const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./index.esm-t-I0eIE7.js","./index.esm2017-fiTcnZeA.js","./index.esm-DslbCide.js","./index.esm2017-DUb48Dq2.js"])))=>i.map(i=>d[i]);
(function(){const A=document.createElement("link").relList;if(A&&A.supports&&A.supports("modulepreload"))return;for(const g of document.querySelectorAll('link[rel="modulepreload"]'))i(g);new MutationObserver(g=>{for(const I of g)if(I.type==="childList")for(const n of I.addedNodes)n.tagName==="LINK"&&n.rel==="modulepreload"&&i(n)}).observe(document,{childList:!0,subtree:!0});function e(g){const I={};return g.integrity&&(I.integrity=g.integrity),g.referrerPolicy&&(I.referrerPolicy=g.referrerPolicy),g.crossOrigin==="use-credentials"?I.credentials="include":g.crossOrigin==="anonymous"?I.credentials="omit":I.credentials="same-origin",I}function i(g){if(g.ep)return;g.ep=!0;const I=e(g);fetch(g.href,I)}})();var g6A=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Td(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}function I6A(t){if(Object.prototype.hasOwnProperty.call(t,"__esModule"))return t;var A=t.default;if(typeof A=="function"){var e=function i(){var g=!1;try{g=this instanceof i}catch{}return g?Reflect.construct(A,arguments,this.constructor):A.apply(this,arguments)};e.prototype=A.prototype}else e={};return Object.defineProperty(e,"__esModule",{value:!0}),Object.keys(t).forEach(function(i){var g=Object.getOwnPropertyDescriptor(t,i);Object.defineProperty(e,i,g.get?g:{enumerable:!0,get:function(){return t[i]}})}),e}var A_={exports:{}},uw={};/**
 * @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 q3;function TrA(){if(q3)return uw;q3=1;var t=Symbol.for("react.transitional.element"),A=Symbol.for("react.fragment");function e(i,g,I){var n=null;if(I!==void 0&&(n=""+I),g.key!==void 0&&(n=""+g.key),"key"in g){I={};for(var o in g)o!=="key"&&(I[o]=g[o])}else I=g;return g=I.ref,{$$typeof:t,type:i,key:n,ref:g!==void 0?g:null,props:I}}return uw.Fragment=A,uw.jsx=e,uw.jsxs=e,uw}var x3;function YrA(){return x3||(x3=1,A_.exports=TrA()),A_.exports}var Q=YrA(),e_={exports:{}},yi={};/**
 * @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 T3;function HrA(){if(T3)return yi;T3=1;var t=Symbol.for("react.transitional.element"),A=Symbol.for("react.portal"),e=Symbol.for("react.fragment"),i=Symbol.for("react.strict_mode"),g=Symbol.for("react.profiler"),I=Symbol.for("react.consumer"),n=Symbol.for("react.context"),o=Symbol.for("react.forward_ref"),a=Symbol.for("react.suspense"),r=Symbol.for("react.memo"),s=Symbol.for("react.lazy"),B=Symbol.for("react.activity"),c=Symbol.iterator;function E(z){return z===null||typeof z!="object"?null:(z=c&&z[c]||z["@@iterator"],typeof z=="function"?z:null)}var D={isMounted:function(){return!1},enqueueForceUpdate:function(){},enqueueReplaceState:function(){},enqueueSetState:function(){}},y=Object.assign,S={};function f(z,X,sA){this.props=z,this.context=X,this.refs=S,this.updater=sA||D}f.prototype.isReactComponent={},f.prototype.setState=function(z,X){if(typeof z!="object"&&typeof z!="function"&&z!=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,z,X,"setState")},f.prototype.forceUpdate=function(z){this.updater.enqueueForceUpdate(this,z,"forceUpdate")};function M(){}M.prototype=f.prototype;function k(z,X,sA){this.props=z,this.context=X,this.refs=S,this.updater=sA||D}var m=k.prototype=new M;m.constructor=k,y(m,f.prototype),m.isPureReactComponent=!0;var U=Array.isArray;function F(){}var b={H:null,A:null,T:null,S:null},K=Object.prototype.hasOwnProperty;function R(z,X,sA){var rA=sA.ref;return{$$typeof:t,type:z,key:X,ref:rA!==void 0?rA:null,props:sA}}function G(z,X){return R(z.type,X,z.props)}function J(z){return typeof z=="object"&&z!==null&&z.$$typeof===t}function x(z){var X={"=":"=0",":":"=2"};return"$"+z.replace(/[=:]/g,function(sA){return X[sA]})}var H=/\/+/g;function P(z,X){return typeof z=="object"&&z!==null&&z.key!=null?x(""+z.key):X.toString(36)}function j(z){switch(z.status){case"fulfilled":return z.value;case"rejected":throw z.reason;default:switch(typeof z.status=="string"?z.then(F,F):(z.status="pending",z.then(function(X){z.status==="pending"&&(z.status="fulfilled",z.value=X)},function(X){z.status==="pending"&&(z.status="rejected",z.reason=X)})),z.status){case"fulfilled":return z.value;case"rejected":throw z.reason}}throw z}function q(z,X,sA,rA,mA){var IA=typeof z;(IA==="undefined"||IA==="boolean")&&(z=null);var uA=!1;if(z===null)uA=!0;else switch(IA){case"bigint":case"string":case"number":uA=!0;break;case"object":switch(z.$$typeof){case t:case A:uA=!0;break;case s:return uA=z._init,q(uA(z._payload),X,sA,rA,mA)}}if(uA)return mA=mA(z),uA=rA===""?"."+P(z,0):rA,U(mA)?(sA="",uA!=null&&(sA=uA.replace(H,"$&/")+"/"),q(mA,X,sA,"",function(RA){return RA})):mA!=null&&(J(mA)&&(mA=G(mA,sA+(mA.key==null||z&&z.key===mA.key?"":(""+mA.key).replace(H,"$&/")+"/")+uA)),X.push(mA)),1;uA=0;var KA=rA===""?".":rA+":";if(U(z))for(var FA=0;FA<z.length;FA++)rA=z[FA],IA=KA+P(rA,FA),uA+=q(rA,X,sA,IA,mA);else if(FA=E(z),typeof FA=="function")for(z=FA.call(z),FA=0;!(rA=z.next()).done;)rA=rA.value,IA=KA+P(rA,FA++),uA+=q(rA,X,sA,IA,mA);else if(IA==="object"){if(typeof z.then=="function")return q(j(z),X,sA,rA,mA);throw X=String(z),Error("Objects are not valid as a React child (found: "+(X==="[object Object]"?"object with keys {"+Object.keys(z).join(", ")+"}":X)+"). If you meant to render a collection of children, use an array instead.")}return uA}function Y(z,X,sA){if(z==null)return z;var rA=[],mA=0;return q(z,rA,"","",function(IA){return X.call(sA,IA,mA++)}),rA}function O(z){if(z._status===-1){var X=z._result;X=X(),X.then(function(sA){(z._status===0||z._status===-1)&&(z._status=1,z._result=sA)},function(sA){(z._status===0||z._status===-1)&&(z._status=2,z._result=sA)}),z._status===-1&&(z._status=0,z._result=X)}if(z._status===1)return z._result.default;throw z._result}var $=typeof reportError=="function"?reportError:function(z){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var X=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof z=="object"&&z!==null&&typeof z.message=="string"?String(z.message):String(z),error:z});if(!window.dispatchEvent(X))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",z);return}},gA={map:Y,forEach:function(z,X,sA){Y(z,function(){X.apply(this,arguments)},sA)},count:function(z){var X=0;return Y(z,function(){X++}),X},toArray:function(z){return Y(z,function(X){return X})||[]},only:function(z){if(!J(z))throw Error("React.Children.only expected to receive a single React element child.");return z}};return yi.Activity=B,yi.Children=gA,yi.Component=f,yi.Fragment=e,yi.Profiler=g,yi.PureComponent=k,yi.StrictMode=i,yi.Suspense=a,yi.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=b,yi.__COMPILER_RUNTIME={__proto__:null,c:function(z){return b.H.useMemoCache(z)}},yi.cache=function(z){return function(){return z.apply(null,arguments)}},yi.cacheSignal=function(){return null},yi.cloneElement=function(z,X,sA){if(z==null)throw Error("The argument must be a React element, but you passed "+z+".");var rA=y({},z.props),mA=z.key;if(X!=null)for(IA in X.key!==void 0&&(mA=""+X.key),X)!K.call(X,IA)||IA==="key"||IA==="__self"||IA==="__source"||IA==="ref"&&X.ref===void 0||(rA[IA]=X[IA]);var IA=arguments.length-2;if(IA===1)rA.children=sA;else if(1<IA){for(var uA=Array(IA),KA=0;KA<IA;KA++)uA[KA]=arguments[KA+2];rA.children=uA}return R(z.type,mA,rA)},yi.createContext=function(z){return z={$$typeof:n,_currentValue:z,_currentValue2:z,_threadCount:0,Provider:null,Consumer:null},z.Provider=z,z.Consumer={$$typeof:I,_context:z},z},yi.createElement=function(z,X,sA){var rA,mA={},IA=null;if(X!=null)for(rA in X.key!==void 0&&(IA=""+X.key),X)K.call(X,rA)&&rA!=="key"&&rA!=="__self"&&rA!=="__source"&&(mA[rA]=X[rA]);var uA=arguments.length-2;if(uA===1)mA.children=sA;else if(1<uA){for(var KA=Array(uA),FA=0;FA<uA;FA++)KA[FA]=arguments[FA+2];mA.children=KA}if(z&&z.defaultProps)for(rA in uA=z.defaultProps,uA)mA[rA]===void 0&&(mA[rA]=uA[rA]);return R(z,IA,mA)},yi.createRef=function(){return{current:null}},yi.forwardRef=function(z){return{$$typeof:o,render:z}},yi.isValidElement=J,yi.lazy=function(z){return{$$typeof:s,_payload:{_status:-1,_result:z},_init:O}},yi.memo=function(z,X){return{$$typeof:r,type:z,compare:X===void 0?null:X}},yi.startTransition=function(z){var X=b.T,sA={};b.T=sA;try{var rA=z(),mA=b.S;mA!==null&&mA(sA,rA),typeof rA=="object"&&rA!==null&&typeof rA.then=="function"&&rA.then(F,$)}catch(IA){$(IA)}finally{X!==null&&sA.types!==null&&(X.types=sA.types),b.T=X}},yi.unstable_useCacheRefresh=function(){return b.H.useCacheRefresh()},yi.use=function(z){return b.H.use(z)},yi.useActionState=function(z,X,sA){return b.H.useActionState(z,X,sA)},yi.useCallback=function(z,X){return b.H.useCallback(z,X)},yi.useContext=function(z){return b.H.useContext(z)},yi.useDebugValue=function(){},yi.useDeferredValue=function(z,X){return b.H.useDeferredValue(z,X)},yi.useEffect=function(z,X){return b.H.useEffect(z,X)},yi.useEffectEvent=function(z){return b.H.useEffectEvent(z)},yi.useId=function(){return b.H.useId()},yi.useImperativeHandle=function(z,X,sA){return b.H.useImperativeHandle(z,X,sA)},yi.useInsertionEffect=function(z,X){return b.H.useInsertionEffect(z,X)},yi.useLayoutEffect=function(z,X){return b.H.useLayoutEffect(z,X)},yi.useMemo=function(z,X){return b.H.useMemo(z,X)},yi.useOptimistic=function(z,X){return b.H.useOptimistic(z,X)},yi.useReducer=function(z,X,sA){return b.H.useReducer(z,X,sA)},yi.useRef=function(z){return b.H.useRef(z)},yi.useState=function(z){return b.H.useState(z)},yi.useSyncExternalStore=function(z,X,sA){return b.H.useSyncExternalStore(z,X,sA)},yi.useTransition=function(){return b.H.useTransition()},yi.version="19.2.0",yi}var Y3;function Ry(){return Y3||(Y3=1,e_.exports=HrA()),e_.exports}var p=Ry();const ke=Td(p);var t_={exports:{}},hw={},i_={exports:{}},g_={};/**
 * @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 H3;function OrA(){return H3||(H3=1,function(t){function A(q,Y){var O=q.length;q.push(Y);A:for(;0<O;){var $=O-1>>>1,gA=q[$];if(0<g(gA,Y))q[$]=Y,q[O]=gA,O=$;else break A}}function e(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var Y=q[0],O=q.pop();if(O!==Y){q[0]=O;A:for(var $=0,gA=q.length,z=gA>>>1;$<z;){var X=2*($+1)-1,sA=q[X],rA=X+1,mA=q[rA];if(0>g(sA,O))rA<gA&&0>g(mA,sA)?(q[$]=mA,q[rA]=O,$=rA):(q[$]=sA,q[X]=O,$=X);else if(rA<gA&&0>g(mA,O))q[$]=mA,q[rA]=O,$=rA;else break A}}return Y}function g(q,Y){var O=q.sortIndex-Y.sortIndex;return O!==0?O: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 n=Date,o=n.now();t.unstable_now=function(){return n.now()-o}}var a=[],r=[],s=1,B=null,c=3,E=!1,D=!1,y=!1,S=!1,f=typeof setTimeout=="function"?setTimeout:null,M=typeof clearTimeout=="function"?clearTimeout:null,k=typeof setImmediate<"u"?setImmediate:null;function m(q){for(var Y=e(r);Y!==null;){if(Y.callback===null)i(r);else if(Y.startTime<=q)i(r),Y.sortIndex=Y.expirationTime,A(a,Y);else break;Y=e(r)}}function U(q){if(y=!1,m(q),!D)if(e(a)!==null)D=!0,F||(F=!0,x());else{var Y=e(r);Y!==null&&j(U,Y.startTime-q)}}var F=!1,b=-1,K=5,R=-1;function G(){return S?!0:!(t.unstable_now()-R<K)}function J(){if(S=!1,F){var q=t.unstable_now();R=q;var Y=!0;try{A:{D=!1,y&&(y=!1,M(b),b=-1),E=!0;var O=c;try{e:{for(m(q),B=e(a);B!==null&&!(B.expirationTime>q&&G());){var $=B.callback;if(typeof $=="function"){B.callback=null,c=B.priorityLevel;var gA=$(B.expirationTime<=q);if(q=t.unstable_now(),typeof gA=="function"){B.callback=gA,m(q),Y=!0;break e}B===e(a)&&i(a),m(q)}else i(a);B=e(a)}if(B!==null)Y=!0;else{var z=e(r);z!==null&&j(U,z.startTime-q),Y=!1}}break A}finally{B=null,c=O,E=!1}Y=void 0}}finally{Y?x():F=!1}}}var x;if(typeof k=="function")x=function(){k(J)};else if(typeof MessageChannel<"u"){var H=new MessageChannel,P=H.port2;H.port1.onmessage=J,x=function(){P.postMessage(null)}}else x=function(){f(J,0)};function j(q,Y){b=f(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||(K=0<q?Math.floor(1e3/q):5)},t.unstable_getCurrentPriorityLevel=function(){return c},t.unstable_next=function(q){switch(c){case 1:case 2:case 3:var Y=3;break;default:Y=c}var O=c;c=Y;try{return q()}finally{c=O}},t.unstable_requestPaint=function(){S=!0},t.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var O=c;c=q;try{return Y()}finally{c=O}},t.unstable_scheduleCallback=function(q,Y,O){var $=t.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?$+O:$):O=$,q){case 1:var gA=-1;break;case 2:gA=250;break;case 5:gA=1073741823;break;case 4:gA=1e4;break;default:gA=5e3}return gA=O+gA,q={id:s++,callback:Y,priorityLevel:q,startTime:O,expirationTime:gA,sortIndex:-1},O>$?(q.sortIndex=O,A(r,q),e(a)===null&&q===e(r)&&(y?(M(b),b=-1):y=!0,j(U,O-$))):(q.sortIndex=gA,A(a,q),D||E||(D=!0,F||(F=!0,x()))),q},t.unstable_shouldYield=G,t.unstable_wrapCallback=function(q){var Y=c;return function(){var O=c;c=Y;try{return q.apply(this,arguments)}finally{c=O}}}}(g_)),g_}var O3;function PrA(){return O3||(O3=1,i_.exports=OrA()),i_.exports}var I_={exports:{}},Ca={};/**
 * @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 P3;function jrA(){if(P3)return Ca;P3=1;var t=Ry();function A(a){var r="https://react.dev/errors/"+a;if(1<arguments.length){r+="?args[]="+encodeURIComponent(arguments[1]);for(var s=2;s<arguments.length;s++)r+="&args[]="+encodeURIComponent(arguments[s])}return"Minified React error #"+a+"; visit "+r+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function e(){}var i={d:{f:e,r:function(){throw Error(A(522))},D:e,C:e,L:e,m:e,X:e,S:e,M:e},p:0,findDOMNode:null},g=Symbol.for("react.portal");function I(a,r,s){var B=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:g,key:B==null?null:""+B,children:a,containerInfo:r,implementation:s}}var n=t.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE;function o(a,r){if(a==="font")return"";if(typeof r=="string")return r==="use-credentials"?r:""}return Ca.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE=i,Ca.createPortal=function(a,r){var s=2<arguments.length&&arguments[2]!==void 0?arguments[2]:null;if(!r||r.nodeType!==1&&r.nodeType!==9&&r.nodeType!==11)throw Error(A(299));return I(a,r,null,s)},Ca.flushSync=function(a){var r=n.T,s=i.p;try{if(n.T=null,i.p=2,a)return a()}finally{n.T=r,i.p=s,i.d.f()}},Ca.preconnect=function(a,r){typeof a=="string"&&(r?(r=r.crossOrigin,r=typeof r=="string"?r==="use-credentials"?r:"":void 0):r=null,i.d.C(a,r))},Ca.prefetchDNS=function(a){typeof a=="string"&&i.d.D(a)},Ca.preinit=function(a,r){if(typeof a=="string"&&r&&typeof r.as=="string"){var s=r.as,B=o(s,r.crossOrigin),c=typeof r.integrity=="string"?r.integrity:void 0,E=typeof r.fetchPriority=="string"?r.fetchPriority:void 0;s==="style"?i.d.S(a,typeof r.precedence=="string"?r.precedence:void 0,{crossOrigin:B,integrity:c,fetchPriority:E}):s==="script"&&i.d.X(a,{crossOrigin:B,integrity:c,fetchPriority:E,nonce:typeof r.nonce=="string"?r.nonce:void 0})}},Ca.preinitModule=function(a,r){if(typeof a=="string")if(typeof r=="object"&&r!==null){if(r.as==null||r.as==="script"){var s=o(r.as,r.crossOrigin);i.d.M(a,{crossOrigin:s,integrity:typeof r.integrity=="string"?r.integrity:void 0,nonce:typeof r.nonce=="string"?r.nonce:void 0})}}else r==null&&i.d.M(a)},Ca.preload=function(a,r){if(typeof a=="string"&&typeof r=="object"&&r!==null&&typeof r.as=="string"){var s=r.as,B=o(s,r.crossOrigin);i.d.L(a,s,{crossOrigin:B,integrity:typeof r.integrity=="string"?r.integrity:void 0,nonce:typeof r.nonce=="string"?r.nonce:void 0,type:typeof r.type=="string"?r.type:void 0,fetchPriority:typeof r.fetchPriority=="string"?r.fetchPriority:void 0,referrerPolicy:typeof r.referrerPolicy=="string"?r.referrerPolicy:void 0,imageSrcSet:typeof r.imageSrcSet=="string"?r.imageSrcSet:void 0,imageSizes:typeof r.imageSizes=="string"?r.imageSizes:void 0,media:typeof r.media=="string"?r.media:void 0})}},Ca.preloadModule=function(a,r){if(typeof a=="string")if(r){var s=o(r.as,r.crossOrigin);i.d.m(a,{as:typeof r.as=="string"&&r.as!=="script"?r.as:void 0,crossOrigin:s,integrity:typeof r.integrity=="string"?r.integrity:void 0})}else i.d.m(a)},Ca.requestFormReset=function(a){i.d.r(a)},Ca.unstable_batchedUpdates=function(a,r){return a(r)},Ca.useFormState=function(a,r,s){return n.H.useFormState(a,r,s)},Ca.useFormStatus=function(){return n.H.useHostTransitionStatus()},Ca.version="19.2.0",Ca}var j3;function FX(){if(j3)return I_.exports;j3=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(),I_.exports=jrA(),I_.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 Z3;function ZrA(){if(Z3)return hw;Z3=1;var t=PrA(),A=Ry(),e=FX();function i(C){var l="https://react.dev/errors/"+C;if(1<arguments.length){l+="?args[]="+encodeURIComponent(arguments[1]);for(var d=2;d<arguments.length;d++)l+="&args[]="+encodeURIComponent(arguments[d])}return"Minified React error #"+C+"; visit "+l+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function g(C){return!(!C||C.nodeType!==1&&C.nodeType!==9&&C.nodeType!==11)}function I(C){var l=C,d=C;if(C.alternate)for(;l.return;)l=l.return;else{C=l;do l=C,(l.flags&4098)!==0&&(d=l.return),C=l.return;while(C)}return l.tag===3?d:null}function n(C){if(C.tag===13){var l=C.memoizedState;if(l===null&&(C=C.alternate,C!==null&&(l=C.memoizedState)),l!==null)return l.dehydrated}return null}function o(C){if(C.tag===31){var l=C.memoizedState;if(l===null&&(C=C.alternate,C!==null&&(l=C.memoizedState)),l!==null)return l.dehydrated}return null}function a(C){if(I(C)!==C)throw Error(i(188))}function r(C){var l=C.alternate;if(!l){if(l=I(C),l===null)throw Error(i(188));return l!==C?null:C}for(var d=C,w=l;;){var v=d.return;if(v===null)break;var L=v.alternate;if(L===null){if(w=v.return,w!==null){d=w;continue}break}if(v.child===L.child){for(L=v.child;L;){if(L===d)return a(v),C;if(L===w)return a(v),l;L=L.sibling}throw Error(i(188))}if(d.return!==w.return)d=v,w=L;else{for(var V=!1,BA=v.child;BA;){if(BA===d){V=!0,d=v,w=L;break}if(BA===w){V=!0,w=v,d=L;break}BA=BA.sibling}if(!V){for(BA=L.child;BA;){if(BA===d){V=!0,d=L,w=v;break}if(BA===w){V=!0,w=L,d=v;break}BA=BA.sibling}if(!V)throw Error(i(189))}}if(d.alternate!==w)throw Error(i(190))}if(d.tag!==3)throw Error(i(188));return d.stateNode.current===d?C:l}function s(C){var l=C.tag;if(l===5||l===26||l===27||l===6)return C;for(C=C.child;C!==null;){if(l=s(C),l!==null)return l;C=C.sibling}return null}var B=Object.assign,c=Symbol.for("react.element"),E=Symbol.for("react.transitional.element"),D=Symbol.for("react.portal"),y=Symbol.for("react.fragment"),S=Symbol.for("react.strict_mode"),f=Symbol.for("react.profiler"),M=Symbol.for("react.consumer"),k=Symbol.for("react.context"),m=Symbol.for("react.forward_ref"),U=Symbol.for("react.suspense"),F=Symbol.for("react.suspense_list"),b=Symbol.for("react.memo"),K=Symbol.for("react.lazy"),R=Symbol.for("react.activity"),G=Symbol.for("react.memo_cache_sentinel"),J=Symbol.iterator;function x(C){return C===null||typeof C!="object"?null:(C=J&&C[J]||C["@@iterator"],typeof C=="function"?C:null)}var H=Symbol.for("react.client.reference");function P(C){if(C==null)return null;if(typeof C=="function")return C.$$typeof===H?null:C.displayName||C.name||null;if(typeof C=="string")return C;switch(C){case y:return"Fragment";case f:return"Profiler";case S:return"StrictMode";case U:return"Suspense";case F:return"SuspenseList";case R:return"Activity"}if(typeof C=="object")switch(C.$$typeof){case D:return"Portal";case k:return C.displayName||"Context";case M:return(C._context.displayName||"Context")+".Consumer";case m:var l=C.render;return C=C.displayName,C||(C=l.displayName||l.name||"",C=C!==""?"ForwardRef("+C+")":"ForwardRef"),C;case b:return l=C.displayName||null,l!==null?l:P(C.type)||"Memo";case K:l=C._payload,C=C._init;try{return P(C(l))}catch{}}return null}var j=Array.isArray,q=A.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Y=e.__DOM_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,O={pending:!1,data:null,method:null,action:null},$=[],gA=-1;function z(C){return{current:C}}function X(C){0>gA||(C.current=$[gA],$[gA]=null,gA--)}function sA(C,l){gA++,$[gA]=C.current,C.current=l}var rA=z(null),mA=z(null),IA=z(null),uA=z(null);function KA(C,l){switch(sA(IA,l),sA(mA,C),sA(rA,null),l.nodeType){case 9:case 11:C=(C=l.documentElement)&&(C=C.namespaceURI)?r3(C):0;break;default:if(C=l.tagName,l=l.namespaceURI)l=r3(l),C=s3(l,C);else switch(C){case"svg":C=1;break;case"math":C=2;break;default:C=0}}X(rA),sA(rA,C)}function FA(){X(rA),X(mA),X(IA)}function RA(C){C.memoizedState!==null&&sA(uA,C);var l=rA.current,d=s3(l,C.type);l!==d&&(sA(mA,C),sA(rA,d))}function MA(C){mA.current===C&&(X(rA),X(mA)),uA.current===C&&(X(uA),cw._currentValue=O)}var oA,AA;function tA(C){if(oA===void 0)try{throw Error()}catch(d){var l=d.stack.trim().match(/\n( *(at )?)/);oA=l&&l[1]||"",AA=-1<d.stack.indexOf(`
    at`)?" (<anonymous>)":-1<d.stack.indexOf("@")?"@unknown:0:0":""}return`
`+oA+C+AA}var iA=!1;function hA(C,l){if(!C||iA)return"";iA=!0;var d=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var w={DetermineComponentFrameRoot:function(){try{if(l){var He=function(){throw Error()};if(Object.defineProperty(He.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(He,[])}catch(Ue){var me=Ue}Reflect.construct(C,[],He)}else{try{He.call()}catch(Ue){me=Ue}C.call(He.prototype)}}else{try{throw Error()}catch(Ue){me=Ue}(He=C())&&typeof He.catch=="function"&&He.catch(function(){})}}catch(Ue){if(Ue&&me&&typeof Ue.stack=="string")return[Ue.stack,me.stack]}return[null,null]}};w.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var v=Object.getOwnPropertyDescriptor(w.DetermineComponentFrameRoot,"name");v&&v.configurable&&Object.defineProperty(w.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var L=w.DetermineComponentFrameRoot(),V=L[0],BA=L[1];if(V&&BA){var YA=V.split(`
`),De=BA.split(`
`);for(v=w=0;w<YA.length&&!YA[w].includes("DetermineComponentFrameRoot");)w++;for(;v<De.length&&!De[v].includes("DetermineComponentFrameRoot");)v++;if(w===YA.length||v===De.length)for(w=YA.length-1,v=De.length-1;1<=w&&0<=v&&YA[w]!==De[v];)v--;for(;1<=w&&0<=v;w--,v--)if(YA[w]!==De[v]){if(w!==1||v!==1)do if(w--,v--,0>v||YA[w]!==De[v]){var Je=`
`+YA[w].replace(" at new "," at ");return C.displayName&&Je.includes("<anonymous>")&&(Je=Je.replace("<anonymous>",C.displayName)),Je}while(1<=w&&0<=v);break}}}finally{iA=!1,Error.prepareStackTrace=d}return(d=C?C.displayName||C.name:"")?tA(d):""}function DA(C,l){switch(C.tag){case 26:case 27:case 5:return tA(C.type);case 16:return tA("Lazy");case 13:return C.child!==l&&l!==null?tA("Suspense Fallback"):tA("Suspense");case 19:return tA("SuspenseList");case 0:case 15:return hA(C.type,!1);case 11:return hA(C.type.render,!1);case 1:return hA(C.type,!0);case 31:return tA("Activity");default:return""}}function dA(C){try{var l="",d=null;do l+=DA(C,d),d=C,C=C.return;while(C);return l}catch(w){return`
Error generating stack: `+w.message+`
`+w.stack}}var SA=Object.prototype.hasOwnProperty,NA=t.unstable_scheduleCallback,OA=t.unstable_cancelCallback,Qe=t.unstable_shouldYield,nA=t.unstable_requestPaint,eA=t.unstable_now,UA=t.unstable_getCurrentPriorityLevel,HA=t.unstable_ImmediatePriority,Se=t.unstable_UserBlockingPriority,ne=t.unstable_NormalPriority,Oe=t.unstable_LowPriority,VA=t.unstable_IdlePriority,de=t.log,te=t.unstable_setDisableYieldValue,WA=null,_A=null;function zA(C){if(typeof de=="function"&&te(C),_A&&typeof _A.setStrictMode=="function")try{_A.setStrictMode(WA,C)}catch{}}var ge=Math.clz32?Math.clz32:bA,he=Math.log,ve=Math.LN2;function bA(C){return C>>>=0,C===0?32:31-(he(C)/ve|0)|0}var pA=256,Re=262144,CA=4194304;function EA(C){var l=C&42;if(l!==0)return l;switch(C&-C){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 C&261888;case 262144:case 524288:case 1048576:case 2097152:return C&3932160;case 4194304:case 8388608:case 16777216:case 33554432:return C&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return C}}function yA(C,l,d){var w=C.pendingLanes;if(w===0)return 0;var v=0,L=C.suspendedLanes,V=C.pingedLanes;C=C.warmLanes;var BA=w&134217727;return BA!==0?(w=BA&~L,w!==0?v=EA(w):(V&=BA,V!==0?v=EA(V):d||(d=BA&~C,d!==0&&(v=EA(d))))):(BA=w&~L,BA!==0?v=EA(BA):V!==0?v=EA(V):d||(d=w&~C,d!==0&&(v=EA(d)))),v===0?0:l!==0&&l!==v&&(l&L)===0&&(L=v&-v,d=l&-l,L>=d||L===32&&(d&4194048)!==0)?l:v}function xA(C,l){return(C.pendingLanes&~(C.suspendedLanes&~C.pingedLanes)&l)===0}function XA(C,l){switch(C){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 pe(){var C=CA;return CA<<=1,(CA&62914560)===0&&(CA=4194304),C}function be(C){for(var l=[],d=0;31>d;d++)l.push(C);return l}function It(C,l){C.pendingLanes|=l,l!==268435456&&(C.suspendedLanes=0,C.pingedLanes=0,C.warmLanes=0)}function Ut(C,l,d,w,v,L){var V=C.pendingLanes;C.pendingLanes=d,C.suspendedLanes=0,C.pingedLanes=0,C.warmLanes=0,C.expiredLanes&=d,C.entangledLanes&=d,C.errorRecoveryDisabledLanes&=d,C.shellSuspendCounter=0;var BA=C.entanglements,YA=C.expirationTimes,De=C.hiddenUpdates;for(d=V&~d;0<d;){var Je=31-ge(d),He=1<<Je;BA[Je]=0,YA[Je]=-1;var me=De[Je];if(me!==null)for(De[Je]=null,Je=0;Je<me.length;Je++){var Ue=me[Je];Ue!==null&&(Ue.lane&=-536870913)}d&=~He}w!==0&&pg(C,w,0),L!==0&&v===0&&C.tag!==0&&(C.suspendedLanes|=L&~(V&~l))}function pg(C,l,d){C.pendingLanes|=l,C.suspendedLanes&=~l;var w=31-ge(l);C.entangledLanes|=l,C.entanglements[w]=C.entanglements[w]|1073741824|d&261930}function Ge(C,l){var d=C.entangledLanes|=l;for(C=C.entanglements;d;){var w=31-ge(d),v=1<<w;v&l|C[w]&l&&(C[w]|=l),d&=~v}}function lt(C,l){var d=l&-l;return d=(d&42)!==0?1:Rt(d),(d&(C.suspendedLanes|l))!==0?0:d}function Rt(C){switch(C){case 2:C=1;break;case 8:C=4;break;case 32:C=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:C=128;break;case 268435456:C=134217728;break;default:C=0}return C}function Yt(C){return C&=-C,2<C?8<C?(C&134217727)!==0?32:268435456:8:2}function st(){var C=Y.p;return C!==0?C:(C=window.event,C===void 0?32:K3(C.type))}function Be(C,l){var d=Y.p;try{return Y.p=C,l()}finally{Y.p=d}}var jA=Math.random().toString(36).slice(2),Me="__reactFiber$"+jA,We="__reactProps$"+jA,at="__reactContainer$"+jA,kA="__reactEvents$"+jA,ae="__reactListeners$"+jA,Ye="__reactHandles$"+jA,Pt="__reactResources$"+jA,jt="__reactMarker$"+jA;function aA(C){delete C[Me],delete C[We],delete C[kA],delete C[ae],delete C[Ye]}function QA(C){var l=C[Me];if(l)return l;for(var d=C.parentNode;d;){if(l=d[at]||d[Me]){if(d=l.alternate,l.child!==null||d!==null&&d.child!==null)for(C=u3(C);C!==null;){if(d=C[Me])return d;C=u3(C)}return l}C=d,d=C.parentNode}return null}function JA(C){if(C=C[Me]||C[at]){var l=C.tag;if(l===5||l===6||l===13||l===31||l===26||l===27||l===3)return C}return null}function ee(C){var l=C.tag;if(l===5||l===26||l===27||l===6)return C.stateNode;throw Error(i(33))}function GA(C){var l=C[Pt];return l||(l=C[Pt]={hoistableStyles:new Map,hoistableScripts:new Map}),l}function oe(C){C[jt]=!0}var Xe=new Set,Qt={};function nt(C,l){Dt(C,l),Dt(C+"Capture",l)}function Dt(C,l){for(Qt[C]=l,C=0;C<l.length;C++)Xe.add(l[C])}var it=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]*$"),Mt={},Zt={};function Ri(C){return SA.call(Zt,C)?!0:SA.call(Mt,C)?!1:it.test(C)?Zt[C]=!0:(Mt[C]=!0,!1)}function Ui(C,l,d){if(Ri(l))if(d===null)C.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":C.removeAttribute(l);return;case"boolean":var w=l.toLowerCase().slice(0,5);if(w!=="data-"&&w!=="aria-"){C.removeAttribute(l);return}}C.setAttribute(l,""+d)}}function qi(C,l,d){if(d===null)C.removeAttribute(l);else{switch(typeof d){case"undefined":case"function":case"symbol":case"boolean":C.removeAttribute(l);return}C.setAttribute(l,""+d)}}function ei(C,l,d,w){if(w===null)C.removeAttribute(d);else{switch(typeof w){case"undefined":case"function":case"symbol":case"boolean":C.removeAttribute(d);return}C.setAttributeNS(l,d,""+w)}}function yt(C){switch(typeof C){case"bigint":case"boolean":case"number":case"string":case"undefined":return C;case"object":return C;default:return""}}function Si(C){var l=C.type;return(C=C.nodeName)&&C.toLowerCase()==="input"&&(l==="checkbox"||l==="radio")}function ti(C,l,d){var w=Object.getOwnPropertyDescriptor(C.constructor.prototype,l);if(!C.hasOwnProperty(l)&&typeof w<"u"&&typeof w.get=="function"&&typeof w.set=="function"){var v=w.get,L=w.set;return Object.defineProperty(C,l,{configurable:!0,get:function(){return v.call(this)},set:function(V){d=""+V,L.call(this,V)}}),Object.defineProperty(C,l,{enumerable:w.enumerable}),{getValue:function(){return d},setValue:function(V){d=""+V},stopTracking:function(){C._valueTracker=null,delete C[l]}}}}function Xg(C){if(!C._valueTracker){var l=Si(C)?"checked":"value";C._valueTracker=ti(C,l,""+C[l])}}function cI(C){if(!C)return!1;var l=C._valueTracker;if(!l)return!0;var d=l.getValue(),w="";return C&&(w=Si(C)?C.checked?"true":"false":C.value),C=w,C!==d?(l.setValue(C),!0):!1}function bg(C){if(C=C||(typeof document<"u"?document:void 0),typeof C>"u")return null;try{return C.activeElement||C.body}catch{return C.body}}var yo=/[\n"\\]/g;function ci(C){return C.replace(yo,function(l){return"\\"+l.charCodeAt(0).toString(16)+" "})}function vg(C,l,d,w,v,L,V,BA){C.name="",V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"?C.type=V:C.removeAttribute("type"),l!=null?V==="number"?(l===0&&C.value===""||C.value!=l)&&(C.value=""+yt(l)):C.value!==""+yt(l)&&(C.value=""+yt(l)):V!=="submit"&&V!=="reset"||C.removeAttribute("value"),l!=null?fg(C,V,yt(l)):d!=null?fg(C,V,yt(d)):w!=null&&C.removeAttribute("value"),v==null&&L!=null&&(C.defaultChecked=!!L),v!=null&&(C.checked=v&&typeof v!="function"&&typeof v!="symbol"),BA!=null&&typeof BA!="function"&&typeof BA!="symbol"&&typeof BA!="boolean"?C.name=""+yt(BA):C.removeAttribute("name")}function Zg(C,l,d,w,v,L,V,BA){if(L!=null&&typeof L!="function"&&typeof L!="symbol"&&typeof L!="boolean"&&(C.type=L),l!=null||d!=null){if(!(L!=="submit"&&L!=="reset"||l!=null)){Xg(C);return}d=d!=null?""+yt(d):"",l=l!=null?""+yt(l):d,BA||l===C.value||(C.value=l),C.defaultValue=l}w=w??v,w=typeof w!="function"&&typeof w!="symbol"&&!!w,C.checked=BA?C.checked:!!w,C.defaultChecked=!!w,V!=null&&typeof V!="function"&&typeof V!="symbol"&&typeof V!="boolean"&&(C.name=V),Xg(C)}function fg(C,l,d){l==="number"&&bg(C.ownerDocument)===C||C.defaultValue===""+d||(C.defaultValue=""+d)}function kg(C,l,d,w){if(C=C.options,l){l={};for(var v=0;v<d.length;v++)l["$"+d[v]]=!0;for(d=0;d<C.length;d++)v=l.hasOwnProperty("$"+C[d].value),C[d].selected!==v&&(C[d].selected=v),v&&w&&(C[d].defaultSelected=!0)}else{for(d=""+yt(d),l=null,v=0;v<C.length;v++){if(C[v].value===d){C[v].selected=!0,w&&(C[v].defaultSelected=!0);return}l!==null||C[v].disabled||(l=C[v])}l!==null&&(l.selected=!0)}}function Qn(C,l,d){if(l!=null&&(l=""+yt(l),l!==C.value&&(C.value=l),d==null)){C.defaultValue!==l&&(C.defaultValue=l);return}C.defaultValue=d!=null?""+yt(d):""}function fI(C,l,d,w){if(l==null){if(w!=null){if(d!=null)throw Error(i(92));if(j(w)){if(1<w.length)throw Error(i(93));w=w[0]}d=w}d==null&&(d=""),l=d}d=yt(l),C.defaultValue=d,w=C.textContent,w===d&&w!==""&&w!==null&&(C.value=w),Xg(C)}function Ao(C,l){if(l){var d=C.firstChild;if(d&&d===C.lastChild&&d.nodeType===3){d.nodeValue=l;return}}C.textContent=l}var wa=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 sr(C,l,d){var w=l.indexOf("--")===0;d==null||typeof d=="boolean"||d===""?w?C.setProperty(l,""):l==="float"?C.cssFloat="":C[l]="":w?C.setProperty(l,d):typeof d!="number"||d===0||wa.has(l)?l==="float"?C.cssFloat=d:C[l]=(""+d).trim():C[l]=d+"px"}function Ds(C,l,d){if(l!=null&&typeof l!="object")throw Error(i(62));if(C=C.style,d!=null){for(var w in d)!d.hasOwnProperty(w)||l!=null&&l.hasOwnProperty(w)||(w.indexOf("--")===0?C.setProperty(w,""):w==="float"?C.cssFloat="":C[w]="");for(var v in l)w=l[v],l.hasOwnProperty(v)&&d[v]!==w&&sr(C,v,w)}else for(var L in l)l.hasOwnProperty(L)&&sr(C,L,l[L])}function ce(C){if(C.indexOf("-")===-1)return!1;switch(C){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 ze=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"]]),At=/^[\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 ZA(C){return At.test(""+C)?"javascript:throw new Error('React has blocked a javascript: URL as a security precaution.')":C}function Le(){}var $e=null;function Nt(C){return C=C.target||C.srcElement||window,C.correspondingUseElement&&(C=C.correspondingUseElement),C.nodeType===3?C.parentNode:C}var wi=null,Mg=null;function en(C){var l=JA(C);if(l&&(C=l.stateNode)){var d=C[We]||null;A:switch(C=l.stateNode,l.type){case"input":if(vg(C,d.value,d.defaultValue,d.defaultValue,d.checked,d.defaultChecked,d.type,d.name),l=d.name,d.type==="radio"&&l!=null){for(d=C;d.parentNode;)d=d.parentNode;for(d=d.querySelectorAll('input[name="'+ci(""+l)+'"][type="radio"]'),l=0;l<d.length;l++){var w=d[l];if(w!==C&&w.form===C.form){var v=w[We]||null;if(!v)throw Error(i(90));vg(w,v.value,v.defaultValue,v.defaultValue,v.checked,v.defaultChecked,v.type,v.name)}}for(l=0;l<d.length;l++)w=d[l],w.form===C.form&&cI(w)}break A;case"textarea":Qn(C,d.value,d.defaultValue);break A;case"select":l=d.value,l!=null&&kg(C,!!d.multiple,l,!1)}}}var So=!1;function ma(C,l,d){if(So)return C(l,d);So=!0;try{var w=C(l);return w}finally{if(So=!1,(wi!==null||Mg!==null)&&(lA(),wi&&(l=wi,C=Mg,Mg=wi=null,en(l),C)))for(l=0;l<C.length;l++)en(C[l])}}function zo(C,l){var d=C.stateNode;if(d===null)return null;var w=d[We]||null;if(w===null)return null;d=w[l];A:switch(l){case"onClick":case"onClickCapture":case"onDoubleClick":case"onDoubleClickCapture":case"onMouseDown":case"onMouseDownCapture":case"onMouseMove":case"onMouseMoveCapture":case"onMouseUp":case"onMouseUpCapture":case"onMouseEnter":(w=!w.disabled)||(C=C.type,w=!(C==="button"||C==="input"||C==="select"||C==="textarea")),C=!w;break A;default:C=!1}if(C)return null;if(d&&typeof d!="function")throw Error(i(231,l,typeof d));return d}var $g=!(typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"),FB=!1;if($g)try{var DI={};Object.defineProperty(DI,"passive",{get:function(){FB=!0}}),window.addEventListener("test",DI,DI),window.removeEventListener("test",DI,DI)}catch{FB=!1}var ka=null,Ng=null,lI=null;function wo(){if(lI)return lI;var C,l=Ng,d=l.length,w,v="value"in ka?ka.value:ka.textContent,L=v.length;for(C=0;C<d&&l[C]===v[C];C++);var V=d-C;for(w=1;w<=V&&l[d-w]===v[L-w];w++);return lI=v.slice(C,1<w?1-w:void 0)}function bn(C){var l=C.keyCode;return"charCode"in C?(C=C.charCode,C===0&&l===13&&(C=13)):C=l,C===10&&(C=13),32<=C||C===13?C:0}function tn(){return!0}function Tr(){return!1}function Dg(C){function l(d,w,v,L,V){this._reactName=d,this._targetInst=v,this.type=w,this.nativeEvent=L,this.target=V,this.currentTarget=null;for(var BA in C)C.hasOwnProperty(BA)&&(d=C[BA],this[BA]=d?d(L):L[BA]);return this.isDefaultPrevented=(L.defaultPrevented!=null?L.defaultPrevented:L.returnValue===!1)?tn:Tr,this.isPropagationStopped=Tr,this}return B(l.prototype,{preventDefault:function(){this.defaultPrevented=!0;var d=this.nativeEvent;d&&(d.preventDefault?d.preventDefault():typeof d.returnValue!="unknown"&&(d.returnValue=!1),this.isDefaultPrevented=tn)},stopPropagation:function(){var d=this.nativeEvent;d&&(d.stopPropagation?d.stopPropagation():typeof d.cancelBubble!="unknown"&&(d.cancelBubble=!0),this.isPropagationStopped=tn)},persist:function(){},isPersistent:tn}),l}var En={eventPhase:0,bubbles:0,cancelable:0,timeStamp:function(C){return C.timeStamp||Date.now()},defaultPrevented:0,isTrusted:0},Vo=Dg(En),eo=B({},En,{view:0,detail:0}),Al=Dg(eo),DC,ys,Yr,el=B({},eo,{screenX:0,screenY:0,clientX:0,clientY:0,pageX:0,pageY:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,getModifierState:gl,button:0,buttons:0,relatedTarget:function(C){return C.relatedTarget===void 0?C.fromElement===C.srcElement?C.toElement:C.fromElement:C.relatedTarget},movementX:function(C){return"movementX"in C?C.movementX:(C!==Yr&&(Yr&&C.type==="mousemove"?(DC=C.screenX-Yr.screenX,ys=C.screenY-Yr.screenY):ys=DC=0,Yr=C),DC)},movementY:function(C){return"movementY"in C?C.movementY:ys}}),tl=Dg(el),EI=B({},el,{dataTransfer:0}),GQ=Dg(EI),yC=B({},eo,{relatedTarget:0}),SC=Dg(yC),wC=B({},En,{animationName:0,elapsedTime:0,pseudoElement:0}),RQ=Dg(wC),il=B({},En,{clipboardData:function(C){return"clipboardData"in C?C.clipboardData:window.clipboardData}}),bB=Dg(il),Mu=B({},En,{data:0}),vB=Dg(Mu),_B={Esc:"Escape",Spacebar:" ",Left:"ArrowLeft",Up:"ArrowUp",Right:"ArrowRight",Down:"ArrowDown",Del:"Delete",Win:"OS",Menu:"ContextMenu",Apps:"ContextMenu",Scroll:"ScrollLock",MozPrintableKey:"Unidentified"},Nu={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"},Gu={Alt:"altKey",Control:"ctrlKey",Meta:"metaKey",Shift:"shiftKey"};function Ep(C){var l=this.nativeEvent;return l.getModifierState?l.getModifierState(C):(C=Gu[C])?!!l[C]:!1}function gl(){return Ep}var Ru=B({},eo,{key:function(C){if(C.key){var l=_B[C.key]||C.key;if(l!=="Unidentified")return l}return C.type==="keypress"?(C=bn(C),C===13?"Enter":String.fromCharCode(C)):C.type==="keydown"||C.type==="keyup"?Nu[C.keyCode]||"Unidentified":""},code:0,location:0,ctrlKey:0,shiftKey:0,altKey:0,metaKey:0,repeat:0,locale:0,getModifierState:gl,charCode:function(C){return C.type==="keypress"?bn(C):0},keyCode:function(C){return C.type==="keydown"||C.type==="keyup"?C.keyCode:0},which:function(C){return C.type==="keypress"?bn(C):C.type==="keydown"||C.type==="keyup"?C.keyCode:0}}),Uu=Dg(Ru),up=B({},el,{pointerId:0,width:0,height:0,pressure:0,tangentialPressure:0,tiltX:0,tiltY:0,twist:0,pointerType:0,isPrimary:0}),mC=Dg(up),Ku=B({},eo,{touches:0,targetTouches:0,changedTouches:0,altKey:0,metaKey:0,ctrlKey:0,shiftKey:0,getModifierState:gl}),Hr=Dg(Ku),JB=B({},En,{propertyName:0,elapsedTime:0,pseudoElement:0}),fA=Dg(JB),LA=B({},el,{deltaX:function(C){return"deltaX"in C?C.deltaX:"wheelDeltaX"in C?-C.wheelDeltaX:0},deltaY:function(C){return"deltaY"in C?C.deltaY:"wheelDeltaY"in C?-C.wheelDeltaY:"wheelDelta"in C?-C.wheelDelta:0},deltaZ:0,deltaMode:0}),Ae=Dg(LA),Ee=B({},En,{newState:0,oldState:0}),PA=Dg(Ee),Ke=[9,13,27,32],xe=$g&&"CompositionEvent"in window,Ct=null;$g&&"documentMode"in document&&(Ct=document.documentMode);var hi=$g&&"TextEvent"in window&&!Ct,di=$g&&(!xe||Ct&&8<Ct&&11>=Ct),li=" ",_g=!1;function Xo(C,l){switch(C){case"keyup":return Ke.indexOf(l.keyCode)!==-1;case"keydown":return l.keyCode!==229;case"keypress":case"mousedown":case"focusout":return!0;default:return!1}}function Ma(C){return C=C.detail,typeof C=="object"&&"data"in C?C.data:null}var $o=!1;function mo(C,l){switch(C){case"compositionend":return Ma(l);case"keypress":return l.which!==32?null:(_g=!0,li);case"textInput":return C=l.data,C===li&&_g?null:C;default:return null}}function Il(C,l){if($o)return C==="compositionend"||!xe&&Xo(C,l)?(C=wo(),lI=Ng=ka=null,$o=!1,C):null;switch(C){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 di&&l.locale!=="ko"?null:l.data;default:return null}}var to={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 vn(C){var l=C&&C.nodeName&&C.nodeName.toLowerCase();return l==="input"?!!to[C.type]:l==="textarea"}function Or(C,l,d,w){wi?Mg?Mg.push(w):Mg=[w]:wi=w,l=XM(l,"onChange"),0<l.length&&(d=new Vo("onChange","change",null,d,w),C.push({event:d,listeners:l}))}var kC=null,io=null;function Fu(C){i3(C,0)}function nl(C){var l=ee(C);if(cI(l))return C}function rS(C,l){if(C==="change")return l}var bu=!1;if($g){var ol;if($g){var II="oninput"in document;if(!II){var aM=document.createElement("div");aM.setAttribute("oninput","return;"),II=typeof aM.oninput=="function"}ol=II}else ol=!1;bu=ol&&(!document.documentMode||9<document.documentMode)}function rM(){kC&&(kC.detachEvent("onpropertychange",sS),io=kC=null)}function sS(C){if(C.propertyName==="value"&&nl(io)){var l=[];Or(l,io,C,Nt(C)),ma(Fu,l)}}function vu(C,l,d){C==="focusin"?(rM(),kC=l,io=d,kC.attachEvent("onpropertychange",sS)):C==="focusout"&&rM()}function LB(C){if(C==="selectionchange"||C==="keyup"||C==="keydown")return nl(io)}function sM(C,l){if(C==="click")return nl(l)}function CM(C,l){if(C==="input"||C==="change")return nl(l)}function al(C,l){return C===l&&(C!==0||1/C===1/l)||C!==C&&l!==l}var nI=typeof Object.is=="function"?Object.is:al;function UQ(C,l){if(nI(C,l))return!0;if(typeof C!="object"||C===null||typeof l!="object"||l===null)return!1;var d=Object.keys(C),w=Object.keys(l);if(d.length!==w.length)return!1;for(w=0;w<d.length;w++){var v=d[w];if(!SA.call(l,v)||!nI(C[v],l[v]))return!1}return!0}function CS(C){for(;C&&C.firstChild;)C=C.firstChild;return C}function BS(C,l){var d=CS(C);C=0;for(var w;d;){if(d.nodeType===3){if(w=C+d.textContent.length,C<=l&&w>=l)return{node:d,offset:l-C};C=w}A:{for(;d;){if(d.nextSibling){d=d.nextSibling;break A}d=d.parentNode}d=void 0}d=CS(d)}}function hp(C,l){return C&&l?C===l?!0:C&&C.nodeType===3?!1:l&&l.nodeType===3?hp(C,l.parentNode):"contains"in C?C.contains(l):C.compareDocumentPosition?!!(C.compareDocumentPosition(l)&16):!1:!1}function dp(C){C=C!=null&&C.ownerDocument!=null&&C.ownerDocument.defaultView!=null?C.ownerDocument.defaultView:window;for(var l=bg(C.document);l instanceof C.HTMLIFrameElement;){try{var d=typeof l.contentWindow.location.href=="string"}catch{d=!1}if(d)C=l.contentWindow;else break;l=bg(C.document)}return l}function KQ(C){var l=C&&C.nodeName&&C.nodeName.toLowerCase();return l&&(l==="input"&&(C.type==="text"||C.type==="search"||C.type==="tel"||C.type==="url"||C.type==="password")||l==="textarea"||C.contentEditable==="true")}var BM=$g&&"documentMode"in document&&11>=document.documentMode,FQ=null,pp=null,bQ=null,Na=!1;function fp(C,l,d){var w=d.window===d?d.document:d.nodeType===9?d:d.ownerDocument;Na||FQ==null||FQ!==bg(w)||(w=FQ,"selectionStart"in w&&KQ(w)?w={start:w.selectionStart,end:w.selectionEnd}:(w=(w.ownerDocument&&w.ownerDocument.defaultView||window).getSelection(),w={anchorNode:w.anchorNode,anchorOffset:w.anchorOffset,focusNode:w.focusNode,focusOffset:w.focusOffset}),bQ&&UQ(bQ,w)||(bQ=w,w=XM(pp,"onSelect"),0<w.length&&(l=new Vo("onSelect","select",null,l,d),C.push({event:l,listeners:w}),l.target=FQ)))}function qB(C,l){var d={};return d[C.toLowerCase()]=l.toLowerCase(),d["Webkit"+C]="webkit"+l,d["Moz"+C]="moz"+l,d}var vQ={animationend:qB("Animation","AnimationEnd"),animationiteration:qB("Animation","AnimationIteration"),animationstart:qB("Animation","AnimationStart"),transitionrun:qB("Transition","TransitionRun"),transitionstart:qB("Transition","TransitionStart"),transitioncancel:qB("Transition","TransitionCancel"),transitionend:qB("Transition","TransitionEnd")},_u={},ko={};$g&&(ko=document.createElement("div").style,"AnimationEvent"in window||(delete vQ.animationend.animation,delete vQ.animationiteration.animation,delete vQ.animationstart.animation),"TransitionEvent"in window||delete vQ.transitionend.transition);function xB(C){if(_u[C])return _u[C];if(!vQ[C])return C;var l=vQ[C],d;for(d in l)if(l.hasOwnProperty(d)&&d in ko)return _u[C]=l[d];return C}var Aa=xB("animationend"),cS=xB("animationiteration"),Ss=xB("animationstart"),_Q=xB("transitionrun"),TB=xB("transitionstart"),lS=xB("transitioncancel"),Dp=xB("transitionend"),MC=new Map,yp="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(" ");yp.push("scrollEnd");function go(C,l){MC.set(C,l),nt(l,[C])}var YB=typeof reportError=="function"?reportError:function(C){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var l=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof C=="object"&&C!==null&&typeof C.message=="string"?String(C.message):String(C),error:C});if(!window.dispatchEvent(l))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",C);return}},un=[],rl=0,Sp=0;function HB(){for(var C=rl,l=Sp=rl=0;l<C;){var d=un[l];un[l++]=null;var w=un[l];un[l++]=null;var v=un[l];un[l++]=null;var L=un[l];if(un[l++]=null,w!==null&&v!==null){var V=w.pending;V===null?v.next=v:(v.next=V.next,V.next=v),w.pending=v}L!==0&&wp(d,v,L)}}function Ju(C,l,d,w){un[rl++]=C,un[rl++]=l,un[rl++]=d,un[rl++]=w,Sp|=w,C.lanes|=w,C=C.alternate,C!==null&&(C.lanes|=w)}function JQ(C,l,d,w){return Ju(C,l,d,w),LQ(C)}function OB(C,l){return Ju(C,null,null,l),LQ(C)}function wp(C,l,d){C.lanes|=d;var w=C.alternate;w!==null&&(w.lanes|=d);for(var v=!1,L=C.return;L!==null;)L.childLanes|=d,w=L.alternate,w!==null&&(w.childLanes|=d),L.tag===22&&(C=L.stateNode,C===null||C._visibility&1||(v=!0)),C=L,L=L.return;return C.tag===3?(L=C.stateNode,v&&l!==null&&(v=31-ge(d),C=L.hiddenUpdates,w=C[v],w===null?C[v]=[l]:w.push(l),l.lane=d|536870912),L):null}function LQ(C){if(50<ml)throw ml=0,kl=null,Error(i(185));for(var l=C.return;l!==null;)C=l,l=C.return;return C.tag===3?C.stateNode:null}var PB={};function cM(C,l,d,w){this.tag=C,this.key=d,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=w,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function Mo(C,l,d,w){return new cM(C,l,d,w)}function No(C){return C=C.prototype,!(!C||!C.isReactComponent)}function ws(C,l){var d=C.alternate;return d===null?(d=Mo(C.tag,l,C.key,C.mode),d.elementType=C.elementType,d.type=C.type,d.stateNode=C.stateNode,d.alternate=C,C.alternate=d):(d.pendingProps=l,d.type=C.type,d.flags=0,d.subtreeFlags=0,d.deletions=null),d.flags=C.flags&65011712,d.childLanes=C.childLanes,d.lanes=C.lanes,d.child=C.child,d.memoizedProps=C.memoizedProps,d.memoizedState=C.memoizedState,d.updateQueue=C.updateQueue,l=C.dependencies,d.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext},d.sibling=C.sibling,d.index=C.index,d.ref=C.ref,d.refCleanup=C.refCleanup,d}function Io(C,l){C.flags&=65011714;var d=C.alternate;return d===null?(C.childLanes=0,C.lanes=l,C.child=null,C.subtreeFlags=0,C.memoizedProps=null,C.memoizedState=null,C.updateQueue=null,C.dependencies=null,C.stateNode=null):(C.childLanes=d.childLanes,C.lanes=d.lanes,C.child=d.child,C.subtreeFlags=0,C.deletions=null,C.memoizedProps=d.memoizedProps,C.memoizedState=d.memoizedState,C.updateQueue=d.updateQueue,C.type=d.type,l=d.dependencies,C.dependencies=l===null?null:{lanes:l.lanes,firstContext:l.firstContext}),C}function Lu(C,l,d,w,v,L){var V=0;if(w=C,typeof C=="function")No(C)&&(V=1);else if(typeof C=="string")V=GrA(C,d,rA.current)?26:C==="html"||C==="head"||C==="body"?27:5;else A:switch(C){case R:return C=Mo(31,d,l,v),C.elementType=R,C.lanes=L,C;case y:return NC(d.children,v,L,l);case S:V=8,v|=24;break;case f:return C=Mo(12,d,l,v|2),C.elementType=f,C.lanes=L,C;case U:return C=Mo(13,d,l,v),C.elementType=U,C.lanes=L,C;case F:return C=Mo(19,d,l,v),C.elementType=F,C.lanes=L,C;default:if(typeof C=="object"&&C!==null)switch(C.$$typeof){case k:V=10;break A;case M:V=9;break A;case m:V=11;break A;case b:V=14;break A;case K:V=16,w=null;break A}V=29,d=Error(i(130,C===null?"null":typeof C,"")),w=null}return l=Mo(V,d,l,v),l.elementType=C,l.type=w,l.lanes=L,l}function NC(C,l,d,w){return C=Mo(7,C,w,l),C.lanes=d,C}function mp(C,l,d){return C=Mo(6,C,null,l),C.lanes=d,C}function lM(C){var l=Mo(18,null,null,0);return l.stateNode=C,l}function Pr(C,l,d){return l=Mo(4,C.children!==null?C.children:[],C.key,l),l.lanes=d,l.stateNode={containerInfo:C.containerInfo,pendingChildren:null,implementation:C.implementation},l}var QS=new WeakMap;function ea(C,l){if(typeof C=="object"&&C!==null){var d=QS.get(C);return d!==void 0?d:(l={value:C,source:l,stack:dA(l)},QS.set(C,l),l)}return{value:C,source:l,stack:dA(l)}}var jr=[],sl=0,qu=null,qQ=0,Ga=[],ta=0,ms=null,ks=1,Ms="";function GC(C,l){jr[sl++]=qQ,jr[sl++]=qu,qu=C,qQ=l}function ES(C,l,d){Ga[ta++]=ks,Ga[ta++]=Ms,Ga[ta++]=ms,ms=C;var w=ks;C=Ms;var v=32-ge(w)-1;w&=~(1<<v),d+=1;var L=32-ge(l)+v;if(30<L){var V=v-v%5;L=(w&(1<<V)-1).toString(32),w>>=V,v-=V,ks=1<<32-ge(l)+v|d<<v|w,Ms=L+C}else ks=1<<L|d<<v|w,Ms=C}function kp(C){C.return!==null&&(GC(C,1),ES(C,1,0))}function jB(C){for(;C===qu;)qu=jr[--sl],jr[sl]=null,qQ=jr[--sl],jr[sl]=null;for(;C===ms;)ms=Ga[--ta],Ga[ta]=null,Ms=Ga[--ta],Ga[ta]=null,ks=Ga[--ta],Ga[ta]=null}function xu(C,l){Ga[ta++]=ks,Ga[ta++]=Ms,Ga[ta++]=ms,ks=l.id,Ms=l.overflow,ms=C}var hn=null,AI=null,zi=!1,RC=null,dn=!1,Mp=Error(i(519));function ji(C){var l=Error(i(418,1<arguments.length&&arguments[1]!==void 0&&arguments[1]?"text":"HTML",""));throw Tu(ea(l,C)),Mp}function Np(C){var l=C.stateNode,d=C.type,w=C.memoizedProps;switch(l[Me]=C,l[We]=w,d){case"dialog":Vi("cancel",l),Vi("close",l);break;case"iframe":case"object":case"embed":Vi("load",l);break;case"video":case"audio":for(d=0;d<aw.length;d++)Vi(aw[d],l);break;case"source":Vi("error",l);break;case"img":case"image":case"link":Vi("error",l),Vi("load",l);break;case"details":Vi("toggle",l);break;case"input":Vi("invalid",l),Zg(l,w.value,w.defaultValue,w.checked,w.defaultChecked,w.type,w.name,!0);break;case"select":Vi("invalid",l);break;case"textarea":Vi("invalid",l),fI(l,w.value,w.defaultValue,w.children)}d=w.children,typeof d!="string"&&typeof d!="number"&&typeof d!="bigint"||l.textContent===""+d||w.suppressHydrationWarning===!0||o3(l.textContent,d)?(w.popover!=null&&(Vi("beforetoggle",l),Vi("toggle",l)),w.onScroll!=null&&Vi("scroll",l),w.onScrollEnd!=null&&Vi("scrollend",l),w.onClick!=null&&(l.onclick=Le),l=!0):l=!1,l||ji(C,!0)}function QM(C){for(hn=C.return;hn;)switch(hn.tag){case 5:case 31:case 13:dn=!1;return;case 27:case 3:dn=!0;return;default:hn=hn.return}}function Cl(C){if(C!==hn)return!1;if(!zi)return QM(C),zi=!0,!1;var l=C.tag,d;if((d=l!==3&&l!==27)&&((d=l===5)&&(d=C.type,d=!(d!=="form"&&d!=="button")||Lv(C.type,C.memoizedProps)),d=!d),d&&AI&&ji(C),QM(C),l===13){if(C=C.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(i(317));AI=E3(C)}else if(l===31){if(C=C.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(i(317));AI=E3(C)}else l===27?(l=AI,IE(C.type)?(C=Hv,Hv=null,AI=C):AI=l):AI=hn?Ls(C.stateNode.nextSibling):null;return!0}function Bl(){AI=hn=null,zi=!1}function uS(){var C=RC;return C!==null&&(Co===null?Co=C:Co.push.apply(Co,C),RC=null),C}function Tu(C){RC===null?RC=[C]:RC.push(C)}var hS=z(null),UC=null,no=null;function KC(C,l,d){sA(hS,l._currentValue),l._currentValue=d}function Cr(C){C._currentValue=hS.current,X(hS)}function FC(C,l,d){for(;C!==null;){var w=C.alternate;if((C.childLanes&l)!==l?(C.childLanes|=l,w!==null&&(w.childLanes|=l)):w!==null&&(w.childLanes&l)!==l&&(w.childLanes|=l),C===d)break;C=C.return}}function Gp(C,l,d,w){var v=C.child;for(v!==null&&(v.return=C);v!==null;){var L=v.dependencies;if(L!==null){var V=v.child;L=L.firstContext;A:for(;L!==null;){var BA=L;L=v;for(var YA=0;YA<l.length;YA++)if(BA.context===l[YA]){L.lanes|=d,BA=L.alternate,BA!==null&&(BA.lanes|=d),FC(L.return,d,C),w||(V=null);break A}L=BA.next}}else if(v.tag===18){if(V=v.return,V===null)throw Error(i(341));V.lanes|=d,L=V.alternate,L!==null&&(L.lanes|=d),FC(V,d,C),V=null}else V=v.child;if(V!==null)V.return=v;else for(V=v;V!==null;){if(V===C){V=null;break}if(v=V.sibling,v!==null){v.return=V.return,V=v;break}V=V.return}v=V}}function ZB(C,l,d,w){C=null;for(var v=l,L=!1;v!==null;){if(!L){if((v.flags&524288)!==0)L=!0;else if((v.flags&262144)!==0)break}if(v.tag===10){var V=v.alternate;if(V===null)throw Error(i(387));if(V=V.memoizedProps,V!==null){var BA=v.type;nI(v.pendingProps.value,V.value)||(C!==null?C.push(BA):C=[BA])}}else if(v===uA.current){if(V=v.alternate,V===null)throw Error(i(387));V.memoizedState.memoizedState!==v.memoizedState.memoizedState&&(C!==null?C.push(cw):C=[cw])}v=v.return}C!==null&&Gp(l,C,d,w),l.flags|=262144}function xQ(C){for(C=C.firstContext;C!==null;){if(!nI(C.context._currentValue,C.memoizedValue))return!0;C=C.next}return!1}function cl(C){UC=C,no=null,C=C.dependencies,C!==null&&(C.firstContext=null)}function pn(C){return dS(UC,C)}function Yu(C,l){return UC===null&&cl(C),dS(C,l)}function dS(C,l){var d=l._currentValue;if(l={context:l,memoizedValue:d,next:null},no===null){if(C===null)throw Error(i(308));no=l,C.dependencies={lanes:0,firstContext:l},C.flags|=524288}else no=no.next=l;return d}var EM=typeof AbortController<"u"?AbortController:function(){var C=[],l=this.signal={aborted:!1,addEventListener:function(d,w){C.push(w)}};this.abort=function(){l.aborted=!0,C.forEach(function(d){return d()})}},uM=t.unstable_scheduleCallback,pS=t.unstable_NormalPriority,Ht={$$typeof:k,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0};function fS(){return{controller:new EM,data:new Map,refCount:0}}function _n(C){C.refCount--,C.refCount===0&&uM(pS,function(){C.controller.abort()})}var ll=null,DS=0,bC=0,Zr=null;function TQ(C,l){if(ll===null){var d=ll=[];DS=0,bC=Gv(),Zr={status:"pending",value:void 0,then:function(w){d.push(w)}}}return DS++,l.then(yS,yS),l}function yS(){if(--DS===0&&ll!==null){Zr!==null&&(Zr.status="fulfilled");var C=ll;ll=null,bC=0,Zr=null;for(var l=0;l<C.length;l++)(0,C[l])()}}function SS(C,l){var d=[],w={status:"pending",value:null,reason:null,then:function(v){d.push(v)}};return C.then(function(){w.status="fulfilled",w.value=l;for(var v=0;v<d.length;v++)(0,d[v])(l)},function(v){for(w.status="rejected",w.reason=v,v=0;v<d.length;v++)(0,d[v])(void 0)}),w}var hM=q.S;q.S=function(C,l){tE=eA(),typeof l=="object"&&l!==null&&typeof l.then=="function"&&TQ(C,l),hM!==null&&hM(C,l)};var WB=z(null);function Ns(){var C=WB.current;return C!==null?C:Rg.pooledCache}function YQ(C,l){l===null?sA(WB,WB.current):sA(WB,l.pool)}function Rp(){var C=Ns();return C===null?null:{parent:Ht._currentValue,pool:C}}var zB=Error(i(460)),Hu=Error(i(474)),Wr=Error(i(542)),Ou={then:function(){}};function dM(C){return C=C.status,C==="fulfilled"||C==="rejected"}function wS(C,l,d){switch(d=C[d],d===void 0?C.push(l):d!==l&&(l.then(Le,Le),l=d),l.status){case"fulfilled":return l.value;case"rejected":throw C=l.reason,mS(C),C;default:if(typeof l.status=="string")l.then(Le,Le);else{if(C=Rg,C!==null&&100<C.shellSuspendCounter)throw Error(i(482));C=l,C.status="pending",C.then(function(w){if(l.status==="pending"){var v=l;v.status="fulfilled",v.value=w}},function(w){if(l.status==="pending"){var v=l;v.status="rejected",v.reason=w}})}switch(l.status){case"fulfilled":return l.value;case"rejected":throw C=l.reason,mS(C),C}throw $t=l,zB}}function Ql(C){try{var l=C._init;return l(C._payload)}catch(d){throw d!==null&&typeof d=="object"&&typeof d.then=="function"?($t=d,zB):d}}var $t=null;function Up(){if($t===null)throw Error(i(459));var C=$t;return $t=null,C}function mS(C){if(C===zB||C===Wr)throw Error(i(483))}var VB=null,XB=0;function Kp(C){var l=XB;return XB+=1,VB===null&&(VB=[]),wS(VB,C,l)}function Pu(C,l){l=l.props.ref,C.ref=l!==void 0?l:null}function ju(C,l){throw l.$$typeof===c?Error(i(525)):(C=Object.prototype.toString.call(l),Error(i(31,C==="[object Object]"?"object with keys {"+Object.keys(l).join(", ")+"}":C)))}function HQ(C){function l(se,$A){if(C){var fe=se.deletions;fe===null?(se.deletions=[$A],se.flags|=16):fe.push($A)}}function d(se,$A){if(!C)return null;for(;$A!==null;)l(se,$A),$A=$A.sibling;return null}function w(se){for(var $A=new Map;se!==null;)se.key!==null?$A.set(se.key,se):$A.set(se.index,se),se=se.sibling;return $A}function v(se,$A){return se=ws(se,$A),se.index=0,se.sibling=null,se}function L(se,$A,fe){return se.index=fe,C?(fe=se.alternate,fe!==null?(fe=fe.index,fe<$A?(se.flags|=67108866,$A):fe):(se.flags|=67108866,$A)):(se.flags|=1048576,$A)}function V(se){return C&&se.alternate===null&&(se.flags|=67108866),se}function BA(se,$A,fe,Te){return $A===null||$A.tag!==6?($A=mp(fe,se.mode,Te),$A.return=se,$A):($A=v($A,fe),$A.return=se,$A)}function YA(se,$A,fe,Te){var Wt=fe.type;return Wt===y?Je(se,$A,fe.props.children,Te,fe.key):$A!==null&&($A.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===K&&Ql(Wt)===$A.type)?($A=v($A,fe.props),Pu($A,fe),$A.return=se,$A):($A=Lu(fe.type,fe.key,fe.props,null,se.mode,Te),Pu($A,fe),$A.return=se,$A)}function De(se,$A,fe,Te){return $A===null||$A.tag!==4||$A.stateNode.containerInfo!==fe.containerInfo||$A.stateNode.implementation!==fe.implementation?($A=Pr(fe,se.mode,Te),$A.return=se,$A):($A=v($A,fe.children||[]),$A.return=se,$A)}function Je(se,$A,fe,Te,Wt){return $A===null||$A.tag!==7?($A=NC(fe,se.mode,Te,Wt),$A.return=se,$A):($A=v($A,fe),$A.return=se,$A)}function He(se,$A,fe){if(typeof $A=="string"&&$A!==""||typeof $A=="number"||typeof $A=="bigint")return $A=mp(""+$A,se.mode,fe),$A.return=se,$A;if(typeof $A=="object"&&$A!==null){switch($A.$$typeof){case E:return fe=Lu($A.type,$A.key,$A.props,null,se.mode,fe),Pu(fe,$A),fe.return=se,fe;case D:return $A=Pr($A,se.mode,fe),$A.return=se,$A;case K:return $A=Ql($A),He(se,$A,fe)}if(j($A)||x($A))return $A=NC($A,se.mode,fe,null),$A.return=se,$A;if(typeof $A.then=="function")return He(se,Kp($A),fe);if($A.$$typeof===k)return He(se,Yu(se,$A),fe);ju(se,$A)}return null}function me(se,$A,fe,Te){var Wt=$A!==null?$A.key:null;if(typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint")return Wt!==null?null:BA(se,$A,""+fe,Te);if(typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case E:return fe.key===Wt?YA(se,$A,fe,Te):null;case D:return fe.key===Wt?De(se,$A,fe,Te):null;case K:return fe=Ql(fe),me(se,$A,fe,Te)}if(j(fe)||x(fe))return Wt!==null?null:Je(se,$A,fe,Te,null);if(typeof fe.then=="function")return me(se,$A,Kp(fe),Te);if(fe.$$typeof===k)return me(se,$A,Yu(se,fe),Te);ju(se,fe)}return null}function Ue(se,$A,fe,Te,Wt){if(typeof Te=="string"&&Te!==""||typeof Te=="number"||typeof Te=="bigint")return se=se.get(fe)||null,BA($A,se,""+Te,Wt);if(typeof Te=="object"&&Te!==null){switch(Te.$$typeof){case E:return se=se.get(Te.key===null?fe:Te.key)||null,YA($A,se,Te,Wt);case D:return se=se.get(Te.key===null?fe:Te.key)||null,De($A,se,Te,Wt);case K:return Te=Ql(Te),Ue(se,$A,fe,Te,Wt)}if(j(Te)||x(Te))return se=se.get(fe)||null,Je($A,se,Te,Wt,null);if(typeof Te.then=="function")return Ue(se,$A,fe,Kp(Te),Wt);if(Te.$$typeof===k)return Ue(se,$A,fe,Yu($A,Te),Wt);ju($A,Te)}return null}function Ft(se,$A,fe,Te){for(var Wt=null,Kg=null,Lt=$A,vi=$A=0,gg=null;Lt!==null&&vi<fe.length;vi++){Lt.index>vi?(gg=Lt,Lt=null):gg=Lt.sibling;var Fg=me(se,Lt,fe[vi],Te);if(Fg===null){Lt===null&&(Lt=gg);break}C&&Lt&&Fg.alternate===null&&l(se,Lt),$A=L(Fg,$A,vi),Kg===null?Wt=Fg:Kg.sibling=Fg,Kg=Fg,Lt=gg}if(vi===fe.length)return d(se,Lt),zi&&GC(se,vi),Wt;if(Lt===null){for(;vi<fe.length;vi++)Lt=He(se,fe[vi],Te),Lt!==null&&($A=L(Lt,$A,vi),Kg===null?Wt=Lt:Kg.sibling=Lt,Kg=Lt);return zi&&GC(se,vi),Wt}for(Lt=w(Lt);vi<fe.length;vi++)gg=Ue(Lt,se,vi,fe[vi],Te),gg!==null&&(C&&gg.alternate!==null&&Lt.delete(gg.key===null?vi:gg.key),$A=L(gg,$A,vi),Kg===null?Wt=gg:Kg.sibling=gg,Kg=gg);return C&&Lt.forEach(function(sE){return l(se,sE)}),zi&&GC(se,vi),Wt}function ii(se,$A,fe,Te){if(fe==null)throw Error(i(151));for(var Wt=null,Kg=null,Lt=$A,vi=$A=0,gg=null,Fg=fe.next();Lt!==null&&!Fg.done;vi++,Fg=fe.next()){Lt.index>vi?(gg=Lt,Lt=null):gg=Lt.sibling;var sE=me(se,Lt,Fg.value,Te);if(sE===null){Lt===null&&(Lt=gg);break}C&&Lt&&sE.alternate===null&&l(se,Lt),$A=L(sE,$A,vi),Kg===null?Wt=sE:Kg.sibling=sE,Kg=sE,Lt=gg}if(Fg.done)return d(se,Lt),zi&&GC(se,vi),Wt;if(Lt===null){for(;!Fg.done;vi++,Fg=fe.next())Fg=He(se,Fg.value,Te),Fg!==null&&($A=L(Fg,$A,vi),Kg===null?Wt=Fg:Kg.sibling=Fg,Kg=Fg);return zi&&GC(se,vi),Wt}for(Lt=w(Lt);!Fg.done;vi++,Fg=fe.next())Fg=Ue(Lt,se,vi,Fg.value,Te),Fg!==null&&(C&&Fg.alternate!==null&&Lt.delete(Fg.key===null?vi:Fg.key),$A=L(Fg,$A,vi),Kg===null?Wt=Fg:Kg.sibling=Fg,Kg=Fg);return C&&Lt.forEach(function(xrA){return l(se,xrA)}),zi&&GC(se,vi),Wt}function iI(se,$A,fe,Te){if(typeof fe=="object"&&fe!==null&&fe.type===y&&fe.key===null&&(fe=fe.props.children),typeof fe=="object"&&fe!==null){switch(fe.$$typeof){case E:A:{for(var Wt=fe.key;$A!==null;){if($A.key===Wt){if(Wt=fe.type,Wt===y){if($A.tag===7){d(se,$A.sibling),Te=v($A,fe.props.children),Te.return=se,se=Te;break A}}else if($A.elementType===Wt||typeof Wt=="object"&&Wt!==null&&Wt.$$typeof===K&&Ql(Wt)===$A.type){d(se,$A.sibling),Te=v($A,fe.props),Pu(Te,fe),Te.return=se,se=Te;break A}d(se,$A);break}else l(se,$A);$A=$A.sibling}fe.type===y?(Te=NC(fe.props.children,se.mode,Te,fe.key),Te.return=se,se=Te):(Te=Lu(fe.type,fe.key,fe.props,null,se.mode,Te),Pu(Te,fe),Te.return=se,se=Te)}return V(se);case D:A:{for(Wt=fe.key;$A!==null;){if($A.key===Wt)if($A.tag===4&&$A.stateNode.containerInfo===fe.containerInfo&&$A.stateNode.implementation===fe.implementation){d(se,$A.sibling),Te=v($A,fe.children||[]),Te.return=se,se=Te;break A}else{d(se,$A);break}else l(se,$A);$A=$A.sibling}Te=Pr(fe,se.mode,Te),Te.return=se,se=Te}return V(se);case K:return fe=Ql(fe),iI(se,$A,fe,Te)}if(j(fe))return Ft(se,$A,fe,Te);if(x(fe)){if(Wt=x(fe),typeof Wt!="function")throw Error(i(150));return fe=Wt.call(fe),ii(se,$A,fe,Te)}if(typeof fe.then=="function")return iI(se,$A,Kp(fe),Te);if(fe.$$typeof===k)return iI(se,$A,Yu(se,fe),Te);ju(se,fe)}return typeof fe=="string"&&fe!==""||typeof fe=="number"||typeof fe=="bigint"?(fe=""+fe,$A!==null&&$A.tag===6?(d(se,$A.sibling),Te=v($A,fe),Te.return=se,se=Te):(d(se,$A),Te=mp(fe,se.mode,Te),Te.return=se,se=Te),V(se)):d(se,$A)}return function(se,$A,fe,Te){try{XB=0;var Wt=iI(se,$A,fe,Te);return VB=null,Wt}catch(Lt){if(Lt===zB||Lt===Wr)throw Lt;var Kg=Mo(29,Lt,null,se.mode);return Kg.lanes=Te,Kg.return=se,Kg}finally{}}}var El=HQ(!0),pM=HQ(!1),$B=!1;function kS(C){C.updateQueue={baseState:C.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function MS(C,l){C=C.updateQueue,l.updateQueue===C&&(l.updateQueue={baseState:C.baseState,firstBaseUpdate:C.firstBaseUpdate,lastBaseUpdate:C.lastBaseUpdate,shared:C.shared,callbacks:null})}function Gs(C){return{lane:C,tag:0,payload:null,callback:null,next:null}}function vC(C,l,d){var w=C.updateQueue;if(w===null)return null;if(w=w.shared,(tg&2)!==0){var v=w.pending;return v===null?l.next=l:(l.next=v.next,v.next=l),w.pending=l,l=LQ(C),wp(C,null,d),l}return Ju(C,w,l,d),LQ(C)}function Ac(C,l,d){if(l=l.updateQueue,l!==null&&(l=l.shared,(d&4194048)!==0)){var w=l.lanes;w&=C.pendingLanes,d|=w,l.lanes=d,Ge(C,d)}}function Fp(C,l){var d=C.updateQueue,w=C.alternate;if(w!==null&&(w=w.updateQueue,d===w)){var v=null,L=null;if(d=d.firstBaseUpdate,d!==null){do{var V={lane:d.lane,tag:d.tag,payload:d.payload,callback:null,next:null};L===null?v=L=V:L=L.next=V,d=d.next}while(d!==null);L===null?v=L=l:L=L.next=l}else v=L=l;d={baseState:w.baseState,firstBaseUpdate:v,lastBaseUpdate:L,shared:w.shared,callbacks:w.callbacks},C.updateQueue=d;return}C=d.lastBaseUpdate,C===null?d.firstBaseUpdate=l:C.next=l,d.lastBaseUpdate=l}var NS=!1;function Zu(){if(NS){var C=Zr;if(C!==null)throw C}}function ul(C,l,d,w){NS=!1;var v=C.updateQueue;$B=!1;var L=v.firstBaseUpdate,V=v.lastBaseUpdate,BA=v.shared.pending;if(BA!==null){v.shared.pending=null;var YA=BA,De=YA.next;YA.next=null,V===null?L=De:V.next=De,V=YA;var Je=C.alternate;Je!==null&&(Je=Je.updateQueue,BA=Je.lastBaseUpdate,BA!==V&&(BA===null?Je.firstBaseUpdate=De:BA.next=De,Je.lastBaseUpdate=YA))}if(L!==null){var He=v.baseState;V=0,Je=De=YA=null,BA=L;do{var me=BA.lane&-536870913,Ue=me!==BA.lane;if(Ue?(Zi&me)===me:(w&me)===me){me!==0&&me===bC&&(NS=!0),Je!==null&&(Je=Je.next={lane:0,tag:BA.tag,payload:BA.payload,callback:null,next:null});A:{var Ft=C,ii=BA;me=l;var iI=d;switch(ii.tag){case 1:if(Ft=ii.payload,typeof Ft=="function"){He=Ft.call(iI,He,me);break A}He=Ft;break A;case 3:Ft.flags=Ft.flags&-65537|128;case 0:if(Ft=ii.payload,me=typeof Ft=="function"?Ft.call(iI,He,me):Ft,me==null)break A;He=B({},He,me);break A;case 2:$B=!0}}me=BA.callback,me!==null&&(C.flags|=64,Ue&&(C.flags|=8192),Ue=v.callbacks,Ue===null?v.callbacks=[me]:Ue.push(me))}else Ue={lane:me,tag:BA.tag,payload:BA.payload,callback:BA.callback,next:null},Je===null?(De=Je=Ue,YA=He):Je=Je.next=Ue,V|=me;if(BA=BA.next,BA===null){if(BA=v.shared.pending,BA===null)break;Ue=BA,BA=Ue.next,Ue.next=null,v.lastBaseUpdate=Ue,v.shared.pending=null}}while(!0);Je===null&&(YA=He),v.baseState=YA,v.firstBaseUpdate=De,v.lastBaseUpdate=Je,L===null&&(v.shared.lanes=0),xa|=V,C.lanes=V,C.memoizedState=He}}function Rs(C,l){if(typeof C!="function")throw Error(i(191,C));C.call(l)}function Jn(C,l){var d=C.callbacks;if(d!==null)for(C.callbacks=null,C=0;C<d.length;C++)Rs(d[C],l)}var Ra=z(null),Go=z(0);function GS(C,l){C=LI,sA(Go,C),sA(Ra,l),LI=C|l.baseLanes}function RS(){sA(Go,LI),sA(Ra,Ra.current)}function oo(){LI=Go.current,X(Ra),X(Go)}var gn=z(null),Br=null;function ec(C){var l=C.alternate;sA(yI,yI.current&1),sA(gn,C),Br===null&&(l===null||Ra.current!==null||l.memoizedState!==null)&&(Br=C)}function US(C){sA(yI,yI.current),sA(gn,C),Br===null&&(Br=C)}function fM(C){C.tag===22?(sA(yI,yI.current),sA(gn,C),Br===null&&(Br=C)):_C()}function _C(){sA(yI,yI.current),sA(gn,gn.current)}function Ua(C){X(gn),Br===C&&(Br=null),X(yI)}var yI=z(0);function bp(C){for(var l=C;l!==null;){if(l.tag===13){var d=l.memoizedState;if(d!==null&&(d=d.dehydrated,d===null||Tv(d)||Yv(d)))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===C)break;for(;l.sibling===null;){if(l.return===null||l.return===C)return null;l=l.return}l.sibling.return=l.return,l=l.sibling}return null}var ia=0,ai=null,xg=null,PI=null,vp=!1,Us=!1,hl=!1,_p=0,Wu=0,Ks=null,pv=0;function SI(){throw Error(i(321))}function KS(C,l){if(l===null)return!1;for(var d=0;d<l.length&&d<C.length;d++)if(!nI(C[d],l[d]))return!1;return!0}function FS(C,l,d,w,v,L){return ia=L,ai=l,l.memoizedState=null,l.updateQueue=null,l.lanes=0,q.H=C===null||C.memoizedState===null?xM:jQ,hl=!1,L=d(w,v),hl=!1,Us&&(L=yM(l,d,w,v)),DM(C),L}function DM(C){q.H=Ah;var l=xg!==null&&xg.next!==null;if(ia=0,PI=xg=ai=null,vp=!1,Wu=0,Ks=null,l)throw Error(i(300));C===null||oI||(C=C.dependencies,C!==null&&xQ(C)&&(oI=!0))}function yM(C,l,d,w){ai=C;var v=0;do{if(Us&&(Ks=null),Wu=0,Us=!1,25<=v)throw Error(i(301));if(v+=1,PI=xg=null,C.updateQueue!=null){var L=C.updateQueue;L.lastEffect=null,L.events=null,L.stores=null,L.memoCache!=null&&(L.memoCache.index=0)}q.H=eh,L=l(d,w)}while(Us);return L}function fv(){var C=q.H,l=C.useState()[0];return l=typeof l.then=="function"?Vu(l):l,C=C.useState()[0],(xg!==null?xg.memoizedState:null)!==C&&(ai.flags|=1024),l}function bS(){var C=_p!==0;return _p=0,C}function vS(C,l,d){l.updateQueue=C.updateQueue,l.flags&=-2053,C.lanes&=~d}function _S(C){if(vp){for(C=C.memoizedState;C!==null;){var l=C.queue;l!==null&&(l.pending=null),C=C.next}vp=!1}ia=0,PI=xg=ai=null,Us=!1,Wu=_p=0,Ks=null}function Ro(){var C={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return PI===null?ai.memoizedState=PI=C:PI=PI.next=C,PI}function bI(){if(xg===null){var C=ai.alternate;C=C!==null?C.memoizedState:null}else C=xg.next;var l=PI===null?ai.memoizedState:PI.next;if(l!==null)PI=l,xg=C;else{if(C===null)throw ai.alternate===null?Error(i(467)):Error(i(310));xg=C,C={memoizedState:xg.memoizedState,baseState:xg.baseState,baseQueue:xg.baseQueue,queue:xg.queue,next:null},PI===null?ai.memoizedState=PI=C:PI=PI.next=C}return PI}function zu(){return{lastEffect:null,events:null,stores:null,memoCache:null}}function Vu(C){var l=Wu;return Wu+=1,Ks===null&&(Ks=[]),C=wS(Ks,C,l),l=ai,(PI===null?l.memoizedState:PI.next)===null&&(l=l.alternate,q.H=l===null||l.memoizedState===null?xM:jQ),C}function Jp(C){if(C!==null&&typeof C=="object"){if(typeof C.then=="function")return Vu(C);if(C.$$typeof===k)return pn(C)}throw Error(i(438,String(C)))}function JS(C){var l=null,d=ai.updateQueue;if(d!==null&&(l=d.memoCache),l==null){var w=ai.alternate;w!==null&&(w=w.updateQueue,w!==null&&(w=w.memoCache,w!=null&&(l={data:w.data.map(function(v){return v.slice()}),index:0})))}if(l==null&&(l={data:[],index:0}),d===null&&(d=zu(),ai.updateQueue=d),d.memoCache=l,d=l.data[l.index],d===void 0)for(d=l.data[l.index]=Array(C),w=0;w<C;w++)d[w]=G;return l.index++,d}function JC(C,l){return typeof l=="function"?l(C):l}function Lp(C){var l=bI();return LS(l,xg,C)}function LS(C,l,d){var w=C.queue;if(w===null)throw Error(i(311));w.lastRenderedReducer=d;var v=C.baseQueue,L=w.pending;if(L!==null){if(v!==null){var V=v.next;v.next=L.next,L.next=V}l.baseQueue=v=L,w.pending=null}if(L=C.baseState,v===null)C.memoizedState=L;else{l=v.next;var BA=V=null,YA=null,De=l,Je=!1;do{var He=De.lane&-536870913;if(He!==De.lane?(Zi&He)===He:(ia&He)===He){var me=De.revertLane;if(me===0)YA!==null&&(YA=YA.next={lane:0,revertLane:0,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null}),He===bC&&(Je=!0);else if((ia&me)===me){De=De.next,me===bC&&(Je=!0);continue}else He={lane:0,revertLane:De.revertLane,gesture:null,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},YA===null?(BA=YA=He,V=L):YA=YA.next=He,ai.lanes|=me,xa|=me;He=De.action,hl&&d(L,He),L=De.hasEagerState?De.eagerState:d(L,He)}else me={lane:He,revertLane:De.revertLane,gesture:De.gesture,action:De.action,hasEagerState:De.hasEagerState,eagerState:De.eagerState,next:null},YA===null?(BA=YA=me,V=L):YA=YA.next=me,ai.lanes|=He,xa|=He;De=De.next}while(De!==null&&De!==l);if(YA===null?V=L:YA.next=BA,!nI(L,C.memoizedState)&&(oI=!0,Je&&(d=Zr,d!==null)))throw d;C.memoizedState=L,C.baseState=V,C.baseQueue=YA,w.lastRenderedState=L}return v===null&&(w.lanes=0),[C.memoizedState,w.dispatch]}function qp(C){var l=bI(),d=l.queue;if(d===null)throw Error(i(311));d.lastRenderedReducer=C;var w=d.dispatch,v=d.pending,L=l.memoizedState;if(v!==null){d.pending=null;var V=v=v.next;do L=C(L,V.action),V=V.next;while(V!==v);nI(L,l.memoizedState)||(oI=!0),l.memoizedState=L,l.baseQueue===null&&(l.baseState=L),d.lastRenderedState=L}return[L,w]}function qS(C,l,d){var w=ai,v=bI(),L=zi;if(L){if(d===void 0)throw Error(i(407));d=d()}else d=l();var V=!nI((xg||v).memoizedState,d);if(V&&(v.memoizedState=d,oI=!0),v=v.queue,OS(TS.bind(null,w,v,C),[C]),v.getSnapshot!==l||V||PI!==null&&PI.memoizedState.tag&1){if(w.flags|=2048,OQ(9,{destroy:void 0},xS.bind(null,w,v,d,l),null),Rg===null)throw Error(i(349));L||(ia&127)!==0||SM(w,l,d)}return d}function SM(C,l,d){C.flags|=16384,C={getSnapshot:l,value:d},l=ai.updateQueue,l===null?(l=zu(),ai.updateQueue=l,l.stores=[C]):(d=l.stores,d===null?l.stores=[C]:d.push(C))}function xS(C,l,d,w){l.value=d,l.getSnapshot=w,YS(l)&&xp(C)}function TS(C,l,d){return d(function(){YS(l)&&xp(C)})}function YS(C){var l=C.getSnapshot;C=C.value;try{var d=l();return!nI(C,d)}catch{return!0}}function xp(C){var l=OB(C,2);l!==null&&h(l,C,2)}function Xu(C){var l=Ro();if(typeof C=="function"){var d=C;if(C=d(),hl){zA(!0);try{d()}finally{zA(!1)}}}return l.memoizedState=l.baseState=C,l.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:JC,lastRenderedState:C},l}function wM(C,l,d,w){return C.baseState=d,LS(C,xg,typeof w=="function"?w:JC)}function Dv(C,l,d,w,v){if(LC(C))throw Error(i(485));if(C=l.action,C!==null){var L={payload:v,action:C,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(V){L.listeners.push(V)}};q.T!==null?d(!0):L.isTransition=!1,w(L),d=l.pending,d===null?(L.next=l.pending=L,mM(l,L)):(L.next=d.next,l.pending=d.next=L)}}function mM(C,l){var d=l.action,w=l.payload,v=C.state;if(l.isTransition){var L=q.T,V={};q.T=V;try{var BA=d(v,w),YA=q.S;YA!==null&&YA(V,BA),kM(C,l,BA)}catch(De){Tp(C,l,De)}finally{L!==null&&V.types!==null&&(L.types=V.types),q.T=L}}else try{L=d(v,w),kM(C,l,L)}catch(De){Tp(C,l,De)}}function kM(C,l,d){d!==null&&typeof d=="object"&&typeof d.then=="function"?d.then(function(w){HS(C,l,w)},function(w){return Tp(C,l,w)}):HS(C,l,d)}function HS(C,l,d){l.status="fulfilled",l.value=d,MM(l),C.state=d,l=C.pending,l!==null&&(d=l.next,d===l?C.pending=null:(d=d.next,l.next=d,mM(C,d)))}function Tp(C,l,d){var w=C.pending;if(C.pending=null,w!==null){w=w.next;do l.status="rejected",l.reason=d,MM(l),l=l.next;while(l!==w)}C.action=null}function MM(C){C=C.listeners;for(var l=0;l<C.length;l++)(0,C[l])()}function NM(C,l){return l}function GM(C,l){if(zi){var d=Rg.formState;if(d!==null){A:{var w=ai;if(zi){if(AI){e:{for(var v=AI,L=dn;v.nodeType!==8;){if(!L){v=null;break e}if(v=Ls(v.nextSibling),v===null){v=null;break e}}L=v.data,v=L==="F!"||L==="F"?v:null}if(v){AI=Ls(v.nextSibling),w=v.data==="F!";break A}}ji(w)}w=!1}w&&(l=d[0])}}return d=Ro(),d.memoizedState=d.baseState=l,w={pending:null,lanes:0,dispatch:null,lastRenderedReducer:NM,lastRenderedState:l},d.queue=w,d=qM.bind(null,ai,w),w.dispatch=d,w=Xu(!1),L=$u.bind(null,ai,!1,w.queue),w=Ro(),v={state:l,dispatch:null,action:C,pending:null},w.queue=v,d=Dv.bind(null,ai,v,L,d),v.dispatch=d,w.memoizedState=C,[l,d,!1]}function RM(C){var l=bI();return UM(l,xg,C)}function UM(C,l,d){if(l=LS(C,l,NM)[0],C=Lp(JC)[0],typeof l=="object"&&l!==null&&typeof l.then=="function")try{var w=Vu(l)}catch(V){throw V===zB?Wr:V}else w=l;l=bI();var v=l.queue,L=v.dispatch;return d!==l.memoizedState&&(ai.flags|=2048,OQ(9,{destroy:void 0},yv.bind(null,v,d),null)),[w,L,C]}function yv(C,l){C.action=l}function KM(C){var l=bI(),d=xg;if(d!==null)return UM(l,d,C);bI(),l=l.memoizedState,d=bI();var w=d.queue.dispatch;return d.memoizedState=C,[l,w,!1]}function OQ(C,l,d,w){return C={tag:C,create:d,deps:w,inst:l,next:null},l=ai.updateQueue,l===null&&(l=zu(),ai.updateQueue=l),d=l.lastEffect,d===null?l.lastEffect=C.next=C:(w=d.next,d.next=C,C.next=w,l.lastEffect=C),C}function FM(){return bI().memoizedState}function Yp(C,l,d,w){var v=Ro();ai.flags|=C,v.memoizedState=OQ(1|l,{destroy:void 0},d,w===void 0?null:w)}function Hp(C,l,d,w){var v=bI();w=w===void 0?null:w;var L=v.memoizedState.inst;xg!==null&&w!==null&&KS(w,xg.memoizedState.deps)?v.memoizedState=OQ(l,L,d,w):(ai.flags|=C,v.memoizedState=OQ(1|l,L,d,w))}function bM(C,l){Yp(8390656,8,C,l)}function OS(C,l){Hp(2048,8,C,l)}function vM(C){ai.flags|=4;var l=ai.updateQueue;if(l===null)l=zu(),ai.updateQueue=l,l.events=[C];else{var d=l.events;d===null?l.events=[C]:d.push(C)}}function _M(C){var l=bI().memoizedState;return vM({ref:l,nextImpl:C}),function(){if((tg&2)!==0)throw Error(i(440));return l.impl.apply(void 0,arguments)}}function JM(C,l){return Hp(4,2,C,l)}function Ka(C,l){return Hp(4,4,C,l)}function PS(C,l){if(typeof l=="function"){C=C();var d=l(C);return function(){typeof d=="function"?d():l(null)}}if(l!=null)return C=C(),l.current=C,function(){l.current=null}}function Op(C,l,d){d=d!=null?d.concat([C]):null,Hp(4,4,PS.bind(null,l,C),d)}function Pp(){}function jS(C,l){var d=bI();l=l===void 0?null:l;var w=d.memoizedState;return l!==null&&KS(l,w[1])?w[0]:(d.memoizedState=[C,l],C)}function ZS(C,l){var d=bI();l=l===void 0?null:l;var w=d.memoizedState;if(l!==null&&KS(l,w[1]))return w[0];if(w=C(),hl){zA(!0);try{C()}finally{zA(!1)}}return d.memoizedState=[w,l],w}function WS(C,l,d){return d===void 0||(ia&1073741824)!==0&&(Zi&261930)===0?C.memoizedState=l:(C.memoizedState=d,C=u(),ai.lanes|=C,xa|=C,d)}function zS(C,l,d,w){return nI(d,l)?d:Ra.current!==null?(C=WS(C,d,w),nI(C,l)||(oI=!0),C):(ia&42)===0||(ia&1073741824)!==0&&(Zi&261930)===0?(oI=!0,C.memoizedState=d):(C=u(),ai.lanes|=C,xa|=C,l)}function VS(C,l,d,w,v){var L=Y.p;Y.p=L!==0&&8>L?L:8;var V=q.T,BA={};q.T=BA,$u(C,!1,l,d);try{var YA=v(),De=q.S;if(De!==null&&De(BA,YA),YA!==null&&typeof YA=="object"&&typeof YA.then=="function"){var Je=SS(YA,w);PQ(C,l,Je,Ko(C))}else PQ(C,l,w,Ko(C))}catch(He){PQ(C,l,{then:function(){},status:"rejected",reason:He},Ko())}finally{Y.p=L,V!==null&&BA.types!==null&&(V.types=BA.types),q.T=V}}function Sv(){}function XS(C,l,d,w){if(C.tag!==5)throw Error(i(476));var v=LM(C).queue;VS(C,v,l,O,d===null?Sv:function(){return $S(C),d(w)})}function LM(C){var l=C.memoizedState;if(l!==null)return l;l={memoizedState:O,baseState:O,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:JC,lastRenderedState:O},next:null};var d={};return l.next={memoizedState:d,baseState:d,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:JC,lastRenderedState:d},next:null},C.memoizedState=l,C=C.alternate,C!==null&&(C.memoizedState=l),l}function $S(C){var l=LM(C);l.next===null&&(l=C.alternate.memoizedState),PQ(C,l.next.queue,{},Ko())}function Aw(){return pn(cw)}function Ln(){return bI().memoizedState}function ew(){return bI().memoizedState}function wv(C){for(var l=C.return;l!==null;){switch(l.tag){case 24:case 3:var d=Ko();C=Gs(d);var w=vC(l,C,d);w!==null&&(h(w,l,d),Ac(w,l,d)),l={cache:fS()},C.payload=l;return}l=l.return}}function mv(C,l,d){var w=Ko();d={lane:w,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null},LC(C)?dl(l,d):(d=JQ(C,l,d,w),d!==null&&(h(d,C,w),ga(d,l,w)))}function qM(C,l,d){var w=Ko();PQ(C,l,d,w)}function PQ(C,l,d,w){var v={lane:w,revertLane:0,gesture:null,action:d,hasEagerState:!1,eagerState:null,next:null};if(LC(C))dl(l,v);else{var L=C.alternate;if(C.lanes===0&&(L===null||L.lanes===0)&&(L=l.lastRenderedReducer,L!==null))try{var V=l.lastRenderedState,BA=L(V,d);if(v.hasEagerState=!0,v.eagerState=BA,nI(BA,V))return Ju(C,l,v,0),Rg===null&&HB(),!1}catch{}finally{}if(d=JQ(C,l,v,w),d!==null)return h(d,C,w),ga(d,l,w),!0}return!1}function $u(C,l,d,w){if(w={lane:2,revertLane:Gv(),gesture:null,action:w,hasEagerState:!1,eagerState:null,next:null},LC(C)){if(l)throw Error(i(479))}else l=JQ(C,d,w,2),l!==null&&h(l,C,2)}function LC(C){var l=C.alternate;return C===ai||l!==null&&l===ai}function dl(C,l){Us=vp=!0;var d=C.pending;d===null?l.next=l:(l.next=d.next,d.next=l),C.pending=l}function ga(C,l,d){if((d&4194048)!==0){var w=l.lanes;w&=C.pendingLanes,d|=w,l.lanes=d,Ge(C,d)}}var Ah={readContext:pn,use:Jp,useCallback:SI,useContext:SI,useEffect:SI,useImperativeHandle:SI,useLayoutEffect:SI,useInsertionEffect:SI,useMemo:SI,useReducer:SI,useRef:SI,useState:SI,useDebugValue:SI,useDeferredValue:SI,useTransition:SI,useSyncExternalStore:SI,useId:SI,useHostTransitionStatus:SI,useFormState:SI,useActionState:SI,useOptimistic:SI,useMemoCache:SI,useCacheRefresh:SI};Ah.useEffectEvent=SI;var xM={readContext:pn,use:Jp,useCallback:function(C,l){return Ro().memoizedState=[C,l===void 0?null:l],C},useContext:pn,useEffect:bM,useImperativeHandle:function(C,l,d){d=d!=null?d.concat([C]):null,Yp(4194308,4,PS.bind(null,l,C),d)},useLayoutEffect:function(C,l){return Yp(4194308,4,C,l)},useInsertionEffect:function(C,l){Yp(4,2,C,l)},useMemo:function(C,l){var d=Ro();l=l===void 0?null:l;var w=C();if(hl){zA(!0);try{C()}finally{zA(!1)}}return d.memoizedState=[w,l],w},useReducer:function(C,l,d){var w=Ro();if(d!==void 0){var v=d(l);if(hl){zA(!0);try{d(l)}finally{zA(!1)}}}else v=l;return w.memoizedState=w.baseState=v,C={pending:null,lanes:0,dispatch:null,lastRenderedReducer:C,lastRenderedState:v},w.queue=C,C=C.dispatch=mv.bind(null,ai,C),[w.memoizedState,C]},useRef:function(C){var l=Ro();return C={current:C},l.memoizedState=C},useState:function(C){C=Xu(C);var l=C.queue,d=qM.bind(null,ai,l);return l.dispatch=d,[C.memoizedState,d]},useDebugValue:Pp,useDeferredValue:function(C,l){var d=Ro();return WS(d,C,l)},useTransition:function(){var C=Xu(!1);return C=VS.bind(null,ai,C.queue,!0,!1),Ro().memoizedState=C,[!1,C]},useSyncExternalStore:function(C,l,d){var w=ai,v=Ro();if(zi){if(d===void 0)throw Error(i(407));d=d()}else{if(d=l(),Rg===null)throw Error(i(349));(Zi&127)!==0||SM(w,l,d)}v.memoizedState=d;var L={value:d,getSnapshot:l};return v.queue=L,bM(TS.bind(null,w,L,C),[C]),w.flags|=2048,OQ(9,{destroy:void 0},xS.bind(null,w,L,d,l),null),d},useId:function(){var C=Ro(),l=Rg.identifierPrefix;if(zi){var d=Ms,w=ks;d=(w&~(1<<32-ge(w)-1)).toString(32)+d,l="_"+l+"R_"+d,d=_p++,0<d&&(l+="H"+d.toString(32)),l+="_"}else d=pv++,l="_"+l+"r_"+d.toString(32)+"_";return C.memoizedState=l},useHostTransitionStatus:Aw,useFormState:GM,useActionState:GM,useOptimistic:function(C){var l=Ro();l.memoizedState=l.baseState=C;var d={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return l.queue=d,l=$u.bind(null,ai,!0,d),d.dispatch=l,[C,l]},useMemoCache:JS,useCacheRefresh:function(){return Ro().memoizedState=wv.bind(null,ai)},useEffectEvent:function(C){var l=Ro(),d={impl:C};return l.memoizedState=d,function(){if((tg&2)!==0)throw Error(i(440));return d.impl.apply(void 0,arguments)}}},jQ={readContext:pn,use:Jp,useCallback:jS,useContext:pn,useEffect:OS,useImperativeHandle:Op,useInsertionEffect:JM,useLayoutEffect:Ka,useMemo:ZS,useReducer:Lp,useRef:FM,useState:function(){return Lp(JC)},useDebugValue:Pp,useDeferredValue:function(C,l){var d=bI();return zS(d,xg.memoizedState,C,l)},useTransition:function(){var C=Lp(JC)[0],l=bI().memoizedState;return[typeof C=="boolean"?C:Vu(C),l]},useSyncExternalStore:qS,useId:Ln,useHostTransitionStatus:Aw,useFormState:RM,useActionState:RM,useOptimistic:function(C,l){var d=bI();return wM(d,xg,C,l)},useMemoCache:JS,useCacheRefresh:ew};jQ.useEffectEvent=_M;var eh={readContext:pn,use:Jp,useCallback:jS,useContext:pn,useEffect:OS,useImperativeHandle:Op,useInsertionEffect:JM,useLayoutEffect:Ka,useMemo:ZS,useReducer:qp,useRef:FM,useState:function(){return qp(JC)},useDebugValue:Pp,useDeferredValue:function(C,l){var d=bI();return xg===null?WS(d,C,l):zS(d,xg.memoizedState,C,l)},useTransition:function(){var C=qp(JC)[0],l=bI().memoizedState;return[typeof C=="boolean"?C:Vu(C),l]},useSyncExternalStore:qS,useId:Ln,useHostTransitionStatus:Aw,useFormState:KM,useActionState:KM,useOptimistic:function(C,l){var d=bI();return xg!==null?wM(d,xg,C,l):(d.baseState=C,[C,d.queue.dispatch])},useMemoCache:JS,useCacheRefresh:ew};eh.useEffectEvent=_M;function ZQ(C,l,d,w){l=C.memoizedState,d=d(w,l),d=d==null?l:B({},l,d),C.memoizedState=d,C.lanes===0&&(C.updateQueue.baseState=d)}var th={enqueueSetState:function(C,l,d){C=C._reactInternals;var w=Ko(),v=Gs(w);v.payload=l,d!=null&&(v.callback=d),l=vC(C,v,w),l!==null&&(h(l,C,w),Ac(l,C,w))},enqueueReplaceState:function(C,l,d){C=C._reactInternals;var w=Ko(),v=Gs(w);v.tag=1,v.payload=l,d!=null&&(v.callback=d),l=vC(C,v,w),l!==null&&(h(l,C,w),Ac(l,C,w))},enqueueForceUpdate:function(C,l){C=C._reactInternals;var d=Ko(),w=Gs(d);w.tag=2,l!=null&&(w.callback=l),l=vC(C,w,d),l!==null&&(h(l,C,d),Ac(l,C,d))}};function TM(C,l,d,w,v,L,V){return C=C.stateNode,typeof C.shouldComponentUpdate=="function"?C.shouldComponentUpdate(w,L,V):l.prototype&&l.prototype.isPureReactComponent?!UQ(d,w)||!UQ(v,L):!0}function YM(C,l,d,w){C=l.state,typeof l.componentWillReceiveProps=="function"&&l.componentWillReceiveProps(d,w),typeof l.UNSAFE_componentWillReceiveProps=="function"&&l.UNSAFE_componentWillReceiveProps(d,w),l.state!==C&&th.enqueueReplaceState(l,l.state,null)}function qn(C,l){var d=l;if("ref"in l){d={};for(var w in l)w!=="ref"&&(d[w]=l[w])}if(C=C.defaultProps){d===l&&(d=B({},d));for(var v in C)d[v]===void 0&&(d[v]=C[v])}return d}function tw(C){YB(C)}function HM(C){}function jp(C){YB(C)}function Zp(C,l){try{var d=C.onUncaughtError;d(l.value,{componentStack:l.stack})}catch(w){setTimeout(function(){throw w})}}function OM(C,l,d){try{var w=C.onCaughtError;w(d.value,{componentStack:d.stack,errorBoundary:l.tag===1?l.stateNode:null})}catch(v){setTimeout(function(){throw v})}}function iw(C,l,d){return d=Gs(d),d.tag=3,d.payload={element:null},d.callback=function(){Zp(C,l)},d}function WQ(C){return C=Gs(C),C.tag=3,C}function Ia(C,l,d,w){var v=d.type.getDerivedStateFromError;if(typeof v=="function"){var L=w.value;C.payload=function(){return v(L)},C.callback=function(){OM(l,d,w)}}var V=d.stateNode;V!==null&&typeof V.componentDidCatch=="function"&&(C.callback=function(){OM(l,d,w),typeof v!="function"&&(Js===null?Js=new Set([this]):Js.add(this));var BA=w.stack;this.componentDidCatch(w.value,{componentStack:BA!==null?BA:""})})}function Fa(C,l,d,w,v){if(d.flags|=32768,w!==null&&typeof w=="object"&&typeof w.then=="function"){if(l=d.alternate,l!==null&&ZB(l,d,v,!0),d=gn.current,d!==null){switch(d.tag){case 31:case 13:return Br===null?Ei():d.alternate===null&&Ug===0&&(Ug=3),d.flags&=-257,d.flags|=65536,d.lanes=v,w===Ou?d.flags|=16384:(l=d.updateQueue,l===null?d.updateQueue=new Set([w]):l.add(w),kv(C,w,v)),!1;case 22:return d.flags|=65536,w===Ou?d.flags|=16384:(l=d.updateQueue,l===null?(l={transitions:null,markerInstances:null,retryQueue:new Set([w])},d.updateQueue=l):(d=l.retryQueue,d===null?l.retryQueue=new Set([w]):d.add(w)),kv(C,w,v)),!1}throw Error(i(435,d.tag))}return kv(C,w,v),Ei(),!1}if(zi)return l=gn.current,l!==null?((l.flags&65536)===0&&(l.flags|=256),l.flags|=65536,l.lanes=v,w!==Mp&&(C=Error(i(422),{cause:w}),Tu(ea(C,d)))):(w!==Mp&&(l=Error(i(423),{cause:w}),Tu(ea(l,d))),C=C.current.alternate,C.flags|=65536,v&=-v,C.lanes|=v,w=ea(w,d),v=iw(C.stateNode,w,v),Fp(C,v),Ug!==4&&(Ug=2)),!1;var L=Error(i(520),{cause:w});if(L=ea(L,d),As===null?As=[L]:As.push(L),Ug!==4&&(Ug=2),l===null)return!0;w=ea(w,d),d=l;do{switch(d.tag){case 3:return d.flags|=65536,C=v&-v,d.lanes|=C,C=iw(d.stateNode,w,C),Fp(d,C),!1;case 1:if(l=d.type,L=d.stateNode,(d.flags&128)===0&&(typeof l.getDerivedStateFromError=="function"||L!==null&&typeof L.componentDidCatch=="function"&&(Js===null||!Js.has(L))))return d.flags|=65536,v&=-v,d.lanes|=v,v=WQ(v),Ia(v,C,d,w),Fp(d,v),!1}d=d.return}while(d!==null);return!1}var Wp=Error(i(461)),oI=!1;function wI(C,l,d,w){l.child=C===null?pM(l,null,d,w):El(l,C.child,d,w)}function ih(C,l,d,w,v){d=d.render;var L=l.ref;if("ref"in w){var V={};for(var BA in w)BA!=="ref"&&(V[BA]=w[BA])}else V=w;return cl(l),w=FS(C,l,d,V,L,v),BA=bS(),C!==null&&!oI?(vS(C,l,v),Xr(C,l,v)):(zi&&BA&&kp(l),l.flags|=1,wI(C,l,w,v),l.child)}function gh(C,l,d,w,v){if(C===null){var L=d.type;return typeof L=="function"&&!No(L)&&L.defaultProps===void 0&&d.compare===null?(l.tag=15,l.type=L,ba(C,l,L,w,v)):(C=Lu(d.type,null,w,l,l.mode,v),C.ref=l.ref,C.return=l,l.child=C)}if(L=C.child,!ic(C,v)){var V=L.memoizedProps;if(d=d.compare,d=d!==null?d:UQ,d(V,w)&&C.ref===l.ref)return Xr(C,l,v)}return l.flags|=1,C=ws(L,w),C.ref=l.ref,C.return=l,l.child=C}function ba(C,l,d,w,v){if(C!==null){var L=C.memoizedProps;if(UQ(L,w)&&C.ref===l.ref)if(oI=!1,l.pendingProps=w=L,ic(C,v))(C.flags&131072)!==0&&(oI=!0);else return l.lanes=C.lanes,Xr(C,l,v)}return zQ(C,l,d,w,v)}function va(C,l,d,w){var v=w.children,L=C!==null?C.memoizedState:null;if(C===null&&l.stateNode===null&&(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),w.mode==="hidden"){if((l.flags&128)!==0){if(L=L!==null?L.baseLanes|d:d,C!==null){for(w=l.child=C.child,v=0;w!==null;)v=v|w.lanes|w.childLanes,w=w.sibling;w=v&~L}else w=0,l.child=null;return Fs(C,l,L,d,w)}if((d&536870912)!==0)l.memoizedState={baseLanes:0,cachePool:null},C!==null&&YQ(l,L!==null?L.cachePool:null),L!==null?GS(l,L):RS(),fM(l);else return w=l.lanes=536870912,Fs(C,l,L!==null?L.baseLanes|d:d,d,w)}else L!==null?(YQ(l,L.cachePool),GS(l,L),_C(),l.memoizedState=null):(C!==null&&YQ(l,null),RS(),_C());return wI(C,l,v,d),l.child}function zr(C,l){return C!==null&&C.tag===22||l.stateNode!==null||(l.stateNode={_visibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null}),l.sibling}function Fs(C,l,d,w,v){var L=Ns();return L=L===null?null:{parent:Ht._currentValue,pool:L},l.memoizedState={baseLanes:d,cachePool:L},C!==null&&YQ(l,null),RS(),fM(l),C!==null&&ZB(C,l,w,!0),l.childLanes=v,null}function cr(C,l){return l=VQ({mode:l.mode,children:l.children},C.mode),l.ref=C.ref,C.child=l,l.return=C,l}function fn(C,l,d){return El(l,C.child,null,d),C=cr(l,l.pendingProps),C.flags|=2,Ua(l),l.memoizedState=null,C}function Ih(C,l,d){var w=l.pendingProps,v=(l.flags&128)!==0;if(l.flags&=-129,C===null){if(zi){if(w.mode==="hidden")return C=cr(l,w),l.lanes=536870912,zr(null,C);if(US(l),(C=AI)?(C=Q3(C,dn),C=C!==null&&C.data==="&"?C:null,C!==null&&(l.memoizedState={dehydrated:C,treeContext:ms!==null?{id:ks,overflow:Ms}:null,retryLane:536870912,hydrationErrors:null},d=lM(C),d.return=l,l.child=d,hn=l,AI=null)):C=null,C===null)throw ji(l);return l.lanes=536870912,null}return cr(l,w)}var L=C.memoizedState;if(L!==null){var V=L.dehydrated;if(US(l),v)if(l.flags&256)l.flags&=-257,l=fn(C,l,d);else if(l.memoizedState!==null)l.child=C.child,l.flags|=128,l=null;else throw Error(i(558));else if(oI||ZB(C,l,d,!1),v=(d&C.childLanes)!==0,oI||v){if(w=Rg,w!==null&&(V=lt(w,d),V!==0&&V!==L.retryLane))throw L.retryLane=V,OB(C,V),h(w,C,V),Wp;Ei(),l=fn(C,l,d)}else C=L.treeContext,AI=Ls(V.nextSibling),hn=l,zi=!0,RC=null,dn=!1,C!==null&&xu(l,C),l=cr(l,w),l.flags|=4096;return l}return C=ws(C.child,{mode:w.mode,children:w.children}),C.ref=l.ref,l.child=C,C.return=l,C}function Vr(C,l){var d=l.ref;if(d===null)C!==null&&C.ref!==null&&(l.flags|=4194816);else{if(typeof d!="function"&&typeof d!="object")throw Error(i(284));(C===null||C.ref!==d)&&(l.flags|=4194816)}}function zQ(C,l,d,w,v){return cl(l),d=FS(C,l,d,w,void 0,v),w=bS(),C!==null&&!oI?(vS(C,l,v),Xr(C,l,v)):(zi&&w&&kp(l),l.flags|=1,wI(C,l,d,v),l.child)}function ao(C,l,d,w,v,L){return cl(l),l.updateQueue=null,d=yM(l,w,d,v),DM(C),w=bS(),C!==null&&!oI?(vS(C,l,L),Xr(C,l,L)):(zi&&w&&kp(l),l.flags|=1,wI(C,l,d,L),l.child)}function xn(C,l,d,w,v){if(cl(l),l.stateNode===null){var L=PB,V=d.contextType;typeof V=="object"&&V!==null&&(L=pn(V)),L=new d(w,L),l.memoizedState=L.state!==null&&L.state!==void 0?L.state:null,L.updater=th,l.stateNode=L,L._reactInternals=l,L=l.stateNode,L.props=w,L.state=l.memoizedState,L.refs={},kS(l),V=d.contextType,L.context=typeof V=="object"&&V!==null?pn(V):PB,L.state=l.memoizedState,V=d.getDerivedStateFromProps,typeof V=="function"&&(ZQ(l,d,V,w),L.state=l.memoizedState),typeof d.getDerivedStateFromProps=="function"||typeof L.getSnapshotBeforeUpdate=="function"||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(V=L.state,typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount(),V!==L.state&&th.enqueueReplaceState(L,L.state,null),ul(l,w,L,v),Zu(),L.state=l.memoizedState),typeof L.componentDidMount=="function"&&(l.flags|=4194308),w=!0}else if(C===null){L=l.stateNode;var BA=l.memoizedProps,YA=qn(d,BA);L.props=YA;var De=L.context,Je=d.contextType;V=PB,typeof Je=="object"&&Je!==null&&(V=pn(Je));var He=d.getDerivedStateFromProps;Je=typeof He=="function"||typeof L.getSnapshotBeforeUpdate=="function",BA=l.pendingProps!==BA,Je||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(BA||De!==V)&&YM(l,L,w,V),$B=!1;var me=l.memoizedState;L.state=me,ul(l,w,L,v),Zu(),De=l.memoizedState,BA||me!==De||$B?(typeof He=="function"&&(ZQ(l,d,He,w),De=l.memoizedState),(YA=$B||TM(l,d,YA,w,me,De,V))?(Je||typeof L.UNSAFE_componentWillMount!="function"&&typeof L.componentWillMount!="function"||(typeof L.componentWillMount=="function"&&L.componentWillMount(),typeof L.UNSAFE_componentWillMount=="function"&&L.UNSAFE_componentWillMount()),typeof L.componentDidMount=="function"&&(l.flags|=4194308)):(typeof L.componentDidMount=="function"&&(l.flags|=4194308),l.memoizedProps=w,l.memoizedState=De),L.props=w,L.state=De,L.context=V,w=YA):(typeof L.componentDidMount=="function"&&(l.flags|=4194308),w=!1)}else{L=l.stateNode,MS(C,l),V=l.memoizedProps,Je=qn(d,V),L.props=Je,He=l.pendingProps,me=L.context,De=d.contextType,YA=PB,typeof De=="object"&&De!==null&&(YA=pn(De)),BA=d.getDerivedStateFromProps,(De=typeof BA=="function"||typeof L.getSnapshotBeforeUpdate=="function")||typeof L.UNSAFE_componentWillReceiveProps!="function"&&typeof L.componentWillReceiveProps!="function"||(V!==He||me!==YA)&&YM(l,L,w,YA),$B=!1,me=l.memoizedState,L.state=me,ul(l,w,L,v),Zu();var Ue=l.memoizedState;V!==He||me!==Ue||$B||C!==null&&C.dependencies!==null&&xQ(C.dependencies)?(typeof BA=="function"&&(ZQ(l,d,BA,w),Ue=l.memoizedState),(Je=$B||TM(l,d,Je,w,me,Ue,YA)||C!==null&&C.dependencies!==null&&xQ(C.dependencies))?(De||typeof L.UNSAFE_componentWillUpdate!="function"&&typeof L.componentWillUpdate!="function"||(typeof L.componentWillUpdate=="function"&&L.componentWillUpdate(w,Ue,YA),typeof L.UNSAFE_componentWillUpdate=="function"&&L.UNSAFE_componentWillUpdate(w,Ue,YA)),typeof L.componentDidUpdate=="function"&&(l.flags|=4),typeof L.getSnapshotBeforeUpdate=="function"&&(l.flags|=1024)):(typeof L.componentDidUpdate!="function"||V===C.memoizedProps&&me===C.memoizedState||(l.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||V===C.memoizedProps&&me===C.memoizedState||(l.flags|=1024),l.memoizedProps=w,l.memoizedState=Ue),L.props=w,L.state=Ue,L.context=YA,w=Je):(typeof L.componentDidUpdate!="function"||V===C.memoizedProps&&me===C.memoizedState||(l.flags|=4),typeof L.getSnapshotBeforeUpdate!="function"||V===C.memoizedProps&&me===C.memoizedState||(l.flags|=1024),w=!1)}return L=w,Vr(C,l),w=(l.flags&128)!==0,L||w?(L=l.stateNode,d=w&&typeof d.getDerivedStateFromError!="function"?null:L.render(),l.flags|=1,C!==null&&w?(l.child=El(l,C.child,null,v),l.child=El(l,null,d,v)):wI(C,l,d,v),l.memoizedState=L.state,C=l.child):C=Xr(C,l,v),C}function og(C,l,d,w){return Bl(),l.flags|=256,wI(C,l,d,w),l.child}var _a={dehydrated:null,treeContext:null,retryLane:0,hydrationErrors:null};function lr(C){return{baseLanes:C,cachePool:Rp()}}function nh(C,l,d){return C=C!==null?C.childLanes&~d:0,l&&(C|=ig),C}function Ja(C,l,d){var w=l.pendingProps,v=!1,L=(l.flags&128)!==0,V;if((V=L)||(V=C!==null&&C.memoizedState===null?!1:(yI.current&2)!==0),V&&(v=!0,l.flags&=-129),V=(l.flags&32)!==0,l.flags&=-33,C===null){if(zi){if(v?ec(l):_C(),(C=AI)?(C=Q3(C,dn),C=C!==null&&C.data!=="&"?C:null,C!==null&&(l.memoizedState={dehydrated:C,treeContext:ms!==null?{id:ks,overflow:Ms}:null,retryLane:536870912,hydrationErrors:null},d=lM(C),d.return=l,l.child=d,hn=l,AI=null)):C=null,C===null)throw ji(l);return Yv(C)?l.lanes=32:l.lanes=536870912,null}var BA=w.children;return w=w.fallback,v?(_C(),v=l.mode,BA=VQ({mode:"hidden",children:BA},v),w=NC(w,v,d,null),BA.return=l,w.return=l,BA.sibling=w,l.child=BA,w=l.child,w.memoizedState=lr(d),w.childLanes=nh(C,V,d),l.memoizedState=_a,zr(null,w)):(ec(l),tc(l,BA))}var YA=C.memoizedState;if(YA!==null&&(BA=YA.dehydrated,BA!==null)){if(L)l.flags&256?(ec(l),l.flags&=-257,l=XQ(C,l,d)):l.memoizedState!==null?(_C(),l.child=C.child,l.flags|=128,l=null):(_C(),BA=w.fallback,v=l.mode,w=VQ({mode:"visible",children:w.children},v),BA=NC(BA,v,d,null),BA.flags|=2,w.return=l,BA.return=l,w.sibling=BA,l.child=w,El(l,C.child,null,d),w=l.child,w.memoizedState=lr(d),w.childLanes=nh(C,V,d),l.memoizedState=_a,l=zr(null,w));else if(ec(l),Yv(BA)){if(V=BA.nextSibling&&BA.nextSibling.dataset,V)var De=V.dgst;V=De,w=Error(i(419)),w.stack="",w.digest=V,Tu({value:w,source:null,stack:null}),l=XQ(C,l,d)}else if(oI||ZB(C,l,d,!1),V=(d&C.childLanes)!==0,oI||V){if(V=Rg,V!==null&&(w=lt(V,d),w!==0&&w!==YA.retryLane))throw YA.retryLane=w,OB(C,w),h(V,C,w),Wp;Tv(BA)||Ei(),l=XQ(C,l,d)}else Tv(BA)?(l.flags|=192,l.child=C.child,l=null):(C=YA.treeContext,AI=Ls(BA.nextSibling),hn=l,zi=!0,RC=null,dn=!1,C!==null&&xu(l,C),l=tc(l,w.children),l.flags|=4096);return l}return v?(_C(),BA=w.fallback,v=l.mode,YA=C.child,De=YA.sibling,w=ws(YA,{mode:"hidden",children:w.children}),w.subtreeFlags=YA.subtreeFlags&65011712,De!==null?BA=ws(De,BA):(BA=NC(BA,v,d,null),BA.flags|=2),BA.return=l,w.return=l,w.sibling=BA,l.child=w,zr(null,w),w=l.child,BA=C.child.memoizedState,BA===null?BA=lr(d):(v=BA.cachePool,v!==null?(YA=Ht._currentValue,v=v.parent!==YA?{parent:YA,pool:YA}:v):v=Rp(),BA={baseLanes:BA.baseLanes|d,cachePool:v}),w.memoizedState=BA,w.childLanes=nh(C,V,d),l.memoizedState=_a,zr(C.child,w)):(ec(l),d=C.child,C=d.sibling,d=ws(d,{mode:"visible",children:w.children}),d.return=l,d.sibling=null,C!==null&&(V=l.deletions,V===null?(l.deletions=[C],l.flags|=16):V.push(C)),l.child=d,l.memoizedState=null,d)}function tc(C,l){return l=VQ({mode:"visible",children:l},C.mode),l.return=C,C.child=l}function VQ(C,l){return C=Mo(22,C,null,l),C.lanes=0,C}function XQ(C,l,d){return El(l,C.child,null,d),C=tc(l,l.pendingProps.children),C.flags|=2,l.memoizedState=null,C}function pl(C,l,d){C.lanes|=l;var w=C.alternate;w!==null&&(w.lanes|=l),FC(C.return,l,d)}function oh(C,l,d,w,v,L){var V=C.memoizedState;V===null?C.memoizedState={isBackwards:l,rendering:null,renderingStartTime:0,last:w,tail:d,tailMode:v,treeForkCount:L}:(V.isBackwards=l,V.rendering=null,V.renderingStartTime=0,V.last=w,V.tail=d,V.tailMode=v,V.treeForkCount=L)}function ah(C,l,d){var w=l.pendingProps,v=w.revealOrder,L=w.tail;w=w.children;var V=yI.current,BA=(V&2)!==0;if(BA?(V=V&1|2,l.flags|=128):V&=1,sA(yI,V),wI(C,l,w,d),w=zi?qQ:0,!BA&&C!==null&&(C.flags&128)!==0)A:for(C=l.child;C!==null;){if(C.tag===13)C.memoizedState!==null&&pl(C,d,l);else if(C.tag===19)pl(C,d,l);else if(C.child!==null){C.child.return=C,C=C.child;continue}if(C===l)break A;for(;C.sibling===null;){if(C.return===null||C.return===l)break A;C=C.return}C.sibling.return=C.return,C=C.sibling}switch(v){case"forwards":for(d=l.child,v=null;d!==null;)C=d.alternate,C!==null&&bp(C)===null&&(v=d),d=d.sibling;d=v,d===null?(v=l.child,l.child=null):(v=d.sibling,d.sibling=null),oh(l,!1,v,d,L,w);break;case"backwards":case"unstable_legacy-backwards":for(d=null,v=l.child,l.child=null;v!==null;){if(C=v.alternate,C!==null&&bp(C)===null){l.child=v;break}C=v.sibling,v.sibling=d,d=v,v=C}oh(l,!0,d,null,L,w);break;case"together":oh(l,!1,null,null,void 0,w);break;default:l.memoizedState=null}return l.child}function Xr(C,l,d){if(C!==null&&(l.dependencies=C.dependencies),xa|=l.lanes,(d&l.childLanes)===0)if(C!==null){if(ZB(C,l,d,!1),(d&l.childLanes)===0)return null}else return null;if(C!==null&&l.child!==C.child)throw Error(i(153));if(l.child!==null){for(C=l.child,d=ws(C,C.pendingProps),l.child=d,d.return=l;C.sibling!==null;)C=C.sibling,d=d.sibling=ws(C,C.pendingProps),d.return=l;d.sibling=null}return l.child}function ic(C,l){return(C.lanes&l)!==0?!0:(C=C.dependencies,!!(C!==null&&xQ(C)))}function rh(C,l,d){switch(l.tag){case 3:KA(l,l.stateNode.containerInfo),KC(l,Ht,C.memoizedState.cache),Bl();break;case 27:case 5:RA(l);break;case 4:KA(l,l.stateNode.containerInfo);break;case 10:KC(l,l.type,l.memoizedProps.value);break;case 31:if(l.memoizedState!==null)return l.flags|=128,US(l),null;break;case 13:var w=l.memoizedState;if(w!==null)return w.dehydrated!==null?(ec(l),l.flags|=128,null):(d&l.child.childLanes)!==0?Ja(C,l,d):(ec(l),C=Xr(C,l,d),C!==null?C.sibling:null);ec(l);break;case 19:var v=(C.flags&128)!==0;if(w=(d&l.childLanes)!==0,w||(ZB(C,l,d,!1),w=(d&l.childLanes)!==0),v){if(w)return ah(C,l,d);l.flags|=128}if(v=l.memoizedState,v!==null&&(v.rendering=null,v.tail=null,v.lastEffect=null),sA(yI,yI.current),w)break;return null;case 22:return l.lanes=0,va(C,l,d,l.pendingProps);case 24:KC(l,Ht,C.memoizedState.cache)}return Xr(C,l,d)}function zp(C,l,d){if(C!==null)if(C.memoizedProps!==l.pendingProps)oI=!0;else{if(!ic(C,d)&&(l.flags&128)===0)return oI=!1,rh(C,l,d);oI=(C.flags&131072)!==0}else oI=!1,zi&&(l.flags&1048576)!==0&&ES(l,qQ,l.index);switch(l.lanes=0,l.tag){case 16:A:{var w=l.pendingProps;if(C=Ql(l.elementType),l.type=C,typeof C=="function")No(C)?(w=qn(C,w),l.tag=1,l=xn(null,l,C,w,d)):(l.tag=0,l=zQ(null,l,C,w,d));else{if(C!=null){var v=C.$$typeof;if(v===m){l.tag=11,l=ih(null,l,C,w,d);break A}else if(v===b){l.tag=14,l=gh(null,l,C,w,d);break A}}throw l=P(C)||C,Error(i(306,l,""))}}return l;case 0:return zQ(C,l,l.type,l.pendingProps,d);case 1:return w=l.type,v=qn(w,l.pendingProps),xn(C,l,w,v,d);case 3:A:{if(KA(l,l.stateNode.containerInfo),C===null)throw Error(i(387));w=l.pendingProps;var L=l.memoizedState;v=L.element,MS(C,l),ul(l,w,null,d);var V=l.memoizedState;if(w=V.cache,KC(l,Ht,w),w!==L.cache&&Gp(l,[Ht],d,!0),Zu(),w=V.element,L.isDehydrated)if(L={element:w,isDehydrated:!1,cache:V.cache},l.updateQueue.baseState=L,l.memoizedState=L,l.flags&256){l=og(C,l,w,d);break A}else if(w!==v){v=ea(Error(i(424)),l),Tu(v),l=og(C,l,w,d);break A}else{switch(C=l.stateNode.containerInfo,C.nodeType){case 9:C=C.body;break;default:C=C.nodeName==="HTML"?C.ownerDocument.body:C}for(AI=Ls(C.firstChild),hn=l,zi=!0,RC=null,dn=!0,d=pM(l,null,w,d),l.child=d;d;)d.flags=d.flags&-3|4096,d=d.sibling}else{if(Bl(),w===v){l=Xr(C,l,d);break A}wI(C,l,w,d)}l=l.child}return l;case 26:return Vr(C,l),C===null?(d=f3(l.type,null,l.pendingProps,null))?l.memoizedState=d:zi||(d=l.type,C=l.pendingProps,w=$M(IA.current).createElement(d),w[Me]=l,w[We]=C,Fo(w,d,C),oe(w),l.stateNode=w):l.memoizedState=f3(l.type,C.memoizedProps,l.pendingProps,C.memoizedState),null;case 27:return RA(l),C===null&&zi&&(w=l.stateNode=h3(l.type,l.pendingProps,IA.current),hn=l,dn=!0,v=AI,IE(l.type)?(Hv=v,AI=Ls(w.firstChild)):AI=v),wI(C,l,l.pendingProps.children,d),Vr(C,l),C===null&&(l.flags|=4194304),l.child;case 5:return C===null&&zi&&((v=w=AI)&&(w=urA(w,l.type,l.pendingProps,dn),w!==null?(l.stateNode=w,hn=l,AI=Ls(w.firstChild),dn=!1,v=!0):v=!1),v||ji(l)),RA(l),v=l.type,L=l.pendingProps,V=C!==null?C.memoizedProps:null,w=L.children,Lv(v,L)?w=null:V!==null&&Lv(v,V)&&(l.flags|=32),l.memoizedState!==null&&(v=FS(C,l,fv,null,null,d),cw._currentValue=v),Vr(C,l),wI(C,l,w,d),l.child;case 6:return C===null&&zi&&((C=d=AI)&&(d=hrA(d,l.pendingProps,dn),d!==null?(l.stateNode=d,hn=l,AI=null,C=!0):C=!1),C||ji(l)),null;case 13:return Ja(C,l,d);case 4:return KA(l,l.stateNode.containerInfo),w=l.pendingProps,C===null?l.child=El(l,null,w,d):wI(C,l,w,d),l.child;case 11:return ih(C,l,l.type,l.pendingProps,d);case 7:return wI(C,l,l.pendingProps,d),l.child;case 8:return wI(C,l,l.pendingProps.children,d),l.child;case 12:return wI(C,l,l.pendingProps.children,d),l.child;case 10:return w=l.pendingProps,KC(l,l.type,w.value),wI(C,l,w.children,d),l.child;case 9:return v=l.type._context,w=l.pendingProps.children,cl(l),v=pn(v),w=w(v),l.flags|=1,wI(C,l,w,d),l.child;case 14:return gh(C,l,l.type,l.pendingProps,d);case 15:return ba(C,l,l.type,l.pendingProps,d);case 19:return ah(C,l,d);case 31:return Ih(C,l,d);case 22:return va(C,l,d,l.pendingProps);case 24:return cl(l),w=pn(Ht),C===null?(v=Ns(),v===null&&(v=Rg,L=fS(),v.pooledCache=L,L.refCount++,L!==null&&(v.pooledCacheLanes|=d),v=L),l.memoizedState={parent:w,cache:v},kS(l),KC(l,Ht,v)):((C.lanes&d)!==0&&(MS(C,l),ul(l,null,null,d),Zu()),v=C.memoizedState,L=l.memoizedState,v.parent!==w?(v={parent:w,cache:w},l.memoizedState=v,l.lanes===0&&(l.memoizedState=l.updateQueue.baseState=v),KC(l,Ht,w)):(w=L.cache,KC(l,Ht,w),w!==v.cache&&Gp(l,[Ht],d,!0))),wI(C,l,l.pendingProps.children,d),l.child;case 29:throw l.pendingProps}throw Error(i(156,l.tag))}function na(C){C.flags|=4}function gc(C,l,d,w,v){if((l=(C.mode&32)!==0)&&(l=!1),l){if(C.flags|=16777216,(v&335544128)===v)if(C.stateNode.complete)C.flags|=8192;else if(rt())C.flags|=8192;else throw $t=Ou,Hu}else C.flags&=-16777217}function qC(C,l){if(l.type!=="stylesheet"||(l.state.loading&4)!==0)C.flags&=-16777217;else if(C.flags|=16777216,!m3(l))if(rt())C.flags|=8192;else throw $t=Ou,Hu}function $Q(C,l){l!==null&&(C.flags|=4),C.flags&16384&&(l=C.tag!==22?pe():536870912,C.lanes|=l,Ta|=l)}function sh(C,l){if(!zi)switch(C.tailMode){case"hidden":l=C.tail;for(var d=null;l!==null;)l.alternate!==null&&(d=l),l=l.sibling;d===null?C.tail=null:d.sibling=null;break;case"collapsed":d=C.tail;for(var w=null;d!==null;)d.alternate!==null&&(w=d),d=d.sibling;w===null?l||C.tail===null?C.tail=null:C.tail.sibling=null:w.sibling=null}}function Jg(C){var l=C.alternate!==null&&C.alternate.child===C.child,d=0,w=0;if(l)for(var v=C.child;v!==null;)d|=v.lanes|v.childLanes,w|=v.subtreeFlags&65011712,w|=v.flags&65011712,v.return=C,v=v.sibling;else for(v=C.child;v!==null;)d|=v.lanes|v.childLanes,w|=v.subtreeFlags,w|=v.flags,v.return=C,v=v.sibling;return C.subtreeFlags|=w,C.childLanes=d,l}function gw(C,l,d){var w=l.pendingProps;switch(jB(l),l.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return Jg(l),null;case 1:return Jg(l),null;case 3:return d=l.stateNode,w=null,C!==null&&(w=C.memoizedState.cache),l.memoizedState.cache!==w&&(l.flags|=2048),Cr(Ht),FA(),d.pendingContext&&(d.context=d.pendingContext,d.pendingContext=null),(C===null||C.child===null)&&(Cl(l)?na(l):C===null||C.memoizedState.isDehydrated&&(l.flags&256)===0||(l.flags|=1024,uS())),Jg(l),null;case 26:var v=l.type,L=l.memoizedState;return C===null?(na(l),L!==null?(Jg(l),qC(l,L)):(Jg(l),gc(l,v,null,w,d))):L?L!==C.memoizedState?(na(l),Jg(l),qC(l,L)):(Jg(l),l.flags&=-16777217):(C=C.memoizedProps,C!==w&&na(l),Jg(l),gc(l,v,C,w,d)),null;case 27:if(MA(l),d=IA.current,v=l.type,C!==null&&l.stateNode!=null)C.memoizedProps!==w&&na(l);else{if(!w){if(l.stateNode===null)throw Error(i(166));return Jg(l),null}C=rA.current,Cl(l)?Np(l):(C=h3(v,w,d),l.stateNode=C,na(l))}return Jg(l),null;case 5:if(MA(l),v=l.type,C!==null&&l.stateNode!=null)C.memoizedProps!==w&&na(l);else{if(!w){if(l.stateNode===null)throw Error(i(166));return Jg(l),null}if(L=rA.current,Cl(l))Np(l);else{var V=$M(IA.current);switch(L){case 1:L=V.createElementNS("http://www.w3.org/2000/svg",v);break;case 2:L=V.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;default:switch(v){case"svg":L=V.createElementNS("http://www.w3.org/2000/svg",v);break;case"math":L=V.createElementNS("http://www.w3.org/1998/Math/MathML",v);break;case"script":L=V.createElement("div"),L.innerHTML="<script><\/script>",L=L.removeChild(L.firstChild);break;case"select":L=typeof w.is=="string"?V.createElement("select",{is:w.is}):V.createElement("select"),w.multiple?L.multiple=!0:w.size&&(L.size=w.size);break;default:L=typeof w.is=="string"?V.createElement(v,{is:w.is}):V.createElement(v)}}L[Me]=l,L[We]=w;A:for(V=l.child;V!==null;){if(V.tag===5||V.tag===6)L.appendChild(V.stateNode);else if(V.tag!==4&&V.tag!==27&&V.child!==null){V.child.return=V,V=V.child;continue}if(V===l)break A;for(;V.sibling===null;){if(V.return===null||V.return===l)break A;V=V.return}V.sibling.return=V.return,V=V.sibling}l.stateNode=L;A:switch(Fo(L,v,w),v){case"button":case"input":case"select":case"textarea":w=!!w.autoFocus;break A;case"img":w=!0;break A;default:w=!1}w&&na(l)}}return Jg(l),gc(l,l.type,C===null?null:C.memoizedProps,l.pendingProps,d),null;case 6:if(C&&l.stateNode!=null)C.memoizedProps!==w&&na(l);else{if(typeof w!="string"&&l.stateNode===null)throw Error(i(166));if(C=IA.current,Cl(l)){if(C=l.stateNode,d=l.memoizedProps,w=null,v=hn,v!==null)switch(v.tag){case 27:case 5:w=v.memoizedProps}C[Me]=l,C=!!(C.nodeValue===d||w!==null&&w.suppressHydrationWarning===!0||o3(C.nodeValue,d)),C||ji(l,!0)}else C=$M(C).createTextNode(w),C[Me]=l,l.stateNode=C}return Jg(l),null;case 31:if(d=l.memoizedState,C===null||C.memoizedState!==null){if(w=Cl(l),d!==null){if(C===null){if(!w)throw Error(i(318));if(C=l.memoizedState,C=C!==null?C.dehydrated:null,!C)throw Error(i(557));C[Me]=l}else Bl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Jg(l),C=!1}else d=uS(),C!==null&&C.memoizedState!==null&&(C.memoizedState.hydrationErrors=d),C=!0;if(!C)return l.flags&256?(Ua(l),l):(Ua(l),null);if((l.flags&128)!==0)throw Error(i(558))}return Jg(l),null;case 13:if(w=l.memoizedState,C===null||C.memoizedState!==null&&C.memoizedState.dehydrated!==null){if(v=Cl(l),w!==null&&w.dehydrated!==null){if(C===null){if(!v)throw Error(i(318));if(v=l.memoizedState,v=v!==null?v.dehydrated:null,!v)throw Error(i(317));v[Me]=l}else Bl(),(l.flags&128)===0&&(l.memoizedState=null),l.flags|=4;Jg(l),v=!1}else v=uS(),C!==null&&C.memoizedState!==null&&(C.memoizedState.hydrationErrors=v),v=!0;if(!v)return l.flags&256?(Ua(l),l):(Ua(l),null)}return Ua(l),(l.flags&128)!==0?(l.lanes=d,l):(d=w!==null,C=C!==null&&C.memoizedState!==null,d&&(w=l.child,v=null,w.alternate!==null&&w.alternate.memoizedState!==null&&w.alternate.memoizedState.cachePool!==null&&(v=w.alternate.memoizedState.cachePool.pool),L=null,w.memoizedState!==null&&w.memoizedState.cachePool!==null&&(L=w.memoizedState.cachePool.pool),L!==v&&(w.flags|=2048)),d!==C&&d&&(l.child.flags|=8192),$Q(l,l.updateQueue),Jg(l),null);case 4:return FA(),C===null&&Fv(l.stateNode.containerInfo),Jg(l),null;case 10:return Cr(l.type),Jg(l),null;case 19:if(X(yI),w=l.memoizedState,w===null)return Jg(l),null;if(v=(l.flags&128)!==0,L=w.rendering,L===null)if(v)sh(w,!1);else{if(Ug!==0||C!==null&&(C.flags&128)!==0)for(C=l.child;C!==null;){if(L=bp(C),L!==null){for(l.flags|=128,sh(w,!1),C=L.updateQueue,l.updateQueue=C,$Q(l,C),l.subtreeFlags=0,C=d,d=l.child;d!==null;)Io(d,C),d=d.sibling;return sA(yI,yI.current&1|2),zi&&GC(l,w.treeForkCount),l.child}C=C.sibling}w.tail!==null&&eA()>Ya&&(l.flags|=128,v=!0,sh(w,!1),l.lanes=4194304)}else{if(!v)if(C=bp(L),C!==null){if(l.flags|=128,v=!0,C=C.updateQueue,l.updateQueue=C,$Q(l,C),sh(w,!0),w.tail===null&&w.tailMode==="hidden"&&!L.alternate&&!zi)return Jg(l),null}else 2*eA()-w.renderingStartTime>Ya&&d!==536870912&&(l.flags|=128,v=!0,sh(w,!1),l.lanes=4194304);w.isBackwards?(L.sibling=l.child,l.child=L):(C=w.last,C!==null?C.sibling=L:l.child=L,w.last=L)}return w.tail!==null?(C=w.tail,w.rendering=C,w.tail=C.sibling,w.renderingStartTime=eA(),C.sibling=null,d=yI.current,sA(yI,v?d&1|2:d&1),zi&&GC(l,w.treeForkCount),C):(Jg(l),null);case 22:case 23:return Ua(l),oo(),w=l.memoizedState!==null,C!==null?C.memoizedState!==null!==w&&(l.flags|=8192):w&&(l.flags|=8192),w?(d&536870912)!==0&&(l.flags&128)===0&&(Jg(l),l.subtreeFlags&6&&(l.flags|=8192)):Jg(l),d=l.updateQueue,d!==null&&$Q(l,d.retryQueue),d=null,C!==null&&C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(d=C.memoizedState.cachePool.pool),w=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(w=l.memoizedState.cachePool.pool),w!==d&&(l.flags|=2048),C!==null&&X(WB),null;case 24:return d=null,C!==null&&(d=C.memoizedState.cache),l.memoizedState.cache!==d&&(l.flags|=2048),Cr(Ht),Jg(l),null;case 25:return null;case 30:return null}throw Error(i(156,l.tag))}function Vp(C,l){switch(jB(l),l.tag){case 1:return C=l.flags,C&65536?(l.flags=C&-65537|128,l):null;case 3:return Cr(Ht),FA(),C=l.flags,(C&65536)!==0&&(C&128)===0?(l.flags=C&-65537|128,l):null;case 26:case 27:case 5:return MA(l),null;case 31:if(l.memoizedState!==null){if(Ua(l),l.alternate===null)throw Error(i(340));Bl()}return C=l.flags,C&65536?(l.flags=C&-65537|128,l):null;case 13:if(Ua(l),C=l.memoizedState,C!==null&&C.dehydrated!==null){if(l.alternate===null)throw Error(i(340));Bl()}return C=l.flags,C&65536?(l.flags=C&-65537|128,l):null;case 19:return X(yI),null;case 4:return FA(),null;case 10:return Cr(l.type),null;case 22:case 23:return Ua(l),oo(),C!==null&&X(WB),C=l.flags,C&65536?(l.flags=C&-65537|128,l):null;case 24:return Cr(Ht),null;case 25:return null;default:return null}}function fl(C,l){switch(jB(l),l.tag){case 3:Cr(Ht),FA();break;case 26:case 27:case 5:MA(l);break;case 4:FA();break;case 31:l.memoizedState!==null&&Ua(l);break;case 13:Ua(l);break;case 19:X(yI);break;case 10:Cr(l.type);break;case 22:case 23:Ua(l),oo(),C!==null&&X(WB);break;case 24:Cr(Ht)}}function bs(C,l){try{var d=l.updateQueue,w=d!==null?d.lastEffect:null;if(w!==null){var v=w.next;d=v;do{if((d.tag&C)===C){w=void 0;var L=d.create,V=d.inst;w=L(),V.destroy=w}d=d.next}while(d!==v)}}catch(BA){Wg(l,l.return,BA)}}function Qr(C,l,d){try{var w=l.updateQueue,v=w!==null?w.lastEffect:null;if(v!==null){var L=v.next;w=L;do{if((w.tag&C)===C){var V=w.inst,BA=V.destroy;if(BA!==void 0){V.destroy=void 0,v=l;var YA=d,De=BA;try{De()}catch(Je){Wg(v,YA,Je)}}}w=w.next}while(w!==L)}}catch(Je){Wg(l,l.return,Je)}}function Ic(C){var l=C.updateQueue;if(l!==null){var d=C.stateNode;try{Jn(l,d)}catch(w){Wg(C,C.return,w)}}}function Iw(C,l,d){d.props=qn(C.type,C.memoizedProps),d.state=C.memoizedState;try{d.componentWillUnmount()}catch(w){Wg(C,l,w)}}function vs(C,l){try{var d=C.ref;if(d!==null){switch(C.tag){case 26:case 27:case 5:var w=C.stateNode;break;case 30:w=C.stateNode;break;default:w=C.stateNode}typeof d=="function"?C.refCleanup=d(w):d.current=w}}catch(v){Wg(C,l,v)}}function La(C,l){var d=C.ref,w=C.refCleanup;if(d!==null)if(typeof w=="function")try{w()}catch(v){Wg(C,l,v)}finally{C.refCleanup=null,C=C.alternate,C!=null&&(C.refCleanup=null)}else if(typeof d=="function")try{d(null)}catch(v){Wg(C,l,v)}else d.current=null}function qa(C){var l=C.type,d=C.memoizedProps,w=C.stateNode;try{A:switch(l){case"button":case"input":case"select":case"textarea":d.autoFocus&&w.focus();break A;case"img":d.src?w.src=d.src:d.srcSet&&(w.srcset=d.srcSet)}}catch(v){Wg(C,C.return,v)}}function Er(C,l,d){try{var w=C.stateNode;CrA(w,C.type,d,l),w[We]=l}catch(v){Wg(C,C.return,v)}}function jI(C){return C.tag===5||C.tag===3||C.tag===26||C.tag===27&&IE(C.type)||C.tag===4}function _s(C){A:for(;;){for(;C.sibling===null;){if(C.return===null||jI(C.return))return null;C=C.return}for(C.sibling.return=C.return,C=C.sibling;C.tag!==5&&C.tag!==6&&C.tag!==18;){if(C.tag===27&&IE(C.type)||C.flags&2||C.child===null||C.tag===4)continue A;C.child.return=C,C=C.child}if(!(C.flags&2))return C.stateNode}}function mi(C,l,d){var w=C.tag;if(w===5||w===6)C=C.stateNode,l?(d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d).insertBefore(C,l):(l=d.nodeType===9?d.body:d.nodeName==="HTML"?d.ownerDocument.body:d,l.appendChild(C),d=d._reactRootContainer,d!=null||l.onclick!==null||(l.onclick=Le));else if(w!==4&&(w===27&&IE(C.type)&&(d=C.stateNode,l=null),C=C.child,C!==null))for(mi(C,l,d),C=C.sibling;C!==null;)mi(C,l,d),C=C.sibling}function yg(C,l,d){var w=C.tag;if(w===5||w===6)C=C.stateNode,l?d.insertBefore(C,l):d.appendChild(C);else if(w!==4&&(w===27&&IE(C.type)&&(d=C.stateNode),C=C.child,C!==null))for(yg(C,l,d),C=C.sibling;C!==null;)yg(C,l,d),C=C.sibling}function vI(C){var l=C.stateNode,d=C.memoizedProps;try{for(var w=C.type,v=l.attributes;v.length;)l.removeAttributeNode(v[0]);Fo(l,w,d),l[Me]=C,l[We]=d}catch(L){Wg(C,C.return,L)}}var ur=!1,aI=!1,xC=!1,Ch=typeof WeakSet=="function"?WeakSet:Set,mI=null;function AE(C,l){if(C=C.containerInfo,_v=nN,C=dp(C),KQ(C)){if("selectionStart"in C)var d={start:C.selectionStart,end:C.selectionEnd};else A:{d=(d=C.ownerDocument)&&d.defaultView||window;var w=d.getSelection&&d.getSelection();if(w&&w.rangeCount!==0){d=w.anchorNode;var v=w.anchorOffset,L=w.focusNode;w=w.focusOffset;try{d.nodeType,L.nodeType}catch{d=null;break A}var V=0,BA=-1,YA=-1,De=0,Je=0,He=C,me=null;e:for(;;){for(var Ue;He!==d||v!==0&&He.nodeType!==3||(BA=V+v),He!==L||w!==0&&He.nodeType!==3||(YA=V+w),He.nodeType===3&&(V+=He.nodeValue.length),(Ue=He.firstChild)!==null;)me=He,He=Ue;for(;;){if(He===C)break e;if(me===d&&++De===v&&(BA=V),me===L&&++Je===w&&(YA=V),(Ue=He.nextSibling)!==null)break;He=me,me=He.parentNode}He=Ue}d=BA===-1||YA===-1?null:{start:BA,end:YA}}else d=null}d=d||{start:0,end:0}}else d=null;for(Jv={focusedElem:C,selectionRange:d},nN=!1,mI=l;mI!==null;)if(l=mI,C=l.child,(l.subtreeFlags&1028)!==0&&C!==null)C.return=l,mI=C;else for(;mI!==null;){switch(l=mI,L=l.alternate,C=l.flags,l.tag){case 0:if((C&4)!==0&&(C=l.updateQueue,C=C!==null?C.events:null,C!==null))for(d=0;d<C.length;d++)v=C[d],v.ref.impl=v.nextImpl;break;case 11:case 15:break;case 1:if((C&1024)!==0&&L!==null){C=void 0,d=l,v=L.memoizedProps,L=L.memoizedState,w=d.stateNode;try{var Ft=qn(d.type,v);C=w.getSnapshotBeforeUpdate(Ft,L),w.__reactInternalSnapshotBeforeUpdate=C}catch(ii){Wg(d,d.return,ii)}}break;case 3:if((C&1024)!==0){if(C=l.stateNode.containerInfo,d=C.nodeType,d===9)xv(C);else if(d===1)switch(C.nodeName){case"HEAD":case"HTML":case"BODY":xv(C);break;default:C.textContent=""}}break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((C&1024)!==0)throw Error(i(163))}if(C=l.sibling,C!==null){C.return=l.return,mI=C;break}mI=l.return}}function PM(C,l,d){var w=d.flags;switch(d.tag){case 0:case 11:case 15:TC(C,d),w&4&&bs(5,d);break;case 1:if(TC(C,d),w&4)if(C=d.stateNode,l===null)try{C.componentDidMount()}catch(V){Wg(d,d.return,V)}else{var v=qn(d.type,l.memoizedProps);l=l.memoizedState;try{C.componentDidUpdate(v,l,C.__reactInternalSnapshotBeforeUpdate)}catch(V){Wg(d,d.return,V)}}w&64&&Ic(d),w&512&&vs(d,d.return);break;case 3:if(TC(C,d),w&64&&(C=d.updateQueue,C!==null)){if(l=null,d.child!==null)switch(d.child.tag){case 27:case 5:l=d.child.stateNode;break;case 1:l=d.child.stateNode}try{Jn(C,l)}catch(V){Wg(d,d.return,V)}}break;case 27:l===null&&w&4&&vI(d);case 26:case 5:TC(C,d),l===null&&w&4&&qa(d),w&512&&vs(d,d.return);break;case 12:TC(C,d);break;case 31:TC(C,d),w&4&&$p(C,d);break;case 13:TC(C,d),w&4&&nw(C,d),w&64&&(C=d.memoizedState,C!==null&&(C=C.dehydrated,C!==null&&(d=$aA.bind(null,d),drA(C,d))));break;case 22:if(w=d.memoizedState!==null||ur,!w){l=l!==null&&l.memoizedState!==null||aI,v=ur;var L=aI;ur=w,(aI=l)&&!L?Gg(C,d,(d.subtreeFlags&8772)!==0):TC(C,d),ur=v,aI=L}break;case 30:break;default:TC(C,d)}}function Xp(C){var l=C.alternate;l!==null&&(C.alternate=null,Xp(l)),C.child=null,C.deletions=null,C.sibling=null,C.tag===5&&(l=C.stateNode,l!==null&&aA(l)),C.stateNode=null,C.return=null,C.dependencies=null,C.memoizedProps=null,C.memoizedState=null,C.pendingProps=null,C.stateNode=null,C.updateQueue=null}var ag=null,ZI=!1;function ro(C,l,d){for(d=d.child;d!==null;)nc(C,l,d),d=d.sibling}function nc(C,l,d){if(_A&&typeof _A.onCommitFiberUnmount=="function")try{_A.onCommitFiberUnmount(WA,d)}catch{}switch(d.tag){case 26:aI||La(d,l),ro(C,l,d),d.memoizedState?d.memoizedState.count--:d.stateNode&&(d=d.stateNode,d.parentNode.removeChild(d));break;case 27:aI||La(d,l);var w=ag,v=ZI;IE(d.type)&&(ag=d.stateNode,ZI=!1),ro(C,l,d),sw(d.stateNode),ag=w,ZI=v;break;case 5:aI||La(d,l);case 6:if(w=ag,v=ZI,ag=null,ro(C,l,d),ag=w,ZI=v,ag!==null)if(ZI)try{(ag.nodeType===9?ag.body:ag.nodeName==="HTML"?ag.ownerDocument.body:ag).removeChild(d.stateNode)}catch(L){Wg(d,l,L)}else try{ag.removeChild(d.stateNode)}catch(L){Wg(d,l,L)}break;case 18:ag!==null&&(ZI?(C=ag,c3(C.nodeType===9?C.body:C.nodeName==="HTML"?C.ownerDocument.body:C,d.stateNode),Cf(C)):c3(ag,d.stateNode));break;case 4:w=ag,v=ZI,ag=d.stateNode.containerInfo,ZI=!0,ro(C,l,d),ag=w,ZI=v;break;case 0:case 11:case 14:case 15:Qr(2,d,l),aI||Qr(4,d,l),ro(C,l,d);break;case 1:aI||(La(d,l),w=d.stateNode,typeof w.componentWillUnmount=="function"&&Iw(d,l,w)),ro(C,l,d);break;case 21:ro(C,l,d);break;case 22:aI=(w=aI)||d.memoizedState!==null,ro(C,l,d),aI=w;break;default:ro(C,l,d)}}function $p(C,l){if(l.memoizedState===null&&(C=l.alternate,C!==null&&(C=C.memoizedState,C!==null))){C=C.dehydrated;try{Cf(C)}catch(d){Wg(l,l.return,d)}}}function nw(C,l){if(l.memoizedState===null&&(C=l.alternate,C!==null&&(C=C.memoizedState,C!==null&&(C=C.dehydrated,C!==null))))try{Cf(C)}catch(d){Wg(l,l.return,d)}}function jM(C){switch(C.tag){case 31:case 13:case 19:var l=C.stateNode;return l===null&&(l=C.stateNode=new Ch),l;case 22:return C=C.stateNode,l=C._retryCache,l===null&&(l=C._retryCache=new Ch),l;default:throw Error(i(435,C.tag))}}function _I(C,l){var d=jM(C);l.forEach(function(w){if(!d.has(w)){d.add(w);var v=ArA.bind(null,C,w);w.then(v,v)}})}function so(C,l){var d=l.deletions;if(d!==null)for(var w=0;w<d.length;w++){var v=d[w],L=C,V=l,BA=V;A:for(;BA!==null;){switch(BA.tag){case 27:if(IE(BA.type)){ag=BA.stateNode,ZI=!1;break A}break;case 5:ag=BA.stateNode,ZI=!1;break A;case 3:case 4:ag=BA.stateNode.containerInfo,ZI=!0;break A}BA=BA.return}if(ag===null)throw Error(i(160));nc(L,V,v),ag=null,ZI=!1,L=v.alternate,L!==null&&(L.return=null),v.return=null}if(l.subtreeFlags&13886)for(l=l.child;l!==null;)oc(l,C),l=l.sibling}var oa=null;function oc(C,l){var d=C.alternate,w=C.flags;switch(C.tag){case 0:case 11:case 14:case 15:so(l,C),kI(C),w&4&&(Qr(3,C,C.return),bs(3,C),Qr(5,C,C.return));break;case 1:so(l,C),kI(C),w&512&&(aI||d===null||La(d,d.return)),w&64&&ur&&(C=C.updateQueue,C!==null&&(w=C.callbacks,w!==null&&(d=C.shared.hiddenCallbacks,C.shared.hiddenCallbacks=d===null?w:d.concat(w))));break;case 26:var v=oa;if(so(l,C),kI(C),w&512&&(aI||d===null||La(d,d.return)),w&4){var L=d!==null?d.memoizedState:null;if(w=C.memoizedState,d===null)if(w===null)if(C.stateNode===null){A:{w=C.type,d=C.memoizedProps,v=v.ownerDocument||v;e:switch(w){case"title":L=v.getElementsByTagName("title")[0],(!L||L[jt]||L[Me]||L.namespaceURI==="http://www.w3.org/2000/svg"||L.hasAttribute("itemprop"))&&(L=v.createElement(w),v.head.insertBefore(L,v.querySelector("head > title"))),Fo(L,w,d),L[Me]=C,oe(L),w=L;break A;case"link":var V=S3("link","href",v).get(w+(d.href||""));if(V){for(var BA=0;BA<V.length;BA++)if(L=V[BA],L.getAttribute("href")===(d.href==null||d.href===""?null:d.href)&&L.getAttribute("rel")===(d.rel==null?null:d.rel)&&L.getAttribute("title")===(d.title==null?null:d.title)&&L.getAttribute("crossorigin")===(d.crossOrigin==null?null:d.crossOrigin)){V.splice(BA,1);break e}}L=v.createElement(w),Fo(L,w,d),v.head.appendChild(L);break;case"meta":if(V=S3("meta","content",v).get(w+(d.content||""))){for(BA=0;BA<V.length;BA++)if(L=V[BA],L.getAttribute("content")===(d.content==null?null:""+d.content)&&L.getAttribute("name")===(d.name==null?null:d.name)&&L.getAttribute("property")===(d.property==null?null:d.property)&&L.getAttribute("http-equiv")===(d.httpEquiv==null?null:d.httpEquiv)&&L.getAttribute("charset")===(d.charSet==null?null:d.charSet)){V.splice(BA,1);break e}}L=v.createElement(w),Fo(L,w,d),v.head.appendChild(L);break;default:throw Error(i(468,w))}L[Me]=C,oe(L),w=L}C.stateNode=w}else w3(v,C.type,C.stateNode);else C.stateNode=y3(v,w,C.memoizedProps);else L!==w?(L===null?d.stateNode!==null&&(d=d.stateNode,d.parentNode.removeChild(d)):L.count--,w===null?w3(v,C.type,C.stateNode):y3(v,w,C.memoizedProps)):w===null&&C.stateNode!==null&&Er(C,C.memoizedProps,d.memoizedProps)}break;case 27:so(l,C),kI(C),w&512&&(aI||d===null||La(d,d.return)),d!==null&&w&4&&Er(C,C.memoizedProps,d.memoizedProps);break;case 5:if(so(l,C),kI(C),w&512&&(aI||d===null||La(d,d.return)),C.flags&32){v=C.stateNode;try{Ao(v,"")}catch(Ft){Wg(C,C.return,Ft)}}w&4&&C.stateNode!=null&&(v=C.memoizedProps,Er(C,v,d!==null?d.memoizedProps:v)),w&1024&&(xC=!0);break;case 6:if(so(l,C),kI(C),w&4){if(C.stateNode===null)throw Error(i(162));w=C.memoizedProps,d=C.stateNode;try{d.nodeValue=w}catch(Ft){Wg(C,C.return,Ft)}}break;case 3:if(tN=null,v=oa,oa=AN(l.containerInfo),so(l,C),oa=v,kI(C),w&4&&d!==null&&d.memoizedState.isDehydrated)try{Cf(l.containerInfo)}catch(Ft){Wg(C,C.return,Ft)}xC&&(xC=!1,ZM(C));break;case 4:w=oa,oa=AN(C.stateNode.containerInfo),so(l,C),kI(C),oa=w;break;case 12:so(l,C),kI(C);break;case 31:so(l,C),kI(C),w&4&&(w=C.updateQueue,w!==null&&(C.updateQueue=null,_I(C,w)));break;case 13:so(l,C),kI(C),C.child.flags&8192&&C.memoizedState!==null!=(d!==null&&d.memoizedState!==null)&&(OC=eA()),w&4&&(w=C.updateQueue,w!==null&&(C.updateQueue=null,_I(C,w)));break;case 22:v=C.memoizedState!==null;var YA=d!==null&&d.memoizedState!==null,De=ur,Je=aI;if(ur=De||v,aI=Je||YA,so(l,C),aI=Je,ur=De,kI(C),w&8192)A:for(l=C.stateNode,l._visibility=v?l._visibility&-2:l._visibility|1,v&&(d===null||YA||ur||aI||Dl(C)),d=null,l=C;;){if(l.tag===5||l.tag===26){if(d===null){YA=d=l;try{if(L=YA.stateNode,v)V=L.style,typeof V.setProperty=="function"?V.setProperty("display","none","important"):V.display="none";else{BA=YA.stateNode;var He=YA.memoizedProps.style,me=He!=null&&He.hasOwnProperty("display")?He.display:null;BA.style.display=me==null||typeof me=="boolean"?"":(""+me).trim()}}catch(Ft){Wg(YA,YA.return,Ft)}}}else if(l.tag===6){if(d===null){YA=l;try{YA.stateNode.nodeValue=v?"":YA.memoizedProps}catch(Ft){Wg(YA,YA.return,Ft)}}}else if(l.tag===18){if(d===null){YA=l;try{var Ue=YA.stateNode;v?l3(Ue,!0):l3(YA.stateNode,!1)}catch(Ft){Wg(YA,YA.return,Ft)}}}else if((l.tag!==22&&l.tag!==23||l.memoizedState===null||l===C)&&l.child!==null){l.child.return=l,l=l.child;continue}if(l===C)break A;for(;l.sibling===null;){if(l.return===null||l.return===C)break A;d===l&&(d=null),l=l.return}d===l&&(d=null),l.sibling.return=l.return,l=l.sibling}w&4&&(w=C.updateQueue,w!==null&&(d=w.retryQueue,d!==null&&(w.retryQueue=null,_I(C,d))));break;case 19:so(l,C),kI(C),w&4&&(w=C.updateQueue,w!==null&&(C.updateQueue=null,_I(C,w)));break;case 30:break;case 21:break;default:so(l,C),kI(C)}}function kI(C){var l=C.flags;if(l&2){try{for(var d,w=C.return;w!==null;){if(jI(w)){d=w;break}w=w.return}if(d==null)throw Error(i(160));switch(d.tag){case 27:var v=d.stateNode,L=_s(C);yg(C,L,v);break;case 5:var V=d.stateNode;d.flags&32&&(Ao(V,""),d.flags&=-33);var BA=_s(C);yg(C,BA,V);break;case 3:case 4:var YA=d.stateNode.containerInfo,De=_s(C);mi(C,De,YA);break;default:throw Error(i(161))}}catch(Je){Wg(C,C.return,Je)}C.flags&=-3}l&4096&&(C.flags&=-4097)}function ZM(C){if(C.subtreeFlags&1024)for(C=C.child;C!==null;){var l=C;ZM(l),l.tag===5&&l.flags&1024&&l.stateNode.reset(),C=C.sibling}}function TC(C,l){if(l.subtreeFlags&8772)for(l=l.child;l!==null;)PM(C,l.alternate,l),l=l.sibling}function Dl(C){for(C=C.child;C!==null;){var l=C;switch(l.tag){case 0:case 11:case 14:case 15:Qr(4,l,l.return),Dl(l);break;case 1:La(l,l.return);var d=l.stateNode;typeof d.componentWillUnmount=="function"&&Iw(l,l.return,d),Dl(l);break;case 27:sw(l.stateNode);case 26:case 5:La(l,l.return),Dl(l);break;case 22:l.memoizedState===null&&Dl(l);break;case 30:Dl(l);break;default:Dl(l)}C=C.sibling}}function Gg(C,l,d){for(d=d&&(l.subtreeFlags&8772)!==0,l=l.child;l!==null;){var w=l.alternate,v=C,L=l,V=L.flags;switch(L.tag){case 0:case 11:case 15:Gg(v,L,d),bs(4,L);break;case 1:if(Gg(v,L,d),w=L,v=w.stateNode,typeof v.componentDidMount=="function")try{v.componentDidMount()}catch(De){Wg(w,w.return,De)}if(w=L,v=w.updateQueue,v!==null){var BA=w.stateNode;try{var YA=v.shared.hiddenCallbacks;if(YA!==null)for(v.shared.hiddenCallbacks=null,v=0;v<YA.length;v++)Rs(YA[v],BA)}catch(De){Wg(w,w.return,De)}}d&&V&64&&Ic(L),vs(L,L.return);break;case 27:vI(L);case 26:case 5:Gg(v,L,d),d&&w===null&&V&4&&qa(L),vs(L,L.return);break;case 12:Gg(v,L,d);break;case 31:Gg(v,L,d),d&&V&4&&$p(v,L);break;case 13:Gg(v,L,d),d&&V&4&&nw(v,L);break;case 22:L.memoizedState===null&&Gg(v,L,d),vs(L,L.return);break;case 30:break;default:Gg(v,L,d)}l=l.sibling}}function Af(C,l){var d=null;C!==null&&C.memoizedState!==null&&C.memoizedState.cachePool!==null&&(d=C.memoizedState.cachePool.pool),C=null,l.memoizedState!==null&&l.memoizedState.cachePool!==null&&(C=l.memoizedState.cachePool.pool),C!==d&&(C!=null&&C.refCount++,d!=null&&_n(d))}function YC(C,l){C=null,l.alternate!==null&&(C=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==C&&(l.refCount++,C!=null&&_n(C))}function In(C,l,d,w){if(l.subtreeFlags&10256)for(l=l.child;l!==null;)uI(C,l,d,w),l=l.sibling}function uI(C,l,d,w){var v=l.flags;switch(l.tag){case 0:case 11:case 15:In(C,l,d,w),v&2048&&bs(9,l);break;case 1:In(C,l,d,w);break;case 3:In(C,l,d,w),v&2048&&(C=null,l.alternate!==null&&(C=l.alternate.memoizedState.cache),l=l.memoizedState.cache,l!==C&&(l.refCount++,C!=null&&_n(C)));break;case 12:if(v&2048){In(C,l,d,w),C=l.stateNode;try{var L=l.memoizedProps,V=L.id,BA=L.onPostCommit;typeof BA=="function"&&BA(V,l.alternate===null?"mount":"update",C.passiveEffectDuration,-0)}catch(YA){Wg(l,l.return,YA)}}else In(C,l,d,w);break;case 31:In(C,l,d,w);break;case 13:In(C,l,d,w);break;case 23:break;case 22:L=l.stateNode,V=l.alternate,l.memoizedState!==null?L._visibility&2?In(C,l,d,w):eE(C,l):L._visibility&2?In(C,l,d,w):(L._visibility|=2,ac(C,l,d,w,(l.subtreeFlags&10256)!==0||!1)),v&2048&&Af(V,l);break;case 24:In(C,l,d,w),v&2048&&YC(l.alternate,l);break;default:In(C,l,d,w)}}function ac(C,l,d,w,v){for(v=v&&((l.subtreeFlags&10256)!==0||!1),l=l.child;l!==null;){var L=C,V=l,BA=d,YA=w,De=V.flags;switch(V.tag){case 0:case 11:case 15:ac(L,V,BA,YA,v),bs(8,V);break;case 23:break;case 22:var Je=V.stateNode;V.memoizedState!==null?Je._visibility&2?ac(L,V,BA,YA,v):eE(L,V):(Je._visibility|=2,ac(L,V,BA,YA,v)),v&&De&2048&&Af(V.alternate,V);break;case 24:ac(L,V,BA,YA,v),v&&De&2048&&YC(V.alternate,V);break;default:ac(L,V,BA,YA,v)}l=l.sibling}}function eE(C,l){if(l.subtreeFlags&10256)for(l=l.child;l!==null;){var d=C,w=l,v=w.flags;switch(w.tag){case 22:eE(d,w),v&2048&&Af(w.alternate,w);break;case 24:eE(d,w),v&2048&&YC(w.alternate,w);break;default:eE(d,w)}l=l.sibling}}var MI=8192;function yl(C,l,d){if(C.subtreeFlags&MI)for(C=C.child;C!==null;)JI(C,l,d),C=C.sibling}function JI(C,l,d){switch(C.tag){case 26:yl(C,l,d),C.flags&MI&&C.memoizedState!==null&&RrA(d,oa,C.memoizedState,C.memoizedProps);break;case 5:yl(C,l,d);break;case 3:case 4:var w=oa;oa=AN(C.stateNode.containerInfo),yl(C,l,d),oa=w;break;case 22:C.memoizedState===null&&(w=C.alternate,w!==null&&w.memoizedState!==null?(w=MI,MI=16777216,yl(C,l,d),MI=w):yl(C,l,d));break;default:yl(C,l,d)}}function aa(C){var l=C.alternate;if(l!==null&&(C=l.child,C!==null)){l.child=null;do l=C.sibling,C.sibling=null,C=l;while(C!==null)}}function Uo(C){var l=C.deletions;if((C.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var w=l[d];mI=w,Bh(w,C)}aa(C)}if(C.subtreeFlags&10256)for(C=C.child;C!==null;)Sl(C),C=C.sibling}function Sl(C){switch(C.tag){case 0:case 11:case 15:Uo(C),C.flags&2048&&Qr(9,C,C.return);break;case 3:Uo(C);break;case 12:Uo(C);break;case 22:var l=C.stateNode;C.memoizedState!==null&&l._visibility&2&&(C.return===null||C.return.tag!==13)?(l._visibility&=-3,ef(C)):Uo(C);break;default:Uo(C)}}function ef(C){var l=C.deletions;if((C.flags&16)!==0){if(l!==null)for(var d=0;d<l.length;d++){var w=l[d];mI=w,Bh(w,C)}aa(C)}for(C=C.child;C!==null;){switch(l=C,l.tag){case 0:case 11:case 15:Qr(8,l,l.return),ef(l);break;case 22:d=l.stateNode,d._visibility&2&&(d._visibility&=-3,ef(l));break;default:ef(l)}C=C.sibling}}function Bh(C,l){for(;mI!==null;){var d=mI;switch(d.tag){case 0:case 11:case 15:Qr(8,d,l);break;case 23:case 22:if(d.memoizedState!==null&&d.memoizedState.cachePool!==null){var w=d.memoizedState.cachePool.pool;w!=null&&w.refCount++}break;case 24:_n(d.memoizedState.cache)}if(w=d.child,w!==null)w.return=d,mI=w;else A:for(d=C;mI!==null;){w=mI;var v=w.sibling,L=w.return;if(Xp(w),w===d){mI=null;break A}if(v!==null){v.return=L,mI=v;break A}mI=L}}}var tf={getCacheForType:function(C){var l=pn(Ht),d=l.data.get(C);return d===void 0&&(d=C(),l.data.set(C,d)),d},cacheSignal:function(){return pn(Ht).controller.signal}},gf=typeof WeakMap=="function"?WeakMap:Map,tg=0,Rg=null,ki=null,Zi=0,Ot=0,xi=null,ui=!1,bi=!1,Tg=!1,LI=0,Ug=0,xa=0,HC=0,$r=0,ig=0,Ta=0,As=null,Co=null,ra=!1,OC=0,tE=0,Ya=1/0,iE=null,Js=null,hI=0,es=null,Ha=null,hr=0,PC=0,wl=null,If=null,ml=0,kl=null;function Ko(){return(tg&2)!==0&&Zi!==0?Zi&-Zi:q.T!==null?Gv():st()}function u(){if(ig===0)if((Zi&536870912)===0||zi){var C=Re;Re<<=1,(Re&3932160)===0&&(Re=262144),ig=C}else ig=536870912;return C=gn.current,C!==null&&(C.flags|=32),ig}function h(C,l,d){(C===Rg&&(Ot===2||Ot===9)||C.cancelPendingCommit!==null)&&(le(C,0),W(C,Zi,ig,!1)),It(C,d),((tg&2)===0||C!==Rg)&&(C===Rg&&((tg&2)===0&&(HC|=d),Ug===4&&W(C,Zi,ig,!1)),rc(C))}function N(C,l,d){if((tg&6)!==0)throw Error(i(327));var w=!d&&(l&127)===0&&(l&C.expiredLanes)===0||xA(C,l),v=w?Ml(C,l):sa(C,l,!0),L=w;do{if(v===0){bi&&!w&&W(C,l,0,!1);break}else{if(d=C.current.alternate,L&&!T(d)){v=sa(C,l,!1),L=!1;continue}if(v===2){if(L=l,C.errorRecoveryDisabledLanes&L)var V=0;else V=C.pendingLanes&-536870913,V=V!==0?V:V&536870912?536870912:0;if(V!==0){l=V;A:{var BA=C;v=As;var YA=BA.current.memoizedState.isDehydrated;if(YA&&(le(BA,V).flags|=256),V=sa(BA,V,!1),V!==2){if(Tg&&!YA){BA.errorRecoveryDisabledLanes|=L,HC|=L,v=4;break A}L=Co,Co=v,L!==null&&(Co===null?Co=L:Co.push.apply(Co,L))}v=V}if(L=!1,v!==2)continue}}if(v===1){le(C,0),W(C,l,0,!0);break}A:{switch(w=C,L=v,L){case 0:case 1:throw Error(i(345));case 4:if((l&4194048)!==l)break;case 6:W(w,l,ig,!ui);break A;case 2:Co=null;break;case 3:case 5:break;default:throw Error(i(329))}if((l&62914560)===l&&(v=OC+300-eA(),10<v)){if(W(w,l,ig,!ui),yA(w,0,!0)!==0)break A;hr=l,w.timeoutHandle=C3(_.bind(null,w,d,Co,iE,ra,l,ig,HC,Ta,ui,L,"Throttled",-0,0),v);break A}_(w,d,Co,iE,ra,l,ig,HC,Ta,ui,L,null,-0,0)}}break}while(!0);rc(C)}function _(C,l,d,w,v,L,V,BA,YA,De,Je,He,me,Ue){if(C.timeoutHandle=-1,He=l.subtreeFlags,He&8192||(He&16785408)===16785408){He={stylesheets:null,count:0,imgCount:0,imgBytes:0,suspenseyImages:[],waitingForImages:!0,waitingForViewTransition:!1,unsuspend:Le},JI(l,L,He);var Ft=(L&62914560)===L?OC-eA():(L&4194048)===L?tE-eA():0;if(Ft=UrA(He,Ft),Ft!==null){hr=L,C.cancelPendingCommit=Ft(ri.bind(null,C,l,L,d,w,v,V,BA,YA,Je,He,null,me,Ue)),W(C,L,V,!De);return}}ri(C,l,L,d,w,v,V,BA,YA)}function T(C){for(var l=C;;){var d=l.tag;if((d===0||d===11||d===15)&&l.flags&16384&&(d=l.updateQueue,d!==null&&(d=d.stores,d!==null)))for(var w=0;w<d.length;w++){var v=d[w],L=v.getSnapshot;v=v.value;try{if(!nI(L(),v))return!1}catch{return!1}}if(d=l.child,l.subtreeFlags&16384&&d!==null)d.return=l,l=d;else{if(l===C)break;for(;l.sibling===null;){if(l.return===null||l.return===C)return!0;l=l.return}l.sibling.return=l.return,l=l.sibling}}return!0}function W(C,l,d,w){l&=~$r,l&=~HC,C.suspendedLanes|=l,C.pingedLanes&=~l,w&&(C.warmLanes|=l),w=C.expirationTimes;for(var v=l;0<v;){var L=31-ge(v),V=1<<L;w[L]=-1,v&=~V}d!==0&&pg(C,d,l)}function lA(){return(tg&6)===0?(ow(0),!1):!0}function TA(){if(ki!==null){if(Ot===0)var C=ki.return;else C=ki,no=UC=null,_S(C),VB=null,XB=0,C=ki;for(;C!==null;)fl(C.alternate,C),C=C.return;ki=null}}function le(C,l){var d=C.timeoutHandle;d!==-1&&(C.timeoutHandle=-1,lrA(d)),d=C.cancelPendingCommit,d!==null&&(C.cancelPendingCommit=null,d()),hr=0,TA(),Rg=C,ki=d=ws(C.current,null),Zi=l,Ot=0,xi=null,ui=!1,bi=xA(C,l),Tg=!1,Ta=ig=$r=HC=xa=Ug=0,Co=As=null,ra=!1,(l&8)!==0&&(l|=l&32);var w=C.entangledLanes;if(w!==0)for(C=C.entanglements,w&=l;0<w;){var v=31-ge(w),L=1<<v;l|=C[v],w&=~L}return LI=l,HB(),d}function qe(C,l){ai=null,q.H=Ah,l===zB||l===Wr?(l=Up(),Ot=3):l===Hu?(l=Up(),Ot=4):Ot=l===Wp?8:l!==null&&typeof l=="object"&&typeof l.then=="function"?6:1,xi=l,ki===null&&(Ug=1,Zp(C,ea(l,C.current)))}function rt(){var C=gn.current;return C===null?!0:(Zi&4194048)===Zi?Br===null:(Zi&62914560)===Zi||(Zi&536870912)!==0?C===Br:!1}function mt(){var C=q.H;return q.H=Ah,C===null?Ah:C}function Gt(){var C=q.A;return q.A=tf,C}function Ei(){Ug=4,ui||(Zi&4194048)!==Zi&&gn.current!==null||(bi=!0),(xa&134217727)===0&&(HC&134217727)===0||Rg===null||W(Rg,Zi,ig,!1)}function sa(C,l,d){var w=tg;tg|=2;var v=mt(),L=Gt();(Rg!==C||Zi!==l)&&(iE=null,le(C,l)),l=!1;var V=Ug;A:do try{if(Ot!==0&&ki!==null){var BA=ki,YA=xi;switch(Ot){case 8:TA(),V=6;break A;case 3:case 2:case 9:case 6:gn.current===null&&(l=!0);var De=Ot;if(Ot=0,xi=null,tt(C,BA,YA,De),d&&bi){V=0;break A}break;default:De=Ot,Ot=0,xi=null,tt(C,BA,YA,De)}}ch(),V=Ug;break}catch(Je){qe(C,Je)}while(!0);return l&&C.shellSuspendCounter++,no=UC=null,tg=w,q.H=v,q.A=L,ki===null&&(Rg=null,Zi=0,HB()),V}function ch(){for(;ki!==null;)re(ki)}function Ml(C,l){var d=tg;tg|=2;var w=mt(),v=Gt();Rg!==C||Zi!==l?(iE=null,Ya=eA()+500,le(C,l)):bi=xA(C,l);A:do try{if(Ot!==0&&ki!==null){l=ki;var L=xi;e:switch(Ot){case 1:Ot=0,xi=null,tt(C,l,L,1);break;case 2:case 9:if(dM(L)){Ot=0,xi=null,Ne(l);break}l=function(){Ot!==2&&Ot!==9||Rg!==C||(Ot=7),rc(C)},L.then(l,l);break A;case 3:Ot=7;break A;case 4:Ot=5;break A;case 7:dM(L)?(Ot=0,xi=null,Ne(l)):(Ot=0,xi=null,tt(C,l,L,7));break;case 5:var V=null;switch(ki.tag){case 26:V=ki.memoizedState;case 5:case 27:var BA=ki;if(V?m3(V):BA.stateNode.complete){Ot=0,xi=null;var YA=BA.sibling;if(YA!==null)ki=YA;else{var De=BA.return;De!==null?(ki=De,Tt(De)):ki=null}break e}}Ot=0,xi=null,tt(C,l,L,5);break;case 6:Ot=0,xi=null,tt(C,l,L,6);break;case 8:TA(),Ug=6;break A;default:throw Error(i(462))}}we();break}catch(Je){qe(C,Je)}while(!0);return no=UC=null,q.H=w,q.A=v,tg=d,ki!==null?0:(Rg=null,Zi=0,HB(),Ug)}function we(){for(;ki!==null&&!Qe();)re(ki)}function re(C){var l=zp(C.alternate,C,LI);C.memoizedProps=C.pendingProps,l===null?Tt(C):ki=l}function Ne(C){var l=C,d=l.alternate;switch(l.tag){case 15:case 0:l=ao(d,l,l.pendingProps,l.type,void 0,Zi);break;case 11:l=ao(d,l,l.pendingProps,l.type.render,l.ref,Zi);break;case 5:_S(l);default:fl(d,l),l=ki=Io(l,LI),l=zp(d,l,LI)}C.memoizedProps=C.pendingProps,l===null?Tt(C):ki=l}function tt(C,l,d,w){no=UC=null,_S(l),VB=null,XB=0;var v=l.return;try{if(Fa(C,v,l,d,Zi)){Ug=1,Zp(C,ea(d,C.current)),ki=null;return}}catch(L){if(v!==null)throw ki=v,L;Ug=1,Zp(C,ea(d,C.current)),ki=null;return}l.flags&32768?(zi||w===1?C=!0:bi||(Zi&536870912)!==0?C=!1:(ui=C=!0,(w===2||w===9||w===3||w===6)&&(w=gn.current,w!==null&&w.tag===13&&(w.flags|=16384))),eI(l,C)):Tt(l)}function Tt(C){var l=C;do{if((l.flags&32768)!==0){eI(l,ui);return}C=l.return;var d=gw(l.alternate,l,LI);if(d!==null){ki=d;return}if(l=l.sibling,l!==null){ki=l;return}ki=l=C}while(l!==null);Ug===0&&(Ug=5)}function eI(C,l){do{var d=Vp(C.alternate,C);if(d!==null){d.flags&=32767,ki=d;return}if(d=C.return,d!==null&&(d.flags|=32768,d.subtreeFlags=0,d.deletions=null),!l&&(C=C.sibling,C!==null)){ki=C;return}ki=C=d}while(C!==null);Ug=6,ki=null}function ri(C,l,d,w,v,L,V,BA,YA){C.cancelPendingCommit=null;do nf();while(hI!==0);if((tg&6)!==0)throw Error(i(327));if(l!==null){if(l===C.current)throw Error(i(177));if(L=l.lanes|l.childLanes,L|=Sp,Ut(C,d,L,V,BA,YA),C===Rg&&(ki=Rg=null,Zi=0),Ha=l,es=C,hr=d,PC=L,wl=v,If=w,(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?(C.callbackNode=null,C.callbackPriority=0,erA(ne,function(){return Z1(),null})):(C.callbackNode=null,C.callbackPriority=0),w=(l.flags&13878)!==0,(l.subtreeFlags&13878)!==0||w){w=q.T,q.T=null,v=Y.p,Y.p=2,V=tg,tg|=4;try{AE(C,l,d)}finally{tg=V,Y.p=v,q.T=w}}hI=1,rg(),nn(),sg()}}function rg(){if(hI===1){hI=0;var C=es,l=Ha,d=(l.flags&13878)!==0;if((l.subtreeFlags&13878)!==0||d){d=q.T,q.T=null;var w=Y.p;Y.p=2;var v=tg;tg|=4;try{oc(l,C);var L=Jv,V=dp(C.containerInfo),BA=L.focusedElem,YA=L.selectionRange;if(V!==BA&&BA&&BA.ownerDocument&&hp(BA.ownerDocument.documentElement,BA)){if(YA!==null&&KQ(BA)){var De=YA.start,Je=YA.end;if(Je===void 0&&(Je=De),"selectionStart"in BA)BA.selectionStart=De,BA.selectionEnd=Math.min(Je,BA.value.length);else{var He=BA.ownerDocument||document,me=He&&He.defaultView||window;if(me.getSelection){var Ue=me.getSelection(),Ft=BA.textContent.length,ii=Math.min(YA.start,Ft),iI=YA.end===void 0?ii:Math.min(YA.end,Ft);!Ue.extend&&ii>iI&&(V=iI,iI=ii,ii=V);var se=BS(BA,ii),$A=BS(BA,iI);if(se&&$A&&(Ue.rangeCount!==1||Ue.anchorNode!==se.node||Ue.anchorOffset!==se.offset||Ue.focusNode!==$A.node||Ue.focusOffset!==$A.offset)){var fe=He.createRange();fe.setStart(se.node,se.offset),Ue.removeAllRanges(),ii>iI?(Ue.addRange(fe),Ue.extend($A.node,$A.offset)):(fe.setEnd($A.node,$A.offset),Ue.addRange(fe))}}}}for(He=[],Ue=BA;Ue=Ue.parentNode;)Ue.nodeType===1&&He.push({element:Ue,left:Ue.scrollLeft,top:Ue.scrollTop});for(typeof BA.focus=="function"&&BA.focus(),BA=0;BA<He.length;BA++){var Te=He[BA];Te.element.scrollLeft=Te.left,Te.element.scrollTop=Te.top}}nN=!!_v,Jv=_v=null}finally{tg=v,Y.p=w,q.T=d}}C.current=l,hI=2}}function nn(){if(hI===2){hI=0;var C=es,l=Ha,d=(l.flags&8772)!==0;if((l.subtreeFlags&8772)!==0||d){d=q.T,q.T=null;var w=Y.p;Y.p=2;var v=tg;tg|=4;try{PM(C,l.alternate,l)}finally{tg=v,Y.p=w,q.T=d}}hI=3}}function sg(){if(hI===4||hI===3){hI=0,nA();var C=es,l=Ha,d=hr,w=If;(l.subtreeFlags&10256)!==0||(l.flags&10256)!==0?hI=5:(hI=0,Ha=es=null,jC(C,C.pendingLanes));var v=C.pendingLanes;if(v===0&&(Js=null),Yt(d),l=l.stateNode,_A&&typeof _A.onCommitFiberRoot=="function")try{_A.onCommitFiberRoot(WA,l,void 0,(l.current.flags&128)===128)}catch{}if(w!==null){l=q.T,v=Y.p,Y.p=2,q.T=null;try{for(var L=C.onRecoverableError,V=0;V<w.length;V++){var BA=w[V];L(BA.value,{componentStack:BA.stack})}}finally{q.T=l,Y.p=v}}(hr&3)!==0&&nf(),rc(C),v=C.pendingLanes,(d&261930)!==0&&(v&42)!==0?C===kl?ml++:(ml=0,kl=C):ml=0,ow(0)}}function jC(C,l){(C.pooledCacheLanes&=l)===0&&(l=C.pooledCache,l!=null&&(C.pooledCache=null,_n(l)))}function nf(){return rg(),nn(),sg(),Z1()}function Z1(){if(hI!==5)return!1;var C=es,l=PC;PC=0;var d=Yt(hr),w=q.T,v=Y.p;try{Y.p=32>d?32:d,q.T=null,d=wl,wl=null;var L=es,V=hr;if(hI=0,Ha=es=null,hr=0,(tg&6)!==0)throw Error(i(331));var BA=tg;if(tg|=4,Sl(L.current),uI(L,L.current,V,d),tg=BA,ow(0,!1),_A&&typeof _A.onPostCommitFiberRoot=="function")try{_A.onPostCommitFiberRoot(WA,L)}catch{}return!0}finally{Y.p=v,q.T=w,jC(C,l)}}function W1(C,l,d){l=ea(d,l),l=iw(C.stateNode,l,2),C=vC(C,l,2),C!==null&&(It(C,2),rc(C))}function Wg(C,l,d){if(C.tag===3)W1(C,C,d);else for(;l!==null;){if(l.tag===3){W1(l,C,d);break}else if(l.tag===1){var w=l.stateNode;if(typeof l.type.getDerivedStateFromError=="function"||typeof w.componentDidCatch=="function"&&(Js===null||!Js.has(w))){C=ea(d,C),d=WQ(2),w=vC(l,d,2),w!==null&&(Ia(d,w,l,C),It(w,2),rc(w));break}}l=l.return}}function kv(C,l,d){var w=C.pingCache;if(w===null){w=C.pingCache=new gf;var v=new Set;w.set(l,v)}else v=w.get(l),v===void 0&&(v=new Set,w.set(l,v));v.has(d)||(Tg=!0,v.add(d),C=XaA.bind(null,C,l,d),l.then(C,C))}function XaA(C,l,d){var w=C.pingCache;w!==null&&w.delete(l),C.pingedLanes|=C.suspendedLanes&d,C.warmLanes&=~d,Rg===C&&(Zi&d)===d&&(Ug===4||Ug===3&&(Zi&62914560)===Zi&&300>eA()-OC?(tg&2)===0&&le(C,0):$r|=d,Ta===Zi&&(Ta=0)),rc(C)}function z1(C,l){l===0&&(l=pe()),C=OB(C,l),C!==null&&(It(C,l),rc(C))}function $aA(C){var l=C.memoizedState,d=0;l!==null&&(d=l.retryLane),z1(C,d)}function ArA(C,l){var d=0;switch(C.tag){case 31:case 13:var w=C.stateNode,v=C.memoizedState;v!==null&&(d=v.retryLane);break;case 19:w=C.stateNode;break;case 22:w=C.stateNode._retryCache;break;default:throw Error(i(314))}w!==null&&w.delete(l),z1(C,d)}function erA(C,l){return NA(C,l)}var WM=null,of=null,Mv=!1,zM=!1,Nv=!1,gE=0;function rc(C){C!==of&&C.next===null&&(of===null?WM=of=C:of=of.next=C),zM=!0,Mv||(Mv=!0,irA())}function ow(C,l){if(!Nv&&zM){Nv=!0;do for(var d=!1,w=WM;w!==null;){if(C!==0){var v=w.pendingLanes;if(v===0)var L=0;else{var V=w.suspendedLanes,BA=w.pingedLanes;L=(1<<31-ge(42|C)+1)-1,L&=v&~(V&~BA),L=L&201326741?L&201326741|1:L?L|2:0}L!==0&&(d=!0,A3(w,L))}else L=Zi,L=yA(w,w===Rg?L:0,w.cancelPendingCommit!==null||w.timeoutHandle!==-1),(L&3)===0||xA(w,L)||(d=!0,A3(w,L));w=w.next}while(d);Nv=!1}}function trA(){V1()}function V1(){zM=Mv=!1;var C=0;gE!==0&&crA()&&(C=gE);for(var l=eA(),d=null,w=WM;w!==null;){var v=w.next,L=X1(w,l);L===0?(w.next=null,d===null?WM=v:d.next=v,v===null&&(of=d)):(d=w,(C!==0||(L&3)!==0)&&(zM=!0)),w=v}hI!==0&&hI!==5||ow(C),gE!==0&&(gE=0)}function X1(C,l){for(var d=C.suspendedLanes,w=C.pingedLanes,v=C.expirationTimes,L=C.pendingLanes&-62914561;0<L;){var V=31-ge(L),BA=1<<V,YA=v[V];YA===-1?((BA&d)===0||(BA&w)!==0)&&(v[V]=XA(BA,l)):YA<=l&&(C.expiredLanes|=BA),L&=~BA}if(l=Rg,d=Zi,d=yA(C,C===l?d:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),w=C.callbackNode,d===0||C===l&&(Ot===2||Ot===9)||C.cancelPendingCommit!==null)return w!==null&&w!==null&&OA(w),C.callbackNode=null,C.callbackPriority=0;if((d&3)===0||xA(C,d)){if(l=d&-d,l===C.callbackPriority)return l;switch(w!==null&&OA(w),Yt(d)){case 2:case 8:d=Se;break;case 32:d=ne;break;case 268435456:d=VA;break;default:d=ne}return w=$1.bind(null,C),d=NA(d,w),C.callbackPriority=l,C.callbackNode=d,l}return w!==null&&w!==null&&OA(w),C.callbackPriority=2,C.callbackNode=null,2}function $1(C,l){if(hI!==0&&hI!==5)return C.callbackNode=null,C.callbackPriority=0,null;var d=C.callbackNode;if(nf()&&C.callbackNode!==d)return null;var w=Zi;return w=yA(C,C===Rg?w:0,C.cancelPendingCommit!==null||C.timeoutHandle!==-1),w===0?null:(N(C,w,l),X1(C,eA()),C.callbackNode!=null&&C.callbackNode===d?$1.bind(null,C):null)}function A3(C,l){if(nf())return null;N(C,l,!0)}function irA(){QrA(function(){(tg&6)!==0?NA(HA,trA):V1()})}function Gv(){if(gE===0){var C=bC;C===0&&(C=pA,pA<<=1,(pA&261888)===0&&(pA=256)),gE=C}return gE}function e3(C){return C==null||typeof C=="symbol"||typeof C=="boolean"?null:typeof C=="function"?C:ZA(""+C)}function t3(C,l){var d=l.ownerDocument.createElement("input");return d.name=l.name,d.value=l.value,C.id&&d.setAttribute("form",C.id),l.parentNode.insertBefore(d,l),C=new FormData(C),d.parentNode.removeChild(d),C}function grA(C,l,d,w,v){if(l==="submit"&&d&&d.stateNode===v){var L=e3((v[We]||null).action),V=w.submitter;V&&(l=(l=V[We]||null)?e3(l.formAction):V.getAttribute("formAction"),l!==null&&(L=l,V=null));var BA=new Vo("action","action",null,w,v);C.push({event:BA,listeners:[{instance:null,listener:function(){if(w.defaultPrevented){if(gE!==0){var YA=V?t3(v,V):new FormData(v);XS(d,{pending:!0,data:YA,method:v.method,action:L},null,YA)}}else typeof L=="function"&&(BA.preventDefault(),YA=V?t3(v,V):new FormData(v),XS(d,{pending:!0,data:YA,method:v.method,action:L},L,YA))},currentTarget:v}]})}}for(var Rv=0;Rv<yp.length;Rv++){var Uv=yp[Rv],IrA=Uv.toLowerCase(),nrA=Uv[0].toUpperCase()+Uv.slice(1);go(IrA,"on"+nrA)}go(Aa,"onAnimationEnd"),go(cS,"onAnimationIteration"),go(Ss,"onAnimationStart"),go("dblclick","onDoubleClick"),go("focusin","onFocus"),go("focusout","onBlur"),go(_Q,"onTransitionRun"),go(TB,"onTransitionStart"),go(lS,"onTransitionCancel"),go(Dp,"onTransitionEnd"),Dt("onMouseEnter",["mouseout","mouseover"]),Dt("onMouseLeave",["mouseout","mouseover"]),Dt("onPointerEnter",["pointerout","pointerover"]),Dt("onPointerLeave",["pointerout","pointerover"]),nt("onChange","change click focusin focusout input keydown keyup selectionchange".split(" ")),nt("onSelect","focusout contextmenu dragend focusin keydown keyup mousedown mouseup selectionchange".split(" ")),nt("onBeforeInput",["compositionend","keypress","textInput","paste"]),nt("onCompositionEnd","compositionend focusout keydown keypress keyup mousedown".split(" ")),nt("onCompositionStart","compositionstart focusout keydown keypress keyup mousedown".split(" ")),nt("onCompositionUpdate","compositionupdate focusout keydown keypress keyup mousedown".split(" "));var aw="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(" "),orA=new Set("beforetoggle cancel close invalid load scroll scrollend toggle".split(" ").concat(aw));function i3(C,l){l=(l&4)!==0;for(var d=0;d<C.length;d++){var w=C[d],v=w.event;w=w.listeners;A:{var L=void 0;if(l)for(var V=w.length-1;0<=V;V--){var BA=w[V],YA=BA.instance,De=BA.currentTarget;if(BA=BA.listener,YA!==L&&v.isPropagationStopped())break A;L=BA,v.currentTarget=De;try{L(v)}catch(Je){YB(Je)}v.currentTarget=null,L=YA}else for(V=0;V<w.length;V++){if(BA=w[V],YA=BA.instance,De=BA.currentTarget,BA=BA.listener,YA!==L&&v.isPropagationStopped())break A;L=BA,v.currentTarget=De;try{L(v)}catch(Je){YB(Je)}v.currentTarget=null,L=YA}}}}function Vi(C,l){var d=l[kA];d===void 0&&(d=l[kA]=new Set);var w=C+"__bubble";d.has(w)||(g3(l,C,2,!1),d.add(w))}function Kv(C,l,d){var w=0;l&&(w|=4),g3(d,C,w,l)}var VM="_reactListening"+Math.random().toString(36).slice(2);function Fv(C){if(!C[VM]){C[VM]=!0,Xe.forEach(function(d){d!=="selectionchange"&&(orA.has(d)||Kv(d,!1,C),Kv(d,!0,C))});var l=C.nodeType===9?C:C.ownerDocument;l===null||l[VM]||(l[VM]=!0,Kv("selectionchange",!1,l))}}function g3(C,l,d,w){switch(K3(l)){case 2:var v=brA;break;case 8:v=vrA;break;default:v=Wv}d=v.bind(null,l,d,C),v=void 0,!FB||l!=="touchstart"&&l!=="touchmove"&&l!=="wheel"||(v=!0),w?v!==void 0?C.addEventListener(l,d,{capture:!0,passive:v}):C.addEventListener(l,d,!0):v!==void 0?C.addEventListener(l,d,{passive:v}):C.addEventListener(l,d,!1)}function bv(C,l,d,w,v){var L=w;if((l&1)===0&&(l&2)===0&&w!==null)A:for(;;){if(w===null)return;var V=w.tag;if(V===3||V===4){var BA=w.stateNode.containerInfo;if(BA===v)break;if(V===4)for(V=w.return;V!==null;){var YA=V.tag;if((YA===3||YA===4)&&V.stateNode.containerInfo===v)return;V=V.return}for(;BA!==null;){if(V=QA(BA),V===null)return;if(YA=V.tag,YA===5||YA===6||YA===26||YA===27){w=L=V;continue A}BA=BA.parentNode}}w=w.return}ma(function(){var De=L,Je=Nt(d),He=[];A:{var me=MC.get(C);if(me!==void 0){var Ue=Vo,Ft=C;switch(C){case"keypress":if(bn(d)===0)break A;case"keydown":case"keyup":Ue=Uu;break;case"focusin":Ft="focus",Ue=SC;break;case"focusout":Ft="blur",Ue=SC;break;case"beforeblur":case"afterblur":Ue=SC;break;case"click":if(d.button===2)break A;case"auxclick":case"dblclick":case"mousedown":case"mousemove":case"mouseup":case"mouseout":case"mouseover":case"contextmenu":Ue=tl;break;case"drag":case"dragend":case"dragenter":case"dragexit":case"dragleave":case"dragover":case"dragstart":case"drop":Ue=GQ;break;case"touchcancel":case"touchend":case"touchmove":case"touchstart":Ue=Hr;break;case Aa:case cS:case Ss:Ue=RQ;break;case Dp:Ue=fA;break;case"scroll":case"scrollend":Ue=Al;break;case"wheel":Ue=Ae;break;case"copy":case"cut":case"paste":Ue=bB;break;case"gotpointercapture":case"lostpointercapture":case"pointercancel":case"pointerdown":case"pointermove":case"pointerout":case"pointerover":case"pointerup":Ue=mC;break;case"toggle":case"beforetoggle":Ue=PA}var ii=(l&4)!==0,iI=!ii&&(C==="scroll"||C==="scrollend"),se=ii?me!==null?me+"Capture":null:me;ii=[];for(var $A=De,fe;$A!==null;){var Te=$A;if(fe=Te.stateNode,Te=Te.tag,Te!==5&&Te!==26&&Te!==27||fe===null||se===null||(Te=zo($A,se),Te!=null&&ii.push(rw($A,Te,fe))),iI)break;$A=$A.return}0<ii.length&&(me=new Ue(me,Ft,null,d,Je),He.push({event:me,listeners:ii}))}}if((l&7)===0){A:{if(me=C==="mouseover"||C==="pointerover",Ue=C==="mouseout"||C==="pointerout",me&&d!==$e&&(Ft=d.relatedTarget||d.fromElement)&&(QA(Ft)||Ft[at]))break A;if((Ue||me)&&(me=Je.window===Je?Je:(me=Je.ownerDocument)?me.defaultView||me.parentWindow:window,Ue?(Ft=d.relatedTarget||d.toElement,Ue=De,Ft=Ft?QA(Ft):null,Ft!==null&&(iI=I(Ft),ii=Ft.tag,Ft!==iI||ii!==5&&ii!==27&&ii!==6)&&(Ft=null)):(Ue=null,Ft=De),Ue!==Ft)){if(ii=tl,Te="onMouseLeave",se="onMouseEnter",$A="mouse",(C==="pointerout"||C==="pointerover")&&(ii=mC,Te="onPointerLeave",se="onPointerEnter",$A="pointer"),iI=Ue==null?me:ee(Ue),fe=Ft==null?me:ee(Ft),me=new ii(Te,$A+"leave",Ue,d,Je),me.target=iI,me.relatedTarget=fe,Te=null,QA(Je)===De&&(ii=new ii(se,$A+"enter",Ft,d,Je),ii.target=fe,ii.relatedTarget=iI,Te=ii),iI=Te,Ue&&Ft)e:{for(ii=arA,se=Ue,$A=Ft,fe=0,Te=se;Te;Te=ii(Te))fe++;Te=0;for(var Wt=$A;Wt;Wt=ii(Wt))Te++;for(;0<fe-Te;)se=ii(se),fe--;for(;0<Te-fe;)$A=ii($A),Te--;for(;fe--;){if(se===$A||$A!==null&&se===$A.alternate){ii=se;break e}se=ii(se),$A=ii($A)}ii=null}else ii=null;Ue!==null&&I3(He,me,Ue,ii,!1),Ft!==null&&iI!==null&&I3(He,iI,Ft,ii,!0)}}A:{if(me=De?ee(De):window,Ue=me.nodeName&&me.nodeName.toLowerCase(),Ue==="select"||Ue==="input"&&me.type==="file")var Kg=rS;else if(vn(me))if(bu)Kg=CM;else{Kg=LB;var Lt=vu}else Ue=me.nodeName,!Ue||Ue.toLowerCase()!=="input"||me.type!=="checkbox"&&me.type!=="radio"?De&&ce(De.elementType)&&(Kg=rS):Kg=sM;if(Kg&&(Kg=Kg(C,De))){Or(He,Kg,d,Je);break A}Lt&&Lt(C,me,De),C==="focusout"&&De&&me.type==="number"&&De.memoizedProps.value!=null&&fg(me,"number",me.value)}switch(Lt=De?ee(De):window,C){case"focusin":(vn(Lt)||Lt.contentEditable==="true")&&(FQ=Lt,pp=De,bQ=null);break;case"focusout":bQ=pp=FQ=null;break;case"mousedown":Na=!0;break;case"contextmenu":case"mouseup":case"dragend":Na=!1,fp(He,d,Je);break;case"selectionchange":if(BM)break;case"keydown":case"keyup":fp(He,d,Je)}var vi;if(xe)A:{switch(C){case"compositionstart":var gg="onCompositionStart";break A;case"compositionend":gg="onCompositionEnd";break A;case"compositionupdate":gg="onCompositionUpdate";break A}gg=void 0}else $o?Xo(C,d)&&(gg="onCompositionEnd"):C==="keydown"&&d.keyCode===229&&(gg="onCompositionStart");gg&&(di&&d.locale!=="ko"&&($o||gg!=="onCompositionStart"?gg==="onCompositionEnd"&&$o&&(vi=wo()):(ka=Je,Ng="value"in ka?ka.value:ka.textContent,$o=!0)),Lt=XM(De,gg),0<Lt.length&&(gg=new vB(gg,C,null,d,Je),He.push({event:gg,listeners:Lt}),vi?gg.data=vi:(vi=Ma(d),vi!==null&&(gg.data=vi)))),(vi=hi?mo(C,d):Il(C,d))&&(gg=XM(De,"onBeforeInput"),0<gg.length&&(Lt=new vB("onBeforeInput","beforeinput",null,d,Je),He.push({event:Lt,listeners:gg}),Lt.data=vi)),grA(He,C,De,d,Je)}i3(He,l)})}function rw(C,l,d){return{instance:C,listener:l,currentTarget:d}}function XM(C,l){for(var d=l+"Capture",w=[];C!==null;){var v=C,L=v.stateNode;if(v=v.tag,v!==5&&v!==26&&v!==27||L===null||(v=zo(C,d),v!=null&&w.unshift(rw(C,v,L)),v=zo(C,l),v!=null&&w.push(rw(C,v,L))),C.tag===3)return w;C=C.return}return[]}function arA(C){if(C===null)return null;do C=C.return;while(C&&C.tag!==5&&C.tag!==27);return C||null}function I3(C,l,d,w,v){for(var L=l._reactName,V=[];d!==null&&d!==w;){var BA=d,YA=BA.alternate,De=BA.stateNode;if(BA=BA.tag,YA!==null&&YA===w)break;BA!==5&&BA!==26&&BA!==27||De===null||(YA=De,v?(De=zo(d,L),De!=null&&V.unshift(rw(d,De,YA))):v||(De=zo(d,L),De!=null&&V.push(rw(d,De,YA)))),d=d.return}V.length!==0&&C.push({event:l,listeners:V})}var rrA=/\r\n?/g,srA=/\u0000|\uFFFD/g;function n3(C){return(typeof C=="string"?C:""+C).replace(rrA,`
`).replace(srA,"")}function o3(C,l){return l=n3(l),n3(C)===l}function tI(C,l,d,w,v,L){switch(d){case"children":typeof w=="string"?l==="body"||l==="textarea"&&w===""||Ao(C,w):(typeof w=="number"||typeof w=="bigint")&&l!=="body"&&Ao(C,""+w);break;case"className":qi(C,"class",w);break;case"tabIndex":qi(C,"tabindex",w);break;case"dir":case"role":case"viewBox":case"width":case"height":qi(C,d,w);break;case"style":Ds(C,w,L);break;case"data":if(l!=="object"){qi(C,"data",w);break}case"src":case"href":if(w===""&&(l!=="a"||d!=="href")){C.removeAttribute(d);break}if(w==null||typeof w=="function"||typeof w=="symbol"||typeof w=="boolean"){C.removeAttribute(d);break}w=ZA(""+w),C.setAttribute(d,w);break;case"action":case"formAction":if(typeof w=="function"){C.setAttribute(d,"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 L=="function"&&(d==="formAction"?(l!=="input"&&tI(C,l,"name",v.name,v,null),tI(C,l,"formEncType",v.formEncType,v,null),tI(C,l,"formMethod",v.formMethod,v,null),tI(C,l,"formTarget",v.formTarget,v,null)):(tI(C,l,"encType",v.encType,v,null),tI(C,l,"method",v.method,v,null),tI(C,l,"target",v.target,v,null)));if(w==null||typeof w=="symbol"||typeof w=="boolean"){C.removeAttribute(d);break}w=ZA(""+w),C.setAttribute(d,w);break;case"onClick":w!=null&&(C.onclick=Le);break;case"onScroll":w!=null&&Vi("scroll",C);break;case"onScrollEnd":w!=null&&Vi("scrollend",C);break;case"dangerouslySetInnerHTML":if(w!=null){if(typeof w!="object"||!("__html"in w))throw Error(i(61));if(d=w.__html,d!=null){if(v.children!=null)throw Error(i(60));C.innerHTML=d}}break;case"multiple":C.multiple=w&&typeof w!="function"&&typeof w!="symbol";break;case"muted":C.muted=w&&typeof w!="function"&&typeof w!="symbol";break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"defaultValue":case"defaultChecked":case"innerHTML":case"ref":break;case"autoFocus":break;case"xlinkHref":if(w==null||typeof w=="function"||typeof w=="boolean"||typeof w=="symbol"){C.removeAttribute("xlink:href");break}d=ZA(""+w),C.setAttributeNS("http://www.w3.org/1999/xlink","xlink:href",d);break;case"contentEditable":case"spellCheck":case"draggable":case"value":case"autoReverse":case"externalResourcesRequired":case"focusable":case"preserveAlpha":w!=null&&typeof w!="function"&&typeof w!="symbol"?C.setAttribute(d,""+w):C.removeAttribute(d);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":w&&typeof w!="function"&&typeof w!="symbol"?C.setAttribute(d,""):C.removeAttribute(d);break;case"capture":case"download":w===!0?C.setAttribute(d,""):w!==!1&&w!=null&&typeof w!="function"&&typeof w!="symbol"?C.setAttribute(d,w):C.removeAttribute(d);break;case"cols":case"rows":case"size":case"span":w!=null&&typeof w!="function"&&typeof w!="symbol"&&!isNaN(w)&&1<=w?C.setAttribute(d,w):C.removeAttribute(d);break;case"rowSpan":case"start":w==null||typeof w=="function"||typeof w=="symbol"||isNaN(w)?C.removeAttribute(d):C.setAttribute(d,w);break;case"popover":Vi("beforetoggle",C),Vi("toggle",C),Ui(C,"popover",w);break;case"xlinkActuate":ei(C,"http://www.w3.org/1999/xlink","xlink:actuate",w);break;case"xlinkArcrole":ei(C,"http://www.w3.org/1999/xlink","xlink:arcrole",w);break;case"xlinkRole":ei(C,"http://www.w3.org/1999/xlink","xlink:role",w);break;case"xlinkShow":ei(C,"http://www.w3.org/1999/xlink","xlink:show",w);break;case"xlinkTitle":ei(C,"http://www.w3.org/1999/xlink","xlink:title",w);break;case"xlinkType":ei(C,"http://www.w3.org/1999/xlink","xlink:type",w);break;case"xmlBase":ei(C,"http://www.w3.org/XML/1998/namespace","xml:base",w);break;case"xmlLang":ei(C,"http://www.w3.org/XML/1998/namespace","xml:lang",w);break;case"xmlSpace":ei(C,"http://www.w3.org/XML/1998/namespace","xml:space",w);break;case"is":Ui(C,"is",w);break;case"innerText":case"textContent":break;default:(!(2<d.length)||d[0]!=="o"&&d[0]!=="O"||d[1]!=="n"&&d[1]!=="N")&&(d=ze.get(d)||d,Ui(C,d,w))}}function vv(C,l,d,w,v,L){switch(d){case"style":Ds(C,w,L);break;case"dangerouslySetInnerHTML":if(w!=null){if(typeof w!="object"||!("__html"in w))throw Error(i(61));if(d=w.__html,d!=null){if(v.children!=null)throw Error(i(60));C.innerHTML=d}}break;case"children":typeof w=="string"?Ao(C,w):(typeof w=="number"||typeof w=="bigint")&&Ao(C,""+w);break;case"onScroll":w!=null&&Vi("scroll",C);break;case"onScrollEnd":w!=null&&Vi("scrollend",C);break;case"onClick":w!=null&&(C.onclick=Le);break;case"suppressContentEditableWarning":case"suppressHydrationWarning":case"innerHTML":case"ref":break;case"innerText":case"textContent":break;default:if(!Qt.hasOwnProperty(d))A:{if(d[0]==="o"&&d[1]==="n"&&(v=d.endsWith("Capture"),l=d.slice(2,v?d.length-7:void 0),L=C[We]||null,L=L!=null?L[d]:null,typeof L=="function"&&C.removeEventListener(l,L,v),typeof w=="function")){typeof L!="function"&&L!==null&&(d in C?C[d]=null:C.hasAttribute(d)&&C.removeAttribute(d)),C.addEventListener(l,w,v);break A}d in C?C[d]=w:w===!0?C.setAttribute(d,""):Ui(C,d,w)}}}function Fo(C,l,d){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"img":Vi("error",C),Vi("load",C);var w=!1,v=!1,L;for(L in d)if(d.hasOwnProperty(L)){var V=d[L];if(V!=null)switch(L){case"src":w=!0;break;case"srcSet":v=!0;break;case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:tI(C,l,L,V,d,null)}}v&&tI(C,l,"srcSet",d.srcSet,d,null),w&&tI(C,l,"src",d.src,d,null);return;case"input":Vi("invalid",C);var BA=L=V=v=null,YA=null,De=null;for(w in d)if(d.hasOwnProperty(w)){var Je=d[w];if(Je!=null)switch(w){case"name":v=Je;break;case"type":V=Je;break;case"checked":YA=Je;break;case"defaultChecked":De=Je;break;case"value":L=Je;break;case"defaultValue":BA=Je;break;case"children":case"dangerouslySetInnerHTML":if(Je!=null)throw Error(i(137,l));break;default:tI(C,l,w,Je,d,null)}}Zg(C,L,BA,YA,De,V,v,!1);return;case"select":Vi("invalid",C),w=V=L=null;for(v in d)if(d.hasOwnProperty(v)&&(BA=d[v],BA!=null))switch(v){case"value":L=BA;break;case"defaultValue":V=BA;break;case"multiple":w=BA;default:tI(C,l,v,BA,d,null)}l=L,d=V,C.multiple=!!w,l!=null?kg(C,!!w,l,!1):d!=null&&kg(C,!!w,d,!0);return;case"textarea":Vi("invalid",C),L=v=w=null;for(V in d)if(d.hasOwnProperty(V)&&(BA=d[V],BA!=null))switch(V){case"value":w=BA;break;case"defaultValue":v=BA;break;case"children":L=BA;break;case"dangerouslySetInnerHTML":if(BA!=null)throw Error(i(91));break;default:tI(C,l,V,BA,d,null)}fI(C,w,v,L);return;case"option":for(YA in d)if(d.hasOwnProperty(YA)&&(w=d[YA],w!=null))switch(YA){case"selected":C.selected=w&&typeof w!="function"&&typeof w!="symbol";break;default:tI(C,l,YA,w,d,null)}return;case"dialog":Vi("beforetoggle",C),Vi("toggle",C),Vi("cancel",C),Vi("close",C);break;case"iframe":case"object":Vi("load",C);break;case"video":case"audio":for(w=0;w<aw.length;w++)Vi(aw[w],C);break;case"image":Vi("error",C),Vi("load",C);break;case"details":Vi("toggle",C);break;case"embed":case"source":case"link":Vi("error",C),Vi("load",C);case"area":case"base":case"br":case"col":case"hr":case"keygen":case"meta":case"param":case"track":case"wbr":case"menuitem":for(De in d)if(d.hasOwnProperty(De)&&(w=d[De],w!=null))switch(De){case"children":case"dangerouslySetInnerHTML":throw Error(i(137,l));default:tI(C,l,De,w,d,null)}return;default:if(ce(l)){for(Je in d)d.hasOwnProperty(Je)&&(w=d[Je],w!==void 0&&vv(C,l,Je,w,d,void 0));return}}for(BA in d)d.hasOwnProperty(BA)&&(w=d[BA],w!=null&&tI(C,l,BA,w,d,null))}function CrA(C,l,d,w){switch(l){case"div":case"span":case"svg":case"path":case"a":case"g":case"p":case"li":break;case"input":var v=null,L=null,V=null,BA=null,YA=null,De=null,Je=null;for(Ue in d){var He=d[Ue];if(d.hasOwnProperty(Ue)&&He!=null)switch(Ue){case"checked":break;case"value":break;case"defaultValue":YA=He;default:w.hasOwnProperty(Ue)||tI(C,l,Ue,null,w,He)}}for(var me in w){var Ue=w[me];if(He=d[me],w.hasOwnProperty(me)&&(Ue!=null||He!=null))switch(me){case"type":L=Ue;break;case"name":v=Ue;break;case"checked":De=Ue;break;case"defaultChecked":Je=Ue;break;case"value":V=Ue;break;case"defaultValue":BA=Ue;break;case"children":case"dangerouslySetInnerHTML":if(Ue!=null)throw Error(i(137,l));break;default:Ue!==He&&tI(C,l,me,Ue,w,He)}}vg(C,V,BA,YA,De,Je,L,v);return;case"select":Ue=V=BA=me=null;for(L in d)if(YA=d[L],d.hasOwnProperty(L)&&YA!=null)switch(L){case"value":break;case"multiple":Ue=YA;default:w.hasOwnProperty(L)||tI(C,l,L,null,w,YA)}for(v in w)if(L=w[v],YA=d[v],w.hasOwnProperty(v)&&(L!=null||YA!=null))switch(v){case"value":me=L;break;case"defaultValue":BA=L;break;case"multiple":V=L;default:L!==YA&&tI(C,l,v,L,w,YA)}l=BA,d=V,w=Ue,me!=null?kg(C,!!d,me,!1):!!w!=!!d&&(l!=null?kg(C,!!d,l,!0):kg(C,!!d,d?[]:"",!1));return;case"textarea":Ue=me=null;for(BA in d)if(v=d[BA],d.hasOwnProperty(BA)&&v!=null&&!w.hasOwnProperty(BA))switch(BA){case"value":break;case"children":break;default:tI(C,l,BA,null,w,v)}for(V in w)if(v=w[V],L=d[V],w.hasOwnProperty(V)&&(v!=null||L!=null))switch(V){case"value":me=v;break;case"defaultValue":Ue=v;break;case"children":break;case"dangerouslySetInnerHTML":if(v!=null)throw Error(i(91));break;default:v!==L&&tI(C,l,V,v,w,L)}Qn(C,me,Ue);return;case"option":for(var Ft in d)if(me=d[Ft],d.hasOwnProperty(Ft)&&me!=null&&!w.hasOwnProperty(Ft))switch(Ft){case"selected":C.selected=!1;break;default:tI(C,l,Ft,null,w,me)}for(YA in w)if(me=w[YA],Ue=d[YA],w.hasOwnProperty(YA)&&me!==Ue&&(me!=null||Ue!=null))switch(YA){case"selected":C.selected=me&&typeof me!="function"&&typeof me!="symbol";break;default:tI(C,l,YA,me,w,Ue)}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 ii in d)me=d[ii],d.hasOwnProperty(ii)&&me!=null&&!w.hasOwnProperty(ii)&&tI(C,l,ii,null,w,me);for(De in w)if(me=w[De],Ue=d[De],w.hasOwnProperty(De)&&me!==Ue&&(me!=null||Ue!=null))switch(De){case"children":case"dangerouslySetInnerHTML":if(me!=null)throw Error(i(137,l));break;default:tI(C,l,De,me,w,Ue)}return;default:if(ce(l)){for(var iI in d)me=d[iI],d.hasOwnProperty(iI)&&me!==void 0&&!w.hasOwnProperty(iI)&&vv(C,l,iI,void 0,w,me);for(Je in w)me=w[Je],Ue=d[Je],!w.hasOwnProperty(Je)||me===Ue||me===void 0&&Ue===void 0||vv(C,l,Je,me,w,Ue);return}}for(var se in d)me=d[se],d.hasOwnProperty(se)&&me!=null&&!w.hasOwnProperty(se)&&tI(C,l,se,null,w,me);for(He in w)me=w[He],Ue=d[He],!w.hasOwnProperty(He)||me===Ue||me==null&&Ue==null||tI(C,l,He,me,w,Ue)}function a3(C){switch(C){case"css":case"script":case"font":case"img":case"image":case"input":case"link":return!0;default:return!1}}function BrA(){if(typeof performance.getEntriesByType=="function"){for(var C=0,l=0,d=performance.getEntriesByType("resource"),w=0;w<d.length;w++){var v=d[w],L=v.transferSize,V=v.initiatorType,BA=v.duration;if(L&&BA&&a3(V)){for(V=0,BA=v.responseEnd,w+=1;w<d.length;w++){var YA=d[w],De=YA.startTime;if(De>BA)break;var Je=YA.transferSize,He=YA.initiatorType;Je&&a3(He)&&(YA=YA.responseEnd,V+=Je*(YA<BA?1:(BA-De)/(YA-De)))}if(--w,l+=8*(L+V)/(v.duration/1e3),C++,10<C)break}}if(0<C)return l/C/1e6}return navigator.connection&&(C=navigator.connection.downlink,typeof C=="number")?C:5}var _v=null,Jv=null;function $M(C){return C.nodeType===9?C:C.ownerDocument}function r3(C){switch(C){case"http://www.w3.org/2000/svg":return 1;case"http://www.w3.org/1998/Math/MathML":return 2;default:return 0}}function s3(C,l){if(C===0)switch(l){case"svg":return 1;case"math":return 2;default:return 0}return C===1&&l==="foreignObject"?0:C}function Lv(C,l){return C==="textarea"||C==="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 qv=null;function crA(){var C=window.event;return C&&C.type==="popstate"?C===qv?!1:(qv=C,!0):(qv=null,!1)}var C3=typeof setTimeout=="function"?setTimeout:void 0,lrA=typeof clearTimeout=="function"?clearTimeout:void 0,B3=typeof Promise=="function"?Promise:void 0,QrA=typeof queueMicrotask=="function"?queueMicrotask:typeof B3<"u"?function(C){return B3.resolve(null).then(C).catch(ErA)}:C3;function ErA(C){setTimeout(function(){throw C})}function IE(C){return C==="head"}function c3(C,l){var d=l,w=0;do{var v=d.nextSibling;if(C.removeChild(d),v&&v.nodeType===8)if(d=v.data,d==="/$"||d==="/&"){if(w===0){C.removeChild(v),Cf(l);return}w--}else if(d==="$"||d==="$?"||d==="$~"||d==="$!"||d==="&")w++;else if(d==="html")sw(C.ownerDocument.documentElement);else if(d==="head"){d=C.ownerDocument.head,sw(d);for(var L=d.firstChild;L;){var V=L.nextSibling,BA=L.nodeName;L[jt]||BA==="SCRIPT"||BA==="STYLE"||BA==="LINK"&&L.rel.toLowerCase()==="stylesheet"||d.removeChild(L),L=V}}else d==="body"&&sw(C.ownerDocument.body);d=v}while(d);Cf(l)}function l3(C,l){var d=C;C=0;do{var w=d.nextSibling;if(d.nodeType===1?l?(d._stashedDisplay=d.style.display,d.style.display="none"):(d.style.display=d._stashedDisplay||"",d.getAttribute("style")===""&&d.removeAttribute("style")):d.nodeType===3&&(l?(d._stashedText=d.nodeValue,d.nodeValue=""):d.nodeValue=d._stashedText||""),w&&w.nodeType===8)if(d=w.data,d==="/$"){if(C===0)break;C--}else d!=="$"&&d!=="$?"&&d!=="$~"&&d!=="$!"||C++;d=w}while(d)}function xv(C){var l=C.firstChild;for(l&&l.nodeType===10&&(l=l.nextSibling);l;){var d=l;switch(l=l.nextSibling,d.nodeName){case"HTML":case"HEAD":case"BODY":xv(d),aA(d);continue;case"SCRIPT":case"STYLE":continue;case"LINK":if(d.rel.toLowerCase()==="stylesheet")continue}C.removeChild(d)}}function urA(C,l,d,w){for(;C.nodeType===1;){var v=d;if(C.nodeName.toLowerCase()!==l.toLowerCase()){if(!w&&(C.nodeName!=="INPUT"||C.type!=="hidden"))break}else if(w){if(!C[jt])switch(l){case"meta":if(!C.hasAttribute("itemprop"))break;return C;case"link":if(L=C.getAttribute("rel"),L==="stylesheet"&&C.hasAttribute("data-precedence"))break;if(L!==v.rel||C.getAttribute("href")!==(v.href==null||v.href===""?null:v.href)||C.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin)||C.getAttribute("title")!==(v.title==null?null:v.title))break;return C;case"style":if(C.hasAttribute("data-precedence"))break;return C;case"script":if(L=C.getAttribute("src"),(L!==(v.src==null?null:v.src)||C.getAttribute("type")!==(v.type==null?null:v.type)||C.getAttribute("crossorigin")!==(v.crossOrigin==null?null:v.crossOrigin))&&L&&C.hasAttribute("async")&&!C.hasAttribute("itemprop"))break;return C;default:return C}}else if(l==="input"&&C.type==="hidden"){var L=v.name==null?null:""+v.name;if(v.type==="hidden"&&C.getAttribute("name")===L)return C}else return C;if(C=Ls(C.nextSibling),C===null)break}return null}function hrA(C,l,d){if(l==="")return null;for(;C.nodeType!==3;)if((C.nodeType!==1||C.nodeName!=="INPUT"||C.type!=="hidden")&&!d||(C=Ls(C.nextSibling),C===null))return null;return C}function Q3(C,l){for(;C.nodeType!==8;)if((C.nodeType!==1||C.nodeName!=="INPUT"||C.type!=="hidden")&&!l||(C=Ls(C.nextSibling),C===null))return null;return C}function Tv(C){return C.data==="$?"||C.data==="$~"}function Yv(C){return C.data==="$!"||C.data==="$?"&&C.ownerDocument.readyState!=="loading"}function drA(C,l){var d=C.ownerDocument;if(C.data==="$~")C._reactRetry=l;else if(C.data!=="$?"||d.readyState!=="loading")l();else{var w=function(){l(),d.removeEventListener("DOMContentLoaded",w)};d.addEventListener("DOMContentLoaded",w),C._reactRetry=w}}function Ls(C){for(;C!=null;C=C.nextSibling){var l=C.nodeType;if(l===1||l===3)break;if(l===8){if(l=C.data,l==="$"||l==="$!"||l==="$?"||l==="$~"||l==="&"||l==="F!"||l==="F")break;if(l==="/$"||l==="/&")return null}}return C}var Hv=null;function E3(C){C=C.nextSibling;for(var l=0;C;){if(C.nodeType===8){var d=C.data;if(d==="/$"||d==="/&"){if(l===0)return Ls(C.nextSibling);l--}else d!=="$"&&d!=="$!"&&d!=="$?"&&d!=="$~"&&d!=="&"||l++}C=C.nextSibling}return null}function u3(C){C=C.previousSibling;for(var l=0;C;){if(C.nodeType===8){var d=C.data;if(d==="$"||d==="$!"||d==="$?"||d==="$~"||d==="&"){if(l===0)return C;l--}else d!=="/$"&&d!=="/&"||l++}C=C.previousSibling}return null}function h3(C,l,d){switch(l=$M(d),C){case"html":if(C=l.documentElement,!C)throw Error(i(452));return C;case"head":if(C=l.head,!C)throw Error(i(453));return C;case"body":if(C=l.body,!C)throw Error(i(454));return C;default:throw Error(i(451))}}function sw(C){for(var l=C.attributes;l.length;)C.removeAttributeNode(l[0]);aA(C)}var qs=new Map,d3=new Set;function AN(C){return typeof C.getRootNode=="function"?C.getRootNode():C.nodeType===9?C:C.ownerDocument}var Nl=Y.d;Y.d={f:prA,r:frA,D:DrA,C:yrA,L:SrA,m:wrA,X:krA,S:mrA,M:MrA};function prA(){var C=Nl.f(),l=lA();return C||l}function frA(C){var l=JA(C);l!==null&&l.tag===5&&l.type==="form"?$S(l):Nl.r(C)}var af=typeof document>"u"?null:document;function p3(C,l,d){var w=af;if(w&&typeof l=="string"&&l){var v=ci(l);v='link[rel="'+C+'"][href="'+v+'"]',typeof d=="string"&&(v+='[crossorigin="'+d+'"]'),d3.has(v)||(d3.add(v),C={rel:C,crossOrigin:d,href:l},w.querySelector(v)===null&&(l=w.createElement("link"),Fo(l,"link",C),oe(l),w.head.appendChild(l)))}}function DrA(C){Nl.D(C),p3("dns-prefetch",C,null)}function yrA(C,l){Nl.C(C,l),p3("preconnect",C,l)}function SrA(C,l,d){Nl.L(C,l,d);var w=af;if(w&&C&&l){var v='link[rel="preload"][as="'+ci(l)+'"]';l==="image"&&d&&d.imageSrcSet?(v+='[imagesrcset="'+ci(d.imageSrcSet)+'"]',typeof d.imageSizes=="string"&&(v+='[imagesizes="'+ci(d.imageSizes)+'"]')):v+='[href="'+ci(C)+'"]';var L=v;switch(l){case"style":L=rf(C);break;case"script":L=sf(C)}qs.has(L)||(C=B({rel:"preload",href:l==="image"&&d&&d.imageSrcSet?void 0:C,as:l},d),qs.set(L,C),w.querySelector(v)!==null||l==="style"&&w.querySelector(Cw(L))||l==="script"&&w.querySelector(Bw(L))||(l=w.createElement("link"),Fo(l,"link",C),oe(l),w.head.appendChild(l)))}}function wrA(C,l){Nl.m(C,l);var d=af;if(d&&C){var w=l&&typeof l.as=="string"?l.as:"script",v='link[rel="modulepreload"][as="'+ci(w)+'"][href="'+ci(C)+'"]',L=v;switch(w){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":L=sf(C)}if(!qs.has(L)&&(C=B({rel:"modulepreload",href:C},l),qs.set(L,C),d.querySelector(v)===null)){switch(w){case"audioworklet":case"paintworklet":case"serviceworker":case"sharedworker":case"worker":case"script":if(d.querySelector(Bw(L)))return}w=d.createElement("link"),Fo(w,"link",C),oe(w),d.head.appendChild(w)}}}function mrA(C,l,d){Nl.S(C,l,d);var w=af;if(w&&C){var v=GA(w).hoistableStyles,L=rf(C);l=l||"default";var V=v.get(L);if(!V){var BA={loading:0,preload:null};if(V=w.querySelector(Cw(L)))BA.loading=5;else{C=B({rel:"stylesheet",href:C,"data-precedence":l},d),(d=qs.get(L))&&Ov(C,d);var YA=V=w.createElement("link");oe(YA),Fo(YA,"link",C),YA._p=new Promise(function(De,Je){YA.onload=De,YA.onerror=Je}),YA.addEventListener("load",function(){BA.loading|=1}),YA.addEventListener("error",function(){BA.loading|=2}),BA.loading|=4,eN(V,l,w)}V={type:"stylesheet",instance:V,count:1,state:BA},v.set(L,V)}}}function krA(C,l){Nl.X(C,l);var d=af;if(d&&C){var w=GA(d).hoistableScripts,v=sf(C),L=w.get(v);L||(L=d.querySelector(Bw(v)),L||(C=B({src:C,async:!0},l),(l=qs.get(v))&&Pv(C,l),L=d.createElement("script"),oe(L),Fo(L,"link",C),d.head.appendChild(L)),L={type:"script",instance:L,count:1,state:null},w.set(v,L))}}function MrA(C,l){Nl.M(C,l);var d=af;if(d&&C){var w=GA(d).hoistableScripts,v=sf(C),L=w.get(v);L||(L=d.querySelector(Bw(v)),L||(C=B({src:C,async:!0,type:"module"},l),(l=qs.get(v))&&Pv(C,l),L=d.createElement("script"),oe(L),Fo(L,"link",C),d.head.appendChild(L)),L={type:"script",instance:L,count:1,state:null},w.set(v,L))}}function f3(C,l,d,w){var v=(v=IA.current)?AN(v):null;if(!v)throw Error(i(446));switch(C){case"meta":case"title":return null;case"style":return typeof d.precedence=="string"&&typeof d.href=="string"?(l=rf(d.href),d=GA(v).hoistableStyles,w=d.get(l),w||(w={type:"style",instance:null,count:0,state:null},d.set(l,w)),w):{type:"void",instance:null,count:0,state:null};case"link":if(d.rel==="stylesheet"&&typeof d.href=="string"&&typeof d.precedence=="string"){C=rf(d.href);var L=GA(v).hoistableStyles,V=L.get(C);if(V||(v=v.ownerDocument||v,V={type:"stylesheet",instance:null,count:0,state:{loading:0,preload:null}},L.set(C,V),(L=v.querySelector(Cw(C)))&&!L._p&&(V.instance=L,V.state.loading=5),qs.has(C)||(d={rel:"preload",as:"style",href:d.href,crossOrigin:d.crossOrigin,integrity:d.integrity,media:d.media,hrefLang:d.hrefLang,referrerPolicy:d.referrerPolicy},qs.set(C,d),L||NrA(v,C,d,V.state))),l&&w===null)throw Error(i(528,""));return V}if(l&&w!==null)throw Error(i(529,""));return null;case"script":return l=d.async,d=d.src,typeof d=="string"&&l&&typeof l!="function"&&typeof l!="symbol"?(l=sf(d),d=GA(v).hoistableScripts,w=d.get(l),w||(w={type:"script",instance:null,count:0,state:null},d.set(l,w)),w):{type:"void",instance:null,count:0,state:null};default:throw Error(i(444,C))}}function rf(C){return'href="'+ci(C)+'"'}function Cw(C){return'link[rel="stylesheet"]['+C+"]"}function D3(C){return B({},C,{"data-precedence":C.precedence,precedence:null})}function NrA(C,l,d,w){C.querySelector('link[rel="preload"][as="style"]['+l+"]")?w.loading=1:(l=C.createElement("link"),w.preload=l,l.addEventListener("load",function(){return w.loading|=1}),l.addEventListener("error",function(){return w.loading|=2}),Fo(l,"link",d),oe(l),C.head.appendChild(l))}function sf(C){return'[src="'+ci(C)+'"]'}function Bw(C){return"script[async]"+C}function y3(C,l,d){if(l.count++,l.instance===null)switch(l.type){case"style":var w=C.querySelector('style[data-href~="'+ci(d.href)+'"]');if(w)return l.instance=w,oe(w),w;var v=B({},d,{"data-href":d.href,"data-precedence":d.precedence,href:null,precedence:null});return w=(C.ownerDocument||C).createElement("style"),oe(w),Fo(w,"style",v),eN(w,d.precedence,C),l.instance=w;case"stylesheet":v=rf(d.href);var L=C.querySelector(Cw(v));if(L)return l.state.loading|=4,l.instance=L,oe(L),L;w=D3(d),(v=qs.get(v))&&Ov(w,v),L=(C.ownerDocument||C).createElement("link"),oe(L);var V=L;return V._p=new Promise(function(BA,YA){V.onload=BA,V.onerror=YA}),Fo(L,"link",w),l.state.loading|=4,eN(L,d.precedence,C),l.instance=L;case"script":return L=sf(d.src),(v=C.querySelector(Bw(L)))?(l.instance=v,oe(v),v):(w=d,(v=qs.get(L))&&(w=B({},d),Pv(w,v)),C=C.ownerDocument||C,v=C.createElement("script"),oe(v),Fo(v,"link",w),C.head.appendChild(v),l.instance=v);case"void":return null;default:throw Error(i(443,l.type))}else l.type==="stylesheet"&&(l.state.loading&4)===0&&(w=l.instance,l.state.loading|=4,eN(w,d.precedence,C));return l.instance}function eN(C,l,d){for(var w=d.querySelectorAll('link[rel="stylesheet"][data-precedence],style[data-precedence]'),v=w.length?w[w.length-1]:null,L=v,V=0;V<w.length;V++){var BA=w[V];if(BA.dataset.precedence===l)L=BA;else if(L!==v)break}L?L.parentNode.insertBefore(C,L.nextSibling):(l=d.nodeType===9?d.head:d,l.insertBefore(C,l.firstChild))}function Ov(C,l){C.crossOrigin==null&&(C.crossOrigin=l.crossOrigin),C.referrerPolicy==null&&(C.referrerPolicy=l.referrerPolicy),C.title==null&&(C.title=l.title)}function Pv(C,l){C.crossOrigin==null&&(C.crossOrigin=l.crossOrigin),C.referrerPolicy==null&&(C.referrerPolicy=l.referrerPolicy),C.integrity==null&&(C.integrity=l.integrity)}var tN=null;function S3(C,l,d){if(tN===null){var w=new Map,v=tN=new Map;v.set(d,w)}else v=tN,w=v.get(d),w||(w=new Map,v.set(d,w));if(w.has(C))return w;for(w.set(C,null),d=d.getElementsByTagName(C),v=0;v<d.length;v++){var L=d[v];if(!(L[jt]||L[Me]||C==="link"&&L.getAttribute("rel")==="stylesheet")&&L.namespaceURI!=="http://www.w3.org/2000/svg"){var V=L.getAttribute(l)||"";V=C+V;var BA=w.get(V);BA?BA.push(L):w.set(V,[L])}}return w}function w3(C,l,d){C=C.ownerDocument||C,C.head.insertBefore(d,l==="title"?C.querySelector("head > title"):null)}function GrA(C,l,d){if(d===1||l.itemProp!=null)return!1;switch(C){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 C=l.disabled,typeof l.precedence=="string"&&C==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 m3(C){return!(C.type==="stylesheet"&&(C.state.loading&3)===0)}function RrA(C,l,d,w){if(d.type==="stylesheet"&&(typeof w.media!="string"||matchMedia(w.media).matches!==!1)&&(d.state.loading&4)===0){if(d.instance===null){var v=rf(w.href),L=l.querySelector(Cw(v));if(L){l=L._p,l!==null&&typeof l=="object"&&typeof l.then=="function"&&(C.count++,C=iN.bind(C),l.then(C,C)),d.state.loading|=4,d.instance=L,oe(L);return}L=l.ownerDocument||l,w=D3(w),(v=qs.get(v))&&Ov(w,v),L=L.createElement("link"),oe(L);var V=L;V._p=new Promise(function(BA,YA){V.onload=BA,V.onerror=YA}),Fo(L,"link",w),d.instance=L}C.stylesheets===null&&(C.stylesheets=new Map),C.stylesheets.set(d,l),(l=d.state.preload)&&(d.state.loading&3)===0&&(C.count++,d=iN.bind(C),l.addEventListener("load",d),l.addEventListener("error",d))}}var jv=0;function UrA(C,l){return C.stylesheets&&C.count===0&&IN(C,C.stylesheets),0<C.count||0<C.imgCount?function(d){var w=setTimeout(function(){if(C.stylesheets&&IN(C,C.stylesheets),C.unsuspend){var L=C.unsuspend;C.unsuspend=null,L()}},6e4+l);0<C.imgBytes&&jv===0&&(jv=62500*BrA());var v=setTimeout(function(){if(C.waitingForImages=!1,C.count===0&&(C.stylesheets&&IN(C,C.stylesheets),C.unsuspend)){var L=C.unsuspend;C.unsuspend=null,L()}},(C.imgBytes>jv?50:800)+l);return C.unsuspend=d,function(){C.unsuspend=null,clearTimeout(w),clearTimeout(v)}}:null}function iN(){if(this.count--,this.count===0&&(this.imgCount===0||!this.waitingForImages)){if(this.stylesheets)IN(this,this.stylesheets);else if(this.unsuspend){var C=this.unsuspend;this.unsuspend=null,C()}}}var gN=null;function IN(C,l){C.stylesheets=null,C.unsuspend!==null&&(C.count++,gN=new Map,l.forEach(KrA,C),gN=null,iN.call(C))}function KrA(C,l){if(!(l.state.loading&4)){var d=gN.get(C);if(d)var w=d.get(null);else{d=new Map,gN.set(C,d);for(var v=C.querySelectorAll("link[data-precedence],style[data-precedence]"),L=0;L<v.length;L++){var V=v[L];(V.nodeName==="LINK"||V.getAttribute("media")!=="not all")&&(d.set(V.dataset.precedence,V),w=V)}w&&d.set(null,w)}v=l.instance,V=v.getAttribute("data-precedence"),L=d.get(V)||w,L===w&&d.set(null,v),d.set(V,v),this.count++,w=iN.bind(this),v.addEventListener("load",w),v.addEventListener("error",w),L?L.parentNode.insertBefore(v,L.nextSibling):(C=C.nodeType===9?C.head:C,C.insertBefore(v,C.firstChild)),l.state.loading|=4}}var cw={$$typeof:k,Provider:null,Consumer:null,_currentValue:O,_currentValue2:O,_threadCount:0};function FrA(C,l,d,w,v,L,V,BA,YA){this.tag=1,this.containerInfo=C,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=be(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=be(0),this.hiddenUpdates=be(null),this.identifierPrefix=w,this.onUncaughtError=v,this.onCaughtError=L,this.onRecoverableError=V,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=YA,this.incompleteTransitions=new Map}function k3(C,l,d,w,v,L,V,BA,YA,De,Je,He){return C=new FrA(C,l,d,V,YA,De,Je,He,BA),l=1,L===!0&&(l|=24),L=Mo(3,null,null,l),C.current=L,L.stateNode=C,l=fS(),l.refCount++,C.pooledCache=l,l.refCount++,L.memoizedState={element:w,isDehydrated:d,cache:l},kS(L),C}function M3(C){return C?(C=PB,C):PB}function N3(C,l,d,w,v,L){v=M3(v),w.context===null?w.context=v:w.pendingContext=v,w=Gs(l),w.payload={element:d},L=L===void 0?null:L,L!==null&&(w.callback=L),d=vC(C,w,l),d!==null&&(h(d,C,l),Ac(d,C,l))}function G3(C,l){if(C=C.memoizedState,C!==null&&C.dehydrated!==null){var d=C.retryLane;C.retryLane=d!==0&&d<l?d:l}}function Zv(C,l){G3(C,l),(C=C.alternate)&&G3(C,l)}function R3(C){if(C.tag===13||C.tag===31){var l=OB(C,67108864);l!==null&&h(l,C,67108864),Zv(C,67108864)}}function U3(C){if(C.tag===13||C.tag===31){var l=Ko();l=Rt(l);var d=OB(C,l);d!==null&&h(d,C,l),Zv(C,l)}}var nN=!0;function brA(C,l,d,w){var v=q.T;q.T=null;var L=Y.p;try{Y.p=2,Wv(C,l,d,w)}finally{Y.p=L,q.T=v}}function vrA(C,l,d,w){var v=q.T;q.T=null;var L=Y.p;try{Y.p=8,Wv(C,l,d,w)}finally{Y.p=L,q.T=v}}function Wv(C,l,d,w){if(nN){var v=zv(w);if(v===null)bv(C,l,w,oN,d),F3(C,w);else if(JrA(v,C,l,d,w))w.stopPropagation();else if(F3(C,w),l&4&&-1<_rA.indexOf(C)){for(;v!==null;){var L=JA(v);if(L!==null)switch(L.tag){case 3:if(L=L.stateNode,L.current.memoizedState.isDehydrated){var V=EA(L.pendingLanes);if(V!==0){var BA=L;for(BA.pendingLanes|=2,BA.entangledLanes|=2;V;){var YA=1<<31-ge(V);BA.entanglements[1]|=YA,V&=~YA}rc(L),(tg&6)===0&&(Ya=eA()+500,ow(0))}}break;case 31:case 13:BA=OB(L,2),BA!==null&&h(BA,L,2),lA(),Zv(L,2)}if(L=zv(w),L===null&&bv(C,l,w,oN,d),L===v)break;v=L}v!==null&&w.stopPropagation()}else bv(C,l,w,null,d)}}function zv(C){return C=Nt(C),Vv(C)}var oN=null;function Vv(C){if(oN=null,C=QA(C),C!==null){var l=I(C);if(l===null)C=null;else{var d=l.tag;if(d===13){if(C=n(l),C!==null)return C;C=null}else if(d===31){if(C=o(l),C!==null)return C;C=null}else if(d===3){if(l.stateNode.current.memoizedState.isDehydrated)return l.tag===3?l.stateNode.containerInfo:null;C=null}else l!==C&&(C=null)}}return oN=C,null}function K3(C){switch(C){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(UA()){case HA:return 2;case Se:return 8;case ne:case Oe:return 32;case VA:return 268435456;default:return 32}default:return 32}}var Xv=!1,nE=null,oE=null,aE=null,lw=new Map,Qw=new Map,rE=[],_rA="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 F3(C,l){switch(C){case"focusin":case"focusout":nE=null;break;case"dragenter":case"dragleave":oE=null;break;case"mouseover":case"mouseout":aE=null;break;case"pointerover":case"pointerout":lw.delete(l.pointerId);break;case"gotpointercapture":case"lostpointercapture":Qw.delete(l.pointerId)}}function Ew(C,l,d,w,v,L){return C===null||C.nativeEvent!==L?(C={blockedOn:l,domEventName:d,eventSystemFlags:w,nativeEvent:L,targetContainers:[v]},l!==null&&(l=JA(l),l!==null&&R3(l)),C):(C.eventSystemFlags|=w,l=C.targetContainers,v!==null&&l.indexOf(v)===-1&&l.push(v),C)}function JrA(C,l,d,w,v){switch(l){case"focusin":return nE=Ew(nE,C,l,d,w,v),!0;case"dragenter":return oE=Ew(oE,C,l,d,w,v),!0;case"mouseover":return aE=Ew(aE,C,l,d,w,v),!0;case"pointerover":var L=v.pointerId;return lw.set(L,Ew(lw.get(L)||null,C,l,d,w,v)),!0;case"gotpointercapture":return L=v.pointerId,Qw.set(L,Ew(Qw.get(L)||null,C,l,d,w,v)),!0}return!1}function b3(C){var l=QA(C.target);if(l!==null){var d=I(l);if(d!==null){if(l=d.tag,l===13){if(l=n(d),l!==null){C.blockedOn=l,Be(C.priority,function(){U3(d)});return}}else if(l===31){if(l=o(d),l!==null){C.blockedOn=l,Be(C.priority,function(){U3(d)});return}}else if(l===3&&d.stateNode.current.memoizedState.isDehydrated){C.blockedOn=d.tag===3?d.stateNode.containerInfo:null;return}}}C.blockedOn=null}function aN(C){if(C.blockedOn!==null)return!1;for(var l=C.targetContainers;0<l.length;){var d=zv(C.nativeEvent);if(d===null){d=C.nativeEvent;var w=new d.constructor(d.type,d);$e=w,d.target.dispatchEvent(w),$e=null}else return l=JA(d),l!==null&&R3(l),C.blockedOn=d,!1;l.shift()}return!0}function v3(C,l,d){aN(C)&&d.delete(l)}function LrA(){Xv=!1,nE!==null&&aN(nE)&&(nE=null),oE!==null&&aN(oE)&&(oE=null),aE!==null&&aN(aE)&&(aE=null),lw.forEach(v3),Qw.forEach(v3)}function rN(C,l){C.blockedOn===l&&(C.blockedOn=null,Xv||(Xv=!0,t.unstable_scheduleCallback(t.unstable_NormalPriority,LrA)))}var sN=null;function _3(C){sN!==C&&(sN=C,t.unstable_scheduleCallback(t.unstable_NormalPriority,function(){sN===C&&(sN=null);for(var l=0;l<C.length;l+=3){var d=C[l],w=C[l+1],v=C[l+2];if(typeof w!="function"){if(Vv(w||d)===null)continue;break}var L=JA(d);L!==null&&(C.splice(l,3),l-=3,XS(L,{pending:!0,data:v,method:d.method,action:w},w,v))}}))}function Cf(C){function l(YA){return rN(YA,C)}nE!==null&&rN(nE,C),oE!==null&&rN(oE,C),aE!==null&&rN(aE,C),lw.forEach(l),Qw.forEach(l);for(var d=0;d<rE.length;d++){var w=rE[d];w.blockedOn===C&&(w.blockedOn=null)}for(;0<rE.length&&(d=rE[0],d.blockedOn===null);)b3(d),d.blockedOn===null&&rE.shift();if(d=(C.ownerDocument||C).$$reactFormReplay,d!=null)for(w=0;w<d.length;w+=3){var v=d[w],L=d[w+1],V=v[We]||null;if(typeof L=="function")V||_3(d);else if(V){var BA=null;if(L&&L.hasAttribute("formAction")){if(v=L,V=L[We]||null)BA=V.formAction;else if(Vv(v)!==null)continue}else BA=V.action;typeof BA=="function"?d[w+1]=BA:(d.splice(w,3),w-=3),_3(d)}}}function J3(){function C(L){L.canIntercept&&L.info==="react-transition"&&L.intercept({handler:function(){return new Promise(function(V){return v=V})},focusReset:"manual",scroll:"manual"})}function l(){v!==null&&(v(),v=null),w||setTimeout(d,20)}function d(){if(!w&&!navigation.transition){var L=navigation.currentEntry;L&&L.url!=null&&navigation.navigate(L.url,{state:L.getState(),info:"react-transition",history:"replace"})}}if(typeof navigation=="object"){var w=!1,v=null;return navigation.addEventListener("navigate",C),navigation.addEventListener("navigatesuccess",l),navigation.addEventListener("navigateerror",l),setTimeout(d,100),function(){w=!0,navigation.removeEventListener("navigate",C),navigation.removeEventListener("navigatesuccess",l),navigation.removeEventListener("navigateerror",l),v!==null&&(v(),v=null)}}}function $v(C){this._internalRoot=C}CN.prototype.render=$v.prototype.render=function(C){var l=this._internalRoot;if(l===null)throw Error(i(409));var d=l.current,w=Ko();N3(d,w,C,l,null,null)},CN.prototype.unmount=$v.prototype.unmount=function(){var C=this._internalRoot;if(C!==null){this._internalRoot=null;var l=C.containerInfo;N3(C.current,2,null,C,null,null),lA(),l[at]=null}};function CN(C){this._internalRoot=C}CN.prototype.unstable_scheduleHydration=function(C){if(C){var l=st();C={blockedOn:null,target:C,priority:l};for(var d=0;d<rE.length&&l!==0&&l<rE[d].priority;d++);rE.splice(d,0,C),d===0&&b3(C)}};var L3=A.version;if(L3!=="19.2.0")throw Error(i(527,L3,"19.2.0"));Y.findDOMNode=function(C){var l=C._reactInternals;if(l===void 0)throw typeof C.render=="function"?Error(i(188)):(C=Object.keys(C).join(","),Error(i(268,C)));return C=r(l),C=C!==null?s(C):null,C=C===null?null:C.stateNode,C};var qrA={bundleType:0,version:"19.2.0",rendererPackageName:"react-dom",currentDispatcherRef:q,reconcilerVersion:"19.2.0"};if(typeof __REACT_DEVTOOLS_GLOBAL_HOOK__<"u"){var BN=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(!BN.isDisabled&&BN.supportsFiber)try{WA=BN.inject(qrA),_A=BN}catch{}}return hw.createRoot=function(C,l){if(!g(C))throw Error(i(299));var d=!1,w="",v=tw,L=HM,V=jp;return l!=null&&(l.unstable_strictMode===!0&&(d=!0),l.identifierPrefix!==void 0&&(w=l.identifierPrefix),l.onUncaughtError!==void 0&&(v=l.onUncaughtError),l.onCaughtError!==void 0&&(L=l.onCaughtError),l.onRecoverableError!==void 0&&(V=l.onRecoverableError)),l=k3(C,1,!1,null,null,d,w,null,v,L,V,J3),C[at]=l.current,Fv(C),new $v(l)},hw.hydrateRoot=function(C,l,d){if(!g(C))throw Error(i(299));var w=!1,v="",L=tw,V=HM,BA=jp,YA=null;return d!=null&&(d.unstable_strictMode===!0&&(w=!0),d.identifierPrefix!==void 0&&(v=d.identifierPrefix),d.onUncaughtError!==void 0&&(L=d.onUncaughtError),d.onCaughtError!==void 0&&(V=d.onCaughtError),d.onRecoverableError!==void 0&&(BA=d.onRecoverableError),d.formState!==void 0&&(YA=d.formState)),l=k3(C,1,!0,l,d??null,w,v,YA,L,V,BA,J3),l.context=M3(null),d=l.current,w=Ko(),w=Rt(w),v=Gs(w),v.callback=null,vC(d,v,w),d=w,l.current.lanes=d,It(l,d),rc(l),C[at]=l.current,Fv(C),new CN(l)},hw.version="19.2.0",hw}var W3;function WrA(){if(W3)return t_.exports;W3=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(),t_.exports=ZrA(),t_.exports}var n_=WrA();/**
 * react-router v7.8.0
 *
 * 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 z3="popstate";function zrA(t={}){function A(i,g){let{pathname:I,search:n,hash:o}=i.location;return Ex("",{pathname:I,search:n,hash:o},g.state&&g.state.usr||null,g.state&&g.state.key||"default")}function e(i,g){return typeof g=="string"?g:g0(g)}return XrA(A,e,null,t)}function KI(t,A){if(t===!1||t===null||typeof t>"u")throw new Error(A)}function sC(t,A){if(!t)try{throw new Error(A)}catch{}}function VrA(){return Math.random().toString(36).substring(2,10)}function V3(t,A){return{usr:t.state,key:t.key,idx:A}}function Ex(t,A,e=null,i){return{pathname:typeof t=="string"?t:t.pathname,search:"",hash:"",...typeof A=="string"?Uy(A):A,state:e,key:A&&A.key||i||VrA()}}function g0({pathname:t="/",search:A="",hash:e=""}){return A&&A!=="?"&&(t+=A.charAt(0)==="?"?A:"?"+A),e&&e!=="#"&&(t+=e.charAt(0)==="#"?e:"#"+e),t}function Uy(t){let A={};if(t){let e=t.indexOf("#");e>=0&&(A.hash=t.substring(e),t=t.substring(0,e));let i=t.indexOf("?");i>=0&&(A.search=t.substring(i),t=t.substring(0,i)),t&&(A.pathname=t)}return A}function XrA(t,A,e,i={}){let{window:g=document.defaultView,v5Compat:I=!1}=i,n=g.history,o="POP",a=null,r=s();r==null&&(r=0,n.replaceState({...n.state,idx:r},""));function s(){return(n.state||{idx:null}).idx}function B(){o="POP";let S=s(),f=S==null?null:S-r;r=S,a&&a({action:o,location:y.location,delta:f})}function c(S,f){o="PUSH";let M=Ex(y.location,S,f);r=s()+1;let k=V3(M,r),m=y.createHref(M);try{n.pushState(k,"",m)}catch(U){if(U instanceof DOMException&&U.name==="DataCloneError")throw U;g.location.assign(m)}I&&a&&a({action:o,location:y.location,delta:1})}function E(S,f){o="REPLACE";let M=Ex(y.location,S,f);r=s();let k=V3(M,r),m=y.createHref(M);n.replaceState(k,"",m),I&&a&&a({action:o,location:y.location,delta:0})}function D(S){return $rA(S)}let y={get action(){return o},get location(){return t(g,n)},listen(S){if(a)throw new Error("A history only accepts one active listener");return g.addEventListener(z3,B),a=S,()=>{g.removeEventListener(z3,B),a=null}},createHref(S){return A(g,S)},createURL:D,encodeLocation(S){let f=D(S);return{pathname:f.pathname,search:f.search,hash:f.hash}},push:c,replace:E,go(S){return n.go(S)}};return y}function $rA(t,A=!1){let e="http://localhost";typeof window<"u"&&(e=window.location.origin!=="null"?window.location.origin:window.location.href),KI(e,"No window.location.(origin|href) available to create URL");let i=typeof t=="string"?t:g0(t);return i=i.replace(/ $/,"%20"),!A&&i.startsWith("//")&&(i=e+i),new URL(i,e)}function bX(t,A,e="/"){return AsA(t,A,e,!1)}function AsA(t,A,e,i){let g=typeof A=="string"?Uy(A):A,I=sQ(g.pathname||"/",e);if(I==null)return null;let n=vX(t);esA(n);let o=null;for(let a=0;o==null&&a<n.length;++a){let r=BsA(I);o=ssA(n[a],r,i)}return o}function vX(t,A=[],e=[],i=""){let g=(I,n,o)=>{let a={relativePath:o===void 0?I.path||"":o,caseSensitive:I.caseSensitive===!0,childrenIndex:n,route:I};a.relativePath.startsWith("/")&&(KI(a.relativePath.startsWith(i),`Absolute route path "${a.relativePath}" nested under path "${i}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),a.relativePath=a.relativePath.slice(i.length));let r=eQ([i,a.relativePath]),s=e.concat(a);I.children&&I.children.length>0&&(KI(I.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${r}".`),vX(I.children,A,s,r)),!(I.path==null&&!I.index)&&A.push({path:r,score:asA(r,I.index),routesMeta:s})};return t.forEach((I,n)=>{if(I.path===""||!I.path?.includes("?"))g(I,n);else for(let o of _X(I.path))g(I,n,o)}),A}function _X(t){let A=t.split("/");if(A.length===0)return[];let[e,...i]=A,g=e.endsWith("?"),I=e.replace(/\?$/,"");if(i.length===0)return g?[I,""]:[I];let n=_X(i.join("/")),o=[];return o.push(...n.map(a=>a===""?I:[I,a].join("/"))),g&&o.push(...n),o.map(a=>t.startsWith("/")&&a===""?"/":a)}function esA(t){t.sort((A,e)=>A.score!==e.score?e.score-A.score:rsA(A.routesMeta.map(i=>i.childrenIndex),e.routesMeta.map(i=>i.childrenIndex)))}var tsA=/^:[\w-]+$/,isA=3,gsA=2,IsA=1,nsA=10,osA=-2,X3=t=>t==="*";function asA(t,A){let e=t.split("/"),i=e.length;return e.some(X3)&&(i+=osA),A&&(i+=gsA),e.filter(g=>!X3(g)).reduce((g,I)=>g+(tsA.test(I)?isA:I===""?IsA:nsA),i)}function rsA(t,A){return t.length===A.length&&t.slice(0,-1).every((i,g)=>i===A[g])?t[t.length-1]-A[A.length-1]:0}function ssA(t,A,e=!1){let{routesMeta:i}=t,g={},I="/",n=[];for(let o=0;o<i.length;++o){let a=i[o],r=o===i.length-1,s=I==="/"?A:A.slice(I.length)||"/",B=tU({path:a.relativePath,caseSensitive:a.caseSensitive,end:r},s),c=a.route;if(!B&&r&&e&&!i[i.length-1].route.index&&(B=tU({path:a.relativePath,caseSensitive:a.caseSensitive,end:!1},s)),!B)return null;Object.assign(g,B.params),n.push({params:g,pathname:eQ([I,B.pathname]),pathnameBase:EsA(eQ([I,B.pathnameBase])),route:c}),B.pathnameBase!=="/"&&(I=eQ([I,B.pathnameBase]))}return n}function tU(t,A){typeof t=="string"&&(t={path:t,caseSensitive:!1,end:!0});let[e,i]=CsA(t.path,t.caseSensitive,t.end),g=A.match(e);if(!g)return null;let I=g[0],n=I.replace(/(.)\/+$/,"$1"),o=g.slice(1);return{params:i.reduce((r,{paramName:s,isOptional:B},c)=>{if(s==="*"){let D=o[c]||"";n=I.slice(0,I.length-D.length).replace(/(.)\/+$/,"$1")}const E=o[c];return B&&!E?r[s]=void 0:r[s]=(E||"").replace(/%2F/g,"/"),r},{}),pathname:I,pathnameBase:n,pattern:t}}function CsA(t,A=!1,e=!0){sC(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 i=[],g="^"+t.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(n,o,a)=>(i.push({paramName:o,isOptional:a!=null}),a?"/?([^\\/]+)?":"/([^\\/]+)"));return t.endsWith("*")?(i.push({paramName:"*"}),g+=t==="*"||t==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):e?g+="\\/*$":t!==""&&t!=="/"&&(g+="(?:(?=\\/|$))"),[new RegExp(g,A?void 0:"i"),i]}function BsA(t){try{return t.split("/").map(A=>decodeURIComponent(A).replace(/\//g,"%2F")).join("/")}catch(A){return sC(!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 (${A}).`),t}}function sQ(t,A){if(A==="/")return t;if(!t.toLowerCase().startsWith(A.toLowerCase()))return null;let e=A.endsWith("/")?A.length-1:A.length,i=t.charAt(e);return i&&i!=="/"?null:t.slice(e)||"/"}function csA(t,A="/"){let{pathname:e,search:i="",hash:g=""}=typeof t=="string"?Uy(t):t;return{pathname:e?e.startsWith("/")?e:lsA(e,A):A,search:usA(i),hash:hsA(g)}}function lsA(t,A){let e=A.replace(/\/+$/,"").split("/");return t.split("/").forEach(g=>{g===".."?e.length>1&&e.pop():g!=="."&&e.push(g)}),e.length>1?e.join("/"):"/"}function o_(t,A,e,i){return`Cannot include a '${t}' character in a manually specified \`to.${A}\` field [${JSON.stringify(i)}].  Please separate it out to the \`to.${e}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function QsA(t){return t.filter((A,e)=>e===0||A.route.path&&A.route.path.length>0)}function g2(t){let A=QsA(t);return A.map((e,i)=>i===A.length-1?e.pathname:e.pathnameBase)}function I2(t,A,e,i=!1){let g;typeof t=="string"?g=Uy(t):(g={...t},KI(!g.pathname||!g.pathname.includes("?"),o_("?","pathname","search",g)),KI(!g.pathname||!g.pathname.includes("#"),o_("#","pathname","hash",g)),KI(!g.search||!g.search.includes("#"),o_("#","search","hash",g)));let I=t===""||g.pathname==="",n=I?"/":g.pathname,o;if(n==null)o=e;else{let B=A.length-1;if(!i&&n.startsWith("..")){let c=n.split("/");for(;c[0]==="..";)c.shift(),B-=1;g.pathname=c.join("/")}o=B>=0?A[B]:"/"}let a=csA(g,o),r=n&&n!=="/"&&n.endsWith("/"),s=(I||n===".")&&e.endsWith("/");return!a.pathname.endsWith("/")&&(r||s)&&(a.pathname+="/"),a}var eQ=t=>t.join("/").replace(/\/\/+/g,"/"),EsA=t=>t.replace(/\/+$/,"").replace(/^\/*/,"/"),usA=t=>!t||t==="?"?"":t.startsWith("?")?t:"?"+t,hsA=t=>!t||t==="#"?"":t.startsWith("#")?t:"#"+t;function dsA(t){return t!=null&&typeof t.status=="number"&&typeof t.statusText=="string"&&typeof t.internal=="boolean"&&"data"in t}var JX=["POST","PUT","PATCH","DELETE"];new Set(JX);var psA=["GET",...JX];new Set(psA);var Ky=p.createContext(null);Ky.displayName="DataRouter";var QF=p.createContext(null);QF.displayName="DataRouterState";p.createContext(!1);var LX=p.createContext({isTransitioning:!1});LX.displayName="ViewTransition";var fsA=p.createContext(new Map);fsA.displayName="Fetchers";var DsA=p.createContext(null);DsA.displayName="Await";var wB=p.createContext(null);wB.displayName="Navigation";var dk=p.createContext(null);dk.displayName="Location";var uC=p.createContext({outlet:null,matches:[],isDataRoute:!1});uC.displayName="Route";var n2=p.createContext(null);n2.displayName="RouteError";function ysA(t,{relative:A}={}){KI(Fy(),"useHref() may be used only in the context of a <Router> component.");let{basename:e,navigator:i}=p.useContext(wB),{hash:g,pathname:I,search:n}=pk(t,{relative:A}),o=I;return e!=="/"&&(o=I==="/"?e:eQ([e,I])),i.createHref({pathname:o,search:n,hash:g})}function Fy(){return p.useContext(dk)!=null}function ln(){return KI(Fy(),"useLocation() may be used only in the context of a <Router> component."),p.useContext(dk).location}var qX="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function xX(t){p.useContext(wB).static||p.useLayoutEffect(t)}function Di(){let{isDataRoute:t}=p.useContext(uC);return t?JsA():SsA()}function SsA(){KI(Fy(),"useNavigate() may be used only in the context of a <Router> component.");let t=p.useContext(Ky),{basename:A,navigator:e}=p.useContext(wB),{matches:i}=p.useContext(uC),{pathname:g}=ln(),I=JSON.stringify(g2(i)),n=p.useRef(!1);return xX(()=>{n.current=!0}),p.useCallback((a,r={})=>{if(sC(n.current,qX),!n.current)return;if(typeof a=="number"){e.go(a);return}let s=I2(a,JSON.parse(I),g,r.relative==="path");t==null&&A!=="/"&&(s.pathname=s.pathname==="/"?A:eQ([A,s.pathname])),(r.replace?e.replace:e.push)(s,r.state,r)},[A,e,I,g,t])}var wsA=p.createContext(null);function msA(t){let A=p.useContext(uC).outlet;return A&&p.createElement(wsA.Provider,{value:t},A)}function by(){let{matches:t}=p.useContext(uC),A=t[t.length-1];return A?A.params:{}}function pk(t,{relative:A}={}){let{matches:e}=p.useContext(uC),{pathname:i}=ln(),g=JSON.stringify(g2(e));return p.useMemo(()=>I2(t,JSON.parse(g),i,A==="path"),[t,g,i,A])}function ksA(t,A){return TX(t,A)}function TX(t,A,e,i){KI(Fy(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:g}=p.useContext(wB),{matches:I}=p.useContext(uC),n=I[I.length-1],o=n?n.params:{},a=n?n.pathname:"/",r=n?n.pathnameBase:"/",s=n&&n.route;{let f=s&&s.path||"";YX(a,!s||f.endsWith("*")||f.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${a}" (under <Route path="${f}">) 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="${f}"> to <Route path="${f==="/"?"*":`${f}/*`}">.`)}let B=ln(),c;if(A){let f=typeof A=="string"?Uy(A):A;KI(r==="/"||f.pathname?.startsWith(r),`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 "${r}" but pathname "${f.pathname}" was given in the \`location\` prop.`),c=f}else c=B;let E=c.pathname||"/",D=E;if(r!=="/"){let f=r.replace(/^\//,"").split("/");D="/"+E.replace(/^\//,"").split("/").slice(f.length).join("/")}let y=bX(t,{pathname:D});sC(s||y!=null,`No routes matched location "${c.pathname}${c.search}${c.hash}" `),sC(y==null||y[y.length-1].route.element!==void 0||y[y.length-1].route.Component!==void 0||y[y.length-1].route.lazy!==void 0,`Matched leaf route at location "${c.pathname}${c.search}${c.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 S=UsA(y&&y.map(f=>Object.assign({},f,{params:Object.assign({},o,f.params),pathname:eQ([r,g.encodeLocation?g.encodeLocation(f.pathname).pathname:f.pathname]),pathnameBase:f.pathnameBase==="/"?r:eQ([r,g.encodeLocation?g.encodeLocation(f.pathnameBase).pathname:f.pathnameBase])})),I,e,i);return A&&S?p.createElement(dk.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...c},navigationType:"POP"}},S):S}function MsA(){let t=_sA(),A=dsA(t)?`${t.status} ${t.statusText}`:t instanceof Error?t.message:JSON.stringify(t),e=t instanceof Error?t.stack:null,i="rgba(200,200,200, 0.5)",g={padding:"0.5rem",backgroundColor:i},I={padding:"2px 4px",backgroundColor:i},n=null;return n=p.createElement(p.Fragment,null,p.createElement("p",null,"💿 Hey developer 👋"),p.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",p.createElement("code",{style:I},"ErrorBoundary")," or"," ",p.createElement("code",{style:I},"errorElement")," prop on your route.")),p.createElement(p.Fragment,null,p.createElement("h2",null,"Unexpected Application Error!"),p.createElement("h3",{style:{fontStyle:"italic"}},A),e?p.createElement("pre",{style:g},e):null,n)}var NsA=p.createElement(MsA,null),GsA=class extends p.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,A){return A.location!==t.location||A.revalidation!=="idle"&&t.revalidation==="idle"?{error:t.error,location:t.location,revalidation:t.revalidation}:{error:t.error!==void 0?t.error:A.error,location:A.location,revalidation:t.revalidation||A.revalidation}}componentDidCatch(t,A){}render(){return this.state.error!==void 0?p.createElement(uC.Provider,{value:this.props.routeContext},p.createElement(n2.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function RsA({routeContext:t,match:A,children:e}){let i=p.useContext(Ky);return i&&i.static&&i.staticContext&&(A.route.errorElement||A.route.ErrorBoundary)&&(i.staticContext._deepestRenderedBoundaryId=A.route.id),p.createElement(uC.Provider,{value:t},e)}function UsA(t,A=[],e=null,i=null){if(t==null){if(!e)return null;if(e.errors)t=e.matches;else if(A.length===0&&!e.initialized&&e.matches.length>0)t=e.matches;else return null}let g=t,I=e?.errors;if(I!=null){let a=g.findIndex(r=>r.route.id&&I?.[r.route.id]!==void 0);KI(a>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(I).join(",")}`),g=g.slice(0,Math.min(g.length,a+1))}let n=!1,o=-1;if(e)for(let a=0;a<g.length;a++){let r=g[a];if((r.route.HydrateFallback||r.route.hydrateFallbackElement)&&(o=a),r.route.id){let{loaderData:s,errors:B}=e,c=r.route.loader&&!s.hasOwnProperty(r.route.id)&&(!B||B[r.route.id]===void 0);if(r.route.lazy||c){n=!0,o>=0?g=g.slice(0,o+1):g=[g[0]];break}}}return g.reduceRight((a,r,s)=>{let B,c=!1,E=null,D=null;e&&(B=I&&r.route.id?I[r.route.id]:void 0,E=r.route.errorElement||NsA,n&&(o<0&&s===0?(YX("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),c=!0,D=null):o===s&&(c=!0,D=r.route.hydrateFallbackElement||null)));let y=A.concat(g.slice(0,s+1)),S=()=>{let f;return B?f=E:c?f=D:r.route.Component?f=p.createElement(r.route.Component,null):r.route.element?f=r.route.element:f=a,p.createElement(RsA,{match:r,routeContext:{outlet:a,matches:y,isDataRoute:e!=null},children:f})};return e&&(r.route.ErrorBoundary||r.route.errorElement||s===0)?p.createElement(GsA,{location:e.location,revalidation:e.revalidation,component:E,error:B,children:S(),routeContext:{outlet:null,matches:y,isDataRoute:!0}}):S()},null)}function o2(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function KsA(t){let A=p.useContext(Ky);return KI(A,o2(t)),A}function FsA(t){let A=p.useContext(QF);return KI(A,o2(t)),A}function bsA(t){let A=p.useContext(uC);return KI(A,o2(t)),A}function a2(t){let A=bsA(t),e=A.matches[A.matches.length-1];return KI(e.route.id,`${t} can only be used on routes that contain a unique "id"`),e.route.id}function vsA(){return a2("useRouteId")}function _sA(){let t=p.useContext(n2),A=FsA("useRouteError"),e=a2("useRouteError");return t!==void 0?t:A.errors?.[e]}function JsA(){let{router:t}=KsA("useNavigate"),A=a2("useNavigate"),e=p.useRef(!1);return xX(()=>{e.current=!0}),p.useCallback(async(g,I={})=>{sC(e.current,qX),e.current&&(typeof g=="number"?t.navigate(g):await t.navigate(g,{fromRouteId:A,...I}))},[t,A])}var $3={};function YX(t,A,e){!A&&!$3[t]&&($3[t]=!0,sC(!1,e))}p.memo(LsA);function LsA({routes:t,future:A,state:e}){return TX(t,void 0,e,A)}function An({to:t,replace:A,state:e,relative:i}){KI(Fy(),"<Navigate> may be used only in the context of a <Router> component.");let{static:g}=p.useContext(wB);sC(!g,"<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}=p.useContext(uC),{pathname:n}=ln(),o=Di(),a=I2(t,g2(I),n,i==="path"),r=JSON.stringify(a);return p.useEffect(()=>{o(JSON.parse(r),{replace:A,state:e,relative:i})},[o,r,i,A,e]),null}function HX(t){return msA(t.context)}function Ce(t){KI(!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 qsA({basename:t="/",children:A=null,location:e,navigationType:i="POP",navigator:g,static:I=!1}){KI(!Fy(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let n=t.replace(/^\/*/,"/"),o=p.useMemo(()=>({basename:n,navigator:g,static:I,future:{}}),[n,g,I]);typeof e=="string"&&(e=Uy(e));let{pathname:a="/",search:r="",hash:s="",state:B=null,key:c="default"}=e,E=p.useMemo(()=>{let D=sQ(a,n);return D==null?null:{location:{pathname:D,search:r,hash:s,state:B,key:c},navigationType:i}},[n,a,r,s,B,c,i]);return sC(E!=null,`<Router basename="${n}"> is not able to match the URL "${a}${r}${s}" because it does not start with the basename, so the <Router> won't render anything.`),E==null?null:p.createElement(wB.Provider,{value:o},p.createElement(dk.Provider,{children:A,value:E}))}function Yd({children:t,location:A}){return ksA(ux(t),A)}function ux(t,A=[]){let e=[];return p.Children.forEach(t,(i,g)=>{if(!p.isValidElement(i))return;let I=[...A,g];if(i.type===p.Fragment){e.push.apply(e,ux(i.props.children,I));return}KI(i.type===Ce,`[${typeof i.type=="string"?i.type:i.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),KI(!i.props.index||!i.props.children,"An index route cannot have child routes.");let n={id:i.props.id||I.join("-"),caseSensitive:i.props.caseSensitive,element:i.props.element,Component:i.props.Component,index:i.props.index,path:i.props.path,loader:i.props.loader,action:i.props.action,hydrateFallbackElement:i.props.hydrateFallbackElement,HydrateFallback:i.props.HydrateFallback,errorElement:i.props.errorElement,ErrorBoundary:i.props.ErrorBoundary,hasErrorBoundary:i.props.hasErrorBoundary===!0||i.props.ErrorBoundary!=null||i.props.errorElement!=null,shouldRevalidate:i.props.shouldRevalidate,handle:i.props.handle,lazy:i.props.lazy};i.props.children&&(n.children=ux(i.props.children,I)),e.push(n)}),e}var gR="get",IR="application/x-www-form-urlencoded";function EF(t){return t!=null&&typeof t.tagName=="string"}function xsA(t){return EF(t)&&t.tagName.toLowerCase()==="button"}function TsA(t){return EF(t)&&t.tagName.toLowerCase()==="form"}function YsA(t){return EF(t)&&t.tagName.toLowerCase()==="input"}function HsA(t){return!!(t.metaKey||t.altKey||t.ctrlKey||t.shiftKey)}function OsA(t,A){return t.button===0&&(!A||A==="_self")&&!HsA(t)}function hx(t=""){return new URLSearchParams(typeof t=="string"||Array.isArray(t)||t instanceof URLSearchParams?t:Object.keys(t).reduce((A,e)=>{let i=t[e];return A.concat(Array.isArray(i)?i.map(g=>[e,g]):[[e,i]])},[]))}function PsA(t,A){let e=hx(t);return A&&A.forEach((i,g)=>{e.has(g)||A.getAll(g).forEach(I=>{e.append(g,I)})}),e}var cN=null;function jsA(){if(cN===null)try{new FormData(document.createElement("form"),0),cN=!1}catch{cN=!0}return cN}var ZsA=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function a_(t){return t!=null&&!ZsA.has(t)?(sC(!1,`"${t}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${IR}"`),null):t}function WsA(t,A){let e,i,g,I,n;if(TsA(t)){let o=t.getAttribute("action");i=o?sQ(o,A):null,e=t.getAttribute("method")||gR,g=a_(t.getAttribute("enctype"))||IR,I=new FormData(t)}else if(xsA(t)||YsA(t)&&(t.type==="submit"||t.type==="image")){let o=t.form;if(o==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let a=t.getAttribute("formaction")||o.getAttribute("action");if(i=a?sQ(a,A):null,e=t.getAttribute("formmethod")||o.getAttribute("method")||gR,g=a_(t.getAttribute("formenctype"))||a_(o.getAttribute("enctype"))||IR,I=new FormData(o,t),!jsA()){let{name:r,type:s,value:B}=t;if(s==="image"){let c=r?`${r}.`:"";I.append(`${c}x`,"0"),I.append(`${c}y`,"0")}else r&&I.append(r,B)}}else{if(EF(t))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');e=gR,i=null,g=IR,n=t}return I&&g==="text/plain"&&(n=I,I=void 0),{action:i,method:e.toLowerCase(),encType:g,formData:I,body:n}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function r2(t,A){if(t===!1||t===null||typeof t>"u")throw new Error(A)}function zsA(t,A,e){let i=typeof t=="string"?new URL(t,typeof window>"u"?"server://singlefetch/":window.location.origin):t;return i.pathname==="/"?i.pathname=`_root.${e}`:A&&sQ(i.pathname,A)==="/"?i.pathname=`${A.replace(/\/$/,"")}/_root.${e}`:i.pathname=`${i.pathname.replace(/\/$/,"")}.${e}`,i}async function VsA(t,A){if(t.id in A)return A[t.id];try{let e=await import(t.module);return A[t.id]=e,e}catch{return window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function XsA(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 $sA(t,A,e){let i=await Promise.all(t.map(async g=>{let I=A.routes[g.route.id];if(I){let n=await VsA(I,e);return n.links?n.links():[]}return[]}));return iCA(i.flat(1).filter(XsA).filter(g=>g.rel==="stylesheet"||g.rel==="preload").map(g=>g.rel==="stylesheet"?{...g,rel:"prefetch",as:"style"}:{...g,rel:"prefetch"}))}function A4(t,A,e,i,g,I){let n=(a,r)=>e[r]?a.route.id!==e[r].route.id:!0,o=(a,r)=>e[r].pathname!==a.pathname||e[r].route.path?.endsWith("*")&&e[r].params["*"]!==a.params["*"];return I==="assets"?A.filter((a,r)=>n(a,r)||o(a,r)):I==="data"?A.filter((a,r)=>{let s=i.routes[a.route.id];if(!s||!s.hasLoader)return!1;if(n(a,r)||o(a,r))return!0;if(a.route.shouldRevalidate){let B=a.route.shouldRevalidate({currentUrl:new URL(g.pathname+g.search+g.hash,window.origin),currentParams:e[0]?.params||{},nextUrl:new URL(t,window.origin),nextParams:a.params,defaultShouldRevalidate:!0});if(typeof B=="boolean")return B}return!0}):[]}function ACA(t,A,{includeHydrateFallback:e}={}){return eCA(t.map(i=>{let g=A.routes[i.route.id];if(!g)return[];let I=[g.module];return g.clientActionModule&&(I=I.concat(g.clientActionModule)),g.clientLoaderModule&&(I=I.concat(g.clientLoaderModule)),e&&g.hydrateFallbackModule&&(I=I.concat(g.hydrateFallbackModule)),g.imports&&(I=I.concat(g.imports)),I}).flat(1))}function eCA(t){return[...new Set(t)]}function tCA(t){let A={},e=Object.keys(t).sort();for(let i of e)A[i]=t[i];return A}function iCA(t,A){let e=new Set;return new Set(A),t.reduce((i,g)=>{let I=JSON.stringify(tCA(g));return e.has(I)||(e.add(I),i.push({key:I,link:g})),i},[])}function OX(){let t=p.useContext(Ky);return r2(t,"You must render this element inside a <DataRouterContext.Provider> element"),t}function gCA(){let t=p.useContext(QF);return r2(t,"You must render this element inside a <DataRouterStateContext.Provider> element"),t}var s2=p.createContext(void 0);s2.displayName="FrameworkContext";function PX(){let t=p.useContext(s2);return r2(t,"You must render this element inside a <HydratedRouter> element"),t}function ICA(t,A){let e=p.useContext(s2),[i,g]=p.useState(!1),[I,n]=p.useState(!1),{onFocus:o,onBlur:a,onMouseEnter:r,onMouseLeave:s,onTouchStart:B}=A,c=p.useRef(null);p.useEffect(()=>{if(t==="render"&&n(!0),t==="viewport"){let y=f=>{f.forEach(M=>{n(M.isIntersecting)})},S=new IntersectionObserver(y,{threshold:.5});return c.current&&S.observe(c.current),()=>{S.disconnect()}}},[t]),p.useEffect(()=>{if(i){let y=setTimeout(()=>{n(!0)},100);return()=>{clearTimeout(y)}}},[i]);let E=()=>{g(!0)},D=()=>{g(!1),n(!1)};return e?t!=="intent"?[I,c,{}]:[I,c,{onFocus:dw(o,E),onBlur:dw(a,D),onMouseEnter:dw(r,E),onMouseLeave:dw(s,D),onTouchStart:dw(B,E)}]:[!1,c,{}]}function dw(t,A){return e=>{t&&t(e),e.defaultPrevented||A(e)}}function nCA({page:t,...A}){let{router:e}=OX(),i=p.useMemo(()=>bX(e.routes,t,e.basename),[e.routes,t,e.basename]);return i?p.createElement(aCA,{page:t,matches:i,...A}):null}function oCA(t){let{manifest:A,routeModules:e}=PX(),[i,g]=p.useState([]);return p.useEffect(()=>{let I=!1;return $sA(t,A,e).then(n=>{I||g(n)}),()=>{I=!0}},[t,A,e]),i}function aCA({page:t,matches:A,...e}){let i=ln(),{manifest:g,routeModules:I}=PX(),{basename:n}=OX(),{loaderData:o,matches:a}=gCA(),r=p.useMemo(()=>A4(t,A,a,g,i,"data"),[t,A,a,g,i]),s=p.useMemo(()=>A4(t,A,a,g,i,"assets"),[t,A,a,g,i]),B=p.useMemo(()=>{if(t===i.pathname+i.search+i.hash)return[];let D=new Set,y=!1;if(A.forEach(f=>{let M=g.routes[f.route.id];!M||!M.hasLoader||(!r.some(k=>k.route.id===f.route.id)&&f.route.id in o&&I[f.route.id]?.shouldRevalidate||M.hasClientLoader?y=!0:D.add(f.route.id))}),D.size===0)return[];let S=zsA(t,n,"data");return y&&D.size>0&&S.searchParams.set("_routes",A.filter(f=>D.has(f.route.id)).map(f=>f.route.id).join(",")),[S.pathname+S.search]},[n,o,i,g,r,A,t,I]),c=p.useMemo(()=>ACA(s,g),[s,g]),E=oCA(s);return p.createElement(p.Fragment,null,B.map(D=>p.createElement("link",{key:D,rel:"prefetch",as:"fetch",href:D,...e})),c.map(D=>p.createElement("link",{key:D,rel:"modulepreload",href:D,...e})),E.map(({key:D,link:y})=>p.createElement("link",{key:D,nonce:e.nonce,...y})))}function rCA(...t){return A=>{t.forEach(e=>{typeof e=="function"?e(A):e!=null&&(e.current=A)})}}var jX=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{jX&&(window.__reactRouterVersion="7.8.0")}catch{}function sCA({basename:t,children:A,window:e}){let i=p.useRef();i.current==null&&(i.current=zrA({window:e,v5Compat:!0}));let g=i.current,[I,n]=p.useState({action:g.action,location:g.location}),o=p.useCallback(a=>{p.startTransition(()=>n(a))},[n]);return p.useLayoutEffect(()=>g.listen(o),[g,o]),p.createElement(qsA,{basename:t,children:A,location:I.location,navigationType:I.action,navigator:g})}var ZX=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Yo=p.forwardRef(function({onClick:A,discover:e="render",prefetch:i="none",relative:g,reloadDocument:I,replace:n,state:o,target:a,to:r,preventScrollReset:s,viewTransition:B,...c},E){let{basename:D}=p.useContext(wB),y=typeof r=="string"&&ZX.test(r),S,f=!1;if(typeof r=="string"&&y&&(S=r,jX))try{let R=new URL(window.location.href),G=r.startsWith("//")?new URL(R.protocol+r):new URL(r),J=sQ(G.pathname,D);G.origin===R.origin&&J!=null?r=J+G.search+G.hash:f=!0}catch{sC(!1,`<Link to="${r}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let M=ysA(r,{relative:g}),[k,m,U]=ICA(i,c),F=lCA(r,{replace:n,state:o,target:a,preventScrollReset:s,relative:g,viewTransition:B});function b(R){A&&A(R),R.defaultPrevented||F(R)}let K=p.createElement("a",{...c,...U,href:S||M,onClick:f||I?A:b,ref:rCA(E,m),target:a,"data-discover":!y&&e==="render"?"true":void 0});return k&&!y?p.createElement(p.Fragment,null,K,p.createElement(nCA,{page:M})):K});Yo.displayName="Link";var CCA=p.forwardRef(function({"aria-current":A="page",caseSensitive:e=!1,className:i="",end:g=!1,style:I,to:n,viewTransition:o,children:a,...r},s){let B=pk(n,{relative:r.relative}),c=ln(),E=p.useContext(QF),{navigator:D,basename:y}=p.useContext(wB),S=E!=null&&dCA(B)&&o===!0,f=D.encodeLocation?D.encodeLocation(B).pathname:B.pathname,M=c.pathname,k=E&&E.navigation&&E.navigation.location?E.navigation.location.pathname:null;e||(M=M.toLowerCase(),k=k?k.toLowerCase():null,f=f.toLowerCase()),k&&y&&(k=sQ(k,y)||k);const m=f!=="/"&&f.endsWith("/")?f.length-1:f.length;let U=M===f||!g&&M.startsWith(f)&&M.charAt(m)==="/",F=k!=null&&(k===f||!g&&k.startsWith(f)&&k.charAt(f.length)==="/"),b={isActive:U,isPending:F,isTransitioning:S},K=U?A:void 0,R;typeof i=="function"?R=i(b):R=[i,U?"active":null,F?"pending":null,S?"transitioning":null].filter(Boolean).join(" ");let G=typeof I=="function"?I(b):I;return p.createElement(Yo,{...r,"aria-current":K,className:R,ref:s,style:G,to:n,viewTransition:o},typeof a=="function"?a(b):a)});CCA.displayName="NavLink";var BCA=p.forwardRef(({discover:t="render",fetcherKey:A,navigate:e,reloadDocument:i,replace:g,state:I,method:n=gR,action:o,onSubmit:a,relative:r,preventScrollReset:s,viewTransition:B,...c},E)=>{let D=uCA(),y=hCA(o,{relative:r}),S=n.toLowerCase()==="get"?"get":"post",f=typeof o=="string"&&ZX.test(o),M=k=>{if(a&&a(k),k.defaultPrevented)return;k.preventDefault();let m=k.nativeEvent.submitter,U=m?.getAttribute("formmethod")||n;D(m||k.currentTarget,{fetcherKey:A,method:U,navigate:e,replace:g,state:I,relative:r,preventScrollReset:s,viewTransition:B})};return p.createElement("form",{ref:E,method:S,action:y,onSubmit:i?a:M,...c,"data-discover":!f&&t==="render"?"true":void 0})});BCA.displayName="Form";function cCA(t){return`${t} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function WX(t){let A=p.useContext(Ky);return KI(A,cCA(t)),A}function lCA(t,{target:A,replace:e,state:i,preventScrollReset:g,relative:I,viewTransition:n}={}){let o=Di(),a=ln(),r=pk(t,{relative:I});return p.useCallback(s=>{if(OsA(s,A)){s.preventDefault();let B=e!==void 0?e:g0(a)===g0(r);o(t,{replace:B,state:i,preventScrollReset:g,relative:I,viewTransition:n})}},[a,o,r,e,i,A,t,g,I,n])}function C2(t){sC(typeof URLSearchParams<"u","You cannot use the `useSearchParams` hook in a browser that does not support the URLSearchParams API. If you need to support Internet Explorer 11, we recommend you load a polyfill such as https://github.com/ungap/url-search-params.");let A=p.useRef(hx(t)),e=p.useRef(!1),i=ln(),g=p.useMemo(()=>PsA(i.search,e.current?null:A.current),[i.search]),I=Di(),n=p.useCallback((o,a)=>{const r=hx(typeof o=="function"?o(new URLSearchParams(g)):o);e.current=!0,I("?"+r,a)},[I,g]);return[g,n]}var QCA=0,ECA=()=>`__${String(++QCA)}__`;function uCA(){let{router:t}=WX("useSubmit"),{basename:A}=p.useContext(wB),e=vsA();return p.useCallback(async(i,g={})=>{let{action:I,method:n,encType:o,formData:a,body:r}=WsA(i,A);if(g.navigate===!1){let s=g.fetcherKey||ECA();await t.fetch(s,e,g.action||I,{preventScrollReset:g.preventScrollReset,formData:a,body:r,formMethod:g.method||n,formEncType:g.encType||o,flushSync:g.flushSync})}else await t.navigate(g.action||I,{preventScrollReset:g.preventScrollReset,formData:a,body:r,formMethod:g.method||n,formEncType:g.encType||o,replace:g.replace,state:g.state,fromRouteId:e,flushSync:g.flushSync,viewTransition:g.viewTransition})},[t,A,e])}function hCA(t,{relative:A}={}){let{basename:e}=p.useContext(wB),i=p.useContext(uC);KI(i,"useFormAction must be used inside a RouteContext");let[g]=i.matches.slice(-1),I={...pk(t||".",{relative:A})},n=ln();if(t==null){I.search=n.search;let o=new URLSearchParams(I.search),a=o.getAll("index");if(a.some(s=>s==="")){o.delete("index"),a.filter(B=>B).forEach(B=>o.append("index",B));let s=o.toString();I.search=s?`?${s}`:""}}return(!t||t===".")&&g.route.index&&(I.search=I.search?I.search.replace(/^\?/,"?index&"):"?index"),e!=="/"&&(I.pathname=I.pathname==="/"?e:eQ([e,I.pathname])),g0(I)}function dCA(t,{relative:A}={}){let e=p.useContext(LX);KI(e!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:i}=WX("useViewTransitionState"),g=pk(t,{relative:A});if(!e.isTransitioning)return!1;let I=sQ(e.currentLocation.pathname,i)||e.currentLocation.pathname,n=sQ(e.nextLocation.pathname,i)||e.nextLocation.pathname;return tU(g.pathname,n)!=null||tU(g.pathname,I)!=null}var Zc=FX();/*! Capacitor: https://capacitorjs.com/ - MIT License */var xD;(function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"})(xD||(xD={}));class r_ extends Error{constructor(A,e,i){super(A),this.message=A,this.code=e,this.data=i}}const pCA=t=>{var A,e;return t?.androidBridge?"android":!((e=(A=t?.webkit)===null||A===void 0?void 0:A.messageHandlers)===null||e===void 0)&&e.bridge?"ios":"web"},fCA=t=>{const A=t.CapacitorCustomPlatform||null,e=t.Capacitor||{},i=e.Plugins=e.Plugins||{},g=()=>A!==null?A.name:pCA(t),I=()=>g()!=="web",n=B=>{const c=r.get(B);return!!(c?.platforms.has(g())||o(B))},o=B=>{var c;return(c=e.PluginHeaders)===null||c===void 0?void 0:c.find(E=>E.name===B)},a=B=>t.console.error(B),r=new Map,s=(B,c={})=>{const E=r.get(B);if(E)return E.proxy;const D=g(),y=o(B);let S;const f=async()=>(!S&&D in c?S=typeof c[D]=="function"?S=await c[D]():S=c[D]:A!==null&&!S&&"web"in c&&(S=typeof c.web=="function"?S=await c.web():S=c.web),S),M=(K,R)=>{var G,J;if(y){const x=y?.methods.find(H=>R===H.name);if(x)return x.rtype==="promise"?H=>e.nativePromise(B,R.toString(),H):(H,P)=>e.nativeCallback(B,R.toString(),H,P);if(K)return(G=K[R])===null||G===void 0?void 0:G.bind(K)}else{if(K)return(J=K[R])===null||J===void 0?void 0:J.bind(K);throw new r_(`"${B}" plugin is not implemented on ${D}`,xD.Unimplemented)}},k=K=>{let R;const G=(...J)=>{const x=f().then(H=>{const P=M(H,K);if(P){const j=P(...J);return R=j?.remove,j}else throw new r_(`"${B}.${K}()" is not implemented on ${D}`,xD.Unimplemented)});return K==="addListener"&&(x.remove=async()=>R()),x};return G.toString=()=>`${K.toString()}() { [capacitor code] }`,Object.defineProperty(G,"name",{value:K,writable:!1,configurable:!1}),G},m=k("addListener"),U=k("removeListener"),F=(K,R)=>{const G=m({eventName:K},R),J=async()=>{const H=await G;U({eventName:K,callbackId:H},R)},x=new Promise(H=>G.then(()=>H({remove:J})));return x.remove=async()=>{await J()},x},b=new Proxy({},{get(K,R){switch(R){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return y?F:m;case"removeListener":return U;default:return k(R)}}});return i[B]=b,r.set(B,{name:B,proxy:b,platforms:new Set([...Object.keys(c),...y?[D]:[]])}),b};return e.convertFileSrc||(e.convertFileSrc=B=>B),e.getPlatform=g,e.handleError=a,e.isNativePlatform=I,e.isPluginAvailable=n,e.registerPlugin=s,e.Exception=r_,e.DEBUG=!!e.DEBUG,e.isLoggingEnabled=!!e.isLoggingEnabled,e},DCA=t=>t.Capacitor=fCA(t),Li=DCA(typeof globalThis<"u"?globalThis:typeof self<"u"?self:typeof window<"u"?window:typeof global<"u"?global:{}),mB=Li.registerPlugin;class zX{constructor(){this.listeners={},this.retainedEventArguments={},this.windowListeners={}}addListener(A,e){let i=!1;this.listeners[A]||(this.listeners[A]=[],i=!0),this.listeners[A].push(e);const I=this.windowListeners[A];I&&!I.registered&&this.addWindowListener(I),i&&this.sendRetainedArgumentsForEvent(A);const n=async()=>this.removeListener(A,e);return Promise.resolve({remove:n})}async removeAllListeners(){this.listeners={};for(const A in this.windowListeners)this.removeWindowListener(this.windowListeners[A]);this.windowListeners={}}notifyListeners(A,e,i){const g=this.listeners[A];if(!g){if(i){let I=this.retainedEventArguments[A];I||(I=[]),I.push(e),this.retainedEventArguments[A]=I}return}g.forEach(I=>I(e))}hasListeners(A){var e;return!!(!((e=this.listeners[A])===null||e===void 0)&&e.length)}registerWindowListener(A,e){this.windowListeners[e]={registered:!1,windowEventName:A,pluginEventName:e,handler:i=>{this.notifyListeners(e,i)}}}unimplemented(A="not implemented"){return new Li.Exception(A,xD.Unimplemented)}unavailable(A="not available"){return new Li.Exception(A,xD.Unavailable)}async removeListener(A,e){const i=this.listeners[A];if(!i)return;const g=i.indexOf(e);this.listeners[A].splice(g,1),this.listeners[A].length||this.removeWindowListener(this.windowListeners[A])}addWindowListener(A){window.addEventListener(A.windowEventName,A.handler),A.registered=!0}removeWindowListener(A){A&&(window.removeEventListener(A.windowEventName,A.handler),A.registered=!1)}sendRetainedArgumentsForEvent(A){const e=this.retainedEventArguments[A];e&&(delete this.retainedEventArguments[A],e.forEach(i=>{this.notifyListeners(A,i)}))}}const e4=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),t4=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class yCA extends zX{async getCookies(){const A=document.cookie,e={};return A.split(";").forEach(i=>{if(i.length<=0)return;let[g,I]=i.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");g=t4(g).trim(),I=t4(I).trim(),e[g]=I}),e}async setCookie(A){try{const e=e4(A.key),i=e4(A.value),g=`; expires=${(A.expires||"").replace("expires=","")}`,I=(A.path||"/").replace("path=",""),n=A.url!=null&&A.url.length>0?`domain=${A.url}`:"";document.cookie=`${e}=${i||""}${g}; path=${I}; ${n};`}catch(e){return Promise.reject(e)}}async deleteCookie(A){try{document.cookie=`${A.key}=; Max-Age=0`}catch(e){return Promise.reject(e)}}async clearCookies(){try{const A=document.cookie.split(";")||[];for(const e of A)document.cookie=e.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(A){return Promise.reject(A)}}async clearAllCookies(){try{await this.clearCookies()}catch(A){return Promise.reject(A)}}}mB("CapacitorCookies",{web:()=>new yCA});const SCA=async t=>new Promise((A,e)=>{const i=new FileReader;i.onload=()=>{const g=i.result;A(g.indexOf(",")>=0?g.split(",")[1]:g)},i.onerror=g=>e(g),i.readAsDataURL(t)}),wCA=(t={})=>{const A=Object.keys(t);return Object.keys(t).map(g=>g.toLocaleLowerCase()).reduce((g,I,n)=>(g[I]=t[A[n]],g),{})},mCA=(t,A=!0)=>t?Object.entries(t).reduce((i,g)=>{const[I,n]=g;let o,a;return Array.isArray(n)?(a="",n.forEach(r=>{o=A?encodeURIComponent(r):r,a+=`${I}=${o}&`}),a.slice(0,-1)):(o=A?encodeURIComponent(n):n,a=`${I}=${o}`),`${i}&${a}`},"").substr(1):null,kCA=(t,A={})=>{const e=Object.assign({method:t.method||"GET",headers:t.headers},A),g=wCA(t.headers)["content-type"]||"";if(typeof t.data=="string")e.body=t.data;else if(g.includes("application/x-www-form-urlencoded")){const I=new URLSearchParams;for(const[n,o]of Object.entries(t.data||{}))I.set(n,o);e.body=I.toString()}else if(g.includes("multipart/form-data")||t.data instanceof FormData){const I=new FormData;if(t.data instanceof FormData)t.data.forEach((o,a)=>{I.append(a,o)});else for(const o of Object.keys(t.data))I.append(o,t.data[o]);e.body=I;const n=new Headers(e.headers);n.delete("content-type"),e.headers=n}else(g.includes("application/json")||typeof t.data=="object")&&(e.body=JSON.stringify(t.data));return e};class MCA extends zX{async request(A){const e=kCA(A,A.webFetchExtra),i=mCA(A.params,A.shouldEncodeUrlParams),g=i?`${A.url}?${i}`:A.url,I=await fetch(g,e),n=I.headers.get("content-type")||"";let{responseType:o="text"}=I.ok?A:{};n.includes("application/json")&&(o="json");let a,r;switch(o){case"arraybuffer":case"blob":r=await I.blob(),a=await SCA(r);break;case"json":a=await I.json();break;case"document":case"text":default:a=await I.text()}const s={};return I.headers.forEach((B,c)=>{s[c]=B}),{data:a,headers:s,status:I.status,url:I.url}}async get(A){return this.request(Object.assign(Object.assign({},A),{method:"GET"}))}async post(A){return this.request(Object.assign(Object.assign({},A),{method:"POST"}))}async put(A){return this.request(Object.assign(Object.assign({},A),{method:"PUT"}))}async patch(A){return this.request(Object.assign(Object.assign({},A),{method:"PATCH"}))}async delete(A){return this.request(Object.assign(Object.assign({},A),{method:"DELETE"}))}}mB("CapacitorHttp",{web:()=>new MCA});const NCA="modulepreload",GCA=function(t,A){return new URL(t,A).href},i4={},pi=function(A,e,i){let g=Promise.resolve();if(e&&e.length>0){let r=function(s){return Promise.all(s.map(B=>Promise.resolve(B).then(c=>({status:"fulfilled",value:c}),c=>({status:"rejected",reason:c}))))};const n=document.getElementsByTagName("link"),o=document.querySelector("meta[property=csp-nonce]"),a=o?.nonce||o?.getAttribute("nonce");g=r(e.map(s=>{if(s=GCA(s,i),s in i4)return;i4[s]=!0;const B=s.endsWith(".css"),c=B?'[rel="stylesheet"]':"";if(!!i)for(let y=n.length-1;y>=0;y--){const S=n[y];if(S.href===s&&(!B||S.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${s}"]${c}`))return;const D=document.createElement("link");if(D.rel=B?"stylesheet":NCA,B||(D.as="script"),D.crossOrigin="",D.href=s,a&&D.setAttribute("nonce",a),document.head.appendChild(D),B)return new Promise((y,S)=>{D.addEventListener("load",y),D.addEventListener("error",()=>S(new Error(`Unable to preload CSS for ${s}`)))})}))}function I(n){const o=new Event("vite:preloadError",{cancelable:!0});if(o.payload=n,window.dispatchEvent(o),!o.defaultPrevented)throw n}return g.then(n=>{for(const o of n||[])o.status==="rejected"&&I(o.reason);return A().catch(I)})},I0=mB("SocialLogin",{web:()=>pi(()=>import("./web-CJwEetko.js"),[],import.meta.url).then(t=>new t.SocialLoginWeb)});var RCA={};const UCA={SOCKET:{NEEDS_PREMIUM:"premium_membership_required"}},KCA=(()=>{try{if(typeof window>"u")return!1;const t=(window.location?.protocol||"").toLowerCase();return t==="capacitor:"||t==="ionic:"}catch{return!1}})(),FCA=(()=>{try{if(typeof window>"u")return!1;const t=window.location?.hostname||"";return t==="localhost"||t==="127.0.0.1"}catch{return!1}})();function bCA(){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 n0=(()=>{const t=bCA();return t||(KCA?"https://dicelounge.app":FCA?"http://localhost:4000":"https://dicelounge.app")})(),vCA=globalThis?.APP_TARGET,_CA=typeof process<"u"?RCA?.APP_TARGET:void 0;let dx;try{dx="ceelo"}catch{dx=void 0}const JCA=vCA??_CA??dx,_r=JCA??"unified",s_=_r==="ceelo",nd=_r==="craps",od=_r==="poker",uF=_r==="skills",bh=_r==="unified",LCA="rcb_eaWheJLZtWHJDCzyjruqCITeZlrK",g4={ceelo:"goog_TshzudibKBufFkwSWOodGwQAzMI",craps:"goog_FJlwnXjmdmVYKAbOkaiNyICWjkd",poker:"goog_AwODgwTGrKmYPFStHgslgZENzyG",unified:"goog_TshzudibKBufFkwSWOodGwQAzMI",skills:"goog_iGrdhumdjhzgNbIWxdHFjChutDX",zentara:"goog_TshzudibKBufFkwSWOodGwQAzMI"},qCA=g4[_r]??g4.ceelo,I4={ceelo:"appl_YhZbXhNlphlrxochELLsdNJajdp",craps:"appl_uCBrYNXSOUzHdUNnkbfMaNxBxXI",poker:"appl_SKqhTdSJqfYQQGUjeFYzVZoSBqA",skills:"appl_OSFruGMgnsBocgEzWxpUyLYtskV",zentara:"appl_YhZbXhNlphlrxochELLsdNJajdp",unified:"appl_YhZbXhNlphlrxochELLsdNJajdp"},xCA=I4[_r]??I4.ceelo,TCA="true",VX="default",YCA="com.zentaraone.ceeloLounge.chips",XX=YCA,HCA="com.zentaraone.ceeloLounge.chips1000",OCA="com.zentaraone.crapsLounge.chips_1000",PCA="com.zentaraone.pokerLounge.chips_1000",$X=nd?OCA:od?PCA:HCA,jCA="",B2="Premium",ZCA="AIzaSyCmll0lLOqadkCyjlrM-bb5H4n1L8eMxkE",WCA="dice-lounge.firebaseapp.com",zCA="dice-lounge",VCA="1:423374558927:web:283377221554368e57c9ba",XCA="G-MYPNJQR9RN",$CA="dicelounge.app",ABA="PEcc15f3HTqKKafnvHp1yRrbxrS8ji1kzZ4dyS4R+fI=",eBA="193765381581-rucls0d90bmpkqaj0ginhp87chgjq70j.apps.googleusercontent.com",hF="193765381581-s0a3p66cb39cdfum20jrm0d2e87jmlu8.apps.googleusercontent.com",tBA=hF,iBA=hF,gBA=hF,IBA=nd?tBA:od?iBA:uF?gBA:hF,nBA="com.zentaraone.ceeloLounge.service",oBA="com.zentaraone.crapsLounge.service",aBA="com.zentaraone.pokerLounge.service",rBA="com.zentaraone.skillslounge.service",sBA=nd?oBA:od?aBA:uF?rBA:nBA,CBA="https://dicelounge.app/api/auth/apple/callback",BBA="com.zentaraone.ceeloLounge",cBA="com.zentaraone.crapsLounge",lBA="com.zentaraone.pokerLounge",QBA="com.zentaraone.skillslounge",EBA=nd?cBA:od?lBA:uF?QBA:BBA,n4={ceelo:"ca-app-pub-4219446894372985/2712849620",craps:"ca-app-pub-4219446894372985/4123145978",poker:"ca-app-pub-4219446894372985/6524920361",skills:"ca-app-pub-4219446894372985/7770618032",zentara:"ca-app-pub-4219446894372985/2712849620",unified:"ca-app-pub-4219446894372985/2712849620"},o4={ceelo:"ca-app-pub-4219446894372985/9898216833",craps:"ca-app-pub-4219446894372985/2585675356",poker:"ca-app-pub-4219446894372985/5810604494",skills:"ca-app-pub-4219446894372985/2727665607",zentara:"ca-app-pub-4219446894372985/9898216833",unified:"ca-app-pub-4219446894372985/9898216833"},uBA=n4[_r]??n4.ceelo,a4=o4[_r]??o4.ceelo,r4={ceelo:"ca-app-pub-4219446894372985/3451216225",craps:"ca-app-pub-4219446894372985/9366706127",poker:"ca-app-pub-4219446894372985/4109691778",skills:"ca-app-pub-4219446894372985/6006474652",zentara:"ca-app-pub-4219446894372985/3451216225",unified:"ca-app-pub-4219446894372985/3451216225"},s4={ceelo:"ca-app-pub-4219446894372985/2394103660",craps:"ca-app-pub-4219446894372985/5020267007",poker:"ca-app-pub-4219446894372985/8389694041",skills:"ca-app-pub-4219446894372985/2073059481",zentara:"ca-app-pub-4219446894372985/2394103660",unified:"ca-app-pub-4219446894372985/2394103660"},hBA=r4[_r]??r4.ceelo,C4=s4[_r]??s4.ceelo,Wf=100,B4=30,A6=3,e6=3,Am=6e4,em=0,dF=mB("SecureStoragePlugin",{web:()=>pi(()=>import("./web-D2nJFpsx.js"),[],import.meta.url).then(t=>new t.SecureStoragePluginWeb)}),dBA=Object.freeze(Object.defineProperty({__proto__:null,SecureStoragePlugin:dF},Symbol.toStringTag,{value:"Module"})),nr=mB("Preferences",{web:()=>pi(()=>import("./web-CV94570M.js"),[],import.meta.url).then(t=>new t.PreferencesWeb)}),iC=Object.freeze(Object.defineProperty({__proto__:null,Preferences:nr},Symbol.toStringTag,{value:"Module"})),lN="sess:";async function c4(t){const{value:A}=await nr.get({key:t});return A??null}async function l4(t,A){await nr.set({key:t,value:A})}async function C_(t){await nr.remove({key:t})}const EB={async get(t){return c4(t)},async set(t,A){await l4(t,A)},async remove(t){await C_(t)},async setSession(t,A){await l4(lN+t,A)},async getSession(t){return c4(lN+t)},async removeSession(t){return C_(lN+t)},async clearSessionKeys(){try{const A=(await nr.keys()).keys?.filter(e=>e.startsWith(lN))||[];await Promise.all(A.map(e=>C_(e)))}catch{}}};async function TD(t){try{const A=await EB.getSession(t);return A?JSON.parse(A):null}catch{return null}}async function pF(t,A){try{await EB.setSession(t,JSON.stringify(A))}catch{}}async function YD(t){try{await EB.removeSession(t)}catch{}}const HD="session_token",c2=Li.isNativePlatform();async function dd(t){c2?await dF.set({key:HD,value:t}):await EB.setSession(HD,t)}async function Nn(){if(c2)try{const{value:A}=await dF.get({key:HD});return A||void 0}catch{return}return await EB.getSession(HD)||void 0}async function Hd(){if(c2)try{await dF.remove({key:HD})}catch{}else await EB.removeSession(HD)}const pBA=Object.freeze(Object.defineProperty({__proto__:null,clearToken:Hd,getToken:Nn,setToken:dd},Symbol.toStringTag,{value:"Module"})),Bf={done:!1};function Q4(t){if(!t)return"";const A=String(t);return A.length<=12?A:`${A.slice(0,6)}…${A.slice(-6)}`}async function fBA(){const t=Li.getPlatform(),A={mode:"online"},e=eBA,i=IBA;A.clientId=e,A.webClientId=e,A.mode="online",A.iOSClientId=i;const g={mode:"online"},I=t==="ios"?EBA:sBA,n=CBA;g.clientId=I,t!=="ios"&&n&&(g.redirectUrl=n),Q4(e),Q4(i),await I0.initialize({...Object.keys(A).length?{google:A}:{},...Object.keys(g).length?{apple:g}:{}})}async function OD(t=!1){if(!(!t&&Bf.done)){if(!t&&Bf.promise)return Bf.promise;Bf.promise=fBA().then(()=>{Bf.done=!0}).catch(A=>{throw Bf.promise=void 0,A})}}async function t6(){try{await OD()}catch{}}function DBA(){try{const t=Li.getPlatform();if(t==="ios"||t==="android")return!0;const A=typeof window<"u"?window:{};return A.Capacitor?.isNativePlatform?!!A.Capacitor.isNativePlatform:!!A.webkit?.messageHandlers}catch{return!1}}async function yBA(){await OD(!0);const A=Li.getPlatform()==="android"?{}:{scopes:["email","name"]},e=await I0.login({provider:"apple",options:A}),i=e?.result?.idToken,g=e?.result?.profile,I=g?.email||void 0,n=g?.givenName||g?.name?.split(" ")?.[0],o=g?.familyName||g?.name?.split(" ")?.slice(1)?.join(" "),a=[n,o].filter(Boolean).join(" ").trim()||g?.name||void 0;if(!i)throw new Error("Apple did not return an id token");return{provider:"apple",idToken:i,email:I,name:a}}async function SBA(){await OD(!0);try{const A=Li.getPlatform()==="android"?{}:{scopes:["email","profile"]},e=await I0.login({provider:"google",options:A});e?.result,e&&typeof e=="object"&&Object.keys(e),e?.result&&Object.keys(e.result);const i=e?.result?.idToken,g=e?.result?.profile,I=g?.email||void 0,n=g?.name||[g?.givenName,g?.familyName].filter(Boolean).join(" ").trim()||void 0;if(!i)throw new Error("Google did not return an id token");return{provider:"google",idToken:i,email:I,name:n}}catch(t){const A=t;Object.prototype.toString.call(A),A?.message,A?.name,A?.code,A?.status;const e=String(A?.message||"").toLowerCase();if(e.includes("developer console")||e.includes("config")||e.includes("clientid")||A?.code===28444)try{await OD(!0);const i=Li.getPlatform(),g=await I0.login({provider:"google",options:i==="android"?{}:{scopes:["email","profile"]}});g?.result;const I=g?.result?.idToken,n=g?.result?.profile,o=n?.email||void 0,a=n?.name||[n?.givenName,n?.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:o,name:a}}catch{}throw A}}async function wBA(t,A){try{await OD()}catch{}try{await I0.logout({provider:t})}catch{}try{await new Promise(e=>setTimeout(e,120)),await OD(!0)}catch{}if(A?.clearLocal!==!1)try{await Hd()}catch{}}const iU={isNativePlatform:DBA,signInWithAppleNative:yBA,signInWithGoogleNative:SBA,signOut:wBA,prewarmNativeAuth:t6};let sc;function mBA(){try{const t=Li?.getPlatform?.();if(t)return t==="android"}catch{}try{return typeof navigator<"u"&&/Android/i.test(navigator.userAgent)}catch{return!1}}function kBA(){try{const t=Li?.getPlatform?.();if(t)return t==="ios"}catch{}try{return typeof navigator<"u"&&/iPhone|iPad|iPod/i.test(navigator.userAgent)}catch{return!1}}function MBA(){try{const t=Li?.getPlatform?.();return t&&["ios","android"].includes(t)?!0:!!window.Capacitor?.isNativePlatform?.()}catch{return!1}}function NBA(){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 Ea(){if(sc)return sc;const t=mBA(),A=kBA(),e=MBA();if(t||A&&e)return sc="https://dicelounge.app",sc;let i=null;if(!t&&!(A&&e)&&(i=NBA()),i)return sc=i,sc;let g=!1;try{const I=window.location?.hostname;g=I==="localhost"||I==="127.0.0.1"}catch{}return g&&!(A&&e)?(sc="http://localhost:4000",sc):(sc="https://dicelounge.app",sc)}const vE=Ea();let vh=null,zf=0,Vf=null;const GBA=1e4;async function fF(t){const A=t?.force===!0,e=t?.signal;return!A&&vh&&Date.now()-zf<GBA?vh:!A&&Vf?Vf:(Vf=(async()=>{try{let I=!1;try{I=!!iU.isNativePlatform?.()}catch{I=!1}let n=null;try{n=await Nn()??null}catch{n=null}if(!A&&!n)return null;const o=!!n,a={Accept:"application/json"};o&&n&&(a.Authorization=`Bearer ${n}`);const r=await fetch(`${vE}/api/auth/me`,{credentials:"include",headers:a,signal:e});if(r.ok){const s=await r.json();if(vh=s,zf=Date.now(),s?.dailyGrant?.granted&&s.dailyGrant.amount)try{window.dispatchEvent(new CustomEvent("daily-grant",{detail:{amount:s.dailyGrant.amount}}))}catch{}return s}if(r.status===204)return vh=null,zf=Date.now(),null;if(r.status===401){if(!o&&n){const s=await fetch(`${vE}/api/auth/me`,{credentials:"include",headers:{Accept:"application/json",Authorization:`Bearer ${n}`},signal:e});if(s.ok){const B=await s.json();return vh=B,zf=Date.now(),B}if(s.status===401)try{await Hd()}catch{}}return vh=null,zf=Date.now(),null}return null}catch(I){return I?.name==="AbortError",null}})().finally(()=>{Vf=null}),await Vf)}async function nR(t){let A=null;try{A=await Nn()??null}catch{A=null}try{await fetch(`${vE}/api/auth/logout`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...A?{Authorization:`Bearer ${A}`}:{}},body:JSON.stringify({email:t})})}catch{}try{await Hd()}catch{}try{vh=null,zf=0,Vf=null}catch{}}async function RBA(t){return(await fetch(`${vE}/api/auth/verify-app?token=${encodeURIComponent(t)}`,{method:"GET",credentials:"include"})).json()}async function UBA(t){try{if(iU.isNativePlatform())throw new Error("startOAuth is not allowed on native")}catch{}try{const A=await fetch(`${vE}/api/auth/${t}`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(A.ok){const e=await A.json().catch(()=>({ok:!1}));if(e?.ok&&e?.url)return window.location.assign(e.url),{ok:!0,url:e.url}}return window.location.assign(`${vE}/api/auth/${t}`),{ok:!1}}catch{try{window.location.assign(`${vE}/api/auth/${t}`)}catch{}return{ok:!1}}}async function KBA(){try{const t=await fetch(`${vE}/api/auth/guest`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(!t.ok)return{ok:!1};const A=await t.json().catch(()=>({ok:!1}));return{ok:!!A?.ok,token:A?.token}}catch{return{ok:!1}}}var FBA={};let B_=!1,PD=null,cf=null;function bBA(){return{apiKey:ZCA,authDomain:WCA,projectId:zCA,appId:VCA,measurementId:XCA}}function pm(){return typeof window<"u"&&typeof document<"u"}function i6(){if(!pm())return!1;if(cf!==null)return cf;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 cf=!0}catch{}return cf=!1}function fm(...t){i6()}async function l2(){if(B_||!pm())return;try{if(typeof navigator<"u"&&/jsdom|playwright/i.test(navigator.userAgent||"")||typeof window<"u"&&window.__E2E===!0||typeof process<"u"&&(FBA.VITEST||!1)){B_=!0,fm("skip:init (test env heuristic)");return}}catch{}const t=bBA();try{const[{initializeApp:A},{getAnalytics:e}]=await Promise.all([pi(()=>import("./index.esm-t-I0eIE7.js"),__vite__mapDeps([0,1]),import.meta.url),pi(()=>import("./index.esm-DslbCide.js"),__vite__mapDeps([2,1,3]),import.meta.url)]),i=A({apiKey:t.apiKey,authDomain:t.authDomain,projectId:t.projectId,appId:t.appId,measurementId:t.measurementId});PD=e(i),fm("init:ok",{measurementId:t.measurementId})}catch(A){PD=null,fm("init:fail",{error:A?.message||String(A)})}finally{B_=!0}}function jD(t,A){if(PD)try{pi(async()=>{const{logEvent:e}=await import("./index.esm-DslbCide.js");return{logEvent:e}},__vite__mapDeps([2,1,3]),import.meta.url).then(({logEvent:e})=>{const i=A||{};i6()&&(i.debug_mode=!0);try{e(PD,t,i),fm("event",{eventName:t,params:i})}catch{}})}catch{}}function Kr(t,A){const e=pm()?window.location.href:void 0,i=t??(pm()?window.location.pathname:void 0),g=pm()?document.title:void 0;jD("page_view",{page_location:e,page_path:i,page_title:g})}function c_(t){!PD||!t||pi(async()=>{const{setUserId:A}=await import("./index.esm-DslbCide.js");return{setUserId:A}},__vite__mapDeps([2,1,3]),import.meta.url).then(({setUserId:A})=>{try{A(PD,t)}catch{}fm("userId:set",{userId:t})})}async function vBA(t){const A=new Set([]);try{await nr.clear()}catch{}try{if(typeof window<"u"){try{const e={};if(A.size>0)for(let i=0;i<window.localStorage.length;i++){const g=window.localStorage.key(i);g&&A.has(g)&&(e[g]=window.localStorage.getItem(g))}if(window.localStorage.clear(),A.size>0)for(const i of Object.keys(e)){const g=e[i];g!=null&&window.localStorage.setItem(i,g)}}catch{}try{window.sessionStorage.clear()}catch{}}}catch{}}const Hc=Object.create(null);Hc.open="0";Hc.close="1";Hc.ping="2";Hc.pong="3";Hc.message="4";Hc.upgrade="5";Hc.noop="6";const oR=Object.create(null);Object.keys(Hc).forEach(t=>{oR[Hc[t]]=t});const px={type:"error",data:"parser error"},g6=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",I6=typeof ArrayBuffer=="function",n6=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t&&t.buffer instanceof ArrayBuffer,Q2=({type:t,data:A},e,i)=>g6&&A instanceof Blob?e?i(A):E4(A,i):I6&&(A instanceof ArrayBuffer||n6(A))?e?i(A):E4(new Blob([A]),i):i(Hc[t]+(A||"")),E4=(t,A)=>{const e=new FileReader;return e.onload=function(){const i=e.result.split(",")[1];A("b"+(i||""))},e.readAsDataURL(t)};function u4(t){return t instanceof Uint8Array?t:t instanceof ArrayBuffer?new Uint8Array(t):new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}let l_;function _BA(t,A){if(g6&&t.data instanceof Blob)return t.data.arrayBuffer().then(u4).then(A);if(I6&&(t.data instanceof ArrayBuffer||n6(t.data)))return A(u4(t.data));Q2(t,!1,e=>{l_||(l_=new TextEncoder),A(l_.encode(e))})}const h4="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",tm=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let t=0;t<h4.length;t++)tm[h4.charCodeAt(t)]=t;const JBA=t=>{let A=t.length*.75,e=t.length,i,g=0,I,n,o,a;t[t.length-1]==="="&&(A--,t[t.length-2]==="="&&A--);const r=new ArrayBuffer(A),s=new Uint8Array(r);for(i=0;i<e;i+=4)I=tm[t.charCodeAt(i)],n=tm[t.charCodeAt(i+1)],o=tm[t.charCodeAt(i+2)],a=tm[t.charCodeAt(i+3)],s[g++]=I<<2|n>>4,s[g++]=(n&15)<<4|o>>2,s[g++]=(o&3)<<6|a&63;return r},LBA=typeof ArrayBuffer=="function",E2=(t,A)=>{if(typeof t!="string")return{type:"message",data:o6(t,A)};const e=t.charAt(0);return e==="b"?{type:"message",data:qBA(t.substring(1),A)}:oR[e]?t.length>1?{type:oR[e],data:t.substring(1)}:{type:oR[e]}:px},qBA=(t,A)=>{if(LBA){const e=JBA(t);return o6(e,A)}else return{base64:!0,data:t}},o6=(t,A)=>{switch(A){case"blob":return t instanceof Blob?t:new Blob([t]);case"arraybuffer":default:return t instanceof ArrayBuffer?t:t.buffer}},a6="",xBA=(t,A)=>{const e=t.length,i=new Array(e);let g=0;t.forEach((I,n)=>{Q2(I,!1,o=>{i[n]=o,++g===e&&A(i.join(a6))})})},TBA=(t,A)=>{const e=t.split(a6),i=[];for(let g=0;g<e.length;g++){const I=E2(e[g],A);if(i.push(I),I.type==="error")break}return i};function YBA(){return new TransformStream({transform(t,A){_BA(t,e=>{const i=e.length;let g;if(i<126)g=new Uint8Array(1),new DataView(g.buffer).setUint8(0,i);else if(i<65536){g=new Uint8Array(3);const I=new DataView(g.buffer);I.setUint8(0,126),I.setUint16(1,i)}else{g=new Uint8Array(9);const I=new DataView(g.buffer);I.setUint8(0,127),I.setBigUint64(1,BigInt(i))}t.data&&typeof t.data!="string"&&(g[0]|=128),A.enqueue(g),A.enqueue(e)})}})}let Q_;function QN(t){return t.reduce((A,e)=>A+e.length,0)}function EN(t,A){if(t[0].length===A)return t.shift();const e=new Uint8Array(A);let i=0;for(let g=0;g<A;g++)e[g]=t[0][i++],i===t[0].length&&(t.shift(),i=0);return t.length&&i<t[0].length&&(t[0]=t[0].slice(i)),e}function HBA(t,A){Q_||(Q_=new TextDecoder);const e=[];let i=0,g=-1,I=!1;return new TransformStream({transform(n,o){for(e.push(n);;){if(i===0){if(QN(e)<1)break;const a=EN(e,1);I=(a[0]&128)===128,g=a[0]&127,g<126?i=3:g===126?i=1:i=2}else if(i===1){if(QN(e)<2)break;const a=EN(e,2);g=new DataView(a.buffer,a.byteOffset,a.length).getUint16(0),i=3}else if(i===2){if(QN(e)<8)break;const a=EN(e,8),r=new DataView(a.buffer,a.byteOffset,a.length),s=r.getUint32(0);if(s>Math.pow(2,21)-1){o.enqueue(px);break}g=s*Math.pow(2,32)+r.getUint32(4),i=3}else{if(QN(e)<g)break;const a=EN(e,g);o.enqueue(E2(I?a:Q_.decode(a),A)),i=0}if(g===0||g>t){o.enqueue(px);break}}}})}const r6=4;function Gn(t){if(t)return OBA(t)}function OBA(t){for(var A in Gn.prototype)t[A]=Gn.prototype[A];return t}Gn.prototype.on=Gn.prototype.addEventListener=function(t,A){return this._callbacks=this._callbacks||{},(this._callbacks["$"+t]=this._callbacks["$"+t]||[]).push(A),this};Gn.prototype.once=function(t,A){function e(){this.off(t,e),A.apply(this,arguments)}return e.fn=A,this.on(t,e),this};Gn.prototype.off=Gn.prototype.removeListener=Gn.prototype.removeAllListeners=Gn.prototype.removeEventListener=function(t,A){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var e=this._callbacks["$"+t];if(!e)return this;if(arguments.length==1)return delete this._callbacks["$"+t],this;for(var i,g=0;g<e.length;g++)if(i=e[g],i===A||i.fn===A){e.splice(g,1);break}return e.length===0&&delete this._callbacks["$"+t],this};Gn.prototype.emit=function(t){this._callbacks=this._callbacks||{};for(var A=new Array(arguments.length-1),e=this._callbacks["$"+t],i=1;i<arguments.length;i++)A[i-1]=arguments[i];if(e){e=e.slice(0);for(var i=0,g=e.length;i<g;++i)e[i].apply(this,A)}return this};Gn.prototype.emitReserved=Gn.prototype.emit;Gn.prototype.listeners=function(t){return this._callbacks=this._callbacks||{},this._callbacks["$"+t]||[]};Gn.prototype.hasListeners=function(t){return!!this.listeners(t).length};const DF=typeof Promise=="function"&&typeof Promise.resolve=="function"?A=>Promise.resolve().then(A):(A,e)=>e(A,0),tC=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),PBA="arraybuffer";function s6(t,...A){return A.reduce((e,i)=>(t.hasOwnProperty(i)&&(e[i]=t[i]),e),{})}const jBA=tC.setTimeout,ZBA=tC.clearTimeout;function yF(t,A){A.useNativeTimers?(t.setTimeoutFn=jBA.bind(tC),t.clearTimeoutFn=ZBA.bind(tC)):(t.setTimeoutFn=tC.setTimeout.bind(tC),t.clearTimeoutFn=tC.clearTimeout.bind(tC))}const WBA=1.33;function zBA(t){return typeof t=="string"?VBA(t):Math.ceil((t.byteLength||t.size)*WBA)}function VBA(t){let A=0,e=0;for(let i=0,g=t.length;i<g;i++)A=t.charCodeAt(i),A<128?e+=1:A<2048?e+=2:A<55296||A>=57344?e+=3:(i++,e+=4);return e}function C6(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function XBA(t){let A="";for(let e in t)t.hasOwnProperty(e)&&(A.length&&(A+="&"),A+=encodeURIComponent(e)+"="+encodeURIComponent(t[e]));return A}function $BA(t){let A={},e=t.split("&");for(let i=0,g=e.length;i<g;i++){let I=e[i].split("=");A[decodeURIComponent(I[0])]=decodeURIComponent(I[1])}return A}class AcA extends Error{constructor(A,e,i){super(A),this.description=e,this.context=i,this.type="TransportError"}}class u2 extends Gn{constructor(A){super(),this.writable=!1,yF(this,A),this.opts=A,this.query=A.query,this.socket=A.socket,this.supportsBinary=!A.forceBase64}onError(A,e,i){return super.emitReserved("error",new AcA(A,e,i)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(A){this.readyState==="open"&&this.write(A)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(A){const e=E2(A,this.socket.binaryType);this.onPacket(e)}onPacket(A){super.emitReserved("packet",A)}onClose(A){this.readyState="closed",super.emitReserved("close",A)}pause(A){}createUri(A,e={}){return A+"://"+this._hostname()+this._port()+this.opts.path+this._query(e)}_hostname(){const A=this.opts.hostname;return A.indexOf(":")===-1?A:"["+A+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(A){const e=XBA(A);return e.length?"?"+e:""}}class ecA extends u2{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(A){this.readyState="pausing";const e=()=>{this.readyState="paused",A()};if(this._polling||!this.writable){let i=0;this._polling&&(i++,this.once("pollComplete",function(){--i||e()})),this.writable||(i++,this.once("drain",function(){--i||e()}))}else e()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(A){const e=i=>{if(this.readyState==="opening"&&i.type==="open"&&this.onOpen(),i.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(i)};TBA(A,this.socket.binaryType).forEach(e),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const A=()=>{this.write([{type:"close"}])};this.readyState==="open"?A():this.once("open",A)}write(A){this.writable=!1,xBA(A,e=>{this.doWrite(e,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const A=this.opts.secure?"https":"http",e=this.query||{};return this.opts.timestampRequests!==!1&&(e[this.opts.timestampParam]=C6()),!this.supportsBinary&&!e.sid&&(e.b64=1),this.createUri(A,e)}}let B6=!1;try{B6=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const tcA=B6;function icA(){}class gcA extends ecA{constructor(A){if(super(A),typeof location<"u"){const e=location.protocol==="https:";let i=location.port;i||(i=e?"443":"80"),this.xd=typeof location<"u"&&A.hostname!==location.hostname||i!==A.port}}doWrite(A,e){const i=this.request({method:"POST",data:A});i.on("success",e),i.on("error",(g,I)=>{this.onError("xhr post error",g,I)})}doPoll(){const A=this.request();A.on("data",this.onData.bind(this)),A.on("error",(e,i)=>{this.onError("xhr poll error",e,i)}),this.pollXhr=A}}let DD=class aR extends Gn{constructor(A,e,i){super(),this.createRequest=A,yF(this,i),this._opts=i,this._method=i.method||"GET",this._uri=e,this._data=i.data!==void 0?i.data:null,this._create()}_create(){var A;const e=s6(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");e.xdomain=!!this._opts.xd;const i=this._xhr=this.createRequest(e);try{i.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){i.setDisableHeaderCheck&&i.setDisableHeaderCheck(!0);for(let g in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(g)&&i.setRequestHeader(g,this._opts.extraHeaders[g])}}catch{}if(this._method==="POST")try{i.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{i.setRequestHeader("Accept","*/*")}catch{}(A=this._opts.cookieJar)===null||A===void 0||A.addCookies(i),"withCredentials"in i&&(i.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(i.timeout=this._opts.requestTimeout),i.onreadystatechange=()=>{var g;i.readyState===3&&((g=this._opts.cookieJar)===null||g===void 0||g.parseCookies(i.getResponseHeader("set-cookie"))),i.readyState===4&&(i.status===200||i.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof i.status=="number"?i.status:0)},0))},i.send(this._data)}catch(g){this.setTimeoutFn(()=>{this._onError(g)},0);return}typeof document<"u"&&(this._index=aR.requestsCount++,aR.requests[this._index]=this)}_onError(A){this.emitReserved("error",A,this._xhr),this._cleanup(!0)}_cleanup(A){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=icA,A)try{this._xhr.abort()}catch{}typeof document<"u"&&delete aR.requests[this._index],this._xhr=null}}_onLoad(){const A=this._xhr.responseText;A!==null&&(this.emitReserved("data",A),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};DD.requestsCount=0;DD.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",d4);else if(typeof addEventListener=="function"){const t="onpagehide"in tC?"pagehide":"unload";addEventListener(t,d4,!1)}}function d4(){for(let t in DD.requests)DD.requests.hasOwnProperty(t)&&DD.requests[t].abort()}const IcA=function(){const t=c6({xdomain:!1});return t&&t.responseType!==null}();class ncA extends gcA{constructor(A){super(A);const e=A&&A.forceBase64;this.supportsBinary=IcA&&!e}request(A={}){return Object.assign(A,{xd:this.xd},this.opts),new DD(c6,this.uri(),A)}}function c6(t){const A=t.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!A||tcA))return new XMLHttpRequest}catch{}if(!A)try{return new tC[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const l6=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class ocA extends u2{get name(){return"websocket"}doOpen(){const A=this.uri(),e=this.opts.protocols,i=l6?{}:s6(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(i.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(A,e,i)}catch(g){return this.emitReserved("error",g)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=A=>this.onClose({description:"websocket connection closed",context:A}),this.ws.onmessage=A=>this.onData(A.data),this.ws.onerror=A=>this.onError("websocket error",A)}write(A){this.writable=!1;for(let e=0;e<A.length;e++){const i=A[e],g=e===A.length-1;Q2(i,this.supportsBinary,I=>{try{this.doWrite(i,I)}catch{}g&&DF(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const A=this.opts.secure?"wss":"ws",e=this.query||{};return this.opts.timestampRequests&&(e[this.opts.timestampParam]=C6()),this.supportsBinary||(e.b64=1),this.createUri(A,e)}}const E_=tC.WebSocket||tC.MozWebSocket;class acA extends ocA{createSocket(A,e,i){return l6?new E_(A,e,i):e?new E_(A,e):new E_(A)}doWrite(A,e){this.ws.send(e)}}class rcA extends u2{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(A){return this.emitReserved("error",A)}this._transport.closed.then(()=>{this.onClose()}).catch(A=>{this.onError("webtransport error",A)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(A=>{const e=HBA(Number.MAX_SAFE_INTEGER,this.socket.binaryType),i=A.readable.pipeThrough(e).getReader(),g=YBA();g.readable.pipeTo(A.writable),this._writer=g.writable.getWriter();const I=()=>{i.read().then(({done:o,value:a})=>{o||(this.onPacket(a),I())}).catch(o=>{})};I();const n={type:"open"};this.query.sid&&(n.data=`{"sid":"${this.query.sid}"}`),this._writer.write(n).then(()=>this.onOpen())})})}write(A){this.writable=!1;for(let e=0;e<A.length;e++){const i=A[e],g=e===A.length-1;this._writer.write(i).then(()=>{g&&DF(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var A;(A=this._transport)===null||A===void 0||A.close()}}const scA={websocket:acA,webtransport:rcA,polling:ncA},CcA=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,BcA=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function fx(t){if(t.length>8e3)throw"URI too long";const A=t,e=t.indexOf("["),i=t.indexOf("]");e!=-1&&i!=-1&&(t=t.substring(0,e)+t.substring(e,i).replace(/:/g,";")+t.substring(i,t.length));let g=CcA.exec(t||""),I={},n=14;for(;n--;)I[BcA[n]]=g[n]||"";return e!=-1&&i!=-1&&(I.source=A,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=ccA(I,I.path),I.queryKey=lcA(I,I.query),I}function ccA(t,A){const e=/\/{2,9}/g,i=A.replace(e,"/").split("/");return(A.slice(0,1)=="/"||A.length===0)&&i.splice(0,1),A.slice(-1)=="/"&&i.splice(i.length-1,1),i}function lcA(t,A){const e={};return A.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(i,g,I){g&&(e[g]=I)}),e}const Dx=typeof addEventListener=="function"&&typeof removeEventListener=="function",rR=[];Dx&&addEventListener("offline",()=>{rR.forEach(t=>t())},!1);class _E extends Gn{constructor(A,e){if(super(),this.binaryType=PBA,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,A&&typeof A=="object"&&(e=A,A=null),A){const i=fx(A);e.hostname=i.host,e.secure=i.protocol==="https"||i.protocol==="wss",e.port=i.port,i.query&&(e.query=i.query)}else e.host&&(e.hostname=fx(e.host).host);yF(this,e),this.secure=e.secure!=null?e.secure:typeof location<"u"&&location.protocol==="https:",e.hostname&&!e.port&&(e.port=this.secure?"443":"80"),this.hostname=e.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=e.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},e.transports.forEach(i=>{const g=i.prototype.name;this.transports.push(g),this._transportsByName[g]=i}),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},e),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=$BA(this.opts.query)),Dx&&(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"})},rR.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(A){const e=Object.assign({},this.opts.query);e.EIO=r6,e.transport=A,this.id&&(e.sid=this.id);const i=Object.assign({},this.opts,{query:e,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[A]);return new this._transportsByName[A](i)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const A=this.opts.rememberUpgrade&&_E.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const e=this.createTransport(A);e.open(),this.setTransport(e)}setTransport(A){this.transport&&this.transport.removeAllListeners(),this.transport=A,A.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",e=>this._onClose("transport close",e))}onOpen(){this.readyState="open",_E.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(A){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",A),this.emitReserved("heartbeat"),A.type){case"open":this.onHandshake(JSON.parse(A.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const e=new Error("server error");e.code=A.data,this._onError(e);break;case"message":this.emitReserved("data",A.data),this.emitReserved("message",A.data);break}}onHandshake(A){this.emitReserved("handshake",A),this.id=A.sid,this.transport.query.sid=A.sid,this._pingInterval=A.pingInterval,this._pingTimeout=A.pingTimeout,this._maxPayload=A.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const A=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+A,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},A),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 A=this._getWritablePackets();this.transport.send(A),this._prevBufferLen=A.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let e=1;for(let i=0;i<this.writeBuffer.length;i++){const g=this.writeBuffer[i].data;if(g&&(e+=zBA(g)),i>0&&e>this._maxPayload)return this.writeBuffer.slice(0,i);e+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const A=Date.now()>this._pingTimeoutTime;return A&&(this._pingTimeoutTime=0,DF(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),A}write(A,e,i){return this._sendPacket("message",A,e,i),this}send(A,e,i){return this._sendPacket("message",A,e,i),this}_sendPacket(A,e,i,g){if(typeof e=="function"&&(g=e,e=void 0),typeof i=="function"&&(g=i,i=null),this.readyState==="closing"||this.readyState==="closed")return;i=i||{},i.compress=i.compress!==!1;const I={type:A,data:e,options:i};this.emitReserved("packetCreate",I),this.writeBuffer.push(I),g&&this.once("flush",g),this.flush()}close(){const A=()=>{this._onClose("forced close"),this.transport.close()},e=()=>{this.off("upgrade",e),this.off("upgradeError",e),A()},i=()=>{this.once("upgrade",e),this.once("upgradeError",e)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?i():A()}):this.upgrading?i():A()),this}_onError(A){if(_E.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",A),this._onClose("transport error",A)}_onClose(A,e){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(),Dx&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const i=rR.indexOf(this._offlineEventListener);i!==-1&&rR.splice(i,1)}this.readyState="closed",this.id=null,this.emitReserved("close",A,e),this.writeBuffer=[],this._prevBufferLen=0}}}_E.protocol=r6;class QcA extends _E{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let A=0;A<this._upgrades.length;A++)this._probe(this._upgrades[A])}_probe(A){let e=this.createTransport(A),i=!1;_E.priorWebsocketSuccess=!1;const g=()=>{i||(e.send([{type:"ping",data:"probe"}]),e.once("packet",B=>{if(!i)if(B.type==="pong"&&B.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",e),!e)return;_E.priorWebsocketSuccess=e.name==="websocket",this.transport.pause(()=>{i||this.readyState!=="closed"&&(s(),this.setTransport(e),e.send([{type:"upgrade"}]),this.emitReserved("upgrade",e),e=null,this.upgrading=!1,this.flush())})}else{const c=new Error("probe error");c.transport=e.name,this.emitReserved("upgradeError",c)}}))};function I(){i||(i=!0,s(),e.close(),e=null)}const n=B=>{const c=new Error("probe error: "+B);c.transport=e.name,I(),this.emitReserved("upgradeError",c)};function o(){n("transport closed")}function a(){n("socket closed")}function r(B){e&&B.name!==e.name&&I()}const s=()=>{e.removeListener("open",g),e.removeListener("error",n),e.removeListener("close",o),this.off("close",a),this.off("upgrading",r)};e.once("open",g),e.once("error",n),e.once("close",o),this.once("close",a),this.once("upgrading",r),this._upgrades.indexOf("webtransport")!==-1&&A!=="webtransport"?this.setTimeoutFn(()=>{i||e.open()},200):e.open()}onHandshake(A){this._upgrades=this._filterUpgrades(A.upgrades),super.onHandshake(A)}_filterUpgrades(A){const e=[];for(let i=0;i<A.length;i++)~this.transports.indexOf(A[i])&&e.push(A[i]);return e}}let EcA=class extends QcA{constructor(A,e={}){const i=typeof A=="object"?A:e;(!i.transports||i.transports&&typeof i.transports[0]=="string")&&(i.transports=(i.transports||["polling","websocket","webtransport"]).map(g=>scA[g]).filter(g=>!!g)),super(A,i)}};function ucA(t,A="",e){let i=t;e=e||typeof location<"u"&&location,t==null&&(t=e.protocol+"//"+e.host),typeof t=="string"&&(t.charAt(0)==="/"&&(t.charAt(1)==="/"?t=e.protocol+t:t=e.host+t),/^(https?|wss?):\/\//.test(t)||(typeof e<"u"?t=e.protocol+"//"+t:t="https://"+t),i=fx(t)),i.port||(/^(http|ws)$/.test(i.protocol)?i.port="80":/^(http|ws)s$/.test(i.protocol)&&(i.port="443")),i.path=i.path||"/";const I=i.host.indexOf(":")!==-1?"["+i.host+"]":i.host;return i.id=i.protocol+"://"+I+":"+i.port+A,i.href=i.protocol+"://"+I+(e&&e.port===i.port?"":":"+i.port),i}const hcA=typeof ArrayBuffer=="function",dcA=t=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(t):t.buffer instanceof ArrayBuffer,Q6=Object.prototype.toString,pcA=typeof Blob=="function"||typeof Blob<"u"&&Q6.call(Blob)==="[object BlobConstructor]",fcA=typeof File=="function"||typeof File<"u"&&Q6.call(File)==="[object FileConstructor]";function h2(t){return hcA&&(t instanceof ArrayBuffer||dcA(t))||pcA&&t instanceof Blob||fcA&&t instanceof File}function sR(t,A){if(!t||typeof t!="object")return!1;if(Array.isArray(t)){for(let e=0,i=t.length;e<i;e++)if(sR(t[e]))return!0;return!1}if(h2(t))return!0;if(t.toJSON&&typeof t.toJSON=="function"&&arguments.length===1)return sR(t.toJSON(),!0);for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)&&sR(t[e]))return!0;return!1}function DcA(t){const A=[],e=t.data,i=t;return i.data=yx(e,A),i.attachments=A.length,{packet:i,buffers:A}}function yx(t,A){if(!t)return t;if(h2(t)){const e={_placeholder:!0,num:A.length};return A.push(t),e}else if(Array.isArray(t)){const e=new Array(t.length);for(let i=0;i<t.length;i++)e[i]=yx(t[i],A);return e}else if(typeof t=="object"&&!(t instanceof Date)){const e={};for(const i in t)Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=yx(t[i],A));return e}return t}function ycA(t,A){return t.data=Sx(t.data,A),delete t.attachments,t}function Sx(t,A){if(!t)return t;if(t&&t._placeholder===!0){if(typeof t.num=="number"&&t.num>=0&&t.num<A.length)return A[t.num];throw new Error("illegal attachments")}else if(Array.isArray(t))for(let e=0;e<t.length;e++)t[e]=Sx(t[e],A);else if(typeof t=="object")for(const e in t)Object.prototype.hasOwnProperty.call(t,e)&&(t[e]=Sx(t[e],A));return t}const ScA=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],wcA=5;var cg;(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"})(cg||(cg={}));class mcA{constructor(A){this.replacer=A}encode(A){return(A.type===cg.EVENT||A.type===cg.ACK)&&sR(A)?this.encodeAsBinary({type:A.type===cg.EVENT?cg.BINARY_EVENT:cg.BINARY_ACK,nsp:A.nsp,data:A.data,id:A.id}):[this.encodeAsString(A)]}encodeAsString(A){let e=""+A.type;return(A.type===cg.BINARY_EVENT||A.type===cg.BINARY_ACK)&&(e+=A.attachments+"-"),A.nsp&&A.nsp!=="/"&&(e+=A.nsp+","),A.id!=null&&(e+=A.id),A.data!=null&&(e+=JSON.stringify(A.data,this.replacer)),e}encodeAsBinary(A){const e=DcA(A),i=this.encodeAsString(e.packet),g=e.buffers;return g.unshift(i),g}}function p4(t){return Object.prototype.toString.call(t)==="[object Object]"}class d2 extends Gn{constructor(A){super(),this.reviver=A}add(A){let e;if(typeof A=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");e=this.decodeString(A);const i=e.type===cg.BINARY_EVENT;i||e.type===cg.BINARY_ACK?(e.type=i?cg.EVENT:cg.ACK,this.reconstructor=new kcA(e),e.attachments===0&&super.emitReserved("decoded",e)):super.emitReserved("decoded",e)}else if(h2(A)||A.base64)if(this.reconstructor)e=this.reconstructor.takeBinaryData(A),e&&(this.reconstructor=null,super.emitReserved("decoded",e));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+A)}decodeString(A){let e=0;const i={type:Number(A.charAt(0))};if(cg[i.type]===void 0)throw new Error("unknown packet type "+i.type);if(i.type===cg.BINARY_EVENT||i.type===cg.BINARY_ACK){const I=e+1;for(;A.charAt(++e)!=="-"&&e!=A.length;);const n=A.substring(I,e);if(n!=Number(n)||A.charAt(e)!=="-")throw new Error("Illegal attachments");i.attachments=Number(n)}if(A.charAt(e+1)==="/"){const I=e+1;for(;++e&&!(A.charAt(e)===","||e===A.length););i.nsp=A.substring(I,e)}else i.nsp="/";const g=A.charAt(e+1);if(g!==""&&Number(g)==g){const I=e+1;for(;++e;){const n=A.charAt(e);if(n==null||Number(n)!=n){--e;break}if(e===A.length)break}i.id=Number(A.substring(I,e+1))}if(A.charAt(++e)){const I=this.tryParse(A.substr(e));if(d2.isPayloadValid(i.type,I))i.data=I;else throw new Error("invalid payload")}return i}tryParse(A){try{return JSON.parse(A,this.reviver)}catch{return!1}}static isPayloadValid(A,e){switch(A){case cg.CONNECT:return p4(e);case cg.DISCONNECT:return e===void 0;case cg.CONNECT_ERROR:return typeof e=="string"||p4(e);case cg.EVENT:case cg.BINARY_EVENT:return Array.isArray(e)&&(typeof e[0]=="number"||typeof e[0]=="string"&&ScA.indexOf(e[0])===-1);case cg.ACK:case cg.BINARY_ACK:return Array.isArray(e)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class kcA{constructor(A){this.packet=A,this.buffers=[],this.reconPack=A}takeBinaryData(A){if(this.buffers.push(A),this.buffers.length===this.reconPack.attachments){const e=ycA(this.reconPack,this.buffers);return this.finishedReconstruction(),e}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const McA=Object.freeze(Object.defineProperty({__proto__:null,Decoder:d2,Encoder:mcA,get PacketType(){return cg},protocol:wcA},Symbol.toStringTag,{value:"Module"}));function iB(t,A,e){return t.on(A,e),function(){t.off(A,e)}}const NcA=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class E6 extends Gn{constructor(A,e,i){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=A,this.nsp=e,i&&i.auth&&(this.auth=i.auth),this._opts=Object.assign({},i),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const A=this.io;this.subs=[iB(A,"open",this.onopen.bind(this)),iB(A,"packet",this.onpacket.bind(this)),iB(A,"error",this.onerror.bind(this)),iB(A,"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(...A){return A.unshift("message"),this.emit.apply(this,A),this}emit(A,...e){var i,g,I;if(NcA.hasOwnProperty(A))throw new Error('"'+A.toString()+'" is a reserved event name');if(e.unshift(A),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(e),this;const n={type:cg.EVENT,data:e};if(n.options={},n.options.compress=this.flags.compress!==!1,typeof e[e.length-1]=="function"){const s=this.ids++,B=e.pop();this._registerAckCallback(s,B),n.id=s}const o=(g=(i=this.io.engine)===null||i===void 0?void 0:i.transport)===null||g===void 0?void 0:g.writable,a=this.connected&&!(!((I=this.io.engine)===null||I===void 0)&&I._hasPingExpired());return this.flags.volatile&&!o||(a?(this.notifyOutgoingListeners(n),this.packet(n)):this.sendBuffer.push(n)),this.flags={},this}_registerAckCallback(A,e){var i;const g=(i=this.flags.timeout)!==null&&i!==void 0?i:this._opts.ackTimeout;if(g===void 0){this.acks[A]=e;return}const I=this.io.setTimeoutFn(()=>{delete this.acks[A];for(let o=0;o<this.sendBuffer.length;o++)this.sendBuffer[o].id===A&&this.sendBuffer.splice(o,1);e.call(this,new Error("operation has timed out"))},g),n=(...o)=>{this.io.clearTimeoutFn(I),e.apply(this,o)};n.withError=!0,this.acks[A]=n}emitWithAck(A,...e){return new Promise((i,g)=>{const I=(n,o)=>n?g(n):i(o);I.withError=!0,e.push(I),this.emit(A,...e)})}_addToQueue(A){let e;typeof A[A.length-1]=="function"&&(e=A.pop());const i={id:this._queueSeq++,tryCount:0,pending:!1,args:A,flags:Object.assign({fromQueue:!0},this.flags)};A.push((g,...I)=>i!==this._queue[0]?void 0:(g!==null?i.tryCount>this._opts.retries&&(this._queue.shift(),e&&e(g)):(this._queue.shift(),e&&e(null,...I)),i.pending=!1,this._drainQueue())),this._queue.push(i),this._drainQueue()}_drainQueue(A=!1){if(!this.connected||this._queue.length===0)return;const e=this._queue[0];e.pending&&!A||(e.pending=!0,e.tryCount++,this.flags=e.flags,this.emit.apply(this,e.args))}packet(A){A.nsp=this.nsp,this.io._packet(A)}onopen(){typeof this.auth=="function"?this.auth(A=>{this._sendConnectPacket(A)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(A){this.packet({type:cg.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},A):A})}onerror(A){this.connected||this.emitReserved("connect_error",A)}onclose(A,e){this.connected=!1,delete this.id,this.emitReserved("disconnect",A,e),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(A=>{if(!this.sendBuffer.some(i=>String(i.id)===A)){const i=this.acks[A];delete this.acks[A],i.withError&&i.call(this,new Error("socket has been disconnected"))}})}onpacket(A){if(A.nsp===this.nsp)switch(A.type){case cg.CONNECT:A.data&&A.data.sid?this.onconnect(A.data.sid,A.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 cg.EVENT:case cg.BINARY_EVENT:this.onevent(A);break;case cg.ACK:case cg.BINARY_ACK:this.onack(A);break;case cg.DISCONNECT:this.ondisconnect();break;case cg.CONNECT_ERROR:this.destroy();const i=new Error(A.data.message);i.data=A.data.data,this.emitReserved("connect_error",i);break}}onevent(A){const e=A.data||[];A.id!=null&&e.push(this.ack(A.id)),this.connected?this.emitEvent(e):this.receiveBuffer.push(Object.freeze(e))}emitEvent(A){if(this._anyListeners&&this._anyListeners.length){const e=this._anyListeners.slice();for(const i of e)i.apply(this,A)}super.emit.apply(this,A),this._pid&&A.length&&typeof A[A.length-1]=="string"&&(this._lastOffset=A[A.length-1])}ack(A){const e=this;let i=!1;return function(...g){i||(i=!0,e.packet({type:cg.ACK,id:A,data:g}))}}onack(A){const e=this.acks[A.id];typeof e=="function"&&(delete this.acks[A.id],e.withError&&A.data.unshift(null),e.apply(this,A.data))}onconnect(A,e){this.id=A,this.recovered=e&&this._pid===e,this._pid=e,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(A=>this.emitEvent(A)),this.receiveBuffer=[],this.sendBuffer.forEach(A=>{this.notifyOutgoingListeners(A),this.packet(A)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(A=>A()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:cg.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(A){return this.flags.compress=A,this}get volatile(){return this.flags.volatile=!0,this}timeout(A){return this.flags.timeout=A,this}onAny(A){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(A),this}prependAny(A){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(A),this}offAny(A){if(!this._anyListeners)return this;if(A){const e=this._anyListeners;for(let i=0;i<e.length;i++)if(A===e[i])return e.splice(i,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(A){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(A),this}prependAnyOutgoing(A){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(A),this}offAnyOutgoing(A){if(!this._anyOutgoingListeners)return this;if(A){const e=this._anyOutgoingListeners;for(let i=0;i<e.length;i++)if(A===e[i])return e.splice(i,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(A){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const e=this._anyOutgoingListeners.slice();for(const i of e)i.apply(this,A.data)}}}function vy(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}vy.prototype.duration=function(){var t=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var A=Math.random(),e=Math.floor(A*this.jitter*t);t=(Math.floor(A*10)&1)==0?t-e:t+e}return Math.min(t,this.max)|0};vy.prototype.reset=function(){this.attempts=0};vy.prototype.setMin=function(t){this.ms=t};vy.prototype.setMax=function(t){this.max=t};vy.prototype.setJitter=function(t){this.jitter=t};class wx extends Gn{constructor(A,e){var i;super(),this.nsps={},this.subs=[],A&&typeof A=="object"&&(e=A,A=void 0),e=e||{},e.path=e.path||"/socket.io",this.opts=e,yF(this,e),this.reconnection(e.reconnection!==!1),this.reconnectionAttempts(e.reconnectionAttempts||1/0),this.reconnectionDelay(e.reconnectionDelay||1e3),this.reconnectionDelayMax(e.reconnectionDelayMax||5e3),this.randomizationFactor((i=e.randomizationFactor)!==null&&i!==void 0?i:.5),this.backoff=new vy({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(e.timeout==null?2e4:e.timeout),this._readyState="closed",this.uri=A;const g=e.parser||McA;this.encoder=new g.Encoder,this.decoder=new g.Decoder,this._autoConnect=e.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(A){return arguments.length?(this._reconnection=!!A,A||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(A){return A===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=A,this)}reconnectionDelay(A){var e;return A===void 0?this._reconnectionDelay:(this._reconnectionDelay=A,(e=this.backoff)===null||e===void 0||e.setMin(A),this)}randomizationFactor(A){var e;return A===void 0?this._randomizationFactor:(this._randomizationFactor=A,(e=this.backoff)===null||e===void 0||e.setJitter(A),this)}reconnectionDelayMax(A){var e;return A===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=A,(e=this.backoff)===null||e===void 0||e.setMax(A),this)}timeout(A){return arguments.length?(this._timeout=A,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(A){if(~this._readyState.indexOf("open"))return this;this.engine=new EcA(this.uri,this.opts);const e=this.engine,i=this;this._readyState="opening",this.skipReconnect=!1;const g=iB(e,"open",function(){i.onopen(),A&&A()}),I=o=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",o),A?A(o):this.maybeReconnectOnOpen()},n=iB(e,"error",I);if(this._timeout!==!1){const o=this._timeout,a=this.setTimeoutFn(()=>{g(),I(new Error("timeout")),e.close()},o);this.opts.autoUnref&&a.unref(),this.subs.push(()=>{this.clearTimeoutFn(a)})}return this.subs.push(g),this.subs.push(n),this}connect(A){return this.open(A)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const A=this.engine;this.subs.push(iB(A,"ping",this.onping.bind(this)),iB(A,"data",this.ondata.bind(this)),iB(A,"error",this.onerror.bind(this)),iB(A,"close",this.onclose.bind(this)),iB(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(A){try{this.decoder.add(A)}catch(e){this.onclose("parse error",e)}}ondecoded(A){DF(()=>{this.emitReserved("packet",A)},this.setTimeoutFn)}onerror(A){this.emitReserved("error",A)}socket(A,e){let i=this.nsps[A];return i?this._autoConnect&&!i.active&&i.connect():(i=new E6(this,A,e),this.nsps[A]=i),i}_destroy(A){const e=Object.keys(this.nsps);for(const i of e)if(this.nsps[i].active)return;this._close()}_packet(A){const e=this.encoder.encode(A);for(let i=0;i<e.length;i++)this.engine.write(e[i],A.options)}cleanup(){this.subs.forEach(A=>A()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(A,e){var i;this.cleanup(),(i=this.engine)===null||i===void 0||i.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",A,e),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const A=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const e=this.backoff.duration();this._reconnecting=!0;const i=this.setTimeoutFn(()=>{A.skipReconnect||(this.emitReserved("reconnect_attempt",A.backoff.attempts),!A.skipReconnect&&A.open(g=>{g?(A._reconnecting=!1,A.reconnect(),this.emitReserved("reconnect_error",g)):A.onreconnect()}))},e);this.opts.autoUnref&&i.unref(),this.subs.push(()=>{this.clearTimeoutFn(i)})}}onreconnect(){const A=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",A)}}const pw={};function Dm(t,A){typeof t=="object"&&(A=t,t=void 0),A=A||{};const e=ucA(t,A.path||"/socket.io"),i=e.source,g=e.id,I=e.path,n=pw[g]&&I in pw[g].nsps,o=A.forceNew||A["force new connection"]||A.multiplex===!1||n;let a;return o?a=new wx(i,A):(pw[g]||(pw[g]=new wx(i,A)),a=pw[g]),e.query&&!A.query&&(A.query=e.queryKey),a.socket(e.path,A)}Object.assign(Dm,{Manager:wx,Socket:E6,io:Dm,connect:Dm});function ad(t,A){try{if(!t)return;const e={tag:A,id:t.id,connected:t.connected,active:t.active};t.disconnect()}catch{}}function u6(t,A){try{if(!t)return;t.close?.()}catch{}}const h6=p.createContext(void 0),GcA=({children:t})=>{const[A,e]=p.useState(!0),[i,g]=p.useState(0),I=p.useCallback(()=>e(!0),[]),n=p.useCallback(()=>g(s=>s+1),[]),o=p.useCallback(()=>g(0),[]),a=p.useCallback(s=>{e(!1),setTimeout(()=>e(!0),s)},[]),r=p.useCallback(()=>e(!1),[]);return p.useEffect(()=>{if(typeof window>"u"||!(typeof window.location<"u"&&window.location.search.includes("e2e=1")))return;const B={triggerSpin:n,scheduleReveal:a,resetReveal:r,resetSpin:o};try{window.__diceRevealTest=B}catch{}return()=>{try{delete window.__diceRevealTest}catch{}}},[n,a,r,o]),Q.jsx(h6.Provider,{value:{reveal:A,triggerReveal:I,scheduleReveal:a,resetReveal:r,triggerSpin:n,rollTrigger:i,resetSpin:o},children:t})},kQ=()=>{const t=p.useContext(h6);if(!t)throw new Error("useDiceReveal must be used within a DiceRevealProvider");return t},RcA={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"ceelo",VITE_OTA:"1"},o0=500,d6=new Array(o0);let ym=0,gU=0;const p2="fe:crashlog",UcA=80;function p6(){try{const t=a0().slice(-UcA).map(A=>({t:A.t,level:A.level,tag:A.tag,msg:A.msg,...A.data!==void 0?{data:typeof A.data=="string"?A.data:JSON.stringify(A.data)?.slice(0,200)}:{}}));localStorage.setItem(p2,JSON.stringify(t))}catch{}}function f2(){try{const t=localStorage.getItem(p2);return t?JSON.parse(t):[]}catch{return[]}}function KcA(){try{localStorage.removeItem(p2)}catch{}}let u_=null;function FcA(){u_||(u_=setTimeout(()=>{u_=null,p6()},2e3))}function bcA(){try{if(typeof window<"u"&&window.localStorage?.getItem("logs:disable")==="1"||typeof import.meta<"u"&&RcA?.VITE_LOGS_DISABLED==="1")return!1}catch{}return!0}function vcA(t){d6[ym]=t,ym=(ym+1)%o0,gU=Math.min(gU+1,o0);try{window.dispatchEvent(new CustomEvent("fe:log",{detail:t}))}catch{}t.level==="error"||t.level==="warn"?p6():FcA()}function a0(){const t=[],A=gU;for(let e=0;e<A;e++){const i=(ym-A+e+o0)%o0,g=d6[i];g&&t.push(g)}return t}function _cA(){ym=0,gU=0}function Rn(t,A,e,i){const g={t:Date.now(),tag:t,level:A,msg:e,data:i};if(bcA()){`${new Date(g.t).toISOString()}${t}${A}`;try{const I=i===void 0?[]:[i]}catch{}vcA(g)}}const _t={debug:(t,A)=>Rn("RTC","debug",t,A),info:(t,A)=>Rn("RTC","info",t,A),warn:(t,A)=>Rn("RTC","warn",t,A),error:(t,A)=>Rn("RTC","error",t,A)},Tn={debug:(t,A)=>Rn("LIFE","debug",t,A),info:(t,A)=>Rn("LIFE","info",t,A),warn:(t,A)=>Rn("LIFE","warn",t,A),error:(t,A)=>Rn("LIFE","error",t,A)},Sc={debug:(t,A)=>Rn("SOCK","debug",t,A),info:(t,A)=>Rn("SOCK","info",t,A),warn:(t,A)=>Rn("SOCK","warn",t,A),error:(t,A)=>Rn("SOCK","error",t,A)},r0={debug:(t,A)=>Rn("GL","debug",t,A),info:(t,A)=>Rn("GL","info",t,A),warn:(t,A)=>Rn("GL","warn",t,A),error:(t,A)=>Rn("GL","error",t,A)},mx={debug:(t,A)=>Rn("ERR","debug",t,A),info:(t,A)=>Rn("ERR","info",t,A),warn:(t,A)=>Rn("ERR","warn",t,A),error:(t,A)=>Rn("ERR","error",t,A)};try{window.rtcLogs=a0,window.rtcLogsClear=_cA,window.feLogs=a0,window.feCrashLogs=f2}catch{}const f6=p.createContext(null);let Jo=null,f4="",im=0,D6=0,D4=0;const JcA=1200;let D2=!1,h_=0;const LcA=2e3;function CB(t,A){if(!t||t.connected||t.active)return!1;if(D2)return Sc.warn("safeSocketConnect SKIPPED - session superseded",{source:A}),!1;const e=Date.now();if(e<h_)return Sc.debug("safeSocketConnect SKIPPED - debounce",{source:A,msRemaining:h_-e}),!1;h_=e+LcA,Sc.info("safeSocketConnect calling connect()",{source:A,socketId:t.id});try{t.connect()}catch{}return!0}function qcA(){D2=!1}function y6(){D2=!0}function y2(t=2e3){try{im=Date.now()+Math.max(0,t|0)}catch{}}function xcA(){return Jo}function TcA(t=2e3){try{y2(t)}catch{}try{Jo?.removeAllListeners()}catch{}try{ad(Jo,"SocketContext: hardDisconnectSocket")}catch{}}function YcA(){const t=Jo;if(t){try{t.auth={platform:"web",guest:!0}}catch{}try{D6=Date.now()+3e3}catch{}try{ad(t,"SocketContext: logout refresh")}catch{}setTimeout(()=>{try{t.connect()}catch{}},100)}}function HcA(t){const A=(()=>{try{return typeof window<"u"&&/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})(),e=(()=>{try{return typeof window<"u"?window.location.search:""}catch{return""}})(),g=/(?:[?&])wsOnly=1/.test(e)||(()=>{try{return localStorage.getItem("socket:wsOnly")==="1"}catch{return!1}})()?["websocket"]:["websocket","polling"],I=window.APP_TARGET||"ceelo",n=Dm(t,{path:"/socket.io",withCredentials:!0,transports:g,upgrade:g.length>1,timeout:25e3,autoConnect:!1,extraHeaders:A?{Origin:t}:void 0,auth:{appTarget:I}});return n.on("connect_error",o=>{try{n.__lastConnectErr={ts:Date.now(),reason:o?.message||""}}catch{}}),n}function OcA(t){if(Jo&&f4===t)return Jo;if(Jo){try{Jo.removeAllListeners()}catch{}try{u6(Jo,"SocketContext: getSharedSocket replace")}catch{}Jo=null}Jo=HcA(t),f4=t;try{if(typeof window<"u"){(window.location?.search||"").includes("e2e=1")&&(window.__SOCKET=Jo,window.__sharedSocket=Jo,window.hardDisconnectSocket=TcA,window.suspendSocketAutoConnect=y2);try{if(!window.__clientErrMon){window.__clientErrMon=!0;const e=g=>{try{const I=window.__sharedSocket||Jo;if(!I)return;I.connected?I.emit("client_error",g):(I.__pendingClientErrors=I.__pendingClientErrors||[],I.__pendingClientErrors.push(g))}catch{}},i=()=>{let g="web";try{const I=navigator.userAgent||"";/iPhone|iPad|iPod/i.test(I)?g="ios":/Android/i.test(I)?g="android":g="web"}catch{}return{platform:g,userAgent:typeof navigator<"u"?navigator.userAgent:"",ts:Date.now()}};window.addEventListener("error",g=>{try{if(!g.error&&!g.message)return;const I=g.message||"";if(I.includes("websocket error")||I.includes("WebSocket"))return;e({message:I||"error",stack:g.error?.stack?.slice?.(0,5e3),filename:g.filename,line:g.lineno,col:g.colno,...i()})}catch{}}),window.addEventListener("unhandledrejection",g=>{try{const I=g.reason,n=typeof I=="string"?I:I?.message||"unhandledrejection";if(I?.name==="AbortError"||n?.includes?.("aborted")||n?.includes?.("The operation was aborted"))return;e({message:n?.slice?.(0,500)||"unhandledrejection",stack:(I?.stack||"").slice?.(0,5e3),...i()})}catch{}}),Jo.on("connect",()=>{try{const g=Jo,I=g?.__pendingClientErrors;Array.isArray(I)&&I.length&&I.splice(0,I.length).forEach(o=>{try{g.emit("client_error",o)}catch{}})}catch{}})}}catch{}}}catch{}return Jo}function PcA({children:t}){const{user:A,initialized:e}=Yi(),i=Ea(),g=p.useMemo(()=>OcA(i),[i]),{resetSpin:I}=kQ();return p.useEffect(()=>{if(!e)return;let n=!1;return(async()=>{const o=s=>{try{g.__authSig=s}catch{}},a=()=>{try{return String(g.__authSig||"")}catch{return""}},r=s=>{const B=Math.max(0,im-Date.now());if(B<=0)return s();setTimeout(()=>{n||s()},B).unref?.()};if(A){const s=await Nn();if(n)return;if(s){const B=a(),c=`t:${s}`;if(g.auth={token:s},o(c),g.disconnected)r(()=>{n||(CB(g,"SocketContext:auth-token-connect"),I())});else if(B!==c){const E=Date.now();E-D4>=JcA&&(D4=E,r(()=>{if(!n){try{ad(g,"SocketContext: auth change soft reconnect")}catch{}setTimeout(()=>{n||(CB(g,"SocketContext:auth-change-reconnect"),I())},100)}}))}}}})(),()=>{n=!0}},[e,A,g]),p.useEffect(()=>{const n=async()=>{if(Date.now()<im)return;const o=await Nn();if(!o){if(Date.now()<D6){try{g.auth={platform:"web",guest:!0},g.__authSig="g:*"}catch{}I();return}try{g.auth={},g.__authSig=""}catch{}try{g.disconnected||ad(g,"SocketContext: skip reconnect without token")}catch{}return}g.auth={token:o};try{g.__authSig=`t:${o}`}catch{}I()};return g.on("reconnect_attempt",n),()=>{g.off("reconnect_attempt",n)}},[g,I]),p.useEffect(()=>{const n=async o=>{try{await dd(o)}catch{}g.auth=o?{token:o}:{};try{g.__authSig=o?`t:${o}`:""}catch{}};return g.on("auth:rotate",n),()=>{g.off("auth:rotate",n)}},[g]),p.useEffect(()=>{let n=!1;const o=async()=>{if(!n){try{const r=await Nn();g.auth=r?{token:r}:{platform:"web",guest:!0}}catch{}try{if(g.connected)try{ad(g,"SocketContext: OTA forceReconnect")}catch{}setTimeout(()=>{n||(CB(g,"SocketContext:OTA-forceReconnect"),I())},100)}catch{}}},a=()=>o();window.addEventListener("ota:activated",a);try{window.__OTA_ACTIVATED__&&o()}catch{}return()=>{n=!0,window.removeEventListener("ota:activated",a)}},[g,I]),p.useEffect(()=>{let n=!1;const o=async()=>{if(!n&&!(Date.now()<im)&&g.disconnected){try{const c=await Nn();if(n||!c)return;g.auth={token:c}}catch{}g.disconnected&&(CB(g,"SocketContext:refreshAuthAndConnect"),I())}},a=()=>{try{document.visibilityState==="visible"&&o()}catch{}},r=()=>o(),s=()=>o(),B=()=>o();return window.addEventListener("visibilitychange",a),window.addEventListener("focus",r),window.addEventListener("pageshow",s),window.addEventListener("online",B),()=>{n=!0,window.removeEventListener("visibilitychange",a),window.removeEventListener("focus",r),window.removeEventListener("pageshow",s),window.removeEventListener("online",B)}},[g,I]),p.useEffect(()=>{const n=()=>{try{g.removeAllListeners()}catch{}try{u6(g,"SocketContext: beforeunload")}catch{}};return window.addEventListener("beforeunload",n),()=>{window.removeEventListener("beforeunload",n)}},[g]),p.useEffect(()=>{let n=!1;const o=5e3,a=15e3,r=2e3;let s=!1;const c=setInterval(()=>{if(n)return;try{if(document.visibilityState==="hidden")return}catch{}if(Date.now()<im||!g||s)return;const E=g.connected,D=g?.data?.lastAckAt;if(!E){try{g.connect()}catch{}return}if(D&&Date.now()-D<a)return;s=!0;let y=!1;const S=setTimeout(()=>{if(!y){y=!0,s=!1;try{g.disconnect()}catch{}setTimeout(()=>{if(!n)try{g.connect()}catch{}},100)}},r);try{g.emit("health:ping",{},f=>{if(!y){y=!0,clearTimeout(S),s=!1;try{g.data=g.data||{},g.data.lastAckAt=Date.now(),g.data.lastAckEvent="health:ping"}catch{}try{if(f&&typeof f.ts=="number"){const M=Date.now()-f.ts;g.__lastRttMs=M}f&&typeof f.lagMs=="number"&&(g.__lastServerLagMs=f.lagMs)}catch{}}})}catch{s=!1}},o);return()=>{n=!0,clearInterval(c)}},[g]),Q.jsx(f6.Provider,{value:g,children:t})}function Xn(){const t=p.useContext(f6);if(!t)throw new Error("useSocket must be used within a SocketProvider");return t}const S6=p.createContext({user:null,loading:!0,initialized:!1,refreshUser:async()=>{},logout:async()=>{},meId:"",updateBalance:()=>{}}),Yi=()=>p.useContext(S6);function jcA(t){if(!t)return null;if(typeof t=="object"&&"authenticated"in t){const A=t;return A.authenticated?A.user??null:null}return t}const ZcA=({children:t})=>{const[A,e]=p.useState(null),[i,g]=p.useState(""),[I,n]=p.useState(!0),[o,a]=p.useState(!1),r=ln(),s=p.useRef(null),B=p.useRef(!0);p.useEffect(()=>(B.current=!0,()=>{B.current=!1}),[]);const c=p.useCallback(async S=>{if(s.current){if(!S?.force)return s.current;try{await s.current}catch{}}const f=new URLSearchParams(r.search);if((()=>{try{if(f.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 U=1e3;try{const F=window.sessionStorage?.getItem("e2e_balance"),b=F?Number(F):NaN;Number.isFinite(b)&&(U=b)}catch{}e({id:"e2e-user",name:"E2E",email:"e2e@example.com",balance:U,botChatDisabled:!1,ceeloBotsPerRoom:null,crapsBotsPerRoom:null,pokerBotsPerRoom:null}),g("e2e-user"),n(!1),a(!0);return}const k=async()=>{e(null),g("");try{c_(null)}catch{}};if(r.pathname==="/login"&&!S?.force){await k(),n(!1),a(!0);return}n(!0);const m=(async()=>{try{const U=await fF(),F=jcA(U);if(F){qcA(),e(F),g(F?.id||"");try{c_(F.id||null)}catch{}}else await k()}catch{if(!B.current)return;await k()}finally{n(!1),a(!0),s.current=null}})();return s.current=m,m},[]);p.useEffect(()=>{c()},[c]);const E=p.useCallback(S=>{B.current&&e(f=>!f||f.balance===S?f:{...f,balance:S})},[]),D=p.useCallback(async()=>{const S=A?.email;try{try{y2(2500)}catch{}S&&await nR(S);try{await fetch("/api/auth/clear",{method:"POST",credentials:"include"})}catch{}}finally{if(!B.current)return;try{await Hd()}catch{}try{await vBA()}catch{}e(null),g("");try{c_(null)}catch{}try{YcA()}catch{}}},[A?.email]),y=p.useMemo(()=>({user:A,loading:I,initialized:o,refreshUser:c,logout:D,meId:i,updateBalance:E}),[A,I,o,c,D,i,E]);return Q.jsx(S6.Provider,{value:y,children:t})},WcA=(()=>{try{return"ceelo"}catch{return}})();function zcA(){try{const t=window.localStorage?.getItem("app_target_lock");if(t==="ceelo"||t==="craps"||t==="poker"||t==="skills"||t==="zentara"||t==="unified")return t}catch{}}function VcA(t){try{window.localStorage?.setItem("app_target_lock",t)}catch{}}const y4=(()=>{try{return Li.getPlatform()}catch{return"web"}})(),w6=zcA()??WcA??_r;(y4==="ios"||y4==="android")&&VcA(w6);const m6=w6,XcA=m6==="skills";function $cA(){return m6}function Po({className:t}){return p.useEffect(()=>{document.body.classList.add(t);const A=(()=>{try{return/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})();return A&&(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")),()=>{document.body.classList.remove(t),window.scrollTo(0,0),document.body.scrollTop=0,document.documentElement.scrollTop=0,A&&(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app"))}},[t]),null}function Od(){const{user:t,loading:A,initialized:e}=Yi(),i=ln(),I=new URLSearchParams(i.search).get("e2e")==="1",n=i.pathname||"",o=/^\/poker\/room\//.test(n),a=/^\/room\//.test(n);return!e||A?Q.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[Q.jsx(Po,{className:"page-home-screen"}),Q.jsx("div",{className:"home-preloader",children:Q.jsx("div",{className:"home-preloader__spinner"})})]}):!t&&!I&&!(o||a)?Q.jsx(An,{to:"/login",replace:!0,state:{from:i}}):Q.jsx(HX,{})}function Pd(){return Q.jsxs("div",{style:{padding:24},children:[Q.jsx("h2",{children:"Verification failed"}),Q.jsx("p",{children:"Your login link is invalid or expired. Please request a new one."})]})}const k6=p.createContext(null);function AlA({children:t}){const[A,e]=p.useState([]),i=p.useRef({}),g=p.useCallback(s=>{e(c=>c.filter(E=>E.id!==s));const B=i.current[s];B&&(window.clearTimeout(B),delete i.current[s])},[]),I=p.useCallback(s=>{const B=crypto.randomUUID(),c={id:B,duration:3500,...s};e(D=>[...D,c]);const E=c.duration??3500;return E>0&&(i.current[B]=window.setTimeout(()=>g(B),E)),B},[g]),n=p.useCallback((s,B={})=>I({message:s,variant:"success",...B}),[I]),o=p.useCallback((s,B={})=>I({message:s,variant:"error",...B}),[I]),a=p.useCallback((s,B={})=>I({message:s,variant:"info",...B}),[I]),r=p.useMemo(()=>({show:I,success:n,error:o,info:a,dismiss:g}),[I,n,o,a,g]);return Q.jsxs(k6.Provider,{value:r,children:[t,Zc.createPortal(Q.jsx("div",{className:"toast-root","aria-live":"polite","aria-atomic":"true",children:A.map(s=>Q.jsxs("div",{className:`toast-item toast-${s.variant}`,role:"status",onClick:()=>g(s.id),children:[s.title&&Q.jsx("div",{className:"toast-title",children:s.title}),s.message&&Q.jsx("div",{className:"toast-message",children:s.message}),Q.jsx("button",{className:"toast-close","aria-label":"Dismiss",onClick:B=>{B.stopPropagation(),g(s.id)},children:"×"})]},s.id))}),document.body)]})}function MQ(){const t=p.useContext(k6);if(!t){const A=()=>"noop";return{show:()=>"noop",success:A,error:A,info:A,dismiss:()=>{}}}return t}const M6={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",SOCIAL_SEARCH_PLAYERS:"social:search_players",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",GAME_INVITE_CANCELLED:"game_invite:cancelled",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",QUICK_MATCH_JOIN:"quick_match:join",QUICK_MATCH_LEAVE:"quick_match:leave",QUICK_MATCH_STATUS:"quick_match:status",QUICK_MATCH_FOUND:"quick_match:found",QUICK_MATCH_WAITING:"quick_match:waiting",SOCIAL_ONLINE_FRIENDS:"social:online_friends"};Object.freeze(M6);const ht=new Proxy(M6,{set(){throw new TypeError("SocketEvents is read-only")},defineProperty(){throw new TypeError("SocketEvents is read-only")},deleteProperty(){throw new TypeError("SocketEvents is read-only")}}),elA="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=",S4=""+new URL("flash-1UjQ_pjl.m4a",import.meta.url).href,w4=""+new URL("swoosh-DWLYYP2o.m4a",import.meta.url).href,N6=""+new URL("dice_whirr_merged-kYY8GDzo.m4a",import.meta.url).href,tlA=""+new URL("loss-MbFJ6Xyb.m4a",import.meta.url).href,ilA=""+new URL("winner-C_feQyA8.m4a",import.meta.url).href,glA=""+new URL("win-BofsSXdy.m4a",import.meta.url).href,IlA=""+new URL("ante_up-BNJNkzdg.m4a",import.meta.url).href,nlA=""+new URL("push-D8ciTeGD.m4a",import.meta.url).href,olA=""+new URL("your_turn-r-y-lDUH.m4a",import.meta.url).href,alA=""+new URL("point_set-BYYb2H7O.m4a",import.meta.url).href,rlA=""+new URL("place_hit-B397CGff.m4a",import.meta.url).href,slA=""+new URL("yes-D6HNwLBK.m4a",import.meta.url).href,ClA=""+new URL("smashing-CDhgl1WN.m4a",import.meta.url).href,BlA=""+new URL("love_you-ClILzZiq.m4a",import.meta.url).href,clA=""+new URL("gangster-BuThOTHu.m4a",import.meta.url).href,llA=""+new URL("skills_win-B9044Qtf.m4a",import.meta.url).href,QlA=""+new URL("skills_lose-C2hT1pjV.m4a",import.meta.url).href,G6=""+new URL("skills_lobby-Wq3LgbVY.m4a",import.meta.url).href,jd=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),tQ=typeof window<"u"?window.Capacitor:void 0,SF=!!tQ&&typeof tQ.isNativePlatform=="function"&&tQ.isNativePlatform(),Eg=tQ&&(tQ.Plugins?.NativeAudio||tQ.NativeAudio)||void 0,lu=SF&&!!Eg,fk=SF&&jd,ElA=SF&&!jd;let pB=!1,CQ=!0,s0=null;const S2=500;function ulA(){return!!CQ}function m4(t){if(CQ=!!t,!CQ)try{aU()}catch{}}const hlA=["vYes","vSmashing","vLove","vGangster"],Ar={click:elA,flash:S4,chip:w4,win:ilA,winDing:glA,lose:tlA,push:nlA,cardSwoosh:w4,placeBets:IlA,yourTurn:olA,vYes:slA,vSmashing:ClA,vLove:BlA,vGangster:clA,pointSet:alA,placeHit:rlA,betPlaced:S4,skillsWin:llA,skillsLose:QlA,skillsLobby:G6},k4=["flash","win","winDing","lose","push","chip","cardSwoosh","placeBets","yourTurn","pointSet","vYes","vSmashing","vLove","vGangster","placeHit"],R6=3,U6=4,K6=fk?1:jd?2:8;let d_=0,w2=!1;function F6(){const t=performance.now();w2=d_>0&&t-d_>50,d_=t,requestAnimationFrame(F6)}typeof requestAnimationFrame<"u"&&requestAnimationFrame(F6);const b6={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},IU={},BQ={};let WE=0,v6=0;const p_=new WeakMap;let f_=!1;const M4=[];function C0(t){M4.push(t),!f_&&(f_=!0,requestAnimationFrame(()=>{f_=!1;const A=M4.splice(0);for(const e of A)e()}))}const rs=new Set,D_=new Map,B0=new Map;function zE(t){const A=Date.now(),e=B0.get(t)||{count:0,last:0};e.count=Math.min(5,e.count+1),e.last=A,B0.set(t,e)}function wF(t){t?B0.delete(t):B0.clear()}function mF(t){const A=B0.get(t);if(!A)return!0;const e=Date.now(),i=2e3*Math.min(3,A.count);return e-A.last>i}function dlA(t){try{const A=String(t||"");if(!A)return null;if(/^https?:\/\//i.test(A))return{path:A,isUrl:!0};if(/^data:/i.test(A))return null;if(/^file:\/\//i.test(A))return{path:A,isUrl:!0};if(/^capacitor:\/\//i.test(A)){const i=new URL(A).pathname||"";return i.startsWith("/assets/")?{path:`public${i}`,isUrl:!1}:i.startsWith("/public/")?{path:i.replace(/^\//,""),isUrl:!1}:{path:A,isUrl:!0}}return A.startsWith("./assets/")?{path:`public/${A.slice(2)}`,isUrl:!1}:A.startsWith("assets/")?{path:`public/${A}`,isUrl:!1}:A.startsWith("/assets/")?{path:`public${A}`,isUrl:!1}:A.startsWith("public/")?{path:A,isUrl:!1}:A.startsWith("/public/")?{path:A.slice(1),isUrl:!1}:{path:`public/${A.replace(/^\.\//,"")}`,isUrl:!1}}catch{return null}}const nU=new Map,N4=fk?100:20;async function plA(t){if(!Eg?.getDuration)return!0;try{const A=await Eg.getDuration({assetId:t});return A&&typeof A.duration=="number"&&A.duration>0}catch{return!1}}async function c0(t,A){if(!lu||!Eg)throw new Error("Native audio not available");if(rs.has(t))return;const e=D_.get(t);if(e){if(await e,!rs.has(t))throw new Error("Asset preload failed");return}try{const i=dlA(A);if(!i)throw zE(t),new Error("Failed to resolve asset path");const g=(async()=>{await Eg.preload({assetId:t,assetPath:i.path}),rs.add(t),nU.set(t,Date.now())})();D_.set(t,g),await g.finally(()=>{D_.delete(t)})}catch(i){throw zE(t),i}}async function flA(t,A,e){if(!lu||!Eg)throw new Error("Native audio not available");if(!mF(t))throw new Error("Native audio cooldown active");try{if(await c0(t,A),!rs.has(t))throw new Error("Asset not loaded");const i=nU.get(t)||0,g=Date.now()-i;if(g<N4&&await new Promise(I=>setTimeout(I,N4-g)),fk&&!await plA(t)){try{await Eg.unload({assetId:t})}catch{}throw rs.delete(t),nU.delete(t),new Error("Asset verification failed - native player not ready")}if(e?.volume!=null&&Eg.setVolume)try{await Eg.setVolume({assetId:t,volume:or(e.volume,0,1)})}catch{}try{await Eg.play({assetId:t})}catch{await new Promise(n=>setTimeout(n,30)),await Eg.play({assetId:t})}e?.durationMs&&e.durationMs>0&&window.setTimeout(()=>{try{Eg.stop({assetId:t})}catch{}},Math.max(10,Math.floor(e.durationMs)))}catch(i){throw zE(t),i}}function m2(t){const A=new Audio(Ar[t]);A.preload="auto";try{A.playsInline=!0}catch{}try{A.setAttribute("playsinline",""),A.setAttribute("webkit-playsinline","")}catch{}try{A.muted=!1}catch{}try{A.volume=1}catch{}return A.addEventListener("ended",()=>Rc(t,A)),A}function Qu(t){let A=BQ[t];if(!A){const e=t==="flash"?U6:R6;A={free:[],busy:new Set,size:0};for(let i=0;i<e;i++)A.free.push(m2(t)),A.size++;BQ[t]=A}return A}function k2(t){const A=t==="flash"?U6:R6,e=Qu(t);if(e.free.length>0)return e.free.pop();if(e.size<A){const i=m2(t);return e.size++,i}return null}function Rc(t,A){const e=BQ[t];e&&e.busy.has(A)&&(e.busy.delete(A),e.free.push(A),WE=Math.max(0,WE-1))}function M2(){Object.keys(b6).forEach(t=>delete IU[t])}function DlA(){try{rs.clear(),nU.clear(),wF()}catch{}}function kF(t,A=800){const e=p_.get(t);if(e)return e;const i=new Promise(g=>{try{if(t.readyState>=2){g(!0);return}let I=!1;const n=()=>{try{t.removeEventListener("canplaythrough",o)}catch{}try{t.removeEventListener("loadeddata",o)}catch{}try{t.removeEventListener("error",a)}catch{}},o=()=>{I||(I=!0,n(),g(!0))},a=()=>{I||(I=!0,n(),g(!1))};t.addEventListener("canplaythrough",o,{once:!0}),t.addEventListener("loadeddata",o,{once:!0}),t.addEventListener("error",a,{once:!0});try{t.load()}catch{}window.setTimeout(()=>{I||(I=!0,n(),g(t.readyState>=2))},Math.max(200,Math.min(4e3,A)))}catch{g(!1)}});return p_.set(t,i),i.finally(()=>{p_.delete(t)}),i}let uN=null,yn=null,iQ=null,oU=!1;function aU(){Object.keys(BQ).forEach(t=>{const A=BQ[t];A&&[...A.busy].forEach(e=>{try{e.pause(),e.currentTime=0}catch{}Rc(t,e)})});try{uN&&(uN.pause(),uN.currentTime=0)}catch{}try{yn&&(yn.pause(),yn.currentTime=0)}catch{}uN=null,yn=null;try{const t=Object.keys(Ar);for(const A of t){const e=WD?.[A];if(e){try{e.pause(),e.currentTime=0}catch{}WD[A]=null}gQ[A]&&(window.clearTimeout(gQ[A]),delete gQ[A])}if(lu&&Eg){for(const A of Object.keys(Ar))if(rs.has(A)){try{gD(Eg.stop({assetId:A}))}catch{}try{Eg.unload&&gD(Eg.unload({assetId:A}))}catch{}try{rs.delete(A)}catch{}}if(rs.has("loop_dice_whirr")){try{gD(Eg.stop({assetId:"loop_dice_whirr"}))}catch{}try{Eg.unload&&gD(Eg.unload({assetId:"loop_dice_whirr"}))}catch{}try{rs.delete("loop_dice_whirr"),wF("loop_dice_whirr")}catch{}}oU=!1}}catch{}WE=0,M2()}let _6=!1;function Sm(t){_6=!!t}let G4=0;const ylA=1500;async function SlA(t,A){if(!CQ||_6)return!1;const e=Date.now();if(e-G4<ylA)return!1;if(G4=e,fk&&Eg&&mF(t))try{return(async()=>{try{if(await c0(t,Ar[t]),rs.has(t)){if(Eg.setVolume)try{await Eg.setVolume({assetId:t,volume:or(A,0,1)})}catch{}await Eg.play({assetId:t})}}catch{zE(t)}})(),!0}catch{zE(t)}if(!pB||jd&&w2)return!1;try{const i=k2(t);if(!i){const I=new Audio(Ar[t]);return I.volume=Do(t,A),I.play().catch(()=>{}),!0}return Qu(t).busy.add(i),WE++,i.currentTime=0,i.volume=Do(t,A),i.play().catch(()=>Rc(t,i)),!0}catch{return!1}}const wlA={3:"vGangster",4:"vLove",5:"vSmashing",6:"vYes",7:"vSmashing"};async function R4(t,A=.5){const e=wlA[t>=7?7:t];return e?SlA(e,A):!1}function mlA(t,A){if(!CQ||!pB||WE>=K6)return;const e=k2(t);if(!e)return;Qu(t).busy.add(e),WE++;try{e.currentTime=0,A?.volume!=null&&(e.volume=Do(t,A.volume)),A?.rate!=null&&(e.playbackRate=or(A.rate,.25,4));const g=A?.durationMs&&A.durationMs>0?window.setTimeout(()=>{try{e.pause(),e.currentTime=0}catch{}Rc(t,e)},Math.max(10,Math.floor(A.durationMs))):null;C0(()=>{e.play().catch(()=>{g&&window.clearTimeout(g),Rc(t,e)})})}catch{Rc(t,e)}}async function pa(t,A){if(!CQ)return;const e=Date.now();if(e<v6||jd&&w2&&t!=="win"&&t!=="lose")return;const i=b6[t]??0;if(i>0){const n=IU[t]??0;if(e-n<i)return}if(IU[t]=e,fk&&Eg&&mF(t)){(async()=>{try{await flA(t,Ar[t],{volume:A?.volume,durationMs:A?.durationMs})}catch{zE(t)}})();return}if(!pB||s0&&e-s0<S2)return;if(ElA){mlA(t,A);return}if(WE>=K6)return;const g=k2(t);if(!g)return;Qu(t).busy.add(g),WE++;try{g.currentTime=0,A?.volume!=null&&(g.volume=Do(t,A.volume)),A?.rate!=null&&(g.playbackRate=or(A.rate,.25,4));const n=A?.durationMs&&A.durationMs>0?window.setTimeout(()=>{try{g.pause(),g.currentTime=0}catch{}Rc(t,g)},Math.max(10,Math.floor(A.durationMs))):null;if(!await kF(g,1e3)){C0(()=>{g.play().catch(()=>{n&&window.clearTimeout(n),Rc(t,g)})});return}C0(()=>{g.play().catch(()=>{n&&window.clearTimeout(n),Rc(t,g)})})}catch{Rc(t,g)}}const or=(t,A,e)=>Math.min(e,Math.max(A,t)),klA={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 Do(t,A){const e=or(A,0,1);if(jd){const i=klA[t];if(typeof i=="number")return or(Math.max(e,i),0,1)}return e}function kx(){jd&&(Object.keys(BQ).forEach(t=>{const A=t,e=BQ[A];e&&e.free.forEach(i=>{try{i.pause(),i.src=Ar[A],i.load()}catch{}})}),M2())}function MlA(){try{aU()}catch{}try{pd()}catch{}}function NlA(){DlA();try{kx()}catch{}M2()}try{const t=tQ&&(tQ.Plugins?.App||tQ.App)||void 0;SF&&t?.addListener&&t.addListener("appStateChange",A=>{!!(A&&A.isActive)?NlA():MlA()})}catch{}let rU=null,Oh=!1,Xf=0,J6=0;function U4(){return!lu||Oh}function GlA(){return{loaded:Xf,total:J6}}async function RlA(t=5e3){if(!lu||Oh||!rU)return!0;try{return await Promise.race([rU,new Promise((A,e)=>setTimeout(()=>e(new Error("timeout")),t))]),!0}catch{return!1}}async function Cg(){if(!pB){pB=!0,s0=Date.now(),v6=Date.now()+S2,Object.keys(Ar).forEach(t=>{try{Qu(t)}catch{}});try{ZD()}catch{}try{if(lu&&Eg){const t=Object.keys(Ar);J6=t.length,Xf=0,Oh=!1,rU=(async()=>{for(const e of k4)try{await c0(e,Ar[e]),Xf++,await new Promise(i=>setTimeout(i,15))}catch{Xf++}const A=t.filter(e=>!k4.includes(e));for(const e of A)try{await c0(e,Ar[e]),Xf++,await new Promise(i=>setTimeout(i,15))}catch{Xf++}Oh=!0})(),rU.catch(()=>{Oh=!0})}else Oh=!0}catch{Oh=!0}}}function N2(){return!!pB}function ZD(t){const A=t&&t.length?t:Object.keys(Ar);for(const e of A)Qu(e).free.forEach(g=>{try{g.load()}catch{}})}async function sU(t,A=800){const e=t&&t.length?t:Object.keys(Ar),i=I=>new Promise(n=>{try{const a=Qu(I).free[0]||m2(I);kF(a,A).then(n)}catch{n(!1)}});return(await Promise.all(e.map(i))).every(Boolean)}if(typeof document<"u"){const t=()=>{document.visibilityState==="hidden"?(aU(),pd()):kx()};document.addEventListener("visibilitychange",t),window.addEventListener("pagehide",()=>{aU(),pd()}),window.addEventListener("pageshow",()=>kx())}function rd(t){const e=or(t?.volume??.01,0,1)*.5;pa("flash",{volume:Do("flash",e)})}function UlA(t){pa("chip",{volume:Do("chip",t?.volume??.25),durationMs:t?.durationMs??500,rate:t?.playbackRate})}function KlA(t){pa("cardSwoosh",{volume:Do("cardSwoosh",t?.volume),rate:t?.playbackRate??1})}function FlA(t){pa("lose",{volume:Do("lose",t?.volume)})}function blA(t){pa("push",{volume:Do("push",t?.volume)})}function vlA(t){const A=or(t?.volume,0,1),e=Do("win",A);pa("winDing",{volume:.025}),pa("win",{volume:Do("win",or(e*.35,0,1))})}function _lA(t){pa("winDing",{volume:Do("winDing",t?.volume)})}function Mx(t){pa("placeBets",{volume:Do("placeBets",t?.volume??.65)})}function K4(t){pa("pointSet",{volume:Do("pointSet",t?.volume??.15)})}function JlA(t){pa("betPlaced",{volume:Do("betPlaced",t?.volume)})}function Nx(t){pa("skillsWin",{volume:Do("skillsWin",t?.volume??.5)}),pa("win",{volume:Do("win",.35)})}function Gx(t){pa("skillsLose",{volume:Do("skillsLose",t?.volume??.4)})}let Tl=null,Rx=!1;function MF(t){if(!(!CQ||!pB)&&!(Rx&&Tl))try{Tl||(Tl=new Audio(G6),Tl.loop=!0,Tl.volume=t?.volume??.075),Tl.play().then(()=>{Rx=!0}).catch(()=>{})}catch{}}function pd(){if(Tl)try{Tl.pause(),Tl.currentTime=0,Rx=!1}catch{}}function F4(t){const A=or(t?.sfxVolume??.15,0,1);pa("winDing",{volume:or(A*.25,0,1)})}async function L6(t,A=150){return new Promise(e=>{try{const g=Math.max(10,Math.floor(A/10));let I=0;const n=t.volume,o=window.setInterval(()=>{I++;const a=I/10;if(t.volume=Math.max(0,n*(1-a)),I>=10){window.clearInterval(o);try{t.pause(),t.currentTime=0}catch{}t.volume=n,e()}},g)}catch{try{t.pause(),t.currentTime=0}catch{}e()}})}function LlA(t){if(!CQ)return;const A=or(t?.volume,0,1),e=or(t?.playbackRate,.25,4);let i=!1;if(lu&&Eg&&mF("loop_dice_whirr")){try{c0("loop_dice_whirr",N6).then(async()=>{try{if(oU||(Eg.loop?await Eg.loop({assetId:"loop_dice_whirr"}):await Eg.play({assetId:"loop_dice_whirr"}),oU=!0),Eg.setVolume)try{await Eg.setVolume({assetId:"loop_dice_whirr",volume:A})}catch{}}catch{zE("loop_dice_whirr"),y_(A,e)}}).catch(()=>{zE("loop_dice_whirr"),y_(A,e)}),i=!0}catch{}if(i){try{iQ&&window.clearTimeout(iQ),iQ=window.setTimeout(()=>{try{js()}catch{}},8e3)}catch{}return}}pB&&y_(A,e)}function y_(t,A){if(pB)try{if(!yn){yn=new Audio(N6),yn.loop=!0,yn.preload="auto";try{yn.playsInline=!0}catch{}kF(yn,800)}if(!yn.paused){yn.volume=t,yn.playbackRate=A;return}yn.volume=t,yn.playbackRate=A,yn.currentTime=0,C0(()=>{yn&&yn.play().catch(()=>{})}),iQ&&window.clearTimeout(iQ),iQ=window.setTimeout(()=>{try{js()}catch{}},8e3)}catch{}}function js(){if(iQ&&(window.clearTimeout(iQ),iQ=null),lu&&Eg)try{try{gD(Eg.stop({assetId:"loop_dice_whirr"}))}catch{}try{Eg.unload&&gD(Eg.unload({assetId:"loop_dice_whirr"}))}catch{}try{rs.delete("loop_dice_whirr"),wF("loop_dice_whirr")}catch{}oU=!1}catch{}try{yn&&L6(yn,120)}catch{}}function gD(t){try{return t&&typeof t.then=="function"?t.catch(()=>{}):Promise.resolve()}catch{return Promise.resolve()}}const WD={},gQ={};function qlA(t,A){hlA.includes(t)||pa(t,{volume:A?.volume,rate:A?.rate,durationMs:A?.durationMs})}function xlA(t,A){if(!(!CQ||!pB)&&!(s0&&Date.now()-s0<S2))try{let e=WD[t];if(!e){e=new Audio(Ar[t]),e.loop=!0,e.preload="auto";try{e.playsInline=!0}catch{}WD[t]=e,kF(e,800)}const i=or(A?.volume??.1,0,1),g=or(A?.rate??1,.25,4);if(!e.paused){e.volume=i,e.playbackRate=g;return}e.volume=i,e.playbackRate=g,e.currentTime=0,C0(()=>{e.play().catch(()=>{})}),gQ[t]&&window.clearTimeout(gQ[t]);const I=Math.max(5e3,Math.min(6e4,A?.maxMs??15e3));gQ[t]=window.setTimeout(()=>{try{q6(t)}catch{}},I)}catch{}}async function q6(t){try{gQ[t]&&(window.clearTimeout(gQ[t]),delete gQ[t]);const A=WD[t];if(!A)return;await L6(A,120),WD[t]=null}catch{}}function TlA(){try{Cg()}catch{}}async function YlA(t,A){try{if(t==="__probe__")return Promise.resolve(!!pB);const e=t;return e in Ar?A?.loop?(xlA(e,{volume:A.volume,rate:A.rate}),!0):(qlA(e,{volume:A?.volume,rate:A?.rate}),!0):!1}catch{return!1}}function HlA(t){try{ZD(t)}catch{}}function b4(t){try{const A=t;try{q6(A)}catch{}const e=BQ[A];if(e){try{[...e.busy].forEach(i=>{try{i.pause(),i.currentTime=0}catch{}})}catch{}delete BQ[A]}try{delete IU[A]}catch{}try{rs.delete(A),wF(A)}catch{}try{Qu(A)}catch{}}catch{}}const UE=[];function Ux(t,A){try{UE.push({event:t,ts:Date.now(),mode:A}),UE.length>12&&UE.shift()}catch{}}function CR(){return[...UE]}function wm(t,A=2e3){return t.connected?Promise.resolve():(CB(t,"emit.ensureConnected"),new Promise((e,i)=>{let g=!1;const I=()=>{g||(g=!0,a(),e())},n=s=>{g||(g=!0,a(),i(s??new Error("socket connect error")))},o=()=>{g||(g=!0,a(),i(new Error("socket connect timeout")))},a=()=>{try{t.off("connect",I)}catch{}try{t.off("connect_error",n)}catch{}clearTimeout(r)},r=setTimeout(o,Math.max(300,A));r.unref?.(),t.once("connect",I),t.once("connect_error",n)}))}async function Kx(t,A,e,i){try{T6(A)}catch{}const g=i?.timeoutMs??15e3;try{await wm(t)}catch(n){const o=String(n?.message||n||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)|timeout/i.test(o)){try{CB(t,"emit.ts:emitAck-ensureConnected-fallback")}catch{}await new Promise(a=>{const r=setTimeout(()=>a(),800);t.once("connect",()=>{clearTimeout(r),a()})})}else throw n}Ux(A,"ack");const I=()=>new Promise((n,o)=>{t.timeout(g).emit(A,e,(a,r)=>a?o(a):r?n(r):o(new Error("No ack payload received")))});try{return await I()}catch(n){const o=String(n?.message||n||"");try{if(/operation has timed out|timeout/i.test(o)){const a=t?.io?.engine?.transport?.name,r=e?.roomId||null,s=UE[UE.length-1]?.event||"unknown";jD("socket_ack_timeout",{event:String(A),scope:String(A).includes("craps")?"craps":String(A).includes("poker")?"poker":"other",roomId:r,lastEvent:s,timeoutMs:g,connected:!!t.connected,transport:a||"unknown",phase:"initial"})}}catch{}if(/socket has been disconnected|the socket is disconnected/i.test(o)||/connect_error|transport close|transport error/i.test(o)){try{CB(t,"emit.ts:emitAck-disconnect-retry")}catch{}try{await new Promise(a=>{const r=setTimeout(()=>a(),1e3);t.once("connect",()=>{clearTimeout(r),a()})})}catch{}try{return await I()}catch(a){const r=String(a?.message||a||"");try{if(/operation has timed out|timeout/i.test(r)){const s=t?.io?.engine?.transport?.name,B=e?.roomId||null,c=UE[UE.length-1]?.event||"unknown";jD("socket_ack_timeout",{event:String(A),scope:String(A).includes("craps")?"craps":String(A).includes("poker")?"poker":"other",roomId:B,lastEvent:c,timeoutMs:g,connected:!!t.connected,transport:s||"unknown",phase:"retry"})}}catch{}throw a}}throw n}}async function x6(t,A,e){try{T6(A)}catch{}try{await wm(t),Ux(A,"ff"),t.emit(A,e)}catch(i){const g=String(i?.message||i||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)/i.test(g)){try{CB(t,"emit.ts:emitFF-fallback")}catch{}await new Promise(I=>{const n=setTimeout(()=>I(),800);t.once("connect",()=>{clearTimeout(n),I()})}),Ux(A,"ff"),t.emit(A,e);return}throw i}}function T6(t){new Set([ht.ROLL_DICE,ht.PLACE_MAIN_BET,ht.CREATE_SIDE_BET,ht.ACCEPT_SIDE_BET,ht.CANCEL_SIDE_BET,ht.POKER_ACT,"poker:start_hand","craps:roll"]).has(t)&&Cg()}const Y6=Ea();async function OlA(t,A,e="usd"){return await(await fetch(`${Y6}/api/payment/chips`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({amount:t,userId:A,currency:e})})).json()}async function PlA(t,A){return await(await fetch(`${Y6}/api/payment/membership`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({planId:t,userId:A})})).json()}const v4={createChipsCheckout:OlA,createMembershipCheckout:PlA},H6=p.createContext(void 0),jlA=({children:t})=>{const[A,e]=p.useState("idle"),[i,g]=p.useState(null),[I,n]=p.useState(!1),[o,a]=p.useState(!1),r=p.useCallback(async(B,c,E="usd")=>{e("loading"),g(null);try{const D=await v4.createChipsCheckout(B,c,E);return D.url?(e("success"),D.url):(e("error"),g(D.error||"Unable to start chips checkout"),null)}catch(D){return e("error"),g(D.message||"Unable to start chips checkout"),null}},[]),s=p.useCallback(async(B,c)=>{e("loading"),g(null);try{const E=await v4.createMembershipCheckout(B,c);return E.url?(e("success"),E.url):(e("error"),g(E.error||"Unable to start membership checkout"),null)}catch(E){return e("error"),g(E.message||"Unable to start membership checkout"),null}},[]);return Q.jsx(H6.Provider,{value:{status:A,error:i,startChipsCheckout:r,startMembershipCheckout:s,setStatus:e,setError:g,membershipModalOpen:I,setMembershipModalOpen:n,chipsModalOpen:o,setChipsModalOpen:a},children:t})};function _y(){const t=p.useContext(H6);return t||{status:"idle",error:null,startChipsCheckout:async()=>null,startMembershipCheckout:async()=>null,setStatus:()=>{},setError:()=>{},membershipModalOpen:!1,setMembershipModalOpen:()=>{},chipsModalOpen:!1,setChipsModalOpen:()=>{}}}function gs(){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 o=new Uint8Array(16);t.getRandomValues(o),o[6]=o[6]&15|64,o[8]=o[8]&63|128;const a=Array.from(o,r=>r.toString(16).padStart(2,"0")).join("");return`${a.slice(0,8)}-${a.slice(8,12)}-${a.slice(12,16)}-${a.slice(16,20)}-${a.slice(20)}`}}catch{}const A=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0"),e=A(),i=A().slice(0,4),g=("4"+A()).slice(0,4),I=((8+Math.floor(Math.random()*4)).toString(16)+A()).slice(0,4),n=(A()+A()).slice(0,12);return`${e}-${i}-${g}-${I}-${n}`}function ZlA(t,A){const e=p.useCallback(async()=>{if(!t)throw new Error("Socket unavailable");if(t.connected)return t;try{!t.active&&t.disconnected&&CB(t,"useEmitter.ensureConnected"),await new Promise(I=>{const n=setTimeout(()=>I(),4e3);t.once("connect",()=>{clearTimeout(n),I()})})}catch{}return t},[t]),i=p.useCallback(async(I,n,o)=>{const a=await e();let r=n;if(n&&typeof n=="object"&&!n.eventId)try{r={...n,eventId:gs()}}catch{}const s={room_create:3e4,poker_room_create:3e4},B=o?.timeoutMs||15e3,c=I in s?s[I]:B,E={...o,timeoutMs:c},D=async()=>Kx(a,I,r,E);let y,S=0;const f=2,M=async()=>{try{return await D()}catch(k){const m=String(k?.message||k||""),U=/socket connect timeout/i.test(m)||/ETIMEDOUT/i.test(m)||/timeout/i.test(m),F=/socket has been disconnected/i.test(m)||/the socket is disconnected/i.test(m);if((U||F||/connect_error|transport close|transport error/i.test(m))&&S<f){S++;const G=(/create/i.test(I)?1500:800)*Math.pow(2,S-1);try{t&&t.disconnected&&CB(t,"useSocketEmitters:backoff-retry"),await new Promise(J=>{const x=setTimeout(()=>J(),G);t?.once("connect",()=>{clearTimeout(x),J()})})}catch{}return M()}else throw k}};y=await M();try{if(y&&y.ok===!1&&(y.error==="rate_limited"||/rate[_-]?limited/i.test(y.error||"")))try{A&&A(String(I))}catch{}}catch{}return y},[e,A]),g=p.useCallback(async(I,n)=>{const o=await e();return x6(o,I,n)},[e]);return{ack:i,send:g}}function OI(){const t=Xn(),{info:A}=MQ(),e=p.useRef(0),i=p.useCallback(kA=>{const ae=Date.now();if(!(ae-e.current<1200)){e.current=ae;try{A("Please wait a moment - you're doing that too quickly.",{duration:2500})}catch{}}},[A]),{ack:g,send:I}=ZlA(t,i),{setMembershipModalOpen:n}=_y(),{user:o}=Yi(),a=p.useCallback(kA=>{const ae=(()=>{const Ye={};try{Ye.name=String(kA.name||"").trim().slice(0,60),(kA.isPrivate===!0||kA.isPrivate===!1)&&(Ye.isPrivate=!!kA.isPrivate),(kA.singlePlayer===!0||kA.singlePlayer===!1)&&(Ye.singlePlayer=!!kA.singlePlayer),typeof kA.botsPerRoom=="number"&&Number.isInteger(kA.botsPerRoom)&&(Ye.botsPerRoom=kA.botsPerRoom),(kA.gameMode==="cee-lo"||kA.gameMode==="craps")&&(Ye.gameMode=kA.gameMode),typeof kA.botLevel=="number"&&kA.botLevel>=1&&kA.botLevel<=9&&(Ye.botLevel=kA.botLevel)}catch{}return Ye})();return g(ht.CREATE_ROOM,ae).then(Ye=>{try{Ye&&Ye.ok}catch{}return Ye})},[g,n,o]),r=p.useCallback(async kA=>{const ae=async()=>g(ht.JOIN_ROOM,{roomId:kA});let Ye=await ae();if(Ye&&Ye.ok===!1&&/Room not found/i.test(String(Ye.error||""))){try{await new Promise(Pt=>setTimeout(Pt,120))}catch{}Ye=await ae(),Ye&&Ye.ok}if(Ye&&Ye.ok===!1&&Ye.error===UCA.SOCKET.NEEDS_PREMIUM)try{n(!0)}catch{}return Ye},[g,n]),s=p.useCallback(kA=>g(ht.LEAVE_ROOM,{roomId:kA}),[g]),B=p.useCallback(kA=>I(ht.LEAVE_ROOM,{roomId:kA}),[I]),c=p.useCallback((kA,ae,Ye,Pt,jt)=>g("skills:submit",{roomId:kA,path:ae,word:Ye,tsClient:Pt,seq:jt}),[g]),E=p.useCallback((kA,ae,Ye,Pt,jt)=>g("skills:tap",{roomId:kA,r:ae,c:Ye,tsClient:Pt,seq:jt}),[g]),D=p.useCallback((kA,ae)=>g("anagrams:submit",{roomId:kA,word:ae}),[g]),y=p.useCallback((kA,ae,Ye)=>g("trivia:answer",{roomId:kA,questionIndex:ae,answerIndex:Ye}),[g]),S=p.useCallback(kA=>g(ht.ROLL_DICE,{roomId:kA}),[g]),f=p.useCallback(kA=>g(ht.CONFIRM_BETS,{roomId:kA}),[g]),M=p.useCallback((kA,ae)=>g(ht.CRAPS_PLACE_PASS,{roomId:kA,amount:ae}),[g]);p.useCallback((kA,ae)=>g(ht.CRAPS_PLACE_DONT_PASS,{roomId:kA,amount:ae}),[g]);const k=p.useCallback((kA,ae,Ye)=>g(ht.CRAPS_PLACE_ODDS,{roomId:kA,amount:ae,passType:Ye}),[g]),m=p.useCallback((kA,ae,Ye)=>g(ht.CRAPS_PLACE_PLACE,{roomId:kA,amount:ae,point:Ye}),[g]),U=p.useCallback((kA,ae)=>g(ht.CRAPS_PLACE_FIELD,{roomId:kA,amount:ae}),[g]),F=p.useCallback((kA,ae,Ye)=>g(ht.CRAPS_PLACE_BIG,{roomId:kA,amount:ae,kind:Ye}),[g]),b=p.useCallback((kA,ae)=>g(ht.CRAPS_PLACE_COME,{roomId:kA,amount:ae}),[g]),K=p.useCallback((kA,ae)=>g(ht.CRAPS_PLACE_DONT_COME,{roomId:kA,amount:ae}),[g]),R=p.useCallback((kA,ae,Ye)=>g(ht.CRAPS_PLACE_COME_ODDS,{roomId:kA,point:ae,amount:Ye}),[g]),G=p.useCallback((kA,ae,Ye)=>g(ht.CRAPS_PLACE_DONT_COME_ODDS,{roomId:kA,point:ae,amount:Ye}),[g]),J=p.useCallback((kA,ae)=>g(ht.CRAPS_TOGGLE_PLACE_WORKING,{roomId:kA,working:ae}),[g]),x=p.useCallback(async kA=>{try{const ae=X.current.get(kA)||[],Ye=sA.current.get(kA);if(Ye&&(clearTimeout(Ye),sA.current.delete(kA)),ae.length>0)if(X.current.delete(kA),ae.length>1)await g("craps:add_bets_batch",{roomId:kA,bets:ae,eventId:gs()});else{const{type:Pt,amount:jt}=ae[0];await g("craps:add_bet",{roomId:kA,type:Pt,amount:jt,eventId:gs()})}}catch{}try{const ae=mA.current.get(kA)||[],Ye=IA.current.get(kA);if(Ye&&(clearTimeout(Ye),IA.current.delete(kA)),ae.length>0)if(mA.current.delete(kA),ae.length>1)await g("craps:remove_bets_batch",{roomId:kA,bets:ae,eventId:gs()});else{const{type:Pt,amount:jt}=ae[0];await g("craps:remove_bet",{roomId:kA,type:Pt,amount:jt,eventId:gs()})}}catch{}},[g]),H=p.useCallback(async kA=>{try{if(!kA)return{ok:!1,error:"no_room"}}catch{}try{await x(kA)}catch{}return g(ht.CRAPS_ROLL,{roomId:kA})},[g,x]),P=p.useCallback(kA=>g(ht.CRAPS_READY,{roomId:kA}),[g]),j=p.useCallback((kA,ae)=>g(ht.CRAPS_FETCH_HISTORY,{roomId:kA,...ae||{}}),[g]),q=p.useCallback(kA=>g("craps:get_state",{roomId:kA}),[g]),Y=p.useCallback(kA=>g("craps:join_order",{roomId:kA}),[g]),O=p.useCallback(kA=>g("craps:leave_order",{roomId:kA}),[g]),$=p.useCallback(kA=>g("craps:pass_turn",{roomId:kA}),[g]),gA=p.useCallback((kA,ae)=>g("craps:set_order",{roomId:kA,order:ae}),[g]),z=p.useCallback(kA=>g("craps:reset_shooter",{roomId:kA}),[g]),X=p.useRef(new Map),sA=p.useRef(new Map),rA=80,mA=p.useRef(new Map),IA=p.useRef(new Map),uA=80,KA=p.useCallback(kA=>g("craps:list_bets",{roomId:kA,eventId:gs()}),[g]),FA=p.useCallback((kA,ae,Ye)=>{const Pt=X.current.get(kA)||[];Pt.push({type:ae,amount:Ye}),X.current.set(kA,Pt);const jt=sA.current.get(kA);jt&&clearTimeout(jt);const aA=setTimeout(()=>{const QA=X.current.get(kA)||[];if(QA.length!==0)if(X.current.delete(kA),sA.current.delete(kA),QA.length>1)g("craps:add_bets_batch",{roomId:kA,bets:QA,eventId:gs()});else{const{type:JA,amount:ee}=QA[0];g("craps:add_bet",{roomId:kA,type:JA,amount:ee,eventId:gs()})}},rA);return sA.current.set(kA,aA),Promise.resolve({ok:!0})},[g]),RA=p.useCallback((kA,ae)=>g("craps:add_bets_batch",{roomId:kA,bets:ae,eventId:gs()}),[g]),MA=p.useCallback((kA,ae)=>g("craps:remove_bets_batch",{roomId:kA,bets:ae,eventId:gs()}),[g]),oA=p.useCallback((kA,ae,Ye)=>{const Pt=mA.current.get(kA)||[];Pt.push({type:ae,amount:Ye}),mA.current.set(kA,Pt);const jt=IA.current.get(kA);jt&&clearTimeout(jt);const aA=setTimeout(()=>{const QA=mA.current.get(kA)||[];if(QA.length!==0)if(mA.current.delete(kA),IA.current.delete(kA),QA.length>1)g("craps:remove_bets_batch",{roomId:kA,bets:QA,eventId:gs()});else{const{type:JA,amount:ee}=QA[0];g("craps:remove_bet",{roomId:kA,type:JA,amount:ee,eventId:gs()})}},uA);return IA.current.set(kA,aA),Promise.resolve({ok:!0})},[g]),AA=p.useCallback(kA=>g("craps:clear_bets",{roomId:kA,eventId:gs()}),[g]),tA=p.useCallback(kA=>g("craps:summarize",{roomId:kA}),[g]),iA=p.useCallback(kA=>g(ht.BANKER_GIVE_UP,{roomId:kA}),[g]),hA=p.useCallback(async()=>{const kA=async()=>g(ht.GET_ROOMS_LIST,{});let ae=await kA();return ae&&ae.ok===!1&&ae.error==="invalid_payload"&&(await new Promise(Ye=>setTimeout(Ye,80)),ae=await kA()),ae},[g]),DA=p.useCallback((kA,ae)=>g(ht.SPECTATE_SET,{roomId:kA,spectate:ae}),[g]),dA=p.useCallback(async(kA,ae)=>{const Ye=await g(ht.PLACE_MAIN_BET,{roomId:kA,amount:ae});try{jD("bet_place",{game:"cee-lo",type:"MAIN",amount:ae})}catch{}return Ye},[g]),SA=p.useCallback((kA,ae)=>g(ht.CANCEL_MAIN_BET,{roomId:kA,wagerId:ae}),[g]),NA=p.useCallback((kA,ae)=>g(ht.CREATE_SIDE_BET,{roomId:kA,...ae}),[g]),OA=p.useCallback((kA,ae)=>g(ht.ACCEPT_SIDE_BET,{roomId:kA,wagerId:ae}),[g]),Qe=p.useCallback((kA,ae)=>g(ht.CANCEL_SIDE_BET,{roomId:kA,wagerId:ae}),[g]),nA=p.useCallback(async kA=>{if(!kA)return{ok:!1,error:"no_room"};const ae={roomId:kA},Ye=await g(ht.GET_WAGERS,ae);return Ye&&Ye.ok,Ye},[g]),eA=p.useCallback(kA=>g(ht.RTC_JOIN,{roomId:kA}),[g]),UA=p.useCallback(kA=>{try{t?.volatile?.emit?.(ht.RTC_LEAVE,{roomId:kA})}catch{}},[t]),HA=p.useCallback(async(kA,ae,Ye)=>{try{await I(ht.RTC_SIGNAL,{roomId:kA,toPeerId:ae,payload:Ye})}catch(Pt){const jt=String(Pt?.message||Pt||"");if(/disconnect|timeout|transport/i.test(jt)){await new Promise(aA=>setTimeout(aA,200));try{await I(ht.RTC_SIGNAL,{roomId:kA,toPeerId:ae,payload:Ye})}catch{}}}},[I]),Se=p.useCallback((kA,ae)=>g(ht.RTC_SET_CAMERA_OWNER,{roomId:kA,ownerId:ae}),[g]),ne=p.useCallback(async(kA,ae)=>{try{if(!kA)return{ok:!1,error:"no_room"};const Ye=await g(ht.RTC_SET_VIDEO_ENABLED,{roomId:kA,enabled:ae});return Ye.ok,Ye}catch{}},[g,n]),Oe=p.useCallback((kA,ae)=>g(ht.ROOM_SEND_MESSAGE,{roomId:kA,text:ae}),[g]),VA=p.useCallback((kA,ae)=>g(ht.ROOM_FETCH_HISTORY,{roomId:kA,sinceTs:ae}),[g]),de=p.useCallback((kA,ae)=>g(ht.DM_SEND_MESSAGE,{toUserId:kA,text:ae}),[g]),te=p.useCallback((kA,ae)=>g(ht.DM_FETCH_HISTORY,{peerUserId:kA,sinceTs:ae}),[g]),WA=p.useCallback(()=>g(ht.LOBBY_JOIN,{}),[g]),_A=p.useCallback(()=>I(ht.LOBBY_LEAVE,{}),[I]),zA=p.useCallback(()=>g(ht.LOBBY_LIST,{}),[g]),ge=p.useCallback(kA=>g(ht.DELETE_ROOM,{roomId:kA}),[g]),he=p.useCallback(()=>g(ht.USER_GET_BALANCE,void 0),[g]),ve=p.useCallback((kA,ae)=>g(ht.SEND_FRIEND_REQUEST,{toUserId:kA,message:ae}),[g]),bA=p.useCallback(kA=>g(ht.CANCEL_FRIEND_REQUEST,{requestId:kA}),[g]),pA=p.useCallback((kA,ae)=>g(ht.RESPOND_FRIEND_REQUEST,{requestId:kA,action:ae}),[g]),Re=p.useCallback(kA=>g(ht.UNFRIEND,{otherId:kA}),[g]),CA=p.useCallback(kA=>g(ht.BLOCK_USER,{blockedId:kA}),[g]),EA=p.useCallback(kA=>g(ht.UNBLOCK_USER,{blockedId:kA}),[g]),yA=p.useCallback(()=>g(ht.SOCIAL_GET_LIST,void 0),[g]),xA=p.useCallback((kA,ae,Ye)=>g(ht.GAME_INVITE_SEND,{roomId:kA,toUserId:ae,gameMode:Ye}),[g]),XA=p.useCallback((kA,ae)=>g(ht.GAME_INVITE_RESPOND,{inviteId:kA,action:ae}),[g]),pe=p.useCallback(kA=>g(ht.QUICK_MATCH_JOIN,{gameMode:kA}),[g]),be=p.useCallback(()=>g(ht.QUICK_MATCH_LEAVE,void 0),[g]),It=p.useCallback(()=>g(ht.QUICK_MATCH_STATUS,void 0),[g]),Ut=p.useCallback(()=>g(ht.SOCIAL_ONLINE_FRIENDS,void 0),[g]),pg=p.useCallback(kA=>g(ht.USER_UPDATE_PROFILE,kA),[g]),Ge=p.useCallback(kA=>g(ht.BOTS_NUDGE,{roomId:kA??null}),[g]),lt=p.useCallback(kA=>g(ht.ROOM_REFRESH_STATE,{roomId:kA??null}),[g]),Rt=p.useCallback((kA,ae)=>I("player:visibility",{roomId:kA,visible:ae}),[I]),Yt=p.useCallback(async(kA,ae,Ye,Pt)=>g("skills:single_start",{stake:kA,gameMode:ae,duration:Ye,botLevel:Pt}),[g]),st=p.useCallback(async kA=>g("skills:ready",{roomId:kA}),[g]),Be=p.useCallback(async kA=>g("skills:room_create",kA),[g]),jA=p.useCallback(async kA=>g("skills:join_room",{roomId:kA}),[g]),Me=p.useCallback(async kA=>g("skills:leave_room",{roomId:kA}),[g]),We=p.useCallback(async kA=>g("skills:spectator_join",{roomId:kA}),[g]),at=p.useCallback(async kA=>g("skills:spectator_leave",{roomId:kA}),[g]);return{createRoom:a,joinRoom:r,leaveRoom:s,leaveRoomTearDown:B,getRoomsList:hA,setSpectate:DA,bankerGiveUp:iA,pokerCreateRoom:p.useCallback(kA=>{const ae={...kA};let Ye=ae.maxPlayers;if((typeof Ye!="number"||!Number.isInteger(Ye)||Ye<1||Ye>4)&&(Ye=ae.singlePlayer?1:4),ae.maxPlayers=Ye,typeof ae.startingStack=="number"){const Pt=Math.max(500,Math.min(1e6,Math.floor(ae.startingStack)));ae.startingStack=Pt}return ae.eliminationMode?ae.eliminationMode={enabled:!0}:delete ae.eliminationMode,typeof ae.botLevel=="number"&&ae.botLevel>=1&&ae.botLevel<=9||delete ae.botLevel,g(ht.POKER_ROOM_CREATE,ae)},[g,o,n]),pokerDeleteRoom:p.useCallback(kA=>g(ht.POKER_ROOM_DELETE,{roomId:kA}),[g]),pokerJoinRoom:p.useCallback(async kA=>g(ht.POKER_JOIN_ROOM,{roomId:kA}),[g]),pokerStartHand:p.useCallback(kA=>g(ht.POKER_START_HAND,{roomId:kA}),[g]),pokerFold:p.useCallback(kA=>g(ht.POKER_ACT,{roomId:kA,action:"fold"}),[g]),pokerCheck:p.useCallback(kA=>g(ht.POKER_ACT,{roomId:kA,action:"check"}),[g]),pokerCall:p.useCallback(kA=>g(ht.POKER_ACT,{roomId:kA,action:"call"}),[g]),pokerBet:p.useCallback((kA,ae)=>g(ht.POKER_ACT,{roomId:kA,action:"bet",amount:ae}),[g]),pokerRaise:p.useCallback((kA,ae)=>g(ht.POKER_ACT,{roomId:kA,action:"raise",amount:ae}),[g]),pokerFetchHistory:p.useCallback((kA,ae,Ye)=>g(ht.POKER_FETCH_HISTORY,{roomId:kA,limit:ae,beforeSeq:Ye}),[g]),rollDice:S,confirmBets:f,crapsPlacePass:M,crapsRoll:H,crapsPlaceOdds:k,crapsPlacePlace:m,crapsPlaceField:U,crapsPlaceBig:F,crapsPlaceCome:b,crapsPlaceDontCome:K,crapsPlaceComeOdds:R,crapsPlaceDontComeOdds:G,crapsTogglePlaceWorking:J,crapsReady:P,crapsFetchHistory:j,crapsGetState:q,crapsJoinOrder:Y,crapsLeaveOrder:O,crapsPassTurn:$,crapsSetOrder:gA,crapsResetShooter:z,crapsListBets:KA,crapsAddBet:FA,crapsBatchAddBets:RA,crapsRemoveBet:oA,crapsBatchRemoveBets:MA,crapsClearBets:AA,crapsSummarizeBets:tA,placeMainBet:dA,cancelMainBet:SA,createSideBet:NA,acceptSideBet:OA,cancelSideBet:Qe,getWagers:nA,rtcJoin:eA,rtcLeave:UA,rtcSignal:HA,rtcSetCameraOwner:Se,rtcSetVideoEnabled:ne,roomSendMessage:Oe,roomFetchHistory:VA,dmSendMessage:de,dmFetchHistory:te,lobbyJoin:WA,lobbyLeave:_A,lobbyList:zA,deleteRoom:ge,getUserBalance:he,sendFriendRequest:ve,cancelFriendRequest:bA,respondFriendRequest:pA,unfriend:Re,blockUser:CA,unblockUser:EA,getFriendsList:yA,sendGameInvite:xA,respondGameInvite:XA,quickMatchJoin:pe,quickMatchLeave:be,quickMatchStatus:It,getOnlineFriends:Ut,updateProfile:pg,botsNudge:Ge,refreshRoomState:lt,sendVisibilityChange:Rt,skillsSubmit:c,skillsTap:E,skillsSingleStart:Yt,skillsReady:st,skillsRoomCreate:Be,skillsJoinRoom:jA,skillsLeaveRoom:Me,skillsSpectatorJoin:We,skillsSpectatorLeave:at,anagramsSubmit:D,triviaAnswer:y}}const Fe={FAIRNESS_REVEAL:"fairness_reveal",GET_ROOMS_LIST:"get_rooms_list",LOBBY_ROOMS:"lobby_rooms",ROOM_CREATED:"room_created",ROOM_UPDATED:"room_updated",ROOM_DELETED:"room_deleted",JOINED_ROOM:"joined_room",REJOINED_ROOM:"rejoined_room",OTHER_JOINED:"other_player_joined_room",OTHER_LEFT:"other_player_left_room",BANKER_CHANGED:"banker_changed",DICE_ROLLED:"dice_rolled",NOT_YOUR_TURN:"not_your_turn",BETS_UPDATED:"bets_updated",GET_WAGERS:"get_wagers",PLAYER_BALANCE_UPDATED:"player_balance_updated",SIDE_BET_CREATED:"side_bet_created",SIDE_BET_ACCEPTED:"side_bet_accepted",SIDE_BET_CANCELED:"side_bet_canceled",FORCE_LOGOUT:"force_logout",ERROR:"error",RTC_SIGNAL:"rtc_signal",RTC_PEER_JOINED:"rtc_peer_joined",RTC_PEER_LEFT:"rtc_peer_left",RTC_CAMERA_OWNER_CHANGED:"rtc_camera_owner_changed",RTC_VIDEO_ENABLED:"rtc_video_enabled",ROOM_MESSAGE:"room_message",ROOM_HISTORY:"room_history",DM_MESSAGE:"dm_message",DM_HISTORY:"dm_history",FRIEND_REQUEST_RECEIVED:"friend_request_received",FRIEND_REQUEST_CANCELLED:"friend_request_cancelled",FRIEND_REQUEST_RESPONDED:"friend_request_responded",UNFRIENDED:"unfriended",USER_BLOCKED:"user_blocked",USER_UNBLOCKED:"user_unblocked",TURN_ORDER_UPDATED:"turn_order_updated",SPECTATORS_UPDATED:"spectators_updated",PLAYER_PROFILE_UPDATED:"player_profile_updated",CRAPS_ROLL:"craps:roll",CRAPS_READY_UPDATE:"craps:ready_update",CRAPS_BETS_UPDATE:"craps:bets_update",CRAPS_BET_DELTA:"craps:bet_delta",CRAPS_STATE:"craps:state",CRAPS_BET_RESULTS:"craps:bet_results",CRAPS_BET_ERROR:"craps:bet_error",CRAPS_POINT_SET:"craps:point_set",CRAPS_POINT_MADE:"craps:point_made",CRAPS_ATS_PROGRESS:"craps:ats_progress",CRAPS_ATS_SMALL_COMPLETE:"craps:ats_small_complete",CRAPS_ATS_TALL_COMPLETE:"craps:ats_tall_complete",CRAPS_ATS_ALL_COMPLETE:"craps:ats_all_complete",CRAPS_ATS_RESET:"craps:ats_reset",POKER_MY_HOLE:"poker:my_hole",POKER_WINNERS:"poker:winners",POKER_REVEAL_ALL:"poker:reveal_all",POKER_TIMED_OUT:"poker:timed_out",POKER_MY_BALANCE:"poker:my_balance",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",SKILLS_ROOM_CREATED:"skills_room_created",ROOM_UPDATE_STATE:"room:update_state",OTA_UPDATE_AVAILABLE:"ota:update_available",GAME_INVITE_RECEIVED:"game_invite:received",GAME_INVITE_CANCELLED:"game_invite:cancelled",PLAYER_PRESENCE_UPDATE:"player:presence_update",SKILLS_SUBMIT:"skills:submit",SKILLS_TAP:"skills:tap",SKILLS_SCORE_UPDATE:"skills:score_update",SKILLS_ROUND_START:"skills:round_start",SKILLS_ROUND_END:"skills:round_end"};function $n(t){const A=Xn(),e=p.useRef(t);p.useEffect(()=>{e.current=t},[t]),p.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 g=window;g.__crapsHandlersBus||(g.__crapsHandlersBus={onCrapsRollResult:new Set,onCrapsBetResults:new Set,onCrapsPointSet:new Set,onCrapsPointMade:new Set,_buffer:{onCrapsRollResult:[],onCrapsBetResults:[],onCrapsPointSet:[],onCrapsPointMade:[],push(o,a){const r=this[o];r.push(a),r.length>20&&r.shift()}}}),(()=>{const o=g.__crapsHandlers||{};o&&o.__wrappedByBus||(g.__crapsHandlers={onCrapsRollResult:a=>{try{g.__crapsHandlersBus._buffer.push("onCrapsRollResult",a)}catch{}g.__crapsHandlersBus.onCrapsRollResult.forEach(r=>{try{r(a)}catch{}});try{const r=g.__flashTest;(g.__E2E===!0||g.location?.search?.includes("e2e=1")||g.sessionStorage&&g.sessionStorage.getItem("e2e")==="1")&&r&&r.info}catch{}try{typeof o.onCrapsRollResult=="function"&&o.onCrapsRollResult(a)}catch{}},onCrapsBetResults:a=>{try{g.__crapsHandlersBus._buffer.push("onCrapsBetResults",a)}catch{}g.__crapsHandlersBus.onCrapsBetResults.forEach(r=>{try{r(a)}catch{}});try{const r=g.__flashTest;if(!(!(g.__E2E===!0||g.location?.search?.includes("e2e=1")||g.sessionStorage&&g.sessionStorage.getItem("e2e")==="1")||!r)){const B=Array.isArray(a?.settlements)?a.settlements:[],c=B.filter(y=>typeof y?.betType=="string"&&y.betType.startsWith("place")&&y.outcome==="WIN"),E=B.filter(y=>(y.betType==="pass"||y.betType==="dontPass")&&y.outcome==="WIN"),D=B.filter(y=>(y.betType==="pass"||y.betType==="dontPass")&&y.outcome==="LOSE");if(c.length>0&&typeof r.win=="function"){const y=c.reduce((S,f)=>S+(Number(f.payout)||0),0);r.win(c.length>1?"Place Wins":"Place Win",y?`+${y}`:void 0)}else if(E.length>0&&typeof r.win=="function"){const y=E.reduce((S,f)=>S+(Number(f.payout)||0)+(Number(f.amount)||0),0);r.win("Line Win",y?`+${y}`:void 0)}else if(D.length>0&&typeof r.lose=="function"){const y=D.reduce((S,f)=>S+(Number(f.amount)||0),0);r.lose("Line Lose",y?`-${y}`:void 0)}}}catch{}try{typeof o.onCrapsBetResults=="function"&&o.onCrapsBetResults(a)}catch{}},onCrapsPointSet:a=>{try{g.__crapsHandlersBus._buffer.push("onCrapsPointSet",a)}catch{}g.__crapsHandlersBus.onCrapsPointSet.forEach(r=>{try{r(a)}catch{}});try{const r=g.__flashTest;if((g.__E2E===!0||g.location?.search?.includes("e2e=1")||g.sessionStorage&&g.sessionStorage.getItem("e2e")==="1")&&r&&typeof r.info=="function"){const B=a&&(a.point??a?.state?.point);r.info("Point Set",B?`${B} is the point`:void 0)}}catch{}try{typeof o.onCrapsPointSet=="function"&&o.onCrapsPointSet(a)}catch{}},onCrapsPointMade:a=>{try{g.__crapsHandlersBus._buffer.push("onCrapsPointMade",a)}catch{}g.__crapsHandlersBus.onCrapsPointMade.forEach(r=>{try{r(a)}catch{}});try{const r=g.__flashTest;if((g.__E2E===!0||g.location?.search?.includes("e2e=1")||g.sessionStorage&&g.sessionStorage.getItem("e2e")==="1")&&r&&typeof r.win=="function"){const B=a&&(a.point??a?.state?.point);r.win("Point Made",B?`${B} hit`:void 0)}}catch{}try{typeof o.onCrapsPointMade=="function"&&o.onCrapsPointMade(a)}catch{}},__wrappedByBus:!0})})();const n={onCrapsRollResult:o=>e.current.onCrapsRollResult?.(o),onCrapsBetResults:o=>e.current.onCrapsBetResults?.(o),onCrapsPointSet:o=>e.current.onCrapsPointSet?.(o),onCrapsPointMade:o=>e.current.onCrapsPointMade?.(o)};g.__crapsHandlersBus.onCrapsRollResult.add(n.onCrapsRollResult),g.__crapsHandlersBus.onCrapsBetResults.add(n.onCrapsBetResults),g.__crapsHandlersBus.onCrapsPointSet.add(n.onCrapsPointSet),g.__crapsHandlersBus.onCrapsPointMade.add(n.onCrapsPointMade);try{const o=g.__crapsHandlersBus._buffer;if(o){for(const a of o.onCrapsRollResult)try{n.onCrapsRollResult(a)}catch{}for(const a of o.onCrapsBetResults)try{n.onCrapsBetResults(a)}catch{}for(const a of o.onCrapsPointSet)try{n.onCrapsPointSet(a)}catch{}for(const a of o.onCrapsPointMade)try{n.onCrapsPointMade(a)}catch{}}}catch{}return()=>{try{g.__crapsHandlersBus.onCrapsRollResult.delete(n.onCrapsRollResult),g.__crapsHandlersBus.onCrapsBetResults.delete(n.onCrapsBetResults),g.__crapsHandlersBus.onCrapsPointSet.delete(n.onCrapsPointSet),g.__crapsHandlersBus.onCrapsPointMade.delete(n.onCrapsPointMade)}catch{}}},[]),p.useEffect(()=>{if(!A)return;const i=pA=>e.current.onLobbyRooms?.(pA),g=pA=>e.current.onRoomCreated?.(pA),I=pA=>e.current.onRoomUpdated?.(pA),n=pA=>e.current.onRoomDeleted?.(pA),o=pA=>e.current.onJoinedRoom?.(pA),a=pA=>e.current.onRejoinedRoom?.(pA),r=pA=>{e.current.onOtherPlayerJoined?.(pA)},s=pA=>{e.current.onOtherLeft?.(pA)},B=pA=>e.current.onBankerChanged?.(pA),c=pA=>e.current.onDiceRolled?.(pA),E=()=>e.current.onNotYourTurn?.(),D=pA=>e.current.onOtaUpdateAvailable?.(pA),y=pA=>e.current.onBetsUpdated?.(pA),S=pA=>e.current.onGetWagers?.(pA),f=pA=>e.current.onPlayerBalanceUpdated?.(pA),M=pA=>e.current.onSideBetCreated?.(pA),k=pA=>e.current.onSideBetAccepted?.(pA),m=pA=>e.current.onSideBetCanceled?.(pA),U=pA=>e.current.onForceLogout?.(pA),F=pA=>e.current.onError?.(pA),b=pA=>e.current.onRtcSignal?.(pA),K=pA=>e.current.onRtcPeerJoined?.(pA),R=pA=>e.current.onRtcPeerLeft?.(pA),G=pA=>e.current.onRtcCameraOwnerChanged?.(pA),J=pA=>e.current.onRtcVideoEnabled?.(pA),x=pA=>e.current.onRoomMessage?.(pA),H=pA=>e.current.onRoomHistory?.(pA),P=pA=>e.current.onDmMessage?.(pA),j=pA=>e.current.onDmHistory?.(pA),q=pA=>e.current.onFairnessReveal?.(pA),Y=pA=>e.current.onFriendRequestReceived?.(pA),O=pA=>e.current.onFriendRequestCancelled?.(pA),$=pA=>e.current.onFriendRequestResponded?.(pA),gA=pA=>e.current.onUnfriended?.(pA),z=pA=>e.current.onUserBlocked?.(pA),X=pA=>e.current.onUserUnblocked?.(pA),sA=pA=>e.current.onGameInviteReceived?.(pA),rA=pA=>e.current.onGameInviteCancelled?.(pA),mA=pA=>e.current.onTurnOrderUpdated?.(pA),IA=pA=>e.current.onSpectatorsUpdated?.(pA),uA=pA=>e.current.onPlayerProfileUpdated?.(pA),KA=pA=>e.current.onPlayerPresenceUpdate?.(pA),FA=pA=>e.current.onPokerMyHole?.(pA),RA=pA=>e.current.onPokerWinners?.(pA),MA=pA=>e.current.onPokerRevealAll?.(pA),oA=pA=>e.current.onPokerTimedOut?.(pA),AA=pA=>e.current.onPokerMyBalance?.(pA),tA=pA=>e.current.onRoomUpdateState?.(pA),iA=pA=>pA&&(!pA.dice&&typeof pA.d1=="number"&&typeof pA.d2=="number"&&(pA.dice=[pA.d1,pA.d2]),pA.dice&&(typeof pA.d1!="number"||typeof pA.d2!="number")&&(pA.d1=pA.dice[0],pA.d2=pA.dice[1]),pA.shooterId!==void 0&&pA.currentRollerId===void 0&&(pA.currentRollerId=pA.shooterId),pA.nextShooterId!==void 0&&pA.nextRollerId===void 0&&(pA.nextRollerId=pA.nextShooterId),pA),hA=pA=>{e.current.onCrapsRollResult?.(iA(pA))},DA=pA=>{e.current.onCrapsReadyUpdate?.(pA)},dA=pA=>{e.current.onCrapsBetsUpdate?.(pA)},SA=pA=>{e.current.onCrapsBetDelta?.(pA)},NA=pA=>{e.current.onCrapsBetResults?.(pA)},OA=pA=>{e.current.onCrapsBetError?.(pA)},Qe=pA=>{e.current.onCrapsPointSet?.(pA)},nA=pA=>{e.current.onCrapsPointMade?.(pA)},eA=pA=>e.current.onSkillsRejoinedRoom?.(pA),UA=pA=>e.current.onSkillsScoreUpdate?.(pA),HA=pA=>e.current.onSkillsRoundStart?.(pA),Se=pA=>e.current.onSkillsRoundEnd?.(pA),ne=pA=>e.current.onSkillsSessionInfo?.(pA),Oe=pA=>e.current.onAnagramsWordFound?.(pA),VA=pA=>e.current.onTriviaAnswer?.(pA),de=pA=>e.current.onTriviaNextQuestion?.(pA),te=pA=>e.current.onSkillsSpectatorState?.(pA),WA=pA=>e.current.onSkillsSpectatorUpdate?.(pA),_A=pA=>e.current.onSkillsSpectatorJoined?.(pA),zA=pA=>e.current.onSkillsSpectatorLeft?.(pA),ge=pA=>e.current.onSkillsWordClaimed?.(pA),he=()=>{A.on(Fe.LOBBY_ROOMS,i),A.on(Fe.ROOM_CREATED,g);try{A.on(Fe.POKER_ROOM_CREATED,g)}catch{}try{A.on(Fe.SKILLS_ROOM_CREATED,g)}catch{}A.on(Fe.ROOM_UPDATED,I);try{A.on(Fe.POKER_ROOM_UPDATED,I)}catch{}A.on(Fe.ROOM_DELETED,n);try{A.on(Fe.POKER_ROOM_DELETED,n)}catch{}A.on(Fe.JOINED_ROOM,o);try{A.on(Fe.POKER_JOINED_ROOM,o)}catch{}A.on(Fe.REJOINED_ROOM,a),A.on(Fe.OTHER_JOINED,r),A.on(Fe.POKER_OTHER_JOINED,r),A.on(Fe.OTHER_LEFT,s),A.on(Fe.BANKER_CHANGED,B),A.on(Fe.DICE_ROLLED,c),A.on(Fe.NOT_YOUR_TURN,E),A.on(Fe.OTA_UPDATE_AVAILABLE,D),A.on(Fe.BETS_UPDATED,y),A.on(Fe.GET_WAGERS,S),A.on(Fe.PLAYER_BALANCE_UPDATED,f),A.on(Fe.SIDE_BET_CREATED,M),A.on(Fe.SIDE_BET_ACCEPTED,k),A.on(Fe.SIDE_BET_CANCELED,m),A.on(Fe.FORCE_LOGOUT,U),A.on(Fe.ERROR,F),A.on(Fe.RTC_SIGNAL,b),A.on(Fe.RTC_PEER_JOINED,K),A.on(Fe.RTC_PEER_LEFT,R),A.on(Fe.RTC_CAMERA_OWNER_CHANGED,G),A.on(Fe.RTC_VIDEO_ENABLED,J),A.on(Fe.ROOM_MESSAGE,x),A.on(Fe.ROOM_HISTORY,H),A.on(Fe.DM_MESSAGE,P),A.on(Fe.DM_HISTORY,j),A.on(Fe.FAIRNESS_REVEAL,q),A.on(Fe.FRIEND_REQUEST_RECEIVED,Y),A.on(Fe.FRIEND_REQUEST_CANCELLED,O),A.on(Fe.FRIEND_REQUEST_RESPONDED,$),A.on(Fe.UNFRIENDED,gA),A.on(Fe.USER_BLOCKED,z),A.on(Fe.USER_UNBLOCKED,X),A.on(Fe.GAME_INVITE_RECEIVED,sA),A.on(Fe.GAME_INVITE_CANCELLED,rA),A.on(Fe.TURN_ORDER_UPDATED,mA),A.on(Fe.SPECTATORS_UPDATED,IA),A.on(Fe.PLAYER_PROFILE_UPDATED,uA),A.on(Fe.PLAYER_PRESENCE_UPDATE,KA),A.on(Fe.CRAPS_ROLL,hA),A.on(Fe.CRAPS_READY_UPDATE,DA),A.on(Fe.CRAPS_BETS_UPDATE,dA),A.on(Fe.CRAPS_BET_DELTA,SA),A.on(Fe.CRAPS_BET_RESULTS,NA),A.on(Fe.CRAPS_BET_ERROR,OA),A.on(Fe.CRAPS_POINT_SET,Qe),A.on(Fe.CRAPS_POINT_MADE,nA),A.on(Fe.POKER_MY_HOLE,FA),A.on(Fe.POKER_WINNERS,RA),A.on(Fe.POKER_REVEAL_ALL,MA),A.on(Fe.POKER_TIMED_OUT,oA),A.on(Fe.POKER_MY_BALANCE,AA),A.on(Fe.ROOM_UPDATE_STATE,tA);const pA=Re=>e.current.onCrapsState?.(Re);return A.on(Fe.CRAPS_STATE,pA),A.on("skills:rejoined_room",eA),A.on(Fe.SKILLS_SCORE_UPDATE,UA),A.on(Fe.SKILLS_ROUND_START,HA),A.on(Fe.SKILLS_ROUND_END,Se),A.on("skills:session_info",ne),A.on("anagrams:word_found",Oe),A.on("trivia:answer",VA),A.on("trivia:next_question",de),A.on("skills:spectator_state",te),A.on("skills:spectator_update",WA),A.on("skills:spectator_joined",_A),A.on("skills:spectator_left",zA),A.on("skills:word_claimed",ge),()=>{A.off(Fe.LOBBY_ROOMS,i),A.off(Fe.ROOM_CREATED,g);try{A.off(Fe.POKER_ROOM_CREATED,g)}catch{}try{A.off(Fe.SKILLS_ROOM_CREATED,g)}catch{}A.off(Fe.ROOM_UPDATED,I);try{A.off(Fe.POKER_ROOM_UPDATED,I)}catch{}A.off(Fe.ROOM_DELETED,n);try{A.off(Fe.POKER_ROOM_DELETED,n)}catch{}A.off(Fe.JOINED_ROOM,o);try{A.off(Fe.POKER_JOINED_ROOM,o)}catch{}A.off(Fe.REJOINED_ROOM,a),A.off(Fe.OTHER_JOINED,r);try{A.off(Fe.POKER_OTHER_JOINED,r)}catch{}A.off(Fe.OTHER_LEFT,s),A.off(Fe.BANKER_CHANGED,B),A.off(Fe.DICE_ROLLED,c),A.off(Fe.NOT_YOUR_TURN,E),A.off(Fe.OTA_UPDATE_AVAILABLE,D),A.off(Fe.BETS_UPDATED,y),A.off(Fe.GET_WAGERS,S),A.off(Fe.PLAYER_BALANCE_UPDATED,f),A.off(Fe.SIDE_BET_CREATED,M),A.off(Fe.SIDE_BET_ACCEPTED,k),A.off(Fe.SIDE_BET_CANCELED,m),A.off(Fe.FORCE_LOGOUT,U),A.off(Fe.ERROR,F),A.off(Fe.RTC_SIGNAL,b),A.off(Fe.RTC_PEER_JOINED,K),A.off(Fe.RTC_PEER_LEFT,R),A.off(Fe.RTC_CAMERA_OWNER_CHANGED,G),A.off(Fe.RTC_VIDEO_ENABLED,J),A.off(Fe.ROOM_MESSAGE,x),A.off(Fe.ROOM_HISTORY,H),A.off(Fe.DM_MESSAGE,P),A.off(Fe.DM_HISTORY,j),A.off(Fe.FAIRNESS_REVEAL,q),A.off(Fe.FRIEND_REQUEST_RECEIVED,Y),A.off(Fe.FRIEND_REQUEST_CANCELLED,O),A.off(Fe.FRIEND_REQUEST_RESPONDED,$),A.off(Fe.UNFRIENDED,gA),A.off(Fe.USER_BLOCKED,z),A.off(Fe.USER_UNBLOCKED,X),A.off(Fe.GAME_INVITE_RECEIVED,sA),A.off(Fe.GAME_INVITE_CANCELLED,rA),A.off(Fe.TURN_ORDER_UPDATED,mA),A.off(Fe.SPECTATORS_UPDATED,IA),A.off(Fe.PLAYER_PROFILE_UPDATED,uA),A.off(Fe.PLAYER_PRESENCE_UPDATE,KA),A.off(Fe.CRAPS_ROLL,hA),A.off(Fe.CRAPS_READY_UPDATE,DA),A.off(Fe.CRAPS_BETS_UPDATE,dA),A.off(Fe.CRAPS_BET_DELTA,SA),A.off(Fe.CRAPS_BET_RESULTS,NA),A.off(Fe.CRAPS_BET_ERROR,OA),A.off(Fe.CRAPS_POINT_SET,Qe),A.off(Fe.CRAPS_POINT_MADE,nA),A.off(Fe.POKER_MY_HOLE,FA),A.off(Fe.POKER_WINNERS,RA),A.off(Fe.POKER_REVEAL_ALL,MA),A.off(Fe.POKER_TIMED_OUT,oA),A.off(Fe.POKER_MY_BALANCE,AA),A.off(Fe.ROOM_UPDATE_STATE,tA),A.off(Fe.CRAPS_STATE,pA),A.off("skills:rejoined_room",eA),A.off(Fe.SKILLS_SCORE_UPDATE,UA),A.off(Fe.SKILLS_ROUND_START,HA),A.off(Fe.SKILLS_ROUND_END,Se),A.off("skills:session_info",ne),A.off("anagrams:word_found",Oe),A.off("trivia:answer",VA),A.off("trivia:next_question",de),A.off("skills:spectator_state",te),A.off("skills:spectator_update",WA),A.off("skills:spectator_joined",_A),A.off("skills:spectator_left",zA),A.off("skills:word_claimed",ge)}};let ve=he();const bA=()=>{try{ve&&ve()}catch{}ve=he();try{pi(async()=>{const{reRegisterPushToken:pA}=await Promise.resolve().then(()=>pXA);return{reRegisterPushToken:pA}},void 0,import.meta.url).then(({reRegisterPushToken:pA})=>{pA()}).catch(()=>{})}catch{}};return A.on("connect",bA),A.on("reconnect",bA),()=>{A.off("connect",bA),A.off("reconnect",bA);try{ve&&ve()}catch{}}},[A])}function G2(){const{getRoomsList:t,createRoom:A,lobbyJoin:e,lobbyLeave:i}=OI(),[g,I]=p.useState({public:[],private:[]}),[n,o]=p.useState(!0),[a,r]=p.useState(null),{setMembershipModalOpen:s}=_y(),{resetSpin:B}=kQ(),c=globalThis.__lastRoomsFetchAt||(globalThis.__lastRoomsFetchAt={}),E=600,D=(b,K)=>{switch(b){case"skills":return`/skills/play?roomId=${K}`;case"zentara":return`/zentara/match/${K}`;case"cee-lo":return`/room/${K}`;case"craps":return`/room/${K}`;case"poker":return`/poker/room/${K}`;default:return`/room/${K}`}},y=p.useCallback(async()=>{const b=Date.now(),K=c.t||0;if(!(b-K<E)){c.t=b,o(!0),r(null);try{const R=await t();if(R?.ok){const G=R.public&&R.private?{public:R.public,private:R.private}:null,J=R.data||R.roomsList||{},x=J.public&&J.private?{public:J.public,private:J.private}:null,H=G||x||{public:[],private:[]};I({public:Array.isArray(H.public)?H.public:[],private:Array.isArray(H.private)?H.private:[]})}else throw new Error(R?.error??"Failed to load rooms.")}catch(R){r(R?.message??"Failed to load rooms.")}finally{o(!1)}}},[t]),S=globalThis.__lobbyState||(globalThis.__lobbyState={refCount:0,joined:!1}),f=p.useCallback(async(b=!1)=>{S.refCount++,(!S.joined||b)&&(S.joined=!0,await e())},[e]),M=p.useCallback(async()=>{S.refCount=Math.max(0,S.refCount-1),S.refCount===0&&S.joined&&(S.joined=!1,await i())},[i]),k=globalThis.__createRoomGuard||(globalThis.__createRoomGuard={}),m=800,U=p.useCallback(async b=>{const K=Date.now(),R=k.lastAt||0;if(K-R<m&&k.inFlight)try{return await k.inFlight}catch{}const G=async()=>{let H=0;if(K-R<m){const P=m-(K-R);await new Promise(j=>setTimeout(j,Math.max(50,P)))}for(;H<3;){H++;const P=await A({name:b.name,isPrivate:b.isPrivate,singlePlayer:b.singlePlayer,gameMode:b.gameMode,botLevel:b.botLevel});if(!P||P.ok===!0||P?.ok===!1&&P.error!=="rate_limited"&&!/rate[_-]?limited/i.test(P.error||""))return P;const j=180*H,q=Math.floor(Math.random()*140);await new Promise(Y=>setTimeout(Y,j+q))}return A({name:b.name,isPrivate:b.isPrivate,singlePlayer:b.singlePlayer,gameMode:b.gameMode,botLevel:b.botLevel})};o(!0),r(null),k.lastAt=Date.now();const J=G();k.inFlight=J;try{const x=await J;if(!x?.ok)return x;const H=x.room||x.roomsList?.room||null;if(H){const P={roomId:H.roomId,name:H.name,createdAt:H.createdAt,maxPlayers:H.maxPlayers,currentPlayers:H.players?.length??1,phase:H.gameState?.phase??"waiting",private:!!H.private,gameMode:H.gameMode||H.gameState?.gameMode||"cee-lo"};I(j=>j.public.some(q=>q.roomId===P.roomId)||j.private.some(q=>q.roomId===P.roomId)?j:P.private?{...j,private:[P,...j.private]}:{...j,public:[P,...j.public]})}else await y();return B(),x}catch(x){const H=x?.message??"Failed to create room.";throw r(H),x}finally{o(!1),k.inFlight=null}},[A,y,s,B]),F=Xn();return p.useEffect(()=>(f(),()=>{M()}),[]),p.useEffect(()=>{if(!F)return;let b=!0;const K=async()=>{if(b){b=!1;return}await f(!0),await y()},R=()=>{S.joined=!1};return F.on("connect",K),F.on("disconnect",R),()=>{F.off("connect",K),F.off("disconnect",R)}},[F,f,y]),p.useEffect(()=>{y()},[y]),$n({onRoomCreated:b=>{I(K=>b.private?{...K,private:[b,...K.private.filter(R=>R.roomId!==b.roomId)]}:{...K,public:[b,...K.public.filter(R=>R.roomId!==b.roomId)]})},onRoomDeleted:({roomId:b})=>{I(K=>({public:K.public.filter(R=>R.roomId!==b),private:K.private.filter(R=>R.roomId!==b)}))},onRoomUpdated:b=>{I(K=>({public:K.public.map(R=>R.roomId===b.roomId?{...R,currentPlayers:b.currentPlayers??R.currentPlayers,phase:b.phase??R.phase}:R),private:K.private.map(R=>R.roomId===b.roomId?{...R,currentPlayers:b.currentPlayers??R.currentPlayers,phase:b.phase??R.phase}:R)}))}}),{roomsList:g,loading:n,error:a,refreshRooms:y,createRoom:U,getGameRoute:D}}const WlA=[0,100,250,500,1e3,2500,5e3],zlA=[15,30,45,60,90,120],VlA=[{value:"wordsearch",label:"🔤 Word Search"},{value:"anagrams",label:"🔀 Anagrams"},{value:"trivia",label:"❓ Trivia"}];function XlA({gameMode:t}){const[A,e]=p.useState(""),[i,g]=p.useState(2),[I,n]=p.useState(!1),[o,a]=p.useState(!1),[r,s]=p.useState(!1),[B,c]=p.useState(1e3),[E,D]=p.useState(100),[y,S]=p.useState(30),[f,M]=p.useState("wordsearch"),[k,m]=p.useState(!1),[U,F]=p.useState(null),[b,K]=p.useState(null),R=Di(),{createRoom:G}=G2(),{pokerCreateRoom:J,skillsRoomCreate:x}=OI(),H=t==="skills",P=async j=>{j.preventDefault(),F(null),m(!0);try{const q=t||"cee-lo";let Y;if(q==="zentara"){const O=crypto.randomUUID().slice(0,8);R(`/zentara/match/${O}`);return}else q==="poker"?Y=await J({name:A,maxPlayers:i,isPrivate:I,singlePlayer:o,eliminationMode:r,startingStack:B}):q==="skills"?Y=await x({name:A,maxPlayers:i,isPrivate:I,stake:E,duration:y,gameMode:f}):Y=await G({name:A,maxPlayers:i,isPrivate:I,singlePlayer:o,gameMode:q});if(!Y?.ok)F(Y?.error||"Failed to create room");else{const O=Y?.room??Y?.roomsList?.room??Y?.data?.room??null,$=O?.roomId??O?.id??Y?.roomId??Y?.data?.roomId;R($?q==="poker"?`/poker/room/${$}`:q==="skills"?`/skills/room/${$}`:`/room/${$}`:q==="poker"?"/poker":q==="skills"?"/skills/play":"/")}}catch{F("Unexpected error")}finally{m(!1)}};return b?Q.jsxs("div",{className:"create-room-success",children:[Q.jsx("h2",{children:"Room Created!"}),Q.jsxs("p",{children:["Your room ",Q.jsx("strong",{children:b.name})," (ID: ",Q.jsx("code",{children:b.roomId}),") has been created."]})]}):Q.jsxs("form",{className:"create-room-form",onSubmit:P,children:[Q.jsx("h2",{children:"Create a New Room"}),Q.jsxs("label",{children:["Room Name",Q.jsx("input",{type:"text",value:A,onChange:j=>e(j.target.value),required:!0,disabled:k,className:"create-room-input",placeholder:"Enter room name"})]}),Q.jsxs("label",{children:["Max Players",Q.jsx("input",{type:"number",value:i,min:2,max:H?4:10,className:"create-room-input",onChange:j=>g(Number(j.target.value)),required:!0,disabled:k})]}),H&&Q.jsxs(Q.Fragment,{children:[Q.jsxs("label",{children:["Game Mode",Q.jsx("select",{value:f,onChange:j=>M(j.target.value),className:"create-room-input",disabled:k,children:VlA.map(j=>Q.jsx("option",{value:j.value,children:j.label},j.value))})]}),Q.jsxs("label",{children:["Bet Amount",Q.jsx("select",{value:E,onChange:j=>D(Number(j.target.value)),className:"create-room-input",disabled:k,children:WlA.map(j=>Q.jsx("option",{value:j,children:j===0?"Free Play":`${j.toLocaleString()} Credits`},j))})]}),Q.jsxs("label",{children:["Game Duration",Q.jsx("select",{value:y,onChange:j=>S(Number(j.target.value)),className:"create-room-input",disabled:k,children:zlA.map(j=>Q.jsxs("option",{value:j,children:[j," seconds"]},j))})]})]}),t==="poker"&&Q.jsxs("label",{children:["Buy-In Amount",Q.jsx("input",{type:"number",value:B,min:500,max:25e3,step:100,className:"create-room-input",onChange:j=>c(Math.max(500,Math.min(25e3,Number(j.target.value)))),required:!0,disabled:k})]}),t==="poker"&&!o&&Q.jsxs("label",{className:"create-room-elim-toggle",children:[Q.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:r,onChange:j=>s(j.target.checked),disabled:k}),"Elimination Mode",Q.jsx("span",{className:"create-room-elim-hint",children:"Players lose shields on losses & get knocked out"})]}),Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:I,onChange:j=>n(j.target.checked),disabled:k}),"Private room (invite only)"]}),U&&Q.jsx("p",{className:"error",children:U}),Q.jsx("button",{className:"felt-btn",type:"submit",disabled:k,children:k?"Creating...":"Create Room"})]})}function O6(t){p.useEffect(()=>{if(!(typeof document>"u")){if(t){try{Sm(!0)}catch{}try{js()}catch{}try{document.body.classList.add("modal-open")}catch{}}else{try{Sm(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}return()=>{try{Sm(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}}},[t])}function $lA({open:t,onClose:A,gameMode:e}){const[i,g]=p.useState(e||"cee-lo");O6(!!t),p.useEffect(()=>{const n=o=>{o.key==="Escape"&&A()};return t&&document.addEventListener("keydown",n),()=>document.removeEventListener("keydown",n)},[t,A]),p.useEffect(()=>{e&&g(e)},[e]);const I=i==="craps"?"Craps":i==="poker"?"Poker":i==="skills"?"Skills":i==="zentara"?"Zentara":"Cee‑Lo";return t?Q.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:A,children:Q.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Create a room",onClick:n=>n.stopPropagation(),children:[Q.jsx("button",{className:"modal-close",onClick:A,"aria-label":"Close",children:"×"}),Q.jsx("h3",{className:"modal-title",children:"Create a Room"}),Q.jsxs("p",{"aria-live":"polite",className:"modal-subtitle",children:["Game mode: ",Q.jsx("strong",{children:I})]}),Q.jsx(XlA,{gameMode:i})]})}):null}function _4({rooms:t,title:A,onJoinClick:e,spectateMode:i}){const g=Di(),[I,n]=p.useState(null);if(t.length===0)return Q.jsx("div",{className:"room-list",children:"No rooms available."});const o=async(a,r)=>{if(!I){n(a);try{if(e&&await e(),i&&r==="skills")return g(`/skills/spectate/${a}`);if(r==="poker")return g(`/poker/room/${a}`);if(r==="skills")return g(`/skills/room/${a}`);g(`/room/${a}`)}catch{n(null)}}};return Q.jsxs("div",{className:"room-list",children:[Q.jsx("h3",{children:A}),Q.jsx("ul",{children:[...new Set(t)].filter(a=>!a.singlePlayer).map(a=>Q.jsxs("li",{className:"room-list__item",children:[Q.jsxs("div",{className:"room-list__info",children:[Q.jsx("span",{className:"room-list__name",children:a.name}),a.private&&Q.jsx("span",{className:"room-list__private",children:"🔒"}),Q.jsxs("span",{className:"room-list__players",children:[a.currentPlayers,"/",a.maxPlayers]}),Q.jsx("span",{className:"room-list__phase",children:a.phase??"waiting"}),a.gameMode&&Q.jsx("span",{className:"room-list__mode",title:"Game Mode",children:a.gameMode}),a.gameMode==="skills"&&Q.jsxs(Q.Fragment,{children:[typeof a.stake=="number"&&Q.jsxs("span",{className:"room-list__stake",title:"Bet Amount",children:["💰 ",a.stake===0?"Free":a.stake.toLocaleString()]}),typeof a.duration=="number"&&Q.jsxs("span",{className:"room-list__duration",title:"Game Duration",children:["⏱️ ",a.duration,"s"]})]}),Q.jsx("span",{className:"room-list__created",children:new Date(a.createdAt).toLocaleTimeString()})]}),Q.jsx("button",{className:`btn btn--join ${i&&a.gameMode==="skills"?"btn--spectate":""} ${I===a.roomId?"btn--loading":""}`,onClick:()=>o(a.roomId,a.gameMode),disabled:I!==null,children:I===a.roomId?Q.jsx("span",{className:"btn-spinner"}):i&&a.gameMode==="skills"?"👁️ Spectate":"Join"})]},a.roomId))})]})}function AQA({open:t,onClose:A,isPrivate:e,setIsPrivate:i,roomsList:g,onJoinClick:I,loading:n}){const o=p.useRef(null),[a,r]=p.useState(!1);return p.useEffect(()=>{if(!t)return;const s=c=>{c.key==="Escape"&&A()},B=c=>{o.current&&!o.current.contains(c.target)&&A()};return document.addEventListener("keydown",s),document.addEventListener("mousedown",B),()=>{document.removeEventListener("keydown",s),document.removeEventListener("mousedown",B)}},[t,A]),t?Q.jsx("div",{className:"modal-backdrop",role:"presentation",children:Q.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Browse Rooms",ref:o,children:[Q.jsx("button",{className:"modal-close",onClick:A,"aria-label":"Close",children:"×"}),Q.jsx("h3",{className:"modal-title",children:"Browse Rooms"}),Q.jsxs("div",{style:{display:"flex",gap:16,marginBottom:12,flexWrap:"wrap"},children:[Q.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[Q.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:e,onChange:s=>i(s.target.checked)}),Q.jsxs("span",{children:[e?"Private":"Public"," Rooms"]})]}),Q.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[Q.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:a,onChange:s=>r(s.target.checked)}),Q.jsx("span",{children:"👁️ Spectate Mode"})]})]}),n?Q.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"32px 0"},children:Q.jsx("div",{className:"home-preloader__spinner",style:{width:32,height:32}})}):e?g.private.length?Q.jsx(_4,{title:"Private Rooms",rooms:g.private,onJoinClick:I,spectateMode:a}):Q.jsx("p",{children:"No private rooms available."}):g.public.length?Q.jsx(_4,{title:"Public Rooms",rooms:g.public,onJoinClick:I,spectateMode:a}):Q.jsx("p",{children:"No public rooms available."})]})}):null}function eQA({anchorRef:t,open:A,onClose:e,items:i}){const g=p.useRef(null);return p.useEffect(()=>{if(!A)return;const I=o=>{const a=o.target,r=!!g.current?.contains(a),s=!!t.current?.contains(a);!r&&!s&&e()},n=o=>{o.key==="Escape"&&e()};return document.addEventListener("mousedown",I,!0),document.addEventListener("keydown",n),()=>{document.removeEventListener("mousedown",I,!0),document.removeEventListener("keydown",n)}},[A,e,t]),A?Q.jsx("div",{ref:g,className:"settings-menu",role:"menu","aria-orientation":"vertical",children:i.map(I=>Q.jsxs("button",{className:"settings-menu__item",role:"menuitem",onClick:()=>{I.onClick?.(),e()},children:[I.label,(I.badge??0)>0&&Q.jsx("span",{className:"settings-menu__badge",children:I.badge>99?"99+":I.badge})]},I.key))}):null}const gC={diceAudio:!0,backgroundMusic:!0,chatAudio:!1,video:!1,showAnimations:!0,lastGameMode:"cee-lo",diceColorTheme:"dice_white_black",theme:"dark"},P6="app:settings:v1";async function jo(){try{const{value:t}=await nr.get({key:P6});if(!t)return{...gC};const A=JSON.parse(t);return{...gC,...A}}catch{return{...gC}}}async function VE(t){await nr.set({key:P6,value:JSON.stringify(t)})}const j6=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SETTINGS:gC,loadSettings:jo,saveSettings:VE},Symbol.toStringTag,{value:"Module"})),er=mB("App",{web:()=>pi(()=>import("./web-D5QpaxP0.js"),[],import.meta.url).then(t=>new t.AppWeb)}),Z6=Object.freeze(Object.defineProperty({__proto__:null,App:er},Symbol.toStringTag,{value:"Module"}));var tQA=Object.create,W6=Object.defineProperty,iQA=Object.getOwnPropertyDescriptor,gQA=(t,A)=>(A=Symbol[t])?A:Symbol.for("Symbol."+t),z6=t=>{throw TypeError(t)},V6=(t,A,e)=>A in t?W6(t,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[A]=e,IQA=t=>[,,,tQA(null)],X6=["class","method","getter","setter","accessor","field","value","get","set"],$6=t=>t!==void 0&&typeof t!="function"?z6("Function expected"):t,nQA=(t,A,e,i,g)=>({kind:X6[t],name:A,metadata:i,addInitializer:I=>e._?z6("Already initialized"):g.push($6(I||null))}),oQA=(t,A)=>V6(A,gQA("metadata"),t[3]),aQA=(t,A,e,i)=>{for(var g=0,I=t[A>>1],n=I&&I.length;g<n;g++)I[g].call(e);return i},rQA=(t,A,e,i,g,I)=>{for(var n,o,a,r,s=A&7,B=!1,c=!1,E=2,D=X6[s+5],y=t[E]||(t[E]=[]),S=(g=g.prototype,iQA(g,e)),f=i.length-1;f>=0;f--)a=nQA(s,e,o={},t[3],y),a.static=B,a.private=c,r=a.access={has:M=>e in M},r.get=M=>M[e],s>2,n=(0,i[f])(S[D],a),o._=1,$6(n)&&(S[D]=n);return S&&W6(g,e,S),g},ft=(t,A,e)=>V6(t,typeof A!="symbol"?A+"":A,e);const sQA="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(sQA);const R2=1,U2=2,A7=4,CQA=8,BQA=16,cQA=1,lQA=2,QQA=4,EQA=8,uQA=16,hQA=1,dQA=2,pQA=4,fQA=1,DQA=2,pr=Symbol(),l0="http://www.w3.org/2000/svg";function yQA(t){return t.endsWith("capture")&&t!=="gotpointercapture"&&t!=="lostpointercapture"}const SQA=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function wQA(t){return SQA.includes(t)}const mQA={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject"};function kQA(t){return t=t.toLowerCase(),mQA[t]??t}const MQA=["touchstart","touchmove"];function NQA(t){return MQA.includes(t)}const GQA=!1;var NF=Array.isArray,RQA=Array.prototype.indexOf,K2=Array.from,UQA=Object.defineProperty,JE=Object.getOwnPropertyDescriptor,e7=Object.getOwnPropertyDescriptors,KQA=Object.prototype,FQA=Array.prototype,F2=Object.getPrototypeOf;function $f(t){return typeof t=="function"}const qg=()=>{};function bQA(t){return t()}function Fx(t){for(var A=0;A<t.length;A++)t[A]()}const fB=2,t7=4,Dk=8,GF=16,kB=32,yk=64,CU=128,Zd=256,BU=512,Fr=1024,XE=2048,Sk=4096,vc=8192,Jy=16384,i7=32768,Eu=65536,vQA=1<<17,_QA=1<<19,g7=1<<20,LE=Symbol("$state"),I7=Symbol("legacy props"),JQA=Symbol("");function n7(t){return t===this.v}function o7(t,A){return t!=t?A==A:t!==A||t!==null&&typeof t=="object"||typeof t=="function"}function b2(t){return!o7(t,this.v)}function LQA(t){throw new Error("https://svelte.dev/e/effect_in_teardown")}function qQA(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function xQA(t){throw new Error("https://svelte.dev/e/effect_orphan")}function TQA(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function YQA(t){throw new Error("https://svelte.dev/e/props_invalid_value")}function HQA(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function OQA(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function PQA(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function jQA(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let Ly=!1,ZQA=!1;function WQA(){Ly=!0}function as(t,A){var e={f:0,v:t,reactions:null,equals:n7,rv:0,wv:0};return e}function Ki(t){return a7(as(t))}function RF(t,A=!1){var e;const i=as(t);return A||(i.equals=b2),Ly&&mg!==null&&mg.l!==null&&((e=mg.l).s??(e.s=[])).push(i),i}function $C(t,A=!1){return a7(RF(t,A))}function a7(t){return jg!==null&&(jg.f&fB)!==0&&(_c===null?IEA([t]):_c.push(t)),t}function Et(t,A){return jg!==null&&x2()&&(jg.f&(fB|GF))!==0&&(_c===null||!_c.includes(t))&&jQA(),bx(t,A)}function bx(t,A){return t.equals(A)||(t.v,t.v=A,t.wv=S7(),r7(t,XE),x2()&&Ti!==null&&(Ti.f&Fr)!==0&&(Ti.f&kB)===0&&(Qa!==null&&Qa.includes(t)?(MB(Ti,XE),bF(Ti)):qE===null?nEA([t]):qE.push(t))),A}function r7(t,A){var e=t.reactions;if(e!==null)for(var i=x2(),g=e.length,I=0;I<g;I++){var n=e[I],o=n.f;(o&XE)===0&&(!i&&n===Ti||(MB(n,A),(o&(Fr|Zd))!==0&&((o&fB)!==0?r7(n,Sk):bF(n))))}}let v2=!1;function Xt(t,A=null,e){if(typeof t!="object"||t===null||LE in t)return t;const i=F2(t);if(i!==KQA&&i!==FQA)return t;var g=new Map,I=NF(t),n=as(0);I&&g.set("length",as(t.length));var o;return new Proxy(t,{defineProperty(a,r,s){(!("value"in s)||s.configurable===!1||s.enumerable===!1||s.writable===!1)&&HQA();var B=g.get(r);return B===void 0?(B=as(s.value),g.set(r,B)):Et(B,Xt(s.value,o)),!0},deleteProperty(a,r){var s=g.get(r);if(s===void 0)r in a&&g.set(r,as(pr));else{if(I&&typeof r=="string"){var B=g.get("length"),c=Number(r);Number.isInteger(c)&&c<B.v&&Et(B,c)}Et(s,pr),J4(n)}return!0},get(a,r,s){var B;if(r===LE)return t;var c=g.get(r),E=r in a;if(c===void 0&&(!E||(B=JE(a,r))!=null&&B.writable)&&(c=as(Xt(E?a[r]:pr,o)),g.set(r,c)),c!==void 0){var D=cA(c);return D===pr?void 0:D}return Reflect.get(a,r,s)},getOwnPropertyDescriptor(a,r){var s=Reflect.getOwnPropertyDescriptor(a,r);if(s&&"value"in s){var B=g.get(r);B&&(s.value=cA(B))}else if(s===void 0){var c=g.get(r),E=c?.v;if(c!==void 0&&E!==pr)return{enumerable:!0,configurable:!0,value:E,writable:!0}}return s},has(a,r){var s;if(r===LE)return!0;var B=g.get(r),c=B!==void 0&&B.v!==pr||Reflect.has(a,r);if(B!==void 0||Ti!==null&&(!c||(s=JE(a,r))!=null&&s.writable)){B===void 0&&(B=as(c?Xt(a[r],o):pr),g.set(r,B));var E=cA(B);if(E===pr)return!1}return c},set(a,r,s,B){var c,E=g.get(r),D=r in a;if(I&&r==="length")for(var y=s;y<E.v;y+=1){var S=g.get(y+"");S!==void 0?Et(S,pr):y in a&&(S=as(pr),g.set(y+"",S))}E===void 0?(!D||(c=JE(a,r))!=null&&c.writable)&&(E=as(void 0),Et(E,Xt(s,o)),g.set(r,E)):(D=E.v!==pr,Et(E,Xt(s,o)));var f=Reflect.getOwnPropertyDescriptor(a,r);if(f!=null&&f.set&&f.set.call(B,s),!D){if(I&&typeof r=="string"){var M=g.get("length"),k=Number(r);Number.isInteger(k)&&k>=M.v&&Et(M,k+1)}J4(n)}return!0},ownKeys(a){cA(n);var r=Reflect.ownKeys(a).filter(c=>{var E=g.get(c);return E===void 0||E.v!==pr});for(var[s,B]of g)B.v!==pr&&!(s in a)&&r.push(s);return r},setPrototypeOf(){OQA()}})}function J4(t,A=1){Et(t,t.v+A)}var L4,s7,C7;function zQA(){if(L4===void 0){L4=window;var t=Element.prototype,A=Node.prototype;s7=JE(A,"firstChild").get,C7=JE(A,"nextSibling").get,t.__click=void 0,t.__className="",t.__attributes=null,t.__styles=null,t.__e=void 0,Text.prototype.__t=void 0}}function wk(t=""){return document.createTextNode(t)}function fd(t){return s7.call(t)}function UF(t){return C7.call(t)}function _e(t,A){return fd(t)}function Bi(t,A){{var e=fd(t);return e instanceof Comment&&e.data===""?UF(e):e}}function St(t,A=1,e=!1){let i=t;for(;A--;)i=UF(i);return i}function VQA(t){t.textContent=""}function je(t){var A=fB|XE;Ti===null?A|=Zd:Ti.f|=g7;var e=jg!==null&&(jg.f&fB)!==0?jg:null;const i={children:null,ctx:mg,deps:null,equals:n7,f:A,fn:t,reactions:null,rv:0,v:null,wv:0,parent:e??Ti};return e!==null&&(e.children??(e.children=[])).push(i),i}function yD(t){const A=je(t);return A.equals=b2,A}function B7(t){var A=t.children;if(A!==null){t.children=null;for(var e=0;e<A.length;e+=1){var i=A[e];(i.f&fB)!==0?_2(i):CC(i)}}}function XQA(t){for(var A=t.parent;A!==null;){if((A.f&fB)===0)return A;A=A.parent}return null}function c7(t){var A,e=Ti;br(XQA(t));try{B7(t),A=w7(t)}finally{br(e)}return A}function l7(t){var A=c7(t),e=(jh||(t.f&Zd)!==0)&&t.deps!==null?Sk:Fr;MB(t,e),t.equals(A)||(t.v=A,t.wv=S7())}function _2(t){B7(t),E0(t,0),MB(t,Jy),t.v=t.children=t.deps=t.ctx=t.reactions=null}function Q7(t){Ti===null&&jg===null&&xQA(),jg!==null&&(jg.f&Zd)!==0&&qQA(),q2&&LQA()}function $QA(t,A){var e=A.last;e===null?A.last=A.first=t:(e.next=t,t.prev=e,A.last=t)}function qy(t,A,e,i=!0){var g=(t&yk)!==0,I=Ti,n={ctx:mg,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:t|XE,first:null,fn:A,last:null,next:null,parent:g?null:I,prev:null,teardown:null,transitions:null,wv:0};if(e){var o=SD;try{q4(!0),kk(n),n.f|=i7}catch(s){throw CC(n),s}finally{q4(o)}}else A!==null&&bF(n);var a=e&&n.deps===null&&n.first===null&&n.nodes_start===null&&n.teardown===null&&(n.f&g7)===0;if(!a&&!g&&i&&(I!==null&&$QA(n,I),jg!==null&&(jg.f&fB)!==0)){var r=jg;(r.children??(r.children=[])).push(n)}return n}function E7(t){const A=qy(Dk,null,!1);return MB(A,Fr),A.teardown=t,A}function zD(t){Q7();var A=Ti!==null&&(Ti.f&kB)!==0&&mg!==null&&!mg.m;if(A){var e=mg;(e.e??(e.e=[])).push({fn:t,effect:Ti,reaction:jg})}else{var i=KF(t);return i}}function AEA(t){return Q7(),FF(t)}function eEA(t){const A=qy(yk,t,!0);return(e={})=>new Promise(i=>{e.outro?Dd(A,()=>{CC(A),i(void 0)}):(CC(A),i(void 0))})}function KF(t){return qy(t7,t,!1)}function Cc(t,A){var e=mg,i={effect:null,ran:!1};e.l.r1.push(i),i.effect=FF(()=>{t(),!i.ran&&(i.ran=!0,Et(e.l.r2,!0),cQ(A))})}function tEA(){var t=mg;FF(()=>{if(cA(t.l.r2)){for(var A of t.l.r1){var e=A.effect;(e.f&Fr)!==0&&MB(e,Sk),xy(e)&&kk(e),A.ran=!1}t.l.r2.v=!1}})}function FF(t){return qy(Dk,t,!0)}function dt(t){return uu(t)}function uu(t,A=0){return qy(Dk|GF|A,t,!0)}function aC(t,A=!0){return qy(Dk|kB,t,!0,A)}function u7(t){var A=t.teardown;if(A!==null){const e=q2,i=jg;x4(!0),BC(null);try{A.call(null)}finally{x4(e),BC(i)}}}function h7(t){var A=t.deriveds;if(A!==null){t.deriveds=null;for(var e=0;e<A.length;e+=1)_2(A[e])}}function d7(t,A=!1){var e=t.first;for(t.first=t.last=null;e!==null;){var i=e.next;CC(e,A),e=i}}function iEA(t){for(var A=t.first;A!==null;){var e=A.next;(A.f&kB)===0&&CC(A),A=e}}function CC(t,A=!0){var e=!1;if((A||(t.f&_QA)!==0)&&t.nodes_start!==null){for(var i=t.nodes_start,g=t.nodes_end;i!==null;){var I=i===g?null:UF(i);i.remove(),i=I}e=!0}d7(t,A&&!e),h7(t),E0(t,0),MB(t,Jy);var n=t.transitions;if(n!==null)for(const a of n)a.stop();u7(t);var o=t.parent;o!==null&&o.first!==null&&p7(t),t.next=t.prev=t.teardown=t.ctx=t.deps=t.fn=t.nodes_start=t.nodes_end=null}function p7(t){var A=t.parent,e=t.prev,i=t.next;e!==null&&(e.next=i),i!==null&&(i.prev=e),A!==null&&(A.first===t&&(A.first=i),A.last===t&&(A.last=e))}function Dd(t,A){var e=[];J2(t,e,!0),f7(e,()=>{CC(t),A&&A()})}function f7(t,A){var e=t.length;if(e>0){var i=()=>--e||A();for(var g of t)g.out(i)}else A()}function J2(t,A,e){if((t.f&vc)===0){if(t.f^=vc,t.transitions!==null)for(const n of t.transitions)(n.is_global||e)&&A.push(n);for(var i=t.first;i!==null;){var g=i.next,I=(i.f&Eu)!==0||(i.f&kB)!==0;J2(i,A,I?e:!1),i=g}}}function Q0(t){D7(t,!0)}function D7(t,A){if((t.f&vc)!==0){xy(t)&&kk(t),t.f^=vc;for(var e=t.first;e!==null;){var i=e.next,g=(e.f&Eu)!==0||(e.f&kB)!==0;D7(e,g?A:!1),e=i}if(t.transitions!==null)for(const I of t.transitions)(I.is_global||A)&&I.in()}}let vx=!1,_x=[];function gEA(){vx=!1;const t=_x.slice();_x=[],Fx(t)}function Wd(t){vx||(vx=!0,queueMicrotask(gEA)),_x.push(t)}function L2(t){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let mm=!1,cU=!1,lU=null,SD=!1,q2=!1;function q4(t){SD=t}function x4(t){q2=t}let Jx=[],km=0,jg=null;function BC(t){jg=t}let Ti=null;function br(t){Ti=t}let _c=null;function IEA(t){_c=t}let Qa=null,Is=0,qE=null;function nEA(t){qE=t}let y7=1,Lx=0,jh=!1,mg=null;function T4(t){mg=t}function S7(){return++y7}function x2(){return!Ly||mg!==null&&mg.l===null}function xy(t){var A,e=t.f;if((e&XE)!==0)return!0;if((e&Sk)!==0){var i=t.deps,g=(e&Zd)!==0;if(i!==null){var I,n,o=(e&BU)!==0,a=g&&Ti!==null&&!jh,r=i.length;if(o||a){for(I=0;I<r;I++)n=i[I],(o||!((A=n?.reactions)!=null&&A.includes(t)))&&(n.reactions??(n.reactions=[])).push(t);o&&(t.f^=BU)}for(I=0;I<r;I++)if(n=i[I],xy(n)&&l7(n),n.wv>t.wv)return!0}(!g||Ti!==null&&!jh)&&MB(t,Fr)}return!1}function oEA(t,A){for(var e=A;e!==null;){if((e.f&CU)!==0)try{e.fn(t);return}catch{e.f^=CU}e=e.parent}throw mm=!1,t}function aEA(t){return(t.f&Jy)===0&&(t.parent===null||(t.parent.f&CU)===0)}function S_(){mm=!1}function mk(t,A,e,i){if(mm){if(e===null&&(mm=!1),aEA(A))throw t;return}e!==null&&(mm=!0);{oEA(t,A);return}}function w7(t){var A,e=Qa,i=Is,g=qE,I=jg,n=jh,o=_c,a=mg,r=t.f;Qa=null,Is=0,qE=null,jg=(r&(kB|yk))===0?t:null,jh=!SD&&(r&Zd)!==0,_c=null,mg=t.ctx,Lx++;try{var s=(0,t.fn)(),B=t.deps;if(Qa!==null){var c;if(E0(t,Is),B!==null&&Is>0)for(B.length=Is+Qa.length,c=0;c<Qa.length;c++)B[Is+c]=Qa[c];else t.deps=B=Qa;if(!jh)for(c=Is;c<B.length;c++)((A=B[c]).reactions??(A.reactions=[])).push(t)}else B!==null&&Is<B.length&&(E0(t,Is),B.length=Is);return s}finally{Qa=e,Is=i,qE=g,jg=I,jh=n,_c=o,mg=a}}function rEA(t,A){let e=A.reactions;if(e!==null){var i=RQA.call(e,t);if(i!==-1){var g=e.length-1;g===0?e=A.reactions=null:(e[i]=e[g],e.pop())}}e===null&&(A.f&fB)!==0&&(Qa===null||!Qa.includes(A))&&(MB(A,Sk),(A.f&(Zd|BU))===0&&(A.f^=BU),E0(A,0))}function E0(t,A){var e=t.deps;if(e!==null)for(var i=A;i<e.length;i++)rEA(t,e[i])}function kk(t){var A=t.f;if((A&Jy)===0){MB(t,Fr);var e=Ti,i=mg;Ti=t;try{(A&GF)!==0?iEA(t):d7(t),h7(t),u7(t);var g=w7(t);t.teardown=typeof g=="function"?g:null,t.wv=y7;var I=t.deps,n;GQA&&ZQA&&t.f&XE}catch(o){mk(o,t,e,i||t.ctx)}finally{Ti=e}}}function sEA(){if(km>1e3){km=0;try{TQA()}catch(t){if(lU!==null)mk(t,lU,null);else throw t}}km++}function CEA(t){var A=t.length;if(A!==0){sEA();var e=SD;SD=!0;try{for(var i=0;i<A;i++){var g=t[i];(g.f&Fr)===0&&(g.f^=Fr);var I=[];m7(g,I),BEA(I)}}finally{SD=e}}}function BEA(t){var A=t.length;if(A!==0)for(var e=0;e<A;e++){var i=t[e];if((i.f&(Jy|vc))===0)try{xy(i)&&(kk(i),i.deps===null&&i.first===null&&i.nodes_start===null&&(i.teardown===null?p7(i):i.fn=null))}catch(g){mk(g,i,null,i.ctx)}}}function cEA(){if(cU=!1,km>1001)return;const t=Jx;Jx=[],CEA(t),cU||(km=0,lU=null)}function bF(t){cU||(cU=!0,queueMicrotask(cEA)),lU=t;for(var A=t;A.parent!==null;){A=A.parent;var e=A.f;if((e&(yk|kB))!==0){if((e&Fr)===0)return;A.f^=Fr}}Jx.push(A)}function m7(t,A){var e=t.first,i=[];A:for(;e!==null;){var g=e.f,I=(g&kB)!==0,n=I&&(g&Fr)!==0,o=e.next;if(!n&&(g&vc)===0)if((g&Dk)!==0){if(I)e.f^=Fr;else try{xy(e)&&kk(e)}catch(B){mk(B,e,null,e.ctx)}var a=e.first;if(a!==null){e=a;continue}}else(g&t7)!==0&&i.push(e);if(o===null){let B=e.parent;for(;B!==null;){if(t===B)break A;var r=B.next;if(r!==null){e=r;continue A}B=B.parent}}e=o}for(var s=0;s<i.length;s++)a=i[s],A.push(a),m7(a,A)}function cA(t){var A,e=t.f,i=(e&fB)!==0;if(i&&(e&Jy)!==0){var g=c7(t);return _2(t),g}if(jg!==null){_c!==null&&_c.includes(t)&&PQA();var I=jg.deps;t.rv<Lx&&(t.rv=Lx,Qa===null&&I!==null&&I[Is]===t?Is++:Qa===null?Qa=[t]:Qa.push(t),qE!==null&&Ti!==null&&(Ti.f&Fr)!==0&&(Ti.f&kB)===0&&qE.includes(t)&&(MB(Ti,XE),bF(Ti)))}else if(i&&t.deps===null)for(var n=t,o=n.parent,a=n;o!==null;)if((o.f&fB)!==0){var r=o;a=r,o=r.parent}else{var s=o;(A=s.deriveds)!=null&&A.includes(a)||(s.deriveds??(s.deriveds=[])).push(a);break}return i&&(n=t,xy(n)&&l7(n)),t.v}function cQ(t){const A=jg;try{return jg=null,t()}finally{jg=A}}const lEA=-7169;function MB(t,A){t.f=t.f&lEA|A}function fa(t){return k7().get(t)}function w_(t,A){return k7().set(t,A),A}function k7(t){return mg===null&&L2(),mg.c??(mg.c=new Map(QEA(mg)||void 0))}function QEA(t){let A=t.p;for(;A!==null;){const e=A.c;if(e!==null)return e;A=A.p}return null}function ni(t,A=!1,e){mg={p:mg,c:null,e:null,m:!1,s:t,x:null,l:null},Ly&&!A&&(mg.l={s:null,u:null,r1:[],r2:as(!1)})}function oi(t){const A=mg;if(A!==null){t!==void 0&&(A.x=t);const n=A.e;if(n!==null){var e=Ti,i=jg;A.e=null;try{for(var g=0;g<n.length;g++){var I=n[g];br(I.effect),BC(I.reaction),KF(I.fn)}}finally{br(e),BC(i)}}mg=A.p,A.m=!0}return t||{}}function BR(t){if(!(typeof t!="object"||!t||t instanceof EventTarget)){if(LE in t)qx(t);else if(!Array.isArray(t))for(let A in t){const e=t[A];typeof e=="object"&&e&&LE in e&&qx(e)}}}function qx(t,A=new Set){if(typeof t=="object"&&t!==null&&!(t instanceof EventTarget)&&!A.has(t)){A.add(t),t instanceof Date&&t.getTime();for(let i in t)try{qx(t[i],A)}catch{}const e=F2(t);if(e!==Object.prototype&&e!==Array.prototype&&e!==Map.prototype&&e!==Set.prototype&&e!==Date.prototype){const i=e7(e);for(let g in i){const I=i[g].get;if(I)try{I.call(t)}catch{}}}}}function EEA(t,A){if(A){const e=document.body;t.autofocus=!0,Wd(()=>{document.activeElement===e&&t.focus()})}}function uEA(t){var A=jg,e=Ti;BC(null),br(null);try{return t()}finally{BC(A),br(e)}}const M7=new Set,xx=new Set;function N7(t,A,e,i){function g(I){if(i.capture||gm.call(A,I),!I.cancelBubble)return uEA(()=>e.call(this,I))}return t.startsWith("pointer")||t.startsWith("touch")||t==="wheel"?Wd(()=>{A.addEventListener(t,g,i)}):A.addEventListener(t,g,i),g}function Uc(t,A,e,i,g){var I={capture:i,passive:g},n=N7(t,A,e,I);(A===document.body||A===window||A===document)&&E7(()=>{A.removeEventListener(t,n,I)})}function vF(t){for(var A=0;A<t.length;A++)M7.add(t[A]);for(var e of xx)e(t)}function gm(t){var A,e=this,i=e.ownerDocument,g=t.type,I=((A=t.composedPath)==null?void 0:A.call(t))||[],n=I[0]||t.target,o=0,a=t.__root;if(a){var r=I.indexOf(a);if(r!==-1&&(e===document||e===window)){t.__root=e;return}var s=I.indexOf(e);if(s===-1)return;r<=s&&(o=r)}if(n=I[o]||t.target,n!==e){UQA(t,"currentTarget",{configurable:!0,get(){return n||i}});var B=jg,c=Ti;BC(null),br(null);try{for(var E,D=[];n!==null;){var y=n.assignedSlot||n.parentNode||n.host||null;try{var S=n["__"+g];if(S!==void 0&&!n.disabled)if(NF(S)){var[f,...M]=S;f.apply(n,[t,...M])}else S.call(n,t)}catch(k){E?D.push(k):E=k}if(t.cancelBubble||y===e||y===null)break;n=y}if(E){for(let k of D)queueMicrotask(()=>{throw k});throw E}}finally{t.__root=e,delete t.currentTarget,BC(B),br(c)}}}function T2(t){var A=document.createElement("template");return A.innerHTML=t,A.content}function yd(t,A){var e=Ti;e.nodes_start===null&&(e.nodes_start=t,e.nodes_end=A)}function ot(t,A){var e=(A&fQA)!==0,i=(A&DQA)!==0,g,I=!t.startsWith("<!>");return()=>{g===void 0&&(g=T2(I?t:"<!>"+t),e||(g=fd(g)));var n=i?document.importNode(g,!0):g.cloneNode(!0);if(e){var o=fd(n),a=n.lastChild;yd(o,a)}else yd(n,n);return n}}function Wc(t,A,e="svg"){var i=!t.startsWith("<!>"),g=`<${e}>${i?t:"<!>"+t}</${e}>`,I;return()=>{if(!I){var n=T2(g),o=fd(n);I=fd(o)}var a=I.cloneNode(!0);return yd(a,a),a}}function Lg(t=""){{var A=wk(t+"");return yd(A,A),A}}function Ig(){var t=document.createDocumentFragment(),A=document.createComment(""),e=wk();return t.append(A,e),yd(A,e),t}function ue(t,A){t!==null&&t.before(A)}let QU=!0;function Y4(t){QU=t}function Oi(t,A){var e=A==null?"":typeof A=="object"?A+"":A;e!==(t.__t??(t.__t=t.nodeValue))&&(t.__t=e,t.nodeValue=e==null?"":e+"")}function Tx(t,A){return hEA(t,A)}const lf=new Map;function hEA(t,{target:A,anchor:e,props:i={},events:g,context:I,intro:n=!0}){zQA();var o=new Set,a=B=>{for(var c=0;c<B.length;c++){var E=B[c];if(!o.has(E)){o.add(E);var D=NQA(E);A.addEventListener(E,gm,{passive:D});var y=lf.get(E);y===void 0?(document.addEventListener(E,gm,{passive:D}),lf.set(E,1)):lf.set(E,y+1)}}};a(K2(M7)),xx.add(a);var r=void 0,s=eEA(()=>{var B=e??A.appendChild(wk());return aC(()=>{if(I){ni({});var c=mg;c.c=I}g&&(i.$$events=g),QU=n,r=t(B,i)||{},QU=!0,I&&oi()}),()=>{var c;for(var E of o){A.removeEventListener(E,gm);var D=lf.get(E);--D===0?(document.removeEventListener(E,gm),lf.delete(E)):lf.set(E,D)}xx.delete(a),B!==e&&((c=B.parentNode)==null||c.removeChild(B))}});return Yx.set(r,s),r}let Yx=new WeakMap;function cR(t,A){const e=Yx.get(t);return e?(Yx.delete(t),e(A)):Promise.resolve()}function Kt(t,A,e=!1){var i=t,g=null,I=null,n=pr,o=e?Eu:0,a=!1;const r=(B,c=!0)=>{a=!0,s(c,B)},s=(B,c)=>{n!==(n=B)&&(n?(g?Q0(g):c&&(g=aC(()=>c(i))),I&&Dd(I,()=>{I=null})):(I?Q0(I):c&&(I=aC(()=>c(i))),g&&Dd(g,()=>{g=null})))};uu(()=>{a=!1,A(r),a||s(null,null)},o)}function VD(t,A){return A}function dEA(t,A,e,i){for(var g=[],I=A.length,n=0;n<I;n++)J2(A[n].e,g,!0);var o=I>0&&g.length===0&&e!==null;if(o){var a=e.parentNode;VQA(a),a.append(e),i.clear(),SE(t,A[0].prev,A[I-1].next)}f7(g,()=>{for(var r=0;r<I;r++){var s=A[r];o||(i.delete(s.k),SE(t,s.prev,s.next)),CC(s.e,!o)}})}function XD(t,A,e,i,g,I=null){var n=t,o={flags:A,items:new Map,first:null},a=(A&A7)!==0;if(a){var r=t;n=r.appendChild(wk())}var s=null,B=!1;uu(()=>{var c=e(),E=NF(c)?c:c==null?[]:K2(c),D=E.length;if(!(B&&D===0)){B=D===0;{var y=jg;pEA(E,o,n,g,A,(y.f&vc)!==0,i)}I!==null&&(D===0?s?Q0(s):s=aC(()=>I(n)):s!==null&&Dd(s,()=>{s=null})),e()}})}function pEA(t,A,e,i,g,I,n,o){var a,r,s,B,c=(g&CQA)!==0,E=(g&(R2|U2))!==0,D=t.length,y=A.items,S=A.first,f=S,M,k=null,m,U=[],F=[],b,K,R,G;if(c)for(G=0;G<D;G+=1)b=t[G],K=n(b,G),R=y.get(K),R!==void 0&&((a=R.a)==null||a.measure(),(m??(m=new Set)).add(R));for(G=0;G<D;G+=1){if(b=t[G],K=n(b,G),R=y.get(K),R===void 0){var J=f?f.e.nodes_start:e;k=DEA(J,A,k,k===null?A.first:k.next,b,K,G,i,g),y.set(K,k),U=[],F=[],f=k.next;continue}if(E&&fEA(R,b,G,g),(R.e.f&vc)!==0&&(Q0(R.e),c&&((r=R.a)==null||r.unfix(),(m??(m=new Set)).delete(R))),R!==f){if(M!==void 0&&M.has(R)){if(U.length<F.length){var x=F[0],H;k=x.prev;var P=U[0],j=U[U.length-1];for(H=0;H<U.length;H+=1)H4(U[H],x,e);for(H=0;H<F.length;H+=1)M.delete(F[H]);SE(A,P.prev,j.next),SE(A,k,P),SE(A,j,x),f=x,k=j,G-=1,U=[],F=[]}else M.delete(R),H4(R,f,e),SE(A,R.prev,R.next),SE(A,R,k===null?A.first:k.next),SE(A,k,R),k=R;continue}for(U=[],F=[];f!==null&&f.k!==K;)(I||(f.e.f&vc)===0)&&(M??(M=new Set)).add(f),F.push(f),f=f.next;if(f===null)continue;R=f}U.push(R),k=R,f=R.next}if(f!==null||M!==void 0){for(var q=M===void 0?[]:K2(M);f!==null;)(I||(f.e.f&vc)===0)&&q.push(f),f=f.next;var Y=q.length;if(Y>0){var O=(g&A7)!==0&&D===0?e:null;if(c){for(G=0;G<Y;G+=1)(s=q[G].a)==null||s.measure();for(G=0;G<Y;G+=1)(B=q[G].a)==null||B.fix()}dEA(A,q,O,y)}}c&&Wd(()=>{var $;if(m!==void 0)for(R of m)($=R.a)==null||$.apply()}),Ti.first=A.first&&A.first.e,Ti.last=k&&k.e}function fEA(t,A,e,i){(i&R2)!==0&&bx(t.v,A),(i&U2)!==0?bx(t.i,e):t.i=e}function DEA(t,A,e,i,g,I,n,o,a,r){var s=(a&R2)!==0,B=(a&BQA)===0,c=s?B?RF(g):as(g):g,E=(a&U2)===0?n:as(n),D={i:E,v:c,k:I,a:null,e:null,prev:e,next:i};try{return D.e=aC(()=>o(t,c,E),v2),D.e.prev=e&&e.e,D.e.next=i&&i.e,e===null?A.first=D:(e.next=D,e.e.next=D.e),i!==null&&(i.prev=D,i.e.prev=D.e),D}finally{}}function H4(t,A,e){for(var i=t.next?t.next.e.nodes_start:e,g=A?A.e.nodes_start:e,I=t.e.nodes_start;I!==i;){var n=UF(I);g.before(I),I=n}}function SE(t,A,e){A===null?t.first=e:(A.next=e,A.e.next=e&&e.e),e!==null&&(e.prev=A,e.e.prev=A&&A.e)}function hu(t,A,e,i,g){var I=t,n="",o;uu(()=>{n!==(n=A()??"")&&(o!==void 0&&(CC(o),o=void 0),n!==""&&(o=aC(()=>{var a=n+"",r=T2(a);yd(fd(r),r.lastChild),I.before(r)})))})}function yEA(t,A,e,i,g){var I,n=(I=A.$$slots)==null?void 0:I[e],o=!1;n===!0&&(n=A.children,o=!0),n===void 0||n(t,o?()=>i:i)}function Bn(t,A,...e){var i=t,g=qg,I;uu(()=>{g!==(g=A())&&(I&&(CC(I),I=null),I=aC(()=>g(i,...e)))},Eu)}function SEA(t,A,e){var i=t,g,I;uu(()=>{g!==(g=A())&&(I&&(Dd(I),I=null),g&&(I=aC(()=>e(i,g))))},Eu)}function EU(t,A,e,i,g,I){var n,o,a=null,r=t,s;uu(()=>{const B=A()||null;var c=B==="svg"?l0:null;B!==n&&(s&&(B===null?Dd(s,()=>{s=null,o=null}):B===o?Q0(s):(CC(s),Y4(!1))),B&&B!==o&&(s=aC(()=>{if(a=c?document.createElementNS(c,B):document.createElement(B),yd(a,a),i){var E=a.appendChild(wk());i(a,E)}Ti.nodes_end=a,r.before(a)})),n=B,n&&(o=n),Y4(!0))},Eu)}function Vt(t,A){Wd(()=>{var e=t.getRootNode(),i=e.host?e:e.head??e.ownerDocument.head;if(!i.querySelector("#"+A.hash)){const g=document.createElement("style");g.id=A.hash,g.textContent=A.code,i.appendChild(g)}})}function G7(t){var A,e,i="";if(typeof t=="string"||typeof t=="number")i+=t;else if(typeof t=="object")if(Array.isArray(t)){var g=t.length;for(A=0;A<g;A++)t[A]&&(e=G7(t[A]))&&(i&&(i+=" "),i+=e)}else for(e in t)t[e]&&(i&&(i+=" "),i+=e);return i}function wEA(){for(var t,A,e=0,i="",g=arguments.length;e<g;e++)(t=arguments[e])&&(A=G7(t))&&(i&&(i+=" "),i+=A);return i}function R7(t){return typeof t=="object"?wEA(t):t??""}function mEA(t,A){A?t.hasAttribute("selected")||t.setAttribute("selected",""):t.removeAttribute("selected")}function qt(t,A,e,i){var g=t.__attributes??(t.__attributes={});g[A]!==(g[A]=e)&&(A==="style"&&"__styles"in t&&(t.__styles={}),A==="loading"&&(t[JQA]=e),e==null?t.removeAttribute(A):typeof e!="string"&&U7(t).includes(A)?t[A]=e:t.setAttribute(A,e))}function uU(t,A,e,i,g=!1,I=!1,n=!1){var o=A||{},a=t.tagName==="OPTION";for(var r in A)r in e||(e[r]=null);e.class&&(e.class=R7(e.class)),i!==void 0&&(e.class=e.class?e.class+" "+i:i);var s=U7(t),B=t.__attributes??(t.__attributes={});for(const f in e){let M=e[f];if(a&&f==="value"&&M==null){t.value=t.__value="",o[f]=M;continue}var c=o[f];if(M!==c){o[f]=M;var E=f[0]+f[1];if(E!=="$$"){if(E==="on"){const k={},m="$$"+f;let U=f.slice(2);var D=wQA(U);if(yQA(U)&&(U=U.slice(0,-7),k.capture=!0),!D&&c){if(M!=null)continue;t.removeEventListener(U,o[m],k),o[m]=null}if(M!=null)if(D)t[`__${U}`]=M,vF([U]);else{let F=function(b){o[f].call(this,b)};o[m]=N7(U,t,F,k)}else D&&(t[`__${U}`]=void 0)}else if(f==="style"&&M!=null)t.style.cssText=M+"";else if(f==="autofocus")EEA(t,!!M);else if(f==="__value"||f==="value"&&M!=null)t.value=t[f]=t.__value=M;else if(f==="selected"&&a)mEA(t,M);else{var y=f;g||(y=kQA(y));var S=y==="defaultValue"||y==="defaultChecked";if(M==null&&!I&&!S)if(B[f]=null,y==="value"||y==="checked"){let k=t;if(y==="value"){let m=k.defaultValue;k.removeAttribute(y),k.defaultValue=m}else{let m=k.defaultChecked;k.removeAttribute(y),k.defaultChecked=m}}else t.removeAttribute(f);else S||s.includes(y)&&(I||typeof M!="string")?t[y]=M:typeof M!="function"&&qt(t,y,M)}f==="style"&&"__styles"in t&&(t.__styles={})}}}return o}var O4=new Map;function U7(t){var A=O4.get(t.nodeName);if(A)return A;O4.set(t.nodeName,A=[]);for(var e,i=t,g=Element.prototype;g!==i;){e=e7(i);for(var I in e)e[I].set&&A.push(I);i=F2(i)}return A}function kEA(t,A,e){var i=t.__className,g=K7(A,e);(i!==g||v2)&&(g===""?t.removeAttribute("class"):t.setAttribute("class",g),t.__className=g)}function $E(t,A,e){var i=t.__className,g=K7(A,e);(i!==g||v2)&&(A==null&&!e?t.removeAttribute("class"):t.className=g,t.__className=g)}function K7(t,A){return(t??"")+(A?" "+A:"")}function IQ(t,A,e){if(e){if(t.classList.contains(A))return;t.classList.add(A)}else{if(!t.classList.contains(A))return;t.classList.remove(A)}}const MEA=()=>performance.now(),Ol={tick:t=>requestAnimationFrame(t),now:()=>MEA(),tasks:new Set};function F7(){const t=Ol.now();Ol.tasks.forEach(A=>{A.c(t)||(Ol.tasks.delete(A),A.f())}),Ol.tasks.size!==0&&Ol.tick(F7)}function NEA(t){let A;return Ol.tasks.size===0&&Ol.tick(F7),{promise:new Promise(e=>{Ol.tasks.add(A={c:t,f:e})}),abort(){Ol.tasks.delete(A)}}}function hN(t,A){t.dispatchEvent(new CustomEvent(A))}function GEA(t){if(t==="float")return"cssFloat";if(t==="offset")return"cssOffset";if(t.startsWith("--"))return t;const A=t.split("-");return A.length===1?A[0]:A[0]+A.slice(1).map(e=>e[0].toUpperCase()+e.slice(1)).join("")}function P4(t){const A={},e=t.split(";");for(const i of e){const[g,I]=i.split(":");if(!g||I===void 0)break;const n=GEA(g.trim());A[n]=I.trim()}return A}const REA=t=>t;function b7(t,A,e,i){var g=(t&hQA)!==0,I=(t&dQA)!==0,n=g&&I,o=(t&pQA)!==0,a=n?"both":g?"in":"out",r,s=A.inert,B,c;function E(){var M=jg,k=Ti;BC(null),br(null);try{return r??(r=e()(A,i?.()??{},{direction:a}))}finally{BC(M),br(k)}}var D={is_global:o,in(){var M;if(A.inert=s,!g){c?.abort(),(M=c?.reset)==null||M.call(c);return}I||B==null||B.abort(),hN(A,"introstart"),B=Hx(A,E(),c,1,()=>{hN(A,"introend"),B?.abort(),B=r=void 0})},out(M){if(!I){M?.(),r=void 0;return}A.inert=!0,hN(A,"outrostart"),c=Hx(A,E(),B,0,()=>{hN(A,"outroend"),M?.()})},stop:()=>{B?.abort(),c?.abort()}},y=Ti;if((y.transitions??(y.transitions=[])).push(D),g&&QU){var S=o;if(!S){for(var f=y.parent;f&&(f.f&Eu)!==0;)for(;(f=f.parent)&&(f.f&GF)===0;);S=!f||(f.f&i7)!==0}S&&KF(()=>{cQ(()=>D.in())})}}function Hx(t,A,e,i,g){var I=i===1;if($f(A)){var n,o=!1;return Wd(()=>{if(!o){var S=A({direction:I?"in":"out"});n=Hx(t,S,e,i,g)}}),{abort:()=>{o=!0,n?.abort()},deactivate:()=>n.deactivate(),reset:()=>n.reset(),t:()=>n.t()}}if(e?.deactivate(),!(A!=null&&A.duration))return g(),{abort:qg,deactivate:qg,reset:qg,t:()=>i};const{delay:a=0,css:r,tick:s,easing:B=REA}=A;var c=[];if(I&&e===void 0&&(s&&s(0,1),r)){var E=P4(r(0,1));c.push(E,E)}var D=()=>1-i,y=t.animate(c,{duration:a});return y.onfinish=()=>{var S=e?.t()??1-i;e?.abort();var f=i-S,M=A.duration*Math.abs(f),k=[];if(M>0){if(r)for(var m=Math.ceil(M/16.666666666666668),U=0;U<=m;U+=1){var F=S+f*B(U/m),b=r(F,1-F);k.push(P4(b))}D=()=>{var K=y.currentTime;return S+f*B(K/M)},s&&NEA(()=>{if(y.playState!=="running")return!1;var K=D();return s(K,1-K),!0})}y=t.animate(k,{duration:M,fill:"forwards"}),y.onfinish=()=>{D=()=>i,s?.(i,1-i),g()}},{abort:()=>{y&&(y.cancel(),y.effect=null,y.onfinish=qg)},deactivate:()=>{g=qg},reset:()=>{i===0&&s?.(1,0)},t:()=>D()}}function j4(t,A){return t===A||t?.[LE]===A}function v7(t={},A,e,i){return KF(()=>{var g,I;return FF(()=>{g=I,I=[],cQ(()=>{t!==e(...I)&&(A(t,...I),g&&j4(e(...g),t)&&A(null,...g))})}),()=>{Wd(()=>{I&&j4(e(...I),t)&&A(null,...I)})}}),t}function hC(t=!1){const A=mg,e=A.l.u;if(!e)return;let i=()=>BR(A.s);if(t){let g=0,I={};const n=je(()=>{let o=!1;const a=A.s;for(const r in a)a[r]!==I[r]&&(I[r]=a[r],o=!0);return o&&g++,g});i=()=>cA(n)}e.b.length&&AEA(()=>{Z4(A,i),Fx(e.b)}),zD(()=>{const g=cQ(()=>e.m.map(bQA));return()=>{for(const I of g)typeof I=="function"&&I()}}),e.a.length&&zD(()=>{Z4(A,i),Fx(e.a)})}function Z4(t,A){if(t.l.s)for(const e of t.l.s)cA(e);A()}function _7(t,A){var e,i=(e=t.$$events)==null?void 0:e[A.type],g=NF(i)?i.slice():i==null?[]:[i];for(var I of g)I.call(this,A)}function cC(t){mg===null&&L2(),Ly&&mg.l!==null?UEA(mg).m.push(t):zD(()=>{const A=cQ(t);if(typeof A=="function")return A})}function Mk(t){mg===null&&L2(),cC(()=>()=>cQ(t))}function UEA(t){var A=t.l;return A.u??(A.u={a:[],b:[],m:[]})}function KEA(t,A,e){if(t==null)return A(void 0),qg;const i=cQ(()=>t.subscribe(A,e));return i.unsubscribe?()=>i.unsubscribe():i}let dN=!1;function Jr(t,A,e){const i=e[A]??(e[A]={store:null,source:RF(void 0),unsubscribe:qg});if(i.store!==t)if(i.unsubscribe(),i.store=t??null,t==null)i.source.v=void 0,i.unsubscribe=qg;else{var g=!0;i.unsubscribe=KEA(t,I=>{g?i.source.v=I:Et(i.source,I)}),g=!1}return cA(i.source)}function Lr(){const t={};return E7(()=>{for(var A in t)t[A].unsubscribe()}),t}function FEA(t){var A=dN;try{return dN=!1,[t(),dN]}finally{dN=A}}const bEA={get(t,A){if(!t.exclude.includes(A))return t.props[A]},set(t,A){return!1},getOwnPropertyDescriptor(t,A){if(!t.exclude.includes(A)&&A in t.props)return{enumerable:!0,configurable:!0,value:t.props[A]}},has(t,A){return t.exclude.includes(A)?!1:A in t.props},ownKeys(t){return Reflect.ownKeys(t.props).filter(A=>!t.exclude.includes(A))}};function du(t,A,e){return new Proxy({props:t,exclude:A},bEA)}const vEA={get(t,A){let e=t.props.length;for(;e--;){let i=t.props[e];if($f(i)&&(i=i()),typeof i=="object"&&i!==null&&A in i)return i[A]}},set(t,A,e){let i=t.props.length;for(;i--;){let g=t.props[i];$f(g)&&(g=g());const I=JE(g,A);if(I&&I.set)return I.set(e),!0}return!1},getOwnPropertyDescriptor(t,A){let e=t.props.length;for(;e--;){let i=t.props[e];if($f(i)&&(i=i()),typeof i=="object"&&i!==null&&A in i){const g=JE(i,A);return g&&!g.configurable&&(g.configurable=!0),g}}},has(t,A){if(A===LE||A===I7)return!1;for(let e of t.props)if($f(e)&&(e=e()),e!=null&&A in e)return!0;return!1},ownKeys(t){const A=[];for(let e of t.props){$f(e)&&(e=e());for(const i in e)A.includes(i)||A.push(i)}return A}};function lQ(...t){return new Proxy({props:t},vEA)}function W4(t){for(var A=Ti,e=Ti;A!==null&&(A.f&(kB|yk))===0;)A=A.parent;try{return br(A),t()}finally{br(e)}}function Jt(t,A,e,i){var g,I=(e&cQA)!==0,n=!Ly||(e&lQA)!==0,o=(e&EQA)!==0,a=(e&uQA)!==0,r=!1,s;o?[s,r]=FEA(()=>t[A]):s=t[A];var B=LE in t||I7 in t,c=((g=JE(t,A))==null?void 0:g.set)??(B&&o&&A in t?K=>t[A]=K:void 0),E=i,D=!0,y=!1,S=()=>(y=!0,D&&(D=!1,a?E=cQ(i):E=i),E);s===void 0&&i!==void 0&&(c&&n&&YQA(),s=S(),c&&c(s));var f;if(n)f=()=>{var K=t[A];return K===void 0?S():(D=!0,y=!1,K)};else{var M=W4(()=>(I?je:yD)(()=>t[A]));M.f|=vQA,f=()=>{var K=cA(M);return K!==void 0&&(E=void 0),K===void 0?E:K}}if((e&QQA)===0)return f;if(c){var k=t.$$legacy;return function(K,R){return arguments.length>0?((!n||!R||k||r)&&c(R?f():K),K):f()}}var m=!1,U=!1,F=RF(s),b=W4(()=>je(()=>{var K=f(),R=cA(F);return m?(m=!1,U=!0,R):(U=!1,F.v=K)}));return I||(b.equals=b2),function(K,R){if(arguments.length>0){const G=R?cA(b):n&&o?Xt(K):K;return b.equals(G)||(m=!0,Et(F,G),y&&E!==void 0&&(E=G),cQ(()=>cA(b))),K}return cA(b)}}function z4(t,A){var e=Ti,i=jg,g=mg;br(t),BC(t),T4(t.ctx);try{A()}finally{br(e),BC(i),T4(g)}}function _EA(t,A,e){var i=t,g;uu(()=>{var I=Ti,n=!1;I.fn=o=>{var a=A.onerror;let r=A.failed;if(!a&&!r||n)throw o;var s=()=>{Dd(g),z4(I,()=>{n=!1,g=aC(()=>e(i)),S_()})};a?.(o,s),g&&CC(g),r&&Wd(()=>{z4(I,()=>{n=!0;try{g=aC(()=>{r(i,()=>o,()=>s)})}catch(B){mk(B,I,null,I.ctx)}S_(),n=!1})})},g=aC(()=>e(i)),S_()},Eu|CU)}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 Mm{static getPublicMessage(A){switch(A){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(A){switch(A){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(A){return A in Nm?A:null}static convertPurchaseFlowErrorCodeToErrorCode(A){switch(A){case Og.ErrorSettingUpPurchase:return 2;case Og.ErrorChargingPayment:return 20;case Og.NetworkError:return 10;case Og.MissingEmailError:return 4;case Og.AlreadyPurchasedError:return 6;default:return 0}}}var Nm=(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))(Nm||{});class xI extends Error{constructor(A,e,i,g){super(e),ft(this,"toString",()=>`PurchasesError(code: ${Un[this.errorCode]}, message: ${this.message})`),this.errorCode=A,this.underlyingErrorMessage=i,this.extra=g}static getForBackendError(A,e){const i=Mm.getErrorCodeForBackendErrorCode(A);return new xI(i,Mm.getPublicMessage(i),e,{backendErrorCode:A})}static getForPurchasesFlowError(A){return new xI(Mm.convertPurchaseFlowErrorCodeToErrorCode(A.errorCode),A.message,A.underlyingErrorMessage)}}class JEA extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var Im=(t=>(t.Started="started",t.InProgress="in_progress",t.Succeeded="succeeded",t.Failed="failed",t))(Im||{}),AD=(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))(AD||{}),ns=(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))(ns||{});let Mi=class{static setLogLevel(A){this.logLevel=A}static log(A,e=this.logLevel){const i=`[Purchases] ${A}`;if(!(this.logLevel<e||e===ns.Silent))switch(e){case ns.Error:break;case ns.Warn:break;case ns.Info:break;case ns.Debug:break;case ns.Verbose:break}}static errorLog(A){this.log(A,ns.Error)}static warnLog(A){this.log(A,ns.Warn)}static infoLog(A){this.log(A,ns.Info)}static debugLog(A){this.log(A,ns.Debug)}static verboseLog(A){this.log(A,ns.Verbose)}};ft(Mi,"logLevel",ns.Silent);function LEA(t){var A;return t.operation.redemption_info?{redeemUrl:((A=t.operation.redemption_info)==null?void 0:A.redeem_url)??null}:null}var Og=(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))(Og||{});class rI extends Error{constructor(A,e,i,g,I){super(e),this.errorCode=A,this.underlyingErrorMessage=i,this.purchasesErrorCode=g,this.extra=I}getErrorCode(){var A;return((A=this.extra)==null?void 0:A.backendErrorCode)??this.purchasesErrorCode??this.errorCode}static fromPurchasesError(A,e){var i;let g;return A.errorCode===Un.ProductAlreadyPurchasedError?g=5:A.errorCode===Un.InvalidEmailError?g=4:A.errorCode===Un.NetworkError?g=3:g=rI.fromBackendErrorCode((i=A.extra)==null?void 0:i.backendErrorCode)??e,new rI(g,A.message,A.underlyingErrorMessage,A.errorCode,A.extra)}static fromBackendErrorCode(A){switch(A){case Nm.BackendGatewaySetupErrorStripeTaxNotActive:return 6;case Nm.BackendGatewaySetupErrorInvalidTaxOriginAddress:return 7;case Nm.BackendGatewaySetupErrorMissingRequiredPermission:return 8;default:return null}}}class qEA{constructor(A,e,i=10){ft(this,"operationSessionId",null),ft(this,"backend"),ft(this,"eventsTracker"),ft(this,"maxNumberAttempts"),ft(this,"waitMSBetweenAttempts",1e3),this.backend=A,this.eventsTracker=e,this.maxNumberAttempts=i}async checkoutStart(A,e,i,g,I,n){try{const o=this.eventsTracker.getTraceId(),a=await this.backend.postCheckoutStart(A,e,g,i,o,I,n);return this.operationSessionId=a.operation_session_id,a}catch(o){if(o instanceof xI)throw rI.fromPurchasesError(o,0);{const a="Unknown error starting purchase: "+String(o);throw Mi.errorLog(a),new rI(2,a)}}}async checkoutCalculateTax(A,e,i){const g=this.operationSessionId;if(!g)throw new rI(0,"No purchase started");try{return await this.backend.postCheckoutCalculateTax(g,A,e,i)}catch(I){if(I instanceof xI)throw rI.fromPurchasesError(I,0);{const n="Unknown error calculating tax: "+String(I);throw Mi.errorLog(n),new rI(2,n)}}}async checkoutComplete(A){const e=this.operationSessionId;if(!e)throw new rI(0,"No purchase started");try{return await this.backend.postCheckoutComplete(e,A)}catch(i){if(i instanceof xI)throw rI.fromPurchasesError(i,0);{const g="Unknown error starting purchase: "+String(i);throw Mi.errorLog(g),new rI(2,g)}}}async pollCurrentPurchaseForCompletion(){const A=this.operationSessionId;if(!A)throw new rI(0,"No purchase in progress");return new Promise((e,i)=>{const g=(I=1)=>{if(I>this.maxNumberAttempts){this.clearPurchaseInProgress(),i(new rI(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(A).then(n=>{const o=n.operation.store_transaction_identifier,a=n.operation.product_identifier,r=n.operation.purchase_date?isNaN(Date.parse(n.operation.purchase_date))?null:new Date(n.operation.purchase_date):null;switch(n.operation.status){case Im.Started:case Im.InProgress:setTimeout(()=>g(I+1),this.waitMSBetweenAttempts);break;case Im.Succeeded:if(this.clearPurchaseInProgress(),!o||!a||!r){i(new rI(2,"Missing required fields in operation response."));return}e({redemptionInfo:LEA(n),operationSessionId:A,storeTransactionIdentifier:o,productIdentifier:a,purchaseDate:r});return;case Im.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(n.operation.error,i)}}).catch(n=>{const o=rI.fromPurchasesError(n,3);i(o)})};g()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(A,e){if(A==null){e(new rI(2,"Got an error status but error field is empty."));return}switch(A.code){case AD.SetupIntentCreationFailed:e(new rI(0,"Setup intent creation failed"));return;case AD.PaymentMethodCreationFailed:e(new rI(0,"Payment method creation failed"));return;case AD.PaymentChargeFailed:e(new rI(1,"Payment charge failed"));return;case AD.SetupIntentCompletionFailed:e(new rI(0,"Setup intent completion failed"));return;case AD.AlreadyPurchased:e(new rI(5,"Purchased was already completed"));return;default:e(new rI(2,"Unknown error code received"));return}}}const us="rcb-ui-translator",wD="en",xEA={"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"},TEA={"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."},YEA={"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."},HEA={"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}} بتحصيل رسوم منك وفقًا لشروطها حتى تقوم بالإلغاء."},OEA={"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."},PEA={"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}} 按照其条款向您收费，直到您取消订阅。"},jEA={"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}} 根據其條款向您收費，直到您取消為止。"},ZEA={"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."},WEA={"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."},zEA={"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."},VEA={"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."},XEA={"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."},$EA={"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."},AuA={"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."},euA={"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}} να σας χρεώνει σύμφωνα με τους όρους της έως ότου ακυρώσετε."},tuA={"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}} לחייב אותך בהתאם לתנאים שלהם עד שתבטל."},iuA={"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}} को रद्द करने तक उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं."},guA={"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."},IuA={"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."},nuA={"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}}が利用規約に従って課金することを許可することに同意したことになります。"},ouA={"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}}이 약관에 따라 요금을 청구하는 데 동의하는 것입니다."},auA={"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."},ruA={"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."},suA={"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."},CuA={"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."},BuA={"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."},cuA={"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}} будет взимать с вас плату в соответствии с их условиями до тех пор, пока вы не отмените подписку."},luA={"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."},QuA={"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."},EuA={"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}} เรียกเก็บเงินจากคุณตามข้อกำหนดจนกว่าคุณจะยกเลิก"},uuA={"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."},huA={"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}} стягувати з вас плату відповідно до їхніх умов, поки ви не скасуєте підписку."},duA={"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 vt=(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))(vt||{});const puA={en:xEA,es:TEA,it:YEA,ar:HEA,ca:OEA,zh_Hans:PEA,zh_Hant:jEA,hr:ZEA,cs:WEA,da:zEA,nl:VEA,fi:XEA,fr:$EA,de:AuA,el:euA,he:tuA,hi:iuA,hu:guA,id:IuA,ja:nuA,ko:ouA,ms:auA,no:ruA,pl:suA,pt:CuA,ro:BuA,ru:cuA,sk:luA,sv:QuA,th:EuA,tr:uuA,uk:huA,vi:duA};var To=(t=>(t.Year="year",t.Month="month",t.Week="week",t.Day="day",t))(To||{});function J7(t){const A=t.match(/^PT?([0-9]+)([MDYW])$/);if(!A||A.length<3)return Mi.errorLog(`Invalid ISO 8601 duration format: ${t}`),null;const e=parseInt(A[1]);switch(A[2]){case"Y":return{number:e,unit:"year"};case"M":return{number:e,unit:"month"};case"W":return{number:e,unit:"week"};case"D":return{number:e,unit:"day"};default:return Mi.errorLog(`Invalid ISO 8601 unit duration format: ${t}`),null}}function Ox(t,A,e){if(!e)return null;let i=new Date(t);switch(A.unit){case"year":i.getDate()===29&&i.getMonth()===1&&A.number!==4?i.setFullYear(i.getFullYear()+A.number,i.getMonth(),28):i.setFullYear(i.getFullYear()+A.number,i.getMonth(),i.getDate());break;case"month":i.setMonth(i.getMonth()+A.number,i.getDate()),i.getDate()!==t.getDate()&&(i=new Date(t),i.setMonth(i.getMonth()+A.number+1,0));break;case"week":i.setDate(i.getDate()+A.number*7);break;case"day":i.setDate(i.getDate()+A.number);break}return i}const fuA=t=>t/1e6,xE=(t,A,e,i={})=>{const g=fuA(t),I={style:"currency",currency:A,currencyDisplay:"symbol",...i,minimumFractionDigits:i.maximumFractionDigits};return new Intl.NumberFormat(e,I).format(g).replace("US$","$")},DuA=(t,A)=>{const e=J7(t);return e?A.translatePeriod(e.number,e.unit)||`${e.number} ${e.unit}s`:t},yuA=t=>{try{return t.charAt(0).toUpperCase()+t.slice(1)}catch{return t}},ID={noWhitespace:!1,short:!1},L7={useMultipleWords:!1};class _F{constructor(A={},e=wD,i=wD){ft(this,"locales",{}),this.selectedLocale=e,this.defaultLocale=i;const g={};Object.entries(puA).forEach(([I,n])=>{g[I]=new V4(n,I)}),this.locales=g,A&&this.override(A)}static fallback(){return new _F}override(A){Object.entries(A).forEach(([e,i])=>{this.locales[e]=new V4({...this.locales[e].labels||{},...i},this.getLanguageCodeString(e))})}formatPrice(A,e){const i={currencyDisplay:"narrowSymbol"};A===0&&(i.maximumFractionDigits=0);try{return xE(A,e,this.locale,i)}catch{Mi.errorLog(`Failed to create a price formatter for locale: ${this.locale}`)}try{return xE(A,e,this.fallbackLocale,i)}catch{Mi.errorLog(`Failed to create a price formatter for locale: ${this.fallbackLocale}`)}return xE(A,e,wD,i)}get locale(){var A;return((A=this.getLocaleInstance(this.selectedLocale))==null?void 0:A.localeKey)||this.getLanguageCodeString(this.selectedLocale)}get fallbackLocale(){var A;return((A=this.getLocaleInstance(this.defaultLocale))==null?void 0:A.localeKey)||this.getLanguageCodeString(this.defaultLocale)}getLanguageCodeString(A){return A.split("_")[0].split("-")[0]}getLocaleInstance(A){const e=this.getLanguageCodeString(A);return this.locales[A]||this.locales[e]}translate(A,e){const i=this.getLocaleInstance(this.selectedLocale),g=this.getLocaleInstance(this.defaultLocale);return i?.translate(A,e)||g?.translate(A,e)||""}formatCountry(A){return new Intl.DisplayNames([this.locale],{type:"region"}).of(A)||A}translatePeriod(A,e,i=ID){const g=this.getLocaleInstance(this.selectedLocale),I=this.getLocaleInstance(this.defaultLocale);return g?.translatePeriod(A,e,i)||I?.translatePeriod(A,e,i)}translatePeriodUnit(A,e=ID){const i=this.getLocaleInstance(this.selectedLocale),g=this.getLocaleInstance(this.defaultLocale);return i?.translatePeriodUnit(A,e)||g?.translatePeriodUnit(A,e)}translatePeriodFrequency(A,e,i=L7){const g=this.getLocaleInstance(this.selectedLocale),I=this.getLocaleInstance(this.defaultLocale);return g?.translatePeriodFrequency(A,e,i)||I?.translatePeriodFrequency(A,e,i)}translateDate(A,e={}){const i=this.getLocaleInstance(this.selectedLocale),g=this.getLocaleInstance(this.defaultLocale);return i?.translateDate(A,e)||g?.translateDate(A,e)}}class V4{constructor(A={},e){this.labels=A,this.localeKey=e}replaceVariables(A,e){return Object.entries(e).reduce((i,[g,I])=>i.replace(`{{${g}}}`,`${I??""}`),A)}translate(A,e){const i=this.labels[A];if(i)return this.replaceVariables(i,e||{})}translatePeriod(A,e,i=ID){var g;const{noWhitespace:I,short:n}={...ID,...i},o=n?`periods.${e}Short`:Math.abs(A)===1?`periods.${e}`:`periods.${e}Plural`;return(g=this.translate(o,{amount:A.toString()}))==null?void 0:g.replace(" ",I?"":" ")}translatePeriodUnit(A,e=ID){var i;const{noWhitespace:g,short:I}={...ID,...e},n=`periods.${A}${I?"Short":""}`;return(i=this.translate(n,{amount:""}))==null?void 0:i.replace(" ",g?"":" ")}translatePeriodFrequency(A,e,i=L7){const g=i?.useMultipleWords,I=Math.abs(A)===1?`periods.${g===!0?"per":""}${g?yuA(e.toString()):e}Frequency`:`periods.${e}FrequencyPlural`;return this.translate(I,{amount:A.toString()})}translateDate(A,e={}){return A.toLocaleDateString(this.localeKey,e)}}WQA();const SuA=`<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 wuA=ot('<div style="color:var(--rc-color-primary);"><!></div>');function q7(t){var A=wuA(),e=_e(A);hu(e,()=>SuA),ue(t,A)}var Px;(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"})(Px||(Px={}));var hU;(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"})(hU||(hU={}));var dU;(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"})(dU||(dU={}));var pU;(function(t){t.leading="start",t.center="center",t.trailing="end"})(pU||(pU={}));var jx;(function(t){t.vertical="column",t.horizontal="row",t.zlayer="zstack"})(jx||(jx={}));var Zx;(function(t){t.top="flex-start",t.leading="flex-start",t.center="center",t.bottom="flex-end",t.trailing="flex-end"})(Zx||(Zx={}));var Wx;(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"})(Wx||(Wx={}));const muA=["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"],kuA=({value:t="",variableDictionary:A})=>A?muA.reduce((e,i)=>{var g;return e.replaceAll(`{{ ${i} }}`,((g=A[i])==null?void 0:g.toString())||"N/A")},t):t;function x7(t,A,e,i){var g;if(!t)return"";const I=(g=i[e])==null?void 0:g[t];return(i[A]||{})[t]?i[A][t]:I}function Y2({text_lid:t,locale:A,defaultLocale:e,labels:i,variableDictionary:g}){if(!t)return"";const I=x7(t,A,e,i);return kuA({value:I,variableDictionary:g})}const Qf=[];function MuA(t,A){return{subscribe:T7(t,A).subscribe}}function T7(t,A=qg){let e=null;const i=new Set;function g(o){if(o7(t,o)&&(t=o,e)){const a=!Qf.length;for(const r of i)r[1](),Qf.push(r,t);if(a){for(let r=0;r<Qf.length;r+=2)Qf[r][0](Qf[r+1]);Qf.length=0}}}function I(o){g(o(t))}function n(o,a=qg){const r=[o,a];return i.add(r),i.size===1&&(e=A(g,I)||qg),o(t),()=>{i.delete(r),i.size===0&&e&&(e(),e=null)}}return{set:g,update:I,subscribe:n}}const Y7=MuA(!1,t=>{if(typeof window<"u"){const A=window.matchMedia("(prefers-color-scheme: dark)");t(A.matches);const e=i=>t(i.matches);return A.addEventListener("change",e),()=>A.removeEventListener("change",e)}return()=>{}}),IC="light",zx="#000000",NuA="#FFFFFF";function X4(t,A){const e={[`--${A}-block-start`]:"0px",[`--${A}-inline-end`]:"0px",[`--${A}-block-end`]:"0px",[`--${A}-inline-start`]:"0px"};return!t||!A||Object.assign(e,{[`--${A}-block-start`]:`${t.top??0}px`,[`--${A}-inline-end`]:`${t.trailing??0}px`,[`--${A}-block-end`]:`${t.bottom??0}px`,[`--${A}-inline-start`]:`${t.leading??0}px`}),e}function GuA(t){return Px[t]}function nQ({colorMap:t,colorMode:A=IC,fallback:e="FFFFFF"}){if(!t)return e;const i=t[A]||t[IC];let g="";switch(i.type){case"hex":case"alias":return i.value??e;case"linear":return g=(i.points||[]).map(I=>`${I.color} ${I.percent}%`).join(", "),`linear-gradient(${i.degrees}deg, ${g})`;case"radial":return g=(i.points||[]).map(I=>`${I.color} ${I.percent}%`).join(", "),`radial-gradient(${g})`;default:return e}}function H7(t,A=IC){if(!t)return"";const e=nQ({colorMap:t.color,colorMode:A});return`${t.width}px solid ${e}`}function fU(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 JF({background_color:t,border:A,margin:e,padding:i,color:g,colorMode:I=IC,shape:n,shadow:o}){const a={"--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 i&&Object.assign(a,X4(i,"padding")),e&&Object.assign(a,X4(e,"margin")),t&&(a["--background"]=nQ({colorMap:t,colorMode:I,fallback:"transparent"})),g&&(a["--text-color"]=nQ({colorMap:g,colorMode:I,fallback:zx})),A&&(a["--border"]=H7(A,I)),n?.type==="rectangle"&&n.corners&&Object.assign(a,fU(n.corners)),n?.type==="pill"&&Object.assign(a,fU({bottom_leading:9999,bottom_trailing:9999,top_leading:9999,top_trailing:9999})),o&&(a["--shadow"]=`${o.x}px ${o.y}px ${o.radius}px 
      ${nQ({colorMap:o.color,colorMode:I,fallback:zx})}`),a}function $4(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 Nk(t){const A={"--width":"initial","--height":"initial","--flex":"initial"},e=$4(t.width),i=$4(t.height),g=t.width.type==="fill"||t.height.type==="fill";return Object.assign(A,{"--width":e,"--height":i,"--flex":g?"initial":"0 1 auto"}),A}function O7(t){const A={"--inset":"initial","--transform":"initial"};switch(t.alignment){case"top_leading":A["--inset"]="0 auto auto 0";break;case"top":A["--inset"]="auto auto auto 50%",A["--transform"]="translate(-50%, 0)";break;case"top_trailing":A["--inset"]="0 0 auto auto";break;case"leading":A["--inset"]="50% 0 50% 0",A["--transform"]="translate(0, -50%)";break;case"center":A["--inset"]="50% auto auto 50%",A["--transform"]="translate(-50%, -50%)";break;case"trailing":A["--inset"]="50% 0 50% auto",A["--transform"]="translate(0, -50%)";break;case"bottom_leading":A["--inset"]="auto auto 0 0";break;case"bottom":A["--inset"]="auto 50% 0 auto",A["--transform"]="translate(50%, 0)";break;case"bottom_trailing":A["--inset"]="auto 0 0 auto";break}return A}function RuA(t){const A={"--direction":"initial","--alignment":"initial","--distribution":"initial","--position":"relative","--inset":"initial","--transform":"initial"};return t.type!=="zlayer"&&(Object.assign(A,{"--direction":jx[t.type],"--alignment":Zx[t.alignment]}),t.distribution&&Object.assign(A,{"--distribution":Wx[t.distribution]})),A}function UuA(t,A=IC){var e,i;const{font_size:g,horizontal_alignment:I,font_weight:n,font_name:o,color:a}=t,r={"--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(r,{"--text-align":pU[I]||pU.leading,"--font-weight":hU[n]||hU.regular,"--font-size":dU[g]||dU.body_m,"--font-family":o||"sans-serif"}),a&&(((e=a[A])==null?void 0:e.type)==="linear"||((i=a[A])==null?void 0:i.type)==="radial")&&Object.assign(r,{"--background-clip":"text","--text-fill-color":"transparent","--background":nQ({colorMap:a,colorMode:A})}),r}function hs(t){return Object.entries(t).map(([A,e])=>`${A}: ${e}`).join("; ")}function KuA(t){const A=i=>{if(i.type==="package"&&i.is_selected_by_default)return i;if(i.components&&Array.isArray(i.components))for(const g of i.components){const I=A(g);if(I)return I}if(i.stack!==void 0){const g=A(i.stack);if(g)return g}},e=A(t.components_config.base.stack);if(e!==void 0)return e.package_id}const H2=(t,A)=>A?FuA(A).reduce((e,i)=>{var g;if(t){const I=((g=t?.states)==null?void 0:g[i])||{};return{...e,...I}}return e},{}):{},FuA=t=>t?Object.entries(t).reduce((A,[e,i])=>(i&&A.push(e),A),[]):[];function dC(t,A){return t?A?Object.entries(t).reduce((e,[i,g])=>{const I=i.replace(/^--/,`${A}-`);return e[`--${I}`]=g,e},{}):t:{}}function buA(t){const{mask_shape:A,imageAspectRatio:e}=t;let i="";return A?.type==="concave"?i=`M 0 0 
              H 100 
              V ${e*100} 
              Q 50 ${e*80} 0 ${e*100} 
              Z`:A?.type==="convex"?i=`M 0 0 
              H 100 
              V ${e*80} 
              Q 50 ${e*120} 0 ${e*80} 
              Z`:i=`M 0 0 H 100 V ${e*100} H 0 Z`,i}const vuA=t=>{const A={"--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(A,fU(t.corners)),A};function _uA(t){var A,e,i;if(((e=(A=t.color_overlay)==null?void 0:A[t.purchaseState.colorMode])==null?void 0:e.type)!=="linear")return{x1:"0%",y1:"0%",x2:"0%",y2:"0%"};const{color_overlay:g}=t,I=((i=g?.[IC])==null?void 0:i.degrees)||0,n="50%",o="0%",a=`${Math.round(50+Math.sin((I+90)*Math.PI/90)*50)}%`,r=`${Math.round(50-Math.cos((I+90)*Math.PI/90)*50)}%`;return{x1:n,y1:o,x2:a,y2:r}}const P7={light:{type:"hex",value:zx}},JuA={light:{type:"hex",value:NuA}},O2=t=>{const{font_size:A="body_m",color:e=P7,background_color:i=JuA,padding:g,margin:I,size:n,purchaseState:o}=t,a={"--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"},r=H2(t.overrides,t.componentState),s=GuA(A),B=UuA({...t,...r},o.colorMode),c=JF({background_color:i,color:e,margin:I,padding:g,colorMode:o.colorMode,...r}),E=Nk({...n,...r}),D={...a,...c,...B,...E};return{textStyles:dC(D,"text"),tagToRender:s}};function LuA(t,A,e){const i={"--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(i,JF({background_color:e,...t}),Nk(A)),Object.assign(i,t.zStackChildStyles);const g=dC(i,"text");return hs(g)}function quA(t){const 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","--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:e,textStyles:i}=O2(t);return Object.assign(A,i),{tagToRender:e,textStyles:hs(A)}}function xuA(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((A,{regexp:e,output:i})=>A.replaceAll(e,i),t):""}const TuA={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 j7(t,A){ni(A,!0),Vt(t,TuA);const e=Jt(A,"styleVariables",3,""),i=Jt(A,"component",3,"p");var g=Ig(),I=Bi(g);EU(I,i,!1,(n,o)=>{let a;dt(()=>a=uU(n,a,{id:A.id,style:e(),class:"rc-pw-text-block"},"svelte-1wz4si8",n.namespaceURI===l0,n.nodeName.includes("-")));var r=Ig(),s=Bi(r);Bn(s,()=>A.children??qg),ue(o,r)}),ue(t,g),oi()}var YuA=ot('<span class="rc-pw-text-wrapper svelte-11gzifq"><!></span>');const HuA={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 OuA(t,A){ni(A,!0),Vt(t,HuA);const e=du(A,["$$slots","$$events","$$legacy","id","labels","text_lid","purchaseState","variableDictionary","background_color","size"]),i=je(()=>quA({id:A.id,labels:A.labels,text_lid:A.text_lid,purchaseState:A.purchaseState,background_color:A.background_color,size:A.size,...e})),g=je(()=>cA(i).tagToRender),I=je(()=>cA(i).textStyles),n=je(()=>LuA(e,A.size,A.background_color)),o=je(()=>Y2({text_lid:A.text_lid,locale:A.purchaseState.locale,defaultLocale:A.purchaseState.defaultLocale,labels:A.labels,variableDictionary:A.variableDictionary})),a=je(()=>xuA(cA(o)));var r=YuA(),s=_e(r);j7(s,{get styleVariables(){return cA(I)},get component(){return cA(g)},get id(){return A.id},children:(B,c)=>{var E=Ig(),D=Bi(E);hu(D,()=>cA(a)),ue(B,E)},$$slots:{default:!0}}),dt(()=>qt(r,"style",cA(n))),ue(t,r),oi()}const PuA=t=>{const{background_color:A,margin:e,padding:i,spacing:g,size:I,border:n,shape:o,shadow:a,dimension:r,componentState:s,overrides:B,purchaseState:c,zStackChildStyles:E}=t,D={"--flex":"0 1 auto","--height":"initial","--width":"initial","--spacing":`${g||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"},y=H2(B,s);Object.assign(D,JF({background_color:A,margin:e,padding:i,border:n,colorMode:c.colorMode,shape:o,shadow:a,...y}),RuA({...r,...y}),Nk({...I,...y})),Object.assign(D,E);const S=dC(D,"stack");return hs(S)};function juA(t){var A,e,i,g,I,n;const{badge:o}=t;if(!o)return"";const a={"--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(a,O7({alignment:o.alignment}),JF({...o,background_color:o.background_color,color:o.color,colorMode:t.purchaseState.colorMode})),o.style==="overlay"&&(a["--margin-block-start"]="0px",a["--margin-block-end"]="0px",a["--transform"]=pN(o,0,-(((A=t.border)==null?void 0:A.width)||0))),o.style==="edge_to_edge")if(a["--margin-block-start"]="0px",a["--margin-block-end"]="0px",a["--margin-inline-start"]="0px",a["--margin-inline-end"]="0px",o.alignment==="top"||o.alignment==="bottom"){a["--badge-width"]=`calc(100% + ${(((e=t.border)==null?void 0:e.width)||0)*2}px)`,a["--z-index"]="-1";const s=Math.max(((g=(i=t.shape)==null?void 0:i.corners)==null?void 0:g.top_leading)||0,((n=(I=t.shape)==null?void 0:I.corners)==null?void 0:n.top_trailing)||0);o.alignment==="top"&&(a["--padding-block-end"]=`${s+o.padding.bottom}px`,a["--transform"]=pN(o,s)),o.alignment==="bottom"&&(a["--padding-block-start"]=`${s+o.padding.top}px`,a["--transform"]=pN(o,-s))}else a["--transform"]=pN(o),Object.assign(a,ZuA(t));const r=dC(a,"stack-badge");return hs(r)}const Aj={top_leading:"bottom_trailing",top_trailing:"bottom_leading",bottom_leading:"top_trailing",bottom_trailing:"top_leading"},ej={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 ZuA(t){var A,e,i;const g={"--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 g;const n=((A=t.border)==null?void 0:A.width)||0,o=I.alignment;return g[ej[Aj[o]]]=`${(e=I.shape)==null?void 0:e.corners[Aj[o]]}px`,g[ej[o]]=`${((i=t.shape)==null?void 0:i.corners[o])-n}px`,g}function pN(t,A=0,e=0){if(!t)return"";if(t.style==="overlay"){if(t.alignment==="top_leading")return`translate(${e}px, calc(-50% + ${A}px))`;if(t.alignment==="top_trailing")return`translate(calc(0% - ${e}px), calc(-50% + ${A}px))`;if(t.alignment==="bottom_leading")return`translate(${e}px, calc(50% + ${A}px))`;if(t.alignment==="bottom_trailing")return`translate(calc(0% - ${e}px), calc(50% + ${A}px))`;if(t.alignment==="top")return`translate(calc(-50% + ${e}px), calc(-50% + ${A}px))`;if(t.alignment==="bottom")return`translate(calc(50% + ${e}px), calc(50% + ${A}px))`}if(t.style==="edge_to_edge"){if(t.alignment==="top")return`translate(calc(-50% + ${e}px), calc(-100% - ${A}px + 16px))`;if(t.alignment==="bottom")return`translate(calc(50% + ${e}px), calc(100% + ${A}px))`}return""}function WuA(t){const{badge:A}=t;if(!A)return{tagToRender:"",textStyles:""};const{tagToRender:e,textStyles:i}=O2({id:t.id,labels:t.labels,purchaseState:t.purchaseState,...A,components:[],type:"text",size:{width:{type:"fit"},height:{type:"fit"}},color:A?.color,name:t.name}),g={...i,"--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"},I=hs(g);return{tagToRender:e,textStyles:I}}function zuA(t){const{dimension:A}=t,e={"--inset":"initial","--transform":"initial","--position":"relative"};if(A.type!=="zlayer")return;const i=O7({...A});return Object.assign(e,{...i,"--position":"absolute"}),e}var VuA=ot('<span class="rc-pw-badge svelte-1b5bst5"><!></span>'),XuA=ot('<div class="rc-pw-stack-wrapper svelte-1b5bst5"><!> <div class="rc-pw-stack svelte-1b5bst5"></div></div>');const $uA={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 Gk(t,A){ni(A,!0),Vt(t,$uA);const e=du(A,["$$slots","$$events","$$legacy","id","components","labels","onAction","purchaseState","variableDictionary","badge","zStackChildStyles"]),i=je(()=>PuA({id:A.id,components:A.components,labels:A.labels,onAction:A.onAction,purchaseState:A.purchaseState,zStackChildStyles:A.zStackChildStyles,...e})),g=je(()=>juA({id:A.id,components:A.components,labels:A.labels,onAction:A.onAction,purchaseState:A.purchaseState,badge:A.badge,...e})),I=je(()=>zuA({id:A.id,components:A.components,labels:A.labels,onAction:A.onAction,purchaseState:A.purchaseState,...e})),n=je(()=>{var D;return Y2({defaultLocale:A.purchaseState.defaultLocale,locale:A.purchaseState.locale,labels:A.labels,variableDictionary:A.variableDictionary,text_lid:(D=A.badge)==null?void 0:D.text_lid})}),o=je(()=>WuA({id:A.id,components:A.components,labels:A.labels,onAction:A.onAction,purchaseState:A.purchaseState,variableDictionary:A.variableDictionary,badge:A.badge,...e})),a=je(()=>cA(o).tagToRender),r=je(()=>cA(o).textStyles);var s=XuA(),B=_e(s);{var c=D=>{var y=VuA(),S=_e(y);j7(S,{get styleVariables(){return cA(r)},get component(){return cA(a)},children:(f,M)=>{var k=Lg();dt(()=>Oi(k,cA(n))),ue(f,k)},$$slots:{default:!0}}),dt(()=>qt(y,"style",cA(g))),ue(D,y)};Kt(B,D=>{A.badge&&D(c)})}var E=St(B,2);XD(E,21,()=>A.components,VD,(D,y,S)=>{var f=Ig(),M=Bi(f);{var k=U=>{var F=je(()=>S>0?cA(I):void 0);DU(U,{get nodeData(){return cA(y)},get labels(){return A.labels},get onAction(){return A.onAction},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary},get componentState(){return A.componentState},get zStackChildStyles(){return cA(F)}})},m=U=>{DU(U,{get nodeData(){return cA(y)},get labels(){return A.labels},get onAction(){return A.onAction},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary},get componentState(){return A.componentState}})};Kt(M,U=>{cA(I)?U(k):U(m,!1)})}ue(D,f)}),dt(()=>{qt(s,"id",A.id),qt(s,"style",cA(i))}),ue(t,s),oi()}function AhA({stack:t,zStackChildStyles:A}){var e,i;const g=((i=(e=t?.size)==null?void 0:e.width)==null?void 0:i.type)==="fill"?"100%":"fit-content",I=dC(A||{},"button");return hs({...I,position:"var(--button-position, relative)",inset:"var(--button-inset, 0)",transform:"var(--button-transform, initial)",width:g})}const ehA={hash:"svelte-mx8s0a",code:""};function thA(t,A){ni(A,!0),Vt(t,ehA);const e=du(A,["$$slots","$$events","$$legacy","stack","action","onAction","labels","purchaseState","variableDictionary"]),i=()=>{A.onAction&&A.onAction(A.action)},g=je(()=>AhA({stack:A.stack,action:A.action,onAction:A.onAction,labels:A.labels,purchaseState:A.purchaseState,variableDictionary:A.variableDictionary,...e}));W7(t,{onclick:i,get style(){return cA(g)},class:"rc-pw-button",children:(I,n)=>{Gk(I,lQ(()=>A.stack,{get labels(){return A.labels},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary}}))},$$slots:{default:!0}}),oi()}function DU(t,A){ni(A,!0);const e=Lr(),i=()=>Jr(Y7,"$prefersDarkMode",e),g={stack:Gk,text:OuA,image:$hA,button:thA,purchase_button:tdA,package:ndA,footer:Z7,timeline:ldA},I=c=>{if(g[c.type])return[g[c.type],c];const{fallback:E}=c;if(E&&g[E?.type])return[g[E.type],E];throw new Error(`Invalid component type: ${c.type}`)},n=du(A,["$$slots","$$events","$$legacy","nodeData","labels","onAction","purchaseState","variableDictionary","zStackChildStyles"]),o=je(()=>I(A.nodeData)),a=je(()=>cA(o)[0]),r=je(()=>cA(o)[1]);var s=Ig(),B=Bi(s);return SEA(B,()=>cA(a),(c,E)=>{E(c,lQ(()=>cA(r)||{},{get labels(){return A.labels},get prefersDarkMode(){return i()},get onAction(){return A.onAction},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary},get zStackChildStyles(){return A.zStackChildStyles}},()=>n,{children:(D,y)=>{var S=Ig(),f=Bi(S);XD(f,17,()=>A.nodeData.components,VD,(M,k)=>{DU(M,lQ({get nodeData(){return cA(k)},get labels(){return A.labels},get onAction(){return A.onAction},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary}},()=>n))}),ue(D,S)},$$slots:{default:!0}}))}),ue(t,s),oi({getComponentClass:I})}function ihA({background:t,colorMode:A}){const e={"--background":"initial"};t?.type==="color"&&Object.assign(e,{"--background":nQ({colorMap:t.value,colorMode:A,fallback:"transparent"})});const i=dC(e,"paywall");return hs(i)}function ghA(t,A){var e,i,g,I;if(((i=(e=t.components_config.base)==null?void 0:e.background)==null?void 0:i.type)!=="image")return"";const n=t.components_config.base.background;return((g=n.value[A])==null?void 0:g.original)||((I=n.value[IC])==null?void 0:I.original)}var IhA=ot('<div class="rc-pw-footer svelte-pg5jlz"><!></div>');const nhA={hash:"svelte-pg5jlz",code:".rc-pw-footer.svelte-pg5jlz {position:sticky;bottom:0;transform:translateY(50%);width:100%;}"};function Z7(t,A){Vt(t,nhA);var e=IhA(),i=_e(e);Gk(i,lQ(()=>A.stack,{get labels(){return A.labels},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary},get onAction(){return A.onAction}})),dt(()=>qt(e,"id",A.id)),ue(t,e)}var ohA=ot('<div class="rc-pw-paywall-background svelte-14bszwq"></div>'),ahA=ot('<div class="rc-pw-paywall-background rc-pw-image-container svelte-14bszwq"><img class="rc-pw-image svelte-14bszwq" alt=""></div>'),rhA=ot('<div class="rc-pw-paywall svelte-14bszwq"><!> <!> <!></div>');const shA={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 ChA(t,A){ni(A,!0),Vt(t,shA);const e=Lr(),i=()=>Jr(Y7,"$prefersDarkMode",e),g=Jt(A,"variablesPerPackage",19,()=>({}));let I=Xt({selectedPackageId:KuA(A.paywallData),locale:A.selectedLocale||A.paywallData.default_locale,defaultLocale:A.paywallData.default_locale,variablesPerPackage:g(),colorMode:A.preferredColorMode||(i()?"dark":IC)}),n=Ki(Xt(g()[I.selectedPackageId||""]));const o=(f,M)=>{var k;(k=A.onRestorePurchasesClicked)==null||k.call(A)},a=(f,M)=>{var k;(k=A.onBackClicked)==null||k.call(A)},r=(f,M)=>{var k,m;if(f.destination==="customer_center"&&((k=A.onVisitCustomerCenterClicked)==null||k.call(A)),!f.url)return;const U=x7(f.url.url_lid,I.locale,I.defaultLocale,A.paywallData.components_localizations);U&&((m=A.onNavigateToUrlClicked)==null||m.call(A,U))},s=(f,M)=>{I.selectedPackageId=M?.packageId,M!=null&&M.packageId&&Et(n,Xt(g()[M.packageId]))},B=(f,M)=>{var k;I.selectedPackageId!==void 0&&((k=A.onPurchaseClicked)==null||k.call(A,I.selectedPackageId))},c=(f,M)=>{switch(f.type){case"select_package":s(f,M);break;case"navigate_to":r(f);break;case"navigate_back":a();break;case"restore_purchases":o();break;case"purchase":B();break}},E=je(()=>{var f;return ihA({background:(f=A.paywallData.components_config.base)==null?void 0:f.background,colorMode:I.colorMode})}),D=je(()=>ghA(A.paywallData,I.colorMode));var y=Ig(),S=Bi(y);_EA(S,{get onerror(){return A.onError}},f=>{var M=rhA(),k=_e(M);DU(k,{onAction:c,get nodeData(){return A.paywallData.components_config.base.stack},get labels(){return A.paywallData.components_localizations},get purchaseState(){return I},get variableDictionary(){return cA(n)}});var m=St(k,2);{var U=R=>{Z7(R,lQ(()=>A.paywallData.components_config.base.sticky_footer,{get stack(){return A.paywallData.components_config.base.sticky_footer.stack},get labels(){return A.paywallData.components_localizations},get purchaseState(){return I},get variableDictionary(){return cA(n)},onAction:c}))};Kt(m,R=>{A.paywallData.components_config.base.sticky_footer&&R(U)})}var F=St(m,2);{var b=R=>{var G=ohA();dt(()=>qt(G,"style",cA(E))),ue(R,G)},K=R=>{var G=Ig(),J=Bi(G);{var x=H=>{var P=ahA(),j=_e(P);dt(()=>qt(j,"src",cA(D))),ue(H,P)};Kt(J,H=>{var P;((P=A.paywallData.components_config.base.background)==null?void 0:P.type)==="image"&&H(x)},!0)}ue(R,G)};Kt(F,R=>{var G;((G=A.paywallData.components_config.base.background)==null?void 0:G.type)==="color"?R(b):R(K,!1)})}ue(f,M)}),ue(t,y),oi()}const BhA=(t,A)=>{var e;(e=A.onclick)==null||e.call(A)};var chA=ot("<button><!></button>");const lhA={hash:"svelte-1wpam0z",code:"button.svelte-1wpam0z {border:none;cursor:pointer;background:transparent;width:fit-content;}"};function W7(t,A){ni(A,!0),Vt(t,lhA);var e=chA();e.__click=[BhA,A];var i=_e(e);Bn(i,()=>A.children??qg),dt(()=>{$E(e,R7(A.class),"svelte-1wpam0z"),e.disabled=!A.onclick,qt(e,"style",A.style)}),ue(t,e),oi()}vF(["click"]);var QhA=ot('<div class="rcb-processing svelte-2j2b59"></div>');const EhA={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 uhA(t,A){Vt(t,EhA);let e=Jt(A,"size",8,"medium");const i={small:{width:"8px",offset:"10px"},medium:{width:"12px",offset:"20px"},large:{width:"16px",offset:"30px"}};var g=QhA();dt(()=>qt(g,"style",`--shadow-offset: ${i[e()].offset??""}; --width: ${i[e()].width??""};`)),ue(t,g)}var hhA=ot("<span><!></span>");const dhA={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 phA(t,A){ni(A,!0),Vt(t,dhA);const e=Jt(A,"size",3,"body-base");var i=hhA(),g=_e(i);Bn(g,()=>A.children??qg),dt(()=>$E(i,`rcb-typography rcb-typography-${e()??""} svelte-byrjto`)),ue(t,i),oi()}const fhA={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"},DhA={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"},z7={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},yhA={...z7,"input-background":"color_form_bg",background:"color_form_bg"},ShA={...z7,"input-background":"color_product_info_bg",background:"color_product_info_bg"},V7={"input-border-radius":"4px","input-button-border-radius":"8px"},whA={"input-border-radius":"0px","input-button-border-radius":"0px"},mhA={"input-border-radius":"12px","input-button-border-radius":"9999px"},tj=V7,ij="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",Bc={regular:"400",medium:"500",semibold:"600"},zs={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},cc={120:"120%",130:"130%",140:"140%"},lc={tight:"0.20%",regular:"0"},wn={heading2xl:{fontSize:zs[28],lineHeight:cc[120],fontWeight:Bc.semibold,letterSpacing:lc.tight},headingXl:{fontSize:zs[24],lineHeight:cc[130],fontWeight:Bc.semibold,letterSpacing:lc.regular},headingLg:{fontSize:"20px",lineHeight:cc[130],fontWeight:Bc.semibold,letterSpacing:lc.regular},headingMd:{fontSize:"16px",lineHeight:cc[140],fontWeight:Bc.medium,letterSpacing:lc.regular},bodyBase:{fontSize:zs[16],lineHeight:cc[140],fontWeight:Bc.regular,letterSpacing:lc.regular},bodySmall:{fontSize:zs[14],lineHeight:cc[140],fontWeight:Bc.regular,letterSpacing:lc.regular},labelButton:{fontSize:zs[16],lineHeight:cc[140],fontWeight:Bc.regular,letterSpacing:lc.tight},labelDefault:{fontSize:zs[14],lineHeight:cc[140],fontWeight:Bc.regular,letterSpacing:lc.tight},captionDefault:{fontSize:zs[12],lineHeight:cc[140],fontWeight:Bc.regular,letterSpacing:lc.regular},captionLink:{fontSize:zs[12],lineHeight:cc[140],fontWeight:Bc.regular,letterSpacing:lc.regular}},Qc={heading2xl:{...wn.heading2xl,fontSize:zs[36]},headingXl:{...wn.headingXl,fontSize:zs[32]},headingLg:{...wn.headingLg,fontSize:zs[24]},headingMd:{...wn.headingMd,fontSize:zs[18]},bodyBase:{...wn.bodyBase},bodySmall:{...wn.bodySmall},labelButton:{...wn.labelButton},labelDefault:{...wn.labelDefault},captionDefault:{...wn.captionDefault},captionLink:{...wn.captionLink}},khA={heading2xl:{mobile:wn.heading2xl,desktop:Qc.heading2xl},headingXl:{desktop:Qc.headingXl,mobile:wn.headingXl},headingLg:{desktop:Qc.headingLg,mobile:wn.headingLg},headingMd:{desktop:Qc.headingMd,mobile:wn.headingMd},bodyBase:{desktop:Qc.bodyBase,mobile:wn.bodyBase},bodySmall:{desktop:Qc.bodySmall,mobile:wn.bodySmall},labelButton:{desktop:Qc.labelButton,mobile:wn.labelButton},labelDefault:{desktop:Qc.labelDefault,mobile:wn.labelDefault},captionDefault:{desktop:Qc.captionDefault,mobile:wn.captionDefault},captionLink:{desktop:Qc.captionLink,mobile:wn.captionLink}},u0=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,P2=({r:t,g:A,b:e,luminanceThreshold:i})=>{const g=I=>(I=I/255,I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4));return .2126*g(t)+.7152*g(A)+.0722*g(e)>i},j2=.37,MhA=(t,A=j2)=>{const e=P2({...t,luminanceThreshold:A})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${e})`,"grey-text-light":`rgba(${e},0.70)`,"grey-ui-dark":`rgba(${e},0.3)`,"grey-ui-light":`rgba(${e},0.1)`}};function NhA(t,A,e){const i=u0(t)||{r:0,g:0,b:0},g=u0(A)||{r:255,g:255,b:255},I=Math.round(g.r*e+i.r*(1-e)),n=Math.round(g.g*e+i.g*(1-e)),o=Math.round(g.b*e+i.b*(1-e));return`#${m_(I)}${m_(n)}${m_(o)}`}function gj(t,A){const e={r:255,g:255,b:255},i=Math.max(0,Math.min(1,A));let g=t,I=u0(t)||e;(isNaN(I.r)||isNaN(I.g)||isNaN(I.b))&&(I=e,g="#FFFFFF");const n=P2({...I,luminanceThreshold:j2})?"#000000":"#FFFFFF";return NhA(g,n,i)}function m_(t){return t.toString(16).padStart(2,"0").toUpperCase()}const GhA=(t,A,e,i=j2)=>{const g={"grey-text-dark":e["grey-text-dark"],"grey-text-light":e["grey-text-light"],"grey-ui-dark":e["grey-ui-dark"],"grey-ui-light":e["grey-ui-light"],"primary-text":e["primary-text"]};if(t!=null&&t.startsWith("#")){const I=u0(t);I!==null&&Object.assign(g,MhA(I))}if(A!=null&&A.startsWith("#")){const I=u0(A);I!==null&&(g["primary-text"]=P2({...I,luminanceThreshold:i})?"black":"white")}return g},RhA=t=>({"primary-hover":gj(t,.1),"primary-pressed":gj(t,.15)}),UhA=(t,A)=>t||A,KhA=(t,A,e)=>{const i=Object.entries(t).map(([g,I])=>[g,UhA(e?e[I]:null,A[g])]);return Object.fromEntries(i)},X7=(t,A,e)=>{const i=KhA(t,A,e);return e?{...A,...i,...GhA(i.background,i.primary,A),...RhA(i.primary)}:{...A}},FhA=t=>X7(ShA,DhA,t),$7=t=>X7(yhA,fhA,t),Z2=t=>{if(!t)return tj;switch(t.shapes){case"rounded":return V7;case"rectangle":return whA;case"pill":return mhA;default:return tj}},yU=(t="",A)=>A.map(([e,i])=>`--rc-${t}-${e}: ${i}`).join("; "),bhA=t=>{const A=yU("color",Object.entries(FhA(t))),e=yU("shape",Object.entries(Z2(t)));return[A,e].join("; ")},vhA=t=>{const A=yU("color",Object.entries($7(t))),e=yU("shape",Object.entries(Z2(t)));return[A,e].join("; ")},_hA=(t="",A)=>Object.entries(A).flatMap(([e,{desktop:i,mobile:g}])=>[`--rc-${t}-${e}-desktop: normal normal ${i.fontWeight} ${i.fontSize}/${i.lineHeight} ${ij}`,`--rc-${t}-${e}-mobile: normal normal ${g.fontWeight} ${g.fontSize}/${g.lineHeight} ${ij}`,`--rc-${t}-${e}-desktop-font-size: ${i.fontSize}`,`--rc-${t}-${e}-mobile-font-size: ${g.fontSize}`]).join("; "),JhA=(t="",A)=>Object.entries(A).map(([e,{mobile:i,desktop:g}])=>`--rc-${t}-${e}-mobile: ${i};  --rc-${t}-${e}-desktop: ${g};`).join(" "),LhA={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"}};let qhA=class{constructor(t){ft(this,"brandingAppearance"),t?this.brandingAppearance=t:this.brandingAppearance=void 0}get shape(){return Z2(this.brandingAppearance)}get formColors(){return $7(this.brandingAppearance)}get formStyleVars(){return vhA(this.brandingAppearance)}get productInfoStyleVars(){return bhA(this.brandingAppearance)}get spacing(){return LhA}get textStyles(){return khA}get textStyleVars(){return _hA("text",this.textStyles)}get spacingStyleVars(){return JhA("spacing",this.spacing)}};var xhA=ot("<button><!></button>");const ThA={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 A$(t,A){ni(A,!0),Vt(t,ThA);const e=Jt(A,"intent",3,"primary"),i=Jt(A,"disabled",3,!1),g=Jt(A,"loading",3,!1),I=je(()=>new qhA(A.brandingAppearance)),n=je(()=>cA(I).textStyleVars),o=je(()=>cA(I).spacingStyleVars),a=je(()=>cA(I).productInfoStyleVars),r=je(()=>cA(I).formStyleVars),s=je(()=>[A.styleOverrides,cA(n),cA(o),cA(a),cA(r)].join("; "));var B=xhA();B.__click=function(...y){var S;(S=A.onclick)==null||S.apply(this,y)};var c=_e(B);{var E=y=>{uhA(y,{size:"small"})},D=y=>{phA(y,{size:"body-base",children:(S,f)=>{var M=Ig(),k=Bi(M);yEA(k,A,"default",{}),ue(S,M)},$$slots:{default:!0}})};Kt(c,y=>{g()?y(E):y(D,!1)})}dt(()=>{$E(B,`${`intent-${e()}`??""} svelte-td7xvm`),B.disabled=i(),qt(B,"data-testid",A.testId),qt(B,"type",A.type),qt(B,"style",cA(s))}),ue(t,B),oi()}vF(["click"]);const YhA=t=>{const{size:A,overrides:e,componentState:i,zStackChildStyles:g}=t,I={"--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"},n=H2(e,i);Object.assign(I,g),Object.assign(I,Nk({...A,...n})),Object.assign(I,vuA(t.mask_shape));const o=dC(I,"image"),a=buA(t),r=_uA(t);return{imageStyles:hs(o),maskPath:a,linearGradientAngle:r}};var HhA=Wc('<ellipse cx="50" rx="50"></ellipse>'),OhA=Wc("<path></path>"),PhA=Wc("<stop></stop>"),jhA=Wc("<linearGradient></linearGradient>"),ZhA=Wc("<stop></stop>"),WhA=Wc('<radialGradient cx="50%" cy="50%" r="50%" fx="50%" fy="50%"></radialGradient>'),zhA=Wc('<linearGradient><stop offset="0%"></stop></linearGradient>'),VhA=ot('<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 XhA={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 $hA(t,A){ni(A,!0),Vt(t,XhA);const e=du(A,["$$slots","$$events","$$legacy","id","source","purchaseState"]);let i=Ki(0),g;function I(){g&&Et(i,g.naturalHeight/g.naturalWidth)}const n=je(()=>YhA({id:A.id,colorMode:A.purchaseState.colorMode,source:A.source,purchaseState:A.purchaseState,...e,imageAspectRatio:cA(i)})),o=je(()=>cA(n).imageStyles),a=je(()=>cA(n).maskPath),r=je(()=>cA(n).linearGradientAngle),s=je(()=>{var K,R;const G=A.purchaseState.colorMode;return(K=A.source[G])!=null&&K.original?A.source[G].original:(R=A.source[IC])==null?void 0:R.original});var B=VhA(),c=Bi(B);v7(c,K=>g=K,()=>g);var E=St(c,2),D=_e(E),y=_e(D),S=_e(y);{var f=K=>{var R=HhA();dt(()=>{qt(R,"cy",cA(i)*50),qt(R,"ry",cA(i)*50)}),ue(K,R)},M=K=>{var R=OhA();dt(()=>qt(R,"d",cA(a))),ue(K,R)};Kt(S,K=>{var R;((R=A.mask_shape)==null?void 0:R.type)==="circle"?K(f):K(M,!1)})}var k=St(y);{var m=K=>{var R=jhA();XD(R,21,()=>{var G,J,x,H;return((J=(G=A.color_overlay)==null?void 0:G[A.purchaseState.colorMode])==null?void 0:J.points)||((H=(x=A.color_overlay)==null?void 0:x[IC])==null?void 0:H.points)||[]},VD,(G,J)=>{var x=PhA();dt(()=>{qt(x,"offset",`${cA(J).percent}%`),qt(x,"style",`stop-color: ${cA(J).color}`)}),ue(G,x)}),dt(()=>{qt(R,"id",`gradient-${A.id}`),qt(R,"x1",cA(r).x1),qt(R,"y1",cA(r).y1),qt(R,"x2",cA(r).x2),qt(R,"y2",cA(r).y2)}),ue(K,R)},U=K=>{var R=Ig(),G=Bi(R);{var J=H=>{var P=WhA();XD(P,21,()=>{var j,q,Y,O;return((q=(j=A.color_overlay)==null?void 0:j[A.purchaseState.colorMode])==null?void 0:q.points)||((O=(Y=A.color_overlay)==null?void 0:Y[IC])==null?void 0:O.points)||[]},VD,(j,q)=>{var Y=ZhA();dt(()=>{qt(Y,"offset",`${cA(q).percent}%`),qt(Y,"style",`stop-color: ${cA(q).color}`)}),ue(j,Y)}),dt(()=>qt(P,"id",`gradient-${A.id}`)),ue(H,P)},x=H=>{var P=Ig(),j=Bi(P);{var q=Y=>{var O=zhA(),$=_e(O);dt(()=>{var gA,z,X;qt(O,"id",`gradient-${A.id}`),qt($,"style",`stop-color: ${((gA=A.color_overlay[A.purchaseState.colorMode])==null?void 0:gA.value)||((X=(z=A.color_overlay)==null?void 0:z[IC])==null?void 0:X.value)}`)}),ue(Y,O)};Kt(j,Y=>{var O,$;(($=(O=A.color_overlay)==null?void 0:O[A.purchaseState.colorMode])==null?void 0:$.type)==="hex"&&Y(q)},!0)}ue(H,P)};Kt(G,H=>{var P,j;((j=(P=A.color_overlay)==null?void 0:P[A.purchaseState.colorMode])==null?void 0:j.type)==="radial"?H(J):H(x,!1)},!0)}ue(K,R)};Kt(k,K=>{var R,G;((G=(R=A.color_overlay)==null?void 0:R[A.purchaseState.colorMode])==null?void 0:G.type)==="linear"?K(m):K(U,!1)})}var F=St(D),b=St(F);dt(()=>{qt(c,"src",cA(s)),qt(E,"id",`rc-pw-image-container-${A.id}`),qt(E,"style",cA(o)),qt(E,"viewBox",`0 0 100 ${cA(i)*100}`),qt(y,"id",`clip-path-${A.id}`),qt(F,"href",cA(s)),qt(F,"height",cA(i)*100),qt(F,"clip-path",`url(#clip-path-${A.id})`),qt(F,"id",A.id),qt(b,"height",cA(i)*100),qt(b,"clip-path",`url(#clip-path-${A.id})`),qt(b,"fill",`url(#gradient-${A.id})`)}),Uc("load",c,I),ue(t,B),oi()}function AdA({stack:t,zStackChildStyles:A}){const e=t.size.width.type==="fill"?"100%":"fit-content",i=dC(A||{},"purchase-button");return hs({...i,position:"var(--purchase-button-position, relative)",inset:"var(--purchase-button-inset, 0)",transform:"var(--purchase-button-transform, initial)",width:e})}const edA={hash:"svelte-1x8zwdp",code:""};function tdA(t,A){ni(A,!0),Vt(t,edA);const e=du(A,["$$slots","$$events","$$legacy","stack","labels","onAction","purchaseState","variableDictionary","zStackChildStyles"]),i=()=>{A.onAction&&A.onAction({type:"purchase"})},g=je(()=>AdA({stack:A.stack,labels:A.labels,onAction:A.onAction,purchaseState:A.purchaseState,variableDictionary:A.variableDictionary,zStackChildStyles:A.zStackChildStyles,...e}));W7(t,{onclick:i,class:"rc-pw-purchase-button",get style(){return cA(g)},children:(I,n)=>{Gk(I,lQ(()=>A.stack,{get labels(){return A.labels},get purchaseState(){return A.purchaseState},get variableDictionary(){return A.variableDictionary}}))},$$slots:{default:!0}}),oi()}const idA=(t,A)=>{t.preventDefault(),t.stopPropagation(),A.onAction&&A.onAction({type:"select_package"},{packageId:A.package_id})};var gdA=ot('<button class="rc-pw-package svelte-123kamd"><!></button>');const IdA={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 ndA(t,A){ni(A,!0),Vt(t,IdA);const e=je(()=>{var o;return((o=A.purchaseState.variablesPerPackage)==null?void 0:o[A.package_id])||A.variableDictionary}),i=je(()=>{var o;return{selected:((o=A.purchaseState)==null?void 0:o.selectedPackageId)===A.package_id}}),g=je(()=>hs(dC(A.zStackChildStyles,"package")));var I=gdA();I.__click=[idA,A];var n=_e(I);Gk(n,lQ(()=>A.stack,{get labels(){return A.labels},get onAction(){return A.onAction},get purchaseState(){return A.purchaseState},get componentState(){return cA(i)},get variableDictionary(){return cA(e)}})),dt(()=>{qt(I,"id",A.id),qt(I,"style",cA(g)),IQ(I,"selected",cA(i).selected)}),ue(t,I),oi()}vF(["click"]);function odA(t){const A={"--item-spacing":`${t.item_spacing}px`,"--width":"initial","--height":"initial","--flex":"0 1 auto","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(A,Nk(t.size)),Object.assign(A,t.zStackChildStyles);const e=dC(A,"timeline");return hs(e)}function adA(t){var A,e,i,g,I,n,o,a,r,s;const B={"--icon-size":`${t.icon.width_and_height}px`,"--icon-padding":`${t.icon.padding}px`,"--icon-color":nQ({colorMap:t.icon.color,colorMode:(A=t.purchaseState)==null?void 0:A.colorMode}),"--icon-background-color":nQ({colorMap:(e=t.icon_background)==null?void 0:e.color,colorMode:t.purchaseState.colorMode}),"--icon-border":H7((i=t.icon_background)==null?void 0:i.border,(g=t.purchaseState)==null?void 0:g.colorMode),"--text-spacing":`${t.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":nQ({colorMap:(I=t.connector)==null?void 0:I.color,colorMode:t.purchaseState.colorMode}),"--connector-width":`${((n=t.connector)==null?void 0:n.width)||0}px`,"--connector-top":"0px","--connector-height":`${t.item_spacing}px`};if(Object.assign(B,((a=(o=t.icon_background)==null?void 0:o.shape)==null?void 0:a.type)==="rectangle"?fU((s=(r=t.icon_background)==null?void 0:r.shape)==null?void 0:s.corners):{"--border-start-start-radius":"50%","--border-start-end-radius":"50%","--border-end-start-radius":"50%","--border-end-end-radius":"50%"}),t.connector){const E=t.connector.margin.top!==0,D=t.connector.margin.bottom!==0,y=t.icon.padding+t.icon.width_and_height/2;!E&&!D&&(B["--connector-height"]=`${t.item_spacing+y*2}px`,B["--connector-top"]="50%"),E&&D&&(B["--connector-height"]=`${t.item_spacing-t.connector.margin.top-t.connector.margin.bottom}px`,B["--connector-top"]=`calc(100% + ${t.connector.margin.top}px)`),!E&&D&&(B["--connector-height"]=`${t.item_spacing-t.connector.margin.bottom+y}px`,B["--connector-top"]="50%"),E&&!D&&(B["--connector-height"]=`${t.item_spacing+y}px`,B["--connector-top"]=`calc(100% + ${t.connector.margin.top}px)`)}const c=dC(B,"timeline-item");return hs(c)}function Ij(t,A="title"){var e,i,g,I,n;const o={"--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"},a={color:((e=t[A])==null?void 0:e.color)||P7,font_size:((i=t[A])==null?void 0:i.font_size)||"body_m",font_weight:((g=t[A])==null?void 0:g.font_weight)||"regular",horizontal_alignment:((I=t[A])==null?void 0:I.horizontal_alignment)||"leading"},{tagToRender:r,textStyles:s}=O2({...t,components:[],...a,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:""});Object.assign(o,s);const B=hs(dC(o,"timeline-item")),c=Y2({text_lid:(n=t[A])==null?void 0:n.text_lid,locale:t.purchaseState.locale,defaultLocale:t.purchaseState.defaultLocale,labels:t.labels,variableDictionary:t.variableDictionary});return{textStyles:B,tagToRender:r,textLabel:c}}var rdA=ot('<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 sdA={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 CdA(t,A){ni(A,!0),Vt(t,sdA);const e=du(A,["$$slots","$$events","$$legacy"]),i=je(()=>adA(e)),g=je(()=>Ij(e,"title")),I=je(()=>cA(g).tagToRender),n=je(()=>cA(g).textStyles),o=je(()=>cA(g).textLabel),a=je(()=>Ij(e,"description")),r=je(()=>cA(a).tagToRender),s=je(()=>cA(a).textStyles),B=je(()=>cA(a).textLabel);var c=rdA(),E=St(_e(c),2),D=_e(E);EU(D,()=>cA(I),!1,(f,M)=>{let k;dt(()=>k=uU(f,k,{class:"rc-pw-timeline-item-content-title",style:cA(n)},"svelte-gjmo4g",f.namespaceURI===l0,f.nodeName.includes("-")));var m=Lg();dt(()=>Oi(m,cA(o))),ue(M,m)});var y=St(D,2);{var S=f=>{var M=Ig(),k=Bi(M);EU(k,()=>cA(r),!1,(m,U)=>{let F;dt(()=>F=uU(m,F,{class:"rc-pw-timeline-item-content-description",style:cA(s)},"svelte-gjmo4g",m.namespaceURI===l0,m.nodeName.includes("-")));var b=Lg();dt(()=>Oi(b,cA(B))),ue(U,b)}),ue(f,M)};Kt(y,f=>{cA(B)&&f(S)})}dt(()=>qt(c,"style",cA(i))),ue(t,c),oi()}var BdA=ot('<div class="rc-pw-timeline-container svelte-12g27vu"></div>');const cdA={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 ldA(t,A){ni(A,!0),Vt(t,cdA);const e=du(A,["$$slots","$$events","$$legacy","items"]),i=je(()=>odA({items:A.items,...e}));var g=Ig(),I=Bi(g);{var n=o=>{var a=BdA();XD(a,21,()=>A.items,VD,(r,s,B)=>{var c=je(()=>`${A.id}-${B}`),E=je(()=>`${A.name}-${B}`);CdA(r,lQ(()=>cA(s),{get labels(){return A.labels},get id(){return cA(c)},get name(){return cA(E)},type:"timeline",get purchaseState(){return A.purchaseState},get text_spacing(){return A.text_spacing},get item_spacing(){return A.item_spacing}}))}),dt(()=>qt(a,"style",cA(i))),ue(o,a)};Kt(I,o=>{A.items.length&&o(n)})}ue(t,g),oi()}var QdA=ot('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const EdA={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function udA(t,A){ni(A,!1),Vt(t,EdA);let e=Jt(A,"children",8);hC();var i=QdA(),g=_e(i);Bn(g,()=>e()??qg),ue(t,i),oi()}const hdA={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 ddA(t,A){ni(A,!1),Vt(t,hdA);let e=Jt(A,"as",8,"section"),i=Jt(A,"children",8);hC();var g=Ig(),I=Bi(g);EU(I,e,!1,(n,o)=>{uU(n,null,{class:"rcb-modal-section"},"svelte-1bzqb13",n.namespaceURI===l0,n.nodeName.includes("-"));var a=Ig(),r=Bi(a);Bn(r,()=>i()??qg),ue(o,a)}),ue(t,g),oi()}var pdA=ot("<div><!></div>");const fdA={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 e$(t,A){ni(A,!1),Vt(t,fdA);let e=Jt(A,"gap",8,"small"),i=Jt(A,"align",8,"start"),g=Jt(A,"children",8);hC();var I=pdA(),n=_e(I);Bn(n,()=>g()??qg),dt(()=>$E(I,`rcb-column gap-${e()??""} align-${i()??""} svelte-b5dygi`)),ue(t,I),oi()}var DdA=ot('<div class="rcb-row svelte-1seeuxq"><!></div>');const ydA={hash:"svelte-1seeuxq",code:".rcb-row.svelte-1seeuxq {display:flex;flex-direction:row;justify-content:flex-start;}"};function SdA(t,A){ni(A,!1),Vt(t,ydA);let e=Jt(A,"children",8);hC();var i=DdA(),g=_e(i);Bn(g,()=>e()??qg),ue(t,i),oi()}var wdA=ot("<span><!></span>");const mdA={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 lg(t,A){ni(A,!0),Vt(t,mdA);const e=Jt(A,"size",3,"body-base"),i=Jt(A,"branded",3,!1);var g=wdA(),I=_e(g);Bn(I,()=>A.children??qg),dt(()=>$E(g,`rcb-typography rcb-typography-${e()??""} ${(i()?"rcb-typography-branded":"")??""} svelte-orw2sj`)),ue(t,g),oi()}var kdA=ot("<div><!></div>"),MdA=ot('<span style="display: block;"><!></span>'),NdA=ot("<!> <!>",1),GdA=ot("<!> <!>",1),RdA=ot('<div class="rcb-modal-message svelte-w46z5s" data-type="error"><!></div>');const UdA={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 KdA(t,A){ni(A,!0),Vt(t,UdA);const e=Jt(A,"title",3,null),i=Jt(A,"icon",3,null),g=32;let I=Ki(null),n=Ki(!1),o;cC(()=>(cA(I)&&(o=new ResizeObserver(()=>{var s;Et(n,(((s=cA(I))==null?void 0:s.offsetHeight)??0)>g)}),o.observe(cA(I))),()=>{o?.disconnect()}));var a=RdA(),r=_e(a);e$(r,{gap:"medium",align:"start",children:(s,B)=>{var c=GdA(),E=Bi(c);SdA(E,{children:(S,f)=>{var M=NdA(),k=Bi(M);{var m=b=>{var K=kdA(),R=_e(K);Bn(R,i),dt(()=>$E(K,`rcb-modal-message-icon ${(cA(n)?"large":"small")??""} svelte-w46z5s`)),ue(b,K)};Kt(k,b=>{i()&&b(m)})}var U=St(k,2);{var F=b=>{var K=MdA(),R=_e(K);lg(R,{size:"heading-md",children:(G,J)=>{var x=Lg();dt(()=>Oi(x,e())),ue(G,x)},$$slots:{default:!0}}),v7(K,G=>Et(I,G),()=>cA(I)),ue(b,K)};Kt(U,b=>{e()&&b(F)})}ue(S,M)},$$slots:{default:!0}});var D=St(E,2);{var y=S=>{lg(S,{size:"body-small",children:(f,M)=>{var k=Ig(),m=Bi(k);Bn(m,()=>A.message??qg),ue(f,k)},$$slots:{default:!0}})};Kt(D,S=>{A.message&&S(y)})}ue(s,c)},$$slots:{default:!0}}),dt(()=>qt(a,"data-has-title",!!e())),ue(t,a),oi()}var FdA=ot('<div class="rcb-modal-message-icon svelte-c8cuu5"><!></div>'),bdA=ot("<!> <!>",1),vdA=ot('<div class="rcb-modal-message svelte-c8cuu5" data-type="success"><!></div>');const _dA={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 JdA(t,A){ni(A,!0),Vt(t,_dA);const e=Jt(A,"title",3,null),i=Jt(A,"icon",3,null);var g=vdA(),I=_e(g);e$(I,{gap:"large",align:"center",children:(n,o)=>{var a=bdA(),r=Bi(a);{var s=E=>{var D=FdA(),y=_e(D);Bn(y,i),ue(E,D)};Kt(r,E=>{i()&&E(s)})}var B=St(r,2);{var c=E=>{lg(E,{size:"heading-md",children:(D,y)=>{var S=Lg();dt(()=>Oi(S,e())),ue(D,S)},$$slots:{default:!0}})};Kt(B,E=>{e()&&E(c)})}ue(n,a)},$$slots:{default:!0}}),dt(()=>qt(g,"data-has-title",!!e())),ue(t,g),oi()}const W2="rcb-ui-events-tracker",z2="branding";var LdA=ot('<div class="message-layout svelte-qavr33"><div class="message-layout-content svelte-qavr33"><!></div> <div class="message-layout-footer"><!></div></div>');const qdA={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 V2(t,A){ni(A,!0),Vt(t,qdA);let e=Jt(A,"title",3,null),i=Jt(A,"closeButtonTitle",3,"Go back to app"),g=Jt(A,"icon",3,null),I=Jt(A,"message",3,null);const n=fa(z2);function o(){A.onDismiss()}var a=LdA(),r=_e(a),s=_e(r);ddA(s,{children:(E,D)=>{var y=Ig(),S=Bi(y);{var f=k=>{JdA(k,{get title(){return e()},get icon(){return g()}})},M=k=>{KdA(k,{get title(){return e()},get icon(){return g()},get message(){return I()}})};Kt(S,k=>{A.type==="success"?k(f):k(M,!1)})}ue(E,y)},$$slots:{default:!0}});var B=St(r,2),c=_e(B);udA(c,{children:(E,D)=>{A$(E,{onclick:o,type:"submit",brandingAppearance:n,children:(y,S)=>{var f=Lg();dt(()=>Oi(f,i())),ue(y,f)},$$slots:{default:!0}})},$$slots:{default:!0}}),ue(t,a),oi()}function kr(t,A){ni(A,!0);const e=Lr(),i=()=>Jr(I,"$translator",e),g=Jt(A,"key",3,""),I=fa(us),n=je(()=>g()?i().translate(g()||"",A.variables):void 0);var o=Ig(),a=Bi(o);{var r=B=>{var c=Lg();dt(()=>Oi(c,cA(n))),ue(B,c)},s=B=>{var c=Ig(),E=Bi(c);Bn(E,()=>A.children??qg),ue(B,c)};Kt(a,B=>{cA(n)?B(r):B(s,!1)})}ue(t,o),oi()}var xdA=ot('<p class="footer-caption svelte-1hbk6xu"><!></p>'),TdA=ot('<p class="footer-caption svelte-1hbk6xu"><!></p>'),YdA=ot('<div class="footer-caption-container svelte-1hbk6xu"><!> <!> <p class="footer-caption svelte-1hbk6xu"><!></p></div>');const HdA={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 OdA(t,A){ni(A,!1),Vt(t,HdA);const e=Lr(),i=()=>Jr(S,"$translator",e),g=$C(),I=$C(),n=$C(),o=$C(),a=$C(),r=$C(),s=$C(),B=$C(),c=$C(),E=$C();let D=Jt(A,"brandingInfo",8,null),y=Jt(A,"purchaseOption",8,null);const S=fa(us);function f(J){return J!=null&&"base"in J}function M(J){return J!=null&&"basePrice"in J}function k(J){return J?J.trial?vt.PaymentEntryPageTrialSubscriptionTermsInfo:vt.PaymentEntryPageSubscriptionTermsInfo:vt.PaymentEntryPageOtpTermsInfo}Cc(()=>BR(y()),()=>{Et(g,f(y())?y():null)}),Cc(()=>BR(y()),()=>{Et(I,M(y())?y():null)}),Cc(()=>cA(g),()=>{Et(n,k(cA(g)))}),Cc(()=>cA(g),()=>{var J,x;Et(o,((J=cA(g))==null?void 0:J.introPrice)||((x=cA(g))==null?void 0:x.base))}),Cc(()=>(cA(I),cA(o)),()=>{var J,x;Et(a,((J=cA(I))==null?void 0:J.basePrice)||((x=cA(o))==null?void 0:x.price))}),Cc(()=>(cA(a),i()),()=>{Et(r,cA(a)?xE(cA(a).amountMicros,cA(a).currency,i().locale||i().fallbackLocale):null)}),Cc(()=>(cA(o),i()),()=>{var J,x,H,P,j;Et(s,(J=cA(o))!=null&&J.period?i().translatePeriodFrequency(((H=(x=cA(o))==null?void 0:x.period)==null?void 0:H.number)||1,(j=(P=cA(o))==null?void 0:P.period)==null?void 0:j.unit,{useMultipleWords:!0}):null)}),Cc(()=>(cA(g),i(),Ox),()=>{var J,x;Et(B,(x=(J=cA(g))==null?void 0:J.trial)!=null&&x.period?i().translateDate(Ox(new Date,cA(g).trial.period,!0),{year:"numeric",month:"long",day:"numeric"}):null)}),Cc(()=>(BR(D()),cA(a),i(),cA(n),cA(r),cA(s),cA(B)),()=>{var J;Et(c,D()&&cA(a)?i().translate(cA(n),{appName:(J=D())==null?void 0:J.app_name,price:cA(r),perFrequency:cA(s),renewalDate:cA(B)}):null)}),Cc(()=>(cA(g),i(),vt),()=>{Et(E,cA(g)?i().translate(vt.PaymentEntryPageSubscriptionInfo):null)}),tEA(),hC();var m=YdA(),U=_e(m);{var F=J=>{var x=xdA(),H=_e(x);lg(H,{size:"caption-default",children:(P,j)=>{var q=Lg();dt(()=>Oi(q,cA(c))),ue(P,q)},$$slots:{default:!0}}),ue(J,x)};Kt(U,J=>{cA(c)&&J(F)})}var b=St(U,2);{var K=J=>{var x=TdA(),H=_e(x);lg(H,{size:"caption-default",children:(P,j)=>{var q=Lg();dt(()=>Oi(q,cA(E))),ue(P,q)},$$slots:{default:!0}}),ue(J,x)};Kt(b,J=>{cA(E)&&J(K)})}var R=St(b,2),G=_e(R);lg(G,{size:"caption-default",children:(J,x)=>{kr(J,{get key(){return vt.PaymentEntryPagePaymentStepTitle}})},$$slots:{default:!0}}),ue(t,m),oi()}var vr=(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))(vr||{}),X2=(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))(X2||{});function PdA({errorCode:t,errorMessage:A}){return{eventName:vr.CheckoutFlowError,properties:{errorCode:t,errorMessage:A}}}function jdA({errorCode:t,errorMessage:A}){return{eventName:vr.CheckoutPaymentFormError,properties:{errorCode:t,errorMessage:A}}}function ZdA({appearance:t,rcPackage:A,purchaseOptionToUse:e,customerEmail:i}){return{eventName:vr.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:A.webBillingProduct.normalPeriodDuration,productPrice:A.webBillingProduct.price.amountMicros,productCurrency:A.webBillingProduct.price.currency,selectedProductId:A.webBillingProduct.identifier,selectedPackageId:A.identifier,selectedPurchaseOption:e.id,customerEmailProvidedByDeveloper:!!i}}}function WdA({redemptionInfo:t}){return{eventName:vr.CheckoutSessionEnd,properties:{outcome:"finished",withRedemptionInfo:!!t}}}function zdA(){return{eventName:vr.CheckoutSessionEnd,properties:{outcome:"closed"}}}function VdA({errorCode:t,errorMessage:A}){return{eventName:vr.CheckoutSessionEnd,properties:{outcome:"errored",errorCode:t,errorMessage:A}}}function XdA({taxCalculation:t,taxCustomerDetails:A}){const e=t.failed_reason===X2.tax_collection_disabled?"disabled":t.failed_reason?"failed":t.tax_amount_in_micros===0?"not-taxed":"taxed",i=A===null?"auto":"form";return{eventName:vr.CheckoutPaymentTaxCalculation,properties:{outcome:e,ui_element:i,tax_inclusive:t.tax_inclusive,error_code:t.failed_reason??null}}}function $dA({selectedPaymentMethod:t}){return{eventName:vr.CheckoutPaymentFormSubmit,properties:{selectedPaymentMethod:t??null}}}function ApA({errorCode:t,errorMessage:A}){return{eventName:vr.CheckoutPaymentFormGatewayError,properties:{errorCode:t,errorMessage:A}}}const epA=`<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 tpA=ot('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1sxpw7o"><!></div>');const ipA={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 gpA(t){Vt(t,ipA);var A=tpA(),e=_e(A);hu(e,()=>epA),ue(t,A)}var IpA=ot('<div class="rcb-modal-loader svelte-102edf4"><!></div>');const npA={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 t$(t){Vt(t,npA);var A=IpA(),e=_e(A);gpA(e),ue(t,A)}function opA(t,A){var e,i;ni(A,!0);const g=Lr(),I=()=>Jr(n,"$translator",g),n=fa(us),o=fa(z2),a=je(()=>A.priceBreakdown?I().formatPrice(A.priceBreakdown.totalAmountInMicros,A.priceBreakdown.currency):null),r=(i=(e=A.subscriptionOption)==null?void 0:e.trial)==null?void 0:i.period,s=je(()=>r?I().translatePeriod(r.number,r.unit):null);A$(t,{get disabled(){return A.disabled},testId:"PayButton",brandingAppearance:o,children:(B,c)=>{var E=Ig(),D=Bi(E);{var y=f=>{var M=je(()=>({trialPeriodLabel:cA(s)}));kr(f,{get key(){return vt.PaymentEntryPageButtonStartTrial},get variables(){return cA(M)}})},S=f=>{var M=Ig(),k=Bi(M);{var m=F=>{var b=je(()=>({formattedPrice:cA(a)}));kr(F,{get key(){return vt.PaymentEntryPageButtonWithPrice},get variables(){return cA(b)}})},U=F=>{kr(F,{get key(){return vt.PaymentEntryPageButtonPay}})};Kt(k,F=>{cA(a)?F(m):F(U,!1)},!0)}ue(f,M)};Kt(D,f=>{var M;(M=A.subscriptionOption)!=null&&M.trial?f(y):f(S,!1)})}ue(B,E)},$$slots:{default:!0}}),oi()}const apA={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"},rpA={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"},i$={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},spA={...i$,"input-background":"color_form_bg",background:"color_form_bg"},CpA={...i$,"input-background":"color_product_info_bg",background:"color_product_info_bg"},g$={"input-border-radius":"4px","input-button-border-radius":"8px"},BpA={"input-border-radius":"0px","input-button-border-radius":"0px"},cpA={"input-border-radius":"12px","input-button-border-radius":"9999px"},nj=g$,SU="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",I$="BrandCustomFont",oj=`${I$}, ${SU}`,Ec={regular:"400",medium:"500",semibold:"600"},Vs={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},uc={130:"130%",140:"140%"},hc={tight:"0.20%",regular:"0",loose:"0.20%"},mn={heading2xl:{fontSize:Vs[28],lineHeight:uc[130],fontWeight:Ec.semibold,letterSpacing:hc.loose},headingXl:{fontSize:Vs[24],lineHeight:uc[130],fontWeight:Ec.semibold,letterSpacing:hc.loose},headingLg:{fontSize:"20px",lineHeight:uc[130],fontWeight:Ec.semibold,letterSpacing:hc.loose},headingMd:{fontSize:"16px",lineHeight:uc[140],fontWeight:Ec.medium,letterSpacing:hc.regular},bodyBase:{fontSize:Vs[16],lineHeight:uc[140],fontWeight:Ec.regular,letterSpacing:hc.regular},bodySmall:{fontSize:Vs[14],lineHeight:uc[140],fontWeight:Ec.regular,letterSpacing:hc.regular},labelButton:{fontSize:Vs[16],lineHeight:uc[140],fontWeight:Ec.semibold,letterSpacing:hc.tight},labelDefault:{fontSize:Vs[14],lineHeight:uc[140],fontWeight:Ec.regular,letterSpacing:hc.tight},captionDefault:{fontSize:Vs[12],lineHeight:uc[140],fontWeight:Ec.regular,letterSpacing:hc.regular},captionLink:{fontSize:Vs[12],lineHeight:uc[140],fontWeight:Ec.regular,letterSpacing:hc.regular}},dc={heading2xl:{...mn.heading2xl,fontSize:Vs[36]},headingXl:{...mn.headingXl,fontSize:Vs[32]},headingLg:{...mn.headingLg,fontSize:Vs[24]},headingMd:{...mn.headingMd,fontSize:Vs[18]},bodyBase:{...mn.bodyBase},bodySmall:{...mn.bodySmall},labelButton:{...mn.labelButton},labelDefault:{...mn.labelDefault},captionDefault:{...mn.captionDefault},captionLink:{...mn.captionLink}},Vx={heading2xl:{mobile:mn.heading2xl,desktop:dc.heading2xl},headingXl:{desktop:dc.headingXl,mobile:mn.headingXl},headingLg:{desktop:dc.headingLg,mobile:mn.headingLg},headingMd:{desktop:dc.headingMd,mobile:mn.headingMd},bodyBase:{desktop:dc.bodyBase,mobile:mn.bodyBase},bodySmall:{desktop:dc.bodySmall,mobile:mn.bodySmall},labelButton:{desktop:dc.labelButton,mobile:mn.labelButton},labelDefault:{desktop:dc.labelDefault,mobile:mn.labelDefault},captionDefault:{desktop:dc.captionDefault,mobile:mn.captionDefault},captionLink:{desktop:dc.captionLink,mobile:mn.captionLink}},h0=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,$2=({r:t,g:A,b:e,luminanceThreshold:i})=>{const g=I=>(I=I/255,I<=.03928?I/12.92:Math.pow((I+.055)/1.055,2.4));return .2126*g(t)+.7152*g(A)+.0722*g(e)>i},AH=.37,lpA=(t,A=AH)=>{const e=$2({...t,luminanceThreshold:A})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${e})`,"grey-text-light":`rgba(${e},0.70)`,"grey-ui-dark":`rgba(${e},0.3)`,"grey-ui-light":`rgba(${e},0.1)`}};function QpA(t,A,e){const i=h0(t)||{r:0,g:0,b:0},g=h0(A)||{r:255,g:255,b:255},I=Math.round(g.r*e+i.r*(1-e)),n=Math.round(g.g*e+i.g*(1-e)),o=Math.round(g.b*e+i.b*(1-e));return`#${k_(I)}${k_(n)}${k_(o)}`}function aj(t,A){const e={r:255,g:255,b:255},i=Math.max(0,Math.min(1,A));let g=t,I=h0(t)||e;(isNaN(I.r)||isNaN(I.g)||isNaN(I.b))&&(I=e,g="#FFFFFF");const n=$2({...I,luminanceThreshold:AH})?"#000000":"#FFFFFF";return QpA(g,n,i)}function k_(t){return t.toString(16).padStart(2,"0").toUpperCase()}const EpA=(t,A,e,i=AH)=>{const g={"grey-text-dark":e["grey-text-dark"],"grey-text-light":e["grey-text-light"],"grey-ui-dark":e["grey-ui-dark"],"grey-ui-light":e["grey-ui-light"],"primary-text":e["primary-text"]};if(t!=null&&t.startsWith("#")){const I=h0(t);I!==null&&Object.assign(g,lpA(I))}if(A!=null&&A.startsWith("#")){const I=h0(A);I!==null&&(g["primary-text"]=$2({...I,luminanceThreshold:i})?"black":"white")}return g},upA=t=>({"primary-hover":aj(t,.1),"primary-pressed":aj(t,.15)}),hpA=(t,A)=>t||A,dpA=(t,A,e)=>{const i=Object.entries(t).map(([g,I])=>[g,hpA(e?e[I]:null,A[g])]);return Object.fromEntries(i)},n$=(t,A,e)=>{const i=dpA(t,A,e);return e?{...A,...i,...EpA(i.background,i.primary,A),...upA(i.primary)}:{...A}},ppA=t=>n$(CpA,rpA,t),o$=t=>n$(spA,apA,t),eH=t=>{if(!t)return nj;switch(t.shapes){case"rounded":return g$;case"rectangle":return BpA;case"pill":return cpA;default:return nj}},wU=(t="",A)=>A.map(([e,i])=>`--rc-${t}-${e}: ${i}`).join("; "),a$=t=>{const A=wU("color",Object.entries(ppA(t))),e=wU("shape",Object.entries(eH(t)));return[A,e].join("; ")},fpA=t=>{const A=wU("color",Object.entries(o$(t))),e=wU("shape",Object.entries(eH(t)));return[A,e].join("; ")},DpA=(t="",A,e)=>Object.entries(A).flatMap(([i,{desktop:g,mobile:I}])=>{const n=`normal normal ${g.fontWeight} ${g.fontSize}/${g.lineHeight} ${SU}`,o=`normal normal ${I.fontWeight} ${I.fontSize}/${I.lineHeight} ${SU}`,a=`normal normal ${e?.desktop.font_weight} ${e?.desktop.font_size} ${oj}`,r=`normal normal ${e?.mobile.font_weight} ${e?.mobile.font_size} ${oj}`;return[`--rc-${t}-${i}-desktop: ${n}`,`--rc-${t}-${i}-mobile: ${o}`,`--rc-${t}-${i}-branded-desktop: ${e?a:n}`,`--rc-${t}-${i}-branded-mobile: ${e?r:o}`,`--rc-${t}-${i}-desktop-font-size: ${g.fontSize}`,`--rc-${t}-${i}-mobile-font-size: ${I.fontSize}`]}).join("; "),ypA=(t="",A)=>Object.entries(A).map(([e,{mobile:i,desktop:g}])=>`--rc-${t}-${e}-mobile: ${i};  --rc-${t}-${e}-desktop: ${g};`).join(" "),SpA={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 d0{constructor(A){ft(this,"brandingAppearance"),A?this.brandingAppearance=A:this.brandingAppearance=void 0}get shape(){return eH(this.brandingAppearance)}get formColors(){return o$(this.brandingAppearance)}get formStyleVars(){return fpA(this.brandingAppearance)}get productInfoStyleVars(){return a$(this.brandingAppearance)}get spacing(){return SpA}get textStyles(){return Vx}getTextStyleVars(A){return DpA("text",this.textStyles,A)}get spacingStyleVars(){return ypA("spacing",this.spacing)}}var r$="basil",wpA=function(t){return t===3?"v3":t},s$="https://js.stripe.com",mpA="".concat(s$,"/").concat(r$,"/stripe.js"),kpA=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,MpA=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,NpA=function(t){return kpA.test(t)||MpA.test(t)},GpA=function(){for(var t=document.querySelectorAll('script[src^="'.concat(s$,'"]')),A=0;A<t.length;A++){var e=t[A];if(NpA(e.src))return e}return null},rj=function(t){var A="",e=document.createElement("script");e.src="".concat(mpA).concat(A);var i=document.head||document.body;if(!i)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return i.appendChild(e),e},RpA=function(t,A){!t||!t._registerWrapper||t._registerWrapper({name:"stripe-js",version:"7.3.1",startTime:A})},fw=null,fN=null,DN=null,UpA=function(t){return function(A){t(new Error("Failed to load Stripe.js",{cause:A}))}},KpA=function(t,A){return function(){window.Stripe?t(window.Stripe):A(new Error("Stripe.js not available"))}},FpA=function(t){return fw!==null?fw:(fw=new Promise(function(A,e){if(typeof window>"u"||typeof document>"u"){A(null);return}if(window.Stripe){A(window.Stripe);return}try{var i=GpA();if(!(i&&t)){if(!i)i=rj(t);else if(i&&DN!==null&&fN!==null){var g;i.removeEventListener("load",DN),i.removeEventListener("error",fN),(g=i.parentNode)===null||g===void 0||g.removeChild(i),i=rj(t)}}DN=KpA(A,e),fN=UpA(e),i.addEventListener("load",DN),i.addEventListener("error",fN)}catch(I){e(I);return}}),fw.catch(function(A){return fw=null,Promise.reject(A)}))},bpA=function(t,A,e){if(t===null)return null;var i=A[0],g=i.match(/^pk_test/),I=wpA(t.version),n=r$,o=t.apply(void 0,A);return RpA(o,e),o},yN,C$=!1,B$=function(){return yN||(yN=FpA(null).catch(function(t){return yN=null,Promise.reject(t)}),yN)};Promise.resolve().then(function(){return B$()}).catch(function(t){});var vpA=function(){for(var t=arguments.length,A=new Array(t),e=0;e<t;e++)A[e]=arguments[e];C$=!0;var i=Date.now();return B$().then(function(g){return bpA(g,A,i)})},Xx=(t=>(t[t.ErrorLoadingStripe=0]="ErrorLoadingStripe",t[t.HandledFormError=1]="HandledFormError",t[t.UnhandledFormError=2]="UnhandledFormError",t))(Xx||{});class lR{constructor(A,e,i){this.code=A,this.gatewayErrorCode=e,this.message=i}}const c$=class QR{static getStripeLocale(A){if(["ca","hi","uk"].includes(A))return"auto";const e={zh_Hans:"zh",zh_Hant:"zh"};return Object.keys(e).includes(A)?e[A]:A}static async initializeStripe(A,e,i,g,I,n,o){if(!e||!A||!i)throw{code:0,gatewayErrorCode:void 0,message:"Stripe configuration is missing"};const a=await vpA(e,{stripeAccount:A}).catch(y=>{throw this.mapInitializationError(y)});if(!a)throw{code:0,gatewayErrorCode:void 0,message:"Stripe client not found"};const r=new d0(g?.appearance),s=r.shape,B=r.formColors,c=r.textStyles,E=Vx.bodyBase[o].fontSize||Vx.bodyBase.mobile.fontSize;let D;try{D=a.elements({mode:i.mode,paymentMethodTypes:i.payment_method_types,setupFutureUsage:i.setup_future_usage,amount:i.amount,currency:i.currency,loader:"always",locale:I,appearance:{theme:"stripe",labels:"floating",variables:{borderRadius:s["input-border-radius"],focusBoxShadow:"none",colorDanger:B.error,colorTextPlaceholder:B["grey-text-light"],colorText:B["grey-text-dark"],colorTextSecondary:B["grey-text-light"],fontSizeBase:E,...n},rules:{".Input":{boxShadow:"none",paddingTop:"6px",paddingBottom:"6px",fontSize:E,border:`1px solid ${B["grey-ui-dark"]}`,backgroundColor:B["input-background"],color:B["grey-text-dark"]},".Input:focus":{border:`1px solid ${B.focus}`,outline:"none"},".Label":{fontWeight:c.labelDefault[o].fontWeight,lineHeight:"22px",color:B["grey-text-dark"]},".Label--floating":{opacity:"1"},".Input--invalid":{boxShadow:"none"}}}})}catch(y){throw this.mapInitializationError(y)}return{stripe:a,elements:D}}static async updateElementsConfiguration(A,e){A.update({mode:e.mode,paymentMethodTypes:e.payment_method_types,setupFutureUsage:e.setup_future_usage,amount:e.amount,currency:e.currency})}static isStripeHandledFormError(A){const e=A.type==="validation_error",i=A.type==="card_error"&&A.code&&this.FORM_VALIDATED_CARD_ERROR_CODES.includes(A.code);return e||i}static createPaymentElement(A,e){return A.create("payment",{business:e?{name:e}: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(A,e,i){const g={billingAddressRequired:e,emailRequired:!0,...i||{}};return A.create("expressCheckout",g)}static createLinkAuthenticationElement(A,e){return A.create("linkAuthentication",{defaultValues:{email:e??""}})}static async submitElements(A){const{error:e}=await A.submit();if(e)throw this.mapError(e)}static mapInitializationError(A){return new lR(0,A.code,A.message)}static mapError(A){return this.isStripeHandledFormError(A)?new lR(1,A.code,A.message):new lR(2,A.code,A.message)}static async confirmElements(A,e,i,g){const I={clientSecret:i,redirect:"if_required"},n=g?{...I,confirmParams:{confirmation_token:g}}:{...I,elements:e},o=i.startsWith("seti_");let a;if(o?a=await A.confirmSetup(n):a=await A.confirmPayment(n),a!=null&&a.error)throw this.mapError(a.error)}static async extractTaxCustomerDetails(A,e){var i,g;const{error:I,confirmationToken:n}=await e.createConfirmationToken({elements:A});if(I)throw this.mapError(I);const o=(g=(i=n.payment_method_preview)==null?void 0:i.billing_details)==null?void 0:g.address;return{customerDetails:{countryCode:o?.country??void 0,postalCode:o?.postal_code??void 0},confirmationTokenId:n.id}}static nextDateForPeriod(A,e){return A.unit===To.Year?(e.setFullYear(e.getFullYear()+A.number),e):A.unit===To.Month?(e.setMonth(e.getMonth()+A.number),e):A.unit===To.Week?(e.setDate(e.getDate()+A.number*7),e):(A.unit===To.Day&&e.setDate(e.getDate()+A.number),e)}static applePayPeriod(A){return A.unit===To.Week?{recurringPaymentIntervalUnit:"day",recurringPaymentIntervalCount:A.number*7}:{recurringPaymentIntervalUnit:A.unit,recurringPaymentIntervalCount:A.number}}static microsToMinimumAmountPrice(A,e){return["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"].includes(e)?Math.floor(A/1e6):Math.floor(A/1e4)}static buildStripeExpressCheckoutOptionsForSubscription(A,e,i,g,I){var n;const o=QR.microsToMinimumAmountPrice(e.totalAmountInMicros,e.currency),a=i.trial,r=(n=i.trial)==null?void 0:n.period,s=i.base.period,B=a&&r?QR.nextDateForPeriod(r,new Date):void 0,c=s?QR.applePayPeriod(s):{};return{applePay:{recurringPaymentRequest:{paymentDescription:A.title,managementURL:I,trialBilling:a?{label:g.translate(vt.ApplePayFreeTrial),amount:0}:void 0,regularBilling:{label:A.title,amount:o,recurringPaymentStartDate:B,...c}}}}}};ft(c$,"FORM_VALIDATED_CARD_ERROR_CODES",["card_declined","expired_card","incorrect_cvc","incorrect_number"]);let ua=c$;var _pA=ot("<div></div>");function JpA(t,A){ni(A,!0);let e=null;const i="payment-element",g=async n=>{await A.onError(ua.mapInitializationError(n.error))};cC(()=>{var n;try{e=ua.createPaymentElement(A.elements,(n=A.brandingInfo)==null?void 0:n.app_name),e.mount(`#${i}`),e.on("ready",A.onReady),e.on("change",A.onChange),e.on("loaderror",g)}catch(o){A.onError(ua.mapInitializationError(o))}}),Mk(()=>{e?.destroy(),e=null});var I=_pA();qt(I,"id",i),ue(t,I),oi()}var LpA=ot("<div></div>");function qpA(t,A){ni(A,!0);let e=null;const i="link-authentication-element",g=async n=>{await A.onError(ua.mapInitializationError(n.error))};cC(()=>{try{e=ua.createLinkAuthenticationElement(A.elements,A.email),e.mount(`#${i}`),e.on("ready",A.onReady),e.on("change",A.onChange),e.on("loaderror",g)}catch(n){A.onError(ua.mapInitializationError(n))}}),Mk(()=>{e?.destroy(),e=null});var I=LpA();qt(I,"id",i),ue(t,I),oi()}var xpA=ot('<div class="text-separator svelte-ch0h61"><hr class="line svelte-ch0h61"> <span class="text svelte-ch0h61"><!></span> <hr class="line svelte-ch0h61"></div>');const TpA={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 YpA(t,A){Vt(t,TpA);let e=Jt(A,"text",8);var i=xpA(),g=St(_e(i),2),I=_e(g);lg(I,{size:"caption-default",children:(n,o)=>{var a=Lg();dt(()=>Oi(a,e())),ue(n,a)},$$slots:{default:!0}}),ue(t,i)}var HpA=ot("<div></div> <!>",1);function OpA(t,A){ni(A,!0);const e=Lr(),i=()=>Jr(g,"$translator",e),g=fa(us);let I=null,n=Ki(!1);const o="express-checkout-element",a=async y=>{const S={...A.expressCheckoutOptions?A.expressCheckoutOptions:{}};y.resolve(S)},r=async y=>{await A.onError(ua.mapInitializationError(y.error))},s=async y=>{var S;A.onSubmit(y.expressPaymentType,((S=y.billingDetails)==null?void 0:S.email)??"")},B=async y=>{Et(n,!y.availablePaymentMethods),A.onReady()};cC(()=>{try{I=ua.createExpressCheckoutElement(A.elements,A.billingAddressRequired,A.expressCheckoutOptions),I.mount(`#${o}`),I.on("ready",B),I.on("confirm",s),I.on("loaderror",r),I.on("click",a)}catch(y){A.onError(ua.mapInitializationError(y))}}),Mk(()=>{I?.destroy(),I=null});var c=Ig(),E=Bi(c);{var D=y=>{var S=HpA(),f=Bi(S);qt(f,"id",o);var M=St(f,2),k=je(()=>i().translate(vt.PaymentEntryPageExpressCheckoutDivider));YpA(M,{get text(){return cA(k)}}),ue(y,S)};Kt(E,y=>{cA(n)||y(D)})}ue(t,c),oi()}var PpA=ot('<div class="rc-elements svelte-6qa1vy"><!> <!> <!></div>');const jpA={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 ZpA(t,A){ni(A,!0),Vt(t,jpA);const e=Lr(),i=()=>Jr(n,"$translator",e);let g=Jt(A,"stripe",15,null),I=Jt(A,"elements",15,null);const n=fa(us),o=ua.getStripeLocale(i().locale||i().fallbackLocale);let a=Ki(!1),r=Ki(Xt(A.skipEmail)),s=Ki(!1),B=Ki(void 0),c=Ki("mobile"),E=Ki(void 0);function D(){window.matchMedia&&window.matchMedia("(max-width: 767px)").matches?Et(c,"mobile"):Et(c,"desktop"),Et(B,Xt({fontSizeBase:"14px",fontFamily:SU,spacingGridRow:"16px"}))}function y(){clearTimeout(cA(E)),Et(E,Xt(setTimeout(()=>{D()},150)))}const S=R=>{A.onError(R),A.onLoadingComplete()},f=async()=>{cA(r)||(Et(r,!0),cA(r)&&cA(a)&&cA(s)&&A.onLoadingComplete())},M=async()=>{cA(s)||(Et(s,!0),cA(r)&&cA(a)&&cA(s)&&A.onLoadingComplete())},k=async()=>{cA(a)||(Et(a,!0),cA(r)&&cA(a)&&cA(s)&&A.onLoadingComplete())},m=async R=>{A.onPaymentInfoChange({complete:R.complete,paymentMethod:R.complete?R.value.type:void 0})},U=async R=>{A.onEmailChange(R.complete,R.value.email)};cC(()=>(window.addEventListener("resize",y),()=>{window.removeEventListener("resize",y)})),cC(async()=>{D(),!g()&&(I()||!A.stripeAccountId||!A.publishableApiKey||!A.elementsConfiguration||await ua.initializeStripe(A.stripeAccountId,A.publishableApiKey,A.elementsConfiguration,A.brandingInfo,o,cA(B),cA(c)).then(({stripe:R,elements:G})=>{g(R),I(G)}).catch(R=>{A.onError(R)}))}),zD(()=>{A.elementsConfiguration&&I()&&ua.updateElementsConfiguration(I(),A.elementsConfiguration)});var F=Ig(),b=Bi(F);{var K=R=>{var G=PpA(),J=_e(G);OpA(J,{get elements(){return I()},onError:S,onReady:M,get onSubmit(){return A.onExpressCheckoutElementSubmit},get expressCheckoutOptions(){return A.expressCheckoutOptions},get billingAddressRequired(){return A.billingAddressRequired}});var x=St(J,2);{var H=j=>{qpA(j,{get elements(){return I()},onReady:f,onChange:U,onError:S})};Kt(x,j=>{A.skipEmail||j(H)})}var P=St(x,2);JpA(P,{get elements(){return I()},get brandingInfo(){return A.brandingInfo},onReady:k,onChange:m,onError:S}),ue(R,G)};Kt(b,R=>{I()&&R(K)})}ue(t,F),oi()}const WpA=`<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 zpA=ot('<div class="rcb-ui-asset-icon svelte-1rk57mx"><!></div>');const VpA={hash:"svelte-1rk57mx",code:".rcb-ui-asset-icon.svelte-1rk57mx {display:inline-block;width:1em;height:1em;}"};function l$(t){Vt(t,VpA);var A=zpA(),e=_e(A);hu(e,()=>WpA),ue(t,A)}var XpA=ot('<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 $pA={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 AfA(t,A){Vt(t,$pA);var e=XpA(),i=_e(e),g=_e(i);l$(g);var I=St(i,2),n=_e(I),o=_e(n);lg(o,{size:"body-small",children:(s,B)=>{var c=Lg();dt(()=>Oi(c,A.title)),ue(s,c)},$$slots:{default:!0}});var a=St(n,2),r=_e(a);lg(r,{size:"body-small",children:(s,B)=>{var c=Lg();dt(()=>Oi(c,A.message)),ue(s,c)},$$slots:{default:!0}}),ue(t,e)}function efA(t,A){ni(A,!0);const e=Lr(),i=()=>Jr(g,"$translator",e),g=fa(us);var I=je(()=>i().translate(vt.PriceUpdateTitle)),n=je(()=>{var o;return i().translate((o=A.subscriptionOption)!=null&&o.trial?vt.PriceUpdateTrialMessage:vt.PriceUpdateBaseMessage)});AfA(t,{get title(){return cA(I)},get message(){return cA(n)}}),oi()}function Q$(t,A){if(t.productType==="subscription"){const e=A,i=e.introPrice?e.introPrice.price:e.base.price;if(i)return i}else return A.basePrice;return t.price}class sj extends Error{}var tfA=ot('<div class="rc-loading svelte-dg9m6p"><!></div>'),ifA=ot('<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 gfA={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 IfA(t,A){var e,i,g;ni(A,!0),Vt(t,gfA);const I=Lr(),n=()=>Jr(a,"$translator",I),o=fa(W2),a=fa(us),r=(e=A.productDetails.subscriptionOptions)==null?void 0:e[A.purchaseOption.id],s=Q$(A.productDetails,A.purchaseOption);let B=Ki(Xt(((i=A.defaultPriceBreakdown)==null?void 0:i.taxCalculationStatus)??((g=A.brandingInfo)!=null&&g.gateway_tax_collection_enabled?"unavailable":"disabled"))),c=Ki(null),E=Ki(null),D=Ki(Xt(s.amountMicros)),y=Ki(Xt(s.amountMicros)),S=je(()=>A.defaultPriceBreakdown??{currency:s.currency,totalAmountInMicros:cA(y),totalExcludingTaxInMicros:cA(D),taxCalculationStatus:cA(B),taxAmountInMicros:cA(c),taxBreakdown:cA(E)}),f=Ki(Xt(A.gatewayParams.elements_configuration)),M=Ki(null),k=Ki(null),m=Ki(null),U=Ki(Xt(A.customerEmail??void 0)),F=Ki(Xt(!!A.customerEmail)),b=Ki(!0),K=Ki(!1),R=Ki(void 0),G=Ki(void 0),J=Ki(void 0),x=Ki(!1),H=Ki(null),P=je(()=>cA(b)||cA(x)?"loading":cA(G)?"error":"form"),j=Ki("unavailable"),q=je(()=>!cA(x)&&cA(K)&&cA(F)&&(cA(B)==="disabled"||cA(B)==="calculated"||cA(B)==="miss-match")),Y=je(()=>r&&A.managementUrl&&cA(S)?ua.buildStripeExpressCheckoutOptionsForSubscription(A.productDetails,cA(S),r,n(),A.managementUrl):void 0);zD(()=>{A.onPriceBreakdownUpdated(cA(S))}),cC(async()=>{cA(B)==="unavailable"&&await O(null).catch(oA)}),Mk(()=>{cA(H)&&(cA(H).abort(),Et(H,null))});async function O(_A,zA){await A.purchaseOperationHelper.checkoutCalculateTax(_A?.countryCode,_A?.postalCode,zA).then(ge=>{const he=XdA({taxCalculation:ge,taxCustomerDetails:_A});o.trackSDKEvent(he),zA?.throwIfAborted(),ge.failed_reason?!_A&&ge.failed_reason===X2.invalid_tax_location?Et(B,"pending"):Et(B,"disabled"):Et(B,"calculated"),Et(c,Xt(ge.tax_amount_in_micros)),Et(D,Xt(ge.total_excluding_tax_in_micros)),Et(y,Xt(ge.total_amount_in_micros)),Et(E,Xt(ge.tax_breakdown)),Et(f,Xt(ge.gateway_params.elements_configuration)),Et(M,Xt(_A))})}function $(){o.trackSDKEvent({eventName:vr.CheckoutPaymentFormImpression}),Et(b,!1)}async function gA(_A,zA){Et(U,Xt(zA)),Et(F,Xt(_A)),await rA()}async function z({complete:_A,paymentMethod:zA}){Et(R,Xt(zA)),Et(K,Xt(_A)),await rA()}async function X(_A){if(_A?.preventDefault(),cA(x))return;const zA=$dA({selectedPaymentMethod:cA(R)??null});o.trackSDKEvent(zA),Et(x,!0),await mA()?A.onContinue():Et(x,!1)}async function sA(_A,zA){Et(R,Xt(_A)),Et(U,Xt(A.customerEmail??zA)),await X()}async function rA(){cA(R)!=="card"||!cA(F)||!cA(K)||cA(x)||cA(B)==="disabled"||(cA(B)!=="loading"&&(Et(j,Xt(cA(B))),Et(B,"loading")),await IA(async _A=>{await uA().then(()=>_A.throwIfAborted()).then(()=>KA(_A)).then(()=>_A.throwIfAborted()).catch(zA=>{_A.aborted||oA(zA)}).finally(()=>{cA(B)==="loading"&&!_A.aborted&&Et(B,Xt(cA(j)))})}))}async function mA(){return await IA(async _A=>{const zA=cA(y);let ge;return await uA().then(()=>_A.throwIfAborted()).then(()=>KA(_A)).then(he=>{ge=he}).then(()=>_A.throwIfAborted()).then(FA(zA)).then(()=>_A.throwIfAborted()).then(RA).then(()=>_A.throwIfAborted()).then(()=>MA(ge)).then(()=>_A.throwIfAborted()).then(()=>!0).catch(he=>(_A.aborted||oA(he),!1))})}async function IA(_A){cA(H)&&cA(H).abort(),Et(H,Xt(new AbortController));const zA=cA(H).signal;try{return await _A(zA)}catch(ge){if(ge instanceof DOMException&&ge.name==="AbortError")return Promise.resolve(void 0);throw ge}}async function uA(){cA(m)&&await ua.submitElements(cA(m))}async function KA(_A){var zA,ge;if(cA(B)==="unavailable"||cA(B)==="disabled"||!cA(m)||!cA(k))return;const{customerDetails:he,confirmationTokenId:ve}=await ua.extractTaxCustomerDetails(cA(m),cA(k));return _A?.throwIfAborted(),he.postalCode===((zA=cA(M))==null?void 0:zA.postalCode)&&he.countryCode===((ge=cA(M))==null?void 0:ge.countryCode)||await O(he,_A),ve&&cA(R)!=="card"?ve:void 0}function FA(_A){return()=>{if(cA(y)!==_A)throw new sj}}async function RA(){var _A;const zA=await A.purchaseOperationHelper.checkoutComplete(cA(U)),ge=(_A=zA?.gateway_params)==null?void 0:_A.client_secret;ge&&Et(J,Xt(ge))}async function MA(_A){!cA(k)||!cA(m)||!cA(J)||await ua.confirmElements(cA(k),cA(m),cA(J),_A)}async function oA(_A){if(_A instanceof sj)Et(B,"miss-match");else if(_A instanceof rI){const zA=jdA({errorCode:_A.errorCode.toString(),errorMessage:_A.message});o.trackSDKEvent(zA),_A.errorCode===Og.MissingEmailError?Et(G,Xt(n().translate(vt.ErrorPageErrorMessageInvalidEmailError,{email:cA(U)}))):A.onError(_A)}else if(_A instanceof lR)await AA(_A);else throw _A}async function AA(_A){const zA=ApA({errorCode:_A.gatewayErrorCode??"",errorMessage:_A.message??""});o.trackSDKEvent(zA),_A.code===Xx.HandledFormError||(_A.code===Xx.UnhandledFormError?Et(G,Xt(_A.message)):A.onError(new rI(Og.ErrorSettingUpPurchase,"Failed to initialize payment form",_A.message)))}const tA=()=>{Et(G,void 0)};var iA=ifA(),hA=_e(iA);{var DA=_A=>{var zA=tfA(),ge=_e(zA);t$(ge),ue(_A,zA)};Kt(hA,_A=>{cA(P)==="loading"&&_A(DA)})}var dA=St(hA,2);{var SA=_A=>{var zA=je(()=>n().translate(vt.ErrorButtonTryAgain));V2(_A,{title:null,type:"error",get closeButtonTitle(){return cA(zA)},onDismiss:tA,icon:ge=>{q7(ge)},message:ge=>{var he=Lg();dt(()=>Oi(he,cA(G))),ue(ge,he)},$$slots:{icon:!0,message:!0}})};Kt(dA,_A=>{cA(P)==="error"&&_A(SA)})}var NA=St(dA,2),OA=_e(NA),Qe=_e(OA),nA=_e(Qe),eA=je(()=>!!A.customerEmail),UA=je(()=>cA(B)!=="disabled");ZpA(nA,{get stripeAccountId(){return A.gatewayParams.stripe_account_id},get publishableApiKey(){return A.gatewayParams.publishable_api_key},get elementsConfiguration(){return cA(f)},get brandingInfo(){return A.brandingInfo},get skipEmail(){return cA(eA)},get billingAddressRequired(){return cA(UA)},onLoadingComplete:$,onError:AA,onEmailChange:gA,onPaymentInfoChange:z,onExpressCheckoutElementSubmit:sA,get expressCheckoutOptions(){return cA(Y)},get stripe(){return cA(k)},set stripe(_A){Et(k,Xt(_A))},get elements(){return cA(m)},set elements(_A){Et(m,Xt(_A))}});var HA=St(Qe,2),Se=_e(HA);efA(Se,{subscriptionOption:r});var ne=St(HA,2),Oe=_e(ne),VA=je(()=>!cA(q)),de=je(()=>{var _A;return(_A=A.brandingInfo)!=null&&_A.gateway_tax_collection_enabled?cA(S):void 0});opA(Oe,{get disabled(){return cA(VA)},subscriptionOption:r,get priceBreakdown(){return cA(de)}});var te=St(Oe,2),WA=_e(te);OdA(WA,{get brandingInfo(){return A.brandingInfo},get purchaseOption(){return A.purchaseOption}}),dt(()=>{IQ(OA,"invisible",cA(P)!=="form"),IQ(HA,"fully-hidden",cA(B)!=="miss-match"||cA(P)!=="form"),IQ(ne,"fully-hidden",cA(P)!=="form")}),Uc("submit",NA,X),ue(t,iA),oi()}function nfA(t){return t!=null}var sd=(t=>(t.Subscription="subscription",t.Consumable="consumable",t.NonConsumable="non_consumable",t))(sd||{});const E$=t=>({amount:t.amount_micros/1e4,amountMicros:t.amount_micros,currency:t.currency,formattedPrice:xE(t.amount_micros,t.currency)}),M_=t=>{const A=t.period_duration,e=t.price?E$(t.price):null,i=A?J7(A):null;let g=null,I=null,n=null;if(e!==null&&i!==null){const o=ofA(i),a=1e4,r=Math.round(e.amountMicros*o.toWeek);g={amount:r/a,amountMicros:r,currency:e.currency,formattedPrice:xE(r,e.currency)};const s=Math.round(e.amountMicros*o.toMonth);I={amount:s/a,amountMicros:s,currency:e.currency,formattedPrice:xE(s,e.currency)};const B=Math.round(e.amountMicros*o.toYear);n={amount:B/a,amountMicros:B,currency:e.currency,formattedPrice:xE(B,e.currency)}}return{periodDuration:A,period:i,cycleCount:t.cycle_count,price:e,pricePerWeek:g,pricePerMonth:I,pricePerYear:n}};function ofA(t){const{number:A,unit:e}=t,i=7,g=30,I=365;let n;switch(e){case To.Day:n=A;break;case To.Week:n=A*i;break;case To.Month:n=A*g;break;case To.Year:n=A*I;break;default:n=0,Mi.errorLog(`Unknown period unit: ${e}`)}const o=n>0?i/n:0,a=n>0?g/n:0,r=n>0?I/n:0;return{toWeek:o,toMonth:a,toYear:r}}const afA=t=>t.base==null?(Mi.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,base:M_(t.base),trial:t.trial?M_(t.trial):null,introPrice:t.intro_price?M_(t.intro_price):null},rfA=t=>t.base_price==null?(Mi.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:t.id,priceId:t.price_id,basePrice:E$(t.base_price)},sfA=(t,A)=>{const e=t.product_type;return e==="subscription"?BfA(t,A,e):CfA(t,A,e)},CfA=(t,A,e)=>{const i={};if(Object.entries(t.purchase_options).forEach(([n,o])=>{const a=rfA(o);a!=null&&(i[n]=a)}),Object.keys(i).length===0)return Mi.debugLog(`Product ${t.identifier} has no purchase options. Ignoring.`),null;const g=t.default_purchase_option_id,I=g&&g in t.purchase_options?i[g]:null;return I==null?(Mi.debugLog(`Product ${t.identifier} has no default purchase option. Ignoring.`),null):{identifier:t.identifier,displayName:t.title,title:t.title,description:t.description,productType:e,currentPrice:I.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:A.offeringIdentifier,presentedOfferingContext:A,defaultPurchaseOption:I,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:I,price:I.basePrice,period:null,freeTrialPhase:null,introPricePhase:null}},BfA=(t,A,e)=>{const i={};if(Object.entries(t.purchase_options).forEach(([o,a])=>{const r=afA(a);r!=null&&(i[o]=r)}),Object.keys(i).length===0)return Mi.debugLog(`Product ${t.identifier} has no subscription options. Ignoring.`),null;const g=t.default_purchase_option_id,I=g&&g in i?i[g]:null;if(I==null)return Mi.debugLog(`Product ${t.identifier} has no default subscription option. Ignoring.`),null;const n=I.base.price;return n==null?(Mi.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:e,currentPrice:n,normalPeriodDuration:I.base.periodDuration,presentedOfferingIdentifier:A.offeringIdentifier,presentedOfferingContext:A,defaultPurchaseOption:I,defaultSubscriptionOption:I,subscriptionOptions:i,defaultNonSubscriptionOption:null,price:n,period:I.base.period,freeTrialPhase:I.trial,introPricePhase:I.introPrice}},cfA=(t,A,e)=>{const i=e[A.platform_product_identifier];if(i===void 0)return null;const g=sfA(i,t);return g===null?null:{identifier:A.identifier,rcBillingProduct:g,webBillingProduct:g,packageType:QfA(A.identifier)}},lfA=(t,A,e,i)=>{const g={offeringIdentifier:A.identifier,targetingContext:t&&i?{ruleId:i.rule_id,revision:i.revision}:null,placementIdentifier:null},I=A.packages.map(o=>cfA(g,o,e)).filter(nfA),n={};for(const o of I)o!=null&&(n[o.identifier]=o);return I.length==0?null:{identifier:A.identifier,serverDescription:A.description,metadata:A.metadata,packagesById:n,availablePackages:I,lifetime:n.$rc_lifetime??null,annual:n.$rc_annual??null,sixMonth:n.$rc_six_month??null,threeMonth:n.$rc_three_month??null,twoMonth:n.$rc_two_month??null,monthly:n.$rc_monthly??null,weekly:n.$rc_weekly??null,paywall_components:A.paywall_components?A.paywall_components:null}};function QfA(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 EfA=Wc('<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 ufA={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 SN(t,A){Vt(t,ufA);let e=Jt(A,"direction",8);var i=EfA();dt(()=>kEA(i,`arrow ${e()??""} svelte-1qexsu3`)),ue(t,i)}var hfA=Wc('<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 dfA={hash:"svelte-r0zny8",code:".arrow-fill.svelte-r0zny8 {fill:var(--rc-color-grey-text-dark);}"};function pfA(t){Vt(t,dfA);var A=hfA();ue(t,A)}const ffA=`<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 DfA=ot('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function yfA(t){var A=DfA(),e=_e(A);hu(e,()=>ffA),ue(t,A)}const SfA=`<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 wfA=ot('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-wgufvv"><!></div>');const mfA={hash:"svelte-wgufvv",code:"div.svelte-wgufvv {height:24px;width:24px;}"};function kfA(t){Vt(t,mfA);var A=wfA(),e=_e(A);hu(e,()=>SfA),ue(t,A)}const MfA=`<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 NfA=ot('<div style="color:var(--rc-color-primary)"><!></div>');function u$(t){var A=NfA(),e=_e(A);hu(e,()=>MfA),ue(t,A)}var GfA=Wc('<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 RfA={hash:"svelte-1jpfelf",code:".arrow-fill.svelte-1jpfelf {fill:var(--arrow-fill-color, var(--rc-color-grey-text-dark));}"};function UfA(t){Vt(t,RfA);var A=GfA();ue(t,A)}const KfA={cart:yfA,error:q7,lock:kfA,success:u$,back:pfA,info:l$,close:UfA,"chevron-left":SN,"chevron-right":SN,"chevron-up":SN,"chevron-down":SN};function p0(t,A){ni(A,!0);const e=KfA[A.name];let i=Ki(Xt({}));if(A.name.startsWith("chevron")){const g=A.name.split("-")[1];Et(i,Xt({direction:g}))}e(t,lQ(()=>cA(i))),oi()}var FfA=ot('<span class="rc-sandbox-only-error svelte-1d8gf9n"><!></span> <br> <br>',1),bfA=ot('<!> <a class="svelte-1d8gf9n"> </a>.',1),vfA=ot("<!> <!>",1);const _fA={hash:"svelte-1d8gf9n",code:"a.svelte-1d8gf9n {color:var(--rc-color-grey-text-dark);}.rc-sandbox-only-error.svelte-1d8gf9n {font-weight:bold;}"};function JfA(t,A){ni(A,!0),Vt(t,_fA);const e=Lr(),i=()=>Jr(I,"$translator",e),g=je(()=>A.lastError??new rI(Og.UnknownError,"Unknown error without state set.")),I=fa(us),n=je(()=>cA(g).errorCode===Og.StripeTaxNotActive||cA(g).errorCode===Og.StripeInvalidTaxOriginAddress||cA(g).errorCode===Og.StripeMissingRequiredPermission);cC(()=>{Mi.errorLog(`Displayed error: ${Og[cA(g).errorCode]}. Message: ${cA(g).message??"None"}. Underlying error: ${cA(g).underlyingErrorMessage??"None"}`)});function o(){return cA(g).errorCode===Og.AlreadyPurchasedError?i().translate(vt.ErrorPageCloseButtonTitle,{appName:A.appName??"App"}):cA(n)?i().translate(vt.ErrorButtonClose):i().translate(vt.ErrorButtonTryAgain)}function a(){switch(cA(g).errorCode){case Og.AlreadyPurchasedError:return A.productDetails.productType===sd.Subscription?i().translate(vt.ErrorPageErrorTitleAlreadySubscribed,{productTitle:A.productDetails.title}):i().translate(vt.ErrorPageErrorTitleAlreadyPurchased,{productTitle:A.productDetails.title});case Og.StripeTaxNotActive:return i().translate(vt.ErrorPageErrorTitleStripeTaxNotActive);case Og.StripeInvalidTaxOriginAddress:return i().translate(vt.ErrorPageErrorTitleStripeInvalidTaxOriginAddress);case Og.StripeMissingRequiredPermission:return i().translate(vt.ErrorPageErrorTitleStripeMissingRequiredPermission);default:return i().translate(vt.ErrorPageErrorTitleOtherErrors)}}function r(){const D=cA(g).getErrorCode();switch(cA(g).errorCode){case Og.ErrorSettingUpPurchase:return i().translate(vt.ErrorPageErrorMessageErrorSettingUpPurchase,{errorCode:D});case Og.ErrorChargingPayment:return i().translate(vt.ErrorPageErrorMessageErrorChargingPayment,{errorCode:D});case Og.AlreadyPurchasedError:return A.productDetails.productType===sd.Subscription?i().translate(vt.ErrorPageErrorMessageAlreadySubscribed,{errorCode:D}):i().translate(vt.ErrorPageErrorMessageAlreadyPurchased,{errorCode:D});case Og.StripeTaxNotActive:return i().translate(vt.ErrorPageErrorMessageStripeTaxNotActive,{errorCode:D});case Og.StripeInvalidTaxOriginAddress:return i().translate(vt.ErrorPageErrorMessageStripeInvalidTaxOriginAddress,{errorCode:D});case Og.StripeMissingRequiredPermission:return i().translate(vt.ErrorPageErrorMessageStripeMissingRequiredPermission,{errorCode:D});case Og.NetworkError:return i().translate(vt.ErrorPageErrorMessageNetworkError,{errorCode:D});default:return i().translate(vt.ErrorPageErrorMessageUnknownError,{errorCode:D})}}function s(){return cA(g).errorCode===Og.AlreadyPurchasedError?vt.ErrorPageTroubleAccessing:vt.ErrorPageIfErrorPersists}function B(){return cA(g).errorCode===Og.AlreadyPurchasedError?"success":"error"}var c=je(a),E=je(o);V2(t,{get title(){return cA(c)},get onDismiss(){return A.onDismiss},type:"error",get closeButtonTitle(){return cA(E)},icon:D=>{var y=je(B);p0(D,{get name(){return cA(y)}})},message:D=>{var y=vfA(),S=Bi(y);{var f=U=>{var F=FfA(),b=Bi(F),K=_e(b);kr(K,{get key(){return vt.ErrorPageErrorMessageOnlyInSandbox}}),ue(U,F)};Kt(S,U=>{cA(n)&&U(f)})}var M=St(S);dt(()=>Oi(M,` ${r()??""} `));var k=St(M);{var m=U=>{var F=bfA(),b=Bi(F),K=je(s);kr(b,{get key(){return cA(K)}});var R=St(b,2),G=_e(R);dt(()=>{qt(R,"href",`mailto:${A.supportEmail??""}`),Oi(G,A.supportEmail)}),ue(U,F)};Kt(k,U=>{!cA(n)&&A.supportEmail&&U(m)})}ue(D,y)},$$slots:{icon:!0,message:!0}}),oi()}function LfA(t,A){ni(A,!1);const e=Lr(),i=()=>Jr(I,"$translator",e);let g=Jt(A,"onContinue",8);const I=fa(us),n=fa(W2);function o(){n.trackSDKEvent({eventName:vr.CheckoutPurchaseSuccessfulDismiss,properties:{ui_element:"go_back_to_app"}}),g()()}cC(()=>{n.trackSDKEvent({eventName:vr.CheckoutPurchaseSuccessfulImpression})}),hC();var a=yD(()=>i().translate(vt.SuccessPagePurchaseSuccessful)),r=yD(()=>i().translate(vt.SuccessPageButtonClose));V2(t,{type:"success",get title(){return cA(a)},onDismiss:o,get closeButtonTitle(){return cA(r)},icon:s=>{u$(s)},$$slots:{icon:!0}}),oi()}function qfA(t){t$(t)}var xfA=ot('<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 TfA={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 YfA(t,A){ni(A,!1),Vt(t,TfA);const e=Lr(),i=()=>Jr(n,"$translator",e);let g=Jt(A,"isExpanded",12,!0),I=Jt(A,"children",8);const n=fa(us);function o(){g(!g())}hC();var a=xfA(),r=_e(a),s=_e(r);lg(s,{size:"label-default",children:(M,k)=>{var m=Ig(),U=Bi(m);{var F=K=>{var R=Lg();dt(()=>Oi(R,i().translate(vt.PricingDropdownHideDetails))),ue(K,R)},b=K=>{var R=Lg();dt(()=>Oi(R,i().translate(vt.PricingDropdownShowDetails))),ue(K,R)};Kt(U,K=>{g()?K(F):K(b,!1)})}ue(M,m)},$$slots:{default:!0}});var B=St(s,2),c=_e(B);{var E=M=>{p0(M,{name:"chevron-up"})},D=M=>{p0(M,{name:"chevron-down"})};Kt(c,M=>{g()?M(E):M(D,!1)})}var y=St(r,2),S=_e(y),f=_e(S);Bn(f,()=>I()??qg),dt(()=>{qt(r,"aria-expanded",g()),IQ(y,"collapsed",!g())}),Uc("click",r,o),Uc("keydown",r,M=>M.key==="Enter"||M.key===" "?o():null),ue(t,a),oi()}var HfA=ot('<div class="rcb-pricing-table-value-loading svelte-erv89n"><!></div>');const OfA={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 PfA(t,A){ni(A,!1),Vt(t,OfA);let e=Jt(A,"children",8);hC();var i=HfA(),g=_e(i);Bn(g,()=>e()??qg),ue(t,i),oi()}var jfA=ot('<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>'),ZfA=ot('<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>'),WfA=ot('<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>'),zfA=ot('<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),VfA=ot('<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>'),XfA=ot('<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 $fA={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 ADA(t,A){var e;ni(A,!0),Vt(t,$fA);const i=Lr(),g=()=>Jr(o,"$translator",i),I=E=>{var D=XfA(),y=_e(D);{var S=K=>{var R=zfA(),G=Bi(R),J=_e(G),x=_e(J);lg(x,{size:"body-small",children:(O,$)=>{var gA=Lg();dt(()=>Oi(gA,g().translate(vt.PricingTotalExcludingTax))),ue(O,gA)},$$slots:{default:!0}});var H=St(J,2),P=_e(H);lg(P,{size:"body-small",children:(O,$)=>{var gA=Lg();dt(()=>Oi(gA,g().formatPrice(A.priceBreakdown.totalExcludingTaxInMicros,A.priceBreakdown.currency))),ue(O,gA)},$$slots:{default:!0}});var j=St(G,2);{var q=O=>{var $=jfA(),gA=_e($),z=_e(gA);lg(z,{size:"body-small",children:(rA,mA)=>{var IA=Lg();dt(()=>Oi(IA,g().translate(vt.PricingTableTax))),ue(rA,IA)},$$slots:{default:!0}});var X=St(gA,2),sA=_e(X);lg(sA,{size:"body-small",children:(rA,mA)=>{PfA(rA,{children:(IA,uA)=>{var KA=Lg();dt(()=>Oi(KA,g().formatPrice(1234e4,A.priceBreakdown.currency))),ue(IA,KA)},$$slots:{default:!0}})},$$slots:{default:!0}}),ue(O,$)},Y=O=>{var $=Ig(),gA=Bi($);{var z=sA=>{var rA=ZfA(),mA=_e(rA),IA=_e(mA);dt(()=>Oi(IA,g().translate(vt.PricingTableTax)));var uA=St(mA,2),KA=_e(uA);lg(KA,{size:"body-small",children:(FA,RA)=>{var MA=Lg();dt(()=>Oi(MA,g().translate(vt.PricingTableEnterBillingAddressToCalculate))),ue(FA,MA)},$$slots:{default:!0}}),ue(sA,rA)},X=sA=>{var rA=Ig(),mA=Bi(rA);{var IA=uA=>{var KA=Ig(),FA=Bi(KA);XD(FA,17,()=>A.priceBreakdown.taxBreakdown,VD,(RA,MA)=>{var oA=WfA(),AA=_e(oA),tA=_e(AA);lg(tA,{size:"body-small",children:(DA,dA)=>{var SA=Lg();dt(()=>Oi(SA,cA(MA).display_name)),ue(DA,SA)},$$slots:{default:!0}});var iA=St(AA,2),hA=_e(iA);lg(hA,{size:"body-small",children:(DA,dA)=>{var SA=Lg();dt(()=>Oi(SA,g().formatPrice(cA(MA).tax_amount_in_micros,A.priceBreakdown.currency))),ue(DA,SA)},$$slots:{default:!0}}),ue(RA,oA)}),ue(uA,KA)};Kt(mA,uA=>{A.priceBreakdown.taxBreakdown!==null&&uA(IA)},!0)}ue(sA,rA)};Kt(gA,sA=>{A.priceBreakdown.taxCalculationStatus==="pending"?sA(z):sA(X,!1)},!0)}ue(O,$)};Kt(j,O=>{A.priceBreakdown.taxCalculationStatus==="loading"?O(q):O(Y,!1)})}ue(K,R)};Kt(y,K=>{cA(a)&&K(S)})}var f=St(y,2);{var M=K=>{var R=VfA(),G=_e(R),J=_e(G);lg(J,{size:"body-small",children:(P,j)=>{var q=Lg();dt(()=>Oi(q,g().translate(vt.PricingTableTrialEnds,{formattedTrialEndDate:g().translateDate(cA(n),{dateStyle:"medium"})}))),ue(P,q)},$$slots:{default:!0}});var x=St(G,2),H=_e(x);lg(H,{size:"body-small",children:(P,j)=>{var q=Lg();dt(()=>Oi(q,g().formatPrice(A.priceBreakdown.totalAmountInMicros,A.priceBreakdown.currency))),ue(P,q)},$$slots:{default:!0}}),ue(K,R)};Kt(f,K=>{cA(n)&&K(M)})}var k=St(f,2),m=_e(k),U=_e(m);lg(U,{size:"body-small",children:(K,R)=>{var G=Lg();dt(()=>Oi(G,g().translate(vt.PricingTableTotalDueToday))),ue(K,G)},$$slots:{default:!0}});var F=St(m,2),b=_e(F);lg(b,{size:"body-small",children:(K,R)=>{var G=Ig(),J=Bi(G);{var x=P=>{var j=Lg();dt(()=>Oi(j,g().formatPrice(0,A.priceBreakdown.currency))),ue(P,j)},H=P=>{var j=Lg();dt(()=>Oi(j,g().formatPrice(A.priceBreakdown.totalAmountInMicros,A.priceBreakdown.currency))),ue(P,j)};Kt(J,P=>{cA(n)?P(x):P(H,!1)})}ue(K,G)},$$slots:{default:!0}}),ue(E,D)};let n=Ki(null);(e=A.trialPhase)!=null&&e.period&&Et(n,Xt(Ox(new Date,A.trialPhase.period,!0)));const o=fa(us),a=je(()=>A.priceBreakdown.taxCalculationStatus!=="unavailable"&&A.priceBreakdown.taxCalculationStatus!=="disabled"&&A.priceBreakdown.taxBreakdown&&A.priceBreakdown.taxBreakdown.length>0);var r=Ig(),s=Bi(r);{var B=E=>{YfA(E,{children:(D,y)=>{I(D)},$$slots:{default:!0}})},c=E=>{I(E)};Kt(s,E=>{cA(a)?E(B):E(c,!1)})}ue(t,r),oi()}var eDA=ot('<div class="rcb-subscribe-to svelte-4fnm8t"><!></div>'),tDA=ot('<span class="rcb-product-description svelte-4fnm8t"><!></span>'),iDA=ot('<div class="rcb-pricing-info-header svelte-4fnm8t"><!> <div class="rcb-product-title svelte-4fnm8t"><!></div> <!></div>');const gDA={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 IDA(t,A){ni(A,!1),Vt(t,gDA);let e=Jt(A,"productDetails",8),i=Jt(A,"showProductDescription",8);const g=e().productType===sd.Subscription;hC();var I=iDA(),n=_e(I);{var o=c=>{var E=eDA(),D=_e(E);lg(D,{size:"body-base",children:(y,S)=>{var f=yD(()=>({productTitle:e().title}));kr(y,{get key(){return vt.ProductInfoSubscribeTo},get variables(){return cA(f)}})},$$slots:{default:!0}}),ue(c,E)};Kt(n,c=>{g&&c(o)})}var a=St(n,2),r=_e(a);lg(r,{size:"heading-lg",branded:!0,children:(c,E)=>{var D=yD(()=>({productTitle:e().title}));kr(c,{get key(){return vt.ProductInfoProductTitle},get variables(){return cA(D)}})},$$slots:{default:!0}});var s=St(a,2);{var B=c=>{var E=tDA(),D=_e(E);lg(D,{size:"body-small",children:(y,S)=>{var f=yD(()=>({productDescription:e().description}));kr(y,{get key(){return vt.ProductInfoProductDescription},get variables(){return cA(f)}})},$$slots:{default:!0}}),ue(c,E)};Kt(s,c=>{i()&&e().description&&c(B)})}ue(t,I),oi()}var nDA=ot("<div><!></div>"),oDA=ot("<div><!> <!></div>"),aDA=ot('<div class="rcb-product-price-container svelte-509gz3"><!> <!> <div><!> <!> <!></div></div>');const rDA={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 sDA(t,A){ni(A,!0),Vt(t,rDA);const e=Lr(),i=()=>Jr(g,"$translator",e),g=fa(us),I=je(()=>{var G;return(G=A.introPricePhase)!=null&&G.period&&i().translatePeriod(A.introPricePhase.period.number*A.introPricePhase.cycleCount,A.introPricePhase.period.unit)||""}),n=je(()=>"heading-lg"),o=je(()=>{var G;return(G=A.trialPhase)!=null&&G.periodDuration?"heading-md":"heading-lg"}),a=je(()=>{var G,J;return(G=A.trialPhase)!=null&&G.periodDuration||(J=A.introPricePhase)!=null&&J.periodDuration?"heading-md":"heading-lg"}),r=je(()=>{var G;return(G=A.trialPhase)==null?void 0:G.periodDuration}),s=je(()=>{var G;return(G=A.introPricePhase)==null?void 0:G.periodDuration}),B=je(()=>{var G;return((G=A.introPricePhase)==null?void 0:G.cycleCount)==1}),c=je(()=>{var G,J;return i().formatPrice(cA(s)?((J=(G=A.basePhase)==null?void 0:G.price)==null?void 0:J.amountMicros)??0:A.priceBreakdown.totalAmountInMicros,A.priceBreakdown.currency)}),E=je(()=>i().formatPrice(A.priceBreakdown.totalAmountInMicros,A.priceBreakdown.currency));var D=aDA(),y=_e(D);{var S=G=>{var J=nDA(),x=_e(J);lg(x,{get size(){return cA(n)},children:(H,P)=>{var j=je(()=>({trialDuration:DuA(A.trialPhase.periodDuration,i())}));kr(H,{get key(){return vt.ProductInfoFreeTrialDuration},get variables(){return cA(j)}})},$$slots:{default:!0}}),ue(G,J)};Kt(y,G=>{var J;(J=A.trialPhase)!=null&&J.periodDuration&&G(S)})}var f=St(y,2);{var M=G=>{var J=oDA(),x=_e(J);lg(x,{get size(){return cA(o)},children:(q,Y)=>{var O=je(()=>cA(r)?vt.ProductInfoIntroPricePhaseAfterTrial:vt.ProductInfoIntroPricePhase),$=je(()=>({introPriceDuration:cA(I),introPrice:cA(E)}));kr(q,{get key(){return cA(O)},get variables(){return cA($)}})},$$slots:{default:!0}});var H=St(x,2);{var P=q=>{lg(q,{size:"body-small",children:(Y,O)=>{kr(Y,{get key(){return vt.ProductInfoIntroPricePhasePaidOnce}})},$$slots:{default:!0}})},j=q=>{var Y=Ig(),O=Bi(Y);{var $=gA=>{lg(gA,{size:"body-small",children:(z,X)=>{var sA=Lg();dt(()=>Oi(sA,i().translatePeriodFrequency(A.introPricePhase.period.number,A.introPricePhase.period.unit,{useMultipleWords:!0}))),ue(z,sA)},$$slots:{default:!0}})};Kt(O,gA=>{A.introPricePhase.period&&gA($)},!0)}ue(q,Y)};Kt(H,q=>{cA(B)?q(P):q(j,!1)})}ue(G,J)};Kt(f,G=>{var J;(J=A.introPricePhase)!=null&&J.periodDuration&&G(M)})}var k=St(f,2),m=_e(k);lg(m,{get size(){return cA(a)},children:(G,J)=>{var x=Lg();dt(()=>Oi(x,cA(c))),ue(G,x)},$$slots:{default:!0}});var U=St(m,2);{var F=G=>{lg(G,{size:"body-small",children:(J,x)=>{var H=Lg();dt(()=>Oi(H,i().translatePeriodFrequency(A.basePhase.period.number,A.basePhase.period.unit,{useMultipleWords:!0}))),ue(J,H)},$$slots:{default:!0}})};Kt(U,G=>{var J;(J=A.basePhase)!=null&&J.period&&G(F)})}var b=St(U,2);{var K=G=>{lg(G,{size:"body-small",children:(J,x)=>{kr(J,{get key(){return vt.ProductInfoAfter}})},$$slots:{default:!0}})},R=G=>{var J=Ig(),x=Bi(J);{var H=P=>{lg(P,{size:"body-small",children:(j,q)=>{kr(j,{get key(){return vt.ProductInfoAfterTrial}})},$$slots:{default:!0}})};Kt(x,P=>{cA(r)&&P(H)},!0)}ue(G,J)};Kt(b,G=>{cA(s)?G(K):G(R,!1)})}ue(t,D),oi()}var CDA=ot('<div class="rcb-pricing-info svelte-18guro7"><div class="rcb-pricing-info-header svelte-18guro7"><!> <!></div> <!></div>');const BDA={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 cDA(t,A){Vt(t,BDA);let e=Jt(A,"productDetails",8),i=Jt(A,"purchaseOption",8),g=Jt(A,"showProductDescription",8),I=Jt(A,"priceBreakdown",8);const n=i(),o=n?.base,a=n?.trial,r=n?.introPrice;var s=CDA(),B=_e(s),c=_e(B);IDA(c,{get productDetails(){return e()},get showProductDescription(){return g()}});var E=St(c,2);sDA(E,{get priceBreakdown(){return I()},basePhase:o,trialPhase:a,introPricePhase:r});var D=St(B,2);ADA(D,{get priceBreakdown(){return I()},trialPhase:a}),ue(t,s)}const nm=t=>`https://da08ctfrofx1b.cloudfront.net/${t}`;var lDA=ot('<div class="rcb-ui-container svelte-1h6xr8z"><!></div>');const QDA={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 EDA(t,A){ni(A,!0),Vt(t,QDA);const e=Jt(A,"brandingAppearance",3,void 0),i=Jt(A,"brandFontConfig",3,void 0),g=Jt(A,"isInElement",3,!1),I=je(()=>new d0(e()).getTextStyleVars(i())),n=je(()=>new d0(e()).spacingStyleVars),o=je(()=>[cA(I),cA(n)].join("; ")),a=je(()=>{var c;return(c=i())!=null&&c.font_url?nm(i().font_url):null}),r=async c=>{try{const E=new FontFace(I$,`url(${c})`);await E.load(),document.fonts.add(E)}catch{}};zD(()=>{cA(a)&&r(cA(a))});var s=lDA(),B=_e(s);Bn(B,()=>A.children??qg),dt(()=>{qt(s,"style",cA(o)),IQ(s,"fullscreen",!g()),IQ(s,"inside",g())}),ue(t,s),oi()}var uDA=ot('<div id="layout-query-container" class="svelte-1x4ow5d"><div class="rcb-ui-layout svelte-1x4ow5d"><!></div></div>');const hDA={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 dDA(t,A){ni(A,!1),Vt(t,hDA);let e=Jt(A,"style",8,""),i=Jt(A,"children",8);hC();var g=uDA(),I=_e(g),n=_e(I);Bn(n,()=>i()??qg),dt(()=>qt(I,"style",e())),ue(t,g),oi()}const pDA=t=>t;function fDA(t){const A=t-1;return A*A*A+1}function Cj(t){const A=typeof t=="string"&&t.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return A?[parseFloat(A[1]),A[2]||"px"]:[t,"px"]}function DDA(t,{delay:A=0,duration:e=400,easing:i=pDA}={}){const g=+getComputedStyle(t).opacity;return{delay:A,duration:e,easing:i,css:I=>`opacity: ${I*g}`}}function yDA(t,{delay:A=0,duration:e=400,easing:i=fDA,x:g=0,y:I=0,opacity:n=0}={}){const o=getComputedStyle(t),a=+o.opacity,r=o.transform==="none"?"":o.transform,s=a*(1-n),[B,c]=Cj(g),[E,D]=Cj(I);return{delay:A,duration:e,easing:i,css:(y,S)=>`
			transform: ${r} translate(${(1-y)*B}${c}, ${(1-y)*E}${D});
			opacity: ${a-s*S}`}}var SDA=ot('<div><div class="layout-wrapper svelte-1w6qvx7"><div><!></div></div></div>');const wDA={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 h$(t,A){ni(A,!0),Vt(t,wDA);const e=`rcb-${A.location}`;var i=SDA();$E(i,`layout-wrapper-outer ${e??""} svelte-1w6qvx7`);var g=_e(i),I=_e(g);$E(I,`layout-content ${e??""} svelte-1w6qvx7`);var n=_e(I);Bn(n,()=>A.children??qg),b7(3,I,()=>DDA,()=>({duration:500,delay:50})),ue(t,i),oi()}var mDA=ot('<div class="navbar-body svelte-jz90ay"><!></div>'),kDA=ot('<div class="navbar-header svelte-jz90ay"><!></div> <!>',1),MDA=ot('<div class="rcb-ui-navbar svelte-jz90ay"><!></div>');const NDA={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 GDA(t,A){ni(A,!0),Vt(t,NDA);const e=Jt(A,"brandingAppearance",3,void 0),i=je(()=>new d0(e()).productInfoStyleVars);var g=MDA(),I=_e(g);h$(I,{location:"navbar",children:(n,o)=>{var a=kDA(),r=Bi(a),s=_e(r);Bn(s,()=>A.headerContent??qg);var B=St(r,2);{var c=E=>{var D=mDA(),y=_e(D);Bn(y,()=>A.bodyContent??qg),ue(E,D)};Kt(B,E=>{A.bodyContent&&E(c)})}ue(n,a)},$$slots:{default:!0}}),dt(()=>qt(g,"style",cA(i))),ue(t,g),oi()}var RDA=ot('<button class="rcb-close-button svelte-nssttr" data-testid="close-button"><!></button>');const UDA={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 d$(t,A){Vt(t,UDA);var e=RDA(),i=_e(e);p0(i,{name:"close"}),Uc("click",e,function(g){_7.call(this,A,g)}),ue(t,e)}const KDA=`<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 FDA=ot('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-5vi85d"><!></div>');const bDA={hash:"svelte-5vi85d",code:"div.svelte-5vi85d {height:12px;width:12px;}"};function vDA(t){Vt(t,bDA);var A=FDA(),e=_e(A);hu(e,()=>KDA),ue(t,A)}var _DA=ot('<span class="rcb-sandbox-text svelte-18xxdea">SANDBOX</span>'),JDA=ot('<span class="rcb-sandbox-text svelte-18xxdea">Share feedback</span>'),LDA=ot('<a class="rcb-ui-sandbox-banner-link svelte-18xxdea" target="_blank"><!> <!></a>'),qDA=ot('<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 xDA={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 TDA(t,A){ni(A,!1),Vt(t,xDA);let e=Jt(A,"style",8,""),i=Jt(A,"isInElement",8,!1),g=Jt(A,"brandingInfo",8,null),I=$C(!0);function n(){Mi.debugLog("closeBanner"),Et(I,!1)}hC();var o=Ig(),a=Bi(o);{var r=s=>{var B=qDA(),c=St(_e(B),2),E=_e(c);lg(E,{size:"caption-default",children:(M,k)=>{var m=_DA();ue(M,m)},$$slots:{default:!0}});var D=St(c,2),y=_e(D);{var S=M=>{var k=LDA(),m=_e(k);vDA(m);var U=St(m,2);lg(U,{size:"caption-link",children:(F,b)=>{var K=JDA();ue(F,K)},$$slots:{default:!0}}),dt(()=>qt(k,"href",g().sandbox_configuration.checkout_feedback_form_url)),ue(M,k)};Kt(y,M=>{var k;(k=g())!=null&&k.sandbox_configuration&&M(S)})}var f=St(y,2);d$(f,{$$events:{click:n}}),dt(()=>{qt(B,"style",e()),IQ(B,"isInElement",i())}),b7(2,B,()=>yDA,()=>({y:-100,duration:300})),ue(s,B)};Kt(a,s=>{cA(I)&&s(r)})}ue(t,o),oi()}var YDA=ot('<div class="rcb-ui-main svelte-nr408n"><!></div>');const HDA={hash:"svelte-nr408n",code:".rcb-ui-main.svelte-nr408n {flex:1;display:flex;background-color:var(--rc-color-background);}"};function ODA(t,A){ni(A,!0),Vt(t,HDA);const e=je(()=>new d0(A.brandingAppearance).formStyleVars);var i=YDA(),g=_e(i);h$(g,{location:"main-block",children:(I,n)=>{var o=Ig(),a=Bi(o);Bn(a,()=>A.children??qg),ue(I,o)},$$slots:{default:!0}}),dt(()=>qt(i,"style",cA(e))),ue(t,i),oi()}var PDA=ot("<!> <!>",1),jDA=ot("<!> <!>",1);function ZDA(t,A){ni(A,!0);const e=je(()=>{var I;return a$((I=A.brandingInfo)==null?void 0:I.appearance)??""});var i=je(()=>{var I;return(I=A.brandingInfo)==null?void 0:I.appearance}),g=je(()=>{var I;return(I=A.brandingInfo)==null?void 0:I.brand_font_config});EDA(t,{get brandingAppearance(){return cA(i)},get brandFontConfig(){return cA(g)},get isInElement(){return A.isInElement},children:(I,n)=>{var o=jDA(),a=Bi(o);{var r=B=>{TDA(B,{get style(){return cA(e)},get isInElement(){return A.isInElement},get brandingInfo(){return A.brandingInfo}})};Kt(a,B=>{A.isSandbox&&B(r)})}var s=St(a,2);dDA(s,{get style(){return cA(e)},children:(B,c)=>{var E=PDA(),D=Bi(E);{var y=M=>{var k=je(()=>{var m;return(m=A.brandingInfo)==null?void 0:m.appearance});GDA(M,{get brandingAppearance(){return cA(k)},get headerContent(){return A.navbarHeaderContent},get bodyContent(){return A.navbarBodyContent}})};Kt(D,M=>{(A.navbarHeaderContent||A.navbarBodyContent)&&M(y)})}var S=St(D,2),f=je(()=>{var M;return(M=A.brandingInfo)==null?void 0:M.appearance});ODA(S,{get brandingAppearance(){return cA(f)},children:(M,k)=>{var m=Ig(),U=Bi(m);Bn(U,()=>A.mainContent??qg),ue(M,m)},$$slots:{default:!0}}),ue(B,E)},$$slots:{default:!0}}),ue(I,o)},$$slots:{default:!0}}),oi()}var WDA=ot('<source type="image/webp">'),zDA=ot('<picture class="rcb-app-icon-picture-container svelte-el1u77"><!> <img class="rcb-app-icon svelte-el1u77" alt="App icon"></picture>'),VDA=ot('<div class="rcb-app-icon loading svelte-el1u77"></div>');const XDA={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 $DA(t,A){Vt(t,XDA);var e=Ig(),i=Bi(e);{var g=n=>{var o=zDA(),a=_e(o);{var r=B=>{var c=WDA();dt(()=>qt(c,"srcset",A.srcWebp)),ue(B,c)};Kt(a,B=>{A.srcWebp&&B(r)})}var s=St(a,2);dt(()=>qt(s,"src",A.src)),ue(n,o)},I=n=>{var o=VDA();ue(n,o)};Kt(i,n=>{A.src?n(g):n(I,!1)})}ue(t,e)}var AyA=ot('<button class="rcb-back-button svelte-9xjbko" data-testid="close-button"><!></button>');const eyA={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 tyA(t,A){Vt(t,eyA);var e=AyA(),i=_e(e);p0(i,{name:"back"}),Uc("click",e,function(g){_7.call(this,A,g)}),ue(t,e)}var iyA=ot('<source type="image/webp" class="rcb-app-icon svelte-19gv4gf">'),gyA=ot('<picture class="rcb-app-icon svelte-19gv4gf"><!> <img class="rcb-app-icon svelte-19gv4gf" alt="App icon"></picture>');const IyA={hash:"svelte-19gv4gf",code:".rcb-app-icon.svelte-19gv4gf {height:32px;}"};function nyA(t,A){Vt(t,IyA);var e=gyA(),i=_e(e);{var g=n=>{var o=iyA();dt(()=>qt(o,"srcset",A.srcWebp)),ue(n,o)};Kt(i,n=>{A.srcWebp&&n(g)})}var I=St(i,2);dt(()=>qt(I,"src",A.src)),ue(t,e)}var oyA=ot('<div class="rcb-back-wrapper svelte-11zapuq"><!></div>'),ayA=ot('<div class="rcb-close-wrapper svelte-11zapuq"><!></div>'),ryA=ot('<div class="rcb-header-wrapper svelte-11zapuq"><!> <div class="rcb-header svelte-11zapuq"><div class="rcb-title svelte-11zapuq"><!> <!></div></div> <!></div>');const syA={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 CyA(t,A){ni(A,!0),Vt(t,syA);const e=K=>K==null||K==null||K==""?null:K,i=je(()=>{var K;return e((K=A.brandingInfo)==null?void 0:K.app_icon)}),g=je(()=>{var K;return e((K=A.brandingInfo)==null?void 0:K.app_icon_webp)}),I=je(()=>{var K;return e((K=A.brandingInfo)==null?void 0:K.app_wordmark)}),n=je(()=>{var K;return e((K=A.brandingInfo)==null?void 0:K.app_wordmark_webp)}),o=je(()=>cA(i)?nm(cA(i)):null),a=je(()=>cA(g)?nm(cA(g)):null),r=je(()=>cA(I)?nm(cA(I)):null),s=je(()=>cA(n)?nm(cA(n)):null),B=()=>{A.onClose&&A.onClose()};var c=ryA(),E=_e(c);{var D=K=>{var R=oyA(),G=_e(R);tyA(G,{$$events:{click:B}}),ue(K,R)};Kt(E,K=>{A.showCloseButton&&K(D)})}var y=St(E,2),S=_e(y),f=_e(S);{var M=K=>{nyA(K,{get src(){return cA(r)},get srcWebp(){return cA(s)}})},k=K=>{var R=Ig(),G=Bi(R);{var J=x=>{$DA(x,{get src(){return cA(o)},get srcWebp(){return cA(a)}})};Kt(G,x=>{cA(o)!==null&&cA(a)!==null&&x(J)},!0)}ue(K,R)};Kt(f,K=>{cA(r)!==null?K(M):K(k,!1)})}var m=St(f,2);{var U=K=>{lg(K,{size:"body-base",children:(R,G)=>{var J=Lg();dt(()=>{var x;return Oi(J,(x=A.brandingInfo)==null?void 0:x.app_name)}),ue(R,J)},$$slots:{default:!0}})};Kt(m,K=>{cA(r)===null&&K(U)})}var F=St(y,2);{var b=K=>{var R=ayA(),G=_e(R);d$(G,{$$events:{click:B}}),ue(K,R)};Kt(F,K=>{A.showCloseButton&&K(b)})}dt(()=>IQ(c,"rcb-with-close-button",A.showCloseButton)),ue(t,c),oi()}var ByA=ot("<!> <!> <!> <!>",1);function cyA(t,A){ni(A,!0);const e=Jt(A,"onClose",3,void 0),i=Q$(A.productDetails,A.purchaseOptionToUse);let g=Ki(Xt(A.defaultPriceBreakdown??{currency:i.currency,totalAmountInMicros:i.amountMicros,totalExcludingTaxInMicros:i.amountMicros,taxCalculationStatus:"unavailable",taxAmountInMicros:null,taxBreakdown:null}));const I=n=>{Et(g,Xt(n))};ZDA(t,{get brandingInfo(){return A.brandingInfo},get isInElement(){return A.isInElement},get isSandbox(){return A.isSandbox},get onClose(){return e()},navbarHeaderContent:n=>{var o=je(()=>!A.isInElement&&!!e());CyA(n,{get brandingInfo(){return A.brandingInfo},get onClose(){return e()},get showCloseButton(){return cA(o)}})},navbarBodyContent:n=>{var o=je(()=>{var a,r;return((r=(a=A.brandingInfo)==null?void 0:a.appearance)==null?void 0:r.show_product_description)??!1});cDA(n,{get productDetails(){return A.productDetails},get purchaseOption(){return A.purchaseOptionToUse},get showProductDescription(){return cA(o)},get priceBreakdown(){return cA(g)}})},mainContent:n=>{var o=ByA(),a=Bi(o);{var r=S=>{qfA(S)};Kt(a,S=>{A.currentPage==="payment-entry-loading"&&S(r)})}var s=St(a,2);{var B=S=>{IfA(S,{get productDetails(){return A.productDetails},get purchaseOption(){return A.purchaseOptionToUse},get brandingInfo(){return A.brandingInfo},get purchaseOperationHelper(){return A.purchaseOperationHelper},get gatewayParams(){return A.gatewayParams},get managementUrl(){return A.managementUrl},get customerEmail(){return A.customerEmail},get defaultPriceBreakdown(){return A.defaultPriceBreakdown},get onContinue(){return A.onContinue},get onError(){return A.onError},onPriceBreakdownUpdated:I})};Kt(s,S=>{A.currentPage==="payment-entry"&&S(B)})}var c=St(s,2);{var E=S=>{var f=je(()=>{var k;return((k=A.brandingInfo)==null?void 0:k.support_email)??null}),M=je(()=>{var k;return((k=A.brandingInfo)==null?void 0:k.app_name)??null});JfA(S,{get lastError(){return A.lastError},get productDetails(){return A.productDetails},get supportEmail(){return cA(f)},get onDismiss(){return A.closeWithError},get appName(){return cA(M)}})};Kt(c,S=>{A.currentPage==="error"&&S(E)})}var D=St(c,2);{var y=S=>{LfA(S,{get onContinue(){return A.onContinue}})};Kt(D,S=>{A.currentPage==="success"&&S(y)})}ue(n,o)},$$slots:{navbarHeaderContent:!0,navbarBodyContent:!0,mainContent:!0}}),oi()}function lyA(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 QyA(t){if(t&&!t.match(/^[A-Z]{3}$/)){const A=`Currency code ${t} is not valid. Please provide a valid ISO 4217 currency code.`;throw Mi.errorLog(A),new xI(Un.ConfigurationError,A)}}function EyA(t,A){var e;ni(A,!0);const i=Jt(A,"customTranslations",19,()=>({})),g=Jt(A,"skipSuccessPage",3,!1),I=A.customerEmail?lyA(A.customerEmail):null;let n=Ki(Xt(I?void 0:A.customerEmail)),o=A.rcPackage.webBillingProduct,a=Ki(null);const r=A.rcPackage.webBillingProduct.identifier??null;let s=Ki("payment-entry-loading"),B=Ki(null),c=Ki(Xt({})),E=Ki(null),D=Ki(null),y=Ki(null),S=Ki(null),f=new _F(i(),A.selectedLocale,A.defaultLocale),M=T7(f);w_(us,M),w_(z2,(e=A.brandingInfo)==null?void 0:e.appearance),cC(()=>{A.isInElement||(Et(D,Xt(document.documentElement.style.height)),Et(y,Xt(document.documentElement.style.overflow)),Et(S,Xt(document.body.style.height)),document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden")}),Mk(()=>{if(!A.isInElement){const K=(R,G,J)=>{J===""?R.style.removeProperty(G):R.style.setProperty(G,J)};K(document.documentElement,"height",cA(D)),K(document.body,"height",cA(S)),K(document.documentElement,"overflow",cA(y))}}),w_(W2,A.eventsTracker),cC(async()=>{if(r===null){m(new rI(Og.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}A.purchaseOperationHelper.checkoutStart(A.appUserId,r,A.purchaseOption,A.rcPackage.webBillingProduct.presentedOfferingContext,cA(n),A.metadata).then(K=>{Et(a,null),Et(s,"payment-entry"),Et(c,Xt(K.gateway_params)),Et(E,Xt(K.management_url))}).catch(K=>{if(K.errorCode===Og.MissingEmailError)return Et(n,void 0),A.purchaseOperationHelper.checkoutStart(A.appUserId,r,A.purchaseOption,A.rcPackage.webBillingProduct.presentedOfferingContext,cA(n),A.metadata).then(R=>{Et(a,null),Et(s,"payment-entry"),Et(c,Xt(R.gateway_params)),Et(E,Xt(R.management_url))}).catch(R=>{m(R)});m(K)})});const k=()=>{if(cA(s)==="payment-entry"){A.purchaseOperationHelper.pollCurrentPurchaseForCompletion().then(K=>{Et(B,Xt(K)),g()?A.onFinished(K):Et(s,"success")}).catch(K=>{m(K)});return}if(cA(s)==="success"||cA(s)==="error"){A.onFinished(cA(B));return}Et(s,"success")},m=K=>{const R=PdA({errorCode:K.getErrorCode().toString(),errorMessage:K.message});A.eventsTracker.trackSDKEvent(R),Et(a,Xt(K)),Et(s,"error")},U=()=>{A.onError(cA(a)??new rI(Og.UnknownError,"Unknown error without state set."))};var F=je(()=>A.purchases.isSandbox()),b=je(()=>cA(n)??null);cyA(t,{get isSandbox(){return cA(F)},get currentPage(){return cA(s)},get brandingInfo(){return A.brandingInfo},productDetails:o,get purchaseOptionToUse(){return A.purchaseOption},get lastError(){return cA(a)},get gatewayParams(){return cA(c)},get managementUrl(){return cA(E)},get purchaseOperationHelper(){return A.purchaseOperationHelper},get isInElement(){return A.isInElement},get customerEmail(){return cA(b)},closeWithError:U,onContinue:k,onError:m,get onClose(){return A.onClose}}),oi()}function p$(t){return t==null?!0:new Date(t)>new Date}function uyA(t,A,e,i){const g=A.product_identifier;if(g in e)return hyA(t,A,e[g]);if(g in i)return dyA(t,A,i[g]);throw new xI(Un.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function hyA(t,A,e){return{identifier:t,isActive:p$(A.expires_date),willRenew:D$(A.expires_date,e),store:e?.store??"unknown",latestPurchaseDate:new Date(A.purchase_date),originalPurchaseDate:new Date(A.purchase_date),expirationDate:wc(A.expires_date),productIdentifier:A.product_identifier,productPlanIdentifier:A.product_plan_identifier??null,unsubscribeDetectedAt:wc(e?.unsubscribe_detected_at),billingIssueDetectedAt:wc(e?.billing_issues_detected_at),isSandbox:e?.is_sandbox??!1,periodType:e?.period_type??"normal",ownershipType:e?.ownership_type??"UNKNOWN"}}function dyA(t,A,e){return{identifier:t,isActive:!0,willRenew:!1,store:e.store,latestPurchaseDate:new Date(A.purchase_date),originalPurchaseDate:new Date(e.original_purchase_date),expirationDate:null,productIdentifier:A.product_identifier,productPlanIdentifier:null,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:e.is_sandbox,periodType:"normal",ownershipType:"UNKNOWN"}}function pyA(t,A,e){const i={},g={};for(const I in t){const n=uyA(I,t[I],A,e);i[I]=n,n.isActive&&(g[I]=n)}return{all:i,active:g}}function wc(t){return t==null?null:new Date(t)}function f$(t){const A=DyA(t),e=t.subscriber,i=SyA(e.non_subscriptions),g=Object.entries(t.subscriber.non_subscriptions).flatMap(([o,a])=>a.map(r=>({transactionIdentifier:r.id,productIdentifier:o,purchaseDate:new Date(r.purchase_date||r.original_purchase_date),storeTransactionId:r.store_transaction_id||null,store:r.store}))),I=new Date(t.request_date),n=Object.fromEntries(Object.entries(t.subscriber.subscriptions).map(([o,a])=>[o,{productIdentifier:o,purchaseDate:new Date(a.purchase_date),originalPurchaseDate:wc(a.original_purchase_date),expiresDate:wc(a.expires_date),store:a.store,unsubscribeDetectedAt:wc(a.unsubscribe_detected_at),isSandbox:a.is_sandbox,billingIssuesDetectedAt:wc(a.billing_issues_detected_at),gracePeriodExpiresDate:wc(a.grace_period_expires_date),ownershipType:a.ownership_type??"UNKNOWN",periodType:a.period_type,refundedAt:wc(a.refunded_at),storeTransactionId:a.store_transaction_id||null,isActive:p$(a.expires_date),willRenew:D$(a.expires_date,a)}]));return{entitlements:pyA(e.entitlements,e.subscriptions,i),allExpirationDatesByProduct:A,allPurchaseDatesByProduct:fyA(t,i),activeSubscriptions:yyA(A),managementURL:e.management_url,requestDate:I,firstSeenDate:new Date(e.first_seen),originalPurchaseDate:wc(e.original_purchase_date),originalAppUserId:t.subscriber.original_app_user_id,nonSubscriptionTransactions:g,subscriptionsByProductIdentifier:n}}function D$(t,A){if(A==null)return!1;const e=A.store=="promotional",i=t==null,g=A.unsubscribe_detected_at!=null,I=A.billing_issues_detected_at!=null;return!(e||i||g||I)}function fyA(t,A){const e={};for(const i in t.subscriber.subscriptions){const g=t.subscriber.subscriptions[i];e[i]=new Date(g.purchase_date)}for(const i in A){const g=A[i].purchase_date;g==null?e[i]=null:e[i]=new Date(g)}return e}function DyA(t){const A={};for(const e in t.subscriber.subscriptions){const i=t.subscriber.subscriptions[e];i.expires_date==null?A[e]=null:A[e]=new Date(i.expires_date)}return A}function yyA(t){const A=new Set,e=new Date;for(const i in t){const g=t[i];(g==null||g>e)&&A.add(i)}return A}function SyA(t){const A={};for(const e in t){if(t[e].length===0)continue;const i=t[e].length;A[e]=t[e][i-1]}return A}const y$="1.13.1",wyA="https://api.revenuecat.com",myA="https://e.revenue.cat";var mU;(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"})(mU||(mU={}));const kyA=/^rcb_[a-zA-Z0-9_.-]+$/,MyA=/^pdl_[a-zA-Z0-9_.-]+$/,NyA=/^test_[a-zA-Z0-9_.-]+$/;function kU(t){return t?t.startsWith("rcb_sb_"):!1}function GyA(t){return t?kyA.test(t):!1}function RyA(t){return t?MyA.test(t):!1}function om(t){return t?NyA.test(t):!1}async function ZC(t,A,e){const{apiKey:i,body:g,headers:I,httpConfig:n}=A,o=`${n?.proxyURL??wyA}${t.urlPath()}`;try{const a=await fetch(o,{method:t.method,headers:U$(i,I,n?.additionalHeaders),body:KyA(g),signal:e});return await UyA(a,t),await a.json()}catch(a){throw a instanceof TypeError?new xI(Un.NetworkError,Mm.getPublicMessage(Un.NetworkError),a.message):a}}async function UyA(t,A){const e=t.status;if(e>=mU.INTERNAL_SERVER_ERROR)N_(A,e,await t.text());else if(e>=mU.BAD_REQUEST){const i=await t.json(),g=i?JSON.stringify(i):null,I=i?.code,n=i?.message;if(I!=null){const o=Mm.convertCodeToBackendErrorCode(I);if(o==null)N_(A,e,g,I);else throw xI.getForBackendError(o,n)}else N_(A,e,g)}}function N_(t,A,e,i){throw new xI(Un.UnknownBackendError,"Unknown backend error.",`Request: ${t.name}. Status code: ${A}. Body: ${e}.`,{backendErrorCode:i})}function KyA(t){return t==null?null:JSON.stringify(t)}const S$="Authorization",w$="Content-Type",m$="Accept",k$="X-Platform",M$="X-Version",N$="X-Platform-Flavor",G$="X-Platform-Flavor-Version",R$="X-Is-Sandbox",FyA=new Set([S$,w$,m$,k$,M$,R$,N$,G$]);function U$(t,A,e){let i={[S$]:`Bearer ${t}`,[w$]:"application/json",[m$]:"application/json",[k$]:"web",[M$]:y$,[R$]:`${kU(t)}`};const g=Gm.getPlatformInfo();if(g){const I={[N$]:g.flavor,[G$]:g.version};i={...i,...I}}return A&&(i={...i,...A}),e&&(i={...e,...i}),i}const LF="/v1/subscribers",Ty="/rcbilling/v1";class byA{constructor(A){ft(this,"appUserId"),ft(this,"method","GET"),ft(this,"name","getOfferings"),this.appUserId=A}urlPath(){const A=encodeURIComponent(this.appUserId);return`${LF}/${A}/offerings`}}class vyA{constructor(A,e,i){ft(this,"method","GET"),ft(this,"name","getProducts"),ft(this,"appUserId"),ft(this,"productIds"),ft(this,"currency"),this.appUserId=A,this.productIds=e,this.currency=i}urlPath(){const A=encodeURIComponent(this.appUserId),e=this.productIds.map(encodeURIComponent).join("&id="),i=this.currency?`&currency=${this.currency}`:"";return`${Ty}/subscribers/${A}/products?id=${e}${i}`}}class _yA{constructor(A){ft(this,"method","GET"),ft(this,"name","getCustomerInfo"),ft(this,"appUserId"),this.appUserId=A}urlPath(){const A=encodeURIComponent(this.appUserId);return`${LF}/${A}`}}class JyA{constructor(){ft(this,"method","GET"),ft(this,"name","getBrandingInfo")}urlPath(){return`${Ty}/branding`}}class LyA{constructor(){ft(this,"method","POST"),ft(this,"name","postCheckoutStart")}urlPath(){return`${Ty}/checkout/start`}}class qyA{constructor(A){ft(this,"method","POST"),ft(this,"name","postCheckoutCalculateTax"),ft(this,"operationSessionId"),this.operationSessionId=A}urlPath(){return`${Ty}/checkout/${this.operationSessionId}/calculate_taxes`}}class xyA{constructor(A){ft(this,"method","POST"),ft(this,"name","postCheckoutComplete"),ft(this,"operationSessionId"),this.operationSessionId=A}urlPath(){return`${Ty}/checkout/${this.operationSessionId}/complete`}}class TyA{constructor(A){ft(this,"method","GET"),ft(this,"name","getCheckoutStatus"),ft(this,"operationSessionId"),this.operationSessionId=A}urlPath(){return`${Ty}/checkout/${this.operationSessionId}`}}class YyA{constructor(A){ft(this,"method","POST"),ft(this,"name","setAttributes"),ft(this,"appUserId"),this.appUserId=A}urlPath(){const A=encodeURIComponent(this.appUserId);return`${LF}/${A}/attributes`}}class HyA{constructor(){ft(this,"method","POST"),ft(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class OyA{constructor(A){ft(this,"method","GET"),ft(this,"name","getVirtualCurrencies"),ft(this,"appUserId"),this.appUserId=A}urlPath(){const A=encodeURIComponent(this.appUserId);return`${LF}/${A}/virtual_currencies`}}const $x={};class PyA{constructor(A,e=$x){ft(this,"API_KEY"),ft(this,"httpConfig"),ft(this,"isSandbox"),this.API_KEY=A,this.httpConfig=e,this.isSandbox=kU(A)}getIsSandbox(){return this.isSandbox}async getOfferings(A){return await ZC(new byA(A),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(A){return await ZC(new _yA(A),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(A,e,i){return await ZC(new vyA(A,e,i),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await ZC(new JyA,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postCheckoutStart(A,e,i,g,I,n,o=void 0){const a={app_user_id:A,product_id:e,email:n,price_id:g.priceId,presented_offering_identifier:i.offeringIdentifier,trace_id:I};return o&&(a.metadata=o),g.id!=="base_option"&&(a.offer_id=g.id),i.targetingContext&&(a.applied_targeting_rule={rule_id:i.targetingContext.ruleId,revision:i.targetingContext.revision}),i.placementIdentifier&&(a.presented_placement_identifier=i.placementIdentifier),await ZC(new LyA,{apiKey:this.API_KEY,body:a,httpConfig:this.httpConfig})}async postCheckoutCalculateTax(A,e,i,g){const I={country_code:e,postal_code:i};return await ZC(new qyA(A),{apiKey:this.API_KEY,body:I,httpConfig:this.httpConfig},g)}async postCheckoutComplete(A,e){const i={email:e};return await ZC(new xyA(A),{apiKey:this.API_KEY,body:i,httpConfig:this.httpConfig})}async getCheckoutStatus(A){return await ZC(new TyA(A),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async setAttributes(A,e){const i=Date.now(),g={};for(const[n,o]of Object.entries(e))g[n]={value:o,updated_at_ms:i};const I={attributes:g};return await ZC(new YyA(A),{apiKey:this.API_KEY,body:I,httpConfig:this.httpConfig})}async postReceipt(A,e,i,g,I){let n=null;g.targetingContext&&(n={rule_id:g.targetingContext.ruleId,revision:g.targetingContext.revision});const o={fetch_token:i,product_id:e,app_user_id:A,presented_offering_identifier:g.offeringIdentifier,presented_placement_identifier:g.placementIdentifier,applied_targeting_rule:n,initiation_source:I};return await ZC(new HyA,{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig})}async getVirtualCurrencies(A){return await ZC(new OyA(A),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function jyA(t,A){if(!(GyA(t)||om(t)||RyA(t)&&A?.allowPaddleAPIKey))throw new xI(Un.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function Bj(t){if(!t||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(t)||t.includes("/"))throw new xI(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 ZyA(t){if(t!=null&&t.endsWith("/"))throw new xI(Un.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function WyA(t){if(t){for(const A in t)if(FyA.has(A))throw new xI(Un.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var K$=(t=>(t.Current="current",t))(K$||{});function zyA(t,A){async function e(...i){return await this.preload(),await t.call(this,...i)}return e}const F$=(t,A)=>{const e={...t.webBillingProduct,presentedOfferingContext:{...t.webBillingProduct.presentedOfferingContext,placementIdentifier:A}};return{...t,webBillingProduct:e,rcBillingProduct:e}},lh=(t,A)=>t==null?null:F$(t,A),VyA=(t,A,e)=>{const i=t.offering_ids_by_placement??null;if(i==null)return null;const g=t.fallback_offering_id??null;let I;if(e in i){const o=i[e]??null;if(o==null)return null;I=A[o],I==null&&(I=A[g])}else I=A[g];if(I==null)return null;const n=Object.fromEntries(Object.entries(I.packagesById).map(([o,a])=>[o,F$(a,e)]));return{...I,packagesById:n,availablePackages:Object.values(n),weekly:lh(I.weekly,e),monthly:lh(I.monthly,e),twoMonth:lh(I.twoMonth,e),threeMonth:lh(I.threeMonth,e),sixMonth:lh(I.sixMonth,e),annual:lh(I.annual,e),lifetime:lh(I.lifetime,e)}};function XyA(t,A){const e={};A.product_details.forEach(I=>{e[I.identifier]=I});const i={};t.offerings.forEach(I=>{const n=I.identifier===t.current_offering_id,o=lfA(n,I,e,t.targeting);o!=null&&(i[I.identifier]=o)});const g=t.current_offering_id?i[t.current_offering_id]??null:null;return Object.keys(i).length==0&&Mi.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:i,current:g}}const $yA=1000001;function ASA(t){return t.webBillingProduct.defaultPurchaseOption}function cj(t,A,e,i=!1){return e.translate(vt.PaywallVariablesPricePerPeriod,{formattedPrice:t,period:A.base.period?e.translatePeriod(A.base.period.number,A.base.period.unit,{noWhitespace:!0,short:!i}):""})}function eSA(t,A){return t.unit==="year"?A.translatePeriod(t.number*12,To.Month):A.translatePeriod(t.number,t.unit)}function tSA({price:t,period:A,translator:e}){const i=e.formatPrice(t.amountMicros,t.currency);return A?A.unit==="year"?e.formatPrice(t.amountMicros/12/4,t.currency):A.unit==="month"||A.unit==="week"&&A.number>1?e.formatPrice(t.amountMicros/A.number,t.currency):A.unit==="day"?e.formatPrice(t.amountMicros*7/A.number,t.currency):i:i}function iSA({price:t,period:A,translator:e}){const i=e.formatPrice(t.amountMicros,t.currency);return!A||!A.number?i:A.unit==="year"?e.formatPrice(t.amountMicros/12,t.currency):A.unit==="month"&&A.number>1?e.formatPrice(t.amountMicros/A.number,t.currency):A.unit==="week"?e.formatPrice(t.amountMicros*4/A.number,t.currency):A.unit==="day"?e.formatPrice(t.amountMicros*30/A.number,t.currency):i}function lj({price:t,period:A,full:e=!1,translator:i}){if(!A||!A.number||A.unit===To.Month&&A.number==1)return i.formatPrice(t.amountMicros,t.currency);let g="";switch(A.unit){case To.Year:g=i.formatPrice(t.amountMicros/12,t.currency);break;case To.Month:g=i.formatPrice(t.amountMicros/A.number,t.currency);break;case To.Week:g=i.formatPrice(t.amountMicros*4/A.number,t.currency);break;case To.Day:g=i.formatPrice(t.amountMicros*30/A.number,t.currency);break}return i.translate(vt.PaywallVariablesTotalPriceAndPerMonth,{formattedPrice:i.formatPrice(t.amountMicros,t.currency),period:i.translatePeriod(A.number,A.unit,{noWhitespace:!0,short:!e}),formattedPricePerMonth:g,monthPeriod:i.translatePeriodUnit(To.Month,{noWhitespace:!0,short:!e})})}function gSA(t,A){const e=t.availablePackages,i=e.reduce((g,I)=>{const n=g.webBillingProduct.price||g.webBillingProduct.price,o=I.webBillingProduct.price||I.webBillingProduct.price;return n.amountMicros>o.amountMicros?g:I});return e.reduce((g,I)=>(g[I.identifier]=ISA(I,i,A),g),{})}function ISA(t,A,e){const i=t.webBillingProduct,g=i.price||i.price,I=e.formatPrice(g.amountMicros,g.currency),n=ASA(t),o=i.productType,a={product_name:i.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(o===sd.Subscription&&n){a.price_per_period=cj(I,n,e),a.price_per_period_full=cj(I,n,e,!0);const r=i.period||n.base.period;a.total_price_and_per_month=lj({price:g,period:r,translator:e}),a.total_price_and_per_month_full=lj({price:g,period:r,full:!0,translator:e}),a.sub_price_per_month=iSA({price:g,period:r,translator:e}),a.sub_price_per_week=tSA({price:g,period:r,translator:e}),a.sub_duration=e.translatePeriod(r?.number,r?.unit),a.sub_duration_in_months=eSA(r,e),a.sub_period=e.translatePeriodFrequency(r?.number,r?.unit),a.sub_period_length=r?e.translatePeriodUnit(r.unit,{noWhitespace:!0}):void 0,a.sub_period_abbreviated=r?e.translatePeriodUnit(r.unit,{noWhitespace:!0,short:!0}):void 0;const s=g.amountMicros,B=(A.webBillingProduct.price||A.webBillingProduct.price).amountMicros,c=((B-s)*100/B).toFixed(0);a.sub_relative_discount=s===B?"":e.translate(vt.PaywallVariablesSubRelativeDiscount,{discount:c})}return(o===sd.NonConsumable||o===sd.Consumable)&&n&&(a.price=I,a.price_per_period=I,a.price_per_period_full=I,a.total_price_and_per_month=I,a.sub_price_per_month=I,a.sub_duration=e.translate(vt.PeriodsLifetime),a.sub_duration_in_months=e.translate(vt.PeriodsLifetime),a.sub_period=e.translate(vt.PeriodsLifetime),a.sub_price_per_week=void 0,a.sub_relative_discount=void 0,a.price_per_period_full=I,a.total_price_and_per_month_full=I,a.sub_period_length=void 0,a.sub_period_abbreviated=void 0),a}const _o=[];for(let t=0;t<256;++t)_o.push((t+256).toString(16).slice(1));function nSA(t,A=0){return(_o[t[A+0]]+_o[t[A+1]]+_o[t[A+2]]+_o[t[A+3]]+"-"+_o[t[A+4]]+_o[t[A+5]]+"-"+_o[t[A+6]]+_o[t[A+7]]+"-"+_o[t[A+8]]+_o[t[A+9]]+"-"+_o[t[A+10]]+_o[t[A+11]]+_o[t[A+12]]+_o[t[A+13]]+_o[t[A+14]]+_o[t[A+15]]).toLowerCase()}let G_;const oSA=new Uint8Array(16);function aSA(){if(!G_){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");G_=crypto.getRandomValues.bind(crypto)}return G_(oSA)}const rSA=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),Qj={randomUUID:rSA};function b$(t,A,e){var i;if(Qj.randomUUID&&!t)return Qj.randomUUID();t=t||{};const g=t.random??((i=t.rng)==null?void 0:i.call(t))??aSA();if(g.length<16)throw new Error("Random bytes length must be >= 16");return g[6]=g[6]&15|64,g[8]=g[8]&63|128,nSA(g)}var sSA=/(%?)(%([sdijo]))/g;function CSA(t,A){switch(A){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 e=JSON.stringify(t);return e==="{}"||e==="[]"||/^\[object .+?\]$/.test(e)?t:e}}}function tH(t,...A){if(A.length===0)return t;let e=0,i=t.replace(sSA,(g,I,n,o)=>{const a=A[e],r=CSA(a,o);return I?g:(e++,r)});return e<A.length&&(i+=` ${A.slice(e).join(" ")}`),i=i.replace(/%{2,2}/g,"%"),i}var BSA=2;function cSA(t){if(!t.stack)return;const A=t.stack.split(`
`);A.splice(1,BSA),t.stack=A.join(`
`)}var lSA=class extends Error{constructor(t,...A){super(t),this.message=t,this.name="Invariant Violation",this.message=tH(t,...A),cSA(this)}},v$=(t,A,...e)=>{if(!t)throw new lSA(A,...e)};v$.as=(t,A,e,...i)=>{if(!A){const g=i.length===0?e:tH(e,...i);let I;try{I=Reflect.construct(t,[g])}catch{I=t(g)}throw I}};const QSA="[MSW]";function ESA(t,...A){const e=tH(t,...A);return`${QSA} ${e}`}function uSA(t,...A){}function hSA(t,...A){}const dSA={formatMessage:ESA,warn:uSA,error:hSA};function pSA(){v$(typeof URL<"u",dSA.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 _$=(t=>(t.HEAD="HEAD",t.GET="GET",t.POST="POST",t.PUT="PUT",t.PATCH="PATCH",t.OPTIONS="OPTIONS",t.DELETE="DELETE",t))(_$||{});pSA();class fSA{constructor(A,e,i,g){ft(this,"initialDelay"),ft(this,"maxDelay"),ft(this,"jitterPercent"),ft(this,"callback"),ft(this,"currentDelay"),ft(this,"timeoutId"),ft(this,"executingCallback",!1),this.initialDelay=A,this.currentDelay=A,this.maxDelay=e,this.jitterPercent=i,this.callback=g}tryFlush(){if(this.backingOff()){Mi.debugLog("Backing off, not flushing");return}this.clearTimeout(),this.executeCallbackWithRetries()}stop(){this.clearTimeout()}schedule(A){if(this.timeoutId!==void 0)return;const e=this.addJitter(A||this.currentDelay);this.timeoutId=setTimeout(()=>{this.timeoutId=void 0,this.executeCallbackWithRetries()},e)}backoff(){const A=this.currentDelay,e=Math.min(this.currentDelay*2,this.maxDelay);Mi.debugLog(`Backing next off to ${A}ms delay`),this.clearTimeout(),this.currentDelay=e,this.schedule(A)}reset(){this.currentDelay!==this.initialDelay&&(this.clearTimeout(),this.currentDelay=this.initialDelay)}async executeCallbackWithRetries(){if(this.executingCallback){Mi.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(A){const e=A*this.jitterPercent,i=A-e,g=A+e;return Math.floor(Math.random()*(g-i+1)+i)}}function J$(t){const A={};for(const e in t)if(Object.prototype.hasOwnProperty.call(t,e)){const i=e.replace(/([A-Z])/g,"_$1").toLowerCase(),g=t[e];g&&typeof g=="object"&&!Array.isArray(g)?A[i]=J$(g):A[i]=g}return A}class DSA{constructor(A){ft(this,"EVENT_TYPE","web_billing"),ft(this,"id"),ft(this,"timestampMs"),ft(this,"data"),this.id=b$(),this.timestampMs=Date.now(),this.data=A}toJSON(){return J$({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 ySA(t,A){const e=new URLSearchParams(window.location.search);return{libraryName:"purchases-js",libraryVersion:y$,locale:navigator.language,userAgent:navigator.userAgent,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,utmSource:e.get("utm_source")??null,utmMedium:e.get("utm_medium")??null,utmCampaign:e.get("utm_campaign")??null,utmContent:e.get("utm_content")??null,utmTerm:e.get("utm_term")??null,pageReferrer:document.referrer,pageUrl:`${window.location.origin}${window.location.pathname}`,pageTitle:document.title,source:t,rcSource:A}}const SSA=2e3,wSA=5*6e4,mSA=.1;class kSA{constructor(A){ft(this,"apiKey"),ft(this,"eventsQueue",[]),ft(this,"eventsUrl"),ft(this,"flushManager"),ft(this,"traceId",b$()),ft(this,"appUserId"),ft(this,"isSilent"),ft(this,"rcSource"),this.apiKey=A.apiKey,this.eventsUrl=`${myA}/v1/events`,this.appUserId=A.appUserId,this.isSilent=A.silent||!1,this.rcSource=A.rcSource,this.flushManager=new fSA(SSA,wSA,mSA,this.flushEvents.bind(this))}async updateUser(A){this.appUserId=A}getTraceId(){return this.traceId}trackSDKEvent(A){this.trackEvent({...A,source:"sdk"})}trackExternalEvent(A){this.trackEvent({...A})}trackEvent(A){if(this.isSilent){Mi.verboseLog("Skipping event tracking, the EventsTracker is silent");return}try{const e=new DSA({eventName:A.eventName,traceId:this.traceId,appUserId:this.appUserId,context:ySA(A.source,this.rcSource),properties:A.properties||{}});this.eventsQueue.push(e),this.flushManager.tryFlush()}catch{Mi.errorLog(`Error while tracking event ${A.eventName}`)}}dispose(){this.flushManager.stop()}flushEvents(){if(this.eventsQueue.length===0)return Promise.resolve();const A=[...this.eventsQueue];return fetch(this.eventsUrl,{method:_$.POST,headers:U$(this.apiKey),body:JSON.stringify({events:A})}).then(e=>{if(e.status===200||e.status===201){this.eventsQueue.splice(0,A.length);return}else throw Mi.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(e=>{throw Mi.debugLog("Error while flushing events"),e})}}const MSA=()=>{const t=new URLSearchParams(window.location.search),A=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],e={};return A.forEach(i=>{const g=t.get(i);g!==null&&(e[i]=g)}),e},NSA=["app","embedded"],R_={autoCollectUTMAsMetadata:!0,collectAnalyticsEvents:!0};function AT(){if(crypto&&crypto.randomUUID)return crypto.randomUUID();const t=new Uint8Array(16);if(crypto&&crypto.getRandomValues)crypto.getRandomValues(t);else for(let e=0;e<16;e++)t[e]=Math.floor(Math.random()*256);t[6]=t[6]&15|64,t[8]=t[8]&63|128;const A=Array.from(t).map(e=>e.toString(16).padStart(2,"0"));return[A.slice(0,4).join(""),A.slice(4,6).join(""),A.slice(6,8).join(""),A.slice(8,10).join(""),A.slice(10,16).join("")].join("-")}var GSA=ot('<p class="svelte-11vxb6p"><strong>Free Trial:</strong> </p>'),RSA=ot('<p class="svelte-11vxb6p"><strong>Intro Price:</strong> </p>'),USA=ot('<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 KSA={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 FSA(t,A){ni(A,!1),Vt(t,KSA);let e=Jt(A,"productIdentifier",8),i=Jt(A,"productType",8),g=Jt(A,"basePrice",8),I=Jt(A,"freeTrialPeriod",8,void 0),n=Jt(A,"introPriceFormatted",8,void 0),o=Jt(A,"onValidPurchase",8),a=Jt(A,"onFailedPurchase",8),r=Jt(A,"onCancel",8);function s(P){P.target===P.currentTarget&&r()()}hC();var B=USA(),c=_e(B),E=_e(c),D=St(_e(E),2),y=_e(D),S=_e(y),f=St(_e(S)),M=St(S,2),k=St(_e(M)),m=St(M,2),U=St(_e(m)),F=St(m,2);{var b=P=>{var j=GSA(),q=St(_e(j));dt(()=>Oi(q,` ${I()??""}`)),ue(P,j)};Kt(F,P=>{I()&&P(b)})}var K=St(F,2);{var R=P=>{var j=RSA(),q=St(_e(j));dt(()=>Oi(q,` ${n()??""}`)),ue(P,j)};Kt(K,P=>{n()&&P(R)})}var G=St(D,2),J=_e(G),x=St(J,2),H=St(x,2);dt(()=>{Oi(f,` ${e()??""}`),Oi(k,` ${i()??""}`),Oi(U,` ${g()??""}`)}),Uc("click",J,function(...P){var j;(j=o())==null||j.apply(this,P)}),Uc("click",x,function(...P){var j;(j=a())==null||j.apply(this,P)}),Uc("click",H,function(...P){var j;(j=r())==null||j.apply(this,P)}),Uc("click",B,s),ue(t,B),oi()}async function L$(t,A,e){const i=new Date,g=`test_${i.getTime()}_${AT()}`,I=`test_store_operation_session_${AT()}`,n={storeTransactionId:g,productIdentifier:t.identifier,purchaseDate:i},o=await A.postReceipt(e,t.identifier,g,t.presentedOfferingContext,"purchase");return{customerInfo:f$(o),redemptionInfo:null,operationSessionId:I,storeTransaction:n}}function bSA(t,A,e){const i=t.rcPackage.webBillingProduct,g=i.productType,I=i.freeTrialPhase,n=i.introPricePhase,o=i.price,a=r=>r?`${r.number} ${r.unit}${r.number>1?"s":""}`:"N/A";return new Promise((r,s)=>{var B;const c=document.createElement("div");document.body.appendChild(c);const E=()=>{D&&cR(D),document.body.removeChild(c)};let D=null;D=Tx(FSA,{target:c,props:{productIdentifier:i.identifier,productType:g,basePrice:o.formattedPrice,freeTrialPeriod:I?a(I.period):void 0,introPriceFormatted:(B=n?.price)==null?void 0:B.formattedPrice,onValidPurchase:async()=>{E();try{r(await L$(i,A,e))}catch(y){s(y)}},onFailedPurchase:()=>{E(),s(new xI(Un.ProductNotAvailableForPurchaseError,"Simulated test purchase failure: no real transaction occurred"))},onCancel:()=>{E(),s(new xI(Un.UserCancelledError))}}})})}class vSA{constructor(){ft(this,"virtualCurrenciesCache",new Map),ft(this,"CACHE_EXPIRY_MS",300*1e3)}invalidateAllCaches(){this.virtualCurrenciesCache.clear()}cacheVirtualCurrencies(A,e){this.virtualCurrenciesCache.set(A,{data:e,lastUpdatedAt:Date.now()})}getCachedVirtualCurrencies(A,e=!1){const i=this.virtualCurrenciesCache.get(A);return this.getCachedData(i??null,e)}invalidateVirtualCurrenciesCache(A){this.virtualCurrenciesCache.delete(A)}getCachedData(A,e=!1){return A?e?A.data:Date.now()-A.lastUpdatedAt>=this.CACHE_EXPIRY_MS?null:A.data:null}}function _SA(t){return{balance:t.balance,name:t.name,code:t.code,serverDescription:t.description??null}}function JSA(t){const A={};for(const[e,i]of Object.entries(t.virtual_currencies))A[e]=_SA(i);return{all:A}}const Ej="$RCAnonymousID:";var q$,ER;q$=[zyA];const am=class fr{constructor(A,e,i=$x,g=R_){aQA(ER,5,this),ft(this,"_API_KEY"),ft(this,"_appUserId"),ft(this,"_brandingInfo",null),ft(this,"_loadingResourcesPromise",null),ft(this,"_flags"),ft(this,"backend"),ft(this,"purchaseOperationHelper"),ft(this,"eventsTracker"),ft(this,"inMemoryCache"),this._API_KEY=A,this._appUserId=e,this._flags={...R_,...g},kU(A)?Mi.debugLog("Initializing Purchases SDK with Web billing sandbox API Key"):om(A)&&Mi.debugLog("Initializing Purchases SDK with RC Test store API Key."),this.eventsTracker=new kSA({apiKey:this._API_KEY,appUserId:this._appUserId,silent:!this._flags.collectAnalyticsEvents,rcSource:this._flags.rcSource??null}),this.backend=new PyA(this._API_KEY,i),this.inMemoryCache=new vSA,this.purchaseOperationHelper=new qEA(this.backend,this.eventsTracker),this.eventsTracker.trackSDKEvent({eventName:vr.SDKInitialized})}static setLogLevel(A){Mi.setLogLevel(A)}static setPlatformInfo(A){fr._platformInfo=A}static getPlatformInfo(){return fr._platformInfo}static getSharedInstance(){if(fr.isConfigured())return fr.instance;throw new JEA}static isConfigured(){return fr.instance!==void 0}static configure(A,e,i,g){fr.instance!==void 0&&Mi.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance.");let I;if(typeof A=="object"&&A!==null)I=A;else{if(typeof A!="string")throw new xI(Un.ConfigurationError,"API key must be provided as a string");if(typeof e!="string")throw new xI(Un.ConfigurationError,"App user ID must be provided as a string");I={apiKey:A,appUserId:e,httpConfig:i,flags:g}}return fr.configureInternal(I),fr.getSharedInstance()}static configureInternal(A){const{apiKey:e,appUserId:i,httpConfig:g,flags:I}=A,n=g??$x,o=I??R_;fr.validateConfig(A),fr.instance=new fr(e,i,n,o)}static validateConfig(A){var e,i;jyA(A.apiKey,A.flags),Bj(A.appUserId),ZyA((e=A.httpConfig)==null?void 0:e.proxyURL),WyA((i=A.httpConfig)==null?void 0:i.additionalHeaders)}async preload(){if(this.hasLoadedResources()){Mi.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){Mi.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.fetchAndCacheBrandingInfo().catch(A=>{let e=`${A}`;A instanceof xI&&(e=`${A.message}. ${A.underlyingErrorMessage?`Underlying error: ${A.underlyingErrorMessage}`:""}`),Mi.errorLog(`Error fetching branding info: ${e}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}async fetchAndCacheBrandingInfo(){if(om(this._API_KEY)){Mi.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(A){let e=A.htmlTarget??document.getElementById("rcb-ui-pw-root");if(e===null){const c=document.createElement("div");c.id="rcb-ui-pw-root",c.className="rcb-ui-pw-root",c.style.zIndex=`${$yA}`,document.body.appendChild(c),e=c}if(e===null)throw new Error("Could not generate a mount point for the billing widget");const i=e;i.innerHTML="";const g=A.offering;if(!g.paywall_components)throw new Error("You cannot use paywalls yet, they are coming soon!");const I=A.selectedLocale||navigator.language,n=new _F({},I,g.paywall_components.default_locale),o=c=>{var E;const D=g.availablePackages.find(y=>y.identifier===c);if(D===void 0)throw new Error(`No package found for ${c}`);return this.purchase({rcPackage:D,htmlTarget:A.purchaseHtmlTarget,customerEmail:A.customerEmail,selectedLocale:I,defaultLocale:((E=g.paywall_components)==null?void 0:E.default_locale)||wD})},a=c=>{var E;if(A.onNavigateToUrl){A.onNavigateToUrl(c);return}(E=window.open(c,"_blank"))==null||E.focus()},r=()=>{},s=()=>{if(A.onVisitCustomerCenter){A.onVisitCustomerCenter();return}},B=gSA(g,n);return new Promise((c,E)=>{Tx(ChA,{target:i,props:{paywallData:g.paywall_components,selectedLocale:I,onNavigateToUrlClicked:a,onVisitCustomerCenterClicked:s,onBackClicked:()=>{if(A.onBack){A.onBack();return}i.innerHTML="",Mi.debugLog("Purchase cancelled by user"),E(new xI(Un.UserCancelledError))},onRestorePurchasesClicked:r,onPurchaseClicked:D=>{o(D).then(y=>{c(y)}).catch(y=>E(y))},onError:D=>E(D),variablesPerPackage:B}})})}async getOfferings(A){QyA(A?.currency);const e=this._appUserId,i=await this.backend.getOfferings(e),g=A?.offeringIdentifier===K$.Current?i.current_offering_id:A?.offeringIdentifier;return g&&(i.offerings=i.offerings.filter(I=>I.identifier===g)),await this.getAllOfferings(i,e,A)}async getCurrentOfferingForPlacement(A,e){const i=this._appUserId,g=await this.backend.getOfferings(i),I=await this.getAllOfferings(g,i,e),n=g.placements??null;return n==null?null:VyA(n,I.all,A)}async getAllOfferings(A,e,i){const g=A.offerings.flatMap(n=>n.packages).map(n=>n.platform_product_identifier),I=await this.backend.getProducts(e,g,i?.currency);return this.logMissingProductIds(g,I.product_details),XyA(A,I)}async isEntitledTo(A){const e=await this.getCustomerInfo();return A in e.entitlements.active}purchasePackage(A,e,i){return this.purchase({rcPackage:A,customerEmail:e,htmlTarget:i})}async purchase(A){var e;const{rcPackage:i,purchaseOption:g,htmlTarget:I,customerEmail:n,selectedLocale:o=wD,defaultLocale:a=wD,skipSuccessPage:r=!1}=A;if(om(this._API_KEY)){const m=await bSA(A,this.backend,this._appUserId);return this.inMemoryCache.invalidateAllCaches(),m}let s=I??document.getElementById("rcb-ui-root");if(s===null){const m=document.createElement("div");m.className="rcb-ui-root",document.body.appendChild(m),s=m}if(s===null)throw new Error("Could not generate a mount point for the billing widget");const B=s,c=this._appUserId;Mi.debugLog(`Presenting purchase form for package ${i.identifier}`);const E=o||a,D=g??i.webBillingProduct.defaultPurchaseOption,y=ZdA({appearance:(e=this._brandingInfo)==null?void 0:e.appearance,rcPackage:i,purchaseOptionToUse:D,customerEmail:n});this.eventsTracker.trackSDKEvent(y);const S={...this._flags.autoCollectUTMAsMetadata?MSA():{},...A.metadata||{}};let f=null;const M=this._brandingInfo;M&&A.brandingAppearanceOverride&&(M.appearance=A.brandingAppearanceOverride);const k=I!==void 0;return new Promise((m,U)=>{k||window.history.pushState({checkoutOpen:!0},"");const F=this._flags.rcSource&&NSA.includes(this._flags.rcSource)?void 0:()=>{const b=zdA();this.eventsTracker.trackSDKEvent(b),window.removeEventListener("popstate",F),f&&cR(f),B.innerHTML="",Mi.debugLog("Purchase cancelled by user"),U(new xI(Un.UserCancelledError))};!k&&F&&window.addEventListener("popstate",F),f=Tx(EyA,{target:B,props:{isInElement:k,appUserId:c,rcPackage:i,purchaseOption:D,customerEmail:n,onFinished:async b=>{const K=WdA({redemptionInfo:b.redemptionInfo});this.eventsTracker.trackSDKEvent(K),this.inMemoryCache.invalidateAllCaches(),Mi.debugLog("Purchase finished"),f&&cR(f),B.innerHTML="";const R={customerInfo:await this._getCustomerInfoForUserId(c),redemptionInfo:b.redemptionInfo,operationSessionId:b.operationSessionId,storeTransaction:{storeTransactionId:b.storeTransactionIdentifier,productIdentifier:i.webBillingProduct.identifier,purchaseDate:b.purchaseDate}};m(R)},onClose:F,onError:b=>{var K;const R=VdA({errorCode:(K=b.errorCode)==null?void 0:K.toString(),errorMessage:b.message});this.eventsTracker.trackSDKEvent(R),f&&cR(f),B.innerHTML="",U(xI.getForPurchasesFlowError(b))},purchases:this,eventsTracker:this.eventsTracker,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,selectedLocale:E,metadata:S,defaultLocale:a,customTranslations:A.labelsOverride,skipSuccessPage:r}})})}async _postSimulatedStoreReceipt(A){return await L$(A,this.backend,this._appUserId)}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async setAttributes(A){return await this.getCustomerInfo(),await this.backend.setAttributes(this._appUserId,A)}async changeUser(A){return Bj(A),this._appUserId=A,this.eventsTracker.updateUser(A),this.inMemoryCache.invalidateAllCaches(),await this.getCustomerInfo()}logMissingProductIds(A,e){const i={};e.forEach(I=>i[I.identifier]=I);const g=[];A.forEach(I=>{i[I]===void 0&&g.push(I)}),g.length>0&&Mi.debugLog(`Could not find product data for product ids:
        ${g.join()}.
        Please check that your product configuration is correct.`)}isSandbox(){return kU(this._API_KEY)||om(this._API_KEY)}isAnonymous(){return this._appUserId.startsWith(Ej)}async getVirtualCurrencies(){return await this._getVirtualCurrenciesForUserId(this._appUserId)}getCachedVirtualCurrencies(){return this.inMemoryCache.getCachedVirtualCurrencies(this._appUserId,!0)}invalidateVirtualCurrenciesCache(){this.inMemoryCache.invalidateVirtualCurrenciesCache(this._appUserId)}close(){fr.instance===this?(this.eventsTracker&&this.eventsTracker.dispose(),fr.instance=void 0):Mi.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(A){const e=await this.backend.getCustomerInfo(A);return f$(e)}async _getVirtualCurrenciesForUserId(A){const e=this.inMemoryCache.getCachedVirtualCurrencies(A);if(e)return Mi.debugLog("Vending VirtualCurrencies from cache."),e;const i=await this.backend.getVirtualCurrencies(A),g=JSA(i);return Mi.debugLog("VirtualCurrencies updated from the network."),this.inMemoryCache.cacheVirtualCurrencies(A,g),g}static generateRevenueCatAnonymousAppUserId(){return`${Ej}${AT().replace(/-/g,"")}`}_trackEvent(A){this.eventsTracker.trackExternalEvent(A)}};ER=IQA(),rQA(ER,1,"purchase",q$,am),oQA(ER,am),ft(am,"_platformInfo"),ft(am,"instance");let Gm=am;function LSA(t,A){const e=String(A||"");if(t==="web"&&!e.startsWith("web_")&&!e.startsWith("rcb"))throw new Error('RevenueCat Web requires a Web Billing key (starts with "web_"). Set VITE_RC_API_KEY_WEB.');t==="ios"&&e.startsWith("appl_"),t==="android"&&e.startsWith("goog_")}function eT(t){const A=t==="web"?LCA:t==="ios"?xCA:qCA;if(!A)throw new Error(`RevenueCat SDK key missing for ${t}. Add VITE_RC_API_KEY_* and restart.`);return LSA(t,String(A)),String(A)}function x$(t){const A=(t??"").toString().trim();if(!A||A==="[Not provided]")throw new Error("Invalid appUserID for RevenueCat.");if(A.length>255)throw new Error("appUserID too long for RevenueCat (max 255).");return A}let Yl=null,eD=null,$D=null;function qSA(t){const A=(t??"").toString();return{length:A.length,empty:A.length===0}}function xSA(t){return t?String(t).slice(0,4):null}async function TSA(t){return Yl||eD||(eD=(async()=>{const A=Li.getPlatform();if(A==="web"){const i=eT("web");if(typeof Gm?.configure!="function")throw new Error("[RC] Web SDK load failed");try{await Gm.configure({apiKey:i,appUserId:t,observerMode:!1});try{MU()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Yl={platform:"web",Purchases:Gm},Yl}const e=eT(A==="ios"?"ios":"android");try{const g=(await pi(()=>import("./index-DbCnq2Df.js"),[],import.meta.url))?.Purchases;if(!g||typeof g.configure!="function")throw new Error("Capacitor Purchases plugin not available. Did you run `npx cap sync ios`?");try{await g.configure({apiKey:e,appUserID:t,observerMode:!1});try{MU()}catch{}}catch{throw new Error("Purchases are temporarily paused.")}return Yl={platform:"native",Purchases:g},Yl}catch(i){throw i}})().catch(A=>{throw eD=null,A}),eD)}async function iH(t){const A=x$(t),e=await TSA(A);if($D!==A){try{const i=e.Purchases;typeof i?.logIn=="function"&&(e.platform==="native"?await i.logIn({appUserID:A}):await i.logIn(A));try{MU()}catch{}}catch{}$D=A}return e}function Sr(){const t=Yl;if(!t?.Purchases){if(Li.getPlatform()==="web")try{const n=Gm;if(typeof n?.getSharedInstance=="function"){const o=n.getSharedInstance();if(o)return o}return null}catch{}return null}const A=Li.getPlatform(),e=t.Purchases;function i(I){const n=Object.create(I);return typeof I.getOfferings=="function"&&(n.getOfferings=async()=>{const o=A;let a=null;try{a=xSA(eT(o==="ios"?"ios":o==="android"?"android":"web"))}catch{}try{const r=await I.getOfferings(),s=r?.current?.identifier??r?.currentOfferingIdentifier??null,B=(r?.current?.availablePackages??r?.availablePackages??[]).length;return r}catch(r){let s;try{s=r?.getErrorCode?.()??r?.errorCode??r?.code}catch{}throw r?.message,r}}),n}if(A==="web"){if(typeof e.getSharedInstance=="function")try{const I=e.getSharedInstance();return i(I)}catch{return i(e)}return i(e)}const g=Object.create(e);return typeof e.purchasePackage=="function"&&(g.purchasePackage=I=>e.purchasePackage({aPackage:I})),i(g)}function MU(){Li.getPlatform(),qSA($D);try{er.getInfo().then(t=>{}).catch(()=>{})}catch{}}async function tD(){if(!$D)throw new Error("Cannot reconfigure RevenueCat before user identification.");return Yl=null,eD=null,iH($D)}async function T$(t){const A=x$(t),e=Yl;if(e)try{const i=e.Purchases;typeof i?.logIn=="function"&&(e.platform==="native"?await i.logIn({appUserID:A}):await i.logIn(A),$D=A)}catch(i){throw i}}const YSA=Object.freeze(Object.defineProperty({__proto__:null,getPurchases:Sr,initRevenueCat:iH,logRevenueCatConfig:MU,loginRevenueCat:T$,reconfigureRevenueCat:tD},Symbol.toStringTag,{value:"Module"})),wN="rc_anonymous_device_id";async function HSA(){if(Li.isNativePlatform())try{const{SecureStoragePlugin:A}=await pi(async()=>{const{SecureStoragePlugin:i}=await Promise.resolve().then(()=>dBA);return{SecureStoragePlugin:i}},void 0,import.meta.url);try{const{value:i}=await A.get({key:wN});if(i&&i.length>10)return i}catch{}const e=`anon_${crypto.randomUUID()}`;return await A.set({key:wN,value:e}),e}catch{}try{const A=localStorage.getItem(wN);if(A&&A.length>10)return A;const e=`anon_${crypto.randomUUID()}`;return localStorage.setItem(wN,e),e}catch{return`anon_ephemeral_${crypto.randomUUID()}`}}function uj(t){return t.startsWith("anon_")}const hj={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"ceelo",VITE_OTA:"1"},dj=VX,OSA=XX,PSA=$X,pj=B2,jSA=String(TCA).toLowerCase()==="true",uR={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 U_(t,A){try{const e=A?.getErrorCode?.()??A?.errorCode??A?.code,i=typeof e=="number"?uR[e]||`Code${e}`:"Unknown",g=A?.extra?.backendErrorCode??A?.extra?.code??A?.backendErrorCode,I=A?.underlyingErrorMessage||A?.nativeStack||A?.stack,n=A?.message||String(A);if(jSA){const o=A?.extra?{...A.extra}:void 0}}catch{}}const Y$=p.createContext({rc:null,ready:!1,error:null,isPremium:!1,anonymousBalance:null,buyChips:async()=>{},buySubscription:async()=>{},restorePurchases:async()=>{}});function ZSA({children:t}){const{user:A,refreshUser:e}=Yi(),[i,g]=p.useState(null),[I,n]=p.useState(!1),[o,a]=p.useState(null),[r,s]=p.useState(!1),[B,c]=p.useState(null),E=p.useRef(null),D=p.useCallback(()=>{try{e()}catch{}try{setTimeout(()=>{e().catch(()=>{})},1200)}catch{}},[e]);p.useEffect(()=>{let J=!1;return(async()=>{n(!1),a(null);try{const x=A?.id??await HSA(),H=E.current;if(A?.id&&H&&uj(H)&&H!==A.id)try{await T$(A.id),E.current=A.id;try{const O=hj?.VITE_API_URL||"",{getToken:$}=await pi(async()=>{const{getToken:sA}=await Promise.resolve().then(()=>pBA);return{getToken:sA}},void 0,import.meta.url),gA=await $(),X=await(await fetch(`${O}/api/account/merge-anonymous`,{method:"POST",headers:{"Content-Type":"application/json",...gA?{Authorization:`Bearer ${gA}`}:{}},credentials:"include",body:JSON.stringify({anonymousId:H})})).json().catch(()=>({}));X?.ok&&X?.mergedBalance>0}catch{}D()}catch{}const P=await iH(x);E.current=x;let j=!1;const q=1e3,Y=Date.now();for(;!J;){const $=Sr()||P?.Purchases;if($&&(typeof $.purchasePackage=="function"||typeof $.getOfferings=="function")){j=!0;break}if(Date.now()-Y>q)break;await new Promise(gA=>setTimeout(gA,50))}!j&&P?.platform==="web"&&(j=!0),J||(g(P),n(j))}catch(x){J||(a(x?.message||"Purchases are temporarily paused. Please try again later."),n(!1))}})(),()=>{J=!0}},[A?.id,D]);const y=p.useCallback(async()=>{try{const J=Sr();if(!J?.getCustomerInfo)return;const H=(await J.getCustomerInfo())?.entitlements?.active||{},P=Object.keys(H).length>0;let j=!1;pj&&(j=!!H?.[pj]||P),s(j)}catch{}},[]);p.useEffect(()=>{if(!I)return;y();const J=setInterval(y,6e4);return()=>clearInterval(J)},[I,y]);const S=p.useCallback(async()=>{if(A?.id){c(null);return}const J=E.current;if(!J||!uj(J)){c(null);return}try{const x=hj?.VITE_API_URL||"",P=await(await fetch(`${x}/api/account/anonymous-balance?id=${encodeURIComponent(J)}`)).json().catch(()=>({}));P?.ok&&typeof P.balance=="number"&&c(P.balance)}catch{}},[A?.id]);p.useEffect(()=>{I&&S()},[I,S]);const f=p.useCallback(J=>J?.all?.[dj]?J.all[dj]:J?.current||J?.all?.default||null,[]),M=p.useCallback(J=>{const x=[],H=j=>{if(Array.isArray(j))for(const q of j){const Y=q?.identifier||q?.product?.identifier;Y&&(x.find(O=>(O?.identifier||O?.product?.identifier)===Y)||x.push(q))}};H(J?.current?.availablePackages||J?.current?.packages);const P=J?.all||{};return Object.keys(P).forEach(j=>{H(P[j]?.availablePackages||P[j]?.packages)}),x},[]),k=J=>{const x=J?.packageType,H=J?.product?.type;return x==="MONTHLY"||x==="ANNUAL"||x==="SIX_MONTH"||x==="THREE_MONTH"||x==="TWO_MONTH"||H==="SUBSCRIPTION"||H==="AUTO_RENEWABLE_SUBSCRIPTION"||!!J?.product?.subscriptionPeriod},m=J=>{const x=J?.product?.type,H=J?.packageType;return!k(J)||x==="NON_SUBSCRIPTION"||x==="NON_CONSUMABLE"||H==="LIFETIME"},U=p.useCallback(J=>{const x=f(J),H=M(J);{const q=H.find(Y=>Y?.identifier===OSA);if(q)return q}{const q=H.find(Y=>Y?.product?.identifier===PSA);if(q)return q}const P=H.find(q=>m(q));if(P)return P;const j=x?.availablePackages||x?.packages||[];return Array.isArray(j)&&j.length>0?j[0]:H[0]||null},[M,f]),F=p.useCallback(J=>{const x=f(J),H=M(J),P=H.find(O=>O?.packageType==="MONTHLY")||H.find(O=>(O?.identifier||"").toLowerCase().includes("month"));if(P)return P;const j=H.find(O=>O?.packageType==="ANNUAL")||H.find(O=>(O?.identifier||"").toLowerCase().includes("year"));if(j)return j;const q=H.find(O=>k(O));if(q)return q;const Y=x?.availablePackages||x?.packages||[];return Array.isArray(Y)&&Y.length>0?Y[0]:H[0]||null},[M,f]),b=p.useCallback(async()=>{if(!I)throw new Error("RevenueCat not ready");let J=Sr();if(!J?.getOfferings||!J?.purchasePackage)try{await tD(),J=Sr()}catch{}if(!J?.getOfferings||!J?.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 x=await J.getOfferings(),H=U(x);if(!H)throw M(x),new Error("No chips product configured");try{try{await J.purchasePackage(H),D(),S()}catch(P){const j=String(P?.message||P);if(/already been destroyed/i.test(j))try{await tD();const q=Sr();if(!q?.purchasePackage)throw P;await q.purchasePackage(H),D(),S();return}catch{}throw P}}catch(P){U_("[RC] purchasePackage(chips)",P);const j=P?.getErrorCode?.()??P?.errorCode??P?.code,q=typeof j=="number"?uR[j]||`Code${j}`:"Unknown",Y=P?.extra?.backendErrorCode??P?.backendErrorCode,O=Y===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 (${q}${typeof j=="number"?` ${j}`:""}${Y?` | backend ${Y}`:""}).${O}`)}},[I,U,M,D,S]),K=p.useCallback(async()=>{if(!I)throw new Error("RevenueCat not ready");let J=Sr();if(!J?.getOfferings||!J?.purchasePackage)try{await tD(),J=Sr()}catch{}if(!J?.getOfferings||!J?.purchasePackage)throw new Error("Purchases not initialized");const x=await J.getOfferings(),H=F(x);if(!H)throw new Error("No subscription package available");try{try{await J.purchasePackage(H),D(),y()}catch(P){const j=String(P?.message||P);if(/already been destroyed/i.test(j))try{await tD();const q=Sr();if(!q?.purchasePackage)throw P;await q.purchasePackage(H),D(),y();return}catch{}throw P}}catch(P){U_("[RC] purchasePackage(subscription)",P);const j=P?.getErrorCode?.()??P?.errorCode??P?.code,q=typeof j=="number"?uR[j]||`Code${j}`:"Unknown",Y=P?.extra?.backendErrorCode??P?.backendErrorCode,O=Y===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 (${q}${typeof j=="number"?` ${j}`:""}${Y?` | backend ${Y}`:""}).${O}`)}},[I,F,D,y]),R=p.useCallback(async()=>{if(!I)throw new Error("RevenueCat not ready");let J=Sr();if(!J?.getCustomerInfo||!J?.syncPurchases)try{await tD(),J=Sr()}catch{}try{const x=await J?.getCustomerInfo?.();if(!J?.syncPurchases)throw new Error("Restore Purchases not initialized");await J?.syncPurchases(),D(),y(),S()}catch(x){U_("[RC] restorePurchases",x);const H=x?.getErrorCode?.()??x?.errorCode??x?.code,P=typeof H=="number"?uR[H]||`Code${H}`:"Unknown",j=x?.extra?.backendErrorCode??x?.backendErrorCode;throw new Error(`Restore failed (${P}${typeof H=="number"?` ${H}`:""}${j?` | backend ${j}`:""}).`)}},[I,D,y,S]),G=p.useMemo(()=>({rc:i,ready:I,error:o,isPremium:r,anonymousBalance:B,buyChips:b,buySubscription:K,restorePurchases:R}),[i,I,o,r,B,b,K,R]);return Q.jsx(Y$.Provider,{value:G,children:t})}function H$(){return p.useContext(Y$)}function WSA({viral:t,onClose:A}){return t?Q.jsx("div",{className:"viral-container",children:Q.jsxs("div",{className:"viral-content",children:[Q.jsx("img",{src:t.preview,alt:"Preview",className:"viral-preview",style:{width:t.width,height:t.height}}),Q.jsx("video",{src:t.url,autoPlay:!0,loop:!0,muted:!0,className:"viral-video",style:{width:t.width,height:t.height}})]})}):null}const gH=""+new URL("avatars-BLAbFok_.webp",import.meta.url).href,IH=""+new URL("avatars2-BhCQ9Hmk.webp",import.meta.url).href,nH=""+new URL("bikini_avatars-D9_A_byG.webp",import.meta.url).href,oH=""+new URL("bikini_avatars2-CqEDCn9Y.webp",import.meta.url).href,aH=""+new URL("car_avatars-C2asmsaV.webp",import.meta.url).href,rH=""+new URL("cowboy_avatars-Dh4o-H8O.webp",import.meta.url).href,sH=""+new URL("surf_avatars-BNzNQWcq.webp",import.meta.url).href,CH=""+new URL("surf_avatars2-CP3KwVoE.webp",import.meta.url).href,BH=""+new URL("toy_avatars-CYoTJdP7.webp",import.meta.url).href,O$="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",P$="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",j$="data:image/svg+xml,%3csvg%20xmlns='http://www.w3.org/2000/svg'%20viewBox='0%200%20512%20512'%20style='height:%20512px;%20width:%20512px;'%3e%3cg%20class=''%20transform='translate(0,0)'%20style=''%3e%3cpath%20d='M74.5%2036A38.5%2038.5%200%200%200%2036%2074.5v363A38.5%2038.5%200%200%200%2074.5%20476h363a38.5%2038.5%200%200%200%2038.5-38.5v-363A38.5%2038.5%200%200%200%20437.5%2036h-363zm316.97%2036.03A50%2050%200%200%201%20440%20122a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97zM256%20206a50%2050%200%200%201%200%20100%2050%2050%200%200%201%200-100zM123.47%20340.03A50%2050%200%200%201%20172%20390a50%2050%200%200%201-100%200%2050%2050%200%200%201%2051.47-49.97z'%20fill='%23fff'%20fill-opacity='1'%3e%3c/path%3e%3c/g%3e%3c/svg%3e",Z$="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",W$="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",z$="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",zSA=0,VSA=2500,Zn={diceRevealDelayMs:zSA,diceSettleClientMs:VSA,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},NU=[gH,IH,nH,oH,aH,rH,sH,CH,BH];function XSA(t){if(!t||!t.startsWith("sprite:"))return null;const A=t.slice(7).split("/"),e=Number(A[0]),i=Number(A[1]);return!Number.isFinite(e)||!Number.isFinite(i)||e<0||e>=NU.length?null:{sheetIdx:e,tile:i%6}}function $SA(t){let A=0;for(let e=0;e<t.length;e++)A=A*31+t.charCodeAt(e)>>>0;return A%(NU.length*6)}function AwA(t,A){const e=XSA(t);if(e){const{sheetIdx:f,tile:M}=e,k=NU[f],m=2,U=3,F=M%m,b=Math.floor(M/m),K=m*100,R=f===4?400:U*100,G=K/100,J=R/100,x=F/(G-1)*100,H=f===8?b*37:J>1?b/(J-1)*100:0;return Q.jsx("span",{className:"flash-avatar__sprite",style:{backgroundImage:`url(${k})`,backgroundSize:`${K}% ${R}%`,backgroundPosition:`${x}% ${H}%`},"aria-hidden":!0})}if(t)return Q.jsx("img",{src:t,alt:A,className:"flash-avatar__img"});const i=$SA(A),g=Math.floor(i/6),I=i%6,n=NU[g],o=2,a=3,r=I%o,s=Math.floor(I/o),B=o*100,c=g===4?400:a*100,E=B/100,D=c/100,y=r/(E-1)*100,S=g===8?s*37:D>1?s/(D-1)*100:0;return Q.jsx("span",{className:"flash-avatar__sprite",style:{backgroundImage:`url(${n})`,backgroundSize:`${B}% ${c}%`,backgroundPosition:`${y}% ${S}%`},"aria-hidden":!0})}const ewA={1:O$,2:P$,3:j$,4:Z$,5:W$,6:z$};function V$(t){const A=/[⚀⚁⚂⚃⚄⚅]+/,e=t.match(A);if(!e)return t;const i=e[0],g=t.slice(e.index+i.length).trim(),I=[...i].map(n=>n.codePointAt(0)-9855);return Q.jsxs("span",{className:"flash-dice-result",children:[Q.jsx("span",{className:"flash-dice-faces",children:I.map((n,o)=>Q.jsx("img",{src:ewA[n],alt:`Dice ${n}`,className:"flash-die-face"},o))}),g&&Q.jsx("span",{className:"flash-dice-label",children:g})]})}let mN=null;async function X$(){if(mN)return mN;const t=await pi(()=>import("./lottie-CFSZLqZ9.js").then(A=>A.l),[],import.meta.url);return mN=t?.default&&t.default.loadAnimation?t.default:t,mN}let kN=null,MN=null;async function tT(t){if(t==="win"&&kN)return kN;if(t==="lose"&&MN)return MN;if(t==="win"){const A=await pi(()=>import("./winning-lottie-NODzSKgp.js"),[],import.meta.url);return kN=A.default||A,kN}else{const A=await pi(()=>import("./lose-lottie-DRt9PYrq.js"),[],import.meta.url);return MN=A.default||A,MN}}const cH=p.createContext(null),twA={win:void 0,lose:void 0,push:void 0,roll:void 0,info:void 0},iwA=typeof window<"u"&&window.requestIdleCallback||(t=>setTimeout(t,50));function gwA(){if(typeof navigator>"u")return!1;const t=navigator.userAgent||"",A=navigator;return/iP(ad|hone|od)/.test(t)||A.platform==="MacIntel"&&A.maxTouchPoints>1}function fj(){iwA(async()=>{try{await X$(),await Promise.allSettled([tT("win"),tT("lose")])}catch{}})}function Dj(){try{const t=document?.body,A=!!t?.classList?.contains("page-poker-room"),e=!!document.querySelector(".mode-craps"),i=!!(t?.classList?.contains("page-gameroom")&&!e);return{isPoker:A,isCraps:e,isCeeLo:i}}catch{return{isPoker:!1,isCraps:!1,isCeeLo:!1}}}function IwA(t,A,e,i){return typeof A=="boolean"?A:i?!1:t==="lose"&&typeof e!="number"}function nwA(t,A){if(!t)return!1;const e=t.kind==="roll"&&typeof t.title=="string"&&/\bpoint\b/i.test(t.title||"");return t.kind==="roll"&&typeof t.title=="string"&&/\bbanker\b/i.test(t.title||"")&&/\bpoint\b/i.test(t.title||""),A.isPoker||A.isCraps&&(t.kind==="win"||t.kind==="lose"||e)||A.isCeeLo&&(t.kind==="win"||t.kind==="lose"||t.kind==="push")}function owA(){try{return document.querySelector(".card.player-panel, .card.craps-player-panel, .card.skills-player-panel")}catch{return null}}function K_(t){return typeof t!="string"?t:/[⚀⚁⚂⚃⚄⚅]/.test(t)?V$(t):$$(t)}function $$(t){if(typeof t!="string")return t;const A=t,e=[];let i=0;for(let g=0;g<A.length;g++){const I=A[g];if(I==="Z"||I==="z"){let n=g+1;for(;n<A.length&&(A[n]===" "||A[n]===" "||A[n]===" ");)n++;if(n<A.length&&/\d/.test(A[n])){e.push(Q.jsx("span",{style:{textTransform:"none"},children:"z"},`z-${g}-${i++}`));continue}}e.push(I)}return Q.jsx(Q.Fragment,{children:e})}function awA(){p.useEffect(()=>{if(fj(),typeof window>"u")return;const t=()=>{fj(),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 rwA(t,A,e){p.useEffect(()=>{if(typeof A!="number"||A<0)return;const i=window.setTimeout(()=>e(),A);return()=>window.clearTimeout(i)},[A,e])}function swA(t){p.useEffect(()=>{let A=!1;const e=async()=>{try{if(!N2())try{await Cg()}catch{}const g=t==="win"?["winDing","win"]:t==="lose"?["lose"]:t==="push"?["push"]:[];if(g.length){try{ZD(g)}catch{}try{await sU(g,600)}catch{}}if(A)return;t==="lose"?FlA({volume:.06}):t==="win"?vlA({volume:.25}):t==="push"&&blA({volume:.04})}catch{}},i=window.setTimeout(()=>{e()},10);return()=>{A=!0,window.clearTimeout(i)}},[t])}function CwA(t){const{enabled:A,kind:e,targetRef:i,animationData:g,fallbackMap:I,isIOS:n,onComplete:o}=t,a=p.useRef(null);p.useEffect(()=>{if(!A||e!=="win"&&e!=="lose")return;let r=!1;return(async()=>{try{const s=await X$(),B=g||(e?I[e]:void 0)||await tT(e);if(r||!i.current||!B)return;a.current=s.loadAnimation({container:i.current,renderer:n?"canvas":"svg",autoplay:!0,loop:!1,animationData:B,subframe:!1,rendererSettings:{progressiveLoad:!0,hideOnTransparent:!0,preserveAspectRatio:"xMidYMid meet",dpr:Math.min(window.devicePixelRatio||1,1.5)}}),o&&a.current.addEventListener("complete",o)}catch{}})(),()=>{r=!0;try{o&&a.current&&a.current.removeEventListener?.("complete",o),a.current?.destroy()}catch{}a.current=null,i.current&&(i.current.innerHTML="")}},[A,e,g,I,n,o,i])}function BwA({item:t,onDone:A,animations:e,zIndex:i}){const g=p.useRef(null),I=p.useRef(null),[n,o]=p.useState("enter"),a=p.useRef(!1),r=p.useCallback(()=>{a.current||(a.current=!0,A(t.id))},[A,t.id]),s=p.useCallback(()=>{o("leave"),window.setTimeout(r,320)},[r]);swA(t.kind),rwA(t.id,t.duration,s);const B=p.useMemo(gwA,[]),c=t.kind==="win"||t.kind==="lose";CwA({enabled:c,kind:t.kind,targetRef:I,animationData:t.animationData,fallbackMap:e,isIOS:B,onComplete:c&&t.autoDismissOnComplete?()=>{s()}:void 0});const E=t.title&&typeof t.title=="string"&&t.title.includes(":")?(()=>{const y=t.title.indexOf(":"),S=t.title.slice(0,y).trim(),f=t.title.slice(y+1).trim();return Q.jsxs(Q.Fragment,{children:[Q.jsx("span",{className:"flash-title__name",children:S}),Q.jsx("span",{className:"flash-title__rest",children:K_(f)})]})})():Q.jsx("span",{children:$$(t.title)}),D=typeof t.title=="string"&&/\bbanker\b/i.test(t.title)?{opacity:.9}:void 0;return Q.jsxs("div",{ref:g,className:["flash-card",`flash-${t.kind??"info"}`,n==="leave"?"leave":n==="steady"?"steady":"enter"].join(" "),role:"status","data-testid":"flash-card","data-flash-kind":t.kind??"info",onClick:()=>t.dismissible&&s(),onAnimationEnd:y=>{y.target===g.current&&(n==="enter"&&o("steady"),n==="leave"&&r())},onTransitionEnd:y=>{y.target===g.current&&n==="leave"&&r()},style:{pointerEvents:"auto",zIndex:i},children:[(t.kind==="lose"||t.kind==="win")&&Q.jsx("div",{className:"flash-lottie",ref:I}),t.icon&&Q.jsx("div",{className:"flash-icon","aria-hidden":!0,children:t.icon}),Q.jsxs("div",{className:"flash-body",children:[t.title&&Q.jsx("div",{className:"flash-title"+(typeof t.title=="string"&&/\bbanker\b/i.test(t.title)?" flash-title--banker":""),"data-testid":"flash-title",style:D,children:E}),t.subtitle&&Q.jsx("div",{className:"flash-subtitle","data-testid":"flash-subtitle",children:typeof t.subtitle=="string"&&t.subtitle.includes(`
`)?t.subtitle.split(`
`).map((y,S)=>{const f=y.indexOf(":");if(f>0){const M=y.slice(0,f).trim(),k=y.slice(f+1).trim(),m=t.playerAvatars?.[S];return Q.jsxs("span",{className:"flash-subtitle__player",children:[Q.jsx("span",{className:"flash-avatar",children:AwA(m?.avatarUrl,M)}),Q.jsx("strong",{className:"flash-subtitle__name",children:M}),Q.jsx("span",{className:"flash-subtitle__result",children:V$(k)})]},S)}return Q.jsx("span",{children:K_(y)},S)}):K_(t.subtitle)}),t.viral&&Q.jsx(WSA,{viral:t.viral,onClose:()=>{}})]})]})}function cwA({children:t,baseDurationMs:A=Zn.flash.baseMs}){const[e,i]=p.useState([]),g=p.useRef(new Set),I=p.useRef({...twA});awA();const n=p.useCallback(c=>{i(E=>E.filter(D=>D.id!==c))},[]),o=p.useCallback(()=>{i([])},[]),a=p.useCallback(c=>{I.current={...I.current,...c}},[]),r=p.useCallback(c=>{const E=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,y=(typeof document<"u"?Dj():{isCeeLo:!1}).isCeeLo,S=typeof c.duration=="number"?c.duration:y&&(c.kind==="win"||c.kind==="lose")?Zn.flash.ceeLoShortMs:c.kind==="win"?Zn.flash.winMs:A,f={id:E,dismissible:!0,autoDismissOnComplete:IwA(c.kind,c.autoDismissOnComplete,c.duration,y),...c,duration:S};y&&!f.subtitle&&(f.kind==="win"||f.kind==="lose"||f.kind==="push")&&(f.kind==="push"?f.subtitle="No Action":f.subtitle=f.kind==="win"?"You win this round":"You lose this round");try{const M=typeof location<"u"?new URLSearchParams(location.search):null;if(M&&M.get("flashDebug")==="1")try{localStorage.setItem("debug:flashes","1")}catch{}const m=!!(typeof window<"u"?window:void 0)?.FLASH_DEBUG||typeof localStorage<"u"&&localStorage.getItem("debug:flashes")==="1"}catch{}if(c.kind==="info"||c.kind==="roll")try{rd({volume:.15})}catch{}return i(M=>[...M,f]),E},[A]);p.useEffect(()=>{if(e.length!==0||!g.current.size)return;const c=Array.from(g.current);g.current.clear(),c.forEach(E=>{try{E()}catch{}})},[e.length]);const s=p.useMemo(()=>({show:r,roll:(c,E)=>r({kind:"roll",title:c,subtitle:E}),rollNow:(c,E)=>r({kind:"roll",title:c,subtitle:E}),win:(c,E,D,y,S)=>(pi(()=>import("./InAppReviewService-CCwmDugv.js"),[],import.meta.url).then(f=>f.maybePromptReview()).catch(()=>{}),r({kind:"win",title:c,subtitle:E,viral:D,animationData:y,...S})),lose:(c,E,D,y,S)=>r({kind:"lose",title:c,subtitle:E,viral:D,animationData:y,...S}),push:(c,E,D,y,S)=>r({kind:"push",title:c,subtitle:E,viral:D,animationData:y,...S}),info:(c,E)=>r({kind:"info",title:c,subtitle:E}),infoNow:(c,E)=>r({kind:"info",title:c,subtitle:E}),dismiss:n,clear:o,setFlashAnimations:a,activeKind:e.length?e[e.length-1]?.kind:void 0,hasActive:e.length>0,onIdle:c=>{e.length===0?setTimeout(c,0):g.current.add(c)}}),[r,n,o,a,e.length]),B=p.useMemo(()=>{if(typeof document>"u")return null;const c=Dj(),E=owA();return e.map((D,y)=>{const f=nwA(D,c)&&E?E:document.body,M=f!==document.body,k=M&&c.isCeeLo&&(D.kind==="win"||D.kind==="lose"||D.kind==="push")&&(D.playerAvatars?.length??0)>=2,m=M&&c.isCeeLo&&(D.kind==="win"||D.kind==="lose"||D.kind==="push"),U=2e3+y;return Zc.createPortal(Q.jsxs("div",{className:"flash-root"+(M?" flash-root--header":"")+(k?" flash-root--inline":"")+(m?" flash-root--ceelo":""),"aria-live":"polite","data-testid":"flash-overlay-root",children:[Q.jsx(BwA,{item:D,onDone:n,animations:I.current,zIndex:U}),Q.jsx("div",{className:"flash-backdrop"})]},D.id),f)})},[e,n]);return p.useEffect(()=>{},[r]),Q.jsxs(cH.Provider,{value:s,children:[t,B]})}function qr(){const t=p.useContext(cH);if(!t)throw new Error("useFlashOverlay must be used within <FlashOverlayProvider>");return t}function lH(){const t=p.useContext(cH);if(t)return t;const A=()=>{},e=()=>"";return{show:e,roll:e,rollNow:A,win:A,lose:A,push:A,info:A,infoNow:A,dismiss:A,clear:A,setFlashAnimations:A,activeKind:void 0,hasActive:!1,onIdle:A}}const yj=VX,lwA=XX,QwA=$X,EwA=jCA,Sj=B2;function Rk(){const{user:t,refreshUser:A}=Yi(),{rc:e,ready:i,error:g,buyChips:I,buySubscription:n,restorePurchases:o}=H$(),{infoNow:a}=qr(),[r,s]=p.useState(!1),[B,c]=p.useState(!1),[E,D]=p.useState(!1),[y,S]=p.useState(!1),[f,M]=p.useState(!1),[k,m]=p.useState(void 0),[U,F]=p.useState(void 0),[b,K]=p.useState(void 0),[R,G]=p.useState(void 0),[J,x]=p.useState(void 0),[H,P]=p.useState(void 0),[j,q]=p.useState(!1),Y=Li.getPlatform()==="web",O=Ea(),$=!0,gA=p.useMemo(()=>e?.Purchases,[e]);p.useCallback(IA=>IA?.all?.[yj]?IA.all[yj]:IA?.current||IA?.all?.default||null,[]);const z=p.useCallback(async()=>{try{const uA=await Sr()?.getCustomerInfo?.();let KA=!1;const FA=uA?.entitlements?.active||{},RA=Object.keys(FA).length>0;Sj&&(KA=!!FA?.[Sj]||RA),M(KA)}catch{}},[gA,$]);p.useEffect(()=>{i&&$&&z()},[i,$,z]),p.useEffect(()=>{if(!i||!$)return;let IA=0;const uA=6,KA=setInterval(()=>{IA+=1,z(),IA>=uA&&clearInterval(KA)},500);return()=>clearInterval(KA)},[i,$,z]),p.useEffect(()=>{let IA=!1;return(async()=>{try{if(!i||!$)return;const KA=await Sr()?.getOfferings?.();if(!KA)return;const FA=[],RA=NA=>{Array.isArray(NA)&&NA.forEach(OA=>{OA&&FA.push(OA)})};RA(KA?.current?.availablePackages||KA?.current?.packages),KA?.all&&Object.values(KA.all).forEach(NA=>RA(NA?.availablePackages||NA?.packages));const MA=NA=>NA?.identifier||NA?.product?.identifier||NA?.rcBillingProduct?.identifier||NA?.webBillingProduct?.identifier,oA=NA=>NA?.product||NA?.rcBillingProduct||NA?.webBillingProduct||NA,AA=NA=>{const OA=oA(NA);return!!(NA?.packageType==="MONTHLY"||NA?.packageType==="ANNUAL"||OA?.subscriptionPeriod||OA?.period||OA?.defaultSubscriptionOption||OA?.productType&&/subscription/i.test(String(OA.productType)))},tA=NA=>NA?.priceString||NA?.price?.formattedPrice||NA?.currentPrice?.formattedPrice||NA?.price||NA?.defaultPurchaseOption?.basePrice?.formattedPrice,iA=NA=>String(NA?.title||NA?.displayName||""),hA=NA=>String(NA?.description||""),DA=NA=>NA?FA.find(OA=>MA(OA)===NA):void 0;let dA=DA(lwA)||DA(QwA);if(dA||(dA=FA.find(NA=>!AA(NA))),dA){const NA=oA(dA),OA=tA(NA),Qe=iA(NA),nA=hA(NA),eA=String(MA(dA)||""),UA=de=>{const te=de.match(/\b(\d{1,3}(?:[\,\._\s]\d{3})*|\d{2,})\b/);if(!te)return null;const WA=te[1].replace(/[\._\s,]/g,""),_A=parseInt(WA,10);return Number.isFinite(_A)?_A:null},HA=UA(Qe)??UA(nA)??UA(eA),Se=HA&&HA>0?HA:void 0,ne=Se?new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Se):void 0,Oe=ne?`z${ne}`:"Z Credits",VA=OA?`${Oe} for ${OA}`:void 0;IA||m(VA),IA||K("Top up your Z Credits to keep playing.")}let SA=DA(EwA);if(SA||(SA=FA.find(Qe=>Qe?.packageType==="MONTHLY"||/month/i.test(String(MA(Qe)||""))||/month/i.test(iA(oA(Qe))))||FA.find(Qe=>AA(Qe)||/year|annual|week|month/i.test(String(MA(Qe)||"")))),IA||q(!!SA),SA){const NA=oA(SA),OA=tA(NA),Qe=OA?`${OA} Mo`:void 0;if(IA||F(Qe),IA||G("Remove ads and unlock premium features."),IA||x(OA),!IA){let nA="Auto-renewing";const eA=SA?.packageType||NA?.subscriptionPeriod||NA?.period||NA?.defaultSubscriptionOption?.period,UA=String(eA||"").toUpperCase();UA.includes("MONTH")||UA==="MONTHLY"||UA==="P1M"?nA="Monthly":UA.includes("YEAR")||UA==="ANNUAL"||UA==="P1Y"?nA="Annual":UA.includes("WEEK")||UA==="WEEKLY"||UA==="P1W"?nA="Weekly":(UA.includes("DAY")||UA==="P1D")&&(nA="Daily"),P(nA)}}}catch{}})(),()=>{IA=!0}},[i,$,gA]);const X=async()=>{if(!r){if(s(!0),c(!0),!i){a("Purchases initializing…","Please try again in a moment."),c(!1),s(!1);return}try{await I(),a("Purchase complete","Chips will appear shortly.")}catch(IA){let uA=IA?.message||"Purchase unavailable right now. Please try again shortly.";try{const KA=IA?.getErrorCode?.()??IA?.errorCode??IA?.code,FA=typeof KA=="number"?KA===3?"PurchaseNotAllowedError":KA===2?"StoreProblemError":KA===5?"ProductNotAvailableForPurchaseError":void 0:void 0;FA==="PurchaseNotAllowedError"?uA="Purchases not allowed for this Apple ID/device. Use an App Store sandbox account and ensure the Paid Apps Agreement is accepted.":FA==="StoreProblemError"?uA="App Store is currently unavailable. Please try again later or verify sandbox account is signed in to the device.":FA==="ProductNotAvailableForPurchaseError"&&(uA="Product not available. Verify the product identifier matches App Store Connect and RevenueCat configuration for this app target.")}catch{}a("Purchase failed",uA)}finally{c(!1),s(!1)}}},sA=async()=>{if(!r){if(s(!0),D(!0),!i){try{a("Purchases initializing…","Please try again in a moment.")}catch{}try{await(await pi(async()=>{const{reconfigureRevenueCat:IA}=await Promise.resolve().then(()=>YSA);return{reconfigureRevenueCat:IA}},void 0,import.meta.url)).reconfigureRevenueCat()}catch{}D(!1),s(!1);return}try{await n(),await z(),a("Subscription active","Thanks for supporting.")}finally{D(!1),s(!1)}}},rA=async()=>{if(!r){if(s(!0),S(!0),!i)throw new Error("Payment service not ready");await o(),await z();try{const IA=await Nn();IA&&await fetch(`${O}/api/payment/revenuecat/restore`,{method:"POST",headers:{Authorization:`Bearer ${IA}`}})}catch{}try{await A()}catch{}try{setTimeout(()=>{A().catch(()=>{})},800)}catch{}try{setTimeout(()=>{A().catch(()=>{})},2e3)}catch{}a("Restored purchases","Your purchases have been restored."),S(!1),s(!1)}},mA=p.useMemo(()=>!i||!$?"Initializing…":f?"Premium Active":"Go Premium",[f,i,$]);return{ready:i,error:g||null,busy:r,busyChips:B,busySubscription:E,premiumActive:f,hasPremiumPackage:j,premiumLabel:mA,purchasesReady:$,isWeb:Y,onBuyChips:X,onGoPremium:sA,onRestore:rA,chipsSubtitle:k,premiumSubtitle:U,chipsDescription:b,premiumDescription:R,premiumPrice:J,premiumInterval:H}}var Rm;(function(t){t.Heavy="HEAVY",t.Medium="MEDIUM",t.Light="LIGHT"})(Rm||(Rm={}));var wj;(function(t){t.Success="SUCCESS",t.Warning="WARNING",t.Error="ERROR"})(wj||(wj={}));const rm=mB("Haptics",{web:()=>pi(()=>import("./web-D2Sw8Kz1.js"),[],import.meta.url).then(t=>new t.HapticsWeb)}),uwA={Light:Rm.Light,Medium:Rm.Medium,Heavy:Rm.Heavy},hwA={Light:10,Medium:20,Heavy:35};async function Xa(t="Light"){try{await rm.impact({style:uwA[t]});return}catch{}try{navigator.vibrate?.(hwA[t])}catch{}}function xt(t="Light"){Xa(t)}async function AAA(){try{if(rm?.selectionStart){await rm.selectionStart(),await rm.selectionChanged(),await rm.selectionEnd();return}}catch{}await Xa("Light")}const iT=Object.freeze(Object.defineProperty({__proto__:null,hapticClick:xt,hapticImpact:Xa,hapticSelection:AAA},Symbol.toStringTag,{value:"Module"}));function QH({isPremium:t,className:A}){const[e,i]=p.useState(!1),{onGoPremium:g,busy:I,ready:n,purchasesReady:o}=Rk();if(!t)return null;const a=async()=>{try{i(!0);try{xt("Light")}catch{}await g()}finally{i(!1)}};return Q.jsx("button",{className:A||"felt-btn","data-no-global-haptic":!0,onClick:a,disabled:e||I||!n||!o,"aria-busy":e||I,title:"Manage your subscription",children:e||I?"Processing…":"Manage"})}function EH({open:t,onClose:A,featureDescription:e}){const{user:i}=Yi(),{onGoPremium:g,onRestore:I,busy:n,premiumActive:o,hasPremiumPackage:a,premiumLabel:r,error:s,ready:B,purchasesReady:c,premiumPrice:E,premiumInterval:D}=Rk(),y=Di(),{infoNow:S}=qr(),f=async()=>{if(!i?.id){try{y("/login")}catch{}try{A?.()}catch{}return}if(!(o||n))try{if(await g(),!o)return;A()}catch(m){const U=m?.message||"Purchases are initializing… please try again in a moment.";try{S("Purchase unavailable",U)}catch{}}};if(!t)return null;const M=!!i?.id,k="$1.99";return Q.jsx("div",{className:"modal-overlay",children:Q.jsxs("div",{className:"modal",children:[Q.jsx("button",{className:"modal-close","aria-label":"Close",onClick:A,children:"×"}),Q.jsx("h3",{children:o?"Premium Active":`Go Premium for ${k}/mo!`}),Q.jsx("p",{children:o?"Your premium membership is active.":e||"Creating rooms is a premium feature. Upgrade to unlock it and more."}),!o&&a&&Q.jsx("button",{className:"gold-btn felt-btn",onClick:f,disabled:n,children:M?n?"Processing…":r:"Sign in to Upgrade"}),o&&Q.jsx("div",{style:{marginTop:12},children:Q.jsx(QH,{isPremium:!0})}),!o&&a&&Q.jsxs("p",{className:"meta",style:{fontSize:12,opacity:.85},children:[Q.jsx("strong",{children:"Premium Subscription"})," — ",E?`${E} `:k+" ",D?`(${D})`:"(Monthly)",". Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",Q.jsx(Yo,{to:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",Q.jsx(Yo,{to:"/terms",className:"legal-link",children:"Terms of Use"}),"."]}),s&&Q.jsx("p",{className:"error",role:"alert",children:s}),!o&&a&&Q.jsx("div",{style:{marginTop:8},children:Q.jsx("button",{type:"button",className:"gold-link",onClick:I,disabled:!M||n||!B||!c,"aria-label":"Restore Purchases",title:"Restore Purchases",children:"Restore Purchases"})}),!M&&!o&&Q.jsx("p",{className:"meta",children:"Please sign in to upgrade."}),!M&&s&&Q.jsx("p",{className:"meta",children:"Purchases unavailable while signed out."})]})})}let Ef=null,mj=0;const dwA=3e4;function pwA(){const{user:t}=Yi(),[A,e]=p.useState(Ef),[i,g]=p.useState(!1),[I,n]=p.useState(!1),o=Ea(),a=p.useCallback(async(s=!1)=>{if(t){if(!s&&Ef&&Date.now()-mj<dwA){e(Ef);return}g(!0);try{const B=await Nn(),E=await(await fetch(`${o}/api/challenges/daily`,{credentials:"include",headers:{...B?{Authorization:`Bearer ${B}`}:{},Accept:"application/json"}})).json();E?.ok&&E?.data&&(Ef=E.data,mj=Date.now(),e(Ef))}catch{}finally{g(!1)}}},[t,o]),r=p.useCallback(async()=>{if(!t||I)return null;n(!0);try{const s=await Nn(),c=await(await fetch(`${o}/api/challenges/daily/claim`,{method:"POST",credentials:"include",headers:{...s?{Authorization:`Bearer ${s}`}:{},Accept:"application/json","Content-Type":"application/json"}})).json();return c?.ok?(Ef=null,await a(!0),c.data):null}catch{return null}finally{n(!1)}},[t,I,o,a]);return p.useEffect(()=>{t&&a()},[t,a]),{data:A,loading:i,claiming:I,refresh:a,claim:r}}function uH({open:t,onClose:A,title:e,tagline:i,steps:g,primaryLabel:I,persistKey:n="seenOnboardingV1",secondaryLabel:o="Log In",onSecondary:a,targetSelector:r=".home-mode-toggle-row",coachText:s="Pick a game mode"}){const B=Di(),{user:c,loading:E}=Yi(),D=p.useMemo(()=>{if(E)return!1;const m=c?.email||"";return!m||/@guest\.local$/i.test(m)},[c?.email,E]),y=p.useCallback(()=>{try{n&&nr.set({key:n,value:"1"})}catch{}A()},[A,n]);p.useEffect(()=>{if(!t)return;function m(U){U.key==="Escape"&&y()}return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[t,y]);const[S,f]=p.useState(null),M=p.useCallback(()=>{try{if(!t){f(null);return}const m=r?document.querySelector(r):null;if(!m){f(null);return}const U=m.getBoundingClientRect();f({top:U.top,left:U.left,width:U.width,height:U.height})}catch{f(null)}},[t,r]);if(p.useLayoutEffect(()=>{M()},[M]),p.useEffect(()=>{if(!t)return;const m=()=>M(),U=()=>M();window.addEventListener("resize",m),window.addEventListener("scroll",U,!0);const F=setInterval(M,400);return()=>{window.removeEventListener("resize",m),window.removeEventListener("scroll",U,!0),clearInterval(F)}},[t,M]),p.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}})()&&(n&&nr.set({key:n,value:"1"}),setTimeout(()=>{try{A()}catch{}},0))}catch{}},[t,A,n]),!t)return null;const k=Array.isArray(g)&&g.length?g:["Create or join a room","Place bets, roll dice, or deal cards","Win chips and share the fun"];return Q.jsxs("div",{className:"onb-modal",role:"dialog","aria-modal":"true","aria-label":"Welcome to Dice Lounge",children:[Q.jsx("div",{className:"onb-backdrop",onClick:y}),Q.jsxs("div",{className:"onb-card",onClick:m=>m.stopPropagation(),children:[Q.jsxs("header",{className:"onb-header",children:[Q.jsx("h2",{className:"onb-title",children:e||"Dice Lounge"}),Q.jsx("p",{className:"onb-tagline",children:i||"Roll, chat, and play with friends."})]}),Q.jsx("ol",{className:"onb-steps","aria-label":"Getting started steps",children:k.map((m,U)=>Q.jsx("li",{className:"onb-step",children:m},U))}),Q.jsx("div",{className:"onb-cta-row",children:o&&D&&Q.jsx("button",{type:"button",className:"onb-btn onb-btn--ghost felt-btn",onClick:a||(()=>B("/login")),children:o})})]}),S&&Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:"onb-highlight","aria-hidden":!0,style:{top:Math.max(0,S.top-8),left:Math.max(0,S.left-8),width:S.width+16,height:S.height+16}}),Q.jsx("div",{className:"onb-coachmark",role:"note","aria-label":s,style:{top:Math.max(0,S.top-14),left:S.left+S.width/2},children:Q.jsx("span",{className:"onb-coachmark__label",children:s})})]})]})}function pu({onClose:t,defaultMode:A}){const[e,i]=p.useState(A??"cee-lo"),g=!A,I=()=>g?Q.jsxs("div",{className:"howto__toggle",role:"tablist","aria-label":"Select ruleset",children:[Q.jsx("button",{type:"button",role:"tab","aria-selected":e==="cee-lo","aria-pressed":e==="cee-lo",onClick:()=>{i("cee-lo")},className:"felt-btn"+(e==="cee-lo"?" felt-btn--active":""),children:"Cee‑Lo"}),Q.jsx("button",{type:"button",role:"tab","aria-selected":e==="craps","aria-pressed":e==="craps",onClick:()=>{i("craps")},className:"felt-btn"+(e==="craps"?" felt-btn--active":""),children:"Craps"}),Q.jsx("button",{type:"button",role:"tab","aria-selected":e==="poker","aria-pressed":e==="poker",onClick:()=>{i("poker")},className:"felt-btn"+(e==="poker"?" felt-btn--active":""),children:"Poker"}),Q.jsx("button",{type:"button",role:"tab","aria-selected":e==="skills","aria-pressed":e==="skills",onClick:()=>{i("skills")},className:"felt-btn"+(e==="skills"?" felt-btn--active":""),children:"Skills"})]}):null,n=Q.jsxs(Q.Fragment,{children:[Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Overview"}),Q.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."})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Single‑Player Mode"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.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."]}),Q.jsxs("li",{children:[Q.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."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Auto pacing:"})," Rounds settle automatically and the next round starts after a short buffer."]}),Q.jsxs("li",{children:[Q.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."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Round Flow"}),Q.jsxs("ol",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Banker sets the roll:"})," The banker rolls until they have a scoring result."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Challengers roll:"})," Each challenger rolls once a banker score exists."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Settle:"})," Wagers settle automatically with chip animations and a result flash."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Dice Scoring"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"456 (banker only):"})," Banker wins against everyone (auto‑win)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"123 (banker only):"})," Banker fails/pass this round (auto‑lose / pass)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Triples:"})," Three of a kind beats any point (higher triple beats lower)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Point:"})," A pair plus a singleton sets a point equal to the singleton value (1–6). Higher point wins."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Nothing:"})," No pair/triple and not 123/456 — banker re‑rolls; challenger non‑score."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Challenger 123/456:"})," Treated as a normal point (no auto outcome for challengers)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Tie:"})," Push (stake returned)."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Main Bets (vs Banker)"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Main bet wins if your roll outranks banker, loses if lower, pushes if equal."}),Q.jsx("li",{children:"Banker auto results (456 / 123) settle immediately with no legacy sweep animation."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Side Bets"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Create offers on another player’s upcoming roll (e.g. “Under 4 on Alex”)."}),Q.jsx("li",{children:"Only non‑subject players may accept; creator & subject excluded."}),Q.jsx("li",{children:"Offer can be canceled until the subject rolls."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Visual Feedback"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Chip flights represent transfers; flashes show WIN / LOSE / PUSH."}),Q.jsx("li",{children:"Push flashes appear shortly after resolution to keep pacing consistent."}),Q.jsx("li",{children:"Haptics fire for meaningful outcomes (supported devices)."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Tips"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"High banker point (5 or 6) reduces challenger EV—size bets accordingly."}),Q.jsx("li",{children:"Track patterns with the history view; variance can mask true edge short‑term."})]})]})]}),o=Q.jsxs(Q.Fragment,{children:[Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Overview"}),Q.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."}),Q.jsxs("p",{className:"howto__note howto__note--small",children:[Q.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."]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Table Flow"}),Q.jsxs("ol",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Come‑Out Roll:"})," Shooter rolls with no point established."]}),Q.jsxs("li",{children:[Q.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."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Point Phase:"})," Shooter keeps rolling until point repeats (Pass wins) or a 7 appears (Don’t Pass wins / seven‑out)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Shooter Rotation:"})," On seven‑out (or configured rotation rule) the dice pass to next player in order."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Pass / Don’t Pass Rules"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.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)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Point Phase:"})," Pass wins if point repeats before 7; Don’t Pass wins on 7 before point."]}),Q.jsx("li",{children:"Payout: Even money (winning line bet returns principal + equal winnings; push returns principal)."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Place Bets (Implemented)"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Available only after a point is established."}),Q.jsx("li",{children:"Remain on the table until a 7 (seven‑out) or player removes them (UI removal support pending future update)."}),Q.jsx("li",{children:"Payout ratios (winnings only; principal stays): 4/10: 9:5 • 5/9: 7:5 • 6/8: 7:6."}),Q.jsx("li",{children:"On seven‑out all active place bets lose and are cleared."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Coming Soon"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Odds Bets:"})," True odds behind line & come bets (no house edge)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Come / Don’t Come:"})," Independent points established after the main point."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Field & Big 6/8:"})," One‑roll (Field) and even‑money (Big) bets with proper settlement."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Prop / Horn:"})," Center action (yo, any 7, craps, hardways) with single‑roll or multi‑roll resolution."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Readiness & Rolling"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"All players mark Ready between rolls; shooter auto‑ready on new shooter assignment."}),Q.jsx("li",{children:"Countdown deadline (if shown) enforces timely rolls; expired deadlines may auto‑roll in later phases."}),Q.jsx("li",{children:"Shooter must have an active Pass (or Don’t Pass if allowed by table config) before rolling."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Settlement Pipeline"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Server validates roll → computes line & place settlements → emits results → credits balances."}),Q.jsx("li",{children:"Line WIN: principal + winnings credited. Line PUSH: principal only. Place WIN: winnings only (bet stays)."}),Q.jsx("li",{children:"Seven‑out triggers removal of all unresolved place bets (auto clear broadcast)."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Payout Reference"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Pass / Don’t Pass:"})," 1:1"]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Place 4 / 10:"})," 9:5"]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Place 5 / 9:"})," 7:5"]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Place 6 / 8:"})," 7:6"]})]}),Q.jsx("p",{className:"howto__note howto__note--tiny",children:"Fractions floored in current build; rounding rules may refine later."})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Strategy Notes (Basics)"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Place 6 & 8 have the lowest house edge among implemented place bets."}),Q.jsx("li",{children:"Even‑money Pass vs Don’t Pass is preference until odds arrive (future true‑odds leverage)."}),Q.jsx("li",{children:"Avoid overexposing bankroll pre‑odds: variance on early seven‑outs can be sharp."})]})]})]}),a=Q.jsxs(Q.Fragment,{children:[Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Overview"}),Q.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."}),Q.jsxs("p",{className:"howto__note howto__note--small",children:[Q.jsx("b",{children:"Table Defaults:"})," Small blind 5, big blind 10, minimum buy‑in z1000, up to 6 seats."]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Buy‑In & Seating"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:["Joining a poker room requires at least ",Q.jsx("b",{children:"z1000"})," balance (server‑enforced)."]}),Q.jsx("li",{children:"When seated, your starting stack equals the minimum buy‑in (z1000)."}),Q.jsx("li",{children:"Bots, when present, are seated with z1000 stacks."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Blinds & Turn Order"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"The dealer button rotates each hand. Players post small blind and big blind to start the pot."}),Q.jsx("li",{children:"Pre‑flop action begins left of the big blind; on later streets it begins left of the button."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Actions"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Fold"})," — Surrender your hand; no further claim to the pot."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Check/Call"})," — Match the current bet to continue (or check for free when no bet is outstanding)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Bet/Raise"})," — Put chips in the pot. Min raise equals the last raise size; UI shows legal targets."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Streets & Dealing"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Pre‑flop:"})," Two private cards to each player."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Flop:"})," Three community cards."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Turn:"})," One community card."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"River:"})," One community card."]}),Q.jsx("li",{children:"Short UI locks play during dealing animations to keep state consistent."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Pots, All‑In, Side Pots"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Contributions create the main pot and side pots automatically when stacks differ."}),Q.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)."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Hand Ranking (Best 5 Cards)"}),Q.jsx("ul",{children:Q.jsx("li",{children:"Straight Flush (best) → Four of a Kind → Full House → Flush → Straight → Three of a Kind → Two Pair → One Pair → High Card."})})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Showdown"}),Q.jsx("ul",{children:Q.jsx("li",{children:"Remaining players reveal; best 5‑card hand wins each pot. If everyone else folds, last player takes the pot without showdown."})})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Tips"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Respect position: act later to gather more information."}),Q.jsx("li",{children:"Size raises relative to the pot and prior aggression; avoid bet sizing tells."}),Q.jsx("li",{children:"Tighten ranges out of position; widen on the button."})]})]})]}),r=Q.jsxs(Q.Fragment,{children:[Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Overview"}),Q.jsx("p",{children:"Skills Lounge is a head‑to‑head word and trivia battle. Compete against opponents in timed challenges across three game modes: Word Search, Anagrams, and Trivia. Earn points based on speed and accuracy."})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Game Modes"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Word Search:"})," Find hidden words in a letter grid by swiping across letters."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Anagrams:"})," Form valid words from a pool of scrambled letters."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Trivia:"})," Answer multiple‑choice questions across various categories."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Word Search Rules"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Swipe across adjacent letters (horizontal, vertical, or diagonal) to form words."}),Q.jsx("li",{children:"Words must be at least 3 letters long to score."}),Q.jsx("li",{children:"Longer words earn more points: 3 letters = 1 pt, 4 letters = 2 pts, 5+ letters = 3+ pts."}),Q.jsx("li",{children:"Each word can only be found once per round."}),Q.jsx("li",{children:"The timer counts down—find as many words as possible before time expires."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Anagrams Rules"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"You're given a pool of letters—tap letters to select them and form words."}),Q.jsx("li",{children:"Submit valid words to score points; invalid words don't count."}),Q.jsx("li",{children:"Longer words earn more points."}),Q.jsx("li",{children:"Letters reset after each submission, allowing multiple words per round."}),Q.jsx("li",{children:"Race against the clock to find as many valid words as possible."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Trivia Rules"}),Q.jsxs("ul",{children:[Q.jsx("li",{children:"Answer multiple‑choice questions from categories like Science, History, Sports, and more."}),Q.jsx("li",{children:"Each question has a time limit—answer quickly for bonus points."}),Q.jsx("li",{children:"Correct answers earn base points; faster answers earn time bonuses."}),Q.jsx("li",{children:"Difficulty varies: Easy, Medium, and Hard questions with increasing point values."}),Q.jsx("li",{children:"Questions are drawn from a pool of thousands—fresh challenges every game."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Scoring"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Word Search:"})," Points scale with word length (longer = better)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Anagrams:"})," Points scale with word length (longer = better)."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Trivia:"})," Base points for correct answers + time bonus for fast responses."]}),Q.jsx("li",{children:"Final score determines the winner of each duel."})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Match Flow"}),Q.jsxs("ol",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Matchmaking:"})," Find an opponent or play against AI."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Mode Selection:"})," Choose Word Search, Anagrams, or Trivia."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Challenge:"})," Both players compete on the same puzzle/questions simultaneously."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Results:"})," Scores are compared and the winner is declared."]})]})]}),Q.jsxs("section",{className:"howto__section",children:[Q.jsx("h3",{children:"Tips"}),Q.jsxs("ul",{children:[Q.jsxs("li",{children:[Q.jsx("b",{children:"Word Search:"})," Start with the corners and edges—words often extend from boundaries."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Anagrams:"})," Look for common prefixes/suffixes (‑ing, ‑ed, un‑, re‑) to spot words faster."]}),Q.jsxs("li",{children:[Q.jsx("b",{children:"Trivia:"})," Don't overthink—your first instinct is often correct. Manage time wisely."]}),Q.jsx("li",{children:"Practice regularly to build vocabulary and improve pattern recognition."})]})]})]});return Q.jsxs("div",{className:"card how-to-play howto",children:[Q.jsx("div",{className:"card-header howto__header",children:Q.jsx("div",{className:"howto__header-row",children:Q.jsx(I,{})})}),Q.jsx("h2",{className:"howto__title",children:"How to Play"}),Q.jsxs("div",{className:"card-body howto__body",children:[Q.jsxs("div",{role:"note","aria-label":"Disclaimer",className:"howto__disclaimer",children:[Q.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"?n:e==="craps"?o:e==="poker"?a:r]})]})}function eAA({open:t,onClose:A,defaultMode:e}){const i=p.useRef(null),g="howto-intro";return p.useEffect(()=>{if(!t)return;const I=o=>{o.key==="Escape"&&A()},n=o=>{i.current&&!i.current.contains(o.target)&&A()};return document.addEventListener("keydown",I),document.addEventListener("mousedown",n),()=>{document.removeEventListener("keydown",I),document.removeEventListener("mousedown",n)}},[t,A]),t?Q.jsx("div",{className:"modal-backdrop",role:"presentation",children:Q.jsxs("div",{className:"modal-panel modal-panel--fullscreen howto-modal",role:"dialog","aria-modal":"true","aria-label":"How to Play","aria-describedby":g,ref:i,children:[Q.jsxs("div",{className:"modal-header",children:[Q.jsx("h3",{className:"modal-title",children:"How to Play"}),Q.jsx("button",{className:"modal-close",onClick:A,"aria-label":"Close",children:"×"})]}),Q.jsx(pu,{defaultMode:e})]})}):null}let uf=null,kj=0;const fwA=6e4;let Dw=null;function tAA(){const{user:t}=Yi(),[A,e]=p.useState(uf),[i,g]=p.useState(!1),[I,n]=p.useState(null),o=Ea(),a=p.useCallback(async(r=!1)=>{if(t){if(!r&&uf&&Date.now()-kj<fwA){e(uf);return}if(Dw){await Dw,e(uf);return}g(!0),n(null),Dw=(async()=>{try{const s=await Nn(),B=await fetch(`${o}/api/leaderboard/summary`,{credentials:"include",headers:{...s?{Authorization:`Bearer ${s}`}:{},Accept:"application/json"}});if(!(B.headers.get("content-type")||"").includes("application/json")){const D=await B.text();throw new Error(`Unexpected response (${B.status}). Not JSON. First bytes: ${D.slice(0,120)}`)}const E=await B.json();if(E?.ok&&E?.data)uf=E.data,kj=Date.now(),e(uf);else throw new Error(E?.error||"Failed to load leaderboard")}catch(s){n(s?.message??"Failed to load leaderboard")}finally{g(!1),Dw=null}})(),await Dw}},[t]);return p.useEffect(()=>{t&&a()},[t,a]),{data:A,loading:i,error:I,refresh:a}}const DwA={topBalances:[{rank:1,playerId:"demo1",name:"ChipMaster",avatarUrl:null,balance:25e5},{rank:2,playerId:"demo2",name:"LuckyDice",avatarUrl:null,balance:185e4},{rank:3,playerId:"demo3",name:"WordWizard",avatarUrl:null,balance:142e4},{rank:4,playerId:"demo4",name:"SkillsKing",avatarUrl:null,balance:98e4},{rank:5,playerId:"demo5",name:"ProPlayer",avatarUrl:null,balance:75e4}],weeklyWinners:[{rank:1,playerId:"demo6",name:"HotStreak",avatarUrl:null,amount:425e3},{rank:2,playerId:"demo7",name:"BigWinner",avatarUrl:null,amount:312e3},{rank:3,playerId:"demo1",name:"ChipMaster",avatarUrl:null,amount:285e3},{rank:4,playerId:"demo8",name:"RisingStar",avatarUrl:null,amount:198e3},{rank:5,playerId:"demo9",name:"GamePro",avatarUrl:null,amount:145e3}],allTimeWinners:[{rank:1,playerId:"demo1",name:"ChipMaster",avatarUrl:null,amount:125e5},{rank:2,playerId:"demo10",name:"Legend99",avatarUrl:null,amount:98e5},{rank:3,playerId:"demo2",name:"LuckyDice",avatarUrl:null,amount:765e4},{rank:4,playerId:"demo11",name:"VeteranAce",avatarUrl:null,amount:542e4},{rank:5,playerId:"demo12",name:"OGPlayer",avatarUrl:null,amount:41e5}],skillsStreaks:[{rank:1,playerId:"demo3",name:"WordWizard",avatarUrl:null,bestStreak:12,currentStreak:5},{rank:2,playerId:"demo6",name:"HotStreak",avatarUrl:null,bestStreak:9,currentStreak:9},{rank:3,playerId:"demo1",name:"ChipMaster",avatarUrl:null,bestStreak:7,currentStreak:0},{rank:4,playerId:"demo4",name:"SkillsKing",avatarUrl:null,bestStreak:6,currentStreak:3},{rank:5,playerId:"demo9",name:"GamePro",avatarUrl:null,bestStreak:5,currentStreak:1}]};function ywA({open:t,onClose:A}){const[e]=C2(),i=e.get("e2e")==="1",{data:g,loading:I,error:n,refresh:o}=tAA(),a=p.useMemo(()=>i?DwA:g,[i,g]);return p.useEffect(()=>{t&&!i&&o(!0)},[t,o,i]),t?Q.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:A,children:Q.jsxs("div",{className:"modal-panel modal-panel--fullscreen leaderboard-modal",role:"dialog","aria-modal":"true","aria-label":"Leaderboards",onClick:r=>r.stopPropagation(),children:[Q.jsxs("div",{className:"modal-header",children:[Q.jsx("h3",{className:"modal-title",children:"Leaderboards"}),Q.jsx("button",{className:"modal-close",onClick:A,"aria-label":"Close",children:"×"})]}),!i&&I&&Q.jsx("p",{children:"Loading…"}),!i&&n&&Q.jsx("p",{className:"error",role:"status",children:n}),a&&Q.jsxs("div",{className:"leaderboard-sections",children:[a.skillsStreaks?.length>0&&Q.jsxs("section",{children:[Q.jsx("h4",{children:"🔥 Skills Win Streaks"}),Q.jsx("ol",{className:"lb-list",children:a.skillsStreaks.map(r=>Q.jsxs("li",{className:"lb-row",children:[Q.jsxs("span",{className:"lb-rank",children:["#",r.rank]}),Q.jsx("span",{className:"lb-name",children:r.name}),Q.jsxs("span",{className:"lb-metric",children:[r.bestStreak," best",r.currentStreak>0?` · ${r.currentStreak} now 🔥`:""]})]},r.playerId))})]}),Q.jsxs("section",{children:[Q.jsx("h4",{children:"Top Balances"}),Q.jsx("ol",{className:"lb-list",children:a.topBalances.map(r=>Q.jsxs("li",{className:"lb-row",children:[Q.jsxs("span",{className:"lb-rank",children:["#",r.rank]}),Q.jsx("span",{className:"lb-name",children:r.name}),Q.jsxs("span",{className:"lb-metric",children:[r.balance.toLocaleString()," chips"]})]},r.playerId))})]}),Q.jsxs("section",{children:[Q.jsx("h4",{children:"Weekly Winners"}),Q.jsx("ol",{className:"lb-list",children:a.weeklyWinners.map(r=>Q.jsxs("li",{className:"lb-row",children:[Q.jsxs("span",{className:"lb-rank",children:["#",r.rank]}),Q.jsx("span",{className:"lb-name",children:r.name}),Q.jsxs("span",{className:"lb-metric",children:["+",r.amount.toLocaleString()," chips"]})]},r.playerId))})]}),Q.jsxs("section",{children:[Q.jsx("h4",{children:"All‑Time Winners"}),Q.jsx("ol",{className:"lb-list",children:a.allTimeWinners.map(r=>Q.jsxs("li",{className:"lb-row",children:[Q.jsxs("span",{className:"lb-rank",children:["#",r.rank]}),Q.jsx("span",{className:"lb-name",children:r.name}),Q.jsxs("span",{className:"lb-metric",children:["+",r.amount.toLocaleString()," chips"]})]},r.playerId))})]})]})]})}):null}function SwA({open:t,onClose:A,onGoLogin:e,title:i,message:g}){const I=p.useRef(null),n=Di();if(p.useEffect(()=>{if(!t)return;const a=s=>{s.key==="Escape"&&A()},r=s=>{I.current&&!I.current.contains(s.target)&&A()};return document.addEventListener("keydown",a),document.addEventListener("mousedown",r),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",r)}},[t,A]),!t)return null;const o=()=>{try{(e??(()=>n("/login")))()}finally{A()}};return Q.jsx("div",{className:"modal-backdrop",role:"presentation",children:Q.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Login required",ref:I,children:[Q.jsx("button",{className:"modal-close",onClick:A,"aria-label":"Close",children:"×"}),Q.jsx("h3",{className:"modal-title",children:i??"Login Required"}),g?Q.jsx("div",{style:{marginTop:8},children:g}):Q.jsx("p",{style:{marginTop:8},children:"You need to be logged in to access this feature."}),Q.jsxs("div",{style:{display:"flex",gap:12,marginTop:16,justifyContent:"flex-end"},children:[Q.jsx("button",{className:"felt-btn btn--ghost",onClick:A,children:"Cancel"}),Q.jsx("button",{className:"felt-btn felt-btn--primary",onClick:o,children:"Go to Login"})]})]})})}const Ll=mB("CapacitorUpdater",{web:()=>pi(()=>import("./web-CvyNlK5C.js"),[],import.meta.url).then(t=>new t.CapacitorUpdaterWeb)});var NN={exports:{}},F_,Mj;function qF(){if(Mj)return F_;Mj=1;const t="2.0.0",A=256,e=Number.MAX_SAFE_INTEGER||9007199254740991,i=16,g=A-6;return F_={MAX_LENGTH:A,MAX_SAFE_COMPONENT_LENGTH:i,MAX_SAFE_BUILD_LENGTH:g,MAX_SAFE_INTEGER:e,RELEASE_TYPES:["major","premajor","minor","preminor","patch","prepatch","prerelease"],SEMVER_SPEC_VERSION:t,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},F_}var b_,Nj;function xF(){if(Nj)return b_;Nj=1;var t={};return b_=typeof process=="object"&&t&&t.NODE_DEBUG&&/\bsemver\b/i.test(t.NODE_DEBUG)?(...e)=>{}:()=>{},b_}var Gj;function Uk(){return Gj||(Gj=1,function(t,A){const{MAX_SAFE_COMPONENT_LENGTH:e,MAX_SAFE_BUILD_LENGTH:i,MAX_LENGTH:g}=qF(),I=xF();A=t.exports={};const n=A.re=[],o=A.safeRe=[],a=A.src=[],r=A.safeSrc=[],s=A.t={};let B=0;const c="[a-zA-Z0-9-]",E=[["\\s",1],["\\d",g],[c,i]],D=S=>{for(const[f,M]of E)S=S.split(`${f}*`).join(`${f}{0,${M}}`).split(`${f}+`).join(`${f}{1,${M}}`);return S},y=(S,f,M)=>{const k=D(f),m=B++;I(S,m,f),s[S]=m,a[m]=f,r[m]=k,n[m]=new RegExp(f,M?"g":void 0),o[m]=new RegExp(k,M?"g":void 0)};y("NUMERICIDENTIFIER","0|[1-9]\\d*"),y("NUMERICIDENTIFIERLOOSE","\\d+"),y("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${c}*`),y("MAINVERSION",`(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})\\.(${a[s.NUMERICIDENTIFIER]})`),y("MAINVERSIONLOOSE",`(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})\\.(${a[s.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASEIDENTIFIER",`(?:${a[s.NONNUMERICIDENTIFIER]}|${a[s.NUMERICIDENTIFIER]})`),y("PRERELEASEIDENTIFIERLOOSE",`(?:${a[s.NONNUMERICIDENTIFIER]}|${a[s.NUMERICIDENTIFIERLOOSE]})`),y("PRERELEASE",`(?:-(${a[s.PRERELEASEIDENTIFIER]}(?:\\.${a[s.PRERELEASEIDENTIFIER]})*))`),y("PRERELEASELOOSE",`(?:-?(${a[s.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${a[s.PRERELEASEIDENTIFIERLOOSE]})*))`),y("BUILDIDENTIFIER",`${c}+`),y("BUILD",`(?:\\+(${a[s.BUILDIDENTIFIER]}(?:\\.${a[s.BUILDIDENTIFIER]})*))`),y("FULLPLAIN",`v?${a[s.MAINVERSION]}${a[s.PRERELEASE]}?${a[s.BUILD]}?`),y("FULL",`^${a[s.FULLPLAIN]}$`),y("LOOSEPLAIN",`[v=\\s]*${a[s.MAINVERSIONLOOSE]}${a[s.PRERELEASELOOSE]}?${a[s.BUILD]}?`),y("LOOSE",`^${a[s.LOOSEPLAIN]}$`),y("GTLT","((?:<|>)?=?)"),y("XRANGEIDENTIFIERLOOSE",`${a[s.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),y("XRANGEIDENTIFIER",`${a[s.NUMERICIDENTIFIER]}|x|X|\\*`),y("XRANGEPLAIN",`[v=\\s]*(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:\\.(${a[s.XRANGEIDENTIFIER]})(?:${a[s.PRERELEASE]})?${a[s.BUILD]}?)?)?`),y("XRANGEPLAINLOOSE",`[v=\\s]*(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:\\.(${a[s.XRANGEIDENTIFIERLOOSE]})(?:${a[s.PRERELEASELOOSE]})?${a[s.BUILD]}?)?)?`),y("XRANGE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAIN]}$`),y("XRANGELOOSE",`^${a[s.GTLT]}\\s*${a[s.XRANGEPLAINLOOSE]}$`),y("COERCEPLAIN",`(^|[^\\d])(\\d{1,${e}})(?:\\.(\\d{1,${e}}))?(?:\\.(\\d{1,${e}}))?`),y("COERCE",`${a[s.COERCEPLAIN]}(?:$|[^\\d])`),y("COERCEFULL",a[s.COERCEPLAIN]+`(?:${a[s.PRERELEASE]})?(?:${a[s.BUILD]})?(?:$|[^\\d])`),y("COERCERTL",a[s.COERCE],!0),y("COERCERTLFULL",a[s.COERCEFULL],!0),y("LONETILDE","(?:~>?)"),y("TILDETRIM",`(\\s*)${a[s.LONETILDE]}\\s+`,!0),A.tildeTrimReplace="$1~",y("TILDE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAIN]}$`),y("TILDELOOSE",`^${a[s.LONETILDE]}${a[s.XRANGEPLAINLOOSE]}$`),y("LONECARET","(?:\\^)"),y("CARETTRIM",`(\\s*)${a[s.LONECARET]}\\s+`,!0),A.caretTrimReplace="$1^",y("CARET",`^${a[s.LONECARET]}${a[s.XRANGEPLAIN]}$`),y("CARETLOOSE",`^${a[s.LONECARET]}${a[s.XRANGEPLAINLOOSE]}$`),y("COMPARATORLOOSE",`^${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]})$|^$`),y("COMPARATOR",`^${a[s.GTLT]}\\s*(${a[s.FULLPLAIN]})$|^$`),y("COMPARATORTRIM",`(\\s*)${a[s.GTLT]}\\s*(${a[s.LOOSEPLAIN]}|${a[s.XRANGEPLAIN]})`,!0),A.comparatorTrimReplace="$1$2$3",y("HYPHENRANGE",`^\\s*(${a[s.XRANGEPLAIN]})\\s+-\\s+(${a[s.XRANGEPLAIN]})\\s*$`),y("HYPHENRANGELOOSE",`^\\s*(${a[s.XRANGEPLAINLOOSE]})\\s+-\\s+(${a[s.XRANGEPLAINLOOSE]})\\s*$`),y("STAR","(<|>)?=?\\s*\\*"),y("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),y("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")}(NN,NN.exports)),NN.exports}var v_,Rj;function hH(){if(Rj)return v_;Rj=1;const t=Object.freeze({loose:!0}),A=Object.freeze({});return v_=i=>i?typeof i!="object"?t:i:A,v_}var __,Uj;function iAA(){if(Uj)return __;Uj=1;const t=/^[0-9]+$/,A=(i,g)=>{const I=t.test(i),n=t.test(g);return I&&n&&(i=+i,g=+g),i===g?0:I&&!n?-1:n&&!I?1:i<g?-1:1};return __={compareIdentifiers:A,rcompareIdentifiers:(i,g)=>A(g,i)},__}var J_,Kj;function ar(){if(Kj)return J_;Kj=1;const t=xF(),{MAX_LENGTH:A,MAX_SAFE_INTEGER:e}=qF(),{safeRe:i,t:g}=Uk(),I=hH(),{compareIdentifiers:n}=iAA();class o{constructor(r,s){if(s=I(s),r instanceof o){if(r.loose===!!s.loose&&r.includePrerelease===!!s.includePrerelease)return r;r=r.version}else if(typeof r!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof r}".`);if(r.length>A)throw new TypeError(`version is longer than ${A} characters`);t("SemVer",r,s),this.options=s,this.loose=!!s.loose,this.includePrerelease=!!s.includePrerelease;const B=r.trim().match(s.loose?i[g.LOOSE]:i[g.FULL]);if(!B)throw new TypeError(`Invalid Version: ${r}`);if(this.raw=r,this.major=+B[1],this.minor=+B[2],this.patch=+B[3],this.major>e||this.major<0)throw new TypeError("Invalid major version");if(this.minor>e||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>e||this.patch<0)throw new TypeError("Invalid patch version");B[4]?this.prerelease=B[4].split(".").map(c=>{if(/^[0-9]+$/.test(c)){const E=+c;if(E>=0&&E<e)return E}return c}):this.prerelease=[],this.build=B[5]?B[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(r){if(t("SemVer.compare",this.version,this.options,r),!(r instanceof o)){if(typeof r=="string"&&r===this.version)return 0;r=new o(r,this.options)}return r.version===this.version?0:this.compareMain(r)||this.comparePre(r)}compareMain(r){return r instanceof o||(r=new o(r,this.options)),n(this.major,r.major)||n(this.minor,r.minor)||n(this.patch,r.patch)}comparePre(r){if(r instanceof o||(r=new o(r,this.options)),this.prerelease.length&&!r.prerelease.length)return-1;if(!this.prerelease.length&&r.prerelease.length)return 1;if(!this.prerelease.length&&!r.prerelease.length)return 0;let s=0;do{const B=this.prerelease[s],c=r.prerelease[s];if(t("prerelease compare",s,B,c),B===void 0&&c===void 0)return 0;if(c===void 0)return 1;if(B===void 0)return-1;if(B===c)continue;return n(B,c)}while(++s)}compareBuild(r){r instanceof o||(r=new o(r,this.options));let s=0;do{const B=this.build[s],c=r.build[s];if(t("build compare",s,B,c),B===void 0&&c===void 0)return 0;if(c===void 0)return 1;if(B===void 0)return-1;if(B===c)continue;return n(B,c)}while(++s)}inc(r,s,B){if(r.startsWith("pre")){if(!s&&B===!1)throw new Error("invalid increment argument: identifier is empty");if(s){const c=`-${s}`.match(this.options.loose?i[g.PRERELEASELOOSE]:i[g.PRERELEASE]);if(!c||c[1]!==s)throw new Error(`invalid identifier: ${s}`)}}switch(r){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",s,B);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",s,B);break;case"prepatch":this.prerelease.length=0,this.inc("patch",s,B),this.inc("pre",s,B);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",s,B),this.inc("pre",s,B);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 c=Number(B)?1:0;if(this.prerelease.length===0)this.prerelease=[c];else{let E=this.prerelease.length;for(;--E>=0;)typeof this.prerelease[E]=="number"&&(this.prerelease[E]++,E=-2);if(E===-1){if(s===this.prerelease.join(".")&&B===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(c)}}if(s){let E=[s,c];B===!1&&(E=[s]),n(this.prerelease[0],s)===0?isNaN(this.prerelease[1])&&(this.prerelease=E):this.prerelease=E}break}default:throw new Error(`invalid increment argument: ${r}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}}return J_=o,J_}var L_,Fj;function Yy(){if(Fj)return L_;Fj=1;const t=ar();return L_=(e,i,g=!1)=>{if(e instanceof t)return e;try{return new t(e,i)}catch(I){if(!g)return null;throw I}},L_}var q_,bj;function wwA(){if(bj)return q_;bj=1;const t=Yy();return q_=(e,i)=>{const g=t(e,i);return g?g.version:null},q_}var x_,vj;function mwA(){if(vj)return x_;vj=1;const t=Yy();return x_=(e,i)=>{const g=t(e.trim().replace(/^[=v]+/,""),i);return g?g.version:null},x_}var T_,_j;function kwA(){if(_j)return T_;_j=1;const t=ar();return T_=(e,i,g,I,n)=>{typeof g=="string"&&(n=I,I=g,g=void 0);try{return new t(e instanceof t?e.version:e,g).inc(i,I,n).version}catch{return null}},T_}var Y_,Jj;function MwA(){if(Jj)return Y_;Jj=1;const t=Yy();return Y_=(e,i)=>{const g=t(e,null,!0),I=t(i,null,!0),n=g.compare(I);if(n===0)return null;const o=n>0,a=o?g:I,r=o?I:g,s=!!a.prerelease.length;if(!!r.prerelease.length&&!s){if(!r.patch&&!r.minor)return"major";if(r.compareMain(a)===0)return r.minor&&!r.patch?"minor":"patch"}const c=s?"pre":"";return g.major!==I.major?c+"major":g.minor!==I.minor?c+"minor":g.patch!==I.patch?c+"patch":"prerelease"},Y_}var H_,Lj;function NwA(){if(Lj)return H_;Lj=1;const t=ar();return H_=(e,i)=>new t(e,i).major,H_}var O_,qj;function GwA(){if(qj)return O_;qj=1;const t=ar();return O_=(e,i)=>new t(e,i).minor,O_}var P_,xj;function RwA(){if(xj)return P_;xj=1;const t=ar();return P_=(e,i)=>new t(e,i).patch,P_}var j_,Tj;function UwA(){if(Tj)return j_;Tj=1;const t=Yy();return j_=(e,i)=>{const g=t(e,i);return g&&g.prerelease.length?g.prerelease:null},j_}var Z_,Yj;function NB(){if(Yj)return Z_;Yj=1;const t=ar();return Z_=(e,i,g)=>new t(e,g).compare(new t(i,g)),Z_}var W_,Hj;function KwA(){if(Hj)return W_;Hj=1;const t=NB();return W_=(e,i,g)=>t(i,e,g),W_}var z_,Oj;function FwA(){if(Oj)return z_;Oj=1;const t=NB();return z_=(e,i)=>t(e,i,!0),z_}var V_,Pj;function dH(){if(Pj)return V_;Pj=1;const t=ar();return V_=(e,i,g)=>{const I=new t(e,g),n=new t(i,g);return I.compare(n)||I.compareBuild(n)},V_}var X_,jj;function bwA(){if(jj)return X_;jj=1;const t=dH();return X_=(e,i)=>e.sort((g,I)=>t(g,I,i)),X_}var $_,Zj;function vwA(){if(Zj)return $_;Zj=1;const t=dH();return $_=(e,i)=>e.sort((g,I)=>t(I,g,i)),$_}var AJ,Wj;function TF(){if(Wj)return AJ;Wj=1;const t=NB();return AJ=(e,i,g)=>t(e,i,g)>0,AJ}var eJ,zj;function pH(){if(zj)return eJ;zj=1;const t=NB();return eJ=(e,i,g)=>t(e,i,g)<0,eJ}var tJ,Vj;function gAA(){if(Vj)return tJ;Vj=1;const t=NB();return tJ=(e,i,g)=>t(e,i,g)===0,tJ}var iJ,Xj;function IAA(){if(Xj)return iJ;Xj=1;const t=NB();return iJ=(e,i,g)=>t(e,i,g)!==0,iJ}var gJ,$j;function fH(){if($j)return gJ;$j=1;const t=NB();return gJ=(e,i,g)=>t(e,i,g)>=0,gJ}var IJ,A8;function DH(){if(A8)return IJ;A8=1;const t=NB();return IJ=(e,i,g)=>t(e,i,g)<=0,IJ}var nJ,e8;function nAA(){if(e8)return nJ;e8=1;const t=gAA(),A=IAA(),e=TF(),i=fH(),g=pH(),I=DH();return nJ=(o,a,r,s)=>{switch(a){case"===":return typeof o=="object"&&(o=o.version),typeof r=="object"&&(r=r.version),o===r;case"!==":return typeof o=="object"&&(o=o.version),typeof r=="object"&&(r=r.version),o!==r;case"":case"=":case"==":return t(o,r,s);case"!=":return A(o,r,s);case">":return e(o,r,s);case">=":return i(o,r,s);case"<":return g(o,r,s);case"<=":return I(o,r,s);default:throw new TypeError(`Invalid operator: ${a}`)}},nJ}var oJ,t8;function _wA(){if(t8)return oJ;t8=1;const t=ar(),A=Yy(),{safeRe:e,t:i}=Uk();return oJ=(I,n)=>{if(I instanceof t)return I;if(typeof I=="number"&&(I=String(I)),typeof I!="string")return null;n=n||{};let o=null;if(!n.rtl)o=I.match(n.includePrerelease?e[i.COERCEFULL]:e[i.COERCE]);else{const E=n.includePrerelease?e[i.COERCERTLFULL]:e[i.COERCERTL];let D;for(;(D=E.exec(I))&&(!o||o.index+o[0].length!==I.length);)(!o||D.index+D[0].length!==o.index+o[0].length)&&(o=D),E.lastIndex=D.index+D[1].length+D[2].length;E.lastIndex=-1}if(o===null)return null;const a=o[2],r=o[3]||"0",s=o[4]||"0",B=n.includePrerelease&&o[5]?`-${o[5]}`:"",c=n.includePrerelease&&o[6]?`+${o[6]}`:"";return A(`${a}.${r}.${s}${B}${c}`,n)},oJ}var aJ,i8;function JwA(){if(i8)return aJ;i8=1;class t{constructor(){this.max=1e3,this.map=new Map}get(e){const i=this.map.get(e);if(i!==void 0)return this.map.delete(e),this.map.set(e,i),i}delete(e){return this.map.delete(e)}set(e,i){if(!this.delete(e)&&i!==void 0){if(this.map.size>=this.max){const I=this.map.keys().next().value;this.delete(I)}this.map.set(e,i)}return this}}return aJ=t,aJ}var rJ,g8;function GB(){if(g8)return rJ;g8=1;const t=/\s+/g;class A{constructor(j,q){if(q=g(q),j instanceof A)return j.loose===!!q.loose&&j.includePrerelease===!!q.includePrerelease?j:new A(j.raw,q);if(j instanceof I)return this.raw=j.value,this.set=[[j]],this.formatted=void 0,this;if(this.options=q,this.loose=!!q.loose,this.includePrerelease=!!q.includePrerelease,this.raw=j.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(O=>!y(O[0])),this.set.length===0)this.set=[Y];else if(this.set.length>1){for(const O of this.set)if(O.length===1&&S(O[0])){this.set=[O];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let j=0;j<this.set.length;j++){j>0&&(this.formatted+="||");const q=this.set[j];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(j){const Y=((this.options.includePrerelease&&E)|(this.options.loose&&D))+":"+j,O=i.get(Y);if(O)return O;const $=this.options.loose,gA=$?a[r.HYPHENRANGELOOSE]:a[r.HYPHENRANGE];j=j.replace(gA,x(this.options.includePrerelease)),n("hyphen replace",j),j=j.replace(a[r.COMPARATORTRIM],s),n("comparator trim",j),j=j.replace(a[r.TILDETRIM],B),n("tilde trim",j),j=j.replace(a[r.CARETTRIM],c),n("caret trim",j);let z=j.split(" ").map(mA=>M(mA,this.options)).join(" ").split(/\s+/).map(mA=>J(mA,this.options));$&&(z=z.filter(mA=>(n("loose invalid filter",mA,this.options),!!mA.match(a[r.COMPARATORLOOSE])))),n("range list",z);const X=new Map,sA=z.map(mA=>new I(mA,this.options));for(const mA of sA){if(y(mA))return[mA];X.set(mA.value,mA)}X.size>1&&X.has("")&&X.delete("");const rA=[...X.values()];return i.set(Y,rA),rA}intersects(j,q){if(!(j instanceof A))throw new TypeError("a Range is required");return this.set.some(Y=>f(Y,q)&&j.set.some(O=>f(O,q)&&Y.every($=>O.every(gA=>$.intersects(gA,q)))))}test(j){if(!j)return!1;if(typeof j=="string")try{j=new o(j,this.options)}catch{return!1}for(let q=0;q<this.set.length;q++)if(H(this.set[q],j,this.options))return!0;return!1}}rJ=A;const e=JwA(),i=new e,g=hH(),I=YF(),n=xF(),o=ar(),{safeRe:a,t:r,comparatorTrimReplace:s,tildeTrimReplace:B,caretTrimReplace:c}=Uk(),{FLAG_INCLUDE_PRERELEASE:E,FLAG_LOOSE:D}=qF(),y=P=>P.value==="<0.0.0-0",S=P=>P.value==="",f=(P,j)=>{let q=!0;const Y=P.slice();let O=Y.pop();for(;q&&Y.length;)q=Y.every($=>O.intersects($,j)),O=Y.pop();return q},M=(P,j)=>(n("comp",P,j),P=F(P,j),n("caret",P),P=m(P,j),n("tildes",P),P=K(P,j),n("xrange",P),P=G(P,j),n("stars",P),P),k=P=>!P||P.toLowerCase()==="x"||P==="*",m=(P,j)=>P.trim().split(/\s+/).map(q=>U(q,j)).join(" "),U=(P,j)=>{const q=j.loose?a[r.TILDELOOSE]:a[r.TILDE];return P.replace(q,(Y,O,$,gA,z)=>{n("tilde",P,Y,O,$,gA,z);let X;return k(O)?X="":k($)?X=`>=${O}.0.0 <${+O+1}.0.0-0`:k(gA)?X=`>=${O}.${$}.0 <${O}.${+$+1}.0-0`:z?(n("replaceTilde pr",z),X=`>=${O}.${$}.${gA}-${z} <${O}.${+$+1}.0-0`):X=`>=${O}.${$}.${gA} <${O}.${+$+1}.0-0`,n("tilde return",X),X})},F=(P,j)=>P.trim().split(/\s+/).map(q=>b(q,j)).join(" "),b=(P,j)=>{n("caret",P,j);const q=j.loose?a[r.CARETLOOSE]:a[r.CARET],Y=j.includePrerelease?"-0":"";return P.replace(q,(O,$,gA,z,X)=>{n("caret",P,O,$,gA,z,X);let sA;return k($)?sA="":k(gA)?sA=`>=${$}.0.0${Y} <${+$+1}.0.0-0`:k(z)?$==="0"?sA=`>=${$}.${gA}.0${Y} <${$}.${+gA+1}.0-0`:sA=`>=${$}.${gA}.0${Y} <${+$+1}.0.0-0`:X?(n("replaceCaret pr",X),$==="0"?gA==="0"?sA=`>=${$}.${gA}.${z}-${X} <${$}.${gA}.${+z+1}-0`:sA=`>=${$}.${gA}.${z}-${X} <${$}.${+gA+1}.0-0`:sA=`>=${$}.${gA}.${z}-${X} <${+$+1}.0.0-0`):(n("no pr"),$==="0"?gA==="0"?sA=`>=${$}.${gA}.${z}${Y} <${$}.${gA}.${+z+1}-0`:sA=`>=${$}.${gA}.${z}${Y} <${$}.${+gA+1}.0-0`:sA=`>=${$}.${gA}.${z} <${+$+1}.0.0-0`),n("caret return",sA),sA})},K=(P,j)=>(n("replaceXRanges",P,j),P.split(/\s+/).map(q=>R(q,j)).join(" ")),R=(P,j)=>{P=P.trim();const q=j.loose?a[r.XRANGELOOSE]:a[r.XRANGE];return P.replace(q,(Y,O,$,gA,z,X)=>{n("xRange",P,Y,O,$,gA,z,X);const sA=k($),rA=sA||k(gA),mA=rA||k(z),IA=mA;return O==="="&&IA&&(O=""),X=j.includePrerelease?"-0":"",sA?O===">"||O==="<"?Y="<0.0.0-0":Y="*":O&&IA?(rA&&(gA=0),z=0,O===">"?(O=">=",rA?($=+$+1,gA=0,z=0):(gA=+gA+1,z=0)):O==="<="&&(O="<",rA?$=+$+1:gA=+gA+1),O==="<"&&(X="-0"),Y=`${O+$}.${gA}.${z}${X}`):rA?Y=`>=${$}.0.0${X} <${+$+1}.0.0-0`:mA&&(Y=`>=${$}.${gA}.0${X} <${$}.${+gA+1}.0-0`),n("xRange return",Y),Y})},G=(P,j)=>(n("replaceStars",P,j),P.trim().replace(a[r.STAR],"")),J=(P,j)=>(n("replaceGTE0",P,j),P.trim().replace(a[j.includePrerelease?r.GTE0PRE:r.GTE0],"")),x=P=>(j,q,Y,O,$,gA,z,X,sA,rA,mA,IA)=>(k(Y)?q="":k(O)?q=`>=${Y}.0.0${P?"-0":""}`:k($)?q=`>=${Y}.${O}.0${P?"-0":""}`:gA?q=`>=${q}`:q=`>=${q}${P?"-0":""}`,k(sA)?X="":k(rA)?X=`<${+sA+1}.0.0-0`:k(mA)?X=`<${sA}.${+rA+1}.0-0`:IA?X=`<=${sA}.${rA}.${mA}-${IA}`:P?X=`<${sA}.${rA}.${+mA+1}-0`:X=`<=${X}`,`${q} ${X}`.trim()),H=(P,j,q)=>{for(let Y=0;Y<P.length;Y++)if(!P[Y].test(j))return!1;if(j.prerelease.length&&!q.includePrerelease){for(let Y=0;Y<P.length;Y++)if(n(P[Y].semver),P[Y].semver!==I.ANY&&P[Y].semver.prerelease.length>0){const O=P[Y].semver;if(O.major===j.major&&O.minor===j.minor&&O.patch===j.patch)return!0}return!1}return!0};return rJ}var sJ,I8;function YF(){if(I8)return sJ;I8=1;const t=Symbol("SemVer ANY");class A{static get ANY(){return t}constructor(s,B){if(B=e(B),s instanceof A){if(s.loose===!!B.loose)return s;s=s.value}s=s.trim().split(/\s+/).join(" "),n("comparator",s,B),this.options=B,this.loose=!!B.loose,this.parse(s),this.semver===t?this.value="":this.value=this.operator+this.semver.version,n("comp",this)}parse(s){const B=this.options.loose?i[g.COMPARATORLOOSE]:i[g.COMPARATOR],c=s.match(B);if(!c)throw new TypeError(`Invalid comparator: ${s}`);this.operator=c[1]!==void 0?c[1]:"",this.operator==="="&&(this.operator=""),c[2]?this.semver=new o(c[2],this.options.loose):this.semver=t}toString(){return this.value}test(s){if(n("Comparator.test",s,this.options.loose),this.semver===t||s===t)return!0;if(typeof s=="string")try{s=new o(s,this.options)}catch{return!1}return I(s,this.operator,this.semver,this.options)}intersects(s,B){if(!(s instanceof A))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new a(s.value,B).test(this.value):s.operator===""?s.value===""?!0:new a(this.value,B).test(s.semver):(B=e(B),B.includePrerelease&&(this.value==="<0.0.0-0"||s.value==="<0.0.0-0")||!B.includePrerelease&&(this.value.startsWith("<0.0.0")||s.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&s.operator.startsWith(">")||this.operator.startsWith("<")&&s.operator.startsWith("<")||this.semver.version===s.semver.version&&this.operator.includes("=")&&s.operator.includes("=")||I(this.semver,"<",s.semver,B)&&this.operator.startsWith(">")&&s.operator.startsWith("<")||I(this.semver,">",s.semver,B)&&this.operator.startsWith("<")&&s.operator.startsWith(">")))}}sJ=A;const e=hH(),{safeRe:i,t:g}=Uk(),I=nAA(),n=xF(),o=ar(),a=GB();return sJ}var CJ,n8;function HF(){if(n8)return CJ;n8=1;const t=GB();return CJ=(e,i,g)=>{try{i=new t(i,g)}catch{return!1}return i.test(e)},CJ}var BJ,o8;function LwA(){if(o8)return BJ;o8=1;const t=GB();return BJ=(e,i)=>new t(e,i).set.map(g=>g.map(I=>I.value).join(" ").trim().split(" ")),BJ}var cJ,a8;function qwA(){if(a8)return cJ;a8=1;const t=ar(),A=GB();return cJ=(i,g,I)=>{let n=null,o=null,a=null;try{a=new A(g,I)}catch{return null}return i.forEach(r=>{a.test(r)&&(!n||o.compare(r)===-1)&&(n=r,o=new t(n,I))}),n},cJ}var lJ,r8;function xwA(){if(r8)return lJ;r8=1;const t=ar(),A=GB();return lJ=(i,g,I)=>{let n=null,o=null,a=null;try{a=new A(g,I)}catch{return null}return i.forEach(r=>{a.test(r)&&(!n||o.compare(r)===1)&&(n=r,o=new t(n,I))}),n},lJ}var QJ,s8;function TwA(){if(s8)return QJ;s8=1;const t=ar(),A=GB(),e=TF();return QJ=(g,I)=>{g=new A(g,I);let n=new t("0.0.0");if(g.test(n)||(n=new t("0.0.0-0"),g.test(n)))return n;n=null;for(let o=0;o<g.set.length;++o){const a=g.set[o];let r=null;a.forEach(s=>{const B=new t(s.semver.version);switch(s.operator){case">":B.prerelease.length===0?B.patch++:B.prerelease.push(0),B.raw=B.format();case"":case">=":(!r||e(B,r))&&(r=B);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${s.operator}`)}}),r&&(!n||e(n,r))&&(n=r)}return n&&g.test(n)?n:null},QJ}var EJ,C8;function YwA(){if(C8)return EJ;C8=1;const t=GB();return EJ=(e,i)=>{try{return new t(e,i).range||"*"}catch{return null}},EJ}var uJ,B8;function yH(){if(B8)return uJ;B8=1;const t=ar(),A=YF(),{ANY:e}=A,i=GB(),g=HF(),I=TF(),n=pH(),o=DH(),a=fH();return uJ=(s,B,c,E)=>{s=new t(s,E),B=new i(B,E);let D,y,S,f,M;switch(c){case">":D=I,y=o,S=n,f=">",M=">=";break;case"<":D=n,y=a,S=I,f="<",M="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(g(s,B,E))return!1;for(let k=0;k<B.set.length;++k){const m=B.set[k];let U=null,F=null;if(m.forEach(b=>{b.semver===e&&(b=new A(">=0.0.0")),U=U||b,F=F||b,D(b.semver,U.semver,E)?U=b:S(b.semver,F.semver,E)&&(F=b)}),U.operator===f||U.operator===M||(!F.operator||F.operator===f)&&y(s,F.semver))return!1;if(F.operator===M&&S(s,F.semver))return!1}return!0},uJ}var hJ,c8;function HwA(){if(c8)return hJ;c8=1;const t=yH();return hJ=(e,i,g)=>t(e,i,">",g),hJ}var dJ,l8;function OwA(){if(l8)return dJ;l8=1;const t=yH();return dJ=(e,i,g)=>t(e,i,"<",g),dJ}var pJ,Q8;function PwA(){if(Q8)return pJ;Q8=1;const t=GB();return pJ=(e,i,g)=>(e=new t(e,g),i=new t(i,g),e.intersects(i,g)),pJ}var fJ,E8;function jwA(){if(E8)return fJ;E8=1;const t=HF(),A=NB();return fJ=(e,i,g)=>{const I=[];let n=null,o=null;const a=e.sort((c,E)=>A(c,E,g));for(const c of a)t(c,i,g)?(o=c,n||(n=c)):(o&&I.push([n,o]),o=null,n=null);n&&I.push([n,null]);const r=[];for(const[c,E]of I)c===E?r.push(c):!E&&c===a[0]?r.push("*"):E?c===a[0]?r.push(`<=${E}`):r.push(`${c} - ${E}`):r.push(`>=${c}`);const s=r.join(" || "),B=typeof i.raw=="string"?i.raw:String(i);return s.length<B.length?s:i},fJ}var DJ,u8;function ZwA(){if(u8)return DJ;u8=1;const t=GB(),A=YF(),{ANY:e}=A,i=HF(),g=NB(),I=(B,c,E={})=>{if(B===c)return!0;B=new t(B,E),c=new t(c,E);let D=!1;A:for(const y of B.set){for(const S of c.set){const f=a(y,S,E);if(D=D||f!==null,f)continue A}if(D)return!1}return!0},n=[new A(">=0.0.0-0")],o=[new A(">=0.0.0")],a=(B,c,E)=>{if(B===c)return!0;if(B.length===1&&B[0].semver===e){if(c.length===1&&c[0].semver===e)return!0;E.includePrerelease?B=n:B=o}if(c.length===1&&c[0].semver===e){if(E.includePrerelease)return!0;c=o}const D=new Set;let y,S;for(const K of B)K.operator===">"||K.operator===">="?y=r(y,K,E):K.operator==="<"||K.operator==="<="?S=s(S,K,E):D.add(K.semver);if(D.size>1)return null;let f;if(y&&S){if(f=g(y.semver,S.semver,E),f>0)return null;if(f===0&&(y.operator!==">="||S.operator!=="<="))return null}for(const K of D){if(y&&!i(K,String(y),E)||S&&!i(K,String(S),E))return null;for(const R of c)if(!i(K,String(R),E))return!1;return!0}let M,k,m,U,F=S&&!E.includePrerelease&&S.semver.prerelease.length?S.semver:!1,b=y&&!E.includePrerelease&&y.semver.prerelease.length?y.semver:!1;F&&F.prerelease.length===1&&S.operator==="<"&&F.prerelease[0]===0&&(F=!1);for(const K of c){if(U=U||K.operator===">"||K.operator===">=",m=m||K.operator==="<"||K.operator==="<=",y){if(b&&K.semver.prerelease&&K.semver.prerelease.length&&K.semver.major===b.major&&K.semver.minor===b.minor&&K.semver.patch===b.patch&&(b=!1),K.operator===">"||K.operator===">="){if(M=r(y,K,E),M===K&&M!==y)return!1}else if(y.operator===">="&&!i(y.semver,String(K),E))return!1}if(S){if(F&&K.semver.prerelease&&K.semver.prerelease.length&&K.semver.major===F.major&&K.semver.minor===F.minor&&K.semver.patch===F.patch&&(F=!1),K.operator==="<"||K.operator==="<="){if(k=s(S,K,E),k===K&&k!==S)return!1}else if(S.operator==="<="&&!i(S.semver,String(K),E))return!1}if(!K.operator&&(S||y)&&f!==0)return!1}return!(y&&m&&!S&&f!==0||S&&U&&!y&&f!==0||b||F)},r=(B,c,E)=>{if(!B)return c;const D=g(B.semver,c.semver,E);return D>0?B:D<0||c.operator===">"&&B.operator===">="?c:B},s=(B,c,E)=>{if(!B)return c;const D=g(B.semver,c.semver,E);return D<0?B:D>0||c.operator==="<"&&B.operator==="<="?c:B};return DJ=I,DJ}var yJ,h8;function WwA(){if(h8)return yJ;h8=1;const t=Uk(),A=qF(),e=ar(),i=iAA(),g=Yy(),I=wwA(),n=mwA(),o=kwA(),a=MwA(),r=NwA(),s=GwA(),B=RwA(),c=UwA(),E=NB(),D=KwA(),y=FwA(),S=dH(),f=bwA(),M=vwA(),k=TF(),m=pH(),U=gAA(),F=IAA(),b=fH(),K=DH(),R=nAA(),G=_wA(),J=YF(),x=GB(),H=HF(),P=LwA(),j=qwA(),q=xwA(),Y=TwA(),O=YwA(),$=yH(),gA=HwA(),z=OwA(),X=PwA(),sA=jwA(),rA=ZwA();return yJ={parse:g,valid:I,clean:n,inc:o,diff:a,major:r,minor:s,patch:B,prerelease:c,compare:E,rcompare:D,compareLoose:y,compareBuild:S,sort:f,rsort:M,gt:k,lt:m,eq:U,neq:F,gte:b,lte:K,cmp:R,coerce:G,Comparator:J,Range:x,satisfies:H,toComparators:P,maxSatisfying:j,minSatisfying:q,minVersion:Y,validRange:O,outside:$,gtr:gA,ltr:z,intersects:X,simplifyRange:sA,subset:rA,SemVer:e,re:t.re,src:t.src,tokens:t.t,SEMVER_SPEC_VERSION:A.SEMVER_SPEC_VERSION,RELEASE_TYPES:A.RELEASE_TYPES,compareIdentifiers:i.compareIdentifiers,rcompareIdentifiers:i.rcompareIdentifiers},yJ}var zwA=WwA();const hf=Td(zwA),VwA={},GU="https://updates.dicelounge.app";function XwA(){const A=String("ceelo").trim().toLowerCase();let e=A==="craps"||A==="ceelo"||A==="poker"||A==="skills"?`${GU}/${A}/manifest.json`:`${GU}/manifest.json`;e=e.replace(/manifest\.jjson$/i,"manifest.json");try{}catch{}return e}function GN(){return Date.now()}function yw(){try{const A=globalThis.Capacitor?.getPlatform?.();return A==="ios"||A==="android"}catch{return!1}}function d8(t){if(!t)return"0.0.0";let A=t.replace(/^v/i,"").trim();const e=/^(\d+)\.0(\d+)$/.exec(A);if(e)return`${e[1]}.0.${parseInt(e[2],10)}`;const i=/^(\d+)\.(\d+)$/.exec(A);return i?`${i[1]}.${i[2]}.0`:A}function $wA(t){try{const A=new URL(t);return`${A.protocol}//${A.host}`===GU}catch{return!1}}async function AmA(t){if(!$wA(t))throw new Error("Manifest origin not allowed");const A=await fetch(t,{cache:"no-store",redirect:"error"});if(!A.ok)throw new Error(`HTTP ${A.status}`);return await A.json()}async function emA(t){const A=await t.arrayBuffer(),e=await crypto.subtle.digest("SHA-256",A);return Array.from(new Uint8Array(e)).map(i=>i.toString(16).padStart(2,"0")).join("")}const p8=globalThis.OTA_PUBLIC_KEY_B64||VwA?.VITE_OTA_PUBKEY||ABA,f8=!0,tmA=50*1024*1024,imA=/^(\d{12,14}|v?\d+\.\d+\.\d+(?:[-+].+)?)$/;async function gmA(){try{let t=Uint8Array.from(atob(p8),A=>A.charCodeAt(0));if(t.length>40&&t[0]===48)try{const A=t.slice(-32);A.length===32&&(t=A)}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 ImA=gmA();async function nmA(t,A){if(!t||!t.startsWith("ed25519:"))return!1;const e=t.slice(8);let i;try{i=Uint8Array.from(atob(e),o=>o.charCodeAt(0))}catch{return!1}const g=await ImA;if(!g)return!1;const I=`${A.webVersion}|${A.minNativeVersion}|${A.url}|${A.sha256}`,n=new TextEncoder().encode(I);try{const o=new Uint8Array(i);if(g.legacyRaw){try{}catch{}return!0}return await crypto.subtle.verify({name:"Ed25519"},g,o,n)}catch{return!1}}class omA{nativeVersion=null;activeWebVersion=null;pendingUpdateVersion=null;previousWebVersion=null;lastAppliedSha256=null;async init(){if(!yw())return;const A=await er.getInfo();this.nativeVersion=A.version;const e=await nr.get({key:"ota_state"});if(e.value)try{const g=JSON.parse(e.value);this.activeWebVersion=g.activeWebVersion,this.pendingUpdateVersion=g.pendingUpdateVersion,this.previousWebVersion=g.previousWebVersion,this.lastAppliedSha256=g.lastAppliedSha256??null}catch{}const i=await Ll.current().catch(()=>null);i?.version&&!this.activeWebVersion&&(this.activeWebVersion=i.version,await this.writePersist()),i?.bundle?.status==="builtin"&&this.activeWebVersion&&(this.activeWebVersion,this.activeWebVersion=null,this.pendingUpdateVersion=null,await this.writePersist(),await this.clearCaches()),this.nativeVersion,this.activeWebVersion}getVersions(){return{nativeVersion:this.nativeVersion,webVersion:this.activeWebVersion}}async checkForUpdate(){let A=this.nativeVersion||null;if(!A&&yw())try{A=(await er.getInfo()).version||null,this.nativeVersion=A}catch(e){e?.message}A=A||"0.0.0";try{const e=XwA(),g=(await AmA(e))?.latest;if(!g?.webVersion||!g?.minNativeVersion||!g?.url||!g?.sha256)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:A,currentWebVersion:this.activeWebVersion};try{g.webVersion,g.sig,g.sig&&g.sig.slice(0,18),(()=>{try{return new URL(g.url).host}catch{return"parse_err"}})()}catch{}if(f8&&!g.sig)return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:A,currentWebVersion:this.activeWebVersion};if(!imA.test(g.webVersion))return g.webVersion,{available:!1,reason:"INVALID_MANIFEST",nativeVersion:A,currentWebVersion:this.activeWebVersion};if(!/^https:\/\//.test(g.url))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:A,currentWebVersion:this.activeWebVersion};if(!/^[a-f0-9]{64}$/i.test(g.sha256))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:A,currentWebVersion:this.activeWebVersion};const I=d8(A),n=d8(g.minNativeVersion),o=hf.coerce(n)||"0.0.0",a=hf.coerce(I)||"0.0.0",r=hf.gte(a,o);if(g.minNativeVersion,!r)return this.activeWebVersion,g.webVersion,{available:!1,reason:"INCOMPATIBLE_NATIVE",nativeVersion:A,currentWebVersion:this.activeWebVersion};if(this.pendingUpdateVersion&&this.pendingUpdateVersion===g.webVersion)return this.activeWebVersion,g.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:A,currentWebVersion:this.activeWebVersion};const s=this.activeWebVersion;if(s&&s===g.webVersion)return g.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:A,currentWebVersion:s};const B=s?hf.valid(s):null,c=hf.valid(g.webVersion);let E=!0;if(s)if(B&&c)E=hf.gt(g.webVersion,s);else if(/^\d+$/.test(g.webVersion)&&/^\d+$/.test(s)){const S=Number(g.webVersion),f=Number(s);!Number.isNaN(S)&&!Number.isNaN(f)&&(E=S>f)}else E=g.webVersion>s;if(s&&!E)return g.webVersion,{available:!1,reason:"NO_NEW_VERSION",nativeVersion:A,currentWebVersion:s};const D={...g};return D.webVersion,{available:!0,reason:"OK",release:D,nativeVersion:A,currentWebVersion:s}}catch(e){return this.activeWebVersion,e?.message||String(e),{available:!1,reason:"NETWORK_ERROR",nativeVersion:A,currentWebVersion:this.activeWebVersion}}}async downloadUpdate(A,e){if(!yw())throw new Error("OTA only applies on native platforms");e?.({stage:"downloading",percent:0});const i=new AbortController,g=setTimeout(()=>i.abort(),3e4),I=await fetch(A.url,{cache:"no-store",redirect:"error",signal:i.signal});if(clearTimeout(g),!I.ok||!I.body)throw new Error(`Download failed: ${I.status}`);const n=I.body.getReader(),o=[];let a=0;const r=Number(I.headers.get("content-length")||0);for(;;){const{done:D,value:y}=await n.read();if(D)break;if(y){if(o.push(y),a+=y.byteLength,a>tmA)throw new Error("SIZE_LIMIT");r>0&&e?.({stage:"downloading",bytes:a,total:r,percent:Math.round(a/r*100)})}}const s=new Blob(o,{type:"application/zip"});if(e?.({stage:"verifying"}),(await emA(s)).toLowerCase()!==A.sha256.toLowerCase())throw A.sha256,new Error("SHA256_MISMATCH");try{const D=new URL(A.url);if(`${D.protocol}//${D.host}`!==GU)throw new Error("ORIGIN_MISMATCH")}catch{throw new Error("ORIGIN_MISMATCH")}const c=!!A.sig;if(!await nmA(A.sig,A)){const D=c?"SIG_INVALID":"SIG_MISSING";if(D==="SIG_MISSING"&&f8)try{Object.keys(A),A.webVersion,A.url,A.sha256?.length}catch{}throw new Error(D)}return{blob:s}}async clearCaches(){try{if("caches"in window){const A=await caches.keys();await Promise.all(A.map(e=>caches.delete(e))),A.length}}catch{}try{if("serviceWorker"in navigator){const A=await navigator.serviceWorker.getRegistrations();await Promise.all(A.map(e=>e.unregister())),A.length}}catch{}}async applyUpdate(A,e){if(!yw())throw new Error("OTA only applies on native platforms");const i=GN();A.webVersion,this.previousWebVersion=this.activeWebVersion,this.pendingUpdateVersion=A.webVersion,this.lastAppliedSha256=A.sha256,await this.writePersist(),await this.clearCaches();const g=6e4;try{A.url,A.webVersion;const I=Ll.download({url:A.url,version:A.webVersion}),n=new Promise((a,r)=>setTimeout(()=>r(new Error("OTA_APPLY_TIMEOUT")),g)),o=await Promise.race([I,n]);o.id,await Ll.set({id:o.id}),GN()-i,this.previousWebVersion,A.webVersion}catch(I){throw I?.message||String(I),A.url,I}}async healthCheck(){if(!yw())return!0;const A=this.pendingUpdateVersion;if(!A)return!0;if(await this.tryFetchHealth(2e3).catch(()=>!1)||await this.waitForAppMounted(5e3).catch(()=>!1)){this.activeWebVersion=A,this.pendingUpdateVersion=null;try{await Ll.notifyAppReady()}catch{}await this.writePersist();try{const i=window;i.__OTA_ACTIVATED__=!0,i.__OTA_ACTIVATED_VERSION__=this.activeWebVersion;try{window.dispatchEvent(new CustomEvent("ota:activated",{detail:{webVersion:this.activeWebVersion}}))}catch{}}catch{}return this.activeWebVersion,this.cleanupOldBundles(),!0}return await this.rollbackIfBootFails(),!1}async tryFetchHealth(A){try{const e=new AbortController,i=setTimeout(()=>e.abort(),A),g=await fetch("/health",{signal:e.signal,cache:"no-store"});return clearTimeout(i),g.ok}catch{return!1}}async waitForAppMounted(A){const e=GN(),i=window;for(;GN()-e<A;){if(i.__APP_MOUNTED__)return!0;await new Promise(g=>setTimeout(g,100))}return!1}async rollbackIfBootFails(){try{await this.clearCaches(),await Ll.reset(),this.pendingUpdateVersion=null,this.activeWebVersion=this.previousWebVersion??null,await this.writePersist(),this.activeWebVersion,location.reload()}catch(A){A?.message}}async cleanupOldBundles(){try{const A=await Ll.list(),i=(await Ll.current().catch(()=>null))?.bundle?.id;for(const g of A.bundles||[])if(g.id&&g.id!==i&&g.status!=="builtin")try{await Ll.delete({id:g.id}),g.id}catch{}}catch(A){A?.message}}async writePersist(){const A={activeWebVersion:this.activeWebVersion??null,pendingUpdateVersion:this.pendingUpdateVersion??null,previousWebVersion:this.previousWebVersion??null,lastAppliedSha256:this.lastAppliedSha256??null};await nr.set({key:"ota_state",value:JSON.stringify(A)})}}const eC=new omA,D8="ota:lastCheckAt",amA=18e4;function rmA(){try{const t=globalThis.__E2E_OTA_COOLDOWN_MS;if(typeof t=="number"&&t>=0)return t}catch{}return amA}function smA(){const[t,A]=p.useState(eC.getVersions()),[e,i]=p.useState(!1),[g,I]=p.useState(null),[n,o]=p.useState({stage:"idle"}),a=p.useRef(null);p.useEffect(()=>{A(eC.getVersions())},[]);const r=p.useCallback(async()=>{i(!0);try{try{const E=Date.now(),D=await EB.get(D8),y=D?Number(D):0;if(y&&E-y<rmA()){i(!1);return}}catch{}const c=await eC.checkForUpdate();if(c.available&&c.release){I(c),a.current=c.release;try{const E=window;if(!E.__OTA_AUTO_APPLY_RUNNING__){E.__OTA_AUTO_APPLY_RUNNING__=!0,o({stage:"downloading",percent:0});const{blob:D}=await eC.downloadUpdate(c.release,y=>o(y));o({stage:"applying"}),await eC.applyUpdate(c.release,D)}}catch(E){o({stage:"error",error:E?.message||"Update failed"});try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}}else c.reason==="NO_NEW_VERSION"?(I(null),a.current=null):I(c);try{await EB.set(D8,String(Date.now()))}catch{}}finally{i(!1)}},[]),s=p.useCallback(async()=>{const c=a.current;if(!c)return;o({stage:"downloading",percent:0});const{blob:E}=await eC.downloadUpdate(c,D=>o(D));o({stage:"applying"}),await eC.applyUpdate(c,E)},[]),B=p.useCallback(()=>{o({stage:"idle"})},[]);return p.useEffect(()=>{r()},[r]),{current:t,checking:e,available:g,progress:n,applyNow:s,later:B}}function CmA({available:t,progress:A,applyNow:e,later:i}){if(!Li.isNativePlatform()||!t?.available||!t.release)return null;const g=t.release,I=A.percent??0,n=A.stage!=="error",o=A.stage==="downloading"?`Downloading update… ${I}%`:A.stage==="verifying"?"Verifying update…":A.stage==="applying"?"Installing update…":A.stage==="error"?`Update failed: ${A.error||"Unknown error"}`:"Preparing update…";return Q.jsx("div",{className:"ota-overlay",children:Q.jsxs("div",{className:"ota-overlay-content",children:[Q.jsx("div",{className:"ota-overlay-icon","aria-hidden":!0,children:"🔄"}),Q.jsxs("h2",{className:"ota-overlay-title",children:["Updating to ",g.webVersion]}),Q.jsx("p",{className:"ota-overlay-status",children:o}),n&&Q.jsx("div",{className:"ota-overlay-progress",children:Q.jsx("div",{className:"ota-overlay-progress-bar",style:{width:`${Math.min(100,I)}%`}})}),A.stage==="error"&&Q.jsx("button",{className:"ota-overlay-retry",onClick:e,children:"Retry"})]})})}function BmA({cooldownMs:t=3e4}){const A=p.useRef(!1);return p.useEffect(()=>{let e=[];async function i(n){if(!A.current){A.current=!0;try{const o=await eC.checkForUpdate();if(o.available&&o.release){try{const r=window;if(r.__OTA_AUTO_APPLY_RUNNING__)return;r.__OTA_AUTO_APPLY_RUNNING__=!0}catch{}const{blob:a}=await eC.downloadUpdate(o.release,r=>{});await eC.applyUpdate(o.release,a),setTimeout(()=>{try{window.location.reload()}catch{}},500)}}catch(o){o?.message;try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}finally{A.current=!1}}}(async()=>{try{const n=await er.addListener("appStateChange",o=>{o.isActive&&i("native_foreground")});e.push(()=>{try{n.remove()}catch{}})}catch{}})();const g=()=>{document.visibilityState==="visible"&&i()};document.addEventListener("visibilitychange",g),e.push(()=>document.removeEventListener("visibilitychange",g));const I=setTimeout(()=>i(),4e3);return e.push(()=>clearTimeout(I)),()=>{e.forEach(n=>{try{n()}catch{}})}},[t]),null}function cmA(){const t=p.useRef(0),A=5e3;return p.useEffect(()=>{if(Li.getPlatform()!=="ios")return;const e=[];async function i(I){const n=Date.now();if(!(n-t.current<A)){t.current=n;try{const o=await Nn();if(!o)return;const a=String(n0??"https://dicelounge.app").replace(/\/+$/,"");await fetch(`${a}/api/push/clear-badge`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${o}`}})}catch{}}}(async()=>{try{const I=await er.addListener("appStateChange",n=>{n.isActive&&i("native_foreground")});e.push(()=>{try{I.remove()}catch{}})}catch{}})();const g=setTimeout(()=>i(),1e3);return e.push(()=>clearTimeout(g)),()=>{e.forEach(I=>{try{I()}catch{}})}},[]),null}const lmA="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 Cd(){return Q.jsxs("footer",{className:"lp-footer",children:[Q.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[Q.jsx(Yo,{to:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx(Yo,{to:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx(Yo,{to:"/terms",className:"lp-footer__link",children:"Terms of Use"}),Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx(Yo,{to:"/support",className:"lp-footer__link",children:"Support"}),Q.jsxs("span",{className:"lp-store-links",children:[Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx("span",{className:"lp-coming",children:"Mobile App Coming Soon"})]})]}),Q.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),Q.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]})}const gT=""+new URL("logo-Bd_WWMIU.webp",import.meta.url).href,QmA=""+new URL("ceelo-icon-DBUGq3gk.webp",import.meta.url).href,EmA=""+new URL("craps-icon-Cxbu5IDi.webp",import.meta.url).href,umA=""+new URL("poker-icon-D9lS6jix.webp",import.meta.url).href,hmA=""+new URL("skills-icon-BWMGnrDl.webp",import.meta.url).href,dmA=""+new URL("zentara-icon-PkjJTbqN.webp",import.meta.url).href;/*!
 * Font Awesome Free 7.0.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.
 */function IT(t,A){(A==null||A>t.length)&&(A=t.length);for(var e=0,i=Array(A);e<A;e++)i[e]=t[e];return i}function pmA(t){if(Array.isArray(t))return t}function fmA(t){if(Array.isArray(t))return IT(t)}function DmA(t,A){if(!(t instanceof A))throw new TypeError("Cannot call a class as a function")}function ymA(t,A){for(var e=0;e<A.length;e++){var i=A[e];i.enumerable=i.enumerable||!1,i.configurable=!0,"value"in i&&(i.writable=!0),Object.defineProperty(t,oAA(i.key),i)}}function SmA(t,A,e){return A&&ymA(t.prototype,A),Object.defineProperty(t,"prototype",{writable:!1}),t}function hR(t,A){var e=typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(!e){if(Array.isArray(t)||(e=SH(t))||A){e&&(t=e);var i=0,g=function(){};return{s:g,n:function(){return i>=t.length?{done:!0}:{done:!1,value:t[i++]}},e:function(a){throw a},f:g}}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,n=!0,o=!1;return{s:function(){e=e.call(t)},n:function(){var a=e.next();return n=a.done,a},e:function(a){o=!0,I=a},f:function(){try{n||e.return==null||e.return()}finally{if(o)throw I}}}}function Bg(t,A,e){return(A=oAA(A))in t?Object.defineProperty(t,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[A]=e,t}function wmA(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function mmA(t,A){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var i,g,I,n,o=[],a=!0,r=!1;try{if(I=(e=e.call(t)).next,A===0){if(Object(e)!==e)return;a=!1}else for(;!(a=(i=I.call(e)).done)&&(o.push(i.value),o.length!==A);a=!0);}catch(s){r=!0,g=s}finally{try{if(!a&&e.return!=null&&(n=e.return(),Object(n)!==n))return}finally{if(r)throw g}}return o}}function kmA(){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 MmA(){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 y8(t,A){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);A&&(i=i.filter(function(g){return Object.getOwnPropertyDescriptor(t,g).enumerable})),e.push.apply(e,i)}return e}function Bt(t){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?y8(Object(e),!0).forEach(function(i){Bg(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):y8(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}function OF(t,A){return pmA(t)||mmA(t,A)||SH(t,A)||kmA()}function DB(t){return fmA(t)||wmA(t)||SH(t)||MmA()}function NmA(t,A){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,A);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(t)}function oAA(t){var A=NmA(t,"string");return typeof A=="symbol"?A:A+""}function RU(t){"@babel/helpers - typeof";return RU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},RU(t)}function SH(t,A){if(t){if(typeof t=="string")return IT(t,A);var e={}.toString.call(t).slice(8,-1);return e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set"?Array.from(t):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?IT(t,A):void 0}}var S8=function(){},wH={},aAA={},rAA=null,sAA={mark:S8,measure:S8};try{typeof window<"u"&&(wH=window),typeof document<"u"&&(aAA=document),typeof MutationObserver<"u"&&(rAA=MutationObserver),typeof performance<"u"&&(sAA=performance)}catch{}var GmA=wH.navigator||{},w8=GmA.userAgent,m8=w8===void 0?"":w8,Au=wH,pI=aAA,k8=rAA,RN=sAA;Au.document;var NQ=!!pI.documentElement&&!!pI.head&&typeof pI.addEventListener=="function"&&typeof pI.createElement=="function",CAA=~m8.indexOf("MSIE")||~m8.indexOf("Trident/"),SJ,RmA=/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)?[\-\ ]/,UmA=/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,BAA={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"}},KmA={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},cAA=["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"],Da="classic",Kk="duotone",lAA="sharp",QAA="sharp-duotone",EAA="chisel",uAA="etch",hAA="jelly",dAA="jelly-duo",pAA="jelly-fill",fAA="notdog",DAA="notdog-duo",yAA="slab",SAA="slab-press",wAA="thumbprint",mAA="whiteboard",FmA="Classic",bmA="Duotone",vmA="Sharp",_mA="Sharp Duotone",JmA="Chisel",LmA="Etch",qmA="Jelly",xmA="Jelly Duo",TmA="Jelly Fill",YmA="Notdog",HmA="Notdog Duo",OmA="Slab",PmA="Slab Press",jmA="Thumbprint",ZmA="Whiteboard",kAA=[Da,Kk,lAA,QAA,EAA,uAA,hAA,dAA,pAA,fAA,DAA,yAA,SAA,wAA,mAA];SJ={},Bg(Bg(Bg(Bg(Bg(Bg(Bg(Bg(Bg(Bg(SJ,Da,FmA),Kk,bmA),lAA,vmA),QAA,_mA),EAA,JmA),uAA,LmA),hAA,qmA),dAA,xmA),pAA,TmA),fAA,YmA),Bg(Bg(Bg(Bg(Bg(SJ,DAA,HmA),yAA,OmA),SAA,PmA),wAA,jmA),mAA,ZmA);var WmA={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"}},zmA={"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"}},VmA=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}]]),XmA={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"}},MAA=["fak","fa-kit","fakd","fa-kit-duotone"],M8={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},$mA=["kit"],A0A="kit",e0A="kit-duotone",t0A="Kit",i0A="Kit Duotone";Bg(Bg({},A0A,t0A),e0A,i0A);var g0A={kit:{"fa-kit":"fak"}},I0A={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},n0A={kit:{fak:"fa-kit"}},N8={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}},wJ,UN={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},o0A=["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"],a0A="classic",r0A="duotone",s0A="sharp",C0A="sharp-duotone",B0A="chisel",c0A="etch",l0A="jelly",Q0A="jelly-duo",E0A="jelly-fill",u0A="notdog",h0A="notdog-duo",d0A="slab",p0A="slab-press",f0A="thumbprint",D0A="whiteboard",y0A="Classic",S0A="Duotone",w0A="Sharp",m0A="Sharp Duotone",k0A="Chisel",M0A="Etch",N0A="Jelly",G0A="Jelly Duo",R0A="Jelly Fill",U0A="Notdog",K0A="Notdog Duo",F0A="Slab",b0A="Slab Press",v0A="Thumbprint",_0A="Whiteboard";wJ={},Bg(Bg(Bg(Bg(Bg(Bg(Bg(Bg(Bg(Bg(wJ,a0A,y0A),r0A,S0A),s0A,w0A),C0A,m0A),B0A,k0A),c0A,M0A),l0A,N0A),Q0A,G0A),E0A,R0A),u0A,U0A),Bg(Bg(Bg(Bg(Bg(wJ,h0A,K0A),d0A,F0A),p0A,b0A),f0A,v0A),D0A,_0A);var J0A="kit",L0A="kit-duotone",q0A="Kit",x0A="Kit Duotone";Bg(Bg({},J0A,q0A),L0A,x0A);var T0A={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"}},Y0A={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"]},nT={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"}},H0A=["fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands","fa-semibold"],NAA=["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(o0A,H0A),O0A=["solid","regular","light","thin","duotone","brands","semibold"],GAA=[1,2,3,4,5,6,7,8,9,10],P0A=GAA.concat([11,12,13,14,15,16,17,18,19,20]),j0A=["aw","fw","pull-left","pull-right"],Z0A=[].concat(DB(Object.keys(Y0A)),O0A,j0A,["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",UN.GROUP,UN.SWAP_OPACITY,UN.PRIMARY,UN.SECONDARY]).concat(GAA.map(function(t){return"".concat(t,"x")})).concat(P0A.map(function(t){return"w-".concat(t)})),W0A={"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"}},QQ="___FONT_AWESOME___",oT=16,RAA="fa",UAA="svg-inline--fa",Sd="data-fa-i2svg",aT="data-fa-pseudo-element",z0A="data-fa-pseudo-element-pending",mH="data-prefix",kH="data-icon",G8="fontawesome-i2svg",V0A="async",X0A=["HTML","HEAD","STYLE","SCRIPT"],KAA=["::before","::after",":before",":after"],FAA=function(){try{return!0}catch{return!1}}();function Fk(t){return new Proxy(t,{get:function(e,i){return i in e?e[i]:e[Da]}})}var bAA=Bt({},BAA);bAA[Da]=Bt(Bt(Bt(Bt({},{"fa-duotone":"duotone"}),BAA[Da]),M8.kit),M8["kit-duotone"]);var $0A=Fk(bAA),rT=Bt({},XmA);rT[Da]=Bt(Bt(Bt(Bt({},{duotone:"fad"}),rT[Da]),N8.kit),N8["kit-duotone"]);var R8=Fk(rT),sT=Bt({},nT);sT[Da]=Bt(Bt({},sT[Da]),n0A.kit);var vAA=Fk(sT),CT=Bt({},T0A);CT[Da]=Bt(Bt({},CT[Da]),g0A.kit);Fk(CT);var AkA=RmA,_AA="fa-layers-text",ekA=UmA,tkA=Bt({},WmA);Fk(tkA);var ikA=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],mJ=KmA,gkA=[].concat(DB($mA),DB(Z0A)),Um=Au.FontAwesomeConfig||{};function IkA(t){var A=pI.querySelector("script["+t+"]");if(A)return A.getAttribute(t)}function nkA(t){return t===""?!0:t==="false"?!1:t==="true"?!0:t}if(pI&&typeof pI.querySelector=="function"){var okA=[["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"]];okA.forEach(function(t){var A=OF(t,2),e=A[0],i=A[1],g=nkA(IkA(e));g!=null&&(Um[i]=g)})}var JAA={styleDefault:"solid",familyDefault:Da,cssPrefix:RAA,replacementClass:UAA,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};Um.familyPrefix&&(Um.cssPrefix=Um.familyPrefix);var Ay=Bt(Bt({},JAA),Um);Ay.autoReplaceSvg||(Ay.observeMutations=!1);var zt={};Object.keys(JAA).forEach(function(t){Object.defineProperty(zt,t,{enumerable:!0,set:function(e){Ay[t]=e,Km.forEach(function(i){return i(zt)})},get:function(){return Ay[t]}})});Object.defineProperty(zt,"familyPrefix",{enumerable:!0,set:function(A){Ay.cssPrefix=A,Km.forEach(function(e){return e(zt)})},get:function(){return Ay.cssPrefix}});Au.FontAwesomeConfig=zt;var Km=[];function akA(t){return Km.push(t),function(){Km.splice(Km.indexOf(t),1)}}var df=oT,Kc={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function rkA(t){if(!(!t||!NQ)){var A=pI.createElement("style");A.setAttribute("type","text/css"),A.innerHTML=t;for(var e=pI.head.childNodes,i=null,g=e.length-1;g>-1;g--){var I=e[g],n=(I.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(n)>-1&&(i=I)}return pI.head.insertBefore(A,i),t}}var skA="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function U8(){for(var t=12,A="";t-- >0;)A+=skA[Math.random()*62|0];return A}function Hy(t){for(var A=[],e=(t||[]).length>>>0;e--;)A[e]=t[e];return A}function MH(t){return t.classList?Hy(t.classList):(t.getAttribute("class")||"").split(" ").filter(function(A){return A})}function LAA(t){return"".concat(t).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function CkA(t){return Object.keys(t||{}).reduce(function(A,e){return A+"".concat(e,'="').concat(LAA(t[e]),'" ')},"").trim()}function PF(t){return Object.keys(t||{}).reduce(function(A,e){return A+"".concat(e,": ").concat(t[e].trim(),";")},"")}function NH(t){return t.size!==Kc.size||t.x!==Kc.x||t.y!==Kc.y||t.rotate!==Kc.rotate||t.flipX||t.flipY}function BkA(t){var A=t.transform,e=t.containerWidth,i=t.iconWidth,g={transform:"translate(".concat(e/2," 256)")},I="translate(".concat(A.x*32,", ").concat(A.y*32,") "),n="scale(".concat(A.size/16*(A.flipX?-1:1),", ").concat(A.size/16*(A.flipY?-1:1),") "),o="rotate(".concat(A.rotate," 0 0)"),a={transform:"".concat(I," ").concat(n," ").concat(o)},r={transform:"translate(".concat(i/2*-1," -256)")};return{outer:g,inner:a,path:r}}function ckA(t){var A=t.transform,e=t.width,i=e===void 0?oT:e,g=t.height,I=g===void 0?oT:g,n="";return CAA?n+="translate(".concat(A.x/df-i/2,"em, ").concat(A.y/df-I/2,"em) "):n+="translate(calc(-50% + ".concat(A.x/df,"em), calc(-50% + ").concat(A.y/df,"em)) "),n+="scale(".concat(A.size/df*(A.flipX?-1:1),", ").concat(A.size/df*(A.flipY?-1:1),") "),n+="rotate(".concat(A.rotate,"deg) "),n}var lkA=`: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 {
  height: 1em;
  width: 1.25em;
}
.svg-inline--fa.fa-stack-2x {
  height: 2em;
  width: 2.5em;
}

.fa-stack-1x,
.fa-stack-2x {
  bottom: 0;
  left: 0;
  margin: auto;
  position: absolute;
  right: 0;
  top: 0;
  z-index: var(--fa-stack-z-index, auto);
}`;function qAA(){var t=RAA,A=UAA,e=zt.cssPrefix,i=zt.replacementClass,g=lkA;if(e!==t||i!==A){var I=new RegExp("\\.".concat(t,"\\-"),"g"),n=new RegExp("\\--".concat(t,"\\-"),"g"),o=new RegExp("\\.".concat(A),"g");g=g.replace(I,".".concat(e,"-")).replace(n,"--".concat(e,"-")).replace(o,".".concat(i))}return g}var K8=!1;function kJ(){zt.autoAddCss&&!K8&&(rkA(qAA()),K8=!0)}var QkA={mixout:function(){return{dom:{css:qAA,insertCss:kJ}}},hooks:function(){return{beforeDOMElementCreation:function(){kJ()},beforeI2svg:function(){kJ()}}}},EQ=Au||{};EQ[QQ]||(EQ[QQ]={});EQ[QQ].styles||(EQ[QQ].styles={});EQ[QQ].hooks||(EQ[QQ].hooks={});EQ[QQ].shims||(EQ[QQ].shims=[]);var BB=EQ[QQ],xAA=[],TAA=function(){pI.removeEventListener("DOMContentLoaded",TAA),UU=1,xAA.map(function(A){return A()})},UU=!1;NQ&&(UU=(pI.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(pI.readyState),UU||pI.addEventListener("DOMContentLoaded",TAA));function EkA(t){NQ&&(UU?setTimeout(t,0):xAA.push(t))}function bk(t){var A=t.tag,e=t.attributes,i=e===void 0?{}:e,g=t.children,I=g===void 0?[]:g;return typeof t=="string"?LAA(t):"<".concat(A," ").concat(CkA(i),">").concat(I.map(bk).join(""),"</").concat(A,">")}function F8(t,A,e){if(t&&t[A]&&t[A][e])return{prefix:A,iconName:e,icon:t[A][e]}}var MJ=function(A,e,i,g){var I=Object.keys(A),n=I.length,o=e,a,r,s;for(i===void 0?(a=1,s=A[I[0]]):(a=0,s=i);a<n;a++)r=I[a],s=o(s,A[r],r,A);return s};function YAA(t){return DB(t).length!==1?null:t.codePointAt(0).toString(16)}function b8(t){return Object.keys(t).reduce(function(A,e){var i=t[e],g=!!i.icon;return g?A[i.iconName]=i.icon:A[e]=i,A},{})}function HAA(t,A){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},i=e.skipHooks,g=i===void 0?!1:i,I=b8(A);typeof BB.hooks.addPack=="function"&&!g?BB.hooks.addPack(t,b8(A)):BB.styles[t]=Bt(Bt({},BB.styles[t]||{}),I),t==="fas"&&HAA("fa",A)}var f0=BB.styles,ukA=BB.shims,OAA=Object.keys(vAA),hkA=OAA.reduce(function(t,A){return t[A]=Object.keys(vAA[A]),t},{}),GH=null,PAA={},jAA={},ZAA={},WAA={},zAA={};function dkA(t){return~gkA.indexOf(t)}function pkA(t,A){var e=A.split("-"),i=e[0],g=e.slice(1).join("-");return i===t&&g!==""&&!dkA(g)?g:null}var VAA=function(){var A=function(I){return MJ(f0,function(n,o,a){return n[a]=MJ(o,I,{}),n},{})};PAA=A(function(g,I,n){if(I[3]&&(g[I[3]]=n),I[2]){var o=I[2].filter(function(a){return typeof a=="number"});o.forEach(function(a){g[a.toString(16)]=n})}return g}),jAA=A(function(g,I,n){if(g[n]=n,I[2]){var o=I[2].filter(function(a){return typeof a=="string"});o.forEach(function(a){g[a]=n})}return g}),zAA=A(function(g,I,n){var o=I[2];return g[n]=n,o.forEach(function(a){g[a]=n}),g});var e="far"in f0||zt.autoFetchSvg,i=MJ(ukA,function(g,I){var n=I[0],o=I[1],a=I[2];return o==="far"&&!e&&(o="fas"),typeof n=="string"&&(g.names[n]={prefix:o,iconName:a}),typeof n=="number"&&(g.unicodes[n.toString(16)]={prefix:o,iconName:a}),g},{names:{},unicodes:{}});ZAA=i.names,WAA=i.unicodes,GH=jF(zt.styleDefault,{family:zt.familyDefault})};akA(function(t){GH=jF(t.styleDefault,{family:zt.familyDefault})});VAA();function RH(t,A){return(PAA[t]||{})[A]}function fkA(t,A){return(jAA[t]||{})[A]}function Zh(t,A){return(zAA[t]||{})[A]}function XAA(t){return ZAA[t]||{prefix:null,iconName:null}}function DkA(t){var A=WAA[t],e=RH("fas",t);return A||(e?{prefix:"fas",iconName:e}:null)||{prefix:null,iconName:null}}function eu(){return GH}var $AA=function(){return{prefix:null,iconName:null,rest:[]}};function ykA(t){var A=Da,e=OAA.reduce(function(i,g){return i[g]="".concat(zt.cssPrefix,"-").concat(g),i},{});return kAA.forEach(function(i){(t.includes(e[i])||t.some(function(g){return hkA[i].includes(g)}))&&(A=i)}),A}function jF(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=A.family,i=e===void 0?Da:e,g=$0A[i][t];if(i===Kk&&!t)return"fad";var I=R8[i][t]||R8[i][g],n=t in BB.styles?t:null,o=I||n||null;return o}function SkA(t){var A=[],e=null;return t.forEach(function(i){var g=pkA(zt.cssPrefix,i);g?e=g:i&&A.push(i)}),{iconName:e,rest:A}}function v8(t){return t.sort().filter(function(A,e,i){return i.indexOf(A)===e})}var _8=NAA.concat(MAA);function ZF(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=A.skipLookups,i=e===void 0?!1:e,g=null,I=v8(t.filter(function(E){return _8.includes(E)})),n=v8(t.filter(function(E){return!_8.includes(E)})),o=I.filter(function(E){return g=E,!cAA.includes(E)}),a=OF(o,1),r=a[0],s=r===void 0?null:r,B=ykA(I),c=Bt(Bt({},SkA(n)),{},{prefix:jF(s,{family:B})});return Bt(Bt(Bt({},c),MkA({values:t,family:B,styles:f0,config:zt,canonical:c,givenPrefix:g})),wkA(i,g,c))}function wkA(t,A,e){var i=e.prefix,g=e.iconName;if(t||!i||!g)return{prefix:i,iconName:g};var I=A==="fa"?XAA(g):{},n=Zh(i,g);return g=I.iconName||n||g,i=I.prefix||i,i==="far"&&!f0.far&&f0.fas&&!zt.autoFetchSvg&&(i="fas"),{prefix:i,iconName:g}}var mkA=kAA.filter(function(t){return t!==Da||t!==Kk}),kkA=Object.keys(nT).filter(function(t){return t!==Da}).map(function(t){return Object.keys(nT[t])}).flat();function MkA(t){var A=t.values,e=t.family,i=t.canonical,g=t.givenPrefix,I=g===void 0?"":g,n=t.styles,o=n===void 0?{}:n,a=t.config,r=a===void 0?{}:a,s=e===Kk,B=A.includes("fa-duotone")||A.includes("fad"),c=r.familyDefault==="duotone",E=i.prefix==="fad"||i.prefix==="fa-duotone";if(!s&&(B||c||E)&&(i.prefix="fad"),(A.includes("fa-brands")||A.includes("fab"))&&(i.prefix="fab"),!i.prefix&&mkA.includes(e)){var D=Object.keys(o).find(function(S){return kkA.includes(S)});if(D||r.autoFetchSvg){var y=VmA.get(e).defaultShortPrefixId;i.prefix=y,i.iconName=Zh(i.prefix,i.iconName)||i.iconName}}return(i.prefix==="fa"||I==="fa")&&(i.prefix=eu()||"fas"),i}var NkA=function(){function t(){DmA(this,t),this.definitions={}}return SmA(t,[{key:"add",value:function(){for(var e=this,i=arguments.length,g=new Array(i),I=0;I<i;I++)g[I]=arguments[I];var n=g.reduce(this._pullDefinitions,{});Object.keys(n).forEach(function(o){e.definitions[o]=Bt(Bt({},e.definitions[o]||{}),n[o]),HAA(o,n[o]),VAA()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(e,i){var g=i.prefix&&i.iconName&&i.icon?{0:i}:i;return Object.keys(g).map(function(I){var n=g[I],o=n.prefix,a=n.iconName,r=n.icon,s=r[2];e[o]||(e[o]={}),s.length>0&&s.forEach(function(B){typeof B=="string"&&(e[o][B]=r)}),e[o][a]=r}),e}}])}(),J8=[],nD={},mD={},GkA=Object.keys(mD);function RkA(t,A){var e=A.mixoutsTo;return J8=t,nD={},Object.keys(mD).forEach(function(i){GkA.indexOf(i)===-1&&delete mD[i]}),J8.forEach(function(i){var g=i.mixout?i.mixout():{};if(Object.keys(g).forEach(function(n){typeof g[n]=="function"&&(e[n]=g[n]),RU(g[n])==="object"&&Object.keys(g[n]).forEach(function(o){e[n]||(e[n]={}),e[n][o]=g[n][o]})}),i.hooks){var I=i.hooks();Object.keys(I).forEach(function(n){nD[n]||(nD[n]=[]),nD[n].push(I[n])})}i.provides&&i.provides(mD)}),e}function BT(t,A){for(var e=arguments.length,i=new Array(e>2?e-2:0),g=2;g<e;g++)i[g-2]=arguments[g];var I=nD[t]||[];return I.forEach(function(n){A=n.apply(null,[A].concat(i))}),A}function wd(t){for(var A=arguments.length,e=new Array(A>1?A-1:0),i=1;i<A;i++)e[i-1]=arguments[i];var g=nD[t]||[];g.forEach(function(I){I.apply(null,e)})}function tu(){var t=arguments[0],A=Array.prototype.slice.call(arguments,1);return mD[t]?mD[t].apply(null,A):void 0}function cT(t){t.prefix==="fa"&&(t.prefix="fas");var A=t.iconName,e=t.prefix||eu();if(A)return A=Zh(e,A)||A,F8(AeA.definitions,e,A)||F8(BB.styles,e,A)}var AeA=new NkA,UkA=function(){zt.autoReplaceSvg=!1,zt.observeMutations=!1,wd("noAuto")},KkA={i2svg:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return NQ?(wd("beforeI2svg",A),tu("pseudoElements2svg",A),tu("i2svg",A)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=A.autoReplaceSvgRoot;zt.autoReplaceSvg===!1&&(zt.autoReplaceSvg=!0),zt.observeMutations=!0,EkA(function(){bkA({autoReplaceSvgRoot:e}),wd("watch",A)})}},FkA={icon:function(A){if(A===null)return null;if(RU(A)==="object"&&A.prefix&&A.iconName)return{prefix:A.prefix,iconName:Zh(A.prefix,A.iconName)||A.iconName};if(Array.isArray(A)&&A.length===2){var e=A[1].indexOf("fa-")===0?A[1].slice(3):A[1],i=jF(A[0]);return{prefix:i,iconName:Zh(i,e)||e}}if(typeof A=="string"&&(A.indexOf("".concat(zt.cssPrefix,"-"))>-1||A.match(AkA))){var g=ZF(A.split(" "),{skipLookups:!0});return{prefix:g.prefix||eu(),iconName:Zh(g.prefix,g.iconName)||g.iconName}}if(typeof A=="string"){var I=eu();return{prefix:I,iconName:Zh(I,A)||A}}}},ds={noAuto:UkA,config:zt,dom:KkA,parse:FkA,library:AeA,findIconDefinition:cT,toHtml:bk},bkA=function(){var A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},e=A.autoReplaceSvgRoot,i=e===void 0?pI:e;(Object.keys(BB.styles).length>0||zt.autoFetchSvg)&&NQ&&zt.autoReplaceSvg&&ds.dom.i2svg({node:i})};function WF(t,A){return Object.defineProperty(t,"abstract",{get:A}),Object.defineProperty(t,"html",{get:function(){return t.abstract.map(function(i){return bk(i)})}}),Object.defineProperty(t,"node",{get:function(){if(NQ){var i=pI.createElement("div");return i.innerHTML=t.html,i.children}}}),t}function vkA(t){var A=t.children,e=t.main,i=t.mask,g=t.attributes,I=t.styles,n=t.transform;if(NH(n)&&e.found&&!i.found){var o=e.width,a=e.height,r={x:o/a/2,y:.5};g.style=PF(Bt(Bt({},I),{},{"transform-origin":"".concat(r.x+n.x/16,"em ").concat(r.y+n.y/16,"em")}))}return[{tag:"svg",attributes:g,children:A}]}function _kA(t){var A=t.prefix,e=t.iconName,i=t.children,g=t.attributes,I=t.symbol,n=I===!0?"".concat(A,"-").concat(zt.cssPrefix,"-").concat(e):I;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:Bt(Bt({},g),{},{id:n}),children:i}]}]}function JkA(t){var A=["aria-label","aria-labelledby","title","role"];return A.some(function(e){return e in t})}function UH(t){var A=t.icons,e=A.main,i=A.mask,g=t.prefix,I=t.iconName,n=t.transform,o=t.symbol,a=t.maskId,r=t.extra,s=t.watchable,B=s===void 0?!1:s,c=i.found?i:e,E=c.width,D=c.height,y=[zt.replacementClass,I?"".concat(zt.cssPrefix,"-").concat(I):""].filter(function(U){return r.classes.indexOf(U)===-1}).filter(function(U){return U!==""||!!U}).concat(r.classes).join(" "),S={children:[],attributes:Bt(Bt({},r.attributes),{},{"data-prefix":g,"data-icon":I,class:y,role:r.attributes.role||"img",viewBox:"0 0 ".concat(E," ").concat(D)})};!JkA(r.attributes)&&!r.attributes["aria-hidden"]&&(S.attributes["aria-hidden"]="true"),B&&(S.attributes[Sd]="");var f=Bt(Bt({},S),{},{prefix:g,iconName:I,main:e,mask:i,maskId:a,transform:n,symbol:o,styles:Bt({},r.styles)}),M=i.found&&e.found?tu("generateAbstractMask",f)||{children:[],attributes:{}}:tu("generateAbstractIcon",f)||{children:[],attributes:{}},k=M.children,m=M.attributes;return f.children=k,f.attributes=m,o?_kA(f):vkA(f)}function L8(t){var A=t.content,e=t.width,i=t.height,g=t.transform,I=t.extra,n=t.watchable,o=n===void 0?!1:n,a=Bt(Bt({},I.attributes),{},{class:I.classes.join(" ")});o&&(a[Sd]="");var r=Bt({},I.styles);NH(g)&&(r.transform=ckA({transform:g,width:e,height:i}),r["-webkit-transform"]=r.transform);var s=PF(r);s.length>0&&(a.style=s);var B=[];return B.push({tag:"span",attributes:a,children:[A]}),B}function LkA(t){var A=t.content,e=t.extra,i=Bt(Bt({},e.attributes),{},{class:e.classes.join(" ")}),g=PF(e.styles);g.length>0&&(i.style=g);var I=[];return I.push({tag:"span",attributes:i,children:[A]}),I}var NJ=BB.styles;function lT(t){var A=t[0],e=t[1],i=t.slice(4),g=OF(i,1),I=g[0],n=null;return Array.isArray(I)?n={tag:"g",attributes:{class:"".concat(zt.cssPrefix,"-").concat(mJ.GROUP)},children:[{tag:"path",attributes:{class:"".concat(zt.cssPrefix,"-").concat(mJ.SECONDARY),fill:"currentColor",d:I[0]}},{tag:"path",attributes:{class:"".concat(zt.cssPrefix,"-").concat(mJ.PRIMARY),fill:"currentColor",d:I[1]}}]}:n={tag:"path",attributes:{fill:"currentColor",d:I}},{found:!0,width:A,height:e,icon:n}}var qkA={found:!1,width:512,height:512};function xkA(t,A){!FAA&&zt.showMissingIcons}function QT(t,A){var e=A;return A==="fa"&&zt.styleDefault!==null&&(A=eu()),new Promise(function(i,g){if(e==="fa"){var I=XAA(t)||{};t=I.iconName||t,A=I.prefix||A}if(t&&A&&NJ[A]&&NJ[A][t]){var n=NJ[A][t];return i(lT(n))}xkA(t,A),i(Bt(Bt({},qkA),{},{icon:zt.showMissingIcons&&t?tu("missingIconAbstract")||{}:{}}))})}var q8=function(){},ET=zt.measurePerformance&&RN&&RN.mark&&RN.measure?RN:{mark:q8,measure:q8},sm='FA "7.0.0"',TkA=function(A){return ET.mark("".concat(sm," ").concat(A," begins")),function(){return eeA(A)}},eeA=function(A){ET.mark("".concat(sm," ").concat(A," ends")),ET.measure("".concat(sm," ").concat(A),"".concat(sm," ").concat(A," begins"),"".concat(sm," ").concat(A," ends"))},KH={begin:TkA,end:eeA},dR=function(){};function x8(t){var A=t.getAttribute?t.getAttribute(Sd):null;return typeof A=="string"}function YkA(t){var A=t.getAttribute?t.getAttribute(mH):null,e=t.getAttribute?t.getAttribute(kH):null;return A&&e}function HkA(t){return t&&t.classList&&t.classList.contains&&t.classList.contains(zt.replacementClass)}function OkA(){if(zt.autoReplaceSvg===!0)return pR.replace;var t=pR[zt.autoReplaceSvg];return t||pR.replace}function PkA(t){return pI.createElementNS("http://www.w3.org/2000/svg",t)}function jkA(t){return pI.createElement(t)}function teA(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},e=A.ceFn,i=e===void 0?t.tag==="svg"?PkA:jkA:e;if(typeof t=="string")return pI.createTextNode(t);var g=i(t.tag);Object.keys(t.attributes||[]).forEach(function(n){g.setAttribute(n,t.attributes[n])});var I=t.children||[];return I.forEach(function(n){g.appendChild(teA(n,{ceFn:i}))}),g}function ZkA(t){var A=" ".concat(t.outerHTML," ");return A="".concat(A,"Font Awesome fontawesome.com "),A}var pR={replace:function(A){var e=A[0];if(e.parentNode)if(A[1].forEach(function(g){e.parentNode.insertBefore(teA(g),e)}),e.getAttribute(Sd)===null&&zt.keepOriginalSource){var i=pI.createComment(ZkA(e));e.parentNode.replaceChild(i,e)}else e.remove()},nest:function(A){var e=A[0],i=A[1];if(~MH(e).indexOf(zt.replacementClass))return pR.replace(A);var g=new RegExp("".concat(zt.cssPrefix,"-.*"));if(delete i[0].attributes.id,i[0].attributes.class){var I=i[0].attributes.class.split(" ").reduce(function(o,a){return a===zt.replacementClass||a.match(g)?o.toSvg.push(a):o.toNode.push(a),o},{toNode:[],toSvg:[]});i[0].attributes.class=I.toSvg.join(" "),I.toNode.length===0?e.removeAttribute("class"):e.setAttribute("class",I.toNode.join(" "))}var n=i.map(function(o){return bk(o)}).join(`
`);e.setAttribute(Sd,""),e.innerHTML=n}};function T8(t){t()}function ieA(t,A){var e=typeof A=="function"?A:dR;if(t.length===0)e();else{var i=T8;zt.mutateApproach===V0A&&(i=Au.requestAnimationFrame||T8),i(function(){var g=OkA(),I=KH.begin("mutate");t.map(g),I(),e()})}}var FH=!1;function geA(){FH=!0}function uT(){FH=!1}var KU=null;function Y8(t){if(k8&&zt.observeMutations){var A=t.treeCallback,e=A===void 0?dR:A,i=t.nodeCallback,g=i===void 0?dR:i,I=t.pseudoElementsCallback,n=I===void 0?dR:I,o=t.observeMutationsRoot,a=o===void 0?pI:o;KU=new k8(function(r){if(!FH){var s=eu();Hy(r).forEach(function(B){if(B.type==="childList"&&B.addedNodes.length>0&&!x8(B.addedNodes[0])&&(zt.searchPseudoElements&&n(B.target),e(B.target)),B.type==="attributes"&&B.target.parentNode&&zt.searchPseudoElements&&n([B.target],!0),B.type==="attributes"&&x8(B.target)&&~ikA.indexOf(B.attributeName))if(B.attributeName==="class"&&YkA(B.target)){var c=ZF(MH(B.target)),E=c.prefix,D=c.iconName;B.target.setAttribute(mH,E||s),D&&B.target.setAttribute(kH,D)}else HkA(B.target)&&g(B.target)})}}),NQ&&KU.observe(a,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function WkA(){KU&&KU.disconnect()}function zkA(t){var A=t.getAttribute("style"),e=[];return A&&(e=A.split(";").reduce(function(i,g){var I=g.split(":"),n=I[0],o=I.slice(1);return n&&o.length>0&&(i[n]=o.join(":").trim()),i},{})),e}function VkA(t){var A=t.getAttribute("data-prefix"),e=t.getAttribute("data-icon"),i=t.innerText!==void 0?t.innerText.trim():"",g=ZF(MH(t));return g.prefix||(g.prefix=eu()),A&&e&&(g.prefix=A,g.iconName=e),g.iconName&&g.prefix||(g.prefix&&i.length>0&&(g.iconName=fkA(g.prefix,t.innerText)||RH(g.prefix,YAA(t.innerText))),!g.iconName&&zt.autoFetchSvg&&t.firstChild&&t.firstChild.nodeType===Node.TEXT_NODE&&(g.iconName=t.firstChild.data)),g}function XkA(t){var A=Hy(t.attributes).reduce(function(e,i){return e.name!=="class"&&e.name!=="style"&&(e[i.name]=i.value),e},{});return A}function $kA(){return{iconName:null,prefix:null,transform:Kc,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function H8(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},e=VkA(t),i=e.iconName,g=e.prefix,I=e.rest,n=XkA(t),o=BT("parseNodeAttributes",{},t),a=A.styleParser?zkA(t):[];return Bt({iconName:i,prefix:g,transform:Kc,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:I,styles:a,attributes:n}},o)}var AMA=BB.styles;function IeA(t){var A=zt.autoReplaceSvg==="nest"?H8(t,{styleParser:!1}):H8(t);return~A.extra.classes.indexOf(_AA)?tu("generateLayersText",t,A):tu("generateSvgReplacementMutation",t,A)}function eMA(){return[].concat(DB(MAA),DB(NAA))}function O8(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!NQ)return Promise.resolve();var e=pI.documentElement.classList,i=function(B){return e.add("".concat(G8,"-").concat(B))},g=function(B){return e.remove("".concat(G8,"-").concat(B))},I=zt.autoFetchSvg?eMA():cAA.concat(Object.keys(AMA));I.includes("fa")||I.push("fa");var n=[".".concat(_AA,":not([").concat(Sd,"])")].concat(I.map(function(s){return".".concat(s,":not([").concat(Sd,"])")})).join(", ");if(n.length===0)return Promise.resolve();var o=[];try{o=Hy(t.querySelectorAll(n))}catch{}if(o.length>0)i("pending"),g("complete");else return Promise.resolve();var a=KH.begin("onTree"),r=o.reduce(function(s,B){try{var c=IeA(B);c&&s.push(c)}catch(E){FAA||E.name}return s},[]);return new Promise(function(s,B){Promise.all(r).then(function(c){ieA(c,function(){i("active"),i("complete"),g("pending"),typeof A=="function"&&A(),a(),s()})}).catch(function(c){a(),B(c)})})}function tMA(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;IeA(t).then(function(e){e&&ieA([e],A)})}function iMA(t){return function(A){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=(A||{}).icon?A:cT(A||{}),g=e.mask;return g&&(g=(g||{}).icon?g:cT(g||{})),t(i,Bt(Bt({},e),{},{mask:g}))}}var gMA=function(A){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},i=e.transform,g=i===void 0?Kc:i,I=e.symbol,n=I===void 0?!1:I,o=e.mask,a=o===void 0?null:o,r=e.maskId,s=r===void 0?null:r,B=e.classes,c=B===void 0?[]:B,E=e.attributes,D=E===void 0?{}:E,y=e.styles,S=y===void 0?{}:y;if(A){var f=A.prefix,M=A.iconName,k=A.icon;return WF(Bt({type:"icon"},A),function(){return wd("beforeDOMElementCreation",{iconDefinition:A,params:e}),UH({icons:{main:lT(k),mask:a?lT(a.icon):{found:!1,width:null,height:null,icon:{}}},prefix:f,iconName:M,transform:Bt(Bt({},Kc),g),symbol:n,maskId:s,extra:{attributes:D,styles:S,classes:c}})})}},IMA={mixout:function(){return{icon:iMA(gMA)}},hooks:function(){return{mutationObserverCallbacks:function(e){return e.treeCallback=O8,e.nodeCallback=tMA,e}}},provides:function(A){A.i2svg=function(e){var i=e.node,g=i===void 0?pI:i,I=e.callback,n=I===void 0?function(){}:I;return O8(g,n)},A.generateSvgReplacementMutation=function(e,i){var g=i.iconName,I=i.prefix,n=i.transform,o=i.symbol,a=i.mask,r=i.maskId,s=i.extra;return new Promise(function(B,c){Promise.all([QT(g,I),a.iconName?QT(a.iconName,a.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(E){var D=OF(E,2),y=D[0],S=D[1];B([e,UH({icons:{main:y,mask:S},prefix:I,iconName:g,transform:n,symbol:o,maskId:r,extra:s,watchable:!0})])}).catch(c)})},A.generateAbstractIcon=function(e){var i=e.children,g=e.attributes,I=e.main,n=e.transform,o=e.styles,a=PF(o);a.length>0&&(g.style=a);var r;return NH(n)&&(r=tu("generateAbstractTransformGrouping",{main:I,transform:n,containerWidth:I.width,iconWidth:I.width})),i.push(r||I.icon),{children:i,attributes:g}}}},nMA={mixout:function(){return{layer:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=i.classes,I=g===void 0?[]:g;return WF({type:"layer"},function(){wd("beforeDOMElementCreation",{assembler:e,params:i});var n=[];return e(function(o){Array.isArray(o)?o.map(function(a){n=n.concat(a.abstract)}):n=n.concat(o.abstract)}),[{tag:"span",attributes:{class:["".concat(zt.cssPrefix,"-layers")].concat(DB(I)).join(" ")},children:n}]})}}}},oMA={mixout:function(){return{counter:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};i.title;var g=i.classes,I=g===void 0?[]:g,n=i.attributes,o=n===void 0?{}:n,a=i.styles,r=a===void 0?{}:a;return WF({type:"counter",content:e},function(){return wd("beforeDOMElementCreation",{content:e,params:i}),LkA({content:e.toString(),extra:{attributes:o,styles:r,classes:["".concat(zt.cssPrefix,"-layers-counter")].concat(DB(I))}})})}}}},aMA={mixout:function(){return{text:function(e){var i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},g=i.transform,I=g===void 0?Kc:g,n=i.classes,o=n===void 0?[]:n,a=i.attributes,r=a===void 0?{}:a,s=i.styles,B=s===void 0?{}:s;return WF({type:"text",content:e},function(){return wd("beforeDOMElementCreation",{content:e,params:i}),L8({content:e,transform:Bt(Bt({},Kc),I),extra:{attributes:r,styles:B,classes:["".concat(zt.cssPrefix,"-layers-text")].concat(DB(o))}})})}}},provides:function(A){A.generateLayersText=function(e,i){var g=i.transform,I=i.extra,n=null,o=null;if(CAA){var a=parseInt(getComputedStyle(e).fontSize,10),r=e.getBoundingClientRect();n=r.width/a,o=r.height/a}return Promise.resolve([e,L8({content:e.innerHTML,width:n,height:o,transform:g,extra:I,watchable:!0})])}}},neA=new RegExp('"',"ug"),P8=[1105920,1112319],j8=Bt(Bt(Bt(Bt({},{FontAwesome:{normal:"fas",400:"fas"}}),zmA),W0A),I0A),hT=Object.keys(j8).reduce(function(t,A){return t[A.toLowerCase()]=j8[A],t},{}),rMA=Object.keys(hT).reduce(function(t,A){var e=hT[A];return t[A]=e[900]||DB(Object.entries(e))[0][1],t},{});function sMA(t){var A=t.replace(neA,"");return YAA(DB(A)[0]||"")}function CMA(t){var A=t.getPropertyValue("font-feature-settings").includes("ss01"),e=t.getPropertyValue("content"),i=e.replace(neA,""),g=i.codePointAt(0),I=g>=P8[0]&&g<=P8[1],n=i.length===2?i[0]===i[1]:!1;return I||n||A}function BMA(t,A){var e=t.replace(/^['"]|['"]$/g,"").toLowerCase(),i=parseInt(A),g=isNaN(i)?"normal":i;return(hT[e]||{})[g]||rMA[e]}function Z8(t,A){var e="".concat(z0A).concat(A.replace(":","-"));return new Promise(function(i,g){if(t.getAttribute(e)!==null)return i();var I=Hy(t.children),n=I.filter(function(F){return F.getAttribute(aT)===A})[0],o=Au.getComputedStyle(t,A),a=o.getPropertyValue("font-family"),r=a.match(ekA),s=o.getPropertyValue("font-weight"),B=o.getPropertyValue("content");if(n&&!r)return t.removeChild(n),i();if(r&&B!=="none"&&B!==""){var c=o.getPropertyValue("content"),E=BMA(a,s),D=sMA(c),y=r[0].startsWith("FontAwesome"),S=CMA(o),f=RH(E,D),M=f;if(y){var k=DkA(D);k.iconName&&k.prefix&&(f=k.iconName,E=k.prefix)}if(f&&!S&&(!n||n.getAttribute(mH)!==E||n.getAttribute(kH)!==M)){t.setAttribute(e,M),n&&t.removeChild(n);var m=$kA(),U=m.extra;U.attributes[aT]=A,QT(f,E).then(function(F){var b=UH(Bt(Bt({},m),{},{icons:{main:F,mask:$AA()},prefix:E,iconName:M,extra:U,watchable:!0})),K=pI.createElementNS("http://www.w3.org/2000/svg","svg");A==="::before"?t.insertBefore(K,t.firstChild):t.appendChild(K),K.outerHTML=b.map(function(R){return bk(R)}).join(`
`),t.removeAttribute(e),i()}).catch(g)}else i()}else i()})}function cMA(t){return Promise.all([Z8(t,"::before"),Z8(t,"::after")])}function lMA(t){return t.parentNode!==document.head&&!~X0A.indexOf(t.tagName.toUpperCase())&&!t.getAttribute(aT)&&(!t.parentNode||t.parentNode.tagName!=="svg")}var QMA=function(A){return!!A&&KAA.some(function(e){return A.includes(e)})},EMA=function(A){if(!A)return[];for(var e=new Set,i=[A],g=[/(?=\s:)/,new RegExp("(?<=\\)\\)?[^,]*,)")],I=function(){var E=o[n];i=i.flatMap(function(D){return D.split(E).map(function(y){return y.replace(/,\s*$/,"").trim()})})},n=0,o=g;n<o.length;n++)I();i=i.flatMap(function(c){return c.includes("(")?c:c.split(",").map(function(E){return E.trim()})});var a=hR(i),r;try{for(a.s();!(r=a.n()).done;){var s=r.value;if(QMA(s)){var B=KAA.reduce(function(c,E){return c.replace(E,"")},s);B!==""&&B!=="*"&&e.add(B)}}}catch(c){a.e(c)}finally{a.f()}return e};function W8(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(NQ){var e;if(A)e=t;else if(zt.searchPseudoElementsFullScan)e=t.querySelectorAll("*");else{var i=new Set,g=hR(document.styleSheets),I;try{for(g.s();!(I=g.n()).done;){var n=I.value;try{var o=hR(n.cssRules),a;try{for(o.s();!(a=o.n()).done;){var r=a.value,s=EMA(r.selectorText),B=hR(s),c;try{for(B.s();!(c=B.n()).done;){var E=c.value;i.add(E)}}catch(y){B.e(y)}finally{B.f()}}}catch(y){o.e(y)}finally{o.f()}}catch{zt.searchPseudoElementsWarnings}}}catch(y){g.e(y)}finally{g.f()}if(!i.size)return;var D=Array.from(i).join(", ");try{e=t.querySelectorAll(D)}catch{}}return new Promise(function(y,S){var f=Hy(e).filter(lMA).map(cMA),M=KH.begin("searchPseudoElements");geA(),Promise.all(f).then(function(){M(),uT(),y()}).catch(function(){M(),uT(),S()})})}}var uMA={hooks:function(){return{mutationObserverCallbacks:function(e){return e.pseudoElementsCallback=W8,e}}},provides:function(A){A.pseudoElements2svg=function(e){var i=e.node,g=i===void 0?pI:i;zt.searchPseudoElements&&W8(g)}}},z8=!1,hMA={mixout:function(){return{dom:{unwatch:function(){geA(),z8=!0}}}},hooks:function(){return{bootstrap:function(){Y8(BT("mutationObserverCallbacks",{}))},noAuto:function(){WkA()},watch:function(e){var i=e.observeMutationsRoot;z8?uT():Y8(BT("mutationObserverCallbacks",{observeMutationsRoot:i}))}}}},V8=function(A){var e={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return A.toLowerCase().split(" ").reduce(function(i,g){var I=g.toLowerCase().split("-"),n=I[0],o=I.slice(1).join("-");if(n&&o==="h")return i.flipX=!0,i;if(n&&o==="v")return i.flipY=!0,i;if(o=parseFloat(o),isNaN(o))return i;switch(n){case"grow":i.size=i.size+o;break;case"shrink":i.size=i.size-o;break;case"left":i.x=i.x-o;break;case"right":i.x=i.x+o;break;case"up":i.y=i.y-o;break;case"down":i.y=i.y+o;break;case"rotate":i.rotate=i.rotate+o;break}return i},e)},dMA={mixout:function(){return{parse:{transform:function(e){return V8(e)}}}},hooks:function(){return{parseNodeAttributes:function(e,i){var g=i.getAttribute("data-fa-transform");return g&&(e.transform=V8(g)),e}}},provides:function(A){A.generateAbstractTransformGrouping=function(e){var i=e.main,g=e.transform,I=e.containerWidth,n=e.iconWidth,o={transform:"translate(".concat(I/2," 256)")},a="translate(".concat(g.x*32,", ").concat(g.y*32,") "),r="scale(".concat(g.size/16*(g.flipX?-1:1),", ").concat(g.size/16*(g.flipY?-1:1),") "),s="rotate(".concat(g.rotate," 0 0)"),B={transform:"".concat(a," ").concat(r," ").concat(s)},c={transform:"translate(".concat(n/2*-1," -256)")},E={outer:o,inner:B,path:c};return{tag:"g",attributes:Bt({},E.outer),children:[{tag:"g",attributes:Bt({},E.inner),children:[{tag:i.icon.tag,children:i.icon.children,attributes:Bt(Bt({},i.icon.attributes),E.path)}]}]}}}},GJ={x:0,y:0,width:"100%",height:"100%"};function X8(t){var A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return t.attributes&&(t.attributes.fill||A)&&(t.attributes.fill="black"),t}function pMA(t){return t.tag==="g"?t.children:[t]}var fMA={hooks:function(){return{parseNodeAttributes:function(e,i){var g=i.getAttribute("data-fa-mask"),I=g?ZF(g.split(" ").map(function(n){return n.trim()})):$AA();return I.prefix||(I.prefix=eu()),e.mask=I,e.maskId=i.getAttribute("data-fa-mask-id"),e}}},provides:function(A){A.generateAbstractMask=function(e){var i=e.children,g=e.attributes,I=e.main,n=e.mask,o=e.maskId,a=e.transform,r=I.width,s=I.icon,B=n.width,c=n.icon,E=BkA({transform:a,containerWidth:B,iconWidth:r}),D={tag:"rect",attributes:Bt(Bt({},GJ),{},{fill:"white"})},y=s.children?{children:s.children.map(X8)}:{},S={tag:"g",attributes:Bt({},E.inner),children:[X8(Bt({tag:s.tag,attributes:Bt(Bt({},s.attributes),E.path)},y))]},f={tag:"g",attributes:Bt({},E.outer),children:[S]},M="mask-".concat(o||U8()),k="clip-".concat(o||U8()),m={tag:"mask",attributes:Bt(Bt({},GJ),{},{id:M,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[D,f]},U={tag:"defs",children:[{tag:"clipPath",attributes:{id:k},children:pMA(c)},m]};return i.push(U,{tag:"rect",attributes:Bt({fill:"currentColor","clip-path":"url(#".concat(k,")"),mask:"url(#".concat(M,")")},GJ)}),{children:i,attributes:g}}}},DMA={provides:function(A){var e=!1;Au.matchMedia&&(e=Au.matchMedia("(prefers-reduced-motion: reduce)").matches),A.missingIconAbstract=function(){var i=[],g={fill:"currentColor"},I={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};i.push({tag:"path",attributes:Bt(Bt({},g),{},{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 n=Bt(Bt({},I),{},{attributeName:"opacity"}),o={tag:"circle",attributes:Bt(Bt({},g),{},{cx:"256",cy:"364",r:"28"}),children:[]};return e||o.children.push({tag:"animate",attributes:Bt(Bt({},I),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:Bt(Bt({},n),{},{values:"1;0;1;1;0;1;"})}),i.push(o),i.push({tag:"path",attributes:Bt(Bt({},g),{},{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:e?[]:[{tag:"animate",attributes:Bt(Bt({},n),{},{values:"1;0;0;0;0;1;"})}]}),e||i.push({tag:"path",attributes:Bt(Bt({},g),{},{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:Bt(Bt({},n),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:i}}}},yMA={hooks:function(){return{parseNodeAttributes:function(e,i){var g=i.getAttribute("data-fa-symbol"),I=g===null?!1:g===""?!0:g;return e.symbol=I,e}}}},SMA=[QkA,IMA,nMA,oMA,aMA,uMA,hMA,dMA,fMA,DMA,yMA];RkA(SMA,{mixoutsTo:ds});ds.noAuto;ds.config;ds.library;ds.dom;var dT=ds.parse;ds.findIconDefinition;ds.toHtml;var wMA=ds.icon;ds.layer;ds.text;ds.counter;var RJ={exports:{}},UJ,$8;function mMA(){if($8)return UJ;$8=1;var t="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";return UJ=t,UJ}var KJ,A5;function kMA(){if(A5)return KJ;A5=1;var t=mMA();function A(){}function e(){}return e.resetWarningCache=A,KJ=function(){function i(n,o,a,r,s,B){if(B!==t){var c=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 c.name="Invariant Violation",c}}i.isRequired=i;function g(){return i}var I={array:i,bigint:i,bool:i,func:i,number:i,object:i,string:i,symbol:i,any:i,arrayOf:g,element:i,elementType:i,instanceOf:g,node:i,objectOf:g,oneOf:g,oneOfType:g,shape:g,exact:g,checkPropTypes:e,resetWarningCache:A};return I.PropTypes=I,I},KJ}var e5;function MMA(){return e5||(e5=1,RJ.exports=kMA()()),RJ.exports}var NMA=MMA();const Hi=Td(NMA);var GMA={};function pT(t,A){(A==null||A>t.length)&&(A=t.length);for(var e=0,i=Array(A);e<A;e++)i[e]=t[e];return i}function RMA(t){if(Array.isArray(t))return t}function UMA(t){if(Array.isArray(t))return pT(t)}function wE(t,A,e){return(A=qMA(A))in t?Object.defineProperty(t,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[A]=e,t}function KMA(t){if(typeof Symbol<"u"&&t[Symbol.iterator]!=null||t["@@iterator"]!=null)return Array.from(t)}function FMA(t,A){var e=t==null?null:typeof Symbol<"u"&&t[Symbol.iterator]||t["@@iterator"];if(e!=null){var i,g,I,n,o=[],a=!0,r=!1;try{if(I=(e=e.call(t)).next,A!==0)for(;!(a=(i=I.call(e)).done)&&(o.push(i.value),o.length!==A);a=!0);}catch(s){r=!0,g=s}finally{try{if(!a&&e.return!=null&&(n=e.return(),Object(n)!==n))return}finally{if(r)throw g}}return o}}function bMA(){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 vMA(){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 t5(t,A){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);A&&(i=i.filter(function(g){return Object.getOwnPropertyDescriptor(t,g).enumerable})),e.push.apply(e,i)}return e}function Mc(t){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?t5(Object(e),!0).forEach(function(i){wE(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):t5(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}function _MA(t,A){if(t==null)return{};var e,i,g=JMA(t,A);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(t);for(i=0;i<I.length;i++)e=I[i],A.indexOf(e)===-1&&{}.propertyIsEnumerable.call(t,e)&&(g[e]=t[e])}return g}function JMA(t,A){if(t==null)return{};var e={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(A.indexOf(i)!==-1)continue;e[i]=t[i]}return e}function i5(t,A){return RMA(t)||FMA(t,A)||oeA(t,A)||bMA()}function fT(t){return UMA(t)||KMA(t)||oeA(t)||vMA()}function LMA(t,A){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,A);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(t)}function qMA(t){var A=LMA(t,"string");return typeof A=="symbol"?A:A+""}function FU(t){"@babel/helpers - typeof";return FU=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(A){return typeof A}:function(A){return A&&typeof Symbol=="function"&&A.constructor===Symbol&&A!==Symbol.prototype?"symbol":typeof A},FU(t)}function oeA(t,A){if(t){if(typeof t=="string")return pT(t,A);var e={}.toString.call(t).slice(8,-1);return e==="Object"&&t.constructor&&(e=t.constructor.name),e==="Map"||e==="Set"?Array.from(t):e==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?pT(t,A):void 0}}var xMA="7.0.0-alpha1",DT;try{var TMA=require("@fortawesome/fontawesome-svg-core/package.json");DT=TMA.version}catch{DT=GMA.FA_VERSION||"7.0.0-alpha8"}function YMA(t){var A=t.beat,e=t.fade,i=t.beatFade,g=t.bounce,I=t.shake,n=t.flash,o=t.spin,a=t.spinPulse,r=t.spinReverse,s=t.pulse,B=t.fixedWidth,c=t.inverse,E=t.border,D=t.listItem,y=t.flip,S=t.size,f=t.rotation,M=t.pull,k=t.swapOpacity,m=t.rotateBy,U=t.widthAuto,F=HMA(DT,xMA),b=wE(wE(wE(wE(wE(wE({"fa-beat":A,"fa-fade":e,"fa-beat-fade":i,"fa-bounce":g,"fa-shake":I,"fa-flash":n,"fa-spin":o,"fa-spin-reverse":r,"fa-spin-pulse":a,"fa-pulse":s,"fa-fw":B,"fa-inverse":c,"fa-border":E,"fa-li":D,"fa-flip":y===!0,"fa-flip-horizontal":y==="horizontal"||y==="both","fa-flip-vertical":y==="vertical"||y==="both"},"fa-".concat(S),typeof S<"u"&&S!==null),"fa-rotate-".concat(f),typeof f<"u"&&f!==null&&f!==0),"fa-pull-".concat(M),typeof M<"u"&&M!==null),"fa-swap-opacity",k),"fa-rotate-by",F&&m),"fa-width-auto",F&&U);return Object.keys(b).map(function(K){return b[K]?K:null}).filter(function(K){return K})}function HMA(t,A){for(var e=t.split("-"),i=i5(e,2),g=i[0],I=i[1],n=A.split("-"),o=i5(n,2),a=o[0],r=o[1],s=g.split("."),B=a.split("."),c=0;c<Math.max(s.length,B.length);c++){var E=s[c]||"0",D=B[c]||"0",y=parseInt(E,10),S=parseInt(D,10);if(y!==S)return y>S}for(var f=0;f<Math.max(s.length,B.length);f++){var M=s[f]||"0",k=B[f]||"0";if(M!==k&&M.length!==k.length)return M.length<k.length}return!(I&&!r)}function OMA(t){return t=t-0,t===t}function aeA(t){return OMA(t)?t:(t=t.replace(/[\-_\s]+(.)?/g,function(A,e){return e?e.toUpperCase():""}),t.substr(0,1).toLowerCase()+t.substr(1))}var PMA=["style"];function jMA(t){return t.charAt(0).toUpperCase()+t.slice(1)}function ZMA(t){return t.split(";").map(function(A){return A.trim()}).filter(function(A){return A}).reduce(function(A,e){var i=e.indexOf(":"),g=aeA(e.slice(0,i)),I=e.slice(i+1).trim();return g.startsWith("webkit")?A[jMA(g)]=I:A[g]=I,A},{})}function reA(t,A){var e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof A=="string")return A;var i=(A.children||[]).map(function(a){return reA(t,a)}),g=Object.keys(A.attributes||{}).reduce(function(a,r){var s=A.attributes[r];switch(r){case"class":a.attrs.className=s,delete A.attributes.class;break;case"style":a.attrs.style=ZMA(s);break;default:r.indexOf("aria-")===0||r.indexOf("data-")===0?a.attrs[r.toLowerCase()]=s:a.attrs[aeA(r)]=s}return a},{attrs:{}}),I=e.style,n=I===void 0?{}:I,o=_MA(e,PMA);return g.attrs.style=Mc(Mc({},g.attrs.style),n),t.apply(void 0,[A.tag,Mc(Mc({},g.attrs),o)].concat(fT(i)))}var seA=!1;try{seA=!0}catch{}function WMA(){if(!seA&&console&&typeof console.error=="function"){var t;(t=console).error.apply(t,arguments)}}function g5(t){if(t&&FU(t)==="object"&&t.prefix&&t.iconName&&t.icon)return t;if(dT.icon)return dT.icon(t);if(t===null)return null;if(t&&FU(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 FJ(t,A){return Array.isArray(A)&&A.length>0||!Array.isArray(A)&&A?wE({},t,A):{}}var I5={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},Fc=ke.forwardRef(function(t,A){var e=Mc(Mc({},I5),t),i=e.icon,g=e.mask,I=e.symbol,n=e.className,o=e.title,a=e.titleId,r=e.maskId,s=g5(i),B=FJ("classes",[].concat(fT(YMA(e)),fT((n||"").split(" ")))),c=FJ("transform",typeof e.transform=="string"?dT.transform(e.transform):e.transform),E=FJ("mask",g5(g)),D=wMA(s,Mc(Mc(Mc(Mc({},B),c),E),{},{symbol:I,title:o,titleId:a,maskId:r}));if(!D)return WMA("Could not find icon",s),null;var y=D.abstract,S={ref:A};return Object.keys(e).forEach(function(f){I5.hasOwnProperty(f)||(S[f]=e[f])}),zMA(y[0],S)});Fc.displayName="FontAwesomeIcon";Fc.propTypes={beat:Hi.bool,border:Hi.bool,beatFade:Hi.bool,bounce:Hi.bool,className:Hi.string,fade:Hi.bool,flash:Hi.bool,mask:Hi.oneOfType([Hi.object,Hi.array,Hi.string]),maskId:Hi.string,fixedWidth:Hi.bool,inverse:Hi.bool,flip:Hi.oneOf([!0,!1,"horizontal","vertical","both"]),icon:Hi.oneOfType([Hi.object,Hi.array,Hi.string]),listItem:Hi.bool,pull:Hi.oneOf(["right","left"]),pulse:Hi.bool,rotation:Hi.oneOf([0,90,180,270]),rotateBy:Hi.bool,shake:Hi.bool,size:Hi.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:Hi.bool,spinPulse:Hi.bool,spinReverse:Hi.bool,symbol:Hi.oneOfType([Hi.bool,Hi.string]),title:Hi.string,titleId:Hi.string,transform:Hi.oneOfType([Hi.string,Hi.object]),swapOpacity:Hi.bool,widthAuto:Hi.bool};var zMA=reA.bind(null,ke.createElement);/*!
 * Font Awesome Free 7.0.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 VMA={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"]},XMA={prefix:"fas",iconName:"circle-chevron-left",icon:[512,512,["chevron-circle-left"],"f137","M512 256a256 256 0 1 0 -512 0 256 256 0 1 0 512 0zM271 135c9.4-9.4 24.6-9.4 33.9 0s9.4 24.6 0 33.9l-87 87 87 87c9.4 9.4 9.4 24.6 0 33.9s-24.6 9.4-33.9 0L167 273c-9.4-9.4-9.4-24.6 0-33.9L271 135z"]},$MA=XMA,ANA={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"]},eNA={prefix:"fas",iconName:"circle-chevron-right",icon:[512,512,["chevron-circle-right"],"f138","M0 256a256 256 0 1 0 512 0 256 256 0 1 0 -512 0zM241 377c-9.4 9.4-24.6 9.4-33.9 0s-9.4-24.6 0-33.9l87-87-87-87c-9.4-9.4-9.4-24.6 0-33.9s24.6-9.4 33.9 0L345 239c9.4 9.4 9.4 24.6 0 33.9L241 377z"]},tNA=eNA;const iNA=[{key:"cee-lo",title:"CEE-LO",tagline:"Fast • Social • Casual",icon:QmA},{key:"craps",title:"CRAPS",tagline:"High Energy • Strategy",icon:EmA},{key:"poker",title:"POKER",tagline:"Skill-Based • Competitive",icon:umA},{key:"skills",title:"SKILLS",tagline:"Challenge • Mastery",icon:hmA},{key:"zentara",title:"ZENTARA",tagline:"Conquer • Build • Dominate",icon:dmA}];function gNA({selectedMode:t,onSelectMode:A,slides:e=iNA,interval:i=4e3,width:g=140,height:I=140,className:n=""}){const[o,a]=p.useState(0),[r,s]=p.useState(!1);p.useEffect(()=>{if(t){const m=e.findIndex(U=>U.key===t);m>=0&&m!==o&&a(m)}},[t,e,o]),p.useEffect(()=>{if(r||t||i<=0)return;const m=setInterval(()=>{a(U=>(U+1)%e.length)},i);return()=>clearInterval(m)},[r,t,i,e.length]);const B=p.useCallback(m=>{a(m),s(!0),A?.(e[m].key)},[A,e]),[c,E]=p.useState(null),D=p.useCallback(m=>{E(m.touches[0].clientX)},[]),y=p.useCallback(m=>{if(c===null)return;const U=m.changedTouches[0].clientX-c;if(Math.abs(U)>50){const b=U>0?-1:1,K=(o+b+e.length)%e.length;B(K)}E(null)},[c,o,e.length,B]),S=e[o],f=p.useCallback(m=>{m.currentTarget.src=gT},[]),M=p.useCallback(m=>{m.stopPropagation();const U=(o-1+e.length)%e.length;B(U)},[o,e.length,B]),k=p.useCallback(m=>{m.stopPropagation();const U=(o+1)%e.length;B(U)},[o,e.length,B]);return Q.jsxs("div",{className:`logo-slideshow ${n}`,onTouchStart:D,onTouchEnd:y,onClick:()=>B(o),role:"button",tabIndex:0,"aria-label":`Select ${S.title}`,children:[Q.jsx("button",{className:"logo-slideshow__chevron logo-slideshow__chevron--left",onClick:M,"aria-label":"Previous game",type:"button",children:Q.jsx(Fc,{icon:$MA})}),Q.jsx("div",{className:"logo-slideshow__track",children:e.map((m,U)=>Q.jsxs("div",{className:`logo-slideshow__slide ${U===o?"logo-slideshow__slide--active":""}`,"aria-hidden":U!==o,children:[Q.jsx("img",{src:m.icon,alt:m.title,width:g,height:I,className:"logo-slideshow__icon",onError:f,loading:U===0?"eager":"lazy"}),Q.jsx("div",{className:"logo-slideshow__tagline",children:m.tagline})]},m.key))}),Q.jsx("button",{className:"logo-slideshow__chevron logo-slideshow__chevron--right",onClick:k,"aria-label":"Next game",type:"button",children:Q.jsx(Fc,{icon:tNA})})]})}const INA=""+new URL("logo-256-CalulGNO.webp",import.meta.url).href,nNA=""+new URL("logo-420-D7JbtaQr.webp",import.meta.url).href,oNA=""+new URL("logo-256-BQd-RHpb.avif",import.meta.url).href,aNA=""+new URL("logo-420-CxzlrsyU.avif",import.meta.url).href;function bH({width:t=180,height:A=180,tagline:e,className:i=""}){const g="ceelo";let I="";try{I=window?.APP_TARGET??""}catch{}const n=String(g).toLowerCase(),o=n==="cee-lo"?"ceelo":n,a=o==="craps"||o==="poker"||o==="ceelo"||o==="skills",r=n==="poker"?"Zentara One Poker Lounge":n==="craps"?"Zentara One Craps Lounge":n==="skills"?"Zentara One Skills Lounge":"Zentara One Dice Lounge",B=e??(o==="skills"?"Think Fast. Play Smart. Win Big.":o==="craps"?"Roll the Dice. Beat the House.":o==="poker"?"Ante Up. Bluff. Win Big.":o==="ceelo"?"Street Rules. Real Stakes.":"Play. Roll. Win. Together!"),c=typeof window<"u"?window:{};let E=c.APP_ICON_PNG||"./icon.png",D=c.APP_ICON_512||"./icon-512.webp";return Q.jsxs("div",{className:`logo-hero ${i}`,"data-testid":"logo-hero",children:[a?Q.jsxs("picture",{children:[Q.jsx("source",{type:"image/webp",srcSet:D,sizes:"(max-width: 600px) 60vw, 420px"}),Q.jsx("img",{width:t,height:A,src:E,alt:r,decoding:"async",loading:"eager",fetchPriority:"high",style:{maxWidth:"100%",height:"auto"},onError:y=>{try{y.currentTarget.src=gT}catch{}}})]}):Q.jsxs("picture",{children:[Q.jsx("source",{type:"image/avif",srcSet:`${oNA} 256w, ${aNA} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),Q.jsx("source",{type:"image/webp",srcSet:`${INA} 256w, ${nNA} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),Q.jsx("img",{width:t,height:A,src:gT,alt:r,decoding:"async",loading:"eager",fetchPriority:"high",sizes:"(max-width:600px) 60vw, 420px",style:{maxWidth:"100%",height:"auto"}})]}),B&&Q.jsx("span",{className:"gold-link",children:B})]})}const CeA=p.createContext(void 0),rNA=({children:t})=>{const{user:A}=Yi(),[e,i]=p.useState([]),[g,I]=p.useState([]),[n,o]=p.useState([]),{blockUser:a,unblockUser:r,getFriendsList:s,sendFriendRequest:B,unfriend:c,respondFriendRequest:E}=OI(),D=p.useCallback(async()=>{try{const K=await s();K?.ok&&(Array.isArray(K.friendsProfiles)&&i(K.friendsProfiles),Array.isArray(K.friendRequests)&&I(K.friendRequests),Array.isArray(K.blockedProfiles)&&o(K.blockedProfiles))}catch{}},[s]);$n({onFriendRequestReceived:K=>{K?.request&&I(R=>[...R.filter(G=>G.id!==K.request.id),K.request])},onFriendRequestCancelled:K=>{K?.requestId&&I(R=>R.filter(G=>G.id!==K.requestId))},onFriendRequestResponded:K=>{K?.requestId&&K?.action&&(I(R=>R.map(G=>G.id===K.requestId?{...G,status:K.action==="ACCEPT"?"ACCEPTED":"DECLINED"}:G)),K.action==="ACCEPT"&&D())},onUnfriended:K=>{K?.byUserId&&i(R=>R.filter(G=>G.id!==K.byUserId))},onUserBlocked:K=>{K?.byUserId&&o(R=>R.find(G=>G.id===K.byUserId)?R:[...R,{id:K.byUserId}])},onUserUnblocked:K=>{K?.byUserId&&o(R=>R.filter(G=>G.id!==K.byUserId))}}),p.useEffect(()=>{D()},[]);const y=p.useCallback(K=>{if(!A?.id||g.some(x=>x.status==="PENDING"&&x.fromUserId===A.id&&x.toUserId===K))return;const G=`temp:${Date.now()}:${K}`,J={id:G,fromUserId:A.id,toUserId:K,message:void 0,status:"PENDING",createdAt:new Date().toISOString(),respondedAt:void 0,fromUser:{id:A.id,name:A.name??null,avatarUrl:A.avatarUrl??null},toUser:n.find(x=>x.id===K)??e.find(x=>x.id===K)??{id:K,name:null,avatarUrl:null}};I(x=>[...x,J]),B(K).then(x=>{x?.ok?x.request?I(H=>[...H.filter(P=>!(P.id===G||P.fromUserId===A.id&&P.toUserId===K&&P.id.startsWith("temp:"))),x.request]):D():I(H=>H.filter(P=>P.id!==G))}).catch(()=>{I(x=>x.filter(H=>H.id!==G))})},[B,D,A?.id,A?.name,n,e,g]),S=p.useCallback(K=>{c(K).then(R=>{R?.ok&&i(G=>G.filter(J=>J.id!==K))}).catch(()=>{})},[c]),f=p.useCallback(K=>{I(R=>[...R.filter(G=>G.id!==K.id),K])},[]),M=p.useCallback(K=>{I(R=>R.map(G=>G.id===K.id?K:G))},[]),k=p.useCallback(K=>{I(R=>R.filter(G=>G.id!==K))},[]),m=p.useCallback(async(K,R)=>{try{(await E(K,R))?.ok&&await D()}catch{}},[E,D]),U=p.useCallback(async K=>{(await a(K)).ok&&o(G=>G.find(J=>J.id===K)?G:[...G,{id:K}])},[a]),F=p.useCallback(async K=>{(await r(K)).ok&&o(G=>G.filter(J=>J.id!==K))},[r]),b=p.useCallback(K=>!!n.find(R=>R.id===K),[n]);return Q.jsx(CeA.Provider,{value:{friends:e,friendRequests:g,blockedUsers:n,addFriend:y,removeFriend:S,addFriendRequest:f,updateFriendRequest:M,removeFriendRequest:k,respondToFriendRequest:m,blockUser:U,unblockUser:F,isBlocked:b,refreshSocial:D},children:t})};function fu(){const t=p.useContext(CeA);if(!t)throw new Error("useSocial must be used within a SocialProvider");return t}const BeA=p.createContext(null),zF=()=>p.useContext(BeA),Qh=t=>`room:${t}`,Ys=(t,A)=>`dm:${[t,A].sort().join("|")}`,n5=t=>{if(!t.startsWith("dm:"))return null;const e=t.slice(3).split("|");return e.length===2?e:null},bJ=(t,A)=>t.ts===A.ts?t.id<A.id?-1:t.id>A.id?1:0:t.ts-A.ts,o5=()=>"tmp:"+Math.random().toString(36).slice(2)+Date.now().toString(36),vJ=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,roomId:t.roomId}),_J=t=>({id:t.id,ts:t.ts,senderId:t.fromUserId,text:t.text,toUserId:t.toUserId});function sNA({children:t}){const{user:A}=Yi(),e=A?.id??"anon",{roomSendMessage:i,roomFetchHistory:g,dmSendMessage:I,dmFetchHistory:n}=OI(),[o,a]=p.useState({}),[r,s]=p.useState({}),[B,c]=p.useState(null),[E,D]=p.useState({}),y=p.useRef(new Set),{info:S}=lH(),f=X=>X?X.length>100?X.slice(0,100)+"…":X:"",M=p.useCallback((X,sA,rA)=>{if(sA?.length&&(a(mA=>{const IA=mA[X]??[],uA=new Map;for(const FA of IA)FA?.id&&uA.set(FA.id,FA);for(const FA of sA){if(!FA?.id)continue;const RA=uA.get(FA.id);uA.set(FA.id,{...RA??{},...FA,pending:!1,error:void 0})}const KA=Array.from(uA.values()).sort(bJ);return{...mA,[X]:KA}}),X.startsWith("dm:")&&rA?.fromPeerId)){const mA=rA.fromPeerId,IA=Ys(e,mA),uA=B===mA,KA=sA.filter(FA=>FA.senderId===mA).length;KA>0&&!uA&&s(FA=>({...FA,[IA]:(FA[IA]??0)+KA}))}},[B,e]),k=p.useCallback((X,sA,rA)=>{a(mA=>{const IA=(mA[X]??[]).slice();return IA.push(sA),IA.sort(bJ),{...mA,[X]:IA}}),(async()=>{try{const mA=await rA();if(!mA?.ok||!mA.id)throw new Error(mA?.error||"send failed");const IA=mA.id;y.current.add(IA),a(uA=>{const KA=uA[X]??[],FA=KA.some(MA=>MA.id===IA);let RA;return FA?RA=KA.filter(MA=>MA.id!==sA.id):RA=KA.map(MA=>MA.id===sA.id?{...MA,id:IA,pending:!1,error:void 0}:MA),RA.sort(bJ),{...uA,[X]:RA}})}catch(mA){a(IA=>{const uA=(IA[X]??[]).map(KA=>KA.id===sA.id?{...KA,pending:!1,error:mA?.message||"send failed"}:KA);return{...IA,[X]:uA}})}})()},[]),m=p.useCallback(X=>{a(sA=>{if(!sA[X])return sA;const rA={...sA};return delete rA[X],rA}),X.startsWith("dm:")&&(s(sA=>{if(!(X in sA))return sA;const rA={...sA};return delete rA[X],rA}),D(sA=>{if(!(X in sA))return sA;const rA={...sA};return delete rA[X],rA}))},[]),U=p.useCallback(X=>(o[X]??[]).some(sA=>sA.pending),[o]),F=p.useCallback(X=>{const sA=Qh(X);return gA(X),(o[sA]??[]).slice()},[o]),b=p.useCallback((X,sA)=>{const rA=(sA??"").trim();if(!rA)return null;const mA=Qh(X),IA=o5(),uA={id:IA,ts:Date.now(),senderId:e,text:rA,roomId:X,pending:!0};return k(mA,uA,()=>i(X,rA)),IA},[e,i,k]),K=p.useCallback(X=>m(Qh(X)),[m]),R=p.useCallback(X=>U(Qh(X)),[U]),G=p.useCallback(async X=>{const sA=Ys(e,X);if(!E[sA])try{const rA=await n?.(X);if(rA?.ok&&Array.isArray(rA.messages)){const mA=rA.messages.map(_J);M(sA,mA),s(IA=>({...IA,[sA]:0}))}}finally{D(rA=>({...rA,[sA]:!0}))}},[n,M,e,E]),J=p.useCallback(X=>{const sA=Ys(e,X);return G(X),(o[sA]??[]).slice()},[o,e,G]),x=p.useCallback((X,sA)=>{const rA=(sA??"").trim();if(!rA)return null;const mA=Ys(e,X),IA=o5(),uA={id:IA,ts:Date.now(),senderId:e,text:rA,toUserId:X,pending:!0};return k(mA,uA,()=>I(X,rA)),IA},[e,k,I]),H=p.useCallback(X=>m(Ys(e,X)),[m,e]),P=p.useCallback(X=>U(Ys(e,X)),[U,e]),j=p.useCallback(X=>{const sA=Ys(e,X);s(rA=>{if(!(sA in rA))return rA;const mA={...rA};return mA[sA]=0,mA})},[e]),q=p.useCallback(X=>{c(X),X&&(j(X),G(X))},[j,G]),Y=p.useCallback(X=>{const sA=[];for(const[rA,mA]of Object.entries(o??{})){if(!rA.startsWith("dm:"))continue;const IA=n5(rA);if(!IA)continue;const uA=IA[0]===e?IA[1]:IA[0];if(X&&uA!==X)continue;const KA=mA[mA.length-1];sA.push({peerUserId:uA,last:KA,unread:r?.[rA]??0,hasPending:mA.some(FA=>FA.pending)})}return sA.sort((rA,mA)=>(mA.last?.ts??0)-(rA.last?.ts??0)),sA},[o,r,e]),O=p.useCallback(X=>{const sA=new Set(X);let rA=0;for(const[mA,IA]of Object.entries(r)){if(IA<=0)continue;const uA=n5(mA);if(!uA)continue;const KA=uA[0]===e?uA[1]:uA[0];sA.has(KA)&&(rA+=IA)}return rA},[r,e]),$=p.useCallback(X=>{const sA=Ys(e,X);return r?.[sA]??0},[r,e]);async function gA(X){const sA=Qh(X);if(!(o[sA]??[]).length)try{const rA=await g?.(X);if(rA?.ok&&Array.isArray(rA.messages)){const mA=rA.messages.map(vJ);M(sA,mA)}}catch{}}$n({onRoomMessage:X=>{if(!(!X?.id||!X.roomId)&&!y.current.has(X.id)){y.current.add(X.id),M(Qh(X.roomId),[vJ(X)]);try{S("Message",f(X.text))}catch{}}},onRoomHistory:({roomId:X,messages:sA})=>{!X||!Array.isArray(sA)||M(Qh(X),sA.map(vJ))},onDmMessage:X=>{if(!X?.id)return;const sA=X.fromUserId===e?X.toUserId:X.fromUserId;if(!sA)return;const rA=Ys(e,sA),mA=_J(X);if(M(rA,[mA],{fromPeerId:X.fromUserId!==e?X.fromUserId:void 0}),X.fromUserId!==e)try{S("Direct Message",f(X.text))}catch{}B===sA&&s(IA=>({...IA,[rA]:0}))},onDmHistory:({peerUserId:X,messages:sA})=>{if(!X||!Array.isArray(sA))return;const rA=Ys(e,X);M(rA,sA.map(_J)),B===X&&s(mA=>({...mA,[rA]:0})),D(mA=>({...mA,[rA]:!0}))}});const z=p.useMemo(()=>({getRoomMessages:F,sendRoomMessage:b,clearRoom:K,roomHasPending:R,getDmMessages:J,sendDmMessage:x,clearDm:H,dmHasPending:P,getDmSummary:Y,markDmRead:j,setActiveDm:q,loadDmHistory:G,threads:o,getTotalFriendUnread:O,getUnreadForPeer:$}),[F,b,K,R,J,x,H,P,Y,j,q,G,o,O,$]);return Q.jsx(BeA.Provider,{value:z,children:t})}function CNA(){const{quickMatchJoin:t,quickMatchLeave:A,quickMatchStatus:e}=OI(),i=Xn(),g=Di(),[I,n]=p.useState({status:"idle"}),[o,a]=p.useState({}),r=p.useRef(!0),s=p.useRef(I);s.current=I,p.useEffect(()=>{if(!i)return;const E=f=>{n({status:"found",roomId:f.roomId,route:f.route,gameMode:f.gameMode,opponent:f.opponent}),r.current&&setTimeout(()=>{g(f.route),setTimeout(()=>n({status:"idle"}),500)},1500)},D=f=>{f?.queueSizes&&a(f.queueSizes)},y=()=>{i.off("quick_match:found",E),i.off("quick_match:waiting",D),i.on("quick_match:found",E),i.on("quick_match:waiting",D)};y(),i.on("connect",y);const S=()=>{s.current.status==="searching"&&e?.().then(f=>{f?.ok&&f.queueSizes&&a(f.queueSizes)}).catch(()=>{})};return i.on("connect",S),()=>{i.off("quick_match:found",E),i.off("quick_match:waiting",D),i.off("connect",y),i.off("connect",S)}},[i,g,e]);const B=p.useCallback(async E=>{n({status:"searching",gameMode:E});try{const D=await t(E);D?.ok?D.matched||D.queueSizes&&a(D.queueSizes):n({status:"idle"})}catch{n({status:"idle"})}},[t]),c=p.useCallback(async()=>{try{await A()}catch{}n({status:"idle"})},[A]);return{state:I,queueSizes:o,join:B,leave:c}}function BNA({gameMode:t,disabled:A}){const{state:e,leave:i,join:g}=CNA(),I=p.useCallback(()=>{t&&(xt("Medium"),e.status==="searching"?i():e.status==="idle"&&g(t))},[t,e.status,g,i]),n=e.status==="searching",o=e.status==="found";return Q.jsx("button",{className:`btn quick-match-btn${n?" quick-match-btn--searching":""}${o?" quick-match-btn--found":""}`,onClick:I,disabled:A||!t||o,"aria-label":n?"Cancel Quick Match":o?"Match Found!":"Quick Match",type:"button",children:o?Q.jsxs(Q.Fragment,{children:[Q.jsx("span",{className:"qm-icon","aria-hidden":!0,children:"🎯"}),Q.jsx("span",{className:"qm-label",children:"Match Found!"})]}):n?Q.jsxs(Q.Fragment,{children:[Q.jsx("span",{className:"qm-spinner","aria-hidden":!0}),Q.jsx("span",{className:"qm-label",children:"Searching…"}),Q.jsx("span",{className:"qm-cancel",children:"✕"})]}):Q.jsxs(Q.Fragment,{children:[Q.jsx("span",{className:"qm-icon","aria-hidden":!0,children:"⚡"}),Q.jsx("span",{className:"qm-label",children:"Quick Match"})]})})}let KN=null;function Oy(){const{available:t,progress:A,applyNow:e,later:i}=smA(),{membershipModalOpen:g,setMembershipModalOpen:I}=_y(),n=Di(),{roomsList:o,loading:a,createRoom:r,getGameRoute:s,refreshRooms:B}=G2(),{pokerCreateRoom:c,getUserBalance:E}=OI(),{logout:D,user:y,refreshUser:S}=Yi(),{friends:f}=fu(),{getTotalFriendUnread:M}=zF(),k=p.useMemo(()=>M(f.map(jA=>jA.id)),[M,f]),{refresh:m}=tAA();p.useEffect(()=>{m()},[m]);const[U,F]=p.useState(!1),[b,K]=p.useState(!1),[R,G]=p.useState(!1),[J,x]=p.useState(!1),[H,P]=p.useState(!1),[j,q]=p.useState(!1),Y="ceelo",O=(()=>{try{return window?.APP_TARGET??""}catch{return""}})(),$=(Y||O).toString().toLowerCase().trim(),gA=$==="craps"?"craps":$==="poker"?"poker":$==="skills"?"skills":$==="zentara"?"zentara":$==="cee-lo"||$==="ceelo"?"cee-lo":null,[z,X]=p.useState(gA??KN??null),[sA,rA]=p.useState(!1),[mA,IA]=p.useState(!1),[uA,KA]=p.useState("wordsearch"),FA=p.useRef(null),{info:RA}=MQ();p.useEffect(()=>{gA&&z!==gA&&X(gA)},[gA,z]),p.useEffect(()=>{(async()=>{try{const{Preferences:jA}=await pi(async()=>{const{Preferences:We}=await Promise.resolve().then(()=>iC);return{Preferences:We}},void 0,import.meta.url),{value:Me}=await jA.get({key:"selectedSkillsGameMode"});(Me==="wordsearch"||Me==="anagrams"||Me==="trivia")&&KA(Me)}catch{}})()},[]),p.useEffect(()=>{if(!gA){if(KN){X(KN);return}(async()=>{try{const{Preferences:jA}=await pi(async()=>{const{Preferences:We}=await Promise.resolve().then(()=>iC);return{Preferences:We}},void 0,import.meta.url),{value:Me}=await jA.get({key:"selectedGameMode"});X(Me==="cee-lo"||Me==="craps"||Me==="poker"||Me==="skills"||Me==="zentara"?Me:"cee-lo")}catch{X("cee-lo")}})()}},[gA]),p.useEffect(()=>{gA||z&&(KN=z,(async()=>{try{const{Preferences:jA}=await pi(async()=>{const{Preferences:Me}=await Promise.resolve().then(()=>iC);return{Preferences:Me}},void 0,import.meta.url);await jA.set({key:"selectedGameMode",value:z})}catch{}})())},[z,gA]),p.useEffect(()=>{MF({volume:.0125})},[]),p.useEffect(()=>{const jA=()=>{window.scrollTo(0,0),document.body.scrollTop=0,document.documentElement.scrollTop=0;const at=document.getElementById("root");at&&(at.scrollTop=0)};jA();const Me=requestAnimationFrame(jA),We=setTimeout(jA,50);return()=>{cancelAnimationFrame(Me),clearTimeout(We)}},[]);const MA=p.useMemo(()=>{const jA=gA??z;if(!jA)return o;const Me=We=>We.filter(at=>(at.gameMode||"cee-lo")===jA);return{public:Me(o.public),private:Me(o.private)}},[o,gA,z]),oA=p.useRef(null),AA=p.useCallback(()=>{xt("Light")},[]),tA=p.useCallback(()=>{try{rd({volume:.5})}catch{}},[]),iA=p.useCallback(()=>{try{Cg()}catch{}},[]),hA=p.useCallback(jA=>{iA(),jA!==z?(AA(),tA(),X(jA)):(AA(),tA())},[z,AA,tA,iA]),DA=p.useRef(null),dA=p.useRef(null),[SA,NA]=p.useState(1),[OA,Qe]=p.useState(null),nA=p.useCallback(()=>{const jA=dA.current,Me=DA.current;if(!jA||!Me)return;const We=jA.style.transform;jA.style.transform="none";const at=jA.scrollHeight,kA=window.innerHeight;let ae=Math.min(1,kA/at);NA(ae),Qe(at*ae),jA.style.transform=We},[]);p.useLayoutEffect(()=>{nA()},[nA,z]),p.useEffect(()=>{const jA=new ResizeObserver(()=>requestAnimationFrame(nA)),Me=dA.current;Me&&jA.observe(Me),window.addEventListener("resize",nA);const We=setTimeout(nA,250),at=setTimeout(nA,800);return()=>{jA.disconnect(),window.removeEventListener("resize",nA),clearTimeout(We),clearTimeout(at)}},[nA]);const eA=p.useCallback(()=>{n("/profile")},[n]),UA=p.useCallback(()=>{n("/messages")},[n]);p.useCallback(()=>{n("/settings")},[n]);const HA=p.useCallback(()=>{n("/add-chips")},[n]),Se=p.useCallback(()=>{n("/login")},[n]),ne=p.useCallback(()=>{iA(),AA(),tA(),D()},[D,AA,tA,iA]),Oe=async()=>{try{const jA=y&&typeof y.balance=="number"?Number(y.balance):null;if(jA!=null)return jA;try{await Promise.resolve(S())}catch{}const Me=y&&typeof y.balance=="number"?Number(y.balance):null;if(Me!=null)return Me}catch{}try{const jA=await E?.();if(jA?.ok&&typeof jA.data?.balance=="number")return Number(jA.data.balance)}catch{}return null},VA=p.useCallback(async()=>{iA(),AA(),tA();try{if(y?.isGuest===!0){q(!0);return}}catch{}if(z==="poker")try{const jA=await Oe();if(jA!=null&&jA<1e3){rA(!0);return}}catch{}K(!0)},[iA,AA,tA,z,y,S,I,Se]),de=p.useCallback(async()=>{iA(),AA(),tA();try{if(y?.isGuest===!0){q(!0);return}}catch{}if(z==="poker")try{const jA=await Oe();if(jA!=null&&jA<1e3){rA(!0);return}}catch{}B(),G(!0)},[iA,AA,tA,z,y,S,I,Se,B]),te=p.useCallback(()=>{document.activeElement?.blur?.()},[]),WA=p.useCallback(()=>{te(),de()},[te,de]),_A=p.useCallback(()=>{te(),VA()},[te,VA]),{meId:zA}=Yi(),ge=p.useCallback(async()=>{if(iA(),!!z&&!H){P(!0),IA(!0),AA(),tA(),FA.current&&clearTimeout(FA.current),FA.current=window.setTimeout(()=>{IA(!1),RA("Try again.",{duration:3e3})},15e3);try{let jA;const Me=await jo(),We=Me.botDifficultyLevel&&Me.botDifficultyLevel>=1&&Me.botDifficultyLevel<=9?Me.botDifficultyLevel:void 0;switch(z){case"poker":jA=await c({name:"Single Player Room",singlePlayer:!0,botLevel:We});break;case"cee-lo":case"craps":jA=await r({singlePlayer:!0,name:"Single Player Room",gameMode:z,botLevel:We});break;case"skills":n(`/skills/play?mode=${uA}`);return;case"zentara":{const Ye=crypto.randomUUID().slice(0,8);n(`/zentara/match/${Ye}`);return}default:jA=await r({singlePlayer:!0,name:"Single Player Room"});break}try{window.location.search.includes("e2e=1")&&(window.__handleCreateSingleRes=jA)}catch{}const at=jA?.room??jA?.roomsList?.room??jA?.data?.room??null,kA=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),ae=at?.roomId??at?.id??jA?.roomId??jA?.data?.roomId;if(ae&&at){FA.current&&(clearTimeout(FA.current),FA.current=null);try{window.__PRESEEDED_ROOM=at}catch{}const Ye=kA?"?e2e=1":"",Pt=s(z,ae)+Ye;n(Pt)}else if(jA?.error){const Ye=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),Pt=String(jA.error||"");if(!Ye&&/insufficient|minimum buy-in/i.test(Pt)){rA(!0);return}}}catch(jA){const Me=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})();if(Me){const We=`e2e-${Math.random().toString(36).slice(2,8)}`;try{window.__handleCreateSingleRes={ok:!0,roomId:We}}catch{}const at=Me?"&e2e=1":"";n(z==="poker"?`/poker/room/${We}?m=${z}${at}`:`/room/${We}?m=${z}${at}`)}else{const We=String(jA?.message??jA??"");/insufficient|minimum buy-in/i.test(We)&&rA(!0)}}finally{P(!1),IA(!1),FA.current&&(clearTimeout(FA.current),FA.current=null)}}},[iA,r,AA,tA,n,H,z,zA,RA,uA,c,s]),he=p.useCallback(jA=>()=>{iA(),AA(),tA(),jA()},[iA,AA,tA]);y?.membershipTier;const ve=!!y,bA=(()=>{try{return y?.isGuest===!0}catch{return!1}})(),pA=p.useMemo(()=>{const jA=[{key:"chips",label:"Shop",onClick:he(HA)}];return ve&&!bA&&(jA.unshift({key:"profile",label:"Profile",onClick:he(eA)}),jA.splice(1,0,{key:"messages",label:"Messages",onClick:he(UA),badge:k}),jA.push({key:"logout",label:"Log Out",onClick:he(ne)})),jA},[he,eA,UA,HA,ne,ve,bA,k]),Re=p.useCallback(jA=>{jA.stopPropagation(),iA(),AA(),tA(),x(Me=>!Me)},[iA,AA,tA]),CA=p.useCallback(()=>x(!1),[]),EA=p.useCallback(()=>K(!1),[]),yA=p.useCallback(()=>G(!1),[]),xA=p.useCallback(()=>I(!1),[I]),[XA,pe]=p.useState(!1),be=p.useCallback(()=>{iA(),AA(),tA(),pe(!0)},[iA,AA,tA]),It=p.useCallback(()=>pe(!1),[]),[Ut,pg]=p.useState(!1),[Ge,lt]=p.useState(!1);p.useEffect(()=>{let jA=!0;return(async()=>{try{const{Preferences:Me}=await pi(async()=>{const{Preferences:at}=await Promise.resolve().then(()=>iC);return{Preferences:at}},void 0,import.meta.url),{value:We}=await Me.get({key:"seenOnboardingV1"});if(!jA)return;lt(We!=="1")}catch{if(!jA)return;lt(!0)}})(),()=>{jA=!1}},[]);const Rt=p.useCallback(()=>lt(!1),[]),Yt=p.useCallback(()=>{iA(),AA(),tA(),pg(!0)},[iA,AA,tA]),st=p.useCallback(()=>pg(!1),[]),Be=gA==="skills"?"theme-skills":"theme-casino";return Q.jsxs("div",{className:`HomeScreen ${Be} home-fixed-root`,children:[Q.jsx(Po,{className:"page-home-screen"}),Q.jsx(BmA,{}),Q.jsx(cmA,{}),gA!=="skills"&&Q.jsx(uH,{open:Ge,onClose:Rt}),Q.jsxs("div",{className:"logout-container home-header-row",children:[Q.jsx("a",{id:"btn-how-to-play",className:"home-header-link",title:"How to Play","aria-label":"How to Play",onClick:be,role:"button",children:Q.jsx("img",{src:lmA,alt:"How to Play",className:"home-header-icon"})}),Q.jsxs("button",{className:"home-header-leaderboard",onClick:Yt,"aria-label":"View Leaderboards",type:"button",children:[Q.jsx("span",{className:"home-header-leaderboard-icon","aria-hidden":!0,children:"🏆"}),Q.jsx("span",{className:"home-header-leaderboard-label",children:"Leaderboards"})]}),!y&&Q.jsx("a",{className:"gold-link",onClick:he(Se),children:"Login"}),Q.jsxs("button",{ref:oA,className:"settings-toggle",title:"Menu","aria-label":k>0?`Menu (${k} unread messages)`:"Menu","aria-haspopup":"menu","aria-expanded":J,onClick:Re,style:{width:38,height:38,borderRadius:"50%",background:y?.avatarUrl?`url(${y.avatarUrl}) center/cover no-repeat`:"linear-gradient(135deg, #E6C166, #CDA34A)",border:"2px solid var(--gold, #d4af37)",cursor:"pointer",display:"flex",alignItems:"center",justifyContent:"center",padding:0,position:"relative"},children:[!y?.avatarUrl&&Q.jsx("span",{style:{fontSize:"20px",lineHeight:1},children:"👤"}),k>0&&Q.jsx("span",{className:"settings-unread-badge","aria-label":`${k} unread`,children:k>99?"99+":k})]}),Q.jsx(eQA,{anchorRef:oA,open:J,onClose:CA,items:pA})]}),Q.jsx("div",{ref:DA,className:`home-fit-shell ${Be}`,children:Q.jsxs("div",{ref:dA,className:"home-fit-content",style:SA<1?{transform:`scale(${SA})`,transformOrigin:"top center"}:void 0,children:[Q.jsx(cNA,{onPlay:ge,playDisabled:!z||H}),!gA&&Q.jsx(gNA,{selectedMode:gA??z,onSelectMode:gA?void 0:hA,interval:gA?0:4e3}),gA&&Q.jsx(bH,{width:240,height:240,tagline:""}),gA==="skills"&&Q.jsx("div",{className:"skills-mode-selector",children:[{value:"wordsearch",label:"🔤 WORDS"},{value:"anagrams",label:"🔀 ANAGRAMS"},{value:"trivia",label:"❓ TRIVIA"}].map(({value:jA,label:Me})=>Q.jsx("button",{className:uA===jA?"active":"",onClick:async()=>{AA(),tA(),KA(jA);try{const{Preferences:We}=await pi(async()=>{const{Preferences:at}=await Promise.resolve().then(()=>iC);return{Preferences:at}},void 0,import.meta.url);await We.set({key:"selectedSkillsGameMode",value:jA})}catch{}},children:Me},jA))}),(!ve||bA)&&Q.jsxs("div",{className:`promo-banner ${gA?`promo-banner--${gA}`:""}`,role:"region","aria-label":"Login banner",children:[Q.jsx("div",{className:"promo-banner__content",children:Q.jsx("span",{className:"promo-banner__title",children:"Login to unlock Multiplayer"})}),Q.jsx("div",{children:Q.jsx("button",{className:"btn gold-fill",onClick:he(Se),"aria-label":"Login",children:"Login"})})]}),Q.jsxs("section",{className:"home-cta buttonRow","aria-label":"Actions",children:[Q.jsx("div",{className:"cta-spotlight","aria-hidden":!0}),Q.jsx("button",{id:"btn-single-player",className:"btn gold-fill cta-btn primaryButton",onClick:ge,disabled:!z||H,"aria-label":"Single Player",children:"Single Player"}),Q.jsxs("div",{className:"cta-row-pair",children:[Q.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:WA,disabled:!z,"aria-label":"Join Room",children:"Join Room"}),ve&&!bA&&Q.jsx(BNA,{gameMode:gA??z,disabled:!z||H})]}),Q.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:_A,disabled:!z,"aria-label":"Create Room",children:"Create Room"})]})]})}),Q.jsx($lA,{open:b,onClose:EA,gameMode:z??"cee-lo"}),Q.jsx(AQA,{open:R,onClose:yA,isPrivate:U,setIsPrivate:F,roomsList:MA,onJoinClick:B,loading:a}),Q.jsx(EH,{open:g,onClose:xA,planId:y?.membershipTier}),Q.jsx(eAA,{open:XA,onClose:It,defaultMode:gA??void 0}),Q.jsx(ywA,{open:Ut,onClose:st}),Q.jsx(SwA,{open:j,onClose:()=>q(!1),onGoLogin:()=>Se(),title:"Login Required",message:Q.jsx(Q.Fragment,{children:"Please log in to access Settings and Multiplayer."})}),Q.jsx(CmA,{available:t,progress:A,applyNow:e,later:i}),Q.jsx(Cd,{})]})}function cNA({onPlay:t,playDisabled:A}){const{data:e,claiming:i,claim:g,refresh:I}=pwA();if(p.useEffect(()=>{const E=setInterval(()=>void I(!0),3e4);return()=>clearInterval(E)},[I]),!e)return Q.jsxs("button",{className:"daily-challenge-banner",onClick:t,disabled:A,type:"button","aria-label":"Daily Challenge",children:[Q.jsx("span",{className:"daily-challenge-icon","aria-hidden":!0,children:"🎯"}),Q.jsxs("span",{className:"daily-challenge-text",children:[Q.jsx("span",{className:"daily-challenge-label",children:"Daily Challenge"}),Q.jsx("span",{className:"daily-challenge-reward",children:"Play & earn bonus coins"})]}),Q.jsx("span",{className:"daily-challenge-go","aria-hidden":!0,children:"▸"})]});const{description:n,target:o,progress:a,reward:r,completed:s,claimed:B}=e,c=async()=>{s&&!B&&!i?await g()&&I(!0):s||t()};return Q.jsxs("button",{className:`daily-challenge-banner${B?" daily-challenge-banner--claimed":s?" daily-challenge-banner--ready":""}`,onClick:c,disabled:B||i||A&&!s,type:"button","aria-label":B?"Challenge completed":s?"Claim reward":n,children:[Q.jsx("span",{className:"daily-challenge-icon","aria-hidden":!0,children:B?"✅":s?"🎉":"🎯"}),Q.jsxs("span",{className:"daily-challenge-text",children:[Q.jsx("span",{className:"daily-challenge-label",children:B?"Challenge Complete!":"Daily Challenge"}),Q.jsx("span",{className:"daily-challenge-reward",children:B?"Come back tomorrow!":s?`Claim +${r.toLocaleString()} coins!`:Q.jsxs(Q.Fragment,{children:[n," — ",Q.jsxs("strong",{children:["+",r.toLocaleString()]})," coins"]})})]}),!B&&Q.jsx("span",{className:"daily-challenge-go","aria-hidden":!0,children:s?i?"…":"💰":`${a}/${o}`})]})}const lNA=""+new URL("fairness-BcL04fcA.webp",import.meta.url).href;function vH({state:t}){const e={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 Q.jsx("span",{className:`fairness ${e.cls}`,title:e.label,"aria-label":e.label,children:t==="verified"?Q.jsx("img",{src:lNA,alt:"Fairness verified",className:"fairness-img"}):e.icon})}const QNA=""+new URL("login-icon-BjxGOBCs.webp",import.meta.url).href;/*!
 * 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 ENA={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"]},uNA={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 a5=(()=>{try{return Li.getPlatform()}catch{return"web"}})(),JJ=a5==="ios"||a5==="android",r5=ENA,s5=uNA;function zd({initialStatus:t="idle"}){const[A,e]=p.useState(""),[i,g]=p.useState(""),[I,n]=p.useState(t),[o,a]=p.useState(null),[r,s]=p.useState(!1),[B,c]=p.useState(!1),[E,D]=p.useState(!0),[y,S]=p.useState(!1),f=p.useCallback(()=>S(!1),[]);p.useCallback(()=>S(!0),[]);const M=p.useRef(null),k=Di(),{refreshUser:m}=Yi(),U=()=>setTimeout(()=>M.current?.focus(),60);p.useCallback(()=>{D(!0),U()},[]),p.useCallback(()=>{k("/how-to-play")},[k]);const F=p.useCallback(async()=>{try{await nR("");const R=Ea();await fetch(`${R}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}try{const R=await KBA();if(R.ok){try{R.token&&await dd(R.token)}catch{}await m({force:!0}),k("/lobby",{replace:!0});return}}catch{}a("Guest mode is temporarily unavailable. Please sign in.")},[k,m]),b=async R=>{try{if(JJ){a("Use the Native Sign-in buttons inside the mobile app.");return}R==="google"?s(!0):c(!0),a(null);try{await nR("");const G=Ea();await fetch(`${G}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}await UBA(R)}catch(G){R==="google"?s(!1):c(!1),a(G?.message||"Web sign-in failed")}},K=async R=>{try{if(!JJ){a("Open the Android/iOS app to use Native Sign-in.");return}R==="google"?s(!0):c(!0),a(null);try{await nR("");const P=Ea();await fetch(`${P}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}const G=R==="apple"?await iU.signInWithAppleNative():await iU.signInWithGoogleNative(),J=Ea(),x=await fetch(`${J}/api/auth/oauth/mobile-verify`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({provider:G.provider,idToken:G.idToken,email:G.email,name:G.name})});if(!x.ok)throw new Error("Native verify failed");const H=await x.json();if(H?.ok&&H?.token){try{await dd(H.token)}catch{}await m({force:!0}),k("/lobby",{replace:!0})}else throw new Error("No token")}catch(G){R==="google"?s(!1):c(!1),G?.message||String(G),a("Sign-in failed. Check your device account settings and try again.")}};return Q.jsxs("main",{className:`landing-page${XcA?" landing-skills":""}`,children:[Q.jsx(Po,{className:"page-login"}),Q.jsxs("div",{className:"lp-brand-bar",children:[Q.jsx("span",{className:"lp-brand-bar__text",children:"Zentara"}),Q.jsx("img",{src:QNA,alt:"Zentara",className:"lp-brand-bar__icon",width:36,height:36,onError:R=>{R.currentTarget.style.display="none"}}),Q.jsx("span",{className:"lp-brand-bar__text",children:"One"})]}),Q.jsxs("header",{className:"lp-hero",children:[Q.jsx("div",{className:"lp-hero__mask","aria-hidden":!0}),Q.jsxs("div",{className:"lp-hero__content",children:[Q.jsxs("div",{className:"lp-fairness-badge",children:["Provably Fair! ",Q.jsx(vH,{state:"verified"})]}),Q.jsx(bH,{}),Q.jsxs("div",{id:"signup-form",className:["lp-signup",E||I==="sent"?"is-open":""].join(" "),children:[JJ?Q.jsxs("div",{className:"lp-oauth","aria-label":"Native Sign-in (use inside the mobile app)",children:[Q.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--google",onClick:()=>K("google"),disabled:r||B,"aria-label":"Continue with Google (Native)",style:{position:"relative"},children:Q.jsxs(Q.Fragment,{children:[Q.jsx(Fc,{className:"lp-oauth__fa",icon:r5,"aria-hidden":!0}),Q.jsx("span",{className:"lp-oauth__label",children:"Continue with Google"}),r&&Q.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),Q.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--apple",onClick:()=>K("apple"),disabled:r||B,"aria-label":"Continue with Apple (Native)",style:{position:"relative"},children:Q.jsxs(Q.Fragment,{children:[Q.jsx(Fc,{className:"lp-oauth__fa",icon:s5,"aria-hidden":!0}),Q.jsx("span",{className:"lp-oauth__label",children:"Continue with Apple"}),B&&Q.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),Q.jsx("button",{type:"button",className:"gold-link",onClick:F,"aria-label":"Continue as Guest",children:"Continue as Guest"})]}):Q.jsxs("div",{className:"lp-oauth","aria-label":"Web Sign-in (use in browser)",children:[Q.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--google",onClick:()=>b("google"),disabled:r||B,"aria-label":"Continue with Google (Web)",style:{position:"relative"},children:Q.jsxs(Q.Fragment,{children:[Q.jsx(Fc,{className:"lp-oauth__fa",icon:r5,"aria-hidden":!0}),Q.jsx("span",{className:"lp-oauth__label",children:"Continue with Google"}),r&&Q.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),Q.jsx("button",{type:"button",className:"felt-btn lp-btn lp-btn--oauth lp-btn--apple",onClick:()=>b("apple"),disabled:r||B,"aria-label":"Continue with Apple (Web)",style:{position:"relative"},children:Q.jsxs(Q.Fragment,{children:[Q.jsx(Fc,{className:"lp-oauth__fa",icon:s5,"aria-hidden":!0}),Q.jsx("span",{className:"lp-oauth__label",children:"Continue with Apple"}),B&&Q.jsx("span",{className:"lp-oauth__spinner","aria-label":"Loading"})]})}),Q.jsx("button",{type:"button",className:"gold-link",onClick:F,"aria-label":"Continue as Guest",children:"Continue as Guest"})]}),I==="error"&&Q.jsx("p",{className:"lp-error",role:"alert",children:o})]})]})]}),Q.jsxs("footer",{className:"lp-footer",children:[Q.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[Q.jsx(Yo,{to:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx(Yo,{to:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx(Yo,{to:"/terms",className:"lp-footer__link",children:"Terms of Use"}),Q.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),Q.jsx(Yo,{to:"/support",className:"lp-footer__link",children:"Support"})]}),Q.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),Q.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]}),Q.jsx(eAA,{open:y,onClose:f})]})}function Vd(){const{user:t,loading:A,initialized:e,refreshUser:i}=Yi(),g=ln(),I=!!(t?.email&&/@guest\.local$/i.test(t.email));return p.useEffect(()=>{!e&&!A&&g.pathname!=="/login"&&i()},[e,A,i]),p.useEffect(()=>{g.pathname==="/login"&&Hd()},[g.pathname]),g.pathname!=="/login"&&(!e||A)?Q.jsx("div",{className:"app-loading",children:"Loading…"}):t&&!I?Q.jsx(An,{to:"/lobby",replace:!0}):Q.jsx(HX,{})}var C5={};function hNA(t,A){return A.forEach(function(e){e&&typeof e!="string"&&!Array.isArray(e)&&Object.keys(e).forEach(function(i){if(i!=="default"&&!(i in t)){var g=Object.getOwnPropertyDescriptor(e,i);Object.defineProperty(t,i,g.get?g:{enumerable:!0,get:function(){return e[i]}})}})}),Object.freeze(t)}var dNA=Object.defineProperty,pNA=(t,A,e)=>A in t?dNA(t,A,{enumerable:!0,configurable:!0,writable:!0,value:e}):t[A]=e,B5=(t,A,e)=>pNA(t,typeof A!="symbol"?A+"":A,e);let gr=class{constructor(){B5(this,"_locking"),B5(this,"_locks"),this._locking=Promise.resolve(),this._locks=0}isLocked(){return this._locks>0}lock(){this._locks+=1;let A;const e=new Promise(g=>A=()=>{this._locks-=1,g()}),i=this._locking.then(()=>A);return this._locking=this._locking.then(()=>e),i}};function $I(t,A){if(!t)throw new Error(A)}const fNA=34028234663852886e22,DNA=-34028234663852886e22,yNA=4294967295,SNA=2147483647,wNA=-2147483648;function fR(t){if(typeof t!="number")throw new Error("invalid int 32: "+typeof t);if(!Number.isInteger(t)||t>SNA||t<wNA)throw new Error("invalid int 32: "+t)}function yT(t){if(typeof t!="number")throw new Error("invalid uint 32: "+typeof t);if(!Number.isInteger(t)||t>yNA||t<0)throw new Error("invalid uint 32: "+t)}function ceA(t){if(typeof t!="number")throw new Error("invalid float 32: "+typeof t);if(Number.isFinite(t)&&(t>fNA||t<DNA))throw new Error("invalid float 32: "+t)}const leA=Symbol("@bufbuild/protobuf/enum-type");function mNA(t){const A=t[leA];return $I(A,"missing enum type on enum object"),A}function QeA(t,A,e,i){t[leA]=EeA(A,e.map(g=>({no:g.no,name:g.name,localName:t[g.no]})))}function EeA(t,A,e){const i=Object.create(null),g=Object.create(null),I=[];for(const n of A){const o=ueA(n);I.push(o),i[n.name]=o,g[n.no]=o}return{typeName:t,values:I,findName(n){return i[n]},findNumber(n){return g[n]}}}function kNA(t,A,e){const i={};for(const g of A){const I=ueA(g);i[I.localName]=I.no,i[I.no]=I.localName}return QeA(i,t,A),i}function ueA(t){return"localName"in t?t:Object.assign(Object.assign({},t),{localName:t.name})}class _H{equals(A){return this.getType().runtime.util.equals(this.getType(),this,A)}clone(){return this.getType().runtime.util.clone(this)}fromBinary(A,e){const i=this.getType(),g=i.runtime.bin,I=g.makeReadOptions(e);return g.readMessage(this,I.readerFactory(A),A.byteLength,I),this}fromJson(A,e){const i=this.getType(),g=i.runtime.json,I=g.makeReadOptions(e);return g.readMessage(i,A,I,this),this}fromJsonString(A,e){let i;try{i=JSON.parse(A)}catch(g){throw new Error("cannot decode ".concat(this.getType().typeName," from JSON: ").concat(g instanceof Error?g.message:String(g)))}return this.fromJson(i,e)}toBinary(A){const e=this.getType(),i=e.runtime.bin,g=i.makeWriteOptions(A),I=g.writerFactory();return i.writeMessage(this,I,g),I.finish()}toJson(A){const e=this.getType(),i=e.runtime.json,g=i.makeWriteOptions(A);return i.writeMessage(this,g)}toJsonString(A){var e;const i=this.toJson(A);return JSON.stringify(i,null,(e=A?.prettySpaces)!==null&&e!==void 0?e:0)}toJSON(){return this.toJson({emitDefaultValues:!0})}getType(){return Object.getPrototypeOf(this).constructor}}function MNA(t,A,e,i){var g;const I=(g=i?.localName)!==null&&g!==void 0?g:A.substring(A.lastIndexOf(".")+1),n={[I]:function(o){t.util.initFields(this),t.util.initPartial(o,this)}}[I];return Object.setPrototypeOf(n.prototype,new _H),Object.assign(n,{runtime:t,typeName:A,fields:t.util.newFieldList(e),fromBinary(o,a){return new n().fromBinary(o,a)},fromJson(o,a){return new n().fromJson(o,a)},fromJsonString(o,a){return new n().fromJsonString(o,a)},equals(o,a){return t.util.equals(n,o,a)}}),n}function NNA(){let t=0,A=0;for(let i=0;i<28;i+=7){let g=this.buf[this.pos++];if(t|=(g&127)<<i,(g&128)==0)return this.assertBounds(),[t,A]}let e=this.buf[this.pos++];if(t|=(e&15)<<28,A=(e&112)>>4,(e&128)==0)return this.assertBounds(),[t,A];for(let i=3;i<=31;i+=7){let g=this.buf[this.pos++];if(A|=(g&127)<<i,(g&128)==0)return this.assertBounds(),[t,A]}throw new Error("invalid varint")}function LJ(t,A,e){for(let I=0;I<28;I=I+7){const n=t>>>I,o=!(!(n>>>7)&&A==0),a=(o?n|128:n)&255;if(e.push(a),!o)return}const i=t>>>28&15|(A&7)<<4,g=A>>3!=0;if(e.push((g?i|128:i)&255),!!g){for(let I=3;I<31;I=I+7){const n=A>>>I,o=!!(n>>>7),a=(o?n|128:n)&255;if(e.push(a),!o)return}e.push(A>>>31&1)}}const DR=4294967296;function c5(t){const A=t[0]==="-";A&&(t=t.slice(1));const e=1e6;let i=0,g=0;function I(n,o){const a=Number(t.slice(n,o));g*=e,i=i*e+a,i>=DR&&(g=g+(i/DR|0),i=i%DR)}return I(-24,-18),I(-18,-12),I(-12,-6),I(-6),A?deA(i,g):JH(i,g)}function GNA(t,A){let e=JH(t,A);const i=e.hi&2147483648;i&&(e=deA(e.lo,e.hi));const g=heA(e.lo,e.hi);return i?"-"+g:g}function heA(t,A){if({lo:t,hi:A}=RNA(t,A),A<=2097151)return String(DR*A+t);const e=t&16777215,i=(t>>>24|A<<8)&16777215,g=A>>16&65535;let I=e+i*6777216+g*6710656,n=i+g*8147497,o=g*2;const a=1e7;return I>=a&&(n+=Math.floor(I/a),I%=a),n>=a&&(o+=Math.floor(n/a),n%=a),o.toString()+l5(n)+l5(I)}function RNA(t,A){return{lo:t>>>0,hi:A>>>0}}function JH(t,A){return{lo:t|0,hi:A|0}}function deA(t,A){return A=~A,t?t=~t+1:A+=1,JH(t,A)}const l5=t=>{const A=String(t);return"0000000".slice(A.length)+A};function Q5(t,A){if(t>=0){for(;t>127;)A.push(t&127|128),t=t>>>7;A.push(t)}else{for(let e=0;e<9;e++)A.push(t&127|128),t=t>>7;A.push(1)}}function UNA(){let t=this.buf[this.pos++],A=t&127;if((t&128)==0)return this.assertBounds(),A;if(t=this.buf[this.pos++],A|=(t&127)<<7,(t&128)==0)return this.assertBounds(),A;if(t=this.buf[this.pos++],A|=(t&127)<<14,(t&128)==0)return this.assertBounds(),A;if(t=this.buf[this.pos++],A|=(t&127)<<21,(t&128)==0)return this.assertBounds(),A;t=this.buf[this.pos++],A|=(t&15)<<28;for(let e=5;(t&128)!==0&&e<10;e++)t=this.buf[this.pos++];if((t&128)!=0)throw new Error("invalid varint");return this.assertBounds(),A>>>0}function KNA(){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 C5!="object"||C5.BUF_BIGINT_DISABLE!=="1")){const g=BigInt("-9223372036854775808"),I=BigInt("9223372036854775807"),n=BigInt("0"),o=BigInt("18446744073709551615");return{zero:BigInt(0),supported:!0,parse(a){const r=typeof a=="bigint"?a:BigInt(a);if(r>I||r<g)throw new Error("int64 invalid: ".concat(a));return r},uParse(a){const r=typeof a=="bigint"?a:BigInt(a);if(r>o||r<n)throw new Error("uint64 invalid: ".concat(a));return r},enc(a){return t.setBigInt64(0,this.parse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},uEnc(a){return t.setBigInt64(0,this.uParse(a),!0),{lo:t.getInt32(0,!0),hi:t.getInt32(4,!0)}},dec(a,r){return t.setInt32(0,a,!0),t.setInt32(4,r,!0),t.getBigInt64(0,!0)},uDec(a,r){return t.setInt32(0,a,!0),t.setInt32(4,r,!0),t.getBigUint64(0,!0)}}}const e=g=>$I(/^-?[0-9]+$/.test(g),"int64 invalid: ".concat(g)),i=g=>$I(/^[0-9]+$/.test(g),"uint64 invalid: ".concat(g));return{zero:"0",supported:!1,parse(g){return typeof g!="string"&&(g=g.toString()),e(g),g},uParse(g){return typeof g!="string"&&(g=g.toString()),i(g),g},enc(g){return typeof g!="string"&&(g=g.toString()),e(g),c5(g)},uEnc(g){return typeof g!="string"&&(g=g.toString()),i(g),c5(g)},dec(g,I){return GNA(g,I)},uDec(g,I){return heA(g,I)}}}const RI=KNA();var Ve;(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"})(Ve||(Ve={}));var iu;(function(t){t[t.BIGINT=0]="BIGINT",t[t.STRING=1]="STRING"})(iu||(iu={}));function CE(t,A,e){if(A===e)return!0;if(t==Ve.BYTES){if(!(A instanceof Uint8Array)||!(e instanceof Uint8Array)||A.length!==e.length)return!1;for(let i=0;i<A.length;i++)if(A[i]!==e[i])return!1;return!0}switch(t){case Ve.UINT64:case Ve.FIXED64:case Ve.INT64:case Ve.SFIXED64:case Ve.SINT64:return A==e}return!1}function ey(t,A){switch(t){case Ve.BOOL:return!1;case Ve.UINT64:case Ve.FIXED64:case Ve.INT64:case Ve.SFIXED64:case Ve.SINT64:return A==0?RI.zero:"0";case Ve.DOUBLE:case Ve.FLOAT:return 0;case Ve.BYTES:return new Uint8Array(0);case Ve.STRING:return"";default:return 0}}function peA(t,A){switch(t){case Ve.BOOL:return A===!1;case Ve.STRING:return A==="";case Ve.BYTES:return A instanceof Uint8Array&&!A.byteLength;default:return A==0}}var sn;(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"})(sn||(sn={}));class FNA{constructor(A){this.stack=[],this.textEncoder=A??new TextEncoder,this.chunks=[],this.buf=[]}finish(){this.chunks.push(new Uint8Array(this.buf));let A=0;for(let g=0;g<this.chunks.length;g++)A+=this.chunks[g].length;let e=new Uint8Array(A),i=0;for(let g=0;g<this.chunks.length;g++)e.set(this.chunks[g],i),i+=this.chunks[g].length;return this.chunks=[],e}fork(){return this.stack.push({chunks:this.chunks,buf:this.buf}),this.chunks=[],this.buf=[],this}join(){let A=this.finish(),e=this.stack.pop();if(!e)throw new Error("invalid state, fork stack empty");return this.chunks=e.chunks,this.buf=e.buf,this.uint32(A.byteLength),this.raw(A)}tag(A,e){return this.uint32((A<<3|e)>>>0)}raw(A){return this.buf.length&&(this.chunks.push(new Uint8Array(this.buf)),this.buf=[]),this.chunks.push(A),this}uint32(A){for(yT(A);A>127;)this.buf.push(A&127|128),A=A>>>7;return this.buf.push(A),this}int32(A){return fR(A),Q5(A,this.buf),this}bool(A){return this.buf.push(A?1:0),this}bytes(A){return this.uint32(A.byteLength),this.raw(A)}string(A){let e=this.textEncoder.encode(A);return this.uint32(e.byteLength),this.raw(e)}float(A){ceA(A);let e=new Uint8Array(4);return new DataView(e.buffer).setFloat32(0,A,!0),this.raw(e)}double(A){let e=new Uint8Array(8);return new DataView(e.buffer).setFloat64(0,A,!0),this.raw(e)}fixed32(A){yT(A);let e=new Uint8Array(4);return new DataView(e.buffer).setUint32(0,A,!0),this.raw(e)}sfixed32(A){fR(A);let e=new Uint8Array(4);return new DataView(e.buffer).setInt32(0,A,!0),this.raw(e)}sint32(A){return fR(A),A=(A<<1^A>>31)>>>0,Q5(A,this.buf),this}sfixed64(A){let e=new Uint8Array(8),i=new DataView(e.buffer),g=RI.enc(A);return i.setInt32(0,g.lo,!0),i.setInt32(4,g.hi,!0),this.raw(e)}fixed64(A){let e=new Uint8Array(8),i=new DataView(e.buffer),g=RI.uEnc(A);return i.setInt32(0,g.lo,!0),i.setInt32(4,g.hi,!0),this.raw(e)}int64(A){let e=RI.enc(A);return LJ(e.lo,e.hi,this.buf),this}sint64(A){let e=RI.enc(A),i=e.hi>>31,g=e.lo<<1^i,I=(e.hi<<1|e.lo>>>31)^i;return LJ(g,I,this.buf),this}uint64(A){let e=RI.uEnc(A);return LJ(e.lo,e.hi,this.buf),this}}class bNA{constructor(A,e){this.varint64=NNA,this.uint32=UNA,this.buf=A,this.len=A.length,this.pos=0,this.view=new DataView(A.buffer,A.byteOffset,A.byteLength),this.textDecoder=e??new TextDecoder}tag(){let A=this.uint32(),e=A>>>3,i=A&7;if(e<=0||i<0||i>5)throw new Error("illegal tag: field no "+e+" wire type "+i);return[e,i]}skip(A,e){let i=this.pos;switch(A){case sn.Varint:for(;this.buf[this.pos++]&128;);break;case sn.Bit64:this.pos+=4;case sn.Bit32:this.pos+=4;break;case sn.LengthDelimited:let g=this.uint32();this.pos+=g;break;case sn.StartGroup:for(;;){const[I,n]=this.tag();if(n===sn.EndGroup){if(e!==void 0&&I!==e)throw new Error("invalid end group tag");break}this.skip(n,I)}break;default:throw new Error("cant skip wire type "+A)}return this.assertBounds(),this.buf.subarray(i,this.pos)}assertBounds(){if(this.pos>this.len)throw new RangeError("premature EOF")}int32(){return this.uint32()|0}sint32(){let A=this.uint32();return A>>>1^-(A&1)}int64(){return RI.dec(...this.varint64())}uint64(){return RI.uDec(...this.varint64())}sint64(){let[A,e]=this.varint64(),i=-(A&1);return A=(A>>>1|(e&1)<<31)^i,e=e>>>1^i,RI.dec(A,e)}bool(){let[A,e]=this.varint64();return A!==0||e!==0}fixed32(){return this.view.getUint32((this.pos+=4)-4,!0)}sfixed32(){return this.view.getInt32((this.pos+=4)-4,!0)}fixed64(){return RI.uDec(this.sfixed32(),this.sfixed32())}sfixed64(){return RI.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 A=this.uint32(),e=this.pos;return this.pos+=A,this.assertBounds(),this.buf.subarray(e,e+A)}string(){return this.textDecoder.decode(this.bytes())}}function vNA(t,A,e,i){let g;return{typeName:A,extendee:e,get field(){if(!g){const I=typeof i=="function"?i():i;I.name=A.split(".").pop(),I.jsonName="[".concat(A,"]"),g=t.util.newFieldList([I]).list()[0]}return g},runtime:t}}function feA(t){const A=t.field.localName,e=Object.create(null);return e[A]=_NA(t),[e,()=>e[A]]}function _NA(t){const A=t.field;if(A.repeated)return[];if(A.default!==void 0)return A.default;switch(A.kind){case"enum":return A.T.values[0].no;case"scalar":return ey(A.T,A.L);case"message":const e=A.T,i=new e;return e.fieldWrapper?e.fieldWrapper.unwrapField(i):i;case"map":throw"map fields are not allowed to be extensions"}}function JNA(t,A){if(!A.repeated&&(A.kind=="enum"||A.kind=="scalar")){for(let e=t.length-1;e>=0;--e)if(t[e].no==A.no)return[t[e]];return[]}return t.filter(e=>e.no===A.no)}let Pl="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/".split(""),VF=[];for(let t=0;t<Pl.length;t++)VF[Pl[t].charCodeAt(0)]=t;VF[45]=Pl.indexOf("+");VF[95]=Pl.indexOf("/");const DeA={dec(t){let A=t.length*3/4;t[t.length-2]=="="?A-=2:t[t.length-1]=="="&&(A-=1);let e=new Uint8Array(A),i=0,g=0,I,n=0;for(let o=0;o<t.length;o++){if(I=VF[t.charCodeAt(o)],I===void 0)switch(t[o]){case"=":g=0;case`
`:case"\r":case"	":case" ":continue;default:throw Error("invalid base64 string.")}switch(g){case 0:n=I,g=1;break;case 1:e[i++]=n<<2|(I&48)>>4,n=I,g=2;break;case 2:e[i++]=(n&15)<<4|(I&60)>>2,n=I,g=3;break;case 3:e[i++]=(n&3)<<6|I,g=0;break}}if(g==1)throw Error("invalid base64 string.");return e.subarray(0,i)},enc(t){let A="",e=0,i,g=0;for(let I=0;I<t.length;I++)switch(i=t[I],e){case 0:A+=Pl[i>>2],g=(i&3)<<4,e=1;break;case 1:A+=Pl[g|i>>4],g=(i&15)<<2,e=2;break;case 2:A+=Pl[g|i>>6],A+=Pl[i&63],e=0;break}return e&&(A+=Pl[g],A+="=",e==1&&(A+="=")),A}};function LNA(t,A,e){SeA(A,t);const i=A.runtime.bin.makeReadOptions(e),g=JNA(t.getType().runtime.bin.listUnknownFields(t),A.field),[I,n]=feA(A);for(const o of g)A.runtime.bin.readField(I,i.readerFactory(o.data),A.field,o.wireType,i);return n()}function qNA(t,A,e,i){SeA(A,t);const g=A.runtime.bin.makeReadOptions(i),I=A.runtime.bin.makeWriteOptions(i);if(yeA(t,A)){const r=t.getType().runtime.bin.listUnknownFields(t).filter(s=>s.no!=A.field.no);t.getType().runtime.bin.discardUnknownFields(t);for(const s of r)t.getType().runtime.bin.onUnknownField(t,s.no,s.wireType,s.data)}const n=I.writerFactory();let o=A.field;!o.opt&&!o.repeated&&(o.kind=="enum"||o.kind=="scalar")&&(o=Object.assign(Object.assign({},A.field),{opt:!0})),A.runtime.bin.writeField(o,e,n,I);const a=g.readerFactory(n.finish());for(;a.pos<a.len;){const[r,s]=a.tag(),B=a.skip(s,r);t.getType().runtime.bin.onUnknownField(t,r,s,B)}}function yeA(t,A){const e=t.getType();return A.extendee.typeName===e.typeName&&!!e.runtime.bin.listUnknownFields(t).find(i=>i.no==A.field.no)}function SeA(t,A){$I(t.extendee.typeName==A.getType().typeName,"extension ".concat(t.typeName," can only be applied to message ").concat(t.extendee.typeName))}function weA(t,A){const e=t.localName;if(t.repeated)return A[e].length>0;if(t.oneof)return A[t.oneof.localName].case===e;switch(t.kind){case"enum":case"scalar":return t.opt||t.req?A[e]!==void 0:t.kind=="enum"?A[e]!==t.T.values[0].no:!peA(t.T,A[e]);case"message":return A[e]!==void 0;case"map":return Object.keys(A[e]).length>0}}function E5(t,A){const e=t.localName,i=!t.opt&&!t.req;if(t.repeated)A[e]=[];else if(t.oneof)A[t.oneof.localName]={case:void 0};else switch(t.kind){case"map":A[e]={};break;case"enum":A[e]=i?t.T.values[0].no:void 0;break;case"scalar":A[e]=i?ey(t.T,t.L):void 0;break;case"message":A[e]=void 0;break}}function jl(t,A){if(t===null||typeof t!="object"||!Object.getOwnPropertyNames(_H.prototype).every(i=>i in t&&typeof t[i]=="function"))return!1;const e=t.getType();return e===null||typeof e!="function"||!("typeName"in e)||typeof e.typeName!="string"?!1:A===void 0?!0:e.typeName==A.typeName}function meA(t,A){return jl(A)||!t.fieldWrapper?A:t.fieldWrapper.wrapField(A)}Ve.DOUBLE,Ve.FLOAT,Ve.INT64,Ve.UINT64,Ve.INT32,Ve.UINT32,Ve.BOOL,Ve.STRING,Ve.BYTES;const u5={ignoreUnknownFields:!1},h5={emitDefaultValues:!1,enumAsInteger:!1,useProtoFieldName:!1,prettySpaces:0};function xNA(t){return t?Object.assign(Object.assign({},u5),t):u5}function TNA(t){return t?Object.assign(Object.assign({},h5),t):h5}const bU=Symbol(),yR=Symbol();function YNA(){return{makeReadOptions:xNA,makeWriteOptions:TNA,readMessage(t,A,e,i){if(A==null||Array.isArray(A)||typeof A!="object")throw new Error("cannot decode message ".concat(t.typeName," from JSON: ").concat(mc(A)));i=i??new t;const g=new Map,I=e.typeRegistry;for(const[n,o]of Object.entries(A)){const a=t.fields.findJsonName(n);if(a){if(a.oneof){if(o===null&&a.kind=="scalar")continue;const r=g.get(a.oneof);if(r!==void 0)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: multiple keys for oneof "').concat(a.oneof.name,'" present: "').concat(r,'", "').concat(n,'"'));g.set(a.oneof,n)}d5(i,o,a,e,t)}else{let r=!1;if(I?.findExtension&&n.startsWith("[")&&n.endsWith("]")){const s=I.findExtension(n.substring(1,n.length-1));if(s&&s.extendee.typeName==t.typeName){r=!0;const[B,c]=feA(s);d5(B,o,s.field,e,s),qNA(i,s,c(),e)}}if(!r&&!e.ignoreUnknownFields)throw new Error("cannot decode message ".concat(t.typeName,' from JSON: key "').concat(n,'" is unknown'))}}return i},writeMessage(t,A){const e=t.getType(),i={};let g;try{for(g of e.fields.byNumber()){if(!weA(g,t)){if(g.req)throw"required field not set";if(!A.emitDefaultValues||!ONA(g))continue}const n=g.oneof?t[g.oneof.localName].value:t[g.localName],o=p5(g,n,A);o!==void 0&&(i[A.useProtoFieldName?g.name:g.jsonName]=o)}const I=A.typeRegistry;if(I?.findExtensionFor)for(const n of e.runtime.bin.listUnknownFields(t)){const o=I.findExtensionFor(e.typeName,n.no);if(o&&yeA(t,o)){const a=LNA(t,o,A),r=p5(o.field,a,A);r!==void 0&&(i[o.field.jsonName]=r)}}}catch(I){const n=g?"cannot encode field ".concat(e.typeName,".").concat(g.name," to JSON"):"cannot encode message ".concat(e.typeName," to JSON"),o=I instanceof Error?I.message:String(I);throw new Error(n+(o.length>0?": ".concat(o):""))}return i},readScalar(t,A,e){return Fm(t,A,e??iu.BIGINT,!0)},writeScalar(t,A,e){if(A!==void 0&&(e||peA(t,A)))return SR(t,A)},debug:mc}}function mc(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 d5(t,A,e,i,g){let I=e.localName;if(e.repeated){if($I(e.kind!="map"),A===null)return;if(!Array.isArray(A))throw new Error("cannot decode field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(A)));const n=t[I];for(const o of A){if(o===null)throw new Error("cannot decode field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(o)));switch(e.kind){case"message":n.push(e.T.fromJson(o,i));break;case"enum":const a=qJ(e.T,o,i.ignoreUnknownFields,!0);a!==yR&&n.push(a);break;case"scalar":try{n.push(Fm(e.T,o,e.L,!0))}catch(r){let s="cannot decode field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(o));throw r instanceof Error&&r.message.length>0&&(s+=": ".concat(r.message)),new Error(s)}break}}}else if(e.kind=="map"){if(A===null)return;if(typeof A!="object"||Array.isArray(A))throw new Error("cannot decode field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(A)));const n=t[I];for(const[o,a]of Object.entries(A)){if(a===null)throw new Error("cannot decode field ".concat(g.typeName,".").concat(e.name," from JSON: map value null"));let r;try{r=HNA(e.K,o)}catch(s){let B="cannot decode map key for field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(A));throw s instanceof Error&&s.message.length>0&&(B+=": ".concat(s.message)),new Error(B)}switch(e.V.kind){case"message":n[r]=e.V.T.fromJson(a,i);break;case"enum":const s=qJ(e.V.T,a,i.ignoreUnknownFields,!0);s!==yR&&(n[r]=s);break;case"scalar":try{n[r]=Fm(e.V.T,a,iu.BIGINT,!0)}catch(B){let c="cannot decode map value for field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(A));throw B instanceof Error&&B.message.length>0&&(c+=": ".concat(B.message)),new Error(c)}break}}}else switch(e.oneof&&(t=t[e.oneof.localName]={case:I},I="value"),e.kind){case"message":const n=e.T;if(A===null&&n.typeName!="google.protobuf.Value")return;let o=t[I];jl(o)?o.fromJson(A,i):(t[I]=o=n.fromJson(A,i),n.fieldWrapper&&!e.oneof&&(t[I]=n.fieldWrapper.unwrapField(o)));break;case"enum":const a=qJ(e.T,A,i.ignoreUnknownFields,!1);switch(a){case bU:E5(e,t);break;case yR:break;default:t[I]=a;break}break;case"scalar":try{const r=Fm(e.T,A,e.L,!1);switch(r){case bU:E5(e,t);break;default:t[I]=r;break}}catch(r){let s="cannot decode field ".concat(g.typeName,".").concat(e.name," from JSON: ").concat(mc(A));throw r instanceof Error&&r.message.length>0&&(s+=": ".concat(r.message)),new Error(s)}break}}function HNA(t,A){if(t===Ve.BOOL)switch(A){case"true":A=!0;break;case"false":A=!1;break}return Fm(t,A,iu.BIGINT,!0).toString()}function Fm(t,A,e,i){if(A===null)return i?ey(t,e):bU;switch(t){case Ve.DOUBLE:case Ve.FLOAT:if(A==="NaN")return Number.NaN;if(A==="Infinity")return Number.POSITIVE_INFINITY;if(A==="-Infinity")return Number.NEGATIVE_INFINITY;if(A===""||typeof A=="string"&&A.trim().length!==A.length||typeof A!="string"&&typeof A!="number")break;const g=Number(A);if(Number.isNaN(g)||!Number.isFinite(g))break;return t==Ve.FLOAT&&ceA(g),g;case Ve.INT32:case Ve.FIXED32:case Ve.SFIXED32:case Ve.SINT32:case Ve.UINT32:let I;if(typeof A=="number"?I=A:typeof A=="string"&&A.length>0&&A.trim().length===A.length&&(I=Number(A)),I===void 0)break;return t==Ve.UINT32||t==Ve.FIXED32?yT(I):fR(I),I;case Ve.INT64:case Ve.SFIXED64:case Ve.SINT64:if(typeof A!="number"&&typeof A!="string")break;const n=RI.parse(A);return e?n.toString():n;case Ve.FIXED64:case Ve.UINT64:if(typeof A!="number"&&typeof A!="string")break;const o=RI.uParse(A);return e?o.toString():o;case Ve.BOOL:if(typeof A!="boolean")break;return A;case Ve.STRING:if(typeof A!="string")break;try{encodeURIComponent(A)}catch{throw new Error("invalid UTF8")}return A;case Ve.BYTES:if(A==="")return new Uint8Array(0);if(typeof A!="string")break;return DeA.dec(A)}throw new Error}function qJ(t,A,e,i){if(A===null)return t.typeName=="google.protobuf.NullValue"?0:i?t.values[0].no:bU;switch(typeof A){case"number":if(Number.isInteger(A))return A;break;case"string":const g=t.findName(A);if(g!==void 0)return g.no;if(e)return yR;break}throw new Error("cannot decode enum ".concat(t.typeName," from JSON: ").concat(mc(A)))}function ONA(t){return t.repeated||t.kind=="map"?!0:!(t.oneof||t.kind=="message"||t.opt||t.req)}function p5(t,A,e){if(t.kind=="map"){$I(typeof A=="object"&&A!=null);const i={},g=Object.entries(A);switch(t.V.kind){case"scalar":for(const[n,o]of g)i[n.toString()]=SR(t.V.T,o);break;case"message":for(const[n,o]of g)i[n.toString()]=o.toJson(e);break;case"enum":const I=t.V.T;for(const[n,o]of g)i[n.toString()]=xJ(I,o,e.enumAsInteger);break}return e.emitDefaultValues||g.length>0?i:void 0}if(t.repeated){$I(Array.isArray(A));const i=[];switch(t.kind){case"scalar":for(let g=0;g<A.length;g++)i.push(SR(t.T,A[g]));break;case"enum":for(let g=0;g<A.length;g++)i.push(xJ(t.T,A[g],e.enumAsInteger));break;case"message":for(let g=0;g<A.length;g++)i.push(A[g].toJson(e));break}return e.emitDefaultValues||i.length>0?i:void 0}switch(t.kind){case"scalar":return SR(t.T,A);case"enum":return xJ(t.T,A,e.enumAsInteger);case"message":return meA(t.T,A).toJson(e)}}function xJ(t,A,e){var i;if($I(typeof A=="number"),t.typeName=="google.protobuf.NullValue")return null;if(e)return A;const g=t.findNumber(A);return(i=g?.name)!==null&&i!==void 0?i:A}function SR(t,A){switch(t){case Ve.INT32:case Ve.SFIXED32:case Ve.SINT32:case Ve.FIXED32:case Ve.UINT32:return $I(typeof A=="number"),A;case Ve.FLOAT:case Ve.DOUBLE:return $I(typeof A=="number"),Number.isNaN(A)?"NaN":A===Number.POSITIVE_INFINITY?"Infinity":A===Number.NEGATIVE_INFINITY?"-Infinity":A;case Ve.STRING:return $I(typeof A=="string"),A;case Ve.BOOL:return $I(typeof A=="boolean"),A;case Ve.UINT64:case Ve.FIXED64:case Ve.INT64:case Ve.SFIXED64:case Ve.SINT64:return $I(typeof A=="bigint"||typeof A=="string"||typeof A=="number"),A.toString();case Ve.BYTES:return $I(A instanceof Uint8Array),DeA.enc(A)}}const pf=Symbol("@bufbuild/protobuf/unknown-fields"),f5={readUnknownFields:!0,readerFactory:t=>new bNA(t)},D5={writeUnknownFields:!0,writerFactory:()=>new FNA};function PNA(t){return t?Object.assign(Object.assign({},f5),t):f5}function jNA(t){return t?Object.assign(Object.assign({},D5),t):D5}function ZNA(){return{makeReadOptions:PNA,makeWriteOptions:jNA,listUnknownFields(t){var A;return(A=t[pf])!==null&&A!==void 0?A:[]},discardUnknownFields(t){delete t[pf]},writeUnknownFields(t,A){const i=t[pf];if(i)for(const g of i)A.tag(g.no,g.wireType).raw(g.data)},onUnknownField(t,A,e,i){const g=t;Array.isArray(g[pf])||(g[pf]=[]),g[pf].push({no:A,wireType:e,data:i})},readMessage(t,A,e,i,g){const I=t.getType(),n=g?A.len:A.pos+e;let o,a;for(;A.pos<n&&([o,a]=A.tag(),!(g===!0&&a==sn.EndGroup));){const r=I.fields.find(o);if(!r){const s=A.skip(a,o);i.readUnknownFields&&this.onUnknownField(t,o,a,s);continue}y5(t,A,r,a,i)}if(g&&(a!=sn.EndGroup||o!==e))throw new Error("invalid end group tag")},readField:y5,writeMessage(t,A,e){const i=t.getType();for(const g of i.fields.byNumber()){if(!weA(g,t)){if(g.req)throw new Error("cannot encode field ".concat(i.typeName,".").concat(g.name," to binary: required field not set"));continue}const I=g.oneof?t[g.oneof.localName].value:t[g.localName];S5(g,I,A,e)}return e.writeUnknownFields&&this.writeUnknownFields(t,A),A},writeField(t,A,e,i){A!==void 0&&S5(t,A,e,i)}}}function y5(t,A,e,i,g){let{repeated:I,localName:n}=e;switch(e.oneof&&(t=t[e.oneof.localName],t.case!=n&&delete t.value,t.case=n,n="value"),e.kind){case"scalar":case"enum":const o=e.kind=="enum"?Ve.INT32:e.T;let a=vU;if(e.kind=="scalar"&&e.L>0&&(a=zNA),I){let c=t[n];if(i==sn.LengthDelimited&&o!=Ve.STRING&&o!=Ve.BYTES){let D=A.uint32()+A.pos;for(;A.pos<D;)c.push(a(A,o))}else c.push(a(A,o))}else t[n]=a(A,o);break;case"message":const r=e.T;I?t[n].push(wR(A,new r,g,e)):jl(t[n])?wR(A,t[n],g,e):(t[n]=wR(A,new r,g,e),r.fieldWrapper&&!e.oneof&&!e.repeated&&(t[n]=r.fieldWrapper.unwrapField(t[n])));break;case"map":let[s,B]=WNA(e,A,g);t[n][s]=B;break}}function wR(t,A,e,i){const g=A.getType().runtime.bin,I=i?.delimited;return g.readMessage(A,t,I?i.no:t.uint32(),e,I),A}function WNA(t,A,e){const i=A.uint32(),g=A.pos+i;let I,n;for(;A.pos<g;){const[o]=A.tag();switch(o){case 1:I=vU(A,t.K);break;case 2:switch(t.V.kind){case"scalar":n=vU(A,t.V.T);break;case"enum":n=A.int32();break;case"message":n=wR(A,new t.V.T,e,void 0);break}break}}if(I===void 0&&(I=ey(t.K,iu.BIGINT)),typeof I!="string"&&typeof I!="number"&&(I=I.toString()),n===void 0)switch(t.V.kind){case"scalar":n=ey(t.V.T,iu.BIGINT);break;case"enum":n=t.V.T.values[0].no;break;case"message":n=new t.V.T;break}return[I,n]}function zNA(t,A){const e=vU(t,A);return typeof e=="bigint"?e.toString():e}function vU(t,A){switch(A){case Ve.STRING:return t.string();case Ve.BOOL:return t.bool();case Ve.DOUBLE:return t.double();case Ve.FLOAT:return t.float();case Ve.INT32:return t.int32();case Ve.INT64:return t.int64();case Ve.UINT64:return t.uint64();case Ve.FIXED64:return t.fixed64();case Ve.BYTES:return t.bytes();case Ve.FIXED32:return t.fixed32();case Ve.SFIXED32:return t.sfixed32();case Ve.SFIXED64:return t.sfixed64();case Ve.SINT64:return t.sint64();case Ve.UINT32:return t.uint32();case Ve.SINT32:return t.sint32()}}function S5(t,A,e,i){$I(A!==void 0);const g=t.repeated;switch(t.kind){case"scalar":case"enum":let I=t.kind=="enum"?Ve.INT32:t.T;if(g)if($I(Array.isArray(A)),t.packed)XNA(e,I,t.no,A);else for(const n of A)bm(e,I,t.no,n);else bm(e,I,t.no,A);break;case"message":if(g){$I(Array.isArray(A));for(const n of A)w5(e,i,t,n)}else w5(e,i,t,A);break;case"map":$I(typeof A=="object"&&A!=null);for(const[n,o]of Object.entries(A))VNA(e,i,t,n,o);break}}function VNA(t,A,e,i,g){t.tag(e.no,sn.LengthDelimited),t.fork();let I=i;switch(e.K){case Ve.INT32:case Ve.FIXED32:case Ve.UINT32:case Ve.SFIXED32:case Ve.SINT32:I=Number.parseInt(i);break;case Ve.BOOL:$I(i=="true"||i=="false"),I=i=="true";break}switch(bm(t,e.K,1,I),e.V.kind){case"scalar":bm(t,e.V.T,2,g);break;case"enum":bm(t,Ve.INT32,2,g);break;case"message":$I(g!==void 0),t.tag(2,sn.LengthDelimited).bytes(g.toBinary(A));break}t.join()}function w5(t,A,e,i){const g=meA(e.T,i);e.delimited?t.tag(e.no,sn.StartGroup).raw(g.toBinary(A)).tag(e.no,sn.EndGroup):t.tag(e.no,sn.LengthDelimited).bytes(g.toBinary(A))}function bm(t,A,e,i){$I(i!==void 0);let[g,I]=keA(A);t.tag(e,g)[I](i)}function XNA(t,A,e,i){if(!i.length)return;t.tag(e,sn.LengthDelimited).fork();let[,g]=keA(A);for(let I=0;I<i.length;I++)t[g](i[I]);t.join()}function keA(t){let A=sn.Varint;switch(t){case Ve.BYTES:case Ve.STRING:A=sn.LengthDelimited;break;case Ve.DOUBLE:case Ve.FIXED64:case Ve.SFIXED64:A=sn.Bit64;break;case Ve.FIXED32:case Ve.SFIXED32:case Ve.FLOAT:A=sn.Bit32;break}const e=Ve[t].toLowerCase();return[A,e]}function $NA(){return{setEnumType:QeA,initPartial(t,A){if(t===void 0)return;const e=A.getType();for(const i of e.fields.byMember()){const g=i.localName,I=A,n=t;if(n[g]!=null)switch(i.kind){case"oneof":const o=n[g].case;if(o===void 0)continue;const a=i.findField(o);let r=n[g].value;a&&a.kind=="message"&&!jl(r,a.T)?r=new a.T(r):a&&a.kind==="scalar"&&a.T===Ve.BYTES&&(r=Sw(r)),I[g]={case:o,value:r};break;case"scalar":case"enum":let s=n[g];i.T===Ve.BYTES&&(s=i.repeated?s.map(Sw):Sw(s)),I[g]=s;break;case"map":switch(i.V.kind){case"scalar":case"enum":if(i.V.T===Ve.BYTES)for(const[E,D]of Object.entries(n[g]))I[g][E]=Sw(D);else Object.assign(I[g],n[g]);break;case"message":const c=i.V.T;for(const E of Object.keys(n[g])){let D=n[g][E];c.fieldWrapper||(D=new c(D)),I[g][E]=D}break}break;case"message":const B=i.T;if(i.repeated)I[g]=n[g].map(c=>jl(c,B)?c:new B(c));else{const c=n[g];B.fieldWrapper?B.typeName==="google.protobuf.BytesValue"?I[g]=Sw(c):I[g]=c:I[g]=jl(c,B)?c:new B(c)}break}}},equals(t,A,e){return A===e?!0:!A||!e?!1:t.fields.byMember().every(i=>{const g=A[i.localName],I=e[i.localName];if(i.repeated){if(g.length!==I.length)return!1;switch(i.kind){case"message":return g.every((n,o)=>i.T.equals(n,I[o]));case"scalar":return g.every((n,o)=>CE(i.T,n,I[o]));case"enum":return g.every((n,o)=>CE(Ve.INT32,n,I[o]))}throw new Error("repeated cannot contain ".concat(i.kind))}switch(i.kind){case"message":let n=g,o=I;return i.T.fieldWrapper&&(n!==void 0&&!jl(n)&&(n=i.T.fieldWrapper.wrapField(n)),o!==void 0&&!jl(o)&&(o=i.T.fieldWrapper.wrapField(o))),i.T.equals(n,o);case"enum":return CE(Ve.INT32,g,I);case"scalar":return CE(i.T,g,I);case"oneof":if(g.case!==I.case)return!1;const a=i.findField(g.case);if(a===void 0)return!0;switch(a.kind){case"message":return a.T.equals(g.value,I.value);case"enum":return CE(Ve.INT32,g.value,I.value);case"scalar":return CE(a.T,g.value,I.value)}throw new Error("oneof cannot contain ".concat(a.kind));case"map":const r=Object.keys(g).concat(Object.keys(I));switch(i.V.kind){case"message":const s=i.V.T;return r.every(c=>s.equals(g[c],I[c]));case"enum":return r.every(c=>CE(Ve.INT32,g[c],I[c]));case"scalar":const B=i.V.T;return r.every(c=>CE(B,g[c],I[c]))}break}})},clone(t){const A=t.getType(),e=new A,i=e;for(const g of A.fields.byMember()){const I=t[g.localName];let n;if(g.repeated)n=I.map(FN);else if(g.kind=="map"){n=i[g.localName];for(const[o,a]of Object.entries(I))n[o]=FN(a)}else g.kind=="oneof"?n=g.findField(I.case)?{case:I.case,value:FN(I.value)}:{case:void 0}:n=FN(I);i[g.localName]=n}for(const g of A.runtime.bin.listUnknownFields(t))A.runtime.bin.onUnknownField(i,g.no,g.wireType,g.data);return e}}}function FN(t){if(t===void 0)return t;if(jl(t))return t.clone();if(t instanceof Uint8Array){const A=new Uint8Array(t.byteLength);return A.set(t),A}return t}function Sw(t){return t instanceof Uint8Array?t:new Uint8Array(t)}function AGA(t,A,e){return{syntax:t,json:YNA(),bin:ZNA(),util:Object.assign(Object.assign({},$NA()),{newFieldList:A,initFields:e}),makeMessageType(i,g,I){return MNA(this,i,g,I)},makeEnum:kNA,makeEnumType:EeA,getEnumType:mNA,makeExtension(i,g,I){return vNA(this,i,g,I)}}}class eGA{constructor(A,e){this._fields=A,this._normalizer=e}findJsonName(A){if(!this.jsonNames){const e={};for(const i of this.list())e[i.jsonName]=e[i.name]=i;this.jsonNames=e}return this.jsonNames[A]}find(A){if(!this.numbers){const e={};for(const i of this.list())e[i.no]=i;this.numbers=e}return this.numbers[A]}list(){return this.all||(this.all=this._normalizer(this._fields)),this.all}byNumber(){return this.numbersAsc||(this.numbersAsc=this.list().concat().sort((A,e)=>A.no-e.no)),this.numbersAsc}byMember(){if(!this.members){this.members=[];const A=this.members;let e;for(const i of this.list())i.oneof?i.oneof!==e&&(e=i.oneof,A.push(e)):A.push(i)}return this.members}}function MeA(t,A){const e=NeA(t);return A?e:oGA(nGA(e))}function tGA(t){return MeA(t,!1)}const iGA=NeA;function NeA(t){let A=!1;const e=[];for(let i=0;i<t.length;i++){let g=t.charAt(i);switch(g){case"_":A=!0;break;case"0":case"1":case"2":case"3":case"4":case"5":case"6":case"7":case"8":case"9":e.push(g),A=!1;break;default:A&&(A=!1,g=g.toUpperCase()),e.push(g);break}}return e.join("")}const gGA=new Set(["constructor","toString","toJSON","valueOf"]),IGA=new Set(["getType","clone","equals","fromBinary","fromJson","fromJsonString","toBinary","toJson","toJsonString","toObject"]),GeA=t=>"".concat(t,"$"),nGA=t=>IGA.has(t)?GeA(t):t,oGA=t=>gGA.has(t)?GeA(t):t;class aGA{constructor(A){this.kind="oneof",this.repeated=!1,this.packed=!1,this.opt=!1,this.req=!1,this.default=void 0,this.fields=[],this.name=A,this.localName=tGA(A)}addField(A){$I(A.oneof===this,"field ".concat(A.name," not one of ").concat(this.name)),this.fields.push(A)}findField(A){if(!this._lookup){this._lookup=Object.create(null);for(let e=0;e<this.fields.length;e++)this._lookup[this.fields[e].localName]=this.fields[e]}return this._lookup[A]}}function rGA(t,A){var e,i,g,I,n,o;const a=[];let r;for(const s of typeof t=="function"?t():t){const B=s;if(B.localName=MeA(s.name,s.oneof!==void 0),B.jsonName=(e=s.jsonName)!==null&&e!==void 0?e:iGA(s.name),B.repeated=(i=s.repeated)!==null&&i!==void 0?i:!1,s.kind=="scalar"&&(B.L=(g=s.L)!==null&&g!==void 0?g:iu.BIGINT),B.delimited=(I=s.delimited)!==null&&I!==void 0?I:!1,B.req=(n=s.req)!==null&&n!==void 0?n:!1,B.opt=(o=s.opt)!==null&&o!==void 0?o:!1,s.packed===void 0&&(B.packed=s.kind=="enum"||s.kind=="scalar"&&s.T!=Ve.BYTES&&s.T!=Ve.STRING),s.oneof!==void 0){const c=typeof s.oneof=="string"?s.oneof:s.oneof.name;(!r||r.name!=c)&&(r=new aGA(c)),B.oneof=r,r.addField(B)}a.push(B)}return a}const ye=AGA("proto3",t=>new eGA(t,A=>rGA(A)),t=>{for(const A of t.getType().fields.byMember()){if(A.opt)continue;const e=A.localName,i=t;if(A.repeated){i[e]=[];continue}switch(A.kind){case"oneof":i[e]={case:void 0};break;case"enum":i[e]=0;break;case"map":i[e]={};break;case"scalar":i[e]=ey(A.T,A.L);break}}});class mr extends _H{constructor(A){super(),this.seconds=RI.zero,this.nanos=0,ye.util.initPartial(A,this)}fromJson(A,e){if(typeof A!="string")throw new Error("cannot decode google.protobuf.Timestamp from JSON: ".concat(ye.json.debug(A)));const i=A.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(!i)throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");const g=Date.parse(i[1]+"-"+i[2]+"-"+i[3]+"T"+i[4]+":"+i[5]+":"+i[6]+(i[8]?i[8]:"Z"));if(Number.isNaN(g))throw new Error("cannot decode google.protobuf.Timestamp from JSON: invalid RFC 3339 string");if(g<Date.parse("0001-01-01T00:00:00Z")||g>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=RI.parse(g/1e3),this.nanos=0,i[7]&&(this.nanos=parseInt("1"+i[7]+"0".repeat(9-i[7].length))-1e9),this}toJson(A){const e=Number(this.seconds)*1e3;if(e<Date.parse("0001-01-01T00:00:00Z")||e>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 i="Z";if(this.nanos>0){const g=(this.nanos+1e9).toString().substring(1);g.substring(3)==="000000"?i="."+g.substring(0,3)+"Z":g.substring(6)==="000"?i="."+g.substring(0,6)+"Z":i="."+g+"Z"}return new Date(e).toISOString().replace(".000Z",i)}toDate(){return new Date(Number(this.seconds)*1e3+Math.ceil(this.nanos/1e6))}static now(){return mr.fromDate(new Date)}static fromDate(A){const e=A.getTime();return new mr({seconds:RI.parse(Math.floor(e/1e3)),nanos:e%1e3*1e6})}static fromBinary(A,e){return new mr().fromBinary(A,e)}static fromJson(A,e){return new mr().fromJson(A,e)}static fromJsonString(A,e){return new mr().fromJsonString(A,e)}static equals(A,e){return ye.util.equals(mr,A,e)}}mr.runtime=ye;mr.typeName="google.protobuf.Timestamp";mr.fields=ye.util.newFieldList(()=>[{no:1,name:"seconds",kind:"scalar",T:3},{no:2,name:"nanos",kind:"scalar",T:5}]);const sGA=ye.makeMessageType("livekit.MetricsBatch",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:mr},{no:3,name:"str_data",kind:"scalar",T:9,repeated:!0},{no:4,name:"time_series",kind:"message",T:CGA,repeated:!0},{no:5,name:"events",kind:"message",T:cGA,repeated:!0}]),CGA=ye.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:BGA,repeated:!0},{no:5,name:"rid",kind:"scalar",T:13}]),BGA=ye.makeMessageType("livekit.MetricSample",()=>[{no:1,name:"timestamp_ms",kind:"scalar",T:3},{no:2,name:"normalized_timestamp",kind:"message",T:mr},{no:3,name:"value",kind:"scalar",T:2}]),cGA=ye.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:mr},{no:7,name:"normalized_end_timestamp",kind:"message",T:mr,opt:!0},{no:8,name:"metadata",kind:"scalar",T:9},{no:9,name:"rid",kind:"scalar",T:13}]),ReA=ye.makeEnum("livekit.BackupCodecPolicy",[{no:0,name:"PREFER_REGRESSION"},{no:1,name:"SIMULCAST"},{no:2,name:"REGRESSION"}]),oB=ye.makeEnum("livekit.TrackType",[{no:0,name:"AUDIO"},{no:1,name:"VIDEO"},{no:2,name:"DATA"}]),Mn=ye.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"}]),LH=ye.makeEnum("livekit.VideoQuality",[{no:0,name:"LOW"},{no:1,name:"MEDIUM"},{no:2,name:"HIGH"},{no:3,name:"OFF"}]),Cm=ye.makeEnum("livekit.ConnectionQuality",[{no:0,name:"POOR"},{no:1,name:"GOOD"},{no:2,name:"EXCELLENT"},{no:3,name:"LOST"}]),D0=ye.makeEnum("livekit.ClientConfigSetting",[{no:0,name:"UNSET"},{no:1,name:"DISABLED"},{no:2,name:"ENABLED"}]),cB=ye.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"}]),_h=ye.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"}]),lGA=ye.makeEnum("livekit.SubscriptionError",[{no:0,name:"SE_UNKNOWN"},{no:1,name:"SE_CODEC_UNSUPPORTED"},{no:2,name:"SE_TRACK_NOTFOUND"}]),Eo=ye.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"}]),XF=ye.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:_U,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:HeA}]),_U=ye.makeMessageType("livekit.Codec",()=>[{no:1,name:"mime",kind:"scalar",T:9},{no:2,name:"fmtp_line",kind:"scalar",T:9}]),QGA=ye.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:ye.getEnumType(Mn),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}]),md=ye.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:ye.getEnumType(kD)},{no:4,name:"tracks",kind:"message",T:oD,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:QGA},{no:12,name:"region",kind:"scalar",T:9},{no:13,name:"is_publisher",kind:"scalar",T:8},{no:14,name:"kind",kind:"enum",T:ye.getEnumType(y0)},{no:15,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:16,name:"disconnect_reason",kind:"enum",T:ye.getEnumType(cB)},{no:18,name:"kind_details",kind:"enum",T:ye.getEnumType(EGA),repeated:!0}]),kD=ye.makeEnum("livekit.ParticipantInfo.State",[{no:0,name:"JOINING"},{no:1,name:"JOINED"},{no:2,name:"ACTIVE"},{no:3,name:"DISCONNECTED"}]),y0=ye.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"}]),EGA=ye.makeEnum("livekit.ParticipantInfo.KindDetail",[{no:0,name:"CLOUD_AGENT"},{no:1,name:"FORWARDED"}]),On=ye.makeEnum("livekit.Encryption.Type",[{no:0,name:"NONE"},{no:1,name:"GCM"},{no:2,name:"CUSTOM"}]),uGA=ye.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:TE,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:ye.getEnumType(UeA)},{no:6,name:"sdp_cid",kind:"scalar",T:9}]),oD=ye.makeMessageType("livekit.TrackInfo",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"type",kind:"enum",T:ye.getEnumType(oB)},{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:ye.getEnumType(Mn)},{no:10,name:"layers",kind:"message",T:TE,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:uGA,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:ye.getEnumType(On)},{no:17,name:"stream",kind:"scalar",T:9},{no:18,name:"version",kind:"message",T:HeA},{no:19,name:"audio_features",kind:"enum",T:ye.getEnumType(Eo),repeated:!0},{no:20,name:"backup_codec_policy",kind:"enum",T:ye.getEnumType(ReA)}]),TE=ye.makeMessageType("livekit.VideoLayer",()=>[{no:1,name:"quality",kind:"enum",T:ye.getEnumType(LH)},{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}]),UeA=ye.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"}]),Wa=ye.makeMessageType("livekit.DataPacket",()=>[{no:1,name:"kind",kind:"enum",T:ye.getEnumType(Wi)},{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:qH,oneof:"value"},{no:3,name:"speaker",kind:"message",T:hGA,oneof:"value"},{no:6,name:"sip_dtmf",kind:"message",T:veA,oneof:"value"},{no:7,name:"transcription",kind:"message",T:dGA,oneof:"value"},{no:8,name:"metrics",kind:"message",T:sGA,oneof:"value"},{no:9,name:"chat_message",kind:"message",T:JU,oneof:"value"},{no:10,name:"rpc_request",kind:"message",T:xH,oneof:"value"},{no:11,name:"rpc_ack",kind:"message",T:TH,oneof:"value"},{no:12,name:"rpc_response",kind:"message",T:YH,oneof:"value"},{no:13,name:"stream_header",kind:"message",T:LU,oneof:"value"},{no:14,name:"stream_chunk",kind:"message",T:qU,oneof:"value"},{no:15,name:"stream_trailer",kind:"message",T:xU,oneof:"value"},{no:18,name:"encrypted_packet",kind:"message",T:KeA,oneof:"value"},{no:16,name:"sequence",kind:"scalar",T:13},{no:17,name:"participant_sid",kind:"scalar",T:9}]),Wi=ye.makeEnum("livekit.DataPacket.Kind",[{no:0,name:"RELIABLE"},{no:1,name:"LOSSY"}]),KeA=ye.makeMessageType("livekit.EncryptedPacket",()=>[{no:1,name:"encryption_type",kind:"enum",T:ye.getEnumType(On)},{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}]),FeA=ye.makeMessageType("livekit.EncryptedPacketPayload",()=>[{no:1,name:"user",kind:"message",T:qH,oneof:"value"},{no:3,name:"chat_message",kind:"message",T:JU,oneof:"value"},{no:4,name:"rpc_request",kind:"message",T:xH,oneof:"value"},{no:5,name:"rpc_ack",kind:"message",T:TH,oneof:"value"},{no:6,name:"rpc_response",kind:"message",T:YH,oneof:"value"},{no:7,name:"stream_header",kind:"message",T:LU,oneof:"value"},{no:8,name:"stream_chunk",kind:"message",T:qU,oneof:"value"},{no:9,name:"stream_trailer",kind:"message",T:xU,oneof:"value"}]),hGA=ye.makeMessageType("livekit.ActiveSpeakerUpdate",()=>[{no:1,name:"speakers",kind:"message",T:beA,repeated:!0}]),beA=ye.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}]),qH=ye.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}]),veA=ye.makeMessageType("livekit.SipDTMF",()=>[{no:3,name:"code",kind:"scalar",T:13},{no:4,name:"digit",kind:"scalar",T:9}]),dGA=ye.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:pGA,repeated:!0}]),pGA=ye.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}]),JU=ye.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}]),xH=ye.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}]),TH=ye.makeMessageType("livekit.RpcAck",()=>[{no:1,name:"request_id",kind:"scalar",T:9}]),YH=ye.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:_eA,oneof:"value"}]),_eA=ye.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}]),JeA=ye.makeMessageType("livekit.ParticipantTracks",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"track_sids",kind:"scalar",T:9,repeated:!0}]),LeA=ye.makeMessageType("livekit.ServerInfo",()=>[{no:1,name:"edition",kind:"enum",T:ye.getEnumType(qeA)},{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}]),qeA=ye.makeEnum("livekit.ServerInfo.Edition",[{no:0,name:"Standard"},{no:1,name:"Cloud"}]),xeA=ye.makeMessageType("livekit.ClientInfo",()=>[{no:1,name:"sdk",kind:"enum",T:ye.getEnumType(TeA)},{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}]),TeA=ye.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"}]),YeA=ye.makeMessageType("livekit.ClientConfiguration",()=>[{no:1,name:"video",kind:"message",T:m5},{no:2,name:"screen",kind:"message",T:m5},{no:3,name:"resume_connection",kind:"enum",T:ye.getEnumType(D0)},{no:4,name:"disabled_codecs",kind:"message",T:fGA},{no:5,name:"force_relay",kind:"enum",T:ye.getEnumType(D0)}]),m5=ye.makeMessageType("livekit.VideoConfiguration",()=>[{no:1,name:"hardware_encoder",kind:"enum",T:ye.getEnumType(D0)}]),fGA=ye.makeMessageType("livekit.DisabledCodecs",()=>[{no:1,name:"codecs",kind:"message",T:_U,repeated:!0},{no:2,name:"publish",kind:"message",T:_U,repeated:!0}]),HeA=ye.makeMessageType("livekit.TimedVersion",()=>[{no:1,name:"unix_micro",kind:"scalar",T:3},{no:2,name:"ticks",kind:"scalar",T:5}]),ST=ye.makeEnum("livekit.DataStream.OperationType",[{no:0,name:"CREATE"},{no:1,name:"UPDATE"},{no:2,name:"DELETE"},{no:3,name:"REACTION"}]),OeA=ye.makeMessageType("livekit.DataStream.TextHeader",()=>[{no:1,name:"operation_type",kind:"enum",T:ye.getEnumType(ST)},{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"}),PeA=ye.makeMessageType("livekit.DataStream.ByteHeader",()=>[{no:1,name:"name",kind:"scalar",T:9}],{localName:"DataStream_ByteHeader"}),LU=ye.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:ye.getEnumType(On)},{no:8,name:"attributes",kind:"map",K:9,V:{kind:"scalar",T:9}},{no:9,name:"text_header",kind:"message",T:OeA,oneof:"content_header"},{no:10,name:"byte_header",kind:"message",T:PeA,oneof:"content_header"}],{localName:"DataStream_Header"}),qU=ye.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"}),xU=ye.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"}),DGA=ye.makeMessageType("livekit.SubscribedAudioCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"enabled",kind:"scalar",T:8}]),aB=ye.makeEnum("livekit.SignalTarget",[{no:0,name:"PUBLISHER"},{no:1,name:"SUBSCRIBER"}]),wT=ye.makeEnum("livekit.StreamState",[{no:0,name:"ACTIVE"},{no:1,name:"PAUSED"}]),yGA=ye.makeEnum("livekit.CandidateProtocol",[{no:0,name:"UDP"},{no:1,name:"TCP"},{no:2,name:"TLS"}]),SGA=ye.makeMessageType("livekit.SignalRequest",()=>[{no:1,name:"offer",kind:"message",T:gu,oneof:"message"},{no:2,name:"answer",kind:"message",T:gu,oneof:"message"},{no:3,name:"trickle",kind:"message",T:$F,oneof:"message"},{no:4,name:"add_track",kind:"message",T:S0,oneof:"message"},{no:5,name:"mute",kind:"message",T:Ab,oneof:"message"},{no:6,name:"subscription",kind:"message",T:eb,oneof:"message"},{no:7,name:"track_setting",kind:"message",T:jeA,oneof:"message"},{no:8,name:"leave",kind:"message",T:tb,oneof:"message"},{no:10,name:"update_layers",kind:"message",T:WeA,oneof:"message"},{no:11,name:"subscription_permission",kind:"message",T:XeA,oneof:"message"},{no:12,name:"sync_state",kind:"message",T:ZH,oneof:"message"},{no:13,name:"simulate",kind:"message",T:yc,oneof:"message"},{no:14,name:"ping",kind:"scalar",T:3,oneof:"message"},{no:15,name:"update_metadata",kind:"message",T:PH,oneof:"message"},{no:16,name:"ping_req",kind:"message",T:etA,oneof:"message"},{no:17,name:"update_audio_track",kind:"message",T:OH,oneof:"message"},{no:18,name:"update_video_track",kind:"message",T:ZeA,oneof:"message"}]),k5=ye.makeMessageType("livekit.SignalResponse",()=>[{no:1,name:"join",kind:"message",T:wGA,oneof:"message"},{no:2,name:"answer",kind:"message",T:gu,oneof:"message"},{no:3,name:"offer",kind:"message",T:gu,oneof:"message"},{no:4,name:"trickle",kind:"message",T:$F,oneof:"message"},{no:5,name:"update",kind:"message",T:MGA,oneof:"message"},{no:6,name:"track_published",kind:"message",T:HH,oneof:"message"},{no:8,name:"leave",kind:"message",T:tb,oneof:"message"},{no:9,name:"mute",kind:"message",T:Ab,oneof:"message"},{no:10,name:"speakers_changed",kind:"message",T:NGA,oneof:"message"},{no:11,name:"room_update",kind:"message",T:GGA,oneof:"message"},{no:12,name:"connection_quality",kind:"message",T:UGA,oneof:"message"},{no:13,name:"stream_state_update",kind:"message",T:FGA,oneof:"message"},{no:14,name:"subscribed_quality_update",kind:"message",T:vGA,oneof:"message"},{no:15,name:"subscription_permission_update",kind:"message",T:JGA,oneof:"message"},{no:16,name:"refresh_token",kind:"scalar",T:9,oneof:"message"},{no:17,name:"track_unpublished",kind:"message",T:kGA,oneof:"message"},{no:18,name:"pong",kind:"scalar",T:3,oneof:"message"},{no:19,name:"reconnect",kind:"message",T:mGA,oneof:"message"},{no:20,name:"pong_resp",kind:"message",T:qGA,oneof:"message"},{no:21,name:"subscription_response",kind:"message",T:YGA,oneof:"message"},{no:22,name:"request_response",kind:"message",T:HGA,oneof:"message"},{no:23,name:"track_subscribed",kind:"message",T:OGA,oneof:"message"},{no:24,name:"room_moved",kind:"message",T:LGA,oneof:"message"},{no:25,name:"media_sections_requirement",kind:"message",T:WGA,oneof:"message"},{no:26,name:"subscribed_audio_codec_update",kind:"message",T:_GA,oneof:"message"}]),mT=ye.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:TE,repeated:!0},{no:5,name:"video_layer_mode",kind:"enum",T:ye.getEnumType(UeA)}]),S0=ye.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:ye.getEnumType(oB)},{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:ye.getEnumType(Mn)},{no:9,name:"layers",kind:"message",T:TE,repeated:!0},{no:10,name:"simulcast_codecs",kind:"message",T:mT,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:ye.getEnumType(On)},{no:15,name:"stream",kind:"scalar",T:9},{no:16,name:"backup_codec_policy",kind:"enum",T:ye.getEnumType(ReA)},{no:17,name:"audio_features",kind:"enum",T:ye.getEnumType(Eo),repeated:!0}]),$F=ye.makeMessageType("livekit.TrickleRequest",()=>[{no:1,name:"candidateInit",kind:"scalar",T:9},{no:2,name:"target",kind:"enum",T:ye.getEnumType(aB)},{no:3,name:"final",kind:"scalar",T:8}]),Ab=ye.makeMessageType("livekit.MuteTrackRequest",()=>[{no:1,name:"sid",kind:"scalar",T:9},{no:2,name:"muted",kind:"scalar",T:8}]),wGA=ye.makeMessageType("livekit.JoinResponse",()=>[{no:1,name:"room",kind:"message",T:XF},{no:2,name:"participant",kind:"message",T:md},{no:3,name:"other_participants",kind:"message",T:md,repeated:!0},{no:4,name:"server_version",kind:"scalar",T:9},{no:5,name:"ice_servers",kind:"message",T:zeA,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:YeA},{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:LeA},{no:13,name:"sif_trailer",kind:"scalar",T:12},{no:14,name:"enabled_publish_codecs",kind:"message",T:_U,repeated:!0},{no:15,name:"fast_publish",kind:"scalar",T:8}]),mGA=ye.makeMessageType("livekit.ReconnectResponse",()=>[{no:1,name:"ice_servers",kind:"message",T:zeA,repeated:!0},{no:2,name:"client_configuration",kind:"message",T:YeA},{no:3,name:"server_info",kind:"message",T:LeA},{no:4,name:"last_message_seq",kind:"scalar",T:13}]),HH=ye.makeMessageType("livekit.TrackPublishedResponse",()=>[{no:1,name:"cid",kind:"scalar",T:9},{no:2,name:"track",kind:"message",T:oD}]),kGA=ye.makeMessageType("livekit.TrackUnpublishedResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),gu=ye.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}}]),MGA=ye.makeMessageType("livekit.ParticipantUpdate",()=>[{no:1,name:"participants",kind:"message",T:md,repeated:!0}]),eb=ye.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:JeA,repeated:!0}]),jeA=ye.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:ye.getEnumType(LH)},{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}]),OH=ye.makeMessageType("livekit.UpdateLocalAudioTrack",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"features",kind:"enum",T:ye.getEnumType(Eo),repeated:!0}]),ZeA=ye.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}]),tb=ye.makeMessageType("livekit.LeaveRequest",()=>[{no:1,name:"can_reconnect",kind:"scalar",T:8},{no:2,name:"reason",kind:"enum",T:ye.getEnumType(cB)},{no:3,name:"action",kind:"enum",T:ye.getEnumType(MD)},{no:4,name:"regions",kind:"message",T:xGA}]),MD=ye.makeEnum("livekit.LeaveRequest.Action",[{no:0,name:"DISCONNECT"},{no:1,name:"RESUME"},{no:2,name:"RECONNECT"}]),WeA=ye.makeMessageType("livekit.UpdateVideoLayers",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"layers",kind:"message",T:TE,repeated:!0}]),PH=ye.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}]),zeA=ye.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}]),NGA=ye.makeMessageType("livekit.SpeakersChanged",()=>[{no:1,name:"speakers",kind:"message",T:beA,repeated:!0}]),GGA=ye.makeMessageType("livekit.RoomUpdate",()=>[{no:1,name:"room",kind:"message",T:XF}]),RGA=ye.makeMessageType("livekit.ConnectionQualityInfo",()=>[{no:1,name:"participant_sid",kind:"scalar",T:9},{no:2,name:"quality",kind:"enum",T:ye.getEnumType(Cm)},{no:3,name:"score",kind:"scalar",T:2}]),UGA=ye.makeMessageType("livekit.ConnectionQualityUpdate",()=>[{no:1,name:"updates",kind:"message",T:RGA,repeated:!0}]),KGA=ye.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:ye.getEnumType(wT)}]),FGA=ye.makeMessageType("livekit.StreamStateUpdate",()=>[{no:1,name:"stream_states",kind:"message",T:KGA,repeated:!0}]),jH=ye.makeMessageType("livekit.SubscribedQuality",()=>[{no:1,name:"quality",kind:"enum",T:ye.getEnumType(LH)},{no:2,name:"enabled",kind:"scalar",T:8}]),bGA=ye.makeMessageType("livekit.SubscribedCodec",()=>[{no:1,name:"codec",kind:"scalar",T:9},{no:2,name:"qualities",kind:"message",T:jH,repeated:!0}]),vGA=ye.makeMessageType("livekit.SubscribedQualityUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_qualities",kind:"message",T:jH,repeated:!0},{no:3,name:"subscribed_codecs",kind:"message",T:bGA,repeated:!0}]),_GA=ye.makeMessageType("livekit.SubscribedAudioCodecUpdate",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"subscribed_audio_codecs",kind:"message",T:DGA,repeated:!0}]),VeA=ye.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}]),XeA=ye.makeMessageType("livekit.SubscriptionPermission",()=>[{no:1,name:"all_participants",kind:"scalar",T:8},{no:2,name:"track_permissions",kind:"message",T:VeA,repeated:!0}]),JGA=ye.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}]),LGA=ye.makeMessageType("livekit.RoomMovedResponse",()=>[{no:1,name:"room",kind:"message",T:XF},{no:2,name:"token",kind:"scalar",T:9},{no:3,name:"participant",kind:"message",T:md},{no:4,name:"other_participants",kind:"message",T:md,repeated:!0}]),ZH=ye.makeMessageType("livekit.SyncState",()=>[{no:1,name:"answer",kind:"message",T:gu},{no:2,name:"subscription",kind:"message",T:eb},{no:3,name:"publish_tracks",kind:"message",T:HH,repeated:!0},{no:4,name:"data_channels",kind:"message",T:AtA,repeated:!0},{no:5,name:"offer",kind:"message",T:gu},{no:6,name:"track_sids_disabled",kind:"scalar",T:9,repeated:!0},{no:7,name:"datachannel_receive_states",kind:"message",T:$eA,repeated:!0}]),$eA=ye.makeMessageType("livekit.DataChannelReceiveState",()=>[{no:1,name:"publisher_sid",kind:"scalar",T:9},{no:2,name:"last_seq",kind:"scalar",T:13}]),AtA=ye.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:ye.getEnumType(aB)}]),yc=ye.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:ye.getEnumType(yGA),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"}]),etA=ye.makeMessageType("livekit.Ping",()=>[{no:1,name:"timestamp",kind:"scalar",T:3},{no:2,name:"rtt",kind:"scalar",T:3}]),qGA=ye.makeMessageType("livekit.Pong",()=>[{no:1,name:"last_ping_timestamp",kind:"scalar",T:3},{no:2,name:"timestamp",kind:"scalar",T:3}]),xGA=ye.makeMessageType("livekit.RegionSettings",()=>[{no:1,name:"regions",kind:"message",T:TGA,repeated:!0}]),TGA=ye.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}]),YGA=ye.makeMessageType("livekit.SubscriptionResponse",()=>[{no:1,name:"track_sid",kind:"scalar",T:9},{no:2,name:"err",kind:"enum",T:ye.getEnumType(lGA)}]),HGA=ye.makeMessageType("livekit.RequestResponse",()=>[{no:1,name:"request_id",kind:"scalar",T:13},{no:2,name:"reason",kind:"enum",T:ye.getEnumType(WH)},{no:3,name:"message",kind:"scalar",T:9},{no:4,name:"trickle",kind:"message",T:$F,oneof:"request"},{no:5,name:"add_track",kind:"message",T:S0,oneof:"request"},{no:6,name:"mute",kind:"message",T:Ab,oneof:"request"},{no:7,name:"update_metadata",kind:"message",T:PH,oneof:"request"},{no:8,name:"update_audio_track",kind:"message",T:OH,oneof:"request"},{no:9,name:"update_video_track",kind:"message",T:ZeA,oneof:"request"}]),WH=ye.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"}]),OGA=ye.makeMessageType("livekit.TrackSubscribed",()=>[{no:1,name:"track_sid",kind:"scalar",T:9}]),ttA=ye.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}]),PGA=ye.makeMessageType("livekit.JoinRequest",()=>[{no:1,name:"client_info",kind:"message",T:xeA},{no:2,name:"connection_settings",kind:"message",T:ttA},{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:S0,repeated:!0},{no:6,name:"publisher_offer",kind:"message",T:gu},{no:7,name:"reconnect",kind:"scalar",T:8},{no:8,name:"reconnect_reason",kind:"enum",T:ye.getEnumType(_h)},{no:9,name:"participant_sid",kind:"scalar",T:9},{no:10,name:"sync_state",kind:"message",T:ZH}]),jGA=ye.makeMessageType("livekit.WrappedJoinRequest",()=>[{no:1,name:"compression",kind:"enum",T:ye.getEnumType(ZGA)},{no:2,name:"join_request",kind:"scalar",T:12}]),ZGA=ye.makeEnum("livekit.WrappedJoinRequest.Compression",[{no:0,name:"NONE"},{no:1,name:"GZIP"}]),WGA=ye.makeMessageType("livekit.MediaSectionsRequirement",()=>[{no:1,name:"num_audios",kind:"scalar",T:13},{no:2,name:"num_videos",kind:"scalar",T:13}]);function zGA(t){return t&&t.__esModule&&Object.prototype.hasOwnProperty.call(t,"default")?t.default:t}var mR={exports:{}},VGA=mR.exports,M5;function XGA(){return M5||(M5=1,function(t){(function(A,e){t.exports?t.exports=e():A.log=e()})(VGA,function(){var A=function(){},e="undefined",i=typeof window!==e&&typeof window.navigator!==e&&/Trident\/|MSIE /.test(window.navigator.userAgent),g=["trace","debug","info","warn","error"],I={},n=null;function o(y,S){var f=y[S];if(typeof f.bind=="function")return f.bind(y);try{return Function.prototype.bind.call(f,y)}catch{return function(){return Function.prototype.apply.apply(f,[y,arguments])}}}function a(){console.log&&(console.log.apply||Function.prototype.apply.apply(console.log,[console,arguments]))}function r(y){return y==="debug"&&(y="log"),typeof console===e?!1:y==="trace"&&i?a:console[y]!==void 0?o(console,y):console.log!==void 0?o(console,"log"):A}function s(){for(var y=this.getLevel(),S=0;S<g.length;S++){var f=g[S];this[f]=S<y?A:this.methodFactory(f,y,this.name)}if(this.log=this.debug,typeof console===e&&y<this.levels.SILENT)return"No console available for logging"}function B(y){return function(){typeof console!==e&&(s.call(this),this[y].apply(this,arguments))}}function c(y,S,f){return r(y)||B.apply(this,arguments)}function E(y,S){var f=this,M,k,m,U="loglevel";typeof y=="string"?U+=":"+y:typeof y=="symbol"&&(U=void 0);function F(J){var x=(g[J]||"silent").toUpperCase();if(!(typeof window===e||!U)){try{window.localStorage[U]=x;return}catch{}try{window.document.cookie=encodeURIComponent(U)+"="+x+";"}catch{}}}function b(){var J;if(!(typeof window===e||!U)){try{J=window.localStorage[U]}catch{}if(typeof J===e)try{var x=window.document.cookie,H=encodeURIComponent(U),P=x.indexOf(H+"=");P!==-1&&(J=/^([^;]+)/.exec(x.slice(P+H.length+1))[1])}catch{}return f.levels[J]===void 0&&(J=void 0),J}}function K(){if(!(typeof window===e||!U)){try{window.localStorage.removeItem(U)}catch{}try{window.document.cookie=encodeURIComponent(U)+"=; expires=Thu, 01 Jan 1970 00:00:00 UTC"}catch{}}}function R(J){var x=J;if(typeof x=="string"&&f.levels[x.toUpperCase()]!==void 0&&(x=f.levels[x.toUpperCase()]),typeof x=="number"&&x>=0&&x<=f.levels.SILENT)return x;throw new TypeError("log.setLevel() called with invalid level: "+J)}f.name=y,f.levels={TRACE:0,DEBUG:1,INFO:2,WARN:3,ERROR:4,SILENT:5},f.methodFactory=S||c,f.getLevel=function(){return m??k??M},f.setLevel=function(J,x){return m=R(J),x!==!1&&F(m),s.call(f)},f.setDefaultLevel=function(J){k=R(J),b()||f.setLevel(J,!1)},f.resetLevel=function(){m=null,K(),s.call(f)},f.enableAll=function(J){f.setLevel(f.levels.TRACE,J)},f.disableAll=function(J){f.setLevel(f.levels.SILENT,J)},f.rebuild=function(){if(n!==f&&(M=R(n.getLevel())),s.call(f),n===f)for(var J in I)I[J].rebuild()},M=R(n?n.getLevel():"WARN");var G=b();G!=null&&(m=R(G)),s.call(f)}n=new E,n.getLogger=function(S){if(typeof S!="symbol"&&typeof S!="string"||S==="")throw new TypeError("You must supply a name when creating a logger.");var f=I[S];return f||(f=I[S]=new E(S,n.methodFactory)),f};var D=typeof window!==e?window.log:void 0;return n.noConflict=function(){return typeof window!==e&&window.log===n&&(window.log=D),n},n.getLoggers=function(){return I},n.default=n,n})}(mR)),mR.exports}var ib=XGA(),kT;(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"})(kT||(kT={}));var yB;(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"})(yB||(yB={}));let Ji=ib.getLogger("livekit");Object.values(yB).map(t=>ib.getLogger(t));Ji.setDefaultLevel(kT.info);function uQ(t){const A=ib.getLogger(t);return A.setDefaultLevel(Ji.getLevel()),A}const $GA=ib.getLogger("lk-e2ee"),ww=7e3,ARA=[0,300,4*300,9*300,16*300,ww,ww,ww,ww,ww];class eRA{constructor(A){this._retryDelays=A!==void 0?[...A]:ARA}nextRetryDelayInMs(A){if(A.retryCount>=this._retryDelays.length)return null;const e=this._retryDelays[A.retryCount];return A.retryCount<=1?e:e+Math.random()*1e3}}function tRA(t,A){var e={};for(var i in t)Object.prototype.hasOwnProperty.call(t,i)&&A.indexOf(i)<0&&(e[i]=t[i]);if(t!=null&&typeof Object.getOwnPropertySymbols=="function")for(var g=0,i=Object.getOwnPropertySymbols(t);g<i.length;g++)A.indexOf(i[g])<0&&Object.prototype.propertyIsEnumerable.call(t,i[g])&&(e[i[g]]=t[i[g]]);return e}function vA(t,A,e,i){function g(I){return I instanceof e?I:new e(function(n){n(I)})}return new(e||(e=Promise))(function(I,n){function o(s){try{r(i.next(s))}catch(B){n(B)}}function a(s){try{r(i.throw(s))}catch(B){n(B)}}function r(s){s.done?I(s.value):g(s.value).then(o,a)}r((i=i.apply(t,A||[])).next())})}function N5(t){var A=typeof Symbol=="function"&&Symbol.iterator,e=A&&t[A],i=0;if(e)return e.call(t);if(t&&typeof t.length=="number")return{next:function(){return t&&i>=t.length&&(t=void 0),{value:t&&t[i++],done:!t}}};throw new TypeError(A?"Object is not iterable.":"Symbol.iterator is not defined.")}function Zl(t){if(!Symbol.asyncIterator)throw new TypeError("Symbol.asyncIterator is not defined.");var A=t[Symbol.asyncIterator],e;return A?A.call(t):(t=typeof N5=="function"?N5(t):t[Symbol.iterator](),e={},i("next"),i("throw"),i("return"),e[Symbol.asyncIterator]=function(){return this},e);function i(I){e[I]=t[I]&&function(n){return new Promise(function(o,a){n=t[I](n),g(o,a,n.done,n.value)})}}function g(I,n,o,a){Promise.resolve(a).then(function(r){I({value:r,done:o})},n)}}var bN={exports:{}},G5;function iRA(){if(G5)return bN.exports;G5=1;var t=typeof Reflect=="object"?Reflect:null,A=t&&typeof t.apply=="function"?t.apply:function(U,F,b){return Function.prototype.apply.call(U,F,b)},e;t&&typeof t.ownKeys=="function"?e=t.ownKeys:Object.getOwnPropertySymbols?e=function(U){return Object.getOwnPropertyNames(U).concat(Object.getOwnPropertySymbols(U))}:e=function(U){return Object.getOwnPropertyNames(U)};function i(m){}var g=Number.isNaN||function(U){return U!==U};function I(){I.init.call(this)}bN.exports=I,bN.exports.once=f,I.EventEmitter=I,I.prototype._events=void 0,I.prototype._eventsCount=0,I.prototype._maxListeners=void 0;var n=10;function o(m){if(typeof m!="function")throw new TypeError('The "listener" argument must be of type Function. Received type '+typeof m)}Object.defineProperty(I,"defaultMaxListeners",{enumerable:!0,get:function(){return n},set:function(m){if(typeof m!="number"||m<0||g(m))throw new RangeError('The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received '+m+".");n=m}}),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(U){if(typeof U!="number"||U<0||g(U))throw new RangeError('The value of "n" is out of range. It must be a non-negative number. Received '+U+".");return this._maxListeners=U,this};function a(m){return m._maxListeners===void 0?I.defaultMaxListeners:m._maxListeners}I.prototype.getMaxListeners=function(){return a(this)},I.prototype.emit=function(U){for(var F=[],b=1;b<arguments.length;b++)F.push(arguments[b]);var K=U==="error",R=this._events;if(R!==void 0)K=K&&R.error===void 0;else if(!K)return!1;if(K){var G;if(F.length>0&&(G=F[0]),G instanceof Error)throw G;var J=new Error("Unhandled error."+(G?" ("+G.message+")":""));throw J.context=G,J}var x=R[U];if(x===void 0)return!1;if(typeof x=="function")A(x,this,F);else for(var H=x.length,P=D(x,H),b=0;b<H;++b)A(P[b],this,F);return!0};function r(m,U,F,b){var K,R,G;if(o(F),R=m._events,R===void 0?(R=m._events=Object.create(null),m._eventsCount=0):(R.newListener!==void 0&&(m.emit("newListener",U,F.listener?F.listener:F),R=m._events),G=R[U]),G===void 0)G=R[U]=F,++m._eventsCount;else if(typeof G=="function"?G=R[U]=b?[F,G]:[G,F]:b?G.unshift(F):G.push(F),K=a(m),K>0&&G.length>K&&!G.warned){G.warned=!0;var J=new Error("Possible EventEmitter memory leak detected. "+G.length+" "+String(U)+" listeners added. Use emitter.setMaxListeners() to increase limit");J.name="MaxListenersExceededWarning",J.emitter=m,J.type=U,J.count=G.length}return m}I.prototype.addListener=function(U,F){return r(this,U,F,!1)},I.prototype.on=I.prototype.addListener,I.prototype.prependListener=function(U,F){return r(this,U,F,!0)};function s(){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 B(m,U,F){var b={fired:!1,wrapFn:void 0,target:m,type:U,listener:F},K=s.bind(b);return K.listener=F,b.wrapFn=K,K}I.prototype.once=function(U,F){return o(F),this.on(U,B(this,U,F)),this},I.prototype.prependOnceListener=function(U,F){return o(F),this.prependListener(U,B(this,U,F)),this},I.prototype.removeListener=function(U,F){var b,K,R,G,J;if(o(F),K=this._events,K===void 0)return this;if(b=K[U],b===void 0)return this;if(b===F||b.listener===F)--this._eventsCount===0?this._events=Object.create(null):(delete K[U],K.removeListener&&this.emit("removeListener",U,b.listener||F));else if(typeof b!="function"){for(R=-1,G=b.length-1;G>=0;G--)if(b[G]===F||b[G].listener===F){J=b[G].listener,R=G;break}if(R<0)return this;R===0?b.shift():y(b,R),b.length===1&&(K[U]=b[0]),K.removeListener!==void 0&&this.emit("removeListener",U,J||F)}return this},I.prototype.off=I.prototype.removeListener,I.prototype.removeAllListeners=function(U){var F,b,K;if(b=this._events,b===void 0)return this;if(b.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):b[U]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete b[U]),this;if(arguments.length===0){var R=Object.keys(b),G;for(K=0;K<R.length;++K)G=R[K],G!=="removeListener"&&this.removeAllListeners(G);return this.removeAllListeners("removeListener"),this._events=Object.create(null),this._eventsCount=0,this}if(F=b[U],typeof F=="function")this.removeListener(U,F);else if(F!==void 0)for(K=F.length-1;K>=0;K--)this.removeListener(U,F[K]);return this};function c(m,U,F){var b=m._events;if(b===void 0)return[];var K=b[U];return K===void 0?[]:typeof K=="function"?F?[K.listener||K]:[K]:F?S(K):D(K,K.length)}I.prototype.listeners=function(U){return c(this,U,!0)},I.prototype.rawListeners=function(U){return c(this,U,!1)},I.listenerCount=function(m,U){return typeof m.listenerCount=="function"?m.listenerCount(U):E.call(m,U)},I.prototype.listenerCount=E;function E(m){var U=this._events;if(U!==void 0){var F=U[m];if(typeof F=="function")return 1;if(F!==void 0)return F.length}return 0}I.prototype.eventNames=function(){return this._eventsCount>0?e(this._events):[]};function D(m,U){for(var F=new Array(U),b=0;b<U;++b)F[b]=m[b];return F}function y(m,U){for(;U+1<m.length;U++)m[U]=m[U+1];m.pop()}function S(m){for(var U=new Array(m.length),F=0;F<U.length;++F)U[F]=m[F].listener||m[F];return U}function f(m,U){return new Promise(function(F,b){function K(G){m.removeListener(U,R),b(G)}function R(){typeof m.removeListener=="function"&&m.removeListener("error",K),F([].slice.call(arguments))}k(m,U,R,{once:!0}),U!=="error"&&M(m,K,{once:!0})})}function M(m,U,F){typeof m.on=="function"&&k(m,"error",U,F)}function k(m,U,F,b){if(typeof m.on=="function")b.once?m.once(U,F):m.on(U,F);else if(typeof m.addEventListener=="function")m.addEventListener(U,function K(R){b.once&&m.removeEventListener(U,K),F(R)});else throw new TypeError('The "emitter" argument must be of type EventEmitter. Received type '+typeof m)}return bN.exports}var zc=iRA();let itA=!0,gRA=!0;function Bm(t,A,e){const i=t.match(A);return i&&i.length>=e&&parseFloat(i[e],10)}function Xd(t,A,e){if(!t.RTCPeerConnection)return;const i=t.RTCPeerConnection.prototype,g=i.addEventListener;i.addEventListener=function(n,o){if(n!==A)return g.apply(this,arguments);const a=r=>{const s=e(r);s&&(o.handleEvent?o.handleEvent(s):o(s))};return this._eventMap=this._eventMap||{},this._eventMap[A]||(this._eventMap[A]=new Map),this._eventMap[A].set(o,a),g.apply(this,[n,a])};const I=i.removeEventListener;i.removeEventListener=function(n,o){if(n!==A||!this._eventMap||!this._eventMap[A])return I.apply(this,arguments);if(!this._eventMap[A].has(o))return I.apply(this,arguments);const a=this._eventMap[A].get(o);return this._eventMap[A].delete(o),this._eventMap[A].size===0&&delete this._eventMap[A],Object.keys(this._eventMap).length===0&&delete this._eventMap,I.apply(this,[n,a])},Object.defineProperty(i,"on"+A,{get(){return this["_on"+A]},set(n){this["_on"+A]&&(this.removeEventListener(A,this["_on"+A]),delete this["_on"+A]),n&&this.addEventListener(A,this["_on"+A]=n)},enumerable:!0,configurable:!0})}function IRA(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(itA=t,t?"adapter.js logging disabled":"adapter.js logging enabled")}function nRA(t){return typeof t!="boolean"?new Error("Argument type: "+typeof t+". Please use a boolean."):(gRA=!t,"adapter.js deprecation warnings "+(t?"disabled":"enabled"))}function gtA(){}function oRA(t){const A={browser:null,version:null};if(typeof t>"u"||!t.navigator||!t.navigator.userAgent)return A.browser="Not a browser.",A;const{navigator:e}=t;if(e.userAgentData&&e.userAgentData.brands){const i=e.userAgentData.brands.find(g=>g.brand==="Chromium");if(i)return{browser:"chrome",version:parseInt(i.version,10)}}if(e.mozGetUserMedia)A.browser="firefox",A.version=parseInt(Bm(e.userAgent,/Firefox\/(\d+)\./,1));else if(e.webkitGetUserMedia||t.isSecureContext===!1&&t.webkitRTCPeerConnection)A.browser="chrome",A.version=parseInt(Bm(e.userAgent,/Chrom(e|ium)\/(\d+)\./,2));else if(t.RTCPeerConnection&&e.userAgent.match(/AppleWebKit\/(\d+)\./))A.browser="safari",A.version=parseInt(Bm(e.userAgent,/AppleWebKit\/(\d+)\./,1)),A.supportsUnifiedPlan=t.RTCRtpTransceiver&&"currentDirection"in t.RTCRtpTransceiver.prototype,A._safariVersion=Bm(e.userAgent,/Version\/(\d+(\.?\d+))/,1);else return A.browser="Not a supported browser.",A;return A}function R5(t){return Object.prototype.toString.call(t)==="[object Object]"}function ItA(t){return R5(t)?Object.keys(t).reduce(function(A,e){const i=R5(t[e]),g=i?ItA(t[e]):t[e],I=i&&!Object.keys(g).length;return g===void 0||I?A:Object.assign(A,{[e]:g})},{}):t}function MT(t,A,e){!A||e.has(A.id)||(e.set(A.id,A),Object.keys(A).forEach(i=>{i.endsWith("Id")?MT(t,t.get(A[i]),e):i.endsWith("Ids")&&A[i].forEach(g=>{MT(t,t.get(g),e)})}))}function U5(t,A,e){const i=e?"outbound-rtp":"inbound-rtp",g=new Map;if(A===null)return g;const I=[];return t.forEach(n=>{n.type==="track"&&n.trackIdentifier===A.id&&I.push(n)}),I.forEach(n=>{t.forEach(o=>{o.type===i&&o.trackId===n.id&&MT(t,o,g)})}),g}const K5=gtA;function ntA(t,A){const e=t&&t.navigator;if(!e.mediaDevices)return;const i=function(o){if(typeof o!="object"||o.mandatory||o.optional)return o;const a={};return Object.keys(o).forEach(r=>{if(r==="require"||r==="advanced"||r==="mediaSource")return;const s=typeof o[r]=="object"?o[r]:{ideal:o[r]};s.exact!==void 0&&typeof s.exact=="number"&&(s.min=s.max=s.exact);const B=function(c,E){return c?c+E.charAt(0).toUpperCase()+E.slice(1):E==="deviceId"?"sourceId":E};if(s.ideal!==void 0){a.optional=a.optional||[];let c={};typeof s.ideal=="number"?(c[B("min",r)]=s.ideal,a.optional.push(c),c={},c[B("max",r)]=s.ideal,a.optional.push(c)):(c[B("",r)]=s.ideal,a.optional.push(c))}s.exact!==void 0&&typeof s.exact!="number"?(a.mandatory=a.mandatory||{},a.mandatory[B("",r)]=s.exact):["min","max"].forEach(c=>{s[c]!==void 0&&(a.mandatory=a.mandatory||{},a.mandatory[B(c,r)]=s[c])})}),o.advanced&&(a.optional=(a.optional||[]).concat(o.advanced)),a},g=function(o,a){if(A.version>=61)return a(o);if(o=JSON.parse(JSON.stringify(o)),o&&typeof o.audio=="object"){const r=function(s,B,c){B in s&&!(c in s)&&(s[c]=s[B],delete s[B])};o=JSON.parse(JSON.stringify(o)),r(o.audio,"autoGainControl","googAutoGainControl"),r(o.audio,"noiseSuppression","googNoiseSuppression"),o.audio=i(o.audio)}if(o&&typeof o.video=="object"){let r=o.video.facingMode;r=r&&(typeof r=="object"?r:{ideal:r});const s=A.version<66;if(r&&(r.exact==="user"||r.exact==="environment"||r.ideal==="user"||r.ideal==="environment")&&!(e.mediaDevices.getSupportedConstraints&&e.mediaDevices.getSupportedConstraints().facingMode&&!s)){delete o.video.facingMode;let B;if(r.exact==="environment"||r.ideal==="environment"?B=["back","rear"]:(r.exact==="user"||r.ideal==="user")&&(B=["front"]),B)return e.mediaDevices.enumerateDevices().then(c=>{c=c.filter(D=>D.kind==="videoinput");let E=c.find(D=>B.some(y=>D.label.toLowerCase().includes(y)));return!E&&c.length&&B.includes("back")&&(E=c[c.length-1]),E&&(o.video.deviceId=r.exact?{exact:E.deviceId}:{ideal:E.deviceId}),o.video=i(o.video),K5("chrome: "+JSON.stringify(o)),a(o)})}o.video=i(o.video)}return K5("chrome: "+JSON.stringify(o)),a(o)},I=function(o){return A.version>=64?o:{name:{PermissionDeniedError:"NotAllowedError",PermissionDismissedError:"NotAllowedError",InvalidStateError:"NotAllowedError",DevicesNotFoundError:"NotFoundError",ConstraintNotSatisfiedError:"OverconstrainedError",TrackStartError:"NotReadableError",MediaDeviceFailedDueToShutdown:"NotAllowedError",MediaDeviceKillSwitchOn:"NotAllowedError",TabCaptureError:"AbortError",ScreenCaptureError:"AbortError",DeviceCaptureError:"AbortError"}[o.name]||o.name,message:o.message,constraint:o.constraint||o.constraintName,toString(){return this.name+(this.message&&": ")+this.message}}},n=function(o,a,r){g(o,s=>{e.webkitGetUserMedia(s,a,B=>{r&&r(I(B))})})};if(e.getUserMedia=n.bind(e),e.mediaDevices.getUserMedia){const o=e.mediaDevices.getUserMedia.bind(e.mediaDevices);e.mediaDevices.getUserMedia=function(a){return g(a,r=>o(r).then(s=>{if(r.audio&&!s.getAudioTracks().length||r.video&&!s.getVideoTracks().length)throw s.getTracks().forEach(B=>{B.stop()}),new DOMException("","NotFoundError");return s},s=>Promise.reject(I(s))))}}}function otA(t){t.MediaStream=t.MediaStream||t.webkitMediaStream}function atA(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("ontrack"in t.RTCPeerConnection.prototype)){Object.defineProperty(t.RTCPeerConnection.prototype,"ontrack",{get(){return this._ontrack},set(e){this._ontrack&&this.removeEventListener("track",this._ontrack),this.addEventListener("track",this._ontrack=e)},enumerable:!0,configurable:!0});const A=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){return this._ontrackpoly||(this._ontrackpoly=i=>{i.stream.addEventListener("addtrack",g=>{let I;t.RTCPeerConnection.prototype.getReceivers?I=this.getReceivers().find(o=>o.track&&o.track.id===g.track.id):I={track:g.track};const n=new Event("track");n.track=g.track,n.receiver=I,n.transceiver={receiver:I},n.streams=[i.stream],this.dispatchEvent(n)}),i.stream.getTracks().forEach(g=>{let I;t.RTCPeerConnection.prototype.getReceivers?I=this.getReceivers().find(o=>o.track&&o.track.id===g.id):I={track:g};const n=new Event("track");n.track=g,n.receiver=I,n.transceiver={receiver:I},n.streams=[i.stream],this.dispatchEvent(n)})},this.addEventListener("addstream",this._ontrackpoly)),A.apply(this,arguments)}}else Xd(t,"track",A=>(A.transceiver||Object.defineProperty(A,"transceiver",{value:{receiver:A.receiver}}),A))}function rtA(t){if(typeof t=="object"&&t.RTCPeerConnection&&!("getSenders"in t.RTCPeerConnection.prototype)&&"createDTMFSender"in t.RTCPeerConnection.prototype){const A=function(g,I){return{track:I,get dtmf(){return this._dtmf===void 0&&(I.kind==="audio"?this._dtmf=g.createDTMFSender(I):this._dtmf=null),this._dtmf},_pc:g}};if(!t.RTCPeerConnection.prototype.getSenders){t.RTCPeerConnection.prototype.getSenders=function(){return this._senders=this._senders||[],this._senders.slice()};const g=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(o,a){let r=g.apply(this,arguments);return r||(r=A(this,o),this._senders.push(r)),r};const I=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(o){I.apply(this,arguments);const a=this._senders.indexOf(o);a!==-1&&this._senders.splice(a,1)}}const e=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(I){this._senders=this._senders||[],e.apply(this,[I]),I.getTracks().forEach(n=>{this._senders.push(A(this,n))})};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(I){this._senders=this._senders||[],i.apply(this,[I]),I.getTracks().forEach(n=>{const o=this._senders.find(a=>a.track===n);o&&this._senders.splice(this._senders.indexOf(o),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 A=t.RTCPeerConnection.prototype.getSenders;t.RTCPeerConnection.prototype.getSenders=function(){const i=A.apply(this,[]);return i.forEach(g=>g._pc=this),i},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 stA(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender&&t.RTCRtpReceiver))return;if(!("getStats"in t.RTCRtpSender.prototype)){const e=t.RTCPeerConnection.prototype.getSenders;e&&(t.RTCPeerConnection.prototype.getSenders=function(){const I=e.apply(this,[]);return I.forEach(n=>n._pc=this),I});const i=t.RTCPeerConnection.prototype.addTrack;i&&(t.RTCPeerConnection.prototype.addTrack=function(){const I=i.apply(this,arguments);return I._pc=this,I}),t.RTCRtpSender.prototype.getStats=function(){const I=this;return this._pc.getStats().then(n=>U5(n,I.track,!0))}}if(!("getStats"in t.RTCRtpReceiver.prototype)){const e=t.RTCPeerConnection.prototype.getReceivers;e&&(t.RTCPeerConnection.prototype.getReceivers=function(){const g=e.apply(this,[]);return g.forEach(I=>I._pc=this),g}),Xd(t,"track",i=>(i.receiver._pc=i.srcElement,i)),t.RTCRtpReceiver.prototype.getStats=function(){const g=this;return this._pc.getStats().then(I=>U5(I,g.track,!1))}}if(!("getStats"in t.RTCRtpSender.prototype&&"getStats"in t.RTCRtpReceiver.prototype))return;const A=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){if(arguments.length>0&&arguments[0]instanceof t.MediaStreamTrack){const i=arguments[0];let g,I,n;return this.getSenders().forEach(o=>{o.track===i&&(g?n=!0:g=o)}),this.getReceivers().forEach(o=>(o.track===i&&(I?n=!0:I=o),o.track===i)),n||g&&I?Promise.reject(new DOMException("There are more than one sender or receiver for the track.","InvalidAccessError")):g?g.getStats():I?I.getStats():Promise.reject(new DOMException("There is no sender or receiver for the track.","InvalidAccessError"))}return A.apply(this,arguments)}}function CtA(t){t.RTCPeerConnection.prototype.getLocalStreams=function(){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},Object.keys(this._shimmedLocalStreams).map(n=>this._shimmedLocalStreams[n][0])};const A=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addTrack=function(n,o){if(!o)return A.apply(this,arguments);this._shimmedLocalStreams=this._shimmedLocalStreams||{};const a=A.apply(this,arguments);return this._shimmedLocalStreams[o.id]?this._shimmedLocalStreams[o.id].indexOf(a)===-1&&this._shimmedLocalStreams[o.id].push(a):this._shimmedLocalStreams[o.id]=[o,a],a};const e=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(n){this._shimmedLocalStreams=this._shimmedLocalStreams||{},n.getTracks().forEach(r=>{if(this.getSenders().find(B=>B.track===r))throw new DOMException("Track already exists.","InvalidAccessError")});const o=this.getSenders();e.apply(this,arguments);const a=this.getSenders().filter(r=>o.indexOf(r)===-1);this._shimmedLocalStreams[n.id]=[n].concat(a)};const i=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(n){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},delete this._shimmedLocalStreams[n.id],i.apply(this,arguments)};const g=t.RTCPeerConnection.prototype.removeTrack;t.RTCPeerConnection.prototype.removeTrack=function(n){return this._shimmedLocalStreams=this._shimmedLocalStreams||{},n&&Object.keys(this._shimmedLocalStreams).forEach(o=>{const a=this._shimmedLocalStreams[o].indexOf(n);a!==-1&&this._shimmedLocalStreams[o].splice(a,1),this._shimmedLocalStreams[o].length===1&&delete this._shimmedLocalStreams[o]}),g.apply(this,arguments)}}function BtA(t,A){if(!t.RTCPeerConnection)return;if(t.RTCPeerConnection.prototype.addTrack&&A.version>=65)return CtA(t);const e=t.RTCPeerConnection.prototype.getLocalStreams;t.RTCPeerConnection.prototype.getLocalStreams=function(){const s=e.apply(this);return this._reverseStreams=this._reverseStreams||{},s.map(B=>this._reverseStreams[B.id])};const i=t.RTCPeerConnection.prototype.addStream;t.RTCPeerConnection.prototype.addStream=function(s){if(this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},s.getTracks().forEach(B=>{if(this.getSenders().find(E=>E.track===B))throw new DOMException("Track already exists.","InvalidAccessError")}),!this._reverseStreams[s.id]){const B=new t.MediaStream(s.getTracks());this._streams[s.id]=B,this._reverseStreams[B.id]=s,s=B}i.apply(this,[s])};const g=t.RTCPeerConnection.prototype.removeStream;t.RTCPeerConnection.prototype.removeStream=function(s){this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{},g.apply(this,[this._streams[s.id]||s]),delete this._reverseStreams[this._streams[s.id]?this._streams[s.id].id:s.id],delete this._streams[s.id]},t.RTCPeerConnection.prototype.addTrack=function(s,B){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");const c=[].slice.call(arguments,1);if(c.length!==1||!c[0].getTracks().find(y=>y===s))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(y=>y.track===s))throw new DOMException("Track already exists.","InvalidAccessError");this._streams=this._streams||{},this._reverseStreams=this._reverseStreams||{};const D=this._streams[B.id];if(D)D.addTrack(s),Promise.resolve().then(()=>{this.dispatchEvent(new Event("negotiationneeded"))});else{const y=new t.MediaStream([s]);this._streams[B.id]=y,this._reverseStreams[y.id]=B,this.addStream(y)}return this.getSenders().find(y=>y.track===s)};function I(r,s){let B=s.sdp;return Object.keys(r._reverseStreams||[]).forEach(c=>{const E=r._reverseStreams[c],D=r._streams[E.id];B=B.replace(new RegExp(D.id,"g"),E.id)}),new RTCSessionDescription({type:s.type,sdp:B})}function n(r,s){let B=s.sdp;return Object.keys(r._reverseStreams||[]).forEach(c=>{const E=r._reverseStreams[c],D=r._streams[E.id];B=B.replace(new RegExp(E.id,"g"),D.id)}),new RTCSessionDescription({type:s.type,sdp:B})}["createOffer","createAnswer"].forEach(function(r){const s=t.RTCPeerConnection.prototype[r],B={[r](){const c=arguments;return arguments.length&&typeof arguments[0]=="function"?s.apply(this,[D=>{const y=I(this,D);c[0].apply(null,[y])},D=>{c[1]&&c[1].apply(null,D)},arguments[2]]):s.apply(this,arguments).then(D=>I(this,D))}};t.RTCPeerConnection.prototype[r]=B[r]});const o=t.RTCPeerConnection.prototype.setLocalDescription;t.RTCPeerConnection.prototype.setLocalDescription=function(){return!arguments.length||!arguments[0].type?o.apply(this,arguments):(arguments[0]=n(this,arguments[0]),o.apply(this,arguments))};const a=Object.getOwnPropertyDescriptor(t.RTCPeerConnection.prototype,"localDescription");Object.defineProperty(t.RTCPeerConnection.prototype,"localDescription",{get(){const r=a.get.apply(this);return r.type===""?r:I(this,r)}}),t.RTCPeerConnection.prototype.removeTrack=function(s){if(this.signalingState==="closed")throw new DOMException("The RTCPeerConnection's signalingState is 'closed'.","InvalidStateError");if(!s._pc)throw new DOMException("Argument 1 of RTCPeerConnection.removeTrack does not implement interface RTCRtpSender.","TypeError");if(!(s._pc===this))throw new DOMException("Sender was not created by this connection.","InvalidAccessError");this._streams=this._streams||{};let c;Object.keys(this._streams).forEach(E=>{this._streams[E].getTracks().find(y=>s.track===y)&&(c=this._streams[E])}),c&&(c.getTracks().length===1?this.removeStream(this._reverseStreams[c.id]):c.removeTrack(s.track),this.dispatchEvent(new Event("negotiationneeded")))}}function NT(t,A){!t.RTCPeerConnection&&t.webkitRTCPeerConnection&&(t.RTCPeerConnection=t.webkitRTCPeerConnection),t.RTCPeerConnection&&A.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(e){const i=t.RTCPeerConnection.prototype[e],g={[e](){return arguments[0]=new(e==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),i.apply(this,arguments)}};t.RTCPeerConnection.prototype[e]=g[e]})}function ctA(t,A){Xd(t,"negotiationneeded",e=>{const i=e.target;if(!((A.version<72||i.getConfiguration&&i.getConfiguration().sdpSemantics==="plan-b")&&i.signalingState!=="stable"))return e})}var F5=Object.freeze({__proto__:null,fixNegotiationNeeded:ctA,shimAddTrackRemoveTrack:BtA,shimAddTrackRemoveTrackWithNative:CtA,shimGetSendersWithDtmf:rtA,shimGetUserMedia:ntA,shimMediaStream:otA,shimOnTrack:atA,shimPeerConnection:NT,shimSenderReceiverGetStats:stA});function ltA(t,A){const e=t&&t.navigator,i=t&&t.MediaStreamTrack;if(e.getUserMedia=function(g,I,n){e.mediaDevices.getUserMedia(g).then(I,n)},!(A.version>55&&"autoGainControl"in e.mediaDevices.getSupportedConstraints())){const g=function(n,o,a){o in n&&!(a in n)&&(n[a]=n[o],delete n[o])},I=e.mediaDevices.getUserMedia.bind(e.mediaDevices);if(e.mediaDevices.getUserMedia=function(n){return typeof n=="object"&&typeof n.audio=="object"&&(n=JSON.parse(JSON.stringify(n)),g(n.audio,"autoGainControl","mozAutoGainControl"),g(n.audio,"noiseSuppression","mozNoiseSuppression")),I(n)},i&&i.prototype.getSettings){const n=i.prototype.getSettings;i.prototype.getSettings=function(){const o=n.apply(this,arguments);return g(o,"mozAutoGainControl","autoGainControl"),g(o,"mozNoiseSuppression","noiseSuppression"),o}}if(i&&i.prototype.applyConstraints){const n=i.prototype.applyConstraints;i.prototype.applyConstraints=function(o){return this.kind==="audio"&&typeof o=="object"&&(o=JSON.parse(JSON.stringify(o)),g(o,"autoGainControl","mozAutoGainControl"),g(o,"noiseSuppression","mozNoiseSuppression")),n.apply(this,[o])}}}}function aRA(t,A){t.navigator.mediaDevices&&"getDisplayMedia"in t.navigator.mediaDevices||t.navigator.mediaDevices&&(t.navigator.mediaDevices.getDisplayMedia=function(i){if(!(i&&i.video)){const g=new DOMException("getDisplayMedia without video constraints is undefined");return g.name="NotFoundError",g.code=8,Promise.reject(g)}return i.video===!0?i.video={mediaSource:A}:i.video.mediaSource=A,t.navigator.mediaDevices.getUserMedia(i)})}function QtA(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 GT(t,A){if(typeof t!="object"||!(t.RTCPeerConnection||t.mozRTCPeerConnection))return;!t.RTCPeerConnection&&t.mozRTCPeerConnection&&(t.RTCPeerConnection=t.mozRTCPeerConnection),A.version<53&&["setLocalDescription","setRemoteDescription","addIceCandidate"].forEach(function(g){const I=t.RTCPeerConnection.prototype[g],n={[g](){return arguments[0]=new(g==="addIceCandidate"?t.RTCIceCandidate:t.RTCSessionDescription)(arguments[0]),I.apply(this,arguments)}};t.RTCPeerConnection.prototype[g]=n[g]});const e={inboundrtp:"inbound-rtp",outboundrtp:"outbound-rtp",candidatepair:"candidate-pair",localcandidate:"local-candidate",remotecandidate:"remote-candidate"},i=t.RTCPeerConnection.prototype.getStats;t.RTCPeerConnection.prototype.getStats=function(){const[I,n,o]=arguments;return i.apply(this,[I||null]).then(a=>{if(A.version<53&&!n)try{a.forEach(r=>{r.type=e[r.type]||r.type})}catch(r){if(r.name!=="TypeError")throw r;a.forEach((s,B)=>{a.set(B,Object.assign({},s,{type:e[s.type]||s.type}))})}return a}).then(n,o)}}function EtA(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpSender.prototype)return;const A=t.RTCPeerConnection.prototype.getSenders;A&&(t.RTCPeerConnection.prototype.getSenders=function(){const g=A.apply(this,[]);return g.forEach(I=>I._pc=this),g});const e=t.RTCPeerConnection.prototype.addTrack;e&&(t.RTCPeerConnection.prototype.addTrack=function(){const g=e.apply(this,arguments);return g._pc=this,g}),t.RTCRtpSender.prototype.getStats=function(){return this.track?this._pc.getStats(this.track):Promise.resolve(new Map)}}function utA(t){if(!(typeof t=="object"&&t.RTCPeerConnection&&t.RTCRtpSender)||t.RTCRtpSender&&"getStats"in t.RTCRtpReceiver.prototype)return;const A=t.RTCPeerConnection.prototype.getReceivers;A&&(t.RTCPeerConnection.prototype.getReceivers=function(){const i=A.apply(this,[]);return i.forEach(g=>g._pc=this),i}),Xd(t,"track",e=>(e.receiver._pc=e.srcElement,e)),t.RTCRtpReceiver.prototype.getStats=function(){return this._pc.getStats(this.track)}}function htA(t){!t.RTCPeerConnection||"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(e){this.getSenders().forEach(i=>{i.track&&e.getTracks().includes(i.track)&&this.removeTrack(i)})})}function dtA(t){t.DataChannel&&!t.RTCDataChannel&&(t.RTCDataChannel=t.DataChannel)}function ptA(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const A=t.RTCPeerConnection.prototype.addTransceiver;A&&(t.RTCPeerConnection.prototype.addTransceiver=function(){this.setParametersPromises=[];let i=arguments[1]&&arguments[1].sendEncodings;i===void 0&&(i=[]),i=[...i];const g=i.length>0;g&&i.forEach(n=>{if("rid"in n&&!/^[a-z0-9]{0,16}$/i.test(n.rid))throw new TypeError("Invalid RID value provided.");if("scaleResolutionDownBy"in n&&!(parseFloat(n.scaleResolutionDownBy)>=1))throw new RangeError("scale_resolution_down_by must be >= 1.0");if("maxFramerate"in n&&!(parseFloat(n.maxFramerate)>=0))throw new RangeError("max_framerate must be >= 0.0")});const I=A.apply(this,arguments);if(g){const{sender:n}=I,o=n.getParameters();(!("encodings"in o)||o.encodings.length===1&&Object.keys(o.encodings[0]).length===0)&&(o.encodings=i,n.sendEncodings=i,this.setParametersPromises.push(n.setParameters(o).then(()=>{delete n.sendEncodings}).catch(()=>{delete n.sendEncodings})))}return I})}function ftA(t){if(!(typeof t=="object"&&t.RTCRtpSender))return;const A=t.RTCRtpSender.prototype.getParameters;A&&(t.RTCRtpSender.prototype.getParameters=function(){const i=A.apply(this,arguments);return"encodings"in i||(i.encodings=[].concat(this.sendEncodings||[{}])),i})}function DtA(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const A=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>A.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):A.apply(this,arguments)}}function ytA(t){if(!(typeof t=="object"&&t.RTCPeerConnection))return;const A=t.RTCPeerConnection.prototype.createAnswer;t.RTCPeerConnection.prototype.createAnswer=function(){return this.setParametersPromises&&this.setParametersPromises.length?Promise.all(this.setParametersPromises).then(()=>A.apply(this,arguments)).finally(()=>{this.setParametersPromises=[]}):A.apply(this,arguments)}}var b5=Object.freeze({__proto__:null,shimAddTransceiver:ptA,shimCreateAnswer:ytA,shimCreateOffer:DtA,shimGetDisplayMedia:aRA,shimGetParameters:ftA,shimGetUserMedia:ltA,shimOnTrack:QtA,shimPeerConnection:GT,shimRTCDataChannel:dtA,shimReceiverGetStats:utA,shimRemoveStream:htA,shimSenderGetStats:EtA});function StA(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 A=t.RTCPeerConnection.prototype.addTrack;t.RTCPeerConnection.prototype.addStream=function(i){this._localStreams||(this._localStreams=[]),this._localStreams.includes(i)||this._localStreams.push(i),i.getAudioTracks().forEach(g=>A.call(this,g,i)),i.getVideoTracks().forEach(g=>A.call(this,g,i))},t.RTCPeerConnection.prototype.addTrack=function(i){for(var g=arguments.length,I=new Array(g>1?g-1:0),n=1;n<g;n++)I[n-1]=arguments[n];return I&&I.forEach(o=>{this._localStreams?this._localStreams.includes(o)||this._localStreams.push(o):this._localStreams=[o]}),A.apply(this,arguments)}}"removeStream"in t.RTCPeerConnection.prototype||(t.RTCPeerConnection.prototype.removeStream=function(e){this._localStreams||(this._localStreams=[]);const i=this._localStreams.indexOf(e);if(i===-1)return;this._localStreams.splice(i,1);const g=e.getTracks();this.getSenders().forEach(I=>{g.includes(I.track)&&this.removeTrack(I)})})}}function wtA(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(e){this._onaddstream&&(this.removeEventListener("addstream",this._onaddstream),this.removeEventListener("track",this._onaddstreampoly)),this.addEventListener("addstream",this._onaddstream=e),this.addEventListener("track",this._onaddstreampoly=i=>{i.streams.forEach(g=>{if(this._remoteStreams||(this._remoteStreams=[]),this._remoteStreams.includes(g))return;this._remoteStreams.push(g);const I=new Event("addstream");I.stream=g,this.dispatchEvent(I)})})}});const A=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){const i=this;return this._onaddstreampoly||this.addEventListener("track",this._onaddstreampoly=function(g){g.streams.forEach(I=>{if(i._remoteStreams||(i._remoteStreams=[]),i._remoteStreams.indexOf(I)>=0)return;i._remoteStreams.push(I);const n=new Event("addstream");n.stream=I,i.dispatchEvent(n)})}),A.apply(i,arguments)}}}function mtA(t){if(typeof t!="object"||!t.RTCPeerConnection)return;const A=t.RTCPeerConnection.prototype,e=A.createOffer,i=A.createAnswer,g=A.setLocalDescription,I=A.setRemoteDescription,n=A.addIceCandidate;A.createOffer=function(r,s){const B=arguments.length>=2?arguments[2]:arguments[0],c=e.apply(this,[B]);return s?(c.then(r,s),Promise.resolve()):c},A.createAnswer=function(r,s){const B=arguments.length>=2?arguments[2]:arguments[0],c=i.apply(this,[B]);return s?(c.then(r,s),Promise.resolve()):c};let o=function(a,r,s){const B=g.apply(this,[a]);return s?(B.then(r,s),Promise.resolve()):B};A.setLocalDescription=o,o=function(a,r,s){const B=I.apply(this,[a]);return s?(B.then(r,s),Promise.resolve()):B},A.setRemoteDescription=o,o=function(a,r,s){const B=n.apply(this,[a]);return s?(B.then(r,s),Promise.resolve()):B},A.addIceCandidate=o}function ktA(t){const A=t&&t.navigator;if(A.mediaDevices&&A.mediaDevices.getUserMedia){const e=A.mediaDevices,i=e.getUserMedia.bind(e);A.mediaDevices.getUserMedia=g=>i(MtA(g))}!A.getUserMedia&&A.mediaDevices&&A.mediaDevices.getUserMedia&&(A.getUserMedia=(function(i,g,I){A.mediaDevices.getUserMedia(i).then(g,I)}).bind(A))}function MtA(t){return t&&t.video!==void 0?Object.assign({},t,{video:ItA(t.video)}):t}function NtA(t){if(!t.RTCPeerConnection)return;const A=t.RTCPeerConnection;t.RTCPeerConnection=function(i,g){if(i&&i.iceServers){const I=[];for(let n=0;n<i.iceServers.length;n++){let o=i.iceServers[n];o.urls===void 0&&o.url?(o=JSON.parse(JSON.stringify(o)),o.urls=o.url,delete o.url,I.push(o)):I.push(i.iceServers[n])}i.iceServers=I}return new A(i,g)},t.RTCPeerConnection.prototype=A.prototype,"generateCertificate"in A&&Object.defineProperty(t.RTCPeerConnection,"generateCertificate",{get(){return A.generateCertificate}})}function GtA(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 RtA(t){const A=t.RTCPeerConnection.prototype.createOffer;t.RTCPeerConnection.prototype.createOffer=function(i){if(i){typeof i.offerToReceiveAudio<"u"&&(i.offerToReceiveAudio=!!i.offerToReceiveAudio);const g=this.getTransceivers().find(n=>n.receiver.track.kind==="audio");i.offerToReceiveAudio===!1&&g?g.direction==="sendrecv"?g.setDirection?g.setDirection("sendonly"):g.direction="sendonly":g.direction==="recvonly"&&(g.setDirection?g.setDirection("inactive"):g.direction="inactive"):i.offerToReceiveAudio===!0&&!g&&this.addTransceiver("audio",{direction:"recvonly"}),typeof i.offerToReceiveVideo<"u"&&(i.offerToReceiveVideo=!!i.offerToReceiveVideo);const I=this.getTransceivers().find(n=>n.receiver.track.kind==="video");i.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"):i.offerToReceiveVideo===!0&&!I&&this.addTransceiver("video",{direction:"recvonly"})}return A.apply(this,arguments)}}function UtA(t){typeof t!="object"||t.AudioContext||(t.AudioContext=t.webkitAudioContext)}var v5=Object.freeze({__proto__:null,shimAudioContext:UtA,shimCallbacksAPI:mtA,shimConstraints:MtA,shimCreateOfferLegacy:RtA,shimGetUserMedia:ktA,shimLocalStreamsAPI:StA,shimRTCIceServerUrls:NtA,shimRemoteStreamsAPI:wtA,shimTrackEventTransceiver:GtA}),TJ={exports:{}},_5;function rRA(){return _5||(_5=1,function(t){const A={};A.generateIdentifier=function(){return Math.random().toString(36).substring(2,12)},A.localCName=A.generateIdentifier(),A.splitLines=function(e){return e.trim().split(`
`).map(i=>i.trim())},A.splitSections=function(e){return e.split(`
m=`).map((g,I)=>(I>0?"m="+g:g).trim()+`\r
`)},A.getDescription=function(e){const i=A.splitSections(e);return i&&i[0]},A.getMediaSections=function(e){const i=A.splitSections(e);return i.shift(),i},A.matchPrefix=function(e,i){return A.splitLines(e).filter(g=>g.indexOf(i)===0)},A.parseCandidate=function(e){let i;e.indexOf("a=candidate:")===0?i=e.substring(12).split(" "):i=e.substring(10).split(" ");const g={foundation:i[0],component:{1:"rtp",2:"rtcp"}[i[1]]||i[1],protocol:i[2].toLowerCase(),priority:parseInt(i[3],10),ip:i[4],address:i[4],port:parseInt(i[5],10),type:i[7]};for(let I=8;I<i.length;I+=2)switch(i[I]){case"raddr":g.relatedAddress=i[I+1];break;case"rport":g.relatedPort=parseInt(i[I+1],10);break;case"tcptype":g.tcpType=i[I+1];break;case"ufrag":g.ufrag=i[I+1],g.usernameFragment=i[I+1];break;default:g[i[I]]===void 0&&(g[i[I]]=i[I+1]);break}return g},A.writeCandidate=function(e){const i=[];i.push(e.foundation);const g=e.component;g==="rtp"?i.push(1):g==="rtcp"?i.push(2):i.push(g),i.push(e.protocol.toUpperCase()),i.push(e.priority),i.push(e.address||e.ip),i.push(e.port);const I=e.type;return i.push("typ"),i.push(I),I!=="host"&&e.relatedAddress&&e.relatedPort&&(i.push("raddr"),i.push(e.relatedAddress),i.push("rport"),i.push(e.relatedPort)),e.tcpType&&e.protocol.toLowerCase()==="tcp"&&(i.push("tcptype"),i.push(e.tcpType)),(e.usernameFragment||e.ufrag)&&(i.push("ufrag"),i.push(e.usernameFragment||e.ufrag)),"candidate:"+i.join(" ")},A.parseIceOptions=function(e){return e.substring(14).split(" ")},A.parseRtpMap=function(e){let i=e.substring(9).split(" ");const g={payloadType:parseInt(i.shift(),10)};return i=i[0].split("/"),g.name=i[0],g.clockRate=parseInt(i[1],10),g.channels=i.length===3?parseInt(i[2],10):1,g.numChannels=g.channels,g},A.writeRtpMap=function(e){let i=e.payloadType;e.preferredPayloadType!==void 0&&(i=e.preferredPayloadType);const g=e.channels||e.numChannels||1;return"a=rtpmap:"+i+" "+e.name+"/"+e.clockRate+(g!==1?"/"+g:"")+`\r
`},A.parseExtmap=function(e){const i=e.substring(9).split(" ");return{id:parseInt(i[0],10),direction:i[0].indexOf("/")>0?i[0].split("/")[1]:"sendrecv",uri:i[1],attributes:i.slice(2).join(" ")}},A.writeExtmap=function(e){return"a=extmap:"+(e.id||e.preferredId)+(e.direction&&e.direction!=="sendrecv"?"/"+e.direction:"")+" "+e.uri+(e.attributes?" "+e.attributes:"")+`\r
`},A.parseFmtp=function(e){const i={};let g;const I=e.substring(e.indexOf(" ")+1).split(";");for(let n=0;n<I.length;n++)g=I[n].trim().split("="),i[g[0].trim()]=g[1];return i},A.writeFmtp=function(e){let i="",g=e.payloadType;if(e.preferredPayloadType!==void 0&&(g=e.preferredPayloadType),e.parameters&&Object.keys(e.parameters).length){const I=[];Object.keys(e.parameters).forEach(n=>{e.parameters[n]!==void 0?I.push(n+"="+e.parameters[n]):I.push(n)}),i+="a=fmtp:"+g+" "+I.join(";")+`\r
`}return i},A.parseRtcpFb=function(e){const i=e.substring(e.indexOf(" ")+1).split(" ");return{type:i.shift(),parameter:i.join(" ")}},A.writeRtcpFb=function(e){let i="",g=e.payloadType;return e.preferredPayloadType!==void 0&&(g=e.preferredPayloadType),e.rtcpFeedback&&e.rtcpFeedback.length&&e.rtcpFeedback.forEach(I=>{i+="a=rtcp-fb:"+g+" "+I.type+(I.parameter&&I.parameter.length?" "+I.parameter:"")+`\r
`}),i},A.parseSsrcMedia=function(e){const i=e.indexOf(" "),g={ssrc:parseInt(e.substring(7,i),10)},I=e.indexOf(":",i);return I>-1?(g.attribute=e.substring(i+1,I),g.value=e.substring(I+1)):g.attribute=e.substring(i+1),g},A.parseSsrcGroup=function(e){const i=e.substring(13).split(" ");return{semantics:i.shift(),ssrcs:i.map(g=>parseInt(g,10))}},A.getMid=function(e){const i=A.matchPrefix(e,"a=mid:")[0];if(i)return i.substring(6)},A.parseFingerprint=function(e){const i=e.substring(14).split(" ");return{algorithm:i[0].toLowerCase(),value:i[1].toUpperCase()}},A.getDtlsParameters=function(e,i){return{role:"auto",fingerprints:A.matchPrefix(e+i,"a=fingerprint:").map(A.parseFingerprint)}},A.writeDtlsParameters=function(e,i){let g="a=setup:"+i+`\r
`;return e.fingerprints.forEach(I=>{g+="a=fingerprint:"+I.algorithm+" "+I.value+`\r
`}),g},A.parseCryptoLine=function(e){const i=e.substring(9).split(" ");return{tag:parseInt(i[0],10),cryptoSuite:i[1],keyParams:i[2],sessionParams:i.slice(3)}},A.writeCryptoLine=function(e){return"a=crypto:"+e.tag+" "+e.cryptoSuite+" "+(typeof e.keyParams=="object"?A.writeCryptoKeyParams(e.keyParams):e.keyParams)+(e.sessionParams?" "+e.sessionParams.join(" "):"")+`\r
`},A.parseCryptoKeyParams=function(e){if(e.indexOf("inline:")!==0)return null;const i=e.substring(7).split("|");return{keyMethod:"inline",keySalt:i[0],lifeTime:i[1],mkiValue:i[2]?i[2].split(":")[0]:void 0,mkiLength:i[2]?i[2].split(":")[1]:void 0}},A.writeCryptoKeyParams=function(e){return e.keyMethod+":"+e.keySalt+(e.lifeTime?"|"+e.lifeTime:"")+(e.mkiValue&&e.mkiLength?"|"+e.mkiValue+":"+e.mkiLength:"")},A.getCryptoParameters=function(e,i){return A.matchPrefix(e+i,"a=crypto:").map(A.parseCryptoLine)},A.getIceParameters=function(e,i){const g=A.matchPrefix(e+i,"a=ice-ufrag:")[0],I=A.matchPrefix(e+i,"a=ice-pwd:")[0];return g&&I?{usernameFragment:g.substring(12),password:I.substring(10)}:null},A.writeIceParameters=function(e){let i="a=ice-ufrag:"+e.usernameFragment+`\r
a=ice-pwd:`+e.password+`\r
`;return e.iceLite&&(i+=`a=ice-lite\r
`),i},A.parseRtpParameters=function(e){const i={codecs:[],headerExtensions:[],fecMechanisms:[],rtcp:[]},I=A.splitLines(e)[0].split(" ");i.profile=I[2];for(let o=3;o<I.length;o++){const a=I[o],r=A.matchPrefix(e,"a=rtpmap:"+a+" ")[0];if(r){const s=A.parseRtpMap(r),B=A.matchPrefix(e,"a=fmtp:"+a+" ");switch(s.parameters=B.length?A.parseFmtp(B[0]):{},s.rtcpFeedback=A.matchPrefix(e,"a=rtcp-fb:"+a+" ").map(A.parseRtcpFb),i.codecs.push(s),s.name.toUpperCase()){case"RED":case"ULPFEC":i.fecMechanisms.push(s.name.toUpperCase());break}}}A.matchPrefix(e,"a=extmap:").forEach(o=>{i.headerExtensions.push(A.parseExtmap(o))});const n=A.matchPrefix(e,"a=rtcp-fb:* ").map(A.parseRtcpFb);return i.codecs.forEach(o=>{n.forEach(a=>{o.rtcpFeedback.find(s=>s.type===a.type&&s.parameter===a.parameter)||o.rtcpFeedback.push(a)})}),i},A.writeRtpDescription=function(e,i){let g="";g+="m="+e+" ",g+=i.codecs.length>0?"9":"0",g+=" "+(i.profile||"UDP/TLS/RTP/SAVPF")+" ",g+=i.codecs.map(n=>n.preferredPayloadType!==void 0?n.preferredPayloadType:n.payloadType).join(" ")+`\r
`,g+=`c=IN IP4 0.0.0.0\r
`,g+=`a=rtcp:9 IN IP4 0.0.0.0\r
`,i.codecs.forEach(n=>{g+=A.writeRtpMap(n),g+=A.writeFmtp(n),g+=A.writeRtcpFb(n)});let I=0;return i.codecs.forEach(n=>{n.maxptime>I&&(I=n.maxptime)}),I>0&&(g+="a=maxptime:"+I+`\r
`),i.headerExtensions&&i.headerExtensions.forEach(n=>{g+=A.writeExtmap(n)}),g},A.parseRtpEncodingParameters=function(e){const i=[],g=A.parseRtpParameters(e),I=g.fecMechanisms.indexOf("RED")!==-1,n=g.fecMechanisms.indexOf("ULPFEC")!==-1,o=A.matchPrefix(e,"a=ssrc:").map(c=>A.parseSsrcMedia(c)).filter(c=>c.attribute==="cname"),a=o.length>0&&o[0].ssrc;let r;const s=A.matchPrefix(e,"a=ssrc-group:FID").map(c=>c.substring(17).split(" ").map(D=>parseInt(D,10)));s.length>0&&s[0].length>1&&s[0][0]===a&&(r=s[0][1]),g.codecs.forEach(c=>{if(c.name.toUpperCase()==="RTX"&&c.parameters.apt){let E={ssrc:a,codecPayloadType:parseInt(c.parameters.apt,10)};a&&r&&(E.rtx={ssrc:r}),i.push(E),I&&(E=JSON.parse(JSON.stringify(E)),E.fec={ssrc:a,mechanism:n?"red+ulpfec":"red"},i.push(E))}}),i.length===0&&a&&i.push({ssrc:a});let B=A.matchPrefix(e,"b=");return B.length&&(B[0].indexOf("b=TIAS:")===0?B=parseInt(B[0].substring(7),10):B[0].indexOf("b=AS:")===0?B=parseInt(B[0].substring(5),10)*1e3*.95-2e3*8:B=void 0,i.forEach(c=>{c.maxBitrate=B})),i},A.parseRtcpParameters=function(e){const i={},g=A.matchPrefix(e,"a=ssrc:").map(o=>A.parseSsrcMedia(o)).filter(o=>o.attribute==="cname")[0];g&&(i.cname=g.value,i.ssrc=g.ssrc);const I=A.matchPrefix(e,"a=rtcp-rsize");i.reducedSize=I.length>0,i.compound=I.length===0;const n=A.matchPrefix(e,"a=rtcp-mux");return i.mux=n.length>0,i},A.writeRtcpParameters=function(e){let i="";return e.reducedSize&&(i+=`a=rtcp-rsize\r
`),e.mux&&(i+=`a=rtcp-mux\r
`),e.ssrc!==void 0&&e.cname&&(i+="a=ssrc:"+e.ssrc+" cname:"+e.cname+`\r
`),i},A.parseMsid=function(e){let i;const g=A.matchPrefix(e,"a=msid:");if(g.length===1)return i=g[0].substring(7).split(" "),{stream:i[0],track:i[1]};const I=A.matchPrefix(e,"a=ssrc:").map(n=>A.parseSsrcMedia(n)).filter(n=>n.attribute==="msid");if(I.length>0)return i=I[0].value.split(" "),{stream:i[0],track:i[1]}},A.parseSctpDescription=function(e){const i=A.parseMLine(e),g=A.matchPrefix(e,"a=max-message-size:");let I;g.length>0&&(I=parseInt(g[0].substring(19),10)),isNaN(I)&&(I=65536);const n=A.matchPrefix(e,"a=sctp-port:");if(n.length>0)return{port:parseInt(n[0].substring(12),10),protocol:i.fmt,maxMessageSize:I};const o=A.matchPrefix(e,"a=sctpmap:");if(o.length>0){const a=o[0].substring(10).split(" ");return{port:parseInt(a[0],10),protocol:a[1],maxMessageSize:I}}},A.writeSctpDescription=function(e,i){let g=[];return e.protocol!=="DTLS/SCTP"?g=["m="+e.kind+" 9 "+e.protocol+" "+i.protocol+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctp-port:"+i.port+`\r
`]:g=["m="+e.kind+" 9 "+e.protocol+" "+i.port+`\r
`,`c=IN IP4 0.0.0.0\r
`,"a=sctpmap:"+i.port+" "+i.protocol+` 65535\r
`],i.maxMessageSize!==void 0&&g.push("a=max-message-size:"+i.maxMessageSize+`\r
`),g.join("")},A.generateSessionId=function(){return Math.random().toString().substr(2,22)},A.writeSessionBoilerplate=function(e,i,g){let I;const n=i!==void 0?i:2;return e?I=e:I=A.generateSessionId(),`v=0\r
o=`+(g||"thisisadapterortc")+" "+I+" "+n+` IN IP4 127.0.0.1\r
s=-\r
t=0 0\r
`},A.getDirection=function(e,i){const g=A.splitLines(e);for(let I=0;I<g.length;I++)switch(g[I]){case"a=sendrecv":case"a=sendonly":case"a=recvonly":case"a=inactive":return g[I].substring(2)}return i?A.getDirection(i):"sendrecv"},A.getKind=function(e){return A.splitLines(e)[0].split(" ")[0].substring(2)},A.isRejected=function(e){return e.split(" ",2)[1]==="0"},A.parseMLine=function(e){const g=A.splitLines(e)[0].substring(2).split(" ");return{kind:g[0],port:parseInt(g[1],10),protocol:g[2],fmt:g.slice(3).join(" ")}},A.parseOLine=function(e){const g=A.matchPrefix(e,"o=")[0].substring(2).split(" ");return{username:g[0],sessionId:g[1],sessionVersion:parseInt(g[2],10),netType:g[3],addressType:g[4],address:g[5]}},A.isValidSDP=function(e){if(typeof e!="string"||e.length===0)return!1;const i=A.splitLines(e);for(let g=0;g<i.length;g++)if(i[g].length<2||i[g].charAt(1)!=="=")return!1;return!0},t.exports=A}(TJ)),TJ.exports}var KtA=rRA(),ND=zGA(KtA),sRA=hNA({__proto__:null,default:ND},[KtA]);function kR(t){if(!t.RTCIceCandidate||t.RTCIceCandidate&&"foundation"in t.RTCIceCandidate.prototype)return;const A=t.RTCIceCandidate;t.RTCIceCandidate=function(i){if(typeof i=="object"&&i.candidate&&i.candidate.indexOf("a=")===0&&(i=JSON.parse(JSON.stringify(i)),i.candidate=i.candidate.substring(2)),i.candidate&&i.candidate.length){const g=new A(i),I=ND.parseCandidate(i.candidate);for(const n in I)n in g||Object.defineProperty(g,n,{value:I[n]});return g.toJSON=function(){return{candidate:g.candidate,sdpMid:g.sdpMid,sdpMLineIndex:g.sdpMLineIndex,usernameFragment:g.usernameFragment}},g}return new A(i)},t.RTCIceCandidate.prototype=A.prototype,Xd(t,"icecandidate",e=>(e.candidate&&Object.defineProperty(e,"candidate",{value:new t.RTCIceCandidate(e.candidate),writable:"false"}),e))}function RT(t){!t.RTCIceCandidate||t.RTCIceCandidate&&"relayProtocol"in t.RTCIceCandidate.prototype||Xd(t,"icecandidate",A=>{if(A.candidate){const e=ND.parseCandidate(A.candidate.candidate);e.type==="relay"&&(A.candidate.relayProtocol={0:"tls",1:"tcp",2:"udp"}[e.priority>>24])}return A})}function MR(t,A){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 e=function(o){if(!o||!o.sdp)return!1;const a=ND.splitSections(o.sdp);return a.shift(),a.some(r=>{const s=ND.parseMLine(r);return s&&s.kind==="application"&&s.protocol.indexOf("SCTP")!==-1})},i=function(o){const a=o.sdp.match(/mozilla...THIS_IS_SDPARTA-(\d+)/);if(a===null||a.length<2)return-1;const r=parseInt(a[1],10);return r!==r?-1:r},g=function(o){let a=65536;return A.browser==="firefox"&&(A.version<57?o===-1?a=16384:a=2147483637:A.version<60?a=A.version===57?65535:65536:a=2147483637),a},I=function(o,a){let r=65536;A.browser==="firefox"&&A.version===57&&(r=65535);const s=ND.matchPrefix(o.sdp,"a=max-message-size:");return s.length>0?r=parseInt(s[0].substring(19),10):A.browser==="firefox"&&a!==-1&&(r=2147483637),r},n=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(){if(this._sctp=null,A.browser==="chrome"&&A.version>=76){const{sdpSemantics:a}=this.getConfiguration();a==="plan-b"&&Object.defineProperty(this,"sctp",{get(){return typeof this._sctp>"u"?null:this._sctp},enumerable:!0,configurable:!0})}if(e(arguments[0])){const a=i(arguments[0]),r=g(a),s=I(arguments[0],a);let B;r===0&&s===0?B=Number.POSITIVE_INFINITY:r===0||s===0?B=Math.max(r,s):B=Math.min(r,s);const c={};Object.defineProperty(c,"maxMessageSize",{get(){return B}}),this._sctp=c}return n.apply(this,arguments)}}function NR(t){if(!(t.RTCPeerConnection&&"createDataChannel"in t.RTCPeerConnection.prototype))return;function A(i,g){const I=i.send;i.send=function(){const o=arguments[0],a=o.length||o.size||o.byteLength;if(i.readyState==="open"&&g.sctp&&a>g.sctp.maxMessageSize)throw new TypeError("Message too large (can send a maximum of "+g.sctp.maxMessageSize+" bytes)");return I.apply(i,arguments)}}const e=t.RTCPeerConnection.prototype.createDataChannel;t.RTCPeerConnection.prototype.createDataChannel=function(){const g=e.apply(this,arguments);return A(g,this),g},Xd(t,"datachannel",i=>(A(i.channel,i.target),i))}function UT(t){if(!t.RTCPeerConnection||"connectionState"in t.RTCPeerConnection.prototype)return;const A=t.RTCPeerConnection.prototype;Object.defineProperty(A,"connectionState",{get(){return{completed:"connected",checking:"connecting"}[this.iceConnectionState]||this.iceConnectionState},enumerable:!0,configurable:!0}),Object.defineProperty(A,"onconnectionstatechange",{get(){return this._onconnectionstatechange||null},set(e){this._onconnectionstatechange&&(this.removeEventListener("connectionstatechange",this._onconnectionstatechange),delete this._onconnectionstatechange),e&&this.addEventListener("connectionstatechange",this._onconnectionstatechange=e)},enumerable:!0,configurable:!0}),["setLocalDescription","setRemoteDescription"].forEach(e=>{const i=A[e];A[e]=function(){return this._connectionstatechangepoly||(this._connectionstatechangepoly=g=>{const I=g.target;if(I._lastConnectionState!==I.connectionState){I._lastConnectionState=I.connectionState;const n=new Event("connectionstatechange",g);I.dispatchEvent(n)}return g},this.addEventListener("iceconnectionstatechange",this._connectionstatechangepoly)),i.apply(this,arguments)}})}function KT(t,A){if(!t.RTCPeerConnection||A.browser==="chrome"&&A.version>=71||A.browser==="safari"&&A._safariVersion>=13.1)return;const e=t.RTCPeerConnection.prototype.setRemoteDescription;t.RTCPeerConnection.prototype.setRemoteDescription=function(g){if(g&&g.sdp&&g.sdp.indexOf(`
a=extmap-allow-mixed`)!==-1){const I=g.sdp.split(`
`).filter(n=>n.trim()!=="a=extmap-allow-mixed").join(`
`);t.RTCSessionDescription&&g instanceof t.RTCSessionDescription?arguments[0]=new t.RTCSessionDescription({type:g.type,sdp:I}):g.sdp=I}return e.apply(this,arguments)}}function GR(t,A){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const e=t.RTCPeerConnection.prototype.addIceCandidate;!e||e.length===0||(t.RTCPeerConnection.prototype.addIceCandidate=function(){return arguments[0]?(A.browser==="chrome"&&A.version<78||A.browser==="firefox"&&A.version<68||A.browser==="safari")&&arguments[0]&&arguments[0].candidate===""?Promise.resolve():e.apply(this,arguments):(arguments[1]&&arguments[1].apply(null),Promise.resolve())})}function RR(t,A){if(!(t.RTCPeerConnection&&t.RTCPeerConnection.prototype))return;const e=t.RTCPeerConnection.prototype.setLocalDescription;!e||e.length===0||(t.RTCPeerConnection.prototype.setLocalDescription=function(){let g=arguments[0]||{};if(typeof g!="object"||g.type&&g.sdp)return e.apply(this,arguments);if(g={type:g.type,sdp:g.sdp},!g.type)switch(this.signalingState){case"stable":case"have-local-offer":case"have-remote-pranswer":g.type="offer";break;default:g.type="answer";break}return g.sdp||g.type!=="offer"&&g.type!=="answer"?e.apply(this,[g]):(g.type==="offer"?this.createOffer:this.createAnswer).apply(this).then(n=>e.apply(this,[n]))})}var CRA=Object.freeze({__proto__:null,removeExtmapAllowMixed:KT,shimAddIceCandidateNullOrEmpty:GR,shimConnectionState:UT,shimMaxMessageSize:MR,shimParameterlessSetLocalDescription:RR,shimRTCIceCandidate:kR,shimRTCIceCandidateRelayProtocol:RT,shimSendThrowTypeError:NR});function BRA(){let{window:t}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{shimChrome:!0,shimFirefox:!0,shimSafari:!0};const e=gtA,i=oRA(t),g={browserDetails:i,commonShim:CRA,extractVersion:Bm,disableLog:IRA,disableWarnings:nRA,sdp:sRA};switch(i.browser){case"chrome":if(!F5||!NT||!A.shimChrome)return e("Chrome shim is not included in this adapter release."),g;if(i.version===null)return e("Chrome shim can not determine version, not shimming."),g;e("adapter.js shimming chrome."),g.browserShim=F5,GR(t,i),RR(t),ntA(t,i),otA(t),NT(t,i),atA(t),BtA(t,i),rtA(t),stA(t),ctA(t,i),kR(t),RT(t),UT(t),MR(t,i),NR(t),KT(t,i);break;case"firefox":if(!b5||!GT||!A.shimFirefox)return e("Firefox shim is not included in this adapter release."),g;e("adapter.js shimming firefox."),g.browserShim=b5,GR(t,i),RR(t),ltA(t,i),GT(t,i),QtA(t),htA(t),EtA(t),utA(t),dtA(t),ptA(t),ftA(t),DtA(t),ytA(t),kR(t),UT(t),MR(t,i),NR(t);break;case"safari":if(!v5||!A.shimSafari)return e("Safari shim is not included in this adapter release."),g;e("adapter.js shimming safari."),g.browserShim=v5,GR(t,i),RR(t),NtA(t),RtA(t),mtA(t),StA(t),wtA(t),GtA(t),ktA(t),UtA(t),kR(t),RT(t),MR(t,i),NR(t),KT(t,i);break;default:e("Unsupported browser!");break}return g}BRA({window:typeof window>"u"?void 0:window});class Nr extends Promise{constructor(A){super(A)}catch(A){return super.catch(A)}static reject(A){return super.reject(A)}static all(A){return super.all(A)}static race(A){return super.race(A)}}const cRA=/version\/(\d+(\.?_?\d+)+)/i;let YJ;function Ur(t){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;if(typeof navigator>"u")return;const e=navigator.userAgent.toLowerCase();if(YJ===void 0||A){const i=lRA.find(g=>{let{test:I}=g;return I.test(e)});YJ=i?.describe(e)}return YJ}const lRA=[{test:/firefox|iceweasel|fxios/i,describe(t){return{name:"Firefox",version:UR(/(?:firefox|iceweasel|fxios)[\s/](\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("fxios")?"iOS":void 0,osVersion:HJ(t)}}},{test:/chrom|crios|crmo/i,describe(t){return{name:"Chrome",version:UR(/(?:chrome|chromium|crios|crmo)\/(\d+(\.?_?\d+)+)/i,t),os:t.toLowerCase().includes("crios")?"iOS":void 0,osVersion:HJ(t)}}},{test:/safari|applewebkit/i,describe(t){return{name:"Safari",version:UR(cRA,t),os:t.includes("mobile/")?"iOS":"macOS",osVersion:HJ(t)}}}];function UR(t,A){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:1;const i=A.match(t);return i&&i.length>=e&&i[e]||""}function HJ(t){return t.includes("mac os")?UR(/\(.+?(\d+_\d+(:?_\d+)?)/,t,1).replace(/_/g,"."):void 0}var QRA="2.17.0";const ERA=QRA,uRA=16;class Vc extends Error{constructor(A,e){super(e||"an error has occured"),this.name="LiveKitError",this.code=A}}var BI;(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"})(BI||(BI={}));class Ii extends Vc{constructor(A,e,i,g){super(1,A),this.name="ConnectionError",this.status=i,this.reason=e,this.context=g,this.reasonName=BI[e]}static notAllowed(A,e,i){return new Ii(A,BI.NotAllowed,e,i)}static timeout(A){return new Ii(A,BI.Timeout)}static leaveRequest(A,e){return new Ii(A,BI.LeaveRequest,void 0,e)}static internal(A,e){return new Ii(A,BI.InternalError,void 0,e)}static cancelled(A){return new Ii(A,BI.Cancelled)}static serverUnreachable(A,e){return new Ii(A,BI.ServerUnreachable,e)}static websocket(A,e,i){return new Ii(A,BI.WebSocket,e,i)}static serviceNotFound(A,e){return new Ii(A,BI.ServiceNotFound,void 0,e)}}class zH extends Vc{constructor(A){super(21,A??"device is unsupported"),this.name="DeviceUnsupportedError"}}class Wl extends Vc{constructor(A){super(20,A??"track is invalid"),this.name="TrackInvalidError"}}class hRA extends Vc{constructor(A){super(10,A??"unsupported server"),this.name="UnsupportedServer"}}class rn extends Vc{constructor(A){super(12,A??"unexpected connection state"),this.name="UnexpectedConnectionState"}}class GD extends Vc{constructor(A){super(13,A??"unable to negotiate"),this.name="NegotiationError"}}class J5 extends Vc{constructor(A,e){super(15,A),this.name="PublishTrackError",this.status=e}}class L5 extends Vc{constructor(A,e){super(15,A),this.name="SignalRequestError",this.reason=e,this.reasonName=typeof e=="string"?e:WH[e]}}var ja;(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"})(ja||(ja={}));class Zs extends Vc{constructor(A,e){super(16,A),this.name="DataStreamError",this.reason=e,this.reasonName=ja[e]}}class ff extends Vc{constructor(A){super(18,A),this.name="SignalReconnectError"}}var TU;(function(t){t.PermissionDenied="PermissionDenied",t.NotFound="NotFound",t.DeviceInUse="DeviceInUse",t.Other="Other"})(TU||(TU={}));(function(t){function A(e){if(e&&"name"in e)return e.name==="NotFoundError"||e.name==="DevicesNotFoundError"?t.NotFound:e.name==="NotAllowedError"||e.name==="PermissionDeniedError"?t.PermissionDenied:e.name==="NotReadableError"||e.name==="TrackStartError"?t.DeviceInUse:t.Other}t.getFailure=A})(TU||(TU={}));class Ho{}Ho.setTimeout=function(){return setTimeout(...arguments)};Ho.setInterval=function(){return setInterval(...arguments)};Ho.clearTimeout=function(){return clearTimeout(...arguments)};Ho.clearInterval=function(){return clearInterval(...arguments)};var et;(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"})(et||(et={}));var pt;(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"})(pt||(pt={}));var ut;(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"})(ut||(ut={}));var ct;(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"})(ct||(ct={}));function dRA(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 gI{constructor(A,e,i,g,I){if(typeof A=="object")this.width=A.width,this.height=A.height,this.aspectRatio=A.aspectRatio,this.encoding={maxBitrate:A.maxBitrate,maxFramerate:A.maxFramerate,priority:A.priority};else if(e!==void 0&&i!==void 0)this.width=A,this.height=e,this.aspectRatio=A/e,this.encoding={maxBitrate:i,maxFramerate:g,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 pRA=["vp8","h264"],fRA=["vp8","h264","vp9","av1","h265"];function DRA(t){return!!pRA.find(A=>A===t)}const yRA=DRA;var q5;(function(t){t[t.PREFER_REGRESSION=0]="PREFER_REGRESSION",t[t.SIMULCAST=1]="SIMULCAST",t[t.REGRESSION=2]="REGRESSION"})(q5||(q5={}));var FT;(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}})(FT||(FT={}));const ty={h90:new gI(160,90,9e4,20),h180:new gI(320,180,16e4,20),h216:new gI(384,216,18e4,20),h360:new gI(640,360,45e4,20),h540:new gI(960,540,8e5,25),h720:new gI(1280,720,17e5,30),h1080:new gI(1920,1080,3e6,30),h1440:new gI(2560,1440,5e6,30),h2160:new gI(3840,2160,8e6,30)},bT={h120:new gI(160,120,7e4,20),h180:new gI(240,180,125e3,20),h240:new gI(320,240,14e4,20),h360:new gI(480,360,33e4,20),h480:new gI(640,480,5e5,20),h540:new gI(720,540,6e5,25),h720:new gI(960,720,13e5,30),h1080:new gI(1440,1080,23e5,30),h1440:new gI(1920,1440,38e5,30)},VH={h360fps3:new gI(640,360,2e5,3,"medium"),h360fps15:new gI(640,360,4e5,15,"medium"),h720fps5:new gI(1280,720,8e5,5,"medium"),h720fps15:new gI(1280,720,15e5,15,"medium"),h720fps30:new gI(1280,720,2e6,30,"medium"),h1080fps15:new gI(1920,1080,25e5,15,"medium"),h1080fps30:new gI(1920,1080,5e6,30,"medium"),original:new gI(0,0,7e6,30,"medium")};function FtA(t,A,e){var i,g,I,n;const{optionsWithoutProcessor:o,audioProcessor:a,videoProcessor:r}=_tA(t??{}),s=A?.processor,B=e?.processor,c=o??{};return c.audio===!0&&(c.audio={}),c.video===!0&&(c.video={}),c.audio&&(vT(c.audio,A),(i=(I=c.audio).deviceId)!==null&&i!==void 0||(I.deviceId={ideal:"default"}),(a||s)&&(c.audio.processor=a??s)),c.video&&(vT(c.video,e),(g=(n=c.video).deviceId)!==null&&g!==void 0||(n.deviceId={ideal:"default"}),(r||B)&&(c.video.processor=r??B)),c}function vT(t,A){return Object.keys(A).forEach(e=>{t[e]===void 0&&(t[e]=A[e])}),t}function XH(t){var A,e,i,g;const I={};if(t.video)if(typeof t.video=="object"){const n={},o=n,a=t.video;Object.keys(a).forEach(r=>{switch(r){case"resolution":vT(o,a.resolution);break;default:o[r]=a[r]}}),I.video=n,(A=(i=I.video).deviceId)!==null&&A!==void 0||(i.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,(e=(g=I.audio).deviceId)!==null&&e!==void 0||(g.deviceId={ideal:"default"})):I.audio={deviceId:{ideal:"default"}}:I.audio=!1,I}function btA(t){return vA(this,arguments,void 0,function(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:200;return function*(){const i=vtA();if(i){const g=i.createAnalyser();g.fftSize=2048;const I=g.frequencyBinCount,n=new Uint8Array(I);i.createMediaStreamSource(new MediaStream([A.mediaStreamTrack])).connect(g),yield Oo(e),g.getByteTimeDomainData(n);const a=n.some(r=>r!==128&&r!==0);return i.close(),!a}return!1}()})}function vtA(){var t;const A=typeof window<"u"&&(window.AudioContext||window.webkitAudioContext);if(A){const e=new A({latencyHint:"interactive"});if(e.state==="suspended"&&typeof window<"u"&&(!((t=window.document)===null||t===void 0)&&t.body)){const i=()=>vA(this,void 0,void 0,function*(){var g;try{e.state==="suspended"&&(yield e.resume())}catch{}finally{(g=window.document.body)===null||g===void 0||g.removeEventListener("click",i)}});e.addEventListener("statechange",()=>{var g;e.state==="closed"&&((g=window.document.body)===null||g===void 0||g.removeEventListener("click",i))}),window.document.body.addEventListener("click",i)}return e}}function SRA(t){return t==="audioinput"?Pe.Source.Microphone:t==="videoinput"?Pe.Source.Camera:Pe.Source.Unknown}function _T(t){return t===Pe.Source.Microphone?"audioinput":t===Pe.Source.Camera?"videoinput":void 0}function wRA(t){var A,e;let i=(A=t.video)!==null&&A!==void 0?A:!0;return t.resolution&&t.resolution.width>0&&t.resolution.height>0&&(i=typeof i=="boolean"?{}:i,Md()?i=Object.assign(Object.assign({},i),{width:{max:t.resolution.width},height:{max:t.resolution.height},frameRate:t.resolution.frameRate}):i=Object.assign(Object.assign({},i),{width:{ideal:t.resolution.width},height:{ideal:t.resolution.height},frameRate:t.resolution.frameRate})),{audio:(e=t.audio)!==null&&e!==void 0?e:!1,video:i,controller:t.controller,selfBrowserSurface:t.selfBrowserSurface,surfaceSwitching:t.surfaceSwitching,systemAudio:t.systemAudio,preferCurrentTab:t.preferCurrentTab}}function vm(t){return t.split("/")[1].toLowerCase()}function mRA(t){const A=[];return t.forEach(e=>{e.track!==void 0&&A.push(new HH({cid:e.track.mediaStreamID,track:e.trackInfo}))}),A}function Xi(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?Xi(t.track):{})}}function kRA(){return typeof RTCRtpReceiver<"u"&&"getSynchronizationSources"in RTCRtpReceiver}function MRA(t,A){var e;t===void 0&&(t={}),A===void 0&&(A={});const i=[...Object.keys(A),...Object.keys(t)],g={};for(const I of i)t[I]!==A[I]&&(g[I]=(e=A[I])!==null&&e!==void 0?e:"");return g}function _tA(t){const A=Object.assign({},t);let e,i;return typeof A.audio=="object"&&A.audio.processor&&(e=A.audio.processor,A.audio=Object.assign(Object.assign({},A.audio),{processor:void 0})),typeof A.video=="object"&&A.video.processor&&(i=A.video.processor,A.video=Object.assign(Object.assign({},A.video),{processor:void 0})),{audioProcessor:e,videoProcessor:i,optionsWithoutProcessor:dRA(A)}}function NRA(t){switch(t){case Mn.CAMERA:return Pe.Source.Camera;case Mn.MICROPHONE:return Pe.Source.Microphone;case Mn.SCREEN_SHARE:return Pe.Source.ScreenShare;case Mn.SCREEN_SHARE_AUDIO:return Pe.Source.ScreenShareAudio;default:return Pe.Source.Unknown}}function x5(t,A){return t.width*t.height<A.width*A.height}function GRA(t,A){var e;return(e=t.layers)===null||e===void 0?void 0:e.find(i=>i.quality===A)}const RRA=5e3,mw=[];var ss;(function(t){t[t.LOW=0]="LOW",t[t.MEDIUM=1]="MEDIUM",t[t.HIGH=2]="HIGH"})(ss||(ss={}));class Pe extends zc.EventEmitter{get streamState(){return this._streamState}setStreamState(A){this._streamState=A}constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};var g;super(),this.attachedElements=[],this.isMuted=!1,this._streamState=Pe.StreamState.Active,this.isInBackground=!1,this._currentBitrate=0,this.log=Ji,this.appVisibilityChangedListener=()=>{this.backgroundTimeout&&clearTimeout(this.backgroundTimeout),document.visibilityState==="hidden"?this.backgroundTimeout=setTimeout(()=>this.handleAppVisibilityChanged(),RRA):this.handleAppVisibilityChanged()},this.log=uQ((g=i.loggerName)!==null&&g!==void 0?g:yB.Track),this.loggerContextCb=i.loggerContextCb,this.setMaxListeners(100),this.kind=e,this._mediaStreamTrack=A,this._mediaStreamID=A.id,this.source=Pe.Source.Unknown}get logContext(){var A;return Object.assign(Object.assign({},(A=this.loggerContextCb)===null||A===void 0?void 0:A.call(this)),Xi(this))}get currentBitrate(){return this._currentBitrate}get mediaStreamTrack(){return this._mediaStreamTrack}get mediaStreamID(){return this._mediaStreamID}attach(A){let e="audio";this.kind===Pe.Kind.Video&&(e="video"),this.attachedElements.length===0&&this.kind===Pe.Kind.Video&&this.addAppVisibilityListener(),A||(e==="audio"&&(mw.forEach(I=>{I.parentElement===null&&!A&&(A=I)}),A&&mw.splice(mw.indexOf(A),1)),A||(A=document.createElement(e))),this.attachedElements.includes(A)||this.attachedElements.push(A),aD(this.mediaStreamTrack,A);const i=A.srcObject.getTracks(),g=i.some(I=>I.kind==="audio");return A.play().then(()=>{this.emit(g?ct.AudioPlaybackStarted:ct.VideoPlaybackStarted)}).catch(I=>{I.name==="NotAllowedError"?this.emit(g?ct.AudioPlaybackFailed:ct.VideoPlaybackFailed,I):I.name==="AbortError"?Ji.debug("".concat(g?"audio":"video"," playback aborted, likely due to new play request")):Ji.warn("could not playback ".concat(g?"audio":"video"),I),g&&A&&i.some(n=>n.kind==="video")&&I.name==="NotAllowedError"&&(A.muted=!0,A.play().catch(()=>{}))}),this.emit(ct.ElementAttached,A),A}detach(A){try{if(A){RD(this.mediaStreamTrack,A);const i=this.attachedElements.indexOf(A);return i>=0&&(this.attachedElements.splice(i,1),this.recycleElement(A),this.emit(ct.ElementDetached,A)),A}const e=[];return this.attachedElements.forEach(i=>{RD(this.mediaStreamTrack,i),e.push(i),this.recycleElement(i),this.emit(ct.ElementDetached,i)}),this.attachedElements=[],e}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(A){A.loggerName&&(this.log=uQ(A.loggerName)),A.loggerContextCb&&(this.loggerContextCb=A.loggerContextCb)}recycleElement(A){if(A instanceof HTMLAudioElement){let e=!0;A.pause(),mw.forEach(i=>{i.parentElement||(e=!1)}),e&&mw.push(A)}}handleAppVisibilityChanged(){return vA(this,void 0,void 0,function*(){this.isInBackground=document.visibilityState==="hidden",!this.isInBackground&&this.kind===Pe.Kind.Video&&setTimeout(()=>this.attachedElements.forEach(A=>A.play().catch(()=>{})),0)})}addAppVisibilityListener(){Gr()?(this.isInBackground=document.visibilityState==="hidden",document.addEventListener("visibilitychange",this.appVisibilityChangedListener)):this.isInBackground=!1}removeAppVisibilityListener(){Gr()&&document.removeEventListener("visibilitychange",this.appVisibilityChangedListener)}}function aD(t,A){let e;A.srcObject instanceof MediaStream?e=A.srcObject:e=new MediaStream;let i;t.kind==="audio"?i=e.getAudioTracks():i=e.getVideoTracks(),i.includes(t)||(i.forEach(g=>{e.removeTrack(g)}),e.addTrack(t)),(!Md()||!(A instanceof HTMLVideoElement))&&(A.autoplay=!0),A.muted=e.getAudioTracks().length===0,A instanceof HTMLVideoElement&&(A.playsInline=!0),A.srcObject!==e&&(A.srcObject=e,(Md()||kd())&&A instanceof HTMLVideoElement&&setTimeout(()=>{A.srcObject=e,A.play().catch(()=>{})},0))}function RD(t,A){if(A.srcObject instanceof MediaStream){const e=A.srcObject;e.removeTrack(t),e.getTracks().length>0?A.srcObject=e:A.srcObject=null}}(function(t){let A;(function(r){r.Audio="audio",r.Video="video",r.Unknown="unknown"})(A=t.Kind||(t.Kind={}));let e;(function(r){r.Camera="camera",r.Microphone="microphone",r.ScreenShare="screen_share",r.ScreenShareAudio="screen_share_audio",r.Unknown="unknown"})(e=t.Source||(t.Source={}));let i;(function(r){r.Active="active",r.Paused="paused",r.Unknown="unknown"})(i=t.StreamState||(t.StreamState={}));function g(r){switch(r){case A.Audio:return oB.AUDIO;case A.Video:return oB.VIDEO;default:return oB.DATA}}t.kindToProto=g;function I(r){switch(r){case oB.AUDIO:return A.Audio;case oB.VIDEO:return A.Video;default:return A.Unknown}}t.kindFromProto=I;function n(r){switch(r){case e.Camera:return Mn.CAMERA;case e.Microphone:return Mn.MICROPHONE;case e.ScreenShare:return Mn.SCREEN_SHARE;case e.ScreenShareAudio:return Mn.SCREEN_SHARE_AUDIO;default:return Mn.UNKNOWN}}t.sourceToProto=n;function o(r){switch(r){case Mn.CAMERA:return e.Camera;case Mn.MICROPHONE:return e.Microphone;case Mn.SCREEN_SHARE:return e.ScreenShare;case Mn.SCREEN_SHARE_AUDIO:return e.ScreenShareAudio;default:return e.Unknown}}t.sourceFromProto=o;function a(r){switch(r){case wT.ACTIVE:return i.Active;case wT.PAUSED:return i.Paused;default:return i.Unknown}}t.streamStateFromProto=a})(Pe||(Pe={}));const URA="|",T5="https://aomediacodec.github.io/av1-rtp-spec/#dependency-descriptor-rtp-header-extension";function KRA(t){const A=t.split(URA);return A.length>1?[A[0],t.substr(A[0].length+1)]:[t,""]}function Oo(t){return new Nr(A=>Ho.setTimeout(A,t))}function JT(){return"addTransceiver"in RTCPeerConnection.prototype}function LT(){return"addTrack"in RTCPeerConnection.prototype}function FRA(){if(!("getCapabilities"in RTCRtpSender)||Md()||kd())return!1;const t=RTCRtpSender.getCapabilities("video");let A=!1;if(t){for(const e of t.codecs)if(e.mimeType.toLowerCase()==="video/av1"){A=!0;break}}return A}function bRA(){if(!("getCapabilities"in RTCRtpSender)||kd())return!1;if(Md()){const e=Ur();if(e?.version&&Pc(e.version,"16")<0||e?.os==="iOS"&&e?.osVersion&&Pc(e.osVersion,"16")<0)return!1}const t=RTCRtpSender.getCapabilities("video");let A=!1;if(t){for(const e of t.codecs)if(e.mimeType.toLowerCase()==="video/vp9"){A=!0;break}}return A}function rB(t){return t==="av1"||t==="vp9"}function qT(t){return!document||w0()?!1:(t||(t=document.createElement("audio")),"setSinkId"in t)}function vRA(){return typeof RTCPeerConnection>"u"?!1:JT()||LT()}function kd(){var t;return((t=Ur())===null||t===void 0?void 0:t.name)==="Firefox"}function Y5(){const t=Ur();return!!t&&t.name==="Chrome"&&t.os!=="iOS"}function Md(){var t;return((t=Ur())===null||t===void 0?void 0:t.name)==="Safari"}function w0(){const t=Ur();return t?.name==="Safari"||t?.os==="iOS"}function _RA(){const t=Ur();return t?.name==="Safari"&&t.version.startsWith("17.")||t?.os==="iOS"&&!!t?.osVersion&&Pc(t.osVersion,"17")>=0}function JRA(t){return t||(t=Ur()),t?.name==="Safari"&&Pc(t.version,"18.3")>0||t?.os==="iOS"&&!!t?.osVersion&&Pc(t.osVersion,"18.3")>0}function JtA(){var t,A;return Gr()?(A=(t=navigator.userAgentData)===null||t===void 0?void 0:t.mobile)!==null&&A!==void 0?A:/Tablet|iPad|Mobile|Android|BlackBerry/.test(navigator.userAgent):!1}function LRA(){const t=Ur(),A="17.2";if(t)return t.name!=="Safari"&&t.os!=="iOS"||t.os==="iOS"&&t.osVersion&&Pc(t.osVersion,A)>=0?!0:t.name==="Safari"&&Pc(t.version,A)>=0}function Gr(){return typeof document<"u"}function Oc(){return navigator.product=="ReactNative"}function iy(t){return t.hostname.endsWith(".livekit.cloud")||t.hostname.endsWith(".livekit.run")}function OJ(t){return iy(t)?t.hostname.split(".")[0]:null}function LtA(){if(global&&global.LiveKitReactNativeGlobal)return global.LiveKitReactNativeGlobal}function qtA(){if(!Oc())return;let t=LtA();if(t)return t.platform}function H5(){if(Gr())return window.devicePixelRatio;if(Oc()){let t=LtA();if(t)return t.devicePixelRatio}return 1}function Pc(t,A){const e=t.split("."),i=A.split("."),g=Math.min(e.length,i.length);for(let I=0;I<g;++I){const n=parseInt(e[I],10),o=parseInt(i[I],10);if(n>o)return 1;if(n<o)return-1;if(I===g-1&&n===o)return 0}return t===""&&A!==""?-1:A===""?1:e.length==i.length?0:e.length<i.length?-1:1}function qRA(t){for(const A of t)A.target.handleResize(A)}function xRA(t){for(const A of t)A.target.handleVisibilityChanged(A)}let PJ=null;const O5=()=>(PJ||(PJ=new ResizeObserver(qRA)),PJ);let jJ=null;const P5=()=>(jJ||(jJ=new IntersectionObserver(xRA,{root:null,rootMargin:"0px"})),jJ);function TRA(){var t;const A=new xeA({sdk:TeA.JS,protocol:uRA,version:ERA});return Oc()&&(A.os=(t=qtA())!==null&&t!==void 0?t:""),A}function j5(){let t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:16,A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:16,e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1,i=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1;const g=document.createElement("canvas");g.width=t,g.height=A;const I=g.getContext("2d");I?.fillRect(0,0,g.width,g.height),i&&I&&(I.beginPath(),I.arc(t/2,A/2,50,0,Math.PI*2,!0),I.closePath(),I.fillStyle="grey",I.fill());const n=g.captureStream(),[o]=n.getTracks();if(!o)throw Error("Could not get empty media stream video track");return o.enabled=e,o}let kw;function ZJ(){if(!kw){const t=new AudioContext,A=t.createOscillator(),e=t.createGain();e.gain.setValueAtTime(0,0);const i=t.createMediaStreamDestination();if(A.connect(e),e.connect(i),A.start(),[kw]=i.stream.getAudioTracks(),!kw)throw Error("Could not get empty media stream audio track");kw.enabled=!1}return kw.clone()}class nC{get isResolved(){return this._isResolved}constructor(A,e){this._isResolved=!1,this.onFinally=e,this.promise=new Promise((i,g)=>vA(this,void 0,void 0,function*(){this.resolve=i,this.reject=g,A&&(yield A(i,g))})).finally(()=>{var i;this._isResolved=!0,(i=this.onFinally)===null||i===void 0||i.call(this)})}}function YRA(t){return fRA.includes(t)}function YE(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 HRA(t){return t.startsWith("http")?t.replace(/^(http)/,"ws"):t}function m0(t){return t.startsWith("ws")?t.replace(/^(ws)/,"http"):t}function ORA(t,A){return t.segments.map(e=>{let{id:i,text:g,language:I,startTime:n,endTime:o,final:a}=e;var r;const s=(r=A.get(i))!==null&&r!==void 0?r:Date.now(),B=Date.now();return a?A.delete(i):A.set(i,s),{id:i,text:g,startTime:Number.parseInt(n.toString()),endTime:Number.parseInt(o.toString()),final:a,language:I,firstReceivedTime:s,lastReceivedTime:B}})}function PRA(t){const{id:A,timestamp:e,message:i,editTimestamp:g}=t;return{id:A,timestamp:Number.parseInt(e.toString()),editTimestamp:g?Number.parseInt(g.toString()):void 0,message:i}}function Z5(t){switch(t.reason){case BI.LeaveRequest:return t.context;case BI.Cancelled:return cB.CLIENT_INITIATED;case BI.NotAllowed:return cB.USER_REJECTED;case BI.ServerUnreachable:return cB.JOIN_FAILURE;default:return cB.UNKNOWN_REASON}}function KR(t){return t!==void 0?Number(t):void 0}function Jh(t){return t!==void 0?BigInt(t):void 0}function UD(t){return!!t&&!(t instanceof MediaStreamTrack)&&t.isLocal}function Jc(t){return!!t&&t.kind==Pe.Kind.Audio}function Du(t){return!!t&&t.kind==Pe.Kind.Video}function BE(t){return UD(t)&&Du(t)}function ql(t){return UD(t)&&Jc(t)}function xT(t){return!!t&&!t.isLocal}function jRA(t){return!!t&&!t.isLocal}function WJ(t){return xT(t)&&Du(t)}function ZRA(t){return t.isLocal}function WRA(t,A){const e=[];let i=new TextEncoder().encode(t);for(;i.length>A;){let g=A;for(;g>0;){const I=i[g];if(I!==void 0&&(I&192)!==128)break;g--}e.push(i.slice(0,g)),i=i.slice(g)}return i.length>0&&e.push(i),e}function zRA(t){var A;const e=t.get("Cache-Control");if(e){const i=(A=e.match(/(?:^|[,\s])max-age=(\d+)/))===null||A===void 0?void 0:A[1];if(i)return parseInt(i,10)}}function VRA(t,A){let e=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;const i=XRA(t,A);return e?i:$H(i,"v1")}function XRA(t,A){const e=new URL(HRA(t));return A.forEach((i,g)=>{e.searchParams.set(g,i)}),$H(e,"rtc")}function $RA(t){const A=new URL(m0(t));return $H(A,"validate")}function xtA(t){return t.endsWith("/")?t:"".concat(t,"/")}function $H(t,A){return t.pathname="".concat(xtA(t.pathname)).concat(A),t}function W5(t){if(typeof t=="string")return k5.fromJson(JSON.parse(t),{ignoreUnknownFields:!0});if(t instanceof ArrayBuffer)return k5.fromBinary(new Uint8Array(t));throw new Error("could not decode websocket message: ".concat(typeof t))}function AUA(t){let A=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Unknown reason";if(!(t instanceof AbortSignal))return A;const e=t.reason;switch(typeof e){case"string":return e;case"object":return e instanceof Error?e.message:A;default:return"toString"in e?e.toString():A}}const eUA=10,Mw="lk_e2ee",tUA="LKFrameEncryptionKey",iUA={sharedKey:!1,ratchetSalt:tUA,ratchetWindowSize:8,failureTolerance:eUA,keyringSize:16};var HE;(function(t){t.SetKey="setKey",t.RatchetRequest="ratchetRequest",t.KeyRatcheted="keyRatcheted"})(HE||(HE={}));var z5;(function(t){t.KeyRatcheted="keyRatcheted"})(z5||(z5={}));var KE;(function(t){t.ParticipantEncryptionStatusChanged="participantEncryptionStatusChanged",t.EncryptionError="encryptionError"})(KE||(KE={}));var V5;(function(t){t.Error="cryptorError"})(V5||(V5={}));function gUA(){return IUA()||TT()}function TT(){return typeof window.RTCRtpScriptTransform<"u"}function IUA(){return typeof window.RTCRtpSender<"u"&&typeof window.RTCRtpSender.prototype.createEncodedStreams<"u"}function nUA(t){var A,e,i,g,I;if(((A=t.value)===null||A===void 0?void 0:A.case)!=="sipDtmf"&&((e=t.value)===null||e===void 0?void 0:e.case)!=="metrics"&&((i=t.value)===null||i===void 0?void 0:i.case)!=="speaker"&&((g=t.value)===null||g===void 0?void 0:g.case)!=="transcription"&&((I=t.value)===null||I===void 0?void 0:I.case)!=="encryptedPacket")return new FeA({value:t.value})}class r6A extends zc.EventEmitter{constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};super(),this.onKeyRatcheted=(e,i,g)=>{Ji.debug("key ratcheted event received",{ratchetResult:e,participantId:i,keyIndex:g})},this.keyInfoMap=new Map,this.options=Object.assign(Object.assign({},iUA),A),this.on(HE.KeyRatcheted,this.onKeyRatcheted)}onSetEncryptionKey(A,e,i){const g={key:A,participantIdentity:e,keyIndex:i};if(!this.options.sharedKey&&!e)throw new Error("participant identity needs to be passed for encryption key if sharedKey option is false");this.keyInfoMap.set("".concat(e??"shared","-").concat(i??0),g),this.emit(HE.SetKey,g)}getKeys(){return Array.from(this.keyInfoMap.values())}getOptions(){return this.options}ratchetKey(A,e){this.emit(HE.RatchetRequest,A,e)}}var X5;(function(t){t[t.InvalidKey=0]="InvalidKey",t[t.MissingKey=1]="MissingKey",t[t.InternalError=2]="InternalError"})(X5||(X5={}));class oUA extends zc.EventEmitter{constructor(A,e){super(),this.decryptDataRequests=new Map,this.encryptDataRequests=new Map,this.onWorkerMessage=i=>{var g,I;const{kind:n,data:o}=i.data;switch(n){case"error":if(Ji.error(o.error.message),o.uuid){const s=this.decryptDataRequests.get(o.uuid);if(s?.reject){s.reject(o.error);break}const B=this.encryptDataRequests.get(o.uuid);if(B?.reject){B.reject(o.error);break}}this.emit(KE.EncryptionError,o.error,o.participantIdentity);break;case"initAck":o.enabled&&this.keyProvider.getKeys().forEach(s=>{this.postKey(s)});break;case"enable":if(o.enabled&&this.keyProvider.getKeys().forEach(s=>{this.postKey(s)}),this.encryptionEnabled!==o.enabled&&o.participantIdentity===((g=this.room)===null||g===void 0?void 0:g.localParticipant.identity))this.emit(KE.ParticipantEncryptionStatusChanged,o.enabled,this.room.localParticipant),this.encryptionEnabled=o.enabled;else if(o.participantIdentity){const s=(I=this.room)===null||I===void 0?void 0:I.getParticipantByIdentity(o.participantIdentity);if(!s)throw TypeError("couldn't set encryption status, participant not found".concat(o.participantIdentity));this.emit(KE.ParticipantEncryptionStatusChanged,o.enabled,s)}break;case"ratchetKey":this.keyProvider.emit(HE.KeyRatcheted,o.ratchetResult,o.participantIdentity,o.keyIndex);break;case"decryptDataResponse":const a=this.decryptDataRequests.get(o.uuid);a?.resolve&&a.resolve(o);break;case"encryptDataResponse":const r=this.encryptDataRequests.get(o.uuid);r?.resolve&&r.resolve(o);break}},this.onWorkerError=i=>{Ji.error("e2ee worker encountered an error:",{error:i.error}),this.emit(KE.EncryptionError,i.error,void 0)},this.keyProvider=A.keyProvider,this.worker=A.worker,this.encryptionEnabled=!1,this.dataChannelEncryptionEnabled=e}get isEnabled(){return this.encryptionEnabled}get isDataChannelEncryptionEnabled(){return this.isEnabled&&this.dataChannelEncryptionEnabled}setup(A){if(!gUA())throw new zH("tried to setup end-to-end encryption on an unsupported browser");if(Ji.info("setting up e2ee"),A!==this.room){this.room=A,this.setupEventListeners(A,this.keyProvider);const e={kind:"init",data:{keyProviderOptions:this.keyProvider.getOptions(),loglevel:$GA.getLevel()}};this.worker&&(Ji.info("initializing worker",{worker:this.worker}),this.worker.onmessage=this.onWorkerMessage,this.worker.onerror=this.onWorkerError,this.worker.postMessage(e))}}setParticipantCryptorEnabled(A,e){Ji.debug("set e2ee to ".concat(A," for participant ").concat(e)),this.postEnable(A,e)}setSifTrailer(A){!A||A.length===0?Ji.warn("ignoring server sent trailer as it's empty"):this.postSifTrailer(A)}setupEngine(A){A.on(ut.RTPVideoMapUpdate,e=>{this.postRTPMap(e)})}setupEventListeners(A,e){A.on(et.TrackPublished,(i,g)=>this.setParticipantCryptorEnabled(i.trackInfo.encryption!==On.NONE,g.identity)),A.on(et.ConnectionStateChanged,i=>{i===ug.Connected&&A.remoteParticipants.forEach(g=>{g.trackPublications.forEach(I=>{this.setParticipantCryptorEnabled(I.trackInfo.encryption!==On.NONE,g.identity)})})}).on(et.TrackUnsubscribed,(i,g,I)=>{var n;const o={kind:"removeTransform",data:{participantIdentity:I.identity,trackId:i.mediaStreamID}};(n=this.worker)===null||n===void 0||n.postMessage(o)}).on(et.TrackSubscribed,(i,g,I)=>{this.setupE2EEReceiver(i,I.identity,g.trackInfo)}).on(et.SignalConnected,()=>{if(!this.room)throw new TypeError("expected room to be present on signal connect");e.getKeys().forEach(i=>{this.postKey(i)}),this.setParticipantCryptorEnabled(this.room.localParticipant.isE2EEEnabled,this.room.localParticipant.identity)}),A.localParticipant.on(pt.LocalSenderCreated,(i,g)=>vA(this,void 0,void 0,function*(){this.setupE2EESender(g,i)})),A.localParticipant.on(pt.LocalTrackPublished,i=>{if(!Du(i.track)||!w0())return;const g={kind:"updateCodec",data:{trackId:i.track.mediaStreamID,codec:vm(i.trackInfo.codecs[0].mimeType),participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(g)}),e.on(HE.SetKey,i=>this.postKey(i)).on(HE.RatchetRequest,(i,g)=>this.postRatchetRequest(i,g))}encryptData(A){return vA(this,void 0,void 0,function*(){if(!this.worker)throw Error("could not encrypt data, worker is missing");const e=crypto.randomUUID(),i={kind:"encryptDataRequest",data:{uuid:e,payload:A,participantIdentity:this.room.localParticipant.identity}},g=new nC;return g.onFinally=()=>{this.encryptDataRequests.delete(e)},this.encryptDataRequests.set(e,g),this.worker.postMessage(i),g.promise})}handleEncryptedData(A,e,i,g){if(!this.worker)throw Error("could not handle encrypted data, worker is missing");const I=crypto.randomUUID(),n={kind:"decryptDataRequest",data:{uuid:I,payload:A,iv:e,participantIdentity:i,keyIndex:g}},o=new nC;return o.onFinally=()=>{this.decryptDataRequests.delete(I)},this.decryptDataRequests.set(I,o),this.worker.postMessage(n),o.promise}postRatchetRequest(A,e){if(!this.worker)throw Error("could not ratchet key, worker is missing");const i={kind:"ratchetRequest",data:{participantIdentity:A,keyIndex:e}};this.worker.postMessage(i)}postKey(A){let{key:e,participantIdentity:i,keyIndex:g}=A;var I;if(!this.worker)throw Error("could not set key, worker is missing");const n={kind:"setKey",data:{participantIdentity:i,isPublisher:i===((I=this.room)===null||I===void 0?void 0:I.localParticipant.identity),key:e,keyIndex:g}};this.worker.postMessage(n)}postEnable(A,e){if(this.worker){const i={kind:"enable",data:{enabled:A,participantIdentity:e}};this.worker.postMessage(i)}else throw new ReferenceError("failed to enable e2ee, worker is not ready")}postRTPMap(A){var e;if(!this.worker)throw TypeError("could not post rtp map, worker is missing");if(!(!((e=this.room)===null||e===void 0)&&e.localParticipant.identity))throw TypeError("could not post rtp map, local participant identity is missing");const i={kind:"setRTPMap",data:{map:A,participantIdentity:this.room.localParticipant.identity}};this.worker.postMessage(i)}postSifTrailer(A){if(!this.worker)throw Error("could not post SIF trailer, worker is missing");const e={kind:"setSifTrailer",data:{trailer:A}};this.worker.postMessage(e)}setupE2EEReceiver(A,e,i){if(A.receiver){if(!i?.mimeType||i.mimeType==="")throw new TypeError("MimeType missing from trackInfo, cannot set up E2EE cryptor");this.handleReceiver(A.receiver,A.mediaStreamID,e,A.kind==="video"?vm(i.mimeType):void 0)}}setupE2EESender(A,e){if(!UD(A)||!e){e||Ji.warn("early return because sender is not ready");return}this.handleSender(e,A.mediaStreamID,void 0)}handleReceiver(A,e,i,g){return vA(this,void 0,void 0,function*(){if(this.worker){if(TT()&&!Y5()){const I={kind:"decode",participantIdentity:i,trackId:e,codec:g};A.transform=new RTCRtpScriptTransform(this.worker,I)}else{if(Mw in A&&g){const a={kind:"updateCodec",data:{trackId:e,codec:g,participantIdentity:i}};this.worker.postMessage(a);return}let I=A.writableStream,n=A.readableStream;if(!I||!n){const a=A.createEncodedStreams();A.writableStream=a.writable,I=a.writable,A.readableStream=a.readable,n=a.readable}const o={kind:"decode",data:{readableStream:n,writableStream:I,trackId:e,codec:g,participantIdentity:i,isReuse:Mw in A}};this.worker.postMessage(o,[n,I])}A[Mw]=!0}})}handleSender(A,e,i){var g;if(!(Mw in A||!this.worker)){if(!(!((g=this.room)===null||g===void 0)&&g.localParticipant.identity)||this.room.localParticipant.identity==="")throw TypeError("local identity needs to be known in order to set up encrypted sender");if(TT()&&!Y5()){Ji.info("initialize script transform");const I={kind:"encode",participantIdentity:this.room.localParticipant.identity,trackId:e,codec:i};A.transform=new RTCRtpScriptTransform(this.worker,I)}else{Ji.info("initialize encoded streams");const I=A.createEncodedStreams(),n={kind:"encode",data:{readableStream:I.readable,writableStream:I.writable,codec:i,trackId:e,participantIdentity:this.room.localParticipant.identity,isReuse:!1}};this.worker.postMessage(n,[I.readable,I.writable])}A[Mw]=!0}}}const aUA=500,rUA=15e3;class KD{constructor(){this.failedConnectionAttempts=new Map,this.backOffPromises=new Map}static getInstance(){return this._instance||(this._instance=new KD),this._instance}addFailedConnectionAttempt(A){var e;const i=new URL(A),g=OJ(i);if(!g)return;let I=(e=this.failedConnectionAttempts.get(g))!==null&&e!==void 0?e:0;this.failedConnectionAttempts.set(g,I+1),this.backOffPromises.set(g,Oo(Math.min(aUA*Math.pow(2,I),rUA)))}getBackOffPromise(A){const e=new URL(A),i=e&&OJ(e);return i&&this.backOffPromises.get(i)||Promise.resolve()}resetFailedConnectionAttempts(A){const e=new URL(A),i=e&&OJ(e);i&&(this.failedConnectionAttempts.set(i,0),this.backOffPromises.set(i,Promise.resolve()))}resetAll(){this.backOffPromises.clear(),this.failedConnectionAttempts.clear()}}KD._instance=null;const zJ="default";class uo{constructor(){this._previousDevices=[]}static getInstance(){return this.instance===void 0&&(this.instance=new uo),this.instance}get previousDevices(){return this._previousDevices}getDevices(A){return vA(this,arguments,void 0,function(e){var i=this;let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var I;if(((I=uo.userMediaPromiseMap)===null||I===void 0?void 0:I.size)>0){Ji.debug("awaiting getUserMedia promise");try{e?yield uo.userMediaPromiseMap.get(e):yield Promise.all(uo.userMediaPromiseMap.values())}catch{Ji.warn("error waiting for media permissons")}}let n=yield navigator.mediaDevices.enumerateDevices();if(g&&!(Md()&&i.hasDeviceInUse(e))&&(n.filter(a=>a.kind===e).length===0||n.some(a=>{const r=a.label==="",s=e?a.kind===e:!0;return r&&s}))){const a={video:e!=="audioinput"&&e!=="audiooutput",audio:e!=="videoinput"&&{deviceId:{ideal:"default"}}},r=yield navigator.mediaDevices.getUserMedia(a);n=yield navigator.mediaDevices.enumerateDevices(),r.getTracks().forEach(s=>{s.stop()})}return i._previousDevices=n,e&&(n=n.filter(o=>o.kind===e)),n}()})}normalizeDeviceId(A,e,i){return vA(this,void 0,void 0,function*(){if(e!==zJ)return e;const g=yield this.getDevices(A),I=g.find(o=>o.deviceId===zJ);if(!I){Ji.warn("could not reliably determine default device");return}const n=g.find(o=>o.deviceId!==zJ&&o.groupId===(i??I.groupId));if(!n){Ji.warn("could not reliably determine default device");return}return n?.deviceId})}hasDeviceInUse(A){return A?uo.userMediaPromiseMap.has(A):uo.userMediaPromiseMap.size>0}}uo.mediaDeviceKinds=["audioinput","audiooutput","videoinput"];uo.userMediaPromiseMap=new Map;var _m;(function(t){t[t.WAITING=0]="WAITING",t[t.RUNNING=1]="RUNNING",t[t.COMPLETED=2]="COMPLETED"})(_m||(_m={}));class sUA{constructor(){this.pendingTasks=new Map,this.taskMutex=new gr,this.nextTaskIndex=0}run(A){return vA(this,void 0,void 0,function*(){const e={id:this.nextTaskIndex++,enqueuedAt:Date.now(),status:_m.WAITING};this.pendingTasks.set(e.id,e);const i=yield this.taskMutex.lock();try{return e.executedAt=Date.now(),e.status=_m.RUNNING,yield A()}finally{e.status=_m.COMPLETED,this.pendingTasks.delete(e.id),i()}})}flush(){return vA(this,void 0,void 0,function*(){return this.run(()=>vA(this,void 0,void 0,function*(){}))})}snapshot(){return Array.from(this.pendingTasks.values())}}class CUA{get readyState(){return this.ws.readyState}constructor(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i,g;if(!((i=e.signal)===null||i===void 0)&&i.aborted)throw new DOMException("This operation was aborted","AbortError");this.url=A;const I=new WebSocket(A,(g=e.protocols)!==null&&g!==void 0?g:[]);I.binaryType="arraybuffer",this.ws=I;const n=function(){let{closeCode:o,reason:a}=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return I.close(o,a)};this.opened=new Nr((o,a)=>{const r=()=>{a(Ii.websocket("Encountered websocket error during connection establishment"))};I.onopen=()=>{o({readable:new ReadableStream({start(s){I.onmessage=B=>{let{data:c}=B;return s.enqueue(c)},I.onerror=B=>s.error(B)},cancel:n}),writable:new WritableStream({write(s){I.send(s)},abort(){I.close()},close:n}),protocol:I.protocol,extensions:I.extensions}),I.removeEventListener("error",r)},I.addEventListener("error",r)}),this.closed=new Nr((o,a)=>{const r=()=>vA(this,void 0,void 0,function*(){const s=new Nr(c=>{I.readyState!==WebSocket.CLOSED&&I.addEventListener("close",E=>{c(E)},{once:!0})}),B=yield Nr.race([Oo(250),s]);B?o(B):a(Ii.websocket("Encountered unspecified websocket error without a timely close event"))});I.onclose=s=>{let{code:B,reason:c}=s;o({closeCode:B,reason:c}),I.removeEventListener("error",r)},I.addEventListener("error",r)}),e.signal&&(e.signal.onabort=()=>I.close()),this.close=n}}const BUA=["syncState","trickle","offer","answer","simulate","leave"];function cUA(t){const A=BUA.indexOf(t.case)>=0;return Ji.trace("request allowed to bypass queue:",{canPass:A,req:t}),A}var sI;(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"})(sI||(sI={}));const lUA=250;class AO{get currentState(){return this.state}get isDisconnected(){return this.state===sI.DISCONNECTING||this.state===sI.DISCONNECTED}get isEstablishingConnection(){return this.state===sI.CONNECTING||this.state===sI.RECONNECTING}getNextRequestId(){return this._requestId+=1,this._requestId}constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1,e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;this.rtt=0,this.state=sI.DISCONNECTED,this.log=Ji,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=uQ((i=e.loggerName)!==null&&i!==void 0?i:yB.Signal),this.loggerContextCb=e.loggerContextCb,this.useJSON=A,this.requestQueue=new sUA,this.queuedRequests=[],this.closingLock=new gr,this.connectionLock=new gr,this.state=sI.DISCONNECTED}get logContext(){var A,e;return(e=(A=this.loggerContextCb)===null||A===void 0?void 0:A.call(this))!==null&&e!==void 0?e:{}}join(A,e,i,g){return vA(this,arguments,void 0,function(I,n,o,a){var r=this;let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){return r.state=sI.CONNECTING,r.options=o,yield r.connect(I,n,o,a,s)}()})}reconnect(A,e,i,g){return vA(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=sI.RECONNECTING,this.clearPingInterval(),yield this.connect(A,e,Object.assign(Object.assign({},this.options),{reconnect:!0,sid:i,reconnectReason:g}),void 0,this.useV0SignalPath)})}connect(A,e,i,g){return vA(this,arguments,void 0,function(I,n,o,a){var r=this;let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){const B=yield r.connectionLock.lock();r.connectOptions=o,r.useV0SignalPath=s;const c=TRA(),E=s?QUA(n,c,o):EUA(n,c,o),D=VRA(I,E,s).toString(),y=$RA(D).toString();return new Promise((S,f)=>vA(r,void 0,void 0,function*(){var M,k;try{let m=!1;const U=G=>vA(this,void 0,void 0,function*(){if(m)return;m=!0;const J=G instanceof Event?G.currentTarget:G,x=AUA(J,"Abort handler called");this.streamWriter&&!this.isDisconnected?this.sendLeave().then(()=>this.close(x)).catch(H=>{this.log.error(H),this.close()}):this.close(),F(),f(Ii.cancelled(x))});a?.addEventListener("abort",U);const F=()=>{clearTimeout(b),a?.removeEventListener("abort",U)},b=setTimeout(()=>{U(Ii.timeout("room connection has timed out (signal)"))},o.websocketTimeout),K=(G,J)=>{this.handleSignalConnected(G,b,J)},R=new URL(D);R.searchParams.has("access_token")&&R.searchParams.set("access_token","<redacted>"),this.log.debug("connecting to ".concat(R),Object.assign({reconnect:o.reconnect,reconnectReason:o.reconnectReason},this.logContext)),this.ws&&(yield this.close(!1)),this.ws=new CUA(D);try{this.ws.closed.then(q=>{var Y;this.isEstablishingConnection&&f(Ii.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===sI.CONNECTED&&this.handleOnClose((Y=q.reason)!==null&&Y!==void 0?Y:"Unexpected WS error"))}).catch(q=>{this.isEstablishingConnection&&f(Ii.internal("Websocket error during a (re)connection attempt: ".concat(q)))});const G=yield this.ws.opened.catch(q=>vA(this,void 0,void 0,function*(){if(this.state!==sI.CONNECTED){this.state=sI.DISCONNECTED,clearTimeout(b);const Y=yield this.handleConnectionError(q,y);f(Y);return}this.handleWSError(q),f(q)}));if(clearTimeout(b),!G)return;const J=G.readable.getReader();this.streamWriter=G.writable.getWriter();const x=yield J.read();if(J.releaseLock(),!x.value)throw Ii.internal("no message received as first message");const H=W5(x.value),P=this.validateFirstMessage(H,(M=o.reconnect)!==null&&M!==void 0?M:!1);if(!P.isValid){f(P.error);return}((k=H.message)===null||k===void 0?void 0:k.case)==="join"&&(this.pingTimeoutDuration=H.message.value.pingTimeout,this.pingIntervalDuration=H.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 j=P.shouldProcessFirstMessage?H:void 0;K(G,j),S(P.response)}catch(G){f(G)}finally{F()}}finally{B()}}))}()})}startReadingLoop(A,e){return vA(this,void 0,void 0,function*(){for(e&&this.handleSignalResponse(e);;){this.signalLatency&&(yield Oo(this.signalLatency));const{done:i,value:g}=yield A.read();if(i)break;const I=W5(g);this.handleSignalResponse(I)}})}close(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,i=arguments.length>1&&arguments[1]!==void 0?arguments[1]:"Close method called on signal client";return function*(){if([sI.DISCONNECTING||sI.DISCONNECTED].includes(A.state)){A.log.debug("ignoring signal close as it's already in disconnecting state");return}const g=yield A.closingLock.lock();try{if(A.clearPingInterval(),e&&(A.state=sI.DISCONNECTING),A.ws){A.ws.close({closeCode:1e3,reason:i});const I=A.ws.closed;A.ws=void 0,A.streamWriter=void 0,yield Promise.race([I,Oo(lUA)])}}catch(I){A.log.debug("websocket error while closing",Object.assign(Object.assign({},A.logContext),{error:I}))}finally{e&&(A.state=sI.DISCONNECTED),g()}}()})}sendOffer(A,e){this.log.debug("sending offer",Object.assign(Object.assign({},this.logContext),{offerSdp:A.sdp})),this.sendRequest({case:"offer",value:rD(A,e)})}sendAnswer(A,e){return this.log.debug("sending answer",Object.assign(Object.assign({},this.logContext),{answerSdp:A.sdp})),this.sendRequest({case:"answer",value:rD(A,e)})}sendIceCandidate(A,e){return this.log.debug("sending ice candidate",Object.assign(Object.assign({},this.logContext),{candidate:A})),this.sendRequest({case:"trickle",value:new $F({candidateInit:JSON.stringify(A),target:e})})}sendMuteTrack(A,e){return this.sendRequest({case:"mute",value:new Ab({sid:A,muted:e})})}sendAddTrack(A){return this.sendRequest({case:"addTrack",value:A})}sendUpdateLocalMetadata(A,e){return vA(this,arguments,void 0,function(i,g){var I=this;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};return function*(){const o=I.getNextRequestId();return yield I.sendRequest({case:"updateMetadata",value:new PH({requestId:o,metadata:i,name:g,attributes:n})}),o}()})}sendUpdateTrackSettings(A){this.sendRequest({case:"trackSetting",value:A})}sendUpdateSubscription(A){return this.sendRequest({case:"subscription",value:A})}sendSyncState(A){return this.sendRequest({case:"syncState",value:A})}sendUpdateVideoLayers(A,e){return this.sendRequest({case:"updateLayers",value:new WeA({trackSid:A,layers:e})})}sendUpdateSubscriptionPermissions(A,e){return this.sendRequest({case:"subscriptionPermission",value:new XeA({allParticipants:A,trackPermissions:e})})}sendSimulateScenario(A){return this.sendRequest({case:"simulate",value:A})}sendPing(){return Promise.all([this.sendRequest({case:"ping",value:RI.parse(Date.now())}),this.sendRequest({case:"pingReq",value:new etA({timestamp:RI.parse(Date.now()),rtt:RI.parse(this.rtt)})})])}sendUpdateLocalAudioTrack(A,e){return this.sendRequest({case:"updateAudioTrack",value:new OH({trackSid:A,features:e})})}sendLeave(){return this.sendRequest({case:"leave",value:new tb({reason:cB.CLIENT_INITIATED,action:MD.DISCONNECT})})}sendRequest(A){return vA(this,arguments,void 0,function(e){var i=this;let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;return function*(){if(!g&&!cUA(e)&&i.state===sI.RECONNECTING){i.queuedRequests.push(()=>vA(i,void 0,void 0,function*(){yield this.sendRequest(e,!0)}));return}if(g||(yield i.requestQueue.flush()),i.signalLatency&&(yield Oo(i.signalLatency)),i.isDisconnected){i.log.debug("skipping signal request (type: ".concat(e.case,") - SignalClient disconnected"));return}if(!i.streamWriter){i.log.error("cannot send signal request before connected, type: ".concat(e?.case),i.logContext);return}const n=new SGA({message:e});try{i.useJSON?yield i.streamWriter.write(n.toJsonString()):yield i.streamWriter.write(n.toBinary())}catch(o){i.log.error("error sending signal message",Object.assign(Object.assign({},i.logContext),{error:o}))}}()})}handleSignalResponse(A){var e,i;const g=A.message;if(g==null){this.log.debug("received unsupported message",this.logContext);return}let I=!1;if(g.case==="answer"){const n=$5(g.value);this.onAnswer&&this.onAnswer(n,g.value.id,g.value.midToTrackId)}else if(g.case==="offer"){const n=$5(g.value);this.onOffer&&this.onOffer(n,g.value.id,g.value.midToTrackId)}else if(g.case==="trickle"){const n=JSON.parse(g.value.candidateInit);this.onTrickle&&this.onTrickle(n,g.value.target)}else g.case==="update"?this.onParticipantUpdate&&this.onParticipantUpdate((e=g.value.participants)!==null&&e!==void 0?e:[]):g.case==="trackPublished"?this.onLocalTrackPublished&&this.onLocalTrackPublished(g.value):g.case==="speakersChanged"?this.onSpeakersChanged&&this.onSpeakersChanged((i=g.value.speakers)!==null&&i!==void 0?i:[]):g.case==="leave"?this.onLeave&&this.onLeave(g.value):g.case==="mute"?this.onRemoteMuteChanged&&this.onRemoteMuteChanged(g.value.sid,g.value.muted):g.case==="roomUpdate"?this.onRoomUpdate&&g.value.room&&this.onRoomUpdate(g.value.room):g.case==="connectionQuality"?this.onConnectionQuality&&this.onConnectionQuality(g.value):g.case==="streamStateUpdate"?this.onStreamStateUpdate&&this.onStreamStateUpdate(g.value):g.case==="subscribedQualityUpdate"?this.onSubscribedQualityUpdate&&this.onSubscribedQualityUpdate(g.value):g.case==="subscriptionPermissionUpdate"?this.onSubscriptionPermissionUpdate&&this.onSubscriptionPermissionUpdate(g.value):g.case==="refreshToken"?this.onTokenRefresh&&this.onTokenRefresh(g.value):g.case==="trackUnpublished"?this.onLocalTrackUnpublished&&this.onLocalTrackUnpublished(g.value):g.case==="subscriptionResponse"?this.onSubscriptionError&&this.onSubscriptionError(g.value):g.case==="pong"||(g.case==="pongResp"?(this.rtt=Date.now()-Number.parseInt(g.value.lastPingTimestamp.toString()),this.resetPingTimeout(),I=!0):g.case==="requestResponse"?this.onRequestResponse&&this.onRequestResponse(g.value):g.case==="trackSubscribed"?this.onLocalTrackSubscribed&&this.onLocalTrackSubscribed(g.value.trackSid):g.case==="roomMoved"?(this.onTokenRefresh&&this.onTokenRefresh(g.value.token),this.onRoomMoved&&this.onRoomMoved(g.value)):g.case==="mediaSectionsRequirement"?this.onMediaSectionsRequirement&&this.onMediaSectionsRequirement(g.value):this.log.debug("unsupported message",Object.assign(Object.assign({},this.logContext),{msgCase:g.case})));I||this.resetPingTimeout()}setReconnected(){for(;this.queuedRequests.length>0;){const A=this.queuedRequests.shift();A&&this.requestQueue.run(A)}}handleOnClose(A){return vA(this,void 0,void 0,function*(){if(this.state===sI.DISCONNECTED)return;const e=this.onClose;yield this.close(void 0,A),this.log.debug("websocket connection closed: ".concat(A),Object.assign(Object.assign({},this.logContext),{reason:A})),e&&e(A)})}handleWSError(A){this.log.error("websocket error",Object.assign(Object.assign({},this.logContext),{error:A}))}resetPingTimeout(){if(this.clearPingTimeout(),!this.pingTimeoutDuration){this.log.warn("ping timeout duration not set",this.logContext);return}this.pingTimeout=Ho.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&&Ho.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=Ho.setInterval(()=>{this.sendPing()},this.pingIntervalDuration*1e3)}clearPingInterval(){this.log.debug("clearing ping interval",this.logContext),this.clearPingTimeout(),this.pingInterval&&Ho.clearInterval(this.pingInterval)}handleSignalConnected(A,e,i){this.state=sI.CONNECTED,clearTimeout(e),this.startPingInterval(),this.startReadingLoop(A.readable.getReader(),i)}validateFirstMessage(A,e){var i,g,I,n,o;return((i=A.message)===null||i===void 0?void 0:i.case)==="join"?{isValid:!0,response:A.message.value}:this.state===sI.RECONNECTING&&((g=A.message)===null||g===void 0?void 0:g.case)!=="leave"?((I=A.message)===null||I===void 0?void 0:I.case)==="reconnect"?{isValid:!0,response:A.message.value}:(this.log.debug("declaring signal reconnected without reconnect response received",this.logContext),{isValid:!0,response:void 0,shouldProcessFirstMessage:!0}):this.isEstablishingConnection&&((n=A.message)===null||n===void 0?void 0:n.case)==="leave"?{isValid:!1,error:Ii.leaveRequest("Received leave request while trying to (re)connect",A.message.value.reason)}:e?{isValid:!1,error:Ii.internal("Unexpected first message")}:{isValid:!1,error:Ii.internal("did not receive join response, got ".concat((o=A.message)===null||o===void 0?void 0:o.case," instead"))}}handleConnectionError(A,e){return vA(this,void 0,void 0,function*(){try{const i=yield fetch(e);switch(i.status){case 404:return Ii.serviceNotFound("v1 RTC path not found. Consider upgrading your LiveKit server version","v0-rtc");case 401:case 403:const g=yield i.text();return Ii.notAllowed(g,i.status);default:break}return A instanceof Ii?A:Ii.internal("Encountered unknown websocket error during connection: ".concat(A),{status:i.status,statusText:i.statusText})}catch(i){return i instanceof Ii?i:Ii.serverUnreachable(i instanceof Error?i.message:"server was not reachable")}})}}function $5(t){const A={type:"offer",sdp:t.sdp};switch(t.type){case"answer":case"offer":case"pranswer":case"rollback":A.type=t.type;break}return A}function rD(t,A){return new gu({sdp:t.sdp,type:t.type,id:A})}function QUA(t,A,e){var i;const g=new URLSearchParams;return g.set("access_token",t),e.reconnect&&(g.set("reconnect","1"),e.sid&&g.set("sid",e.sid)),g.set("auto_subscribe",e.autoSubscribe?"1":"0"),g.set("sdk",Oc()?"reactnative":"js"),g.set("version",A.version),g.set("protocol",A.protocol.toString()),A.deviceModel&&g.set("device_model",A.deviceModel),A.os&&g.set("os",A.os),A.osVersion&&g.set("os_version",A.osVersion),A.browser&&g.set("browser",A.browser),A.browserVersion&&g.set("browser_version",A.browserVersion),e.adaptiveStream&&g.set("adaptive_stream","1"),e.reconnectReason&&g.set("reconnect_reason",e.reconnectReason.toString()),!((i=navigator.connection)===null||i===void 0)&&i.type&&g.set("network",navigator.connection.type),g}function EUA(t,A,e){const i=new URLSearchParams;i.set("access_token",t);const g=new PGA({clientInfo:A,connectionSettings:new ttA({autoSubscribe:!!e.autoSubscribe,adaptiveStream:!!e.adaptiveStream}),reconnect:!!e.reconnect,participantSid:e.sid?e.sid:void 0});e.reconnectReason&&(g.reconnectReason=e.reconnectReason);const I=new jGA({joinRequest:g.toBinary()});return i.set("join_request",btoa(new TextDecoder("utf-8").decode(I.toBinary()))),i}class AZ{constructor(){this.buffer=[],this._totalSize=0}push(A){this.buffer.push(A),this._totalSize+=A.data.byteLength}pop(){const A=this.buffer.shift();return A&&(this._totalSize-=A.data.byteLength),A}getAll(){return this.buffer.slice()}popToSequence(A){for(;this.buffer.length>0&&this.buffer[0].sequence<=A;)this.pop()}alignBufferedAmount(A){for(;this.buffer.length>0;){const e=this.buffer[0];if(this._totalSize-e.data.byteLength<=A)break;this.pop()}}get length(){return this.buffer.length}}class uUA{constructor(A){this._map=new Map,this._lastCleanup=0,this.ttl=A}set(A,e){const i=Date.now();i-this._lastCleanup>this.ttl/2&&this.cleanup();const g=i+this.ttl;return this._map.set(A,{value:e,expiresAt:g}),this}get(A){const e=this._map.get(A);if(e){if(e.expiresAt<Date.now()){this._map.delete(A);return}return e.value}}has(A){const e=this._map.get(A);return e?e.expiresAt<Date.now()?(this._map.delete(A),!1):!0:!1}delete(A){return this._map.delete(A)}clear(){this._map.clear()}cleanup(){const A=Date.now();for(const[e,i]of this._map.entries())i.expiresAt<A&&this._map.delete(e);this._lastCleanup=A}get size(){return this.cleanup(),this._map.size}forEach(A){this.cleanup();for(const[e,i]of this._map.entries())i.expiresAt>=Date.now()&&A(i.value,e,this.asValueMap())}map(A){this.cleanup();const e=[],i=this.asValueMap();for(const[g,I]of i.entries())e.push(A(I,g,i));return e}asValueMap(){const A=new Map;for(const[e,i]of this._map.entries())i.expiresAt>=Date.now()&&A.set(e,i.value);return A}}var WC={},VJ={},XJ={exports:{}},eZ;function eO(){if(eZ)return XJ.exports;eZ=1;var t=XJ.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(A){return A.encoding?"rtpmap:%d %s/%s/%s":A.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(A){return A.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(A){return A.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(A){return"extmap:%d"+(A.direction?"/%s":"%v")+(A["encrypt-uri"]?" %s":"%v")+" %s"+(A.config?" %s":"")}},{name:"extmapAllowMixed",reg:/^(extmap-allow-mixed)/},{push:"crypto",reg:/^crypto:(\d*) ([\w_]*) (\S*)(?: (\S*))?/,names:["id","suite","config","sessionConfig"],format:function(A){return A.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(A){var e="candidate:%s %d %s %d %s %d typ %s";return e+=A.raddr!=null?" raddr %s rport %d":"%v%v",e+=A.tcptype!=null?" tcptype %s":"%v",A.generation!=null&&(e+=" generation %d"),e+=A["network-id"]!=null?" network-id %d":"%v",e+=A["network-cost"]!=null?" network-cost %d":"%v",e}},{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(A){var e="ssrc:%d";return A.attribute!=null&&(e+=" %s",A.value!=null&&(e+=":%s")),e}},{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(A){return A.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(A){return A.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(A){return"imageattr:%s %s %s"+(A.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(A){return"simulcast:%s %s"+(A.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(A){return"ts-refclk:%s"+(A.clksrcExt!=null?"=%s":"")}},{name:"mediaClk",reg:/^mediaclk:(?:id=(\S*))? *([^\s=]*)(?:=(\S*))?(?: *rate=(\d+)\/(\d+))?/,names:["id","mediaClockName","mediaClockValue","rateNumerator","rateDenominator"],format:function(A){var e="mediaclk:";return e+=A.id!=null?"id=%s %s":"%v%s",e+=A.mediaClockValue!=null?"=%s":"",e+=A.rateNumerator!=null?" rate=%s":"",e+=A.rateDenominator!=null?"/%s":"",e}},{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(A){var e=t[A];e.forEach(function(i){i.reg||(i.reg=/(.*)/),i.format||(i.format="%s")})}),XJ.exports}var tZ;function hUA(){return tZ||(tZ=1,function(t){var A=function(o){return String(Number(o))===o?Number(o):o},e=function(o,a,r,s){if(s&&!r)a[s]=A(o[1]);else for(var B=0;B<r.length;B+=1)o[B+1]!=null&&(a[r[B]]=A(o[B+1]))},i=function(o,a,r){var s=o.name&&o.names;o.push&&!a[o.push]?a[o.push]=[]:s&&!a[o.name]&&(a[o.name]={});var B=o.push?{}:s?a[o.name]:a;e(r.match(o.reg),B,o.names,o.name),o.push&&a[o.push].push(B)},g=eO(),I=RegExp.prototype.test.bind(/^([a-z])=(.*)/);t.parse=function(o){var a={},r=[],s=a;return o.split(/(\r\n|\r|\n)/).filter(I).forEach(function(B){var c=B[0],E=B.slice(2);c==="m"&&(r.push({rtp:[],fmtp:[]}),s=r[r.length-1]);for(var D=0;D<(g[c]||[]).length;D+=1){var y=g[c][D];if(y.reg.test(E))return i(y,s,E)}}),a.media=r,a};var n=function(o,a){var r=a.split(/=(.+)/,2);return r.length===2?o[r[0]]=A(r[1]):r.length===1&&a.length>1&&(o[r[0]]=void 0),o};t.parseParams=function(o){return o.split(/;\s?/).reduce(n,{})},t.parseFmtpConfig=t.parseParams,t.parsePayloads=function(o){return o.toString().split(" ").map(Number)},t.parseRemoteCandidates=function(o){for(var a=[],r=o.split(" ").map(A),s=0;s<r.length;s+=3)a.push({component:r[s],ip:r[s+1],port:r[s+2]});return a},t.parseImageAttributes=function(o){return o.split(" ").map(function(a){return a.substring(1,a.length-1).split(",").reduce(n,{})})},t.parseSimulcastStreamList=function(o){return o.split(";").map(function(a){return a.split(",").map(function(r){var s,B=!1;return r[0]!=="~"?s=A(r):(s=A(r.substring(1,r.length)),B=!0),{scid:s,paused:B}})})}}(VJ)),VJ}var $J,iZ;function dUA(){if(iZ)return $J;iZ=1;var t=eO(),A=/%[sdv%]/g,e=function(n){var o=1,a=arguments,r=a.length;return n.replace(A,function(s){if(o>=r)return s;var B=a[o];switch(o+=1,s){case"%%":return"%";case"%s":return String(B);case"%d":return Number(B);case"%v":return""}})},i=function(n,o,a){var r=o.format instanceof Function?o.format(o.push?a:a[o.name]):o.format,s=[n+"="+r];if(o.names)for(var B=0;B<o.names.length;B+=1){var c=o.names[B];o.name?s.push(a[o.name][c]):s.push(a[o.names[B]])}else s.push(a[o.name]);return e.apply(null,s)},g=["v","o","s","i","u","e","p","c","b","t","r","z","a"],I=["i","c","b","a"];return $J=function(n,o){o=o||{},n.version==null&&(n.version=0),n.name==null&&(n.name=" "),n.media.forEach(function(B){B.payloads==null&&(B.payloads="")});var a=o.outerOrder||g,r=o.innerOrder||I,s=[];return a.forEach(function(B){t[B].forEach(function(c){c.name in n&&n[c.name]!=null?s.push(i(B,c,n)):c.push in n&&n[c.push]!=null&&n[c.push].forEach(function(E){s.push(i(B,c,E))})})}),n.media.forEach(function(B){s.push(i("m",t.m[0],B)),r.forEach(function(c){t[c].forEach(function(E){E.name in B&&B[E.name]!=null?s.push(i(c,E,B)):E.push in B&&B[E.push]!=null&&B[E.push].forEach(function(D){s.push(i(c,E,D))})})})}),s.join(`\r
`)+`\r
`},$J}var gZ;function pUA(){if(gZ)return WC;gZ=1;var t=hUA(),A=dUA(),e=eO();return WC.grammar=e,WC.write=A,WC.parse=t.parse,WC.parseParams=t.parseParams,WC.parseFmtpConfig=t.parseFmtpConfig,WC.parsePayloads=t.parsePayloads,WC.parseRemoteCandidates=t.parseRemoteCandidates,WC.parseImageAttributes=t.parseImageAttributes,WC.parseSimulcastStreamList=t.parseSimulcastStreamList,WC}var DE=pUA();function tO(t,A,e){var i,g,I;A===void 0&&(A=50),e===void 0&&(e={});var n=(i=e.isImmediate)!=null&&i,o=(g=e.callback)!=null&&g,a=e.maxWait,r=Date.now(),s=[];function B(){if(a!==void 0){var E=Date.now()-r;if(E+A>=a)return a-E}return A}var c=function(){var E=[].slice.call(arguments),D=this;return new Promise(function(y,S){var f=n&&I===void 0;if(I!==void 0&&clearTimeout(I),I=setTimeout(function(){if(I=void 0,r=Date.now(),!n){var k=t.apply(D,E);o&&o(k),s.forEach(function(m){return(0,m.resolve)(k)}),s=[]}},B()),f){var M=t.apply(D,E);return o&&o(M),y(M)}s.push({resolve:y,reject:S})})};return c.cancel=function(E){I!==void 0&&clearTimeout(I),s.forEach(function(D){return(0,D.reject)(E)}),s=[]},c}const fUA=.7,DUA=20,FD={NegotiationStarted:"negotiationStarted",NegotiationComplete:"negotiationComplete",RTPVideoPayloadTypes:"rtpVideoPayloadTypes"};class IZ extends zc.EventEmitter{get pc(){return this._pc||(this._pc=this.createPC()),this._pc}constructor(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};var i;super(),this.log=Ji,this.ddExtID=0,this.latestOfferId=0,this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate=!1,this.trackBitrates=[],this.remoteStereoMids=[],this.remoteNackMids=[],this.negotiate=tO(g=>vA(this,void 0,void 0,function*(){this.emit(FD.NegotiationStarted);try{yield this.createAndSendOffer()}catch(I){if(g)g(I);else throw I}}),DUA),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=uQ((i=e.loggerName)!==null&&i!==void 0?i:yB.PCTransport),this.loggerOptions=e,this.config=A,this._pc=this.createPC(),this.offerLock=new gr}createPC(){const A=new RTCPeerConnection(this.config);return A.onicecandidate=e=>{var i;e.candidate&&((i=this.onIceCandidate)===null||i===void 0||i.call(this,e.candidate))},A.onicecandidateerror=e=>{var i;(i=this.onIceCandidateError)===null||i===void 0||i.call(this,e)},A.oniceconnectionstatechange=()=>{var e;(e=this.onIceConnectionStateChange)===null||e===void 0||e.call(this,A.iceConnectionState)},A.onsignalingstatechange=()=>{var e;(e=this.onSignalingStatechange)===null||e===void 0||e.call(this,A.signalingState)},A.onconnectionstatechange=()=>{var e;(e=this.onConnectionStateChange)===null||e===void 0||e.call(this,A.connectionState)},A.ondatachannel=e=>{var i;(i=this.onDataChannel)===null||i===void 0||i.call(this,e)},A.ontrack=e=>{var i;(i=this.onTrack)===null||i===void 0||i.call(this,e)},A}get logContext(){var A,e;return Object.assign({},(e=(A=this.loggerOptions).loggerContextCb)===null||e===void 0?void 0:e.call(A))}get isICEConnected(){return this._pc!==null&&(this.pc.iceConnectionState==="connected"||this.pc.iceConnectionState==="completed")}addIceCandidate(A){return vA(this,void 0,void 0,function*(){if(this.pc.remoteDescription&&!this.restartingIce)return this.pc.addIceCandidate(A);this.pendingCandidates.push(A)})}setRemoteDescription(A,e){return vA(this,void 0,void 0,function*(){var i;if(A.type==="answer"&&this.latestOfferId>0&&e>0&&e!==this.latestOfferId)return this.log.warn("ignoring answer for old offer",Object.assign(Object.assign({},this.logContext),{offerId:e,latestOfferId:this.latestOfferId})),!1;let g;if(A.type==="offer"){let{stereoMids:I,nackMids:n}=yUA(A);this.remoteStereoMids=I,this.remoteNackMids=n}else if(A.type==="answer"){const I=DE.parse((i=A.sdp)!==null&&i!==void 0?i:"");I.media.forEach(n=>{const o=iO(n.mid);n.type==="audio"&&this.trackBitrates.some(a=>{if(!a.transceiver||o!=a.transceiver.mid)return!1;let r=0;if(n.rtp.some(B=>B.codec.toUpperCase()===a.codec.toUpperCase()?(r=B.payload,!0):!1),r===0)return!0;let s=!1;for(const B of n.fmtp)if(B.payload===r){B.config=B.config.split(";").filter(c=>!c.includes("maxaveragebitrate")).join(";"),a.maxbr>0&&(B.config+=";maxaveragebitrate=".concat(a.maxbr*1e3)),s=!0;break}return s||a.maxbr>0&&n.fmtp.push({payload:r,config:"maxaveragebitrate=".concat(a.maxbr*1e3)}),!0})}),g=DE.write(I)}return yield this.setMungedSDP(A,g,!0),this.pendingCandidates.forEach(I=>{this.pc.addIceCandidate(I)}),this.pendingCandidates=[],this.restartingIce=!1,this.renegotiate?(this.renegotiate=!1,yield this.createAndSendOffer()):A.type==="answer"&&(this.emit(FD.NegotiationComplete),A.sdp&&DE.parse(A.sdp).media.forEach(n=>{n.type==="video"&&this.emit(FD.RTPVideoPayloadTypes,n.rtp)})),!0})}createAndSendOffer(A){return vA(this,void 0,void 0,function*(){var e;const i=yield this.offerLock.lock();try{if(this.onOffer===void 0)return;if(A?.iceRestart&&(this.log.debug("restarting ICE",this.logContext),this.restartingIce=!0),this._pc&&this._pc.signalingState==="have-local-offer"){const o=this._pc.remoteDescription;if(A?.iceRestart&&o)yield this._pc.setRemoteDescription(o);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 g=this.latestOfferId+1;this.latestOfferId=g;const I=yield this.pc.createOffer(A);this.log.debug("original offer",Object.assign({sdp:I.sdp},this.logContext));const n=DE.parse((e=I.sdp)!==null&&e!==void 0?e:"");if(n.media.forEach(o=>{oZ(o),o.type==="audio"?nZ(o,["all"],[]):o.type==="video"&&this.trackBitrates.some(a=>{if(!o.msid||!a.cid||!o.msid.includes(a.cid))return!1;let r=0;if(o.rtp.some(B=>B.codec.toUpperCase()===a.codec.toUpperCase()?(r=B.payload,!0):!1),r===0||(rB(a.codec)&&!Md()&&this.ensureVideoDDExtensionForSVC(o,n),!rB(a.codec)))return!0;const s=Math.round(a.maxbr*fUA);for(const B of o.fmtp)if(B.payload===r){B.config.includes("x-google-start-bitrate")||(B.config+=";x-google-start-bitrate=".concat(s));break}return!0})}),this.latestOfferId>g){this.log.warn("latestOfferId mismatch",Object.assign(Object.assign({},this.logContext),{latestOfferId:this.latestOfferId,offerId:g}));return}yield this.setMungedSDP(I,DE.write(n)),this.onOffer(I,this.latestOfferId)}finally{i()}})}createAndSetAnswer(){return vA(this,void 0,void 0,function*(){var A;const e=yield this.pc.createAnswer(),i=DE.parse((A=e.sdp)!==null&&A!==void 0?A:"");return i.media.forEach(g=>{oZ(g),g.type==="audio"&&nZ(g,this.remoteStereoMids,this.remoteNackMids)}),yield this.setMungedSDP(e,DE.write(i)),e})}createDataChannel(A,e){return this.pc.createDataChannel(A,e)}addTransceiver(A,e){return this.pc.addTransceiver(A,e)}addTransceiverOfKind(A,e){return this.pc.addTransceiver(A,e)}addTrack(A){if(!this._pc)throw new rn("PC closed, cannot add track");return this._pc.addTrack(A)}setTrackCodecBitrate(A){this.trackBitrates.push(A)}setConfiguration(A){var e;if(!this._pc)throw new rn("PC closed, cannot configure");return(e=this._pc)===null||e===void 0?void 0:e.setConfiguration(A)}canRemoveTrack(){var A;return!!(!((A=this._pc)===null||A===void 0)&&A.removeTrack)}removeTrack(A){var e;return(e=this._pc)===null||e===void 0?void 0:e.removeTrack(A)}getConnectionState(){var A,e;return(e=(A=this._pc)===null||A===void 0?void 0:A.connectionState)!==null&&e!==void 0?e:"closed"}getICEConnectionState(){var A,e;return(e=(A=this._pc)===null||A===void 0?void 0:A.iceConnectionState)!==null&&e!==void 0?e:"closed"}getSignallingState(){var A,e;return(e=(A=this._pc)===null||A===void 0?void 0:A.signalingState)!==null&&e!==void 0?e:"closed"}getTransceivers(){var A,e;return(e=(A=this._pc)===null||A===void 0?void 0:A.getTransceivers())!==null&&e!==void 0?e:[]}getSenders(){var A,e;return(e=(A=this._pc)===null||A===void 0?void 0:A.getSenders())!==null&&e!==void 0?e:[]}getLocalDescription(){var A;return(A=this._pc)===null||A===void 0?void 0:A.localDescription}getRemoteDescription(){var A;return(A=this.pc)===null||A===void 0?void 0:A.remoteDescription}getStats(){return this.pc.getStats()}getConnectedAddress(){return vA(this,void 0,void 0,function*(){var A;if(!this._pc)return;let e="";const i=new Map,g=new Map;if((yield this._pc.getStats()).forEach(o=>{switch(o.type){case"transport":e=o.selectedCandidatePairId;break;case"candidate-pair":e===""&&o.selected&&(e=o.id),i.set(o.id,o);break;case"remote-candidate":g.set(o.id,"".concat(o.address,":").concat(o.port));break}}),e==="")return;const n=(A=i.get(e))===null||A===void 0?void 0:A.remoteCandidateId;if(n!==void 0)return g.get(n)})}setMungedSDP(A,e,i){return vA(this,void 0,void 0,function*(){if(e){const g=A.sdp;A.sdp=e;try{this.log.debug("setting munged ".concat(i?"remote":"local"," description"),this.logContext),i?yield this.pc.setRemoteDescription(A):yield this.pc.setLocalDescription(A);return}catch(I){this.log.warn("not able to set ".concat(A.type,", falling back to unmodified sdp"),Object.assign(Object.assign({},this.logContext),{error:I,sdp:e})),A.sdp=g}}try{i?yield this.pc.setRemoteDescription(A):yield this.pc.setLocalDescription(A)}catch(g){let I="unknown error";g instanceof Error?I=g.message:typeof g=="string"&&(I=g);const n={error:I,sdp:A.sdp};throw!i&&this.pc.remoteDescription&&(n.remoteSdp=this.pc.remoteDescription),this.log.error("unable to set ".concat(A.type),Object.assign(Object.assign({},this.logContext),{fields:n})),new GD(I)}})}ensureVideoDDExtensionForSVC(A,e){var i,g;if(!((i=A.ext)===null||i===void 0?void 0:i.some(n=>n.uri===T5))){if(this.ddExtID===0){let n=0;e.media.forEach(o=>{var a;o.type==="video"&&((a=o.ext)===null||a===void 0||a.forEach(r=>{r.value>n&&(n=r.value)}))}),this.ddExtID=n+1}(g=A.ext)===null||g===void 0||g.push({value:this.ddExtID,uri:T5})}}}function nZ(t,A,e){const i=iO(t.mid);let g=0;t.rtp.some(I=>I.codec==="opus"?(g=I.payload,!0):!1),g>0&&(t.rtcpFb||(t.rtcpFb=[]),e.includes(i)&&!t.rtcpFb.some(I=>I.payload===g&&I.type==="nack")&&t.rtcpFb.push({payload:g,type:"nack"}),(A.includes(i)||A.length===1&&A[0]==="all")&&t.fmtp.some(I=>I.payload===g?(I.config.includes("stereo=1")||(I.config+=";stereo=1"),!0):!1))}function yUA(t){var A;const e=[],i=[],g=DE.parse((A=t.sdp)!==null&&A!==void 0?A:"");let I=0;return g.media.forEach(n=>{var o;const a=iO(n.mid);n.type==="audio"&&(n.rtp.some(r=>r.codec==="opus"?(I=r.payload,!0):!1),!((o=n.rtcpFb)===null||o===void 0)&&o.some(r=>r.payload===I&&r.type==="nack")&&i.push(a),n.fmtp.some(r=>r.payload===I?(r.config.includes("sprop-stereo=1")&&e.push(a),!0):!1))}),{stereoMids:e,nackMids:i}}function oZ(t){if(t.connection){const A=t.connection.ip.indexOf(":")>=0;(t.connection.version===4&&A||t.connection.version===6&&!A)&&(t.connection.ip="0.0.0.0",t.connection.version=4)}}function iO(t){return typeof t=="number"?t.toFixed(0):t}const YT="vp8",SUA={audioPreset:FT.music,dtx:!0,red:!0,forceStereo:!1,simulcast:!0,screenShareEncoding:VH.h1080fps15.encoding,stopMicTrackOnMute:!1,videoCodec:YT,backupCodec:!0,preConnectBuffer:!1},TtA={deviceId:{ideal:"default"},autoGainControl:!0,echoCancellation:!0,noiseSuppression:!0,voiceIsolation:!0},YtA={deviceId:{ideal:"default"},resolution:ty.h720.resolution},wUA={adaptiveStream:!1,dynacast:!1,stopLocalTrackOnUnpublish:!0,reconnectPolicy:new eRA,disconnectOnPageLeave:!0,webAudioMix:!1,singlePeerConnection:!0},gO={autoSubscribe:!0,maxRetries:1,peerConnectionTimeout:15e3,websocketTimeout:15e3};var VI;(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"})(VI||(VI={}));class mUA{get needsPublisher(){return this.isPublisherConnectionRequired}get needsSubscriber(){return this.isSubscriberConnectionRequired}get currentState(){return this.state}get mode(){return this._mode}constructor(A,e,i){var g;this.peerConnectionTimeout=gO.peerConnectionTimeout,this.log=Ji,this.updateState=()=>{var I,n;const o=this.state,a=this.requiredTransports.map(r=>r.getConnectionState());a.every(r=>r==="connected")?this.state=VI.CONNECTED:a.some(r=>r==="failed")?this.state=VI.FAILED:a.some(r=>r==="connecting")?this.state=VI.CONNECTING:a.every(r=>r==="closed")?this.state=VI.CLOSED:a.some(r=>r==="closed")?this.state=VI.CLOSING:a.every(r=>r==="new")&&(this.state=VI.NEW),o!==this.state&&(this.log.debug("pc state change: from ".concat(VI[o]," to ").concat(VI[this.state]),this.logContext),(I=this.onStateChange)===null||I===void 0||I.call(this,this.state,this.publisher.getConnectionState(),(n=this.subscriber)===null||n===void 0?void 0:n.getConnectionState()))},this.log=uQ((g=i.loggerName)!==null&&g!==void 0?g:yB.PCManager),this.loggerOptions=i,this.isPublisherConnectionRequired=e!=="subscriber-primary",this.isSubscriberConnectionRequired=e==="subscriber-primary",this.publisher=new IZ(A,i),this._mode=e,e!=="publisher-only"&&(this.subscriber=new IZ(A,i),this.subscriber.onConnectionStateChange=this.updateState,this.subscriber.onIceConnectionStateChange=this.updateState,this.subscriber.onSignalingStatechange=this.updateState,this.subscriber.onIceCandidate=I=>{var n;(n=this.onIceCandidate)===null||n===void 0||n.call(this,I,aB.SUBSCRIBER)},this.subscriber.onDataChannel=I=>{var n;(n=this.onDataChannel)===null||n===void 0||n.call(this,I)},this.subscriber.onTrack=I=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,I)}),this.publisher.onConnectionStateChange=this.updateState,this.publisher.onIceConnectionStateChange=this.updateState,this.publisher.onSignalingStatechange=this.updateState,this.publisher.onIceCandidate=I=>{var n;(n=this.onIceCandidate)===null||n===void 0||n.call(this,I,aB.PUBLISHER)},this.publisher.onTrack=I=>{var n;(n=this.onTrack)===null||n===void 0||n.call(this,I)},this.publisher.onOffer=(I,n)=>{var o;(o=this.onPublisherOffer)===null||o===void 0||o.call(this,I,n)},this.state=VI.NEW,this.connectionLock=new gr,this.remoteOfferLock=new gr}get logContext(){var A,e;return Object.assign({},(e=(A=this.loggerOptions).loggerContextCb)===null||e===void 0?void 0:e.call(A))}requirePublisher(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;this.isPublisherConnectionRequired=A,this.updateState()}createAndSendPublisherOffer(A){return this.publisher.createAndSendOffer(A)}setPublisherAnswer(A,e){return this.publisher.setRemoteDescription(A,e)}removeTrack(A){return this.publisher.removeTrack(A)}close(){return vA(this,void 0,void 0,function*(){var A;if(this.publisher&&this.publisher.getSignallingState()!=="closed"){const e=this.publisher;for(const i of e.getSenders())try{e.canRemoveTrack()&&e.removeTrack(i)}catch(g){this.log.warn("could not removeTrack",Object.assign(Object.assign({},this.logContext),{error:g}))}}yield Promise.all([this.publisher.close(),(A=this.subscriber)===null||A===void 0?void 0:A.close()]),this.updateState()})}triggerIceRestart(){return vA(this,void 0,void 0,function*(){this.subscriber&&(this.subscriber.restartingIce=!0),this.needsPublisher&&(yield this.createAndSendPublisherOffer({iceRestart:!0}))})}addIceCandidate(A,e){return vA(this,void 0,void 0,function*(){var i;e===aB.PUBLISHER?yield this.publisher.addIceCandidate(A):yield(i=this.subscriber)===null||i===void 0?void 0:i.addIceCandidate(A)})}createSubscriberAnswerFromOffer(A,e){return vA(this,void 0,void 0,function*(){var i,g,I;this.log.debug("received server offer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:A.type,sdp:A.sdp,signalingState:(i=this.subscriber)===null||i===void 0?void 0:i.getSignallingState().toString()}));const n=yield this.remoteOfferLock.lock();try{return(yield(g=this.subscriber)===null||g===void 0?void 0:g.setRemoteDescription(A,e))?yield(I=this.subscriber)===null||I===void 0?void 0:I.createAndSetAnswer():void 0}finally{n()}})}updateConfiguration(A,e){var i;this.publisher.setConfiguration(A),(i=this.subscriber)===null||i===void 0||i.setConfiguration(A),e&&this.triggerIceRestart()}ensurePCTransportConnection(A,e){return vA(this,void 0,void 0,function*(){var i;const g=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((i=this.requiredTransports)===null||i===void 0?void 0:i.map(I=>this.ensureTransportConnected(I,A,e)))}finally{g()}})}negotiate(A){return vA(this,void 0,void 0,function*(){return new Nr((e,i)=>vA(this,void 0,void 0,function*(){const g=setTimeout(()=>{i(new GD("negotiation timed out"))},this.peerConnectionTimeout),I=()=>{clearTimeout(g),i(new GD("negotiation aborted"))};A.signal.addEventListener("abort",I),this.publisher.once(FD.NegotiationStarted,()=>{A.signal.aborted||this.publisher.once(FD.NegotiationComplete,()=>{clearTimeout(g),e()})}),yield this.publisher.negotiate(n=>{clearTimeout(g),n instanceof Error?i(n):i(new Error(String(n)))})}))})}addPublisherTransceiver(A,e){return this.publisher.addTransceiver(A,e)}addPublisherTransceiverOfKind(A,e){return this.publisher.addTransceiverOfKind(A,e)}getMidForReceiver(A){const i=(this.subscriber?this.subscriber.getTransceivers():this.publisher.getTransceivers()).find(g=>g.receiver===A);return i?.mid}addPublisherTrack(A){return this.publisher.addTrack(A)}createPublisherDataChannel(A,e){return this.publisher.createDataChannel(A,e)}getConnectedAddress(A){return A===aB.PUBLISHER?this.publisher.getConnectedAddress():A===aB.SUBSCRIBER?this.publisher.getConnectedAddress():this.requiredTransports[0].getConnectedAddress()}get requiredTransports(){const A=[];return this.isPublisherConnectionRequired&&A.push(this.publisher),this.isSubscriberConnectionRequired&&this.subscriber&&A.push(this.subscriber),A}ensureTransportConnected(A,e){return vA(this,arguments,void 0,function(i,g){var I=this;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:this.peerConnectionTimeout;return function*(){if(i.getConnectionState()!=="connected")return new Promise((a,r)=>vA(I,void 0,void 0,function*(){const s=()=>{this.log.warn("abort transport connection",this.logContext),Ho.clearTimeout(B),r(Ii.cancelled("room connection has been cancelled"))};g?.signal.aborted&&s(),g?.signal.addEventListener("abort",s);const B=Ho.setTimeout(()=>{g?.signal.removeEventListener("abort",s),r(Ii.internal("could not establish pc connection"))},n);for(;this.state!==VI.CONNECTED;)if(yield Oo(50),g?.signal.aborted){r(Ii.cancelled("room connection has been cancelled"));return}Ho.clearTimeout(B),g?.signal.removeEventListener("abort",s),a()}))}()})}}const HtA=5e3,kUA=3e4;class Sg{static fetchRegionSettings(A,e,i){return vA(this,void 0,void 0,function*(){const g=yield Sg.fetchLock.lock();try{const I=yield fetch("".concat(MUA(A),"/regions"),{headers:{authorization:"Bearer ".concat(e)},signal:i});if(I.ok){const n=zRA(I.headers),o=n?n*1e3:HtA;return{regionSettings:yield I.json(),updatedAtInMs:Date.now(),maxAgeInMs:o}}else throw I.status===401?Ii.notAllowed("Could not fetch region settings: ".concat(I.statusText),I.status):Ii.internal("Could not fetch region settings: ".concat(I.statusText))}catch(I){throw I instanceof Ii?I:i?.aborted?Ii.cancelled("Region fetching was aborted"):Ii.serverUnreachable("Could not fetch region settings, ".concat(I instanceof Error?"".concat(I.name,": ").concat(I.message):I))}finally{g()}})}static scheduleRefetch(A,e,i){return vA(this,void 0,void 0,function*(){const g=Sg.settingsTimeouts.get(A.hostname);clearTimeout(g),Sg.settingsTimeouts.set(A.hostname,setTimeout(()=>vA(this,void 0,void 0,function*(){try{const I=yield Sg.fetchRegionSettings(A,e);Sg.updateCachedRegionSettings(A,e,I)}catch(I){if(I instanceof Ii&&I.reason===BI.NotAllowed){Ji.debug("token is not valid, cancelling auto region refresh");return}Ji.debug("auto refetching of region settings failed",{error:I}),Sg.scheduleRefetch(A,e,i)}}),i))})}static updateCachedRegionSettings(A,e,i){Sg.cache.set(A.hostname,i),Sg.scheduleRefetch(A,e,i.maxAgeInMs)}static stopRefetch(A){const e=Sg.settingsTimeouts.get(A);e&&(clearTimeout(e),Sg.settingsTimeouts.delete(A))}static scheduleCleanup(A){let e=Sg.connectionTrackers.get(A);e&&(e.cleanupTimeout&&clearTimeout(e.cleanupTimeout),e.cleanupTimeout=setTimeout(()=>{const i=Sg.connectionTrackers.get(A);i&&i.connectionCount===0&&(Ji.debug("stopping region refetch after disconnect delay",{hostname:A}),Sg.stopRefetch(A)),i&&(i.cleanupTimeout=void 0)},kUA))}static cancelCleanup(A){const e=Sg.connectionTrackers.get(A);e?.cleanupTimeout&&(clearTimeout(e.cleanupTimeout),e.cleanupTimeout=void 0)}notifyConnected(){const A=this.serverUrl.hostname;let e=Sg.connectionTrackers.get(A);e||(e={connectionCount:0},Sg.connectionTrackers.set(A,e)),e.connectionCount++,Sg.cancelCleanup(A)}notifyDisconnected(){const A=this.serverUrl.hostname,e=Sg.connectionTrackers.get(A);e&&(e.connectionCount=Math.max(0,e.connectionCount-1),e.connectionCount===0&&Sg.scheduleCleanup(A))}constructor(A,e){this.attemptedRegions=[],this.serverUrl=new URL(A),this.token=e}updateToken(A){this.token=A}isCloud(){return iy(this.serverUrl)}getServerUrl(){return this.serverUrl}fetchRegionSettings(A){return vA(this,void 0,void 0,function*(){return Sg.fetchRegionSettings(this.serverUrl,this.token,A)})}getNextBestRegionUrl(A){return vA(this,void 0,void 0,function*(){if(!this.isCloud())throw Error("region availability is only supported for LiveKit Cloud domains");let e=Sg.cache.get(this.serverUrl.hostname);(!e||Date.now()-e.updatedAtInMs>e.maxAgeInMs)&&(e=yield this.fetchRegionSettings(A),Sg.updateCachedRegionSettings(this.serverUrl,this.token,e));const i=e.regionSettings.regions.filter(g=>!this.attemptedRegions.find(I=>I.url===g.url));if(i.length>0){const g=i[0];return this.attemptedRegions.push(g),Ji.debug("next region: ".concat(g.region)),g.url}else return null})}resetAttempts(){this.attemptedRegions=[]}setServerReportedRegions(A){Sg.updateCachedRegionSettings(this.serverUrl,this.token,A)}}Sg.cache=new Map;Sg.settingsTimeouts=new Map;Sg.connectionTrackers=new Map;Sg.fetchLock=new gr;function MUA(t){return"".concat(t.protocol.replace("ws","http"),"//").concat(t.host,"/settings")}let za=class Lh extends Error{constructor(A,e,i){super(e),this.code=A,this.message=aZ(e,Lh.MAX_MESSAGE_BYTES),this.data=i?aZ(i,Lh.MAX_DATA_BYTES):void 0}static fromProto(A){return new Lh(A.code,A.message,A.data)}toProto(){return new _eA({code:this.code,message:this.message,data:this.data})}static builtIn(A,e){return new Lh(Lh.ErrorCode[A],Lh.ErrorMessage[A],e)}};za.MAX_MESSAGE_BYTES=256;za.MAX_DATA_BYTES=15360;za.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};za.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 OtA=15360;function IO(t){return new TextEncoder().encode(t).length}function aZ(t,A){if(IO(t)<=A)return t;let e=0,i=t.length;const g=new TextEncoder;for(;e<i;){const I=Math.floor((e+i+1)/2);g.encode(t.slice(0,I)).length<=A?e=I:i=I-1}return t.slice(0,e)}const nO=2e3;function gb(t,A){if(!A)return 0;let e,i;return"bytesReceived"in t?(e=t.bytesReceived,i=A.bytesReceived):"bytesSent"in t&&(e=t.bytesSent,i=A.bytesSent),e===void 0||i===void 0||t.timestamp===void 0||A.timestamp===void 0?0:(e-i)*8*1e3/(t.timestamp-A.timestamp)}const oO=typeof MediaRecorder<"u";class NUA{constructor(){throw new Error("MediaRecorder is not available in this environment")}}const GUA=oO?MediaRecorder:NUA;class RUA extends GUA{constructor(A,e){if(!oO)throw new Error("MediaRecorder is not available in this environment");super(new MediaStream([A.mediaStreamTrack]),e);let i,g;const I=()=>g===void 0,n=()=>{this.removeEventListener("dataavailable",i),this.removeEventListener("stop",n),this.removeEventListener("error",o),g?.close(),g=void 0},o=a=>{g?.error(a),this.removeEventListener("dataavailable",i),this.removeEventListener("stop",n),this.removeEventListener("error",o),g=void 0};this.byteStream=new ReadableStream({start:a=>{g=a,i=r=>vA(this,void 0,void 0,function*(){let s;if(r.data.arrayBuffer){const B=yield r.data.arrayBuffer();s=new Uint8Array(B)}else if(r.data.byteArray)s=r.data.byteArray;else throw new Error("no data available!");I()||a.enqueue(s)}),this.addEventListener("dataavailable",i)},cancel:()=>{n()}}),this.addEventListener("stop",n),this.addEventListener("error",o)}}function UUA(){return oO}const KUA=1e3,FUA=1e4;class PtA extends Pe{get sender(){return this._sender}set sender(A){this._sender=A}get constraints(){return this._constraints}get hasPreConnectBuffer(){return!!this.localTrackRecorder}constructor(A,e,i){let g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:!1,I=arguments.length>4?arguments[4]:void 0;super(A,e,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=tO(()=>vA(this,void 0,void 0,function*(){yield this.pauseUpstream()}),5e3),this.handleTrackUnmuteEvent=()=>vA(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(ct.Ended,this)},this.reacquireTrack=!1,this.providedByUser=g,this.muteLock=new gr,this.pauseUpstreamLock=new gr,this.trackChangeLock=new gr,this.trackChangeLock.lock().then(n=>vA(this,void 0,void 0,function*(){try{yield this.setMediaStreamTrack(A,!0)}finally{n()}})),this._constraints=A.getConstraints(),i&&(this._constraints=i)}get id(){return this._mediaStreamTrack.id}get dimensions(){if(this.kind!==Pe.Kind.Video)return;const{width:A,height:e}=this._mediaStreamTrack.getSettings();if(A&&e)return{width:A,height:e}}get isUpstreamPaused(){return this._isUpstreamPaused}get isUserProvided(){return this.providedByUser}get mediaStreamTrack(){var A,e;return(e=(A=this.processor)===null||A===void 0?void 0:A.processedTrack)!==null&&e!==void 0?e:this._mediaStreamTrack}get isLocal(){return!0}getSourceTrackSettings(){return this._mediaStreamTrack.getSettings()}setMediaStreamTrack(A,e){return vA(this,void 0,void 0,function*(){var i;if(A===this._mediaStreamTrack&&!e)return;this._mediaStreamTrack&&(this.attachedElements.forEach(I=>{RD(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([A]),A&&(A.addEventListener("ended",this.handleEnded),A.addEventListener("mute",this.handleTrackMuteEvent),A.addEventListener("unmute",this.handleTrackUnmuteEvent),this._constraints=A.getConstraints());let g;if(this.processor&&A){if(this.log.debug("restarting processor",this.logContext),this.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");this.processorElement&&(aD(A,this.processorElement),this.processorElement.muted=!0),yield this.processor.restart({track:A,kind:this.kind,element:this.processorElement}),g=this.processor.processedTrack}this.sender&&((i=this.sender.transport)===null||i===void 0?void 0:i.state)!=="closed"&&(yield this.sender.replaceTrack(g??A)),!this.providedByUser&&this._mediaStreamTrack!==A&&this._mediaStreamTrack.stop(),this._mediaStreamTrack=A,A&&(this._mediaStreamTrack.enabled=!this.isMuted,yield this.resumeUpstream(),this.attachedElements.forEach(I=>{aD(g??A,I)}))})}waitForDimensions(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:KUA;return function*(){var i;if(A.kind===Pe.Kind.Audio)throw new Error("cannot get dimensions for audio tracks");((i=Ur())===null||i===void 0?void 0:i.os)==="iOS"&&(yield Oo(10));const g=Date.now();for(;Date.now()-g<e;){const I=A.dimensions;if(I)return I;yield Oo(50)}throw new Wl("unable to get track dimensions after timeout")}()})}setDeviceId(A){return vA(this,void 0,void 0,function*(){return this._constraints.deviceId===A&&this._mediaStreamTrack.getSettings().deviceId===YE(A)||(this._constraints.deviceId=A,this.isMuted)?!0:(yield this.restartTrack(),YE(A)===this._mediaStreamTrack.getSettings().deviceId)})}getDeviceId(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){if(A.source===Pe.Source.ScreenShare)return;const{deviceId:i,groupId:g}=A._mediaStreamTrack.getSettings(),I=A.kind===Pe.Kind.Audio?"audioinput":"videoinput";return e?uo.getInstance().normalizeDeviceId(I,i,g):i}()})}mute(){return vA(this,void 0,void 0,function*(){return this.setTrackMuted(!0),this})}unmute(){return vA(this,void 0,void 0,function*(){return this.setTrackMuted(!1),this})}replaceTrack(A,e){return vA(this,void 0,void 0,function*(){const i=yield this.trackChangeLock.lock();try{if(!this.sender)throw new Wl("unable to replace an unpublished track");let g,I;return typeof e=="boolean"?g=e:e!==void 0&&(g=e.userProvidedTrack,I=e.stopProcessor),this.providedByUser=g??!0,this.log.debug("replace MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(A),I&&this.processor&&(yield this.internalStopProcessor()),this}finally{i()}})}restart(A){return vA(this,void 0,void 0,function*(){this.manuallyStopped=!1;const e=yield this.trackChangeLock.lock();try{A||(A=this._constraints);const{deviceId:i,facingMode:g}=A,I=tRA(A,["deviceId","facingMode"]);this.log.debug("restarting track with constraints",Object.assign(Object.assign({},this.logContext),{constraints:A}));const n={audio:!1,video:!1};this.kind===Pe.Kind.Video?n.video=i||g?{deviceId:i,facingMode:g}:!0:n.audio=i?Object.assign({deviceId:i},I):!0,this.attachedElements.forEach(r=>{RD(this.mediaStreamTrack,r)}),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.stop();const a=(yield navigator.mediaDevices.getUserMedia(n)).getTracks()[0];return this.kind===Pe.Kind.Video&&(yield a.applyConstraints(I)),a.addEventListener("ended",this.handleEnded),this.log.debug("re-acquired MediaStreamTrack",this.logContext),yield this.setMediaStreamTrack(a),this._constraints=A,this.emit(ct.Restarted,this),this.manuallyStopped&&(this.log.warn("track was stopped during a restart, stopping restarted track",this.logContext),this.stop()),this}finally{e()}})}setTrackMuted(A){this.log.debug("setting ".concat(this.kind," track ").concat(A?"muted":"unmuted"),this.logContext),!(this.isMuted===A&&this._mediaStreamTrack.enabled!==A)&&(this.isMuted=A,this._mediaStreamTrack.enabled=!A,this.emit(A?ct.Muted:ct.Unmuted,this))}get needsReAcquisition(){return this._mediaStreamTrack.readyState!=="live"||this._mediaStreamTrack.muted||!this._mediaStreamTrack.enabled||this.reacquireTrack}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return vA(this,void 0,void 0,function*(){yield A.handleAppVisibilityChanged.call(this),JtA()&&(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 A;this.manuallyStopped=!0,super.stop(),this._mediaStreamTrack.removeEventListener("ended",this.handleEnded),this._mediaStreamTrack.removeEventListener("mute",this.handleTrackMuteEvent),this._mediaStreamTrack.removeEventListener("unmute",this.handleTrackUnmuteEvent),(A=this.processor)===null||A===void 0||A.destroy(),this.processor=void 0}pauseUpstream(){return vA(this,void 0,void 0,function*(){var A;const e=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(ct.UpstreamPaused,this);const i=Ur();if(i?.name==="Safari"&&Pc(i.version,"12.0")<0)throw new zH("pauseUpstream is not supported on Safari < 12.");((A=this.sender.transport)===null||A===void 0?void 0:A.state)!=="closed"&&(yield this.sender.replaceTrack(null))}finally{e()}})}resumeUpstream(){return vA(this,void 0,void 0,function*(){var A;const e=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(ct.UpstreamResumed,this),((A=this.sender.transport)===null||A===void 0?void 0:A.state)!=="closed"&&(yield this.sender.replaceTrack(this.mediaStreamTrack))}finally{e()}})}getRTCStatsReport(){return vA(this,void 0,void 0,function*(){var A;return!((A=this.sender)===null||A===void 0)&&A.getStats?yield this.sender.getStats():void 0})}setProcessor(A){return vA(this,arguments,void 0,function(e){var i=this;let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var I;const n=yield i.trackChangeLock.lock();try{i.log.debug("setting up processor",i.logContext);const o=document.createElement(i.kind),a={kind:i.kind,track:i._mediaStreamTrack,element:o,audioContext:i.audioContext};if(yield e.init(a),i.log.debug("processor initialized",i.logContext),i.processor&&(yield i.internalStopProcessor()),i.kind==="unknown")throw TypeError("cannot set processor on track of unknown kind");if(aD(i._mediaStreamTrack,o),o.muted=!0,o.play().catch(r=>{r instanceof DOMException&&r.name==="AbortError"?(i.log.warn("failed to play processor element, retrying",Object.assign(Object.assign({},i.logContext),{error:r})),setTimeout(()=>{o.play().catch(s=>{i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{err:s}))})},100)):i.log.error("failed to play processor element",Object.assign(Object.assign({},i.logContext),{error:r}))}),i.processor=e,i.processorElement=o,i.processor.processedTrack){for(const r of i.attachedElements)r!==i.processorElement&&g&&(RD(i._mediaStreamTrack,r),aD(i.processor.processedTrack,r));yield(I=i.sender)===null||I===void 0?void 0:I.replaceTrack(i.processor.processedTrack)}i.emit(ct.TrackProcessorUpdate,i.processor)}finally{n()}}()})}getProcessor(){return this.processor}stopProcessor(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){const i=yield A.trackChangeLock.lock();try{yield A.internalStopProcessor(e)}finally{i()}}()})}internalStopProcessor(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var i,g;A.processor&&(A.log.debug("stopping processor",A.logContext),(i=A.processor.processedTrack)===null||i===void 0||i.stop(),yield A.processor.destroy(),A.processor=void 0,e||((g=A.processorElement)===null||g===void 0||g.remove(),A.processorElement=void 0),yield A._mediaStreamTrack.applyConstraints(A._constraints),yield A.setMediaStreamTrack(A._mediaStreamTrack,!0),A.emit(ct.TrackProcessorUpdate))}()})}startPreConnectBuffer(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:100;if(!UUA()){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 e="audio/webm;codecs=opus";MediaRecorder.isTypeSupported(e)||(e="video/mp4"),this.localTrackRecorder=new RUA(this,{mimeType:e})}this.localTrackRecorder.start(A),this.autoStopPreConnectBuffer=setTimeout(()=>{this.log.warn("preconnect buffer timed out, stopping recording automatically",this.logContext),this.stopPreConnectBuffer()},FUA)}stopPreConnectBuffer(){clearTimeout(this.autoStopPreConnectBuffer),this.localTrackRecorder&&(this.localTrackRecorder.stop(),this.localTrackRecorder=void 0)}getPreConnectBuffer(){var A;return(A=this.localTrackRecorder)===null||A===void 0?void 0:A.byteStream}getPreConnectBufferMimeType(){var A;return(A=this.localTrackRecorder)===null||A===void 0?void 0:A.mimeType}}class YU extends PtA{get enhancedNoiseCancellation(){return this.isKrispNoiseFilterEnabled}constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,g=arguments.length>3?arguments[3]:void 0,I=arguments.length>4?arguments[4]:void 0;super(A,Pe.Kind.Audio,e,i,I),this.stopOnMute=!1,this.isKrispNoiseFilterEnabled=!1,this.monitorSender=()=>vA(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let n;try{n=yield this.getSenderStats()}catch(o){this.log.error("could not get audio sender stats",Object.assign(Object.assign({},this.logContext),{error:o}));return}n&&this.prevStats&&(this._currentBitrate=gb(n,this.prevStats)),this.prevStats=n}),this.handleKrispNoiseFilterEnable=()=>{this.isKrispNoiseFilterEnabled=!0,this.log.debug("Krisp noise filter enabled",this.logContext),this.emit(ct.AudioTrackFeatureUpdate,this,Eo.TF_ENHANCED_NOISE_CANCELLATION,!0)},this.handleKrispNoiseFilterDisable=()=>{this.isKrispNoiseFilterEnabled=!1,this.log.debug("Krisp noise filter disabled",this.logContext),this.emit(ct.AudioTrackFeatureUpdate,this,Eo.TF_ENHANCED_NOISE_CANCELLATION,!1)},this.audioContext=g,this.checkForSilence()}mute(){const A=Object.create(null,{mute:{get:()=>super.mute}});return vA(this,void 0,void 0,function*(){const e=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Pe.Source.Microphone&&this.stopOnMute&&!this.isUserProvided&&(this.log.debug("stopping mic track",this.logContext),this._mediaStreamTrack.stop()),yield A.mute.call(this),this)}finally{e()}})}unmute(){const A=Object.create(null,{unmute:{get:()=>super.unmute}});return vA(this,void 0,void 0,function*(){const e=yield this.muteLock.lock();try{if(!this.isMuted)return this.log.debug("Track already unmuted",this.logContext),this;const i=this._constraints.deviceId&&this._mediaStreamTrack.getSettings().deviceId!==YE(this._constraints.deviceId);return this.source===Pe.Source.Microphone&&(this.stopOnMute||this._mediaStreamTrack.readyState==="ended"||i)&&!this.isUserProvided&&(this.log.debug("reacquiring mic track",this.logContext),yield this.restartTrack()),yield A.unmute.call(this),this}finally{e()}})}restartTrack(A){return vA(this,void 0,void 0,function*(){let e;if(A){const i=XH({audio:A});typeof i.audio!="boolean"&&(e=i.audio)}yield this.restart(e)})}restart(A){const e=Object.create(null,{restart:{get:()=>super.restart}});return vA(this,void 0,void 0,function*(){const i=yield e.restart.call(this,A);return this.checkForSilence(),i})}startMonitor(){Gr()&&(this.monitorInterval||(this.monitorInterval=setInterval(()=>{this.monitorSender()},nO)))}setProcessor(A){return vA(this,void 0,void 0,function*(){var e;const i=yield this.trackChangeLock.lock();try{if(!Oc()&&!this.audioContext)throw Error("Audio context needs to be set on LocalAudioTrack in order to enable processors");this.processor&&(yield this.internalStopProcessor());const g={kind:this.kind,track:this._mediaStreamTrack,audioContext:this.audioContext};this.log.debug("setting up audio processor ".concat(A.name),this.logContext),yield A.init(g),this.processor=A,this.processor.processedTrack&&(yield(e=this.sender)===null||e===void 0?void 0:e.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(ct.TrackProcessorUpdate,this.processor)}finally{i()}})}setAudioContext(A){this.audioContext=A}getSenderStats(){return vA(this,void 0,void 0,function*(){var A;if(!(!((A=this.sender)===null||A===void 0)&&A.getStats))return;const e=yield this.sender.getStats();let i;return e.forEach(g=>{g.type==="outbound-rtp"&&(i={type:"audio",streamId:g.id,packetsSent:g.packetsSent,packetsLost:g.packetsLost,bytesSent:g.bytesSent,timestamp:g.timestamp,roundTripTime:g.roundTripTime,jitter:g.jitter})}),i})}checkForSilence(){return vA(this,void 0,void 0,function*(){const A=yield btA(this);return A&&(this.isMuted||this.log.debug("silence detected on local audio track",this.logContext),this.emit(ct.AudioSilenceDetected)),A})}}function bUA(t,A,e){switch(t.kind){case"audio":return new YU(t,A,!1,void 0,e);case"video":return new HU(t,A,!1,e);default:throw new Wl("unsupported track type: ".concat(t.kind))}}const vUA=Object.values(ty),_UA=Object.values(bT),JUA=Object.values(VH),LUA=[ty.h180,ty.h360],qUA=[bT.h180,bT.h360],xUA=t=>[{scaleResolutionDownBy:2,fps:t.encoding.maxFramerate}].map(e=>{var i,g;return new gI(Math.floor(t.width/e.scaleResolutionDownBy),Math.floor(t.height/e.scaleResolutionDownBy),Math.max(15e4,Math.floor(t.encoding.maxBitrate/(Math.pow(e.scaleResolutionDownBy,2)*(((i=t.encoding.maxFramerate)!==null&&i!==void 0?i:30)/((g=e.fps)!==null&&g!==void 0?g:30))))),e.fps,t.encoding.priority)}),HT=["q","h","f"];function OT(t,A,e,i){var g,I;let n=i?.videoEncoding;t&&(n=i?.screenShareEncoding);const o=i?.simulcast,a=i?.scalabilityMode,r=i?.videoCodec;if(!n&&!o&&!a||!A||!e)return[{}];n||(n=YUA(t,A,e,r),Ji.debug("using video encoding",n));const s=n.maxFramerate,B=new gI(A,e,n.maxBitrate,n.maxFramerate,n.priority);if(a&&rB(r)){const D=new jtA(a),y=[];if(D.spatial>3)throw new Error("unsupported scalabilityMode: ".concat(a));const S=Ur();if(w0()||Oc()||S?.name==="Chrome"&&Pc(S?.version,"113")<0){const f=D.suffix=="h"?2:3,M=JRA(S);for(let k=0;k<D.spatial;k+=1)y.push({rid:HT[2-k],maxBitrate:n.maxBitrate/Math.pow(f,k),maxFramerate:B.encoding.maxFramerate,scaleResolutionDownBy:M?Math.pow(2,k):void 0});y[0].scalabilityMode=a}else y.push({maxBitrate:n.maxBitrate,maxFramerate:B.encoding.maxFramerate,scalabilityMode:a});return B.encoding.priority&&(y[0].priority=B.encoding.priority,y[0].networkPriority=B.encoding.priority),Ji.debug("using svc encoding",{encodings:y}),y}if(!o)return[n];let c=[];t?c=(g=sZ(i?.screenShareSimulcastLayers))!==null&&g!==void 0?g:rZ(t,B):c=(I=sZ(i?.videoSimulcastLayers))!==null&&I!==void 0?I:rZ(t,B);let E;if(c.length>0){const D=c[0];c.length>1&&([,E]=c);const y=Math.max(A,e);if(y>=960&&E)return AL(A,e,[D,E,B],s);if(y>=480)return AL(A,e,[D,B],s)}return AL(A,e,[B])}function TUA(t,A,e){var i,g,I,n;if(!e.backupCodec||e.backupCodec===!0||e.backupCodec.codec===e.videoCodec)return;A!==e.backupCodec.codec&&Ji.warn("requested a different codec than specified as backup",{serverRequested:A,backup:e.backupCodec.codec}),e.videoCodec=A,e.videoEncoding=e.backupCodec.encoding;const o=t.mediaStreamTrack.getSettings(),a=(i=o.width)!==null&&i!==void 0?i:(g=t.dimensions)===null||g===void 0?void 0:g.width,r=(I=o.height)!==null&&I!==void 0?I:(n=t.dimensions)===null||n===void 0?void 0:n.height;return t.source===Pe.Source.ScreenShare&&e.simulcast&&(e.simulcast=!1),OT(t.source===Pe.Source.ScreenShare,a,r,e)}function YUA(t,A,e,i){const g=HUA(t,A,e);let{encoding:I}=g[0];const n=Math.max(A,e);for(let o=0;o<g.length;o+=1){const a=g[o];if(I=a.encoding,a.width>=n)break}if(i)switch(i){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 HUA(t,A,e){if(t)return JUA;const i=A>e?A/e:e/A;return Math.abs(i-16/9)<Math.abs(i-4/3)?vUA:_UA}function rZ(t,A){if(t)return xUA(A);const{width:e,height:i}=A,g=e>i?e/i:i/e;return Math.abs(g-16/9)<Math.abs(g-4/3)?LUA:qUA}function AL(t,A,e,i){const g=[];if(e.forEach((I,n)=>{if(n>=HT.length)return;const o=Math.min(t,A),r={rid:HT[n],scaleResolutionDownBy:Math.max(1,o/Math.min(I.width,I.height)),maxBitrate:I.encoding.maxBitrate},s=i&&I.encoding.maxFramerate?Math.min(i,I.encoding.maxFramerate):I.encoding.maxFramerate;s&&(r.maxFramerate=s);const B=kd()||n===0;I.encoding.priority&&B&&(r.priority=I.encoding.priority,r.networkPriority=I.encoding.priority),g.push(r)}),Oc()&&qtA()==="ios"){let I;g.forEach(o=>{I?o.maxFramerate&&o.maxFramerate>I&&(I=o.maxFramerate):I=o.maxFramerate});let n=!0;g.forEach(o=>{var a;o.maxFramerate!=I&&(n&&(n=!1,Ji.info("Simulcast on iOS React-Native requires all encodings to share the same framerate.")),Ji.info('Setting framerate of encoding "'.concat((a=o.rid)!==null&&a!==void 0?a:"",'" to ').concat(I)),o.maxFramerate=I)})}return g}function sZ(t){if(t)return t.sort((A,e)=>{const{encoding:i}=A,{encoding:g}=e;return i.maxBitrate>g.maxBitrate?1:i.maxBitrate<g.maxBitrate?-1:i.maxBitrate===g.maxBitrate&&i.maxFramerate&&g.maxFramerate?i.maxFramerate>g.maxFramerate?1:-1:0})}class jtA{constructor(A){const e=A.match(/^L(\d)T(\d)(h|_KEY|_KEY_SHIFT){0,1}$/);if(!e)throw new Error("invalid scalability mode");if(this.spatial=parseInt(e[1]),this.temporal=parseInt(e[2]),e.length>3)switch(e[3]){case"h":case"_KEY":case"_KEY_SHIFT":this.suffix=e[3]}}toString(){var A;return"L".concat(this.spatial,"T").concat(this.temporal).concat((A=this.suffix)!==null&&A!==void 0?A:"")}}function OUA(t){return t.source===Pe.Source.ScreenShare||t.constraints.height&&YE(t.constraints.height)>=1080?"maintain-resolution":"balanced"}const PUA=5e3;class HU extends PtA{get sender(){return this._sender}set sender(A){this._sender=A,this.degradationPreference&&this.setDegradationPreference(this.degradationPreference)}constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0,g=arguments.length>3?arguments[3]:void 0;super(A,Pe.Kind.Video,e,i,g),this.simulcastCodecs=new Map,this.degradationPreference="balanced",this.isCpuConstrained=!1,this.optimizeForPerformance=!1,this.monitorSender=()=>vA(this,void 0,void 0,function*(){if(!this.sender){this._currentBitrate=0;return}let I;try{I=yield this.getSenderStats()}catch(a){this.log.error("could not get video sender stats",Object.assign(Object.assign({},this.logContext),{error:a}));return}const n=new Map(I.map(a=>[a.rid,a])),o=I.some(a=>a.qualityLimitationReason==="cpu");if(o!==this.isCpuConstrained&&(this.isCpuConstrained=o,this.isCpuConstrained&&this.emit(ct.CpuConstrained)),this.prevStats){let a=0;n.forEach((r,s)=>{var B;const c=(B=this.prevStats)===null||B===void 0?void 0:B.get(s);a+=gb(r,c)}),this._currentBitrate=a}this.prevStats=n}),this.senderLock=new gr}get isSimulcast(){return!!(this.sender&&this.sender.getParameters().encodings.length>1)}startMonitor(A){var e;if(this.signalClient=A,!Gr())return;const i=(e=this.sender)===null||e===void 0?void 0:e.getParameters();i&&(this.encodings=i.encodings),!this.monitorInterval&&(this.monitorInterval=setInterval(()=>{this.monitorSender()},nO))}stop(){this._mediaStreamTrack.getConstraints(),this.simulcastCodecs.forEach(A=>{A.mediaStreamTrack.stop()}),super.stop()}pauseUpstream(){const A=Object.create(null,{pauseUpstream:{get:()=>super.pauseUpstream}});return vA(this,void 0,void 0,function*(){var e,i,g,I,n;yield A.pauseUpstream.call(this);try{for(var o=!0,a=Zl(this.simulcastCodecs.values()),r;r=yield a.next(),e=r.done,!e;o=!0)I=r.value,o=!1,yield(n=I.sender)===null||n===void 0?void 0:n.replaceTrack(null)}catch(s){i={error:s}}finally{try{!o&&!e&&(g=a.return)&&(yield g.call(a))}finally{if(i)throw i.error}}})}resumeUpstream(){const A=Object.create(null,{resumeUpstream:{get:()=>super.resumeUpstream}});return vA(this,void 0,void 0,function*(){var e,i,g,I,n;yield A.resumeUpstream.call(this);try{for(var o=!0,a=Zl(this.simulcastCodecs.values()),r;r=yield a.next(),e=r.done,!e;o=!0){I=r.value,o=!1;const s=I;yield(n=s.sender)===null||n===void 0?void 0:n.replaceTrack(s.mediaStreamTrack)}}catch(s){i={error:s}}finally{try{!o&&!e&&(g=a.return)&&(yield g.call(a))}finally{if(i)throw i.error}}})}mute(){const A=Object.create(null,{mute:{get:()=>super.mute}});return vA(this,void 0,void 0,function*(){const e=yield this.muteLock.lock();try{return this.isMuted?(this.log.debug("Track already muted",this.logContext),this):(this.source===Pe.Source.Camera&&!this.isUserProvided&&(this.log.debug("stopping camera track",this.logContext),this._mediaStreamTrack.stop()),yield A.mute.call(this),this)}finally{e()}})}unmute(){const A=Object.create(null,{unmute:{get:()=>super.unmute}});return vA(this,void 0,void 0,function*(){const e=yield this.muteLock.lock();try{return this.isMuted?(this.source===Pe.Source.Camera&&!this.isUserProvided&&(this.log.debug("reacquiring camera track",this.logContext),yield this.restartTrack()),yield A.unmute.call(this),this):(this.log.debug("Track already unmuted",this.logContext),this)}finally{e()}})}setTrackMuted(A){super.setTrackMuted(A);for(const e of this.simulcastCodecs.values())e.mediaStreamTrack.enabled=!A}getSenderStats(){return vA(this,void 0,void 0,function*(){var A;if(!(!((A=this.sender)===null||A===void 0)&&A.getStats))return[];const e=[],i=yield this.sender.getStats();return i.forEach(g=>{var I;if(g.type==="outbound-rtp"){const n={type:"video",streamId:g.id,frameHeight:g.frameHeight,frameWidth:g.frameWidth,framesPerSecond:g.framesPerSecond,framesSent:g.framesSent,firCount:g.firCount,pliCount:g.pliCount,nackCount:g.nackCount,packetsSent:g.packetsSent,bytesSent:g.bytesSent,qualityLimitationReason:g.qualityLimitationReason,qualityLimitationDurations:g.qualityLimitationDurations,qualityLimitationResolutionChanges:g.qualityLimitationResolutionChanges,rid:(I=g.rid)!==null&&I!==void 0?I:g.id,retransmittedPacketsSent:g.retransmittedPacketsSent,targetBitrate:g.targetBitrate,timestamp:g.timestamp},o=i.get(g.remoteId);o&&(n.jitter=o.jitter,n.packetsLost=o.packetsLost,n.roundTripTime=o.roundTripTime),e.push(n)}}),e.sort((g,I)=>{var n,o;return((n=I.frameWidth)!==null&&n!==void 0?n:0)-((o=g.frameWidth)!==null&&o!==void 0?o:0)}),e})}setPublishingQuality(A){const e=[];for(let i=ss.LOW;i<=ss.HIGH;i+=1)e.push(new jH({quality:i,enabled:i<=A}));this.log.debug("setting publishing quality. max quality ".concat(A),this.logContext),this.setPublishingLayers(rB(this.codec),e)}restartTrack(A){return vA(this,void 0,void 0,function*(){var e,i,g,I,n;let o;if(A){const B=XH({video:A});typeof B.video!="boolean"&&(o=B.video)}yield this.restart(o),this.isCpuConstrained=!1;try{for(var a=!0,r=Zl(this.simulcastCodecs.values()),s;s=yield r.next(),e=s.done,!e;a=!0){I=s.value,a=!1;const B=I;B.sender&&((n=B.sender.transport)===null||n===void 0?void 0:n.state)!=="closed"&&(B.mediaStreamTrack=this.mediaStreamTrack.clone(),yield B.sender.replaceTrack(B.mediaStreamTrack))}}catch(B){i={error:B}}finally{try{!a&&!e&&(g=r.return)&&(yield g.call(r))}finally{if(i)throw i.error}}})}setProcessor(A){const e=Object.create(null,{setProcessor:{get:()=>super.setProcessor}});return vA(this,arguments,void 0,function(i){var g=this;let I=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){var n,o,a,r,s,B;if(yield e.setProcessor.call(g,i,I),!((s=g.processor)===null||s===void 0)&&s.processedTrack)try{for(var c=!0,E=Zl(g.simulcastCodecs.values()),D;D=yield E.next(),n=D.done,!n;c=!0)r=D.value,c=!1,yield(B=r.sender)===null||B===void 0?void 0:B.replaceTrack(g.processor.processedTrack)}catch(y){o={error:y}}finally{try{!c&&!n&&(a=E.return)&&(yield a.call(E))}finally{if(o)throw o.error}}}()})}setDegradationPreference(A){return vA(this,void 0,void 0,function*(){if(this.degradationPreference=A,this.sender)try{this.log.debug("setting degradationPreference to ".concat(A),this.logContext);const e=this.sender.getParameters();e.degradationPreference=A,this.sender.setParameters(e)}catch(e){this.log.warn("failed to set degradationPreference",Object.assign({error:e},this.logContext))}})}addSimulcastTrack(A,e){if(this.simulcastCodecs.has(A)){this.log.error("".concat(A," already added, skipping adding simulcast codec"),this.logContext);return}const i={codec:A,mediaStreamTrack:this.mediaStreamTrack.clone(),sender:void 0,encodings:e};return this.simulcastCodecs.set(A,i),i}setSimulcastTrackSender(A,e){const i=this.simulcastCodecs.get(A);i&&(i.sender=e,setTimeout(()=>{this.subscribedCodecs&&this.setPublishingCodecs(this.subscribedCodecs)},PUA))}setPublishingCodecs(A){return vA(this,void 0,void 0,function*(){var e,i,g,I,n,o,a;if(this.log.debug("setting publishing codecs",Object.assign(Object.assign({},this.logContext),{codecs:A,currentCodec:this.codec})),!this.codec&&A.length>0)return yield this.setPublishingLayers(rB(A[0].codec),A[0].qualities),[];this.subscribedCodecs=A;const r=[];try{for(e=!0,i=Zl(A);g=yield i.next(),I=g.done,!I;e=!0){a=g.value,e=!1;const s=a;if(!this.codec||this.codec===s.codec)yield this.setPublishingLayers(rB(s.codec),s.qualities);else{const B=this.simulcastCodecs.get(s.codec);if(this.log.debug("try setPublishingCodec for ".concat(s.codec),Object.assign(Object.assign({},this.logContext),{simulcastCodecInfo:B})),!B||!B.sender){for(const c of s.qualities)if(c.enabled){r.push(s.codec);break}}else B.encodings&&(this.log.debug("try setPublishingLayersForSender ".concat(s.codec),this.logContext),yield CZ(B.sender,B.encodings,s.qualities,this.senderLock,rB(s.codec),this.log,this.logContext))}}}catch(s){n={error:s}}finally{try{!e&&!I&&(o=i.return)&&(yield o.call(i))}finally{if(n)throw n.error}}return r})}setPublishingLayers(A,e){return vA(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:e}));return}this.log.debug("setting publishing layers",Object.assign(Object.assign({},this.logContext),{qualities:e})),!(!this.sender||!this.encodings)&&(yield CZ(this.sender,this.encodings,e,this.senderLock,A,this.log,this.logContext))})}prioritizePerformance(){return vA(this,void 0,void 0,function*(){if(!this.sender)throw new Error("sender not found");const A=yield this.senderLock.lock();try{this.optimizeForPerformance=!0;const e=this.sender.getParameters();e.encodings=e.encodings.map((i,g)=>{var I;return Object.assign(Object.assign({},i),{active:g===0,scaleResolutionDownBy:Math.max(1,Math.ceil(((I=this.mediaStreamTrack.getSettings().height)!==null&&I!==void 0?I:360)/360)),scalabilityMode:g===0&&rB(this.codec)?"L1T3":void 0,maxFramerate:g===0?15:0,maxBitrate:g===0?i.maxBitrate:0})}),this.log.debug("setting performance optimised encodings",Object.assign(Object.assign({},this.logContext),{encodings:e.encodings})),this.encodings=e.encodings,yield this.sender.setParameters(e)}catch(e){this.log.error("failed to set performance optimised encodings",Object.assign(Object.assign({},this.logContext),{error:e})),this.optimizeForPerformance=!1}finally{A()}})}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return vA(this,void 0,void 0,function*(){yield A.handleAppVisibilityChanged.call(this),JtA()&&this.isInBackground&&this.source===Pe.Source.Camera&&(this._mediaStreamTrack.enabled=!1)})}}function CZ(t,A,e,i,g,I,n){return vA(this,void 0,void 0,function*(){const o=yield i.lock();I.debug("setPublishingLayersForSender",Object.assign(Object.assign({},n),{sender:t,qualities:e,senderEncodings:A}));try{const a=t.getParameters(),{encodings:r}=a;if(!r)return;if(r.length!==A.length){I.warn("cannot set publishing layers, encodings mismatch",Object.assign(Object.assign({},n),{encodings:r,senderEncodings:A}));return}let s=!1;!1&&r[0].scalabilityMode||(g&&e.some(E=>E.enabled)&&e.forEach(E=>E.enabled=!0),r.forEach((c,E)=>{var D;let y=(D=c.rid)!==null&&D!==void 0?D:"";y===""&&(y="q");const S=ZtA(y),f=e.find(M=>M.quality===S);f&&c.active!==f.enabled&&(s=!0,c.active=f.enabled,I.debug("setting layer ".concat(f.quality," to ").concat(c.active?"enabled":"disabled"),n),kd()&&(f.enabled?(c.scaleResolutionDownBy=A[E].scaleResolutionDownBy,c.maxBitrate=A[E].maxBitrate,c.maxFrameRate=A[E].maxFrameRate):(c.scaleResolutionDownBy=4,c.maxBitrate=10,c.maxFrameRate=2)))})),s&&(a.encodings=r,I.debug("setting encodings",Object.assign(Object.assign({},n),{encodings:a.encodings})),yield t.setParameters(a))}finally{o()}})}function ZtA(t){switch(t){case"f":return ss.HIGH;case"h":return ss.MEDIUM;case"q":return ss.LOW;default:return ss.HIGH}}function BZ(t,A,e,i){if(!e)return[new TE({quality:ss.HIGH,width:t,height:A,bitrate:0,ssrc:0})];if(i){const g=e[0].scalabilityMode,I=new jtA(g),n=[],o=I.suffix=="h"?1.5:2,a=I.suffix=="h"?2:3;for(let r=0;r<I.spatial;r+=1)n.push(new TE({quality:Math.min(ss.HIGH,I.spatial-1)-r,width:Math.ceil(t/Math.pow(o,r)),height:Math.ceil(A/Math.pow(o,r)),bitrate:e[0].maxBitrate?Math.ceil(e[0].maxBitrate/Math.pow(a,r)):0,ssrc:0}));return n}return e.map(g=>{var I,n,o;const a=(I=g.scaleResolutionDownBy)!==null&&I!==void 0?I:1;let r=ZtA((n=g.rid)!==null&&n!==void 0?n:"");return new TE({quality:r,width:Math.ceil(t/a),height:Math.ceil(A/a),bitrate:(o=g.maxBitrate)!==null&&o!==void 0?o:0,ssrc:0})})}const cZ="_lossy",lZ="_reliable",jUA=2*1e3,eL="leave-reconnect",ZUA=3e4,WUA=8*1024,zUA=256*1024;var Hs;(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"})(Hs||(Hs={}));class VUA extends zc.EventEmitter{get isClosed(){return this._isClosed}get pendingReconnect(){return!!this.reconnectTimeout}constructor(A){var e;super(),this.options=A,this.rtcConfig={},this.peerConnectionTimeout=gO.peerConnectionTimeout,this.fullReconnectOnNext=!1,this.latestRemoteOfferId=0,this.subscriberPrimary=!1,this.pcState=Hs.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=Ji,this.reliableDataSequence=1,this.reliableMessageBuffer=new AZ,this.reliableReceivedState=new uUA(ZUA),this.lossyDataStatCurrentBytes=0,this.lossyDataStatByterate=0,this.lossyDataDropCount=0,this.midToTrackId={},this.isWaitingForNetworkReconnect=!1,this.handleDataChannel=i=>vA(this,[i],void 0,function(g){var I=this;let{channel:n}=g;return function*(){if(n){if(n.label===lZ)I.reliableDCSub=n;else if(n.label===cZ)I.lossyDCSub=n;else return;I.log.debug("on data channel ".concat(n.id,", ").concat(n.label),I.logContext),n.onmessage=I.handleDataMessage}}()}),this.handleDataMessage=i=>vA(this,void 0,void 0,function*(){var g,I,n,o,a;const r=yield this.dataProcessLock.lock();try{let s;if(i.data instanceof ArrayBuffer)s=i.data;else if(i.data instanceof Blob)s=yield i.data.arrayBuffer();else{this.log.error("unsupported data type",Object.assign(Object.assign({},this.logContext),{data:i.data}));return}const B=Wa.fromBinary(new Uint8Array(s));if(B.sequence>0&&B.participantSid!==""){const c=this.reliableReceivedState.get(B.participantSid);if(c&&B.sequence<=c)return;this.reliableReceivedState.set(B.participantSid,B.sequence)}if(((g=B.value)===null||g===void 0?void 0:g.case)==="speaker")this.emit(ut.ActiveSpeakersUpdate,B.value.value.speakers);else if(((I=B.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 c=yield(n=this.e2eeManager)===null||n===void 0?void 0:n.handleEncryptedData(B.value.value.encryptedValue,B.value.value.iv,B.participantIdentity,B.value.value.keyIndex),E=FeA.fromBinary(c.payload),D=new Wa({value:E.value,participantIdentity:B.participantIdentity,participantSid:B.participantSid});((o=D.value)===null||o===void 0?void 0:o.case)==="user"&&QZ(D,D.value.value),this.emit(ut.DataPacketReceived,D,B.value.value.encryptionType)}else((a=B.value)===null||a===void 0?void 0:a.case)==="user"&&QZ(B,B.value.value),this.emit(ut.DataPacketReceived,B,On.NONE)}finally{r()}}),this.handleDataError=i=>{const I=i.currentTarget.maxRetransmits===0?"lossy":"reliable";if(i instanceof ErrorEvent&&i.error){const{error:n}=i.error;this.log.error("DataChannel error on ".concat(I,": ").concat(i.message),Object.assign(Object.assign({},this.logContext),{error:n}))}else this.log.error("Unknown DataChannel error on ".concat(I),Object.assign(Object.assign({},this.logContext),{event:i}))},this.handleBufferedAmountLow=i=>{const I=i.currentTarget.maxRetransmits===0?Wi.LOSSY:Wi.RELIABLE;this.updateAndEmitDCBufferStatus(I)},this.handleDisconnect=(i,g)=>{if(this._isClosed)return;this.log.warn("".concat(i," disconnected"),this.logContext),this.reconnectAttempts===0&&(this.reconnectStart=Date.now());const I=a=>{this.log.warn("could not recover connection after ".concat(this.reconnectAttempts," attempts, ").concat(a,"ms. giving up"),this.logContext),this.emit(ut.Disconnected),this.close()},n=Date.now()-this.reconnectStart;let o=this.getNextRetryDelay({elapsedMs:n,retryCount:this.reconnectAttempts});if(o===null){I(n);return}i===eL&&(o=0),this.log.debug("reconnecting in ".concat(o,"ms"),this.logContext),this.clearReconnectTimeout(),this.token&&this.regionUrlProvider&&this.regionUrlProvider.updateToken(this.token),this.reconnectTimeout=Ho.setTimeout(()=>this.attemptReconnect(g).finally(()=>this.reconnectTimeout=void 0),o)},this.waitForRestarted=()=>new Promise((i,g)=>{this.pcState===Hs.Connected&&i();const I=()=>{this.off(ut.Disconnected,n),i()},n=()=>{this.off(ut.Restarted,I),g()};this.once(ut.Restarted,I),this.once(ut.Disconnected,n)}),this.updateAndEmitDCBufferStatus=i=>{if(i===Wi.RELIABLE){const I=this.dataChannelForKind(i);I&&this.reliableMessageBuffer.alignBufferedAmount(I.bufferedAmount)}const g=this.isBufferStatusLow(i);typeof g<"u"&&g!==this.dcBufferStatus.get(i)&&(this.dcBufferStatus.set(i,g),this.emit(ut.DCBufferStatusChanged,g,i))},this.isBufferStatusLow=i=>{const g=this.dataChannelForKind(i);if(g)return g.bufferedAmount<=g.bufferedAmountLowThreshold},this.handleBrowserOnLine=()=>vA(this,void 0,void 0,function*(){!this.url||!(yield fetch(m0(this.url),{method:"HEAD"}).then(g=>g.ok).catch(()=>!1))||(this.log.info("detected network reconnected"),(this.client.currentState===sI.RECONNECTING||this.isWaitingForNetworkReconnect&&this.client.currentState===sI.CONNECTED)&&(this.clearReconnectTimeout(),this.attemptReconnect(_h.RR_SIGNAL_DISCONNECTED),this.isWaitingForNetworkReconnect=!1))}),this.handleBrowserOffline=()=>vA(this,void 0,void 0,function*(){if(this.url)try{yield Promise.race([fetch(m0(this.url),{method:"HEAD"}),Oo(4e3).then(()=>Promise.reject())])}catch{window.navigator.onLine===!1&&(this.log.info("detected network interruption"),this.isWaitingForNetworkReconnect=!0)}}),this.log=uQ((e=A.loggerName)!==null&&e!==void 0?e:yB.Engine),this.loggerOptions={loggerName:A.loggerName,loggerContextCb:()=>this.logContext},this.client=new AO(void 0,this.loggerOptions),this.client.signalLatency=this.options.expSignalLatency,this.reconnectPolicy=this.options.reconnectPolicy,this.closingLock=new gr,this.dataProcessLock=new gr,this.dcBufferStatus=new Map([[Wi.LOSSY,!0],[Wi.RELIABLE,!0]]),this.client.onParticipantUpdate=i=>this.emit(ut.ParticipantUpdate,i),this.client.onConnectionQuality=i=>this.emit(ut.ConnectionQualityUpdate,i),this.client.onRoomUpdate=i=>this.emit(ut.RoomUpdate,i),this.client.onSubscriptionError=i=>this.emit(ut.SubscriptionError,i),this.client.onSubscriptionPermissionUpdate=i=>this.emit(ut.SubscriptionPermissionUpdate,i),this.client.onSpeakersChanged=i=>this.emit(ut.SpeakersChanged,i),this.client.onStreamStateUpdate=i=>this.emit(ut.StreamStateChanged,i),this.client.onRequestResponse=i=>this.emit(ut.SignalRequestResponse,i)}get logContext(){var A,e,i,g,I,n;return{room:(e=(A=this.latestJoinResponse)===null||A===void 0?void 0:A.room)===null||e===void 0?void 0:e.name,roomID:(g=(i=this.latestJoinResponse)===null||i===void 0?void 0:i.room)===null||g===void 0?void 0:g.sid,participant:(n=(I=this.latestJoinResponse)===null||I===void 0?void 0:I.participant)===null||n===void 0?void 0:n.identity,pID:this.participantSid}}join(A,e,i,g){return vA(this,arguments,void 0,function(I,n,o,a){var r=this;let s=arguments.length>4&&arguments[4]!==void 0?arguments[4]:!1;return function*(){r.url=I,r.token=n,r.signalOpts=o,r.maxJoinAttempts=o.maxRetries;try{r.joinAttempts+=1,r.setupSignalClientCallbacks();const B=yield r.client.join(I,n,o,a,s);return r._isClosed=!1,r.latestJoinResponse=B,r.subscriberPrimary=B.subscriberPrimary,r.pcManager||(yield r.configure(B,!s)),(!r.subscriberPrimary||B.fastPublish)&&r.negotiate().catch(c=>{Ji.error(c,r.logContext)}),r.registerOnLineListener(),r.clientConfiguration=B.clientConfiguration,r.emit(ut.SignalConnected,B),B}catch(B){if(B instanceof Ii){if(B.reason===BI.ServerUnreachable){if(r.log.warn("Couldn't connect to server, attempt ".concat(r.joinAttempts," of ").concat(r.maxJoinAttempts),r.logContext),r.joinAttempts<r.maxJoinAttempts)return r.join(I,n,o,a,s)}else if(B.reason===BI.ServiceNotFound)return r.log.warn("Initial connection failed: ".concat(B.message," – Retrying")),r.join(I,n,o,a,!0)}throw B}}()})}close(){return vA(this,void 0,void 0,function*(){const A=yield this.closingLock.lock();if(this.isClosed){A();return}try{this._isClosed=!0,this.joinAttempts=0,this.emit(ut.Closing),this.removeAllListeners(),this.deregisterOnLineListener(),this.clearPendingReconnect(),this.cleanupLossyDataStats(),yield this.cleanupPeerConnections(),yield this.cleanupClient()}finally{A()}})}cleanupPeerConnections(){return vA(this,void 0,void 0,function*(){var A;yield(A=this.pcManager)===null||A===void 0?void 0:A.close(),this.pcManager=void 0;const e=i=>{i&&(i.close(),i.onbufferedamountlow=null,i.onclose=null,i.onclosing=null,i.onerror=null,i.onmessage=null,i.onopen=null)};e(this.lossyDC),e(this.lossyDCSub),e(this.reliableDC),e(this.reliableDCSub),this.lossyDC=void 0,this.lossyDCSub=void 0,this.reliableDC=void 0,this.reliableDCSub=void 0,this.reliableMessageBuffer=new AZ,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 vA(this,void 0,void 0,function*(){yield this.client.close(),this.client.resetCallbacks()})}addTrack(A){if(this.pendingTrackResolvers[A.cid])throw new Wl("a track with the same ID has already been published");return new Promise((e,i)=>{const g=setTimeout(()=>{delete this.pendingTrackResolvers[A.cid],i(Ii.timeout("publication of local track timed out, no response from server"))},1e4);this.pendingTrackResolvers[A.cid]={resolve:I=>{clearTimeout(g),e(I)},reject:()=>{clearTimeout(g),i(new Error("Cancelled publication by calling unpublish"))}},this.client.sendAddTrack(A)})}removeTrack(A){if(A.track&&this.pendingTrackResolvers[A.track.id]){const{reject:e}=this.pendingTrackResolvers[A.track.id];e&&e(),delete this.pendingTrackResolvers[A.track.id]}try{return this.pcManager.removeTrack(A),!0}catch(e){this.log.warn("failed to remove track",Object.assign(Object.assign({},this.logContext),{error:e}))}return!1}updateMuteStatus(A,e){this.client.sendMuteTrack(A,e)}get dataSubscriberReadyState(){var A;return(A=this.reliableDCSub)===null||A===void 0?void 0:A.readyState}getConnectedServerAddress(){return vA(this,void 0,void 0,function*(){var A;return(A=this.pcManager)===null||A===void 0?void 0:A.getConnectedAddress()})}setRegionUrlProvider(A){this.regionUrlProvider=A}configure(A,e){return vA(this,void 0,void 0,function*(){var i,g;if(this.pcManager&&this.pcManager.currentState!==VI.NEW)return;this.participantSid=(i=A.participant)===null||i===void 0?void 0:i.sid;const I=this.makeRTCConfiguration(A);this.pcManager=new mUA(I,e?"publisher-only":A.subscriberPrimary?"subscriber-primary":"publisher-primary",this.loggerOptions),this.emit(ut.TransportsCreated,this.pcManager.publisher,this.pcManager.subscriber),this.pcManager.onIceCandidate=(n,o)=>{this.client.sendIceCandidate(n,o)},this.pcManager.onPublisherOffer=(n,o)=>{this.client.sendOffer(n,o)},this.pcManager.onDataChannel=this.handleDataChannel,this.pcManager.onStateChange=(n,o,a)=>vA(this,void 0,void 0,function*(){if(this.log.debug("primary PC state changed ".concat(n),this.logContext),["closed","disconnected","failed"].includes(o)&&(this.publisherConnectionPromise=void 0),n===VI.CONNECTED){const B=this.pcState===Hs.New;this.pcState=Hs.Connected,B&&this.emit(ut.Connected,A)}else n===VI.FAILED&&(this.pcState===Hs.Connected||this.pcState===Hs.Reconnecting)&&(this.pcState=Hs.Disconnected,this.handleDisconnect("peerconnection failed",a==="failed"?_h.RR_SUBSCRIBER_FAILED:_h.RR_PUBLISHER_FAILED));const r=this.client.isDisconnected||this.client.currentState===sI.RECONNECTING,s=[VI.FAILED,VI.CLOSING,VI.CLOSED].includes(n);r&&s&&!this._isClosed&&this.emit(ut.Offline)}),this.pcManager.onTrack=n=>{n.streams.length!==0&&this.emit(ut.MediaTrackAdded,n.track,n.streams[0],n.receiver)},XUA((g=A.serverInfo)===null||g===void 0?void 0:g.protocol)||this.createDataChannels()})}setupSignalClientCallbacks(){this.client.onAnswer=(A,e,i)=>vA(this,void 0,void 0,function*(){this.pcManager&&(this.log.debug("received server answer",Object.assign(Object.assign({},this.logContext),{RTCSdpType:A.type,sdp:A.sdp,midToTrackId:i})),this.midToTrackId=i,yield this.pcManager.setPublisherAnswer(A,e))}),this.client.onTrickle=(A,e)=>{this.pcManager&&(this.log.debug("got ICE candidate from peer",Object.assign(Object.assign({},this.logContext),{candidate:A,target:e})),this.pcManager.addIceCandidate(A,e))},this.client.onOffer=(A,e,i)=>vA(this,void 0,void 0,function*(){if(this.latestRemoteOfferId=e,!this.pcManager)return;this.midToTrackId=i;const g=yield this.pcManager.createSubscriberAnswerFromOffer(A,e);g&&this.client.sendAnswer(g,e)}),this.client.onLocalTrackPublished=A=>{var e;if(this.log.debug("received trackPublishedResponse",Object.assign(Object.assign({},this.logContext),{cid:A.cid,track:(e=A.track)===null||e===void 0?void 0:e.sid})),!this.pendingTrackResolvers[A.cid]){this.log.error("missing track resolver for ".concat(A.cid),Object.assign(Object.assign({},this.logContext),{cid:A.cid}));return}const{resolve:i}=this.pendingTrackResolvers[A.cid];delete this.pendingTrackResolvers[A.cid],i(A.track)},this.client.onLocalTrackUnpublished=A=>{this.emit(ut.LocalTrackUnpublished,A)},this.client.onLocalTrackSubscribed=A=>{this.emit(ut.LocalTrackSubscribed,A)},this.client.onTokenRefresh=A=>{var e;this.token=A,(e=this.regionUrlProvider)===null||e===void 0||e.updateToken(A)},this.client.onRemoteMuteChanged=(A,e)=>{this.emit(ut.RemoteMute,A,e)},this.client.onSubscribedQualityUpdate=A=>{this.emit(ut.SubscribedQualityUpdate,A)},this.client.onRoomMoved=A=>{var e;this.participantSid=(e=A.participant)===null||e===void 0?void 0:e.sid,this.latestJoinResponse&&(this.latestJoinResponse.room=A.room),this.emit(ut.RoomMoved,A)},this.client.onMediaSectionsRequirement=A=>{var e,i;const g={direction:"recvonly"};for(let I=0;I<A.numAudios;I++)(e=this.pcManager)===null||e===void 0||e.addPublisherTransceiverOfKind("audio",g);for(let I=0;I<A.numVideos;I++)(i=this.pcManager)===null||i===void 0||i.addPublisherTransceiverOfKind("video",g);this.negotiate()},this.client.onClose=()=>{this.handleDisconnect("signal",_h.RR_SIGNAL_DISCONNECTED)},this.client.onLeave=A=>{switch(this.log.debug("client leave request",Object.assign(Object.assign({},this.logContext),{reason:A?.reason})),A.regions&&this.regionUrlProvider&&(this.log.debug("updating regions",this.logContext),this.regionUrlProvider.setServerReportedRegions({updatedAtInMs:Date.now(),maxAgeInMs:HtA,regionSettings:A.regions})),A.action){case MD.DISCONNECT:this.emit(ut.Disconnected,A?.reason),this.close();break;case MD.RECONNECT:this.fullReconnectOnNext=!0,this.handleDisconnect(eL);break;case MD.RESUME:this.handleDisconnect(eL)}}}makeRTCConfiguration(A){var e;const i=Object.assign({},this.rtcConfig);if(!((e=this.signalOpts)===null||e===void 0)&&e.e2eeEnabled&&(this.log.debug("E2EE - setting up transports with insertable streams",this.logContext),i.encodedInsertableStreams=!0),A.iceServers&&!i.iceServers){const g=[];A.iceServers.forEach(I=>{const n={urls:I.urls};I.username&&(n.username=I.username),I.credential&&(n.credential=I.credential),g.push(n)}),i.iceServers=g}return A.clientConfiguration&&A.clientConfiguration.forceRelay===D0.ENABLED&&(i.iceTransportPolicy="relay"),i.sdpSemantics="unified-plan",i.continualGatheringPolicy="gather_continually",i}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(cZ,{ordered:!1,maxRetransmits:0}),this.reliableDC=this.pcManager.createPublisherDataChannel(lZ,{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 A=this.dataChannelForKind(Wi.LOSSY);if(A){const e=this.lossyDataStatByterate/10;A.bufferedAmountLowThreshold=Math.min(Math.max(e,WUA),zUA)}},1e3))}createSender(A,e,i){return vA(this,void 0,void 0,function*(){if(JT())return yield this.createTransceiverRTCRtpSender(A,e,i);if(LT())return this.log.warn("using add-track fallback",this.logContext),yield this.createRTCRtpSender(A.mediaStreamTrack);throw new rn("Required webRTC APIs not supported on this device")})}createSimulcastSender(A,e,i,g){return vA(this,void 0,void 0,function*(){if(JT())return this.createSimulcastTransceiverSender(A,e,i,g);if(LT())return this.log.debug("using add-track fallback",this.logContext),this.createRTCRtpSender(A.mediaStreamTrack);throw new rn("Cannot stream on this device")})}createTransceiverRTCRtpSender(A,e,i){return vA(this,void 0,void 0,function*(){if(!this.pcManager)throw new rn("publisher is closed");const g=[];A.mediaStream&&g.push(A.mediaStream),Du(A)&&(A.codec=e.videoCodec);const I={direction:"sendonly",streams:g};return i&&(I.sendEncodings=i),(yield this.pcManager.addPublisherTransceiver(A.mediaStreamTrack,I)).sender})}createSimulcastTransceiverSender(A,e,i,g){return vA(this,void 0,void 0,function*(){if(!this.pcManager)throw new rn("publisher is closed");const I={direction:"sendonly"};g&&(I.sendEncodings=g);const n=yield this.pcManager.addPublisherTransceiver(e.mediaStreamTrack,I);if(i.videoCodec)return A.setSimulcastTrackSender(i.videoCodec,n.sender),n.sender})}createRTCRtpSender(A){return vA(this,void 0,void 0,function*(){if(!this.pcManager)throw new rn("publisher is closed");return this.pcManager.addPublisherTrack(A)})}attemptReconnect(A){return vA(this,void 0,void 0,function*(){var e,i,g;if(!this._isClosed){if(this.attemptingReconnect){Ji.warn("already attempting reconnect, returning early",this.logContext);return}(((e=this.clientConfiguration)===null||e===void 0?void 0:e.resumeConnection)===D0.DISABLED||((g=(i=this.pcManager)===null||i===void 0?void 0:i.currentState)!==null&&g!==void 0?g:VI.NEW)===VI.NEW)&&(this.fullReconnectOnNext=!0);try{this.attemptingReconnect=!0,this.fullReconnectOnNext?yield this.restartConnection():yield this.resumeConnection(A),this.clearPendingReconnect(),this.fullReconnectOnNext=!1}catch(I){this.reconnectAttempts+=1;let n=!0;I instanceof rn?(this.log.debug("received unrecoverable error",Object.assign(Object.assign({},this.logContext),{error:I})),n=!1):I instanceof ff||(this.fullReconnectOnNext=!0),n?this.handleDisconnect("reconnect",_h.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(ut.Disconnected),yield this.close())}finally{this.attemptingReconnect=!1}}})}getNextRetryDelay(A){try{return this.reconnectPolicy.nextRetryDelayInMs(A)}catch(e){this.log.warn("encountered error in reconnect policy",Object.assign(Object.assign({},this.logContext),{error:e}))}return null}restartConnection(A){return vA(this,void 0,void 0,function*(){var e,i,g;try{if(!this.url||!this.token)throw new rn("could not reconnect, url or token not saved");this.log.info("reconnecting, attempt: ".concat(this.reconnectAttempts),this.logContext),this.emit(ut.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 ff;I=yield this.join(A??this.url,this.token,this.signalOpts,void 0,!this.options.singlePeerConnection)}catch(n){throw n instanceof Ii&&n.reason===BI.NotAllowed?new rn("could not reconnect, token might be expired"):new ff}if(this.shouldFailNext)throw this.shouldFailNext=!1,new Error("simulated failure");if(this.client.setReconnected(),this.emit(ut.SignalRestarted,I),yield this.waitForPCReconnected(),this.client.currentState!==sI.CONNECTED)throw new ff("Signal connection got severed during reconnect");(e=this.regionUrlProvider)===null||e===void 0||e.resetAttempts(),this.emit(ut.Restarted)}catch(I){const n=yield(i=this.regionUrlProvider)===null||i===void 0?void 0:i.getNextBestRegionUrl();if(n){yield this.restartConnection(n);return}else throw(g=this.regionUrlProvider)===null||g===void 0||g.resetAttempts(),I}})}resumeConnection(A){return vA(this,void 0,void 0,function*(){var e;if(!this.url||!this.token)throw new rn("could not reconnect, url or token not saved");if(!this.pcManager)throw new rn("publisher and subscriber connections unset");this.log.info("resuming signal connection, attempt ".concat(this.reconnectAttempts),this.logContext),this.emit(ut.Resuming);let i;try{this.setupSignalClientCallbacks(),i=yield this.client.reconnect(this.url,this.token,this.participantSid,A)}catch(g){let I="";throw g instanceof Error&&(I=g.message,this.log.error(g.message,Object.assign(Object.assign({},this.logContext),{error:g}))),g instanceof Ii&&g.reason===BI.NotAllowed?new rn("could not reconnect, token might be expired"):g instanceof Ii&&g.reason===BI.LeaveRequest?g:new ff(I)}if(this.emit(ut.SignalResumed),i){const g=this.makeRTCConfiguration(i);this.pcManager.updateConfiguration(g),this.latestJoinResponse&&(this.latestJoinResponse.serverInfo=i.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!==sI.CONNECTED)throw new ff("Signal connection got severed during reconnect");this.client.setReconnected(),((e=this.reliableDC)===null||e===void 0?void 0:e.readyState)==="open"&&this.reliableDC.id===null&&this.createDataChannels(),i?.lastMessageSeq&&this.resendReliableMessagesForResume(i.lastMessageSeq),this.emit(ut.Resumed)})}waitForPCInitialConnection(A,e){return vA(this,void 0,void 0,function*(){if(!this.pcManager)throw new rn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(e,A)})}waitForPCReconnected(){return vA(this,void 0,void 0,function*(){this.pcState=Hs.Reconnecting,this.log.debug("waiting for peer connection to reconnect",this.logContext);try{if(yield Oo(jUA),!this.pcManager)throw new rn("PC manager is closed");yield this.pcManager.ensurePCTransportConnection(void 0,this.peerConnectionTimeout),this.pcState=Hs.Connected}catch(A){throw this.pcState=Hs.Disconnected,Ii.internal("could not establish PC connection, ".concat(A.message))}})}publishRpcResponse(A,e,i,g){return vA(this,void 0,void 0,function*(){const I=new Wa({destinationIdentities:[A],kind:Wi.RELIABLE,value:{case:"rpcResponse",value:new YH({requestId:e,value:g?{case:"error",value:g.toProto()}:{case:"payload",value:i??""}})}});yield this.sendDataPacket(I,Wi.RELIABLE)})}publishRpcAck(A,e){return vA(this,void 0,void 0,function*(){const i=new Wa({destinationIdentities:[A],kind:Wi.RELIABLE,value:{case:"rpcAck",value:new TH({requestId:e})}});yield this.sendDataPacket(i,Wi.RELIABLE)})}sendDataPacket(A,e){return vA(this,void 0,void 0,function*(){if(yield this.ensurePublisherConnected(e),this.e2eeManager&&this.e2eeManager.isDataChannelEncryptionEnabled){const I=nUA(A);if(I){const n=yield this.e2eeManager.encryptData(I.toBinary());A.value={case:"encryptedPacket",value:new KeA({encryptedValue:n.payload,iv:n.iv,keyIndex:n.keyIndex})}}}e===Wi.RELIABLE&&(A.sequence=this.reliableDataSequence,this.reliableDataSequence+=1);const i=A.toBinary(),g=this.dataChannelForKind(e);if(g){if(e===Wi.RELIABLE)yield this.waitForBufferStatusLow(e),this.reliableMessageBuffer.push({data:i,sequence:A.sequence});else{if(!this.isBufferStatusLow(e)){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+=i.byteLength}if(this.attemptingReconnect)return;g.send(i)}this.updateAndEmitDCBufferStatus(e)})}resendReliableMessagesForResume(A){return vA(this,void 0,void 0,function*(){yield this.ensurePublisherConnected(Wi.RELIABLE);const e=this.dataChannelForKind(Wi.RELIABLE);e&&(this.reliableMessageBuffer.popToSequence(A),this.reliableMessageBuffer.getAll().forEach(i=>{e.send(i.data)})),this.updateAndEmitDCBufferStatus(Wi.RELIABLE)})}waitForBufferStatusLow(A){return new Nr((e,i)=>vA(this,void 0,void 0,function*(){if(this.isBufferStatusLow(A))e();else{const g=()=>i(new rn("engine closed"));for(this.once(ut.Closing,g);!this.dcBufferStatus.get(A);)yield Oo(10);this.off(ut.Closing,g),e()}}))}ensureDataTransportConnected(A){return vA(this,arguments,void 0,function(e){var i=this;let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:this.subscriberPrimary;return function*(){var I;if(!i.pcManager)throw new rn("PC manager is closed");const n=g?i.pcManager.subscriber:i.pcManager.publisher,o=g?"Subscriber":"Publisher";if(!n)throw Ii.internal("".concat(o," connection not set"));let a=!1;!g&&!i.dataChannelForKind(e,g)&&(i.createDataChannels(),a=!0),!a&&!g&&!i.pcManager.publisher.isICEConnected&&i.pcManager.publisher.getICEConnectionState()!=="checking"&&(a=!0),a&&i.negotiate().catch(B=>{Ji.error(B,i.logContext)});const r=i.dataChannelForKind(e,g);if(r?.readyState==="open")return;const s=new Date().getTime()+i.peerConnectionTimeout;for(;new Date().getTime()<s;){if(n.isICEConnected&&((I=i.dataChannelForKind(e,g))===null||I===void 0?void 0:I.readyState)==="open")return;yield Oo(50)}throw Ii.internal("could not establish ".concat(o," connection, state: ").concat(n.getICEConnectionState()))}()})}ensurePublisherConnected(A){return vA(this,void 0,void 0,function*(){this.publisherConnectionPromise||(this.publisherConnectionPromise=this.ensureDataTransportConnected(A,!1)),yield this.publisherConnectionPromise})}verifyTransport(){return!(!this.pcManager||this.pcManager.currentState!==VI.CONNECTED||!this.client.ws||this.client.ws.readyState===WebSocket.CLOSED)}negotiate(){return vA(this,void 0,void 0,function*(){return new Nr((A,e)=>vA(this,void 0,void 0,function*(){if(!this.pcManager){e(new GD("PC manager is closed"));return}this.pcManager.requirePublisher(),this.pcManager.publisher.getTransceivers().length==0&&!this.lossyDC&&!this.reliableDC&&this.createDataChannels();const i=new AbortController,g=()=>{i.abort(),this.log.debug("engine disconnected while negotiation was ongoing",this.logContext),A()};this.isClosed&&e(new GD("cannot negotiate on closed engine")),this.on(ut.Closing,g),this.pcManager.publisher.once(FD.RTPVideoPayloadTypes,I=>{const n=new Map;I.forEach(o=>{const a=o.codec.toLowerCase();YRA(a)&&n.set(o.payload,a)}),this.emit(ut.RTPVideoMapUpdate,n)});try{yield this.pcManager.negotiate(i),A()}catch(I){I instanceof GD&&(this.fullReconnectOnNext=!0),this.handleDisconnect("negotiation",_h.RR_UNKNOWN),I instanceof Error?e(I):e(new Error(String(I)))}finally{this.off(ut.Closing,g)}}))})}dataChannelForKind(A,e){if(e){if(A===Wi.LOSSY)return this.lossyDCSub;if(A===Wi.RELIABLE)return this.reliableDCSub}else{if(A===Wi.LOSSY)return this.lossyDC;if(A===Wi.RELIABLE)return this.reliableDC}}sendSyncState(A,e){var i,g,I,n;if(!this.pcManager){this.log.warn("sync state cannot be sent without peer connection setup",this.logContext);return}const o=this.pcManager.publisher.getLocalDescription(),a=this.pcManager.publisher.getRemoteDescription(),r=(i=this.pcManager.subscriber)===null||i===void 0?void 0:i.getRemoteDescription(),s=(g=this.pcManager.subscriber)===null||g===void 0?void 0:g.getLocalDescription(),B=(n=(I=this.signalOpts)===null||I===void 0?void 0:I.autoSubscribe)!==null&&n!==void 0?n:!0,c=new Array,E=new Array;A.forEach(D=>{D.isDesired!==B&&c.push(D.trackSid),D.isEnabled||E.push(D.trackSid)}),this.client.sendSyncState(new ZH({answer:this.pcManager.mode==="publisher-only"?a?rD({sdp:a.sdp,type:a.type}):void 0:s?rD({sdp:s.sdp,type:s.type}):void 0,offer:this.pcManager.mode==="publisher-only"?o?rD({sdp:o.sdp,type:o.type}):void 0:r?rD({sdp:r.sdp,type:r.type}):void 0,subscription:new eb({trackSids:c,subscribe:!B,participantTracks:[]}),publishTracks:mRA(e),dataChannels:this.dataChannelsInfo(),trackSidsDisabled:E,datachannelReceiveStates:this.reliableReceivedState.map((D,y)=>new $eA({publisherSid:y,lastSeq:D}))}))}failNext(){this.shouldFailNext=!0}dataChannelsInfo(){const A=[],e=(i,g)=>{i?.id!==void 0&&i.id!==null&&A.push(new AtA({label:i.label,id:i.id,target:g}))};return e(this.dataChannelForKind(Wi.LOSSY),aB.PUBLISHER),e(this.dataChannelForKind(Wi.RELIABLE),aB.PUBLISHER),e(this.dataChannelForKind(Wi.LOSSY,!0),aB.SUBSCRIBER),e(this.dataChannelForKind(Wi.RELIABLE,!0),aB.SUBSCRIBER),A}clearReconnectTimeout(){this.reconnectTimeout&&Ho.clearTimeout(this.reconnectTimeout)}clearPendingReconnect(){this.clearReconnectTimeout(),this.reconnectAttempts=0}registerOnLineListener(){Gr()&&(window.addEventListener("online",this.handleBrowserOnLine),window.addEventListener("offline",this.handleBrowserOffline))}deregisterOnLineListener(){Gr()&&(window.removeEventListener("online",this.handleBrowserOnLine),window.removeEventListener("offline",this.handleBrowserOffline))}getTrackIdForReceiver(A){var e;const i=(e=this.pcManager)===null||e===void 0?void 0:e.getMidForReceiver(A);if(i){const g=Object.entries(this.midToTrackId).find(I=>{let[n]=I;return n===i});if(g)return g[1]}}}function XUA(t){return t!==void 0&&t>13}function QZ(t,A){const e=t.participantIdentity?t.participantIdentity:A.participantIdentity;t.participantIdentity=e,A.participantIdentity=e;const i=t.destinationIdentities.length!==0?t.destinationIdentities:A.destinationIdentities;t.destinationIdentities=i,A.destinationIdentities=i}class WtA{get info(){return this._info}validateBytesReceived(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!1;if(!(typeof this.totalByteSize!="number"||this.totalByteSize===0)){if(A&&this.bytesReceived<this.totalByteSize)throw new Zs("Not enough chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, only received ").concat(this.bytesReceived," bytes"),ja.Incomplete);if(this.bytesReceived>this.totalByteSize)throw new Zs("Extra chunk(s) received - expected ".concat(this.totalByteSize," bytes of data total, received ").concat(this.bytesReceived," bytes"),ja.LengthExceeded)}}constructor(A,e,i,g){this.reader=e,this.totalByteSize=i,this._info=A,this.bytesReceived=0,this.outOfBandFailureRejectingFuture=g}}class $UA extends WtA{handleChunkReceived(A){var e;this.bytesReceived+=A.content.byteLength,this.validateBytesReceived();const i=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(e=this.onProgress)===null||e===void 0||e.call(this,i)}[Symbol.asyncIterator](){const A=this.reader.getReader();let e=new nC,i=null,g=null;if(this.signal){const n=this.signal;g=()=>{var o;(o=e.reject)===null||o===void 0||o.call(e,n.reason)},n.addEventListener("abort",g),i=n}const I=()=>{A.releaseLock(),i&&g&&i.removeEventListener("abort",g),this.signal=void 0};return{next:()=>vA(this,void 0,void 0,function*(){var n,o;try{const{done:a,value:r}=yield Promise.race([A.read(),e.promise,(o=(n=this.outOfBandFailureRejectingFuture)===null||n===void 0?void 0:n.promise)!==null&&o!==void 0?o:new Promise(()=>{})]);return a?(this.validateBytesReceived(!0),{done:!0,value:void 0}):(this.handleChunkReceived(r),{done:!1,value:r.content})}catch(a){throw I(),a}}),return(){return vA(this,void 0,void 0,function*(){return I(),{done:!0,value:void 0}})}}}withAbortSignal(A){return this.signal=A,this}readAll(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var i,g,I,n;let o=new Set;const a=e.signal?A.withAbortSignal(e.signal):A;try{for(var r=!0,s=Zl(a),B;B=yield s.next(),i=B.done,!i;r=!0){n=B.value,r=!1;const c=n;o.add(c)}}catch(c){g={error:c}}finally{try{!r&&!i&&(I=s.return)&&(yield I.call(s))}finally{if(g)throw g.error}}return Array.from(o)}()})}}class AKA extends WtA{constructor(A,e,i,g){super(A,e,i,g),this.receivedChunks=new Map}handleChunkReceived(A){var e;const i=KR(A.chunkIndex),g=this.receivedChunks.get(i);if(g&&g.version>A.version)return;this.receivedChunks.set(i,A),this.bytesReceived+=A.content.byteLength,this.validateBytesReceived();const I=this.totalByteSize?this.bytesReceived/this.totalByteSize:void 0;(e=this.onProgress)===null||e===void 0||e.call(this,I)}[Symbol.asyncIterator](){const A=this.reader.getReader(),e=new TextDecoder("utf-8",{fatal:!0});let i=new nC,g=null,I=null;if(this.signal){const o=this.signal;I=()=>{var a;(a=i.reject)===null||a===void 0||a.call(i,o.reason)},o.addEventListener("abort",I),g=o}const n=()=>{A.releaseLock(),g&&I&&g.removeEventListener("abort",I),this.signal=void 0};return{next:()=>vA(this,void 0,void 0,function*(){var o,a;try{const{done:r,value:s}=yield Promise.race([A.read(),i.promise,(a=(o=this.outOfBandFailureRejectingFuture)===null||o===void 0?void 0:o.promise)!==null&&a!==void 0?a:new Promise(()=>{})]);if(r)return this.validateBytesReceived(!0),{done:!0,value:void 0};{this.handleChunkReceived(s);let B;try{B=e.decode(s.content)}catch(c){throw new Zs("Cannot decode datastream chunk ".concat(s.chunkIndex," as text: ").concat(c),ja.DecodeFailed)}return{done:!1,value:B}}}catch(r){throw n(),r}}),return(){return vA(this,void 0,void 0,function*(){return n(),{done:!0,value:void 0}})}}}withAbortSignal(A){return this.signal=A,this}readAll(){return vA(this,arguments,void 0,function(){var A=this;let e=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return function*(){var i,g,I,n;let o="";const a=e.signal?A.withAbortSignal(e.signal):A;try{for(var r=!0,s=Zl(a),B;B=yield s.next(),i=B.done,!i;r=!0)n=B.value,r=!1,o+=n}catch(c){g={error:c}}finally{try{!r&&!i&&(I=s.return)&&(yield I.call(s))}finally{if(g)throw g.error}}return o}()})}}class eKA{constructor(){this.log=Ji,this.byteStreamControllers=new Map,this.textStreamControllers=new Map,this.byteStreamHandlers=new Map,this.textStreamHandlers=new Map}registerTextStreamHandler(A,e){if(this.textStreamHandlers.has(A))throw new Zs('A text stream handler for topic "'.concat(A,'" has already been set.'),ja.HandlerAlreadyRegistered);this.textStreamHandlers.set(A,e)}unregisterTextStreamHandler(A){this.textStreamHandlers.delete(A)}registerByteStreamHandler(A,e){if(this.byteStreamHandlers.has(A))throw new Zs('A byte stream handler for topic "'.concat(A,'" has already been set.'),ja.HandlerAlreadyRegistered);this.byteStreamHandlers.set(A,e)}unregisterByteStreamHandler(A){this.byteStreamHandlers.delete(A)}clearControllers(){this.byteStreamControllers.clear(),this.textStreamControllers.clear()}validateParticipantHasNoActiveDataStreams(A){var e,i,g,I;const n=Array.from(this.textStreamControllers.entries()).filter(a=>a[1].sendingParticipantIdentity===A),o=Array.from(this.byteStreamControllers.entries()).filter(a=>a[1].sendingParticipantIdentity===A);if(n.length>0||o.length>0){const a=new Zs("Participant ".concat(A," unexpectedly disconnected in the middle of sending data"),ja.AbnormalEnd);for(const[r,s]of o)(i=(e=s.outOfBandFailureRejectingFuture).reject)===null||i===void 0||i.call(e,a),this.byteStreamControllers.delete(r);for(const[r,s]of n)(I=(g=s.outOfBandFailureRejectingFuture).reject)===null||I===void 0||I.call(g,a),this.textStreamControllers.delete(r)}}handleDataStreamPacket(A,e){return vA(this,void 0,void 0,function*(){switch(A.value.case){case"streamHeader":return this.handleStreamHeader(A.value.value,A.participantIdentity,e);case"streamChunk":return this.handleStreamChunk(A.value.value,e);case"streamTrailer":return this.handleStreamTrailer(A.value.value,e);default:throw new Error('DataPacket of value "'.concat(A.value.case,'" is not data stream related!'))}})}handleStreamHeader(A,e,i){return vA(this,void 0,void 0,function*(){var g;if(A.contentHeader.case==="byteHeader"){const I=this.byteStreamHandlers.get(A.topic);if(!I){this.log.debug("ignoring incoming byte stream due to no handler for topic",A.topic);return}let n;const o=new nC;o.promise.catch(s=>{this.log.error(s)});const a={id:A.streamId,name:(g=A.contentHeader.value.name)!==null&&g!==void 0?g:"unknown",mimeType:A.mimeType,size:A.totalLength?Number(A.totalLength):void 0,topic:A.topic,timestamp:KR(A.timestamp),attributes:A.attributes,encryptionType:i},r=new ReadableStream({start:s=>{if(n=s,this.textStreamControllers.has(A.streamId))throw new Zs("A data stream read is already in progress for a stream with id ".concat(A.streamId,"."),ja.AlreadyOpened);this.byteStreamControllers.set(A.streamId,{info:a,controller:n,startTime:Date.now(),sendingParticipantIdentity:e,outOfBandFailureRejectingFuture:o})}});I(new $UA(a,r,KR(A.totalLength),o),{identity:e})}else if(A.contentHeader.case==="textHeader"){const I=this.textStreamHandlers.get(A.topic);if(!I){this.log.debug("ignoring incoming text stream due to no handler for topic",A.topic);return}let n;const o=new nC;o.promise.catch(s=>{this.log.error(s)});const a={id:A.streamId,mimeType:A.mimeType,size:A.totalLength?Number(A.totalLength):void 0,topic:A.topic,timestamp:Number(A.timestamp),attributes:A.attributes,encryptionType:i},r=new ReadableStream({start:s=>{if(n=s,this.textStreamControllers.has(A.streamId))throw new Zs("A data stream read is already in progress for a stream with id ".concat(A.streamId,"."),ja.AlreadyOpened);this.textStreamControllers.set(A.streamId,{info:a,controller:n,startTime:Date.now(),sendingParticipantIdentity:e,outOfBandFailureRejectingFuture:o})}});I(new AKA(a,r,KR(A.totalLength),o),{identity:e})}})}handleStreamChunk(A,e){const i=this.byteStreamControllers.get(A.streamId);i&&(i.info.encryptionType!==e?(i.controller.error(new Zs("Encryption type mismatch for stream ".concat(A.streamId,". Expected ").concat(e,", got ").concat(i.info.encryptionType),ja.EncryptionTypeMismatch)),this.byteStreamControllers.delete(A.streamId)):A.content.length>0&&i.controller.enqueue(A));const g=this.textStreamControllers.get(A.streamId);g&&(g.info.encryptionType!==e?(g.controller.error(new Zs("Encryption type mismatch for stream ".concat(A.streamId,". Expected ").concat(e,", got ").concat(g.info.encryptionType),ja.EncryptionTypeMismatch)),this.textStreamControllers.delete(A.streamId)):A.content.length>0&&g.controller.enqueue(A))}handleStreamTrailer(A,e){const i=this.textStreamControllers.get(A.streamId);i&&(i.info.encryptionType!==e?i.controller.error(new Zs("Encryption type mismatch for stream ".concat(A.streamId,". Expected ").concat(e,", got ").concat(i.info.encryptionType),ja.EncryptionTypeMismatch)):(i.info.attributes=Object.assign(Object.assign({},i.info.attributes),A.attributes),i.controller.close(),this.textStreamControllers.delete(A.streamId)));const g=this.byteStreamControllers.get(A.streamId);g&&(g.info.encryptionType!==e?g.controller.error(new Zs("Encryption type mismatch for stream ".concat(A.streamId,". Expected ").concat(e,", got ").concat(g.info.encryptionType),ja.EncryptionTypeMismatch)):(g.info.attributes=Object.assign(Object.assign({},g.info.attributes),A.attributes),g.controller.close()),this.byteStreamControllers.delete(A.streamId))}}class ztA{constructor(A,e,i){this.writableStream=A,this.defaultWriter=A.getWriter(),this.onClose=i,this.info=e}write(A){return this.defaultWriter.write(A)}close(){return vA(this,void 0,void 0,function*(){var A;yield this.defaultWriter.close(),this.defaultWriter.releaseLock(),(A=this.onClose)===null||A===void 0||A.call(this)})}}class tKA extends ztA{}class iKA extends ztA{}const EZ=15e3;class gKA{constructor(A,e){this.engine=A,this.log=e}setupEngine(A){this.engine=A}sendText(A,e){return vA(this,void 0,void 0,function*(){var i;const g=crypto.randomUUID(),n=new TextEncoder().encode(A).byteLength,o=(i=e?.attachments)===null||i===void 0?void 0:i.map(()=>crypto.randomUUID()),a=new Array(o?o.length+1:1).fill(0),r=(B,c)=>{var E;a[c]=B;const D=a.reduce((y,S)=>y+S,0);(E=e?.onProgress)===null||E===void 0||E.call(e,D)},s=yield this.streamText({streamId:g,totalSize:n,destinationIdentities:e?.destinationIdentities,topic:e?.topic,attachedStreamIds:o,attributes:e?.attributes});return yield s.write(A),r(1,0),yield s.close(),e?.attachments&&o&&(yield Promise.all(e.attachments.map((B,c)=>vA(this,void 0,void 0,function*(){return this._sendFile(o[c],B,{topic:e.topic,mimeType:B.type,onProgress:E=>{r(E,c+1)}})})))),s.info})}streamText(A){return vA(this,void 0,void 0,function*(){var e,i,g;const I=(e=A?.streamId)!==null&&e!==void 0?e:crypto.randomUUID(),n={id:I,mimeType:"text/plain",timestamp:Date.now(),topic:(i=A?.topic)!==null&&i!==void 0?i:"",size:A?.totalSize,attributes:A?.attributes,encryptionType:!((g=this.engine.e2eeManager)===null||g===void 0)&&g.isDataChannelEncryptionEnabled?On.GCM:On.NONE},o=new LU({streamId:I,mimeType:n.mimeType,topic:n.topic,timestamp:Jh(n.timestamp),totalLength:Jh(A?.totalSize),attributes:n.attributes,contentHeader:{case:"textHeader",value:new OeA({version:A?.version,attachedStreamIds:A?.attachedStreamIds,replyToStreamId:A?.replyToStreamId,operationType:A?.type==="update"?ST.UPDATE:ST.CREATE})}}),a=A?.destinationIdentities,r=new Wa({destinationIdentities:a,value:{case:"streamHeader",value:o}});yield this.engine.sendDataPacket(r,Wi.RELIABLE);let s=0;const B=this.engine,c=new WritableStream({write(y){return vA(this,void 0,void 0,function*(){for(const S of WRA(y,EZ)){const f=new qU({content:S,streamId:I,chunkIndex:Jh(s)}),M=new Wa({destinationIdentities:a,value:{case:"streamChunk",value:f}});yield B.sendDataPacket(M,Wi.RELIABLE),s+=1}})},close(){return vA(this,void 0,void 0,function*(){const y=new xU({streamId:I}),S=new Wa({destinationIdentities:a,value:{case:"streamTrailer",value:y}});yield B.sendDataPacket(S,Wi.RELIABLE)})},abort(y){}});let E=()=>vA(this,void 0,void 0,function*(){yield D.close()});B.once(ut.Closing,E);const D=new tKA(c,n,()=>this.engine.off(ut.Closing,E));return D})}sendFile(A,e){return vA(this,void 0,void 0,function*(){const i=crypto.randomUUID();return yield this._sendFile(i,A,e),{id:i}})}_sendFile(A,e,i){return vA(this,void 0,void 0,function*(){var g;const I=yield this.streamBytes({streamId:A,totalSize:e.size,name:e.name,mimeType:(g=i?.mimeType)!==null&&g!==void 0?g:e.type,topic:i?.topic,destinationIdentities:i?.destinationIdentities}),n=e.stream().getReader();for(;;){const{done:o,value:a}=yield n.read();if(o)break;yield I.write(a)}return yield I.close(),I.info})}streamBytes(A){return vA(this,void 0,void 0,function*(){var e,i,g,I,n,o;const a=(e=A?.streamId)!==null&&e!==void 0?e:crypto.randomUUID(),r=A?.destinationIdentities,s={id:a,mimeType:(i=A?.mimeType)!==null&&i!==void 0?i:"application/octet-stream",topic:(g=A?.topic)!==null&&g!==void 0?g:"",timestamp:Date.now(),attributes:A?.attributes,size:A?.totalSize,name:(I=A?.name)!==null&&I!==void 0?I:"unknown",encryptionType:!((n=this.engine.e2eeManager)===null||n===void 0)&&n.isDataChannelEncryptionEnabled?On.GCM:On.NONE},B=new LU({totalLength:Jh((o=s.size)!==null&&o!==void 0?o:0),mimeType:s.mimeType,streamId:a,topic:s.topic,timestamp:Jh(Date.now()),attributes:s.attributes,contentHeader:{case:"byteHeader",value:new PeA({name:s.name})}}),c=new Wa({destinationIdentities:r,value:{case:"streamHeader",value:B}});yield this.engine.sendDataPacket(c,Wi.RELIABLE);let E=0;const D=new gr,y=this.engine,S=this.log,f=new WritableStream({write(k){return vA(this,void 0,void 0,function*(){const m=yield D.lock();let U=0;try{for(;U<k.byteLength;){const F=k.slice(U,U+EZ),b=new Wa({destinationIdentities:r,value:{case:"streamChunk",value:new qU({content:F,streamId:a,chunkIndex:Jh(E)})}});yield y.sendDataPacket(b,Wi.RELIABLE),E+=1,U+=F.byteLength}}finally{m()}})},close(){return vA(this,void 0,void 0,function*(){const k=new xU({streamId:a}),m=new Wa({destinationIdentities:r,value:{case:"streamTrailer",value:k}});yield y.sendDataPacket(m,Wi.RELIABLE)})},abort(k){S.error("Sink error:",k)}});return new iKA(f,s)})}}class VtA extends Pe{constructor(A,e,i,g,I){super(A,i,I),this.sid=e,this.receiver=g}get isLocal(){return!1}setMuted(A){this.isMuted!==A&&(this.isMuted=A,this._mediaStreamTrack.enabled=!A,this.emit(A?ct.Muted:ct.Unmuted,this))}setMediaStream(A){this.mediaStream=A;const e=i=>{i.track===this._mediaStreamTrack&&(A.removeEventListener("removetrack",e),this.receiver&&"playoutDelayHint"in this.receiver&&(this.receiver.playoutDelayHint=void 0),this.receiver=void 0,this._currentBitrate=0,this.emit(ct.Ended,this))};A.addEventListener("removetrack",e)}start(){this.startMonitor(),super.enable()}stop(){this.stopMonitor(),super.disable()}getRTCStatsReport(){return vA(this,void 0,void 0,function*(){var A;return!((A=this.receiver)===null||A===void 0)&&A.getStats?yield this.receiver.getStats():void 0})}setPlayoutDelay(A){this.receiver?"playoutDelayHint"in this.receiver?this.receiver.playoutDelayHint=A: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(),nO)),kRA()&&this.registerTimeSyncUpdate()}registerTimeSyncUpdate(){const A=()=>{var e;this.timeSyncHandle=requestAnimationFrame(()=>A());const i=(e=this.receiver)===null||e===void 0?void 0:e.getSynchronizationSources()[0];if(i){const{timestamp:g,rtpTimestamp:I}=i;I&&this.rtpTimestamp!==I&&(this.emit(ct.TimeSyncUpdate,{timestamp:g,rtpTimestamp:I}),this.rtpTimestamp=I)}};A()}}class IKA extends VtA{constructor(A,e,i,g,I,n){super(A,e,Pe.Kind.Audio,i,n),this.monitorReceiver=()=>vA(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=gb(o,this.prevStats)),this.prevStats=o}),this.audioContext=g,this.webAudioPluginNodes=[],I&&(this.sinkId=I.deviceId)}setVolume(A){var e;for(const i of this.attachedElements)this.audioContext?(e=this.gainNode)===null||e===void 0||e.gain.setTargetAtTime(A,0,.1):i.volume=A;Oc()&&this._mediaStreamTrack._setVolume(A),this.elementVolume=A}getVolume(){if(this.elementVolume)return this.elementVolume;if(Oc())return 1;let A=0;return this.attachedElements.forEach(e=>{e.volume>A&&(A=e.volume)}),A}setSinkId(A){return vA(this,void 0,void 0,function*(){this.sinkId=A,yield Promise.all(this.attachedElements.map(e=>{if(qT(e))return e.setSinkId(A)}))})}attach(A){const e=this.attachedElements.length===0;return A?super.attach(A):A=super.attach(),this.sinkId&&qT(A)&&A.setSinkId(this.sinkId).catch(i=>{this.log.error("Failed to set sink id on remote audio track",i,this.logContext)}),this.audioContext&&e&&(this.log.debug("using audio context mapping",this.logContext),this.connectWebAudio(this.audioContext,A),A.volume=0,A.muted=!0),this.elementVolume&&this.setVolume(this.elementVolume),A}detach(A){let e;return A?(e=super.detach(A),this.audioContext&&(this.attachedElements.length>0?this.connectWebAudio(this.audioContext,this.attachedElements[0]):this.disconnectWebAudio())):(e=super.detach(),this.disconnectWebAudio()),e}setAudioContext(A){this.audioContext=A,A&&this.attachedElements.length>0?this.connectWebAudio(A,this.attachedElements[0]):A||this.disconnectWebAudio()}setWebAudioPlugins(A){this.webAudioPluginNodes=A,this.attachedElements.length>0&&this.audioContext&&this.connectWebAudio(this.audioContext,this.attachedElements[0])}connectWebAudio(A,e){this.disconnectWebAudio(),this.sourceNode=A.createMediaStreamSource(e.srcObject);let i=this.sourceNode;this.webAudioPluginNodes.forEach(g=>{i.connect(g),i=g}),this.gainNode=A.createGain(),i.connect(this.gainNode),this.gainNode.connect(A.destination),this.elementVolume&&this.gainNode.gain.setTargetAtTime(this.elementVolume,0,.1),A.state!=="running"&&A.resume().then(()=>{A.state!=="running"&&this.emit(ct.AudioPlaybackFailed,new Error("Audio Context couldn't be started automatically"))}).catch(g=>{this.emit(ct.AudioPlaybackFailed,g)})}disconnectWebAudio(){var A,e;(A=this.gainNode)===null||A===void 0||A.disconnect(),(e=this.sourceNode)===null||e===void 0||e.disconnect(),this.gainNode=void 0,this.sourceNode=void 0}getReceiverStats(){return vA(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const A=yield this.receiver.getStats();let e;return A.forEach(i=>{i.type==="inbound-rtp"&&(e={type:"audio",streamId:i.id,timestamp:i.timestamp,jitter:i.jitter,bytesReceived:i.bytesReceived,concealedSamples:i.concealedSamples,concealmentEvents:i.concealmentEvents,silentConcealedSamples:i.silentConcealedSamples,silentConcealmentEvents:i.silentConcealmentEvents,totalAudioEnergy:i.totalAudioEnergy,totalSamplesDuration:i.totalSamplesDuration})}),e})}}const tL=100;class nKA extends VtA{constructor(A,e,i,g,I){super(A,e,Pe.Kind.Video,i,I),this.elementInfos=[],this.monitorReceiver=()=>vA(this,void 0,void 0,function*(){if(!this.receiver){this._currentBitrate=0;return}const n=yield this.getReceiverStats();n&&this.prevStats&&this.receiver&&(this._currentBitrate=gb(n,this.prevStats)),this.prevStats=n}),this.debouncedHandleResize=tO(()=>{this.updateDimensions()},tL),this.adaptiveStreamSettings=g}get isAdaptiveStream(){return this.adaptiveStreamSettings!==void 0}setStreamState(A){super.setStreamState(A),this.log.debug("setStreamState",A),this.isAdaptiveStream&&A===Pe.StreamState.Active&&this.updateVisibility()}get mediaStreamTrack(){return this._mediaStreamTrack}setMuted(A){super.setMuted(A),this.attachedElements.forEach(e=>{A?RD(this._mediaStreamTrack,e):aD(this._mediaStreamTrack,e)})}attach(A){if(A?super.attach(A):A=super.attach(),this.adaptiveStreamSettings&&this.elementInfos.find(e=>e.element===A)===void 0){const e=new oKA(A);this.observeElementInfo(e)}return A}observeElementInfo(A){this.adaptiveStreamSettings&&this.elementInfos.find(e=>e===A)===void 0?(A.handleResize=()=>{this.debouncedHandleResize()},A.handleVisibilityChanged=()=>{this.updateVisibility()},this.elementInfos.push(A),A.observe(),this.debouncedHandleResize(),this.updateVisibility()):this.log.warn("visibility resize observer not triggered",this.logContext)}stopObservingElementInfo(A){if(!this.isAdaptiveStream){this.log.warn("stopObservingElementInfo ignored",this.logContext);return}const e=this.elementInfos.filter(i=>i===A);for(const i of e)i.stopObserving();this.elementInfos=this.elementInfos.filter(i=>i!==A),this.updateVisibility(),this.debouncedHandleResize()}detach(A){let e=[];if(A)return this.stopObservingElement(A),super.detach(A);e=super.detach();for(const i of e)this.stopObservingElement(i);return e}getDecoderImplementation(){var A;return(A=this.prevStats)===null||A===void 0?void 0:A.decoderImplementation}getReceiverStats(){return vA(this,void 0,void 0,function*(){if(!this.receiver||!this.receiver.getStats)return;const A=yield this.receiver.getStats();let e,i="",g=new Map;return A.forEach(I=>{I.type==="inbound-rtp"?(i=I.codecId,e={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"&&g.set(I.id,I)}),e&&i!==""&&g.get(i)&&(e.mimeType=g.get(i).mimeType),e})}stopObservingElement(A){const e=this.elementInfos.filter(i=>i.element===A);for(const i of e)this.stopObservingElementInfo(i)}handleAppVisibilityChanged(){const A=Object.create(null,{handleAppVisibilityChanged:{get:()=>super.handleAppVisibilityChanged}});return vA(this,void 0,void 0,function*(){yield A.handleAppVisibilityChanged.call(this),this.isAdaptiveStream&&this.updateVisibility()})}updateVisibility(A){var e,i;const g=this.elementInfos.reduce((a,r)=>Math.max(a,r.visibilityChangedAt||0),0),I=!((i=(e=this.adaptiveStreamSettings)===null||e===void 0?void 0:e.pauseVideoInBackground)!==null&&i!==void 0)||i?this.isInBackground:!1,n=this.elementInfos.some(a=>a.pictureInPicture),o=this.elementInfos.some(a=>a.visible)&&!I||n;if(!(this.lastVisible===o&&!A)){if(!o&&Date.now()-g<tL){Ho.setTimeout(()=>{this.updateVisibility()},tL);return}this.lastVisible=o,this.emit(ct.VisibilityChanged,o,this)}}updateDimensions(){var A,e;let i=0,g=0;const I=this.getPixelDensity();for(const n of this.elementInfos){const o=n.width()*I,a=n.height()*I;o+a>i+g&&(i=o,g=a)}((A=this.lastDimensions)===null||A===void 0?void 0:A.width)===i&&((e=this.lastDimensions)===null||e===void 0?void 0:e.height)===g||(this.lastDimensions={width:i,height:g},this.emit(ct.VideoDimensionsChanged,this.lastDimensions,this))}getPixelDensity(){var A;const e=(A=this.adaptiveStreamSettings)===null||A===void 0?void 0:A.pixelDensity;return e==="screen"?H5():e||(H5()>2?2:1)}}class oKA{get visible(){return this.isPiP||this.isIntersecting}get pictureInPicture(){return this.isPiP}constructor(A,e){this.onVisibilityChanged=i=>{var g;const{target:I,isIntersecting:n}=i;I===this.element&&(this.isIntersecting=n,this.isPiP=Nw(this.element),this.visibilityChangedAt=Date.now(),(g=this.handleVisibilityChanged)===null||g===void 0||g.call(this))},this.onEnterPiP=()=>{var i,g,I;(g=(i=window.documentPictureInPicture)===null||i===void 0?void 0:i.window)===null||g===void 0||g.addEventListener("pagehide",this.onLeavePiP),this.isPiP=Nw(this.element),(I=this.handleVisibilityChanged)===null||I===void 0||I.call(this)},this.onLeavePiP=()=>{var i;this.isPiP=Nw(this.element),(i=this.handleVisibilityChanged)===null||i===void 0||i.call(this)},this.element=A,this.isIntersecting=e??PT(A),this.isPiP=Gr()&&Nw(A),this.visibilityChangedAt=0}width(){return this.element.clientWidth}height(){return this.element.clientHeight}observe(){var A,e,i;this.isIntersecting=PT(this.element),this.isPiP=Nw(this.element),this.element.handleResize=()=>{var g;(g=this.handleResize)===null||g===void 0||g.call(this)},this.element.handleVisibilityChanged=this.onVisibilityChanged,P5().observe(this.element),O5().observe(this.element),this.element.addEventListener("enterpictureinpicture",this.onEnterPiP),this.element.addEventListener("leavepictureinpicture",this.onLeavePiP),(A=window.documentPictureInPicture)===null||A===void 0||A.addEventListener("enter",this.onEnterPiP),(i=(e=window.documentPictureInPicture)===null||e===void 0?void 0:e.window)===null||i===void 0||i.addEventListener("pagehide",this.onLeavePiP)}stopObserving(){var A,e,i,g,I;(A=P5())===null||A===void 0||A.unobserve(this.element),(e=O5())===null||e===void 0||e.unobserve(this.element),this.element.removeEventListener("enterpictureinpicture",this.onEnterPiP),this.element.removeEventListener("leavepictureinpicture",this.onLeavePiP),(i=window.documentPictureInPicture)===null||i===void 0||i.removeEventListener("enter",this.onEnterPiP),(I=(g=window.documentPictureInPicture)===null||g===void 0?void 0:g.window)===null||I===void 0||I.removeEventListener("pagehide",this.onLeavePiP)}}function Nw(t){var A,e;return document.pictureInPictureElement===t?!0:!((A=window.documentPictureInPicture)===null||A===void 0)&&A.window?PT(t,(e=window.documentPictureInPicture)===null||e===void 0?void 0:e.window):!1}function PT(t,A){const e=A||window;let i=t.offsetTop,g=t.offsetLeft;const I=t.offsetWidth,n=t.offsetHeight,{hidden:o}=t,{display:a}=getComputedStyle(t);for(;t.offsetParent;)t=t.offsetParent,i+=t.offsetTop,g+=t.offsetLeft;return i<e.pageYOffset+e.innerHeight&&g<e.pageXOffset+e.innerWidth&&i+n>e.pageYOffset&&g+I>e.pageXOffset&&!o&&a!=="none"}class Hl extends zc.EventEmitter{constructor(A,e,i,g){var I;super(),this.metadataMuted=!1,this.encryption=On.NONE,this.log=Ji,this.handleMuted=()=>{this.emit(ct.Muted)},this.handleUnmuted=()=>{this.emit(ct.Unmuted)},this.log=uQ((I=g?.loggerName)!==null&&I!==void 0?I:yB.Publication),this.loggerContextCb=this.loggerContextCb,this.setMaxListeners(100),this.kind=A,this.trackSid=e,this.trackName=i,this.source=Pe.Source.Unknown}setTrack(A){this.track&&(this.track.off(ct.Muted,this.handleMuted),this.track.off(ct.Unmuted,this.handleUnmuted)),this.track=A,A&&(A.on(ct.Muted,this.handleMuted),A.on(ct.Unmuted,this.handleUnmuted))}get logContext(){var A;return Object.assign(Object.assign({},(A=this.loggerContextCb)===null||A===void 0?void 0:A.call(this)),Xi(this))}get isMuted(){return this.metadataMuted}get isEnabled(){return!0}get isSubscribed(){return this.track!==void 0}get isEncrypted(){return this.encryption!==On.NONE}get audioTrack(){if(Jc(this.track))return this.track}get videoTrack(){if(Du(this.track))return this.track}updateInfo(A){this.trackSid=A.sid,this.trackName=A.name,this.source=Pe.sourceFromProto(A.source),this.mimeType=A.mimeType,this.kind===Pe.Kind.Video&&A.width>0&&(this.dimensions={width:A.width,height:A.height},this.simulcasted=A.simulcast),this.encryption=A.encryption,this.trackInfo=A,this.log.debug("update publication info",Object.assign(Object.assign({},this.logContext),{info:A}))}}(function(t){(function(A){A.Desired="desired",A.Subscribed="subscribed",A.Unsubscribed="unsubscribed"})(t.SubscriptionStatus||(t.SubscriptionStatus={})),function(A){A.Allowed="allowed",A.NotAllowed="not_allowed"}(t.PermissionStatus||(t.PermissionStatus={}))})(Hl||(Hl={}));class jT extends Hl{get isUpstreamPaused(){var A;return(A=this.track)===null||A===void 0?void 0:A.isUpstreamPaused}constructor(A,e,i,g){super(A,e.sid,e.name,g),this.track=void 0,this.handleTrackEnded=()=>{this.emit(ct.Ended)},this.handleCpuConstrained=()=>{this.track&&Du(this.track)&&this.emit(ct.CpuConstrained,this.track)},this.updateInfo(e),this.setTrack(i)}setTrack(A){this.track&&(this.track.off(ct.Ended,this.handleTrackEnded),this.track.off(ct.CpuConstrained,this.handleCpuConstrained)),super.setTrack(A),A&&(A.on(ct.Ended,this.handleTrackEnded),A.on(ct.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 vA(this,void 0,void 0,function*(){var A;return(A=this.track)===null||A===void 0?void 0:A.mute()})}unmute(){return vA(this,void 0,void 0,function*(){var A;return(A=this.track)===null||A===void 0?void 0:A.unmute()})}pauseUpstream(){return vA(this,void 0,void 0,function*(){var A;yield(A=this.track)===null||A===void 0?void 0:A.pauseUpstream()})}resumeUpstream(){return vA(this,void 0,void 0,function*(){var A;yield(A=this.track)===null||A===void 0?void 0:A.resumeUpstream()})}getTrackFeatures(){var A;if(Jc(this.track)){const e=this.track.getSourceTrackSettings(),i=new Set;return e.autoGainControl&&i.add(Eo.TF_AUTO_GAIN_CONTROL),e.echoCancellation&&i.add(Eo.TF_ECHO_CANCELLATION),e.noiseSuppression&&i.add(Eo.TF_NOISE_SUPPRESSION),e.channelCount&&e.channelCount>1&&i.add(Eo.TF_STEREO),!((A=this.options)===null||A===void 0)&&A.dtx||i.add(Eo.TF_NO_DTX),this.track.enhancedNoiseCancellation&&i.add(Eo.TF_ENHANCED_NOISE_CANCELLATION),Array.from(i.values())}else return[]}}function Ib(t,A){return vA(this,void 0,void 0,function*(){t??(t={});let e=!1;const{audioProcessor:i,videoProcessor:g,optionsWithoutProcessor:I}=_tA(t);let n=I.audio,o=I.video;if(i&&typeof I.audio=="object"&&(I.audio.processor=i),g&&typeof I.video=="object"&&(I.video.processor=g),t.audio&&typeof I.audio=="object"&&typeof I.audio.deviceId=="string"){const B=I.audio.deviceId;I.audio.deviceId={exact:B},e=!0,n=Object.assign(Object.assign({},I.audio),{deviceId:{ideal:B}})}if(I.video&&typeof I.video=="object"&&typeof I.video.deviceId=="string"){const B=I.video.deviceId;I.video.deviceId={exact:B},e=!0,o=Object.assign(Object.assign({},I.video),{deviceId:{ideal:B}})}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 a=FtA(I,TtA,YtA),r=XH(a),s=navigator.mediaDevices.getUserMedia(r);I.audio&&(uo.userMediaPromiseMap.set("audioinput",s),s.catch(()=>uo.userMediaPromiseMap.delete("audioinput"))),I.video&&(uo.userMediaPromiseMap.set("videoinput",s),s.catch(()=>uo.userMediaPromiseMap.delete("videoinput")));try{const B=yield s;return yield Promise.all(B.getTracks().map(c=>vA(this,void 0,void 0,function*(){const E=c.kind==="audio";let D=E?a.audio:a.video;(typeof D=="boolean"||!D)&&(D={});let y;const S=E?r.audio:r.video;typeof S!="boolean"&&(y=S);const f=c.getSettings().deviceId;y?.deviceId&&YE(y.deviceId)!==f?y.deviceId=f:y||(y={deviceId:f});const M=bUA(c,y,A);return M.kind===Pe.Kind.Video?M.source=Pe.Source.Camera:M.kind===Pe.Kind.Audio&&(M.source=Pe.Source.Microphone),M.mediaStream=B,Jc(M)&&i?yield M.setProcessor(i):Du(M)&&g&&(yield M.setProcessor(g)),M})))}catch(B){if(!e)throw B;return Ib(Object.assign(Object.assign({},t),{audio:n,video:o}),A)}})}function aKA(t){return vA(this,void 0,void 0,function*(){return(yield Ib({audio:!1,video:!0}))[0]})}function rKA(t){return vA(this,void 0,void 0,function*(){return(yield Ib({audio:!0,video:!1}))[0]})}var ME;(function(t){t.Excellent="excellent",t.Good="good",t.Poor="poor",t.Lost="lost",t.Unknown="unknown"})(ME||(ME={}));function sKA(t){switch(t){case Cm.EXCELLENT:return ME.Excellent;case Cm.GOOD:return ME.Good;case Cm.POOR:return ME.Poor;case Cm.LOST:return ME.Lost;default:return ME.Unknown}}class XtA extends zc.EventEmitter{get logContext(){var A,e;return Object.assign({},(e=(A=this.loggerOptions)===null||A===void 0?void 0:A.loggerContextCb)===null||e===void 0?void 0:e.call(A))}get isEncrypted(){return this.trackPublications.size>0&&Array.from(this.trackPublications.values()).every(A=>A.isEncrypted)}get isAgent(){var A;return((A=this.permissions)===null||A===void 0?void 0:A.agent)||this.kind===y0.AGENT}get isActive(){var A;return((A=this.participantInfo)===null||A===void 0?void 0:A.state)===kD.ACTIVE}get kind(){return this._kind}get attributes(){return Object.freeze(Object.assign({},this._attributes))}constructor(A,e,i,g,I,n){let o=arguments.length>6&&arguments[6]!==void 0?arguments[6]:y0.STANDARD;var a;super(),this.audioLevel=0,this.isSpeaking=!1,this._connectionQuality=ME.Unknown,this.log=Ji,this.log=uQ((a=n?.loggerName)!==null&&a!==void 0?a:yB.Participant),this.loggerOptions=n,this.setMaxListeners(100),this.sid=A,this.identity=e,this.name=i,this.metadata=g,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this._kind=o,this._attributes=I??{}}getTrackPublications(){return Array.from(this.trackPublications.values())}getTrackPublication(A){for(const[,e]of this.trackPublications)if(e.source===A)return e}getTrackPublicationByName(A){for(const[,e]of this.trackPublications)if(e.trackName===A)return e}waitUntilActive(){return this.isActive?Promise.resolve():this.activeFuture?this.activeFuture.promise:(this.activeFuture=new nC,this.once(pt.Active,()=>{var A,e;(e=(A=this.activeFuture)===null||A===void 0?void 0:A.resolve)===null||e===void 0||e.call(A),this.activeFuture=void 0}),this.activeFuture.promise)}get connectionQuality(){return this._connectionQuality}get isCameraEnabled(){var A;const e=this.getTrackPublication(Pe.Source.Camera);return!(!((A=e?.isMuted)!==null&&A!==void 0)||A)}get isMicrophoneEnabled(){var A;const e=this.getTrackPublication(Pe.Source.Microphone);return!(!((A=e?.isMuted)!==null&&A!==void 0)||A)}get isScreenShareEnabled(){return!!this.getTrackPublication(Pe.Source.ScreenShare)}get isLocal(){return!1}get joinedAt(){return this.participantInfo?new Date(Number.parseInt(this.participantInfo.joinedAt.toString())*1e3):new Date}updateInfo(A){var e;return this.participantInfo&&this.participantInfo.sid===A.sid&&this.participantInfo.version>A.version?!1:(this.identity=A.identity,this.sid=A.sid,this._setName(A.name),this._setMetadata(A.metadata),this._setAttributes(A.attributes),A.state===kD.ACTIVE&&((e=this.participantInfo)===null||e===void 0?void 0:e.state)!==kD.ACTIVE&&this.emit(pt.Active),A.permission&&this.setPermissions(A.permission),this.participantInfo=A,!0)}_setMetadata(A){const e=this.metadata!==A,i=this.metadata;this.metadata=A,e&&this.emit(pt.ParticipantMetadataChanged,i)}_setName(A){const e=this.name!==A;this.name=A,e&&this.emit(pt.ParticipantNameChanged,A)}_setAttributes(A){const e=MRA(this.attributes,A);this._attributes=A,Object.keys(e).length>0&&this.emit(pt.AttributesChanged,e)}setPermissions(A){var e,i,g,I,n,o;const a=this.permissions,r=A.canPublish!==((e=this.permissions)===null||e===void 0?void 0:e.canPublish)||A.canSubscribe!==((i=this.permissions)===null||i===void 0?void 0:i.canSubscribe)||A.canPublishData!==((g=this.permissions)===null||g===void 0?void 0:g.canPublishData)||A.hidden!==((I=this.permissions)===null||I===void 0?void 0:I.hidden)||A.recorder!==((n=this.permissions)===null||n===void 0?void 0:n.recorder)||A.canPublishSources.length!==this.permissions.canPublishSources.length||A.canPublishSources.some((s,B)=>{var c;return s!==((c=this.permissions)===null||c===void 0?void 0:c.canPublishSources[B])})||A.canSubscribeMetrics!==((o=this.permissions)===null||o===void 0?void 0:o.canSubscribeMetrics);return this.permissions=A,r&&this.emit(pt.ParticipantPermissionsChanged,a),r}setIsSpeaking(A){A!==this.isSpeaking&&(this.isSpeaking=A,A&&(this.lastSpokeAt=new Date),this.emit(pt.IsSpeakingChanged,A))}setConnectionQuality(A){const e=this._connectionQuality;this._connectionQuality=sKA(A),e!==this._connectionQuality&&this.emit(pt.ConnectionQualityChanged,this._connectionQuality)}setDisconnected(){var A,e;this.activeFuture&&((e=(A=this.activeFuture).reject)===null||e===void 0||e.call(A,new Error("Participant disconnected")),this.activeFuture=void 0)}setAudioContext(A){this.audioContext=A,this.audioTrackPublications.forEach(e=>Jc(e.track)&&e.track.setAudioContext(A))}addTrackPublication(A){A.on(ct.Muted,()=>{this.emit(pt.TrackMuted,A)}),A.on(ct.Unmuted,()=>{this.emit(pt.TrackUnmuted,A)});const e=A;switch(e.track&&(e.track.sid=A.trackSid),this.trackPublications.set(A.trackSid,A),A.kind){case Pe.Kind.Audio:this.audioTrackPublications.set(A.trackSid,A);break;case Pe.Kind.Video:this.videoTrackPublications.set(A.trackSid,A);break}}}function CKA(t){var A,e,i;if(!t.participantSid&&!t.participantIdentity)throw new Error("Invalid track permission, must provide at least one of participantIdentity and participantSid");return new VeA({participantIdentity:(A=t.participantIdentity)!==null&&A!==void 0?A:"",participantSid:(e=t.participantSid)!==null&&e!==void 0?e:"",allTracks:(i=t.allowAll)!==null&&i!==void 0?i:!1,trackSids:t.allowedTrackSids||[]})}class BKA extends XtA{constructor(A,e,i,g,I,n){super(A,e,void 0,void 0,void 0,{loggerName:g.loggerName,loggerContextCb:()=>this.engine.logContext}),this.pendingPublishing=new Set,this.pendingPublishPromises=new Map,this.participantTrackPermissions=[],this.allParticipantsAllowedToSubscribe=!0,this.encryptionType=On.NONE,this.enabledPublishVideoCodecs=[],this.pendingAcks=new Map,this.pendingResponses=new Map,this.handleReconnecting=()=>{this.reconnectFuture||(this.reconnectFuture=new nC)},this.handleReconnected=()=>{var o,a;(a=(o=this.reconnectFuture)===null||o===void 0?void 0:o.resolve)===null||a===void 0||a.call(o),this.reconnectFuture=void 0,this.updateTrackSubscriptionPermissions()},this.handleClosing=()=>{var o,a,r,s,B,c;this.reconnectFuture&&(this.reconnectFuture.promise.catch(E=>this.log.warn(E.message,this.logContext)),(a=(o=this.reconnectFuture)===null||o===void 0?void 0:o.reject)===null||a===void 0||a.call(o,new Error("Got disconnected during reconnection attempt")),this.reconnectFuture=void 0),this.signalConnectedFuture&&((s=(r=this.signalConnectedFuture).reject)===null||s===void 0||s.call(r,new Error("Got disconnected without signal connected")),this.signalConnectedFuture=void 0),(c=(B=this.activeAgentFuture)===null||B===void 0?void 0:B.reject)===null||c===void 0||c.call(B,new Error("Got disconnected without active agent present")),this.activeAgentFuture=void 0,this.firstActiveAgent=void 0},this.handleSignalConnected=o=>{var a,r;o.participant&&this.updateInfo(o.participant),this.signalConnectedFuture||(this.signalConnectedFuture=new nC),(r=(a=this.signalConnectedFuture).resolve)===null||r===void 0||r.call(a)},this.handleSignalRequestResponse=o=>{const{requestId:a,reason:r,message:s}=o,B=this.pendingSignalRequests.get(a);B&&(r!==WH.OK&&B.reject(new L5(s,r)),this.pendingSignalRequests.delete(a))},this.handleDataPacket=o=>{switch(o.value.case){case"rpcResponse":let a=o.value.value,r=null,s=null;a.value.case==="payload"?r=a.value.value:a.value.case==="error"&&(s=za.fromProto(a.value.value)),this.handleIncomingRpcResponse(a.requestId,r,s);break;case"rpcAck":let B=o.value.value;this.handleIncomingRpcAck(B.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(o=>CKA(o)))},this.onTrackUnmuted=o=>{this.onTrackMuted(o,o.isUpstreamPaused)},this.onTrackMuted=(o,a)=>{if(a===void 0&&(a=!0),!o.sid){this.log.error("could not update mute status for unpublished track",Object.assign(Object.assign({},this.logContext),Xi(o)));return}this.engine.updateMuteStatus(o.sid,a)},this.onTrackUpstreamPaused=o=>{this.log.debug("upstream paused",Object.assign(Object.assign({},this.logContext),Xi(o))),this.onTrackMuted(o,!0)},this.onTrackUpstreamResumed=o=>{this.log.debug("upstream resumed",Object.assign(Object.assign({},this.logContext),Xi(o))),this.onTrackMuted(o,o.isMuted)},this.onTrackFeatureUpdate=o=>{const a=this.audioTrackPublications.get(o.sid);if(!a){this.log.warn("Could not update local audio track settings, missing publication for track ".concat(o.sid),this.logContext);return}this.engine.client.sendUpdateLocalAudioTrack(a.trackSid,a.getTrackFeatures())},this.onTrackCpuConstrained=(o,a)=>{this.log.debug("track cpu constrained",Object.assign(Object.assign({},this.logContext),Xi(a))),this.emit(pt.LocalTrackCpuConstrained,o,a)},this.handleSubscribedQualityUpdate=o=>vA(this,void 0,void 0,function*(){var a,r,s,B,c;if(!(!((c=this.roomOptions)===null||c===void 0)&&c.dynacast))return;const E=this.videoTrackPublications.get(o.trackSid);if(!E){this.log.warn("received subscribed quality update for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}if(!E.videoTrack)return;const D=yield E.videoTrack.setPublishingCodecs(o.subscribedCodecs);try{for(var y=!0,S=Zl(D),f;f=yield S.next(),a=f.done,!a;y=!0){B=f.value,y=!1;const M=B;yRA(M)&&(this.log.debug("publish ".concat(M," for ").concat(E.videoTrack.sid),Object.assign(Object.assign({},this.logContext),Xi(E))),yield this.publishAdditionalCodecForTrack(E.videoTrack,M,E.options))}}catch(M){r={error:M}}finally{try{!y&&!a&&(s=S.return)&&(yield s.call(S))}finally{if(r)throw r.error}}}),this.handleLocalTrackUnpublished=o=>{const a=this.trackPublications.get(o.trackSid);if(!a){this.log.warn("received unpublished event for unknown track",Object.assign(Object.assign({},this.logContext),{trackSid:o.trackSid}));return}this.unpublishTrack(a.track)},this.handleTrackEnded=o=>vA(this,void 0,void 0,function*(){if(o.source===Pe.Source.ScreenShare||o.source===Pe.Source.ScreenShareAudio)this.log.debug("unpublishing local track due to TrackEnded",Object.assign(Object.assign({},this.logContext),Xi(o))),this.unpublishTrack(o);else if(o.isUserProvided)yield o.mute();else if(ql(o)||BE(o))try{if(Gr())try{const a=yield navigator?.permissions.query({name:o.source===Pe.Source.Camera?"camera":"microphone"});if(a&&a.state==="denied")throw this.log.warn("user has revoked access to ".concat(o.source),Object.assign(Object.assign({},this.logContext),Xi(o))),a.onchange=()=>{a.state!=="denied"&&(o.isMuted||o.restartTrack(),a.onchange=null)},new Error("GetUserMedia Permission denied")}catch{}o.isMuted||(this.log.debug("track ended, attempting to use a different device",Object.assign(Object.assign({},this.logContext),Xi(o))),ql(o)?yield o.restartTrack({deviceId:"default"}):yield o.restartTrack())}catch{this.log.warn("could not restart track, muting instead",Object.assign(Object.assign({},this.logContext),Xi(o))),yield o.mute()}}),this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.trackPublications=new Map,this.engine=i,this.roomOptions=g,this.setupEngine(i),this.activeDeviceMap=new Map([["audioinput","default"],["videoinput","default"],["audiooutput","default"]]),this.pendingSignalRequests=new Map,this.rpcHandlers=I,this.roomOutgoingDataStreamManager=n}get lastCameraError(){return this.cameraError}get lastMicrophoneError(){return this.microphoneError}get isE2EEEnabled(){return this.encryptionType!==On.NONE}getTrackPublication(A){const e=super.getTrackPublication(A);if(e)return e}getTrackPublicationByName(A){const e=super.getTrackPublicationByName(A);if(e)return e}setupEngine(A){var e;this.engine=A,this.engine.on(ut.RemoteMute,(i,g)=>{const I=this.trackPublications.get(i);!I||!I.track||(g?I.mute():I.unmute())}),!((e=this.signalConnectedFuture)===null||e===void 0)&&e.isResolved&&(this.signalConnectedFuture=void 0),this.engine.on(ut.Connected,this.handleReconnected).on(ut.SignalConnected,this.handleSignalConnected).on(ut.SignalRestarted,this.handleReconnected).on(ut.SignalResumed,this.handleReconnected).on(ut.Restarting,this.handleReconnecting).on(ut.Resuming,this.handleReconnecting).on(ut.LocalTrackUnpublished,this.handleLocalTrackUnpublished).on(ut.SubscribedQualityUpdate,this.handleSubscribedQualityUpdate).on(ut.Closing,this.handleClosing).on(ut.SignalRequestResponse,this.handleSignalRequestResponse).on(ut.DataPacketReceived,this.handleDataPacket)}setMetadata(A){return vA(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({metadata:A})})}setName(A){return vA(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({name:A})})}setAttributes(A){return vA(this,void 0,void 0,function*(){yield this.requestMetadataUpdate({attributes:A})})}requestMetadataUpdate(A){return vA(this,arguments,void 0,function(e){var i=this;let{metadata:g,name:I,attributes:n}=e;return function*(){return new Nr((o,a)=>vA(i,void 0,void 0,function*(){var r,s;try{let B=!1;const c=yield this.engine.client.sendUpdateLocalMetadata((r=g??this.metadata)!==null&&r!==void 0?r:"",(s=I??this.name)!==null&&s!==void 0?s:"",n),E=performance.now();for(this.pendingSignalRequests.set(c,{resolve:o,reject:D=>{a(D),B=!0},values:{name:I,metadata:g,attributes:n}});performance.now()-E<5e3&&!B;){if((!I||this.name===I)&&(!g||this.metadata===g)&&(!n||Object.entries(n).every(D=>{let[y,S]=D;return this.attributes[y]===S||S===""&&!this.attributes[y]}))){this.pendingSignalRequests.delete(c),o();return}yield Oo(50)}a(new L5("Request to update local metadata timed out","TimeoutError"))}catch(B){B instanceof Error?a(B):a(new Error(String(B)))}}))}()})}setCameraEnabled(A,e,i){return this.setTrackEnabled(Pe.Source.Camera,A,e,i)}setMicrophoneEnabled(A,e,i){return this.setTrackEnabled(Pe.Source.Microphone,A,e,i)}setScreenShareEnabled(A,e,i){return this.setTrackEnabled(Pe.Source.ScreenShare,A,e,i)}setE2EEEnabled(A){return vA(this,void 0,void 0,function*(){this.encryptionType=A?On.GCM:On.NONE,yield this.republishAllTracks(void 0,!1)})}setTrackEnabled(A,e,i,g){return vA(this,void 0,void 0,function*(){var I,n;this.log.debug("setTrackEnabled",Object.assign(Object.assign({},this.logContext),{source:A,enabled:e})),this.republishPromise&&(yield this.republishPromise);let o=this.getTrackPublication(A);if(e)if(o)yield o.unmute();else{let a;if(this.pendingPublishing.has(A)){const r=yield this.waitForPendingPublicationOfSource(A);return r||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:A})),yield r?.unmute(),r}this.pendingPublishing.add(A);try{switch(A){case Pe.Source.Camera:a=yield this.createTracks({video:(I=i)!==null&&I!==void 0?I:!0});break;case Pe.Source.Microphone:a=yield this.createTracks({audio:(n=i)!==null&&n!==void 0?n:!0});break;case Pe.Source.ScreenShare:a=yield this.createScreenTracks(Object.assign({},i));break;default:throw new Wl(A)}}catch(r){throw a?.forEach(s=>{s.stop()}),r instanceof Error&&this.emit(pt.MediaDevicesError,r,_T(A)),this.pendingPublishing.delete(A),r}for(const r of a){const s=Object.assign(Object.assign({},this.roomOptions.publishDefaults),i);A===Pe.Source.Microphone&&Jc(r)&&s.preConnectBuffer&&(this.log.info("starting preconnect buffer for microphone",Object.assign({},this.logContext)),r.startPreConnectBuffer())}try{const r=[];for(const B of a)this.log.info("publishing track",Object.assign(Object.assign({},this.logContext),Xi(B))),r.push(this.publishTrack(B,g));[o]=yield Promise.all(r)}catch(r){throw a?.forEach(s=>{s.stop()}),r}finally{this.pendingPublishing.delete(A)}}else if(!o?.track&&this.pendingPublishing.has(A)&&(o=yield this.waitForPendingPublicationOfSource(A),o||this.log.info("waiting for pending publication promise timed out",Object.assign(Object.assign({},this.logContext),{source:A}))),o&&o.track)if(A===Pe.Source.ScreenShare){o=yield this.unpublishTrack(o.track);const a=this.getTrackPublication(Pe.Source.ScreenShareAudio);a&&a.track&&this.unpublishTrack(a.track)}else yield o.mute();return o})}enableCameraAndMicrophone(){return vA(this,void 0,void 0,function*(){if(!(this.pendingPublishing.has(Pe.Source.Camera)||this.pendingPublishing.has(Pe.Source.Microphone))){this.pendingPublishing.add(Pe.Source.Camera),this.pendingPublishing.add(Pe.Source.Microphone);try{const A=yield this.createTracks({audio:!0,video:!0});yield Promise.all(A.map(e=>this.publishTrack(e)))}finally{this.pendingPublishing.delete(Pe.Source.Camera),this.pendingPublishing.delete(Pe.Source.Microphone)}}})}createTracks(A){return vA(this,void 0,void 0,function*(){var e,i;A??(A={});const g=FtA(A,(e=this.roomOptions)===null||e===void 0?void 0:e.audioCaptureDefaults,(i=this.roomOptions)===null||i===void 0?void 0:i.videoCaptureDefaults);try{return(yield Ib(g,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext})).map(o=>(Jc(o)&&(this.microphoneError=void 0,o.setAudioContext(this.audioContext),o.source=Pe.Source.Microphone,this.emit(pt.AudioStreamAcquired)),Du(o)&&(this.cameraError=void 0,o.source=Pe.Source.Camera),o))}catch(I){throw I instanceof Error&&(A.audio&&(this.microphoneError=I),A.video&&(this.cameraError=I)),I}})}createScreenTracks(A){return vA(this,void 0,void 0,function*(){if(A===void 0&&(A={}),navigator.mediaDevices.getDisplayMedia===void 0)throw new zH("getDisplayMedia not supported");A.resolution===void 0&&!_RA()&&(A.resolution=VH.h1080fps30.resolution);const e=wRA(A),i=yield navigator.mediaDevices.getDisplayMedia(e),g=i.getVideoTracks();if(g.length===0)throw new Wl("no video track found");const I=new HU(g[0],void 0,!1,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});I.source=Pe.Source.ScreenShare,A.contentHint&&(I.mediaStreamTrack.contentHint=A.contentHint);const n=[I];if(i.getAudioTracks().length>0){this.emit(pt.AudioStreamAcquired);const o=new YU(i.getAudioTracks()[0],void 0,!1,this.audioContext,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});o.source=Pe.Source.ScreenShareAudio,n.push(o)}return n})}publishTrack(A,e){return vA(this,void 0,void 0,function*(){return this.publishOrRepublishTrack(A,e)})}publishOrRepublishTrack(A,e){return vA(this,arguments,void 0,function(i,g){var I=this;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!1;return function*(){var o,a,r,s;ql(i)&&i.setAudioContext(I.audioContext),yield(o=I.reconnectFuture)===null||o===void 0?void 0:o.promise,I.republishPromise&&!n&&(yield I.republishPromise),UD(i)&&I.pendingPublishPromises.has(i)&&(yield I.pendingPublishPromises.get(i));let B;if(i instanceof MediaStreamTrack)B=i.getConstraints();else{B=i.constraints;let f;switch(i.source){case Pe.Source.Microphone:f="audioinput";break;case Pe.Source.Camera:f="videoinput"}f&&I.activeDeviceMap.has(f)&&(B=Object.assign(Object.assign({},B),{deviceId:I.activeDeviceMap.get(f)}))}if(i instanceof MediaStreamTrack)switch(i.kind){case"audio":i=new YU(i,B,!0,I.audioContext,{loggerName:I.roomOptions.loggerName,loggerContextCb:()=>I.logContext});break;case"video":i=new HU(i,B,!0,{loggerName:I.roomOptions.loggerName,loggerContextCb:()=>I.logContext});break;default:throw new Wl("unsupported MediaStreamTrack kind ".concat(i.kind))}else i.updateLoggerOptions({loggerName:I.roomOptions.loggerName,loggerContextCb:()=>I.logContext});let c;if(I.trackPublications.forEach(f=>{f.track&&f.track===i&&(c=f)}),c)return I.log.warn("track has already been published, skipping",Object.assign(Object.assign({},I.logContext),Xi(c))),c;const E=Object.assign(Object.assign({},I.roomOptions.publishDefaults),g),D="channelCount"in i.mediaStreamTrack.getSettings()&&i.mediaStreamTrack.getSettings().channelCount===2||i.mediaStreamTrack.getConstraints().channelCount===2,y=(a=E.forceStereo)!==null&&a!==void 0?a:D;y&&(E.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),Xi(i))),E.red===void 0&&I.log.info("Opus RED will be disabled for stereo tracks by default. Enable them explicitly to make it work."),(r=E.dtx)!==null&&r!==void 0||(E.dtx=!1),(s=E.red)!==null&&s!==void 0||(E.red=!1)),!LRA()&&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)),E.simulcast=!1),E.source&&(i.source=E.source);const S=new Promise((f,M)=>vA(I,void 0,void 0,function*(){try{if(this.engine.client.currentState!==sI.CONNECTED){this.log.debug("deferring track publication until signal is connected",Object.assign(Object.assign({},this.logContext),{track:Xi(i)}));let k=!1;const m=setTimeout(()=>{k=!0,i.stop(),M(new J5("publishing rejected as engine not connected within timeout",408))},15e3);if(yield this.waitUntilEngineConnected(),clearTimeout(m),k)return;const U=yield this.publish(i,E,y);f(U)}else try{const k=yield this.publish(i,E,y);f(k)}catch(k){M(k)}}catch(k){M(k)}}));I.pendingPublishPromises.set(i,S);try{return yield S}catch(f){throw f}finally{I.pendingPublishPromises.delete(i)}}()})}waitUntilEngineConnected(){return this.signalConnectedFuture||(this.signalConnectedFuture=new nC),this.signalConnectedFuture.promise}hasPermissionsToPublish(A){if(!this.permissions)return this.log.warn("no permissions present for publishing track",Object.assign(Object.assign({},this.logContext),Xi(A))),!1;const{canPublish:e,canPublishSources:i}=this.permissions;return e&&(i.length===0||i.map(g=>NRA(g)).includes(A.source))?!0:(this.log.warn("insufficient permissions to publish",Object.assign(Object.assign({},this.logContext),Xi(A))),!1)}publish(A,e,i){return vA(this,void 0,void 0,function*(){var g,I,n,o,a,r,s,B,c,E;if(!this.hasPermissionsToPublish(A))throw new J5("failed to publish track, insufficient permissions",403);Array.from(this.trackPublications.values()).find(R=>UD(A)&&R.source===A.source)&&A.source!==Pe.Source.Unknown&&this.log.info("publishing a second track with the same source: ".concat(A.source),Object.assign(Object.assign({},this.logContext),Xi(A))),e.stopMicTrackOnMute&&Jc(A)&&(A.stopOnMute=!0),A.source===Pe.Source.ScreenShare&&kd()&&(e.simulcast=!1),e.videoCodec==="av1"&&!FRA()&&(e.videoCodec=void 0),e.videoCodec==="vp9"&&!bRA()&&(e.videoCodec=void 0),e.videoCodec===void 0&&(e.videoCodec=YT),this.enabledPublishVideoCodecs.length>0&&(this.enabledPublishVideoCodecs.some(R=>e.videoCodec===vm(R.mime))||(e.videoCodec=vm(this.enabledPublishVideoCodecs[0].mime)));const y=e.videoCodec;A.on(ct.Muted,this.onTrackMuted),A.on(ct.Unmuted,this.onTrackUnmuted),A.on(ct.Ended,this.handleTrackEnded),A.on(ct.UpstreamPaused,this.onTrackUpstreamPaused),A.on(ct.UpstreamResumed,this.onTrackUpstreamResumed),A.on(ct.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate);const S=[],f=!(!((g=e.dtx)!==null&&g!==void 0)||g),M=A.getSourceTrackSettings();M.autoGainControl&&S.push(Eo.TF_AUTO_GAIN_CONTROL),M.echoCancellation&&S.push(Eo.TF_ECHO_CANCELLATION),M.noiseSuppression&&S.push(Eo.TF_NOISE_SUPPRESSION),M.channelCount&&M.channelCount>1&&S.push(Eo.TF_STEREO),f&&S.push(Eo.TF_NO_DTX),ql(A)&&A.hasPreConnectBuffer&&S.push(Eo.TF_PRECONNECT_BUFFER);const k=new S0({cid:A.mediaStreamTrack.id,name:e.name,type:Pe.kindToProto(A.kind),muted:A.isMuted,source:Pe.sourceToProto(A.source),disableDtx:f,encryption:this.encryptionType,stereo:i,disableRed:this.isE2EEEnabled||!(!((I=e.red)!==null&&I!==void 0)||I),stream:e?.stream,backupCodecPolicy:e?.backupCodecPolicy,audioFeatures:S});let m;if(A.kind===Pe.Kind.Video){let R={width:0,height:0};try{R=yield A.waitForDimensions()}catch{const J=(o=(n=this.roomOptions.videoCaptureDefaults)===null||n===void 0?void 0:n.resolution)!==null&&o!==void 0?o:ty.h720.resolution;R={width:J.width,height:J.height},this.log.error("could not determine track dimensions, using defaults",Object.assign(Object.assign(Object.assign({},this.logContext),Xi(A)),{dims:R}))}k.width=R.width,k.height=R.height,BE(A)&&(rB(y)&&(A.source===Pe.Source.ScreenShare&&(e.scalabilityMode="L1T3","contentHint"in A.mediaStreamTrack&&(A.mediaStreamTrack.contentHint="motion",this.log.info("forcing contentHint to motion for screenshare with SVC codecs",Object.assign(Object.assign({},this.logContext),Xi(A))))),e.scalabilityMode=(a=e.scalabilityMode)!==null&&a!==void 0?a:"L3T3_KEY"),k.simulcastCodecs=[new mT({codec:y,cid:A.mediaStreamTrack.id})],e.backupCodec===!0&&(e.backupCodec={codec:YT}),e.backupCodec&&y!==e.backupCodec.codec&&k.encryption===On.NONE&&(this.roomOptions.dynacast||(this.roomOptions.dynacast=!0),k.simulcastCodecs.push(new mT({codec:e.backupCodec.codec,cid:""})))),m=OT(A.source===Pe.Source.ScreenShare,k.width,k.height,e),k.layers=BZ(k.width,k.height,m,rB(e.videoCodec))}else A.kind===Pe.Kind.Audio&&(m=[{maxBitrate:(r=e.audioPreset)===null||r===void 0?void 0:r.maxBitrate,priority:(B=(s=e.audioPreset)===null||s===void 0?void 0:s.priority)!==null&&B!==void 0?B:"high",networkPriority:(E=(c=e.audioPreset)===null||c===void 0?void 0:c.priority)!==null&&E!==void 0?E:"high"}]);if(!this.engine||this.engine.isClosed)throw new rn("cannot publish track when not connected");const U=()=>vA(this,void 0,void 0,function*(){var R,G,J;if(!this.engine.pcManager)throw new rn("pcManager is not ready");if(A.sender=yield this.engine.createSender(A,e,m),this.emit(pt.LocalSenderCreated,A.sender,A),BE(A)&&((R=e.degradationPreference)!==null&&R!==void 0||(e.degradationPreference=OUA(A)),A.setDegradationPreference(e.degradationPreference)),m)if(kd()&&A.kind===Pe.Kind.Audio){let x;for(const H of this.engine.pcManager.publisher.getTransceivers())if(H.sender===A.sender){x=H;break}x&&this.engine.pcManager.publisher.setTrackCodecBitrate({transceiver:x,codec:"opus",maxbr:!((G=m[0])===null||G===void 0)&&G.maxBitrate?m[0].maxBitrate/1e3:0})}else A.codec&&rB(A.codec)&&(!((J=m[0])===null||J===void 0)&&J.maxBitrate)&&this.engine.pcManager.publisher.setTrackCodecBitrate({cid:k.cid,codec:A.codec,maxbr:m[0].maxBitrate/1e3});yield this.engine.negotiate()});let F;const b=new Promise((R,G)=>vA(this,void 0,void 0,function*(){var J;try{F=yield this.engine.addTrack(k),R(F)}catch(x){A.sender&&(!((J=this.engine.pcManager)===null||J===void 0)&&J.publisher)&&(this.engine.pcManager.publisher.removeTrack(A.sender),yield this.engine.negotiate().catch(H=>{this.log.error("failed to negotiate after removing track due to failed add track request",Object.assign(Object.assign(Object.assign({},this.logContext),Xi(A)),{error:H}))})),G(x)}}));if(this.enabledPublishVideoCodecs.length>0)F=(yield Promise.all([b,U()]))[0];else{F=yield b;let R;if(F.codecs.forEach(G=>{R===void 0&&(R=G.mimeType)}),R&&A.kind===Pe.Kind.Video){const G=vm(R);G!==y&&(this.log.debug("falling back to server selected codec",Object.assign(Object.assign(Object.assign({},this.logContext),Xi(A)),{codec:G})),e.videoCodec=G,m=OT(A.source===Pe.Source.ScreenShare,k.width,k.height,e))}yield U()}const K=new jT(A.kind,F,A,{loggerName:this.roomOptions.loggerName,loggerContextCb:()=>this.logContext});if(K.on(ct.CpuConstrained,R=>this.onTrackCpuConstrained(R,K)),K.options=e,A.sid=F.sid,this.log.debug("publishing ".concat(A.kind," with encodings"),Object.assign(Object.assign({},this.logContext),{encodings:m,trackInfo:F})),BE(A)?A.startMonitor(this.engine.client):ql(A)&&A.startMonitor(),this.addTrackPublication(K),this.emit(pt.LocalTrackPublished,K),ql(A)&&F.audioFeatures.includes(Eo.TF_PRECONNECT_BUFFER)){const R=A.getPreConnectBuffer(),G=A.getPreConnectBufferMimeType();this.on(pt.LocalTrackSubscribed,J=>{if(J.trackSid===F.sid){if(!A.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),Xi(A))),A.stopPreConnectBuffer()}}),R&&new Promise((x,H)=>vA(this,void 0,void 0,function*(){var P,j,q,Y,O,$;try{this.log.debug("waiting for agent",Object.assign(Object.assign({},this.logContext),Xi(A)));const sA=setTimeout(()=>{H(new Error("agent not active within 10 seconds"))},1e4),rA=yield this.waitUntilActiveAgentPresent();clearTimeout(sA),this.log.debug("sending preconnect buffer",Object.assign(Object.assign({},this.logContext),Xi(A)));const mA=yield this.streamBytes({name:"preconnect-buffer",mimeType:G,topic:"lk.agent.pre-connect-audio-buffer",destinationIdentities:[rA.identity],attributes:{trackId:K.trackSid,sampleRate:String((O=M.sampleRate)!==null&&O!==void 0?O:"48000"),channels:String(($=M.channelCount)!==null&&$!==void 0?$:"1")}});try{for(var gA=!0,z=Zl(R),X;X=yield z.next(),P=X.done,!P;gA=!0){Y=X.value,gA=!1;const IA=Y;yield mA.write(IA)}}catch(IA){j={error:IA}}finally{try{!gA&&!P&&(q=z.return)&&(yield q.call(z))}finally{if(j)throw j.error}}yield mA.close(),x()}catch(sA){H(sA)}})).then(()=>{this.log.debug("preconnect buffer sent successfully",Object.assign(Object.assign({},this.logContext),Xi(A)))}).catch(x=>{this.log.error("error sending preconnect buffer",Object.assign(Object.assign(Object.assign({},this.logContext),Xi(A)),{error:x}))})}return K})}get isLocal(){return!0}publishAdditionalCodecForTrack(A,e,i){return vA(this,void 0,void 0,function*(){var g;if(this.encryptionType!==On.NONE)return;let I;if(this.trackPublications.forEach(E=>{E.track&&E.track===A&&(I=E)}),!I)throw new Wl("track is not published");if(!BE(A))throw new Wl("track is not a video track");const n=Object.assign(Object.assign({},(g=this.roomOptions)===null||g===void 0?void 0:g.publishDefaults),i),o=TUA(A,e,n);if(!o){this.log.info("backup codec has been disabled, ignoring request to add additional codec for track",Object.assign(Object.assign({},this.logContext),Xi(A)));return}const a=A.addSimulcastTrack(e,o);if(!a)return;const r=new S0({cid:a.mediaStreamTrack.id,type:Pe.kindToProto(A.kind),muted:A.isMuted,source:Pe.sourceToProto(A.source),sid:A.sid,simulcastCodecs:[{codec:n.videoCodec,cid:a.mediaStreamTrack.id}]});if(r.layers=BZ(r.width,r.height,o),!this.engine||this.engine.isClosed)throw new rn("cannot publish track when not connected");const s=()=>vA(this,void 0,void 0,function*(){yield this.engine.createSimulcastSender(A,a,n,o),yield this.engine.negotiate()}),c=(yield Promise.all([this.engine.addTrack(r),s()]))[0];this.log.debug("published ".concat(e," for track ").concat(A.sid),Object.assign(Object.assign({},this.logContext),{encodings:o,trackInfo:c}))})}unpublishTrack(A,e){return vA(this,void 0,void 0,function*(){var i,g;if(UD(A)){const r=this.pendingPublishPromises.get(A);r&&(this.log.info("awaiting publish promise before attempting to unpublish",Object.assign(Object.assign({},this.logContext),Xi(A))),yield r)}const I=this.getPublicationForTrack(A),n=I?Xi(I):void 0;if(this.log.debug("unpublishing track",Object.assign(Object.assign({},this.logContext),n)),!I||!I.track){this.log.warn("track was not unpublished because no publication was found",Object.assign(Object.assign({},this.logContext),n));return}A=I.track,A.off(ct.Muted,this.onTrackMuted),A.off(ct.Unmuted,this.onTrackUnmuted),A.off(ct.Ended,this.handleTrackEnded),A.off(ct.UpstreamPaused,this.onTrackUpstreamPaused),A.off(ct.UpstreamResumed,this.onTrackUpstreamResumed),A.off(ct.AudioTrackFeatureUpdate,this.onTrackFeatureUpdate),e===void 0&&(e=(g=(i=this.roomOptions)===null||i===void 0?void 0:i.stopLocalTrackOnUnpublish)!==null&&g!==void 0?g:!0),e?A.stop():A.stopMonitor();let o=!1;const a=A.sender;if(A.sender=void 0,this.engine.pcManager&&this.engine.pcManager.currentState<VI.FAILED&&a)try{for(const r of this.engine.pcManager.publisher.getTransceivers())r.sender===a&&(r.direction="inactive",o=!0);if(this.engine.removeTrack(a)&&(o=!0),BE(A)){for(const[,r]of A.simulcastCodecs)r.sender&&(this.engine.removeTrack(r.sender)&&(o=!0),r.sender=void 0);A.simulcastCodecs.clear()}}catch(r){this.log.warn("failed to unpublish track",Object.assign(Object.assign(Object.assign({},this.logContext),n),{error:r}))}switch(this.trackPublications.delete(I.trackSid),I.kind){case Pe.Kind.Audio:this.audioTrackPublications.delete(I.trackSid);break;case Pe.Kind.Video:this.videoTrackPublications.delete(I.trackSid);break}return this.emit(pt.LocalTrackUnpublished,I),I.setTrack(void 0),o&&(yield this.engine.negotiate()),I})}unpublishTracks(A){return vA(this,void 0,void 0,function*(){return(yield Promise.all(A.map(i=>this.unpublishTrack(i)))).filter(i=>!!i)})}republishAllTracks(A){return vA(this,arguments,void 0,function(e){var i=this;let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return function*(){i.republishPromise&&(yield i.republishPromise),i.republishPromise=new Nr((I,n)=>vA(i,void 0,void 0,function*(){try{const o=[];this.trackPublications.forEach(a=>{a.track&&(e&&(a.options=Object.assign(Object.assign({},a.options),e)),o.push(a))}),yield Promise.all(o.map(a=>vA(this,void 0,void 0,function*(){const r=a.track;yield this.unpublishTrack(r,!1),g&&!r.isMuted&&r.source!==Pe.Source.ScreenShare&&r.source!==Pe.Source.ScreenShareAudio&&(ql(r)||BE(r))&&!r.isUserProvided&&(this.log.debug("restarting existing track",Object.assign(Object.assign({},this.logContext),{track:a.trackSid})),yield r.restartTrack()),yield this.publishOrRepublishTrack(r,a.options,!0)}))),I()}catch(o){o instanceof Error?n(o):n(new Error(String(o)))}finally{this.republishPromise=void 0}})),yield i.republishPromise}()})}publishData(A){return vA(this,arguments,void 0,function(e){var i=this;let g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};return function*(){const I=g.reliable?Wi.RELIABLE:Wi.LOSSY,n=g.destinationIdentities,o=g.topic;let a=new qH({participantIdentity:i.identity,payload:e,destinationIdentities:n,topic:o});const r=new Wa({kind:I,value:{case:"user",value:a}});yield i.engine.sendDataPacket(r,I)}()})}publishDtmf(A,e){return vA(this,void 0,void 0,function*(){const i=new Wa({kind:Wi.RELIABLE,value:{case:"sipDtmf",value:new veA({code:A,digit:e})}});yield this.engine.sendDataPacket(i,Wi.RELIABLE)})}sendChatMessage(A,e){return vA(this,void 0,void 0,function*(){const i={id:crypto.randomUUID(),message:A,timestamp:Date.now(),attachedFiles:e?.attachments},g=new Wa({value:{case:"chatMessage",value:new JU(Object.assign(Object.assign({},i),{timestamp:RI.parse(i.timestamp)}))}});return yield this.engine.sendDataPacket(g,Wi.RELIABLE),this.emit(pt.ChatMessage,i),i})}editChatMessage(A,e){return vA(this,void 0,void 0,function*(){const i=Object.assign(Object.assign({},e),{message:A,editTimestamp:Date.now()}),g=new Wa({value:{case:"chatMessage",value:new JU(Object.assign(Object.assign({},i),{timestamp:RI.parse(i.timestamp),editTimestamp:RI.parse(i.editTimestamp)}))}});return yield this.engine.sendDataPacket(g,Wi.RELIABLE),this.emit(pt.ChatMessage,i),i})}sendText(A,e){return vA(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendText(A,e)})}streamText(A){return vA(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamText(A)})}sendFile(A,e){return vA(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.sendFile(A,e)})}streamBytes(A){return vA(this,void 0,void 0,function*(){return this.roomOutgoingDataStreamManager.streamBytes(A)})}performRpc(A){let{destinationIdentity:e,method:i,payload:g,responseTimeout:I=15e3}=A;const n=7e3,o=n+1e3;return new Nr((a,r)=>vA(this,void 0,void 0,function*(){var s,B,c,E;if(IO(g)>OtA){r(za.builtIn("REQUEST_PAYLOAD_TOO_LARGE"));return}if(!((B=(s=this.engine.latestJoinResponse)===null||s===void 0?void 0:s.serverInfo)===null||B===void 0)&&B.version&&Pc((E=(c=this.engine.latestJoinResponse)===null||c===void 0?void 0:c.serverInfo)===null||E===void 0?void 0:E.version,"1.8.0")<0){r(za.builtIn("UNSUPPORTED_SERVER"));return}const D=Math.max(I,o),y=crypto.randomUUID();yield this.publishRpcRequest(e,y,i,g,D);const S=setTimeout(()=>{this.pendingAcks.delete(y),r(za.builtIn("CONNECTION_TIMEOUT")),this.pendingResponses.delete(y),clearTimeout(f)},n);this.pendingAcks.set(y,{resolve:()=>{clearTimeout(S)},participantIdentity:e});const f=setTimeout(()=>{this.pendingResponses.delete(y),r(za.builtIn("RESPONSE_TIMEOUT"))},I);this.pendingResponses.set(y,{resolve:(M,k)=>{clearTimeout(f),this.pendingAcks.has(y)&&(this.log.warn("RPC response received before ack",y),this.pendingAcks.delete(y),clearTimeout(S)),k?r(k):a(M??"")},participantIdentity:e})}))}registerRpcMethod(A,e){this.rpcHandlers.has(A)&&this.log.warn("you're overriding the RPC handler for method ".concat(A,", in the future this will throw an error")),this.rpcHandlers.set(A,e)}unregisterRpcMethod(A){this.rpcHandlers.delete(A)}setTrackSubscriptionPermissions(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:[];this.participantTrackPermissions=e,this.allParticipantsAllowedToSubscribe=A,this.engine.client.isDisconnected||this.updateTrackSubscriptionPermissions()}handleIncomingRpcAck(A){const e=this.pendingAcks.get(A);e&&(e.resolve(),this.pendingAcks.delete(A))}handleIncomingRpcResponse(A,e,i){const g=this.pendingResponses.get(A);g&&(g.resolve(e,i),this.pendingResponses.delete(A))}publishRpcRequest(A,e,i,g,I){return vA(this,void 0,void 0,function*(){const n=new Wa({destinationIdentities:[A],kind:Wi.RELIABLE,value:{case:"rpcRequest",value:new xH({id:e,method:i,payload:g,responseTimeoutMs:I,version:1})}});yield this.engine.sendDataPacket(n,Wi.RELIABLE)})}handleParticipantDisconnected(A){for(const[e,{participantIdentity:i}]of this.pendingAcks)i===A&&this.pendingAcks.delete(e);for(const[e,{participantIdentity:i,resolve:g}]of this.pendingResponses)i===A&&(g(null,za.builtIn("RECIPIENT_DISCONNECTED")),this.pendingResponses.delete(e))}setEnabledPublishCodecs(A){this.enabledPublishVideoCodecs=A.filter(e=>e.mime.split("/")[0].toLowerCase()==="video")}updateInfo(A){return super.updateInfo(A)?(A.tracks.forEach(e=>{var i,g;const I=this.trackPublications.get(e.sid);if(I){const n=I.isMuted||((g=(i=I.track)===null||i===void 0?void 0:i.isUpstreamPaused)!==null&&g!==void 0?g:!1);n!==e.muted&&(this.log.debug("updating server mute state after reconcile",Object.assign(Object.assign(Object.assign({},this.logContext),Xi(I)),{mutedOnServer:n})),this.engine.client.sendMuteTrack(e.sid,n))}}),!0):!1}setActiveAgent(A){var e,i,g,I;this.firstActiveAgent=A,A&&!this.firstActiveAgent&&(this.firstActiveAgent=A),A?(i=(e=this.activeAgentFuture)===null||e===void 0?void 0:e.resolve)===null||i===void 0||i.call(e,A):(I=(g=this.activeAgentFuture)===null||g===void 0?void 0:g.reject)===null||I===void 0||I.call(g,new Error("Agent disconnected")),this.activeAgentFuture=void 0}waitUntilActiveAgentPresent(){return this.firstActiveAgent?Promise.resolve(this.firstActiveAgent):(this.activeAgentFuture||(this.activeAgentFuture=new nC),this.activeAgentFuture.promise)}getPublicationForTrack(A){let e;return this.trackPublications.forEach(i=>{const g=i.track;g&&(A instanceof MediaStreamTrack?(ql(g)||BE(g))&&g.mediaStreamTrack===A&&(e=i):A===g&&(e=i))}),e}waitForPendingPublicationOfSource(A){return vA(this,void 0,void 0,function*(){const i=Date.now();for(;Date.now()<i+1e4;){const g=Array.from(this.pendingPublishPromises.entries()).find(I=>{let[n]=I;return n.source===A});if(g)return g[1];yield Oo(20)}})}}class cKA extends Hl{constructor(A,e,i,g){super(A,e.sid,e.name,g),this.track=void 0,this.allowed=!0,this.requestedDisabled=void 0,this.visible=!0,this.handleEnded=I=>{this.setTrack(void 0),this.emit(ct.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=i,this.updateInfo(e)}setSubscribed(A){const e=this.subscriptionStatus,i=this.permissionStatus;this.subscribed=A,A&&(this.allowed=!0);const g=new eb({trackSids:[this.trackSid],subscribe:this.subscribed,participantTracks:[new JeA({participantSid:"",trackSids:[this.trackSid]})]});this.emit(ct.UpdateSubscription,g),this.emitSubscriptionUpdateIfChanged(e),this.emitPermissionUpdateIfChanged(i)}get subscriptionStatus(){return this.subscribed===!1?Hl.SubscriptionStatus.Unsubscribed:super.isSubscribed?Hl.SubscriptionStatus.Subscribed:Hl.SubscriptionStatus.Desired}get permissionStatus(){return this.allowed?Hl.PermissionStatus.Allowed:Hl.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(A){!this.isManualOperationAllowed()||this.requestedDisabled===!A||(this.requestedDisabled=!A,this.emitTrackUpdate())}setVideoQuality(A){!this.isManualOperationAllowed()||this.requestedMaxQuality===A||(this.requestedMaxQuality=A,this.requestedVideoDimensions=void 0,this.emitTrackUpdate())}setVideoDimensions(A){var e,i;this.isManualOperationAllowed()&&(((e=this.requestedVideoDimensions)===null||e===void 0?void 0:e.width)===A.width&&((i=this.requestedVideoDimensions)===null||i===void 0?void 0:i.height)===A.height||(WJ(this.track)&&(this.requestedVideoDimensions=A),this.requestedMaxQuality=void 0,this.emitTrackUpdate()))}setVideoFPS(A){this.isManualOperationAllowed()&&WJ(this.track)&&this.fps!==A&&(this.fps=A,this.emitTrackUpdate())}get videoQuality(){var A;return(A=this.requestedMaxQuality)!==null&&A!==void 0?A:ss.HIGH}setTrack(A){const e=this.subscriptionStatus,i=this.permissionStatus,g=this.track;g!==A&&(g&&(g.off(ct.VideoDimensionsChanged,this.handleVideoDimensionsChange),g.off(ct.VisibilityChanged,this.handleVisibilityChange),g.off(ct.Ended,this.handleEnded),g.detach(),g.stopMonitor(),this.emit(ct.Unsubscribed,g)),super.setTrack(A),A&&(A.sid=this.trackSid,A.on(ct.VideoDimensionsChanged,this.handleVideoDimensionsChange),A.on(ct.VisibilityChanged,this.handleVisibilityChange),A.on(ct.Ended,this.handleEnded),this.emit(ct.Subscribed,A)),this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(e))}setAllowed(A){const e=this.subscriptionStatus,i=this.permissionStatus;this.allowed=A,this.emitPermissionUpdateIfChanged(i),this.emitSubscriptionUpdateIfChanged(e)}setSubscriptionError(A){this.emit(ct.SubscriptionFailed,A)}updateInfo(A){super.updateInfo(A);const e=this.metadataMuted;this.metadataMuted=A.muted,this.track?this.track.setMuted(A.muted):e!==A.muted&&this.emit(A.muted?ct.Muted:ct.Unmuted)}emitSubscriptionUpdateIfChanged(A){const e=this.subscriptionStatus;A!==e&&this.emit(ct.SubscriptionStatusChanged,e,A)}emitPermissionUpdateIfChanged(A){this.permissionStatus!==A&&this.emit(ct.SubscriptionPermissionChanged,this.permissionStatus,A)}isManualOperationAllowed(){return this.isDesired?!0:(this.log.warn("cannot update track settings when not subscribed",this.logContext),!1)}get isAdaptiveStream(){return WJ(this.track)&&this.track.isAdaptiveStream}emitTrackUpdate(){const A=new jeA({trackSids:[this.trackSid],disabled:!this.isEnabled,fps:this.fps});if(this.kind===Pe.Kind.Video){let e=this.requestedVideoDimensions;if(this.videoDimensionsAdaptiveStream!==void 0)if(e)x5(this.videoDimensionsAdaptiveStream,e)&&(this.log.debug("using adaptive stream dimensions instead of requested",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),e=this.videoDimensionsAdaptiveStream);else if(this.requestedMaxQuality!==void 0&&this.trackInfo){const i=GRA(this.trackInfo,this.requestedMaxQuality);i&&x5(this.videoDimensionsAdaptiveStream,i)&&(this.log.debug("using adaptive stream dimensions instead of max quality layer",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),e=this.videoDimensionsAdaptiveStream)}else this.log.debug("using adaptive stream dimensions",Object.assign(Object.assign({},this.logContext),this.videoDimensionsAdaptiveStream)),e=this.videoDimensionsAdaptiveStream;e?(A.width=Math.ceil(e.width),A.height=Math.ceil(e.height)):this.requestedMaxQuality!==void 0?(this.log.debug("using requested max quality",Object.assign(Object.assign({},this.logContext),{quality:this.requestedMaxQuality})),A.quality=this.requestedMaxQuality):(this.log.debug("using default quality",Object.assign(Object.assign({},this.logContext),{quality:ss.HIGH})),A.quality=ss.HIGH)}this.emit(ct.UpdateSettings,A)}}class OU extends XtA{static fromParticipantInfo(A,e,i){return new OU(A,e.sid,e.identity,e.name,e.metadata,e.attributes,i,e.kind)}get logContext(){return Object.assign(Object.assign({},super.logContext),{rpID:this.sid,remoteParticipant:this.identity})}constructor(A,e,i,g,I,n,o){let a=arguments.length>7&&arguments[7]!==void 0?arguments[7]:y0.STANDARD;super(e,i||"",g,I,n,o,a),this.signalClient=A,this.trackPublications=new Map,this.audioTrackPublications=new Map,this.videoTrackPublications=new Map,this.volumeMap=new Map}addTrackPublication(A){super.addTrackPublication(A),A.on(ct.UpdateSettings,e=>{this.log.debug("send update settings",Object.assign(Object.assign(Object.assign({},this.logContext),Xi(A)),{settings:e})),this.signalClient.sendUpdateTrackSettings(e)}),A.on(ct.UpdateSubscription,e=>{e.participantTracks.forEach(i=>{i.participantSid=this.sid}),this.signalClient.sendUpdateSubscription(e)}),A.on(ct.SubscriptionPermissionChanged,e=>{this.emit(pt.TrackSubscriptionPermissionChanged,A,e)}),A.on(ct.SubscriptionStatusChanged,e=>{this.emit(pt.TrackSubscriptionStatusChanged,A,e)}),A.on(ct.Subscribed,e=>{this.emit(pt.TrackSubscribed,e,A)}),A.on(ct.Unsubscribed,e=>{this.emit(pt.TrackUnsubscribed,e,A)}),A.on(ct.SubscriptionFailed,e=>{this.emit(pt.TrackSubscriptionFailed,A.trackSid,e)})}getTrackPublication(A){const e=super.getTrackPublication(A);if(e)return e}getTrackPublicationByName(A){const e=super.getTrackPublicationByName(A);if(e)return e}setVolume(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:Pe.Source.Microphone;this.volumeMap.set(e,A);const i=this.getTrackPublication(e);i&&i.track&&i.track.setVolume(A)}getVolume(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:Pe.Source.Microphone;const e=this.getTrackPublication(A);return e&&e.track?e.track.getVolume():this.volumeMap.get(A)}addSubscribedMediaTrack(A,e,i,g,I,n){let o=this.getTrackPublicationBySid(e);if(o||e.startsWith("TR")||this.trackPublications.forEach(s=>{!o&&A.kind===s.kind.toString()&&(o=s)}),!o){if(n===0){this.log.error("could not find published track",Object.assign(Object.assign({},this.logContext),{trackSid:e})),this.emit(pt.TrackSubscriptionFailed,e);return}n===void 0&&(n=20),setTimeout(()=>{this.addSubscribedMediaTrack(A,e,i,g,I,n-1)},150);return}if(A.readyState==="ended"){this.log.error("unable to subscribe because MediaStreamTrack is ended. Do not call MediaStreamTrack.stop()",Object.assign(Object.assign({},this.logContext),Xi(o))),this.emit(pt.TrackSubscriptionFailed,e);return}const a=A.kind==="video";let r;return a?r=new nKA(A,e,g,I):r=new IKA(A,e,g,this.audioContext,this.audioOutput),r.source=o.source,r.isMuted=o.isMuted,r.setMediaStream(i),r.start(),o.setTrack(r),this.volumeMap.has(o.source)&&xT(r)&&Jc(r)&&r.setVolume(this.volumeMap.get(o.source)),o}get hasMetadata(){return!!this.participantInfo}getTrackPublicationBySid(A){return this.trackPublications.get(A)}updateInfo(A){if(!super.updateInfo(A))return!1;const e=new Map,i=new Map;return A.tracks.forEach(g=>{var I,n;let o=this.getTrackPublicationBySid(g.sid);if(o)o.updateInfo(g);else{const a=Pe.kindFromProto(g.type);if(!a)return;o=new cKA(a,g,(I=this.signalClient.connectOptions)===null||I===void 0?void 0:I.autoSubscribe,{loggerContextCb:()=>this.logContext,loggerName:(n=this.loggerOptions)===null||n===void 0?void 0:n.loggerName}),o.updateInfo(g),i.set(g.sid,o);const r=Array.from(this.trackPublications.values()).find(s=>s.source===o?.source);r&&o.source!==Pe.Source.Unknown&&this.log.debug("received a second track publication for ".concat(this.identity," with the same source: ").concat(o.source),Object.assign(Object.assign({},this.logContext),{oldTrack:Xi(r),newTrack:Xi(o)})),this.addTrackPublication(o)}e.set(g.sid,o)}),this.trackPublications.forEach(g=>{e.has(g.trackSid)||(this.log.trace("detected removed track on remote participant, unpublishing",Object.assign(Object.assign({},this.logContext),Xi(g))),this.unpublishTrack(g.trackSid,!0))}),i.forEach(g=>{this.emit(pt.TrackPublished,g)}),!0}unpublishTrack(A,e){const i=this.trackPublications.get(A);if(!i)return;const{track:g}=i;switch(g&&(g.stop(),i.setTrack(void 0)),this.trackPublications.delete(A),i.kind){case Pe.Kind.Audio:this.audioTrackPublications.delete(A);break;case Pe.Kind.Video:this.videoTrackPublications.delete(A);break}e&&this.emit(pt.TrackUnpublished,i)}setAudioOutput(A){return vA(this,void 0,void 0,function*(){this.audioOutput=A;const e=[];this.audioTrackPublications.forEach(i=>{var g;Jc(i.track)&&xT(i.track)&&e.push(i.track.setSinkId((g=A.deviceId)!==null&&g!==void 0?g:"default"))}),yield Promise.all(e)})}emit(A){for(var e=arguments.length,i=new Array(e>1?e-1:0),g=1;g<e;g++)i[g-1]=arguments[g];return this.log.trace("participant event",Object.assign(Object.assign({},this.logContext),{event:A,args:i})),super.emit(A,...i)}}var ug;(function(t){t.Disconnected="disconnected",t.Connecting="connecting",t.Connected="connected",t.Reconnecting="reconnecting",t.SignalReconnecting="signalReconnecting"})(ug||(ug={}));const lKA=4*1e3;class gy extends zc.EventEmitter{get hasE2EESetup(){return this.e2eeManager!==void 0}constructor(A){var e,i,g,I,n;if(super(),e=this,this.state=ug.Disconnected,this.activeSpeakers=[],this.isE2EEEnabled=!1,this.audioEnabled=!0,this.isVideoPlaybackBlocked=!1,this.log=Ji,this.bufferedEvents=[],this.isResuming=!1,this.rpcHandlers=new Map,this.connect=(o,a,r)=>vA(this,void 0,void 0,function*(){var s;if(!vRA())throw Oc()?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 B=yield this.disconnectLock.lock();if(this.state===ug.Connected)return this.log.info("already connected to room ".concat(this.name),this.logContext),B(),Promise.resolve();if(this.connectFuture)return B(),this.connectFuture.promise;this.setAndEmitConnectionState(ug.Connecting),((s=this.regionUrlProvider)===null||s===void 0?void 0:s.getServerUrl().toString())!==xtA(o)&&(this.regionUrl=void 0,this.regionUrlProvider=void 0),iy(new URL(o))&&(this.regionUrlProvider===void 0?this.regionUrlProvider=new Sg(o,a):this.regionUrlProvider.updateToken(a),this.regionUrlProvider.fetchRegionSettings().then(D=>{var y;(y=this.regionUrlProvider)===null||y===void 0||y.setServerReportedRegions(D)}).catch(D=>{this.log.warn("could not fetch region settings",Object.assign(Object.assign({},this.logContext),{error:D}))}));const c=(D,y,S)=>vA(this,void 0,void 0,function*(){var f,M;this.abortController&&this.abortController.abort();const k=new AbortController;this.abortController=k,B?.();try{if(yield KD.getInstance().getBackOffPromise(o),k.signal.aborted)throw Ii.cancelled("Connection attempt aborted");yield this.attemptConnection(S??o,a,r,k),this.abortController=void 0,D()}catch(m){if(this.regionUrlProvider&&m instanceof Ii&&m.reason!==BI.Cancelled&&m.reason!==BI.NotAllowed){let U=null;try{this.log.debug("Fetching next region"),U=yield this.regionUrlProvider.getNextBestRegionUrl((f=this.abortController)===null||f===void 0?void 0:f.signal)}catch(F){if(F instanceof Ii&&(F.status===401||F.reason===BI.Cancelled)){this.handleDisconnect(this.options.stopLocalTrackOnUnpublish),y(F);return}}[BI.InternalError,BI.ServerUnreachable,BI.Timeout].includes(m.reason)&&(this.log.debug("Adding failed connection attempt to back off"),KD.getInstance().addFailedConnectionAttempt(o)),U&&!(!((M=this.abortController)===null||M===void 0)&&M.signal.aborted)?(this.log.info("Initial connection failed with ConnectionError: ".concat(m.message,". Retrying with another region: ").concat(U),this.logContext),this.recreateEngine(),yield c(D,y,U)):(this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,Z5(m)),y(m))}else{let U=cB.UNKNOWN_REASON;m instanceof Ii&&(U=Z5(m)),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,U),y(m)}}}),E=this.regionUrl;return this.regionUrl=void 0,this.connectFuture=new nC((D,y)=>{c(D,y,E)},()=>{this.clearConnectionFutures()}),this.connectFuture.promise}),this.connectSignal=(o,a,r,s,B,c)=>vA(this,void 0,void 0,function*(){var E,D,y;const S=yield r.join(o,a,{autoSubscribe:s.autoSubscribe,adaptiveStream:typeof B.adaptiveStream=="object"?!0:B.adaptiveStream,maxRetries:s.maxRetries,e2eeEnabled:!!this.e2eeManager,websocketTimeout:s.websocketTimeout},c.signal,!B.singlePeerConnection);let f=S.serverInfo;if(f||(f={version:S.serverVersion,region:S.serverRegion}),this.serverInfo=f,this.log.debug("connected to Livekit Server ".concat(Object.entries(f).map(M=>{let[k,m]=M;return"".concat(k,": ").concat(m)}).join(", ")),{room:(E=S.room)===null||E===void 0?void 0:E.name,roomSid:(D=S.room)===null||D===void 0?void 0:D.sid,identity:(y=S.participant)===null||y===void 0?void 0:y.identity}),!f.version)throw new hRA("unknown server version");return f.version==="0.15.1"&&this.options.dynacast&&(this.log.debug("disabling dynacast due to server version",this.logContext),B.dynacast=!1),S}),this.applyJoinResponse=o=>{const a=o.participant;if(this.localParticipant.sid=a.sid,this.localParticipant.identity=a.identity,this.localParticipant.setEnabledPublishCodecs(o.enabledPublishCodecs),this.e2eeManager)try{this.e2eeManager.setSifTrailer(o.sifTrailer)}catch(r){this.log.error(r instanceof Error?r.message:"Could not set SifTrailer",Object.assign(Object.assign({},this.logContext),{error:r}))}this.handleParticipantUpdates([a,...o.otherParticipants]),o.room&&this.handleRoomUpdate(o.room)},this.attemptConnection=(o,a,r,s)=>vA(this,void 0,void 0,function*(){var B,c;this.state===ug.Reconnecting||this.isResuming||!((B=this.engine)===null||B===void 0)&&B.pendingReconnect?(this.log.info("Reconnection attempt replaced by new connection attempt",this.logContext),this.recreateEngine()):this.maybeCreateEngine(),!((c=this.regionUrlProvider)===null||c===void 0)&&c.isCloud()&&this.engine.setRegionUrlProvider(this.regionUrlProvider),this.acquireAudioContext(),this.connOptions=Object.assign(Object.assign({},gO),r),this.connOptions.rtcConfig&&(this.engine.rtcConfig=this.connOptions.rtcConfig),this.connOptions.peerConnectionTimeout&&(this.engine.peerConnectionTimeout=this.connOptions.peerConnectionTimeout);try{const E=yield this.connectSignal(o,a,this.engine,this.connOptions,this.options,s);this.applyJoinResponse(E),this.setupLocalParticipantEvents(),this.emit(et.SignalConnected)}catch(E){yield this.engine.close(),this.recreateEngine();const D=s.signal.aborted?Ii.cancelled("Signal connection aborted"):Ii.serverUnreachable("could not establish signal connection");throw E instanceof Error&&(D.message="".concat(D.message,": ").concat(E.message)),E instanceof Ii&&(D.reason=E.reason,D.status=E.status),this.log.debug("error trying to establish signal connection",Object.assign(Object.assign({},this.logContext),{error:E})),D}if(s.signal.aborted)throw yield this.engine.close(),this.recreateEngine(),Ii.cancelled("Connection attempt aborted");try{yield this.engine.waitForPCInitialConnection(this.connOptions.peerConnectionTimeout,s)}catch(E){throw yield this.engine.close(),this.recreateEngine(),E}Gr()&&this.options.disconnectOnPageLeave&&(window.addEventListener("pagehide",this.onPageLeave),window.addEventListener("beforeunload",this.onPageLeave)),Gr()&&window.addEventListener("freeze",this.onPageLeave),this.setAndEmitConnectionState(ug.Connected),this.emit(et.Connected),KD.getInstance().resetFailedConnectionAttempts(o),this.registerConnectionReconcile(),this.regionUrlProvider&&this.regionUrlProvider.notifyConnected()}),this.disconnect=function(){for(var o=arguments.length,a=new Array(o),r=0;r<o;r++)a[r]=arguments[r];return vA(e,[...a],void 0,function(){var s=this;let B=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0;return function*(){var c,E,D;const y=yield s.disconnectLock.lock();try{if(s.state===ug.Disconnected){s.log.debug("already disconnected",s.logContext);return}if(s.log.info("disconnect from room",Object.assign({},s.logContext)),s.state===ug.Connecting||s.state===ug.Reconnecting||s.isResuming){const S="Abort connection attempt due to user initiated disconnect";s.log.warn(S,s.logContext),(c=s.abortController)===null||c===void 0||c.abort(S),(D=(E=s.connectFuture)===null||E===void 0?void 0:E.reject)===null||D===void 0||D.call(E,Ii.cancelled("Client initiated disconnect")),s.connectFuture=void 0}s.engine&&(s.engine.client.isDisconnected||(yield s.engine.client.sendLeave()),yield s.engine.close()),s.handleDisconnect(B,cB.CLIENT_INITIATED),s.engine=void 0}finally{y()}}()})},this.onPageLeave=()=>vA(this,void 0,void 0,function*(){this.log.info("Page leave detected, disconnecting",this.logContext),yield this.disconnect()}),this.startAudio=()=>vA(this,void 0,void 0,function*(){const o=[],a=Ur();if(a&&a.os==="iOS"){const r="livekit-dummy-audio-el";let s=document.getElementById(r);if(!s){s=document.createElement("audio"),s.id=r,s.autoplay=!0,s.hidden=!0;const B=ZJ();B.enabled=!0;const c=new MediaStream([B]);s.srcObject=c,document.addEventListener("visibilitychange",()=>{s&&(s.srcObject=document.hidden?null:c,document.hidden||(this.log.debug("page visible again, triggering startAudio to resume playback and update playback status",this.logContext),this.startAudio()))}),document.body.append(s),this.once(et.Disconnected,()=>{s?.remove(),s=null})}o.push(s)}this.remoteParticipants.forEach(r=>{r.audioTrackPublications.forEach(s=>{s.track&&s.track.attachedElements.forEach(B=>{o.push(B)})})});try{yield Promise.all([this.acquireAudioContext(),...o.map(r=>(r.muted=!1,r.play()))]),this.handleAudioPlaybackStarted()}catch(r){throw this.handleAudioPlaybackFailed(r),r}}),this.startVideo=()=>vA(this,void 0,void 0,function*(){const o=[];for(const a of this.remoteParticipants.values())a.videoTrackPublications.forEach(r=>{var s;(s=r.track)===null||s===void 0||s.attachedElements.forEach(B=>{o.includes(B)||o.push(B)})});yield Promise.all(o.map(a=>a.play())).then(()=>{this.handleVideoPlaybackStarted()}).catch(a=>{a.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 o of this.remoteParticipants.values())this.handleParticipantDisconnected(o.identity,o);this.setAndEmitConnectionState(ug.Reconnecting)&&this.emit(et.Reconnecting)},this.handleSignalRestarted=o=>vA(this,void 0,void 0,function*(){this.log.debug("signal reconnected to server, region ".concat(o.serverRegion),Object.assign(Object.assign({},this.logContext),{region:o.serverRegion})),this.bufferedEvents=[],this.applyJoinResponse(o);try{yield this.localParticipant.republishAllTracks(void 0,!0)}catch(a){this.log.error("error trying to re-publish tracks after reconnection",Object.assign(Object.assign({},this.logContext),{error:a}))}try{yield this.engine.waitForRestarted(),this.log.debug("fully reconnected to server",Object.assign(Object.assign({},this.logContext),{region:o.serverRegion}))}catch{return}this.setAndEmitConnectionState(ug.Connected),this.emit(et.Reconnected),this.registerConnectionReconcile(),this.emitBufferedEvents()}),this.handleParticipantUpdates=o=>{o.forEach(a=>{var r;if(a.identity===this.localParticipant.identity){this.localParticipant.updateInfo(a);return}a.identity===""&&(a.identity=(r=this.sidToIdentity.get(a.sid))!==null&&r!==void 0?r:"");let s=this.remoteParticipants.get(a.identity);a.state===kD.DISCONNECTED?this.handleParticipantDisconnected(a.identity,s):s=this.getOrCreateParticipant(a.identity,a)})},this.handleActiveSpeakersUpdate=o=>{const a=[],r={};o.forEach(s=>{if(r[s.sid]=!0,s.sid===this.localParticipant.sid)this.localParticipant.audioLevel=s.level,this.localParticipant.setIsSpeaking(!0),a.push(this.localParticipant);else{const B=this.getRemoteParticipantBySid(s.sid);B&&(B.audioLevel=s.level,B.setIsSpeaking(!0),a.push(B))}}),r[this.localParticipant.sid]||(this.localParticipant.audioLevel=0,this.localParticipant.setIsSpeaking(!1)),this.remoteParticipants.forEach(s=>{r[s.sid]||(s.audioLevel=0,s.setIsSpeaking(!1))}),this.activeSpeakers=a,this.emitWhenConnected(et.ActiveSpeakersChanged,a)},this.handleSpeakersChanged=o=>{const a=new Map;this.activeSpeakers.forEach(s=>{const B=this.remoteParticipants.get(s.identity);B&&B.sid!==s.sid||a.set(s.sid,s)}),o.forEach(s=>{let B=this.getRemoteParticipantBySid(s.sid);s.sid===this.localParticipant.sid&&(B=this.localParticipant),B&&(B.audioLevel=s.level,B.setIsSpeaking(s.active),s.active?a.set(s.sid,B):a.delete(s.sid))});const r=Array.from(a.values());r.sort((s,B)=>B.audioLevel-s.audioLevel),this.activeSpeakers=r,this.emitWhenConnected(et.ActiveSpeakersChanged,r)},this.handleStreamStateUpdate=o=>{o.streamStates.forEach(a=>{const r=this.getRemoteParticipantBySid(a.participantSid);if(!r)return;const s=r.getTrackPublicationBySid(a.trackSid);if(!s||!s.track)return;const B=Pe.streamStateFromProto(a.state);s.track.setStreamState(B),B!==s.track.streamState&&(r.emit(pt.TrackStreamStateChanged,s,s.track.streamState),this.emitWhenConnected(et.TrackStreamStateChanged,s,s.track.streamState,r))})},this.handleSubscriptionPermissionUpdate=o=>{const a=this.getRemoteParticipantBySid(o.participantSid);if(!a)return;const r=a.getTrackPublicationBySid(o.trackSid);r&&r.setAllowed(o.allowed)},this.handleSubscriptionError=o=>{const a=Array.from(this.remoteParticipants.values()).find(s=>s.trackPublications.has(o.trackSid));if(!a)return;const r=a.getTrackPublicationBySid(o.trackSid);r&&r.setSubscriptionError(o.err)},this.handleDataPacket=(o,a)=>{const r=this.remoteParticipants.get(o.participantIdentity);if(o.value.case==="user")this.handleUserPacket(r,o.value.value,o.kind,a);else if(o.value.case==="transcription")this.handleTranscription(r,o.value.value);else if(o.value.case==="sipDtmf")this.handleSipDtmf(r,o.value.value);else if(o.value.case==="chatMessage")this.handleChatMessage(r,o.value.value);else if(o.value.case==="metrics")this.handleMetrics(o.value.value,r);else if(o.value.case==="streamHeader"||o.value.case==="streamChunk"||o.value.case==="streamTrailer")this.handleDataStream(o,a);else if(o.value.case==="rpcRequest"){const s=o.value.value;this.handleIncomingRpcRequest(o.participantIdentity,s.id,s.method,s.payload,s.responseTimeoutMs,s.version)}},this.handleUserPacket=(o,a,r,s)=>{this.emit(et.DataReceived,a.payload,o,r,a.topic,s),o?.emit(pt.DataReceived,a.payload,r,s)},this.handleSipDtmf=(o,a)=>{this.emit(et.SipDTMFReceived,a,o),o?.emit(pt.SipDTMFReceived,a)},this.handleTranscription=(o,a)=>{const r=a.transcribedParticipantIdentity===this.localParticipant.identity?this.localParticipant:this.getParticipantByIdentity(a.transcribedParticipantIdentity),s=r?.trackPublications.get(a.trackId),B=ORA(a,this.transcriptionReceivedTimes);s?.emit(ct.TranscriptionReceived,B),r?.emit(pt.TranscriptionReceived,B,s),this.emit(et.TranscriptionReceived,B,r,s)},this.handleChatMessage=(o,a)=>{const r=PRA(a);this.emit(et.ChatMessage,r,o)},this.handleMetrics=(o,a)=>{this.emit(et.MetricsReceived,o,a)},this.handleDataStream=(o,a)=>{this.incomingDataStreamManager.handleDataStreamPacket(o,a)},this.bufferedSegments=new Map,this.handleAudioPlaybackStarted=()=>{this.canPlaybackAudio||(this.audioEnabled=!0,this.emit(et.AudioPlaybackStatusChanged,!0))},this.handleAudioPlaybackFailed=o=>{this.log.warn("could not playback audio",Object.assign(Object.assign({},this.logContext),{error:o})),this.canPlaybackAudio&&(this.audioEnabled=!1,this.emit(et.AudioPlaybackStatusChanged,!1))},this.handleVideoPlaybackStarted=()=>{this.isVideoPlaybackBlocked&&(this.isVideoPlaybackBlocked=!1,this.emit(et.VideoPlaybackStatusChanged,!0))},this.handleVideoPlaybackFailed=()=>{this.isVideoPlaybackBlocked||(this.isVideoPlaybackBlocked=!0,this.emit(et.VideoPlaybackStatusChanged,!1))},this.handleDeviceChange=()=>vA(this,void 0,void 0,function*(){var o;((o=Ur())===null||o===void 0?void 0:o.os)!=="iOS"&&(yield this.selectDefaultDevices()),this.emit(et.MediaDevicesChanged)}),this.handleRoomUpdate=o=>{const a=this.roomInfo;this.roomInfo=o,a&&a.metadata!==o.metadata&&this.emitWhenConnected(et.RoomMetadataChanged,o.metadata),a?.activeRecording!==o.activeRecording&&this.emitWhenConnected(et.RecordingStatusChanged,o.activeRecording)},this.handleConnectionQualityUpdate=o=>{o.updates.forEach(a=>{if(a.participantSid===this.localParticipant.sid){this.localParticipant.setConnectionQuality(a.quality);return}const r=this.getRemoteParticipantBySid(a.participantSid);r&&r.setConnectionQuality(a.quality)})},this.onLocalParticipantMetadataChanged=o=>{this.emit(et.ParticipantMetadataChanged,o,this.localParticipant)},this.onLocalParticipantNameChanged=o=>{this.emit(et.ParticipantNameChanged,o,this.localParticipant)},this.onLocalAttributesChanged=o=>{this.emit(et.ParticipantAttributesChanged,o,this.localParticipant)},this.onLocalTrackMuted=o=>{this.emit(et.TrackMuted,o,this.localParticipant)},this.onLocalTrackUnmuted=o=>{this.emit(et.TrackUnmuted,o,this.localParticipant)},this.onTrackProcessorUpdate=o=>{var a;(a=o?.onPublish)===null||a===void 0||a.call(o,this)},this.onLocalTrackPublished=o=>vA(this,void 0,void 0,function*(){var a,r,s,B,c,E;(a=o.track)===null||a===void 0||a.on(ct.TrackProcessorUpdate,this.onTrackProcessorUpdate),(r=o.track)===null||r===void 0||r.on(ct.Restarted,this.onLocalTrackRestarted),(c=(B=(s=o.track)===null||s===void 0?void 0:s.getProcessor())===null||B===void 0?void 0:B.onPublish)===null||c===void 0||c.call(B,this),this.emit(et.LocalTrackPublished,o,this.localParticipant),ql(o.track)&&(yield o.track.checkForSilence())&&this.emit(et.LocalAudioSilenceDetected,o);const D=yield(E=o.track)===null||E===void 0?void 0:E.getDeviceId(!1),y=_T(o.source);y&&D&&D!==this.localParticipant.activeDeviceMap.get(y)&&(this.localParticipant.activeDeviceMap.set(y,D),this.emit(et.ActiveDeviceChanged,y,D))}),this.onLocalTrackUnpublished=o=>{var a,r;(a=o.track)===null||a===void 0||a.off(ct.TrackProcessorUpdate,this.onTrackProcessorUpdate),(r=o.track)===null||r===void 0||r.off(ct.Restarted,this.onLocalTrackRestarted),this.emit(et.LocalTrackUnpublished,o,this.localParticipant)},this.onLocalTrackRestarted=o=>vA(this,void 0,void 0,function*(){const a=yield o.getDeviceId(!1),r=_T(o.source);r&&a&&a!==this.localParticipant.activeDeviceMap.get(r)&&(this.log.debug("local track restarted, setting ".concat(r," ").concat(a," active"),this.logContext),this.localParticipant.activeDeviceMap.set(r,a),this.emit(et.ActiveDeviceChanged,r,a))}),this.onLocalConnectionQualityChanged=o=>{this.emit(et.ConnectionQualityChanged,o,this.localParticipant)},this.onMediaDevicesError=(o,a)=>{this.emit(et.MediaDevicesError,o,a)},this.onLocalParticipantPermissionsChanged=o=>{this.emit(et.ParticipantPermissionsChanged,o,this.localParticipant)},this.onLocalChatMessageSent=o=>{this.emit(et.ChatMessage,o,this.localParticipant)},this.setMaxListeners(100),this.remoteParticipants=new Map,this.sidToIdentity=new Map,this.options=Object.assign(Object.assign({},wUA),A),this.log=uQ((i=this.options.loggerName)!==null&&i!==void 0?i:yB.Room),this.transcriptionReceivedTimes=new Map,this.options.audioCaptureDefaults=Object.assign(Object.assign({},TtA),A?.audioCaptureDefaults),this.options.videoCaptureDefaults=Object.assign(Object.assign({},YtA),A?.videoCaptureDefaults),this.options.publishDefaults=Object.assign(Object.assign({},SUA),A?.publishDefaults),this.maybeCreateEngine(),this.incomingDataStreamManager=new eKA,this.outgoingDataStreamManager=new gKA(this.engine,this.log),this.disconnectLock=new gr,this.localParticipant=new BKA("","",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",YE(this.options.videoCaptureDefaults.deviceId)),this.options.audioCaptureDefaults.deviceId&&this.localParticipant.activeDeviceMap.set("audioinput",YE(this.options.audioCaptureDefaults.deviceId)),!((g=this.options.audioOutput)===null||g===void 0)&&g.deviceId&&this.switchActiveDevice("audiooutput",YE(this.options.audioOutput.deviceId)).catch(o=>this.log.warn("Could not set audio output: ".concat(o.message),this.logContext)),Gr()){const o=new AbortController;(n=(I=navigator.mediaDevices)===null||I===void 0?void 0:I.addEventListener)===null||n===void 0||n.call(I,"devicechange",this.handleDeviceChange,{signal:o.signal}),gy.cleanupRegistry&&gy.cleanupRegistry.register(this,()=>{o.abort()})}}registerTextStreamHandler(A,e){return this.incomingDataStreamManager.registerTextStreamHandler(A,e)}unregisterTextStreamHandler(A){return this.incomingDataStreamManager.unregisterTextStreamHandler(A)}registerByteStreamHandler(A,e){return this.incomingDataStreamManager.registerByteStreamHandler(A,e)}unregisterByteStreamHandler(A){return this.incomingDataStreamManager.unregisterByteStreamHandler(A)}registerRpcMethod(A,e){if(this.rpcHandlers.has(A))throw Error("RPC handler already registered for method ".concat(A,", unregisterRpcMethod before trying to register again"));this.rpcHandlers.set(A,e)}unregisterRpcMethod(A){this.rpcHandlers.delete(A)}setE2EEEnabled(A){return vA(this,void 0,void 0,function*(){if(this.e2eeManager)yield Promise.all([this.localParticipant.setE2EEEnabled(A)]),this.localParticipant.identity!==""&&this.e2eeManager.setParticipantCryptorEnabled(A,this.localParticipant.identity);else throw Error("e2ee not configured, please set e2ee settings within the room options")})}setupE2EE(){var A;const e=!!this.options.encryption,i=this.options.encryption||this.options.e2ee;i&&("e2eeManager"in i?(this.e2eeManager=i.e2eeManager,this.e2eeManager.isDataChannelEncryptionEnabled=e):this.e2eeManager=new oUA(i,e),this.e2eeManager.on(KE.ParticipantEncryptionStatusChanged,(g,I)=>{ZRA(I)&&(this.isE2EEEnabled=g),this.emit(et.ParticipantEncryptionStatusChanged,g,I)}),this.e2eeManager.on(KE.EncryptionError,(g,I)=>{const n=I?this.getParticipantByIdentity(I):void 0;this.emit(et.EncryptionError,g,n)}),(A=this.e2eeManager)===null||A===void 0||A.setup(this))}get logContext(){var A;return{room:this.name,roomID:(A=this.roomInfo)===null||A===void 0?void 0:A.sid,participant:this.localParticipant.identity,pID:this.localParticipant.sid}}get isRecording(){var A,e;return(e=(A=this.roomInfo)===null||A===void 0?void 0:A.activeRecording)!==null&&e!==void 0?e:!1}getSid(){return this.state===ug.Disconnected?Nr.resolve(""):this.roomInfo&&this.roomInfo.sid!==""?Nr.resolve(this.roomInfo.sid):new Nr((A,e)=>{const i=g=>{g.sid!==""&&(this.engine.off(ut.RoomUpdate,i),A(g.sid))};this.engine.on(ut.RoomUpdate,i),this.once(et.Disconnected,()=>{this.engine.off(ut.RoomUpdate,i),e(new rn("Room disconnected before room server id was available"))})})}get name(){var A,e;return(e=(A=this.roomInfo)===null||A===void 0?void 0:A.name)!==null&&e!==void 0?e:""}get metadata(){var A;return(A=this.roomInfo)===null||A===void 0?void 0:A.metadata}get numParticipants(){var A,e;return(e=(A=this.roomInfo)===null||A===void 0?void 0:A.numParticipants)!==null&&e!==void 0?e:0}get numPublishers(){var A,e;return(e=(A=this.roomInfo)===null||A===void 0?void 0:A.numPublishers)!==null&&e!==void 0?e:0}maybeCreateEngine(){this.engine&&!this.engine.isClosed||(this.engine=new VUA(this.options),this.engine.e2eeManager=this.e2eeManager,this.engine.on(ut.ParticipantUpdate,this.handleParticipantUpdates).on(ut.RoomUpdate,this.handleRoomUpdate).on(ut.SpeakersChanged,this.handleSpeakersChanged).on(ut.StreamStateChanged,this.handleStreamStateUpdate).on(ut.ConnectionQualityUpdate,this.handleConnectionQualityUpdate).on(ut.SubscriptionError,this.handleSubscriptionError).on(ut.SubscriptionPermissionUpdate,this.handleSubscriptionPermissionUpdate).on(ut.MediaTrackAdded,(A,e,i)=>{this.onTrackAdded(A,e,i)}).on(ut.Disconnected,A=>{this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,A)}).on(ut.ActiveSpeakersUpdate,this.handleActiveSpeakersUpdate).on(ut.DataPacketReceived,this.handleDataPacket).on(ut.Resuming,()=>{this.clearConnectionReconcile(),this.isResuming=!0,this.log.info("Resuming signal connection",this.logContext),this.setAndEmitConnectionState(ug.SignalReconnecting)&&this.emit(et.SignalReconnecting)}).on(ut.Resumed,()=>{this.registerConnectionReconcile(),this.isResuming=!1,this.log.info("Resumed signal connection",this.logContext),this.updateSubscriptions(),this.emitBufferedEvents(),this.setAndEmitConnectionState(ug.Connected)&&this.emit(et.Reconnected)}).on(ut.SignalResumed,()=>{this.bufferedEvents=[],(this.state===ug.Reconnecting||this.isResuming)&&this.sendSyncState()}).on(ut.Restarting,this.handleRestarting).on(ut.SignalRestarted,this.handleSignalRestarted).on(ut.Offline,()=>{this.setAndEmitConnectionState(ug.Reconnecting)&&this.emit(et.Reconnecting)}).on(ut.DCBufferStatusChanged,(A,e)=>{this.emit(et.DCBufferStatusChanged,A,e)}).on(ut.LocalTrackSubscribed,A=>{const e=this.localParticipant.getTrackPublications().find(i=>{let{trackSid:g}=i;return g===A});if(!e){this.log.warn("could not find local track subscription for subscribed event",this.logContext);return}this.localParticipant.emit(pt.LocalTrackSubscribed,e),this.emitWhenConnected(et.LocalTrackSubscribed,e,this.localParticipant)}).on(ut.RoomMoved,A=>{this.log.debug("room moved",A),A.room&&this.handleRoomUpdate(A.room),this.remoteParticipants.forEach((e,i)=>{this.handleParticipantDisconnected(i,e)}),this.emit(et.Moved,A.room.name),A.participant?this.handleParticipantUpdates([A.participant,...A.otherParticipants]):this.handleParticipantUpdates(A.otherParticipants)}),this.localParticipant&&this.localParticipant.setupEngine(this.engine),this.e2eeManager&&this.e2eeManager.setupEngine(this.engine),this.outgoingDataStreamManager&&this.outgoingDataStreamManager.setupEngine(this.engine))}static getLocalDevices(A){let e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return uo.getInstance().getDevices(A,e)}prepareConnection(A,e){return vA(this,void 0,void 0,function*(){if(this.state===ug.Disconnected){this.log.debug("prepareConnection to ".concat(A),this.logContext);try{if(iy(new URL(A))&&e){this.regionUrlProvider=new Sg(A,e);const i=yield this.regionUrlProvider.getNextBestRegionUrl();i&&this.state===ug.Disconnected&&(this.regionUrl=i,yield fetch(m0(i),{method:"HEAD"}),this.log.debug("prepared connection to ".concat(i),this.logContext))}else yield fetch(m0(A),{method:"HEAD"})}catch(i){this.log.warn("could not prepare connection",Object.assign(Object.assign({},this.logContext),{error:i}))}}})}getParticipantByIdentity(A){return this.localParticipant.identity===A?this.localParticipant:this.remoteParticipants.get(A)}clearConnectionFutures(){this.connectFuture=void 0}simulateScenario(A,e){return vA(this,void 0,void 0,function*(){let i=()=>vA(this,void 0,void 0,function*(){}),g;switch(A){case"signal-reconnect":yield this.engine.client.handleOnClose("simulate disconnect");break;case"speaker":g=new yc({scenario:{case:"speakerUpdate",value:3}});break;case"node-failure":g=new yc({scenario:{case:"nodeFailure",value:!0}});break;case"server-leave":g=new yc({scenario:{case:"serverLeave",value:!0}});break;case"migration":g=new yc({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":i=()=>vA(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),g=new yc({scenario:{case:"disconnectSignalOnResume",value:!0}});break;case"disconnect-signal-on-resume-no-messages":i=()=>vA(this,void 0,void 0,function*(){yield this.engine.client.handleOnClose("simulate resume-disconnect")}),g=new yc({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":g=new yc({scenario:{case:"switchCandidateProtocol",value:A==="force-tls"?2:1}}),i=()=>vA(this,void 0,void 0,function*(){const I=this.engine.client.onLeave;I&&I(new tb({reason:cB.CLIENT_INITIATED,action:MD.RECONNECT}))});break;case"subscriber-bandwidth":if(e===void 0||typeof e!="number")throw new Error("subscriber-bandwidth requires a number as argument");g=new yc({scenario:{case:"subscriberBandwidth",value:Jh(e)}});break;case"leave-full-reconnect":g=new yc({scenario:{case:"leaveRequestFullReconnect",value:!0}})}g&&(yield this.engine.client.sendSimulateScenario(g),yield i())})}get canPlaybackAudio(){return this.audioEnabled}get canPlaybackVideo(){return!this.isVideoPlaybackBlocked}getActiveDevice(A){return this.localParticipant.activeDeviceMap.get(A)}switchActiveDevice(A,e){return vA(this,arguments,void 0,function(i,g){var I=this;let n=arguments.length>2&&arguments[2]!==void 0?arguments[2]:!0;return function*(){var o,a,r,s,B,c,E;let D=!0,y=!1;const S=n?{exact:g}:g;if(i==="audioinput"){y=I.localParticipant.audioTrackPublications.size===0;const f=(o=I.getActiveDevice(i))!==null&&o!==void 0?o:I.options.audioCaptureDefaults.deviceId;I.options.audioCaptureDefaults.deviceId=S;const M=Array.from(I.localParticipant.audioTrackPublications.values()).filter(m=>m.source===Pe.Source.Microphone);try{D=(yield Promise.all(M.map(m=>{var U;return(U=m.audioTrack)===null||U===void 0?void 0:U.setDeviceId(S)}))).every(m=>m===!0)}catch(m){throw I.options.audioCaptureDefaults.deviceId=f,m}const k=M.some(m=>{var U,F;return(F=(U=m.track)===null||U===void 0?void 0:U.isMuted)!==null&&F!==void 0?F:!1});D&&k&&(y=!0)}else if(i==="videoinput"){y=I.localParticipant.videoTrackPublications.size===0;const f=(a=I.getActiveDevice(i))!==null&&a!==void 0?a:I.options.videoCaptureDefaults.deviceId;I.options.videoCaptureDefaults.deviceId=S;const M=Array.from(I.localParticipant.videoTrackPublications.values()).filter(m=>m.source===Pe.Source.Camera);try{D=(yield Promise.all(M.map(m=>{var U;return(U=m.videoTrack)===null||U===void 0?void 0:U.setDeviceId(S)}))).every(m=>m===!0)}catch(m){throw I.options.videoCaptureDefaults.deviceId=f,m}const k=M.some(m=>{var U,F;return(F=(U=m.track)===null||U===void 0?void 0:U.isMuted)!==null&&F!==void 0?F:!1});D&&k&&(y=!0)}else if(i==="audiooutput"){if(y=!0,!qT()&&!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&&(g=(r=yield uo.getInstance().normalizeDeviceId("audiooutput",g))!==null&&r!==void 0?r:""),(s=(E=I.options).audioOutput)!==null&&s!==void 0||(E.audioOutput={});const f=(B=I.getActiveDevice(i))!==null&&B!==void 0?B:I.options.audioOutput.deviceId;I.options.audioOutput.deviceId=g;try{I.options.webAudioMix&&((c=I.audioContext)===null||c===void 0||c.setSinkId(g)),yield Promise.all(Array.from(I.remoteParticipants.values()).map(M=>M.setAudioOutput({deviceId:g})))}catch(M){throw I.options.audioOutput.deviceId=f,M}}return y&&(I.localParticipant.activeDeviceMap.set(i,g),I.emit(et.ActiveDeviceChanged,i,g)),D}()})}setupLocalParticipantEvents(){this.localParticipant.on(pt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).on(pt.ParticipantNameChanged,this.onLocalParticipantNameChanged).on(pt.AttributesChanged,this.onLocalAttributesChanged).on(pt.TrackMuted,this.onLocalTrackMuted).on(pt.TrackUnmuted,this.onLocalTrackUnmuted).on(pt.LocalTrackPublished,this.onLocalTrackPublished).on(pt.LocalTrackUnpublished,this.onLocalTrackUnpublished).on(pt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).on(pt.MediaDevicesError,this.onMediaDevicesError).on(pt.AudioStreamAcquired,this.startAudio).on(pt.ChatMessage,this.onLocalChatMessageSent).on(pt.ParticipantPermissionsChanged,this.onLocalParticipantPermissionsChanged)}recreateEngine(){var A;(A=this.engine)===null||A===void 0||A.close(),this.engine=void 0,this.isResuming=!1,this.remoteParticipants.clear(),this.sidToIdentity.clear(),this.bufferedEvents=[],this.maybeCreateEngine()}onTrackAdded(A,e,i){if(this.state===ug.Connecting||this.state===ug.Reconnecting){const B=()=>{this.log.debug("deferring on track for later",{mediaTrackId:A.id,mediaStreamId:e.id,tracksInStream:e.getTracks().map(E=>E.id)}),this.onTrackAdded(A,e,i),c()},c=()=>{this.off(et.Reconnected,B),this.off(et.Connected,B),this.off(et.Disconnected,c)};this.once(et.Reconnected,B),this.once(et.Connected,B),this.once(et.Disconnected,c);return}if(this.state===ug.Disconnected){this.log.warn("skipping incoming track after Room disconnected",this.logContext);return}if(A.readyState==="ended"){this.log.info("skipping incoming track as it already ended",this.logContext);return}const g=KRA(e.id),I=g[0];let n=g[1],o=A.id;if(n&&n.startsWith("TR")&&(o=n),I===this.localParticipant.sid){this.log.warn("tried to create RemoteParticipant for local participant",this.logContext);return}const a=Array.from(this.remoteParticipants.values()).find(B=>B.sid===I);if(!a){this.log.error("Tried to add a track for a participant, that's not present. Sid: ".concat(I),this.logContext);return}if(!o.startsWith("TR")){const B=this.engine.getTrackIdForReceiver(i);if(!B){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}o=B}o.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(n,", trackId: ").concat(o),Object.assign(Object.assign({},this.logContext),{rpID:I,streamId:n,trackId:o}));let r;this.options.adaptiveStream&&(typeof this.options.adaptiveStream=="object"?r=this.options.adaptiveStream:r={});const s=a.addSubscribedMediaTrack(A,o,e,i,r);s?.isEncrypted&&!this.e2eeManager&&this.emit(et.EncryptionError,new Error("Encrypted ".concat(s.source," track received from participant ").concat(a.sid,", but room does not have encryption enabled!")))}handleDisconnect(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:!0,e=arguments.length>1?arguments[1]:void 0;var i,g;if(this.clearConnectionReconcile(),this.isResuming=!1,this.bufferedEvents=[],this.transcriptionReceivedTimes.clear(),this.incomingDataStreamManager.clearControllers(),this.state!==ug.Disconnected){this.regionUrl=void 0,this.regionUrlProvider&&this.regionUrlProvider.notifyDisconnected();try{this.remoteParticipants.forEach(I=>{I.trackPublications.forEach(n=>{I.unpublishTrack(n.trackSid)})}),this.localParticipant.trackPublications.forEach(I=>{var n,o,a;I.track&&this.localParticipant.unpublishTrack(I.track,A),A?((n=I.track)===null||n===void 0||n.detach(),(o=I.track)===null||o===void 0||o.stop()):(a=I.track)===null||a===void 0||a.stopMonitor()}),this.localParticipant.off(pt.ParticipantMetadataChanged,this.onLocalParticipantMetadataChanged).off(pt.ParticipantNameChanged,this.onLocalParticipantNameChanged).off(pt.AttributesChanged,this.onLocalAttributesChanged).off(pt.TrackMuted,this.onLocalTrackMuted).off(pt.TrackUnmuted,this.onLocalTrackUnmuted).off(pt.LocalTrackPublished,this.onLocalTrackPublished).off(pt.LocalTrackUnpublished,this.onLocalTrackUnpublished).off(pt.ConnectionQualityChanged,this.onLocalConnectionQualityChanged).off(pt.MediaDevicesError,this.onMediaDevicesError).off(pt.AudioStreamAcquired,this.startAudio).off(pt.ChatMessage,this.onLocalChatMessageSent).off(pt.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),Gr()&&(window.removeEventListener("beforeunload",this.onPageLeave),window.removeEventListener("pagehide",this.onPageLeave),window.removeEventListener("freeze",this.onPageLeave),(g=(i=navigator.mediaDevices)===null||i===void 0?void 0:i.removeEventListener)===null||g===void 0||g.call(i,"devicechange",this.handleDeviceChange))}finally{this.setAndEmitConnectionState(ug.Disconnected),this.emit(et.Disconnected,e)}}}handleParticipantDisconnected(A,e){var i;this.remoteParticipants.delete(A),e&&(this.incomingDataStreamManager.validateParticipantHasNoActiveDataStreams(A),e.trackPublications.forEach(g=>{e.unpublishTrack(g.trackSid,!0)}),this.emit(et.ParticipantDisconnected,e),e.setDisconnected(),(i=this.localParticipant)===null||i===void 0||i.handleParticipantDisconnected(e.identity))}handleIncomingRpcRequest(A,e,i,g,I,n){return vA(this,void 0,void 0,function*(){if(yield this.engine.publishRpcAck(A,e),n!==1){yield this.engine.publishRpcResponse(A,e,null,za.builtIn("UNSUPPORTED_VERSION"));return}const o=this.rpcHandlers.get(i);if(!o){yield this.engine.publishRpcResponse(A,e,null,za.builtIn("UNSUPPORTED_METHOD"));return}let a=null,r=null;try{const s=yield o({requestId:e,callerIdentity:A,payload:g,responseTimeout:I});IO(s)>OtA?(a=za.builtIn("RESPONSE_PAYLOAD_TOO_LARGE"),this.log.warn("RPC Response payload too large for ".concat(i))):r=s}catch(s){s instanceof za?a=s:(this.log.warn("Uncaught error returned by RPC handler for ".concat(i,". Returning APPLICATION_ERROR instead."),s),a=za.builtIn("APPLICATION_ERROR"))}yield this.engine.publishRpcResponse(A,e,r,a)})}selectDefaultDevices(){return vA(this,void 0,void 0,function*(){var A,e,i;const g=uo.getInstance().previousDevices,I=yield uo.getInstance().getDevices(void 0,!1),n=Ur();if(n?.name==="Chrome"&&n.os!=="iOS")for(let a of I){const r=g.find(s=>s.deviceId===a.deviceId);r&&r.label!==""&&r.kind===a.kind&&r.label!==a.label&&this.getActiveDevice(a.kind)==="default"&&this.emit(et.ActiveDeviceChanged,a.kind,a.deviceId)}const o=["audiooutput","audioinput","videoinput"];for(let a of o){const r=SRA(a),s=this.localParticipant.getTrackPublication(r);if(s&&(!((A=s.track)===null||A===void 0)&&A.isUserProvided))continue;const B=I.filter(E=>E.kind===a),c=this.getActiveDevice(a);if(c===((e=g.filter(E=>E.kind===a)[0])===null||e===void 0?void 0:e.deviceId)&&B.length>0&&((i=B[0])===null||i===void 0?void 0:i.deviceId)!==c){yield this.switchActiveDevice(a,B[0].deviceId);continue}a==="audioinput"&&!w0()||a==="videoinput"||B.length>0&&!B.find(E=>E.deviceId===this.getActiveDevice(a))&&(a!=="audiooutput"||!w0())&&(yield this.switchActiveDevice(a,B[0].deviceId))}})}acquireAudioContext(){return vA(this,void 0,void 0,function*(){var A,e;if(typeof this.options.webAudioMix!="boolean"&&this.options.webAudioMix.audioContext?this.audioContext=this.options.webAudioMix.audioContext:(!this.audioContext||this.audioContext.state==="closed")&&(this.audioContext=(A=vtA())!==null&&A!==void 0?A:void 0),this.options.webAudioMix&&this.remoteParticipants.forEach(g=>g.setAudioContext(this.audioContext)),this.localParticipant.setAudioContext(this.audioContext),this.audioContext&&this.audioContext.state==="suspended")try{yield Promise.race([this.audioContext.resume(),Oo(200)])}catch(g){this.log.warn("Could not resume audio context",Object.assign(Object.assign({},this.logContext),{error:g}))}const i=((e=this.audioContext)===null||e===void 0?void 0:e.state)==="running";i!==this.canPlaybackAudio&&(this.audioEnabled=i,this.emit(et.AudioPlaybackStatusChanged,i))})}createParticipant(A,e){var i;let g;return e?g=OU.fromParticipantInfo(this.engine.client,e,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}):g=new OU(this.engine.client,"",A,void 0,void 0,void 0,{loggerContextCb:()=>this.logContext,loggerName:this.options.loggerName}),this.options.webAudioMix&&g.setAudioContext(this.audioContext),!((i=this.options.audioOutput)===null||i===void 0)&&i.deviceId&&g.setAudioOutput(this.options.audioOutput).catch(I=>this.log.warn("Could not set audio output: ".concat(I.message),this.logContext)),g}getOrCreateParticipant(A,e){if(this.remoteParticipants.has(A)){const g=this.remoteParticipants.get(A);return e&&g.updateInfo(e)&&this.sidToIdentity.set(e.sid,e.identity),g}const i=this.createParticipant(A,e);return this.remoteParticipants.set(A,i),this.sidToIdentity.set(e.sid,e.identity),this.emitWhenConnected(et.ParticipantConnected,i),i.on(pt.TrackPublished,g=>{this.emitWhenConnected(et.TrackPublished,g,i)}).on(pt.TrackSubscribed,(g,I)=>{g.kind===Pe.Kind.Audio?(g.on(ct.AudioPlaybackStarted,this.handleAudioPlaybackStarted),g.on(ct.AudioPlaybackFailed,this.handleAudioPlaybackFailed)):g.kind===Pe.Kind.Video&&(g.on(ct.VideoPlaybackFailed,this.handleVideoPlaybackFailed),g.on(ct.VideoPlaybackStarted,this.handleVideoPlaybackStarted)),this.emit(et.TrackSubscribed,g,I,i)}).on(pt.TrackUnpublished,g=>{this.emit(et.TrackUnpublished,g,i)}).on(pt.TrackUnsubscribed,(g,I)=>{this.emit(et.TrackUnsubscribed,g,I,i)}).on(pt.TrackMuted,g=>{this.emitWhenConnected(et.TrackMuted,g,i)}).on(pt.TrackUnmuted,g=>{this.emitWhenConnected(et.TrackUnmuted,g,i)}).on(pt.ParticipantMetadataChanged,g=>{this.emitWhenConnected(et.ParticipantMetadataChanged,g,i)}).on(pt.ParticipantNameChanged,g=>{this.emitWhenConnected(et.ParticipantNameChanged,g,i)}).on(pt.AttributesChanged,g=>{this.emitWhenConnected(et.ParticipantAttributesChanged,g,i)}).on(pt.ConnectionQualityChanged,g=>{this.emitWhenConnected(et.ConnectionQualityChanged,g,i)}).on(pt.ParticipantPermissionsChanged,g=>{this.emitWhenConnected(et.ParticipantPermissionsChanged,g,i)}).on(pt.TrackSubscriptionStatusChanged,(g,I)=>{this.emitWhenConnected(et.TrackSubscriptionStatusChanged,g,I,i)}).on(pt.TrackSubscriptionFailed,(g,I)=>{this.emit(et.TrackSubscriptionFailed,g,i,I)}).on(pt.TrackSubscriptionPermissionChanged,(g,I)=>{this.emitWhenConnected(et.TrackSubscriptionPermissionChanged,g,I,i)}).on(pt.Active,()=>{this.emitWhenConnected(et.ParticipantActive,i),i.kind===y0.AGENT&&this.localParticipant.setActiveAgent(i)}),e&&i.updateInfo(e),i}sendSyncState(){const A=Array.from(this.remoteParticipants.values()).reduce((i,g)=>(i.push(...g.getTrackPublications()),i),[]),e=this.localParticipant.getTrackPublications();this.engine.sendSyncState(A,e)}updateSubscriptions(){for(const A of this.remoteParticipants.values())for(const e of A.videoTrackPublications.values())e.isSubscribed&&jRA(e)&&e.emitTrackUpdate()}getRemoteParticipantBySid(A){const e=this.sidToIdentity.get(A);if(e)return this.remoteParticipants.get(e)}registerConnectionReconcile(){this.clearConnectionReconcile();let A=0;this.connectionReconcileInterval=Ho.setInterval(()=>{!this.engine||this.engine.isClosed||!this.engine.verifyTransport()?(A++,this.log.warn("detected connection state mismatch",Object.assign(Object.assign({},this.logContext),{numFailures:A,engine:this.engine?{closed:this.engine.isClosed,transportsConnected:this.engine.verifyTransport()}:void 0})),A>=3&&(this.recreateEngine(),this.handleDisconnect(this.options.stopLocalTrackOnUnpublish,cB.STATE_MISMATCH))):A=0},lKA)}clearConnectionReconcile(){this.connectionReconcileInterval&&Ho.clearInterval(this.connectionReconcileInterval)}setAndEmitConnectionState(A){return A===this.state?!1:(this.state=A,this.emit(et.ConnectionStateChanged,this.state),!0)}emitBufferedEvents(){this.bufferedEvents.forEach(A=>{let[e,i]=A;this.emit(e,...i)}),this.bufferedEvents=[]}emitWhenConnected(A){for(var e=arguments.length,i=new Array(e>1?e-1:0),g=1;g<e;g++)i[g-1]=arguments[g];if(this.state===ug.Reconnecting||this.isResuming||!this.engine||this.engine.pendingReconnect)this.bufferedEvents.push([A,i]);else if(this.state===ug.Connected)return this.emit(A,...i);return!1}simulateParticipants(A){return vA(this,void 0,void 0,function*(){var e,i,g,I;const n=Object.assign({audio:!0,video:!0,useRealTracks:!1},A.publish),o=Object.assign({count:9,audio:!1,video:!0,aspectRatios:[1.66,1.7,1.3]},A.participants);if(this.handleDisconnect(),this.roomInfo=new XF({sid:"RM_SIMULATED",name:"simulated-room",emptyTimeout:0,maxParticipants:0,creationTime:RI.parse(new Date().getTime()),metadata:"",numParticipants:1,numPublishers:1,turnPassword:"",enabledCodecs:[],activeRecording:!1}),this.localParticipant.updateInfo(new md({identity:"simulated-local",name:"local-name"})),this.setupLocalParticipantEvents(),this.emit(et.SignalConnected),this.emit(et.Connected),this.setAndEmitConnectionState(ug.Connected),n.video){const a=new jT(Pe.Kind.Video,new oD({source:Mn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:oB.AUDIO,name:"video-dummy"}),new HU(n.useRealTracks&&(!((e=window.navigator.mediaDevices)===null||e===void 0)&&e.getUserMedia)?(yield window.navigator.mediaDevices.getUserMedia({video:!0})).getVideoTracks()[0]:j5(160*((i=o.aspectRatios[0])!==null&&i!==void 0?i:1),160,!0,!0),void 0,!1,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(a),this.localParticipant.emit(pt.LocalTrackPublished,a)}if(n.audio){const a=new jT(Pe.Kind.Audio,new oD({source:Mn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:oB.AUDIO}),new YU(n.useRealTracks&&(!((g=navigator.mediaDevices)===null||g===void 0)&&g.getUserMedia)?(yield navigator.mediaDevices.getUserMedia({audio:!0})).getAudioTracks()[0]:ZJ(),void 0,!1,this.audioContext,{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext}),{loggerName:this.options.loggerName,loggerContextCb:()=>this.logContext});this.localParticipant.addTrackPublication(a),this.localParticipant.emit(pt.LocalTrackPublished,a)}for(let a=0;a<o.count-1;a+=1){let r=new md({sid:Math.floor(Math.random()*1e4).toString(),identity:"simulated-".concat(a),state:kD.ACTIVE,tracks:[],joinedAt:RI.parse(Date.now())});const s=this.getOrCreateParticipant(r.identity,r);if(o.video){const B=j5(160*((I=o.aspectRatios[a%o.aspectRatios.length])!==null&&I!==void 0?I:1),160,!1,!0),c=new oD({source:Mn.CAMERA,sid:Math.floor(Math.random()*1e4).toString(),type:oB.AUDIO});s.addSubscribedMediaTrack(B,c.sid,new MediaStream([B]),new RTCRtpReceiver),r.tracks=[...r.tracks,c]}if(o.audio){const B=ZJ(),c=new oD({source:Mn.MICROPHONE,sid:Math.floor(Math.random()*1e4).toString(),type:oB.AUDIO});s.addSubscribedMediaTrack(B,c.sid,new MediaStream([B]),new RTCRtpReceiver),r.tracks=[...r.tracks,c]}s.updateInfo(r)}})}emit(A){for(var e=arguments.length,i=new Array(e>1?e-1:0),g=1;g<e;g++)i[g-1]=arguments[g];if(A!==et.ActiveSpeakersChanged&&A!==et.TranscriptionReceived){const I=$tA(i).filter(n=>n!==void 0);(A===et.TrackSubscribed||A===et.TrackUnsubscribed)&&this.log.trace("subscribe trace: ".concat(A),Object.assign(Object.assign({},this.logContext),{event:A,args:I})),this.log.debug("room event ".concat(A),Object.assign(Object.assign({},this.logContext),{event:A,args:I}))}return super.emit(A,...i)}}gy.cleanupRegistry=typeof FinalizationRegistry<"u"&&new FinalizationRegistry(t=>{t()});function $tA(t){return t.map(A=>{if(A)return Array.isArray(A)?$tA(A):typeof A=="object"?"logContext"in A?A.logContext:void 0:A})}var gB;(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"})(gB||(gB={}));class yu extends zc.EventEmitter{constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.status=gB.IDLE,this.logs=[],this.options={},this.url=A,this.token=e,this.name=this.constructor.name,this.room=new gy(i.roomOptions),this.connectOptions=i.connectOptions,this.options=i}run(A){return vA(this,void 0,void 0,function*(){if(this.status!==gB.IDLE)throw Error("check is running already");this.setStatus(gB.RUNNING);try{yield this.perform()}catch(e){e instanceof Error&&(this.options.errorsAsWarnings?this.appendWarning(e.message):this.appendError(e.message))}return yield this.disconnect(),yield new Promise(e=>setTimeout(e,500)),this.status!==gB.SKIPPED&&this.setStatus(this.isSuccess()?gB.SUCCESS:gB.FAILED),A&&A(),this.getInfo()})}isSuccess(){return!this.logs.some(A=>A.level==="error")}connect(A){return vA(this,void 0,void 0,function*(){return this.room.state===ug.Connected?this.room:(A||(A=this.url),yield this.room.connect(A,this.token,this.connectOptions),this.room)})}disconnect(){return vA(this,void 0,void 0,function*(){this.room&&this.room.state!==ug.Disconnected&&(yield this.room.disconnect(),yield new Promise(A=>setTimeout(A,500)))})}skip(){this.setStatus(gB.SKIPPED)}switchProtocol(A){return vA(this,void 0,void 0,function*(){let e=!1,i=!1;if(this.room.on(et.Reconnecting,()=>{e=!0}),this.room.once(et.Reconnected,()=>{i=!0}),this.room.simulateScenario("force-".concat(A)),yield new Promise(I=>setTimeout(I,1e3)),!e)return;const g=Date.now()+1e4;for(;Date.now()<g;){if(i)return;yield Oo(100)}throw new Error("Could not reconnect using ".concat(A," protocol after 10 seconds"))})}appendMessage(A){this.logs.push({level:"info",message:A}),this.emit("update",this.getInfo())}appendWarning(A){this.logs.push({level:"warning",message:A}),this.emit("update",this.getInfo())}appendError(A){this.logs.push({level:"error",message:A}),this.emit("update",this.getInfo())}setStatus(A){this.status=A,this.emit("update",this.getInfo())}get engine(){var A;return(A=this.room)===null||A===void 0?void 0:A.engine}getInfo(){return{logs:this.logs,name:this.name,status:this.status,description:this.description}}}class QKA extends yu{get description(){return"Cloud regions"}perform(){return vA(this,void 0,void 0,function*(){const A=new Sg(this.url,this.token);if(!A.isCloud()){this.skip();return}const e=[],i=new Set;for(let I=0;I<3;I++){const n=yield A.getNextBestRegionUrl();if(!n)break;if(i.has(n))continue;i.add(n);const o=yield this.checkCloudRegion(n);this.appendMessage("".concat(o.region," RTT: ").concat(o.rtt,"ms, duration: ").concat(o.duration,"ms")),e.push(o)}e.sort((I,n)=>(I.duration-n.duration)*.5+(I.rtt-n.rtt)*.5);const g=e[0];this.bestStats=g,this.appendMessage("best Cloud region: ".concat(g.region))})}getInfo(){const A=super.getInfo();return A.data=this.bestStats,A}checkCloudRegion(A){return vA(this,void 0,void 0,function*(){var e,i;yield this.connect(A),this.options.protocol==="tcp"&&(yield this.switchProtocol("tcp"));const g=(e=this.room.serverInfo)===null||e===void 0?void 0:e.region;if(!g)throw new Error("Region not found");const I=yield this.room.localParticipant.streamText({topic:"test"}),n=1e3,a=1e6/n,r="A".repeat(n),s=Date.now();for(let D=0;D<a;D++)yield I.write(r);yield I.close();const B=Date.now(),c=yield(i=this.room.engine.pcManager)===null||i===void 0?void 0:i.publisher.getStats(),E={region:g,rtt:1e4,duration:B-s};return c?.forEach(D=>{D.type==="candidate-pair"&&D.nominated&&(E.rtt=D.currentRoundTripTime*1e3)}),yield this.disconnect(),E})}}const iL=1e4;class EKA extends yu{get description(){return"Connection via UDP vs TCP"}perform(){return vA(this,void 0,void 0,function*(){const A=yield this.checkConnectionProtocol("udp"),e=yield this.checkConnectionProtocol("tcp");this.bestStats=A,A.qualityLimitationDurations.bandwidth-e.qualityLimitationDurations.bandwidth>.5||(A.packetsLost-e.packetsLost)/A.packetsSent>.01?(this.appendMessage("best connection quality via tcp"),this.bestStats=e):this.appendMessage("best connection quality via udp");const i=this.bestStats;this.appendMessage("upstream bitrate: ".concat((i.bitrateTotal/i.count/1e3/1e3).toFixed(2)," mbps")),this.appendMessage("RTT: ".concat((i.rttTotal/i.count*1e3).toFixed(2)," ms")),this.appendMessage("jitter: ".concat((i.jitterTotal/i.count*1e3).toFixed(2)," ms")),i.packetsLost>0&&this.appendWarning("packets lost: ".concat((i.packetsLost/i.packetsSent*100).toFixed(2),"%")),i.qualityLimitationDurations.bandwidth>1&&this.appendWarning("bandwidth limited ".concat((i.qualityLimitationDurations.bandwidth/(iL/1e3)*100).toFixed(2),"%")),i.qualityLimitationDurations.cpu>0&&this.appendWarning("cpu limited ".concat((i.qualityLimitationDurations.cpu/(iL/1e3)*100).toFixed(2),"%"))})}getInfo(){const A=super.getInfo();return A.data=this.bestStats,A}checkConnectionProtocol(A){return vA(this,void 0,void 0,function*(){yield this.connect(),A==="tcp"?yield this.switchProtocol("tcp"):yield this.switchProtocol("udp");const e=document.createElement("canvas");e.width=1280,e.height=720;const i=e.getContext("2d");if(!i)throw new Error("Could not get canvas context");let g=0;const I=()=>{g=(g+1)%360,i.fillStyle="hsl(".concat(g,", 100%, 50%)"),i.fillRect(0,0,e.width,e.height),requestAnimationFrame(I)};I();const o=e.captureStream(30).getVideoTracks()[0],r=(yield this.room.localParticipant.publishTrack(o,{simulcast:!1,degradationPreference:"maintain-resolution",videoEncoding:{maxBitrate:2e6}})).track,s={protocol:A,packetsLost:0,packetsSent:0,qualityLimitationDurations:{},rttTotal:0,jitterTotal:0,bitrateTotal:0,count:0},B=setInterval(()=>vA(this,void 0,void 0,function*(){const c=yield r.getRTCStatsReport();c?.forEach(E=>{E.type==="outbound-rtp"?(s.packetsSent=E.packetsSent,s.qualityLimitationDurations=E.qualityLimitationDurations,s.bitrateTotal+=E.targetBitrate,s.count++):E.type==="remote-inbound-rtp"&&(s.packetsLost=E.packetsLost,s.rttTotal+=E.roundTripTime,s.jitterTotal+=E.jitter)})}),1e3);return yield new Promise(c=>setTimeout(c,iL)),clearInterval(B),o.stop(),e.remove(),yield this.disconnect(),s})}}class uKA extends yu{get description(){return"Can publish audio"}perform(){return vA(this,void 0,void 0,function*(){var A;const e=yield this.connect(),i=yield rKA();if(yield btA(i,1e3))throw new Error("unable to detect audio from microphone");this.appendMessage("detected audio from microphone"),e.localParticipant.publishTrack(i),yield new Promise(o=>setTimeout(o,3e3));const I=yield(A=i.sender)===null||A===void 0?void 0:A.getStats();if(!I)throw new Error("Could not get RTCStats");let n=0;if(I.forEach(o=>{o.type==="outbound-rtp"&&(o.kind==="audio"||!o.kind&&o.mediaType==="audio")&&(n=o.packetsSent)}),n===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(n," audio packets"))})}}class hKA extends yu{get description(){return"Can publish video"}perform(){return vA(this,void 0,void 0,function*(){var A;const e=yield this.connect(),i=yield aKA();yield this.checkForVideo(i.mediaStreamTrack),e.localParticipant.publishTrack(i),yield new Promise(n=>setTimeout(n,5e3));const g=yield(A=i.sender)===null||A===void 0?void 0:A.getStats();if(!g)throw new Error("Could not get RTCStats");let I=0;if(g.forEach(n=>{n.type==="outbound-rtp"&&(n.kind==="video"||!n.kind&&n.mediaType==="video")&&(I+=n.packetsSent)}),I===0)throw new Error("Could not determine packets are sent");this.appendMessage("published ".concat(I," video packets"))})}checkForVideo(A){return vA(this,void 0,void 0,function*(){const e=new MediaStream;e.addTrack(A.clone());const i=document.createElement("video");i.srcObject=e,i.muted=!0,i.autoplay=!0,i.playsInline=!0,i.setAttribute("playsinline","true"),document.body.appendChild(i),yield new Promise(g=>{i.onplay=()=>{setTimeout(()=>{var I,n,o,a;const r=document.createElement("canvas"),s=A.getSettings(),B=(n=(I=s.width)!==null&&I!==void 0?I:i.videoWidth)!==null&&n!==void 0?n:1280,c=(a=(o=s.height)!==null&&o!==void 0?o:i.videoHeight)!==null&&a!==void 0?a:720;r.width=B,r.height=c;const E=r.getContext("2d");E.drawImage(i,0,0);const y=E.getImageData(0,0,r.width,r.height).data;let S=!0;for(let f=0;f<y.length;f+=4)if(y[f]!==0||y[f+1]!==0||y[f+2]!==0){S=!1;break}S?this.appendError("camera appears to be producing only black frames"):this.appendMessage("received video frames"),g()},1e3)},i.play()}),e.getTracks().forEach(g=>g.stop()),i.remove()})}}class dKA extends yu{get description(){return"Resuming connection after interruption"}perform(){return vA(this,void 0,void 0,function*(){var A;const e=yield this.connect();let i=!1,g=!1,I;const n=new Promise(r=>{setTimeout(r,5e3),I=r}),o=()=>{i=!0};e.on(et.SignalReconnecting,o).on(et.Reconnecting,o).on(et.Reconnected,()=>{g=!0,I(!0)}),(A=e.engine.client.ws)===null||A===void 0||A.close();const a=e.engine.client.onClose;if(a&&a(""),yield n,i){if(!g||e.state!==ug.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 pKA extends yu{get description(){return"Can connect via TURN"}perform(){return vA(this,void 0,void 0,function*(){var A,e,i;iy(new URL(this.url))&&(this.appendMessage("Using region specific url"),this.url=(A=yield new Sg(this.url,this.token).getNextBestRegionUrl())!==null&&A!==void 0?A:this.url);const g=new AO,I=yield g.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0);let n=!1,o=!1,a=!1;for(let r of I.iceServers)for(let s of r.urls)s.startsWith("turn:")?(o=!0,a=!0):s.startsWith("turns:")&&(o=!0,a=!0,n=!0),s.startsWith("stun:")&&(a=!0);a?o&&!n&&this.appendWarning("TURN is configured server side, but TURN/TLS is unavailable."):this.appendWarning("No STUN servers configured on server side."),yield g.close(),!((i=(e=this.connectOptions)===null||e===void 0?void 0:e.rtcConfig)===null||i===void 0)&&i.iceServers||o?yield this.room.connect(this.url,this.token,{rtcConfig:{iceTransportPolicy:"relay"}}):(this.appendWarning("No TURN servers configured."),this.skip(),yield new Promise(r=>setTimeout(r,0)))})}}class fKA extends yu{get description(){return"Establishing WebRTC connection"}perform(){return vA(this,void 0,void 0,function*(){let A=!1,e=!1;this.room.on(et.SignalConnected,()=>{var i;const g=this.room.engine.client.onTrickle;this.room.engine.client.onTrickle=(I,n)=>{if(I.candidate){const o=new RTCIceCandidate(I);let a="".concat(o.protocol," ").concat(o.address,":").concat(o.port," ").concat(o.type);o.address&&(DKA(o.address)?a+=" (private)":o.protocol==="tcp"&&o.tcpType==="passive"?(A=!0,a+=" (passive)"):o.protocol==="udp"&&(e=!0)),this.appendMessage(a)}g&&g(I,n)},!((i=this.room.engine.pcManager)===null||i===void 0)&&i.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(),Ji.info("now the room is connected")}catch(i){throw this.appendWarning("ports need to be open on firewall in order to connect."),i}A||this.appendWarning("Server is not configured for ICE/TCP"),e||this.appendWarning("No public IPv4 UDP candidates were found. Your server is likely not configured correctly")})}}function DKA(t){const A=t.split(".");if(A.length===4){if(A[0]==="10")return!0;if(A[0]==="192"&&A[1]==="168")return!0;if(A[0]==="172"){const e=parseInt(A[1],10);if(e>=16&&e<=31)return!0}}return!1}class yKA extends yu{get description(){return"Connecting to signal connection via WebSocket"}perform(){return vA(this,void 0,void 0,function*(){var A,e,i;(this.url.startsWith("ws:")||this.url.startsWith("http:"))&&this.appendWarning("Server is insecure, clients may block connections to it");let g=new AO,I;try{I=yield g.join(this.url,this.token,{autoSubscribe:!0,maxRetries:0,e2eeEnabled:!1,websocketTimeout:15e3},void 0,!0)}catch(n){if(iy(new URL(this.url))){this.appendMessage("Initial connection failed with error ".concat(n.message,". Retrying with region fallback"));const a=yield new Sg(this.url,this.token).getNextBestRegionUrl();a&&(I=yield g.join(a,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,".")),((A=I.serverInfo)===null||A===void 0?void 0:A.edition)===qeA.Cloud&&(!((e=I.serverInfo)===null||e===void 0)&&e.region)&&this.appendMessage("LiveKit Cloud: ".concat((i=I.serverInfo)===null||i===void 0?void 0:i.region))):this.appendError("Websocket connection could not be established"),yield g.close()})}}class s6A extends zc.EventEmitter{constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};super(),this.options={},this.checkResults=new Map,this.url=A,this.token=e,this.options=i}getNextCheckId(){const A=this.checkResults.size;return this.checkResults.set(A,{logs:[],status:gB.IDLE,name:"",description:""}),A}updateCheck(A,e){this.checkResults.set(A,e),this.emit("checkUpdate",A,e)}isSuccess(){return Array.from(this.checkResults.values()).every(A=>A.status!==gB.FAILED)}getResults(){return Array.from(this.checkResults.values())}createAndRunCheck(A){return vA(this,void 0,void 0,function*(){const e=this.getNextCheckId(),i=new A(this.url,this.token,this.options),g=n=>{this.updateCheck(e,n)};i.on("update",g);const I=yield i.run();return i.off("update",g),I})}checkWebsocket(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(yKA)})}checkWebRTC(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(fKA)})}checkTURN(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(pKA)})}checkReconnect(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(dKA)})}checkPublishAudio(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(uKA)})}checkPublishVideo(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(hKA)})}checkConnectionProtocol(){return vA(this,void 0,void 0,function*(){const A=yield this.createAndRunCheck(EKA);if(A.data&&"protocol"in A.data){const e=A.data;this.options.protocol=e.protocol}return A})}checkCloudRegion(){return vA(this,void 0,void 0,function*(){return this.createAndRunCheck(QKA)})}}function Ag(t,A,e){return(A=wKA(A))in t?Object.defineProperty(t,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[A]=e,t}function SKA(t,A){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,A);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(t)}function wKA(t){var A=SKA(t,"string");return typeof A=="symbol"?A:A+""}new TextEncoder;new TextDecoder;class rr extends Error{constructor(A,e){var i;super(A,e),Ag(this,"code","ERR_JOSE_GENERIC"),this.name=this.constructor.name,(i=Error.captureStackTrace)===null||i===void 0||i.call(Error,this,this.constructor)}}Ag(rr,"code","ERR_JOSE_GENERIC");class mKA extends rr{constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(A,{cause:{claim:i,reason:g,payload:e}}),Ag(this,"code","ERR_JWT_CLAIM_VALIDATION_FAILED"),Ag(this,"claim",void 0),Ag(this,"reason",void 0),Ag(this,"payload",void 0),this.claim=i,this.reason=g,this.payload=e}}Ag(mKA,"code","ERR_JWT_CLAIM_VALIDATION_FAILED");class kKA extends rr{constructor(A,e){let i=arguments.length>2&&arguments[2]!==void 0?arguments[2]:"unspecified",g=arguments.length>3&&arguments[3]!==void 0?arguments[3]:"unspecified";super(A,{cause:{claim:i,reason:g,payload:e}}),Ag(this,"code","ERR_JWT_EXPIRED"),Ag(this,"claim",void 0),Ag(this,"reason",void 0),Ag(this,"payload",void 0),this.claim=i,this.reason=g,this.payload=e}}Ag(kKA,"code","ERR_JWT_EXPIRED");class MKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JOSE_ALG_NOT_ALLOWED")}}Ag(MKA,"code","ERR_JOSE_ALG_NOT_ALLOWED");class NKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JOSE_NOT_SUPPORTED")}}Ag(NKA,"code","ERR_JOSE_NOT_SUPPORTED");class GKA extends rr{constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"decryption operation failed",e=arguments.length>1?arguments[1]:void 0;super(A,e),Ag(this,"code","ERR_JWE_DECRYPTION_FAILED")}}Ag(GKA,"code","ERR_JWE_DECRYPTION_FAILED");class RKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JWE_INVALID")}}Ag(RKA,"code","ERR_JWE_INVALID");class UKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JWS_INVALID")}}Ag(UKA,"code","ERR_JWS_INVALID");class KKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JWT_INVALID")}}Ag(KKA,"code","ERR_JWT_INVALID");class FKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JWK_INVALID")}}Ag(FKA,"code","ERR_JWK_INVALID");class bKA extends rr{constructor(){super(...arguments),Ag(this,"code","ERR_JWKS_INVALID")}}Ag(bKA,"code","ERR_JWKS_INVALID");class vKA extends rr{constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"no applicable key found in the JSON Web Key Set",e=arguments.length>1?arguments[1]:void 0;super(A,e),Ag(this,"code","ERR_JWKS_NO_MATCHING_KEY")}}Ag(vKA,"code","ERR_JWKS_NO_MATCHING_KEY");class _KA extends rr{constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"multiple matching keys found in the JSON Web Key Set",e=arguments.length>1?arguments[1]:void 0;super(A,e),Ag(this,Symbol.asyncIterator,void 0),Ag(this,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS")}}Ag(_KA,"code","ERR_JWKS_MULTIPLE_MATCHING_KEYS");class JKA extends rr{constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"request timed out",e=arguments.length>1?arguments[1]:void 0;super(A,e),Ag(this,"code","ERR_JWKS_TIMEOUT")}}Ag(JKA,"code","ERR_JWKS_TIMEOUT");class LKA extends rr{constructor(){let A=arguments.length>0&&arguments[0]!==void 0?arguments[0]:"signature verification failed",e=arguments.length>1?arguments[1]:void 0;super(A,e),Ag(this,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED")}}Ag(LKA,"code","ERR_JWS_SIGNATURE_VERIFICATION_FAILED");const qKA=15e3,xKA=1e4,AiA=p.createContext(null),TKA=()=>p.useContext(AiA);function YKA({children:t}){const{user:A}=Yi(),e=Xn(),i=A?.id,g=!!(A?.email&&/@guest\.local$/i.test(A.email)),I=!!i&&!g,n=p.useRef(null),[o,a]=p.useState(null),r=p.useRef(null);p.useEffect(()=>{r.current=o},[o]);const[s,B]=p.useState(!1),[c,E]=p.useState(!1),[D,y]=p.useState(null),[S,f]=p.useState(!1),M=p.useRef(null),[k,m]=p.useState([]),[U,F]=p.useState(null),[b,K]=p.useState(!1),[R,G]=p.useState(!1),[J,x]=p.useState(null),[H,P]=p.useState(null),j=p.useRef(null);p.useEffect(()=>{j.current=H},[H]);const q=p.useCallback(()=>{const oA=n.current;if(!oA){m([]),F(null);return}const AA=[];oA.remoteParticipants.forEach(iA=>{const hA=iA.getTrackPublication(Pe.Source.Camera)?.track,DA=iA.getTrackPublication(Pe.Source.Microphone)?.track;AA.push({id:iA.identity,name:iA.name||iA.identity,isSelf:!1,audioEnabled:iA.isMicrophoneEnabled,videoEnabled:iA.isCameraEnabled,isSpeaking:iA.isSpeaking,videoTrack:hA||void 0,audioTrack:DA||void 0})}),m(AA);const tA=oA.localParticipant;if(tA){const hA=tA.getTrackPublication(Pe.Source.Camera)?.track,DA=tA.getTrackPublication(Pe.Source.Microphone)?.track;F({id:tA.identity,name:tA.name||tA.identity,isSelf:!0,audioEnabled:tA.isMicrophoneEnabled,videoEnabled:tA.isCameraEnabled,isSpeaking:tA.isSpeaking,videoTrack:hA||void 0,audioTrack:DA||void 0}),x(hA||null),K(tA.isMicrophoneEnabled),G(tA.isCameraEnabled)}},[]),Y=p.useRef(null),O=p.useRef(!1),$=p.useRef(0),gA=3,z=p.useCallback(async oA=>{if(!I||!e){y("Not authenticated");return}if(!(r.current===oA&&n.current)){if(M.current&&(clearTimeout(M.current),M.current=null),n.current){const AA=n.current;n.current=null;try{const tA=AA.localParticipant;if(tA){try{await tA.setCameraEnabled(!1)}catch{}try{await tA.setMicrophoneEnabled(!1)}catch{}}AA.disconnect()}catch{}}B(!1),a(null),P(oA),f(!1),K(!1),G(!1),y(null)}},[I,e]),X=p.useCallback(async(oA,AA=0)=>{if(!I||!e)return y("Not authenticated"),!1;if(r.current===oA&&n.current)return!0;if(Y.current===oA&&AA===0)return!1;if(AA===0&&($.current=0),n.current){const tA=n.current;n.current=null;try{const iA=tA.localParticipant;if(iA){try{await iA.setCameraEnabled(!1)}catch{}try{await iA.setMicrophoneEnabled(!1)}catch{}}tA.disconnect()}catch{}}Y.current=oA,O.current=!1,E(!0),y(null);try{const tA=await new Promise((OA,Qe)=>{const nA=setTimeout(()=>{Qe(new Error("livekit_join timed out"))},xKA);e.emit("livekit_join",{roomId:oA},eA=>{clearTimeout(nA),OA(eA)})});if(O.current)return Y.current=null,!1;if(!tA?.ok)throw new Error(tA?.error||"Failed to get LiveKit token");const{token:iA,url:hA,iceServers:DA}=tA,dA={};DA&&Array.isArray(DA)&&DA.length>0&&(dA.iceServers=DA,dA.iceTransportPolicy="all");const SA=new gy({adaptiveStream:!0,dynacast:!0,videoCaptureDefaults:{resolution:ty.h540.resolution}});await SA.prepareConnection(hA,iA),SA.on(et.Connected,()=>{n.current===SA&&(B(!0),E(!1),q())}),SA.on(et.ParticipantConnected,OA=>{q()}),SA.on(et.ParticipantDisconnected,OA=>{q()}),SA.on(et.TrackSubscribed,(OA,Qe,nA)=>{q()}),SA.on(et.TrackUnsubscribed,(OA,Qe,nA)=>{q()}),SA.on(et.LocalTrackPublished,(OA,Qe)=>{q()}),SA.on(et.LocalTrackUnpublished,(OA,Qe)=>{q()}),SA.on(et.ActiveSpeakersChanged,()=>{q()}),SA.on(et.ConnectionStateChanged,OA=>{if(n.current===SA)if(OA===ug.Disconnected){n.current=null,B(!1),q(),P(oA);const Qe=r.current;Qe&&!O.current&&oA===Qe&&setTimeout(()=>{!O.current&&r.current===oA&&X(oA,0)},1500)}else OA===ug.Reconnecting||OA===ug.Connected&&B(!0)});const NA=Object.keys(dA).length>0?{rtcConfig:dA}:void 0;return await SA.connect(hA,iA,NA),O.current?(SA.disconnect(),Y.current=null,!1):(n.current=SA,a(oA),P(null),Y.current=null,!0)}catch(tA){if(AA<gA&&!O.current){const iA=Math.min(1e3*Math.pow(2,AA),5e3);if(Y.current=null,await new Promise(hA=>setTimeout(hA,iA)),!O.current)return $.current=AA+1,X(oA,AA+1)}return y(tA?.message||"Failed to join room"),E(!1),a(null),Y.current=null,f(!0),!1}},[I,e,q]),sA=p.useCallback(async()=>{M.current&&(clearTimeout(M.current),M.current=null),O.current=!0,Y.current=null,P(null);const oA=n.current;if(oA){n.current=null;try{const AA=oA.localParticipant;if(AA){try{AA.isCameraEnabled&&await AA.setCameraEnabled(!1)}catch{}try{AA.isMicrophoneEnabled&&await AA.setMicrophoneEnabled(!1)}catch{}}oA.disconnect()}catch{}}B(!1),E(!1),a(null),m([]),F(null),x(null),K(!1),G(!1)},[]),rA=p.useCallback(()=>{M.current&&(clearTimeout(M.current),M.current=null);const oA=n.current;if(!oA)return;const AA=oA.localParticipant;if(!AA||AA.isMicrophoneEnabled||AA.isCameraEnabled)return;let tA=!1;oA.remoteParticipants.forEach(iA=>{(iA.isMicrophoneEnabled||iA.isCameraEnabled)&&(tA=!0)}),!tA&&(M.current=setTimeout(()=>{M.current=null;const iA=n.current;if(!iA)return;const hA=iA.localParticipant;if(hA&&(hA.isMicrophoneEnabled||hA.isCameraEnabled))return;let DA=!1;if(iA.remoteParticipants.forEach(SA=>{(SA.isMicrophoneEnabled||SA.isCameraEnabled)&&(DA=!0)}),DA)return;const dA=r.current;n.current=null;try{iA.disconnect()}catch{}B(!1),a(null),m([]),F(null),x(null),dA&&P(dA)},qKA))},[]),mA=p.useCallback(()=>{M.current&&(clearTimeout(M.current),M.current=null)},[]),IA=p.useCallback(async()=>{if(n.current)return n.current;const oA=j.current;return oA&&await X(oA)?n.current:null},[X]),uA=p.useCallback(async()=>{const oA=await IA();if(oA)try{const AA=!oA.localParticipant.isMicrophoneEnabled;AA&&mA(),await oA.localParticipant.setMicrophoneEnabled(AA),K(AA),AA||rA()}catch{}},[IA,mA,rA]),KA=p.useCallback(async()=>{const oA=await IA();if(oA)try{const AA=!oA.localParticipant.isCameraEnabled;AA&&mA(),await oA.localParticipant.setCameraEnabled(AA),G(AA),q(),AA||rA()}catch{}},[IA,q,mA,rA]),FA=p.useCallback(async oA=>{if(oA){mA();const AA=await IA();if(!AA)return;try{await AA.localParticipant.setMicrophoneEnabled(!0),K(!0)}catch{}}else{const AA=n.current;if(!AA){K(!1);return}try{await AA.localParticipant.setMicrophoneEnabled(!1),K(!1),rA()}catch{}}},[IA,mA,rA]),RA=p.useCallback(async oA=>{if(oA){mA();const AA=await IA();if(!AA)return;try{await AA.localParticipant.setCameraEnabled(!0),G(!0),q()}catch{}}else{const AA=n.current;if(!AA){G(!1);return}try{await AA.localParticipant.setCameraEnabled(!1),G(!1),q(),rA()}catch{}}},[IA,q,mA,rA]);p.useEffect(()=>()=>{M.current&&(clearTimeout(M.current),M.current=null),O.current=!0,Y.current=null;const oA=n.current;if(oA){n.current=null;try{const AA=oA.localParticipant;if(AA){try{AA.setCameraEnabled(!1)}catch{}try{AA.setMicrophoneEnabled(!1)}catch{}}oA.disconnect()}catch{}}},[]);const MA={connected:s,connecting:c,error:D,liveKitFailed:S,joinRoom:z,leaveRoom:sA,currentRoomId:o,pendingRoomId:H,participants:k,localParticipant:U,micEnabled:b,videoEnabled:R,toggleMic:uA,toggleVideo:KA,setMicEnabled:FA,setVideoEnabled:RA,localVideoTrack:J};return Q.jsx(AiA.Provider,{value:MA,children:t})}const eiA=p.createContext(null),HKA=()=>p.useContext(eiA);function QI(t){return t.connectionState==="closed"||t.signalingState==="closed"}function vN(t){if(t)try{t.getTracks().forEach(A=>A.stop())}catch{}}function OKA(t){try{const A=t.getAudioTracks?.()||[],e=t.getVideoTracks?.()||[],i=A.map(I=>({id:I.id,kind:I.kind,enabled:I.enabled,ready:I.readyState})),g=e.map(I=>({id:I.id,kind:I.kind,enabled:I.enabled,ready:I.readyState,settings:I.getSettings?.()||void 0}));return{id:t.id,audioTracks:i.length,videoTracks:g.length,audio:i,video:g}}catch{return{id:t?.id}}}const PKA=(()=>{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 Gw(t,A){const e=new Set,i=[],g=I=>{const n=Array.isArray(I.urls)?I.urls:I.urls?[I.urls]:[];for(const o of n){if(!o||typeof o!="string")continue;const a=o.trim();if(a.startsWith("stun:")){const r=`${a}|`;e.has(r)||(e.add(r),i.push({urls:a}));continue}if(a.startsWith("turn:")||a.startsWith("turns:")){const r=I.username,s=I.credential;if(r&&s){const B=`${a}|${r}|${s}`;e.has(B)||(e.add(B),i.push({urls:a,username:r,credential:s}))}}}};return(t||[]).forEach(g),i.length===0&&A.forEach(g),i.length?i:A}function jKA(t,A){if(!A.heartbeat){try{A.dc||(A.dc=A.pc.createDataChannel("ka",{negotiated:!1,ordered:!0}))}catch{}A.heartbeat=window.setInterval(()=>{try{A.dc?.readyState==="open"&&A.dc.send("ping")}catch{}},12e3)}}function Rw(t){t.heartbeat&&(clearInterval(t.heartbeat),t.heartbeat=void 0);try{t.dc?.close()}catch{}t.dc=void 0}function ZKA({children:t}){const{user:A}=Yi(),e=Xn(),i=A?.id,g=!!(A?.email&&/@guest\.local$/i.test(A.email)),I=!!i&&!g;function n(CA,EA){try{const yA=window;yA.__rtcVideoDisableReasons||(yA.__rtcVideoDisableReasons=[]),yA.__rtcVideoDisableReasons.push({t:Date.now(),reason:CA,...EA?{data:EA}:{}});try{ZT(`video:disable:${CA}`)}catch{}}catch{}}const{rtcJoin:o,rtcSignal:a,rtcLeave:r,rtcSetVideoEnabled:s}=OI(),B=p.useRef(new Map),[c,E]=p.useState({}),D=null,[y,S]=p.useState({}),[f,M]=p.useState(void 0),k=p.useRef(void 0),m=p.useRef(void 0),U=p.useRef(""),F=p.useRef(new Map),b=p.useRef(new Map),[K,R]=p.useState(!1),[G,J]=p.useState(!1),x=[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}],H=p.useRef([...x]),[P,j]=p.useState(0),q=p.useRef(null);p.useRef([]);const Y=p.useRef({audio:!1,video:!1}),O=P>0||G||K,$=p.useCallback(async()=>{try{const CA=navigator;CA?.wakeLock?.request&&!q.current&&(q.current=await CA.wakeLock.request("screen"),q.current.addEventListener("release",()=>{}))}catch{}},[]),gA=p.useCallback(async()=>{try{await q.current?.release?.()}catch{}q.current=null},[]);p.useEffect(()=>(_t.debug("wakeLock:effect",{need:O}),O?$():gA(),()=>{gA()}),[O,$,gA]),p.useEffect(()=>{const CA=()=>{document.visibilityState==="visible"&&O&&$()};return document.addEventListener("visibilitychange",CA),()=>document.removeEventListener("visibilitychange",CA)},[O,$]);const z=(()=>{try{return window.Capacitor?.getPlatform?.()==="ios"}catch{return!1}})();async function X(CA,EA){if(!I||Y.current[EA])return null;Y.current[EA]=!0;try{return navigator.mediaDevices?.getUserMedia?await navigator.mediaDevices.getUserMedia(CA):(_t.error("gUM:not-available",{kind:EA,isNativeIOS:z}),null)}catch(yA){return _t.error("gUM:failed",{kind:EA,errName:yA?.name,errMsg:yA?.message,isNativeIOS:z}),null}finally{Y.current[EA]=!1}}async function sA(){if(!I)return;if(m.current)return m.current;const CA=await X({audio:!0,video:!1},"audio");if(CA){const EA=CA.getAudioTracks()[0];EA&&(EA.enabled=!1),m.current=CA}return m.current}async function rA(){if(!I)return;if(k.current)return k.current;const EA=await X({audio:!1,video:PKA?{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 EA&&(k.current=EA,M(EA),_t.info("ensureVideo:acquired",OKA(EA))),k.current}function mA(){const CA=k.current?.getVideoTracks()??[];try{CA.forEach(EA=>{EA.stop()})}catch{}k.current=void 0,M(void 0)}function IA(){try{m.current?.getAudioTracks()?.forEach(CA=>CA.stop())}catch{}m.current=void 0}const uA=p.useRef(new Map),[KA,FA]=p.useState({});function RA(CA,EA){if(uA.current.get(CA))return;const yA=EA?.getAudioTracks?.()??[];if(!yA.length||yA.every(st=>st.readyState!=="live"))return;let xA;try{xA=new AudioContext}catch(st){_t.warn("vad:audiocontext-failed",{pid:CA,err:String(st)});return}let XA,pe;try{XA=xA.createMediaStreamSource(EA),pe=xA.createAnalyser(),pe.fftSize=2048,XA.connect(pe)}catch(st){_t.warn("vad:setup-failed",{pid:CA,err:String(st)});try{xA.close()}catch{}return}const be=new Uint8Array(pe.fftSize);let It=0;const Ut=.04,pg=.02;let Ge=!1,lt=!1;const Rt=()=>{if(!lt){try{pe.getByteTimeDomainData(be);let st=0;for(let jA=0;jA<be.length;jA++){const Me=(be[jA]-128)/128;st+=Me*Me}const Be=Math.sqrt(st/be.length);!Ge&&Be>=Ut?(Ge=!0,FA(jA=>jA[CA]===!0?jA:{...jA,[CA]:!0})):Ge&&Be<=pg&&(Ge=!1,FA(jA=>jA[CA]===!1?jA:{...jA,[CA]:!1}))}catch{}lt||(It=requestAnimationFrame(Rt))}};It=requestAnimationFrame(Rt);const Yt=()=>{lt=!0,cancelAnimationFrame(It);try{XA.disconnect()}catch{}try{pe.disconnect()}catch{}xA.close().catch(()=>{})};uA.current.set(CA,Yt)}function MA(CA){const EA=uA.current.get(CA);EA&&(EA(),uA.current.delete(CA)),FA(yA=>{if(!(CA in yA))return yA;const xA={...yA};return delete xA[CA],xA})}function oA(CA,EA){try{return QI(CA)?void 0:CA.getTransceivers().find(yA=>yA.receiver.track?.kind===EA)??CA.getTransceivers().find(yA=>yA.sender.track?.kind===EA)??CA.getTransceivers()[EA==="audio"?0:1]}catch{return}}function AA(CA,EA){try{return QI(CA)?void 0:CA.getSenders().find(yA=>yA.track?.kind===EA)??oA(CA,EA)?.sender}catch{return}}async function tA(CA,EA){try{if(QI(CA))return;const yA=EA?.getAudioTracks?.()[0]??null,xA=AA(CA,"audio");xA&&await xA.replaceTrack(yA)}catch(yA){_t.warn("upsertAudioTrack:failed",{err:String(yA)})}}async function iA(CA,EA){try{if(QI(CA))return;const yA=EA?.getVideoTracks?.()[0]??null,xA=AA(CA,"video");xA&&await xA.replaceTrack(yA)}catch(yA){_t.warn("upsertVideoTrack:failed",{err:String(yA)})}}async function hA(CA,EA){try{const yA=EA.pc,xA=Date.now();let XA=0,pe=0;(await yA.getStats()).forEach(Ut=>{Ut.type==="outbound-rtp"&&!Ut.isRemote&&(XA+=Ut.bytesSent??0),Ut.type==="inbound-rtp"&&!Ut.isRemote&&(pe+=Ut.bytesReceived??0)});const It=b.current.get(CA);b.current.set(CA,{t:xA,up:XA,down:pe}),It&&yA.connectionState==="connected"&&XA===It.up&&pe===It.down&&xA-It.t>2e4&&await eA(CA,EA)}catch{}}function DA(CA,EA){if(F.current.get(CA))return;const yA=window.setInterval(()=>hA(CA,EA),1e4);F.current.set(CA,yA)}function dA(CA){const EA=F.current.get(CA);EA&&(clearInterval(EA),F.current.delete(CA)),b.current.delete(CA)}function SA(){const CA=typeof window<"u"?new URL(window.location.href):null,EA=typeof localStorage<"u"&&(localStorage.getItem("rtcRelayOnly")==="1"||localStorage.getItem("rtcRelayOnly")==="true")||CA?.searchParams.get("rtcRelay")==="1"||CA?.searchParams.get("rtcRelay")==="true",yA=!!OA._compat,xA=!!(EA||yA),XA={iceServers:Gw(H.current,x),bundlePolicy:"balanced",iceTransportPolicy:xA?"relay":"all",rtcpMuxPolicy:"require",iceCandidatePoolSize:2};XA.iceServers.some(be=>(Array.isArray(be.urls)?be.urls:[be.urls]).some(Ut=>Ut.startsWith("turn:")||Ut.startsWith("turns:"))),_t.debug("pc:new",{relayOnly:xA,iceTransportPolicy:XA.iceTransportPolicy,iceServers:(XA.iceServers||[]).map(be=>typeof be.urls=="string"?be.urls:be.urls?.[0])});let pe;try{pe=new RTCPeerConnection(XA)}catch(be){_t.error("pc:new-failed",{err:String(be),servers:XA.iceServers});const It={...XA,iceServers:x};pe=new RTCPeerConnection(It)}return pe.addTransceiver("audio",{direction:"sendrecv"}),pe.addTransceiver("video",{direction:"sendrecv"}),pe}async function NA(CA,EA){try{const yA=await EA.getStats(),xA={};yA.forEach(pe=>{pe&&pe.id&&(xA[pe.id]=pe)});let XA;if(yA.forEach(pe=>{pe.type==="transport"&&pe.selectedCandidatePairId&&xA[pe.selectedCandidatePairId]&&(XA=xA[pe.selectedCandidatePairId])}),XA||yA.forEach(pe=>{pe.type==="candidate-pair"&&(pe.selected||pe.state==="succeeded")&&(XA=pe)}),XA){const pe=xA[XA.localCandidateId],be=xA[XA.remoteCandidateId];_t.info("ice:selected",{peerId:CA,state:XA.state,nominated:XA.nominated,bytesSent:XA.bytesSent,bytesReceived:XA.bytesReceived,local:pe?{type:pe.candidateType,protocol:pe.protocol,address:pe.address,port:pe.port}:void 0,remote:be?{type:be.candidateType,protocol:be.protocol,address:be.address,port:be.port}:void 0})}else _t.debug("ice:selected:none",{peerId:CA})}catch(yA){_t.error("ice:selected-failed",{peerId:CA,err:String(yA)})}}async function OA(){try{if(OA._ran)return;OA._ran=!0;const CA={iceServers:Gw(H.current,x),bundlePolicy:"balanced",iceTransportPolicy:"all"},EA=new RTCPeerConnection(CA),yA={host:0,srflx:0,relay:0,prflx:0};EA.onicecandidate=Ut=>{if(!Ut.candidate)return;const lt=(Ut.candidate.candidate||"").match(/ typ ([a-z]+)/)?.[1]||"unknown";yA[lt]===void 0&&(yA[lt]=0),yA[lt]+=1},EA.createDataChannel("probe");const xA=await EA.createOffer({iceRestart:!1});await EA.setLocalDescription(xA),await new Promise(Ut=>setTimeout(Ut,4e3));try{EA.close()}catch{}const XA=(yA.relay||0)>0,pe=(yA.srflx||0)>0,be=(yA.host||0)>0,It=XA&&!pe&&be;if(It){_t.warn("ice:probe-forcing-relay",{counts:yA,reason:"no-srflx"}),OA._compat=!0;try{localStorage.setItem("rtcRelayOnly","1")}catch{}}else!XA&&!pe&&_t.error("ice:probe-restricted-network",{counts:yA,warning:"Voice/video may not work"});_t.info("ice:probe",{counts:yA,relayOK:XA,srflxOK:pe,needsRelayOnly:It})}catch(CA){_t.error("ice:probe-failed",{err:String(CA)})}}function Qe(CA){let EA=B.current.get(CA);if(EA)return EA;const yA=SA(),xA={pc:yA,iceBuffer:[],makingOffer:!1,ignoreOffer:!1,isSettingRemoteAnswerPending:!1};return yA.onicecandidate=XA=>{XA.candidate&&(_t.debug("pc:icecandidate",{peerId:CA,ctype:XA.candidate.type,proto:XA.candidate.protocol,addr:XA.candidate.address,port:XA.candidate.port}),a(U.current,CA,{ice:XA.candidate.toJSON()}).catch(console.error))},yA.ontrack=XA=>{if(_t.info("pc:ontrack",{peerId:CA,kind:XA.track.kind,id:XA.track.id}),E(pe=>{const be=pe[CA]??new MediaStream;return be.getTracks().includes(XA.track)||(be.addTrack(XA.track),XA.track.addEventListener("ended",()=>{_t.debug("pc:track-ended",{peerId:CA,kind:XA.track.kind,id:XA.track.id}),E(It=>{const Ut=It[CA];if(!Ut)return It;try{Ut.removeTrack(XA.track)}catch{}return{...It,[CA]:Ut}}),XA.track.kind==="video"&&S(It=>({...It,[CA]:!1}))}),XA.track.kind==="video"&&(XA.track.addEventListener("mute",()=>{S(It=>({...It,[CA]:!1}))}),XA.track.addEventListener("unmute",()=>{XA.track.readyState==="live"&&S(It=>({...It,[CA]:!0}))}))),{...pe,[CA]:be}}),XA.track.kind==="video"){const pe=XA.track.readyState==="live"&&!XA.track.muted;S(be=>({...be,[CA]:pe}))}},yA.onnegotiationneeded=()=>{_t.debug("pc:onnegotiationneeded",{peerId:CA})},yA.onconnectionstatechange=()=>{const{connectionState:XA}=yA,pe=yA.iceConnectionState;if(_t.info("pc:state",{peerId:CA,state:XA,ice:pe}),XA==="connected"&&(xA.degradedAt=null,xA.iceRestartCount=0,xA.rebuildAttempts=0,jKA(CA,xA),DA(CA,xA),setTimeout(()=>NA(CA,yA),500)),XA==="closed"&&(Rw(xA),dA(CA)),(XA==="disconnected"||nA(XA,pe))&&!xA.degradedAt&&(xA.degradedAt=Date.now()),XA==="disconnected"&&xA.degradedAt){const It=Date.now()-xA.degradedAt;It>3e3&&It<8e3?eA(CA,xA):It>=8e3&&(_t.warn("pc:prolonged-disconnect",{peerId:CA,degradedMs:It}),ne(CA))}nA(XA,pe)&&eA(CA,xA)},yA.oniceconnectionstatechange=()=>{const XA=yA.iceConnectionState;_t.debug("pc:ice-state",{peerId:CA,ice:XA}),XA==="failed"&&eA(CA,xA),XA==="disconnected"&&setTimeout(()=>{!QI(yA)&&yA.iceConnectionState==="disconnected"&&(_t.warn("ice:prolonged-disconnect",{peerId:CA}),eA(CA,xA))},4e3)},yA.onicegatheringstatechange=()=>{},yA.ondatachannel=XA=>{if(XA.channel.label==="ka"){const pe=XA.channel;xA.dc=pe,_t.debug("pc:datachannel",{peerId:CA,label:pe.label,state:pe.readyState})}},B.current.set(CA,xA),j(B.current.size),_t.info("peer:new",{peerId:CA}),xA}function nA(CA,EA){return CA==="failed"||EA==="failed"}async function eA(CA,EA){if(QI(EA.pc))return;const yA=Date.now(),xA=EA.lastIceRestartAt,XA=EA.iceRestartCount??0,pe=Math.min(1e4*Math.pow(2,XA),6e4);if(!(xA&&yA-xA<pe)){if(XA>=3){_t.warn("ice:restart-exhausted",{peerId:CA,restartCount:XA}),EA.iceRestartCount=0,await ne(CA);return}if(_t.warn("ice:restart",{peerId:CA,attempt:XA+1}),!(EA.makingOffer||QI(EA.pc))&&(EA.pc.signalingState!=="stable"&&await VA(EA.pc),!QI(EA.pc)))try{const be=await EA.pc.createOffer({iceRestart:!0});if(QI(EA.pc))return;await EA.pc.setLocalDescription(be),await a(U.current,CA,{sdp:EA.pc.localDescription}),EA.lastIceRestartAt=yA,EA.iceRestartCount=XA+1}catch(be){_t.error("ice:restart-failed",{peerId:CA,err:String(be)}),EA.iceRestartCount=0,await ne(CA)}}}const UA=p.useRef(new Map),HA=3,Se=3e4;async function ne(CA){const EA=UA.current.get(CA)??{count:0,lastAt:0},yA=Date.now();if(yA-EA.lastAt>Se*3&&(EA.count=0),EA.count>=HA){const be=Se-(yA-EA.lastAt);if(be>0){_t.warn("rebuild:rate-limited",{peerId:CA,attempts:EA.count,waitMs:be}),setTimeout(()=>{UA.current.delete(CA),ne(CA)},be);return}EA.count=0}EA.count++,EA.lastAt=yA,UA.current.set(CA,EA),_t.info("rebuild:peer",{peerId:CA,attempt:EA.count});const xA=B.current.get(CA);if(xA){Rw(xA);try{xA.pc.close()}catch{}B.current.delete(CA)}E(be=>{if(!be[CA])return be;const It={...be};return vN(It[CA]),delete It[CA],It}),MA(CA),S(be=>{const{[CA]:It,...Ut}=be;return Ut});const{pc:XA}=Qe(CA);await zA(XA);const pe=B.current.get(CA);await de(CA,XA,pe)}function Oe(CA){return CA.signalingState==="stable"}function VA(CA){return CA.signalingState==="stable"||QI(CA)?Promise.resolve():new Promise(EA=>{const yA=()=>{const xA=CA.signalingState;(xA==="stable"||xA==="closed")&&(CA.removeEventListener("signalingstatechange",yA),EA())};CA.addEventListener("signalingstatechange",yA)})}async function de(CA,EA,yA){try{if(QI(EA)||(Oe(EA)||await VA(EA),!Oe(EA)||yA.makingOffer||QI(EA)))return;yA.makingOffer=!0,_t.debug("sdp:offer",{peerId:CA});const xA=await EA.createOffer();if(QI(EA)){yA.makingOffer=!1;return}await EA.setLocalDescription(xA),await a(U.current,CA,{sdp:EA.localDescription})}catch(xA){_t.warn("safeRenegotiate:failed",{peerId:CA,err:String(xA)})}finally{yA.makingOffer=!1}}const te=p.useCallback(async CA=>{if(CA!==G){if(!I){J(!1),n("preferences:init"),J(!1);return}if(CA&&A?.membershipTier!=="PREMIUM"){_t.info("video:premium-blocked",{tier:A?.membershipTier});return}if(J(CA),i&&S(EA=>({...EA,[i]:CA})),CA){try{Sm(!0)}catch{}if(!await rA()){J(!1),i&&S(XA=>({...XA,[i]:!1}));return}for(const[XA,pe]of B.current)await iA(pe.pc,k.current),await de(XA,pe.pc,pe);const yA=()=>{try{Sm(!1)}catch{}};let xA=!1;for(const[,XA]of B.current){const pe=XA.pc,be=()=>{!xA&&pe.connectionState==="connected"&&(xA=!0,yA(),pe.removeEventListener("connectionstatechange",be))};pe.addEventListener("connectionstatechange",be)}window.setTimeout(()=>{xA||yA()},2500)}else{for(const[EA,yA]of B.current)await iA(yA.pc,void 0),await de(EA,yA.pc,yA);mA()}s(U.current,CA).catch(()=>{});try{ZT(CA?"videoEnabled:on":"videoEnabled:off")}catch{}}},[G,i,I,A?.membershipTier,B,rA,iA,de,mA,s]),WA=async CA=>{if(!I){R(!1);return}if(R(CA),CA&&!m.current&&!await sA()){R(!1);return}const EA=m.current?.getAudioTracks?.()[0];EA&&(EA.enabled=CA);for(const[,yA]of B.current)await tA(yA.pc,m.current)},_A=CA=>CA===i?!!k.current?.getVideoTracks?.().some(yA=>yA.readyState==="live"):!!c[CA]?.getVideoTracks?.().some(yA=>yA.readyState==="live"),zA=async CA=>{if(!QI(CA)){if(!I){await tA(CA,void 0),await iA(CA,void 0);return}try{if(await sA(),G&&await rA(),QI(CA))return;_t.debug("attachLocalTracks",{audio:!!(K&&m.current),video:!!(G&&k.current)}),await tA(CA,K?m.current:void 0),await iA(CA,G?k.current:void 0)}catch(EA){_t.warn("attachLocalTracks:failed",{err:String(EA)})}}},ge=p.useRef(0),he=5400*1e3;p.useEffect(()=>{if(!U.current||B.current.size===0)return;const CA=async()=>{const yA=Date.now();if(!(yA-ge.current<he)){_t.info("ice:refresh-credentials",{roomId:U.current});try{const xA=await o(U.current);if(xA?.ok&&Array.isArray(xA.iceServers)&&xA.iceServers.length){const XA=Gw([...x,...xA.iceServers],x);H.current=XA,ge.current=yA,_t.debug("ice:credentials-refreshed",{count:XA.length})}}catch(xA){_t.warn("ice:refresh-failed",{err:String(xA)})}}},EA=window.setInterval(CA,6e4);return()=>clearInterval(EA)},[P,o]);const ve=async CA=>{if(!I||!i)return;U.current=CA,_t.info("rtc:join",{roomId:CA});const EA=3,yA=150;let xA=null,XA=null;for(let pe=0;pe<EA&&(xA=await o(CA),!(xA?.ok||(XA=xA?.error||"rtc_join failed",!/not a member|room not found/i.test(XA||"")||pe>=EA-1)));pe++)_t.warn("rtc:join:retry",{roomId:CA,attempt:pe+1,error:XA}),await new Promise(It=>setTimeout(It,yA*(pe+1)));if(!xA?.ok)throw new Error(XA||"rtc_join failed");if(Array.isArray(xA.iceServers)&&xA.iceServers.length){const pe=Gw([...x,...xA.iceServers],x);H.current=pe,ge.current=Date.now(),pe.some(be=>(Array.isArray(be.urls)?be.urls:[be.urls]).some(Ut=>Ut.startsWith("turn:")||Ut.startsWith("turns:"))),_t.debug("rtc:ice-servers",{count:pe.length,servers:pe.map(be=>be.urls).slice(0,4)})}else H.current=[...x],ge.current=Date.now();if(OA(),G&&!k.current){const pe=await rA();pe&&M(pe)}for(const pe of xA.peers.filter(be=>be!==i)){const{pc:be}=Qe(pe);await zA(be);const It=B.current.get(pe);await de(pe,be,It)}j(B.current.size)},bA=CA=>{!CA||U.current&&U.current,_t.info("rtc:leave",{roomId:CA});try{r(CA)}catch{}for(const[,EA]of B.current){Rw(EA);try{EA.pc.close()}catch{}}B.current.clear(),j(0),U.current=void 0,gA(),E(EA=>(Object.values(EA).forEach(vN),{}));for(const EA of Array.from(uA.current.keys()))MA(EA);m.current?.getTracks()?.forEach(EA=>EA.stop()),k.current?.getTracks()?.forEach(EA=>EA.stop()),m.current=void 0,k.current=void 0,M(void 0),S({})},pA=async(CA,EA)=>{},Re=async()=>{I&&await te(!0)};return p.useEffect(()=>{if(!G||!U.current||B.current.size===0)return;const CA=async()=>{if(!G||!k.current)return;const yA=k.current.getVideoTracks()[0];if(!((!yA||yA.readyState!=="live")&&(_t.warn("health:video-track-dead"),k.current=void 0,!await rA()))){for(const[xA,XA]of B.current)if(!QI(XA.pc))try{const be=XA.pc.getSenders().find(Ut=>Ut.track?.kind==="video")?.track,It=k.current?.getVideoTracks()[0];It&&(!be||be.id!==It.id)&&(_t.info("health:reattach-video",{peerId:xA}),await iA(XA.pc,k.current),await de(xA,XA.pc,XA))}catch(pe){_t.warn("health:check-failed",{peerId:xA,err:String(pe)})}}},EA=window.setInterval(CA,5e3);return CA(),()=>clearInterval(EA)},[G,P]),p.useEffect(()=>{if(!e||!I)return;const CA=async()=>{const EA=U.current;if(EA){_t.info("socket:reconnect:rtc-rejoin",{roomId:EA,peerCount:B.current.size});for(const[,yA]of B.current){Rw(yA);try{yA.pc.close()}catch{}}B.current.clear(),j(0),E(yA=>(Object.values(yA).forEach(vN),{})),S({});try{const yA=await o(EA);if(!yA?.ok){_t.warn("socket:reconnect:rtc-rejoin-failed",{roomId:EA,error:yA?.error});return}if(Array.isArray(yA.iceServers)&&yA.iceServers.length){const xA=Gw([...x,...yA.iceServers],x);H.current=xA,ge.current=Date.now()}for(const xA of yA.peers.filter(XA=>XA!==i)){const{pc:XA}=Qe(xA);await zA(XA);const pe=B.current.get(xA);await de(xA,XA,pe)}j(B.current.size),_t.info("socket:reconnect:rtc-rejoin-success",{roomId:EA,peerCount:B.current.size})}catch(yA){_t.error("socket:reconnect:rtc-rejoin-error",{roomId:EA,err:String(yA)})}}};return e.on("connect",CA),e.on("reconnect",CA),()=>{e.off("connect",CA),e.off("reconnect",CA)}},[e,I,i,o]),p.useEffect(()=>{const CA=m.current?.getAudioTracks?.()[0];K&&CA&&m.current?RA(i,m.current):MA(i)},[m.current,i,K]),p.useEffect(()=>{for(const[CA,EA]of Object.entries(c))EA?.getAudioTracks().some(xA=>xA.enabled)&&RA(CA,EA);for(const CA of uA.current.keys())CA!==i&&!c[CA]&&MA(CA)},[c,i]),$n({onRtcPeerJoined:async({peerId:CA})=>{if(_t.info("sig:peer-joined",{peerId:CA}),!(!U.current||CA===i))try{const{pc:EA}=Qe(CA);if(QI(EA))return;await zA(EA);const yA=B.current.get(CA);yA&&!QI(EA)&&await de(CA,EA,yA)}catch(EA){_t.warn("sig:peer-joined:failed",{peerId:CA,err:String(EA)})}},onRtcPeerLeft:({peerId:CA})=>{_t.info("sig:peer-left",{peerId:CA});const EA=B.current.get(CA);if(EA){Rw(EA),dA(CA);try{EA.pc.close()}catch{}}B.current.delete(CA),j(B.current.size),E(yA=>{const xA={...yA};return vN(xA[CA]),delete xA[CA],xA}),MA(CA),S(yA=>{const{[CA]:xA,...XA}=yA;return XA})},onRtcSignal:async({fromPeerId:CA,payload:EA})=>{let yA,xA;try{yA=Qe(CA),xA=yA.pc}catch(XA){_t.warn("sig:getPeer-failed",{fromPeerId:CA,err:String(XA)});return}if(QI(xA)){_t.debug("sig:pc-closed",{fromPeerId:CA});return}try{if(EA.sdp){if(_t.debug("sig:sdp",{fromPeerId:CA,type:EA.sdp.type}),QI(xA))return;const XA=EA.sdp;if(XA.type==="answer"&&Oe(xA)){_t.debug("sig:stale-answer-ignored",{fromPeerId:CA,signalingState:xA.signalingState});return}const pe=Oe(xA)||yA.isSettingRemoteAnswerPending,be=XA.type==="offer"&&!pe;if(yA.ignoreOffer=!(i<CA)&&be,yA.ignoreOffer||(XA.type==="answer"&&(yA.isSettingRemoteAnswerPending=!0),be&&(QI(xA)||await xA.setLocalDescription({type:"rollback"})),QI(xA)))return;if(await xA.setRemoteDescription(XA),yA.isSettingRemoteAnswerPending=!1,XA.type==="offer"&&!QI(xA)){const It=await xA.createAnswer();if(QI(xA))return;await xA.setLocalDescription(It),await a(U.current,CA,{sdp:xA.localDescription})}for(;yA.iceBuffer.length&&!QI(xA);){const It=yA.iceBuffer.shift();try{await xA.addIceCandidate(It)}catch{}}}else if(EA.ice){if(_t.debug("sig:ice",{fromPeerId:CA,hasRemote:!!xA.remoteDescription}),QI(xA))return;const XA=EA.ice;if(xA.remoteDescription)try{await xA.addIceCandidate(XA)}catch{}else yA.iceBuffer.push(XA)}}catch(XA){const pe=String(XA);_t.error("sig:error",{fromPeerId:CA,err:pe}),(pe.includes("order of m-lines")||pe.includes("m-line")||pe.includes("InvalidAccessError"))&&(_t.warn("sig:mline-mismatch-rebuild",{fromPeerId:CA}),await ne(CA))}},onRtcVideoEnabled:({playerId:CA,enabled:EA})=>{_t.debug("sig:video-enabled",{playerId:CA,enabled:EA}),S(yA=>({...yA,[CA]:!!EA}))}}),p.useEffect(()=>{let CA=!0;return(async()=>{try{const EA=await jo();if(!CA)return;J(!1),i&&S(yA=>({...yA,[i]:!1})),R(I?!!EA.chatAudio:!1)}catch{}})(),()=>{CA=!1}},[i,I]),p.useEffect(()=>{I||(R(!1),G&&n("auth:lost"),J(!1),i&&S(CA=>({...CA,[i]:!1})),(async()=>{for(const[CA,EA]of B.current)await tA(EA.pc,void 0),await iA(EA.pc,void 0),await de(CA,EA.pc,EA).catch(()=>{})})(),IA(),mA())},[I,i]),p.useEffect(()=>{const CA=EA=>{const yA=EA.detail;yA&&(typeof yA.video=="boolean"&&yA.video===!1&&(J(!1),S(xA=>({...xA,[i]:!1}))),typeof yA.chatAudio=="boolean"&&R(yA.chatAudio))};return window.addEventListener("app:settings",CA),()=>window.removeEventListener("app:settings",CA)},[i]),p.useEffect(()=>{const CA=()=>{if(document.visibilityState==="visible")for(const[xA,XA]of B.current)eA(xA,XA)},EA=()=>{for(const[xA,XA]of B.current)eA(xA,XA)},yA=()=>{for(const[xA,XA]of B.current)eA(xA,XA)};return document.addEventListener("visibilitychange",CA),window.addEventListener("online",EA),window.addEventListener("offline",yA),()=>{document.removeEventListener("visibilitychange",CA),window.removeEventListener("online",EA),window.removeEventListener("offline",yA)}},[]),p.useEffect(()=>{try{const CA=window;CA.__rtcCtxInternal||(CA.__rtcCtxInternal={}),CA.__rtcCtxInternal.peers=B.current,CA.__rtcCtxInternal.myVideoRef=k,CA.__rtcCtxInternal.videoEnabledState={current:G}}catch{}},[G,f,P]),Q.jsx(eiA.Provider,{value:{videoEnabled:G,setVideoEnabled:te,enableCamera:Re,joinRtc:ve,leaveRtc:bA,cameraOwnerId:D,setCameraOwner:pA,remoteStreams:c,myVideo:f,micEnabled:K,setMicEnabled:WA,hasVideo:_A,speaking:KA,remoteVideoFlags:y},children:t})}function WKA(t){const A=[];for(const[e,i]of t)try{const g=i.pc;A.push({id:e,state:g.connectionState,ice:g.iceConnectionState,signaling:g.signalingState})}catch{}return A}function ZT(t){try{const A=window,e=A.__rtcCtxInternal||{},i=e.peers||new Map,g=e.myVideoRef?.current,I=g?.getVideoTracks?.()[0],n={t:Date.now(),label:t,videoEnabled:e.videoEnabledState?.current,hasStream:!!g,trackState:I?.readyState,muted:I?.muted,peers:WKA(i),activePeerCount:i.size};A.__rtcDiag||(A.__rtcDiag=[]),A.__rtcDiag.push(n),A.__rtcDiag.length>200&&A.__rtcDiag.splice(0,A.__rtcDiag.length-200),A.dispatchEvent?.(new CustomEvent("rtc:diag",{detail:n}))}catch{}}try{queueMicrotask(()=>{const t=window;t.__rtcCtxInternal||(t.__rtcCtxInternal={}),t.__dumpRtcDiag=ZT})}catch{}function Xc(){const t=TKA(),A=HKA(),e=!!t&&!t.liveKitFailed,i=t?.joinRoom,g=t?.leaveRoom,I=t?.setVideoEnabled,n=t?.setMicEnabled,o=A?.joinRtc,a=A?.leaveRtc,r=A?.setVideoEnabled,s=A?.setMicEnabled,B=p.useRef(o);B.current=o;const c=p.useRef(a);c.current=a;const E=p.useRef(r);E.current=r;const D=p.useRef(s);D.current=s;const y=t?.liveKitFailed??!1,S=t?.pendingRoomId??null;p.useEffect(()=>{y&&S&&B.current&&Promise.resolve(B.current(S)).catch(G=>{})},[y,S]);const f=p.useCallback(async G=>{e&&i?await i(G):B.current&&await Promise.resolve(B.current(G))},[e,i]),M=p.useCallback(async G=>{e&&g?await g():c.current&&c.current(G)},[e,g]),k=p.useCallback(async G=>{e&&I?await I(G):E.current&&await E.current(G)},[e,I]),m=p.useCallback(async G=>{e&&n?await n(G):D.current&&await D.current(G)},[e,n]),U=p.useMemo(()=>{if(e){const G={};t.localParticipant&&(G[t.localParticipant.id]=t.localParticipant.isSpeaking);for(const J of t.participants)G[J.id]=J.isSpeaking;return G}return A?.speaking??{}},[e,t.localParticipant,t.participants,A?.speaking]),F=p.useMemo(()=>{if(!e)return A?.myVideo;const G=t.localParticipant?.videoTrack||t.localVideoTrack;if(G){if(G.mediaStream instanceof MediaStream)return G.mediaStream;const J=G.mediaStreamTrack;if(J instanceof MediaStreamTrack){const x=new MediaStream;return x.addTrack(J),x}}},[e,t.localParticipant?.videoTrack,t.localVideoTrack,A?.myVideo]),b=p.useMemo(()=>{if(!e)return A?.remoteStreams??{};const G={};for(const J of t.participants){const x=new MediaStream;J.videoTrack&&"mediaStreamTrack"in J.videoTrack&&x.addTrack(J.videoTrack.mediaStreamTrack),J.audioTrack&&"mediaStreamTrack"in J.audioTrack&&x.addTrack(J.audioTrack.mediaStreamTrack),x.getTracks().length>0&&(G[J.id]=x)}return G},[e,t.participants,A?.remoteStreams]),K=p.useMemo(()=>{if(!e)return A?.remoteVideoFlags;const G={};t.localParticipant&&(G[t.localParticipant.id]=t.localParticipant.videoEnabled);for(const J of t.participants)G[J.id]=J.videoEnabled;return G},[e,t.localParticipant,t.participants,A?.remoteVideoFlags]),R=p.useMemo(()=>{if(e){const G=t.localParticipant;if(G&&(G.audioEnabled||G.videoEnabled))return!0;for(const J of t.participants)if(J.audioEnabled||J.videoEnabled)return!0;return!1}return F?!0:Object.keys(A?.remoteStreams??{}).length>0},[e,t.localParticipant,t.participants,A?.remoteStreams,F]);return p.useMemo(()=>({joinRoom:f,leaveRoom:M,connected:(e?t.connected:(A?.activePeerCount??0)>0)&&R,videoEnabled:e?t.videoEnabled:A?.videoEnabled??!1,setVideoEnabled:k,localVideoTrack:e?t.localVideoTrack:A?.myVideo??null,micEnabled:e?t.micEnabled:A?.micEnabled??!1,setMicEnabled:m,speaking:U,participants:e?t.participants:[],localParticipant:e?t.localParticipant:null,remoteStreams:b,myVideo:F,remoteVideoFlags:K,throttleVideoForAnimation:A?.throttleVideoForAnimation,mode:e?"livekit":"mesh"}),[f,M,k,m,U,e,t,A,F,b,K,R])}const tiA=p.createContext(null),Cs=()=>p.useContext(tiA),gL={};function zKA({children:t}){const{user:A,meId:e}=Yi(),i=e||A?.id,{resetSpin:g}=kQ(),I=Di(),{joinRoom:n,leaveRoom:o,setSpectate:a,pokerJoinRoom:r,getRoomsList:s}=OI(),[B,c]=p.useState(()=>{try{const G=window.__PRESEEDED_ROOM;if(G&&typeof G=="object")return delete window.__PRESEEDED_ROOM,G}catch{}return null}),{leaveRoom:E,joinRoom:D}=Xc(),y=p.useRef(i);p.useEffect(()=>{const G=y.current;y.current=i,G&&i&&G!==i&&c(J=>{if(!J)return J;try{E(J.id)}catch{}return null})},[i,E]);const S=p.useRef({}),f=p.useMemo(()=>(B?.gameState??{}).phase==="waiting"||B===null,[B]),M=p.useCallback(async G=>{try{const J=await n(G);if(!J?.ok)throw new Error(J?.error||"Failed to join room");try{g()}catch{}if(c(J.room),!J.room?.singlePlayer)try{await Promise.resolve(D?.(G))}catch{}if(!J.room?.singlePlayer)try{const x=await s?.(),P=(x&&(Array.isArray(x?.rooms)?x.rooms:Array.isArray(x?.data?.rooms)?x.data.rooms:[])||[]).find(j=>j?.id===G);P&&Array.isArray(P.players)&&c(j=>{if(!j||j.id!==G)return j;const q=Array.isArray(j.players)?j.players:[],Y=new Map(q.map($=>[$.id,$])),O=P.players.map($=>{const gA=Y.get($.id);if(gA){const z=$.name&&$.name!=="Bot"&&$.name!=="Player"?$.name:gA.name&&gA.name!=="Bot"&&gA.name!=="Player"?gA.name:$.name||gA.name,X=$.avatarUrl??gA.avatarUrl??null;return{...gA,...$,name:z,avatarUrl:X}}return $});for(const $ of q)O.some(gA=>gA.id===$.id)||O.push($);return{...j,players:O}})}catch{}return{ok:!0,room:J.room}}catch(J){try{if(!(typeof window<"u"&&(window.location?.search?.includes("e2e=1")||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")))throw J;const H=Date.now(),P=i||"e2e-user",j=A?.name||"E2E User",q={id:G,name:"E2E Room",gameMode:"craps",createdAt:H,updatedAt:H,bankerId:"bank",players:[{id:P,name:j,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:P,turnOrder:[P],roundSeq:1,crapsPassBets:[{playerId:P,amount:10}],crapsDontPassBets:[],crapsPlaceBets:[]}};try{g()}catch{}c(q);return}catch{throw J}}},[n,g,D,s,i,A?.name]),k=p.useCallback(async()=>{if(B){try{await E(B.id)}catch{}try{await o(B.id)}finally{c(null)}}},[o,E,B]),m=p.useCallback((G,J)=>{if(!J)return G;if(!G)return J;try{const x=Array.isArray(G.players)?G.players:[],H=Array.isArray(J.players)?J.players:[];let P;if(H.length===0&&x.length>0)P=x;else if(x.length===0)P=H;else{const j=new Map(x.map(Y=>[String(Y.id),Y])),q=new Map(H.map(Y=>[String(Y.id),Y]));P=[];for(const[Y,O]of q.entries()){const $=j.get(Y);$?P.push({...$,...O,name:O.name||$.name,avatarUrl:O.avatarUrl??$.avatarUrl}):P.push(O)}}return{...G,...J,players:P}}catch{return J||G}},[]);$n({onJoinedRoom:({room:G})=>{try{g()}catch{}c(J=>m(J,G))},onOtherPlayerJoined:({room:G})=>c(J=>m(J,G)),onOtherLeft:({room:G})=>{let J=!1,x=null;if(c(H=>{const P=m(H,G);try{const j=Array.isArray(G?.players)?G?.players:Array.isArray(P?.players)?P.players:[],q=String(i||""),Y=q&&j.some(O=>String(O?.id)===q);if(Y&&H)try{delete S.current[String(H.id||"")]}catch{}if(!Y&&H){if(!!(G?.singlePlayer||P?.singlePlayer))return P;const $=String(H.id||""),gA=S.current[$]||0,z=Date.now();return gA?z-gA<1500?P:(J=!0,x=String(H.id),delete S.current[$],null):(S.current[$]=z,P)}}catch{}return P}),J){try{x&&E?.(x)}catch{}try{I("/lobby",{replace:!0})}catch{}}},onSpectatorsUpdated:({spectators:G})=>{c(J=>J&&{...J,gameState:{...J.gameState,spectators:G}})},onPlayerProfileUpdated:({playerId:G,name:J,avatarUrl:x})=>{c(H=>{if(!H)return H;const P=H.players.map(j=>j.id!==G?j:{...j,...J!==void 0&&{name:J},...x!==void 0&&{avatarUrl:x}});return{...H,players:P}})},onBetsUpdated:({room:G})=>{G&&c(J=>{if(!J)return G;try{const x=new Map(J.players.map(j=>[j.id,j])),H=new Map((G.players||[]).map(j=>[j.id,j])),P=J.players.map(j=>{const q=H.get(j.id);if(!q)return j;const Y={...j,...q};return(!q.name||q.name==="Player"||q.name==="Anonymous")&&j.name&&j.name!=="Player"&&j.name!=="Anonymous"&&(Y.name=j.name),q.avatarUrl==null&&j.avatarUrl&&(Y.avatarUrl=j.avatarUrl),Y});for(const[j,q]of H.entries())x.has(j)||P.push(q);return{...J,gameState:G.gameState??J.gameState,name:G.name??J.name,maxPlayers:G.maxPlayers??J.maxPlayers,private:G.private??J.private,singlePlayer:G.singlePlayer??J.singlePlayer,players:P}}catch{return J}})},onBankerChanged:G=>{c(J=>!J||J.id!==G.roomId?J:{...J,gameState:{...J.gameState,banker:G.bankerId,currentRollerId:G.currentRollerId,roundSeq:G.roundSeq,bankRoll:null}})},onForceLogout:G=>{G?.reason==="session_superseded"&&y6();try{B?.id&&E(B.id)}catch{}c(null)},onRoomUpdateState:({roomId:G,gameState:J,room:x})=>{const H=x?.gameState??J;if(!H)return;const P=Array.isArray(x?.players)?x.players:[];let j=!1,q=null;if(c(Y=>{const O=$=>{if(!P.length)return $;const gA=new Map($.map(z=>[z.id,z]));for(const z of P){const X=gA.get(z.id);if(X){const sA=!z.name||z.name==="Player"||z.name==="Anonymous",rA={...X,...z};sA&&X.name&&X.name!=="Player"&&X.name!=="Anonymous"&&(rA.name=X.name),z.avatarUrl==null&&X.avatarUrl&&(rA.avatarUrl=X.avatarUrl),gA.set(z.id,rA)}else gA.set(z.id,z)}return Array.from(gA.values())};try{if(P.length&&Y&&Y.id===G){const $=String(i||"");if($){const gA=P.some(z=>String(z?.id)===$);if(gA)try{delete S.current[String(Y.id||"")]}catch{}if(!gA){if(!!(x?.singlePlayer||Y?.singlePlayer))return{...Y,players:O(Y.players),gameState:H};const X=String(Y.id||""),sA=S.current[X]||0,rA=Date.now();return sA?rA-sA<1500?{...Y,players:O(Y.players),gameState:H}:(j=!0,q=String(Y.id),delete S.current[X],null):(S.current[X]=rA,{...Y,players:O(Y.players),gameState:H})}}}}catch{}return Y&&Y.id===G?{...Y,players:O(Y.players),gameState:H}:Y||{id:G,players:P,gameState:H}}),j){try{q&&E?.(q)}catch{}try{I("/lobby",{replace:!0})}catch{}}},onPlayerBalanceUpdated:({playerId:G,balance:J})=>{c(x=>{if(!x)return x;const H=x.players.findIndex(q=>q.id===G);if(H<0){const q=[...x.players,{id:G,balance:J}];return{...x,players:q}}const P=x.players[H];if(typeof P?.balance=="number"&&P.balance===J)return x;const j=x.players.slice();return j[H]={...P,balance:J},{...x,players:j}})},onError:G=>{try{const J=CR?.()||[],x=Date.now(),H=[...J].filter(P=>x-P.ts<1200).slice(-1)[0]}catch{}}});const U=p.useMemo(()=>({room:B,isWaiting:f,joinRoom:M,leaveRoom:k,setRoom:c,setSpectatingForMe:async G=>{if(B)try{return await a(B.id,G)}catch(J){return{ok:!1,error:J?.message||"Failed"}}}}),[B,f,M,k,a]),F=Xn(),b=p.useRef(0),K=p.useRef(!1),R=p.useCallback(async()=>{const G=Date.now();if(G-(b.current||0)<800)return;b.current=G;const J=B?.id;if(!J){try{const H=(CR?.()||[]).slice(-1)[0];if(H&&String(H.event).toLowerCase().includes("create_room")&&G-(H.ts||0)<1500)return}catch{}return}try{const H=(CR?.()||[]).slice(-1)[0];H&&String(H.event).toLowerCase().includes("create_room")&&G-(H.ts||0)<1500&&await new Promise(j=>setTimeout(j,1100))}catch{}try{const x=B?.gameMode==="poker";let H;if(x&&typeof r=="function"){const P=gL[J];if(P)H=await P;else{const j=r(J);gL[J]=j;try{H=await j}finally{delete gL[J]}}}else H=await n(J);if(H?.ok){try{g()}catch{}if(c(H.room),!H.room?.singlePlayer)try{await Promise.resolve(D?.(J))}catch{}try{const P=await s?.(),q=(P&&(Array.isArray(P?.rooms)?P.rooms:Array.isArray(P?.data?.rooms)?P.data.rooms:[])||[]).find(Y=>Y?.id===J);q&&Array.isArray(q.players)&&c(Y=>!Y||Y.id!==J?Y:{...Y,players:q.players})}catch{}}}catch{}},[B?.id,r,n,g,D,s]);return p.useEffect(()=>{if(!F)return;const G=P=>{P!=="io client disconnect"&&(K.current=!0)},J=()=>{K.current&&(K.current=!1,R())},x=()=>{R()},H=()=>{R()};F.on("disconnect",G),F.on("connect",J);try{F.io.on("reconnect",x)}catch{}try{F.on?.("reconnect",H)}catch{}return()=>{F.off("disconnect",G),F.off("connect",J);try{F.io.off("reconnect",x)}catch{}try{F.off?.("reconnect",H)}catch{}}},[F,R]),p.useEffect(()=>{const G=()=>{try{document.visibilityState==="visible"&&(K.current||!F?.connected)&&R()}catch{}},J=()=>{(K.current||!F?.connected)&&R()},x=()=>{(K.current||!F?.connected)&&R()},H=()=>{R()};return window.addEventListener("visibilitychange",G),window.addEventListener("focus",J),window.addEventListener("pageshow",x),window.addEventListener("ad:complete",H),()=>{window.removeEventListener("visibilitychange",G),window.removeEventListener("focus",J),window.removeEventListener("pageshow",x),window.removeEventListener("ad:complete",H)}},[F,R]),Q.jsx(tiA.Provider,{value:U,children:t})}const _N=globalThis.__lastWagersFetchAt||(globalThis.__lastWagersFetchAt={}),uZ=500;function nb(t,A){const e=Xn(),{room:i}=Cs(),g=t&&A?`betsnap:${t}:${A}`:null,[I,n]=p.useState(()=>({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[],playerBalance:null}));p.useEffect(()=>{g&&(async()=>{try{const MA=await TD(g);if(!MA?.mainWagerId)return;n(oA=>oA.open.some(tA=>tA.type==="MAIN"&&tA.playerId===A)?oA:{...oA,roundSeq:MA.roundSeq||oA.roundSeq,open:[...oA.open,{id:MA.mainWagerId,type:"MAIN",playerId:A,acceptedById:null,amount:0,roundSeq:MA.roundSeq}]})}catch{}})()},[g,A]),p.useEffect(()=>{g&&(async()=>{try{const MA=await TD(g);if(!MA)return;MA?.mainWagerId&&n(oA=>oA.open.some(tA=>tA.type==="MAIN"&&tA.playerId===A)?oA:{...oA,roundSeq:MA.roundSeq||oA.roundSeq,open:[...oA.open,{id:MA.mainWagerId,type:"MAIN",playerId:A,acceptedById:null,amount:0,roundSeq:MA.roundSeq}]})}catch{}})()},[g,A]);const{getWagers:o,createSideBet:a,cancelSideBet:r,acceptSideBet:s,placeMainBet:B,cancelMainBet:c}=OI(),[E,D]=p.useState([]),y=p.useRef(new Set),S=p.useRef(new Set),[f,M]=p.useState(0),k=p.useRef(null);p.useEffect(()=>{if(k.current===null){k.current=t;return}n({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[]}),D([]),y.current.clear(),S.current.clear(),M(0),g&&YD(g)},[t,g]),$n({onBetsUpdated:MA=>{g&&(async()=>{try{const iA=MA.open.find(hA=>hA.type==="MAIN"&&hA.playerId===A);iA?await pF(g,{roundSeq:MA.roundSeq,mainWagerId:iA.id}):await YD(g)}catch{}})(),n(MA);const oA=MA.settled.filter(iA=>iA.roundSeq===MA.roundSeq);D(oA.filter(iA=>!y.current.has(iA.id)));const tA=(MA.open||[]).filter(iA=>iA.type==="SIDE"&&!iA.acceptedById&&iA.playerId!==A&&iA.subjectId!==A).filter(iA=>!S.current.has(iA.id));M(tA.length)}});const[m,U]=p.useState([]);p.useEffect(()=>{U([])},[t]),p.useEffect(()=>{const MA=Array.isArray(I.settledAll)?I.settledAll:[];MA.length===0&&m.length===0||U(oA=>{if(MA.length===0)return oA;const AA=new Map;for(const iA of oA)AA.set(iA.id,iA);for(const iA of MA)AA.set(iA.id,iA);return Array.from(AA.values()).sort((iA,hA)=>{const DA=Number(iA.roundSeq||0),dA=Number(hA.roundSeq||0);return dA!==DA?dA-DA:String(hA.id).localeCompare(String(iA.id))})})},[I.settledAll]),p.useEffect(()=>{if(!t)return;let MA=null;const oA=()=>{const tA=Date.now(),iA=_N[t]||0;tA-iA<uZ||(_N[t]=tA,MA=window.setTimeout(()=>{try{o(t)}catch{}},300))};if(i?.id===t)return oA(),()=>{MA&&clearTimeout(MA)};const AA=window.setTimeout(()=>{oA()},500);return()=>{MA&&clearTimeout(MA),clearTimeout(AA)}},[t,i?.id,o]),p.useEffect(()=>{if(!e)return;const MA={current:0},oA={current:e.connected},AA=()=>{if(!t||i?.id!==t)return;const DA=Date.now();if(!(DA-MA.current<400)&&!(DA-(_N[t]||0)<uZ)){MA.current=DA,_N[t]=DA;try{S.current.clear(),M(0),y.current.clear(),setTimeout(()=>{try{o(t)}catch{}},300)}catch{}}},tA=()=>{if(!oA.current){oA.current=!0;return}AA()},iA=()=>{AA()},hA=()=>{document.visibilityState==="visible"&&AA()};return e.on("connect",tA),window.addEventListener("ad:complete",iA),window.addEventListener("visibilitychange",hA),()=>{e.off("connect",tA),window.removeEventListener("ad:complete",iA),window.removeEventListener("visibilitychange",hA)}},[e,t,i?.id,o]),p.useEffect(()=>{D([]),y.current.clear()},[I.roundSeq]);const F=p.useMemo(()=>I.openAll?.filter(MA=>MA.type==="MAIN"),[I.openAll]),b=p.useMemo(()=>I.open.find(MA=>MA.type==="MAIN"&&MA.playerId===A),[I.open,A]),K=p.useMemo(()=>I.openAll?.filter(MA=>MA.type==="SIDE"),[I.openAll]),R=p.useMemo(()=>I.open.filter(MA=>MA.type==="SIDE"&&(MA.playerId===A||MA.acceptedById===A)),[I.open,A]),G=p.useMemo(()=>I.settled.filter(MA=>MA.playerId===A||MA.acceptedById===A),[I.settled,A]);p.useMemo(()=>m.filter(MA=>MA.playerId===A||MA.acceptedById===A),[m,A]);const J=p.useMemo(()=>I.open.filter(MA=>MA.playerId===A||MA.acceptedById===A).reduce((MA,oA)=>MA+(oA.amount||0),0),[I.open,A]),[x,H]=p.useState([]);p.useEffect(()=>{const MA=setTimeout(()=>{H(m.filter(oA=>oA.playerId===A||oA.acceptedById===A))},Zn.mySettledDelayMs);return()=>clearTimeout(MA)},[m,A]);const[P,j]=p.useState(null);p.useEffect(()=>{const MA=setTimeout(()=>{j(I.playerBalance)},Zn.balanceDelayMs);return()=>clearTimeout(MA)},[I.playerBalance]);const[q,Y]=p.useState([]);p.useEffect(()=>{const MA=setTimeout(()=>{Y(m)},Zn.settledAllDelayMs);return()=>clearTimeout(MA)},[m]);const O=p.useMemo(()=>I.open.filter(MA=>MA.type==="SIDE"&&!MA.acceptedById&&MA.subjectId!==A&&MA.playerId!==A),[I.open,A]),$=()=>D(MA=>{if(MA.length===0)return MA;const[oA,...AA]=MA;return y.current.add(oA.id),AA}),gA=MA=>D(oA=>(y.current.add(MA),oA.filter(AA=>AA.id!==MA))),z=p.useCallback(()=>{for(const MA of O)S.current.add(MA.id);M(0)},[O]),X=p.useCallback(async MA=>{try{const oA=await a(t,{amount:Math.floor(MA.amount),subjectId:MA.subjectId,predicate:MA.predicate,oddsBp:MA.oddsBp});return oA?.ok?{ok:!0,betId:oA?.wager?.id||oA?.id||MA.clientBetId}:{ok:!1,error:oA?.error||"Failed to place side bet"}}catch(oA){return{ok:!1,error:oA?.message||"Failed to place side bet"}}},[t,a]),sA=p.useCallback(async MA=>{try{const oA=await r(t,MA);return oA?.ok?{ok:!0}:{ok:!1,error:oA?.error||"Failed to cancel side bet"}}catch(oA){return{ok:!1,error:oA?.message||"Failed to cancel side bet"}}},[t,r]),rA=p.useCallback(async MA=>{try{const oA=await s(t,MA);return oA?.ok?{ok:!0}:{ok:!1,error:oA?.error||"Failed to accept side bet"}}catch(oA){return{ok:!1,error:oA?.message||"Failed to accept side bet"}}},[t,s]),mA=p.useCallback(async MA=>{try{const oA=await B(t,Math.floor(MA));return oA?.ok?{ok:!0,wagerId:oA?.wager?.id||oA?.id}:{ok:!1,error:oA?.error||"Failed to place main bet"}}catch(oA){return{ok:!1,error:oA?.message||"Failed to place main bet"}}},[t,B]),IA=p.useCallback(async MA=>{try{const oA=await c(t,MA);return oA?.ok?{ok:!0}:{ok:!1,error:oA?.error||"Failed to cancel main bet"}}catch(oA){return{ok:!1,error:oA?.message||"Failed to cancel main bet"}}},[t,c]),[uA,KA]=p.useState([]),FA=p.useRef(I.roundSeq),RA=p.useRef(new Set);return p.useEffect(()=>{FA.current!==I.roundSeq&&(FA.current=I.roundSeq,RA.current.clear(),KA([]));const MA=I.settledAll.filter(oA=>oA.roundSeq===I.roundSeq&&!RA.current.has(oA.id));if(MA.length>0){MA.forEach(AA=>RA.current.add(AA.id)),KA(MA);const oA=setTimeout(()=>KA([]),1e3);return()=>clearTimeout(oA)}},[I.settledAll,I.roundSeq]),{roundSeq:I.roundSeq,openAll:I.openAll,open:I.open,settled:I.settled,settledAll:q,myOpenMain:b,myOpenSides:R,openAllMain:F,openAllSides:K,mySettledThisRound:G,mySettledAll:x,myExposure:J,unseenSettledWagers:E,consumeNextUnseen:$,markAsSeen:gA,offersToMe:O,newOfferCount:f,markOffersAsSeen:z,placeSideBet:X,cancelSideBet:sA,acceptSideBet:rA,placeMainBet:mA,cancelMainBet:IA,playerBalance:P,newSettlements:uA}}var JN={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 hZ;function VKA(){return hZ||(hZ=1,function(t,A){(function(e,i){var g={};g.version="0.4.1",g.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var I=Array.prototype.map,n=Array.isArray,o=Object.prototype.toString;function a(k){return!!(k===""||k&&k.charCodeAt&&k.substr)}function r(k){return n?n(k):o.call(k)==="[object Array]"}function s(k){return k&&o.call(k)==="[object Object]"}function B(k,m){var U;k=k||{},m=m||{};for(U in m)m.hasOwnProperty(U)&&k[U]==null&&(k[U]=m[U]);return k}function c(k,m,U){var F=[],b,K;if(!k)return F;if(I&&k.map===I)return k.map(m,U);for(b=0,K=k.length;b<K;b++)F[b]=m.call(U,k[b],b,k);return F}function E(k,m){return k=Math.round(Math.abs(k)),isNaN(k)?m:k}function D(k){var m=g.settings.currency.format;return typeof k=="function"&&(k=k()),a(k)&&k.match("%v")?{pos:k,neg:k.replace("-","").replace("%v","-%v"),zero:k}:!k||!k.pos||!k.pos.match("%v")?a(m)?g.settings.currency.format={pos:m,neg:m.replace("%v","-%v"),zero:m}:m:k}var y=g.unformat=g.parse=function(k,m){if(r(k))return c(k,function(b){return y(b,m)});if(k=k||0,typeof k=="number")return k;m=m||g.settings.number.decimal;var U=new RegExp("[^0-9-"+m+"]",["g"]),F=parseFloat((""+k).replace(/\((.*)\)/,"-$1").replace(U,"").replace(m,"."));return isNaN(F)?0:F},S=g.toFixed=function(k,m){m=E(m,g.settings.number.precision);var U=Math.pow(10,m);return(Math.round(g.unformat(k)*U)/U).toFixed(m)},f=g.formatNumber=g.format=function(k,m,U,F){if(r(k))return c(k,function(x){return f(x,m,U,F)});k=y(k);var b=B(s(m)?m:{precision:m,thousand:U,decimal:F},g.settings.number),K=E(b.precision),R=k<0?"-":"",G=parseInt(S(Math.abs(k||0),K),10)+"",J=G.length>3?G.length%3:0;return R+(J?G.substr(0,J)+b.thousand:"")+G.substr(J).replace(/(\d{3})(?=\d)/g,"$1"+b.thousand)+(K?b.decimal+S(Math.abs(k),K).split(".")[1]:"")},M=g.formatMoney=function(k,m,U,F,b,K){if(r(k))return c(k,function(x){return M(x,m,U,F,b,K)});k=y(k);var R=B(s(m)?m:{symbol:m,precision:U,thousand:F,decimal:b,format:K},g.settings.currency),G=D(R.format),J=k>0?G.pos:k<0?G.neg:G.zero;return J.replace("%s",R.symbol).replace("%v",f(Math.abs(k),E(R.precision),R.thousand,R.decimal))};g.formatColumn=function(k,m,U,F,b,K){if(!k)return[];var R=B(s(m)?m:{symbol:m,precision:U,thousand:F,decimal:b,format:K},g.settings.currency),G=D(R.format),J=G.pos.indexOf("%s")<G.pos.indexOf("%v"),x=0,H=c(k,function(P,j){if(r(P))return g.formatColumn(P,R);P=y(P);var q=P>0?G.pos:P<0?G.neg:G.zero,Y=q.replace("%s",R.symbol).replace("%v",f(Math.abs(P),E(R.precision),R.thousand,R.decimal));return Y.length>x&&(x=Y.length),Y});return c(H,function(P,j){return a(P)&&P.length<x?J?P.replace(R.symbol,R.symbol+new Array(x-P.length+1).join(" ")):new Array(x-P.length+1).join(" ")+P:P})},t.exports&&(A=t.exports=g),A.accounting=g})()}(JN,JN.exports)),JN.exports}var XKA=VKA();const Bd=Td(XKA);function dZ(t){return t==="WIN"?"LOSE":t==="LOSE"?"WIN":t}function PU(t){const A=Math.round(Number(t)||0);try{return`z${new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(A)}`}catch{return`z${A}`}}function Iu(t,A){if(!t)return{myResult:"",myPayout:0,label:""};const e=t.playerId,i=A===e,g=t.acceptedById,I=g!=null&&A===g;if(t.type==="MAIN"){if(!(i||I))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(t.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(i){const n=pZ(t);return{myResult:t.result,myPayout:t.result==="WIN"?n:0,label:qh(t.result,t.result==="WIN"?n:0,t.amount)}}else{const n=dZ(t.result),o=$KA(t);return{myResult:n,myPayout:n==="WIN"?o:0,label:qh(n,n==="WIN"?o:0,t.amount)}}}if(t.type==="SIDE"){const n=A===t.acceptedById;if(!(i||n))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(t.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(i){const o=pZ(t),a=t.result==="WIN"?o:0,r={myResult:t.result,myPayout:a,label:qh(t.result,a,t.amount)};if(r.myResult==="WIN"&&r.myPayout<=0){const s=typeof t.payout=="number"&&t.payout>0?t.payout:t.amount;return{myResult:r.myResult,myPayout:s,label:qh(r.myResult,s,t.amount)}}return r}else{const o=dZ(t.result),a=AFA(t),r=o==="WIN"?a:0,s={myResult:o,myPayout:r,label:qh(o,r,t.amount)};if(s.myResult==="WIN"&&s.myPayout<=0){const B=typeof t.payout=="number"&&t.payout>0?t.payout:t.amount;return{myResult:s.myResult,myPayout:B,label:qh(s.myResult,B,t.amount)}}return s}}return{myResult:"PUSH",myPayout:0,label:"Push"}}function pZ(t){return typeof t.payout=="number"?t.payout:t.amount}function $KA(t){return t.amount}function AFA(t){return typeof t.oddsBp=="number"&&t.oddsBp!==1e4&&typeof t.payout=="number"?t.payout:t.amount}function qh(t,A,e){return t==="WIN"?`won ${PU(Math.max(0,A))}`:t==="LOSE"?`lost ${PU(Math.max(0,e))}`:t==="PUSH"?"Push":t}function eFA(t){return!t||t.length===0?0:t.reduce((A,e)=>A+Number(e?.amount||0),0)}function iiA({meId:t,items:A,onClose:e,nameOf:i,crapsRollHistory:g,gameMode:I,crapsLedgerItems:n}){const o=A,a=I==="craps",r={};for(const B of o){const c=B?.acceptedById===t?B?.playerId:B?.acceptedById;if(!c)continue;const E=Iu(B,t);let D=0;E.myResult==="WIN"?D=Number(E.myPayout??0):E.myResult==="LOSE"&&(D=-Number(B?.amount??0)),r[c]=(r[c]??0)+D}const s=Object.entries(r).map(([B,c])=>({id:B,name:i?.(B)||B,delta:c})).sort((B,c)=>c.delta-B.delta);return Q.jsxs("div",{className:"results-modal",children:[Q.jsx("div",{className:"results-modal__backdrop",onClick:e}),Q.jsxs("div",{className:"results-modal__card card",children:[Q.jsxs("div",{className:"results-modal__header",children:[Q.jsx("h3",{children:"Your Results (this game)"}),Q.jsx("button",{className:"btn btn--ghost",onClick:e,children:"Close"})]}),!a&&s.length>0&&Q.jsx("div",{className:"results-modal__deltas",children:Q.jsx("ul",{className:"results-modal__deltas-list",children:s.map(({id:B,name:c,delta:E})=>Q.jsxs("li",{className:`results-modal__delta ${E>=0?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[c,": ",E>=0?"+":"","z",Bd.formatMoney(E,"",0)]},B))})}),a&&Q.jsxs(Q.Fragment,{children:[(()=>{const B=eFA(n),c=B>=0,E=Math.abs(B);return n?Q.jsx("div",{className:"results-modal__deltas",children:Q.jsxs("div",{className:`results-modal__delta ${c?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[Q.jsx("strong",{children:"Total won/lost:"})," ",c?"+":"-","z",Bd.formatMoney(E,"",0)]})}):null})(),Q.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[(n?.length??0)===0&&Q.jsx("li",{className:"betitem",children:"No history yet."}),(n||[]).map((B,c)=>{const E=Number(B.amount||0),D=E>=0,y=Math.abs(E),f=new Date(B.ts).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let M="";if(B.kind==="BET_PLACED")M=`Placed ${B.meta?.betType?String(B.meta.betType):"bet"}`;else if(B.kind==="REFUND")M=`Refund ${B.meta?.betType?String(B.meta.betType):"chips"}`;else if(B.kind==="BET_SETTLED"){const k=Array.isArray(B.meta?.settlements)?B.meta.settlements:[],m=k[0]||null,U=m?.betType?String(m.betType):B.meta?.betType?String(B.meta.betType):"bet",F=E>0?"WIN":E<0?"LOSE":"PUSH",b=B.meta?.roll?.total?` on ${B.meta.roll.total}`:"",K=k.length>1?` (+${k.length-1} more)`:"";M=`Settled: ${U} ${F}${b}${K}`}return Q.jsx("li",{className:"betitem results-modal__bet-row",children:Q.jsxs("span",{children:[f," — ",M," ",D?"+":"-","z",Bd.formatMoney(y,"",0)]})},B.id||c)})]})]}),!a&&Q.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[o.length===0&&Q.jsx("li",{className:"betitem",children:"No results yet."}),o.map((B,c)=>{const E=B?.acceptedById===t?B?.playerId:B?.acceptedById,D=(()=>{const f=B;return f?.acceptedById===t?f?.playerName||f?.player?.name||f?.playerEmail||f?.player?.email:f?.bankerName||f?.banker?.name||f?.bankerEmail||f?.banker?.email})(),y=i?.(E)||D||E||"Unknown",S=qh(...(()=>{const f=Iu(B,t);return[f.myResult,f.myPayout,B.amount]})());return Q.jsx("li",{className:"betitem results-modal__bet-row",children:Q.jsxs("span",{children:["Round ",B.roundSeq," ",S," vs ",y]})},c)})]})]})]})}var fZ;(function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"})(fZ||(fZ={}));var DZ;(function(t){t.Body="body",t.Ionic="ionic",t.Native="native",t.None="none"})(DZ||(DZ={}));const LN=mB("Keyboard");function giA({onPlaceBet:t,onCancelBet:A,disabled:e=!1,showCancel:i=!1,min:g=1,max:I,defaultValue:n=25,heading:o}){const[a,r]=p.useState(n),s=p.useRef(!1),[B,c]=p.useState(0),E=p.useRef(null);p.useEffect(()=>{if(!Li.isNativePlatform())return;LN.setAccessoryBarVisible({isVisible:!0});const M=LN.addListener("keyboardWillShow",m=>c(m.keyboardHeight)),k=LN.addListener("keyboardWillHide",()=>c(0));return()=>{LN.setAccessoryBarVisible({isVisible:!1}),M.then(m=>m.remove()),k.then(m=>m.remove())}},[]);const D=p.useCallback(M=>{const k=M.target.value.replace(/[^0-9]/g,""),m=k===""?0:parseInt(k,10);r(I!=null?Math.min(m,I):m)},[I]),y=p.useCallback(()=>{if(s.current||e||i)return;const M=Math.max(g,Math.floor(a));M<=0||(s.current=!0,xt("Light"),E.current?.blur(),t(M),setTimeout(()=>{s.current=!1},600))},[e,i,a,g,t]),S=p.useCallback(()=>{i&&(xt("Light"),A())},[i,A]),f=!e&&!i&&a>=g;return Q.jsxs("div",{className:"bet-amount-input",children:[o&&Q.jsx("div",{className:"bet-amount-input__heading",children:o}),Q.jsxs("div",{className:`bet-amount-input__group ${e?"bet-amount-input__group--disabled":""}`,children:[Q.jsxs("div",{className:"bet-amount-input__field",children:[Q.jsx("button",{className:"bet-amount-input__cancel",onClick:S,disabled:!i,children:"Cancel"}),Q.jsx("span",{className:"bet-amount-input__symbol",children:"ℤ"}),Q.jsx("input",{ref:E,type:"text",inputMode:"numeric",pattern:"[0-9]*",enterKeyHint:"done",className:`bet-amount-input__input${i?" bet-amount-input__input--active-bet":""}`,value:a||"",onChange:D,onKeyDown:M=>{M.key==="Enter"&&f&&(M.currentTarget.blur(),y())},disabled:e||i,"aria-label":"Bet amount",autoComplete:"off"})]}),Q.jsx("button",{className:"bet-amount-input__place-btn",onClick:y,disabled:!f,"aria-label":"Place bet",children:"Place Bet"})]}),B>0&&Zc.createPortal(Q.jsxs("div",{className:"bet-amount-input__kb-bar",style:{bottom:B,position:"fixed",left:0,right:0,zIndex:99999,display:"flex",alignItems:"center",gap:10,padding:"10px 16px",background:"rgba(14, 20, 28, 0.97)",borderTop:"1px solid rgba(230, 193, 102, 0.25)",visibility:"visible",opacity:1},children:[Q.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",color:"#D9CCA7",flexShrink:0},children:"Bet Amount"}),Q.jsxs("span",{style:{flex:1,fontSize:24,fontWeight:600,color:"#F5E9CA",textAlign:"center"},children:["ℤ ",a||0]}),Q.jsx("button",{className:"bet-amount-input__kb-place",style:{flexShrink:0,padding:"8px 18px",border:"1.5px solid #E6C166",borderRadius:6,background:"transparent",color:"#E6C166",fontSize:13,fontWeight:700,textTransform:"uppercase",letterSpacing:"0.04em"},onTouchEnd:M=>{M.preventDefault(),f&&y()},disabled:!f,children:"Place Bet"})]}),document.body)]})}const tFA=""+new URL("roll-btn-web-wZ6ex-aH.webp",import.meta.url).href,IiA=50,qN=IiA/1200;function niA({disabled:t,busy:A=!1,onClick:e,onPressStart:i,onChargeChange:g,label:I="ROLL",className:n,"aria-label":o,useImage:a=!0,"data-testid":r}){const s=t||A,B=p.useRef(!1),c=p.useRef(0),E=p.useRef(null),D=p.useRef(g);D.current=g,p.useEffect(()=>()=>{E.current&&(clearInterval(E.current),E.current=null)},[]);const y=p.useCallback(()=>{c.current=0,D.current?.(0),E.current&&clearInterval(E.current),E.current=window.setInterval(()=>{c.current=Math.min(1,c.current+qN),D.current?.(c.current),c.current>=.25&&c.current<.25+qN*1.5?Xa("Light"):c.current>=.6&&c.current<.6+qN*1.5?Xa("Medium"):c.current>=.95&&c.current<.95+qN*1.5&&Xa("Heavy")},IiA)},[]),S=p.useCallback(()=>{E.current&&(clearInterval(E.current),E.current=null),D.current?.(0)},[]),f=p.useCallback(()=>{s||B.current||(B.current=!0,Cg(),i?.(),y())},[s,i,y]),M=p.useCallback(async()=>{if(B.current){B.current=!1,S();try{const m=window;m.__rtcDiag||(m.__rtcDiag=[]),m.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),m.__dumpRtcDiag&&m.__dumpRtcDiag("ui:rollButtonClick")}catch{}e();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await Xa("Heavy")}},[e,S]),k=p.useCallback(async m=>{if(B.current){m.preventDefault();return}if(!s){i?.(),D.current?.(1);try{const U=window;U.__rtcDiag||(U.__rtcDiag=[]),U.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),U.__dumpRtcDiag&&U.__dumpRtcDiag("ui:rollButtonClick")}catch{}e(),D.current?.(0);try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await Xa("Heavy")}},[s,e,i]);return Q.jsx("div",{className:["roll-wrapper",n].filter(Boolean).join(" "),children:Q.jsxs("button",{type:"button",className:["roll",a?"roll--image":"",s?"is-disabled":""].join(" "),onClick:k,onPointerDown:f,onPointerUp:M,onPointerCancel:M,onPointerLeave:M,disabled:s,"aria-label":o??(A?"Rolling dice":"Roll dice"),"aria-busy":A||void 0,"data-testid":r,children:[a&&Q.jsx("img",{src:tFA,alt:"",className:"roll__img",draggable:!1}),A&&Q.jsx("span",{className:"roll__spinner","aria-hidden":"true"}),Q.jsx("span",{className:"roll__halo","aria-hidden":"true"}),!a&&Q.jsx("span",{className:"roll__gloss","aria-hidden":"true"}),!a&&Q.jsx("span",{className:"roll__label","aria-live":"polite",children:A?"ROLLING…":I})]})})}const iFA={1:O$,2:P$,3:j$,4:Z$,5:W$,6:z$};function aO({dice:t}){return!t||!t.length?null:Q.jsx("div",{className:"dice-results-icons",style:{display:"flex",gap:2},children:t.map((A,e)=>Q.jsx("img",{src:iFA[A],alt:`Dice face ${A}`,style:{width:22,height:22,borderRadius:"4px"}},e))})}function gFA({roomId:t,meId:A,bankerId:e,players:i,className:g,hasBankRoll:I,gameState:n,gameplay:o,onChargeChange:a}){const B=n.gameMode==="cee-lo"?100:10,[c,E]=p.useState(B),D=c,[y,S]=p.useState(!1),[f,M]=p.useState(!1),k=MQ(),m=n.banker??e,U=m===A,{settled:F,settledAll:b,myOpenMain:K,placeMainBet:R,cancelMainBet:G}=nb(t,A),[J,x]=p.useState(!1);p.useEffect(()=>{K&&J&&x(!1)},[K,J]),p.useEffect(()=>{if(!J||K)return;const RA=setTimeout(()=>x(!1),5e3);return()=>clearTimeout(RA)},[J,K]);const H=o?.handleRoll??(()=>{}),P=!!o?.canRoll;o?.lastRollerId;const j=o?.diceSettled??!0,q=n?.betsLocked??!1;n?.roundSeq;const Y=!!n?.bankRoll,O=Y,[$,gA]=p.useState(!1),z=p.useRef(q),X=p.useRef(null);p.useEffect(()=>(z.current&&!q&&(gA(!0),X.current&&window.clearTimeout(X.current),X.current=window.setTimeout(()=>{gA(!1),X.current=null},3e3)),q&&X.current&&(window.clearTimeout(X.current),X.current=null,gA(!1)),z.current=q,()=>{X.current&&window.clearTimeout(X.current)}),[q]);const sA=p.useCallback(async RA=>{try{Cg()}catch{}if(y)return;const MA=Math.floor(RA??D);if(MA<=0){k.info("Enter a bet amount.");return}if(!Y){if(q||O){k.info("Bets are closed.");return}if(n?.spectators?.includes(A)){k.info("Exit spectate to place a bet.");return}try{S(!0);const oA=await R(MA);if(!oA?.ok){k.error(oA?.error||"Bet rejected");return}x(!0)}catch{}finally{S(!1)}}},[y,D,I,q,O,n,R]),rA=p.useCallback(async()=>{try{Cg()}catch{}if(K)try{const RA=await G(K.id);RA.ok||k.error(RA.error||"Failed to cancel bet")}catch(RA){k.error(RA?.message??"Failed to cancel bet")}},[G,K,k]),IA=(n?.spectators??[]).includes(A),uA=y||IA||O||q||J,KA=p.useMemo(()=>{const RA=n?.currentRollerId;if(!RA||RA===A)return null;const MA=i.find(iA=>iA.id===RA);if(!MA)return null;let oA=0,AA=0;for(const iA of b){if(iA.type!=="MAIN"||!(iA.playerId===A&&iA.acceptedById===RA||iA.playerId===RA&&iA.acceptedById===A))continue;AA++;const DA=Iu(iA,A);DA.myResult==="WIN"?oA+=Number(DA.myPayout??0):DA.myResult==="LOSE"&&(oA-=Number(iA.amount??0))}const tA=oA>0?`+ℤ${oA.toLocaleString()}`:oA<0?`-ℤ${Math.abs(oA).toLocaleString()}`:"ℤ0";return{name:MA.name,net:oA,label:tA,hasHistory:AA>0}},[n,A,i,b]),FA=p.useMemo(()=>{if(!m)return null;const RA=n.bankRoll;if(!RA||!Array.isArray(RA.raw))return null;const MA=[...RA.raw].sort((AA,tA)=>AA-tA),oA=m===A?"You":i.find(AA=>AA.id===m)?.name??"Banker";switch(RA.type){case"point":{const[AA,tA,iA]=RA.raw;return{label:"Point",display:RA.pointValue??(AA===tA?iA:AA===iA?tA:AA),dice:null,bankerName:oA}}case"triplet":return{label:"Trips",display:null,dice:MA,bankerName:oA};case"456":return{label:"4-5-6!",display:null,dice:[4,5,6],bankerName:oA};case"123":return{label:"1-2-3",display:null,dice:[1,2,3],bankerName:oA};default:return null}},[n,m,A,i]);return Q.jsxs("div",{className:["betpanel",g].filter(Boolean).join(" "),children:[Q.jsxs("section",{className:"betpanel__section",children:[Q.jsxs("div",{className:"betpanel__row betpanel__row--roll",children:[Q.jsx("div",{className:`betpanel__roundInfo${FA?" betpanel__roundInfo--visible":""}`,"aria-label":"Round info",children:FA&&Q.jsxs(Q.Fragment,{children:[Q.jsx("span",{className:"betpanel__roundInfo__label",children:FA.label}),Q.jsx("span",{className:"betpanel__roundInfo__number",children:FA.dice?Q.jsx(aO,{dice:FA.dice}):FA.display}),Q.jsx("span",{className:"betpanel__roundInfo__banker",children:FA.bankerName})]})},FA?.label),Q.jsx(niA,{disabled:!P||IA,busy:!j,onClick:H,onChargeChange:a,"data-testid":"roll-button"}),Q.jsx("div",{className:`betpanel__rollerMeta${KA?" betpanel__rollerMeta--visible":""}`,"aria-label":"Current roller",children:KA&&Q.jsxs(Q.Fragment,{children:[Q.jsx("span",{className:"betpanel__rollerMeta__label",children:"vs"}),KA.hasHistory?Q.jsxs("span",{className:`betpanel__rollerMeta__record ${KA.net>0?"betpanel__rollerMeta__record--up":KA.net<0?"betpanel__rollerMeta__record--down":""}`,children:[KA.net>0?"+":KA.net<0?"-":"",Q.jsx("span",{className:"betpanel__rollerMeta__z",children:"ℤ"}),Math.abs(KA.net).toLocaleString()]}):Q.jsx("span",{className:"betpanel__rollerMeta__noRecord",children:"—"}),Q.jsx("span",{className:"betpanel__rollerMeta__name",children:KA.name})]})})]}),!U&&Q.jsx("div",{className:"betpanel__row",children:Q.jsx(giA,{onPlaceBet:sA,onCancelBet:rA,disabled:uA,showCancel:!!K&&!Y,defaultValue:B})})]}),f&&Q.jsx(iiA,{meId:A,items:F,onClose:()=>M(!1)})]})}const IFA="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let IL=(t=21)=>{let A="",e=crypto.getRandomValues(new Uint8Array(t|=0));for(;t--;)A+=IFA[e[t]&63];return A};const oiA=p.createContext({});function nFA(t){const A=p.useRef(null);return A.current===null&&(A.current=t()),A.current}const rO=typeof window<"u",oFA=rO?p.useLayoutEffect:p.useEffect,sO=p.createContext(null);function CO(t,A){t.indexOf(A)===-1&&t.push(A)}function BO(t,A){const e=t.indexOf(A);e>-1&&t.splice(e,1)}const hQ=(t,A,e)=>e>A?A:e<t?t:e;let cO=()=>{};const dQ={},aiA=t=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(t);function riA(t){return typeof t=="object"&&t!==null}const siA=t=>/^0[^.\s]+$/u.test(t);function lO(t){let A;return()=>(A===void 0&&(A=t()),A)}const rC=t=>t,aFA=(t,A)=>e=>A(t(e)),vk=(...t)=>t.reduce(aFA),k0=(t,A,e)=>{const i=A-t;return i===0?1:(e-t)/i};class QO{constructor(){this.subscriptions=[]}add(A){return CO(this.subscriptions,A),()=>BO(this.subscriptions,A)}notify(A,e,i){const g=this.subscriptions.length;if(g)if(g===1)this.subscriptions[0](A,e,i);else for(let I=0;I<g;I++){const n=this.subscriptions[I];n&&n(A,e,i)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Lc=t=>t*1e3,qc=t=>t/1e3;function CiA(t,A){return A?t*(1e3/A):0}const BiA=(t,A,e)=>(((1-3*e+3*A)*t+(3*e-6*A))*t+3*A)*t,rFA=1e-7,sFA=12;function CFA(t,A,e,i,g){let I,n,o=0;do n=A+(e-A)/2,I=BiA(n,i,g)-t,I>0?e=n:A=n;while(Math.abs(I)>rFA&&++o<sFA);return n}function _k(t,A,e,i){if(t===A&&e===i)return rC;const g=I=>CFA(I,0,1,t,e);return I=>I===0||I===1?I:BiA(g(I),A,i)}const ciA=t=>A=>A<=.5?t(2*A)/2:(2-t(2*(1-A)))/2,liA=t=>A=>1-t(1-A),QiA=_k(.33,1.53,.69,.99),EO=liA(QiA),EiA=ciA(EO),uiA=t=>(t*=2)<1?.5*EO(t):.5*(2-Math.pow(2,-10*(t-1))),uO=t=>1-Math.sin(Math.acos(t)),hiA=liA(uO),diA=ciA(uO),BFA=_k(.42,0,1,1),cFA=_k(0,0,.58,1),piA=_k(.42,0,.58,1),lFA=t=>Array.isArray(t)&&typeof t[0]!="number",fiA=t=>Array.isArray(t)&&typeof t[0]=="number",QFA={linear:rC,easeIn:BFA,easeInOut:piA,easeOut:cFA,circIn:uO,circInOut:diA,circOut:hiA,backIn:EO,backInOut:EiA,backOut:QiA,anticipate:uiA},EFA=t=>typeof t=="string",yZ=t=>{if(fiA(t)){cO(t.length===4);const[A,e,i,g]=t;return _k(A,e,i,g)}else if(EFA(t))return QFA[t];return t},xN=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function uFA(t,A){let e=new Set,i=new Set,g=!1,I=!1;const n=new WeakSet;let o={delta:0,timestamp:0,isProcessing:!1};function a(s){n.has(s)&&(r.schedule(s),t()),s(o)}const r={schedule:(s,B=!1,c=!1)=>{const D=c&&g?e:i;return B&&n.add(s),D.has(s)||D.add(s),s},cancel:s=>{i.delete(s),n.delete(s)},process:s=>{if(o=s,g){I=!0;return}g=!0,[e,i]=[i,e],e.forEach(a),e.clear(),g=!1,I&&(I=!1,r.process(s))}};return r}const hFA=40;function DiA(t,A){let e=!1,i=!0;const g={delta:0,timestamp:0,isProcessing:!1},I=()=>e=!0,n=xN.reduce((k,m)=>(k[m]=uFA(I),k),{}),{setup:o,read:a,resolveKeyframes:r,preUpdate:s,update:B,preRender:c,render:E,postRender:D}=n,y=()=>{const k=dQ.useManualTiming?g.timestamp:performance.now();e=!1,dQ.useManualTiming||(g.delta=i?1e3/60:Math.max(Math.min(k-g.timestamp,hFA),1)),g.timestamp=k,g.isProcessing=!0,o.process(g),a.process(g),r.process(g),s.process(g),B.process(g),c.process(g),E.process(g),D.process(g),g.isProcessing=!1,e&&A&&(i=!1,t(y))},S=()=>{e=!0,i=!0,g.isProcessing||t(y)};return{schedule:xN.reduce((k,m)=>{const U=n[m];return k[m]=(F,b=!1,K=!1)=>(e||S(),U.schedule(F,b,K)),k},{}),cancel:k=>{for(let m=0;m<xN.length;m++)n[xN[m]].cancel(k)},state:g,steps:n}}const{schedule:UI,cancel:nu,state:Lo,steps:nL}=DiA(typeof requestAnimationFrame<"u"?requestAnimationFrame:rC,!0);let FR;function dFA(){FR=void 0}const Rr={now:()=>(FR===void 0&&Rr.set(Lo.isProcessing||dQ.useManualTiming?Lo.timestamp:performance.now()),FR),set:t=>{FR=t,queueMicrotask(dFA)}},yiA=t=>A=>typeof A=="string"&&A.startsWith(t),hO=yiA("--"),pFA=yiA("var(--"),dO=t=>pFA(t)?fFA.test(t.split("/*")[0].trim()):!1,fFA=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Py={test:t=>typeof t=="number",parse:parseFloat,transform:t=>t},M0={...Py,transform:t=>hQ(0,1,t)},TN={...Py,default:1},Jm=t=>Math.round(t*1e5)/1e5,pO=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function DFA(t){return t==null}const yFA=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,fO=(t,A)=>e=>!!(typeof e=="string"&&yFA.test(e)&&e.startsWith(t)||A&&!DFA(e)&&Object.prototype.hasOwnProperty.call(e,A)),SiA=(t,A,e)=>i=>{if(typeof i!="string")return i;const[g,I,n,o]=i.match(pO);return{[t]:parseFloat(g),[A]:parseFloat(I),[e]:parseFloat(n),alpha:o!==void 0?parseFloat(o):1}},SFA=t=>hQ(0,255,t),oL={...Py,transform:t=>Math.round(SFA(t))},Wh={test:fO("rgb","red"),parse:SiA("red","green","blue"),transform:({red:t,green:A,blue:e,alpha:i=1})=>"rgba("+oL.transform(t)+", "+oL.transform(A)+", "+oL.transform(e)+", "+Jm(M0.transform(i))+")"};function wFA(t){let A="",e="",i="",g="";return t.length>5?(A=t.substring(1,3),e=t.substring(3,5),i=t.substring(5,7),g=t.substring(7,9)):(A=t.substring(1,2),e=t.substring(2,3),i=t.substring(3,4),g=t.substring(4,5),A+=A,e+=e,i+=i,g+=g),{red:parseInt(A,16),green:parseInt(e,16),blue:parseInt(i,16),alpha:g?parseInt(g,16)/255:1}}const WT={test:fO("#"),parse:wFA,transform:Wh.transform},Jk=t=>({test:A=>typeof A=="string"&&A.endsWith(t)&&A.split(" ").length===1,parse:parseFloat,transform:A=>`${A}${t}`}),yE=Jk("deg"),xc=Jk("%"),Qi=Jk("px"),mFA=Jk("vh"),kFA=Jk("vw"),SZ={...xc,parse:t=>xc.parse(t)/100,transform:t=>xc.transform(t*100)},sD={test:fO("hsl","hue"),parse:SiA("hue","saturation","lightness"),transform:({hue:t,saturation:A,lightness:e,alpha:i=1})=>"hsla("+Math.round(t)+", "+xc.transform(Jm(A))+", "+xc.transform(Jm(e))+", "+Jm(M0.transform(i))+")"},kn={test:t=>Wh.test(t)||WT.test(t)||sD.test(t),parse:t=>Wh.test(t)?Wh.parse(t):sD.test(t)?sD.parse(t):WT.parse(t),transform:t=>typeof t=="string"?t:t.hasOwnProperty("red")?Wh.transform(t):sD.transform(t),getAnimatableNone:t=>{const A=kn.parse(t);return A.alpha=0,kn.transform(A)}},MFA=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function NFA(t){return isNaN(t)&&typeof t=="string"&&(t.match(pO)?.length||0)+(t.match(MFA)?.length||0)>0}const wiA="number",miA="color",GFA="var",RFA="var(",wZ="${}",UFA=/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 N0(t){const A=t.toString(),e=[],i={color:[],number:[],var:[]},g=[];let I=0;const o=A.replace(UFA,a=>(kn.test(a)?(i.color.push(I),g.push(miA),e.push(kn.parse(a))):a.startsWith(RFA)?(i.var.push(I),g.push(GFA),e.push(a)):(i.number.push(I),g.push(wiA),e.push(parseFloat(a))),++I,wZ)).split(wZ);return{values:e,split:o,indexes:i,types:g}}function kiA(t){return N0(t).values}function MiA(t){const{split:A,types:e}=N0(t),i=A.length;return g=>{let I="";for(let n=0;n<i;n++)if(I+=A[n],g[n]!==void 0){const o=e[n];o===wiA?I+=Jm(g[n]):o===miA?I+=kn.transform(g[n]):I+=g[n]}return I}}const KFA=t=>typeof t=="number"?0:kn.test(t)?kn.getAnimatableNone(t):t;function FFA(t){const A=kiA(t);return MiA(t)(A.map(KFA))}const ou={test:NFA,parse:kiA,createTransformer:MiA,getAnimatableNone:FFA};function aL(t,A,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(A-t)*6*e:e<1/2?A:e<2/3?t+(A-t)*(2/3-e)*6:t}function bFA({hue:t,saturation:A,lightness:e,alpha:i}){t/=360,A/=100,e/=100;let g=0,I=0,n=0;if(!A)g=I=n=e;else{const o=e<.5?e*(1+A):e+A-e*A,a=2*e-o;g=aL(a,o,t+1/3),I=aL(a,o,t),n=aL(a,o,t-1/3)}return{red:Math.round(g*255),green:Math.round(I*255),blue:Math.round(n*255),alpha:i}}function jU(t,A){return e=>e>0?A:t}const TI=(t,A,e)=>t+(A-t)*e,rL=(t,A,e)=>{const i=t*t,g=e*(A*A-i)+i;return g<0?0:Math.sqrt(g)},vFA=[WT,Wh,sD],_FA=t=>vFA.find(A=>A.test(t));function mZ(t){const A=_FA(t);if(!A)return!1;let e=A.parse(t);return A===sD&&(e=bFA(e)),e}const kZ=(t,A)=>{const e=mZ(t),i=mZ(A);if(!e||!i)return jU(t,A);const g={...e};return I=>(g.red=rL(e.red,i.red,I),g.green=rL(e.green,i.green,I),g.blue=rL(e.blue,i.blue,I),g.alpha=TI(e.alpha,i.alpha,I),Wh.transform(g))},zT=new Set(["none","hidden"]);function JFA(t,A){return zT.has(t)?e=>e<=0?t:A:e=>e>=1?A:t}function LFA(t,A){return e=>TI(t,A,e)}function DO(t){return typeof t=="number"?LFA:typeof t=="string"?dO(t)?jU:kn.test(t)?kZ:TFA:Array.isArray(t)?NiA:typeof t=="object"?kn.test(t)?kZ:qFA:jU}function NiA(t,A){const e=[...t],i=e.length,g=t.map((I,n)=>DO(I)(I,A[n]));return I=>{for(let n=0;n<i;n++)e[n]=g[n](I);return e}}function qFA(t,A){const e={...t,...A},i={};for(const g in e)t[g]!==void 0&&A[g]!==void 0&&(i[g]=DO(t[g])(t[g],A[g]));return g=>{for(const I in i)e[I]=i[I](g);return e}}function xFA(t,A){const e=[],i={color:0,var:0,number:0};for(let g=0;g<A.values.length;g++){const I=A.types[g],n=t.indexes[I][i[I]],o=t.values[n]??0;e[g]=o,i[I]++}return e}const TFA=(t,A)=>{const e=ou.createTransformer(A),i=N0(t),g=N0(A);return i.indexes.var.length===g.indexes.var.length&&i.indexes.color.length===g.indexes.color.length&&i.indexes.number.length>=g.indexes.number.length?zT.has(t)&&!g.values.length||zT.has(A)&&!i.values.length?JFA(t,A):vk(NiA(xFA(i,g),g.values),e):jU(t,A)};function GiA(t,A,e){return typeof t=="number"&&typeof A=="number"&&typeof e=="number"?TI(t,A,e):DO(t)(t,A)}const YFA=t=>{const A=({timestamp:e})=>t(e);return{start:(e=!0)=>UI.update(A,e),stop:()=>nu(A),now:()=>Lo.isProcessing?Lo.timestamp:Rr.now()}},RiA=(t,A,e=10)=>{let i="";const g=Math.max(Math.round(A/e),2);for(let I=0;I<g;I++)i+=Math.round(t(I/(g-1))*1e4)/1e4+", ";return`linear(${i.substring(0,i.length-2)})`},ZU=2e4;function yO(t){let A=0;const e=50;let i=t.next(A);for(;!i.done&&A<ZU;)A+=e,i=t.next(A);return A>=ZU?1/0:A}function HFA(t,A=100,e){const i=e({...t,keyframes:[0,A]}),g=Math.min(yO(i),ZU);return{type:"keyframes",ease:I=>i.next(g*I).value/A,duration:qc(g)}}const OFA=5;function UiA(t,A,e){const i=Math.max(A-OFA,0);return CiA(e-t(i),A-i)}const XI={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},sL=.001;function PFA({duration:t=XI.duration,bounce:A=XI.bounce,velocity:e=XI.velocity,mass:i=XI.mass}){let g,I,n=1-A;n=hQ(XI.minDamping,XI.maxDamping,n),t=hQ(XI.minDuration,XI.maxDuration,qc(t)),n<1?(g=r=>{const s=r*n,B=s*t,c=s-e,E=VT(r,n),D=Math.exp(-B);return sL-c/E*D},I=r=>{const B=r*n*t,c=B*e+e,E=Math.pow(n,2)*Math.pow(r,2)*t,D=Math.exp(-B),y=VT(Math.pow(r,2),n);return(-g(r)+sL>0?-1:1)*((c-E)*D)/y}):(g=r=>{const s=Math.exp(-r*t),B=(r-e)*t+1;return-sL+s*B},I=r=>{const s=Math.exp(-r*t),B=(e-r)*(t*t);return s*B});const o=5/t,a=ZFA(g,I,o);if(t=Lc(t),isNaN(a))return{stiffness:XI.stiffness,damping:XI.damping,duration:t};{const r=Math.pow(a,2)*i;return{stiffness:r,damping:n*2*Math.sqrt(i*r),duration:t}}}const jFA=12;function ZFA(t,A,e){let i=e;for(let g=1;g<jFA;g++)i=i-t(i)/A(i);return i}function VT(t,A){return t*Math.sqrt(1-A*A)}const WFA=["duration","bounce"],zFA=["stiffness","damping","mass"];function MZ(t,A){return A.some(e=>t[e]!==void 0)}function VFA(t){let A={velocity:XI.velocity,stiffness:XI.stiffness,damping:XI.damping,mass:XI.mass,isResolvedFromDuration:!1,...t};if(!MZ(t,zFA)&&MZ(t,WFA))if(t.visualDuration){const e=t.visualDuration,i=2*Math.PI/(e*1.2),g=i*i,I=2*hQ(.05,1,1-(t.bounce||0))*Math.sqrt(g);A={...A,mass:XI.mass,stiffness:g,damping:I}}else{const e=PFA(t);A={...A,...e,mass:XI.mass},A.isResolvedFromDuration=!0}return A}function WU(t=XI.visualDuration,A=XI.bounce){const e=typeof t!="object"?{visualDuration:t,keyframes:[0,1],bounce:A}:t;let{restSpeed:i,restDelta:g}=e;const I=e.keyframes[0],n=e.keyframes[e.keyframes.length-1],o={done:!1,value:I},{stiffness:a,damping:r,mass:s,duration:B,velocity:c,isResolvedFromDuration:E}=VFA({...e,velocity:-qc(e.velocity||0)}),D=c||0,y=r/(2*Math.sqrt(a*s)),S=n-I,f=qc(Math.sqrt(a/s)),M=Math.abs(S)<5;i||(i=M?XI.restSpeed.granular:XI.restSpeed.default),g||(g=M?XI.restDelta.granular:XI.restDelta.default);let k;if(y<1){const U=VT(f,y);k=F=>{const b=Math.exp(-y*f*F);return n-b*((D+y*f*S)/U*Math.sin(U*F)+S*Math.cos(U*F))}}else if(y===1)k=U=>n-Math.exp(-f*U)*(S+(D+f*S)*U);else{const U=f*Math.sqrt(y*y-1);k=F=>{const b=Math.exp(-y*f*F),K=Math.min(U*F,300);return n-b*((D+y*f*S)*Math.sinh(K)+U*S*Math.cosh(K))/U}}const m={calculatedDuration:E&&B||null,next:U=>{const F=k(U);if(E)o.done=U>=B;else{let b=U===0?D:0;y<1&&(b=U===0?Lc(D):UiA(k,U,F));const K=Math.abs(b)<=i,R=Math.abs(n-F)<=g;o.done=K&&R}return o.value=o.done?n:F,o},toString:()=>{const U=Math.min(yO(m),ZU),F=RiA(b=>m.next(U*b).value,U,30);return U+"ms "+F},toTransition:()=>{}};return m}WU.applyToOptions=t=>{const A=HFA(t,100,WU);return t.ease=A.ease,t.duration=Lc(A.duration),t.type="keyframes",t};function XT({keyframes:t,velocity:A=0,power:e=.8,timeConstant:i=325,bounceDamping:g=10,bounceStiffness:I=500,modifyTarget:n,min:o,max:a,restDelta:r=.5,restSpeed:s}){const B=t[0],c={done:!1,value:B},E=K=>o!==void 0&&K<o||a!==void 0&&K>a,D=K=>o===void 0?a:a===void 0||Math.abs(o-K)<Math.abs(a-K)?o:a;let y=e*A;const S=B+y,f=n===void 0?S:n(S);f!==S&&(y=f-B);const M=K=>-y*Math.exp(-K/i),k=K=>f+M(K),m=K=>{const R=M(K),G=k(K);c.done=Math.abs(R)<=r,c.value=c.done?f:G};let U,F;const b=K=>{E(c.value)&&(U=K,F=WU({keyframes:[c.value,D(c.value)],velocity:UiA(k,K,c.value),damping:g,stiffness:I,restDelta:r,restSpeed:s}))};return b(0),{calculatedDuration:null,next:K=>{let R=!1;return!F&&U===void 0&&(R=!0,m(K),b(K)),U!==void 0&&K>=U?F.next(K-U):(!R&&m(K),c)}}}function XFA(t,A,e){const i=[],g=e||dQ.mix||GiA,I=t.length-1;for(let n=0;n<I;n++){let o=g(t[n],t[n+1]);if(A){const a=Array.isArray(A)?A[n]||rC:A;o=vk(a,o)}i.push(o)}return i}function $FA(t,A,{clamp:e=!0,ease:i,mixer:g}={}){const I=t.length;if(cO(I===A.length),I===1)return()=>A[0];if(I===2&&A[0]===A[1])return()=>A[1];const n=t[0]===t[1];t[0]>t[I-1]&&(t=[...t].reverse(),A=[...A].reverse());const o=XFA(A,i,g),a=o.length,r=s=>{if(n&&s<t[0])return A[0];let B=0;if(a>1)for(;B<t.length-2&&!(s<t[B+1]);B++);const c=k0(t[B],t[B+1],s);return o[B](c)};return e?s=>r(hQ(t[0],t[I-1],s)):r}function AbA(t,A){const e=t[t.length-1];for(let i=1;i<=A;i++){const g=k0(0,A,i);t.push(TI(e,1,g))}}function ebA(t){const A=[0];return AbA(A,t.length-1),A}function tbA(t,A){return t.map(e=>e*A)}function ibA(t,A){return t.map(()=>A||piA).splice(0,t.length-1)}function Lm({duration:t=300,keyframes:A,times:e,ease:i="easeInOut"}){const g=lFA(i)?i.map(yZ):yZ(i),I={done:!1,value:A[0]},n=tbA(e&&e.length===A.length?e:ebA(A),t),o=$FA(n,A,{ease:Array.isArray(g)?g:ibA(A,g)});return{calculatedDuration:t,next:a=>(I.value=o(a),I.done=a>=t,I)}}const gbA=t=>t!==null;function SO(t,{repeat:A,repeatType:e="loop"},i,g=1){const I=t.filter(gbA),o=g<0||A&&e!=="loop"&&A%2===1?0:I.length-1;return!o||i===void 0?I[o]:i}const IbA={decay:XT,inertia:XT,tween:Lm,keyframes:Lm,spring:WU};function KiA(t){typeof t.type=="string"&&(t.type=IbA[t.type])}class wO{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(A=>{this.resolve=A})}notifyFinished(){this.resolve()}then(A,e){return this.finished.then(A,e)}}const nbA=t=>t/100;class mO extends wO{constructor(A){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{const{motionValue:e}=this.options;e&&e.updatedAt!==Rr.now()&&this.tick(Rr.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),this.options.onStop?.())},this.options=A,this.initAnimation(),this.play(),A.autoplay===!1&&this.pause()}initAnimation(){const{options:A}=this;KiA(A);const{type:e=Lm,repeat:i=0,repeatDelay:g=0,repeatType:I,velocity:n=0}=A;let{keyframes:o}=A;const a=e||Lm;a!==Lm&&typeof o[0]!="number"&&(this.mixKeyframes=vk(nbA,GiA(o[0],o[1])),o=[0,100]);const r=a({...A,keyframes:o});I==="mirror"&&(this.mirroredGenerator=a({...A,keyframes:[...o].reverse(),velocity:-n})),r.calculatedDuration===null&&(r.calculatedDuration=yO(r));const{calculatedDuration:s}=r;this.calculatedDuration=s,this.resolvedDuration=s+g,this.totalDuration=this.resolvedDuration*(i+1)-g,this.generator=r}updateTime(A){const e=Math.round(A-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=e}tick(A,e=!1){const{generator:i,totalDuration:g,mixKeyframes:I,mirroredGenerator:n,resolvedDuration:o,calculatedDuration:a}=this;if(this.startTime===null)return i.next(0);const{delay:r=0,keyframes:s,repeat:B,repeatType:c,repeatDelay:E,type:D,onUpdate:y,finalKeyframe:S}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,A):this.speed<0&&(this.startTime=Math.min(A-g/this.speed,this.startTime)),e?this.currentTime=A:this.updateTime(A);const f=this.currentTime-r*(this.playbackSpeed>=0?1:-1),M=this.playbackSpeed>=0?f<0:f>g;this.currentTime=Math.max(f,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=g);let k=this.currentTime,m=i;if(B){const K=Math.min(this.currentTime,g)/o;let R=Math.floor(K),G=K%1;!G&&K>=1&&(G=1),G===1&&R--,R=Math.min(R,B+1),!!(R%2)&&(c==="reverse"?(G=1-G,E&&(G-=E/o)):c==="mirror"&&(m=n)),k=hQ(0,1,G)*o}const U=M?{done:!1,value:s[0]}:m.next(k);I&&(U.value=I(U.value));let{done:F}=U;!M&&a!==null&&(F=this.playbackSpeed>=0?this.currentTime>=g:this.currentTime<=0);const b=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&F);return b&&D!==XT&&(U.value=SO(s,this.options,S,this.speed)),y&&y(U.value),b&&this.finish(),U}then(A,e){return this.finished.then(A,e)}get duration(){return qc(this.calculatedDuration)}get time(){return qc(this.currentTime)}set time(A){A=Lc(A),this.currentTime=A,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=A:this.driver&&(this.startTime=this.driver.now()-A/this.playbackSpeed),this.driver?.start(!1)}get speed(){return this.playbackSpeed}set speed(A){this.updateTime(Rr.now());const e=this.playbackSpeed!==A;this.playbackSpeed=A,e&&(this.time=qc(this.currentTime))}play(){if(this.isStopped)return;const{driver:A=YFA,startTime:e}=this.options;this.driver||(this.driver=A(g=>this.tick(g))),this.options.onPlay?.();const i=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=i):this.holdTime!==null?this.startTime=i-this.holdTime:this.startTime||(this.startTime=e??i),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(Rr.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(A){return this.startTime=0,this.tick(A,!0)}attachTimeline(A){return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),this.driver?.stop(),A.observe(this)}}function obA(t){for(let A=1;A<t.length;A++)t[A]??(t[A]=t[A-1])}const zh=t=>t*180/Math.PI,$T=t=>{const A=zh(Math.atan2(t[1],t[0]));return AY(A)},abA={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:t=>(Math.abs(t[0])+Math.abs(t[3]))/2,rotate:$T,rotateZ:$T,skewX:t=>zh(Math.atan(t[1])),skewY:t=>zh(Math.atan(t[2])),skew:t=>(Math.abs(t[1])+Math.abs(t[2]))/2},AY=t=>(t=t%360,t<0&&(t+=360),t),NZ=$T,GZ=t=>Math.sqrt(t[0]*t[0]+t[1]*t[1]),RZ=t=>Math.sqrt(t[4]*t[4]+t[5]*t[5]),rbA={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:GZ,scaleY:RZ,scale:t=>(GZ(t)+RZ(t))/2,rotateX:t=>AY(zh(Math.atan2(t[6],t[5]))),rotateY:t=>AY(zh(Math.atan2(-t[2],t[0]))),rotateZ:NZ,rotate:NZ,skewX:t=>zh(Math.atan(t[4])),skewY:t=>zh(Math.atan(t[1])),skew:t=>(Math.abs(t[1])+Math.abs(t[4]))/2};function eY(t){return t.includes("scale")?1:0}function tY(t,A){if(!t||t==="none")return eY(A);const e=t.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let i,g;if(e)i=rbA,g=e;else{const o=t.match(/^matrix\(([-\d.e\s,]+)\)$/u);i=abA,g=o}if(!g)return eY(A);const I=i[A],n=g[1].split(",").map(CbA);return typeof I=="function"?I(n):n[I]}const sbA=(t,A)=>{const{transform:e="none"}=getComputedStyle(t);return tY(e,A)};function CbA(t){return parseFloat(t.trim())}const jy=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Zy=new Set(jy),UZ=t=>t===Py||t===Qi,BbA=new Set(["x","y","z"]),cbA=jy.filter(t=>!BbA.has(t));function lbA(t){const A=[];return cbA.forEach(e=>{const i=t.getValue(e);i!==void 0&&(A.push([e,i.get()]),i.set(e.startsWith("scale")?1:0))}),A}const cd={width:({x:t},{paddingLeft:A="0",paddingRight:e="0"})=>t.max-t.min-parseFloat(A)-parseFloat(e),height:({y:t},{paddingTop:A="0",paddingBottom:e="0"})=>t.max-t.min-parseFloat(A)-parseFloat(e),top:(t,{top:A})=>parseFloat(A),left:(t,{left:A})=>parseFloat(A),bottom:({y:t},{top:A})=>parseFloat(A)+(t.max-t.min),right:({x:t},{left:A})=>parseFloat(A)+(t.max-t.min),x:(t,{transform:A})=>tY(A,"x"),y:(t,{transform:A})=>tY(A,"y")};cd.translateX=cd.x;cd.translateY=cd.y;const ld=new Set;let iY=!1,gY=!1,IY=!1;function FiA(){if(gY){const t=Array.from(ld).filter(i=>i.needsMeasurement),A=new Set(t.map(i=>i.element)),e=new Map;A.forEach(i=>{const g=lbA(i);g.length&&(e.set(i,g),i.render())}),t.forEach(i=>i.measureInitialState()),A.forEach(i=>{i.render();const g=e.get(i);g&&g.forEach(([I,n])=>{i.getValue(I)?.set(n)})}),t.forEach(i=>i.measureEndState()),t.forEach(i=>{i.suspendedScrollY!==void 0&&window.scrollTo(0,i.suspendedScrollY)})}gY=!1,iY=!1,ld.forEach(t=>t.complete(IY)),ld.clear()}function biA(){ld.forEach(t=>{t.readKeyframes(),t.needsMeasurement&&(gY=!0)})}function QbA(){IY=!0,biA(),FiA(),IY=!1}class kO{constructor(A,e,i,g,I,n=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...A],this.onComplete=e,this.name=i,this.motionValue=g,this.element=I,this.isAsync=n}scheduleResolve(){this.state="scheduled",this.isAsync?(ld.add(this),iY||(iY=!0,UI.read(biA),UI.resolveKeyframes(FiA))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:A,name:e,element:i,motionValue:g}=this;if(A[0]===null){const I=g?.get(),n=A[A.length-1];if(I!==void 0)A[0]=I;else if(i&&e){const o=i.readValue(e,n);o!=null&&(A[0]=o)}A[0]===void 0&&(A[0]=n),g&&I===void 0&&g.set(A[0])}obA(A)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(A=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,A),ld.delete(this)}cancel(){this.state==="scheduled"&&(ld.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const EbA=t=>t.startsWith("--");function ubA(t,A,e){EbA(A)?t.style.setProperty(A,e):t.style[A]=e}const hbA=lO(()=>window.ScrollTimeline!==void 0),dbA={};function pbA(t,A){const e=lO(t);return()=>dbA[A]??e()}const viA=pbA(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),cm=([t,A,e,i])=>`cubic-bezier(${t}, ${A}, ${e}, ${i})`,KZ={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:cm([0,.65,.55,1]),circOut:cm([.55,0,1,.45]),backIn:cm([.31,.01,.66,-.59]),backOut:cm([.33,1.53,.69,.99])};function _iA(t,A){if(t)return typeof t=="function"?viA()?RiA(t,A):"ease-out":fiA(t)?cm(t):Array.isArray(t)?t.map(e=>_iA(e,A)||KZ.easeOut):KZ[t]}function fbA(t,A,e,{delay:i=0,duration:g=300,repeat:I=0,repeatType:n="loop",ease:o="easeOut",times:a}={},r=void 0){const s={[A]:e};a&&(s.offset=a);const B=_iA(o,g);Array.isArray(B)&&(s.easing=B);const c={delay:i,duration:g,easing:Array.isArray(B)?"linear":B,fill:"both",iterations:I+1,direction:n==="reverse"?"alternate":"normal"};return r&&(c.pseudoElement=r),t.animate(s,c)}function JiA(t){return typeof t=="function"&&"applyToOptions"in t}function DbA({type:t,...A}){return JiA(t)&&viA()?t.applyToOptions(A):(A.duration??(A.duration=300),A.ease??(A.ease="easeOut"),A)}class ybA extends wO{constructor(A){if(super(),this.finishedTime=null,this.isStopped=!1,!A)return;const{element:e,name:i,keyframes:g,pseudoElement:I,allowFlatten:n=!1,finalKeyframe:o,onComplete:a}=A;this.isPseudoElement=!!I,this.allowFlatten=n,this.options=A,cO(typeof A.type!="string");const r=DbA(A);this.animation=fbA(e,i,g,r,I),r.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!I){const s=SO(g,this.options,o,this.speed);this.updateMotionValue?this.updateMotionValue(s):ubA(e,i,s),this.animation.cancel()}a?.(),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:A}=this;A==="idle"||A==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){this.isPseudoElement||this.animation.commitStyles?.()}get duration(){const A=this.animation.effect?.getComputedTiming?.().duration||0;return qc(Number(A))}get time(){return qc(Number(this.animation.currentTime)||0)}set time(A){this.finishedTime=null,this.animation.currentTime=Lc(A)}get speed(){return this.animation.playbackRate}set speed(A){A<0&&(this.finishedTime=null),this.animation.playbackRate=A}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(A){this.animation.startTime=A}attachTimeline({timeline:A,observe:e}){return this.allowFlatten&&this.animation.effect?.updateTiming({easing:"linear"}),this.animation.onfinish=null,A&&hbA()?(this.animation.timeline=A,rC):e(this)}}const LiA={anticipate:uiA,backInOut:EiA,circInOut:diA};function SbA(t){return t in LiA}function wbA(t){typeof t.ease=="string"&&SbA(t.ease)&&(t.ease=LiA[t.ease])}const FZ=10;class mbA extends ybA{constructor(A){wbA(A),KiA(A),super(A),A.startTime&&(this.startTime=A.startTime),this.options=A}updateMotionValue(A){const{motionValue:e,onUpdate:i,onComplete:g,element:I,...n}=this.options;if(!e)return;if(A!==void 0){e.set(A);return}const o=new mO({...n,autoplay:!1}),a=Lc(this.finishedTime??this.time);e.setWithVelocity(o.sample(a-FZ).value,o.sample(a).value,FZ),o.stop()}}const bZ=(t,A)=>A==="zIndex"?!1:!!(typeof t=="number"||Array.isArray(t)||typeof t=="string"&&(ou.test(t)||t==="0")&&!t.startsWith("url("));function kbA(t){const A=t[0];if(t.length===1)return!0;for(let e=0;e<t.length;e++)if(t[e]!==A)return!0}function MbA(t,A,e,i){const g=t[0];if(g===null)return!1;if(A==="display"||A==="visibility")return!0;const I=t[t.length-1],n=bZ(g,A),o=bZ(I,A);return!n||!o?!1:kbA(t)||(e==="spring"||JiA(e))&&i}function nY(t){t.duration=0,t.type}const NbA=new Set(["opacity","clipPath","filter","transform"]),GbA=lO(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function RbA(t){const{motionValue:A,name:e,repeatDelay:i,repeatType:g,damping:I,type:n}=t;if(!(A?.owner?.current instanceof HTMLElement))return!1;const{onUpdate:a,transformTemplate:r}=A.owner.getProps();return GbA()&&e&&NbA.has(e)&&(e!=="transform"||!r)&&!a&&!i&&g!=="mirror"&&I!==0&&n!=="inertia"}const UbA=40;class KbA extends wO{constructor({autoplay:A=!0,delay:e=0,type:i="keyframes",repeat:g=0,repeatDelay:I=0,repeatType:n="loop",keyframes:o,name:a,motionValue:r,element:s,...B}){super(),this.stop=()=>{this._animation&&(this._animation.stop(),this.stopTimeline?.()),this.keyframeResolver?.cancel()},this.createdAt=Rr.now();const c={autoplay:A,delay:e,type:i,repeat:g,repeatDelay:I,repeatType:n,name:a,motionValue:r,element:s,...B},E=s?.KeyframeResolver||kO;this.keyframeResolver=new E(o,(D,y,S)=>this.onKeyframesResolved(D,y,c,!S),a,r,s),this.keyframeResolver?.scheduleResolve()}onKeyframesResolved(A,e,i,g){this.keyframeResolver=void 0;const{name:I,type:n,velocity:o,delay:a,isHandoff:r,onUpdate:s}=i;this.resolvedAt=Rr.now(),MbA(A,I,n,o)||((dQ.instantAnimations||!a)&&s?.(SO(A,i,e)),A[0]=A[A.length-1],nY(i),i.repeat=0);const c={startTime:g?this.resolvedAt?this.resolvedAt-this.createdAt>UbA?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:e,...i,keyframes:A},E=!r&&RbA(c)?new mbA({...c,element:c.motionValue.owner.current}):new mO(c);E.finished.then(()=>this.notifyFinished()).catch(rC),this.pendingTimeline&&(this.stopTimeline=E.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=E}get finished(){return this._animation?this.animation.finished:this._finished}then(A,e){return this.finished.finally(A).then(()=>{})}get animation(){return this._animation||(this.keyframeResolver?.resume(),QbA()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(A){this.animation.time=A}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(A){this.animation.speed=A}get startTime(){return this.animation.startTime}attachTimeline(A){return this._animation?this.stopTimeline=this.animation.attachTimeline(A):this.pendingTimeline=A,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){this._animation&&this.animation.cancel(),this.keyframeResolver?.cancel()}}const FbA=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function bbA(t){const A=FbA.exec(t);if(!A)return[,];const[,e,i,g]=A;return[`--${e??i}`,g]}function qiA(t,A,e=1){const[i,g]=bbA(t);if(!i)return;const I=window.getComputedStyle(A).getPropertyValue(i);if(I){const n=I.trim();return aiA(n)?parseFloat(n):n}return dO(g)?qiA(g,A,e+1):g}function MO(t,A){return t?.[A]??t?.default??t}const xiA=new Set(["width","height","top","left","right","bottom",...jy]),vbA={test:t=>t==="auto",parse:t=>t},TiA=t=>A=>A.test(t),YiA=[Py,Qi,xc,yE,kFA,mFA,vbA],vZ=t=>YiA.find(TiA(t));function _bA(t){return typeof t=="number"?t===0:t!==null?t==="none"||t==="0"||siA(t):!0}const JbA=new Set(["brightness","contrast","saturate","opacity"]);function LbA(t){const[A,e]=t.slice(0,-1).split("(");if(A==="drop-shadow")return t;const[i]=e.match(pO)||[];if(!i)return t;const g=e.replace(i,"");let I=JbA.has(A)?1:0;return i!==e&&(I*=100),A+"("+I+g+")"}const qbA=/\b([a-z-]*)\(.*?\)/gu,oY={...ou,getAnimatableNone:t=>{const A=t.match(qbA);return A?A.map(LbA).join(" "):t}},_Z={...Py,transform:Math.round},xbA={rotate:yE,rotateX:yE,rotateY:yE,rotateZ:yE,scale:TN,scaleX:TN,scaleY:TN,scaleZ:TN,skew:yE,skewX:yE,skewY:yE,distance:Qi,translateX:Qi,translateY:Qi,translateZ:Qi,x:Qi,y:Qi,z:Qi,perspective:Qi,transformPerspective:Qi,opacity:M0,originX:SZ,originY:SZ,originZ:Qi},NO={borderWidth:Qi,borderTopWidth:Qi,borderRightWidth:Qi,borderBottomWidth:Qi,borderLeftWidth:Qi,borderRadius:Qi,radius:Qi,borderTopLeftRadius:Qi,borderTopRightRadius:Qi,borderBottomRightRadius:Qi,borderBottomLeftRadius:Qi,width:Qi,maxWidth:Qi,height:Qi,maxHeight:Qi,top:Qi,right:Qi,bottom:Qi,left:Qi,padding:Qi,paddingTop:Qi,paddingRight:Qi,paddingBottom:Qi,paddingLeft:Qi,margin:Qi,marginTop:Qi,marginRight:Qi,marginBottom:Qi,marginLeft:Qi,backgroundPositionX:Qi,backgroundPositionY:Qi,...xbA,zIndex:_Z,fillOpacity:M0,strokeOpacity:M0,numOctaves:_Z},TbA={...NO,color:kn,backgroundColor:kn,outlineColor:kn,fill:kn,stroke:kn,borderColor:kn,borderTopColor:kn,borderRightColor:kn,borderBottomColor:kn,borderLeftColor:kn,filter:oY,WebkitFilter:oY},HiA=t=>TbA[t];function OiA(t,A){let e=HiA(t);return e!==oY&&(e=ou),e.getAnimatableNone?e.getAnimatableNone(A):void 0}const YbA=new Set(["auto","none","0"]);function HbA(t,A,e){let i=0,g;for(;i<t.length&&!g;){const I=t[i];typeof I=="string"&&!YbA.has(I)&&N0(I).values.length&&(g=t[i]),i++}if(g&&e)for(const I of A)t[I]=OiA(e,g)}class ObA extends kO{constructor(A,e,i,g,I){super(A,e,i,g,I,!0)}readKeyframes(){const{unresolvedKeyframes:A,element:e,name:i}=this;if(!e||!e.current)return;super.readKeyframes();for(let a=0;a<A.length;a++){let r=A[a];if(typeof r=="string"&&(r=r.trim(),dO(r))){const s=qiA(r,e.current);s!==void 0&&(A[a]=s),a===A.length-1&&(this.finalKeyframe=r)}}if(this.resolveNoneKeyframes(),!xiA.has(i)||A.length!==2)return;const[g,I]=A,n=vZ(g),o=vZ(I);if(n!==o)if(UZ(n)&&UZ(o))for(let a=0;a<A.length;a++){const r=A[a];typeof r=="string"&&(A[a]=parseFloat(r))}else cd[i]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:A,name:e}=this,i=[];for(let g=0;g<A.length;g++)(A[g]===null||_bA(A[g]))&&i.push(g);i.length&&HbA(A,i,e)}measureInitialState(){const{element:A,unresolvedKeyframes:e,name:i}=this;if(!A||!A.current)return;i==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=cd[i](A.measureViewportBox(),window.getComputedStyle(A.current)),e[0]=this.measuredOrigin;const g=e[e.length-1];g!==void 0&&A.getValue(i,g).jump(g,!1)}measureEndState(){const{element:A,name:e,unresolvedKeyframes:i}=this;if(!A||!A.current)return;const g=A.getValue(e);g&&g.jump(this.measuredOrigin,!1);const I=i.length-1,n=i[I];i[I]=cd[e](A.measureViewportBox(),window.getComputedStyle(A.current)),n!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=n),this.removedTransforms?.length&&this.removedTransforms.forEach(([o,a])=>{A.getValue(o).set(a)}),this.resolveNoneKeyframes()}}function PbA(t,A,e){if(t instanceof EventTarget)return[t];if(typeof t=="string"){let i=document;const g=e?.[t]??i.querySelectorAll(t);return g?Array.from(g):[]}return Array.from(t)}const PiA=(t,A)=>A&&typeof t=="number"?A.transform(t):t;function jbA(t){return riA(t)&&"offsetHeight"in t}const JZ=30,ZbA=t=>!isNaN(parseFloat(t));class WbA{constructor(A,e={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=i=>{const g=Rr.now();if(this.updatedAt!==g&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(i),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(A),this.owner=e.owner}setCurrent(A){this.current=A,this.updatedAt=Rr.now(),this.canTrackVelocity===null&&A!==void 0&&(this.canTrackVelocity=ZbA(this.current))}setPrevFrameValue(A=this.current){this.prevFrameValue=A,this.prevUpdatedAt=this.updatedAt}onChange(A){return this.on("change",A)}on(A,e){this.events[A]||(this.events[A]=new QO);const i=this.events[A].add(e);return A==="change"?()=>{i(),UI.read(()=>{this.events.change.getSize()||this.stop()})}:i}clearListeners(){for(const A in this.events)this.events[A].clear()}attach(A,e){this.passiveEffect=A,this.stopPassiveEffect=e}set(A){this.passiveEffect?this.passiveEffect(A,this.updateAndNotify):this.updateAndNotify(A)}setWithVelocity(A,e,i){this.set(e),this.prev=void 0,this.prevFrameValue=A,this.prevUpdatedAt=this.updatedAt-i}jump(A,e=!0){this.updateAndNotify(A),this.prev=A,this.prevUpdatedAt=this.prevFrameValue=void 0,e&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){this.events.change?.notify(this.current)}addDependent(A){this.dependents||(this.dependents=new Set),this.dependents.add(A)}removeDependent(A){this.dependents&&this.dependents.delete(A)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const A=Rr.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||A-this.updatedAt>JZ)return 0;const e=Math.min(this.updatedAt-this.prevUpdatedAt,JZ);return CiA(parseFloat(this.current)-parseFloat(this.prevFrameValue),e)}start(A){return this.stop(),new Promise(e=>{this.hasAnimated=!0,this.animation=A(e),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 Iy(t,A){return new WbA(t,A)}const{schedule:GO}=DiA(queueMicrotask,!1),AB={x:!1,y:!1};function jiA(){return AB.x||AB.y}function zbA(t){return t==="x"||t==="y"?AB[t]?null:(AB[t]=!0,()=>{AB[t]=!1}):AB.x||AB.y?null:(AB.x=AB.y=!0,()=>{AB.x=AB.y=!1})}function ZiA(t,A){const e=PbA(t),i=new AbortController,g={passive:!0,...A,signal:i.signal};return[e,g,()=>i.abort()]}function LZ(t){return!(t.pointerType==="touch"||jiA())}function VbA(t,A,e={}){const[i,g,I]=ZiA(t,e),n=o=>{if(!LZ(o))return;const{target:a}=o,r=A(a,o);if(typeof r!="function"||!a)return;const s=B=>{LZ(B)&&(r(B),a.removeEventListener("pointerleave",s))};a.addEventListener("pointerleave",s,g)};return i.forEach(o=>{o.addEventListener("pointerenter",n,g)}),I}const WiA=(t,A)=>A?t===A?!0:WiA(t,A.parentElement):!1,RO=t=>t.pointerType==="mouse"?typeof t.button!="number"||t.button<=0:t.isPrimary!==!1,XbA=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function $bA(t){return XbA.has(t.tagName)||t.tabIndex!==-1}const bR=new WeakSet;function qZ(t){return A=>{A.key==="Enter"&&t(A)}}function CL(t,A){t.dispatchEvent(new PointerEvent("pointer"+A,{isPrimary:!0,bubbles:!0}))}const AvA=(t,A)=>{const e=t.currentTarget;if(!e)return;const i=qZ(()=>{if(bR.has(e))return;CL(e,"down");const g=qZ(()=>{CL(e,"up")}),I=()=>CL(e,"cancel");e.addEventListener("keyup",g,A),e.addEventListener("blur",I,A)});e.addEventListener("keydown",i,A),e.addEventListener("blur",()=>e.removeEventListener("keydown",i),A)};function xZ(t){return RO(t)&&!jiA()}function evA(t,A,e={}){const[i,g,I]=ZiA(t,e),n=o=>{const a=o.currentTarget;if(!xZ(o))return;bR.add(a);const r=A(a,o),s=(E,D)=>{window.removeEventListener("pointerup",B),window.removeEventListener("pointercancel",c),bR.has(a)&&bR.delete(a),xZ(E)&&typeof r=="function"&&r(E,{success:D})},B=E=>{s(E,a===window||a===document||e.useGlobalTarget||WiA(a,E.target))},c=E=>{s(E,!1)};window.addEventListener("pointerup",B,g),window.addEventListener("pointercancel",c,g)};return i.forEach(o=>{(e.useGlobalTarget?window:o).addEventListener("pointerdown",n,g),jbA(o)&&(o.addEventListener("focus",r=>AvA(r,g)),!$bA(o)&&!o.hasAttribute("tabindex")&&(o.tabIndex=0))}),I}function ziA(t){return riA(t)&&"ownerSVGElement"in t}function tvA(t){return ziA(t)&&t.tagName==="svg"}const ha=t=>!!(t&&t.getVelocity),ivA=[...YiA,kn,ou],gvA=t=>ivA.find(TiA(t)),ViA=p.createContext({transformPagePoint:t=>t,isStatic:!1,reducedMotion:"never"});function IvA(t=!0){const A=p.useContext(sO);if(A===null)return[!0,null];const{isPresent:e,onExitComplete:i,register:g}=A,I=p.useId();p.useEffect(()=>{if(t)return g(I)},[t]);const n=p.useCallback(()=>t&&i&&i(I),[I,i,t]);return!e&&i?[!1,n]:[!0]}const XiA=p.createContext({strict:!1}),TZ={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"]},ny={};for(const t in TZ)ny[t]={isEnabled:A=>TZ[t].some(e=>!!A[e])};function nvA(t){for(const A in t)ny[A]={...ny[A],...t[A]}}const ovA=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 zU(t){return t.startsWith("while")||t.startsWith("drag")&&t!=="draggable"||t.startsWith("layout")||t.startsWith("onTap")||t.startsWith("onPan")||t.startsWith("onLayout")||ovA.has(t)}let $iA=t=>!zU(t);function avA(t){typeof t=="function"&&($iA=A=>A.startsWith("on")?!zU(A):t(A))}try{avA(require("@emotion/is-prop-valid").default)}catch{}function rvA(t,A,e){const i={};for(const g in t)g==="values"&&typeof t.values=="object"||($iA(g)||e===!0&&zU(g)||!A&&!zU(g)||t.draggable&&g.startsWith("onDrag"))&&(i[g]=t[g]);return i}const ob=p.createContext({});function ab(t){return t!==null&&typeof t=="object"&&typeof t.start=="function"}function G0(t){return typeof t=="string"||Array.isArray(t)}const UO=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],KO=["initial",...UO];function rb(t){return ab(t.animate)||KO.some(A=>G0(t[A]))}function AgA(t){return!!(rb(t)||t.variants)}function svA(t,A){if(rb(t)){const{initial:e,animate:i}=t;return{initial:e===!1||G0(e)?e:void 0,animate:G0(i)?i:void 0}}return t.inherit!==!1?A:{}}function CvA(t){const{initial:A,animate:e}=svA(t,p.useContext(ob));return p.useMemo(()=>({initial:A,animate:e}),[YZ(A),YZ(e)])}function YZ(t){return Array.isArray(t)?t.join(" "):t}const R0={};function BvA(t){for(const A in t)R0[A]=t[A],hO(A)&&(R0[A].isCSSVariable=!0)}function egA(t,{layout:A,layoutId:e}){return Zy.has(t)||t.startsWith("origin")||(A||e!==void 0)&&(!!R0[t]||t==="opacity")}const cvA={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},lvA=jy.length;function QvA(t,A,e){let i="",g=!0;for(let I=0;I<lvA;I++){const n=jy[I],o=t[n];if(o===void 0)continue;let a=!0;if(typeof o=="number"?a=o===(n.startsWith("scale")?1:0):a=parseFloat(o)===0,!a||e){const r=PiA(o,NO[n]);if(!a){g=!1;const s=cvA[n]||n;i+=`${s}(${r}) `}e&&(A[n]=r)}}return i=i.trim(),e?i=e(A,g?"":i):g&&(i="none"),i}function FO(t,A,e){const{style:i,vars:g,transformOrigin:I}=t;let n=!1,o=!1;for(const a in A){const r=A[a];if(Zy.has(a)){n=!0;continue}else if(hO(a)){g[a]=r;continue}else{const s=PiA(r,NO[a]);a.startsWith("origin")?(o=!0,I[a]=s):i[a]=s}}if(A.transform||(n||e?i.transform=QvA(A,t.transform,e):i.transform&&(i.transform="none")),o){const{originX:a="50%",originY:r="50%",originZ:s=0}=I;i.transformOrigin=`${a} ${r} ${s}`}}const bO=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function tgA(t,A,e){for(const i in A)!ha(A[i])&&!egA(i,e)&&(t[i]=A[i])}function EvA({transformTemplate:t},A){return p.useMemo(()=>{const e=bO();return FO(e,A,t),Object.assign({},e.vars,e.style)},[A])}function uvA(t,A){const e=t.style||{},i={};return tgA(i,e,t),Object.assign(i,EvA(t,A)),i}function hvA(t,A){const e={},i=uvA(t,A);return t.drag&&t.dragListener!==!1&&(e.draggable=!1,i.userSelect=i.WebkitUserSelect=i.WebkitTouchCallout="none",i.touchAction=t.drag===!0?"none":`pan-${t.drag==="x"?"y":"x"}`),t.tabIndex===void 0&&(t.onTap||t.onTapStart||t.whileTap)&&(e.tabIndex=0),e.style=i,e}const dvA={offset:"stroke-dashoffset",array:"stroke-dasharray"},pvA={offset:"strokeDashoffset",array:"strokeDasharray"};function fvA(t,A,e=1,i=0,g=!0){t.pathLength=1;const I=g?dvA:pvA;t[I.offset]=Qi.transform(-i);const n=Qi.transform(A),o=Qi.transform(e);t[I.array]=`${n} ${o}`}function igA(t,{attrX:A,attrY:e,attrScale:i,pathLength:g,pathSpacing:I=1,pathOffset:n=0,...o},a,r,s){if(FO(t,o,r),a){t.style.viewBox&&(t.attrs.viewBox=t.style.viewBox);return}t.attrs=t.style,t.style={};const{attrs:B,style:c}=t;B.transform&&(c.transform=B.transform,delete B.transform),(c.transform||B.transformOrigin)&&(c.transformOrigin=B.transformOrigin??"50% 50%",delete B.transformOrigin),c.transform&&(c.transformBox=s?.transformBox??"fill-box",delete B.transformBox),A!==void 0&&(B.x=A),e!==void 0&&(B.y=e),i!==void 0&&(B.scale=i),g!==void 0&&fvA(B,g,I,n,!1)}const ggA=()=>({...bO(),attrs:{}}),IgA=t=>typeof t=="string"&&t.toLowerCase()==="svg";function DvA(t,A,e,i){const g=p.useMemo(()=>{const I=ggA();return igA(I,A,IgA(i),t.transformTemplate,t.style),{...I.attrs,style:{...I.style}}},[A]);if(t.style){const I={};tgA(I,t.style,t),g.style={...I,...g.style}}return g}const yvA=["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 vO(t){return typeof t!="string"||t.includes("-")?!1:!!(yvA.indexOf(t)>-1||/[A-Z]/u.test(t))}function SvA(t,A,e,{latestValues:i},g,I=!1){const o=(vO(t)?DvA:hvA)(A,i,g,t),a=rvA(A,typeof t=="string",I),r=t!==p.Fragment?{...a,...o,ref:e}:{},{children:s}=A,B=p.useMemo(()=>ha(s)?s.get():s,[s]);return p.createElement(t,{...r,children:B})}function HZ(t){const A=[{},{}];return t?.values.forEach((e,i)=>{A[0][i]=e.get(),A[1][i]=e.getVelocity()}),A}function _O(t,A,e,i){if(typeof A=="function"){const[g,I]=HZ(i);A=A(e!==void 0?e:t.custom,g,I)}if(typeof A=="string"&&(A=t.variants&&t.variants[A]),typeof A=="function"){const[g,I]=HZ(i);A=A(e!==void 0?e:t.custom,g,I)}return A}function vR(t){return ha(t)?t.get():t}function wvA({scrapeMotionValuesFromProps:t,createRenderState:A},e,i,g){return{latestValues:mvA(e,i,g,t),renderState:A()}}function mvA(t,A,e,i){const g={},I=i(t,{});for(const c in I)g[c]=vR(I[c]);let{initial:n,animate:o}=t;const a=rb(t),r=AgA(t);A&&r&&!a&&t.inherit!==!1&&(n===void 0&&(n=A.initial),o===void 0&&(o=A.animate));let s=e?e.initial===!1:!1;s=s||n===!1;const B=s?o:n;if(B&&typeof B!="boolean"&&!ab(B)){const c=Array.isArray(B)?B:[B];for(let E=0;E<c.length;E++){const D=_O(t,c[E]);if(D){const{transitionEnd:y,transition:S,...f}=D;for(const M in f){let k=f[M];if(Array.isArray(k)){const m=s?k.length-1:0;k=k[m]}k!==null&&(g[M]=k)}for(const M in y)g[M]=y[M]}}}return g}const ngA=t=>(A,e)=>{const i=p.useContext(ob),g=p.useContext(sO),I=()=>wvA(t,A,i,g);return e?I():nFA(I)};function JO(t,A,e){const{style:i}=t,g={};for(const I in i)(ha(i[I])||A.style&&ha(A.style[I])||egA(I,t)||e?.getValue(I)?.liveStyle!==void 0)&&(g[I]=i[I]);return g}const kvA=ngA({scrapeMotionValuesFromProps:JO,createRenderState:bO});function ogA(t,A,e){const i=JO(t,A,e);for(const g in t)if(ha(t[g])||ha(A[g])){const I=jy.indexOf(g)!==-1?"attr"+g.charAt(0).toUpperCase()+g.substring(1):g;i[I]=t[g]}return i}const MvA=ngA({scrapeMotionValuesFromProps:ogA,createRenderState:ggA}),NvA=Symbol.for("motionComponentSymbol");function CD(t){return t&&typeof t=="object"&&Object.prototype.hasOwnProperty.call(t,"current")}function GvA(t,A,e){return p.useCallback(i=>{i&&t.onMount&&t.onMount(i),A&&(i?A.mount(i):A.unmount()),e&&(typeof e=="function"?e(i):CD(e)&&(e.current=i))},[A])}const LO=t=>t.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),RvA="framerAppearId",agA="data-"+LO(RvA),rgA=p.createContext({});function UvA(t,A,e,i,g){const{visualElement:I}=p.useContext(ob),n=p.useContext(XiA),o=p.useContext(sO),a=p.useContext(ViA).reducedMotion,r=p.useRef(null);i=i||n.renderer,!r.current&&i&&(r.current=i(t,{visualState:A,parent:I,props:e,presenceContext:o,blockInitialAnimation:o?o.initial===!1:!1,reducedMotionConfig:a}));const s=r.current,B=p.useContext(rgA);s&&!s.projection&&g&&(s.type==="html"||s.type==="svg")&&KvA(r.current,e,g,B);const c=p.useRef(!1);p.useInsertionEffect(()=>{s&&c.current&&s.update(e,o)});const E=e[agA],D=p.useRef(!!E&&!window.MotionHandoffIsComplete?.(E)&&window.MotionHasOptimisedAnimation?.(E));return oFA(()=>{s&&(c.current=!0,window.MotionIsMounted=!0,s.updateFeatures(),s.scheduleRenderMicrotask(),D.current&&s.animationState&&s.animationState.animateChanges())}),p.useEffect(()=>{s&&(!D.current&&s.animationState&&s.animationState.animateChanges(),D.current&&(queueMicrotask(()=>{window.MotionHandoffMarkAsComplete?.(E)}),D.current=!1),s.enteringChildren=void 0)}),s}function KvA(t,A,e,i){const{layoutId:g,layout:I,drag:n,dragConstraints:o,layoutScroll:a,layoutRoot:r,layoutCrossfade:s}=A;t.projection=new e(t.latestValues,A["data-framer-portal-id"]?void 0:sgA(t.parent)),t.projection.setOptions({layoutId:g,layout:I,alwaysMeasureLayout:!!n||o&&CD(o),visualElement:t,animationType:typeof I=="string"?I:"both",initialPromotionConfig:i,crossfade:s,layoutScroll:a,layoutRoot:r})}function sgA(t){if(t)return t.options.allowProjection!==!1?t.projection:sgA(t.parent)}function BL(t,{forwardMotionProps:A=!1}={},e,i){e&&nvA(e);const g=vO(t)?MvA:kvA;function I(o,a){let r;const s={...p.useContext(ViA),...o,layoutId:FvA(o)},{isStatic:B}=s,c=CvA(o),E=g(o,B);if(!B&&rO){bvA();const D=vvA(s);r=D.MeasureLayout,c.visualElement=UvA(t,E,s,i,D.ProjectionNode)}return Q.jsxs(ob.Provider,{value:c,children:[r&&c.visualElement?Q.jsx(r,{visualElement:c.visualElement,...s}):null,SvA(t,o,GvA(E,c.visualElement,a),E,B,A)]})}I.displayName=`motion.${typeof t=="string"?t:`create(${t.displayName??t.name??""})`}`;const n=p.forwardRef(I);return n[NvA]=t,n}function FvA({layoutId:t}){const A=p.useContext(oiA).id;return A&&t!==void 0?A+"-"+t:t}function bvA(t,A){p.useContext(XiA).strict}function vvA(t){const{drag:A,layout:e}=ny;if(!A&&!e)return{};const i={...A,...e};return{MeasureLayout:A?.isEnabled(t)||e?.isEnabled(t)?i.MeasureLayout:void 0,ProjectionNode:i.ProjectionNode}}function _vA(t,A){if(typeof Proxy>"u")return BL;const e=new Map,i=(I,n)=>BL(I,n,t,A),g=(I,n)=>i(I,n);return new Proxy(g,{get:(I,n)=>n==="create"?i:(e.has(n)||e.set(n,BL(n,void 0,t,A)),e.get(n))})}function CgA({top:t,left:A,right:e,bottom:i}){return{x:{min:A,max:e},y:{min:t,max:i}}}function JvA({x:t,y:A}){return{top:A.min,right:t.max,bottom:A.max,left:t.min}}function LvA(t,A){if(!A)return t;const e=A({x:t.left,y:t.top}),i=A({x:t.right,y:t.bottom});return{top:e.y,left:e.x,bottom:i.y,right:i.x}}function cL(t){return t===void 0||t===1}function aY({scale:t,scaleX:A,scaleY:e}){return!cL(t)||!cL(A)||!cL(e)}function xh(t){return aY(t)||BgA(t)||t.z||t.rotate||t.rotateX||t.rotateY||t.skewX||t.skewY}function BgA(t){return OZ(t.x)||OZ(t.y)}function OZ(t){return t&&t!=="0%"}function VU(t,A,e){const i=t-e,g=A*i;return e+g}function PZ(t,A,e,i,g){return g!==void 0&&(t=VU(t,g,i)),VU(t,e,i)+A}function rY(t,A=0,e=1,i,g){t.min=PZ(t.min,A,e,i,g),t.max=PZ(t.max,A,e,i,g)}function cgA(t,{x:A,y:e}){rY(t.x,A.translate,A.scale,A.originPoint),rY(t.y,e.translate,e.scale,e.originPoint)}const jZ=.999999999999,ZZ=1.0000000000001;function qvA(t,A,e,i=!1){const g=e.length;if(!g)return;A.x=A.y=1;let I,n;for(let o=0;o<g;o++){I=e[o],n=I.projectionDelta;const{visualElement:a}=I.options;a&&a.props.style&&a.props.style.display==="contents"||(i&&I.options.layoutScroll&&I.scroll&&I!==I.root&&cD(t,{x:-I.scroll.offset.x,y:-I.scroll.offset.y}),n&&(A.x*=n.x.scale,A.y*=n.y.scale,cgA(t,n)),i&&xh(I.latestValues)&&cD(t,I.latestValues))}A.x<ZZ&&A.x>jZ&&(A.x=1),A.y<ZZ&&A.y>jZ&&(A.y=1)}function BD(t,A){t.min=t.min+A,t.max=t.max+A}function WZ(t,A,e,i,g=.5){const I=TI(t.min,t.max,g);rY(t,A,e,I,i)}function cD(t,A){WZ(t.x,A.x,A.scaleX,A.scale,A.originX),WZ(t.y,A.y,A.scaleY,A.scale,A.originY)}function lgA(t,A){return CgA(LvA(t.getBoundingClientRect(),A))}function xvA(t,A,e){const i=lgA(t,e),{scroll:g}=A;return g&&(BD(i.x,g.offset.x),BD(i.y,g.offset.y)),i}const zZ=()=>({translate:0,scale:1,origin:0,originPoint:0}),lD=()=>({x:zZ(),y:zZ()}),VZ=()=>({min:0,max:0}),an=()=>({x:VZ(),y:VZ()}),XU={current:null},qO={current:!1};function QgA(){if(qO.current=!0,!!rO)if(window.matchMedia){const t=window.matchMedia("(prefers-reduced-motion)"),A=()=>XU.current=t.matches;t.addEventListener("change",A),A()}else XU.current=!1}const TvA=new WeakMap;function YvA(t,A,e){for(const i in A){const g=A[i],I=e[i];if(ha(g))t.addValue(i,g);else if(ha(I))t.addValue(i,Iy(g,{owner:t}));else if(I!==g)if(t.hasValue(i)){const n=t.getValue(i);n.liveStyle===!0?n.jump(g):n.hasAnimated||n.set(g)}else{const n=t.getStaticValue(i);t.addValue(i,Iy(n!==void 0?n:g,{owner:t}))}}for(const i in e)A[i]===void 0&&t.removeValue(i);return A}const XZ=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class HvA{scrapeMotionValuesFromProps(A,e,i){return{}}constructor({parent:A,props:e,presenceContext:i,reducedMotionConfig:g,blockInitialAnimation:I,visualState:n},o={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=kO,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 c=Rr.now();this.renderScheduledAt<c&&(this.renderScheduledAt=c,UI.render(this.render,!1,!0))};const{latestValues:a,renderState:r}=n;this.latestValues=a,this.baseTarget={...a},this.initialValues=e.initial?{...a}:{},this.renderState=r,this.parent=A,this.props=e,this.presenceContext=i,this.depth=A?A.depth+1:0,this.reducedMotionConfig=g,this.options=o,this.blockInitialAnimation=!!I,this.isControllingVariants=rb(e),this.isVariantNode=AgA(e),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(A&&A.current);const{willChange:s,...B}=this.scrapeMotionValuesFromProps(e,{},this);for(const c in B){const E=B[c];a[c]!==void 0&&ha(E)&&E.set(a[c])}}mount(A){this.current=A,TvA.set(A,this),this.projection&&!this.projection.instance&&this.projection.mount(A),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((e,i)=>this.bindToMotionValue(i,e)),qO.current||QgA(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:XU.current,this.parent?.addChild(this),this.update(this.props,this.presenceContext)}unmount(){this.projection&&this.projection.unmount(),nu(this.notifyUpdate),nu(this.render),this.valueSubscriptions.forEach(A=>A()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),this.parent?.removeChild(this);for(const A in this.events)this.events[A].clear();for(const A in this.features){const e=this.features[A];e&&(e.unmount(),e.isMounted=!1)}this.current=null}addChild(A){this.children.add(A),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(A)}removeChild(A){this.children.delete(A),this.enteringChildren&&this.enteringChildren.delete(A)}bindToMotionValue(A,e){this.valueSubscriptions.has(A)&&this.valueSubscriptions.get(A)();const i=Zy.has(A);i&&this.onBindTransform&&this.onBindTransform();const g=e.on("change",n=>{this.latestValues[A]=n,this.props.onUpdate&&UI.preRender(this.notifyUpdate),i&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let I;window.MotionCheckAppearSync&&(I=window.MotionCheckAppearSync(this,A,e)),this.valueSubscriptions.set(A,()=>{g(),I&&I(),e.owner&&e.stop()})}sortNodePosition(A){return!this.current||!this.sortInstanceNodePosition||this.type!==A.type?0:this.sortInstanceNodePosition(this.current,A.current)}updateFeatures(){let A="animation";for(A in ny){const e=ny[A];if(!e)continue;const{isEnabled:i,Feature:g}=e;if(!this.features[A]&&g&&i(this.props)&&(this.features[A]=new g(this)),this.features[A]){const I=this.features[A];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):an()}getStaticValue(A){return this.latestValues[A]}setStaticValue(A,e){this.latestValues[A]=e}update(A,e){(A.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=A,this.prevPresenceContext=this.presenceContext,this.presenceContext=e;for(let i=0;i<XZ.length;i++){const g=XZ[i];this.propEventSubscriptions[g]&&(this.propEventSubscriptions[g](),delete this.propEventSubscriptions[g]);const I="on"+g,n=A[I];n&&(this.propEventSubscriptions[g]=this.on(g,n))}this.prevMotionValues=YvA(this,this.scrapeMotionValuesFromProps(A,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(A){return this.props.variants?this.props.variants[A]: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(A){const e=this.getClosestVariantNode();if(e)return e.variantChildren&&e.variantChildren.add(A),()=>e.variantChildren.delete(A)}addValue(A,e){const i=this.values.get(A);e!==i&&(i&&this.removeValue(A),this.bindToMotionValue(A,e),this.values.set(A,e),this.latestValues[A]=e.get())}removeValue(A){this.values.delete(A);const e=this.valueSubscriptions.get(A);e&&(e(),this.valueSubscriptions.delete(A)),delete this.latestValues[A],this.removeValueFromRenderState(A,this.renderState)}hasValue(A){return this.values.has(A)}getValue(A,e){if(this.props.values&&this.props.values[A])return this.props.values[A];let i=this.values.get(A);return i===void 0&&e!==void 0&&(i=Iy(e===null?void 0:e,{owner:this}),this.addValue(A,i)),i}readValue(A,e){let i=this.latestValues[A]!==void 0||!this.current?this.latestValues[A]:this.getBaseTargetFromProps(this.props,A)??this.readValueFromInstance(this.current,A,this.options);return i!=null&&(typeof i=="string"&&(aiA(i)||siA(i))?i=parseFloat(i):!gvA(i)&&ou.test(e)&&(i=OiA(A,e)),this.setBaseTarget(A,ha(i)?i.get():i)),ha(i)?i.get():i}setBaseTarget(A,e){this.baseTarget[A]=e}getBaseTarget(A){const{initial:e}=this.props;let i;if(typeof e=="string"||typeof e=="object"){const I=_O(this.props,e,this.presenceContext?.custom);I&&(i=I[A])}if(e&&i!==void 0)return i;const g=this.getBaseTargetFromProps(this.props,A);return g!==void 0&&!ha(g)?g:this.initialValues[A]!==void 0&&i===void 0?void 0:this.baseTarget[A]}on(A,e){return this.events[A]||(this.events[A]=new QO),this.events[A].add(e)}notify(A,...e){this.events[A]&&this.events[A].notify(...e)}scheduleRenderMicrotask(){GO.render(this.render)}}class EgA extends HvA{constructor(){super(...arguments),this.KeyframeResolver=ObA}sortInstanceNodePosition(A,e){return A.compareDocumentPosition(e)&2?1:-1}getBaseTargetFromProps(A,e){return A.style?A.style[e]:void 0}removeValueFromRenderState(A,{vars:e,style:i}){delete e[A],delete i[A]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:A}=this.props;ha(A)&&(this.childSubscription=A.on("change",e=>{this.current&&(this.current.textContent=`${e}`)}))}}function ugA(t,{style:A,vars:e},i,g){const I=t.style;let n;for(n in A)I[n]=A[n];g?.applyProjectionStyles(I,i);for(n in e)I.setProperty(n,e[n])}function OvA(t){return window.getComputedStyle(t)}class PvA extends EgA{constructor(){super(...arguments),this.type="html",this.renderInstance=ugA}readValueFromInstance(A,e){if(Zy.has(e))return this.projection?.isProjecting?eY(e):sbA(A,e);{const i=OvA(A),g=(hO(e)?i.getPropertyValue(e):i[e])||0;return typeof g=="string"?g.trim():g}}measureInstanceViewportBox(A,{transformPagePoint:e}){return lgA(A,e)}build(A,e,i){FO(A,e,i.transformTemplate)}scrapeMotionValuesFromProps(A,e,i){return JO(A,e,i)}}const hgA=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 jvA(t,A,e,i){ugA(t,A,void 0,i);for(const g in A.attrs)t.setAttribute(hgA.has(g)?g:LO(g),A.attrs[g])}class ZvA extends EgA{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=an}getBaseTargetFromProps(A,e){return A[e]}readValueFromInstance(A,e){if(Zy.has(e)){const i=HiA(e);return i&&i.default||0}return e=hgA.has(e)?e:LO(e),A.getAttribute(e)}scrapeMotionValuesFromProps(A,e,i){return ogA(A,e,i)}build(A,e,i){igA(A,e,this.isSVGTag,i.transformTemplate,i.style)}renderInstance(A,e,i,g){jvA(A,e,i,g)}mount(A){this.isSVGTag=IgA(A.tagName),super.mount(A)}}const WvA=(t,A)=>vO(t)?new ZvA(A):new PvA(A,{allowProjection:t!==p.Fragment});function bD(t,A,e){const i=t.getProps();return _O(i,A,e!==void 0?e:i.custom,t)}const sY=t=>Array.isArray(t);function zvA(t,A,e){t.hasValue(A)?t.getValue(A).set(e):t.addValue(A,Iy(e))}function VvA(t){return sY(t)?t[t.length-1]||0:t}function XvA(t,A){const e=bD(t,A);let{transitionEnd:i={},transition:g={},...I}=e||{};I={...I,...i};for(const n in I){const o=VvA(I[n]);zvA(t,n,o)}}function $vA(t){return!!(ha(t)&&t.add)}function CY(t,A){const e=t.getValue("willChange");if($vA(e))return e.add(A);if(!e&&dQ.WillChange){const i=new dQ.WillChange("auto");t.addValue("willChange",i),i.add(A)}}function dgA(t){return t.props[agA]}const A_A=t=>t!==null;function e_A(t,{repeat:A,repeatType:e="loop"},i){const g=t.filter(A_A),I=A&&e!=="loop"&&A%2===1?0:g.length-1;return g[I]}const t_A={type:"spring",stiffness:500,damping:25,restSpeed:10},i_A=t=>({type:"spring",stiffness:550,damping:t===0?2*Math.sqrt(550):30,restSpeed:10}),g_A={type:"keyframes",duration:.8},I_A={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},n_A=(t,{keyframes:A})=>A.length>2?g_A:Zy.has(t)?t.startsWith("scale")?i_A(A[1]):t_A:I_A;function o_A({when:t,delay:A,delayChildren:e,staggerChildren:i,staggerDirection:g,repeat:I,repeatType:n,repeatDelay:o,from:a,elapsed:r,...s}){return!!Object.keys(s).length}const xO=(t,A,e,i={},g,I)=>n=>{const o=MO(i,t)||{},a=o.delay||i.delay||0;let{elapsed:r=0}=i;r=r-Lc(a);const s={keyframes:Array.isArray(e)?e:[null,e],ease:"easeOut",velocity:A.getVelocity(),...o,delay:-r,onUpdate:c=>{A.set(c),o.onUpdate&&o.onUpdate(c)},onComplete:()=>{n(),o.onComplete&&o.onComplete()},name:t,motionValue:A,element:I?void 0:g};o_A(o)||Object.assign(s,n_A(t,s)),s.duration&&(s.duration=Lc(s.duration)),s.repeatDelay&&(s.repeatDelay=Lc(s.repeatDelay)),s.from!==void 0&&(s.keyframes[0]=s.from);let B=!1;if((s.type===!1||s.duration===0&&!s.repeatDelay)&&(nY(s),s.delay===0&&(B=!0)),(dQ.instantAnimations||dQ.skipAnimations)&&(B=!0,nY(s),s.delay=0),s.allowFlatten=!o.type&&!o.ease,B&&!I&&A.get()!==void 0){const c=e_A(s.keyframes,o);if(c!==void 0){UI.update(()=>{s.onUpdate(c),s.onComplete()});return}}return o.isSync?new mO(s):new KbA(s)};function a_A({protectedKeys:t,needsAnimating:A},e){const i=t.hasOwnProperty(e)&&A[e]!==!0;return A[e]=!1,i}function pgA(t,A,{delay:e=0,transitionOverride:i,type:g}={}){let{transition:I=t.getDefaultTransition(),transitionEnd:n,...o}=A;i&&(I=i);const a=[],r=g&&t.animationState&&t.animationState.getState()[g];for(const s in o){const B=t.getValue(s,t.latestValues[s]??null),c=o[s];if(c===void 0||r&&a_A(r,s))continue;const E={delay:e,...MO(I||{},s)},D=B.get();if(D!==void 0&&!B.isAnimating&&!Array.isArray(c)&&c===D&&!E.velocity)continue;let y=!1;if(window.MotionHandoffAnimation){const f=dgA(t);if(f){const M=window.MotionHandoffAnimation(f,s,UI);M!==null&&(E.startTime=M,y=!0)}}CY(t,s),B.start(xO(s,B,c,t.shouldReduceMotion&&xiA.has(s)?{type:!1}:E,t,y));const S=B.animation;S&&a.push(S)}return n&&Promise.all(a).then(()=>{UI.update(()=>{n&&XvA(t,n)})}),a}function fgA(t,A,e,i=0,g=1){const I=Array.from(t).sort((r,s)=>r.sortNodePosition(s)).indexOf(A),n=t.size,o=(n-1)*i;return typeof e=="function"?e(I,n):g===1?I*i:o-I*i}function BY(t,A,e={}){const i=bD(t,A,e.type==="exit"?t.presenceContext?.custom:void 0);let{transition:g=t.getDefaultTransition()||{}}=i||{};e.transitionOverride&&(g=e.transitionOverride);const I=i?()=>Promise.all(pgA(t,i,e)):()=>Promise.resolve(),n=t.variantChildren&&t.variantChildren.size?(a=0)=>{const{delayChildren:r=0,staggerChildren:s,staggerDirection:B}=g;return r_A(t,A,a,r,s,B,e)}:()=>Promise.resolve(),{when:o}=g;if(o){const[a,r]=o==="beforeChildren"?[I,n]:[n,I];return a().then(()=>r())}else return Promise.all([I(),n(e.delay)])}function r_A(t,A,e=0,i=0,g=0,I=1,n){const o=[];for(const a of t.variantChildren)a.notify("AnimationStart",A),o.push(BY(a,A,{...n,delay:e+(typeof i=="function"?0:i)+fgA(t.variantChildren,a,i,g,I)}).then(()=>a.notify("AnimationComplete",A)));return Promise.all(o)}function s_A(t,A,e={}){t.notify("AnimationStart",A);let i;if(Array.isArray(A)){const g=A.map(I=>BY(t,I,e));i=Promise.all(g)}else if(typeof A=="string")i=BY(t,A,e);else{const g=typeof A=="function"?bD(t,A,e.custom):A;i=Promise.all(pgA(t,g,e))}return i.then(()=>{t.notify("AnimationComplete",A)})}function DgA(t,A){if(!Array.isArray(A))return!1;const e=A.length;if(e!==t.length)return!1;for(let i=0;i<e;i++)if(A[i]!==t[i])return!1;return!0}const C_A=KO.length;function ygA(t){if(!t)return;if(!t.isControllingVariants){const e=t.parent?ygA(t.parent)||{}:{};return t.props.initial!==void 0&&(e.initial=t.props.initial),e}const A={};for(let e=0;e<C_A;e++){const i=KO[e],g=t.props[i];(G0(g)||g===!1)&&(A[i]=g)}return A}const B_A=[...UO].reverse(),c_A=UO.length;function l_A(t){return A=>Promise.all(A.map(({animation:e,options:i})=>s_A(t,e,i)))}function Q_A(t){let A=l_A(t),e=$Z(),i=!0;const g=a=>(r,s)=>{const B=bD(t,s,a==="exit"?t.presenceContext?.custom:void 0);if(B){const{transition:c,transitionEnd:E,...D}=B;r={...r,...D,...E}}return r};function I(a){A=a(t)}function n(a){const{props:r}=t,s=ygA(t.parent)||{},B=[],c=new Set;let E={},D=1/0;for(let S=0;S<c_A;S++){const f=B_A[S],M=e[f],k=r[f]!==void 0?r[f]:s[f],m=G0(k),U=f===a?M.isActive:null;U===!1&&(D=S);let F=k===s[f]&&k!==r[f]&&m;if(F&&i&&t.manuallyAnimateOnMount&&(F=!1),M.protectedKeys={...E},!M.isActive&&U===null||!k&&!M.prevProp||ab(k)||typeof k=="boolean")continue;const b=E_A(M.prevProp,k);let K=b||f===a&&M.isActive&&!F&&m||S>D&&m,R=!1;const G=Array.isArray(k)?k:[k];let J=G.reduce(g(f),{});U===!1&&(J={});const{prevResolvedValues:x={}}=M,H={...x,...J},P=Y=>{K=!0,c.has(Y)&&(R=!0,c.delete(Y)),M.needsAnimating[Y]=!0;const O=t.getValue(Y);O&&(O.liveStyle=!1)};for(const Y in H){const O=J[Y],$=x[Y];if(E.hasOwnProperty(Y))continue;let gA=!1;sY(O)&&sY($)?gA=!DgA(O,$):gA=O!==$,gA?O!=null?P(Y):c.add(Y):O!==void 0&&c.has(Y)?P(Y):M.protectedKeys[Y]=!0}M.prevProp=k,M.prevResolvedValues=J,M.isActive&&(E={...E,...J}),i&&t.blockInitialAnimation&&(K=!1);const j=F&&b;K&&(!j||R)&&B.push(...G.map(Y=>{const O={type:f};if(typeof Y=="string"&&i&&!j&&t.manuallyAnimateOnMount&&t.parent){const{parent:$}=t,gA=bD($,Y);if($.enteringChildren&&gA){const{delayChildren:z}=gA.transition||{};O.delay=fgA($.enteringChildren,t,z)}}return{animation:Y,options:O}}))}if(c.size){const S={};if(typeof r.initial!="boolean"){const f=bD(t,Array.isArray(r.initial)?r.initial[0]:r.initial);f&&f.transition&&(S.transition=f.transition)}c.forEach(f=>{const M=t.getBaseTarget(f),k=t.getValue(f);k&&(k.liveStyle=!0),S[f]=M??null}),B.push({animation:S})}let y=!!B.length;return i&&(r.initial===!1||r.initial===r.animate)&&!t.manuallyAnimateOnMount&&(y=!1),i=!1,y?A(B):Promise.resolve()}function o(a,r){if(e[a].isActive===r)return Promise.resolve();t.variantChildren?.forEach(B=>B.animationState?.setActive(a,r)),e[a].isActive=r;const s=n(a);for(const B in e)e[B].protectedKeys={};return s}return{animateChanges:n,setActive:o,setAnimateFunction:I,getState:()=>e,reset:()=>{e=$Z(),i=!0}}}function E_A(t,A){return typeof A=="string"?A!==t:Array.isArray(A)?!DgA(A,t):!1}function Eh(t=!1){return{isActive:t,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function $Z(){return{animate:Eh(!0),whileInView:Eh(),whileHover:Eh(),whileTap:Eh(),whileDrag:Eh(),whileFocus:Eh(),exit:Eh()}}class Su{constructor(A){this.isMounted=!1,this.node=A}update(){}}class u_A extends Su{constructor(A){super(A),A.animationState||(A.animationState=Q_A(A))}updateAnimationControlsSubscription(){const{animate:A}=this.node.getProps();ab(A)&&(this.unmountControls=A.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:A}=this.node.getProps(),{animate:e}=this.node.prevProps||{};A!==e&&this.updateAnimationControlsSubscription()}unmount(){this.node.animationState.reset(),this.unmountControls?.()}}let h_A=0;class d_A extends Su{constructor(){super(...arguments),this.id=h_A++}update(){if(!this.node.presenceContext)return;const{isPresent:A,onExitComplete:e}=this.node.presenceContext,{isPresent:i}=this.node.prevPresenceContext||{};if(!this.node.animationState||A===i)return;const g=this.node.animationState.setActive("exit",!A);e&&!A&&g.then(()=>{e(this.id)})}mount(){const{register:A,onExitComplete:e}=this.node.presenceContext||{};e&&e(this.id),A&&(this.unmount=A(this.id))}unmount(){}}const p_A={animation:{Feature:u_A},exit:{Feature:d_A}};function U0(t,A,e,i={passive:!0}){return t.addEventListener(A,e,i),()=>t.removeEventListener(A,e)}function Lk(t){return{point:{x:t.pageX,y:t.pageY}}}const f_A=t=>A=>RO(A)&&t(A,Lk(A));function qm(t,A,e,i){return U0(t,A,f_A(e),i)}const SgA=1e-4,D_A=1-SgA,y_A=1+SgA,wgA=.01,S_A=0-wgA,w_A=0+wgA;function tr(t){return t.max-t.min}function m_A(t,A,e){return Math.abs(t-A)<=e}function AW(t,A,e,i=.5){t.origin=i,t.originPoint=TI(A.min,A.max,t.origin),t.scale=tr(e)/tr(A),t.translate=TI(e.min,e.max,t.origin)-t.originPoint,(t.scale>=D_A&&t.scale<=y_A||isNaN(t.scale))&&(t.scale=1),(t.translate>=S_A&&t.translate<=w_A||isNaN(t.translate))&&(t.translate=0)}function xm(t,A,e,i){AW(t.x,A.x,e.x,i?i.originX:void 0),AW(t.y,A.y,e.y,i?i.originY:void 0)}function eW(t,A,e){t.min=e.min+A.min,t.max=t.min+tr(A)}function k_A(t,A,e){eW(t.x,A.x,e.x),eW(t.y,A.y,e.y)}function tW(t,A,e){t.min=A.min-e.min,t.max=t.min+tr(A)}function Tm(t,A,e){tW(t.x,A.x,e.x),tW(t.y,A.y,e.y)}function Os(t){return[t("x"),t("y")]}const mgA=({current:t})=>t?t.ownerDocument.defaultView:null,iW=(t,A)=>Math.abs(t-A);function M_A(t,A){const e=iW(t.x,A.x),i=iW(t.y,A.y);return Math.sqrt(e**2+i**2)}class kgA{constructor(A,e,{transformPagePoint:i,contextWindow:g=window,dragSnapToOrigin:I=!1,distanceThreshold:n=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 c=QL(this.lastMoveEventInfo,this.history),E=this.startEvent!==null,D=M_A(c.offset,{x:0,y:0})>=this.distanceThreshold;if(!E&&!D)return;const{point:y}=c,{timestamp:S}=Lo;this.history.push({...y,timestamp:S});const{onStart:f,onMove:M}=this.handlers;E||(f&&f(this.lastMoveEvent,c),this.startEvent=this.lastMoveEvent),M&&M(this.lastMoveEvent,c)},this.handlePointerMove=(c,E)=>{this.lastMoveEvent=c,this.lastMoveEventInfo=lL(E,this.transformPagePoint),UI.update(this.updatePoint,!0)},this.handlePointerUp=(c,E)=>{this.end();const{onEnd:D,onSessionEnd:y,resumeAnimation:S}=this.handlers;if(this.dragSnapToOrigin&&S&&S(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const f=QL(c.type==="pointercancel"?this.lastMoveEventInfo:lL(E,this.transformPagePoint),this.history);this.startEvent&&D&&D(c,f),y&&y(c,f)},!RO(A))return;this.dragSnapToOrigin=I,this.handlers=e,this.transformPagePoint=i,this.distanceThreshold=n,this.contextWindow=g||window;const o=Lk(A),a=lL(o,this.transformPagePoint),{point:r}=a,{timestamp:s}=Lo;this.history=[{...r,timestamp:s}];const{onSessionStart:B}=e;B&&B(A,QL(a,this.history)),this.removeListeners=vk(qm(this.contextWindow,"pointermove",this.handlePointerMove),qm(this.contextWindow,"pointerup",this.handlePointerUp),qm(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(A){this.handlers=A}end(){this.removeListeners&&this.removeListeners(),nu(this.updatePoint)}}function lL(t,A){return A?{point:A(t.point)}:t}function gW(t,A){return{x:t.x-A.x,y:t.y-A.y}}function QL({point:t},A){return{point:t,delta:gW(t,MgA(A)),offset:gW(t,N_A(A)),velocity:G_A(A,.1)}}function N_A(t){return t[0]}function MgA(t){return t[t.length-1]}function G_A(t,A){if(t.length<2)return{x:0,y:0};let e=t.length-1,i=null;const g=MgA(t);for(;e>=0&&(i=t[e],!(g.timestamp-i.timestamp>Lc(A)));)e--;if(!i)return{x:0,y:0};const I=qc(g.timestamp-i.timestamp);if(I===0)return{x:0,y:0};const n={x:(g.x-i.x)/I,y:(g.y-i.y)/I};return n.x===1/0&&(n.x=0),n.y===1/0&&(n.y=0),n}function R_A(t,{min:A,max:e},i){return A!==void 0&&t<A?t=i?TI(A,t,i.min):Math.max(t,A):e!==void 0&&t>e&&(t=i?TI(e,t,i.max):Math.min(t,e)),t}function IW(t,A,e){return{min:A!==void 0?t.min+A:void 0,max:e!==void 0?t.max+e-(t.max-t.min):void 0}}function U_A(t,{top:A,left:e,bottom:i,right:g}){return{x:IW(t.x,e,g),y:IW(t.y,A,i)}}function nW(t,A){let e=A.min-t.min,i=A.max-t.max;return A.max-A.min<t.max-t.min&&([e,i]=[i,e]),{min:e,max:i}}function K_A(t,A){return{x:nW(t.x,A.x),y:nW(t.y,A.y)}}function F_A(t,A){let e=.5;const i=tr(t),g=tr(A);return g>i?e=k0(A.min,A.max-i,t.min):i>g&&(e=k0(t.min,t.max-g,A.min)),hQ(0,1,e)}function b_A(t,A){const e={};return A.min!==void 0&&(e.min=A.min-t.min),A.max!==void 0&&(e.max=A.max-t.min),e}const cY=.35;function v_A(t=cY){return t===!1?t=0:t===!0&&(t=cY),{x:oW(t,"left","right"),y:oW(t,"top","bottom")}}function oW(t,A,e){return{min:aW(t,A),max:aW(t,e)}}function aW(t,A){return typeof t=="number"?t:t[A]||0}const __A=new WeakMap;class J_A{constructor(A){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=an(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=A}start(A,{snapToCursor:e=!1,distanceThreshold:i}={}){const{presenceContext:g}=this.visualElement;if(g&&g.isPresent===!1)return;const I=B=>{const{dragSnapToOrigin:c}=this.getProps();c?this.pauseAnimation():this.stopAnimation(),e&&this.snapToCursor(Lk(B).point)},n=(B,c)=>{const{drag:E,dragPropagation:D,onDragStart:y}=this.getProps();if(E&&!D&&(this.openDragLock&&this.openDragLock(),this.openDragLock=zbA(E),!this.openDragLock))return;this.latestPointerEvent=B,this.latestPanInfo=c,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),Os(f=>{let M=this.getAxisMotionValue(f).get()||0;if(xc.test(M)){const{projection:k}=this.visualElement;if(k&&k.layout){const m=k.layout.layoutBox[f];m&&(M=tr(m)*(parseFloat(M)/100))}}this.originPoint[f]=M}),y&&UI.postRender(()=>y(B,c)),CY(this.visualElement,"transform");const{animationState:S}=this.visualElement;S&&S.setActive("whileDrag",!0)},o=(B,c)=>{this.latestPointerEvent=B,this.latestPanInfo=c;const{dragPropagation:E,dragDirectionLock:D,onDirectionLock:y,onDrag:S}=this.getProps();if(!E&&!this.openDragLock)return;const{offset:f}=c;if(D&&this.currentDirection===null){this.currentDirection=L_A(f),this.currentDirection!==null&&y&&y(this.currentDirection);return}this.updateAxis("x",c.point,f),this.updateAxis("y",c.point,f),this.visualElement.render(),S&&S(B,c)},a=(B,c)=>{this.latestPointerEvent=B,this.latestPanInfo=c,this.stop(B,c),this.latestPointerEvent=null,this.latestPanInfo=null},r=()=>Os(B=>this.getAnimationState(B)==="paused"&&this.getAxisMotionValue(B).animation?.play()),{dragSnapToOrigin:s}=this.getProps();this.panSession=new kgA(A,{onSessionStart:I,onStart:n,onMove:o,onSessionEnd:a,resumeAnimation:r},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:s,distanceThreshold:i,contextWindow:mgA(this.visualElement)})}stop(A,e){const i=A||this.latestPointerEvent,g=e||this.latestPanInfo,I=this.isDragging;if(this.cancel(),!I||!g||!i)return;const{velocity:n}=g;this.startAnimation(n);const{onDragEnd:o}=this.getProps();o&&UI.postRender(()=>o(i,g))}cancel(){this.isDragging=!1;const{projection:A,animationState:e}=this.visualElement;A&&(A.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:i}=this.getProps();!i&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),e&&e.setActive("whileDrag",!1)}updateAxis(A,e,i){const{drag:g}=this.getProps();if(!i||!YN(A,g,this.currentDirection))return;const I=this.getAxisMotionValue(A);let n=this.originPoint[A]+i[A];this.constraints&&this.constraints[A]&&(n=R_A(n,this.constraints[A],this.elastic[A])),I.set(n)}resolveConstraints(){const{dragConstraints:A,dragElastic:e}=this.getProps(),i=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):this.visualElement.projection?.layout,g=this.constraints;A&&CD(A)?this.constraints||(this.constraints=this.resolveRefConstraints()):A&&i?this.constraints=U_A(i.layoutBox,A):this.constraints=!1,this.elastic=v_A(e),g!==this.constraints&&i&&this.constraints&&!this.hasMutatedConstraints&&Os(I=>{this.constraints!==!1&&this.getAxisMotionValue(I)&&(this.constraints[I]=b_A(i.layoutBox[I],this.constraints[I]))})}resolveRefConstraints(){const{dragConstraints:A,onMeasureDragConstraints:e}=this.getProps();if(!A||!CD(A))return!1;const i=A.current,{projection:g}=this.visualElement;if(!g||!g.layout)return!1;const I=xvA(i,g.root,this.visualElement.getTransformPagePoint());let n=K_A(g.layout.layoutBox,I);if(e){const o=e(JvA(n));this.hasMutatedConstraints=!!o,o&&(n=CgA(o))}return n}startAnimation(A){const{drag:e,dragMomentum:i,dragElastic:g,dragTransition:I,dragSnapToOrigin:n,onDragTransitionEnd:o}=this.getProps(),a=this.constraints||{},r=Os(s=>{if(!YN(s,e,this.currentDirection))return;let B=a&&a[s]||{};n&&(B={min:0,max:0});const c=g?200:1e6,E=g?40:1e7,D={type:"inertia",velocity:i?A[s]:0,bounceStiffness:c,bounceDamping:E,timeConstant:750,restDelta:1,restSpeed:10,...I,...B};return this.startAxisValueAnimation(s,D)});return Promise.all(r).then(o)}startAxisValueAnimation(A,e){const i=this.getAxisMotionValue(A);return CY(this.visualElement,A),i.start(xO(A,i,0,e,this.visualElement,!1))}stopAnimation(){Os(A=>this.getAxisMotionValue(A).stop())}pauseAnimation(){Os(A=>this.getAxisMotionValue(A).animation?.pause())}getAnimationState(A){return this.getAxisMotionValue(A).animation?.state}getAxisMotionValue(A){const e=`_drag${A.toUpperCase()}`,i=this.visualElement.getProps(),g=i[e];return g||this.visualElement.getValue(A,(i.initial?i.initial[A]:void 0)||0)}snapToCursor(A){Os(e=>{const{drag:i}=this.getProps();if(!YN(e,i,this.currentDirection))return;const{projection:g}=this.visualElement,I=this.getAxisMotionValue(e);if(g&&g.layout){const{min:n,max:o}=g.layout.layoutBox[e];I.set(A[e]-TI(n,o,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:A,dragConstraints:e}=this.getProps(),{projection:i}=this.visualElement;if(!CD(e)||!i||!this.constraints)return;this.stopAnimation();const g={x:0,y:0};Os(n=>{const o=this.getAxisMotionValue(n);if(o&&this.constraints!==!1){const a=o.get();g[n]=F_A({min:a,max:a},this.constraints[n])}});const{transformTemplate:I}=this.visualElement.getProps();this.visualElement.current.style.transform=I?I({},""):"none",i.root&&i.root.updateScroll(),i.updateLayout(),this.resolveConstraints(),Os(n=>{if(!YN(n,A,null))return;const o=this.getAxisMotionValue(n),{min:a,max:r}=this.constraints[n];o.set(TI(a,r,g[n]))})}addListeners(){if(!this.visualElement.current)return;__A.set(this.visualElement,this);const A=this.visualElement.current,e=qm(A,"pointerdown",a=>{const{drag:r,dragListener:s=!0}=this.getProps();r&&s&&this.start(a)}),i=()=>{const{dragConstraints:a}=this.getProps();CD(a)&&a.current&&(this.constraints=this.resolveRefConstraints())},{projection:g}=this.visualElement,I=g.addEventListener("measure",i);g&&!g.layout&&(g.root&&g.root.updateScroll(),g.updateLayout()),UI.read(i);const n=U0(window,"resize",()=>this.scalePositionWithinConstraints()),o=g.addEventListener("didUpdate",({delta:a,hasLayoutChanged:r})=>{this.isDragging&&r&&(Os(s=>{const B=this.getAxisMotionValue(s);B&&(this.originPoint[s]+=a[s].translate,B.set(B.get()+a[s].translate))}),this.visualElement.render())});return()=>{n(),e(),I(),o&&o()}}getProps(){const A=this.visualElement.getProps(),{drag:e=!1,dragDirectionLock:i=!1,dragPropagation:g=!1,dragConstraints:I=!1,dragElastic:n=cY,dragMomentum:o=!0}=A;return{...A,drag:e,dragDirectionLock:i,dragPropagation:g,dragConstraints:I,dragElastic:n,dragMomentum:o}}}function YN(t,A,e){return(A===!0||A===t)&&(e===null||e===t)}function L_A(t,A=10){let e=null;return Math.abs(t.y)>A?e="y":Math.abs(t.x)>A&&(e="x"),e}class q_A extends Su{constructor(A){super(A),this.removeGroupControls=rC,this.removeListeners=rC,this.controls=new J_A(A)}mount(){const{dragControls:A}=this.node.getProps();A&&(this.removeGroupControls=A.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||rC}unmount(){this.removeGroupControls(),this.removeListeners()}}const rW=t=>(A,e)=>{t&&UI.postRender(()=>t(A,e))};class x_A extends Su{constructor(){super(...arguments),this.removePointerDownListener=rC}onPointerDown(A){this.session=new kgA(A,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:mgA(this.node)})}createPanHandlers(){const{onPanSessionStart:A,onPanStart:e,onPan:i,onPanEnd:g}=this.node.getProps();return{onSessionStart:rW(A),onStart:rW(e),onMove:i,onEnd:(I,n)=>{delete this.session,g&&UI.postRender(()=>g(I,n))}}}mount(){this.removePointerDownListener=qm(this.node.current,"pointerdown",A=>this.onPointerDown(A))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const _R={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function sW(t,A){return A.max===A.min?0:t/(A.max-A.min)*100}const Uw={correct:(t,A)=>{if(!A.target)return t;if(typeof t=="string")if(Qi.test(t))t=parseFloat(t);else return t;const e=sW(t,A.target.x),i=sW(t,A.target.y);return`${e}% ${i}%`}},T_A={correct:(t,{treeScale:A,projectionDelta:e})=>{const i=t,g=ou.parse(t);if(g.length>5)return i;const I=ou.createTransformer(t),n=typeof g[0]!="number"?1:0,o=e.x.scale*A.x,a=e.y.scale*A.y;g[0+n]/=o,g[1+n]/=a;const r=TI(o,a,.5);return typeof g[2+n]=="number"&&(g[2+n]/=r),typeof g[3+n]=="number"&&(g[3+n]/=r),I(g)}};let EL=!1;class Y_A extends p.Component{componentDidMount(){const{visualElement:A,layoutGroup:e,switchLayoutGroup:i,layoutId:g}=this.props,{projection:I}=A;BvA(H_A),I&&(e.group&&e.group.add(I),i&&i.register&&g&&i.register(I),EL&&I.root.didUpdate(),I.addEventListener("animationComplete",()=>{this.safeToRemove()}),I.setOptions({...I.options,onExitComplete:()=>this.safeToRemove()})),_R.hasEverUpdated=!0}getSnapshotBeforeUpdate(A){const{layoutDependency:e,visualElement:i,drag:g,isPresent:I}=this.props,{projection:n}=i;return n&&(n.isPresent=I,EL=!0,g||A.layoutDependency!==e||e===void 0||A.isPresent!==I?n.willUpdate():this.safeToRemove(),A.isPresent!==I&&(I?n.promote():n.relegate()||UI.postRender(()=>{const o=n.getStack();(!o||!o.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:A}=this.props.visualElement;A&&(A.root.didUpdate(),GO.postRender(()=>{!A.currentAnimation&&A.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:A,layoutGroup:e,switchLayoutGroup:i}=this.props,{projection:g}=A;EL=!0,g&&(g.scheduleCheckAfterUnmount(),e&&e.group&&e.group.remove(g),i&&i.deregister&&i.deregister(g))}safeToRemove(){const{safeToRemove:A}=this.props;A&&A()}render(){return null}}function NgA(t){const[A,e]=IvA(),i=p.useContext(oiA);return Q.jsx(Y_A,{...t,layoutGroup:i,switchLayoutGroup:p.useContext(rgA),isPresent:A,safeToRemove:e})}const H_A={borderRadius:{...Uw,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Uw,borderTopRightRadius:Uw,borderBottomLeftRadius:Uw,borderBottomRightRadius:Uw,boxShadow:T_A};function O_A(t,A,e){const i=ha(t)?t:Iy(t);return i.start(xO("",i,A,e)),i.animation}const P_A=(t,A)=>t.depth-A.depth;class j_A{constructor(){this.children=[],this.isDirty=!1}add(A){CO(this.children,A),this.isDirty=!0}remove(A){BO(this.children,A),this.isDirty=!0}forEach(A){this.isDirty&&this.children.sort(P_A),this.isDirty=!1,this.children.forEach(A)}}function Z_A(t,A){const e=Rr.now(),i=({timestamp:g})=>{const I=g-e;I>=A&&(nu(i),t(I-A))};return UI.setup(i,!0),()=>nu(i)}const GgA=["TopLeft","TopRight","BottomLeft","BottomRight"],W_A=GgA.length,CW=t=>typeof t=="string"?parseFloat(t):t,BW=t=>typeof t=="number"||Qi.test(t);function z_A(t,A,e,i,g,I){g?(t.opacity=TI(0,e.opacity??1,V_A(i)),t.opacityExit=TI(A.opacity??1,0,X_A(i))):I&&(t.opacity=TI(A.opacity??1,e.opacity??1,i));for(let n=0;n<W_A;n++){const o=`border${GgA[n]}Radius`;let a=cW(A,o),r=cW(e,o);if(a===void 0&&r===void 0)continue;a||(a=0),r||(r=0),a===0||r===0||BW(a)===BW(r)?(t[o]=Math.max(TI(CW(a),CW(r),i),0),(xc.test(r)||xc.test(a))&&(t[o]+="%")):t[o]=r}(A.rotate||e.rotate)&&(t.rotate=TI(A.rotate||0,e.rotate||0,i))}function cW(t,A){return t[A]!==void 0?t[A]:t.borderRadius}const V_A=RgA(0,.5,hiA),X_A=RgA(.5,.95,rC);function RgA(t,A,e){return i=>i<t?0:i>A?1:e(k0(t,A,i))}function lW(t,A){t.min=A.min,t.max=A.max}function xs(t,A){lW(t.x,A.x),lW(t.y,A.y)}function QW(t,A){t.translate=A.translate,t.scale=A.scale,t.originPoint=A.originPoint,t.origin=A.origin}function EW(t,A,e,i,g){return t-=A,t=VU(t,1/e,i),g!==void 0&&(t=VU(t,1/g,i)),t}function $_A(t,A=0,e=1,i=.5,g,I=t,n=t){if(xc.test(A)&&(A=parseFloat(A),A=TI(n.min,n.max,A/100)-n.min),typeof A!="number")return;let o=TI(I.min,I.max,i);t===I&&(o-=A),t.min=EW(t.min,A,e,o,g),t.max=EW(t.max,A,e,o,g)}function uW(t,A,[e,i,g],I,n){$_A(t,A[e],A[i],A[g],A.scale,I,n)}const AJA=["x","scaleX","originX"],eJA=["y","scaleY","originY"];function hW(t,A,e,i){uW(t.x,A,AJA,e?e.x:void 0,i?i.x:void 0),uW(t.y,A,eJA,e?e.y:void 0,i?i.y:void 0)}function dW(t){return t.translate===0&&t.scale===1}function UgA(t){return dW(t.x)&&dW(t.y)}function pW(t,A){return t.min===A.min&&t.max===A.max}function tJA(t,A){return pW(t.x,A.x)&&pW(t.y,A.y)}function fW(t,A){return Math.round(t.min)===Math.round(A.min)&&Math.round(t.max)===Math.round(A.max)}function KgA(t,A){return fW(t.x,A.x)&&fW(t.y,A.y)}function DW(t){return tr(t.x)/tr(t.y)}function yW(t,A){return t.translate===A.translate&&t.scale===A.scale&&t.originPoint===A.originPoint}class iJA{constructor(){this.members=[]}add(A){CO(this.members,A),A.scheduleRender()}remove(A){if(BO(this.members,A),A===this.prevLead&&(this.prevLead=void 0),A===this.lead){const e=this.members[this.members.length-1];e&&this.promote(e)}}relegate(A){const e=this.members.findIndex(g=>A===g);if(e===0)return!1;let i;for(let g=e;g>=0;g--){const I=this.members[g];if(I.isPresent!==!1){i=I;break}}return i?(this.promote(i),!0):!1}promote(A,e){const i=this.lead;if(A!==i&&(this.prevLead=i,this.lead=A,A.show(),i)){i.instance&&i.scheduleRender(),A.scheduleRender(),A.resumeFrom=i,e&&(A.resumeFrom.preserveOpacity=!0),i.snapshot&&(A.snapshot=i.snapshot,A.snapshot.latestValues=i.animationValues||i.latestValues),A.root&&A.root.isUpdating&&(A.isLayoutDirty=!0);const{crossfade:g}=A.options;g===!1&&i.hide()}}exitAnimationComplete(){this.members.forEach(A=>{const{options:e,resumingFrom:i}=A;e.onExitComplete&&e.onExitComplete(),i&&i.options.onExitComplete&&i.options.onExitComplete()})}scheduleRender(){this.members.forEach(A=>{A.instance&&A.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function gJA(t,A,e){let i="";const g=t.x.translate/A.x,I=t.y.translate/A.y,n=e?.z||0;if((g||I||n)&&(i=`translate3d(${g}px, ${I}px, ${n}px) `),(A.x!==1||A.y!==1)&&(i+=`scale(${1/A.x}, ${1/A.y}) `),e){const{transformPerspective:r,rotate:s,rotateX:B,rotateY:c,skewX:E,skewY:D}=e;r&&(i=`perspective(${r}px) ${i}`),s&&(i+=`rotate(${s}deg) `),B&&(i+=`rotateX(${B}deg) `),c&&(i+=`rotateY(${c}deg) `),E&&(i+=`skewX(${E}deg) `),D&&(i+=`skewY(${D}deg) `)}const o=t.x.scale*A.x,a=t.y.scale*A.y;return(o!==1||a!==1)&&(i+=`scale(${o}, ${a})`),i||"none"}const uL=["","X","Y","Z"],IJA=1e3;let nJA=0;function hL(t,A,e,i){const{latestValues:g}=A;g[t]&&(e[t]=g[t],A.setStaticValue(t,0),i&&(i[t]=0))}function FgA(t){if(t.hasCheckedOptimisedAppear=!0,t.root===t)return;const{visualElement:A}=t.options;if(!A)return;const e=dgA(A);if(window.MotionHasOptimisedAnimation(e,"transform")){const{layout:g,layoutId:I}=t.options;window.MotionCancelOptimisedAnimation(e,"transform",UI,!(g||I))}const{parent:i}=t;i&&!i.hasCheckedOptimisedAppear&&FgA(i)}function bgA({attachResizeListener:t,defaultParent:A,measureScroll:e,checkIsScrollRoot:i,resetTransform:g}){return class{constructor(n={},o=A?.()){this.id=nJA++,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(rJA),this.nodes.forEach(cJA),this.nodes.forEach(lJA),this.nodes.forEach(sJA)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=n,this.root=o?o.root||o:this,this.path=o?[...o.path,o]:[],this.parent=o,this.depth=o?o.depth+1:0;for(let a=0;a<this.path.length;a++)this.path[a].shouldResetTransform=!0;this.root===this&&(this.nodes=new j_A)}addEventListener(n,o){return this.eventHandlers.has(n)||this.eventHandlers.set(n,new QO),this.eventHandlers.get(n).add(o)}notifyListeners(n,...o){const a=this.eventHandlers.get(n);a&&a.notify(...o)}hasListeners(n){return this.eventHandlers.has(n)}mount(n){if(this.instance)return;this.isSVG=ziA(n)&&!tvA(n),this.instance=n;const{layoutId:o,layout:a,visualElement:r}=this.options;if(r&&!r.current&&r.mount(n),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(a||o)&&(this.isLayoutDirty=!0),t){let s,B=0;const c=()=>this.root.updateBlockedByResize=!1;UI.read(()=>{B=window.innerWidth}),t(n,()=>{const E=window.innerWidth;E!==B&&(B=E,this.root.updateBlockedByResize=!0,s&&s(),s=Z_A(c,250),_R.hasAnimatedSinceResize&&(_R.hasAnimatedSinceResize=!1,this.nodes.forEach(mW)))})}o&&this.root.registerSharedNode(o,this),this.options.animate!==!1&&r&&(o||a)&&this.addEventListener("didUpdate",({delta:s,hasLayoutChanged:B,hasRelativeLayoutChanged:c,layout:E})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const D=this.options.transition||r.getDefaultTransition()||dJA,{onLayoutAnimationStart:y,onLayoutAnimationComplete:S}=r.getProps(),f=!this.targetLayout||!KgA(this.targetLayout,E),M=!B&&c;if(this.options.layoutRoot||this.resumeFrom||M||B&&(f||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const k={...MO(D,"layout"),onPlay:y,onComplete:S};(r.shouldReduceMotion||this.options.layoutRoot)&&(k.delay=0,k.type=!1),this.startAnimation(k),this.setAnimationOrigin(s,M)}else B||mW(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=E})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const n=this.getStack();n&&n.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),nu(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(QJA),this.animationId++)}getTransformTemplate(){const{visualElement:n}=this.options;return n&&n.getProps().transformTemplate}willUpdate(n=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&FgA(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let s=0;s<this.path.length;s++){const B=this.path[s];B.shouldResetTransform=!0,B.updateScroll("snapshot"),B.options.layoutRoot&&B.willUpdate(!1)}const{layoutId:o,layout:a}=this.options;if(o===void 0&&!a)return;const r=this.getTransformTemplate();this.prevTransformTemplateValue=r?r(this.latestValues,""):void 0,this.updateSnapshot(),n&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(SW);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(wW);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(BJA),this.nodes.forEach(oJA),this.nodes.forEach(aJA)):this.nodes.forEach(wW),this.clearAllSnapshots();const o=Rr.now();Lo.delta=hQ(0,1e3/60,o-Lo.timestamp),Lo.timestamp=o,Lo.isProcessing=!0,nL.update.process(Lo),nL.preRender.process(Lo),nL.render.process(Lo),Lo.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,GO.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(CJA),this.sharedNodes.forEach(EJA)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,UI.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){UI.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!tr(this.snapshot.measuredBox.x)&&!tr(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 a=0;a<this.path.length;a++)this.path[a].updateScroll();const n=this.layout;this.layout=this.measure(!1),this.layoutCorrected=an(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:o}=this.options;o&&o.notify("LayoutMeasure",this.layout.layoutBox,n?n.layoutBox:void 0)}updateScroll(n="measure"){let o=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===n&&(o=!1),o&&this.instance){const a=i(this.instance);this.scroll={animationId:this.root.animationId,phase:n,isRoot:a,offset:e(this.instance),wasRoot:this.scroll?this.scroll.isRoot:a}}}resetTransform(){if(!g)return;const n=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,o=this.projectionDelta&&!UgA(this.projectionDelta),a=this.getTransformTemplate(),r=a?a(this.latestValues,""):void 0,s=r!==this.prevTransformTemplateValue;n&&this.instance&&(o||xh(this.latestValues)||s)&&(g(this.instance,r),this.shouldResetTransform=!1,this.scheduleRender())}measure(n=!0){const o=this.measurePageBox();let a=this.removeElementScroll(o);return n&&(a=this.removeTransform(a)),pJA(a),{animationId:this.root.animationId,measuredBox:o,layoutBox:a,latestValues:{},source:this.id}}measurePageBox(){const{visualElement:n}=this.options;if(!n)return an();const o=n.measureViewportBox();if(!(this.scroll?.wasRoot||this.path.some(fJA))){const{scroll:r}=this.root;r&&(BD(o.x,r.offset.x),BD(o.y,r.offset.y))}return o}removeElementScroll(n){const o=an();if(xs(o,n),this.scroll?.wasRoot)return o;for(let a=0;a<this.path.length;a++){const r=this.path[a],{scroll:s,options:B}=r;r!==this.root&&s&&B.layoutScroll&&(s.wasRoot&&xs(o,n),BD(o.x,s.offset.x),BD(o.y,s.offset.y))}return o}applyTransform(n,o=!1){const a=an();xs(a,n);for(let r=0;r<this.path.length;r++){const s=this.path[r];!o&&s.options.layoutScroll&&s.scroll&&s!==s.root&&cD(a,{x:-s.scroll.offset.x,y:-s.scroll.offset.y}),xh(s.latestValues)&&cD(a,s.latestValues)}return xh(this.latestValues)&&cD(a,this.latestValues),a}removeTransform(n){const o=an();xs(o,n);for(let a=0;a<this.path.length;a++){const r=this.path[a];if(!r.instance||!xh(r.latestValues))continue;aY(r.latestValues)&&r.updateSnapshot();const s=an(),B=r.measurePageBox();xs(s,B),hW(o,r.latestValues,r.snapshot?r.snapshot.layoutBox:void 0,s)}return xh(this.latestValues)&&hW(o,this.latestValues),o}setTargetDelta(n){this.targetDelta=n,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(n){this.options={...this.options,...n,crossfade:n.crossfade!==void 0?n.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!==Lo.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(n=!1){const o=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=o.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=o.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=o.isSharedProjectionDirty);const a=!!this.resumingFrom||this!==o;if(!(n||a&&this.isSharedProjectionDirty||this.isProjectionDirty||this.parent?.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:s,layoutId:B}=this.options;if(!(!this.layout||!(s||B))){if(this.resolvedRelativeTargetAt=Lo.timestamp,!this.targetDelta&&!this.relativeTarget){const c=this.getClosestProjectingParent();c&&c.layout&&this.animationProgress!==1?(this.relativeParent=c,this.forceRelativeParentToResolveTarget(),this.relativeTarget=an(),this.relativeTargetOrigin=an(),Tm(this.relativeTargetOrigin,this.layout.layoutBox,c.layout.layoutBox),xs(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=an(),this.targetWithTransforms=an()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),k_A(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):xs(this.target,this.layout.layoutBox),cgA(this.target,this.targetDelta)):xs(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const c=this.getClosestProjectingParent();c&&!!c.resumingFrom==!!this.resumingFrom&&!c.options.layoutScroll&&c.target&&this.animationProgress!==1?(this.relativeParent=c,this.forceRelativeParentToResolveTarget(),this.relativeTarget=an(),this.relativeTargetOrigin=an(),Tm(this.relativeTargetOrigin,this.target,c.target),xs(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||aY(this.parent.latestValues)||BgA(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 n=this.getLead(),o=!!this.resumingFrom||this!==n;let a=!0;if((this.isProjectionDirty||this.parent?.isProjectionDirty)&&(a=!1),o&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(a=!1),this.resolvedRelativeTargetAt===Lo.timestamp&&(a=!1),a)return;const{layout:r,layoutId:s}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(r||s))return;xs(this.layoutCorrected,this.layout.layoutBox);const B=this.treeScale.x,c=this.treeScale.y;qvA(this.layoutCorrected,this.treeScale,this.path,o),n.layout&&!n.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(n.target=n.layout.layoutBox,n.targetWithTransforms=an());const{target:E}=n;if(!E){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(QW(this.prevProjectionDelta.x,this.projectionDelta.x),QW(this.prevProjectionDelta.y,this.projectionDelta.y)),xm(this.projectionDelta,this.layoutCorrected,E,this.latestValues),(this.treeScale.x!==B||this.treeScale.y!==c||!yW(this.projectionDelta.x,this.prevProjectionDelta.x)||!yW(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",E))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(n=!0){if(this.options.visualElement?.scheduleRender(),n){const o=this.getStack();o&&o.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=lD(),this.projectionDelta=lD(),this.projectionDeltaWithTransform=lD()}setAnimationOrigin(n,o=!1){const a=this.snapshot,r=a?a.latestValues:{},s={...this.latestValues},B=lD();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!o;const c=an(),E=a?a.source:void 0,D=this.layout?this.layout.source:void 0,y=E!==D,S=this.getStack(),f=!S||S.members.length<=1,M=!!(y&&!f&&this.options.crossfade===!0&&!this.path.some(hJA));this.animationProgress=0;let k;this.mixTargetDelta=m=>{const U=m/1e3;kW(B.x,n.x,U),kW(B.y,n.y,U),this.setTargetDelta(B),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(Tm(c,this.layout.layoutBox,this.relativeParent.layout.layoutBox),uJA(this.relativeTarget,this.relativeTargetOrigin,c,U),k&&tJA(this.relativeTarget,k)&&(this.isProjectionDirty=!1),k||(k=an()),xs(k,this.relativeTarget)),y&&(this.animationValues=s,z_A(s,r,this.latestValues,U,M,f)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=U},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(n){this.notifyListeners("animationStart"),this.currentAnimation?.stop(),this.resumingFrom?.currentAnimation?.stop(),this.pendingAnimation&&(nu(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=UI.update(()=>{_R.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=Iy(0)),this.currentAnimation=O_A(this.motionValue,[0,1e3],{...n,velocity:0,isSync:!0,onUpdate:o=>{this.mixTargetDelta(o),n.onUpdate&&n.onUpdate(o)},onStop:()=>{},onComplete:()=>{n.onComplete&&n.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 n=this.getStack();n&&n.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(IJA),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const n=this.getLead();let{targetWithTransforms:o,target:a,layout:r,latestValues:s}=n;if(!(!o||!a||!r)){if(this!==n&&this.layout&&r&&vgA(this.options.animationType,this.layout.layoutBox,r.layoutBox)){a=this.target||an();const B=tr(this.layout.layoutBox.x);a.x.min=n.target.x.min,a.x.max=a.x.min+B;const c=tr(this.layout.layoutBox.y);a.y.min=n.target.y.min,a.y.max=a.y.min+c}xs(o,a),cD(o,s),xm(this.projectionDeltaWithTransform,this.layoutCorrected,o,s)}}registerSharedNode(n,o){this.sharedNodes.has(n)||this.sharedNodes.set(n,new iJA),this.sharedNodes.get(n).add(o);const r=o.options.initialPromotionConfig;o.promote({transition:r?r.transition:void 0,preserveFollowOpacity:r&&r.shouldPreserveFollowOpacity?r.shouldPreserveFollowOpacity(o):void 0})}isLead(){const n=this.getStack();return n?n.lead===this:!0}getLead(){const{layoutId:n}=this.options;return n?this.getStack()?.lead||this:this}getPrevLead(){const{layoutId:n}=this.options;return n?this.getStack()?.prevLead:void 0}getStack(){const{layoutId:n}=this.options;if(n)return this.root.sharedNodes.get(n)}promote({needsReset:n,transition:o,preserveFollowOpacity:a}={}){const r=this.getStack();r&&r.promote(this,a),n&&(this.projectionDelta=void 0,this.needsReset=!0),o&&this.setOptions({transition:o})}relegate(){const n=this.getStack();return n?n.relegate(this):!1}resetSkewAndRotation(){const{visualElement:n}=this.options;if(!n)return;let o=!1;const{latestValues:a}=n;if((a.z||a.rotate||a.rotateX||a.rotateY||a.rotateZ||a.skewX||a.skewY)&&(o=!0),!o)return;const r={};a.z&&hL("z",n,r,this.animationValues);for(let s=0;s<uL.length;s++)hL(`rotate${uL[s]}`,n,r,this.animationValues),hL(`skew${uL[s]}`,n,r,this.animationValues);n.render();for(const s in r)n.setStaticValue(s,r[s]),this.animationValues&&(this.animationValues[s]=r[s]);n.scheduleRender()}applyProjectionStyles(n,o){if(!this.instance||this.isSVG)return;if(!this.isVisible){n.visibility="hidden";return}const a=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,n.visibility="",n.opacity="",n.pointerEvents=vR(o?.pointerEvents)||"",n.transform=a?a(this.latestValues,""):"none";return}const r=this.getLead();if(!this.projectionDelta||!this.layout||!r.target){this.options.layoutId&&(n.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,n.pointerEvents=vR(o?.pointerEvents)||""),this.hasProjected&&!xh(this.latestValues)&&(n.transform=a?a({},""):"none",this.hasProjected=!1);return}n.visibility="";const s=r.animationValues||r.latestValues;this.applyTransformsToTarget();let B=gJA(this.projectionDeltaWithTransform,this.treeScale,s);a&&(B=a(s,B)),n.transform=B;const{x:c,y:E}=this.projectionDelta;n.transformOrigin=`${c.origin*100}% ${E.origin*100}% 0`,r.animationValues?n.opacity=r===this?s.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:s.opacityExit:n.opacity=r===this?s.opacity!==void 0?s.opacity:"":s.opacityExit!==void 0?s.opacityExit:0;for(const D in R0){if(s[D]===void 0)continue;const{correct:y,applyTo:S,isCSSVariable:f}=R0[D],M=B==="none"?s[D]:y(s[D],r);if(S){const k=S.length;for(let m=0;m<k;m++)n[S[m]]=M}else f?this.options.visualElement.renderState.vars[D]=M:n[D]=M}this.options.layoutId&&(n.pointerEvents=r===this?vR(o?.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(n=>n.currentAnimation?.stop()),this.root.nodes.forEach(SW),this.root.sharedNodes.clear()}}}function oJA(t){t.updateLayout()}function aJA(t){const A=t.resumeFrom?.snapshot||t.snapshot;if(t.isLead()&&t.layout&&A&&t.hasListeners("didUpdate")){const{layoutBox:e,measuredBox:i}=t.layout,{animationType:g}=t.options,I=A.source!==t.layout.source;g==="size"?Os(s=>{const B=I?A.measuredBox[s]:A.layoutBox[s],c=tr(B);B.min=e[s].min,B.max=B.min+c}):vgA(g,A.layoutBox,e)&&Os(s=>{const B=I?A.measuredBox[s]:A.layoutBox[s],c=tr(e[s]);B.max=B.min+c,t.relativeTarget&&!t.currentAnimation&&(t.isProjectionDirty=!0,t.relativeTarget[s].max=t.relativeTarget[s].min+c)});const n=lD();xm(n,e,A.layoutBox);const o=lD();I?xm(o,t.applyTransform(i,!0),A.measuredBox):xm(o,e,A.layoutBox);const a=!UgA(n);let r=!1;if(!t.resumeFrom){const s=t.getClosestProjectingParent();if(s&&!s.resumeFrom){const{snapshot:B,layout:c}=s;if(B&&c){const E=an();Tm(E,A.layoutBox,B.layoutBox);const D=an();Tm(D,e,c.layoutBox),KgA(E,D)||(r=!0),s.options.layoutRoot&&(t.relativeTarget=D,t.relativeTargetOrigin=E,t.relativeParent=s)}}}t.notifyListeners("didUpdate",{layout:e,snapshot:A,delta:o,layoutDelta:n,hasLayoutChanged:a,hasRelativeLayoutChanged:r})}else if(t.isLead()){const{onExitComplete:e}=t.options;e&&e()}t.options.transition=void 0}function rJA(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 sJA(t){t.isProjectionDirty=t.isSharedProjectionDirty=t.isTransformDirty=!1}function CJA(t){t.clearSnapshot()}function SW(t){t.clearMeasurements()}function wW(t){t.isLayoutDirty=!1}function BJA(t){const{visualElement:A}=t.options;A&&A.getProps().onBeforeLayoutMeasure&&A.notify("BeforeLayoutMeasure"),t.resetTransform()}function mW(t){t.finishAnimation(),t.targetDelta=t.relativeTarget=t.target=void 0,t.isProjectionDirty=!0}function cJA(t){t.resolveTargetDelta()}function lJA(t){t.calcProjection()}function QJA(t){t.resetSkewAndRotation()}function EJA(t){t.removeLeadSnapshot()}function kW(t,A,e){t.translate=TI(A.translate,0,e),t.scale=TI(A.scale,1,e),t.origin=A.origin,t.originPoint=A.originPoint}function MW(t,A,e,i){t.min=TI(A.min,e.min,i),t.max=TI(A.max,e.max,i)}function uJA(t,A,e,i){MW(t.x,A.x,e.x,i),MW(t.y,A.y,e.y,i)}function hJA(t){return t.animationValues&&t.animationValues.opacityExit!==void 0}const dJA={duration:.45,ease:[.4,0,.1,1]},NW=t=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(t),GW=NW("applewebkit/")&&!NW("chrome/")?Math.round:rC;function RW(t){t.min=GW(t.min),t.max=GW(t.max)}function pJA(t){RW(t.x),RW(t.y)}function vgA(t,A,e){return t==="position"||t==="preserve-aspect"&&!m_A(DW(A),DW(e),.2)}function fJA(t){return t!==t.root&&t.scroll?.wasRoot}const DJA=bgA({attachResizeListener:(t,A)=>U0(t,"resize",A),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),dL={current:void 0},_gA=bgA({measureScroll:t=>({x:t.scrollLeft,y:t.scrollTop}),defaultParent:()=>{if(!dL.current){const t=new DJA({});t.mount(window),t.setOptions({layoutScroll:!0}),dL.current=t}return dL.current},resetTransform:(t,A)=>{t.style.transform=A!==void 0?A:"none"},checkIsScrollRoot:t=>window.getComputedStyle(t).position==="fixed"}),yJA={pan:{Feature:x_A},drag:{Feature:q_A,ProjectionNode:_gA,MeasureLayout:NgA}};function UW(t,A,e){const{props:i}=t;t.animationState&&i.whileHover&&t.animationState.setActive("whileHover",e==="Start");const g="onHover"+e,I=i[g];I&&UI.postRender(()=>I(A,Lk(A)))}class SJA extends Su{mount(){const{current:A}=this.node;A&&(this.unmount=VbA(A,(e,i)=>(UW(this.node,i,"Start"),g=>UW(this.node,g,"End"))))}unmount(){}}class wJA extends Su{constructor(){super(...arguments),this.isActive=!1}onFocus(){let A=!1;try{A=this.node.current.matches(":focus-visible")}catch{A=!0}!A||!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=vk(U0(this.node.current,"focus",()=>this.onFocus()),U0(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function KW(t,A,e){const{props:i}=t;if(t.current instanceof HTMLButtonElement&&t.current.disabled)return;t.animationState&&i.whileTap&&t.animationState.setActive("whileTap",e==="Start");const g="onTap"+(e==="End"?"":e),I=i[g];I&&UI.postRender(()=>I(A,Lk(A)))}class mJA extends Su{mount(){const{current:A}=this.node;A&&(this.unmount=evA(A,(e,i)=>(KW(this.node,i,"Start"),(g,{success:I})=>KW(this.node,g,I?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const lY=new WeakMap,pL=new WeakMap,kJA=t=>{const A=lY.get(t.target);A&&A(t)},MJA=t=>{t.forEach(kJA)};function NJA({root:t,...A}){const e=t||document;pL.has(e)||pL.set(e,{});const i=pL.get(e),g=JSON.stringify(A);return i[g]||(i[g]=new IntersectionObserver(MJA,{root:t,...A})),i[g]}function GJA(t,A,e){const i=NJA(A);return lY.set(t,e),i.observe(t),()=>{lY.delete(t),i.unobserve(t)}}const RJA={some:0,all:1};class UJA extends Su{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:A={}}=this.node.getProps(),{root:e,margin:i,amount:g="some",once:I}=A,n={root:e?e.current:void 0,rootMargin:i,threshold:typeof g=="number"?g:RJA[g]},o=a=>{const{isIntersecting:r}=a;if(this.isInView===r||(this.isInView=r,I&&!r&&this.hasEnteredView))return;r&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",r);const{onViewportEnter:s,onViewportLeave:B}=this.node.getProps(),c=r?s:B;c&&c(a)};return GJA(this.node.current,n,o)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:A,prevProps:e}=this.node;["amount","margin","root"].some(KJA(A,e))&&this.startObserver()}unmount(){}}function KJA({viewport:t={}},{viewport:A={}}={}){return e=>t[e]!==A[e]}const FJA={inView:{Feature:UJA},tap:{Feature:mJA},focus:{Feature:wJA},hover:{Feature:SJA}},bJA={layout:{ProjectionNode:_gA,MeasureLayout:NgA}},vJA={...p_A,...FJA,...yJA,...bJA},uB=_vA(vJA,WvA);function _JA(){!qO.current&&QgA();const[t]=p.useState(XU.current);return t}const JJA="_panelRoot_6rzhz_1",LJA="_crapsPlaceTile_6rzhz_43",qJA="_mobileShow_6rzhz_64",xJA="_mobileHide_6rzhz_68",TJA="_spotBtn_6rzhz_95",YJA="_spotRow_6rzhz_108",HJA="_actions_6rzhz_120",OJA="_actionBtn_6rzhz_124",PJA="_amountBadge_6rzhz_130",jJA="_badgeMinus_6rzhz_137",ZJA="_crapsStatusBar_6rzhz_148",WJA="_crapsStatusText_6rzhz_154",zJA="_crapsHighlight_6rzhz_162",VJA="_crapsPlaceRow_6rzhz_179",XJA="_crapsBetTile_6rzhz_190",$JA="_crapsActionsBar_6rzhz_198",ALA="_crapsActionButton_6rzhz_202",eLA="_crapsActionButtonPrimary_6rzhz_207",tLA="_crapsActionButtonSecondary_6rzhz_208",iLA="_crapsMainBets_6rzhz_214",gLA="_disabled_6rzhz_334",ILA="_spotBtnTopRow_6rzhz_520",nLA="_lineWin_6rzhz_571",oLA="_lineLose_6rzhz_576",aLA="_linePush_6rzhz_581",rLA="_outcomeBadge_6rzhz_586",sLA="_locked_6rzhz_600",CLA="_amountBadgeDisabled_6rzhz_628",BLA="_lockIcon_6rzhz_634",cLA="_aggBadge_6rzhz_674",lLA="_rollBtn_6rzhz_890",QLA="_rollIcon_6rzhz_897",ELA="_clear_6rzhz_923",uLA="_errorLive_6rzhz_940",hLA="_tooltip_6rzhz_948",dLA="_betInfoBtn_6rzhz_972",pLA="_betInfoModalOverlay_6rzhz_1000",fLA="_betInfoModal_6rzhz_1000",DLA="_betInfoHeader_6rzhz_1034",yLA="_betInfoClose_6rzhz_1050",SLA="_betInfoContent_6rzhz_1071",wLA="_betInfoItem_6rzhz_1079",mLA="_shake_6rzhz_1165",kLA="_attnHalo_6rzhz_1213",MLA="_crapsAtsLabel_6rzhz_1335",NLA="_crapsIronCrossBtn_6rzhz_1355",GLA="_crapsMinusBadge_6rzhz_1470",RLA="_rollHaloActive_6rzhz_1657",ULA="_crapsClearIcon_6rzhz_1770",KLA="_particle_6rzhz_1804",FLA="_particleContainer_6rzhz_1810",bLA="_floatingWinAmount_6rzhz_1860",vLA="_countdownBadge_6rzhz_1975",_LA="_countdownUrgent_6rzhz_1998",JLA="_countdownCritical_6rzhz_2005",LLA="_chipPickerWrapper_6rzhz_2329",qLA="_chipPickerToggle_6rzhz_2334",xLA="_chipPickerToggleOpen_6rzhz_2377",TLA="_chipPickerChip_6rzhz_2387",YLA="_chipPickerDropdown_6rzhz_2391",HLA="_chipPickerOption_6rzhz_2413",OLA="_chipPickerOptionSelected_6rzhz_2422",PLA="_chipPickerChipSelected_6rzhz_2426",jLA="_crapsAtsSection_6rzhz_2446",gt={panelRoot:JJA,crapsPlaceTile:LJA,mobileShow:qJA,mobileHide:xJA,spotBtn:TJA,spotRow:YJA,actions:HJA,actionBtn:OJA,amountBadge:PJA,badgeMinus:jJA,crapsStatusBar:ZJA,crapsStatusText:WJA,crapsHighlight:zJA,crapsPlaceRow:VJA,crapsBetTile:XJA,crapsActionsBar:$JA,crapsActionButton:ALA,crapsActionButtonPrimary:eLA,crapsActionButtonSecondary:tLA,crapsMainBets:iLA,disabled:gLA,spotBtnTopRow:ILA,lineWin:nLA,lineLose:oLA,linePush:aLA,outcomeBadge:rLA,locked:sLA,amountBadgeDisabled:CLA,lockIcon:BLA,aggBadge:cLA,rollBtn:lLA,rollIcon:QLA,clear:ELA,errorLive:uLA,tooltip:hLA,betInfoBtn:dLA,betInfoModalOverlay:pLA,betInfoModal:fLA,betInfoHeader:DLA,betInfoClose:yLA,betInfoContent:SLA,betInfoItem:wLA,shake:mLA,attnHalo:kLA,crapsAtsLabel:MLA,crapsIronCrossBtn:NLA,crapsMinusBadge:GLA,rollHaloActive:RLA,crapsClearIcon:ULA,particle:KLA,particleContainer:FLA,floatingWinAmount:bLA,countdownBadge:vLA,countdownUrgent:_LA,countdownCritical:JLA,chipPickerWrapper:LLA,chipPickerToggle:qLA,chipPickerToggleOpen:xLA,chipPickerChip:TLA,chipPickerDropdown:YLA,chipPickerOption:HLA,chipPickerOptionSelected:OLA,chipPickerChipSelected:PLA,crapsAtsSection:jLA},ZLA={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 WLA({open:t,onClose:A}){const e=p.useRef(null);if(p.useEffect(()=>{if(!t)return;const g=n=>{n.key==="Escape"&&A()},I=n=>{e.current&&!e.current.contains(n.target)&&A()};return document.addEventListener("keydown",g),document.addEventListener("mousedown",I),()=>{document.removeEventListener("keydown",g),document.removeEventListener("mousedown",I)}},[t,A]),!t)return null;const i=Q.jsx("div",{className:gt.betInfoModalOverlay,role:"presentation",children:Q.jsxs("div",{className:gt.betInfoModal,role:"dialog","aria-modal":"true","aria-label":"Craps Bet Guide",ref:e,children:[Q.jsxs("div",{className:gt.betInfoHeader,children:[Q.jsx("h3",{children:"Craps Bet Guide"}),Q.jsx("button",{className:gt.betInfoClose,onClick:A,"aria-label":"Close",children:"✕"})]}),Q.jsx("div",{className:gt.betInfoContent,children:Object.entries(ZLA).map(([g,{title:I,description:n}])=>Q.jsxs("div",{className:gt.betInfoItem,children:[Q.jsx("strong",{children:I}),Q.jsx("p",{children:n})]},g))})]})});return Zc.createPortal(i,document.body)}const zLA="_atsProgressContainer_bok0p_3",VLA="_inline_bok0p_15",XLA="_atsSection_bok0p_25",$LA="_complete_bok0p_42",AqA="_justCompleted_bok0p_47",eqA="_atsSectionAll_bok0p_66",tqA="_atsSectionHeader_bok0p_75",iqA="_atsSectionLabel_bok0p_84",gqA="_atsSectionCount_bok0p_97",IqA="_atsNumberRow_bok0p_107",nqA="_atsNumber_bok0p_107",oqA="_hit_bok0p_138",aqA="_atsCompleteText_bok0p_160",rqA="_atsLockedBadge_bok0p_181",zg={atsProgressContainer:zLA,inline:VLA,atsSection:XLA,complete:$LA,justCompleted:AqA,atsSectionAll:eqA,atsSectionHeader:tqA,atsSectionLabel:iqA,atsSectionCount:gqA,atsNumberRow:IqA,atsNumber:nqA,hit:oqA,atsCompleteText:aqA,atsLockedBadge:rqA},sqA=[2,3,4,5,6],CqA=[8,9,10,11,12];function BqA({hitNumbers:t,smallProgress:A,tallProgress:e,allProgress:i,betsLocked:g,lastCompletedCategory:I,inline:n=!1}){const o=B=>t.includes(B),a=A===5,r=e===5,s=i===10;return Q.jsxs("div",{className:`${zg.atsProgressContainer} ${n?zg.inline:""}`,children:[Q.jsxs("div",{className:`${zg.atsSection} ${a?zg.complete:""} ${I==="small"?zg.justCompleted:""}`,children:[Q.jsxs("div",{className:zg.atsSectionHeader,children:[Q.jsx("span",{className:zg.atsSectionLabel,children:"SMALL"}),Q.jsxs("span",{className:zg.atsSectionCount,children:[A,"/5"]})]}),Q.jsx("div",{className:zg.atsNumberRow,children:sqA.map(B=>Q.jsx("div",{className:`${zg.atsNumber} ${o(B)?zg.hit:""}`,"aria-label":`${B} ${o(B)?"hit":"not hit"}`,children:B},B))})]}),Q.jsxs("div",{className:`${zg.atsSection} ${zg.atsSectionAll} ${s?zg.complete:""} ${I==="all"?zg.justCompleted:""}`,children:[Q.jsxs("div",{className:zg.atsSectionHeader,children:[Q.jsx("span",{className:zg.atsSectionLabel,children:"ALL"}),Q.jsxs("span",{className:zg.atsSectionCount,children:[i,"/10"]})]}),s&&Q.jsx("div",{className:zg.atsCompleteText,children:"🎉"}),g&&!s&&Q.jsx("div",{className:zg.atsLockedBadge,children:"LOCKED"})]}),Q.jsxs("div",{className:`${zg.atsSection} ${r?zg.complete:""} ${I==="tall"?zg.justCompleted:""}`,children:[Q.jsxs("div",{className:zg.atsSectionHeader,children:[Q.jsx("span",{className:zg.atsSectionLabel,children:"TALL"}),Q.jsxs("span",{className:zg.atsSectionCount,children:[e,"/5"]})]}),Q.jsx("div",{className:zg.atsNumberRow,children:CqA.map(B=>Q.jsx("div",{className:`${zg.atsNumber} ${o(B)?zg.hit:""}`,"aria-label":`${B} ${o(B)?"hit":"not hit"}`,children:B},B))})]})]})}const pc={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"},fL={hitNumbers:[],smallProgress:0,tallProgress:0,allProgress:0,betsLocked:!1};function cqA(t){const A=Xn(),[e,i]=p.useState(fL),[g,I]=p.useState(null);p.useEffect(()=>{if(!g)return;const o=setTimeout(()=>I(null),3e3);return()=>clearTimeout(o)},[g]),p.useEffect(()=>{if(!A||!t)return;const o=c=>{c.roomId===t&&i({hitNumbers:c.hitNumbers,smallProgress:c.smallProgress,tallProgress:c.tallProgress,allProgress:c.allProgress,betsLocked:c.betsLocked})},a=c=>{c.roomId===t&&I("small")},r=c=>{c.roomId===t&&I("tall")},s=c=>{c.roomId===t&&I("all")},B=c=>{c.roomId===t&&(i(fL),I(null))};return A.on(pc.PROGRESS,o),A.on(pc.SMALL_COMPLETE,a),A.on(pc.TALL_COMPLETE,r),A.on(pc.ALL_COMPLETE,s),A.on(pc.RESET,B),()=>{A.off(pc.PROGRESS,o),A.off(pc.SMALL_COMPLETE,a),A.off(pc.TALL_COMPLETE,r),A.off(pc.ALL_COMPLETE,s),A.off(pc.RESET,B)}},[A,t]);const n=p.useCallback(o=>e.hitNumbers.includes(o),[e.hitNumbers]);return{atsProgress:e,lastCompletedCategory:g,isNumberHit:n,reset:()=>i(fL)}}const QD=t=>`z${t.toLocaleString(void 0,{maximumFractionDigits:0})}`;function hB({value:t,onAdd:A,onClear:e,disabled:i,selectedTimes:g=0,style:I,mini:n=!1,className:o,hideValue:a=!1}){const r=g>0,B=["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}`,i?"is-disabled":"",r?"is-selected":"",n?"chip-container--mini":"",o||""].filter(Boolean).join(" "),c=!!A&&!i;return Q.jsxs("div",{style:I,className:"chip-container",children:[Q.jsxs("button",{type:"button",className:B,onClick:c?()=>{A?.(t)}:void 0,disabled:!c,"aria-label":`Add ${QD(Number(t))}`,title:`Add ${QD(Number(t))}`,style:c?void 0:{pointerEvents:"none"},children:[!a&&Q.jsx("span",{className:"chip__value",children:t>=1e3?`${(Number(t)/1e3).toLocaleString(void 0,{maximumFractionDigits:t>=1e4?0:1})}k`:t}),r&&c&&Q.jsxs("span",{className:"chip__count",children:["×",g]})]}),r&&c&&!!e&&Q.jsx("button",{type:"button",className:"chip-clear","aria-label":`Clear ${QD(Number(t))} chip`,title:`Clear ${QD(Number(t))} chip`,onClick:E=>{E.stopPropagation(),e(t)},children:"×"})]})}function qo(t){return`z${t}`}function Xs(t,A){return t.filter(e=>e.type===A).reduce((e,i)=>e+i.amount,0)}function lqA(t,A){return t*A}function FW(t,A,e){const{phase:i,point:g,balance:I,pendingBets:n,minBet:o,maxBet:a,oddsMultiple:r,committedAddBack:s=0}=e,B=n.reduce((m,U)=>m+U.amount,0),c=Xs(n,t),E=B+A,D=I+s;if(E>D)return{ok:!1,reason:"Insufficient balance"};const y=t==="pass"||t==="dontPass",S=t==="come"||t==="dontCome",f=t==="oddsPass"||t==="oddsDontPass",M=t.startsWith("place");if(y){if(i!=="comeOut"&&g)return{ok:!1,reason:"Line bets locked after point"};if(c===0&&A<o)return{ok:!1,reason:`Minimum ${qo(o)}`}}if(S){if(!g)return{ok:!1,reason:"Come bets only after point"};if(c===0&&A<o)return{ok:!1,reason:`Minimum ${qo(o)}`};if(c+A>a)return{ok:!1,reason:`Max ${qo(a)}`}}if(f){if(!g)return{ok:!1,reason:"Point required for odds"};const U=Xs(n,t==="oddsPass"?"pass":"dontPass");if(!U)return{ok:!1,reason:"Need line bet first"};const F=lqA(U,t==="oddsPass"?r.pass:r.dontPass);if(c+A>F)return{ok:!1,reason:`Max odds ${qo(F)}`}}if(M){if(!g)return{ok:!1,reason:"Place bets only in point phase"};if(c===0&&A<o)return{ok:!1,reason:`Minimum ${qo(o)}`};if(c+A>a)return{ok:!1,reason:`Max ${qo(a)}`}}if(t==="field"||t==="big6"||t==="big8"){if(c===0&&A<o)return{ok:!1,reason:`Minimum ${qo(o)}`};if(c+A>a)return{ok:!1,reason:`Max ${qo(a)}`}}if(t==="atsSmall"||t==="atsTall"||t==="atsAll"){if(c===0&&A<o)return{ok:!1,reason:`Minimum ${qo(o)}`};if(c+A>a)return{ok:!1,reason:`Max ${qo(a)}`}}return{ok:!0}}const QqA=[{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"}],EqA=[{key:"atsSmall",label:"Small"},{key:"atsTall",label:"Tall"},{key:"atsAll",label:"All"}],uqA=[{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 hqA(t,A){const[e,i]=p.useState(25);return p.useEffect(()=>{if(t.length&&!t.includes(e)){const g=t[0];i(g);return}},[t,e]),{selectedChip:e,setSelectedChip:i}}function dqA(t){const{pendingBets:A,myPlayerPlaceTotal:e,myCommittedByType:i}=t;return p.useMemo(()=>typeof e=="number"&&e>0||["place4","place5","place6","place8","place9","place10"].some(I=>Number(i[I]||0)>0)?!0:A.some(I=>I.type.startsWith("place")&&I.amount>0),[e,A,i])}function pqA(t,A,e){const i=p.useRef(null);p.useEffect(()=>{A!==i.current&&(i.current=null)},[A]),p.useEffect(()=>{if(!t||!A||i.current===A)return;const g=e.current||document.querySelector(`.${gt.crapsPlaceRow}`),I=g?g.querySelector(`.${gt.crapsIronCrossBtn}`):document.querySelector(`.${gt.crapsIronCrossBtn}`);if(!I)return;const n=window.setTimeout(()=>{try{I.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},50);return i.current=A,()=>window.clearTimeout(n)},[t,A,e])}function fqA(t,A){const e=p.useRef(null);p.useEffect(()=>{if(!t){e.current=null;return}if(e.current===t)return;const i=A.current||document.querySelector(`.${gt.crapsPlaceRow}`),g=i?i.querySelector(`.${gt.crapsAtsLabel}`):document.querySelector(`.${gt.crapsAtsLabel}`);if(!g)return;const I=window.setTimeout(()=>{try{g.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},100);return e.current=t,()=>window.clearTimeout(I)},[t,A])}function DqA(t,A,e){const i=p.useRef(null);p.useEffect(()=>{if(!t||i.current===t)return;i.current=t;const g=window.setTimeout(()=>{const I=A.current||document.querySelector(`.${gt.crapsMainBets}`),n=e.current||document.querySelector(`.${gt.crapsPlaceRow}`),o=(a,r)=>{if(!a)return;const s=a.scrollWidth,B=a.clientWidth;s<=B||window.setTimeout(()=>{a.scrollTo({left:s,behavior:"smooth"}),window.setTimeout(()=>{a.scrollTo({left:0,behavior:"smooth"})},600)},r)};o(I,0),o(n,150)},500);return()=>window.clearTimeout(g)},[t,A,e])}function yqA(t){const{phase:A,point:e,balance:i,pendingBets:g,minBet:I,maxBet:n,oddsMultiple:o,myPlayerLineTotals:a,myPlayerPlaceTotal:r}=t;return p.useMemo(()=>{const s=(a?.pass??0)+(a?.dontPass??0)+(r??0),B=Xs(g,"pass")+Xs(g,"dontPass")+Xs(g,"place4")+Xs(g,"place5")+Xs(g,"place6")+Xs(g,"place8")+Xs(g,"place9")+Xs(g,"place10"),c=Math.max(0,B-s);return{phase:A,point:e,balance:i,pendingBets:g,minBet:I,maxBet:n,oddsMultiple:o,committedAddBack:s+c}},[A,e,i,g,I,n,o,a?.pass,a?.dontPass,r])}function SqA(t,A){return p.useCallback(e=>{const i=t.find(I=>I.type===e),g=Number(A[e]||0);return i?i.amount===g?g:Math.max(0,i.amount):Math.max(0,g)},[t,A])}function wqA(t,A,e){const i=p.useRef(new Map),g=5e3;p.useEffect(()=>{if(!t.length){i.current.clear();return}const I=Date.now();for(const a of t){const r=`${a.type}:${a.amount}`;i.current.has(r)||i.current.set(r,I)}const n=new Set(t.map(a=>`${a.type}:${a.amount}`));for(const a of i.current.keys())n.has(a)||i.current.delete(a);const o=t.filter(a=>{const r=Number(A[a.type]||0);if(a.amount===0&&r>0)return!0;if(a.amount===r)return!1;const s=`${a.type}:${a.amount}`,B=i.current.get(s)||I;return!(I-B>g)});o.length!==t.length&&e(o)},[t,A,e])}function mqA(t){const{recentSettlements:A,meId:e,myPlayerLineTotals:i}=t,g=p.useMemo(()=>{if(!A.length||!e)return{};const r=A.filter(B=>(B.betType==="pass"||B.betType==="dontPass")&&B.playerId===e),s={};for(const B of r)(B.betType==="pass"?(i?.pass??0)>0:(i?.dontPass??0)>0)&&(s[B.betType]=B.outcome);return s},[A,e,i?.pass,i?.dontPass]),I=p.useMemo(()=>{if(!A.length||!e)return{};const r=A.filter(B=>B.betType.startsWith("place")&&B.playerId===e),s={};for(const B of r)s[B.betType]=B.outcome;return s},[A,e]),n=p.useMemo(()=>{if(!A.length||!e)return{};const r=A.filter(B=>B.betType==="field"&&B.playerId===e),s={};for(const B of r)s[B.betType]=B.outcome;return s},[A,e]),o=p.useMemo(()=>{if(!A.length||!e)return{};const r=A.filter(B=>(B.betType==="big6"||B.betType==="big8")&&B.playerId===e),s={};for(const B of r)s[B.betType]=B.outcome;return s},[A,e]),a=p.useMemo(()=>{if(!A.length||!e)return{};const r=A.filter(B=>(B.betType==="come"||B.betType==="dontCome")&&B.playerId===e),s={};for(const B of r)s[B.betType]=B.outcome;return s},[A,e]);return{lineOutcomeMap:g,placeOutcomeMap:I,fieldOutcomeMap:n,bigOutcomeMap:o,comeOutcomeMap:a}}function kqA(t,A){p.useEffect(()=>{const e=document.querySelectorAll(t),i=[];return e.forEach(g=>{if(g.querySelector(`.${gt.particleContainer}`))return;const I=document.createElement("div");I.className=gt.particleContainer,g.appendChild(I);const n=()=>{const a=document.createElement("div");a.className=gt.particle;const r=Math.random()*100,s=(Math.random()-.5)*40,B=-(80+Math.random()*60),c=1.8+Math.random()*1,E=Math.random()*.3;a.style.setProperty("--start-x",`${r}%`),a.style.setProperty("--drift-x",`${s}px`),a.style.setProperty("--rise-y",`${B}px`),a.style.setProperty("--duration",`${c}s`),a.style.setProperty("--delay",`${E}s`),a.style.left="0",a.style.bottom="0",I.appendChild(a),window.setTimeout(()=>a.remove(),(c+E)*1e3)},o=window.setInterval(n,400+Math.random()*300);i.push(o),n(),window.setTimeout(n,150),window.setTimeout(n,300)}),()=>{i.forEach(g=>window.clearInterval(g)),e.forEach(g=>g.querySelector(`.${gt.particleContainer}`)?.remove())}},[t,A])}function MqA(t){const{recentSettlements:A,meId:e,winSelector:i,floatingClass:g}=t,I=p.useRef(new Set),n=p.useRef(0);p.useEffect(()=>{if(A.length===0&&n.current>0&&I.current.clear(),n.current=A.length,!A.length||!e)return;const a=A.map((s,B)=>({s,idx:B})).filter(({s})=>s.playerId===e&&s.outcome==="WIN"&&s.payout>0).filter(({s,idx:B})=>{const c=`${s.betType}|${s.amount}|${s.payout}|${B}`;return I.current.has(c)?!1:(I.current.add(c),!0)});if(!a.length)return;const r=window.setTimeout(()=>{const s={};a.forEach(({s:c})=>{s[c.betType]=c.payout}),document.querySelectorAll(i).forEach(c=>{const E=c.getAttribute("data-bet-type");if(!E)return;const D=s[E];if(!D)return;try{c.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}catch{}const y=()=>{const S=c.getBoundingClientRect(),f=document.createElement("div");f.className=g,f.textContent=`+${qo(D)}`,f.style.left=`${S.left+S.width/2}px`,f.style.top=`${S.top}px`,document.body.appendChild(f),window.setTimeout(()=>f.remove(),2500)};E.startsWith("place")?window.setTimeout(y,500):y()})},50);return()=>window.clearTimeout(r)},[A,e,i,g])}function NqA(t){const{roomId:A,balance:e,phase:i,point:g,shooterName:I,minBet:n,maxBet:o,oddsMultiple:a,chips:r,pendingBets:s,onChangeBets:B,onClearAll:c,disabled:E,onRoll:D,canRoll:y,myPlayerPlaceTotal:S,readyPlayers:f=[],meId:M,onBetDelta:k,onBetsBatch:m,showReadyButton:U,onReadyClick:F,readyStateLabel:b,readyButtonDisabled:K,countdownSeconds:R=0,recentSettlements:G=[],myPlayerLineTotals:J,othersTotals:x,myCommittedByType:H={},onPassTurn:P,canPassTurn:j,onChargeChange:q}=t,Y=E,{selectedChip:O,setSelectedChip:$}=hqA(r),{atsProgress:gA,lastCompletedCategory:z}=cqA(A??null),[X,sA]=p.useState(!1),[rA,mA]=p.useState(),[IA,uA]=p.useState(),{info:KA}=lH(),FA=p.useRef(!1),RA=p.useRef(null),MA=p.useRef(0),oA=50,AA=oA/1200,tA=i==="comeOut"&&!g,iA=i==="point"&&!!g,hA=!1,DA=p.useRef(null),dA=p.useRef(null),SA=p.useRef(null),NA=p.useRef(gA.betsLocked),OA=dqA({pendingBets:s,myPlayerPlaceTotal:S,myCommittedByType:H}),Qe=i==="point"&&!!g&&!OA;pqA(Qe,g,dA),fqA(z,dA),DqA(A,DA,dA),p.useEffect(()=>{const Ge=NA.current,lt=gA.betsLocked;NA.current=lt,Ge!==lt&&(lt&&SA.current?SA.current.scrollTo({left:SA.current.scrollWidth,behavior:"smooth"}):!lt&&SA.current&&SA.current.scrollTo({left:0,behavior:"smooth"}))},[gA.betsLocked]);const nA=p.useCallback(()=>{FA.current||(FA.current=!0,Cg(),MA.current=0,q?.(0),RA.current&&clearInterval(RA.current),RA.current=setInterval(()=>{MA.current=Math.min(1,MA.current+AA),q?.(MA.current),MA.current>=.95?xt("Heavy"):MA.current>=.6?xt("Medium"):MA.current>=.25&&xt("Light")},oA))},[q]),eA=p.useCallback(()=>{if(FA.current){if(FA.current=!1,RA.current&&(clearInterval(RA.current),RA.current=null),MA.current=0,q?.(0),i==="point"&&!OA)try{KA("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}D?.()}},[i,OA,KA,D,q]),UA=yqA({phase:i,point:g,balance:e,pendingBets:s,minBet:n,maxBet:o,oddsMultiple:a,myPlayerLineTotals:J,myPlayerPlaceTotal:S}),HA=SqA(s,H);wqA(s,H,B);const Se=p.useMemo(()=>{const Ge=Xs(s,"pass")>0||Xs(s,"dontPass")>0,lt=(J?.pass??0)>0||(J?.dontPass??0)>0,Rt=HA("pass")>0||HA("dontPass")>0;return Ge||lt||Rt},[s,J?.pass,J?.dontPass,HA]),{lineOutcomeMap:ne,placeOutcomeMap:Oe,fieldOutcomeMap:VA,bigOutcomeMap:de,comeOutcomeMap:te}=mqA({recentSettlements:G,meId:M,myPlayerLineTotals:J}),WA=p.useMemo(()=>`.${gt.spotBtn}[data-win-outcome="true"]`,[]),_A=p.useMemo(()=>JSON.stringify({lineOutcomeMap:ne,placeOutcomeMap:Oe,fieldOutcomeMap:VA,bigOutcomeMap:de,comeOutcomeMap:te}),[ne,Oe,VA,de,te]);kqA(WA,_A),MqA({recentSettlements:G,meId:M,winSelector:WA,floatingClass:gt.floatingWinAmount});const zA=p.useMemo(()=>{const Ge=new Set;for(const lt of s){const Rt=Number(H[lt.type]||0);lt.amount!==Rt&&Ge.add(lt.type)}return Ge},[s,H]),ge=p.useRef(new Set);p.useEffect(()=>{const Ge=ge.current,lt=zA;for(const Rt of Ge)if(!lt.has(Rt)){try{JlA({volume:.03})}catch{}break}ge.current=new Set(lt)},[zA]),zA.size>0,p.useMemo(()=>zA.size>0,[zA]);const he=p.useCallback((Ge,lt)=>{if(lt===0)return;const Rt=s.find(Be=>Be.type===Ge);if(lt>0){const Be=lt,{ok:jA,reason:Me}=FW(Ge,Be,UA);if(!jA){if(mA(Me),uA(Ge),Me==="Insufficient balance")try{KA("Insufficient funds","Add chips to place this bet")}catch{}window.setTimeout(()=>uA(void 0),600);return}if(Rt)B(s.map(We=>We===Rt?{...We,amount:We.amount+Be}:We));else{const We=Number(H[Ge]||0);B([...s,{id:IL(),type:Ge,amount:We+Be}])}k?.(Ge,Be);return}let Yt=Rt?.amount??0;if(!Rt){const Be=Number(H[Ge]||0);if(Be<=0)return;Yt=Be}const st=Yt+lt;B(Rt?s.map(Be=>Be===Rt?{...Be,amount:Math.max(0,st)}:Be):[...s,{id:IL(),type:Ge,amount:Math.max(0,st)}]),k?.(Ge,lt)},[s,B,n,H,UA,k,KA]),ve=p.useCallback((Ge,lt)=>{const Rt=Ge==="oddsPass",Yt=Ge==="oddsDontPass",st=Ge==="atsSmall"||Ge==="atsTall"||Ge==="atsAll",Be=Ge==="pass"||Ge==="dontPass"?iA:Rt?i!=="point"||!g||HA("pass")===0:Yt?i!=="point"||!g||HA("dontPass")===0:Ge.startsWith("place")||Ge==="come"||Ge==="dontCome"?!g:st?i!=="comeOut"||gA.betsLocked:!1,jA=Ge==="pass"||Ge==="dontPass",Me=Ge==="come"||Ge==="dontCome",We=!Ge.startsWith("place"),at=jA&&iA,kA=jA?ne[Ge]:Ge==="field"?VA[Ge]:Ge==="big6"||Ge==="big8"?de[Ge]:Me?te[Ge]:void 0,ae=kA==="WIN"?gt.lineWin:kA==="LOSE"?gt.lineLose:kA==="PUSH"?gt.linePush:"",Ye=jA&&tA&&!Se,Pt=[gt.spotBtn,gt.crapsBetTile,Ge.startsWith("place")?gt.crapsPlaceTile:"",Be?gt.locked:"",IA===Ge?gt.shake:"",ae,Ye?gt.attnHalo:"",Ge.startsWith("place")&&Qe?gt.attnHalo:""],jt=E||hA,aA=x&&typeof x[Ge]=="number"?x[Ge]:0,QA=HA(Ge);if(We){const GA=[...Pt,gt.spotBtnTopRow,"gold-link",jt?gt.disabled:""].filter(Boolean).join(" ");return Q.jsxs(uB.a,{role:"button",tabIndex:0,"aria-disabled":jt||void 0,className:GA,"data-bet-type":Ge,"data-attn":Ye?"need-line":void 0,"data-has-bet":QA>0?"true":"false","data-win-outcome":kA==="WIN"?"true":"false","data-no-global-haptic":!0,"aria-label":`Place bet on ${lt}, +${O}`,onClick:oe=>{oe.preventDefault(),!Be&&!jt&&(Cg(),xt("Light"),he(Ge,O))},onKeyDown:oe=>{(oe.key==="Enter"||oe.key===" ")&&!Be&&!jt&&(oe.preventDefault(),Cg(),xt("Light"),he(Ge,O))},whileTap:{scale:.94},children:[lt,aA>0&&Q.jsx("div",{className:gt.aggBadge,"aria-label":`Others ${lt} total ${qo(aA)}`,children:qo(aA)}),QA>0&&Q.jsxs("div",{className:gt.amountBadge+(at?" "+gt.amountBadgeDisabled:""),"aria-disabled":at||void 0,children:[!at&&Q.jsx("span",{role:"button",tabIndex:0,className:[gt.badgeMinus,gt.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${lt}`,onClick:oe=>{oe.stopPropagation(),Cg(),xt("Light"),he(Ge,-O)},onKeyDown:oe=>{(oe.key==="Enter"||oe.key===" ")&&(oe.preventDefault(),oe.stopPropagation(),Cg(),xt("Light"),he(Ge,-O))},children:"−"}),qo(QA),at&&Q.jsx("span",{className:gt.lockIcon,"aria-hidden":"true",children:"🔒"}),kA&&Q.jsx("span",{className:gt.outcomeBadge,"aria-label":`Outcome ${kA}`,children:kA==="WIN"?"✓":kA==="LOSE"?"✕":"⟳"})]}),IA===Ge&&rA&&Q.jsx("div",{className:gt.tooltip,children:rA})]},Ge)}const JA=Ge.startsWith("place")?Oe[Ge]:Ge==="field"?VA[Ge]:Ge==="big6"||Ge==="big8"?de[Ge]:void 0,ee=Pt.filter(Boolean).join(" ");return Q.jsxs(uB.button,{type:"button",className:ee,"data-bet-type":Ge,"data-attn":Ge.startsWith("place")&&Qe?"need-places":void 0,"data-has-bet":QA>0?"true":"false","data-win-outcome":kA==="WIN"||JA==="WIN"?"true":"false","aria-label":`Place bet on ${lt}, +${O}`,onClick:()=>{!Be&&!jt&&(Cg(),xt("Light"),he(Ge,O))},disabled:E||hA,whileTap:{scale:.94},children:[lt,aA>0&&Q.jsx("div",{className:gt.aggBadge,"aria-label":`Others ${lt} total ${qo(aA)}`,children:qo(aA)}),QA>0&&Q.jsxs("div",{className:gt.amountBadge+(at?" "+gt.amountBadgeDisabled:""),"aria-disabled":at||void 0,children:[!at&&Q.jsx("span",{role:"button",tabIndex:0,className:[gt.badgeMinus,gt.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${lt}`,onClick:GA=>{GA.stopPropagation(),Cg(),xt("Light"),he(Ge,-O)},onKeyDown:GA=>{(GA.key==="Enter"||GA.key===" ")&&(GA.preventDefault(),GA.stopPropagation(),Cg(),xt("Light"),he(Ge,-O))},children:"−"}),qo(QA),at&&Q.jsx("span",{className:gt.lockIcon,"aria-hidden":"true",children:"🔒"}),kA&&Q.jsx("span",{className:gt.outcomeBadge,"aria-label":`Outcome ${kA}`,children:kA==="WIN"?"✓":kA==="LOSE"?"✕":"⟳"})]}),IA===Ge&&rA&&Q.jsx("div",{className:gt.tooltip,children:rA})]},Ge)},[he,E,hA,HA,rA,IA,tA,Se,Qe,O,iA,i,g,ne,Oe,VA,de,te,x,gA.betsLocked]),bA=p.useMemo(()=>{const Ge=[...QqA],lt=(Rt,Yt,st)=>{const Be=Ge.findIndex(jA=>jA.key===Rt);Be>=0&&!Ge.some(jA=>jA.key===Yt)&&Ge.splice(Be+1,0,{key:Yt,label:st})};return lt("pass","oddsPass","Odds Pass"),lt("dontPass","oddsDontPass","Odds Don't"),Ge},[]),pA=p.useMemo(()=>bA.map(Ge=>ve(Ge.key,Ge.label)),[bA,ve]),Re=p.useMemo(()=>uqA.map(Ge=>ve(Ge.key,Ge.label)),[ve]),CA=p.useMemo(()=>EqA.map(Ge=>ve(Ge.key,Ge.label)),[ve]),EA=p.useCallback(()=>{if(E||hA)return;Cg(),xt("Light");const Ge=["place4","place5","place6","place8","place9","place10"],lt=[];for(const Yt of Ge){s.find(Me=>Me.type===Yt);const st=O,{ok:Be,reason:jA}=FW(Yt,st,UA);if(!Be){if(mA(jA),uA(Yt),jA==="Insufficient balance")try{KA("Insufficient funds","Add chips to place All Places bet")}catch{}window.setTimeout(()=>uA(void 0),600);return}lt.push({type:Yt,delta:st})}let Rt=[...s];for(const{type:Yt,delta:st}of lt){const Be=Rt.find(jA=>jA.type===Yt);if(Be)Rt=Rt.map(jA=>jA===Be?{...jA,amount:jA.amount+st}:jA);else{const jA=Number(H[Yt]||0);Rt.push({id:IL(),type:Yt,amount:jA+st})}}B(Rt),m?m(lt.map(({type:Yt,delta:st})=>({type:Yt,amount:st}))):k&&lt.forEach(({type:Yt,delta:st})=>k(Yt,st))},[E,hA,s,O,n,UA,B,H,m,k,KA]),yA=!!U,xA=yA?b||"Ready":"Roll",XA=yA?!!K:Y||y===!1,pe=!yA&&!XA&&y!==!1&&(i!=="point"||OA),[be,It]=p.useState(!1),Ut=p.useRef(null);p.useEffect(()=>{if(!be)return;const Ge=lt=>{Ut.current&&!Ut.current.contains(lt.target)&&It(!1)};return document.addEventListener("mousedown",Ge),()=>document.removeEventListener("mousedown",Ge)},[be]);const pg=I;return Q.jsxs("div",{className:[gt.panelRoot,E?gt.disabled:""].join(" "),children:[Q.jsxs("div",{className:gt.crapsStatusBar,children:[Q.jsxs("div",{className:gt.chipPickerWrapper,ref:Ut,children:[Q.jsx("div",{className:[gt.chipPickerToggle,be?gt.chipPickerToggleOpen:""].join(" "),onClick:()=>{Cg(),xt("Light"),It(Ge=>!Ge)},role:"button",tabIndex:0,"aria-label":`Selected chip ${O}, click to change`,"aria-expanded":be,onKeyDown:Ge=>{(Ge.key==="Enter"||Ge.key===" ")&&(Ge.preventDefault(),Cg(),xt("Light"),It(lt=>!lt))},children:Q.jsx(hB,{value:O,mini:!0,className:gt.chipPickerChip,onAdd:()=>{Cg(),xt("Light"),It(Ge=>!Ge)}})}),be&&Q.jsx("div",{className:gt.chipPickerDropdown,children:r.map(Ge=>Q.jsx("div",{className:[gt.chipPickerOption,Ge===O?gt.chipPickerOptionSelected:""].join(" "),children:Q.jsx(hB,{value:Ge,mini:!0,className:Ge===O?gt.chipPickerChipSelected:"",onAdd:()=>{Cg(),AAA(),$(Ge),It(!1)}})},Ge))})]}),Q.jsxs("span",{className:gt.crapsStatusText,children:[Q.jsx("span",{className:gt.mobileHide,children:i==="comeOut"?"COME-OUT":"POINT"}),Q.jsx("span",{className:gt.mobileShow,children:i==="comeOut"?"CO":"PT"})," • ",Q.jsx("span",{className:gt.mobileHide,children:"SHOOTER: "}),Q.jsx("strong",{className:gt.crapsHighlight,children:pg})," • ",Q.jsx("span",{className:gt.mobileHide,children:"POINT: "}),Q.jsx("span",{className:gt.mobileShow,children:"P: "}),Q.jsx("strong",{className:gt.crapsHighlight,children:g??"—"})]}),Q.jsx("button",{type:"button",className:gt.betInfoBtn,onClick:()=>{xt("Light"),sA(!0)},"aria-label":"Show bet information",children:Q.jsx(Fc,{icon:ANA})})]}),Q.jsx(WLA,{open:X,onClose:()=>sA(!1)}),Q.jsx("div",{className:[gt.spotRow,gt.crapsMainBets].join(" "),ref:DA,children:pA}),Q.jsxs("div",{className:gt.crapsPlaceRow,ref:dA,children:[Re,Q.jsx("button",{type:"button",className:[gt.spotBtn,gt.crapsBetTile,gt.crapsIronCrossBtn].join(" "),onClick:EA,disabled:!g||E||hA,"aria-label":"Place All Places (4/5/6/8/9/10)",children:"All Places"})]}),Q.jsxs("div",{className:gt.crapsAtsSection,ref:SA,children:[Q.jsx("span",{className:gt.crapsAtsLabel,children:"ATS"}),CA,Q.jsx(BqA,{hitNumbers:gA.hitNumbers,smallProgress:gA.smallProgress,tallProgress:gA.tallProgress,allProgress:gA.allProgress,betsLocked:gA.betsLocked,lastCompletedCategory:z,inline:!0})]}),Q.jsx("div",{className:gt.crapsActionsBar,children:Q.jsxs("div",{className:gt.actions,children:[Q.jsxs("button",{type:"button",className:[gt.actionBtn,gt.rollBtn,gt.crapsActionButton,gt.crapsActionButtonPrimary,pe?gt.rollHaloActive:""].join(" "),onClick:Ge=>{if(yA){if(K)return;try{Cg(),xt("Light")}catch{}F?.();return}if(FA.current){Ge.preventDefault();return}if(!XA){q?.(1),Cg(),xt("Medium");try{i==="point"&&!OA&&KA("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}D?.(),q?.(0)}},onPointerDown:()=>{yA||XA||(nA(),xt("Medium"))},onPointerUp:()=>{yA||eA()},onPointerCancel:()=>{eA()},onPointerLeave:()=>{eA()},disabled:XA,"aria-label":yA?"Mark ready":"Roll dice",children:[!yA&&Q.jsx(Fc,{icon:VMA,className:gt.rollIcon,"aria-hidden":"true"}),xA,yA&&R>0&&Q.jsx("span",{className:[gt.countdownBadge,R<=5?gt.countdownCritical:R<=10?gt.countdownUrgent:""].join(" "),"aria-label":`${R} seconds remaining`,children:R})]}),!U&&j&&P&&Q.jsx("button",{type:"button",className:[gt.actionBtn,gt.crapsActionButton,gt.crapsActionButtonSecondary].join(" "),onClick:()=>{try{Cg(),xt("Light")}catch{}P()},"aria-label":"Pass dice to next shooter",children:"Pass"}),Q.jsxs("button",{type:"button",className:[gt.actionBtn,gt.clear,gt.crapsActionButton,gt.crapsActionButtonSecondary].join(" "),onClick:()=>{Cg(),xt("Light"),c()},"aria-label":"Clear all bets",children:[Q.jsx("span",{className:gt.crapsClearIcon,"aria-hidden":"true",children:"✕"})," Clear"]})]})}),Q.jsx("div",{className:gt.errorLive,"aria-live":"polite",children:rA||""})]})}function GqA(t,A){const{crapsGetState:e,crapsJoinOrder:i,crapsLeaveOrder:g,crapsSetOrder:I,crapsRoll:n,crapsResetShooter:o,crapsReady:a,crapsPassTurn:r}=OI(),s=A?.enabled??!0;return{getState:B=>s&&t?e(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0,joinOrder:B=>s&&t?i(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0,leaveOrder:B=>s&&t?g(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0,setOrder:(B,c)=>s&&t?I(t,B).then(E=>(c?.(E),E)).catch(E=>(c?.({ok:!1,error:E?.message||"ERR"}),{ok:!1,error:E?.message||"ERR"})):void 0,roll:B=>s&&t?n(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0,resetShooter:B=>s&&t?o(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0,ready:B=>s&&t?a(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0,passTurn:B=>s&&t?r(t).then(c=>(B?.(c),c)).catch(c=>(B?.({ok:!1,error:c?.message||"ERR"}),{ok:!1,error:c?.message||"ERR"})):void 0}}let Kw={},RqA=1;function JgA(t){const{roomId:A,myPlayerId:e,autoJoinOrder:i=!0,onRoll:g,onState:I}=t,{crapsReady:n}=OI(),o=(()=>{try{return Cs&&Cs()}catch{return null}})(),a=o?.room??null,r=o?.setRoom??(()=>{}),B=a?.gameState?.gameMode==="craps",c=GqA(A,{enabled:B}),E=p.useMemo(()=>{const oA=a?.gameState;return!oA||oA.gameMode!=="craps"?null:{point:oA.crapsPoint??null,currentRollerId:oA.currentRollerId??null,turnOrder:oA.turnOrder??[]}},[a?.gameState]),[D,y]=p.useState(null),[S,f]=p.useState([]),[M,k]=p.useState(!1),m=p.useRef(!1),[U,F]=p.useState([]),[b,K]=p.useState(null),[R,G]=p.useState([]),J=p.useRef(null),x=p.useRef(null),H=p.useRef(null),P=p.useRef(null),j=p.useRef(null),{triggerSpin:q}=kQ(),Y=p.useRef(null),O=p.useRef(null),$=p.useRef(null),gA=2e3,z=600,X=p.useMemo(()=>!!(e&&E?.turnOrder.includes(e)),[e,E?.turnOrder]),sA=p.useCallback(()=>{B&&c.getState?.()},[c,B]),rA=p.useCallback(oA=>{!B||!A||m.current||(m.current=!0,c.joinOrder?.(AA=>{m.current=!1,oA?.(AA?.ok,AA?.data)}))},[c,A,B]),mA=p.useCallback(oA=>{!B||!A||m.current||(m.current=!0,c.leaveOrder?.(AA=>{m.current=!1,oA?.(AA?.ok,AA?.data)}))},[c,A,B]),IA=p.useCallback((oA,AA)=>{!B||!A||m.current||(m.current=!0,c.setOrder?.(oA,tA=>{m.current=!1,AA?.(tA?.ok,tA?.data)}))},[c,A,B]),uA=p.useCallback(oA=>{if(!(!B||!A||m.current)){m.current=!0,k(!0),y(null),$.current=Date.now(),q();try{const AA=c.roll?.();AA&&typeof AA.then=="function"?AA.then(tA=>{const iA=!!tA?.ok,hA=String(tA?.error||"");if(m.current=!1,!iA)try{const DA=/invalid_payload/i.test(hA),dA=/no_room/i.test(hA),SA=/forbidden|unauthorized/i.test(hA);if(DA||dA||SA){O.current&&(window.clearTimeout(O.current),O.current=null),k(!1),$.current=null,sA(),oA?.(!1,tA?.data);return}}catch{}try{O.current&&(window.clearTimeout(O.current),O.current=null),O.current=window.setTimeout(()=>{k(!1),$.current=null,O.current=null},Math.max(gA,4e3))}catch{}oA?.(iA,tA?.data)}).catch(()=>{m.current=!1,k(!1),$.current=null;try{sA()}catch{}oA?.(!1)}):(m.current=!1,k(!1),$.current=null,oA?.(!1))}catch{m.current=!1,k(!1),$.current=null,oA?.(!1)}}},[c,A,B]),KA=p.useCallback(oA=>{if(!(!B||!A||m.current)){m.current=!0;try{const AA=c.resetShooter?.();AA&&typeof AA.then=="function"?AA.then(tA=>{m.current=!1,oA?.(!!tA?.ok,tA?.data)}).catch(()=>{m.current=!1,oA?.(!1)}):(m.current=!1,oA?.(!1))}catch{m.current=!1,oA?.(!1)}}},[c,A,B]),FA=p.useCallback(oA=>{if(!(!B||!A||m.current)){m.current=!0;try{const AA=c.passTurn?.();AA&&typeof AA.then=="function"?AA.then(tA=>{m.current=!1,oA?.(!!tA?.ok,tA?.data)}).catch(tA=>{m.current=!1,oA?.(!1)}):(m.current=!1,oA?.(!1))}catch{m.current=!1,oA?.(!1)}}},[c,A,B]),RA=p.useRef(0);RA.current===0&&(RA.current=RqA++);const MA=p.useMemo(()=>A?Kw[A]?Kw[A]===RA.current:(Kw[A]=RA.current,!0):!1,[A]);return p.useEffect(()=>()=>{try{A&&Kw[A]===RA.current&&delete Kw[A]}catch{}},[A]),$n({onJoinedRoom:({room:oA})=>{if(MA)try{if(!A||!oA||oA.id!==A)return;if(P.current){const AA=P.current.cb;P.current=null,(async()=>{try{const tA=await n(A);AA?.(!!tA?.ok,tA?.data)}catch{AA?.(!1)}})()}}catch{}},onRejoinedRoom:({room:oA})=>{if(MA)try{if(!A||!oA||oA.id!==A)return;if(P.current){const AA=P.current.cb;P.current=null,(async()=>{try{const tA=await n(A);AA?.(!!tA?.ok,tA?.data)}catch{AA?.(!1)}})()}}catch{}},onCrapsState:oA=>{if(!MA||!A||oA.roomId!==A)return;const AA=oA.state?.currentRollerId??oA.state?.currentShooterId??oA.state?.shooterId??null,tA=oA.state?.turnOrder||oA.state?.shooterOrder||[],iA=oA.state?.point??oA.state?.crapsPoint??null;try{r(hA=>{if(!hA||hA.id!==A)return hA;const DA=hA.gameState||{},dA=iA?"point":"come-out";return{...hA,gameState:{...DA,gameMode:DA.gameMode||"craps",crapsPoint:iA,currentRollerId:AA,turnOrder:tA,crapsPhase:dA}}})}catch{}try{I?.({point:iA,currentRollerId:AA,turnOrder:tA})}catch{}i&&e&&!tA.includes(e)&&rA()},onCrapsPointSet:oA=>{if(MA)try{if(!A||oA?.roomId!==A)return;const AA=oA?.point??oA?.crapsPoint??null;r(tA=>{if(!tA||tA.id!==A)return tA;const iA={...tA.gameState||{}};return AA!=null&&(iA.crapsPoint=AA,iA.crapsPhase="point"),{...tA,gameState:iA}})}catch{}},onCrapsRollResult:oA=>{if(!MA||!A||oA?.roomId!==A)return;let AA,tA;if(Array.isArray(oA?.dice)?[AA,tA]=oA.dice:(AA=oA?.d1,tA=oA?.d2),typeof AA!="number"||typeof tA!="number")return;const iA=typeof oA.total=="number"?oA.total:AA+tA,hA=oA.currentRollerId??oA.currentShooterId??oA.shooterId??null,DA=oA.nextRollerId??oA.nextShooterId??oA.nextShooter??null,dA={roomId:oA.roomId,dice:[AA,tA],total:iA,point:oA.point??oA.crapsPoint??null,currentRollerId:hA,nextRollerId:DA,events:Array.isArray(oA.events)?oA.events:[],resolutions:oA.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1}};$.current||($.current=Date.now(),y(null),q());try{m.current=!1,k(!0),Y.current&&(window.clearTimeout(Y.current),Y.current=null);const SA=$.current?Date.now()-$.current:0,NA=Math.max(gA-SA,0)+z;Y.current=window.setTimeout(()=>{k(!1),$.current=null,Y.current=null},NA),O.current&&(window.clearTimeout(O.current),O.current=null)}catch{}y(dA),f(SA=>{const NA=Date.now(),OA=30,Qe=900;for(let UA=0;UA<SA.length&&UA<5;UA++){const HA=SA[UA];if(HA.dice[0]===dA.dice[0]&&HA.dice[1]===dA.dice[1]&&NA-HA.ts<Qe)return SA}const eA=[{...dA,ts:NA,phase:dA.point?"point":"come-out"},...SA];eA.length>OA&&(eA.length=OA);try{if(A){const UA={v:1,roomId:A,ts:NA,items:eA};pF(`craps-roll-history:${A}`,UA)}}catch{}return eA});try{const SA=DA||null;F(SA?[SA]:[]),K(null)}catch{}try{(oA.gameState||oA.point!==void 0||oA.currentRollerId!==void 0||oA.nextRollerId!==void 0)&&r(SA=>{if(!SA||SA.id!==A)return SA;const OA={...SA.gameState||{}};(oA.point!==void 0||oA.crapsPoint!==void 0)&&(OA.crapsPoint=oA.point??oA.crapsPoint);const Qe=DA??hA;return Qe!==void 0&&(OA.currentRollerId=Qe),(Array.isArray(oA.turnOrder)||Array.isArray(oA.shooterOrder))&&(OA.turnOrder=oA.turnOrder||oA.shooterOrder),OA.gameMode||(OA.gameMode="craps"),OA.crapsPhase=OA.crapsPoint?"point":"come-out",{...SA,gameState:OA}})}catch{}g?.(dA)},onCrapsReadyUpdate:oA=>{if(MA)try{const AA=Array.isArray(oA?.readyPlayers)?oA.readyPlayers:void 0,tA=Array.isArray(oA?.requiredReadyPlayers)?oA.requiredReadyPlayers:void 0,iA=oA&&Object.prototype.hasOwnProperty.call(oA,"deadline"),hA=iA?typeof oA.deadline=="number"?oA.deadline:null:void 0,DA=(dA,SA)=>{if(!dA&&!SA)return!0;if(!dA||!SA||dA.length!==SA.length)return!1;for(let NA=0;NA<dA.length;NA++)if(dA[NA]!==SA[NA])return!1;return!0};AA&&(DA(J.current,AA)||(J.current=AA.slice(),F(AA))),tA&&(DA(x.current,tA)||(x.current=tA.slice(),G(tA))),iA&&H.current!==hA&&(H.current=hA===void 0?H.current:hA,K(hA))}catch{}},onCrapsBetsUpdate:oA=>{if(MA)try{const AA=oA?.snapshot||{};r(tA=>{if(!tA||tA.id!==A)return tA;const iA={...tA.gameState||{}};for(const hA of Object.keys(AA))iA[hA]=AA[hA];return iA.gameMode||(iA.gameMode="craps"),{...tA,gameState:iA}})}catch{}}}),p.useEffect(()=>{!A||!B||MA&&sA()},[A,B]),p.useEffect(()=>{try{const oA=a?.gameState;if(!oA||oA.gameMode!=="craps")return;const AA=oA.crapsReadiness;AA&&(Array.isArray(AA.readyPlayers)&&F(AA.readyPlayers),Array.isArray(AA.requiredReadyPlayers)&&G(AA.requiredReadyPlayers),Object.prototype.hasOwnProperty.call(AA,"deadline")&&K(typeof AA.deadline=="number"?AA.deadline:null))}catch{}},[a?.gameState]),p.useEffect(()=>{if(!B||!A||!MA)return;let oA=0;const AA=500,tA=()=>{try{const dA=Date.now();if(dA-oA<AA)return;oA=dA,sA()}catch{}},iA=()=>{document.visibilityState==="visible"&&tA()},hA=()=>{tA()},DA=()=>{tA()};return window.addEventListener("visibilitychange",iA),window.addEventListener("focus",hA),window.addEventListener("ad:complete",DA),()=>{window.removeEventListener("visibilitychange",iA),window.removeEventListener("focus",hA),window.removeEventListener("ad:complete",DA)}},[B,A,sA,MA]),p.useEffect(()=>{A&&(async()=>{try{const oA=await TD(`craps-roll-history:${A}`);if(!oA)return;if(oA&&oA.v===1&&Array.isArray(oA.items)){if(typeof oA.ts=="number"&&Date.now()-oA.ts>72e5)return;const tA=[];for(const iA of oA.items)if(!(!iA||!Array.isArray(iA.dice)||iA.dice.length!==2)&&!(typeof iA.total!="number"||typeof iA.ts!="number")&&(tA.push({roomId:A,dice:[Number(iA.dice[0]),Number(iA.dice[1])],total:Number(iA.total),point:typeof iA.point=="number"?iA.point:iA.point??null,currentRollerId:iA.currentRollerId??null,nextRollerId:iA.nextRollerId??null,events:Array.isArray(iA.events)?iA.events.slice(0,8):[],resolutions:iA.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1},ts:iA.ts,phase:iA.phase==="point"?"point":"come-out"}),tA.length>=30))break;tA.length&&f(tA)}}catch{}})()},[A]),p.useEffect(()=>()=>{Y.current&&(window.clearTimeout(Y.current),Y.current=null),O.current&&(window.clearTimeout(O.current),O.current=null),j.current&&(window.clearTimeout(j.current),j.current=null)},[]),{shooterState:E,lastRoll:D,rollHistory:S,rolling:M,inTurnOrder:X,joinOrder:rA,leaveOrder:mA,setOrder:IA,roll:uA,resetShooter:KA,passTurn:FA,requestState:sA,readyPlayers:U,readinessDeadline:b,requiredReadyPlayers:R,ready:oA=>{if(!A||!B)return;const AA=!!(a&&a.id===A);if(e&&!U.includes(e)&&F(tA=>[...tA,e]),b||K(Date.now()+5e3),!AA){P.current={cb:oA,at:Date.now()};try{j.current&&(window.clearTimeout(j.current),j.current=null),j.current=window.setTimeout(async()=>{try{if(!P.current)return;const tA=await n(A),iA=P.current?.cb;P.current=null,iA?.(!!tA?.ok,tA?.data)}catch{const tA=P.current?.cb;P.current=null,tA?.(!1)}finally{j.current&&(window.clearTimeout(j.current),j.current=null)}},600)}catch{}return}(async()=>{try{const tA=await n(A);if(!tA?.ok){const iA=String(tA?.error||""),hA=/forbidden|unauthorized/i.test(iA),DA=/ready_failed/i.test(iA);if(hA||DA){try{sA()}catch{}try{const dA=await n(A);oA?.(!!dA?.ok,dA?.data);return}catch{}}oA?.(!1);return}oA?.(!0,tA?.data)}catch{try{setTimeout(async()=>{try{const tA=await n(A);oA?.(!!tA?.ok,tA?.data)}catch{oA?.(!1)}},400)}catch{oA?.(!1)}}})()},iAmReady:!!(e&&U.includes(e)),clearRollHistory:()=>{f([]);try{A&&YD(`craps-roll-history:${A}`)}catch{}}}}function UqA(t){const{roomId:A,userId:e,shooterState:i,roomGameState:g,myLineFromUnified:I,betsLastUpdated:n}=t;if(!A||!e)return!1;const o=g?.currentRollerId,a=i?.currentRollerId||null;if(!!!(e&&(o?o===e:a===e)))return!1;let s;const B=g?.crapsPassBets,c=g?.crapsDontPassBets;if(Array.isArray(B)||Array.isArray(c))s=!!(B?.some(y=>y.playerId===e&&y.amount>0)||c?.some(y=>y.playerId===e&&y.amount>0));else if(typeof n=="number")if(n===0)s=!0;else{const y=Number(I?.pass||0),S=Number(I?.dontPass||0);s=y>0||S>0}else{const y=Number(I?.pass||0),S=Number(I?.dontPass||0);s=y>0||S>0}if(!s)return!1;const E=Array.isArray(i?.turnOrder)&&i.turnOrder.length?i.turnOrder:Array.isArray(g?.turnOrder)?g.turnOrder:[];return!!(e&&E.includes(e))}const DL=new Map,yL={pass:[],dontPass:[],odds:[],place:[],field:[],big:[],come:[],dontCome:[],ats:[],lastUpdated:0};function LgA(t){const{roomId:A,myPlayerId:e,autoListOnMount:i=!0,autoClearSettlementsMs:g=8e3}=t;Xn();const{room:I,setRoom:n}=Cs(),[o,a]=p.useState(yL),r=p.useRef(yL),[s,B]=p.useState([]),[c,E]=p.useState(null),[D,y]=p.useState(null),[S,f]=p.useState(null),[M,k]=p.useState([]),[m,U]=p.useState([]),[F,b]=p.useState(null),K=p.useRef(null),R=p.useRef(!1),G=p.useRef(0),J=p.useRef(new Map),{crapsListBets:x,crapsAddBet:H,crapsRemoveBet:P,crapsClearBets:j,crapsSummarizeBets:q}=OI(),Y=p.useCallback(tA=>{if(!A)return;const iA=DL.get(A);if(iA)return tA&&iA.then(DA=>tA(DA)).catch(DA=>tA({ok:!1,error:String(DA?.message||DA)})),iA;const hA=x(A);return DL.set(A,hA),hA.finally(()=>{DL.delete(A)}),tA&&hA.then(DA=>tA(DA)).catch(DA=>tA({ok:!1,error:String(DA?.message||DA)})),hA},[x,A]),O=p.useCallback((tA,iA)=>{!e||iA<=0||a(hA=>{const DA={...hA,lastUpdated:Date.now()};if(tA==="pass")hA.pass.find(SA=>SA.playerId===e)?DA.pass=hA.pass.map(SA=>SA.playerId===e?{...SA,amount:SA.amount+iA}:SA):DA.pass=[...hA.pass,{playerId:e,amount:iA}];else if(tA==="dontPass")hA.dontPass.find(SA=>SA.playerId===e)?DA.dontPass=hA.dontPass.map(SA=>SA.playerId===e?{...SA,amount:SA.amount+iA}:SA):DA.dontPass=[...hA.dontPass,{playerId:e,amount:iA}];else if(tA.startsWith("place")){const dA=tA.match(/^place(\d+)$/);if(dA){const SA=Number(dA[1]);hA.place.find(OA=>OA.playerId===e&&OA.point===SA)?DA.place=hA.place.map(OA=>OA.playerId===e&&OA.point===SA?{...OA,amount:OA.amount+iA}:OA):DA.place=[...hA.place,{playerId:e,point:SA,amount:iA}]}}return r.current=DA,DA})},[e]),$=p.useCallback((tA,iA,hA)=>{if(!A)return;O(tA,iA);const DA=H(A,tA,iA);return hA&&DA.then(dA=>hA(dA)).catch(dA=>hA({ok:!1,error:String(dA?.message||dA)})),DA},[H,A,O]),gA=p.useCallback((tA,iA)=>{!e||iA<=0||a(hA=>{const DA={...hA,lastUpdated:Date.now()};if(tA==="pass"){const dA=[...DA.pass||[]],SA=dA.findIndex(NA=>NA.playerId===e);SA!==-1&&(dA[SA]={...dA[SA],amount:Math.max(0,dA[SA].amount-iA)},dA[SA].amount===0&&dA.splice(SA,1)),DA.pass=dA}else if(tA==="dontPass"){const dA=[...DA.dontPass||[]],SA=dA.findIndex(NA=>NA.playerId===e);SA!==-1&&(dA[SA]={...dA[SA],amount:Math.max(0,dA[SA].amount-iA)},dA[SA].amount===0&&dA.splice(SA,1)),DA.dontPass=dA}else if(tA.startsWith("place")){const dA=tA.replace("place",""),SA=parseInt(dA,10);if(!isNaN(SA)){const NA=[...DA.place||[]],OA=NA.findIndex(Qe=>Qe.playerId===e&&Qe.point===SA);OA!==-1&&(NA[OA]={...NA[OA],amount:Math.max(0,NA[OA].amount-iA)},NA[OA].amount===0&&NA.splice(OA,1)),DA.place=NA}}return r.current=DA,DA})},[e]),z=p.useCallback((tA,iA,hA)=>{if(!A)return;gA(tA,iA);const DA=P(A,tA,iA);return hA&&DA.then(dA=>hA(dA)).catch(dA=>hA({ok:!1,error:String(dA?.message||dA)})),DA},[P,A,gA]),X=p.useCallback(tA=>{if(!A)return;const iA=j(A);return tA&&iA.then(hA=>tA(hA)).catch(hA=>tA({ok:!1,error:String(hA?.message||hA)})),iA},[j,A]),sA=p.useCallback(tA=>{if(!A)return;const iA=q(A);return tA&&iA.then(hA=>tA(hA)).catch(hA=>tA({ok:!1,error:String(hA?.message||hA)})),iA},[q,A]),rA=A&&e?`crapsbets:${A}:${e}`:null,mA=1800*1e3,IA=p.useCallback(async()=>{if(rA)try{const tA=await TD(rA);if(!tA)return;const iA=tA.pass,hA=tA.dontPass,DA=Array.isArray(tA.place)?tA.place:[],dA=typeof tA.ts=="number"?tA.ts:void 0;if(dA&&Date.now()-dA>mA||!DA?.length&&!iA&&!hA)return;a(SA=>{if(SA.lastUpdated!==0||SA.place.length+SA.pass.length+SA.dontPass.length>0)return SA;const NA={...SA};return iA&&(NA.pass=[{playerId:e,amount:iA}]),hA&&(NA.dontPass=[{playerId:e,amount:hA}]),DA?.length&&(NA.place=DA.map(OA=>({playerId:e,point:OA.point,amount:OA.amount}))),NA.lastUpdated=Date.now(),r.current=NA,NA})}catch{}},[rA,e]);p.useEffect(()=>{IA()},[IA]);const uA=p.useCallback(async()=>{if(!(!rA||!e||!A))try{const tA=await TD(rA);if(!tA)return;const iA=Number(tA.pass||0),hA=Number(tA.dontPass||0),DA=Array.isArray(tA.place)?tA.place:[],dA=Date.now();try{await Y()}catch{}const SA=Date.now()+1200;for(;(r.current.lastUpdated||0)<=dA&&Date.now()<SA;)await new Promise(HA=>setTimeout(HA,120));if((r.current.lastUpdated||0)<=dA)return;const NA=r.current,OA=(NA.pass||[]).find(HA=>HA.playerId===e)?.amount||0,Qe=(NA.dontPass||[]).find(HA=>HA.playerId===e)?.amount||0,nA={};for(const HA of NA.place||[])HA.playerId===e&&(nA[HA.point]=(nA[HA.point]||0)+HA.amount);const eA=Math.max(0,iA-OA),UA=Math.max(0,hA-Qe);if(eA>0)try{await H(A,"pass",eA)}catch{}if(UA>0)try{await H(A,"dontPass",UA)}catch{}for(const HA of DA){const Se=Number(HA.point),ne=Number(HA.amount||0),Oe=Number(nA[Se]||0),VA=Math.max(0,ne-Oe);if(VA>0)try{const de=`place${Se}`;await H(A,de,VA)}catch{}}}catch{}},[rA,e,A,Y,o,H]),KA=p.useCallback(tA=>{!tA||typeof tA!="object"||a(iA=>{const hA={pass:Array.isArray(tA.crapsPassBets)?tA.crapsPassBets:iA.pass,dontPass:Array.isArray(tA.crapsDontPassBets)?tA.crapsDontPassBets:iA.dontPass,odds:Array.isArray(tA.crapsOddsBets)?tA.crapsOddsBets:iA.odds,place:Array.isArray(tA.crapsPlaceBets)?tA.crapsPlaceBets:iA.place,field:Array.isArray(tA.crapsFieldBets)?tA.crapsFieldBets:iA.field,big:Array.isArray(tA.crapsBigBets)?tA.crapsBigBets:iA.big,come:Array.isArray(tA.crapsComeBets)?tA.crapsComeBets:iA.come,dontCome:Array.isArray(tA.crapsDontComeBets)?tA.crapsDontComeBets:iA.dontCome,ats:Array.isArray(tA.crapsAtsBets)?tA.crapsAtsBets:iA.ats,lastUpdated:Date.now()};return r.current=hA,hA})},[]),FA=p.useCallback((tA,iA,hA)=>{if(!A||tA!==A)return;B(iA),G.current+=1;const DA={...hA||{},_seq:G.current};E(DA);try{n(SA=>{if(!SA||SA.id!==A)return SA;const NA={...SA.gameState||{}};return NA.lastCrapsSettlementsTs=Date.now(),NA.lastCrapsSettlements=iA,{...SA,gameState:NA}})}catch{}const dA=new Map;for(const SA of iA)SA.outcome==="WIN"&&SA.playerId&&dA.set(SA.playerId,(dA.get(SA.playerId)||0)+1);for(const[SA,NA]of dA){const OA=J.current.get(SA)||0,Qe=OA+NA;if(J.current.set(SA,Qe),OA>=6&&Qe>OA)R4(7,.55);else for(const nA of[3,4,5,6])if(OA<nA&&Qe>=nA){R4(nA,.55);break}if(SA===e)try{window.dispatchEvent(new CustomEvent("craps:streak",{detail:{streak:Qe}}))}catch{}}K.current&&clearTimeout(K.current),K.current=setTimeout(()=>B([]),g)},[A,n,g]);$n({onCrapsRollResult:tA=>{try{if(!A||tA?.roomId!==A)return;const iA=Array.isArray(tA?.events)?tA.events:[],hA=iA.includes("crapsOut")||iA.includes("CRAPS_OUT"),DA=iA.includes("sevenOut")||iA.includes("SEVEN_OUT");if(hA||DA){J.current.clear();try{window.dispatchEvent(new CustomEvent("craps:streak",{detail:{streak:0}}))}catch{}}if(DA){a(dA=>{if(!dA.place.length)return dA;const SA={...dA,place:[],lastUpdated:Date.now()};return r.current=SA,SA});try{n(dA=>{if(!dA||dA.id!==A)return dA;const SA={...dA.gameState||{}};return SA.crapsPlaceBets=[],{...dA,gameState:SA}})}catch{}}}catch{}},onJoinedRoom:async({room:tA})=>{try{if(tA?.id&&tA.id===A){try{await Y()}catch{}try{await uA()}catch{}}}catch{}},onRejoinedRoom:async({room:tA})=>{try{if(tA?.id&&tA.id===A){try{await Y()}catch{}try{await uA()}catch{}}}catch{}},onCrapsReadyUpdate:tA=>{try{if(Array.isArray(tA?.readyPlayers)&&k(tA.readyPlayers),Array.isArray(tA?.requiredReadyPlayers)&&U(tA.requiredReadyPlayers),tA&&Object.prototype.hasOwnProperty.call(tA,"deadline")){const iA=typeof tA.deadline=="number"?tA.deadline:null;b(iA)}}catch{}},onCrapsBetsUpdate:tA=>{if(!A||tA?.roomId!==A)return;const iA=tA?.snapshot;if(iA){KA(iA);try{n(hA=>{if(!hA||hA.id!==A)return hA;const DA={...hA.gameState||{}};for(const dA of Object.keys(iA))DA[dA]=iA[dA];return DA.gameMode||(DA.gameMode="craps"),{...hA,gameState:DA}})}catch{}}rA&&e&&(async()=>{try{const hA=(iA?.crapsPassBets||[]).find(NA=>NA.playerId===e)?.amount||0,DA=(iA?.crapsDontPassBets||[]).find(NA=>NA.playerId===e)?.amount||0,dA=(iA?.crapsPlaceBets||[]).filter(NA=>NA.playerId===e).map(NA=>({point:NA.point,amount:NA.amount})),SA={v:1,ts:Date.now(),pass:hA,dontPass:DA,place:dA};hA||DA||dA.length?await pF(rA,SA):await YD(rA)}catch{}})()},onCrapsBetResults:tA=>{const iA=Array.isArray(tA?.settlements)?tA.settlements:[];FA(tA?.roomId,iA,tA?.roll)},onCrapsPointSet:tA=>{if(!A||tA?.roomId!==A)return;const iA=tA.currentRollerId||tA.nextRollerId||"unknown",hA=`ptSet:${tA.point}:${Array.isArray(tA.dice)?tA.dice.join("-"):""}:${iA}`;y({...tA,_key:hA});try{n(DA=>{if(!DA||DA.id!==A)return DA;const dA={...DA.gameState||{}};return dA.gameMode=dA.gameMode||"craps",dA.crapsPoint=typeof tA.point=="number"?tA.point:tA.point??null,dA.crapsPhase=dA.crapsPoint?"point":"come-out",tA.currentRollerId!==void 0&&(dA.currentRollerId=tA.currentRollerId),Array.isArray(tA.turnOrder)&&(dA.turnOrder=tA.turnOrder),{...DA,gameState:dA}})}catch{}},onCrapsPointMade:tA=>{if(!A||tA?.roomId!==A)return;const iA=tA.currentRollerId||tA.nextRollerId||"unknown",hA=`ptMade:${tA.point}:${Array.isArray(tA.dice)?tA.dice.join("-"):""}:${iA}`;f({...tA,_key:hA});try{n(DA=>{if(!DA||DA.id!==A)return DA;const dA={...DA.gameState||{}};return dA.gameMode=dA.gameMode||"craps",dA.crapsPoint=null,dA.crapsPhase="come-out",tA.nextRollerId!==void 0&&(dA.currentRollerId=tA.nextRollerId),Array.isArray(tA.turnOrder)&&(dA.turnOrder=tA.turnOrder),{...DA,gameState:dA}})}catch{}}}),p.useEffect(()=>{if(!A){a(yL),R.current=!1,B([]),E(null);return}const tA=I?.gameState;tA&&(tA.crapsPassBets||tA.crapsDontPassBets)&&KA(tA),i&&!R.current&&(R.current=!0,Y())},[A]),p.useEffect(()=>{if(!A)return;const tA=async()=>{await new Promise(iA=>setTimeout(iA,300));try{await Y()}catch{}try{await uA()}catch{}};return window.addEventListener("ad:complete",tA),()=>{window.removeEventListener("ad:complete",tA)}},[A,Y,uA]),p.useEffect(()=>()=>{K.current&&clearTimeout(K.current)},[]);const RA=p.useMemo(()=>o.pass.reduce((tA,iA)=>tA+iA.amount,0),[o.pass]),MA=p.useMemo(()=>o.dontPass.reduce((tA,iA)=>tA+iA.amount,0),[o.dontPass]),oA=p.useMemo(()=>o.field.reduce((tA,iA)=>tA+iA.amount,0),[o.field]),AA=p.useMemo(()=>e?{pass:o.pass.filter(tA=>tA.playerId===e).reduce((tA,iA)=>tA+iA.amount,0),dontPass:o.dontPass.filter(tA=>tA.playerId===e).reduce((tA,iA)=>tA+iA.amount,0)}:{pass:0,dontPass:0},[o.pass,o.dontPass,e]);return{betsState:o,recentSettlements:s,lastSettlementRoll:c,_persistKey:rA,passTotal:RA,dontPassTotal:MA,fieldTotal:oA,myLine:AA,listBets:Y,addBet:$,removeBet:z,clearBets:X,summarize:sA,clearRecentSettlements:()=>B([]),pointSetEvent:D,pointMadeEvent:S,readyPlayers:M,requiredReadyPlayers:m,readinessDeadline:F}}function KqA(){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 Gl(t,A){if(!Array.isArray(t)||!A)return 0;let e=0;for(const i of t)i.playerId===A&&(e+=Number(i.amount)||0);return e}function Fw(t,A){if(!Array.isArray(t)||!A)return 0;let e=0;for(const i of t)i.playerId!==A&&(e+=Number(i.amount)||0);return e}function uh(t,A,e){if(!Array.isArray(t)||!A)return 0;let i=0;for(const g of t)g.playerId===A&&e(g)&&(i+=Number(g.amount)||0);return i}function bW(t,A,e){if(!Array.isArray(t)||!A)return 0;let i=0;for(const g of t)g.playerId!==A&&e(g)&&(i+=Number(g.amount)||0);return i}function FqA(t,A){const e={};if(!Array.isArray(t)||!A)return e;for(const i of t){if(i.playerId!==A)continue;const g=Number(i.point);e[g]=(e[g]||0)+(Number(i.amount)||0)}return e}function Df(t,A,e){if(!Array.isArray(t)||!A)return 0;let i=0;for(const g of t)g.playerId!==A&&Number(g.point)===e&&(i+=Number(g.amount)||0);return i}function bqA(t,A){const[e,i]=p.useState(t.point),[g,I]=p.useState(t.phase);return p.useEffect(()=>{A&&(i(t.point),I(t.phase))},[A,t.point,t.phase]),{displayPoint:e,displayPhase:g}}function vqA({balance:t,meId:A,readyPlayers:e,onChargeChange:i}){const{user:g,meId:I}=Yi(),{room:n,setRoom:o}=Cs(),a=n?.id??null,r=p.useMemo(()=>KqA(),[]),s=p.useMemo(()=>{if(I)return I;const VA=g;return VA?.id??VA?.email??""},[g,I]),B=p.useMemo(()=>A||s,[A,s]),[c,E]=p.useState([]),{shooterState:D,roll:y,rolling:S,readyPlayers:f,ready:M,passTurn:k}=JgA({roomId:a,myPlayerId:B}),m=LgA({roomId:a,myPlayerId:B}),U=p.useMemo(()=>Array.isArray(e)?e:Array.isArray(m.readyPlayers)&&m.readyPlayers.length>0?m.readyPlayers:f,[e,m.readyPlayers,f]),F=p.useMemo(()=>({addBet:m.addBet,removeBet:m.removeBet,clearBets:m.clearBets}),[m.addBet,m.removeBet,m.clearBets]),b=m.betsState||{},K=b.pass||[],R=b.dontPass||[],G=b.place||[],J=b.field||[],x=b.big||[],H=b.come||[],P=b.dontCome||[],j=b.odds||[],q=b.ats||[],Y=p.useMemo(()=>FqA(G,B),[G,B]),O=p.useMemo(()=>{let VA=0;for(const de of[4,5,6,8,9,10])VA+=Y[de]||0;return VA},[Y]),$=p.useMemo(()=>{const VA={};if(!B)return VA;const de=m.myLine?.pass??Gl(K,B),te=m.myLine?.dontPass??Gl(R,B);de>0&&(VA.pass=de),te>0&&(VA.dontPass=te);for(const EA of[4,5,6,8,9,10]){const yA=Y[EA]||0;yA>0&&(VA[`place${EA}`]=yA)}const WA=Gl(J,B);WA>0&&(VA.field=WA);const _A=uh(x,B,EA=>EA.kind==="big6");_A>0&&(VA.big6=_A);const zA=uh(x,B,EA=>EA.kind==="big8");zA>0&&(VA.big8=zA);const ge=Gl(H,B);ge>0&&(VA.come=ge);const he=Gl(P,B);he>0&&(VA.dontCome=he);const ve=uh(j,B,EA=>EA.passType==="pass");ve>0&&(VA.oddsPass=ve);const bA=uh(j,B,EA=>EA.passType==="dontPass");bA>0&&(VA.oddsDontPass=bA);const pA=uh(q,B,EA=>EA.kind==="atsSmall");pA>0&&(VA.atsSmall=pA);const Re=uh(q,B,EA=>EA.kind==="atsTall");Re>0&&(VA.atsTall=Re);const CA=uh(q,B,EA=>EA.kind==="atsAll");return CA>0&&(VA.atsAll=CA),VA},[B,m.myLine?.pass,m.myLine?.dontPass,K,R,Y,J,x,H,P,j,q]),gA=p.useMemo(()=>{const VA=B;return VA?{pass:Fw(K,VA),dontPass:Fw(R,VA),field:Fw(J,VA),big6:bW(x,VA,de=>de.kind==="big6"),big8:bW(x,VA,de=>de.kind==="big8"),come:Fw(H,VA),dontCome:Fw(P,VA),place4:Df(G,VA,4),place5:Df(G,VA,5),place6:Df(G,VA,6),place8:Df(G,VA,8),place9:Df(G,VA,9),place10:Df(G,VA,10)}:{}},[B,K,R,J,x,H,P,G]),z=p.useCallback(VA=>E(VA),[]),X=p.useRef(0),sA=p.useCallback(()=>{if(!a||!B||!c.length)return;const VA=Date.now();if(!(VA-X.current<1e3)){X.current=VA;try{const de=Gl(K,B),te=Gl(R,B),WA=Y;for(const _A of c){const zA=_A.type;let ge=0;if(zA==="pass")ge=de;else if(zA==="dontPass")ge=te;else if(zA.startsWith("place")){const bA=parseInt(zA.replace("place",""),10);ge=WA[bA]||0}else continue;const he=Math.max(0,Number(_A.amount)||0),ve=Math.max(0,he-ge);if(ve>0)try{F.addBet(zA,ve)}catch{}}}catch{}}},[a,B,c,K,R,Y,F]);$n({onJoinedRoom:({room:VA})=>{VA?.id===a&&sA()},onRejoinedRoom:({room:VA})=>{VA?.id===a&&sA()}}),p.useEffect(()=>{if(!B)return;const VA=c.filter(de=>{if(de.type==="pass")return!(Gl(K,B)>=de.amount);if(de.type==="dontPass")return!(Gl(R,B)>=de.amount);if(de.type.startsWith("place")){const te=parseInt(de.type.replace("place",""),10);return!((Y[te]||0)>=de.amount)}return!0});VA.length!==c.length&&E(VA)},[B,K,R,Y,c]),p.useEffect(()=>{if(!a||!B||!o||!r)return;const VA=n?.gameState,de=VA?.currentRollerId;if(!de||de!==B)return;const te=VA?.crapsPassBets,WA=VA?.crapsDontPassBets;if(!(te?.some(zA=>zA.playerId===B&&zA.amount>0)||WA?.some(zA=>zA.playerId===B&&zA.amount>0)))try{o(zA=>{if(!zA||zA.id!==a)return zA;const ge=zA.gameState||{},he=Array.isArray(ge.crapsPassBets)?ge.crapsPassBets.slice():[];return he.push({playerId:B,amount:10}),{...zA,gameState:{...ge,crapsPassBets:he,gameMode:ge.gameMode||"craps"}}})}catch{}},[a,n?.gameState,B,o,r]);const rA=p.useCallback((VA,de)=>{a&&(de>0?F.addBet(VA,de):de<0&&F.removeBet(VA,Math.abs(de)))},[a,F]),mA=p.useMemo(()=>{const VA=n?.gameState;if(VA?.gameMode==="craps"){const de=VA.crapsPhase||(D?.point?"point":"comeOut");return{point:VA.crapsPoint??D?.point??null,phase:de==="point"?"point":"comeOut"}}return{point:D?.point??null,phase:D?.point?"point":"comeOut"}},[n?.gameState,D]),{reveal:IA}=kQ(),{displayPoint:uA,displayPhase:KA}=bqA(mA,IA);p.useEffect(()=>{if(mA.point==null&&IA){const VA=c.filter(de=>!de.type.startsWith("place"));VA.length!==c.length&&E(VA)}},[mA.point,IA,c]);const FA=n?.gameState,RA=m.readinessDeadline??null,MA=m.requiredReadyPlayers??[],oA=UqA({roomId:a,userId:s,shooterState:D,roomGameState:FA,myLineFromUnified:m.myLine,betsLastUpdated:m.betsState?.lastUpdated}),AA=r?!0:oA&&!S;p.useEffect(()=>{try{if(!r)return;window.__debugCanRoll={canRoll:AA,userId:g?.id,rolling:S,shooterState:D,roomGS:FA,readyPlayers:U,requiredReadyPlayers:MA,readinessDeadline:RA}}catch{}},[AA,g,S,D,FA,U,MA,RA,r]);const tA=!a,iA=p.useMemo(()=>{const VA=n?.gameState?.currentRollerId;return B?VA===B:!1},[n?.gameState,B]),hA=p.useMemo(()=>iA&&mA.phase==="comeOut"&&mA.point===null,[iA,mA.phase,mA.point]),DA=!!(B&&U.includes(B)),[dA,SA]=p.useState(!1);p.useEffect(()=>{DA&&SA(!1)},[DA]);const NA=p.useRef(null),OA=p.useCallback(()=>{if(!(!a||!B||dA||DA)){SA(!0);try{M()}catch{}NA.current&&window.clearTimeout(NA.current),NA.current=window.setTimeout(()=>{SA(!1)},5e3)}},[a,B,dA,DA,M]);p.useEffect(()=>()=>{NA.current&&window.clearTimeout(NA.current)},[]);const[Qe,nA]=p.useState(Date.now());p.useEffect(()=>{if(!RA)return;const VA=window.setInterval(()=>nA(Date.now()),1e3);return()=>window.clearInterval(VA)},[RA]);const eA=RA?Math.max(0,Math.ceil((RA-Qe)/1e3)):0,UA=p.useMemo(()=>{try{const VA=n?.gameState?.currentRollerId??null;if(!VA)return null;const de=n?.players?.find(te=>te.id===VA);return de?.name||de?.id||null}catch{return null}},[n?.gameState,n?.players]),HA=5,Se=500,ne=p.useMemo(()=>[1,5,10,25,100],[]);return Q.jsx(NqA,{roomId:a,balance:t,point:uA,phase:KA,shooterName:UA,minBet:HA,maxBet:Se,oddsMultiple:{pass:3,dontPass:3,place:1},chips:ne,pendingBets:c,onChangeBets:z,onClearAll:()=>{E([]),F.clearBets()},disabled:tA,onRoll:()=>y(),canRoll:AA,myPlayerPlaceTotal:O,myCommittedByType:$,readyPlayers:U,meId:B,onBetDelta:rA,showReadyButton:!iA,onReadyClick:OA,readyStateLabel:"Ready",readyButtonDisabled:S||dA||DA,countdownSeconds:eA,recentSettlements:m.recentSettlements,myPlayerLineTotals:m.myLine,othersTotals:gA,onPassTurn:()=>{k()},canPassTurn:hA,onChargeChange:i})}function _qA({balance:t,meId:A,readyPlayers:e,onChargeChange:i}){return Q.jsx("div",{className:"craps-bet-panel",children:Q.jsx(vqA,{balance:t,meId:A,readyPlayers:e,onChargeChange:i})})}function JqA(){const{infoNow:t}=qr(),{room:A}=Cs(),{meId:e}=Yi(),i=A?.gameMode||A?.gameState?.gameMode,g=i==="craps",I=i==="cee-lo"||!i,n=!A?.singlePlayer,o=p.useRef({roundSeq:0,seen:new Set}),a=p.useRef(new Map),r=p.useRef(new Map),s=B=>B?(A?.players||[]).find(E=>E.id===B)?.name||"Player":"Unknown";return $n({onBetsUpdated:B=>{try{const c=Number(B?.roundSeq??0)||0,E=Array.isArray(B?.openAll)?B.openAll:[];o.current.roundSeq!==c&&(o.current={roundSeq:c,seen:new Set},r.current.clear());const D=o.current.seen;if(D.size===0&&E.length>0){for(const f of E)f?.id&&D.add(f.id);r.current=new Map(E.filter(Boolean).map(f=>[f.id,f]));return}const y=r.current,S=new Map(E.filter(Boolean).map(f=>[f.id,f]));for(const f of E)if(!(!f||!f.id)&&!D.has(f.id)){if(D.add(f.id),f.type==="MAIN"){if(!(I&&n)||g&&e&&f.playerId===e)continue;const M=s(f.playerId),k=Math.max(0,Math.trunc(Number(f.amount)||0));k>0&&t("Main bet placed",`+z${k} — ${M}`)}else if(f.type==="SIDE"){const M=s(f.subjectId),k=Math.max(0,Math.trunc(Number(f.amount)||0));if(f.acceptedById){const m=s(f.acceptedById);k>0&&t("Side bet accepted",`z${k} — ${m} on ${M}`)}else{if(g&&e&&f.playerId===e)continue;k>0&&t("Side bet created",`+z${k} — on ${M}`)}}}for(const[f,M]of y.entries()){const k=S.get(f);if(M&&M.type==="SIDE"&&k&&k.type==="SIDE"&&!M.acceptedById&&k.acceptedById){const m=s(k.subjectId),U=Math.max(0,Math.trunc(Number(k.amount)||0)),F=s(k.acceptedById);U>0&&t("Side bet accepted",`z${U} — ${F} on ${m}`)}}for(const[f,M]of y.entries()){if(M?.type!=="SIDE")continue;if(!S.has(f)&&!M.acceptedById){const m=s(M.subjectId),U=Math.max(0,Math.trunc(Number(M.amount)||0));U>0&&t("Side bet cancelled",`-z${U} — on ${m}`)}}r.current=S}catch{}},onCrapsBetsUpdate:B=>{try{const c=B?.snapshot||{},E=a.current,D=new Map,y=(M,k)=>{D.set(M,(D.get(M)||0)+(Number.isFinite(k)?k:0))},S=M=>{const k=M.split("|"),m=k[0],U=k[1]||"",F=s(m);if(U.startsWith("place:"))return`Place ${U.split(":")[1]} — ${F}`;switch(U){case"pass":return`Pass — ${F}`;case"dontPass":return`Don't Pass — ${F}`;case"field":return`Field — ${F}`;case"big6":return`Big 6 — ${F}`;case"big8":return`Big 8 — ${F}`;default:return`${U} — ${F}`}},f=M=>Array.isArray(M)?M:[];for(const{playerId:M,amount:k}of f(c.crapsPassBets))y(`${M}|pass`,k);for(const{playerId:M,amount:k}of f(c.crapsDontPassBets))y(`${M}|dontPass`,k);for(const{playerId:M,amount:k}of f(c.crapsFieldBets))y(`${M}|field`,k);for(const{playerId:M,kind:k,amount:m}of f(c.crapsBigBets))y(`${M}|${k}`,m);for(const{playerId:M,point:k,amount:m}of f(c.crapsPlaceBets))y(`${M}|place:${k}`,m);for(const{playerId:M,amount:k,status:m,point:U}of f(c.crapsComeBets))y(`${M}|come${m==="POINT"&&U?":"+U:""}`,k);for(const{playerId:M,amount:k,status:m,point:U}of f(c.crapsDontComeBets))y(`${M}|dontCome${m==="POINT"&&U?":"+U:""}`,k);if(E.size===0){a.current=D;return}for(const[M,k]of D.entries()){const m=E.get(M)||0,U=Math.trunc(k-m);if(U>0){if(e&&M.startsWith(e+"|"))continue;t("Bet Placed",`+z${U} — ${S(M)}`)}}a.current=D}catch{}}}),p.useEffect(()=>{},[]),null}function LqA(t,A){const{rollDice:e,placeMainBet:i,cancelMainBet:g,createSideBet:I,acceptSideBet:n,cancelSideBet:o,confirmBets:a,bankerGiveUp:r,setSpectate:s,getWagers:B}=OI(),c=E=>{if(t)try{return E()}catch(D){return Promise.resolve({ok:!1,error:D?.message||"ERR"})}};return{roll:E=>c(()=>e(t).then(D=>(E?.(D),D)).catch(D=>{const y={ok:!1,error:D?.message||"ERR"};return E?.(y),y})),confirmBets:E=>c(()=>a(t).then(D=>(E?.(D),D)).catch(D=>{const y={ok:!1,error:D?.message||"ERR"};return E?.(y),y})),placeMain:(E,D)=>c(()=>i(t,E).then(y=>(D?.(y),y)).catch(y=>{const S={ok:!1,error:y?.message||"ERR"};return D?.(S),S})),cancelMain:(E,D)=>c(()=>g(t,E).then(y=>(D?.(y),y)).catch(y=>{const S={ok:!1,error:y?.message||"ERR"};return D?.(S),S})),createSide:(E,D,y)=>c(()=>I(t,{amount:E,...D||{}}).then(S=>(y?.(S),S)).catch(S=>{const f={ok:!1,error:S?.message||"ERR"};return y?.(f),f})),acceptSide:(E,D)=>c(()=>n(t,E).then(y=>(D?.(y),y)).catch(y=>{const S={ok:!1,error:y?.message||"ERR"};return D?.(S),S})),cancelSide:(E,D)=>c(()=>o(t,E).then(y=>(D?.(y),y)).catch(y=>{const S={ok:!1,error:y?.message||"ERR"};return D?.(S),S})),giveUpBank:E=>c(()=>r(t).then(D=>(E?.(D),D)).catch(D=>{const y={ok:!1,error:D?.message||"ERR"};return E?.(y),y})),spectate:(E,D)=>c(()=>s(t,E).then(y=>(D?.(y),y)).catch(y=>{const S={ok:!1,error:y?.message||"ERR"};return D?.(S),S})),refreshWagers:()=>{if(t)try{B(t)}catch{}}}}function qqA(t){const{isMyTurn:A,isBanker:e,diceSettled:i,hasMainBetPlaced:g,bankPointExists:I,roundEnded:n}=t;return A?i?n?{canRoll:!1,reason:"Round transition in progress"}:e&&I?{canRoll:!1,reason:"Banker point established"}:!e&&!g?{canRoll:!1,reason:"Place a main bet first"}:{canRoll:!0}:{canRoll:!1,reason:"Dice not settled"}:{canRoll:!1,reason:"Not your turn"}}const HN=Object.create(null);function xqA(){switch(_r){case"ceelo":return"cee-lo";case"craps":return"craps";case"poker":return"poker";case"skills":return"skills";default:return null}}function vW(t){const A=xqA();if(!A)return!0;const e=t?.gameState?.gameMode||t?.gameState?.mode;return e?e===A:!0}function _W(t,A){return A&&t.find(i=>i.id===A)?.name||"Anonymous"}function TqA(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 SL(t,A){const[e,i]=p.useState(A),g=p.useRef(!1);return p.useEffect(()=>{if(!t)return;let I=!1;return(async()=>{try{const n=await TD(t);!I&&n!==null&&i(n)}catch{}g.current=!0})(),()=>{I=!0}},[t]),p.useEffect(()=>{t&&g.current&&(async()=>{try{await pF(t,e)}catch{}})()},[t,e]),[e,i]}function TO(t,A,e){const{info:i}=lH(),g=e?.autoJoin??!0,I=Di(),n=MQ(),{leaveRoom:o}=OI(),{joinRoom:a}=Cs(),r=a,s=LqA(t||null),{reveal:B,rollTrigger:c,triggerSpin:E}=kQ(),{user:D}=Yi(),[y,S]=p.useState(null),{room:f}=Cs(),k=(()=>{try{return Cs&&Cs()}catch{return null}})()?.setRoom??null;p.useRef(null);const[m,U]=p.useState(!0),[F,b]=p.useState(null),[K,R]=p.useState(null),G=p.useRef(null),J=p.useRef(null),x=p.useRef(null);p.useRef([]);const[H,P]=p.useState(!0),[j,q]=p.useState(void 0),[Y,O]=SL(t?`gp:${t}:${A}:deadline`:void 0,30),[$,gA]=SL(t?`gp:${t}:${A}:serverNow`:void 0,30),[z,X]=SL(t?`gp:${t}:${A}:feed`:void 0,[]),[sA,rA]=p.useState([]),[mA,IA]=p.useState(null),[uA,KA]=p.useState([]),[FA,RA]=p.useState(!1),[MA,oA]=p.useState(!1),AA=p.useRef(null),tA=p.useRef(null);p.useEffect(()=>{t&&(async()=>{try{await YD(`gp:${t}:${A}:diceSettled`),await YD(`gp:${t}:${A}:diceResults`)}catch{}})()},[t,A]),p.useEffect(()=>()=>{AA.current&&(window.clearTimeout(AA.current),AA.current=null)},[]),p.useEffect(()=>{if(!y||!y.singlePlayer){RA(!1),oA(!1),AA.current&&(window.clearTimeout(AA.current),AA.current=null),tA.current=null;return}const WA=(y.gameState?.gameMode||y.gameState?.mode)==="craps"?1:3;if(y.players.length>=WA+1){MA||oA(!0),RA(!1),AA.current&&(window.clearTimeout(AA.current),AA.current=null),tA.current=null;return}MA||(AA.current||(AA.current=window.setTimeout(()=>{RA(!0),AA.current=null},250)),tA.current?Date.now()>tA.current&&(oA(!0),RA(!1)):tA.current=Date.now()+5e3)},[y,MA]);const iA=e?.listeners??!0;$n(iA?{onJoinedRoom:({room:te})=>{S(te),X(WA=>[{kind:"system",message:`You joined ${te.name}`,ts:Date.now()},...WA]);try{H===!1&&(J.current&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{H===!1&&!G.current&&P(!0),J.current=null},Zn.diceSettleClientMs));const WA=te?.gameState||{};!WA?.bankRoll&&!WA?.lastRoll&&H===!1&&!G.current&&P(!0)}catch{}},onRejoinedRoom:({room:te})=>{vW(te)&&(S(te),X(WA=>[{kind:"system",message:`Rejoined ${te.name}`,ts:Date.now()},...WA]))},onOtherLeft:({room:te})=>{S(te)},onOtherPlayerJoined:({room:te})=>{S(te),X(WA=>[{kind:"system",message:"Another player joined.",ts:Date.now()},...WA])},onSpectatorsUpdated:te=>{const{spectators:WA,roundSeq:_A}=te||{};S(zA=>{if(!zA)return zA;const ge=zA.gameState?.roundSeq;return typeof _A=="number"&&typeof ge=="number"&&_A!==ge?zA:{...zA,gameState:{...zA.gameState,spectators:WA??[]}}})},onDiceRolled:te=>{const{rollerId:WA,results:_A,rank:zA,room:ge,deadline:he,serverNow:ve}=te;O(he),P(!1),J.current&&(window.clearTimeout(J.current),J.current=null),G.current&&window.clearTimeout(G.current),x.current=Date.now(),q(void 0),E();const bA=2e3,pA=600,Re=x.current?Date.now()-x.current:0,CA=Math.max(bA-Re,0)+pA;G.current=window.setTimeout(()=>{P(!0),x.current=null,ge&&S(EA=>EA?{...EA,...ge,spLevel:ge.spLevel??EA.spLevel,levelName:ge.levelName??EA.levelName}:ge),G.current=null},CA),gA(ve),R(WA),q(_A)},onBetsUpdated:te=>{te.room?.players&&S(WA=>{if(!WA)return WA;const _A=Array.isArray(te.room.players)?te.room.players:[];if(!_A.length)return WA;const zA=new Map((WA.players??[]).map(ge=>[ge.id,ge]));for(const ge of _A){const he=zA.get(ge.id);zA.set(ge.id,he?{...he,...ge}:ge)}return{...WA,players:Array.from(zA.values())}})},onSideBetCreated:te=>{if(!te||te.acceptedById||!te.subjectId||te.subjectId!==A)return;const _A=`${_W(y?.players??[],te.playerId)} offered: ${TqA(te.predicate)} for z${te.amount}`;n.info(_A,{title:"New Side Bet"})},onLobbyRooms:void 0,onNotYourTurn:()=>{X(te=>[{kind:"system",message:"It’s not your turn.",ts:Date.now()},...te])},onForceLogout:te=>{te?.reason==="session_superseded"?(y6(),X(WA=>[{kind:"system",message:"You logged in from another device.",ts:Date.now()},...WA])):X(WA=>[{kind:"system",message:"You were logged out.",ts:Date.now()},...WA]),I("/login",{replace:!0})},onError:te=>b(te),onBankerChanged:te=>{te?.roomId&&S(WA=>!WA||WA.id!==te.roomId?WA:{...WA,gameState:{...WA.gameState,banker:te.bankerId,currentRollerId:te.currentRollerId,roundSeq:te.roundSeq,bankRoll:null}})},onTurnOrderUpdated:te=>{if(!te.room||!te.room.gameState)return;S(te.room);const WA=_W(te.room.players,te.banker);X(_A=>[{kind:"system",message:`${WA} is now the banker for the new round.`,ts:Date.now()},..._A])},onRoomUpdateState:te=>{const{roomId:WA,gameState:_A,room:zA}=te||{},ge=zA?.gameState??_A;if(!WA||!ge||!vW(zA??{gameState:ge}))return;const he=Array.isArray(zA?.players)?zA.players:[],ve=bA=>{if(!he.length)return bA;const pA=new Map(bA.map(Re=>[Re.id,Re]));for(const Re of he){const CA=pA.get(Re.id);pA.set(Re.id,CA?{...CA,...Re}:Re)}return Array.from(pA.values())};S(bA=>{if(!bA||bA.id!==WA)return{...bA,gameState:ge,...he.length?{players:he}:{}};const pA=bA.gameState?.roundSeq,Re=ge?.roundSeq,CA=typeof pA=="number"&&typeof Re=="number"&&pA!==Re,EA={...bA,players:ve(bA.players??[]),gameState:{...bA.gameState,...ge}};if(CA&&!G.current){try{P(!0)}catch{}try{q(void 0)}catch{}try{R(null)}catch{}}return EA})}}:{}),p.useEffect(()=>()=>{G.current&&(window.clearTimeout(G.current),G.current=null),J.current&&(window.clearTimeout(J.current),J.current=null)},[]),p.useEffect(()=>{H===!1&&!G.current?(J.current&&window.clearTimeout(J.current),J.current=window.setTimeout(()=>{if(H===!1){G.current||P(!0);try{G.current&&window.clearTimeout(G.current)}catch{}G.current=null}J.current=null},Zn.diceSettleClientMs)):H===!0&&J.current&&(window.clearTimeout(J.current),J.current=null)},[H]);const DA=p.useRef(null),dA=p.useRef(void 0),SA=p.useRef(!1);DA.current=r,p.useEffect(()=>{if(!g)return;let te=!1;if(dA.current!==t)return dA.current=t,SA.current=!1,(async()=>{if(!t){b("No room id provided."),U(!1);return}if(U(!0),b(null),!DA.current){b("No join ref");return}const WA=(()=>{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 _A=null;try{const zA=()=>WA?Promise.race([DA.current(t),new Promise(ve=>setTimeout(()=>ve({ok:!1,error:"e2e-timeout"}),1800))]):DA.current(t),ge=HN[t]||zA();HN[t]=ge;try{_A=await ge}finally{delete HN[t]}}catch(zA){if(delete HN[t],!WA){b(zA?.message||"Failed to join room."),U(!1);return}}if(typeof window<"u"&&(window.__e2eJoinAttempt={roomId:t,res:_A,ts:Date.now()}),!te){if(!_A?.ok){if(!WA){b(_A?.error??"Failed to join room."),U(!1);return}const zA=Date.now(),ge=D?.id||"e2e-user",he=D?.name||"E2E User",bA=((()=>{try{const EA=new URLSearchParams(window.location.search).get("m");return EA==="cee-lo"||EA==="craps"?EA:null}catch{return null}})()||(t?.toLowerCase().includes("ceelo")?"cee-lo":"craps"))==="cee-lo",pA=[{id:ge,name:he,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],Re=bA?{id:t,name:"E2E Cee-Lo Room",gameMode:"cee-lo",createdAt:zA,updatedAt:zA,bankerId:ge,players:pA,gameState:{gameMode:"cee-lo",currentRollerId:ge,banker:ge,turnOrder:[ge],roundSeq:1,bankRoll:null,turnHistory:[]}}:{id:t,name:"E2E Craps Room",gameMode:"craps",createdAt:zA,updatedAt:zA,bankerId:"bank",players:pA,gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:ge,turnOrder:[ge],roundSeq:1,crapsPassBets:[],crapsDontPassBets:[],crapsPlaceBets:[]}};S(Re);try{k?.(Re)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:Re.id,players:Re.players.map(CA=>CA.id),gameMode:Re.gameState.gameMode,ts:Date.now()}),U(!1);return}S(_A.room);try{k?.(_A.room)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:_A.room?.id,players:_A.room?.players?.map(zA=>zA.id),gameMode:_A.room?.gameState?.gameMode,ts:Date.now()});try{jD("room_join",{roomId:t})}catch{}U(!1)}})(),()=>{te=!0,dA.current===t&&(dA.current=void 0)}},[t,g]);const NA=p.useMemo(()=>{if(!y||!A)return!1;const te=y.gameState||{};return(te?.gameMode??"cee-lo")==="craps",te?.currentRollerId===A},[y,A]),OA=p.useMemo(()=>!y||!A?!1:(y.gameState||{})?.banker===A,[y,A]),{open:Qe,openAll:nA}=nb(t,A),eA=p.useMemo(()=>(Qe||[]).some(te=>te.type==="MAIN"&&Number(te.amount)>0),[Qe]),UA=p.useMemo(()=>(nA||[]).some(te=>te.type==="MAIN"),[nA]),HA=y?.gameState?.currentRollerId??null,Se=p.useMemo(()=>{const te=y?.gameState||f?.gameState||{},WA=te?.gameMode??"cee-lo",_A=!!te?.roundEnded;if(WA==="craps"){const he=!!NA&&!!H&&!_A;return IA(he?null:NA?H?"Round transition in progress":"Dice not settled":"Not your turn"),KA([]),he}if(!te?.currentRollerId)return IA("Initializing…"),KA([]),!1;if(OA&&!UA)return IA("Waiting for bets"),KA([]),!1;const zA=!!te?.bankRoll,ge=qqA({isMyTurn:NA,isBanker:OA,diceSettled:H,hasMainBetPlaced:eA,bankPointExists:zA,roundEnded:_A});return IA(ge.reason??null),KA([]),ge.canRoll},[y?.gameState,f?.gameState,NA,OA,eA,H,UA,y?.singlePlayer]),ne=p.useCallback(()=>{t&&(o(t),I("/lobby"))},[t,o,I]),Oe=p.useCallback(()=>{if(t&&Se){if(OA&&!UA){try{i("Waiting for bets")}catch{}return}if(!OA&&!eA){try{i("No open challenges")}catch{}return}try{jD("roll_click",{game:"cee-lo",role:OA?"banker":"challenger"})}catch{}try{G.current&&(window.clearTimeout(G.current),G.current=null),J.current&&(window.clearTimeout(J.current),J.current=null)}catch{}q(void 0),P(!1),x.current=Date.now(),E(),G.current=window.setTimeout(()=>{P(!0),x.current=null,G.current=null},8e3),(async()=>{const te=await s.roll(),WA=te?.error||te?.message||"";if(!te||te.ok===!1){if(G.current&&(window.clearTimeout(G.current),G.current=null),x.current=null,P(!0),/no open main bets/i.test(WA)){const _A=!!y?.singlePlayer;try{s.refreshWagers()}catch{}if(!_A||!OA)try{i("No open challenges")}catch{}return}return}})()}},[t,s,E,Se,OA,eA,UA,y?.gameState]),VA=p.useCallback(async()=>{if(t)return s.giveUpBank?.()},[t,s]),de=p.useCallback(async te=>{if(t)return s.spectate?.(te)},[t,s]);return{room:y,joining:m,botsHydrating:FA,error:F,isMyTurn:NA,isBanker:OA,lastRollerId:K,rollTrigger:c,diceSettled:H,diceResults:j,deadline:Y,serverNow:$,canRoll:Se,canRollReason:mA,canRollBlocking:uA,handleRoll:Oe,handleLeave:ne,giveUpBank:VA,setSpectateMode:de,currentRollerId:HA,readyPlayers:sA}}function YqA({meId:t,players:A,openSideBets:e,onCancelSideBet:i,onAcceptSideBet:g,offersToMe:I=[],newOffersCount:n=0,onOffersSeen:o,disabled:a=!1,betsLocked:r,hasBankRoll:s,hasRolledThisRound:B}){const c=MQ(),[E,D]=p.useState(!1),y=p.useRef(null),S=p.useMemo(()=>{if(typeof window<"u"&&window.location?.search?.includes("e2e=1")){const b=window.__e2eSideBets;if(Array.isArray(b)&&b.length>0)return b}return I},[I]);p.useEffect(()=>{E&&o?.()},[E,o]);const f=p.useCallback(async(b,K)=>{if(!g)return;if(K&&B?.(K)){c.info("Subject already rolled. Side bets are closed for this subject.");return}try{Cg()}catch{}const R=await g(b);R.ok||c.error(R.error||"Failed to accept side bet")},[g,B,c]),M=p.useCallback((b,K)=>{const R=(K||"").toLowerCase();return R==="beatsbank"||R==="subject_beats_banker"?`${b} beats Banker`:R==="losestobank"||R==="subject_loses_to_banker"?`${b} loses to Banker`:R==="tiesbank"||R==="subject_push"||R==="subject_ties_banker"?`${b} ties Banker`:`${b} side bet`},[]),k=p.useCallback(b=>b?b==="house_global"||b==="house"?"House":A.find(K=>K.id===b)?.name||"Player":"Player",[A]);p.useEffect(()=>{const b=K=>{y.current&&!y.current.contains(K.target)&&D(!1)};return E&&document.addEventListener("mousedown",b),()=>document.removeEventListener("mousedown",b)},[E]);const m=!s&&!a,U=(S?.length??0)>0&&m&&!E,F=m?"btn btn--casino-action"+(U?" btn--casino-action--pulse":""):"btn btn--casino-action"+(m?"":" is-disabled");return Q.jsxs("div",{className:"side-bet-panel",children:[Q.jsxs("a",{onClick:()=>{try{o?.()}catch{}m&&D(!0)},className:F,"aria-disabled":m?void 0:"true",title:m?void 0:"Side bets closed",children:[Q.jsx("span",{className:"btn--casino-action__icon",children:"🎰"}),"Side bets",n>0&&Q.jsx("span",{className:"sidebet-badge","aria-label":`${n} new offer${n>1?"s":""}`,children:n})]}),E&&Q.jsx("div",{className:"side-bet-panel__modal",children:Q.jsxs("div",{className:"side-bet-panel__modal-content",ref:y,children:[Q.jsx("h3",{className:"side-bet-panel__title",children:"Side Bets"}),Q.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Offers to you",children:S.length>0?S.map(b=>{const K=k(b.subjectId),R=M(K,b.predicate),G=b.subjectId,J=B?.(G)??!1,x=G===t;return Q.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[Q.jsxs("div",{className:"side-bet-panel__wager-info",children:[Q.jsx("span",{className:"side-bet-panel__wager-amount",children:Q.jsx(hB,{mini:!0,value:b.amount})}),Q.jsx("span",{className:"side-bet-panel__wager-label",children:R})]}),g&&Q.jsx("button",{className:"felt-btn felt-btn--primary",onClick:()=>f(b.id,G),disabled:a||J||x||s,title:s?"Dealer rolled – side bets closed":J?"Subject already rolled this round":x?"Cannot bet on yourself":"Accept this side bet",children:"Accept"})]},b.id)}):Q.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:Q.jsx("span",{className:"side-bet-panel__empty",children:"No offers right now."})})}),Q.jsx("h3",{className:"side-bet-panel__title",style:{marginTop:14},children:"Active side bets"}),Q.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Your active side bets",children:e&&e.length>0?e.map(b=>{const K=k(b.subjectId),R=M(K,b.predicate),G=b.acceptedById,J=b.playerId===t,x=G===t,H=k(J?G||void 0:b.playerId),P=(J||x)&&!s&&!!i,j=!J&&!x?"Only a party to the bet can cancel":s?"Dealer rolled – side bets closed":i?void 0:"Cancel not available";return Q.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[Q.jsxs("div",{className:"side-bet-panel__wager-info",style:{flex:1},children:[Q.jsx("span",{className:"side-bet-panel__wager-amount",children:Q.jsx(hB,{mini:!0,value:b.amount})}),Q.jsxs("span",{className:"side-bet-panel__wager-label",children:[R,Q.jsx("span",{style:{display:"block",fontSize:"0.85em",opacity:.8},children:G?`with ${H}`:"awaiting taker"})]})]}),Q.jsx("button",{className:"felt-btn "+(P?"felt-btn--danger":"felt-btn--secondary"),"aria-label":"Cancel side bet",title:P?"Cancel this side bet":j||"Cannot cancel",disabled:!P||!!a,onClick:async()=>{if(!P)return;try{Cg()}catch{}const q=await i(b.id);q.ok||c.error(q.error||"Failed to cancel side bet")},children:"Cancel"})]},`active-${b.id}`)}):Q.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:Q.jsx("span",{className:"side-bet-panel__empty",children:"No active side bets."})})}),Q.jsx("div",{className:"side-bet-panel__cta",children:Q.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>D(!1),style:{marginTop:8},children:"Close"})})]})})]})}function HqA({roomId:t,meId:A,bankerId:e,players:i,gameState:g,gameplay:I}){const n=MQ(),o=e===A,{myOpenMain:a,myOpenSides:r,placeSideBet:s,cancelSideBet:B,acceptSideBet:c,offersToMe:E,newOfferCount:D,markOffersAsSeen:y}=nb(t,A),S=TO(t,A,{autoJoin:!1}),f=I?.giveUpBank??S.giveUpBank,M=I?.setSpectateMode??S.setSpectateMode,k=!!g?.betsLocked,m=!!g?.bankRoll,U=g?.spectators??[],F=U.includes(A),K=!o&&!k&&!m&&!!!a,R=o&&!k&&!m,G=p.useCallback(async()=>{try{Cg()}catch{}const P=await M(!F);P&&!P.ok&&n.error(P.error||"Failed to update spectate mode")},[M,F,n]),J=p.useCallback(async()=>{try{Cg()}catch{}try{}catch{}try{await Xa("Medium")}catch{}const P=await f();P&&!P.ok&&n.error(P.error||"Failed to pass bank")},[f,n]),x=g?.roundSeq??1,H=p.useMemo(()=>{const P=g?.turnHistory??[];return!P||!Array.isArray(P)?[]:typeof g?.roundSeq=="number"?P.filter(j=>(j.roundSeq??x)===x):P},[g,x]);return Q.jsxs(Q.Fragment,{children:[o&&Q.jsxs("button",{className:"btn btn--casino-action",disabled:!R,onClick:J,"aria-label":"Pass Bank",children:[Q.jsx("span",{className:"btn--casino-action__icon",children:"🎲"}),"Pass Bank"]}),!o&&Q.jsxs("div",{className:"betpanel__row betpanel__row--spectate",children:[Q.jsx("div",{"aria-label":"Side bets",children:Q.jsx(YqA,{isBanker:o,openSideBets:r,meId:A,players:i,onPlaceSideBet:P=>s({subjectId:P.playerId,predicate:P.predicate,amount:P.amount,clientBetId:P.clientBetId}),onCancelSideBet:B,onAcceptSideBet:c,offersToMe:E,newOffersCount:D,onOffersSeen:y,roomId:t,betsLocked:k,disabled:U.includes(A),hasBankRoll:m,hasRolledThisRound:P=>!!P&&H.some(j=>j.playerId===P&&(j.roundSeq??x)===x)})}),Q.jsxs("button",{className:`btn btn--casino-action${F?" btn--casino-action--active":""}`,onClick:G,disabled:!K,"aria-pressed":F,"aria-label":F?"Stop spectating this round":"Spectate this round",children:[Q.jsx("span",{className:"btn--casino-action__icon",children:F?"👁️":"👀"}),F?"Spectating":"Spectate"]})]})]})}function dB({className:t,title:A,...e}){return Q.jsxs("svg",{width:36,height:36,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:t,"aria-hidden":A?void 0:!0,role:A?"img":"presentation",...e,children:[A?Q.jsx("title",{children:A}):null,Q.jsx("path",{d:"M19 12H5m0 0l7-7m-7 7l7 7",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})}const OqA=new TextEncoder;function PqA(t){const A=t instanceof Uint8Array?t:new Uint8Array(t);return Array.from(A).map(e=>e.toString(16).padStart(2,"0")).join("")}async function jqA(t){const A=await crypto.subtle.digest("SHA-256",OqA.encode(t));return PqA(A)}async function ZqA(t,A){return!t||!A?!1:(await jqA(t)).toLowerCase()===A.toLowerCase()}const wL=(t,A)=>`${t}:${A}`;function qgA(t){const[A,e]=p.useState({}),[i,g]=p.useState({}),I=p.useRef({});p.useEffect(()=>{e({}),g({}),I.current={}},[t]),$n({onDiceRolled:a=>{const r=a?.fairness,s=a?.rollerId,B=r?.roundSeq??a?.room?.gameState?.roundSeq;if(!r||!s||typeof B!="number")return;const c=wL(B,s);e(E=>E[c]?E:{...E,[c]:r}),delete I.current[c]},onCrapsRollResult:a=>{const r=a?.fairness,s=a?.fairness?.rollerId||a?.currentRollerId,B=r?.roundSeq;if(!r||!s||typeof B!="number")return;const c=wL(B,s);e(E=>E[c]?E:{...E,[c]:r}),delete I.current[c]},onFairnessReveal:a=>{typeof a?.roundSeq!="number"||!a.commit||!a.serverSeed||g(r=>{const s=r[a.roundSeq];if(!s||s.commit!==a.commit)for(const B of Object.keys(I.current))B.startsWith(`${a.roundSeq}:`)&&delete I.current[B];return{...r,[a.roundSeq]:{commit:a.commit,serverSeed:a.serverSeed}}})}});const n=p.useCallback(async(a,r,s)=>{const B=wL(r,a);if(I.current[B])return I.current[B];const c=A[B],E=i[r];if(!c||!E)return I.current[B]="unverifiable","unverifiable";const y=await ZqA(E.serverSeed,c.commit)?"verified":"bad-commit";return I.current[B]=y,y},[A,i]),o=p.useMemo(()=>{const a=Object.keys(i).map(r=>Number(r)).filter(r=>!Number.isNaN(r));return a.length?Math.max(...a):void 0},[i]);return{proofs:A,reveals:i,verifyFor:n,lastRoundWithReveal:o}}let Pn=null,JR=null,QY=null;async function qk(){if(Pn)return!0;try{const t=await pi(()=>import("./index-ClF8rkTI.js"),[],import.meta.url);return Pn=t.AdMob,JR=t.RewardAdPluginEvents,QY=t.InterstitialAdPluginEvents,!0}catch{return!1}}let oy=!1;async function Wy(){if(oy)return!0;if(Li.getPlatform()==="web"||!await qk()||!Pn)return!1;try{return await Pn.initialize({requestTrackingAuthorization:!0,initializeForTesting:xk??!1}),oy=!0,!0}catch{return!1}}const xk=typeof process<"u"&&!1;function xgA(){const t=Li.getPlatform();return t==="ios"?uBA:a4}function TgA(){const t=Li.getPlatform();return t==="ios"?hBA:C4}async function WqA(){if(Li.getPlatform()==="web"||!await qk()||!Pn)return!1;oy||await Wy();try{const e=xgA();return await Pn.prepareRewardVideoAd({adId:e,isTesting:xk??!1}),!0}catch{return!1}}async function zqA(){return Li.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await qk()||!Pn?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!oy&&!await Wy()?{ok:!1,error:"INIT_FAILED"}:new Promise(async e=>{let i=!1,g,I;const n=Pn.addListener(JR.Rewarded,s=>{i=!0,g=s?.type||"chips",I=s?.amount||Wf}),o=Pn.addListener(JR.Dismissed,()=>{r(),e(i?{ok:!0,rewardType:g,rewardAmount:I}:{ok:!1,error:"AD_DISMISSED"})}),a=Pn.addListener(JR.FailedToShow,s=>{r(),e({ok:!1,error:"FAILED_TO_SHOW"})}),r=()=>{try{n?.remove?.()}catch{}try{o?.remove?.()}catch{}try{a?.remove?.()}catch{}};try{const s=xgA();await Pn.prepareRewardVideoAd({adId:s,isTesting:xk??!1}),await Pn.showRewardVideoAd()}catch(s){r(),e({ok:!1,error:s?.message||"UNKNOWN_ERROR"})}})}async function ED(){if(Li.getPlatform()==="web"||!await qk()||!Pn)return!1;oy||await Wy();try{const e=TgA();return await Pn.prepareInterstitial({adId:e,isTesting:xk??!1}),!0}catch{return!1}}async function LR(){return Li.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await qk()||!Pn?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!oy&&!await Wy()?{ok:!1,error:"INIT_FAILED"}:new Promise(async e=>{const i=Pn.addListener(QY.Dismissed,()=>{I(),e({ok:!0}),ED().catch(()=>{})}),g=Pn.addListener(QY.FailedToShow,n=>{I(),e({ok:!1,error:"FAILED_TO_SHOW"})}),I=()=>{try{i?.remove?.()}catch{}try{g?.remove?.()}catch{}};try{const n=TgA();await Pn.prepareInterstitial({adId:n,isTesting:xk??!1}),await Pn.showInterstitial()}catch(n){I(),e({ok:!1,error:n?.message||"UNKNOWN_ERROR"})}})}function YgA(){const t=Li.getPlatform();return t==="ios"||t==="android"}const mL={initializeAdMob:Wy,prepareRewardedAd:WqA,showRewardedAd:zqA,prepareInterstitialAd:ED,showInterstitialAd:LR,isNativeAdSupported:YgA},JW=B2,LW=A6,qW=e6,bw="ad:complete",HgA=p.createContext({onHandEnd:async()=>{},onCrapsShooterTurnEnd:async()=>{},showAdNow:async()=>{},cancelAd:()=>{},isAdEnabled:!1,isAdShowing:!1,adConfig:{handsPerAd:A6,crapsShooterTurnsPerAd:e6,minIntervalMs:Am,displayDelayMs:em}}),zy=()=>p.useContext(HgA);function VqA({children:t}){const[A,e]=p.useState(!1),[i,g]=p.useState(!1),I=YgA(),n=!A&&I,o=p.useRef(!1),a=p.useRef(0),r=p.useRef(0),s=p.useRef(0),B=p.useRef(!1);p.useEffect(()=>{const f=async()=>{try{const k=Sr();if(!k)return;const U=(await k.getCustomerInfo?.())?.entitlements?.active||{},F=Object.keys(U).length>0;let b=!1;JW&&(b=!!U?.[JW]||F),e(b)}catch{}};f();const M=setInterval(f,6e4);return()=>clearInterval(M)},[]),p.useEffect(()=>{n&&ED().catch(()=>{})},[n]);const c=p.useCallback(async()=>{if(!n||o.current)return;const f=Date.now();if(!(f-s.current<Am)&&(a.current+=1,!(a.current<LW))){o.current=!0,a.current=0,s.current=f;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}if(g(!0),B.current=!1,await new Promise(M=>setTimeout(M,em)),B.current){o.current=!1,g(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(bw))}catch{}return}try{await LR()}catch{}finally{o.current=!1,g(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(bw))}catch{}ED().catch(()=>{})}}},[n]),E=p.useCallback(async()=>{if(!n||o.current)return;const f=Date.now();if(!(f-s.current<Am)&&(r.current+=1,!(r.current<qW))){o.current=!0,r.current=0,s.current=f;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}g(!0),await new Promise(M=>setTimeout(M,em));try{await LR()}catch{}finally{o.current=!1,g(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(bw))}catch{}ED().catch(()=>{})}}},[n]),D=p.useCallback(async()=>{if(!n||o.current)return;const f=Date.now();if(!(f-s.current<Am)){o.current=!0,a.current=0,r.current=0,s.current=f;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}g(!0),await new Promise(M=>setTimeout(M,em));try{await LR()}catch{}finally{o.current=!1,g(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(bw))}catch{}ED().catch(()=>{})}}},[n]),y=p.useCallback(()=>{if(o.current){B.current=!0,o.current=!1,g(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent(bw))}catch{}}},[]),S={handsPerAd:LW,crapsShooterTurnsPerAd:qW,minIntervalMs:Am,displayDelayMs:em};return Q.jsx(HgA.Provider,{value:{onHandEnd:c,onCrapsShooterTurnEnd:E,showAdNow:D,cancelAd:y,isAdEnabled:n,isAdShowing:i,adConfig:S},children:t})}const OgA=Ea();async function XqA(t){if(!t)return null;try{const A=await Nn(),e=`${OgA}/api/rooms/${encodeURIComponent(t)}/craps-history?playerScope=me&limit=200`,g=await(await fetch(e,{credentials:"include",cache:"no-store",headers:A?{Authorization:`Bearer ${A}`}:void 0})).json();return g&&g.ok&&g.data&&Array.isArray(g.data.items)?g.data.items:null}catch{return null}}async function $qA(t){if(!t)return null;try{const A=await Nn(),i=await(await fetch(`${OgA}/api/rooms/${encodeURIComponent(t)}/settlements?playerScope=me&limit=500`,{credentials:"include",cache:"no-store",headers:A?{Authorization:`Bearer ${A}`}:void 0})).json();return i&&i.ok&&i.data&&Array.isArray(i.data.items)?i.data.items:null}catch{return null}}const YO=[gH,IH,nH,oH,aH,rH,sH,CH,BH];function AxA(t){let A=0;for(let e=0;e<t.length;e++)A=A*31+t.charCodeAt(e)>>>0;return A%(YO.length*6)}function exA(t){if(!t||!t.startsWith("sprite:"))return null;const A=t.slice(7).split("/"),e=Number(A[0]),i=Number(A[1]);return!Number.isFinite(e)||!Number.isFinite(i)||e<0||e>=YO.length?null:{sheetIdx:e,tile:i%6}}function xW({seed:t,sheetIdx:A,tile:e}){const i=AxA(t),g=A??Math.floor(i/6),I=e??i%6,n=YO[g],o=2,a=3,r=I%o,s=Math.floor(I/o),B=o*100,c=g===4?400:a*100,E=B/100,D=c/100,y=r/(E-1)*100,S=g===8?s*37:D>1?s/(D-1)*100:0,f={display:"block",width:"100%",height:"100%",borderRadius:"8px",backgroundImage:`url(${n})`,backgroundSize:`${B}% ${c}%`,backgroundPosition:`${y}% ${S}%`,backgroundRepeat:"no-repeat"};return Q.jsx("span",{className:"avatar-sprite",style:f,"aria-hidden":!0})}function txA({stream:t,labelFallback:A,muted:e=!0,forceHideVideo:i=!1,active:g=!1,avatarUrl:I}){const n=p.useRef(null),[o,a]=p.useState(!1),[r,s]=p.useState(!1);p.useEffect(()=>{s(!1)},[I]);const B=p.useCallback(()=>t?t.getVideoTracks().some(S=>S.readyState==="live"&&S.enabled!==!1&&!S.muted):!1,[t]);p.useEffect(()=>{if(!t){a(!1);return}const S=()=>a(B());S();const f=new Set,M=m=>{f.has(m)||(f.add(m),m.addEventListener("mute",S),m.addEventListener("unmute",S),m.addEventListener("ended",S))};for(const m of t.getVideoTracks())M(m);const k=()=>{S();for(const m of t.getVideoTracks())M(m)};return t.addEventListener("addtrack",k),t.addEventListener("removetrack",k),()=>{for(const m of f)m.removeEventListener("mute",S),m.removeEventListener("unmute",S),m.removeEventListener("ended",S);t.removeEventListener("addtrack",k),t.removeEventListener("removetrack",k)}},[t,B]),p.useEffect(()=>{const S=n.current;if(!S||!t)return;const f=()=>{B()&&a(!0)},M=setInterval(()=>{const k=B(),m=S.readyState>=2;a(U=>m&&k&&!U?!0:!k&&U?!1:U)},1e3);return S.addEventListener("canplay",f),S.addEventListener("playing",f),()=>{clearInterval(M),S.removeEventListener("canplay",f),S.removeEventListener("playing",f)}},[t,B]),p.useEffect(()=>{const S=n.current;if(!S)return;let f=0;const M=4,k=b=>{if(!t||!t.getVideoTracks().some(G=>G.readyState==="live"&&G.enabled!==!1)||!S.paused&&S.readyState>=2)return;S.play()?.catch(()=>{if(f<M){const G=150+f*200;f++,setTimeout(()=>k(`${b}:retry${f}`),G)}else try{window.dispatchEvent(new CustomEvent("rtc:videoStall",{detail:{reason:b}}))}catch{}})},m=()=>k("ui"),U=()=>{document.hidden||k("visibility")},F=()=>{if(!t||!S)return;const b=t.getVideoTracks()[0];b&&b.readyState==="live"&&S.paused&&k("pause-event")};return window.addEventListener("ui:roll",m),window.addEventListener("ui:placeMainBet",m),window.addEventListener("ui:cancelMainBet",m),document.addEventListener("visibilitychange",U),S.addEventListener("pause",F),()=>{window.removeEventListener("ui:roll",m),window.removeEventListener("ui:placeMainBet",m),window.removeEventListener("ui:cancelMainBet",m),document.removeEventListener("visibilitychange",U),S.removeEventListener("pause",F)}},[t]),p.useLayoutEffect(()=>{const S=n.current;if(S){try{S.setAttribute("playsinline","true"),S.setAttribute("webkit-playsinline","true"),S.setAttribute("muted",e?"true":"false"),S.disablePictureInPicture=!0}catch{}if(S.srcObject!==t&&(S.srcObject=t??null),t){S.muted=!!e;const f=()=>{S.play().catch(()=>{setTimeout(()=>{S.play().catch(()=>{})},160)})};f(),S.onloadedmetadata=f}else S.onloadedmetadata=null}},[t,e]);const c=!i&&!!t&&o,E=p.useMemo(()=>exA(I),[I]),D=p.useCallback(()=>s(!0),[]),y=E?Q.jsx(xW,{seed:A,sheetIdx:E.sheetIdx,tile:E.tile}):I&&!r?Q.jsx("img",{src:I,alt:A,className:"avatar-uploaded",style:{width:"100%",height:"100%",objectFit:"cover"},onError:D}):Q.jsx(xW,{seed:A});return i||!t?Q.jsx("div",{className:`avatar-shell is-avatar ${g?"is-rolling":""}`,children:y}):Q.jsxs("div",{className:`avatar-shell ${g?" is-rolling":""}`,style:{position:"relative",overflow:"hidden"},children:[Q.jsx("div",{className:`avatar-image ${g?"is-rolling":""}`,style:{position:"absolute",inset:0,opacity:c?0:1,transition:"opacity 160ms ease",display:"flex",alignItems:"center",justifyContent:"center",background:"radial-gradient(circle at 30% 35%, #2e2e2e, #141414)"},children:y}),Q.jsx("video",{ref:n,playsInline:!0,autoPlay:!0,muted:e,className:"avatar-video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#000",position:"relative",opacity:c?1:0,transition:"opacity 160ms ease"}})]})}function ixA(t,A){return!(t.forceHideVideo!==A.forceHideVideo||t.muted!==A.muted||t.stream!==A.stream||t.avatarUrl!==A.avatarUrl||t.active!==A.active||t.labelFallback!==A.labelFallback)}const gxA=p.memo(txA,ixA);function IxA(t){const e=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),i=(e[0]?.[0]??"").toUpperCase(),g=(e[1]?.[0]??"").toUpperCase();return i+g||i||"?"}function HO(t){if(!t||t.length!==3)return"nothing";const A=new Set(t);if(A.size===1)return"triple";const e=[...t].sort().join("");return e==="123"?"123":e==="456"?"456":A.size===2?"point":"nothing"}function Ym(t,A){return HO(t)}function TW(t,A,e,i,g){if(!t)return null;if(t===e)return g||null;for(let I=A.length-1;I>=0;I--){const n=A[I];if(n.playerId===t&&Array.isArray(n.result)&&n.result.length===3)return n.result}return null}function kL(t){if(!t||t.length!==3)return{score:0,label:"—",kind:"invalid"};const A=HO(t);if(A==="456")return{score:1e4,label:"4-5-6 (Auto Win)",kind:A};if(A==="123")return{score:2e3,label:"1-2-3 (Auto Lose)",kind:A};if(A==="triple"){const e=t[0];return{score:8e3+e*100,label:`Triple ${e}s`,kind:A}}if(A==="point"){const e={};for(const g of t)e[g]=(e[g]||0)+1;let i;for(const[g,I]of Object.entries(e))if(I===1){i=Number(g);break}return i==null?{score:0,label:t.slice().sort().join("-"),kind:"nothing"}:{score:4e3+i*100,label:`Point ${i}`,kind:A,point:i}}return A==="nothing"?{score:0,label:t.slice().sort().join("-"),kind:A}:{score:0,label:t.slice().sort().join("-"),kind:A}}function PgA(t){const{anchorRect:A,anchorEl:e,onClose:i,onMessages:g,onSendMoney:I,onAddFriend:n,onUnfriend:o,onBlockUser:a,onViewProfile:r,isFriend:s,isBlocked:B,hideAddFriend:c}=t,[E,D]=p.useState({top:0,left:0}),[y,S]=p.useState(!1),f=p.useRef(null),M=p.useRef(Date.now());if(p.useLayoutEffect(()=>{if(!A)return;D({top:A.bottom+8,left:A.left}),M.current=Date.now(),S(!0)},[A]),p.useLayoutEffect(()=>{if(!A||!f.current)return;const U=f.current.getBoundingClientRect(),F=window.innerWidth,b=window.innerHeight,K=8,R=window.visualViewport,G=R?R.offsetTop:0,J=parseInt(getComputedStyle(document.documentElement).getPropertyValue("padding-top"))||0;let x=A.bottom+K,H=A.left;H+U.width>F-K&&(H=Math.max(K,F-U.width-K)),x+U.height>b-K&&(x=Math.max(K+J+G,A.top-U.height-K)),x<K+J+G&&(x=K+J+G),H<K&&(H=K),D({top:x,left:H})},[A,y]),p.useEffect(()=>{const m=R=>{if(Date.now()-M.current<120)return;const G=R.target;e&&(e===G||e.contains(G))||f.current&&(f.current.contains(G)||i())},U=R=>{R.key==="Escape"&&i()};let F=null;const b=()=>{Date.now()-M.current<120||(F&&window.clearTimeout(F),F=window.setTimeout(()=>i(),120))},K=b;return document.addEventListener("mousedown",m),window.addEventListener("keydown",U),window.addEventListener("scroll",b,{passive:!0,capture:!0}),window.addEventListener("resize",K),()=>{document.removeEventListener("mousedown",m),window.removeEventListener("keydown",U),window.removeEventListener("scroll",b,{capture:!0}),window.removeEventListener("resize",K),F&&window.clearTimeout(F)}},[i,e]),!A)return null;const k=Q.jsxs("div",{className:"avatar-context-menu",style:{top:E.top,left:E.left},ref:f,role:"menu","aria-label":"Player actions",onMouseDown:m=>m.stopPropagation(),children:[r&&Q.jsx("button",{role:"menuitem",onClick:()=>{r(),i()},className:"avatar-context-menu__item",children:"View Profile"}),g&&Q.jsx("button",{role:"menuitem",onClick:()=>{g?.(),i()},className:"avatar-context-menu__item",children:"Messages"}),!s&&!c&&n&&Q.jsx("button",{role:"menuitem",onClick:()=>{n(),i()},className:"avatar-context-menu__item",disabled:!!s||!!B||!n,title:s?"Already friends":B?"User is blocked":"Add Friend",children:s?"Friend ✓":"Add Friend"}),s&&o&&Q.jsx("button",{role:"menuitem",onClick:()=>{o(),i()},className:"avatar-context-menu__item",children:"Unfriend"}),Q.jsx("button",{role:"menuitem",onClick:()=>{a?.(),i()},className:"avatar-context-menu__item",disabled:!a,title:B?"Unblock user":"Block user",children:B?"Unblock":"Block"})]});return typeof document<"u"?Zc.createPortal(k,document.body):k}function jgA({targetId:t,anchorRect:A,anchorEl:e,onClose:i,onOpenDM:g,onOpenSendMoney:I,meId:n}){const{friends:o,friendRequests:a,isBlocked:r,blockUser:s,unblockUser:B,addFriend:c,removeFriend:E}=fu();Di();const D=a.some(y=>y.status==="PENDING"&&y.fromUserId===n&&y.toUserId===t);return Q.jsx(PgA,{anchorRect:A,anchorEl:e,onClose:i,onMessages:g?()=>{g(t),i()}:void 0,onSendMoney:()=>{I?.(t),i()},hideAddFriend:D,onAddFriend:()=>{!o.find(y=>y.id===t)&&!r(t)&&c(t)},onUnfriend:()=>{o.find(y=>y.id===t)&&E(t)},onBlockUser:async()=>{r(t)?await B(t):await s(t)},isFriend:!!o.find(y=>y.id===t),isBlocked:r(t)})}const nxA=p.forwardRef(function({id:A,display:e,isCurrentRoller:i,isMe:g,balance:I,isSpectating:n=!1,folded:o=!1,tags:a,stream:r,diceResult:s,onOpenMenu:B,showMenu:c,menuProps:E,forceHideVideo:D,actDeadlineTs:y,avatarUrl:S,showActingTimerRing:f=!0,presenceStatus:M},k){const m=IxA(e);return Q.jsxs(uB.li,{layout:!0,layoutDependency:A,transition:{type:"spring",stiffness:420,damping:38,mass:.6},ref:k,className:["player","player--avatar",i?"is-rolling":"",g?"is-me":"",o?"player--folded":""].join(" "),"data-player-id":A,title:`${e}${a.length?" · "+a.join(" · "):""}`,"aria-label":`${e}${a.length?", "+a.join(", "):""}`,children:[Q.jsxs("div",{className:["avatar-ring",i?"is-rolling":""].join(" "),onClick:U=>{U.stopPropagation(),B(A,U.currentTarget)},onKeyDown:U=>{(U.key==="Enter"||U.key===" ")&&(U.preventDefault(),B(A,U.currentTarget))},role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":c,children:[Q.jsx(gxA,{active:i,stream:r,labelFallback:m,muted:g,forceHideVideo:D,avatarUrl:S}),typeof I=="number"&&Q.jsx("div",{className:"avatar-balance-pill","aria-label":`Balance ${PU(I)}`,children:PU(I)})]}),g&&Q.jsx("span",{className:"status-dot","aria-hidden":!0}),!g&&M&&Q.jsx("span",{className:`presence-dot presence-dot--${M}`,"aria-label":M==="active"?"Online":"Away"}),Q.jsxs("div",{className:"player-mini",children:[Q.jsxs("div",{className:"player-name",children:[Q.jsx("span",{className:"player-name__text",children:e}),a.includes("B")&&Q.jsx("span",{className:"player-tag tag--B","aria-label":"Banker",children:"B"}),a.includes("D")&&Q.jsx("span",{className:"player-tag tag--D","aria-label":"Dealer",children:"D"}),a.includes("SB")&&Q.jsx("span",{className:"player-tag tag--SB","aria-label":"Small blind",children:"SB"}),a.includes("BB")&&Q.jsx("span",{className:"player-tag tag--BB","aria-label":"Big blind",children:"BB"})]}),n&&Q.jsx("div",{className:"player-spectating","aria-label":"spectating",children:"spectating"}),Q.jsx("div",{className:"player-faces",children:s??Q.jsx("span",{style:{display:"inline-block",height:22},"aria-hidden":!0})})]}),c&&E&&Q.jsx(jgA,{...E})]})}),ZgA=[gH,IH,nH,oH,aH,rH,sH,CH,BH];function oxA(t){let A=0;for(let e=0;e<t.length;e++)A=A*31+t.charCodeAt(e)>>>0;return A%(ZgA.length*6)}function axA({seed:t}){const A=oxA(t),e=Math.floor(A/6),i=A%6,g=ZgA[e],I=2,n=3,o=i%I,a=Math.floor(i/I),r={display:"block",width:"100%",height:"100%",borderRadius:"8px",backgroundImage:`url(${g})`,backgroundSize:`${I*100}% ${n*100}%`,backgroundPosition:`${o*(100/(I-1))}% ${a*(100/(n-1))}%`,backgroundRepeat:"no-repeat"};return Q.jsx("span",{className:"avatar-sprite",style:r,"aria-hidden":!0})}function qR({players:t,meId:A,className:e,showBalance:i=!1,onPlayerClick:g,renderActions:I}){return Q.jsx("div",{className:["card",e].filter(Boolean).join(" "),children:Q.jsx("ul",{className:"players players--avatars",role:"list",children:t.map((n,o)=>{const a=n.id??String(o),r=n.name??a;return Q.jsxs("li",{className:["player","player--avatar",a===A?"is-me":""].join(" "),"data-player-id":a,title:r,"aria-label":r,onClick:()=>g?.(a),role:g?"button":void 0,tabIndex:g?0:-1,onKeyDown:s=>{g&&(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),g(a))},children:[Q.jsx("div",{className:"avatar-ring","aria-hidden":!0,children:Q.jsx("div",{className:"video-bubble",children:Q.jsx(axA,{seed:n.id})})}),a===A&&Q.jsx("span",{className:"status-dot","aria-hidden":!0}),Q.jsxs("div",{className:"player-info",children:[Q.jsx("div",{className:"player-name",children:r}),i&&Q.jsx("div",{className:"player-bank",children:Q.jsxs("b",{children:["$",n.balance??0]})})]}),I?.(n)]},a)})})})}function OO(){const[t,A]=p.useState(null),[e,i]=p.useState(null),[g,I]=p.useState(null);return{forUserId:t,anchorRect:e,anchorEl:g,openFor:(a,r)=>{r&&(A(a),I(r),i(r.getBoundingClientRect()))},close:()=>{A(null),i(null),I(null)}}}function WgA({players:t,meId:A,className:e,onOpenDM:i,onOpenSendMoney:g,renderActionsOverride:I}){const{forUserId:n,anchorRect:o,anchorEl:a,openFor:r,close:s}=OO(),B=(E,D)=>{!D||E===A||r(E,D)},c=()=>s();return Q.jsxs("div",{className:e,children:[Q.jsx(qR,{className:"card",players:t,meId:A,showBalance:!1,renderActions:I?E=>I(E):E=>Q.jsx("button",{className:"btn btn-xs",onClick:D=>B(E.id,D.currentTarget),"aria-haspopup":"menu","aria-expanded":n===E.id,style:{marginLeft:"auto"},children:"⋯"})}),!I&&n&&Q.jsx(jgA,{targetId:n,anchorRect:o,anchorEl:a,onClose:c,onOpenDM:i,onOpenSendMoney:g,meId:A})]})}function rxA(t,A,e,i){const g=p.useRef(new Map),I=p.useRef(new Map),[n,o]=p.useState(0),a=p.useRef(i),r=p.useRef(0),s=p.useCallback(B=>{g.current.get(B)||(g.current.set(B,!0),I.current.set(B,performance.now()),o(c=>c+1))},[]);return p.useEffect(()=>{a.current!==i&&(g.current.clear(),I.current.clear(),r.current=0,o(B=>B+1),a.current=i)},[i]),p.useEffect(()=>{for(let B=r.current;B<t.length;B++){const c=t[B],E=c.result;Ym(E,c.playerId===A)!=="nothing"&&s(c.playerId)}r.current=t.length},[t,s,A]),p.useEffect(()=>{if(!A||!e.bankRoll?.raw)return;Ym(e.bankRoll.raw)!=="nothing"&&s(A)},[A,e.bankRoll,s]),{revealedPlayers:g.current,revealTimesRef:I,revealVersion:n,markRevealed:s}}function sxA(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 CxA(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 PO(t,A){if(!t)return{outcome:null,isChallenger:!1,needsAnimation:!1};const e=t.type==="MAIN"||t.type==="SIDE"?t.type:t.predicate||t.subjectId?"SIDE":"MAIN";let i=null,g=!1,I=!1,n,o=typeof t.result=="string"?t.result.toUpperCase():"",a=!1;if(!o||!["WIN","LOSE","PUSH","TIE"].includes(o)){const B=Iu(t,A);B&&B.myResult&&(o=B.myResult.toUpperCase(),a=!0)}const r=o==="WIN"||o==="LOSE",s=o==="PUSH"||o==="TIE";if(!r&&!s)return{outcome:null,isChallenger:!1,needsAnimation:!1};if(a)return r?i=o==="WIN"?"win":"lose":i="push",I=r,{outcome:i,isChallenger:g,subtitle:n,needsAnimation:I};if(e==="MAIN"){const B=t.acceptedById||t.bankerId,c=t.playerId;if(!B||!c)return{outcome:null,isChallenger:!1,needsAnimation:!1};r?(A===c?(i=o==="WIN"?"win":"lose",g=!0):A===B?i=o==="WIN"?"lose":"win":i=null,I=!0):s&&((A===c||A===B)&&(i="push"),I=!0)}else{const B=t.playerId,c=t.acceptedById||void 0;if(r?(A===B?(i=o==="WIN"?"win":"lose",g=!0):A===c?i=o==="WIN"?"lose":"win":i=null,I=!!(B&&c)):s&&((A===B||A===c)&&(i="push"),I=!1),t.predicate||t.subjectId){const E=[];t.predicate&&E.push(sxA(t.predicate)),t.subjectId&&E.push(`on ${t.subjectId}`),E.length&&(n=E.join(" "))}}return{outcome:i,isChallenger:g,subtitle:n,needsAnimation:I}}function BxA(t,A){const e=t.acceptedById||t.bankerId,i=t.playerId;if(!e||!i)return null;let g,I;const n=String(t.result||"").toUpperCase();if(n==="WIN")g=e,I=i;else if(n==="LOSE")g=i,I=e;else return null;if(!g||!I||g===I)return null;const o=A(g),a=A(I);if(!o||!a||Math.hypot(a.x-o.x,a.y-o.y)<4)return null;const s=Number(t.amount)||1;return{id:`${g}-${I}-${t.id}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,settlementId:String(t.id),amount:s,fromId:g,toId:I,startX:o.x,startY:o.y,endX:a.x,endY:a.y}}function zgA(t,A,e,i){if(!Array.isArray(t)||t.length===0)return[];const g=[];for(const I of t){if(!I)continue;const n=I.type?I.type:I.predicate||I.subjectId?"SIDE":"MAIN",o={...I,type:n};o.type==="MAIN"&&!o.acceptedById&&!o.bankerId&&i&&(o.bankerId=i||void 0),!(typeof o.roundSeq!="number"||o.roundSeq!==A)&&(e.has(o.id)||(e.add(o.id),g.push(o)))}return g}function jO(){const[t,A]=p.useState(!1),[e,i]=p.useState(!0);p.useEffect(()=>{let I=!0;return(async()=>{try{const n=await jo();I&&(i(n.showAnimations!==!1),A(!0))}catch{I&&A(!0)}})(),()=>{I=!1}},[]);const g=p.useCallback(async I=>{const n=typeof I=="boolean"?I:!e;i(n);try{const o=await jo(),a={...gC,...o,showAnimations:n};await VE(a)}catch{}},[e]);return{ready:t,showAnimations:e,toggleAnimations:g}}const VgA=[1,5,10,25,100,500];var xR=(t=>(t.FREE="FREE",t.PREMIUM="PREMIUM",t))(xR||{});const ON={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]},cxA=[500,100,25,10,5,1],ML=20;function ZO(t){const A=[];let e=Math.max(1,Math.floor(t));for(const i of cxA){for(;e>=i&&(A.push(i),e-=i,!(A.length>=ML)););if(A.length>=ML)break}return e>0&&A.length<ML&&A.push(e),A.length===0&&A.push(1),A}function XgA({anim:t,onComplete:A}){const{showAnimations:e}=jO(),i=e===!1,g=p.useRef(!1),I=p.useRef(t).current,{amount:n,startX:o,startY:a,endX:r,endY:s}=I,B=p.useRef([]);if(B.current.length===0){const E=ZO(n),D=Math.max(0,I.startDelaySec??.25),y=Math.min(8,Math.ceil(E.length/2)),S=(E.length-1)/2;B.current=E.map((f,M)=>({id:`${t.id}-sub-${M}`,value:f,delay:D+M*.05,yOffset:(M-S)*(y>1?4:0)}))}const c=p.useCallback(()=>{g.current||(g.current=!0,A())},[A]);return p.useEffect(()=>{if(i)return Promise.resolve().then(()=>{try{c()}catch{}}),()=>{};const E=B.current.map(f=>f.delay),y=(E.length?Math.max(...E):0)*1e3+900,S=window.setTimeout(c,y);return()=>{window.clearTimeout(S)}},[i,c]),i?null:Q.jsx("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:5},children:(()=>{const E=B.current.map(D=>D.delay);return E.length&&Math.min(...E),B.current.map((D,y)=>{const S=o-18,f=r-18,M=a-18+D.yOffset,k=s-18+D.yOffset;return Q.jsx(uB.div,{initial:{x:S,y:M,scale:.85,opacity:0},animate:{x:f,y:k,scale:1.05+y%3*.03,opacity:1},transition:{delay:D.delay,type:"spring",stiffness:150,damping:20,duration:.55+y%4*.03},onAnimationComplete:()=>{y===B.current.length-1&&c()},style:{position:"absolute"},children:Q.jsx(hB,{mini:!0,value:D.value,className:"chip--flight"})},D.id)})})()})}const EY=new Set;function lxA(t){return EY.add(t),()=>EY.delete(t)}function QxA(t){t&&EY.forEach(A=>{try{A(t)}catch{}})}function ExA({newSettlements:t,roundSeqNow:A,getAvatarCenter:e,getPlayerName:i,myId:g,bankerDice:I,bankerId:n,isPartyReady:o,onAnimCompleteBySettlement:a}){const[r,s]=p.useState([]),[B,c]=p.useState([]),E=p.useRef(new Set),D=p.useRef(new Set),y=p.useRef(null),S=p.useRef(new Set),f=p.useCallback(R=>(D.current.add(R),R),[]),M=p.useCallback(()=>{D.current.forEach(R=>clearTimeout(R)),D.current.clear(),y.current!=null&&(cancelAnimationFrame(y.current),y.current=null)},[]);p.useEffect(()=>()=>{M()},[M]);const k=p.useCallback(R=>e(R),[e]),m=p.useCallback(R=>BxA(R,k),[k]),U=p.useCallback((R,G=0)=>{if(o&&R?.type==="MAIN"){const O=R?.playerId,$=R?.acceptedById||R?.bankerId;if(!(!!O&&o(O)&&!!$&&o($))){f(setTimeout(()=>U(R,G),120));return}}const x=R?.acceptedById||R?.bankerId,H=R?.playerId;if(!x||!H){if(G>25)return;const O=80+G*60;f(setTimeout(()=>U(R,G+1),O));return}const P=String(R.result||"").toUpperCase();let j,q;if(P==="WIN"?(j=x,q=H):P==="LOSE"&&(j=H,q=x),j&&q){const O=k(j),$=k(q);if(!O||!$){if(G>25)return;if(G<5&&typeof requestAnimationFrame<"u")y.current=requestAnimationFrame(()=>U(R,G+1));else{const gA=80+G*60;f(setTimeout(()=>U(R,G+1),gA))}return}}if(G>25)return;const Y=m(R);if(!Y){const O=80+G*60;G<5&&typeof requestAnimationFrame<"u"?y.current=requestAnimationFrame(()=>U(R,G+1)):f(setTimeout(()=>U(R,G+1),O));return}s(O=>[...O,[Y]])},[m,o,f]);p.useEffect(()=>{if(!t.length)return;const R=zgA(t,A,E.current,n);for(const G of R){if(S.current.has(G.id))continue;S.current.add(G.id);const{outcome:J,needsAnimation:x}=PO(G,g);x&&f(setTimeout(()=>U(G),200))}},[t,A,g,n,U]),p.useEffect(()=>{B.length===0&&r.length>0&&(c(r[0]),s(R=>R.slice(1)))},[B.length,r]);const F=p.useCallback(R=>{c(G=>{const J=G.filter(H=>H.id!==R),x=G.find(H=>H.id===R);try{x?.settlementId&&typeof a=="function"&&a(x.settlementId),x?.settlementId&&(QxA(x.settlementId),E.current.add(x.settlementId))}catch{}return J})},[a]),b=p.useCallback(()=>{M(),s([]),c([]),E.current.clear(),S.current.clear()},[M]),K=p.useCallback(R=>{R?.length&&s(G=>[...G,R])},[]);return{activeBatch:B,handleAnimItemComplete:F,resetForRound:b,queueBatch:K}}function uxA(){const{hasActive:t}=qr(),A=p.useRef([]),e=p.useRef(!1),i=p.useRef(null),g=p.useRef(new Set),I=p.useCallback(()=>{Xa("Light").catch(()=>{})},[]),n=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),o=Zn?.diceToChipDelayMs+600,a=p.useCallback(()=>{if(e.current)return;e.current=!0;const c=()=>{i.current&&(window.clearTimeout(i.current),i.current=null);const E=A.current;if(!E.length){e.current=!1;return}const D=E[0],y=n();if(y<D.readyAt){i.current=window.setTimeout(c,Math.min(500,Math.max(20,D.readyAt-y)));return}if(D.revealGate){const f=D.revealGate,M=f.challengerId?f.getRevealTime(f.challengerId):void 0,k=f.bankerId?f.getRevealTime(f.bankerId):void 0;if(typeof M=="number"&&typeof k=="number"){const U=Math.max(M,k)+f.postRevealDelayMs;if(y<U){const F=Math.min(U-y,1e3);i.current=window.setTimeout(c,Math.max(50,F));return}}else if(y-D.enqueuedAt<o){i.current=window.setTimeout(c,120);return}}try{I()}catch{}try{D.run()}catch{}const S=E.shift();S?.key&&g.current.add(S.key),i.current=window.setTimeout(c,0)};c()},[I]),r=p.useCallback((c,E)=>{const D=Math.max(0,typeof E?.delayMs=="number"?E.delayMs:0),y=n(),S=y+(E?.immediate?0:D);if(E?.key){if(g.current.has(E.key))return;g.current.add(E.key)}A.current.push({run:c,readyAt:S,revealGate:E?.revealGate,key:E?.key,enqueuedAt:y}),a()},[a]),s=p.useCallback(()=>{i.current&&(window.clearTimeout(i.current),i.current=null),e.current=!1,a()},[a]),B=p.useCallback(()=>{i.current&&(window.clearTimeout(i.current),i.current=null),A.current=[],e.current=!1},[]);return{schedule:r,nudge:s,clear:B,hasActive:t}}function hxA({newSettlements:t,roundSeqNow:A,myId:e,bankerDice:i,getPlayerName:g,getPlayerAvatarUrl:I,getPlayerDice:n,getRevealTime:o,postRevealDelayMs:a=0,bankerId:r}){const{win:s,lose:B,push:c}=qr(),E=p.useRef(new Set),{schedule:D,nudge:y}=uxA(),S=p.useRef(null),f=p.useRef(!1),M=p.useRef(!1);p.useRef(new Set);const k=p.useRef(null);p.useEffect(()=>{const F=i;if(!F||F.length!==3){S.current=null,f.current=!1;return}const b={};for(const G of F)b[G]=(b[G]||0)+1;const K=Object.keys(b).map(Number);K.length===2&&K.some(G=>b[G]===1)?S.current=K.find(G=>b[G]===1):S.current=null;try{const G=[...F].sort((J,x)=>J-x).join(",");f.current=G==="4,5,6",M.current=G==="1,2,3"}catch{f.current=!1,M.current=!1}},[i]);const m=p.useCallback((F,b,K,R,G,J,x)=>{if(F==="win"||F==="lose")try{window.dispatchEvent(new CustomEvent("ceelo:result",{detail:{result:F}}))}catch{}const H=b?" Clutch":"",P=J?J.replace(/^(won|lost)\s*/i,"").trim():"",j=x?.length?{playerAvatars:x}:void 0;if(R)F==="win"?s(`${R}${H}`,K,void 0,void 0,j):F==="lose"?B(R,K,void 0,void 0,j):c(R,K,void 0,void 0,j);else if(G)F==="win"?s("win",K,void 0,void 0,j):F==="lose"?B("lose",K,void 0,void 0,j):c("push",K,void 0,void 0,j);else{const q=P?`Won ${P}!${H}`:`You Won!${H}`,Y=P?`Lost ${P}!`:"You Lost!";F==="win"?s(q,K,void 0,void 0,j):F==="lose"?B(Y,K,void 0,void 0,j):c("Push!",K,void 0,void 0,j)}},[s,B,c]),U=p.useCallback((F,b,K,R,G,J={})=>{const x=b&&(S.current??0)>=5&&F==="win";D(()=>m(F,x,K,R,G),J)},[D,m]);p.useEffect(()=>{const F=zgA(t,A,E.current,r);if(F.length)for(const b of F){const{outcome:K,isChallenger:R,subtitle:G,needsAnimation:J}=PO(b,e);if(!K)continue;let x=G,H=!1;if(b.type==="SIDE"){const mA=b.subjectId&&g(b.subjectId)||b.subjectId||"Player",IA=CxA(b.predicate);let uA;K==="win"?uA=`${mA} ${IA}`:K==="lose"?IA==="beats banker"?uA=`${mA} does not beat banker`:IA==="loses to banker"?uA=`${mA} does not lose to banker`:IA==="ties banker"?uA=`${mA} does not tie banker`:uA=`${mA} ${IA}`:uA=`${mA} ${IA}`,x=uA,H=!0}else G&&b.subjectId&&G.includes("on ")&&(x=G.replace(/on \S+$/,`on ${g(b.subjectId)||b.subjectId}`));try{const mA=Iu(b,e);if(mA&&mA.label&&!(b.type==="SIDE"&&H)){const uA=String(mA.label||"").trim(),KA=String(x||"").trim();if(KA.length===0)x=uA;else if(uA.length>0){const FA=KA.toLowerCase(),RA=uA.toLowerCase();FA.includes(RA)||(x=`${KA} — ${uA}`)}}}catch{}K==="push"&&((x||"").trim()||(x="No Action"));const P=b.type==="SIDE"?b.subjectId||void 0:b.playerId,j=b.type==="SIDE"?r:b.acceptedById||b.bankerId||r,q=!!(f.current||M.current),Y=q||b.type==="SIDE"?!1:J,O=q?!0:!Y,$=!q&&Y?Zn.diceToChipDelayMs+50:0,gA=P,z=j,X=o?Zn.revealFlashPostDelayMs:0,sA=o&&!q?{getRevealTime:o,challengerId:gA,bankerId:z,postRevealDelayMs:X}:void 0,rA=sA?0:Y?$:0;if(b.type==="MAIN"){let mA;try{const RA=Iu(b,e);mA=String(RA?.label||"").trim()||void 0}catch{}let IA,uA;try{const RA=b,MA=(Array.isArray(RA.bankerDice)&&RA.bankerDice.length===3?RA.bankerDice:null)||(n&&r?n(r):null),oA=(Array.isArray(RA.challengerDice)&&RA.challengerDice.length===3?RA.challengerDice:null)||(n?n(b.playerId):null),AA=["","⚀","⚁","⚂","⚃","⚄","⚅"],tA=SA=>SA.slice().sort((NA,OA)=>NA-OA).map(NA=>AA[NA]||String(NA)).join(""),iA=r&&g(r)||"Banker",hA=g(b.playerId)||"Challenger",DA={name:iA,avatarUrl:r&&I?I(r):void 0},dA={name:hA,avatarUrl:I?I(b.playerId):void 0};if(MA&&oA){const SA=kL(MA),NA=kL(oA),OA=new Set(["456","123","triple","point"]);if(OA.has(SA.kind)&&OA.has(NA.kind)){const nA=`${iA}: ${tA(MA)} ${SA.label}`,eA=`${hA}: ${tA(oA)} ${NA.label}`;SA.score>=NA.score?(IA=`${nA}
${eA}`,uA=[DA,dA]):(IA=`${eA}
${nA}`,uA=[dA,DA])}}else if(MA){const SA=kL(MA);(SA.kind==="456"||SA.kind==="123")&&(IA=`${r&&g(r)||"Banker"}: ${tA(MA)} ${SA.label}`)}}catch{}let KA;K==="push"?KA=IA||"No Action":IA?KA=IA:KA=mA||"",D(()=>{m(K,R,KA,void 0,H,mA,uA)},{immediate:q?!0:O&&!sA,delayMs:rA,revealGate:sA,key:String(b.id)})}else U(K,R,x,void 0,H,{immediate:q?!0:O&&!sA,delayMs:rA,revealGate:sA,key:String(b.id)})}},[t,A,e,g,U,r]),p.useEffect(()=>{if(!(f.current||M.current)||k.current===A||Array.isArray(t)&&t.some(Y=>Y?.roundSeq===A))return;const K=f.current,R=r&&g(r)||"Banker",G=["","⚀","⚁","⚂","⚃","⚄","⚅"],x=i?` ${(Y=>Y.slice().sort((O,$)=>O-$).map(O=>G[O]||String(O)).join(""))(i)}`:"",H=K?`${R}:${x} 4‑5‑6`:`${R}:${x} 1‑2‑3`,P=K?"All challengers lose":"All challengers win",j=r&&e&&r===e,q=K?j?"win":"lose":j?"lose":"win";D(()=>m(q,!1,P,H,!0),{immediate:!0,key:`auto-${A}`}),k.current=A},[t,A,e,r,D,m]),p.useEffect(()=>{const F=lxA(b=>{try{y()}catch{}});return()=>{try{F()}catch{}}},[y])}function $gA({open:t,onClose:A,message:e}){if(!t)return null;const i=Di(),g=e||"You must be logged in.",I=p.useCallback(()=>{i("/login")},[i]),n=Q.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Login required",children:[Q.jsx("div",{className:"results-modal__backdrop",onClick:A}),Q.jsxs("div",{className:"results-modal__card card",onClick:o=>o.stopPropagation(),children:[Q.jsxs("div",{className:"results-modal__header",children:[Q.jsx("h3",{children:"Login required"}),Q.jsx("button",{type:"button","aria-label":"Close",className:"btn btn--ghost",onClick:A,children:"✕"})]}),Q.jsxs("div",{style:{padding:16},children:[Q.jsx("p",{style:{marginBottom:16},children:g}),Q.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[Q.jsx("button",{className:"btn btn--ghost",onClick:A,children:"Cancel"}),Q.jsx("button",{className:"btn btn--primary",onClick:I,children:"Sign In"})]})]})]})]});return Zc.createPortal(n,document.body)}function dxA({isUserTurn:t=!1,onOpen:A,isConnected:e=!0}){const{micEnabled:i,videoEnabled:g,speaking:I}=Xc(),[n,o]=p.useState(!1),a=p.useRef(null),s=p.useCallback(()=>e?i?Object.values(I).some(Boolean)?"speaking":"connected":"muted":"disconnected",[e,i,I])(),B=p.useCallback(()=>{if(!(!e||t)){try{xt("Light")}catch{}A()}},[e,t,A]),c=p.useCallback(()=>{e&&(a.current=setTimeout(()=>{if(o(!0),t){try{xt("Medium")}catch{}A()}},500))},[e,t,A]),E=p.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),setTimeout(()=>o(!1),1500)},[]),D=p.useCallback(()=>{a.current&&(clearTimeout(a.current),a.current=null),o(!1)},[]),y=s==="muted"?"Muted":s==="disconnected"?"Voice disconnected":"Voice connected",S=i||g,f=["comms-btn",`comms-btn--${s}`,S?"comms-btn--active":"",t?"comms-btn--turn":""].filter(Boolean).join(" ");return Q.jsxs("div",{className:"comms-btn-container",children:[Q.jsxs("button",{type:"button",className:f,onClick:B,onPointerDown:c,onPointerUp:E,onPointerLeave:D,onPointerCancel:D,"aria-label":y,"aria-pressed":i,style:{opacity:t?.75:1,pointerEvents:"auto"},children:[s==="speaking"&&Q.jsx("span",{className:"comms-btn__pulse","aria-hidden":"true"}),Q.jsxs("span",{className:"comms-btn__icon-wrap",children:[Q.jsx(pxA,{}),s==="muted"&&Q.jsx("span",{className:"comms-btn__slash","aria-hidden":"true"})]})]}),n&&Q.jsx("div",{className:"comms-btn__tooltip",role:"tooltip",children:y})]})}function pxA(){return Q.jsx("svg",{className:"comms-btn__svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:Q.jsx("path",{d:"M17 10.5V7c0-.55-.45-1-1-1H4c-.55 0-1 .45-1 1v10c0 .55.45 1 1 1h12c.55 0 1-.45 1-1v-3.5l4 4v-11l-4 4z"})})}function fxA({open:t,onClose:A,roomId:e,onLeaveVoice:i,onBlockReport:g}){const{micEnabled:I,setMicEnabled:n,videoEnabled:o,setVideoEnabled:a,leaveRoom:r}=Xc(),{user:s}=Yi(),{setMembershipModalOpen:B}=_y(),c=s?.membershipTier==="PREMIUM",[E,D]=p.useState(100),[y,S]=p.useState(!1),[f,M]=p.useState(!1),k=p.useRef(null),m=p.useCallback(G=>{G.target===G.currentTarget&&A()},[A]);p.useEffect(()=>{if(!t)return;const G=J=>{J.key==="Escape"&&A()};return document.addEventListener("keydown",G),()=>document.removeEventListener("keydown",G)},[t,A]),p.useEffect(()=>{if(!t||!k.current)return;k.current.querySelector('button, input, [tabindex]:not([tabindex="-1"])')?.focus()},[t]);const U=p.useCallback(async()=>{if(!y){try{xt("Light")}catch{}S(!0);try{await n(!I)}catch{}finally{S(!1)}}},[I,n,y]),F=p.useCallback(async()=>{if(!f){try{xt("Light")}catch{}if(!c){B(!0);return}M(!0);try{await a(!o)}catch{}finally{M(!1)}}},[o,a,c,B,f]),b=p.useCallback(G=>{const J=parseInt(G.target.value,10);D(J);try{window.dispatchEvent(new CustomEvent("comms:volume",{detail:{volume:J/100}}))}catch{}},[]),K=p.useCallback(()=>{try{xt("Medium")}catch{}r(e),i?.(),A()},[e,r,i,A]),R=p.useCallback(()=>{try{xt("Medium")}catch{}g?.(),A()},[g,A]);return t?Q.jsx("div",{className:"comms-drawer-backdrop",onClick:m,"aria-modal":"true",role:"dialog",children:Q.jsxs("div",{ref:k,className:"comms-drawer",role:"document","aria-label":"Communication settings",children:[Q.jsx("div",{className:"comms-drawer__handle","aria-hidden":"true"}),Q.jsxs("div",{className:"comms-drawer__header",children:[Q.jsx("h2",{className:"comms-drawer__title",children:"Voice & Video"}),Q.jsx("button",{type:"button",className:"comms-drawer__close",onClick:A,"aria-label":"Close",children:"✕"})]}),Q.jsxs("div",{className:"comms-drawer__content",children:[Q.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${I?"comms-drawer__row--active":""} ${y?"comms-drawer__row--activating":""}`,onClick:U,"aria-pressed":I,disabled:y,children:[Q.jsx("span",{className:"comms-drawer__row-icon",children:I?"🎙️":"🔇"}),Q.jsx("span",{className:"comms-drawer__row-label",children:y?"Activating…":I?"Microphone On":"Microphone Off"}),y?Q.jsx("span",{className:"comms-drawer__spinner",role:"status","aria-label":"Activating"}):Q.jsx("span",{className:`comms-drawer__toggle ${I?"comms-drawer__toggle--on":""}`,children:Q.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),Q.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${o?"comms-drawer__row--active":""} ${f?"comms-drawer__row--activating":""}`,onClick:F,"aria-pressed":o,disabled:f,children:[Q.jsx("span",{className:"comms-drawer__row-icon",children:o?"📹":"📷"}),Q.jsxs("span",{className:"comms-drawer__row-label",children:[f?"Activating…":o?"Camera On":"Camera Off",!c&&!f&&Q.jsx("span",{className:"comms-drawer__premium-badge",children:"⭐ Premium"})]}),f?Q.jsx("span",{className:"comms-drawer__spinner",role:"status","aria-label":"Activating"}):Q.jsx("span",{className:`comms-drawer__toggle ${o?"comms-drawer__toggle--on":""}`,children:Q.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),Q.jsxs("div",{className:"comms-drawer__row comms-drawer__row--slider",children:[Q.jsx("span",{className:"comms-drawer__row-icon",children:"🔊"}),Q.jsx("span",{className:"comms-drawer__row-label",children:"Volume"}),Q.jsx("input",{type:"range",min:"0",max:"100",value:E,onChange:b,className:"comms-drawer__slider","aria-label":"Volume"}),Q.jsxs("span",{className:"comms-drawer__slider-value",children:[E,"%"]})]}),Q.jsx("hr",{className:"comms-drawer__divider"}),Q.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:K,children:[Q.jsx("span",{className:"comms-drawer__row-icon",children:"🚪"}),Q.jsx("span",{className:"comms-drawer__row-label",children:"Leave Voice"})]}),g&&Q.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:R,children:[Q.jsx("span",{className:"comms-drawer__row-icon",children:"🚫"}),Q.jsx("span",{className:"comms-drawer__row-label",children:"Block / Report Player"})]})]}),Q.jsx("div",{className:"comms-drawer__footer",children:Q.jsx("p",{children:"All changes are saved automatically"})})]})}):null}function DxA({roomId:t,isUserTurn:A=!1,leftSlot:e,singlePlayer:i}){Xc();const{user:g}=Yi(),[I,n]=p.useState(!1),[o,a]=p.useState(!1),[r,s]=p.useState(ulA()),B=(()=>{try{return g?.isGuest===!0}catch{return!1}})(),c=p.useCallback(D=>()=>{try{xt("Light")}catch{}try{}catch{}D()},[]);p.useEffect(()=>{let D=!0;return(async()=>{try{const y=await jo();if(!D)return;const S=!!y.diceAudio;s(S),m4(S)}catch{}})(),()=>{D=!1}},[]),c(()=>{const D=!r;if(s(D),m4(D),D)try{Cg()}catch{}(async()=>{try{const S={...await jo(),diceAudio:D};await VE(S)}catch{}})()}),p.useMemo(()=>r?"Mute sounds":"Unmute sounds",[r]);const E=p.useCallback(()=>{if(B){n(!0);return}a(!0)},[B]);return Q.jsxs(Q.Fragment,{children:[e,Q.jsx("div",{className:"poker-header-comms",role:"group","aria-label":"communications controls",children:Q.jsx(dxA,{isUserTurn:A,onOpen:E,isConnected:!!t&&!i})}),Q.jsx(fxA,{open:o,onClose:()=>a(!1),roomId:t}),Q.jsx($gA,{open:I,onClose:()=>n(!1)})]})}const AIA=p.createContext(void 0),yxA=({children:t})=>{const[A,e]=p.useState([]),[i,g]=p.useState(null),{sendGameInvite:I,respondGameInvite:n}=OI(),o=MQ();$n({onGameInviteReceived:c=>{const E={inviteId:c.inviteId,fromUserId:c.fromUserId,fromUserName:c.fromUserName,roomId:c.roomId,roomName:c.roomName,gameMode:c.gameMode,receivedAt:Date.now()};e(D=>[...D,E]),g(D=>D||E)},onGameInviteCancelled:c=>{e(E=>E.filter(D=>D.inviteId!==c.inviteId)),g(E=>E?.inviteId===c.inviteId?null:E),o?.info(c.reason||"Game invite was cancelled")}}),p.useEffect(()=>{const c=setInterval(()=>{const E=Date.now(),D=120*1e3;e(y=>y.filter(S=>E-S.receivedAt<D))},1e4);return()=>clearInterval(c)},[]);const a=p.useCallback(async(c,E,D)=>{try{const y=await I(c,E,D);if(y&&y.ok)return o?.success("Invite sent!"),{ok:!0};{const S=y?.error||"Failed to send invite";return o?.error(S),{ok:!1,error:S}}}catch(y){const S=y?.message||"Failed to send invite";return o?.error(S),{ok:!1,error:S}}},[I,o]),r=p.useCallback(async c=>{const E=A.find(D=>D.inviteId===c);if(!E)return{ok:!1};try{const D=await n(c,"accept");return D&&D.ok?(e(y=>y.filter(S=>S.inviteId!==c)),g(null),{ok:!0,roomId:E.roomId,gameMode:E.gameMode}):{ok:!1}}catch{return{ok:!1}}},[A,n]),s=p.useCallback(c=>{n(c,"decline").catch(()=>{}),e(E=>E.filter(D=>D.inviteId!==c)),g(E=>E?.inviteId===c?A.filter(y=>y.inviteId!==c)[0]||null:E)},[A,n]),B=p.useCallback(()=>{i&&s(i.inviteId)},[i,s]);return Q.jsx(AIA.Provider,{value:{pendingInvites:A,currentInvite:i,sendInvite:a,acceptInvite:r,declineInvite:s,dismissCurrentInvite:B},children:t})};function eIA(){return p.useContext(AIA)}function SxA({roomId:t,gameMode:A,className:e}){const[i,g]=p.useState(!1),[I,n]=p.useState(null),[o,a]=p.useState(new Set),r=p.useRef(null),s=eIA(),{friends:B}=fu();p.useEffect(()=>{if(!i)return;const y=f=>{f.key==="Escape"&&g(!1)},S=f=>{r.current&&!r.current.contains(f.target)&&g(!1)};return document.addEventListener("keydown",y),document.addEventListener("mousedown",S),()=>{document.removeEventListener("keydown",y),document.removeEventListener("mousedown",S)}},[i]);const c=async y=>{if(s){n(y);try{(await s.sendInvite(t,y,A)).ok&&a(f=>new Set([...f,y]))}finally{n(null)}}},E=y=>{switch(y){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return y}};if(!s)return null;const D=i?Q.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:Q.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Invite friends",ref:r,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:[Q.jsx("button",{className:"modal-close",onClick:()=>g(!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:"×"}),Q.jsxs("h3",{className:"modal-title",style:{marginBottom:16,textAlign:"center"},children:["Invite Friends to ",E(A)]}),B.length===0?Q.jsxs("p",{style:{textAlign:"center",opacity:.7,padding:"20px 0"},children:["You don't have any friends yet.",Q.jsx("br",{}),"Add friends from your profile to invite them to games!"]}):Q.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:B.map(y=>{const S=o.has(y.id),f=I===y.id;return Q.jsxs("li",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",borderBottom:"1px solid rgba(255,255,255,0.1)"},children:[Q.jsx("span",{style:{fontWeight:500},children:y.name||"Anonymous"}),S?Q.jsx("span",{style:{color:"var(--success, #4caf50)",fontSize:"0.875rem"},children:"✓ Invited"}):Q.jsx("button",{className:"felt-btn felt-btn--sm felt-btn--primary",onClick:()=>c(y.id),disabled:f,style:{minWidth:70},children:f?"...":"Invite"})]},y.id)})}),Q.jsx("div",{style:{marginTop:20,textAlign:"center"},children:Q.jsx("button",{className:"felt-btn btn--ghost",onClick:()=>g(!1),children:"Close"})})]})}):null;return Q.jsxs(Q.Fragment,{children:[Q.jsx("a",{className:`gold-link ${e||""}`,onClick:()=>g(!0),title:"Invite a friend to this game","aria-label":"Invite friend",style:{padding:"0px 10px",fontSize:"2.5rem",lineHeight:1},children:"+"}),D&&Zc.createPortal(D,document.body)]})}function Tk(t){const{roomName:A,players:e,bankerId:i,currentRollerId:g,meId:I,gameState:n,roomId:o,onOpenDM:a,onOpenSendMoney:r,showHeader:s=!0,className:B,lite:c=!1,hideDiceResults:E,disableBankerFlash:D,crapsRollHistory:y,lastRollerId:S,hideSideBets:f,hideAvatars:M,renderFacesOverride:k,headerCommsLeftSlot:m}=t;if(c)return Q.jsx(WgA,{players:e,meId:I,className:B,onOpenDM:a,onOpenSendMoney:r});const{handleLeave:U}=TO(o,I,{autoJoin:!1}),F=Di(),{onBuyChips:b,busy:K,ready:R,purchasesReady:G,isWeb:J}=Rk(),{onHandEnd:x}=zy(),H=Xc(),{remoteStreams:P,myVideo:j,remoteVideoFlags:q}=H,{proofs:Y,reveals:O,verifyFor:$}=qgA(o),{user:gA,updateBalance:z}=Yi(),X=(()=>{try{return gA?.isGuest===!0}catch{return!1}})(),[sA,rA]=p.useState(!1),[mA,IA]=p.useState({}),{settledAll:uA,playerBalance:KA,mySettledAll:FA,newSettlements:RA,openAllMain:MA}=nb(o,I),{leaveRoom:oA,skillsLeaveRoom:AA}=OI();n?.betsLocked;const tA=p.useCallback(()=>{const ce=n?.gameMode;if(ce==="poker"){o&&oA(o),F("/lobby");return}if(ce==="skills"){o&&AA(o),F("/");return}U()},[n,o,oA,AA,F,U]),iA=p.useCallback(ce=>()=>{try{xt("Light")}catch{}try{}catch{}ce()},[]),hA=p.useMemo(()=>e.find(ce=>ce.id===I)?.balance,[e,I]),DA=n?.gameMode,dA=(()=>{const ce=typeof KA=="number"?KA:void 0,ze=typeof hA=="number"?hA:void 0;if(DA==="craps")return ze??ce??0;if(DA==="poker"){const At=ce??ze??0,Le=(Array.isArray(n?.pokerSeats)?n.pokerSeats:[]).find(Nt=>Nt.playerId===I),$e=Le&&typeof Le.stack=="number"?Le.stack:0;return At+$e}return ce??ze??0})(),[SA,NA]=p.useState(dA),[OA,Qe]=p.useState(!1),nA=p.useRef(dA),eA=p.useRef(new Set),UA=p.useRef({}),HA=p.useRef(0),Se=5e3,ne=p.useRef({}),[Oe,VA]=p.useState(0);p.useEffect(()=>{Date.now()-HA.current<Se||nA.current!==dA&&(nA.current=dA,NA(dA))},[dA]);const de=p.useMemo(()=>{if(n?.gameMode!=="poker")return null;const ze=Array.isArray(n?.pokerSeats)?n.pokerSeats:[],At=new Set;for(const ZA of ze)ZA?.playerId&&At.add(String(ZA.playerId));return At},[n?.gameMode,n?.pokerSeats]),te=p.useCallback(ce=>{const ze=n?.gameMode;if(ze==="poker"){const At=typeof ce.balance=="number"?ce.balance:0,Le=(Array.isArray(n?.pokerSeats)?n.pokerSeats:[]).find(Nt=>Nt.playerId===ce.id);if(Le&&typeof Le.stack=="number")return Math.max(0,Le.stack);const $e=typeof Le?.committed=="number"?Le.committed:0;return Math.max(0,At-$e)}return ze==="craps"&&ce.id!==I&&typeof ne.current[ce.id]=="number"?ne.current[ce.id]:ce.id===I?Number(SA??0):typeof ce.balance=="number"?ce.balance:0},[n,I,SA,Oe]),WA=p.useMemo(()=>{const ce=n?.gameMode;return ce==="poker"?de?e.filter(At=>de.has(At.id)):e:ce==="craps"||ce==="skills"||n?.mode==="single"||t.roomId?.includes("single")?e:e.filter(At=>At.id===I||At.id?.startsWith("bot_")||At.id?.startsWith("craps_bot_")?!0:te(At)>0)},[e,de,n?.gameMode,n?.mode,I,te,t.roomId]),_A=p.useMemo(()=>Object.fromEntries(WA.map(ce=>[ce.id,ce])),[WA]),zA=p.useRef(void 0),ge=p.useRef(new Map);p.useEffect(()=>{if(n?.gameMode!=="poker")return;const ze=t.roomId||"unknown";zA.current!==ze&&(zA.current=ze,ge.current=new Map);const At=ge.current;let ZA=-1;At.forEach(Le=>{Le>ZA&&(ZA=Le)});for(const Le of WA)At.has(Le.id)||(ZA+=1,At.set(Le.id,ZA))},[WA,t.roomId,n?.gameMode]);const he=p.useMemo(()=>{const ce=n?.gameMode;if(ce==="poker"){const $e=ge.current;return WA.map(Nt=>Nt.id).slice().sort((Nt,wi)=>($e.get(Nt)??0)-($e.get(wi)??0))}if(ce==="skills")return WA.map($e=>$e.id);const ze=Array.isArray(n?.turnOrder)?n.turnOrder:[];if(!ze.length)return WA.map($e=>$e.id);const At=new Set(WA.map($e=>$e.id)),ZA=ze.filter($e=>At.has($e)),Le=WA.map($e=>$e.id).filter($e=>!ZA.includes($e));return[...ZA,...Le]},[WA,e,n?.turnOrder,n?.gameMode]),ve=n.roundSeq??1;p.useEffect(()=>{if(!(!RA||!RA.length)){for(const ce of RA){if(!ce||ce.roundSeq!==ve||eA.current.has(ce.id))continue;const ze={...ce,type:ce.type||(ce.predicate||ce.subjectId?"SIDE":"MAIN")},At=PO(ze,I);if(!At.outcome)continue;eA.current.add(ce.id);let ZA=0,Le=0;try{const Mg=Iu(ce,I);Mg&&(Mg.myResult==="WIN"?ZA=Mg.myPayout||0:Mg.myResult==="LOSE"&&(Le=ce.amount||0))}catch{}const $e=ZA>0?ZA:Le>0?-Le:0;if($e===0)continue;const Nt=At.needsAnimation?2e3:0,wi=window.setTimeout(()=>{NA(Mg=>Mg+$e),Qe(!0),window.setTimeout(()=>Qe(!1),2e3),delete UA.current[ce.id]},Nt);UA.current[ce.id]=wi}return()=>{Object.values(UA.current).forEach(ce=>window.clearTimeout(ce)),UA.current={}}}},[RA,ve,I]);const bA=p.useMemo(()=>typeof n.roundSeq=="number"?(n.turnHistory??[]).filter(ce=>ce.roundSeq===n.roundSeq):n.turnHistory??[],[n.turnHistory,n.roundSeq]),[pA,Re]=p.useState(!1),[CA,EA]=p.useState(0),[yA,xA]=p.useState(void 0);p.useEffect(()=>{if(!(!RA||!RA.length||n?.gameMode==="poker"))for(const ze of RA){if(!ze||ze.roundSeq!==ve||ze.playerId!==I)continue;const At=Iu(ze,I);if(At&&At.myResult==="LOSE"){const ZA=Number(ze.amount||0);EA(ZA>0?ZA:0),xA(void 0),Re(!0);break}}},[RA,ve,I,n]);const[XA,pe]=p.useState(null),[be,It]=p.useState(null),[Ut,pg]=p.useState(!1),[Ge,lt]=p.useState(!1),Rt=p.useRef(null),[Yt,st]=p.useState(new Map),{sendVisibilityChange:Be}=OI();p.useEffect(()=>{pe(null)},[o]);const jA=p.useCallback(async()=>{if(o)try{const ce=await XqA(o);ce&&pe(ce)}catch{}},[o]),Me=p.useCallback(async()=>{if(o)try{pg(!0);const ce=await $qA(o);It(ce||null)}catch{It(null)}finally{pg(!1)}},[o]);p.useEffect(()=>{Ge&&n?.gameMode==="craps"&&jA()},[Ge,n,jA]),p.useEffect(()=>{if(!o||!Y||typeof Y!="object")return;let ce=!1;const ze=ve,At=`${ze}:`,ZA=Object.keys(Y||{}).filter(Le=>Le.startsWith(At));if(ZA.length)return ZA.forEach(Le=>{const $e=Le.split(":")[1];$e&&(async()=>{try{const Nt=await $($e,ze);ce||IA(wi=>wi[Le]===Nt?wi:{...wi,[Le]:Nt})}catch{ce||IA(Nt=>Nt[Le]==="unverifiable"?Nt:{...Nt,[Le]:"unverifiable"})}})()}),()=>{ce=!0}},[Y,O,$,o,ve]);const We=p.useMemo(()=>{if(!i)return null;for(let ce=bA.length-1;ce>=0;ce--){const ze=bA[ce];if(ze.playerId===i&&Array.isArray(ze.result)&&ze.result.length===3){const At=ze.result;if(Ym(At)!=="nothing")return At}}if(n.bankRoll?.raw&&Array.isArray(n.bankRoll.raw)&&n.bankRoll.raw.length===3){const ce=n.bankRoll.raw;if(Ym(ce)!=="nothing")return ce}return null},[i,bA,n.bankRoll]),{revealedPlayers:at,revealTimesRef:kA}=rxA(bA,i,n,ve),{show:ae,roll:Ye,activeKind:Pt,hasActive:jt,onIdle:aA,info:QA}=qr(),JA=p.useRef(null),ee=p.useRef(null);p.useEffect(()=>{if(!(DA!=="craps"&&DA!=="poker"&&DA!=="skills")||!We||We.length!==3||HO(We)!=="point")return;const ze={};for(const $e of We)ze[$e]=(ze[$e]||0)+1;const At=Object.keys(ze).map(Number).find($e=>ze[$e]===1);if(At==null)return;const ZA=`${ve}:${At}`;if(JA.current===ZA)return;ee.current&&window.clearTimeout(ee.current);const Le=[...We];ee.current=window.setTimeout(()=>{if(ee.current=null,JA.current===ZA)return;JA.current=ZA;const $e=i&&e.find(So=>So.id===i)?.name,Nt=["","⚀","⚁","⚂","⚃","⚄","⚅"],wi=So=>So.slice().sort((ma,zo)=>ma-zo).map(ma=>Nt[ma]||String(ma)).join(""),Mg=`${$e||"Banker"}'s Point`,en=`${wi(Le)} — point is ${At}`;Ye(Mg,en)},Zn.revealFlashPostDelayMs)},[We,ve,DA,i,e,Ye]);const GA=p.useRef(new Set),oe=p.useRef(!1);p.useEffect(()=>{if(!oe.current){const ce=new Set(e.map(ze=>String(ze.id)));GA.current=ce,oe.current=!0}},[e]);const Xe=p.useMemo(()=>{const ce=new Map;try{const ze=Array.isArray(MA)?MA:[];for(const At of ze){const ZA=At?.roundSeq;typeof ZA=="number"&&ZA!==ve||At&&At.playerId&&typeof At.amount=="number"&&ce.set(At.playerId,At.amount)}}catch{}return ce},[MA,ve]),Qt=p.useRef({});p.useRef(0),p.useRef(null),$n({onOtherPlayerJoined:({room:ce})=>{try{if(!ce||!Array.isArray(ce.players))return;const ze=GA.current,At=new Set(ce.players.map(Le=>String(Le.id)));if(!oe.current){GA.current=At,oe.current=!0;return}const ZA=[...At].filter(Le=>!ze.has(Le));if(ZA.length>0){const Le=new Map(ce.players.map($e=>[String($e.id),$e]));for(const $e of ZA){if($e===I)continue;const Nt=Le.get($e),wi=Nt?.name||Nt?.email||$e;try{QA&&QA("Player Joined",String(wi))}catch{}}}GA.current=At}catch{}},onOtherLeft:({room:ce})=>{try{if(!ce||!Array.isArray(ce.players))return;const ze=GA.current,At=new Set(ce.players.map(Le=>String(Le.id)));if(!oe.current){GA.current=At,oe.current=!0;return}const ZA=[...ze].filter(Le=>!At.has(Le));if(ZA.length>0){const Le=new Map;try{e.forEach($e=>Le.set(String($e.id),$e.name||$e.email||String($e.id)))}catch{}for(const $e of ZA){if($e===I)continue;const Nt=Le.get($e)||$e;try{QA&&QA("Player Left",String(Nt))}catch{}}}GA.current=At}catch{}},onPlayerBalanceUpdated:({playerId:ce,balance:ze})=>{if(ce!==I){ne.current[ce]=ze,VA(At=>At+1);return}HA.current=Date.now(),Object.values(UA.current).forEach(At=>window.clearTimeout(At)),UA.current={},eA.current.clear(),nA.current=ze,NA(ze),z(ze),Qe(!0),window.setTimeout(()=>Qe(!1),2e3)},onCrapsBetResults:ce=>{!ce||ce.roomId!==o||(Rt.current&&window.clearTimeout(Rt.current),Rt.current=window.setTimeout(()=>{jA()},350))},onCrapsBetsUpdate:ce=>{!ce||ce.roomId!==o||(Rt.current&&window.clearTimeout(Rt.current),Rt.current=window.setTimeout(()=>{jA()},250))},onCrapsPointSet:ce=>{!ce||ce.roomId!==o||(Rt.current&&window.clearTimeout(Rt.current),Rt.current=window.setTimeout(()=>{jA()},300))},onCrapsPointMade:ce=>{!ce||ce.roomId!==o||(Rt.current&&window.clearTimeout(Rt.current),Rt.current=window.setTimeout(()=>{jA()},300))},onPlayerPresenceUpdate:ce=>{if(!ce||ce.roomId!==o)return;const{playerId:ze,status:At}=ce;!ze||!At||st(ZA=>{const Le=new Map(ZA);return Le.set(ze,At),Le})}}),p.useEffect(()=>()=>{Rt.current&&window.clearTimeout(Rt.current)},[]),p.useEffect(()=>{if(!o)return;const ce=()=>{const At=!document.hidden;Be(o,At)};Be(o,!document.hidden),document.addEventListener("visibilitychange",ce);let ze=null;return(async()=>{try{const{App:At}=await pi(async()=>{const{App:ZA}=await Promise.resolve().then(()=>Z6);return{App:ZA}},void 0,import.meta.url);ze=await At.addListener("appStateChange",ZA=>{Be(o,ZA.isActive)})}catch{}})(),()=>{document.removeEventListener("visibilitychange",ce),ze&&typeof ze.remove=="function"&&ze.remove()}},[o,Be]);const nt=p.useCallback(ce=>{let ze=Qt.current[ce];if(ze&&ze.getAttribute("data-player-id")!==ce&&(ze=null),!ze)try{const Le=window.CSS&&typeof window.CSS.escape=="function"?window.CSS.escape(ce):String(ce).replace(/[^a-zA-Z0-9_-]/g,"_");ze=document.querySelector(`.players.players--avatars [data-player-id="${Le}"]`)}catch{}if(!ze)return null;const At=ze.querySelector(".avatar-ring");let ZA=null;if(At)ZA=At.getBoundingClientRect();else try{ZA=ze.getBoundingClientRect()}catch{}return!ZA||ZA.width===0&&ZA.height===0?null:{x:ZA.left+ZA.width/2,y:ZA.top+ZA.height/2}},[]),Dt=p.useRef(bA.length),it=p.useRef(null),Mt=p.useRef(null),Zt=p.useRef(null);p.useEffect(()=>{Dt.current=bA.length},[ve]),p.useEffect(()=>{Zt.current=null},[ve]);const{forUserId:Ri,anchorRect:Ui,anchorEl:qi,openFor:ei,close:yt}=OO(),Si=(ce,ze)=>{!ze||ce===I||ei(ce,ze)},ti=()=>yt(),Xg=p.useMemo(()=>{const ce=new Map;for(const ze of e)ce.set(ze.id,ze.name||ze.email||ze.id);for(const ze of uA){const At=ze?.playerId,ZA=ze?.bankerId;At&&!ce.has(At)&&ce.set(At,At),ZA&&!ce.has(ZA)&&ce.set(ZA,ZA)}return ce},[e,uA]),cI=p.useCallback(ce=>Xg.get(ce||"")||ce||"Unknown",[Xg]),bg=p.useCallback(ce=>cI(ce),[cI]),yo=p.useMemo(()=>{const ce=new Map;for(const ze of e)ze.avatarUrl&&ce.set(ze.id,ze.avatarUrl);return ce},[e]),ci=p.useCallback(ce=>yo.get(ce),[yo]),vg=p.useCallback(ce=>TW(ce,bA,i,n.bankRoll,We),[bA,i,n.bankRoll,We]);hxA({newSettlements:RA,roundSeqNow:ve,myId:I,bankerDice:We,getPlayerName:bg,getPlayerAvatarUrl:ci,getPlayerDice:vg,getRevealTime:ce=>kA?.current?.get?.(ce),postRevealDelayMs:0,bankerId:i});const Zg=p.useRef(null);p.useEffect(()=>{!(n?.gameMode==="cee-lo"||n?.gameMode==="ceeLo"||!n?.gameMode)||!RA.length||!RA.filter(At=>At.playerId===I||At.bankerId===I).length||Zg.current!==ve&&(Zg.current=ve,!(t.singlePlayer&&e.filter(ZA=>ZA.id.startsWith("bot_")&&(ZA.balance??0)>0).length===0)&&setTimeout(async()=>{try{await x()}catch{}},2500))},[RA,ve,I,n,x,t.singlePlayer,e]);const fg=n?.gameMode==="cee-lo"||n?.gameMode==="ceeLo"||!n?.gameMode;n?.gameMode;const kg=p.useCallback(ce=>{if(!fg)return!0;if(!ce||!(at.get(ce)===!0))return!1;const At=kA?.current?.get?.(ce);return(typeof At=="number"?performance.now()-At:0)>=Zn.diceToChipDelayMs},[fg,at,kA]),{activeBatch:Qn,handleAnimItemComplete:fI,resetForRound:Ao}=ExA({newSettlements:RA,roundSeqNow:ve,getAvatarCenter:nt,getPlayerName:bg,myId:I,bankerDice:We,bankerId:i,isPartyReady:kg});p.useEffect(()=>{Ao()},[ve,Ao]);const wa=p.useRef(null),sr=p.useRef(null),Ds=p.useMemo(()=>{if(n?.gameMode==="poker"){const ze=Number(n?.pokerUiLockedUntilTs||0),At=ze>0&&Date.now()<ze,ZA=7e3;At&&wa.current==null&&(wa.current=Date.now());const Le=wa.current||0,$e=Le>0?Date.now()-Le:Number.POSITIVE_INFINITY,Nt=At&&$e<=ZA,wi=Array.isArray(n?.pokerSeats)?n.pokerSeats:[],Mg=typeof n?.pokerActingSeat=="number"?n.pokerActingSeat:void 0,en=typeof Mg=="number"&&wi.find(So=>So.seatIndex===Mg)?.playerId||null;return Nt?sr.current??en??null:(sr.current=en??null,wa.current=null,en??null)}return(n?.currentRollerId??g)||null},[n?.gameMode,n?.pokerSeats,n?.pokerActingSeat,n?.currentRollerId,g]);return p.useEffect(()=>{const ce=Mt.current,ze=Ds||void 0;if(!ce||!ze||Zt.current===ze)return;const At=Qt.current[ze];if(!At)return;const ZA=()=>{try{const Le=ce.getBoundingClientRect(),$e=At.getBoundingClientRect(),Nt=$e.left-Le.left+ce.scrollLeft,wi=Math.max(0,Math.min(Nt-ce.clientWidth/2+$e.width/2,ce.scrollWidth-ce.clientWidth));ce.scrollTo({left:wi,behavior:"smooth"}),Zt.current=ze}catch{}};return it.current&&clearTimeout(it.current),it.current=setTimeout(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(ZA):ZA()},100),()=>{it.current&&(clearTimeout(it.current),it.current=null)}},[Ds,he]),Q.jsxs("div",{className:["card",B].filter(Boolean).join(" "),style:{position:"relative"},children:[s&&Q.jsx("div",{className:"card-header card-header--two-rows",children:Q.jsxs("div",{className:"card-header-row",children:[Q.jsxs("div",{className:"header-slot header-slot--left",children:[Q.jsx("a",{className:"gold-link white-link",onClick:iA(tA),"aria-label":"Back",style:{display:"flex"},children:Q.jsx(dB,{className:"icon",style:{color:"var(--gold, #caa64d)"}})}),(()=>{const ce=K||!R||!G,ze=ce?"Balance (login to Buy 1000 Z Credits)":J?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",At=ce?"Login to Buy 1000 Z Credits":J?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",ZA=iA(()=>{if(X){rA(!0);return}b()});return Q.jsx("a",{className:"gold-link balance-display"+(ce?" disabled":"")+(OA?" balance--pulse":""),role:"button","aria-label":ze,title:At,"aria-disabled":ce||void 0,onClick:ZA,children:Q.jsxs("b",{children:[Q.jsx("span",{className:"lowercase",children:"z"}),Bd.formatMoney(SA,"",0)]})})})(),DA!=="skills"&&Q.jsx("a",{role:"button",className:"gold-link white-link"+(t.historyHalo?" history-halo":""),onClick:iA(()=>{if(X){rA(!0);return}const ce=n?.gameMode;ce==="craps"?(jA(),lt(!0)):ce==="poker"?t.onOpenHistory&&t.onOpenHistory():Me().then(()=>lt(!0))}),"aria-haspopup":"dialog","aria-controls":"my-bets-modal",children:"History"}),o&&!X&&!t.singlePlayer&&Q.jsx(SxA,{roomId:o,gameMode:n?.gameMode||"cee-lo"})]}),Q.jsx("div",{className:"header-slot header-slot--right",children:Q.jsx(DxA,{roomId:o,leftSlot:m,singlePlayer:t.singlePlayer})})]})}),Qn.length>0&&Q.jsxs("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:[Qn.map(ce=>Q.jsx(XgA,{anim:ce,onComplete:()=>fI(ce.id)},ce.id)),!1]}),Q.jsx("div",{className:"chip-fly-container",children:!M&&Q.jsx(uB.ul,{className:"players players--avatars",role:"list",ref:Mt,layout:!0,transition:{type:"spring",stiffness:420,damping:38,mass:.6},children:he.map(ce=>{const ze=n?.currentRollerId??g,At=_A[ce];if(!At)return null;const ZA=At.id,Le=[];if(n?.gameMode==="poker"){const Ng=n,lI=Array.isArray(Ng.pokerSeats)?Ng.pokerSeats:[],wo=typeof Ng.pokerDealerSeat=="number"?Ng.pokerDealerSeat:void 0,bn=lI.find(tn=>tn.playerId===ZA);if(bn&&typeof wo=="number"){bn.seatIndex===wo&&Le.push("D");const tn=lI.filter(Dg=>!!Dg.playerId).map(Dg=>Dg.seatIndex).sort((Dg,En)=>Dg-En),Tr=tn.length;if(Tr>=2){const Dg=tn.indexOf(wo);if(Dg!==-1){let En,Vo;Tr===2?(En=wo,Vo=tn[(Dg+1)%Tr]):(En=tn[(Dg+1)%Tr],Vo=tn[(Dg+2)%Tr]),bn.seatIndex===En&&Le.push("SB"),typeof Vo=="number"&&bn.seatIndex===Vo&&Le.push("BB")}}}}fg&&i&&ZA===i&&Le.push("B"),ZA===ze&&!at.get(ZA)&&Le.push("Rolling"),ZA===ze&&Le.push("Shooter");let $e=!1;if(n?.gameMode==="poker"){const Ng=n,lI=typeof Ng.pokerActingSeat=="number"?Ng.pokerActingSeat:void 0;typeof lI=="number"&&Array.isArray(Ng.pokerSeats)&&($e=Ng.pokerSeats.find(bn=>bn.seatIndex===lI)?.playerId===ZA)}else $e=ZA===ze;let Nt=!1;if(n?.gameMode==="poker"){const lI=(Array.isArray(n?.pokerSeats)?n.pokerSeats:[]).find(wo=>wo.playerId===ZA);lI&&String(lI.status||"").toLowerCase()==="folded"&&(Nt=!0)}const wi=ZA===I?j:P[ZA],Mg=q[ZA]?wi:void 0,en=!E&&at.get(ZA)?TW(ZA,bA,i,n.bankRoll,We):null;let So=!E&&en&&Array.isArray(en)&&en.length===3&&!en.every(Ng=>Ng===0)&&Ym(en)!=="nothing"?Q.jsx(aO,{dice:en}):null;const zo=(n.spectators??[]).includes(ZA);let $g;if(k)$g=k(At);else if(zo)$g=null;else if(fg&&!at.get(ZA)){const Ng=Xe.get(ZA);$g=typeof Ng=="number"&&Ng>0?Q.jsxs("span",{className:"player-bet-pill","aria-label":`Bet z${Bd.formatMoney(Ng,"",0)}`,children:["z",Bd.formatMoney(Ng,"",0)]}):null}else $g=So;const FB=n?.gameMode==="poker",DI=te(At),ka=Number.isFinite(DI)?DI:void 0;return Q.jsx(nxA,{ref:Ng=>{Qt.current[ZA]=Ng},id:ZA,display:At.name??At.email??ZA,isCurrentRoller:$e,isMe:ZA===I,balance:ka,isSpectating:zo,folded:Nt,tags:Le,stream:Mg,isMuted:ZA===I,diceResult:$g,onOpenMenu:(Ng,lI)=>Si(Ng,lI),showMenu:Ri===ZA,menuProps:Ri===ZA?{targetId:ZA,anchorRect:Ui,anchorEl:qi,onClose:ti,onOpenDM:a,onOpenSendMoney:r,meId:I}:null,forceHideVideo:!q[ZA],avatarUrl:At.avatarUrl,showActingTimerRing:FB,presenceStatus:Yt.get(ZA)},ZA)})})}),Ge&&Q.jsx(iiA,{onClose:()=>lt(!1),items:Array.isArray(be)&&be.length>0?be:FA,meId:I,nameOf:cI,crapsRollHistory:y,gameMode:n?.gameMode,crapsLedgerItems:(XA||[]).slice().sort((ce,ze)=>Number(ze.ts)-Number(ce.ts))}),Q.jsx($gA,{open:sA,onClose:()=>rA(!1),message:"This feature is for logged in users."})]})}function wxA(t){const{gameState:A,roomId:e,meId:i}=t,{show:g,hasActive:I,activeKind:n,onIdle:o,rollNow:a}=qr(),{onHandEnd:r}=zy(),s=p.useRef(null),B=p.useRef(new Set),c=p.useRef(null),E=p.useRef(null),D=p.useRef(null),y=p.useRef(null),S=p.useRef(null),f=p.useRef(null),{reveal:M}=kQ(),{recentSettlements:k,lastSettlementRoll:m,pointSetEvent:U,pointMadeEvent:F}=LgA({roomId:e||null,myPlayerId:i}),b=p.useCallback((K,R,G,J,x)=>{if(s.current===x||B.current.has(x))return;(()=>{s.current=x,B.current.add(x),g({kind:K==="roll"?"roll":K,title:R,subtitle:G,duration:J})})()},[g]);return p.useEffect(()=>{if(!U||!e||U.roomId!==e)return;const K=U._key;s.current===K||B.current.has(K)||(c.current={key:K,point:U.point},E.current&&clearTimeout(E.current),M&&(E.current=setTimeout(()=>{const R=c.current;if(R){if(B.current.has(R.key)){c.current=null;return}s.current=R.key,B.current.add(R.key);try{K4({volume:.15})}catch{}typeof a=="function"?a("Point Established",`${R.point} is the point`):g({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),c.current=null}},Zn.revealFlashPostDelayMs)))},[U,e,a,g,M]),p.useEffect(()=>{!M||!c.current||(E.current&&clearTimeout(E.current),E.current=setTimeout(()=>{const R=c.current;if(R){if(B.current.has(R.key)){c.current=null;return}s.current=R.key,B.current.add(R.key);try{K4({volume:.15})}catch{}typeof a=="function"?a("Point Established",`${R.point} is the point`):g({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),c.current=null}},Zn.revealFlashPostDelayMs))},[M,a,g]),p.useEffect(()=>{F&&(!e||F.roomId!==e||(D.current={key:F._key,point:F.point},y.current&&clearTimeout(y.current),M&&(y.current=setTimeout(()=>{const K=D.current;if(K){if(B.current.has(K.key)){D.current=null;return}b("win","Point Made!",`${K.point} hit`,1300,K.key);try{F4({sfxVolume:.15,voiceVolume:.55})}catch{}D.current=null}},Zn.revealFlashPostDelayMs))))},[F,e,b,M]),p.useEffect(()=>{!M||!D.current||(y.current&&clearTimeout(y.current),y.current=setTimeout(()=>{const R=D.current;if(R){if(B.current.has(R.key)){D.current=null;return}b("win","Point Made!",`${R.point} hit`,1300,R.key);try{F4({sfxVolume:.15,voiceVolume:.55})}catch{}D.current=null}},Zn.revealFlashPostDelayMs))},[M,b]),p.useEffect(()=>()=>{E.current&&clearTimeout(E.current),y.current&&clearTimeout(y.current),f.current&&clearTimeout(f.current)},[]),p.useEffect(()=>{if(!k.length)return;const K=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})(),R=i||(K?A?.currentRollerId||"e2e-user":void 0),G=dA=>{const SA=dA.betType;return SA==="pass"||SA==="dontPass"||SA.startsWith("place")||SA==="field"||SA==="big6"||SA==="big8"||SA==="come"||SA==="dontCome"||SA==="atsSmall"||SA==="atsTall"||SA==="atsAll"},J=k.filter(dA=>(R?dA.playerId===R:!0)&&G(dA));if(!J.length)return;const x=m?._seq||0,H=typeof m?.total=="number"?m.total:Array.isArray(m?.dice)?m.dice[0]+m.dice[1]:"",P=J.map(dA=>`${dA.betType}:${dA.outcome}:${dA.amount}:${dA.payout}`).sort().join("|"),j=`${x}:${H}:${P}`;if(S.current===j)return;S.current=j;const q=J.filter(dA=>dA.betType==="pass"||dA.betType==="dontPass"),Y=J.filter(dA=>dA.betType.startsWith("place")&&dA.outcome==="WIN"),O=J.filter(dA=>dA.betType==="field"),$=J.filter(dA=>dA.betType==="big6"||dA.betType==="big8"),gA=J.filter(dA=>dA.betType==="come"||dA.betType==="dontCome"),z=J.filter(dA=>dA.betType==="atsSmall"||dA.betType==="atsTall"||dA.betType==="atsAll"),X=q.some(dA=>dA.outcome==="WIN"),sA=Y.length>0,rA=O.some(dA=>dA.outcome==="WIN"),mA=$.some(dA=>dA.outcome==="WIN"),IA=gA.some(dA=>dA.outcome==="WIN"),uA=z.some(dA=>dA.outcome==="WIN"),KA=z.some(dA=>dA.outcome==="LOSE"),FA=q.some(dA=>dA.outcome==="LOSE"),RA=O.some(dA=>dA.outcome==="LOSE"),MA=$.some(dA=>dA.outcome==="LOSE"),oA=gA.some(dA=>dA.outcome==="LOSE"),AA=gA.some(dA=>dA.outcome==="PUSH"),tA=!X&&!FA&&q.some(dA=>dA.outcome==="PUSH");let iA="",hA="";f.current&&clearTimeout(f.current);const DA=(()=>{try{return typeof window<"u"&&(window.__E2E===!0||window.location?.search?.includes("e2e=1"))}catch{return!1}})();f.current=setTimeout(()=>{const dA=typeof H=="number"?H:Number(H),SA=m?.currentRollerId,NA=Y.some(OA=>{const Qe=Number(String(OA.betType).replace(/^place/,""));return Number.isFinite(Qe)&&Qe===dA});if(uA){const OA=z.filter(eA=>eA.outcome==="WIN"),Qe=OA.reduce((eA,UA)=>eA+UA.payout,0),nA=OA.map(eA=>eA.betType==="atsAll"?"ALL":eA.betType==="atsSmall"?"SMALL":eA.betType==="atsTall"?"TALL":eA.betType);iA=OA.length>1?`ATS ${nA.join(" & ")}!`:`ATS ${nA[0]}!`,hA=`+${Qe}`,g({kind:"win",title:iA,subtitle:hA,duration:2e3});try{window.dispatchEvent(new CustomEvent("craps:ats_win",{detail:{payout:Qe,bets:nA}}))}catch{}return}if(X){if(sA&&NA&&i&&SA===i){const Qe=Y.reduce((nA,eA)=>nA+eA.payout,0);iA=Y.length>1?"Place Wins":"Place Win",hA=`+${Qe}`,g({kind:"win",title:iA,subtitle:hA,duration:1e3});return}const OA=q.filter(Qe=>Qe.outcome==="WIN").reduce((Qe,nA)=>Qe+(nA.payout+nA.amount),0);iA="Line Win",hA=`+${OA}`,g({kind:"win",title:iA,subtitle:hA,duration:1100});return}if(sA){const OA=Y.reduce((Qe,nA)=>Qe+nA.payout,0);iA=Y.length>1?"Place Wins":"Place Win",hA=`+${OA}`,g({kind:"win",title:iA,subtitle:hA,duration:1e3});try{window.dispatchEvent(new CustomEvent("craps:place_win",{detail:{payout:OA,count:Y.length}}))}catch{}return}if(rA){const OA=O.filter(Qe=>Qe.outcome==="WIN").reduce((Qe,nA)=>Qe+nA.payout,0);iA="Field Win",hA=`+${OA}`,g({kind:"win",title:iA,subtitle:hA,duration:1e3});return}if(mA){const OA=$.filter(eA=>eA.outcome==="WIN"),Qe=OA.reduce((eA,UA)=>eA+UA.payout,0);iA=OA.length>1?"Big Wins":OA[0]?.betType==="big6"?"Big 6 Win":"Big 8 Win",hA=`+${Qe}`,g({kind:"win",title:iA,subtitle:hA,duration:1e3});return}if(IA){const OA=gA.filter(eA=>eA.outcome==="WIN"),Qe=OA.reduce((eA,UA)=>eA+UA.payout,0);iA=OA.length>1?"Come Wins":OA[0]?.betType==="dontCome"?"DC Win":"Come Win",hA=`+${Qe}`,g({kind:"win",title:iA,subtitle:hA,duration:1e3});return}if(FA){const OA=q.filter(Qe=>Qe.outcome==="LOSE").reduce((Qe,nA)=>Qe+nA.amount,0);iA="Line Lose",hA=`-${OA}`,g({kind:"lose",title:iA,subtitle:hA,duration:1100});return}if(RA){const OA=O.filter(Qe=>Qe.outcome==="LOSE").reduce((Qe,nA)=>Qe+nA.amount,0);iA="Field Lose",hA=`-${OA}`,g({kind:"lose",title:iA,subtitle:hA,duration:1e3});return}if(MA){const OA=$.filter(eA=>eA.outcome==="LOSE"),Qe=OA.reduce((eA,UA)=>eA+UA.amount,0);iA=OA.length>1?"Big Bets Lose":OA[0]?.betType==="big6"?"Big 6 Lose":"Big 8 Lose",hA=`-${Qe}`,g({kind:"lose",title:iA,subtitle:hA,duration:1e3});return}if(oA){const OA=gA.filter(eA=>eA.outcome==="LOSE"),Qe=OA.reduce((eA,UA)=>eA+UA.amount,0);iA=OA.length>1?"Come Bets Lose":OA[0]?.betType==="dontCome"?"DC Lose":"Come Lose",hA=`-${Qe}`,g({kind:"lose",title:iA,subtitle:hA,duration:1e3});return}if(AA){iA="DC Push",hA="No action",g({kind:"push",title:iA,subtitle:hA,duration:1e3});return}if(tA){iA="Line Push",hA="No action",g({kind:"push",title:iA,subtitle:hA,duration:1e3});return}if(KA){const Qe=z.filter(nA=>nA.outcome==="LOSE").reduce((nA,eA)=>nA+eA.amount,0);iA="ATS Busted",hA=`-${Qe}`,g({kind:"lose",title:iA,subtitle:hA,duration:1200});return}try{r()}catch{}},DA?200:2e3)},[k,i,m,g,r]),Q.jsx(Tk,{...t,hideDiceResults:!0,className:"craps-player-panel"})}function mxA({deadlineTs:t,isActive:A,totalSeconds:e=30,isMyTurn:i}){const[g,I]=p.useState(e),n=p.useRef(null);p.useEffect(()=>{if(!A||!t){I(e),n.current&&(cancelAnimationFrame(n.current),n.current=null);return}const B=()=>{const c=Date.now(),E=Math.max(0,Math.ceil((t-c)/1e3));I(E),E>0?n.current=requestAnimationFrame(B):n.current=null};return B(),()=>{n.current&&(cancelAnimationFrame(n.current),n.current=null)}},[t,A,e]);const o=A&&t!==void 0,a=g<=10,r=g<=5,s=g/e*100;return Q.jsxs("div",{className:["poker-turn-timer",o?"":"poker-turn-timer--hidden",a?"poker-turn-timer--urgent":"",r?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!o,children:[Q.jsxs("div",{className:"poker-turn-timer__ring",children:[Q.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[Q.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),Q.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${s} 100`})]}),Q.jsx("div",{className:"poker-turn-timer__number",children:g})]}),i&&Q.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Your Turn"})]})}const kxA=30;function MxA(t){const{turnDeadlineTs:A,currentRollerId:e,meId:i,gameState:g}=t,I=!!(e&&i&&e===i),n=!!g?.roundEnded,o=p.useMemo(()=>Q.jsx(mxA,{deadlineTs:A,isActive:!n&&!!A,totalSeconds:kxA,isMyTurn:I}),[A,n,I]);return Q.jsx(Tk,{...t,headerCommsLeftSlot:o})}function NxA({deadlineTs:t,isActive:A,showTurnLabel:e=!0}){const[i,g]=p.useState(30),I=p.useRef(null);p.useEffect(()=>{if(!A||!t){g(30),I.current&&(cancelAnimationFrame(I.current),I.current=null);return}const s=()=>{const B=Date.now(),c=Math.max(0,Math.ceil((t-B)/1e3));g(c),c>0?I.current=requestAnimationFrame(s):I.current=null};return s(),()=>{I.current&&(cancelAnimationFrame(I.current),I.current=null)}},[t,A]);const n=A&&i!==30,o=i<=10,a=i<=5,r=i/30*100;return Q.jsxs("div",{className:["poker-turn-timer",n?"":"poker-turn-timer--hidden",o?"poker-turn-timer--urgent":"",a?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!n,children:[Q.jsxs("div",{className:"poker-turn-timer__ring",children:[Q.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[Q.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),Q.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${r} 100`})]}),Q.jsx("div",{className:"poker-turn-timer__number",children:i})]}),e&&Q.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Your Turn"})]})}function NL({state:t,startingShields:A,maxTokens:e}){if(t.eliminated)return Q.jsxs("div",{className:"elim-badge elim-badge--eliminated","aria-label":`Eliminated — ${GxA(t.place??0)} place`,children:[Q.jsx("span",{className:"elim-badge__out",children:"OUT"}),typeof t.place=="number"&&t.place>0&&Q.jsxs("span",{className:"elim-badge__place",children:["#",t.place]})]});const i=[];for(let I=0;I<A;I++)i.push(Q.jsx("span",{className:`elim-badge__shield ${I<t.shields?"elim-badge__shield--active":"elim-badge__shield--lost"}`,"aria-hidden":!0,children:"🛡"},`s${I}`));const g=[];for(let I=0;I<e;I++)g.push(Q.jsx("span",{className:`elim-badge__token ${I<t.penaltyTokens?"elim-badge__token--active":""}`,"aria-hidden":!0},`t${I}`));return Q.jsxs("div",{className:"elim-badge","aria-label":`Shields: ${t.shields}/${A}, Tokens: ${t.penaltyTokens}/${e}`,children:[Q.jsx("span",{className:"elim-badge__shields",children:i}),t.penaltyTokens>0&&Q.jsx("span",{className:"elim-badge__tokens",children:g}),t.winStreak>=2&&Q.jsxs("span",{className:"elim-badge__streak","aria-label":`${t.winStreak} win streak`,children:["🔥",t.winStreak]})]})}function GxA(t){const A=["th","st","nd","rd"],e=t%100;return t+(A[(e-20)%10]||A[e]||A[0])}function WO(t){const A=p.useMemo(()=>t.headerExtras,[t.headerExtras]),e=p.useMemo(()=>{const a=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],r=new Map;for(const s of a){const B=(s.totalCommitted||0)+(s.committed||0);r.set(s.playerId,B)}return r},[t.gameState]),i=p.useMemo(()=>{const a=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],r=new Set;for(const s of a)s?.playerId&&String(s.status||"").toLowerCase()==="folded"&&r.add(s.playerId);return r},[t.gameState]),g=p.useMemo(()=>{const a=new Map,r=Array.isArray(t.revealedHands)?t.revealedHands:[];for(const s of r)s?.playerId&&Array.isArray(s.hole)&&s.hole.length===2&&a.set(String(s.playerId),s.hole);return a},[t.revealedHands]),I=p.useMemo(()=>a=>{const r=t.elimConfig?.enabled?t.elimStates?.[a.id]:void 0,s=g.get(a.id);if(s&&s.length===2){const E=({value:D})=>{const y=String(D||"").toUpperCase(),S=y.slice(0,-1),f=y.slice(-1),M=S==="T"?"10":S,k=f==="H"||f==="D",m=f==="H"?"♥":f==="D"?"♦":f==="C"?"♣":"♠";return Q.jsxs("div",{className:["poker-card","poker-card--mini",k?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":`${M} of ${f}`,children:[Q.jsx("span",{className:"poker-card__rank",style:{fontSize:14},children:M}),Q.jsx("span",{className:"poker-card__suit",style:{fontSize:11},children:m})]})};return Q.jsxs(Q.Fragment,{children:[Q.jsxs("div",{className:"poker-avatar__faces","aria-label":"hole-cards",children:[Q.jsx(E,{value:s[0]}),Q.jsx(E,{value:s[1]})]}),r&&Q.jsx(NL,{state:r,startingShields:t.elimConfig?.startingShields??3,maxTokens:t.elimConfig?.maxTokens??3})]})}if(i.has(a.id))return Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:"poker-avatar__bet","aria-label":"Folded",children:"Folded"}),r&&Q.jsx(NL,{state:r,startingShields:t.elimConfig?.startingShields??3,maxTokens:t.elimConfig?.maxTokens??3})]});const c=`z${(e.get(a.id)||0).toLocaleString("en-US")}`;return Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:"poker-avatar__bet","aria-label":`Total bet ${c}`,children:c}),r&&Q.jsx(NL,{state:r,startingShields:t.elimConfig?.startingShields??3,maxTokens:t.elimConfig?.maxTokens??3})]})},[g,e,i,t.elimConfig,t.elimStates]);if(t.lite)return Q.jsx(WgA,{className:"",players:t.players,meId:t.meId,onOpenDM:t.onOpenDM,onOpenSendMoney:t.onOpenSendMoney,renderActionsOverride:a=>I({id:a.id})});const n=p.useMemo(()=>{const a=Array.isArray(t.gameState?.pokerSeats)?t.gameState.pokerSeats:[],r=new Map,s=new Set;for(const B of a){if(!B||!B.playerId)continue;const c=typeof B.stack=="number"?B.stack:void 0;typeof c=="number"&&r.set(String(B.playerId),c),s.add(String(B.playerId))}return t.players.map(B=>{const c=r.get(String(B.id));return typeof c=="number"?{...B,balance:c}:B})},[t.players]),o=p.useMemo(()=>Q.jsx(NxA,{deadlineTs:t.turnDeadlineTs,isActive:!!t.isBettingStreet&&!!t.turnDeadlineTs,showTurnLabel:!!t.isHeroTurn}),[t.turnDeadlineTs,t.isBettingStreet,t.isHeroTurn]);return Q.jsx(Tk,{...t,className:"player-panel",players:n,hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerExtras:A,headerCommsLeftSlot:o,renderFacesOverride:a=>I(a)})}function YW(t){const A=t.gameState?.gameMode||"cee-lo";return A==="craps"?Q.jsx(wxA,{...t}):A==="poker"?Q.jsx(WO,{...t}):Q.jsx(MxA,{...t})}function RxA(){const{remoteStreams:t}=Xc(),A=p.useRef({}),[e,i]=p.useState(!1),g=async n=>{const o=n.srcObject;if(!o||!o.getAudioTracks().length)return!1;try{return await n.play(),!0}catch{return!1}};p.useEffect(()=>{let n=!1;for(const[a,r]of Object.entries(t)){const s=A.current[a];s&&s.srcObject!==r&&(s.srcObject=r)}(async()=>{for(const a of Object.values(A.current)){if(!a)continue;await g(a)||(n=!0)}i(n)})();for(const a of Object.keys(A.current))if(!t[a]){const r=A.current[a];if(r){try{r.pause()}catch{}r.srcObject=null}delete A.current[a]}},[t]);const I=async()=>{for(const n of Object.values(A.current))n&&await g(n);i(!1)};return Q.jsxs(Q.Fragment,{children:[Object.keys(t).map(n=>Q.jsx("audio",{ref:o=>{A.current[n]=o},autoPlay:!0,playsInline:!0,muted:!1,style:{display:"none"},onError:o=>{}},n)),e&&Q.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 UxA="_overlay_d52xd_3",KxA="_overlayClosed_d52xd_15",FxA="_drawer_d52xd_22",bxA="_drawerClosed_d52xd_59",vxA="_header_d52xd_72",_xA="_headerTitle_d52xd_82",JxA="_closeBtn_d52xd_91",LxA="_body_d52xd_108",qxA="_threadList_d52xd_115",xxA="_noPeers_d52xd_132",TxA="_threadBtn_d52xd_140",YxA="_threadBtnActive_d52xd_163",HxA="_avatar_d52xd_169",OxA="_threadLabel_d52xd_189",PxA="_threadName_d52xd_195",jxA="_threadPreview_d52xd_204",ZxA="_unreadBadge_d52xd_212",WxA="_activeThread_d52xd_229",zxA="_scroller_d52xd_237",VxA="_scrollerEmpty_d52xd_251",XxA="_message_d52xd_258",$xA="_messageMine_d52xd_275",ATA="_messageContent_d52xd_284",eTA="_messageTime_d52xd_297",tTA="_pending_d52xd_308",iTA="_error_d52xd_316",gTA="_composer_d52xd_324",ITA="_composerInput_d52xd_336",nTA="_composerSend_d52xd_363",oTA="_composerSendDisabled_d52xd_389",Yg={overlay:UxA,overlayClosed:KxA,drawer:FxA,drawerClosed:bxA,header:vxA,headerTitle:_xA,closeBtn:JxA,body:LxA,threadList:qxA,noPeers:xxA,threadBtn:TxA,threadBtnActive:YxA,avatar:HxA,threadLabel:OxA,threadName:PxA,threadPreview:jxA,unreadBadge:ZxA,activeThread:WxA,scroller:zxA,scrollerEmpty:VxA,message:XxA,messageMine:$xA,messageContent:ATA,messageTime:eTA,pending:tTA,error:iTA,composer:gTA,composerInput:ITA,composerSend:nTA,composerSendDisabled:oTA};function aTA(t){if(!t)return"?";const e=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),i=(e[0]?.[0]??"").toUpperCase(),g=(e[1]?.[0]??"").toUpperCase();return i+g||i||"?"}function rTA({open:t,onClose:A,peers:e,initialPeerId:i}){const{user:g}=Yi(),I=g?.id??g?.email??"",{getDmSummary:n,getDmMessages:o,sendDmMessage:a,markDmRead:r,setActiveDm:s,threads:B,loadDmHistory:c}=zF(),[E,D]=p.useState(i??null),[y,S]=p.useState(""),f=p.useRef(!1),M=p.useRef(null);p.useEffect(()=>{if(!t){f.current=!1;return}if(f.current)return;f.current=!0;let H=null;if(i)H=i;else{const j=n()?.find(q=>q.unread>0);j?H=j.peerUserId:E?H=E:e.length&&(H=e[0].id)}H&&H!==E&&(D(H),s(H),c(H))},[t,i,e,E,n,s]),p.useEffect(()=>{!t||!E||M.current!==E&&(M.current=E,r(E))},[t,E,r]);const k=p.useRef(null);p.useEffect(()=>(t?(k.current=document.body.style.overflow,document.body.style.overflow="hidden"):k.current!==null&&(document.body.style.overflow=k.current,k.current=null),()=>{k.current!==null&&(document.body.style.overflow=k.current,k.current=null)}),[t]),p.useEffect(()=>{t&&requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[t]),p.useEffect(()=>{const H=window.visualViewport;if(!H)return;const P=()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight+1e3)};return H.addEventListener("resize",P),()=>{H.removeEventListener("resize",P)}},[]);const m=p.useMemo(()=>E?B?.[Ys(E,I)]??[]:[],[E,t,B]),U=p.useMemo(()=>n()??[],[t,m.length]),F=p.useMemo(()=>{const H=new Map;return U.forEach(P=>H.set(P.peerUserId,P)),H},[U]),b=p.useRef(null);p.useEffect(()=>{b.current&&(b.current.scrollTop=b.current.scrollHeight+1e3)},[m.length,E,t]);const K=H=>{D(H),s(H),r(H)},R=()=>{if(!E)return;const H=y.trim();if(!H)return;a(E,H)&&S("")},G=H=>{H.key==="Enter"&&!H.shiftKey&&(H.preventDefault(),R())},J=H=>{const P=e.find(j=>j.id===H);return P?.name||P?.email||H},x=H=>{const P=F.get(H);return P?.last?((P.last.senderId===I?"You: ":"")+P.last.text).trim():""};return Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{"aria-hidden":!t,onClick:A,className:`${Yg.overlay} ${t?"":Yg.overlayClosed}`}),Q.jsxs("aside",{"aria-hidden":!t,role:"dialog","aria-label":"Direct Messages",className:`${Yg.drawer} ${t?"":Yg.drawerClosed}`,onClick:H=>H.stopPropagation(),children:[Q.jsxs("div",{className:Yg.header,children:[Q.jsx("strong",{className:Yg.headerTitle,children:"Messages"}),Q.jsx("button",{onClick:A,className:Yg.closeBtn,"aria-label":"Close messages",children:"✕"})]}),Q.jsxs("div",{className:Yg.body,children:[Q.jsxs("div",{className:Yg.threadList,children:[e.length===0&&Q.jsx("div",{className:Yg.noPeers,children:"No other players yet."}),e.map(H=>{const P=H.id===E,j=aTA(H.name||H.email||H.id),q=F.get(H.id)?.unread??0,Y=x(H.id);return Q.jsxs("button",{onClick:()=>K(H.id),className:`${Yg.threadBtn} ${P?Yg.threadBtnActive:""}`,title:J(H.id),children:[Q.jsx("div",{className:Yg.avatar,"aria-hidden":!0,children:j}),Q.jsxs("div",{className:Yg.threadLabel,children:[Q.jsx("div",{className:Yg.threadName,children:J(H.id)}),Q.jsx("div",{className:Yg.threadPreview,children:Y})]}),q>0&&Q.jsx("span",{"aria-label":`${q} unread`,className:Yg.unreadBadge,children:q>99?"99+":q})]},H.id)})]}),Q.jsxs("div",{className:Yg.activeThread,children:[Q.jsxs("div",{ref:b,className:Yg.scroller,children:[!E&&Q.jsx("div",{className:Yg.scrollerEmpty,children:"Select a conversation to begin."}),E&&m.map(H=>{const P=H.senderId===I,j=new Date(H.ts),q=j.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return Q.jsxs("div",{className:`${Yg.message} ${P?Yg.messageMine:""}`,title:j.toLocaleString(),children:[Q.jsx("div",{className:Yg.messageContent,children:H.text}),Q.jsx("div",{className:Yg.messageTime,children:q}),H.pending&&Q.jsx("div",{className:Yg.pending,children:"sending…"}),H.error&&Q.jsx("div",{className:Yg.error,children:H.error})]},H.id)})]}),Q.jsxs("div",{className:Yg.composer,children:[Q.jsx("input",{value:y,onChange:H=>S(H.target.value),onKeyDown:G,placeholder:E?`Message ${J(E)}…`:"Pick a conversation…",disabled:!E,className:Yg.composerInput}),Q.jsx("button",{onClick:R,disabled:!E||y.trim()==="",className:`${Yg.composerSend} ${!E||y.trim()===""?Yg.composerSendDisabled:""}`,children:"Send"})]})]})]})]})]})}function sTA({roomId:t,lastRollerId:A,roundSeq:e,className:i,autoHideMs:g}){const{verifyFor:I,lastRoundWithReveal:n,proofs:o,reveals:a}=qgA(t),[r,s]=p.useState("unverifiable"),B=p.useRef(0),[c,E]=p.useState({}),[D,y]=p.useState(!0),S=p.useMemo(()=>typeof e!="number"||!o?[]:Object.keys(o).filter(U=>U.startsWith(`${e}:`)),[o,e]),f=p.useMemo(()=>A||S.length&&S[S.length-1].split(":")[1]||null,[A,S]);p.useEffect(()=>{let U=!1;if(!I||!t||typeof e!="number"||!f)return s("unverifiable"),()=>{U=!0};const F=++B.current;return(async()=>{try{const b=await I(f,e);!U&&F===B.current&&s(b)}catch{!U&&F===B.current&&s("unverifiable")}})(),()=>{U=!0}},[I,t,f,e,S.length]),p.useEffect(()=>{if(!I||typeof e!="number")return;let U=!1;return S.forEach(F=>{const b=F.split(":")[1];b&&(async()=>{try{const K=await I(b,e);U||E(R=>R[F]===K?R:{...R,[F]:K})}catch{U||E(K=>K[F]==="unverifiable"?K:{...K,[F]:"unverifiable"})}})()}),()=>{U=!0}},[I,S,e,n]);const M=typeof e=="number"?!!a?.[e]:!1;if(p.useEffect(()=>{if(!g||g<=0||!M)return;y(!0);const U=window.setTimeout(()=>y(!1),g);return()=>window.clearTimeout(U)},[g,e,M]),!M||!D)return null;const k=S.filter(U=>c[U]==="verified").length,m=(()=>{if(S.length>1){if(k===S.length)return"All Verified";if(k>0)return`${k}/${S.length} Verified`}switch(r){case"verified":return"Provably Fair";case"bad-commit":return"Commit Mismatch";case"mismatch":return"Mismatch";default:return S.length?"Unverified":"Awaiting Reveal"}})();return Q.jsxs("div",{className:["fairness-status-bar",i].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:[Q.jsx(vH,{state:r}),Q.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[Q.jsx("span",{style:{fontWeight:600},children:m}),typeof e=="number"&&Q.jsxs("span",{style:{opacity:.75},children:["Round ",e]})]})]})}const HW=["Bones Bot","Stickman","Railbird","High Roller","Side Bet Sam","Mainline Max"],OW=["#ffd700","#ff6b6b","#4fc3f7","#81c784","#ba68c8","#ffb74d","#f06292","#aed581"],CTA=50;function BTA(t){const A=OW[t%OW.length],e=Math.random()*100,i=Math.random()*2,g=2+Math.random()*2,I=6+Math.random()*6,n=Math.random()*360,o=["square","rect","circle"],a=o[t%o.length];return Q.jsx("span",{className:`lms-confetti__piece lms-confetti__piece--${a}`,style:{left:`${e}%`,animationDelay:`${i}s`,animationDuration:`${g}s`,backgroundColor:A,width:a==="rect"?`${I*.5}px`:`${I}px`,height:`${I}px`,transform:`rotate(${n}deg)`}},t)}function tIA({winnerName:t,bonus:A,isHero:e,onDismiss:i,onPlayAgain:g,playAgainBusy:I}){const[n,o]=p.useState(!1);p.useEffect(()=>{requestAnimationFrame(()=>o(!0))},[]);const a=p.useMemo(()=>Array.from({length:CTA},(r,s)=>BTA(s)),[]);return Q.jsxs("div",{className:`lms-overlay ${n?"lms-overlay--visible":""}`,onClick:i,children:[Q.jsx("div",{className:"lms-confetti","aria-hidden":"true",children:a}),Q.jsxs("div",{className:"lms-content",children:[Q.jsx("div",{className:"lms-trophy",children:"🏆"}),Q.jsx("div",{className:"lms-title",children:e?"Last One Standing!":`${t} Wins!`}),Q.jsx("div",{className:"lms-subtitle",children:e?"All opponents eliminated — you dominate the table!":`${t} outlasted everyone at the table!`}),e&&A>0&&Q.jsxs("div",{className:"lms-bonus",children:[Q.jsx("span",{className:"lms-bonus__label",children:"Bonus Reward"}),Q.jsxs("span",{className:"lms-bonus__amount",children:["+z",A.toLocaleString()]})]}),Q.jsxs("div",{className:"lms-actions",children:[g&&Q.jsx("button",{type:"button",className:"lms-dismiss lms-dismiss--primary",onClick:r=>{r.stopPropagation(),g()},disabled:I,style:I?{opacity:.5,pointerEvents:"none"}:void 0,children:I?"Starting…":"Play Again"}),Q.jsx("button",{type:"button",className:g?"lms-dismiss lms-dismiss--secondary":"lms-dismiss",onClick:i,children:g?"Lobby":"Continue"})]})]})]})}const cTA=2e3,lTA=2500,QTA=400,zO=({show:t,variant:A,onComplete:e,zoomDurationMs:i=cTA,displayMs:g=lTA,fadeDurationMs:I=QTA,ariaLabel:n})=>{const[o,a]=p.useState(!1),[r,s]=p.useState(!1),[B,c]=p.useState(!1),E=p.useRef({fade:null,complete:null,raf:null}),D=p.useRef(e);return p.useEffect(()=>{D.current=e},[e]),p.useEffect(()=>(t?(E.current.fade&&clearTimeout(E.current.fade),E.current.complete&&clearTimeout(E.current.complete),E.current.raf&&cancelAnimationFrame(E.current.raf),a(!0),s(!1),c(!1),E.current.raf=requestAnimationFrame(()=>{E.current.raf=requestAnimationFrame(()=>{E.current.raf=null,s(!0)})}),E.current.fade=setTimeout(()=>{c(!0)},g),E.current.complete=setTimeout(()=>{a(!1),s(!1),c(!1),D.current()},g+I)):(E.current.fade&&clearTimeout(E.current.fade),E.current.complete&&clearTimeout(E.current.complete),E.current.raf&&cancelAnimationFrame(E.current.raf),a(!1),s(!1),c(!1)),()=>{E.current.fade&&clearTimeout(E.current.fade),E.current.complete&&clearTimeout(E.current.complete),E.current.raf&&cancelAnimationFrame(E.current.raf)}),[t,g,I]),o?Zc.createPortal(Q.jsx("div",{className:`celebration-overlay ${B?"celebration-overlay--fadeout":""}`,"data-testid":`celebration-${A}`,style:{"--celebration-fade-ms":`${I}ms`},children:Q.jsx("div",{className:"celebration-container",children:Q.jsx("div",{className:`celebration-image celebration-image--${A} ${r?"celebration-image--animating":""}`,style:{"--celebration-zoom-ms":`${i}ms`},role:"img","aria-label":n||`${A} celebration`})})}),document.body):null},ETA=500;function VO(){const[t,A]=p.useState(null),e=p.useRef([]),i=p.useRef(null),g=p.useCallback(()=>{if(e.current.length===0){i.current=null,A(null);return}const o=e.current.shift();o&&(i.current=o,A(o))},[]),I=p.useCallback((o,a)=>{const r={variant:o,...a};if(e.current.push(r),!i.current){const s=e.current.shift();i.current=s,A(s)}},[]),n=p.useCallback(()=>{i.current=null,A(null),setTimeout(()=>g(),ETA)},[g]);return p.useEffect(()=>{},[I]),{active:t,fire:I,onComplete:n}}function uTA(t){const{total:A,point:e,events:i,resolutions:g}=t,I=[],n=!e&&(A===7||A===11);n&&g?.passLineWins&&I.push({variant:"natural",displayMs:2500});const o=i?.includes?.("point_made")||i?.includes?.("POINT_MADE")||i?.some?.(r=>r.startsWith("pointMade:"));o&&(I.push({variant:"point-made",displayMs:3e3}),g?.passLineWins&&I.push({variant:"craps-big-win",displayMs:3e3}));const a=i?.includes?.("sevenOut")||i?.includes?.("SEVEN_OUT")||A===7&&!!g?.passLineLosses;return a&&I.push({variant:"generic-loss",displayMs:2e3}),{celebrations:I,sevenOut:a,isNatural:n,pointMade:!!o}}const PW=p.lazy(()=>pi(()=>Promise.resolve().then(()=>WWA),void 0,import.meta.url));function Yk(){const{roomId:t}=by(),A=Di(),{user:e,meId:i}=Yi(),{error:g}=MQ(),{membershipModalOpen:I,setMembershipModalOpen:n}=_y(),o=p.useCallback(()=>n(!1),[n]);p.useEffect(()=>{const Be=()=>{try{N2()||Cg()}catch{}};Be();const jA=["pointerdown","touchstart","mousedown","click","keydown"];return jA.forEach(Me=>{document.addEventListener(Me,Be,{once:!0,capture:!0})}),()=>{jA.forEach(Me=>{document.removeEventListener(Me,Be,{capture:!0})})}},[]);const a=i||e?.id||e?.email||"",[r,s]=p.useState(0),{rollTrigger:B,resetSpin:c}=kQ(),[E,D]=p.useState(0),y=p.useRef(null),S=TO(t,a,{autoJoin:!0}),{room:f,joining:M,error:k,lastRollerId:m,deadline:U,serverNow:F,diceSettled:b}=S,K=JgA({roomId:t||null,myPlayerId:a,autoJoinOrder:!0}),R=f?.gameState?.gameMode==="craps"?K.shooterState:null,G=p.useMemo(()=>{const Be=f?.gameState;if(Be?.gameMode==="craps"){const jA=K.lastRoll?.point??null,Me=jA??Be.crapsPoint??null,We=R?{...R}:{},at={...Be,...We,crapsPoint:Me};return at.crapsPhase=Me?"point":"come-out",at}return Be},[f?.gameState,R,K.lastRoll]),J=p.useMemo(()=>{if(f?.gameState?.gameMode==="craps"){const Be=K.lastRoll;return Be&&Array.isArray(Be.dice)?[Be.dice[0],Be.dice[1],0]:void 0}return S.diceResults},[f?.gameState?.gameMode,K.lastRoll,S.diceResults]),x=p.useMemo(()=>{if(f?.gameState?.gameMode!=="craps")return[];const Be=f?.players??[],jA=R?.turnOrder||f?.gameState?.turnOrder||[];if(!jA.length)return Be;const Me=new Map(Be.map(ae=>[ae.id,ae])),We=new Set(jA),at=jA.map((ae,Ye)=>{const Pt=Me.get(ae);if(Pt)return Pt;const jt=ae.includes("craps_bot_")||ae.includes("bot_");return{id:ae,name:jt?HW[Ye%HW.length]||`Bot ${Ye+1}`:"Player",isReady:!0,balance:jt?500:0,avatarUrl:null,isBot:jt}}),kA=Be.filter(ae=>!We.has(ae.id)&&!ae.isBot);return[...at,...kA]},[f?.gameState?.gameMode,f?.players,R?.turnOrder,f?.gameState?.turnOrder]),{onCrapsShooterTurnEnd:H,cancelAd:P}=zy(),j=p.useRef(null);p.useEffect(()=>{if(f?.gameState?.gameMode!=="craps")return;const Be=K.lastRoll;if(!Be||j.current===Be)return;j.current=Be;const{currentRollerId:jA,nextRollerId:Me}=Be;jA&&Me&&jA!==Me&&H()},[K.lastRoll,f?.gameState?.gameMode,H]);const q=p.useRef(null),[Y,O]=p.useState(1),[$,gA]=p.useState(null),[z,X]=p.useState(!1),[sA,rA]=p.useState(void 0),mA=p.useMemo(()=>(f?.players??[]).filter(Be=>Be.id!==a).map(Be=>({id:Be.id,name:Be.name})),[f?.players,a]),IA=f?.gameState?.phase==="waiting"&&!B;p.useEffect(()=>{IA?MF({volume:.0125}):pd()},[IA]);const uA=p.useCallback(Be=>{rA(Be),X(!0)},[]),KA=p.useCallback(()=>{X(!1),rA(void 0)},[]),FA=p.useRef(void 0);p.useEffect(()=>{const Be=f?.gameState?.roundSeq;if(typeof Be=="number"&&FA.current!==void 0&&Be!==FA.current&&(s(0),(f?.gameState?.gameMode||"cee-lo")==="cee-lo")){const jA=f?.gameState?.banker,Me=jA&&a&&jA===a;try{Me||Mx({volume:.6})}catch{}}typeof Be=="number"&&(FA.current=Be)},[f?.gameState?.roundSeq]);const RA=Xn(),{joinRoom:MA}=Cs(),[oA,AA]=p.useState(!1);p.useCallback(async()=>{if(!oA&&!(!RA||!t)){AA(!0);try{if(MA)try{await MA(t)}catch{}}catch{}finally{AA(!1)}}},[oA,RA,t,MA]),p.useEffect(()=>{if(!RA)return;const Be=()=>{try{c()}catch{}};return RA.on("disconnect",Be),()=>{RA.off("disconnect",Be)}},[RA,c]),p.useEffect(()=>{if(!RA||!a)return;const Be=jA=>{if(!(!jA||jA.winnerId!==a)){try{P()}catch{}EA({winnerId:a}),ne.current?.("last-man",{displayMs:3e3})}};return RA.on("ceelo:last_man_standing",Be),RA.on("craps:last_man_standing",Be),()=>{RA.off("ceelo:last_man_standing",Be),RA.off("craps:last_man_standing",Be)}},[RA,a,P]),p.useEffect(()=>{if(!RA||!a)return;const Be=jA=>{!jA||jA.playerId!==a||pe(!0)};return RA.on("ceelo:player_busted",Be),()=>{RA.off("ceelo:player_busted",Be)}},[RA,a]),p.useEffect(()=>{pe(!1)},[t]),p.useEffect(()=>{requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[]);const[tA,iA]=p.useState(()=>typeof window>"u"?!1:window.innerWidth>window.innerHeight);p.useEffect(()=>{const Be=()=>iA(window.innerWidth>window.innerHeight);window.addEventListener("resize",Be);const jA=setTimeout(Be,0);return()=>{window.removeEventListener("resize",Be),clearTimeout(jA)}},[]),p.useEffect(()=>{k&&g(k,{title:"Room Error",duration:5e3})},[k,g]);const hA=p.useRef(0),DA=p.useRef(!1),dA=p.useRef(!1),SA=p.useRef(!1),NA=p.useRef(!1),OA=p.useRef(null),Qe=p.useRef(null),[nA,eA]=p.useState(0),{active:UA,fire:HA,onComplete:Se}=VO(),ne=p.useRef(HA);ne.current=HA;const Oe=p.useRef(0),VA=p.useRef(null),de=p.useRef(0),te=p.useRef(0),WA=p.useRef(0),_A=p.useRef(0),zA=p.useRef(0),ge=["ceelo-win","ceelo-generic","big-win"],he=["craps-win","craps-lucky","big-win"],ve=["loss-a","loss-b","loss-c"],bA=()=>{const Be=ge[WA.current%ge.length];return WA.current+=1,Be},pA=()=>{const Be=he[_A.current%he.length];return _A.current+=1,Be},Re=()=>{const Be=ve[zA.current%ve.length];return zA.current+=1,Be},[CA,EA]=p.useState(null),[yA,xA]=p.useState(!1),[XA,pe]=p.useState(!1);p.useEffect(()=>{},[a,HA]);const{createRoom:be}=OI(),[It,Ut]=p.useState(),pg=p.useRef(null);p.useEffect(()=>{const Be=f?.gameState?.gameMode||"cee-lo",jA=f?.gameState?.currentRollerId,Me=!!f?.gameState?.roundEnded;if(Be==="cee-lo"){if(Me){Ut(void 0),pg.current=null;return}jA&&jA!==pg.current&&(pg.current=jA,Ut(Date.now()+3e4))}},[f?.gameState?.currentRollerId,f?.gameState?.roundEnded,f?.gameState?.gameMode]);const[Ge,lt]=p.useState(!1);p.useEffect(()=>{const Be=f?.gameState?.gameMode;if(!Be)return;let jA=!0;return(async()=>{try{const{Preferences:Me}=await pi(async()=>{const{Preferences:kA}=await Promise.resolve().then(()=>iC);return{Preferences:kA}},void 0,import.meta.url),We=Be==="craps"?"onb_craps_v1":"onb_ceelo_v1",{value:at}=await Me.get({key:We});if(!jA)return;lt(at!=="1")}catch{if(!jA)return;lt(!0)}})(),()=>{jA=!1}},[f?.gameState?.gameMode]);const Rt=p.useCallback(()=>{const Be=f?.gameState?.gameMode;(async()=>{try{const{Preferences:jA}=await pi(async()=>{const{Preferences:Me}=await Promise.resolve().then(()=>iC);return{Preferences:Me}},void 0,import.meta.url);await jA.set({key:Be==="craps"?"onb_craps_v1":"onb_ceelo_v1",value:"1"})}catch{}lt(!1)})()},[f?.gameState?.gameMode]);if(p.useEffect(()=>{if(f?.gameState?.gameMode==="craps"){DA.current=!1,dA.current=!1;return}const Be=S?.diceResults;if(!Be||Be.length!==3){DA.current=!1,dA.current=!1,SA.current=!1,OA.current=null;return}const jA=Be.join(",");if(jA===OA.current)return;OA.current=jA;const Me=[...Be].sort().join(","),We=Me==="4,5,6",at=We||Me==="1,2,3",kA=Be[0]===Be[1]&&Be[1]===Be[2];SA.current=kA,DA.current=at,dA.current=We},[S?.diceResults,f?.gameState?.gameMode]),p.useEffect(()=>{if(f?.gameState?.gameMode==="craps"){Qe.current=null;return}const Be=f?.gameState?.bankRoll;if(!Be||!Array.isArray(Be.raw)||Be.raw.length!==3){Qe.current=null;return}const jA=Be.raw,Me={};for(const kA of jA)Me[kA]=(Me[kA]||0)+1;const We=Object.keys(Me).map(Number);We.length===2&&We.some(kA=>Me[kA]===1)?Qe.current=We.find(kA=>Me[kA]===1)||null:Qe.current=null},[f?.gameState?.bankRoll,f?.gameState?.gameMode]),p.useEffect(()=>{if(f?.gameState?.gameMode==="craps"){NA.current=!1;return}const Be=f?.gameState?.banker;if(Be&&a&&Be===a){NA.current=!1;return}const Me=Qe.current;if(!Me||Me<1){NA.current=!1;return}const We=S?.diceResults;if(!We||We.length!==3){NA.current=!1;return}const kA=[...We].sort((QA,JA)=>QA-JA).join(",")==="4,5,6",ae={};for(const QA of We)ae[QA]=(ae[QA]||0)+1;const Ye=Object.keys(ae).map(Number),Pt=Ye.length===1,aA=Ye.length===2&&Ye.some(QA=>ae[QA]===1)?Ye.find(QA=>ae[QA]===1):null;NA.current=kA||Pt||aA!==null&&aA>Me},[S?.diceResults,f?.gameState,a,f?.gameState?.gameMode]),p.useEffect(()=>{if(!S?.diceSettled)return;const Be=Date.now();if(DA.current||dA.current||SA.current||NA.current){if(Be-hA.current<800){DA.current=!1,dA.current=!1,SA.current=!1,NA.current=!1;return}hA.current=Be;const jA=f?.singlePlayer===!0,Me=f?.gameState?.banker,We=Me&&a&&Me===a,at=m,kA=at?.startsWith("bot_");!kA&&(jA||at&&a&&at===a||!We)&&(dA.current?HA("bang-bang-456",{displayMs:3e3,zoomDurationMs:2500}):SA.current&&HA("trips",{displayMs:2500})),NA.current&&!kA&&HA("clutch",{displayMs:2500}),DA.current=!1,dA.current=!1,SA.current=!1,NA.current=!1,eA(Pt=>Pt+1)}},[S?.diceSettled,m,a,f?.singlePlayer,f?.gameState?.banker,HA]),p.useEffect(()=>{if((f?.gameState?.gameMode||"cee-lo")!=="cee-lo")return;const jA=Me=>{const We=Me.detail?.result;if(We==="win"){te.current+=1;const at=te.current;at>=5&&at%5===0?HA("streak-5",{displayMs:3500}):at>=3&&at%3===0?HA("streak-3",{displayMs:3e3}):HA(bA(),{displayMs:2e3})}else We==="lose"&&(te.current=0,HA(Re(),{displayMs:2e3}))};return window.addEventListener("ceelo:result",jA),()=>window.removeEventListener("ceelo:result",jA)},[f?.gameState?.gameMode,HA]),p.useEffect(()=>{if(f?.gameState?.gameMode!=="craps")return;const Be=K.lastRoll;if(!Be||VA.current===Be)return;VA.current=Be;const{total:jA,point:Me,resolutions:We,events:at}=Be,kA=uTA({total:jA,point:Me,events:at??[],resolutions:We??{passLineWins:!1,passLineLosses:!1,pushes:!1}});for(const ae of kA.celebrations){const Ye=ae.variant==="generic-loss"?Re():ae.variant;HA(Ye,{displayMs:ae.displayMs})}We?.passLineWins&&HA(pA(),{displayMs:2e3}),We?.passLineWins?(Oe.current+=1,Oe.current>=5?(HA("streak-5",{displayMs:3500}),Oe.current=0):Oe.current>=2&&HA("hot-streak",{displayMs:3e3})):We?.passLineLosses&&(Oe.current=0)},[K.lastRoll,f?.gameState?.gameMode,HA]),p.useEffect(()=>{if((f?.gameState?.gameMode||"cee-lo")!=="cee-lo")return;const jA=f?.gameState,Me=jA?.roundSeq??0,at=(jA?.turnHistory??[]).filter(aA=>aA.roundSeq===Me);if(at.find(aA=>aA.playerId===a),at.filter(aA=>aA.playerId!==a),!jA?.roundEnded)return;const kA=jA.roundSeq??0;if(kA<=de.current)return;const ae=jA.banker;if(!ae||ae!==a)return;const Ye=at.find(aA=>aA.playerId===a),Pt=at.filter(aA=>aA.playerId!==a);!Ye||Pt.length<2||!Pt.every(aA=>aA.rank<Ye.rank)||(de.current=kA,HA("ceelo-sweep",{displayMs:3e3}))},[f?.gameState?.roundEnded,f?.gameState?.roundSeq,f?.gameState?.gameMode,a,HA]),p.useEffect(()=>{if(f?.gameState?.gameMode!=="craps")return;const Be=()=>{HA(pA(),{displayMs:2e3})},jA=()=>{HA("craps-big-win",{displayMs:3500})};return window.addEventListener("craps:place_win",Be),window.addEventListener("craps:ats_win",jA),()=>{window.removeEventListener("craps:place_win",Be),window.removeEventListener("craps:ats_win",jA)}},[f?.gameState?.gameMode,HA]),M)return Q.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[Q.jsx(Po,{className:"page-home-screen"}),Q.jsx("div",{className:"home-preloader",children:Q.jsx("div",{className:"home-preloader__spinner"})})]});if(!f)return Q.jsxs("div",{className:"HomeScreen theme-casino",children:[Q.jsx(Po,{className:"page-gameroom"}),Q.jsx("div",{className:"room-grid-fit",children:Q.jsxs("div",{className:"error-grid",children:[Q.jsx("p",{className:"error text-center",children:"Room not found."}),Q.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>A("/lobby"),children:"Back to lobby"})]})})]});const Yt=f.gameState?.gameMode==="craps",st=f.gameState?.gameMode!=="craps";return Q.jsxs(hTA,{className:Yt?"mode-craps":st?"mode-ceelo":void 0,bgShakeTrigger:nA,children:[Q.jsx(Po,{className:"page-gameroom"}),Q.jsx(JqA,{}),Q.jsx(uH,{open:Ge,onClose:Rt,title:Yt?"Craps":"Cee‑Lo",tagline:Yt?"Place your bets and roll the point.":"Banker vs challengers. Roll to win.",steps:Yt?["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:Yt?"onb_craps_v1":"onb_ceelo_v1"}),Q.jsxs("div",{className:"room-grid-fit",style:!tA&&$&&!Yt?{height:$}:void 0,children:[Q.jsx("div",{className:"fairness-container",children:Q.jsx(sTA,{roomId:t,lastRollerId:m,roundSeq:f?.gameState?.roundSeq,autoHideMs:Yt?3e3:void 0})}),Q.jsxs("div",{ref:q,className:"room-grid"+(Yt?" room-grid--craps":"")+(Y<.999?" room-grid--scaled":""),style:Y<.999?{transform:`scale(${Y})`,transformOrigin:"top center",height:$||void 0}:void 0,children:[UA&&Q.jsx(zO,{show:!0,variant:UA.variant,displayMs:UA.displayMs,zoomDurationMs:UA.zoomDurationMs,fadeDurationMs:UA.fadeDurationMs,ariaLabel:UA.ariaLabel,onComplete:Se}),Yt?Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:"players-row",children:Q.jsx(YW,{className:"PlayerPanel",roomId:t,roomName:f.name,players:x,bankerId:f.gameState?.banker,currentRollerId:f.gameState?.currentRollerId,meId:a,gameState:G,lastRollerId:m,onOpenDM:uA,onOpenSendMoney:()=>{},crapsRollHistory:K.rollHistory,singlePlayer:f?.singlePlayer})}),Q.jsx("div",{className:"stage",ref:y,children:Q.jsx("div",{className:"table-wrap",children:Q.jsx("div",{className:`felt ${IA?"is-muted":""}`,children:Q.jsx(PW,{isWaiting:IA,rollTrigger:B,results:J,preRollTrigger:r,gameMode:f.gameState?.gameMode,gameState:G,chargeLevel:E})})})}),Q.jsx("div",{className:"bets-wrapper bets-wrapper--craps",children:(()=>{const jA=f.players.find(Me=>Me.id===a)?.balance??e?.balance??1e3;return Q.jsx(_qA,{meId:a,balance:jA,onChargeChange:D})})()})]}):Q.jsxs(Q.Fragment,{children:[Q.jsx("div",{className:"players-row",children:Q.jsx(YW,{className:"player-panel",roomId:t,roomName:f.name,players:f.gameState.turnOrder.map(Be=>f.players.find(jA=>jA.id===Be)).filter(Be=>!!Be),bankerId:f.gameState?.banker,currentRollerId:f.gameState?.currentRollerId,meId:a,gameState:G,lastRollerId:m,onOpenDM:uA,onOpenSendMoney:()=>{},singlePlayer:f?.singlePlayer,turnDeadlineTs:It})}),Q.jsx("div",{className:"stage",ref:y,children:Q.jsx("div",{className:"table-wrap",children:Q.jsx("div",{className:`felt ${IA?"is-muted":""}`,children:Q.jsx(PW,{isWaiting:IA,rollTrigger:B,results:J,preRollTrigger:r,gameMode:f.gameState?.gameMode,gameState:G,chargeLevel:E})})})}),Q.jsxs("div",{className:"grid-body",children:[Q.jsx("div",{className:"bets-wrapper",children:Q.jsx(gFA,{gameState:f.gameState,roundEnded:f.gameState.roundEnded,roomId:t,meId:a,bankerId:f.gameState.banker,hasBankRoll:!!f.gameState.bankRoll,players:f.players,timeLeft:{deadline:U,serverNow:F},showPassBank:!1,showSpectateRow:!1,gameplay:S,onChargeChange:D})}),Q.jsx("div",{className:"spectate-wrapper",children:Q.jsx(HqA,{roomId:t,meId:a,bankerId:f.gameState.banker,players:f.players,gameState:G,gameplay:S})})]})]})]})]}),Q.jsx(RxA,{}),Q.jsx(rTA,{open:z,onClose:KA,peers:mA,initialPeerId:sA}),CA&&Q.jsx(tIA,{winnerName:(f?.players??[]).find(jA=>jA.id===CA.winnerId)?.name||"You",bonus:0,isHero:!0,onDismiss:()=>{EA(null),A("/lobby")},playAgainBusy:yA,onPlayAgain:async()=>{if(!yA){try{const{hapticClick:Be}=await pi(async()=>{const{hapticClick:jA}=await Promise.resolve().then(()=>iT);return{hapticClick:jA}},void 0,import.meta.url);Be("Medium")}catch{}xA(!0);try{const{loadSettings:Be}=await pi(async()=>{const{loadSettings:Ye}=await Promise.resolve().then(()=>j6);return{loadSettings:Ye}},void 0,import.meta.url),jA=await Be(),Me=jA.botDifficultyLevel&&jA.botDifficultyLevel>=1&&jA.botDifficultyLevel<=9?jA.botDifficultyLevel:void 0,We=f?.gameState?.gameMode||"cee-lo",at=await be({name:"Single Player Room",singlePlayer:!0,gameMode:We,botLevel:Me}),kA=at?.room??at?.data?.room??null,ae=kA?.roomId??kA?.id??at?.roomId??at?.data?.roomId;ae?(EA(null),A(`/room/${ae}`,{replace:!0})):xA(!1)}catch{xA(!1)}}}}),Q.jsx(EH,{open:I,onClose:o,featureDescription:"Enable your camera with a Premium membership."}),XA&&Q.jsx("div",{className:"busted-overlay",onClick:()=>{pe(!1),A("/lobby")},children:Q.jsxs("div",{className:"busted-overlay__card",onClick:Be=>Be.stopPropagation(),children:[Q.jsx("h2",{children:"You're Busted!"}),Q.jsx("p",{children:"Your balance hit zero. Buy more credits to keep playing."}),Q.jsxs("div",{className:"busted-overlay__actions",children:[Q.jsx("button",{className:"felt-btn felt-btn--halo",onClick:()=>{pe(!1),A("/profile")},children:"Buy Credits"}),Q.jsx("button",{className:"felt-btn",onClick:()=>{pe(!1),A("/lobby")},children:"Back to Lobby"})]})]})})]})}function hTA({children:t,className:A,bgShakeTrigger:e}){const i=p.useRef(null),g=p.useRef(!0),{showAnimations:I}=jO();return p.useEffect(()=>{i.current&&i.current.classList.remove("fx-bg-shake")},[]),p.useEffect(()=>{if(!i.current||typeof e!="number"||I===!1)return;if(g.current||e===0){g.current=!1;return}i.current.classList.remove("fx-bg-shake"),i.current.offsetHeight,i.current.classList.add("fx-bg-shake");const n=()=>{i.current?.classList.remove("fx-bg-shake")};return i.current.addEventListener("animationend",n,{once:!0}),()=>{i.current?.removeEventListener("animationend",n)}},[e,I]),Q.jsx("div",{ref:i,className:"room-shell"+(A?` ${A}`:""),children:t})}function dTA(t=3e4){const{friends:A}=fu(),{getOnlineFriends:e}=OI(),[i,g]=p.useState(new Set),[I,n]=p.useState(!0),o=p.useCallback(async()=>{try{const r=await e();r?.ok&&Array.isArray(r.online)&&g(new Set(r.online))}catch{}n(!1)},[e]);return p.useEffect(()=>{o();const r=setInterval(o,t);return()=>clearInterval(r)},[o,t]),p.useEffect(()=>{o()},[A.length,o]),{onlineFriends:A.filter(r=>i.has(r.id)).map(r=>({...r,isOnline:!0})),loading:I,refresh:o}}function pTA({gameMode:t}){const{onlineFriends:A,loading:e}=dTA(),{user:i}=Yi();return!i||e||A.length===0?null:Q.jsxs("div",{className:"online-friends",role:"region","aria-label":"Online Friends",children:[Q.jsxs("div",{className:"online-friends__header",children:[Q.jsx("span",{className:"online-friends__dot","aria-hidden":!0}),Q.jsxs("span",{className:"online-friends__title",children:[A.length," Friend",A.length>1?"s":""," Online"]})]}),Q.jsx("div",{className:"online-friends__scroll",children:A.map(g=>Q.jsx(fTA,{friend:g,gameMode:t},g.id))})]})}function fTA({friend:t,gameMode:A}){const e=t.name??"Player",i=e.charAt(0).toUpperCase();return Q.jsxs("div",{className:"online-friend-chip",title:e,children:[Q.jsxs("div",{className:"online-friend-chip__avatar",style:t.avatarUrl?{backgroundImage:`url(${t.avatarUrl})`}:void 0,children:[!t.avatarUrl&&Q.jsx("span",{className:"online-friend-chip__initial",children:i}),Q.jsx("span",{className:"online-friend-chip__status","aria-hidden":!0})]}),Q.jsx("span",{className:"online-friend-chip__name",children:e.length>8?e.slice(0,7)+"…":e})]})}const PN="theme-light",jN="theme-dark";function ZN(t){const A=document.documentElement,e=document.body;t==="light"?(A.classList.add(PN),A.classList.remove(jN),e.classList.add(PN),e.classList.remove(jN)):(A.classList.add(jN),A.classList.remove(PN),e.classList.add(jN),e.classList.remove(PN))}function iIA(){const[t,A]=p.useState(!1),[e,i]=p.useState("dark");p.useEffect(()=>{let n=!0;return(async()=>{try{const a=(await jo()).theme??"dark";n&&(i(a),ZN(a),A(!0))}catch{n&&(ZN("dark"),A(!0))}})(),()=>{n=!1}},[]),p.useEffect(()=>{t&&ZN(e)},[e,t]);const g=p.useCallback(async n=>{i(n),ZN(n);try{const o=await jo(),a={...gC,...o,theme:n};await VE(a)}catch{}},[]),I=p.useCallback(async()=>{await g(e==="dark"?"light":"dark")},[e,g]);return{ready:t,theme:e,setTheme:g,toggleTheme:I}}const DTA=""+new URL("ceelo-icon-DBUGq3gk.webp",import.meta.url).href,yTA=""+new URL("craps-icon-Cxbu5IDi.webp",import.meta.url).href,STA=""+new URL("poker-icon-D9lS6jix.webp",import.meta.url).href,wTA=""+new URL("skills-icon-BWMGnrDl.webp",import.meta.url).href,mTA=""+new URL("zentara-icon-PkjJTbqN.webp",import.meta.url).href,uY=[{level:1,name:"Toy Box"},{level:2,name:"Cowboys"},{level:3,name:"Surfers"},{level:4,name:"Speed Demons"},{level:5,name:"Beach Club"},{level:6,name:"Rookies"},{level:7,name:"Wave Riders"},{level:8,name:"Regulars"},{level:9,name:"High Rollers"}];function kTA(){const t=Xn(),A=Di(),{user:e}=Yi(),{friends:i,friendRequests:g,blockedUsers:I,addFriend:n}=fu(),[o,a]=p.useState(""),[r,s]=p.useState([]),[B,c]=p.useState(!1),[E,D]=p.useState(null),[y,S]=p.useState(new Set),f=p.useRef(null),M=p.useCallback(F=>{if(!t||!F.trim()||F.trim().length<2){s([]),D(null);return}c(!0),D(null),t.emit(ht.SOCIAL_SEARCH_PLAYERS,{query:F.trim()},b=>{if(c(!1),b.ok&&b.players){const K=b.players.map(R=>({...R,isFriend:i.some(G=>G.id===R.id),isPending:g.some(G=>(G.fromUserId===R.id||G.toUserId===R.id)&&G.status==="PENDING"),isBlocked:I.some(G=>G.id===R.id)}));s(K)}else D(b.error||"Search failed"),s([])})},[t,i,g,I]);p.useEffect(()=>(f.current&&clearTimeout(f.current),o.trim().length>=2?f.current=setTimeout(()=>{M(o)},300):(s([]),D(null)),()=>{f.current&&clearTimeout(f.current)}),[o,M]);const k=p.useCallback(F=>{y.has(F)||(n(F),S(b=>new Set([...b,F])))},[n,y]),m=F=>F.isFriend?"Friends":F.isPending||y.has(F.id)?"Pending":F.isBlocked?"Blocked":"Add Friend",U=F=>F.isFriend||F.isPending||F.isBlocked||y.has(F.id);return e?Q.jsxs("div",{className:"friend-search",children:[Q.jsx("div",{className:"friend-search-header",children:Q.jsx("h3",{children:"Find Friends"})}),Q.jsxs("div",{className:"friend-search-input-wrapper",children:[Q.jsx("input",{type:"text",className:"friend-search-input",placeholder:"Search by username...",value:o,onChange:F=>a(F.target.value),autoComplete:"off",autoCapitalize:"off"}),B&&Q.jsx("span",{className:"friend-search-spinner",children:"⟳"})]}),E&&Q.jsx("div",{className:"friend-search-error",children:E}),r.length>0&&Q.jsx("ul",{className:"friend-search-results",children:r.map(F=>Q.jsxs("li",{className:"friend-search-result",children:[Q.jsx("div",{className:"friend-search-avatar",onClick:()=>A(`/player/${F.id}`),style:{cursor:"pointer"},children:F.avatarUrl?Q.jsx("img",{src:F.avatarUrl,alt:F.name||"User"}):Q.jsx("div",{className:"friend-search-avatar-placeholder",children:(F.name||"?")[0].toUpperCase()})}),Q.jsx("span",{className:"friend-search-name",onClick:()=>A(`/player/${F.id}`),style:{cursor:"pointer"},children:F.name}),Q.jsx("button",{className:`friend-search-btn ${U(F)?"disabled":""}`,onClick:()=>k(F.id),disabled:U(F),children:m(F)})]},F.id))}),o.trim().length>=2&&!B&&r.length===0&&!E&&Q.jsx("div",{className:"friend-search-empty",children:"No users found"}),o.trim().length>0&&o.trim().length<2&&Q.jsx("div",{className:"friend-search-hint",children:"Enter at least 2 characters"})]}):null}function $d(){const t=Di(),{user:A,refreshUser:e,logout:i}=Yi(),{updateProfile:g}=OI(),{membershipModalOpen:I,setMembershipModalOpen:n}=_y(),{isPremium:o}=H$(),{friends:a,friendRequests:r,blockedUsers:s,refreshSocial:B,isBlocked:c,blockUser:E,unblockUser:D,removeFriend:y,respondToFriendRequest:S}=fu(),{getUnreadForPeer:f}=zF(),{forUserId:M,anchorRect:k,anchorEl:m,openFor:U,close:F}=OO(),[b,K]=p.useState(null),[R,G]=p.useState(null),J=p.useCallback((QA,JA,ee,GA)=>{U(QA,JA),K(ee),G(GA||null)},[U]),x=p.useCallback(()=>{F(),K(null),G(null)},[F]),[H,P]=p.useState(A?.name??""),[j,q]=p.useState(A?.email??""),[Y,O]=p.useState(A?.avatarUrl??""),[$,gA]=p.useState(!1),[z,X]=p.useState(null),[sA,rA]=p.useState(!1),[mA,IA]=p.useState(null),[uA,KA]=p.useState(!1),[FA,RA]=p.useState(null),[MA,oA]=p.useState("received"),AA=p.useRef(null),{onBuyChips:tA,onGoPremium:iA,onRestore:hA,busy:DA,busyChips:dA,ready:SA,purchasesReady:NA,isWeb:OA,premiumActive:Qe,hasPremiumPackage:nA,premiumLabel:eA,premiumSubtitle:UA,premiumDescription:HA,premiumPrice:Se,premiumInterval:ne}=Rk(),[Oe,VA]=p.useState(!!A?.botChatDisabled),[de,te]=p.useState(A?.ceeloBotsPerRoom??null),[WA,_A]=p.useState(A?.crapsBotsPerRoom??null),[zA,ge]=p.useState(A?.pokerBotsPerRoom??null),[he,ve]=p.useState(A?.sex??""),[bA,pA]=p.useState(A?.location??""),[Re,CA]=p.useState(A?.age!=null?String(A.age):""),[EA,yA]=p.useState(A?.interests??""),[xA,XA]=p.useState(A?.aboutMe??"");p.useEffect(()=>{P(A?.name??""),q(A?.email??""),O(A?.avatarUrl??""),VA(!!A?.botChatDisabled),te(A?.ceeloBotsPerRoom??null),_A(A?.crapsBotsPerRoom??null),ge(A?.pokerBotsPerRoom??null),ve(A?.sex??""),pA(A?.location??""),CA(A?.age!=null?String(A.age):""),yA(A?.interests??""),XA(A?.aboutMe??"")},[A?.id,A?.name,A?.email,A?.avatarUrl,A?.botChatDisabled,A?.ceeloBotsPerRoom,A?.crapsBotsPerRoom,A?.pokerBotsPerRoom,A?.sex,A?.location,A?.age,A?.interests,A?.aboutMe]),p.useEffect(()=>{B()},[]);const pe=p.useCallback(async()=>{gA(!0),X(null);try{const QA={};H!==A?.name&&(QA.name=H),j!==A?.email&&(QA.email=j),Y!==A?.avatarUrl&&(QA.avatarUrl=Y),typeof Oe=="boolean"&&(QA.botChatDisabled=Oe);const JA=he.trim()||null;JA!==(A?.sex??null)&&(QA.sex=JA);const ee=bA.trim()||null;ee!==(A?.location??null)&&(QA.location=ee);const GA=Re.trim()?Number(Re.trim()):null;GA!==(A?.age??null)&&(QA.age=GA);const oe=EA.trim()||null;oe!==(A?.interests??null)&&(QA.interests=oe);const Xe=xA.trim()||null;Xe!==(A?.aboutMe??null)&&(QA.aboutMe=Xe);const Qt=bh||s_,nt=bh||nd,Dt=bh||od;Qt&&de!==(A?.ceeloBotsPerRoom??null)&&(QA.ceeloBotsPerRoom=de),nt&&WA!==(A?.crapsBotsPerRoom??null)&&(QA.crapsBotsPerRoom=WA),Dt&&zA!==(A?.pokerBotsPerRoom??null)&&(QA.pokerBotsPerRoom=zA);const it=await g(QA);if(!it?.ok)X(it?.error||"Failed to save");else{try{await e({force:!0})}catch{}await B()}}catch(QA){X(QA?.message||"Failed to save")}finally{gA(!1)}},[H,j,Y,A,g,B,e,de,WA,zA,Oe,he,bA,Re,EA,xA]),be=p.useCallback(async QA=>{c(QA)?await D(QA):await E(QA)},[c,E,D]),It=p.useCallback(QA=>{y(QA)},[y]),Ut=p.useCallback(QA=>{t(`/messages?peer=${encodeURIComponent(QA)}`)},[t]),pg=p.useCallback(async QA=>{await S(QA.id,"ACCEPT")},[S]);p.useCallback(async QA=>{await S(QA.id,"DECLINE")},[S]);const Ge=p.useCallback(async QA=>{rA(!0),IA(null);try{if(QA.size>5242880){IA("File size must be less than 5MB");return}if(!["image/jpeg","image/jpg","image/png","image/webp","image/gif"].includes(QA.type)){IA("File must be a valid image (JPEG, PNG, WebP, or GIF)");return}const GA=new FormData;GA.append("avatar",QA);const oe=String(n0??"http://localhost:4000").replace(/\/+$/,"");let Xe={},Qt;try{const Mt=await Nn();Mt&&(Xe={Authorization:`Bearer ${Mt}`},Qt=Mt)}catch{}const nt=new URL(`${oe}/api/avatar/upload`);Qt&&nt.searchParams.set("token",Qt);const Dt=await fetch(nt.toString(),{method:"POST",body:GA,headers:Xe,credentials:"include"});if(!Dt.ok){const Mt=await Dt.json().catch(()=>({error:"Upload failed"}));throw new Error(Mt.error||`Upload failed with status ${Dt.status}`)}const it=await Dt.json();it.avatarUrl&&O(it.avatarUrl)}catch(JA){IA(JA?.message||"Failed to upload avatar")}finally{rA(!1)}},[]),lt=p.useCallback(QA=>{const JA=QA.target.files?.[0];JA&&Ge(JA),AA.current&&(AA.current.value="")},[Ge]),Rt=p.useCallback(()=>{if(!(A?.membershipTier==="PREMIUM"||o)){try{n(!0)}catch{}return}AA.current?.click()},[A,o,n]),Yt=p.useMemo(()=>{const QA=new Map;for(const JA of a)QA.set(JA.id,JA);for(const JA of s)QA.has(JA.id)||QA.set(JA.id,JA);return QA},[a,s]),st=p.useMemo(()=>r.map(QA=>{const JA=A?.id===QA.toUserId,ee=JA?QA.fromUserId:QA.toUserId;if(!ee)return null;const GA=(JA?QA.fromUser:QA.toUser)||Yt.get(ee),oe=GA?.name??ee,Xe=GA?.avatarUrl??void 0;return{id:ee,name:oe,avatarUrl:Xe,_req:QA,_incoming:JA}}).filter(Boolean),[r,A?.id,Yt]),{showAnimations:Be,toggleAnimations:jA,ready:Me}=jO();iIA();const[We,at]=p.useState(gC.diceColorTheme),[kA,ae]=p.useState(void 0);p.useEffect(()=>{(async()=>{try{const QA=await jo();at(QA.diceColorTheme??gC.diceColorTheme),ae(QA.botDifficultyLevel)}catch{at(gC.diceColorTheme)}})()},[]);const Ye=p.useCallback(async QA=>{try{const JA=await jo(),ee={...gC,...JA,botDifficultyLevel:QA};await VE(ee),ae(QA)}catch{}},[]),Pt=p.useCallback(async QA=>{try{const JA=await jo(),ee={...gC,...JA,diceColorTheme:QA};await VE(ee),at(QA)}catch{}},[]),jt=p.useCallback(()=>n(!1),[n]);p.useEffect(()=>{e()},[]);const aA=p.useCallback(async()=>{try{if(RA(null),!window.confirm("Are you sure you want to permanently delete your account? This action cannot be undone."))return;const JA=String(n0??"http://localhost:4000").replace(/\/+$/,"");let ee;try{const oe=await Nn();oe&&(ee={Authorization:`Bearer ${oe}`})}catch{}const GA=await fetch(`${JA}/api/account`,{method:"DELETE",credentials:"include",headers:ee});if(!GA.ok){const oe=await GA.json().catch(()=>({error:"Deletion failed"}));throw new Error(oe.error||`Failed with status ${GA.status}`)}}catch(QA){RA(QA?.message||"Failed to delete account")}finally{i()}},[t]);return Q.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[Q.jsx(Po,{className:"profile-page-body"}),Q.jsx("div",{className:"logout-container  home-header-row",children:Q.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}history.back()},children:[Q.jsx(dB,{className:"icon"})," Back"]})}),Q.jsx("div",{className:"profile-page",children:Q.jsx("div",{className:"home-fit-shell",children:Q.jsxs("div",{className:"home-fit-content",children:[Q.jsx(pTA,{}),Q.jsxs("div",{className:"profile-content",children:[Q.jsx("div",{className:"profile-avatar-section",children:Q.jsxs("div",{className:"profile-avatar-card",children:[Q.jsxs("div",{className:"profile-avatar-header",children:[Q.jsx("span",{className:"profile-avatar-label",children:"Avatar"}),Q.jsx("span",{className:"profile-avatar-badge",children:"PREMIUM"})]}),Q.jsxs("div",{className:"profile-avatar-content",children:[Q.jsx("div",{className:"profile-avatar-preview",children:Y?Q.jsx("img",{src:Y,alt:"Avatar preview",className:"profile-avatar-img"}):Q.jsx("div",{className:"profile-avatar-placeholder",children:Q.jsx("span",{children:"No Avatar"})})}),Q.jsxs("div",{className:"profile-avatar-actions",children:[Q.jsx("input",{ref:AA,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp,image/gif",onChange:lt,disabled:sA,style:{display:"none"}}),Q.jsx("button",{className:"profile-avatar-upload-btn","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}Rt()},disabled:sA,children:sA?"Uploading...":"Upload Avatar"}),Q.jsx("div",{className:"profile-avatar-hint",children:"Max 5MB • JPEG, PNG, WebP, or GIF"}),mA&&Q.jsxs("div",{className:"error-message",style:{marginTop:"8px"},children:[mA,mA.includes("Premium")&&Q.jsx("div",{style:{marginTop:"8px"},children:Q.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}iA()},style:{fontSize:"0.9em",padding:"6px 12px"},children:"Upgrade to Premium"})})]})]})]})]})}),Q.jsx("div",{className:"profile-section",children:Q.jsx(kTA,{})}),Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Friends:"}),a.length?Q.jsx("div",{className:"friends-scroll",children:Q.jsx(qR,{className:"friends-panel",players:a,meId:A?.id||"",onPlayerClick:QA=>{const ee=document.querySelector(`[data-player-id="${QA}"]`)?.querySelector(".avatar-ring");ee&&J(QA,ee,"friends")},renderActions:QA=>{const JA=f(QA.id);return JA<=0?null:Q.jsx("span",{className:"friend-unread-badge","aria-label":`${JA} unread message${JA>1?"s":""}`,children:JA>99?"99+":JA})}})}):Q.jsx("span",{children:"No friends yet"})]}),Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Friend Requests:"}),Q.jsxs("div",{className:"request-tab-toggle",children:[Q.jsx("button",{className:`request-tab-btn${MA==="received"?" active":""}`,onClick:()=>oA("received"),children:"Received"}),Q.jsx("button",{className:`request-tab-btn${MA==="sent"?" active":""}`,onClick:()=>oA("sent"),children:"Sent"})]}),(()=>{const QA=st.filter(JA=>MA==="received"?JA._incoming:!JA._incoming);return QA.length?Q.jsx("div",{className:"friends-scroll",children:Q.jsx(qR,{className:"friends-panel",players:QA,meId:A?.id||"",onPlayerClick:JA=>{const GA=document.querySelector(`[data-player-id="${JA}"]`)?.querySelector(".avatar-ring"),oe=st.find(Xe=>Xe.id===JA);GA&&oe?._req&&J(JA,GA,"requests",{id:oe._req.id,incoming:!!oe._incoming})}})}):Q.jsxs("span",{children:["No ",MA," requests"]})})()]}),Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Blocked Users:"}),s.length?Q.jsx("div",{className:"friends-scroll",children:Q.jsx(qR,{className:"friends-panel",players:s,meId:A?.id||"",onPlayerClick:QA=>{const ee=document.querySelector(`[data-player-id="${QA}"]`)?.querySelector(".avatar-ring");ee&&J(QA,ee,"blocked")}})}):Q.jsx("span",{children:"No blocked users"})]}),M&&k&&b&&Q.jsx(PgA,{anchorRect:k,anchorEl:m,onClose:x,onViewProfile:()=>{t(`/player/${M}`),x()},onMessages:b==="friends"?()=>{Ut(M),x()}:void 0,onUnfriend:b==="friends"?()=>{It(M),x()}:void 0,onBlockUser:b!=="requests"?async()=>{await be(M),x()}:void 0,isFriend:b==="friends",isBlocked:b==="blocked",...b==="requests"&&R?.incoming?{onAddFriend:()=>{pg({id:R.id}),x()},hideAddFriend:!1}:{}}),Q.jsxs("div",{className:"profile-row profile-row--two",children:[Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Name:"}),Q.jsx("div",{className:"editable-field",children:Q.jsx("input",{type:"text",value:H,onChange:QA=>P(QA.target.value),disabled:$})})]}),Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Email:"}),Q.jsx("div",{className:"editable-field",children:Q.jsx("input",{type:"email",value:j,onChange:QA=>q(QA.target.value),disabled:$})})]})]}),Q.jsxs("div",{className:"profile-row profile-row--two",children:[Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Sex:"}),Q.jsx("div",{className:"editable-field",children:Q.jsxs("select",{value:he,onChange:QA=>ve(QA.target.value),disabled:$,"aria-label":"Sex",children:[Q.jsx("option",{value:"",children:"Prefer not to say"}),Q.jsx("option",{value:"Male",children:"Male"}),Q.jsx("option",{value:"Female",children:"Female"}),Q.jsx("option",{value:"Non-binary",children:"Non-binary"})]})})]}),Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Age:"}),Q.jsx("div",{className:"editable-field",children:Q.jsxs("select",{value:Re,onChange:QA=>CA(QA.target.value),disabled:$,"aria-label":"Age",children:[Q.jsx("option",{value:"",children:"Prefer not to say"}),Array.from({length:103},(QA,JA)=>JA+18).map(QA=>Q.jsx("option",{value:QA,children:QA},QA))]})})]})]}),Q.jsx("div",{className:"profile-row",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Location:"}),Q.jsx("div",{className:"editable-field",children:Q.jsx("input",{type:"text",value:bA,onChange:QA=>pA(QA.target.value),disabled:$,placeholder:"e.g. Chicago, IL",maxLength:120,"aria-label":"Location"})})]})}),Q.jsx("div",{className:"profile-row",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Interests:"}),Q.jsx("div",{className:"editable-field",children:Q.jsx("input",{type:"text",value:EA,onChange:QA=>yA(QA.target.value),disabled:$,placeholder:"e.g. Poker, Sports, Music",maxLength:500,"aria-label":"Interests"})})]})}),Q.jsx("div",{className:"profile-row",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"About Me:"}),Q.jsx("div",{className:"editable-field",children:Q.jsx("textarea",{value:xA,onChange:QA=>XA(QA.target.value),disabled:$,placeholder:"Tell other players about yourself...",maxLength:500,rows:3,"aria-label":"About Me",style:{resize:"vertical",minHeight:60}})})]})}),(()=>{const QA=bh||s_,JA=bh||nd,ee=bh||od;return Q.jsxs(Q.Fragment,{children:[(QA||JA)&&Q.jsxs("div",{className:"profile-row profile-row--two",children:[QA&&Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Single‑player bots (Cee‑Lo):"}),Q.jsxs("div",{className:"editable-field",children:[Q.jsxs("select",{value:de==null?"":String(de),onChange:GA=>{const oe=GA.target.value;te(oe===""?null:Math.max(0,Math.min(8,Math.trunc(Number(oe)))))},disabled:$,"aria-label":"Preferred number of bots in single-player Cee‑Lo rooms",children:[Q.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((GA,oe)=>Q.jsx("option",{value:oe,children:oe},oe))]}),Q.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]}),JA&&Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Single‑player bots (Craps):"}),Q.jsxs("div",{className:"editable-field",children:[Q.jsxs("select",{value:WA==null?"":String(WA),onChange:GA=>{const oe=GA.target.value;_A(oe===""?null:Math.max(0,Math.min(8,Math.trunc(Number(oe)))))},disabled:$,"aria-label":"Preferred number of bots in single-player Craps rooms",children:[Q.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((GA,oe)=>Q.jsx("option",{value:oe,children:oe},oe))]}),Q.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})]}),ee&&Q.jsx("div",{className:"profile-row profile-row--two",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Single‑player bots (Poker):"}),Q.jsxs("div",{className:"editable-field",children:[Q.jsxs("select",{value:zA==null?"":String(zA),onChange:GA=>{const oe=GA.target.value;ge(oe===""?null:Math.max(0,Math.min(8,Math.trunc(Number(oe)))))},disabled:$,"aria-label":"Preferred number of bots in single-player Poker rooms",children:[Q.jsx("option",{value:"",children:"Default"}),Array.from({length:5}).map((GA,oe)=>Q.jsx("option",{value:oe,children:oe},oe))]}),Q.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})})]})})(),Q.jsx("div",{className:"profile-row",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Bot Difficulty:"}),Q.jsxs("div",{className:"editable-field",children:[(()=>{const QA=(()=>{const GA=A;return GA?nd?GA.spLevelCraps??1:s_?GA.spLevelCeelo??1:od?GA.spLevelPoker??1:Math.max(GA.spLevelCeelo??1,GA.spLevelCraps??1,GA.spLevelPoker??1,GA.spLevelSkills??1):1})(),JA=Math.max(1,Math.min(9,QA)),ee=uY.find(GA=>GA.level===JA)?.name??`Level ${JA}`;return Q.jsxs("select",{value:kA??"",onChange:GA=>{const oe=GA.target.value;Ye(oe===""?void 0:Number(oe))},"aria-label":"Bot difficulty level for single-player games",children:[Q.jsxs("option",{value:"",children:["Default — ",JA,". ",ee]}),uY.map(GA=>{const oe=GA.level>JA;return Q.jsxs("option",{value:GA.level,disabled:oe,children:[oe?"🔒 ":"",GA.level,". ",GA.name,oe?" (locked)":""]},GA.level)})]})})(),Q.jsx("div",{className:"subtle",children:"Controls bot difficulty in all single-player games."})]})]})}),Q.jsx("div",{className:"profile-row",children:Q.jsx("div",{className:"profile-section",children:Q.jsxs("div",{className:"editable-field",children:[Q.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}pe()},disabled:$,children:$?"Saving...":"Save Profile"}),z&&Q.jsx("div",{className:"error-message",children:z})]})})}),Q.jsxs("div",{className:"profile-row profile-row--two",children:[Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Animations:"}),Q.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:8},children:[Q.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[Q.jsx("input",{type:"checkbox",disabled:!Me,checked:!!Be,onChange:()=>jA(),"aria-label":Be?"Disable animations (dice physics, chip flights, background shake)":"Enable animations (dice physics, chip flights, background shake)"}),Q.jsx("span",{children:Be?"Enabled":"Disabled"})]}),Q.jsx("div",{className:"subtle",style:{opacity:.7},children:Be?"Full motion effects active.":"Reduced motion: static dice & suppressed decorative effects."})]})]}),Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Dice Color (Cee‑Lo & Craps):"}),Q.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[Q.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[Q.jsx("input",{type:"radio",name:"dice-color",value:"dice_red_white",checked:We==="dice_red_white",onChange:()=>Pt("dice_red_white"),"aria-label":"Use red/white dice"}),Q.jsx("span",{children:"Red/White"})]}),Q.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[Q.jsx("input",{type:"radio",name:"dice-color",value:"dice_green_gold",checked:We==="dice_green_gold",onChange:()=>Pt("dice_green_gold"),"aria-label":"Use green/gold dice"}),Q.jsx("span",{children:"Green/Gold"})]}),Q.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[Q.jsx("input",{type:"radio",name:"dice-color",value:"dice_white_black",checked:We==="dice_white_black",onChange:()=>Pt("dice_white_black"),"aria-label":"Use white/black dice (default)"}),Q.jsx("span",{children:"White/Black"})]})]})]})]}),Q.jsxs("div",{className:"profile-row profile-row--two",children:[Q.jsxs("div",{className:"profile-section",children:[Q.jsxs("strong",{children:["Balance: ",Bd.formatMoney(A?.balance,"",2)]}),Q.jsx("div",{className:"editable-field",children:Q.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}try{tA()}catch{}},disabled:$||DA||!SA||!NA,"aria-label":OA?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",title:OA?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",children:dA?"Purchasing...":"Buy Credits"})}),Q.jsx("strong",{children:"Restore:"}),Q.jsx("div",{className:"editable-field",children:Q.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}try{hA()}catch{}},disabled:DA||!SA||!NA,title:"Restore Purchases","aria-label":"Restore Purchases",children:"Restore"})})]}),Q.jsxs("div",{className:"profile-section",children:[Q.jsxs("strong",{children:["Membership:                                         ",A?.membershipTier===xR.PREMIUM?"Premium Active":"Free",Q.jsx("span",{className:"badge","aria-live":"polite",children:A?.membershipTier===xR.PREMIUM?"P":""})]}),Q.jsxs("div",{className:"editable-field",children:[A?.membershipTier===xR.PREMIUM?Q.jsx(QH,{isPremium:!0,className:"felt-btn"}):nA&&Q.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}try{iA()}catch{}},disabled:DA,"aria-label":eA,title:eA,children:"Go Premium"}),!Qe&&nA&&Q.jsx("div",{className:"meta",style:{marginTop:6},children:(()=>{const QA="$1.99",JA="Monthly",ee=Se||QA,GA=ne||JA,oe=UA||`${ee} Mo`,Xe=HA||"Remove ads and unlock premium features.";return Q.jsxs(Q.Fragment,{children:[oe&&Q.jsx("div",{className:"subtle","aria-hidden":!0,children:oe}),Q.jsx("div",{className:"legal-note","aria-hidden":!0,children:Xe}),Q.jsxs("div",{className:"legal-note",role:"note",children:[Q.jsx("strong",{children:"Premium Subscription"})," — ",ee," (",GA,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",Q.jsx(Yo,{to:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",Q.jsx(Yo,{to:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})})()})]})]})]}),Q.jsx(MTA,{}),Q.jsx("div",{className:"profile-row",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Account:"}),Q.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",gap:8},children:[Q.jsx("div",{className:"legal-note",children:"Deleting your account is permanent and cannot be undone."}),Q.jsx("button",{className:"felt-btn felt-btn--danger","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}aA()},disabled:uA,"aria-label":"Delete Account",title:"Delete Account",children:uA?"Deleting…":"Delete Account"}),FA&&Q.jsx("div",{className:"error-message",children:FA})]})]})})]})]})})}),Q.jsx(EH,{open:I,onClose:jt,planId:A?.membershipTier,featureDescription:"Upload custom avatars and create multiplayer rooms with Premium membership."}),Q.jsx(Cd,{})]})}const jW=[{key:"ceelo",name:"Cee-Lo Lounge",tagline:"Street dice with style",icon:DTA,android:"https://play.google.com/store/apps/details?id=com.zentaraone.ceelolounge",ios:"https://apps.apple.com/us/app/zentara-one-cee-lo-lounge/id6751764952"},{key:"craps",name:"Craps Lounge",tagline:"Roll the bones",icon:yTA,android:"https://play.google.com/store/apps/details?id=com.zentaraone.crapslounge",ios:"https://apps.apple.com/us/app/zentara-one-craps-lounge/id6756252344"},{key:"poker",name:"Poker Lounge",tagline:"Texas Hold 'em",icon:STA,android:"https://play.google.com/store/apps/details?id=com.zentaraone.pokerlounge",ios:"https://apps.apple.com/us/app/zentara-one-poker-lounge/id6757020405"},{key:"skills",name:"Skills Lounge",tagline:"Word games & trivia",icon:wTA,android:"https://play.google.com/store/apps/details?id=com.zentaraone.skillslounge",ios:"https://apps.apple.com/us/app/zentara-one-skills-lounge/id6758308777"},{key:"zentara",name:"Zentara",tagline:"Conquer the cosmos",icon:mTA,android:"",ios:""}];function MTA(){const t=(()=>{try{return Li.isNativePlatform()}catch{return!1}})(),A=(()=>{try{return Li.getPlatform()}catch{return"web"}})(),e=jW.filter(I=>I.key!==_r),i=bh?jW:e;if(i.length===0)return null;const g=I=>A==="ios"?I.ios:I.android;return Q.jsx("div",{className:"profile-row",children:Q.jsxs("div",{className:"profile-section",children:[Q.jsx("strong",{children:"Our Other Apps"}),Q.jsx("div",{className:"other-apps-grid",children:i.map(I=>{const n=g(I);return Q.jsxs("a",{className:"other-app-card",href:n||"#",target:"_blank",rel:"noopener noreferrer","aria-label":`Get ${I.name}`,...n?{}:{"aria-disabled":"true",onClick:o=>o.preventDefault()},children:[Q.jsx("img",{className:"other-app-icon",src:I.icon,alt:`${I.name} icon`,width:56,height:56,loading:"lazy"}),Q.jsxs("div",{className:"other-app-info",children:[Q.jsx("div",{className:"other-app-name",children:I.name}),Q.jsx("div",{className:"other-app-tagline",children:I.tagline})]}),Q.jsx("span",{className:"other-app-cta",children:n?t?"Get":"View":"Soon"})]},I.key)})})]})})}function Ap(){const{playerId:t}=by(),A=Di(),e=Xn(),{user:i}=Yi(),{friends:g,friendRequests:I,blockedUsers:n,addFriend:o}=fu(),[a,r]=p.useState(null),[s,B]=p.useState(!0),[c,E]=p.useState(null),[D,y]=p.useState(!1),[S,f]=p.useState(!1),M=i?.id===t,k=g.some(x=>x.id===t),m=I.some(x=>(x.fromUserId===t||x.toUserId===t)&&x.status==="PENDING"),U=n.some(x=>x.id===t),F=p.useCallback(()=>{window.history.length>1?A(-1):A("/")},[A]);p.useEffect(()=>{if(!e||!t)return;let x=!1;return B(!0),E(null),e.emit("social:get_profile",{playerId:t},H=>{x||(B(!1),H.ok&&H.player?r(H.player):E(H.error||"Player not found"))}),()=>{x=!0}},[e,t]);const b=p.useCallback(async()=>{if(!(!t||k||m||U||D||S||a?.isBot)){f(!0);try{await o(t),y(!0)}catch{y(!1)}finally{f(!1)}}},[t,k,m,U,D,S,o,a?.isBot]),K=p.useCallback(()=>{t&&A(`/messages?peer=${encodeURIComponent(t)}`)},[t,A]);if(s)return Q.jsxs("div",{className:"theme-casino home-fixed-root",children:[Q.jsx(Po,{className:"profile-page-body"}),Q.jsx("div",{className:"logout-container home-header-row",children:Q.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}F()},children:[Q.jsx(dB,{className:"icon"})," Back"]})}),Q.jsx("div",{className:"profile-page",children:Q.jsx("div",{className:"home-fit-shell",children:Q.jsx("div",{className:"home-fit-content",children:Q.jsx("div",{className:"player-profile-loading",children:"Loading profile…"})})})}),Q.jsx(Cd,{})]});if(c||!a)return Q.jsxs("div",{className:"theme-casino home-fixed-root",children:[Q.jsx(Po,{className:"profile-page-body"}),Q.jsx("div",{className:"logout-container home-header-row",children:Q.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}F()},children:[Q.jsx(dB,{className:"icon"})," Back"]})}),Q.jsx("div",{className:"profile-page",children:Q.jsx("div",{className:"home-fit-shell",children:Q.jsx("div",{className:"home-fit-content",children:Q.jsx("div",{className:"player-profile-error",children:c||"Player not found"})})})}),Q.jsx(Cd,{})]});const R=a.isBot===!0,G=M||R?null:k?"Friends":m||D?"Pending":U?"Blocked":S?"Sending…":"Add Friend",J=M||R||k||m||U||D||S;return Q.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[Q.jsx(Po,{className:"profile-page-body"}),Q.jsx("div",{className:"logout-container home-header-row",children:Q.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}F()},children:[Q.jsx(dB,{className:"icon"})," Back"]})}),Q.jsx("div",{className:"profile-page",children:Q.jsx("div",{className:"home-fit-shell",children:Q.jsx("div",{className:"home-fit-content",children:Q.jsxs("div",{className:"profile-content",children:[Q.jsxs("div",{className:"pp-header-card",children:[Q.jsx("div",{className:"pp-avatar",children:a.avatarUrl?Q.jsx("img",{src:a.avatarUrl,alt:a.name||"Player",className:"pp-avatar-img"}):Q.jsx("div",{className:"pp-avatar-placeholder",children:(a.name||"?")[0].toUpperCase()})}),Q.jsxs("div",{className:"pp-header-info",children:[Q.jsxs("h2",{className:"pp-name",children:[a.name||"Anonymous",R&&Q.jsx("span",{className:"pp-bot-badge",children:"Bot"})]}),Q.jsxs("div",{className:"pp-meta-row",children:[a.age&&Q.jsxs("span",{className:"pp-meta-tag",children:[a.age," yrs"]}),a.sex&&Q.jsx("span",{className:"pp-meta-tag",children:a.sex}),a.location&&Q.jsx("span",{className:"pp-meta-tag",children:a.location})]})]})]}),!M&&!R&&Q.jsxs("div",{className:"pp-actions",children:[G&&Q.jsx("button",{className:"felt-btn pp-action-btn",onClick:()=>{try{xt("Light")}catch{}b()},disabled:J,children:G}),k&&Q.jsx("button",{className:"felt-btn pp-action-btn",onClick:()=>{try{xt("Light")}catch{}K()},children:"Message"})]}),a.aboutMe&&Q.jsxs("div",{className:"pp-section",children:[Q.jsx("h3",{className:"pp-section-title",children:"About"}),Q.jsx("p",{className:"pp-section-body",children:a.aboutMe})]}),a.interests&&Q.jsxs("div",{className:"pp-section",children:[Q.jsx("h3",{className:"pp-section-title",children:"Interests"}),Q.jsx("div",{className:"pp-interests",children:a.interests.split(/[,;]+/).map(x=>x.trim()).filter(Boolean).map((x,H)=>Q.jsx("span",{className:"pp-interest-tag",children:x},H))})]})]})})})}),Q.jsx(Cd,{})]})}function NTA(t){if(!t)return"?";const e=t.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),i=(e[0]?.[0]??"").toUpperCase(),g=(e[1]?.[0]??"").toUpperCase();return i+g||i||"?"}function ep(){const t=Di(),[A]=C2(),{user:e}=Yi(),i=e?.id??e?.email??"",{friends:g}=fu(),{getDmSummary:I,sendDmMessage:n,markDmRead:o,setActiveDm:a,threads:r,loadDmHistory:s}=zF(),[B,c]=p.useState(null),[E,D]=p.useState(""),y=p.useRef(null),S=p.useRef(null),f=p.useRef(!1);p.useEffect(()=>{if(f.current)return;f.current=!0;const J=A.get("peer");if(J){c(J),a(J),s(J),t("/messages",{replace:!0});return}const H=I()?.find(j=>j.unread>0);let P=null;H?P=H.peerUserId:g.length&&(P=g[0].id),P&&(c(P),a(P),s(P))},[g,I,a,s,A,t]),p.useEffect(()=>{B&&S.current!==B&&(S.current=B,o(B))},[B,o]);const M=p.useMemo(()=>B?r?.[Ys(B,i)]??[]:[],[B,r,i]),k=p.useMemo(()=>I()??[],[I,M.length]),m=p.useMemo(()=>{const J=new Map;return k.forEach(x=>J.set(x.peerUserId,x)),J},[k]);p.useEffect(()=>{y.current&&(y.current.scrollTop=y.current.scrollHeight)},[M.length,B]);const U=p.useCallback(J=>{c(J),a(J),o(J),s(J)},[a,o,s]),F=p.useCallback(()=>{if(!B)return;const J=E.trim();if(!J)return;n(B,J)&&D("")},[B,E,n]),b=J=>{J.key==="Enter"&&!J.shiftKey&&(J.preventDefault(),F())},K=p.useCallback(J=>g.find(H=>H.id===J)?.name||J,[g]),R=p.useCallback(J=>{const x=m.get(J);return x?.last?((x.last.senderId===i?"You: ":"")+x.last.text).trim():""},[m,i]),G=p.useCallback(()=>{try{xt("Light")}catch{}t(-1)},[t]);return Q.jsxs("div",{className:"theme-casino home-fixed-root messages-page",children:[Q.jsx(Po,{className:"messages-page-body"}),Q.jsx("div",{className:"logout-container  home-header-row",children:Q.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:G,children:[Q.jsx(dB,{className:"icon"})," Back"]})}),Q.jsxs("div",{className:"messages-container",children:[Q.jsxs("div",{className:"messages-thread-list",children:[g.length===0&&Q.jsx("div",{className:"messages-no-friends",children:"Add friends from your Profile to start messaging."}),g.map(J=>{const x=J.id===B,H=NTA(J.name||J.id),P=m.get(J.id)?.unread??0,j=R(J.id);return Q.jsxs("button",{onClick:()=>U(J.id),className:`messages-thread-btn ${x?"messages-thread-btn--active":""}`,title:K(J.id),children:[Q.jsx("div",{className:"messages-avatar","aria-hidden":!0,children:H}),Q.jsxs("div",{className:"messages-thread-label",children:[Q.jsx("div",{className:"messages-thread-name",children:K(J.id)}),Q.jsx("div",{className:"messages-thread-preview",children:j})]}),P>0&&Q.jsx("span",{"aria-label":`${P} unread`,className:"messages-unread-badge",children:P>99?"99+":P})]},J.id)})]}),Q.jsxs("div",{className:"messages-active-thread",children:[Q.jsxs("div",{ref:y,className:"messages-scroller",children:[!B&&Q.jsx("div",{className:"messages-empty",children:"Select a conversation to begin."}),B&&M.length===0&&Q.jsx("div",{className:"messages-empty",children:"No messages yet. Say hello!"}),B&&M.length>0&&M.map(J=>{const x=J.senderId===i,H=new Date(J.ts),P=H.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return Q.jsxs("div",{className:`messages-message ${x?"messages-message--mine":""}`,title:H.toLocaleString(),children:[Q.jsx("div",{className:"messages-message-content",children:J.text}),Q.jsx("div",{className:"messages-message-time",children:P}),J.pending&&Q.jsx("div",{className:"messages-pending",children:"sending…"}),J.error&&Q.jsx("div",{className:"messages-error",children:J.error})]},J.id)})]}),Q.jsxs("div",{className:"messages-composer",children:[Q.jsx("input",{value:E,onChange:J=>D(J.target.value),onKeyDown:b,placeholder:B?`Message ${K(B)}…`:"Pick a conversation…",disabled:!B,className:"messages-composer-input"}),Q.jsx("button",{onClick:F,disabled:!B||E.trim()==="",className:`messages-composer-send ${!B||E.trim()===""?"messages-composer-send--disabled":""}`,children:"Send"})]})]})]}),Q.jsx(Cd,{})]})}function tp(){const[t,A]=p.useState(gC),[e,i]=p.useState(!1),g=p.useRef(null);p.useEffect(()=>{let n=!0;return(async()=>{const o=await jo();n&&(A(o),i(!0))})(),()=>{n=!1,g.current&&window.clearTimeout(g.current)}},[]),p.useEffect(()=>{e&&(g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{VE(t).catch(()=>{})},200))},[t,e]);const I=n=>A(o=>({...o,[n]:!o[n]}));return Q.jsxs("div",{className:"settings-page",children:[Q.jsxs("a",{className:"gold-link white-link",onClick:()=>history.back(),children:[Q.jsx("img",{src:"/icons/arrow-left.svg",alt:"","aria-hidden":!0,className:"icon"})," Back"]}),Q.jsx("div",{className:"settings-section",children:Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:t.diceAudio,onChange:()=>I("diceAudio"),disabled:!e}),"Dice Audio"]})}),Q.jsx("div",{className:"settings-section",children:Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:t.backgroundMusic,onChange:()=>I("backgroundMusic"),disabled:!e}),"Background Music"]})}),Q.jsx("div",{className:"settings-section",children:Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:t.chatAudio,onChange:()=>I("chatAudio"),disabled:!e}),"In-Room Chat Audio"]})}),Q.jsx("div",{className:"settings-section",children:Q.jsxs("label",{children:[Q.jsx("input",{type:"checkbox",checked:t.video,onChange:()=>I("video"),disabled:!e}),"Video"]})})]})}const gIA=Ea();async function GTA(){try{const t=await Nn(),A=await fetch(`${gIA}/api/ad-reward`,{method:"POST",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},credentials:"include"});if(!A.ok){const i=await A.json();return{ok:!1,error:i.error,retryInMs:i.retryInMs}}return{ok:!0,balance:(await A.json()).balance}}catch{return{ok:!1,error:"NETWORK_ERROR"}}}async function RTA(){try{const t=await Nn(),A=await fetch(`${gIA}/api/ad-reward/status`,{method:"GET",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},credentials:"include"});return A.ok?{ok:!0,nextAt:(await A.json()).nextAt}:{ok:!1,error:(await A.json()).error,nextAt:null}}catch{return{ok:!1,error:"NETWORK_ERROR",nextAt:null}}}const ZW={claimAdReward:GTA,getAdRewardCooldown:RTA};function ip(){const{busy:t,busyChips:A,ready:e,error:i,purchasesReady:g,premiumActive:I,hasPremiumPackage:n,premiumLabel:o,onBuyChips:a,onGoPremium:r,onRestore:s,chipsSubtitle:B,premiumSubtitle:c,chipsDescription:E,premiumDescription:D,premiumPrice:y,premiumInterval:S}=Rk(),{refreshUser:f}=Yi(),{infoNow:M}=qr(),[k,m]=p.useState(!1),[U,F]=p.useState(0),[b,K]=p.useState(()=>Date.now()),R=Math.max(0,U-b),G=R>0,J=mL.isNativeAdSupported(),x=!I&&J,H=p.useCallback(KA=>{const FA=Math.ceil(KA/1e3),RA=Math.floor(FA/60),MA=FA%60;return`${RA}m ${MA}s`},[]);p.useEffect(()=>{x&&(async()=>{try{const KA=await ZW.getAdRewardCooldown();KA?.ok&&KA.nextAt&&KA.nextAt>Date.now()&&F(KA.nextAt)}catch{}})()},[x]),p.useEffect(()=>{!x||G||mL.prepareRewardedAd().catch(()=>{})},[x,G]),p.useEffect(()=>{if(!G)return;const KA=setInterval(()=>K(Date.now()),1e3);return()=>clearInterval(KA)},[G]);const P=p.useCallback(async()=>{if(!(k||G||!x)){xt("Light"),m(!0);try{const KA=await mL.showRewardedAd();if(!KA.ok){KA.error==="AD_DISMISSED"?M?.("Ad skipped - watch the full ad to earn credits!"):M?.(`Ad unavailable: ${KA.error}`),m(!1);return}const FA=await ZW.claimAdReward();if(FA.ok){const RA=B4*60*1e3;F(Date.now()+RA),M?.(`+${Wf} Z Credits earned!`);try{f()}catch{}}else if(FA.error==="COOLDOWN_ACTIVE"){const RA=FA.retryInMs??B4*60*1e3;F(Date.now()+RA),M?.("Please wait before watching another ad.")}else M?.(`Reward failed: ${FA.error}`)}catch{M?.("Something went wrong. Please try again.")}finally{m(!1)}}},[k,G,x,M,f]),j="$1.99",q="Monthly",Y=y||j,O=S||q,$=c||`${Y} Mo`,gA=D||"Remove ads and unlock premium features.",z="$1.99 for 1,000 Zentara Credits",X="Buy Zentara Credits to keep playing.",sA=B||z,rA=E||X,mA=()=>{try{xt("Light")}catch{}try{a()}catch{}},IA=()=>{try{xt("Light")}catch{}try{r()}catch{}},uA=()=>{try{xt("Light")}catch{}try{s()}catch{}};return Q.jsxs("div",{className:"theme-casino home-fixed-root add-chips",children:[Q.jsx(Po,{className:"profile-page-body"}),Q.jsx("div",{className:"logout-container  home-header-row",children:Q.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{xt("Light")}catch{}history.back()},children:[Q.jsx(dB,{className:"icon"})," Back"]})}),Q.jsx("div",{className:"home-fit-shell",children:Q.jsxs("div",{className:"home-fit-content",children:[i&&Q.jsx("div",{className:"error-message",role:"alert",children:i}),!i&&e&&!g&&Q.jsx("div",{className:"status-message","aria-live":"polite",children:"Initializing… please wait."}),Q.jsxs("div",{className:"home-action-buttons",children:[x&&Q.jsxs("div",{className:"outline-action-btn-wrapper",children:[Q.jsx("button",{className:"felt-btn felt-btn--secondary","data-no-global-haptic":!0,onClick:P,disabled:k||G,"aria-label":`Watch ad for ${Wf} free credits`,title:`Watch ad for ${Wf} free credits`,style:{background:"linear-gradient(135deg, #2d5a2d 0%, #1a3d1a 100%)",borderColor:"#4a8f4a"},children:k?"Loading Ad…":G?`Available in ${H(R)}`:`🎬 WATCH AD → +${Wf}`}),Q.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[Q.jsxs("div",{className:"subtle","aria-hidden":!0,children:["Free ",Wf," Z Credits"]}),Q.jsx("div",{className:"hint","aria-hidden":!0,children:"Watch a short video to earn free credits!"})]})]}),Q.jsxs("div",{className:"outline-action-btn-wrapper",children:[Q.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:mA,disabled:t||!e||!g,"aria-label":"Buy 1000 Z Credits",title:"Buy 1000 Z Credits",children:A?"Purchasing…":"BUY Z CREDITS"}),Q.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[Q.jsx("div",{className:"subtle","aria-hidden":!0,children:sA}),Q.jsx("div",{className:"hint","aria-hidden":!0,children:rA})]})]}),Q.jsxs("div",{className:"outline-action-btn-wrapper",children:[!I&&n&&Q.jsxs(Q.Fragment,{children:[Q.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:IA,disabled:t,"aria-label":o,title:o,children:"GO PREMIUM"}),Q.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[$&&Q.jsx("div",{className:"subtle","aria-hidden":!0,children:$}),Q.jsx("div",{className:"hint","aria-hidden":!0,children:gA}),Q.jsxs("div",{className:"legal-note",role:"note",style:{marginTop:8,fontSize:12,opacity:.85},children:[Q.jsx("strong",{children:"Premium Subscription"})," — ",Y," (",O,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",Q.jsx(Yo,{to:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",Q.jsx(Yo,{to:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})]}),I&&Q.jsx("div",{style:{textAlign:"center"},children:Q.jsx(QH,{isPremium:!0})})]}),n&&Q.jsx("div",{className:"outline-action-btn-wrapper",children:Q.jsxs("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:uA,disabled:t||!e||!g,"aria-label":"Restore Purchases",title:"Restore Purchases",children:["RESTORE",Q.jsx("br",{}),"PURCHASES"]})})]})]})}),Q.jsx(Cd,{})]})}function XO({open:t,onClose:A,title:e="Error",message:i}){return O6(!!t),p.useEffect(()=>{const g=I=>{I.key==="Escape"&&A()};return t&&document.addEventListener("keydown",g),()=>document.removeEventListener("keydown",g)},[t,A]),t?Q.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:A,children:Q.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":e,onClick:g=>g.stopPropagation(),children:[Q.jsx("button",{className:"modal-close",onClick:A,"aria-label":"Close",children:"×"}),Q.jsx("h3",{className:"modal-title",children:e}),Q.jsx("p",{className:"modal-subtitle",role:"alert",children:i}),Q.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:12},children:Q.jsx("button",{className:"btn close-btn",onClick:A,"aria-label":"Close",children:"Close"})})]})}):null}function gp(){const[t,A]=p.useState("verifying"),e=Di(),{refreshUser:i}=Yi();p.useEffect(()=>{(async()=>{const o=new URLSearchParams(window.location.search).get("token");if(!o)return A("error");try{const a=await RBA(o);if(a?.success){a.token&&await dd(a.token);try{await i({force:!0})}catch{}try{setTimeout(()=>{i({force:!0}).catch(()=>{})},400)}catch{}if(await fF()){A("success");return}A("success")}else A("error")}catch{A("error")}})()},[e,i]),p.useEffect(()=>{if(t!=="success")return;const I=window.setTimeout(()=>{try{e("/?redirect=/lobby",{replace:!0})}catch{window.location.href=`${window.location.origin}/?redirect=/lobby`}},1200);return()=>{window.clearTimeout(I)}},[t,e]);const g=I=>I==="verifying"?Q.jsxs(Q.Fragment,{children:[Q.jsx("p",{children:"Verifying your magic link..."}),Q.jsx("button",{className:"landing-btn-secondary",onClick:()=>e("/login"),style:{marginTop:16},"aria-label":"Back to Login",children:"Back to Login"})]}):I==="success"?Q.jsx("p",{children:"Verification successful! Redirecting to the lobby..."}):Q.jsxs(Q.Fragment,{children:[Q.jsx(XO,{open:!0,onClose:()=>e("/login"),title:"Verification failed",message:"Verification failed. Please try again."}),Q.jsx("button",{className:"landing-btn-secondary",onClick:()=>e("/login"),style:{marginTop:16},"aria-label":"Back to Login",children:"Back to Login"})]});return Q.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[Q.jsx(Po,{className:"page-home-screen"}),Q.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"0 16px"},children:Q.jsx("div",{children:g(t)})})]})}function Ip(){const[t,A]=p.useState("verifying"),[e,i]=p.useState(!1),g=Di(),I=Ea();return p.useEffect(()=>{(async()=>{const a=new URLSearchParams(window.location.search).get("token");if(!a){A("error");return}try{const r=await fetch(`${I}/api/auth/review-login?token=${encodeURIComponent(a)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!r.ok){A("error");return}let s=null;try{const B=await r.json().catch(()=>null);B?.token&&await dd(B.token)}catch{}if(s=await fF(),s){A("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else A("error")}catch{A("error")}})()},[I,g]),p.useEffect(()=>{t==="error"&&i(!0)},[t]),t==="verifying"?Q.jsx("p",{children:"Signing you in for review…"}):t==="success"?Q.jsx("p",{children:"Success! Redirecting to the lobby…"}):Q.jsx(Q.Fragment,{children:Q.jsx(XO,{open:e,onClose:()=>i(!1),title:"Review login failed",message:"Review login failed. Please check your link."})})}function np(){const[t,A]=p.useState("verifying"),[e,i]=p.useState(!1),g=Di(),I=Ea();return p.useEffect(()=>{(async()=>{const a=new URLSearchParams(window.location.search).get("token");if(!a){A("error");return}try{const r=await fetch(`${I}/api/auth/qa-login?token=${encodeURIComponent(a)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!r.ok){A("error");return}try{const B=await r.json().catch(()=>null);B?.token&&await dd(B.token)}catch{}if(await fF()){A("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else A("error")}catch{A("error")}})()},[I,g]),p.useEffect(()=>{t==="error"&&i(!0)},[t]),t==="verifying"?Q.jsx("p",{children:"Signing you in for QA…"}):t==="success"?Q.jsx("p",{children:"Success! Redirecting to the lobby…"}):Q.jsx(Q.Fragment,{children:Q.jsx(XO,{open:e,onClose:()=>i(!1),title:"QA login failed",message:"QA login failed. Please check your link."})})}function hY({busy:t=!1,label:A="Cancel Bet",disabled:e,...i}){const g=e||t;return Q.jsxs("button",{type:"button",className:`cancel-btn ${t?"is-busy":""} ${g?"is-disabled":""}`,disabled:g,"aria-busy":t||void 0,"aria-label":A,"aria-live":"polite",...i,children:[Q.jsx("span",{className:"cancel-btn__content",children:"X"}),t&&Q.jsx("span",{className:"cancel-btn__spinner","aria-hidden":"true"})]})}function IIA({disabled:t,onClick:A,busy:e=!1,label:i="✓",mini:g=!1}){return Q.jsx("button",{disabled:t||e,onClick:A,className:`place-bet-btn ${g?"place-bet-btn--mini":""} ${e?"busy":""}`,"aria-label":"Place Bet",children:e?"Placing...":i})}function UTA({show:t,open:A,isBanker:e,meId:i,players:g,labelPrefix:I="Main Bet: "}){const n=p.useMemo(()=>A.filter(c=>c.type==="MAIN"),[A]),[o,a]=p.useState(!1),r=p.useMemo(()=>n?.filter(c=>e?!0:c.playerId===i||c.acceptedById===i),[n,e,i]),s=p.useMemo(()=>r.reduce((c,E)=>c+(E.amount||0),0),[r]),B=c=>g.find(E=>E.id===c)?.name||c;return Q.jsxs(Q.Fragment,{children:[Q.jsx(uB.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:Q.jsx("a",{role:"button","aria-haspopup":"dialog","aria-expanded":o,onClick:()=>{a(!0)},title:"Show my bets",className:"gold-link",children:Q.jsxs("span",{className:"betToken__amount",children:[I,QD(s??0)]})})}),o&&Q.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Your bets",children:[Q.jsx("div",{className:"results-modal__backdrop",onClick:()=>a(!1)}),Q.jsxs("div",{className:"results-modal__card card",children:[Q.jsxs("div",{className:"results-modal__header",children:[Q.jsx("h3",{style:{margin:0},children:"Your Open Main Bets"}),Q.jsx("button",{className:"btn btn--ghost",onClick:()=>a(!1),children:"Close"})]}),r.length===0?Q.jsx("ul",{className:"betlist results-list",children:Q.jsx("li",{className:"betitem",children:"No applicable bets."})}):Q.jsx("ul",{className:"betlist results-list",children:r.map(c=>Q.jsx("li",{className:"betitem",children:Q.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[Q.jsxs(Q.Fragment,{children:[" ",ZO(c.amount).map(E=>Q.jsx(hB,{mini:!0,value:E}))]}),Q.jsxs("div",{className:"betitem__info",children:[Q.jsxs("div",{className:"betitem__title",children:[B(c.playerId)," ",Q.jsx("span",{className:"betSummary__dash",children:"—"})," BET"]}),Q.jsxs("div",{className:"betitem__meta",children:["Amount: ",Q.jsx("strong",{children:QD(c.amount??0)}),c.acceptedById?` • matched by ${B(c.acceptedById)}`:" • (pending)"]})]})]})},c.id))})]})]})]})}const KTA={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 nIA({selectedTimes:t,onAdd:A,onClear:e,onPlaceBet:i,onCancelBet:g,disabled:I,collapsed:n=!1,collapseLabel:o="Placed bet",miniChips:a=!1,betTokenProps:{isBanker:r,meId:s,open:B,players:c,show:E,labelPrefix:D},hasBankRoll:y,betsLocked:S,myOpenMain:f,mainAmt:M,heading:k,rollerMeta:m}){const U=VgA,F=_JA(),b=p.useCallback(()=>{xt("Light")},[]),K=p.useRef(!1),R=!!S,G=!!y,J=!I&&!R&&!G&&!r&&!f,x=p.useCallback(()=>{K.current||!J||(K.current=!0,b(),i?.(),setTimeout(()=>{K.current=!1},600))},[J,i,b]),H=p.useCallback(j=>{if(!(I||R)){b();try{}catch{}A?.(j)}},[I,R,A,b]),P=p.useCallback(()=>{I||G||!f||(b(),g?.())},[I,G,f,g,b]);return Q.jsxs("div",{className:`chipRackOuter ${J?"chipRackOuter--active":""}`,children:[M>0&&!f&&Q.jsxs("div",{className:"chipRack__total","aria-label":`Total bet: ${M}${m?` vs ${m.name}${m.hasHistory?` (${m.label})`:""}`:""}`,children:[Q.jsx("span",{className:"chipRack__totalSymbol",children:"ℤ"}),M.toLocaleString(),m&&Q.jsxs("span",{className:"chipRack__totalMeta",children:[Q.jsx("span",{className:"chipRack__totalMeta__vs",children:"vs"}),Q.jsx("span",{className:"chipRack__totalMeta__name",children:m.name}),m.hasHistory&&Q.jsxs("span",{className:`chipRack__totalMeta__record ${m.net>0?"chipRack__totalMeta__record--up":m.net<0?"chipRack__totalMeta__record--down":""}`,children:["(",m.label,")"]})]})]}),Q.jsxs("div",{className:"chipRackContainer",children:[Q.jsxs("div",{className:`chipRack ${I?"chipRack--disabled":""} ${n?"chipRack--collapsed":"chipRack--open"}`,children:[Q.jsx("div",{className:"chipRack__collapseTarget","aria-label":o}),Q.jsx(uB.div,{className:"chipRack__scroller",role:"listbox","aria-label":"Bet chips",initial:!1,style:{pointerEvents:I||R||n||f?"none":"auto"},children:U.map(j=>{const q=(t[j]??0)>0;return Q.jsx(uB.div,{role:"option","aria-selected":q,variants:F?void 0:KTA,layout:!0,className:"chipRack__chipWrapper",children:Q.jsx(hB,{value:j,onAdd:H,onClear:e,disabled:!J,selectedTimes:t[j]??0,mini:a,"data-chip":j})},j)})})]}),Q.jsxs("div",{className:"chipRack__placeWrap","aria-disabled":!J,style:{pointerEvents:J?"auto":"none"},"data-allowed":J?"true":"false",children:[J&&Q.jsx("div",{className:"chipRack__bounceArrow","aria-hidden":"true",children:"▼"}),Q.jsx("div",{className:"chipRack__placeInner",children:Q.jsx(IIA,{onClick:x,disabled:!J,mini:a})}),J&&Q.jsx("div",{className:"chipRack__halo","aria-hidden":"true"})]}),Q.jsxs("div",{className:"chipRack__amount","aria-live":"polite","aria-atomic":"true",children:[Q.jsx(uB.div,{children:Q.jsx(hY,{onClick:P,disabled:I||G||!f})}),Q.jsx(UTA,{isBanker:r,meId:s,open:B,players:c,show:E,labelPrefix:D})]})]})]})}function FTA({fly:t,onComplete:A}){const e=p.useRef({startX:t.startX,startY:t.startY,endX:t.endX,endY:t.endY,amount:t.amount}).current,i=p.useRef(null);p.useEffect(()=>{const I=Zn.chipFlyDurationMs,n=0,o=100;i.current=window.setTimeout(()=>{try{UlA({playbackRate:1.25})}catch{}},n+o);const a=setTimeout(A,I+600);return()=>{clearTimeout(a),i.current&&(window.clearTimeout(i.current),i.current=null)}},[A]);const g=18;return p.useRef(null),Q.jsx(uB.div,{initial:{position:"fixed",left:e.startX-g,top:e.startY-g,zIndex:1e4,opacity:0,scale:.9},animate:{left:e.endX-g,top:e.endY-g,opacity:1,scale:1},transition:{type:"spring",stiffness:120,damping:20,duration:Zn.chipFlyDurationMs/1e3},onAnimationComplete:A,style:{pointerEvents:"none"},children:Q.jsx(hB,{mini:!0,value:e.amount,disabled:!0,className:"chip--flight",selectedTimes:0})})}function Hm({label:t,subtitle:A,onClick:e,className:i,disabled:g,imageName:I,imgSrc:n,size:o="md",ariaLabel:a,showHalo:r}){const s=["gold-btn",`gold-btn--${o}`,n||I?"gold-btn--image":"gold-btn--styled",i||""].filter(Boolean).join(" "),B=I?`/ui/buttons/${I}.webp`:void 0,c=n||B;return Q.jsxs("button",{type:"button",className:s,onClick:e,disabled:g,"aria-label":a||t,children:[r&&Q.jsx("span",{className:"gold-btn__halo","aria-hidden":!0}),c&&Q.jsx("span",{className:"gold-btn__media","aria-hidden":!0,children:Q.jsxs("picture",{children:[Q.jsx("source",{srcSet:c,type:"image/webp"}),Q.jsx("img",{src:c,alt:"",loading:"lazy"})]})}),Q.jsxs("span",{className:"gold-btn__text",children:[Q.jsx("span",{className:"gold-btn__label",children:t}),A?Q.jsx("span",{className:"gold-btn__sub","aria-hidden":!0,children:A}):null]})]})}function Gc({label:t,subtitle:A,onClick:e,disabled:i,size:g="md",ariaLabel:I,className:n,variant:o="pill",showHalo:a}){const r=[n,o==="circle"?"poker-action--circle":""].filter(Boolean).join(" "),[s,B]=ke.useState(!1),c=ke.useCallback(()=>{try{Cg()}catch{}B(!1),requestAnimationFrame(()=>{B(!0),window.setTimeout(()=>B(!1),260)});try{xt("Light")}catch{}try{}catch{}typeof e=="function"&&e()},[e]),E=typeof a=="boolean"?a:!i;return Q.jsx("span",{className:["poker-action-spring",s?"is-spring":""].filter(Boolean).join(" "),"data-no-global-haptic":!0,children:Q.jsx(Hm,{label:t,subtitle:A,onClick:c,disabled:i,size:g,ariaLabel:I,className:r,showHalo:E})})}function Hk(){const t=[{id:"bet1",type:"MAIN",playerId:"player1",acceptedById:"banker1",amount:100},{id:"bet2",type:"MAIN",playerId:"player2",acceptedById:null,amount:50}],A=[{id:"player1",name:"Alice"},{id:"player2",name:"Bob"},{id:"banker1",name:"Banker"}],[e,i]=p.useState({1:0,5:0,10:1,25:0,100:0}),[g,I]=p.useState(10),[n,o]=p.useState(!1),[a,r]=p.useState(!1),[s,B]=p.useState([]),c=p.useRef(null),E=p.useRef({c1:null,c2:null,c3:null,c4:null}),D=K=>{if(!K)return null;const R=K.getBoundingClientRect();return{x:R.left+R.width/2,y:R.top+R.height/2}},y=p.useCallback((K,R,G)=>{const J=D(K),x=D(R);if(!J||!x)return;const P={id:`flight-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,amount:G,fromId:"sandbox-from",toId:"sandbox-to",startX:J.x,startY:J.y,endX:x.x,endY:x.y,active:!0};B(j=>[...j,P])},[]),S=()=>{y(E.current.c1,c.current,25)},f=()=>{["c1","c2","c3","c4"].forEach((K,R)=>{setTimeout(()=>y(E.current[K],c.current,5*(R+1)),R*40)})},M=()=>{["c1","c2","c3","c4"].forEach((K,R)=>{setTimeout(()=>y(c.current,E.current[K],10*(R+1)),R*40)})},k=K=>{B(R=>R.filter(G=>G.id!==K))},m=K=>{i(R=>({...R,[K]:(R[K]||0)+1})),I(R=>R+K)},U=K=>{i(R=>({...R,[K]:0})),I(R=>R-K*(e[K]||0))},F=()=>{o(!0),r(!0)},b=()=>{o(!1),r(!1),i({1:0,5:0,10:0,25:0,100:0}),I(0)};return Q.jsxs("div",{className:"button-sandbox",children:[Q.jsx("h1",{children:"Button Sandbox"}),Q.jsx(Po,{className:"profile-page"}),Q.jsxs("section",{style:{marginBottom:28},children:[Q.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"ChipFly Test"}),Q.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:[Q.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[Q.jsx("button",{className:"felt-btn felt-btn--mini",onClick:S,children:"Single Flight"}),Q.jsx("button",{className:"felt-btn felt-btn--mini",onClick:f,children:"Sweep 456"}),Q.jsx("button",{className:"felt-btn felt-btn--mini",onClick:M,children:"Sweep 123"}),Q.jsx("button",{className:"felt-btn felt-btn--mini",onClick:()=>B([]),style:{background:"#933",borderColor:"#600"},children:"Clear Flights"})]}),Q.jsxs("div",{style:{position:"relative",minHeight:170,marginTop:8,display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0 12px"},children:[Q.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c1","c2"].map(K=>Q.jsx("div",{ref:R=>{E.current[K]=R},children:Q.jsx(hB,{mini:!0,value:5,disabled:!0,className:"chip--flight"})},K))}),Q.jsxs("div",{ref:c,children:[Q.jsx(hB,{mini:!0,value:100,disabled:!0,className:"chip--flight"}),Q.jsx("div",{style:{textAlign:"center",marginTop:4,fontSize:11,opacity:.7},children:"Banker"})]}),Q.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c3","c4"].map(K=>Q.jsx("div",{ref:R=>{E.current[K]=R},children:Q.jsx(hB,{mini:!0,value:25,disabled:!0,className:"chip--flight"})},K))})]})]}),s.map(K=>Q.jsx(FTA,{fly:K,onComplete:()=>k(K.id)},K.id))]}),Q.jsxs("section",{style:{marginBottom:28},children:[Q.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Flash Overlays"}),Q.jsxs("div",{className:"flash-preview__row",children:[Q.jsx("div",{className:"flash-preview__header",children:Q.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:Q.jsx("div",{className:"flash-card flash-win",children:Q.jsxs("div",{className:"flash-body",children:[Q.jsxs("div",{className:"flash-title",children:[Q.jsx("span",{className:"flash-title__name",children:"ALICE"}),Q.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),Q.jsxs("div",{className:"flash-subtitle",children:[Q.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})})}),Q.jsx("div",{className:"flash-preview__header",children:Q.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:Q.jsx("div",{className:"flash-card flash-lose",children:Q.jsxs("div",{className:"flash-body",children:[Q.jsxs("div",{className:"flash-title",children:[Q.jsx("span",{className:"flash-title__name",children:"BANKER"}),Q.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),Q.jsxs("div",{className:"flash-subtitle",children:[Q.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})})}),Q.jsx("div",{className:"flash-preview__header",children:Q.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:Q.jsx("div",{className:"flash-card flash-push",children:Q.jsxs("div",{className:"flash-body",children:[Q.jsx("div",{className:"flash-title",children:"PUSH"}),Q.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})})]}),Q.jsxs("div",{className:"flash-preview__row",children:[Q.jsx("div",{className:"flash-frame",children:Q.jsx("div",{className:"flash-card flash-win","aria-hidden":!0,children:Q.jsxs("div",{className:"flash-body",children:[Q.jsxs("div",{className:"flash-title",children:[Q.jsx("span",{className:"flash-title__name",children:"ALICE"}),Q.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),Q.jsxs("div",{className:"flash-subtitle",children:[Q.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})}),Q.jsx("div",{className:"flash-frame",children:Q.jsx("div",{className:"flash-card flash-lose","aria-hidden":!0,children:Q.jsxs("div",{className:"flash-body",children:[Q.jsxs("div",{className:"flash-title",children:[Q.jsx("span",{className:"flash-title__name",children:"BANKER"}),Q.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),Q.jsxs("div",{className:"flash-subtitle",children:[Q.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})}),Q.jsx("div",{className:"flash-frame",children:Q.jsx("div",{className:"flash-card flash-push","aria-hidden":!0,children:Q.jsxs("div",{className:"flash-body",children:[Q.jsx("div",{className:"flash-title",children:"PUSH"}),Q.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})]})]}),Q.jsxs("section",{style:{marginBottom:28},children:[Q.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Poker Action Buttons"}),Q.jsxs("div",{className:"poker-actions",role:"group","aria-label":"Poker action buttons",style:{display:"flex",gap:12,flexWrap:"wrap",alignItems:"center"},children:[Q.jsx(Gc,{label:"Check",ariaLabel:"Check",size:"md",className:"poker-action--green poker-action--secondary poker-action--check",onClick:()=>{}}),Q.jsx(Gc,{label:"Call",subtitle:"z120",ariaLabel:"Call 120",size:"md",className:"poker-action--green poker-action--primary poker-action--call",onClick:()=>{}}),Q.jsx(Gc,{label:"Bet",subtitle:"z250",ariaLabel:"Bet 250",size:"md",className:"poker-action--flat poker-action--secondary poker-action--bet",onClick:()=>{}}),Q.jsx(Gc,{label:"Raise",subtitle:"z400",ariaLabel:"Raise 400",size:"md",className:"poker-action--flat poker-action--secondary poker-action--raise",onClick:()=>{}}),Q.jsx(Gc,{label:"Fold",ariaLabel:"Fold",size:"md",className:"poker-action--flat poker-action--danger poker-action--fold",onClick:()=>{}})]})]}),Q.jsxs("div",{className:"button-grid",children:[Q.jsx("div",{className:"button-item",children:Q.jsx(niA,{onClick:()=>{},label:"ROLL",busy:!1,disabled:!1})}),Q.jsx("div",{className:"button-item",children:Q.jsx(hY,{onClick:()=>{},busy:!1,disabled:!1,label:"Cancel Bet"})}),Q.jsx("div",{className:"button-item",children:n?Q.jsx(hY,{onClick:b,busy:!1,disabled:!1,label:"Cancel Bet"}):Q.jsx(IIA,{disabled:g<=0,onClick:F,busy:!1,label:"✓"})}),Q.jsx("div",{className:"button-item",children:Q.jsx(nIA,{selectedTimes:e,onAdd:m,onClear:U,disabled:n,collapsed:a,collapseLabel:"Chip Rack",betTokenProps:{isBanker:!1,meId:"player1",open:t,players:A,show:n},onPlaceBet:F,onCancelBet:b,mainAmt:g})}),Q.jsx("div",{className:"button-item",children:Q.jsx(vH,{state:"verified"})})]})]})}function op(){const t=Di(),A=()=>{window.history.length>1?t(-1):t("/lobby",{replace:!0})};return Q.jsx("div",{className:"disclaimer-screen",children:Q.jsxs("div",{className:"disclaimer-panel",children:[Q.jsxs("button",{type:"button",className:"disclaimer-back",onClick:A,"aria-label":"Back",children:[Q.jsx(dB,{className:"icon"})," Back"]}),Q.jsx("div",{className:"disclaimer-accent-bar"}),Q.jsx("h1",{className:"disclaimer-title",children:"Disclaimer"}),Q.jsxs("div",{className:"disclaimer-body",children:[Q.jsxs("p",{children:[Q.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."]}),Q.jsx("p",{children:"Virtual chips used in gameplay have no cash value and cannot be redeemed for real money, goods, or services."}),Q.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."}),Q.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."}),Q.jsx("p",{children:"If you or someone you know has a gambling problem and needs help, please contact your local gambling support hotline."})]}),Q.jsxs("div",{className:"disclaimer-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function ap(){const t=Di();return Q.jsx("div",{className:"legal-screen",children:Q.jsxs("div",{className:"legal-panel",children:[Q.jsx("div",{className:"legal-accent-bar"}),Q.jsxs("div",{className:"legal-header",children:[Q.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[Q.jsx(dB,{className:"icon"}),"Back"]}),Q.jsx("h1",{className:"legal-title",children:"Support"})]}),Q.jsxs("div",{className:"legal-body",children:[Q.jsx("p",{children:"Need help with Zentara One Dice Lounge? We're here for you."}),Q.jsxs("p",{children:["Email us at"," ",Q.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."]}),Q.jsx("p",{children:"Please include your device, OS version, and a brief description of the issue."})]}),Q.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function rp(){const t=Di();return Q.jsx("div",{className:"legal-screen",children:Q.jsxs("div",{className:"legal-panel",children:[Q.jsx("div",{className:"legal-accent-bar"}),Q.jsxs("div",{className:"legal-header",children:[Q.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[Q.jsx(dB,{className:"icon"}),"Back"]}),Q.jsx("h1",{className:"legal-title",children:"Privacy Policy"})]}),Q.jsxs("div",{className:"legal-body",children:[Q.jsx("p",{children:"We respect your privacy. Zentara One Dice Lounge, Zentara One Poker Lounge, Zentara One Craps Lounge, Zentara One Cee-Lo Lounge, and Zentara One Skills 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."}),Q.jsxs("p",{children:["For questions or data requests, contact"," ",Q.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),Q.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function sp(){const t=Di();return Q.jsx("div",{className:"legal-screen",children:Q.jsxs("div",{className:"legal-panel",children:[Q.jsx("div",{className:"legal-accent-bar"}),Q.jsxs("div",{className:"legal-header",children:[Q.jsxs("button",{type:"button",className:"legal-back",onClick:()=>t(-1),"aria-label":"Go back",children:[Q.jsx(dB,{className:"icon"}),"Back"]}),Q.jsx("h1",{className:"legal-title",children:"Terms of Use"})]}),Q.jsxs("div",{className:"legal-body",children:[Q.jsx("p",{children:'By using Zentara One Dice Lounge, Poker Lounge, Craps Lounge, Cee-Lo Lounge, or Skills Lounge (the "App"), you agree to these Terms of Use. If you do not agree, do not use the App.'}),Q.jsx("h2",{children:"1. Apple Standard EULA"}),Q.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:"," ",Q.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/"}),"."]}),Q.jsx("h2",{children:"2. Subscriptions and Billing"}),Q.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."}),Q.jsx("h2",{children:"3. Refunds"}),Q.jsx("p",{children:"Refunds for purchases made via the App Store are handled by Apple directly, per Apple policies."}),Q.jsx("h2",{children:"4. Acceptable Use"}),Q.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."}),Q.jsx("h2",{children:"5. Privacy"}),Q.jsxs("p",{children:["Please review our"," ",Q.jsx(Yo,{className:"legal-link",to:"/privacy",children:"Privacy Policy"})," ","to understand how we collect and use information."]}),Q.jsx("h2",{children:"6. Contact"}),Q.jsxs("p",{children:["Questions? Contact"," ",Q.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),Q.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}Ea();function $O({children:t,header:A,footer:e,showAvatarBacks:i=!1}){return Q.jsxs("div",{className:"poker-room-shell","aria-label":"Poker Room","data-game-mode":"poker","data-show-avatar-backs":i?"1":void 0,children:[Q.jsx(Po,{className:"page-poker-room"}),Q.jsx("div",{className:"poker-room-bg"}),Q.jsxs("div",{className:"poker-room-foreground",role:"main",children:[A,Q.jsx("div",{className:"poker-room-content",children:t}),e]})]})}function bTA({cards:t,firstRevealed:A=!0,bothRevealed:e=!0}){const[i,g]=Array.isArray(t)?t:[];return!i&&!g?null:Q.jsxs("div",{className:"holecards","aria-label":"hole-cards",children:[Q.jsx(WW,{value:i,revealed:!!A||!!e}),Q.jsx(WW,{value:g,revealed:!!e})]})}function WW({value:t,revealed:A=!1}){if(!t)return Q.jsx("span",{className:"poker-card"+(A?" revealed":""),"aria-hidden":!0});const{rank:e,suit:i}=vTA(t),g=i==="hearts"||i==="diamonds";return Q.jsxs("div",{className:["poker-card",g?"poker-card--red":"",A?"revealed":""].filter(Boolean).join(" "),"aria-label":`${e} of ${i}`,children:[Q.jsx("span",{className:"poker-card__rank",children:e}),Q.jsx("span",{className:"poker-card__suit",children:_TA(i)})]})}function vTA(t){const A=String(t||"").trim().toUpperCase(),e=A.slice(0,-1),i=A.slice(-1);return{rank:e==="T"?"10":e,suit:i==="H"?"hearts":i==="D"?"diamonds":i==="C"?"clubs":"spades"}}function _TA(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function JTA({gameState:t,players:A,winners:e,hands:i,durationMs:g,meId:I}){const n=p.useRef(null),o=p.useRef(null),a=p.useRef(null),{info:r}=qr();p.useEffect(()=>{const s=n.current,B=t||{};n.current=B;const c=B?.pokerLastAction;if(c&&typeof c.seq=="number"){const Y=(Array.isArray(B?.pokerSeats)?B.pokerSeats:[]).find(O=>O.seatIndex===c.seatIndex);if(Y){const O=A.find(rA=>rA.id===Y.playerId),$=O?.name||O?.email||"Player";let gA;const z=rA=>typeof rA=="number"?`z${rA.toLocaleString("en-US")}`:"";switch((c.action||"").toLowerCase()){case"fold":gA="Fold";break;case"check":gA="Check";break;case"call":gA=`Call ${z(c.amountDelta)}`;break;case"bet":gA=`Bet ${z(c.amountDelta)}`;break;case"raise":gA=c.toBet?`Raise to ${z(c.toBet)}`:`Raise ${z(c.amountDelta)}`;break;default:gA="Action";break}const sA=`srv:${Number(B?.pokerRoundSeq||0)||0}:${c.seq}`;a.current!==sA&&(r(`${$}: ${gA}`,void 0),a.current=sA),o.current=c.seq;return}}if(!s)return;const E=s?.pokerPhase??"waiting",D=B?.pokerPhase??"waiting";if(E!==D&&E==="waiting"&&D==="pre-flop")return;const y=Array.isArray(s?.pokerSeats)?s.pokerSeats:[],S=Array.isArray(B?.pokerSeats)?B.pokerSeats:[];if(!S.length)return;const f=q=>{const Y=new Map;for(const O of q)Y.set(O.seatIndex,O);return Y},M=f(y),k=f(S),m=s?.pokerActingSeat,U=B?.pokerActingSeat,F=s?.pokerCurrentBet||0,b=B?.pokerCurrentBet||0;let K=null,R=null;for(const q of S){const Y=M.get(q.seatIndex);if(Y&&(Y.status==="active"||Y.status==="all-in")&&q.status==="folded"){K=q,R="Fold";break}}if(!R)for(const q of S){const Y=M.get(q.seatIndex);if(!Y)continue;const O=(q.committed||0)-(Y.committed||0);if(O>0){K=q,F===0?R=`Bet z${O}`:b>F?R=`Raise to z${b}`:R=`Call z${O}`;break}}if(!R&&m!=null&&U!=null&&m!==U){const q=M.get(m),Y=k.get(m);q&&Y&&q.status==="active"&&Y.status==="active"&&(q.committed||0)===(Y.committed||0)&&(K=Y,R="Check")}if(!R||!K)return;const G=A.find(q=>q.id===K.playerId),x=`${G?.name||G?.email||"Player"}: ${R}`,H=Number(B?.pokerRoundSeq||0)||0;try{const q=typeof window<"u"?window:void 0,Y=q&&q.__pokerWinnersFlashGuard;if(Y&&Y.roundSeq===H)return}catch{}const P=Number(K?.committed||0),j=`heur:${H}:${K.seatIndex}:${R}:${P}:${b}`;a.current!==j&&(r(x,void 0),a.current=j)},[t,A,r,g])}function zW({enabled:t,onComplete:A,perCardSec:e=.55,staggerSec:i=.12,origin:g,handKey:I,getTargets:n,passes:o=2}){const a=p.useRef(null),[r,s]=p.useState([]),[B,c]=p.useState(!1),E=p.useMemo(()=>{if(!a.current)return{x:0,y:0};const S=a.current.getBoundingClientRect(),f=g?.xPct??.5,M=g?.yPct??.78;return{x:S.width*f,y:S.height*M}},[g,a.current]);p.useEffect(()=>{if(!t)return;const y=a.current;if(!y||typeof window>"u")return;let S=[];if(typeof n=="function")try{S=n(y)||[]}catch{S=[]}else{const f=y.getBoundingClientRect();S=Array.from(document.querySelectorAll(".poker-room-header .avatar-ring")).map(k=>{const m=k.getBoundingClientRect();return{x:(m.left+m.right)/2-f.left,y:(m.top+m.bottom)/2-f.top}})}s(S)},[t,I,n]),p.useEffect(()=>{if(!t)return;try{ZD(["cardSwoosh"])}catch{}(async()=>{const M=await sU(["cardSwoosh"],900);c(M)})();const y=r.length*Math.max(1,o);if(y===0){const M=setTimeout(()=>A?.(),10);return()=>clearTimeout(M)}const S=(y-1)*i+e,f=setTimeout(()=>A?.(),S*1e3);return()=>clearTimeout(f)},[t,r,e,i,A,o]);const D=p.useMemo(()=>{const y=[],S=Math.max(1,o);for(let f=0;f<S;f++)for(let M=0;M<r.length;M++){const k=f*r.length+M;y.push({key:`card-${f}-${M}`,delay:k*i,to:r[M]})}return y},[r,o,i,I]);return p.useEffect(()=>{if(!t||!D.length||!B)return;const y=[],f=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)?70:0;let M=0,k=!0;for(const m of D){const U=Math.max(0,(m.delay||0)*1e3),b=Math.max(U+(k?30:0),M+f),K=window.setTimeout(()=>{try{KlA({volume:.0125})}catch{}},b);M=b,k=!1,y.push(K)}return()=>{y.forEach(m=>window.clearTimeout(m))}},[t,D,B]),!t||!B?null:Q.jsx("div",{ref:a,className:"poker-dealing-layer","aria-hidden":!0,style:{willChange:"transform, opacity"},children:D.map(y=>Q.jsx(uB.div,{className:"poker-dealing-card",initial:{x:E.x,y:E.y,opacity:0},animate:{x:y.to.x,y:y.to.y,opacity:1},transition:{duration:e,delay:y.delay,ease:"easeOut"},style:{willChange:"transform, opacity",backfaceVisibility:"hidden"}},y.key))})}function LTA({players:t,entries:A,onClose:e}){const i=ke.useCallback((n,o)=>t.find(a=>a.id===n)?.name||`Seat ${o+1}`,[t]),g=ke.useCallback(n=>{if(!n||typeof n.category!="number")return;const o=n.category|0,a=Array.isArray(n.tiebreak)?n.tiebreak:[],r=B=>"23456789TJQKA"[Math.max(0,Math.min(12,B))]||"?",s=B=>({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"})[r(B)]||r(B);switch(o){case 8:return`Straight Flush (${s(a[0]??0)} high)`;case 7:return`Four of a Kind (${s(a[0]??0)}s)`;case 6:return`Full House (${s(a[0]??0)}s over ${s(a[1]??0)}s)`;case 5:return`Flush (${[a[0],a[1],a[2],a[3],a[4]].filter(B=>B!=null).map(B=>r(B)).join("")})`;case 4:return`Straight (${s(a[0]??0)} high)`;case 3:return`Three of a Kind (${s(a[0]??0)}s)`;case 2:return`Two Pair (${s(a[0]??0)}s & ${s(a[1]??0)}s)`;case 1:return`One Pair (${s(a[0]??0)}s)`;default:return`High Card (${s(a[0]??0)})`}},[]),I=ke.useMemo(()=>[...A].sort((n,o)=>o.roundSeq-n.roundSeq),[A]);return Q.jsxs("div",{className:"results-modal","data-testid":"poker-history-modal",children:[Q.jsx("div",{className:"results-modal__backdrop",onClick:e}),Q.jsxs("div",{className:"results-modal__card card",style:{maxWidth:900},children:[Q.jsxs("div",{className:"results-modal__header",children:[Q.jsx("h3",{children:"Poker History"}),Q.jsx("button",{className:"btn btn--ghost",onClick:e,"aria-label":"Close History",children:"Close"})]}),I.length===0&&Q.jsx("div",{children:"No hands yet."}),Q.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,maxHeight:"70vh",overflow:"auto"},children:I.map(n=>Q.jsxs("div",{className:"card",style:{padding:10,background:"rgba(255,255,255,0.05)"},children:[Q.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8},children:[Q.jsxs("div",{style:{fontWeight:600},children:["Hand ",n.roundSeq]}),Q.jsxs("div",{"aria-label":"pot",children:["Pot: z",n.pot||0]})]}),Q.jsx("div",{"aria-label":"seats",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:8},children:(n.seats&&n.seats.length?n.seats:n.hands.map(o=>({playerId:o.playerId,seatIndex:o.seatIndex}))).map((o,a)=>{const r=n.winners.find(y=>y.playerId===o.playerId),s=i(o.playerId,o.seatIndex),B=!!r,c=String(o.status||"").toLowerCase()==="folded",E=g(o.rank||r?.rank),D=typeof r?.amount=="number"?r.amount:0;return Q.jsxs("div",{className:["poker-history__seat",B?"is-winner":""].filter(Boolean).join(" "),style:{padding:8,borderRadius:6,background:B?"rgba(40,180,80,0.15)":"rgba(255,255,255,0.06)"},children:[Q.jsx("div",{style:{fontWeight:600,marginBottom:4},children:s}),Q.jsx("div",{style:{fontSize:13,opacity:.9},children:c?Q.jsx("span",{children:"Folded"}):Q.jsx("span",{children:E||"—"})}),Q.jsx("div",{style:{fontSize:13,opacity:.9,marginTop:2},children:D>0?Q.jsxs("span",{children:["Winnings: z",D]}):Q.jsx("span",{children:"Winnings: z0"})})]},`s-${n.roundSeq}-${a}`)})})]},n.roundSeq))})]})]})}function qTA(){const t=p.useRef(null),A=p.useRef(!1),e=async()=>{if(!(A.current||t.current)){A.current=!0;try{"wakeLock"in navigator&&(t.current=await navigator.wakeLock.request("screen"),t.current.addEventListener("release",()=>{t.current=null}))}catch{}finally{A.current=!1}}},i=async()=>{if(t.current)try{await t.current.release(),t.current=null}catch{}};return p.useEffect(()=>{const g=()=>{document.visibilityState==="visible"&&t.current===null&&A.current};return document.addEventListener("visibilitychange",g),()=>{document.removeEventListener("visibilitychange",g),i()}},[]),{acquire:e,release:i}}const dY=["A","K","Q","J","10","9","8","7","6","5","4","3","2"],xTA={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 oIA(t){const A=String(t||"").trim().toUpperCase();if(!A)return null;const e=A.slice(0,-1),i=e==="T"?"10":e;return dY.includes(i)?i:null}function aIA(t){return t.map(oIA).filter(A=>A!==null)}function AP(t){const A=aIA(t),e={};for(const i of A)e[i]=(e[i]||0)+1;return Object.entries(e).filter(([,i])=>i>=2).map(([i])=>i)}function TTA(t){return AP(t).length>0}function YTA(t){const A=aIA(t);if(A.length===0)return null;let e=null,i=dY.length;for(const g of A){const I=dY.indexOf(g);I!==-1&&I<i&&(i=I,e=g)}return e}function HTA(t){const A=YTA(t);return A?`${xTA[A]} High`:null}function OTA(t,A){if(A<0||A>=t.length)return!1;const e=oIA(t[A]);return e?AP(t).includes(e):!1}function PTA(t){const A=[];if(!t||t.length===0)return A;TTA(t)&&A.push({label:"Paired Board",type:"paired"});const e=HTA(t);return e&&A.push({label:e,type:"high"}),A}function jTA(t){return t<0||t>4?null:t<=2?"flop":t===3?"turn":"river"}function ZTA({boardCards:t}){const A=PTA(t);return Q.jsx("div",{className:"board-badges","aria-label":"Board state indicators",children:A.map((e,i)=>Q.jsx("span",{className:`board-badge board-badge--${e.type}`,role:"status","aria-live":"polite",children:e.label},`${e.type}-${i}`))})}function WTA({winner:t,eliminatedOrder:A,finalStates:e,nameOf:i,meId:g,onDismiss:I}){const n=[];t&&n.push({playerId:t,place:1});const o=[...A].reverse();for(const r of o){const B=e[r]?.place??n.length+1;r!==t&&n.push({playerId:r,place:B})}const a=t===g;return Q.jsxs("div",{className:"elim-gameover",onClick:I,children:[Q.jsx("div",{className:"elim-gameover__title",children:a?"🏆 You Win!":"Game Over"}),Q.jsx("div",{className:"elim-gameover__subtitle",children:a?"Last player standing — champion!":t?`${i(t)} wins the tournament!`:"Tournament complete"}),Q.jsx("ol",{className:"elim-gameover__standings",children:n.map(r=>{const s=r.place===1,B=r.playerId===g,c=["elim-gameover__row",s?"elim-gameover__row--winner":"",B?"elim-gameover__row--hero":""].filter(Boolean).join(" ");return Q.jsxs("li",{className:c,children:[Q.jsx("span",{className:"elim-gameover__place-num",children:r.place===1?"🥇":r.place===2?"🥈":r.place===3?"🥉":`#${r.place}`}),Q.jsxs("span",{className:"elim-gameover__player-name",children:[i(r.playerId),B?" (You)":""]})]},r.playerId)})}),Q.jsx("button",{type:"button",className:"elim-gameover__dismiss",onClick:I,children:"OK"})]})}function VW(t){if(t==null||!t)return"";const A=["th","st","nd","rd"],e=t%100;return t+(A[(e-20)%10]||A[e]||A[0])}function zTA(t){const A=String(t||"").trim().toUpperCase(),e=A.slice(0,-1),i=A.slice(-1);return{rank:e==="T"?"10":e,suit:i==="H"?"hearts":i==="D"?"diamonds":i==="C"?"clubs":"spades"}}function VTA(t){switch(t){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function XTA({value:t,concealed:A,position:e,isPaired:i,animateEntrance:g}){if(!t)return null;const{rank:I,suit:n}=zTA(t),a=["poker-card","poker-card--board",n==="hearts"||n==="diamonds"?"poker-card--red":"",e?`poker-card--${e}`:"",i?"poker-card--paired":"",g?"poker-card--enter":""].filter(Boolean).join(" ");return Q.jsxs("div",{className:a,style:A?{visibility:"hidden"}:void 0,"aria-label":`${I} of ${n}`,children:[Q.jsx("span",{className:"poker-card__rank",children:I}),Q.jsx("span",{className:"poker-card__suit",children:VTA(n)})]})}const vw=Object.create(null),GL=Object.create(null);function eP(){const{roomId:t}=by(),{user:A,refreshUser:e}=Yi(),i=Xn(),{onHandEnd:g,isAdShowing:I}=zy(),n=String(A?.id??A?.email??""),{joinRoom:o,leaveRoom:a,connected:r,participants:s,localParticipant:B}=Xc(),c=qTA(),{active:E,fire:D,onComplete:y}=VO(),S=ke.useRef(0),f=["loss-a","loss-b","loss-c"],M=()=>{const fA=f[S.current%f.length];return S.current+=1,fA};p.useEffect(()=>{const fA=()=>{try{N2()||Cg()}catch{}};fA();const LA=["pointerdown","touchstart","mousedown","click","keydown"];return LA.forEach(Ae=>{document.addEventListener(Ae,fA,{once:!0,capture:!0})}),()=>{LA.forEach(Ae=>{document.removeEventListener(Ae,fA,{capture:!0})})}},[]);const{pokerJoinRoom:k,pokerStartHand:m,pokerCreateRoom:U,pokerFold:F,pokerCheck:b,pokerCall:K,pokerBet:R,pokerRaise:G,pokerFetchHistory:J}=OI(),x=Di(),{info:H,win:P,onIdle:j,show:q}=qr(),[Y,O]=p.useState(null);p.useEffect(()=>{const fA=Y?.gameState?.pokerPhase;return fA&&fA!=="waiting"?c.acquire():c.release(),()=>{c.release()}},[Y?.gameState,c]),p.useEffect(()=>{const fA=Y?.gameState?.pokerPhase;!fA||fA==="waiting"?MF({volume:.0125}):pd()},[Y?.gameState]);const[$,gA]=p.useState(!1),z=ke.useRef(!1),[X,sA]=p.useState(null),[rA,mA]=p.useState(!1),[IA,uA]=p.useState(!1),[KA,FA]=p.useState(!1),RA=ke.useRef(!1),MA=ke.useRef(!1),oA=ke.useRef(null);ke.useEffect(()=>{RA.current=KA},[KA]),ke.useEffect(()=>{MA.current=rA},[rA]),ke.useEffect(()=>{oA.current=X},[X]),ke.useEffect(()=>{z.current=$},[$]),ke.useEffect(()=>{(!X||X.length!==2)&&(zA.current=0)},[X]);const AA=ke.useRef(null),tA=ke.useRef(0);ke.useRef(0);const iA=ke.useRef(null),hA=ke.useRef(null),DA=ke.useRef(null),[dA,SA]=p.useState(0),[NA,OA]=p.useState(0),[Qe,nA]=p.useState([]),[eA,UA]=p.useState([]),[HA,Se]=p.useState(!1),[ne,Oe]=p.useState([]),VA=ke.useRef(0),de=ke.useRef(0),te=ke.useRef(0),WA=ke.useRef(!1),_A=ke.useRef(null),zA=ke.useRef(0),ge=ke.useRef(void 0),he=ke.useRef(0),[ve,bA]=ke.useState([]),pA=ke.useRef(0),Re=ke.useRef(0),CA=ke.useRef(0),[EA,yA]=ke.useState(!1),xA=ke.useRef(0),XA=ke.useRef(new Set),pe=ke.useRef(null),be=ke.useRef(null),[It,Ut]=p.useState(0),[pg,Ge]=p.useState(0),[lt,Rt]=ke.useState(new Set),Yt=ke.useRef([]),st=ke.useRef(null),Be=ke.useRef(0),jA=!0,[Me,We]=p.useState(!0),at=ke.useRef(0),kA=ke.useRef(null),ae=ke.useRef(null),Ye=ke.useRef(null),[Pt,jt]=p.useState(null),[aA,QA]=p.useState({}),[JA,ee]=p.useState([]),[GA,oe]=p.useState(null),[Xe,Qt]=p.useState(null);ke.useEffect(()=>{const fA=Y?.gameState;fA&&fA.pokerElimination?.enabled&&(jt({enabled:!0,startingShields:fA.pokerElimination.startingShields??3,maxTokens:fA.pokerElimination.maxTokens??3}),fA.pokerEliminationState&&QA(fA.pokerEliminationState),fA.pokerEliminatedOrder&&ee(fA.pokerEliminatedOrder))},[Y?.gameState]);const[nt,Dt]=p.useState(null),it=ke.useMemo(()=>A?A.id:"",[A]),[Mt,Zt]=p.useState(!1);p.useEffect(()=>{let fA=!0;return(async()=>{try{const{Preferences:LA}=await pi(async()=>{const{Preferences:Ee}=await Promise.resolve().then(()=>iC);return{Preferences:Ee}},void 0,import.meta.url),{value:Ae}=await LA.get({key:"onb_poker_v1"});if(!fA)return;Zt(Ae!=="1")}catch{if(!fA)return;Zt(!0)}})(),()=>{fA=!1}},[]);const Ri=ke.useCallback(()=>{(async()=>{try{const{Preferences:fA}=await pi(async()=>{const{Preferences:LA}=await Promise.resolve().then(()=>iC);return{Preferences:LA}},void 0,import.meta.url);await fA.set({key:"onb_poker_v1",value:"1"})}catch{}Zt(!1)})()},[]);ke.useEffect(()=>{let fA=!1,LA=null,Ae=null,Ee=null;const PA=xe=>{try{const Ct=xe.getBoundingClientRect();if(Ct&&isFinite(Ct.height)){const di=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 480px)").matches?85:Math.round(Ct.height);document.body.style.setProperty("--poker-header-height",`${di}px`)}}catch{}},Ke=()=>{if(fA||typeof document>"u")return;const xe=document.querySelector(".card-header.card-header--two-rows");if(xe){kA.current=xe;try{LA=new ResizeObserver(()=>PA(xe)),LA.observe(xe)}catch{Ee=()=>PA(xe),window.addEventListener("resize",Ee)}PA(xe)}};if(Ke(),!kA.current)try{Ae=window.setTimeout(Ke,0)}catch{}return()=>{fA=!0;try{document.body.style.removeProperty("--poker-header-height")}catch{}if(LA)try{LA.disconnect()}catch{}if(Ee){try{window.removeEventListener("resize",Ee)}catch{}Ee=null}if(Ae!=null){try{clearTimeout(Ae)}catch{}Ae=null}}},[]);const Ui=ke.useCallback(fA=>{try{const Ae=document.body.querySelector(`li.player--avatar[data-player-id="${fA}"]`),PA=(Ae?.querySelector(".avatar-ring")||Ae)?.getBoundingClientRect();return PA?{x:PA.left+PA.width/2,y:PA.top+PA.height/2}:null}catch{return null}},[]),qi=ke.useCallback(()=>{try{const fA=_A.current;if(!fA)return null;const LA=fA.querySelectorAll(".poker-pot-stack");if(!LA||LA.length===0){const xe=fA.getBoundingClientRect();return xe?{x:xe.left+xe.width/2,y:xe.top+xe.height/2}:null}let Ae=1/0,Ee=1/0,PA=-1/0,Ke=-1/0;return LA.forEach(xe=>{const Ct=xe.getBoundingClientRect();Ct&&(Ae=Math.min(Ae,Ct.left),Ee=Math.min(Ee,Ct.top),PA=Math.max(PA,Ct.right),Ke=Math.max(Ke,Ct.bottom))}),!isFinite(Ae)||!isFinite(Ee)||!isFinite(PA)||!isFinite(Ke)?null:{x:(Ae+PA)/2,y:(Ee+Ke)/2}}catch{return null}},[]);p.useEffect(()=>{j(()=>{try{const fA=eA||[];if(!fA.length)return;at.current=Date.now();const LA=qi();if(!LA)return;const Ae=[],Ee=Number(NA||Y?.gameState?.pokerRoundSeq||0)||Date.now();if(Ee&&pA.current===Ee)return;fA.forEach((PA,Ke)=>{const xe=Ui(PA.playerId);xe&&Ae.push({id:`poker-pot-${Ee}-${Ke}`,amount:Math.max(1,Number(PA.amount||0)),fromId:"pot",toId:PA.playerId,startX:LA.x,startY:LA.y,endX:xe.x,endY:xe.y})}),Ae.length&&(pA.current=Ee,Re.current=Ee,CA.current=Ae.length,bA(PA=>[...PA,...Ae]),We(!1))}catch{}})},[eA,NA,Y?.gameState]),p.useEffect(()=>{const fA=Y?.gameState?.pokerPhase,LA=Array.isArray(eA)&&eA.length>0&&fA!=="pre-flop"?eA.map(Ke=>String(Ke.playerId)):[],Ae=XA.current,Ee=new Set(LA),PA=(Ke,xe)=>{try{const Ct=document.querySelector(`li.player--avatar[data-player-id="${Ke}"]`);Ct&&(xe?Ct.classList.add("player--winner-shake"):Ct.classList.remove("player--winner-shake"))}catch{}};return Ae.forEach(Ke=>{Ee.has(Ke)||PA(Ke,!1)}),Ee.forEach(Ke=>{Ae.has(Ke)||PA(Ke,!0)}),XA.current=Ee,()=>{XA.current.forEach(Ke=>PA(Ke,!1)),XA.current.clear()}},[eA,Y?.gameState]),p.useEffect(()=>{try{window.__pokerRoomMounted=Date.now()}catch{}},[]),p.useEffect(()=>()=>{if(Yt.current.forEach(fA=>clearTimeout(fA)),Yt.current=[],st.current&&(clearTimeout(st.current),st.current=null),iA.current!=null&&(clearTimeout(iA.current),iA.current=null),hA.current!=null&&(clearTimeout(hA.current),hA.current=null),AA.current!=null){try{clearTimeout(AA.current)}catch{}AA.current=null}DA.current=null;try{const fA=String(t||"");if(fA&&oA.current&&oA.current.length===2){const LA=Y?.gameState||{},Ae=Number(LA?.pokerRoundSeq||zA.current||0)||0;vw[fA]={myHole:oA.current.slice(),roundSeq:Ae,first:!!IA,both:!!rA,ts:Date.now()};try{const Ee=window;Ee&&(Ee.__pokerHoleDiag=Ee.__pokerHoleDiag||[],Ee.__pokerHoleDiag.push({kind:"persist_hole_on_unmount",at:Date.now(),round:Ae}))}catch{}}}catch{}},[]),p.useEffect(()=>{const fA=String(t||"");if(fA)try{const LA=vw[fA];if(!LA)return;if(!(Date.now()-(LA.ts||0)<3e4)){delete vw[fA];return}if(Array.isArray(LA.myHole)&&LA.myHole.length===2){sA(LA.myHole.slice()),zA.current=Number(LA.roundSeq||0)||zA.current||0,LA.first&&uA(!0),LA.both&&mA(!0);try{const Ee=window;Ee&&(Ee.__pokerHoleDiag=Ee.__pokerHoleDiag||[],Ee.__pokerHoleDiag.push({kind:"restore_persisted_hole_on_mount",at:Date.now(),round:LA.roundSeq}))}catch{}}}catch{}},[t]);function ei(fA){if(!fA||typeof fA.category!="number")return;const LA=fA.category|0,Ae=Array.isArray(fA.tiebreak)?fA.tiebreak:[],Ee=Ke=>"23456789TJQKA"[Math.max(0,Math.min(12,Ke))]||"?",PA=Ke=>({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"})[Ee(Ke)]||Ee(Ke);switch(LA){case 8:return`Straight Flush (${PA(Ae[0]??0)} high)`;case 7:return`Four of a Kind (${PA(Ae[0]??0)}s)`;case 6:return`Full House (${PA(Ae[0]??0)}s over ${PA(Ae[1]??0)}s)`;case 5:return`Flush (${[Ae[0],Ae[1],Ae[2],Ae[3],Ae[4]].filter(Ke=>Ke!=null).map(Ke=>Ee(Ke)).join("")})`;case 4:return`Straight (${PA(Ae[0]??0)} high)`;case 3:return`Three of a Kind (${PA(Ae[0]??0)}s)`;case 2:return`Two Pair (${PA(Ae[0]??0)}s & ${PA(Ae[1]??0)}s)`;case 1:return`One Pair (${PA(Ae[0]??0)}s)`;default:return`High Card (${PA(Ae[0]??0)})`}}p.useEffect(()=>{if(!t)return;let fA=!1;const LA=k,Ae=e;return(async()=>{if(pe.current!==t&&!(Y&&Y.id===t))try{const Ee=GL[t]||(async()=>LA(t))();GL[t]=Ee;const PA=await Ee;if(!fA&&PA?.ok){pe.current=t,O(PA.room);try{o&&be.current!==t&&(await Promise.resolve(o(t)),be.current=t)}catch{}try{await Ae()}catch{}}else if(!fA&&PA&&!PA.ok)try{H("Poker",PA.error||"Failed to join room")}catch{}}catch{}finally{delete GL[t]}})(),()=>{fA=!0,pe.current===t&&(pe.current=null),a&&be.current===t&&(be.current=null,a().catch(()=>{}))}},[t]);const yt=ke.useCallback((fA,LA)=>{if(!fA||fA.id&&LA?.id&&fA.id!==LA.id)return LA;try{const Ae=Array.isArray(fA.players)?fA.players:[],Ee=Array.isArray(LA?.players)?LA.players:[];if(Ee.length===0&&Ae.length>0)return{...fA,...LA,players:Ae};const PA=Ee.map(Ke=>{const xe=Ae.find(Ct=>String(Ct.id)===String(Ke.id));return xe?{...xe,...Ke}:Ke});return{...fA,...LA,players:PA}}catch{return LA||fA}},[]);$n({onJoinedRoom:({room:fA})=>{try{if(fA&&fA.id===t){O(LA=>LA&&LA.id===fA.id?yt(LA,fA):fA),pe.current=t||null;try{const LA=fA?.gameState;if(!z.current&&LA&&typeof LA.pokerPhase=="string"&&LA.pokerPhase.length>0){gA(!0);const Ae=LA.pokerPhase;Ae&&Ae!=="pre-flop"&&Ae!=="waiting"&&FA(!1)}}catch{}}}catch{}},onRejoinedRoom:({room:fA})=>{try{if(fA&&fA.id===t){O(LA=>LA&&LA.id===fA.id?yt(LA,fA):fA),pe.current=t||null,FA(!1);try{const LA=fA?.gameState;!z.current&&LA&&typeof LA.pokerPhase=="string"&&LA.pokerPhase.length>0&&gA(!0)}catch{}}}catch{}},onOtherPlayerJoined:({room:fA})=>{try{fA&&fA.id===t&&O(LA=>LA&&LA.id===fA.id?yt(LA,fA):fA)}catch{}},onOtherLeft:({room:fA})=>{try{fA&&fA.id===t&&O(LA=>LA&&LA.id===fA.id?yt(LA,fA):fA)}catch{}},onPlayerBalanceUpdated:({playerId:fA,balance:LA})=>{O(Ae=>{if(!Ae||!Array.isArray(Ae.players))return Ae;const Ee=Ae.players.findIndex(xe=>String(xe.id)===String(fA));if(Ee===-1)return Ae;const PA=Ae.players.slice(),Ke=PA[Ee];return typeof Ke?.balance=="number"&&Ke.balance===LA?Ae:(PA[Ee]={...Ke,balance:LA},{...Ae,players:PA})})},onPokerMyBalance:({roomId:fA,seatIndex:LA,stack:Ae,committed:Ee})=>{fA===t&&O(PA=>{if(!PA||!PA.gameState)return PA;const Ke=Array.isArray(PA.gameState.pokerSeats)?[...PA.gameState.pokerSeats]:[],xe=Ke.findIndex(hi=>hi?.seatIndex===LA);if(xe===-1)return PA;const Ct=Ke[xe];return Ct.stack===Ae&&Ct.committed===Ee?PA:(Ke[xe]={...Ct,stack:Ae,committed:Ee},{...PA,gameState:{...PA.gameState,pokerSeats:Ke}})})},onRoomUpdateState:fA=>{if(!fA||fA.roomId!==t)return;if(fA.myHole&&Array.isArray(fA.myHole)&&fA.myHole.length===2){const PA=Number(fA?.room?.gameState?.pokerRoundSeq||0);if(!oA.current||oA.current.length!==2||zA.current&&zA.current!==PA){sA(fA.myHole),PA>0&&(zA.current=PA),tA.current=Date.now();try{const xe=typeof window<"u"?window:void 0;xe&&(xe.__pokerHoleDiag=xe.__pokerHoleDiag||[],xe.__pokerHoleDiag.push({kind:"hole_from_state",at:Date.now(),round:PA}))}catch{}const Ke=fA?.room?.gameState?.pokerPhase;!RA.current&&Ke!=="pre-flop"&&(uA(!0),setTimeout(()=>mA(!0),180))}}O(PA=>{try{const Ke=fA?.room,xe=Ke?.gameState;if(!PA||PA.id&&PA.id!==fA.roomId)return Ke&&Ke.id===fA.roomId?Ke:PA;let Ct=xe?{...PA,gameState:xe}:{...PA};return Ke&&Ke.id===PA.id&&(Ct=yt(Ct,Ke),xe&&(Ct.gameState=xe)),Ct}catch{return PA}});try{const PA=fA?.room?.gameState;!z.current&&PA&&typeof PA.pokerPhase=="string"&&PA.pokerPhase.length>0&&gA(!0)}catch{}const LA=fA?.room?.gameState?.pokerPhase,Ae=Number(fA?.room?.gameState?.pokerRoundSeq||0),Ee=ge.current;if(ge.current=LA,(LA||"")==="pre-flop"){const PA=Ae>0&&Ae!==VA.current&&Ae!==de.current,Ke=!Ee||["waiting","showdown","complete"].includes(String(Ee));if(PA&&Ke){if(mA(!1),uA(!1),oA.current&&oA.current.length===2)if(zA.current===0){zA.current=Ae;try{const Ct=typeof window<"u"?window:void 0;Ct&&(Ct.__pokerHoleDiag=Ct.__pokerHoleDiag||[],Ct.__pokerHoleDiag.push({kind:"assign_hole_round_on_preflop",at:Date.now(),round:Ae}))}catch{}}else if(zA.current!==Ae){sA(null);try{const Ct=String(t||"");Ct&&delete vw[Ct]}catch{}try{const Ct=typeof window<"u"?window:void 0;Ct&&(Ct.__pokerHoleDiag=Ct.__pokerHoleDiag||[],Ct.__pokerHoleDiag.push({kind:"clear_hole_new_round",at:Date.now(),toRound:Ae,prevHoleRound:zA.current}))}catch{}}else try{const Ct=typeof window<"u"?window:void 0;Ct&&(Ct.__pokerHoleDiag=Ct.__pokerHoleDiag||[],Ct.__pokerHoleDiag.push({kind:"keep_hole_new_round",at:Date.now(),round:Ae}))}catch{}else zA.current=0;de.current=Ae,Be.current=Date.now(),SA(Ae);try{ZD(["cardSwoosh"])}catch{}const xe=he.current!==Ae;xe&&(he.current=Ae),(async()=>{if(await sU(["cardSwoosh"],900),FA(!0),xe)try{Mx({volume:.6})}catch{}})()}else if(PA&&!Ke)try{const xe=window;xe&&(xe.__pokerHoleDiag=xe.__pokerHoleDiag||[],xe.__pokerHoleDiag.push({kind:"skip_preflop_midhand",at:Date.now(),round:Ae,prevPhase:Ee}))}catch{}OA(0),nA([]),UA([]),We(!0)}else if((LA||"")==="waiting"){if(mA(!1),uA(!1),FA(!1),AA.current!=null){try{clearTimeout(AA.current)}catch{}AA.current=null}SA(PA=>PA+1),de.current=0,oA.current||(zA.current=0);try{const PA=String(t||"");PA&&!oA.current&&delete vw[PA]}catch{}}},onPokerMyHole:fA=>{if(!(!fA||fA.roomId!==t)&&Array.isArray(fA.hole)&&fA.hole.length===2){sA(fA.hole);try{const Ee=Y?.gameState||{},PA=Number(Ee?.pokerRoundSeq||0);PA>0&&(zA.current=PA)}catch{}tA.current=Date.now();try{const Ee=typeof window<"u"?window:void 0;Ee&&(Ee.__pokerHoleDiag=Ee.__pokerHoleDiag||[],Ee.__pokerHoleDiag.push({kind:"hole",at:Date.now(),phase:Y?.gameState?.pokerPhase,dealing:RA.current,round:Number(Y?.gameState?.pokerRoundSeq||0)}))}catch{}const Ae=(Y?.gameState?.pokerPhase||"")==="pre-flop";if(z.current)if(!KA&&!Ae)uA(!0),setTimeout(()=>mA(!0),180);else{if(AA.current!=null){try{clearTimeout(AA.current)}catch{}AA.current=null}try{AA.current=window.setTimeout(()=>{if(MA.current||!oA.current||oA.current.length!==2)return;const Ee=Date.now();if(RA.current&&Ee-(tA.current||Ee)>3e3&&FA(!1),!z.current&&Ee-(tA.current||Ee)<4e3){try{AA.current=window.setTimeout(()=>{},500)}catch{}return}uA(!0),mA(!0);try{const Ke=typeof window<"u"?window:void 0;Ke&&(Ke.__pokerHoleDiag=Ke.__pokerHoleDiag||[],Ke.__pokerHoleDiag.push({kind:"fallback_reveal",at:Ee}))}catch{}},1800)}catch{}}}},onPokerRevealAll:fA=>{if(!fA||fA.roomId!==t)return;const LA=Number(fA?.roundSeq||0),Ae=Number(Y?.gameState?.pokerRoundSeq||0);if(LA&&Ae){const Ee=LA===Ae,PA=Ae===LA+1;if(!Ee&&!PA)return}if(!(NA&&NA===LA)&&Array.isArray(fA.hands)){nA(fA.hands.filter(PA=>Array.isArray(PA?.hole)&&PA.hole.length===2)),OA(LA||Ae||Date.now());const Ee=Array.isArray(eA)&&eA.length>0?eA:[];if((LA||Ae)&&Ee.length>0){const PA=Number(LA||Ae),xe=Ee.reduce((Ct,hi)=>Ct+(Number(hi.amount)||0),0)||Number(Y?.gameState?.wagerPool?.totalAmount||0)||0;Oe(Ct=>{const hi=Ct.findIndex(li=>li.roundSeq===PA),di={roundSeq:PA,ts:Date.now(),winners:Ee.slice(),hands:(fA.hands||[]).slice(),pot:xe,seats:Array.isArray(Y?.gameState?.pokerSeats)?Y.gameState.pokerSeats.map(li=>({playerId:li.playerId,seatIndex:li.seatIndex,status:li.status,rank:Ee.find(_g=>_g.playerId===li.playerId)?.rank||void 0,winnings:Ee.find(_g=>_g.playerId===li.playerId)?.amount})):void 0};if(hi>=0){const li=Ct.slice();return li[hi]=di,li}return[...Ct,di].slice(-20)})}}},onPokerWinners:fA=>{if(!fA||fA.roomId!==t)return;const LA=Number(fA?.roundSeq||0),Ae=Number(Y?.gameState?.pokerRoundSeq||0);if(LA&&Ae){const PA=LA===Ae,Ke=Ae===LA+1;if(!PA&&!Ke)return}NA&&NA===LA?UA(PA=>PA.length?PA:Array.isArray(fA.winners)?fA.winners:[]):(UA(Array.isArray(fA.winners)?fA.winners:[]),NA||OA(LA||Ae||Date.now()));try{const PA=Number(LA||Ae||0)||0;if(PA&&te.current!==PA){const Ke=Array.isArray(fA.winners)?fA.winners:[],Ct=Ke.slice().sort((li,_g)=>String(li.playerId).localeCompare(String(_g.playerId))).map(li=>`${li.playerId}:${Number(li.amount)||0}:${Number(li.seatIndex)||0}:${li.rank&&Number(li.rank.category)||-1}`).join("|"),hi=typeof window<"u"?window:void 0,di=hi&&hi.__pokerWinnersFlashGuard;if(!di||di.roundSeq!==PA||di.content!==Ct){const li=Ke.find(vn=>vn&&vn.rank&&typeof vn.rank.category=="number"),_g=ei(li?.rank),Ma=Ke.reduce((vn,Or)=>vn+(Number(Or.amount)||0),0)||Number(Y?.gameState?.wagerPool?.totalAmount||0)||0,$o=Ma>0?`Pot: z${Ma}`:void 0,mo=[_g,$o].filter(Boolean).join(" ");hi&&(hi.__pokerWinnersFlashGuard={roundSeq:PA,content:Ct,at:Date.now()});try{hi&&(hi.__pokerWinnersFlashed=!0)}catch{}const Il=String(A?.id??A?.email??"");if(Ke.some(vn=>String(vn.playerId)===Il)){const vn=Ke.find(io=>String(io.playerId)===Il),Or=Number(vn?.amount||0),kC=Or>0?`You won: z${Or}`:"You won!";try{q({kind:"win",title:kC,subtitle:mo,duration:4e3})}catch{}try{Nx()}catch{}try{hi&&(hi.__E2E===!0||(hi.location?.search||"").includes("e2e=1"))&&(hi.__pokerWinnersFlashed={title:kC,subtitle:mo,roundSeq:PA,at:Date.now(),__viaServer:!0})}catch{}try{const io=vn?.rank?.category??li?.rank?.category,Fu=vn?.rank?.tiebreak??li?.rank?.tiebreak??[];typeof io=="number"?io===8&&Fu[0]===12?D("royal-flush",{displayMs:4e3}):io===8?D("straight-flush",{displayMs:3500}):io===7?D("quads",{displayMs:3e3}):io===6?D("full-house",{displayMs:2500}):io===5?D("flush",{displayMs:2500}):io===4&&D("straight",{displayMs:2500}):Ke.length===1&&!li&&D("poker-bluff",{displayMs:2500})}catch{}}te.current=PA}}}catch{}try{const PA=String(A?.id??A?.email??""),Ke=Array.isArray(fA.winners)?fA.winners:[];if(!Ke.some(Ct=>String(Ct.playerId)===PA)){let Ct=0;const di=(Array.isArray(Y?.gameState?.pokerSeats)?Y.gameState.pokerSeats:[]).find(mo=>String(mo.playerId||"")===PA),li=Number(di?.committed||0),_g=Number(di?.returned||0);li>0&&(Ct=Math.max(0,li-(Number.isFinite(_g)?_g:0)));const Xo=Ke.find(mo=>mo&&mo.rank&&typeof mo.rank.category=="number"),Ma=Xo?`Winner: ${ei(Xo.rank)}`:void 0,$o=Ct>0?`You lost: z${Ct}`:"You lost";try{j(()=>{try{q({kind:"lose",title:$o,subtitle:Ma})}catch{}try{Gx()}catch{}try{D(M(),{displayMs:2e3})}catch{}})}catch{}}}catch{}try{const PA=Number(LA||Ae||0);PA&&xA.current!==PA&&(xA.current=PA,yA(!0),setTimeout(()=>yA(!1),5200))}catch{}const Ee=Array.isArray(Qe)&&Qe.length>0?Qe:[];if((LA||Ae)&&Ee.length>0){const PA=Number(LA||Ae),Ke=Array.isArray(fA.winners)?fA.winners:[],Ct=Ke.reduce((hi,di)=>hi+(Number(di.amount)||0),0)||Number(Y?.gameState?.wagerPool?.totalAmount||0)||0;Oe(hi=>{const di=hi.findIndex(_g=>_g.roundSeq===PA),li={roundSeq:PA,ts:Date.now(),winners:Ke.slice(),hands:Ee.slice(),pot:Ct,seats:Array.isArray(Y?.gameState?.pokerSeats)?Y.gameState.pokerSeats.map(_g=>({playerId:_g.playerId,seatIndex:_g.seatIndex,status:_g.status,rank:Ke.find(Xo=>Xo.playerId===_g.playerId)?.rank||void 0,winnings:Ke.find(Xo=>Xo.playerId===_g.playerId)?.amount})):void 0};if(di>=0){const _g=hi.slice();return _g[di]=li,_g}return[...hi,li].slice(-20)})}try{g()}catch{}},onPokerTimedOut:fA=>{try{if(!fA||fA.roomId!==t)return;const LA=String(A?.id??A?.email??"");if(fA.playerId!==LA)return;const Ae=fA.action==="check"?"auto-check":"auto-fold";Hr(`🕒 Timed out — ${Ae}`)}catch{}}}),p.useEffect(()=>{if(!i||!t)return;const fA=Ee=>{Ee.roomId===t&&(eo(Ee.readyPlayers||[]),DC(Ee.requiredPlayers||[]),Ee.allReady&&(tn(!1),Ut(0)))},LA=Ee=>{Ee.roomId===t&&(Ut(Ee.endsAt),eo(Ee.readyPlayers||[]),DC(Ee.requiredPlayers||[]))},Ae=Ee=>{Ee.roomId===t&&(Ut(0),Ge(0))};return i.on("poker:start_ready_update",fA),i.on("poker:start_countdown",LA),i.on("poker:start_countdown_cancelled",Ae),()=>{i.off("poker:start_ready_update",fA),i.off("poker:start_countdown",LA),i.off("poker:start_countdown_cancelled",Ae)}},[i,t]),p.useEffect(()=>{if(!i||!t)return;const fA=PA=>{PA?.roomId===t&&(PA.config&&jt({enabled:!0,startingShields:PA.config.startingShields??3,maxTokens:PA.config.maxTokens??3}),PA.states&&QA(PA.states),PA.eliminatedOrder&&ee(PA.eliminatedOrder))},LA=PA=>{if(PA?.roomId!==t)return;const Ke=PA.place??"";if(PA.playerId===it)try{q({kind:"lose",title:"Eliminated!",subtitle:`You finished in ${VW(Ke)} place`,duration:4e3})}catch{}},Ae=PA=>{if(PA?.roomId===t&&PA.playerId&&PA.playerId!==it){const Ke=Y?.players?.find(xe=>xe.id===PA.playerId)?.name||"A player";Qt({text:`${Ke} eliminated!`,sub:PA.place?`${VW(PA.place)} place`:void 0}),setTimeout(()=>Qt(null),3e3)}},Ee=PA=>{if(PA?.roomId===t){oe({winner:PA.winner,eliminatedOrder:PA.eliminatedOrder||[],finalStates:PA.finalStates||{}});try{PA.winner===it?Nx():Gx()}catch{}}};return i.on("poker:elimination_update",fA),i.on("poker:eliminated",LA),i.on("poker:player_eliminated",Ae),i.on("poker:elimination_gameover",Ee),()=>{i.off("poker:elimination_update",fA),i.off("poker:eliminated",LA),i.off("poker:player_eliminated",Ae),i.off("poker:elimination_gameover",Ee)}},[i,t,it,Y?.players]);const Si=ke.useRef(0);p.useEffect(()=>{if(!i||!it)return;const fA=LA=>{!LA||LA.winner?.userId!==it||Dt({winnerUserId:it,bonus:LA.bonus??0})};return i.on("poker:last_man_standing",fA),()=>{i.off("poker:last_man_standing",fA)}},[i,it]),p.useEffect(()=>{const fA=Y?.gameState;if(!fA||!it)return;const LA=fA.pokerPhase;if(LA!=="complete"&&LA!=="waiting")return;const Ee=(Array.isArray(fA.pokerSeats)?fA.pokerSeats.filter(Ke=>!!Ke?.playerId):[]).filter(Ke=>(Ke.stack??0)>0);if(Ee.length!==1||Ee[0].playerId!==it)return;const PA=Number(fA.pokerRoundSeq||0);PA<=0||PA===Si.current||(Si.current=PA,Dt({winnerUserId:it,bonus:0}))},[Y?.gameState,it]),p.useEffect(()=>{if(!It||It<=Date.now()){Ge(0);return}const fA=()=>{const Ae=Math.max(0,Math.ceil((It-Date.now())/1e3));Ge(Ae),Ae<=0&&Ut(0)};fA();const LA=setInterval(fA,1e3);return()=>clearInterval(LA)},[It]);const ti=ke.useRef("waiting");p.useEffect(()=>{const fA=Y?.gameState?.pokerPhase||"waiting",LA=ti.current;ti.current=fA;const Ae=!["waiting","complete"].includes(fA),Ee=!["waiting","complete"].includes(LA);return(Ae||fA==="waiting"&&Ee)&&(eo([]),DC([]),Ut(0),Ge(0),tn(!1)),Ee&&!Ae?(Ng(!0),clearTimeout(lI.current),lI.current=setTimeout(()=>Ng(!1),1500)):Ae&&(clearTimeout(lI.current),Ng(!1)),()=>clearTimeout(lI.current)},[Y?.gameState?.pokerPhase]),p.useEffect(()=>{const fA=Y?.gameState;if(!fA)return;const LA=fA?.pokerPhase,Ae=Number(fA?.pokerRoundSeq||0);if((LA||"")==="pre-flop"&&Ae>0&&Ae!==VA.current&&Ae!==de.current){if(mA(!1),uA(!1),oA.current&&oA.current.length===2)if(zA.current===0){zA.current=Ae;try{const PA=typeof window<"u"?window:void 0;PA&&(PA.__pokerHoleDiag=PA.__pokerHoleDiag||[],PA.__pokerHoleDiag.push({kind:"assign_hole_round_on_initial_preflop",at:Date.now(),round:Ae}))}catch{}}else if(zA.current!==Ae){sA(null);try{const PA=typeof window<"u"?window:void 0;PA&&(PA.__pokerHoleDiag=PA.__pokerHoleDiag||[],PA.__pokerHoleDiag.push({kind:"clear_hole_initial_preflop",at:Date.now(),toRound:Ae,prevHoleRound:zA.current}))}catch{}}else try{const PA=typeof window<"u"?window:void 0;PA&&(PA.__pokerHoleDiag=PA.__pokerHoleDiag||[],PA.__pokerHoleDiag.push({kind:"keep_hole_initial_preflop",at:Date.now(),round:Ae}))}catch{}else zA.current=0;de.current=Ae,Be.current=Date.now(),SA(Ae);try{ZD(["cardSwoosh"])}catch{}const Ee=he.current!==Ae;Ee&&(he.current=Ae),(async()=>{if(await sU(["cardSwoosh"],900),FA(!0),Ee)try{Mx({volume:.6})}catch{}})()}},[Y?.gameState]),ke.useEffect(()=>{try{const fA=typeof window<"u"?window:void 0;if(!(!!fA&&(fA.__E2E===!0||typeof fA.location?.search=="string"&&fA.location.search.includes("e2e=1")||fA.sessionStorage&&fA.sessionStorage.getItem("e2e")==="1")))return;const Ae=(t||"").startsWith("e2e-"),Ee=!Y||!Y.gameState||!Array.isArray(Y.gameState.pokerSeats);if(!Ae||!Ee||WA.current)return;WA.current=!0;try{window.__pokerFallbackArmed=Date.now()}catch{}const PA=setTimeout(()=>{try{const Ke=Date.now()%1e5,xe={playerId:String(it||n||"hero"),seatIndex:0,amount:120,rank:{category:1,tiebreak:[12,7,5,4,2]}},Ct=[{playerId:String(it||n||"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"]}];UA([xe]),nA(Ct),OA(Ke);const hi=`You: +z${Number(xe.amount||0)}`,di=`Pot: z${Number(xe.amount||0)}`,li=`${ei(xe.rank)} ${di}`;try{window.__pokerWinnersFlashed={title:hi,subtitle:li,roundSeq:Ke,at:Date.now(),__fallback:!0}}catch{}try{window.__pokerFallbackFired=Date.now()}catch{}}catch{}},5500);return()=>clearTimeout(PA)}catch{}},[]),ke.useEffect(()=>{try{const fA=typeof window<"u"?window:void 0;if(!(!!fA&&(fA.__E2E===!0||typeof fA.location?.search=="string"&&fA.location.search.includes("e2e=1")||fA.sessionStorage&&fA.sessionStorage.getItem("e2e")==="1")))return;const Ae=setTimeout(()=>{try{if(window.__pokerWinnersFlashed)return;const Ee=Date.now()%1e5,PA={playerId:String(it||n||"hero"),seatIndex:0,amount:80,rank:{category:1,tiebreak:[11,9,6,4,2]}},Ke=[{playerId:String(it||n||"hero"),seatIndex:0,hole:["As","Ad"]}];UA([PA]),nA(Ke),OA(Ee);const xe=`You: +z${Number(PA.amount||0)}`,Ct=`Pot: z${Number(PA.amount||0)}`,hi=`${ei(PA.rank)} ${Ct}`;try{window.__pokerWinnersFlashed={title:xe,subtitle:hi,roundSeq:Ee,at:Date.now(),__safety:!0}}catch{}}catch{}},1e4);return()=>clearTimeout(Ae)}catch{}},[P,it,n]),p.useEffect(()=>{const fA=Y?.gameState?.pokerPhase,LA=["flop","turn","river","showdown"].includes(fA||"");$&&LA&&X&&X.length===2&&!rA&&!KA&&(uA(!0),mA(!0))},[Y?.gameState,X,rA,KA,$]),p.useEffect(()=>{const LA=(Y?.gameState?.pokerPhase||"")==="pre-flop";if($&&LA&&!KA&&X&&X.length===2&&!rA){uA(!0);const Ae=setTimeout(()=>mA(!0),220);return()=>clearTimeout(Ae)}},[KA,Y?.gameState,X,rA,$]),p.useEffect(()=>{if(!$||!X||X.length!==2||rA)return;const fA=setTimeout(()=>{!MA.current&&oA.current&&oA.current.length===2&&(uA(!0),setTimeout(()=>mA(!0),180))},300);return()=>clearTimeout(fA)},[$,X,rA]),p.useEffect(()=>()=>{zA.current=0},[]);const Xg=Y?.name||"Poker Room",cI=p.useMemo(()=>(Array.isArray(Y?.players)?Y.players:[]).map(LA=>({id:String(LA.id??""),name:String(LA.name||LA.email||LA.id||""),balance:typeof LA.balance=="number"?LA.balance:0,avatarUrl:LA.avatarUrl||void 0})),[Y?.players]);ke.useCallback((fA,LA)=>cI.find(Ae=>Ae.id===fA)?.name||`Seat ${LA+1}`,[cI]);const bg=p.useMemo(()=>Y?.gameState?Y.gameState:{gameMode:"poker",roundSeq:1},[Y?.gameState]);JTA({gameState:bg,players:cI,winners:eA,hands:Qe,meId:it});const[yo]=p.useState(()=>Date.now()),ci=p.useMemo(()=>{const fA=Y?.gameState?.pokerPhase;return fA==="pre-flop"||fA==="flop"||fA==="turn"||fA==="river"||fA==="showdown"},[Y?.gameState]),vg=Number(Y?.gameState?.pokerUiLockedUntilTs||0),Zg=vg>0&&Date.now()<vg,fg=7e3,kg=ke.useRef(null);ke.useEffect(()=>{const fA=String(Y?.gameState?.pokerPhase||"");Zg?kg.current==null&&(kg.current=Date.now()):fA==="waiting"&&(kg.current=null)},[Zg,Y?.gameState]);const Qn=kg.current??(Be.current||0),fI=Qn>0?Date.now()-Qn:Number.POSITIVE_INFINITY,Ao=Zg&&fI<=fg,[,wa]=ke.useReducer(fA=>fA+1,0);ke.useEffect(()=>{if(!Zg)return;const fA=Qn>0?Qn+fg:Number.POSITIVE_INFINITY,LA=vg>0?vg:Number.POSITIVE_INFINITY,Ae=Math.min(fA,LA);if(!isFinite(Ae))return;const Ee=Math.max(0,Math.min(15e3,Math.ceil(Ae-Date.now()+2))),PA=window.setTimeout(()=>{try{wa()}catch{}},Ee);return()=>{window.clearTimeout(PA)}},[Zg,vg,Qn,fg]);const sr=p.useMemo(()=>{const fA=Y?.gameState||{},LA=fA?.pokerPhase||"",Ae=Array.isArray(fA?.pokerCommunity)?fA.pokerCommunity:[];return LA==="flop"?Ae.length>=3&&![0,1,2].some(Ee=>lt.has(Ee)):LA==="turn"?Ae.length>=4&&!lt.has(3):LA==="river"?Ae.length>=5&&!lt.has(4):!0},[Y?.gameState,lt]),Ds=Y?.gameState?.pokerPhase||"",ce=["showdown","complete"].includes(Ds),ze=Date.now()-yo<800||!ci||KA||Ao||!sr||ce,{isBettingStreet:At,isHeroTurn:ZA,heroStatus:Le,toCall:$e,canCheck:Nt,canCall:wi,canBet:Mg,canRaise:en,showActions:So,minRaiseTo:ma,currentBet:zo,heroStack:$g,turnDeadlineTs:FB}=p.useMemo(()=>{const fA=Y?.gameState||{},LA=fA?.pokerPhase||"",Ae=["pre-flop","flop","turn","river"].includes(LA),PA=(Array.isArray(fA?.pokerSeats)?fA.pokerSeats:[]).find(Or=>String(Or.playerId)===String(it)),Ke=typeof fA?.pokerActingSeat=="number"?fA.pokerActingSeat:void 0,xe=!!PA&&typeof Ke=="number"&&PA.seatIndex===Ke,Ct=Number(fA?.pokerCurrentBet||0),hi=Number(PA?.committed||0),di=Number(PA?.stack||0),li=String(PA?.status||"active"),_g=Math.max(0,Ct-hi),Xo=_g===0&&li==="active",Ma=_g>0&&li==="active"&&di>0,$o=Ct===0&&li==="active"&&di>0,mo=Ct>0&&li==="active"&&di>0,Il=Ae&&!!PA&&li==="active",to=Number(fA?.pokerMinRaiseTo||0),vn=Number(fA?.pokerTurnDeadlineTs||0)||void 0;return{isBettingStreet:Ae,isHeroTurn:xe,heroStatus:li,toCall:_g,canCheck:Xo,canCall:Ma,canBet:$o,canRaise:mo,showActions:Il,minRaiseTo:to,currentBet:Ct,heroStack:di,turnDeadlineTs:vn}},[Y?.gameState,it]),DI=ze||!ZA||Le!=="active",[ka,Ng]=p.useState(!1),lI=ke.useRef(void 0),wo=p.useMemo(()=>{const fA=Y?.gameState||{},LA=fA?.pokerPhase||"waiting",Ae=Array.isArray(fA?.pokerSeats)?fA.pokerSeats:[];return["waiting","complete"].includes(LA)&&Ae.length>=2&&!KA&&!Ao&&!!t&&!I&&!ka},[Y?.gameState,KA,Ao,t,I,ka]),[bn,tn]=p.useState(!1),Tr=p.useMemo(()=>{if(!t||!Y?.singlePlayer)return!1;const fA=Y?.gameState||{},LA=fA?.pokerPhase||"waiting";if(LA!=="waiting"&&LA!=="complete")return!1;const Ae=Array.isArray(fA?.pokerSeats)?fA.pokerSeats.filter(PA=>!!PA?.playerId):[],Ee=Ae.find(PA=>String(PA.playerId||"")===it);return!!(Ae.length<=1&&Ee||!Ee||Ee&&Number(Ee.stack||0)===0)},[Y?.gameState,Y?.singlePlayer,t,it]),[Dg,En]=p.useState(!1),[Vo,eo]=p.useState([]),[Al,DC]=p.useState([]),ys=p.useMemo(()=>Vo.includes(it),[Vo,it]),Yr=ke.useCallback(()=>{iA.current!=null&&(clearTimeout(iA.current),iA.current=null),hA.current!=null&&(clearTimeout(hA.current),hA.current=null),DA.current=null},[]),[el,tl]=p.useState(0),EI=el,[GQ,yC]=p.useState(!1),[SC,wC]=p.useState(null),RQ=it,il=!!ci&&!KA&&!(Array.isArray(Qe)&&Qe.length>0),[bB,Mu]=p.useState({active:!1,key:0,indices:[]}),vB=ke.useRef(0);p.useEffect(()=>{const LA=(Array.isArray(Y?.gameState?.pokerCommunity)?Y.gameState.pokerCommunity:[]).length,Ae=vB.current;if(LA>Ae){const Ee=Array.from({length:LA-Ae},(PA,Ke)=>Ae+Ke);Rt(PA=>{const Ke=new Set(PA);return Ee.forEach(xe=>Ke.add(xe)),Ke}),st.current&&(clearTimeout(st.current),st.current=null),st.current=window.setTimeout(()=>{Mu({active:!0,key:Date.now(),indices:Ee}),st.current=null},3e3),vB.current=LA}else vB.current=LA},[Y?.gameState]),ke.useEffect(()=>{const fA=Ye.current;if(!fA)return;fA.style.marginTop=fA.style.marginTop==="0px"?"0.01px":"0px";const LA=window.setTimeout(()=>{fA&&(fA.style.marginTop="")},0);return()=>window.clearTimeout(LA)},[KA,rA,IA,GQ]);const _B=(fA,LA)=>{!fA&&LA&&H("Poker",LA)},Nu=async()=>{if(!t)return;Yr();const fA=await b(t);_B(fA?.ok,fA?.error)},Gu=async()=>{if(!t)return;Yr();const fA=await K(t);_B(fA?.ok,fA?.error)},Ep=async()=>{if(!t)return;Yr();const fA=await F(t);_B(fA?.ok,fA?.error)},gl=()=>{DI||!Mg||(wC("bet"),yC(!0))},Ru=()=>{DI||!en||(wC("raise"),yC(!0))},Uu=async fA=>{if(!t||!SC)return;Yr();let LA=fA??EI;if(SC==="bet"){(!LA||LA<=0)&&(LA=Math.max(1,ma||1));const Ae=Math.floor(LA),Ee=await R(t,Ae);_B(Ee?.ok,Ee?.error),Ee?.ok&&(tl(0),yC(!1),wC(null))}else if(SC==="raise"){if(!LA||LA<=0){const PA=Math.max(0,ma-zo);LA=Math.max(1,PA)}LA=Math.min(LA,Math.max(0,$g));const Ae=Math.floor(LA),Ee=await G(t,Ae);_B(Ee?.ok,Ee?.error),Ee?.ok&&(tl(0),yC(!1),wC(null))}},up=()=>{tl(0),yC(!1),wC(null)},[mC,Ku]=ke.useState(null),Hr=ke.useCallback(fA=>{try{const LA=Ui(it);LA&&Ku({x:LA.x,y:Math.max(0,LA.y-70),text:fA});const Ae=document.querySelector(`li.player--avatar[data-player-id="${it}"]`);Ae&&(Ae.classList.add("player--timeout"),setTimeout(()=>{try{Ae.classList.remove("player--timeout")}catch{}},2500)),setTimeout(()=>Ku(null),2600)}catch{}},[Ui,it]);p.useEffect(()=>{(DI||!So)&&(yC(!1),wC(null),tl(0))},[DI,So]);const JB=ke.useRef(0);return p.useEffect(()=>{const fA=Y?.gameState;if(!fA)return;const LA=fA?.pokerLastAction;if(!LA||typeof LA.seq!="number"||JB.current===LA.seq)return;const Ae=String(LA.action||"").toLowerCase();if(!["bet","raise","call"].includes(Ae)){JB.current=LA.seq;return}const Ee=Math.max(0,Number(LA.amountDelta||0));if(Ee<=0){JB.current=LA.seq;return}const Ke=(Array.isArray(fA?.pokerSeats)?fA.pokerSeats:[]).find(Ct=>Ct.seatIndex===LA.seatIndex),xe=Ke?.playerId?String(Ke.playerId):void 0;j(()=>{try{const Ct=qi();if(!Ct)return;const hi=xe?Ui(xe):null;if(!hi)return;const di=`poker-commit-${LA.seq}-${xe||LA.seatIndex}-${Date.now()}`;bA(li=>[...li,{id:`${di}-to-pot`,amount:Ee,fromId:xe||`seat:${LA.seatIndex}`,toId:"pot",startX:hi.x,startY:hi.y,endX:Ct.x,endY:Ct.y,startDelaySec:.1}])}catch{}}),JB.current=LA.seq},[Y?.gameState,j,Ui,jA]),Q.jsxs(Q.Fragment,{children:[Q.jsx(Po,{className:"page-poker-room"}),Q.jsx(uH,{open:Mt,onClose:Ri,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"}),Q.jsxs($O,{showAvatarBacks:il,header:Q.jsx("div",{className:"poker-room-header",children:Q.jsx(WO,{roomName:Xg,roomId:t,players:cI,meId:RQ,gameState:bg,lastRollerId:null,showHeader:!0,revealedHands:Qe,historyHalo:EA,singlePlayer:Y?.singlePlayer,turnDeadlineTs:FB,isBettingStreet:At,isHeroTurn:ZA,elimConfig:Pt,elimStates:aA,onOpenHistory:async()=>{if(Se(!0),!!t)try{const fA=await J(t,20);if(fA?.ok&&Array.isArray(fA?.data?.items)){const LA=fA.data.items;Oe(Ae=>{const Ee=LA.map(Ke=>({roundSeq:Number(Ke.seq||Ke.roundSeq||0),ts:Number(Ke.endedAt||Ke.createdAt||Date.now()),pot:Number(Ke.mainPot||Ke.pot||0),winners:Array.isArray(Ke.seats)?Ke.seats.filter(xe=>(xe.winnings||0)>0).map(xe=>({playerId:xe.playerId,seatIndex:xe.seatIndex,amount:xe.winnings||0,rank:xe.rank?xe.rank:xe.handRank!=null?{category:xe.handRank,tiebreak:xe.tiebreak||[]}:void 0})):[],hands:Array.isArray(Ke.seats)?Ke.seats.map(xe=>({playerId:xe.playerId,seatIndex:xe.seatIndex,hole:Array.isArray(xe.hole)?xe.hole:Array.isArray(xe.holeCards)?xe.holeCards:[]})):[],seats:Array.isArray(Ke.seats)?Ke.seats.map(xe=>({playerId:xe.playerId,seatIndex:xe.seatIndex,status:xe.status,rank:xe.rank?xe.rank:xe.handRank!=null?{category:xe.handRank,tiebreak:xe.tiebreak||[]}:void 0,winnings:xe.winnings})):void 0})),PA=new Map;for(const Ke of[...Ae,...Ee])PA.set(Ke.roundSeq,Ke);return Array.from(PA.values()).sort((Ke,xe)=>xe.roundSeq-Ke.roundSeq).slice(0,20)})}}catch{}}})}),children:[Q.jsx(zW,{enabled:KA,handKey:dA,perCardSec:.6,staggerSec:.14,onComplete:()=>{FA(!1);const fA=de.current;if(fA>0&&(VA.current=fA),X&&!rA&&(uA(!0),setTimeout(()=>mA(!0),200)),AA.current!=null){try{clearTimeout(AA.current)}catch{}AA.current=null}try{const LA=typeof window<"u"?window:void 0;LA&&(LA.__pokerHoleDiag=LA.__pokerHoleDiag||[],LA.__pokerHoleDiag.push({kind:"dealing_complete",at:Date.now()}))}catch{}}}),Q.jsx(zW,{enabled:bB.active,handKey:`board-${bB.key}`,perCardSec:.5,staggerSec:.12,passes:1,getTargets:fA=>{try{const LA=fA.getBoundingClientRect(),Ae=fA.ownerDocument?.querySelector(".poker-board");if(!Ae)return[];const Ee=Array.from(Ae.querySelectorAll(".poker-card"));return bB.indices.map(Ke=>{const xe=Ee[Ke];if(!xe)return null;const Ct=xe.getBoundingClientRect();return{x:(Ct.left+Ct.right)/2-LA.left,y:(Ct.top+Ct.bottom)/2-LA.top}}).filter(Boolean)}catch{return[]}},onComplete:()=>{const fA=bB.indices.slice();if(Mu(LA=>({...LA,active:!1})),fA.length>0){Rt(Ae=>{const Ee=new Set(Ae);return fA.forEach(PA=>Ee.add(PA)),Ee});const LA=window.setTimeout(()=>{Rt(Ae=>{const Ee=new Set(Ae);return fA.forEach(PA=>Ee.delete(PA)),Ee})},250);Yt.current.push(LA)}}}),Q.jsxs("div",{className:"poker-mock",children:[Tr&&!wo&&Q.jsx("div",{className:"poker-start-hand",style:{position:"absolute",top:8,right:12,zIndex:5},children:Q.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",Dg?"is-busy":""].filter(Boolean).join(" "),"aria-label":"Play Again",disabled:Dg,onClick:async()=>{if(!Dg){try{const{hapticClick:fA}=await pi(async()=>{const{hapticClick:LA}=await Promise.resolve().then(()=>iT);return{hapticClick:LA}},void 0,import.meta.url);fA("Medium")}catch{}En(!0);try{const{loadSettings:fA}=await pi(async()=>{const{loadSettings:xe}=await Promise.resolve().then(()=>j6);return{loadSettings:xe}},void 0,import.meta.url),LA=await fA(),Ae=LA.botDifficultyLevel&&LA.botDifficultyLevel>=1&&LA.botDifficultyLevel<=9?LA.botDifficultyLevel:void 0,Ee=await U({name:"Single Player Room",singlePlayer:!0,botLevel:Ae}),PA=Ee?.room??Ee?.roomsList?.room??Ee?.data?.room??null,Ke=PA?.roomId??PA?.id??Ee?.roomId??Ee?.data?.roomId;if(Ke){try{window.__PRESEEDED_ROOM=PA}catch{}x(`/poker/room/${Ke}`,{replace:!0})}else{try{H("Poker",Ee?.error||"Unable to create room")}catch{}En(!1)}}catch{try{H("Poker","Unable to create room")}catch{}En(!1)}}},children:"Play Again"})}),wo&&Q.jsxs("div",{className:"poker-start-hand",style:{position:"absolute",top:8,right:12,zIndex:5},children:[pg>0&&Q.jsxs("div",{className:"poker-start-hand__countdown",style:{marginBottom:4,fontSize:"0.9rem",color:"#ffd700",textAlign:"center",fontWeight:"bold"},children:["Starting in ",pg,"s"]}),Al.length>1&&Q.jsxs("div",{className:"poker-start-hand__readiness",style:{marginBottom:4,fontSize:"0.75rem",color:"#ccc",textAlign:"center"},children:[Vo.length,"/",Al.length," ready"]}),Q.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",bn?"is-busy":"",ys?"is-ready":""].filter(Boolean).join(" "),"aria-label":ys?"Waiting for others":"Start Hand",disabled:bn||ys,onClick:async()=>{if(t){try{const{hapticClick:fA}=await pi(async()=>{const{hapticClick:LA}=await Promise.resolve().then(()=>iT);return{hapticClick:LA}},void 0,import.meta.url);fA("Medium")}catch{}tn(!0);try{const fA=await m(t);if(fA?.countdown&&Ut(fA?.countdown),fA?.waiting){eo(fA?.readyPlayers||[]),DC(fA?.requiredPlayers||[]);return}if(!fA?.ok)try{H("Poker",fA?.error||"Unable to start hand")}catch{}tn(!1)}catch{try{H("Poker","Unable to start hand")}catch{}tn(!1)}}},children:ys?"✓ Ready":"Start Hand"})]}),Q.jsxs("div",{className:"poker-mock__table",children:[Q.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),Q.jsxs("div",{className:"poker-board-wrap",children:[Q.jsx("div",{className:"poker-pot","aria-label":"poker-pot",ref:_A,style:Me?void 0:{visibility:"hidden"},children:(()=>{const fA=Number(bg?.wagerPool?.totalAmount||0),LA=ZO(fA);return Object.entries(LA.reduce((Ae,Ee)=>{const PA=String(Ee);return Ae[PA]=(Ae[PA]||0)+1,Ae},{})).sort((Ae,Ee)=>Number(Ee[0])-Number(Ae[0])),Q.jsx("div",{className:"poker-pot__wrap",children:Q.jsxs("div",{className:"poker-pot__context","aria-live":"polite",children:[Q.jsxs("span",{className:"poker-pot__stack-info",children:["You: z",$g]}),Q.jsx("span",{className:"poker-pot__divider","aria-hidden":"true",children:"•"}),Q.jsxs("span",{className:`poker-pot__pot-info ${$e>0&&$g>0&&$e/$g>=.25?"poker-pot__pot-info--high":""}`,children:[$e>0?`To Call: z${$e}`:`Pot: z${fA}`,$e>0&&$g>0&&$e/$g>=.5&&Q.jsxs("span",{className:"poker-pot__high-pct","aria-label":"High percentage of stack",children:[Math.round($e/$g*100),"%"]})]})]})})})()}),Q.jsx(ZTA,{boardCards:Array.isArray(Y?.gameState?.pokerCommunity)?Y.gameState.pokerCommunity:[]}),Q.jsx("div",{className:"poker-board poker-community","aria-label":"community-cards",children:Array.isArray(Y?.gameState?.pokerCommunity)&&Y.gameState.pokerCommunity.map((fA,LA)=>{const Ae=lt.has(LA)||LA>=(vB.current||0),Ee=Y.gameState.pokerCommunity,PA=jTA(LA),Ke=OTA(Ee,LA),xe=PA==="river"&&Ee.length===5;return Q.jsx(XTA,{value:fA,concealed:Ae,position:PA,isPaired:Ke,animateEntrance:xe&&!Ae},`${fA}-${LA}`)})}),Q.jsx("div",{className:["poker-hole",KA?"poker-hole--concealed":"",rA?"is-revealed":"",!rA&&IA?"is-partial":"",ZA&&!DI?"poker-hole--active-turn":""].filter(Boolean).join(" "),"aria-label":"hole-cards",ref:ae,children:Q.jsxs("div",{className:"poker-hole-stack",children:[Q.jsx("div",{className:"poker-hole-label","aria-hidden":!0,children:"--"}),IA,rA,Q.jsx(bTA,{cards:X,firstRevealed:!!IA,bothRevealed:!!rA}),Array.isArray(Y?.gameState?.pokerCommunity)&&Y.gameState.pokerCommunity.length>0&&(()=>{const fA=Y.gameState.pokerCommunity;return AP(fA).length>0?Q.jsxs("div",{className:"poker-hole__board-hint","aria-label":"Board is paired",title:"Paired board",children:[Q.jsx("span",{className:"poker-hole__board-icon","aria-hidden":"true",children:"≡"}),Q.jsx("span",{className:"poker-hole__board-text",children:"Paired Board"})]}):null})()]})})]}),mC&&Q.jsx("div",{className:"poker-timeout-toast","aria-live":"polite",style:{position:"fixed",left:mC.x,top:mC.y,transform:"translate(-50%, -100%)"},children:mC.text})]}),HA&&Q.jsx(LTA,{players:cI,entries:ne,onClose:()=>Se(!1)}),ve.length>0&&Q.jsx(XgA,{anim:ve[0],onComplete:()=>{ve[0],bA(fA=>fA.slice(1))}},ve[0].id)]}),Q.jsxs("div",{className:"poker-actions-wrap",ref:Ye,children:[Q.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented",ZA&&!DI?"poker-actions--halo":""].filter(Boolean).join(" "),role:"group","aria-label":"Action buttons","aria-disabled":DI||void 0,children:[Nt&&Q.jsx(Gc,{label:"Check",ariaLabel:"Check",size:"md",disabled:DI,onClick:Nu,className:"poker-action--flat poker-action--secondary poker-action--check"}),!Nt&&wi&&Q.jsx(Gc,{label:"Call",subtitle:`z${$e}`,ariaLabel:`Call ${$e}`,size:"md",disabled:DI,onClick:Gu,className:"poker-action--flat poker-action--primary poker-action--call"}),Mg&&Q.jsx(Gc,{label:"Bet",subtitle:EI>0?`z${EI}`:void 0,ariaLabel:"Bet",size:"md",disabled:DI,onClick:gl,className:"poker-action--green poker-action--secondary poker-action--bet"}),!Mg&&en&&Q.jsx(Gc,{label:"Raise",subtitle:EI>0?`z${EI}`:void 0,ariaLabel:"Raise",size:"md",disabled:DI,onClick:Ru,className:["poker-action--green","poker-action--secondary","poker-action--raise",SC==="raise"&&GQ?"raise-active":""].filter(Boolean).join(" ")}),Le==="active"&&Q.jsx(Gc,{label:"Fold",ariaLabel:"Fold",size:"md",disabled:DI,onClick:Ep,className:"poker-action--flat poker-action--danger poker-action--fold"})]}),Q.jsx("div",{className:"poker-chiprack",style:GQ?void 0:{visibility:"hidden",pointerEvents:"none"},children:Q.jsx(giA,{onPlaceBet:Uu,onCancelBet:up,disabled:DI,defaultValue:Math.max(1,ma||1),max:$g>0?$g:void 0})})]})]}),Xe&&Q.jsxs("div",{className:"elim-toast",children:[Q.jsx("div",{className:"elim-toast__text",children:Xe.text}),Xe.sub&&Q.jsx("div",{className:"elim-toast__sub",children:Xe.sub})]}),GA&&Q.jsx(WTA,{winner:GA.winner,eliminatedOrder:GA.eliminatedOrder,finalStates:GA.finalStates,nameOf:fA=>cI.find(Ae=>Ae.id===fA)?.name||fA.slice(0,6),meId:RQ,onDismiss:()=>oe(null)}),nt&&Q.jsx(tIA,{winnerName:cI.find(LA=>LA.id===nt.winnerUserId)?.name||nt.winnerUserId?.slice(0,6)||"Winner",bonus:nt.bonus,isHero:nt.winnerUserId===RQ,onDismiss:()=>Dt(null)}),E&&Q.jsx(zO,{show:!0,variant:E.variant,displayMs:E.displayMs,zoomDurationMs:E.zoomDurationMs,fadeDurationMs:E.fadeDurationMs,ariaLabel:E.ariaLabel,onComplete:y})]})}function tP(){const t=Di(),{user:A}=Yi(),[e,i]=p.useState(!1),g=(()=>{try{return window.location.search.includes("e2e=1")||window.__E2E===!0||window.sessionStorage?.getItem("e2e")==="1"}catch{return!1}})(),I=p.useCallback(()=>{if(!(Number(A?.balance??0)>=1e3)){i(!0);return}const o=`e2e-${Math.random().toString(36).slice(2,8)}`;t(`/poker/room/${o}?m=poker`)},[t,A?.balance]);return Q.jsxs($O,{header:Q.jsx("div",{className:"poker-room-header",role:"banner",children:Q.jsx("h1",{className:"poker-title","aria-label":"Poker Room",children:"Poker"})}),children:[g&&Q.jsx("div",{className:"poker-room-controls",role:"group","aria-label":"poker e2e controls",children:Q.jsx("button",{type:"button",onClick:I,"aria-label":"Create Game",children:"Create Game"})}),g&&Q.jsx("div",{className:"poker-actions-wrap",children:Q.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented","poker-actions--halo"].join(" "),role:"group","aria-label":"Action buttons",children:[Q.jsx(Hm,{label:"Check",ariaLabel:"Check",size:"md",onClick:()=>{},className:"poker-action--flat"}),Q.jsx(Hm,{label:"Bet",ariaLabel:"Bet",size:"md",onClick:()=>{},className:"poker-action--flat"}),Q.jsx(Hm,{label:"Fold",ariaLabel:"Fold",size:"md",onClick:()=>{},className:"poker-action--flat poker-action--fold"})]})})]})}const hh=(t,A)=>({rank:t,suit:A}),_w={name:"Texas Hold’em",pot:295,community:[hh("5","♠"),hh("8","♦"),hh("A","♣"),hh("10","♣"),hh("2","♥")],players:[{id:"p1",name:"Hero",stack:295,bet:25,isHero:!0,isActing:!0,hole:[hh("K","♠"),hh("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}]},$TA=[{kind:"call",amount:25},{kind:"fold"},{kind:"check"},{kind:"bet",amount:0},{kind:"raise",to:0}];function XW(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 $W(t){return`${t.rank}${t.suit}`}function AYA(t={1:0,5:0,10:0,25:0,100:0,500:0}){const[A,e]=p.useState(t),i=p.useMemo(()=>VgA.reduce((o,a)=>o+a*(A[a]??0),0),[A]),g=p.useCallback(o=>{e(a=>({...a,[o]:(a[o]??0)+1}))},[]),I=p.useCallback(o=>{e(a=>a[o]?{...a,[o]:0}:a)},[]),n=p.useCallback(()=>{e({1:0,5:0,10:0,25:0,100:0,500:0})},[]);return{rack:A,totalAmount:i,addChip:g,clearChip:I,clearAllChips:n}}function iP(){const{user:t}=Yi(),[A,e]=ke.useState(!1),i=_w.players.find(c=>c.isHero),g=_w.players.map(c=>({id:c.id,name:c.name,balance:c.bet??0})),I={gameMode:"poker"},n=typeof window<"u"&&window.location.search.includes("e2e=1"),{rack:o,totalAmount:a,addChip:r,clearChip:s,clearAllChips:B}=AYA();return Q.jsx(Q.Fragment,{children:Q.jsx($O,{header:Q.jsx("div",{className:"poker-room-header",children:Q.jsx(WO,{roomName:_w.name,players:g,meId:i.id,gameState:I,lastRollerId:null,showHeader:!0})}),children:Q.jsxs("div",{className:"poker-mock",children:[n&&Q.jsx("div",{className:"poker-e2e-bar",children:Q.jsx("button",{className:"felt-btn","aria-label":"Create Game",onClick:()=>{if(!(Number(t?.balance??0)>=1e3)){e(!0);return}const E="e2e_"+Math.random().toString(36).slice(2,8);window.location.assign(`/poker/room/${E}`)},children:"Create Game"})}),Q.jsxs("div",{className:"poker-mock__table",children:[Q.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),Q.jsx("div",{className:"poker-board",children:_w.community.map((c,E)=>{const D=c.suit==="♥"||c.suit==="♦";return Q.jsxs("div",{className:["poker-card",D?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":$W(c),children:[Q.jsx("span",{className:"poker-card__rank",children:c.rank}),Q.jsx("span",{className:"poker-card__suit",children:c.suit})]},E)})}),Q.jsxs("div",{className:"poker-pot",children:["$",_w.pot]})]}),i?.hole&&Q.jsx("div",{className:"poker-hole",children:i.hole.map((c,E)=>{const D=c.suit==="♥"||c.suit==="♦";return Q.jsxs("div",{className:["poker-card",D?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":$W(c),children:[Q.jsx("span",{className:"poker-card__rank",children:c.rank}),Q.jsx("span",{className:"poker-card__suit",children:c.suit})]},E)})}),Q.jsx("div",{className:"poker-actions-wrap",children:Q.jsx("div",{className:"poker-actions",children:$TA.map((c,E)=>Q.jsx(Hm,{label:XW(c),ariaLabel:XW(c),size:"md",onClick:()=>{}},E))})}),Q.jsx("div",{className:"poker-chiprack",children:Q.jsx(nIA,{selectedTimes:o,onAdd:r,onClear:s,onPlaceBet:()=>{B()},onCancelBet:()=>{B()},disabled:!1,collapsed:!1,miniChips:!0,mainAmt:a,betTokenProps:{isBanker:!1,meId:i.id,open:[],players:g,show:!0}})})]})})})}const TR="red",YR="blue",HR="green",OR="yellow",pY="purple",PR="cyan",jR="orange",fY="magenta",Az=[{id:0,name:"Command Base",type:"start"},{id:1,name:"Alpha Centauri",type:"planet",group:pY,cost:60,rent:[2,10,30,90,160,250],upgradeCost:50},{id:2,name:"Nebula Drift",type:"nebula"},{id:3,name:"Proxima B",type:"planet",group:pY,cost:60,rent:[4,20,60,180,320,450],upgradeCost:50},{id:4,name:"Supply Levy",type:"tax"},{id:5,name:"Outpost Alpha",type:"station",cost:200},{id:6,name:"Kepler-22b",type:"planet",group:PR,cost:100,rent:[6,30,90,270,400,550],upgradeCost:50},{id:7,name:"Asteroid Belt",type:"asteroid"},{id:8,name:"Kepler-442b",type:"planet",group:PR,cost:100,rent:[6,30,90,270,400,550],upgradeCost:50},{id:9,name:"Kepler-62f",type:"planet",group:PR,cost:120,rent:[8,40,100,300,450,600],upgradeCost:50},{id:10,name:"Detention Block",type:"jail"},{id:11,name:"Trappist-1d",type:"planet",group:jR,cost:140,rent:[10,50,150,450,625,750],upgradeCost:100},{id:12,name:"Wormhole α",type:"wormhole"},{id:13,name:"Trappist-1e",type:"planet",group:jR,cost:140,rent:[10,50,150,450,625,750],upgradeCost:100},{id:14,name:"Trappist-1f",type:"planet",group:jR,cost:160,rent:[12,60,180,500,700,900],upgradeCost:100},{id:15,name:"Outpost Beta",type:"station",cost:200},{id:16,name:"Ross 128b",type:"planet",group:TR,cost:180,rent:[14,70,200,550,750,950],upgradeCost:100},{id:17,name:"Nebula Storm",type:"nebula"},{id:18,name:"Tau Ceti e",type:"planet",group:TR,cost:180,rent:[14,70,200,550,750,950],upgradeCost:100},{id:19,name:"Tau Ceti f",type:"planet",group:TR,cost:200,rent:[16,80,220,600,800,1e3],upgradeCost:100},{id:20,name:"Safe Harbor",type:"free-parking"},{id:21,name:"Gliese 667Cc",type:"planet",group:OR,cost:220,rent:[18,90,250,700,875,1050],upgradeCost:150},{id:22,name:"Asteroid Storm",type:"asteroid"},{id:23,name:"Gliese 581d",type:"planet",group:OR,cost:220,rent:[18,90,250,700,875,1050],upgradeCost:150},{id:24,name:"Gliese 581g",type:"planet",group:OR,cost:240,rent:[20,100,300,750,925,1100],upgradeCost:150},{id:25,name:"Outpost Gamma",type:"station",cost:200},{id:26,name:"Cancri 55e",type:"planet",group:HR,cost:260,rent:[22,110,330,800,975,1150],upgradeCost:150},{id:27,name:"Cancri 55f",type:"planet",group:HR,cost:260,rent:[22,110,330,800,975,1150],upgradeCost:150},{id:28,name:"Wormhole β",type:"wormhole"},{id:29,name:"HD 40307g",type:"planet",group:HR,cost:280,rent:[24,120,360,850,1025,1200],upgradeCost:150},{id:30,name:"Black Hole",type:"go-to-jail"},{id:31,name:"Kapteyn b",type:"planet",group:YR,cost:300,rent:[26,130,390,900,1100,1275],upgradeCost:200},{id:32,name:"Kapteyn c",type:"planet",group:YR,cost:300,rent:[26,130,390,900,1100,1275],upgradeCost:200},{id:33,name:"Nebula Gateway",type:"nebula"},{id:34,name:"Wolf 1061c",type:"planet",group:YR,cost:320,rent:[28,150,450,1e3,1200,1400],upgradeCost:200},{id:35,name:"Outpost Delta",type:"station",cost:200},{id:36,name:"Asteroid Shower",type:"asteroid"},{id:37,name:"Pandora",type:"planet",group:fY,cost:350,rent:[35,175,500,1100,1300,1500],upgradeCost:200},{id:38,name:"War Tax",type:"tax"},{id:39,name:"Elysium",type:"planet",group:fY,cost:400,rent:[50,200,600,1400,1700,2e3],upgradeCost:200}],ay={tiles:Az,tileCount:Az.length,startingCredits:1500,passStartBonus:200,jailBailCost:50},gP={[pY]:"#7b2ff2",[PR]:"#00e5ff",[jR]:"#ff9100",[TR]:"#ff1744",[OR]:"#ffd600",[HR]:"#00e676",[YR]:"#2979ff",[fY]:"#e040fb"},sb="zentara_saved_game";function eYA(t){const{board:A,...e}=t;localStorage.setItem(sb,JSON.stringify(e))}function tYA(){return localStorage.getItem(sb)!==null}function rIA(){const t=localStorage.getItem(sb);if(!t)return null;try{const A=JSON.parse(t);return!A.matchId||!Array.isArray(A.players)||A.players.length<2?null:{...A,board:ay.tiles}}catch{return null}}function sIA(){localStorage.removeItem(sb)}const iYA={minHeight:"100svh",background:"radial-gradient(ellipse at 50% 20%, #0f1a3a 0%, #060a14 70%)",display:"flex",flexDirection:"column",alignItems:"center",justifyContent:"center",padding:"24px 16px",fontFamily:"Rubik, sans-serif",color:"#c0d0e8",textAlign:"center"},gYA={fontFamily:"Orbitron, monospace",fontSize:36,fontWeight:700,background:"linear-gradient(135deg, #7b2ff2, #00e5ff)",WebkitBackgroundClip:"text",WebkitTextFillColor:"transparent",marginBottom:8},IYA={fontSize:14,opacity:.6,marginBottom:32},WN={padding:"14px 40px",borderRadius:10,border:"none",background:"linear-gradient(135deg, #7b2ff2, #00e5ff)",color:"#fff",fontFamily:"Orbitron, monospace",fontSize:16,fontWeight:600,cursor:"pointer",textTransform:"uppercase",letterSpacing:2,marginBottom:12},nYA=Array.from({length:30},(t,A)=>({width:A%3===0?3:2,height:A%3===0?3:2,opacity:.1+A%5*.06,left:`${(A*137+50)%100}%`,top:`${(A*251+30)%100}%`})),IP=()=>{const t=Di(),[A,e]=p.useState(!1);p.useEffect(()=>{e(tYA())},[]);const i=()=>{const n=rIA();n&&t(`/zentara/match/${n.matchId}`)},g=()=>{sIA(),e(!1)},I=()=>{const n=crypto.randomUUID().slice(0,8);t(`/zentara/match/${n}`)};return Q.jsxs("div",{style:iYA,children:[Q.jsx("div",{style:{position:"absolute",inset:0,overflow:"hidden",pointerEvents:"none"},children:nYA.map((n,o)=>Q.jsx("div",{style:{position:"absolute",width:n.width,height:n.height,borderRadius:"50%",background:"#fff",opacity:n.opacity,left:n.left,top:n.top}},o))}),Q.jsx("h1",{style:gYA,children:"ZENTARA"}),Q.jsx("p",{style:IYA,children:"Wage war across the stars"}),A&&Q.jsx("button",{style:WN,onClick:i,children:"Continue Game"}),Q.jsx("button",{style:A?{...WN,background:"transparent",border:"1px solid #7b2ff2",color:"#7b2ff2"}:WN,onClick:()=>{A&&g(),I()},children:A?"New Game":"Quick Play"}),Q.jsx("button",{style:{...WN,background:"transparent",border:"1px solid #1e3a5f",color:"#6b7fa3",fontSize:13},onClick:()=>t("/settings"),children:"Settings"})]})};function CIA(){const t=Math.floor(Math.random()*6)+1,A=Math.floor(Math.random()*6)+1;return[t,A]}function BIA(t){return t[0]===t[1]}function oYA(t,A,e){const i=(t+A)%e,g=t+A>=e;return{newTile:i,passedStart:g}}function aYA(t,A,e){const i=[];let g=t;for(;g!==A;)g=(g+1)%e,i.push(g);return i}function rYA(t,A){return{...t,credits:t.credits+A.passStartBonus}}function sYA(t,A,e){const i=A[0]+A[1],{newTile:g,passedStart:I}=oYA(t.tileIndex,i,e.tileCount),n=aYA(t.tileIndex,g,e.tileCount);let o={...t,tileIndex:g};return I&&(o=rYA(o,e)),{player:o,passedStart:I,path:n}}function DY(t,A){return{...t,tileIndex:A,inJail:!0,jailTurnsLeft:3}}function CYA(t,A,e){if(BIA(A))return{player:{...t,inJail:!1,jailTurnsLeft:0},escaped:!0,method:"roll-doubles"};const i=t.jailTurnsLeft-1;return i<=0?{player:{...t,inJail:!1,jailTurnsLeft:0,credits:t.credits-e},escaped:!0,method:"pay"}:{player:{...t,jailTurnsLeft:i},escaped:!1,method:null}}function BYA(t,A){return{...t,inJail:!1,jailTurnsLeft:0,credits:t.credits-A}}function cYA(t,A,e){return A.filter(i=>i.ownerId===t&&!i.mortgaged&&e[i.tileId]?.type==="station").length}function lYA(t,A,e,i){return i.filter(I=>I.group===A).map(I=>I.id).every(I=>e.some(n=>n.tileId===I&&n.ownerId===t&&!n.mortgaged))}function QYA(t,A,e,i){if(!t.rent)return 0;const g=t.rent[A.upgradeLevel]??t.rent[0]??0;return A.upgradeLevel===0&&t.group&&lYA(A.ownerId,t.group,e,i)?g*2:g}function EYA(t,A,e){const i=cYA(t,A,e);return i<=0?0:25*Math.pow(2,i-1)}const uYA={12:28,28:12},ez=[{text:"Intercepted enemy supply convoy! Collect 150 credits.",amount:150},{text:"Asteroid barrage hit your fleet! Pay 100 for repairs.",amount:-100},{text:"Stealth mission success. Collect 50 credits.",amount:50},{text:"Hull breach from enemy fire! Repairs cost 200 credits.",amount:-200},{text:"Salvaged weapons from derelict warship. Collect 75 credits.",amount:75},{text:"Debris field damaged shields! Pay 50 for repairs.",amount:-50}],tz=[{text:"War council grants reinforcements. Collect 200 credits.",amount:200},{text:"Fleet maintenance overdue. Pay 150 credits.",amount:-150},{text:"Weapons upgrade bonus. Collect 100 credits.",amount:100},{text:"Tactical systems overhaul. Pay 75 credits.",amount:-75},{text:"Arms trade dividend. Collect 50 credits.",amount:50},{text:"Reactor core replacement. Pay 125 credits.",amount:-125}];function hYA(t,A,e,i){switch(t.type){case"planet":{const g=e.find(n=>n.tileId===t.id);if(!g)return{tileId:t.id,action:"buy-prompt",amount:t.cost};if(g.ownerId===A.id||g.mortgaged)return{tileId:t.id,action:"none"};const I=QYA(t,g,e,i);return{tileId:t.id,action:"pay-rent",amount:I}}case"station":{const g=e.find(n=>n.tileId===t.id);if(!g)return{tileId:t.id,action:"buy-prompt",amount:t.cost};if(g.ownerId===A.id||g.mortgaged)return{tileId:t.id,action:"none"};const I=EYA(g.ownerId,e,i);return{tileId:t.id,action:"pay-rent",amount:I}}case"tax":return{tileId:t.id,action:"pay-tax",amount:t.id===4?200:100};case"go-to-jail":return{tileId:t.id,action:"go-to-jail"};case"wormhole":{const g=uYA[t.id];return{tileId:t.id,action:"wormhole",targetTile:g??t.id}}case"asteroid":{const g=ez[Math.floor(Math.random()*ez.length)];return{tileId:t.id,action:"draw-card",amount:g.amount,cardText:g.text}}case"nebula":{const g=tz[Math.floor(Math.random()*tz.length)];return{tileId:t.id,action:"draw-card",amount:g.amount,cardText:g.text}}default:return{tileId:t.id,action:"none"}}}const RL=10;function cIA(t){return{playerId:t,phase:"pre-roll",diceValues:null,doublesCount:0,rolledDoubles:!1,landedTile:null}}function dYA(t,A){const e=[],i={...t.currentTurn},g=t.players.findIndex(E=>E.id===i.playerId);if(g===-1)return{state:t,events:e,effect:null};let I={...t.players[g]};const n=A??CIA();i.diceValues=n,e.push({type:"roll",playerId:I.id,dice:n});const o=BIA(n);if(i.doublesCount=o?i.doublesCount+1:0,i.rolledDoubles=o,i.doublesCount>=3){I=DY(I,RL),e.push({type:"jail",playerId:I.id,reason:"triple-doubles"}),i.phase="done",i.landedTile=RL;const E=[...t.players];return E[g]=I,{state:{...t,players:E,currentTurn:i,pendingEffect:null},events:e,effect:null}}if(I.inJail){const{player:E,escaped:D,method:y}=CYA(I,n,ay.jailBailCost);if(I=E,!D){i.phase="done";const S=[...t.players];return S[g]=I,{state:{...t,players:S,currentTurn:i,pendingEffect:null},events:e,effect:null}}e.push({type:"jail-free",playerId:I.id,method:y})}const{player:a,passedStart:r}=sYA(I,n,ay);I=a,e.push({type:"move",playerId:I.id,from:t.players[g].tileIndex,to:I.tileIndex,passedStart:r}),i.landedTile=I.tileIndex,i.phase="landed";const s=[...t.players];s[g]=I;const B=t.board[I.tileIndex],c=B?hYA(B,I,t.properties,t.board):null;if(c&&c.action==="go-to-jail")return I=DY(I,RL),e.push({type:"jail",playerId:I.id,reason:"go-to-jail"}),i.phase="done",s[g]=I,{state:{...t,players:s,currentTurn:i,pendingEffect:null},events:e,effect:null};if(c&&c.action==="wormhole"&&c.targetTile!=null){const E=I.tileIndex;return I={...I,tileIndex:c.targetTile},e.push({type:"move",playerId:I.id,from:E,to:c.targetTile,passedStart:!1}),i.landedTile=c.targetTile,i.phase=o?"pre-roll":"done",s[g]=I,{state:{...t,players:s,currentTurn:i,pendingEffect:null},events:e,effect:null}}return c&&c.action==="none"?i.phase=o?"pre-roll":"done":c&&(i.phase="action"),{state:{...t,players:s,currentTurn:i,pendingEffect:c??null},events:e,effect:c}}function pYA(t){const A=t.players.filter(g=>!g.bankrupt);if(A.length<=1)return{...t,finished:!0,winnerId:A[0]?.id??null};let e=(t.currentPlayerIndex+1)%t.players.length;for(;t.players[e]?.bankrupt;)e=(e+1)%t.players.length;const i=e<=t.currentPlayerIndex?t.roundNumber+1:t.roundNumber;return{...t,currentPlayerIndex:e,currentTurn:cIA(t.players[e].id),roundNumber:i,pendingEffect:null}}const fYA=10,iz=["rocket","satellite","shuttle","probe","ufo","meteor"],gz=["#ff4081","#00e5ff","#76ff03","#ffab00","#e040fb","#ff6e40"];function DYA(t,A,e){return{id:t,displayName:A,credits:ay.startingCredits,tileIndex:0,inJail:!1,jailTurnsLeft:0,bankrupt:!1,piece:iz[e%iz.length],pieceColor:gz[e%gz.length]}}function yYA(t){const A=t.map((e,i)=>DYA(e.id,e.name,i));return{matchId:crypto.randomUUID(),players:A,properties:[],currentTurn:cIA(A[0].id),currentPlayerIndex:0,board:ay.tiles,roundNumber:1,finished:!1,winnerId:null,pendingEffect:null}}function SYA(t,A){const[e,i]=p.useState(()=>A??yYA(t)),[g,I]=p.useState([]),[n,o]=p.useState(0),a=p.useRef(!1),r=p.useRef([]),s=p.useRef(!1);p.useEffect(()=>{if(s.current){const b=r.current;r.current=[],s.current=!1,I(b)}else if(r.current.length>0){const b=r.current;r.current=[],I(K=>[...K,...b])}});const B=p.useCallback(()=>{if(a.current)return;a.current=!0;const b=CIA();let K=!1;i(R=>{if(R.finished||R.currentTurn.phase!=="pre-roll")return R;const G=dYA(R,b);return s.current=!0,r.current=G.events,K=!0,G.state}),K&&o(R=>R+1),a.current=!1},[]),c=p.useCallback(b=>{i(K=>{if(K.currentTurn.phase!=="action"||K.pendingEffect?.action!=="buy-prompt")return K;const R=K.board[b];if(!R?.cost)return K;const G=K.currentPlayerIndex,J=K.players[G];if(J.credits<R.cost)return K;const x={...J,credits:J.credits-R.cost},H=[...K.players];H[G]=x;const P=[...K.properties,{tileId:b,ownerId:J.id,upgradeLevel:0,mortgaged:!1}];r.current.push({type:"buy",playerId:J.id,tileId:b,cost:R.cost});const j=K.currentTurn.rolledDoubles?"pre-roll":"done",q={...K.currentTurn,phase:j};return{...K,players:H,properties:P,currentTurn:q,pendingEffect:null}})},[]),E=p.useCallback(()=>{i(b=>{const K=b.pendingEffect;if(!K||K.action!=="pay-rent")return b;const R=b.currentPlayerIndex,G=b.players[R],J=K.amount??0,x=b.properties.find(O=>O.tileId===K.tileId);if(!x)return b;const H={...G,credits:G.credits-J},P=b.players.findIndex(O=>O.id===x.ownerId),j=[...b.players];j[R]=H,P!==-1&&(j[P]={...j[P],credits:j[P].credits+J}),r.current.push({type:"pay-rent",payerId:G.id,ownerId:x.ownerId,tileId:K.tileId,amount:J}),H.credits<0&&(j[R]={...H,bankrupt:!0,credits:0},r.current.push({type:"bankrupt",playerId:G.id}));const q=b.currentTurn.rolledDoubles?"pre-roll":"done",Y={...b.currentTurn,phase:q};return{...b,players:j,currentTurn:Y,pendingEffect:null}})},[]),D=p.useCallback(()=>{i(b=>{const K=b.pendingEffect;if(!K||K.action!=="pay-tax")return b;const R=b.currentPlayerIndex,G=K.amount??0,J={...b.players[R],credits:b.players[R].credits-G},x=[...b.players];x[R]=J,r.current.push({type:"tax",playerId:J.id,amount:G});const H=b.currentTurn.rolledDoubles?"pre-roll":"done",P={...b.currentTurn,phase:H};return{...b,players:x,currentTurn:P,pendingEffect:null}})},[]),y=p.useCallback(()=>{i(b=>{const K=b.pendingEffect;if(!K||K.action!=="draw-card")return b;const R=b.currentPlayerIndex,G={...b.players[R],credits:b.players[R].credits+(K.amount??0)},J=[...b.players];J[R]=G;const x=b.board[K.tileId]?.type==="asteroid"?"asteroid":"nebula";r.current.push({type:"card",playerId:G.id,deck:x,text:K.cardText??""});const H=b.currentTurn.rolledDoubles?"pre-roll":"done";return{...b,players:J,currentTurn:{...b.currentTurn,phase:H},pendingEffect:null}})},[]),S=p.useCallback(()=>{i(b=>{const K=b.currentPlayerIndex,R=DY(b.players[K],fYA),G=[...b.players];G[K]=R,r.current.push({type:"jail",playerId:R.id,reason:"go-to-jail"});const J={...b.currentTurn,phase:"done"};return{...b,players:G,currentTurn:J,pendingEffect:null}})},[]),f=p.useCallback(()=>{i(b=>{const K=b.currentPlayerIndex,R=BYA(b.players[K],ay.jailBailCost),G=[...b.players];return G[K]=R,r.current.push({type:"jail-free",playerId:R.id,method:"pay"}),{...b,players:G}})},[]),M=p.useCallback(()=>{i(b=>b.currentTurn.phase!=="done"?b:pYA(b)),r.current=[],s.current=!1,I([])},[]),k=p.useCallback(()=>{i(b=>(eYA(b),b))},[]);p.useEffect(()=>{e.finished&&sIA()},[e.finished]);const m=p.useCallback(()=>{i(b=>{if(b.currentTurn.phase!=="action"||b.pendingEffect?.action!=="buy-prompt")return b;const K=b.currentTurn.rolledDoubles?"pre-roll":"done",R={...b.currentTurn,phase:K};return{...b,currentTurn:R,pendingEffect:null}})},[]),U=p.useCallback(b=>{i(K=>{const R=K.currentPlayerIndex,G=K.players[R],J=K.properties.findIndex(O=>O.tileId===b&&O.ownerId===G.id);if(J===-1)return K;const x=K.properties[J];if(x.upgradeLevel>=5||x.mortgaged)return K;const H=K.board[b];if(!H?.upgradeCost||G.credits<H.upgradeCost||!K.board.filter(O=>O.group===H.group).every(O=>K.properties.some($=>$.tileId===O.id&&$.ownerId===G.id)))return K;const q=[...K.players];q[R]={...G,credits:G.credits-H.upgradeCost};const Y=[...K.properties];return Y[J]={...x,upgradeLevel:x.upgradeLevel+1},r.current.push({type:"upgrade",playerId:G.id,tileId:b,level:x.upgradeLevel+1}),{...K,players:q,properties:Y}})},[]),F=p.useCallback(b=>{i(K=>{const R=K.currentPlayerIndex,G=K.players[R],J=K.properties.findIndex(Y=>Y.tileId===b&&Y.ownerId===G.id);if(J===-1)return K;const x=K.properties[J],H=K.board[b];if(!H?.cost)return K;if(x.mortgaged){const Y=Math.floor(H.cost*.55);if(G.credits<Y)return K;const O=[...K.players];O[R]={...G,credits:G.credits-Y};const $=[...K.properties];return $[J]={...x,mortgaged:!1},r.current.push({type:"unmortgage",playerId:G.id,tileId:b}),{...K,players:O,properties:$}}if(x.upgradeLevel>0)return K;const P=Math.floor(H.cost/2),j=[...K.players];j[R]={...G,credits:G.credits+P};const q=[...K.properties];return q[J]={...x,mortgaged:!0},r.current.push({type:"mortgage",playerId:G.id,tileId:b}),{...K,players:j,properties:q}})},[]);return{gameState:e,events:g,pendingEffect:e.pendingEffect,rollTrigger:n,actions:{roll:B,buyProperty:c,payRent:E,payTax:D,resolveCard:y,goToJail:S,payBailAction:f,endTurn:M,skipBuy:m,upgradeProperty:U,mortgageProperty:F,saveGame:k}}}const wYA=3e3,mYA=3e3;function kYA({isMyTurn:t,phase:A,pendingEffect:e,inJail:i,credits:g,actions:I}){const n=p.useRef(null);p.useEffect(()=>{if(t)return;const o=()=>{n.current&&clearTimeout(n.current)};return A==="pre-roll"?n.current=setTimeout(()=>{i&&g>=50&&I.payBailAction(),I.roll()},wYA):A==="action"&&e&&(n.current=setTimeout(()=>{switch(e.action){case"buy-prompt":e.amount!=null&&g>=e.amount?I.buyProperty(e.tileId):I.skipBuy();break;case"pay-rent":I.payRent();break;case"pay-tax":I.payTax();break;case"draw-card":I.resolveCard();break;default:I.endTurn()}},mYA)),o},[t,A,e,i,g,I])}const MYA=[{cx:70,cy:100,r:1.5,opacity:.15},{cx:207,cy:351,r:1,opacity:.23},{cx:344,cy:602,r:1,opacity:.31},{cx:481,cy:853,r:1.5,opacity:.39},{cx:618,cy:144,r:1,opacity:.47},{cx:755,cy:395,r:1,opacity:.15},{cx:892,cy:646,r:1.5,opacity:.23},{cx:69,cy:897,r:1,opacity:.31},{cx:206,cy:188,r:1,opacity:.39},{cx:343,cy:439,r:1.5,opacity:.47},{cx:480,cy:690,r:1,opacity:.15},{cx:617,cy:941,r:1,opacity:.23},{cx:754,cy:232,r:1.5,opacity:.31},{cx:891,cy:483,r:1,opacity:.39},{cx:68,cy:734,r:1,opacity:.47},{cx:205,cy:25,r:1.5,opacity:.15},{cx:342,cy:276,r:1,opacity:.23},{cx:479,cy:527,r:1,opacity:.31},{cx:616,cy:778,r:1.5,opacity:.39},{cx:753,cy:69,r:1,opacity:.47},{cx:890,cy:320,r:1,opacity:.15},{cx:67,cy:571,r:1.5,opacity:.23},{cx:204,cy:822,r:1,opacity:.31},{cx:341,cy:113,r:1,opacity:.39},{cx:478,cy:364,r:1.5,opacity:.47},{cx:615,cy:615,r:1,opacity:.15},{cx:752,cy:866,r:1,opacity:.23},{cx:889,cy:157,r:1.5,opacity:.31},{cx:66,cy:408,r:1,opacity:.39},{cx:203,cy:659,r:1,opacity:.47},{cx:340,cy:910,r:1.5,opacity:.15},{cx:477,cy:201,r:1,opacity:.23},{cx:614,cy:452,r:1,opacity:.31},{cx:751,cy:703,r:1.5,opacity:.39},{cx:888,cy:954,r:1,opacity:.47},{cx:65,cy:245,r:1,opacity:.15},{cx:202,cy:496,r:1.5,opacity:.23},{cx:339,cy:747,r:1,opacity:.31},{cx:476,cy:38,r:1,opacity:.39},{cx:613,cy:289,r:1.5,opacity:.47},{cx:750,cy:540,r:1,opacity:.15},{cx:887,cy:791,r:1,opacity:.23},{cx:64,cy:82,r:1.5,opacity:.31},{cx:201,cy:333,r:1,opacity:.39},{cx:338,cy:584,r:1,opacity:.47},{cx:475,cy:835,r:1.5,opacity:.15},{cx:612,cy:126,r:1,opacity:.23},{cx:749,cy:377,r:1,opacity:.31},{cx:886,cy:628,r:1.5,opacity:.39},{cx:63,cy:879,r:1,opacity:.47},{cx:200,cy:170,r:1,opacity:.15},{cx:337,cy:421,r:1.5,opacity:.23},{cx:474,cy:672,r:1,opacity:.31},{cx:611,cy:923,r:1,opacity:.39},{cx:748,cy:214,r:1.5,opacity:.47},{cx:885,cy:465,r:1,opacity:.15},{cx:62,cy:716,r:1,opacity:.23},{cx:199,cy:967,r:1.5,opacity:.31},{cx:336,cy:258,r:1,opacity:.39},{cx:473,cy:509,r:1,opacity:.47}],NYA=[{wedge:"M467.05,81.29 A420,420 0 0 1 532.95,81.29 L528.25,141.11 A360,360 0 0 0 471.75,141.11 Z",fill:"#1a237e",strip:null,stripColor:null},{wedge:"M532.95,81.29 A420,420 0 0 1 598.05,91.60 L584.04,149.95 A360,360 0 0 0 528.25,141.11 Z",fill:"#0d1b2a",strip:"M532.95,81.29 A420,420 0 0 1 598.05,91.60 L596.18,99.38 A412,412 0 0 0 532.33,89.27 Z",stripColor:"#7b2ff2"},{wedge:"M598.05,91.60 A420,420 0 0 1 660.73,111.97 L637.77,167.40 A360,360 0 0 0 584.04,149.95 Z",fill:"#4a148c",strip:null,stripColor:null},{wedge:"M660.73,111.97 A420,420 0 0 1 719.45,141.89 L688.10,193.05 A360,360 0 0 0 637.77,167.40 Z",fill:"#0d1b2a",strip:"M660.73,111.97 A420,420 0 0 1 719.45,141.89 L715.27,148.71 A412,412 0 0 0 657.67,119.36 Z",stripColor:"#7b2ff2"},{wedge:"M719.45,141.89 A420,420 0 0 1 772.77,180.63 L733.80,226.25 A360,360 0 0 0 688.10,193.05 Z",fill:"#b71c1c",strip:null,stripColor:null},{wedge:"M772.77,180.63 A420,420 0 0 1 819.37,227.23 L773.75,266.20 A360,360 0 0 0 733.80,226.25 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M819.37,227.23 A420,420 0 0 1 858.11,280.55 L806.95,311.90 A360,360 0 0 0 773.75,266.20 Z",fill:"#0d1b2a",strip:"M819.37,227.23 A420,420 0 0 1 858.11,280.55 L851.29,284.73 A412,412 0 0 0 813.29,232.43 Z",stripColor:"#00e5ff"},{wedge:"M858.11,280.55 A420,420 0 0 1 888.03,339.27 L832.60,362.23 A360,360 0 0 0 806.95,311.90 Z",fill:"#1b5e20",strip:null,stripColor:null},{wedge:"M888.03,339.27 A420,420 0 0 1 908.40,401.95 L850.05,415.96 A360,360 0 0 0 832.60,362.23 Z",fill:"#0d1b2a",strip:"M888.03,339.27 A420,420 0 0 1 908.40,401.95 L900.62,403.82 A412,412 0 0 0 880.64,342.33 Z",stripColor:"#00e5ff"},{wedge:"M908.40,401.95 A420,420 0 0 1 918.71,467.05 L858.89,471.75 A360,360 0 0 0 850.05,415.96 Z",fill:"#0d1b2a",strip:"M908.40,401.95 A420,420 0 0 1 918.71,467.05 L910.73,467.67 A412,412 0 0 0 900.62,403.82 Z",stripColor:"#00e5ff"},{wedge:"M918.71,467.05 A420,420 0 0 1 918.71,532.95 L858.89,528.25 A360,360 0 0 0 858.89,471.75 Z",fill:"#e65100",strip:null,stripColor:null},{wedge:"M918.71,532.95 A420,420 0 0 1 908.40,598.05 L850.05,584.04 A360,360 0 0 0 858.89,528.25 Z",fill:"#0d1b2a",strip:"M918.71,532.95 A420,420 0 0 1 908.40,598.05 L900.62,596.18 A412,412 0 0 0 910.73,532.33 Z",stripColor:"#ff9100"},{wedge:"M908.40,598.05 A420,420 0 0 1 888.03,660.73 L832.60,637.77 A360,360 0 0 0 850.05,584.04 Z",fill:"#006064",strip:null,stripColor:null},{wedge:"M888.03,660.73 A420,420 0 0 1 858.11,719.45 L806.95,688.10 A360,360 0 0 0 832.60,637.77 Z",fill:"#0d1b2a",strip:"M888.03,660.73 A420,420 0 0 1 858.11,719.45 L851.29,715.27 A412,412 0 0 0 880.64,657.67 Z",stripColor:"#ff9100"},{wedge:"M858.11,719.45 A420,420 0 0 1 819.37,772.77 L773.75,733.80 A360,360 0 0 0 806.95,688.10 Z",fill:"#0d1b2a",strip:"M858.11,719.45 A420,420 0 0 1 819.37,772.77 L813.29,767.57 A412,412 0 0 0 851.29,715.27 Z",stripColor:"#ff9100"},{wedge:"M819.37,772.77 A420,420 0 0 1 772.77,819.37 L733.80,773.75 A360,360 0 0 0 773.75,733.80 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M772.77,819.37 A420,420 0 0 1 719.45,858.11 L688.10,806.95 A360,360 0 0 0 733.80,773.75 Z",fill:"#0d1b2a",strip:"M772.77,819.37 A420,420 0 0 1 719.45,858.11 L715.27,851.29 A412,412 0 0 0 767.57,813.29 Z",stripColor:"#ff1744"},{wedge:"M719.45,858.11 A420,420 0 0 1 660.73,888.03 L637.77,832.60 A360,360 0 0 0 688.10,806.95 Z",fill:"#4a148c",strip:null,stripColor:null},{wedge:"M660.73,888.03 A420,420 0 0 1 598.05,908.40 L584.04,850.05 A360,360 0 0 0 637.77,832.60 Z",fill:"#0d1b2a",strip:"M660.73,888.03 A420,420 0 0 1 598.05,908.40 L596.18,900.62 A412,412 0 0 0 657.67,880.64 Z",stripColor:"#ff1744"},{wedge:"M598.05,908.40 A420,420 0 0 1 532.95,918.71 L528.25,858.89 A360,360 0 0 0 584.04,850.05 Z",fill:"#0d1b2a",strip:"M598.05,908.40 A420,420 0 0 1 532.95,918.71 L532.33,910.73 A412,412 0 0 0 596.18,900.62 Z",stripColor:"#ff1744"},{wedge:"M532.95,918.71 A420,420 0 0 1 467.05,918.71 L471.75,858.89 A360,360 0 0 0 528.25,858.89 Z",fill:"#2e7d32",strip:null,stripColor:null},{wedge:"M467.05,918.71 A420,420 0 0 1 401.95,908.40 L415.96,850.05 A360,360 0 0 0 471.75,858.89 Z",fill:"#0d1b2a",strip:"M467.05,918.71 A420,420 0 0 1 401.95,908.40 L403.82,900.62 A412,412 0 0 0 467.67,910.73 Z",stripColor:"#ffd600"},{wedge:"M401.95,908.40 A420,420 0 0 1 339.27,888.03 L362.23,832.60 A360,360 0 0 0 415.96,850.05 Z",fill:"#1b5e20",strip:null,stripColor:null},{wedge:"M339.27,888.03 A420,420 0 0 1 280.55,858.11 L311.90,806.95 A360,360 0 0 0 362.23,832.60 Z",fill:"#0d1b2a",strip:"M339.27,888.03 A420,420 0 0 1 280.55,858.11 L284.73,851.29 A412,412 0 0 0 342.33,880.64 Z",stripColor:"#ffd600"},{wedge:"M280.55,858.11 A420,420 0 0 1 227.23,819.37 L266.20,773.75 A360,360 0 0 0 311.90,806.95 Z",fill:"#0d1b2a",strip:"M280.55,858.11 A420,420 0 0 1 227.23,819.37 L232.43,813.29 A412,412 0 0 0 284.73,851.29 Z",stripColor:"#ffd600"},{wedge:"M227.23,819.37 A420,420 0 0 1 180.63,772.77 L226.25,733.80 A360,360 0 0 0 266.20,773.75 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M180.63,772.77 A420,420 0 0 1 141.89,719.45 L193.05,688.10 A360,360 0 0 0 226.25,733.80 Z",fill:"#0d1b2a",strip:"M180.63,772.77 A420,420 0 0 1 141.89,719.45 L148.71,715.27 A412,412 0 0 0 186.71,767.57 Z",stripColor:"#00e676"},{wedge:"M141.89,719.45 A420,420 0 0 1 111.97,660.73 L167.40,637.77 A360,360 0 0 0 193.05,688.10 Z",fill:"#0d1b2a",strip:"M141.89,719.45 A420,420 0 0 1 111.97,660.73 L119.36,657.67 A412,412 0 0 0 148.71,715.27 Z",stripColor:"#00e676"},{wedge:"M111.97,660.73 A420,420 0 0 1 91.60,598.05 L149.95,584.04 A360,360 0 0 0 167.40,637.77 Z",fill:"#006064",strip:null,stripColor:null},{wedge:"M91.60,598.05 A420,420 0 0 1 81.29,532.95 L141.11,528.25 A360,360 0 0 0 149.95,584.04 Z",fill:"#0d1b2a",strip:"M91.60,598.05 A420,420 0 0 1 81.29,532.95 L89.27,532.33 A412,412 0 0 0 99.38,596.18 Z",stripColor:"#00e676"},{wedge:"M81.29,532.95 A420,420 0 0 1 81.29,467.05 L141.11,471.75 A360,360 0 0 0 141.11,528.25 Z",fill:"#d50000",strip:null,stripColor:null},{wedge:"M81.29,467.05 A420,420 0 0 1 91.60,401.95 L149.95,415.96 A360,360 0 0 0 141.11,471.75 Z",fill:"#0d1b2a",strip:"M81.29,467.05 A420,420 0 0 1 91.60,401.95 L99.38,403.82 A412,412 0 0 0 89.27,467.67 Z",stripColor:"#2979ff"},{wedge:"M91.60,401.95 A420,420 0 0 1 111.97,339.27 L167.40,362.23 A360,360 0 0 0 149.95,415.96 Z",fill:"#0d1b2a",strip:"M91.60,401.95 A420,420 0 0 1 111.97,339.27 L119.36,342.33 A412,412 0 0 0 99.38,403.82 Z",stripColor:"#2979ff"},{wedge:"M111.97,339.27 A420,420 0 0 1 141.89,280.55 L193.05,311.90 A360,360 0 0 0 167.40,362.23 Z",fill:"#4a148c",strip:null,stripColor:null},{wedge:"M141.89,280.55 A420,420 0 0 1 180.63,227.23 L226.25,266.20 A360,360 0 0 0 193.05,311.90 Z",fill:"#0d1b2a",strip:"M141.89,280.55 A420,420 0 0 1 180.63,227.23 L186.71,232.43 A412,412 0 0 0 148.71,284.73 Z",stripColor:"#2979ff"},{wedge:"M180.63,227.23 A420,420 0 0 1 227.23,180.63 L266.20,226.25 A360,360 0 0 0 226.25,266.20 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M227.23,180.63 A420,420 0 0 1 280.55,141.89 L311.90,193.05 A360,360 0 0 0 266.20,226.25 Z",fill:"#1b5e20",strip:null,stripColor:null},{wedge:"M280.55,141.89 A420,420 0 0 1 339.27,111.97 L362.23,167.40 A360,360 0 0 0 311.90,193.05 Z",fill:"#0d1b2a",strip:"M280.55,141.89 A420,420 0 0 1 339.27,111.97 L342.33,119.36 A412,412 0 0 0 284.73,148.71 Z",stripColor:"#e040fb"},{wedge:"M339.27,111.97 A420,420 0 0 1 401.95,91.60 L415.96,149.95 A360,360 0 0 0 362.23,167.40 Z",fill:"#b71c1c",strip:null,stripColor:null},{wedge:"M401.95,91.60 A420,420 0 0 1 467.05,81.29 L471.75,141.11 A360,360 0 0 0 415.96,149.95 Z",fill:"#0d1b2a",strip:"M401.95,91.60 A420,420 0 0 1 467.05,81.29 L467.67,89.27 A412,412 0 0 0 403.82,99.38 Z",stripColor:"#e040fb"}],yr=500,$U=390,GYA=$U-30,Ph=$U+30,lIA=40,RYA=360/lIA,uD=20,Jw=yr-Ph-uD,zN=(Ph+uD)*2,UYA={start:"🚀",planet:"🪐",asteroid:"☄",nebula:"🌌",wormhole:"🌀",tax:"💸",station:"🛰",jail:"🔒","go-to-jail":"🕳","free-parking":"🅿"},KYA=Array.from({length:lIA},(t,A)=>{const e=-90+A*RYA,i=e*Math.PI/180;return{cx:yr+$U*Math.cos(i),cy:yr+$U*Math.sin(i),baseRot:e+90}});function FYA(t,A){const e=((t+A)%360+360)%360,i=e>90&&e<270;return{angleDeg:i?t+180:t,flipped:i}}const bYA=({tiles:t,onTileClick:A,children:e,rotationDeg:i=0,mini:g=!1})=>Q.jsxs("svg",{viewBox:`${Jw} ${Jw} ${zN} ${zN}`,className:"zentara-svg",children:[Q.jsx("rect",{x:Jw,y:Jw,width:zN,height:zN,fill:"#050a18"}),Q.jsxs("g",{transform:`rotate(${i}, ${yr}, ${yr})`,className:g?"zentara-ring-group--mini":"zentara-ring-group",children:[!g&&MYA.map((I,n)=>Q.jsx("circle",{cx:I.cx,cy:I.cy,r:I.r,fill:"#ffffff",opacity:I.opacity},n)),Q.jsx("circle",{cx:yr,cy:yr,r:Ph,fill:"none",stroke:"#38bdf8",strokeWidth:1.5,opacity:.5}),NYA.map((I,n)=>Q.jsxs("g",{onClick:!g&&A?()=>A(t[n].id):void 0,className:!g&&A?"zentara-tile-group":void 0,children:[Q.jsx("path",{d:I.wedge,fill:I.fill,stroke:"#38bdf8",strokeWidth:1.5}),I.strip&&Q.jsx("path",{d:I.strip,fill:I.stripColor,opacity:.85})]},n)),!g&&t.length>0&&KYA.map((I,n)=>{const o=t[n];if(!o)return null;const{angleDeg:a,flipped:r}=FYA(I.baseRot,i),s=o.name.split(" "),B=7,E=(r?-1:1)*24,D=(r?1:-1)*((s.length-1)*B)/2,y=r?[...s].reverse():s;return Q.jsxs("g",{pointerEvents:"none",transform:`rotate(${a}, ${I.cx}, ${I.cy})`,children:[Q.jsx("text",{x:I.cx,y:I.cy,dy:E,textAnchor:"middle",dominantBaseline:"central",fontSize:16,className:"zentara-tile-symbol",children:UYA[o.type]}),Q.jsx("text",{x:I.cx,y:I.cy,textAnchor:"middle",dominantBaseline:"central",fontSize:6,fontWeight:600,fontFamily:"Teko, sans-serif",fill:"#fff",className:"zentara-tile-symbol",children:y.map((S,f)=>Q.jsx("tspan",{x:I.cx,dy:f===0?D:r?-B:B,children:S},f))})]},`label-${n}`)}),Q.jsx("circle",{cx:yr,cy:yr,r:GYA-12,fill:"#060b16",stroke:"none",opacity:.7}),e]}),g&&Q.jsx("path",{d:`M${yr},${yr} L${yr},${Jw} A${Ph+uD},${Ph+uD} 0 0 1 ${yr+(Ph+uD)*Math.sin(Math.PI)},${yr-(Ph+uD)*Math.cos(Math.PI)} Z`,fill:"rgba(123, 47, 242, 0.08)",stroke:"rgba(123, 47, 242, 0.3)",strokeWidth:3})]}),vYA=ke.memo(bYA),Iz=500,nz=420,oz=40,_YA=Array.from({length:oz},(t,A)=>{const e=A*360/oz-90,i=e*Math.PI/180;return{x:Iz+nz*Math.cos(i),y:Iz+nz*Math.sin(i),rotation:e+90}}),JYA={rocket:"M0,-12 L4,8 L0,4 L-4,8 Z",satellite:"M-6,-6 L6,-6 L6,6 L-6,6 Z M-10,0 L-6,0 M6,0 L10,0",shuttle:"M0,-10 L6,6 L0,2 L-6,6 Z",probe:"M0,-8 Q8,-8 8,0 Q8,8 0,8 Q-8,8 -8,0 Q-8,-8 0,-8 Z",ufo:"M-10,0 Q-10,-6 0,-6 Q10,-6 10,0 Q10,4 0,4 Q-10,4 -10,0 Z",meteor:"M0,-10 L3,-3 L10,-4 L5,2 L7,10 L0,5 L-7,10 L-5,2 L-10,-4 L-3,-3 Z"},LYA=({x:t,y:A,color:e,shape:i,isCurrentPlayer:g})=>Q.jsxs("g",{style:{transform:`translate(${t}px, ${A}px)`,transition:"transform 0.22s ease-out"},children:[g&&Q.jsxs("circle",{r:16,fill:"none",stroke:e,strokeWidth:2,opacity:.5,children:[Q.jsx("animate",{attributeName:"r",values:"14;18;14",dur:"1.2s",repeatCount:"indefinite"}),Q.jsx("animate",{attributeName:"opacity",values:"0.5;0.2;0.5",dur:"1.2s",repeatCount:"indefinite"})]}),Q.jsx("path",{d:JYA[i],fill:e,stroke:"#fff",strokeWidth:1.5})]}),qYA=ke.memo(LYA),UL=40,xYA=300,TYA=12;function YYA(t,A){if(A<=1)return{dx:0,dy:0};const e=2*Math.PI*t/A,i=10;return{dx:Math.cos(e)*i,dy:Math.sin(e)*i}}const HYA=({players:t,currentPlayerId:A})=>{const[e,i]=p.useState(()=>{const o={};for(const a of t)o[a.id]=a.tileIndex;return o}),g=p.useRef({}),I=p.useRef({});p.useEffect(()=>{for(const o of t){const a=o.tileIndex,r=g.current[o.id];if(r===void 0){g.current[o.id]=a,i(E=>({...E,[o.id]:a}));continue}if(r===a)continue;g.current[o.id]=a;const s=I.current[o.id];if(s){for(const E of s)clearTimeout(E);delete I.current[o.id]}const B=(a-r+UL)%UL;if(B===0||B>TYA){i(E=>({...E,[o.id]:a}));continue}const c=[];for(let E=1;E<=B;E++){const D=(r+E)%UL;c.push(setTimeout(()=>{i(y=>({...y,[o.id]:D}))},xYA*E))}I.current[o.id]=c}},[t]),p.useEffect(()=>()=>{for(const o of Object.values(I.current))for(const a of o)clearTimeout(a)},[]);const n=new Map;for(const o of t){if(o.bankrupt)continue;const a=e[o.id]??o.tileIndex,r=n.get(a)??[];r.push(o),n.set(a,r)}return Q.jsx("g",{id:"piece-layer",children:t.map(o=>{if(o.bankrupt)return null;const a=e[o.id]??o.tileIndex,r=_YA[a];if(!r)return null;const s=n.get(a)??[o],B=s.indexOf(o),{dx:c,dy:E}=YYA(B,s.length);return Q.jsx(qYA,{x:r.x+c,y:r.y+E,color:o.pieceColor,shape:o.piece,isCurrentPlayer:o.id===A},o.id)})})},OYA=ke.memo(HYA),PYA=40;function az(t){return 180-t*(360/PYA)}const jYA=1,ZYA=7,WYA=({gameState:t,onTileClick:A,children:e})=>{const i=t.players[t.currentPlayerIndex]?.id??"",g=t.players[t.currentPlayerIndex]?.tileIndex??0,[I,n]=p.useState(()=>az(g)),[o,a]=p.useState(!1),r=o?ZYA:jYA,s=p.useCallback(()=>a(m=>!m),[]),B=p.useCallback(m=>{m.propertyName==="scale"&&requestAnimationFrame(()=>n(U=>U+.001))},[]),c=p.useRef(g);p.useEffect(()=>{c.current!==g&&(c.current=g,n(az(g)))},[g]);const E=p.useRef(null),D=p.useRef({active:!1,startAngle:0,startRot:0}),y=p.useCallback((m,U)=>{const F=E.current;if(!F)return 0;const b=F.getBoundingClientRect(),K=b.left+b.width/2,R=b.top+b.height/2;return Math.atan2(U-R,m-K)*(180/Math.PI)},[]),S=p.useCallback(m=>{m.button===0&&(m.target.setPointerCapture?.(m.pointerId),D.current={active:!0,startAngle:y(m.clientX,m.clientY),startRot:I})},[y,I]),f=p.useCallback(m=>{if(!D.current.active)return;const F=y(m.clientX,m.clientY)-D.current.startAngle;n(D.current.startRot+F)},[y]),M=p.useCallback(()=>{D.current.active=!1},[]),k=p.useCallback(m=>{m.preventDefault()},[]);return Q.jsxs("div",{ref:E,onPointerDown:S,onPointerMove:f,onPointerUp:M,onPointerCancel:M,onWheel:k,className:"zentara-board-container",children:[Q.jsxs("div",{className:"zentara-board-inner",style:{scale:String(r)},onTransitionEnd:B,children:[Q.jsx(vYA,{tiles:t.board,onTileClick:A,rotationDeg:I,children:Q.jsx(OYA,{players:t.players,currentPlayerId:i})}),e]}),Q.jsx("button",{className:"zentara-zoom-btn zentara-zoom-toggle",onClick:s,"aria-label":o?"Zoom out":"Zoom in",children:o?"−":"+"})]})},zYA=ke.memo(WYA);let Z;const hg=new Array(128).fill(void 0);function Hg(t){return hg[t]}hg.push(void 0,null,!0,!1);let Om=hg.length;function Sn(t){Om===hg.length&&hg.push(hg.length+1);const A=Om;return Om=hg[A],hg[A]=t,A}function KL(t,A){try{return t.apply(this,A)}catch(e){Z.__wbindgen_export_0(Sn(e))}}function si(t){return t==null}let Th=null;function lo(){return(Th===null||Th.buffer.detached===!0||Th.buffer.detached===void 0&&Th.buffer!==Z.memory.buffer)&&(Th=new DataView(Z.memory.buffer)),Th}function K0(t){const A=Hg(t);return function(e){e<132||(hg[e]=Om,Om=e)}(t),A}const QIA=typeof TextDecoder<"u"?new TextDecoder("utf-8",{ignoreBOM:!0,fatal:!0}):{decode:()=>{throw Error("TextDecoder not available")}};typeof TextDecoder<"u"&&QIA.decode();let lm=null;function EIA(t,A){return t>>>=0,QIA.decode((lm!==null&&lm.byteLength!==0||(lm=new Uint8Array(Z.memory.buffer)),lm).subarray(t,t+A))}function qA(t,A){if(!(t instanceof A))throw new Error(`expected instance of ${A.name}`)}let CI=128;function NI(t){if(CI==1)throw new Error("out of js stack");return hg[--CI]=t,CI}let Qm=null;function uIA(){return Qm!==null&&Qm.byteLength!==0||(Qm=new Float32Array(Z.memory.buffer)),Qm}function rz(t,A){return t>>>=0,uIA().subarray(t/4,t/4+A)}let Em=null;function hIA(){return Em!==null&&Em.byteLength!==0||(Em=new Uint32Array(Z.memory.buffer)),Em}let os=0;function dh(t,A){const e=A(4*t.length,4)>>>0;return uIA().set(t,e/4),os=t.length,e}function VN(t,A){const e=A(4*t.length,4)>>>0;return hIA().set(t,e/4),os=t.length,e}const Cb=Object.freeze({LinX:0,0:"LinX",LinY:1,1:"LinY",LinZ:2,2:"LinZ",AngX:3,3:"AngX",AngY:4,4:"AngY",AngZ:5,5:"AngZ"}),IB=Object.freeze({Revolute:0,0:"Revolute",Fixed:1,1:"Fixed",Prismatic:2,2:"Prismatic",Rope:3,3:"Rope",Spring:4,4:"Spring",Spherical:5,5:"Spherical",Generic:6,6:"Generic"}),bo=Object.freeze({Ball:0,0:"Ball",Cuboid:1,1:"Cuboid",Capsule:2,2:"Capsule",Segment:3,3:"Segment",Polyline:4,4:"Polyline",Triangle:5,5:"Triangle",TriMesh:6,6:"TriMesh",HeightField:7,7:"HeightField",Compound:8,8:"Compound",ConvexPolyhedron:9,9:"ConvexPolyhedron",Cylinder:10,10:"Cylinder",Cone:11,11:"Cone",RoundCuboid:12,12:"RoundCuboid",RoundTriangle:13,13:"RoundTriangle",RoundCylinder:14,14:"RoundCylinder",RoundCone:15,15:"RoundCone",RoundConvexPolyhedron:16,16:"RoundConvexPolyhedron",HalfSpace:17,17:"HalfSpace"}),FL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawbroadphase_free(t>>>0,1));class Nd{static __wrap(A){A>>>=0;const e=Object.create(Nd.prototype);return e.__wbg_ptr=A,FL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,FL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawbroadphase_free(A,0)}constructor(){const A=Z.rawbroadphase_new();return this.__wbg_ptr=A>>>0,FL.register(this,this.__wbg_ptr,this),this}}const sz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawccdsolver_free(t>>>0,1));class yY{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,sz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawccdsolver_free(A,0)}constructor(){const A=Z.rawccdsolver_new();return this.__wbg_ptr=A>>>0,sz.register(this,this.__wbg_ptr,this),this}}const Cz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawcharactercollision_free(t>>>0,1));class dIA{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Cz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawcharactercollision_free(A,0)}constructor(){const A=Z.rawcharactercollision_new();return this.__wbg_ptr=A>>>0,Cz.register(this,this.__wbg_ptr,this),this}handle(){return Z.rawcharactercollision_handle(this.__wbg_ptr)}translationDeltaApplied(){const A=Z.rawcharactercollision_translationDeltaApplied(this.__wbg_ptr);return Ie.__wrap(A)}translationDeltaRemaining(){const A=Z.rawcharactercollision_translationDeltaRemaining(this.__wbg_ptr);return Ie.__wrap(A)}toi(){return Z.rawcharactercollision_toi(this.__wbg_ptr)}worldWitness1(){const A=Z.rawcharactercollision_worldWitness1(this.__wbg_ptr);return Ie.__wrap(A)}worldWitness2(){const A=Z.rawcharactercollision_worldWitness2(this.__wbg_ptr);return Ie.__wrap(A)}worldNormal1(){const A=Z.rawcharactercollision_worldNormal1(this.__wbg_ptr);return Ie.__wrap(A)}worldNormal2(){const A=Z.rawcharactercollision_worldNormal2(this.__wbg_ptr);return Ie.__wrap(A)}}const bL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawcolliderset_free(t>>>0,1));class qI{static __wrap(A){A>>>=0;const e=Object.create(qI.prototype);return e.__wbg_ptr=A,bL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,bL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawcolliderset_free(A,0)}coTranslation(A){const e=Z.rawcolliderset_coTranslation(this.__wbg_ptr,A);return Ie.__wrap(e)}coRotation(A){const e=Z.rawcolliderset_coRotation(this.__wbg_ptr,A);return Pi.__wrap(e)}coSetTranslation(A,e,i,g){Z.rawcolliderset_coSetTranslation(this.__wbg_ptr,A,e,i,g)}coSetTranslationWrtParent(A,e,i,g){Z.rawcolliderset_coSetTranslationWrtParent(this.__wbg_ptr,A,e,i,g)}coSetRotation(A,e,i,g,I){Z.rawcolliderset_coSetRotation(this.__wbg_ptr,A,e,i,g,I)}coSetRotationWrtParent(A,e,i,g,I){Z.rawcolliderset_coSetRotationWrtParent(this.__wbg_ptr,A,e,i,g,I)}coIsSensor(A){return Z.rawcolliderset_coIsSensor(this.__wbg_ptr,A)!==0}coShapeType(A){return Z.rawcolliderset_coShapeType(this.__wbg_ptr,A)}coHalfspaceNormal(A){const e=Z.rawcolliderset_coHalfspaceNormal(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}coHalfExtents(A){const e=Z.rawcolliderset_coHalfExtents(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}coSetHalfExtents(A,e){qA(e,Ie),Z.rawcolliderset_coSetHalfExtents(this.__wbg_ptr,A,e.__wbg_ptr)}coRadius(A){const e=Z.rawcolliderset_coRadius(this.__wbg_ptr,A);return e===4294967297?void 0:e}coSetRadius(A,e){Z.rawcolliderset_coSetRadius(this.__wbg_ptr,A,e)}coHalfHeight(A){const e=Z.rawcolliderset_coHalfHeight(this.__wbg_ptr,A);return e===4294967297?void 0:e}coSetHalfHeight(A,e){Z.rawcolliderset_coSetHalfHeight(this.__wbg_ptr,A,e)}coRoundRadius(A){const e=Z.rawcolliderset_coRoundRadius(this.__wbg_ptr,A);return e===4294967297?void 0:e}coSetRoundRadius(A,e){Z.rawcolliderset_coSetRoundRadius(this.__wbg_ptr,A,e)}coVertices(A){try{const g=Z.__wbindgen_add_to_stack_pointer(-16);Z.rawcolliderset_coVertices(g,this.__wbg_ptr,A);var e=lo().getInt32(g+0,!0),i=lo().getInt32(g+4,!0);let I;return e!==0&&(I=rz(e,i).slice(),Z.__wbindgen_export_1(e,4*i,4)),I}finally{Z.__wbindgen_add_to_stack_pointer(16)}}coIndices(A){try{const g=Z.__wbindgen_add_to_stack_pointer(-16);Z.rawcolliderset_coIndices(g,this.__wbg_ptr,A);var e=lo().getInt32(g+0,!0),i=lo().getInt32(g+4,!0);let I;return e!==0&&(I=function(n,o){return n>>>=0,hIA().subarray(n/4,n/4+o)}(e,i).slice(),Z.__wbindgen_export_1(e,4*i,4)),I}finally{Z.__wbindgen_add_to_stack_pointer(16)}}coTriMeshFlags(A){const e=Z.rawcolliderset_coTriMeshFlags(this.__wbg_ptr,A);return e===4294967297?void 0:e}coHeightFieldFlags(A){const e=Z.rawcolliderset_coHeightFieldFlags(this.__wbg_ptr,A);return e===4294967297?void 0:e}coHeightfieldHeights(A){try{const g=Z.__wbindgen_add_to_stack_pointer(-16);Z.rawcolliderset_coHeightfieldHeights(g,this.__wbg_ptr,A);var e=lo().getInt32(g+0,!0),i=lo().getInt32(g+4,!0);let I;return e!==0&&(I=rz(e,i).slice(),Z.__wbindgen_export_1(e,4*i,4)),I}finally{Z.__wbindgen_add_to_stack_pointer(16)}}coHeightfieldScale(A){const e=Z.rawcolliderset_coHeightfieldScale(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}coHeightfieldNRows(A){const e=Z.rawcolliderset_coHeightfieldNRows(this.__wbg_ptr,A);return e===4294967297?void 0:e}coHeightfieldNCols(A){const e=Z.rawcolliderset_coHeightfieldNCols(this.__wbg_ptr,A);return e===4294967297?void 0:e}coParent(A){try{const g=Z.__wbindgen_add_to_stack_pointer(-16);Z.rawcolliderset_coParent(g,this.__wbg_ptr,A);var e=lo().getInt32(g+0,!0),i=lo().getFloat64(g+8,!0);return e===0?void 0:i}finally{Z.__wbindgen_add_to_stack_pointer(16)}}coSetEnabled(A,e){Z.rawcolliderset_coSetEnabled(this.__wbg_ptr,A,e)}coIsEnabled(A){return Z.rawcolliderset_coIsEnabled(this.__wbg_ptr,A)!==0}coSetContactSkin(A,e){Z.rawcolliderset_coSetContactSkin(this.__wbg_ptr,A,e)}coContactSkin(A){return Z.rawcolliderset_coContactSkin(this.__wbg_ptr,A)}coFriction(A){return Z.rawcolliderset_coFriction(this.__wbg_ptr,A)}coRestitution(A){return Z.rawcolliderset_coRestitution(this.__wbg_ptr,A)}coDensity(A){return Z.rawcolliderset_coDensity(this.__wbg_ptr,A)}coMass(A){return Z.rawcolliderset_coMass(this.__wbg_ptr,A)}coVolume(A){return Z.rawcolliderset_coVolume(this.__wbg_ptr,A)}coCollisionGroups(A){return Z.rawcolliderset_coCollisionGroups(this.__wbg_ptr,A)>>>0}coSolverGroups(A){return Z.rawcolliderset_coSolverGroups(this.__wbg_ptr,A)>>>0}coActiveHooks(A){return Z.rawcolliderset_coActiveHooks(this.__wbg_ptr,A)>>>0}coActiveCollisionTypes(A){return Z.rawcolliderset_coActiveCollisionTypes(this.__wbg_ptr,A)}coActiveEvents(A){return Z.rawcolliderset_coActiveEvents(this.__wbg_ptr,A)>>>0}coContactForceEventThreshold(A){return Z.rawcolliderset_coContactForceEventThreshold(this.__wbg_ptr,A)}coContainsPoint(A,e){return qA(e,Ie),Z.rawcolliderset_coContainsPoint(this.__wbg_ptr,A,e.__wbg_ptr)!==0}coCastShape(A,e,i,g,I,n,o,a,r){qA(e,Ie),qA(i,gi),qA(g,Ie),qA(I,Pi),qA(n,Ie);const s=Z.rawcolliderset_coCastShape(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n.__wbg_ptr,o,a,r);return s===0?void 0:Eb.__wrap(s)}coCastCollider(A,e,i,g,I,n,o){qA(e,Ie),qA(g,Ie);const a=Z.rawcolliderset_coCastCollider(this.__wbg_ptr,A,e.__wbg_ptr,i,g.__wbg_ptr,I,n,o);return a===0?void 0:Bb.__wrap(a)}coIntersectsShape(A,e,i,g){return qA(e,gi),qA(i,Ie),qA(g,Pi),Z.rawcolliderset_coIntersectsShape(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr)!==0}coContactShape(A,e,i,g,I){qA(e,gi),qA(i,Ie),qA(g,Pi);const n=Z.rawcolliderset_coContactShape(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I);return n===0?void 0:F0.__wrap(n)}coContactCollider(A,e,i){const g=Z.rawcolliderset_coContactCollider(this.__wbg_ptr,A,e,i);return g===0?void 0:F0.__wrap(g)}coProjectPoint(A,e,i){qA(e,Ie);const g=Z.rawcolliderset_coProjectPoint(this.__wbg_ptr,A,e.__wbg_ptr,i);return cb.__wrap(g)}coIntersectsRay(A,e,i,g){return qA(e,Ie),qA(i,Ie),Z.rawcolliderset_coIntersectsRay(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g)!==0}coCastRay(A,e,i,g,I){return qA(e,Ie),qA(i,Ie),Z.rawcolliderset_coCastRay(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g,I)}coCastRayAndGetNormal(A,e,i,g,I){qA(e,Ie),qA(i,Ie);const n=Z.rawcolliderset_coCastRayAndGetNormal(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g,I);return n===0?void 0:Qb.__wrap(n)}coSetSensor(A,e){Z.rawcolliderset_coSetSensor(this.__wbg_ptr,A,e)}coSetRestitution(A,e){Z.rawcolliderset_coSetRestitution(this.__wbg_ptr,A,e)}coSetFriction(A,e){Z.rawcolliderset_coSetFriction(this.__wbg_ptr,A,e)}coFrictionCombineRule(A){return Z.rawcolliderset_coFrictionCombineRule(this.__wbg_ptr,A)>>>0}coSetFrictionCombineRule(A,e){Z.rawcolliderset_coSetFrictionCombineRule(this.__wbg_ptr,A,e)}coRestitutionCombineRule(A){return Z.rawcolliderset_coRestitutionCombineRule(this.__wbg_ptr,A)>>>0}coSetRestitutionCombineRule(A,e){Z.rawcolliderset_coSetRestitutionCombineRule(this.__wbg_ptr,A,e)}coSetCollisionGroups(A,e){Z.rawcolliderset_coSetCollisionGroups(this.__wbg_ptr,A,e)}coSetSolverGroups(A,e){Z.rawcolliderset_coSetSolverGroups(this.__wbg_ptr,A,e)}coSetActiveHooks(A,e){Z.rawcolliderset_coSetActiveHooks(this.__wbg_ptr,A,e)}coSetActiveEvents(A,e){Z.rawcolliderset_coSetActiveEvents(this.__wbg_ptr,A,e)}coSetActiveCollisionTypes(A,e){Z.rawcolliderset_coSetActiveCollisionTypes(this.__wbg_ptr,A,e)}coSetShape(A,e){qA(e,gi),Z.rawcolliderset_coSetShape(this.__wbg_ptr,A,e.__wbg_ptr)}coSetContactForceEventThreshold(A,e){Z.rawcolliderset_coSetContactForceEventThreshold(this.__wbg_ptr,A,e)}coSetDensity(A,e){Z.rawcolliderset_coSetDensity(this.__wbg_ptr,A,e)}coSetMass(A,e){Z.rawcolliderset_coSetMass(this.__wbg_ptr,A,e)}coSetMassProperties(A,e,i,g,I){qA(i,Ie),qA(g,Ie),qA(I,Pi),Z.rawcolliderset_coSetMassProperties(this.__wbg_ptr,A,e,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr)}constructor(){const A=Z.rawcolliderset_new();return this.__wbg_ptr=A>>>0,bL.register(this,this.__wbg_ptr,this),this}len(){return Z.rawcolliderset_len(this.__wbg_ptr)>>>0}contains(A){return Z.rawcolliderset_contains(this.__wbg_ptr,A)!==0}createCollider(A,e,i,g,I,n,o,a,r,s,B,c,E,D,y,S,f,M,k,m,U,F,b,K,R){try{const x=Z.__wbindgen_add_to_stack_pointer(-16);qA(e,gi),qA(i,Ie),qA(g,Pi),qA(o,Ie),qA(a,Ie),qA(r,Pi),qA(R,dI),Z.rawcolliderset_createCollider(x,this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n,o.__wbg_ptr,a.__wbg_ptr,r.__wbg_ptr,s,B,c,E,D,y,S,f,M,k,m,U,F,b,K,R.__wbg_ptr);var G=lo().getInt32(x+0,!0),J=lo().getFloat64(x+8,!0);return G===0?void 0:J}finally{Z.__wbindgen_add_to_stack_pointer(16)}}remove(A,e,i,g){qA(e,fQ),qA(i,dI),Z.rawcolliderset_remove(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g)}isHandleValid(A){return Z.rawcolliderset_contains(this.__wbg_ptr,A)!==0}forEachColliderHandle(A){try{Z.rawcolliderset_forEachColliderHandle(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}}const Bz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawcollidershapecasthit_free(t>>>0,1));class Bb{static __wrap(A){A>>>=0;const e=Object.create(Bb.prototype);return e.__wbg_ptr=A,Bz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Bz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawcollidershapecasthit_free(A,0)}colliderHandle(){return Z.rawcharactercollision_handle(this.__wbg_ptr)}time_of_impact(){return Z.rawcollidershapecasthit_time_of_impact(this.__wbg_ptr)}witness1(){const A=Z.rawcollidershapecasthit_witness1(this.__wbg_ptr);return Ie.__wrap(A)}witness2(){const A=Z.rawcollidershapecasthit_witness2(this.__wbg_ptr);return Ie.__wrap(A)}normal1(){const A=Z.rawcharactercollision_translationDeltaApplied(this.__wbg_ptr);return Ie.__wrap(A)}normal2(){const A=Z.rawcharactercollision_translationDeltaRemaining(this.__wbg_ptr);return Ie.__wrap(A)}}const cz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawcontactforceevent_free(t>>>0,1));class nP{static __wrap(A){A>>>=0;const e=Object.create(nP.prototype);return e.__wbg_ptr=A,cz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,cz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawcontactforceevent_free(A,0)}collider1(){return Z.rawcharactercollision_handle(this.__wbg_ptr)}collider2(){return Z.rawcontactforceevent_collider2(this.__wbg_ptr)}total_force(){const A=Z.rawcontactforceevent_total_force(this.__wbg_ptr);return Ie.__wrap(A)}total_force_magnitude(){return Z.rawcontactforceevent_total_force_magnitude(this.__wbg_ptr)}max_force_direction(){const A=Z.rawcontactforceevent_max_force_direction(this.__wbg_ptr);return Ie.__wrap(A)}max_force_magnitude(){return Z.rawcontactforceevent_max_force_magnitude(this.__wbg_ptr)}}const lz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawcontactmanifold_free(t>>>0,1));let VYA=class pIA{static __wrap(A){A>>>=0;const e=Object.create(pIA.prototype);return e.__wbg_ptr=A,lz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,lz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawcontactmanifold_free(A,0)}normal(){const A=Z.rawcontactmanifold_normal(this.__wbg_ptr);return Ie.__wrap(A)}local_n1(){const A=Z.rawcontactmanifold_local_n1(this.__wbg_ptr);return Ie.__wrap(A)}local_n2(){const A=Z.rawcontactmanifold_local_n2(this.__wbg_ptr);return Ie.__wrap(A)}subshape1(){return Z.rawcontactmanifold_subshape1(this.__wbg_ptr)>>>0}subshape2(){return Z.rawcontactmanifold_subshape2(this.__wbg_ptr)>>>0}num_contacts(){return Z.rawcontactmanifold_num_contacts(this.__wbg_ptr)>>>0}contact_local_p1(A){const e=Z.rawcontactmanifold_contact_local_p1(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}contact_local_p2(A){const e=Z.rawcontactmanifold_contact_local_p2(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}contact_dist(A){return Z.rawcontactmanifold_contact_dist(this.__wbg_ptr,A)}contact_fid1(A){return Z.rawcontactmanifold_contact_fid1(this.__wbg_ptr,A)>>>0}contact_fid2(A){return Z.rawcontactmanifold_contact_fid2(this.__wbg_ptr,A)>>>0}contact_impulse(A){return Z.rawcontactmanifold_contact_impulse(this.__wbg_ptr,A)}contact_tangent_impulse_x(A){return Z.rawcontactmanifold_contact_tangent_impulse_x(this.__wbg_ptr,A)}contact_tangent_impulse_y(A){return Z.rawcontactmanifold_contact_tangent_impulse_y(this.__wbg_ptr,A)}num_solver_contacts(){return Z.rawcontactmanifold_num_solver_contacts(this.__wbg_ptr)>>>0}solver_contact_point(A){const e=Z.rawcontactmanifold_solver_contact_point(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}solver_contact_dist(A){return Z.rawcontactmanifold_solver_contact_dist(this.__wbg_ptr,A)}solver_contact_friction(A){return Z.rawcontactmanifold_solver_contact_friction(this.__wbg_ptr,A)}solver_contact_restitution(A){return Z.rawcontactmanifold_solver_contact_restitution(this.__wbg_ptr,A)}solver_contact_tangent_velocity(A){const e=Z.rawcontactmanifold_solver_contact_tangent_velocity(this.__wbg_ptr,A);return Ie.__wrap(e)}};const Qz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawcontactpair_free(t>>>0,1));let XYA=class fIA{static __wrap(A){A>>>=0;const e=Object.create(fIA.prototype);return e.__wbg_ptr=A,Qz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Qz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawcontactpair_free(A,0)}collider1(){return Z.rawcontactpair_collider1(this.__wbg_ptr)}collider2(){return Z.rawcontactpair_collider2(this.__wbg_ptr)}numContactManifolds(){return Z.rawcontactpair_numContactManifolds(this.__wbg_ptr)>>>0}contactManifold(A){const e=Z.rawcontactpair_contactManifold(this.__wbg_ptr,A);return e===0?void 0:VYA.__wrap(e)}};const Ez=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawdebugrenderpipeline_free(t>>>0,1));let $YA=class{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Ez.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawdebugrenderpipeline_free(A,0)}constructor(){const A=Z.rawdebugrenderpipeline_new();return this.__wbg_ptr=A>>>0,Ez.register(this,this.__wbg_ptr,this),this}vertices(){return K0(Z.rawdebugrenderpipeline_vertices(this.__wbg_ptr))}colors(){return K0(Z.rawdebugrenderpipeline_colors(this.__wbg_ptr))}render(A,e,i,g,I){qA(A,dI),qA(e,qI),qA(i,pQ),qA(g,DQ),qA(I,au),Z.rawdebugrenderpipeline_render(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr)}};const uz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawdeserializedworld_free(t>>>0,1));let A2A=class DIA{static __wrap(A){A>>>=0;const e=Object.create(DIA.prototype);return e.__wbg_ptr=A,uz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,uz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawdeserializedworld_free(A,0)}takeGravity(){const A=Z.rawdeserializedworld_takeGravity(this.__wbg_ptr);return A===0?void 0:Ie.__wrap(A)}takeIntegrationParameters(){const A=Z.rawdeserializedworld_takeIntegrationParameters(this.__wbg_ptr);return A===0?void 0:Gd.__wrap(A)}takeIslandManager(){const A=Z.rawdeserializedworld_takeIslandManager(this.__wbg_ptr);return A===0?void 0:fQ.__wrap(A)}takeBroadPhase(){const A=Z.rawdeserializedworld_takeBroadPhase(this.__wbg_ptr);return A===0?void 0:Nd.__wrap(A)}takeNarrowPhase(){const A=Z.rawdeserializedworld_takeNarrowPhase(this.__wbg_ptr);return A===0?void 0:au.__wrap(A)}takeBodies(){const A=Z.rawdeserializedworld_takeBodies(this.__wbg_ptr);return A===0?void 0:dI.__wrap(A)}takeColliders(){const A=Z.rawdeserializedworld_takeColliders(this.__wbg_ptr);return A===0?void 0:qI.__wrap(A)}takeImpulseJoints(){const A=Z.rawdeserializedworld_takeImpulseJoints(this.__wbg_ptr);return A===0?void 0:pQ.__wrap(A)}takeMultibodyJoints(){const A=Z.rawdeserializedworld_takeMultibodyJoints(this.__wbg_ptr);return A===0?void 0:DQ.__wrap(A)}};const hz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawdynamicraycastvehiclecontroller_free(t>>>0,1));class e2A{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,hz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawdynamicraycastvehiclecontroller_free(A,0)}constructor(A){const e=Z.rawdynamicraycastvehiclecontroller_new(A);return this.__wbg_ptr=e>>>0,hz.register(this,this.__wbg_ptr,this),this}current_vehicle_speed(){return Z.rawdynamicraycastvehiclecontroller_current_vehicle_speed(this.__wbg_ptr)}chassis(){return Z.rawdynamicraycastvehiclecontroller_chassis(this.__wbg_ptr)}index_up_axis(){return Z.rawdynamicraycastvehiclecontroller_index_up_axis(this.__wbg_ptr)>>>0}set_index_up_axis(A){Z.rawdynamicraycastvehiclecontroller_set_index_up_axis(this.__wbg_ptr,A)}index_forward_axis(){return Z.rawdynamicraycastvehiclecontroller_index_forward_axis(this.__wbg_ptr)>>>0}set_index_forward_axis(A){Z.rawdynamicraycastvehiclecontroller_set_index_forward_axis(this.__wbg_ptr,A)}add_wheel(A,e,i,g,I){qA(A,Ie),qA(e,Ie),qA(i,Ie),Z.rawdynamicraycastvehiclecontroller_add_wheel(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g,I)}num_wheels(){return Z.rawdynamicraycastvehiclecontroller_num_wheels(this.__wbg_ptr)>>>0}update_vehicle(A,e,i,g,I,n,o){try{qA(e,dI),qA(i,qI),qA(g,oP),Z.rawdynamicraycastvehiclecontroller_update_vehicle(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,si(n)?4294967297:n>>>0,NI(o))}finally{hg[CI++]=void 0}}wheel_chassis_connection_point_cs(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_chassis_connection_point_cs(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}set_wheel_chassis_connection_point_cs(A,e){qA(e,Ie),Z.rawdynamicraycastvehiclecontroller_set_wheel_chassis_connection_point_cs(this.__wbg_ptr,A,e.__wbg_ptr)}wheel_suspension_rest_length(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_suspension_rest_length(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_suspension_rest_length(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_suspension_rest_length(this.__wbg_ptr,A,e)}wheel_max_suspension_travel(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_max_suspension_travel(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_max_suspension_travel(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_max_suspension_travel(this.__wbg_ptr,A,e)}wheel_radius(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_radius(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_radius(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_radius(this.__wbg_ptr,A,e)}wheel_suspension_stiffness(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_suspension_stiffness(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_suspension_stiffness(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_suspension_stiffness(this.__wbg_ptr,A,e)}wheel_suspension_compression(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_suspension_compression(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_suspension_compression(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_suspension_compression(this.__wbg_ptr,A,e)}wheel_suspension_relaxation(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_suspension_relaxation(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_suspension_relaxation(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_suspension_relaxation(this.__wbg_ptr,A,e)}wheel_max_suspension_force(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_max_suspension_force(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_max_suspension_force(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_max_suspension_force(this.__wbg_ptr,A,e)}wheel_brake(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_brake(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_brake(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_brake(this.__wbg_ptr,A,e)}wheel_steering(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_steering(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_steering(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_steering(this.__wbg_ptr,A,e)}wheel_engine_force(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_engine_force(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_engine_force(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_engine_force(this.__wbg_ptr,A,e)}wheel_direction_cs(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_direction_cs(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}set_wheel_direction_cs(A,e){qA(e,Ie),Z.rawdynamicraycastvehiclecontroller_set_wheel_direction_cs(this.__wbg_ptr,A,e.__wbg_ptr)}wheel_axle_cs(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_axle_cs(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}set_wheel_axle_cs(A,e){qA(e,Ie),Z.rawdynamicraycastvehiclecontroller_set_wheel_axle_cs(this.__wbg_ptr,A,e.__wbg_ptr)}wheel_friction_slip(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_friction_slip(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_friction_slip(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_friction_slip(this.__wbg_ptr,A,e)}wheel_side_friction_stiffness(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_side_friction_stiffness(this.__wbg_ptr,A);return e===4294967297?void 0:e}set_wheel_side_friction_stiffness(A,e){Z.rawdynamicraycastvehiclecontroller_set_wheel_side_friction_stiffness(this.__wbg_ptr,A,e)}wheel_rotation(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_rotation(this.__wbg_ptr,A);return e===4294967297?void 0:e}wheel_forward_impulse(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_forward_impulse(this.__wbg_ptr,A);return e===4294967297?void 0:e}wheel_side_impulse(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_side_impulse(this.__wbg_ptr,A);return e===4294967297?void 0:e}wheel_suspension_force(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_suspension_force(this.__wbg_ptr,A);return e===4294967297?void 0:e}wheel_contact_normal_ws(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_contact_normal_ws(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}wheel_contact_point_ws(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_contact_point_ws(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}wheel_suspension_length(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_suspension_length(this.__wbg_ptr,A);return e===4294967297?void 0:e}wheel_hard_point_ws(A){const e=Z.rawdynamicraycastvehiclecontroller_wheel_hard_point_ws(this.__wbg_ptr,A);return e===0?void 0:Ie.__wrap(e)}wheel_is_in_contact(A){return Z.rawdynamicraycastvehiclecontroller_wheel_is_in_contact(this.__wbg_ptr,A)!==0}wheel_ground_object(A){try{const g=Z.__wbindgen_add_to_stack_pointer(-16);Z.rawdynamicraycastvehiclecontroller_wheel_ground_object(g,this.__wbg_ptr,A);var e=lo().getInt32(g+0,!0),i=lo().getFloat64(g+8,!0);return e===0?void 0:i}finally{Z.__wbindgen_add_to_stack_pointer(16)}}}const dz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_raweventqueue_free(t>>>0,1));class yIA{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,dz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_raweventqueue_free(A,0)}constructor(A){const e=Z.raweventqueue_new(A);return this.__wbg_ptr=e>>>0,dz.register(this,this.__wbg_ptr,this),this}drainCollisionEvents(A){try{Z.raweventqueue_drainCollisionEvents(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}drainContactForceEvents(A){try{Z.raweventqueue_drainContactForceEvents(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}clear(){Z.raweventqueue_clear(this.__wbg_ptr)}}const pz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawgenericjoint_free(t>>>0,1));class Qo{static __wrap(A){A>>>=0;const e=Object.create(Qo.prototype);return e.__wbg_ptr=A,pz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,pz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawgenericjoint_free(A,0)}static generic(A,e,i,g){qA(A,Ie),qA(e,Ie),qA(i,Ie);const I=Z.rawgenericjoint_generic(A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g);return I===0?void 0:Qo.__wrap(I)}static spring(A,e,i,g,I){qA(g,Ie),qA(I,Ie);const n=Z.rawgenericjoint_spring(A,e,i,g.__wbg_ptr,I.__wbg_ptr);return Qo.__wrap(n)}static rope(A,e,i){qA(e,Ie),qA(i,Ie);const g=Z.rawgenericjoint_rope(A,e.__wbg_ptr,i.__wbg_ptr);return Qo.__wrap(g)}static spherical(A,e){qA(A,Ie),qA(e,Ie);const i=Z.rawgenericjoint_spherical(A.__wbg_ptr,e.__wbg_ptr);return Qo.__wrap(i)}static prismatic(A,e,i,g,I,n){qA(A,Ie),qA(e,Ie),qA(i,Ie);const o=Z.rawgenericjoint_prismatic(A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g,I,n);return o===0?void 0:Qo.__wrap(o)}static fixed(A,e,i,g){qA(A,Ie),qA(e,Pi),qA(i,Ie),qA(g,Pi);const I=Z.rawgenericjoint_fixed(A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr);return Qo.__wrap(I)}static revolute(A,e,i){qA(A,Ie),qA(e,Ie),qA(i,Ie);const g=Z.rawgenericjoint_revolute(A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr);return g===0?void 0:Qo.__wrap(g)}}const vL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawimpulsejointset_free(t>>>0,1));class pQ{static __wrap(A){A>>>=0;const e=Object.create(pQ.prototype);return e.__wbg_ptr=A,vL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,vL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawimpulsejointset_free(A,0)}jointType(A){return Z.rawimpulsejointset_jointType(this.__wbg_ptr,A)}jointBodyHandle1(A){return Z.rawimpulsejointset_jointBodyHandle1(this.__wbg_ptr,A)}jointBodyHandle2(A){return Z.rawimpulsejointset_jointBodyHandle2(this.__wbg_ptr,A)}jointFrameX1(A){const e=Z.rawimpulsejointset_jointFrameX1(this.__wbg_ptr,A);return Pi.__wrap(e)}jointFrameX2(A){const e=Z.rawimpulsejointset_jointFrameX2(this.__wbg_ptr,A);return Pi.__wrap(e)}jointAnchor1(A){const e=Z.rawimpulsejointset_jointAnchor1(this.__wbg_ptr,A);return Ie.__wrap(e)}jointAnchor2(A){const e=Z.rawimpulsejointset_jointAnchor2(this.__wbg_ptr,A);return Ie.__wrap(e)}jointSetAnchor1(A,e){qA(e,Ie),Z.rawimpulsejointset_jointSetAnchor1(this.__wbg_ptr,A,e.__wbg_ptr)}jointSetAnchor2(A,e){qA(e,Ie),Z.rawimpulsejointset_jointSetAnchor2(this.__wbg_ptr,A,e.__wbg_ptr)}jointContactsEnabled(A){return Z.rawimpulsejointset_jointContactsEnabled(this.__wbg_ptr,A)!==0}jointSetContactsEnabled(A,e){Z.rawimpulsejointset_jointSetContactsEnabled(this.__wbg_ptr,A,e)}jointLimitsEnabled(A,e){return Z.rawimpulsejointset_jointLimitsEnabled(this.__wbg_ptr,A,e)!==0}jointLimitsMin(A,e){return Z.rawimpulsejointset_jointLimitsMin(this.__wbg_ptr,A,e)}jointLimitsMax(A,e){return Z.rawimpulsejointset_jointLimitsMax(this.__wbg_ptr,A,e)}jointSetLimits(A,e,i,g){Z.rawimpulsejointset_jointSetLimits(this.__wbg_ptr,A,e,i,g)}jointConfigureMotorModel(A,e,i){Z.rawimpulsejointset_jointConfigureMotorModel(this.__wbg_ptr,A,e,i)}jointConfigureMotorVelocity(A,e,i,g){Z.rawimpulsejointset_jointConfigureMotorVelocity(this.__wbg_ptr,A,e,i,g)}jointConfigureMotorPosition(A,e,i,g,I){Z.rawimpulsejointset_jointConfigureMotorPosition(this.__wbg_ptr,A,e,i,g,I)}jointConfigureMotor(A,e,i,g,I,n){Z.rawimpulsejointset_jointConfigureMotor(this.__wbg_ptr,A,e,i,g,I,n)}constructor(){const A=Z.rawimpulsejointset_new();return this.__wbg_ptr=A>>>0,vL.register(this,this.__wbg_ptr,this),this}createJoint(A,e,i,g){return qA(A,Qo),Z.rawimpulsejointset_createJoint(this.__wbg_ptr,A.__wbg_ptr,e,i,g)}remove(A,e){Z.rawimpulsejointset_remove(this.__wbg_ptr,A,e)}len(){return Z.rawimpulsejointset_len(this.__wbg_ptr)>>>0}contains(A){return Z.rawimpulsejointset_contains(this.__wbg_ptr,A)!==0}forEachJointHandle(A){try{Z.rawimpulsejointset_forEachJointHandle(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}forEachJointAttachedToRigidBody(A,e){try{Z.rawimpulsejointset_forEachJointAttachedToRigidBody(this.__wbg_ptr,A,NI(e))}finally{hg[CI++]=void 0}}}const _L=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawintegrationparameters_free(t>>>0,1));class Gd{static __wrap(A){A>>>=0;const e=Object.create(Gd.prototype);return e.__wbg_ptr=A,_L.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,_L.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawintegrationparameters_free(A,0)}constructor(){const A=Z.rawintegrationparameters_new();return this.__wbg_ptr=A>>>0,_L.register(this,this.__wbg_ptr,this),this}get dt(){return Z.rawintegrationparameters_dt(this.__wbg_ptr)}get contact_erp(){return Z.rawintegrationparameters_contact_erp(this.__wbg_ptr)}get normalizedAllowedLinearError(){return Z.rawintegrationparameters_normalizedAllowedLinearError(this.__wbg_ptr)}get normalizedPredictionDistance(){return Z.rawcontactforceevent_max_force_magnitude(this.__wbg_ptr)}get numSolverIterations(){return Z.rawintegrationparameters_numSolverIterations(this.__wbg_ptr)>>>0}get numAdditionalFrictionIterations(){return Z.rawintegrationparameters_numAdditionalFrictionIterations(this.__wbg_ptr)>>>0}get numInternalPgsIterations(){return Z.rawintegrationparameters_numInternalPgsIterations(this.__wbg_ptr)>>>0}get minIslandSize(){return Z.rawimpulsejointset_len(this.__wbg_ptr)>>>0}get maxCcdSubsteps(){return Z.rawintegrationparameters_maxCcdSubsteps(this.__wbg_ptr)>>>0}get lengthUnit(){return Z.rawintegrationparameters_lengthUnit(this.__wbg_ptr)}set dt(A){Z.rawintegrationparameters_set_dt(this.__wbg_ptr,A)}set contact_natural_frequency(A){Z.rawintegrationparameters_set_contact_natural_frequency(this.__wbg_ptr,A)}set normalizedAllowedLinearError(A){Z.rawintegrationparameters_set_normalizedAllowedLinearError(this.__wbg_ptr,A)}set normalizedPredictionDistance(A){Z.rawintegrationparameters_set_normalizedPredictionDistance(this.__wbg_ptr,A)}set numSolverIterations(A){Z.rawintegrationparameters_set_numSolverIterations(this.__wbg_ptr,A)}set numAdditionalFrictionIterations(A){Z.rawintegrationparameters_set_numAdditionalFrictionIterations(this.__wbg_ptr,A)}set numInternalPgsIterations(A){Z.rawintegrationparameters_set_numInternalPgsIterations(this.__wbg_ptr,A)}set minIslandSize(A){Z.rawintegrationparameters_set_minIslandSize(this.__wbg_ptr,A)}set maxCcdSubsteps(A){Z.rawintegrationparameters_set_maxCcdSubsteps(this.__wbg_ptr,A)}set lengthUnit(A){Z.rawintegrationparameters_set_lengthUnit(this.__wbg_ptr,A)}switchToStandardPgsSolver(){Z.rawintegrationparameters_switchToStandardPgsSolver(this.__wbg_ptr)}switchToSmallStepsPgsSolver(){Z.rawintegrationparameters_switchToSmallStepsPgsSolver(this.__wbg_ptr)}switchToSmallStepsPgsSolverWithoutWarmstart(){Z.rawintegrationparameters_switchToSmallStepsPgsSolverWithoutWarmstart(this.__wbg_ptr)}}const JL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawislandmanager_free(t>>>0,1));class fQ{static __wrap(A){A>>>=0;const e=Object.create(fQ.prototype);return e.__wbg_ptr=A,JL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,JL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawislandmanager_free(A,0)}constructor(){const A=Z.rawislandmanager_new();return this.__wbg_ptr=A>>>0,JL.register(this,this.__wbg_ptr,this),this}forEachActiveRigidBodyHandle(A){try{Z.rawislandmanager_forEachActiveRigidBodyHandle(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}}const fz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawkinematiccharactercontroller_free(t>>>0,1));class t2A{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,fz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawkinematiccharactercontroller_free(A,0)}constructor(A){const e=Z.rawkinematiccharactercontroller_new(A);return this.__wbg_ptr=e>>>0,fz.register(this,this.__wbg_ptr,this),this}up(){const A=Z.rawcharactercollision_translationDeltaApplied(this.__wbg_ptr);return Ie.__wrap(A)}setUp(A){qA(A,Ie),Z.rawkinematiccharactercontroller_setUp(this.__wbg_ptr,A.__wbg_ptr)}normalNudgeFactor(){return Z.rawkinematiccharactercontroller_normalNudgeFactor(this.__wbg_ptr)}setNormalNudgeFactor(A){Z.rawkinematiccharactercontroller_setNormalNudgeFactor(this.__wbg_ptr,A)}offset(){return Z.rawintegrationparameters_dt(this.__wbg_ptr)}setOffset(A){Z.rawkinematiccharactercontroller_setOffset(this.__wbg_ptr,A)}slideEnabled(){return Z.rawkinematiccharactercontroller_slideEnabled(this.__wbg_ptr)!==0}setSlideEnabled(A){Z.rawkinematiccharactercontroller_setSlideEnabled(this.__wbg_ptr,A)}autostepMaxHeight(){const A=Z.rawkinematiccharactercontroller_autostepMaxHeight(this.__wbg_ptr);return A===4294967297?void 0:A}autostepMinWidth(){const A=Z.rawkinematiccharactercontroller_autostepMinWidth(this.__wbg_ptr);return A===4294967297?void 0:A}autostepIncludesDynamicBodies(){const A=Z.rawkinematiccharactercontroller_autostepIncludesDynamicBodies(this.__wbg_ptr);return A===16777215?void 0:A!==0}autostepEnabled(){return Z.rawkinematiccharactercontroller_autostepEnabled(this.__wbg_ptr)!==0}enableAutostep(A,e,i){Z.rawkinematiccharactercontroller_enableAutostep(this.__wbg_ptr,A,e,i)}disableAutostep(){Z.rawkinematiccharactercontroller_disableAutostep(this.__wbg_ptr)}maxSlopeClimbAngle(){return Z.rawkinematiccharactercontroller_maxSlopeClimbAngle(this.__wbg_ptr)}setMaxSlopeClimbAngle(A){Z.rawkinematiccharactercontroller_setMaxSlopeClimbAngle(this.__wbg_ptr,A)}minSlopeSlideAngle(){return Z.rawkinematiccharactercontroller_minSlopeSlideAngle(this.__wbg_ptr)}setMinSlopeSlideAngle(A){Z.rawkinematiccharactercontroller_setMinSlopeSlideAngle(this.__wbg_ptr,A)}snapToGroundDistance(){const A=Z.rawkinematiccharactercontroller_snapToGroundDistance(this.__wbg_ptr);return A===4294967297?void 0:A}enableSnapToGround(A){Z.rawkinematiccharactercontroller_enableSnapToGround(this.__wbg_ptr,A)}disableSnapToGround(){Z.rawkinematiccharactercontroller_disableSnapToGround(this.__wbg_ptr)}snapToGroundEnabled(){return Z.rawkinematiccharactercontroller_snapToGroundEnabled(this.__wbg_ptr)!==0}computeColliderMovement(A,e,i,g,I,n,o,a,r,s,B){try{qA(e,dI),qA(i,qI),qA(g,oP),qA(n,Ie),Z.rawkinematiccharactercontroller_computeColliderMovement(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n.__wbg_ptr,o,si(a)?4294967297:Math.fround(a),r,si(s)?4294967297:s>>>0,NI(B))}finally{hg[CI++]=void 0}}computedMovement(){const A=Z.rawkinematiccharactercontroller_computedMovement(this.__wbg_ptr);return Ie.__wrap(A)}computedGrounded(){return Z.rawkinematiccharactercontroller_computedGrounded(this.__wbg_ptr)!==0}numComputedCollisions(){return Z.rawkinematiccharactercontroller_numComputedCollisions(this.__wbg_ptr)>>>0}computedCollision(A,e){return qA(e,dIA),Z.rawkinematiccharactercontroller_computedCollision(this.__wbg_ptr,A,e.__wbg_ptr)!==0}}const LL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawmultibodyjointset_free(t>>>0,1));class DQ{static __wrap(A){A>>>=0;const e=Object.create(DQ.prototype);return e.__wbg_ptr=A,LL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,LL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawmultibodyjointset_free(A,0)}jointType(A){return Z.rawmultibodyjointset_jointType(this.__wbg_ptr,A)}jointFrameX1(A){const e=Z.rawmultibodyjointset_jointFrameX1(this.__wbg_ptr,A);return Pi.__wrap(e)}jointFrameX2(A){const e=Z.rawmultibodyjointset_jointFrameX2(this.__wbg_ptr,A);return Pi.__wrap(e)}jointAnchor1(A){const e=Z.rawmultibodyjointset_jointAnchor1(this.__wbg_ptr,A);return Ie.__wrap(e)}jointAnchor2(A){const e=Z.rawmultibodyjointset_jointAnchor2(this.__wbg_ptr,A);return Ie.__wrap(e)}jointContactsEnabled(A){return Z.rawmultibodyjointset_jointContactsEnabled(this.__wbg_ptr,A)!==0}jointSetContactsEnabled(A,e){Z.rawmultibodyjointset_jointSetContactsEnabled(this.__wbg_ptr,A,e)}jointLimitsEnabled(A,e){return Z.rawmultibodyjointset_jointLimitsEnabled(this.__wbg_ptr,A,e)!==0}jointLimitsMin(A,e){return Z.rawmultibodyjointset_jointLimitsMin(this.__wbg_ptr,A,e)}jointLimitsMax(A,e){return Z.rawmultibodyjointset_jointLimitsMax(this.__wbg_ptr,A,e)}constructor(){const A=Z.rawmultibodyjointset_new();return this.__wbg_ptr=A>>>0,LL.register(this,this.__wbg_ptr,this),this}createJoint(A,e,i,g){return qA(A,Qo),Z.rawmultibodyjointset_createJoint(this.__wbg_ptr,A.__wbg_ptr,e,i,g)}remove(A,e){Z.rawmultibodyjointset_remove(this.__wbg_ptr,A,e)}contains(A){return Z.rawmultibodyjointset_contains(this.__wbg_ptr,A)!==0}forEachJointHandle(A){try{Z.rawmultibodyjointset_forEachJointHandle(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}forEachJointAttachedToRigidBody(A,e){try{Z.rawmultibodyjointset_forEachJointAttachedToRigidBody(this.__wbg_ptr,A,NI(e))}finally{hg[CI++]=void 0}}}const qL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawnarrowphase_free(t>>>0,1));class au{static __wrap(A){A>>>=0;const e=Object.create(au.prototype);return e.__wbg_ptr=A,qL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,qL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawnarrowphase_free(A,0)}constructor(){const A=Z.rawnarrowphase_new();return this.__wbg_ptr=A>>>0,qL.register(this,this.__wbg_ptr,this),this}contact_pairs_with(A,e){Z.rawnarrowphase_contact_pairs_with(this.__wbg_ptr,A,Sn(e))}contact_pair(A,e){const i=Z.rawnarrowphase_contact_pair(this.__wbg_ptr,A,e);return i===0?void 0:XYA.__wrap(i)}intersection_pairs_with(A,e){Z.rawnarrowphase_intersection_pairs_with(this.__wbg_ptr,A,Sn(e))}intersection_pair(A,e){return Z.rawnarrowphase_intersection_pair(this.__wbg_ptr,A,e)!==0}}const Dz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawphysicspipeline_free(t>>>0,1));class i2A{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Dz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawphysicspipeline_free(A,0)}constructor(){const A=Z.rawphysicspipeline_new();return this.__wbg_ptr=A>>>0,Dz.register(this,this.__wbg_ptr,this),this}step(A,e,i,g,I,n,o,a,r,s){qA(A,Ie),qA(e,Gd),qA(i,fQ),qA(g,Nd),qA(I,au),qA(n,dI),qA(o,qI),qA(a,pQ),qA(r,DQ),qA(s,yY),Z.rawphysicspipeline_step(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n.__wbg_ptr,o.__wbg_ptr,a.__wbg_ptr,r.__wbg_ptr,s.__wbg_ptr)}stepWithEvents(A,e,i,g,I,n,o,a,r,s,B,c,E,D){qA(A,Ie),qA(e,Gd),qA(i,fQ),qA(g,Nd),qA(I,au),qA(n,dI),qA(o,qI),qA(a,pQ),qA(r,DQ),qA(s,yY),qA(B,yIA),Z.rawphysicspipeline_stepWithEvents(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n.__wbg_ptr,o.__wbg_ptr,a.__wbg_ptr,r.__wbg_ptr,s.__wbg_ptr,B.__wbg_ptr,Sn(c),Sn(E),Sn(D))}}const yz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawpidcontroller_free(t>>>0,1));class g2A{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,yz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawpidcontroller_free(A,0)}constructor(A,e,i,g){const I=Z.rawpidcontroller_new(A,e,i,g);return this.__wbg_ptr=I>>>0,yz.register(this,this.__wbg_ptr,this),this}set_kp(A,e){Z.rawpidcontroller_set_kp(this.__wbg_ptr,A,e)}set_ki(A,e){Z.rawpidcontroller_set_ki(this.__wbg_ptr,A,e)}set_kd(A,e){Z.rawpidcontroller_set_kd(this.__wbg_ptr,A,e)}set_axes_mask(A){Z.rawpidcontroller_set_axes_mask(this.__wbg_ptr,A)}reset_integrals(){Z.rawpidcontroller_reset_integrals(this.__wbg_ptr)}apply_linear_correction(A,e,i,g,I){qA(e,dI),qA(g,Ie),qA(I,Ie),Z.rawpidcontroller_apply_linear_correction(this.__wbg_ptr,A,e.__wbg_ptr,i,g.__wbg_ptr,I.__wbg_ptr)}apply_angular_correction(A,e,i,g,I){qA(e,dI),qA(g,Pi),qA(I,Ie),Z.rawpidcontroller_apply_angular_correction(this.__wbg_ptr,A,e.__wbg_ptr,i,g.__wbg_ptr,I.__wbg_ptr)}linear_correction(A,e,i,g,I){qA(e,dI),qA(g,Ie),qA(I,Ie);const n=Z.rawpidcontroller_linear_correction(this.__wbg_ptr,A,e.__wbg_ptr,i,g.__wbg_ptr,I.__wbg_ptr);return Ie.__wrap(n)}angular_correction(A,e,i,g,I){qA(e,dI),qA(g,Pi),qA(I,Ie);const n=Z.rawpidcontroller_angular_correction(this.__wbg_ptr,A,e.__wbg_ptr,i,g.__wbg_ptr,I.__wbg_ptr);return Ie.__wrap(n)}}const Sz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawpointcolliderprojection_free(t>>>0,1));class AK{static __wrap(A){A>>>=0;const e=Object.create(AK.prototype);return e.__wbg_ptr=A,Sz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Sz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawpointcolliderprojection_free(A,0)}colliderHandle(){return Z.rawpointcolliderprojection_colliderHandle(this.__wbg_ptr)}point(){const A=Z.rawpointcolliderprojection_point(this.__wbg_ptr);return Ie.__wrap(A)}isInside(){return Z.rawpointcolliderprojection_isInside(this.__wbg_ptr)!==0}featureType(){return Z.rawpointcolliderprojection_featureType(this.__wbg_ptr)}featureId(){const A=Z.rawpointcolliderprojection_featureId(this.__wbg_ptr);return A===4294967297?void 0:A}}const wz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawpointprojection_free(t>>>0,1));class cb{static __wrap(A){A>>>=0;const e=Object.create(cb.prototype);return e.__wbg_ptr=A,wz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,wz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawpointprojection_free(A,0)}point(){const A=Z.rawpointprojection_point(this.__wbg_ptr);return Ie.__wrap(A)}isInside(){return Z.rawpointprojection_isInside(this.__wbg_ptr)!==0}}const mz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawquerypipeline_free(t>>>0,1));class oP{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,mz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawquerypipeline_free(A,0)}constructor(){const A=Z.rawquerypipeline_new();return this.__wbg_ptr=A>>>0,mz.register(this,this.__wbg_ptr,this),this}update(A){qA(A,qI),Z.rawquerypipeline_update(this.__wbg_ptr,A.__wbg_ptr)}castRay(A,e,i,g,I,n,o,a,r,s,B){try{qA(A,dI),qA(e,qI),qA(i,Ie),qA(g,Ie);const c=Z.rawquerypipeline_castRay(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n,o,si(a)?4294967297:a>>>0,!si(r),si(r)?0:r,!si(s),si(s)?0:s,NI(B));return c===0?void 0:aP.__wrap(c)}finally{hg[CI++]=void 0}}castRayAndGetNormal(A,e,i,g,I,n,o,a,r,s,B){try{qA(A,dI),qA(e,qI),qA(i,Ie),qA(g,Ie);const c=Z.rawquerypipeline_castRayAndGetNormal(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n,o,si(a)?4294967297:a>>>0,!si(r),si(r)?0:r,!si(s),si(s)?0:s,NI(B));return c===0?void 0:lb.__wrap(c)}finally{hg[CI++]=void 0}}intersectionsWithRay(A,e,i,g,I,n,o,a,r,s,B,c){try{qA(A,dI),qA(e,qI),qA(i,Ie),qA(g,Ie),Z.rawquerypipeline_intersectionsWithRay(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n,NI(o),a,si(r)?4294967297:r>>>0,!si(s),si(s)?0:s,!si(B),si(B)?0:B,NI(c))}finally{hg[CI++]=void 0,hg[CI++]=void 0}}intersectionWithShape(A,e,i,g,I,n,o,a,r,s){try{const E=Z.__wbindgen_add_to_stack_pointer(-16);qA(A,dI),qA(e,qI),qA(i,Ie),qA(g,Pi),qA(I,gi),Z.rawquerypipeline_intersectionWithShape(E,this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n,si(o)?4294967297:o>>>0,!si(a),si(a)?0:a,!si(r),si(r)?0:r,NI(s));var B=lo().getInt32(E+0,!0),c=lo().getFloat64(E+8,!0);return B===0?void 0:c}finally{Z.__wbindgen_add_to_stack_pointer(16),hg[CI++]=void 0}}projectPoint(A,e,i,g,I,n,o,a,r){try{qA(A,dI),qA(e,qI),qA(i,Ie);const s=Z.rawquerypipeline_projectPoint(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g,I,si(n)?4294967297:n>>>0,!si(o),si(o)?0:o,!si(a),si(a)?0:a,NI(r));return s===0?void 0:AK.__wrap(s)}finally{hg[CI++]=void 0}}projectPointAndGetFeature(A,e,i,g,I,n,o,a){try{qA(A,dI),qA(e,qI),qA(i,Ie);const r=Z.rawquerypipeline_projectPointAndGetFeature(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g,si(I)?4294967297:I>>>0,!si(n),si(n)?0:n,!si(o),si(o)?0:o,NI(a));return r===0?void 0:AK.__wrap(r)}finally{hg[CI++]=void 0}}intersectionsWithPoint(A,e,i,g,I,n,o,a,r){try{qA(A,dI),qA(e,qI),qA(i,Ie),Z.rawquerypipeline_intersectionsWithPoint(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,NI(g),I,si(n)?4294967297:n>>>0,!si(o),si(o)?0:o,!si(a),si(a)?0:a,NI(r))}finally{hg[CI++]=void 0,hg[CI++]=void 0}}castShape(A,e,i,g,I,n,o,a,r,s,B,c,E,D){try{qA(A,dI),qA(e,qI),qA(i,Ie),qA(g,Pi),qA(I,Ie),qA(n,gi);const y=Z.rawquerypipeline_castShape(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n.__wbg_ptr,o,a,r,s,si(B)?4294967297:B>>>0,!si(c),si(c)?0:c,!si(E),si(E)?0:E,NI(D));return y===0?void 0:Bb.__wrap(y)}finally{hg[CI++]=void 0}}intersectionsWithShape(A,e,i,g,I,n,o,a,r,s,B){try{qA(A,dI),qA(e,qI),qA(i,Ie),qA(g,Pi),qA(I,gi),Z.rawquerypipeline_intersectionsWithShape(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,NI(n),o,si(a)?4294967297:a>>>0,!si(r),si(r)?0:r,!si(s),si(s)?0:s,NI(B))}finally{hg[CI++]=void 0,hg[CI++]=void 0}}collidersWithAabbIntersectingAabb(A,e,i){try{qA(A,Ie),qA(e,Ie),Z.rawquerypipeline_collidersWithAabbIntersectingAabb(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,NI(i))}finally{hg[CI++]=void 0}}}const kz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawraycolliderhit_free(t>>>0,1));class aP{static __wrap(A){A>>>=0;const e=Object.create(aP.prototype);return e.__wbg_ptr=A,kz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,kz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawraycolliderhit_free(A,0)}colliderHandle(){return Z.rawcharactercollision_handle(this.__wbg_ptr)}timeOfImpact(){return Z.rawcollidershapecasthit_time_of_impact(this.__wbg_ptr)}}const Mz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawraycolliderintersection_free(t>>>0,1));class lb{static __wrap(A){A>>>=0;const e=Object.create(lb.prototype);return e.__wbg_ptr=A,Mz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Mz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawraycolliderintersection_free(A,0)}colliderHandle(){return Z.rawpointcolliderprojection_colliderHandle(this.__wbg_ptr)}normal(){const A=Z.rawcollidershapecasthit_witness1(this.__wbg_ptr);return Ie.__wrap(A)}time_of_impact(){return Z.rawcollidershapecasthit_time_of_impact(this.__wbg_ptr)}featureType(){return Z.rawpointcolliderprojection_featureType(this.__wbg_ptr)}featureId(){const A=Z.rawpointcolliderprojection_featureId(this.__wbg_ptr);return A===4294967297?void 0:A}}const Nz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawrayintersection_free(t>>>0,1));class Qb{static __wrap(A){A>>>=0;const e=Object.create(Qb.prototype);return e.__wbg_ptr=A,Nz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Nz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawrayintersection_free(A,0)}normal(){const A=Z.rawcollidershapecasthit_witness1(this.__wbg_ptr);return Ie.__wrap(A)}time_of_impact(){return Z.rawcollidershapecasthit_time_of_impact(this.__wbg_ptr)}featureType(){return Z.rawpointcolliderprojection_featureType(this.__wbg_ptr)}featureId(){const A=Z.rawpointcolliderprojection_featureId(this.__wbg_ptr);return A===4294967297?void 0:A}}const xL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawrigidbodyset_free(t>>>0,1));class dI{static __wrap(A){A>>>=0;const e=Object.create(dI.prototype);return e.__wbg_ptr=A,xL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,xL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawrigidbodyset_free(A,0)}rbTranslation(A){const e=Z.rawrigidbodyset_rbTranslation(this.__wbg_ptr,A);return Ie.__wrap(e)}rbRotation(A){const e=Z.rawrigidbodyset_rbRotation(this.__wbg_ptr,A);return Pi.__wrap(e)}rbSleep(A){Z.rawrigidbodyset_rbSleep(this.__wbg_ptr,A)}rbIsSleeping(A){return Z.rawrigidbodyset_rbIsSleeping(this.__wbg_ptr,A)!==0}rbIsMoving(A){return Z.rawrigidbodyset_rbIsMoving(this.__wbg_ptr,A)!==0}rbNextTranslation(A){const e=Z.rawrigidbodyset_rbNextTranslation(this.__wbg_ptr,A);return Ie.__wrap(e)}rbNextRotation(A){const e=Z.rawrigidbodyset_rbNextRotation(this.__wbg_ptr,A);return Pi.__wrap(e)}rbSetTranslation(A,e,i,g,I){Z.rawrigidbodyset_rbSetTranslation(this.__wbg_ptr,A,e,i,g,I)}rbSetRotation(A,e,i,g,I,n){Z.rawrigidbodyset_rbSetRotation(this.__wbg_ptr,A,e,i,g,I,n)}rbSetLinvel(A,e,i){qA(e,Ie),Z.rawrigidbodyset_rbSetLinvel(this.__wbg_ptr,A,e.__wbg_ptr,i)}rbSetAngvel(A,e,i){qA(e,Ie),Z.rawrigidbodyset_rbSetAngvel(this.__wbg_ptr,A,e.__wbg_ptr,i)}rbSetNextKinematicTranslation(A,e,i,g){Z.rawrigidbodyset_rbSetNextKinematicTranslation(this.__wbg_ptr,A,e,i,g)}rbSetNextKinematicRotation(A,e,i,g,I){Z.rawrigidbodyset_rbSetNextKinematicRotation(this.__wbg_ptr,A,e,i,g,I)}rbRecomputeMassPropertiesFromColliders(A,e){qA(e,qI),Z.rawrigidbodyset_rbRecomputeMassPropertiesFromColliders(this.__wbg_ptr,A,e.__wbg_ptr)}rbSetAdditionalMass(A,e,i){Z.rawrigidbodyset_rbSetAdditionalMass(this.__wbg_ptr,A,e,i)}rbSetAdditionalMassProperties(A,e,i,g,I,n){qA(i,Ie),qA(g,Ie),qA(I,Pi),Z.rawrigidbodyset_rbSetAdditionalMassProperties(this.__wbg_ptr,A,e,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n)}rbLinvel(A){const e=Z.rawrigidbodyset_rbLinvel(this.__wbg_ptr,A);return Ie.__wrap(e)}rbAngvel(A){const e=Z.rawrigidbodyset_rbAngvel(this.__wbg_ptr,A);return Ie.__wrap(e)}rbLockTranslations(A,e,i){Z.rawrigidbodyset_rbLockTranslations(this.__wbg_ptr,A,e,i)}rbSetEnabledTranslations(A,e,i,g,I){Z.rawrigidbodyset_rbSetEnabledTranslations(this.__wbg_ptr,A,e,i,g,I)}rbLockRotations(A,e,i){Z.rawrigidbodyset_rbLockRotations(this.__wbg_ptr,A,e,i)}rbSetEnabledRotations(A,e,i,g,I){Z.rawrigidbodyset_rbSetEnabledRotations(this.__wbg_ptr,A,e,i,g,I)}rbDominanceGroup(A){return Z.rawrigidbodyset_rbDominanceGroup(this.__wbg_ptr,A)}rbSetDominanceGroup(A,e){Z.rawrigidbodyset_rbSetDominanceGroup(this.__wbg_ptr,A,e)}rbEnableCcd(A,e){Z.rawrigidbodyset_rbEnableCcd(this.__wbg_ptr,A,e)}rbSetSoftCcdPrediction(A,e){Z.rawrigidbodyset_rbSetSoftCcdPrediction(this.__wbg_ptr,A,e)}rbMass(A){return Z.rawrigidbodyset_rbMass(this.__wbg_ptr,A)}rbInvMass(A){return Z.rawrigidbodyset_rbInvMass(this.__wbg_ptr,A)}rbEffectiveInvMass(A){const e=Z.rawrigidbodyset_rbEffectiveInvMass(this.__wbg_ptr,A);return Ie.__wrap(e)}rbLocalCom(A){const e=Z.rawrigidbodyset_rbLocalCom(this.__wbg_ptr,A);return Ie.__wrap(e)}rbWorldCom(A){const e=Z.rawrigidbodyset_rbWorldCom(this.__wbg_ptr,A);return Ie.__wrap(e)}rbInvPrincipalInertiaSqrt(A){const e=Z.rawrigidbodyset_rbInvPrincipalInertiaSqrt(this.__wbg_ptr,A);return Ie.__wrap(e)}rbPrincipalInertiaLocalFrame(A){const e=Z.rawrigidbodyset_rbPrincipalInertiaLocalFrame(this.__wbg_ptr,A);return Pi.__wrap(e)}rbPrincipalInertia(A){const e=Z.rawrigidbodyset_rbPrincipalInertia(this.__wbg_ptr,A);return Ie.__wrap(e)}rbEffectiveWorldInvInertiaSqrt(A){const e=Z.rawrigidbodyset_rbEffectiveWorldInvInertiaSqrt(this.__wbg_ptr,A);return eK.__wrap(e)}rbEffectiveAngularInertia(A){const e=Z.rawrigidbodyset_rbEffectiveAngularInertia(this.__wbg_ptr,A);return eK.__wrap(e)}rbWakeUp(A){Z.rawrigidbodyset_rbWakeUp(this.__wbg_ptr,A)}rbIsCcdEnabled(A){return Z.rawrigidbodyset_rbIsCcdEnabled(this.__wbg_ptr,A)!==0}rbSoftCcdPrediction(A){return Z.rawrigidbodyset_rbSoftCcdPrediction(this.__wbg_ptr,A)}rbNumColliders(A){return Z.rawrigidbodyset_rbNumColliders(this.__wbg_ptr,A)>>>0}rbCollider(A,e){return Z.rawrigidbodyset_rbCollider(this.__wbg_ptr,A,e)}rbBodyType(A){return Z.rawrigidbodyset_rbBodyType(this.__wbg_ptr,A)}rbSetBodyType(A,e,i){Z.rawrigidbodyset_rbSetBodyType(this.__wbg_ptr,A,e,i)}rbIsFixed(A){return Z.rawrigidbodyset_rbIsFixed(this.__wbg_ptr,A)!==0}rbIsKinematic(A){return Z.rawrigidbodyset_rbIsKinematic(this.__wbg_ptr,A)!==0}rbIsDynamic(A){return Z.rawrigidbodyset_rbIsDynamic(this.__wbg_ptr,A)!==0}rbLinearDamping(A){return Z.rawrigidbodyset_rbLinearDamping(this.__wbg_ptr,A)}rbAngularDamping(A){return Z.rawrigidbodyset_rbAngularDamping(this.__wbg_ptr,A)}rbSetLinearDamping(A,e){Z.rawrigidbodyset_rbSetLinearDamping(this.__wbg_ptr,A,e)}rbSetAngularDamping(A,e){Z.rawrigidbodyset_rbSetAngularDamping(this.__wbg_ptr,A,e)}rbSetEnabled(A,e){Z.rawrigidbodyset_rbSetEnabled(this.__wbg_ptr,A,e)}rbIsEnabled(A){return Z.rawrigidbodyset_rbIsEnabled(this.__wbg_ptr,A)!==0}rbGravityScale(A){return Z.rawrigidbodyset_rbGravityScale(this.__wbg_ptr,A)}rbSetGravityScale(A,e,i){Z.rawrigidbodyset_rbSetGravityScale(this.__wbg_ptr,A,e,i)}rbResetForces(A,e){Z.rawrigidbodyset_rbResetForces(this.__wbg_ptr,A,e)}rbResetTorques(A,e){Z.rawrigidbodyset_rbResetTorques(this.__wbg_ptr,A,e)}rbAddForce(A,e,i){qA(e,Ie),Z.rawrigidbodyset_rbAddForce(this.__wbg_ptr,A,e.__wbg_ptr,i)}rbApplyImpulse(A,e,i){qA(e,Ie),Z.rawrigidbodyset_rbApplyImpulse(this.__wbg_ptr,A,e.__wbg_ptr,i)}rbAddTorque(A,e,i){qA(e,Ie),Z.rawrigidbodyset_rbAddTorque(this.__wbg_ptr,A,e.__wbg_ptr,i)}rbApplyTorqueImpulse(A,e,i){qA(e,Ie),Z.rawrigidbodyset_rbApplyTorqueImpulse(this.__wbg_ptr,A,e.__wbg_ptr,i)}rbAddForceAtPoint(A,e,i,g){qA(e,Ie),qA(i,Ie),Z.rawrigidbodyset_rbAddForceAtPoint(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g)}rbApplyImpulseAtPoint(A,e,i,g){qA(e,Ie),qA(i,Ie),Z.rawrigidbodyset_rbApplyImpulseAtPoint(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g)}rbAdditionalSolverIterations(A){return Z.rawrigidbodyset_rbAdditionalSolverIterations(this.__wbg_ptr,A)>>>0}rbSetAdditionalSolverIterations(A,e){Z.rawrigidbodyset_rbSetAdditionalSolverIterations(this.__wbg_ptr,A,e)}rbUserData(A){return Z.rawrigidbodyset_rbUserData(this.__wbg_ptr,A)>>>0}rbSetUserData(A,e){Z.rawrigidbodyset_rbSetUserData(this.__wbg_ptr,A,e)}rbUserForce(A){const e=Z.rawrigidbodyset_rbUserForce(this.__wbg_ptr,A);return Ie.__wrap(e)}rbUserTorque(A){const e=Z.rawrigidbodyset_rbUserTorque(this.__wbg_ptr,A);return Ie.__wrap(e)}constructor(){const A=Z.rawrigidbodyset_new();return this.__wbg_ptr=A>>>0,xL.register(this,this.__wbg_ptr,this),this}createRigidBody(A,e,i,g,I,n,o,a,r,s,B,c,E,D,y,S,f,M,k,m,U,F,b,K,R,G){return qA(e,Ie),qA(i,Pi),qA(o,Ie),qA(a,Ie),qA(r,Ie),qA(s,Ie),qA(B,Pi),Z.rawrigidbodyset_createRigidBody(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g,I,n,o.__wbg_ptr,a.__wbg_ptr,r.__wbg_ptr,s.__wbg_ptr,B.__wbg_ptr,c,E,D,y,S,f,M,k,m,U,F,b,K,R,G)}remove(A,e,i,g,I){qA(e,fQ),qA(i,qI),qA(g,pQ),qA(I,DQ),Z.rawrigidbodyset_remove(this.__wbg_ptr,A,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr)}len(){return Z.rawcolliderset_len(this.__wbg_ptr)>>>0}contains(A){return Z.rawrigidbodyset_contains(this.__wbg_ptr,A)!==0}forEachRigidBodyHandle(A){try{Z.rawrigidbodyset_forEachRigidBodyHandle(this.__wbg_ptr,NI(A))}finally{hg[CI++]=void 0}}propagateModifiedBodyPositionsToColliders(A){qA(A,qI),Z.rawrigidbodyset_propagateModifiedBodyPositionsToColliders(this.__wbg_ptr,A.__wbg_ptr)}}const TL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawrotation_free(t>>>0,1));class Pi{static __wrap(A){A>>>=0;const e=Object.create(Pi.prototype);return e.__wbg_ptr=A,TL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,TL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawrotation_free(A,0)}constructor(A,e,i,g){const I=Z.rawrotation_new(A,e,i,g);return this.__wbg_ptr=I>>>0,TL.register(this,this.__wbg_ptr,this),this}static identity(){const A=Z.rawrotation_identity();return Pi.__wrap(A)}get x(){return Z.rawrotation_x(this.__wbg_ptr)}get y(){return Z.rawintegrationparameters_dt(this.__wbg_ptr)}get z(){return Z.rawcollidershapecasthit_time_of_impact(this.__wbg_ptr)}get w(){return Z.rawrotation_w(this.__wbg_ptr)}}const Gz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawsdpmatrix3_free(t>>>0,1));class eK{static __wrap(A){A>>>=0;const e=Object.create(eK.prototype);return e.__wbg_ptr=A,Gz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Gz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawsdpmatrix3_free(A,0)}elements(){return K0(Z.rawsdpmatrix3_elements(this.__wbg_ptr))}}const Rz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawserializationpipeline_free(t>>>0,1));class I2A{__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Rz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawserializationpipeline_free(A,0)}constructor(){const A=Z.rawserializationpipeline_new();return this.__wbg_ptr=A>>>0,Rz.register(this,this.__wbg_ptr,this),this}serializeAll(A,e,i,g,I,n,o,a,r){return qA(A,Ie),qA(e,Gd),qA(i,fQ),qA(g,Nd),qA(I,au),qA(n,dI),qA(o,qI),qA(a,pQ),qA(r,DQ),K0(Z.rawserializationpipeline_serializeAll(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n.__wbg_ptr,o.__wbg_ptr,a.__wbg_ptr,r.__wbg_ptr))}deserializeAll(A){const e=Z.rawserializationpipeline_deserializeAll(this.__wbg_ptr,Sn(A));return e===0?void 0:A2A.__wrap(e)}}const Uz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawshape_free(t>>>0,1));class gi{static __wrap(A){A>>>=0;const e=Object.create(gi.prototype);return e.__wbg_ptr=A,Uz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Uz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawshape_free(A,0)}static cuboid(A,e,i){const g=Z.rawshape_cuboid(A,e,i);return gi.__wrap(g)}static roundCuboid(A,e,i,g){const I=Z.rawshape_roundCuboid(A,e,i,g);return gi.__wrap(I)}static ball(A){const e=Z.rawshape_ball(A);return gi.__wrap(e)}static halfspace(A){qA(A,Ie);const e=Z.rawshape_halfspace(A.__wbg_ptr);return gi.__wrap(e)}static capsule(A,e){const i=Z.rawshape_capsule(A,e);return gi.__wrap(i)}static cylinder(A,e){const i=Z.rawshape_cylinder(A,e);return gi.__wrap(i)}static roundCylinder(A,e,i){const g=Z.rawshape_roundCylinder(A,e,i);return gi.__wrap(g)}static cone(A,e){const i=Z.rawshape_cone(A,e);return gi.__wrap(i)}static roundCone(A,e,i){const g=Z.rawshape_roundCone(A,e,i);return gi.__wrap(g)}static polyline(A,e){const i=dh(A,Z.__wbindgen_export_2),g=os,I=VN(e,Z.__wbindgen_export_2),n=os,o=Z.rawshape_polyline(i,g,I,n);return gi.__wrap(o)}static trimesh(A,e,i){const g=dh(A,Z.__wbindgen_export_2),I=os,n=VN(e,Z.__wbindgen_export_2),o=os,a=Z.rawshape_trimesh(g,I,n,o,i);return a===0?void 0:gi.__wrap(a)}static heightfield(A,e,i,g,I){const n=dh(i,Z.__wbindgen_export_2),o=os;qA(g,Ie);const a=Z.rawshape_heightfield(A,e,n,o,g.__wbg_ptr,I);return gi.__wrap(a)}static segment(A,e){qA(A,Ie),qA(e,Ie);const i=Z.rawshape_segment(A.__wbg_ptr,e.__wbg_ptr);return gi.__wrap(i)}static triangle(A,e,i){qA(A,Ie),qA(e,Ie),qA(i,Ie);const g=Z.rawshape_triangle(A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr);return gi.__wrap(g)}static roundTriangle(A,e,i,g){qA(A,Ie),qA(e,Ie),qA(i,Ie);const I=Z.rawshape_roundTriangle(A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g);return gi.__wrap(I)}static convexHull(A){const e=dh(A,Z.__wbindgen_export_2),i=os,g=Z.rawshape_convexHull(e,i);return g===0?void 0:gi.__wrap(g)}static roundConvexHull(A,e){const i=dh(A,Z.__wbindgen_export_2),g=os,I=Z.rawshape_roundConvexHull(i,g,e);return I===0?void 0:gi.__wrap(I)}static convexMesh(A,e){const i=dh(A,Z.__wbindgen_export_2),g=os,I=VN(e,Z.__wbindgen_export_2),n=os,o=Z.rawshape_convexMesh(i,g,I,n);return o===0?void 0:gi.__wrap(o)}static roundConvexMesh(A,e,i){const g=dh(A,Z.__wbindgen_export_2),I=os,n=VN(e,Z.__wbindgen_export_2),o=os,a=Z.rawshape_roundConvexMesh(g,I,n,o,i);return a===0?void 0:gi.__wrap(a)}castShape(A,e,i,g,I,n,o,a,r,s){qA(A,Ie),qA(e,Pi),qA(i,Ie),qA(g,gi),qA(I,Ie),qA(n,Pi),qA(o,Ie);const B=Z.rawshape_castShape(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n.__wbg_ptr,o.__wbg_ptr,a,r,s);return B===0?void 0:Eb.__wrap(B)}intersectsShape(A,e,i,g,I){return qA(A,Ie),qA(e,Pi),qA(i,gi),qA(g,Ie),qA(I,Pi),Z.rawshape_intersectsShape(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr)!==0}contactShape(A,e,i,g,I,n){qA(A,Ie),qA(e,Pi),qA(i,gi),qA(g,Ie),qA(I,Pi);const o=Z.rawshape_contactShape(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I.__wbg_ptr,n);return o===0?void 0:F0.__wrap(o)}containsPoint(A,e,i){return qA(A,Ie),qA(e,Pi),qA(i,Ie),Z.rawshape_containsPoint(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr)!==0}projectPoint(A,e,i,g){qA(A,Ie),qA(e,Pi),qA(i,Ie);const I=Z.rawshape_projectPoint(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g);return cb.__wrap(I)}intersectsRay(A,e,i,g,I){return qA(A,Ie),qA(e,Pi),qA(i,Ie),qA(g,Ie),Z.rawshape_intersectsRay(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I)!==0}castRay(A,e,i,g,I,n){return qA(A,Ie),qA(e,Pi),qA(i,Ie),qA(g,Ie),Z.rawshape_castRay(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n)}castRayAndGetNormal(A,e,i,g,I,n){qA(A,Ie),qA(e,Pi),qA(i,Ie),qA(g,Ie);const o=Z.rawshape_castRayAndGetNormal(this.__wbg_ptr,A.__wbg_ptr,e.__wbg_ptr,i.__wbg_ptr,g.__wbg_ptr,I,n);return o===0?void 0:Qb.__wrap(o)}}const Kz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawshapecasthit_free(t>>>0,1));class Eb{static __wrap(A){A>>>=0;const e=Object.create(Eb.prototype);return e.__wbg_ptr=A,Kz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Kz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawshapecasthit_free(A,0)}time_of_impact(){return Z.rawrotation_x(this.__wbg_ptr)}witness1(){const A=Z.rawshapecasthit_witness1(this.__wbg_ptr);return Ie.__wrap(A)}witness2(){const A=Z.rawcontactforceevent_total_force(this.__wbg_ptr);return Ie.__wrap(A)}normal1(){const A=Z.rawshapecasthit_normal1(this.__wbg_ptr);return Ie.__wrap(A)}normal2(){const A=Z.rawshapecasthit_normal2(this.__wbg_ptr);return Ie.__wrap(A)}}const Fz=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawshapecontact_free(t>>>0,1));class F0{static __wrap(A){A>>>=0;const e=Object.create(F0.prototype);return e.__wbg_ptr=A,Fz.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,Fz.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawshapecontact_free(A,0)}distance(){return Z.rawkinematiccharactercontroller_maxSlopeClimbAngle(this.__wbg_ptr)}point1(){const A=Z.rawpointprojection_point(this.__wbg_ptr);return Ie.__wrap(A)}point2(){const A=Z.rawcollidershapecasthit_witness1(this.__wbg_ptr);return Ie.__wrap(A)}normal1(){const A=Z.rawcollidershapecasthit_witness2(this.__wbg_ptr);return Ie.__wrap(A)}normal2(){const A=Z.rawcharactercollision_translationDeltaApplied(this.__wbg_ptr);return Ie.__wrap(A)}}const YL=typeof FinalizationRegistry>"u"?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(t=>Z.__wbg_rawvector_free(t>>>0,1));class Ie{static __wrap(A){A>>>=0;const e=Object.create(Ie.prototype);return e.__wbg_ptr=A,YL.register(e,e.__wbg_ptr,e),e}__destroy_into_raw(){const A=this.__wbg_ptr;return this.__wbg_ptr=0,YL.unregister(this),A}free(){const A=this.__destroy_into_raw();Z.__wbg_rawvector_free(A,0)}static zero(){const A=Z.rawvector_zero();return Ie.__wrap(A)}constructor(A,e,i){const g=Z.rawvector_new(A,e,i);return this.__wbg_ptr=g>>>0,YL.register(this,this.__wbg_ptr,this),this}get x(){return Z.rawrotation_x(this.__wbg_ptr)}set x(A){Z.rawvector_set_x(this.__wbg_ptr,A)}get y(){return Z.rawintegrationparameters_dt(this.__wbg_ptr)}set y(A){Z.rawintegrationparameters_set_dt(this.__wbg_ptr,A)}get z(){return Z.rawcollidershapecasthit_time_of_impact(this.__wbg_ptr)}set z(A){Z.rawvector_set_z(this.__wbg_ptr,A)}xyz(){const A=Z.rawvector_xyz(this.__wbg_ptr);return Ie.__wrap(A)}yxz(){const A=Z.rawvector_yxz(this.__wbg_ptr);return Ie.__wrap(A)}zxy(){const A=Z.rawvector_zxy(this.__wbg_ptr);return Ie.__wrap(A)}xzy(){const A=Z.rawvector_xzy(this.__wbg_ptr);return Ie.__wrap(A)}yzx(){const A=Z.rawvector_yzx(this.__wbg_ptr);return Ie.__wrap(A)}zyx(){const A=Z.rawvector_zyx(this.__wbg_ptr);return Ie.__wrap(A)}}async function SIA(t){if(Z!==void 0)return Z;t!==void 0&&(Object.getPrototypeOf(t)===Object.prototype&&({module_or_path:t}=t)),t===void 0&&(t=new URL("rapier_wasm3d_bg.wasm","<deleted>"));const A=function(){const g={wbg:{}};return g.wbg.__wbg_bind_c8359b1cba058168=function(I,n,o,a){return Sn(Hg(I).bind(Hg(n),Hg(o),Hg(a)))},g.wbg.__wbg_buffer_609cc3eee51ed158=function(I){return Sn(Hg(I).buffer)},g.wbg.__wbg_call_7cccdd69e0791ae2=function(){return KL(function(I,n,o){return Sn(Hg(I).call(Hg(n),Hg(o)))},arguments)},g.wbg.__wbg_call_833bed5770ea2041=function(){return KL(function(I,n,o,a){return Sn(Hg(I).call(Hg(n),Hg(o),Hg(a)))},arguments)},g.wbg.__wbg_call_b8adc8b1d0a0d8eb=function(){return KL(function(I,n,o,a,r){return Sn(Hg(I).call(Hg(n),Hg(o),Hg(a),Hg(r)))},arguments)},g.wbg.__wbg_length_3b4f022188ae8db6=function(I){return Hg(I).length},g.wbg.__wbg_length_a446193dc22c12f8=function(I){return Hg(I).length},g.wbg.__wbg_new_a12002a7f91c75be=function(I){return Sn(new Uint8Array(Hg(I)))},g.wbg.__wbg_newwithbyteoffsetandlength_d97e637ebe145a9a=function(I,n,o){return Sn(new Uint8Array(Hg(I),n>>>0,o>>>0))},g.wbg.__wbg_newwithbyteoffsetandlength_e6b7e69acd4c7354=function(I,n,o){return Sn(new Float32Array(Hg(I),n>>>0,o>>>0))},g.wbg.__wbg_newwithlength_5a5efe313cfd59f1=function(I){return Sn(new Float32Array(I>>>0))},g.wbg.__wbg_rawcontactforceevent_new=function(I){return Sn(nP.__wrap(I))},g.wbg.__wbg_rawraycolliderintersection_new=function(I){return Sn(lb.__wrap(I))},g.wbg.__wbg_set_10bad9bee0e9c58b=function(I,n,o){Hg(I).set(Hg(n),o>>>0)},g.wbg.__wbg_set_65595bdd868b3009=function(I,n,o){Hg(I).set(Hg(n),o>>>0)},g.wbg.__wbindgen_boolean_get=function(I){const n=Hg(I);return typeof n=="boolean"?n?1:0:2},g.wbg.__wbindgen_is_function=function(I){return typeof Hg(I)=="function"},g.wbg.__wbindgen_memory=function(){return Sn(Z.memory)},g.wbg.__wbindgen_number_get=function(I,n){const o=Hg(n),a=typeof o=="number"?o:void 0;lo().setFloat64(I+8,si(a)?0:a,!0),lo().setInt32(I+0,!si(a),!0)},g.wbg.__wbindgen_number_new=function(I){return Sn(I)},g.wbg.__wbindgen_object_drop_ref=function(I){K0(I)},g.wbg.__wbindgen_throw=function(I,n){throw new Error(EIA(I,n))},g}();(typeof t=="string"||typeof Request=="function"&&t instanceof Request||typeof URL=="function"&&t instanceof URL)&&(t=fetch(t));const{instance:e,module:i}=await async function(g,I){if(typeof Response=="function"&&g instanceof Response){if(typeof WebAssembly.instantiateStreaming=="function")try{return await WebAssembly.instantiateStreaming(g,I)}catch(o){if(g.headers.get("Content-Type")=="application/wasm")throw o}const n=await g.arrayBuffer();return await WebAssembly.instantiate(n,I)}{const n=await WebAssembly.instantiate(g,I);return n instanceof WebAssembly.Instance?{instance:n,module:g}:n}}(await t,A);return function(g,I){return Z=g.exports,SIA.__wbindgen_wasm_module=I,Th=null,Qm=null,Em=null,lm=null,Z}(e,i)}class vD{constructor(A,e,i){this.x=A,this.y=e,this.z=i}}class ie{static new(A,e,i){return new vD(A,e,i)}static intoRaw(A){return new Ie(A.x,A.y,A.z)}static zeros(){return ie.new(0,0,0)}static fromRaw(A){if(!A)return null;let e=ie.new(A.x,A.y,A.z);return A.free(),e}static copy(A,e){A.x=e.x,A.y=e.y,A.z=e.z}}class tK{constructor(A,e,i,g){this.x=A,this.y=e,this.z=i,this.w=g}}class Gi{static identity(){return new tK(0,0,0,1)}static fromRaw(A){if(!A)return null;let e=new tK(A.x,A.y,A.z,A.w);return A.free(),e}static intoRaw(A){return new Pi(A.x,A.y,A.z,A.w)}static copy(A,e){A.x=e.x,A.y=e.y,A.z=e.z,A.w=e.w}}class rP{constructor(A){this.elements=A}get m11(){return this.elements[0]}get m12(){return this.elements[1]}get m21(){return this.m12}get m13(){return this.elements[2]}get m31(){return this.m13}get m22(){return this.elements[3]}get m23(){return this.elements[4]}get m32(){return this.m23}get m33(){return this.elements[5]}}class iK{static fromRaw(A){const e=new rP(A.elements());return A.free(),e}}var $s,co,gK,IK,ry,Rd,cn,nK,oK,aK,rK,Xl,b0,sK,v0,FE;(function(t){t[t.Dynamic=0]="Dynamic",t[t.Fixed=1]="Fixed",t[t.KinematicPositionBased=2]="KinematicPositionBased",t[t.KinematicVelocityBased=3]="KinematicVelocityBased"})($s||($s={}));class CK{constructor(A,e,i){this.rawSet=A,this.colliderSet=e,this.handle=i}finalizeDeserialization(A){this.colliderSet=A}isValid(){return this.rawSet.contains(this.handle)}lockTranslations(A,e){return this.rawSet.rbLockTranslations(this.handle,A,e)}lockRotations(A,e){return this.rawSet.rbLockRotations(this.handle,A,e)}setEnabledTranslations(A,e,i,g){return this.rawSet.rbSetEnabledTranslations(this.handle,A,e,i,g)}restrictTranslations(A,e,i,g){this.setEnabledTranslations(A,e,i,g)}setEnabledRotations(A,e,i,g){return this.rawSet.rbSetEnabledRotations(this.handle,A,e,i,g)}restrictRotations(A,e,i,g){this.setEnabledRotations(A,e,i,g)}dominanceGroup(){return this.rawSet.rbDominanceGroup(this.handle)}setDominanceGroup(A){this.rawSet.rbSetDominanceGroup(this.handle,A)}additionalSolverIterations(){return this.rawSet.rbAdditionalSolverIterations(this.handle)}setAdditionalSolverIterations(A){this.rawSet.rbSetAdditionalSolverIterations(this.handle,A)}enableCcd(A){this.rawSet.rbEnableCcd(this.handle,A)}setSoftCcdPrediction(A){this.rawSet.rbSetSoftCcdPrediction(this.handle,A)}softCcdPrediction(){return this.rawSet.rbSoftCcdPrediction(this.handle)}translation(){let A=this.rawSet.rbTranslation(this.handle);return ie.fromRaw(A)}rotation(){let A=this.rawSet.rbRotation(this.handle);return Gi.fromRaw(A)}nextTranslation(){let A=this.rawSet.rbNextTranslation(this.handle);return ie.fromRaw(A)}nextRotation(){let A=this.rawSet.rbNextRotation(this.handle);return Gi.fromRaw(A)}setTranslation(A,e){this.rawSet.rbSetTranslation(this.handle,A.x,A.y,A.z,e)}setLinvel(A,e){let i=ie.intoRaw(A);this.rawSet.rbSetLinvel(this.handle,i,e),i.free()}gravityScale(){return this.rawSet.rbGravityScale(this.handle)}setGravityScale(A,e){this.rawSet.rbSetGravityScale(this.handle,A,e)}setRotation(A,e){this.rawSet.rbSetRotation(this.handle,A.x,A.y,A.z,A.w,e)}setAngvel(A,e){let i=ie.intoRaw(A);this.rawSet.rbSetAngvel(this.handle,i,e),i.free()}setNextKinematicTranslation(A){this.rawSet.rbSetNextKinematicTranslation(this.handle,A.x,A.y,A.z)}setNextKinematicRotation(A){this.rawSet.rbSetNextKinematicRotation(this.handle,A.x,A.y,A.z,A.w)}linvel(){return ie.fromRaw(this.rawSet.rbLinvel(this.handle))}angvel(){return ie.fromRaw(this.rawSet.rbAngvel(this.handle))}mass(){return this.rawSet.rbMass(this.handle)}effectiveInvMass(){return ie.fromRaw(this.rawSet.rbEffectiveInvMass(this.handle))}invMass(){return this.rawSet.rbInvMass(this.handle)}localCom(){return ie.fromRaw(this.rawSet.rbLocalCom(this.handle))}worldCom(){return ie.fromRaw(this.rawSet.rbWorldCom(this.handle))}invPrincipalInertiaSqrt(){return ie.fromRaw(this.rawSet.rbInvPrincipalInertiaSqrt(this.handle))}principalInertia(){return ie.fromRaw(this.rawSet.rbPrincipalInertia(this.handle))}principalInertiaLocalFrame(){return Gi.fromRaw(this.rawSet.rbPrincipalInertiaLocalFrame(this.handle))}effectiveWorldInvInertiaSqrt(){return iK.fromRaw(this.rawSet.rbEffectiveWorldInvInertiaSqrt(this.handle))}effectiveAngularInertia(){return iK.fromRaw(this.rawSet.rbEffectiveAngularInertia(this.handle))}sleep(){this.rawSet.rbSleep(this.handle)}wakeUp(){this.rawSet.rbWakeUp(this.handle)}isCcdEnabled(){return this.rawSet.rbIsCcdEnabled(this.handle)}numColliders(){return this.rawSet.rbNumColliders(this.handle)}collider(A){return this.colliderSet.get(this.rawSet.rbCollider(this.handle,A))}setEnabled(A){this.rawSet.rbSetEnabled(this.handle,A)}isEnabled(){return this.rawSet.rbIsEnabled(this.handle)}bodyType(){return this.rawSet.rbBodyType(this.handle)}setBodyType(A,e){return this.rawSet.rbSetBodyType(this.handle,A,e)}isSleeping(){return this.rawSet.rbIsSleeping(this.handle)}isMoving(){return this.rawSet.rbIsMoving(this.handle)}isFixed(){return this.rawSet.rbIsFixed(this.handle)}isKinematic(){return this.rawSet.rbIsKinematic(this.handle)}isDynamic(){return this.rawSet.rbIsDynamic(this.handle)}linearDamping(){return this.rawSet.rbLinearDamping(this.handle)}angularDamping(){return this.rawSet.rbAngularDamping(this.handle)}setLinearDamping(A){this.rawSet.rbSetLinearDamping(this.handle,A)}recomputeMassPropertiesFromColliders(){this.rawSet.rbRecomputeMassPropertiesFromColliders(this.handle,this.colliderSet.raw)}setAdditionalMass(A,e){this.rawSet.rbSetAdditionalMass(this.handle,A,e)}setAdditionalMassProperties(A,e,i,g,I){let n=ie.intoRaw(e),o=ie.intoRaw(i),a=Gi.intoRaw(g);this.rawSet.rbSetAdditionalMassProperties(this.handle,A,n,o,a,I),n.free(),o.free(),a.free()}setAngularDamping(A){this.rawSet.rbSetAngularDamping(this.handle,A)}resetForces(A){this.rawSet.rbResetForces(this.handle,A)}resetTorques(A){this.rawSet.rbResetTorques(this.handle,A)}addForce(A,e){const i=ie.intoRaw(A);this.rawSet.rbAddForce(this.handle,i,e),i.free()}applyImpulse(A,e){const i=ie.intoRaw(A);this.rawSet.rbApplyImpulse(this.handle,i,e),i.free()}addTorque(A,e){const i=ie.intoRaw(A);this.rawSet.rbAddTorque(this.handle,i,e),i.free()}applyTorqueImpulse(A,e){const i=ie.intoRaw(A);this.rawSet.rbApplyTorqueImpulse(this.handle,i,e),i.free()}addForceAtPoint(A,e,i){const g=ie.intoRaw(A),I=ie.intoRaw(e);this.rawSet.rbAddForceAtPoint(this.handle,g,I,i),g.free(),I.free()}applyImpulseAtPoint(A,e,i){const g=ie.intoRaw(A),I=ie.intoRaw(e);this.rawSet.rbApplyImpulseAtPoint(this.handle,g,I,i),g.free(),I.free()}userForce(){return ie.fromRaw(this.rawSet.rbUserForce(this.handle))}userTorque(){return ie.fromRaw(this.rawSet.rbUserTorque(this.handle))}}class AC{constructor(A){this.enabled=!0,this.status=A,this.translation=ie.zeros(),this.rotation=Gi.identity(),this.gravityScale=1,this.linvel=ie.zeros(),this.mass=0,this.massOnly=!1,this.centerOfMass=ie.zeros(),this.translationsEnabledX=!0,this.translationsEnabledY=!0,this.angvel=ie.zeros(),this.principalAngularInertia=ie.zeros(),this.angularInertiaLocalFrame=Gi.identity(),this.translationsEnabledZ=!0,this.rotationsEnabledX=!0,this.rotationsEnabledY=!0,this.rotationsEnabledZ=!0,this.linearDamping=0,this.angularDamping=0,this.canSleep=!0,this.sleeping=!1,this.ccdEnabled=!1,this.softCcdPrediction=0,this.dominanceGroup=0,this.additionalSolverIterations=0}static dynamic(){return new AC($s.Dynamic)}static kinematicPositionBased(){return new AC($s.KinematicPositionBased)}static kinematicVelocityBased(){return new AC($s.KinematicVelocityBased)}static fixed(){return new AC($s.Fixed)}static newDynamic(){return new AC($s.Dynamic)}static newKinematicPositionBased(){return new AC($s.KinematicPositionBased)}static newKinematicVelocityBased(){return new AC($s.KinematicVelocityBased)}static newStatic(){return new AC($s.Fixed)}setDominanceGroup(A){return this.dominanceGroup=A,this}setAdditionalSolverIterations(A){return this.additionalSolverIterations=A,this}setEnabled(A){return this.enabled=A,this}setTranslation(A,e,i){if(typeof A!="number"||typeof e!="number"||typeof i!="number")throw TypeError("The translation components must be numbers.");return this.translation={x:A,y:e,z:i},this}setRotation(A){return Gi.copy(this.rotation,A),this}setGravityScale(A){return this.gravityScale=A,this}setAdditionalMass(A){return this.mass=A,this.massOnly=!0,this}setLinvel(A,e,i){if(typeof A!="number"||typeof e!="number"||typeof i!="number")throw TypeError("The linvel components must be numbers.");return this.linvel={x:A,y:e,z:i},this}setAngvel(A){return ie.copy(this.angvel,A),this}setAdditionalMassProperties(A,e,i,g){return this.mass=A,ie.copy(this.centerOfMass,e),ie.copy(this.principalAngularInertia,i),Gi.copy(this.angularInertiaLocalFrame,g),this.massOnly=!1,this}enabledTranslations(A,e,i){return this.translationsEnabledX=A,this.translationsEnabledY=e,this.translationsEnabledZ=i,this}restrictTranslations(A,e,i){return this.enabledTranslations(A,e,i)}lockTranslations(){return this.enabledTranslations(!1,!1,!1)}enabledRotations(A,e,i){return this.rotationsEnabledX=A,this.rotationsEnabledY=e,this.rotationsEnabledZ=i,this}restrictRotations(A,e,i){return this.enabledRotations(A,e,i)}lockRotations(){return this.restrictRotations(!1,!1,!1)}setLinearDamping(A){return this.linearDamping=A,this}setAngularDamping(A){return this.angularDamping=A,this}setCanSleep(A){return this.canSleep=A,this}setSleeping(A){return this.sleeping=A,this}setCcdEnabled(A){return this.ccdEnabled=A,this}setSoftCcdPrediction(A){return this.softCcdPrediction=A,this}setUserData(A){return this.userData=A,this}}class ub{constructor(){this.fconv=new Float64Array(1),this.uconv=new Uint32Array(this.fconv.buffer),this.data=new Array,this.size=0}set(A,e){let i=this.index(A);for(;this.data.length<=i;)this.data.push(null);this.data[i]==null&&(this.size+=1),this.data[i]=e}len(){return this.size}delete(A){let e=this.index(A);e<this.data.length&&(this.data[e]!=null&&(this.size-=1),this.data[e]=null)}clear(){this.data=new Array}get(A){let e=this.index(A);return e<this.data.length?this.data[e]:null}forEach(A){for(const e of this.data)e!=null&&A(e)}getAll(){return this.data.filter(A=>A!=null)}index(A){return this.fconv[0]=A,this.uconv[0]}}class sP{constructor(A){this.raw=A||new dI,this.map=new ub,A&&A.forEachRigidBodyHandle(e=>{this.map.set(e,new CK(A,null,e))})}free(){this.raw&&this.raw.free(),this.raw=void 0,this.map&&this.map.clear(),this.map=void 0}finalizeDeserialization(A){this.map.forEach(e=>e.finalizeDeserialization(A))}createRigidBody(A,e){let i=ie.intoRaw(e.translation),g=Gi.intoRaw(e.rotation),I=ie.intoRaw(e.linvel),n=ie.intoRaw(e.centerOfMass),o=ie.intoRaw(e.angvel),a=ie.intoRaw(e.principalAngularInertia),r=Gi.intoRaw(e.angularInertiaLocalFrame),s=this.raw.createRigidBody(e.enabled,i,g,e.gravityScale,e.mass,e.massOnly,n,I,o,a,r,e.translationsEnabledX,e.translationsEnabledY,e.translationsEnabledZ,e.rotationsEnabledX,e.rotationsEnabledY,e.rotationsEnabledZ,e.linearDamping,e.angularDamping,e.status,e.canSleep,e.sleeping,e.softCcdPrediction,e.ccdEnabled,e.dominanceGroup,e.additionalSolverIterations);i.free(),g.free(),I.free(),n.free(),o.free(),a.free(),r.free();const B=new CK(this.raw,A,s);return B.userData=e.userData,this.map.set(s,B),B}remove(A,e,i,g,I){for(let n=0;n<this.raw.rbNumColliders(A);n+=1)i.unmap(this.raw.rbCollider(A,n));g.forEachJointHandleAttachedToRigidBody(A,n=>g.unmap(n)),I.forEachJointHandleAttachedToRigidBody(A,n=>I.unmap(n)),this.raw.remove(A,e.raw,i.raw,g.raw,I.raw),this.map.delete(A)}len(){return this.map.len()}contains(A){return this.get(A)!=null}get(A){return this.map.get(A)}forEach(A){this.map.forEach(A)}forEachActiveRigidBody(A,e){A.forEachActiveRigidBodyHandle(i=>{e(this.get(i))})}getAll(){return this.map.getAll()}}class CP{constructor(A){this.raw=A||new Gd}free(){this.raw&&this.raw.free(),this.raw=void 0}get dt(){return this.raw.dt}get contact_erp(){return this.raw.contact_erp}get lengthUnit(){return this.raw.lengthUnit}get normalizedAllowedLinearError(){return this.raw.normalizedAllowedLinearError}get normalizedPredictionDistance(){return this.raw.normalizedPredictionDistance}get numSolverIterations(){return this.raw.numSolverIterations}get numAdditionalFrictionIterations(){return this.raw.numAdditionalFrictionIterations}get numInternalPgsIterations(){return this.raw.numInternalPgsIterations}get minIslandSize(){return this.raw.minIslandSize}get maxCcdSubsteps(){return this.raw.maxCcdSubsteps}set dt(A){this.raw.dt=A}set contact_natural_frequency(A){this.raw.contact_natural_frequency=A}set lengthUnit(A){this.raw.lengthUnit=A}set normalizedAllowedLinearError(A){this.raw.normalizedAllowedLinearError=A}set normalizedPredictionDistance(A){this.raw.normalizedPredictionDistance=A}set numSolverIterations(A){this.raw.numSolverIterations=A}set numAdditionalFrictionIterations(A){this.raw.numAdditionalFrictionIterations=A}set numInternalPgsIterations(A){this.raw.numInternalPgsIterations=A}set minIslandSize(A){this.raw.minIslandSize=A}set maxCcdSubsteps(A){this.raw.maxCcdSubsteps=A}switchToStandardPgsSolver(){this.raw.switchToStandardPgsSolver()}switchToSmallStepsPgsSolver(){this.raw.switchToSmallStepsPgsSolver()}switchToSmallStepsPgsSolverWithoutWarmstart(){this.raw.switchToSmallStepsPgsSolverWithoutWarmstart()}}(function(t){t[t.Revolute=0]="Revolute",t[t.Fixed=1]="Fixed",t[t.Prismatic=2]="Prismatic",t[t.Rope=3]="Rope",t[t.Spring=4]="Spring",t[t.Spherical=5]="Spherical",t[t.Generic=6]="Generic"})(co||(co={})),function(t){t[t.AccelerationBased=0]="AccelerationBased",t[t.ForceBased=1]="ForceBased"}(gK||(gK={})),function(t){t[t.LinX=1]="LinX",t[t.LinY=2]="LinY",t[t.LinZ=4]="LinZ",t[t.AngX=8]="AngX",t[t.AngY=16]="AngY",t[t.AngZ=32]="AngZ"}(IK||(IK={}));class lC{constructor(A,e,i){this.rawSet=A,this.bodySet=e,this.handle=i}static newTyped(A,e,i){switch(A.jointType(i)){case IB.Revolute:return new EP(A,e,i);case IB.Prismatic:return new QP(A,e,i);case IB.Fixed:return new BP(A,e,i);case IB.Spring:return new lP(A,e,i);case IB.Rope:return new cP(A,e,i);case IB.Spherical:return new hP(A,e,i);case IB.Generic:return new uP(A,e,i);default:return new lC(A,e,i)}}finalizeDeserialization(A){this.bodySet=A}isValid(){return this.rawSet.contains(this.handle)}body1(){return this.bodySet.get(this.rawSet.jointBodyHandle1(this.handle))}body2(){return this.bodySet.get(this.rawSet.jointBodyHandle2(this.handle))}type(){return this.rawSet.jointType(this.handle)}frameX1(){return Gi.fromRaw(this.rawSet.jointFrameX1(this.handle))}frameX2(){return Gi.fromRaw(this.rawSet.jointFrameX2(this.handle))}anchor1(){return ie.fromRaw(this.rawSet.jointAnchor1(this.handle))}anchor2(){return ie.fromRaw(this.rawSet.jointAnchor2(this.handle))}setAnchor1(A){const e=ie.intoRaw(A);this.rawSet.jointSetAnchor1(this.handle,e),e.free()}setAnchor2(A){const e=ie.intoRaw(A);this.rawSet.jointSetAnchor2(this.handle,e),e.free()}setContactsEnabled(A){this.rawSet.jointSetContactsEnabled(this.handle,A)}contactsEnabled(){return this.rawSet.jointContactsEnabled(this.handle)}}class hb extends lC{limitsEnabled(){return this.rawSet.jointLimitsEnabled(this.handle,this.rawAxis())}limitsMin(){return this.rawSet.jointLimitsMin(this.handle,this.rawAxis())}limitsMax(){return this.rawSet.jointLimitsMax(this.handle,this.rawAxis())}setLimits(A,e){this.rawSet.jointSetLimits(this.handle,this.rawAxis(),A,e)}configureMotorModel(A){this.rawSet.jointConfigureMotorModel(this.handle,this.rawAxis(),A)}configureMotorVelocity(A,e){this.rawSet.jointConfigureMotorVelocity(this.handle,this.rawAxis(),A,e)}configureMotorPosition(A,e,i){this.rawSet.jointConfigureMotorPosition(this.handle,this.rawAxis(),A,e,i)}configureMotor(A,e,i,g){this.rawSet.jointConfigureMotor(this.handle,this.rawAxis(),A,e,i,g)}}class BP extends lC{}class cP extends lC{}class lP extends lC{}class QP extends hb{rawAxis(){return Cb.LinX}}class EP extends hb{rawAxis(){return Cb.AngX}}class uP extends lC{}class hP extends lC{}class kc{constructor(){}static fixed(A,e,i,g){let I=new kc;return I.anchor1=A,I.anchor2=i,I.frame1=e,I.frame2=g,I.jointType=co.Fixed,I}static spring(A,e,i,g,I){let n=new kc;return n.anchor1=g,n.anchor2=I,n.length=A,n.stiffness=e,n.damping=i,n.jointType=co.Spring,n}static rope(A,e,i){let g=new kc;return g.anchor1=e,g.anchor2=i,g.length=A,g.jointType=co.Rope,g}static generic(A,e,i,g){let I=new kc;return I.anchor1=A,I.anchor2=e,I.axis=i,I.axesMask=g,I.jointType=co.Generic,I}static spherical(A,e){let i=new kc;return i.anchor1=A,i.anchor2=e,i.jointType=co.Spherical,i}static prismatic(A,e,i){let g=new kc;return g.anchor1=A,g.anchor2=e,g.axis=i,g.jointType=co.Prismatic,g}static revolute(A,e,i){let g=new kc;return g.anchor1=A,g.anchor2=e,g.axis=i,g.jointType=co.Revolute,g}intoRaw(){let A,e,i=ie.intoRaw(this.anchor1),g=ie.intoRaw(this.anchor2),I=!1,n=0,o=0;switch(this.jointType){case co.Fixed:let a=Gi.intoRaw(this.frame1),r=Gi.intoRaw(this.frame2);e=Qo.fixed(i,a,g,r),a.free(),r.free();break;case co.Spring:e=Qo.spring(this.length,this.stiffness,this.damping,i,g);break;case co.Rope:e=Qo.rope(this.length,i,g);break;case co.Prismatic:A=ie.intoRaw(this.axis),this.limitsEnabled&&(I=!0,n=this.limits[0],o=this.limits[1]),e=Qo.prismatic(i,g,A,I,n,o),A.free();break;case co.Generic:A=ie.intoRaw(this.axis);let s=this.axesMask;e=Qo.generic(i,g,A,s);break;case co.Spherical:e=Qo.spherical(i,g);break;case co.Revolute:A=ie.intoRaw(this.axis),e=Qo.revolute(i,g,A),A.free()}return i.free(),g.free(),e}}class dP{constructor(A){this.raw=A||new pQ,this.map=new ub,A&&A.forEachJointHandle(e=>{this.map.set(e,lC.newTyped(A,null,e))})}free(){this.raw&&this.raw.free(),this.raw=void 0,this.map&&this.map.clear(),this.map=void 0}finalizeDeserialization(A){this.map.forEach(e=>e.finalizeDeserialization(A))}createJoint(A,e,i,g,I){const n=e.intoRaw(),o=this.raw.createJoint(n,i,g,I);n.free();let a=lC.newTyped(this.raw,A,o);return this.map.set(o,a),a}remove(A,e){this.raw.remove(A,e),this.unmap(A)}forEachJointHandleAttachedToRigidBody(A,e){this.raw.forEachJointAttachedToRigidBody(A,e)}unmap(A){this.map.delete(A)}len(){return this.map.len()}contains(A){return this.get(A)!=null}get(A){return this.map.get(A)}forEach(A){this.map.forEach(A)}getAll(){return this.map.getAll()}}class yQ{constructor(A,e){this.rawSet=A,this.handle=e}static newTyped(A,e){switch(A.jointType(e)){case IB.Revolute:return new DP(A,e);case IB.Prismatic:return new fP(A,e);case IB.Fixed:return new pP(A,e);case IB.Spherical:return new yP(A,e);default:return new yQ(A,e)}}isValid(){return this.rawSet.contains(this.handle)}setContactsEnabled(A){this.rawSet.jointSetContactsEnabled(this.handle,A)}contactsEnabled(){return this.rawSet.jointContactsEnabled(this.handle)}}class db extends yQ{}class pP extends yQ{}class fP extends db{rawAxis(){return Cb.LinX}}class DP extends db{rawAxis(){return Cb.AngX}}class yP extends yQ{}class SP{constructor(A){this.raw=A||new DQ,this.map=new ub,A&&A.forEachJointHandle(e=>{this.map.set(e,yQ.newTyped(this.raw,e))})}free(){this.raw&&this.raw.free(),this.raw=void 0,this.map&&this.map.clear(),this.map=void 0}createJoint(A,e,i,g){const I=A.intoRaw(),n=this.raw.createJoint(I,e,i,g);I.free();let o=yQ.newTyped(this.raw,n);return this.map.set(n,o),o}remove(A,e){this.raw.remove(A,e),this.map.delete(A)}unmap(A){this.map.delete(A)}len(){return this.map.len()}contains(A){return this.get(A)!=null}get(A){return this.map.get(A)}forEach(A){this.map.forEach(A)}forEachJointHandleAttachedToRigidBody(A,e){this.raw.forEachJointAttachedToRigidBody(A,e)}getAll(){return this.map.getAll()}}(function(t){t[t.Average=0]="Average",t[t.Min=1]="Min",t[t.Multiply=2]="Multiply",t[t.Max=3]="Max"})(ry||(ry={}));class wP{constructor(A){this.raw=A||new yY}free(){this.raw&&this.raw.free(),this.raw=void 0}}class mP{constructor(A){this.raw=A||new fQ}free(){this.raw&&this.raw.free(),this.raw=void 0}forEachActiveRigidBodyHandle(A){this.raw.forEachActiveRigidBodyHandle(A)}}class kP{constructor(A){this.raw=A||new Nd}free(){this.raw&&this.raw.free(),this.raw=void 0}}class MP{constructor(A){this.raw=A||new au,this.tempManifold=new NP(null)}free(){this.raw&&this.raw.free(),this.raw=void 0}contactPairsWith(A,e){this.raw.contact_pairs_with(A,e)}intersectionPairsWith(A,e){this.raw.intersection_pairs_with(A,e)}contactPair(A,e,i){const g=this.raw.contact_pair(A,e);if(g){const I=g.collider1()!=A;let n;for(n=0;n<g.numContactManifolds();++n)this.tempManifold.raw=g.contactManifold(n),this.tempManifold.raw&&i(this.tempManifold,I),this.tempManifold.free();g.free()}}intersectionPair(A,e){return this.raw.intersection_pair(A,e)}}class NP{constructor(A){this.raw=A}free(){this.raw&&this.raw.free(),this.raw=void 0}normal(){return ie.fromRaw(this.raw.normal())}localNormal1(){return ie.fromRaw(this.raw.local_n1())}localNormal2(){return ie.fromRaw(this.raw.local_n2())}subshape1(){return this.raw.subshape1()}subshape2(){return this.raw.subshape2()}numContacts(){return this.raw.num_contacts()}localContactPoint1(A){return ie.fromRaw(this.raw.contact_local_p1(A))}localContactPoint2(A){return ie.fromRaw(this.raw.contact_local_p2(A))}contactDist(A){return this.raw.contact_dist(A)}contactFid1(A){return this.raw.contact_fid1(A)}contactFid2(A){return this.raw.contact_fid2(A)}contactImpulse(A){return this.raw.contact_impulse(A)}contactTangentImpulseX(A){return this.raw.contact_tangent_impulse_x(A)}contactTangentImpulseY(A){return this.raw.contact_tangent_impulse_y(A)}numSolverContacts(){return this.raw.num_solver_contacts()}solverContactPoint(A){return ie.fromRaw(this.raw.solver_contact_point(A))}solverContactDist(A){return this.raw.solver_contact_dist(A)}solverContactFriction(A){return this.raw.solver_contact_friction(A)}solverContactRestitution(A){return this.raw.solver_contact_restitution(A)}solverContactTangentVelocity(A){return ie.fromRaw(this.raw.solver_contact_tangent_velocity(A))}}class Ud{constructor(A,e,i,g,I){this.distance=A,this.point1=e,this.point2=i,this.normal1=g,this.normal2=I}static fromRaw(A){if(!A)return null;const e=new Ud(A.distance(),ie.fromRaw(A.point1()),ie.fromRaw(A.point2()),ie.fromRaw(A.normal1()),ie.fromRaw(A.normal2()));return A.free(),e}}(function(t){t[t.Vertex=0]="Vertex",t[t.Edge=1]="Edge",t[t.Face=2]="Face",t[t.Unknown=3]="Unknown"})(Rd||(Rd={}));class Vy{constructor(A,e){this.point=A,this.isInside=e}static fromRaw(A){if(!A)return null;const e=new Vy(ie.fromRaw(A.point()),A.isInside());return A.free(),e}}class sy{constructor(A,e,i,g,I){this.featureType=Rd.Unknown,this.featureId=void 0,this.collider=A,this.point=e,this.isInside=i,I!==void 0&&(this.featureId=I),g!==void 0&&(this.featureType=g)}static fromRaw(A,e){if(!e)return null;const i=new sy(A.get(e.colliderHandle()),ie.fromRaw(e.point()),e.isInside(),e.featureType(),e.featureId());return e.free(),i}}class wIA{constructor(A,e){this.origin=A,this.dir=e}pointAt(A){return{x:this.origin.x+this.dir.x*A,y:this.origin.y+this.dir.y*A,z:this.origin.z+this.dir.z*A}}}class Xy{constructor(A,e,i,g){this.featureType=Rd.Unknown,this.featureId=void 0,this.timeOfImpact=A,this.normal=e,g!==void 0&&(this.featureId=g),i!==void 0&&(this.featureType=i)}static fromRaw(A){if(!A)return null;const e=new Xy(A.time_of_impact(),ie.fromRaw(A.normal()),A.featureType(),A.featureId());return A.free(),e}}class Cy{constructor(A,e,i,g,I){this.featureType=Rd.Unknown,this.featureId=void 0,this.collider=A,this.timeOfImpact=e,this.normal=i,I!==void 0&&(this.featureId=I),g!==void 0&&(this.featureType=g)}static fromRaw(A,e){if(!e)return null;const i=new Cy(A.get(e.colliderHandle()),e.time_of_impact(),ie.fromRaw(e.normal()),e.featureType(),e.featureId());return e.free(),i}}class Ok{constructor(A,e){this.collider=A,this.timeOfImpact=e}static fromRaw(A,e){if(!e)return null;const i=new Ok(A.get(e.colliderHandle()),e.timeOfImpact());return e.free(),i}}class Cp{constructor(A,e,i,g,I){this.time_of_impact=A,this.witness1=e,this.witness2=i,this.normal1=g,this.normal2=I}static fromRaw(A,e){if(!e)return null;const i=new Cp(e.time_of_impact(),ie.fromRaw(e.witness1()),ie.fromRaw(e.witness2()),ie.fromRaw(e.normal1()),ie.fromRaw(e.normal2()));return e.free(),i}}class $y extends Cp{constructor(A,e,i,g,I,n){super(e,i,g,I,n),this.collider=A}static fromRaw(A,e){if(!e)return null;const i=new $y(A.get(e.colliderHandle()),e.time_of_impact(),ie.fromRaw(e.witness1()),ie.fromRaw(e.witness2()),ie.fromRaw(e.normal1()),ie.fromRaw(e.normal2()));return e.free(),i}}class Fn{static fromRaw(A,e){const i=A.coShapeType(e);let g,I,n,o,a,r,s;switch(i){case bo.Ball:return new pb(A.coRadius(e));case bo.Cuboid:return g=A.coHalfExtents(e),new fb(g.x,g.y,g.z);case bo.RoundCuboid:return g=A.coHalfExtents(e),I=A.coRoundRadius(e),new Db(g.x,g.y,g.z,I);case bo.Capsule:return a=A.coHalfHeight(e),r=A.coRadius(e),new yb(a,r);case bo.Segment:return n=A.coVertices(e),new Sb(ie.new(n[0],n[1],n[2]),ie.new(n[3],n[4],n[5]));case bo.Polyline:return n=A.coVertices(e),o=A.coIndices(e),new kb(n,o);case bo.Triangle:return n=A.coVertices(e),new wb(ie.new(n[0],n[1],n[2]),ie.new(n[3],n[4],n[5]),ie.new(n[6],n[7],n[8]));case bo.RoundTriangle:return n=A.coVertices(e),I=A.coRoundRadius(e),new mb(ie.new(n[0],n[1],n[2]),ie.new(n[3],n[4],n[5]),ie.new(n[6],n[7],n[8]),I);case bo.HalfSpace:return s=ie.fromRaw(A.coHalfspaceNormal(e)),new GP(s);case bo.TriMesh:n=A.coVertices(e),o=A.coIndices(e);const B=A.coTriMeshFlags(e);return new Mb(n,o,B);case bo.HeightField:const c=A.coHeightfieldScale(e),E=A.coHeightfieldHeights(e),D=A.coHeightfieldNRows(e),y=A.coHeightfieldNCols(e),S=A.coHeightFieldFlags(e);return new Nb(D,y,E,c,S);case bo.ConvexPolyhedron:return n=A.coVertices(e),o=A.coIndices(e),new _0(n,o);case bo.RoundConvexPolyhedron:return n=A.coVertices(e),o=A.coIndices(e),I=A.coRoundRadius(e),new J0(n,o,I);case bo.Cylinder:return a=A.coHalfHeight(e),r=A.coRadius(e),new Gb(a,r);case bo.RoundCylinder:return a=A.coHalfHeight(e),r=A.coRadius(e),I=A.coRoundRadius(e),new Rb(a,r,I);case bo.Cone:return a=A.coHalfHeight(e),r=A.coRadius(e),new Ub(a,r);case bo.RoundCone:return a=A.coHalfHeight(e),r=A.coRadius(e),I=A.coRoundRadius(e),new Kb(a,r,I);default:throw new Error("unknown shape type: "+i)}}castShape(A,e,i,g,I,n,o,a,r,s){let B=ie.intoRaw(A),c=Gi.intoRaw(e),E=ie.intoRaw(i),D=ie.intoRaw(I),y=Gi.intoRaw(n),S=ie.intoRaw(o),f=this.intoRaw(),M=g.intoRaw(),k=Cp.fromRaw(null,f.castShape(B,c,E,M,D,y,S,a,r,s));return B.free(),c.free(),E.free(),D.free(),y.free(),S.free(),f.free(),M.free(),k}intersectsShape(A,e,i,g,I){let n=ie.intoRaw(A),o=Gi.intoRaw(e),a=ie.intoRaw(g),r=Gi.intoRaw(I),s=this.intoRaw(),B=i.intoRaw(),c=s.intersectsShape(n,o,B,a,r);return n.free(),o.free(),a.free(),r.free(),s.free(),B.free(),c}contactShape(A,e,i,g,I,n){let o=ie.intoRaw(A),a=Gi.intoRaw(e),r=ie.intoRaw(g),s=Gi.intoRaw(I),B=this.intoRaw(),c=i.intoRaw(),E=Ud.fromRaw(B.contactShape(o,a,c,r,s,n));return o.free(),a.free(),r.free(),s.free(),B.free(),c.free(),E}containsPoint(A,e,i){let g=ie.intoRaw(A),I=Gi.intoRaw(e),n=ie.intoRaw(i),o=this.intoRaw(),a=o.containsPoint(g,I,n);return g.free(),I.free(),n.free(),o.free(),a}projectPoint(A,e,i,g){let I=ie.intoRaw(A),n=Gi.intoRaw(e),o=ie.intoRaw(i),a=this.intoRaw(),r=Vy.fromRaw(a.projectPoint(I,n,o,g));return I.free(),n.free(),o.free(),a.free(),r}intersectsRay(A,e,i,g){let I=ie.intoRaw(e),n=Gi.intoRaw(i),o=ie.intoRaw(A.origin),a=ie.intoRaw(A.dir),r=this.intoRaw(),s=r.intersectsRay(I,n,o,a,g);return I.free(),n.free(),o.free(),a.free(),r.free(),s}castRay(A,e,i,g,I){let n=ie.intoRaw(e),o=Gi.intoRaw(i),a=ie.intoRaw(A.origin),r=ie.intoRaw(A.dir),s=this.intoRaw(),B=s.castRay(n,o,a,r,g,I);return n.free(),o.free(),a.free(),r.free(),s.free(),B}castRayAndGetNormal(A,e,i,g,I){let n=ie.intoRaw(e),o=Gi.intoRaw(i),a=ie.intoRaw(A.origin),r=ie.intoRaw(A.dir),s=this.intoRaw(),B=Xy.fromRaw(s.castRayAndGetNormal(n,o,a,r,g,I));return n.free(),o.free(),a.free(),r.free(),s.free(),B}}(function(t){t[t.Ball=0]="Ball",t[t.Cuboid=1]="Cuboid",t[t.Capsule=2]="Capsule",t[t.Segment=3]="Segment",t[t.Polyline=4]="Polyline",t[t.Triangle=5]="Triangle",t[t.TriMesh=6]="TriMesh",t[t.HeightField=7]="HeightField",t[t.ConvexPolyhedron=9]="ConvexPolyhedron",t[t.Cylinder=10]="Cylinder",t[t.Cone=11]="Cone",t[t.RoundCuboid=12]="RoundCuboid",t[t.RoundTriangle=13]="RoundTriangle",t[t.RoundCylinder=14]="RoundCylinder",t[t.RoundCone=15]="RoundCone",t[t.RoundConvexPolyhedron=16]="RoundConvexPolyhedron",t[t.HalfSpace=17]="HalfSpace"})(cn||(cn={})),function(t){t[t.FIX_INTERNAL_EDGES=1]="FIX_INTERNAL_EDGES"}(nK||(nK={})),function(t){t[t.DELETE_BAD_TOPOLOGY_TRIANGLES=4]="DELETE_BAD_TOPOLOGY_TRIANGLES",t[t.ORIENTED=8]="ORIENTED",t[t.MERGE_DUPLICATE_VERTICES=16]="MERGE_DUPLICATE_VERTICES",t[t.DELETE_DEGENERATE_TRIANGLES=32]="DELETE_DEGENERATE_TRIANGLES",t[t.DELETE_DUPLICATE_TRIANGLES=64]="DELETE_DUPLICATE_TRIANGLES",t[t.FIX_INTERNAL_EDGES=152]="FIX_INTERNAL_EDGES"}(oK||(oK={}));class pb extends Fn{constructor(A){super(),this.type=cn.Ball,this.radius=A}intoRaw(){return gi.ball(this.radius)}}class GP extends Fn{constructor(A){super(),this.type=cn.HalfSpace,this.normal=A}intoRaw(){let A=ie.intoRaw(this.normal),e=gi.halfspace(A);return A.free(),e}}class fb extends Fn{constructor(A,e,i){super(),this.type=cn.Cuboid,this.halfExtents=ie.new(A,e,i)}intoRaw(){return gi.cuboid(this.halfExtents.x,this.halfExtents.y,this.halfExtents.z)}}class Db extends Fn{constructor(A,e,i,g){super(),this.type=cn.RoundCuboid,this.halfExtents=ie.new(A,e,i),this.borderRadius=g}intoRaw(){return gi.roundCuboid(this.halfExtents.x,this.halfExtents.y,this.halfExtents.z,this.borderRadius)}}class yb extends Fn{constructor(A,e){super(),this.type=cn.Capsule,this.halfHeight=A,this.radius=e}intoRaw(){return gi.capsule(this.halfHeight,this.radius)}}class Sb extends Fn{constructor(A,e){super(),this.type=cn.Segment,this.a=A,this.b=e}intoRaw(){let A=ie.intoRaw(this.a),e=ie.intoRaw(this.b),i=gi.segment(A,e);return A.free(),e.free(),i}}class wb extends Fn{constructor(A,e,i){super(),this.type=cn.Triangle,this.a=A,this.b=e,this.c=i}intoRaw(){let A=ie.intoRaw(this.a),e=ie.intoRaw(this.b),i=ie.intoRaw(this.c),g=gi.triangle(A,e,i);return A.free(),e.free(),i.free(),g}}class mb extends Fn{constructor(A,e,i,g){super(),this.type=cn.RoundTriangle,this.a=A,this.b=e,this.c=i,this.borderRadius=g}intoRaw(){let A=ie.intoRaw(this.a),e=ie.intoRaw(this.b),i=ie.intoRaw(this.c),g=gi.roundTriangle(A,e,i,this.borderRadius);return A.free(),e.free(),i.free(),g}}class kb extends Fn{constructor(A,e){super(),this.type=cn.Polyline,this.vertices=A,this.indices=e??new Uint32Array(0)}intoRaw(){return gi.polyline(this.vertices,this.indices)}}class Mb extends Fn{constructor(A,e,i){super(),this.type=cn.TriMesh,this.vertices=A,this.indices=e,this.flags=i}intoRaw(){return gi.trimesh(this.vertices,this.indices,this.flags)}}class _0 extends Fn{constructor(A,e){super(),this.type=cn.ConvexPolyhedron,this.vertices=A,this.indices=e}intoRaw(){return this.indices?gi.convexMesh(this.vertices,this.indices):gi.convexHull(this.vertices)}}class J0 extends Fn{constructor(A,e,i){super(),this.type=cn.RoundConvexPolyhedron,this.vertices=A,this.indices=e,this.borderRadius=i}intoRaw(){return this.indices?gi.roundConvexMesh(this.vertices,this.indices,this.borderRadius):gi.roundConvexHull(this.vertices,this.borderRadius)}}class Nb extends Fn{constructor(A,e,i,g,I){super(),this.type=cn.HeightField,this.nrows=A,this.ncols=e,this.heights=i,this.scale=g,this.flags=I}intoRaw(){let A=ie.intoRaw(this.scale),e=gi.heightfield(this.nrows,this.ncols,this.heights,A,this.flags);return A.free(),e}}class Gb extends Fn{constructor(A,e){super(),this.type=cn.Cylinder,this.halfHeight=A,this.radius=e}intoRaw(){return gi.cylinder(this.halfHeight,this.radius)}}class Rb extends Fn{constructor(A,e,i){super(),this.type=cn.RoundCylinder,this.borderRadius=i,this.halfHeight=A,this.radius=e}intoRaw(){return gi.roundCylinder(this.halfHeight,this.radius,this.borderRadius)}}class Ub extends Fn{constructor(A,e){super(),this.type=cn.Cone,this.halfHeight=A,this.radius=e}intoRaw(){return gi.cone(this.halfHeight,this.radius)}}class Kb extends Fn{constructor(A,e,i){super(),this.type=cn.RoundCone,this.halfHeight=A,this.radius=e,this.borderRadius=i}intoRaw(){return gi.roundCone(this.halfHeight,this.radius,this.borderRadius)}}class RP{constructor(A){this.raw=A||new i2A}free(){this.raw&&this.raw.free(),this.raw=void 0}step(A,e,i,g,I,n,o,a,r,s,B,c){let E=ie.intoRaw(A);B?this.raw.stepWithEvents(E,e.raw,i.raw,g.raw,I.raw,n.raw,o.raw,a.raw,r.raw,s.raw,B.raw,c,c?c.filterContactPair:null,c?c.filterIntersectionPair:null):this.raw.step(E,e.raw,i.raw,g.raw,I.raw,n.raw,o.raw,a.raw,r.raw,s.raw),E.free()}}(function(t){t[t.EXCLUDE_FIXED=1]="EXCLUDE_FIXED",t[t.EXCLUDE_KINEMATIC=2]="EXCLUDE_KINEMATIC",t[t.EXCLUDE_DYNAMIC=4]="EXCLUDE_DYNAMIC",t[t.EXCLUDE_SENSORS=8]="EXCLUDE_SENSORS",t[t.EXCLUDE_SOLIDS=16]="EXCLUDE_SOLIDS",t[t.ONLY_DYNAMIC=3]="ONLY_DYNAMIC",t[t.ONLY_KINEMATIC=5]="ONLY_KINEMATIC",t[t.ONLY_FIXED=6]="ONLY_FIXED"})(aK||(aK={}));class UP{constructor(A){this.raw=A||new oP}free(){this.raw&&this.raw.free(),this.raw=void 0}update(A){this.raw.update(A.raw)}castRay(A,e,i,g,I,n,o,a,r,s){let B=ie.intoRaw(i.origin),c=ie.intoRaw(i.dir),E=Ok.fromRaw(e,this.raw.castRay(A.raw,e.raw,B,c,g,I,n,o,a,r,s));return B.free(),c.free(),E}castRayAndGetNormal(A,e,i,g,I,n,o,a,r,s){let B=ie.intoRaw(i.origin),c=ie.intoRaw(i.dir),E=Cy.fromRaw(e,this.raw.castRayAndGetNormal(A.raw,e.raw,B,c,g,I,n,o,a,r,s));return B.free(),c.free(),E}intersectionsWithRay(A,e,i,g,I,n,o,a,r,s,B){let c=ie.intoRaw(i.origin),E=ie.intoRaw(i.dir);this.raw.intersectionsWithRay(A.raw,e.raw,c,E,g,I,D=>n(Cy.fromRaw(e,D)),o,a,r,s,B),c.free(),E.free()}intersectionWithShape(A,e,i,g,I,n,o,a,r,s){let B=ie.intoRaw(i),c=Gi.intoRaw(g),E=I.intoRaw(),D=this.raw.intersectionWithShape(A.raw,e.raw,B,c,E,n,o,a,r,s);return B.free(),c.free(),E.free(),D}projectPoint(A,e,i,g,I,n,o,a,r){let s=ie.intoRaw(i),B=sy.fromRaw(e,this.raw.projectPoint(A.raw,e.raw,s,g,I,n,o,a,r));return s.free(),B}projectPointAndGetFeature(A,e,i,g,I,n,o,a){let r=ie.intoRaw(i),s=sy.fromRaw(e,this.raw.projectPointAndGetFeature(A.raw,e.raw,r,g,I,n,o,a));return r.free(),s}intersectionsWithPoint(A,e,i,g,I,n,o,a,r){let s=ie.intoRaw(i);this.raw.intersectionsWithPoint(A.raw,e.raw,s,g,I,n,o,a,r),s.free()}castShape(A,e,i,g,I,n,o,a,r,s,B,c,E,D){let y=ie.intoRaw(i),S=Gi.intoRaw(g),f=ie.intoRaw(I),M=n.intoRaw(),k=$y.fromRaw(e,this.raw.castShape(A.raw,e.raw,y,S,f,M,o,a,r,s,B,c,E,D));return y.free(),S.free(),f.free(),M.free(),k}intersectionsWithShape(A,e,i,g,I,n,o,a,r,s,B){let c=ie.intoRaw(i),E=Gi.intoRaw(g),D=I.intoRaw();this.raw.intersectionsWithShape(A.raw,e.raw,c,E,D,n,o,a,r,s,B),c.free(),E.free(),D.free()}collidersWithAabbIntersectingAabb(A,e,i){let g=ie.intoRaw(A),I=ie.intoRaw(e);this.raw.collidersWithAabbIntersectingAabb(g,I,i),g.free(),I.free()}}class BK{constructor(A){this.raw=A||new I2A}free(){this.raw&&this.raw.free(),this.raw=void 0}serializeAll(A,e,i,g,I,n,o,a,r){let s=ie.intoRaw(A);const B=this.raw.serializeAll(s,e.raw,i.raw,g.raw,I.raw,n.raw,o.raw,a.raw,r.raw);return s.free(),B}deserializeAll(A){return Pk.fromRaw(this.raw.deserializeAll(A))}}class KP{constructor(A,e){this.vertices=A,this.colors=e}}class FP{constructor(A){this.raw=A||new $YA}free(){this.raw&&this.raw.free(),this.raw=void 0,this.vertices=void 0,this.colors=void 0}render(A,e,i,g,I){this.raw.render(A.raw,e.raw,i.raw,g.raw,I.raw),this.vertices=this.raw.vertices(),this.colors=this.raw.colors()}}class bP{}class vP{constructor(A,e,i,g,I){this.params=e,this.bodies=i,this.colliders=g,this.queries=I,this.raw=new t2A(A),this.rawCharacterCollision=new dIA,this._applyImpulsesToDynamicBodies=!1,this._characterMass=null}free(){this.raw&&(this.raw.free(),this.rawCharacterCollision.free()),this.raw=void 0,this.rawCharacterCollision=void 0}up(){return this.raw.up()}setUp(A){let e=ie.intoRaw(A);return this.raw.setUp(e)}applyImpulsesToDynamicBodies(){return this._applyImpulsesToDynamicBodies}setApplyImpulsesToDynamicBodies(A){this._applyImpulsesToDynamicBodies=A}characterMass(){return this._characterMass}setCharacterMass(A){this._characterMass=A}offset(){return this.raw.offset()}setOffset(A){this.raw.setOffset(A)}normalNudgeFactor(){return this.raw.normalNudgeFactor()}setNormalNudgeFactor(A){this.raw.setNormalNudgeFactor(A)}slideEnabled(){return this.raw.slideEnabled()}setSlideEnabled(A){this.raw.setSlideEnabled(A)}autostepMaxHeight(){return this.raw.autostepMaxHeight()}autostepMinWidth(){return this.raw.autostepMinWidth()}autostepIncludesDynamicBodies(){return this.raw.autostepIncludesDynamicBodies()}autostepEnabled(){return this.raw.autostepEnabled()}enableAutostep(A,e,i){this.raw.enableAutostep(A,e,i)}disableAutostep(){return this.raw.disableAutostep()}maxSlopeClimbAngle(){return this.raw.maxSlopeClimbAngle()}setMaxSlopeClimbAngle(A){this.raw.setMaxSlopeClimbAngle(A)}minSlopeSlideAngle(){return this.raw.minSlopeSlideAngle()}setMinSlopeSlideAngle(A){this.raw.setMinSlopeSlideAngle(A)}snapToGroundDistance(){return this.raw.snapToGroundDistance()}enableSnapToGround(A){this.raw.enableSnapToGround(A)}disableSnapToGround(){this.raw.disableSnapToGround()}snapToGroundEnabled(){return this.raw.snapToGroundEnabled()}computeColliderMovement(A,e,i,g,I){let n=ie.intoRaw(e);this.raw.computeColliderMovement(this.params.dt,this.bodies.raw,this.colliders.raw,this.queries.raw,A.handle,n,this._applyImpulsesToDynamicBodies,this._characterMass,i,g,this.colliders.castClosure(I)),n.free()}computedMovement(){return ie.fromRaw(this.raw.computedMovement())}computedGrounded(){return this.raw.computedGrounded()}numComputedCollisions(){return this.raw.numComputedCollisions()}computedCollision(A,e){if(this.raw.computedCollision(A,this.rawCharacterCollision)){let i=this.rawCharacterCollision;return(e=e??new bP).translationDeltaApplied=ie.fromRaw(i.translationDeltaApplied()),e.translationDeltaRemaining=ie.fromRaw(i.translationDeltaRemaining()),e.toi=i.toi(),e.witness1=ie.fromRaw(i.worldWitness1()),e.witness2=ie.fromRaw(i.worldWitness2()),e.normal1=ie.fromRaw(i.worldNormal1()),e.normal2=ie.fromRaw(i.worldNormal2()),e.collider=this.colliders.get(i.handle()),e}return null}}(function(t){t[t.None=0]="None",t[t.LinX=1]="LinX",t[t.LinY=2]="LinY",t[t.LinZ=4]="LinZ",t[t.AngX=8]="AngX",t[t.AngY=16]="AngY",t[t.AngZ=32]="AngZ",t[t.AllLin=7]="AllLin",t[t.AllAng=56]="AllAng",t[t.All=63]="All"})(rK||(rK={}));class _P{constructor(A,e,i,g,I,n){this.params=A,this.bodies=e,this.raw=new g2A(i,g,I,n)}free(){this.raw&&this.raw.free(),this.raw=void 0}setKp(A,e){this.raw.set_kp(A,e)}setKi(A,e){this.raw.set_kp(A,e)}setKd(A,e){this.raw.set_kp(A,e)}setAxes(A){this.raw.set_axes_mask(A)}resetIntegrals(){this.raw.reset_integrals()}applyLinearCorrection(A,e,i){let g=ie.intoRaw(e),I=ie.intoRaw(i);this.raw.apply_linear_correction(this.params.dt,this.bodies.raw,A.handle,g,I),g.free(),I.free()}applyAngularCorrection(A,e,i){let g=Gi.intoRaw(e),I=ie.intoRaw(i);this.raw.apply_angular_correction(this.params.dt,this.bodies.raw,A.handle,g,I),g.free(),I.free()}linearCorrection(A,e,i){let g=ie.intoRaw(e),I=ie.intoRaw(i),n=this.raw.linear_correction(this.params.dt,this.bodies.raw,A.handle,g,I);return g.free(),I.free(),ie.fromRaw(n)}angularCorrection(A,e,i){let g=Gi.intoRaw(e),I=ie.intoRaw(i),n=this.raw.angular_correction(this.params.dt,this.bodies.raw,A.handle,g,I);return g.free(),I.free(),ie.fromRaw(n)}}class JP{constructor(A,e,i,g){this.raw=new e2A(A.handle),this.bodies=e,this.colliders=i,this.queries=g,this._chassis=A}free(){this.raw&&this.raw.free(),this.raw=void 0}updateVehicle(A,e,i,g){this.raw.update_vehicle(A,this.bodies.raw,this.colliders.raw,this.queries.raw,e,i,this.colliders.castClosure(g))}currentVehicleSpeed(){return this.raw.current_vehicle_speed()}chassis(){return this._chassis}get indexUpAxis(){return this.raw.index_up_axis()}set indexUpAxis(A){this.raw.set_index_up_axis(A)}get indexForwardAxis(){return this.raw.index_forward_axis()}set setIndexForwardAxis(A){this.raw.set_index_forward_axis(A)}addWheel(A,e,i,g,I){let n=ie.intoRaw(A),o=ie.intoRaw(e),a=ie.intoRaw(i);this.raw.add_wheel(n,o,a,g,I),n.free(),o.free(),a.free()}numWheels(){return this.raw.num_wheels()}wheelChassisConnectionPointCs(A){return ie.fromRaw(this.raw.wheel_chassis_connection_point_cs(A))}setWheelChassisConnectionPointCs(A,e){let i=ie.intoRaw(e);this.raw.set_wheel_chassis_connection_point_cs(A,i),i.free()}wheelSuspensionRestLength(A){return this.raw.wheel_suspension_rest_length(A)}setWheelSuspensionRestLength(A,e){this.raw.set_wheel_suspension_rest_length(A,e)}wheelMaxSuspensionTravel(A){return this.raw.wheel_max_suspension_travel(A)}setWheelMaxSuspensionTravel(A,e){this.raw.set_wheel_max_suspension_travel(A,e)}wheelRadius(A){return this.raw.wheel_radius(A)}setWheelRadius(A,e){this.raw.set_wheel_radius(A,e)}wheelSuspensionStiffness(A){return this.raw.wheel_suspension_stiffness(A)}setWheelSuspensionStiffness(A,e){this.raw.set_wheel_suspension_stiffness(A,e)}wheelSuspensionCompression(A){return this.raw.wheel_suspension_compression(A)}setWheelSuspensionCompression(A,e){this.raw.set_wheel_suspension_compression(A,e)}wheelSuspensionRelaxation(A){return this.raw.wheel_suspension_relaxation(A)}setWheelSuspensionRelaxation(A,e){this.raw.set_wheel_suspension_relaxation(A,e)}wheelMaxSuspensionForce(A){return this.raw.wheel_max_suspension_force(A)}setWheelMaxSuspensionForce(A,e){this.raw.set_wheel_max_suspension_force(A,e)}wheelBrake(A){return this.raw.wheel_brake(A)}setWheelBrake(A,e){this.raw.set_wheel_brake(A,e)}wheelSteering(A){return this.raw.wheel_steering(A)}setWheelSteering(A,e){this.raw.set_wheel_steering(A,e)}wheelEngineForce(A){return this.raw.wheel_engine_force(A)}setWheelEngineForce(A,e){this.raw.set_wheel_engine_force(A,e)}wheelDirectionCs(A){return ie.fromRaw(this.raw.wheel_direction_cs(A))}setWheelDirectionCs(A,e){let i=ie.intoRaw(e);this.raw.set_wheel_direction_cs(A,i),i.free()}wheelAxleCs(A){return ie.fromRaw(this.raw.wheel_axle_cs(A))}setWheelAxleCs(A,e){let i=ie.intoRaw(e);this.raw.set_wheel_axle_cs(A,i),i.free()}wheelFrictionSlip(A){return this.raw.wheel_friction_slip(A)}setWheelFrictionSlip(A,e){this.raw.set_wheel_friction_slip(A,e)}wheelSideFrictionStiffness(A){return this.raw.wheel_side_friction_stiffness(A)}setWheelSideFrictionStiffness(A,e){this.raw.set_wheel_side_friction_stiffness(A,e)}wheelRotation(A){return this.raw.wheel_rotation(A)}wheelForwardImpulse(A){return this.raw.wheel_forward_impulse(A)}wheelSideImpulse(A){return this.raw.wheel_side_impulse(A)}wheelSuspensionForce(A){return this.raw.wheel_suspension_force(A)}wheelContactNormal(A){return ie.fromRaw(this.raw.wheel_contact_normal_ws(A))}wheelContactPoint(A){return ie.fromRaw(this.raw.wheel_contact_point_ws(A))}wheelSuspensionLength(A){return this.raw.wheel_suspension_length(A)}wheelHardPoint(A){return ie.fromRaw(this.raw.wheel_hard_point_ws(A))}wheelIsInContact(A){return this.raw.wheel_is_in_contact(A)}wheelGroundObject(A){return this.colliders.get(this.raw.wheel_ground_object(A))}}class Pk{constructor(A,e,i,g,I,n,o,a,r,s,B,c,E,D){this.gravity=A,this.integrationParameters=new CP(e),this.islands=new mP(i),this.broadPhase=new kP(g),this.narrowPhase=new MP(I),this.bodies=new sP(n),this.colliders=new xP(o),this.impulseJoints=new dP(a),this.multibodyJoints=new SP(r),this.ccdSolver=new wP(s),this.queryPipeline=new UP(B),this.physicsPipeline=new RP(c),this.serializationPipeline=new BK(E),this.debugRenderPipeline=new FP(D),this.characterControllers=new Set,this.pidControllers=new Set,this.vehicleControllers=new Set,this.impulseJoints.finalizeDeserialization(this.bodies),this.bodies.finalizeDeserialization(this.colliders),this.colliders.finalizeDeserialization(this.bodies)}free(){this.integrationParameters.free(),this.islands.free(),this.broadPhase.free(),this.narrowPhase.free(),this.bodies.free(),this.colliders.free(),this.impulseJoints.free(),this.multibodyJoints.free(),this.ccdSolver.free(),this.queryPipeline.free(),this.physicsPipeline.free(),this.serializationPipeline.free(),this.debugRenderPipeline.free(),this.characterControllers.forEach(A=>A.free()),this.pidControllers.forEach(A=>A.free()),this.vehicleControllers.forEach(A=>A.free()),this.integrationParameters=void 0,this.islands=void 0,this.broadPhase=void 0,this.narrowPhase=void 0,this.bodies=void 0,this.colliders=void 0,this.ccdSolver=void 0,this.impulseJoints=void 0,this.multibodyJoints=void 0,this.queryPipeline=void 0,this.physicsPipeline=void 0,this.serializationPipeline=void 0,this.debugRenderPipeline=void 0,this.characterControllers=void 0,this.pidControllers=void 0,this.vehicleControllers=void 0}static fromRaw(A){return A?new Pk(ie.fromRaw(A.takeGravity()),A.takeIntegrationParameters(),A.takeIslandManager(),A.takeBroadPhase(),A.takeNarrowPhase(),A.takeBodies(),A.takeColliders(),A.takeImpulseJoints(),A.takeMultibodyJoints()):null}takeSnapshot(){return this.serializationPipeline.serializeAll(this.gravity,this.integrationParameters,this.islands,this.broadPhase,this.narrowPhase,this.bodies,this.colliders,this.impulseJoints,this.multibodyJoints)}static restoreSnapshot(A){return new BK().deserializeAll(A)}debugRender(){return this.debugRenderPipeline.render(this.bodies,this.colliders,this.impulseJoints,this.multibodyJoints,this.narrowPhase),new KP(this.debugRenderPipeline.vertices,this.debugRenderPipeline.colors)}step(A,e){this.physicsPipeline.step(this.gravity,this.integrationParameters,this.islands,this.broadPhase,this.narrowPhase,this.bodies,this.colliders,this.impulseJoints,this.multibodyJoints,this.ccdSolver,A,e),this.queryPipeline.update(this.colliders)}propagateModifiedBodyPositionsToColliders(){this.bodies.raw.propagateModifiedBodyPositionsToColliders(this.colliders.raw)}updateSceneQueries(){this.propagateModifiedBodyPositionsToColliders(),this.queryPipeline.update(this.colliders)}get timestep(){return this.integrationParameters.dt}set timestep(A){this.integrationParameters.dt=A}get lengthUnit(){return this.integrationParameters.lengthUnit}set lengthUnit(A){this.integrationParameters.lengthUnit=A}get numSolverIterations(){return this.integrationParameters.numSolverIterations}set numSolverIterations(A){this.integrationParameters.numSolverIterations=A}get numAdditionalFrictionIterations(){return this.integrationParameters.numAdditionalFrictionIterations}set numAdditionalFrictionIterations(A){this.integrationParameters.numAdditionalFrictionIterations=A}get numInternalPgsIterations(){return this.integrationParameters.numInternalPgsIterations}set numInternalPgsIterations(A){this.integrationParameters.numInternalPgsIterations=A}switchToStandardPgsSolver(){this.integrationParameters.switchToStandardPgsSolver()}switchToSmallStepsPgsSolver(){this.integrationParameters.switchToSmallStepsPgsSolver()}switchToSmallStepsPgsSolverWithoutWarmstart(){this.integrationParameters.switchToSmallStepsPgsSolverWithoutWarmstart()}createRigidBody(A){return this.bodies.createRigidBody(this.colliders,A)}createCharacterController(A){let e=new vP(A,this.integrationParameters,this.bodies,this.colliders,this.queryPipeline);return this.characterControllers.add(e),e}removeCharacterController(A){this.characterControllers.delete(A),A.free()}createPidController(A,e,i,g){let I=new _P(this.integrationParameters,this.bodies,A,e,i,g);return this.pidControllers.add(I),I}removePidController(A){this.pidControllers.delete(A),A.free()}createVehicleController(A){let e=new JP(A,this.bodies,this.colliders,this.queryPipeline);return this.vehicleControllers.add(e),e}removeVehicleController(A){this.vehicleControllers.delete(A),A.free()}createCollider(A,e){let i=e?e.handle:void 0;return this.colliders.createCollider(this.bodies,A,i)}createImpulseJoint(A,e,i,g){return this.impulseJoints.createJoint(this.bodies,A,e.handle,i.handle,g)}createMultibodyJoint(A,e,i,g){return this.multibodyJoints.createJoint(A,e.handle,i.handle,g)}getRigidBody(A){return this.bodies.get(A)}getCollider(A){return this.colliders.get(A)}getImpulseJoint(A){return this.impulseJoints.get(A)}getMultibodyJoint(A){return this.multibodyJoints.get(A)}removeRigidBody(A){this.bodies&&this.bodies.remove(A.handle,this.islands,this.colliders,this.impulseJoints,this.multibodyJoints)}removeCollider(A,e){this.colliders&&this.colliders.remove(A.handle,this.islands,this.bodies,e)}removeImpulseJoint(A,e){this.impulseJoints&&this.impulseJoints.remove(A.handle,e)}removeMultibodyJoint(A,e){this.impulseJoints&&this.multibodyJoints.remove(A.handle,e)}forEachCollider(A){this.colliders.forEach(A)}forEachRigidBody(A){this.bodies.forEach(A)}forEachActiveRigidBody(A){this.bodies.forEachActiveRigidBody(this.islands,A)}castRay(A,e,i,g,I,n,o,a){return this.queryPipeline.castRay(this.bodies,this.colliders,A,e,i,g,I,n?n.handle:null,o?o.handle:null,this.colliders.castClosure(a))}castRayAndGetNormal(A,e,i,g,I,n,o,a){return this.queryPipeline.castRayAndGetNormal(this.bodies,this.colliders,A,e,i,g,I,n?n.handle:null,o?o.handle:null,this.colliders.castClosure(a))}intersectionsWithRay(A,e,i,g,I,n,o,a,r){this.queryPipeline.intersectionsWithRay(this.bodies,this.colliders,A,e,i,g,I,n,o?o.handle:null,a?a.handle:null,this.colliders.castClosure(r))}intersectionWithShape(A,e,i,g,I,n,o,a){let r=this.queryPipeline.intersectionWithShape(this.bodies,this.colliders,A,e,i,g,I,n?n.handle:null,o?o.handle:null,this.colliders.castClosure(a));return r!=null?this.colliders.get(r):null}projectPoint(A,e,i,g,I,n,o){return this.queryPipeline.projectPoint(this.bodies,this.colliders,A,e,i,g,I?I.handle:null,n?n.handle:null,this.colliders.castClosure(o))}projectPointAndGetFeature(A,e,i,g,I,n){return this.queryPipeline.projectPointAndGetFeature(this.bodies,this.colliders,A,e,i,g?g.handle:null,I?I.handle:null,this.colliders.castClosure(n))}intersectionsWithPoint(A,e,i,g,I,n,o){this.queryPipeline.intersectionsWithPoint(this.bodies,this.colliders,A,this.colliders.castClosure(e),i,g,I?I.handle:null,n?n.handle:null,this.colliders.castClosure(o))}castShape(A,e,i,g,I,n,o,a,r,s,B,c){return this.queryPipeline.castShape(this.bodies,this.colliders,A,e,i,g,I,n,o,a,r,s?s.handle:null,B?B.handle:null,this.colliders.castClosure(c))}intersectionsWithShape(A,e,i,g,I,n,o,a,r){this.queryPipeline.intersectionsWithShape(this.bodies,this.colliders,A,e,i,this.colliders.castClosure(g),I,n,o?o.handle:null,a?a.handle:null,this.colliders.castClosure(r))}collidersWithAabbIntersectingAabb(A,e,i){this.queryPipeline.collidersWithAabbIntersectingAabb(A,e,this.colliders.castClosure(i))}contactPairsWith(A,e){this.narrowPhase.contactPairsWith(A.handle,this.colliders.castClosure(e))}intersectionPairsWith(A,e){this.narrowPhase.intersectionPairsWith(A.handle,this.colliders.castClosure(e))}contactPair(A,e,i){this.narrowPhase.contactPair(A.handle,e.handle,i)}intersectionPair(A,e){return this.narrowPhase.intersectionPair(A.handle,e.handle)}}(function(t){t[t.NONE=0]="NONE",t[t.COLLISION_EVENTS=1]="COLLISION_EVENTS",t[t.CONTACT_FORCE_EVENTS=2]="CONTACT_FORCE_EVENTS"})(Xl||(Xl={}));class LP{free(){this.raw&&this.raw.free(),this.raw=void 0}collider1(){return this.raw.collider1()}collider2(){return this.raw.collider2()}totalForce(){return ie.fromRaw(this.raw.total_force())}totalForceMagnitude(){return this.raw.total_force_magnitude()}maxForceDirection(){return ie.fromRaw(this.raw.max_force_direction())}maxForceMagnitude(){return this.raw.max_force_magnitude()}}class qP{constructor(A,e){this.raw=e||new yIA(A)}free(){this.raw&&this.raw.free(),this.raw=void 0}drainCollisionEvents(A){this.raw.drainCollisionEvents(A)}drainContactForceEvents(A){let e=new LP;this.raw.drainContactForceEvents(i=>{e.raw=i,A(e),e.free()})}clear(){this.raw.clear()}}(function(t){t[t.NONE=0]="NONE",t[t.FILTER_CONTACT_PAIRS=1]="FILTER_CONTACT_PAIRS",t[t.FILTER_INTERSECTION_PAIRS=2]="FILTER_INTERSECTION_PAIRS"})(b0||(b0={})),function(t){t[t.EMPTY=0]="EMPTY",t[t.COMPUTE_IMPULSE=1]="COMPUTE_IMPULSE"}(sK||(sK={})),function(t){t[t.DYNAMIC_DYNAMIC=1]="DYNAMIC_DYNAMIC",t[t.DYNAMIC_KINEMATIC=12]="DYNAMIC_KINEMATIC",t[t.DYNAMIC_FIXED=2]="DYNAMIC_FIXED",t[t.KINEMATIC_KINEMATIC=52224]="KINEMATIC_KINEMATIC",t[t.KINEMATIC_FIXED=8704]="KINEMATIC_FIXED",t[t.FIXED_FIXED=32]="FIXED_FIXED",t[t.DEFAULT=15]="DEFAULT",t[t.ALL=60943]="ALL"}(v0||(v0={}));class cK{constructor(A,e,i,g){this.colliderSet=A,this.handle=e,this._parent=i,this._shape=g}finalizeDeserialization(A){this.handle!=null&&(this._parent=A.get(this.colliderSet.raw.coParent(this.handle)))}ensureShapeIsCached(){this._shape||(this._shape=Fn.fromRaw(this.colliderSet.raw,this.handle))}get shape(){return this.ensureShapeIsCached(),this._shape}isValid(){return this.colliderSet.raw.contains(this.handle)}translation(){return ie.fromRaw(this.colliderSet.raw.coTranslation(this.handle))}rotation(){return Gi.fromRaw(this.colliderSet.raw.coRotation(this.handle))}isSensor(){return this.colliderSet.raw.coIsSensor(this.handle)}setSensor(A){this.colliderSet.raw.coSetSensor(this.handle,A)}setShape(A){let e=A.intoRaw();this.colliderSet.raw.coSetShape(this.handle,e),e.free(),this._shape=A}setEnabled(A){this.colliderSet.raw.coSetEnabled(this.handle,A)}isEnabled(){return this.colliderSet.raw.coIsEnabled(this.handle)}setRestitution(A){this.colliderSet.raw.coSetRestitution(this.handle,A)}setFriction(A){this.colliderSet.raw.coSetFriction(this.handle,A)}frictionCombineRule(){return this.colliderSet.raw.coFrictionCombineRule(this.handle)}setFrictionCombineRule(A){this.colliderSet.raw.coSetFrictionCombineRule(this.handle,A)}restitutionCombineRule(){return this.colliderSet.raw.coRestitutionCombineRule(this.handle)}setRestitutionCombineRule(A){this.colliderSet.raw.coSetRestitutionCombineRule(this.handle,A)}setCollisionGroups(A){this.colliderSet.raw.coSetCollisionGroups(this.handle,A)}setSolverGroups(A){this.colliderSet.raw.coSetSolverGroups(this.handle,A)}contactSkin(){return this.colliderSet.raw.coContactSkin(this.handle)}setContactSkin(A){return this.colliderSet.raw.coSetContactSkin(this.handle,A)}activeHooks(){return this.colliderSet.raw.coActiveHooks(this.handle)}setActiveHooks(A){this.colliderSet.raw.coSetActiveHooks(this.handle,A)}activeEvents(){return this.colliderSet.raw.coActiveEvents(this.handle)}setActiveEvents(A){this.colliderSet.raw.coSetActiveEvents(this.handle,A)}activeCollisionTypes(){return this.colliderSet.raw.coActiveCollisionTypes(this.handle)}setContactForceEventThreshold(A){return this.colliderSet.raw.coSetContactForceEventThreshold(this.handle,A)}contactForceEventThreshold(){return this.colliderSet.raw.coContactForceEventThreshold(this.handle)}setActiveCollisionTypes(A){this.colliderSet.raw.coSetActiveCollisionTypes(this.handle,A)}setDensity(A){this.colliderSet.raw.coSetDensity(this.handle,A)}setMass(A){this.colliderSet.raw.coSetMass(this.handle,A)}setMassProperties(A,e,i,g){let I=ie.intoRaw(e),n=ie.intoRaw(i),o=Gi.intoRaw(g);this.colliderSet.raw.coSetMassProperties(this.handle,A,I,n,o),I.free(),n.free(),o.free()}setTranslation(A){this.colliderSet.raw.coSetTranslation(this.handle,A.x,A.y,A.z)}setTranslationWrtParent(A){this.colliderSet.raw.coSetTranslationWrtParent(this.handle,A.x,A.y,A.z)}setRotation(A){this.colliderSet.raw.coSetRotation(this.handle,A.x,A.y,A.z,A.w)}setRotationWrtParent(A){this.colliderSet.raw.coSetRotationWrtParent(this.handle,A.x,A.y,A.z,A.w)}shapeType(){return this.colliderSet.raw.coShapeType(this.handle)}halfExtents(){return ie.fromRaw(this.colliderSet.raw.coHalfExtents(this.handle))}setHalfExtents(A){const e=ie.intoRaw(A);this.colliderSet.raw.coSetHalfExtents(this.handle,e)}radius(){return this.colliderSet.raw.coRadius(this.handle)}setRadius(A){this.colliderSet.raw.coSetRadius(this.handle,A)}roundRadius(){return this.colliderSet.raw.coRoundRadius(this.handle)}setRoundRadius(A){this.colliderSet.raw.coSetRoundRadius(this.handle,A)}halfHeight(){return this.colliderSet.raw.coHalfHeight(this.handle)}setHalfHeight(A){this.colliderSet.raw.coSetHalfHeight(this.handle,A)}vertices(){return this.colliderSet.raw.coVertices(this.handle)}indices(){return this.colliderSet.raw.coIndices(this.handle)}heightfieldHeights(){return this.colliderSet.raw.coHeightfieldHeights(this.handle)}heightfieldScale(){let A=this.colliderSet.raw.coHeightfieldScale(this.handle);return ie.fromRaw(A)}heightfieldNRows(){return this.colliderSet.raw.coHeightfieldNRows(this.handle)}heightfieldNCols(){return this.colliderSet.raw.coHeightfieldNCols(this.handle)}parent(){return this._parent}friction(){return this.colliderSet.raw.coFriction(this.handle)}restitution(){return this.colliderSet.raw.coRestitution(this.handle)}density(){return this.colliderSet.raw.coDensity(this.handle)}mass(){return this.colliderSet.raw.coMass(this.handle)}volume(){return this.colliderSet.raw.coVolume(this.handle)}collisionGroups(){return this.colliderSet.raw.coCollisionGroups(this.handle)}solverGroups(){return this.colliderSet.raw.coSolverGroups(this.handle)}containsPoint(A){let e=ie.intoRaw(A),i=this.colliderSet.raw.coContainsPoint(this.handle,e);return e.free(),i}projectPoint(A,e){let i=ie.intoRaw(A),g=Vy.fromRaw(this.colliderSet.raw.coProjectPoint(this.handle,i,e));return i.free(),g}intersectsRay(A,e){let i=ie.intoRaw(A.origin),g=ie.intoRaw(A.dir),I=this.colliderSet.raw.coIntersectsRay(this.handle,i,g,e);return i.free(),g.free(),I}castShape(A,e,i,g,I,n,o,a){let r=ie.intoRaw(A),s=ie.intoRaw(i),B=Gi.intoRaw(g),c=ie.intoRaw(I),E=e.intoRaw(),D=Cp.fromRaw(this.colliderSet,this.colliderSet.raw.coCastShape(this.handle,r,E,s,B,c,n,o,a));return r.free(),s.free(),B.free(),c.free(),E.free(),D}castCollider(A,e,i,g,I,n){let o=ie.intoRaw(A),a=ie.intoRaw(i),r=$y.fromRaw(this.colliderSet,this.colliderSet.raw.coCastCollider(this.handle,o,e.handle,a,g,I,n));return o.free(),a.free(),r}intersectsShape(A,e,i){let g=ie.intoRaw(e),I=Gi.intoRaw(i),n=A.intoRaw(),o=this.colliderSet.raw.coIntersectsShape(this.handle,n,g,I);return g.free(),I.free(),n.free(),o}contactShape(A,e,i,g){let I=ie.intoRaw(e),n=Gi.intoRaw(i),o=A.intoRaw(),a=Ud.fromRaw(this.colliderSet.raw.coContactShape(this.handle,o,I,n,g));return I.free(),n.free(),o.free(),a}contactCollider(A,e){return Ud.fromRaw(this.colliderSet.raw.coContactCollider(this.handle,A.handle,e))}castRay(A,e,i){let g=ie.intoRaw(A.origin),I=ie.intoRaw(A.dir),n=this.colliderSet.raw.coCastRay(this.handle,g,I,e,i);return g.free(),I.free(),n}castRayAndGetNormal(A,e,i){let g=ie.intoRaw(A.origin),I=ie.intoRaw(A.dir),n=Xy.fromRaw(this.colliderSet.raw.coCastRayAndGetNormal(this.handle,g,I,e,i));return g.free(),I.free(),n}}(function(t){t[t.Density=0]="Density",t[t.Mass=1]="Mass",t[t.MassProps=2]="MassProps"})(FE||(FE={}));class zI{constructor(A){this.enabled=!0,this.shape=A,this.massPropsMode=FE.Density,this.density=1,this.friction=.5,this.restitution=0,this.rotation=Gi.identity(),this.translation=ie.zeros(),this.isSensor=!1,this.collisionGroups=4294967295,this.solverGroups=4294967295,this.frictionCombineRule=ry.Average,this.restitutionCombineRule=ry.Average,this.activeCollisionTypes=v0.DEFAULT,this.activeEvents=Xl.NONE,this.activeHooks=b0.NONE,this.mass=0,this.centerOfMass=ie.zeros(),this.contactForceEventThreshold=0,this.contactSkin=0,this.principalAngularInertia=ie.zeros(),this.angularInertiaLocalFrame=Gi.identity()}static ball(A){const e=new pb(A);return new zI(e)}static capsule(A,e){const i=new yb(A,e);return new zI(i)}static segment(A,e){const i=new Sb(A,e);return new zI(i)}static triangle(A,e,i){const g=new wb(A,e,i);return new zI(g)}static roundTriangle(A,e,i,g){const I=new mb(A,e,i,g);return new zI(I)}static polyline(A,e){const i=new kb(A,e);return new zI(i)}static trimesh(A,e,i){const g=new Mb(A,e,i);return new zI(g)}static cuboid(A,e,i){const g=new fb(A,e,i);return new zI(g)}static roundCuboid(A,e,i,g){const I=new Db(A,e,i,g);return new zI(I)}static heightfield(A,e,i,g,I){const n=new Nb(A,e,i,g,I);return new zI(n)}static cylinder(A,e){const i=new Gb(A,e);return new zI(i)}static roundCylinder(A,e,i){const g=new Rb(A,e,i);return new zI(g)}static cone(A,e){const i=new Ub(A,e);return new zI(i)}static roundCone(A,e,i){const g=new Kb(A,e,i);return new zI(g)}static convexHull(A){const e=new _0(A,null);return new zI(e)}static convexMesh(A,e){const i=new _0(A,e);return new zI(i)}static roundConvexHull(A,e){const i=new J0(A,null,e);return new zI(i)}static roundConvexMesh(A,e,i){const g=new J0(A,e,i);return new zI(g)}setTranslation(A,e,i){if(typeof A!="number"||typeof e!="number"||typeof i!="number")throw TypeError("The translation components must be numbers.");return this.translation={x:A,y:e,z:i},this}setRotation(A){return Gi.copy(this.rotation,A),this}setSensor(A){return this.isSensor=A,this}setEnabled(A){return this.enabled=A,this}setContactSkin(A){return this.contactSkin=A,this}setDensity(A){return this.massPropsMode=FE.Density,this.density=A,this}setMass(A){return this.massPropsMode=FE.Mass,this.mass=A,this}setMassProperties(A,e,i,g){return this.massPropsMode=FE.MassProps,this.mass=A,ie.copy(this.centerOfMass,e),ie.copy(this.principalAngularInertia,i),Gi.copy(this.angularInertiaLocalFrame,g),this}setRestitution(A){return this.restitution=A,this}setFriction(A){return this.friction=A,this}setFrictionCombineRule(A){return this.frictionCombineRule=A,this}setRestitutionCombineRule(A){return this.restitutionCombineRule=A,this}setCollisionGroups(A){return this.collisionGroups=A,this}setSolverGroups(A){return this.solverGroups=A,this}setActiveHooks(A){return this.activeHooks=A,this}setActiveEvents(A){return this.activeEvents=A,this}setActiveCollisionTypes(A){return this.activeCollisionTypes=A,this}setContactForceEventThreshold(A){return this.contactForceEventThreshold=A,this}}class xP{constructor(A){this.raw=A||new qI,this.map=new ub,A&&A.forEachColliderHandle(e=>{this.map.set(e,new cK(this,e,null))})}free(){this.raw&&this.raw.free(),this.raw=void 0,this.map&&this.map.clear(),this.map=void 0}castClosure(A){return e=>A?A(this.get(e)):void 0}finalizeDeserialization(A){this.map.forEach(e=>e.finalizeDeserialization(A))}createCollider(A,e,i){let g=i!=null&&i!=null;if(g&&isNaN(i))throw Error("Cannot create a collider with a parent rigid-body handle that is not a number.");let I=e.shape.intoRaw(),n=ie.intoRaw(e.translation),o=Gi.intoRaw(e.rotation),a=ie.intoRaw(e.centerOfMass),r=ie.intoRaw(e.principalAngularInertia),s=Gi.intoRaw(e.angularInertiaLocalFrame),B=this.raw.createCollider(e.enabled,I,n,o,e.massPropsMode,e.mass,a,r,s,e.density,e.friction,e.restitution,e.frictionCombineRule,e.restitutionCombineRule,e.isSensor,e.collisionGroups,e.solverGroups,e.activeCollisionTypes,e.activeHooks,e.activeEvents,e.contactForceEventThreshold,e.contactSkin,g,g?i:0,A.raw);I.free(),n.free(),o.free(),a.free(),r.free(),s.free();let c=g?A.get(i):null,E=new cK(this,B,c,e.shape);return this.map.set(B,E),E}remove(A,e,i,g){this.raw.remove(A,e.raw,i.raw,g),this.unmap(A)}unmap(A){this.map.delete(A)}get(A){return this.map.get(A)}len(){return this.map.len()}contains(A){return this.get(A)!=null}forEach(A){this.map.forEach(A)}getAll(){return this.map.getAll()}}function n2A(t,A,e,i){return new(e||(e=Promise))(function(g,I){function n(r){try{a(i.next(r))}catch(s){I(s)}}function o(r){try{a(i.throw(r))}catch(s){I(s)}}function a(r){var s;r.done?g(r.value):(s=r.value,s instanceof e?s:new e(function(B){B(s)})).then(n,o)}a((i=i.apply(t,[])).next())})}for(var o2A={byteLength:function(t){var A=bz(t),e=A[0],i=A[1];return 3*(e+i)/4-i},toByteArray:function(t){var A,e,i=bz(t),g=i[0],I=i[1],n=new a2A(function(r,s,B){return 3*(s+B)/4-B}(0,g,I)),o=0,a=I>0?g-4:g;for(e=0;e<a;e+=4)A=Ps[t.charCodeAt(e)]<<18|Ps[t.charCodeAt(e+1)]<<12|Ps[t.charCodeAt(e+2)]<<6|Ps[t.charCodeAt(e+3)],n[o++]=A>>16&255,n[o++]=A>>8&255,n[o++]=255&A;return I===2&&(A=Ps[t.charCodeAt(e)]<<2|Ps[t.charCodeAt(e+1)]>>4,n[o++]=255&A),I===1&&(A=Ps[t.charCodeAt(e)]<<10|Ps[t.charCodeAt(e+1)]<<4|Ps[t.charCodeAt(e+2)]>>2,n[o++]=A>>8&255,n[o++]=255&A),n},fromByteArray:function(t){for(var A,e=t.length,i=e%3,g=[],I=16383,n=0,o=e-i;n<o;n+=I)g.push(s2A(t,n,n+I>o?o:n+I));return i===1?(A=t[e-1],g.push(Nc[A>>2]+Nc[A<<4&63]+"==")):i===2&&(A=(t[e-2]<<8)+t[e-1],g.push(Nc[A>>10]+Nc[A>>4&63]+Nc[A<<2&63]+"=")),g.join("")}},Nc=[],Ps=[],a2A=typeof Uint8Array<"u"?Uint8Array:Array,HL="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",yf=0,r2A=HL.length;yf<r2A;++yf)Nc[yf]=HL[yf],Ps[HL.charCodeAt(yf)]=yf;function bz(t){var A=t.length;if(A%4>0)throw new Error("Invalid string. Length must be a multiple of 4");var e=t.indexOf("=");return e===-1&&(e=A),[e,e===A?0:4-e%4]}function s2A(t,A,e){for(var i,g,I=[],n=A;n<e;n+=3)i=(t[n]<<16&16711680)+(t[n+1]<<8&65280)+(255&t[n+2]),I.push(Nc[(g=i)>>18&63]+Nc[g>>12&63]+Nc[g>>6&63]+Nc[63&g]);return I.join("")}function mIA(){return n2A(this,void 0,void 0,function*(){yield SIA(o2A.toByteArray(" ").buffer)})}function kIA(){return function(){let t,A;try{const g=Z.__wbindgen_add_to_stack_pointer(-16);Z.version(g);var e=lo().getInt32(g+0,!0),i=lo().getInt32(g+4,!0);return t=e,A=i,EIA(e,i)}finally{Z.__wbindgen_add_to_stack_pointer(16),Z.__wbindgen_export_1(t,A,1)}}()}Ps[45]=62,Ps[95]=63;var C2A=Object.freeze({__proto__:null,version:kIA,Vector3:vD,VectorOps:ie,Quaternion:tK,RotationOps:Gi,SdpMatrix3:rP,SdpMatrix3Ops:iK,get RigidBodyType(){return $s},RigidBody:CK,RigidBodyDesc:AC,RigidBodySet:sP,IntegrationParameters:CP,get JointType(){return co},get MotorModel(){return gK},get JointAxesMask(){return IK},ImpulseJoint:lC,UnitImpulseJoint:hb,FixedImpulseJoint:BP,RopeImpulseJoint:cP,SpringImpulseJoint:lP,PrismaticImpulseJoint:QP,RevoluteImpulseJoint:EP,GenericImpulseJoint:uP,SphericalImpulseJoint:hP,JointData:kc,ImpulseJointSet:dP,MultibodyJoint:yQ,UnitMultibodyJoint:db,FixedMultibodyJoint:pP,PrismaticMultibodyJoint:fP,RevoluteMultibodyJoint:DP,SphericalMultibodyJoint:yP,MultibodyJointSet:SP,get CoefficientCombineRule(){return ry},CCDSolver:wP,IslandManager:mP,BroadPhase:kP,NarrowPhase:MP,TempContactManifold:NP,Shape:Fn,get ShapeType(){return cn},get HeightFieldFlags(){return nK},get TriMeshFlags(){return oK},Ball:pb,HalfSpace:GP,Cuboid:fb,RoundCuboid:Db,Capsule:yb,Segment:Sb,Triangle:wb,RoundTriangle:mb,Polyline:kb,TriMesh:Mb,ConvexPolyhedron:_0,RoundConvexPolyhedron:J0,Heightfield:Nb,Cylinder:Gb,RoundCylinder:Rb,Cone:Ub,RoundCone:Kb,get ActiveCollisionTypes(){return v0},Collider:cK,get MassPropsMode(){return FE},ColliderDesc:zI,ColliderSet:xP,get FeatureType(){return Rd},Ray:wIA,RayIntersection:Xy,RayColliderIntersection:Cy,RayColliderHit:Ok,PointProjection:Vy,PointColliderProjection:sy,ShapeCastHit:Cp,ColliderShapeCastHit:$y,ShapeContact:Ud,World:Pk,PhysicsPipeline:RP,SerializationPipeline:BK,get ActiveEvents(){return Xl},TempContactForceEvent:LP,EventQueue:qP,get ActiveHooks(){return b0},get SolverFlags(){return sK},DebugRenderBuffers:KP,DebugRenderPipeline:FP,get QueryFilterFlags(){return aK},QueryPipeline:UP,init:mIA,CharacterCollision:bP,KinematicCharacterController:vP,get PidAxesMask(){return rK},PidController:_P,DynamicRayCastVehicleController:JP});const B2A=Object.freeze(Object.defineProperty({__proto__:null,get ActiveCollisionTypes(){return v0},get ActiveEvents(){return Xl},get ActiveHooks(){return b0},Ball:pb,BroadPhase:kP,CCDSolver:wP,Capsule:yb,CharacterCollision:bP,get CoefficientCombineRule(){return ry},Collider:cK,ColliderDesc:zI,ColliderSet:xP,ColliderShapeCastHit:$y,Cone:Ub,ConvexPolyhedron:_0,Cuboid:fb,Cylinder:Gb,DebugRenderBuffers:KP,DebugRenderPipeline:FP,DynamicRayCastVehicleController:JP,EventQueue:qP,get FeatureType(){return Rd},FixedImpulseJoint:BP,FixedMultibodyJoint:pP,GenericImpulseJoint:uP,HalfSpace:GP,get HeightFieldFlags(){return nK},Heightfield:Nb,ImpulseJoint:lC,ImpulseJointSet:dP,IntegrationParameters:CP,IslandManager:mP,get JointAxesMask(){return IK},JointData:kc,get JointType(){return co},KinematicCharacterController:vP,get MassPropsMode(){return FE},get MotorModel(){return gK},MultibodyJoint:yQ,MultibodyJointSet:SP,NarrowPhase:MP,PhysicsPipeline:RP,get PidAxesMask(){return rK},PidController:_P,PointColliderProjection:sy,PointProjection:Vy,Polyline:kb,PrismaticImpulseJoint:QP,PrismaticMultibodyJoint:fP,Quaternion:tK,get QueryFilterFlags(){return aK},QueryPipeline:UP,Ray:wIA,RayColliderHit:Ok,RayColliderIntersection:Cy,RayIntersection:Xy,RevoluteImpulseJoint:EP,RevoluteMultibodyJoint:DP,RigidBody:CK,RigidBodyDesc:AC,RigidBodySet:sP,get RigidBodyType(){return $s},RopeImpulseJoint:cP,RotationOps:Gi,RoundCone:Kb,RoundConvexPolyhedron:J0,RoundCuboid:Db,RoundCylinder:Rb,RoundTriangle:mb,SdpMatrix3:rP,SdpMatrix3Ops:iK,Segment:Sb,SerializationPipeline:BK,Shape:Fn,ShapeCastHit:Cp,ShapeContact:Ud,get ShapeType(){return cn},get SolverFlags(){return sK},SphericalImpulseJoint:hP,SphericalMultibodyJoint:yP,SpringImpulseJoint:lP,TempContactForceEvent:LP,TempContactManifold:NP,TriMesh:Mb,get TriMeshFlags(){return oK},Triangle:wb,UnitImpulseJoint:hb,UnitMultibodyJoint:db,Vector3:vD,VectorOps:ie,World:Pk,default:C2A,init:mIA,version:kIA},Symbol.toStringTag,{value:"Module"}));var OL={exports:{}},Rl={};/**
 * @license React
 * react-reconciler-constants.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 vz;function c2A(){return vz||(vz=1,Rl.ConcurrentRoot=1,Rl.ContinuousEventPriority=8,Rl.DefaultEventPriority=32,Rl.DiscreteEventPriority=2,Rl.IdleEventPriority=268435456,Rl.LegacyRoot=0,Rl.NoEventPriority=0),Rl}var _z;function l2A(){return _z||(_z=1,OL.exports=c2A()),OL.exports}var ZR=l2A();/**
 * @license
 * Copyright 2010-2025 Three.js Authors
 * SPDX-License-Identifier: MIT
 */const jk="180",Q2A={LEFT:0,MIDDLE:1,RIGHT:2,ROTATE:0,DOLLY:1,PAN:2},E2A={ROTATE:0,PAN:1,DOLLY_PAN:2,DOLLY_ROTATE:3},MIA=0,SY=1,NIA=2,u2A=3,GIA=0,Fb=1,Pm=2,eB=3,jc=0,Ir=1,sB=2,oQ=0,Qd=1,wY=2,mY=3,kY=4,RIA=5,NE=100,UIA=101,KIA=102,FIA=103,bIA=104,vIA=200,_IA=201,JIA=202,LIA=203,lK=204,QK=205,qIA=206,xIA=207,TIA=208,YIA=209,HIA=210,OIA=211,PIA=212,jIA=213,ZIA=214,EK=0,uK=1,hK=2,Kd=3,dK=4,pK=5,fK=6,DK=7,Zk=0,WIA=1,zIA=2,Tc=0,VIA=1,XIA=2,$IA=3,Wk=4,AnA=5,enA=6,tnA=7,MY="attached",inA="detached",bb=300,SQ=301,ru=302,L0=303,q0=304,AS=306,su=1e3,Bs=1001,By=1002,ho=1003,vb=1004,h2A=1004,Vh=1005,d2A=1005,HI=1006,_D=1007,p2A=1007,oC=1008,f2A=1008,QC=1009,TP=1010,YP=1011,cy=1012,_b=1013,wQ=1014,ir=1015,Bp=1016,Jb=1017,Lb=1018,ly=1020,HP=35902,OP=35899,PP=1021,jP=1022,da=1023,Qy=1026,Ey=1027,qb=1028,zk=1029,ZP=1030,xb=1031,D2A=1032,Tb=1033,jm=33776,Zm=33777,Wm=33778,zm=33779,yK=35840,SK=35841,wK=35842,mK=35843,kK=36196,MK=37492,NK=37496,GK=37808,RK=37809,UK=37810,KK=37811,FK=37812,bK=37813,vK=37814,_K=37815,JK=37816,LK=37817,qK=37818,xK=37819,TK=37820,YK=37821,HK=36492,OK=36494,PK=36495,jK=36283,ZK=36284,WK=36285,zK=36286,gnA=2200,InA=2201,nnA=2202,uy=2300,hy=2301,WR=2302,Xh=2400,$h=2401,x0=2402,Yb=2500,WP=2501,onA=0,zP=1,VK=2,anA=3200,rnA=3201,y2A=3202,S2A=3203,wu=0,snA=1,zl="",Hn="srgb",Cu="srgb-linear",T0="linear",Vg="srgb",w2A=0,Yh=7680,m2A=7681,k2A=7682,M2A=7683,N2A=34055,G2A=34056,R2A=5386,U2A=512,K2A=513,F2A=514,b2A=515,v2A=516,_2A=517,J2A=518,NY=519,CnA=512,BnA=513,cnA=514,VP=515,lnA=516,QnA=517,EnA=518,unA=519,Y0=35044,hnA=35048,L2A=35040,q2A=35045,x2A=35049,T2A=35041,Y2A=35046,H2A=35050,O2A=35042,P2A="100",GY="300 es",cs=2e3,dy=2001,j2A={COMPUTE:"compute",RENDER:"render"},Z2A={PERSPECTIVE:"perspective",LINEAR:"linear",FLAT:"flat"},W2A={NORMAL:"normal",CENTROID:"centroid",SAMPLE:"sample",FIRST:"first",EITHER:"either"};class $c{addEventListener(A,e){this._listeners===void 0&&(this._listeners={});const i=this._listeners;i[A]===void 0&&(i[A]=[]),i[A].indexOf(e)===-1&&i[A].push(e)}hasEventListener(A,e){const i=this._listeners;return i===void 0?!1:i[A]!==void 0&&i[A].indexOf(e)!==-1}removeEventListener(A,e){const i=this._listeners;if(i===void 0)return;const g=i[A];if(g!==void 0){const I=g.indexOf(e);I!==-1&&g.splice(I,1)}}dispatchEvent(A){const e=this._listeners;if(e===void 0)return;const i=e[A.type];if(i!==void 0){A.target=this;const g=i.slice(0);for(let I=0,n=g.length;I<n;I++)g[I].call(this,A);A.target=null}}}const Ba=["00","01","02","03","04","05","06","07","08","09","0a","0b","0c","0d","0e","0f","10","11","12","13","14","15","16","17","18","19","1a","1b","1c","1d","1e","1f","20","21","22","23","24","25","26","27","28","29","2a","2b","2c","2d","2e","2f","30","31","32","33","34","35","36","37","38","39","3a","3b","3c","3d","3e","3f","40","41","42","43","44","45","46","47","48","49","4a","4b","4c","4d","4e","4f","50","51","52","53","54","55","56","57","58","59","5a","5b","5c","5d","5e","5f","60","61","62","63","64","65","66","67","68","69","6a","6b","6c","6d","6e","6f","70","71","72","73","74","75","76","77","78","79","7a","7b","7c","7d","7e","7f","80","81","82","83","84","85","86","87","88","89","8a","8b","8c","8d","8e","8f","90","91","92","93","94","95","96","97","98","99","9a","9b","9c","9d","9e","9f","a0","a1","a2","a3","a4","a5","a6","a7","a8","a9","aa","ab","ac","ad","ae","af","b0","b1","b2","b3","b4","b5","b6","b7","b8","b9","ba","bb","bc","bd","be","bf","c0","c1","c2","c3","c4","c5","c6","c7","c8","c9","ca","cb","cc","cd","ce","cf","d0","d1","d2","d3","d4","d5","d6","d7","d8","d9","da","db","dc","dd","de","df","e0","e1","e2","e3","e4","e5","e6","e7","e8","e9","ea","eb","ec","ed","ee","ef","f0","f1","f2","f3","f4","f5","f6","f7","f8","f9","fa","fb","fc","fd","fe","ff"];let Jz=1234567;const Ed=Math.PI/180,py=180/Math.PI;function Qs(){const t=Math.random()*4294967295|0,A=Math.random()*4294967295|0,e=Math.random()*4294967295|0,i=Math.random()*4294967295|0;return(Ba[t&255]+Ba[t>>8&255]+Ba[t>>16&255]+Ba[t>>24&255]+"-"+Ba[A&255]+Ba[A>>8&255]+"-"+Ba[A>>16&15|64]+Ba[A>>24&255]+"-"+Ba[e&63|128]+Ba[e>>8&255]+"-"+Ba[e>>16&255]+Ba[e>>24&255]+Ba[i&255]+Ba[i>>8&255]+Ba[i>>16&255]+Ba[i>>24&255]).toLowerCase()}function Ci(t,A,e){return Math.max(A,Math.min(e,t))}function XP(t,A){return(t%A+A)%A}function z2A(t,A,e,i,g){return i+(t-A)*(g-i)/(e-A)}function V2A(t,A,e){return t!==A?(e-t)/(A-t):0}function Vm(t,A,e){return(1-e)*t+e*A}function X2A(t,A,e,i){return Vm(t,A,1-Math.exp(-e*i))}function $2A(t,A=1){return A-Math.abs(XP(t,A*2)-A)}function AHA(t,A,e){return t<=A?0:t>=e?1:(t=(t-A)/(e-A),t*t*(3-2*t))}function eHA(t,A,e){return t<=A?0:t>=e?1:(t=(t-A)/(e-A),t*t*t*(t*(t*6-15)+10))}function tHA(t,A){return t+Math.floor(Math.random()*(A-t+1))}function iHA(t,A){return t+Math.random()*(A-t)}function gHA(t){return t*(.5-Math.random())}function IHA(t){t!==void 0&&(Jz=t);let A=Jz+=1831565813;return A=Math.imul(A^A>>>15,A|1),A^=A+Math.imul(A^A>>>7,A|61),((A^A>>>14)>>>0)/4294967296}function nHA(t){return t*Ed}function oHA(t){return t*py}function aHA(t){return(t&t-1)===0&&t!==0}function rHA(t){return Math.pow(2,Math.ceil(Math.log(t)/Math.LN2))}function sHA(t){return Math.pow(2,Math.floor(Math.log(t)/Math.LN2))}function CHA(t,A,e,i,g){const I=Math.cos,n=Math.sin,o=I(e/2),a=n(e/2),r=I((A+i)/2),s=n((A+i)/2),B=I((A-i)/2),c=n((A-i)/2),E=I((i-A)/2),D=n((i-A)/2);switch(g){case"XYX":t.set(o*s,a*B,a*c,o*r);break;case"YZY":t.set(a*c,o*s,a*B,o*r);break;case"ZXZ":t.set(a*B,a*c,o*s,o*r);break;case"XZX":t.set(o*s,a*D,a*E,o*r);break;case"YXY":t.set(a*E,o*s,a*D,o*r);break;case"ZYZ":t.set(a*D,a*E,o*s,o*r);break;default:}}function $a(t,A){switch(A.constructor){case Float32Array:return t;case Uint32Array:return t/4294967295;case Uint16Array:return t/65535;case Uint8Array:return t/255;case Int32Array:return Math.max(t/2147483647,-1);case Int16Array:return Math.max(t/32767,-1);case Int8Array:return Math.max(t/127,-1);default:throw new Error("Invalid component type.")}}function Fi(t,A){switch(A.constructor){case Float32Array:return t;case Uint32Array:return Math.round(t*4294967295);case Uint16Array:return Math.round(t*65535);case Uint8Array:return Math.round(t*255);case Int32Array:return Math.round(t*2147483647);case Int16Array:return Math.round(t*32767);case Int8Array:return Math.round(t*127);default:throw new Error("Invalid component type.")}}const $P={DEG2RAD:Ed,RAD2DEG:py,generateUUID:Qs,clamp:Ci,euclideanModulo:XP,mapLinear:z2A,inverseLerp:V2A,lerp:Vm,damp:X2A,pingpong:$2A,smoothstep:AHA,smootherstep:eHA,randInt:tHA,randFloat:iHA,randFloatSpread:gHA,seededRandom:IHA,degToRad:nHA,radToDeg:oHA,isPowerOfTwo:aHA,ceilPowerOfTwo:rHA,floorPowerOfTwo:sHA,setQuaternionFromProperEuler:CHA,normalize:Fi,denormalize:$a};class Ze{constructor(A=0,e=0){Ze.prototype.isVector2=!0,this.x=A,this.y=e}get width(){return this.x}set width(A){this.x=A}get height(){return this.y}set height(A){this.y=A}set(A,e){return this.x=A,this.y=e,this}setScalar(A){return this.x=A,this.y=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y)}copy(A){return this.x=A.x,this.y=A.y,this}add(A){return this.x+=A.x,this.y+=A.y,this}addScalar(A){return this.x+=A,this.y+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this}subScalar(A){return this.x-=A,this.y-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this}multiply(A){return this.x*=A.x,this.y*=A.y,this}multiplyScalar(A){return this.x*=A,this.y*=A,this}divide(A){return this.x/=A.x,this.y/=A.y,this}divideScalar(A){return this.multiplyScalar(1/A)}applyMatrix3(A){const e=this.x,i=this.y,g=A.elements;return this.x=g[0]*e+g[3]*i+g[6],this.y=g[1]*e+g[4]*i+g[7],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this}clamp(A,e){return this.x=Ci(this.x,A.x,e.x),this.y=Ci(this.y,A.y,e.y),this}clampScalar(A,e){return this.x=Ci(this.x,A,e),this.y=Ci(this.y,A,e),this}clampLength(A,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ci(i,A,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this}negate(){return this.x=-this.x,this.y=-this.y,this}dot(A){return this.x*A.x+this.y*A.y}cross(A){return this.x*A.y-this.y*A.x}lengthSq(){return this.x*this.x+this.y*this.y}length(){return Math.sqrt(this.x*this.x+this.y*this.y)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)}normalize(){return this.divideScalar(this.length()||1)}angle(){return Math.atan2(-this.y,-this.x)+Math.PI}angleTo(A){const e=Math.sqrt(this.lengthSq()*A.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(A)/e;return Math.acos(Ci(i,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,i=this.y-A.y;return e*e+i*i}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this}lerpVectors(A,e,i){return this.x=A.x+(e.x-A.x)*i,this.y=A.y+(e.y-A.y)*i,this}equals(A){return A.x===this.x&&A.y===this.y}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this}rotateAround(A,e){const i=Math.cos(e),g=Math.sin(e),I=this.x-A.x,n=this.y-A.y;return this.x=I*i-n*g+A.x,this.y=I*g+n*i+A.y,this}random(){return this.x=Math.random(),this.y=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y}}class Kn{constructor(A=0,e=0,i=0,g=1){this.isQuaternion=!0,this._x=A,this._y=e,this._z=i,this._w=g}static slerpFlat(A,e,i,g,I,n,o){let a=i[g+0],r=i[g+1],s=i[g+2],B=i[g+3];const c=I[n+0],E=I[n+1],D=I[n+2],y=I[n+3];if(o===0){A[e+0]=a,A[e+1]=r,A[e+2]=s,A[e+3]=B;return}if(o===1){A[e+0]=c,A[e+1]=E,A[e+2]=D,A[e+3]=y;return}if(B!==y||a!==c||r!==E||s!==D){let S=1-o;const f=a*c+r*E+s*D+B*y,M=f>=0?1:-1,k=1-f*f;if(k>Number.EPSILON){const U=Math.sqrt(k),F=Math.atan2(U,f*M);S=Math.sin(S*F)/U,o=Math.sin(o*F)/U}const m=o*M;if(a=a*S+c*m,r=r*S+E*m,s=s*S+D*m,B=B*S+y*m,S===1-o){const U=1/Math.sqrt(a*a+r*r+s*s+B*B);a*=U,r*=U,s*=U,B*=U}}A[e]=a,A[e+1]=r,A[e+2]=s,A[e+3]=B}static multiplyQuaternionsFlat(A,e,i,g,I,n){const o=i[g],a=i[g+1],r=i[g+2],s=i[g+3],B=I[n],c=I[n+1],E=I[n+2],D=I[n+3];return A[e]=o*D+s*B+a*E-r*c,A[e+1]=a*D+s*c+r*B-o*E,A[e+2]=r*D+s*E+o*c-a*B,A[e+3]=s*D-o*B-a*c-r*E,A}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get w(){return this._w}set w(A){this._w=A,this._onChangeCallback()}set(A,e,i,g){return this._x=A,this._y=e,this._z=i,this._w=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._w)}copy(A){return this._x=A.x,this._y=A.y,this._z=A.z,this._w=A.w,this._onChangeCallback(),this}setFromEuler(A,e=!0){const i=A._x,g=A._y,I=A._z,n=A._order,o=Math.cos,a=Math.sin,r=o(i/2),s=o(g/2),B=o(I/2),c=a(i/2),E=a(g/2),D=a(I/2);switch(n){case"XYZ":this._x=c*s*B+r*E*D,this._y=r*E*B-c*s*D,this._z=r*s*D+c*E*B,this._w=r*s*B-c*E*D;break;case"YXZ":this._x=c*s*B+r*E*D,this._y=r*E*B-c*s*D,this._z=r*s*D-c*E*B,this._w=r*s*B+c*E*D;break;case"ZXY":this._x=c*s*B-r*E*D,this._y=r*E*B+c*s*D,this._z=r*s*D+c*E*B,this._w=r*s*B-c*E*D;break;case"ZYX":this._x=c*s*B-r*E*D,this._y=r*E*B+c*s*D,this._z=r*s*D-c*E*B,this._w=r*s*B+c*E*D;break;case"YZX":this._x=c*s*B+r*E*D,this._y=r*E*B+c*s*D,this._z=r*s*D-c*E*B,this._w=r*s*B-c*E*D;break;case"XZY":this._x=c*s*B-r*E*D,this._y=r*E*B-c*s*D,this._z=r*s*D+c*E*B,this._w=r*s*B+c*E*D;break;default:}return e===!0&&this._onChangeCallback(),this}setFromAxisAngle(A,e){const i=e/2,g=Math.sin(i);return this._x=A.x*g,this._y=A.y*g,this._z=A.z*g,this._w=Math.cos(i),this._onChangeCallback(),this}setFromRotationMatrix(A){const e=A.elements,i=e[0],g=e[4],I=e[8],n=e[1],o=e[5],a=e[9],r=e[2],s=e[6],B=e[10],c=i+o+B;if(c>0){const E=.5/Math.sqrt(c+1);this._w=.25/E,this._x=(s-a)*E,this._y=(I-r)*E,this._z=(n-g)*E}else if(i>o&&i>B){const E=2*Math.sqrt(1+i-o-B);this._w=(s-a)/E,this._x=.25*E,this._y=(g+n)/E,this._z=(I+r)/E}else if(o>B){const E=2*Math.sqrt(1+o-i-B);this._w=(I-r)/E,this._x=(g+n)/E,this._y=.25*E,this._z=(a+s)/E}else{const E=2*Math.sqrt(1+B-i-o);this._w=(n-g)/E,this._x=(I+r)/E,this._y=(a+s)/E,this._z=.25*E}return this._onChangeCallback(),this}setFromUnitVectors(A,e){let i=A.dot(e)+1;return i<1e-8?(i=0,Math.abs(A.x)>Math.abs(A.z)?(this._x=-A.y,this._y=A.x,this._z=0,this._w=i):(this._x=0,this._y=-A.z,this._z=A.y,this._w=i)):(this._x=A.y*e.z-A.z*e.y,this._y=A.z*e.x-A.x*e.z,this._z=A.x*e.y-A.y*e.x,this._w=i),this.normalize()}angleTo(A){return 2*Math.acos(Math.abs(Ci(this.dot(A),-1,1)))}rotateTowards(A,e){const i=this.angleTo(A);if(i===0)return this;const g=Math.min(1,e/i);return this.slerp(A,g),this}identity(){return this.set(0,0,0,1)}invert(){return this.conjugate()}conjugate(){return this._x*=-1,this._y*=-1,this._z*=-1,this._onChangeCallback(),this}dot(A){return this._x*A._x+this._y*A._y+this._z*A._z+this._w*A._w}lengthSq(){return this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w}length(){return Math.sqrt(this._x*this._x+this._y*this._y+this._z*this._z+this._w*this._w)}normalize(){let A=this.length();return A===0?(this._x=0,this._y=0,this._z=0,this._w=1):(A=1/A,this._x=this._x*A,this._y=this._y*A,this._z=this._z*A,this._w=this._w*A),this._onChangeCallback(),this}multiply(A){return this.multiplyQuaternions(this,A)}premultiply(A){return this.multiplyQuaternions(A,this)}multiplyQuaternions(A,e){const i=A._x,g=A._y,I=A._z,n=A._w,o=e._x,a=e._y,r=e._z,s=e._w;return this._x=i*s+n*o+g*r-I*a,this._y=g*s+n*a+I*o-i*r,this._z=I*s+n*r+i*a-g*o,this._w=n*s-i*o-g*a-I*r,this._onChangeCallback(),this}slerp(A,e){if(e===0)return this;if(e===1)return this.copy(A);const i=this._x,g=this._y,I=this._z,n=this._w;let o=n*A._w+i*A._x+g*A._y+I*A._z;if(o<0?(this._w=-A._w,this._x=-A._x,this._y=-A._y,this._z=-A._z,o=-o):this.copy(A),o>=1)return this._w=n,this._x=i,this._y=g,this._z=I,this;const a=1-o*o;if(a<=Number.EPSILON){const E=1-e;return this._w=E*n+e*this._w,this._x=E*i+e*this._x,this._y=E*g+e*this._y,this._z=E*I+e*this._z,this.normalize(),this}const r=Math.sqrt(a),s=Math.atan2(r,o),B=Math.sin((1-e)*s)/r,c=Math.sin(e*s)/r;return this._w=n*B+this._w*c,this._x=i*B+this._x*c,this._y=g*B+this._y*c,this._z=I*B+this._z*c,this._onChangeCallback(),this}slerpQuaternions(A,e,i){return this.copy(A).slerp(e,i)}random(){const A=2*Math.PI*Math.random(),e=2*Math.PI*Math.random(),i=Math.random(),g=Math.sqrt(1-i),I=Math.sqrt(i);return this.set(g*Math.sin(A),g*Math.cos(A),I*Math.sin(e),I*Math.cos(e))}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._w===this._w}fromArray(A,e=0){return this._x=A[e],this._y=A[e+1],this._z=A[e+2],this._w=A[e+3],this._onChangeCallback(),this}toArray(A=[],e=0){return A[e]=this._x,A[e+1]=this._y,A[e+2]=this._z,A[e+3]=this._w,A}fromBufferAttribute(A,e){return this._x=A.getX(e),this._y=A.getY(e),this._z=A.getZ(e),this._w=A.getW(e),this._onChangeCallback(),this}toJSON(){return this.toArray()}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._w}}class wA{constructor(A=0,e=0,i=0){wA.prototype.isVector3=!0,this.x=A,this.y=e,this.z=i}set(A,e,i){return i===void 0&&(i=this.z),this.x=A,this.y=e,this.z=i,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this.z=A.z+e.z,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this.z+=A.z*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this.z=A.z-e.z,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this}multiplyVectors(A,e){return this.x=A.x*e.x,this.y=A.y*e.y,this.z=A.z*e.z,this}applyEuler(A){return this.applyQuaternion(Lz.setFromEuler(A))}applyAxisAngle(A,e){return this.applyQuaternion(Lz.setFromAxisAngle(A,e))}applyMatrix3(A){const e=this.x,i=this.y,g=this.z,I=A.elements;return this.x=I[0]*e+I[3]*i+I[6]*g,this.y=I[1]*e+I[4]*i+I[7]*g,this.z=I[2]*e+I[5]*i+I[8]*g,this}applyNormalMatrix(A){return this.applyMatrix3(A).normalize()}applyMatrix4(A){const e=this.x,i=this.y,g=this.z,I=A.elements,n=1/(I[3]*e+I[7]*i+I[11]*g+I[15]);return this.x=(I[0]*e+I[4]*i+I[8]*g+I[12])*n,this.y=(I[1]*e+I[5]*i+I[9]*g+I[13])*n,this.z=(I[2]*e+I[6]*i+I[10]*g+I[14])*n,this}applyQuaternion(A){const e=this.x,i=this.y,g=this.z,I=A.x,n=A.y,o=A.z,a=A.w,r=2*(n*g-o*i),s=2*(o*e-I*g),B=2*(I*i-n*e);return this.x=e+a*r+n*B-o*s,this.y=i+a*s+o*r-I*B,this.z=g+a*B+I*s-n*r,this}project(A){return this.applyMatrix4(A.matrixWorldInverse).applyMatrix4(A.projectionMatrix)}unproject(A){return this.applyMatrix4(A.projectionMatrixInverse).applyMatrix4(A.matrixWorld)}transformDirection(A){const e=this.x,i=this.y,g=this.z,I=A.elements;return this.x=I[0]*e+I[4]*i+I[8]*g,this.y=I[1]*e+I[5]*i+I[9]*g,this.z=I[2]*e+I[6]*i+I[10]*g,this.normalize()}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this}divideScalar(A){return this.multiplyScalar(1/A)}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this}clamp(A,e){return this.x=Ci(this.x,A.x,e.x),this.y=Ci(this.y,A.y,e.y),this.z=Ci(this.z,A.z,e.z),this}clampScalar(A,e){return this.x=Ci(this.x,A,e),this.y=Ci(this.y,A,e),this.z=Ci(this.z,A,e),this}clampLength(A,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ci(i,A,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this}dot(A){return this.x*A.x+this.y*A.y+this.z*A.z}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)}normalize(){return this.divideScalar(this.length()||1)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this.z+=(A.z-this.z)*e,this}lerpVectors(A,e,i){return this.x=A.x+(e.x-A.x)*i,this.y=A.y+(e.y-A.y)*i,this.z=A.z+(e.z-A.z)*i,this}cross(A){return this.crossVectors(this,A)}crossVectors(A,e){const i=A.x,g=A.y,I=A.z,n=e.x,o=e.y,a=e.z;return this.x=g*a-I*o,this.y=I*n-i*a,this.z=i*o-g*n,this}projectOnVector(A){const e=A.lengthSq();if(e===0)return this.set(0,0,0);const i=A.dot(this)/e;return this.copy(A).multiplyScalar(i)}projectOnPlane(A){return PL.copy(this).projectOnVector(A),this.sub(PL)}reflect(A){return this.sub(PL.copy(A).multiplyScalar(2*this.dot(A)))}angleTo(A){const e=Math.sqrt(this.lengthSq()*A.lengthSq());if(e===0)return Math.PI/2;const i=this.dot(A)/e;return Math.acos(Ci(i,-1,1))}distanceTo(A){return Math.sqrt(this.distanceToSquared(A))}distanceToSquared(A){const e=this.x-A.x,i=this.y-A.y,g=this.z-A.z;return e*e+i*i+g*g}manhattanDistanceTo(A){return Math.abs(this.x-A.x)+Math.abs(this.y-A.y)+Math.abs(this.z-A.z)}setFromSpherical(A){return this.setFromSphericalCoords(A.radius,A.phi,A.theta)}setFromSphericalCoords(A,e,i){const g=Math.sin(e)*A;return this.x=g*Math.sin(i),this.y=Math.cos(e)*A,this.z=g*Math.cos(i),this}setFromCylindrical(A){return this.setFromCylindricalCoords(A.radius,A.theta,A.y)}setFromCylindricalCoords(A,e,i){return this.x=A*Math.sin(e),this.y=i,this.z=A*Math.cos(e),this}setFromMatrixPosition(A){const e=A.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this}setFromMatrixScale(A){const e=this.setFromMatrixColumn(A,0).length(),i=this.setFromMatrixColumn(A,1).length(),g=this.setFromMatrixColumn(A,2).length();return this.x=e,this.y=i,this.z=g,this}setFromMatrixColumn(A,e){return this.fromArray(A.elements,e*4)}setFromMatrix3Column(A,e){return this.fromArray(A.elements,e*3)}setFromEuler(A){return this.x=A._x,this.y=A._y,this.z=A._z,this}setFromColor(A){return this.x=A.r,this.y=A.g,this.z=A.b,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this.z=A[e+2],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A[e+2]=this.z,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this.z=A.getZ(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this}randomDirection(){const A=Math.random()*Math.PI*2,e=Math.random()*2-1,i=Math.sqrt(1-e*e);return this.x=i*Math.cos(A),this.y=e,this.z=i*Math.sin(A),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z}}const PL=new wA,Lz=new Kn;class Ni{constructor(A,e,i,g,I,n,o,a,r){Ni.prototype.isMatrix3=!0,this.elements=[1,0,0,0,1,0,0,0,1],A!==void 0&&this.set(A,e,i,g,I,n,o,a,r)}set(A,e,i,g,I,n,o,a,r){const s=this.elements;return s[0]=A,s[1]=g,s[2]=o,s[3]=e,s[4]=I,s[5]=a,s[6]=i,s[7]=n,s[8]=r,this}identity(){return this.set(1,0,0,0,1,0,0,0,1),this}copy(A){const e=this.elements,i=A.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],this}extractBasis(A,e,i){return A.setFromMatrix3Column(this,0),e.setFromMatrix3Column(this,1),i.setFromMatrix3Column(this,2),this}setFromMatrix4(A){const e=A.elements;return this.set(e[0],e[4],e[8],e[1],e[5],e[9],e[2],e[6],e[10]),this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const i=A.elements,g=e.elements,I=this.elements,n=i[0],o=i[3],a=i[6],r=i[1],s=i[4],B=i[7],c=i[2],E=i[5],D=i[8],y=g[0],S=g[3],f=g[6],M=g[1],k=g[4],m=g[7],U=g[2],F=g[5],b=g[8];return I[0]=n*y+o*M+a*U,I[3]=n*S+o*k+a*F,I[6]=n*f+o*m+a*b,I[1]=r*y+s*M+B*U,I[4]=r*S+s*k+B*F,I[7]=r*f+s*m+B*b,I[2]=c*y+E*M+D*U,I[5]=c*S+E*k+D*F,I[8]=c*f+E*m+D*b,this}multiplyScalar(A){const e=this.elements;return e[0]*=A,e[3]*=A,e[6]*=A,e[1]*=A,e[4]*=A,e[7]*=A,e[2]*=A,e[5]*=A,e[8]*=A,this}determinant(){const A=this.elements,e=A[0],i=A[1],g=A[2],I=A[3],n=A[4],o=A[5],a=A[6],r=A[7],s=A[8];return e*n*s-e*o*r-i*I*s+i*o*a+g*I*r-g*n*a}invert(){const A=this.elements,e=A[0],i=A[1],g=A[2],I=A[3],n=A[4],o=A[5],a=A[6],r=A[7],s=A[8],B=s*n-o*r,c=o*a-s*I,E=r*I-n*a,D=e*B+i*c+g*E;if(D===0)return this.set(0,0,0,0,0,0,0,0,0);const y=1/D;return A[0]=B*y,A[1]=(g*r-s*i)*y,A[2]=(o*i-g*n)*y,A[3]=c*y,A[4]=(s*e-g*a)*y,A[5]=(g*I-o*e)*y,A[6]=E*y,A[7]=(i*a-r*e)*y,A[8]=(n*e-i*I)*y,this}transpose(){let A;const e=this.elements;return A=e[1],e[1]=e[3],e[3]=A,A=e[2],e[2]=e[6],e[6]=A,A=e[5],e[5]=e[7],e[7]=A,this}getNormalMatrix(A){return this.setFromMatrix4(A).invert().transpose()}transposeIntoArray(A){const e=this.elements;return A[0]=e[0],A[1]=e[3],A[2]=e[6],A[3]=e[1],A[4]=e[4],A[5]=e[7],A[6]=e[2],A[7]=e[5],A[8]=e[8],this}setUvTransform(A,e,i,g,I,n,o){const a=Math.cos(I),r=Math.sin(I);return this.set(i*a,i*r,-i*(a*n+r*o)+n+A,-g*r,g*a,-g*(-r*n+a*o)+o+e,0,0,1),this}scale(A,e){return this.premultiply(jL.makeScale(A,e)),this}rotate(A){return this.premultiply(jL.makeRotation(-A)),this}translate(A,e){return this.premultiply(jL.makeTranslation(A,e)),this}makeTranslation(A,e){return A.isVector2?this.set(1,0,A.x,0,1,A.y,0,0,1):this.set(1,0,A,0,1,e,0,0,1),this}makeRotation(A){const e=Math.cos(A),i=Math.sin(A);return this.set(e,-i,0,i,e,0,0,0,1),this}makeScale(A,e){return this.set(A,0,0,0,e,0,0,0,1),this}equals(A){const e=this.elements,i=A.elements;for(let g=0;g<9;g++)if(e[g]!==i[g])return!1;return!0}fromArray(A,e=0){for(let i=0;i<9;i++)this.elements[i]=A[i+e];return this}toArray(A=[],e=0){const i=this.elements;return A[e]=i[0],A[e+1]=i[1],A[e+2]=i[2],A[e+3]=i[3],A[e+4]=i[4],A[e+5]=i[5],A[e+6]=i[6],A[e+7]=i[7],A[e+8]=i[8],A}clone(){return new this.constructor().fromArray(this.elements)}}const jL=new Ni;function dnA(t){for(let A=t.length-1;A>=0;--A)if(t[A]>=65535)return!0;return!1}const BHA={Int8Array,Uint8Array,Uint8ClampedArray,Int16Array,Uint16Array,Int32Array,Uint32Array,Float32Array,Float64Array};function hD(t,A){return new BHA[t](A)}function H0(t){return document.createElementNS("http://www.w3.org/1999/xhtml",t)}function pnA(){const t=H0("canvas");return t.style.display="block",t}const qz={};function O0(t){t in qz||(qz[t]=!0)}function cHA(t,A,e){return new Promise(function(i,g){function I(){switch(t.clientWaitSync(A,t.SYNC_FLUSH_COMMANDS_BIT,0)){case t.WAIT_FAILED:g();break;case t.TIMEOUT_EXPIRED:setTimeout(I,e);break;default:i()}}setTimeout(I,e)})}const xz=new Ni().set(.4123908,.3575843,.1804808,.212639,.7151687,.0721923,.0193308,.1191948,.9505322),Tz=new Ni().set(3.2409699,-1.5373832,-.4986108,-.9692436,1.8759675,.0415551,.0556301,-.203977,1.0569715);function lHA(){const t={enabled:!0,workingColorSpace:Cu,spaces:{},convert:function(g,I,n){return this.enabled===!1||I===n||!I||!n||(this.spaces[I].transfer===Vg&&(g.r=aQ(g.r),g.g=aQ(g.g),g.b=aQ(g.b)),this.spaces[I].primaries!==this.spaces[n].primaries&&(g.applyMatrix3(this.spaces[I].toXYZ),g.applyMatrix3(this.spaces[n].fromXYZ)),this.spaces[n].transfer===Vg&&(g.r=JD(g.r),g.g=JD(g.g),g.b=JD(g.b))),g},workingToColorSpace:function(g,I){return this.convert(g,this.workingColorSpace,I)},colorSpaceToWorking:function(g,I){return this.convert(g,I,this.workingColorSpace)},getPrimaries:function(g){return this.spaces[g].primaries},getTransfer:function(g){return g===zl?T0:this.spaces[g].transfer},getToneMappingMode:function(g){return this.spaces[g].outputColorSpaceConfig.toneMappingMode||"standard"},getLuminanceCoefficients:function(g,I=this.workingColorSpace){return g.fromArray(this.spaces[I].luminanceCoefficients)},define:function(g){Object.assign(this.spaces,g)},_getMatrix:function(g,I,n){return g.copy(this.spaces[I].toXYZ).multiply(this.spaces[n].fromXYZ)},_getDrawingBufferColorSpace:function(g){return this.spaces[g].outputColorSpaceConfig.drawingBufferColorSpace},_getUnpackColorSpace:function(g=this.workingColorSpace){return this.spaces[g].workingColorSpaceConfig.unpackColorSpace},fromWorkingColorSpace:function(g,I){return O0("THREE.ColorManagement: .fromWorkingColorSpace() has been renamed to .workingToColorSpace()."),t.workingToColorSpace(g,I)},toWorkingColorSpace:function(g,I){return O0("THREE.ColorManagement: .toWorkingColorSpace() has been renamed to .colorSpaceToWorking()."),t.colorSpaceToWorking(g,I)}},A=[.64,.33,.3,.6,.15,.06],e=[.2126,.7152,.0722],i=[.3127,.329];return t.define({[Cu]:{primaries:A,whitePoint:i,transfer:T0,toXYZ:xz,fromXYZ:Tz,luminanceCoefficients:e,workingColorSpaceConfig:{unpackColorSpace:Hn},outputColorSpaceConfig:{drawingBufferColorSpace:Hn}},[Hn]:{primaries:A,whitePoint:i,transfer:Vg,toXYZ:xz,fromXYZ:Tz,luminanceCoefficients:e,outputColorSpaceConfig:{drawingBufferColorSpace:Hn}}}),t}const Qg=lHA();function aQ(t){return t<.04045?t*.0773993808:Math.pow(t*.9478672986+.0521327014,2.4)}function JD(t){return t<.0031308?t*12.92:1.055*Math.pow(t,.41666)-.055}let Sf;class fnA{static getDataURL(A,e="image/png"){if(/^data:/i.test(A.src)||typeof HTMLCanvasElement>"u")return A.src;let i;if(A instanceof HTMLCanvasElement)i=A;else{Sf===void 0&&(Sf=H0("canvas")),Sf.width=A.width,Sf.height=A.height;const g=Sf.getContext("2d");A instanceof ImageData?g.putImageData(A,0,0):g.drawImage(A,0,0,A.width,A.height),i=Sf}return i.toDataURL(e)}static sRGBToLinear(A){if(typeof HTMLImageElement<"u"&&A instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&A instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&A instanceof ImageBitmap){const e=H0("canvas");e.width=A.width,e.height=A.height;const i=e.getContext("2d");i.drawImage(A,0,0,A.width,A.height);const g=i.getImageData(0,0,A.width,A.height),I=g.data;for(let n=0;n<I.length;n++)I[n]=aQ(I[n]/255)*255;return i.putImageData(g,0,0),e}else if(A.data){const e=A.data.slice(0);for(let i=0;i<e.length;i++)e instanceof Uint8Array||e instanceof Uint8ClampedArray?e[i]=Math.floor(aQ(e[i]/255)*255):e[i]=aQ(e[i]);return{data:e,width:A.width,height:A.height}}else return A}}let QHA=0;class bE{constructor(A=null){this.isSource=!0,Object.defineProperty(this,"id",{value:QHA++}),this.uuid=Qs(),this.data=A,this.dataReady=!0,this.version=0}getSize(A){const e=this.data;return typeof HTMLVideoElement<"u"&&e instanceof HTMLVideoElement?A.set(e.videoWidth,e.videoHeight,0):e instanceof VideoFrame?A.set(e.displayHeight,e.displayWidth,0):e!==null?A.set(e.width,e.height,e.depth||0):A.set(0,0,0),A}set needsUpdate(A){A===!0&&this.version++}toJSON(A){const e=A===void 0||typeof A=="string";if(!e&&A.images[this.uuid]!==void 0)return A.images[this.uuid];const i={uuid:this.uuid,url:""},g=this.data;if(g!==null){let I;if(Array.isArray(g)){I=[];for(let n=0,o=g.length;n<o;n++)g[n].isDataTexture?I.push(ZL(g[n].image)):I.push(ZL(g[n]))}else I=ZL(g);i.url=I}return e||(A.images[this.uuid]=i),i}}function ZL(t){return typeof HTMLImageElement<"u"&&t instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&t instanceof ImageBitmap?fnA.getDataURL(t):t.data?{data:Array.from(t.data),width:t.width,height:t.height,type:t.data.constructor.name}:{}}let EHA=0;const WL=new wA;class FI extends $c{constructor(A=FI.DEFAULT_IMAGE,e=FI.DEFAULT_MAPPING,i=Bs,g=Bs,I=HI,n=oC,o=da,a=QC,r=FI.DEFAULT_ANISOTROPY,s=zl){super(),this.isTexture=!0,Object.defineProperty(this,"id",{value:EHA++}),this.uuid=Qs(),this.name="",this.source=new bE(A),this.mipmaps=[],this.mapping=e,this.channel=0,this.wrapS=i,this.wrapT=g,this.magFilter=I,this.minFilter=n,this.anisotropy=r,this.format=o,this.internalFormat=null,this.type=a,this.offset=new Ze(0,0),this.repeat=new Ze(1,1),this.center=new Ze(0,0),this.rotation=0,this.matrixAutoUpdate=!0,this.matrix=new Ni,this.generateMipmaps=!0,this.premultiplyAlpha=!1,this.flipY=!0,this.unpackAlignment=4,this.colorSpace=s,this.userData={},this.updateRanges=[],this.version=0,this.onUpdate=null,this.renderTarget=null,this.isRenderTargetTexture=!1,this.isArrayTexture=!!(A&&A.depth&&A.depth>1),this.pmremVersion=0}get width(){return this.source.getSize(WL).x}get height(){return this.source.getSize(WL).y}get depth(){return this.source.getSize(WL).z}get image(){return this.source.data}set image(A=null){this.source.data=A}updateMatrix(){this.matrix.setUvTransform(this.offset.x,this.offset.y,this.repeat.x,this.repeat.y,this.rotation,this.center.x,this.center.y)}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}clone(){return new this.constructor().copy(this)}copy(A){return this.name=A.name,this.source=A.source,this.mipmaps=A.mipmaps.slice(0),this.mapping=A.mapping,this.channel=A.channel,this.wrapS=A.wrapS,this.wrapT=A.wrapT,this.magFilter=A.magFilter,this.minFilter=A.minFilter,this.anisotropy=A.anisotropy,this.format=A.format,this.internalFormat=A.internalFormat,this.type=A.type,this.offset.copy(A.offset),this.repeat.copy(A.repeat),this.center.copy(A.center),this.rotation=A.rotation,this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrix.copy(A.matrix),this.generateMipmaps=A.generateMipmaps,this.premultiplyAlpha=A.premultiplyAlpha,this.flipY=A.flipY,this.unpackAlignment=A.unpackAlignment,this.colorSpace=A.colorSpace,this.renderTarget=A.renderTarget,this.isRenderTargetTexture=A.isRenderTargetTexture,this.isArrayTexture=A.isArrayTexture,this.userData=JSON.parse(JSON.stringify(A.userData)),this.needsUpdate=!0,this}setValues(A){for(const e in A){const i=A[e];if(i===void 0)continue;const g=this[e];g!==void 0&&(g&&i&&g.isVector2&&i.isVector2||g&&i&&g.isVector3&&i.isVector3||g&&i&&g.isMatrix3&&i.isMatrix3?g.copy(i):this[e]=i)}}toJSON(A){const e=A===void 0||typeof A=="string";if(!e&&A.textures[this.uuid]!==void 0)return A.textures[this.uuid];const i={metadata:{version:4.7,type:"Texture",generator:"Texture.toJSON"},uuid:this.uuid,name:this.name,image:this.source.toJSON(A).uuid,mapping:this.mapping,channel:this.channel,repeat:[this.repeat.x,this.repeat.y],offset:[this.offset.x,this.offset.y],center:[this.center.x,this.center.y],rotation:this.rotation,wrap:[this.wrapS,this.wrapT],format:this.format,internalFormat:this.internalFormat,type:this.type,colorSpace:this.colorSpace,minFilter:this.minFilter,magFilter:this.magFilter,anisotropy:this.anisotropy,flipY:this.flipY,generateMipmaps:this.generateMipmaps,premultiplyAlpha:this.premultiplyAlpha,unpackAlignment:this.unpackAlignment};return Object.keys(this.userData).length>0&&(i.userData=this.userData),e||(A.textures[this.uuid]=i),i}dispose(){this.dispatchEvent({type:"dispose"})}transformUv(A){if(this.mapping!==bb)return A;if(A.applyMatrix3(this.matrix),A.x<0||A.x>1)switch(this.wrapS){case su:A.x=A.x-Math.floor(A.x);break;case Bs:A.x=A.x<0?0:1;break;case By:Math.abs(Math.floor(A.x)%2)===1?A.x=Math.ceil(A.x)-A.x:A.x=A.x-Math.floor(A.x);break}if(A.y<0||A.y>1)switch(this.wrapT){case su:A.y=A.y-Math.floor(A.y);break;case Bs:A.y=A.y<0?0:1;break;case By:Math.abs(Math.floor(A.y)%2)===1?A.y=Math.ceil(A.y)-A.y:A.y=A.y-Math.floor(A.y);break}return this.flipY&&(A.y=1-A.y),A}set needsUpdate(A){A===!0&&(this.version++,this.source.needsUpdate=!0)}set needsPMREMUpdate(A){A===!0&&this.pmremVersion++}}FI.DEFAULT_IMAGE=null;FI.DEFAULT_MAPPING=bb;FI.DEFAULT_ANISOTROPY=1;class wg{constructor(A=0,e=0,i=0,g=1){wg.prototype.isVector4=!0,this.x=A,this.y=e,this.z=i,this.w=g}get width(){return this.z}set width(A){this.z=A}get height(){return this.w}set height(A){this.w=A}set(A,e,i,g){return this.x=A,this.y=e,this.z=i,this.w=g,this}setScalar(A){return this.x=A,this.y=A,this.z=A,this.w=A,this}setX(A){return this.x=A,this}setY(A){return this.y=A,this}setZ(A){return this.z=A,this}setW(A){return this.w=A,this}setComponent(A,e){switch(A){case 0:this.x=e;break;case 1:this.y=e;break;case 2:this.z=e;break;case 3:this.w=e;break;default:throw new Error("index is out of range: "+A)}return this}getComponent(A){switch(A){case 0:return this.x;case 1:return this.y;case 2:return this.z;case 3:return this.w;default:throw new Error("index is out of range: "+A)}}clone(){return new this.constructor(this.x,this.y,this.z,this.w)}copy(A){return this.x=A.x,this.y=A.y,this.z=A.z,this.w=A.w!==void 0?A.w:1,this}add(A){return this.x+=A.x,this.y+=A.y,this.z+=A.z,this.w+=A.w,this}addScalar(A){return this.x+=A,this.y+=A,this.z+=A,this.w+=A,this}addVectors(A,e){return this.x=A.x+e.x,this.y=A.y+e.y,this.z=A.z+e.z,this.w=A.w+e.w,this}addScaledVector(A,e){return this.x+=A.x*e,this.y+=A.y*e,this.z+=A.z*e,this.w+=A.w*e,this}sub(A){return this.x-=A.x,this.y-=A.y,this.z-=A.z,this.w-=A.w,this}subScalar(A){return this.x-=A,this.y-=A,this.z-=A,this.w-=A,this}subVectors(A,e){return this.x=A.x-e.x,this.y=A.y-e.y,this.z=A.z-e.z,this.w=A.w-e.w,this}multiply(A){return this.x*=A.x,this.y*=A.y,this.z*=A.z,this.w*=A.w,this}multiplyScalar(A){return this.x*=A,this.y*=A,this.z*=A,this.w*=A,this}applyMatrix4(A){const e=this.x,i=this.y,g=this.z,I=this.w,n=A.elements;return this.x=n[0]*e+n[4]*i+n[8]*g+n[12]*I,this.y=n[1]*e+n[5]*i+n[9]*g+n[13]*I,this.z=n[2]*e+n[6]*i+n[10]*g+n[14]*I,this.w=n[3]*e+n[7]*i+n[11]*g+n[15]*I,this}divide(A){return this.x/=A.x,this.y/=A.y,this.z/=A.z,this.w/=A.w,this}divideScalar(A){return this.multiplyScalar(1/A)}setAxisAngleFromQuaternion(A){this.w=2*Math.acos(A.w);const e=Math.sqrt(1-A.w*A.w);return e<1e-4?(this.x=1,this.y=0,this.z=0):(this.x=A.x/e,this.y=A.y/e,this.z=A.z/e),this}setAxisAngleFromRotationMatrix(A){let e,i,g,I;const a=A.elements,r=a[0],s=a[4],B=a[8],c=a[1],E=a[5],D=a[9],y=a[2],S=a[6],f=a[10];if(Math.abs(s-c)<.01&&Math.abs(B-y)<.01&&Math.abs(D-S)<.01){if(Math.abs(s+c)<.1&&Math.abs(B+y)<.1&&Math.abs(D+S)<.1&&Math.abs(r+E+f-3)<.1)return this.set(1,0,0,0),this;e=Math.PI;const k=(r+1)/2,m=(E+1)/2,U=(f+1)/2,F=(s+c)/4,b=(B+y)/4,K=(D+S)/4;return k>m&&k>U?k<.01?(i=0,g=.707106781,I=.707106781):(i=Math.sqrt(k),g=F/i,I=b/i):m>U?m<.01?(i=.707106781,g=0,I=.707106781):(g=Math.sqrt(m),i=F/g,I=K/g):U<.01?(i=.707106781,g=.707106781,I=0):(I=Math.sqrt(U),i=b/I,g=K/I),this.set(i,g,I,e),this}let M=Math.sqrt((S-D)*(S-D)+(B-y)*(B-y)+(c-s)*(c-s));return Math.abs(M)<.001&&(M=1),this.x=(S-D)/M,this.y=(B-y)/M,this.z=(c-s)/M,this.w=Math.acos((r+E+f-1)/2),this}setFromMatrixPosition(A){const e=A.elements;return this.x=e[12],this.y=e[13],this.z=e[14],this.w=e[15],this}min(A){return this.x=Math.min(this.x,A.x),this.y=Math.min(this.y,A.y),this.z=Math.min(this.z,A.z),this.w=Math.min(this.w,A.w),this}max(A){return this.x=Math.max(this.x,A.x),this.y=Math.max(this.y,A.y),this.z=Math.max(this.z,A.z),this.w=Math.max(this.w,A.w),this}clamp(A,e){return this.x=Ci(this.x,A.x,e.x),this.y=Ci(this.y,A.y,e.y),this.z=Ci(this.z,A.z,e.z),this.w=Ci(this.w,A.w,e.w),this}clampScalar(A,e){return this.x=Ci(this.x,A,e),this.y=Ci(this.y,A,e),this.z=Ci(this.z,A,e),this.w=Ci(this.w,A,e),this}clampLength(A,e){const i=this.length();return this.divideScalar(i||1).multiplyScalar(Ci(i,A,e))}floor(){return this.x=Math.floor(this.x),this.y=Math.floor(this.y),this.z=Math.floor(this.z),this.w=Math.floor(this.w),this}ceil(){return this.x=Math.ceil(this.x),this.y=Math.ceil(this.y),this.z=Math.ceil(this.z),this.w=Math.ceil(this.w),this}round(){return this.x=Math.round(this.x),this.y=Math.round(this.y),this.z=Math.round(this.z),this.w=Math.round(this.w),this}roundToZero(){return this.x=Math.trunc(this.x),this.y=Math.trunc(this.y),this.z=Math.trunc(this.z),this.w=Math.trunc(this.w),this}negate(){return this.x=-this.x,this.y=-this.y,this.z=-this.z,this.w=-this.w,this}dot(A){return this.x*A.x+this.y*A.y+this.z*A.z+this.w*A.w}lengthSq(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w}length(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)}manhattanLength(){return Math.abs(this.x)+Math.abs(this.y)+Math.abs(this.z)+Math.abs(this.w)}normalize(){return this.divideScalar(this.length()||1)}setLength(A){return this.normalize().multiplyScalar(A)}lerp(A,e){return this.x+=(A.x-this.x)*e,this.y+=(A.y-this.y)*e,this.z+=(A.z-this.z)*e,this.w+=(A.w-this.w)*e,this}lerpVectors(A,e,i){return this.x=A.x+(e.x-A.x)*i,this.y=A.y+(e.y-A.y)*i,this.z=A.z+(e.z-A.z)*i,this.w=A.w+(e.w-A.w)*i,this}equals(A){return A.x===this.x&&A.y===this.y&&A.z===this.z&&A.w===this.w}fromArray(A,e=0){return this.x=A[e],this.y=A[e+1],this.z=A[e+2],this.w=A[e+3],this}toArray(A=[],e=0){return A[e]=this.x,A[e+1]=this.y,A[e+2]=this.z,A[e+3]=this.w,A}fromBufferAttribute(A,e){return this.x=A.getX(e),this.y=A.getY(e),this.z=A.getZ(e),this.w=A.getW(e),this}random(){return this.x=Math.random(),this.y=Math.random(),this.z=Math.random(),this.w=Math.random(),this}*[Symbol.iterator](){yield this.x,yield this.y,yield this.z,yield this.w}}class A1 extends $c{constructor(A=1,e=1,i={}){super(),i=Object.assign({generateMipmaps:!1,internalFormat:null,minFilter:HI,depthBuffer:!0,stencilBuffer:!1,resolveDepthBuffer:!0,resolveStencilBuffer:!0,depthTexture:null,samples:0,count:1,depth:1,multiview:!1},i),this.isRenderTarget=!0,this.width=A,this.height=e,this.depth=i.depth,this.scissor=new wg(0,0,A,e),this.scissorTest=!1,this.viewport=new wg(0,0,A,e);const g={width:A,height:e,depth:i.depth},I=new FI(g);this.textures=[];const n=i.count;for(let o=0;o<n;o++)this.textures[o]=I.clone(),this.textures[o].isRenderTargetTexture=!0,this.textures[o].renderTarget=this;this._setTextureOptions(i),this.depthBuffer=i.depthBuffer,this.stencilBuffer=i.stencilBuffer,this.resolveDepthBuffer=i.resolveDepthBuffer,this.resolveStencilBuffer=i.resolveStencilBuffer,this._depthTexture=null,this.depthTexture=i.depthTexture,this.samples=i.samples,this.multiview=i.multiview}_setTextureOptions(A={}){const e={minFilter:HI,generateMipmaps:!1,flipY:!1,internalFormat:null};A.mapping!==void 0&&(e.mapping=A.mapping),A.wrapS!==void 0&&(e.wrapS=A.wrapS),A.wrapT!==void 0&&(e.wrapT=A.wrapT),A.wrapR!==void 0&&(e.wrapR=A.wrapR),A.magFilter!==void 0&&(e.magFilter=A.magFilter),A.minFilter!==void 0&&(e.minFilter=A.minFilter),A.format!==void 0&&(e.format=A.format),A.type!==void 0&&(e.type=A.type),A.anisotropy!==void 0&&(e.anisotropy=A.anisotropy),A.colorSpace!==void 0&&(e.colorSpace=A.colorSpace),A.flipY!==void 0&&(e.flipY=A.flipY),A.generateMipmaps!==void 0&&(e.generateMipmaps=A.generateMipmaps),A.internalFormat!==void 0&&(e.internalFormat=A.internalFormat);for(let i=0;i<this.textures.length;i++)this.textures[i].setValues(e)}get texture(){return this.textures[0]}set texture(A){this.textures[0]=A}set depthTexture(A){this._depthTexture!==null&&(this._depthTexture.renderTarget=null),A!==null&&(A.renderTarget=this),this._depthTexture=A}get depthTexture(){return this._depthTexture}setSize(A,e,i=1){if(this.width!==A||this.height!==e||this.depth!==i){this.width=A,this.height=e,this.depth=i;for(let g=0,I=this.textures.length;g<I;g++)this.textures[g].image.width=A,this.textures[g].image.height=e,this.textures[g].image.depth=i,this.textures[g].isArrayTexture=this.textures[g].image.depth>1;this.dispose()}this.viewport.set(0,0,A,e),this.scissor.set(0,0,A,e)}clone(){return new this.constructor().copy(this)}copy(A){this.width=A.width,this.height=A.height,this.depth=A.depth,this.scissor.copy(A.scissor),this.scissorTest=A.scissorTest,this.viewport.copy(A.viewport),this.textures.length=0;for(let e=0,i=A.textures.length;e<i;e++){this.textures[e]=A.textures[e].clone(),this.textures[e].isRenderTargetTexture=!0,this.textures[e].renderTarget=this;const g=Object.assign({},A.textures[e].image);this.textures[e].source=new bE(g)}return this.depthBuffer=A.depthBuffer,this.stencilBuffer=A.stencilBuffer,this.resolveDepthBuffer=A.resolveDepthBuffer,this.resolveStencilBuffer=A.resolveStencilBuffer,A.depthTexture!==null&&(this.depthTexture=A.depthTexture.clone()),this.samples=A.samples,this}dispose(){this.dispatchEvent({type:"dispose"})}}class SB extends A1{constructor(A=1,e=1,i={}){super(A,e,i),this.isWebGLRenderTarget=!0}}class Hb extends FI{constructor(A=null,e=1,i=1,g=1){super(null),this.isDataArrayTexture=!0,this.image={data:A,width:e,height:i,depth:g},this.magFilter=ho,this.minFilter=ho,this.wrapR=Bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1,this.layerUpdates=new Set}addLayerUpdate(A){this.layerUpdates.add(A)}clearLayerUpdates(){this.layerUpdates.clear()}}class uHA extends SB{constructor(A=1,e=1,i=1,g={}){super(A,e,g),this.isWebGLArrayRenderTarget=!0,this.depth=i,this.texture=new Hb(null,A,e,i),this._setTextureOptions(g),this.texture.isRenderTargetTexture=!0}}class Ob extends FI{constructor(A=null,e=1,i=1,g=1){super(null),this.isData3DTexture=!0,this.image={data:A,width:e,height:i,depth:g},this.magFilter=ho,this.minFilter=ho,this.wrapR=Bs,this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}class hHA extends SB{constructor(A=1,e=1,i=1,g={}){super(A,e,g),this.isWebGL3DRenderTarget=!0,this.depth=i,this.texture=new Ob(null,A,e,i),this._setTextureOptions(g),this.texture.isRenderTargetTexture=!0}}class Zo{constructor(A=new wA(1/0,1/0,1/0),e=new wA(-1/0,-1/0,-1/0)){this.isBox3=!0,this.min=A,this.max=e}set(A,e){return this.min.copy(A),this.max.copy(e),this}setFromArray(A){this.makeEmpty();for(let e=0,i=A.length;e<i;e+=3)this.expandByPoint(zC.fromArray(A,e));return this}setFromBufferAttribute(A){this.makeEmpty();for(let e=0,i=A.count;e<i;e++)this.expandByPoint(zC.fromBufferAttribute(A,e));return this}setFromPoints(A){this.makeEmpty();for(let e=0,i=A.length;e<i;e++)this.expandByPoint(A[e]);return this}setFromCenterAndSize(A,e){const i=zC.copy(e).multiplyScalar(.5);return this.min.copy(A).sub(i),this.max.copy(A).add(i),this}setFromObject(A,e=!1){return this.makeEmpty(),this.expandByObject(A,e)}clone(){return new this.constructor().copy(this)}copy(A){return this.min.copy(A.min),this.max.copy(A.max),this}makeEmpty(){return this.min.x=this.min.y=this.min.z=1/0,this.max.x=this.max.y=this.max.z=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y||this.max.z<this.min.z}getCenter(A){return this.isEmpty()?A.set(0,0,0):A.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(A){return this.isEmpty()?A.set(0,0,0):A.subVectors(this.max,this.min)}expandByPoint(A){return this.min.min(A),this.max.max(A),this}expandByVector(A){return this.min.sub(A),this.max.add(A),this}expandByScalar(A){return this.min.addScalar(-A),this.max.addScalar(A),this}expandByObject(A,e=!1){A.updateWorldMatrix(!1,!1);const i=A.geometry;if(i!==void 0){const I=i.getAttribute("position");if(e===!0&&I!==void 0&&A.isInstancedMesh!==!0)for(let n=0,o=I.count;n<o;n++)A.isMesh===!0?A.getVertexPosition(n,zC):zC.fromBufferAttribute(I,n),zC.applyMatrix4(A.matrixWorld),this.expandByPoint(zC);else A.boundingBox!==void 0?(A.boundingBox===null&&A.computeBoundingBox(),XN.copy(A.boundingBox)):(i.boundingBox===null&&i.computeBoundingBox(),XN.copy(i.boundingBox)),XN.applyMatrix4(A.matrixWorld),this.union(XN)}const g=A.children;for(let I=0,n=g.length;I<n;I++)this.expandByObject(g[I],e);return this}containsPoint(A){return A.x>=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y&&A.z>=this.min.z&&A.z<=this.max.z}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y&&this.min.z<=A.min.z&&A.max.z<=this.max.z}getParameter(A,e){return e.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y),(A.z-this.min.z)/(this.max.z-this.min.z))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y&&A.max.z>=this.min.z&&A.min.z<=this.max.z}intersectsSphere(A){return this.clampPoint(A.center,zC),zC.distanceToSquared(A.center)<=A.radius*A.radius}intersectsPlane(A){let e,i;return A.normal.x>0?(e=A.normal.x*this.min.x,i=A.normal.x*this.max.x):(e=A.normal.x*this.max.x,i=A.normal.x*this.min.x),A.normal.y>0?(e+=A.normal.y*this.min.y,i+=A.normal.y*this.max.y):(e+=A.normal.y*this.max.y,i+=A.normal.y*this.min.y),A.normal.z>0?(e+=A.normal.z*this.min.z,i+=A.normal.z*this.max.z):(e+=A.normal.z*this.max.z,i+=A.normal.z*this.min.z),e<=-A.constant&&i>=-A.constant}intersectsTriangle(A){if(this.isEmpty())return!1;this.getCenter(Lw),$N.subVectors(this.max,Lw),wf.subVectors(A.a,Lw),mf.subVectors(A.b,Lw),kf.subVectors(A.c,Lw),cE.subVectors(mf,wf),lE.subVectors(kf,mf),ph.subVectors(wf,kf);let e=[0,-cE.z,cE.y,0,-lE.z,lE.y,0,-ph.z,ph.y,cE.z,0,-cE.x,lE.z,0,-lE.x,ph.z,0,-ph.x,-cE.y,cE.x,0,-lE.y,lE.x,0,-ph.y,ph.x,0];return!zL(e,wf,mf,kf,$N)||(e=[1,0,0,0,1,0,0,0,1],!zL(e,wf,mf,kf,$N))?!1:(AG.crossVectors(cE,lE),e=[AG.x,AG.y,AG.z],zL(e,wf,mf,kf,$N))}clampPoint(A,e){return e.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,zC).distanceTo(A)}getBoundingSphere(A){return this.isEmpty()?A.makeEmpty():(this.getCenter(A.center),A.radius=this.getSize(zC).length()*.5),A}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}applyMatrix4(A){return this.isEmpty()?this:(Ul[0].set(this.min.x,this.min.y,this.min.z).applyMatrix4(A),Ul[1].set(this.min.x,this.min.y,this.max.z).applyMatrix4(A),Ul[2].set(this.min.x,this.max.y,this.min.z).applyMatrix4(A),Ul[3].set(this.min.x,this.max.y,this.max.z).applyMatrix4(A),Ul[4].set(this.max.x,this.min.y,this.min.z).applyMatrix4(A),Ul[5].set(this.max.x,this.min.y,this.max.z).applyMatrix4(A),Ul[6].set(this.max.x,this.max.y,this.min.z).applyMatrix4(A),Ul[7].set(this.max.x,this.max.y,this.max.z).applyMatrix4(A),this.setFromPoints(Ul),this)}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}toJSON(){return{min:this.min.toArray(),max:this.max.toArray()}}fromJSON(A){return this.min.fromArray(A.min),this.max.fromArray(A.max),this}}const Ul=[new wA,new wA,new wA,new wA,new wA,new wA,new wA,new wA],zC=new wA,XN=new Zo,wf=new wA,mf=new wA,kf=new wA,cE=new wA,lE=new wA,ph=new wA,Lw=new wA,$N=new wA,AG=new wA,fh=new wA;function zL(t,A,e,i,g){for(let I=0,n=t.length-3;I<=n;I+=3){fh.fromArray(t,I);const o=g.x*Math.abs(fh.x)+g.y*Math.abs(fh.y)+g.z*Math.abs(fh.z),a=A.dot(fh),r=e.dot(fh),s=i.dot(fh);if(Math.max(-Math.max(a,r,s),Math.min(a,r,s))>o)return!1}return!0}const dHA=new Zo,qw=new wA,VL=new wA;class po{constructor(A=new wA,e=-1){this.isSphere=!0,this.center=A,this.radius=e}set(A,e){return this.center.copy(A),this.radius=e,this}setFromPoints(A,e){const i=this.center;e!==void 0?i.copy(e):dHA.setFromPoints(A).getCenter(i);let g=0;for(let I=0,n=A.length;I<n;I++)g=Math.max(g,i.distanceToSquared(A[I]));return this.radius=Math.sqrt(g),this}copy(A){return this.center.copy(A.center),this.radius=A.radius,this}isEmpty(){return this.radius<0}makeEmpty(){return this.center.set(0,0,0),this.radius=-1,this}containsPoint(A){return A.distanceToSquared(this.center)<=this.radius*this.radius}distanceToPoint(A){return A.distanceTo(this.center)-this.radius}intersectsSphere(A){const e=this.radius+A.radius;return A.center.distanceToSquared(this.center)<=e*e}intersectsBox(A){return A.intersectsSphere(this)}intersectsPlane(A){return Math.abs(A.distanceToPoint(this.center))<=this.radius}clampPoint(A,e){const i=this.center.distanceToSquared(A);return e.copy(A),i>this.radius*this.radius&&(e.sub(this.center).normalize(),e.multiplyScalar(this.radius).add(this.center)),e}getBoundingBox(A){return this.isEmpty()?(A.makeEmpty(),A):(A.set(this.center,this.center),A.expandByScalar(this.radius),A)}applyMatrix4(A){return this.center.applyMatrix4(A),this.radius=this.radius*A.getMaxScaleOnAxis(),this}translate(A){return this.center.add(A),this}expandByPoint(A){if(this.isEmpty())return this.center.copy(A),this.radius=0,this;qw.subVectors(A,this.center);const e=qw.lengthSq();if(e>this.radius*this.radius){const i=Math.sqrt(e),g=(i-this.radius)*.5;this.center.addScaledVector(qw,g/i),this.radius+=g}return this}union(A){return A.isEmpty()?this:this.isEmpty()?(this.copy(A),this):(this.center.equals(A.center)===!0?this.radius=Math.max(this.radius,A.radius):(VL.subVectors(A.center,this.center).setLength(A.radius),this.expandByPoint(qw.copy(A.center).add(VL)),this.expandByPoint(qw.copy(A.center).sub(VL))),this)}equals(A){return A.center.equals(this.center)&&A.radius===this.radius}clone(){return new this.constructor().copy(this)}toJSON(){return{radius:this.radius,center:this.center.toArray()}}fromJSON(A){return this.radius=A.radius,this.center.fromArray(A.center),this}}const Kl=new wA,XL=new wA,eG=new wA,QE=new wA,$L=new wA,tG=new wA,Aq=new wA;class eS{constructor(A=new wA,e=new wA(0,0,-1)){this.origin=A,this.direction=e}set(A,e){return this.origin.copy(A),this.direction.copy(e),this}copy(A){return this.origin.copy(A.origin),this.direction.copy(A.direction),this}at(A,e){return e.copy(this.origin).addScaledVector(this.direction,A)}lookAt(A){return this.direction.copy(A).sub(this.origin).normalize(),this}recast(A){return this.origin.copy(this.at(A,Kl)),this}closestPointToPoint(A,e){e.subVectors(A,this.origin);const i=e.dot(this.direction);return i<0?e.copy(this.origin):e.copy(this.origin).addScaledVector(this.direction,i)}distanceToPoint(A){return Math.sqrt(this.distanceSqToPoint(A))}distanceSqToPoint(A){const e=Kl.subVectors(A,this.origin).dot(this.direction);return e<0?this.origin.distanceToSquared(A):(Kl.copy(this.origin).addScaledVector(this.direction,e),Kl.distanceToSquared(A))}distanceSqToSegment(A,e,i,g){XL.copy(A).add(e).multiplyScalar(.5),eG.copy(e).sub(A).normalize(),QE.copy(this.origin).sub(XL);const I=A.distanceTo(e)*.5,n=-this.direction.dot(eG),o=QE.dot(this.direction),a=-QE.dot(eG),r=QE.lengthSq(),s=Math.abs(1-n*n);let B,c,E,D;if(s>0)if(B=n*a-o,c=n*o-a,D=I*s,B>=0)if(c>=-D)if(c<=D){const y=1/s;B*=y,c*=y,E=B*(B+n*c+2*o)+c*(n*B+c+2*a)+r}else c=I,B=Math.max(0,-(n*c+o)),E=-B*B+c*(c+2*a)+r;else c=-I,B=Math.max(0,-(n*c+o)),E=-B*B+c*(c+2*a)+r;else c<=-D?(B=Math.max(0,-(-n*I+o)),c=B>0?-I:Math.min(Math.max(-I,-a),I),E=-B*B+c*(c+2*a)+r):c<=D?(B=0,c=Math.min(Math.max(-I,-a),I),E=c*(c+2*a)+r):(B=Math.max(0,-(n*I+o)),c=B>0?I:Math.min(Math.max(-I,-a),I),E=-B*B+c*(c+2*a)+r);else c=n>0?-I:I,B=Math.max(0,-(n*c+o)),E=-B*B+c*(c+2*a)+r;return i&&i.copy(this.origin).addScaledVector(this.direction,B),g&&g.copy(XL).addScaledVector(eG,c),E}intersectSphere(A,e){Kl.subVectors(A.center,this.origin);const i=Kl.dot(this.direction),g=Kl.dot(Kl)-i*i,I=A.radius*A.radius;if(g>I)return null;const n=Math.sqrt(I-g),o=i-n,a=i+n;return a<0?null:o<0?this.at(a,e):this.at(o,e)}intersectsSphere(A){return A.radius<0?!1:this.distanceSqToPoint(A.center)<=A.radius*A.radius}distanceToPlane(A){const e=A.normal.dot(this.direction);if(e===0)return A.distanceToPoint(this.origin)===0?0:null;const i=-(this.origin.dot(A.normal)+A.constant)/e;return i>=0?i:null}intersectPlane(A,e){const i=this.distanceToPlane(A);return i===null?null:this.at(i,e)}intersectsPlane(A){const e=A.distanceToPoint(this.origin);return e===0||A.normal.dot(this.direction)*e<0}intersectBox(A,e){let i,g,I,n,o,a;const r=1/this.direction.x,s=1/this.direction.y,B=1/this.direction.z,c=this.origin;return r>=0?(i=(A.min.x-c.x)*r,g=(A.max.x-c.x)*r):(i=(A.max.x-c.x)*r,g=(A.min.x-c.x)*r),s>=0?(I=(A.min.y-c.y)*s,n=(A.max.y-c.y)*s):(I=(A.max.y-c.y)*s,n=(A.min.y-c.y)*s),i>n||I>g||((I>i||isNaN(i))&&(i=I),(n<g||isNaN(g))&&(g=n),B>=0?(o=(A.min.z-c.z)*B,a=(A.max.z-c.z)*B):(o=(A.max.z-c.z)*B,a=(A.min.z-c.z)*B),i>a||o>g)||((o>i||i!==i)&&(i=o),(a<g||g!==g)&&(g=a),g<0)?null:this.at(i>=0?i:g,e)}intersectsBox(A){return this.intersectBox(A,Kl)!==null}intersectTriangle(A,e,i,g,I){$L.subVectors(e,A),tG.subVectors(i,A),Aq.crossVectors($L,tG);let n=this.direction.dot(Aq),o;if(n>0){if(g)return null;o=1}else if(n<0)o=-1,n=-n;else return null;QE.subVectors(this.origin,A);const a=o*this.direction.dot(tG.crossVectors(QE,tG));if(a<0)return null;const r=o*this.direction.dot($L.cross(QE));if(r<0||a+r>n)return null;const s=-o*QE.dot(Aq);return s<0?null:this.at(s/n,I)}applyMatrix4(A){return this.origin.applyMatrix4(A),this.direction.transformDirection(A),this}equals(A){return A.origin.equals(this.origin)&&A.direction.equals(this.direction)}clone(){return new this.constructor().copy(this)}}class Ai{constructor(A,e,i,g,I,n,o,a,r,s,B,c,E,D,y,S){Ai.prototype.isMatrix4=!0,this.elements=[1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1],A!==void 0&&this.set(A,e,i,g,I,n,o,a,r,s,B,c,E,D,y,S)}set(A,e,i,g,I,n,o,a,r,s,B,c,E,D,y,S){const f=this.elements;return f[0]=A,f[4]=e,f[8]=i,f[12]=g,f[1]=I,f[5]=n,f[9]=o,f[13]=a,f[2]=r,f[6]=s,f[10]=B,f[14]=c,f[3]=E,f[7]=D,f[11]=y,f[15]=S,this}identity(){return this.set(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1),this}clone(){return new Ai().fromArray(this.elements)}copy(A){const e=this.elements,i=A.elements;return e[0]=i[0],e[1]=i[1],e[2]=i[2],e[3]=i[3],e[4]=i[4],e[5]=i[5],e[6]=i[6],e[7]=i[7],e[8]=i[8],e[9]=i[9],e[10]=i[10],e[11]=i[11],e[12]=i[12],e[13]=i[13],e[14]=i[14],e[15]=i[15],this}copyPosition(A){const e=this.elements,i=A.elements;return e[12]=i[12],e[13]=i[13],e[14]=i[14],this}setFromMatrix3(A){const e=A.elements;return this.set(e[0],e[3],e[6],0,e[1],e[4],e[7],0,e[2],e[5],e[8],0,0,0,0,1),this}extractBasis(A,e,i){return A.setFromMatrixColumn(this,0),e.setFromMatrixColumn(this,1),i.setFromMatrixColumn(this,2),this}makeBasis(A,e,i){return this.set(A.x,e.x,i.x,0,A.y,e.y,i.y,0,A.z,e.z,i.z,0,0,0,0,1),this}extractRotation(A){const e=this.elements,i=A.elements,g=1/Mf.setFromMatrixColumn(A,0).length(),I=1/Mf.setFromMatrixColumn(A,1).length(),n=1/Mf.setFromMatrixColumn(A,2).length();return e[0]=i[0]*g,e[1]=i[1]*g,e[2]=i[2]*g,e[3]=0,e[4]=i[4]*I,e[5]=i[5]*I,e[6]=i[6]*I,e[7]=0,e[8]=i[8]*n,e[9]=i[9]*n,e[10]=i[10]*n,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromEuler(A){const e=this.elements,i=A.x,g=A.y,I=A.z,n=Math.cos(i),o=Math.sin(i),a=Math.cos(g),r=Math.sin(g),s=Math.cos(I),B=Math.sin(I);if(A.order==="XYZ"){const c=n*s,E=n*B,D=o*s,y=o*B;e[0]=a*s,e[4]=-a*B,e[8]=r,e[1]=E+D*r,e[5]=c-y*r,e[9]=-o*a,e[2]=y-c*r,e[6]=D+E*r,e[10]=n*a}else if(A.order==="YXZ"){const c=a*s,E=a*B,D=r*s,y=r*B;e[0]=c+y*o,e[4]=D*o-E,e[8]=n*r,e[1]=n*B,e[5]=n*s,e[9]=-o,e[2]=E*o-D,e[6]=y+c*o,e[10]=n*a}else if(A.order==="ZXY"){const c=a*s,E=a*B,D=r*s,y=r*B;e[0]=c-y*o,e[4]=-n*B,e[8]=D+E*o,e[1]=E+D*o,e[5]=n*s,e[9]=y-c*o,e[2]=-n*r,e[6]=o,e[10]=n*a}else if(A.order==="ZYX"){const c=n*s,E=n*B,D=o*s,y=o*B;e[0]=a*s,e[4]=D*r-E,e[8]=c*r+y,e[1]=a*B,e[5]=y*r+c,e[9]=E*r-D,e[2]=-r,e[6]=o*a,e[10]=n*a}else if(A.order==="YZX"){const c=n*a,E=n*r,D=o*a,y=o*r;e[0]=a*s,e[4]=y-c*B,e[8]=D*B+E,e[1]=B,e[5]=n*s,e[9]=-o*s,e[2]=-r*s,e[6]=E*B+D,e[10]=c-y*B}else if(A.order==="XZY"){const c=n*a,E=n*r,D=o*a,y=o*r;e[0]=a*s,e[4]=-B,e[8]=r*s,e[1]=c*B+y,e[5]=n*s,e[9]=E*B-D,e[2]=D*B-E,e[6]=o*s,e[10]=y*B+c}return e[3]=0,e[7]=0,e[11]=0,e[12]=0,e[13]=0,e[14]=0,e[15]=1,this}makeRotationFromQuaternion(A){return this.compose(pHA,A,fHA)}lookAt(A,e,i){const g=this.elements;return ts.subVectors(A,e),ts.lengthSq()===0&&(ts.z=1),ts.normalize(),EE.crossVectors(i,ts),EE.lengthSq()===0&&(Math.abs(i.z)===1?ts.x+=1e-4:ts.z+=1e-4,ts.normalize(),EE.crossVectors(i,ts)),EE.normalize(),iG.crossVectors(ts,EE),g[0]=EE.x,g[4]=iG.x,g[8]=ts.x,g[1]=EE.y,g[5]=iG.y,g[9]=ts.y,g[2]=EE.z,g[6]=iG.z,g[10]=ts.z,this}multiply(A){return this.multiplyMatrices(this,A)}premultiply(A){return this.multiplyMatrices(A,this)}multiplyMatrices(A,e){const i=A.elements,g=e.elements,I=this.elements,n=i[0],o=i[4],a=i[8],r=i[12],s=i[1],B=i[5],c=i[9],E=i[13],D=i[2],y=i[6],S=i[10],f=i[14],M=i[3],k=i[7],m=i[11],U=i[15],F=g[0],b=g[4],K=g[8],R=g[12],G=g[1],J=g[5],x=g[9],H=g[13],P=g[2],j=g[6],q=g[10],Y=g[14],O=g[3],$=g[7],gA=g[11],z=g[15];return I[0]=n*F+o*G+a*P+r*O,I[4]=n*b+o*J+a*j+r*$,I[8]=n*K+o*x+a*q+r*gA,I[12]=n*R+o*H+a*Y+r*z,I[1]=s*F+B*G+c*P+E*O,I[5]=s*b+B*J+c*j+E*$,I[9]=s*K+B*x+c*q+E*gA,I[13]=s*R+B*H+c*Y+E*z,I[2]=D*F+y*G+S*P+f*O,I[6]=D*b+y*J+S*j+f*$,I[10]=D*K+y*x+S*q+f*gA,I[14]=D*R+y*H+S*Y+f*z,I[3]=M*F+k*G+m*P+U*O,I[7]=M*b+k*J+m*j+U*$,I[11]=M*K+k*x+m*q+U*gA,I[15]=M*R+k*H+m*Y+U*z,this}multiplyScalar(A){const e=this.elements;return e[0]*=A,e[4]*=A,e[8]*=A,e[12]*=A,e[1]*=A,e[5]*=A,e[9]*=A,e[13]*=A,e[2]*=A,e[6]*=A,e[10]*=A,e[14]*=A,e[3]*=A,e[7]*=A,e[11]*=A,e[15]*=A,this}determinant(){const A=this.elements,e=A[0],i=A[4],g=A[8],I=A[12],n=A[1],o=A[5],a=A[9],r=A[13],s=A[2],B=A[6],c=A[10],E=A[14],D=A[3],y=A[7],S=A[11],f=A[15];return D*(+I*a*B-g*r*B-I*o*c+i*r*c+g*o*E-i*a*E)+y*(+e*a*E-e*r*c+I*n*c-g*n*E+g*r*s-I*a*s)+S*(+e*r*B-e*o*E-I*n*B+i*n*E+I*o*s-i*r*s)+f*(-g*o*s-e*a*B+e*o*c+g*n*B-i*n*c+i*a*s)}transpose(){const A=this.elements;let e;return e=A[1],A[1]=A[4],A[4]=e,e=A[2],A[2]=A[8],A[8]=e,e=A[6],A[6]=A[9],A[9]=e,e=A[3],A[3]=A[12],A[12]=e,e=A[7],A[7]=A[13],A[13]=e,e=A[11],A[11]=A[14],A[14]=e,this}setPosition(A,e,i){const g=this.elements;return A.isVector3?(g[12]=A.x,g[13]=A.y,g[14]=A.z):(g[12]=A,g[13]=e,g[14]=i),this}invert(){const A=this.elements,e=A[0],i=A[1],g=A[2],I=A[3],n=A[4],o=A[5],a=A[6],r=A[7],s=A[8],B=A[9],c=A[10],E=A[11],D=A[12],y=A[13],S=A[14],f=A[15],M=B*S*r-y*c*r+y*a*E-o*S*E-B*a*f+o*c*f,k=D*c*r-s*S*r-D*a*E+n*S*E+s*a*f-n*c*f,m=s*y*r-D*B*r+D*o*E-n*y*E-s*o*f+n*B*f,U=D*B*a-s*y*a-D*o*c+n*y*c+s*o*S-n*B*S,F=e*M+i*k+g*m+I*U;if(F===0)return this.set(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);const b=1/F;return A[0]=M*b,A[1]=(y*c*I-B*S*I-y*g*E+i*S*E+B*g*f-i*c*f)*b,A[2]=(o*S*I-y*a*I+y*g*r-i*S*r-o*g*f+i*a*f)*b,A[3]=(B*a*I-o*c*I-B*g*r+i*c*r+o*g*E-i*a*E)*b,A[4]=k*b,A[5]=(s*S*I-D*c*I+D*g*E-e*S*E-s*g*f+e*c*f)*b,A[6]=(D*a*I-n*S*I-D*g*r+e*S*r+n*g*f-e*a*f)*b,A[7]=(n*c*I-s*a*I+s*g*r-e*c*r-n*g*E+e*a*E)*b,A[8]=m*b,A[9]=(D*B*I-s*y*I-D*i*E+e*y*E+s*i*f-e*B*f)*b,A[10]=(n*y*I-D*o*I+D*i*r-e*y*r-n*i*f+e*o*f)*b,A[11]=(s*o*I-n*B*I-s*i*r+e*B*r+n*i*E-e*o*E)*b,A[12]=U*b,A[13]=(s*y*g-D*B*g+D*i*c-e*y*c-s*i*S+e*B*S)*b,A[14]=(D*o*g-n*y*g-D*i*a+e*y*a+n*i*S-e*o*S)*b,A[15]=(n*B*g-s*o*g+s*i*a-e*B*a-n*i*c+e*o*c)*b,this}scale(A){const e=this.elements,i=A.x,g=A.y,I=A.z;return e[0]*=i,e[4]*=g,e[8]*=I,e[1]*=i,e[5]*=g,e[9]*=I,e[2]*=i,e[6]*=g,e[10]*=I,e[3]*=i,e[7]*=g,e[11]*=I,this}getMaxScaleOnAxis(){const A=this.elements,e=A[0]*A[0]+A[1]*A[1]+A[2]*A[2],i=A[4]*A[4]+A[5]*A[5]+A[6]*A[6],g=A[8]*A[8]+A[9]*A[9]+A[10]*A[10];return Math.sqrt(Math.max(e,i,g))}makeTranslation(A,e,i){return A.isVector3?this.set(1,0,0,A.x,0,1,0,A.y,0,0,1,A.z,0,0,0,1):this.set(1,0,0,A,0,1,0,e,0,0,1,i,0,0,0,1),this}makeRotationX(A){const e=Math.cos(A),i=Math.sin(A);return this.set(1,0,0,0,0,e,-i,0,0,i,e,0,0,0,0,1),this}makeRotationY(A){const e=Math.cos(A),i=Math.sin(A);return this.set(e,0,i,0,0,1,0,0,-i,0,e,0,0,0,0,1),this}makeRotationZ(A){const e=Math.cos(A),i=Math.sin(A);return this.set(e,-i,0,0,i,e,0,0,0,0,1,0,0,0,0,1),this}makeRotationAxis(A,e){const i=Math.cos(e),g=Math.sin(e),I=1-i,n=A.x,o=A.y,a=A.z,r=I*n,s=I*o;return this.set(r*n+i,r*o-g*a,r*a+g*o,0,r*o+g*a,s*o+i,s*a-g*n,0,r*a-g*o,s*a+g*n,I*a*a+i,0,0,0,0,1),this}makeScale(A,e,i){return this.set(A,0,0,0,0,e,0,0,0,0,i,0,0,0,0,1),this}makeShear(A,e,i,g,I,n){return this.set(1,i,I,0,A,1,n,0,e,g,1,0,0,0,0,1),this}compose(A,e,i){const g=this.elements,I=e._x,n=e._y,o=e._z,a=e._w,r=I+I,s=n+n,B=o+o,c=I*r,E=I*s,D=I*B,y=n*s,S=n*B,f=o*B,M=a*r,k=a*s,m=a*B,U=i.x,F=i.y,b=i.z;return g[0]=(1-(y+f))*U,g[1]=(E+m)*U,g[2]=(D-k)*U,g[3]=0,g[4]=(E-m)*F,g[5]=(1-(c+f))*F,g[6]=(S+M)*F,g[7]=0,g[8]=(D+k)*b,g[9]=(S-M)*b,g[10]=(1-(c+y))*b,g[11]=0,g[12]=A.x,g[13]=A.y,g[14]=A.z,g[15]=1,this}decompose(A,e,i){const g=this.elements;let I=Mf.set(g[0],g[1],g[2]).length();const n=Mf.set(g[4],g[5],g[6]).length(),o=Mf.set(g[8],g[9],g[10]).length();this.determinant()<0&&(I=-I),A.x=g[12],A.y=g[13],A.z=g[14],VC.copy(this);const r=1/I,s=1/n,B=1/o;return VC.elements[0]*=r,VC.elements[1]*=r,VC.elements[2]*=r,VC.elements[4]*=s,VC.elements[5]*=s,VC.elements[6]*=s,VC.elements[8]*=B,VC.elements[9]*=B,VC.elements[10]*=B,e.setFromRotationMatrix(VC),i.x=I,i.y=n,i.z=o,this}makePerspective(A,e,i,g,I,n,o=cs,a=!1){const r=this.elements,s=2*I/(e-A),B=2*I/(i-g),c=(e+A)/(e-A),E=(i+g)/(i-g);let D,y;if(a)D=I/(n-I),y=n*I/(n-I);else if(o===cs)D=-(n+I)/(n-I),y=-2*n*I/(n-I);else if(o===dy)D=-n/(n-I),y=-n*I/(n-I);else throw new Error("THREE.Matrix4.makePerspective(): Invalid coordinate system: "+o);return r[0]=s,r[4]=0,r[8]=c,r[12]=0,r[1]=0,r[5]=B,r[9]=E,r[13]=0,r[2]=0,r[6]=0,r[10]=D,r[14]=y,r[3]=0,r[7]=0,r[11]=-1,r[15]=0,this}makeOrthographic(A,e,i,g,I,n,o=cs,a=!1){const r=this.elements,s=2/(e-A),B=2/(i-g),c=-(e+A)/(e-A),E=-(i+g)/(i-g);let D,y;if(a)D=1/(n-I),y=n/(n-I);else if(o===cs)D=-2/(n-I),y=-(n+I)/(n-I);else if(o===dy)D=-1/(n-I),y=-I/(n-I);else throw new Error("THREE.Matrix4.makeOrthographic(): Invalid coordinate system: "+o);return r[0]=s,r[4]=0,r[8]=0,r[12]=c,r[1]=0,r[5]=B,r[9]=0,r[13]=E,r[2]=0,r[6]=0,r[10]=D,r[14]=y,r[3]=0,r[7]=0,r[11]=0,r[15]=1,this}equals(A){const e=this.elements,i=A.elements;for(let g=0;g<16;g++)if(e[g]!==i[g])return!1;return!0}fromArray(A,e=0){for(let i=0;i<16;i++)this.elements[i]=A[i+e];return this}toArray(A=[],e=0){const i=this.elements;return A[e]=i[0],A[e+1]=i[1],A[e+2]=i[2],A[e+3]=i[3],A[e+4]=i[4],A[e+5]=i[5],A[e+6]=i[6],A[e+7]=i[7],A[e+8]=i[8],A[e+9]=i[9],A[e+10]=i[10],A[e+11]=i[11],A[e+12]=i[12],A[e+13]=i[13],A[e+14]=i[14],A[e+15]=i[15],A}}const Mf=new wA,VC=new Ai,pHA=new wA(0,0,0),fHA=new wA(1,1,1),EE=new wA,iG=new wA,ts=new wA,Yz=new Ai,Hz=new Kn;class Wo{constructor(A=0,e=0,i=0,g=Wo.DEFAULT_ORDER){this.isEuler=!0,this._x=A,this._y=e,this._z=i,this._order=g}get x(){return this._x}set x(A){this._x=A,this._onChangeCallback()}get y(){return this._y}set y(A){this._y=A,this._onChangeCallback()}get z(){return this._z}set z(A){this._z=A,this._onChangeCallback()}get order(){return this._order}set order(A){this._order=A,this._onChangeCallback()}set(A,e,i,g=this._order){return this._x=A,this._y=e,this._z=i,this._order=g,this._onChangeCallback(),this}clone(){return new this.constructor(this._x,this._y,this._z,this._order)}copy(A){return this._x=A._x,this._y=A._y,this._z=A._z,this._order=A._order,this._onChangeCallback(),this}setFromRotationMatrix(A,e=this._order,i=!0){const g=A.elements,I=g[0],n=g[4],o=g[8],a=g[1],r=g[5],s=g[9],B=g[2],c=g[6],E=g[10];switch(e){case"XYZ":this._y=Math.asin(Ci(o,-1,1)),Math.abs(o)<.9999999?(this._x=Math.atan2(-s,E),this._z=Math.atan2(-n,I)):(this._x=Math.atan2(c,r),this._z=0);break;case"YXZ":this._x=Math.asin(-Ci(s,-1,1)),Math.abs(s)<.9999999?(this._y=Math.atan2(o,E),this._z=Math.atan2(a,r)):(this._y=Math.atan2(-B,I),this._z=0);break;case"ZXY":this._x=Math.asin(Ci(c,-1,1)),Math.abs(c)<.9999999?(this._y=Math.atan2(-B,E),this._z=Math.atan2(-n,r)):(this._y=0,this._z=Math.atan2(a,I));break;case"ZYX":this._y=Math.asin(-Ci(B,-1,1)),Math.abs(B)<.9999999?(this._x=Math.atan2(c,E),this._z=Math.atan2(a,I)):(this._x=0,this._z=Math.atan2(-n,r));break;case"YZX":this._z=Math.asin(Ci(a,-1,1)),Math.abs(a)<.9999999?(this._x=Math.atan2(-s,r),this._y=Math.atan2(-B,I)):(this._x=0,this._y=Math.atan2(o,E));break;case"XZY":this._z=Math.asin(-Ci(n,-1,1)),Math.abs(n)<.9999999?(this._x=Math.atan2(c,r),this._y=Math.atan2(o,I)):(this._x=Math.atan2(-s,E),this._y=0);break;default:}return this._order=e,i===!0&&this._onChangeCallback(),this}setFromQuaternion(A,e,i){return Yz.makeRotationFromQuaternion(A),this.setFromRotationMatrix(Yz,e,i)}setFromVector3(A,e=this._order){return this.set(A.x,A.y,A.z,e)}reorder(A){return Hz.setFromEuler(this),this.setFromQuaternion(Hz,A)}equals(A){return A._x===this._x&&A._y===this._y&&A._z===this._z&&A._order===this._order}fromArray(A){return this._x=A[0],this._y=A[1],this._z=A[2],A[3]!==void 0&&(this._order=A[3]),this._onChangeCallback(),this}toArray(A=[],e=0){return A[e]=this._x,A[e+1]=this._y,A[e+2]=this._z,A[e+3]=this._order,A}_onChange(A){return this._onChangeCallback=A,this}_onChangeCallback(){}*[Symbol.iterator](){yield this._x,yield this._y,yield this._z,yield this._order}}Wo.DEFAULT_ORDER="XYZ";class fy{constructor(){this.mask=1}set(A){this.mask=(1<<A|0)>>>0}enable(A){this.mask|=1<<A|0}enableAll(){this.mask=-1}toggle(A){this.mask^=1<<A|0}disable(A){this.mask&=~(1<<A|0)}disableAll(){this.mask=0}test(A){return(this.mask&A.mask)!==0}isEnabled(A){return(this.mask&(1<<A|0))!==0}}let DHA=0;const Oz=new wA,Nf=new Kn,Fl=new Ai,gG=new wA,xw=new wA,yHA=new wA,SHA=new Kn,Pz=new wA(1,0,0),jz=new wA(0,1,0),Zz=new wA(0,0,1),Wz={type:"added"},wHA={type:"removed"},Gf={type:"childadded",child:null},eq={type:"childremoved",child:null};class ng extends $c{constructor(){super(),this.isObject3D=!0,Object.defineProperty(this,"id",{value:DHA++}),this.uuid=Qs(),this.name="",this.type="Object3D",this.parent=null,this.children=[],this.up=ng.DEFAULT_UP.clone();const A=new wA,e=new Wo,i=new Kn,g=new wA(1,1,1);function I(){i.setFromEuler(e,!1)}function n(){e.setFromQuaternion(i,void 0,!1)}e._onChange(I),i._onChange(n),Object.defineProperties(this,{position:{configurable:!0,enumerable:!0,value:A},rotation:{configurable:!0,enumerable:!0,value:e},quaternion:{configurable:!0,enumerable:!0,value:i},scale:{configurable:!0,enumerable:!0,value:g},modelViewMatrix:{value:new Ai},normalMatrix:{value:new Ni}}),this.matrix=new Ai,this.matrixWorld=new Ai,this.matrixAutoUpdate=ng.DEFAULT_MATRIX_AUTO_UPDATE,this.matrixWorldAutoUpdate=ng.DEFAULT_MATRIX_WORLD_AUTO_UPDATE,this.matrixWorldNeedsUpdate=!1,this.layers=new fy,this.visible=!0,this.castShadow=!1,this.receiveShadow=!1,this.frustumCulled=!0,this.renderOrder=0,this.animations=[],this.customDepthMaterial=void 0,this.customDistanceMaterial=void 0,this.userData={}}onBeforeShadow(){}onAfterShadow(){}onBeforeRender(){}onAfterRender(){}applyMatrix4(A){this.matrixAutoUpdate&&this.updateMatrix(),this.matrix.premultiply(A),this.matrix.decompose(this.position,this.quaternion,this.scale)}applyQuaternion(A){return this.quaternion.premultiply(A),this}setRotationFromAxisAngle(A,e){this.quaternion.setFromAxisAngle(A,e)}setRotationFromEuler(A){this.quaternion.setFromEuler(A,!0)}setRotationFromMatrix(A){this.quaternion.setFromRotationMatrix(A)}setRotationFromQuaternion(A){this.quaternion.copy(A)}rotateOnAxis(A,e){return Nf.setFromAxisAngle(A,e),this.quaternion.multiply(Nf),this}rotateOnWorldAxis(A,e){return Nf.setFromAxisAngle(A,e),this.quaternion.premultiply(Nf),this}rotateX(A){return this.rotateOnAxis(Pz,A)}rotateY(A){return this.rotateOnAxis(jz,A)}rotateZ(A){return this.rotateOnAxis(Zz,A)}translateOnAxis(A,e){return Oz.copy(A).applyQuaternion(this.quaternion),this.position.add(Oz.multiplyScalar(e)),this}translateX(A){return this.translateOnAxis(Pz,A)}translateY(A){return this.translateOnAxis(jz,A)}translateZ(A){return this.translateOnAxis(Zz,A)}localToWorld(A){return this.updateWorldMatrix(!0,!1),A.applyMatrix4(this.matrixWorld)}worldToLocal(A){return this.updateWorldMatrix(!0,!1),A.applyMatrix4(Fl.copy(this.matrixWorld).invert())}lookAt(A,e,i){A.isVector3?gG.copy(A):gG.set(A,e,i);const g=this.parent;this.updateWorldMatrix(!0,!1),xw.setFromMatrixPosition(this.matrixWorld),this.isCamera||this.isLight?Fl.lookAt(xw,gG,this.up):Fl.lookAt(gG,xw,this.up),this.quaternion.setFromRotationMatrix(Fl),g&&(Fl.extractRotation(g.matrixWorld),Nf.setFromRotationMatrix(Fl),this.quaternion.premultiply(Nf.invert()))}add(A){if(arguments.length>1){for(let e=0;e<arguments.length;e++)this.add(arguments[e]);return this}return A===this?this:(A&&A.isObject3D&&(A.removeFromParent(),A.parent=this,this.children.push(A),A.dispatchEvent(Wz),Gf.child=A,this.dispatchEvent(Gf),Gf.child=null),this)}remove(A){if(arguments.length>1){for(let i=0;i<arguments.length;i++)this.remove(arguments[i]);return this}const e=this.children.indexOf(A);return e!==-1&&(A.parent=null,this.children.splice(e,1),A.dispatchEvent(wHA),eq.child=A,this.dispatchEvent(eq),eq.child=null),this}removeFromParent(){const A=this.parent;return A!==null&&A.remove(this),this}clear(){return this.remove(...this.children)}attach(A){return this.updateWorldMatrix(!0,!1),Fl.copy(this.matrixWorld).invert(),A.parent!==null&&(A.parent.updateWorldMatrix(!0,!1),Fl.multiply(A.parent.matrixWorld)),A.applyMatrix4(Fl),A.removeFromParent(),A.parent=this,this.children.push(A),A.updateWorldMatrix(!1,!0),A.dispatchEvent(Wz),Gf.child=A,this.dispatchEvent(Gf),Gf.child=null,this}getObjectById(A){return this.getObjectByProperty("id",A)}getObjectByName(A){return this.getObjectByProperty("name",A)}getObjectByProperty(A,e){if(this[A]===e)return this;for(let i=0,g=this.children.length;i<g;i++){const n=this.children[i].getObjectByProperty(A,e);if(n!==void 0)return n}}getObjectsByProperty(A,e,i=[]){this[A]===e&&i.push(this);const g=this.children;for(let I=0,n=g.length;I<n;I++)g[I].getObjectsByProperty(A,e,i);return i}getWorldPosition(A){return this.updateWorldMatrix(!0,!1),A.setFromMatrixPosition(this.matrixWorld)}getWorldQuaternion(A){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xw,A,yHA),A}getWorldScale(A){return this.updateWorldMatrix(!0,!1),this.matrixWorld.decompose(xw,SHA,A),A}getWorldDirection(A){this.updateWorldMatrix(!0,!1);const e=this.matrixWorld.elements;return A.set(e[8],e[9],e[10]).normalize()}raycast(){}traverse(A){A(this);const e=this.children;for(let i=0,g=e.length;i<g;i++)e[i].traverse(A)}traverseVisible(A){if(this.visible===!1)return;A(this);const e=this.children;for(let i=0,g=e.length;i<g;i++)e[i].traverseVisible(A)}traverseAncestors(A){const e=this.parent;e!==null&&(A(e),e.traverseAncestors(A))}updateMatrix(){this.matrix.compose(this.position,this.quaternion,this.scale),this.matrixWorldNeedsUpdate=!0}updateMatrixWorld(A){this.matrixAutoUpdate&&this.updateMatrix(),(this.matrixWorldNeedsUpdate||A)&&(this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),this.matrixWorldNeedsUpdate=!1,A=!0);const e=this.children;for(let i=0,g=e.length;i<g;i++)e[i].updateMatrixWorld(A)}updateWorldMatrix(A,e){const i=this.parent;if(A===!0&&i!==null&&i.updateWorldMatrix(!0,!1),this.matrixAutoUpdate&&this.updateMatrix(),this.matrixWorldAutoUpdate===!0&&(this.parent===null?this.matrixWorld.copy(this.matrix):this.matrixWorld.multiplyMatrices(this.parent.matrixWorld,this.matrix)),e===!0){const g=this.children;for(let I=0,n=g.length;I<n;I++)g[I].updateWorldMatrix(!1,!0)}}toJSON(A){const e=A===void 0||typeof A=="string",i={};e&&(A={geometries:{},materials:{},textures:{},images:{},shapes:{},skeletons:{},animations:{},nodes:{}},i.metadata={version:4.7,type:"Object",generator:"Object3D.toJSON"});const g={};g.uuid=this.uuid,g.type=this.type,this.name!==""&&(g.name=this.name),this.castShadow===!0&&(g.castShadow=!0),this.receiveShadow===!0&&(g.receiveShadow=!0),this.visible===!1&&(g.visible=!1),this.frustumCulled===!1&&(g.frustumCulled=!1),this.renderOrder!==0&&(g.renderOrder=this.renderOrder),Object.keys(this.userData).length>0&&(g.userData=this.userData),g.layers=this.layers.mask,g.matrix=this.matrix.toArray(),g.up=this.up.toArray(),this.matrixAutoUpdate===!1&&(g.matrixAutoUpdate=!1),this.isInstancedMesh&&(g.type="InstancedMesh",g.count=this.count,g.instanceMatrix=this.instanceMatrix.toJSON(),this.instanceColor!==null&&(g.instanceColor=this.instanceColor.toJSON())),this.isBatchedMesh&&(g.type="BatchedMesh",g.perObjectFrustumCulled=this.perObjectFrustumCulled,g.sortObjects=this.sortObjects,g.drawRanges=this._drawRanges,g.reservedRanges=this._reservedRanges,g.geometryInfo=this._geometryInfo.map(o=>({...o,boundingBox:o.boundingBox?o.boundingBox.toJSON():void 0,boundingSphere:o.boundingSphere?o.boundingSphere.toJSON():void 0})),g.instanceInfo=this._instanceInfo.map(o=>({...o})),g.availableInstanceIds=this._availableInstanceIds.slice(),g.availableGeometryIds=this._availableGeometryIds.slice(),g.nextIndexStart=this._nextIndexStart,g.nextVertexStart=this._nextVertexStart,g.geometryCount=this._geometryCount,g.maxInstanceCount=this._maxInstanceCount,g.maxVertexCount=this._maxVertexCount,g.maxIndexCount=this._maxIndexCount,g.geometryInitialized=this._geometryInitialized,g.matricesTexture=this._matricesTexture.toJSON(A),g.indirectTexture=this._indirectTexture.toJSON(A),this._colorsTexture!==null&&(g.colorsTexture=this._colorsTexture.toJSON(A)),this.boundingSphere!==null&&(g.boundingSphere=this.boundingSphere.toJSON()),this.boundingBox!==null&&(g.boundingBox=this.boundingBox.toJSON()));function I(o,a){return o[a.uuid]===void 0&&(o[a.uuid]=a.toJSON(A)),a.uuid}if(this.isScene)this.background&&(this.background.isColor?g.background=this.background.toJSON():this.background.isTexture&&(g.background=this.background.toJSON(A).uuid)),this.environment&&this.environment.isTexture&&this.environment.isRenderTargetTexture!==!0&&(g.environment=this.environment.toJSON(A).uuid);else if(this.isMesh||this.isLine||this.isPoints){g.geometry=I(A.geometries,this.geometry);const o=this.geometry.parameters;if(o!==void 0&&o.shapes!==void 0){const a=o.shapes;if(Array.isArray(a))for(let r=0,s=a.length;r<s;r++){const B=a[r];I(A.shapes,B)}else I(A.shapes,a)}}if(this.isSkinnedMesh&&(g.bindMode=this.bindMode,g.bindMatrix=this.bindMatrix.toArray(),this.skeleton!==void 0&&(I(A.skeletons,this.skeleton),g.skeleton=this.skeleton.uuid)),this.material!==void 0)if(Array.isArray(this.material)){const o=[];for(let a=0,r=this.material.length;a<r;a++)o.push(I(A.materials,this.material[a]));g.material=o}else g.material=I(A.materials,this.material);if(this.children.length>0){g.children=[];for(let o=0;o<this.children.length;o++)g.children.push(this.children[o].toJSON(A).object)}if(this.animations.length>0){g.animations=[];for(let o=0;o<this.animations.length;o++){const a=this.animations[o];g.animations.push(I(A.animations,a))}}if(e){const o=n(A.geometries),a=n(A.materials),r=n(A.textures),s=n(A.images),B=n(A.shapes),c=n(A.skeletons),E=n(A.animations),D=n(A.nodes);o.length>0&&(i.geometries=o),a.length>0&&(i.materials=a),r.length>0&&(i.textures=r),s.length>0&&(i.images=s),B.length>0&&(i.shapes=B),c.length>0&&(i.skeletons=c),E.length>0&&(i.animations=E),D.length>0&&(i.nodes=D)}return i.object=g,i;function n(o){const a=[];for(const r in o){const s=o[r];delete s.metadata,a.push(s)}return a}}clone(A){return new this.constructor().copy(this,A)}copy(A,e=!0){if(this.name=A.name,this.up.copy(A.up),this.position.copy(A.position),this.rotation.order=A.rotation.order,this.quaternion.copy(A.quaternion),this.scale.copy(A.scale),this.matrix.copy(A.matrix),this.matrixWorld.copy(A.matrixWorld),this.matrixAutoUpdate=A.matrixAutoUpdate,this.matrixWorldAutoUpdate=A.matrixWorldAutoUpdate,this.matrixWorldNeedsUpdate=A.matrixWorldNeedsUpdate,this.layers.mask=A.layers.mask,this.visible=A.visible,this.castShadow=A.castShadow,this.receiveShadow=A.receiveShadow,this.frustumCulled=A.frustumCulled,this.renderOrder=A.renderOrder,this.animations=A.animations.slice(),this.userData=JSON.parse(JSON.stringify(A.userData)),e===!0)for(let i=0;i<A.children.length;i++){const g=A.children[i];this.add(g.clone())}return this}}ng.DEFAULT_UP=new wA(0,1,0);ng.DEFAULT_MATRIX_AUTO_UPDATE=!0;ng.DEFAULT_MATRIX_WORLD_AUTO_UPDATE=!0;const XC=new wA,bl=new wA,tq=new wA,vl=new wA,Rf=new wA,Uf=new wA,zz=new wA,iq=new wA,gq=new wA,Iq=new wA,nq=new wg,oq=new wg,aq=new wg;class Mr{constructor(A=new wA,e=new wA,i=new wA){this.a=A,this.b=e,this.c=i}static getNormal(A,e,i,g){g.subVectors(i,e),XC.subVectors(A,e),g.cross(XC);const I=g.lengthSq();return I>0?g.multiplyScalar(1/Math.sqrt(I)):g.set(0,0,0)}static getBarycoord(A,e,i,g,I){XC.subVectors(g,e),bl.subVectors(i,e),tq.subVectors(A,e);const n=XC.dot(XC),o=XC.dot(bl),a=XC.dot(tq),r=bl.dot(bl),s=bl.dot(tq),B=n*r-o*o;if(B===0)return I.set(0,0,0),null;const c=1/B,E=(r*a-o*s)*c,D=(n*s-o*a)*c;return I.set(1-E-D,D,E)}static containsPoint(A,e,i,g){return this.getBarycoord(A,e,i,g,vl)===null?!1:vl.x>=0&&vl.y>=0&&vl.x+vl.y<=1}static getInterpolation(A,e,i,g,I,n,o,a){return this.getBarycoord(A,e,i,g,vl)===null?(a.x=0,a.y=0,"z"in a&&(a.z=0),"w"in a&&(a.w=0),null):(a.setScalar(0),a.addScaledVector(I,vl.x),a.addScaledVector(n,vl.y),a.addScaledVector(o,vl.z),a)}static getInterpolatedAttribute(A,e,i,g,I,n){return nq.setScalar(0),oq.setScalar(0),aq.setScalar(0),nq.fromBufferAttribute(A,e),oq.fromBufferAttribute(A,i),aq.fromBufferAttribute(A,g),n.setScalar(0),n.addScaledVector(nq,I.x),n.addScaledVector(oq,I.y),n.addScaledVector(aq,I.z),n}static isFrontFacing(A,e,i,g){return XC.subVectors(i,e),bl.subVectors(A,e),XC.cross(bl).dot(g)<0}set(A,e,i){return this.a.copy(A),this.b.copy(e),this.c.copy(i),this}setFromPointsAndIndices(A,e,i,g){return this.a.copy(A[e]),this.b.copy(A[i]),this.c.copy(A[g]),this}setFromAttributeAndIndices(A,e,i,g){return this.a.fromBufferAttribute(A,e),this.b.fromBufferAttribute(A,i),this.c.fromBufferAttribute(A,g),this}clone(){return new this.constructor().copy(this)}copy(A){return this.a.copy(A.a),this.b.copy(A.b),this.c.copy(A.c),this}getArea(){return XC.subVectors(this.c,this.b),bl.subVectors(this.a,this.b),XC.cross(bl).length()*.5}getMidpoint(A){return A.addVectors(this.a,this.b).add(this.c).multiplyScalar(1/3)}getNormal(A){return Mr.getNormal(this.a,this.b,this.c,A)}getPlane(A){return A.setFromCoplanarPoints(this.a,this.b,this.c)}getBarycoord(A,e){return Mr.getBarycoord(A,this.a,this.b,this.c,e)}getInterpolation(A,e,i,g,I){return Mr.getInterpolation(A,this.a,this.b,this.c,e,i,g,I)}containsPoint(A){return Mr.containsPoint(A,this.a,this.b,this.c)}isFrontFacing(A){return Mr.isFrontFacing(this.a,this.b,this.c,A)}intersectsBox(A){return A.intersectsTriangle(this)}closestPointToPoint(A,e){const i=this.a,g=this.b,I=this.c;let n,o;Rf.subVectors(g,i),Uf.subVectors(I,i),iq.subVectors(A,i);const a=Rf.dot(iq),r=Uf.dot(iq);if(a<=0&&r<=0)return e.copy(i);gq.subVectors(A,g);const s=Rf.dot(gq),B=Uf.dot(gq);if(s>=0&&B<=s)return e.copy(g);const c=a*B-s*r;if(c<=0&&a>=0&&s<=0)return n=a/(a-s),e.copy(i).addScaledVector(Rf,n);Iq.subVectors(A,I);const E=Rf.dot(Iq),D=Uf.dot(Iq);if(D>=0&&E<=D)return e.copy(I);const y=E*r-a*D;if(y<=0&&r>=0&&D<=0)return o=r/(r-D),e.copy(i).addScaledVector(Uf,o);const S=s*D-E*B;if(S<=0&&B-s>=0&&E-D>=0)return zz.subVectors(I,g),o=(B-s)/(B-s+(E-D)),e.copy(g).addScaledVector(zz,o);const f=1/(S+y+c);return n=y*f,o=c*f,e.copy(i).addScaledVector(Rf,n).addScaledVector(Uf,o)}equals(A){return A.a.equals(this.a)&&A.b.equals(this.b)&&A.c.equals(this.c)}}const DnA={aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074},uE={h:0,s:0,l:0},IG={h:0,s:0,l:0};function rq(t,A,e){return e<0&&(e+=1),e>1&&(e-=1),e<1/6?t+(A-t)*6*e:e<1/2?A:e<2/3?t+(A-t)*6*(2/3-e):t}class wt{constructor(A,e,i){return this.isColor=!0,this.r=1,this.g=1,this.b=1,this.set(A,e,i)}set(A,e,i){if(e===void 0&&i===void 0){const g=A;g&&g.isColor?this.copy(g):typeof g=="number"?this.setHex(g):typeof g=="string"&&this.setStyle(g)}else this.setRGB(A,e,i);return this}setScalar(A){return this.r=A,this.g=A,this.b=A,this}setHex(A,e=Hn){return A=Math.floor(A),this.r=(A>>16&255)/255,this.g=(A>>8&255)/255,this.b=(A&255)/255,Qg.colorSpaceToWorking(this,e),this}setRGB(A,e,i,g=Qg.workingColorSpace){return this.r=A,this.g=e,this.b=i,Qg.colorSpaceToWorking(this,g),this}setHSL(A,e,i,g=Qg.workingColorSpace){if(A=XP(A,1),e=Ci(e,0,1),i=Ci(i,0,1),e===0)this.r=this.g=this.b=i;else{const I=i<=.5?i*(1+e):i+e-i*e,n=2*i-I;this.r=rq(n,I,A+1/3),this.g=rq(n,I,A),this.b=rq(n,I,A-1/3)}return Qg.colorSpaceToWorking(this,g),this}setStyle(A,e=Hn){function i(I){I!==void 0&&parseFloat(I)<1}let g;if(g=/^(\w+)\(([^\)]*)\)/.exec(A)){let I;const n=g[1],o=g[2];switch(n){case"rgb":case"rgba":if(I=/^\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(I[4]),this.setRGB(Math.min(255,parseInt(I[1],10))/255,Math.min(255,parseInt(I[2],10))/255,Math.min(255,parseInt(I[3],10))/255,e);if(I=/^\s*(\d+)\%\s*,\s*(\d+)\%\s*,\s*(\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(I[4]),this.setRGB(Math.min(100,parseInt(I[1],10))/100,Math.min(100,parseInt(I[2],10))/100,Math.min(100,parseInt(I[3],10))/100,e);break;case"hsl":case"hsla":if(I=/^\s*(\d*\.?\d+)\s*,\s*(\d*\.?\d+)\%\s*,\s*(\d*\.?\d+)\%\s*(?:,\s*(\d*\.?\d+)\s*)?$/.exec(o))return i(I[4]),this.setHSL(parseFloat(I[1])/360,parseFloat(I[2])/100,parseFloat(I[3])/100,e);break;default:}}else if(g=/^\#([A-Fa-f\d]+)$/.exec(A)){const I=g[1],n=I.length;if(n===3)return this.setRGB(parseInt(I.charAt(0),16)/15,parseInt(I.charAt(1),16)/15,parseInt(I.charAt(2),16)/15,e);if(n===6)return this.setHex(parseInt(I,16),e)}else if(A&&A.length>0)return this.setColorName(A,e);return this}setColorName(A,e=Hn){const i=DnA[A.toLowerCase()];return i!==void 0&&this.setHex(i,e),this}clone(){return new this.constructor(this.r,this.g,this.b)}copy(A){return this.r=A.r,this.g=A.g,this.b=A.b,this}copySRGBToLinear(A){return this.r=aQ(A.r),this.g=aQ(A.g),this.b=aQ(A.b),this}copyLinearToSRGB(A){return this.r=JD(A.r),this.g=JD(A.g),this.b=JD(A.b),this}convertSRGBToLinear(){return this.copySRGBToLinear(this),this}convertLinearToSRGB(){return this.copyLinearToSRGB(this),this}getHex(A=Hn){return Qg.workingToColorSpace(ca.copy(this),A),Math.round(Ci(ca.r*255,0,255))*65536+Math.round(Ci(ca.g*255,0,255))*256+Math.round(Ci(ca.b*255,0,255))}getHexString(A=Hn){return("000000"+this.getHex(A).toString(16)).slice(-6)}getHSL(A,e=Qg.workingColorSpace){Qg.workingToColorSpace(ca.copy(this),e);const i=ca.r,g=ca.g,I=ca.b,n=Math.max(i,g,I),o=Math.min(i,g,I);let a,r;const s=(o+n)/2;if(o===n)a=0,r=0;else{const B=n-o;switch(r=s<=.5?B/(n+o):B/(2-n-o),n){case i:a=(g-I)/B+(g<I?6:0);break;case g:a=(I-i)/B+2;break;case I:a=(i-g)/B+4;break}a/=6}return A.h=a,A.s=r,A.l=s,A}getRGB(A,e=Qg.workingColorSpace){return Qg.workingToColorSpace(ca.copy(this),e),A.r=ca.r,A.g=ca.g,A.b=ca.b,A}getStyle(A=Hn){Qg.workingToColorSpace(ca.copy(this),A);const e=ca.r,i=ca.g,g=ca.b;return A!==Hn?`color(${A} ${e.toFixed(3)} ${i.toFixed(3)} ${g.toFixed(3)})`:`rgb(${Math.round(e*255)},${Math.round(i*255)},${Math.round(g*255)})`}offsetHSL(A,e,i){return this.getHSL(uE),this.setHSL(uE.h+A,uE.s+e,uE.l+i)}add(A){return this.r+=A.r,this.g+=A.g,this.b+=A.b,this}addColors(A,e){return this.r=A.r+e.r,this.g=A.g+e.g,this.b=A.b+e.b,this}addScalar(A){return this.r+=A,this.g+=A,this.b+=A,this}sub(A){return this.r=Math.max(0,this.r-A.r),this.g=Math.max(0,this.g-A.g),this.b=Math.max(0,this.b-A.b),this}multiply(A){return this.r*=A.r,this.g*=A.g,this.b*=A.b,this}multiplyScalar(A){return this.r*=A,this.g*=A,this.b*=A,this}lerp(A,e){return this.r+=(A.r-this.r)*e,this.g+=(A.g-this.g)*e,this.b+=(A.b-this.b)*e,this}lerpColors(A,e,i){return this.r=A.r+(e.r-A.r)*i,this.g=A.g+(e.g-A.g)*i,this.b=A.b+(e.b-A.b)*i,this}lerpHSL(A,e){this.getHSL(uE),A.getHSL(IG);const i=Vm(uE.h,IG.h,e),g=Vm(uE.s,IG.s,e),I=Vm(uE.l,IG.l,e);return this.setHSL(i,g,I),this}setFromVector3(A){return this.r=A.x,this.g=A.y,this.b=A.z,this}applyMatrix3(A){const e=this.r,i=this.g,g=this.b,I=A.elements;return this.r=I[0]*e+I[3]*i+I[6]*g,this.g=I[1]*e+I[4]*i+I[7]*g,this.b=I[2]*e+I[5]*i+I[8]*g,this}equals(A){return A.r===this.r&&A.g===this.g&&A.b===this.b}fromArray(A,e=0){return this.r=A[e],this.g=A[e+1],this.b=A[e+2],this}toArray(A=[],e=0){return A[e]=this.r,A[e+1]=this.g,A[e+2]=this.b,A}fromBufferAttribute(A,e){return this.r=A.getX(e),this.g=A.getY(e),this.b=A.getZ(e),this}toJSON(){return this.getHex()}*[Symbol.iterator](){yield this.r,yield this.g,yield this.b}}const ca=new wt;wt.NAMES=DnA;let mHA=0;class Wn extends $c{constructor(){super(),this.isMaterial=!0,Object.defineProperty(this,"id",{value:mHA++}),this.uuid=Qs(),this.name="",this.type="Material",this.blending=Qd,this.side=jc,this.vertexColors=!1,this.opacity=1,this.transparent=!1,this.alphaHash=!1,this.blendSrc=lK,this.blendDst=QK,this.blendEquation=NE,this.blendSrcAlpha=null,this.blendDstAlpha=null,this.blendEquationAlpha=null,this.blendColor=new wt(0,0,0),this.blendAlpha=0,this.depthFunc=Kd,this.depthTest=!0,this.depthWrite=!0,this.stencilWriteMask=255,this.stencilFunc=NY,this.stencilRef=0,this.stencilFuncMask=255,this.stencilFail=Yh,this.stencilZFail=Yh,this.stencilZPass=Yh,this.stencilWrite=!1,this.clippingPlanes=null,this.clipIntersection=!1,this.clipShadows=!1,this.shadowSide=null,this.colorWrite=!0,this.precision=null,this.polygonOffset=!1,this.polygonOffsetFactor=0,this.polygonOffsetUnits=0,this.dithering=!1,this.alphaToCoverage=!1,this.premultipliedAlpha=!1,this.forceSinglePass=!1,this.allowOverride=!0,this.visible=!0,this.toneMapped=!0,this.userData={},this.version=0,this._alphaTest=0}get alphaTest(){return this._alphaTest}set alphaTest(A){this._alphaTest>0!=A>0&&this.version++,this._alphaTest=A}onBeforeRender(){}onBeforeCompile(){}customProgramCacheKey(){return this.onBeforeCompile.toString()}setValues(A){if(A!==void 0)for(const e in A){const i=A[e];if(i===void 0)continue;const g=this[e];g!==void 0&&(g&&g.isColor?g.set(i):g&&g.isVector3&&i&&i.isVector3?g.copy(i):this[e]=i)}}toJSON(A){const e=A===void 0||typeof A=="string";e&&(A={textures:{},images:{}});const i={metadata:{version:4.7,type:"Material",generator:"Material.toJSON"}};i.uuid=this.uuid,i.type=this.type,this.name!==""&&(i.name=this.name),this.color&&this.color.isColor&&(i.color=this.color.getHex()),this.roughness!==void 0&&(i.roughness=this.roughness),this.metalness!==void 0&&(i.metalness=this.metalness),this.sheen!==void 0&&(i.sheen=this.sheen),this.sheenColor&&this.sheenColor.isColor&&(i.sheenColor=this.sheenColor.getHex()),this.sheenRoughness!==void 0&&(i.sheenRoughness=this.sheenRoughness),this.emissive&&this.emissive.isColor&&(i.emissive=this.emissive.getHex()),this.emissiveIntensity!==void 0&&this.emissiveIntensity!==1&&(i.emissiveIntensity=this.emissiveIntensity),this.specular&&this.specular.isColor&&(i.specular=this.specular.getHex()),this.specularIntensity!==void 0&&(i.specularIntensity=this.specularIntensity),this.specularColor&&this.specularColor.isColor&&(i.specularColor=this.specularColor.getHex()),this.shininess!==void 0&&(i.shininess=this.shininess),this.clearcoat!==void 0&&(i.clearcoat=this.clearcoat),this.clearcoatRoughness!==void 0&&(i.clearcoatRoughness=this.clearcoatRoughness),this.clearcoatMap&&this.clearcoatMap.isTexture&&(i.clearcoatMap=this.clearcoatMap.toJSON(A).uuid),this.clearcoatRoughnessMap&&this.clearcoatRoughnessMap.isTexture&&(i.clearcoatRoughnessMap=this.clearcoatRoughnessMap.toJSON(A).uuid),this.clearcoatNormalMap&&this.clearcoatNormalMap.isTexture&&(i.clearcoatNormalMap=this.clearcoatNormalMap.toJSON(A).uuid,i.clearcoatNormalScale=this.clearcoatNormalScale.toArray()),this.sheenColorMap&&this.sheenColorMap.isTexture&&(i.sheenColorMap=this.sheenColorMap.toJSON(A).uuid),this.sheenRoughnessMap&&this.sheenRoughnessMap.isTexture&&(i.sheenRoughnessMap=this.sheenRoughnessMap.toJSON(A).uuid),this.dispersion!==void 0&&(i.dispersion=this.dispersion),this.iridescence!==void 0&&(i.iridescence=this.iridescence),this.iridescenceIOR!==void 0&&(i.iridescenceIOR=this.iridescenceIOR),this.iridescenceThicknessRange!==void 0&&(i.iridescenceThicknessRange=this.iridescenceThicknessRange),this.iridescenceMap&&this.iridescenceMap.isTexture&&(i.iridescenceMap=this.iridescenceMap.toJSON(A).uuid),this.iridescenceThicknessMap&&this.iridescenceThicknessMap.isTexture&&(i.iridescenceThicknessMap=this.iridescenceThicknessMap.toJSON(A).uuid),this.anisotropy!==void 0&&(i.anisotropy=this.anisotropy),this.anisotropyRotation!==void 0&&(i.anisotropyRotation=this.anisotropyRotation),this.anisotropyMap&&this.anisotropyMap.isTexture&&(i.anisotropyMap=this.anisotropyMap.toJSON(A).uuid),this.map&&this.map.isTexture&&(i.map=this.map.toJSON(A).uuid),this.matcap&&this.matcap.isTexture&&(i.matcap=this.matcap.toJSON(A).uuid),this.alphaMap&&this.alphaMap.isTexture&&(i.alphaMap=this.alphaMap.toJSON(A).uuid),this.lightMap&&this.lightMap.isTexture&&(i.lightMap=this.lightMap.toJSON(A).uuid,i.lightMapIntensity=this.lightMapIntensity),this.aoMap&&this.aoMap.isTexture&&(i.aoMap=this.aoMap.toJSON(A).uuid,i.aoMapIntensity=this.aoMapIntensity),this.bumpMap&&this.bumpMap.isTexture&&(i.bumpMap=this.bumpMap.toJSON(A).uuid,i.bumpScale=this.bumpScale),this.normalMap&&this.normalMap.isTexture&&(i.normalMap=this.normalMap.toJSON(A).uuid,i.normalMapType=this.normalMapType,i.normalScale=this.normalScale.toArray()),this.displacementMap&&this.displacementMap.isTexture&&(i.displacementMap=this.displacementMap.toJSON(A).uuid,i.displacementScale=this.displacementScale,i.displacementBias=this.displacementBias),this.roughnessMap&&this.roughnessMap.isTexture&&(i.roughnessMap=this.roughnessMap.toJSON(A).uuid),this.metalnessMap&&this.metalnessMap.isTexture&&(i.metalnessMap=this.metalnessMap.toJSON(A).uuid),this.emissiveMap&&this.emissiveMap.isTexture&&(i.emissiveMap=this.emissiveMap.toJSON(A).uuid),this.specularMap&&this.specularMap.isTexture&&(i.specularMap=this.specularMap.toJSON(A).uuid),this.specularIntensityMap&&this.specularIntensityMap.isTexture&&(i.specularIntensityMap=this.specularIntensityMap.toJSON(A).uuid),this.specularColorMap&&this.specularColorMap.isTexture&&(i.specularColorMap=this.specularColorMap.toJSON(A).uuid),this.envMap&&this.envMap.isTexture&&(i.envMap=this.envMap.toJSON(A).uuid,this.combine!==void 0&&(i.combine=this.combine)),this.envMapRotation!==void 0&&(i.envMapRotation=this.envMapRotation.toArray()),this.envMapIntensity!==void 0&&(i.envMapIntensity=this.envMapIntensity),this.reflectivity!==void 0&&(i.reflectivity=this.reflectivity),this.refractionRatio!==void 0&&(i.refractionRatio=this.refractionRatio),this.gradientMap&&this.gradientMap.isTexture&&(i.gradientMap=this.gradientMap.toJSON(A).uuid),this.transmission!==void 0&&(i.transmission=this.transmission),this.transmissionMap&&this.transmissionMap.isTexture&&(i.transmissionMap=this.transmissionMap.toJSON(A).uuid),this.thickness!==void 0&&(i.thickness=this.thickness),this.thicknessMap&&this.thicknessMap.isTexture&&(i.thicknessMap=this.thicknessMap.toJSON(A).uuid),this.attenuationDistance!==void 0&&this.attenuationDistance!==1/0&&(i.attenuationDistance=this.attenuationDistance),this.attenuationColor!==void 0&&(i.attenuationColor=this.attenuationColor.getHex()),this.size!==void 0&&(i.size=this.size),this.shadowSide!==null&&(i.shadowSide=this.shadowSide),this.sizeAttenuation!==void 0&&(i.sizeAttenuation=this.sizeAttenuation),this.blending!==Qd&&(i.blending=this.blending),this.side!==jc&&(i.side=this.side),this.vertexColors===!0&&(i.vertexColors=!0),this.opacity<1&&(i.opacity=this.opacity),this.transparent===!0&&(i.transparent=!0),this.blendSrc!==lK&&(i.blendSrc=this.blendSrc),this.blendDst!==QK&&(i.blendDst=this.blendDst),this.blendEquation!==NE&&(i.blendEquation=this.blendEquation),this.blendSrcAlpha!==null&&(i.blendSrcAlpha=this.blendSrcAlpha),this.blendDstAlpha!==null&&(i.blendDstAlpha=this.blendDstAlpha),this.blendEquationAlpha!==null&&(i.blendEquationAlpha=this.blendEquationAlpha),this.blendColor&&this.blendColor.isColor&&(i.blendColor=this.blendColor.getHex()),this.blendAlpha!==0&&(i.blendAlpha=this.blendAlpha),this.depthFunc!==Kd&&(i.depthFunc=this.depthFunc),this.depthTest===!1&&(i.depthTest=this.depthTest),this.depthWrite===!1&&(i.depthWrite=this.depthWrite),this.colorWrite===!1&&(i.colorWrite=this.colorWrite),this.stencilWriteMask!==255&&(i.stencilWriteMask=this.stencilWriteMask),this.stencilFunc!==NY&&(i.stencilFunc=this.stencilFunc),this.stencilRef!==0&&(i.stencilRef=this.stencilRef),this.stencilFuncMask!==255&&(i.stencilFuncMask=this.stencilFuncMask),this.stencilFail!==Yh&&(i.stencilFail=this.stencilFail),this.stencilZFail!==Yh&&(i.stencilZFail=this.stencilZFail),this.stencilZPass!==Yh&&(i.stencilZPass=this.stencilZPass),this.stencilWrite===!0&&(i.stencilWrite=this.stencilWrite),this.rotation!==void 0&&this.rotation!==0&&(i.rotation=this.rotation),this.polygonOffset===!0&&(i.polygonOffset=!0),this.polygonOffsetFactor!==0&&(i.polygonOffsetFactor=this.polygonOffsetFactor),this.polygonOffsetUnits!==0&&(i.polygonOffsetUnits=this.polygonOffsetUnits),this.linewidth!==void 0&&this.linewidth!==1&&(i.linewidth=this.linewidth),this.dashSize!==void 0&&(i.dashSize=this.dashSize),this.gapSize!==void 0&&(i.gapSize=this.gapSize),this.scale!==void 0&&(i.scale=this.scale),this.dithering===!0&&(i.dithering=!0),this.alphaTest>0&&(i.alphaTest=this.alphaTest),this.alphaHash===!0&&(i.alphaHash=!0),this.alphaToCoverage===!0&&(i.alphaToCoverage=!0),this.premultipliedAlpha===!0&&(i.premultipliedAlpha=!0),this.forceSinglePass===!0&&(i.forceSinglePass=!0),this.wireframe===!0&&(i.wireframe=!0),this.wireframeLinewidth>1&&(i.wireframeLinewidth=this.wireframeLinewidth),this.wireframeLinecap!=="round"&&(i.wireframeLinecap=this.wireframeLinecap),this.wireframeLinejoin!=="round"&&(i.wireframeLinejoin=this.wireframeLinejoin),this.flatShading===!0&&(i.flatShading=!0),this.visible===!1&&(i.visible=!1),this.toneMapped===!1&&(i.toneMapped=!1),this.fog===!1&&(i.fog=!1),Object.keys(this.userData).length>0&&(i.userData=this.userData);function g(I){const n=[];for(const o in I){const a=I[o];delete a.metadata,n.push(a)}return n}if(e){const I=g(A.textures),n=g(A.images);I.length>0&&(i.textures=I),n.length>0&&(i.images=n)}return i}clone(){return new this.constructor().copy(this)}copy(A){this.name=A.name,this.blending=A.blending,this.side=A.side,this.vertexColors=A.vertexColors,this.opacity=A.opacity,this.transparent=A.transparent,this.blendSrc=A.blendSrc,this.blendDst=A.blendDst,this.blendEquation=A.blendEquation,this.blendSrcAlpha=A.blendSrcAlpha,this.blendDstAlpha=A.blendDstAlpha,this.blendEquationAlpha=A.blendEquationAlpha,this.blendColor.copy(A.blendColor),this.blendAlpha=A.blendAlpha,this.depthFunc=A.depthFunc,this.depthTest=A.depthTest,this.depthWrite=A.depthWrite,this.stencilWriteMask=A.stencilWriteMask,this.stencilFunc=A.stencilFunc,this.stencilRef=A.stencilRef,this.stencilFuncMask=A.stencilFuncMask,this.stencilFail=A.stencilFail,this.stencilZFail=A.stencilZFail,this.stencilZPass=A.stencilZPass,this.stencilWrite=A.stencilWrite;const e=A.clippingPlanes;let i=null;if(e!==null){const g=e.length;i=new Array(g);for(let I=0;I!==g;++I)i[I]=e[I].clone()}return this.clippingPlanes=i,this.clipIntersection=A.clipIntersection,this.clipShadows=A.clipShadows,this.shadowSide=A.shadowSide,this.colorWrite=A.colorWrite,this.precision=A.precision,this.polygonOffset=A.polygonOffset,this.polygonOffsetFactor=A.polygonOffsetFactor,this.polygonOffsetUnits=A.polygonOffsetUnits,this.dithering=A.dithering,this.alphaTest=A.alphaTest,this.alphaHash=A.alphaHash,this.alphaToCoverage=A.alphaToCoverage,this.premultipliedAlpha=A.premultipliedAlpha,this.forceSinglePass=A.forceSinglePass,this.visible=A.visible,this.toneMapped=A.toneMapped,this.userData=JSON.parse(JSON.stringify(A.userData)),this}dispose(){this.dispatchEvent({type:"dispose"})}set needsUpdate(A){A===!0&&this.version++}}class ls extends Wn{constructor(A){super(),this.isMeshBasicMaterial=!0,this.type="MeshBasicMaterial",this.color=new wt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wo,this.combine=Zk,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}const Vl=kHA();function kHA(){const t=new ArrayBuffer(4),A=new Float32Array(t),e=new Uint32Array(t),i=new Uint32Array(512),g=new Uint32Array(512);for(let a=0;a<256;++a){const r=a-127;r<-27?(i[a]=0,i[a|256]=32768,g[a]=24,g[a|256]=24):r<-14?(i[a]=1024>>-r-14,i[a|256]=1024>>-r-14|32768,g[a]=-r-1,g[a|256]=-r-1):r<=15?(i[a]=r+15<<10,i[a|256]=r+15<<10|32768,g[a]=13,g[a|256]=13):r<128?(i[a]=31744,i[a|256]=64512,g[a]=24,g[a|256]=24):(i[a]=31744,i[a|256]=64512,g[a]=13,g[a|256]=13)}const I=new Uint32Array(2048),n=new Uint32Array(64),o=new Uint32Array(64);for(let a=1;a<1024;++a){let r=a<<13,s=0;for(;(r&8388608)===0;)r<<=1,s-=8388608;r&=-8388609,s+=947912704,I[a]=r|s}for(let a=1024;a<2048;++a)I[a]=939524096+(a-1024<<13);for(let a=1;a<31;++a)n[a]=a<<23;n[31]=1199570944,n[32]=2147483648;for(let a=33;a<63;++a)n[a]=2147483648+(a-32<<23);n[63]=3347054592;for(let a=1;a<64;++a)a!==32&&(o[a]=1024);return{floatView:A,uint32View:e,baseTable:i,shiftTable:g,mantissaTable:I,exponentTable:n,offsetTable:o}}function Dr(t){Math.abs(t)>65504,t=Ci(t,-65504,65504),Vl.floatView[0]=t;const A=Vl.uint32View[0],e=A>>23&511;return Vl.baseTable[e]+((A&8388607)>>Vl.shiftTable[e])}function um(t){const A=t>>10;return Vl.uint32View[0]=Vl.mantissaTable[Vl.offsetTable[A]+(t&1023)]+Vl.exponentTable[A],Vl.floatView[0]}class MHA{static toHalfFloat(A){return Dr(A)}static fromHalfFloat(A){return um(A)}}const Dn=new wA,nG=new Ze;let NHA=0;class eg{constructor(A,e,i=!1){if(Array.isArray(A))throw new TypeError("THREE.BufferAttribute: array should be a Typed Array.");this.isBufferAttribute=!0,Object.defineProperty(this,"id",{value:NHA++}),this.name="",this.array=A,this.itemSize=e,this.count=A!==void 0?A.length/e:0,this.normalized=i,this.usage=Y0,this.updateRanges=[],this.gpuType=ir,this.version=0}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.name=A.name,this.array=new A.array.constructor(A.array),this.itemSize=A.itemSize,this.count=A.count,this.normalized=A.normalized,this.usage=A.usage,this.gpuType=A.gpuType,this}copyAt(A,e,i){A*=this.itemSize,i*=e.itemSize;for(let g=0,I=this.itemSize;g<I;g++)this.array[A+g]=e.array[i+g];return this}copyArray(A){return this.array.set(A),this}applyMatrix3(A){if(this.itemSize===2)for(let e=0,i=this.count;e<i;e++)nG.fromBufferAttribute(this,e),nG.applyMatrix3(A),this.setXY(e,nG.x,nG.y);else if(this.itemSize===3)for(let e=0,i=this.count;e<i;e++)Dn.fromBufferAttribute(this,e),Dn.applyMatrix3(A),this.setXYZ(e,Dn.x,Dn.y,Dn.z);return this}applyMatrix4(A){for(let e=0,i=this.count;e<i;e++)Dn.fromBufferAttribute(this,e),Dn.applyMatrix4(A),this.setXYZ(e,Dn.x,Dn.y,Dn.z);return this}applyNormalMatrix(A){for(let e=0,i=this.count;e<i;e++)Dn.fromBufferAttribute(this,e),Dn.applyNormalMatrix(A),this.setXYZ(e,Dn.x,Dn.y,Dn.z);return this}transformDirection(A){for(let e=0,i=this.count;e<i;e++)Dn.fromBufferAttribute(this,e),Dn.transformDirection(A),this.setXYZ(e,Dn.x,Dn.y,Dn.z);return this}set(A,e=0){return this.array.set(A,e),this}getComponent(A,e){let i=this.array[A*this.itemSize+e];return this.normalized&&(i=$a(i,this.array)),i}setComponent(A,e,i){return this.normalized&&(i=Fi(i,this.array)),this.array[A*this.itemSize+e]=i,this}getX(A){let e=this.array[A*this.itemSize];return this.normalized&&(e=$a(e,this.array)),e}setX(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize]=e,this}getY(A){let e=this.array[A*this.itemSize+1];return this.normalized&&(e=$a(e,this.array)),e}setY(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize+1]=e,this}getZ(A){let e=this.array[A*this.itemSize+2];return this.normalized&&(e=$a(e,this.array)),e}setZ(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize+2]=e,this}getW(A){let e=this.array[A*this.itemSize+3];return this.normalized&&(e=$a(e,this.array)),e}setW(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize+3]=e,this}setXY(A,e,i){return A*=this.itemSize,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array)),this.array[A+0]=e,this.array[A+1]=i,this}setXYZ(A,e,i,g){return A*=this.itemSize,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array),g=Fi(g,this.array)),this.array[A+0]=e,this.array[A+1]=i,this.array[A+2]=g,this}setXYZW(A,e,i,g,I){return A*=this.itemSize,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array),g=Fi(g,this.array),I=Fi(I,this.array)),this.array[A+0]=e,this.array[A+1]=i,this.array[A+2]=g,this.array[A+3]=I,this}onUpload(A){return this.onUploadCallback=A,this}clone(){return new this.constructor(this.array,this.itemSize).copy(this)}toJSON(){const A={itemSize:this.itemSize,type:this.array.constructor.name,array:Array.from(this.array),normalized:this.normalized};return this.name!==""&&(A.name=this.name),this.usage!==Y0&&(A.usage=this.usage),A}}class GHA extends eg{constructor(A,e,i){super(new Int8Array(A),e,i)}}class RHA extends eg{constructor(A,e,i){super(new Uint8Array(A),e,i)}}class UHA extends eg{constructor(A,e,i){super(new Uint8ClampedArray(A),e,i)}}class KHA extends eg{constructor(A,e,i){super(new Int16Array(A),e,i)}}class e1 extends eg{constructor(A,e,i){super(new Uint16Array(A),e,i)}}class FHA extends eg{constructor(A,e,i){super(new Int32Array(A),e,i)}}class t1 extends eg{constructor(A,e,i){super(new Uint32Array(A),e,i)}}class bHA extends eg{constructor(A,e,i){super(new Uint16Array(A),e,i),this.isFloat16BufferAttribute=!0}getX(A){let e=um(this.array[A*this.itemSize]);return this.normalized&&(e=$a(e,this.array)),e}setX(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize]=Dr(e),this}getY(A){let e=um(this.array[A*this.itemSize+1]);return this.normalized&&(e=$a(e,this.array)),e}setY(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize+1]=Dr(e),this}getZ(A){let e=um(this.array[A*this.itemSize+2]);return this.normalized&&(e=$a(e,this.array)),e}setZ(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize+2]=Dr(e),this}getW(A){let e=um(this.array[A*this.itemSize+3]);return this.normalized&&(e=$a(e,this.array)),e}setW(A,e){return this.normalized&&(e=Fi(e,this.array)),this.array[A*this.itemSize+3]=Dr(e),this}setXY(A,e,i){return A*=this.itemSize,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array)),this.array[A+0]=Dr(e),this.array[A+1]=Dr(i),this}setXYZ(A,e,i,g){return A*=this.itemSize,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array),g=Fi(g,this.array)),this.array[A+0]=Dr(e),this.array[A+1]=Dr(i),this.array[A+2]=Dr(g),this}setXYZW(A,e,i,g,I){return A*=this.itemSize,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array),g=Fi(g,this.array),I=Fi(I,this.array)),this.array[A+0]=Dr(e),this.array[A+1]=Dr(i),this.array[A+2]=Dr(g),this.array[A+3]=Dr(I),this}}class bt extends eg{constructor(A,e,i){super(new Float32Array(A),e,i)}}let vHA=0;const Ts=new Ai,sq=new ng,Kf=new wA,is=new Zo,Tw=new Zo,Bo=new wA;class fi extends $c{constructor(){super(),this.isBufferGeometry=!0,Object.defineProperty(this,"id",{value:vHA++}),this.uuid=Qs(),this.name="",this.type="BufferGeometry",this.index=null,this.indirect=null,this.attributes={},this.morphAttributes={},this.morphTargetsRelative=!1,this.groups=[],this.boundingBox=null,this.boundingSphere=null,this.drawRange={start:0,count:1/0},this.userData={}}getIndex(){return this.index}setIndex(A){return Array.isArray(A)?this.index=new(dnA(A)?t1:e1)(A,1):this.index=A,this}setIndirect(A){return this.indirect=A,this}getIndirect(){return this.indirect}getAttribute(A){return this.attributes[A]}setAttribute(A,e){return this.attributes[A]=e,this}deleteAttribute(A){return delete this.attributes[A],this}hasAttribute(A){return this.attributes[A]!==void 0}addGroup(A,e,i=0){this.groups.push({start:A,count:e,materialIndex:i})}clearGroups(){this.groups=[]}setDrawRange(A,e){this.drawRange.start=A,this.drawRange.count=e}applyMatrix4(A){const e=this.attributes.position;e!==void 0&&(e.applyMatrix4(A),e.needsUpdate=!0);const i=this.attributes.normal;if(i!==void 0){const I=new Ni().getNormalMatrix(A);i.applyNormalMatrix(I),i.needsUpdate=!0}const g=this.attributes.tangent;return g!==void 0&&(g.transformDirection(A),g.needsUpdate=!0),this.boundingBox!==null&&this.computeBoundingBox(),this.boundingSphere!==null&&this.computeBoundingSphere(),this}applyQuaternion(A){return Ts.makeRotationFromQuaternion(A),this.applyMatrix4(Ts),this}rotateX(A){return Ts.makeRotationX(A),this.applyMatrix4(Ts),this}rotateY(A){return Ts.makeRotationY(A),this.applyMatrix4(Ts),this}rotateZ(A){return Ts.makeRotationZ(A),this.applyMatrix4(Ts),this}translate(A,e,i){return Ts.makeTranslation(A,e,i),this.applyMatrix4(Ts),this}scale(A,e,i){return Ts.makeScale(A,e,i),this.applyMatrix4(Ts),this}lookAt(A){return sq.lookAt(A),sq.updateMatrix(),this.applyMatrix4(sq.matrix),this}center(){return this.computeBoundingBox(),this.boundingBox.getCenter(Kf).negate(),this.translate(Kf.x,Kf.y,Kf.z),this}setFromPoints(A){const e=this.getAttribute("position");if(e===void 0){const i=[];for(let g=0,I=A.length;g<I;g++){const n=A[g];i.push(n.x,n.y,n.z||0)}this.setAttribute("position",new bt(i,3))}else{const i=Math.min(A.length,e.count);for(let g=0;g<i;g++){const I=A[g];e.setXYZ(g,I.x,I.y,I.z||0)}A.length>e.count,e.needsUpdate=!0}return this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zo);const A=this.attributes.position,e=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){this.boundingBox.set(new wA(-1/0,-1/0,-1/0),new wA(1/0,1/0,1/0));return}if(A!==void 0){if(this.boundingBox.setFromBufferAttribute(A),e)for(let i=0,g=e.length;i<g;i++){const I=e[i];is.setFromBufferAttribute(I),this.morphTargetsRelative?(Bo.addVectors(this.boundingBox.min,is.min),this.boundingBox.expandByPoint(Bo),Bo.addVectors(this.boundingBox.max,is.max),this.boundingBox.expandByPoint(Bo)):(this.boundingBox.expandByPoint(is.min),this.boundingBox.expandByPoint(is.max))}}else this.boundingBox.makeEmpty();isNaN(this.boundingBox.min.x)||isNaN(this.boundingBox.min.y)||isNaN(this.boundingBox.min.z)}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new po);const A=this.attributes.position,e=this.morphAttributes.position;if(A&&A.isGLBufferAttribute){this.boundingSphere.set(new wA,1/0);return}if(A){const i=this.boundingSphere.center;if(is.setFromBufferAttribute(A),e)for(let I=0,n=e.length;I<n;I++){const o=e[I];Tw.setFromBufferAttribute(o),this.morphTargetsRelative?(Bo.addVectors(is.min,Tw.min),is.expandByPoint(Bo),Bo.addVectors(is.max,Tw.max),is.expandByPoint(Bo)):(is.expandByPoint(Tw.min),is.expandByPoint(Tw.max))}is.getCenter(i);let g=0;for(let I=0,n=A.count;I<n;I++)Bo.fromBufferAttribute(A,I),g=Math.max(g,i.distanceToSquared(Bo));if(e)for(let I=0,n=e.length;I<n;I++){const o=e[I],a=this.morphTargetsRelative;for(let r=0,s=o.count;r<s;r++)Bo.fromBufferAttribute(o,r),a&&(Kf.fromBufferAttribute(A,r),Bo.add(Kf)),g=Math.max(g,i.distanceToSquared(Bo))}this.boundingSphere.radius=Math.sqrt(g),isNaN(this.boundingSphere.radius)}}computeTangents(){const A=this.index,e=this.attributes;if(A===null||e.position===void 0||e.normal===void 0||e.uv===void 0)return;const i=e.position,g=e.normal,I=e.uv;this.hasAttribute("tangent")===!1&&this.setAttribute("tangent",new eg(new Float32Array(4*i.count),4));const n=this.getAttribute("tangent"),o=[],a=[];for(let K=0;K<i.count;K++)o[K]=new wA,a[K]=new wA;const r=new wA,s=new wA,B=new wA,c=new Ze,E=new Ze,D=new Ze,y=new wA,S=new wA;function f(K,R,G){r.fromBufferAttribute(i,K),s.fromBufferAttribute(i,R),B.fromBufferAttribute(i,G),c.fromBufferAttribute(I,K),E.fromBufferAttribute(I,R),D.fromBufferAttribute(I,G),s.sub(r),B.sub(r),E.sub(c),D.sub(c);const J=1/(E.x*D.y-D.x*E.y);isFinite(J)&&(y.copy(s).multiplyScalar(D.y).addScaledVector(B,-E.y).multiplyScalar(J),S.copy(B).multiplyScalar(E.x).addScaledVector(s,-D.x).multiplyScalar(J),o[K].add(y),o[R].add(y),o[G].add(y),a[K].add(S),a[R].add(S),a[G].add(S))}let M=this.groups;M.length===0&&(M=[{start:0,count:A.count}]);for(let K=0,R=M.length;K<R;++K){const G=M[K],J=G.start,x=G.count;for(let H=J,P=J+x;H<P;H+=3)f(A.getX(H+0),A.getX(H+1),A.getX(H+2))}const k=new wA,m=new wA,U=new wA,F=new wA;function b(K){U.fromBufferAttribute(g,K),F.copy(U);const R=o[K];k.copy(R),k.sub(U.multiplyScalar(U.dot(R))).normalize(),m.crossVectors(F,R);const J=m.dot(a[K])<0?-1:1;n.setXYZW(K,k.x,k.y,k.z,J)}for(let K=0,R=M.length;K<R;++K){const G=M[K],J=G.start,x=G.count;for(let H=J,P=J+x;H<P;H+=3)b(A.getX(H+0)),b(A.getX(H+1)),b(A.getX(H+2))}}computeVertexNormals(){const A=this.index,e=this.getAttribute("position");if(e!==void 0){let i=this.getAttribute("normal");if(i===void 0)i=new eg(new Float32Array(e.count*3),3),this.setAttribute("normal",i);else for(let c=0,E=i.count;c<E;c++)i.setXYZ(c,0,0,0);const g=new wA,I=new wA,n=new wA,o=new wA,a=new wA,r=new wA,s=new wA,B=new wA;if(A)for(let c=0,E=A.count;c<E;c+=3){const D=A.getX(c+0),y=A.getX(c+1),S=A.getX(c+2);g.fromBufferAttribute(e,D),I.fromBufferAttribute(e,y),n.fromBufferAttribute(e,S),s.subVectors(n,I),B.subVectors(g,I),s.cross(B),o.fromBufferAttribute(i,D),a.fromBufferAttribute(i,y),r.fromBufferAttribute(i,S),o.add(s),a.add(s),r.add(s),i.setXYZ(D,o.x,o.y,o.z),i.setXYZ(y,a.x,a.y,a.z),i.setXYZ(S,r.x,r.y,r.z)}else for(let c=0,E=e.count;c<E;c+=3)g.fromBufferAttribute(e,c+0),I.fromBufferAttribute(e,c+1),n.fromBufferAttribute(e,c+2),s.subVectors(n,I),B.subVectors(g,I),s.cross(B),i.setXYZ(c+0,s.x,s.y,s.z),i.setXYZ(c+1,s.x,s.y,s.z),i.setXYZ(c+2,s.x,s.y,s.z);this.normalizeNormals(),i.needsUpdate=!0}}normalizeNormals(){const A=this.attributes.normal;for(let e=0,i=A.count;e<i;e++)Bo.fromBufferAttribute(A,e),Bo.normalize(),A.setXYZ(e,Bo.x,Bo.y,Bo.z)}toNonIndexed(){function A(o,a){const r=o.array,s=o.itemSize,B=o.normalized,c=new r.constructor(a.length*s);let E=0,D=0;for(let y=0,S=a.length;y<S;y++){o.isInterleavedBufferAttribute?E=a[y]*o.data.stride+o.offset:E=a[y]*s;for(let f=0;f<s;f++)c[D++]=r[E++]}return new eg(c,s,B)}if(this.index===null)return this;const e=new fi,i=this.index.array,g=this.attributes;for(const o in g){const a=g[o],r=A(a,i);e.setAttribute(o,r)}const I=this.morphAttributes;for(const o in I){const a=[],r=I[o];for(let s=0,B=r.length;s<B;s++){const c=r[s],E=A(c,i);a.push(E)}e.morphAttributes[o]=a}e.morphTargetsRelative=this.morphTargetsRelative;const n=this.groups;for(let o=0,a=n.length;o<a;o++){const r=n[o];e.addGroup(r.start,r.count,r.materialIndex)}return e}toJSON(){const A={metadata:{version:4.7,type:"BufferGeometry",generator:"BufferGeometry.toJSON"}};if(A.uuid=this.uuid,A.type=this.type,this.name!==""&&(A.name=this.name),Object.keys(this.userData).length>0&&(A.userData=this.userData),this.parameters!==void 0){const a=this.parameters;for(const r in a)a[r]!==void 0&&(A[r]=a[r]);return A}A.data={attributes:{}};const e=this.index;e!==null&&(A.data.index={type:e.array.constructor.name,array:Array.prototype.slice.call(e.array)});const i=this.attributes;for(const a in i){const r=i[a];A.data.attributes[a]=r.toJSON(A.data)}const g={};let I=!1;for(const a in this.morphAttributes){const r=this.morphAttributes[a],s=[];for(let B=0,c=r.length;B<c;B++){const E=r[B];s.push(E.toJSON(A.data))}s.length>0&&(g[a]=s,I=!0)}I&&(A.data.morphAttributes=g,A.data.morphTargetsRelative=this.morphTargetsRelative);const n=this.groups;n.length>0&&(A.data.groups=JSON.parse(JSON.stringify(n)));const o=this.boundingSphere;return o!==null&&(A.data.boundingSphere=o.toJSON()),A}clone(){return new this.constructor().copy(this)}copy(A){this.index=null,this.attributes={},this.morphAttributes={},this.groups=[],this.boundingBox=null,this.boundingSphere=null;const e={};this.name=A.name;const i=A.index;i!==null&&this.setIndex(i.clone());const g=A.attributes;for(const r in g){const s=g[r];this.setAttribute(r,s.clone(e))}const I=A.morphAttributes;for(const r in I){const s=[],B=I[r];for(let c=0,E=B.length;c<E;c++)s.push(B[c].clone(e));this.morphAttributes[r]=s}this.morphTargetsRelative=A.morphTargetsRelative;const n=A.groups;for(let r=0,s=n.length;r<s;r++){const B=n[r];this.addGroup(B.start,B.count,B.materialIndex)}const o=A.boundingBox;o!==null&&(this.boundingBox=o.clone());const a=A.boundingSphere;return a!==null&&(this.boundingSphere=a.clone()),this.drawRange.start=A.drawRange.start,this.drawRange.count=A.drawRange.count,this.userData=A.userData,this}dispose(){this.dispatchEvent({type:"dispose"})}}const Vz=new Ai,Dh=new eS,oG=new po,Xz=new wA,aG=new wA,rG=new wA,sG=new wA,Cq=new wA,CG=new wA,$z=new wA,BG=new wA;class Cn extends ng{constructor(A=new fi,e=new ls){super(),this.isMesh=!0,this.type="Mesh",this.geometry=A,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.count=1,this.updateMorphTargets()}copy(A,e){return super.copy(A,e),A.morphTargetInfluences!==void 0&&(this.morphTargetInfluences=A.morphTargetInfluences.slice()),A.morphTargetDictionary!==void 0&&(this.morphTargetDictionary=Object.assign({},A.morphTargetDictionary)),this.material=Array.isArray(A.material)?A.material.slice():A.material,this.geometry=A.geometry,this}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const g=e[i[0]];if(g!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let I=0,n=g.length;I<n;I++){const o=g[I].name||String(I);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=I}}}}getVertexPosition(A,e){const i=this.geometry,g=i.attributes.position,I=i.morphAttributes.position,n=i.morphTargetsRelative;e.fromBufferAttribute(g,A);const o=this.morphTargetInfluences;if(I&&o){CG.set(0,0,0);for(let a=0,r=I.length;a<r;a++){const s=o[a],B=I[a];s!==0&&(Cq.fromBufferAttribute(B,A),n?CG.addScaledVector(Cq,s):CG.addScaledVector(Cq.sub(e),s))}e.add(CG)}return e}raycast(A,e){const i=this.geometry,g=this.material,I=this.matrixWorld;g!==void 0&&(i.boundingSphere===null&&i.computeBoundingSphere(),oG.copy(i.boundingSphere),oG.applyMatrix4(I),Dh.copy(A.ray).recast(A.near),!(oG.containsPoint(Dh.origin)===!1&&(Dh.intersectSphere(oG,Xz)===null||Dh.origin.distanceToSquared(Xz)>(A.far-A.near)**2))&&(Vz.copy(I).invert(),Dh.copy(A.ray).applyMatrix4(Vz),!(i.boundingBox!==null&&Dh.intersectsBox(i.boundingBox)===!1)&&this._computeIntersections(A,e,Dh)))}_computeIntersections(A,e,i){let g;const I=this.geometry,n=this.material,o=I.index,a=I.attributes.position,r=I.attributes.uv,s=I.attributes.uv1,B=I.attributes.normal,c=I.groups,E=I.drawRange;if(o!==null)if(Array.isArray(n))for(let D=0,y=c.length;D<y;D++){const S=c[D],f=n[S.materialIndex],M=Math.max(S.start,E.start),k=Math.min(o.count,Math.min(S.start+S.count,E.start+E.count));for(let m=M,U=k;m<U;m+=3){const F=o.getX(m),b=o.getX(m+1),K=o.getX(m+2);g=cG(this,f,A,i,r,s,B,F,b,K),g&&(g.faceIndex=Math.floor(m/3),g.face.materialIndex=S.materialIndex,e.push(g))}}else{const D=Math.max(0,E.start),y=Math.min(o.count,E.start+E.count);for(let S=D,f=y;S<f;S+=3){const M=o.getX(S),k=o.getX(S+1),m=o.getX(S+2);g=cG(this,n,A,i,r,s,B,M,k,m),g&&(g.faceIndex=Math.floor(S/3),e.push(g))}}else if(a!==void 0)if(Array.isArray(n))for(let D=0,y=c.length;D<y;D++){const S=c[D],f=n[S.materialIndex],M=Math.max(S.start,E.start),k=Math.min(a.count,Math.min(S.start+S.count,E.start+E.count));for(let m=M,U=k;m<U;m+=3){const F=m,b=m+1,K=m+2;g=cG(this,f,A,i,r,s,B,F,b,K),g&&(g.faceIndex=Math.floor(m/3),g.face.materialIndex=S.materialIndex,e.push(g))}}else{const D=Math.max(0,E.start),y=Math.min(a.count,E.start+E.count);for(let S=D,f=y;S<f;S+=3){const M=S,k=S+1,m=S+2;g=cG(this,n,A,i,r,s,B,M,k,m),g&&(g.faceIndex=Math.floor(S/3),e.push(g))}}}}function _HA(t,A,e,i,g,I,n,o){let a;if(A.side===Ir?a=i.intersectTriangle(n,I,g,!0,o):a=i.intersectTriangle(g,I,n,A.side===jc,o),a===null)return null;BG.copy(o),BG.applyMatrix4(t.matrixWorld);const r=e.ray.origin.distanceTo(BG);return r<e.near||r>e.far?null:{distance:r,point:BG.clone(),object:t}}function cG(t,A,e,i,g,I,n,o,a,r){t.getVertexPosition(o,aG),t.getVertexPosition(a,rG),t.getVertexPosition(r,sG);const s=_HA(t,A,e,i,aG,rG,sG,$z);if(s){const B=new wA;Mr.getBarycoord($z,aG,rG,sG,B),g&&(s.uv=Mr.getInterpolatedAttribute(g,o,a,r,B,new Ze)),I&&(s.uv1=Mr.getInterpolatedAttribute(I,o,a,r,B,new Ze)),n&&(s.normal=Mr.getInterpolatedAttribute(n,o,a,r,B,new wA),s.normal.dot(i.direction)>0&&s.normal.multiplyScalar(-1));const c={a:o,b:a,c:r,normal:new wA,materialIndex:0};Mr.getNormal(aG,rG,sG,c.normal),s.face=c,s.barycoord=B}return s}class cp extends fi{constructor(A=1,e=1,i=1,g=1,I=1,n=1){super(),this.type="BoxGeometry",this.parameters={width:A,height:e,depth:i,widthSegments:g,heightSegments:I,depthSegments:n};const o=this;g=Math.floor(g),I=Math.floor(I),n=Math.floor(n);const a=[],r=[],s=[],B=[];let c=0,E=0;D("z","y","x",-1,-1,i,e,A,n,I,0),D("z","y","x",1,-1,i,e,-A,n,I,1),D("x","z","y",1,1,A,i,e,g,n,2),D("x","z","y",1,-1,A,i,-e,g,n,3),D("x","y","z",1,-1,A,e,i,g,I,4),D("x","y","z",-1,-1,A,e,-i,g,I,5),this.setIndex(a),this.setAttribute("position",new bt(r,3)),this.setAttribute("normal",new bt(s,3)),this.setAttribute("uv",new bt(B,2));function D(y,S,f,M,k,m,U,F,b,K,R){const G=m/b,J=U/K,x=m/2,H=U/2,P=F/2,j=b+1,q=K+1;let Y=0,O=0;const $=new wA;for(let gA=0;gA<q;gA++){const z=gA*J-H;for(let X=0;X<j;X++){const sA=X*G-x;$[y]=sA*M,$[S]=z*k,$[f]=P,r.push($.x,$.y,$.z),$[y]=0,$[S]=0,$[f]=F>0?1:-1,s.push($.x,$.y,$.z),B.push(X/b),B.push(1-gA/K),Y+=1}}for(let gA=0;gA<K;gA++)for(let z=0;z<b;z++){const X=c+z+j*gA,sA=c+z+j*(gA+1),rA=c+(z+1)+j*(gA+1),mA=c+(z+1)+j*gA;a.push(X,sA,mA),a.push(sA,rA,mA),O+=6}o.addGroup(E,O,R),E+=O,c+=Y}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new cp(A.width,A.height,A.depth,A.widthSegments,A.heightSegments,A.depthSegments)}}function Dy(t){const A={};for(const e in t){A[e]={};for(const i in t[e]){const g=t[e][i];g&&(g.isColor||g.isMatrix3||g.isMatrix4||g.isVector2||g.isVector3||g.isVector4||g.isTexture||g.isQuaternion)?g.isRenderTargetTexture?A[e][i]=null:A[e][i]=g.clone():Array.isArray(g)?A[e][i]=g.slice():A[e][i]=g}}return A}function Pa(t){const A={};for(let e=0;e<t.length;e++){const i=Dy(t[e]);for(const g in i)A[g]=i[g]}return A}function JHA(t){const A=[];for(let e=0;e<t.length;e++)A.push(t[e].clone());return A}function ynA(t){const A=t.getRenderTarget();return A===null?t.outputColorSpace:A.isXRRenderTarget===!0?A.texture.colorSpace:Qg.workingColorSpace}const i1={clone:Dy,merge:Pa};var LHA=`void main() {
	gl_Position = projectionMatrix * modelViewMatrix * vec4( position, 1.0 );
}`,qHA=`void main() {
	gl_FragColor = vec4( 1.0, 0.0, 0.0, 1.0 );
}`;class EC extends Wn{constructor(A){super(),this.isShaderMaterial=!0,this.type="ShaderMaterial",this.defines={},this.uniforms={},this.uniformsGroups=[],this.vertexShader=LHA,this.fragmentShader=qHA,this.linewidth=1,this.wireframe=!1,this.wireframeLinewidth=1,this.fog=!1,this.lights=!1,this.clipping=!1,this.forceSinglePass=!0,this.extensions={clipCullDistance:!1,multiDraw:!1},this.defaultAttributeValues={color:[1,1,1],uv:[0,0],uv1:[0,0]},this.index0AttributeName=void 0,this.uniformsNeedUpdate=!1,this.glslVersion=null,A!==void 0&&this.setValues(A)}copy(A){return super.copy(A),this.fragmentShader=A.fragmentShader,this.vertexShader=A.vertexShader,this.uniforms=Dy(A.uniforms),this.uniformsGroups=JHA(A.uniformsGroups),this.defines=Object.assign({},A.defines),this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.fog=A.fog,this.lights=A.lights,this.clipping=A.clipping,this.extensions=Object.assign({},A.extensions),this.glslVersion=A.glslVersion,this}toJSON(A){const e=super.toJSON(A);e.glslVersion=this.glslVersion,e.uniforms={};for(const g in this.uniforms){const n=this.uniforms[g].value;n&&n.isTexture?e.uniforms[g]={type:"t",value:n.toJSON(A).uuid}:n&&n.isColor?e.uniforms[g]={type:"c",value:n.getHex()}:n&&n.isVector2?e.uniforms[g]={type:"v2",value:n.toArray()}:n&&n.isVector3?e.uniforms[g]={type:"v3",value:n.toArray()}:n&&n.isVector4?e.uniforms[g]={type:"v4",value:n.toArray()}:n&&n.isMatrix3?e.uniforms[g]={type:"m3",value:n.toArray()}:n&&n.isMatrix4?e.uniforms[g]={type:"m4",value:n.toArray()}:e.uniforms[g]={value:n}}Object.keys(this.defines).length>0&&(e.defines=this.defines),e.vertexShader=this.vertexShader,e.fragmentShader=this.fragmentShader,e.lights=this.lights,e.clipping=this.clipping;const i={};for(const g in this.extensions)this.extensions[g]===!0&&(i[g]=!0);return Object.keys(i).length>0&&(e.extensions=i),e}}class Pb extends ng{constructor(){super(),this.isCamera=!0,this.type="Camera",this.matrixWorldInverse=new Ai,this.projectionMatrix=new Ai,this.projectionMatrixInverse=new Ai,this.coordinateSystem=cs,this._reversedDepth=!1}get reversedDepth(){return this._reversedDepth}copy(A,e){return super.copy(A,e),this.matrixWorldInverse.copy(A.matrixWorldInverse),this.projectionMatrix.copy(A.projectionMatrix),this.projectionMatrixInverse.copy(A.projectionMatrixInverse),this.coordinateSystem=A.coordinateSystem,this}getWorldDirection(A){return super.getWorldDirection(A).negate()}updateMatrixWorld(A){super.updateMatrixWorld(A),this.matrixWorldInverse.copy(this.matrixWorld).invert()}updateWorldMatrix(A,e){super.updateWorldMatrix(A,e),this.matrixWorldInverse.copy(this.matrixWorld).invert()}clone(){return new this.constructor().copy(this)}}const hE=new wA,AV=new Ze,eV=new Ze;class jn extends Pb{constructor(A=50,e=1,i=.1,g=2e3){super(),this.isPerspectiveCamera=!0,this.type="PerspectiveCamera",this.fov=A,this.zoom=1,this.near=i,this.far=g,this.focus=10,this.aspect=e,this.view=null,this.filmGauge=35,this.filmOffset=0,this.updateProjectionMatrix()}copy(A,e){return super.copy(A,e),this.fov=A.fov,this.zoom=A.zoom,this.near=A.near,this.far=A.far,this.focus=A.focus,this.aspect=A.aspect,this.view=A.view===null?null:Object.assign({},A.view),this.filmGauge=A.filmGauge,this.filmOffset=A.filmOffset,this}setFocalLength(A){const e=.5*this.getFilmHeight()/A;this.fov=py*2*Math.atan(e),this.updateProjectionMatrix()}getFocalLength(){const A=Math.tan(Ed*.5*this.fov);return .5*this.getFilmHeight()/A}getEffectiveFOV(){return py*2*Math.atan(Math.tan(Ed*.5*this.fov)/this.zoom)}getFilmWidth(){return this.filmGauge*Math.min(this.aspect,1)}getFilmHeight(){return this.filmGauge/Math.max(this.aspect,1)}getViewBounds(A,e,i){hE.set(-1,-1,.5).applyMatrix4(this.projectionMatrixInverse),e.set(hE.x,hE.y).multiplyScalar(-A/hE.z),hE.set(1,1,.5).applyMatrix4(this.projectionMatrixInverse),i.set(hE.x,hE.y).multiplyScalar(-A/hE.z)}getViewSize(A,e){return this.getViewBounds(A,AV,eV),e.subVectors(eV,AV)}setViewOffset(A,e,i,g,I,n){this.aspect=A/e,this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=g,this.view.width=I,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=this.near;let e=A*Math.tan(Ed*.5*this.fov)/this.zoom,i=2*e,g=this.aspect*i,I=-.5*g;const n=this.view;if(this.view!==null&&this.view.enabled){const a=n.fullWidth,r=n.fullHeight;I+=n.offsetX*g/a,e-=n.offsetY*i/r,g*=n.width/a,i*=n.height/r}const o=this.filmOffset;o!==0&&(I+=A*o/this.getFilmWidth()),this.projectionMatrix.makePerspective(I,I+g,e,e-i,A,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const e=super.toJSON(A);return e.object.fov=this.fov,e.object.zoom=this.zoom,e.object.near=this.near,e.object.far=this.far,e.object.focus=this.focus,e.object.aspect=this.aspect,this.view!==null&&(e.object.view=Object.assign({},this.view)),e.object.filmGauge=this.filmGauge,e.object.filmOffset=this.filmOffset,e}}const Ff=-90,bf=1;class SnA extends ng{constructor(A,e,i){super(),this.type="CubeCamera",this.renderTarget=i,this.coordinateSystem=null,this.activeMipmapLevel=0;const g=new jn(Ff,bf,A,e);g.layers=this.layers,this.add(g);const I=new jn(Ff,bf,A,e);I.layers=this.layers,this.add(I);const n=new jn(Ff,bf,A,e);n.layers=this.layers,this.add(n);const o=new jn(Ff,bf,A,e);o.layers=this.layers,this.add(o);const a=new jn(Ff,bf,A,e);a.layers=this.layers,this.add(a);const r=new jn(Ff,bf,A,e);r.layers=this.layers,this.add(r)}updateCoordinateSystem(){const A=this.coordinateSystem,e=this.children.concat(),[i,g,I,n,o,a]=e;for(const r of e)this.remove(r);if(A===cs)i.up.set(0,1,0),i.lookAt(1,0,0),g.up.set(0,1,0),g.lookAt(-1,0,0),I.up.set(0,0,-1),I.lookAt(0,1,0),n.up.set(0,0,1),n.lookAt(0,-1,0),o.up.set(0,1,0),o.lookAt(0,0,1),a.up.set(0,1,0),a.lookAt(0,0,-1);else if(A===dy)i.up.set(0,-1,0),i.lookAt(-1,0,0),g.up.set(0,-1,0),g.lookAt(1,0,0),I.up.set(0,0,1),I.lookAt(0,1,0),n.up.set(0,0,-1),n.lookAt(0,-1,0),o.up.set(0,-1,0),o.lookAt(0,0,1),a.up.set(0,-1,0),a.lookAt(0,0,-1);else throw new Error("THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: "+A);for(const r of e)this.add(r),r.updateMatrixWorld()}update(A,e){this.parent===null&&this.updateMatrixWorld();const{renderTarget:i,activeMipmapLevel:g}=this;this.coordinateSystem!==A.coordinateSystem&&(this.coordinateSystem=A.coordinateSystem,this.updateCoordinateSystem());const[I,n,o,a,r,s]=this.children,B=A.getRenderTarget(),c=A.getActiveCubeFace(),E=A.getActiveMipmapLevel(),D=A.xr.enabled;A.xr.enabled=!1;const y=i.texture.generateMipmaps;i.texture.generateMipmaps=!1,A.setRenderTarget(i,0,g),A.render(e,I),A.setRenderTarget(i,1,g),A.render(e,n),A.setRenderTarget(i,2,g),A.render(e,o),A.setRenderTarget(i,3,g),A.render(e,a),A.setRenderTarget(i,4,g),A.render(e,r),i.texture.generateMipmaps=y,A.setRenderTarget(i,5,g),A.render(e,s),A.setRenderTarget(B,c,E),A.xr.enabled=D,i.texture.needsPMREMUpdate=!0}}class Vk extends FI{constructor(A=[],e=SQ,i,g,I,n,o,a,r,s){super(A,e,i,g,I,n,o,a,r,s),this.isCubeTexture=!0,this.flipY=!1}get images(){return this.image}set images(A){this.image=A}}class wnA extends SB{constructor(A=1,e={}){super(A,A,e),this.isWebGLCubeRenderTarget=!0;const i={width:A,height:A,depth:1},g=[i,i,i,i,i,i];this.texture=new Vk(g),this._setTextureOptions(e),this.texture.isRenderTargetTexture=!0}fromEquirectangularTexture(A,e){this.texture.type=e.type,this.texture.colorSpace=e.colorSpace,this.texture.generateMipmaps=e.generateMipmaps,this.texture.minFilter=e.minFilter,this.texture.magFilter=e.magFilter;const i={uniforms:{tEquirect:{value:null}},vertexShader:`

				varying vec3 vWorldDirection;

				vec3 transformDirection( in vec3 dir, in mat4 matrix ) {

					return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );

				}

				void main() {

					vWorldDirection = transformDirection( position, modelMatrix );

					#include <begin_vertex>
					#include <project_vertex>

				}
			`,fragmentShader:`

				uniform sampler2D tEquirect;

				varying vec3 vWorldDirection;

				#include <common>

				void main() {

					vec3 direction = normalize( vWorldDirection );

					vec2 sampleUV = equirectUv( direction );

					gl_FragColor = texture2D( tEquirect, sampleUV );

				}
			`},g=new cp(5,5,5),I=new EC({name:"CubemapFromEquirect",uniforms:Dy(i.uniforms),vertexShader:i.vertexShader,fragmentShader:i.fragmentShader,side:Ir,blending:oQ});I.uniforms.tEquirect.value=e;const n=new Cn(g,I),o=e.minFilter;return e.minFilter===oC&&(e.minFilter=HI),new SnA(1,10,this).update(A,n),e.minFilter=o,n.geometry.dispose(),n.material.dispose(),this}clear(A,e=!0,i=!0,g=!0){const I=A.getRenderTarget();for(let n=0;n<6;n++)A.setRenderTarget(this,n),A.clear(e,i,g);A.setRenderTarget(I)}}class $l extends ng{constructor(){super(),this.isGroup=!0,this.type="Group"}}const xHA={type:"move"};class zR{constructor(){this._targetRay=null,this._grip=null,this._hand=null}getHandSpace(){return this._hand===null&&(this._hand=new $l,this._hand.matrixAutoUpdate=!1,this._hand.visible=!1,this._hand.joints={},this._hand.inputState={pinching:!1}),this._hand}getTargetRaySpace(){return this._targetRay===null&&(this._targetRay=new $l,this._targetRay.matrixAutoUpdate=!1,this._targetRay.visible=!1,this._targetRay.hasLinearVelocity=!1,this._targetRay.linearVelocity=new wA,this._targetRay.hasAngularVelocity=!1,this._targetRay.angularVelocity=new wA),this._targetRay}getGripSpace(){return this._grip===null&&(this._grip=new $l,this._grip.matrixAutoUpdate=!1,this._grip.visible=!1,this._grip.hasLinearVelocity=!1,this._grip.linearVelocity=new wA,this._grip.hasAngularVelocity=!1,this._grip.angularVelocity=new wA),this._grip}dispatchEvent(A){return this._targetRay!==null&&this._targetRay.dispatchEvent(A),this._grip!==null&&this._grip.dispatchEvent(A),this._hand!==null&&this._hand.dispatchEvent(A),this}connect(A){if(A&&A.hand){const e=this._hand;if(e)for(const i of A.hand.values())this._getHandJoint(e,i)}return this.dispatchEvent({type:"connected",data:A}),this}disconnect(A){return this.dispatchEvent({type:"disconnected",data:A}),this._targetRay!==null&&(this._targetRay.visible=!1),this._grip!==null&&(this._grip.visible=!1),this._hand!==null&&(this._hand.visible=!1),this}update(A,e,i){let g=null,I=null,n=null;const o=this._targetRay,a=this._grip,r=this._hand;if(A&&e.session.visibilityState!=="visible-blurred"){if(r&&A.hand){n=!0;for(const y of A.hand.values()){const S=e.getJointPose(y,i),f=this._getHandJoint(r,y);S!==null&&(f.matrix.fromArray(S.transform.matrix),f.matrix.decompose(f.position,f.rotation,f.scale),f.matrixWorldNeedsUpdate=!0,f.jointRadius=S.radius),f.visible=S!==null}const s=r.joints["index-finger-tip"],B=r.joints["thumb-tip"],c=s.position.distanceTo(B.position),E=.02,D=.005;r.inputState.pinching&&c>E+D?(r.inputState.pinching=!1,this.dispatchEvent({type:"pinchend",handedness:A.handedness,target:this})):!r.inputState.pinching&&c<=E-D&&(r.inputState.pinching=!0,this.dispatchEvent({type:"pinchstart",handedness:A.handedness,target:this}))}else a!==null&&A.gripSpace&&(I=e.getPose(A.gripSpace,i),I!==null&&(a.matrix.fromArray(I.transform.matrix),a.matrix.decompose(a.position,a.rotation,a.scale),a.matrixWorldNeedsUpdate=!0,I.linearVelocity?(a.hasLinearVelocity=!0,a.linearVelocity.copy(I.linearVelocity)):a.hasLinearVelocity=!1,I.angularVelocity?(a.hasAngularVelocity=!0,a.angularVelocity.copy(I.angularVelocity)):a.hasAngularVelocity=!1));o!==null&&(g=e.getPose(A.targetRaySpace,i),g===null&&I!==null&&(g=I),g!==null&&(o.matrix.fromArray(g.transform.matrix),o.matrix.decompose(o.position,o.rotation,o.scale),o.matrixWorldNeedsUpdate=!0,g.linearVelocity?(o.hasLinearVelocity=!0,o.linearVelocity.copy(g.linearVelocity)):o.hasLinearVelocity=!1,g.angularVelocity?(o.hasAngularVelocity=!0,o.angularVelocity.copy(g.angularVelocity)):o.hasAngularVelocity=!1,this.dispatchEvent(xHA)))}return o!==null&&(o.visible=g!==null),a!==null&&(a.visible=I!==null),r!==null&&(r.visible=n!==null),this}_getHandJoint(A,e){if(A.joints[e.jointName]===void 0){const i=new $l;i.matrixAutoUpdate=!1,i.visible=!1,A.joints[e.jointName]=i,A.add(i)}return A.joints[e.jointName]}}class jb{constructor(A,e=25e-5){this.isFogExp2=!0,this.name="",this.color=new wt(A),this.density=e}clone(){return new jb(this.color,this.density)}toJSON(){return{type:"FogExp2",name:this.name,color:this.color.getHex(),density:this.density}}}class Zb{constructor(A,e=1,i=1e3){this.isFog=!0,this.name="",this.color=new wt(A),this.near=e,this.far=i}clone(){return new Zb(this.color,this.near,this.far)}toJSON(){return{type:"Fog",name:this.name,color:this.color.getHex(),near:this.near,far:this.far}}}class g1 extends ng{constructor(){super(),this.isScene=!0,this.type="Scene",this.background=null,this.environment=null,this.fog=null,this.backgroundBlurriness=0,this.backgroundIntensity=1,this.backgroundRotation=new Wo,this.environmentIntensity=1,this.environmentRotation=new Wo,this.overrideMaterial=null,typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}copy(A,e){return super.copy(A,e),A.background!==null&&(this.background=A.background.clone()),A.environment!==null&&(this.environment=A.environment.clone()),A.fog!==null&&(this.fog=A.fog.clone()),this.backgroundBlurriness=A.backgroundBlurriness,this.backgroundIntensity=A.backgroundIntensity,this.backgroundRotation.copy(A.backgroundRotation),this.environmentIntensity=A.environmentIntensity,this.environmentRotation.copy(A.environmentRotation),A.overrideMaterial!==null&&(this.overrideMaterial=A.overrideMaterial.clone()),this.matrixAutoUpdate=A.matrixAutoUpdate,this}toJSON(A){const e=super.toJSON(A);return this.fog!==null&&(e.object.fog=this.fog.toJSON()),this.backgroundBlurriness>0&&(e.object.backgroundBlurriness=this.backgroundBlurriness),this.backgroundIntensity!==1&&(e.object.backgroundIntensity=this.backgroundIntensity),e.object.backgroundRotation=this.backgroundRotation.toArray(),this.environmentIntensity!==1&&(e.object.environmentIntensity=this.environmentIntensity),e.object.environmentRotation=this.environmentRotation.toArray(),e}}class Xk{constructor(A,e){this.isInterleavedBuffer=!0,this.array=A,this.stride=e,this.count=A!==void 0?A.length/e:0,this.usage=Y0,this.updateRanges=[],this.version=0,this.uuid=Qs()}onUploadCallback(){}set needsUpdate(A){A===!0&&this.version++}setUsage(A){return this.usage=A,this}addUpdateRange(A,e){this.updateRanges.push({start:A,count:e})}clearUpdateRanges(){this.updateRanges.length=0}copy(A){return this.array=new A.array.constructor(A.array),this.count=A.count,this.stride=A.stride,this.usage=A.usage,this}copyAt(A,e,i){A*=this.stride,i*=e.stride;for(let g=0,I=this.stride;g<I;g++)this.array[A+g]=e.array[i+g];return this}set(A,e=0){return this.array.set(A,e),this}clone(A){A.arrayBuffers===void 0&&(A.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Qs()),A.arrayBuffers[this.array.buffer._uuid]===void 0&&(A.arrayBuffers[this.array.buffer._uuid]=this.array.slice(0).buffer);const e=new this.array.constructor(A.arrayBuffers[this.array.buffer._uuid]),i=new this.constructor(e,this.stride);return i.setUsage(this.usage),i}onUpload(A){return this.onUploadCallback=A,this}toJSON(A){return A.arrayBuffers===void 0&&(A.arrayBuffers={}),this.array.buffer._uuid===void 0&&(this.array.buffer._uuid=Qs()),A.arrayBuffers[this.array.buffer._uuid]===void 0&&(A.arrayBuffers[this.array.buffer._uuid]=Array.from(new Uint32Array(this.array.buffer))),{uuid:this.uuid,buffer:this.array.buffer._uuid,type:this.array.constructor.name,stride:this.stride}}}const Oa=new wA;class Bu{constructor(A,e,i,g=!1){this.isInterleavedBufferAttribute=!0,this.name="",this.data=A,this.itemSize=e,this.offset=i,this.normalized=g}get count(){return this.data.count}get array(){return this.data.array}set needsUpdate(A){this.data.needsUpdate=A}applyMatrix4(A){for(let e=0,i=this.data.count;e<i;e++)Oa.fromBufferAttribute(this,e),Oa.applyMatrix4(A),this.setXYZ(e,Oa.x,Oa.y,Oa.z);return this}applyNormalMatrix(A){for(let e=0,i=this.count;e<i;e++)Oa.fromBufferAttribute(this,e),Oa.applyNormalMatrix(A),this.setXYZ(e,Oa.x,Oa.y,Oa.z);return this}transformDirection(A){for(let e=0,i=this.count;e<i;e++)Oa.fromBufferAttribute(this,e),Oa.transformDirection(A),this.setXYZ(e,Oa.x,Oa.y,Oa.z);return this}getComponent(A,e){let i=this.array[A*this.data.stride+this.offset+e];return this.normalized&&(i=$a(i,this.array)),i}setComponent(A,e,i){return this.normalized&&(i=Fi(i,this.array)),this.data.array[A*this.data.stride+this.offset+e]=i,this}setX(A,e){return this.normalized&&(e=Fi(e,this.array)),this.data.array[A*this.data.stride+this.offset]=e,this}setY(A,e){return this.normalized&&(e=Fi(e,this.array)),this.data.array[A*this.data.stride+this.offset+1]=e,this}setZ(A,e){return this.normalized&&(e=Fi(e,this.array)),this.data.array[A*this.data.stride+this.offset+2]=e,this}setW(A,e){return this.normalized&&(e=Fi(e,this.array)),this.data.array[A*this.data.stride+this.offset+3]=e,this}getX(A){let e=this.data.array[A*this.data.stride+this.offset];return this.normalized&&(e=$a(e,this.array)),e}getY(A){let e=this.data.array[A*this.data.stride+this.offset+1];return this.normalized&&(e=$a(e,this.array)),e}getZ(A){let e=this.data.array[A*this.data.stride+this.offset+2];return this.normalized&&(e=$a(e,this.array)),e}getW(A){let e=this.data.array[A*this.data.stride+this.offset+3];return this.normalized&&(e=$a(e,this.array)),e}setXY(A,e,i){return A=A*this.data.stride+this.offset,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array)),this.data.array[A+0]=e,this.data.array[A+1]=i,this}setXYZ(A,e,i,g){return A=A*this.data.stride+this.offset,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array),g=Fi(g,this.array)),this.data.array[A+0]=e,this.data.array[A+1]=i,this.data.array[A+2]=g,this}setXYZW(A,e,i,g,I){return A=A*this.data.stride+this.offset,this.normalized&&(e=Fi(e,this.array),i=Fi(i,this.array),g=Fi(g,this.array),I=Fi(I,this.array)),this.data.array[A+0]=e,this.data.array[A+1]=i,this.data.array[A+2]=g,this.data.array[A+3]=I,this}clone(A){if(A===void 0){const e=[];for(let i=0;i<this.count;i++){const g=i*this.data.stride+this.offset;for(let I=0;I<this.itemSize;I++)e.push(this.data.array[g+I])}return new eg(new this.array.constructor(e),this.itemSize,this.normalized)}else return A.interleavedBuffers===void 0&&(A.interleavedBuffers={}),A.interleavedBuffers[this.data.uuid]===void 0&&(A.interleavedBuffers[this.data.uuid]=this.data.clone(A)),new Bu(A.interleavedBuffers[this.data.uuid],this.itemSize,this.offset,this.normalized)}toJSON(A){if(A===void 0){const e=[];for(let i=0;i<this.count;i++){const g=i*this.data.stride+this.offset;for(let I=0;I<this.itemSize;I++)e.push(this.data.array[g+I])}return{itemSize:this.itemSize,type:this.array.constructor.name,array:e,normalized:this.normalized}}else return A.interleavedBuffers===void 0&&(A.interleavedBuffers={}),A.interleavedBuffers[this.data.uuid]===void 0&&(A.interleavedBuffers[this.data.uuid]=this.data.toJSON(A)),{isInterleavedBufferAttribute:!0,itemSize:this.itemSize,data:this.data.uuid,offset:this.offset,normalized:this.normalized}}}class I1 extends Wn{constructor(A){super(),this.isSpriteMaterial=!0,this.type="SpriteMaterial",this.color=new wt(16777215),this.map=null,this.alphaMap=null,this.rotation=0,this.sizeAttenuation=!0,this.transparent=!0,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.alphaMap=A.alphaMap,this.rotation=A.rotation,this.sizeAttenuation=A.sizeAttenuation,this.fog=A.fog,this}}let vf;const Yw=new wA,_f=new wA,Jf=new wA,Lf=new Ze,Hw=new Ze,mnA=new Ai,lG=new wA,Ow=new wA,QG=new wA,tV=new Ze,Bq=new Ze,iV=new Ze;class knA extends ng{constructor(A=new I1){if(super(),this.isSprite=!0,this.type="Sprite",vf===void 0){vf=new fi;const e=new Float32Array([-.5,-.5,0,0,0,.5,-.5,0,1,0,.5,.5,0,1,1,-.5,.5,0,0,1]),i=new Xk(e,5);vf.setIndex([0,1,2,0,2,3]),vf.setAttribute("position",new Bu(i,3,0,!1)),vf.setAttribute("uv",new Bu(i,2,3,!1))}this.geometry=vf,this.material=A,this.center=new Ze(.5,.5),this.count=1}raycast(A,e){A.camera,_f.setFromMatrixScale(this.matrixWorld),mnA.copy(A.camera.matrixWorld),this.modelViewMatrix.multiplyMatrices(A.camera.matrixWorldInverse,this.matrixWorld),Jf.setFromMatrixPosition(this.modelViewMatrix),A.camera.isPerspectiveCamera&&this.material.sizeAttenuation===!1&&_f.multiplyScalar(-Jf.z);const i=this.material.rotation;let g,I;i!==0&&(I=Math.cos(i),g=Math.sin(i));const n=this.center;EG(lG.set(-.5,-.5,0),Jf,n,_f,g,I),EG(Ow.set(.5,-.5,0),Jf,n,_f,g,I),EG(QG.set(.5,.5,0),Jf,n,_f,g,I),tV.set(0,0),Bq.set(1,0),iV.set(1,1);let o=A.ray.intersectTriangle(lG,Ow,QG,!1,Yw);if(o===null&&(EG(Ow.set(-.5,.5,0),Jf,n,_f,g,I),Bq.set(0,1),o=A.ray.intersectTriangle(lG,QG,Ow,!1,Yw),o===null))return;const a=A.ray.origin.distanceTo(Yw);a<A.near||a>A.far||e.push({distance:a,point:Yw.clone(),uv:Mr.getInterpolation(Yw,lG,Ow,QG,tV,Bq,iV,new Ze),face:null,object:this})}copy(A,e){return super.copy(A,e),A.center!==void 0&&this.center.copy(A.center),this.material=A.material,this}}function EG(t,A,e,i,g,I){Lf.subVectors(t,e).addScalar(.5).multiply(i),g!==void 0?(Hw.x=I*Lf.x-g*Lf.y,Hw.y=g*Lf.x+I*Lf.y):Hw.copy(Lf),t.copy(A),t.x+=Hw.x,t.y+=Hw.y,t.applyMatrix4(mnA)}const uG=new wA,gV=new wA;class MnA extends ng{constructor(){super(),this.isLOD=!0,this._currentLevel=0,this.type="LOD",Object.defineProperties(this,{levels:{enumerable:!0,value:[]}}),this.autoUpdate=!0}copy(A){super.copy(A,!1);const e=A.levels;for(let i=0,g=e.length;i<g;i++){const I=e[i];this.addLevel(I.object.clone(),I.distance,I.hysteresis)}return this.autoUpdate=A.autoUpdate,this}addLevel(A,e=0,i=0){e=Math.abs(e);const g=this.levels;let I;for(I=0;I<g.length&&!(e<g[I].distance);I++);return g.splice(I,0,{distance:e,hysteresis:i,object:A}),this.add(A),this}removeLevel(A){const e=this.levels;for(let i=0;i<e.length;i++)if(e[i].distance===A){const g=e.splice(i,1);return this.remove(g[0].object),!0}return!1}getCurrentLevel(){return this._currentLevel}getObjectForDistance(A){const e=this.levels;if(e.length>0){let i,g;for(i=1,g=e.length;i<g;i++){let I=e[i].distance;if(e[i].object.visible&&(I-=I*e[i].hysteresis),A<I)break}return e[i-1].object}return null}raycast(A,e){if(this.levels.length>0){uG.setFromMatrixPosition(this.matrixWorld);const g=A.ray.origin.distanceTo(uG);this.getObjectForDistance(g).raycast(A,e)}}update(A){const e=this.levels;if(e.length>1){uG.setFromMatrixPosition(A.matrixWorld),gV.setFromMatrixPosition(this.matrixWorld);const i=uG.distanceTo(gV)/A.zoom;e[0].object.visible=!0;let g,I;for(g=1,I=e.length;g<I;g++){let n=e[g].distance;if(e[g].object.visible&&(n-=n*e[g].hysteresis),i>=n)e[g-1].object.visible=!1,e[g].object.visible=!0;else break}for(this._currentLevel=g-1;g<I;g++)e[g].object.visible=!1}}toJSON(A){const e=super.toJSON(A);this.autoUpdate===!1&&(e.object.autoUpdate=!1),e.object.levels=[];const i=this.levels;for(let g=0,I=i.length;g<I;g++){const n=i[g];e.object.levels.push({object:n.object.uuid,distance:n.distance,hysteresis:n.hysteresis})}return e}}const IV=new wA,nV=new wg,oV=new wg,THA=new wA,aV=new Ai,hG=new wA,cq=new po,rV=new Ai,lq=new eS;class n1 extends Cn{constructor(A,e){super(A,e),this.isSkinnedMesh=!0,this.type="SkinnedMesh",this.bindMode=MY,this.bindMatrix=new Ai,this.bindMatrixInverse=new Ai,this.boundingBox=null,this.boundingSphere=null}computeBoundingBox(){const A=this.geometry;this.boundingBox===null&&(this.boundingBox=new Zo),this.boundingBox.makeEmpty();const e=A.getAttribute("position");for(let i=0;i<e.count;i++)this.getVertexPosition(i,hG),this.boundingBox.expandByPoint(hG)}computeBoundingSphere(){const A=this.geometry;this.boundingSphere===null&&(this.boundingSphere=new po),this.boundingSphere.makeEmpty();const e=A.getAttribute("position");for(let i=0;i<e.count;i++)this.getVertexPosition(i,hG),this.boundingSphere.expandByPoint(hG)}copy(A,e){return super.copy(A,e),this.bindMode=A.bindMode,this.bindMatrix.copy(A.bindMatrix),this.bindMatrixInverse.copy(A.bindMatrixInverse),this.skeleton=A.skeleton,A.boundingBox!==null&&(this.boundingBox=A.boundingBox.clone()),A.boundingSphere!==null&&(this.boundingSphere=A.boundingSphere.clone()),this}raycast(A,e){const i=this.material,g=this.matrixWorld;i!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),cq.copy(this.boundingSphere),cq.applyMatrix4(g),A.ray.intersectsSphere(cq)!==!1&&(rV.copy(g).invert(),lq.copy(A.ray).applyMatrix4(rV),!(this.boundingBox!==null&&lq.intersectsBox(this.boundingBox)===!1)&&this._computeIntersections(A,e,lq)))}getVertexPosition(A,e){return super.getVertexPosition(A,e),this.applyBoneTransform(A,e),e}bind(A,e){this.skeleton=A,e===void 0&&(this.updateMatrixWorld(!0),this.skeleton.calculateInverses(),e=this.matrixWorld),this.bindMatrix.copy(e),this.bindMatrixInverse.copy(e).invert()}pose(){this.skeleton.pose()}normalizeSkinWeights(){const A=new wg,e=this.geometry.attributes.skinWeight;for(let i=0,g=e.count;i<g;i++){A.fromBufferAttribute(e,i);const I=1/A.manhattanLength();I!==1/0?A.multiplyScalar(I):A.set(1,0,0,0),e.setXYZW(i,A.x,A.y,A.z,A.w)}}updateMatrixWorld(A){super.updateMatrixWorld(A),this.bindMode===MY?this.bindMatrixInverse.copy(this.matrixWorld).invert():this.bindMode===inA&&this.bindMatrixInverse.copy(this.bindMatrix).invert()}applyBoneTransform(A,e){const i=this.skeleton,g=this.geometry;nV.fromBufferAttribute(g.attributes.skinIndex,A),oV.fromBufferAttribute(g.attributes.skinWeight,A),IV.copy(e).applyMatrix4(this.bindMatrix),e.set(0,0,0);for(let I=0;I<4;I++){const n=oV.getComponent(I);if(n!==0){const o=nV.getComponent(I);aV.multiplyMatrices(i.bones[o].matrixWorld,i.boneInverses[o]),e.addScaledVector(THA.copy(IV).applyMatrix4(aV),n)}}return e.applyMatrix4(this.bindMatrixInverse)}}class Wb extends ng{constructor(){super(),this.isBone=!0,this.type="Bone"}}class Yc extends FI{constructor(A=null,e=1,i=1,g,I,n,o,a,r=ho,s=ho,B,c){super(null,n,o,a,r,s,g,I,B,c),this.isDataTexture=!0,this.image={data:A,width:e,height:i},this.generateMipmaps=!1,this.flipY=!1,this.unpackAlignment=1}}const sV=new Ai,YHA=new Ai;class $k{constructor(A=[],e=[]){this.uuid=Qs(),this.bones=A.slice(0),this.boneInverses=e,this.boneMatrices=null,this.boneTexture=null,this.init()}init(){const A=this.bones,e=this.boneInverses;if(this.boneMatrices=new Float32Array(A.length*16),e.length===0)this.calculateInverses();else if(A.length!==e.length){this.boneInverses=[];for(let i=0,g=this.bones.length;i<g;i++)this.boneInverses.push(new Ai)}}calculateInverses(){this.boneInverses.length=0;for(let A=0,e=this.bones.length;A<e;A++){const i=new Ai;this.bones[A]&&i.copy(this.bones[A].matrixWorld).invert(),this.boneInverses.push(i)}}pose(){for(let A=0,e=this.bones.length;A<e;A++){const i=this.bones[A];i&&i.matrixWorld.copy(this.boneInverses[A]).invert()}for(let A=0,e=this.bones.length;A<e;A++){const i=this.bones[A];i&&(i.parent&&i.parent.isBone?(i.matrix.copy(i.parent.matrixWorld).invert(),i.matrix.multiply(i.matrixWorld)):i.matrix.copy(i.matrixWorld),i.matrix.decompose(i.position,i.quaternion,i.scale))}}update(){const A=this.bones,e=this.boneInverses,i=this.boneMatrices,g=this.boneTexture;for(let I=0,n=A.length;I<n;I++){const o=A[I]?A[I].matrixWorld:YHA;sV.multiplyMatrices(o,e[I]),sV.toArray(i,I*16)}g!==null&&(g.needsUpdate=!0)}clone(){return new $k(this.bones,this.boneInverses)}computeBoneTexture(){let A=Math.sqrt(this.bones.length*4);A=Math.ceil(A/4)*4,A=Math.max(A,4);const e=new Float32Array(A*A*4);e.set(this.boneMatrices);const i=new Yc(e,A,A,da,ir);return i.needsUpdate=!0,this.boneMatrices=e,this.boneTexture=i,this}getBoneByName(A){for(let e=0,i=this.bones.length;e<i;e++){const g=this.bones[e];if(g.name===A)return g}}dispose(){this.boneTexture!==null&&(this.boneTexture.dispose(),this.boneTexture=null)}fromJSON(A,e){this.uuid=A.uuid;for(let i=0,g=A.bones.length;i<g;i++){const I=A.bones[i];let n=e[I];n===void 0&&(n=new Wb),this.bones.push(n),this.boneInverses.push(new Ai().fromArray(A.boneInverses[i]))}return this.init(),this}toJSON(){const A={metadata:{version:4.7,type:"Skeleton",generator:"Skeleton.toJSON"},bones:[],boneInverses:[]};A.uuid=this.uuid;const e=this.bones,i=this.boneInverses;for(let g=0,I=e.length;g<I;g++){const n=e[g];A.bones.push(n.uuid);const o=i[g];A.boneInverses.push(o.toArray())}return A}}class Fd extends eg{constructor(A,e,i,g=1){super(A,e,i),this.isInstancedBufferAttribute=!0,this.meshPerAttribute=g}copy(A){return super.copy(A),this.meshPerAttribute=A.meshPerAttribute,this}toJSON(){const A=super.toJSON();return A.meshPerAttribute=this.meshPerAttribute,A.isInstancedBufferAttribute=!0,A}}const qf=new Ai,CV=new Ai,dG=[],BV=new Zo,HHA=new Ai,Pw=new Cn,jw=new po;class o1 extends Cn{constructor(A,e,i){super(A,e),this.isInstancedMesh=!0,this.instanceMatrix=new Fd(new Float32Array(i*16),16),this.instanceColor=null,this.morphTexture=null,this.count=i,this.boundingBox=null,this.boundingSphere=null;for(let g=0;g<i;g++)this.setMatrixAt(g,HHA)}computeBoundingBox(){const A=this.geometry,e=this.count;this.boundingBox===null&&(this.boundingBox=new Zo),A.boundingBox===null&&A.computeBoundingBox(),this.boundingBox.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,qf),BV.copy(A.boundingBox).applyMatrix4(qf),this.boundingBox.union(BV)}computeBoundingSphere(){const A=this.geometry,e=this.count;this.boundingSphere===null&&(this.boundingSphere=new po),A.boundingSphere===null&&A.computeBoundingSphere(),this.boundingSphere.makeEmpty();for(let i=0;i<e;i++)this.getMatrixAt(i,qf),jw.copy(A.boundingSphere).applyMatrix4(qf),this.boundingSphere.union(jw)}copy(A,e){return super.copy(A,e),this.instanceMatrix.copy(A.instanceMatrix),A.morphTexture!==null&&(this.morphTexture=A.morphTexture.clone()),A.instanceColor!==null&&(this.instanceColor=A.instanceColor.clone()),this.count=A.count,A.boundingBox!==null&&(this.boundingBox=A.boundingBox.clone()),A.boundingSphere!==null&&(this.boundingSphere=A.boundingSphere.clone()),this}getColorAt(A,e){e.fromArray(this.instanceColor.array,A*3)}getMatrixAt(A,e){e.fromArray(this.instanceMatrix.array,A*16)}getMorphAt(A,e){const i=e.morphTargetInfluences,g=this.morphTexture.source.data.data,I=i.length+1,n=A*I+1;for(let o=0;o<i.length;o++)i[o]=g[n+o]}raycast(A,e){const i=this.matrixWorld,g=this.count;if(Pw.geometry=this.geometry,Pw.material=this.material,Pw.material!==void 0&&(this.boundingSphere===null&&this.computeBoundingSphere(),jw.copy(this.boundingSphere),jw.applyMatrix4(i),A.ray.intersectsSphere(jw)!==!1))for(let I=0;I<g;I++){this.getMatrixAt(I,qf),CV.multiplyMatrices(i,qf),Pw.matrixWorld=CV,Pw.raycast(A,dG);for(let n=0,o=dG.length;n<o;n++){const a=dG[n];a.instanceId=I,a.object=this,e.push(a)}dG.length=0}}setColorAt(A,e){this.instanceColor===null&&(this.instanceColor=new Fd(new Float32Array(this.instanceMatrix.count*3).fill(1),3)),e.toArray(this.instanceColor.array,A*3)}setMatrixAt(A,e){e.toArray(this.instanceMatrix.array,A*16)}setMorphAt(A,e){const i=e.morphTargetInfluences,g=i.length+1;this.morphTexture===null&&(this.morphTexture=new Yc(new Float32Array(g*this.count),g,this.count,qb,ir));const I=this.morphTexture.source.data.data;let n=0;for(let r=0;r<i.length;r++)n+=i[r];const o=this.geometry.morphTargetsRelative?1:1-n,a=g*A;I[a]=o,I.set(i,a+1)}updateMorphTargets(){}dispose(){this.dispatchEvent({type:"dispose"}),this.morphTexture!==null&&(this.morphTexture.dispose(),this.morphTexture=null)}}const Qq=new wA,OHA=new wA,PHA=new Ni;class mE{constructor(A=new wA(1,0,0),e=0){this.isPlane=!0,this.normal=A,this.constant=e}set(A,e){return this.normal.copy(A),this.constant=e,this}setComponents(A,e,i,g){return this.normal.set(A,e,i),this.constant=g,this}setFromNormalAndCoplanarPoint(A,e){return this.normal.copy(A),this.constant=-e.dot(this.normal),this}setFromCoplanarPoints(A,e,i){const g=Qq.subVectors(i,e).cross(OHA.subVectors(A,e)).normalize();return this.setFromNormalAndCoplanarPoint(g,A),this}copy(A){return this.normal.copy(A.normal),this.constant=A.constant,this}normalize(){const A=1/this.normal.length();return this.normal.multiplyScalar(A),this.constant*=A,this}negate(){return this.constant*=-1,this.normal.negate(),this}distanceToPoint(A){return this.normal.dot(A)+this.constant}distanceToSphere(A){return this.distanceToPoint(A.center)-A.radius}projectPoint(A,e){return e.copy(A).addScaledVector(this.normal,-this.distanceToPoint(A))}intersectLine(A,e){const i=A.delta(Qq),g=this.normal.dot(i);if(g===0)return this.distanceToPoint(A.start)===0?e.copy(A.start):null;const I=-(A.start.dot(this.normal)+this.constant)/g;return I<0||I>1?null:e.copy(A.start).addScaledVector(i,I)}intersectsLine(A){const e=this.distanceToPoint(A.start),i=this.distanceToPoint(A.end);return e<0&&i>0||i<0&&e>0}intersectsBox(A){return A.intersectsPlane(this)}intersectsSphere(A){return A.intersectsPlane(this)}coplanarPoint(A){return A.copy(this.normal).multiplyScalar(-this.constant)}applyMatrix4(A,e){const i=e||PHA.getNormalMatrix(A),g=this.coplanarPoint(Qq).applyMatrix4(A),I=this.normal.applyMatrix3(i).normalize();return this.constant=-g.dot(I),this}translate(A){return this.constant-=A.dot(this.normal),this}equals(A){return A.normal.equals(this.normal)&&A.constant===this.constant}clone(){return new this.constructor().copy(this)}}const yh=new po,jHA=new Ze(.5,.5),pG=new wA;class tS{constructor(A=new mE,e=new mE,i=new mE,g=new mE,I=new mE,n=new mE){this.planes=[A,e,i,g,I,n]}set(A,e,i,g,I,n){const o=this.planes;return o[0].copy(A),o[1].copy(e),o[2].copy(i),o[3].copy(g),o[4].copy(I),o[5].copy(n),this}copy(A){const e=this.planes;for(let i=0;i<6;i++)e[i].copy(A.planes[i]);return this}setFromProjectionMatrix(A,e=cs,i=!1){const g=this.planes,I=A.elements,n=I[0],o=I[1],a=I[2],r=I[3],s=I[4],B=I[5],c=I[6],E=I[7],D=I[8],y=I[9],S=I[10],f=I[11],M=I[12],k=I[13],m=I[14],U=I[15];if(g[0].setComponents(r-n,E-s,f-D,U-M).normalize(),g[1].setComponents(r+n,E+s,f+D,U+M).normalize(),g[2].setComponents(r+o,E+B,f+y,U+k).normalize(),g[3].setComponents(r-o,E-B,f-y,U-k).normalize(),i)g[4].setComponents(a,c,S,m).normalize(),g[5].setComponents(r-a,E-c,f-S,U-m).normalize();else if(g[4].setComponents(r-a,E-c,f-S,U-m).normalize(),e===cs)g[5].setComponents(r+a,E+c,f+S,U+m).normalize();else if(e===dy)g[5].setComponents(a,c,S,m).normalize();else throw new Error("THREE.Frustum.setFromProjectionMatrix(): Invalid coordinate system: "+e);return this}intersectsObject(A){if(A.boundingSphere!==void 0)A.boundingSphere===null&&A.computeBoundingSphere(),yh.copy(A.boundingSphere).applyMatrix4(A.matrixWorld);else{const e=A.geometry;e.boundingSphere===null&&e.computeBoundingSphere(),yh.copy(e.boundingSphere).applyMatrix4(A.matrixWorld)}return this.intersectsSphere(yh)}intersectsSprite(A){yh.center.set(0,0,0);const e=jHA.distanceTo(A.center);return yh.radius=.7071067811865476+e,yh.applyMatrix4(A.matrixWorld),this.intersectsSphere(yh)}intersectsSphere(A){const e=this.planes,i=A.center,g=-A.radius;for(let I=0;I<6;I++)if(e[I].distanceToPoint(i)<g)return!1;return!0}intersectsBox(A){const e=this.planes;for(let i=0;i<6;i++){const g=e[i];if(pG.x=g.normal.x>0?A.max.x:A.min.x,pG.y=g.normal.y>0?A.max.y:A.min.y,pG.z=g.normal.z>0?A.max.z:A.min.z,g.distanceToPoint(pG)<0)return!1}return!0}containsPoint(A){const e=this.planes;for(let i=0;i<6;i++)if(e[i].distanceToPoint(A)<0)return!1;return!0}clone(){return new this.constructor().copy(this)}}const fc=new Ai,Dc=new tS;class zb{constructor(){this.coordinateSystem=cs}intersectsObject(A,e){if(!e.isArrayCamera||e.cameras.length===0)return!1;for(let i=0;i<e.cameras.length;i++){const g=e.cameras[i];if(fc.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),Dc.setFromProjectionMatrix(fc,g.coordinateSystem,g.reversedDepth),Dc.intersectsObject(A))return!0}return!1}intersectsSprite(A,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let i=0;i<e.cameras.length;i++){const g=e.cameras[i];if(fc.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),Dc.setFromProjectionMatrix(fc,g.coordinateSystem,g.reversedDepth),Dc.intersectsSprite(A))return!0}return!1}intersectsSphere(A,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let i=0;i<e.cameras.length;i++){const g=e.cameras[i];if(fc.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),Dc.setFromProjectionMatrix(fc,g.coordinateSystem,g.reversedDepth),Dc.intersectsSphere(A))return!0}return!1}intersectsBox(A,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let i=0;i<e.cameras.length;i++){const g=e.cameras[i];if(fc.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),Dc.setFromProjectionMatrix(fc,g.coordinateSystem,g.reversedDepth),Dc.intersectsBox(A))return!0}return!1}containsPoint(A,e){if(!e||!e.cameras||e.cameras.length===0)return!1;for(let i=0;i<e.cameras.length;i++){const g=e.cameras[i];if(fc.multiplyMatrices(g.projectionMatrix,g.matrixWorldInverse),Dc.setFromProjectionMatrix(fc,g.coordinateSystem,g.reversedDepth),Dc.containsPoint(A))return!0}return!1}clone(){return new zb}}function Eq(t,A){return t-A}function ZHA(t,A){return t.z-A.z}function WHA(t,A){return A.z-t.z}class zHA{constructor(){this.index=0,this.pool=[],this.list=[]}push(A,e,i,g){const I=this.pool,n=this.list;this.index>=I.length&&I.push({start:-1,count:-1,z:-1,index:-1});const o=I[this.index];n.push(o),this.index++,o.start=A,o.count=e,o.z=i,o.index=g}reset(){this.list.length=0,this.index=0}}const dr=new Ai,VHA=new wt(1,1,1),cV=new tS,XHA=new zb,fG=new Zo,Sh=new po,Zw=new wA,lV=new wA,$HA=new wA,uq=new zHA,la=new Cn,DG=[];function AOA(t,A,e=0){const i=A.itemSize;if(t.isInterleavedBufferAttribute||t.array.constructor!==A.array.constructor){const g=t.count;for(let I=0;I<g;I++)for(let n=0;n<i;n++)A.setComponent(I+e,n,t.getComponent(I,n))}else A.array.set(t.array,e*i);A.needsUpdate=!0}function wh(t,A){if(t.constructor!==A.constructor){const e=Math.min(t.length,A.length);for(let i=0;i<e;i++)A[i]=t[i]}else{const e=Math.min(t.length,A.length);A.set(new t.constructor(t.buffer,0,e))}}class NnA extends Cn{constructor(A,e,i=e*2,g){super(new fi,g),this.isBatchedMesh=!0,this.perObjectFrustumCulled=!0,this.sortObjects=!0,this.boundingBox=null,this.boundingSphere=null,this.customSort=null,this._instanceInfo=[],this._geometryInfo=[],this._availableInstanceIds=[],this._availableGeometryIds=[],this._nextIndexStart=0,this._nextVertexStart=0,this._geometryCount=0,this._visibilityChanged=!0,this._geometryInitialized=!1,this._maxInstanceCount=A,this._maxVertexCount=e,this._maxIndexCount=i,this._multiDrawCounts=new Int32Array(A),this._multiDrawStarts=new Int32Array(A),this._multiDrawCount=0,this._multiDrawInstances=null,this._matricesTexture=null,this._indirectTexture=null,this._colorsTexture=null,this._initMatricesTexture(),this._initIndirectTexture()}get maxInstanceCount(){return this._maxInstanceCount}get instanceCount(){return this._instanceInfo.length-this._availableInstanceIds.length}get unusedVertexCount(){return this._maxVertexCount-this._nextVertexStart}get unusedIndexCount(){return this._maxIndexCount-this._nextIndexStart}_initMatricesTexture(){let A=Math.sqrt(this._maxInstanceCount*4);A=Math.ceil(A/4)*4,A=Math.max(A,4);const e=new Float32Array(A*A*4),i=new Yc(e,A,A,da,ir);this._matricesTexture=i}_initIndirectTexture(){let A=Math.sqrt(this._maxInstanceCount);A=Math.ceil(A);const e=new Uint32Array(A*A),i=new Yc(e,A,A,zk,wQ);this._indirectTexture=i}_initColorsTexture(){let A=Math.sqrt(this._maxInstanceCount);A=Math.ceil(A);const e=new Float32Array(A*A*4).fill(1),i=new Yc(e,A,A,da,ir);i.colorSpace=Qg.workingColorSpace,this._colorsTexture=i}_initializeGeometry(A){const e=this.geometry,i=this._maxVertexCount,g=this._maxIndexCount;if(this._geometryInitialized===!1){for(const I in A.attributes){const n=A.getAttribute(I),{array:o,itemSize:a,normalized:r}=n,s=new o.constructor(i*a),B=new eg(s,a,r);e.setAttribute(I,B)}if(A.getIndex()!==null){const I=i>65535?new Uint32Array(g):new Uint16Array(g);e.setIndex(new eg(I,1))}this._geometryInitialized=!0}}_validateGeometry(A){const e=this.geometry;if(!!A.getIndex()!=!!e.getIndex())throw new Error('THREE.BatchedMesh: All geometries must consistently have "index".');for(const i in e.attributes){if(!A.hasAttribute(i))throw new Error(`THREE.BatchedMesh: Added geometry missing "${i}". All geometries must have consistent attributes.`);const g=A.getAttribute(i),I=e.getAttribute(i);if(g.itemSize!==I.itemSize||g.normalized!==I.normalized)throw new Error("THREE.BatchedMesh: All attributes must have a consistent itemSize and normalized value.")}}validateInstanceId(A){const e=this._instanceInfo;if(A<0||A>=e.length||e[A].active===!1)throw new Error(`THREE.BatchedMesh: Invalid instanceId ${A}. Instance is either out of range or has been deleted.`)}validateGeometryId(A){const e=this._geometryInfo;if(A<0||A>=e.length||e[A].active===!1)throw new Error(`THREE.BatchedMesh: Invalid geometryId ${A}. Geometry is either out of range or has been deleted.`)}setCustomSort(A){return this.customSort=A,this}computeBoundingBox(){this.boundingBox===null&&(this.boundingBox=new Zo);const A=this.boundingBox,e=this._instanceInfo;A.makeEmpty();for(let i=0,g=e.length;i<g;i++){if(e[i].active===!1)continue;const I=e[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingBoxAt(I,fG).applyMatrix4(dr),A.union(fG)}}computeBoundingSphere(){this.boundingSphere===null&&(this.boundingSphere=new po);const A=this.boundingSphere,e=this._instanceInfo;A.makeEmpty();for(let i=0,g=e.length;i<g;i++){if(e[i].active===!1)continue;const I=e[i].geometryIndex;this.getMatrixAt(i,dr),this.getBoundingSphereAt(I,Sh).applyMatrix4(dr),A.union(Sh)}}addInstance(A){if(this._instanceInfo.length>=this.maxInstanceCount&&this._availableInstanceIds.length===0)throw new Error("THREE.BatchedMesh: Maximum item count reached.");const i={visible:!0,active:!0,geometryIndex:A};let g=null;this._availableInstanceIds.length>0?(this._availableInstanceIds.sort(Eq),g=this._availableInstanceIds.shift(),this._instanceInfo[g]=i):(g=this._instanceInfo.length,this._instanceInfo.push(i));const I=this._matricesTexture;dr.identity().toArray(I.image.data,g*16),I.needsUpdate=!0;const n=this._colorsTexture;return n&&(VHA.toArray(n.image.data,g*4),n.needsUpdate=!0),this._visibilityChanged=!0,g}addGeometry(A,e=-1,i=-1){this._initializeGeometry(A),this._validateGeometry(A);const g={vertexStart:-1,vertexCount:-1,reservedVertexCount:-1,indexStart:-1,indexCount:-1,reservedIndexCount:-1,start:-1,count:-1,boundingBox:null,boundingSphere:null,active:!0},I=this._geometryInfo;g.vertexStart=this._nextVertexStart,g.reservedVertexCount=e===-1?A.getAttribute("position").count:e;const n=A.getIndex();if(n!==null&&(g.indexStart=this._nextIndexStart,g.reservedIndexCount=i===-1?n.count:i),g.indexStart!==-1&&g.indexStart+g.reservedIndexCount>this._maxIndexCount||g.vertexStart+g.reservedVertexCount>this._maxVertexCount)throw new Error("THREE.BatchedMesh: Reserved space request exceeds the maximum buffer size.");let a;return this._availableGeometryIds.length>0?(this._availableGeometryIds.sort(Eq),a=this._availableGeometryIds.shift(),I[a]=g):(a=this._geometryCount,this._geometryCount++,I.push(g)),this.setGeometryAt(a,A),this._nextIndexStart=g.indexStart+g.reservedIndexCount,this._nextVertexStart=g.vertexStart+g.reservedVertexCount,a}setGeometryAt(A,e){if(A>=this._geometryCount)throw new Error("THREE.BatchedMesh: Maximum geometry count reached.");this._validateGeometry(e);const i=this.geometry,g=i.getIndex()!==null,I=i.getIndex(),n=e.getIndex(),o=this._geometryInfo[A];if(g&&n.count>o.reservedIndexCount||e.attributes.position.count>o.reservedVertexCount)throw new Error("THREE.BatchedMesh: Reserved space not large enough for provided geometry.");const a=o.vertexStart,r=o.reservedVertexCount;o.vertexCount=e.getAttribute("position").count;for(const s in i.attributes){const B=e.getAttribute(s),c=i.getAttribute(s);AOA(B,c,a);const E=B.itemSize;for(let D=B.count,y=r;D<y;D++){const S=a+D;for(let f=0;f<E;f++)c.setComponent(S,f,0)}c.needsUpdate=!0,c.addUpdateRange(a*E,r*E)}if(g){const s=o.indexStart,B=o.reservedIndexCount;o.indexCount=e.getIndex().count;for(let c=0;c<n.count;c++)I.setX(s+c,a+n.getX(c));for(let c=n.count,E=B;c<E;c++)I.setX(s+c,a);I.needsUpdate=!0,I.addUpdateRange(s,o.reservedIndexCount)}return o.start=g?o.indexStart:o.vertexStart,o.count=g?o.indexCount:o.vertexCount,o.boundingBox=null,e.boundingBox!==null&&(o.boundingBox=e.boundingBox.clone()),o.boundingSphere=null,e.boundingSphere!==null&&(o.boundingSphere=e.boundingSphere.clone()),this._visibilityChanged=!0,A}deleteGeometry(A){const e=this._geometryInfo;if(A>=e.length||e[A].active===!1)return this;const i=this._instanceInfo;for(let g=0,I=i.length;g<I;g++)i[g].active&&i[g].geometryIndex===A&&this.deleteInstance(g);return e[A].active=!1,this._availableGeometryIds.push(A),this._visibilityChanged=!0,this}deleteInstance(A){return this.validateInstanceId(A),this._instanceInfo[A].active=!1,this._availableInstanceIds.push(A),this._visibilityChanged=!0,this}optimize(){let A=0,e=0;const i=this._geometryInfo,g=i.map((n,o)=>o).sort((n,o)=>i[n].vertexStart-i[o].vertexStart),I=this.geometry;for(let n=0,o=i.length;n<o;n++){const a=g[n],r=i[a];if(r.active!==!1){if(I.index!==null){if(r.indexStart!==e){const{indexStart:s,vertexStart:B,reservedIndexCount:c}=r,E=I.index,D=E.array,y=A-B;for(let S=s;S<s+c;S++)D[S]=D[S]+y;E.array.copyWithin(e,s,s+c),E.addUpdateRange(e,c),r.indexStart=e}e+=r.reservedIndexCount}if(r.vertexStart!==A){const{vertexStart:s,reservedVertexCount:B}=r,c=I.attributes;for(const E in c){const D=c[E],{array:y,itemSize:S}=D;y.copyWithin(A*S,s*S,(s+B)*S),D.addUpdateRange(A*S,B*S)}r.vertexStart=A}A+=r.reservedVertexCount,r.start=I.index?r.indexStart:r.vertexStart,this._nextIndexStart=I.index?r.indexStart+r.reservedIndexCount:0,this._nextVertexStart=r.vertexStart+r.reservedVertexCount}}return this}getBoundingBoxAt(A,e){if(A>=this._geometryCount)return null;const i=this.geometry,g=this._geometryInfo[A];if(g.boundingBox===null){const I=new Zo,n=i.index,o=i.attributes.position;for(let a=g.start,r=g.start+g.count;a<r;a++){let s=a;n&&(s=n.getX(s)),I.expandByPoint(Zw.fromBufferAttribute(o,s))}g.boundingBox=I}return e.copy(g.boundingBox),e}getBoundingSphereAt(A,e){if(A>=this._geometryCount)return null;const i=this.geometry,g=this._geometryInfo[A];if(g.boundingSphere===null){const I=new po;this.getBoundingBoxAt(A,fG),fG.getCenter(I.center);const n=i.index,o=i.attributes.position;let a=0;for(let r=g.start,s=g.start+g.count;r<s;r++){let B=r;n&&(B=n.getX(B)),Zw.fromBufferAttribute(o,B),a=Math.max(a,I.center.distanceToSquared(Zw))}I.radius=Math.sqrt(a),g.boundingSphere=I}return e.copy(g.boundingSphere),e}setMatrixAt(A,e){this.validateInstanceId(A);const i=this._matricesTexture,g=this._matricesTexture.image.data;return e.toArray(g,A*16),i.needsUpdate=!0,this}getMatrixAt(A,e){return this.validateInstanceId(A),e.fromArray(this._matricesTexture.image.data,A*16)}setColorAt(A,e){return this.validateInstanceId(A),this._colorsTexture===null&&this._initColorsTexture(),e.toArray(this._colorsTexture.image.data,A*4),this._colorsTexture.needsUpdate=!0,this}getColorAt(A,e){return this.validateInstanceId(A),e.fromArray(this._colorsTexture.image.data,A*4)}setVisibleAt(A,e){return this.validateInstanceId(A),this._instanceInfo[A].visible===e?this:(this._instanceInfo[A].visible=e,this._visibilityChanged=!0,this)}getVisibleAt(A){return this.validateInstanceId(A),this._instanceInfo[A].visible}setGeometryIdAt(A,e){return this.validateInstanceId(A),this.validateGeometryId(e),this._instanceInfo[A].geometryIndex=e,this}getGeometryIdAt(A){return this.validateInstanceId(A),this._instanceInfo[A].geometryIndex}getGeometryRangeAt(A,e={}){this.validateGeometryId(A);const i=this._geometryInfo[A];return e.vertexStart=i.vertexStart,e.vertexCount=i.vertexCount,e.reservedVertexCount=i.reservedVertexCount,e.indexStart=i.indexStart,e.indexCount=i.indexCount,e.reservedIndexCount=i.reservedIndexCount,e.start=i.start,e.count=i.count,e}setInstanceCount(A){const e=this._availableInstanceIds,i=this._instanceInfo;for(e.sort(Eq);e[e.length-1]===i.length-1;)i.pop(),e.pop();if(A<i.length)throw new Error(`BatchedMesh: Instance ids outside the range ${A} are being used. Cannot shrink instance count.`);const g=new Int32Array(A),I=new Int32Array(A);wh(this._multiDrawCounts,g),wh(this._multiDrawStarts,I),this._multiDrawCounts=g,this._multiDrawStarts=I,this._maxInstanceCount=A;const n=this._indirectTexture,o=this._matricesTexture,a=this._colorsTexture;n.dispose(),this._initIndirectTexture(),wh(n.image.data,this._indirectTexture.image.data),o.dispose(),this._initMatricesTexture(),wh(o.image.data,this._matricesTexture.image.data),a&&(a.dispose(),this._initColorsTexture(),wh(a.image.data,this._colorsTexture.image.data))}setGeometrySize(A,e){const i=[...this._geometryInfo].filter(o=>o.active);if(Math.max(...i.map(o=>o.vertexStart+o.reservedVertexCount))>A)throw new Error(`BatchedMesh: Geometry vertex values are being used outside the range ${e}. Cannot shrink further.`);if(this.geometry.index&&Math.max(...i.map(a=>a.indexStart+a.reservedIndexCount))>e)throw new Error(`BatchedMesh: Geometry index values are being used outside the range ${e}. Cannot shrink further.`);const I=this.geometry;I.dispose(),this._maxVertexCount=A,this._maxIndexCount=e,this._geometryInitialized&&(this._geometryInitialized=!1,this.geometry=new fi,this._initializeGeometry(I));const n=this.geometry;I.index&&wh(I.index.array,n.index.array);for(const o in I.attributes)wh(I.attributes[o].array,n.attributes[o].array)}raycast(A,e){const i=this._instanceInfo,g=this._geometryInfo,I=this.matrixWorld,n=this.geometry;la.material=this.material,la.geometry.index=n.index,la.geometry.attributes=n.attributes,la.geometry.boundingBox===null&&(la.geometry.boundingBox=new Zo),la.geometry.boundingSphere===null&&(la.geometry.boundingSphere=new po);for(let o=0,a=i.length;o<a;o++){if(!i[o].visible||!i[o].active)continue;const r=i[o].geometryIndex,s=g[r];la.geometry.setDrawRange(s.start,s.count),this.getMatrixAt(o,la.matrixWorld).premultiply(I),this.getBoundingBoxAt(r,la.geometry.boundingBox),this.getBoundingSphereAt(r,la.geometry.boundingSphere),la.raycast(A,DG);for(let B=0,c=DG.length;B<c;B++){const E=DG[B];E.object=this,E.batchId=o,e.push(E)}DG.length=0}la.material=null,la.geometry.index=null,la.geometry.attributes={},la.geometry.setDrawRange(0,1/0)}copy(A){return super.copy(A),this.geometry=A.geometry.clone(),this.perObjectFrustumCulled=A.perObjectFrustumCulled,this.sortObjects=A.sortObjects,this.boundingBox=A.boundingBox!==null?A.boundingBox.clone():null,this.boundingSphere=A.boundingSphere!==null?A.boundingSphere.clone():null,this._geometryInfo=A._geometryInfo.map(e=>({...e,boundingBox:e.boundingBox!==null?e.boundingBox.clone():null,boundingSphere:e.boundingSphere!==null?e.boundingSphere.clone():null})),this._instanceInfo=A._instanceInfo.map(e=>({...e})),this._availableInstanceIds=A._availableInstanceIds.slice(),this._availableGeometryIds=A._availableGeometryIds.slice(),this._nextIndexStart=A._nextIndexStart,this._nextVertexStart=A._nextVertexStart,this._geometryCount=A._geometryCount,this._maxInstanceCount=A._maxInstanceCount,this._maxVertexCount=A._maxVertexCount,this._maxIndexCount=A._maxIndexCount,this._geometryInitialized=A._geometryInitialized,this._multiDrawCounts=A._multiDrawCounts.slice(),this._multiDrawStarts=A._multiDrawStarts.slice(),this._indirectTexture=A._indirectTexture.clone(),this._indirectTexture.image.data=this._indirectTexture.image.data.slice(),this._matricesTexture=A._matricesTexture.clone(),this._matricesTexture.image.data=this._matricesTexture.image.data.slice(),this._colorsTexture!==null&&(this._colorsTexture=A._colorsTexture.clone(),this._colorsTexture.image.data=this._colorsTexture.image.data.slice()),this}dispose(){this.geometry.dispose(),this._matricesTexture.dispose(),this._matricesTexture=null,this._indirectTexture.dispose(),this._indirectTexture=null,this._colorsTexture!==null&&(this._colorsTexture.dispose(),this._colorsTexture=null)}onBeforeRender(A,e,i,g,I){if(!this._visibilityChanged&&!this.perObjectFrustumCulled&&!this.sortObjects)return;const n=g.getIndex(),o=n===null?1:n.array.BYTES_PER_ELEMENT,a=this._instanceInfo,r=this._multiDrawStarts,s=this._multiDrawCounts,B=this._geometryInfo,c=this.perObjectFrustumCulled,E=this._indirectTexture,D=E.image.data,y=i.isArrayCamera?XHA:cV;c&&!i.isArrayCamera&&(dr.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse).multiply(this.matrixWorld),cV.setFromProjectionMatrix(dr,i.coordinateSystem,i.reversedDepth));let S=0;if(this.sortObjects){dr.copy(this.matrixWorld).invert(),Zw.setFromMatrixPosition(i.matrixWorld).applyMatrix4(dr),lV.set(0,0,-1).transformDirection(i.matrixWorld).transformDirection(dr);for(let k=0,m=a.length;k<m;k++)if(a[k].visible&&a[k].active){const U=a[k].geometryIndex;this.getMatrixAt(k,dr),this.getBoundingSphereAt(U,Sh).applyMatrix4(dr);let F=!1;if(c&&(F=!y.intersectsSphere(Sh,i)),!F){const b=B[U],K=$HA.subVectors(Sh.center,Zw).dot(lV);uq.push(b.start,b.count,K,k)}}const f=uq.list,M=this.customSort;M===null?f.sort(I.transparent?WHA:ZHA):M.call(this,f,i);for(let k=0,m=f.length;k<m;k++){const U=f[k];r[S]=U.start*o,s[S]=U.count,D[S]=U.index,S++}uq.reset()}else for(let f=0,M=a.length;f<M;f++)if(a[f].visible&&a[f].active){const k=a[f].geometryIndex;let m=!1;if(c&&(this.getMatrixAt(f,dr),this.getBoundingSphereAt(k,Sh).applyMatrix4(dr),m=!y.intersectsSphere(Sh,i)),!m){const U=B[k];r[S]=U.start*o,s[S]=U.count,D[S]=f,S++}}E.needsUpdate=!0,this._multiDrawCount=S,this._visibilityChanged=!1}onBeforeShadow(A,e,i,g,I,n){this.onBeforeRender(A,null,g,I,n)}}class ya extends Wn{constructor(A){super(),this.isLineBasicMaterial=!0,this.type="LineBasicMaterial",this.color=new wt(16777215),this.map=null,this.linewidth=1,this.linecap="round",this.linejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.linewidth=A.linewidth,this.linecap=A.linecap,this.linejoin=A.linejoin,this.fog=A.fog,this}}const XK=new wA,$K=new wA,QV=new Ai,Ww=new eS,yG=new po,hq=new wA,EV=new wA;class mQ extends ng{constructor(A=new fi,e=new ya){super(),this.isLine=!0,this.type="Line",this.geometry=A,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(A,e){return super.copy(A,e),this.material=Array.isArray(A.material)?A.material.slice():A.material,this.geometry=A.geometry,this}computeLineDistances(){const A=this.geometry;if(A.index===null){const e=A.attributes.position,i=[0];for(let g=1,I=e.count;g<I;g++)XK.fromBufferAttribute(e,g-1),$K.fromBufferAttribute(e,g),i[g]=i[g-1],i[g]+=XK.distanceTo($K);A.setAttribute("lineDistance",new bt(i,1))}return this}raycast(A,e){const i=this.geometry,g=this.matrixWorld,I=A.params.Line.threshold,n=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),yG.copy(i.boundingSphere),yG.applyMatrix4(g),yG.radius+=I,A.ray.intersectsSphere(yG)===!1)return;QV.copy(g).invert(),Ww.copy(A.ray).applyMatrix4(QV);const o=I/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,r=this.isLineSegments?2:1,s=i.index,c=i.attributes.position;if(s!==null){const E=Math.max(0,n.start),D=Math.min(s.count,n.start+n.count);for(let y=E,S=D-1;y<S;y+=r){const f=s.getX(y),M=s.getX(y+1),k=SG(this,A,Ww,a,f,M,y);k&&e.push(k)}if(this.isLineLoop){const y=s.getX(D-1),S=s.getX(E),f=SG(this,A,Ww,a,y,S,D-1);f&&e.push(f)}}else{const E=Math.max(0,n.start),D=Math.min(c.count,n.start+n.count);for(let y=E,S=D-1;y<S;y+=r){const f=SG(this,A,Ww,a,y,y+1,y);f&&e.push(f)}if(this.isLineLoop){const y=SG(this,A,Ww,a,D-1,E,D-1);y&&e.push(y)}}}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const g=e[i[0]];if(g!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let I=0,n=g.length;I<n;I++){const o=g[I].name||String(I);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=I}}}}}function SG(t,A,e,i,g,I,n){const o=t.geometry.attributes.position;if(XK.fromBufferAttribute(o,g),$K.fromBufferAttribute(o,I),e.distanceSqToSegment(XK,$K,hq,EV)>i)return;hq.applyMatrix4(t.matrixWorld);const r=A.ray.origin.distanceTo(hq);if(!(r<A.near||r>A.far))return{distance:r,point:EV.clone().applyMatrix4(t.matrixWorld),index:n,face:null,faceIndex:null,barycoord:null,object:t}}const uV=new wA,hV=new wA;class RB extends mQ{constructor(A,e){super(A,e),this.isLineSegments=!0,this.type="LineSegments"}computeLineDistances(){const A=this.geometry;if(A.index===null){const e=A.attributes.position,i=[];for(let g=0,I=e.count;g<I;g+=2)uV.fromBufferAttribute(e,g),hV.fromBufferAttribute(e,g+1),i[g]=g===0?0:i[g-1],i[g+1]=i[g]+uV.distanceTo(hV);A.setAttribute("lineDistance",new bt(i,1))}return this}}class a1 extends mQ{constructor(A,e){super(A,e),this.isLineLoop=!0,this.type="LineLoop"}}class Vb extends Wn{constructor(A){super(),this.isPointsMaterial=!0,this.type="PointsMaterial",this.color=new wt(16777215),this.map=null,this.alphaMap=null,this.size=1,this.sizeAttenuation=!0,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.alphaMap=A.alphaMap,this.size=A.size,this.sizeAttenuation=A.sizeAttenuation,this.fog=A.fog,this}}const dV=new Ai,RY=new eS,wG=new po,mG=new wA;class r1 extends ng{constructor(A=new fi,e=new Vb){super(),this.isPoints=!0,this.type="Points",this.geometry=A,this.material=e,this.morphTargetDictionary=void 0,this.morphTargetInfluences=void 0,this.updateMorphTargets()}copy(A,e){return super.copy(A,e),this.material=Array.isArray(A.material)?A.material.slice():A.material,this.geometry=A.geometry,this}raycast(A,e){const i=this.geometry,g=this.matrixWorld,I=A.params.Points.threshold,n=i.drawRange;if(i.boundingSphere===null&&i.computeBoundingSphere(),wG.copy(i.boundingSphere),wG.applyMatrix4(g),wG.radius+=I,A.ray.intersectsSphere(wG)===!1)return;dV.copy(g).invert(),RY.copy(A.ray).applyMatrix4(dV);const o=I/((this.scale.x+this.scale.y+this.scale.z)/3),a=o*o,r=i.index,B=i.attributes.position;if(r!==null){const c=Math.max(0,n.start),E=Math.min(r.count,n.start+n.count);for(let D=c,y=E;D<y;D++){const S=r.getX(D);mG.fromBufferAttribute(B,S),pV(mG,S,a,g,A,e,this)}}else{const c=Math.max(0,n.start),E=Math.min(B.count,n.start+n.count);for(let D=c,y=E;D<y;D++)mG.fromBufferAttribute(B,D),pV(mG,D,a,g,A,e,this)}}updateMorphTargets(){const e=this.geometry.morphAttributes,i=Object.keys(e);if(i.length>0){const g=e[i[0]];if(g!==void 0){this.morphTargetInfluences=[],this.morphTargetDictionary={};for(let I=0,n=g.length;I<n;I++){const o=g[I].name||String(I);this.morphTargetInfluences.push(0),this.morphTargetDictionary[o]=I}}}}}function pV(t,A,e,i,g,I,n){const o=RY.distanceSqToPoint(t);if(o<e){const a=new wA;RY.closestPointToPoint(t,a),a.applyMatrix4(i);const r=g.ray.origin.distanceTo(a);if(r<g.near||r>g.far)return;I.push({distance:r,distanceToRay:Math.sqrt(o),point:a,index:A,face:null,faceIndex:null,barycoord:null,object:n})}}class GnA extends FI{constructor(A,e,i,g,I=HI,n=HI,o,a,r){super(A,e,i,g,I,n,o,a,r),this.isVideoTexture=!0,this.generateMipmaps=!1,this._requestVideoFrameCallbackId=0;const s=this;function B(){s.needsUpdate=!0,s._requestVideoFrameCallbackId=A.requestVideoFrameCallback(B)}"requestVideoFrameCallback"in A&&(this._requestVideoFrameCallbackId=A.requestVideoFrameCallback(B))}clone(){return new this.constructor(this.image).copy(this)}update(){const A=this.image;"requestVideoFrameCallback"in A===!1&&A.readyState>=A.HAVE_CURRENT_DATA&&(this.needsUpdate=!0)}dispose(){this._requestVideoFrameCallbackId!==0&&this.source.data.cancelVideoFrameCallback(this._requestVideoFrameCallbackId),super.dispose()}}class eOA extends GnA{constructor(A,e,i,g,I,n,o,a){super({},A,e,i,g,I,n,o,a),this.isVideoFrameTexture=!0}update(){}clone(){return new this.constructor().copy(this)}setFrame(A){this.image=A,this.needsUpdate=!0}}class tOA extends FI{constructor(A,e){super({width:A,height:e}),this.isFramebufferTexture=!0,this.magFilter=ho,this.minFilter=ho,this.generateMipmaps=!1,this.needsUpdate=!0}}class Xb extends FI{constructor(A,e,i,g,I,n,o,a,r,s,B,c){super(null,n,o,a,r,s,g,I,B,c),this.isCompressedTexture=!0,this.image={width:e,height:i},this.mipmaps=A,this.flipY=!1,this.generateMipmaps=!1}}class iOA extends Xb{constructor(A,e,i,g,I,n){super(A,e,i,I,n),this.isCompressedArrayTexture=!0,this.image.depth=g,this.wrapR=Bs,this.layerUpdates=new Set}addLayerUpdate(A){this.layerUpdates.add(A)}clearLayerUpdates(){this.layerUpdates.clear()}}class gOA extends Xb{constructor(A,e,i){super(void 0,A[0].width,A[0].height,e,i,SQ),this.isCompressedCubeTexture=!0,this.isCubeTexture=!0,this.image=A}}class IOA extends FI{constructor(A,e,i,g,I,n,o,a,r){super(A,e,i,g,I,n,o,a,r),this.isCanvasTexture=!0,this.needsUpdate=!0}}class $b extends FI{constructor(A,e,i=wQ,g,I,n,o=ho,a=ho,r,s=Qy,B=1){if(s!==Qy&&s!==Ey)throw new Error("DepthTexture format must be either THREE.DepthFormat or THREE.DepthStencilFormat");const c={width:A,height:e,depth:B};super(c,g,I,n,o,a,s,i,r),this.isDepthTexture=!0,this.flipY=!1,this.generateMipmaps=!1,this.compareFunction=null}copy(A){return super.copy(A),this.source=new bE(Object.assign({},A.image)),this.compareFunction=A.compareFunction,this}toJSON(A){const e=super.toJSON(A);return this.compareFunction!==null&&(e.compareFunction=this.compareFunction),e}}class s1 extends FI{constructor(A=null){super(),this.sourceTexture=A,this.isExternalTexture=!0}copy(A){return super.copy(A),this.sourceTexture=A.sourceTexture,this}}class Av extends fi{constructor(A=1,e=1,i=4,g=8,I=1){super(),this.type="CapsuleGeometry",this.parameters={radius:A,height:e,capSegments:i,radialSegments:g,heightSegments:I},e=Math.max(0,e),i=Math.max(1,Math.floor(i)),g=Math.max(3,Math.floor(g)),I=Math.max(1,Math.floor(I));const n=[],o=[],a=[],r=[],s=e/2,B=Math.PI/2*A,c=e,E=2*B+c,D=i*2+I,y=g+1,S=new wA,f=new wA;for(let M=0;M<=D;M++){let k=0,m=0,U=0,F=0;if(M<=i){const R=M/i,G=R*Math.PI/2;m=-s-A*Math.cos(G),U=A*Math.sin(G),F=-A*Math.cos(G),k=R*B}else if(M<=i+I){const R=(M-i)/I;m=-s+R*e,U=A,F=0,k=B+R*c}else{const R=(M-i-I)/i,G=R*Math.PI/2;m=s+A*Math.sin(G),U=A*Math.cos(G),F=A*Math.sin(G),k=B+c+R*B}const b=Math.max(0,Math.min(1,k/E));let K=0;M===0?K=.5/g:M===D&&(K=-.5/g);for(let R=0;R<=g;R++){const G=R/g,J=G*Math.PI*2,x=Math.sin(J),H=Math.cos(J);f.x=-U*H,f.y=m,f.z=U*x,o.push(f.x,f.y,f.z),S.set(-U*H,F,U*x),S.normalize(),a.push(S.x,S.y,S.z),r.push(G+K,b)}if(M>0){const R=(M-1)*y;for(let G=0;G<g;G++){const J=R+G,x=R+G+1,H=M*y+G,P=M*y+G+1;n.push(J,x,H),n.push(x,P,H)}}}this.setIndex(n),this.setAttribute("position",new bt(o,3)),this.setAttribute("normal",new bt(a,3)),this.setAttribute("uv",new bt(r,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new Av(A.radius,A.height,A.capSegments,A.radialSegments,A.heightSegments)}}class ev extends fi{constructor(A=1,e=32,i=0,g=Math.PI*2){super(),this.type="CircleGeometry",this.parameters={radius:A,segments:e,thetaStart:i,thetaLength:g},e=Math.max(3,e);const I=[],n=[],o=[],a=[],r=new wA,s=new Ze;n.push(0,0,0),o.push(0,0,1),a.push(.5,.5);for(let B=0,c=3;B<=e;B++,c+=3){const E=i+B/e*g;r.x=A*Math.cos(E),r.y=A*Math.sin(E),n.push(r.x,r.y,r.z),o.push(0,0,1),s.x=(n[c]/A+1)/2,s.y=(n[c+1]/A+1)/2,a.push(s.x,s.y)}for(let B=1;B<=e;B++)I.push(B,B+1,0);this.setIndex(I),this.setAttribute("position",new bt(n,3)),this.setAttribute("normal",new bt(o,3)),this.setAttribute("uv",new bt(a,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new ev(A.radius,A.segments,A.thetaStart,A.thetaLength)}}class AM extends fi{constructor(A=1,e=1,i=1,g=32,I=1,n=!1,o=0,a=Math.PI*2){super(),this.type="CylinderGeometry",this.parameters={radiusTop:A,radiusBottom:e,height:i,radialSegments:g,heightSegments:I,openEnded:n,thetaStart:o,thetaLength:a};const r=this;g=Math.floor(g),I=Math.floor(I);const s=[],B=[],c=[],E=[];let D=0;const y=[],S=i/2;let f=0;M(),n===!1&&(A>0&&k(!0),e>0&&k(!1)),this.setIndex(s),this.setAttribute("position",new bt(B,3)),this.setAttribute("normal",new bt(c,3)),this.setAttribute("uv",new bt(E,2));function M(){const m=new wA,U=new wA;let F=0;const b=(e-A)/i;for(let K=0;K<=I;K++){const R=[],G=K/I,J=G*(e-A)+A;for(let x=0;x<=g;x++){const H=x/g,P=H*a+o,j=Math.sin(P),q=Math.cos(P);U.x=J*j,U.y=-G*i+S,U.z=J*q,B.push(U.x,U.y,U.z),m.set(j,b,q).normalize(),c.push(m.x,m.y,m.z),E.push(H,1-G),R.push(D++)}y.push(R)}for(let K=0;K<g;K++)for(let R=0;R<I;R++){const G=y[R][K],J=y[R+1][K],x=y[R+1][K+1],H=y[R][K+1];(A>0||R!==0)&&(s.push(G,J,H),F+=3),(e>0||R!==I-1)&&(s.push(J,x,H),F+=3)}r.addGroup(f,F,0),f+=F}function k(m){const U=D,F=new Ze,b=new wA;let K=0;const R=m===!0?A:e,G=m===!0?1:-1;for(let x=1;x<=g;x++)B.push(0,S*G,0),c.push(0,G,0),E.push(.5,.5),D++;const J=D;for(let x=0;x<=g;x++){const P=x/g*a+o,j=Math.cos(P),q=Math.sin(P);b.x=R*q,b.y=S*G,b.z=R*j,B.push(b.x,b.y,b.z),c.push(0,G,0),F.x=j*.5+.5,F.y=q*.5*G+.5,E.push(F.x,F.y),D++}for(let x=0;x<g;x++){const H=U+x,P=J+x;m===!0?s.push(P,P+1,H):s.push(P+1,P,H),K+=3}r.addGroup(f,K,m===!0?1:2),f+=K}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new AM(A.radiusTop,A.radiusBottom,A.height,A.radialSegments,A.heightSegments,A.openEnded,A.thetaStart,A.thetaLength)}}class eM extends AM{constructor(A=1,e=1,i=32,g=1,I=!1,n=0,o=Math.PI*2){super(0,A,e,i,g,I,n,o),this.type="ConeGeometry",this.parameters={radius:A,height:e,radialSegments:i,heightSegments:g,openEnded:I,thetaStart:n,thetaLength:o}}static fromJSON(A){return new eM(A.radius,A.height,A.radialSegments,A.heightSegments,A.openEnded,A.thetaStart,A.thetaLength)}}class mu extends fi{constructor(A=[],e=[],i=1,g=0){super(),this.type="PolyhedronGeometry",this.parameters={vertices:A,indices:e,radius:i,detail:g};const I=[],n=[];o(g),r(i),s(),this.setAttribute("position",new bt(I,3)),this.setAttribute("normal",new bt(I.slice(),3)),this.setAttribute("uv",new bt(n,2)),g===0?this.computeVertexNormals():this.normalizeNormals();function o(M){const k=new wA,m=new wA,U=new wA;for(let F=0;F<e.length;F+=3)E(e[F+0],k),E(e[F+1],m),E(e[F+2],U),a(k,m,U,M)}function a(M,k,m,U){const F=U+1,b=[];for(let K=0;K<=F;K++){b[K]=[];const R=M.clone().lerp(m,K/F),G=k.clone().lerp(m,K/F),J=F-K;for(let x=0;x<=J;x++)x===0&&K===F?b[K][x]=R:b[K][x]=R.clone().lerp(G,x/J)}for(let K=0;K<F;K++)for(let R=0;R<2*(F-K)-1;R++){const G=Math.floor(R/2);R%2===0?(c(b[K][G+1]),c(b[K+1][G]),c(b[K][G])):(c(b[K][G+1]),c(b[K+1][G+1]),c(b[K+1][G]))}}function r(M){const k=new wA;for(let m=0;m<I.length;m+=3)k.x=I[m+0],k.y=I[m+1],k.z=I[m+2],k.normalize().multiplyScalar(M),I[m+0]=k.x,I[m+1]=k.y,I[m+2]=k.z}function s(){const M=new wA;for(let k=0;k<I.length;k+=3){M.x=I[k+0],M.y=I[k+1],M.z=I[k+2];const m=S(M)/2/Math.PI+.5,U=f(M)/Math.PI+.5;n.push(m,1-U)}D(),B()}function B(){for(let M=0;M<n.length;M+=6){const k=n[M+0],m=n[M+2],U=n[M+4],F=Math.max(k,m,U),b=Math.min(k,m,U);F>.9&&b<.1&&(k<.2&&(n[M+0]+=1),m<.2&&(n[M+2]+=1),U<.2&&(n[M+4]+=1))}}function c(M){I.push(M.x,M.y,M.z)}function E(M,k){const m=M*3;k.x=A[m+0],k.y=A[m+1],k.z=A[m+2]}function D(){const M=new wA,k=new wA,m=new wA,U=new wA,F=new Ze,b=new Ze,K=new Ze;for(let R=0,G=0;R<I.length;R+=9,G+=6){M.set(I[R+0],I[R+1],I[R+2]),k.set(I[R+3],I[R+4],I[R+5]),m.set(I[R+6],I[R+7],I[R+8]),F.set(n[G+0],n[G+1]),b.set(n[G+2],n[G+3]),K.set(n[G+4],n[G+5]),U.copy(M).add(k).add(m).divideScalar(3);const J=S(U);y(F,G+0,M,J),y(b,G+2,k,J),y(K,G+4,m,J)}}function y(M,k,m,U){U<0&&M.x===1&&(n[k]=M.x-1),m.x===0&&m.z===0&&(n[k]=U/2/Math.PI+.5)}function S(M){return Math.atan2(M.z,-M.x)}function f(M){return Math.atan2(-M.y,Math.sqrt(M.x*M.x+M.z*M.z))}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new mu(A.vertices,A.indices,A.radius,A.details)}}class tv extends mu{constructor(A=1,e=0){const i=(1+Math.sqrt(5))/2,g=1/i,I=[-1,-1,-1,-1,-1,1,-1,1,-1,-1,1,1,1,-1,-1,1,-1,1,1,1,-1,1,1,1,0,-g,-i,0,-g,i,0,g,-i,0,g,i,-g,-i,0,-g,i,0,g,-i,0,g,i,0,-i,0,-g,i,0,-g,-i,0,g,i,0,g],n=[3,11,7,3,7,15,3,15,13,7,19,17,7,17,6,7,6,15,17,4,8,17,8,10,17,10,6,8,0,16,8,16,2,8,2,10,0,12,1,0,1,18,0,18,16,6,10,2,6,2,13,6,13,15,2,16,18,2,18,3,2,3,13,18,1,9,18,9,11,18,11,3,4,14,12,4,12,0,4,0,8,11,9,5,11,5,19,11,19,7,19,5,14,19,14,4,19,4,17,1,12,14,1,14,5,1,5,9];super(I,n,A,e),this.type="DodecahedronGeometry",this.parameters={radius:A,detail:e}}static fromJSON(A){return new tv(A.radius,A.detail)}}const kG=new wA,MG=new wA,dq=new wA,NG=new Mr;class RnA extends fi{constructor(A=null,e=1){if(super(),this.type="EdgesGeometry",this.parameters={geometry:A,thresholdAngle:e},A!==null){const g=Math.pow(10,4),I=Math.cos(Ed*e),n=A.getIndex(),o=A.getAttribute("position"),a=n?n.count:o.count,r=[0,0,0],s=["a","b","c"],B=new Array(3),c={},E=[];for(let D=0;D<a;D+=3){n?(r[0]=n.getX(D),r[1]=n.getX(D+1),r[2]=n.getX(D+2)):(r[0]=D,r[1]=D+1,r[2]=D+2);const{a:y,b:S,c:f}=NG;if(y.fromBufferAttribute(o,r[0]),S.fromBufferAttribute(o,r[1]),f.fromBufferAttribute(o,r[2]),NG.getNormal(dq),B[0]=`${Math.round(y.x*g)},${Math.round(y.y*g)},${Math.round(y.z*g)}`,B[1]=`${Math.round(S.x*g)},${Math.round(S.y*g)},${Math.round(S.z*g)}`,B[2]=`${Math.round(f.x*g)},${Math.round(f.y*g)},${Math.round(f.z*g)}`,!(B[0]===B[1]||B[1]===B[2]||B[2]===B[0]))for(let M=0;M<3;M++){const k=(M+1)%3,m=B[M],U=B[k],F=NG[s[M]],b=NG[s[k]],K=`${m}_${U}`,R=`${U}_${m}`;R in c&&c[R]?(dq.dot(c[R].normal)<=I&&(E.push(F.x,F.y,F.z),E.push(b.x,b.y,b.z)),c[R]=null):K in c||(c[K]={index0:r[M],index1:r[k],normal:dq.clone()})}}for(const D in c)if(c[D]){const{index0:y,index1:S}=c[D];kG.fromBufferAttribute(o,y),MG.fromBufferAttribute(o,S),E.push(kG.x,kG.y,kG.z),E.push(MG.x,MG.y,MG.z)}this.setAttribute("position",new bt(E,3))}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}}class UB{constructor(){this.type="Curve",this.arcLengthDivisions=200,this.needsUpdate=!1,this.cacheArcLengths=null}getPoint(){}getPointAt(A,e){const i=this.getUtoTmapping(A);return this.getPoint(i,e)}getPoints(A=5){const e=[];for(let i=0;i<=A;i++)e.push(this.getPoint(i/A));return e}getSpacedPoints(A=5){const e=[];for(let i=0;i<=A;i++)e.push(this.getPointAt(i/A));return e}getLength(){const A=this.getLengths();return A[A.length-1]}getLengths(A=this.arcLengthDivisions){if(this.cacheArcLengths&&this.cacheArcLengths.length===A+1&&!this.needsUpdate)return this.cacheArcLengths;this.needsUpdate=!1;const e=[];let i,g=this.getPoint(0),I=0;e.push(0);for(let n=1;n<=A;n++)i=this.getPoint(n/A),I+=i.distanceTo(g),e.push(I),g=i;return this.cacheArcLengths=e,e}updateArcLengths(){this.needsUpdate=!0,this.getLengths()}getUtoTmapping(A,e=null){const i=this.getLengths();let g=0;const I=i.length;let n;e?n=e:n=A*i[I-1];let o=0,a=I-1,r;for(;o<=a;)if(g=Math.floor(o+(a-o)/2),r=i[g]-n,r<0)o=g+1;else if(r>0)a=g-1;else{a=g;break}if(g=a,i[g]===n)return g/(I-1);const s=i[g],c=i[g+1]-s,E=(n-s)/c;return(g+E)/(I-1)}getTangent(A,e){let g=A-1e-4,I=A+1e-4;g<0&&(g=0),I>1&&(I=1);const n=this.getPoint(g),o=this.getPoint(I),a=e||(n.isVector2?new Ze:new wA);return a.copy(o).sub(n).normalize(),a}getTangentAt(A,e){const i=this.getUtoTmapping(A);return this.getTangent(i,e)}computeFrenetFrames(A,e=!1){const i=new wA,g=[],I=[],n=[],o=new wA,a=new Ai;for(let E=0;E<=A;E++){const D=E/A;g[E]=this.getTangentAt(D,new wA)}I[0]=new wA,n[0]=new wA;let r=Number.MAX_VALUE;const s=Math.abs(g[0].x),B=Math.abs(g[0].y),c=Math.abs(g[0].z);s<=r&&(r=s,i.set(1,0,0)),B<=r&&(r=B,i.set(0,1,0)),c<=r&&i.set(0,0,1),o.crossVectors(g[0],i).normalize(),I[0].crossVectors(g[0],o),n[0].crossVectors(g[0],I[0]);for(let E=1;E<=A;E++){if(I[E]=I[E-1].clone(),n[E]=n[E-1].clone(),o.crossVectors(g[E-1],g[E]),o.length()>Number.EPSILON){o.normalize();const D=Math.acos(Ci(g[E-1].dot(g[E]),-1,1));I[E].applyMatrix4(a.makeRotationAxis(o,D))}n[E].crossVectors(g[E],I[E])}if(e===!0){let E=Math.acos(Ci(I[0].dot(I[A]),-1,1));E/=A,g[0].dot(o.crossVectors(I[0],I[A]))>0&&(E=-E);for(let D=1;D<=A;D++)I[D].applyMatrix4(a.makeRotationAxis(g[D],E*D)),n[D].crossVectors(g[D],I[D])}return{tangents:g,normals:I,binormals:n}}clone(){return new this.constructor().copy(this)}copy(A){return this.arcLengthDivisions=A.arcLengthDivisions,this}toJSON(){const A={metadata:{version:4.7,type:"Curve",generator:"Curve.toJSON"}};return A.arcLengthDivisions=this.arcLengthDivisions,A.type=this.type,A}fromJSON(A){return this.arcLengthDivisions=A.arcLengthDivisions,this}}class iv extends UB{constructor(A=0,e=0,i=1,g=1,I=0,n=Math.PI*2,o=!1,a=0){super(),this.isEllipseCurve=!0,this.type="EllipseCurve",this.aX=A,this.aY=e,this.xRadius=i,this.yRadius=g,this.aStartAngle=I,this.aEndAngle=n,this.aClockwise=o,this.aRotation=a}getPoint(A,e=new Ze){const i=e,g=Math.PI*2;let I=this.aEndAngle-this.aStartAngle;const n=Math.abs(I)<Number.EPSILON;for(;I<0;)I+=g;for(;I>g;)I-=g;I<Number.EPSILON&&(n?I=0:I=g),this.aClockwise===!0&&!n&&(I===g?I=-g:I=I-g);const o=this.aStartAngle+A*I;let a=this.aX+this.xRadius*Math.cos(o),r=this.aY+this.yRadius*Math.sin(o);if(this.aRotation!==0){const s=Math.cos(this.aRotation),B=Math.sin(this.aRotation),c=a-this.aX,E=r-this.aY;a=c*s-E*B+this.aX,r=c*B+E*s+this.aY}return i.set(a,r)}copy(A){return super.copy(A),this.aX=A.aX,this.aY=A.aY,this.xRadius=A.xRadius,this.yRadius=A.yRadius,this.aStartAngle=A.aStartAngle,this.aEndAngle=A.aEndAngle,this.aClockwise=A.aClockwise,this.aRotation=A.aRotation,this}toJSON(){const A=super.toJSON();return A.aX=this.aX,A.aY=this.aY,A.xRadius=this.xRadius,A.yRadius=this.yRadius,A.aStartAngle=this.aStartAngle,A.aEndAngle=this.aEndAngle,A.aClockwise=this.aClockwise,A.aRotation=this.aRotation,A}fromJSON(A){return super.fromJSON(A),this.aX=A.aX,this.aY=A.aY,this.xRadius=A.xRadius,this.yRadius=A.yRadius,this.aStartAngle=A.aStartAngle,this.aEndAngle=A.aEndAngle,this.aClockwise=A.aClockwise,this.aRotation=A.aRotation,this}}class UnA extends iv{constructor(A,e,i,g,I,n){super(A,e,i,i,g,I,n),this.isArcCurve=!0,this.type="ArcCurve"}}function C1(){let t=0,A=0,e=0,i=0;function g(I,n,o,a){t=I,A=o,e=-3*I+3*n-2*o-a,i=2*I-2*n+o+a}return{initCatmullRom:function(I,n,o,a,r){g(n,o,r*(o-I),r*(a-n))},initNonuniformCatmullRom:function(I,n,o,a,r,s,B){let c=(n-I)/r-(o-I)/(r+s)+(o-n)/s,E=(o-n)/s-(a-n)/(s+B)+(a-o)/B;c*=s,E*=s,g(n,o,c,E)},calc:function(I){const n=I*I,o=n*I;return t+A*I+e*n+i*o}}}const GG=new wA,pq=new C1,fq=new C1,Dq=new C1;class KnA extends UB{constructor(A=[],e=!1,i="centripetal",g=.5){super(),this.isCatmullRomCurve3=!0,this.type="CatmullRomCurve3",this.points=A,this.closed=e,this.curveType=i,this.tension=g}getPoint(A,e=new wA){const i=e,g=this.points,I=g.length,n=(I-(this.closed?0:1))*A;let o=Math.floor(n),a=n-o;this.closed?o+=o>0?0:(Math.floor(Math.abs(o)/I)+1)*I:a===0&&o===I-1&&(o=I-2,a=1);let r,s;this.closed||o>0?r=g[(o-1)%I]:(GG.subVectors(g[0],g[1]).add(g[0]),r=GG);const B=g[o%I],c=g[(o+1)%I];if(this.closed||o+2<I?s=g[(o+2)%I]:(GG.subVectors(g[I-1],g[I-2]).add(g[I-1]),s=GG),this.curveType==="centripetal"||this.curveType==="chordal"){const E=this.curveType==="chordal"?.5:.25;let D=Math.pow(r.distanceToSquared(B),E),y=Math.pow(B.distanceToSquared(c),E),S=Math.pow(c.distanceToSquared(s),E);y<1e-4&&(y=1),D<1e-4&&(D=y),S<1e-4&&(S=y),pq.initNonuniformCatmullRom(r.x,B.x,c.x,s.x,D,y,S),fq.initNonuniformCatmullRom(r.y,B.y,c.y,s.y,D,y,S),Dq.initNonuniformCatmullRom(r.z,B.z,c.z,s.z,D,y,S)}else this.curveType==="catmullrom"&&(pq.initCatmullRom(r.x,B.x,c.x,s.x,this.tension),fq.initCatmullRom(r.y,B.y,c.y,s.y,this.tension),Dq.initCatmullRom(r.z,B.z,c.z,s.z,this.tension));return i.set(pq.calc(a),fq.calc(a),Dq.calc(a)),i}copy(A){super.copy(A),this.points=[];for(let e=0,i=A.points.length;e<i;e++){const g=A.points[e];this.points.push(g.clone())}return this.closed=A.closed,this.curveType=A.curveType,this.tension=A.tension,this}toJSON(){const A=super.toJSON();A.points=[];for(let e=0,i=this.points.length;e<i;e++){const g=this.points[e];A.points.push(g.toArray())}return A.closed=this.closed,A.curveType=this.curveType,A.tension=this.tension,A}fromJSON(A){super.fromJSON(A),this.points=[];for(let e=0,i=A.points.length;e<i;e++){const g=A.points[e];this.points.push(new wA().fromArray(g))}return this.closed=A.closed,this.curveType=A.curveType,this.tension=A.tension,this}}function fV(t,A,e,i,g){const I=(i-A)*.5,n=(g-e)*.5,o=t*t,a=t*o;return(2*e-2*i+I+n)*a+(-3*e+3*i-2*I-n)*o+I*t+e}function nOA(t,A){const e=1-t;return e*e*A}function oOA(t,A){return 2*(1-t)*t*A}function aOA(t,A){return t*t*A}function Xm(t,A,e,i){return nOA(t,A)+oOA(t,e)+aOA(t,i)}function rOA(t,A){const e=1-t;return e*e*e*A}function sOA(t,A){const e=1-t;return 3*e*e*t*A}function COA(t,A){return 3*(1-t)*t*t*A}function BOA(t,A){return t*t*t*A}function $m(t,A,e,i,g){return rOA(t,A)+sOA(t,e)+COA(t,i)+BOA(t,g)}class B1 extends UB{constructor(A=new Ze,e=new Ze,i=new Ze,g=new Ze){super(),this.isCubicBezierCurve=!0,this.type="CubicBezierCurve",this.v0=A,this.v1=e,this.v2=i,this.v3=g}getPoint(A,e=new Ze){const i=e,g=this.v0,I=this.v1,n=this.v2,o=this.v3;return i.set($m(A,g.x,I.x,n.x,o.x),$m(A,g.y,I.y,n.y,o.y)),i}copy(A){return super.copy(A),this.v0.copy(A.v0),this.v1.copy(A.v1),this.v2.copy(A.v2),this.v3.copy(A.v3),this}toJSON(){const A=super.toJSON();return A.v0=this.v0.toArray(),A.v1=this.v1.toArray(),A.v2=this.v2.toArray(),A.v3=this.v3.toArray(),A}fromJSON(A){return super.fromJSON(A),this.v0.fromArray(A.v0),this.v1.fromArray(A.v1),this.v2.fromArray(A.v2),this.v3.fromArray(A.v3),this}}class FnA extends UB{constructor(A=new wA,e=new wA,i=new wA,g=new wA){super(),this.isCubicBezierCurve3=!0,this.type="CubicBezierCurve3",this.v0=A,this.v1=e,this.v2=i,this.v3=g}getPoint(A,e=new wA){const i=e,g=this.v0,I=this.v1,n=this.v2,o=this.v3;return i.set($m(A,g.x,I.x,n.x,o.x),$m(A,g.y,I.y,n.y,o.y),$m(A,g.z,I.z,n.z,o.z)),i}copy(A){return super.copy(A),this.v0.copy(A.v0),this.v1.copy(A.v1),this.v2.copy(A.v2),this.v3.copy(A.v3),this}toJSON(){const A=super.toJSON();return A.v0=this.v0.toArray(),A.v1=this.v1.toArray(),A.v2=this.v2.toArray(),A.v3=this.v3.toArray(),A}fromJSON(A){return super.fromJSON(A),this.v0.fromArray(A.v0),this.v1.fromArray(A.v1),this.v2.fromArray(A.v2),this.v3.fromArray(A.v3),this}}class c1 extends UB{constructor(A=new Ze,e=new Ze){super(),this.isLineCurve=!0,this.type="LineCurve",this.v1=A,this.v2=e}getPoint(A,e=new Ze){const i=e;return A===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(A).add(this.v1)),i}getPointAt(A,e){return this.getPoint(A,e)}getTangent(A,e=new Ze){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(A,e){return this.getTangent(A,e)}copy(A){return super.copy(A),this.v1.copy(A.v1),this.v2.copy(A.v2),this}toJSON(){const A=super.toJSON();return A.v1=this.v1.toArray(),A.v2=this.v2.toArray(),A}fromJSON(A){return super.fromJSON(A),this.v1.fromArray(A.v1),this.v2.fromArray(A.v2),this}}class bnA extends UB{constructor(A=new wA,e=new wA){super(),this.isLineCurve3=!0,this.type="LineCurve3",this.v1=A,this.v2=e}getPoint(A,e=new wA){const i=e;return A===1?i.copy(this.v2):(i.copy(this.v2).sub(this.v1),i.multiplyScalar(A).add(this.v1)),i}getPointAt(A,e){return this.getPoint(A,e)}getTangent(A,e=new wA){return e.subVectors(this.v2,this.v1).normalize()}getTangentAt(A,e){return this.getTangent(A,e)}copy(A){return super.copy(A),this.v1.copy(A.v1),this.v2.copy(A.v2),this}toJSON(){const A=super.toJSON();return A.v1=this.v1.toArray(),A.v2=this.v2.toArray(),A}fromJSON(A){return super.fromJSON(A),this.v1.fromArray(A.v1),this.v2.fromArray(A.v2),this}}class l1 extends UB{constructor(A=new Ze,e=new Ze,i=new Ze){super(),this.isQuadraticBezierCurve=!0,this.type="QuadraticBezierCurve",this.v0=A,this.v1=e,this.v2=i}getPoint(A,e=new Ze){const i=e,g=this.v0,I=this.v1,n=this.v2;return i.set(Xm(A,g.x,I.x,n.x),Xm(A,g.y,I.y,n.y)),i}copy(A){return super.copy(A),this.v0.copy(A.v0),this.v1.copy(A.v1),this.v2.copy(A.v2),this}toJSON(){const A=super.toJSON();return A.v0=this.v0.toArray(),A.v1=this.v1.toArray(),A.v2=this.v2.toArray(),A}fromJSON(A){return super.fromJSON(A),this.v0.fromArray(A.v0),this.v1.fromArray(A.v1),this.v2.fromArray(A.v2),this}}class Q1 extends UB{constructor(A=new wA,e=new wA,i=new wA){super(),this.isQuadraticBezierCurve3=!0,this.type="QuadraticBezierCurve3",this.v0=A,this.v1=e,this.v2=i}getPoint(A,e=new wA){const i=e,g=this.v0,I=this.v1,n=this.v2;return i.set(Xm(A,g.x,I.x,n.x),Xm(A,g.y,I.y,n.y),Xm(A,g.z,I.z,n.z)),i}copy(A){return super.copy(A),this.v0.copy(A.v0),this.v1.copy(A.v1),this.v2.copy(A.v2),this}toJSON(){const A=super.toJSON();return A.v0=this.v0.toArray(),A.v1=this.v1.toArray(),A.v2=this.v2.toArray(),A}fromJSON(A){return super.fromJSON(A),this.v0.fromArray(A.v0),this.v1.fromArray(A.v1),this.v2.fromArray(A.v2),this}}class E1 extends UB{constructor(A=[]){super(),this.isSplineCurve=!0,this.type="SplineCurve",this.points=A}getPoint(A,e=new Ze){const i=e,g=this.points,I=(g.length-1)*A,n=Math.floor(I),o=I-n,a=g[n===0?n:n-1],r=g[n],s=g[n>g.length-2?g.length-1:n+1],B=g[n>g.length-3?g.length-1:n+2];return i.set(fV(o,a.x,r.x,s.x,B.x),fV(o,a.y,r.y,s.y,B.y)),i}copy(A){super.copy(A),this.points=[];for(let e=0,i=A.points.length;e<i;e++){const g=A.points[e];this.points.push(g.clone())}return this}toJSON(){const A=super.toJSON();A.points=[];for(let e=0,i=this.points.length;e<i;e++){const g=this.points[e];A.points.push(g.toArray())}return A}fromJSON(A){super.fromJSON(A),this.points=[];for(let e=0,i=A.points.length;e<i;e++){const g=A.points[e];this.points.push(new Ze().fromArray(g))}return this}}var AF=Object.freeze({__proto__:null,ArcCurve:UnA,CatmullRomCurve3:KnA,CubicBezierCurve:B1,CubicBezierCurve3:FnA,EllipseCurve:iv,LineCurve:c1,LineCurve3:bnA,QuadraticBezierCurve:l1,QuadraticBezierCurve3:Q1,SplineCurve:E1});class vnA extends UB{constructor(){super(),this.type="CurvePath",this.curves=[],this.autoClose=!1}add(A){this.curves.push(A)}closePath(){const A=this.curves[0].getPoint(0),e=this.curves[this.curves.length-1].getPoint(1);if(!A.equals(e)){const i=A.isVector2===!0?"LineCurve":"LineCurve3";this.curves.push(new AF[i](e,A))}return this}getPoint(A,e){const i=A*this.getLength(),g=this.getCurveLengths();let I=0;for(;I<g.length;){if(g[I]>=i){const n=g[I]-i,o=this.curves[I],a=o.getLength(),r=a===0?0:1-n/a;return o.getPointAt(r,e)}I++}return null}getLength(){const A=this.getCurveLengths();return A[A.length-1]}updateArcLengths(){this.needsUpdate=!0,this.cacheLengths=null,this.getCurveLengths()}getCurveLengths(){if(this.cacheLengths&&this.cacheLengths.length===this.curves.length)return this.cacheLengths;const A=[];let e=0;for(let i=0,g=this.curves.length;i<g;i++)e+=this.curves[i].getLength(),A.push(e);return this.cacheLengths=A,A}getSpacedPoints(A=40){const e=[];for(let i=0;i<=A;i++)e.push(this.getPoint(i/A));return this.autoClose&&e.push(e[0]),e}getPoints(A=12){const e=[];let i;for(let g=0,I=this.curves;g<I.length;g++){const n=I[g],o=n.isEllipseCurve?A*2:n.isLineCurve||n.isLineCurve3?1:n.isSplineCurve?A*n.points.length:A,a=n.getPoints(o);for(let r=0;r<a.length;r++){const s=a[r];i&&i.equals(s)||(e.push(s),i=s)}}return this.autoClose&&e.length>1&&!e[e.length-1].equals(e[0])&&e.push(e[0]),e}copy(A){super.copy(A),this.curves=[];for(let e=0,i=A.curves.length;e<i;e++){const g=A.curves[e];this.curves.push(g.clone())}return this.autoClose=A.autoClose,this}toJSON(){const A=super.toJSON();A.autoClose=this.autoClose,A.curves=[];for(let e=0,i=this.curves.length;e<i;e++){const g=this.curves[e];A.curves.push(g.toJSON())}return A}fromJSON(A){super.fromJSON(A),this.autoClose=A.autoClose,this.curves=[];for(let e=0,i=A.curves.length;e<i;e++){const g=A.curves[e];this.curves.push(new AF[g.type]().fromJSON(g))}return this}}class eF extends vnA{constructor(A){super(),this.type="Path",this.currentPoint=new Ze,A&&this.setFromPoints(A)}setFromPoints(A){this.moveTo(A[0].x,A[0].y);for(let e=1,i=A.length;e<i;e++)this.lineTo(A[e].x,A[e].y);return this}moveTo(A,e){return this.currentPoint.set(A,e),this}lineTo(A,e){const i=new c1(this.currentPoint.clone(),new Ze(A,e));return this.curves.push(i),this.currentPoint.set(A,e),this}quadraticCurveTo(A,e,i,g){const I=new l1(this.currentPoint.clone(),new Ze(A,e),new Ze(i,g));return this.curves.push(I),this.currentPoint.set(i,g),this}bezierCurveTo(A,e,i,g,I,n){const o=new B1(this.currentPoint.clone(),new Ze(A,e),new Ze(i,g),new Ze(I,n));return this.curves.push(o),this.currentPoint.set(I,n),this}splineThru(A){const e=[this.currentPoint.clone()].concat(A),i=new E1(e);return this.curves.push(i),this.currentPoint.copy(A[A.length-1]),this}arc(A,e,i,g,I,n){const o=this.currentPoint.x,a=this.currentPoint.y;return this.absarc(A+o,e+a,i,g,I,n),this}absarc(A,e,i,g,I,n){return this.absellipse(A,e,i,i,g,I,n),this}ellipse(A,e,i,g,I,n,o,a){const r=this.currentPoint.x,s=this.currentPoint.y;return this.absellipse(A+r,e+s,i,g,I,n,o,a),this}absellipse(A,e,i,g,I,n,o,a){const r=new iv(A,e,i,g,I,n,o,a);if(this.curves.length>0){const B=r.getPoint(0);B.equals(this.currentPoint)||this.lineTo(B.x,B.y)}this.curves.push(r);const s=r.getPoint(1);return this.currentPoint.copy(s),this}copy(A){return super.copy(A),this.currentPoint.copy(A.currentPoint),this}toJSON(){const A=super.toJSON();return A.currentPoint=this.currentPoint.toArray(),A}fromJSON(A){return super.fromJSON(A),this.currentPoint.fromArray(A.currentPoint),this}}class ud extends eF{constructor(A){super(A),this.uuid=Qs(),this.type="Shape",this.holes=[]}getPointsHoles(A){const e=[];for(let i=0,g=this.holes.length;i<g;i++)e[i]=this.holes[i].getPoints(A);return e}extractPoints(A){return{shape:this.getPoints(A),holes:this.getPointsHoles(A)}}copy(A){super.copy(A),this.holes=[];for(let e=0,i=A.holes.length;e<i;e++){const g=A.holes[e];this.holes.push(g.clone())}return this}toJSON(){const A=super.toJSON();A.uuid=this.uuid,A.holes=[];for(let e=0,i=this.holes.length;e<i;e++){const g=this.holes[e];A.holes.push(g.toJSON())}return A}fromJSON(A){super.fromJSON(A),this.uuid=A.uuid,this.holes=[];for(let e=0,i=A.holes.length;e<i;e++){const g=A.holes[e];this.holes.push(new eF().fromJSON(g))}return this}}function cOA(t,A,e=2){const i=A&&A.length,g=i?A[0]*e:t.length;let I=_nA(t,0,g,e,!0);const n=[];if(!I||I.next===I.prev)return n;let o,a,r;if(i&&(I=hOA(t,A,I,e)),t.length>80*e){o=1/0,a=1/0;let s=-1/0,B=-1/0;for(let c=e;c<g;c+=e){const E=t[c],D=t[c+1];E<o&&(o=E),D<a&&(a=D),E>s&&(s=E),D>B&&(B=D)}r=Math.max(s-o,B-a),r=r!==0?32767/r:0}return P0(I,n,e,o,a,r,0),n}function _nA(t,A,e,i,g){let I;if(g===NOA(t,A,e,i)>0)for(let n=A;n<e;n+=i)I=DV(n/i|0,t[n],t[n+1],I);else for(let n=e-i;n>=A;n-=i)I=DV(n/i|0,t[n],t[n+1],I);return I&&yy(I,I.next)&&(Z0(I),I=I.next),I}function bd(t,A){if(!t)return t;A||(A=t);let e=t,i;do if(i=!1,!e.steiner&&(yy(e,e.next)||YI(e.prev,e,e.next)===0)){if(Z0(e),e=A=e.prev,e===e.next)break;i=!0}else e=e.next;while(i||e!==A);return A}function P0(t,A,e,i,g,I,n){if(!t)return;!n&&I&&yOA(t,i,g,I);let o=t;for(;t.prev!==t.next;){const a=t.prev,r=t.next;if(I?QOA(t,i,g,I):lOA(t)){A.push(a.i,t.i,r.i),Z0(t),t=r.next,o=r.next;continue}if(t=r,t===o){n?n===1?(t=EOA(bd(t),A),P0(t,A,e,i,g,I,2)):n===2&&uOA(t,A,e,i,g,I):P0(bd(t),A,e,i,g,I,1);break}}}function lOA(t){const A=t.prev,e=t,i=t.next;if(YI(A,e,i)>=0)return!1;const g=A.x,I=e.x,n=i.x,o=A.y,a=e.y,r=i.y,s=Math.min(g,I,n),B=Math.min(o,a,r),c=Math.max(g,I,n),E=Math.max(o,a,r);let D=i.next;for(;D!==A;){if(D.x>=s&&D.x<=c&&D.y>=B&&D.y<=E&&hm(g,o,I,a,n,r,D.x,D.y)&&YI(D.prev,D,D.next)>=0)return!1;D=D.next}return!0}function QOA(t,A,e,i){const g=t.prev,I=t,n=t.next;if(YI(g,I,n)>=0)return!1;const o=g.x,a=I.x,r=n.x,s=g.y,B=I.y,c=n.y,E=Math.min(o,a,r),D=Math.min(s,B,c),y=Math.max(o,a,r),S=Math.max(s,B,c),f=UY(E,D,A,e,i),M=UY(y,S,A,e,i);let k=t.prevZ,m=t.nextZ;for(;k&&k.z>=f&&m&&m.z<=M;){if(k.x>=E&&k.x<=y&&k.y>=D&&k.y<=S&&k!==g&&k!==n&&hm(o,s,a,B,r,c,k.x,k.y)&&YI(k.prev,k,k.next)>=0||(k=k.prevZ,m.x>=E&&m.x<=y&&m.y>=D&&m.y<=S&&m!==g&&m!==n&&hm(o,s,a,B,r,c,m.x,m.y)&&YI(m.prev,m,m.next)>=0))return!1;m=m.nextZ}for(;k&&k.z>=f;){if(k.x>=E&&k.x<=y&&k.y>=D&&k.y<=S&&k!==g&&k!==n&&hm(o,s,a,B,r,c,k.x,k.y)&&YI(k.prev,k,k.next)>=0)return!1;k=k.prevZ}for(;m&&m.z<=M;){if(m.x>=E&&m.x<=y&&m.y>=D&&m.y<=S&&m!==g&&m!==n&&hm(o,s,a,B,r,c,m.x,m.y)&&YI(m.prev,m,m.next)>=0)return!1;m=m.nextZ}return!0}function EOA(t,A){let e=t;do{const i=e.prev,g=e.next.next;!yy(i,g)&&LnA(i,e,e.next,g)&&j0(i,g)&&j0(g,i)&&(A.push(i.i,e.i,g.i),Z0(e),Z0(e.next),e=t=g),e=e.next}while(e!==t);return bd(e)}function uOA(t,A,e,i,g,I){let n=t;do{let o=n.next.next;for(;o!==n.prev;){if(n.i!==o.i&&mOA(n,o)){let a=qnA(n,o);n=bd(n,n.next),a=bd(a,a.next),P0(n,A,e,i,g,I,0),P0(a,A,e,i,g,I,0);return}o=o.next}n=n.next}while(n!==t)}function hOA(t,A,e,i){const g=[];for(let I=0,n=A.length;I<n;I++){const o=A[I]*i,a=I<n-1?A[I+1]*i:t.length,r=_nA(t,o,a,i,!1);r===r.next&&(r.steiner=!0),g.push(wOA(r))}g.sort(dOA);for(let I=0;I<g.length;I++)e=pOA(g[I],e);return e}function dOA(t,A){let e=t.x-A.x;if(e===0&&(e=t.y-A.y,e===0)){const i=(t.next.y-t.y)/(t.next.x-t.x),g=(A.next.y-A.y)/(A.next.x-A.x);e=i-g}return e}function pOA(t,A){const e=fOA(t,A);if(!e)return A;const i=qnA(e,t);return bd(i,i.next),bd(e,e.next)}function fOA(t,A){let e=A;const i=t.x,g=t.y;let I=-1/0,n;if(yy(t,e))return e;do{if(yy(t,e.next))return e.next;if(g<=e.y&&g>=e.next.y&&e.next.y!==e.y){const B=e.x+(g-e.y)*(e.next.x-e.x)/(e.next.y-e.y);if(B<=i&&B>I&&(I=B,n=e.x<e.next.x?e:e.next,B===i))return n}e=e.next}while(e!==A);if(!n)return null;const o=n,a=n.x,r=n.y;let s=1/0;e=n;do{if(i>=e.x&&e.x>=a&&i!==e.x&&JnA(g<r?i:I,g,a,r,g<r?I:i,g,e.x,e.y)){const B=Math.abs(g-e.y)/(i-e.x);j0(e,t)&&(B<s||B===s&&(e.x>n.x||e.x===n.x&&DOA(n,e)))&&(n=e,s=B)}e=e.next}while(e!==o);return n}function DOA(t,A){return YI(t.prev,t,A.prev)<0&&YI(A.next,t,t.next)<0}function yOA(t,A,e,i){let g=t;do g.z===0&&(g.z=UY(g.x,g.y,A,e,i)),g.prevZ=g.prev,g.nextZ=g.next,g=g.next;while(g!==t);g.prevZ.nextZ=null,g.prevZ=null,SOA(g)}function SOA(t){let A,e=1;do{let i=t,g;t=null;let I=null;for(A=0;i;){A++;let n=i,o=0;for(let r=0;r<e&&(o++,n=n.nextZ,!!n);r++);let a=e;for(;o>0||a>0&&n;)o!==0&&(a===0||!n||i.z<=n.z)?(g=i,i=i.nextZ,o--):(g=n,n=n.nextZ,a--),I?I.nextZ=g:t=g,g.prevZ=I,I=g;i=n}I.nextZ=null,e*=2}while(A>1);return t}function UY(t,A,e,i,g){return t=(t-e)*g|0,A=(A-i)*g|0,t=(t|t<<8)&16711935,t=(t|t<<4)&252645135,t=(t|t<<2)&858993459,t=(t|t<<1)&1431655765,A=(A|A<<8)&16711935,A=(A|A<<4)&252645135,A=(A|A<<2)&858993459,A=(A|A<<1)&1431655765,t|A<<1}function wOA(t){let A=t,e=t;do(A.x<e.x||A.x===e.x&&A.y<e.y)&&(e=A),A=A.next;while(A!==t);return e}function JnA(t,A,e,i,g,I,n,o){return(g-n)*(A-o)>=(t-n)*(I-o)&&(t-n)*(i-o)>=(e-n)*(A-o)&&(e-n)*(I-o)>=(g-n)*(i-o)}function hm(t,A,e,i,g,I,n,o){return!(t===n&&A===o)&&JnA(t,A,e,i,g,I,n,o)}function mOA(t,A){return t.next.i!==A.i&&t.prev.i!==A.i&&!kOA(t,A)&&(j0(t,A)&&j0(A,t)&&MOA(t,A)&&(YI(t.prev,t,A.prev)||YI(t,A.prev,A))||yy(t,A)&&YI(t.prev,t,t.next)>0&&YI(A.prev,A,A.next)>0)}function YI(t,A,e){return(A.y-t.y)*(e.x-A.x)-(A.x-t.x)*(e.y-A.y)}function yy(t,A){return t.x===A.x&&t.y===A.y}function LnA(t,A,e,i){const g=UG(YI(t,A,e)),I=UG(YI(t,A,i)),n=UG(YI(e,i,t)),o=UG(YI(e,i,A));return!!(g!==I&&n!==o||g===0&&RG(t,e,A)||I===0&&RG(t,i,A)||n===0&&RG(e,t,i)||o===0&&RG(e,A,i))}function RG(t,A,e){return A.x<=Math.max(t.x,e.x)&&A.x>=Math.min(t.x,e.x)&&A.y<=Math.max(t.y,e.y)&&A.y>=Math.min(t.y,e.y)}function UG(t){return t>0?1:t<0?-1:0}function kOA(t,A){let e=t;do{if(e.i!==t.i&&e.next.i!==t.i&&e.i!==A.i&&e.next.i!==A.i&&LnA(e,e.next,t,A))return!0;e=e.next}while(e!==t);return!1}function j0(t,A){return YI(t.prev,t,t.next)<0?YI(t,A,t.next)>=0&&YI(t,t.prev,A)>=0:YI(t,A,t.prev)<0||YI(t,t.next,A)<0}function MOA(t,A){let e=t,i=!1;const g=(t.x+A.x)/2,I=(t.y+A.y)/2;do e.y>I!=e.next.y>I&&e.next.y!==e.y&&g<(e.next.x-e.x)*(I-e.y)/(e.next.y-e.y)+e.x&&(i=!i),e=e.next;while(e!==t);return i}function qnA(t,A){const e=KY(t.i,t.x,t.y),i=KY(A.i,A.x,A.y),g=t.next,I=A.prev;return t.next=A,A.prev=t,e.next=g,g.prev=e,i.next=e,e.prev=i,I.next=i,i.prev=I,i}function DV(t,A,e,i){const g=KY(t,A,e);return i?(g.next=i.next,g.prev=i,i.next.prev=g,i.next=g):(g.prev=g,g.next=g),g}function Z0(t){t.next.prev=t.prev,t.prev.next=t.next,t.prevZ&&(t.prevZ.nextZ=t.nextZ),t.nextZ&&(t.nextZ.prevZ=t.prevZ)}function KY(t,A,e){return{i:t,x:A,y:e,prev:null,next:null,z:0,prevZ:null,nextZ:null,steiner:!1}}function NOA(t,A,e,i){let g=0;for(let I=A,n=e-i;I<e;I+=i)g+=(t[n]-t[I])*(t[I+1]+t[n+1]),n=I;return g}class GOA{static triangulate(A,e,i=2){return cOA(A,e,i)}}class lB{static area(A){const e=A.length;let i=0;for(let g=e-1,I=0;I<e;g=I++)i+=A[g].x*A[I].y-A[I].x*A[g].y;return i*.5}static isClockWise(A){return lB.area(A)<0}static triangulateShape(A,e){const i=[],g=[],I=[];yV(A),SV(i,A);let n=A.length;e.forEach(yV);for(let a=0;a<e.length;a++)g.push(n),n+=e[a].length,SV(i,e[a]);const o=GOA.triangulate(i,g);for(let a=0;a<o.length;a+=3)I.push(o.slice(a,a+3));return I}}function yV(t){const A=t.length;A>2&&t[A-1].equals(t[0])&&t.pop()}function SV(t,A){for(let e=0;e<A.length;e++)t.push(A[e].x),t.push(A[e].y)}class gv extends fi{constructor(A=new ud([new Ze(.5,.5),new Ze(-.5,.5),new Ze(-.5,-.5),new Ze(.5,-.5)]),e={}){super(),this.type="ExtrudeGeometry",this.parameters={shapes:A,options:e},A=Array.isArray(A)?A:[A];const i=this,g=[],I=[];for(let o=0,a=A.length;o<a;o++){const r=A[o];n(r)}this.setAttribute("position",new bt(g,3)),this.setAttribute("uv",new bt(I,2)),this.computeVertexNormals();function n(o){const a=[],r=e.curveSegments!==void 0?e.curveSegments:12,s=e.steps!==void 0?e.steps:1,B=e.depth!==void 0?e.depth:1;let c=e.bevelEnabled!==void 0?e.bevelEnabled:!0,E=e.bevelThickness!==void 0?e.bevelThickness:.2,D=e.bevelSize!==void 0?e.bevelSize:E-.1,y=e.bevelOffset!==void 0?e.bevelOffset:0,S=e.bevelSegments!==void 0?e.bevelSegments:3;const f=e.extrudePath,M=e.UVGenerator!==void 0?e.UVGenerator:ROA;let k,m=!1,U,F,b,K;f&&(k=f.getSpacedPoints(s),m=!0,c=!1,U=f.computeFrenetFrames(s,!1),F=new wA,b=new wA,K=new wA),c||(S=0,E=0,D=0,y=0);const R=o.extractPoints(r);let G=R.shape;const J=R.holes;if(!lB.isClockWise(G)){G=G.reverse();for(let tA=0,iA=J.length;tA<iA;tA++){const hA=J[tA];lB.isClockWise(hA)&&(J[tA]=hA.reverse())}}function H(tA){const hA=10000000000000001e-36;let DA=tA[0];for(let dA=1;dA<=tA.length;dA++){const SA=dA%tA.length,NA=tA[SA],OA=NA.x-DA.x,Qe=NA.y-DA.y,nA=OA*OA+Qe*Qe,eA=Math.max(Math.abs(NA.x),Math.abs(NA.y),Math.abs(DA.x),Math.abs(DA.y)),UA=hA*eA*eA;if(nA<=UA){tA.splice(SA,1),dA--;continue}DA=NA}}H(G),J.forEach(H);const P=J.length,j=G;for(let tA=0;tA<P;tA++){const iA=J[tA];G=G.concat(iA)}function q(tA,iA,hA){return tA.clone().addScaledVector(iA,hA)}const Y=G.length;function O(tA,iA,hA){let DA,dA,SA;const NA=tA.x-iA.x,OA=tA.y-iA.y,Qe=hA.x-tA.x,nA=hA.y-tA.y,eA=NA*NA+OA*OA,UA=NA*nA-OA*Qe;if(Math.abs(UA)>Number.EPSILON){const HA=Math.sqrt(eA),Se=Math.sqrt(Qe*Qe+nA*nA),ne=iA.x-OA/HA,Oe=iA.y+NA/HA,VA=hA.x-nA/Se,de=hA.y+Qe/Se,te=((VA-ne)*nA-(de-Oe)*Qe)/(NA*nA-OA*Qe);DA=ne+NA*te-tA.x,dA=Oe+OA*te-tA.y;const WA=DA*DA+dA*dA;if(WA<=2)return new Ze(DA,dA);SA=Math.sqrt(WA/2)}else{let HA=!1;NA>Number.EPSILON?Qe>Number.EPSILON&&(HA=!0):NA<-Number.EPSILON?Qe<-Number.EPSILON&&(HA=!0):Math.sign(OA)===Math.sign(nA)&&(HA=!0),HA?(DA=-OA,dA=NA,SA=Math.sqrt(eA)):(DA=NA,dA=OA,SA=Math.sqrt(eA/2))}return new Ze(DA/SA,dA/SA)}const $=[];for(let tA=0,iA=j.length,hA=iA-1,DA=tA+1;tA<iA;tA++,hA++,DA++)hA===iA&&(hA=0),DA===iA&&(DA=0),$[tA]=O(j[tA],j[hA],j[DA]);const gA=[];let z,X=$.concat();for(let tA=0,iA=P;tA<iA;tA++){const hA=J[tA];z=[];for(let DA=0,dA=hA.length,SA=dA-1,NA=DA+1;DA<dA;DA++,SA++,NA++)SA===dA&&(SA=0),NA===dA&&(NA=0),z[DA]=O(hA[DA],hA[SA],hA[NA]);gA.push(z),X=X.concat(z)}let sA;if(S===0)sA=lB.triangulateShape(j,J);else{const tA=[],iA=[];for(let hA=0;hA<S;hA++){const DA=hA/S,dA=E*Math.cos(DA*Math.PI/2),SA=D*Math.sin(DA*Math.PI/2)+y;for(let NA=0,OA=j.length;NA<OA;NA++){const Qe=q(j[NA],$[NA],SA);FA(Qe.x,Qe.y,-dA),DA===0&&tA.push(Qe)}for(let NA=0,OA=P;NA<OA;NA++){const Qe=J[NA];z=gA[NA];const nA=[];for(let eA=0,UA=Qe.length;eA<UA;eA++){const HA=q(Qe[eA],z[eA],SA);FA(HA.x,HA.y,-dA),DA===0&&nA.push(HA)}DA===0&&iA.push(nA)}}sA=lB.triangulateShape(tA,iA)}const rA=sA.length,mA=D+y;for(let tA=0;tA<Y;tA++){const iA=c?q(G[tA],X[tA],mA):G[tA];m?(b.copy(U.normals[0]).multiplyScalar(iA.x),F.copy(U.binormals[0]).multiplyScalar(iA.y),K.copy(k[0]).add(b).add(F),FA(K.x,K.y,K.z)):FA(iA.x,iA.y,0)}for(let tA=1;tA<=s;tA++)for(let iA=0;iA<Y;iA++){const hA=c?q(G[iA],X[iA],mA):G[iA];m?(b.copy(U.normals[tA]).multiplyScalar(hA.x),F.copy(U.binormals[tA]).multiplyScalar(hA.y),K.copy(k[tA]).add(b).add(F),FA(K.x,K.y,K.z)):FA(hA.x,hA.y,B/s*tA)}for(let tA=S-1;tA>=0;tA--){const iA=tA/S,hA=E*Math.cos(iA*Math.PI/2),DA=D*Math.sin(iA*Math.PI/2)+y;for(let dA=0,SA=j.length;dA<SA;dA++){const NA=q(j[dA],$[dA],DA);FA(NA.x,NA.y,B+hA)}for(let dA=0,SA=J.length;dA<SA;dA++){const NA=J[dA];z=gA[dA];for(let OA=0,Qe=NA.length;OA<Qe;OA++){const nA=q(NA[OA],z[OA],DA);m?FA(nA.x,nA.y+k[s-1].y,k[s-1].x+hA):FA(nA.x,nA.y,B+hA)}}}IA(),uA();function IA(){const tA=g.length/3;if(c){let iA=0,hA=Y*iA;for(let DA=0;DA<rA;DA++){const dA=sA[DA];RA(dA[2]+hA,dA[1]+hA,dA[0]+hA)}iA=s+S*2,hA=Y*iA;for(let DA=0;DA<rA;DA++){const dA=sA[DA];RA(dA[0]+hA,dA[1]+hA,dA[2]+hA)}}else{for(let iA=0;iA<rA;iA++){const hA=sA[iA];RA(hA[2],hA[1],hA[0])}for(let iA=0;iA<rA;iA++){const hA=sA[iA];RA(hA[0]+Y*s,hA[1]+Y*s,hA[2]+Y*s)}}i.addGroup(tA,g.length/3-tA,0)}function uA(){const tA=g.length/3;let iA=0;KA(j,iA),iA+=j.length;for(let hA=0,DA=J.length;hA<DA;hA++){const dA=J[hA];KA(dA,iA),iA+=dA.length}i.addGroup(tA,g.length/3-tA,1)}function KA(tA,iA){let hA=tA.length;for(;--hA>=0;){const DA=hA;let dA=hA-1;dA<0&&(dA=tA.length-1);for(let SA=0,NA=s+S*2;SA<NA;SA++){const OA=Y*SA,Qe=Y*(SA+1),nA=iA+DA+OA,eA=iA+dA+OA,UA=iA+dA+Qe,HA=iA+DA+Qe;MA(nA,eA,UA,HA)}}}function FA(tA,iA,hA){a.push(tA),a.push(iA),a.push(hA)}function RA(tA,iA,hA){oA(tA),oA(iA),oA(hA);const DA=g.length/3,dA=M.generateTopUV(i,g,DA-3,DA-2,DA-1);AA(dA[0]),AA(dA[1]),AA(dA[2])}function MA(tA,iA,hA,DA){oA(tA),oA(iA),oA(DA),oA(iA),oA(hA),oA(DA);const dA=g.length/3,SA=M.generateSideWallUV(i,g,dA-6,dA-3,dA-2,dA-1);AA(SA[0]),AA(SA[1]),AA(SA[3]),AA(SA[1]),AA(SA[2]),AA(SA[3])}function oA(tA){g.push(a[tA*3+0]),g.push(a[tA*3+1]),g.push(a[tA*3+2])}function AA(tA){I.push(tA.x),I.push(tA.y)}}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}toJSON(){const A=super.toJSON(),e=this.parameters.shapes,i=this.parameters.options;return UOA(e,i,A)}static fromJSON(A,e){const i=[];for(let I=0,n=A.shapes.length;I<n;I++){const o=e[A.shapes[I]];i.push(o)}const g=A.options.extrudePath;return g!==void 0&&(A.options.extrudePath=new AF[g.type]().fromJSON(g)),new gv(i,A.options)}}const ROA={generateTopUV:function(t,A,e,i,g){const I=A[e*3],n=A[e*3+1],o=A[i*3],a=A[i*3+1],r=A[g*3],s=A[g*3+1];return[new Ze(I,n),new Ze(o,a),new Ze(r,s)]},generateSideWallUV:function(t,A,e,i,g,I){const n=A[e*3],o=A[e*3+1],a=A[e*3+2],r=A[i*3],s=A[i*3+1],B=A[i*3+2],c=A[g*3],E=A[g*3+1],D=A[g*3+2],y=A[I*3],S=A[I*3+1],f=A[I*3+2];return Math.abs(o-s)<Math.abs(n-r)?[new Ze(n,1-a),new Ze(r,1-B),new Ze(c,1-D),new Ze(y,1-f)]:[new Ze(o,1-a),new Ze(s,1-B),new Ze(E,1-D),new Ze(S,1-f)]}};function UOA(t,A,e){if(e.shapes=[],Array.isArray(t))for(let i=0,g=t.length;i<g;i++){const I=t[i];e.shapes.push(I.uuid)}else e.shapes.push(t.uuid);return e.options=Object.assign({},A),A.extrudePath!==void 0&&(e.options.extrudePath=A.extrudePath.toJSON()),e}class Iv extends mu{constructor(A=1,e=0){const i=(1+Math.sqrt(5))/2,g=[-1,i,0,1,i,0,-1,-i,0,1,-i,0,0,-1,i,0,1,i,0,-1,-i,0,1,-i,i,0,-1,i,0,1,-i,0,-1,-i,0,1],I=[0,11,5,0,5,1,0,1,7,0,7,10,0,10,11,1,5,9,5,11,4,11,10,2,10,7,6,7,1,8,3,9,4,3,4,2,3,2,6,3,6,8,3,8,9,4,9,5,2,4,11,6,2,10,8,6,7,9,8,1];super(g,I,A,e),this.type="IcosahedronGeometry",this.parameters={radius:A,detail:e}}static fromJSON(A){return new Iv(A.radius,A.detail)}}class nv extends fi{constructor(A=[new Ze(0,-.5),new Ze(.5,0),new Ze(0,.5)],e=12,i=0,g=Math.PI*2){super(),this.type="LatheGeometry",this.parameters={points:A,segments:e,phiStart:i,phiLength:g},e=Math.floor(e),g=Ci(g,0,Math.PI*2);const I=[],n=[],o=[],a=[],r=[],s=1/e,B=new wA,c=new Ze,E=new wA,D=new wA,y=new wA;let S=0,f=0;for(let M=0;M<=A.length-1;M++)switch(M){case 0:S=A[M+1].x-A[M].x,f=A[M+1].y-A[M].y,E.x=f*1,E.y=-S,E.z=f*0,y.copy(E),E.normalize(),a.push(E.x,E.y,E.z);break;case A.length-1:a.push(y.x,y.y,y.z);break;default:S=A[M+1].x-A[M].x,f=A[M+1].y-A[M].y,E.x=f*1,E.y=-S,E.z=f*0,D.copy(E),E.x+=y.x,E.y+=y.y,E.z+=y.z,E.normalize(),a.push(E.x,E.y,E.z),y.copy(D)}for(let M=0;M<=e;M++){const k=i+M*s*g,m=Math.sin(k),U=Math.cos(k);for(let F=0;F<=A.length-1;F++){B.x=A[F].x*m,B.y=A[F].y,B.z=A[F].x*U,n.push(B.x,B.y,B.z),c.x=M/e,c.y=F/(A.length-1),o.push(c.x,c.y);const b=a[3*F+0]*m,K=a[3*F+1],R=a[3*F+0]*U;r.push(b,K,R)}}for(let M=0;M<e;M++)for(let k=0;k<A.length-1;k++){const m=k+M*A.length,U=m,F=m+A.length,b=m+A.length+1,K=m+1;I.push(U,F,K),I.push(b,K,F)}this.setIndex(I),this.setAttribute("position",new bt(n,3)),this.setAttribute("uv",new bt(o,2)),this.setAttribute("normal",new bt(r,3))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new nv(A.points,A.segments,A.phiStart,A.phiLength)}}class tM extends mu{constructor(A=1,e=0){const i=[1,0,0,-1,0,0,0,1,0,0,-1,0,0,0,1,0,0,-1],g=[0,2,4,0,4,3,0,3,5,0,5,2,1,2,5,1,5,3,1,3,4,1,4,2];super(i,g,A,e),this.type="OctahedronGeometry",this.parameters={radius:A,detail:e}}static fromJSON(A){return new tM(A.radius,A.detail)}}class iS extends fi{constructor(A=1,e=1,i=1,g=1){super(),this.type="PlaneGeometry",this.parameters={width:A,height:e,widthSegments:i,heightSegments:g};const I=A/2,n=e/2,o=Math.floor(i),a=Math.floor(g),r=o+1,s=a+1,B=A/o,c=e/a,E=[],D=[],y=[],S=[];for(let f=0;f<s;f++){const M=f*c-n;for(let k=0;k<r;k++){const m=k*B-I;D.push(m,-M,0),y.push(0,0,1),S.push(k/o),S.push(1-f/a)}}for(let f=0;f<a;f++)for(let M=0;M<o;M++){const k=M+r*f,m=M+r*(f+1),U=M+1+r*(f+1),F=M+1+r*f;E.push(k,m,F),E.push(m,U,F)}this.setIndex(E),this.setAttribute("position",new bt(D,3)),this.setAttribute("normal",new bt(y,3)),this.setAttribute("uv",new bt(S,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new iS(A.width,A.height,A.widthSegments,A.heightSegments)}}class ov extends fi{constructor(A=.5,e=1,i=32,g=1,I=0,n=Math.PI*2){super(),this.type="RingGeometry",this.parameters={innerRadius:A,outerRadius:e,thetaSegments:i,phiSegments:g,thetaStart:I,thetaLength:n},i=Math.max(3,i),g=Math.max(1,g);const o=[],a=[],r=[],s=[];let B=A;const c=(e-A)/g,E=new wA,D=new Ze;for(let y=0;y<=g;y++){for(let S=0;S<=i;S++){const f=I+S/i*n;E.x=B*Math.cos(f),E.y=B*Math.sin(f),a.push(E.x,E.y,E.z),r.push(0,0,1),D.x=(E.x/e+1)/2,D.y=(E.y/e+1)/2,s.push(D.x,D.y)}B+=c}for(let y=0;y<g;y++){const S=y*(i+1);for(let f=0;f<i;f++){const M=f+S,k=M,m=M+i+1,U=M+i+2,F=M+1;o.push(k,m,F),o.push(m,U,F)}}this.setIndex(o),this.setAttribute("position",new bt(a,3)),this.setAttribute("normal",new bt(r,3)),this.setAttribute("uv",new bt(s,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new ov(A.innerRadius,A.outerRadius,A.thetaSegments,A.phiSegments,A.thetaStart,A.thetaLength)}}class av extends fi{constructor(A=new ud([new Ze(0,.5),new Ze(-.5,-.5),new Ze(.5,-.5)]),e=12){super(),this.type="ShapeGeometry",this.parameters={shapes:A,curveSegments:e};const i=[],g=[],I=[],n=[];let o=0,a=0;if(Array.isArray(A)===!1)r(A);else for(let s=0;s<A.length;s++)r(A[s]),this.addGroup(o,a,s),o+=a,a=0;this.setIndex(i),this.setAttribute("position",new bt(g,3)),this.setAttribute("normal",new bt(I,3)),this.setAttribute("uv",new bt(n,2));function r(s){const B=g.length/3,c=s.extractPoints(e);let E=c.shape;const D=c.holes;lB.isClockWise(E)===!1&&(E=E.reverse());for(let S=0,f=D.length;S<f;S++){const M=D[S];lB.isClockWise(M)===!0&&(D[S]=M.reverse())}const y=lB.triangulateShape(E,D);for(let S=0,f=D.length;S<f;S++){const M=D[S];E=E.concat(M)}for(let S=0,f=E.length;S<f;S++){const M=E[S];g.push(M.x,M.y,0),I.push(0,0,1),n.push(M.x,M.y)}for(let S=0,f=y.length;S<f;S++){const M=y[S],k=M[0]+B,m=M[1]+B,U=M[2]+B;i.push(k,m,U),a+=3}}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}toJSON(){const A=super.toJSON(),e=this.parameters.shapes;return KOA(e,A)}static fromJSON(A,e){const i=[];for(let g=0,I=A.shapes.length;g<I;g++){const n=e[A.shapes[g]];i.push(n)}return new av(i,A.curveSegments)}}function KOA(t,A){if(A.shapes=[],Array.isArray(t))for(let e=0,i=t.length;e<i;e++){const g=t[e];A.shapes.push(g.uuid)}else A.shapes.push(t.uuid);return A}class iM extends fi{constructor(A=1,e=32,i=16,g=0,I=Math.PI*2,n=0,o=Math.PI){super(),this.type="SphereGeometry",this.parameters={radius:A,widthSegments:e,heightSegments:i,phiStart:g,phiLength:I,thetaStart:n,thetaLength:o},e=Math.max(3,Math.floor(e)),i=Math.max(2,Math.floor(i));const a=Math.min(n+o,Math.PI);let r=0;const s=[],B=new wA,c=new wA,E=[],D=[],y=[],S=[];for(let f=0;f<=i;f++){const M=[],k=f/i;let m=0;f===0&&n===0?m=.5/e:f===i&&a===Math.PI&&(m=-.5/e);for(let U=0;U<=e;U++){const F=U/e;B.x=-A*Math.cos(g+F*I)*Math.sin(n+k*o),B.y=A*Math.cos(n+k*o),B.z=A*Math.sin(g+F*I)*Math.sin(n+k*o),D.push(B.x,B.y,B.z),c.copy(B).normalize(),y.push(c.x,c.y,c.z),S.push(F+m,1-k),M.push(r++)}s.push(M)}for(let f=0;f<i;f++)for(let M=0;M<e;M++){const k=s[f][M+1],m=s[f][M],U=s[f+1][M],F=s[f+1][M+1];(f!==0||n>0)&&E.push(k,m,F),(f!==i-1||a<Math.PI)&&E.push(m,U,F)}this.setIndex(E),this.setAttribute("position",new bt(D,3)),this.setAttribute("normal",new bt(y,3)),this.setAttribute("uv",new bt(S,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new iM(A.radius,A.widthSegments,A.heightSegments,A.phiStart,A.phiLength,A.thetaStart,A.thetaLength)}}class rv extends mu{constructor(A=1,e=0){const i=[1,1,1,-1,-1,1,-1,1,-1,1,-1,-1],g=[2,1,0,0,3,2,1,3,0,2,3,1];super(i,g,A,e),this.type="TetrahedronGeometry",this.parameters={radius:A,detail:e}}static fromJSON(A){return new rv(A.radius,A.detail)}}class sv extends fi{constructor(A=1,e=.4,i=12,g=48,I=Math.PI*2){super(),this.type="TorusGeometry",this.parameters={radius:A,tube:e,radialSegments:i,tubularSegments:g,arc:I},i=Math.floor(i),g=Math.floor(g);const n=[],o=[],a=[],r=[],s=new wA,B=new wA,c=new wA;for(let E=0;E<=i;E++)for(let D=0;D<=g;D++){const y=D/g*I,S=E/i*Math.PI*2;B.x=(A+e*Math.cos(S))*Math.cos(y),B.y=(A+e*Math.cos(S))*Math.sin(y),B.z=e*Math.sin(S),o.push(B.x,B.y,B.z),s.x=A*Math.cos(y),s.y=A*Math.sin(y),c.subVectors(B,s).normalize(),a.push(c.x,c.y,c.z),r.push(D/g),r.push(E/i)}for(let E=1;E<=i;E++)for(let D=1;D<=g;D++){const y=(g+1)*E+D-1,S=(g+1)*(E-1)+D-1,f=(g+1)*(E-1)+D,M=(g+1)*E+D;n.push(y,S,M),n.push(S,f,M)}this.setIndex(n),this.setAttribute("position",new bt(o,3)),this.setAttribute("normal",new bt(a,3)),this.setAttribute("uv",new bt(r,2))}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new sv(A.radius,A.tube,A.radialSegments,A.tubularSegments,A.arc)}}class Cv extends fi{constructor(A=1,e=.4,i=64,g=8,I=2,n=3){super(),this.type="TorusKnotGeometry",this.parameters={radius:A,tube:e,tubularSegments:i,radialSegments:g,p:I,q:n},i=Math.floor(i),g=Math.floor(g);const o=[],a=[],r=[],s=[],B=new wA,c=new wA,E=new wA,D=new wA,y=new wA,S=new wA,f=new wA;for(let k=0;k<=i;++k){const m=k/i*I*Math.PI*2;M(m,I,n,A,E),M(m+.01,I,n,A,D),S.subVectors(D,E),f.addVectors(D,E),y.crossVectors(S,f),f.crossVectors(y,S),y.normalize(),f.normalize();for(let U=0;U<=g;++U){const F=U/g*Math.PI*2,b=-e*Math.cos(F),K=e*Math.sin(F);B.x=E.x+(b*f.x+K*y.x),B.y=E.y+(b*f.y+K*y.y),B.z=E.z+(b*f.z+K*y.z),a.push(B.x,B.y,B.z),c.subVectors(B,E).normalize(),r.push(c.x,c.y,c.z),s.push(k/i),s.push(U/g)}}for(let k=1;k<=i;k++)for(let m=1;m<=g;m++){const U=(g+1)*(k-1)+(m-1),F=(g+1)*k+(m-1),b=(g+1)*k+m,K=(g+1)*(k-1)+m;o.push(U,F,K),o.push(F,b,K)}this.setIndex(o),this.setAttribute("position",new bt(a,3)),this.setAttribute("normal",new bt(r,3)),this.setAttribute("uv",new bt(s,2));function M(k,m,U,F,b){const K=Math.cos(k),R=Math.sin(k),G=U/m*k,J=Math.cos(G);b.x=F*(2+J)*.5*K,b.y=F*(2+J)*R*.5,b.z=F*Math.sin(G)*.5}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}static fromJSON(A){return new Cv(A.radius,A.tube,A.tubularSegments,A.radialSegments,A.p,A.q)}}class Bv extends fi{constructor(A=new Q1(new wA(-1,-1,0),new wA(-1,1,0),new wA(1,1,0)),e=64,i=1,g=8,I=!1){super(),this.type="TubeGeometry",this.parameters={path:A,tubularSegments:e,radius:i,radialSegments:g,closed:I};const n=A.computeFrenetFrames(e,I);this.tangents=n.tangents,this.normals=n.normals,this.binormals=n.binormals;const o=new wA,a=new wA,r=new Ze;let s=new wA;const B=[],c=[],E=[],D=[];y(),this.setIndex(D),this.setAttribute("position",new bt(B,3)),this.setAttribute("normal",new bt(c,3)),this.setAttribute("uv",new bt(E,2));function y(){for(let k=0;k<e;k++)S(k);S(I===!1?e:0),M(),f()}function S(k){s=A.getPointAt(k/e,s);const m=n.normals[k],U=n.binormals[k];for(let F=0;F<=g;F++){const b=F/g*Math.PI*2,K=Math.sin(b),R=-Math.cos(b);a.x=R*m.x+K*U.x,a.y=R*m.y+K*U.y,a.z=R*m.z+K*U.z,a.normalize(),c.push(a.x,a.y,a.z),o.x=s.x+i*a.x,o.y=s.y+i*a.y,o.z=s.z+i*a.z,B.push(o.x,o.y,o.z)}}function f(){for(let k=1;k<=e;k++)for(let m=1;m<=g;m++){const U=(g+1)*(k-1)+(m-1),F=(g+1)*k+(m-1),b=(g+1)*k+m,K=(g+1)*(k-1)+m;D.push(U,F,K),D.push(F,b,K)}}function M(){for(let k=0;k<=e;k++)for(let m=0;m<=g;m++)r.x=k/e,r.y=m/g,E.push(r.x,r.y)}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}toJSON(){const A=super.toJSON();return A.path=this.parameters.path.toJSON(),A}static fromJSON(A){return new Bv(new AF[A.path.type]().fromJSON(A.path),A.tubularSegments,A.radius,A.radialSegments,A.closed)}}class xnA extends fi{constructor(A=null){if(super(),this.type="WireframeGeometry",this.parameters={geometry:A},A!==null){const e=[],i=new Set,g=new wA,I=new wA;if(A.index!==null){const n=A.attributes.position,o=A.index;let a=A.groups;a.length===0&&(a=[{start:0,count:o.count,materialIndex:0}]);for(let r=0,s=a.length;r<s;++r){const B=a[r],c=B.start,E=B.count;for(let D=c,y=c+E;D<y;D+=3)for(let S=0;S<3;S++){const f=o.getX(D+S),M=o.getX(D+(S+1)%3);g.fromBufferAttribute(n,f),I.fromBufferAttribute(n,M),wV(g,I,i)===!0&&(e.push(g.x,g.y,g.z),e.push(I.x,I.y,I.z))}}}else{const n=A.attributes.position;for(let o=0,a=n.count/3;o<a;o++)for(let r=0;r<3;r++){const s=3*o+r,B=3*o+(r+1)%3;g.fromBufferAttribute(n,s),I.fromBufferAttribute(n,B),wV(g,I,i)===!0&&(e.push(g.x,g.y,g.z),e.push(I.x,I.y,I.z))}}this.setAttribute("position",new bt(e,3))}}copy(A){return super.copy(A),this.parameters=Object.assign({},A.parameters),this}}function wV(t,A,e){const i=`${t.x},${t.y},${t.z}-${A.x},${A.y},${A.z}`,g=`${A.x},${A.y},${A.z}-${t.x},${t.y},${t.z}`;return e.has(i)===!0||e.has(g)===!0?!1:(e.add(i),e.add(g),!0)}var mV=Object.freeze({__proto__:null,BoxGeometry:cp,CapsuleGeometry:Av,CircleGeometry:ev,ConeGeometry:eM,CylinderGeometry:AM,DodecahedronGeometry:tv,EdgesGeometry:RnA,ExtrudeGeometry:gv,IcosahedronGeometry:Iv,LatheGeometry:nv,OctahedronGeometry:tM,PlaneGeometry:iS,PolyhedronGeometry:mu,RingGeometry:ov,ShapeGeometry:av,SphereGeometry:iM,TetrahedronGeometry:rv,TorusGeometry:sv,TorusKnotGeometry:Cv,TubeGeometry:Bv,WireframeGeometry:xnA});class TnA extends Wn{constructor(A){super(),this.isShadowMaterial=!0,this.type="ShadowMaterial",this.color=new wt(0),this.transparent=!0,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.fog=A.fog,this}}class YnA extends EC{constructor(A){super(A),this.isRawShaderMaterial=!0,this.type="RawShaderMaterial"}}class vd extends Wn{constructor(A){super(),this.isMeshStandardMaterial=!0,this.type="MeshStandardMaterial",this.defines={STANDARD:""},this.color=new wt(16777215),this.roughness=1,this.metalness=0,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wu,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.roughnessMap=null,this.metalnessMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wo,this.envMapIntensity=1,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.defines={STANDARD:""},this.color.copy(A.color),this.roughness=A.roughness,this.metalness=A.metalness,this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.roughnessMap=A.roughnessMap,this.metalnessMap=A.metalnessMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.envMapIntensity=A.envMapIntensity,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.flatShading=A.flatShading,this.fog=A.fog,this}}class pC extends vd{constructor(A){super(),this.isMeshPhysicalMaterial=!0,this.defines={STANDARD:"",PHYSICAL:""},this.type="MeshPhysicalMaterial",this.anisotropyRotation=0,this.anisotropyMap=null,this.clearcoatMap=null,this.clearcoatRoughness=0,this.clearcoatRoughnessMap=null,this.clearcoatNormalScale=new Ze(1,1),this.clearcoatNormalMap=null,this.ior=1.5,Object.defineProperty(this,"reflectivity",{get:function(){return Ci(2.5*(this.ior-1)/(this.ior+1),0,1)},set:function(e){this.ior=(1+.4*e)/(1-.4*e)}}),this.iridescenceMap=null,this.iridescenceIOR=1.3,this.iridescenceThicknessRange=[100,400],this.iridescenceThicknessMap=null,this.sheenColor=new wt(0),this.sheenColorMap=null,this.sheenRoughness=1,this.sheenRoughnessMap=null,this.transmissionMap=null,this.thickness=0,this.thicknessMap=null,this.attenuationDistance=1/0,this.attenuationColor=new wt(1,1,1),this.specularIntensity=1,this.specularIntensityMap=null,this.specularColor=new wt(1,1,1),this.specularColorMap=null,this._anisotropy=0,this._clearcoat=0,this._dispersion=0,this._iridescence=0,this._sheen=0,this._transmission=0,this.setValues(A)}get anisotropy(){return this._anisotropy}set anisotropy(A){this._anisotropy>0!=A>0&&this.version++,this._anisotropy=A}get clearcoat(){return this._clearcoat}set clearcoat(A){this._clearcoat>0!=A>0&&this.version++,this._clearcoat=A}get iridescence(){return this._iridescence}set iridescence(A){this._iridescence>0!=A>0&&this.version++,this._iridescence=A}get dispersion(){return this._dispersion}set dispersion(A){this._dispersion>0!=A>0&&this.version++,this._dispersion=A}get sheen(){return this._sheen}set sheen(A){this._sheen>0!=A>0&&this.version++,this._sheen=A}get transmission(){return this._transmission}set transmission(A){this._transmission>0!=A>0&&this.version++,this._transmission=A}copy(A){return super.copy(A),this.defines={STANDARD:"",PHYSICAL:""},this.anisotropy=A.anisotropy,this.anisotropyRotation=A.anisotropyRotation,this.anisotropyMap=A.anisotropyMap,this.clearcoat=A.clearcoat,this.clearcoatMap=A.clearcoatMap,this.clearcoatRoughness=A.clearcoatRoughness,this.clearcoatRoughnessMap=A.clearcoatRoughnessMap,this.clearcoatNormalMap=A.clearcoatNormalMap,this.clearcoatNormalScale.copy(A.clearcoatNormalScale),this.dispersion=A.dispersion,this.ior=A.ior,this.iridescence=A.iridescence,this.iridescenceMap=A.iridescenceMap,this.iridescenceIOR=A.iridescenceIOR,this.iridescenceThicknessRange=[...A.iridescenceThicknessRange],this.iridescenceThicknessMap=A.iridescenceThicknessMap,this.sheen=A.sheen,this.sheenColor.copy(A.sheenColor),this.sheenColorMap=A.sheenColorMap,this.sheenRoughness=A.sheenRoughness,this.sheenRoughnessMap=A.sheenRoughnessMap,this.transmission=A.transmission,this.transmissionMap=A.transmissionMap,this.thickness=A.thickness,this.thicknessMap=A.thicknessMap,this.attenuationDistance=A.attenuationDistance,this.attenuationColor.copy(A.attenuationColor),this.specularIntensity=A.specularIntensity,this.specularIntensityMap=A.specularIntensityMap,this.specularColor.copy(A.specularColor),this.specularColorMap=A.specularColorMap,this}}class HnA extends Wn{constructor(A){super(),this.isMeshPhongMaterial=!0,this.type="MeshPhongMaterial",this.color=new wt(16777215),this.specular=new wt(1118481),this.shininess=30,this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wu,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wo,this.combine=Zk,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.specular.copy(A.specular),this.shininess=A.shininess,this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.flatShading=A.flatShading,this.fog=A.fog,this}}class OnA extends Wn{constructor(A){super(),this.isMeshToonMaterial=!0,this.defines={TOON:""},this.type="MeshToonMaterial",this.color=new wt(16777215),this.map=null,this.gradientMap=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wu,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.gradientMap=A.gradientMap,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.alphaMap=A.alphaMap,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.fog=A.fog,this}}class PnA extends Wn{constructor(A){super(),this.isMeshNormalMaterial=!0,this.type="MeshNormalMaterial",this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wu,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.flatShading=!1,this.setValues(A)}copy(A){return super.copy(A),this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.flatShading=A.flatShading,this}}class jnA extends Wn{constructor(A){super(),this.isMeshLambertMaterial=!0,this.type="MeshLambertMaterial",this.color=new wt(16777215),this.map=null,this.lightMap=null,this.lightMapIntensity=1,this.aoMap=null,this.aoMapIntensity=1,this.emissive=new wt(0),this.emissiveIntensity=1,this.emissiveMap=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wu,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.specularMap=null,this.alphaMap=null,this.envMap=null,this.envMapRotation=new Wo,this.combine=Zk,this.reflectivity=1,this.refractionRatio=.98,this.wireframe=!1,this.wireframeLinewidth=1,this.wireframeLinecap="round",this.wireframeLinejoin="round",this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.color.copy(A.color),this.map=A.map,this.lightMap=A.lightMap,this.lightMapIntensity=A.lightMapIntensity,this.aoMap=A.aoMap,this.aoMapIntensity=A.aoMapIntensity,this.emissive.copy(A.emissive),this.emissiveMap=A.emissiveMap,this.emissiveIntensity=A.emissiveIntensity,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.specularMap=A.specularMap,this.alphaMap=A.alphaMap,this.envMap=A.envMap,this.envMapRotation.copy(A.envMapRotation),this.combine=A.combine,this.reflectivity=A.reflectivity,this.refractionRatio=A.refractionRatio,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this.wireframeLinecap=A.wireframeLinecap,this.wireframeLinejoin=A.wireframeLinejoin,this.flatShading=A.flatShading,this.fog=A.fog,this}}class u1 extends Wn{constructor(A){super(),this.isMeshDepthMaterial=!0,this.type="MeshDepthMaterial",this.depthPacking=anA,this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.wireframe=!1,this.wireframeLinewidth=1,this.setValues(A)}copy(A){return super.copy(A),this.depthPacking=A.depthPacking,this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.wireframe=A.wireframe,this.wireframeLinewidth=A.wireframeLinewidth,this}}class h1 extends Wn{constructor(A){super(),this.isMeshDistanceMaterial=!0,this.type="MeshDistanceMaterial",this.map=null,this.alphaMap=null,this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.setValues(A)}copy(A){return super.copy(A),this.map=A.map,this.alphaMap=A.alphaMap,this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this}}class ZnA extends Wn{constructor(A){super(),this.isMeshMatcapMaterial=!0,this.defines={MATCAP:""},this.type="MeshMatcapMaterial",this.color=new wt(16777215),this.matcap=null,this.map=null,this.bumpMap=null,this.bumpScale=1,this.normalMap=null,this.normalMapType=wu,this.normalScale=new Ze(1,1),this.displacementMap=null,this.displacementScale=1,this.displacementBias=0,this.alphaMap=null,this.flatShading=!1,this.fog=!0,this.setValues(A)}copy(A){return super.copy(A),this.defines={MATCAP:""},this.color.copy(A.color),this.matcap=A.matcap,this.map=A.map,this.bumpMap=A.bumpMap,this.bumpScale=A.bumpScale,this.normalMap=A.normalMap,this.normalMapType=A.normalMapType,this.normalScale.copy(A.normalScale),this.displacementMap=A.displacementMap,this.displacementScale=A.displacementScale,this.displacementBias=A.displacementBias,this.alphaMap=A.alphaMap,this.flatShading=A.flatShading,this.fog=A.fog,this}}class WnA extends ya{constructor(A){super(),this.isLineDashedMaterial=!0,this.type="LineDashedMaterial",this.scale=1,this.dashSize=3,this.gapSize=1,this.setValues(A)}copy(A){return super.copy(A),this.scale=A.scale,this.dashSize=A.dashSize,this.gapSize=A.gapSize,this}}function Ad(t,A){return!t||t.constructor===A?t:typeof A.BYTES_PER_ELEMENT=="number"?new A(t):Array.prototype.slice.call(t)}function znA(t){return ArrayBuffer.isView(t)&&!(t instanceof DataView)}function VnA(t){function A(g,I){return t[g]-t[I]}const e=t.length,i=new Array(e);for(let g=0;g!==e;++g)i[g]=g;return i.sort(A),i}function FY(t,A,e){const i=t.length,g=new t.constructor(i);for(let I=0,n=0;n!==i;++I){const o=e[I]*A;for(let a=0;a!==A;++a)g[n++]=t[o+a]}return g}function d1(t,A,e,i){let g=1,I=t[0];for(;I!==void 0&&I[i]===void 0;)I=t[g++];if(I===void 0)return;let n=I[i];if(n!==void 0)if(Array.isArray(n))do n=I[i],n!==void 0&&(A.push(I.time),e.push(...n)),I=t[g++];while(I!==void 0);else if(n.toArray!==void 0)do n=I[i],n!==void 0&&(A.push(I.time),n.toArray(e,e.length)),I=t[g++];while(I!==void 0);else do n=I[i],n!==void 0&&(A.push(I.time),e.push(n)),I=t[g++];while(I!==void 0)}function FOA(t,A,e,i,g=30){const I=t.clone();I.name=A;const n=[];for(let a=0;a<I.tracks.length;++a){const r=I.tracks[a],s=r.getValueSize(),B=[],c=[];for(let E=0;E<r.times.length;++E){const D=r.times[E]*g;if(!(D<e||D>=i)){B.push(r.times[E]);for(let y=0;y<s;++y)c.push(r.values[E*s+y])}}B.length!==0&&(r.times=Ad(B,r.times.constructor),r.values=Ad(c,r.values.constructor),n.push(r))}I.tracks=n;let o=1/0;for(let a=0;a<I.tracks.length;++a)o>I.tracks[a].times[0]&&(o=I.tracks[a].times[0]);for(let a=0;a<I.tracks.length;++a)I.tracks[a].shift(-1*o);return I.resetDuration(),I}function bOA(t,A=0,e=t,i=30){i<=0&&(i=30);const g=e.tracks.length,I=A/i;for(let n=0;n<g;++n){const o=e.tracks[n],a=o.ValueTypeName;if(a==="bool"||a==="string")continue;const r=t.tracks.find(function(f){return f.name===o.name&&f.ValueTypeName===a});if(r===void 0)continue;let s=0;const B=o.getValueSize();o.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(s=B/3);let c=0;const E=r.getValueSize();r.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline&&(c=E/3);const D=o.times.length-1;let y;if(I<=o.times[0]){const f=s,M=B-s;y=o.values.slice(f,M)}else if(I>=o.times[D]){const f=D*B+s,M=f+B-s;y=o.values.slice(f,M)}else{const f=o.createInterpolant(),M=s,k=B-s;f.evaluate(I),y=f.resultBuffer.slice(M,k)}a==="quaternion"&&new Kn().fromArray(y).normalize().conjugate().toArray(y);const S=r.times.length;for(let f=0;f<S;++f){const M=f*E+c;if(a==="quaternion")Kn.multiplyQuaternionsFlat(r.values,M,y,0,r.values,M);else{const k=E-c*2;for(let m=0;m<k;++m)r.values[M+m]-=y[m]}}}return t.blendMode=WP,t}class vOA{static convertArray(A,e){return Ad(A,e)}static isTypedArray(A){return znA(A)}static getKeyframeOrder(A){return VnA(A)}static sortedArray(A,e,i){return FY(A,e,i)}static flattenJSON(A,e,i,g){d1(A,e,i,g)}static subclip(A,e,i,g,I=30){return FOA(A,e,i,g,I)}static makeClipAdditive(A,e=0,i=A,g=30){return bOA(A,e,i,g)}}class gS{constructor(A,e,i,g){this.parameterPositions=A,this._cachedIndex=0,this.resultBuffer=g!==void 0?g:new e.constructor(i),this.sampleValues=e,this.valueSize=i,this.settings=null,this.DefaultSettings_={}}evaluate(A){const e=this.parameterPositions;let i=this._cachedIndex,g=e[i],I=e[i-1];A:{e:{let n;t:{i:if(!(A<g)){for(let o=i+2;;){if(g===void 0){if(A<I)break i;return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}if(i===o)break;if(I=g,g=e[++i],A<g)break e}n=e.length;break t}if(!(A>=I)){const o=e[1];A<o&&(i=2,I=o);for(let a=i-2;;){if(I===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(i===a)break;if(g=I,I=e[--i-1],A>=I)break e}n=i,i=0;break t}break A}for(;i<n;){const o=i+n>>>1;A<e[o]?n=o:i=o+1}if(g=e[i],I=e[i-1],I===void 0)return this._cachedIndex=0,this.copySampleValue_(0);if(g===void 0)return i=e.length,this._cachedIndex=i,this.copySampleValue_(i-1)}this._cachedIndex=i,this.intervalChanged_(i,I,g)}return this.interpolate_(i,I,A,g)}getSettings_(){return this.settings||this.DefaultSettings_}copySampleValue_(A){const e=this.resultBuffer,i=this.sampleValues,g=this.valueSize,I=A*g;for(let n=0;n!==g;++n)e[n]=i[I+n];return e}interpolate_(){throw new Error("call to abstract method")}intervalChanged_(){}}class XnA extends gS{constructor(A,e,i,g){super(A,e,i,g),this._weightPrev=-0,this._offsetPrev=-0,this._weightNext=-0,this._offsetNext=-0,this.DefaultSettings_={endingStart:Xh,endingEnd:Xh}}intervalChanged_(A,e,i){const g=this.parameterPositions;let I=A-2,n=A+1,o=g[I],a=g[n];if(o===void 0)switch(this.getSettings_().endingStart){case $h:I=A,o=2*e-i;break;case x0:I=g.length-2,o=e+g[I]-g[I+1];break;default:I=A,o=i}if(a===void 0)switch(this.getSettings_().endingEnd){case $h:n=A,a=2*i-e;break;case x0:n=1,a=i+g[1]-g[0];break;default:n=A-1,a=e}const r=(i-e)*.5,s=this.valueSize;this._weightPrev=r/(e-o),this._weightNext=r/(a-i),this._offsetPrev=I*s,this._offsetNext=n*s}interpolate_(A,e,i,g){const I=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=A*o,r=a-o,s=this._offsetPrev,B=this._offsetNext,c=this._weightPrev,E=this._weightNext,D=(i-e)/(g-e),y=D*D,S=y*D,f=-c*S+2*c*y-c*D,M=(1+c)*S+(-1.5-2*c)*y+(-.5+c)*D+1,k=(-1-E)*S+(1.5+E)*y+.5*D,m=E*S-E*y;for(let U=0;U!==o;++U)I[U]=f*n[s+U]+M*n[r+U]+k*n[a+U]+m*n[B+U];return I}}class p1 extends gS{constructor(A,e,i,g){super(A,e,i,g)}interpolate_(A,e,i,g){const I=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=A*o,r=a-o,s=(i-e)/(g-e),B=1-s;for(let c=0;c!==o;++c)I[c]=n[r+c]*B+n[a+c]*s;return I}}class $nA extends gS{constructor(A,e,i,g){super(A,e,i,g)}interpolate_(A){return this.copySampleValue_(A-1)}}class fC{constructor(A,e,i,g){if(A===void 0)throw new Error("THREE.KeyframeTrack: track name is undefined");if(e===void 0||e.length===0)throw new Error("THREE.KeyframeTrack: no keyframes in track named "+A);this.name=A,this.times=Ad(e,this.TimeBufferType),this.values=Ad(i,this.ValueBufferType),this.setInterpolation(g||this.DefaultInterpolation)}static toJSON(A){const e=A.constructor;let i;if(e.toJSON!==this.toJSON)i=e.toJSON(A);else{i={name:A.name,times:Ad(A.times,Array),values:Ad(A.values,Array)};const g=A.getInterpolation();g!==A.DefaultInterpolation&&(i.interpolation=g)}return i.type=A.ValueTypeName,i}InterpolantFactoryMethodDiscrete(A){return new $nA(this.times,this.values,this.getValueSize(),A)}InterpolantFactoryMethodLinear(A){return new p1(this.times,this.values,this.getValueSize(),A)}InterpolantFactoryMethodSmooth(A){return new XnA(this.times,this.values,this.getValueSize(),A)}setInterpolation(A){let e;switch(A){case uy:e=this.InterpolantFactoryMethodDiscrete;break;case hy:e=this.InterpolantFactoryMethodLinear;break;case WR:e=this.InterpolantFactoryMethodSmooth;break}if(e===void 0){const i="unsupported interpolation for "+this.ValueTypeName+" keyframe track named "+this.name;if(this.createInterpolant===void 0)if(A!==this.DefaultInterpolation)this.setInterpolation(this.DefaultInterpolation);else throw new Error(i);return this}return this.createInterpolant=e,this}getInterpolation(){switch(this.createInterpolant){case this.InterpolantFactoryMethodDiscrete:return uy;case this.InterpolantFactoryMethodLinear:return hy;case this.InterpolantFactoryMethodSmooth:return WR}}getValueSize(){return this.values.length/this.times.length}shift(A){if(A!==0){const e=this.times;for(let i=0,g=e.length;i!==g;++i)e[i]+=A}return this}scale(A){if(A!==1){const e=this.times;for(let i=0,g=e.length;i!==g;++i)e[i]*=A}return this}trim(A,e){const i=this.times,g=i.length;let I=0,n=g-1;for(;I!==g&&i[I]<A;)++I;for(;n!==-1&&i[n]>e;)--n;if(++n,I!==0||n!==g){I>=n&&(n=Math.max(n,1),I=n-1);const o=this.getValueSize();this.times=i.slice(I,n),this.values=this.values.slice(I*o,n*o)}return this}validate(){let A=!0;const e=this.getValueSize();e-Math.floor(e)!==0&&(A=!1);const i=this.times,g=this.values,I=i.length;I===0&&(A=!1);let n=null;for(let o=0;o!==I;o++){const a=i[o];if(typeof a=="number"&&isNaN(a)){A=!1;break}if(n!==null&&n>a){A=!1;break}n=a}if(g!==void 0&&znA(g))for(let o=0,a=g.length;o!==a;++o){const r=g[o];if(isNaN(r)){A=!1;break}}return A}optimize(){const A=this.times.slice(),e=this.values.slice(),i=this.getValueSize(),g=this.getInterpolation()===WR,I=A.length-1;let n=1;for(let o=1;o<I;++o){let a=!1;const r=A[o],s=A[o+1];if(r!==s&&(o!==1||r!==A[0]))if(g)a=!0;else{const B=o*i,c=B-i,E=B+i;for(let D=0;D!==i;++D){const y=e[B+D];if(y!==e[c+D]||y!==e[E+D]){a=!0;break}}}if(a){if(o!==n){A[n]=A[o];const B=o*i,c=n*i;for(let E=0;E!==i;++E)e[c+E]=e[B+E]}++n}}if(I>0){A[n]=A[I];for(let o=I*i,a=n*i,r=0;r!==i;++r)e[a+r]=e[o+r];++n}return n!==A.length?(this.times=A.slice(0,n),this.values=e.slice(0,n*i)):(this.times=A,this.values=e),this}clone(){const A=this.times.slice(),e=this.values.slice(),i=this.constructor,g=new i(this.name,A,e);return g.createInterpolant=this.createInterpolant,g}}fC.prototype.ValueTypeName="";fC.prototype.TimeBufferType=Float32Array;fC.prototype.ValueBufferType=Float32Array;fC.prototype.DefaultInterpolation=hy;class lp extends fC{constructor(A,e,i){super(A,e,i)}}lp.prototype.ValueTypeName="bool";lp.prototype.ValueBufferType=Array;lp.prototype.DefaultInterpolation=uy;lp.prototype.InterpolantFactoryMethodLinear=void 0;lp.prototype.InterpolantFactoryMethodSmooth=void 0;class f1 extends fC{constructor(A,e,i,g){super(A,e,i,g)}}f1.prototype.ValueTypeName="color";class _d extends fC{constructor(A,e,i,g){super(A,e,i,g)}}_d.prototype.ValueTypeName="number";class AoA extends gS{constructor(A,e,i,g){super(A,e,i,g)}interpolate_(A,e,i,g){const I=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=(i-e)/(g-e);let r=A*o;for(let s=r+o;r!==s;r+=4)Kn.slerpFlat(I,0,n,r-o,n,r,a);return I}}class Jd extends fC{constructor(A,e,i,g){super(A,e,i,g)}InterpolantFactoryMethodLinear(A){return new AoA(this.times,this.values,this.getValueSize(),A)}}Jd.prototype.ValueTypeName="quaternion";Jd.prototype.InterpolantFactoryMethodSmooth=void 0;class Qp extends fC{constructor(A,e,i){super(A,e,i)}}Qp.prototype.ValueTypeName="string";Qp.prototype.ValueBufferType=Array;Qp.prototype.DefaultInterpolation=uy;Qp.prototype.InterpolantFactoryMethodLinear=void 0;Qp.prototype.InterpolantFactoryMethodSmooth=void 0;class Ld extends fC{constructor(A,e,i,g){super(A,e,i,g)}}Ld.prototype.ValueTypeName="vector";class Sy{constructor(A="",e=-1,i=[],g=Yb){this.name=A,this.tracks=i,this.duration=e,this.blendMode=g,this.uuid=Qs(),this.userData={},this.duration<0&&this.resetDuration()}static parse(A){const e=[],i=A.tracks,g=1/(A.fps||1);for(let n=0,o=i.length;n!==o;++n)e.push(JOA(i[n]).scale(g));const I=new this(A.name,A.duration,e,A.blendMode);return I.uuid=A.uuid,I.userData=JSON.parse(A.userData||"{}"),I}static toJSON(A){const e=[],i=A.tracks,g={name:A.name,duration:A.duration,tracks:e,uuid:A.uuid,blendMode:A.blendMode,userData:JSON.stringify(A.userData)};for(let I=0,n=i.length;I!==n;++I)e.push(fC.toJSON(i[I]));return g}static CreateFromMorphTargetSequence(A,e,i,g){const I=e.length,n=[];for(let o=0;o<I;o++){let a=[],r=[];a.push((o+I-1)%I,o,(o+1)%I),r.push(0,1,0);const s=VnA(a);a=FY(a,1,s),r=FY(r,1,s),!g&&a[0]===0&&(a.push(I),r.push(r[0])),n.push(new _d(".morphTargetInfluences["+e[o].name+"]",a,r).scale(1/i))}return new this(A,-1,n)}static findByName(A,e){let i=A;if(!Array.isArray(A)){const g=A;i=g.geometry&&g.geometry.animations||g.animations}for(let g=0;g<i.length;g++)if(i[g].name===e)return i[g];return null}static CreateClipsFromMorphTargetSequences(A,e,i){const g={},I=/^([\w-]*?)([\d]+)$/;for(let o=0,a=A.length;o<a;o++){const r=A[o],s=r.name.match(I);if(s&&s.length>1){const B=s[1];let c=g[B];c||(g[B]=c=[]),c.push(r)}}const n=[];for(const o in g)n.push(this.CreateFromMorphTargetSequence(o,g[o],e,i));return n}static parseAnimation(A,e){if(!A)return null;const i=function(B,c,E,D,y){if(E.length!==0){const S=[],f=[];d1(E,S,f,D),S.length!==0&&y.push(new B(c,S,f))}},g=[],I=A.name||"default",n=A.fps||30,o=A.blendMode;let a=A.length||-1;const r=A.hierarchy||[];for(let B=0;B<r.length;B++){const c=r[B].keys;if(!(!c||c.length===0))if(c[0].morphTargets){const E={};let D;for(D=0;D<c.length;D++)if(c[D].morphTargets)for(let y=0;y<c[D].morphTargets.length;y++)E[c[D].morphTargets[y]]=-1;for(const y in E){const S=[],f=[];for(let M=0;M!==c[D].morphTargets.length;++M){const k=c[D];S.push(k.time),f.push(k.morphTarget===y?1:0)}g.push(new _d(".morphTargetInfluence["+y+"]",S,f))}a=E.length*n}else{const E=".bones["+e[B].name+"]";i(Ld,E+".position",c,"pos",g),i(Jd,E+".quaternion",c,"rot",g),i(Ld,E+".scale",c,"scl",g)}}return g.length===0?null:new this(I,a,g,o)}resetDuration(){const A=this.tracks;let e=0;for(let i=0,g=A.length;i!==g;++i){const I=this.tracks[i];e=Math.max(e,I.times[I.times.length-1])}return this.duration=e,this}trim(){for(let A=0;A<this.tracks.length;A++)this.tracks[A].trim(0,this.duration);return this}validate(){let A=!0;for(let e=0;e<this.tracks.length;e++)A=A&&this.tracks[e].validate();return A}optimize(){for(let A=0;A<this.tracks.length;A++)this.tracks[A].optimize();return this}clone(){const A=[];for(let i=0;i<this.tracks.length;i++)A.push(this.tracks[i].clone());const e=new this.constructor(this.name,this.duration,A,this.blendMode);return e.userData=JSON.parse(JSON.stringify(this.userData)),e}toJSON(){return this.constructor.toJSON(this)}}function _OA(t){switch(t.toLowerCase()){case"scalar":case"double":case"float":case"number":case"integer":return _d;case"vector":case"vector2":case"vector3":case"vector4":return Ld;case"color":return f1;case"quaternion":return Jd;case"bool":case"boolean":return lp;case"string":return Qp}throw new Error("THREE.KeyframeTrack: Unsupported typeName: "+t)}function JOA(t){if(t.type===void 0)throw new Error("THREE.KeyframeTrack: track type undefined, can not parse");const A=_OA(t.type);if(t.times===void 0){const e=[],i=[];d1(t.keys,e,i,"value"),t.times=e,t.values=i}return A.parse!==void 0?A.parse(t):new A(t.name,t.times,t.values,t.interpolation)}const bc={enabled:!1,files:{},add:function(t,A){this.enabled!==!1&&(this.files[t]=A)},get:function(t){if(this.enabled!==!1)return this.files[t]},remove:function(t){delete this.files[t]},clear:function(){this.files={}}};class D1{constructor(A,e,i){const g=this;let I=!1,n=0,o=0,a;const r=[];this.onStart=void 0,this.onLoad=A,this.onProgress=e,this.onError=i,this.abortController=new AbortController,this.itemStart=function(s){o++,I===!1&&g.onStart!==void 0&&g.onStart(s,n,o),I=!0},this.itemEnd=function(s){n++,g.onProgress!==void 0&&g.onProgress(s,n,o),n===o&&(I=!1,g.onLoad!==void 0&&g.onLoad())},this.itemError=function(s){g.onError!==void 0&&g.onError(s)},this.resolveURL=function(s){return a?a(s):s},this.setURLModifier=function(s){return a=s,this},this.addHandler=function(s,B){return r.push(s,B),this},this.removeHandler=function(s){const B=r.indexOf(s);return B!==-1&&r.splice(B,2),this},this.getHandler=function(s){for(let B=0,c=r.length;B<c;B+=2){const E=r[B],D=r[B+1];if(E.global&&(E.lastIndex=0),E.test(s))return D}return null},this.abort=function(){return this.abortController.abort(),this.abortController=new AbortController,this}}}const eoA=new D1;class Sa{constructor(A){this.manager=A!==void 0?A:eoA,this.crossOrigin="anonymous",this.withCredentials=!1,this.path="",this.resourcePath="",this.requestHeader={}}load(){}loadAsync(A,e){const i=this;return new Promise(function(g,I){i.load(A,g,e,I)})}parse(){}setCrossOrigin(A){return this.crossOrigin=A,this}setWithCredentials(A){return this.withCredentials=A,this}setPath(A){return this.path=A,this}setResourcePath(A){return this.resourcePath=A,this}setRequestHeader(A){return this.requestHeader=A,this}abort(){return this}}Sa.DEFAULT_MATERIAL_NAME="__DEFAULT";const _l={};class LOA extends Error{constructor(A,e){super(A),this.response=e}}class Es extends Sa{constructor(A){super(A),this.mimeType="",this.responseType="",this._abortController=new AbortController}load(A,e,i,g){A===void 0&&(A=""),this.path!==void 0&&(A=this.path+A),A=this.manager.resolveURL(A);const I=bc.get(`file:${A}`);if(I!==void 0)return this.manager.itemStart(A),setTimeout(()=>{e&&e(I),this.manager.itemEnd(A)},0),I;if(_l[A]!==void 0){_l[A].push({onLoad:e,onProgress:i,onError:g});return}_l[A]=[],_l[A].push({onLoad:e,onProgress:i,onError:g});const n=new Request(A,{headers:new Headers(this.requestHeader),credentials:this.withCredentials?"include":"same-origin",signal:typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal}),o=this.mimeType,a=this.responseType;fetch(n).then(r=>{if(r.status===200||r.status===0){if(r.status,typeof ReadableStream>"u"||r.body===void 0||r.body.getReader===void 0)return r;const s=_l[A],B=r.body.getReader(),c=r.headers.get("X-File-Size")||r.headers.get("Content-Length"),E=c?parseInt(c):0,D=E!==0;let y=0;const S=new ReadableStream({start(f){M();function M(){B.read().then(({done:k,value:m})=>{if(k)f.close();else{y+=m.byteLength;const U=new ProgressEvent("progress",{lengthComputable:D,loaded:y,total:E});for(let F=0,b=s.length;F<b;F++){const K=s[F];K.onProgress&&K.onProgress(U)}f.enqueue(m),M()}},k=>{f.error(k)})}}});return new Response(S)}else throw new LOA(`fetch for "${r.url}" responded with ${r.status}: ${r.statusText}`,r)}).then(r=>{switch(a){case"arraybuffer":return r.arrayBuffer();case"blob":return r.blob();case"document":return r.text().then(s=>new DOMParser().parseFromString(s,o));case"json":return r.json();default:if(o==="")return r.text();{const B=/charset="?([^;"\s]*)"?/i.exec(o),c=B&&B[1]?B[1].toLowerCase():void 0,E=new TextDecoder(c);return r.arrayBuffer().then(D=>E.decode(D))}}}).then(r=>{bc.add(`file:${A}`,r);const s=_l[A];delete _l[A];for(let B=0,c=s.length;B<c;B++){const E=s[B];E.onLoad&&E.onLoad(r)}}).catch(r=>{const s=_l[A];if(s===void 0)throw this.manager.itemError(A),r;delete _l[A];for(let B=0,c=s.length;B<c;B++){const E=s[B];E.onError&&E.onError(r)}this.manager.itemError(A)}).finally(()=>{this.manager.itemEnd(A)}),this.manager.itemStart(A)}setResponseType(A){return this.responseType=A,this}setMimeType(A){return this.mimeType=A,this}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}class qOA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=this,n=new Es(this.manager);n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(A,function(o){try{e(I.parse(JSON.parse(o)))}catch(a){g&&g(a),I.manager.itemError(A)}},i,g)}parse(A){const e=[];for(let i=0;i<A.length;i++){const g=Sy.parse(A[i]);e.push(g)}return e}}class xOA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=this,n=[],o=new Xb,a=new Es(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(I.withCredentials);let r=0;function s(B){a.load(A[B],function(c){const E=I.parse(c,!0);n[B]={width:E.width,height:E.height,format:E.format,mipmaps:E.mipmaps},r+=1,r===6&&(E.mipmapCount===1&&(o.minFilter=HI),o.image=n,o.format=E.format,o.needsUpdate=!0,e&&e(o))},i,g)}if(Array.isArray(A))for(let B=0,c=A.length;B<c;++B)s(B);else a.load(A,function(B){const c=I.parse(B,!0);if(c.isCubemap){const E=c.mipmaps.length/c.mipmapCount;for(let D=0;D<E;D++){n[D]={mipmaps:[]};for(let y=0;y<c.mipmapCount;y++)n[D].mipmaps.push(c.mipmaps[D*c.mipmapCount+y]),n[D].format=c.format,n[D].width=c.width,n[D].height=c.height}o.image=n}else o.image.width=c.width,o.image.height=c.height,o.mipmaps=c.mipmaps;c.mipmapCount===1&&(o.minFilter=HI),o.format=c.format,o.needsUpdate=!0,e&&e(o)},i,g);return o}}const xf=new WeakMap;class W0 extends Sa{constructor(A){super(A)}load(A,e,i,g){this.path!==void 0&&(A=this.path+A),A=this.manager.resolveURL(A);const I=this,n=bc.get(`image:${A}`);if(n!==void 0){if(n.complete===!0)I.manager.itemStart(A),setTimeout(function(){e&&e(n),I.manager.itemEnd(A)},0);else{let B=xf.get(n);B===void 0&&(B=[],xf.set(n,B)),B.push({onLoad:e,onError:g})}return n}const o=H0("img");function a(){s(),e&&e(this);const B=xf.get(this)||[];for(let c=0;c<B.length;c++){const E=B[c];E.onLoad&&E.onLoad(this)}xf.delete(this),I.manager.itemEnd(A)}function r(B){s(),g&&g(B),bc.remove(`image:${A}`);const c=xf.get(this)||[];for(let E=0;E<c.length;E++){const D=c[E];D.onError&&D.onError(B)}xf.delete(this),I.manager.itemError(A),I.manager.itemEnd(A)}function s(){o.removeEventListener("load",a,!1),o.removeEventListener("error",r,!1)}return o.addEventListener("load",a,!1),o.addEventListener("error",r,!1),A.slice(0,5)!=="data:"&&this.crossOrigin!==void 0&&(o.crossOrigin=this.crossOrigin),bc.add(`image:${A}`,o),I.manager.itemStart(A),o.src=A,o}}class TOA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=new Vk;I.colorSpace=Hn;const n=new W0(this.manager);n.setCrossOrigin(this.crossOrigin),n.setPath(this.path);let o=0;function a(r){n.load(A[r],function(s){I.images[r]=s,o++,o===6&&(I.needsUpdate=!0,e&&e(I))},void 0,g)}for(let r=0;r<A.length;++r)a(r);return I}}class YOA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=this,n=new Yc,o=new Es(this.manager);return o.setResponseType("arraybuffer"),o.setRequestHeader(this.requestHeader),o.setPath(this.path),o.setWithCredentials(I.withCredentials),o.load(A,function(a){let r;try{r=I.parse(a)}catch(s){if(g!==void 0)g(s);else return}r.image!==void 0?n.image=r.image:r.data!==void 0&&(n.image.width=r.width,n.image.height=r.height,n.image.data=r.data),n.wrapS=r.wrapS!==void 0?r.wrapS:Bs,n.wrapT=r.wrapT!==void 0?r.wrapT:Bs,n.magFilter=r.magFilter!==void 0?r.magFilter:HI,n.minFilter=r.minFilter!==void 0?r.minFilter:HI,n.anisotropy=r.anisotropy!==void 0?r.anisotropy:1,r.colorSpace!==void 0&&(n.colorSpace=r.colorSpace),r.flipY!==void 0&&(n.flipY=r.flipY),r.format!==void 0&&(n.format=r.format),r.type!==void 0&&(n.type=r.type),r.mipmaps!==void 0&&(n.mipmaps=r.mipmaps,n.minFilter=oC),r.mipmapCount===1&&(n.minFilter=HI),r.generateMipmaps!==void 0&&(n.generateMipmaps=r.generateMipmaps),n.needsUpdate=!0,e&&e(n,r)},i,g),n}}class toA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=new FI,n=new W0(this.manager);return n.setCrossOrigin(this.crossOrigin),n.setPath(this.path),n.load(A,function(o){I.image=o,I.needsUpdate=!0,e!==void 0&&e(I)},i,g),I}}class ku extends ng{constructor(A,e=1){super(),this.isLight=!0,this.type="Light",this.color=new wt(A),this.intensity=e}dispose(){}copy(A,e){return super.copy(A,e),this.color.copy(A.color),this.intensity=A.intensity,this}toJSON(A){const e=super.toJSON(A);return e.object.color=this.color.getHex(),e.object.intensity=this.intensity,this.groundColor!==void 0&&(e.object.groundColor=this.groundColor.getHex()),this.distance!==void 0&&(e.object.distance=this.distance),this.angle!==void 0&&(e.object.angle=this.angle),this.decay!==void 0&&(e.object.decay=this.decay),this.penumbra!==void 0&&(e.object.penumbra=this.penumbra),this.shadow!==void 0&&(e.object.shadow=this.shadow.toJSON()),this.target!==void 0&&(e.object.target=this.target.uuid),e}}class ioA extends ku{constructor(A,e,i){super(A,i),this.isHemisphereLight=!0,this.type="HemisphereLight",this.position.copy(ng.DEFAULT_UP),this.updateMatrix(),this.groundColor=new wt(e)}copy(A,e){return super.copy(A,e),this.groundColor.copy(A.groundColor),this}}const yq=new Ai,kV=new wA,MV=new wA;class y1{constructor(A){this.camera=A,this.intensity=1,this.bias=0,this.normalBias=0,this.radius=1,this.blurSamples=8,this.mapSize=new Ze(512,512),this.mapType=QC,this.map=null,this.mapPass=null,this.matrix=new Ai,this.autoUpdate=!0,this.needsUpdate=!1,this._frustum=new tS,this._frameExtents=new Ze(1,1),this._viewportCount=1,this._viewports=[new wg(0,0,1,1)]}getViewportCount(){return this._viewportCount}getFrustum(){return this._frustum}updateMatrices(A){const e=this.camera,i=this.matrix;kV.setFromMatrixPosition(A.matrixWorld),e.position.copy(kV),MV.setFromMatrixPosition(A.target.matrixWorld),e.lookAt(MV),e.updateMatrixWorld(),yq.multiplyMatrices(e.projectionMatrix,e.matrixWorldInverse),this._frustum.setFromProjectionMatrix(yq,e.coordinateSystem,e.reversedDepth),e.reversedDepth?i.set(.5,0,0,.5,0,.5,0,.5,0,0,1,0,0,0,0,1):i.set(.5,0,0,.5,0,.5,0,.5,0,0,.5,.5,0,0,0,1),i.multiply(yq)}getViewport(A){return this._viewports[A]}getFrameExtents(){return this._frameExtents}dispose(){this.map&&this.map.dispose(),this.mapPass&&this.mapPass.dispose()}copy(A){return this.camera=A.camera.clone(),this.intensity=A.intensity,this.bias=A.bias,this.radius=A.radius,this.autoUpdate=A.autoUpdate,this.needsUpdate=A.needsUpdate,this.normalBias=A.normalBias,this.blurSamples=A.blurSamples,this.mapSize.copy(A.mapSize),this}clone(){return new this.constructor().copy(this)}toJSON(){const A={};return this.intensity!==1&&(A.intensity=this.intensity),this.bias!==0&&(A.bias=this.bias),this.normalBias!==0&&(A.normalBias=this.normalBias),this.radius!==1&&(A.radius=this.radius),(this.mapSize.x!==512||this.mapSize.y!==512)&&(A.mapSize=this.mapSize.toArray()),A.camera=this.camera.toJSON(!1).object,delete A.camera.matrix,A}}class HOA extends y1{constructor(){super(new jn(50,1,.5,500)),this.isSpotLightShadow=!0,this.focus=1,this.aspect=1}updateMatrices(A){const e=this.camera,i=py*2*A.angle*this.focus,g=this.mapSize.width/this.mapSize.height*this.aspect,I=A.distance||e.far;(i!==e.fov||g!==e.aspect||I!==e.far)&&(e.fov=i,e.aspect=g,e.far=I,e.updateProjectionMatrix()),super.updateMatrices(A)}copy(A){return super.copy(A),this.focus=A.focus,this}}class S1 extends ku{constructor(A,e,i=0,g=Math.PI/3,I=0,n=2){super(A,e),this.isSpotLight=!0,this.type="SpotLight",this.position.copy(ng.DEFAULT_UP),this.updateMatrix(),this.target=new ng,this.distance=i,this.angle=g,this.penumbra=I,this.decay=n,this.map=null,this.shadow=new HOA}get power(){return this.intensity*Math.PI}set power(A){this.intensity=A/Math.PI}dispose(){this.shadow.dispose()}copy(A,e){return super.copy(A,e),this.distance=A.distance,this.angle=A.angle,this.penumbra=A.penumbra,this.decay=A.decay,this.target=A.target.clone(),this.shadow=A.shadow.clone(),this}}const NV=new Ai,zw=new wA,Sq=new wA;class OOA extends y1{constructor(){super(new jn(90,1,.5,500)),this.isPointLightShadow=!0,this._frameExtents=new Ze(4,2),this._viewportCount=6,this._viewports=[new wg(2,1,1,1),new wg(0,1,1,1),new wg(3,1,1,1),new wg(1,1,1,1),new wg(3,0,1,1),new wg(1,0,1,1)],this._cubeDirections=[new wA(1,0,0),new wA(-1,0,0),new wA(0,0,1),new wA(0,0,-1),new wA(0,1,0),new wA(0,-1,0)],this._cubeUps=[new wA(0,1,0),new wA(0,1,0),new wA(0,1,0),new wA(0,1,0),new wA(0,0,1),new wA(0,0,-1)]}updateMatrices(A,e=0){const i=this.camera,g=this.matrix,I=A.distance||i.far;I!==i.far&&(i.far=I,i.updateProjectionMatrix()),zw.setFromMatrixPosition(A.matrixWorld),i.position.copy(zw),Sq.copy(i.position),Sq.add(this._cubeDirections[e]),i.up.copy(this._cubeUps[e]),i.lookAt(Sq),i.updateMatrixWorld(),g.makeTranslation(-zw.x,-zw.y,-zw.z),NV.multiplyMatrices(i.projectionMatrix,i.matrixWorldInverse),this._frustum.setFromProjectionMatrix(NV,i.coordinateSystem,i.reversedDepth)}}class w1 extends ku{constructor(A,e,i=0,g=2){super(A,e),this.isPointLight=!0,this.type="PointLight",this.distance=i,this.decay=g,this.shadow=new OOA}get power(){return this.intensity*4*Math.PI}set power(A){this.intensity=A/(4*Math.PI)}dispose(){this.shadow.dispose()}copy(A,e){return super.copy(A,e),this.distance=A.distance,this.decay=A.decay,this.shadow=A.shadow.clone(),this}}let IS=class extends Pb{constructor(A=-1,e=1,i=1,g=-1,I=.1,n=2e3){super(),this.isOrthographicCamera=!0,this.type="OrthographicCamera",this.zoom=1,this.view=null,this.left=A,this.right=e,this.top=i,this.bottom=g,this.near=I,this.far=n,this.updateProjectionMatrix()}copy(A,e){return super.copy(A,e),this.left=A.left,this.right=A.right,this.top=A.top,this.bottom=A.bottom,this.near=A.near,this.far=A.far,this.zoom=A.zoom,this.view=A.view===null?null:Object.assign({},A.view),this}setViewOffset(A,e,i,g,I,n){this.view===null&&(this.view={enabled:!0,fullWidth:1,fullHeight:1,offsetX:0,offsetY:0,width:1,height:1}),this.view.enabled=!0,this.view.fullWidth=A,this.view.fullHeight=e,this.view.offsetX=i,this.view.offsetY=g,this.view.width=I,this.view.height=n,this.updateProjectionMatrix()}clearViewOffset(){this.view!==null&&(this.view.enabled=!1),this.updateProjectionMatrix()}updateProjectionMatrix(){const A=(this.right-this.left)/(2*this.zoom),e=(this.top-this.bottom)/(2*this.zoom),i=(this.right+this.left)/2,g=(this.top+this.bottom)/2;let I=i-A,n=i+A,o=g+e,a=g-e;if(this.view!==null&&this.view.enabled){const r=(this.right-this.left)/this.view.fullWidth/this.zoom,s=(this.top-this.bottom)/this.view.fullHeight/this.zoom;I+=r*this.view.offsetX,n=I+r*this.view.width,o-=s*this.view.offsetY,a=o-s*this.view.height}this.projectionMatrix.makeOrthographic(I,n,o,a,this.near,this.far,this.coordinateSystem,this.reversedDepth),this.projectionMatrixInverse.copy(this.projectionMatrix).invert()}toJSON(A){const e=super.toJSON(A);return e.object.zoom=this.zoom,e.object.left=this.left,e.object.right=this.right,e.object.top=this.top,e.object.bottom=this.bottom,e.object.near=this.near,e.object.far=this.far,this.view!==null&&(e.object.view=Object.assign({},this.view)),e}};class POA extends y1{constructor(){super(new IS(-5,5,5,-5,.5,500)),this.isDirectionalLightShadow=!0}}class m1 extends ku{constructor(A,e){super(A,e),this.isDirectionalLight=!0,this.type="DirectionalLight",this.position.copy(ng.DEFAULT_UP),this.updateMatrix(),this.target=new ng,this.shadow=new POA}dispose(){this.shadow.dispose()}copy(A){return super.copy(A),this.target=A.target.clone(),this.shadow=A.shadow.clone(),this}}class goA extends ku{constructor(A,e){super(A,e),this.isAmbientLight=!0,this.type="AmbientLight"}}class IoA extends ku{constructor(A,e,i=10,g=10){super(A,e),this.isRectAreaLight=!0,this.type="RectAreaLight",this.width=i,this.height=g}get power(){return this.intensity*this.width*this.height*Math.PI}set power(A){this.intensity=A/(this.width*this.height*Math.PI)}copy(A){return super.copy(A),this.width=A.width,this.height=A.height,this}toJSON(A){const e=super.toJSON(A);return e.object.width=this.width,e.object.height=this.height,e}}class noA{constructor(){this.isSphericalHarmonics3=!0,this.coefficients=[];for(let A=0;A<9;A++)this.coefficients.push(new wA)}set(A){for(let e=0;e<9;e++)this.coefficients[e].copy(A[e]);return this}zero(){for(let A=0;A<9;A++)this.coefficients[A].set(0,0,0);return this}getAt(A,e){const i=A.x,g=A.y,I=A.z,n=this.coefficients;return e.copy(n[0]).multiplyScalar(.282095),e.addScaledVector(n[1],.488603*g),e.addScaledVector(n[2],.488603*I),e.addScaledVector(n[3],.488603*i),e.addScaledVector(n[4],1.092548*(i*g)),e.addScaledVector(n[5],1.092548*(g*I)),e.addScaledVector(n[6],.315392*(3*I*I-1)),e.addScaledVector(n[7],1.092548*(i*I)),e.addScaledVector(n[8],.546274*(i*i-g*g)),e}getIrradianceAt(A,e){const i=A.x,g=A.y,I=A.z,n=this.coefficients;return e.copy(n[0]).multiplyScalar(.886227),e.addScaledVector(n[1],2*.511664*g),e.addScaledVector(n[2],2*.511664*I),e.addScaledVector(n[3],2*.511664*i),e.addScaledVector(n[4],2*.429043*i*g),e.addScaledVector(n[5],2*.429043*g*I),e.addScaledVector(n[6],.743125*I*I-.247708),e.addScaledVector(n[7],2*.429043*i*I),e.addScaledVector(n[8],.429043*(i*i-g*g)),e}add(A){for(let e=0;e<9;e++)this.coefficients[e].add(A.coefficients[e]);return this}addScaledSH(A,e){for(let i=0;i<9;i++)this.coefficients[i].addScaledVector(A.coefficients[i],e);return this}scale(A){for(let e=0;e<9;e++)this.coefficients[e].multiplyScalar(A);return this}lerp(A,e){for(let i=0;i<9;i++)this.coefficients[i].lerp(A.coefficients[i],e);return this}equals(A){for(let e=0;e<9;e++)if(!this.coefficients[e].equals(A.coefficients[e]))return!1;return!0}copy(A){return this.set(A.coefficients)}clone(){return new this.constructor().copy(this)}fromArray(A,e=0){const i=this.coefficients;for(let g=0;g<9;g++)i[g].fromArray(A,e+g*3);return this}toArray(A=[],e=0){const i=this.coefficients;for(let g=0;g<9;g++)i[g].toArray(A,e+g*3);return A}static getBasisAt(A,e){const i=A.x,g=A.y,I=A.z;e[0]=.282095,e[1]=.488603*g,e[2]=.488603*I,e[3]=.488603*i,e[4]=1.092548*i*g,e[5]=1.092548*g*I,e[6]=.315392*(3*I*I-1),e[7]=1.092548*i*I,e[8]=.546274*(i*i-g*g)}}class ooA extends ku{constructor(A=new noA,e=1){super(void 0,e),this.isLightProbe=!0,this.sh=A}copy(A){return super.copy(A),this.sh.copy(A.sh),this}fromJSON(A){return this.intensity=A.intensity,this.sh.fromArray(A.sh),this}toJSON(A){const e=super.toJSON(A);return e.object.sh=this.sh.toArray(),e}}class cv extends Sa{constructor(A){super(A),this.textures={}}load(A,e,i,g){const I=this,n=new Es(I.manager);n.setPath(I.path),n.setRequestHeader(I.requestHeader),n.setWithCredentials(I.withCredentials),n.load(A,function(o){try{e(I.parse(JSON.parse(o)))}catch(a){g&&g(a),I.manager.itemError(A)}},i,g)}parse(A){const e=this.textures;function i(I){return e[I],e[I]}const g=this.createMaterialFromType(A.type);if(A.uuid!==void 0&&(g.uuid=A.uuid),A.name!==void 0&&(g.name=A.name),A.color!==void 0&&g.color!==void 0&&g.color.setHex(A.color),A.roughness!==void 0&&(g.roughness=A.roughness),A.metalness!==void 0&&(g.metalness=A.metalness),A.sheen!==void 0&&(g.sheen=A.sheen),A.sheenColor!==void 0&&(g.sheenColor=new wt().setHex(A.sheenColor)),A.sheenRoughness!==void 0&&(g.sheenRoughness=A.sheenRoughness),A.emissive!==void 0&&g.emissive!==void 0&&g.emissive.setHex(A.emissive),A.specular!==void 0&&g.specular!==void 0&&g.specular.setHex(A.specular),A.specularIntensity!==void 0&&(g.specularIntensity=A.specularIntensity),A.specularColor!==void 0&&g.specularColor!==void 0&&g.specularColor.setHex(A.specularColor),A.shininess!==void 0&&(g.shininess=A.shininess),A.clearcoat!==void 0&&(g.clearcoat=A.clearcoat),A.clearcoatRoughness!==void 0&&(g.clearcoatRoughness=A.clearcoatRoughness),A.dispersion!==void 0&&(g.dispersion=A.dispersion),A.iridescence!==void 0&&(g.iridescence=A.iridescence),A.iridescenceIOR!==void 0&&(g.iridescenceIOR=A.iridescenceIOR),A.iridescenceThicknessRange!==void 0&&(g.iridescenceThicknessRange=A.iridescenceThicknessRange),A.transmission!==void 0&&(g.transmission=A.transmission),A.thickness!==void 0&&(g.thickness=A.thickness),A.attenuationDistance!==void 0&&(g.attenuationDistance=A.attenuationDistance),A.attenuationColor!==void 0&&g.attenuationColor!==void 0&&g.attenuationColor.setHex(A.attenuationColor),A.anisotropy!==void 0&&(g.anisotropy=A.anisotropy),A.anisotropyRotation!==void 0&&(g.anisotropyRotation=A.anisotropyRotation),A.fog!==void 0&&(g.fog=A.fog),A.flatShading!==void 0&&(g.flatShading=A.flatShading),A.blending!==void 0&&(g.blending=A.blending),A.combine!==void 0&&(g.combine=A.combine),A.side!==void 0&&(g.side=A.side),A.shadowSide!==void 0&&(g.shadowSide=A.shadowSide),A.opacity!==void 0&&(g.opacity=A.opacity),A.transparent!==void 0&&(g.transparent=A.transparent),A.alphaTest!==void 0&&(g.alphaTest=A.alphaTest),A.alphaHash!==void 0&&(g.alphaHash=A.alphaHash),A.depthFunc!==void 0&&(g.depthFunc=A.depthFunc),A.depthTest!==void 0&&(g.depthTest=A.depthTest),A.depthWrite!==void 0&&(g.depthWrite=A.depthWrite),A.colorWrite!==void 0&&(g.colorWrite=A.colorWrite),A.blendSrc!==void 0&&(g.blendSrc=A.blendSrc),A.blendDst!==void 0&&(g.blendDst=A.blendDst),A.blendEquation!==void 0&&(g.blendEquation=A.blendEquation),A.blendSrcAlpha!==void 0&&(g.blendSrcAlpha=A.blendSrcAlpha),A.blendDstAlpha!==void 0&&(g.blendDstAlpha=A.blendDstAlpha),A.blendEquationAlpha!==void 0&&(g.blendEquationAlpha=A.blendEquationAlpha),A.blendColor!==void 0&&g.blendColor!==void 0&&g.blendColor.setHex(A.blendColor),A.blendAlpha!==void 0&&(g.blendAlpha=A.blendAlpha),A.stencilWriteMask!==void 0&&(g.stencilWriteMask=A.stencilWriteMask),A.stencilFunc!==void 0&&(g.stencilFunc=A.stencilFunc),A.stencilRef!==void 0&&(g.stencilRef=A.stencilRef),A.stencilFuncMask!==void 0&&(g.stencilFuncMask=A.stencilFuncMask),A.stencilFail!==void 0&&(g.stencilFail=A.stencilFail),A.stencilZFail!==void 0&&(g.stencilZFail=A.stencilZFail),A.stencilZPass!==void 0&&(g.stencilZPass=A.stencilZPass),A.stencilWrite!==void 0&&(g.stencilWrite=A.stencilWrite),A.wireframe!==void 0&&(g.wireframe=A.wireframe),A.wireframeLinewidth!==void 0&&(g.wireframeLinewidth=A.wireframeLinewidth),A.wireframeLinecap!==void 0&&(g.wireframeLinecap=A.wireframeLinecap),A.wireframeLinejoin!==void 0&&(g.wireframeLinejoin=A.wireframeLinejoin),A.rotation!==void 0&&(g.rotation=A.rotation),A.linewidth!==void 0&&(g.linewidth=A.linewidth),A.dashSize!==void 0&&(g.dashSize=A.dashSize),A.gapSize!==void 0&&(g.gapSize=A.gapSize),A.scale!==void 0&&(g.scale=A.scale),A.polygonOffset!==void 0&&(g.polygonOffset=A.polygonOffset),A.polygonOffsetFactor!==void 0&&(g.polygonOffsetFactor=A.polygonOffsetFactor),A.polygonOffsetUnits!==void 0&&(g.polygonOffsetUnits=A.polygonOffsetUnits),A.dithering!==void 0&&(g.dithering=A.dithering),A.alphaToCoverage!==void 0&&(g.alphaToCoverage=A.alphaToCoverage),A.premultipliedAlpha!==void 0&&(g.premultipliedAlpha=A.premultipliedAlpha),A.forceSinglePass!==void 0&&(g.forceSinglePass=A.forceSinglePass),A.visible!==void 0&&(g.visible=A.visible),A.toneMapped!==void 0&&(g.toneMapped=A.toneMapped),A.userData!==void 0&&(g.userData=A.userData),A.vertexColors!==void 0&&(typeof A.vertexColors=="number"?g.vertexColors=A.vertexColors>0:g.vertexColors=A.vertexColors),A.uniforms!==void 0)for(const I in A.uniforms){const n=A.uniforms[I];switch(g.uniforms[I]={},n.type){case"t":g.uniforms[I].value=i(n.value);break;case"c":g.uniforms[I].value=new wt().setHex(n.value);break;case"v2":g.uniforms[I].value=new Ze().fromArray(n.value);break;case"v3":g.uniforms[I].value=new wA().fromArray(n.value);break;case"v4":g.uniforms[I].value=new wg().fromArray(n.value);break;case"m3":g.uniforms[I].value=new Ni().fromArray(n.value);break;case"m4":g.uniforms[I].value=new Ai().fromArray(n.value);break;default:g.uniforms[I].value=n.value}}if(A.defines!==void 0&&(g.defines=A.defines),A.vertexShader!==void 0&&(g.vertexShader=A.vertexShader),A.fragmentShader!==void 0&&(g.fragmentShader=A.fragmentShader),A.glslVersion!==void 0&&(g.glslVersion=A.glslVersion),A.extensions!==void 0)for(const I in A.extensions)g.extensions[I]=A.extensions[I];if(A.lights!==void 0&&(g.lights=A.lights),A.clipping!==void 0&&(g.clipping=A.clipping),A.size!==void 0&&(g.size=A.size),A.sizeAttenuation!==void 0&&(g.sizeAttenuation=A.sizeAttenuation),A.map!==void 0&&(g.map=i(A.map)),A.matcap!==void 0&&(g.matcap=i(A.matcap)),A.alphaMap!==void 0&&(g.alphaMap=i(A.alphaMap)),A.bumpMap!==void 0&&(g.bumpMap=i(A.bumpMap)),A.bumpScale!==void 0&&(g.bumpScale=A.bumpScale),A.normalMap!==void 0&&(g.normalMap=i(A.normalMap)),A.normalMapType!==void 0&&(g.normalMapType=A.normalMapType),A.normalScale!==void 0){let I=A.normalScale;Array.isArray(I)===!1&&(I=[I,I]),g.normalScale=new Ze().fromArray(I)}return A.displacementMap!==void 0&&(g.displacementMap=i(A.displacementMap)),A.displacementScale!==void 0&&(g.displacementScale=A.displacementScale),A.displacementBias!==void 0&&(g.displacementBias=A.displacementBias),A.roughnessMap!==void 0&&(g.roughnessMap=i(A.roughnessMap)),A.metalnessMap!==void 0&&(g.metalnessMap=i(A.metalnessMap)),A.emissiveMap!==void 0&&(g.emissiveMap=i(A.emissiveMap)),A.emissiveIntensity!==void 0&&(g.emissiveIntensity=A.emissiveIntensity),A.specularMap!==void 0&&(g.specularMap=i(A.specularMap)),A.specularIntensityMap!==void 0&&(g.specularIntensityMap=i(A.specularIntensityMap)),A.specularColorMap!==void 0&&(g.specularColorMap=i(A.specularColorMap)),A.envMap!==void 0&&(g.envMap=i(A.envMap)),A.envMapRotation!==void 0&&g.envMapRotation.fromArray(A.envMapRotation),A.envMapIntensity!==void 0&&(g.envMapIntensity=A.envMapIntensity),A.reflectivity!==void 0&&(g.reflectivity=A.reflectivity),A.refractionRatio!==void 0&&(g.refractionRatio=A.refractionRatio),A.lightMap!==void 0&&(g.lightMap=i(A.lightMap)),A.lightMapIntensity!==void 0&&(g.lightMapIntensity=A.lightMapIntensity),A.aoMap!==void 0&&(g.aoMap=i(A.aoMap)),A.aoMapIntensity!==void 0&&(g.aoMapIntensity=A.aoMapIntensity),A.gradientMap!==void 0&&(g.gradientMap=i(A.gradientMap)),A.clearcoatMap!==void 0&&(g.clearcoatMap=i(A.clearcoatMap)),A.clearcoatRoughnessMap!==void 0&&(g.clearcoatRoughnessMap=i(A.clearcoatRoughnessMap)),A.clearcoatNormalMap!==void 0&&(g.clearcoatNormalMap=i(A.clearcoatNormalMap)),A.clearcoatNormalScale!==void 0&&(g.clearcoatNormalScale=new Ze().fromArray(A.clearcoatNormalScale)),A.iridescenceMap!==void 0&&(g.iridescenceMap=i(A.iridescenceMap)),A.iridescenceThicknessMap!==void 0&&(g.iridescenceThicknessMap=i(A.iridescenceThicknessMap)),A.transmissionMap!==void 0&&(g.transmissionMap=i(A.transmissionMap)),A.thicknessMap!==void 0&&(g.thicknessMap=i(A.thicknessMap)),A.anisotropyMap!==void 0&&(g.anisotropyMap=i(A.anisotropyMap)),A.sheenColorMap!==void 0&&(g.sheenColorMap=i(A.sheenColorMap)),A.sheenRoughnessMap!==void 0&&(g.sheenRoughnessMap=i(A.sheenRoughnessMap)),g}setTextures(A){return this.textures=A,this}createMaterialFromType(A){return cv.createMaterialFromType(A)}static createMaterialFromType(A){const e={ShadowMaterial:TnA,SpriteMaterial:I1,RawShaderMaterial:YnA,ShaderMaterial:EC,PointsMaterial:Vb,MeshPhysicalMaterial:pC,MeshStandardMaterial:vd,MeshPhongMaterial:HnA,MeshToonMaterial:OnA,MeshNormalMaterial:PnA,MeshLambertMaterial:jnA,MeshDepthMaterial:u1,MeshDistanceMaterial:h1,MeshBasicMaterial:ls,MeshMatcapMaterial:ZnA,LineDashedMaterial:WnA,LineBasicMaterial:ya,Material:Wn};return new e[A]}}class OE{static extractUrlBase(A){const e=A.lastIndexOf("/");return e===-1?"./":A.slice(0,e+1)}static resolveURL(A,e){return typeof A!="string"||A===""?"":(/^https?:\/\//i.test(e)&&/^\//.test(A)&&(e=e.replace(/(^https?:\/\/[^\/]+).*/i,"$1")),/^(https?:)?\/\//i.test(A)||/^data:.*,.*$/i.test(A)||/^blob:.*$/i.test(A)?A:e+A)}}class aoA extends fi{constructor(){super(),this.isInstancedBufferGeometry=!0,this.type="InstancedBufferGeometry",this.instanceCount=1/0}copy(A){return super.copy(A),this.instanceCount=A.instanceCount,this}toJSON(){const A=super.toJSON();return A.instanceCount=this.instanceCount,A.isInstancedBufferGeometry=!0,A}}class roA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=this,n=new Es(I.manager);n.setPath(I.path),n.setRequestHeader(I.requestHeader),n.setWithCredentials(I.withCredentials),n.load(A,function(o){try{e(I.parse(JSON.parse(o)))}catch(a){g&&g(a),I.manager.itemError(A)}},i,g)}parse(A){const e={},i={};function g(E,D){if(e[D]!==void 0)return e[D];const S=E.interleavedBuffers[D],f=I(E,S.buffer),M=hD(S.type,f),k=new Xk(M,S.stride);return k.uuid=S.uuid,e[D]=k,k}function I(E,D){if(i[D]!==void 0)return i[D];const S=E.arrayBuffers[D],f=new Uint32Array(S).buffer;return i[D]=f,f}const n=A.isInstancedBufferGeometry?new aoA:new fi,o=A.data.index;if(o!==void 0){const E=hD(o.type,o.array);n.setIndex(new eg(E,1))}const a=A.data.attributes;for(const E in a){const D=a[E];let y;if(D.isInterleavedBufferAttribute){const S=g(A.data,D.data);y=new Bu(S,D.itemSize,D.offset,D.normalized)}else{const S=hD(D.type,D.array),f=D.isInstancedBufferAttribute?Fd:eg;y=new f(S,D.itemSize,D.normalized)}D.name!==void 0&&(y.name=D.name),D.usage!==void 0&&y.setUsage(D.usage),n.setAttribute(E,y)}const r=A.data.morphAttributes;if(r)for(const E in r){const D=r[E],y=[];for(let S=0,f=D.length;S<f;S++){const M=D[S];let k;if(M.isInterleavedBufferAttribute){const m=g(A.data,M.data);k=new Bu(m,M.itemSize,M.offset,M.normalized)}else{const m=hD(M.type,M.array);k=new eg(m,M.itemSize,M.normalized)}M.name!==void 0&&(k.name=M.name),y.push(k)}n.morphAttributes[E]=y}A.data.morphTargetsRelative&&(n.morphTargetsRelative=!0);const B=A.data.groups||A.data.drawcalls||A.data.offsets;if(B!==void 0)for(let E=0,D=B.length;E!==D;++E){const y=B[E];n.addGroup(y.start,y.count,y.materialIndex)}const c=A.data.boundingSphere;return c!==void 0&&(n.boundingSphere=new po().fromJSON(c)),A.name&&(n.name=A.name),A.userData&&(n.userData=A.userData),n}}class jOA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=this,n=this.path===""?OE.extractUrlBase(A):this.path;this.resourcePath=this.resourcePath||n;const o=new Es(this.manager);o.setPath(this.path),o.setRequestHeader(this.requestHeader),o.setWithCredentials(this.withCredentials),o.load(A,function(a){let r=null;try{r=JSON.parse(a)}catch(B){g!==void 0&&g(B);return}const s=r.metadata;if(s===void 0||s.type===void 0||s.type.toLowerCase()==="geometry"){g!==void 0&&g(new Error("THREE.ObjectLoader: Can't load "+A));return}I.parse(r,e)},i,g)}async loadAsync(A,e){const i=this,g=this.path===""?OE.extractUrlBase(A):this.path;this.resourcePath=this.resourcePath||g;const I=new Es(this.manager);I.setPath(this.path),I.setRequestHeader(this.requestHeader),I.setWithCredentials(this.withCredentials);const n=await I.loadAsync(A,e),o=JSON.parse(n),a=o.metadata;if(a===void 0||a.type===void 0||a.type.toLowerCase()==="geometry")throw new Error("THREE.ObjectLoader: Can't load "+A);return await i.parseAsync(o)}parse(A,e){const i=this.parseAnimations(A.animations),g=this.parseShapes(A.shapes),I=this.parseGeometries(A.geometries,g),n=this.parseImages(A.images,function(){e!==void 0&&e(r)}),o=this.parseTextures(A.textures,n),a=this.parseMaterials(A.materials,o),r=this.parseObject(A.object,I,a,o,i),s=this.parseSkeletons(A.skeletons,r);if(this.bindSkeletons(r,s),this.bindLightTargets(r),e!==void 0){let B=!1;for(const c in n)if(n[c].data instanceof HTMLImageElement){B=!0;break}B===!1&&e(r)}return r}async parseAsync(A){const e=this.parseAnimations(A.animations),i=this.parseShapes(A.shapes),g=this.parseGeometries(A.geometries,i),I=await this.parseImagesAsync(A.images),n=this.parseTextures(A.textures,I),o=this.parseMaterials(A.materials,n),a=this.parseObject(A.object,g,o,n,e),r=this.parseSkeletons(A.skeletons,a);return this.bindSkeletons(a,r),this.bindLightTargets(a),a}parseShapes(A){const e={};if(A!==void 0)for(let i=0,g=A.length;i<g;i++){const I=new ud().fromJSON(A[i]);e[I.uuid]=I}return e}parseSkeletons(A,e){const i={},g={};if(e.traverse(function(I){I.isBone&&(g[I.uuid]=I)}),A!==void 0)for(let I=0,n=A.length;I<n;I++){const o=new $k().fromJSON(A[I],g);i[o.uuid]=o}return i}parseGeometries(A,e){const i={};if(A!==void 0){const g=new roA;for(let I=0,n=A.length;I<n;I++){let o;const a=A[I];switch(a.type){case"BufferGeometry":case"InstancedBufferGeometry":o=g.parse(a);break;default:a.type in mV&&(o=mV[a.type].fromJSON(a,e))}o.uuid=a.uuid,a.name!==void 0&&(o.name=a.name),a.userData!==void 0&&(o.userData=a.userData),i[a.uuid]=o}}return i}parseMaterials(A,e){const i={},g={};if(A!==void 0){const I=new cv;I.setTextures(e);for(let n=0,o=A.length;n<o;n++){const a=A[n];i[a.uuid]===void 0&&(i[a.uuid]=I.parse(a)),g[a.uuid]=i[a.uuid]}}return g}parseAnimations(A){const e={};if(A!==void 0)for(let i=0;i<A.length;i++){const g=A[i],I=Sy.parse(g);e[I.uuid]=I}return e}parseImages(A,e){const i=this,g={};let I;function n(a){return i.manager.itemStart(a),I.load(a,function(){i.manager.itemEnd(a)},void 0,function(){i.manager.itemError(a),i.manager.itemEnd(a)})}function o(a){if(typeof a=="string"){const r=a,s=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(r)?r:i.resourcePath+r;return n(s)}else return a.data?{data:hD(a.type,a.data),width:a.width,height:a.height}:null}if(A!==void 0&&A.length>0){const a=new D1(e);I=new W0(a),I.setCrossOrigin(this.crossOrigin);for(let r=0,s=A.length;r<s;r++){const B=A[r],c=B.url;if(Array.isArray(c)){const E=[];for(let D=0,y=c.length;D<y;D++){const S=c[D],f=o(S);f!==null&&(f instanceof HTMLImageElement?E.push(f):E.push(new Yc(f.data,f.width,f.height)))}g[B.uuid]=new bE(E)}else{const E=o(B.url);g[B.uuid]=new bE(E)}}}return g}async parseImagesAsync(A){const e=this,i={};let g;async function I(n){if(typeof n=="string"){const o=n,a=/^(\/\/)|([a-z]+:(\/\/)?)/i.test(o)?o:e.resourcePath+o;return await g.loadAsync(a)}else return n.data?{data:hD(n.type,n.data),width:n.width,height:n.height}:null}if(A!==void 0&&A.length>0){g=new W0(this.manager),g.setCrossOrigin(this.crossOrigin);for(let n=0,o=A.length;n<o;n++){const a=A[n],r=a.url;if(Array.isArray(r)){const s=[];for(let B=0,c=r.length;B<c;B++){const E=r[B],D=await I(E);D!==null&&(D instanceof HTMLImageElement?s.push(D):s.push(new Yc(D.data,D.width,D.height)))}i[a.uuid]=new bE(s)}else{const s=await I(a.url);i[a.uuid]=new bE(s)}}}return i}parseTextures(A,e){function i(I,n){return typeof I=="number"?I:n[I]}const g={};if(A!==void 0)for(let I=0,n=A.length;I<n;I++){const o=A[I];o.image,e[o.image];const a=e[o.image],r=a.data;let s;Array.isArray(r)?(s=new Vk,r.length===6&&(s.needsUpdate=!0)):(r&&r.data?s=new Yc:s=new FI,r&&(s.needsUpdate=!0)),s.source=a,s.uuid=o.uuid,o.name!==void 0&&(s.name=o.name),o.mapping!==void 0&&(s.mapping=i(o.mapping,ZOA)),o.channel!==void 0&&(s.channel=o.channel),o.offset!==void 0&&s.offset.fromArray(o.offset),o.repeat!==void 0&&s.repeat.fromArray(o.repeat),o.center!==void 0&&s.center.fromArray(o.center),o.rotation!==void 0&&(s.rotation=o.rotation),o.wrap!==void 0&&(s.wrapS=i(o.wrap[0],GV),s.wrapT=i(o.wrap[1],GV)),o.format!==void 0&&(s.format=o.format),o.internalFormat!==void 0&&(s.internalFormat=o.internalFormat),o.type!==void 0&&(s.type=o.type),o.colorSpace!==void 0&&(s.colorSpace=o.colorSpace),o.minFilter!==void 0&&(s.minFilter=i(o.minFilter,RV)),o.magFilter!==void 0&&(s.magFilter=i(o.magFilter,RV)),o.anisotropy!==void 0&&(s.anisotropy=o.anisotropy),o.flipY!==void 0&&(s.flipY=o.flipY),o.generateMipmaps!==void 0&&(s.generateMipmaps=o.generateMipmaps),o.premultiplyAlpha!==void 0&&(s.premultiplyAlpha=o.premultiplyAlpha),o.unpackAlignment!==void 0&&(s.unpackAlignment=o.unpackAlignment),o.compareFunction!==void 0&&(s.compareFunction=o.compareFunction),o.userData!==void 0&&(s.userData=o.userData),g[o.uuid]=s}return g}parseObject(A,e,i,g,I){let n;function o(c){return e[c],e[c]}function a(c){if(c!==void 0){if(Array.isArray(c)){const E=[];for(let D=0,y=c.length;D<y;D++){const S=c[D];i[S],E.push(i[S])}return E}return i[c],i[c]}}function r(c){return g[c],g[c]}let s,B;switch(A.type){case"Scene":n=new g1,A.background!==void 0&&(Number.isInteger(A.background)?n.background=new wt(A.background):n.background=r(A.background)),A.environment!==void 0&&(n.environment=r(A.environment)),A.fog!==void 0&&(A.fog.type==="Fog"?n.fog=new Zb(A.fog.color,A.fog.near,A.fog.far):A.fog.type==="FogExp2"&&(n.fog=new jb(A.fog.color,A.fog.density)),A.fog.name!==""&&(n.fog.name=A.fog.name)),A.backgroundBlurriness!==void 0&&(n.backgroundBlurriness=A.backgroundBlurriness),A.backgroundIntensity!==void 0&&(n.backgroundIntensity=A.backgroundIntensity),A.backgroundRotation!==void 0&&n.backgroundRotation.fromArray(A.backgroundRotation),A.environmentIntensity!==void 0&&(n.environmentIntensity=A.environmentIntensity),A.environmentRotation!==void 0&&n.environmentRotation.fromArray(A.environmentRotation);break;case"PerspectiveCamera":n=new jn(A.fov,A.aspect,A.near,A.far),A.focus!==void 0&&(n.focus=A.focus),A.zoom!==void 0&&(n.zoom=A.zoom),A.filmGauge!==void 0&&(n.filmGauge=A.filmGauge),A.filmOffset!==void 0&&(n.filmOffset=A.filmOffset),A.view!==void 0&&(n.view=Object.assign({},A.view));break;case"OrthographicCamera":n=new IS(A.left,A.right,A.top,A.bottom,A.near,A.far),A.zoom!==void 0&&(n.zoom=A.zoom),A.view!==void 0&&(n.view=Object.assign({},A.view));break;case"AmbientLight":n=new goA(A.color,A.intensity);break;case"DirectionalLight":n=new m1(A.color,A.intensity),n.target=A.target||"";break;case"PointLight":n=new w1(A.color,A.intensity,A.distance,A.decay);break;case"RectAreaLight":n=new IoA(A.color,A.intensity,A.width,A.height);break;case"SpotLight":n=new S1(A.color,A.intensity,A.distance,A.angle,A.penumbra,A.decay),n.target=A.target||"";break;case"HemisphereLight":n=new ioA(A.color,A.groundColor,A.intensity);break;case"LightProbe":n=new ooA().fromJSON(A);break;case"SkinnedMesh":s=o(A.geometry),B=a(A.material),n=new n1(s,B),A.bindMode!==void 0&&(n.bindMode=A.bindMode),A.bindMatrix!==void 0&&n.bindMatrix.fromArray(A.bindMatrix),A.skeleton!==void 0&&(n.skeleton=A.skeleton);break;case"Mesh":s=o(A.geometry),B=a(A.material),n=new Cn(s,B);break;case"InstancedMesh":s=o(A.geometry),B=a(A.material);const c=A.count,E=A.instanceMatrix,D=A.instanceColor;n=new o1(s,B,c),n.instanceMatrix=new Fd(new Float32Array(E.array),16),D!==void 0&&(n.instanceColor=new Fd(new Float32Array(D.array),D.itemSize));break;case"BatchedMesh":s=o(A.geometry),B=a(A.material),n=new NnA(A.maxInstanceCount,A.maxVertexCount,A.maxIndexCount,B),n.geometry=s,n.perObjectFrustumCulled=A.perObjectFrustumCulled,n.sortObjects=A.sortObjects,n._drawRanges=A.drawRanges,n._reservedRanges=A.reservedRanges,n._geometryInfo=A.geometryInfo.map(y=>{let S=null,f=null;return y.boundingBox!==void 0&&(S=new Zo().fromJSON(y.boundingBox)),y.boundingSphere!==void 0&&(f=new po().fromJSON(y.boundingSphere)),{...y,boundingBox:S,boundingSphere:f}}),n._instanceInfo=A.instanceInfo,n._availableInstanceIds=A._availableInstanceIds,n._availableGeometryIds=A._availableGeometryIds,n._nextIndexStart=A.nextIndexStart,n._nextVertexStart=A.nextVertexStart,n._geometryCount=A.geometryCount,n._maxInstanceCount=A.maxInstanceCount,n._maxVertexCount=A.maxVertexCount,n._maxIndexCount=A.maxIndexCount,n._geometryInitialized=A.geometryInitialized,n._matricesTexture=r(A.matricesTexture.uuid),n._indirectTexture=r(A.indirectTexture.uuid),A.colorsTexture!==void 0&&(n._colorsTexture=r(A.colorsTexture.uuid)),A.boundingSphere!==void 0&&(n.boundingSphere=new po().fromJSON(A.boundingSphere)),A.boundingBox!==void 0&&(n.boundingBox=new Zo().fromJSON(A.boundingBox));break;case"LOD":n=new MnA;break;case"Line":n=new mQ(o(A.geometry),a(A.material));break;case"LineLoop":n=new a1(o(A.geometry),a(A.material));break;case"LineSegments":n=new RB(o(A.geometry),a(A.material));break;case"PointCloud":case"Points":n=new r1(o(A.geometry),a(A.material));break;case"Sprite":n=new knA(a(A.material));break;case"Group":n=new $l;break;case"Bone":n=new Wb;break;default:n=new ng}if(n.uuid=A.uuid,A.name!==void 0&&(n.name=A.name),A.matrix!==void 0?(n.matrix.fromArray(A.matrix),A.matrixAutoUpdate!==void 0&&(n.matrixAutoUpdate=A.matrixAutoUpdate),n.matrixAutoUpdate&&n.matrix.decompose(n.position,n.quaternion,n.scale)):(A.position!==void 0&&n.position.fromArray(A.position),A.rotation!==void 0&&n.rotation.fromArray(A.rotation),A.quaternion!==void 0&&n.quaternion.fromArray(A.quaternion),A.scale!==void 0&&n.scale.fromArray(A.scale)),A.up!==void 0&&n.up.fromArray(A.up),A.castShadow!==void 0&&(n.castShadow=A.castShadow),A.receiveShadow!==void 0&&(n.receiveShadow=A.receiveShadow),A.shadow&&(A.shadow.intensity!==void 0&&(n.shadow.intensity=A.shadow.intensity),A.shadow.bias!==void 0&&(n.shadow.bias=A.shadow.bias),A.shadow.normalBias!==void 0&&(n.shadow.normalBias=A.shadow.normalBias),A.shadow.radius!==void 0&&(n.shadow.radius=A.shadow.radius),A.shadow.mapSize!==void 0&&n.shadow.mapSize.fromArray(A.shadow.mapSize),A.shadow.camera!==void 0&&(n.shadow.camera=this.parseObject(A.shadow.camera))),A.visible!==void 0&&(n.visible=A.visible),A.frustumCulled!==void 0&&(n.frustumCulled=A.frustumCulled),A.renderOrder!==void 0&&(n.renderOrder=A.renderOrder),A.userData!==void 0&&(n.userData=A.userData),A.layers!==void 0&&(n.layers.mask=A.layers),A.children!==void 0){const c=A.children;for(let E=0;E<c.length;E++)n.add(this.parseObject(c[E],e,i,g,I))}if(A.animations!==void 0){const c=A.animations;for(let E=0;E<c.length;E++){const D=c[E];n.animations.push(I[D])}}if(A.type==="LOD"){A.autoUpdate!==void 0&&(n.autoUpdate=A.autoUpdate);const c=A.levels;for(let E=0;E<c.length;E++){const D=c[E],y=n.getObjectByProperty("uuid",D.object);y!==void 0&&n.addLevel(y,D.distance,D.hysteresis)}}return n}bindSkeletons(A,e){Object.keys(e).length!==0&&A.traverse(function(i){if(i.isSkinnedMesh===!0&&i.skeleton!==void 0){const g=e[i.skeleton];g===void 0||i.bind(g,i.bindMatrix)}})}bindLightTargets(A){A.traverse(function(e){if(e.isDirectionalLight||e.isSpotLight){const i=e.target,g=A.getObjectByProperty("uuid",i);g!==void 0?e.target=g:e.target=new ng}})}}const ZOA={UVMapping:bb,CubeReflectionMapping:SQ,CubeRefractionMapping:ru,EquirectangularReflectionMapping:L0,EquirectangularRefractionMapping:q0,CubeUVReflectionMapping:AS},GV={RepeatWrapping:su,ClampToEdgeWrapping:Bs,MirroredRepeatWrapping:By},RV={NearestFilter:ho,NearestMipmapNearestFilter:vb,NearestMipmapLinearFilter:Vh,LinearFilter:HI,LinearMipmapNearestFilter:_D,LinearMipmapLinearFilter:oC},wq=new WeakMap;class soA extends Sa{constructor(A){super(A),this.isImageBitmapLoader=!0,this.options={premultiplyAlpha:"none"},this._abortController=new AbortController}setOptions(A){return this.options=A,this}load(A,e,i,g){A===void 0&&(A=""),this.path!==void 0&&(A=this.path+A),A=this.manager.resolveURL(A);const I=this,n=bc.get(`image-bitmap:${A}`);if(n!==void 0){if(I.manager.itemStart(A),n.then){n.then(r=>{if(wq.has(n)===!0)g&&g(wq.get(n)),I.manager.itemError(A),I.manager.itemEnd(A);else return e&&e(r),I.manager.itemEnd(A),r});return}return setTimeout(function(){e&&e(n),I.manager.itemEnd(A)},0),n}const o={};o.credentials=this.crossOrigin==="anonymous"?"same-origin":"include",o.headers=this.requestHeader,o.signal=typeof AbortSignal.any=="function"?AbortSignal.any([this._abortController.signal,this.manager.abortController.signal]):this._abortController.signal;const a=fetch(A,o).then(function(r){return r.blob()}).then(function(r){return createImageBitmap(r,Object.assign(I.options,{colorSpaceConversion:"none"}))}).then(function(r){return bc.add(`image-bitmap:${A}`,r),e&&e(r),I.manager.itemEnd(A),r}).catch(function(r){g&&g(r),wq.set(a,r),bc.remove(`image-bitmap:${A}`),I.manager.itemError(A),I.manager.itemEnd(A)});bc.add(`image-bitmap:${A}`,a),I.manager.itemStart(A)}abort(){return this._abortController.abort(),this._abortController=new AbortController,this}}let KG,k1=class{static getContext(){return KG===void 0&&(KG=new(window.AudioContext||window.webkitAudioContext)),KG}static setContext(A){KG=A}};class WOA extends Sa{constructor(A){super(A)}load(A,e,i,g){const I=this,n=new Es(this.manager);n.setResponseType("arraybuffer"),n.setPath(this.path),n.setRequestHeader(this.requestHeader),n.setWithCredentials(this.withCredentials),n.load(A,function(a){try{const r=a.slice(0);k1.getContext().decodeAudioData(r,function(B){e(B)}).catch(o)}catch(r){o(r)}},i,g);function o(a){g&&g(a),I.manager.itemError(A)}}}const UV=new Ai,KV=new Ai,mh=new Ai;class zOA{constructor(){this.type="StereoCamera",this.aspect=1,this.eyeSep=.064,this.cameraL=new jn,this.cameraL.layers.enable(1),this.cameraL.matrixAutoUpdate=!1,this.cameraR=new jn,this.cameraR.layers.enable(2),this.cameraR.matrixAutoUpdate=!1,this._cache={focus:null,fov:null,aspect:null,near:null,far:null,zoom:null,eyeSep:null}}update(A){const e=this._cache;if(e.focus!==A.focus||e.fov!==A.fov||e.aspect!==A.aspect*this.aspect||e.near!==A.near||e.far!==A.far||e.zoom!==A.zoom||e.eyeSep!==this.eyeSep){e.focus=A.focus,e.fov=A.fov,e.aspect=A.aspect*this.aspect,e.near=A.near,e.far=A.far,e.zoom=A.zoom,e.eyeSep=this.eyeSep,mh.copy(A.projectionMatrix);const g=e.eyeSep/2,I=g*e.near/e.focus,n=e.near*Math.tan(Ed*e.fov*.5)/e.zoom;let o,a;KV.elements[12]=-g,UV.elements[12]=g,o=-n*e.aspect+I,a=n*e.aspect+I,mh.elements[0]=2*e.near/(a-o),mh.elements[8]=(a+o)/(a-o),this.cameraL.projectionMatrix.copy(mh),o=-n*e.aspect-I,a=n*e.aspect-I,mh.elements[0]=2*e.near/(a-o),mh.elements[8]=(a+o)/(a-o),this.cameraR.projectionMatrix.copy(mh)}this.cameraL.matrixWorld.copy(A.matrixWorld).multiply(KV),this.cameraR.matrixWorld.copy(A.matrixWorld).multiply(UV)}}class CoA extends jn{constructor(A=[]){super(),this.isArrayCamera=!0,this.isMultiViewCamera=!1,this.cameras=A}}class M1{constructor(A=!0){this.autoStart=A,this.startTime=0,this.oldTime=0,this.elapsedTime=0,this.running=!1}start(){this.startTime=performance.now(),this.oldTime=this.startTime,this.elapsedTime=0,this.running=!0}stop(){this.getElapsedTime(),this.running=!1,this.autoStart=!1}getElapsedTime(){return this.getDelta(),this.elapsedTime}getDelta(){let A=0;if(this.autoStart&&!this.running)return this.start(),0;if(this.running){const e=performance.now();A=(e-this.oldTime)/1e3,this.oldTime=e,this.elapsedTime+=A}return A}}const kh=new wA,mq=new Kn,VOA=new wA,Mh=new wA,Nh=new wA;class XOA extends ng{constructor(){super(),this.type="AudioListener",this.context=k1.getContext(),this.gain=this.context.createGain(),this.gain.connect(this.context.destination),this.filter=null,this.timeDelta=0,this._clock=new M1}getInput(){return this.gain}removeFilter(){return this.filter!==null&&(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination),this.gain.connect(this.context.destination),this.filter=null),this}getFilter(){return this.filter}setFilter(A){return this.filter!==null?(this.gain.disconnect(this.filter),this.filter.disconnect(this.context.destination)):this.gain.disconnect(this.context.destination),this.filter=A,this.gain.connect(this.filter),this.filter.connect(this.context.destination),this}getMasterVolume(){return this.gain.gain.value}setMasterVolume(A){return this.gain.gain.setTargetAtTime(A,this.context.currentTime,.01),this}updateMatrixWorld(A){super.updateMatrixWorld(A);const e=this.context.listener;if(this.timeDelta=this._clock.getDelta(),this.matrixWorld.decompose(kh,mq,VOA),Mh.set(0,0,-1).applyQuaternion(mq),Nh.set(0,1,0).applyQuaternion(mq),e.positionX){const i=this.context.currentTime+this.timeDelta;e.positionX.linearRampToValueAtTime(kh.x,i),e.positionY.linearRampToValueAtTime(kh.y,i),e.positionZ.linearRampToValueAtTime(kh.z,i),e.forwardX.linearRampToValueAtTime(Mh.x,i),e.forwardY.linearRampToValueAtTime(Mh.y,i),e.forwardZ.linearRampToValueAtTime(Mh.z,i),e.upX.linearRampToValueAtTime(Nh.x,i),e.upY.linearRampToValueAtTime(Nh.y,i),e.upZ.linearRampToValueAtTime(Nh.z,i)}else e.setPosition(kh.x,kh.y,kh.z),e.setOrientation(Mh.x,Mh.y,Mh.z,Nh.x,Nh.y,Nh.z)}}let BoA=class extends ng{constructor(A){super(),this.type="Audio",this.listener=A,this.context=A.context,this.gain=this.context.createGain(),this.gain.connect(A.getInput()),this.autoplay=!1,this.buffer=null,this.detune=0,this.loop=!1,this.loopStart=0,this.loopEnd=0,this.offset=0,this.duration=void 0,this.playbackRate=1,this.isPlaying=!1,this.hasPlaybackControl=!0,this.source=null,this.sourceType="empty",this._startedAt=0,this._progress=0,this._connected=!1,this.filters=[]}getOutput(){return this.gain}setNodeSource(A){return this.hasPlaybackControl=!1,this.sourceType="audioNode",this.source=A,this.connect(),this}setMediaElementSource(A){return this.hasPlaybackControl=!1,this.sourceType="mediaNode",this.source=this.context.createMediaElementSource(A),this.connect(),this}setMediaStreamSource(A){return this.hasPlaybackControl=!1,this.sourceType="mediaStreamNode",this.source=this.context.createMediaStreamSource(A),this.connect(),this}setBuffer(A){return this.buffer=A,this.sourceType="buffer",this.autoplay&&this.play(),this}play(A=0){if(this.isPlaying===!0||this.hasPlaybackControl===!1)return;this._startedAt=this.context.currentTime+A;const e=this.context.createBufferSource();return e.buffer=this.buffer,e.loop=this.loop,e.loopStart=this.loopStart,e.loopEnd=this.loopEnd,e.onended=this.onEnded.bind(this),e.start(this._startedAt,this._progress+this.offset,this.duration),this.isPlaying=!0,this.source=e,this.setDetune(this.detune),this.setPlaybackRate(this.playbackRate),this.connect()}pause(){if(this.hasPlaybackControl!==!1)return this.isPlaying===!0&&(this._progress+=Math.max(this.context.currentTime-this._startedAt,0)*this.playbackRate,this.loop===!0&&(this._progress=this._progress%(this.duration||this.buffer.duration)),this.source.stop(),this.source.onended=null,this.isPlaying=!1),this}stop(A=0){if(this.hasPlaybackControl!==!1)return this._progress=0,this.source!==null&&(this.source.stop(this.context.currentTime+A),this.source.onended=null),this.isPlaying=!1,this}connect(){if(this.filters.length>0){this.source.connect(this.filters[0]);for(let A=1,e=this.filters.length;A<e;A++)this.filters[A-1].connect(this.filters[A]);this.filters[this.filters.length-1].connect(this.getOutput())}else this.source.connect(this.getOutput());return this._connected=!0,this}disconnect(){if(this._connected!==!1){if(this.filters.length>0){this.source.disconnect(this.filters[0]);for(let A=1,e=this.filters.length;A<e;A++)this.filters[A-1].disconnect(this.filters[A]);this.filters[this.filters.length-1].disconnect(this.getOutput())}else this.source.disconnect(this.getOutput());return this._connected=!1,this}}getFilters(){return this.filters}setFilters(A){return A||(A=[]),this._connected===!0?(this.disconnect(),this.filters=A.slice(),this.connect()):this.filters=A.slice(),this}setDetune(A){return this.detune=A,this.isPlaying===!0&&this.source.detune!==void 0&&this.source.detune.setTargetAtTime(this.detune,this.context.currentTime,.01),this}getDetune(){return this.detune}getFilter(){return this.getFilters()[0]}setFilter(A){return this.setFilters(A?[A]:[])}setPlaybackRate(A){if(this.hasPlaybackControl!==!1)return this.playbackRate=A,this.isPlaying===!0&&this.source.playbackRate.setTargetAtTime(this.playbackRate,this.context.currentTime,.01),this}getPlaybackRate(){return this.playbackRate}onEnded(){this.isPlaying=!1,this._progress=0}getLoop(){return this.hasPlaybackControl===!1?!1:this.loop}setLoop(A){if(this.hasPlaybackControl!==!1)return this.loop=A,this.isPlaying===!0&&(this.source.loop=this.loop),this}setLoopStart(A){return this.loopStart=A,this}setLoopEnd(A){return this.loopEnd=A,this}getVolume(){return this.gain.gain.value}setVolume(A){return this.gain.gain.setTargetAtTime(A,this.context.currentTime,.01),this}copy(A,e){return super.copy(A,e),A.sourceType!=="buffer"?this:(this.autoplay=A.autoplay,this.buffer=A.buffer,this.detune=A.detune,this.loop=A.loop,this.loopStart=A.loopStart,this.loopEnd=A.loopEnd,this.offset=A.offset,this.duration=A.duration,this.playbackRate=A.playbackRate,this.hasPlaybackControl=A.hasPlaybackControl,this.sourceType=A.sourceType,this.filters=A.filters.slice(),this)}clone(A){return new this.constructor(this.listener).copy(this,A)}};const Gh=new wA,FV=new Kn,$OA=new wA,Rh=new wA;class APA extends BoA{constructor(A){super(A),this.panner=this.context.createPanner(),this.panner.panningModel="HRTF",this.panner.connect(this.gain)}connect(){return super.connect(),this.panner.connect(this.gain),this}disconnect(){return super.disconnect(),this.panner.disconnect(this.gain),this}getOutput(){return this.panner}getRefDistance(){return this.panner.refDistance}setRefDistance(A){return this.panner.refDistance=A,this}getRolloffFactor(){return this.panner.rolloffFactor}setRolloffFactor(A){return this.panner.rolloffFactor=A,this}getDistanceModel(){return this.panner.distanceModel}setDistanceModel(A){return this.panner.distanceModel=A,this}getMaxDistance(){return this.panner.maxDistance}setMaxDistance(A){return this.panner.maxDistance=A,this}setDirectionalCone(A,e,i){return this.panner.coneInnerAngle=A,this.panner.coneOuterAngle=e,this.panner.coneOuterGain=i,this}updateMatrixWorld(A){if(super.updateMatrixWorld(A),this.hasPlaybackControl===!0&&this.isPlaying===!1)return;this.matrixWorld.decompose(Gh,FV,$OA),Rh.set(0,0,1).applyQuaternion(FV);const e=this.panner;if(e.positionX){const i=this.context.currentTime+this.listener.timeDelta;e.positionX.linearRampToValueAtTime(Gh.x,i),e.positionY.linearRampToValueAtTime(Gh.y,i),e.positionZ.linearRampToValueAtTime(Gh.z,i),e.orientationX.linearRampToValueAtTime(Rh.x,i),e.orientationY.linearRampToValueAtTime(Rh.y,i),e.orientationZ.linearRampToValueAtTime(Rh.z,i)}else e.setPosition(Gh.x,Gh.y,Gh.z),e.setOrientation(Rh.x,Rh.y,Rh.z)}}class ePA{constructor(A,e=2048){this.analyser=A.context.createAnalyser(),this.analyser.fftSize=e,this.data=new Uint8Array(this.analyser.frequencyBinCount),A.getOutput().connect(this.analyser)}getFrequencyData(){return this.analyser.getByteFrequencyData(this.data),this.data}getAverageFrequency(){let A=0;const e=this.getFrequencyData();for(let i=0;i<e.length;i++)A+=e[i];return A/e.length}}class coA{constructor(A,e,i){this.binding=A,this.valueSize=i;let g,I,n;switch(e){case"quaternion":g=this._slerp,I=this._slerpAdditive,n=this._setAdditiveIdentityQuaternion,this.buffer=new Float64Array(i*6),this._workIndex=5;break;case"string":case"bool":g=this._select,I=this._select,n=this._setAdditiveIdentityOther,this.buffer=new Array(i*5);break;default:g=this._lerp,I=this._lerpAdditive,n=this._setAdditiveIdentityNumeric,this.buffer=new Float64Array(i*5)}this._mixBufferRegion=g,this._mixBufferRegionAdditive=I,this._setIdentity=n,this._origIndex=3,this._addIndex=4,this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,this.useCount=0,this.referenceCount=0}accumulate(A,e){const i=this.buffer,g=this.valueSize,I=A*g+g;let n=this.cumulativeWeight;if(n===0){for(let o=0;o!==g;++o)i[I+o]=i[o];n=e}else{n+=e;const o=e/n;this._mixBufferRegion(i,I,0,o,g)}this.cumulativeWeight=n}accumulateAdditive(A){const e=this.buffer,i=this.valueSize,g=i*this._addIndex;this.cumulativeWeightAdditive===0&&this._setIdentity(),this._mixBufferRegionAdditive(e,g,0,A,i),this.cumulativeWeightAdditive+=A}apply(A){const e=this.valueSize,i=this.buffer,g=A*e+e,I=this.cumulativeWeight,n=this.cumulativeWeightAdditive,o=this.binding;if(this.cumulativeWeight=0,this.cumulativeWeightAdditive=0,I<1){const a=e*this._origIndex;this._mixBufferRegion(i,g,a,1-I,e)}n>0&&this._mixBufferRegionAdditive(i,g,this._addIndex*e,1,e);for(let a=e,r=e+e;a!==r;++a)if(i[a]!==i[a+e]){o.setValue(i,g);break}}saveOriginalState(){const A=this.binding,e=this.buffer,i=this.valueSize,g=i*this._origIndex;A.getValue(e,g);for(let I=i,n=g;I!==n;++I)e[I]=e[g+I%i];this._setIdentity(),this.cumulativeWeight=0,this.cumulativeWeightAdditive=0}restoreOriginalState(){const A=this.valueSize*3;this.binding.setValue(this.buffer,A)}_setAdditiveIdentityNumeric(){const A=this._addIndex*this.valueSize,e=A+this.valueSize;for(let i=A;i<e;i++)this.buffer[i]=0}_setAdditiveIdentityQuaternion(){this._setAdditiveIdentityNumeric(),this.buffer[this._addIndex*this.valueSize+3]=1}_setAdditiveIdentityOther(){const A=this._origIndex*this.valueSize,e=this._addIndex*this.valueSize;for(let i=0;i<this.valueSize;i++)this.buffer[e+i]=this.buffer[A+i]}_select(A,e,i,g,I){if(g>=.5)for(let n=0;n!==I;++n)A[e+n]=A[i+n]}_slerp(A,e,i,g){Kn.slerpFlat(A,e,A,e,A,i,g)}_slerpAdditive(A,e,i,g,I){const n=this._workIndex*I;Kn.multiplyQuaternionsFlat(A,n,A,e,A,i),Kn.slerpFlat(A,e,A,e,A,n,g)}_lerp(A,e,i,g,I){const n=1-g;for(let o=0;o!==I;++o){const a=e+o;A[a]=A[a]*n+A[i+o]*g}}_lerpAdditive(A,e,i,g,I){for(let n=0;n!==I;++n){const o=e+n;A[o]=A[o]+A[i+n]*g}}}const N1="\\[\\]\\.:\\/",tPA=new RegExp("["+N1+"]","g"),G1="[^"+N1+"]",iPA="[^"+N1.replace("\\.","")+"]",gPA=/((?:WC+[\/:])*)/.source.replace("WC",G1),IPA=/(WCOD+)?/.source.replace("WCOD",iPA),nPA=/(?:\.(WC+)(?:\[(.+)\])?)?/.source.replace("WC",G1),oPA=/\.(WC+)(?:\[(.+)\])?/.source.replace("WC",G1),aPA=new RegExp("^"+gPA+IPA+nPA+oPA+"$"),rPA=["material","materials","bones","map"];class sPA{constructor(A,e,i){const g=i||dg.parseTrackName(e);this._targetGroup=A,this._bindings=A.subscribe_(e,g)}getValue(A,e){this.bind();const i=this._targetGroup.nCachedObjects_,g=this._bindings[i];g!==void 0&&g.getValue(A,e)}setValue(A,e){const i=this._bindings;for(let g=this._targetGroup.nCachedObjects_,I=i.length;g!==I;++g)i[g].setValue(A,e)}bind(){const A=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=A.length;e!==i;++e)A[e].bind()}unbind(){const A=this._bindings;for(let e=this._targetGroup.nCachedObjects_,i=A.length;e!==i;++e)A[e].unbind()}}class dg{constructor(A,e,i){this.path=e,this.parsedPath=i||dg.parseTrackName(e),this.node=dg.findNode(A,this.parsedPath.nodeName),this.rootNode=A,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}static create(A,e,i){return A&&A.isAnimationObjectGroup?new dg.Composite(A,e,i):new dg(A,e,i)}static sanitizeNodeName(A){return A.replace(/\s/g,"_").replace(tPA,"")}static parseTrackName(A){const e=aPA.exec(A);if(e===null)throw new Error("PropertyBinding: Cannot parse trackName: "+A);const i={nodeName:e[2],objectName:e[3],objectIndex:e[4],propertyName:e[5],propertyIndex:e[6]},g=i.nodeName&&i.nodeName.lastIndexOf(".");if(g!==void 0&&g!==-1){const I=i.nodeName.substring(g+1);rPA.indexOf(I)!==-1&&(i.nodeName=i.nodeName.substring(0,g),i.objectName=I)}if(i.propertyName===null||i.propertyName.length===0)throw new Error("PropertyBinding: can not parse propertyName from trackName: "+A);return i}static findNode(A,e){if(e===void 0||e===""||e==="."||e===-1||e===A.name||e===A.uuid)return A;if(A.skeleton){const i=A.skeleton.getBoneByName(e);if(i!==void 0)return i}if(A.children){const i=function(I){for(let n=0;n<I.length;n++){const o=I[n];if(o.name===e||o.uuid===e)return o;const a=i(o.children);if(a)return a}return null},g=i(A.children);if(g)return g}return null}_getValue_unavailable(){}_setValue_unavailable(){}_getValue_direct(A,e){A[e]=this.targetObject[this.propertyName]}_getValue_array(A,e){const i=this.resolvedProperty;for(let g=0,I=i.length;g!==I;++g)A[e++]=i[g]}_getValue_arrayElement(A,e){A[e]=this.resolvedProperty[this.propertyIndex]}_getValue_toArray(A,e){this.resolvedProperty.toArray(A,e)}_setValue_direct(A,e){this.targetObject[this.propertyName]=A[e]}_setValue_direct_setNeedsUpdate(A,e){this.targetObject[this.propertyName]=A[e],this.targetObject.needsUpdate=!0}_setValue_direct_setMatrixWorldNeedsUpdate(A,e){this.targetObject[this.propertyName]=A[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_array(A,e){const i=this.resolvedProperty;for(let g=0,I=i.length;g!==I;++g)i[g]=A[e++]}_setValue_array_setNeedsUpdate(A,e){const i=this.resolvedProperty;for(let g=0,I=i.length;g!==I;++g)i[g]=A[e++];this.targetObject.needsUpdate=!0}_setValue_array_setMatrixWorldNeedsUpdate(A,e){const i=this.resolvedProperty;for(let g=0,I=i.length;g!==I;++g)i[g]=A[e++];this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_arrayElement(A,e){this.resolvedProperty[this.propertyIndex]=A[e]}_setValue_arrayElement_setNeedsUpdate(A,e){this.resolvedProperty[this.propertyIndex]=A[e],this.targetObject.needsUpdate=!0}_setValue_arrayElement_setMatrixWorldNeedsUpdate(A,e){this.resolvedProperty[this.propertyIndex]=A[e],this.targetObject.matrixWorldNeedsUpdate=!0}_setValue_fromArray(A,e){this.resolvedProperty.fromArray(A,e)}_setValue_fromArray_setNeedsUpdate(A,e){this.resolvedProperty.fromArray(A,e),this.targetObject.needsUpdate=!0}_setValue_fromArray_setMatrixWorldNeedsUpdate(A,e){this.resolvedProperty.fromArray(A,e),this.targetObject.matrixWorldNeedsUpdate=!0}_getValue_unbound(A,e){this.bind(),this.getValue(A,e)}_setValue_unbound(A,e){this.bind(),this.setValue(A,e)}bind(){let A=this.node;const e=this.parsedPath,i=e.objectName,g=e.propertyName;let I=e.propertyIndex;if(A||(A=dg.findNode(this.rootNode,e.nodeName),this.node=A),this.getValue=this._getValue_unavailable,this.setValue=this._setValue_unavailable,!A)return;if(i){let r=e.objectIndex;switch(i){case"materials":if(!A.material||!A.material.materials)return;A=A.material.materials;break;case"bones":if(!A.skeleton)return;A=A.skeleton.bones;for(let s=0;s<A.length;s++)if(A[s].name===r){r=s;break}break;case"map":if("map"in A){A=A.map;break}if(!A.material||!A.material.map)return;A=A.material.map;break;default:if(A[i]===void 0)return;A=A[i]}if(r!==void 0){if(A[r]===void 0)return;A=A[r]}}const n=A[g];if(n===void 0){const r=e.nodeName;return}let o=this.Versioning.None;this.targetObject=A,A.isMaterial===!0?o=this.Versioning.NeedsUpdate:A.isObject3D===!0&&(o=this.Versioning.MatrixWorldNeedsUpdate);let a=this.BindingType.Direct;if(I!==void 0){if(g==="morphTargetInfluences"){if(!A.geometry||!A.geometry.morphAttributes)return;A.morphTargetDictionary[I]!==void 0&&(I=A.morphTargetDictionary[I])}a=this.BindingType.ArrayElement,this.resolvedProperty=n,this.propertyIndex=I}else n.fromArray!==void 0&&n.toArray!==void 0?(a=this.BindingType.HasFromToArray,this.resolvedProperty=n):Array.isArray(n)?(a=this.BindingType.EntireArray,this.resolvedProperty=n):this.propertyName=g;this.getValue=this.GetterByBindingType[a],this.setValue=this.SetterByBindingTypeAndVersioning[a][o]}unbind(){this.node=null,this.getValue=this._getValue_unbound,this.setValue=this._setValue_unbound}}dg.Composite=sPA;dg.prototype.BindingType={Direct:0,EntireArray:1,ArrayElement:2,HasFromToArray:3};dg.prototype.Versioning={None:0,NeedsUpdate:1,MatrixWorldNeedsUpdate:2};dg.prototype.GetterByBindingType=[dg.prototype._getValue_direct,dg.prototype._getValue_array,dg.prototype._getValue_arrayElement,dg.prototype._getValue_toArray];dg.prototype.SetterByBindingTypeAndVersioning=[[dg.prototype._setValue_direct,dg.prototype._setValue_direct_setNeedsUpdate,dg.prototype._setValue_direct_setMatrixWorldNeedsUpdate],[dg.prototype._setValue_array,dg.prototype._setValue_array_setNeedsUpdate,dg.prototype._setValue_array_setMatrixWorldNeedsUpdate],[dg.prototype._setValue_arrayElement,dg.prototype._setValue_arrayElement_setNeedsUpdate,dg.prototype._setValue_arrayElement_setMatrixWorldNeedsUpdate],[dg.prototype._setValue_fromArray,dg.prototype._setValue_fromArray_setNeedsUpdate,dg.prototype._setValue_fromArray_setMatrixWorldNeedsUpdate]];class CPA{constructor(){this.isAnimationObjectGroup=!0,this.uuid=Qs(),this._objects=Array.prototype.slice.call(arguments),this.nCachedObjects_=0;const A={};this._indicesByUUID=A;for(let i=0,g=arguments.length;i!==g;++i)A[arguments[i].uuid]=i;this._paths=[],this._parsedPaths=[],this._bindings=[],this._bindingsIndicesByPath={};const e=this;this.stats={objects:{get total(){return e._objects.length},get inUse(){return this.total-e.nCachedObjects_}},get bindingsPerObject(){return e._bindings.length}}}add(){const A=this._objects,e=this._indicesByUUID,i=this._paths,g=this._parsedPaths,I=this._bindings,n=I.length;let o,a=A.length,r=this.nCachedObjects_;for(let s=0,B=arguments.length;s!==B;++s){const c=arguments[s],E=c.uuid;let D=e[E];if(D===void 0){D=a++,e[E]=D,A.push(c);for(let y=0,S=n;y!==S;++y)I[y].push(new dg(c,i[y],g[y]))}else if(D<r){o=A[D];const y=--r,S=A[y];e[S.uuid]=D,A[D]=S,e[E]=y,A[y]=c;for(let f=0,M=n;f!==M;++f){const k=I[f],m=k[y];let U=k[D];k[D]=m,U===void 0&&(U=new dg(c,i[f],g[f])),k[y]=U}}else A[D]}this.nCachedObjects_=r}remove(){const A=this._objects,e=this._indicesByUUID,i=this._bindings,g=i.length;let I=this.nCachedObjects_;for(let n=0,o=arguments.length;n!==o;++n){const a=arguments[n],r=a.uuid,s=e[r];if(s!==void 0&&s>=I){const B=I++,c=A[B];e[c.uuid]=s,A[s]=c,e[r]=B,A[B]=a;for(let E=0,D=g;E!==D;++E){const y=i[E],S=y[B],f=y[s];y[s]=S,y[B]=f}}}this.nCachedObjects_=I}uncache(){const A=this._objects,e=this._indicesByUUID,i=this._bindings,g=i.length;let I=this.nCachedObjects_,n=A.length;for(let o=0,a=arguments.length;o!==a;++o){const r=arguments[o],s=r.uuid,B=e[s];if(B!==void 0)if(delete e[s],B<I){const c=--I,E=A[c],D=--n,y=A[D];e[E.uuid]=B,A[B]=E,e[y.uuid]=c,A[c]=y,A.pop();for(let S=0,f=g;S!==f;++S){const M=i[S],k=M[c],m=M[D];M[B]=k,M[c]=m,M.pop()}}else{const c=--n,E=A[c];c>0&&(e[E.uuid]=B),A[B]=E,A.pop();for(let D=0,y=g;D!==y;++D){const S=i[D];S[B]=S[c],S.pop()}}}this.nCachedObjects_=I}subscribe_(A,e){const i=this._bindingsIndicesByPath;let g=i[A];const I=this._bindings;if(g!==void 0)return I[g];const n=this._paths,o=this._parsedPaths,a=this._objects,r=a.length,s=this.nCachedObjects_,B=new Array(r);g=I.length,i[A]=g,n.push(A),o.push(e),I.push(B);for(let c=s,E=a.length;c!==E;++c){const D=a[c];B[c]=new dg(D,A,e)}return B}unsubscribe_(A){const e=this._bindingsIndicesByPath,i=e[A];if(i!==void 0){const g=this._paths,I=this._parsedPaths,n=this._bindings,o=n.length-1,a=n[o],r=A[o];e[r]=i,n[i]=a,n.pop(),I[i]=I[o],I.pop(),g[i]=g[o],g.pop()}}}class loA{constructor(A,e,i=null,g=e.blendMode){this._mixer=A,this._clip=e,this._localRoot=i,this.blendMode=g;const I=e.tracks,n=I.length,o=new Array(n),a={endingStart:Xh,endingEnd:Xh};for(let r=0;r!==n;++r){const s=I[r].createInterpolant(null);o[r]=s,s.settings=a}this._interpolantSettings=a,this._interpolants=o,this._propertyBindings=new Array(n),this._cacheIndex=null,this._byClipCacheIndex=null,this._timeScaleInterpolant=null,this._weightInterpolant=null,this.loop=InA,this._loopCount=-1,this._startTime=null,this.time=0,this.timeScale=1,this._effectiveTimeScale=1,this.weight=1,this._effectiveWeight=1,this.repetitions=1/0,this.paused=!1,this.enabled=!0,this.clampWhenFinished=!1,this.zeroSlopeAtStart=!0,this.zeroSlopeAtEnd=!0}play(){return this._mixer._activateAction(this),this}stop(){return this._mixer._deactivateAction(this),this.reset()}reset(){return this.paused=!1,this.enabled=!0,this.time=0,this._loopCount=-1,this._startTime=null,this.stopFading().stopWarping()}isRunning(){return this.enabled&&!this.paused&&this.timeScale!==0&&this._startTime===null&&this._mixer._isActiveAction(this)}isScheduled(){return this._mixer._isActiveAction(this)}startAt(A){return this._startTime=A,this}setLoop(A,e){return this.loop=A,this.repetitions=e,this}setEffectiveWeight(A){return this.weight=A,this._effectiveWeight=this.enabled?A:0,this.stopFading()}getEffectiveWeight(){return this._effectiveWeight}fadeIn(A){return this._scheduleFading(A,0,1)}fadeOut(A){return this._scheduleFading(A,1,0)}crossFadeFrom(A,e,i=!1){if(A.fadeOut(e),this.fadeIn(e),i===!0){const g=this._clip.duration,I=A._clip.duration,n=I/g,o=g/I;A.warp(1,n,e),this.warp(o,1,e)}return this}crossFadeTo(A,e,i=!1){return A.crossFadeFrom(this,e,i)}stopFading(){const A=this._weightInterpolant;return A!==null&&(this._weightInterpolant=null,this._mixer._takeBackControlInterpolant(A)),this}setEffectiveTimeScale(A){return this.timeScale=A,this._effectiveTimeScale=this.paused?0:A,this.stopWarping()}getEffectiveTimeScale(){return this._effectiveTimeScale}setDuration(A){return this.timeScale=this._clip.duration/A,this.stopWarping()}syncWith(A){return this.time=A.time,this.timeScale=A.timeScale,this.stopWarping()}halt(A){return this.warp(this._effectiveTimeScale,0,A)}warp(A,e,i){const g=this._mixer,I=g.time,n=this.timeScale;let o=this._timeScaleInterpolant;o===null&&(o=g._lendControlInterpolant(),this._timeScaleInterpolant=o);const a=o.parameterPositions,r=o.sampleValues;return a[0]=I,a[1]=I+i,r[0]=A/n,r[1]=e/n,this}stopWarping(){const A=this._timeScaleInterpolant;return A!==null&&(this._timeScaleInterpolant=null,this._mixer._takeBackControlInterpolant(A)),this}getMixer(){return this._mixer}getClip(){return this._clip}getRoot(){return this._localRoot||this._mixer._root}_update(A,e,i,g){if(!this.enabled){this._updateWeight(A);return}const I=this._startTime;if(I!==null){const a=(A-I)*i;a<0||i===0?e=0:(this._startTime=null,e=i*a)}e*=this._updateTimeScale(A);const n=this._updateTime(e),o=this._updateWeight(A);if(o>0){const a=this._interpolants,r=this._propertyBindings;switch(this.blendMode){case WP:for(let s=0,B=a.length;s!==B;++s)a[s].evaluate(n),r[s].accumulateAdditive(o);break;case Yb:default:for(let s=0,B=a.length;s!==B;++s)a[s].evaluate(n),r[s].accumulate(g,o)}}}_updateWeight(A){let e=0;if(this.enabled){e=this.weight;const i=this._weightInterpolant;if(i!==null){const g=i.evaluate(A)[0];e*=g,A>i.parameterPositions[1]&&(this.stopFading(),g===0&&(this.enabled=!1))}}return this._effectiveWeight=e,e}_updateTimeScale(A){let e=0;if(!this.paused){e=this.timeScale;const i=this._timeScaleInterpolant;if(i!==null){const g=i.evaluate(A)[0];e*=g,A>i.parameterPositions[1]&&(this.stopWarping(),e===0?this.paused=!0:this.timeScale=e)}}return this._effectiveTimeScale=e,e}_updateTime(A){const e=this._clip.duration,i=this.loop;let g=this.time+A,I=this._loopCount;const n=i===nnA;if(A===0)return I===-1?g:n&&(I&1)===1?e-g:g;if(i===gnA){I===-1&&(this._loopCount=0,this._setEndings(!0,!0,!1));A:{if(g>=e)g=e;else if(g<0)g=0;else{this.time=g;break A}this.clampWhenFinished?this.paused=!0:this.enabled=!1,this.time=g,this._mixer.dispatchEvent({type:"finished",action:this,direction:A<0?-1:1})}}else{if(I===-1&&(A>=0?(I=0,this._setEndings(!0,this.repetitions===0,n)):this._setEndings(this.repetitions===0,!0,n)),g>=e||g<0){const o=Math.floor(g/e);g-=e*o,I+=Math.abs(o);const a=this.repetitions-I;if(a<=0)this.clampWhenFinished?this.paused=!0:this.enabled=!1,g=A>0?e:0,this.time=g,this._mixer.dispatchEvent({type:"finished",action:this,direction:A>0?1:-1});else{if(a===1){const r=A<0;this._setEndings(r,!r,n)}else this._setEndings(!1,!1,n);this._loopCount=I,this.time=g,this._mixer.dispatchEvent({type:"loop",action:this,loopDelta:o})}}else this.time=g;if(n&&(I&1)===1)return e-g}return g}_setEndings(A,e,i){const g=this._interpolantSettings;i?(g.endingStart=$h,g.endingEnd=$h):(A?g.endingStart=this.zeroSlopeAtStart?$h:Xh:g.endingStart=x0,e?g.endingEnd=this.zeroSlopeAtEnd?$h:Xh:g.endingEnd=x0)}_scheduleFading(A,e,i){const g=this._mixer,I=g.time;let n=this._weightInterpolant;n===null&&(n=g._lendControlInterpolant(),this._weightInterpolant=n);const o=n.parameterPositions,a=n.sampleValues;return o[0]=I,a[0]=e,o[1]=I+A,a[1]=i,this}}const BPA=new Float32Array(1);class cPA extends $c{constructor(A){super(),this._root=A,this._initMemoryManager(),this._accuIndex=0,this.time=0,this.timeScale=1}_bindAction(A,e){const i=A._localRoot||this._root,g=A._clip.tracks,I=g.length,n=A._propertyBindings,o=A._interpolants,a=i.uuid,r=this._bindingsByRootAndName;let s=r[a];s===void 0&&(s={},r[a]=s);for(let B=0;B!==I;++B){const c=g[B],E=c.name;let D=s[E];if(D!==void 0)++D.referenceCount,n[B]=D;else{if(D=n[B],D!==void 0){D._cacheIndex===null&&(++D.referenceCount,this._addInactiveBinding(D,a,E));continue}const y=e&&e._propertyBindings[B].binding.parsedPath;D=new coA(dg.create(i,E,y),c.ValueTypeName,c.getValueSize()),++D.referenceCount,this._addInactiveBinding(D,a,E),n[B]=D}o[B].resultBuffer=D.buffer}}_activateAction(A){if(!this._isActiveAction(A)){if(A._cacheIndex===null){const i=(A._localRoot||this._root).uuid,g=A._clip.uuid,I=this._actionsByClip[g];this._bindAction(A,I&&I.knownActions[0]),this._addInactiveAction(A,g,i)}const e=A._propertyBindings;for(let i=0,g=e.length;i!==g;++i){const I=e[i];I.useCount++===0&&(this._lendBinding(I),I.saveOriginalState())}this._lendAction(A)}}_deactivateAction(A){if(this._isActiveAction(A)){const e=A._propertyBindings;for(let i=0,g=e.length;i!==g;++i){const I=e[i];--I.useCount===0&&(I.restoreOriginalState(),this._takeBackBinding(I))}this._takeBackAction(A)}}_initMemoryManager(){this._actions=[],this._nActiveActions=0,this._actionsByClip={},this._bindings=[],this._nActiveBindings=0,this._bindingsByRootAndName={},this._controlInterpolants=[],this._nActiveControlInterpolants=0;const A=this;this.stats={actions:{get total(){return A._actions.length},get inUse(){return A._nActiveActions}},bindings:{get total(){return A._bindings.length},get inUse(){return A._nActiveBindings}},controlInterpolants:{get total(){return A._controlInterpolants.length},get inUse(){return A._nActiveControlInterpolants}}}}_isActiveAction(A){const e=A._cacheIndex;return e!==null&&e<this._nActiveActions}_addInactiveAction(A,e,i){const g=this._actions,I=this._actionsByClip;let n=I[e];if(n===void 0)n={knownActions:[A],actionByRoot:{}},A._byClipCacheIndex=0,I[e]=n;else{const o=n.knownActions;A._byClipCacheIndex=o.length,o.push(A)}A._cacheIndex=g.length,g.push(A),n.actionByRoot[i]=A}_removeInactiveAction(A){const e=this._actions,i=e[e.length-1],g=A._cacheIndex;i._cacheIndex=g,e[g]=i,e.pop(),A._cacheIndex=null;const I=A._clip.uuid,n=this._actionsByClip,o=n[I],a=o.knownActions,r=a[a.length-1],s=A._byClipCacheIndex;r._byClipCacheIndex=s,a[s]=r,a.pop(),A._byClipCacheIndex=null;const B=o.actionByRoot,c=(A._localRoot||this._root).uuid;delete B[c],a.length===0&&delete n[I],this._removeInactiveBindingsForAction(A)}_removeInactiveBindingsForAction(A){const e=A._propertyBindings;for(let i=0,g=e.length;i!==g;++i){const I=e[i];--I.referenceCount===0&&this._removeInactiveBinding(I)}}_lendAction(A){const e=this._actions,i=A._cacheIndex,g=this._nActiveActions++,I=e[g];A._cacheIndex=g,e[g]=A,I._cacheIndex=i,e[i]=I}_takeBackAction(A){const e=this._actions,i=A._cacheIndex,g=--this._nActiveActions,I=e[g];A._cacheIndex=g,e[g]=A,I._cacheIndex=i,e[i]=I}_addInactiveBinding(A,e,i){const g=this._bindingsByRootAndName,I=this._bindings;let n=g[e];n===void 0&&(n={},g[e]=n),n[i]=A,A._cacheIndex=I.length,I.push(A)}_removeInactiveBinding(A){const e=this._bindings,i=A.binding,g=i.rootNode.uuid,I=i.path,n=this._bindingsByRootAndName,o=n[g],a=e[e.length-1],r=A._cacheIndex;a._cacheIndex=r,e[r]=a,e.pop(),delete o[I],Object.keys(o).length===0&&delete n[g]}_lendBinding(A){const e=this._bindings,i=A._cacheIndex,g=this._nActiveBindings++,I=e[g];A._cacheIndex=g,e[g]=A,I._cacheIndex=i,e[i]=I}_takeBackBinding(A){const e=this._bindings,i=A._cacheIndex,g=--this._nActiveBindings,I=e[g];A._cacheIndex=g,e[g]=A,I._cacheIndex=i,e[i]=I}_lendControlInterpolant(){const A=this._controlInterpolants,e=this._nActiveControlInterpolants++;let i=A[e];return i===void 0&&(i=new p1(new Float32Array(2),new Float32Array(2),1,BPA),i.__cacheIndex=e,A[e]=i),i}_takeBackControlInterpolant(A){const e=this._controlInterpolants,i=A.__cacheIndex,g=--this._nActiveControlInterpolants,I=e[g];A.__cacheIndex=g,e[g]=A,I.__cacheIndex=i,e[i]=I}clipAction(A,e,i){const g=e||this._root,I=g.uuid;let n=typeof A=="string"?Sy.findByName(g,A):A;const o=n!==null?n.uuid:A,a=this._actionsByClip[o];let r=null;if(i===void 0&&(n!==null?i=n.blendMode:i=Yb),a!==void 0){const B=a.actionByRoot[I];if(B!==void 0&&B.blendMode===i)return B;r=a.knownActions[0],n===null&&(n=r._clip)}if(n===null)return null;const s=new loA(this,n,e,i);return this._bindAction(s,r),this._addInactiveAction(s,o,I),s}existingAction(A,e){const i=e||this._root,g=i.uuid,I=typeof A=="string"?Sy.findByName(i,A):A,n=I?I.uuid:A,o=this._actionsByClip[n];return o!==void 0&&o.actionByRoot[g]||null}stopAllAction(){const A=this._actions,e=this._nActiveActions;for(let i=e-1;i>=0;--i)A[i].stop();return this}update(A){A*=this.timeScale;const e=this._actions,i=this._nActiveActions,g=this.time+=A,I=Math.sign(A),n=this._accuIndex^=1;for(let r=0;r!==i;++r)e[r]._update(g,A,I,n);const o=this._bindings,a=this._nActiveBindings;for(let r=0;r!==a;++r)o[r].apply(n);return this}setTime(A){this.time=0;for(let e=0;e<this._actions.length;e++)this._actions[e].time=0;return this.update(A)}getRoot(){return this._root}uncacheClip(A){const e=this._actions,i=A.uuid,g=this._actionsByClip,I=g[i];if(I!==void 0){const n=I.knownActions;for(let o=0,a=n.length;o!==a;++o){const r=n[o];this._deactivateAction(r);const s=r._cacheIndex,B=e[e.length-1];r._cacheIndex=null,r._byClipCacheIndex=null,B._cacheIndex=s,e[s]=B,e.pop(),this._removeInactiveBindingsForAction(r)}delete g[i]}}uncacheRoot(A){const e=A.uuid,i=this._actionsByClip;for(const n in i){const o=i[n].actionByRoot,a=o[e];a!==void 0&&(this._deactivateAction(a),this._removeInactiveAction(a))}const g=this._bindingsByRootAndName,I=g[e];if(I!==void 0)for(const n in I){const o=I[n];o.restoreOriginalState(),this._removeInactiveBinding(o)}}uncacheAction(A,e){const i=this.existingAction(A,e);i!==null&&(this._deactivateAction(i),this._removeInactiveAction(i))}}class lPA extends A1{constructor(A=1,e=1,i=1,g={}){super(A,e,g),this.isRenderTarget3D=!0,this.depth=i,this.texture=new Ob(null,A,e,i),this._setTextureOptions(g),this.texture.isRenderTargetTexture=!0}}class R1{constructor(A){this.value=A}clone(){return new R1(this.value.clone===void 0?this.value:this.value.clone())}}let QPA=0;class EPA extends $c{constructor(){super(),this.isUniformsGroup=!0,Object.defineProperty(this,"id",{value:QPA++}),this.name="",this.usage=Y0,this.uniforms=[]}add(A){return this.uniforms.push(A),this}remove(A){const e=this.uniforms.indexOf(A);return e!==-1&&this.uniforms.splice(e,1),this}setName(A){return this.name=A,this}setUsage(A){return this.usage=A,this}dispose(){this.dispatchEvent({type:"dispose"})}copy(A){this.name=A.name,this.usage=A.usage;const e=A.uniforms;this.uniforms.length=0;for(let i=0,g=e.length;i<g;i++){const I=Array.isArray(e[i])?e[i]:[e[i]];for(let n=0;n<I.length;n++)this.uniforms.push(I[n].clone())}return this}clone(){return new this.constructor().copy(this)}}class uPA extends Xk{constructor(A,e,i=1){super(A,e),this.isInstancedInterleavedBuffer=!0,this.meshPerAttribute=i}copy(A){return super.copy(A),this.meshPerAttribute=A.meshPerAttribute,this}clone(A){const e=super.clone(A);return e.meshPerAttribute=this.meshPerAttribute,e}toJSON(A){const e=super.toJSON(A);return e.isInstancedInterleavedBuffer=!0,e.meshPerAttribute=this.meshPerAttribute,e}}class hPA{constructor(A,e,i,g,I,n=!1){this.isGLBufferAttribute=!0,this.name="",this.buffer=A,this.type=e,this.itemSize=i,this.elementSize=g,this.count=I,this.normalized=n,this.version=0}set needsUpdate(A){A===!0&&this.version++}setBuffer(A){return this.buffer=A,this}setType(A,e){return this.type=A,this.elementSize=e,this}setItemSize(A){return this.itemSize=A,this}setCount(A){return this.count=A,this}}const bV=new Ai;class QoA{constructor(A,e,i=0,g=1/0){this.ray=new eS(A,e),this.near=i,this.far=g,this.camera=null,this.layers=new fy,this.params={Mesh:{},Line:{threshold:1},LOD:{},Points:{threshold:1},Sprite:{}}}set(A,e){this.ray.set(A,e)}setFromCamera(A,e){e.isPerspectiveCamera?(this.ray.origin.setFromMatrixPosition(e.matrixWorld),this.ray.direction.set(A.x,A.y,.5).unproject(e).sub(this.ray.origin).normalize(),this.camera=e):e.isOrthographicCamera&&(this.ray.origin.set(A.x,A.y,(e.near+e.far)/(e.near-e.far)).unproject(e),this.ray.direction.set(0,0,-1).transformDirection(e.matrixWorld),this.camera=e)}setFromXRController(A){return bV.identity().extractRotation(A.matrixWorld),this.ray.origin.setFromMatrixPosition(A.matrixWorld),this.ray.direction.set(0,0,-1).applyMatrix4(bV),this}intersectObject(A,e=!0,i=[]){return bY(A,this,i,e),i.sort(vV),i}intersectObjects(A,e=!0,i=[]){for(let g=0,I=A.length;g<I;g++)bY(A[g],this,i,e);return i.sort(vV),i}}function vV(t,A){return t.distance-A.distance}function bY(t,A,e,i){let g=!0;if(t.layers.test(A.layers)&&t.raycast(A,e)===!1&&(g=!1),g===!0&&i===!0){const I=t.children;for(let n=0,o=I.length;n<o;n++)bY(I[n],A,e,!0)}}class dPA{constructor(){this._previousTime=0,this._currentTime=0,this._startTime=performance.now(),this._delta=0,this._elapsed=0,this._timescale=1,this._document=null,this._pageVisibilityHandler=null}connect(A){this._document=A,A.hidden!==void 0&&(this._pageVisibilityHandler=pPA.bind(this),A.addEventListener("visibilitychange",this._pageVisibilityHandler,!1))}disconnect(){this._pageVisibilityHandler!==null&&(this._document.removeEventListener("visibilitychange",this._pageVisibilityHandler),this._pageVisibilityHandler=null),this._document=null}getDelta(){return this._delta/1e3}getElapsed(){return this._elapsed/1e3}getTimescale(){return this._timescale}setTimescale(A){return this._timescale=A,this}reset(){return this._currentTime=performance.now()-this._startTime,this}dispose(){this.disconnect()}update(A){return this._pageVisibilityHandler!==null&&this._document.hidden===!0?this._delta=0:(this._previousTime=this._currentTime,this._currentTime=(A!==void 0?A:performance.now())-this._startTime,this._delta=(this._currentTime-this._previousTime)*this._timescale,this._elapsed+=this._delta),this}}function pPA(){this._document.hidden===!1&&this.reset()}class fPA{constructor(A=1,e=0,i=0){this.radius=A,this.phi=e,this.theta=i}set(A,e,i){return this.radius=A,this.phi=e,this.theta=i,this}copy(A){return this.radius=A.radius,this.phi=A.phi,this.theta=A.theta,this}makeSafe(){return this.phi=Ci(this.phi,1e-6,Math.PI-1e-6),this}setFromVector3(A){return this.setFromCartesianCoords(A.x,A.y,A.z)}setFromCartesianCoords(A,e,i){return this.radius=Math.sqrt(A*A+e*e+i*i),this.radius===0?(this.theta=0,this.phi=0):(this.theta=Math.atan2(A,i),this.phi=Math.acos(Ci(e/this.radius,-1,1))),this}clone(){return new this.constructor().copy(this)}}class DPA{constructor(A=1,e=0,i=0){this.radius=A,this.theta=e,this.y=i}set(A,e,i){return this.radius=A,this.theta=e,this.y=i,this}copy(A){return this.radius=A.radius,this.theta=A.theta,this.y=A.y,this}setFromVector3(A){return this.setFromCartesianCoords(A.x,A.y,A.z)}setFromCartesianCoords(A,e,i){return this.radius=Math.sqrt(A*A+i*i),this.theta=Math.atan2(A,i),this.y=e,this}clone(){return new this.constructor().copy(this)}}class U1{constructor(A,e,i,g){U1.prototype.isMatrix2=!0,this.elements=[1,0,0,1],A!==void 0&&this.set(A,e,i,g)}identity(){return this.set(1,0,0,1),this}fromArray(A,e=0){for(let i=0;i<4;i++)this.elements[i]=A[i+e];return this}set(A,e,i,g){const I=this.elements;return I[0]=A,I[2]=e,I[1]=i,I[3]=g,this}}const _V=new Ze;class yPA{constructor(A=new Ze(1/0,1/0),e=new Ze(-1/0,-1/0)){this.isBox2=!0,this.min=A,this.max=e}set(A,e){return this.min.copy(A),this.max.copy(e),this}setFromPoints(A){this.makeEmpty();for(let e=0,i=A.length;e<i;e++)this.expandByPoint(A[e]);return this}setFromCenterAndSize(A,e){const i=_V.copy(e).multiplyScalar(.5);return this.min.copy(A).sub(i),this.max.copy(A).add(i),this}clone(){return new this.constructor().copy(this)}copy(A){return this.min.copy(A.min),this.max.copy(A.max),this}makeEmpty(){return this.min.x=this.min.y=1/0,this.max.x=this.max.y=-1/0,this}isEmpty(){return this.max.x<this.min.x||this.max.y<this.min.y}getCenter(A){return this.isEmpty()?A.set(0,0):A.addVectors(this.min,this.max).multiplyScalar(.5)}getSize(A){return this.isEmpty()?A.set(0,0):A.subVectors(this.max,this.min)}expandByPoint(A){return this.min.min(A),this.max.max(A),this}expandByVector(A){return this.min.sub(A),this.max.add(A),this}expandByScalar(A){return this.min.addScalar(-A),this.max.addScalar(A),this}containsPoint(A){return A.x>=this.min.x&&A.x<=this.max.x&&A.y>=this.min.y&&A.y<=this.max.y}containsBox(A){return this.min.x<=A.min.x&&A.max.x<=this.max.x&&this.min.y<=A.min.y&&A.max.y<=this.max.y}getParameter(A,e){return e.set((A.x-this.min.x)/(this.max.x-this.min.x),(A.y-this.min.y)/(this.max.y-this.min.y))}intersectsBox(A){return A.max.x>=this.min.x&&A.min.x<=this.max.x&&A.max.y>=this.min.y&&A.min.y<=this.max.y}clampPoint(A,e){return e.copy(A).clamp(this.min,this.max)}distanceToPoint(A){return this.clampPoint(A,_V).distanceTo(A)}intersect(A){return this.min.max(A.min),this.max.min(A.max),this.isEmpty()&&this.makeEmpty(),this}union(A){return this.min.min(A.min),this.max.max(A.max),this}translate(A){return this.min.add(A),this.max.add(A),this}equals(A){return A.min.equals(this.min)&&A.max.equals(this.max)}}const JV=new wA,FG=new wA,Tf=new wA,Yf=new wA,kq=new wA,SPA=new wA,wPA=new wA;class mPA{constructor(A=new wA,e=new wA){this.start=A,this.end=e}set(A,e){return this.start.copy(A),this.end.copy(e),this}copy(A){return this.start.copy(A.start),this.end.copy(A.end),this}getCenter(A){return A.addVectors(this.start,this.end).multiplyScalar(.5)}delta(A){return A.subVectors(this.end,this.start)}distanceSq(){return this.start.distanceToSquared(this.end)}distance(){return this.start.distanceTo(this.end)}at(A,e){return this.delta(e).multiplyScalar(A).add(this.start)}closestPointToPointParameter(A,e){JV.subVectors(A,this.start),FG.subVectors(this.end,this.start);const i=FG.dot(FG);let I=FG.dot(JV)/i;return e&&(I=Ci(I,0,1)),I}closestPointToPoint(A,e,i){const g=this.closestPointToPointParameter(A,e);return this.delta(i).multiplyScalar(g).add(this.start)}distanceSqToLine3(A,e=SPA,i=wPA){const g=10000000000000001e-32;let I,n;const o=this.start,a=A.start,r=this.end,s=A.end;Tf.subVectors(r,o),Yf.subVectors(s,a),kq.subVectors(o,a);const B=Tf.dot(Tf),c=Yf.dot(Yf),E=Yf.dot(kq);if(B<=g&&c<=g)return e.copy(o),i.copy(a),e.sub(i),e.dot(e);if(B<=g)I=0,n=E/c,n=Ci(n,0,1);else{const D=Tf.dot(kq);if(c<=g)n=0,I=Ci(-D/B,0,1);else{const y=Tf.dot(Yf),S=B*c-y*y;S!==0?I=Ci((y*E-D*c)/S,0,1):I=0,n=(y*I+E)/c,n<0?(n=0,I=Ci(-D/B,0,1)):n>1&&(n=1,I=Ci((y-D)/B,0,1))}}return e.copy(o).add(Tf.multiplyScalar(I)),i.copy(a).add(Yf.multiplyScalar(n)),e.sub(i),e.dot(e)}applyMatrix4(A){return this.start.applyMatrix4(A),this.end.applyMatrix4(A),this}equals(A){return A.start.equals(this.start)&&A.end.equals(this.end)}clone(){return new this.constructor().copy(this)}}const LV=new wA;class kPA extends ng{constructor(A,e){super(),this.light=A,this.matrixAutoUpdate=!1,this.color=e,this.type="SpotLightHelper";const i=new fi,g=[0,0,0,0,0,1,0,0,0,1,0,1,0,0,0,-1,0,1,0,0,0,0,1,1,0,0,0,0,-1,1];for(let n=0,o=1,a=32;n<a;n++,o++){const r=n/a*Math.PI*2,s=o/a*Math.PI*2;g.push(Math.cos(r),Math.sin(r),1,Math.cos(s),Math.sin(s),1)}i.setAttribute("position",new bt(g,3));const I=new ya({fog:!1,toneMapped:!1});this.cone=new RB(i,I),this.add(this.cone),this.update()}dispose(){this.cone.geometry.dispose(),this.cone.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),this.parent?(this.parent.updateWorldMatrix(!0),this.matrix.copy(this.parent.matrixWorld).invert().multiply(this.light.matrixWorld)):this.matrix.copy(this.light.matrixWorld),this.matrixWorld.copy(this.light.matrixWorld);const A=this.light.distance?this.light.distance:1e3,e=A*Math.tan(this.light.angle);this.cone.scale.set(e,e,A),LV.setFromMatrixPosition(this.light.target.matrixWorld),this.cone.lookAt(LV),this.color!==void 0?this.cone.material.color.set(this.color):this.cone.material.color.copy(this.light.color)}}const dE=new wA,bG=new Ai,Mq=new Ai;class MPA extends RB{constructor(A){const e=EoA(A),i=new fi,g=[],I=[];for(let r=0;r<e.length;r++){const s=e[r];s.parent&&s.parent.isBone&&(g.push(0,0,0),g.push(0,0,0),I.push(0,0,0),I.push(0,0,0))}i.setAttribute("position",new bt(g,3)),i.setAttribute("color",new bt(I,3));const n=new ya({vertexColors:!0,depthTest:!1,depthWrite:!1,toneMapped:!1,transparent:!0});super(i,n),this.isSkeletonHelper=!0,this.type="SkeletonHelper",this.root=A,this.bones=e,this.matrix=A.matrixWorld,this.matrixAutoUpdate=!1;const o=new wt(255),a=new wt(65280);this.setColors(o,a)}updateMatrixWorld(A){const e=this.bones,i=this.geometry,g=i.getAttribute("position");Mq.copy(this.root.matrixWorld).invert();for(let I=0,n=0;I<e.length;I++){const o=e[I];o.parent&&o.parent.isBone&&(bG.multiplyMatrices(Mq,o.matrixWorld),dE.setFromMatrixPosition(bG),g.setXYZ(n,dE.x,dE.y,dE.z),bG.multiplyMatrices(Mq,o.parent.matrixWorld),dE.setFromMatrixPosition(bG),g.setXYZ(n+1,dE.x,dE.y,dE.z),n+=2)}i.getAttribute("position").needsUpdate=!0,super.updateMatrixWorld(A)}setColors(A,e){const g=this.geometry.getAttribute("color");for(let I=0;I<g.count;I+=2)g.setXYZ(I,A.r,A.g,A.b),g.setXYZ(I+1,e.r,e.g,e.b);return g.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}function EoA(t){const A=[];t.isBone===!0&&A.push(t);for(let e=0;e<t.children.length;e++)A.push(...EoA(t.children[e]));return A}class NPA extends Cn{constructor(A,e,i){const g=new iM(e,4,2),I=new ls({wireframe:!0,fog:!1,toneMapped:!1});super(g,I),this.light=A,this.color=i,this.type="PointLightHelper",this.matrix=this.light.matrixWorld,this.matrixAutoUpdate=!1,this.update()}dispose(){this.geometry.dispose(),this.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.color!==void 0?this.material.color.set(this.color):this.material.color.copy(this.light.color)}}const GPA=new wA,qV=new wt,xV=new wt;class RPA extends ng{constructor(A,e,i){super(),this.light=A,this.matrix=A.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="HemisphereLightHelper";const g=new tM(e);g.rotateY(Math.PI*.5),this.material=new ls({wireframe:!0,fog:!1,toneMapped:!1}),this.color===void 0&&(this.material.vertexColors=!0);const I=g.getAttribute("position"),n=new Float32Array(I.count*3);g.setAttribute("color",new eg(n,3)),this.add(new Cn(g,this.material)),this.update()}dispose(){this.children[0].geometry.dispose(),this.children[0].material.dispose()}update(){const A=this.children[0];if(this.color!==void 0)this.material.color.set(this.color);else{const e=A.geometry.getAttribute("color");qV.copy(this.light.color),xV.copy(this.light.groundColor);for(let i=0,g=e.count;i<g;i++){const I=i<g/2?qV:xV;e.setXYZ(i,I.r,I.g,I.b)}e.needsUpdate=!0}this.light.updateWorldMatrix(!0,!1),A.lookAt(GPA.setFromMatrixPosition(this.light.matrixWorld).negate())}}class UPA extends RB{constructor(A=10,e=10,i=4473924,g=8947848){i=new wt(i),g=new wt(g);const I=e/2,n=A/e,o=A/2,a=[],r=[];for(let c=0,E=0,D=-o;c<=e;c++,D+=n){a.push(-o,0,D,o,0,D),a.push(D,0,-o,D,0,o);const y=c===I?i:g;y.toArray(r,E),E+=3,y.toArray(r,E),E+=3,y.toArray(r,E),E+=3,y.toArray(r,E),E+=3}const s=new fi;s.setAttribute("position",new bt(a,3)),s.setAttribute("color",new bt(r,3));const B=new ya({vertexColors:!0,toneMapped:!1});super(s,B),this.type="GridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}class KPA extends RB{constructor(A=10,e=16,i=8,g=64,I=4473924,n=8947848){I=new wt(I),n=new wt(n);const o=[],a=[];if(e>1)for(let B=0;B<e;B++){const c=B/e*(Math.PI*2),E=Math.sin(c)*A,D=Math.cos(c)*A;o.push(0,0,0),o.push(E,0,D);const y=B&1?I:n;a.push(y.r,y.g,y.b),a.push(y.r,y.g,y.b)}for(let B=0;B<i;B++){const c=B&1?I:n,E=A-A/i*B;for(let D=0;D<g;D++){let y=D/g*(Math.PI*2),S=Math.sin(y)*E,f=Math.cos(y)*E;o.push(S,0,f),a.push(c.r,c.g,c.b),y=(D+1)/g*(Math.PI*2),S=Math.sin(y)*E,f=Math.cos(y)*E,o.push(S,0,f),a.push(c.r,c.g,c.b)}}const r=new fi;r.setAttribute("position",new bt(o,3)),r.setAttribute("color",new bt(a,3));const s=new ya({vertexColors:!0,toneMapped:!1});super(r,s),this.type="PolarGridHelper"}dispose(){this.geometry.dispose(),this.material.dispose()}}const TV=new wA,vG=new wA,YV=new wA;class FPA extends ng{constructor(A,e,i){super(),this.light=A,this.matrix=A.matrixWorld,this.matrixAutoUpdate=!1,this.color=i,this.type="DirectionalLightHelper",e===void 0&&(e=1);let g=new fi;g.setAttribute("position",new bt([-e,e,0,e,e,0,e,-e,0,-e,-e,0,-e,e,0],3));const I=new ya({fog:!1,toneMapped:!1});this.lightPlane=new mQ(g,I),this.add(this.lightPlane),g=new fi,g.setAttribute("position",new bt([0,0,0,0,0,1],3)),this.targetLine=new mQ(g,I),this.add(this.targetLine),this.update()}dispose(){this.lightPlane.geometry.dispose(),this.lightPlane.material.dispose(),this.targetLine.geometry.dispose(),this.targetLine.material.dispose()}update(){this.light.updateWorldMatrix(!0,!1),this.light.target.updateWorldMatrix(!0,!1),TV.setFromMatrixPosition(this.light.matrixWorld),vG.setFromMatrixPosition(this.light.target.matrixWorld),YV.subVectors(vG,TV),this.lightPlane.lookAt(vG),this.color!==void 0?(this.lightPlane.material.color.set(this.color),this.targetLine.material.color.set(this.color)):(this.lightPlane.material.color.copy(this.light.color),this.targetLine.material.color.copy(this.light.color)),this.targetLine.lookAt(vG),this.targetLine.scale.z=YV.length()}}const _G=new wA,WI=new Pb;class bPA extends RB{constructor(A){const e=new fi,i=new ya({color:16777215,vertexColors:!0,toneMapped:!1}),g=[],I=[],n={};o("n1","n2"),o("n2","n4"),o("n4","n3"),o("n3","n1"),o("f1","f2"),o("f2","f4"),o("f4","f3"),o("f3","f1"),o("n1","f1"),o("n2","f2"),o("n3","f3"),o("n4","f4"),o("p","n1"),o("p","n2"),o("p","n3"),o("p","n4"),o("u1","u2"),o("u2","u3"),o("u3","u1"),o("c","t"),o("p","c"),o("cn1","cn2"),o("cn3","cn4"),o("cf1","cf2"),o("cf3","cf4");function o(D,y){a(D),a(y)}function a(D){g.push(0,0,0),I.push(0,0,0),n[D]===void 0&&(n[D]=[]),n[D].push(g.length/3-1)}e.setAttribute("position",new bt(g,3)),e.setAttribute("color",new bt(I,3)),super(e,i),this.type="CameraHelper",this.camera=A,this.camera.updateProjectionMatrix&&this.camera.updateProjectionMatrix(),this.matrix=A.matrixWorld,this.matrixAutoUpdate=!1,this.pointMap=n,this.update();const r=new wt(16755200),s=new wt(16711680),B=new wt(43775),c=new wt(16777215),E=new wt(3355443);this.setColors(r,s,B,c,E)}setColors(A,e,i,g,I){const o=this.geometry.getAttribute("color");return o.setXYZ(0,A.r,A.g,A.b),o.setXYZ(1,A.r,A.g,A.b),o.setXYZ(2,A.r,A.g,A.b),o.setXYZ(3,A.r,A.g,A.b),o.setXYZ(4,A.r,A.g,A.b),o.setXYZ(5,A.r,A.g,A.b),o.setXYZ(6,A.r,A.g,A.b),o.setXYZ(7,A.r,A.g,A.b),o.setXYZ(8,A.r,A.g,A.b),o.setXYZ(9,A.r,A.g,A.b),o.setXYZ(10,A.r,A.g,A.b),o.setXYZ(11,A.r,A.g,A.b),o.setXYZ(12,A.r,A.g,A.b),o.setXYZ(13,A.r,A.g,A.b),o.setXYZ(14,A.r,A.g,A.b),o.setXYZ(15,A.r,A.g,A.b),o.setXYZ(16,A.r,A.g,A.b),o.setXYZ(17,A.r,A.g,A.b),o.setXYZ(18,A.r,A.g,A.b),o.setXYZ(19,A.r,A.g,A.b),o.setXYZ(20,A.r,A.g,A.b),o.setXYZ(21,A.r,A.g,A.b),o.setXYZ(22,A.r,A.g,A.b),o.setXYZ(23,A.r,A.g,A.b),o.setXYZ(24,e.r,e.g,e.b),o.setXYZ(25,e.r,e.g,e.b),o.setXYZ(26,e.r,e.g,e.b),o.setXYZ(27,e.r,e.g,e.b),o.setXYZ(28,e.r,e.g,e.b),o.setXYZ(29,e.r,e.g,e.b),o.setXYZ(30,e.r,e.g,e.b),o.setXYZ(31,e.r,e.g,e.b),o.setXYZ(32,i.r,i.g,i.b),o.setXYZ(33,i.r,i.g,i.b),o.setXYZ(34,i.r,i.g,i.b),o.setXYZ(35,i.r,i.g,i.b),o.setXYZ(36,i.r,i.g,i.b),o.setXYZ(37,i.r,i.g,i.b),o.setXYZ(38,g.r,g.g,g.b),o.setXYZ(39,g.r,g.g,g.b),o.setXYZ(40,I.r,I.g,I.b),o.setXYZ(41,I.r,I.g,I.b),o.setXYZ(42,I.r,I.g,I.b),o.setXYZ(43,I.r,I.g,I.b),o.setXYZ(44,I.r,I.g,I.b),o.setXYZ(45,I.r,I.g,I.b),o.setXYZ(46,I.r,I.g,I.b),o.setXYZ(47,I.r,I.g,I.b),o.setXYZ(48,I.r,I.g,I.b),o.setXYZ(49,I.r,I.g,I.b),o.needsUpdate=!0,this}update(){const A=this.geometry,e=this.pointMap,i=1,g=1;let I,n;if(WI.projectionMatrixInverse.copy(this.camera.projectionMatrixInverse),this.camera.reversedDepth===!0)I=1,n=0;else if(this.camera.coordinateSystem===cs)I=-1,n=1;else if(this.camera.coordinateSystem===dy)I=0,n=1;else throw new Error("THREE.CameraHelper.update(): Invalid coordinate system: "+this.camera.coordinateSystem);on("c",e,A,WI,0,0,I),on("t",e,A,WI,0,0,n),on("n1",e,A,WI,-i,-g,I),on("n2",e,A,WI,i,-g,I),on("n3",e,A,WI,-i,g,I),on("n4",e,A,WI,i,g,I),on("f1",e,A,WI,-i,-g,n),on("f2",e,A,WI,i,-g,n),on("f3",e,A,WI,-i,g,n),on("f4",e,A,WI,i,g,n),on("u1",e,A,WI,i*.7,g*1.1,I),on("u2",e,A,WI,-i*.7,g*1.1,I),on("u3",e,A,WI,0,g*2,I),on("cf1",e,A,WI,-i,0,n),on("cf2",e,A,WI,i,0,n),on("cf3",e,A,WI,0,-g,n),on("cf4",e,A,WI,0,g,n),on("cn1",e,A,WI,-i,0,I),on("cn2",e,A,WI,i,0,I),on("cn3",e,A,WI,0,-g,I),on("cn4",e,A,WI,0,g,I),A.getAttribute("position").needsUpdate=!0}dispose(){this.geometry.dispose(),this.material.dispose()}}function on(t,A,e,i,g,I,n){_G.set(g,I,n).unproject(i);const o=A[t];if(o!==void 0){const a=e.getAttribute("position");for(let r=0,s=o.length;r<s;r++)a.setXYZ(o[r],_G.x,_G.y,_G.z)}}const JG=new Zo;class vPA extends RB{constructor(A,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),g=new Float32Array(24),I=new fi;I.setIndex(new eg(i,1)),I.setAttribute("position",new eg(g,3)),super(I,new ya({color:e,toneMapped:!1})),this.object=A,this.type="BoxHelper",this.matrixAutoUpdate=!1,this.update()}update(){if(this.object!==void 0&&JG.setFromObject(this.object),JG.isEmpty())return;const A=JG.min,e=JG.max,i=this.geometry.attributes.position,g=i.array;g[0]=e.x,g[1]=e.y,g[2]=e.z,g[3]=A.x,g[4]=e.y,g[5]=e.z,g[6]=A.x,g[7]=A.y,g[8]=e.z,g[9]=e.x,g[10]=A.y,g[11]=e.z,g[12]=e.x,g[13]=e.y,g[14]=A.z,g[15]=A.x,g[16]=e.y,g[17]=A.z,g[18]=A.x,g[19]=A.y,g[20]=A.z,g[21]=e.x,g[22]=A.y,g[23]=A.z,i.needsUpdate=!0,this.geometry.computeBoundingSphere()}setFromObject(A){return this.object=A,this.update(),this}copy(A,e){return super.copy(A,e),this.object=A.object,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class _PA extends RB{constructor(A,e=16776960){const i=new Uint16Array([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,4,1,5,2,6,3,7]),g=[1,1,1,-1,1,1,-1,-1,1,1,-1,1,1,1,-1,-1,1,-1,-1,-1,-1,1,-1,-1],I=new fi;I.setIndex(new eg(i,1)),I.setAttribute("position",new bt(g,3)),super(I,new ya({color:e,toneMapped:!1})),this.box=A,this.type="Box3Helper",this.geometry.computeBoundingSphere()}updateMatrixWorld(A){const e=this.box;e.isEmpty()||(e.getCenter(this.position),e.getSize(this.scale),this.scale.multiplyScalar(.5),super.updateMatrixWorld(A))}dispose(){this.geometry.dispose(),this.material.dispose()}}class JPA extends mQ{constructor(A,e=1,i=16776960){const g=i,I=[1,-1,0,-1,1,0,-1,-1,0,1,1,0,-1,1,0,-1,-1,0,1,-1,0,1,1,0],n=new fi;n.setAttribute("position",new bt(I,3)),n.computeBoundingSphere(),super(n,new ya({color:g,toneMapped:!1})),this.type="PlaneHelper",this.plane=A,this.size=e;const o=[1,1,0,-1,1,0,-1,-1,0,1,1,0,-1,-1,0,1,-1,0],a=new fi;a.setAttribute("position",new bt(o,3)),a.computeBoundingSphere(),this.add(new Cn(a,new ls({color:g,opacity:.2,transparent:!0,depthWrite:!1,toneMapped:!1})))}updateMatrixWorld(A){this.position.set(0,0,0),this.scale.set(.5*this.size,.5*this.size,1),this.lookAt(this.plane.normal),this.translateZ(-this.plane.constant),super.updateMatrixWorld(A)}dispose(){this.geometry.dispose(),this.material.dispose(),this.children[0].geometry.dispose(),this.children[0].material.dispose()}}const HV=new wA;let LG,Nq;class LPA extends ng{constructor(A=new wA(0,0,1),e=new wA(0,0,0),i=1,g=16776960,I=i*.2,n=I*.2){super(),this.type="ArrowHelper",LG===void 0&&(LG=new fi,LG.setAttribute("position",new bt([0,0,0,0,1,0],3)),Nq=new eM(.5,1,5,1),Nq.translate(0,-.5,0)),this.position.copy(e),this.line=new mQ(LG,new ya({color:g,toneMapped:!1})),this.line.matrixAutoUpdate=!1,this.add(this.line),this.cone=new Cn(Nq,new ls({color:g,toneMapped:!1})),this.cone.matrixAutoUpdate=!1,this.add(this.cone),this.setDirection(A),this.setLength(i,I,n)}setDirection(A){if(A.y>.99999)this.quaternion.set(0,0,0,1);else if(A.y<-.99999)this.quaternion.set(1,0,0,0);else{HV.set(A.z,0,-A.x).normalize();const e=Math.acos(A.y);this.quaternion.setFromAxisAngle(HV,e)}}setLength(A,e=A*.2,i=e*.2){this.line.scale.set(1,Math.max(1e-4,A-e),1),this.line.updateMatrix(),this.cone.scale.set(i,e,i),this.cone.position.y=A,this.cone.updateMatrix()}setColor(A){this.line.material.color.set(A),this.cone.material.color.set(A)}copy(A){return super.copy(A,!1),this.line.copy(A.line),this.cone.copy(A.cone),this}dispose(){this.line.geometry.dispose(),this.line.material.dispose(),this.cone.geometry.dispose(),this.cone.material.dispose()}}class qPA extends RB{constructor(A=1){const e=[0,0,0,A,0,0,0,0,0,0,A,0,0,0,0,0,0,A],i=[1,0,0,1,.6,0,0,1,0,.6,1,0,0,0,1,0,.6,1],g=new fi;g.setAttribute("position",new bt(e,3)),g.setAttribute("color",new bt(i,3));const I=new ya({vertexColors:!0,toneMapped:!1});super(g,I),this.type="AxesHelper"}setColors(A,e,i){const g=new wt,I=this.geometry.attributes.color.array;return g.set(A),g.toArray(I,0),g.toArray(I,3),g.set(e),g.toArray(I,6),g.toArray(I,9),g.set(i),g.toArray(I,12),g.toArray(I,15),this.geometry.attributes.color.needsUpdate=!0,this}dispose(){this.geometry.dispose(),this.material.dispose()}}class xPA{constructor(){this.type="ShapePath",this.color=new wt,this.subPaths=[],this.currentPath=null}moveTo(A,e){return this.currentPath=new eF,this.subPaths.push(this.currentPath),this.currentPath.moveTo(A,e),this}lineTo(A,e){return this.currentPath.lineTo(A,e),this}quadraticCurveTo(A,e,i,g){return this.currentPath.quadraticCurveTo(A,e,i,g),this}bezierCurveTo(A,e,i,g,I,n){return this.currentPath.bezierCurveTo(A,e,i,g,I,n),this}splineThru(A){return this.currentPath.splineThru(A),this}toShapes(A){function e(f){const M=[];for(let k=0,m=f.length;k<m;k++){const U=f[k],F=new ud;F.curves=U.curves,M.push(F)}return M}function i(f,M){const k=M.length;let m=!1;for(let U=k-1,F=0;F<k;U=F++){let b=M[U],K=M[F],R=K.x-b.x,G=K.y-b.y;if(Math.abs(G)>Number.EPSILON){if(G<0&&(b=M[F],R=-R,K=M[U],G=-G),f.y<b.y||f.y>K.y)continue;if(f.y===b.y){if(f.x===b.x)return!0}else{const J=G*(f.x-b.x)-R*(f.y-b.y);if(J===0)return!0;if(J<0)continue;m=!m}}else{if(f.y!==b.y)continue;if(K.x<=f.x&&f.x<=b.x||b.x<=f.x&&f.x<=K.x)return!0}}return m}const g=lB.isClockWise,I=this.subPaths;if(I.length===0)return[];let n,o,a;const r=[];if(I.length===1)return o=I[0],a=new ud,a.curves=o.curves,r.push(a),r;let s=!g(I[0].getPoints());s=A?!s:s;const B=[],c=[];let E=[],D=0,y;c[D]=void 0,E[D]=[];for(let f=0,M=I.length;f<M;f++)o=I[f],y=o.getPoints(),n=g(y),n=A?!n:n,n?(!s&&c[D]&&D++,c[D]={s:new ud,p:y},c[D].s.curves=o.curves,s&&D++,E[D]=[]):E[D].push({h:o,p:y[0]});if(!c[0])return e(I);if(c.length>1){let f=!1,M=0;for(let k=0,m=c.length;k<m;k++)B[k]=[];for(let k=0,m=c.length;k<m;k++){const U=E[k];for(let F=0;F<U.length;F++){const b=U[F];let K=!0;for(let R=0;R<c.length;R++)i(b.p,c[R].p)&&(k!==R&&M++,K?(K=!1,B[R].push(b)):f=!0);K&&B[k].push(b)}}M>0&&f===!1&&(E=B)}let S;for(let f=0,M=c.length;f<M;f++){a=c[f].s,r.push(a),S=E[f];for(let k=0,m=S.length;k<m;k++)a.holes.push(S[k].h)}return r}}class TPA extends $c{constructor(A,e=null){super(),this.object=A,this.domElement=e,this.enabled=!0,this.state=-1,this.keys={},this.mouseButtons={LEFT:null,MIDDLE:null,RIGHT:null},this.touches={ONE:null,TWO:null}}connect(A){A!==void 0&&(this.domElement!==null&&this.disconnect(),this.domElement=A)}disconnect(){}dispose(){}update(){}}function YPA(t,A){const e=t.image&&t.image.width?t.image.width/t.image.height:1;return e>A?(t.repeat.x=1,t.repeat.y=e/A,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2):(t.repeat.x=A/e,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0),t}function HPA(t,A){const e=t.image&&t.image.width?t.image.width/t.image.height:1;return e>A?(t.repeat.x=A/e,t.repeat.y=1,t.offset.x=(1-t.repeat.x)/2,t.offset.y=0):(t.repeat.x=1,t.repeat.y=e/A,t.offset.x=0,t.offset.y=(1-t.repeat.y)/2),t}function OPA(t){return t.repeat.x=1,t.repeat.y=1,t.offset.x=0,t.offset.y=0,t}function vY(t,A,e,i){const g=PPA(i);switch(e){case PP:return t*A;case qb:return t*A/g.components*g.byteLength;case zk:return t*A/g.components*g.byteLength;case ZP:return t*A*2/g.components*g.byteLength;case xb:return t*A*2/g.components*g.byteLength;case jP:return t*A*3/g.components*g.byteLength;case da:return t*A*4/g.components*g.byteLength;case Tb:return t*A*4/g.components*g.byteLength;case jm:case Zm:return Math.floor((t+3)/4)*Math.floor((A+3)/4)*8;case Wm:case zm:return Math.floor((t+3)/4)*Math.floor((A+3)/4)*16;case SK:case mK:return Math.max(t,16)*Math.max(A,8)/4;case yK:case wK:return Math.max(t,8)*Math.max(A,8)/2;case kK:case MK:return Math.floor((t+3)/4)*Math.floor((A+3)/4)*8;case NK:return Math.floor((t+3)/4)*Math.floor((A+3)/4)*16;case GK:return Math.floor((t+3)/4)*Math.floor((A+3)/4)*16;case RK:return Math.floor((t+4)/5)*Math.floor((A+3)/4)*16;case UK:return Math.floor((t+4)/5)*Math.floor((A+4)/5)*16;case KK:return Math.floor((t+5)/6)*Math.floor((A+4)/5)*16;case FK:return Math.floor((t+5)/6)*Math.floor((A+5)/6)*16;case bK:return Math.floor((t+7)/8)*Math.floor((A+4)/5)*16;case vK:return Math.floor((t+7)/8)*Math.floor((A+5)/6)*16;case _K:return Math.floor((t+7)/8)*Math.floor((A+7)/8)*16;case JK:return Math.floor((t+9)/10)*Math.floor((A+4)/5)*16;case LK:return Math.floor((t+9)/10)*Math.floor((A+5)/6)*16;case qK:return Math.floor((t+9)/10)*Math.floor((A+7)/8)*16;case xK:return Math.floor((t+9)/10)*Math.floor((A+9)/10)*16;case TK:return Math.floor((t+11)/12)*Math.floor((A+9)/10)*16;case YK:return Math.floor((t+11)/12)*Math.floor((A+11)/12)*16;case HK:case OK:case PK:return Math.ceil(t/4)*Math.ceil(A/4)*16;case jK:case ZK:return Math.ceil(t/4)*Math.ceil(A/4)*8;case WK:case zK:return Math.ceil(t/4)*Math.ceil(A/4)*16}throw new Error(`Unable to determine texture byte length for ${e} format.`)}function PPA(t){switch(t){case QC:case TP:return{byteLength:1,components:1};case cy:case YP:case Bp:return{byteLength:2,components:1};case Jb:case Lb:return{byteLength:2,components:4};case wQ:case _b:case ir:return{byteLength:4,components:1};case HP:case OP:return{byteLength:4,components:3}}throw new Error(`Unknown texture type ${t}.`)}class jPA{static contain(A,e){return YPA(A,e)}static cover(A,e){return HPA(A,e)}static fill(A){return OPA(A)}static getByteLength(A,e,i,g){return vY(A,e,i,g)}}typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("register",{detail:{revision:jk}}));typeof window<"u"&&(window.__THREE__||(window.__THREE__=jk));/**
 * @license
 * Copyright 2010-2025 Three.js Authors
 * SPDX-License-Identifier: MIT
 */function uoA(){let t=null,A=!1,e=null,i=null;function g(I,n){e(I,n),i=t.requestAnimationFrame(g)}return{start:function(){A!==!0&&e!==null&&(i=t.requestAnimationFrame(g),A=!0)},stop:function(){t.cancelAnimationFrame(i),A=!1},setAnimationLoop:function(I){e=I},setContext:function(I){t=I}}}function ZPA(t){const A=new WeakMap;function e(o,a){const r=o.array,s=o.usage,B=r.byteLength,c=t.createBuffer();t.bindBuffer(a,c),t.bufferData(a,r,s),o.onUploadCallback();let E;if(r instanceof Float32Array)E=t.FLOAT;else if(typeof Float16Array<"u"&&r instanceof Float16Array)E=t.HALF_FLOAT;else if(r instanceof Uint16Array)o.isFloat16BufferAttribute?E=t.HALF_FLOAT:E=t.UNSIGNED_SHORT;else if(r instanceof Int16Array)E=t.SHORT;else if(r instanceof Uint32Array)E=t.UNSIGNED_INT;else if(r instanceof Int32Array)E=t.INT;else if(r instanceof Int8Array)E=t.BYTE;else if(r instanceof Uint8Array)E=t.UNSIGNED_BYTE;else if(r instanceof Uint8ClampedArray)E=t.UNSIGNED_BYTE;else throw new Error("THREE.WebGLAttributes: Unsupported buffer data format: "+r);return{buffer:c,type:E,bytesPerElement:r.BYTES_PER_ELEMENT,version:o.version,size:B}}function i(o,a,r){const s=a.array,B=a.updateRanges;if(t.bindBuffer(r,o),B.length===0)t.bufferSubData(r,0,s);else{B.sort((E,D)=>E.start-D.start);let c=0;for(let E=1;E<B.length;E++){const D=B[c],y=B[E];y.start<=D.start+D.count+1?D.count=Math.max(D.count,y.start+y.count-D.start):(++c,B[c]=y)}B.length=c+1;for(let E=0,D=B.length;E<D;E++){const y=B[E];t.bufferSubData(r,y.start*s.BYTES_PER_ELEMENT,s,y.start,y.count)}a.clearUpdateRanges()}a.onUploadCallback()}function g(o){return o.isInterleavedBufferAttribute&&(o=o.data),A.get(o)}function I(o){o.isInterleavedBufferAttribute&&(o=o.data);const a=A.get(o);a&&(t.deleteBuffer(a.buffer),A.delete(o))}function n(o,a){if(o.isInterleavedBufferAttribute&&(o=o.data),o.isGLBufferAttribute){const s=A.get(o);(!s||s.version<o.version)&&A.set(o,{buffer:o.buffer,type:o.type,bytesPerElement:o.elementSize,version:o.version});return}const r=A.get(o);if(r===void 0)A.set(o,e(o,a));else if(r.version<o.version){if(r.size!==o.array.byteLength)throw new Error("THREE.WebGLAttributes: The size of the buffer attribute's array buffer does not match the original size. Resizing buffer attributes is not supported.");i(r.buffer,o,a),r.version=o.version}}return{get:g,remove:I,update:n}}var WPA=`#ifdef USE_ALPHAHASH
	if ( diffuseColor.a < getAlphaHashThreshold( vPosition ) ) discard;
#endif`,zPA=`#ifdef USE_ALPHAHASH
	const float ALPHA_HASH_SCALE = 0.05;
	float hash2D( vec2 value ) {
		return fract( 1.0e4 * sin( 17.0 * value.x + 0.1 * value.y ) * ( 0.1 + abs( sin( 13.0 * value.y + value.x ) ) ) );
	}
	float hash3D( vec3 value ) {
		return hash2D( vec2( hash2D( value.xy ), value.z ) );
	}
	float getAlphaHashThreshold( vec3 position ) {
		float maxDeriv = max(
			length( dFdx( position.xyz ) ),
			length( dFdy( position.xyz ) )
		);
		float pixScale = 1.0 / ( ALPHA_HASH_SCALE * maxDeriv );
		vec2 pixScales = vec2(
			exp2( floor( log2( pixScale ) ) ),
			exp2( ceil( log2( pixScale ) ) )
		);
		vec2 alpha = vec2(
			hash3D( floor( pixScales.x * position.xyz ) ),
			hash3D( floor( pixScales.y * position.xyz ) )
		);
		float lerpFactor = fract( log2( pixScale ) );
		float x = ( 1.0 - lerpFactor ) * alpha.x + lerpFactor * alpha.y;
		float a = min( lerpFactor, 1.0 - lerpFactor );
		vec3 cases = vec3(
			x * x / ( 2.0 * a * ( 1.0 - a ) ),
			( x - 0.5 * a ) / ( 1.0 - a ),
			1.0 - ( ( 1.0 - x ) * ( 1.0 - x ) / ( 2.0 * a * ( 1.0 - a ) ) )
		);
		float threshold = ( x < ( 1.0 - a ) )
			? ( ( x < a ) ? cases.x : cases.y )
			: cases.z;
		return clamp( threshold , 1.0e-6, 1.0 );
	}
#endif`,VPA=`#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, vAlphaMapUv ).g;
#endif`,XPA=`#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,$PA=`#ifdef USE_ALPHATEST
	#ifdef ALPHA_TO_COVERAGE
	diffuseColor.a = smoothstep( alphaTest, alphaTest + fwidth( diffuseColor.a ), diffuseColor.a );
	if ( diffuseColor.a == 0.0 ) discard;
	#else
	if ( diffuseColor.a < alphaTest ) discard;
	#endif
#endif`,A1A=`#ifdef USE_ALPHATEST
	uniform float alphaTest;
#endif`,e1A=`#ifdef USE_AOMAP
	float ambientOcclusion = ( texture2D( aoMap, vAoMapUv ).r - 1.0 ) * aoMapIntensity + 1.0;
	reflectedLight.indirectDiffuse *= ambientOcclusion;
	#if defined( USE_CLEARCOAT ) 
		clearcoatSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_SHEEN ) 
		sheenSpecularIndirect *= ambientOcclusion;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD )
		float dotNV = saturate( dot( geometryNormal, geometryViewDir ) );
		reflectedLight.indirectSpecular *= computeSpecularOcclusion( dotNV, ambientOcclusion, material.roughness );
	#endif
#endif`,t1A=`#ifdef USE_AOMAP
	uniform sampler2D aoMap;
	uniform float aoMapIntensity;
#endif`,i1A=`#ifdef USE_BATCHING
	#if ! defined( GL_ANGLE_multi_draw )
	#define gl_DrawID _gl_DrawID
	uniform int _gl_DrawID;
	#endif
	uniform highp sampler2D batchingTexture;
	uniform highp usampler2D batchingIdTexture;
	mat4 getBatchingMatrix( const in float i ) {
		int size = textureSize( batchingTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( batchingTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( batchingTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( batchingTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( batchingTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
	float getIndirectIndex( const in int i ) {
		int size = textureSize( batchingIdTexture, 0 ).x;
		int x = i % size;
		int y = i / size;
		return float( texelFetch( batchingIdTexture, ivec2( x, y ), 0 ).r );
	}
#endif
#ifdef USE_BATCHING_COLOR
	uniform sampler2D batchingColorTexture;
	vec3 getBatchingColor( const in float i ) {
		int size = textureSize( batchingColorTexture, 0 ).x;
		int j = int( i );
		int x = j % size;
		int y = j / size;
		return texelFetch( batchingColorTexture, ivec2( x, y ), 0 ).rgb;
	}
#endif`,g1A=`#ifdef USE_BATCHING
	mat4 batchingMatrix = getBatchingMatrix( getIndirectIndex( gl_DrawID ) );
#endif`,I1A=`vec3 transformed = vec3( position );
#ifdef USE_ALPHAHASH
	vPosition = vec3( position );
#endif`,n1A=`vec3 objectNormal = vec3( normal );
#ifdef USE_TANGENT
	vec3 objectTangent = vec3( tangent.xyz );
#endif`,o1A=`float G_BlinnPhong_Implicit( ) {
	return 0.25;
}
float D_BlinnPhong( const in float shininess, const in float dotNH ) {
	return RECIPROCAL_PI * ( shininess * 0.5 + 1.0 ) * pow( dotNH, shininess );
}
vec3 BRDF_BlinnPhong( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in vec3 specularColor, const in float shininess ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( specularColor, 1.0, dotVH );
	float G = G_BlinnPhong_Implicit( );
	float D = D_BlinnPhong( shininess, dotNH );
	return F * ( G * D );
} // validated`,a1A=`#ifdef USE_IRIDESCENCE
	const mat3 XYZ_TO_REC709 = mat3(
		 3.2404542, -0.9692660,  0.0556434,
		-1.5371385,  1.8760108, -0.2040259,
		-0.4985314,  0.0415560,  1.0572252
	);
	vec3 Fresnel0ToIor( vec3 fresnel0 ) {
		vec3 sqrtF0 = sqrt( fresnel0 );
		return ( vec3( 1.0 ) + sqrtF0 ) / ( vec3( 1.0 ) - sqrtF0 );
	}
	vec3 IorToFresnel0( vec3 transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - vec3( incidentIor ) ) / ( transmittedIor + vec3( incidentIor ) ) );
	}
	float IorToFresnel0( float transmittedIor, float incidentIor ) {
		return pow2( ( transmittedIor - incidentIor ) / ( transmittedIor + incidentIor ));
	}
	vec3 evalSensitivity( float OPD, vec3 shift ) {
		float phase = 2.0 * PI * OPD * 1.0e-9;
		vec3 val = vec3( 5.4856e-13, 4.4201e-13, 5.2481e-13 );
		vec3 pos = vec3( 1.6810e+06, 1.7953e+06, 2.2084e+06 );
		vec3 var = vec3( 4.3278e+09, 9.3046e+09, 6.6121e+09 );
		vec3 xyz = val * sqrt( 2.0 * PI * var ) * cos( pos * phase + shift ) * exp( - pow2( phase ) * var );
		xyz.x += 9.7470e-14 * sqrt( 2.0 * PI * 4.5282e+09 ) * cos( 2.2399e+06 * phase + shift[ 0 ] ) * exp( - 4.5282e+09 * pow2( phase ) );
		xyz /= 1.0685e-7;
		vec3 rgb = XYZ_TO_REC709 * xyz;
		return rgb;
	}
	vec3 evalIridescence( float outsideIOR, float eta2, float cosTheta1, float thinFilmThickness, vec3 baseF0 ) {
		vec3 I;
		float iridescenceIOR = mix( outsideIOR, eta2, smoothstep( 0.0, 0.03, thinFilmThickness ) );
		float sinTheta2Sq = pow2( outsideIOR / iridescenceIOR ) * ( 1.0 - pow2( cosTheta1 ) );
		float cosTheta2Sq = 1.0 - sinTheta2Sq;
		if ( cosTheta2Sq < 0.0 ) {
			return vec3( 1.0 );
		}
		float cosTheta2 = sqrt( cosTheta2Sq );
		float R0 = IorToFresnel0( iridescenceIOR, outsideIOR );
		float R12 = F_Schlick( R0, 1.0, cosTheta1 );
		float T121 = 1.0 - R12;
		float phi12 = 0.0;
		if ( iridescenceIOR < outsideIOR ) phi12 = PI;
		float phi21 = PI - phi12;
		vec3 baseIOR = Fresnel0ToIor( clamp( baseF0, 0.0, 0.9999 ) );		vec3 R1 = IorToFresnel0( baseIOR, iridescenceIOR );
		vec3 R23 = F_Schlick( R1, 1.0, cosTheta2 );
		vec3 phi23 = vec3( 0.0 );
		if ( baseIOR[ 0 ] < iridescenceIOR ) phi23[ 0 ] = PI;
		if ( baseIOR[ 1 ] < iridescenceIOR ) phi23[ 1 ] = PI;
		if ( baseIOR[ 2 ] < iridescenceIOR ) phi23[ 2 ] = PI;
		float OPD = 2.0 * iridescenceIOR * thinFilmThickness * cosTheta2;
		vec3 phi = vec3( phi21 ) + phi23;
		vec3 R123 = clamp( R12 * R23, 1e-5, 0.9999 );
		vec3 r123 = sqrt( R123 );
		vec3 Rs = pow2( T121 ) * R23 / ( vec3( 1.0 ) - R123 );
		vec3 C0 = R12 + Rs;
		I = C0;
		vec3 Cm = Rs - T121;
		for ( int m = 1; m <= 2; ++ m ) {
			Cm *= r123;
			vec3 Sm = 2.0 * evalSensitivity( float( m ) * OPD, float( m ) * phi );
			I += Cm * Sm;
		}
		return max( I, vec3( 0.0 ) );
	}
#endif`,r1A=`#ifdef USE_BUMPMAP
	uniform sampler2D bumpMap;
	uniform float bumpScale;
	vec2 dHdxy_fwd() {
		vec2 dSTdx = dFdx( vBumpMapUv );
		vec2 dSTdy = dFdy( vBumpMapUv );
		float Hll = bumpScale * texture2D( bumpMap, vBumpMapUv ).x;
		float dBx = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdx ).x - Hll;
		float dBy = bumpScale * texture2D( bumpMap, vBumpMapUv + dSTdy ).x - Hll;
		return vec2( dBx, dBy );
	}
	vec3 perturbNormalArb( vec3 surf_pos, vec3 surf_norm, vec2 dHdxy, float faceDirection ) {
		vec3 vSigmaX = normalize( dFdx( surf_pos.xyz ) );
		vec3 vSigmaY = normalize( dFdy( surf_pos.xyz ) );
		vec3 vN = surf_norm;
		vec3 R1 = cross( vSigmaY, vN );
		vec3 R2 = cross( vN, vSigmaX );
		float fDet = dot( vSigmaX, R1 ) * faceDirection;
		vec3 vGrad = sign( fDet ) * ( dHdxy.x * R1 + dHdxy.y * R2 );
		return normalize( abs( fDet ) * surf_norm - vGrad );
	}
#endif`,s1A=`#if NUM_CLIPPING_PLANES > 0
	vec4 plane;
	#ifdef ALPHA_TO_COVERAGE
		float distanceToPlane, distanceGradient;
		float clipOpacity = 1.0;
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
			distanceGradient = fwidth( distanceToPlane ) / 2.0;
			clipOpacity *= smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			if ( clipOpacity == 0.0 ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			float unionClipOpacity = 1.0;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				distanceToPlane = - dot( vClipPosition, plane.xyz ) + plane.w;
				distanceGradient = fwidth( distanceToPlane ) / 2.0;
				unionClipOpacity *= 1.0 - smoothstep( - distanceGradient, distanceGradient, distanceToPlane );
			}
			#pragma unroll_loop_end
			clipOpacity *= 1.0 - unionClipOpacity;
		#endif
		diffuseColor.a *= clipOpacity;
		if ( diffuseColor.a == 0.0 ) discard;
	#else
		#pragma unroll_loop_start
		for ( int i = 0; i < UNION_CLIPPING_PLANES; i ++ ) {
			plane = clippingPlanes[ i ];
			if ( dot( vClipPosition, plane.xyz ) > plane.w ) discard;
		}
		#pragma unroll_loop_end
		#if UNION_CLIPPING_PLANES < NUM_CLIPPING_PLANES
			bool clipped = true;
			#pragma unroll_loop_start
			for ( int i = UNION_CLIPPING_PLANES; i < NUM_CLIPPING_PLANES; i ++ ) {
				plane = clippingPlanes[ i ];
				clipped = ( dot( vClipPosition, plane.xyz ) > plane.w ) && clipped;
			}
			#pragma unroll_loop_end
			if ( clipped ) discard;
		#endif
	#endif
#endif`,C1A=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
	uniform vec4 clippingPlanes[ NUM_CLIPPING_PLANES ];
#endif`,B1A=`#if NUM_CLIPPING_PLANES > 0
	varying vec3 vClipPosition;
#endif`,c1A=`#if NUM_CLIPPING_PLANES > 0
	vClipPosition = - mvPosition.xyz;
#endif`,l1A=`#if defined( USE_COLOR_ALPHA )
	diffuseColor *= vColor;
#elif defined( USE_COLOR )
	diffuseColor.rgb *= vColor;
#endif`,Q1A=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR )
	varying vec3 vColor;
#endif`,E1A=`#if defined( USE_COLOR_ALPHA )
	varying vec4 vColor;
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	varying vec3 vColor;
#endif`,u1A=`#if defined( USE_COLOR_ALPHA )
	vColor = vec4( 1.0 );
#elif defined( USE_COLOR ) || defined( USE_INSTANCING_COLOR ) || defined( USE_BATCHING_COLOR )
	vColor = vec3( 1.0 );
#endif
#ifdef USE_COLOR
	vColor *= color;
#endif
#ifdef USE_INSTANCING_COLOR
	vColor.xyz *= instanceColor.xyz;
#endif
#ifdef USE_BATCHING_COLOR
	vec3 batchingColor = getBatchingColor( getIndirectIndex( gl_DrawID ) );
	vColor.xyz *= batchingColor.xyz;
#endif`,h1A=`#define PI 3.141592653589793
#define PI2 6.283185307179586
#define PI_HALF 1.5707963267948966
#define RECIPROCAL_PI 0.3183098861837907
#define RECIPROCAL_PI2 0.15915494309189535
#define EPSILON 1e-6
#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
#define whiteComplement( a ) ( 1.0 - saturate( a ) )
float pow2( const in float x ) { return x*x; }
vec3 pow2( const in vec3 x ) { return x*x; }
float pow3( const in float x ) { return x*x*x; }
float pow4( const in float x ) { float x2 = x*x; return x2*x2; }
float max3( const in vec3 v ) { return max( max( v.x, v.y ), v.z ); }
float average( const in vec3 v ) { return dot( v, vec3( 0.3333333 ) ); }
highp float rand( const in vec2 uv ) {
	const highp float a = 12.9898, b = 78.233, c = 43758.5453;
	highp float dt = dot( uv.xy, vec2( a,b ) ), sn = mod( dt, PI );
	return fract( sin( sn ) * c );
}
#ifdef HIGH_PRECISION
	float precisionSafeLength( vec3 v ) { return length( v ); }
#else
	float precisionSafeLength( vec3 v ) {
		float maxComponent = max3( abs( v ) );
		return length( v / maxComponent ) * maxComponent;
	}
#endif
struct IncidentLight {
	vec3 color;
	vec3 direction;
	bool visible;
};
struct ReflectedLight {
	vec3 directDiffuse;
	vec3 directSpecular;
	vec3 indirectDiffuse;
	vec3 indirectSpecular;
};
#ifdef USE_ALPHAHASH
	varying vec3 vPosition;
#endif
vec3 transformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( matrix * vec4( dir, 0.0 ) ).xyz );
}
vec3 inverseTransformDirection( in vec3 dir, in mat4 matrix ) {
	return normalize( ( vec4( dir, 0.0 ) * matrix ).xyz );
}
mat3 transposeMat3( const in mat3 m ) {
	mat3 tmp;
	tmp[ 0 ] = vec3( m[ 0 ].x, m[ 1 ].x, m[ 2 ].x );
	tmp[ 1 ] = vec3( m[ 0 ].y, m[ 1 ].y, m[ 2 ].y );
	tmp[ 2 ] = vec3( m[ 0 ].z, m[ 1 ].z, m[ 2 ].z );
	return tmp;
}
bool isPerspectiveMatrix( mat4 m ) {
	return m[ 2 ][ 3 ] == - 1.0;
}
vec2 equirectUv( in vec3 dir ) {
	float u = atan( dir.z, dir.x ) * RECIPROCAL_PI2 + 0.5;
	float v = asin( clamp( dir.y, - 1.0, 1.0 ) ) * RECIPROCAL_PI + 0.5;
	return vec2( u, v );
}
vec3 BRDF_Lambert( const in vec3 diffuseColor ) {
	return RECIPROCAL_PI * diffuseColor;
}
vec3 F_Schlick( const in vec3 f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
}
float F_Schlick( const in float f0, const in float f90, const in float dotVH ) {
	float fresnel = exp2( ( - 5.55473 * dotVH - 6.98316 ) * dotVH );
	return f0 * ( 1.0 - fresnel ) + ( f90 * fresnel );
} // validated`,d1A=`#ifdef ENVMAP_TYPE_CUBE_UV
	#define cubeUV_minMipLevel 4.0
	#define cubeUV_minTileSize 16.0
	float getFace( vec3 direction ) {
		vec3 absDirection = abs( direction );
		float face = - 1.0;
		if ( absDirection.x > absDirection.z ) {
			if ( absDirection.x > absDirection.y )
				face = direction.x > 0.0 ? 0.0 : 3.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		} else {
			if ( absDirection.z > absDirection.y )
				face = direction.z > 0.0 ? 2.0 : 5.0;
			else
				face = direction.y > 0.0 ? 1.0 : 4.0;
		}
		return face;
	}
	vec2 getUV( vec3 direction, float face ) {
		vec2 uv;
		if ( face == 0.0 ) {
			uv = vec2( direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 1.0 ) {
			uv = vec2( - direction.x, - direction.z ) / abs( direction.y );
		} else if ( face == 2.0 ) {
			uv = vec2( - direction.x, direction.y ) / abs( direction.z );
		} else if ( face == 3.0 ) {
			uv = vec2( - direction.z, direction.y ) / abs( direction.x );
		} else if ( face == 4.0 ) {
			uv = vec2( - direction.x, direction.z ) / abs( direction.y );
		} else {
			uv = vec2( direction.x, direction.y ) / abs( direction.z );
		}
		return 0.5 * ( uv + 1.0 );
	}
	vec3 bilinearCubeUV( sampler2D envMap, vec3 direction, float mipInt ) {
		float face = getFace( direction );
		float filterInt = max( cubeUV_minMipLevel - mipInt, 0.0 );
		mipInt = max( mipInt, cubeUV_minMipLevel );
		float faceSize = exp2( mipInt );
		highp vec2 uv = getUV( direction, face ) * ( faceSize - 2.0 ) + 1.0;
		if ( face > 2.0 ) {
			uv.y += faceSize;
			face -= 3.0;
		}
		uv.x += face * faceSize;
		uv.x += filterInt * 3.0 * cubeUV_minTileSize;
		uv.y += 4.0 * ( exp2( CUBEUV_MAX_MIP ) - faceSize );
		uv.x *= CUBEUV_TEXEL_WIDTH;
		uv.y *= CUBEUV_TEXEL_HEIGHT;
		#ifdef texture2DGradEXT
			return texture2DGradEXT( envMap, uv, vec2( 0.0 ), vec2( 0.0 ) ).rgb;
		#else
			return texture2D( envMap, uv ).rgb;
		#endif
	}
	#define cubeUV_r0 1.0
	#define cubeUV_m0 - 2.0
	#define cubeUV_r1 0.8
	#define cubeUV_m1 - 1.0
	#define cubeUV_r4 0.4
	#define cubeUV_m4 2.0
	#define cubeUV_r5 0.305
	#define cubeUV_m5 3.0
	#define cubeUV_r6 0.21
	#define cubeUV_m6 4.0
	float roughnessToMip( float roughness ) {
		float mip = 0.0;
		if ( roughness >= cubeUV_r1 ) {
			mip = ( cubeUV_r0 - roughness ) * ( cubeUV_m1 - cubeUV_m0 ) / ( cubeUV_r0 - cubeUV_r1 ) + cubeUV_m0;
		} else if ( roughness >= cubeUV_r4 ) {
			mip = ( cubeUV_r1 - roughness ) * ( cubeUV_m4 - cubeUV_m1 ) / ( cubeUV_r1 - cubeUV_r4 ) + cubeUV_m1;
		} else if ( roughness >= cubeUV_r5 ) {
			mip = ( cubeUV_r4 - roughness ) * ( cubeUV_m5 - cubeUV_m4 ) / ( cubeUV_r4 - cubeUV_r5 ) + cubeUV_m4;
		} else if ( roughness >= cubeUV_r6 ) {
			mip = ( cubeUV_r5 - roughness ) * ( cubeUV_m6 - cubeUV_m5 ) / ( cubeUV_r5 - cubeUV_r6 ) + cubeUV_m5;
		} else {
			mip = - 2.0 * log2( 1.16 * roughness );		}
		return mip;
	}
	vec4 textureCubeUV( sampler2D envMap, vec3 sampleDir, float roughness ) {
		float mip = clamp( roughnessToMip( roughness ), cubeUV_m0, CUBEUV_MAX_MIP );
		float mipF = fract( mip );
		float mipInt = floor( mip );
		vec3 color0 = bilinearCubeUV( envMap, sampleDir, mipInt );
		if ( mipF == 0.0 ) {
			return vec4( color0, 1.0 );
		} else {
			vec3 color1 = bilinearCubeUV( envMap, sampleDir, mipInt + 1.0 );
			return vec4( mix( color0, color1, mipF ), 1.0 );
		}
	}
#endif`,p1A=`vec3 transformedNormal = objectNormal;
#ifdef USE_TANGENT
	vec3 transformedTangent = objectTangent;
#endif
#ifdef USE_BATCHING
	mat3 bm = mat3( batchingMatrix );
	transformedNormal /= vec3( dot( bm[ 0 ], bm[ 0 ] ), dot( bm[ 1 ], bm[ 1 ] ), dot( bm[ 2 ], bm[ 2 ] ) );
	transformedNormal = bm * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = bm * transformedTangent;
	#endif
#endif
#ifdef USE_INSTANCING
	mat3 im = mat3( instanceMatrix );
	transformedNormal /= vec3( dot( im[ 0 ], im[ 0 ] ), dot( im[ 1 ], im[ 1 ] ), dot( im[ 2 ], im[ 2 ] ) );
	transformedNormal = im * transformedNormal;
	#ifdef USE_TANGENT
		transformedTangent = im * transformedTangent;
	#endif
#endif
transformedNormal = normalMatrix * transformedNormal;
#ifdef FLIP_SIDED
	transformedNormal = - transformedNormal;
#endif
#ifdef USE_TANGENT
	transformedTangent = ( modelViewMatrix * vec4( transformedTangent, 0.0 ) ).xyz;
	#ifdef FLIP_SIDED
		transformedTangent = - transformedTangent;
	#endif
#endif`,f1A=`#ifdef USE_DISPLACEMENTMAP
	uniform sampler2D displacementMap;
	uniform float displacementScale;
	uniform float displacementBias;
#endif`,D1A=`#ifdef USE_DISPLACEMENTMAP
	transformed += normalize( objectNormal ) * ( texture2D( displacementMap, vDisplacementMapUv ).x * displacementScale + displacementBias );
#endif`,y1A=`#ifdef USE_EMISSIVEMAP
	vec4 emissiveColor = texture2D( emissiveMap, vEmissiveMapUv );
	#ifdef DECODE_VIDEO_TEXTURE_EMISSIVE
		emissiveColor = sRGBTransferEOTF( emissiveColor );
	#endif
	totalEmissiveRadiance *= emissiveColor.rgb;
#endif`,S1A=`#ifdef USE_EMISSIVEMAP
	uniform sampler2D emissiveMap;
#endif`,w1A="gl_FragColor = linearToOutputTexel( gl_FragColor );",m1A=`vec4 LinearTransferOETF( in vec4 value ) {
	return value;
}
vec4 sRGBTransferEOTF( in vec4 value ) {
	return vec4( mix( pow( value.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), value.rgb * 0.0773993808, vec3( lessThanEqual( value.rgb, vec3( 0.04045 ) ) ) ), value.a );
}
vec4 sRGBTransferOETF( in vec4 value ) {
	return vec4( mix( pow( value.rgb, vec3( 0.41666 ) ) * 1.055 - vec3( 0.055 ), value.rgb * 12.92, vec3( lessThanEqual( value.rgb, vec3( 0.0031308 ) ) ) ), value.a );
}`,k1A=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vec3 cameraToFrag;
		if ( isOrthographic ) {
			cameraToFrag = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToFrag = normalize( vWorldPosition - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vec3 reflectVec = reflect( cameraToFrag, worldNormal );
		#else
			vec3 reflectVec = refract( cameraToFrag, worldNormal, refractionRatio );
		#endif
	#else
		vec3 reflectVec = vReflect;
	#endif
	#ifdef ENVMAP_TYPE_CUBE
		vec4 envColor = textureCube( envMap, envMapRotation * vec3( flipEnvMap * reflectVec.x, reflectVec.yz ) );
	#else
		vec4 envColor = vec4( 0.0 );
	#endif
	#ifdef ENVMAP_BLENDING_MULTIPLY
		outgoingLight = mix( outgoingLight, outgoingLight * envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_MIX )
		outgoingLight = mix( outgoingLight, envColor.xyz, specularStrength * reflectivity );
	#elif defined( ENVMAP_BLENDING_ADD )
		outgoingLight += envColor.xyz * specularStrength * reflectivity;
	#endif
#endif`,M1A=`#ifdef USE_ENVMAP
	uniform float envMapIntensity;
	uniform float flipEnvMap;
	uniform mat3 envMapRotation;
	#ifdef ENVMAP_TYPE_CUBE
		uniform samplerCube envMap;
	#else
		uniform sampler2D envMap;
	#endif
	
#endif`,N1A=`#ifdef USE_ENVMAP
	uniform float reflectivity;
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		varying vec3 vWorldPosition;
		uniform float refractionRatio;
	#else
		varying vec3 vReflect;
	#endif
#endif`,G1A=`#ifdef USE_ENVMAP
	#if defined( USE_BUMPMAP ) || defined( USE_NORMALMAP ) || defined( PHONG ) || defined( LAMBERT )
		#define ENV_WORLDPOS
	#endif
	#ifdef ENV_WORLDPOS
		
		varying vec3 vWorldPosition;
	#else
		varying vec3 vReflect;
		uniform float refractionRatio;
	#endif
#endif`,R1A=`#ifdef USE_ENVMAP
	#ifdef ENV_WORLDPOS
		vWorldPosition = worldPosition.xyz;
	#else
		vec3 cameraToVertex;
		if ( isOrthographic ) {
			cameraToVertex = normalize( vec3( - viewMatrix[ 0 ][ 2 ], - viewMatrix[ 1 ][ 2 ], - viewMatrix[ 2 ][ 2 ] ) );
		} else {
			cameraToVertex = normalize( worldPosition.xyz - cameraPosition );
		}
		vec3 worldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
		#ifdef ENVMAP_MODE_REFLECTION
			vReflect = reflect( cameraToVertex, worldNormal );
		#else
			vReflect = refract( cameraToVertex, worldNormal, refractionRatio );
		#endif
	#endif
#endif`,U1A=`#ifdef USE_FOG
	vFogDepth = - mvPosition.z;
#endif`,K1A=`#ifdef USE_FOG
	varying float vFogDepth;
#endif`,F1A=`#ifdef USE_FOG
	#ifdef FOG_EXP2
		float fogFactor = 1.0 - exp( - fogDensity * fogDensity * vFogDepth * vFogDepth );
	#else
		float fogFactor = smoothstep( fogNear, fogFar, vFogDepth );
	#endif
	gl_FragColor.rgb = mix( gl_FragColor.rgb, fogColor, fogFactor );
#endif`,b1A=`#ifdef USE_FOG
	uniform vec3 fogColor;
	varying float vFogDepth;
	#ifdef FOG_EXP2
		uniform float fogDensity;
	#else
		uniform float fogNear;
		uniform float fogFar;
	#endif
#endif`,v1A=`#ifdef USE_GRADIENTMAP
	uniform sampler2D gradientMap;
#endif
vec3 getGradientIrradiance( vec3 normal, vec3 lightDirection ) {
	float dotNL = dot( normal, lightDirection );
	vec2 coord = vec2( dotNL * 0.5 + 0.5, 0.0 );
	#ifdef USE_GRADIENTMAP
		return vec3( texture2D( gradientMap, coord ).r );
	#else
		vec2 fw = fwidth( coord ) * 0.5;
		return mix( vec3( 0.7 ), vec3( 1.0 ), smoothstep( 0.7 - fw.x, 0.7 + fw.x, coord.x ) );
	#endif
}`,_1A=`#ifdef USE_LIGHTMAP
	uniform sampler2D lightMap;
	uniform float lightMapIntensity;
#endif`,J1A=`LambertMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularStrength = specularStrength;`,L1A=`varying vec3 vViewPosition;
struct LambertMaterial {
	vec3 diffuseColor;
	float specularStrength;
};
void RE_Direct_Lambert( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Lambert( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in LambertMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Lambert
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Lambert`,q1A=`uniform bool receiveShadow;
uniform vec3 ambientLightColor;
#if defined( USE_LIGHT_PROBES )
	uniform vec3 lightProbe[ 9 ];
#endif
vec3 shGetIrradianceAt( in vec3 normal, in vec3 shCoefficients[ 9 ] ) {
	float x = normal.x, y = normal.y, z = normal.z;
	vec3 result = shCoefficients[ 0 ] * 0.886227;
	result += shCoefficients[ 1 ] * 2.0 * 0.511664 * y;
	result += shCoefficients[ 2 ] * 2.0 * 0.511664 * z;
	result += shCoefficients[ 3 ] * 2.0 * 0.511664 * x;
	result += shCoefficients[ 4 ] * 2.0 * 0.429043 * x * y;
	result += shCoefficients[ 5 ] * 2.0 * 0.429043 * y * z;
	result += shCoefficients[ 6 ] * ( 0.743125 * z * z - 0.247708 );
	result += shCoefficients[ 7 ] * 2.0 * 0.429043 * x * z;
	result += shCoefficients[ 8 ] * 0.429043 * ( x * x - y * y );
	return result;
}
vec3 getLightProbeIrradiance( const in vec3 lightProbe[ 9 ], const in vec3 normal ) {
	vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
	vec3 irradiance = shGetIrradianceAt( worldNormal, lightProbe );
	return irradiance;
}
vec3 getAmbientLightIrradiance( const in vec3 ambientLightColor ) {
	vec3 irradiance = ambientLightColor;
	return irradiance;
}
float getDistanceAttenuation( const in float lightDistance, const in float cutoffDistance, const in float decayExponent ) {
	float distanceFalloff = 1.0 / max( pow( lightDistance, decayExponent ), 0.01 );
	if ( cutoffDistance > 0.0 ) {
		distanceFalloff *= pow2( saturate( 1.0 - pow4( lightDistance / cutoffDistance ) ) );
	}
	return distanceFalloff;
}
float getSpotAttenuation( const in float coneCosine, const in float penumbraCosine, const in float angleCosine ) {
	return smoothstep( coneCosine, penumbraCosine, angleCosine );
}
#if NUM_DIR_LIGHTS > 0
	struct DirectionalLight {
		vec3 direction;
		vec3 color;
	};
	uniform DirectionalLight directionalLights[ NUM_DIR_LIGHTS ];
	void getDirectionalLightInfo( const in DirectionalLight directionalLight, out IncidentLight light ) {
		light.color = directionalLight.color;
		light.direction = directionalLight.direction;
		light.visible = true;
	}
#endif
#if NUM_POINT_LIGHTS > 0
	struct PointLight {
		vec3 position;
		vec3 color;
		float distance;
		float decay;
	};
	uniform PointLight pointLights[ NUM_POINT_LIGHTS ];
	void getPointLightInfo( const in PointLight pointLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = pointLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float lightDistance = length( lVector );
		light.color = pointLight.color;
		light.color *= getDistanceAttenuation( lightDistance, pointLight.distance, pointLight.decay );
		light.visible = ( light.color != vec3( 0.0 ) );
	}
#endif
#if NUM_SPOT_LIGHTS > 0
	struct SpotLight {
		vec3 position;
		vec3 direction;
		vec3 color;
		float distance;
		float decay;
		float coneCos;
		float penumbraCos;
	};
	uniform SpotLight spotLights[ NUM_SPOT_LIGHTS ];
	void getSpotLightInfo( const in SpotLight spotLight, const in vec3 geometryPosition, out IncidentLight light ) {
		vec3 lVector = spotLight.position - geometryPosition;
		light.direction = normalize( lVector );
		float angleCos = dot( light.direction, spotLight.direction );
		float spotAttenuation = getSpotAttenuation( spotLight.coneCos, spotLight.penumbraCos, angleCos );
		if ( spotAttenuation > 0.0 ) {
			float lightDistance = length( lVector );
			light.color = spotLight.color * spotAttenuation;
			light.color *= getDistanceAttenuation( lightDistance, spotLight.distance, spotLight.decay );
			light.visible = ( light.color != vec3( 0.0 ) );
		} else {
			light.color = vec3( 0.0 );
			light.visible = false;
		}
	}
#endif
#if NUM_RECT_AREA_LIGHTS > 0
	struct RectAreaLight {
		vec3 color;
		vec3 position;
		vec3 halfWidth;
		vec3 halfHeight;
	};
	uniform sampler2D ltc_1;	uniform sampler2D ltc_2;
	uniform RectAreaLight rectAreaLights[ NUM_RECT_AREA_LIGHTS ];
#endif
#if NUM_HEMI_LIGHTS > 0
	struct HemisphereLight {
		vec3 direction;
		vec3 skyColor;
		vec3 groundColor;
	};
	uniform HemisphereLight hemisphereLights[ NUM_HEMI_LIGHTS ];
	vec3 getHemisphereLightIrradiance( const in HemisphereLight hemiLight, const in vec3 normal ) {
		float dotNL = dot( normal, hemiLight.direction );
		float hemiDiffuseWeight = 0.5 * dotNL + 0.5;
		vec3 irradiance = mix( hemiLight.groundColor, hemiLight.skyColor, hemiDiffuseWeight );
		return irradiance;
	}
#endif`,x1A=`#ifdef USE_ENVMAP
	vec3 getIBLIrradiance( const in vec3 normal ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 worldNormal = inverseTransformDirection( normal, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * worldNormal, 1.0 );
			return PI * envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	vec3 getIBLRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness ) {
		#ifdef ENVMAP_TYPE_CUBE_UV
			vec3 reflectVec = reflect( - viewDir, normal );
			reflectVec = normalize( mix( reflectVec, normal, roughness * roughness) );
			reflectVec = inverseTransformDirection( reflectVec, viewMatrix );
			vec4 envMapColor = textureCubeUV( envMap, envMapRotation * reflectVec, roughness );
			return envMapColor.rgb * envMapIntensity;
		#else
			return vec3( 0.0 );
		#endif
	}
	#ifdef USE_ANISOTROPY
		vec3 getIBLAnisotropyRadiance( const in vec3 viewDir, const in vec3 normal, const in float roughness, const in vec3 bitangent, const in float anisotropy ) {
			#ifdef ENVMAP_TYPE_CUBE_UV
				vec3 bentNormal = cross( bitangent, viewDir );
				bentNormal = normalize( cross( bentNormal, bitangent ) );
				bentNormal = normalize( mix( bentNormal, normal, pow2( pow2( 1.0 - anisotropy * ( 1.0 - roughness ) ) ) ) );
				return getIBLRadiance( viewDir, bentNormal, roughness );
			#else
				return vec3( 0.0 );
			#endif
		}
	#endif
#endif`,T1A=`ToonMaterial material;
material.diffuseColor = diffuseColor.rgb;`,Y1A=`varying vec3 vViewPosition;
struct ToonMaterial {
	vec3 diffuseColor;
};
void RE_Direct_Toon( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	vec3 irradiance = getGradientIrradiance( geometryNormal, directLight.direction ) * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Toon( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in ToonMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_Toon
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Toon`,H1A=`BlinnPhongMaterial material;
material.diffuseColor = diffuseColor.rgb;
material.specularColor = specular;
material.specularShininess = shininess;
material.specularStrength = specularStrength;`,O1A=`varying vec3 vViewPosition;
struct BlinnPhongMaterial {
	vec3 diffuseColor;
	vec3 specularColor;
	float specularShininess;
	float specularStrength;
};
void RE_Direct_BlinnPhong( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
	reflectedLight.directSpecular += irradiance * BRDF_BlinnPhong( directLight.direction, geometryViewDir, geometryNormal, material.specularColor, material.specularShininess ) * material.specularStrength;
}
void RE_IndirectDiffuse_BlinnPhong( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in BlinnPhongMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
#define RE_Direct				RE_Direct_BlinnPhong
#define RE_IndirectDiffuse		RE_IndirectDiffuse_BlinnPhong`,P1A=`PhysicalMaterial material;
material.diffuseColor = diffuseColor.rgb * ( 1.0 - metalnessFactor );
vec3 dxy = max( abs( dFdx( nonPerturbedNormal ) ), abs( dFdy( nonPerturbedNormal ) ) );
float geometryRoughness = max( max( dxy.x, dxy.y ), dxy.z );
material.roughness = max( roughnessFactor, 0.0525 );material.roughness += geometryRoughness;
material.roughness = min( material.roughness, 1.0 );
#ifdef IOR
	material.ior = ior;
	#ifdef USE_SPECULAR
		float specularIntensityFactor = specularIntensity;
		vec3 specularColorFactor = specularColor;
		#ifdef USE_SPECULAR_COLORMAP
			specularColorFactor *= texture2D( specularColorMap, vSpecularColorMapUv ).rgb;
		#endif
		#ifdef USE_SPECULAR_INTENSITYMAP
			specularIntensityFactor *= texture2D( specularIntensityMap, vSpecularIntensityMapUv ).a;
		#endif
		material.specularF90 = mix( specularIntensityFactor, 1.0, metalnessFactor );
	#else
		float specularIntensityFactor = 1.0;
		vec3 specularColorFactor = vec3( 1.0 );
		material.specularF90 = 1.0;
	#endif
	material.specularColor = mix( min( pow2( ( material.ior - 1.0 ) / ( material.ior + 1.0 ) ) * specularColorFactor, vec3( 1.0 ) ) * specularIntensityFactor, diffuseColor.rgb, metalnessFactor );
#else
	material.specularColor = mix( vec3( 0.04 ), diffuseColor.rgb, metalnessFactor );
	material.specularF90 = 1.0;
#endif
#ifdef USE_CLEARCOAT
	material.clearcoat = clearcoat;
	material.clearcoatRoughness = clearcoatRoughness;
	material.clearcoatF0 = vec3( 0.04 );
	material.clearcoatF90 = 1.0;
	#ifdef USE_CLEARCOATMAP
		material.clearcoat *= texture2D( clearcoatMap, vClearcoatMapUv ).x;
	#endif
	#ifdef USE_CLEARCOAT_ROUGHNESSMAP
		material.clearcoatRoughness *= texture2D( clearcoatRoughnessMap, vClearcoatRoughnessMapUv ).y;
	#endif
	material.clearcoat = saturate( material.clearcoat );	material.clearcoatRoughness = max( material.clearcoatRoughness, 0.0525 );
	material.clearcoatRoughness += geometryRoughness;
	material.clearcoatRoughness = min( material.clearcoatRoughness, 1.0 );
#endif
#ifdef USE_DISPERSION
	material.dispersion = dispersion;
#endif
#ifdef USE_IRIDESCENCE
	material.iridescence = iridescence;
	material.iridescenceIOR = iridescenceIOR;
	#ifdef USE_IRIDESCENCEMAP
		material.iridescence *= texture2D( iridescenceMap, vIridescenceMapUv ).r;
	#endif
	#ifdef USE_IRIDESCENCE_THICKNESSMAP
		material.iridescenceThickness = (iridescenceThicknessMaximum - iridescenceThicknessMinimum) * texture2D( iridescenceThicknessMap, vIridescenceThicknessMapUv ).g + iridescenceThicknessMinimum;
	#else
		material.iridescenceThickness = iridescenceThicknessMaximum;
	#endif
#endif
#ifdef USE_SHEEN
	material.sheenColor = sheenColor;
	#ifdef USE_SHEEN_COLORMAP
		material.sheenColor *= texture2D( sheenColorMap, vSheenColorMapUv ).rgb;
	#endif
	material.sheenRoughness = clamp( sheenRoughness, 0.07, 1.0 );
	#ifdef USE_SHEEN_ROUGHNESSMAP
		material.sheenRoughness *= texture2D( sheenRoughnessMap, vSheenRoughnessMapUv ).a;
	#endif
#endif
#ifdef USE_ANISOTROPY
	#ifdef USE_ANISOTROPYMAP
		mat2 anisotropyMat = mat2( anisotropyVector.x, anisotropyVector.y, - anisotropyVector.y, anisotropyVector.x );
		vec3 anisotropyPolar = texture2D( anisotropyMap, vAnisotropyMapUv ).rgb;
		vec2 anisotropyV = anisotropyMat * normalize( 2.0 * anisotropyPolar.rg - vec2( 1.0 ) ) * anisotropyPolar.b;
	#else
		vec2 anisotropyV = anisotropyVector;
	#endif
	material.anisotropy = length( anisotropyV );
	if( material.anisotropy == 0.0 ) {
		anisotropyV = vec2( 1.0, 0.0 );
	} else {
		anisotropyV /= material.anisotropy;
		material.anisotropy = saturate( material.anisotropy );
	}
	material.alphaT = mix( pow2( material.roughness ), 1.0, pow2( material.anisotropy ) );
	material.anisotropyT = tbn[ 0 ] * anisotropyV.x + tbn[ 1 ] * anisotropyV.y;
	material.anisotropyB = tbn[ 1 ] * anisotropyV.x - tbn[ 0 ] * anisotropyV.y;
#endif`,j1A=`struct PhysicalMaterial {
	vec3 diffuseColor;
	float roughness;
	vec3 specularColor;
	float specularF90;
	float dispersion;
	#ifdef USE_CLEARCOAT
		float clearcoat;
		float clearcoatRoughness;
		vec3 clearcoatF0;
		float clearcoatF90;
	#endif
	#ifdef USE_IRIDESCENCE
		float iridescence;
		float iridescenceIOR;
		float iridescenceThickness;
		vec3 iridescenceFresnel;
		vec3 iridescenceF0;
	#endif
	#ifdef USE_SHEEN
		vec3 sheenColor;
		float sheenRoughness;
	#endif
	#ifdef IOR
		float ior;
	#endif
	#ifdef USE_TRANSMISSION
		float transmission;
		float transmissionAlpha;
		float thickness;
		float attenuationDistance;
		vec3 attenuationColor;
	#endif
	#ifdef USE_ANISOTROPY
		float anisotropy;
		float alphaT;
		vec3 anisotropyT;
		vec3 anisotropyB;
	#endif
};
vec3 clearcoatSpecularDirect = vec3( 0.0 );
vec3 clearcoatSpecularIndirect = vec3( 0.0 );
vec3 sheenSpecularDirect = vec3( 0.0 );
vec3 sheenSpecularIndirect = vec3(0.0 );
vec3 Schlick_to_F0( const in vec3 f, const in float f90, const in float dotVH ) {
    float x = clamp( 1.0 - dotVH, 0.0, 1.0 );
    float x2 = x * x;
    float x5 = clamp( x * x2 * x2, 0.0, 0.9999 );
    return ( f - vec3( f90 ) * x5 ) / ( 1.0 - x5 );
}
float V_GGX_SmithCorrelated( const in float alpha, const in float dotNL, const in float dotNV ) {
	float a2 = pow2( alpha );
	float gv = dotNL * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNV ) );
	float gl = dotNV * sqrt( a2 + ( 1.0 - a2 ) * pow2( dotNL ) );
	return 0.5 / max( gv + gl, EPSILON );
}
float D_GGX( const in float alpha, const in float dotNH ) {
	float a2 = pow2( alpha );
	float denom = pow2( dotNH ) * ( a2 - 1.0 ) + 1.0;
	return RECIPROCAL_PI * a2 / pow2( denom );
}
#ifdef USE_ANISOTROPY
	float V_GGX_SmithCorrelated_Anisotropic( const in float alphaT, const in float alphaB, const in float dotTV, const in float dotBV, const in float dotTL, const in float dotBL, const in float dotNV, const in float dotNL ) {
		float gv = dotNL * length( vec3( alphaT * dotTV, alphaB * dotBV, dotNV ) );
		float gl = dotNV * length( vec3( alphaT * dotTL, alphaB * dotBL, dotNL ) );
		float v = 0.5 / ( gv + gl );
		return saturate(v);
	}
	float D_GGX_Anisotropic( const in float alphaT, const in float alphaB, const in float dotNH, const in float dotTH, const in float dotBH ) {
		float a2 = alphaT * alphaB;
		highp vec3 v = vec3( alphaB * dotTH, alphaT * dotBH, a2 * dotNH );
		highp float v2 = dot( v, v );
		float w2 = a2 / v2;
		return RECIPROCAL_PI * a2 * pow2 ( w2 );
	}
#endif
#ifdef USE_CLEARCOAT
	vec3 BRDF_GGX_Clearcoat( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material) {
		vec3 f0 = material.clearcoatF0;
		float f90 = material.clearcoatF90;
		float roughness = material.clearcoatRoughness;
		float alpha = pow2( roughness );
		vec3 halfDir = normalize( lightDir + viewDir );
		float dotNL = saturate( dot( normal, lightDir ) );
		float dotNV = saturate( dot( normal, viewDir ) );
		float dotNH = saturate( dot( normal, halfDir ) );
		float dotVH = saturate( dot( viewDir, halfDir ) );
		vec3 F = F_Schlick( f0, f90, dotVH );
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
		return F * ( V * D );
	}
#endif
vec3 BRDF_GGX( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, const in PhysicalMaterial material ) {
	vec3 f0 = material.specularColor;
	float f90 = material.specularF90;
	float roughness = material.roughness;
	float alpha = pow2( roughness );
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float dotVH = saturate( dot( viewDir, halfDir ) );
	vec3 F = F_Schlick( f0, f90, dotVH );
	#ifdef USE_IRIDESCENCE
		F = mix( F, material.iridescenceFresnel, material.iridescence );
	#endif
	#ifdef USE_ANISOTROPY
		float dotTL = dot( material.anisotropyT, lightDir );
		float dotTV = dot( material.anisotropyT, viewDir );
		float dotTH = dot( material.anisotropyT, halfDir );
		float dotBL = dot( material.anisotropyB, lightDir );
		float dotBV = dot( material.anisotropyB, viewDir );
		float dotBH = dot( material.anisotropyB, halfDir );
		float V = V_GGX_SmithCorrelated_Anisotropic( material.alphaT, alpha, dotTV, dotBV, dotTL, dotBL, dotNV, dotNL );
		float D = D_GGX_Anisotropic( material.alphaT, alpha, dotNH, dotTH, dotBH );
	#else
		float V = V_GGX_SmithCorrelated( alpha, dotNL, dotNV );
		float D = D_GGX( alpha, dotNH );
	#endif
	return F * ( V * D );
}
vec2 LTC_Uv( const in vec3 N, const in vec3 V, const in float roughness ) {
	const float LUT_SIZE = 64.0;
	const float LUT_SCALE = ( LUT_SIZE - 1.0 ) / LUT_SIZE;
	const float LUT_BIAS = 0.5 / LUT_SIZE;
	float dotNV = saturate( dot( N, V ) );
	vec2 uv = vec2( roughness, sqrt( 1.0 - dotNV ) );
	uv = uv * LUT_SCALE + LUT_BIAS;
	return uv;
}
float LTC_ClippedSphereFormFactor( const in vec3 f ) {
	float l = length( f );
	return max( ( l * l + f.z ) / ( l + 1.0 ), 0.0 );
}
vec3 LTC_EdgeVectorFormFactor( const in vec3 v1, const in vec3 v2 ) {
	float x = dot( v1, v2 );
	float y = abs( x );
	float a = 0.8543985 + ( 0.4965155 + 0.0145206 * y ) * y;
	float b = 3.4175940 + ( 4.1616724 + y ) * y;
	float v = a / b;
	float theta_sintheta = ( x > 0.0 ) ? v : 0.5 * inversesqrt( max( 1.0 - x * x, 1e-7 ) ) - v;
	return cross( v1, v2 ) * theta_sintheta;
}
vec3 LTC_Evaluate( const in vec3 N, const in vec3 V, const in vec3 P, const in mat3 mInv, const in vec3 rectCoords[ 4 ] ) {
	vec3 v1 = rectCoords[ 1 ] - rectCoords[ 0 ];
	vec3 v2 = rectCoords[ 3 ] - rectCoords[ 0 ];
	vec3 lightNormal = cross( v1, v2 );
	if( dot( lightNormal, P - rectCoords[ 0 ] ) < 0.0 ) return vec3( 0.0 );
	vec3 T1, T2;
	T1 = normalize( V - N * dot( V, N ) );
	T2 = - cross( N, T1 );
	mat3 mat = mInv * transposeMat3( mat3( T1, T2, N ) );
	vec3 coords[ 4 ];
	coords[ 0 ] = mat * ( rectCoords[ 0 ] - P );
	coords[ 1 ] = mat * ( rectCoords[ 1 ] - P );
	coords[ 2 ] = mat * ( rectCoords[ 2 ] - P );
	coords[ 3 ] = mat * ( rectCoords[ 3 ] - P );
	coords[ 0 ] = normalize( coords[ 0 ] );
	coords[ 1 ] = normalize( coords[ 1 ] );
	coords[ 2 ] = normalize( coords[ 2 ] );
	coords[ 3 ] = normalize( coords[ 3 ] );
	vec3 vectorFormFactor = vec3( 0.0 );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 0 ], coords[ 1 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 1 ], coords[ 2 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 2 ], coords[ 3 ] );
	vectorFormFactor += LTC_EdgeVectorFormFactor( coords[ 3 ], coords[ 0 ] );
	float result = LTC_ClippedSphereFormFactor( vectorFormFactor );
	return vec3( result );
}
#if defined( USE_SHEEN )
float D_Charlie( float roughness, float dotNH ) {
	float alpha = pow2( roughness );
	float invAlpha = 1.0 / alpha;
	float cos2h = dotNH * dotNH;
	float sin2h = max( 1.0 - cos2h, 0.0078125 );
	return ( 2.0 + invAlpha ) * pow( sin2h, invAlpha * 0.5 ) / ( 2.0 * PI );
}
float V_Neubelt( float dotNV, float dotNL ) {
	return saturate( 1.0 / ( 4.0 * ( dotNL + dotNV - dotNL * dotNV ) ) );
}
vec3 BRDF_Sheen( const in vec3 lightDir, const in vec3 viewDir, const in vec3 normal, vec3 sheenColor, const in float sheenRoughness ) {
	vec3 halfDir = normalize( lightDir + viewDir );
	float dotNL = saturate( dot( normal, lightDir ) );
	float dotNV = saturate( dot( normal, viewDir ) );
	float dotNH = saturate( dot( normal, halfDir ) );
	float D = D_Charlie( sheenRoughness, dotNH );
	float V = V_Neubelt( dotNV, dotNL );
	return sheenColor * ( D * V );
}
#endif
float IBLSheenBRDF( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	float r2 = roughness * roughness;
	float a = roughness < 0.25 ? -339.2 * r2 + 161.4 * roughness - 25.9 : -8.48 * r2 + 14.3 * roughness - 9.95;
	float b = roughness < 0.25 ? 44.0 * r2 - 23.7 * roughness + 3.26 : 1.97 * r2 - 3.27 * roughness + 0.72;
	float DG = exp( a * dotNV + b ) + ( roughness < 0.25 ? 0.0 : 0.1 * ( roughness - 0.25 ) );
	return saturate( DG * RECIPROCAL_PI );
}
vec2 DFGApprox( const in vec3 normal, const in vec3 viewDir, const in float roughness ) {
	float dotNV = saturate( dot( normal, viewDir ) );
	const vec4 c0 = vec4( - 1, - 0.0275, - 0.572, 0.022 );
	const vec4 c1 = vec4( 1, 0.0425, 1.04, - 0.04 );
	vec4 r = roughness * c0 + c1;
	float a004 = min( r.x * r.x, exp2( - 9.28 * dotNV ) ) * r.x + r.y;
	vec2 fab = vec2( - 1.04, 1.04 ) * a004 + r.zw;
	return fab;
}
vec3 EnvironmentBRDF( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness ) {
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	return specularColor * fab.x + specularF90 * fab.y;
}
#ifdef USE_IRIDESCENCE
void computeMultiscatteringIridescence( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float iridescence, const in vec3 iridescenceF0, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#else
void computeMultiscattering( const in vec3 normal, const in vec3 viewDir, const in vec3 specularColor, const in float specularF90, const in float roughness, inout vec3 singleScatter, inout vec3 multiScatter ) {
#endif
	vec2 fab = DFGApprox( normal, viewDir, roughness );
	#ifdef USE_IRIDESCENCE
		vec3 Fr = mix( specularColor, iridescenceF0, iridescence );
	#else
		vec3 Fr = specularColor;
	#endif
	vec3 FssEss = Fr * fab.x + specularF90 * fab.y;
	float Ess = fab.x + fab.y;
	float Ems = 1.0 - Ess;
	vec3 Favg = Fr + ( 1.0 - Fr ) * 0.047619;	vec3 Fms = FssEss * Favg / ( 1.0 - Ems * Favg );
	singleScatter += FssEss;
	multiScatter += Fms * Ems;
}
#if NUM_RECT_AREA_LIGHTS > 0
	void RE_Direct_RectArea_Physical( const in RectAreaLight rectAreaLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
		vec3 normal = geometryNormal;
		vec3 viewDir = geometryViewDir;
		vec3 position = geometryPosition;
		vec3 lightPos = rectAreaLight.position;
		vec3 halfWidth = rectAreaLight.halfWidth;
		vec3 halfHeight = rectAreaLight.halfHeight;
		vec3 lightColor = rectAreaLight.color;
		float roughness = material.roughness;
		vec3 rectCoords[ 4 ];
		rectCoords[ 0 ] = lightPos + halfWidth - halfHeight;		rectCoords[ 1 ] = lightPos - halfWidth - halfHeight;
		rectCoords[ 2 ] = lightPos - halfWidth + halfHeight;
		rectCoords[ 3 ] = lightPos + halfWidth + halfHeight;
		vec2 uv = LTC_Uv( normal, viewDir, roughness );
		vec4 t1 = texture2D( ltc_1, uv );
		vec4 t2 = texture2D( ltc_2, uv );
		mat3 mInv = mat3(
			vec3( t1.x, 0, t1.y ),
			vec3(    0, 1,    0 ),
			vec3( t1.z, 0, t1.w )
		);
		vec3 fresnel = ( material.specularColor * t2.x + ( vec3( 1.0 ) - material.specularColor ) * t2.y );
		reflectedLight.directSpecular += lightColor * fresnel * LTC_Evaluate( normal, viewDir, position, mInv, rectCoords );
		reflectedLight.directDiffuse += lightColor * material.diffuseColor * LTC_Evaluate( normal, viewDir, position, mat3( 1.0 ), rectCoords );
	}
#endif
void RE_Direct_Physical( const in IncidentLight directLight, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	float dotNL = saturate( dot( geometryNormal, directLight.direction ) );
	vec3 irradiance = dotNL * directLight.color;
	#ifdef USE_CLEARCOAT
		float dotNLcc = saturate( dot( geometryClearcoatNormal, directLight.direction ) );
		vec3 ccIrradiance = dotNLcc * directLight.color;
		clearcoatSpecularDirect += ccIrradiance * BRDF_GGX_Clearcoat( directLight.direction, geometryViewDir, geometryClearcoatNormal, material );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularDirect += irradiance * BRDF_Sheen( directLight.direction, geometryViewDir, geometryNormal, material.sheenColor, material.sheenRoughness );
	#endif
	reflectedLight.directSpecular += irradiance * BRDF_GGX( directLight.direction, geometryViewDir, geometryNormal, material );
	reflectedLight.directDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectDiffuse_Physical( const in vec3 irradiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight ) {
	reflectedLight.indirectDiffuse += irradiance * BRDF_Lambert( material.diffuseColor );
}
void RE_IndirectSpecular_Physical( const in vec3 radiance, const in vec3 irradiance, const in vec3 clearcoatRadiance, const in vec3 geometryPosition, const in vec3 geometryNormal, const in vec3 geometryViewDir, const in vec3 geometryClearcoatNormal, const in PhysicalMaterial material, inout ReflectedLight reflectedLight) {
	#ifdef USE_CLEARCOAT
		clearcoatSpecularIndirect += clearcoatRadiance * EnvironmentBRDF( geometryClearcoatNormal, geometryViewDir, material.clearcoatF0, material.clearcoatF90, material.clearcoatRoughness );
	#endif
	#ifdef USE_SHEEN
		sheenSpecularIndirect += irradiance * material.sheenColor * IBLSheenBRDF( geometryNormal, geometryViewDir, material.sheenRoughness );
	#endif
	vec3 singleScattering = vec3( 0.0 );
	vec3 multiScattering = vec3( 0.0 );
	vec3 cosineWeightedIrradiance = irradiance * RECIPROCAL_PI;
	#ifdef USE_IRIDESCENCE
		computeMultiscatteringIridescence( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.iridescence, material.iridescenceFresnel, material.roughness, singleScattering, multiScattering );
	#else
		computeMultiscattering( geometryNormal, geometryViewDir, material.specularColor, material.specularF90, material.roughness, singleScattering, multiScattering );
	#endif
	vec3 totalScattering = singleScattering + multiScattering;
	vec3 diffuse = material.diffuseColor * ( 1.0 - max( max( totalScattering.r, totalScattering.g ), totalScattering.b ) );
	reflectedLight.indirectSpecular += radiance * singleScattering;
	reflectedLight.indirectSpecular += multiScattering * cosineWeightedIrradiance;
	reflectedLight.indirectDiffuse += diffuse * cosineWeightedIrradiance;
}
#define RE_Direct				RE_Direct_Physical
#define RE_Direct_RectArea		RE_Direct_RectArea_Physical
#define RE_IndirectDiffuse		RE_IndirectDiffuse_Physical
#define RE_IndirectSpecular		RE_IndirectSpecular_Physical
float computeSpecularOcclusion( const in float dotNV, const in float ambientOcclusion, const in float roughness ) {
	return saturate( pow( dotNV + ambientOcclusion, exp2( - 16.0 * roughness - 1.0 ) ) - 1.0 + ambientOcclusion );
}`,Z1A=`
vec3 geometryPosition = - vViewPosition;
vec3 geometryNormal = normal;
vec3 geometryViewDir = ( isOrthographic ) ? vec3( 0, 0, 1 ) : normalize( vViewPosition );
vec3 geometryClearcoatNormal = vec3( 0.0 );
#ifdef USE_CLEARCOAT
	geometryClearcoatNormal = clearcoatNormal;
#endif
#ifdef USE_IRIDESCENCE
	float dotNVi = saturate( dot( normal, geometryViewDir ) );
	if ( material.iridescenceThickness == 0.0 ) {
		material.iridescence = 0.0;
	} else {
		material.iridescence = saturate( material.iridescence );
	}
	if ( material.iridescence > 0.0 ) {
		material.iridescenceFresnel = evalIridescence( 1.0, material.iridescenceIOR, dotNVi, material.iridescenceThickness, material.specularColor );
		material.iridescenceF0 = Schlick_to_F0( material.iridescenceFresnel, 1.0, dotNVi );
	}
#endif
IncidentLight directLight;
#if ( NUM_POINT_LIGHTS > 0 ) && defined( RE_Direct )
	PointLight pointLight;
	#if defined( USE_SHADOWMAP ) && NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHTS; i ++ ) {
		pointLight = pointLights[ i ];
		getPointLightInfo( pointLight, geometryPosition, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_POINT_LIGHT_SHADOWS )
		pointLightShadow = pointLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getPointShadow( pointShadowMap[ i ], pointLightShadow.shadowMapSize, pointLightShadow.shadowIntensity, pointLightShadow.shadowBias, pointLightShadow.shadowRadius, vPointShadowCoord[ i ], pointLightShadow.shadowCameraNear, pointLightShadow.shadowCameraFar ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_SPOT_LIGHTS > 0 ) && defined( RE_Direct )
	SpotLight spotLight;
	vec4 spotColor;
	vec3 spotLightCoord;
	bool inSpotLightMap;
	#if defined( USE_SHADOWMAP ) && NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHTS; i ++ ) {
		spotLight = spotLights[ i ];
		getSpotLightInfo( spotLight, geometryPosition, directLight );
		#if ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#define SPOT_LIGHT_MAP_INDEX UNROLLED_LOOP_INDEX
		#elif ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		#define SPOT_LIGHT_MAP_INDEX NUM_SPOT_LIGHT_MAPS
		#else
		#define SPOT_LIGHT_MAP_INDEX ( UNROLLED_LOOP_INDEX - NUM_SPOT_LIGHT_SHADOWS + NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS )
		#endif
		#if ( SPOT_LIGHT_MAP_INDEX < NUM_SPOT_LIGHT_MAPS )
			spotLightCoord = vSpotLightCoord[ i ].xyz / vSpotLightCoord[ i ].w;
			inSpotLightMap = all( lessThan( abs( spotLightCoord * 2. - 1. ), vec3( 1.0 ) ) );
			spotColor = texture2D( spotLightMap[ SPOT_LIGHT_MAP_INDEX ], spotLightCoord.xy );
			directLight.color = inSpotLightMap ? directLight.color * spotColor.rgb : directLight.color;
		#endif
		#undef SPOT_LIGHT_MAP_INDEX
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
		spotLightShadow = spotLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( spotShadowMap[ i ], spotLightShadow.shadowMapSize, spotLightShadow.shadowIntensity, spotLightShadow.shadowBias, spotLightShadow.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_DIR_LIGHTS > 0 ) && defined( RE_Direct )
	DirectionalLight directionalLight;
	#if defined( USE_SHADOWMAP ) && NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLightShadow;
	#endif
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHTS; i ++ ) {
		directionalLight = directionalLights[ i ];
		getDirectionalLightInfo( directionalLight, directLight );
		#if defined( USE_SHADOWMAP ) && ( UNROLLED_LOOP_INDEX < NUM_DIR_LIGHT_SHADOWS )
		directionalLightShadow = directionalLightShadows[ i ];
		directLight.color *= ( directLight.visible && receiveShadow ) ? getShadow( directionalShadowMap[ i ], directionalLightShadow.shadowMapSize, directionalLightShadow.shadowIntensity, directionalLightShadow.shadowBias, directionalLightShadow.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
		#endif
		RE_Direct( directLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if ( NUM_RECT_AREA_LIGHTS > 0 ) && defined( RE_Direct_RectArea )
	RectAreaLight rectAreaLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_RECT_AREA_LIGHTS; i ++ ) {
		rectAreaLight = rectAreaLights[ i ];
		RE_Direct_RectArea( rectAreaLight, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
	}
	#pragma unroll_loop_end
#endif
#if defined( RE_IndirectDiffuse )
	vec3 iblIrradiance = vec3( 0.0 );
	vec3 irradiance = getAmbientLightIrradiance( ambientLightColor );
	#if defined( USE_LIGHT_PROBES )
		irradiance += getLightProbeIrradiance( lightProbe, geometryNormal );
	#endif
	#if ( NUM_HEMI_LIGHTS > 0 )
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_HEMI_LIGHTS; i ++ ) {
			irradiance += getHemisphereLightIrradiance( hemisphereLights[ i ], geometryNormal );
		}
		#pragma unroll_loop_end
	#endif
#endif
#if defined( RE_IndirectSpecular )
	vec3 radiance = vec3( 0.0 );
	vec3 clearcoatRadiance = vec3( 0.0 );
#endif`,W1A=`#if defined( RE_IndirectDiffuse )
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		vec3 lightMapIrradiance = lightMapTexel.rgb * lightMapIntensity;
		irradiance += lightMapIrradiance;
	#endif
	#if defined( USE_ENVMAP ) && defined( STANDARD ) && defined( ENVMAP_TYPE_CUBE_UV )
		iblIrradiance += getIBLIrradiance( geometryNormal );
	#endif
#endif
#if defined( USE_ENVMAP ) && defined( RE_IndirectSpecular )
	#ifdef USE_ANISOTROPY
		radiance += getIBLAnisotropyRadiance( geometryViewDir, geometryNormal, material.roughness, material.anisotropyB, material.anisotropy );
	#else
		radiance += getIBLRadiance( geometryViewDir, geometryNormal, material.roughness );
	#endif
	#ifdef USE_CLEARCOAT
		clearcoatRadiance += getIBLRadiance( geometryViewDir, geometryClearcoatNormal, material.clearcoatRoughness );
	#endif
#endif`,z1A=`#if defined( RE_IndirectDiffuse )
	RE_IndirectDiffuse( irradiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif
#if defined( RE_IndirectSpecular )
	RE_IndirectSpecular( radiance, iblIrradiance, clearcoatRadiance, geometryPosition, geometryNormal, geometryViewDir, geometryClearcoatNormal, material, reflectedLight );
#endif`,V1A=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	gl_FragDepth = vIsPerspective == 0.0 ? gl_FragCoord.z : log2( vFragDepth ) * logDepthBufFC * 0.5;
#endif`,X1A=`#if defined( USE_LOGARITHMIC_DEPTH_BUFFER )
	uniform float logDepthBufFC;
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,$1A=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	varying float vFragDepth;
	varying float vIsPerspective;
#endif`,A3A=`#ifdef USE_LOGARITHMIC_DEPTH_BUFFER
	vFragDepth = 1.0 + gl_Position.w;
	vIsPerspective = float( isPerspectiveMatrix( projectionMatrix ) );
#endif`,e3A=`#ifdef USE_MAP
	vec4 sampledDiffuseColor = texture2D( map, vMapUv );
	#ifdef DECODE_VIDEO_TEXTURE
		sampledDiffuseColor = sRGBTransferEOTF( sampledDiffuseColor );
	#endif
	diffuseColor *= sampledDiffuseColor;
#endif`,t3A=`#ifdef USE_MAP
	uniform sampler2D map;
#endif`,i3A=`#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
	#if defined( USE_POINTS_UV )
		vec2 uv = vUv;
	#else
		vec2 uv = ( uvTransform * vec3( gl_PointCoord.x, 1.0 - gl_PointCoord.y, 1 ) ).xy;
	#endif
#endif
#ifdef USE_MAP
	diffuseColor *= texture2D( map, uv );
#endif
#ifdef USE_ALPHAMAP
	diffuseColor.a *= texture2D( alphaMap, uv ).g;
#endif`,g3A=`#if defined( USE_POINTS_UV )
	varying vec2 vUv;
#else
	#if defined( USE_MAP ) || defined( USE_ALPHAMAP )
		uniform mat3 uvTransform;
	#endif
#endif
#ifdef USE_MAP
	uniform sampler2D map;
#endif
#ifdef USE_ALPHAMAP
	uniform sampler2D alphaMap;
#endif`,I3A=`float metalnessFactor = metalness;
#ifdef USE_METALNESSMAP
	vec4 texelMetalness = texture2D( metalnessMap, vMetalnessMapUv );
	metalnessFactor *= texelMetalness.b;
#endif`,n3A=`#ifdef USE_METALNESSMAP
	uniform sampler2D metalnessMap;
#endif`,o3A=`#ifdef USE_INSTANCING_MORPH
	float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	float morphTargetBaseInfluence = texelFetch( morphTexture, ivec2( 0, gl_InstanceID ), 0 ).r;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		morphTargetInfluences[i] =  texelFetch( morphTexture, ivec2( i + 1, gl_InstanceID ), 0 ).r;
	}
#endif`,a3A=`#if defined( USE_MORPHCOLORS )
	vColor *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		#if defined( USE_COLOR_ALPHA )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ) * morphTargetInfluences[ i ];
		#elif defined( USE_COLOR )
			if ( morphTargetInfluences[ i ] != 0.0 ) vColor += getMorph( gl_VertexID, i, 2 ).rgb * morphTargetInfluences[ i ];
		#endif
	}
#endif`,r3A=`#ifdef USE_MORPHNORMALS
	objectNormal *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) objectNormal += getMorph( gl_VertexID, i, 1 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,s3A=`#ifdef USE_MORPHTARGETS
	#ifndef USE_INSTANCING_MORPH
		uniform float morphTargetBaseInfluence;
		uniform float morphTargetInfluences[ MORPHTARGETS_COUNT ];
	#endif
	uniform sampler2DArray morphTargetsTexture;
	uniform ivec2 morphTargetsTextureSize;
	vec4 getMorph( const in int vertexIndex, const in int morphTargetIndex, const in int offset ) {
		int texelIndex = vertexIndex * MORPHTARGETS_TEXTURE_STRIDE + offset;
		int y = texelIndex / morphTargetsTextureSize.x;
		int x = texelIndex - y * morphTargetsTextureSize.x;
		ivec3 morphUV = ivec3( x, y, morphTargetIndex );
		return texelFetch( morphTargetsTexture, morphUV, 0 );
	}
#endif`,C3A=`#ifdef USE_MORPHTARGETS
	transformed *= morphTargetBaseInfluence;
	for ( int i = 0; i < MORPHTARGETS_COUNT; i ++ ) {
		if ( morphTargetInfluences[ i ] != 0.0 ) transformed += getMorph( gl_VertexID, i, 0 ).xyz * morphTargetInfluences[ i ];
	}
#endif`,B3A=`float faceDirection = gl_FrontFacing ? 1.0 : - 1.0;
#ifdef FLAT_SHADED
	vec3 fdx = dFdx( vViewPosition );
	vec3 fdy = dFdy( vViewPosition );
	vec3 normal = normalize( cross( fdx, fdy ) );
#else
	vec3 normal = normalize( vNormal );
	#ifdef DOUBLE_SIDED
		normal *= faceDirection;
	#endif
#endif
#if defined( USE_NORMALMAP_TANGENTSPACE ) || defined( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY )
	#ifdef USE_TANGENT
		mat3 tbn = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn = getTangentFrame( - vViewPosition, normal,
		#if defined( USE_NORMALMAP )
			vNormalMapUv
		#elif defined( USE_CLEARCOAT_NORMALMAP )
			vClearcoatNormalMapUv
		#else
			vUv
		#endif
		);
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn[0] *= faceDirection;
		tbn[1] *= faceDirection;
	#endif
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	#ifdef USE_TANGENT
		mat3 tbn2 = mat3( normalize( vTangent ), normalize( vBitangent ), normal );
	#else
		mat3 tbn2 = getTangentFrame( - vViewPosition, normal, vClearcoatNormalMapUv );
	#endif
	#if defined( DOUBLE_SIDED ) && ! defined( FLAT_SHADED )
		tbn2[0] *= faceDirection;
		tbn2[1] *= faceDirection;
	#endif
#endif
vec3 nonPerturbedNormal = normal;`,c3A=`#ifdef USE_NORMALMAP_OBJECTSPACE
	normal = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	#ifdef FLIP_SIDED
		normal = - normal;
	#endif
	#ifdef DOUBLE_SIDED
		normal = normal * faceDirection;
	#endif
	normal = normalize( normalMatrix * normal );
#elif defined( USE_NORMALMAP_TANGENTSPACE )
	vec3 mapN = texture2D( normalMap, vNormalMapUv ).xyz * 2.0 - 1.0;
	mapN.xy *= normalScale;
	normal = normalize( tbn * mapN );
#elif defined( USE_BUMPMAP )
	normal = perturbNormalArb( - vViewPosition, normal, dHdxy_fwd(), faceDirection );
#endif`,l3A=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,Q3A=`#ifndef FLAT_SHADED
	varying vec3 vNormal;
	#ifdef USE_TANGENT
		varying vec3 vTangent;
		varying vec3 vBitangent;
	#endif
#endif`,E3A=`#ifndef FLAT_SHADED
	vNormal = normalize( transformedNormal );
	#ifdef USE_TANGENT
		vTangent = normalize( transformedTangent );
		vBitangent = normalize( cross( vNormal, vTangent ) * tangent.w );
	#endif
#endif`,u3A=`#ifdef USE_NORMALMAP
	uniform sampler2D normalMap;
	uniform vec2 normalScale;
#endif
#ifdef USE_NORMALMAP_OBJECTSPACE
	uniform mat3 normalMatrix;
#endif
#if ! defined ( USE_TANGENT ) && ( defined ( USE_NORMALMAP_TANGENTSPACE ) || defined ( USE_CLEARCOAT_NORMALMAP ) || defined( USE_ANISOTROPY ) )
	mat3 getTangentFrame( vec3 eye_pos, vec3 surf_norm, vec2 uv ) {
		vec3 q0 = dFdx( eye_pos.xyz );
		vec3 q1 = dFdy( eye_pos.xyz );
		vec2 st0 = dFdx( uv.st );
		vec2 st1 = dFdy( uv.st );
		vec3 N = surf_norm;
		vec3 q1perp = cross( q1, N );
		vec3 q0perp = cross( N, q0 );
		vec3 T = q1perp * st0.x + q0perp * st1.x;
		vec3 B = q1perp * st0.y + q0perp * st1.y;
		float det = max( dot( T, T ), dot( B, B ) );
		float scale = ( det == 0.0 ) ? 0.0 : inversesqrt( det );
		return mat3( T * scale, B * scale, N );
	}
#endif`,h3A=`#ifdef USE_CLEARCOAT
	vec3 clearcoatNormal = nonPerturbedNormal;
#endif`,d3A=`#ifdef USE_CLEARCOAT_NORMALMAP
	vec3 clearcoatMapN = texture2D( clearcoatNormalMap, vClearcoatNormalMapUv ).xyz * 2.0 - 1.0;
	clearcoatMapN.xy *= clearcoatNormalScale;
	clearcoatNormal = normalize( tbn2 * clearcoatMapN );
#endif`,p3A=`#ifdef USE_CLEARCOATMAP
	uniform sampler2D clearcoatMap;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform sampler2D clearcoatNormalMap;
	uniform vec2 clearcoatNormalScale;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform sampler2D clearcoatRoughnessMap;
#endif`,f3A=`#ifdef USE_IRIDESCENCEMAP
	uniform sampler2D iridescenceMap;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform sampler2D iridescenceThicknessMap;
#endif`,D3A=`#ifdef OPAQUE
diffuseColor.a = 1.0;
#endif
#ifdef USE_TRANSMISSION
diffuseColor.a *= material.transmissionAlpha;
#endif
gl_FragColor = vec4( outgoingLight, diffuseColor.a );`,y3A=`vec3 packNormalToRGB( const in vec3 normal ) {
	return normalize( normal ) * 0.5 + 0.5;
}
vec3 unpackRGBToNormal( const in vec3 rgb ) {
	return 2.0 * rgb.xyz - 1.0;
}
const float PackUpscale = 256. / 255.;const float UnpackDownscale = 255. / 256.;const float ShiftRight8 = 1. / 256.;
const float Inv255 = 1. / 255.;
const vec4 PackFactors = vec4( 1.0, 256.0, 256.0 * 256.0, 256.0 * 256.0 * 256.0 );
const vec2 UnpackFactors2 = vec2( UnpackDownscale, 1.0 / PackFactors.g );
const vec3 UnpackFactors3 = vec3( UnpackDownscale / PackFactors.rg, 1.0 / PackFactors.b );
const vec4 UnpackFactors4 = vec4( UnpackDownscale / PackFactors.rgb, 1.0 / PackFactors.a );
vec4 packDepthToRGBA( const in float v ) {
	if( v <= 0.0 )
		return vec4( 0., 0., 0., 0. );
	if( v >= 1.0 )
		return vec4( 1., 1., 1., 1. );
	float vuf;
	float af = modf( v * PackFactors.a, vuf );
	float bf = modf( vuf * ShiftRight8, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec4( vuf * Inv255, gf * PackUpscale, bf * PackUpscale, af );
}
vec3 packDepthToRGB( const in float v ) {
	if( v <= 0.0 )
		return vec3( 0., 0., 0. );
	if( v >= 1.0 )
		return vec3( 1., 1., 1. );
	float vuf;
	float bf = modf( v * PackFactors.b, vuf );
	float gf = modf( vuf * ShiftRight8, vuf );
	return vec3( vuf * Inv255, gf * PackUpscale, bf );
}
vec2 packDepthToRG( const in float v ) {
	if( v <= 0.0 )
		return vec2( 0., 0. );
	if( v >= 1.0 )
		return vec2( 1., 1. );
	float vuf;
	float gf = modf( v * 256., vuf );
	return vec2( vuf * Inv255, gf );
}
float unpackRGBAToDepth( const in vec4 v ) {
	return dot( v, UnpackFactors4 );
}
float unpackRGBToDepth( const in vec3 v ) {
	return dot( v, UnpackFactors3 );
}
float unpackRGToDepth( const in vec2 v ) {
	return v.r * UnpackFactors2.r + v.g * UnpackFactors2.g;
}
vec4 pack2HalfToRGBA( const in vec2 v ) {
	vec4 r = vec4( v.x, fract( v.x * 255.0 ), v.y, fract( v.y * 255.0 ) );
	return vec4( r.x - r.y / 255.0, r.y, r.z - r.w / 255.0, r.w );
}
vec2 unpackRGBATo2Half( const in vec4 v ) {
	return vec2( v.x + ( v.y / 255.0 ), v.z + ( v.w / 255.0 ) );
}
float viewZToOrthographicDepth( const in float viewZ, const in float near, const in float far ) {
	return ( viewZ + near ) / ( near - far );
}
float orthographicDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return depth * ( near - far ) - near;
}
float viewZToPerspectiveDepth( const in float viewZ, const in float near, const in float far ) {
	return ( ( near + viewZ ) * far ) / ( ( far - near ) * viewZ );
}
float perspectiveDepthToViewZ( const in float depth, const in float near, const in float far ) {
	return ( near * far ) / ( ( far - near ) * depth - far );
}`,S3A=`#ifdef PREMULTIPLIED_ALPHA
	gl_FragColor.rgb *= gl_FragColor.a;
#endif`,w3A=`vec4 mvPosition = vec4( transformed, 1.0 );
#ifdef USE_BATCHING
	mvPosition = batchingMatrix * mvPosition;
#endif
#ifdef USE_INSTANCING
	mvPosition = instanceMatrix * mvPosition;
#endif
mvPosition = modelViewMatrix * mvPosition;
gl_Position = projectionMatrix * mvPosition;`,m3A=`#ifdef DITHERING
	gl_FragColor.rgb = dithering( gl_FragColor.rgb );
#endif`,k3A=`#ifdef DITHERING
	vec3 dithering( vec3 color ) {
		float grid_position = rand( gl_FragCoord.xy );
		vec3 dither_shift_RGB = vec3( 0.25 / 255.0, -0.25 / 255.0, 0.25 / 255.0 );
		dither_shift_RGB = mix( 2.0 * dither_shift_RGB, -2.0 * dither_shift_RGB, grid_position );
		return color + dither_shift_RGB;
	}
#endif`,M3A=`float roughnessFactor = roughness;
#ifdef USE_ROUGHNESSMAP
	vec4 texelRoughness = texture2D( roughnessMap, vRoughnessMapUv );
	roughnessFactor *= texelRoughness.g;
#endif`,N3A=`#ifdef USE_ROUGHNESSMAP
	uniform sampler2D roughnessMap;
#endif`,G3A=`#if NUM_SPOT_LIGHT_COORDS > 0
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#if NUM_SPOT_LIGHT_MAPS > 0
	uniform sampler2D spotLightMap[ NUM_SPOT_LIGHT_MAPS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform sampler2D directionalShadowMap[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		uniform sampler2D spotShadowMap[ NUM_SPOT_LIGHT_SHADOWS ];
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform sampler2D pointShadowMap[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
	float texture2DCompare( sampler2D depths, vec2 uv, float compare ) {
		float depth = unpackRGBAToDepth( texture2D( depths, uv ) );
		#ifdef USE_REVERSED_DEPTH_BUFFER
			return step( depth, compare );
		#else
			return step( compare, depth );
		#endif
	}
	vec2 texture2DDistribution( sampler2D shadow, vec2 uv ) {
		return unpackRGBATo2Half( texture2D( shadow, uv ) );
	}
	float VSMShadow( sampler2D shadow, vec2 uv, float compare ) {
		float occlusion = 1.0;
		vec2 distribution = texture2DDistribution( shadow, uv );
		#ifdef USE_REVERSED_DEPTH_BUFFER
			float hard_shadow = step( distribution.x, compare );
		#else
			float hard_shadow = step( compare, distribution.x );
		#endif
		if ( hard_shadow != 1.0 ) {
			float distance = compare - distribution.x;
			float variance = max( 0.00000, distribution.y * distribution.y );
			float softness_probability = variance / (variance + distance * distance );			softness_probability = clamp( ( softness_probability - 0.3 ) / ( 0.95 - 0.3 ), 0.0, 1.0 );			occlusion = clamp( max( hard_shadow, softness_probability ), 0.0, 1.0 );
		}
		return occlusion;
	}
	float getShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord ) {
		float shadow = 1.0;
		shadowCoord.xyz /= shadowCoord.w;
		shadowCoord.z += shadowBias;
		bool inFrustum = shadowCoord.x >= 0.0 && shadowCoord.x <= 1.0 && shadowCoord.y >= 0.0 && shadowCoord.y <= 1.0;
		bool frustumTest = inFrustum && shadowCoord.z <= 1.0;
		if ( frustumTest ) {
		#if defined( SHADOWMAP_TYPE_PCF )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx0 = - texelSize.x * shadowRadius;
			float dy0 = - texelSize.y * shadowRadius;
			float dx1 = + texelSize.x * shadowRadius;
			float dy1 = + texelSize.y * shadowRadius;
			float dx2 = dx0 / 2.0;
			float dy2 = dy0 / 2.0;
			float dx3 = dx1 / 2.0;
			float dy3 = dy1 / 2.0;
			shadow = (
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy2 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx2, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx3, dy3 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( 0.0, dy1 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, shadowCoord.xy + vec2( dx1, dy1 ), shadowCoord.z )
			) * ( 1.0 / 17.0 );
		#elif defined( SHADOWMAP_TYPE_PCF_SOFT )
			vec2 texelSize = vec2( 1.0 ) / shadowMapSize;
			float dx = texelSize.x;
			float dy = texelSize.y;
			vec2 uv = shadowCoord.xy;
			vec2 f = fract( uv * shadowMapSize + 0.5 );
			uv -= f * texelSize;
			shadow = (
				texture2DCompare( shadowMap, uv, shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( dx, 0.0 ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + vec2( 0.0, dy ), shadowCoord.z ) +
				texture2DCompare( shadowMap, uv + texelSize, shadowCoord.z ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, 0.0 ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 0.0 ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( -dx, dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, dy ), shadowCoord.z ),
					 f.x ) +
				mix( texture2DCompare( shadowMap, uv + vec2( 0.0, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( 0.0, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( texture2DCompare( shadowMap, uv + vec2( dx, -dy ), shadowCoord.z ),
					 texture2DCompare( shadowMap, uv + vec2( dx, 2.0 * dy ), shadowCoord.z ),
					 f.y ) +
				mix( mix( texture2DCompare( shadowMap, uv + vec2( -dx, -dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, -dy ), shadowCoord.z ),
						  f.x ),
					 mix( texture2DCompare( shadowMap, uv + vec2( -dx, 2.0 * dy ), shadowCoord.z ),
						  texture2DCompare( shadowMap, uv + vec2( 2.0 * dx, 2.0 * dy ), shadowCoord.z ),
						  f.x ),
					 f.y )
			) * ( 1.0 / 9.0 );
		#elif defined( SHADOWMAP_TYPE_VSM )
			shadow = VSMShadow( shadowMap, shadowCoord.xy, shadowCoord.z );
		#else
			shadow = texture2DCompare( shadowMap, shadowCoord.xy, shadowCoord.z );
		#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
	vec2 cubeToUV( vec3 v, float texelSizeY ) {
		vec3 absV = abs( v );
		float scaleToCube = 1.0 / max( absV.x, max( absV.y, absV.z ) );
		absV *= scaleToCube;
		v *= scaleToCube * ( 1.0 - 2.0 * texelSizeY );
		vec2 planar = v.xy;
		float almostATexel = 1.5 * texelSizeY;
		float almostOne = 1.0 - almostATexel;
		if ( absV.z >= almostOne ) {
			if ( v.z > 0.0 )
				planar.x = 4.0 - v.x;
		} else if ( absV.x >= almostOne ) {
			float signX = sign( v.x );
			planar.x = v.z * signX + 2.0 * signX;
		} else if ( absV.y >= almostOne ) {
			float signY = sign( v.y );
			planar.x = v.x + 2.0 * signY + 2.0;
			planar.y = v.z * signY - 2.0;
		}
		return vec2( 0.125, 0.25 ) * planar + vec2( 0.375, 0.75 );
	}
	float getPointShadow( sampler2D shadowMap, vec2 shadowMapSize, float shadowIntensity, float shadowBias, float shadowRadius, vec4 shadowCoord, float shadowCameraNear, float shadowCameraFar ) {
		float shadow = 1.0;
		vec3 lightToPosition = shadowCoord.xyz;
		
		float lightToPositionLength = length( lightToPosition );
		if ( lightToPositionLength - shadowCameraFar <= 0.0 && lightToPositionLength - shadowCameraNear >= 0.0 ) {
			float dp = ( lightToPositionLength - shadowCameraNear ) / ( shadowCameraFar - shadowCameraNear );			dp += shadowBias;
			vec3 bd3D = normalize( lightToPosition );
			vec2 texelSize = vec2( 1.0 ) / ( shadowMapSize * vec2( 4.0, 2.0 ) );
			#if defined( SHADOWMAP_TYPE_PCF ) || defined( SHADOWMAP_TYPE_PCF_SOFT ) || defined( SHADOWMAP_TYPE_VSM )
				vec2 offset = vec2( - 1, 1 ) * shadowRadius * texelSize.y;
				shadow = (
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yyx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxy, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.xxx, texelSize.y ), dp ) +
					texture2DCompare( shadowMap, cubeToUV( bd3D + offset.yxx, texelSize.y ), dp )
				) * ( 1.0 / 9.0 );
			#else
				shadow = texture2DCompare( shadowMap, cubeToUV( bd3D, texelSize.y ), dp );
			#endif
		}
		return mix( 1.0, shadow, shadowIntensity );
	}
#endif`,R3A=`#if NUM_SPOT_LIGHT_COORDS > 0
	uniform mat4 spotLightMatrix[ NUM_SPOT_LIGHT_COORDS ];
	varying vec4 vSpotLightCoord[ NUM_SPOT_LIGHT_COORDS ];
#endif
#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
		uniform mat4 directionalShadowMatrix[ NUM_DIR_LIGHT_SHADOWS ];
		varying vec4 vDirectionalShadowCoord[ NUM_DIR_LIGHT_SHADOWS ];
		struct DirectionalLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform DirectionalLightShadow directionalLightShadows[ NUM_DIR_LIGHT_SHADOWS ];
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
		struct SpotLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
		};
		uniform SpotLightShadow spotLightShadows[ NUM_SPOT_LIGHT_SHADOWS ];
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		uniform mat4 pointShadowMatrix[ NUM_POINT_LIGHT_SHADOWS ];
		varying vec4 vPointShadowCoord[ NUM_POINT_LIGHT_SHADOWS ];
		struct PointLightShadow {
			float shadowIntensity;
			float shadowBias;
			float shadowNormalBias;
			float shadowRadius;
			vec2 shadowMapSize;
			float shadowCameraNear;
			float shadowCameraFar;
		};
		uniform PointLightShadow pointLightShadows[ NUM_POINT_LIGHT_SHADOWS ];
	#endif
#endif`,U3A=`#if ( defined( USE_SHADOWMAP ) && ( NUM_DIR_LIGHT_SHADOWS > 0 || NUM_POINT_LIGHT_SHADOWS > 0 ) ) || ( NUM_SPOT_LIGHT_COORDS > 0 )
	vec3 shadowWorldNormal = inverseTransformDirection( transformedNormal, viewMatrix );
	vec4 shadowWorldPosition;
#endif
#if defined( USE_SHADOWMAP )
	#if NUM_DIR_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * directionalLightShadows[ i ].shadowNormalBias, 0 );
			vDirectionalShadowCoord[ i ] = directionalShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
		#pragma unroll_loop_start
		for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
			shadowWorldPosition = worldPosition + vec4( shadowWorldNormal * pointLightShadows[ i ].shadowNormalBias, 0 );
			vPointShadowCoord[ i ] = pointShadowMatrix[ i ] * shadowWorldPosition;
		}
		#pragma unroll_loop_end
	#endif
#endif
#if NUM_SPOT_LIGHT_COORDS > 0
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_COORDS; i ++ ) {
		shadowWorldPosition = worldPosition;
		#if ( defined( USE_SHADOWMAP ) && UNROLLED_LOOP_INDEX < NUM_SPOT_LIGHT_SHADOWS )
			shadowWorldPosition.xyz += shadowWorldNormal * spotLightShadows[ i ].shadowNormalBias;
		#endif
		vSpotLightCoord[ i ] = spotLightMatrix[ i ] * shadowWorldPosition;
	}
	#pragma unroll_loop_end
#endif`,K3A=`float getShadowMask() {
	float shadow = 1.0;
	#ifdef USE_SHADOWMAP
	#if NUM_DIR_LIGHT_SHADOWS > 0
	DirectionalLightShadow directionalLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_DIR_LIGHT_SHADOWS; i ++ ) {
		directionalLight = directionalLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( directionalShadowMap[ i ], directionalLight.shadowMapSize, directionalLight.shadowIntensity, directionalLight.shadowBias, directionalLight.shadowRadius, vDirectionalShadowCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_SPOT_LIGHT_SHADOWS > 0
	SpotLightShadow spotLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_SPOT_LIGHT_SHADOWS; i ++ ) {
		spotLight = spotLightShadows[ i ];
		shadow *= receiveShadow ? getShadow( spotShadowMap[ i ], spotLight.shadowMapSize, spotLight.shadowIntensity, spotLight.shadowBias, spotLight.shadowRadius, vSpotLightCoord[ i ] ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#if NUM_POINT_LIGHT_SHADOWS > 0
	PointLightShadow pointLight;
	#pragma unroll_loop_start
	for ( int i = 0; i < NUM_POINT_LIGHT_SHADOWS; i ++ ) {
		pointLight = pointLightShadows[ i ];
		shadow *= receiveShadow ? getPointShadow( pointShadowMap[ i ], pointLight.shadowMapSize, pointLight.shadowIntensity, pointLight.shadowBias, pointLight.shadowRadius, vPointShadowCoord[ i ], pointLight.shadowCameraNear, pointLight.shadowCameraFar ) : 1.0;
	}
	#pragma unroll_loop_end
	#endif
	#endif
	return shadow;
}`,F3A=`#ifdef USE_SKINNING
	mat4 boneMatX = getBoneMatrix( skinIndex.x );
	mat4 boneMatY = getBoneMatrix( skinIndex.y );
	mat4 boneMatZ = getBoneMatrix( skinIndex.z );
	mat4 boneMatW = getBoneMatrix( skinIndex.w );
#endif`,b3A=`#ifdef USE_SKINNING
	uniform mat4 bindMatrix;
	uniform mat4 bindMatrixInverse;
	uniform highp sampler2D boneTexture;
	mat4 getBoneMatrix( const in float i ) {
		int size = textureSize( boneTexture, 0 ).x;
		int j = int( i ) * 4;
		int x = j % size;
		int y = j / size;
		vec4 v1 = texelFetch( boneTexture, ivec2( x, y ), 0 );
		vec4 v2 = texelFetch( boneTexture, ivec2( x + 1, y ), 0 );
		vec4 v3 = texelFetch( boneTexture, ivec2( x + 2, y ), 0 );
		vec4 v4 = texelFetch( boneTexture, ivec2( x + 3, y ), 0 );
		return mat4( v1, v2, v3, v4 );
	}
#endif`,v3A=`#ifdef USE_SKINNING
	vec4 skinVertex = bindMatrix * vec4( transformed, 1.0 );
	vec4 skinned = vec4( 0.0 );
	skinned += boneMatX * skinVertex * skinWeight.x;
	skinned += boneMatY * skinVertex * skinWeight.y;
	skinned += boneMatZ * skinVertex * skinWeight.z;
	skinned += boneMatW * skinVertex * skinWeight.w;
	transformed = ( bindMatrixInverse * skinned ).xyz;
#endif`,_3A=`#ifdef USE_SKINNING
	mat4 skinMatrix = mat4( 0.0 );
	skinMatrix += skinWeight.x * boneMatX;
	skinMatrix += skinWeight.y * boneMatY;
	skinMatrix += skinWeight.z * boneMatZ;
	skinMatrix += skinWeight.w * boneMatW;
	skinMatrix = bindMatrixInverse * skinMatrix * bindMatrix;
	objectNormal = vec4( skinMatrix * vec4( objectNormal, 0.0 ) ).xyz;
	#ifdef USE_TANGENT
		objectTangent = vec4( skinMatrix * vec4( objectTangent, 0.0 ) ).xyz;
	#endif
#endif`,J3A=`float specularStrength;
#ifdef USE_SPECULARMAP
	vec4 texelSpecular = texture2D( specularMap, vSpecularMapUv );
	specularStrength = texelSpecular.r;
#else
	specularStrength = 1.0;
#endif`,L3A=`#ifdef USE_SPECULARMAP
	uniform sampler2D specularMap;
#endif`,q3A=`#if defined( TONE_MAPPING )
	gl_FragColor.rgb = toneMapping( gl_FragColor.rgb );
#endif`,x3A=`#ifndef saturate
#define saturate( a ) clamp( a, 0.0, 1.0 )
#endif
uniform float toneMappingExposure;
vec3 LinearToneMapping( vec3 color ) {
	return saturate( toneMappingExposure * color );
}
vec3 ReinhardToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	return saturate( color / ( vec3( 1.0 ) + color ) );
}
vec3 CineonToneMapping( vec3 color ) {
	color *= toneMappingExposure;
	color = max( vec3( 0.0 ), color - 0.004 );
	return pow( ( color * ( 6.2 * color + 0.5 ) ) / ( color * ( 6.2 * color + 1.7 ) + 0.06 ), vec3( 2.2 ) );
}
vec3 RRTAndODTFit( vec3 v ) {
	vec3 a = v * ( v + 0.0245786 ) - 0.000090537;
	vec3 b = v * ( 0.983729 * v + 0.4329510 ) + 0.238081;
	return a / b;
}
vec3 ACESFilmicToneMapping( vec3 color ) {
	const mat3 ACESInputMat = mat3(
		vec3( 0.59719, 0.07600, 0.02840 ),		vec3( 0.35458, 0.90834, 0.13383 ),
		vec3( 0.04823, 0.01566, 0.83777 )
	);
	const mat3 ACESOutputMat = mat3(
		vec3(  1.60475, -0.10208, -0.00327 ),		vec3( -0.53108,  1.10813, -0.07276 ),
		vec3( -0.07367, -0.00605,  1.07602 )
	);
	color *= toneMappingExposure / 0.6;
	color = ACESInputMat * color;
	color = RRTAndODTFit( color );
	color = ACESOutputMat * color;
	return saturate( color );
}
const mat3 LINEAR_REC2020_TO_LINEAR_SRGB = mat3(
	vec3( 1.6605, - 0.1246, - 0.0182 ),
	vec3( - 0.5876, 1.1329, - 0.1006 ),
	vec3( - 0.0728, - 0.0083, 1.1187 )
);
const mat3 LINEAR_SRGB_TO_LINEAR_REC2020 = mat3(
	vec3( 0.6274, 0.0691, 0.0164 ),
	vec3( 0.3293, 0.9195, 0.0880 ),
	vec3( 0.0433, 0.0113, 0.8956 )
);
vec3 agxDefaultContrastApprox( vec3 x ) {
	vec3 x2 = x * x;
	vec3 x4 = x2 * x2;
	return + 15.5 * x4 * x2
		- 40.14 * x4 * x
		+ 31.96 * x4
		- 6.868 * x2 * x
		+ 0.4298 * x2
		+ 0.1191 * x
		- 0.00232;
}
vec3 AgXToneMapping( vec3 color ) {
	const mat3 AgXInsetMatrix = mat3(
		vec3( 0.856627153315983, 0.137318972929847, 0.11189821299995 ),
		vec3( 0.0951212405381588, 0.761241990602591, 0.0767994186031903 ),
		vec3( 0.0482516061458583, 0.101439036467562, 0.811302368396859 )
	);
	const mat3 AgXOutsetMatrix = mat3(
		vec3( 1.1271005818144368, - 0.1413297634984383, - 0.14132976349843826 ),
		vec3( - 0.11060664309660323, 1.157823702216272, - 0.11060664309660294 ),
		vec3( - 0.016493938717834573, - 0.016493938717834257, 1.2519364065950405 )
	);
	const float AgxMinEv = - 12.47393;	const float AgxMaxEv = 4.026069;
	color *= toneMappingExposure;
	color = LINEAR_SRGB_TO_LINEAR_REC2020 * color;
	color = AgXInsetMatrix * color;
	color = max( color, 1e-10 );	color = log2( color );
	color = ( color - AgxMinEv ) / ( AgxMaxEv - AgxMinEv );
	color = clamp( color, 0.0, 1.0 );
	color = agxDefaultContrastApprox( color );
	color = AgXOutsetMatrix * color;
	color = pow( max( vec3( 0.0 ), color ), vec3( 2.2 ) );
	color = LINEAR_REC2020_TO_LINEAR_SRGB * color;
	color = clamp( color, 0.0, 1.0 );
	return color;
}
vec3 NeutralToneMapping( vec3 color ) {
	const float StartCompression = 0.8 - 0.04;
	const float Desaturation = 0.15;
	color *= toneMappingExposure;
	float x = min( color.r, min( color.g, color.b ) );
	float offset = x < 0.08 ? x - 6.25 * x * x : 0.04;
	color -= offset;
	float peak = max( color.r, max( color.g, color.b ) );
	if ( peak < StartCompression ) return color;
	float d = 1. - StartCompression;
	float newPeak = 1. - d * d / ( peak + d - StartCompression );
	color *= newPeak / peak;
	float g = 1. - 1. / ( Desaturation * ( peak - newPeak ) + 1. );
	return mix( color, vec3( newPeak ), g );
}
vec3 CustomToneMapping( vec3 color ) { return color; }`,T3A=`#ifdef USE_TRANSMISSION
	material.transmission = transmission;
	material.transmissionAlpha = 1.0;
	material.thickness = thickness;
	material.attenuationDistance = attenuationDistance;
	material.attenuationColor = attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		material.transmission *= texture2D( transmissionMap, vTransmissionMapUv ).r;
	#endif
	#ifdef USE_THICKNESSMAP
		material.thickness *= texture2D( thicknessMap, vThicknessMapUv ).g;
	#endif
	vec3 pos = vWorldPosition;
	vec3 v = normalize( cameraPosition - pos );
	vec3 n = inverseTransformDirection( normal, viewMatrix );
	vec4 transmitted = getIBLVolumeRefraction(
		n, v, material.roughness, material.diffuseColor, material.specularColor, material.specularF90,
		pos, modelMatrix, viewMatrix, projectionMatrix, material.dispersion, material.ior, material.thickness,
		material.attenuationColor, material.attenuationDistance );
	material.transmissionAlpha = mix( material.transmissionAlpha, transmitted.a, material.transmission );
	totalDiffuse = mix( totalDiffuse, transmitted.rgb, material.transmission );
#endif`,Y3A=`#ifdef USE_TRANSMISSION
	uniform float transmission;
	uniform float thickness;
	uniform float attenuationDistance;
	uniform vec3 attenuationColor;
	#ifdef USE_TRANSMISSIONMAP
		uniform sampler2D transmissionMap;
	#endif
	#ifdef USE_THICKNESSMAP
		uniform sampler2D thicknessMap;
	#endif
	uniform vec2 transmissionSamplerSize;
	uniform sampler2D transmissionSamplerMap;
	uniform mat4 modelMatrix;
	uniform mat4 projectionMatrix;
	varying vec3 vWorldPosition;
	float w0( float a ) {
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - a + 3.0 ) - 3.0 ) + 1.0 );
	}
	float w1( float a ) {
		return ( 1.0 / 6.0 ) * ( a *  a * ( 3.0 * a - 6.0 ) + 4.0 );
	}
	float w2( float a ){
		return ( 1.0 / 6.0 ) * ( a * ( a * ( - 3.0 * a + 3.0 ) + 3.0 ) + 1.0 );
	}
	float w3( float a ) {
		return ( 1.0 / 6.0 ) * ( a * a * a );
	}
	float g0( float a ) {
		return w0( a ) + w1( a );
	}
	float g1( float a ) {
		return w2( a ) + w3( a );
	}
	float h0( float a ) {
		return - 1.0 + w1( a ) / ( w0( a ) + w1( a ) );
	}
	float h1( float a ) {
		return 1.0 + w3( a ) / ( w2( a ) + w3( a ) );
	}
	vec4 bicubic( sampler2D tex, vec2 uv, vec4 texelSize, float lod ) {
		uv = uv * texelSize.zw + 0.5;
		vec2 iuv = floor( uv );
		vec2 fuv = fract( uv );
		float g0x = g0( fuv.x );
		float g1x = g1( fuv.x );
		float h0x = h0( fuv.x );
		float h1x = h1( fuv.x );
		float h0y = h0( fuv.y );
		float h1y = h1( fuv.y );
		vec2 p0 = ( vec2( iuv.x + h0x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p1 = ( vec2( iuv.x + h1x, iuv.y + h0y ) - 0.5 ) * texelSize.xy;
		vec2 p2 = ( vec2( iuv.x + h0x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		vec2 p3 = ( vec2( iuv.x + h1x, iuv.y + h1y ) - 0.5 ) * texelSize.xy;
		return g0( fuv.y ) * ( g0x * textureLod( tex, p0, lod ) + g1x * textureLod( tex, p1, lod ) ) +
			g1( fuv.y ) * ( g0x * textureLod( tex, p2, lod ) + g1x * textureLod( tex, p3, lod ) );
	}
	vec4 textureBicubic( sampler2D sampler, vec2 uv, float lod ) {
		vec2 fLodSize = vec2( textureSize( sampler, int( lod ) ) );
		vec2 cLodSize = vec2( textureSize( sampler, int( lod + 1.0 ) ) );
		vec2 fLodSizeInv = 1.0 / fLodSize;
		vec2 cLodSizeInv = 1.0 / cLodSize;
		vec4 fSample = bicubic( sampler, uv, vec4( fLodSizeInv, fLodSize ), floor( lod ) );
		vec4 cSample = bicubic( sampler, uv, vec4( cLodSizeInv, cLodSize ), ceil( lod ) );
		return mix( fSample, cSample, fract( lod ) );
	}
	vec3 getVolumeTransmissionRay( const in vec3 n, const in vec3 v, const in float thickness, const in float ior, const in mat4 modelMatrix ) {
		vec3 refractionVector = refract( - v, normalize( n ), 1.0 / ior );
		vec3 modelScale;
		modelScale.x = length( vec3( modelMatrix[ 0 ].xyz ) );
		modelScale.y = length( vec3( modelMatrix[ 1 ].xyz ) );
		modelScale.z = length( vec3( modelMatrix[ 2 ].xyz ) );
		return normalize( refractionVector ) * thickness * modelScale;
	}
	float applyIorToRoughness( const in float roughness, const in float ior ) {
		return roughness * clamp( ior * 2.0 - 2.0, 0.0, 1.0 );
	}
	vec4 getTransmissionSample( const in vec2 fragCoord, const in float roughness, const in float ior ) {
		float lod = log2( transmissionSamplerSize.x ) * applyIorToRoughness( roughness, ior );
		return textureBicubic( transmissionSamplerMap, fragCoord.xy, lod );
	}
	vec3 volumeAttenuation( const in float transmissionDistance, const in vec3 attenuationColor, const in float attenuationDistance ) {
		if ( isinf( attenuationDistance ) ) {
			return vec3( 1.0 );
		} else {
			vec3 attenuationCoefficient = -log( attenuationColor ) / attenuationDistance;
			vec3 transmittance = exp( - attenuationCoefficient * transmissionDistance );			return transmittance;
		}
	}
	vec4 getIBLVolumeRefraction( const in vec3 n, const in vec3 v, const in float roughness, const in vec3 diffuseColor,
		const in vec3 specularColor, const in float specularF90, const in vec3 position, const in mat4 modelMatrix,
		const in mat4 viewMatrix, const in mat4 projMatrix, const in float dispersion, const in float ior, const in float thickness,
		const in vec3 attenuationColor, const in float attenuationDistance ) {
		vec4 transmittedLight;
		vec3 transmittance;
		#ifdef USE_DISPERSION
			float halfSpread = ( ior - 1.0 ) * 0.025 * dispersion;
			vec3 iors = vec3( ior - halfSpread, ior, ior + halfSpread );
			for ( int i = 0; i < 3; i ++ ) {
				vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, iors[ i ], modelMatrix );
				vec3 refractedRayExit = position + transmissionRay;
				vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
				vec2 refractionCoords = ndcPos.xy / ndcPos.w;
				refractionCoords += 1.0;
				refractionCoords /= 2.0;
				vec4 transmissionSample = getTransmissionSample( refractionCoords, roughness, iors[ i ] );
				transmittedLight[ i ] = transmissionSample[ i ];
				transmittedLight.a += transmissionSample.a;
				transmittance[ i ] = diffuseColor[ i ] * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance )[ i ];
			}
			transmittedLight.a /= 3.0;
		#else
			vec3 transmissionRay = getVolumeTransmissionRay( n, v, thickness, ior, modelMatrix );
			vec3 refractedRayExit = position + transmissionRay;
			vec4 ndcPos = projMatrix * viewMatrix * vec4( refractedRayExit, 1.0 );
			vec2 refractionCoords = ndcPos.xy / ndcPos.w;
			refractionCoords += 1.0;
			refractionCoords /= 2.0;
			transmittedLight = getTransmissionSample( refractionCoords, roughness, ior );
			transmittance = diffuseColor * volumeAttenuation( length( transmissionRay ), attenuationColor, attenuationDistance );
		#endif
		vec3 attenuatedColor = transmittance * transmittedLight.rgb;
		vec3 F = EnvironmentBRDF( n, v, specularColor, specularF90, roughness );
		float transmittanceFactor = ( transmittance.r + transmittance.g + transmittance.b ) / 3.0;
		return vec4( ( 1.0 - F ) * attenuatedColor, 1.0 - ( 1.0 - transmittedLight.a ) * transmittanceFactor );
	}
#endif`,H3A=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_SPECULARMAP
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,O3A=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	varying vec2 vUv;
#endif
#ifdef USE_MAP
	uniform mat3 mapTransform;
	varying vec2 vMapUv;
#endif
#ifdef USE_ALPHAMAP
	uniform mat3 alphaMapTransform;
	varying vec2 vAlphaMapUv;
#endif
#ifdef USE_LIGHTMAP
	uniform mat3 lightMapTransform;
	varying vec2 vLightMapUv;
#endif
#ifdef USE_AOMAP
	uniform mat3 aoMapTransform;
	varying vec2 vAoMapUv;
#endif
#ifdef USE_BUMPMAP
	uniform mat3 bumpMapTransform;
	varying vec2 vBumpMapUv;
#endif
#ifdef USE_NORMALMAP
	uniform mat3 normalMapTransform;
	varying vec2 vNormalMapUv;
#endif
#ifdef USE_DISPLACEMENTMAP
	uniform mat3 displacementMapTransform;
	varying vec2 vDisplacementMapUv;
#endif
#ifdef USE_EMISSIVEMAP
	uniform mat3 emissiveMapTransform;
	varying vec2 vEmissiveMapUv;
#endif
#ifdef USE_METALNESSMAP
	uniform mat3 metalnessMapTransform;
	varying vec2 vMetalnessMapUv;
#endif
#ifdef USE_ROUGHNESSMAP
	uniform mat3 roughnessMapTransform;
	varying vec2 vRoughnessMapUv;
#endif
#ifdef USE_ANISOTROPYMAP
	uniform mat3 anisotropyMapTransform;
	varying vec2 vAnisotropyMapUv;
#endif
#ifdef USE_CLEARCOATMAP
	uniform mat3 clearcoatMapTransform;
	varying vec2 vClearcoatMapUv;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	uniform mat3 clearcoatNormalMapTransform;
	varying vec2 vClearcoatNormalMapUv;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	uniform mat3 clearcoatRoughnessMapTransform;
	varying vec2 vClearcoatRoughnessMapUv;
#endif
#ifdef USE_SHEEN_COLORMAP
	uniform mat3 sheenColorMapTransform;
	varying vec2 vSheenColorMapUv;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	uniform mat3 sheenRoughnessMapTransform;
	varying vec2 vSheenRoughnessMapUv;
#endif
#ifdef USE_IRIDESCENCEMAP
	uniform mat3 iridescenceMapTransform;
	varying vec2 vIridescenceMapUv;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	uniform mat3 iridescenceThicknessMapTransform;
	varying vec2 vIridescenceThicknessMapUv;
#endif
#ifdef USE_SPECULARMAP
	uniform mat3 specularMapTransform;
	varying vec2 vSpecularMapUv;
#endif
#ifdef USE_SPECULAR_COLORMAP
	uniform mat3 specularColorMapTransform;
	varying vec2 vSpecularColorMapUv;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	uniform mat3 specularIntensityMapTransform;
	varying vec2 vSpecularIntensityMapUv;
#endif
#ifdef USE_TRANSMISSIONMAP
	uniform mat3 transmissionMapTransform;
	varying vec2 vTransmissionMapUv;
#endif
#ifdef USE_THICKNESSMAP
	uniform mat3 thicknessMapTransform;
	varying vec2 vThicknessMapUv;
#endif`,P3A=`#if defined( USE_UV ) || defined( USE_ANISOTROPY )
	vUv = vec3( uv, 1 ).xy;
#endif
#ifdef USE_MAP
	vMapUv = ( mapTransform * vec3( MAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ALPHAMAP
	vAlphaMapUv = ( alphaMapTransform * vec3( ALPHAMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_LIGHTMAP
	vLightMapUv = ( lightMapTransform * vec3( LIGHTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_AOMAP
	vAoMapUv = ( aoMapTransform * vec3( AOMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_BUMPMAP
	vBumpMapUv = ( bumpMapTransform * vec3( BUMPMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_NORMALMAP
	vNormalMapUv = ( normalMapTransform * vec3( NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_DISPLACEMENTMAP
	vDisplacementMapUv = ( displacementMapTransform * vec3( DISPLACEMENTMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_EMISSIVEMAP
	vEmissiveMapUv = ( emissiveMapTransform * vec3( EMISSIVEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_METALNESSMAP
	vMetalnessMapUv = ( metalnessMapTransform * vec3( METALNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ROUGHNESSMAP
	vRoughnessMapUv = ( roughnessMapTransform * vec3( ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_ANISOTROPYMAP
	vAnisotropyMapUv = ( anisotropyMapTransform * vec3( ANISOTROPYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOATMAP
	vClearcoatMapUv = ( clearcoatMapTransform * vec3( CLEARCOATMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_NORMALMAP
	vClearcoatNormalMapUv = ( clearcoatNormalMapTransform * vec3( CLEARCOAT_NORMALMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_CLEARCOAT_ROUGHNESSMAP
	vClearcoatRoughnessMapUv = ( clearcoatRoughnessMapTransform * vec3( CLEARCOAT_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCEMAP
	vIridescenceMapUv = ( iridescenceMapTransform * vec3( IRIDESCENCEMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_IRIDESCENCE_THICKNESSMAP
	vIridescenceThicknessMapUv = ( iridescenceThicknessMapTransform * vec3( IRIDESCENCE_THICKNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_COLORMAP
	vSheenColorMapUv = ( sheenColorMapTransform * vec3( SHEEN_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SHEEN_ROUGHNESSMAP
	vSheenRoughnessMapUv = ( sheenRoughnessMapTransform * vec3( SHEEN_ROUGHNESSMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULARMAP
	vSpecularMapUv = ( specularMapTransform * vec3( SPECULARMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_COLORMAP
	vSpecularColorMapUv = ( specularColorMapTransform * vec3( SPECULAR_COLORMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_SPECULAR_INTENSITYMAP
	vSpecularIntensityMapUv = ( specularIntensityMapTransform * vec3( SPECULAR_INTENSITYMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_TRANSMISSIONMAP
	vTransmissionMapUv = ( transmissionMapTransform * vec3( TRANSMISSIONMAP_UV, 1 ) ).xy;
#endif
#ifdef USE_THICKNESSMAP
	vThicknessMapUv = ( thicknessMapTransform * vec3( THICKNESSMAP_UV, 1 ) ).xy;
#endif`,j3A=`#if defined( USE_ENVMAP ) || defined( DISTANCE ) || defined ( USE_SHADOWMAP ) || defined ( USE_TRANSMISSION ) || NUM_SPOT_LIGHT_COORDS > 0
	vec4 worldPosition = vec4( transformed, 1.0 );
	#ifdef USE_BATCHING
		worldPosition = batchingMatrix * worldPosition;
	#endif
	#ifdef USE_INSTANCING
		worldPosition = instanceMatrix * worldPosition;
	#endif
	worldPosition = modelMatrix * worldPosition;
#endif`;const Z3A=`varying vec2 vUv;
uniform mat3 uvTransform;
void main() {
	vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	gl_Position = vec4( position.xy, 1.0, 1.0 );
}`,W3A=`uniform sampler2D t2D;
uniform float backgroundIntensity;
varying vec2 vUv;
void main() {
	vec4 texColor = texture2D( t2D, vUv );
	#ifdef DECODE_VIDEO_TEXTURE
		texColor = vec4( mix( pow( texColor.rgb * 0.9478672986 + vec3( 0.0521327014 ), vec3( 2.4 ) ), texColor.rgb * 0.0773993808, vec3( lessThanEqual( texColor.rgb, vec3( 0.04045 ) ) ) ), texColor.w );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,z3A=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,V3A=`#ifdef ENVMAP_TYPE_CUBE
	uniform samplerCube envMap;
#elif defined( ENVMAP_TYPE_CUBE_UV )
	uniform sampler2D envMap;
#endif
uniform float flipEnvMap;
uniform float backgroundBlurriness;
uniform float backgroundIntensity;
uniform mat3 backgroundRotation;
varying vec3 vWorldDirection;
#include <cube_uv_reflection_fragment>
void main() {
	#ifdef ENVMAP_TYPE_CUBE
		vec4 texColor = textureCube( envMap, backgroundRotation * vec3( flipEnvMap * vWorldDirection.x, vWorldDirection.yz ) );
	#elif defined( ENVMAP_TYPE_CUBE_UV )
		vec4 texColor = textureCubeUV( envMap, backgroundRotation * vWorldDirection, backgroundBlurriness );
	#else
		vec4 texColor = vec4( 0.0, 0.0, 0.0, 1.0 );
	#endif
	texColor.rgb *= backgroundIntensity;
	gl_FragColor = texColor;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,X3A=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
	gl_Position.z = gl_Position.w;
}`,$3A=`uniform samplerCube tCube;
uniform float tFlip;
uniform float opacity;
varying vec3 vWorldDirection;
void main() {
	vec4 texColor = textureCube( tCube, vec3( tFlip * vWorldDirection.x, vWorldDirection.yz ) );
	gl_FragColor = texColor;
	gl_FragColor.a *= opacity;
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,A4A=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
varying vec2 vHighPrecisionZW;
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vHighPrecisionZW = gl_Position.zw;
}`,e4A=`#if DEPTH_PACKING == 3200
	uniform float opacity;
#endif
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
varying vec2 vHighPrecisionZW;
void main() {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#if DEPTH_PACKING == 3200
		diffuseColor.a = opacity;
	#endif
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <logdepthbuf_fragment>
	#ifdef USE_REVERSED_DEPTH_BUFFER
		float fragCoordZ = vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ];
	#else
		float fragCoordZ = 0.5 * vHighPrecisionZW[ 0 ] / vHighPrecisionZW[ 1 ] + 0.5;
	#endif
	#if DEPTH_PACKING == 3200
		gl_FragColor = vec4( vec3( 1.0 - fragCoordZ ), opacity );
	#elif DEPTH_PACKING == 3201
		gl_FragColor = packDepthToRGBA( fragCoordZ );
	#elif DEPTH_PACKING == 3202
		gl_FragColor = vec4( packDepthToRGB( fragCoordZ ), 1.0 );
	#elif DEPTH_PACKING == 3203
		gl_FragColor = vec4( packDepthToRG( fragCoordZ ), 0.0, 1.0 );
	#endif
}`,t4A=`#define DISTANCE
varying vec3 vWorldPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <skinbase_vertex>
	#include <morphinstance_vertex>
	#ifdef USE_DISPLACEMENTMAP
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <worldpos_vertex>
	#include <clipping_planes_vertex>
	vWorldPosition = worldPosition.xyz;
}`,i4A=`#define DISTANCE
uniform vec3 referencePosition;
uniform float nearDistance;
uniform float farDistance;
varying vec3 vWorldPosition;
#include <common>
#include <packing>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <clipping_planes_pars_fragment>
void main () {
	vec4 diffuseColor = vec4( 1.0 );
	#include <clipping_planes_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	float dist = length( vWorldPosition - referencePosition );
	dist = ( dist - nearDistance ) / ( farDistance - nearDistance );
	dist = saturate( dist );
	gl_FragColor = packDepthToRGBA( dist );
}`,g4A=`varying vec3 vWorldDirection;
#include <common>
void main() {
	vWorldDirection = transformDirection( position, modelMatrix );
	#include <begin_vertex>
	#include <project_vertex>
}`,I4A=`uniform sampler2D tEquirect;
varying vec3 vWorldDirection;
#include <common>
void main() {
	vec3 direction = normalize( vWorldDirection );
	vec2 sampleUV = equirectUv( direction );
	gl_FragColor = texture2D( tEquirect, sampleUV );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
}`,n4A=`uniform float scale;
attribute float lineDistance;
varying float vLineDistance;
#include <common>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	vLineDistance = scale * lineDistance;
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,o4A=`uniform vec3 diffuse;
uniform float opacity;
uniform float dashSize;
uniform float totalSize;
varying float vLineDistance;
#include <common>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	if ( mod( vLineDistance, totalSize ) > dashSize ) {
		discard;
	}
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,a4A=`#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#if defined ( USE_ENVMAP ) || defined ( USE_SKINNING )
		#include <beginnormal_vertex>
		#include <morphnormal_vertex>
		#include <skinbase_vertex>
		#include <skinnormal_vertex>
		#include <defaultnormal_vertex>
	#endif
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <fog_vertex>
}`,r4A=`uniform vec3 diffuse;
uniform float opacity;
#ifndef FLAT_SHADED
	varying vec3 vNormal;
#endif
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	#ifdef USE_LIGHTMAP
		vec4 lightMapTexel = texture2D( lightMap, vLightMapUv );
		reflectedLight.indirectDiffuse += lightMapTexel.rgb * lightMapIntensity * RECIPROCAL_PI;
	#else
		reflectedLight.indirectDiffuse += vec3( 1.0 );
	#endif
	#include <aomap_fragment>
	reflectedLight.indirectDiffuse *= diffuseColor.rgb;
	vec3 outgoingLight = reflectedLight.indirectDiffuse;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,s4A=`#define LAMBERT
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,C4A=`#define LAMBERT
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_lambert_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_lambert_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,B4A=`#define MATCAP
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <color_pars_vertex>
#include <displacementmap_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
	vViewPosition = - mvPosition.xyz;
}`,c4A=`#define MATCAP
uniform vec3 diffuse;
uniform float opacity;
uniform sampler2D matcap;
varying vec3 vViewPosition;
#include <common>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	vec3 viewDir = normalize( vViewPosition );
	vec3 x = normalize( vec3( viewDir.z, 0.0, - viewDir.x ) );
	vec3 y = cross( viewDir, x );
	vec2 uv = vec2( dot( x, normal ), dot( y, normal ) ) * 0.495 + 0.5;
	#ifdef USE_MATCAP
		vec4 matcapColor = texture2D( matcap, uv );
	#else
		vec4 matcapColor = vec4( vec3( mix( 0.2, 0.8, uv.y ) ), 1.0 );
	#endif
	vec3 outgoingLight = diffuseColor.rgb * matcapColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,l4A=`#define NORMAL
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	vViewPosition = - mvPosition.xyz;
#endif
}`,Q4A=`#define NORMAL
uniform float opacity;
#if defined( FLAT_SHADED ) || defined( USE_BUMPMAP ) || defined( USE_NORMALMAP_TANGENTSPACE )
	varying vec3 vViewPosition;
#endif
#include <packing>
#include <uv_pars_fragment>
#include <normal_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( 0.0, 0.0, 0.0, opacity );
	#include <clipping_planes_fragment>
	#include <logdepthbuf_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	gl_FragColor = vec4( packNormalToRGB( normal ), diffuseColor.a );
	#ifdef OPAQUE
		gl_FragColor.a = 1.0;
	#endif
}`,E4A=`#define PHONG
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <envmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <envmap_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,u4A=`#define PHONG
uniform vec3 diffuse;
uniform vec3 emissive;
uniform vec3 specular;
uniform float shininess;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_phong_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <specularmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <specularmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_phong_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + reflectedLight.directSpecular + reflectedLight.indirectSpecular + totalEmissiveRadiance;
	#include <envmap_fragment>
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,h4A=`#define STANDARD
varying vec3 vViewPosition;
#ifdef USE_TRANSMISSION
	varying vec3 vWorldPosition;
#endif
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
#ifdef USE_TRANSMISSION
	vWorldPosition = worldPosition.xyz;
#endif
}`,d4A=`#define STANDARD
#ifdef PHYSICAL
	#define IOR
	#define USE_SPECULAR
#endif
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float roughness;
uniform float metalness;
uniform float opacity;
#ifdef IOR
	uniform float ior;
#endif
#ifdef USE_SPECULAR
	uniform float specularIntensity;
	uniform vec3 specularColor;
	#ifdef USE_SPECULAR_COLORMAP
		uniform sampler2D specularColorMap;
	#endif
	#ifdef USE_SPECULAR_INTENSITYMAP
		uniform sampler2D specularIntensityMap;
	#endif
#endif
#ifdef USE_CLEARCOAT
	uniform float clearcoat;
	uniform float clearcoatRoughness;
#endif
#ifdef USE_DISPERSION
	uniform float dispersion;
#endif
#ifdef USE_IRIDESCENCE
	uniform float iridescence;
	uniform float iridescenceIOR;
	uniform float iridescenceThicknessMinimum;
	uniform float iridescenceThicknessMaximum;
#endif
#ifdef USE_SHEEN
	uniform vec3 sheenColor;
	uniform float sheenRoughness;
	#ifdef USE_SHEEN_COLORMAP
		uniform sampler2D sheenColorMap;
	#endif
	#ifdef USE_SHEEN_ROUGHNESSMAP
		uniform sampler2D sheenRoughnessMap;
	#endif
#endif
#ifdef USE_ANISOTROPY
	uniform vec2 anisotropyVector;
	#ifdef USE_ANISOTROPYMAP
		uniform sampler2D anisotropyMap;
	#endif
#endif
varying vec3 vViewPosition;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <iridescence_fragment>
#include <cube_uv_reflection_fragment>
#include <envmap_common_pars_fragment>
#include <envmap_physical_pars_fragment>
#include <fog_pars_fragment>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_physical_pars_fragment>
#include <transmission_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <clearcoat_pars_fragment>
#include <iridescence_pars_fragment>
#include <roughnessmap_pars_fragment>
#include <metalnessmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <roughnessmap_fragment>
	#include <metalnessmap_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <clearcoat_normal_fragment_begin>
	#include <clearcoat_normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_physical_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 totalDiffuse = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse;
	vec3 totalSpecular = reflectedLight.directSpecular + reflectedLight.indirectSpecular;
	#include <transmission_fragment>
	vec3 outgoingLight = totalDiffuse + totalSpecular + totalEmissiveRadiance;
	#ifdef USE_SHEEN
		float sheenEnergyComp = 1.0 - 0.157 * max3( material.sheenColor );
		outgoingLight = outgoingLight * sheenEnergyComp + sheenSpecularDirect + sheenSpecularIndirect;
	#endif
	#ifdef USE_CLEARCOAT
		float dotNVcc = saturate( dot( geometryClearcoatNormal, geometryViewDir ) );
		vec3 Fcc = F_Schlick( material.clearcoatF0, material.clearcoatF90, dotNVcc );
		outgoingLight = outgoingLight * ( 1.0 - material.clearcoat * Fcc ) + ( clearcoatSpecularDirect + clearcoatSpecularIndirect ) * material.clearcoat;
	#endif
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,p4A=`#define TOON
varying vec3 vViewPosition;
#include <common>
#include <batching_pars_vertex>
#include <uv_pars_vertex>
#include <displacementmap_pars_vertex>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <normal_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <shadowmap_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <normal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <displacementmap_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	vViewPosition = - mvPosition.xyz;
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,f4A=`#define TOON
uniform vec3 diffuse;
uniform vec3 emissive;
uniform float opacity;
#include <common>
#include <packing>
#include <dithering_pars_fragment>
#include <color_pars_fragment>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <aomap_pars_fragment>
#include <lightmap_pars_fragment>
#include <emissivemap_pars_fragment>
#include <gradientmap_pars_fragment>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <normal_pars_fragment>
#include <lights_toon_pars_fragment>
#include <shadowmap_pars_fragment>
#include <bumpmap_pars_fragment>
#include <normalmap_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	ReflectedLight reflectedLight = ReflectedLight( vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ), vec3( 0.0 ) );
	vec3 totalEmissiveRadiance = emissive;
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <color_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	#include <normal_fragment_begin>
	#include <normal_fragment_maps>
	#include <emissivemap_fragment>
	#include <lights_toon_fragment>
	#include <lights_fragment_begin>
	#include <lights_fragment_maps>
	#include <lights_fragment_end>
	#include <aomap_fragment>
	vec3 outgoingLight = reflectedLight.directDiffuse + reflectedLight.indirectDiffuse + totalEmissiveRadiance;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
	#include <dithering_fragment>
}`,D4A=`uniform float size;
uniform float scale;
#include <common>
#include <color_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
#ifdef USE_POINTS_UV
	varying vec2 vUv;
	uniform mat3 uvTransform;
#endif
void main() {
	#ifdef USE_POINTS_UV
		vUv = ( uvTransform * vec3( uv, 1 ) ).xy;
	#endif
	#include <color_vertex>
	#include <morphinstance_vertex>
	#include <morphcolor_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <project_vertex>
	gl_PointSize = size;
	#ifdef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) gl_PointSize *= ( scale / - mvPosition.z );
	#endif
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <worldpos_vertex>
	#include <fog_vertex>
}`,y4A=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <color_pars_fragment>
#include <map_particle_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_particle_fragment>
	#include <color_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
	#include <premultiplied_alpha_fragment>
}`,S4A=`#include <common>
#include <batching_pars_vertex>
#include <fog_pars_vertex>
#include <morphtarget_pars_vertex>
#include <skinning_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <shadowmap_pars_vertex>
void main() {
	#include <batching_vertex>
	#include <beginnormal_vertex>
	#include <morphinstance_vertex>
	#include <morphnormal_vertex>
	#include <skinbase_vertex>
	#include <skinnormal_vertex>
	#include <defaultnormal_vertex>
	#include <begin_vertex>
	#include <morphtarget_vertex>
	#include <skinning_vertex>
	#include <project_vertex>
	#include <logdepthbuf_vertex>
	#include <worldpos_vertex>
	#include <shadowmap_vertex>
	#include <fog_vertex>
}`,w4A=`uniform vec3 color;
uniform float opacity;
#include <common>
#include <packing>
#include <fog_pars_fragment>
#include <bsdfs>
#include <lights_pars_begin>
#include <logdepthbuf_pars_fragment>
#include <shadowmap_pars_fragment>
#include <shadowmask_pars_fragment>
void main() {
	#include <logdepthbuf_fragment>
	gl_FragColor = vec4( color, opacity * ( 1.0 - getShadowMask() ) );
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,m4A=`uniform float rotation;
uniform vec2 center;
#include <common>
#include <uv_pars_vertex>
#include <fog_pars_vertex>
#include <logdepthbuf_pars_vertex>
#include <clipping_planes_pars_vertex>
void main() {
	#include <uv_vertex>
	vec4 mvPosition = modelViewMatrix[ 3 ];
	vec2 scale = vec2( length( modelMatrix[ 0 ].xyz ), length( modelMatrix[ 1 ].xyz ) );
	#ifndef USE_SIZEATTENUATION
		bool isPerspective = isPerspectiveMatrix( projectionMatrix );
		if ( isPerspective ) scale *= - mvPosition.z;
	#endif
	vec2 alignedPosition = ( position.xy - ( center - vec2( 0.5 ) ) ) * scale;
	vec2 rotatedPosition;
	rotatedPosition.x = cos( rotation ) * alignedPosition.x - sin( rotation ) * alignedPosition.y;
	rotatedPosition.y = sin( rotation ) * alignedPosition.x + cos( rotation ) * alignedPosition.y;
	mvPosition.xy += rotatedPosition;
	gl_Position = projectionMatrix * mvPosition;
	#include <logdepthbuf_vertex>
	#include <clipping_planes_vertex>
	#include <fog_vertex>
}`,k4A=`uniform vec3 diffuse;
uniform float opacity;
#include <common>
#include <uv_pars_fragment>
#include <map_pars_fragment>
#include <alphamap_pars_fragment>
#include <alphatest_pars_fragment>
#include <alphahash_pars_fragment>
#include <fog_pars_fragment>
#include <logdepthbuf_pars_fragment>
#include <clipping_planes_pars_fragment>
void main() {
	vec4 diffuseColor = vec4( diffuse, opacity );
	#include <clipping_planes_fragment>
	vec3 outgoingLight = vec3( 0.0 );
	#include <logdepthbuf_fragment>
	#include <map_fragment>
	#include <alphamap_fragment>
	#include <alphatest_fragment>
	#include <alphahash_fragment>
	outgoingLight = diffuseColor.rgb;
	#include <opaque_fragment>
	#include <tonemapping_fragment>
	#include <colorspace_fragment>
	#include <fog_fragment>
}`,_i={alphahash_fragment:WPA,alphahash_pars_fragment:zPA,alphamap_fragment:VPA,alphamap_pars_fragment:XPA,alphatest_fragment:$PA,alphatest_pars_fragment:A1A,aomap_fragment:e1A,aomap_pars_fragment:t1A,batching_pars_vertex:i1A,batching_vertex:g1A,begin_vertex:I1A,beginnormal_vertex:n1A,bsdfs:o1A,iridescence_fragment:a1A,bumpmap_pars_fragment:r1A,clipping_planes_fragment:s1A,clipping_planes_pars_fragment:C1A,clipping_planes_pars_vertex:B1A,clipping_planes_vertex:c1A,color_fragment:l1A,color_pars_fragment:Q1A,color_pars_vertex:E1A,color_vertex:u1A,common:h1A,cube_uv_reflection_fragment:d1A,defaultnormal_vertex:p1A,displacementmap_pars_vertex:f1A,displacementmap_vertex:D1A,emissivemap_fragment:y1A,emissivemap_pars_fragment:S1A,colorspace_fragment:w1A,colorspace_pars_fragment:m1A,envmap_fragment:k1A,envmap_common_pars_fragment:M1A,envmap_pars_fragment:N1A,envmap_pars_vertex:G1A,envmap_physical_pars_fragment:x1A,envmap_vertex:R1A,fog_vertex:U1A,fog_pars_vertex:K1A,fog_fragment:F1A,fog_pars_fragment:b1A,gradientmap_pars_fragment:v1A,lightmap_pars_fragment:_1A,lights_lambert_fragment:J1A,lights_lambert_pars_fragment:L1A,lights_pars_begin:q1A,lights_toon_fragment:T1A,lights_toon_pars_fragment:Y1A,lights_phong_fragment:H1A,lights_phong_pars_fragment:O1A,lights_physical_fragment:P1A,lights_physical_pars_fragment:j1A,lights_fragment_begin:Z1A,lights_fragment_maps:W1A,lights_fragment_end:z1A,logdepthbuf_fragment:V1A,logdepthbuf_pars_fragment:X1A,logdepthbuf_pars_vertex:$1A,logdepthbuf_vertex:A3A,map_fragment:e3A,map_pars_fragment:t3A,map_particle_fragment:i3A,map_particle_pars_fragment:g3A,metalnessmap_fragment:I3A,metalnessmap_pars_fragment:n3A,morphinstance_vertex:o3A,morphcolor_vertex:a3A,morphnormal_vertex:r3A,morphtarget_pars_vertex:s3A,morphtarget_vertex:C3A,normal_fragment_begin:B3A,normal_fragment_maps:c3A,normal_pars_fragment:l3A,normal_pars_vertex:Q3A,normal_vertex:E3A,normalmap_pars_fragment:u3A,clearcoat_normal_fragment_begin:h3A,clearcoat_normal_fragment_maps:d3A,clearcoat_pars_fragment:p3A,iridescence_pars_fragment:f3A,opaque_fragment:D3A,packing:y3A,premultiplied_alpha_fragment:S3A,project_vertex:w3A,dithering_fragment:m3A,dithering_pars_fragment:k3A,roughnessmap_fragment:M3A,roughnessmap_pars_fragment:N3A,shadowmap_pars_fragment:G3A,shadowmap_pars_vertex:R3A,shadowmap_vertex:U3A,shadowmask_pars_fragment:K3A,skinbase_vertex:F3A,skinning_pars_vertex:b3A,skinning_vertex:v3A,skinnormal_vertex:_3A,specularmap_fragment:J3A,specularmap_pars_fragment:L3A,tonemapping_fragment:q3A,tonemapping_pars_fragment:x3A,transmission_fragment:T3A,transmission_pars_fragment:Y3A,uv_pars_fragment:H3A,uv_pars_vertex:O3A,uv_vertex:P3A,worldpos_vertex:j3A,background_vert:Z3A,background_frag:W3A,backgroundCube_vert:z3A,backgroundCube_frag:V3A,cube_vert:X3A,cube_frag:$3A,depth_vert:A4A,depth_frag:e4A,distanceRGBA_vert:t4A,distanceRGBA_frag:i4A,equirect_vert:g4A,equirect_frag:I4A,linedashed_vert:n4A,linedashed_frag:o4A,meshbasic_vert:a4A,meshbasic_frag:r4A,meshlambert_vert:s4A,meshlambert_frag:C4A,meshmatcap_vert:B4A,meshmatcap_frag:c4A,meshnormal_vert:l4A,meshnormal_frag:Q4A,meshphong_vert:E4A,meshphong_frag:u4A,meshphysical_vert:h4A,meshphysical_frag:d4A,meshtoon_vert:p4A,meshtoon_frag:f4A,points_vert:D4A,points_frag:y4A,shadow_vert:S4A,shadow_frag:w4A,sprite_vert:m4A,sprite_frag:k4A},kt={common:{diffuse:{value:new wt(16777215)},opacity:{value:1},map:{value:null},mapTransform:{value:new Ni},alphaMap:{value:null},alphaMapTransform:{value:new Ni},alphaTest:{value:0}},specularmap:{specularMap:{value:null},specularMapTransform:{value:new Ni}},envmap:{envMap:{value:null},envMapRotation:{value:new Ni},flipEnvMap:{value:-1},reflectivity:{value:1},ior:{value:1.5},refractionRatio:{value:.98}},aomap:{aoMap:{value:null},aoMapIntensity:{value:1},aoMapTransform:{value:new Ni}},lightmap:{lightMap:{value:null},lightMapIntensity:{value:1},lightMapTransform:{value:new Ni}},bumpmap:{bumpMap:{value:null},bumpMapTransform:{value:new Ni},bumpScale:{value:1}},normalmap:{normalMap:{value:null},normalMapTransform:{value:new Ni},normalScale:{value:new Ze(1,1)}},displacementmap:{displacementMap:{value:null},displacementMapTransform:{value:new Ni},displacementScale:{value:1},displacementBias:{value:0}},emissivemap:{emissiveMap:{value:null},emissiveMapTransform:{value:new Ni}},metalnessmap:{metalnessMap:{value:null},metalnessMapTransform:{value:new Ni}},roughnessmap:{roughnessMap:{value:null},roughnessMapTransform:{value:new Ni}},gradientmap:{gradientMap:{value:null}},fog:{fogDensity:{value:25e-5},fogNear:{value:1},fogFar:{value:2e3},fogColor:{value:new wt(16777215)}},lights:{ambientLightColor:{value:[]},lightProbe:{value:[]},directionalLights:{value:[],properties:{direction:{},color:{}}},directionalLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},directionalShadowMap:{value:[]},directionalShadowMatrix:{value:[]},spotLights:{value:[],properties:{color:{},position:{},direction:{},distance:{},coneCos:{},penumbraCos:{},decay:{}}},spotLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{}}},spotLightMap:{value:[]},spotShadowMap:{value:[]},spotLightMatrix:{value:[]},pointLights:{value:[],properties:{color:{},position:{},decay:{},distance:{}}},pointLightShadows:{value:[],properties:{shadowIntensity:1,shadowBias:{},shadowNormalBias:{},shadowRadius:{},shadowMapSize:{},shadowCameraNear:{},shadowCameraFar:{}}},pointShadowMap:{value:[]},pointShadowMatrix:{value:[]},hemisphereLights:{value:[],properties:{direction:{},skyColor:{},groundColor:{}}},rectAreaLights:{value:[],properties:{color:{},position:{},width:{},height:{}}},ltc_1:{value:null},ltc_2:{value:null}},points:{diffuse:{value:new wt(16777215)},opacity:{value:1},size:{value:1},scale:{value:1},map:{value:null},alphaMap:{value:null},alphaMapTransform:{value:new Ni},alphaTest:{value:0},uvTransform:{value:new Ni}},sprite:{diffuse:{value:new wt(16777215)},opacity:{value:1},center:{value:new Ze(.5,.5)},rotation:{value:0},map:{value:null},mapTransform:{value:new Ni},alphaMap:{value:null},alphaMapTransform:{value:new Ni},alphaTest:{value:0}}},nB={basic:{uniforms:Pa([kt.common,kt.specularmap,kt.envmap,kt.aomap,kt.lightmap,kt.fog]),vertexShader:_i.meshbasic_vert,fragmentShader:_i.meshbasic_frag},lambert:{uniforms:Pa([kt.common,kt.specularmap,kt.envmap,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.fog,kt.lights,{emissive:{value:new wt(0)}}]),vertexShader:_i.meshlambert_vert,fragmentShader:_i.meshlambert_frag},phong:{uniforms:Pa([kt.common,kt.specularmap,kt.envmap,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.fog,kt.lights,{emissive:{value:new wt(0)},specular:{value:new wt(1118481)},shininess:{value:30}}]),vertexShader:_i.meshphong_vert,fragmentShader:_i.meshphong_frag},standard:{uniforms:Pa([kt.common,kt.envmap,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.roughnessmap,kt.metalnessmap,kt.fog,kt.lights,{emissive:{value:new wt(0)},roughness:{value:1},metalness:{value:0},envMapIntensity:{value:1}}]),vertexShader:_i.meshphysical_vert,fragmentShader:_i.meshphysical_frag},toon:{uniforms:Pa([kt.common,kt.aomap,kt.lightmap,kt.emissivemap,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.gradientmap,kt.fog,kt.lights,{emissive:{value:new wt(0)}}]),vertexShader:_i.meshtoon_vert,fragmentShader:_i.meshtoon_frag},matcap:{uniforms:Pa([kt.common,kt.bumpmap,kt.normalmap,kt.displacementmap,kt.fog,{matcap:{value:null}}]),vertexShader:_i.meshmatcap_vert,fragmentShader:_i.meshmatcap_frag},points:{uniforms:Pa([kt.points,kt.fog]),vertexShader:_i.points_vert,fragmentShader:_i.points_frag},dashed:{uniforms:Pa([kt.common,kt.fog,{scale:{value:1},dashSize:{value:1},totalSize:{value:2}}]),vertexShader:_i.linedashed_vert,fragmentShader:_i.linedashed_frag},depth:{uniforms:Pa([kt.common,kt.displacementmap]),vertexShader:_i.depth_vert,fragmentShader:_i.depth_frag},normal:{uniforms:Pa([kt.common,kt.bumpmap,kt.normalmap,kt.displacementmap,{opacity:{value:1}}]),vertexShader:_i.meshnormal_vert,fragmentShader:_i.meshnormal_frag},sprite:{uniforms:Pa([kt.sprite,kt.fog]),vertexShader:_i.sprite_vert,fragmentShader:_i.sprite_frag},background:{uniforms:{uvTransform:{value:new Ni},t2D:{value:null},backgroundIntensity:{value:1}},vertexShader:_i.background_vert,fragmentShader:_i.background_frag},backgroundCube:{uniforms:{envMap:{value:null},flipEnvMap:{value:-1},backgroundBlurriness:{value:0},backgroundIntensity:{value:1},backgroundRotation:{value:new Ni}},vertexShader:_i.backgroundCube_vert,fragmentShader:_i.backgroundCube_frag},cube:{uniforms:{tCube:{value:null},tFlip:{value:-1},opacity:{value:1}},vertexShader:_i.cube_vert,fragmentShader:_i.cube_frag},equirect:{uniforms:{tEquirect:{value:null}},vertexShader:_i.equirect_vert,fragmentShader:_i.equirect_frag},distanceRGBA:{uniforms:Pa([kt.common,kt.displacementmap,{referencePosition:{value:new wA},nearDistance:{value:1},farDistance:{value:1e3}}]),vertexShader:_i.distanceRGBA_vert,fragmentShader:_i.distanceRGBA_frag},shadow:{uniforms:Pa([kt.lights,kt.fog,{color:{value:new wt(0)},opacity:{value:1}}]),vertexShader:_i.shadow_vert,fragmentShader:_i.shadow_frag}};nB.physical={uniforms:Pa([nB.standard.uniforms,{clearcoat:{value:0},clearcoatMap:{value:null},clearcoatMapTransform:{value:new Ni},clearcoatNormalMap:{value:null},clearcoatNormalMapTransform:{value:new Ni},clearcoatNormalScale:{value:new Ze(1,1)},clearcoatRoughness:{value:0},clearcoatRoughnessMap:{value:null},clearcoatRoughnessMapTransform:{value:new Ni},dispersion:{value:0},iridescence:{value:0},iridescenceMap:{value:null},iridescenceMapTransform:{value:new Ni},iridescenceIOR:{value:1.3},iridescenceThicknessMinimum:{value:100},iridescenceThicknessMaximum:{value:400},iridescenceThicknessMap:{value:null},iridescenceThicknessMapTransform:{value:new Ni},sheen:{value:0},sheenColor:{value:new wt(0)},sheenColorMap:{value:null},sheenColorMapTransform:{value:new Ni},sheenRoughness:{value:1},sheenRoughnessMap:{value:null},sheenRoughnessMapTransform:{value:new Ni},transmission:{value:0},transmissionMap:{value:null},transmissionMapTransform:{value:new Ni},transmissionSamplerSize:{value:new Ze},transmissionSamplerMap:{value:null},thickness:{value:0},thicknessMap:{value:null},thicknessMapTransform:{value:new Ni},attenuationDistance:{value:0},attenuationColor:{value:new wt(0)},specularColor:{value:new wt(1,1,1)},specularColorMap:{value:null},specularColorMapTransform:{value:new Ni},specularIntensity:{value:1},specularIntensityMap:{value:null},specularIntensityMapTransform:{value:new Ni},anisotropyVector:{value:new Ze},anisotropyMap:{value:null},anisotropyMapTransform:{value:new Ni}}]),vertexShader:_i.meshphysical_vert,fragmentShader:_i.meshphysical_frag};const qG={r:0,b:0,g:0},Uh=new Wo,M4A=new Ai;function N4A(t,A,e,i,g,I,n){const o=new wt(0);let a=I===!0?0:1,r,s,B=null,c=0,E=null;function D(k){let m=k.isScene===!0?k.background:null;return m&&m.isTexture&&(m=(k.backgroundBlurriness>0?e:A).get(m)),m}function y(k){let m=!1;const U=D(k);U===null?f(o,a):U&&U.isColor&&(f(U,1),m=!0);const F=t.xr.getEnvironmentBlendMode();F==="additive"?i.buffers.color.setClear(0,0,0,1,n):F==="alpha-blend"&&i.buffers.color.setClear(0,0,0,0,n),(t.autoClear||m)&&(i.buffers.depth.setTest(!0),i.buffers.depth.setMask(!0),i.buffers.color.setMask(!0),t.clear(t.autoClearColor,t.autoClearDepth,t.autoClearStencil))}function S(k,m){const U=D(m);U&&(U.isCubeTexture||U.mapping===AS)?(s===void 0&&(s=new Cn(new cp(1,1,1),new EC({name:"BackgroundCubeMaterial",uniforms:Dy(nB.backgroundCube.uniforms),vertexShader:nB.backgroundCube.vertexShader,fragmentShader:nB.backgroundCube.fragmentShader,side:Ir,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),s.geometry.deleteAttribute("normal"),s.geometry.deleteAttribute("uv"),s.onBeforeRender=function(F,b,K){this.matrixWorld.copyPosition(K.matrixWorld)},Object.defineProperty(s.material,"envMap",{get:function(){return this.uniforms.envMap.value}}),g.update(s)),Uh.copy(m.backgroundRotation),Uh.x*=-1,Uh.y*=-1,Uh.z*=-1,U.isCubeTexture&&U.isRenderTargetTexture===!1&&(Uh.y*=-1,Uh.z*=-1),s.material.uniforms.envMap.value=U,s.material.uniforms.flipEnvMap.value=U.isCubeTexture&&U.isRenderTargetTexture===!1?-1:1,s.material.uniforms.backgroundBlurriness.value=m.backgroundBlurriness,s.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,s.material.uniforms.backgroundRotation.value.setFromMatrix4(M4A.makeRotationFromEuler(Uh)),s.material.toneMapped=Qg.getTransfer(U.colorSpace)!==Vg,(B!==U||c!==U.version||E!==t.toneMapping)&&(s.material.needsUpdate=!0,B=U,c=U.version,E=t.toneMapping),s.layers.enableAll(),k.unshift(s,s.geometry,s.material,0,0,null)):U&&U.isTexture&&(r===void 0&&(r=new Cn(new iS(2,2),new EC({name:"BackgroundMaterial",uniforms:Dy(nB.background.uniforms),vertexShader:nB.background.vertexShader,fragmentShader:nB.background.fragmentShader,side:jc,depthTest:!1,depthWrite:!1,fog:!1,allowOverride:!1})),r.geometry.deleteAttribute("normal"),Object.defineProperty(r.material,"map",{get:function(){return this.uniforms.t2D.value}}),g.update(r)),r.material.uniforms.t2D.value=U,r.material.uniforms.backgroundIntensity.value=m.backgroundIntensity,r.material.toneMapped=Qg.getTransfer(U.colorSpace)!==Vg,U.matrixAutoUpdate===!0&&U.updateMatrix(),r.material.uniforms.uvTransform.value.copy(U.matrix),(B!==U||c!==U.version||E!==t.toneMapping)&&(r.material.needsUpdate=!0,B=U,c=U.version,E=t.toneMapping),r.layers.enableAll(),k.unshift(r,r.geometry,r.material,0,0,null))}function f(k,m){k.getRGB(qG,ynA(t)),i.buffers.color.setClear(qG.r,qG.g,qG.b,m,n)}function M(){s!==void 0&&(s.geometry.dispose(),s.material.dispose(),s=void 0),r!==void 0&&(r.geometry.dispose(),r.material.dispose(),r=void 0)}return{getClearColor:function(){return o},setClearColor:function(k,m=1){o.set(k),a=m,f(o,a)},getClearAlpha:function(){return a},setClearAlpha:function(k){a=k,f(o,a)},render:y,addToRenderList:S,dispose:M}}function G4A(t,A){const e=t.getParameter(t.MAX_VERTEX_ATTRIBS),i={},g=c(null);let I=g,n=!1;function o(G,J,x,H,P){let j=!1;const q=B(H,x,J);I!==q&&(I=q,r(I.object)),j=E(G,H,x,P),j&&D(G,H,x,P),P!==null&&A.update(P,t.ELEMENT_ARRAY_BUFFER),(j||n)&&(n=!1,m(G,J,x,H),P!==null&&t.bindBuffer(t.ELEMENT_ARRAY_BUFFER,A.get(P).buffer))}function a(){return t.createVertexArray()}function r(G){return t.bindVertexArray(G)}function s(G){return t.deleteVertexArray(G)}function B(G,J,x){const H=x.wireframe===!0;let P=i[G.id];P===void 0&&(P={},i[G.id]=P);let j=P[J.id];j===void 0&&(j={},P[J.id]=j);let q=j[H];return q===void 0&&(q=c(a()),j[H]=q),q}function c(G){const J=[],x=[],H=[];for(let P=0;P<e;P++)J[P]=0,x[P]=0,H[P]=0;return{geometry:null,program:null,wireframe:!1,newAttributes:J,enabledAttributes:x,attributeDivisors:H,object:G,attributes:{},index:null}}function E(G,J,x,H){const P=I.attributes,j=J.attributes;let q=0;const Y=x.getAttributes();for(const O in Y)if(Y[O].location>=0){const gA=P[O];let z=j[O];if(z===void 0&&(O==="instanceMatrix"&&G.instanceMatrix&&(z=G.instanceMatrix),O==="instanceColor"&&G.instanceColor&&(z=G.instanceColor)),gA===void 0||gA.attribute!==z||z&&gA.data!==z.data)return!0;q++}return I.attributesNum!==q||I.index!==H}function D(G,J,x,H){const P={},j=J.attributes;let q=0;const Y=x.getAttributes();for(const O in Y)if(Y[O].location>=0){let gA=j[O];gA===void 0&&(O==="instanceMatrix"&&G.instanceMatrix&&(gA=G.instanceMatrix),O==="instanceColor"&&G.instanceColor&&(gA=G.instanceColor));const z={};z.attribute=gA,gA&&gA.data&&(z.data=gA.data),P[O]=z,q++}I.attributes=P,I.attributesNum=q,I.index=H}function y(){const G=I.newAttributes;for(let J=0,x=G.length;J<x;J++)G[J]=0}function S(G){f(G,0)}function f(G,J){const x=I.newAttributes,H=I.enabledAttributes,P=I.attributeDivisors;x[G]=1,H[G]===0&&(t.enableVertexAttribArray(G),H[G]=1),P[G]!==J&&(t.vertexAttribDivisor(G,J),P[G]=J)}function M(){const G=I.newAttributes,J=I.enabledAttributes;for(let x=0,H=J.length;x<H;x++)J[x]!==G[x]&&(t.disableVertexAttribArray(x),J[x]=0)}function k(G,J,x,H,P,j,q){q===!0?t.vertexAttribIPointer(G,J,x,P,j):t.vertexAttribPointer(G,J,x,H,P,j)}function m(G,J,x,H){y();const P=H.attributes,j=x.getAttributes(),q=J.defaultAttributeValues;for(const Y in j){const O=j[Y];if(O.location>=0){let $=P[Y];if($===void 0&&(Y==="instanceMatrix"&&G.instanceMatrix&&($=G.instanceMatrix),Y==="instanceColor"&&G.instanceColor&&($=G.instanceColor)),$!==void 0){const gA=$.normalized,z=$.itemSize,X=A.get($);if(X===void 0)continue;const sA=X.buffer,rA=X.type,mA=X.bytesPerElement,IA=rA===t.INT||rA===t.UNSIGNED_INT||$.gpuType===_b;if($.isInterleavedBufferAttribute){const uA=$.data,KA=uA.stride,FA=$.offset;if(uA.isInstancedInterleavedBuffer){for(let RA=0;RA<O.locationSize;RA++)f(O.location+RA,uA.meshPerAttribute);G.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=uA.meshPerAttribute*uA.count)}else for(let RA=0;RA<O.locationSize;RA++)S(O.location+RA);t.bindBuffer(t.ARRAY_BUFFER,sA);for(let RA=0;RA<O.locationSize;RA++)k(O.location+RA,z/O.locationSize,rA,gA,KA*mA,(FA+z/O.locationSize*RA)*mA,IA)}else{if($.isInstancedBufferAttribute){for(let uA=0;uA<O.locationSize;uA++)f(O.location+uA,$.meshPerAttribute);G.isInstancedMesh!==!0&&H._maxInstanceCount===void 0&&(H._maxInstanceCount=$.meshPerAttribute*$.count)}else for(let uA=0;uA<O.locationSize;uA++)S(O.location+uA);t.bindBuffer(t.ARRAY_BUFFER,sA);for(let uA=0;uA<O.locationSize;uA++)k(O.location+uA,z/O.locationSize,rA,gA,z*mA,z/O.locationSize*uA*mA,IA)}}else if(q!==void 0){const gA=q[Y];if(gA!==void 0)switch(gA.length){case 2:t.vertexAttrib2fv(O.location,gA);break;case 3:t.vertexAttrib3fv(O.location,gA);break;case 4:t.vertexAttrib4fv(O.location,gA);break;default:t.vertexAttrib1fv(O.location,gA)}}}}M()}function U(){K();for(const G in i){const J=i[G];for(const x in J){const H=J[x];for(const P in H)s(H[P].object),delete H[P];delete J[x]}delete i[G]}}function F(G){if(i[G.id]===void 0)return;const J=i[G.id];for(const x in J){const H=J[x];for(const P in H)s(H[P].object),delete H[P];delete J[x]}delete i[G.id]}function b(G){for(const J in i){const x=i[J];if(x[G.id]===void 0)continue;const H=x[G.id];for(const P in H)s(H[P].object),delete H[P];delete x[G.id]}}function K(){R(),n=!0,I!==g&&(I=g,r(I.object))}function R(){g.geometry=null,g.program=null,g.wireframe=!1}return{setup:o,reset:K,resetDefaultState:R,dispose:U,releaseStatesOfGeometry:F,releaseStatesOfProgram:b,initAttributes:y,enableAttribute:S,disableUnusedAttributes:M}}function R4A(t,A,e){let i;function g(r){i=r}function I(r,s){t.drawArrays(i,r,s),e.update(s,i,1)}function n(r,s,B){B!==0&&(t.drawArraysInstanced(i,r,s,B),e.update(s,i,B))}function o(r,s,B){if(B===0)return;A.get("WEBGL_multi_draw").multiDrawArraysWEBGL(i,r,0,s,0,B);let E=0;for(let D=0;D<B;D++)E+=s[D];e.update(E,i,1)}function a(r,s,B,c){if(B===0)return;const E=A.get("WEBGL_multi_draw");if(E===null)for(let D=0;D<r.length;D++)n(r[D],s[D],c[D]);else{E.multiDrawArraysInstancedWEBGL(i,r,0,s,0,c,0,B);let D=0;for(let y=0;y<B;y++)D+=s[y]*c[y];e.update(D,i,1)}}this.setMode=g,this.render=I,this.renderInstances=n,this.renderMultiDraw=o,this.renderMultiDrawInstances=a}function U4A(t,A,e,i){let g;function I(){if(g!==void 0)return g;if(A.has("EXT_texture_filter_anisotropic")===!0){const b=A.get("EXT_texture_filter_anisotropic");g=t.getParameter(b.MAX_TEXTURE_MAX_ANISOTROPY_EXT)}else g=0;return g}function n(b){return!(b!==da&&i.convert(b)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_FORMAT))}function o(b){const K=b===Bp&&(A.has("EXT_color_buffer_half_float")||A.has("EXT_color_buffer_float"));return!(b!==QC&&i.convert(b)!==t.getParameter(t.IMPLEMENTATION_COLOR_READ_TYPE)&&b!==ir&&!K)}function a(b){if(b==="highp"){if(t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.HIGH_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.HIGH_FLOAT).precision>0)return"highp";b="mediump"}return b==="mediump"&&t.getShaderPrecisionFormat(t.VERTEX_SHADER,t.MEDIUM_FLOAT).precision>0&&t.getShaderPrecisionFormat(t.FRAGMENT_SHADER,t.MEDIUM_FLOAT).precision>0?"mediump":"lowp"}let r=e.precision!==void 0?e.precision:"highp";const s=a(r);s!==r&&(r=s);const B=e.logarithmicDepthBuffer===!0,c=e.reversedDepthBuffer===!0&&A.has("EXT_clip_control"),E=t.getParameter(t.MAX_TEXTURE_IMAGE_UNITS),D=t.getParameter(t.MAX_VERTEX_TEXTURE_IMAGE_UNITS),y=t.getParameter(t.MAX_TEXTURE_SIZE),S=t.getParameter(t.MAX_CUBE_MAP_TEXTURE_SIZE),f=t.getParameter(t.MAX_VERTEX_ATTRIBS),M=t.getParameter(t.MAX_VERTEX_UNIFORM_VECTORS),k=t.getParameter(t.MAX_VARYING_VECTORS),m=t.getParameter(t.MAX_FRAGMENT_UNIFORM_VECTORS),U=D>0,F=t.getParameter(t.MAX_SAMPLES);return{isWebGL2:!0,getMaxAnisotropy:I,getMaxPrecision:a,textureFormatReadable:n,textureTypeReadable:o,precision:r,logarithmicDepthBuffer:B,reversedDepthBuffer:c,maxTextures:E,maxVertexTextures:D,maxTextureSize:y,maxCubemapSize:S,maxAttributes:f,maxVertexUniforms:M,maxVaryings:k,maxFragmentUniforms:m,vertexTextures:U,maxSamples:F}}function K4A(t){const A=this;let e=null,i=0,g=!1,I=!1;const n=new mE,o=new Ni,a={value:null,needsUpdate:!1};this.uniform=a,this.numPlanes=0,this.numIntersection=0,this.init=function(B,c){const E=B.length!==0||c||i!==0||g;return g=c,i=B.length,E},this.beginShadows=function(){I=!0,s(null)},this.endShadows=function(){I=!1},this.setGlobalState=function(B,c){e=s(B,c,0)},this.setState=function(B,c,E){const D=B.clippingPlanes,y=B.clipIntersection,S=B.clipShadows,f=t.get(B);if(!g||D===null||D.length===0||I&&!S)I?s(null):r();else{const M=I?0:i,k=M*4;let m=f.clippingState||null;a.value=m,m=s(D,c,k,E);for(let U=0;U!==k;++U)m[U]=e[U];f.clippingState=m,this.numIntersection=y?this.numPlanes:0,this.numPlanes+=M}};function r(){a.value!==e&&(a.value=e,a.needsUpdate=i>0),A.numPlanes=i,A.numIntersection=0}function s(B,c,E,D){const y=B!==null?B.length:0;let S=null;if(y!==0){if(S=a.value,D!==!0||S===null){const f=E+y*4,M=c.matrixWorldInverse;o.getNormalMatrix(M),(S===null||S.length<f)&&(S=new Float32Array(f));for(let k=0,m=E;k!==y;++k,m+=4)n.copy(B[k]).applyMatrix4(M,o),n.normal.toArray(S,m),S[m+3]=n.constant}a.value=S,a.needsUpdate=!0}return A.numPlanes=y,A.numIntersection=0,S}}function F4A(t){let A=new WeakMap;function e(n,o){return o===L0?n.mapping=SQ:o===q0&&(n.mapping=ru),n}function i(n){if(n&&n.isTexture){const o=n.mapping;if(o===L0||o===q0)if(A.has(n)){const a=A.get(n).texture;return e(a,n.mapping)}else{const a=n.image;if(a&&a.height>0){const r=new wnA(a.height);return r.fromEquirectangularTexture(t,n),A.set(n,r),n.addEventListener("dispose",g),e(r.texture,n.mapping)}else return null}}return n}function g(n){const o=n.target;o.removeEventListener("dispose",g);const a=A.get(o);a!==void 0&&(A.delete(o),a.dispose())}function I(){A=new WeakMap}return{get:i,dispose:I}}const dD=4,OV=[.125,.215,.35,.446,.526,.582],pD=20,Gq=new IS,PV=new wt;let Rq=null,Uq=0,Kq=0,Fq=!1;const Hh=(1+Math.sqrt(5))/2,Hf=1/Hh,jV=[new wA(-Hh,Hf,0),new wA(Hh,Hf,0),new wA(-Hf,0,Hh),new wA(Hf,0,Hh),new wA(0,Hh,-Hf),new wA(0,Hh,Hf),new wA(-1,1,-1),new wA(1,1,-1),new wA(-1,1,1),new wA(1,1,1)],b4A=new wA;class _Y{constructor(A){this._renderer=A,this._pingPongRenderTarget=null,this._lodMax=0,this._cubeSize=0,this._lodPlanes=[],this._sizeLods=[],this._sigmas=[],this._blurMaterial=null,this._cubemapMaterial=null,this._equirectMaterial=null,this._compileMaterial(this._blurMaterial)}fromScene(A,e=0,i=.1,g=100,I={}){const{size:n=256,position:o=b4A}=I;Rq=this._renderer.getRenderTarget(),Uq=this._renderer.getActiveCubeFace(),Kq=this._renderer.getActiveMipmapLevel(),Fq=this._renderer.xr.enabled,this._renderer.xr.enabled=!1,this._setSize(n);const a=this._allocateTargets();return a.depthBuffer=!0,this._sceneToCubeUV(A,i,g,a,o),e>0&&this._blur(a,0,0,e),this._applyPMREM(a),this._cleanup(a),a}fromEquirectangular(A,e=null){return this._fromTexture(A,e)}fromCubemap(A,e=null){return this._fromTexture(A,e)}compileCubemapShader(){this._cubemapMaterial===null&&(this._cubemapMaterial=zV(),this._compileMaterial(this._cubemapMaterial))}compileEquirectangularShader(){this._equirectMaterial===null&&(this._equirectMaterial=WV(),this._compileMaterial(this._equirectMaterial))}dispose(){this._dispose(),this._cubemapMaterial!==null&&this._cubemapMaterial.dispose(),this._equirectMaterial!==null&&this._equirectMaterial.dispose()}_setSize(A){this._lodMax=Math.floor(Math.log2(A)),this._cubeSize=Math.pow(2,this._lodMax)}_dispose(){this._blurMaterial!==null&&this._blurMaterial.dispose(),this._pingPongRenderTarget!==null&&this._pingPongRenderTarget.dispose();for(let A=0;A<this._lodPlanes.length;A++)this._lodPlanes[A].dispose()}_cleanup(A){this._renderer.setRenderTarget(Rq,Uq,Kq),this._renderer.xr.enabled=Fq,A.scissorTest=!1,xG(A,0,0,A.width,A.height)}_fromTexture(A,e){A.mapping===SQ||A.mapping===ru?this._setSize(A.image.length===0?16:A.image[0].width||A.image[0].image.width):this._setSize(A.image.width/4),Rq=this._renderer.getRenderTarget(),Uq=this._renderer.getActiveCubeFace(),Kq=this._renderer.getActiveMipmapLevel(),Fq=this._renderer.xr.enabled,this._renderer.xr.enabled=!1;const i=e||this._allocateTargets();return this._textureToCubeUV(A,i),this._applyPMREM(i),this._cleanup(i),i}_allocateTargets(){const A=3*Math.max(this._cubeSize,112),e=4*this._cubeSize,i={magFilter:HI,minFilter:HI,generateMipmaps:!1,type:Bp,format:da,colorSpace:Cu,depthBuffer:!1},g=ZV(A,e,i);if(this._pingPongRenderTarget===null||this._pingPongRenderTarget.width!==A||this._pingPongRenderTarget.height!==e){this._pingPongRenderTarget!==null&&this._dispose(),this._pingPongRenderTarget=ZV(A,e,i);const{_lodMax:I}=this;({sizeLods:this._sizeLods,lodPlanes:this._lodPlanes,sigmas:this._sigmas}=v4A(I)),this._blurMaterial=_4A(I,A,e)}return g}_compileMaterial(A){const e=new Cn(this._lodPlanes[0],A);this._renderer.compile(e,Gq)}_sceneToCubeUV(A,e,i,g,I){const a=new jn(90,1,e,i),r=[1,-1,1,1,1,1],s=[1,1,1,-1,-1,-1],B=this._renderer,c=B.autoClear,E=B.toneMapping;B.getClearColor(PV),B.toneMapping=Tc,B.autoClear=!1,B.state.buffers.depth.getReversed()&&(B.setRenderTarget(g),B.clearDepth(),B.setRenderTarget(null));const y=new ls({name:"PMREM.Background",side:Ir,depthWrite:!1,depthTest:!1}),S=new Cn(new cp,y);let f=!1;const M=A.background;M?M.isColor&&(y.color.copy(M),A.background=null,f=!0):(y.color.copy(PV),f=!0);for(let k=0;k<6;k++){const m=k%3;m===0?(a.up.set(0,r[k],0),a.position.set(I.x,I.y,I.z),a.lookAt(I.x+s[k],I.y,I.z)):m===1?(a.up.set(0,0,r[k]),a.position.set(I.x,I.y,I.z),a.lookAt(I.x,I.y+s[k],I.z)):(a.up.set(0,r[k],0),a.position.set(I.x,I.y,I.z),a.lookAt(I.x,I.y,I.z+s[k]));const U=this._cubeSize;xG(g,m*U,k>2?U:0,U,U),B.setRenderTarget(g),f&&B.render(S,a),B.render(A,a)}S.geometry.dispose(),S.material.dispose(),B.toneMapping=E,B.autoClear=c,A.background=M}_textureToCubeUV(A,e){const i=this._renderer,g=A.mapping===SQ||A.mapping===ru;g?(this._cubemapMaterial===null&&(this._cubemapMaterial=zV()),this._cubemapMaterial.uniforms.flipEnvMap.value=A.isRenderTargetTexture===!1?-1:1):this._equirectMaterial===null&&(this._equirectMaterial=WV());const I=g?this._cubemapMaterial:this._equirectMaterial,n=new Cn(this._lodPlanes[0],I),o=I.uniforms;o.envMap.value=A;const a=this._cubeSize;xG(e,0,0,3*a,2*a),i.setRenderTarget(e),i.render(n,Gq)}_applyPMREM(A){const e=this._renderer,i=e.autoClear;e.autoClear=!1;const g=this._lodPlanes.length;for(let I=1;I<g;I++){const n=Math.sqrt(this._sigmas[I]*this._sigmas[I]-this._sigmas[I-1]*this._sigmas[I-1]),o=jV[(g-I-1)%jV.length];this._blur(A,I-1,I,n,o)}e.autoClear=i}_blur(A,e,i,g,I){const n=this._pingPongRenderTarget;this._halfBlur(A,n,e,i,g,"latitudinal",I),this._halfBlur(n,A,i,i,g,"longitudinal",I)}_halfBlur(A,e,i,g,I,n,o){const a=this._renderer,r=this._blurMaterial,s=3,B=new Cn(this._lodPlanes[g],r),c=r.uniforms,E=this._sizeLods[i]-1,D=isFinite(I)?Math.PI/(2*E):2*Math.PI/(2*pD-1),y=I/D,S=isFinite(I)?1+Math.floor(s*y):pD;S>pD;const f=[];let M=0;for(let b=0;b<pD;++b){const K=b/y,R=Math.exp(-K*K/2);f.push(R),b===0?M+=R:b<S&&(M+=2*R)}for(let b=0;b<f.length;b++)f[b]=f[b]/M;c.envMap.value=A.texture,c.samples.value=S,c.weights.value=f,c.latitudinal.value=n==="latitudinal",o&&(c.poleAxis.value=o);const{_lodMax:k}=this;c.dTheta.value=D,c.mipInt.value=k-i;const m=this._sizeLods[g],U=3*m*(g>k-dD?g-k+dD:0),F=4*(this._cubeSize-m);xG(e,U,F,3*m,2*m),a.setRenderTarget(e),a.render(B,Gq)}}function v4A(t){const A=[],e=[],i=[];let g=t;const I=t-dD+1+OV.length;for(let n=0;n<I;n++){const o=Math.pow(2,g);e.push(o);let a=1/o;n>t-dD?a=OV[n-t+dD-1]:n===0&&(a=0),i.push(a);const r=1/(o-2),s=-r,B=1+r,c=[s,s,B,s,B,B,s,s,B,B,s,B],E=6,D=6,y=3,S=2,f=1,M=new Float32Array(y*D*E),k=new Float32Array(S*D*E),m=new Float32Array(f*D*E);for(let F=0;F<E;F++){const b=F%3*2/3-1,K=F>2?0:-1,R=[b,K,0,b+2/3,K,0,b+2/3,K+1,0,b,K,0,b+2/3,K+1,0,b,K+1,0];M.set(R,y*D*F),k.set(c,S*D*F);const G=[F,F,F,F,F,F];m.set(G,f*D*F)}const U=new fi;U.setAttribute("position",new eg(M,y)),U.setAttribute("uv",new eg(k,S)),U.setAttribute("faceIndex",new eg(m,f)),A.push(U),g>dD&&g--}return{lodPlanes:A,sizeLods:e,sigmas:i}}function ZV(t,A,e){const i=new SB(t,A,e);return i.texture.mapping=AS,i.texture.name="PMREM.cubeUv",i.scissorTest=!0,i}function xG(t,A,e,i,g){t.viewport.set(A,e,i,g),t.scissor.set(A,e,i,g)}function _4A(t,A,e){const i=new Float32Array(pD),g=new wA(0,1,0);return new EC({name:"SphericalGaussianBlur",defines:{n:pD,CUBEUV_TEXEL_WIDTH:1/A,CUBEUV_TEXEL_HEIGHT:1/e,CUBEUV_MAX_MIP:`${t}.0`},uniforms:{envMap:{value:null},samples:{value:1},weights:{value:i},latitudinal:{value:!1},dTheta:{value:0},mipInt:{value:0},poleAxis:{value:g}},vertexShader:K1(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;
			uniform int samples;
			uniform float weights[ n ];
			uniform bool latitudinal;
			uniform float dTheta;
			uniform float mipInt;
			uniform vec3 poleAxis;

			#define ENVMAP_TYPE_CUBE_UV
			#include <cube_uv_reflection_fragment>

			vec3 getSample( float theta, vec3 axis ) {

				float cosTheta = cos( theta );
				// Rodrigues' axis-angle rotation
				vec3 sampleDirection = vOutputDirection * cosTheta
					+ cross( axis, vOutputDirection ) * sin( theta )
					+ axis * dot( axis, vOutputDirection ) * ( 1.0 - cosTheta );

				return bilinearCubeUV( envMap, sampleDirection, mipInt );

			}

			void main() {

				vec3 axis = latitudinal ? poleAxis : cross( poleAxis, vOutputDirection );

				if ( all( equal( axis, vec3( 0.0 ) ) ) ) {

					axis = vec3( vOutputDirection.z, 0.0, - vOutputDirection.x );

				}

				axis = normalize( axis );

				gl_FragColor = vec4( 0.0, 0.0, 0.0, 1.0 );
				gl_FragColor.rgb += weights[ 0 ] * getSample( 0.0, axis );

				for ( int i = 1; i < n; i++ ) {

					if ( i >= samples ) {

						break;

					}

					float theta = dTheta * float( i );
					gl_FragColor.rgb += weights[ i ] * getSample( -1.0 * theta, axis );
					gl_FragColor.rgb += weights[ i ] * getSample( theta, axis );

				}

			}
		`,blending:oQ,depthTest:!1,depthWrite:!1})}function WV(){return new EC({name:"EquirectangularToCubeUV",uniforms:{envMap:{value:null}},vertexShader:K1(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			varying vec3 vOutputDirection;

			uniform sampler2D envMap;

			#include <common>

			void main() {

				vec3 outputDirection = normalize( vOutputDirection );
				vec2 uv = equirectUv( outputDirection );

				gl_FragColor = vec4( texture2D ( envMap, uv ).rgb, 1.0 );

			}
		`,blending:oQ,depthTest:!1,depthWrite:!1})}function zV(){return new EC({name:"CubemapToCubeUV",uniforms:{envMap:{value:null},flipEnvMap:{value:-1}},vertexShader:K1(),fragmentShader:`

			precision mediump float;
			precision mediump int;

			uniform float flipEnvMap;

			varying vec3 vOutputDirection;

			uniform samplerCube envMap;

			void main() {

				gl_FragColor = textureCube( envMap, vec3( flipEnvMap * vOutputDirection.x, vOutputDirection.yz ) );

			}
		`,blending:oQ,depthTest:!1,depthWrite:!1})}function K1(){return`

		precision mediump float;
		precision mediump int;

		attribute float faceIndex;

		varying vec3 vOutputDirection;

		// RH coordinate system; PMREM face-indexing convention
		vec3 getDirection( vec2 uv, float face ) {

			uv = 2.0 * uv - 1.0;

			vec3 direction = vec3( uv, 1.0 );

			if ( face == 0.0 ) {

				direction = direction.zyx; // ( 1, v, u ) pos x

			} else if ( face == 1.0 ) {

				direction = direction.xzy;
				direction.xz *= -1.0; // ( -u, 1, -v ) pos y

			} else if ( face == 2.0 ) {

				direction.x *= -1.0; // ( -u, v, 1 ) pos z

			} else if ( face == 3.0 ) {

				direction = direction.zyx;
				direction.xz *= -1.0; // ( -1, v, -u ) neg x

			} else if ( face == 4.0 ) {

				direction = direction.xzy;
				direction.xy *= -1.0; // ( -u, -1, v ) neg y

			} else if ( face == 5.0 ) {

				direction.z *= -1.0; // ( u, v, -1 ) neg z

			}

			return direction;

		}

		void main() {

			vOutputDirection = getDirection( uv, faceIndex );
			gl_Position = vec4( position, 1.0 );

		}
	`}function J4A(t){let A=new WeakMap,e=null;function i(o){if(o&&o.isTexture){const a=o.mapping,r=a===L0||a===q0,s=a===SQ||a===ru;if(r||s){let B=A.get(o);const c=B!==void 0?B.texture.pmremVersion:0;if(o.isRenderTargetTexture&&o.pmremVersion!==c)return e===null&&(e=new _Y(t)),B=r?e.fromEquirectangular(o,B):e.fromCubemap(o,B),B.texture.pmremVersion=o.pmremVersion,A.set(o,B),B.texture;if(B!==void 0)return B.texture;{const E=o.image;return r&&E&&E.height>0||s&&E&&g(E)?(e===null&&(e=new _Y(t)),B=r?e.fromEquirectangular(o):e.fromCubemap(o),B.texture.pmremVersion=o.pmremVersion,A.set(o,B),o.addEventListener("dispose",I),B.texture):null}}}return o}function g(o){let a=0;const r=6;for(let s=0;s<r;s++)o[s]!==void 0&&a++;return a===r}function I(o){const a=o.target;a.removeEventListener("dispose",I);const r=A.get(a);r!==void 0&&(A.delete(a),r.dispose())}function n(){A=new WeakMap,e!==null&&(e.dispose(),e=null)}return{get:i,dispose:n}}function L4A(t){const A={};function e(i){if(A[i]!==void 0)return A[i];let g;switch(i){case"WEBGL_depth_texture":g=t.getExtension("WEBGL_depth_texture")||t.getExtension("MOZ_WEBGL_depth_texture")||t.getExtension("WEBKIT_WEBGL_depth_texture");break;case"EXT_texture_filter_anisotropic":g=t.getExtension("EXT_texture_filter_anisotropic")||t.getExtension("MOZ_EXT_texture_filter_anisotropic")||t.getExtension("WEBKIT_EXT_texture_filter_anisotropic");break;case"WEBGL_compressed_texture_s3tc":g=t.getExtension("WEBGL_compressed_texture_s3tc")||t.getExtension("MOZ_WEBGL_compressed_texture_s3tc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc");break;case"WEBGL_compressed_texture_pvrtc":g=t.getExtension("WEBGL_compressed_texture_pvrtc")||t.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc");break;default:g=t.getExtension(i)}return A[i]=g,g}return{has:function(i){return e(i)!==null},init:function(){e("EXT_color_buffer_float"),e("WEBGL_clip_cull_distance"),e("OES_texture_float_linear"),e("EXT_color_buffer_half_float"),e("WEBGL_multisampled_render_to_texture"),e("WEBGL_render_shared_exponent")},get:function(i){const g=e(i);return g===null&&O0("THREE.WebGLRenderer: "+i+" extension not supported."),g}}}function q4A(t,A,e,i){const g={},I=new WeakMap;function n(B){const c=B.target;c.index!==null&&A.remove(c.index);for(const D in c.attributes)A.remove(c.attributes[D]);c.removeEventListener("dispose",n),delete g[c.id];const E=I.get(c);E&&(A.remove(E),I.delete(c)),i.releaseStatesOfGeometry(c),c.isInstancedBufferGeometry===!0&&delete c._maxInstanceCount,e.memory.geometries--}function o(B,c){return g[c.id]===!0||(c.addEventListener("dispose",n),g[c.id]=!0,e.memory.geometries++),c}function a(B){const c=B.attributes;for(const E in c)A.update(c[E],t.ARRAY_BUFFER)}function r(B){const c=[],E=B.index,D=B.attributes.position;let y=0;if(E!==null){const M=E.array;y=E.version;for(let k=0,m=M.length;k<m;k+=3){const U=M[k+0],F=M[k+1],b=M[k+2];c.push(U,F,F,b,b,U)}}else if(D!==void 0){const M=D.array;y=D.version;for(let k=0,m=M.length/3-1;k<m;k+=3){const U=k+0,F=k+1,b=k+2;c.push(U,F,F,b,b,U)}}else return;const S=new(dnA(c)?t1:e1)(c,1);S.version=y;const f=I.get(B);f&&A.remove(f),I.set(B,S)}function s(B){const c=I.get(B);if(c){const E=B.index;E!==null&&c.version<E.version&&r(B)}else r(B);return I.get(B)}return{get:o,update:a,getWireframeAttribute:s}}function x4A(t,A,e){let i;function g(c){i=c}let I,n;function o(c){I=c.type,n=c.bytesPerElement}function a(c,E){t.drawElements(i,E,I,c*n),e.update(E,i,1)}function r(c,E,D){D!==0&&(t.drawElementsInstanced(i,E,I,c*n,D),e.update(E,i,D))}function s(c,E,D){if(D===0)return;A.get("WEBGL_multi_draw").multiDrawElementsWEBGL(i,E,0,I,c,0,D);let S=0;for(let f=0;f<D;f++)S+=E[f];e.update(S,i,1)}function B(c,E,D,y){if(D===0)return;const S=A.get("WEBGL_multi_draw");if(S===null)for(let f=0;f<c.length;f++)r(c[f]/n,E[f],y[f]);else{S.multiDrawElementsInstancedWEBGL(i,E,0,I,c,0,y,0,D);let f=0;for(let M=0;M<D;M++)f+=E[M]*y[M];e.update(f,i,1)}}this.setMode=g,this.setIndex=o,this.render=a,this.renderInstances=r,this.renderMultiDraw=s,this.renderMultiDrawInstances=B}function T4A(t){const A={geometries:0,textures:0},e={frame:0,calls:0,triangles:0,points:0,lines:0};function i(I,n,o){switch(e.calls++,n){case t.TRIANGLES:e.triangles+=o*(I/3);break;case t.LINES:e.lines+=o*(I/2);break;case t.LINE_STRIP:e.lines+=o*(I-1);break;case t.LINE_LOOP:e.lines+=o*I;break;case t.POINTS:e.points+=o*I;break;default:break}}function g(){e.calls=0,e.triangles=0,e.points=0,e.lines=0}return{memory:A,render:e,programs:null,autoReset:!0,reset:g,update:i}}function Y4A(t,A,e){const i=new WeakMap,g=new wg;function I(n,o,a){const r=n.morphTargetInfluences,s=o.morphAttributes.position||o.morphAttributes.normal||o.morphAttributes.color,B=s!==void 0?s.length:0;let c=i.get(o);if(c===void 0||c.count!==B){let R=function(){b.dispose(),i.delete(o),o.removeEventListener("dispose",R)};c!==void 0&&c.texture.dispose();const E=o.morphAttributes.position!==void 0,D=o.morphAttributes.normal!==void 0,y=o.morphAttributes.color!==void 0,S=o.morphAttributes.position||[],f=o.morphAttributes.normal||[],M=o.morphAttributes.color||[];let k=0;E===!0&&(k=1),D===!0&&(k=2),y===!0&&(k=3);let m=o.attributes.position.count*k,U=1;m>A.maxTextureSize&&(U=Math.ceil(m/A.maxTextureSize),m=A.maxTextureSize);const F=new Float32Array(m*U*4*B),b=new Hb(F,m,U,B);b.type=ir,b.needsUpdate=!0;const K=k*4;for(let G=0;G<B;G++){const J=S[G],x=f[G],H=M[G],P=m*U*4*G;for(let j=0;j<J.count;j++){const q=j*K;E===!0&&(g.fromBufferAttribute(J,j),F[P+q+0]=g.x,F[P+q+1]=g.y,F[P+q+2]=g.z,F[P+q+3]=0),D===!0&&(g.fromBufferAttribute(x,j),F[P+q+4]=g.x,F[P+q+5]=g.y,F[P+q+6]=g.z,F[P+q+7]=0),y===!0&&(g.fromBufferAttribute(H,j),F[P+q+8]=g.x,F[P+q+9]=g.y,F[P+q+10]=g.z,F[P+q+11]=H.itemSize===4?g.w:1)}}c={count:B,texture:b,size:new Ze(m,U)},i.set(o,c),o.addEventListener("dispose",R)}if(n.isInstancedMesh===!0&&n.morphTexture!==null)a.getUniforms().setValue(t,"morphTexture",n.morphTexture,e);else{let E=0;for(let y=0;y<r.length;y++)E+=r[y];const D=o.morphTargetsRelative?1:1-E;a.getUniforms().setValue(t,"morphTargetBaseInfluence",D),a.getUniforms().setValue(t,"morphTargetInfluences",r)}a.getUniforms().setValue(t,"morphTargetsTexture",c.texture,e),a.getUniforms().setValue(t,"morphTargetsTextureSize",c.size)}return{update:I}}function H4A(t,A,e,i){let g=new WeakMap;function I(a){const r=i.render.frame,s=a.geometry,B=A.get(a,s);if(g.get(B)!==r&&(A.update(B),g.set(B,r)),a.isInstancedMesh&&(a.hasEventListener("dispose",o)===!1&&a.addEventListener("dispose",o),g.get(a)!==r&&(e.update(a.instanceMatrix,t.ARRAY_BUFFER),a.instanceColor!==null&&e.update(a.instanceColor,t.ARRAY_BUFFER),g.set(a,r))),a.isSkinnedMesh){const c=a.skeleton;g.get(c)!==r&&(c.update(),g.set(c,r))}return B}function n(){g=new WeakMap}function o(a){const r=a.target;r.removeEventListener("dispose",o),e.remove(r.instanceMatrix),r.instanceColor!==null&&e.remove(r.instanceColor)}return{update:I,dispose:n}}const hoA=new FI,VV=new $b(1,1),doA=new Hb,poA=new Ob,foA=new Vk,XV=[],$V=[],A9=new Float32Array(16),e9=new Float32Array(9),t9=new Float32Array(4);function nS(t,A,e){const i=t[0];if(i<=0||i>0)return t;const g=A*e;let I=XV[g];if(I===void 0&&(I=new Float32Array(g),XV[g]=I),A!==0){i.toArray(I,0);for(let n=1,o=0;n!==A;++n)o+=e,t[n].toArray(I,o)}return I}function zn(t,A){if(t.length!==A.length)return!1;for(let e=0,i=t.length;e<i;e++)if(t[e]!==A[e])return!1;return!0}function Vn(t,A){for(let e=0,i=A.length;e<i;e++)t[e]=A[e]}function lv(t,A){let e=$V[A];e===void 0&&(e=new Int32Array(A),$V[A]=e);for(let i=0;i!==A;++i)e[i]=t.allocateTextureUnit();return e}function O4A(t,A){const e=this.cache;e[0]!==A&&(t.uniform1f(this.addr,A),e[0]=A)}function P4A(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(t.uniform2f(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(zn(e,A))return;t.uniform2fv(this.addr,A),Vn(e,A)}}function j4A(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(t.uniform3f(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else if(A.r!==void 0)(e[0]!==A.r||e[1]!==A.g||e[2]!==A.b)&&(t.uniform3f(this.addr,A.r,A.g,A.b),e[0]=A.r,e[1]=A.g,e[2]=A.b);else{if(zn(e,A))return;t.uniform3fv(this.addr,A),Vn(e,A)}}function Z4A(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(t.uniform4f(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(zn(e,A))return;t.uniform4fv(this.addr,A),Vn(e,A)}}function W4A(t,A){const e=this.cache,i=A.elements;if(i===void 0){if(zn(e,A))return;t.uniformMatrix2fv(this.addr,!1,A),Vn(e,A)}else{if(zn(e,i))return;t9.set(i),t.uniformMatrix2fv(this.addr,!1,t9),Vn(e,i)}}function z4A(t,A){const e=this.cache,i=A.elements;if(i===void 0){if(zn(e,A))return;t.uniformMatrix3fv(this.addr,!1,A),Vn(e,A)}else{if(zn(e,i))return;e9.set(i),t.uniformMatrix3fv(this.addr,!1,e9),Vn(e,i)}}function V4A(t,A){const e=this.cache,i=A.elements;if(i===void 0){if(zn(e,A))return;t.uniformMatrix4fv(this.addr,!1,A),Vn(e,A)}else{if(zn(e,i))return;A9.set(i),t.uniformMatrix4fv(this.addr,!1,A9),Vn(e,i)}}function X4A(t,A){const e=this.cache;e[0]!==A&&(t.uniform1i(this.addr,A),e[0]=A)}function $4A(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(t.uniform2i(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(zn(e,A))return;t.uniform2iv(this.addr,A),Vn(e,A)}}function AjA(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(t.uniform3i(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else{if(zn(e,A))return;t.uniform3iv(this.addr,A),Vn(e,A)}}function ejA(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(t.uniform4i(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(zn(e,A))return;t.uniform4iv(this.addr,A),Vn(e,A)}}function tjA(t,A){const e=this.cache;e[0]!==A&&(t.uniform1ui(this.addr,A),e[0]=A)}function ijA(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y)&&(t.uniform2ui(this.addr,A.x,A.y),e[0]=A.x,e[1]=A.y);else{if(zn(e,A))return;t.uniform2uiv(this.addr,A),Vn(e,A)}}function gjA(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z)&&(t.uniform3ui(this.addr,A.x,A.y,A.z),e[0]=A.x,e[1]=A.y,e[2]=A.z);else{if(zn(e,A))return;t.uniform3uiv(this.addr,A),Vn(e,A)}}function IjA(t,A){const e=this.cache;if(A.x!==void 0)(e[0]!==A.x||e[1]!==A.y||e[2]!==A.z||e[3]!==A.w)&&(t.uniform4ui(this.addr,A.x,A.y,A.z,A.w),e[0]=A.x,e[1]=A.y,e[2]=A.z,e[3]=A.w);else{if(zn(e,A))return;t.uniform4uiv(this.addr,A),Vn(e,A)}}function njA(t,A,e){const i=this.cache,g=e.allocateTextureUnit();i[0]!==g&&(t.uniform1i(this.addr,g),i[0]=g);let I;this.type===t.SAMPLER_2D_SHADOW?(VV.compareFunction=VP,I=VV):I=hoA,e.setTexture2D(A||I,g)}function ojA(t,A,e){const i=this.cache,g=e.allocateTextureUnit();i[0]!==g&&(t.uniform1i(this.addr,g),i[0]=g),e.setTexture3D(A||poA,g)}function ajA(t,A,e){const i=this.cache,g=e.allocateTextureUnit();i[0]!==g&&(t.uniform1i(this.addr,g),i[0]=g),e.setTextureCube(A||foA,g)}function rjA(t,A,e){const i=this.cache,g=e.allocateTextureUnit();i[0]!==g&&(t.uniform1i(this.addr,g),i[0]=g),e.setTexture2DArray(A||doA,g)}function sjA(t){switch(t){case 5126:return O4A;case 35664:return P4A;case 35665:return j4A;case 35666:return Z4A;case 35674:return W4A;case 35675:return z4A;case 35676:return V4A;case 5124:case 35670:return X4A;case 35667:case 35671:return $4A;case 35668:case 35672:return AjA;case 35669:case 35673:return ejA;case 5125:return tjA;case 36294:return ijA;case 36295:return gjA;case 36296:return IjA;case 35678:case 36198:case 36298:case 36306:case 35682:return njA;case 35679:case 36299:case 36307:return ojA;case 35680:case 36300:case 36308:case 36293:return ajA;case 36289:case 36303:case 36311:case 36292:return rjA}}function CjA(t,A){t.uniform1fv(this.addr,A)}function BjA(t,A){const e=nS(A,this.size,2);t.uniform2fv(this.addr,e)}function cjA(t,A){const e=nS(A,this.size,3);t.uniform3fv(this.addr,e)}function ljA(t,A){const e=nS(A,this.size,4);t.uniform4fv(this.addr,e)}function QjA(t,A){const e=nS(A,this.size,4);t.uniformMatrix2fv(this.addr,!1,e)}function EjA(t,A){const e=nS(A,this.size,9);t.uniformMatrix3fv(this.addr,!1,e)}function ujA(t,A){const e=nS(A,this.size,16);t.uniformMatrix4fv(this.addr,!1,e)}function hjA(t,A){t.uniform1iv(this.addr,A)}function djA(t,A){t.uniform2iv(this.addr,A)}function pjA(t,A){t.uniform3iv(this.addr,A)}function fjA(t,A){t.uniform4iv(this.addr,A)}function DjA(t,A){t.uniform1uiv(this.addr,A)}function yjA(t,A){t.uniform2uiv(this.addr,A)}function SjA(t,A){t.uniform3uiv(this.addr,A)}function wjA(t,A){t.uniform4uiv(this.addr,A)}function mjA(t,A,e){const i=this.cache,g=A.length,I=lv(e,g);zn(i,I)||(t.uniform1iv(this.addr,I),Vn(i,I));for(let n=0;n!==g;++n)e.setTexture2D(A[n]||hoA,I[n])}function kjA(t,A,e){const i=this.cache,g=A.length,I=lv(e,g);zn(i,I)||(t.uniform1iv(this.addr,I),Vn(i,I));for(let n=0;n!==g;++n)e.setTexture3D(A[n]||poA,I[n])}function MjA(t,A,e){const i=this.cache,g=A.length,I=lv(e,g);zn(i,I)||(t.uniform1iv(this.addr,I),Vn(i,I));for(let n=0;n!==g;++n)e.setTextureCube(A[n]||foA,I[n])}function NjA(t,A,e){const i=this.cache,g=A.length,I=lv(e,g);zn(i,I)||(t.uniform1iv(this.addr,I),Vn(i,I));for(let n=0;n!==g;++n)e.setTexture2DArray(A[n]||doA,I[n])}function GjA(t){switch(t){case 5126:return CjA;case 35664:return BjA;case 35665:return cjA;case 35666:return ljA;case 35674:return QjA;case 35675:return EjA;case 35676:return ujA;case 5124:case 35670:return hjA;case 35667:case 35671:return djA;case 35668:case 35672:return pjA;case 35669:case 35673:return fjA;case 5125:return DjA;case 36294:return yjA;case 36295:return SjA;case 36296:return wjA;case 35678:case 36198:case 36298:case 36306:case 35682:return mjA;case 35679:case 36299:case 36307:return kjA;case 35680:case 36300:case 36308:case 36293:return MjA;case 36289:case 36303:case 36311:case 36292:return NjA}}class RjA{constructor(A,e,i){this.id=A,this.addr=i,this.cache=[],this.type=e.type,this.setValue=sjA(e.type)}}class UjA{constructor(A,e,i){this.id=A,this.addr=i,this.cache=[],this.type=e.type,this.size=e.size,this.setValue=GjA(e.type)}}class KjA{constructor(A){this.id=A,this.seq=[],this.map={}}setValue(A,e,i){const g=this.seq;for(let I=0,n=g.length;I!==n;++I){const o=g[I];o.setValue(A,e[o.id],i)}}}const bq=/(\w+)(\])?(\[|\.)?/g;function i9(t,A){t.seq.push(A),t.map[A.id]=A}function FjA(t,A,e){const i=t.name,g=i.length;for(bq.lastIndex=0;;){const I=bq.exec(i),n=bq.lastIndex;let o=I[1];const a=I[2]==="]",r=I[3];if(a&&(o=o|0),r===void 0||r==="["&&n+2===g){i9(e,r===void 0?new RjA(o,t,A):new UjA(o,t,A));break}else{let B=e.map[o];B===void 0&&(B=new KjA(o),i9(e,B)),e=B}}}class VR{constructor(A,e){this.seq=[],this.map={};const i=A.getProgramParameter(e,A.ACTIVE_UNIFORMS);for(let g=0;g<i;++g){const I=A.getActiveUniform(e,g),n=A.getUniformLocation(e,I.name);FjA(I,n,this)}}setValue(A,e,i,g){const I=this.map[e];I!==void 0&&I.setValue(A,i,g)}setOptional(A,e,i){const g=e[i];g!==void 0&&this.setValue(A,i,g)}static upload(A,e,i,g){for(let I=0,n=e.length;I!==n;++I){const o=e[I],a=i[o.id];a.needsUpdate!==!1&&o.setValue(A,a.value,g)}}static seqWithValue(A,e){const i=[];for(let g=0,I=A.length;g!==I;++g){const n=A[g];n.id in e&&i.push(n)}return i}}function g9(t,A,e){const i=t.createShader(A);return t.shaderSource(i,e),t.compileShader(i),i}const bjA=37297;let vjA=0;function _jA(t,A){const e=t.split(`
`),i=[],g=Math.max(A-6,0),I=Math.min(A+6,e.length);for(let n=g;n<I;n++){const o=n+1;i.push(`${o===A?">":" "} ${o}: ${e[n]}`)}return i.join(`
`)}const I9=new Ni;function JjA(t){Qg._getMatrix(I9,Qg.workingColorSpace,t);const A=`mat3( ${I9.elements.map(e=>e.toFixed(4))} )`;switch(Qg.getTransfer(t)){case T0:return[A,"LinearTransferOETF"];case Vg:return[A,"sRGBTransferOETF"];default:return[A,"LinearTransferOETF"]}}function n9(t,A,e){const i=t.getShaderParameter(A,t.COMPILE_STATUS),I=(t.getShaderInfoLog(A)||"").trim();if(i&&I==="")return"";const n=/ERROR: 0:(\d+)/.exec(I);if(n){const o=parseInt(n[1]);return e.toUpperCase()+`

`+I+`

`+_jA(t.getShaderSource(A),o)}else return I}function LjA(t,A){const e=JjA(A);return[`vec4 ${t}( vec4 value ) {`,`	return ${e[1]}( vec4( value.rgb * ${e[0]}, value.a ) );`,"}"].join(`
`)}function qjA(t,A){let e;switch(A){case VIA:e="Linear";break;case XIA:e="Reinhard";break;case $IA:e="Cineon";break;case Wk:e="ACESFilmic";break;case enA:e="AgX";break;case tnA:e="Neutral";break;case AnA:e="Custom";break;default:e="Linear"}return"vec3 "+t+"( vec3 color ) { return "+e+"ToneMapping( color ); }"}const TG=new wA;function xjA(){Qg.getLuminanceCoefficients(TG);const t=TG.x.toFixed(4),A=TG.y.toFixed(4),e=TG.z.toFixed(4);return["float luminance( const in vec3 rgb ) {",`	const vec3 weights = vec3( ${t}, ${A}, ${e} );`,"	return dot( weights, rgb );","}"].join(`
`)}function TjA(t){return[t.extensionClipCullDistance?"#extension GL_ANGLE_clip_cull_distance : require":"",t.extensionMultiDraw?"#extension GL_ANGLE_multi_draw : require":""].filter(dm).join(`
`)}function YjA(t){const A=[];for(const e in t){const i=t[e];i!==!1&&A.push("#define "+e+" "+i)}return A.join(`
`)}function HjA(t,A){const e={},i=t.getProgramParameter(A,t.ACTIVE_ATTRIBUTES);for(let g=0;g<i;g++){const I=t.getActiveAttrib(A,g),n=I.name;let o=1;I.type===t.FLOAT_MAT2&&(o=2),I.type===t.FLOAT_MAT3&&(o=3),I.type===t.FLOAT_MAT4&&(o=4),e[n]={type:I.type,location:t.getAttribLocation(A,n),locationSize:o}}return e}function dm(t){return t!==""}function o9(t,A){const e=A.numSpotLightShadows+A.numSpotLightMaps-A.numSpotLightShadowsWithMaps;return t.replace(/NUM_DIR_LIGHTS/g,A.numDirLights).replace(/NUM_SPOT_LIGHTS/g,A.numSpotLights).replace(/NUM_SPOT_LIGHT_MAPS/g,A.numSpotLightMaps).replace(/NUM_SPOT_LIGHT_COORDS/g,e).replace(/NUM_RECT_AREA_LIGHTS/g,A.numRectAreaLights).replace(/NUM_POINT_LIGHTS/g,A.numPointLights).replace(/NUM_HEMI_LIGHTS/g,A.numHemiLights).replace(/NUM_DIR_LIGHT_SHADOWS/g,A.numDirLightShadows).replace(/NUM_SPOT_LIGHT_SHADOWS_WITH_MAPS/g,A.numSpotLightShadowsWithMaps).replace(/NUM_SPOT_LIGHT_SHADOWS/g,A.numSpotLightShadows).replace(/NUM_POINT_LIGHT_SHADOWS/g,A.numPointLightShadows)}function a9(t,A){return t.replace(/NUM_CLIPPING_PLANES/g,A.numClippingPlanes).replace(/UNION_CLIPPING_PLANES/g,A.numClippingPlanes-A.numClipIntersection)}const OjA=/^[ \t]*#include +<([\w\d./]+)>/gm;function JY(t){return t.replace(OjA,jjA)}const PjA=new Map;function jjA(t,A){let e=_i[A];if(e===void 0){const i=PjA.get(A);if(i!==void 0)e=_i[i];else throw new Error("Can not resolve #include <"+A+">")}return JY(e)}const ZjA=/#pragma unroll_loop_start\s+for\s*\(\s*int\s+i\s*=\s*(\d+)\s*;\s*i\s*<\s*(\d+)\s*;\s*i\s*\+\+\s*\)\s*{([\s\S]+?)}\s+#pragma unroll_loop_end/g;function r9(t){return t.replace(ZjA,WjA)}function WjA(t,A,e,i){let g="";for(let I=parseInt(A);I<parseInt(e);I++)g+=i.replace(/\[\s*i\s*\]/g,"[ "+I+" ]").replace(/UNROLLED_LOOP_INDEX/g,I);return g}function s9(t){let A=`precision ${t.precision} float;
	precision ${t.precision} int;
	precision ${t.precision} sampler2D;
	precision ${t.precision} samplerCube;
	precision ${t.precision} sampler3D;
	precision ${t.precision} sampler2DArray;
	precision ${t.precision} sampler2DShadow;
	precision ${t.precision} samplerCubeShadow;
	precision ${t.precision} sampler2DArrayShadow;
	precision ${t.precision} isampler2D;
	precision ${t.precision} isampler3D;
	precision ${t.precision} isamplerCube;
	precision ${t.precision} isampler2DArray;
	precision ${t.precision} usampler2D;
	precision ${t.precision} usampler3D;
	precision ${t.precision} usamplerCube;
	precision ${t.precision} usampler2DArray;
	`;return t.precision==="highp"?A+=`
#define HIGH_PRECISION`:t.precision==="mediump"?A+=`
#define MEDIUM_PRECISION`:t.precision==="lowp"&&(A+=`
#define LOW_PRECISION`),A}function zjA(t){let A="SHADOWMAP_TYPE_BASIC";return t.shadowMapType===Fb?A="SHADOWMAP_TYPE_PCF":t.shadowMapType===Pm?A="SHADOWMAP_TYPE_PCF_SOFT":t.shadowMapType===eB&&(A="SHADOWMAP_TYPE_VSM"),A}function VjA(t){let A="ENVMAP_TYPE_CUBE";if(t.envMap)switch(t.envMapMode){case SQ:case ru:A="ENVMAP_TYPE_CUBE";break;case AS:A="ENVMAP_TYPE_CUBE_UV";break}return A}function XjA(t){let A="ENVMAP_MODE_REFLECTION";if(t.envMap)switch(t.envMapMode){case ru:A="ENVMAP_MODE_REFRACTION";break}return A}function $jA(t){let A="ENVMAP_BLENDING_NONE";if(t.envMap)switch(t.combine){case Zk:A="ENVMAP_BLENDING_MULTIPLY";break;case WIA:A="ENVMAP_BLENDING_MIX";break;case zIA:A="ENVMAP_BLENDING_ADD";break}return A}function A8A(t){const A=t.envMapCubeUVHeight;if(A===null)return null;const e=Math.log2(A)-2,i=1/A;return{texelWidth:1/(3*Math.max(Math.pow(2,e),112)),texelHeight:i,maxMip:e}}function e8A(t,A,e,i){const g=t.getContext(),I=e.defines;let n=e.vertexShader,o=e.fragmentShader;const a=zjA(e),r=VjA(e),s=XjA(e),B=$jA(e),c=A8A(e),E=TjA(e),D=YjA(I),y=g.createProgram();let S,f,M=e.glslVersion?"#version "+e.glslVersion+`
`:"";e.isRawShaderMaterial?(S=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,D].filter(dm).join(`
`),S.length>0&&(S+=`
`),f=["#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,D].filter(dm).join(`
`),f.length>0&&(f+=`
`)):(S=[s9(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,D,e.extensionClipCullDistance?"#define USE_CLIP_DISTANCE":"",e.batching?"#define USE_BATCHING":"",e.batchingColor?"#define USE_BATCHING_COLOR":"",e.instancing?"#define USE_INSTANCING":"",e.instancingColor?"#define USE_INSTANCING_COLOR":"",e.instancingMorph?"#define USE_INSTANCING_MORPH":"",e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.map?"#define USE_MAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+s:"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.displacementMap?"#define USE_DISPLACEMENTMAP":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.mapUv?"#define MAP_UV "+e.mapUv:"",e.alphaMapUv?"#define ALPHAMAP_UV "+e.alphaMapUv:"",e.lightMapUv?"#define LIGHTMAP_UV "+e.lightMapUv:"",e.aoMapUv?"#define AOMAP_UV "+e.aoMapUv:"",e.emissiveMapUv?"#define EMISSIVEMAP_UV "+e.emissiveMapUv:"",e.bumpMapUv?"#define BUMPMAP_UV "+e.bumpMapUv:"",e.normalMapUv?"#define NORMALMAP_UV "+e.normalMapUv:"",e.displacementMapUv?"#define DISPLACEMENTMAP_UV "+e.displacementMapUv:"",e.metalnessMapUv?"#define METALNESSMAP_UV "+e.metalnessMapUv:"",e.roughnessMapUv?"#define ROUGHNESSMAP_UV "+e.roughnessMapUv:"",e.anisotropyMapUv?"#define ANISOTROPYMAP_UV "+e.anisotropyMapUv:"",e.clearcoatMapUv?"#define CLEARCOATMAP_UV "+e.clearcoatMapUv:"",e.clearcoatNormalMapUv?"#define CLEARCOAT_NORMALMAP_UV "+e.clearcoatNormalMapUv:"",e.clearcoatRoughnessMapUv?"#define CLEARCOAT_ROUGHNESSMAP_UV "+e.clearcoatRoughnessMapUv:"",e.iridescenceMapUv?"#define IRIDESCENCEMAP_UV "+e.iridescenceMapUv:"",e.iridescenceThicknessMapUv?"#define IRIDESCENCE_THICKNESSMAP_UV "+e.iridescenceThicknessMapUv:"",e.sheenColorMapUv?"#define SHEEN_COLORMAP_UV "+e.sheenColorMapUv:"",e.sheenRoughnessMapUv?"#define SHEEN_ROUGHNESSMAP_UV "+e.sheenRoughnessMapUv:"",e.specularMapUv?"#define SPECULARMAP_UV "+e.specularMapUv:"",e.specularColorMapUv?"#define SPECULAR_COLORMAP_UV "+e.specularColorMapUv:"",e.specularIntensityMapUv?"#define SPECULAR_INTENSITYMAP_UV "+e.specularIntensityMapUv:"",e.transmissionMapUv?"#define TRANSMISSIONMAP_UV "+e.transmissionMapUv:"",e.thicknessMapUv?"#define THICKNESSMAP_UV "+e.thicknessMapUv:"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.flatShading?"#define FLAT_SHADED":"",e.skinning?"#define USE_SKINNING":"",e.morphTargets?"#define USE_MORPHTARGETS":"",e.morphNormals&&e.flatShading===!1?"#define USE_MORPHNORMALS":"",e.morphColors?"#define USE_MORPHCOLORS":"",e.morphTargetsCount>0?"#define MORPHTARGETS_TEXTURE_STRIDE "+e.morphTextureStride:"",e.morphTargetsCount>0?"#define MORPHTARGETS_COUNT "+e.morphTargetsCount:"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+a:"",e.sizeAttenuation?"#define USE_SIZEATTENUATION":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 modelMatrix;","uniform mat4 modelViewMatrix;","uniform mat4 projectionMatrix;","uniform mat4 viewMatrix;","uniform mat3 normalMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;","#ifdef USE_INSTANCING","	attribute mat4 instanceMatrix;","#endif","#ifdef USE_INSTANCING_COLOR","	attribute vec3 instanceColor;","#endif","#ifdef USE_INSTANCING_MORPH","	uniform sampler2D morphTexture;","#endif","attribute vec3 position;","attribute vec3 normal;","attribute vec2 uv;","#ifdef USE_UV1","	attribute vec2 uv1;","#endif","#ifdef USE_UV2","	attribute vec2 uv2;","#endif","#ifdef USE_UV3","	attribute vec2 uv3;","#endif","#ifdef USE_TANGENT","	attribute vec4 tangent;","#endif","#if defined( USE_COLOR_ALPHA )","	attribute vec4 color;","#elif defined( USE_COLOR )","	attribute vec3 color;","#endif","#ifdef USE_SKINNING","	attribute vec4 skinIndex;","	attribute vec4 skinWeight;","#endif",`
`].filter(dm).join(`
`),f=[s9(e),"#define SHADER_TYPE "+e.shaderType,"#define SHADER_NAME "+e.shaderName,D,e.useFog&&e.fog?"#define USE_FOG":"",e.useFog&&e.fogExp2?"#define FOG_EXP2":"",e.alphaToCoverage?"#define ALPHA_TO_COVERAGE":"",e.map?"#define USE_MAP":"",e.matcap?"#define USE_MATCAP":"",e.envMap?"#define USE_ENVMAP":"",e.envMap?"#define "+r:"",e.envMap?"#define "+s:"",e.envMap?"#define "+B:"",c?"#define CUBEUV_TEXEL_WIDTH "+c.texelWidth:"",c?"#define CUBEUV_TEXEL_HEIGHT "+c.texelHeight:"",c?"#define CUBEUV_MAX_MIP "+c.maxMip+".0":"",e.lightMap?"#define USE_LIGHTMAP":"",e.aoMap?"#define USE_AOMAP":"",e.bumpMap?"#define USE_BUMPMAP":"",e.normalMap?"#define USE_NORMALMAP":"",e.normalMapObjectSpace?"#define USE_NORMALMAP_OBJECTSPACE":"",e.normalMapTangentSpace?"#define USE_NORMALMAP_TANGENTSPACE":"",e.emissiveMap?"#define USE_EMISSIVEMAP":"",e.anisotropy?"#define USE_ANISOTROPY":"",e.anisotropyMap?"#define USE_ANISOTROPYMAP":"",e.clearcoat?"#define USE_CLEARCOAT":"",e.clearcoatMap?"#define USE_CLEARCOATMAP":"",e.clearcoatRoughnessMap?"#define USE_CLEARCOAT_ROUGHNESSMAP":"",e.clearcoatNormalMap?"#define USE_CLEARCOAT_NORMALMAP":"",e.dispersion?"#define USE_DISPERSION":"",e.iridescence?"#define USE_IRIDESCENCE":"",e.iridescenceMap?"#define USE_IRIDESCENCEMAP":"",e.iridescenceThicknessMap?"#define USE_IRIDESCENCE_THICKNESSMAP":"",e.specularMap?"#define USE_SPECULARMAP":"",e.specularColorMap?"#define USE_SPECULAR_COLORMAP":"",e.specularIntensityMap?"#define USE_SPECULAR_INTENSITYMAP":"",e.roughnessMap?"#define USE_ROUGHNESSMAP":"",e.metalnessMap?"#define USE_METALNESSMAP":"",e.alphaMap?"#define USE_ALPHAMAP":"",e.alphaTest?"#define USE_ALPHATEST":"",e.alphaHash?"#define USE_ALPHAHASH":"",e.sheen?"#define USE_SHEEN":"",e.sheenColorMap?"#define USE_SHEEN_COLORMAP":"",e.sheenRoughnessMap?"#define USE_SHEEN_ROUGHNESSMAP":"",e.transmission?"#define USE_TRANSMISSION":"",e.transmissionMap?"#define USE_TRANSMISSIONMAP":"",e.thicknessMap?"#define USE_THICKNESSMAP":"",e.vertexTangents&&e.flatShading===!1?"#define USE_TANGENT":"",e.vertexColors||e.instancingColor||e.batchingColor?"#define USE_COLOR":"",e.vertexAlphas?"#define USE_COLOR_ALPHA":"",e.vertexUv1s?"#define USE_UV1":"",e.vertexUv2s?"#define USE_UV2":"",e.vertexUv3s?"#define USE_UV3":"",e.pointsUvs?"#define USE_POINTS_UV":"",e.gradientMap?"#define USE_GRADIENTMAP":"",e.flatShading?"#define FLAT_SHADED":"",e.doubleSided?"#define DOUBLE_SIDED":"",e.flipSided?"#define FLIP_SIDED":"",e.shadowMapEnabled?"#define USE_SHADOWMAP":"",e.shadowMapEnabled?"#define "+a:"",e.premultipliedAlpha?"#define PREMULTIPLIED_ALPHA":"",e.numLightProbes>0?"#define USE_LIGHT_PROBES":"",e.decodeVideoTexture?"#define DECODE_VIDEO_TEXTURE":"",e.decodeVideoTextureEmissive?"#define DECODE_VIDEO_TEXTURE_EMISSIVE":"",e.logarithmicDepthBuffer?"#define USE_LOGARITHMIC_DEPTH_BUFFER":"",e.reversedDepthBuffer?"#define USE_REVERSED_DEPTH_BUFFER":"","uniform mat4 viewMatrix;","uniform vec3 cameraPosition;","uniform bool isOrthographic;",e.toneMapping!==Tc?"#define TONE_MAPPING":"",e.toneMapping!==Tc?_i.tonemapping_pars_fragment:"",e.toneMapping!==Tc?qjA("toneMapping",e.toneMapping):"",e.dithering?"#define DITHERING":"",e.opaque?"#define OPAQUE":"",_i.colorspace_pars_fragment,LjA("linearToOutputTexel",e.outputColorSpace),xjA(),e.useDepthPacking?"#define DEPTH_PACKING "+e.depthPacking:"",`
`].filter(dm).join(`
`)),n=JY(n),n=o9(n,e),n=a9(n,e),o=JY(o),o=o9(o,e),o=a9(o,e),n=r9(n),o=r9(o),e.isRawShaderMaterial!==!0&&(M=`#version 300 es
`,S=[E,"#define attribute in","#define varying out","#define texture2D texture"].join(`
`)+`
`+S,f=["#define varying in",e.glslVersion===GY?"":"layout(location = 0) out highp vec4 pc_fragColor;",e.glslVersion===GY?"":"#define gl_FragColor pc_fragColor","#define gl_FragDepthEXT gl_FragDepth","#define texture2D texture","#define textureCube texture","#define texture2DProj textureProj","#define texture2DLodEXT textureLod","#define texture2DProjLodEXT textureProjLod","#define textureCubeLodEXT textureLod","#define texture2DGradEXT textureGrad","#define texture2DProjGradEXT textureProjGrad","#define textureCubeGradEXT textureGrad"].join(`
`)+`
`+f);const k=M+S+n,m=M+f+o,U=g9(g,g.VERTEX_SHADER,k),F=g9(g,g.FRAGMENT_SHADER,m);g.attachShader(y,U),g.attachShader(y,F),e.index0AttributeName!==void 0?g.bindAttribLocation(y,0,e.index0AttributeName):e.morphTargets===!0&&g.bindAttribLocation(y,0,"position"),g.linkProgram(y);function b(J){if(t.debug.checkShaderErrors){const x=g.getProgramInfoLog(y)||"",H=g.getShaderInfoLog(U)||"",P=g.getShaderInfoLog(F)||"",j=x.trim(),q=H.trim(),Y=P.trim();let O=!0,$=!0;if(g.getProgramParameter(y,g.LINK_STATUS)===!1)if(O=!1,typeof t.debug.onShaderError=="function")t.debug.onShaderError(g,y,U,F);else{const gA=n9(g,U,"vertex"),z=n9(g,F,"fragment")}else j!==""||(q===""||Y==="")&&($=!1);$&&(J.diagnostics={runnable:O,programLog:j,vertexShader:{log:q,prefix:S},fragmentShader:{log:Y,prefix:f}})}g.deleteShader(U),g.deleteShader(F),K=new VR(g,y),R=HjA(g,y)}let K;this.getUniforms=function(){return K===void 0&&b(this),K};let R;this.getAttributes=function(){return R===void 0&&b(this),R};let G=e.rendererExtensionParallelShaderCompile===!1;return this.isReady=function(){return G===!1&&(G=g.getProgramParameter(y,bjA)),G},this.destroy=function(){i.releaseStatesOfProgram(this),g.deleteProgram(y),this.program=void 0},this.type=e.shaderType,this.name=e.shaderName,this.id=vjA++,this.cacheKey=A,this.usedTimes=1,this.program=y,this.vertexShader=U,this.fragmentShader=F,this}let t8A=0;class i8A{constructor(){this.shaderCache=new Map,this.materialCache=new Map}update(A){const e=A.vertexShader,i=A.fragmentShader,g=this._getShaderStage(e),I=this._getShaderStage(i),n=this._getShaderCacheForMaterial(A);return n.has(g)===!1&&(n.add(g),g.usedTimes++),n.has(I)===!1&&(n.add(I),I.usedTimes++),this}remove(A){const e=this.materialCache.get(A);for(const i of e)i.usedTimes--,i.usedTimes===0&&this.shaderCache.delete(i.code);return this.materialCache.delete(A),this}getVertexShaderID(A){return this._getShaderStage(A.vertexShader).id}getFragmentShaderID(A){return this._getShaderStage(A.fragmentShader).id}dispose(){this.shaderCache.clear(),this.materialCache.clear()}_getShaderCacheForMaterial(A){const e=this.materialCache;let i=e.get(A);return i===void 0&&(i=new Set,e.set(A,i)),i}_getShaderStage(A){const e=this.shaderCache;let i=e.get(A);return i===void 0&&(i=new g8A(A),e.set(A,i)),i}}class g8A{constructor(A){this.id=t8A++,this.code=A,this.usedTimes=0}}function I8A(t,A,e,i,g,I,n){const o=new fy,a=new i8A,r=new Set,s=[],B=g.logarithmicDepthBuffer,c=g.vertexTextures;let E=g.precision;const D={MeshDepthMaterial:"depth",MeshDistanceMaterial:"distanceRGBA",MeshNormalMaterial:"normal",MeshBasicMaterial:"basic",MeshLambertMaterial:"lambert",MeshPhongMaterial:"phong",MeshToonMaterial:"toon",MeshStandardMaterial:"physical",MeshPhysicalMaterial:"physical",MeshMatcapMaterial:"matcap",LineBasicMaterial:"basic",LineDashedMaterial:"dashed",PointsMaterial:"points",ShadowMaterial:"shadow",SpriteMaterial:"sprite"};function y(R){return r.add(R),R===0?"uv":`uv${R}`}function S(R,G,J,x,H){const P=x.fog,j=H.geometry,q=R.isMeshStandardMaterial?x.environment:null,Y=(R.isMeshStandardMaterial?e:A).get(R.envMap||q),O=Y&&Y.mapping===AS?Y.image.height:null,$=D[R.type];R.precision!==null&&(E=g.getMaxPrecision(R.precision),R.precision);const gA=j.morphAttributes.position||j.morphAttributes.normal||j.morphAttributes.color,z=gA!==void 0?gA.length:0;let X=0;j.morphAttributes.position!==void 0&&(X=1),j.morphAttributes.normal!==void 0&&(X=2),j.morphAttributes.color!==void 0&&(X=3);let sA,rA,mA,IA;if($){const be=nB[$];sA=be.vertexShader,rA=be.fragmentShader}else sA=R.vertexShader,rA=R.fragmentShader,a.update(R),mA=a.getVertexShaderID(R),IA=a.getFragmentShaderID(R);const uA=t.getRenderTarget(),KA=t.state.buffers.depth.getReversed(),FA=H.isInstancedMesh===!0,RA=H.isBatchedMesh===!0,MA=!!R.map,oA=!!R.matcap,AA=!!Y,tA=!!R.aoMap,iA=!!R.lightMap,hA=!!R.bumpMap,DA=!!R.normalMap,dA=!!R.displacementMap,SA=!!R.emissiveMap,NA=!!R.metalnessMap,OA=!!R.roughnessMap,Qe=R.anisotropy>0,nA=R.clearcoat>0,eA=R.dispersion>0,UA=R.iridescence>0,HA=R.sheen>0,Se=R.transmission>0,ne=Qe&&!!R.anisotropyMap,Oe=nA&&!!R.clearcoatMap,VA=nA&&!!R.clearcoatNormalMap,de=nA&&!!R.clearcoatRoughnessMap,te=UA&&!!R.iridescenceMap,WA=UA&&!!R.iridescenceThicknessMap,_A=HA&&!!R.sheenColorMap,zA=HA&&!!R.sheenRoughnessMap,ge=!!R.specularMap,he=!!R.specularColorMap,ve=!!R.specularIntensityMap,bA=Se&&!!R.transmissionMap,pA=Se&&!!R.thicknessMap,Re=!!R.gradientMap,CA=!!R.alphaMap,EA=R.alphaTest>0,yA=!!R.alphaHash,xA=!!R.extensions;let XA=Tc;R.toneMapped&&(uA===null||uA.isXRRenderTarget===!0)&&(XA=t.toneMapping);const pe={shaderID:$,shaderType:R.type,shaderName:R.name,vertexShader:sA,fragmentShader:rA,defines:R.defines,customVertexShaderID:mA,customFragmentShaderID:IA,isRawShaderMaterial:R.isRawShaderMaterial===!0,glslVersion:R.glslVersion,precision:E,batching:RA,batchingColor:RA&&H._colorsTexture!==null,instancing:FA,instancingColor:FA&&H.instanceColor!==null,instancingMorph:FA&&H.morphTexture!==null,supportsVertexTextures:c,outputColorSpace:uA===null?t.outputColorSpace:uA.isXRRenderTarget===!0?uA.texture.colorSpace:Cu,alphaToCoverage:!!R.alphaToCoverage,map:MA,matcap:oA,envMap:AA,envMapMode:AA&&Y.mapping,envMapCubeUVHeight:O,aoMap:tA,lightMap:iA,bumpMap:hA,normalMap:DA,displacementMap:c&&dA,emissiveMap:SA,normalMapObjectSpace:DA&&R.normalMapType===snA,normalMapTangentSpace:DA&&R.normalMapType===wu,metalnessMap:NA,roughnessMap:OA,anisotropy:Qe,anisotropyMap:ne,clearcoat:nA,clearcoatMap:Oe,clearcoatNormalMap:VA,clearcoatRoughnessMap:de,dispersion:eA,iridescence:UA,iridescenceMap:te,iridescenceThicknessMap:WA,sheen:HA,sheenColorMap:_A,sheenRoughnessMap:zA,specularMap:ge,specularColorMap:he,specularIntensityMap:ve,transmission:Se,transmissionMap:bA,thicknessMap:pA,gradientMap:Re,opaque:R.transparent===!1&&R.blending===Qd&&R.alphaToCoverage===!1,alphaMap:CA,alphaTest:EA,alphaHash:yA,combine:R.combine,mapUv:MA&&y(R.map.channel),aoMapUv:tA&&y(R.aoMap.channel),lightMapUv:iA&&y(R.lightMap.channel),bumpMapUv:hA&&y(R.bumpMap.channel),normalMapUv:DA&&y(R.normalMap.channel),displacementMapUv:dA&&y(R.displacementMap.channel),emissiveMapUv:SA&&y(R.emissiveMap.channel),metalnessMapUv:NA&&y(R.metalnessMap.channel),roughnessMapUv:OA&&y(R.roughnessMap.channel),anisotropyMapUv:ne&&y(R.anisotropyMap.channel),clearcoatMapUv:Oe&&y(R.clearcoatMap.channel),clearcoatNormalMapUv:VA&&y(R.clearcoatNormalMap.channel),clearcoatRoughnessMapUv:de&&y(R.clearcoatRoughnessMap.channel),iridescenceMapUv:te&&y(R.iridescenceMap.channel),iridescenceThicknessMapUv:WA&&y(R.iridescenceThicknessMap.channel),sheenColorMapUv:_A&&y(R.sheenColorMap.channel),sheenRoughnessMapUv:zA&&y(R.sheenRoughnessMap.channel),specularMapUv:ge&&y(R.specularMap.channel),specularColorMapUv:he&&y(R.specularColorMap.channel),specularIntensityMapUv:ve&&y(R.specularIntensityMap.channel),transmissionMapUv:bA&&y(R.transmissionMap.channel),thicknessMapUv:pA&&y(R.thicknessMap.channel),alphaMapUv:CA&&y(R.alphaMap.channel),vertexTangents:!!j.attributes.tangent&&(DA||Qe),vertexColors:R.vertexColors,vertexAlphas:R.vertexColors===!0&&!!j.attributes.color&&j.attributes.color.itemSize===4,pointsUvs:H.isPoints===!0&&!!j.attributes.uv&&(MA||CA),fog:!!P,useFog:R.fog===!0,fogExp2:!!P&&P.isFogExp2,flatShading:R.flatShading===!0&&R.wireframe===!1,sizeAttenuation:R.sizeAttenuation===!0,logarithmicDepthBuffer:B,reversedDepthBuffer:KA,skinning:H.isSkinnedMesh===!0,morphTargets:j.morphAttributes.position!==void 0,morphNormals:j.morphAttributes.normal!==void 0,morphColors:j.morphAttributes.color!==void 0,morphTargetsCount:z,morphTextureStride:X,numDirLights:G.directional.length,numPointLights:G.point.length,numSpotLights:G.spot.length,numSpotLightMaps:G.spotLightMap.length,numRectAreaLights:G.rectArea.length,numHemiLights:G.hemi.length,numDirLightShadows:G.directionalShadowMap.length,numPointLightShadows:G.pointShadowMap.length,numSpotLightShadows:G.spotShadowMap.length,numSpotLightShadowsWithMaps:G.numSpotLightShadowsWithMaps,numLightProbes:G.numLightProbes,numClippingPlanes:n.numPlanes,numClipIntersection:n.numIntersection,dithering:R.dithering,shadowMapEnabled:t.shadowMap.enabled&&J.length>0,shadowMapType:t.shadowMap.type,toneMapping:XA,decodeVideoTexture:MA&&R.map.isVideoTexture===!0&&Qg.getTransfer(R.map.colorSpace)===Vg,decodeVideoTextureEmissive:SA&&R.emissiveMap.isVideoTexture===!0&&Qg.getTransfer(R.emissiveMap.colorSpace)===Vg,premultipliedAlpha:R.premultipliedAlpha,doubleSided:R.side===sB,flipSided:R.side===Ir,useDepthPacking:R.depthPacking>=0,depthPacking:R.depthPacking||0,index0AttributeName:R.index0AttributeName,extensionClipCullDistance:xA&&R.extensions.clipCullDistance===!0&&i.has("WEBGL_clip_cull_distance"),extensionMultiDraw:(xA&&R.extensions.multiDraw===!0||RA)&&i.has("WEBGL_multi_draw"),rendererExtensionParallelShaderCompile:i.has("KHR_parallel_shader_compile"),customProgramCacheKey:R.customProgramCacheKey()};return pe.vertexUv1s=r.has(1),pe.vertexUv2s=r.has(2),pe.vertexUv3s=r.has(3),r.clear(),pe}function f(R){const G=[];if(R.shaderID?G.push(R.shaderID):(G.push(R.customVertexShaderID),G.push(R.customFragmentShaderID)),R.defines!==void 0)for(const J in R.defines)G.push(J),G.push(R.defines[J]);return R.isRawShaderMaterial===!1&&(M(G,R),k(G,R),G.push(t.outputColorSpace)),G.push(R.customProgramCacheKey),G.join()}function M(R,G){R.push(G.precision),R.push(G.outputColorSpace),R.push(G.envMapMode),R.push(G.envMapCubeUVHeight),R.push(G.mapUv),R.push(G.alphaMapUv),R.push(G.lightMapUv),R.push(G.aoMapUv),R.push(G.bumpMapUv),R.push(G.normalMapUv),R.push(G.displacementMapUv),R.push(G.emissiveMapUv),R.push(G.metalnessMapUv),R.push(G.roughnessMapUv),R.push(G.anisotropyMapUv),R.push(G.clearcoatMapUv),R.push(G.clearcoatNormalMapUv),R.push(G.clearcoatRoughnessMapUv),R.push(G.iridescenceMapUv),R.push(G.iridescenceThicknessMapUv),R.push(G.sheenColorMapUv),R.push(G.sheenRoughnessMapUv),R.push(G.specularMapUv),R.push(G.specularColorMapUv),R.push(G.specularIntensityMapUv),R.push(G.transmissionMapUv),R.push(G.thicknessMapUv),R.push(G.combine),R.push(G.fogExp2),R.push(G.sizeAttenuation),R.push(G.morphTargetsCount),R.push(G.morphAttributeCount),R.push(G.numDirLights),R.push(G.numPointLights),R.push(G.numSpotLights),R.push(G.numSpotLightMaps),R.push(G.numHemiLights),R.push(G.numRectAreaLights),R.push(G.numDirLightShadows),R.push(G.numPointLightShadows),R.push(G.numSpotLightShadows),R.push(G.numSpotLightShadowsWithMaps),R.push(G.numLightProbes),R.push(G.shadowMapType),R.push(G.toneMapping),R.push(G.numClippingPlanes),R.push(G.numClipIntersection),R.push(G.depthPacking)}function k(R,G){o.disableAll(),G.supportsVertexTextures&&o.enable(0),G.instancing&&o.enable(1),G.instancingColor&&o.enable(2),G.instancingMorph&&o.enable(3),G.matcap&&o.enable(4),G.envMap&&o.enable(5),G.normalMapObjectSpace&&o.enable(6),G.normalMapTangentSpace&&o.enable(7),G.clearcoat&&o.enable(8),G.iridescence&&o.enable(9),G.alphaTest&&o.enable(10),G.vertexColors&&o.enable(11),G.vertexAlphas&&o.enable(12),G.vertexUv1s&&o.enable(13),G.vertexUv2s&&o.enable(14),G.vertexUv3s&&o.enable(15),G.vertexTangents&&o.enable(16),G.anisotropy&&o.enable(17),G.alphaHash&&o.enable(18),G.batching&&o.enable(19),G.dispersion&&o.enable(20),G.batchingColor&&o.enable(21),G.gradientMap&&o.enable(22),R.push(o.mask),o.disableAll(),G.fog&&o.enable(0),G.useFog&&o.enable(1),G.flatShading&&o.enable(2),G.logarithmicDepthBuffer&&o.enable(3),G.reversedDepthBuffer&&o.enable(4),G.skinning&&o.enable(5),G.morphTargets&&o.enable(6),G.morphNormals&&o.enable(7),G.morphColors&&o.enable(8),G.premultipliedAlpha&&o.enable(9),G.shadowMapEnabled&&o.enable(10),G.doubleSided&&o.enable(11),G.flipSided&&o.enable(12),G.useDepthPacking&&o.enable(13),G.dithering&&o.enable(14),G.transmission&&o.enable(15),G.sheen&&o.enable(16),G.opaque&&o.enable(17),G.pointsUvs&&o.enable(18),G.decodeVideoTexture&&o.enable(19),G.decodeVideoTextureEmissive&&o.enable(20),G.alphaToCoverage&&o.enable(21),R.push(o.mask)}function m(R){const G=D[R.type];let J;if(G){const x=nB[G];J=i1.clone(x.uniforms)}else J=R.uniforms;return J}function U(R,G){let J;for(let x=0,H=s.length;x<H;x++){const P=s[x];if(P.cacheKey===G){J=P,++J.usedTimes;break}}return J===void 0&&(J=new e8A(t,G,R,I),s.push(J)),J}function F(R){if(--R.usedTimes===0){const G=s.indexOf(R);s[G]=s[s.length-1],s.pop(),R.destroy()}}function b(R){a.remove(R)}function K(){a.dispose()}return{getParameters:S,getProgramCacheKey:f,getUniforms:m,acquireProgram:U,releaseProgram:F,releaseShaderCache:b,programs:s,dispose:K}}function n8A(){let t=new WeakMap;function A(n){return t.has(n)}function e(n){let o=t.get(n);return o===void 0&&(o={},t.set(n,o)),o}function i(n){t.delete(n)}function g(n,o,a){t.get(n)[o]=a}function I(){t=new WeakMap}return{has:A,get:e,remove:i,update:g,dispose:I}}function o8A(t,A){return t.groupOrder!==A.groupOrder?t.groupOrder-A.groupOrder:t.renderOrder!==A.renderOrder?t.renderOrder-A.renderOrder:t.material.id!==A.material.id?t.material.id-A.material.id:t.z!==A.z?t.z-A.z:t.id-A.id}function C9(t,A){return t.groupOrder!==A.groupOrder?t.groupOrder-A.groupOrder:t.renderOrder!==A.renderOrder?t.renderOrder-A.renderOrder:t.z!==A.z?A.z-t.z:t.id-A.id}function B9(){const t=[];let A=0;const e=[],i=[],g=[];function I(){A=0,e.length=0,i.length=0,g.length=0}function n(B,c,E,D,y,S){let f=t[A];return f===void 0?(f={id:B.id,object:B,geometry:c,material:E,groupOrder:D,renderOrder:B.renderOrder,z:y,group:S},t[A]=f):(f.id=B.id,f.object=B,f.geometry=c,f.material=E,f.groupOrder=D,f.renderOrder=B.renderOrder,f.z=y,f.group=S),A++,f}function o(B,c,E,D,y,S){const f=n(B,c,E,D,y,S);E.transmission>0?i.push(f):E.transparent===!0?g.push(f):e.push(f)}function a(B,c,E,D,y,S){const f=n(B,c,E,D,y,S);E.transmission>0?i.unshift(f):E.transparent===!0?g.unshift(f):e.unshift(f)}function r(B,c){e.length>1&&e.sort(B||o8A),i.length>1&&i.sort(c||C9),g.length>1&&g.sort(c||C9)}function s(){for(let B=A,c=t.length;B<c;B++){const E=t[B];if(E.id===null)break;E.id=null,E.object=null,E.geometry=null,E.material=null,E.group=null}}return{opaque:e,transmissive:i,transparent:g,init:I,push:o,unshift:a,finish:s,sort:r}}function a8A(){let t=new WeakMap;function A(i,g){const I=t.get(i);let n;return I===void 0?(n=new B9,t.set(i,[n])):g>=I.length?(n=new B9,I.push(n)):n=I[g],n}function e(){t=new WeakMap}return{get:A,dispose:e}}function r8A(){const t={};return{get:function(A){if(t[A.id]!==void 0)return t[A.id];let e;switch(A.type){case"DirectionalLight":e={direction:new wA,color:new wt};break;case"SpotLight":e={position:new wA,direction:new wA,color:new wt,distance:0,coneCos:0,penumbraCos:0,decay:0};break;case"PointLight":e={position:new wA,color:new wt,distance:0,decay:0};break;case"HemisphereLight":e={direction:new wA,skyColor:new wt,groundColor:new wt};break;case"RectAreaLight":e={color:new wt,position:new wA,halfWidth:new wA,halfHeight:new wA};break}return t[A.id]=e,e}}}function s8A(){const t={};return{get:function(A){if(t[A.id]!==void 0)return t[A.id];let e;switch(A.type){case"DirectionalLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"SpotLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze};break;case"PointLight":e={shadowIntensity:1,shadowBias:0,shadowNormalBias:0,shadowRadius:1,shadowMapSize:new Ze,shadowCameraNear:1,shadowCameraFar:1e3};break}return t[A.id]=e,e}}}let C8A=0;function B8A(t,A){return(A.castShadow?2:0)-(t.castShadow?2:0)+(A.map?1:0)-(t.map?1:0)}function c8A(t){const A=new r8A,e=s8A(),i={version:0,hash:{directionalLength:-1,pointLength:-1,spotLength:-1,rectAreaLength:-1,hemiLength:-1,numDirectionalShadows:-1,numPointShadows:-1,numSpotShadows:-1,numSpotMaps:-1,numLightProbes:-1},ambient:[0,0,0],probe:[],directional:[],directionalShadow:[],directionalShadowMap:[],directionalShadowMatrix:[],spot:[],spotLightMap:[],spotShadow:[],spotShadowMap:[],spotLightMatrix:[],rectArea:[],rectAreaLTC1:null,rectAreaLTC2:null,point:[],pointShadow:[],pointShadowMap:[],pointShadowMatrix:[],hemi:[],numSpotLightShadowsWithMaps:0,numLightProbes:0};for(let r=0;r<9;r++)i.probe.push(new wA);const g=new wA,I=new Ai,n=new Ai;function o(r){let s=0,B=0,c=0;for(let R=0;R<9;R++)i.probe[R].set(0,0,0);let E=0,D=0,y=0,S=0,f=0,M=0,k=0,m=0,U=0,F=0,b=0;r.sort(B8A);for(let R=0,G=r.length;R<G;R++){const J=r[R],x=J.color,H=J.intensity,P=J.distance,j=J.shadow&&J.shadow.map?J.shadow.map.texture:null;if(J.isAmbientLight)s+=x.r*H,B+=x.g*H,c+=x.b*H;else if(J.isLightProbe){for(let q=0;q<9;q++)i.probe[q].addScaledVector(J.sh.coefficients[q],H);b++}else if(J.isDirectionalLight){const q=A.get(J);if(q.color.copy(J.color).multiplyScalar(J.intensity),J.castShadow){const Y=J.shadow,O=e.get(J);O.shadowIntensity=Y.intensity,O.shadowBias=Y.bias,O.shadowNormalBias=Y.normalBias,O.shadowRadius=Y.radius,O.shadowMapSize=Y.mapSize,i.directionalShadow[E]=O,i.directionalShadowMap[E]=j,i.directionalShadowMatrix[E]=J.shadow.matrix,M++}i.directional[E]=q,E++}else if(J.isSpotLight){const q=A.get(J);q.position.setFromMatrixPosition(J.matrixWorld),q.color.copy(x).multiplyScalar(H),q.distance=P,q.coneCos=Math.cos(J.angle),q.penumbraCos=Math.cos(J.angle*(1-J.penumbra)),q.decay=J.decay,i.spot[y]=q;const Y=J.shadow;if(J.map&&(i.spotLightMap[U]=J.map,U++,Y.updateMatrices(J),J.castShadow&&F++),i.spotLightMatrix[y]=Y.matrix,J.castShadow){const O=e.get(J);O.shadowIntensity=Y.intensity,O.shadowBias=Y.bias,O.shadowNormalBias=Y.normalBias,O.shadowRadius=Y.radius,O.shadowMapSize=Y.mapSize,i.spotShadow[y]=O,i.spotShadowMap[y]=j,m++}y++}else if(J.isRectAreaLight){const q=A.get(J);q.color.copy(x).multiplyScalar(H),q.halfWidth.set(J.width*.5,0,0),q.halfHeight.set(0,J.height*.5,0),i.rectArea[S]=q,S++}else if(J.isPointLight){const q=A.get(J);if(q.color.copy(J.color).multiplyScalar(J.intensity),q.distance=J.distance,q.decay=J.decay,J.castShadow){const Y=J.shadow,O=e.get(J);O.shadowIntensity=Y.intensity,O.shadowBias=Y.bias,O.shadowNormalBias=Y.normalBias,O.shadowRadius=Y.radius,O.shadowMapSize=Y.mapSize,O.shadowCameraNear=Y.camera.near,O.shadowCameraFar=Y.camera.far,i.pointShadow[D]=O,i.pointShadowMap[D]=j,i.pointShadowMatrix[D]=J.shadow.matrix,k++}i.point[D]=q,D++}else if(J.isHemisphereLight){const q=A.get(J);q.skyColor.copy(J.color).multiplyScalar(H),q.groundColor.copy(J.groundColor).multiplyScalar(H),i.hemi[f]=q,f++}}S>0&&(t.has("OES_texture_float_linear")===!0?(i.rectAreaLTC1=kt.LTC_FLOAT_1,i.rectAreaLTC2=kt.LTC_FLOAT_2):(i.rectAreaLTC1=kt.LTC_HALF_1,i.rectAreaLTC2=kt.LTC_HALF_2)),i.ambient[0]=s,i.ambient[1]=B,i.ambient[2]=c;const K=i.hash;(K.directionalLength!==E||K.pointLength!==D||K.spotLength!==y||K.rectAreaLength!==S||K.hemiLength!==f||K.numDirectionalShadows!==M||K.numPointShadows!==k||K.numSpotShadows!==m||K.numSpotMaps!==U||K.numLightProbes!==b)&&(i.directional.length=E,i.spot.length=y,i.rectArea.length=S,i.point.length=D,i.hemi.length=f,i.directionalShadow.length=M,i.directionalShadowMap.length=M,i.pointShadow.length=k,i.pointShadowMap.length=k,i.spotShadow.length=m,i.spotShadowMap.length=m,i.directionalShadowMatrix.length=M,i.pointShadowMatrix.length=k,i.spotLightMatrix.length=m+U-F,i.spotLightMap.length=U,i.numSpotLightShadowsWithMaps=F,i.numLightProbes=b,K.directionalLength=E,K.pointLength=D,K.spotLength=y,K.rectAreaLength=S,K.hemiLength=f,K.numDirectionalShadows=M,K.numPointShadows=k,K.numSpotShadows=m,K.numSpotMaps=U,K.numLightProbes=b,i.version=C8A++)}function a(r,s){let B=0,c=0,E=0,D=0,y=0;const S=s.matrixWorldInverse;for(let f=0,M=r.length;f<M;f++){const k=r[f];if(k.isDirectionalLight){const m=i.directional[B];m.direction.setFromMatrixPosition(k.matrixWorld),g.setFromMatrixPosition(k.target.matrixWorld),m.direction.sub(g),m.direction.transformDirection(S),B++}else if(k.isSpotLight){const m=i.spot[E];m.position.setFromMatrixPosition(k.matrixWorld),m.position.applyMatrix4(S),m.direction.setFromMatrixPosition(k.matrixWorld),g.setFromMatrixPosition(k.target.matrixWorld),m.direction.sub(g),m.direction.transformDirection(S),E++}else if(k.isRectAreaLight){const m=i.rectArea[D];m.position.setFromMatrixPosition(k.matrixWorld),m.position.applyMatrix4(S),n.identity(),I.copy(k.matrixWorld),I.premultiply(S),n.extractRotation(I),m.halfWidth.set(k.width*.5,0,0),m.halfHeight.set(0,k.height*.5,0),m.halfWidth.applyMatrix4(n),m.halfHeight.applyMatrix4(n),D++}else if(k.isPointLight){const m=i.point[c];m.position.setFromMatrixPosition(k.matrixWorld),m.position.applyMatrix4(S),c++}else if(k.isHemisphereLight){const m=i.hemi[y];m.direction.setFromMatrixPosition(k.matrixWorld),m.direction.transformDirection(S),y++}}}return{setup:o,setupView:a,state:i}}function c9(t){const A=new c8A(t),e=[],i=[];function g(s){r.camera=s,e.length=0,i.length=0}function I(s){e.push(s)}function n(s){i.push(s)}function o(){A.setup(e)}function a(s){A.setupView(e,s)}const r={lightsArray:e,shadowsArray:i,camera:null,lights:A,transmissionRenderTarget:{}};return{init:g,state:r,setupLights:o,setupLightsView:a,pushLight:I,pushShadow:n}}function l8A(t){let A=new WeakMap;function e(g,I=0){const n=A.get(g);let o;return n===void 0?(o=new c9(t),A.set(g,[o])):I>=n.length?(o=new c9(t),n.push(o)):o=n[I],o}function i(){A=new WeakMap}return{get:e,dispose:i}}const Q8A=`void main() {
	gl_Position = vec4( position, 1.0 );
}`,E8A=`uniform sampler2D shadow_pass;
uniform vec2 resolution;
uniform float radius;
#include <packing>
void main() {
	const float samples = float( VSM_SAMPLES );
	float mean = 0.0;
	float squared_mean = 0.0;
	float uvStride = samples <= 1.0 ? 0.0 : 2.0 / ( samples - 1.0 );
	float uvStart = samples <= 1.0 ? 0.0 : - 1.0;
	for ( float i = 0.0; i < samples; i ++ ) {
		float uvOffset = uvStart + i * uvStride;
		#ifdef HORIZONTAL_PASS
			vec2 distribution = unpackRGBATo2Half( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( uvOffset, 0.0 ) * radius ) / resolution ) );
			mean += distribution.x;
			squared_mean += distribution.y * distribution.y + distribution.x * distribution.x;
		#else
			float depth = unpackRGBAToDepth( texture2D( shadow_pass, ( gl_FragCoord.xy + vec2( 0.0, uvOffset ) * radius ) / resolution ) );
			mean += depth;
			squared_mean += depth * depth;
		#endif
	}
	mean = mean / samples;
	squared_mean = squared_mean / samples;
	float std_dev = sqrt( squared_mean - mean * mean );
	gl_FragColor = pack2HalfToRGBA( vec2( mean, std_dev ) );
}`;function u8A(t,A,e){let i=new tS;const g=new Ze,I=new Ze,n=new wg,o=new u1({depthPacking:rnA}),a=new h1,r={},s=e.maxTextureSize,B={[jc]:Ir,[Ir]:jc,[sB]:sB},c=new EC({defines:{VSM_SAMPLES:8},uniforms:{shadow_pass:{value:null},resolution:{value:new Ze},radius:{value:4}},vertexShader:Q8A,fragmentShader:E8A}),E=c.clone();E.defines.HORIZONTAL_PASS=1;const D=new fi;D.setAttribute("position",new eg(new Float32Array([-1,-1,.5,3,-1,.5,-1,3,.5]),3));const y=new Cn(D,c),S=this;this.enabled=!1,this.autoUpdate=!0,this.needsUpdate=!1,this.type=Fb;let f=this.type;this.render=function(F,b,K){if(S.enabled===!1||S.autoUpdate===!1&&S.needsUpdate===!1||F.length===0)return;const R=t.getRenderTarget(),G=t.getActiveCubeFace(),J=t.getActiveMipmapLevel(),x=t.state;x.setBlending(oQ),x.buffers.depth.getReversed()===!0?x.buffers.color.setClear(0,0,0,0):x.buffers.color.setClear(1,1,1,1),x.buffers.depth.setTest(!0),x.setScissorTest(!1);const H=f!==eB&&this.type===eB,P=f===eB&&this.type!==eB;for(let j=0,q=F.length;j<q;j++){const Y=F[j],O=Y.shadow;if(O===void 0||O.autoUpdate===!1&&O.needsUpdate===!1)continue;g.copy(O.mapSize);const $=O.getFrameExtents();if(g.multiply($),I.copy(O.mapSize),(g.x>s||g.y>s)&&(g.x>s&&(I.x=Math.floor(s/$.x),g.x=I.x*$.x,O.mapSize.x=I.x),g.y>s&&(I.y=Math.floor(s/$.y),g.y=I.y*$.y,O.mapSize.y=I.y)),O.map===null||H===!0||P===!0){const z=this.type!==eB?{minFilter:ho,magFilter:ho}:{};O.map!==null&&O.map.dispose(),O.map=new SB(g.x,g.y,z),O.map.texture.name=Y.name+".shadowMap",O.camera.updateProjectionMatrix()}t.setRenderTarget(O.map),t.clear();const gA=O.getViewportCount();for(let z=0;z<gA;z++){const X=O.getViewport(z);n.set(I.x*X.x,I.y*X.y,I.x*X.z,I.y*X.w),x.viewport(n),O.updateMatrices(Y,z),i=O.getFrustum(),m(b,K,O.camera,Y,this.type)}O.isPointLightShadow!==!0&&this.type===eB&&M(O,K),O.needsUpdate=!1}f=this.type,S.needsUpdate=!1,t.setRenderTarget(R,G,J)};function M(F,b){const K=A.update(y);c.defines.VSM_SAMPLES!==F.blurSamples&&(c.defines.VSM_SAMPLES=F.blurSamples,E.defines.VSM_SAMPLES=F.blurSamples,c.needsUpdate=!0,E.needsUpdate=!0),F.mapPass===null&&(F.mapPass=new SB(g.x,g.y)),c.uniforms.shadow_pass.value=F.map.texture,c.uniforms.resolution.value=F.mapSize,c.uniforms.radius.value=F.radius,t.setRenderTarget(F.mapPass),t.clear(),t.renderBufferDirect(b,null,K,c,y,null),E.uniforms.shadow_pass.value=F.mapPass.texture,E.uniforms.resolution.value=F.mapSize,E.uniforms.radius.value=F.radius,t.setRenderTarget(F.map),t.clear(),t.renderBufferDirect(b,null,K,E,y,null)}function k(F,b,K,R){let G=null;const J=K.isPointLight===!0?F.customDistanceMaterial:F.customDepthMaterial;if(J!==void 0)G=J;else if(G=K.isPointLight===!0?a:o,t.localClippingEnabled&&b.clipShadows===!0&&Array.isArray(b.clippingPlanes)&&b.clippingPlanes.length!==0||b.displacementMap&&b.displacementScale!==0||b.alphaMap&&b.alphaTest>0||b.map&&b.alphaTest>0||b.alphaToCoverage===!0){const x=G.uuid,H=b.uuid;let P=r[x];P===void 0&&(P={},r[x]=P);let j=P[H];j===void 0&&(j=G.clone(),P[H]=j,b.addEventListener("dispose",U)),G=j}if(G.visible=b.visible,G.wireframe=b.wireframe,R===eB?G.side=b.shadowSide!==null?b.shadowSide:b.side:G.side=b.shadowSide!==null?b.shadowSide:B[b.side],G.alphaMap=b.alphaMap,G.alphaTest=b.alphaToCoverage===!0?.5:b.alphaTest,G.map=b.map,G.clipShadows=b.clipShadows,G.clippingPlanes=b.clippingPlanes,G.clipIntersection=b.clipIntersection,G.displacementMap=b.displacementMap,G.displacementScale=b.displacementScale,G.displacementBias=b.displacementBias,G.wireframeLinewidth=b.wireframeLinewidth,G.linewidth=b.linewidth,K.isPointLight===!0&&G.isMeshDistanceMaterial===!0){const x=t.properties.get(G);x.light=K}return G}function m(F,b,K,R,G){if(F.visible===!1)return;if(F.layers.test(b.layers)&&(F.isMesh||F.isLine||F.isPoints)&&(F.castShadow||F.receiveShadow&&G===eB)&&(!F.frustumCulled||i.intersectsObject(F))){F.modelViewMatrix.multiplyMatrices(K.matrixWorldInverse,F.matrixWorld);const H=A.update(F),P=F.material;if(Array.isArray(P)){const j=H.groups;for(let q=0,Y=j.length;q<Y;q++){const O=j[q],$=P[O.materialIndex];if($&&$.visible){const gA=k(F,$,R,G);F.onBeforeShadow(t,F,b,K,H,gA,O),t.renderBufferDirect(K,null,H,gA,F,O),F.onAfterShadow(t,F,b,K,H,gA,O)}}}else if(P.visible){const j=k(F,P,R,G);F.onBeforeShadow(t,F,b,K,H,j,null),t.renderBufferDirect(K,null,H,j,F,null),F.onAfterShadow(t,F,b,K,H,j,null)}}const x=F.children;for(let H=0,P=x.length;H<P;H++)m(x[H],b,K,R,G)}function U(F){F.target.removeEventListener("dispose",U);for(const K in r){const R=r[K],G=F.target.uuid;G in R&&(R[G].dispose(),delete R[G])}}}const h8A={[EK]:uK,[hK]:fK,[dK]:DK,[Kd]:pK,[uK]:EK,[fK]:hK,[DK]:dK,[pK]:Kd};function d8A(t,A){function e(){let bA=!1;const pA=new wg;let Re=null;const CA=new wg(0,0,0,0);return{setMask:function(EA){Re!==EA&&!bA&&(t.colorMask(EA,EA,EA,EA),Re=EA)},setLocked:function(EA){bA=EA},setClear:function(EA,yA,xA,XA,pe){pe===!0&&(EA*=XA,yA*=XA,xA*=XA),pA.set(EA,yA,xA,XA),CA.equals(pA)===!1&&(t.clearColor(EA,yA,xA,XA),CA.copy(pA))},reset:function(){bA=!1,Re=null,CA.set(-1,0,0,0)}}}function i(){let bA=!1,pA=!1,Re=null,CA=null,EA=null;return{setReversed:function(yA){if(pA!==yA){const xA=A.get("EXT_clip_control");yA?xA.clipControlEXT(xA.LOWER_LEFT_EXT,xA.ZERO_TO_ONE_EXT):xA.clipControlEXT(xA.LOWER_LEFT_EXT,xA.NEGATIVE_ONE_TO_ONE_EXT),pA=yA;const XA=EA;EA=null,this.setClear(XA)}},getReversed:function(){return pA},setTest:function(yA){yA?uA(t.DEPTH_TEST):KA(t.DEPTH_TEST)},setMask:function(yA){Re!==yA&&!bA&&(t.depthMask(yA),Re=yA)},setFunc:function(yA){if(pA&&(yA=h8A[yA]),CA!==yA){switch(yA){case EK:t.depthFunc(t.NEVER);break;case uK:t.depthFunc(t.ALWAYS);break;case hK:t.depthFunc(t.LESS);break;case Kd:t.depthFunc(t.LEQUAL);break;case dK:t.depthFunc(t.EQUAL);break;case pK:t.depthFunc(t.GEQUAL);break;case fK:t.depthFunc(t.GREATER);break;case DK:t.depthFunc(t.NOTEQUAL);break;default:t.depthFunc(t.LEQUAL)}CA=yA}},setLocked:function(yA){bA=yA},setClear:function(yA){EA!==yA&&(pA&&(yA=1-yA),t.clearDepth(yA),EA=yA)},reset:function(){bA=!1,Re=null,CA=null,EA=null,pA=!1}}}function g(){let bA=!1,pA=null,Re=null,CA=null,EA=null,yA=null,xA=null,XA=null,pe=null;return{setTest:function(be){bA||(be?uA(t.STENCIL_TEST):KA(t.STENCIL_TEST))},setMask:function(be){pA!==be&&!bA&&(t.stencilMask(be),pA=be)},setFunc:function(be,It,Ut){(Re!==be||CA!==It||EA!==Ut)&&(t.stencilFunc(be,It,Ut),Re=be,CA=It,EA=Ut)},setOp:function(be,It,Ut){(yA!==be||xA!==It||XA!==Ut)&&(t.stencilOp(be,It,Ut),yA=be,xA=It,XA=Ut)},setLocked:function(be){bA=be},setClear:function(be){pe!==be&&(t.clearStencil(be),pe=be)},reset:function(){bA=!1,pA=null,Re=null,CA=null,EA=null,yA=null,xA=null,XA=null,pe=null}}}const I=new e,n=new i,o=new g,a=new WeakMap,r=new WeakMap;let s={},B={},c=new WeakMap,E=[],D=null,y=!1,S=null,f=null,M=null,k=null,m=null,U=null,F=null,b=new wt(0,0,0),K=0,R=!1,G=null,J=null,x=null,H=null,P=null;const j=t.getParameter(t.MAX_COMBINED_TEXTURE_IMAGE_UNITS);let q=!1,Y=0;const O=t.getParameter(t.VERSION);O.indexOf("WebGL")!==-1?(Y=parseFloat(/^WebGL (\d)/.exec(O)[1]),q=Y>=1):O.indexOf("OpenGL ES")!==-1&&(Y=parseFloat(/^OpenGL ES (\d)/.exec(O)[1]),q=Y>=2);let $=null,gA={};const z=t.getParameter(t.SCISSOR_BOX),X=t.getParameter(t.VIEWPORT),sA=new wg().fromArray(z),rA=new wg().fromArray(X);function mA(bA,pA,Re,CA){const EA=new Uint8Array(4),yA=t.createTexture();t.bindTexture(bA,yA),t.texParameteri(bA,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(bA,t.TEXTURE_MAG_FILTER,t.NEAREST);for(let xA=0;xA<Re;xA++)bA===t.TEXTURE_3D||bA===t.TEXTURE_2D_ARRAY?t.texImage3D(pA,0,t.RGBA,1,1,CA,0,t.RGBA,t.UNSIGNED_BYTE,EA):t.texImage2D(pA+xA,0,t.RGBA,1,1,0,t.RGBA,t.UNSIGNED_BYTE,EA);return yA}const IA={};IA[t.TEXTURE_2D]=mA(t.TEXTURE_2D,t.TEXTURE_2D,1),IA[t.TEXTURE_CUBE_MAP]=mA(t.TEXTURE_CUBE_MAP,t.TEXTURE_CUBE_MAP_POSITIVE_X,6),IA[t.TEXTURE_2D_ARRAY]=mA(t.TEXTURE_2D_ARRAY,t.TEXTURE_2D_ARRAY,1,1),IA[t.TEXTURE_3D]=mA(t.TEXTURE_3D,t.TEXTURE_3D,1,1),I.setClear(0,0,0,1),n.setClear(1),o.setClear(0),uA(t.DEPTH_TEST),n.setFunc(Kd),hA(!1),DA(SY),uA(t.CULL_FACE),tA(oQ);function uA(bA){s[bA]!==!0&&(t.enable(bA),s[bA]=!0)}function KA(bA){s[bA]!==!1&&(t.disable(bA),s[bA]=!1)}function FA(bA,pA){return B[bA]!==pA?(t.bindFramebuffer(bA,pA),B[bA]=pA,bA===t.DRAW_FRAMEBUFFER&&(B[t.FRAMEBUFFER]=pA),bA===t.FRAMEBUFFER&&(B[t.DRAW_FRAMEBUFFER]=pA),!0):!1}function RA(bA,pA){let Re=E,CA=!1;if(bA){Re=c.get(pA),Re===void 0&&(Re=[],c.set(pA,Re));const EA=bA.textures;if(Re.length!==EA.length||Re[0]!==t.COLOR_ATTACHMENT0){for(let yA=0,xA=EA.length;yA<xA;yA++)Re[yA]=t.COLOR_ATTACHMENT0+yA;Re.length=EA.length,CA=!0}}else Re[0]!==t.BACK&&(Re[0]=t.BACK,CA=!0);CA&&t.drawBuffers(Re)}function MA(bA){return D!==bA?(t.useProgram(bA),D=bA,!0):!1}const oA={[NE]:t.FUNC_ADD,[UIA]:t.FUNC_SUBTRACT,[KIA]:t.FUNC_REVERSE_SUBTRACT};oA[FIA]=t.MIN,oA[bIA]=t.MAX;const AA={[vIA]:t.ZERO,[_IA]:t.ONE,[JIA]:t.SRC_COLOR,[lK]:t.SRC_ALPHA,[HIA]:t.SRC_ALPHA_SATURATE,[TIA]:t.DST_COLOR,[qIA]:t.DST_ALPHA,[LIA]:t.ONE_MINUS_SRC_COLOR,[QK]:t.ONE_MINUS_SRC_ALPHA,[YIA]:t.ONE_MINUS_DST_COLOR,[xIA]:t.ONE_MINUS_DST_ALPHA,[OIA]:t.CONSTANT_COLOR,[PIA]:t.ONE_MINUS_CONSTANT_COLOR,[jIA]:t.CONSTANT_ALPHA,[ZIA]:t.ONE_MINUS_CONSTANT_ALPHA};function tA(bA,pA,Re,CA,EA,yA,xA,XA,pe,be){if(bA===oQ){y===!0&&(KA(t.BLEND),y=!1);return}if(y===!1&&(uA(t.BLEND),y=!0),bA!==RIA){if(bA!==S||be!==R){if((f!==NE||m!==NE)&&(t.blendEquation(t.FUNC_ADD),f=NE,m=NE),be)switch(bA){case Qd:t.blendFuncSeparate(t.ONE,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case wY:t.blendFunc(t.ONE,t.ONE);break;case mY:t.blendFuncSeparate(t.ZERO,t.ONE_MINUS_SRC_COLOR,t.ZERO,t.ONE);break;case kY:t.blendFuncSeparate(t.DST_COLOR,t.ONE_MINUS_SRC_ALPHA,t.ZERO,t.ONE);break;default:break}else switch(bA){case Qd:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE_MINUS_SRC_ALPHA,t.ONE,t.ONE_MINUS_SRC_ALPHA);break;case wY:t.blendFuncSeparate(t.SRC_ALPHA,t.ONE,t.ONE,t.ONE);break;case mY:break;case kY:break;default:break}M=null,k=null,U=null,F=null,b.set(0,0,0),K=0,S=bA,R=be}return}EA=EA||pA,yA=yA||Re,xA=xA||CA,(pA!==f||EA!==m)&&(t.blendEquationSeparate(oA[pA],oA[EA]),f=pA,m=EA),(Re!==M||CA!==k||yA!==U||xA!==F)&&(t.blendFuncSeparate(AA[Re],AA[CA],AA[yA],AA[xA]),M=Re,k=CA,U=yA,F=xA),(XA.equals(b)===!1||pe!==K)&&(t.blendColor(XA.r,XA.g,XA.b,pe),b.copy(XA),K=pe),S=bA,R=!1}function iA(bA,pA){bA.side===sB?KA(t.CULL_FACE):uA(t.CULL_FACE);let Re=bA.side===Ir;pA&&(Re=!Re),hA(Re),bA.blending===Qd&&bA.transparent===!1?tA(oQ):tA(bA.blending,bA.blendEquation,bA.blendSrc,bA.blendDst,bA.blendEquationAlpha,bA.blendSrcAlpha,bA.blendDstAlpha,bA.blendColor,bA.blendAlpha,bA.premultipliedAlpha),n.setFunc(bA.depthFunc),n.setTest(bA.depthTest),n.setMask(bA.depthWrite),I.setMask(bA.colorWrite);const CA=bA.stencilWrite;o.setTest(CA),CA&&(o.setMask(bA.stencilWriteMask),o.setFunc(bA.stencilFunc,bA.stencilRef,bA.stencilFuncMask),o.setOp(bA.stencilFail,bA.stencilZFail,bA.stencilZPass)),SA(bA.polygonOffset,bA.polygonOffsetFactor,bA.polygonOffsetUnits),bA.alphaToCoverage===!0?uA(t.SAMPLE_ALPHA_TO_COVERAGE):KA(t.SAMPLE_ALPHA_TO_COVERAGE)}function hA(bA){G!==bA&&(bA?t.frontFace(t.CW):t.frontFace(t.CCW),G=bA)}function DA(bA){bA!==MIA?(uA(t.CULL_FACE),bA!==J&&(bA===SY?t.cullFace(t.BACK):bA===NIA?t.cullFace(t.FRONT):t.cullFace(t.FRONT_AND_BACK))):KA(t.CULL_FACE),J=bA}function dA(bA){bA!==x&&(q&&t.lineWidth(bA),x=bA)}function SA(bA,pA,Re){bA?(uA(t.POLYGON_OFFSET_FILL),(H!==pA||P!==Re)&&(t.polygonOffset(pA,Re),H=pA,P=Re)):KA(t.POLYGON_OFFSET_FILL)}function NA(bA){bA?uA(t.SCISSOR_TEST):KA(t.SCISSOR_TEST)}function OA(bA){bA===void 0&&(bA=t.TEXTURE0+j-1),$!==bA&&(t.activeTexture(bA),$=bA)}function Qe(bA,pA,Re){Re===void 0&&($===null?Re=t.TEXTURE0+j-1:Re=$);let CA=gA[Re];CA===void 0&&(CA={type:void 0,texture:void 0},gA[Re]=CA),(CA.type!==bA||CA.texture!==pA)&&($!==Re&&(t.activeTexture(Re),$=Re),t.bindTexture(bA,pA||IA[bA]),CA.type=bA,CA.texture=pA)}function nA(){const bA=gA[$];bA!==void 0&&bA.type!==void 0&&(t.bindTexture(bA.type,null),bA.type=void 0,bA.texture=void 0)}function eA(){try{t.compressedTexImage2D(...arguments)}catch{}}function UA(){try{t.compressedTexImage3D(...arguments)}catch{}}function HA(){try{t.texSubImage2D(...arguments)}catch{}}function Se(){try{t.texSubImage3D(...arguments)}catch{}}function ne(){try{t.compressedTexSubImage2D(...arguments)}catch{}}function Oe(){try{t.compressedTexSubImage3D(...arguments)}catch{}}function VA(){try{t.texStorage2D(...arguments)}catch{}}function de(){try{t.texStorage3D(...arguments)}catch{}}function te(){try{t.texImage2D(...arguments)}catch{}}function WA(){try{t.texImage3D(...arguments)}catch{}}function _A(bA){sA.equals(bA)===!1&&(t.scissor(bA.x,bA.y,bA.z,bA.w),sA.copy(bA))}function zA(bA){rA.equals(bA)===!1&&(t.viewport(bA.x,bA.y,bA.z,bA.w),rA.copy(bA))}function ge(bA,pA){let Re=r.get(pA);Re===void 0&&(Re=new WeakMap,r.set(pA,Re));let CA=Re.get(bA);CA===void 0&&(CA=t.getUniformBlockIndex(pA,bA.name),Re.set(bA,CA))}function he(bA,pA){const CA=r.get(pA).get(bA);a.get(pA)!==CA&&(t.uniformBlockBinding(pA,CA,bA.__bindingPointIndex),a.set(pA,CA))}function ve(){t.disable(t.BLEND),t.disable(t.CULL_FACE),t.disable(t.DEPTH_TEST),t.disable(t.POLYGON_OFFSET_FILL),t.disable(t.SCISSOR_TEST),t.disable(t.STENCIL_TEST),t.disable(t.SAMPLE_ALPHA_TO_COVERAGE),t.blendEquation(t.FUNC_ADD),t.blendFunc(t.ONE,t.ZERO),t.blendFuncSeparate(t.ONE,t.ZERO,t.ONE,t.ZERO),t.blendColor(0,0,0,0),t.colorMask(!0,!0,!0,!0),t.clearColor(0,0,0,0),t.depthMask(!0),t.depthFunc(t.LESS),n.setReversed(!1),t.clearDepth(1),t.stencilMask(4294967295),t.stencilFunc(t.ALWAYS,0,4294967295),t.stencilOp(t.KEEP,t.KEEP,t.KEEP),t.clearStencil(0),t.cullFace(t.BACK),t.frontFace(t.CCW),t.polygonOffset(0,0),t.activeTexture(t.TEXTURE0),t.bindFramebuffer(t.FRAMEBUFFER,null),t.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),t.bindFramebuffer(t.READ_FRAMEBUFFER,null),t.useProgram(null),t.lineWidth(1),t.scissor(0,0,t.canvas.width,t.canvas.height),t.viewport(0,0,t.canvas.width,t.canvas.height),s={},$=null,gA={},B={},c=new WeakMap,E=[],D=null,y=!1,S=null,f=null,M=null,k=null,m=null,U=null,F=null,b=new wt(0,0,0),K=0,R=!1,G=null,J=null,x=null,H=null,P=null,sA.set(0,0,t.canvas.width,t.canvas.height),rA.set(0,0,t.canvas.width,t.canvas.height),I.reset(),n.reset(),o.reset()}return{buffers:{color:I,depth:n,stencil:o},enable:uA,disable:KA,bindFramebuffer:FA,drawBuffers:RA,useProgram:MA,setBlending:tA,setMaterial:iA,setFlipSided:hA,setCullFace:DA,setLineWidth:dA,setPolygonOffset:SA,setScissorTest:NA,activeTexture:OA,bindTexture:Qe,unbindTexture:nA,compressedTexImage2D:eA,compressedTexImage3D:UA,texImage2D:te,texImage3D:WA,updateUBOMapping:ge,uniformBlockBinding:he,texStorage2D:VA,texStorage3D:de,texSubImage2D:HA,texSubImage3D:Se,compressedTexSubImage2D:ne,compressedTexSubImage3D:Oe,scissor:_A,viewport:zA,reset:ve}}function p8A(t,A,e,i,g,I,n){const o=A.has("WEBGL_multisampled_render_to_texture")?A.get("WEBGL_multisampled_render_to_texture"):null,a=typeof navigator>"u"?!1:/OculusBrowser/g.test(navigator.userAgent),r=new Ze,s=new WeakMap;let B;const c=new WeakMap;let E=!1;try{E=typeof OffscreenCanvas<"u"&&new OffscreenCanvas(1,1).getContext("2d")!==null}catch{}function D(nA,eA){return E?new OffscreenCanvas(nA,eA):H0("canvas")}function y(nA,eA,UA){let HA=1;const Se=Qe(nA);if((Se.width>UA||Se.height>UA)&&(HA=UA/Math.max(Se.width,Se.height)),HA<1)if(typeof HTMLImageElement<"u"&&nA instanceof HTMLImageElement||typeof HTMLCanvasElement<"u"&&nA instanceof HTMLCanvasElement||typeof ImageBitmap<"u"&&nA instanceof ImageBitmap||typeof VideoFrame<"u"&&nA instanceof VideoFrame){const ne=Math.floor(HA*Se.width),Oe=Math.floor(HA*Se.height);B===void 0&&(B=D(ne,Oe));const VA=eA?D(ne,Oe):B;return VA.width=ne,VA.height=Oe,VA.getContext("2d").drawImage(nA,0,0,ne,Oe),VA}else return"data"in nA,nA;return nA}function S(nA){return nA.generateMipmaps}function f(nA){t.generateMipmap(nA)}function M(nA){return nA.isWebGLCubeRenderTarget?t.TEXTURE_CUBE_MAP:nA.isWebGL3DRenderTarget?t.TEXTURE_3D:nA.isWebGLArrayRenderTarget||nA.isCompressedArrayTexture?t.TEXTURE_2D_ARRAY:t.TEXTURE_2D}function k(nA,eA,UA,HA,Se=!1){if(nA!==null&&t[nA]!==void 0)return t[nA];let ne=eA;if(eA===t.RED&&(UA===t.FLOAT&&(ne=t.R32F),UA===t.HALF_FLOAT&&(ne=t.R16F),UA===t.UNSIGNED_BYTE&&(ne=t.R8)),eA===t.RED_INTEGER&&(UA===t.UNSIGNED_BYTE&&(ne=t.R8UI),UA===t.UNSIGNED_SHORT&&(ne=t.R16UI),UA===t.UNSIGNED_INT&&(ne=t.R32UI),UA===t.BYTE&&(ne=t.R8I),UA===t.SHORT&&(ne=t.R16I),UA===t.INT&&(ne=t.R32I)),eA===t.RG&&(UA===t.FLOAT&&(ne=t.RG32F),UA===t.HALF_FLOAT&&(ne=t.RG16F),UA===t.UNSIGNED_BYTE&&(ne=t.RG8)),eA===t.RG_INTEGER&&(UA===t.UNSIGNED_BYTE&&(ne=t.RG8UI),UA===t.UNSIGNED_SHORT&&(ne=t.RG16UI),UA===t.UNSIGNED_INT&&(ne=t.RG32UI),UA===t.BYTE&&(ne=t.RG8I),UA===t.SHORT&&(ne=t.RG16I),UA===t.INT&&(ne=t.RG32I)),eA===t.RGB_INTEGER&&(UA===t.UNSIGNED_BYTE&&(ne=t.RGB8UI),UA===t.UNSIGNED_SHORT&&(ne=t.RGB16UI),UA===t.UNSIGNED_INT&&(ne=t.RGB32UI),UA===t.BYTE&&(ne=t.RGB8I),UA===t.SHORT&&(ne=t.RGB16I),UA===t.INT&&(ne=t.RGB32I)),eA===t.RGBA_INTEGER&&(UA===t.UNSIGNED_BYTE&&(ne=t.RGBA8UI),UA===t.UNSIGNED_SHORT&&(ne=t.RGBA16UI),UA===t.UNSIGNED_INT&&(ne=t.RGBA32UI),UA===t.BYTE&&(ne=t.RGBA8I),UA===t.SHORT&&(ne=t.RGBA16I),UA===t.INT&&(ne=t.RGBA32I)),eA===t.RGB&&(UA===t.UNSIGNED_INT_5_9_9_9_REV&&(ne=t.RGB9_E5),UA===t.UNSIGNED_INT_10F_11F_11F_REV&&(ne=t.R11F_G11F_B10F)),eA===t.RGBA){const Oe=Se?T0:Qg.getTransfer(HA);UA===t.FLOAT&&(ne=t.RGBA32F),UA===t.HALF_FLOAT&&(ne=t.RGBA16F),UA===t.UNSIGNED_BYTE&&(ne=Oe===Vg?t.SRGB8_ALPHA8:t.RGBA8),UA===t.UNSIGNED_SHORT_4_4_4_4&&(ne=t.RGBA4),UA===t.UNSIGNED_SHORT_5_5_5_1&&(ne=t.RGB5_A1)}return(ne===t.R16F||ne===t.R32F||ne===t.RG16F||ne===t.RG32F||ne===t.RGBA16F||ne===t.RGBA32F)&&A.get("EXT_color_buffer_float"),ne}function m(nA,eA){let UA;return nA?eA===null||eA===wQ||eA===ly?UA=t.DEPTH24_STENCIL8:eA===ir?UA=t.DEPTH32F_STENCIL8:eA===cy&&(UA=t.DEPTH24_STENCIL8):eA===null||eA===wQ||eA===ly?UA=t.DEPTH_COMPONENT24:eA===ir?UA=t.DEPTH_COMPONENT32F:eA===cy&&(UA=t.DEPTH_COMPONENT16),UA}function U(nA,eA){return S(nA)===!0||nA.isFramebufferTexture&&nA.minFilter!==ho&&nA.minFilter!==HI?Math.log2(Math.max(eA.width,eA.height))+1:nA.mipmaps!==void 0&&nA.mipmaps.length>0?nA.mipmaps.length:nA.isCompressedTexture&&Array.isArray(nA.image)?eA.mipmaps.length:1}function F(nA){const eA=nA.target;eA.removeEventListener("dispose",F),K(eA),eA.isVideoTexture&&s.delete(eA)}function b(nA){const eA=nA.target;eA.removeEventListener("dispose",b),G(eA)}function K(nA){const eA=i.get(nA);if(eA.__webglInit===void 0)return;const UA=nA.source,HA=c.get(UA);if(HA){const Se=HA[eA.__cacheKey];Se.usedTimes--,Se.usedTimes===0&&R(nA),Object.keys(HA).length===0&&c.delete(UA)}i.remove(nA)}function R(nA){const eA=i.get(nA);t.deleteTexture(eA.__webglTexture);const UA=nA.source,HA=c.get(UA);delete HA[eA.__cacheKey],n.memory.textures--}function G(nA){const eA=i.get(nA);if(nA.depthTexture&&(nA.depthTexture.dispose(),i.remove(nA.depthTexture)),nA.isWebGLCubeRenderTarget)for(let HA=0;HA<6;HA++){if(Array.isArray(eA.__webglFramebuffer[HA]))for(let Se=0;Se<eA.__webglFramebuffer[HA].length;Se++)t.deleteFramebuffer(eA.__webglFramebuffer[HA][Se]);else t.deleteFramebuffer(eA.__webglFramebuffer[HA]);eA.__webglDepthbuffer&&t.deleteRenderbuffer(eA.__webglDepthbuffer[HA])}else{if(Array.isArray(eA.__webglFramebuffer))for(let HA=0;HA<eA.__webglFramebuffer.length;HA++)t.deleteFramebuffer(eA.__webglFramebuffer[HA]);else t.deleteFramebuffer(eA.__webglFramebuffer);if(eA.__webglDepthbuffer&&t.deleteRenderbuffer(eA.__webglDepthbuffer),eA.__webglMultisampledFramebuffer&&t.deleteFramebuffer(eA.__webglMultisampledFramebuffer),eA.__webglColorRenderbuffer)for(let HA=0;HA<eA.__webglColorRenderbuffer.length;HA++)eA.__webglColorRenderbuffer[HA]&&t.deleteRenderbuffer(eA.__webglColorRenderbuffer[HA]);eA.__webglDepthRenderbuffer&&t.deleteRenderbuffer(eA.__webglDepthRenderbuffer)}const UA=nA.textures;for(let HA=0,Se=UA.length;HA<Se;HA++){const ne=i.get(UA[HA]);ne.__webglTexture&&(t.deleteTexture(ne.__webglTexture),n.memory.textures--),i.remove(UA[HA])}i.remove(nA)}let J=0;function x(){J=0}function H(){const nA=J;return nA>=g.maxTextures,J+=1,nA}function P(nA){const eA=[];return eA.push(nA.wrapS),eA.push(nA.wrapT),eA.push(nA.wrapR||0),eA.push(nA.magFilter),eA.push(nA.minFilter),eA.push(nA.anisotropy),eA.push(nA.internalFormat),eA.push(nA.format),eA.push(nA.type),eA.push(nA.generateMipmaps),eA.push(nA.premultiplyAlpha),eA.push(nA.flipY),eA.push(nA.unpackAlignment),eA.push(nA.colorSpace),eA.join()}function j(nA,eA){const UA=i.get(nA);if(nA.isVideoTexture&&NA(nA),nA.isRenderTargetTexture===!1&&nA.isExternalTexture!==!0&&nA.version>0&&UA.__version!==nA.version){const HA=nA.image;if(HA!==null){if(HA.complete!==!1){IA(UA,nA,eA);return}}}else nA.isExternalTexture&&(UA.__webglTexture=nA.sourceTexture?nA.sourceTexture:null);e.bindTexture(t.TEXTURE_2D,UA.__webglTexture,t.TEXTURE0+eA)}function q(nA,eA){const UA=i.get(nA);if(nA.isRenderTargetTexture===!1&&nA.version>0&&UA.__version!==nA.version){IA(UA,nA,eA);return}e.bindTexture(t.TEXTURE_2D_ARRAY,UA.__webglTexture,t.TEXTURE0+eA)}function Y(nA,eA){const UA=i.get(nA);if(nA.isRenderTargetTexture===!1&&nA.version>0&&UA.__version!==nA.version){IA(UA,nA,eA);return}e.bindTexture(t.TEXTURE_3D,UA.__webglTexture,t.TEXTURE0+eA)}function O(nA,eA){const UA=i.get(nA);if(nA.version>0&&UA.__version!==nA.version){uA(UA,nA,eA);return}e.bindTexture(t.TEXTURE_CUBE_MAP,UA.__webglTexture,t.TEXTURE0+eA)}const $={[su]:t.REPEAT,[Bs]:t.CLAMP_TO_EDGE,[By]:t.MIRRORED_REPEAT},gA={[ho]:t.NEAREST,[vb]:t.NEAREST_MIPMAP_NEAREST,[Vh]:t.NEAREST_MIPMAP_LINEAR,[HI]:t.LINEAR,[_D]:t.LINEAR_MIPMAP_NEAREST,[oC]:t.LINEAR_MIPMAP_LINEAR},z={[CnA]:t.NEVER,[unA]:t.ALWAYS,[BnA]:t.LESS,[VP]:t.LEQUAL,[cnA]:t.EQUAL,[EnA]:t.GEQUAL,[lnA]:t.GREATER,[QnA]:t.NOTEQUAL};function X(nA,eA){if(eA.type===ir&&A.has("OES_texture_float_linear")===!1&&(eA.magFilter===HI||eA.magFilter===_D||eA.magFilter===Vh||eA.magFilter===oC||eA.minFilter===HI||eA.minFilter===_D||eA.minFilter===Vh||eA.minFilter),t.texParameteri(nA,t.TEXTURE_WRAP_S,$[eA.wrapS]),t.texParameteri(nA,t.TEXTURE_WRAP_T,$[eA.wrapT]),(nA===t.TEXTURE_3D||nA===t.TEXTURE_2D_ARRAY)&&t.texParameteri(nA,t.TEXTURE_WRAP_R,$[eA.wrapR]),t.texParameteri(nA,t.TEXTURE_MAG_FILTER,gA[eA.magFilter]),t.texParameteri(nA,t.TEXTURE_MIN_FILTER,gA[eA.minFilter]),eA.compareFunction&&(t.texParameteri(nA,t.TEXTURE_COMPARE_MODE,t.COMPARE_REF_TO_TEXTURE),t.texParameteri(nA,t.TEXTURE_COMPARE_FUNC,z[eA.compareFunction])),A.has("EXT_texture_filter_anisotropic")===!0){if(eA.magFilter===ho||eA.minFilter!==Vh&&eA.minFilter!==oC||eA.type===ir&&A.has("OES_texture_float_linear")===!1)return;if(eA.anisotropy>1||i.get(eA).__currentAnisotropy){const UA=A.get("EXT_texture_filter_anisotropic");t.texParameterf(nA,UA.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(eA.anisotropy,g.getMaxAnisotropy())),i.get(eA).__currentAnisotropy=eA.anisotropy}}}function sA(nA,eA){let UA=!1;nA.__webglInit===void 0&&(nA.__webglInit=!0,eA.addEventListener("dispose",F));const HA=eA.source;let Se=c.get(HA);Se===void 0&&(Se={},c.set(HA,Se));const ne=P(eA);if(ne!==nA.__cacheKey){Se[ne]===void 0&&(Se[ne]={texture:t.createTexture(),usedTimes:0},n.memory.textures++,UA=!0),Se[ne].usedTimes++;const Oe=Se[nA.__cacheKey];Oe!==void 0&&(Se[nA.__cacheKey].usedTimes--,Oe.usedTimes===0&&R(eA)),nA.__cacheKey=ne,nA.__webglTexture=Se[ne].texture}return UA}function rA(nA,eA,UA){return Math.floor(Math.floor(nA/UA)/eA)}function mA(nA,eA,UA,HA){const ne=nA.updateRanges;if(ne.length===0)e.texSubImage2D(t.TEXTURE_2D,0,0,0,eA.width,eA.height,UA,HA,eA.data);else{ne.sort((WA,_A)=>WA.start-_A.start);let Oe=0;for(let WA=1;WA<ne.length;WA++){const _A=ne[Oe],zA=ne[WA],ge=_A.start+_A.count,he=rA(zA.start,eA.width,4),ve=rA(_A.start,eA.width,4);zA.start<=ge+1&&he===ve&&rA(zA.start+zA.count-1,eA.width,4)===he?_A.count=Math.max(_A.count,zA.start+zA.count-_A.start):(++Oe,ne[Oe]=zA)}ne.length=Oe+1;const VA=t.getParameter(t.UNPACK_ROW_LENGTH),de=t.getParameter(t.UNPACK_SKIP_PIXELS),te=t.getParameter(t.UNPACK_SKIP_ROWS);t.pixelStorei(t.UNPACK_ROW_LENGTH,eA.width);for(let WA=0,_A=ne.length;WA<_A;WA++){const zA=ne[WA],ge=Math.floor(zA.start/4),he=Math.ceil(zA.count/4),ve=ge%eA.width,bA=Math.floor(ge/eA.width),pA=he,Re=1;t.pixelStorei(t.UNPACK_SKIP_PIXELS,ve),t.pixelStorei(t.UNPACK_SKIP_ROWS,bA),e.texSubImage2D(t.TEXTURE_2D,0,ve,bA,pA,Re,UA,HA,eA.data)}nA.clearUpdateRanges(),t.pixelStorei(t.UNPACK_ROW_LENGTH,VA),t.pixelStorei(t.UNPACK_SKIP_PIXELS,de),t.pixelStorei(t.UNPACK_SKIP_ROWS,te)}}function IA(nA,eA,UA){let HA=t.TEXTURE_2D;(eA.isDataArrayTexture||eA.isCompressedArrayTexture)&&(HA=t.TEXTURE_2D_ARRAY),eA.isData3DTexture&&(HA=t.TEXTURE_3D);const Se=sA(nA,eA),ne=eA.source;e.bindTexture(HA,nA.__webglTexture,t.TEXTURE0+UA);const Oe=i.get(ne);if(ne.version!==Oe.__version||Se===!0){e.activeTexture(t.TEXTURE0+UA);const VA=Qg.getPrimaries(Qg.workingColorSpace),de=eA.colorSpace===zl?null:Qg.getPrimaries(eA.colorSpace),te=eA.colorSpace===zl||VA===de?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,eA.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,eA.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,eA.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,te);let WA=y(eA.image,!1,g.maxTextureSize);WA=OA(eA,WA);const _A=I.convert(eA.format,eA.colorSpace),zA=I.convert(eA.type);let ge=k(eA.internalFormat,_A,zA,eA.colorSpace,eA.isVideoTexture);X(HA,eA);let he;const ve=eA.mipmaps,bA=eA.isVideoTexture!==!0,pA=Oe.__version===void 0||Se===!0,Re=ne.dataReady,CA=U(eA,WA);if(eA.isDepthTexture)ge=m(eA.format===Ey,eA.type),pA&&(bA?e.texStorage2D(t.TEXTURE_2D,1,ge,WA.width,WA.height):e.texImage2D(t.TEXTURE_2D,0,ge,WA.width,WA.height,0,_A,zA,null));else if(eA.isDataTexture)if(ve.length>0){bA&&pA&&e.texStorage2D(t.TEXTURE_2D,CA,ge,ve[0].width,ve[0].height);for(let EA=0,yA=ve.length;EA<yA;EA++)he=ve[EA],bA?Re&&e.texSubImage2D(t.TEXTURE_2D,EA,0,0,he.width,he.height,_A,zA,he.data):e.texImage2D(t.TEXTURE_2D,EA,ge,he.width,he.height,0,_A,zA,he.data);eA.generateMipmaps=!1}else bA?(pA&&e.texStorage2D(t.TEXTURE_2D,CA,ge,WA.width,WA.height),Re&&mA(eA,WA,_A,zA)):e.texImage2D(t.TEXTURE_2D,0,ge,WA.width,WA.height,0,_A,zA,WA.data);else if(eA.isCompressedTexture)if(eA.isCompressedArrayTexture){bA&&pA&&e.texStorage3D(t.TEXTURE_2D_ARRAY,CA,ge,ve[0].width,ve[0].height,WA.depth);for(let EA=0,yA=ve.length;EA<yA;EA++)if(he=ve[EA],eA.format!==da){if(_A!==null)if(bA){if(Re)if(eA.layerUpdates.size>0){const xA=vY(he.width,he.height,eA.format,eA.type);for(const XA of eA.layerUpdates){const pe=he.data.subarray(XA*xA/he.data.BYTES_PER_ELEMENT,(XA+1)*xA/he.data.BYTES_PER_ELEMENT);e.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,EA,0,0,XA,he.width,he.height,1,_A,pe)}eA.clearLayerUpdates()}else e.compressedTexSubImage3D(t.TEXTURE_2D_ARRAY,EA,0,0,0,he.width,he.height,WA.depth,_A,he.data)}else e.compressedTexImage3D(t.TEXTURE_2D_ARRAY,EA,ge,he.width,he.height,WA.depth,0,he.data,0,0)}else bA?Re&&e.texSubImage3D(t.TEXTURE_2D_ARRAY,EA,0,0,0,he.width,he.height,WA.depth,_A,zA,he.data):e.texImage3D(t.TEXTURE_2D_ARRAY,EA,ge,he.width,he.height,WA.depth,0,_A,zA,he.data)}else{bA&&pA&&e.texStorage2D(t.TEXTURE_2D,CA,ge,ve[0].width,ve[0].height);for(let EA=0,yA=ve.length;EA<yA;EA++)he=ve[EA],eA.format!==da?_A!==null&&(bA?Re&&e.compressedTexSubImage2D(t.TEXTURE_2D,EA,0,0,he.width,he.height,_A,he.data):e.compressedTexImage2D(t.TEXTURE_2D,EA,ge,he.width,he.height,0,he.data)):bA?Re&&e.texSubImage2D(t.TEXTURE_2D,EA,0,0,he.width,he.height,_A,zA,he.data):e.texImage2D(t.TEXTURE_2D,EA,ge,he.width,he.height,0,_A,zA,he.data)}else if(eA.isDataArrayTexture)if(bA){if(pA&&e.texStorage3D(t.TEXTURE_2D_ARRAY,CA,ge,WA.width,WA.height,WA.depth),Re)if(eA.layerUpdates.size>0){const EA=vY(WA.width,WA.height,eA.format,eA.type);for(const yA of eA.layerUpdates){const xA=WA.data.subarray(yA*EA/WA.data.BYTES_PER_ELEMENT,(yA+1)*EA/WA.data.BYTES_PER_ELEMENT);e.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,yA,WA.width,WA.height,1,_A,zA,xA)}eA.clearLayerUpdates()}else e.texSubImage3D(t.TEXTURE_2D_ARRAY,0,0,0,0,WA.width,WA.height,WA.depth,_A,zA,WA.data)}else e.texImage3D(t.TEXTURE_2D_ARRAY,0,ge,WA.width,WA.height,WA.depth,0,_A,zA,WA.data);else if(eA.isData3DTexture)bA?(pA&&e.texStorage3D(t.TEXTURE_3D,CA,ge,WA.width,WA.height,WA.depth),Re&&e.texSubImage3D(t.TEXTURE_3D,0,0,0,0,WA.width,WA.height,WA.depth,_A,zA,WA.data)):e.texImage3D(t.TEXTURE_3D,0,ge,WA.width,WA.height,WA.depth,0,_A,zA,WA.data);else if(eA.isFramebufferTexture){if(pA)if(bA)e.texStorage2D(t.TEXTURE_2D,CA,ge,WA.width,WA.height);else{let EA=WA.width,yA=WA.height;for(let xA=0;xA<CA;xA++)e.texImage2D(t.TEXTURE_2D,xA,ge,EA,yA,0,_A,zA,null),EA>>=1,yA>>=1}}else if(ve.length>0){if(bA&&pA){const EA=Qe(ve[0]);e.texStorage2D(t.TEXTURE_2D,CA,ge,EA.width,EA.height)}for(let EA=0,yA=ve.length;EA<yA;EA++)he=ve[EA],bA?Re&&e.texSubImage2D(t.TEXTURE_2D,EA,0,0,_A,zA,he):e.texImage2D(t.TEXTURE_2D,EA,ge,_A,zA,he);eA.generateMipmaps=!1}else if(bA){if(pA){const EA=Qe(WA);e.texStorage2D(t.TEXTURE_2D,CA,ge,EA.width,EA.height)}Re&&e.texSubImage2D(t.TEXTURE_2D,0,0,0,_A,zA,WA)}else e.texImage2D(t.TEXTURE_2D,0,ge,_A,zA,WA);S(eA)&&f(HA),Oe.__version=ne.version,eA.onUpdate&&eA.onUpdate(eA)}nA.__version=eA.version}function uA(nA,eA,UA){if(eA.image.length!==6)return;const HA=sA(nA,eA),Se=eA.source;e.bindTexture(t.TEXTURE_CUBE_MAP,nA.__webglTexture,t.TEXTURE0+UA);const ne=i.get(Se);if(Se.version!==ne.__version||HA===!0){e.activeTexture(t.TEXTURE0+UA);const Oe=Qg.getPrimaries(Qg.workingColorSpace),VA=eA.colorSpace===zl?null:Qg.getPrimaries(eA.colorSpace),de=eA.colorSpace===zl||Oe===VA?t.NONE:t.BROWSER_DEFAULT_WEBGL;t.pixelStorei(t.UNPACK_FLIP_Y_WEBGL,eA.flipY),t.pixelStorei(t.UNPACK_PREMULTIPLY_ALPHA_WEBGL,eA.premultiplyAlpha),t.pixelStorei(t.UNPACK_ALIGNMENT,eA.unpackAlignment),t.pixelStorei(t.UNPACK_COLORSPACE_CONVERSION_WEBGL,de);const te=eA.isCompressedTexture||eA.image[0].isCompressedTexture,WA=eA.image[0]&&eA.image[0].isDataTexture,_A=[];for(let yA=0;yA<6;yA++)!te&&!WA?_A[yA]=y(eA.image[yA],!0,g.maxCubemapSize):_A[yA]=WA?eA.image[yA].image:eA.image[yA],_A[yA]=OA(eA,_A[yA]);const zA=_A[0],ge=I.convert(eA.format,eA.colorSpace),he=I.convert(eA.type),ve=k(eA.internalFormat,ge,he,eA.colorSpace),bA=eA.isVideoTexture!==!0,pA=ne.__version===void 0||HA===!0,Re=Se.dataReady;let CA=U(eA,zA);X(t.TEXTURE_CUBE_MAP,eA);let EA;if(te){bA&&pA&&e.texStorage2D(t.TEXTURE_CUBE_MAP,CA,ve,zA.width,zA.height);for(let yA=0;yA<6;yA++){EA=_A[yA].mipmaps;for(let xA=0;xA<EA.length;xA++){const XA=EA[xA];eA.format!==da?ge!==null&&(bA?Re&&e.compressedTexSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA,0,0,XA.width,XA.height,ge,XA.data):e.compressedTexImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA,ve,XA.width,XA.height,0,XA.data)):bA?Re&&e.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA,0,0,XA.width,XA.height,ge,he,XA.data):e.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA,ve,XA.width,XA.height,0,ge,he,XA.data)}}}else{if(EA=eA.mipmaps,bA&&pA){EA.length>0&&CA++;const yA=Qe(_A[0]);e.texStorage2D(t.TEXTURE_CUBE_MAP,CA,ve,yA.width,yA.height)}for(let yA=0;yA<6;yA++)if(WA){bA?Re&&e.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,0,0,0,_A[yA].width,_A[yA].height,ge,he,_A[yA].data):e.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,0,ve,_A[yA].width,_A[yA].height,0,ge,he,_A[yA].data);for(let xA=0;xA<EA.length;xA++){const pe=EA[xA].image[yA].image;bA?Re&&e.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA+1,0,0,pe.width,pe.height,ge,he,pe.data):e.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA+1,ve,pe.width,pe.height,0,ge,he,pe.data)}}else{bA?Re&&e.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,0,0,0,ge,he,_A[yA]):e.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,0,ve,ge,he,_A[yA]);for(let xA=0;xA<EA.length;xA++){const XA=EA[xA];bA?Re&&e.texSubImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA+1,0,0,ge,he,XA.image[yA]):e.texImage2D(t.TEXTURE_CUBE_MAP_POSITIVE_X+yA,xA+1,ve,ge,he,XA.image[yA])}}}S(eA)&&f(t.TEXTURE_CUBE_MAP),ne.__version=Se.version,eA.onUpdate&&eA.onUpdate(eA)}nA.__version=eA.version}function KA(nA,eA,UA,HA,Se,ne){const Oe=I.convert(UA.format,UA.colorSpace),VA=I.convert(UA.type),de=k(UA.internalFormat,Oe,VA,UA.colorSpace),te=i.get(eA),WA=i.get(UA);if(WA.__renderTarget=eA,!te.__hasExternalTextures){const _A=Math.max(1,eA.width>>ne),zA=Math.max(1,eA.height>>ne);Se===t.TEXTURE_3D||Se===t.TEXTURE_2D_ARRAY?e.texImage3D(Se,ne,de,_A,zA,eA.depth,0,Oe,VA,null):e.texImage2D(Se,ne,de,_A,zA,0,Oe,VA,null)}e.bindFramebuffer(t.FRAMEBUFFER,nA),SA(eA)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,HA,Se,WA.__webglTexture,0,dA(eA)):(Se===t.TEXTURE_2D||Se>=t.TEXTURE_CUBE_MAP_POSITIVE_X&&Se<=t.TEXTURE_CUBE_MAP_NEGATIVE_Z)&&t.framebufferTexture2D(t.FRAMEBUFFER,HA,Se,WA.__webglTexture,ne),e.bindFramebuffer(t.FRAMEBUFFER,null)}function FA(nA,eA,UA){if(t.bindRenderbuffer(t.RENDERBUFFER,nA),eA.depthBuffer){const HA=eA.depthTexture,Se=HA&&HA.isDepthTexture?HA.type:null,ne=m(eA.stencilBuffer,Se),Oe=eA.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,VA=dA(eA);SA(eA)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,VA,ne,eA.width,eA.height):UA?t.renderbufferStorageMultisample(t.RENDERBUFFER,VA,ne,eA.width,eA.height):t.renderbufferStorage(t.RENDERBUFFER,ne,eA.width,eA.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,Oe,t.RENDERBUFFER,nA)}else{const HA=eA.textures;for(let Se=0;Se<HA.length;Se++){const ne=HA[Se],Oe=I.convert(ne.format,ne.colorSpace),VA=I.convert(ne.type),de=k(ne.internalFormat,Oe,VA,ne.colorSpace),te=dA(eA);UA&&SA(eA)===!1?t.renderbufferStorageMultisample(t.RENDERBUFFER,te,de,eA.width,eA.height):SA(eA)?o.renderbufferStorageMultisampleEXT(t.RENDERBUFFER,te,de,eA.width,eA.height):t.renderbufferStorage(t.RENDERBUFFER,de,eA.width,eA.height)}}t.bindRenderbuffer(t.RENDERBUFFER,null)}function RA(nA,eA){if(eA&&eA.isWebGLCubeRenderTarget)throw new Error("Depth Texture with cube render targets is not supported");if(e.bindFramebuffer(t.FRAMEBUFFER,nA),!(eA.depthTexture&&eA.depthTexture.isDepthTexture))throw new Error("renderTarget.depthTexture must be an instance of THREE.DepthTexture");const HA=i.get(eA.depthTexture);HA.__renderTarget=eA,(!HA.__webglTexture||eA.depthTexture.image.width!==eA.width||eA.depthTexture.image.height!==eA.height)&&(eA.depthTexture.image.width=eA.width,eA.depthTexture.image.height=eA.height,eA.depthTexture.needsUpdate=!0),j(eA.depthTexture,0);const Se=HA.__webglTexture,ne=dA(eA);if(eA.depthTexture.format===Qy)SA(eA)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Se,0,ne):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_ATTACHMENT,t.TEXTURE_2D,Se,0);else if(eA.depthTexture.format===Ey)SA(eA)?o.framebufferTexture2DMultisampleEXT(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Se,0,ne):t.framebufferTexture2D(t.FRAMEBUFFER,t.DEPTH_STENCIL_ATTACHMENT,t.TEXTURE_2D,Se,0);else throw new Error("Unknown depthTexture format")}function MA(nA){const eA=i.get(nA),UA=nA.isWebGLCubeRenderTarget===!0;if(eA.__boundDepthTexture!==nA.depthTexture){const HA=nA.depthTexture;if(eA.__depthDisposeCallback&&eA.__depthDisposeCallback(),HA){const Se=()=>{delete eA.__boundDepthTexture,delete eA.__depthDisposeCallback,HA.removeEventListener("dispose",Se)};HA.addEventListener("dispose",Se),eA.__depthDisposeCallback=Se}eA.__boundDepthTexture=HA}if(nA.depthTexture&&!eA.__autoAllocateDepthBuffer){if(UA)throw new Error("target.depthTexture not supported in Cube render targets");const HA=nA.texture.mipmaps;HA&&HA.length>0?RA(eA.__webglFramebuffer[0],nA):RA(eA.__webglFramebuffer,nA)}else if(UA){eA.__webglDepthbuffer=[];for(let HA=0;HA<6;HA++)if(e.bindFramebuffer(t.FRAMEBUFFER,eA.__webglFramebuffer[HA]),eA.__webglDepthbuffer[HA]===void 0)eA.__webglDepthbuffer[HA]=t.createRenderbuffer(),FA(eA.__webglDepthbuffer[HA],nA,!1);else{const Se=nA.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ne=eA.__webglDepthbuffer[HA];t.bindRenderbuffer(t.RENDERBUFFER,ne),t.framebufferRenderbuffer(t.FRAMEBUFFER,Se,t.RENDERBUFFER,ne)}}else{const HA=nA.texture.mipmaps;if(HA&&HA.length>0?e.bindFramebuffer(t.FRAMEBUFFER,eA.__webglFramebuffer[0]):e.bindFramebuffer(t.FRAMEBUFFER,eA.__webglFramebuffer),eA.__webglDepthbuffer===void 0)eA.__webglDepthbuffer=t.createRenderbuffer(),FA(eA.__webglDepthbuffer,nA,!1);else{const Se=nA.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,ne=eA.__webglDepthbuffer;t.bindRenderbuffer(t.RENDERBUFFER,ne),t.framebufferRenderbuffer(t.FRAMEBUFFER,Se,t.RENDERBUFFER,ne)}}e.bindFramebuffer(t.FRAMEBUFFER,null)}function oA(nA,eA,UA){const HA=i.get(nA);eA!==void 0&&KA(HA.__webglFramebuffer,nA,nA.texture,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,0),UA!==void 0&&MA(nA)}function AA(nA){const eA=nA.texture,UA=i.get(nA),HA=i.get(eA);nA.addEventListener("dispose",b);const Se=nA.textures,ne=nA.isWebGLCubeRenderTarget===!0,Oe=Se.length>1;if(Oe||(HA.__webglTexture===void 0&&(HA.__webglTexture=t.createTexture()),HA.__version=eA.version,n.memory.textures++),ne){UA.__webglFramebuffer=[];for(let VA=0;VA<6;VA++)if(eA.mipmaps&&eA.mipmaps.length>0){UA.__webglFramebuffer[VA]=[];for(let de=0;de<eA.mipmaps.length;de++)UA.__webglFramebuffer[VA][de]=t.createFramebuffer()}else UA.__webglFramebuffer[VA]=t.createFramebuffer()}else{if(eA.mipmaps&&eA.mipmaps.length>0){UA.__webglFramebuffer=[];for(let VA=0;VA<eA.mipmaps.length;VA++)UA.__webglFramebuffer[VA]=t.createFramebuffer()}else UA.__webglFramebuffer=t.createFramebuffer();if(Oe)for(let VA=0,de=Se.length;VA<de;VA++){const te=i.get(Se[VA]);te.__webglTexture===void 0&&(te.__webglTexture=t.createTexture(),n.memory.textures++)}if(nA.samples>0&&SA(nA)===!1){UA.__webglMultisampledFramebuffer=t.createFramebuffer(),UA.__webglColorRenderbuffer=[],e.bindFramebuffer(t.FRAMEBUFFER,UA.__webglMultisampledFramebuffer);for(let VA=0;VA<Se.length;VA++){const de=Se[VA];UA.__webglColorRenderbuffer[VA]=t.createRenderbuffer(),t.bindRenderbuffer(t.RENDERBUFFER,UA.__webglColorRenderbuffer[VA]);const te=I.convert(de.format,de.colorSpace),WA=I.convert(de.type),_A=k(de.internalFormat,te,WA,de.colorSpace,nA.isXRRenderTarget===!0),zA=dA(nA);t.renderbufferStorageMultisample(t.RENDERBUFFER,zA,_A,nA.width,nA.height),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+VA,t.RENDERBUFFER,UA.__webglColorRenderbuffer[VA])}t.bindRenderbuffer(t.RENDERBUFFER,null),nA.depthBuffer&&(UA.__webglDepthRenderbuffer=t.createRenderbuffer(),FA(UA.__webglDepthRenderbuffer,nA,!0)),e.bindFramebuffer(t.FRAMEBUFFER,null)}}if(ne){e.bindTexture(t.TEXTURE_CUBE_MAP,HA.__webglTexture),X(t.TEXTURE_CUBE_MAP,eA);for(let VA=0;VA<6;VA++)if(eA.mipmaps&&eA.mipmaps.length>0)for(let de=0;de<eA.mipmaps.length;de++)KA(UA.__webglFramebuffer[VA][de],nA,eA,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+VA,de);else KA(UA.__webglFramebuffer[VA],nA,eA,t.COLOR_ATTACHMENT0,t.TEXTURE_CUBE_MAP_POSITIVE_X+VA,0);S(eA)&&f(t.TEXTURE_CUBE_MAP),e.unbindTexture()}else if(Oe){for(let VA=0,de=Se.length;VA<de;VA++){const te=Se[VA],WA=i.get(te);let _A=t.TEXTURE_2D;(nA.isWebGL3DRenderTarget||nA.isWebGLArrayRenderTarget)&&(_A=nA.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),e.bindTexture(_A,WA.__webglTexture),X(_A,te),KA(UA.__webglFramebuffer,nA,te,t.COLOR_ATTACHMENT0+VA,_A,0),S(te)&&f(_A)}e.unbindTexture()}else{let VA=t.TEXTURE_2D;if((nA.isWebGL3DRenderTarget||nA.isWebGLArrayRenderTarget)&&(VA=nA.isWebGL3DRenderTarget?t.TEXTURE_3D:t.TEXTURE_2D_ARRAY),e.bindTexture(VA,HA.__webglTexture),X(VA,eA),eA.mipmaps&&eA.mipmaps.length>0)for(let de=0;de<eA.mipmaps.length;de++)KA(UA.__webglFramebuffer[de],nA,eA,t.COLOR_ATTACHMENT0,VA,de);else KA(UA.__webglFramebuffer,nA,eA,t.COLOR_ATTACHMENT0,VA,0);S(eA)&&f(VA),e.unbindTexture()}nA.depthBuffer&&MA(nA)}function tA(nA){const eA=nA.textures;for(let UA=0,HA=eA.length;UA<HA;UA++){const Se=eA[UA];if(S(Se)){const ne=M(nA),Oe=i.get(Se).__webglTexture;e.bindTexture(ne,Oe),f(ne),e.unbindTexture()}}}const iA=[],hA=[];function DA(nA){if(nA.samples>0){if(SA(nA)===!1){const eA=nA.textures,UA=nA.width,HA=nA.height;let Se=t.COLOR_BUFFER_BIT;const ne=nA.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT,Oe=i.get(nA),VA=eA.length>1;if(VA)for(let te=0;te<eA.length;te++)e.bindFramebuffer(t.FRAMEBUFFER,Oe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+te,t.RENDERBUFFER,null),e.bindFramebuffer(t.FRAMEBUFFER,Oe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+te,t.TEXTURE_2D,null,0);e.bindFramebuffer(t.READ_FRAMEBUFFER,Oe.__webglMultisampledFramebuffer);const de=nA.texture.mipmaps;de&&de.length>0?e.bindFramebuffer(t.DRAW_FRAMEBUFFER,Oe.__webglFramebuffer[0]):e.bindFramebuffer(t.DRAW_FRAMEBUFFER,Oe.__webglFramebuffer);for(let te=0;te<eA.length;te++){if(nA.resolveDepthBuffer&&(nA.depthBuffer&&(Se|=t.DEPTH_BUFFER_BIT),nA.stencilBuffer&&nA.resolveStencilBuffer&&(Se|=t.STENCIL_BUFFER_BIT)),VA){t.framebufferRenderbuffer(t.READ_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.RENDERBUFFER,Oe.__webglColorRenderbuffer[te]);const WA=i.get(eA[te]).__webglTexture;t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,WA,0)}t.blitFramebuffer(0,0,UA,HA,0,0,UA,HA,Se,t.NEAREST),a===!0&&(iA.length=0,hA.length=0,iA.push(t.COLOR_ATTACHMENT0+te),nA.depthBuffer&&nA.resolveDepthBuffer===!1&&(iA.push(ne),hA.push(ne),t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,hA)),t.invalidateFramebuffer(t.READ_FRAMEBUFFER,iA))}if(e.bindFramebuffer(t.READ_FRAMEBUFFER,null),e.bindFramebuffer(t.DRAW_FRAMEBUFFER,null),VA)for(let te=0;te<eA.length;te++){e.bindFramebuffer(t.FRAMEBUFFER,Oe.__webglMultisampledFramebuffer),t.framebufferRenderbuffer(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0+te,t.RENDERBUFFER,Oe.__webglColorRenderbuffer[te]);const WA=i.get(eA[te]).__webglTexture;e.bindFramebuffer(t.FRAMEBUFFER,Oe.__webglFramebuffer),t.framebufferTexture2D(t.DRAW_FRAMEBUFFER,t.COLOR_ATTACHMENT0+te,t.TEXTURE_2D,WA,0)}e.bindFramebuffer(t.DRAW_FRAMEBUFFER,Oe.__webglMultisampledFramebuffer)}else if(nA.depthBuffer&&nA.resolveDepthBuffer===!1&&a){const eA=nA.stencilBuffer?t.DEPTH_STENCIL_ATTACHMENT:t.DEPTH_ATTACHMENT;t.invalidateFramebuffer(t.DRAW_FRAMEBUFFER,[eA])}}}function dA(nA){return Math.min(g.maxSamples,nA.samples)}function SA(nA){const eA=i.get(nA);return nA.samples>0&&A.has("WEBGL_multisampled_render_to_texture")===!0&&eA.__useRenderToTexture!==!1}function NA(nA){const eA=n.render.frame;s.get(nA)!==eA&&(s.set(nA,eA),nA.update())}function OA(nA,eA){const UA=nA.colorSpace,HA=nA.format,Se=nA.type;return nA.isCompressedTexture===!0||nA.isVideoTexture===!0||UA!==Cu&&UA!==zl&&Qg.getTransfer(UA),eA}function Qe(nA){return typeof HTMLImageElement<"u"&&nA instanceof HTMLImageElement?(r.width=nA.naturalWidth||nA.width,r.height=nA.naturalHeight||nA.height):typeof VideoFrame<"u"&&nA instanceof VideoFrame?(r.width=nA.displayWidth,r.height=nA.displayHeight):(r.width=nA.width,r.height=nA.height),r}this.allocateTextureUnit=H,this.resetTextureUnits=x,this.setTexture2D=j,this.setTexture2DArray=q,this.setTexture3D=Y,this.setTextureCube=O,this.rebindTextures=oA,this.setupRenderTarget=AA,this.updateRenderTargetMipmap=tA,this.updateMultisampleRenderTarget=DA,this.setupDepthRenderbuffer=MA,this.setupFrameBufferTexture=KA,this.useMultisampledRTT=SA}function DoA(t,A){function e(i,g=zl){let I;const n=Qg.getTransfer(g);if(i===QC)return t.UNSIGNED_BYTE;if(i===Jb)return t.UNSIGNED_SHORT_4_4_4_4;if(i===Lb)return t.UNSIGNED_SHORT_5_5_5_1;if(i===HP)return t.UNSIGNED_INT_5_9_9_9_REV;if(i===OP)return t.UNSIGNED_INT_10F_11F_11F_REV;if(i===TP)return t.BYTE;if(i===YP)return t.SHORT;if(i===cy)return t.UNSIGNED_SHORT;if(i===_b)return t.INT;if(i===wQ)return t.UNSIGNED_INT;if(i===ir)return t.FLOAT;if(i===Bp)return t.HALF_FLOAT;if(i===PP)return t.ALPHA;if(i===jP)return t.RGB;if(i===da)return t.RGBA;if(i===Qy)return t.DEPTH_COMPONENT;if(i===Ey)return t.DEPTH_STENCIL;if(i===qb)return t.RED;if(i===zk)return t.RED_INTEGER;if(i===ZP)return t.RG;if(i===xb)return t.RG_INTEGER;if(i===Tb)return t.RGBA_INTEGER;if(i===jm||i===Zm||i===Wm||i===zm)if(n===Vg)if(I=A.get("WEBGL_compressed_texture_s3tc_srgb"),I!==null){if(i===jm)return I.COMPRESSED_SRGB_S3TC_DXT1_EXT;if(i===Zm)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT1_EXT;if(i===Wm)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT3_EXT;if(i===zm)return I.COMPRESSED_SRGB_ALPHA_S3TC_DXT5_EXT}else return null;else if(I=A.get("WEBGL_compressed_texture_s3tc"),I!==null){if(i===jm)return I.COMPRESSED_RGB_S3TC_DXT1_EXT;if(i===Zm)return I.COMPRESSED_RGBA_S3TC_DXT1_EXT;if(i===Wm)return I.COMPRESSED_RGBA_S3TC_DXT3_EXT;if(i===zm)return I.COMPRESSED_RGBA_S3TC_DXT5_EXT}else return null;if(i===yK||i===SK||i===wK||i===mK)if(I=A.get("WEBGL_compressed_texture_pvrtc"),I!==null){if(i===yK)return I.COMPRESSED_RGB_PVRTC_4BPPV1_IMG;if(i===SK)return I.COMPRESSED_RGB_PVRTC_2BPPV1_IMG;if(i===wK)return I.COMPRESSED_RGBA_PVRTC_4BPPV1_IMG;if(i===mK)return I.COMPRESSED_RGBA_PVRTC_2BPPV1_IMG}else return null;if(i===kK||i===MK||i===NK)if(I=A.get("WEBGL_compressed_texture_etc"),I!==null){if(i===kK||i===MK)return n===Vg?I.COMPRESSED_SRGB8_ETC2:I.COMPRESSED_RGB8_ETC2;if(i===NK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ETC2_EAC:I.COMPRESSED_RGBA8_ETC2_EAC}else return null;if(i===GK||i===RK||i===UK||i===KK||i===FK||i===bK||i===vK||i===_K||i===JK||i===LK||i===qK||i===xK||i===TK||i===YK)if(I=A.get("WEBGL_compressed_texture_astc"),I!==null){if(i===GK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR:I.COMPRESSED_RGBA_ASTC_4x4_KHR;if(i===RK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR:I.COMPRESSED_RGBA_ASTC_5x4_KHR;if(i===UK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR:I.COMPRESSED_RGBA_ASTC_5x5_KHR;if(i===KK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR:I.COMPRESSED_RGBA_ASTC_6x5_KHR;if(i===FK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR:I.COMPRESSED_RGBA_ASTC_6x6_KHR;if(i===bK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR:I.COMPRESSED_RGBA_ASTC_8x5_KHR;if(i===vK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR:I.COMPRESSED_RGBA_ASTC_8x6_KHR;if(i===_K)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR:I.COMPRESSED_RGBA_ASTC_8x8_KHR;if(i===JK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR:I.COMPRESSED_RGBA_ASTC_10x5_KHR;if(i===LK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR:I.COMPRESSED_RGBA_ASTC_10x6_KHR;if(i===qK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR:I.COMPRESSED_RGBA_ASTC_10x8_KHR;if(i===xK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR:I.COMPRESSED_RGBA_ASTC_10x10_KHR;if(i===TK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR:I.COMPRESSED_RGBA_ASTC_12x10_KHR;if(i===YK)return n===Vg?I.COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR:I.COMPRESSED_RGBA_ASTC_12x12_KHR}else return null;if(i===HK||i===OK||i===PK)if(I=A.get("EXT_texture_compression_bptc"),I!==null){if(i===HK)return n===Vg?I.COMPRESSED_SRGB_ALPHA_BPTC_UNORM_EXT:I.COMPRESSED_RGBA_BPTC_UNORM_EXT;if(i===OK)return I.COMPRESSED_RGB_BPTC_SIGNED_FLOAT_EXT;if(i===PK)return I.COMPRESSED_RGB_BPTC_UNSIGNED_FLOAT_EXT}else return null;if(i===jK||i===ZK||i===WK||i===zK)if(I=A.get("EXT_texture_compression_rgtc"),I!==null){if(i===jK)return I.COMPRESSED_RED_RGTC1_EXT;if(i===ZK)return I.COMPRESSED_SIGNED_RED_RGTC1_EXT;if(i===WK)return I.COMPRESSED_RED_GREEN_RGTC2_EXT;if(i===zK)return I.COMPRESSED_SIGNED_RED_GREEN_RGTC2_EXT}else return null;return i===ly?t.UNSIGNED_INT_24_8:t[i]!==void 0?t[i]:null}return{convert:e}}const f8A=`
void main() {

	gl_Position = vec4( position, 1.0 );

}`,D8A=`
uniform sampler2DArray depthColor;
uniform float depthWidth;
uniform float depthHeight;

void main() {

	vec2 coord = vec2( gl_FragCoord.x / depthWidth, gl_FragCoord.y / depthHeight );

	if ( coord.x >= 1.0 ) {

		gl_FragDepth = texture( depthColor, vec3( coord.x - 1.0, coord.y, 1 ) ).r;

	} else {

		gl_FragDepth = texture( depthColor, vec3( coord.x, coord.y, 0 ) ).r;

	}

}`;class y8A{constructor(){this.texture=null,this.mesh=null,this.depthNear=0,this.depthFar=0}init(A,e){if(this.texture===null){const i=new s1(A.texture);(A.depthNear!==e.depthNear||A.depthFar!==e.depthFar)&&(this.depthNear=A.depthNear,this.depthFar=A.depthFar),this.texture=i}}getMesh(A){if(this.texture!==null&&this.mesh===null){const e=A.cameras[0].viewport,i=new EC({vertexShader:f8A,fragmentShader:D8A,uniforms:{depthColor:{value:this.texture},depthWidth:{value:e.z},depthHeight:{value:e.w}}});this.mesh=new Cn(new iS(20,20),i)}return this.mesh}reset(){this.texture=null,this.mesh=null}getDepthTexture(){return this.texture}}class S8A extends $c{constructor(A,e){super();const i=this;let g=null,I=1,n=null,o="local-floor",a=1,r=null,s=null,B=null,c=null,E=null,D=null;const y=typeof XRWebGLBinding<"u",S=new y8A,f={},M=e.getContextAttributes();let k=null,m=null;const U=[],F=[],b=new Ze;let K=null;const R=new jn;R.viewport=new wg;const G=new jn;G.viewport=new wg;const J=[R,G],x=new CoA;let H=null,P=null;this.cameraAutoUpdate=!0,this.enabled=!1,this.isPresenting=!1,this.getController=function(IA){let uA=U[IA];return uA===void 0&&(uA=new zR,U[IA]=uA),uA.getTargetRaySpace()},this.getControllerGrip=function(IA){let uA=U[IA];return uA===void 0&&(uA=new zR,U[IA]=uA),uA.getGripSpace()},this.getHand=function(IA){let uA=U[IA];return uA===void 0&&(uA=new zR,U[IA]=uA),uA.getHandSpace()};function j(IA){const uA=F.indexOf(IA.inputSource);if(uA===-1)return;const KA=U[uA];KA!==void 0&&(KA.update(IA.inputSource,IA.frame,r||n),KA.dispatchEvent({type:IA.type,data:IA.inputSource}))}function q(){g.removeEventListener("select",j),g.removeEventListener("selectstart",j),g.removeEventListener("selectend",j),g.removeEventListener("squeeze",j),g.removeEventListener("squeezestart",j),g.removeEventListener("squeezeend",j),g.removeEventListener("end",q),g.removeEventListener("inputsourceschange",Y);for(let IA=0;IA<U.length;IA++){const uA=F[IA];uA!==null&&(F[IA]=null,U[IA].disconnect(uA))}H=null,P=null,S.reset();for(const IA in f)delete f[IA];A.setRenderTarget(k),E=null,c=null,B=null,g=null,m=null,mA.stop(),i.isPresenting=!1,A.setPixelRatio(K),A.setSize(b.width,b.height,!1),i.dispatchEvent({type:"sessionend"})}this.setFramebufferScaleFactor=function(IA){I=IA,i.isPresenting},this.setReferenceSpaceType=function(IA){o=IA,i.isPresenting},this.getReferenceSpace=function(){return r||n},this.setReferenceSpace=function(IA){r=IA},this.getBaseLayer=function(){return c!==null?c:E},this.getBinding=function(){return B===null&&y&&(B=new XRWebGLBinding(g,e)),B},this.getFrame=function(){return D},this.getSession=function(){return g},this.setSession=async function(IA){if(g=IA,g!==null){if(k=A.getRenderTarget(),g.addEventListener("select",j),g.addEventListener("selectstart",j),g.addEventListener("selectend",j),g.addEventListener("squeeze",j),g.addEventListener("squeezestart",j),g.addEventListener("squeezeend",j),g.addEventListener("end",q),g.addEventListener("inputsourceschange",Y),M.xrCompatible!==!0&&await e.makeXRCompatible(),K=A.getPixelRatio(),A.getSize(b),y&&"createProjectionLayer"in XRWebGLBinding.prototype){let KA=null,FA=null,RA=null;M.depth&&(RA=M.stencil?e.DEPTH24_STENCIL8:e.DEPTH_COMPONENT24,KA=M.stencil?Ey:Qy,FA=M.stencil?ly:wQ);const MA={colorFormat:e.RGBA8,depthFormat:RA,scaleFactor:I};B=this.getBinding(),c=B.createProjectionLayer(MA),g.updateRenderState({layers:[c]}),A.setPixelRatio(1),A.setSize(c.textureWidth,c.textureHeight,!1),m=new SB(c.textureWidth,c.textureHeight,{format:da,type:QC,depthTexture:new $b(c.textureWidth,c.textureHeight,FA,void 0,void 0,void 0,void 0,void 0,void 0,KA),stencilBuffer:M.stencil,colorSpace:A.outputColorSpace,samples:M.antialias?4:0,resolveDepthBuffer:c.ignoreDepthValues===!1,resolveStencilBuffer:c.ignoreDepthValues===!1})}else{const KA={antialias:M.antialias,alpha:!0,depth:M.depth,stencil:M.stencil,framebufferScaleFactor:I};E=new XRWebGLLayer(g,e,KA),g.updateRenderState({baseLayer:E}),A.setPixelRatio(1),A.setSize(E.framebufferWidth,E.framebufferHeight,!1),m=new SB(E.framebufferWidth,E.framebufferHeight,{format:da,type:QC,colorSpace:A.outputColorSpace,stencilBuffer:M.stencil,resolveDepthBuffer:E.ignoreDepthValues===!1,resolveStencilBuffer:E.ignoreDepthValues===!1})}m.isXRRenderTarget=!0,this.setFoveation(a),r=null,n=await g.requestReferenceSpace(o),mA.setContext(g),mA.start(),i.isPresenting=!0,i.dispatchEvent({type:"sessionstart"})}},this.getEnvironmentBlendMode=function(){if(g!==null)return g.environmentBlendMode},this.getDepthTexture=function(){return S.getDepthTexture()};function Y(IA){for(let uA=0;uA<IA.removed.length;uA++){const KA=IA.removed[uA],FA=F.indexOf(KA);FA>=0&&(F[FA]=null,U[FA].disconnect(KA))}for(let uA=0;uA<IA.added.length;uA++){const KA=IA.added[uA];let FA=F.indexOf(KA);if(FA===-1){for(let MA=0;MA<U.length;MA++)if(MA>=F.length){F.push(KA),FA=MA;break}else if(F[MA]===null){F[MA]=KA,FA=MA;break}if(FA===-1)break}const RA=U[FA];RA&&RA.connect(KA)}}const O=new wA,$=new wA;function gA(IA,uA,KA){O.setFromMatrixPosition(uA.matrixWorld),$.setFromMatrixPosition(KA.matrixWorld);const FA=O.distanceTo($),RA=uA.projectionMatrix.elements,MA=KA.projectionMatrix.elements,oA=RA[14]/(RA[10]-1),AA=RA[14]/(RA[10]+1),tA=(RA[9]+1)/RA[5],iA=(RA[9]-1)/RA[5],hA=(RA[8]-1)/RA[0],DA=(MA[8]+1)/MA[0],dA=oA*hA,SA=oA*DA,NA=FA/(-hA+DA),OA=NA*-hA;if(uA.matrixWorld.decompose(IA.position,IA.quaternion,IA.scale),IA.translateX(OA),IA.translateZ(NA),IA.matrixWorld.compose(IA.position,IA.quaternion,IA.scale),IA.matrixWorldInverse.copy(IA.matrixWorld).invert(),RA[10]===-1)IA.projectionMatrix.copy(uA.projectionMatrix),IA.projectionMatrixInverse.copy(uA.projectionMatrixInverse);else{const Qe=oA+NA,nA=AA+NA,eA=dA-OA,UA=SA+(FA-OA),HA=tA*AA/nA*Qe,Se=iA*AA/nA*Qe;IA.projectionMatrix.makePerspective(eA,UA,HA,Se,Qe,nA),IA.projectionMatrixInverse.copy(IA.projectionMatrix).invert()}}function z(IA,uA){uA===null?IA.matrixWorld.copy(IA.matrix):IA.matrixWorld.multiplyMatrices(uA.matrixWorld,IA.matrix),IA.matrixWorldInverse.copy(IA.matrixWorld).invert()}this.updateCamera=function(IA){if(g===null)return;let uA=IA.near,KA=IA.far;S.texture!==null&&(S.depthNear>0&&(uA=S.depthNear),S.depthFar>0&&(KA=S.depthFar)),x.near=G.near=R.near=uA,x.far=G.far=R.far=KA,(H!==x.near||P!==x.far)&&(g.updateRenderState({depthNear:x.near,depthFar:x.far}),H=x.near,P=x.far),x.layers.mask=IA.layers.mask|6,R.layers.mask=x.layers.mask&3,G.layers.mask=x.layers.mask&5;const FA=IA.parent,RA=x.cameras;z(x,FA);for(let MA=0;MA<RA.length;MA++)z(RA[MA],FA);RA.length===2?gA(x,R,G):x.projectionMatrix.copy(R.projectionMatrix),X(IA,x,FA)};function X(IA,uA,KA){KA===null?IA.matrix.copy(uA.matrixWorld):(IA.matrix.copy(KA.matrixWorld),IA.matrix.invert(),IA.matrix.multiply(uA.matrixWorld)),IA.matrix.decompose(IA.position,IA.quaternion,IA.scale),IA.updateMatrixWorld(!0),IA.projectionMatrix.copy(uA.projectionMatrix),IA.projectionMatrixInverse.copy(uA.projectionMatrixInverse),IA.isPerspectiveCamera&&(IA.fov=py*2*Math.atan(1/IA.projectionMatrix.elements[5]),IA.zoom=1)}this.getCamera=function(){return x},this.getFoveation=function(){if(!(c===null&&E===null))return a},this.setFoveation=function(IA){a=IA,c!==null&&(c.fixedFoveation=IA),E!==null&&E.fixedFoveation!==void 0&&(E.fixedFoveation=IA)},this.hasDepthSensing=function(){return S.texture!==null},this.getDepthSensingMesh=function(){return S.getMesh(x)},this.getCameraTexture=function(IA){return f[IA]};let sA=null;function rA(IA,uA){if(s=uA.getViewerPose(r||n),D=uA,s!==null){const KA=s.views;E!==null&&(A.setRenderTargetFramebuffer(m,E.framebuffer),A.setRenderTarget(m));let FA=!1;KA.length!==x.cameras.length&&(x.cameras.length=0,FA=!0);for(let AA=0;AA<KA.length;AA++){const tA=KA[AA];let iA=null;if(E!==null)iA=E.getViewport(tA);else{const DA=B.getViewSubImage(c,tA);iA=DA.viewport,AA===0&&(A.setRenderTargetTextures(m,DA.colorTexture,DA.depthStencilTexture),A.setRenderTarget(m))}let hA=J[AA];hA===void 0&&(hA=new jn,hA.layers.enable(AA),hA.viewport=new wg,J[AA]=hA),hA.matrix.fromArray(tA.transform.matrix),hA.matrix.decompose(hA.position,hA.quaternion,hA.scale),hA.projectionMatrix.fromArray(tA.projectionMatrix),hA.projectionMatrixInverse.copy(hA.projectionMatrix).invert(),hA.viewport.set(iA.x,iA.y,iA.width,iA.height),AA===0&&(x.matrix.copy(hA.matrix),x.matrix.decompose(x.position,x.quaternion,x.scale)),FA===!0&&x.cameras.push(hA)}const RA=g.enabledFeatures;if(RA&&RA.includes("depth-sensing")&&g.depthUsage=="gpu-optimized"&&y){B=i.getBinding();const AA=B.getDepthInformation(KA[0]);AA&&AA.isValid&&AA.texture&&S.init(AA,g.renderState)}if(RA&&RA.includes("camera-access")&&y){A.state.unbindTexture(),B=i.getBinding();for(let AA=0;AA<KA.length;AA++){const tA=KA[AA].camera;if(tA){let iA=f[tA];iA||(iA=new s1,f[tA]=iA);const hA=B.getCameraImage(tA);iA.sourceTexture=hA}}}}for(let KA=0;KA<U.length;KA++){const FA=F[KA],RA=U[KA];FA!==null&&RA!==void 0&&RA.update(FA,uA,r||n)}sA&&sA(IA,uA),uA.detectedPlanes&&i.dispatchEvent({type:"planesdetected",data:uA}),D=null}const mA=new uoA;mA.setAnimationLoop(rA),this.setAnimationLoop=function(IA){sA=IA},this.dispose=function(){}}}const Kh=new Wo,w8A=new Ai;function m8A(t,A){function e(S,f){S.matrixAutoUpdate===!0&&S.updateMatrix(),f.value.copy(S.matrix)}function i(S,f){f.color.getRGB(S.fogColor.value,ynA(t)),f.isFog?(S.fogNear.value=f.near,S.fogFar.value=f.far):f.isFogExp2&&(S.fogDensity.value=f.density)}function g(S,f,M,k,m){f.isMeshBasicMaterial||f.isMeshLambertMaterial?I(S,f):f.isMeshToonMaterial?(I(S,f),B(S,f)):f.isMeshPhongMaterial?(I(S,f),s(S,f)):f.isMeshStandardMaterial?(I(S,f),c(S,f),f.isMeshPhysicalMaterial&&E(S,f,m)):f.isMeshMatcapMaterial?(I(S,f),D(S,f)):f.isMeshDepthMaterial?I(S,f):f.isMeshDistanceMaterial?(I(S,f),y(S,f)):f.isMeshNormalMaterial?I(S,f):f.isLineBasicMaterial?(n(S,f),f.isLineDashedMaterial&&o(S,f)):f.isPointsMaterial?a(S,f,M,k):f.isSpriteMaterial?r(S,f):f.isShadowMaterial?(S.color.value.copy(f.color),S.opacity.value=f.opacity):f.isShaderMaterial&&(f.uniformsNeedUpdate=!1)}function I(S,f){S.opacity.value=f.opacity,f.color&&S.diffuse.value.copy(f.color),f.emissive&&S.emissive.value.copy(f.emissive).multiplyScalar(f.emissiveIntensity),f.map&&(S.map.value=f.map,e(f.map,S.mapTransform)),f.alphaMap&&(S.alphaMap.value=f.alphaMap,e(f.alphaMap,S.alphaMapTransform)),f.bumpMap&&(S.bumpMap.value=f.bumpMap,e(f.bumpMap,S.bumpMapTransform),S.bumpScale.value=f.bumpScale,f.side===Ir&&(S.bumpScale.value*=-1)),f.normalMap&&(S.normalMap.value=f.normalMap,e(f.normalMap,S.normalMapTransform),S.normalScale.value.copy(f.normalScale),f.side===Ir&&S.normalScale.value.negate()),f.displacementMap&&(S.displacementMap.value=f.displacementMap,e(f.displacementMap,S.displacementMapTransform),S.displacementScale.value=f.displacementScale,S.displacementBias.value=f.displacementBias),f.emissiveMap&&(S.emissiveMap.value=f.emissiveMap,e(f.emissiveMap,S.emissiveMapTransform)),f.specularMap&&(S.specularMap.value=f.specularMap,e(f.specularMap,S.specularMapTransform)),f.alphaTest>0&&(S.alphaTest.value=f.alphaTest);const M=A.get(f),k=M.envMap,m=M.envMapRotation;k&&(S.envMap.value=k,Kh.copy(m),Kh.x*=-1,Kh.y*=-1,Kh.z*=-1,k.isCubeTexture&&k.isRenderTargetTexture===!1&&(Kh.y*=-1,Kh.z*=-1),S.envMapRotation.value.setFromMatrix4(w8A.makeRotationFromEuler(Kh)),S.flipEnvMap.value=k.isCubeTexture&&k.isRenderTargetTexture===!1?-1:1,S.reflectivity.value=f.reflectivity,S.ior.value=f.ior,S.refractionRatio.value=f.refractionRatio),f.lightMap&&(S.lightMap.value=f.lightMap,S.lightMapIntensity.value=f.lightMapIntensity,e(f.lightMap,S.lightMapTransform)),f.aoMap&&(S.aoMap.value=f.aoMap,S.aoMapIntensity.value=f.aoMapIntensity,e(f.aoMap,S.aoMapTransform))}function n(S,f){S.diffuse.value.copy(f.color),S.opacity.value=f.opacity,f.map&&(S.map.value=f.map,e(f.map,S.mapTransform))}function o(S,f){S.dashSize.value=f.dashSize,S.totalSize.value=f.dashSize+f.gapSize,S.scale.value=f.scale}function a(S,f,M,k){S.diffuse.value.copy(f.color),S.opacity.value=f.opacity,S.size.value=f.size*M,S.scale.value=k*.5,f.map&&(S.map.value=f.map,e(f.map,S.uvTransform)),f.alphaMap&&(S.alphaMap.value=f.alphaMap,e(f.alphaMap,S.alphaMapTransform)),f.alphaTest>0&&(S.alphaTest.value=f.alphaTest)}function r(S,f){S.diffuse.value.copy(f.color),S.opacity.value=f.opacity,S.rotation.value=f.rotation,f.map&&(S.map.value=f.map,e(f.map,S.mapTransform)),f.alphaMap&&(S.alphaMap.value=f.alphaMap,e(f.alphaMap,S.alphaMapTransform)),f.alphaTest>0&&(S.alphaTest.value=f.alphaTest)}function s(S,f){S.specular.value.copy(f.specular),S.shininess.value=Math.max(f.shininess,1e-4)}function B(S,f){f.gradientMap&&(S.gradientMap.value=f.gradientMap)}function c(S,f){S.metalness.value=f.metalness,f.metalnessMap&&(S.metalnessMap.value=f.metalnessMap,e(f.metalnessMap,S.metalnessMapTransform)),S.roughness.value=f.roughness,f.roughnessMap&&(S.roughnessMap.value=f.roughnessMap,e(f.roughnessMap,S.roughnessMapTransform)),f.envMap&&(S.envMapIntensity.value=f.envMapIntensity)}function E(S,f,M){S.ior.value=f.ior,f.sheen>0&&(S.sheenColor.value.copy(f.sheenColor).multiplyScalar(f.sheen),S.sheenRoughness.value=f.sheenRoughness,f.sheenColorMap&&(S.sheenColorMap.value=f.sheenColorMap,e(f.sheenColorMap,S.sheenColorMapTransform)),f.sheenRoughnessMap&&(S.sheenRoughnessMap.value=f.sheenRoughnessMap,e(f.sheenRoughnessMap,S.sheenRoughnessMapTransform))),f.clearcoat>0&&(S.clearcoat.value=f.clearcoat,S.clearcoatRoughness.value=f.clearcoatRoughness,f.clearcoatMap&&(S.clearcoatMap.value=f.clearcoatMap,e(f.clearcoatMap,S.clearcoatMapTransform)),f.clearcoatRoughnessMap&&(S.clearcoatRoughnessMap.value=f.clearcoatRoughnessMap,e(f.clearcoatRoughnessMap,S.clearcoatRoughnessMapTransform)),f.clearcoatNormalMap&&(S.clearcoatNormalMap.value=f.clearcoatNormalMap,e(f.clearcoatNormalMap,S.clearcoatNormalMapTransform),S.clearcoatNormalScale.value.copy(f.clearcoatNormalScale),f.side===Ir&&S.clearcoatNormalScale.value.negate())),f.dispersion>0&&(S.dispersion.value=f.dispersion),f.iridescence>0&&(S.iridescence.value=f.iridescence,S.iridescenceIOR.value=f.iridescenceIOR,S.iridescenceThicknessMinimum.value=f.iridescenceThicknessRange[0],S.iridescenceThicknessMaximum.value=f.iridescenceThicknessRange[1],f.iridescenceMap&&(S.iridescenceMap.value=f.iridescenceMap,e(f.iridescenceMap,S.iridescenceMapTransform)),f.iridescenceThicknessMap&&(S.iridescenceThicknessMap.value=f.iridescenceThicknessMap,e(f.iridescenceThicknessMap,S.iridescenceThicknessMapTransform))),f.transmission>0&&(S.transmission.value=f.transmission,S.transmissionSamplerMap.value=M.texture,S.transmissionSamplerSize.value.set(M.width,M.height),f.transmissionMap&&(S.transmissionMap.value=f.transmissionMap,e(f.transmissionMap,S.transmissionMapTransform)),S.thickness.value=f.thickness,f.thicknessMap&&(S.thicknessMap.value=f.thicknessMap,e(f.thicknessMap,S.thicknessMapTransform)),S.attenuationDistance.value=f.attenuationDistance,S.attenuationColor.value.copy(f.attenuationColor)),f.anisotropy>0&&(S.anisotropyVector.value.set(f.anisotropy*Math.cos(f.anisotropyRotation),f.anisotropy*Math.sin(f.anisotropyRotation)),f.anisotropyMap&&(S.anisotropyMap.value=f.anisotropyMap,e(f.anisotropyMap,S.anisotropyMapTransform))),S.specularIntensity.value=f.specularIntensity,S.specularColor.value.copy(f.specularColor),f.specularColorMap&&(S.specularColorMap.value=f.specularColorMap,e(f.specularColorMap,S.specularColorMapTransform)),f.specularIntensityMap&&(S.specularIntensityMap.value=f.specularIntensityMap,e(f.specularIntensityMap,S.specularIntensityMapTransform))}function D(S,f){f.matcap&&(S.matcap.value=f.matcap)}function y(S,f){const M=A.get(f).light;S.referencePosition.value.setFromMatrixPosition(M.matrixWorld),S.nearDistance.value=M.shadow.camera.near,S.farDistance.value=M.shadow.camera.far}return{refreshFogUniforms:i,refreshMaterialUniforms:g}}function k8A(t,A,e,i){let g={},I={},n=[];const o=t.getParameter(t.MAX_UNIFORM_BUFFER_BINDINGS);function a(M,k){const m=k.program;i.uniformBlockBinding(M,m)}function r(M,k){let m=g[M.id];m===void 0&&(D(M),m=s(M),g[M.id]=m,M.addEventListener("dispose",S));const U=k.program;i.updateUBOMapping(M,U);const F=A.render.frame;I[M.id]!==F&&(c(M),I[M.id]=F)}function s(M){const k=B();M.__bindingPointIndex=k;const m=t.createBuffer(),U=M.__size,F=M.usage;return t.bindBuffer(t.UNIFORM_BUFFER,m),t.bufferData(t.UNIFORM_BUFFER,U,F),t.bindBuffer(t.UNIFORM_BUFFER,null),t.bindBufferBase(t.UNIFORM_BUFFER,k,m),m}function B(){for(let M=0;M<o;M++)if(n.indexOf(M)===-1)return n.push(M),M;return 0}function c(M){const k=g[M.id],m=M.uniforms,U=M.__cache;t.bindBuffer(t.UNIFORM_BUFFER,k);for(let F=0,b=m.length;F<b;F++){const K=Array.isArray(m[F])?m[F]:[m[F]];for(let R=0,G=K.length;R<G;R++){const J=K[R];if(E(J,F,R,U)===!0){const x=J.__offset,H=Array.isArray(J.value)?J.value:[J.value];let P=0;for(let j=0;j<H.length;j++){const q=H[j],Y=y(q);typeof q=="number"||typeof q=="boolean"?(J.__data[0]=q,t.bufferSubData(t.UNIFORM_BUFFER,x+P,J.__data)):q.isMatrix3?(J.__data[0]=q.elements[0],J.__data[1]=q.elements[1],J.__data[2]=q.elements[2],J.__data[3]=0,J.__data[4]=q.elements[3],J.__data[5]=q.elements[4],J.__data[6]=q.elements[5],J.__data[7]=0,J.__data[8]=q.elements[6],J.__data[9]=q.elements[7],J.__data[10]=q.elements[8],J.__data[11]=0):(q.toArray(J.__data,P),P+=Y.storage/Float32Array.BYTES_PER_ELEMENT)}t.bufferSubData(t.UNIFORM_BUFFER,x,J.__data)}}}t.bindBuffer(t.UNIFORM_BUFFER,null)}function E(M,k,m,U){const F=M.value,b=k+"_"+m;if(U[b]===void 0)return typeof F=="number"||typeof F=="boolean"?U[b]=F:U[b]=F.clone(),!0;{const K=U[b];if(typeof F=="number"||typeof F=="boolean"){if(K!==F)return U[b]=F,!0}else if(K.equals(F)===!1)return K.copy(F),!0}return!1}function D(M){const k=M.uniforms;let m=0;const U=16;for(let b=0,K=k.length;b<K;b++){const R=Array.isArray(k[b])?k[b]:[k[b]];for(let G=0,J=R.length;G<J;G++){const x=R[G],H=Array.isArray(x.value)?x.value:[x.value];for(let P=0,j=H.length;P<j;P++){const q=H[P],Y=y(q),O=m%U,$=O%Y.boundary,gA=O+$;m+=$,gA!==0&&U-gA<Y.storage&&(m+=U-gA),x.__data=new Float32Array(Y.storage/Float32Array.BYTES_PER_ELEMENT),x.__offset=m,m+=Y.storage}}}const F=m%U;return F>0&&(m+=U-F),M.__size=m,M.__cache={},this}function y(M){const k={boundary:0,storage:0};return typeof M=="number"||typeof M=="boolean"?(k.boundary=4,k.storage=4):M.isVector2?(k.boundary=8,k.storage=8):M.isVector3||M.isColor?(k.boundary=16,k.storage=12):M.isVector4?(k.boundary=16,k.storage=16):M.isMatrix3?(k.boundary=48,k.storage=48):M.isMatrix4?(k.boundary=64,k.storage=64):M.isTexture,k}function S(M){const k=M.target;k.removeEventListener("dispose",S);const m=n.indexOf(k.__bindingPointIndex);n.splice(m,1),t.deleteBuffer(g[k.id]),delete g[k.id],delete I[k.id]}function f(){for(const M in g)t.deleteBuffer(g[M]);n=[],g={},I={}}return{bind:a,update:r,dispose:f}}class yoA{constructor(A={}){const{canvas:e=pnA(),context:i=null,depth:g=!0,stencil:I=!1,alpha:n=!1,antialias:o=!1,premultipliedAlpha:a=!0,preserveDrawingBuffer:r=!1,powerPreference:s="default",failIfMajorPerformanceCaveat:B=!1,reversedDepthBuffer:c=!1}=A;this.isWebGLRenderer=!0;let E;if(i!==null){if(typeof WebGLRenderingContext<"u"&&i instanceof WebGLRenderingContext)throw new Error("THREE.WebGLRenderer: WebGL 1 is not supported since r163.");E=i.getContextAttributes().alpha}else E=n;const D=new Uint32Array(4),y=new Int32Array(4);let S=null,f=null;const M=[],k=[];this.domElement=e,this.debug={checkShaderErrors:!0,onShaderError:null},this.autoClear=!0,this.autoClearColor=!0,this.autoClearDepth=!0,this.autoClearStencil=!0,this.sortObjects=!0,this.clippingPlanes=[],this.localClippingEnabled=!1,this.toneMapping=Tc,this.toneMappingExposure=1,this.transmissionResolutionScale=1;const m=this;let U=!1;this._outputColorSpace=Hn;let F=0,b=0,K=null,R=-1,G=null;const J=new wg,x=new wg;let H=null;const P=new wt(0);let j=0,q=e.width,Y=e.height,O=1,$=null,gA=null;const z=new wg(0,0,q,Y),X=new wg(0,0,q,Y);let sA=!1;const rA=new tS;let mA=!1,IA=!1;const uA=new Ai,KA=new wA,FA=new wg,RA={background:null,fog:null,environment:null,overrideMaterial:null,isScene:!0};let MA=!1;function oA(){return K===null?O:1}let AA=i;function tA(aA,QA){return e.getContext(aA,QA)}try{const aA={alpha:!0,depth:g,stencil:I,antialias:o,premultipliedAlpha:a,preserveDrawingBuffer:r,powerPreference:s,failIfMajorPerformanceCaveat:B};if("setAttribute"in e&&e.setAttribute("data-engine",`three.js r${jk}`),e.addEventListener("webglcontextlost",Re,!1),e.addEventListener("webglcontextrestored",CA,!1),e.addEventListener("webglcontextcreationerror",EA,!1),AA===null){const QA="webgl2";if(AA=tA(QA,aA),AA===null)throw tA(QA)?new Error("Error creating WebGL context with your selected attributes."):new Error("Error creating WebGL context.")}}catch(aA){throw aA}let iA,hA,DA,dA,SA,NA,OA,Qe,nA,eA,UA,HA,Se,ne,Oe,VA,de,te,WA,_A,zA,ge,he,ve;function bA(){iA=new L4A(AA),iA.init(),ge=new DoA(AA,iA),hA=new U4A(AA,iA,A,ge),DA=new d8A(AA,iA),hA.reversedDepthBuffer&&c&&DA.buffers.depth.setReversed(!0),dA=new T4A(AA),SA=new n8A,NA=new p8A(AA,iA,DA,SA,hA,ge,dA),OA=new F4A(m),Qe=new J4A(m),nA=new ZPA(AA),he=new G4A(AA,nA),eA=new q4A(AA,nA,dA,he),UA=new H4A(AA,eA,nA,dA),WA=new Y4A(AA,hA,NA),VA=new K4A(SA),HA=new I8A(m,OA,Qe,iA,hA,he,VA),Se=new m8A(m,SA),ne=new a8A,Oe=new l8A(iA),te=new N4A(m,OA,Qe,DA,UA,E,a),de=new u8A(m,UA,hA),ve=new k8A(AA,dA,hA,DA),_A=new R4A(AA,iA,dA),zA=new x4A(AA,iA,dA),dA.programs=HA.programs,m.capabilities=hA,m.extensions=iA,m.properties=SA,m.renderLists=ne,m.shadowMap=de,m.state=DA,m.info=dA}bA();const pA=new S8A(m,AA);this.xr=pA,this.getContext=function(){return AA},this.getContextAttributes=function(){return AA.getContextAttributes()},this.forceContextLoss=function(){const aA=iA.get("WEBGL_lose_context");aA&&aA.loseContext()},this.forceContextRestore=function(){const aA=iA.get("WEBGL_lose_context");aA&&aA.restoreContext()},this.getPixelRatio=function(){return O},this.setPixelRatio=function(aA){aA!==void 0&&(O=aA,this.setSize(q,Y,!1))},this.getSize=function(aA){return aA.set(q,Y)},this.setSize=function(aA,QA,JA=!0){pA.isPresenting||(q=aA,Y=QA,e.width=Math.floor(aA*O),e.height=Math.floor(QA*O),JA===!0&&(e.style.width=aA+"px",e.style.height=QA+"px"),this.setViewport(0,0,aA,QA))},this.getDrawingBufferSize=function(aA){return aA.set(q*O,Y*O).floor()},this.setDrawingBufferSize=function(aA,QA,JA){q=aA,Y=QA,O=JA,e.width=Math.floor(aA*JA),e.height=Math.floor(QA*JA),this.setViewport(0,0,aA,QA)},this.getCurrentViewport=function(aA){return aA.copy(J)},this.getViewport=function(aA){return aA.copy(z)},this.setViewport=function(aA,QA,JA,ee){aA.isVector4?z.set(aA.x,aA.y,aA.z,aA.w):z.set(aA,QA,JA,ee),DA.viewport(J.copy(z).multiplyScalar(O).round())},this.getScissor=function(aA){return aA.copy(X)},this.setScissor=function(aA,QA,JA,ee){aA.isVector4?X.set(aA.x,aA.y,aA.z,aA.w):X.set(aA,QA,JA,ee),DA.scissor(x.copy(X).multiplyScalar(O).round())},this.getScissorTest=function(){return sA},this.setScissorTest=function(aA){DA.setScissorTest(sA=aA)},this.setOpaqueSort=function(aA){$=aA},this.setTransparentSort=function(aA){gA=aA},this.getClearColor=function(aA){return aA.copy(te.getClearColor())},this.setClearColor=function(){te.setClearColor(...arguments)},this.getClearAlpha=function(){return te.getClearAlpha()},this.setClearAlpha=function(){te.setClearAlpha(...arguments)},this.clear=function(aA=!0,QA=!0,JA=!0){let ee=0;if(aA){let GA=!1;if(K!==null){const oe=K.texture.format;GA=oe===Tb||oe===xb||oe===zk}if(GA){const oe=K.texture.type,Xe=oe===QC||oe===wQ||oe===cy||oe===ly||oe===Jb||oe===Lb,Qt=te.getClearColor(),nt=te.getClearAlpha(),Dt=Qt.r,it=Qt.g,Mt=Qt.b;Xe?(D[0]=Dt,D[1]=it,D[2]=Mt,D[3]=nt,AA.clearBufferuiv(AA.COLOR,0,D)):(y[0]=Dt,y[1]=it,y[2]=Mt,y[3]=nt,AA.clearBufferiv(AA.COLOR,0,y))}else ee|=AA.COLOR_BUFFER_BIT}QA&&(ee|=AA.DEPTH_BUFFER_BIT),JA&&(ee|=AA.STENCIL_BUFFER_BIT,this.state.buffers.stencil.setMask(4294967295)),AA.clear(ee)},this.clearColor=function(){this.clear(!0,!1,!1)},this.clearDepth=function(){this.clear(!1,!0,!1)},this.clearStencil=function(){this.clear(!1,!1,!0)},this.dispose=function(){e.removeEventListener("webglcontextlost",Re,!1),e.removeEventListener("webglcontextrestored",CA,!1),e.removeEventListener("webglcontextcreationerror",EA,!1),te.dispose(),ne.dispose(),Oe.dispose(),SA.dispose(),OA.dispose(),Qe.dispose(),UA.dispose(),he.dispose(),ve.dispose(),HA.dispose(),pA.dispose(),pA.removeEventListener("sessionstart",Ut),pA.removeEventListener("sessionend",pg),Ge.stop()};function Re(aA){aA.preventDefault(),U=!0}function CA(){U=!1;const aA=dA.autoReset,QA=de.enabled,JA=de.autoUpdate,ee=de.needsUpdate,GA=de.type;bA(),dA.autoReset=aA,de.enabled=QA,de.autoUpdate=JA,de.needsUpdate=ee,de.type=GA}function EA(aA){}function yA(aA){const QA=aA.target;QA.removeEventListener("dispose",yA),xA(QA)}function xA(aA){XA(aA),SA.remove(aA)}function XA(aA){const QA=SA.get(aA).programs;QA!==void 0&&(QA.forEach(function(JA){HA.releaseProgram(JA)}),aA.isShaderMaterial&&HA.releaseShaderCache(aA))}this.renderBufferDirect=function(aA,QA,JA,ee,GA,oe){QA===null&&(QA=RA);const Xe=GA.isMesh&&GA.matrixWorld.determinant()<0,Qt=at(aA,QA,JA,ee,GA);DA.setMaterial(ee,Xe);let nt=JA.index,Dt=1;if(ee.wireframe===!0){if(nt=eA.getWireframeAttribute(JA),nt===void 0)return;Dt=2}const it=JA.drawRange,Mt=JA.attributes.position;let Zt=it.start*Dt,Ri=(it.start+it.count)*Dt;oe!==null&&(Zt=Math.max(Zt,oe.start*Dt),Ri=Math.min(Ri,(oe.start+oe.count)*Dt)),nt!==null?(Zt=Math.max(Zt,0),Ri=Math.min(Ri,nt.count)):Mt!=null&&(Zt=Math.max(Zt,0),Ri=Math.min(Ri,Mt.count));const Ui=Ri-Zt;if(Ui<0||Ui===1/0)return;he.setup(GA,ee,Qt,JA,nt);let qi,ei=_A;if(nt!==null&&(qi=nA.get(nt),ei=zA,ei.setIndex(qi)),GA.isMesh)ee.wireframe===!0?(DA.setLineWidth(ee.wireframeLinewidth*oA()),ei.setMode(AA.LINES)):ei.setMode(AA.TRIANGLES);else if(GA.isLine){let yt=ee.linewidth;yt===void 0&&(yt=1),DA.setLineWidth(yt*oA()),GA.isLineSegments?ei.setMode(AA.LINES):GA.isLineLoop?ei.setMode(AA.LINE_LOOP):ei.setMode(AA.LINE_STRIP)}else GA.isPoints?ei.setMode(AA.POINTS):GA.isSprite&&ei.setMode(AA.TRIANGLES);if(GA.isBatchedMesh)if(GA._multiDrawInstances!==null)O0("THREE.WebGLRenderer: renderMultiDrawInstances has been deprecated and will be removed in r184. Append to renderMultiDraw arguments and use indirection."),ei.renderMultiDrawInstances(GA._multiDrawStarts,GA._multiDrawCounts,GA._multiDrawCount,GA._multiDrawInstances);else if(iA.get("WEBGL_multi_draw"))ei.renderMultiDraw(GA._multiDrawStarts,GA._multiDrawCounts,GA._multiDrawCount);else{const yt=GA._multiDrawStarts,Si=GA._multiDrawCounts,ti=GA._multiDrawCount,Xg=nt?nA.get(nt).bytesPerElement:1,cI=SA.get(ee).currentProgram.getUniforms();for(let bg=0;bg<ti;bg++)cI.setValue(AA,"_gl_DrawID",bg),ei.render(yt[bg]/Xg,Si[bg])}else if(GA.isInstancedMesh)ei.renderInstances(Zt,Ui,GA.count);else if(JA.isInstancedBufferGeometry){const yt=JA._maxInstanceCount!==void 0?JA._maxInstanceCount:1/0,Si=Math.min(JA.instanceCount,yt);ei.renderInstances(Zt,Ui,Si)}else ei.render(Zt,Ui)};function pe(aA,QA,JA){aA.transparent===!0&&aA.side===sB&&aA.forceSinglePass===!1?(aA.side=Ir,aA.needsUpdate=!0,jA(aA,QA,JA),aA.side=jc,aA.needsUpdate=!0,jA(aA,QA,JA),aA.side=sB):jA(aA,QA,JA)}this.compile=function(aA,QA,JA=null){JA===null&&(JA=aA),f=Oe.get(JA),f.init(QA),k.push(f),JA.traverseVisible(function(GA){GA.isLight&&GA.layers.test(QA.layers)&&(f.pushLight(GA),GA.castShadow&&f.pushShadow(GA))}),aA!==JA&&aA.traverseVisible(function(GA){GA.isLight&&GA.layers.test(QA.layers)&&(f.pushLight(GA),GA.castShadow&&f.pushShadow(GA))}),f.setupLights();const ee=new Set;return aA.traverse(function(GA){if(!(GA.isMesh||GA.isPoints||GA.isLine||GA.isSprite))return;const oe=GA.material;if(oe)if(Array.isArray(oe))for(let Xe=0;Xe<oe.length;Xe++){const Qt=oe[Xe];pe(Qt,JA,GA),ee.add(Qt)}else pe(oe,JA,GA),ee.add(oe)}),f=k.pop(),ee},this.compileAsync=function(aA,QA,JA=null){const ee=this.compile(aA,QA,JA);return new Promise(GA=>{function oe(){if(ee.forEach(function(Xe){SA.get(Xe).currentProgram.isReady()&&ee.delete(Xe)}),ee.size===0){GA(aA);return}setTimeout(oe,10)}iA.get("KHR_parallel_shader_compile")!==null?oe():setTimeout(oe,10)})};let be=null;function It(aA){be&&be(aA)}function Ut(){Ge.stop()}function pg(){Ge.start()}const Ge=new uoA;Ge.setAnimationLoop(It),typeof self<"u"&&Ge.setContext(self),this.setAnimationLoop=function(aA){be=aA,pA.setAnimationLoop(aA),aA===null?Ge.stop():Ge.start()},pA.addEventListener("sessionstart",Ut),pA.addEventListener("sessionend",pg),this.render=function(aA,QA){if(QA!==void 0&&QA.isCamera!==!0||U===!0)return;if(aA.matrixWorldAutoUpdate===!0&&aA.updateMatrixWorld(),QA.parent===null&&QA.matrixWorldAutoUpdate===!0&&QA.updateMatrixWorld(),pA.enabled===!0&&pA.isPresenting===!0&&(pA.cameraAutoUpdate===!0&&pA.updateCamera(QA),QA=pA.getCamera()),aA.isScene===!0&&aA.onBeforeRender(m,aA,QA,K),f=Oe.get(aA,k.length),f.init(QA),k.push(f),uA.multiplyMatrices(QA.projectionMatrix,QA.matrixWorldInverse),rA.setFromProjectionMatrix(uA,cs,QA.reversedDepth),IA=this.localClippingEnabled,mA=VA.init(this.clippingPlanes,IA),S=ne.get(aA,M.length),S.init(),M.push(S),pA.enabled===!0&&pA.isPresenting===!0){const oe=m.xr.getDepthSensingMesh();oe!==null&&lt(oe,QA,-1/0,m.sortObjects)}lt(aA,QA,0,m.sortObjects),S.finish(),m.sortObjects===!0&&S.sort($,gA),MA=pA.enabled===!1||pA.isPresenting===!1||pA.hasDepthSensing()===!1,MA&&te.addToRenderList(S,aA),this.info.render.frame++,mA===!0&&VA.beginShadows();const JA=f.state.shadowsArray;de.render(JA,aA,QA),mA===!0&&VA.endShadows(),this.info.autoReset===!0&&this.info.reset();const ee=S.opaque,GA=S.transmissive;if(f.setupLights(),QA.isArrayCamera){const oe=QA.cameras;if(GA.length>0)for(let Xe=0,Qt=oe.length;Xe<Qt;Xe++){const nt=oe[Xe];Yt(ee,GA,aA,nt)}MA&&te.render(aA);for(let Xe=0,Qt=oe.length;Xe<Qt;Xe++){const nt=oe[Xe];Rt(S,aA,nt,nt.viewport)}}else GA.length>0&&Yt(ee,GA,aA,QA),MA&&te.render(aA),Rt(S,aA,QA);K!==null&&b===0&&(NA.updateMultisampleRenderTarget(K),NA.updateRenderTargetMipmap(K)),aA.isScene===!0&&aA.onAfterRender(m,aA,QA),he.resetDefaultState(),R=-1,G=null,k.pop(),k.length>0?(f=k[k.length-1],mA===!0&&VA.setGlobalState(m.clippingPlanes,f.state.camera)):f=null,M.pop(),M.length>0?S=M[M.length-1]:S=null};function lt(aA,QA,JA,ee){if(aA.visible===!1)return;if(aA.layers.test(QA.layers)){if(aA.isGroup)JA=aA.renderOrder;else if(aA.isLOD)aA.autoUpdate===!0&&aA.update(QA);else if(aA.isLight)f.pushLight(aA),aA.castShadow&&f.pushShadow(aA);else if(aA.isSprite){if(!aA.frustumCulled||rA.intersectsSprite(aA)){ee&&FA.setFromMatrixPosition(aA.matrixWorld).applyMatrix4(uA);const Xe=UA.update(aA),Qt=aA.material;Qt.visible&&S.push(aA,Xe,Qt,JA,FA.z,null)}}else if((aA.isMesh||aA.isLine||aA.isPoints)&&(!aA.frustumCulled||rA.intersectsObject(aA))){const Xe=UA.update(aA),Qt=aA.material;if(ee&&(aA.boundingSphere!==void 0?(aA.boundingSphere===null&&aA.computeBoundingSphere(),FA.copy(aA.boundingSphere.center)):(Xe.boundingSphere===null&&Xe.computeBoundingSphere(),FA.copy(Xe.boundingSphere.center)),FA.applyMatrix4(aA.matrixWorld).applyMatrix4(uA)),Array.isArray(Qt)){const nt=Xe.groups;for(let Dt=0,it=nt.length;Dt<it;Dt++){const Mt=nt[Dt],Zt=Qt[Mt.materialIndex];Zt&&Zt.visible&&S.push(aA,Xe,Zt,JA,FA.z,Mt)}}else Qt.visible&&S.push(aA,Xe,Qt,JA,FA.z,null)}}const oe=aA.children;for(let Xe=0,Qt=oe.length;Xe<Qt;Xe++)lt(oe[Xe],QA,JA,ee)}function Rt(aA,QA,JA,ee){const GA=aA.opaque,oe=aA.transmissive,Xe=aA.transparent;f.setupLightsView(JA),mA===!0&&VA.setGlobalState(m.clippingPlanes,JA),ee&&DA.viewport(J.copy(ee)),GA.length>0&&st(GA,QA,JA),oe.length>0&&st(oe,QA,JA),Xe.length>0&&st(Xe,QA,JA),DA.buffers.depth.setTest(!0),DA.buffers.depth.setMask(!0),DA.buffers.color.setMask(!0),DA.setPolygonOffset(!1)}function Yt(aA,QA,JA,ee){if((JA.isScene===!0?JA.overrideMaterial:null)!==null)return;f.state.transmissionRenderTarget[ee.id]===void 0&&(f.state.transmissionRenderTarget[ee.id]=new SB(1,1,{generateMipmaps:!0,type:iA.has("EXT_color_buffer_half_float")||iA.has("EXT_color_buffer_float")?Bp:QC,minFilter:oC,samples:4,stencilBuffer:I,resolveDepthBuffer:!1,resolveStencilBuffer:!1,colorSpace:Qg.workingColorSpace}));const oe=f.state.transmissionRenderTarget[ee.id],Xe=ee.viewport||J;oe.setSize(Xe.z*m.transmissionResolutionScale,Xe.w*m.transmissionResolutionScale);const Qt=m.getRenderTarget(),nt=m.getActiveCubeFace(),Dt=m.getActiveMipmapLevel();m.setRenderTarget(oe),m.getClearColor(P),j=m.getClearAlpha(),j<1&&m.setClearColor(16777215,.5),m.clear(),MA&&te.render(JA);const it=m.toneMapping;m.toneMapping=Tc;const Mt=ee.viewport;if(ee.viewport!==void 0&&(ee.viewport=void 0),f.setupLightsView(ee),mA===!0&&VA.setGlobalState(m.clippingPlanes,ee),st(aA,JA,ee),NA.updateMultisampleRenderTarget(oe),NA.updateRenderTargetMipmap(oe),iA.has("WEBGL_multisampled_render_to_texture")===!1){let Zt=!1;for(let Ri=0,Ui=QA.length;Ri<Ui;Ri++){const qi=QA[Ri],ei=qi.object,yt=qi.geometry,Si=qi.material,ti=qi.group;if(Si.side===sB&&ei.layers.test(ee.layers)){const Xg=Si.side;Si.side=Ir,Si.needsUpdate=!0,Be(ei,JA,ee,yt,Si,ti),Si.side=Xg,Si.needsUpdate=!0,Zt=!0}}Zt===!0&&(NA.updateMultisampleRenderTarget(oe),NA.updateRenderTargetMipmap(oe))}m.setRenderTarget(Qt,nt,Dt),m.setClearColor(P,j),Mt!==void 0&&(ee.viewport=Mt),m.toneMapping=it}function st(aA,QA,JA){const ee=QA.isScene===!0?QA.overrideMaterial:null;for(let GA=0,oe=aA.length;GA<oe;GA++){const Xe=aA[GA],Qt=Xe.object,nt=Xe.geometry,Dt=Xe.group;let it=Xe.material;it.allowOverride===!0&&ee!==null&&(it=ee),Qt.layers.test(JA.layers)&&Be(Qt,QA,JA,nt,it,Dt)}}function Be(aA,QA,JA,ee,GA,oe){aA.onBeforeRender(m,QA,JA,ee,GA,oe),aA.modelViewMatrix.multiplyMatrices(JA.matrixWorldInverse,aA.matrixWorld),aA.normalMatrix.getNormalMatrix(aA.modelViewMatrix),GA.onBeforeRender(m,QA,JA,ee,aA,oe),GA.transparent===!0&&GA.side===sB&&GA.forceSinglePass===!1?(GA.side=Ir,GA.needsUpdate=!0,m.renderBufferDirect(JA,QA,ee,GA,aA,oe),GA.side=jc,GA.needsUpdate=!0,m.renderBufferDirect(JA,QA,ee,GA,aA,oe),GA.side=sB):m.renderBufferDirect(JA,QA,ee,GA,aA,oe),aA.onAfterRender(m,QA,JA,ee,GA,oe)}function jA(aA,QA,JA){QA.isScene!==!0&&(QA=RA);const ee=SA.get(aA),GA=f.state.lights,oe=f.state.shadowsArray,Xe=GA.state.version,Qt=HA.getParameters(aA,GA.state,oe,QA,JA),nt=HA.getProgramCacheKey(Qt);let Dt=ee.programs;ee.environment=aA.isMeshStandardMaterial?QA.environment:null,ee.fog=QA.fog,ee.envMap=(aA.isMeshStandardMaterial?Qe:OA).get(aA.envMap||ee.environment),ee.envMapRotation=ee.environment!==null&&aA.envMap===null?QA.environmentRotation:aA.envMapRotation,Dt===void 0&&(aA.addEventListener("dispose",yA),Dt=new Map,ee.programs=Dt);let it=Dt.get(nt);if(it!==void 0){if(ee.currentProgram===it&&ee.lightsStateVersion===Xe)return We(aA,Qt),it}else Qt.uniforms=HA.getUniforms(aA),aA.onBeforeCompile(Qt,m),it=HA.acquireProgram(Qt,nt),Dt.set(nt,it),ee.uniforms=Qt.uniforms;const Mt=ee.uniforms;return(!aA.isShaderMaterial&&!aA.isRawShaderMaterial||aA.clipping===!0)&&(Mt.clippingPlanes=VA.uniform),We(aA,Qt),ee.needsLights=ae(aA),ee.lightsStateVersion=Xe,ee.needsLights&&(Mt.ambientLightColor.value=GA.state.ambient,Mt.lightProbe.value=GA.state.probe,Mt.directionalLights.value=GA.state.directional,Mt.directionalLightShadows.value=GA.state.directionalShadow,Mt.spotLights.value=GA.state.spot,Mt.spotLightShadows.value=GA.state.spotShadow,Mt.rectAreaLights.value=GA.state.rectArea,Mt.ltc_1.value=GA.state.rectAreaLTC1,Mt.ltc_2.value=GA.state.rectAreaLTC2,Mt.pointLights.value=GA.state.point,Mt.pointLightShadows.value=GA.state.pointShadow,Mt.hemisphereLights.value=GA.state.hemi,Mt.directionalShadowMap.value=GA.state.directionalShadowMap,Mt.directionalShadowMatrix.value=GA.state.directionalShadowMatrix,Mt.spotShadowMap.value=GA.state.spotShadowMap,Mt.spotLightMatrix.value=GA.state.spotLightMatrix,Mt.spotLightMap.value=GA.state.spotLightMap,Mt.pointShadowMap.value=GA.state.pointShadowMap,Mt.pointShadowMatrix.value=GA.state.pointShadowMatrix),ee.currentProgram=it,ee.uniformsList=null,it}function Me(aA){if(aA.uniformsList===null){const QA=aA.currentProgram.getUniforms();aA.uniformsList=VR.seqWithValue(QA.seq,aA.uniforms)}return aA.uniformsList}function We(aA,QA){const JA=SA.get(aA);JA.outputColorSpace=QA.outputColorSpace,JA.batching=QA.batching,JA.batchingColor=QA.batchingColor,JA.instancing=QA.instancing,JA.instancingColor=QA.instancingColor,JA.instancingMorph=QA.instancingMorph,JA.skinning=QA.skinning,JA.morphTargets=QA.morphTargets,JA.morphNormals=QA.morphNormals,JA.morphColors=QA.morphColors,JA.morphTargetsCount=QA.morphTargetsCount,JA.numClippingPlanes=QA.numClippingPlanes,JA.numIntersection=QA.numClipIntersection,JA.vertexAlphas=QA.vertexAlphas,JA.vertexTangents=QA.vertexTangents,JA.toneMapping=QA.toneMapping}function at(aA,QA,JA,ee,GA){QA.isScene!==!0&&(QA=RA),NA.resetTextureUnits();const oe=QA.fog,Xe=ee.isMeshStandardMaterial?QA.environment:null,Qt=K===null?m.outputColorSpace:K.isXRRenderTarget===!0?K.texture.colorSpace:Cu,nt=(ee.isMeshStandardMaterial?Qe:OA).get(ee.envMap||Xe),Dt=ee.vertexColors===!0&&!!JA.attributes.color&&JA.attributes.color.itemSize===4,it=!!JA.attributes.tangent&&(!!ee.normalMap||ee.anisotropy>0),Mt=!!JA.morphAttributes.position,Zt=!!JA.morphAttributes.normal,Ri=!!JA.morphAttributes.color;let Ui=Tc;ee.toneMapped&&(K===null||K.isXRRenderTarget===!0)&&(Ui=m.toneMapping);const qi=JA.morphAttributes.position||JA.morphAttributes.normal||JA.morphAttributes.color,ei=qi!==void 0?qi.length:0,yt=SA.get(ee),Si=f.state.lights;if(mA===!0&&(IA===!0||aA!==G)){const fg=aA===G&&ee.id===R;VA.setState(ee,aA,fg)}let ti=!1;ee.version===yt.__version?(yt.needsLights&&yt.lightsStateVersion!==Si.state.version||yt.outputColorSpace!==Qt||GA.isBatchedMesh&&yt.batching===!1||!GA.isBatchedMesh&&yt.batching===!0||GA.isBatchedMesh&&yt.batchingColor===!0&&GA.colorTexture===null||GA.isBatchedMesh&&yt.batchingColor===!1&&GA.colorTexture!==null||GA.isInstancedMesh&&yt.instancing===!1||!GA.isInstancedMesh&&yt.instancing===!0||GA.isSkinnedMesh&&yt.skinning===!1||!GA.isSkinnedMesh&&yt.skinning===!0||GA.isInstancedMesh&&yt.instancingColor===!0&&GA.instanceColor===null||GA.isInstancedMesh&&yt.instancingColor===!1&&GA.instanceColor!==null||GA.isInstancedMesh&&yt.instancingMorph===!0&&GA.morphTexture===null||GA.isInstancedMesh&&yt.instancingMorph===!1&&GA.morphTexture!==null||yt.envMap!==nt||ee.fog===!0&&yt.fog!==oe||yt.numClippingPlanes!==void 0&&(yt.numClippingPlanes!==VA.numPlanes||yt.numIntersection!==VA.numIntersection)||yt.vertexAlphas!==Dt||yt.vertexTangents!==it||yt.morphTargets!==Mt||yt.morphNormals!==Zt||yt.morphColors!==Ri||yt.toneMapping!==Ui||yt.morphTargetsCount!==ei)&&(ti=!0):(ti=!0,yt.__version=ee.version);let Xg=yt.currentProgram;ti===!0&&(Xg=jA(ee,QA,GA));let cI=!1,bg=!1,yo=!1;const ci=Xg.getUniforms(),vg=yt.uniforms;if(DA.useProgram(Xg.program)&&(cI=!0,bg=!0,yo=!0),ee.id!==R&&(R=ee.id,bg=!0),cI||G!==aA){DA.buffers.depth.getReversed()&&aA.reversedDepth!==!0&&(aA._reversedDepth=!0,aA.updateProjectionMatrix()),ci.setValue(AA,"projectionMatrix",aA.projectionMatrix),ci.setValue(AA,"viewMatrix",aA.matrixWorldInverse);const kg=ci.map.cameraPosition;kg!==void 0&&kg.setValue(AA,KA.setFromMatrixPosition(aA.matrixWorld)),hA.logarithmicDepthBuffer&&ci.setValue(AA,"logDepthBufFC",2/(Math.log(aA.far+1)/Math.LN2)),(ee.isMeshPhongMaterial||ee.isMeshToonMaterial||ee.isMeshLambertMaterial||ee.isMeshBasicMaterial||ee.isMeshStandardMaterial||ee.isShaderMaterial)&&ci.setValue(AA,"isOrthographic",aA.isOrthographicCamera===!0),G!==aA&&(G=aA,bg=!0,yo=!0)}if(GA.isSkinnedMesh){ci.setOptional(AA,GA,"bindMatrix"),ci.setOptional(AA,GA,"bindMatrixInverse");const fg=GA.skeleton;fg&&(fg.boneTexture===null&&fg.computeBoneTexture(),ci.setValue(AA,"boneTexture",fg.boneTexture,NA))}GA.isBatchedMesh&&(ci.setOptional(AA,GA,"batchingTexture"),ci.setValue(AA,"batchingTexture",GA._matricesTexture,NA),ci.setOptional(AA,GA,"batchingIdTexture"),ci.setValue(AA,"batchingIdTexture",GA._indirectTexture,NA),ci.setOptional(AA,GA,"batchingColorTexture"),GA._colorsTexture!==null&&ci.setValue(AA,"batchingColorTexture",GA._colorsTexture,NA));const Zg=JA.morphAttributes;if((Zg.position!==void 0||Zg.normal!==void 0||Zg.color!==void 0)&&WA.update(GA,JA,Xg),(bg||yt.receiveShadow!==GA.receiveShadow)&&(yt.receiveShadow=GA.receiveShadow,ci.setValue(AA,"receiveShadow",GA.receiveShadow)),ee.isMeshGouraudMaterial&&ee.envMap!==null&&(vg.envMap.value=nt,vg.flipEnvMap.value=nt.isCubeTexture&&nt.isRenderTargetTexture===!1?-1:1),ee.isMeshStandardMaterial&&ee.envMap===null&&QA.environment!==null&&(vg.envMapIntensity.value=QA.environmentIntensity),bg&&(ci.setValue(AA,"toneMappingExposure",m.toneMappingExposure),yt.needsLights&&kA(vg,yo),oe&&ee.fog===!0&&Se.refreshFogUniforms(vg,oe),Se.refreshMaterialUniforms(vg,ee,O,Y,f.state.transmissionRenderTarget[aA.id]),VR.upload(AA,Me(yt),vg,NA)),ee.isShaderMaterial&&ee.uniformsNeedUpdate===!0&&(VR.upload(AA,Me(yt),vg,NA),ee.uniformsNeedUpdate=!1),ee.isSpriteMaterial&&ci.setValue(AA,"center",GA.center),ci.setValue(AA,"modelViewMatrix",GA.modelViewMatrix),ci.setValue(AA,"normalMatrix",GA.normalMatrix),ci.setValue(AA,"modelMatrix",GA.matrixWorld),ee.isShaderMaterial||ee.isRawShaderMaterial){const fg=ee.uniformsGroups;for(let kg=0,Qn=fg.length;kg<Qn;kg++){const fI=fg[kg];ve.update(fI,Xg),ve.bind(fI,Xg)}}return Xg}function kA(aA,QA){aA.ambientLightColor.needsUpdate=QA,aA.lightProbe.needsUpdate=QA,aA.directionalLights.needsUpdate=QA,aA.directionalLightShadows.needsUpdate=QA,aA.pointLights.needsUpdate=QA,aA.pointLightShadows.needsUpdate=QA,aA.spotLights.needsUpdate=QA,aA.spotLightShadows.needsUpdate=QA,aA.rectAreaLights.needsUpdate=QA,aA.hemisphereLights.needsUpdate=QA}function ae(aA){return aA.isMeshLambertMaterial||aA.isMeshToonMaterial||aA.isMeshPhongMaterial||aA.isMeshStandardMaterial||aA.isShadowMaterial||aA.isShaderMaterial&&aA.lights===!0}this.getActiveCubeFace=function(){return F},this.getActiveMipmapLevel=function(){return b},this.getRenderTarget=function(){return K},this.setRenderTargetTextures=function(aA,QA,JA){const ee=SA.get(aA);ee.__autoAllocateDepthBuffer=aA.resolveDepthBuffer===!1,ee.__autoAllocateDepthBuffer===!1&&(ee.__useRenderToTexture=!1),SA.get(aA.texture).__webglTexture=QA,SA.get(aA.depthTexture).__webglTexture=ee.__autoAllocateDepthBuffer?void 0:JA,ee.__hasExternalTextures=!0},this.setRenderTargetFramebuffer=function(aA,QA){const JA=SA.get(aA);JA.__webglFramebuffer=QA,JA.__useDefaultFramebuffer=QA===void 0};const Ye=AA.createFramebuffer();this.setRenderTarget=function(aA,QA=0,JA=0){K=aA,F=QA,b=JA;let ee=!0,GA=null,oe=!1,Xe=!1;if(aA){const nt=SA.get(aA);if(nt.__useDefaultFramebuffer!==void 0)DA.bindFramebuffer(AA.FRAMEBUFFER,null),ee=!1;else if(nt.__webglFramebuffer===void 0)NA.setupRenderTarget(aA);else if(nt.__hasExternalTextures)NA.rebindTextures(aA,SA.get(aA.texture).__webglTexture,SA.get(aA.depthTexture).__webglTexture);else if(aA.depthBuffer){const Mt=aA.depthTexture;if(nt.__boundDepthTexture!==Mt){if(Mt!==null&&SA.has(Mt)&&(aA.width!==Mt.image.width||aA.height!==Mt.image.height))throw new Error("WebGLRenderTarget: Attached DepthTexture is initialized to the incorrect size.");NA.setupDepthRenderbuffer(aA)}}const Dt=aA.texture;(Dt.isData3DTexture||Dt.isDataArrayTexture||Dt.isCompressedArrayTexture)&&(Xe=!0);const it=SA.get(aA).__webglFramebuffer;aA.isWebGLCubeRenderTarget?(Array.isArray(it[QA])?GA=it[QA][JA]:GA=it[QA],oe=!0):aA.samples>0&&NA.useMultisampledRTT(aA)===!1?GA=SA.get(aA).__webglMultisampledFramebuffer:Array.isArray(it)?GA=it[JA]:GA=it,J.copy(aA.viewport),x.copy(aA.scissor),H=aA.scissorTest}else J.copy(z).multiplyScalar(O).floor(),x.copy(X).multiplyScalar(O).floor(),H=sA;if(JA!==0&&(GA=Ye),DA.bindFramebuffer(AA.FRAMEBUFFER,GA)&&ee&&DA.drawBuffers(aA,GA),DA.viewport(J),DA.scissor(x),DA.setScissorTest(H),oe){const nt=SA.get(aA.texture);AA.framebufferTexture2D(AA.FRAMEBUFFER,AA.COLOR_ATTACHMENT0,AA.TEXTURE_CUBE_MAP_POSITIVE_X+QA,nt.__webglTexture,JA)}else if(Xe){const nt=QA;for(let Dt=0;Dt<aA.textures.length;Dt++){const it=SA.get(aA.textures[Dt]);AA.framebufferTextureLayer(AA.FRAMEBUFFER,AA.COLOR_ATTACHMENT0+Dt,it.__webglTexture,JA,nt)}}else if(aA!==null&&JA!==0){const nt=SA.get(aA.texture);AA.framebufferTexture2D(AA.FRAMEBUFFER,AA.COLOR_ATTACHMENT0,AA.TEXTURE_2D,nt.__webglTexture,JA)}R=-1},this.readRenderTargetPixels=function(aA,QA,JA,ee,GA,oe,Xe,Qt=0){if(!(aA&&aA.isWebGLRenderTarget))return;let nt=SA.get(aA).__webglFramebuffer;if(aA.isWebGLCubeRenderTarget&&Xe!==void 0&&(nt=nt[Xe]),nt){DA.bindFramebuffer(AA.FRAMEBUFFER,nt);try{const Dt=aA.textures[Qt],it=Dt.format,Mt=Dt.type;if(!hA.textureFormatReadable(it)||!hA.textureTypeReadable(Mt))return;QA>=0&&QA<=aA.width-ee&&JA>=0&&JA<=aA.height-GA&&(aA.textures.length>1&&AA.readBuffer(AA.COLOR_ATTACHMENT0+Qt),AA.readPixels(QA,JA,ee,GA,ge.convert(it),ge.convert(Mt),oe))}finally{const Dt=K!==null?SA.get(K).__webglFramebuffer:null;DA.bindFramebuffer(AA.FRAMEBUFFER,Dt)}}},this.readRenderTargetPixelsAsync=async function(aA,QA,JA,ee,GA,oe,Xe,Qt=0){if(!(aA&&aA.isWebGLRenderTarget))throw new Error("THREE.WebGLRenderer.readRenderTargetPixels: renderTarget is not THREE.WebGLRenderTarget.");let nt=SA.get(aA).__webglFramebuffer;if(aA.isWebGLCubeRenderTarget&&Xe!==void 0&&(nt=nt[Xe]),nt)if(QA>=0&&QA<=aA.width-ee&&JA>=0&&JA<=aA.height-GA){DA.bindFramebuffer(AA.FRAMEBUFFER,nt);const Dt=aA.textures[Qt],it=Dt.format,Mt=Dt.type;if(!hA.textureFormatReadable(it))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in RGBA or implementation defined format.");if(!hA.textureTypeReadable(Mt))throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: renderTarget is not in UnsignedByteType or implementation defined type.");const Zt=AA.createBuffer();AA.bindBuffer(AA.PIXEL_PACK_BUFFER,Zt),AA.bufferData(AA.PIXEL_PACK_BUFFER,oe.byteLength,AA.STREAM_READ),aA.textures.length>1&&AA.readBuffer(AA.COLOR_ATTACHMENT0+Qt),AA.readPixels(QA,JA,ee,GA,ge.convert(it),ge.convert(Mt),0);const Ri=K!==null?SA.get(K).__webglFramebuffer:null;DA.bindFramebuffer(AA.FRAMEBUFFER,Ri);const Ui=AA.fenceSync(AA.SYNC_GPU_COMMANDS_COMPLETE,0);return AA.flush(),await cHA(AA,Ui,4),AA.bindBuffer(AA.PIXEL_PACK_BUFFER,Zt),AA.getBufferSubData(AA.PIXEL_PACK_BUFFER,0,oe),AA.deleteBuffer(Zt),AA.deleteSync(Ui),oe}else throw new Error("THREE.WebGLRenderer.readRenderTargetPixelsAsync: requested read bounds are out of range.")},this.copyFramebufferToTexture=function(aA,QA=null,JA=0){const ee=Math.pow(2,-JA),GA=Math.floor(aA.image.width*ee),oe=Math.floor(aA.image.height*ee),Xe=QA!==null?QA.x:0,Qt=QA!==null?QA.y:0;NA.setTexture2D(aA,0),AA.copyTexSubImage2D(AA.TEXTURE_2D,JA,0,0,Xe,Qt,GA,oe),DA.unbindTexture()};const Pt=AA.createFramebuffer(),jt=AA.createFramebuffer();this.copyTextureToTexture=function(aA,QA,JA=null,ee=null,GA=0,oe=null){oe===null&&(GA!==0?(O0("WebGLRenderer: copyTextureToTexture function signature has changed to support src and dst mipmap levels."),oe=GA,GA=0):oe=0);let Xe,Qt,nt,Dt,it,Mt,Zt,Ri,Ui;const qi=aA.isCompressedTexture?aA.mipmaps[oe]:aA.image;if(JA!==null)Xe=JA.max.x-JA.min.x,Qt=JA.max.y-JA.min.y,nt=JA.isBox3?JA.max.z-JA.min.z:1,Dt=JA.min.x,it=JA.min.y,Mt=JA.isBox3?JA.min.z:0;else{const Zg=Math.pow(2,-GA);Xe=Math.floor(qi.width*Zg),Qt=Math.floor(qi.height*Zg),aA.isDataArrayTexture?nt=qi.depth:aA.isData3DTexture?nt=Math.floor(qi.depth*Zg):nt=1,Dt=0,it=0,Mt=0}ee!==null?(Zt=ee.x,Ri=ee.y,Ui=ee.z):(Zt=0,Ri=0,Ui=0);const ei=ge.convert(QA.format),yt=ge.convert(QA.type);let Si;QA.isData3DTexture?(NA.setTexture3D(QA,0),Si=AA.TEXTURE_3D):QA.isDataArrayTexture||QA.isCompressedArrayTexture?(NA.setTexture2DArray(QA,0),Si=AA.TEXTURE_2D_ARRAY):(NA.setTexture2D(QA,0),Si=AA.TEXTURE_2D),AA.pixelStorei(AA.UNPACK_FLIP_Y_WEBGL,QA.flipY),AA.pixelStorei(AA.UNPACK_PREMULTIPLY_ALPHA_WEBGL,QA.premultiplyAlpha),AA.pixelStorei(AA.UNPACK_ALIGNMENT,QA.unpackAlignment);const ti=AA.getParameter(AA.UNPACK_ROW_LENGTH),Xg=AA.getParameter(AA.UNPACK_IMAGE_HEIGHT),cI=AA.getParameter(AA.UNPACK_SKIP_PIXELS),bg=AA.getParameter(AA.UNPACK_SKIP_ROWS),yo=AA.getParameter(AA.UNPACK_SKIP_IMAGES);AA.pixelStorei(AA.UNPACK_ROW_LENGTH,qi.width),AA.pixelStorei(AA.UNPACK_IMAGE_HEIGHT,qi.height),AA.pixelStorei(AA.UNPACK_SKIP_PIXELS,Dt),AA.pixelStorei(AA.UNPACK_SKIP_ROWS,it),AA.pixelStorei(AA.UNPACK_SKIP_IMAGES,Mt);const ci=aA.isDataArrayTexture||aA.isData3DTexture,vg=QA.isDataArrayTexture||QA.isData3DTexture;if(aA.isDepthTexture){const Zg=SA.get(aA),fg=SA.get(QA),kg=SA.get(Zg.__renderTarget),Qn=SA.get(fg.__renderTarget);DA.bindFramebuffer(AA.READ_FRAMEBUFFER,kg.__webglFramebuffer),DA.bindFramebuffer(AA.DRAW_FRAMEBUFFER,Qn.__webglFramebuffer);for(let fI=0;fI<nt;fI++)ci&&(AA.framebufferTextureLayer(AA.READ_FRAMEBUFFER,AA.COLOR_ATTACHMENT0,SA.get(aA).__webglTexture,GA,Mt+fI),AA.framebufferTextureLayer(AA.DRAW_FRAMEBUFFER,AA.COLOR_ATTACHMENT0,SA.get(QA).__webglTexture,oe,Ui+fI)),AA.blitFramebuffer(Dt,it,Xe,Qt,Zt,Ri,Xe,Qt,AA.DEPTH_BUFFER_BIT,AA.NEAREST);DA.bindFramebuffer(AA.READ_FRAMEBUFFER,null),DA.bindFramebuffer(AA.DRAW_FRAMEBUFFER,null)}else if(GA!==0||aA.isRenderTargetTexture||SA.has(aA)){const Zg=SA.get(aA),fg=SA.get(QA);DA.bindFramebuffer(AA.READ_FRAMEBUFFER,Pt),DA.bindFramebuffer(AA.DRAW_FRAMEBUFFER,jt);for(let kg=0;kg<nt;kg++)ci?AA.framebufferTextureLayer(AA.READ_FRAMEBUFFER,AA.COLOR_ATTACHMENT0,Zg.__webglTexture,GA,Mt+kg):AA.framebufferTexture2D(AA.READ_FRAMEBUFFER,AA.COLOR_ATTACHMENT0,AA.TEXTURE_2D,Zg.__webglTexture,GA),vg?AA.framebufferTextureLayer(AA.DRAW_FRAMEBUFFER,AA.COLOR_ATTACHMENT0,fg.__webglTexture,oe,Ui+kg):AA.framebufferTexture2D(AA.DRAW_FRAMEBUFFER,AA.COLOR_ATTACHMENT0,AA.TEXTURE_2D,fg.__webglTexture,oe),GA!==0?AA.blitFramebuffer(Dt,it,Xe,Qt,Zt,Ri,Xe,Qt,AA.COLOR_BUFFER_BIT,AA.NEAREST):vg?AA.copyTexSubImage3D(Si,oe,Zt,Ri,Ui+kg,Dt,it,Xe,Qt):AA.copyTexSubImage2D(Si,oe,Zt,Ri,Dt,it,Xe,Qt);DA.bindFramebuffer(AA.READ_FRAMEBUFFER,null),DA.bindFramebuffer(AA.DRAW_FRAMEBUFFER,null)}else vg?aA.isDataTexture||aA.isData3DTexture?AA.texSubImage3D(Si,oe,Zt,Ri,Ui,Xe,Qt,nt,ei,yt,qi.data):QA.isCompressedArrayTexture?AA.compressedTexSubImage3D(Si,oe,Zt,Ri,Ui,Xe,Qt,nt,ei,qi.data):AA.texSubImage3D(Si,oe,Zt,Ri,Ui,Xe,Qt,nt,ei,yt,qi):aA.isDataTexture?AA.texSubImage2D(AA.TEXTURE_2D,oe,Zt,Ri,Xe,Qt,ei,yt,qi.data):aA.isCompressedTexture?AA.compressedTexSubImage2D(AA.TEXTURE_2D,oe,Zt,Ri,qi.width,qi.height,ei,qi.data):AA.texSubImage2D(AA.TEXTURE_2D,oe,Zt,Ri,Xe,Qt,ei,yt,qi);AA.pixelStorei(AA.UNPACK_ROW_LENGTH,ti),AA.pixelStorei(AA.UNPACK_IMAGE_HEIGHT,Xg),AA.pixelStorei(AA.UNPACK_SKIP_PIXELS,cI),AA.pixelStorei(AA.UNPACK_SKIP_ROWS,bg),AA.pixelStorei(AA.UNPACK_SKIP_IMAGES,yo),oe===0&&QA.generateMipmaps&&AA.generateMipmap(Si),DA.unbindTexture()},this.initRenderTarget=function(aA){SA.get(aA).__webglFramebuffer===void 0&&NA.setupRenderTarget(aA)},this.initTexture=function(aA){aA.isCubeTexture?NA.setTextureCube(aA,0):aA.isData3DTexture?NA.setTexture3D(aA,0):aA.isDataArrayTexture||aA.isCompressedArrayTexture?NA.setTexture2DArray(aA,0):NA.setTexture2D(aA,0),DA.unbindTexture()},this.resetState=function(){F=0,b=0,K=null,DA.reset(),he.reset()},typeof __THREE_DEVTOOLS__<"u"&&__THREE_DEVTOOLS__.dispatchEvent(new CustomEvent("observe",{detail:this}))}get coordinateSystem(){return cs}get outputColorSpace(){return this._outputColorSpace}set outputColorSpace(A){this._outputColorSpace=A;const e=this.getContext();e.drawingBufferColorSpace=Qg._getDrawingBufferColorSpace(A),e.unpackColorSpace=Qg._getUnpackColorSpace()}}const M8A=Object.freeze(Object.defineProperty({__proto__:null,ACESFilmicToneMapping:Wk,AddEquation:NE,AddOperation:zIA,AdditiveAnimationBlendMode:WP,AdditiveBlending:wY,AgXToneMapping:enA,AlphaFormat:PP,AlwaysCompare:unA,AlwaysDepth:uK,AlwaysStencilFunc:NY,AmbientLight:goA,AnimationAction:loA,AnimationClip:Sy,AnimationLoader:qOA,AnimationMixer:cPA,AnimationObjectGroup:CPA,AnimationUtils:vOA,ArcCurve:UnA,ArrayCamera:CoA,ArrowHelper:LPA,AttachedBindMode:MY,Audio:BoA,AudioAnalyser:ePA,AudioContext:k1,AudioListener:XOA,AudioLoader:WOA,AxesHelper:qPA,BackSide:Ir,BasicDepthPacking:anA,BasicShadowMap:GIA,BatchedMesh:NnA,Bone:Wb,BooleanKeyframeTrack:lp,Box2:yPA,Box3:Zo,Box3Helper:_PA,BoxGeometry:cp,BoxHelper:vPA,BufferAttribute:eg,BufferGeometry:fi,BufferGeometryLoader:roA,ByteType:TP,Cache:bc,Camera:Pb,CameraHelper:bPA,CanvasTexture:IOA,CapsuleGeometry:Av,CatmullRomCurve3:KnA,CineonToneMapping:$IA,CircleGeometry:ev,ClampToEdgeWrapping:Bs,Clock:M1,Color:wt,ColorKeyframeTrack:f1,ColorManagement:Qg,CompressedArrayTexture:iOA,CompressedCubeTexture:gOA,CompressedTexture:Xb,CompressedTextureLoader:xOA,ConeGeometry:eM,ConstantAlphaFactor:jIA,ConstantColorFactor:OIA,Controls:TPA,CubeCamera:SnA,CubeReflectionMapping:SQ,CubeRefractionMapping:ru,CubeTexture:Vk,CubeTextureLoader:TOA,CubeUVReflectionMapping:AS,CubicBezierCurve:B1,CubicBezierCurve3:FnA,CubicInterpolant:XnA,CullFaceBack:SY,CullFaceFront:NIA,CullFaceFrontBack:u2A,CullFaceNone:MIA,Curve:UB,CurvePath:vnA,CustomBlending:RIA,CustomToneMapping:AnA,CylinderGeometry:AM,Cylindrical:DPA,Data3DTexture:Ob,DataArrayTexture:Hb,DataTexture:Yc,DataTextureLoader:YOA,DataUtils:MHA,DecrementStencilOp:M2A,DecrementWrapStencilOp:G2A,DefaultLoadingManager:eoA,DepthFormat:Qy,DepthStencilFormat:Ey,DepthTexture:$b,DetachedBindMode:inA,DirectionalLight:m1,DirectionalLightHelper:FPA,DiscreteInterpolant:$nA,DodecahedronGeometry:tv,DoubleSide:sB,DstAlphaFactor:qIA,DstColorFactor:TIA,DynamicCopyUsage:H2A,DynamicDrawUsage:hnA,DynamicReadUsage:x2A,EdgesGeometry:RnA,EllipseCurve:iv,EqualCompare:cnA,EqualDepth:dK,EqualStencilFunc:F2A,EquirectangularReflectionMapping:L0,EquirectangularRefractionMapping:q0,Euler:Wo,EventDispatcher:$c,ExternalTexture:s1,ExtrudeGeometry:gv,FileLoader:Es,Float16BufferAttribute:bHA,Float32BufferAttribute:bt,FloatType:ir,Fog:Zb,FogExp2:jb,FramebufferTexture:tOA,FrontSide:jc,Frustum:tS,FrustumArray:zb,GLBufferAttribute:hPA,GLSL1:P2A,GLSL3:GY,GreaterCompare:lnA,GreaterDepth:fK,GreaterEqualCompare:EnA,GreaterEqualDepth:pK,GreaterEqualStencilFunc:J2A,GreaterStencilFunc:v2A,GridHelper:UPA,Group:$l,HalfFloatType:Bp,HemisphereLight:ioA,HemisphereLightHelper:RPA,IcosahedronGeometry:Iv,ImageBitmapLoader:soA,ImageLoader:W0,ImageUtils:fnA,IncrementStencilOp:k2A,IncrementWrapStencilOp:N2A,InstancedBufferAttribute:Fd,InstancedBufferGeometry:aoA,InstancedInterleavedBuffer:uPA,InstancedMesh:o1,Int16BufferAttribute:KHA,Int32BufferAttribute:FHA,Int8BufferAttribute:GHA,IntType:_b,InterleavedBuffer:Xk,InterleavedBufferAttribute:Bu,Interpolant:gS,InterpolateDiscrete:uy,InterpolateLinear:hy,InterpolateSmooth:WR,InterpolationSamplingMode:W2A,InterpolationSamplingType:Z2A,InvertStencilOp:R2A,KeepStencilOp:Yh,KeyframeTrack:fC,LOD:MnA,LatheGeometry:nv,Layers:fy,LessCompare:BnA,LessDepth:hK,LessEqualCompare:VP,LessEqualDepth:Kd,LessEqualStencilFunc:b2A,LessStencilFunc:K2A,Light:ku,LightProbe:ooA,Line:mQ,Line3:mPA,LineBasicMaterial:ya,LineCurve:c1,LineCurve3:bnA,LineDashedMaterial:WnA,LineLoop:a1,LineSegments:RB,LinearFilter:HI,LinearInterpolant:p1,LinearMipMapLinearFilter:f2A,LinearMipMapNearestFilter:p2A,LinearMipmapLinearFilter:oC,LinearMipmapNearestFilter:_D,LinearSRGBColorSpace:Cu,LinearToneMapping:VIA,LinearTransfer:T0,Loader:Sa,LoaderUtils:OE,LoadingManager:D1,LoopOnce:gnA,LoopPingPong:nnA,LoopRepeat:InA,MOUSE:Q2A,Material:Wn,MaterialLoader:cv,MathUtils:$P,Matrix2:U1,Matrix3:Ni,Matrix4:Ai,MaxEquation:bIA,Mesh:Cn,MeshBasicMaterial:ls,MeshDepthMaterial:u1,MeshDistanceMaterial:h1,MeshLambertMaterial:jnA,MeshMatcapMaterial:ZnA,MeshNormalMaterial:PnA,MeshPhongMaterial:HnA,MeshPhysicalMaterial:pC,MeshStandardMaterial:vd,MeshToonMaterial:OnA,MinEquation:FIA,MirroredRepeatWrapping:By,MixOperation:WIA,MultiplyBlending:kY,MultiplyOperation:Zk,NearestFilter:ho,NearestMipMapLinearFilter:d2A,NearestMipMapNearestFilter:h2A,NearestMipmapLinearFilter:Vh,NearestMipmapNearestFilter:vb,NeutralToneMapping:tnA,NeverCompare:CnA,NeverDepth:EK,NeverStencilFunc:U2A,NoBlending:oQ,NoColorSpace:zl,NoToneMapping:Tc,NormalAnimationBlendMode:Yb,NormalBlending:Qd,NotEqualCompare:QnA,NotEqualDepth:DK,NotEqualStencilFunc:_2A,NumberKeyframeTrack:_d,Object3D:ng,ObjectLoader:jOA,ObjectSpaceNormalMap:snA,OctahedronGeometry:tM,OneFactor:_IA,OneMinusConstantAlphaFactor:ZIA,OneMinusConstantColorFactor:PIA,OneMinusDstAlphaFactor:xIA,OneMinusDstColorFactor:YIA,OneMinusSrcAlphaFactor:QK,OneMinusSrcColorFactor:LIA,OrthographicCamera:IS,PCFShadowMap:Fb,PCFSoftShadowMap:Pm,PMREMGenerator:_Y,Path:eF,PerspectiveCamera:jn,Plane:mE,PlaneGeometry:iS,PlaneHelper:JPA,PointLight:w1,PointLightHelper:NPA,Points:r1,PointsMaterial:Vb,PolarGridHelper:KPA,PolyhedronGeometry:mu,PositionalAudio:APA,PropertyBinding:dg,PropertyMixer:coA,QuadraticBezierCurve:l1,QuadraticBezierCurve3:Q1,Quaternion:Kn,QuaternionKeyframeTrack:Jd,QuaternionLinearInterpolant:AoA,RED_GREEN_RGTC2_Format:WK,RED_RGTC1_Format:jK,REVISION:jk,RGBADepthPacking:rnA,RGBAFormat:da,RGBAIntegerFormat:Tb,RGBA_ASTC_10x10_Format:xK,RGBA_ASTC_10x5_Format:JK,RGBA_ASTC_10x6_Format:LK,RGBA_ASTC_10x8_Format:qK,RGBA_ASTC_12x10_Format:TK,RGBA_ASTC_12x12_Format:YK,RGBA_ASTC_4x4_Format:GK,RGBA_ASTC_5x4_Format:RK,RGBA_ASTC_5x5_Format:UK,RGBA_ASTC_6x5_Format:KK,RGBA_ASTC_6x6_Format:FK,RGBA_ASTC_8x5_Format:bK,RGBA_ASTC_8x6_Format:vK,RGBA_ASTC_8x8_Format:_K,RGBA_BPTC_Format:HK,RGBA_ETC2_EAC_Format:NK,RGBA_PVRTC_2BPPV1_Format:mK,RGBA_PVRTC_4BPPV1_Format:wK,RGBA_S3TC_DXT1_Format:Zm,RGBA_S3TC_DXT3_Format:Wm,RGBA_S3TC_DXT5_Format:zm,RGBDepthPacking:y2A,RGBFormat:jP,RGBIntegerFormat:D2A,RGB_BPTC_SIGNED_Format:OK,RGB_BPTC_UNSIGNED_Format:PK,RGB_ETC1_Format:kK,RGB_ETC2_Format:MK,RGB_PVRTC_2BPPV1_Format:SK,RGB_PVRTC_4BPPV1_Format:yK,RGB_S3TC_DXT1_Format:jm,RGDepthPacking:S2A,RGFormat:ZP,RGIntegerFormat:xb,RawShaderMaterial:YnA,Ray:eS,Raycaster:QoA,RectAreaLight:IoA,RedFormat:qb,RedIntegerFormat:zk,ReinhardToneMapping:XIA,RenderTarget:A1,RenderTarget3D:lPA,RepeatWrapping:su,ReplaceStencilOp:m2A,ReverseSubtractEquation:KIA,RingGeometry:ov,SIGNED_RED_GREEN_RGTC2_Format:zK,SIGNED_RED_RGTC1_Format:ZK,SRGBColorSpace:Hn,SRGBTransfer:Vg,Scene:g1,ShaderChunk:_i,ShaderLib:nB,ShaderMaterial:EC,ShadowMaterial:TnA,Shape:ud,ShapeGeometry:av,ShapePath:xPA,ShapeUtils:lB,ShortType:YP,Skeleton:$k,SkeletonHelper:MPA,SkinnedMesh:n1,Source:bE,Sphere:po,SphereGeometry:iM,Spherical:fPA,SphericalHarmonics3:noA,SplineCurve:E1,SpotLight:S1,SpotLightHelper:kPA,Sprite:knA,SpriteMaterial:I1,SrcAlphaFactor:lK,SrcAlphaSaturateFactor:HIA,SrcColorFactor:JIA,StaticCopyUsage:Y2A,StaticDrawUsage:Y0,StaticReadUsage:q2A,StereoCamera:zOA,StreamCopyUsage:O2A,StreamDrawUsage:L2A,StreamReadUsage:T2A,StringKeyframeTrack:Qp,SubtractEquation:UIA,SubtractiveBlending:mY,TOUCH:E2A,TangentSpaceNormalMap:wu,TetrahedronGeometry:rv,Texture:FI,TextureLoader:toA,TextureUtils:jPA,Timer:dPA,TimestampQuery:j2A,TorusGeometry:sv,TorusKnotGeometry:Cv,Triangle:Mr,TriangleFanDrawMode:VK,TriangleStripDrawMode:zP,TrianglesDrawMode:onA,TubeGeometry:Bv,UVMapping:bb,Uint16BufferAttribute:e1,Uint32BufferAttribute:t1,Uint8BufferAttribute:RHA,Uint8ClampedBufferAttribute:UHA,Uniform:R1,UniformsGroup:EPA,UniformsLib:kt,UniformsUtils:i1,UnsignedByteType:QC,UnsignedInt101111Type:OP,UnsignedInt248Type:ly,UnsignedInt5999Type:HP,UnsignedIntType:wQ,UnsignedShort4444Type:Jb,UnsignedShort5551Type:Lb,UnsignedShortType:cy,VSMShadowMap:eB,Vector2:Ze,Vector3:wA,Vector4:wg,VectorKeyframeTrack:Ld,VideoFrameTexture:eOA,VideoTexture:GnA,WebGL3DRenderTarget:hHA,WebGLArrayRenderTarget:uHA,WebGLCoordinateSystem:cs,WebGLCubeRenderTarget:wnA,WebGLRenderTarget:SB,WebGLRenderer:yoA,WebGLUtils:DoA,WebGPUCoordinateSystem:dy,WebXRController:zR,WireframeGeometry:xnA,WrapAroundEnding:x0,ZeroCurvatureEnding:Xh,ZeroFactor:vIA,ZeroSlopeEnding:$h,ZeroStencilOp:w2A,createCanvasElement:pnA},Symbol.toStringTag,{value:"Module"}));var vq={exports:{}},_q={},Jq={exports:{}},Lq={};/**
 * @license React
 * use-sync-external-store-shim.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 l9;function N8A(){if(l9)return Lq;l9=1;var t=Ry();function A(B,c){return B===c&&(B!==0||1/B===1/c)||B!==B&&c!==c}var e=typeof Object.is=="function"?Object.is:A,i=t.useState,g=t.useEffect,I=t.useLayoutEffect,n=t.useDebugValue;function o(B,c){var E=c(),D=i({inst:{value:E,getSnapshot:c}}),y=D[0].inst,S=D[1];return I(function(){y.value=E,y.getSnapshot=c,a(y)&&S({inst:y})},[B,E,c]),g(function(){return a(y)&&S({inst:y}),B(function(){a(y)&&S({inst:y})})},[B]),n(E),E}function a(B){var c=B.getSnapshot;B=B.value;try{var E=c();return!e(B,E)}catch{return!0}}function r(B,c){return c()}var s=typeof window>"u"||typeof window.document>"u"||typeof window.document.createElement>"u"?r:o;return Lq.useSyncExternalStore=t.useSyncExternalStore!==void 0?t.useSyncExternalStore:s,Lq}var Q9;function G8A(){return Q9||(Q9=1,Jq.exports=N8A()),Jq.exports}/**
 * @license React
 * use-sync-external-store-shim/with-selector.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 E9;function R8A(){if(E9)return _q;E9=1;var t=Ry(),A=G8A();function e(r,s){return r===s&&(r!==0||1/r===1/s)||r!==r&&s!==s}var i=typeof Object.is=="function"?Object.is:e,g=A.useSyncExternalStore,I=t.useRef,n=t.useEffect,o=t.useMemo,a=t.useDebugValue;return _q.useSyncExternalStoreWithSelector=function(r,s,B,c,E){var D=I(null);if(D.current===null){var y={hasValue:!1,value:null};D.current=y}else y=D.current;D=o(function(){function f(F){if(!M){if(M=!0,k=F,F=c(F),E!==void 0&&y.hasValue){var b=y.value;if(E(b,F))return m=b}return m=F}if(b=m,i(k,F))return b;var K=c(F);return E!==void 0&&E(b,K)?(k=F,b):(k=F,m=K)}var M=!1,k,m,U=B===void 0?null:B;return[function(){return f(s())},U===null?void 0:function(){return f(U())}]},[s,B,c,E]);var S=g(r,D[0],D[1]);return n(function(){y.hasValue=!0,y.value=S},[S]),a(S),S},_q}var u9;function U8A(){return u9||(u9=1,vq.exports=R8A()),vq.exports}var K8A=U8A();const F8A=Td(K8A),h9=t=>{let A;const e=new Set,i=(r,s)=>{const B=typeof r=="function"?r(A):r;if(!Object.is(B,A)){const c=A;A=s??(typeof B!="object"||B===null)?B:Object.assign({},A,B),e.forEach(E=>E(A,c))}},g=()=>A,o={setState:i,getState:g,getInitialState:()=>a,subscribe:r=>(e.add(r),()=>e.delete(r))},a=A=t(i,g,o);return o},SoA=t=>t?h9(t):h9,{useSyncExternalStoreWithSelector:b8A}=F8A,v8A=t=>t;function _8A(t,A=v8A,e){const i=b8A(t.subscribe,t.getState,t.getInitialState,A,e);return ke.useDebugValue(i),i}const d9=(t,A)=>{const e=SoA(t),i=(g,I=A)=>_8A(e,g,I);return Object.assign(i,e),i},J8A=(t,A)=>t?d9(t,A):d9,L8A=t=>typeof t=="object"&&typeof t.then=="function",ed=[];function woA(t,A,e=(i,g)=>i===g){if(t===A)return!0;if(!t||!A)return!1;const i=t.length;if(A.length!==i)return!1;for(let g=0;g<i;g++)if(!e(t[g],A[g]))return!1;return!0}function moA(t,A=null,e=!1,i={}){A===null&&(A=[t]);for(const I of ed)if(woA(A,I.keys,I.equal)){if(e)return;if(Object.prototype.hasOwnProperty.call(I,"error"))throw I.error;if(Object.prototype.hasOwnProperty.call(I,"response"))return i.lifespan&&i.lifespan>0&&(I.timeout&&clearTimeout(I.timeout),I.timeout=setTimeout(I.remove,i.lifespan)),I.response;if(!e)throw I.promise}const g={keys:A,equal:i.equal,remove:()=>{const I=ed.indexOf(g);I!==-1&&ed.splice(I,1)},promise:(L8A(t)?t:t(...A)).then(I=>{g.response=I,i.lifespan&&i.lifespan>0&&(g.timeout=setTimeout(g.remove,i.lifespan))}).catch(I=>g.error=I)};if(ed.push(g),!e)throw g.promise}const koA=(t,A,e)=>moA(t,A,!1,e),q8A=(t,A,e)=>void moA(t,A,!0,e),x8A=t=>{if(t===void 0||t.length===0)ed.splice(0,ed.length);else{const A=ed.find(e=>woA(t,e.keys,e.equal));A&&A.remove()}};var qq={exports:{}},xq={exports:{}},Tq={exports:{}},Yq={};/**
 * @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 p9;function T8A(){return p9||(p9=1,function(t){function A(q,Y){var O=q.length;q.push(Y);A:for(;0<O;){var $=O-1>>>1,gA=q[$];if(0<g(gA,Y))q[$]=Y,q[O]=gA,O=$;else break A}}function e(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var Y=q[0],O=q.pop();if(O!==Y){q[0]=O;A:for(var $=0,gA=q.length,z=gA>>>1;$<z;){var X=2*($+1)-1,sA=q[X],rA=X+1,mA=q[rA];if(0>g(sA,O))rA<gA&&0>g(mA,sA)?(q[$]=mA,q[rA]=O,$=rA):(q[$]=sA,q[X]=O,$=X);else if(rA<gA&&0>g(mA,O))q[$]=mA,q[rA]=O,$=rA;else break A}}return Y}function g(q,Y){var O=q.sortIndex-Y.sortIndex;return O!==0?O: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 n=Date,o=n.now();t.unstable_now=function(){return n.now()-o}}var a=[],r=[],s=1,B=null,c=3,E=!1,D=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function k(q){for(var Y=e(r);Y!==null;){if(Y.callback===null)i(r);else if(Y.startTime<=q)i(r),Y.sortIndex=Y.expirationTime,A(a,Y);else break;Y=e(r)}}function m(q){if(y=!1,k(q),!D)if(e(a)!==null)D=!0,P();else{var Y=e(r);Y!==null&&j(m,Y.startTime-q)}}var U=!1,F=-1,b=5,K=-1;function R(){return!(t.unstable_now()-K<b)}function G(){if(U){var q=t.unstable_now();K=q;var Y=!0;try{A:{D=!1,y&&(y=!1,f(F),F=-1),E=!0;var O=c;try{e:{for(k(q),B=e(a);B!==null&&!(B.expirationTime>q&&R());){var $=B.callback;if(typeof $=="function"){B.callback=null,c=B.priorityLevel;var gA=$(B.expirationTime<=q);if(q=t.unstable_now(),typeof gA=="function"){B.callback=gA,k(q),Y=!0;break e}B===e(a)&&i(a),k(q)}else i(a);B=e(a)}if(B!==null)Y=!0;else{var z=e(r);z!==null&&j(m,z.startTime-q),Y=!1}}break A}finally{B=null,c=O,E=!1}Y=void 0}}finally{Y?J():U=!1}}}var J;if(typeof M=="function")J=function(){M(G)};else if(typeof MessageChannel<"u"){var x=new MessageChannel,H=x.port2;x.port1.onmessage=G,J=function(){H.postMessage(null)}}else J=function(){S(G,0)};function P(){U||(U=!0,J())}function j(q,Y){F=S(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_continueExecution=function(){D||E||(D=!0,P())},t.unstable_forceFrameRate=function(q){0>q||125<q||(b=0<q?Math.floor(1e3/q):5)},t.unstable_getCurrentPriorityLevel=function(){return c},t.unstable_getFirstCallbackNode=function(){return e(a)},t.unstable_next=function(q){switch(c){case 1:case 2:case 3:var Y=3;break;default:Y=c}var O=c;c=Y;try{return q()}finally{c=O}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var O=c;c=q;try{return Y()}finally{c=O}},t.unstable_scheduleCallback=function(q,Y,O){var $=t.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?$+O:$):O=$,q){case 1:var gA=-1;break;case 2:gA=250;break;case 5:gA=1073741823;break;case 4:gA=1e4;break;default:gA=5e3}return gA=O+gA,q={id:s++,callback:Y,priorityLevel:q,startTime:O,expirationTime:gA,sortIndex:-1},O>$?(q.sortIndex=O,A(r,q),e(a)===null&&q===e(r)&&(y?(f(F),F=-1):y=!0,j(m,O-$))):(q.sortIndex=gA,A(a,q),D||E||(D=!0,P())),q},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(q){var Y=c;return function(){var O=c;c=Y;try{return q.apply(this,arguments)}finally{c=O}}}}(Yq)),Yq}var f9;function Y8A(){return f9||(f9=1,Tq.exports=T8A()),Tq.exports}/**
 * @license React
 * react-reconciler.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 D9;function H8A(){return D9||(D9=1,function(t){t.exports=function(A){function e(u,h,N,_){return new hS(u,h,N,_)}function i(){}function g(u){var h="https://react.dev/errors/"+u;if(1<arguments.length){h+="?args[]="+encodeURIComponent(arguments[1]);for(var N=2;N<arguments.length;N++)h+="&args[]="+encodeURIComponent(arguments[N])}return"Minified React error #"+u+"; visit "+h+" for the full message or use the non-minified dev environment for full errors and additional helpful warnings."}function I(u){return u===null||typeof u!="object"?null:(u=wS&&u[wS]||u["@@iterator"],typeof u=="function"?u:null)}function n(u){if(u==null)return null;if(typeof u=="function")return u.$$typeof===Ql?null:u.displayName||u.name||null;if(typeof u=="string")return u;switch(u){case TQ:return"Fragment";case Zr:return"Portal";case SS:return"Profiler";case yS:return"StrictMode";case Rp:return"Suspense";case zB:return"SuspenseList"}if(typeof u=="object")switch(u.$$typeof){case Ns:return(u.displayName||"Context")+".Provider";case WB:return(u._context.displayName||"Context")+".Consumer";case YQ:var h=u.render;return u=u.displayName,u||(u=h.displayName||h.name||"",u=u!==""?"ForwardRef("+u+")":"ForwardRef"),u;case Hu:return h=u.displayName||null,h!==null?h:n(u.type)||"Memo";case Wr:h=u._payload,u=u._init;try{return n(u(h))}catch{}}return null}function o(u){if(Up===void 0)try{throw Error()}catch(N){var h=N.stack.trim().match(/\n( *(at )?)/);Up=h&&h[1]||"",mS=-1<N.stack.indexOf(`
    at`)?" (<anonymous>)":-1<N.stack.indexOf("@")?"@unknown:0:0":""}return`
`+Up+u+mS}function a(u,h){if(!u||VB)return"";VB=!0;var N=Error.prepareStackTrace;Error.prepareStackTrace=void 0;try{var _={DetermineComponentFrameRoot:function(){try{if(h){var mt=function(){throw Error()};if(Object.defineProperty(mt.prototype,"props",{set:function(){throw Error()}}),typeof Reflect=="object"&&Reflect.construct){try{Reflect.construct(mt,[])}catch(Ei){var Gt=Ei}Reflect.construct(u,[],mt)}else{try{mt.call()}catch(Ei){Gt=Ei}u.call(mt.prototype)}}else{try{throw Error()}catch(Ei){Gt=Ei}(mt=u())&&typeof mt.catch=="function"&&mt.catch(function(){})}}catch(Ei){if(Ei&&Gt&&typeof Ei.stack=="string")return[Ei.stack,Gt.stack]}return[null,null]}};_.DetermineComponentFrameRoot.displayName="DetermineComponentFrameRoot";var T=Object.getOwnPropertyDescriptor(_.DetermineComponentFrameRoot,"name");T&&T.configurable&&Object.defineProperty(_.DetermineComponentFrameRoot,"name",{value:"DetermineComponentFrameRoot"});var W=_.DetermineComponentFrameRoot(),lA=W[0],TA=W[1];if(lA&&TA){var le=lA.split(`
`),qe=TA.split(`
`);for(T=_=0;_<le.length&&!le[_].includes("DetermineComponentFrameRoot");)_++;for(;T<qe.length&&!qe[T].includes("DetermineComponentFrameRoot");)T++;if(_===le.length||T===qe.length)for(_=le.length-1,T=qe.length-1;1<=_&&0<=T&&le[_]!==qe[T];)T--;for(;1<=_&&0<=T;_--,T--)if(le[_]!==qe[T]){if(_!==1||T!==1)do if(_--,T--,0>T||le[_]!==qe[T]){var rt=`
`+le[_].replace(" at new "," at ");return u.displayName&&rt.includes("<anonymous>")&&(rt=rt.replace("<anonymous>",u.displayName)),rt}while(1<=_&&0<=T);break}}}finally{VB=!1,Error.prepareStackTrace=N}return(N=u?u.displayName||u.name:"")?o(N):""}function r(u){switch(u.tag){case 26:case 27:case 5:return o(u.type);case 16:return o("Lazy");case 13:return o("Suspense");case 19:return o("SuspenseList");case 0:case 15:return u=a(u.type,!1),u;case 11:return u=a(u.type.render,!1),u;case 1:return u=a(u.type,!0),u;default:return""}}function s(u){try{var h="";do h+=r(u),u=u.return;while(u);return h}catch(N){return`
Error generating stack: `+N.message+`
`+N.stack}}function B(u){var h=u,N=u;if(u.alternate)for(;h.return;)h=h.return;else{u=h;do h=u,(h.flags&4098)!==0&&(N=h.return),u=h.return;while(u)}return h.tag===3?N:null}function c(u){if(B(u)!==u)throw Error(g(188))}function E(u){var h=u.alternate;if(!h){if(h=B(u),h===null)throw Error(g(188));return h!==u?null:u}for(var N=u,_=h;;){var T=N.return;if(T===null)break;var W=T.alternate;if(W===null){if(_=T.return,_!==null){N=_;continue}break}if(T.child===W.child){for(W=T.child;W;){if(W===N)return c(T),u;if(W===_)return c(T),h;W=W.sibling}throw Error(g(188))}if(N.return!==_.return)N=T,_=W;else{for(var lA=!1,TA=T.child;TA;){if(TA===N){lA=!0,N=T,_=W;break}if(TA===_){lA=!0,_=T,N=W;break}TA=TA.sibling}if(!lA){for(TA=W.child;TA;){if(TA===N){lA=!0,N=W,_=T;break}if(TA===_){lA=!0,_=W,N=T;break}TA=TA.sibling}if(!lA)throw Error(g(189))}}if(N.alternate!==_)throw Error(g(190))}if(N.tag!==3)throw Error(g(188));return N.stateNode.current===N?u:h}function D(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u;for(u=u.child;u!==null;){if(h=D(u),h!==null)return h;u=u.sibling}return null}function y(u){var h=u.tag;if(h===5||h===26||h===27||h===6)return u;for(u=u.child;u!==null;){if(u.tag!==4&&(h=y(u),h!==null))return h;u=u.sibling}return null}function S(u){return{current:u}}function f(u){0>LC||(u.current=$u[LC],$u[LC]=null,LC--)}function M(u,h){LC++,$u[LC]=u.current,u.current=h}function k(u){return u>>>=0,u===0?32:31-(Ah(u)/xM|0)|0}function m(u){var h=u&42;if(h!==0)return h;switch(u&-u){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: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 u&4194176;case 4194304:case 8388608:case 16777216:case 33554432:return u&62914560;case 67108864:return 67108864;case 134217728:return 134217728;case 268435456:return 268435456;case 536870912:return 536870912;case 1073741824:return 0;default:return u}}function U(u,h){var N=u.pendingLanes;if(N===0)return 0;var _=0,T=u.suspendedLanes,W=u.pingedLanes,lA=u.warmLanes;u=u.finishedLanes!==0;var TA=N&134217727;return TA!==0?(N=TA&~T,N!==0?_=m(N):(W&=TA,W!==0?_=m(W):u||(lA=TA&~lA,lA!==0&&(_=m(lA))))):(TA=N&~T,TA!==0?_=m(TA):W!==0?_=m(W):u||(lA=N&~lA,lA!==0&&(_=m(lA)))),_===0?0:h!==0&&h!==_&&(h&T)===0&&(T=_&-_,lA=h&-h,T>=lA||T===32&&(lA&4194176)!==0)?h:_}function F(u,h){return(u.pendingLanes&~(u.suspendedLanes&~u.pingedLanes)&h)===0}function b(u,h){switch(u){case 1:case 2:case 4:case 8:return h+250;case 16:case 32:case 64: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 h+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 K(){var u=jQ;return jQ<<=1,(jQ&4194176)===0&&(jQ=128),u}function R(){var u=eh;return eh<<=1,(eh&62914560)===0&&(eh=4194304),u}function G(u){for(var h=[],N=0;31>N;N++)h.push(u);return h}function J(u,h){u.pendingLanes|=h,h!==268435456&&(u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0)}function x(u,h,N,_,T,W){var lA=u.pendingLanes;u.pendingLanes=N,u.suspendedLanes=0,u.pingedLanes=0,u.warmLanes=0,u.expiredLanes&=N,u.entangledLanes&=N,u.errorRecoveryDisabledLanes&=N,u.shellSuspendCounter=0;var TA=u.entanglements,le=u.expirationTimes,qe=u.hiddenUpdates;for(N=lA&~N;0<N;){var rt=31-ga(N),mt=1<<rt;TA[rt]=0,le[rt]=-1;var Gt=qe[rt];if(Gt!==null)for(qe[rt]=null,rt=0;rt<Gt.length;rt++){var Ei=Gt[rt];Ei!==null&&(Ei.lane&=-536870913)}N&=~mt}_!==0&&H(u,_,0),W!==0&&T===0&&u.tag!==0&&(u.suspendedLanes|=W&~(lA&~h))}function H(u,h,N){u.pendingLanes|=h,u.suspendedLanes&=~h;var _=31-ga(h);u.entangledLanes|=h,u.entanglements[_]=u.entanglements[_]|1073741824|N&4194218}function P(u,h){var N=u.entangledLanes|=h;for(u=u.entanglements;N;){var _=31-ga(N),T=1<<_;T&h|u[_]&h&&(u[_]|=h),N&=~T}}function j(u){return u&=-u,2<u?8<u?(u&134217727)!==0?32:268435456:8:2}function q(u){if(Ia&&typeof Ia.onCommitFiberRoot=="function")try{Ia.onCommitFiberRoot(WQ,u,void 0,(u.current.flags&128)===128)}catch{}}function Y(u){if(typeof OM=="function"&&iw(u),Ia&&typeof Ia.setStrictMode=="function")try{Ia.setStrictMode(WQ,u)}catch{}}function O(u,h){return u===h&&(u!==0||1/u===1/h)||u!==u&&h!==h}function $(u,h){if(typeof u=="object"&&u!==null){var N=Wp.get(u);return N!==void 0?N:(h={value:u,source:h,stack:s(h)},Wp.set(u,h),h)}return{value:u,source:h,stack:s(h)}}function gA(u,h){oI[wI++]=gh,oI[wI++]=ih,ih=u,gh=h}function z(u,h,N){ba[va++]=Fs,ba[va++]=cr,ba[va++]=zr,zr=u;var _=Fs;u=cr;var T=32-ga(_)-1;_&=~(1<<T),N+=1;var W=32-ga(h)+T;if(30<W){var lA=T-T%5;W=(_&(1<<lA)-1).toString(32),_>>=lA,T-=lA,Fs=1<<32-ga(h)+T|N<<T|_,cr=W+u}else Fs=1<<W|N<<T|_,cr=u}function X(u){u.return!==null&&(gA(u,1),z(u,1,0))}function sA(u){for(;u===ih;)ih=oI[--wI],oI[wI]=null,gh=oI[--wI],oI[wI]=null;for(;u===zr;)zr=ba[--va],ba[va]=null,cr=ba[--va],ba[va]=null,Fs=ba[--va],ba[va]=null}function rA(u,h){M(Vr,h),M(Ih,u),M(fn,null),u=El(h),f(fn),M(fn,u)}function mA(){f(fn),f(Ih),f(Vr)}function IA(u){u.memoizedState!==null&&M(zQ,u);var h=fn.current,N=pM(h,u.type);h!==N&&(M(Ih,u),M(fn,N))}function uA(u){Ih.current===u&&(f(fn),f(Ih)),zQ.current===u&&(f(zQ),Rs?ai._currentValue=ia:ai._currentValue2=ia)}function KA(u){var h=Error(g(418,""));throw AA($(h,u)),nh}function FA(u,h){if(!Go)throw Error(g(175));yv(u.stateNode,u.type,u.memoizedProps,h,u)||KA(u)}function RA(u){for(ao=u.return;ao;)switch(ao.tag){case 3:case 27:lr=!0;return;case 5:case 13:lr=!1;return;default:ao=ao.return}}function MA(u){if(!Go||u!==ao)return!1;if(!og)return RA(u),og=!0,!1;var h=!1;if(Ln?u.tag!==3&&u.tag!==27&&(u.tag!==5||vM(u.type)&&!Ac(u.type,u.memoizedProps))&&(h=!0):u.tag!==3&&(u.tag!==5||vM(u.type)&&!Ac(u.type,u.memoizedProps))&&(h=!0),h&&xn&&KA(u),RA(u),u.tag===13){if(!Go)throw Error(g(316));if(u=u.memoizedState,u=u!==null?u.dehydrated:null,!u)throw Error(g(317));xn=FM(u)}else xn=ao?HS(u.stateNode):null;return!0}function oA(){Go&&(xn=ao=null,og=!1)}function AA(u){_a===null?_a=[u]:_a.push(u)}function tA(){for(var u=tc,h=VQ=tc=0;h<u;){var N=Ja[h];Ja[h++]=null;var _=Ja[h];Ja[h++]=null;var T=Ja[h];Ja[h++]=null;var W=Ja[h];if(Ja[h++]=null,_!==null&&T!==null){var lA=_.pending;lA===null?T.next=T:(T.next=lA.next,lA.next=T),_.pending=T}W!==0&&dA(N,T,W)}}function iA(u,h,N,_){Ja[tc++]=u,Ja[tc++]=h,Ja[tc++]=N,Ja[tc++]=_,VQ|=_,u.lanes|=_,u=u.alternate,u!==null&&(u.lanes|=_)}function hA(u,h,N,_){return iA(u,h,N,_),SA(u)}function DA(u,h){return iA(u,null,null,h),SA(u)}function dA(u,h,N){u.lanes|=N;var _=u.alternate;_!==null&&(_.lanes|=N);for(var T=!1,W=u.return;W!==null;)W.childLanes|=N,_=W.alternate,_!==null&&(_.childLanes|=N),W.tag===22&&(u=W.stateNode,u===null||u._visibility&1||(T=!0)),u=W,W=W.return;T&&h!==null&&u.tag===3&&(W=u.stateNode,T=31-ga(N),W=W.hiddenUpdates,u=W[T],u===null?W[T]=[h]:u.push(h),h.lane=N|536870912)}function SA(u){if(50<kl)throw kl=0,Ko=null,Error(g(185));for(var h=u.return;h!==null;)u=h,h=u.return;return u.tag===3?u.stateNode:null}function NA(u){u!==pl&&u.next===null&&(pl===null?XQ=pl=u:pl=pl.next=u),ah=!0,oh||(oh=!0,HA(Qe))}function OA(u,h){if(!Xr&&ah){Xr=!0;do for(var N=!1,_=XQ;_!==null;){if(u!==0){var T=_.pendingLanes;if(T===0)var W=0;else{var lA=_.suspendedLanes,TA=_.pingedLanes;W=(1<<31-ga(42|u)+1)-1,W&=T&~(lA&~TA),W=W&201326677?W&201326677|1:W?W|2:0}W!==0&&(N=!0,UA(_,W))}else W=bi,W=U(_,_===xi?W:0),(W&3)===0||F(_,W)||(N=!0,UA(_,W));_=_.next}while(N);Xr=!1}}function Qe(){ah=oh=!1;var u=0;ic!==0&&(ec()&&(u=ic),ic=0);for(var h=qn(),N=null,_=XQ;_!==null;){var T=_.next,W=nA(_,h);W===0?(_.next=null,N===null?XQ=T:N.next=T,T===null&&(pl=N)):(N=_,(u!==0||(W&3)!==0)&&(ah=!0)),_=T}OA(u)}function nA(u,h){for(var N=u.suspendedLanes,_=u.pingedLanes,T=u.expirationTimes,W=u.pendingLanes&-62914561;0<W;){var lA=31-ga(W),TA=1<<lA,le=T[lA];le===-1?((TA&N)===0||(TA&_)!==0)&&(T[lA]=b(TA,h)):le<=h&&(u.expiredLanes|=TA),W&=~TA}if(h=xi,N=bi,N=U(u,u===h?N:0),_=u.callbackNode,N===0||u===h&&Tg===2||u.cancelPendingCommit!==null)return _!==null&&_!==null&&th(_),u.callbackNode=null,u.callbackPriority=0;if((N&3)===0||F(u,N)){if(h=N&-N,h===u.callbackPriority)return h;switch(_!==null&&th(_),j(N)){case 2:case 8:N=HM;break;case 32:N=jp;break;case 268435456:N=Zp;break;default:N=jp}return _=eA.bind(null,u),N=ZQ(N,_),u.callbackPriority=h,u.callbackNode=N,h}return _!==null&&_!==null&&th(_),u.callbackPriority=2,u.callbackNode=null,2}function eA(u,h){var N=u.callbackNode;if(dn()&&u.callbackNode!==N)return null;var _=bi;return _=U(u,u===xi?_:0),_===0?null:(Lu(u,_,h),nA(u,qn()),u.callbackNode!=null&&u.callbackNode===N?eA.bind(null,u):null)}function UA(u,h){if(dn())return null;Lu(u,h,!0)}function HA(u){PI?vp(function(){(Ot&6)!==0?ZQ(tw,u):u()}):ZQ(tw,u)}function Se(){return ic===0&&(ic=K()),ic}function ne(u,h){if(rh===null){var N=rh=[];zp=0,na=Se(),gc={status:"pending",value:void 0,then:function(_){N.push(_)}}}return zp++,h.then(Oe,Oe),h}function Oe(){if(--zp===0&&rh!==null){gc!==null&&(gc.status="fulfilled");var u=rh;rh=null,na=0,gc=null;for(var h=0;h<u.length;h++)(0,u[h])()}}function VA(u,h){var N=[],_={status:"pending",value:null,reason:null,then:function(T){N.push(T)}};return u.then(function(){_.status="fulfilled",_.value=h;for(var T=0;T<N.length;T++)(0,N[T])(h)},function(T){for(_.status="rejected",_.reason=T,T=0;T<N.length;T++)(0,N[T])(void 0)}),_}function de(u){u.updateQueue={baseState:u.memoizedState,firstBaseUpdate:null,lastBaseUpdate:null,shared:{pending:null,lanes:0,hiddenCallbacks:null},callbacks:null}}function te(u,h){u=u.updateQueue,h.updateQueue===u&&(h.updateQueue={baseState:u.baseState,firstBaseUpdate:u.firstBaseUpdate,lastBaseUpdate:u.lastBaseUpdate,shared:u.shared,callbacks:null})}function WA(u){return{lane:u,tag:0,payload:null,callback:null,next:null}}function _A(u,h,N){var _=u.updateQueue;if(_===null)return null;if(_=_.shared,(Ot&2)!==0){var T=_.pending;return T===null?h.next=h:(h.next=T.next,T.next=h),_.pending=h,h=SA(u),dA(u,null,N),h}return iA(u,_,h,N),SA(u)}function zA(u,h,N){if(h=h.updateQueue,h!==null&&(h=h.shared,(N&4194176)!==0)){var _=h.lanes;_&=u.pendingLanes,N|=_,h.lanes=N,P(u,N)}}function ge(u,h){var N=u.updateQueue,_=u.alternate;if(_!==null&&(_=_.updateQueue,N===_)){var T=null,W=null;if(N=N.firstBaseUpdate,N!==null){do{var lA={lane:N.lane,tag:N.tag,payload:N.payload,callback:null,next:null};W===null?T=W=lA:W=W.next=lA,N=N.next}while(N!==null);W===null?T=W=h:W=W.next=h}else T=W=h;N={baseState:_.baseState,firstBaseUpdate:T,lastBaseUpdate:W,shared:_.shared,callbacks:_.callbacks},u.updateQueue=N;return}u=N.lastBaseUpdate,u===null?N.firstBaseUpdate=h:u.next=h,N.lastBaseUpdate=h}function he(){if($Q){var u=gc;if(u!==null)throw u}}function ve(u,h,N,_){$Q=!1;var T=u.updateQueue;qC=!1;var W=T.firstBaseUpdate,lA=T.lastBaseUpdate,TA=T.shared.pending;if(TA!==null){T.shared.pending=null;var le=TA,qe=le.next;le.next=null,lA===null?W=qe:lA.next=qe,lA=le;var rt=u.alternate;rt!==null&&(rt=rt.updateQueue,TA=rt.lastBaseUpdate,TA!==lA&&(TA===null?rt.firstBaseUpdate=qe:TA.next=qe,rt.lastBaseUpdate=le))}if(W!==null){var mt=T.baseState;lA=0,rt=qe=le=null,TA=W;do{var Gt=TA.lane&-536870913,Ei=Gt!==TA.lane;if(Ei?(bi&Gt)===Gt:(_&Gt)===Gt){Gt!==0&&Gt===na&&($Q=!0),rt!==null&&(rt=rt.next={lane:0,tag:TA.tag,payload:TA.payload,callback:null,next:null});A:{var sa=u,ch=TA;Gt=h;var Ml=N;switch(ch.tag){case 1:if(sa=ch.payload,typeof sa=="function"){mt=sa.call(Ml,mt,Gt);break A}mt=sa;break A;case 3:sa.flags=sa.flags&-65537|128;case 0:if(sa=ch.payload,Gt=typeof sa=="function"?sa.call(Ml,mt,Gt):sa,Gt==null)break A;mt=ll({},mt,Gt);break A;case 2:qC=!0}}Gt=TA.callback,Gt!==null&&(u.flags|=64,Ei&&(u.flags|=8192),Ei=T.callbacks,Ei===null?T.callbacks=[Gt]:Ei.push(Gt))}else Ei={lane:Gt,tag:TA.tag,payload:TA.payload,callback:TA.callback,next:null},rt===null?(qe=rt=Ei,le=mt):rt=rt.next=Ei,lA|=Gt;if(TA=TA.next,TA===null){if(TA=T.shared.pending,TA===null)break;Ei=TA,TA=Ei.next,Ei.next=null,T.lastBaseUpdate=Ei,T.shared.pending=null}}while(!0);rt===null&&(le=mt),T.baseState=le,T.firstBaseUpdate=qe,T.lastBaseUpdate=rt,W===null&&(T.shared.lanes=0),Ta|=lA,u.lanes=lA,u.memoizedState=mt}}function bA(u,h){if(typeof u!="function")throw Error(g(191,u));u.call(h)}function pA(u,h){var N=u.callbacks;if(N!==null)for(u.callbacks=null,u=0;u<N.length;u++)bA(N[u],h)}function Re(u,h){if(Fa(u,h))return!0;if(typeof u!="object"||u===null||typeof h!="object"||h===null)return!1;var N=Object.keys(u),_=Object.keys(h);if(N.length!==_.length)return!1;for(_=0;_<N.length;_++){var T=N[_];if(!sh.call(h,T)||!Fa(u[T],h[T]))return!1}return!0}function CA(u){return u=u.status,u==="fulfilled"||u==="rejected"}function EA(){}function yA(u,h,N){switch(N=u[N],N===void 0?u.push(h):N!==h&&(h.then(EA,EA),h=N),h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,u===Jg?Error(g(483)):u;default:if(typeof h.status=="string")h.then(EA,EA);else{if(u=xi,u!==null&&100<u.shellSuspendCounter)throw Error(g(482));u=h,u.status="pending",u.then(function(_){if(h.status==="pending"){var T=h;T.status="fulfilled",T.value=_}},function(_){if(h.status==="pending"){var T=h;T.status="rejected",T.reason=_}})}switch(h.status){case"fulfilled":return h.value;case"rejected":throw u=h.reason,u===Jg?Error(g(483)):u}throw fl=h,Jg}}function xA(){if(fl===null)throw Error(g(459));var u=fl;return fl=null,u}function XA(u){var h=Qr;return Qr+=1,bs===null&&(bs=[]),yA(bs,u,h)}function pe(u,h){h=h.props.ref,u.ref=h!==void 0?h:null}function be(u,h){throw h.$$typeof===DS?Error(g(525)):(u=Object.prototype.toString.call(h),Error(g(31,u==="[object Object]"?"object with keys {"+Object.keys(h).join(", ")+"}":u)))}function It(u){var h=u._init;return h(u._payload)}function Ut(u){function h(we,re){if(u){var Ne=we.deletions;Ne===null?(we.deletions=[re],we.flags|=16):Ne.push(re)}}function N(we,re){if(!u)return null;for(;re!==null;)h(we,re),re=re.sibling;return null}function _(we){for(var re=new Map;we!==null;)we.key!==null?re.set(we.key,we):re.set(we.index,we),we=we.sibling;return re}function T(we,re){return we=no(we,re),we.index=0,we.sibling=null,we}function W(we,re,Ne){return we.index=Ne,u?(Ne=we.alternate,Ne!==null?(Ne=Ne.index,Ne<re?(we.flags|=33554434,re):Ne):(we.flags|=33554434,re)):(we.flags|=1048576,re)}function lA(we){return u&&we.alternate===null&&(we.flags|=33554434),we}function TA(we,re,Ne,tt){return re===null||re.tag!==6?(re=ZB(Ne,we.mode,tt),re.return=we,re):(re=T(re,Ne),re.return=we,re)}function le(we,re,Ne,tt){var Tt=Ne.type;return Tt===TQ?rt(we,re,Ne.props.children,tt,Ne.key):re!==null&&(re.elementType===Tt||typeof Tt=="object"&&Tt!==null&&Tt.$$typeof===Wr&&It(Tt)===re.type)?(re=T(re,Ne.props),pe(re,Ne),re.return=we,re):(re=Cr(Ne.type,Ne.key,Ne.props,null,we.mode,tt),pe(re,Ne),re.return=we,re)}function qe(we,re,Ne,tt){return re===null||re.tag!==4||re.stateNode.containerInfo!==Ne.containerInfo||re.stateNode.implementation!==Ne.implementation?(re=xQ(Ne,we.mode,tt),re.return=we,re):(re=T(re,Ne.children||[]),re.return=we,re)}function rt(we,re,Ne,tt,Tt){return re===null||re.tag!==7?(re=FC(Ne,we.mode,tt,Tt),re.return=we,re):(re=T(re,Ne),re.return=we,re)}function mt(we,re,Ne){if(typeof re=="string"&&re!==""||typeof re=="number"||typeof re=="bigint")return re=ZB(""+re,we.mode,Ne),re.return=we,re;if(typeof re=="object"&&re!==null){switch(re.$$typeof){case bC:return Ne=Cr(re.type,re.key,re.props,null,we.mode,Ne),pe(Ne,re),Ne.return=we,Ne;case Zr:return re=xQ(re,we.mode,Ne),re.return=we,re;case Wr:var tt=re._init;return re=tt(re._payload),mt(we,re,Ne)}if(XB(re)||I(re))return re=FC(re,we.mode,Ne,null),re.return=we,re;if(typeof re.then=="function")return mt(we,XA(re),Ne);if(re.$$typeof===Ns)return mt(we,li(we,re),Ne);be(we,re)}return null}function Gt(we,re,Ne,tt){var Tt=re!==null?re.key:null;if(typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint")return Tt!==null?null:TA(we,re,""+Ne,tt);if(typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case bC:return Ne.key===Tt?le(we,re,Ne,tt):null;case Zr:return Ne.key===Tt?qe(we,re,Ne,tt):null;case Wr:return Tt=Ne._init,Ne=Tt(Ne._payload),Gt(we,re,Ne,tt)}if(XB(Ne)||I(Ne))return Tt!==null?null:rt(we,re,Ne,tt,null);if(typeof Ne.then=="function")return Gt(we,re,XA(Ne),tt);if(Ne.$$typeof===Ns)return Gt(we,re,li(we,Ne),tt);be(we,Ne)}return null}function Ei(we,re,Ne,tt,Tt){if(typeof tt=="string"&&tt!==""||typeof tt=="number"||typeof tt=="bigint")return we=we.get(Ne)||null,TA(re,we,""+tt,Tt);if(typeof tt=="object"&&tt!==null){switch(tt.$$typeof){case bC:return we=we.get(tt.key===null?Ne:tt.key)||null,le(re,we,tt,Tt);case Zr:return we=we.get(tt.key===null?Ne:tt.key)||null,qe(re,we,tt,Tt);case Wr:var eI=tt._init;return tt=eI(tt._payload),Ei(we,re,Ne,tt,Tt)}if(XB(tt)||I(tt))return we=we.get(Ne)||null,rt(re,we,tt,Tt,null);if(typeof tt.then=="function")return Ei(we,re,Ne,XA(tt),Tt);if(tt.$$typeof===Ns)return Ei(we,re,Ne,li(re,tt),Tt);be(re,tt)}return null}function sa(we,re,Ne,tt){for(var Tt=null,eI=null,ri=re,rg=re=0,nn=null;ri!==null&&rg<Ne.length;rg++){ri.index>rg?(nn=ri,ri=null):nn=ri.sibling;var sg=Gt(we,ri,Ne[rg],tt);if(sg===null){ri===null&&(ri=nn);break}u&&ri&&sg.alternate===null&&h(we,ri),re=W(sg,re,rg),eI===null?Tt=sg:eI.sibling=sg,eI=sg,ri=nn}if(rg===Ne.length)return N(we,ri),og&&gA(we,rg),Tt;if(ri===null){for(;rg<Ne.length;rg++)ri=mt(we,Ne[rg],tt),ri!==null&&(re=W(ri,re,rg),eI===null?Tt=ri:eI.sibling=ri,eI=ri);return og&&gA(we,rg),Tt}for(ri=_(ri);rg<Ne.length;rg++)nn=Ei(ri,we,rg,Ne[rg],tt),nn!==null&&(u&&nn.alternate!==null&&ri.delete(nn.key===null?rg:nn.key),re=W(nn,re,rg),eI===null?Tt=nn:eI.sibling=nn,eI=nn);return u&&ri.forEach(function(jC){return h(we,jC)}),og&&gA(we,rg),Tt}function ch(we,re,Ne,tt){if(Ne==null)throw Error(g(151));for(var Tt=null,eI=null,ri=re,rg=re=0,nn=null,sg=Ne.next();ri!==null&&!sg.done;rg++,sg=Ne.next()){ri.index>rg?(nn=ri,ri=null):nn=ri.sibling;var jC=Gt(we,ri,sg.value,tt);if(jC===null){ri===null&&(ri=nn);break}u&&ri&&jC.alternate===null&&h(we,ri),re=W(jC,re,rg),eI===null?Tt=jC:eI.sibling=jC,eI=jC,ri=nn}if(sg.done)return N(we,ri),og&&gA(we,rg),Tt;if(ri===null){for(;!sg.done;rg++,sg=Ne.next())sg=mt(we,sg.value,tt),sg!==null&&(re=W(sg,re,rg),eI===null?Tt=sg:eI.sibling=sg,eI=sg);return og&&gA(we,rg),Tt}for(ri=_(ri);!sg.done;rg++,sg=Ne.next())sg=Ei(ri,we,rg,sg.value,tt),sg!==null&&(u&&sg.alternate!==null&&ri.delete(sg.key===null?rg:sg.key),re=W(sg,re,rg),eI===null?Tt=sg:eI.sibling=sg,eI=sg);return u&&ri.forEach(function(nf){return h(we,nf)}),og&&gA(we,rg),Tt}function Ml(we,re,Ne,tt){if(typeof Ne=="object"&&Ne!==null&&Ne.type===TQ&&Ne.key===null&&(Ne=Ne.props.children),typeof Ne=="object"&&Ne!==null){switch(Ne.$$typeof){case bC:A:{for(var Tt=Ne.key;re!==null;){if(re.key===Tt){if(Tt=Ne.type,Tt===TQ){if(re.tag===7){N(we,re.sibling),tt=T(re,Ne.props.children),tt.return=we,we=tt;break A}}else if(re.elementType===Tt||typeof Tt=="object"&&Tt!==null&&Tt.$$typeof===Wr&&It(Tt)===re.type){N(we,re.sibling),tt=T(re,Ne.props),pe(tt,Ne),tt.return=we,we=tt;break A}N(we,re);break}else h(we,re);re=re.sibling}Ne.type===TQ?(tt=FC(Ne.props.children,we.mode,tt,Ne.key),tt.return=we,we=tt):(tt=Cr(Ne.type,Ne.key,Ne.props,null,we.mode,tt),pe(tt,Ne),tt.return=we,we=tt)}return lA(we);case Zr:A:{for(Tt=Ne.key;re!==null;){if(re.key===Tt)if(re.tag===4&&re.stateNode.containerInfo===Ne.containerInfo&&re.stateNode.implementation===Ne.implementation){N(we,re.sibling),tt=T(re,Ne.children||[]),tt.return=we,we=tt;break A}else{N(we,re);break}else h(we,re);re=re.sibling}tt=xQ(Ne,we.mode,tt),tt.return=we,we=tt}return lA(we);case Wr:return Tt=Ne._init,Ne=Tt(Ne._payload),Ml(we,re,Ne,tt)}if(XB(Ne))return sa(we,re,Ne,tt);if(I(Ne)){if(Tt=I(Ne),typeof Tt!="function")throw Error(g(150));return Ne=Tt.call(Ne),ch(we,re,Ne,tt)}if(typeof Ne.then=="function")return Ml(we,re,XA(Ne),tt);if(Ne.$$typeof===Ns)return Ml(we,re,li(we,Ne),tt);be(we,Ne)}return typeof Ne=="string"&&Ne!==""||typeof Ne=="number"||typeof Ne=="bigint"?(Ne=""+Ne,re!==null&&re.tag===6?(N(we,re.sibling),tt=T(re,Ne),tt.return=we,we=tt):(N(we,re),tt=ZB(Ne,we.mode,tt),tt.return=we,we=tt),lA(we)):N(we,re)}return function(we,re,Ne,tt){try{Qr=0;var Tt=Ml(we,re,Ne,tt);return bs=null,Tt}catch(ri){if(ri===Jg)throw ri;var eI=e(29,ri,null,we.mode);return eI.lanes=tt,eI.return=we,eI}finally{}}}function pg(u,h){u=$r,M(La,u),M(vs,h),$r=u|h.baseLanes}function Ge(){M(La,$r),M(vs,vs.current)}function lt(){$r=La.current,f(vs),f(La)}function Rt(u){var h=u.alternate;M(jI,jI.current&1),M(qa,u),Er===null&&(h===null||vs.current!==null||h.memoizedState!==null)&&(Er=u)}function Yt(u){if(u.tag===22){if(M(jI,jI.current),M(qa,u),Er===null){var h=u.alternate;h!==null&&h.memoizedState!==null&&(Er=u)}}else st()}function st(){M(jI,jI.current),M(qa,qa.current)}function Be(u){f(qa),Er===u&&(Er=null),f(jI)}function jA(u){for(var h=u;h!==null;){if(h.tag===13){var N=h.memoizedState;if(N!==null&&(N=N.dehydrated,N===null||xp(N)||Xu(N)))return h}else if(h.tag===19&&h.memoizedProps.revealOrder!==void 0){if((h.flags&128)!==0)return h}else if(h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return null;h=h.return}h.sibling.return=h.return,h=h.sibling}return null}function Me(){throw Error(g(321))}function We(u,h){if(h===null)return!1;for(var N=0;N<h.length&&N<u.length;N++)if(!Fa(u[N],h[N]))return!1;return!0}function at(u,h,N,_,T,W){return _s=W,mi=h,h.memoizedState=null,h.updateQueue=null,h.lanes=0,$t.H=u===null||u.memoizedState===null?ZI:ro,xC=!1,W=N(_,T),xC=!1,aI&&(W=ae(h,N,_,T)),kA(u),W}function kA(u){$t.H=ag;var h=yg!==null&&yg.next!==null;if(_s=0,vI=yg=mi=null,ur=!1,mI=0,AE=null,h)throw Error(g(300));u===null||_I||(u=u.dependencies,u!==null&&Ct(u)&&(_I=!0))}function ae(u,h,N,_){mi=u;var T=0;do{if(aI&&(AE=null),mI=0,aI=!1,25<=T)throw Error(g(301));if(T+=1,vI=yg=null,u.updateQueue!=null){var W=u.updateQueue;W.lastEffect=null,W.events=null,W.stores=null,W.memoCache!=null&&(W.memoCache.index=0)}$t.H=nc,W=h(N,_)}while(aI);return W}function Ye(){var u=$t.H,h=u.useState()[0];return h=typeof h.then=="function"?ee(h):h,u=u.useState()[0],(yg!==null?yg.memoizedState:null)!==u&&(mi.flags|=1024),h}function Pt(){var u=Ch!==0;return Ch=0,u}function jt(u,h,N){h.updateQueue=u.updateQueue,h.flags&=-2053,u.lanes&=~N}function aA(u){if(ur){for(u=u.memoizedState;u!==null;){var h=u.queue;h!==null&&(h.pending=null),u=u.next}ur=!1}_s=0,vI=yg=mi=null,aI=!1,mI=Ch=0,AE=null}function QA(){var u={memoizedState:null,baseState:null,baseQueue:null,queue:null,next:null};return vI===null?mi.memoizedState=vI=u:vI=vI.next=u,vI}function JA(){if(yg===null){var u=mi.alternate;u=u!==null?u.memoizedState:null}else u=yg.next;var h=vI===null?mi.memoizedState:vI.next;if(h!==null)vI=h,yg=u;else{if(u===null)throw mi.alternate===null?Error(g(467)):Error(g(310));yg=u,u={memoizedState:yg.memoizedState,baseState:yg.baseState,baseQueue:yg.baseQueue,queue:yg.queue,next:null},vI===null?mi.memoizedState=vI=u:vI=vI.next=u}return vI}function ee(u){var h=mI;return mI+=1,AE===null&&(AE=[]),u=yA(AE,u,h),h=mi,(vI===null?h.memoizedState:vI.next)===null&&(h=h.alternate,$t.H=h===null||h.memoizedState===null?ZI:ro),u}function GA(u){if(u!==null&&typeof u=="object"){if(typeof u.then=="function")return ee(u);if(u.$$typeof===Ns)return di(u)}throw Error(g(438,String(u)))}function oe(u){var h=null,N=mi.updateQueue;if(N!==null&&(h=N.memoCache),h==null){var _=mi.alternate;_!==null&&(_=_.updateQueue,_!==null&&(_=_.memoCache,_!=null&&(h={data:_.data.map(function(T){return T.slice()}),index:0})))}if(h==null&&(h={data:[],index:0}),N===null&&(N=Xp(),mi.updateQueue=N),N.memoCache=h,N=h.data[h.index],N===void 0)for(N=h.data[h.index]=Array(u),_=0;_<u;_++)N[_]=dM;return h.index++,N}function Xe(u,h){return typeof h=="function"?h(u):h}function Qt(u){var h=JA();return nt(h,yg,u)}function nt(u,h,N){var _=u.queue;if(_===null)throw Error(g(311));_.lastRenderedReducer=N;var T=u.baseQueue,W=_.pending;if(W!==null){if(T!==null){var lA=T.next;T.next=W.next,W.next=lA}h.baseQueue=T=W,_.pending=null}if(W=u.baseState,T===null)u.memoizedState=W;else{h=T.next;var TA=lA=null,le=null,qe=h,rt=!1;do{var mt=qe.lane&-536870913;if(mt!==qe.lane?(bi&mt)===mt:(_s&mt)===mt){var Gt=qe.revertLane;if(Gt===0)le!==null&&(le=le.next={lane:0,revertLane:0,action:qe.action,hasEagerState:qe.hasEagerState,eagerState:qe.eagerState,next:null}),mt===na&&(rt=!0);else if((_s&Gt)===Gt){qe=qe.next,Gt===na&&(rt=!0);continue}else mt={lane:0,revertLane:qe.revertLane,action:qe.action,hasEagerState:qe.hasEagerState,eagerState:qe.eagerState,next:null},le===null?(TA=le=mt,lA=W):le=le.next=mt,mi.lanes|=Gt,Ta|=Gt;mt=qe.action,xC&&N(W,mt),W=qe.hasEagerState?qe.eagerState:N(W,mt)}else Gt={lane:mt,revertLane:qe.revertLane,action:qe.action,hasEagerState:qe.hasEagerState,eagerState:qe.eagerState,next:null},le===null?(TA=le=Gt,lA=W):le=le.next=Gt,mi.lanes|=mt,Ta|=mt;qe=qe.next}while(qe!==null&&qe!==h);if(le===null?lA=W:le.next=TA,!Fa(W,u.memoizedState)&&(_I=!0,rt&&(N=gc,N!==null)))throw N;u.memoizedState=W,u.baseState=lA,u.baseQueue=le,_.lastRenderedState=W}return T===null&&(_.lanes=0),[u.memoizedState,_.dispatch]}function Dt(u){var h=JA(),N=h.queue;if(N===null)throw Error(g(311));N.lastRenderedReducer=u;var _=N.dispatch,T=N.pending,W=h.memoizedState;if(T!==null){N.pending=null;var lA=T=T.next;do W=u(W,lA.action),lA=lA.next;while(lA!==T);Fa(W,h.memoizedState)||(_I=!0),h.memoizedState=W,h.baseQueue===null&&(h.baseState=W),N.lastRenderedState=W}return[W,_]}function it(u,h,N){var _=mi,T=JA(),W=og;if(W){if(N===void 0)throw Error(g(407));N=N()}else N=h();var lA=!Fa((yg||T).memoizedState,N);if(lA&&(T.memoizedState=N,_I=!0),T=T.queue,ce(Ri.bind(null,_,T,u),[u]),T.getSnapshot!==h||lA||vI!==null&&vI.memoizedState.tag&1){if(_.flags|=2048,fI(9,Zt.bind(null,_,T,N,h),{destroy:void 0},null),xi===null)throw Error(g(349));W||(_s&60)!==0||Mt(_,h,N)}return N}function Mt(u,h,N){u.flags|=16384,u={getSnapshot:h,value:N},h=mi.updateQueue,h===null?(h=Xp(),mi.updateQueue=h,h.stores=[u]):(N=h.stores,N===null?h.stores=[u]:N.push(u))}function Zt(u,h,N,_){h.value=N,h.getSnapshot=_,Ui(h)&&qi(u)}function Ri(u,h,N){return N(function(){Ui(h)&&qi(u)})}function Ui(u){var h=u.getSnapshot;u=u.value;try{var N=h();return!Fa(u,N)}catch{return!0}}function qi(u){var h=DA(u,2);h!==null&&Io(h,u,2)}function ei(u){var h=QA();if(typeof u=="function"){var N=u;if(u=N(),xC){Y(!0);try{N()}finally{Y(!1)}}}return h.memoizedState=h.baseState=u,h.queue={pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xe,lastRenderedState:u},h}function yt(u,h,N,_){return u.baseState=N,nt(u,yg,typeof _=="function"?_:Xe)}function Si(u,h,N,_,T){if(bn(u))throw Error(g(485));if(u=h.action,u!==null){var W={payload:T,action:u,next:null,isTransition:!0,status:"pending",value:null,reason:null,listeners:[],then:function(lA){W.listeners.push(lA)}};$t.T!==null?N(!0):W.isTransition=!1,_(W),N=h.pending,N===null?(W.next=h.pending=W,ti(h,W)):(W.next=N.next,h.pending=N.next=W)}}function ti(u,h){var N=h.action,_=h.payload,T=u.state;if(h.isTransition){var W=$t.T,lA={};$t.T=lA;try{var TA=N(T,_),le=$t.S;le!==null&&le(lA,TA),Xg(u,h,TA)}catch(qe){bg(u,h,qe)}finally{$t.T=W}}else try{W=N(T,_),Xg(u,h,W)}catch(qe){bg(u,h,qe)}}function Xg(u,h,N){N!==null&&typeof N=="object"&&typeof N.then=="function"?N.then(function(_){cI(u,h,_)},function(_){return bg(u,h,_)}):cI(u,h,N)}function cI(u,h,N){h.status="fulfilled",h.value=N,yo(h),u.state=N,h=u.pending,h!==null&&(N=h.next,N===h?u.pending=null:(N=N.next,h.next=N,ti(u,N)))}function bg(u,h,N){var _=u.pending;if(u.pending=null,_!==null){_=_.next;do h.status="rejected",h.reason=N,yo(h),h=h.next;while(h!==_)}u.action=null}function yo(u){u=u.listeners;for(var h=0;h<u.length;h++)(0,u[h])()}function ci(u,h){return h}function vg(u,h){if(og){var N=xi.formState;if(N!==null){A:{var _=mi;if(og){if(xn){var T=mM(xn,lr);if(T){xn=HS(T),_=kM(T);break A}}KA(_)}_=!1}_&&(h=N[0])}}N=QA(),N.memoizedState=N.baseState=h,_={pending:null,lanes:0,dispatch:null,lastRenderedReducer:ci,lastRenderedState:h},N.queue=_,N=Ng.bind(null,mi,_),_.dispatch=N,_=ei(!1);var W=wo.bind(null,mi,!1,_.queue);return _=QA(),T={state:h,dispatch:null,action:u,pending:null},_.queue=T,N=Si.bind(null,mi,T,W,N),T.dispatch=N,_.memoizedState=u,[h,N,!1]}function Zg(u){var h=JA();return fg(h,yg,u)}function fg(u,h,N){h=nt(u,h,ci)[0],u=Qt(Xe)[0],h=typeof h=="object"&&h!==null&&typeof h.then=="function"?ee(h):h;var _=JA(),T=_.queue,W=T.dispatch;return N!==_.memoizedState&&(mi.flags|=2048,fI(9,kg.bind(null,T,N),{destroy:void 0},null)),[h,W,u]}function kg(u,h){u.action=h}function Qn(u){var h=JA(),N=yg;if(N!==null)return fg(h,N,u);JA(),h=h.memoizedState,N=JA();var _=N.queue.dispatch;return N.memoizedState=u,[h,_,!1]}function fI(u,h,N,_){return u={tag:u,create:h,inst:N,deps:_,next:null},h=mi.updateQueue,h===null&&(h=Xp(),mi.updateQueue=h),N=h.lastEffect,N===null?h.lastEffect=u.next=u:(_=N.next,N.next=u,u.next=_,h.lastEffect=u),u}function Ao(){return JA().memoizedState}function wa(u,h,N,_){var T=QA();mi.flags|=u,T.memoizedState=fI(1|h,N,{destroy:void 0},_===void 0?null:_)}function sr(u,h,N,_){var T=JA();_=_===void 0?null:_;var W=T.memoizedState.inst;yg!==null&&_!==null&&We(_,yg.memoizedState.deps)?T.memoizedState=fI(h,N,W,_):(mi.flags|=u,T.memoizedState=fI(1|h,N,W,_))}function Ds(u,h){wa(8390656,8,u,h)}function ce(u,h){sr(2048,8,u,h)}function ze(u,h){return sr(4,2,u,h)}function At(u,h){return sr(4,4,u,h)}function ZA(u,h){if(typeof h=="function"){u=u();var N=h(u);return function(){typeof N=="function"?N():h(null)}}if(h!=null)return u=u(),h.current=u,function(){h.current=null}}function Le(u,h,N){N=N!=null?N.concat([u]):null,sr(4,4,ZA.bind(null,h,u),N)}function $e(){}function Nt(u,h){var N=JA();h=h===void 0?null:h;var _=N.memoizedState;return h!==null&&We(h,_[1])?_[0]:(N.memoizedState=[u,h],u)}function wi(u,h){var N=JA();h=h===void 0?null:h;var _=N.memoizedState;if(h!==null&&We(h,_[1]))return _[0];if(_=u(),xC){Y(!0);try{u()}finally{Y(!1)}}return N.memoizedState=[_,h],_}function Mg(u,h,N){return N===void 0||(_s&1073741824)!==0?u.memoizedState=h:(u.memoizedState=N,u=ws(),mi.lanes|=u,Ta|=u,N)}function en(u,h,N,_){return Fa(N,h)?N:vs.current!==null?(u=Mg(u,N,_),Fa(u,h)||(_I=!0),u):(_s&42)===0?(_I=!0,u.memoizedState=N):(u=ws(),mi.lanes|=u,Ta|=u,h)}function So(u,h,N,_,T){var W=gn();oo(W!==0&&8>W?W:8);var lA=$t.T,TA={};$t.T=TA,wo(u,!1,h,N);try{var le=T(),qe=$t.S;if(qe!==null&&qe(TA,le),le!==null&&typeof le=="object"&&typeof le.then=="function"){var rt=VA(le,_);lI(u,h,rt,No(u))}else lI(u,h,_,No(u))}catch(mt){lI(u,h,{then:function(){},status:"rejected",reason:mt},No())}finally{oo(W),$t.T=lA}}function ma(u){var h=u.memoizedState;if(h!==null)return h;h={memoizedState:ia,baseState:ia,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xe,lastRenderedState:ia},next:null};var N={};return h.next={memoizedState:N,baseState:N,baseQueue:null,queue:{pending:null,lanes:0,dispatch:null,lastRenderedReducer:Xe,lastRenderedState:N},next:null},u.memoizedState=h,u=u.alternate,u!==null&&(u.memoizedState=h),h}function zo(){return di(ai)}function $g(){return JA().memoizedState}function FB(){return JA().memoizedState}function DI(u){for(var h=u.return;h!==null;){switch(h.tag){case 24:case 3:var N=No();u=WA(N);var _=_A(h,u,N);_!==null&&(Io(_,h,N),zA(_,h,N)),h={cache:Xo()},u.payload=h;return}h=h.return}}function ka(u,h,N){var _=No();N={lane:_,revertLane:0,action:N,hasEagerState:!1,eagerState:null,next:null},bn(u)?tn(h,N):(N=hA(u,h,N,_),N!==null&&(Io(N,u,_),Tr(N,h,_)))}function Ng(u,h,N){var _=No();lI(u,h,N,_)}function lI(u,h,N,_){var T={lane:_,revertLane:0,action:N,hasEagerState:!1,eagerState:null,next:null};if(bn(u))tn(h,T);else{var W=u.alternate;if(u.lanes===0&&(W===null||W.lanes===0)&&(W=h.lastRenderedReducer,W!==null))try{var lA=h.lastRenderedState,TA=W(lA,N);if(T.hasEagerState=!0,T.eagerState=TA,Fa(TA,lA))return iA(u,h,T,0),xi===null&&tA(),!1}catch{}finally{}if(N=hA(u,h,T,_),N!==null)return Io(N,u,_),Tr(N,h,_),!0}return!1}function wo(u,h,N,_){if(_={lane:2,revertLane:Se(),action:_,hasEagerState:!1,eagerState:null,next:null},bn(u)){if(h)throw Error(g(479))}else h=hA(u,N,_,2),h!==null&&Io(h,u,2)}function bn(u){var h=u.alternate;return u===mi||h!==null&&h===mi}function tn(u,h){aI=ur=!0;var N=u.pending;N===null?h.next=h:(h.next=N.next,N.next=h),u.pending=h}function Tr(u,h,N){if((N&4194176)!==0){var _=h.lanes;_&=u.pendingLanes,N|=_,h.lanes=N,P(u,N)}}function Dg(u,h,N,_){h=u.memoizedState,N=N(_,h),N=N==null?h:ll({},h,N),u.memoizedState=N,u.lanes===0&&(u.updateQueue.baseState=N)}function En(u,h,N,_,T,W,lA){return u=u.stateNode,typeof u.shouldComponentUpdate=="function"?u.shouldComponentUpdate(_,W,lA):h.prototype&&h.prototype.isPureReactComponent?!Re(N,_)||!Re(T,W):!0}function Vo(u,h,N,_){u=h.state,typeof h.componentWillReceiveProps=="function"&&h.componentWillReceiveProps(N,_),typeof h.UNSAFE_componentWillReceiveProps=="function"&&h.UNSAFE_componentWillReceiveProps(N,_),h.state!==u&&$p.enqueueReplaceState(h,h.state,null)}function eo(u,h){var N=h;if("ref"in h){N={};for(var _ in h)_!=="ref"&&(N[_]=h[_])}if(u=u.defaultProps){N===h&&(N=ll({},N));for(var T in u)N[T]===void 0&&(N[T]=u[T])}return N}function Al(u,h){try{var N=u.onUncaughtError;N(h.value,{componentStack:h.stack})}catch(_){setTimeout(function(){throw _})}}function DC(u,h,N){try{var _=u.onCaughtError;_(N.value,{componentStack:N.stack,errorBoundary:h.tag===1?h.stateNode:null})}catch(T){setTimeout(function(){throw T})}}function ys(u,h,N){return N=WA(N),N.tag=3,N.payload={element:null},N.callback=function(){Al(u,h)},N}function Yr(u){return u=WA(u),u.tag=3,u}function el(u,h,N,_){var T=N.type.getDerivedStateFromError;if(typeof T=="function"){var W=_.value;u.payload=function(){return T(W)},u.callback=function(){DC(h,N,_)}}var lA=N.stateNode;lA!==null&&typeof lA.componentDidCatch=="function"&&(u.callback=function(){DC(h,N,_),typeof T!="function"&&(Ha===null?Ha=new Set([this]):Ha.add(this));var TA=_.stack;this.componentDidCatch(_.value,{componentStack:TA!==null?TA:""})})}function tl(u,h,N,_,T){if(N.flags|=32768,_!==null&&typeof _=="object"&&typeof _.then=="function"){if(h=N.alternate,h!==null&&xe(h,N,T,!0),N=qa.current,N!==null){switch(N.tag){case 13:return Er===null?ta():N.alternate===null&&ig===0&&(ig=3),N.flags&=-257,N.flags|=65536,N.lanes=T,_===Vp?N.flags|=16384:(h=N.updateQueue,h===null?N.updateQueue=new Set([_]):h.add(_),Np(u,_,T)),!1;case 22:return N.flags|=65536,_===Vp?N.flags|=16384:(h=N.updateQueue,h===null?(h={transitions:null,markerInstances:null,retryQueue:new Set([_])},N.updateQueue=h):(N=h.retryQueue,N===null?h.retryQueue=new Set([_]):N.add(_)),Np(u,_,T)),!1}throw Error(g(435,N.tag))}return Np(u,_,T),ta(),!1}if(og)return h=qa.current,h!==null?((h.flags&65536)===0&&(h.flags|=256),h.flags|=65536,h.lanes=T,_!==nh&&(u=Error(g(422),{cause:_}),AA($(u,N)))):(_!==nh&&(h=Error(g(423),{cause:_}),AA($(h,N))),u=u.current.alternate,u.flags|=65536,T&=-T,u.lanes|=T,_=$(_,N),T=ys(u.stateNode,_,T),ge(u,T),ig!==4&&(ig=2)),!1;var W=Error(g(520),{cause:_});if(W=$(W,N),tE===null?tE=[W]:tE.push(W),ig!==4&&(ig=2),h===null)return!0;_=$(_,N),N=h;do{switch(N.tag){case 3:return N.flags|=65536,u=T&-T,N.lanes|=u,u=ys(N.stateNode,_,u),ge(N,u),!1;case 1:if(h=N.type,W=N.stateNode,(N.flags&128)===0&&(typeof h.getDerivedStateFromError=="function"||W!==null&&typeof W.componentDidCatch=="function"&&(Ha===null||!Ha.has(W))))return N.flags|=65536,T&=-T,N.lanes|=T,T=Yr(T),el(T,u,N,_),ge(N,T),!1}N=N.return}while(N!==null);return!1}function EI(u,h,N,_){h.child=u===null?Iw(h,null,N,_):Ic(h,u.child,N,_)}function GQ(u,h,N,_,T){N=N.render;var W=h.ref;if("ref"in _){var lA={};for(var TA in _)TA!=="ref"&&(lA[TA]=_[TA])}else lA=_;return hi(h),_=at(u,h,N,lA,W,T),TA=Pt(),u!==null&&!_I?(jt(u,h,T),Hr(u,h,T)):(og&&TA&&X(h),h.flags|=1,EI(u,h,_,T),h.child)}function yC(u,h,N,_,T){if(u===null){var W=N.type;return typeof W=="function"&&!UC(W)&&W.defaultProps===void 0&&N.compare===null?(h.tag=15,h.type=W,SC(u,h,W,_,T)):(u=Cr(N.type,null,_,h,h.mode,T),u.ref=h.ref,u.return=h,h.child=u)}if(W=u.child,!JB(u,T)){var lA=W.memoizedProps;if(N=N.compare,N=N!==null?N:Re,N(lA,_)&&u.ref===h.ref)return Hr(u,h,T)}return h.flags|=1,u=no(W,_),u.ref=h.ref,u.return=h,h.child=u}function SC(u,h,N,_,T){if(u!==null){var W=u.memoizedProps;if(Re(W,_)&&u.ref===h.ref)if(_I=!1,h.pendingProps=_=W,JB(u,T))(u.flags&131072)!==0&&(_I=!0);else return h.lanes=u.lanes,Hr(u,h,T)}return bB(u,h,N,_,T)}function wC(u,h,N){var _=h.pendingProps,T=_.children,W=(h.stateNode._pendingVisibility&2)!==0,lA=u!==null?u.memoizedState:null;if(il(u,h),_.mode==="hidden"||W){if((h.flags&128)!==0){if(_=lA!==null?lA.baseLanes|N:N,u!==null){for(T=h.child=u.child,W=0;T!==null;)W=W|T.lanes|T.childLanes,T=T.sibling;h.childLanes=W&~_}else h.childLanes=0,h.child=null;return RQ(u,h,_,N)}if((N&536870912)!==0)h.memoizedState={baseLanes:0,cachePool:null},u!==null&&mo(h,lA!==null?lA.cachePool:null),lA!==null?pg(h,lA):Ge(),Yt(h);else return h.lanes=h.childLanes=536870912,RQ(u,h,lA!==null?lA.baseLanes|N:N,N)}else lA!==null?(mo(h,lA.cachePool),pg(h,lA),st(),h.memoizedState=null):(u!==null&&mo(h,null),Ge(),st());return EI(u,h,T,N),h.child}function RQ(u,h,N,_){var T=$o();return T=T===null?null:{parent:Rs?Gg._currentValue:Gg._currentValue2,pool:T},h.memoizedState={baseLanes:N,cachePool:T},u!==null&&mo(h,null),Ge(),Yt(h),u!==null&&xe(u,h,_,!0),null}function il(u,h){var N=h.ref;if(N===null)u!==null&&u.ref!==null&&(h.flags|=2097664);else{if(typeof N!="function"&&typeof N!="object")throw Error(g(284));(u===null||u.ref!==N)&&(h.flags|=2097664)}}function bB(u,h,N,_,T){return hi(h),N=at(u,h,N,_,void 0,T),_=Pt(),u!==null&&!_I?(jt(u,h,T),Hr(u,h,T)):(og&&_&&X(h),h.flags|=1,EI(u,h,N,T),h.child)}function Mu(u,h,N,_,T,W){return hi(h),h.updateQueue=null,N=ae(h,_,N,T),kA(u),_=Pt(),u!==null&&!_I?(jt(u,h,W),Hr(u,h,W)):(og&&_&&X(h),h.flags|=1,EI(u,h,N,W),h.child)}function vB(u,h,N,_,T){if(hi(h),h.stateNode===null){var W=dl,lA=N.contextType;typeof lA=="object"&&lA!==null&&(W=di(lA)),W=new N(_,W),h.memoizedState=W.state!==null&&W.state!==void 0?W.state:null,W.updater=$p,h.stateNode=W,W._reactInternals=h,W=h.stateNode,W.props=_,W.state=h.memoizedState,W.refs={},de(h),lA=N.contextType,W.context=typeof lA=="object"&&lA!==null?di(lA):dl,W.state=h.memoizedState,lA=N.getDerivedStateFromProps,typeof lA=="function"&&(Dg(h,N,lA,_),W.state=h.memoizedState),typeof N.getDerivedStateFromProps=="function"||typeof W.getSnapshotBeforeUpdate=="function"||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(lA=W.state,typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount(),lA!==W.state&&$p.enqueueReplaceState(W,W.state,null),ve(h,_,W,T),he(),W.state=h.memoizedState),typeof W.componentDidMount=="function"&&(h.flags|=4194308),_=!0}else if(u===null){W=h.stateNode;var TA=h.memoizedProps,le=eo(N,TA);W.props=le;var qe=W.context,rt=N.contextType;lA=dl,typeof rt=="object"&&rt!==null&&(lA=di(rt));var mt=N.getDerivedStateFromProps;rt=typeof mt=="function"||typeof W.getSnapshotBeforeUpdate=="function",TA=h.pendingProps!==TA,rt||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(TA||qe!==lA)&&Vo(h,W,_,lA),qC=!1;var Gt=h.memoizedState;W.state=Gt,ve(h,_,W,T),he(),qe=h.memoizedState,TA||Gt!==qe||qC?(typeof mt=="function"&&(Dg(h,N,mt,_),qe=h.memoizedState),(le=qC||En(h,N,le,_,Gt,qe,lA))?(rt||typeof W.UNSAFE_componentWillMount!="function"&&typeof W.componentWillMount!="function"||(typeof W.componentWillMount=="function"&&W.componentWillMount(),typeof W.UNSAFE_componentWillMount=="function"&&W.UNSAFE_componentWillMount()),typeof W.componentDidMount=="function"&&(h.flags|=4194308)):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),h.memoizedProps=_,h.memoizedState=qe),W.props=_,W.state=qe,W.context=lA,_=le):(typeof W.componentDidMount=="function"&&(h.flags|=4194308),_=!1)}else{W=h.stateNode,te(u,h),lA=h.memoizedProps,rt=eo(N,lA),W.props=rt,mt=h.pendingProps,Gt=W.context,qe=N.contextType,le=dl,typeof qe=="object"&&qe!==null&&(le=di(qe)),TA=N.getDerivedStateFromProps,(qe=typeof TA=="function"||typeof W.getSnapshotBeforeUpdate=="function")||typeof W.UNSAFE_componentWillReceiveProps!="function"&&typeof W.componentWillReceiveProps!="function"||(lA!==mt||Gt!==le)&&Vo(h,W,_,le),qC=!1,Gt=h.memoizedState,W.state=Gt,ve(h,_,W,T),he();var Ei=h.memoizedState;lA!==mt||Gt!==Ei||qC||u!==null&&u.dependencies!==null&&Ct(u.dependencies)?(typeof TA=="function"&&(Dg(h,N,TA,_),Ei=h.memoizedState),(rt=qC||En(h,N,rt,_,Gt,Ei,le)||u!==null&&u.dependencies!==null&&Ct(u.dependencies))?(qe||typeof W.UNSAFE_componentWillUpdate!="function"&&typeof W.componentWillUpdate!="function"||(typeof W.componentWillUpdate=="function"&&W.componentWillUpdate(_,Ei,le),typeof W.UNSAFE_componentWillUpdate=="function"&&W.UNSAFE_componentWillUpdate(_,Ei,le)),typeof W.componentDidUpdate=="function"&&(h.flags|=4),typeof W.getSnapshotBeforeUpdate=="function"&&(h.flags|=1024)):(typeof W.componentDidUpdate!="function"||lA===u.memoizedProps&&Gt===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||lA===u.memoizedProps&&Gt===u.memoizedState||(h.flags|=1024),h.memoizedProps=_,h.memoizedState=Ei),W.props=_,W.state=Ei,W.context=le,_=rt):(typeof W.componentDidUpdate!="function"||lA===u.memoizedProps&&Gt===u.memoizedState||(h.flags|=4),typeof W.getSnapshotBeforeUpdate!="function"||lA===u.memoizedProps&&Gt===u.memoizedState||(h.flags|=1024),_=!1)}return W=_,il(u,h),_=(h.flags&128)!==0,W||_?(W=h.stateNode,N=_&&typeof N.getDerivedStateFromError!="function"?null:W.render(),h.flags|=1,u!==null&&_?(h.child=Ic(h,u.child,null,T),h.child=Ic(h,null,N,T)):EI(u,h,N,T),h.memoizedState=W.state,u=h.child):u=Hr(u,h,T),u}function _B(u,h,N,_){return oA(),h.flags|=256,EI(u,h,N,_),h.child}function Nu(u){return{baseLanes:u,cachePool:Il()}}function Gu(u,h,N){return u=u!==null?u.childLanes&~N:0,h&&(u|=ra),u}function Ep(u,h,N){var _=h.pendingProps,T=!1,W=(h.flags&128)!==0,lA;if((lA=W)||(lA=u!==null&&u.memoizedState===null?!1:(jI.current&2)!==0),lA&&(T=!0,h.flags&=-129),lA=(h.flags&32)!==0,h.flags&=-33,u===null){if(og){if(T?Rt(h):st(),og){var TA=xn,le;(le=TA)&&(TA=UM(TA,lr),TA!==null?(h.memoizedState={dehydrated:TA,treeContext:zr!==null?{id:Fs,overflow:cr}:null,retryLane:536870912},le=e(18,null,null,0),le.stateNode=TA,le.return=h,h.child=le,ao=h,xn=null,le=!0):le=!1),le||KA(h)}if(TA=h.memoizedState,TA!==null&&(TA=TA.dehydrated,TA!==null))return Xu(TA)?h.lanes=16:h.lanes=536870912,null;Be(h)}return TA=_.children,_=_.fallback,T?(st(),T=h.mode,TA=Ru({mode:"hidden",children:TA},T),_=FC(_,T,N,null),TA.return=h,_.return=h,TA.sibling=_,h.child=TA,T=h.child,T.memoizedState=Nu(N),T.childLanes=Gu(u,lA,N),h.memoizedState=so,_):(Rt(h),gl(h,TA))}if(le=u.memoizedState,le!==null&&(TA=le.dehydrated,TA!==null)){if(W)h.flags&256?(Rt(h),h.flags&=-257,h=Uu(u,h,N)):h.memoizedState!==null?(st(),h.child=u.child,h.flags|=128,h=null):(st(),T=_.fallback,TA=h.mode,_=Ru({mode:"visible",children:_.children},TA),T=FC(T,TA,N,null),T.flags|=2,_.return=h,T.return=h,_.sibling=T,h.child=_,Ic(h,u.child,null,N),_=h.child,_.memoizedState=Nu(N),_.childLanes=Gu(u,lA,N),h.memoizedState=so,h=T);else if(Rt(h),Xu(TA))lA=wM(TA).digest,_=Error(g(419)),_.stack="",_.digest=lA,AA({value:_,source:null,stack:null}),h=Uu(u,h,N);else if(_I||xe(u,h,N,!1),lA=(N&u.childLanes)!==0,_I||lA){if(lA=xi,lA!==null){if(_=N&-N,(_&42)!==0)_=1;else switch(_){case 2:_=1;break;case 8:_=4;break;case 32:_=16;break;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:case 4194304:case 8388608:case 16777216:case 33554432:_=64;break;case 268435456:_=134217728;break;default:_=0}if(_=(_&(lA.suspendedLanes|N))!==0?0:_,_!==0&&_!==le.retryLane)throw le.retryLane=_,DA(u,_),Io(lA,u,_),jM}xp(TA)||ta(),h=Uu(u,h,N)}else xp(TA)?(h.flags|=128,h.child=u.child,h=Bl.bind(null,u),Dv(TA,h),h=null):(u=le.treeContext,Go&&(xn=NM(TA),ao=h,og=!0,_a=null,lr=!1,u!==null&&(ba[va++]=Fs,ba[va++]=cr,ba[va++]=zr,Fs=u.id,cr=u.overflow,zr=h)),h=gl(h,_.children),h.flags|=4096);return h}return T?(st(),T=_.fallback,TA=h.mode,le=u.child,W=le.sibling,_=no(le,{mode:"hidden",children:_.children}),_.subtreeFlags=le.subtreeFlags&31457280,W!==null?T=no(W,T):(T=FC(T,TA,N,null),T.flags|=2),T.return=h,_.return=h,_.sibling=T,h.child=_,_=T,T=h.child,TA=u.child.memoizedState,TA===null?TA=Nu(N):(le=TA.cachePool,le!==null?(W=Rs?Gg._currentValue:Gg._currentValue2,le=le.parent!==W?{parent:W,pool:W}:le):le=Il(),TA={baseLanes:TA.baseLanes|N,cachePool:le}),T.memoizedState=TA,T.childLanes=Gu(u,lA,N),h.memoizedState=so,_):(Rt(h),N=u.child,u=N.sibling,N=no(N,{mode:"visible",children:_.children}),N.return=h,N.sibling=null,u!==null&&(lA=h.deletions,lA===null?(h.deletions=[u],h.flags|=16):lA.push(u)),h.child=N,h.memoizedState=null,N)}function gl(u,h){return h=Ru({mode:"visible",children:h},u.mode),h.return=u,u.child=h}function Ru(u,h){return Gp(u,h,0,null)}function Uu(u,h,N){return Ic(h,u.child,null,N),u=gl(h,h.pendingProps.children),u.flags|=2,h.memoizedState=null,u}function up(u,h,N){u.lanes|=h;var _=u.alternate;_!==null&&(_.lanes|=h),PA(u.return,h,N)}function mC(u,h,N,_,T){var W=u.memoizedState;W===null?u.memoizedState={isBackwards:h,rendering:null,renderingStartTime:0,last:_,tail:N,tailMode:T}:(W.isBackwards=h,W.rendering=null,W.renderingStartTime=0,W.last=_,W.tail=N,W.tailMode=T)}function Ku(u,h,N){var _=h.pendingProps,T=_.revealOrder,W=_.tail;if(EI(u,h,_.children,N),_=jI.current,(_&2)!==0)_=_&1|2,h.flags|=128;else{if(u!==null&&(u.flags&128)!==0)A:for(u=h.child;u!==null;){if(u.tag===13)u.memoizedState!==null&&up(u,N,h);else if(u.tag===19)up(u,N,h);else if(u.child!==null){u.child.return=u,u=u.child;continue}if(u===h)break A;for(;u.sibling===null;){if(u.return===null||u.return===h)break A;u=u.return}u.sibling.return=u.return,u=u.sibling}_&=1}switch(M(jI,_),T){case"forwards":for(N=h.child,T=null;N!==null;)u=N.alternate,u!==null&&jA(u)===null&&(T=N),N=N.sibling;N=T,N===null?(T=h.child,h.child=null):(T=N.sibling,N.sibling=null),mC(h,!1,T,N,W);break;case"backwards":for(N=null,T=h.child,h.child=null;T!==null;){if(u=T.alternate,u!==null&&jA(u)===null){h.child=T;break}u=T.sibling,T.sibling=N,N=T,T=u}mC(h,!0,N,null,W);break;case"together":mC(h,!1,null,null,void 0);break;default:h.memoizedState=null}return h.child}function Hr(u,h,N){if(u!==null&&(h.dependencies=u.dependencies),Ta|=h.lanes,(N&h.childLanes)===0)if(u!==null){if(xe(u,h,N,!1),(N&h.childLanes)===0)return null}else return null;if(u!==null&&h.child!==u.child)throw Error(g(153));if(h.child!==null){for(u=h.child,N=no(u,u.pendingProps),h.child=N,N.return=h;u.sibling!==null;)u=u.sibling,N=N.sibling=no(u,u.pendingProps),N.return=h;N.sibling=null}return h.child}function JB(u,h){return(u.lanes&h)!==0?!0:(u=u.dependencies,!!(u!==null&&Ct(u)))}function fA(u,h,N){switch(h.tag){case 3:rA(h,h.stateNode.containerInfo),Ae(h,Gg,u.memoizedState.cache),oA();break;case 27:case 5:IA(h);break;case 4:rA(h,h.stateNode.containerInfo);break;case 10:Ae(h,h.type,h.memoizedProps.value);break;case 13:var _=h.memoizedState;if(_!==null)return _.dehydrated!==null?(Rt(h),h.flags|=128,null):(N&h.child.childLanes)!==0?Ep(u,h,N):(Rt(h),u=Hr(u,h,N),u!==null?u.sibling:null);Rt(h);break;case 19:var T=(u.flags&128)!==0;if(_=(N&h.childLanes)!==0,_||(xe(u,h,N,!1),_=(N&h.childLanes)!==0),T){if(_)return Ku(u,h,N);h.flags|=128}if(T=h.memoizedState,T!==null&&(T.rendering=null,T.tail=null,T.lastEffect=null),M(jI,jI.current),_)break;return null;case 22:case 23:return h.lanes=0,wC(u,h,N);case 24:Ae(h,Gg,u.memoizedState.cache)}return Hr(u,h,N)}function LA(u,h,N){if(u!==null)if(u.memoizedProps!==h.pendingProps)_I=!0;else{if(!JB(u,N)&&(h.flags&128)===0)return _I=!1,fA(u,h,N);_I=(u.flags&131072)!==0}else _I=!1,og&&(h.flags&1048576)!==0&&z(h,gh,h.index);switch(h.lanes=0,h.tag){case 16:A:{u=h.pendingProps;var _=h.elementType,T=_._init;if(_=T(_._payload),h.type=_,typeof _=="function")UC(_)?(u=eo(_,u),h.tag=1,h=vB(null,h,_,u,N)):(h.tag=0,h=bB(null,h,_,u,N));else{if(_!=null){if(T=_.$$typeof,T===YQ){h.tag=11,h=GQ(null,h,_,u,N);break A}else if(T===Hu){h.tag=14,h=yC(null,h,_,u,N);break A}}throw h=n(_)||_,Error(g(306,h,""))}}return h;case 0:return bB(u,h,h.type,h.pendingProps,N);case 1:return _=h.type,T=eo(_,h.pendingProps),vB(u,h,_,T,N);case 3:A:{if(rA(h,h.stateNode.containerInfo),u===null)throw Error(g(387));var W=h.pendingProps;T=h.memoizedState,_=T.element,te(u,h),ve(h,W,null,N);var lA=h.memoizedState;if(W=lA.cache,Ae(h,Gg,W),W!==T.cache&&Ke(h,[Gg],N,!0),he(),W=lA.element,Go&&T.isDehydrated)if(T={element:W,isDehydrated:!1,cache:lA.cache},h.updateQueue.baseState=T,h.memoizedState=T,h.flags&256){h=_B(u,h,W,N);break A}else if(W!==_){_=$(Error(g(424)),h),AA(_),h=_B(u,h,W,N);break A}else for(Go&&(xn=MM(h.stateNode.containerInfo),ao=h,og=!0,_a=null,lr=!0),N=Iw(h,null,W,N),h.child=N;N;)N.flags=N.flags&-3|4096,N=N.sibling;else{if(oA(),W===_){h=Hr(u,h,N);break A}EI(u,h,W,N)}h=h.child}return h;case 26:if(Ka)return il(u,h),u===null?(N=Pp(h.type,null,h.pendingProps,null))?h.memoizedState=N:og||(h.stateNode=Sv(h.type,h.pendingProps,Vr.current,h)):h.memoizedState=Pp(h.type,u.memoizedProps,h.pendingProps,u.memoizedState),null;case 27:if(Ln)return IA(h),u===null&&Ln&&og&&(_=h.stateNode=ew(h.type,h.pendingProps,Vr.current,fn.current,!1),ao=h,lr=!0,xn=Tp(_)),_=h.pendingProps.children,u!==null||og?EI(u,h,_,N):h.child=Ic(h,null,_,N),il(u,h),h.child;case 5:return u===null&&og&&(_M(h.type,h.pendingProps,fn.current),(T=_=xn)&&(_=GM(_,h.type,h.pendingProps,lr),_!==null?(h.stateNode=_,ao=h,xn=Tp(_),lr=!1,T=!0):T=!1),T||KA(h)),IA(h),T=h.type,W=h.pendingProps,lA=u!==null?u.memoizedProps:null,_=W.children,Ac(T,W)?_=null:lA!==null&&Ac(T,lA)&&(h.flags|=32),h.memoizedState!==null&&(T=at(u,h,Ye,null,null,N),Rs?ai._currentValue=T:ai._currentValue2=T),il(u,h),EI(u,h,_,N),h.child;case 6:return u===null&&og&&(JM(h.pendingProps,fn.current),(u=N=xn)&&(N=RM(N,h.pendingProps,lr),N!==null?(h.stateNode=N,ao=h,xn=null,u=!0):u=!1),u||KA(h)),null;case 13:return Ep(u,h,N);case 4:return rA(h,h.stateNode.containerInfo),_=h.pendingProps,u===null?h.child=Ic(h,null,_,N):EI(u,h,_,N),h.child;case 11:return GQ(u,h,h.type,h.pendingProps,N);case 7:return EI(u,h,h.pendingProps,N),h.child;case 8:return EI(u,h,h.pendingProps.children,N),h.child;case 12:return EI(u,h,h.pendingProps.children,N),h.child;case 10:return _=h.pendingProps,Ae(h,h.type,_.value),EI(u,h,_.children,N),h.child;case 9:return T=h.type._context,_=h.pendingProps.children,hi(h),T=di(T),_=_(T),h.flags|=1,EI(u,h,_,N),h.child;case 14:return yC(u,h,h.type,h.pendingProps,N);case 15:return SC(u,h,h.type,h.pendingProps,N);case 19:return Ku(u,h,N);case 22:return wC(u,h,N);case 24:return hi(h),_=di(Gg),u===null?(T=$o(),T===null&&(T=xi,W=Xo(),T.pooledCache=W,W.refCount++,W!==null&&(T.pooledCacheLanes|=N),T=W),h.memoizedState={parent:_,cache:T},de(h),Ae(h,Gg,T)):((u.lanes&N)!==0&&(te(u,h),ve(h,null,null,N),he()),T=u.memoizedState,W=h.memoizedState,T.parent!==_?(T={parent:_,cache:_},h.memoizedState=T,h.lanes===0&&(h.memoizedState=h.updateQueue.baseState=T),Ae(h,Gg,_)):(_=W.cache,Ae(h,Gg,_),_!==T.cache&&Ke(h,[Gg],N,!0))),EI(u,h,h.pendingProps.children,N),h.child;case 29:throw h.pendingProps}throw Error(g(156,h.tag))}function Ae(u,h,N){Rs?(M(oa,h._currentValue),h._currentValue=N):(M(oa,h._currentValue2),h._currentValue2=N)}function Ee(u){var h=oa.current;Rs?u._currentValue=h:u._currentValue2=h,f(oa)}function PA(u,h,N){for(;u!==null;){var _=u.alternate;if((u.childLanes&h)!==h?(u.childLanes|=h,_!==null&&(_.childLanes|=h)):_!==null&&(_.childLanes&h)!==h&&(_.childLanes|=h),u===N)break;u=u.return}}function Ke(u,h,N,_){var T=u.child;for(T!==null&&(T.return=u);T!==null;){var W=T.dependencies;if(W!==null){var lA=T.child;W=W.firstContext;A:for(;W!==null;){var TA=W;W=T;for(var le=0;le<h.length;le++)if(TA.context===h[le]){W.lanes|=N,TA=W.alternate,TA!==null&&(TA.lanes|=N),PA(W.return,N,u),_||(lA=null);break A}W=TA.next}}else if(T.tag===18){if(lA=T.return,lA===null)throw Error(g(341));lA.lanes|=N,W=lA.alternate,W!==null&&(W.lanes|=N),PA(lA,N,u),lA=null}else lA=T.child;if(lA!==null)lA.return=T;else for(lA=T;lA!==null;){if(lA===u){lA=null;break}if(T=lA.sibling,T!==null){T.return=lA.return,lA=T;break}lA=lA.return}T=lA}}function xe(u,h,N,_){u=null;for(var T=h,W=!1;T!==null;){if(!W){if((T.flags&524288)!==0)W=!0;else if((T.flags&262144)!==0)break}if(T.tag===10){var lA=T.alternate;if(lA===null)throw Error(g(387));if(lA=lA.memoizedProps,lA!==null){var TA=T.type;Fa(T.pendingProps.value,lA.value)||(u!==null?u.push(TA):u=[TA])}}else if(T===zQ.current){if(lA=T.alternate,lA===null)throw Error(g(387));lA.memoizedState.memoizedState!==T.memoizedState.memoizedState&&(u!==null?u.push(ai):u=[ai])}T=T.return}u!==null&&Ke(h,u,N,_),h.flags|=262144}function Ct(u){for(u=u.firstContext;u!==null;){var h=u.context;if(!Fa(Rs?h._currentValue:h._currentValue2,u.memoizedValue))return!0;u=u.next}return!1}function hi(u){oc=u,kI=null,u=u.dependencies,u!==null&&(u.firstContext=null)}function di(u){return _g(oc,u)}function li(u,h){return oc===null&&hi(u),_g(u,h)}function _g(u,h){var N=Rs?h._currentValue:h._currentValue2;if(h={context:h,memoizedValue:N,next:null},kI===null){if(u===null)throw Error(g(308));kI=h,u.dependencies={lanes:0,firstContext:h},u.flags|=524288}else kI=kI.next=h;return N}function Xo(){return{controller:new ZM,data:new Map,refCount:0}}function Ma(u){u.refCount--,u.refCount===0&&TC(Dl,function(){u.controller.abort()})}function $o(){var u=YC.current;return u!==null?u:xi.pooledCache}function mo(u,h){h===null?M(YC,YC.current):M(YC,h.pool)}function Il(){var u=$o();return u===null?null:{parent:Rs?Gg._currentValue:Gg._currentValue2,pool:u}}function to(u){u.flags|=4}function vn(u,h){if(u!==null&&u.child===h.child)return!1;if((h.flags&16)!==0)return!0;for(u=h.child;u!==null;){if((u.flags&13878)!==0||(u.subtreeFlags&13878)!==0)return!0;u=u.sibling}return!1}function Or(u,h,N,_){if(Jn)for(N=h.child;N!==null;){if(N.tag===5||N.tag===6)Gs(u,N.stateNode);else if(!(N.tag===4||Ln&&N.tag===27)&&N.child!==null){N.child.return=N,N=N.child;continue}if(N===h)break;for(;N.sibling===null;){if(N.return===null||N.return===h)return;N=N.return}N.sibling.return=N.return,N=N.sibling}else if(Ra)for(var T=h.child;T!==null;){if(T.tag===5){var W=T.stateNode;N&&_&&(W=TS(W,T.type,T.memoizedProps)),Gs(u,W)}else if(T.tag===6)W=T.stateNode,N&&_&&(W=YS(W,T.memoizedProps)),Gs(u,W);else if(T.tag!==4){if(T.tag===22&&T.memoizedState!==null)W=T.child,W!==null&&(W.return=T),Or(u,T,!0,!0);else if(T.child!==null){T.child.return=T,T=T.child;continue}}if(T===h)break;for(;T.sibling===null;){if(T.return===null||T.return===h)return;T=T.return}T.sibling.return=T.return,T=T.sibling}}function kC(u,h,N,_){if(Ra)for(var T=h.child;T!==null;){if(T.tag===5){var W=T.stateNode;N&&_&&(W=TS(W,T.type,T.memoizedProps)),qS(u,W)}else if(T.tag===6)W=T.stateNode,N&&_&&(W=YS(W,T.memoizedProps)),qS(u,W);else if(T.tag!==4){if(T.tag===22&&T.memoizedState!==null)W=T.child,W!==null&&(W.return=T),kC(u,T,!(T.memoizedProps!==null&&T.memoizedProps.mode==="manual"),!0);else if(T.child!==null){T.child.return=T,T=T.child;continue}}if(T===h)break;for(;T.sibling===null;){if(T.return===null||T.return===h)return;T=T.return}T.sibling.return=T.return,T=T.sibling}}function io(u,h){if(Ra&&vn(u,h)){u=h.stateNode;var N=u.containerInfo,_=qp();kC(_,h,!1,!1),u.pendingChildren=_,to(h),SM(N,_)}}function Fu(u,h,N,_){if(Jn)u.memoizedProps!==_&&to(h);else if(Ra){var T=u.stateNode,W=u.memoizedProps;if((u=vn(u,h))||W!==_){var lA=fn.current;W=LS(T,N,W,_,!u,null),W===T?h.stateNode=T:(vC(W,N,_,lA)&&to(h),h.stateNode=W,u?Or(W,h,!1,!1):to(h))}else h.stateNode=T}}function nl(u,h,N){if(fM(h,N)){if(u.flags|=16777216,!_C(h,N))if(qu())u.flags|=8192;else throw fl=Vp,gw}else u.flags&=-16777217}function rS(u,h){if(LM(h)){if(u.flags|=16777216,!$S(h))if(qu())u.flags|=8192;else throw fl=Vp,gw}else u.flags&=-16777217}function bu(u,h){h!==null&&(u.flags|=4),u.flags&16384&&(h=u.tag!==22?R():536870912,u.lanes|=h,OC|=h)}function ol(u,h){if(!og)switch(u.tailMode){case"hidden":h=u.tail;for(var N=null;h!==null;)h.alternate!==null&&(N=h),h=h.sibling;N===null?u.tail=null:N.sibling=null;break;case"collapsed":N=u.tail;for(var _=null;N!==null;)N.alternate!==null&&(_=N),N=N.sibling;_===null?h||u.tail===null?u.tail=null:u.tail.sibling=null:_.sibling=null}}function II(u){var h=u.alternate!==null&&u.alternate.child===u.child,N=0,_=0;if(h)for(var T=u.child;T!==null;)N|=T.lanes|T.childLanes,_|=T.subtreeFlags&31457280,_|=T.flags&31457280,T.return=u,T=T.sibling;else for(T=u.child;T!==null;)N|=T.lanes|T.childLanes,_|=T.subtreeFlags,_|=T.flags,T.return=u,T=T.sibling;return u.subtreeFlags|=_,u.childLanes=N,h}function aM(u,h,N){var _=h.pendingProps;switch(sA(h),h.tag){case 16:case 15:case 0:case 11:case 7:case 8:case 12:case 9:case 14:return II(h),null;case 1:return II(h),null;case 3:return N=h.stateNode,_=null,u!==null&&(_=u.memoizedState.cache),h.memoizedState.cache!==_&&(h.flags|=2048),Ee(Gg),mA(),N.pendingContext&&(N.context=N.pendingContext,N.pendingContext=null),(u===null||u.child===null)&&(MA(h)?to(h):u===null||u.memoizedState.isDehydrated&&(h.flags&256)===0||(h.flags|=1024,_a!==null&&(NC(_a),_a=null))),io(u,h),II(h),null;case 26:if(Ka){N=h.type;var T=h.memoizedState;return u===null?(to(h),T!==null?(II(h),rS(h,T)):(II(h),nl(h,N,_))):T?T!==u.memoizedState?(to(h),II(h),rS(h,T)):(II(h),h.flags&=-16777217):(Jn?u.memoizedProps!==_&&to(h):Fu(u,h,N,_),II(h),nl(h,N,_)),null}case 27:if(Ln){if(uA(h),N=Vr.current,T=h.type,u!==null&&h.stateNode!=null)Jn?u.memoizedProps!==_&&to(h):Fu(u,h,T,_);else{if(!_){if(h.stateNode===null)throw Error(g(166));return II(h),null}u=fn.current,MA(h)?FA(h,u):(u=ew(T,_,N,u,!0),h.stateNode=u,to(h))}return II(h),null}case 5:if(uA(h),N=h.type,u!==null&&h.stateNode!=null)Fu(u,h,N,_);else{if(!_){if(h.stateNode===null)throw Error(g(166));return II(h),null}u=fn.current,MA(h)?FA(h,u):(T=MS(N,_,Vr.current,u,h),Or(T,h,!1,!1),h.stateNode=T,vC(T,N,_,u)&&to(h))}return II(h),nl(h,h.type,h.pendingProps),null;case 6:if(u&&h.stateNode!=null)N=u.memoizedProps,Jn?N!==_&&to(h):Ra&&(N!==_?(h.stateNode=Fp(_,Vr.current,fn.current,h),to(h)):h.stateNode=u.stateNode);else{if(typeof _!="string"&&h.stateNode===null)throw Error(g(166));if(u=Vr.current,N=fn.current,MA(h)){if(!Go)throw Error(g(176));if(u=h.stateNode,N=h.memoizedProps,_=null,T=ao,T!==null)switch(T.tag){case 27:case 5:_=T.memoizedProps}KM(u,N,h,_)||KA(h)}else h.stateNode=Fp(_,u,N,h)}return II(h),null;case 13:if(_=h.memoizedState,u===null||u.memoizedState!==null&&u.memoizedState.dehydrated!==null){if(T=MA(h),_!==null&&_.dehydrated!==null){if(u===null){if(!T)throw Error(g(318));if(!Go)throw Error(g(344));if(T=h.memoizedState,T=T!==null?T.dehydrated:null,!T)throw Error(g(317));OQ(T,h)}else oA(),(h.flags&128)===0&&(h.memoizedState=null),h.flags|=4;II(h),T=!1}else _a!==null&&(NC(_a),_a=null),T=!0;if(!T)return h.flags&256?(Be(h),h):(Be(h),null)}if(Be(h),(h.flags&128)!==0)return h.lanes=N,h;if(N=_!==null,u=u!==null&&u.memoizedState!==null,N){_=h.child,T=null,_.alternate!==null&&_.alternate.memoizedState!==null&&_.alternate.memoizedState.cachePool!==null&&(T=_.alternate.memoizedState.cachePool.pool);var W=null;_.memoizedState!==null&&_.memoizedState.cachePool!==null&&(W=_.memoizedState.cachePool.pool),W!==T&&(_.flags|=2048)}return N!==u&&N&&(h.child.flags|=8192),bu(h,h.updateQueue),II(h),null;case 4:return mA(),io(u,h),u===null&&RS(h.stateNode.containerInfo),II(h),null;case 10:return Ee(h.type),II(h),null;case 19:if(f(jI),T=h.memoizedState,T===null)return II(h),null;if(_=(h.flags&128)!==0,W=T.rendering,W===null)if(_)ol(T,!1);else{if(ig!==0||u!==null&&(u.flags&128)!==0)for(u=h.child;u!==null;){if(W=jA(u),W!==null){for(h.flags|=128,ol(T,!1),u=W.updateQueue,h.updateQueue=u,bu(h,u),h.subtreeFlags=0,u=N,N=h.child;N!==null;)KC(N,u),N=N.sibling;return M(jI,jI.current&1|2),h.child}u=u.sibling}T.tail!==null&&qn()>hI&&(h.flags|=128,_=!0,ol(T,!1),h.lanes=4194304)}else{if(!_)if(u=jA(W),u!==null){if(h.flags|=128,_=!0,u=u.updateQueue,h.updateQueue=u,bu(h,u),ol(T,!0),T.tail===null&&T.tailMode==="hidden"&&!W.alternate&&!og)return II(h),null}else 2*qn()-T.renderingStartTime>hI&&N!==536870912&&(h.flags|=128,_=!0,ol(T,!1),h.lanes=4194304);T.isBackwards?(W.sibling=h.child,h.child=W):(u=T.last,u!==null?u.sibling=W:h.child=W,T.last=W)}return T.tail!==null?(h=T.tail,T.rendering=h,T.tail=h.sibling,T.renderingStartTime=qn(),h.sibling=null,u=jI.current,M(jI,_?u&1|2:u&1),h):(II(h),null);case 22:case 23:return Be(h),lt(),_=h.memoizedState!==null,u!==null?u.memoizedState!==null!==_&&(h.flags|=8192):_&&(h.flags|=8192),_?(N&536870912)!==0&&(h.flags&128)===0&&(II(h),h.subtreeFlags&6&&(h.flags|=8192)):II(h),N=h.updateQueue,N!==null&&bu(h,N.retryQueue),N=null,u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(N=u.memoizedState.cachePool.pool),_=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(_=h.memoizedState.cachePool.pool),_!==N&&(h.flags|=2048),u!==null&&f(YC),null;case 24:return N=null,u!==null&&(N=u.memoizedState.cache),h.memoizedState.cache!==N&&(h.flags|=2048),Ee(Gg),II(h),null;case 25:return null}throw Error(g(156,h.tag))}function rM(u,h){switch(sA(h),h.tag){case 1:return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 3:return Ee(Gg),mA(),u=h.flags,(u&65536)!==0&&(u&128)===0?(h.flags=u&-65537|128,h):null;case 26:case 27:case 5:return uA(h),null;case 13:if(Be(h),u=h.memoizedState,u!==null&&u.dehydrated!==null){if(h.alternate===null)throw Error(g(340));oA()}return u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 19:return f(jI),null;case 4:return mA(),null;case 10:return Ee(h.type),null;case 22:case 23:return Be(h),lt(),u!==null&&f(YC),u=h.flags,u&65536?(h.flags=u&-65537|128,h):null;case 24:return Ee(Gg),null;case 25:return null;default:return null}}function sS(u,h){switch(sA(h),h.tag){case 3:Ee(Gg),mA();break;case 26:case 27:case 5:uA(h);break;case 4:mA();break;case 13:Be(h);break;case 19:f(jI);break;case 10:Ee(h.type);break;case 22:case 23:Be(h),lt(),u!==null&&f(YC);break;case 24:Ee(Gg)}}function vu(u,h){try{var N=h.updateQueue,_=N!==null?N.lastEffect:null;if(_!==null){var T=_.next;N=T;do{if((N.tag&u)===u){_=void 0;var W=N.create,lA=N.inst;_=W(),lA.destroy=_}N=N.next}while(N!==T)}}catch(TA){ji(h,h.return,TA)}}function LB(u,h,N){try{var _=h.updateQueue,T=_!==null?_.lastEffect:null;if(T!==null){var W=T.next;_=W;do{if((_.tag&u)===u){var lA=_.inst,TA=lA.destroy;if(TA!==void 0){lA.destroy=void 0,T=h;var le=N;try{TA()}catch(qe){ji(T,le,qe)}}}_=_.next}while(_!==W)}}catch(qe){ji(h,h.return,qe)}}function sM(u){var h=u.updateQueue;if(h!==null){var N=u.stateNode;try{pA(h,N)}catch(_){ji(u,u.return,_)}}}function CM(u,h,N){N.props=eo(u.type,u.memoizedProps),N.state=u.memoizedState;try{N.componentWillUnmount()}catch(_){ji(u,h,_)}}function al(u,h){try{var N=u.ref;if(N!==null){var _=u.stateNode;switch(u.tag){case 26:case 27:case 5:var T=HQ(_);break;default:T=_}typeof N=="function"?u.refCleanup=N(T):N.current=T}}catch(W){ji(u,h,W)}}function nI(u,h){var N=u.ref,_=u.refCleanup;if(N!==null)if(typeof _=="function")try{_()}catch(T){ji(u,h,T)}finally{u.refCleanup=null,u=u.alternate,u!=null&&(u.refCleanup=null)}else if(typeof N=="function")try{N(null)}catch(T){ji(u,h,T)}else N.current=null}function UQ(u){var h=u.type,N=u.memoizedProps,_=u.stateNode;try{fv(_,h,N,u)}catch(T){ji(u,u.return,T)}}function CS(u,h,N){try{bS(u.stateNode,u.type,N,h,u)}catch(_){ji(u,u.return,_)}}function BS(u){return u.tag===5||u.tag===3||(Ka?u.tag===26:!1)||(Ln?u.tag===27:!1)||u.tag===4}function hp(u){A:for(;;){for(;u.sibling===null;){if(u.return===null||BS(u.return))return null;u=u.return}for(u.sibling.return=u.return,u=u.sibling;u.tag!==5&&u.tag!==6&&(!Ln||u.tag!==27)&&u.tag!==18;){if(u.flags&2||u.child===null||u.tag===4)continue A;u.child.return=u,u=u.child}if(!(u.flags&2))return u.stateNode}}function dp(u,h,N){var _=u.tag;if(_===5||_===6)u=u.stateNode,h?_S(N,u,h):DM(N,u);else if(!(_===4||Ln&&_===27)&&(u=u.child,u!==null))for(dp(u,h,N),u=u.sibling;u!==null;)dp(u,h,N),u=u.sibling}function KQ(u,h,N){var _=u.tag;if(_===5||_===6)u=u.stateNode,h?vS(N,u,h):FS(N,u);else if(!(_===4||Ln&&_===27)&&(u=u.child,u!==null))for(KQ(u,h,N),u=u.sibling;u!==null;)KQ(u,h,N),u=u.sibling}function BM(u,h,N){u=u.containerInfo;try{xS(u,N)}catch(_){ji(h,h.return,_)}}function FQ(u,h){for($B(u.containerInfo),MI=h;MI!==null;)if(u=MI,h=u.child,(u.subtreeFlags&1028)!==0&&h!==null)h.return=u,MI=h;else for(;MI!==null;){u=MI;var N=u.alternate;switch(h=u.flags,u.tag){case 0:break;case 11:case 15:break;case 1:if((h&1024)!==0&&N!==null){h=void 0;var _=u,T=N.memoizedProps;N=N.memoizedState;var W=_.stateNode;try{var lA=eo(_.type,T,_.elementType===_.type);h=W.getSnapshotBeforeUpdate(lA,N),W.__reactInternalSnapshotBeforeUpdate=h}catch(TA){ji(_,_.return,TA)}}break;case 3:(h&1024)!==0&&Jn&&Lp(u.stateNode.containerInfo);break;case 5:case 26:case 27:case 6:case 4:case 17:break;default:if((h&1024)!==0)throw Error(g(163))}if(h=u.sibling,h!==null){h.return=u.return,MI=h;break}MI=u.return}return lA=yl,yl=!1,lA}function pp(u,h,N){var _=N.flags;switch(N.tag){case 0:case 11:case 15:Ss(u,N),_&4&&vu(5,N);break;case 1:if(Ss(u,N),_&4)if(u=N.stateNode,h===null)try{u.componentDidMount()}catch(TA){ji(N,N.return,TA)}else{var T=eo(N.type,h.memoizedProps);h=h.memoizedState;try{u.componentDidUpdate(T,h,u.__reactInternalSnapshotBeforeUpdate)}catch(TA){ji(N,N.return,TA)}}_&64&&sM(N),_&512&&al(N,N.return);break;case 3:if(Ss(u,N),_&64&&(_=N.updateQueue,_!==null)){if(u=null,N.child!==null)switch(N.child.tag){case 27:case 5:u=HQ(N.child.stateNode);break;case 1:u=N.child.stateNode}try{pA(_,u)}catch(TA){ji(N,N.return,TA)}}break;case 26:if(Ka){Ss(u,N),_&512&&al(N,N.return);break}case 27:case 5:Ss(u,N),h===null&&_&4&&UQ(N),_&512&&al(N,N.return);break;case 12:Ss(u,N);break;case 13:Ss(u,N),_&4&&qB(u,N);break;case 22:if(T=N.memoizedState!==null||In,!T){h=h!==null&&h.memoizedState!==null||uI;var W=In,lA=uI;In=T,(uI=h)&&!lA?TB(u,N,(N.subtreeFlags&8772)!==0):Ss(u,N),In=W,uI=lA}_&512&&(N.memoizedProps.mode==="manual"?al(N,N.return):nI(N,N.return));break;default:Ss(u,N)}}function bQ(u){var h=u.alternate;h!==null&&(u.alternate=null,bQ(h)),u.child=null,u.deletions=null,u.sibling=null,u.tag===5&&(h=u.stateNode,h!==null&&US(h)),u.stateNode=null,u.return=null,u.dependencies=null,u.memoizedProps=null,u.memoizedState=null,u.pendingProps=null,u.stateNode=null,u.updateQueue=null}function Na(u,h,N){for(N=N.child;N!==null;)fp(u,h,N),N=N.sibling}function fp(u,h,N){if(Ia&&typeof Ia.onCommitFiberUnmount=="function")try{Ia.onCommitFiberUnmount(WQ,N)}catch{}switch(N.tag){case 26:if(Ka){uI||nI(N,h),Na(u,h,N),N.memoizedState?ZS(N.memoizedState):N.stateNode&&VS(N.stateNode);break}case 27:if(Ln){uI||nI(N,h);var _=JI,T=aa;JI=N.stateNode,Na(u,h,N),qM(N.stateNode),JI=_,aa=T;break}case 5:uI||nI(N,h);case 6:if(Jn){if(_=JI,T=aa,JI=null,Na(u,h,N),JI=_,aa=T,JI!==null)if(aa)try{bI(JI,N.stateNode)}catch(W){ji(N,h,W)}else try{Ro(JI,N.stateNode)}catch(W){ji(N,h,W)}}else Na(u,h,N);break;case 18:Jn&&JI!==null&&(aa?OS(JI,N.stateNode):bM(JI,N.stateNode));break;case 4:Jn?(_=JI,T=aa,JI=N.stateNode.containerInfo,aa=!0,Na(u,h,N),JI=_,aa=T):(Ra&&BM(N.stateNode,N,qp()),Na(u,h,N));break;case 0:case 11:case 14:case 15:uI||LB(2,N,h),uI||LB(4,N,h),Na(u,h,N);break;case 1:uI||(nI(N,h),_=N.stateNode,typeof _.componentWillUnmount=="function"&&CM(N,h,_)),Na(u,h,N);break;case 21:Na(u,h,N);break;case 22:uI||nI(N,h),uI=(_=uI)||N.memoizedState!==null,Na(u,h,N),uI=_;break;default:Na(u,h,N)}}function qB(u,h){if(Go&&h.memoizedState===null&&(u=h.alternate,u!==null&&(u=u.memoizedState,u!==null&&(u=u.dehydrated,u!==null))))try{Hp(u)}catch(N){ji(h,h.return,N)}}function vQ(u){switch(u.tag){case 13:case 19:var h=u.stateNode;return h===null&&(h=u.stateNode=new eE),h;case 22:return u=u.stateNode,h=u._retryCache,h===null&&(h=u._retryCache=new eE),h;default:throw Error(g(435,u.tag))}}function _u(u,h){var N=vQ(u);h.forEach(function(_){var T=uS.bind(null,u,_);N.has(_)||(N.add(_),_.then(T,T))})}function ko(u,h){var N=h.deletions;if(N!==null)for(var _=0;_<N.length;_++){var T=N[_],W=u,lA=h;if(Jn){var TA=lA;A:for(;TA!==null;){switch(TA.tag){case 27:case 5:JI=TA.stateNode,aa=!1;break A;case 3:JI=TA.stateNode.containerInfo,aa=!0;break A;case 4:JI=TA.stateNode.containerInfo,aa=!0;break A}TA=TA.return}if(JI===null)throw Error(g(160));fp(W,lA,T),JI=null,aa=!1}else fp(W,lA,T);W=T.alternate,W!==null&&(W.return=null),T.return=null}if(h.subtreeFlags&13878)for(h=h.child;h!==null;)xB(h,u),h=h.sibling}function xB(u,h){var N=u.alternate,_=u.flags;switch(u.tag){case 0:case 11:case 14:case 15:ko(h,u),Aa(u),_&4&&(LB(3,u,u.return),vu(3,u),LB(5,u,u.return));break;case 1:ko(h,u),Aa(u),_&512&&(uI||N===null||nI(N,N.return)),_&64&&In&&(u=u.updateQueue,u!==null&&(_=u.callbacks,_!==null&&(N=u.shared.hiddenCallbacks,u.shared.hiddenCallbacks=N===null?_:N.concat(_))));break;case 26:if(Ka){var T=Uo;ko(h,u),Aa(u),_&512&&(uI||N===null||nI(N,N.return)),_&4&&(_=N!==null?N.memoizedState:null,h=u.memoizedState,N===null?h===null?u.stateNode===null?u.stateNode=WS(T,u.type,u.memoizedProps,u):zS(T,u.type,u.stateNode):u.stateNode=jS(T,h,u.memoizedProps):_!==h?(_===null?N.stateNode!==null&&VS(N.stateNode):ZS(_),h===null?zS(T,u.type,u.stateNode):jS(T,h,u.memoizedProps)):h===null&&u.stateNode!==null&&CS(u,u.memoizedProps,N.memoizedProps));break}case 27:if(Ln&&_&4&&u.alternate===null){T=u.stateNode;var W=u.memoizedProps;try{wv(T),mv(u.type,W,T,u)}catch(rt){ji(u,u.return,rt)}}case 5:if(ko(h,u),Aa(u),_&512&&(uI||N===null||nI(N,N.return)),Jn){if(u.flags&32){h=u.stateNode;try{zu(h)}catch(rt){ji(u,u.return,rt)}}_&4&&u.stateNode!=null&&(h=u.memoizedProps,CS(u,h,N!==null?N.memoizedProps:h)),_&1024&&(ac=!0)}break;case 6:if(ko(h,u),Aa(u),_&4&&Jn){if(u.stateNode===null)throw Error(g(162));_=u.memoizedProps,N=N!==null?N.memoizedProps:_,h=u.stateNode;try{yM(h,N,_)}catch(rt){ji(u,u.return,rt)}}break;case 3:if(Ka?(XS(),T=Uo,Uo=Op(h.containerInfo),ko(h,u),Uo=T):ko(h,u),Aa(u),_&4){if(Jn&&Go&&N!==null&&N.memoizedState.isDehydrated)try{Yp(h.containerInfo)}catch(rt){ji(u,u.return,rt)}if(Ra){_=h.containerInfo,N=h.pendingChildren;try{xS(_,N)}catch(rt){ji(u,u.return,rt)}}}ac&&(ac=!1,cS(u));break;case 4:Ka?(N=Uo,Uo=Op(u.stateNode.containerInfo),ko(h,u),Aa(u),Uo=N):(ko(h,u),Aa(u)),_&4&&Ra&&BM(u.stateNode,u,u.stateNode.pendingChildren);break;case 12:ko(h,u),Aa(u);break;case 13:ko(h,u),Aa(u),u.child.flags&8192&&u.memoizedState!==null!=(N!==null&&N.memoizedState!==null)&&(Js=qn()),_&4&&(_=u.updateQueue,_!==null&&(u.updateQueue=null,_u(u,_)));break;case 22:_&512&&(uI||N===null||nI(N,N.return)),T=u.memoizedState!==null;var lA=N!==null&&N.memoizedState!==null,TA=In,le=uI;if(In=TA||T,uI=le||lA,ko(h,u),uI=le,In=TA,Aa(u),h=u.stateNode,h._current=u,h._visibility&=-3,h._visibility|=h._pendingVisibility&2,_&8192&&(h._visibility=T?h._visibility&-2:h._visibility|1,T&&(h=In||uI,N===null||lA||h||_Q(u)),Jn&&(u.memoizedProps===null||u.memoizedProps.mode!=="manual"))){A:if(N=null,Jn)for(h=u;;){if(h.tag===5||Ka&&h.tag===26||Ln&&h.tag===27){if(N===null){lA=N=h;try{W=lA.stateNode,T?Vu(W):JS(lA.stateNode,lA.memoizedProps)}catch(rt){ji(lA,lA.return,rt)}}}else if(h.tag===6){if(N===null){lA=h;try{var qe=lA.stateNode;T?Jp(qe):JC(qe,lA.memoizedProps)}catch(rt){ji(lA,lA.return,rt)}}}else if((h.tag!==22&&h.tag!==23||h.memoizedState===null||h===u)&&h.child!==null){h.child.return=h,h=h.child;continue}if(h===u)break A;for(;h.sibling===null;){if(h.return===null||h.return===u)break A;N===h&&(N=null),h=h.return}N===h&&(N=null),h.sibling.return=h.return,h=h.sibling}}_&4&&(_=u.updateQueue,_!==null&&(N=_.retryQueue,N!==null&&(_.retryQueue=null,_u(u,N))));break;case 19:ko(h,u),Aa(u),_&4&&(_=u.updateQueue,_!==null&&(u.updateQueue=null,_u(u,_)));break;case 21:break;default:ko(h,u),Aa(u)}}function Aa(u){var h=u.flags;if(h&2){try{if(Jn&&(!Ln||u.tag!==27)){A:{for(var N=u.return;N!==null;){if(BS(N)){var _=N;break A}N=N.return}throw Error(g(160))}switch(_.tag){case 27:if(Ln){var T=_.stateNode,W=hp(u);KQ(u,W,T);break}case 5:var lA=_.stateNode;_.flags&32&&(zu(lA),_.flags&=-33);var TA=hp(u);KQ(u,TA,lA);break;case 3:case 4:var le=_.stateNode.containerInfo,qe=hp(u);dp(u,qe,le);break;default:throw Error(g(161))}}}catch(rt){ji(u,u.return,rt)}u.flags&=-3}h&4096&&(u.flags&=-4097)}function cS(u){if(u.subtreeFlags&1024)for(u=u.child;u!==null;){var h=u;cS(h),h.tag===5&&h.flags&1024&&xg(h.stateNode),u=u.sibling}}function Ss(u,h){if(h.subtreeFlags&8772)for(h=h.child;h!==null;)pp(u,h.alternate,h),h=h.sibling}function _Q(u){for(u=u.child;u!==null;){var h=u;switch(h.tag){case 0:case 11:case 14:case 15:LB(4,h,h.return),_Q(h);break;case 1:nI(h,h.return);var N=h.stateNode;typeof N.componentWillUnmount=="function"&&CM(h,h.return,N),_Q(h);break;case 26:case 27:case 5:nI(h,h.return),_Q(h);break;case 22:nI(h,h.return),h.memoizedState===null&&_Q(h);break;default:_Q(h)}u=u.sibling}}function TB(u,h,N){for(N=N&&(h.subtreeFlags&8772)!==0,h=h.child;h!==null;){var _=h.alternate,T=u,W=h,lA=W.flags;switch(W.tag){case 0:case 11:case 15:TB(T,W,N),vu(4,W);break;case 1:if(TB(T,W,N),_=W,T=_.stateNode,typeof T.componentDidMount=="function")try{T.componentDidMount()}catch(qe){ji(_,_.return,qe)}if(_=W,T=_.updateQueue,T!==null){var TA=_.stateNode;try{var le=T.shared.hiddenCallbacks;if(le!==null)for(T.shared.hiddenCallbacks=null,T=0;T<le.length;T++)bA(le[T],TA)}catch(qe){ji(_,_.return,qe)}}N&&lA&64&&sM(W),al(W,W.return);break;case 26:case 27:case 5:TB(T,W,N),N&&_===null&&lA&4&&UQ(W),al(W,W.return);break;case 12:TB(T,W,N);break;case 13:TB(T,W,N),N&&lA&4&&qB(T,W);break;case 22:W.memoizedState===null&&TB(T,W,N),al(W,W.return);break;default:TB(T,W,N)}h=h.sibling}}function lS(u,h){var N=null;u!==null&&u.memoizedState!==null&&u.memoizedState.cachePool!==null&&(N=u.memoizedState.cachePool.pool),u=null,h.memoizedState!==null&&h.memoizedState.cachePool!==null&&(u=h.memoizedState.cachePool.pool),u!==N&&(u!=null&&u.refCount++,N!=null&&Ma(N))}function Dp(u,h){u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Ma(u))}function MC(u,h,N,_){if(h.subtreeFlags&10256)for(h=h.child;h!==null;)yp(u,h,N,_),h=h.sibling}function yp(u,h,N,_){var T=h.flags;switch(h.tag){case 0:case 11:case 15:MC(u,h,N,_),T&2048&&vu(9,h);break;case 3:MC(u,h,N,_),T&2048&&(u=null,h.alternate!==null&&(u=h.alternate.memoizedState.cache),h=h.memoizedState.cache,h!==u&&(h.refCount++,u!=null&&Ma(u)));break;case 12:if(T&2048){MC(u,h,N,_),u=h.stateNode;try{var W=h.memoizedProps,lA=W.id,TA=W.onPostCommit;typeof TA=="function"&&TA(lA,h.alternate===null?"mount":"update",u.passiveEffectDuration,-0)}catch(le){ji(h,h.return,le)}}else MC(u,h,N,_);break;case 23:break;case 22:W=h.stateNode,h.memoizedState!==null?W._visibility&4?MC(u,h,N,_):YB(u,h):W._visibility&4?MC(u,h,N,_):(W._visibility|=4,go(u,h,N,_,(h.subtreeFlags&10256)!==0)),T&2048&&lS(h.alternate,h);break;case 24:MC(u,h,N,_),T&2048&&Dp(h.alternate,h);break;default:MC(u,h,N,_)}}function go(u,h,N,_,T){for(T=T&&(h.subtreeFlags&10256)!==0,h=h.child;h!==null;){var W=u,lA=h,TA=N,le=_,qe=lA.flags;switch(lA.tag){case 0:case 11:case 15:go(W,lA,TA,le,T),vu(8,lA);break;case 23:break;case 22:var rt=lA.stateNode;lA.memoizedState!==null?rt._visibility&4?go(W,lA,TA,le,T):YB(W,lA):(rt._visibility|=4,go(W,lA,TA,le,T)),T&&qe&2048&&lS(lA.alternate,lA);break;case 24:go(W,lA,TA,le,T),T&&qe&2048&&Dp(lA.alternate,lA);break;default:go(W,lA,TA,le,T)}h=h.sibling}}function YB(u,h){if(h.subtreeFlags&10256)for(h=h.child;h!==null;){var N=u,_=h,T=_.flags;switch(_.tag){case 22:YB(N,_),T&2048&&lS(_.alternate,_);break;case 24:YB(N,_),T&2048&&Dp(_.alternate,_);break;default:YB(N,_)}h=h.sibling}}function un(u){if(u.subtreeFlags&Sl)for(u=u.child;u!==null;)rl(u),u=u.sibling}function rl(u){switch(u.tag){case 26:un(u),u.flags&Sl&&(u.memoizedState!==null?Aw(Uo,u.memoizedState,u.memoizedProps):yI(u.type,u.memoizedProps));break;case 5:un(u),u.flags&Sl&&yI(u.type,u.memoizedProps);break;case 3:case 4:if(Ka){var h=Uo;Uo=Op(u.stateNode.containerInfo),un(u),Uo=h}else un(u);break;case 22:u.memoizedState===null&&(h=u.alternate,h!==null&&h.memoizedState!==null?(h=Sl,Sl=16777216,un(u),Sl=h):un(u));break;default:un(u)}}function Sp(u){var h=u.alternate;if(h!==null&&(u=h.child,u!==null)){h.child=null;do h=u.sibling,u.sibling=null,u=h;while(u!==null)}}function HB(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var N=0;N<h.length;N++){var _=h[N];MI=_,OB(_,u)}Sp(u)}if(u.subtreeFlags&10256)for(u=u.child;u!==null;)Ju(u),u=u.sibling}function Ju(u){switch(u.tag){case 0:case 11:case 15:HB(u),u.flags&2048&&LB(9,u,u.return);break;case 3:HB(u);break;case 12:HB(u);break;case 22:var h=u.stateNode;u.memoizedState!==null&&h._visibility&4&&(u.return===null||u.return.tag!==13)?(h._visibility&=-5,JQ(u)):HB(u);break;default:HB(u)}}function JQ(u){var h=u.deletions;if((u.flags&16)!==0){if(h!==null)for(var N=0;N<h.length;N++){var _=h[N];MI=_,OB(_,u)}Sp(u)}for(u=u.child;u!==null;){switch(h=u,h.tag){case 0:case 11:case 15:LB(8,h,h.return),JQ(h);break;case 22:N=h.stateNode,N._visibility&4&&(N._visibility&=-5,JQ(h));break;default:JQ(h)}u=u.sibling}}function OB(u,h){for(;MI!==null;){var N=MI;switch(N.tag){case 0:case 11:case 15:LB(8,N,h);break;case 23:case 22:if(N.memoizedState!==null&&N.memoizedState.cachePool!==null){var _=N.memoizedState.cachePool.pool;_!=null&&_.refCount++}break;case 24:Ma(N.memoizedState.cache)}if(_=N.child,_!==null)_.return=N,MI=_;else A:for(N=u;MI!==null;){_=MI;var T=_.sibling,W=_.return;if(bQ(_),_===N){MI=null;break A}if(T!==null){T.return=W,MI=T;break A}MI=W}}}function wp(u){var h=GS(u);if(h!=null){if(typeof h.memoizedProps["data-testname"]!="string")throw Error(g(364));return h}if(u=hl(u),u===null)throw Error(g(362));return u.stateNode.current}function LQ(u,h){var N=u.tag;switch(h.$$typeof){case Bh:if(u.type===h.value)return!0;break;case tf:A:{for(h=h.value,u=[u,0],N=0;N<u.length;){var _=u[N++],T=_.tag,W=u[N++],lA=h[W];if(T!==5&&T!==26&&T!==27||!Ks(_)){for(;lA!=null&&LQ(_,lA);)W++,lA=h[W];if(W===h.length){h=!0;break A}else for(_=_.child;_!==null;)u.push(_,W),_=_.sibling}}h=!1}return h;case gf:if((N===5||N===26||N===27)&&pv(u.stateNode,h.value))return!0;break;case Rg:if((N===5||N===6||N===26||N===27)&&(u=Wu(u),u!==null&&0<=u.indexOf(h.value)))return!0;break;case tg:if((N===5||N===26||N===27)&&(u=u.memoizedProps["data-testname"],typeof u=="string"&&u.toLowerCase()===h.value.toLowerCase()))return!0;break;default:throw Error(g(365))}return!1}function PB(u){switch(u.$$typeof){case Bh:return"<"+(n(u.value)||"Unknown")+">";case tf:return":has("+(PB(u)||"")+")";case gf:return'[role="'+u.value+'"]';case Rg:return'"'+u.value+'"';case tg:return'[data-testname="'+u.value+'"]';default:throw Error(g(365))}}function cM(u,h){var N=[];u=[u,0];for(var _=0;_<u.length;){var T=u[_++],W=T.tag,lA=u[_++],TA=h[lA];if(W!==5&&W!==26&&W!==27||!Ks(T)){for(;TA!=null&&LQ(T,TA);)lA++,TA=h[lA];if(lA===h.length)N.push(T);else for(T=T.child;T!==null;)u.push(T,lA),T=T.sibling}}return N}function Mo(u,h){if(!Us)throw Error(g(363));u=wp(u),u=cM(u,h),h=[],u=Array.from(u);for(var N=0;N<u.length;){var _=u[N++],T=_.tag;if(T===5||T===26||T===27)Ks(_)||h.push(_.stateNode);else for(_=_.child;_!==null;)u.push(_),_=_.sibling}return h}function No(){if((Ot&2)!==0&&bi!==0)return bi&-bi;if($t.T!==null){var u=na;return u!==0?u:Se()}return Br()}function ws(){ra===0&&(ra=(bi&536870912)===0||og?K():536870912);var u=qa.current;return u!==null&&(u.flags|=32),ra}function Io(u,h,N){(u===xi&&Tg===2||u.cancelPendingCommit!==null)&&(jr(u,0),Pr(u,bi,ra,!1)),J(u,N),((Ot&2)===0||u!==xi)&&(u===xi&&((Ot&2)===0&&(As|=N),ig===4&&Pr(u,bi,ra,!1)),NA(u))}function Lu(u,h,N){if((Ot&6)!==0)throw Error(g(327));var _=!N&&(h&60)===0&&(h&u.expiredLanes)===0||F(u,h),T=_?Ms(u,h):ms(u,h,!0),W=_;do{if(T===0){xa&&!_&&Pr(u,h,0,!1);break}else if(T===6)Pr(u,h,0,!Ug);else{if(N=u.current.alternate,W&&!lM(N)){T=ms(u,h,!1),W=!1;continue}if(T===2){if(W=h,u.errorRecoveryDisabledLanes&W)var lA=0;else lA=u.pendingLanes&-536870913,lA=lA!==0?lA:lA&536870912?536870912:0;if(lA!==0){h=lA;A:{var TA=u;T=tE;var le=Go&&TA.current.memoizedState.isDehydrated;if(le&&(jr(TA,lA).flags|=256),lA=ms(TA,lA,!1),lA!==2){if(HC&&!le){TA.errorRecoveryDisabledLanes|=W,As|=W,T=4;break A}W=Ya,Ya=T,W!==null&&NC(W)}T=lA}if(W=!1,T!==2)continue}}if(T===1){jr(u,0),Pr(u,h,0,!0);break}A:{switch(_=u,T){case 0:case 1:throw Error(g(345));case 4:if((h&4194176)===h){Pr(_,h,ra,!Ug);break A}break;case 2:Ya=null;break;case 3:case 5:break;default:throw Error(g(329))}if(_.finishedWork=N,_.finishedLanes=h,(h&62914560)===h&&(W=Js+300-qn(),10<W)){if(Pr(_,h,ra,!Ug),U(_,0)!==0)break A;_.timeoutHandle=NS(mp.bind(null,_,N,Ya,es,iE,h,ra,As,OC,Ug,2,-0,0),W);break A}mp(_,N,Ya,es,iE,h,ra,As,OC,Ug,0,-0,0)}}break}while(!0);NA(u)}function NC(u){Ya===null?Ya=u:Ya.push.apply(Ya,u)}function mp(u,h,N,_,T,W,lA,TA,le,qe,rt,mt,Gt){var Ei=h.subtreeFlags;if((Ei&8192||(Ei&16785408)===16785408)&&(Ua(),rl(h),h=bp(),h!==null)){u.cancelPendingCommit=h(AI.bind(null,u,N,_,T,lA,TA,le,1,mt,Gt)),Pr(u,W,lA,!qe);return}AI(u,N,_,T,lA,TA,le,rt,mt,Gt)}function lM(u){for(var h=u;;){var N=h.tag;if((N===0||N===11||N===15)&&h.flags&16384&&(N=h.updateQueue,N!==null&&(N=N.stores,N!==null)))for(var _=0;_<N.length;_++){var T=N[_],W=T.getSnapshot;T=T.value;try{if(!Fa(W(),T))return!1}catch{return!1}}if(N=h.child,h.subtreeFlags&16384&&N!==null)N.return=h,h=N;else{if(h===u)break;for(;h.sibling===null;){if(h.return===null||h.return===u)return!0;h=h.return}h.sibling.return=h.return,h=h.sibling}}return!0}function Pr(u,h,N,_){h&=~Co,h&=~As,u.suspendedLanes|=h,u.pingedLanes&=~h,_&&(u.warmLanes|=h),_=u.expirationTimes;for(var T=h;0<T;){var W=31-ga(T),lA=1<<W;_[W]=-1,T&=~lA}N!==0&&H(u,N,h)}function QS(){return(Ot&6)===0?(OA(0),!1):!0}function ea(){if(ui!==null){if(Tg===0)var u=ui.return;else u=ui,kI=oc=null,aA(u),bs=null,Qr=0,u=ui;for(;u!==null;)sS(u.alternate,u),u=u.return;ui=null}}function jr(u,h){u.finishedWork=null,u.finishedLanes=0;var N=u.timeoutHandle;N!==ul&&(u.timeoutHandle=ul,Zu(N)),N=u.cancelPendingCommit,N!==null&&(u.cancelPendingCommit=null,N()),ea(),xi=u,ui=N=no(u.current,null),bi=h,Tg=0,LI=null,Ug=!1,xa=F(u,h),HC=!1,OC=ra=Co=As=Ta=ig=0,Ya=tE=null,iE=!1,(h&8)!==0&&(h|=h&32);var _=u.entangledLanes;if(_!==0)for(u=u.entanglements,_&=h;0<_;){var T=31-ga(_),W=1<<T;h|=u[T],_&=~W}return $r=h,tA(),N}function sl(u,h){mi=null,$t.H=ag,h===Jg?(h=xA(),Tg=3):h===gw?(h=xA(),Tg=4):Tg=h===jM?8:h!==null&&typeof h=="object"&&typeof h.then=="function"?6:1,LI=h,ui===null&&(ig=1,Al(u,$(h,u.current)))}function qu(){var u=qa.current;return u===null?!0:(bi&4194176)===bi?Er===null:(bi&62914560)===bi||(bi&536870912)!==0?u===Er:!1}function qQ(){var u=$t.H;return $t.H=ag,u===null?ag:u}function Ga(){var u=$t.A;return $t.A=ef,u}function ta(){ig=4,Ug||(bi&4194176)!==bi&&qa.current!==null||(xa=!0),(Ta&134217727)===0&&(As&134217727)===0||xi===null||Pr(xi,bi,ra,!1)}function ms(u,h,N){var _=Ot;Ot|=2;var T=qQ(),W=Ga();(xi!==u||bi!==h)&&(es=null,jr(u,h)),h=!1;var lA=ig;A:do try{if(Tg!==0&&ui!==null){var TA=ui,le=LI;switch(Tg){case 8:ea(),lA=6;break A;case 3:case 2:case 6:qa.current===null&&(h=!0);var qe=Tg;if(Tg=0,LI=null,jB(u,TA,le,qe),N&&xa){lA=0;break A}break;default:qe=Tg,Tg=0,LI=null,jB(u,TA,le,qe)}}ks(),lA=ig;break}catch(rt){sl(u,rt)}while(!0);return h&&u.shellSuspendCounter++,kI=oc=null,Ot=_,$t.H=T,$t.A=W,ui===null&&(xi=null,bi=0,tA()),lA}function ks(){for(;ui!==null;)ES(ui)}function Ms(u,h){var N=Ot;Ot|=2;var _=qQ(),T=Ga();xi!==u||bi!==h?(es=null,hI=qn()+500,jr(u,h)):xa=F(u,h);A:do try{if(Tg!==0&&ui!==null){h=ui;var W=LI;e:switch(Tg){case 1:Tg=0,LI=null,jB(u,h,W,1);break;case 2:if(CA(W)){Tg=0,LI=null,kp(h);break}h=function(){Tg===2&&xi===u&&(Tg=7),NA(u)},W.then(h,h);break A;case 3:Tg=7;break A;case 4:Tg=5;break A;case 7:CA(W)?(Tg=0,LI=null,kp(h)):(Tg=0,LI=null,jB(u,h,W,7));break;case 5:var lA=null;switch(ui.tag){case 26:lA=ui.memoizedState;case 5:case 27:var TA=ui,le=TA.type,qe=TA.pendingProps;if(lA?$S(lA):_C(le,qe)){Tg=0,LI=null;var rt=TA.sibling;if(rt!==null)ui=rt;else{var mt=TA.return;mt!==null?(ui=mt,xu(mt)):ui=null}break e}}Tg=0,LI=null,jB(u,h,W,5);break;case 6:Tg=0,LI=null,jB(u,h,W,6);break;case 8:ea(),ig=6;break A;default:throw Error(g(462))}}GC();break}catch(Gt){sl(u,Gt)}while(!0);return kI=oc=null,$t.H=_,$t.A=T,Ot=N,ui!==null?0:(xi=null,bi=0,tA(),ig)}function GC(){for(;ui!==null&&!TM();)ES(ui)}function ES(u){var h=LA(u.alternate,u,$r);u.memoizedProps=u.pendingProps,h===null?xu(u):ui=h}function kp(u){var h=u,N=h.alternate;switch(h.tag){case 15:case 0:h=Mu(N,h,h.pendingProps,h.type,void 0,bi);break;case 11:h=Mu(N,h,h.pendingProps,h.type.render,h.ref,bi);break;case 5:aA(h);default:sS(N,h),h=ui=KC(h,$r),h=LA(N,h,$r)}u.memoizedProps=u.pendingProps,h===null?xu(u):ui=h}function jB(u,h,N,_){kI=oc=null,aA(h),bs=null,Qr=0;var T=h.return;try{if(tl(u,T,h,N,bi)){ig=1,Al(u,$(N,u.current)),ui=null;return}}catch(W){if(T!==null)throw ui=T,W;ig=1,Al(u,$(N,u.current)),ui=null;return}h.flags&32768?(og||_===1?u=!0:xa||(bi&536870912)!==0?u=!1:(Ug=u=!0,(_===2||_===3||_===6)&&(_=qa.current,_!==null&&_.tag===13&&(_.flags|=16384))),hn(h,u)):xu(h)}function xu(u){var h=u;do{if((h.flags&32768)!==0){hn(h,Ug);return}u=h.return;var N=aM(h.alternate,h,$r);if(N!==null){ui=N;return}if(h=h.sibling,h!==null){ui=h;return}ui=h=u}while(h!==null);ig===0&&(ig=5)}function hn(u,h){do{var N=rM(u.alternate,u);if(N!==null){N.flags&=32767,ui=N;return}if(N=u.return,N!==null&&(N.flags|=32768,N.subtreeFlags=0,N.deletions=null),!h&&(u=u.sibling,u!==null)){ui=u;return}ui=u=N}while(u!==null);ig=6,ui=null}function AI(u,h,N,_,T,W,lA,TA,le,qe){var rt=$t.T,mt=gn();try{oo(2),$t.T=null,zi(u,h,N,_,mt,T,W,lA,TA,le,qe)}finally{$t.T=rt,oo(mt)}}function zi(u,h,N,_,T,W,lA,TA){do dn();while(PC!==null);if((Ot&6)!==0)throw Error(g(327));var le=u.finishedWork;if(_=u.finishedLanes,le===null)return null;if(u.finishedWork=null,u.finishedLanes=0,le===u.current)throw Error(g(177));u.callbackNode=null,u.callbackPriority=0,u.cancelPendingCommit=null;var qe=le.lanes|le.childLanes;if(qe|=VQ,x(u,_,qe,W,lA,TA),u===xi&&(ui=xi=null,bi=0),(le.subtreeFlags&10256)===0&&(le.flags&10256)===0||hr||(hr=!0,If=qe,ml=N,Tu(jp,function(){return dn(),null})),N=(le.flags&15990)!==0,(le.subtreeFlags&15990)!==0||N?(N=$t.T,$t.T=null,W=gn(),oo(2),lA=Ot,Ot|=4,FQ(u,le),xB(le,u),kS(u.containerInfo),u.current=le,pp(u,le.alternate,le),YM(),Ot=lA,oo(W),$t.T=N):u.current=le,hr?(hr=!1,PC=u,wl=_):RC(u,qe),qe=u.pendingLanes,qe===0&&(Ha=null),q(le.stateNode),NA(u),h!==null)for(T=u.onRecoverableError,le=0;le<h.length;le++)qe=h[le],T(qe.value,{componentStack:qe.stack});return(wl&3)!==0&&dn(),qe=u.pendingLanes,(_&4194218)!==0&&(qe&42)!==0?u===Ko?kl++:(kl=0,Ko=u):kl=0,OA(0),null}function RC(u,h){(u.pooledCacheLanes&=h)===0&&(h=u.pooledCache,h!=null&&(u.pooledCache=null,Ma(h)))}function dn(){if(PC!==null){var u=PC,h=If;If=0;var N=j(wl),_=32>N?32:N;N=$t.T;var T=gn();try{if(oo(_),$t.T=null,PC===null)var W=!1;else{_=ml,ml=null;var lA=PC,TA=wl;if(PC=null,wl=0,(Ot&6)!==0)throw Error(g(331));var le=Ot;if(Ot|=4,Ju(lA.current),yp(lA,lA.current,TA,_),Ot=le,OA(0,!1),Ia&&typeof Ia.onPostCommitFiberRoot=="function")try{Ia.onPostCommitFiberRoot(WQ,lA)}catch{}W=!0}return W}finally{oo(T),$t.T=N,RC(u,h)}}return!1}function Mp(u,h,N){h=$(N,h),h=ys(u.stateNode,h,2),u=_A(u,h,2),u!==null&&(J(u,2),NA(u))}function ji(u,h,N){if(u.tag===3)Mp(u,u,N);else for(;h!==null;){if(h.tag===3){Mp(h,u,N);break}else if(h.tag===1){var _=h.stateNode;if(typeof h.type.getDerivedStateFromError=="function"||typeof _.componentDidCatch=="function"&&(Ha===null||!Ha.has(_))){u=$(N,u),N=Yr(2),_=_A(h,N,2),_!==null&&(el(N,_,h,u),J(_,2),NA(_));break}}h=h.return}}function Np(u,h,N){var _=u.pingCache;if(_===null){_=u.pingCache=new Zi;var T=new Set;_.set(h,T)}else T=_.get(h),T===void 0&&(T=new Set,_.set(h,T));T.has(N)||(HC=!0,T.add(N),u=QM.bind(null,u,h,N),h.then(u,u))}function QM(u,h,N){var _=u.pingCache;_!==null&&_.delete(h),u.pingedLanes|=u.suspendedLanes&N,u.warmLanes&=~N,xi===u&&(bi&N)===N&&(ig===4||ig===3&&(bi&62914560)===bi&&300>qn()-Js?(Ot&2)===0&&jr(u,0):Co|=N,OC===bi&&(OC=0)),NA(u)}function Cl(u,h){h===0&&(h=R()),u=DA(u,h),u!==null&&(J(u,h),NA(u))}function Bl(u){var h=u.memoizedState,N=0;h!==null&&(N=h.retryLane),Cl(u,N)}function uS(u,h){var N=0;switch(u.tag){case 13:var _=u.stateNode,T=u.memoizedState;T!==null&&(N=T.retryLane);break;case 19:_=u.stateNode;break;case 22:_=u.stateNode._retryCache;break;default:throw Error(g(314))}_!==null&&_.delete(h),Cl(u,N)}function Tu(u,h){return ZQ(u,h)}function hS(u,h,N,_){this.tag=u,this.key=N,this.sibling=this.child=this.return=this.stateNode=this.type=this.elementType=null,this.index=0,this.refCleanup=this.ref=null,this.pendingProps=h,this.dependencies=this.memoizedState=this.updateQueue=this.memoizedProps=null,this.mode=_,this.subtreeFlags=this.flags=0,this.deletions=null,this.childLanes=this.lanes=0,this.alternate=null}function UC(u){return u=u.prototype,!(!u||!u.isReactComponent)}function no(u,h){var N=u.alternate;return N===null?(N=e(u.tag,h,u.key,u.mode),N.elementType=u.elementType,N.type=u.type,N.stateNode=u.stateNode,N.alternate=u,u.alternate=N):(N.pendingProps=h,N.type=u.type,N.flags=0,N.subtreeFlags=0,N.deletions=null),N.flags=u.flags&31457280,N.childLanes=u.childLanes,N.lanes=u.lanes,N.child=u.child,N.memoizedProps=u.memoizedProps,N.memoizedState=u.memoizedState,N.updateQueue=u.updateQueue,h=u.dependencies,N.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext},N.sibling=u.sibling,N.index=u.index,N.ref=u.ref,N.refCleanup=u.refCleanup,N}function KC(u,h){u.flags&=31457282;var N=u.alternate;return N===null?(u.childLanes=0,u.lanes=h,u.child=null,u.subtreeFlags=0,u.memoizedProps=null,u.memoizedState=null,u.updateQueue=null,u.dependencies=null,u.stateNode=null):(u.childLanes=N.childLanes,u.lanes=N.lanes,u.child=N.child,u.subtreeFlags=0,u.deletions=null,u.memoizedProps=N.memoizedProps,u.memoizedState=N.memoizedState,u.updateQueue=N.updateQueue,u.type=N.type,h=N.dependencies,u.dependencies=h===null?null:{lanes:h.lanes,firstContext:h.firstContext}),u}function Cr(u,h,N,_,T,W){var lA=0;if(_=u,typeof u=="function")UC(u)&&(lA=1);else if(typeof u=="string")lA=Ka&&Ln?PS(u,N,fn.current)?26:PQ(u)?27:5:Ka?PS(u,N,fn.current)?26:5:Ln&&PQ(u)?27:5;else A:switch(u){case TQ:return FC(N.children,T,W,h);case yS:lA=8,T|=24;break;case SS:return u=e(12,N,h,T|2),u.elementType=SS,u.lanes=W,u;case Rp:return u=e(13,N,h,T),u.elementType=Rp,u.lanes=W,u;case zB:return u=e(19,N,h,T),u.elementType=zB,u.lanes=W,u;case Ou:return Gp(N,T,W,h);default:if(typeof u=="object"&&u!==null)switch(u.$$typeof){case hM:case Ns:lA=10;break A;case WB:lA=9;break A;case YQ:lA=11;break A;case Hu:lA=14;break A;case Wr:lA=16,_=null;break A}lA=29,N=Error(g(130,u===null?"null":typeof u,"")),_=null}return h=e(lA,N,h,T),h.elementType=u,h.type=_,h.lanes=W,h}function FC(u,h,N,_){return u=e(7,u,_,h),u.lanes=N,u}function Gp(u,h,N,_){u=e(22,u,_,h),u.elementType=Ou,u.lanes=N;var T={_visibility:1,_pendingVisibility:1,_pendingMarkers:null,_retryCache:null,_transitions:null,_current:null,detach:function(){var W=T._current;if(W===null)throw Error(g(456));if((T._pendingVisibility&2)===0){var lA=DA(W,2);lA!==null&&(T._pendingVisibility|=2,Io(lA,W,2))}},attach:function(){var W=T._current;if(W===null)throw Error(g(456));if((T._pendingVisibility&2)!==0){var lA=DA(W,2);lA!==null&&(T._pendingVisibility&=-3,Io(lA,W,2))}}};return u.stateNode=T,u}function ZB(u,h,N){return u=e(6,u,null,h),u.lanes=N,u}function xQ(u,h,N){return h=e(4,u.children!==null?u.children:[],u.key,h),h.lanes=N,h.stateNode={containerInfo:u.containerInfo,pendingChildren:null,implementation:u.implementation},h}function cl(u,h,N,_,T,W,lA,TA){this.tag=1,this.containerInfo=u,this.finishedWork=this.pingCache=this.current=this.pendingChildren=null,this.timeoutHandle=ul,this.callbackNode=this.next=this.pendingContext=this.context=this.cancelPendingCommit=null,this.callbackPriority=0,this.expirationTimes=G(-1),this.entangledLanes=this.shellSuspendCounter=this.errorRecoveryDisabledLanes=this.finishedLanes=this.expiredLanes=this.warmLanes=this.pingedLanes=this.suspendedLanes=this.pendingLanes=0,this.entanglements=G(0),this.hiddenUpdates=G(null),this.identifierPrefix=_,this.onUncaughtError=T,this.onCaughtError=W,this.onRecoverableError=lA,this.pooledCache=null,this.pooledCacheLanes=0,this.formState=TA,this.incompleteTransitions=new Map}function pn(u,h,N,_,T,W,lA,TA,le,qe,rt,mt){return u=new cl(u,h,N,lA,TA,le,qe,mt),h=1,W===!0&&(h|=24),W=e(3,null,null,h),u.current=W,W.stateNode=u,h=Xo(),h.refCount++,u.pooledCache=h,h.refCount++,W.memoizedState={element:_,isDehydrated:N,cache:h},de(W),u}function Yu(u){return u?(u=dl,u):dl}function dS(u){var h=u._reactInternals;if(h===void 0)throw typeof u.render=="function"?Error(g(188)):(u=Object.keys(u).join(","),Error(g(268,u)));return u=E(h),u=u!==null?D(u):null,u===null?null:HQ(u.stateNode)}function EM(u,h,N,_,T,W){T=Yu(T),_.context===null?_.context=T:_.pendingContext=T,_=WA(h),_.payload={element:N},W=W===void 0?null:W,W!==null&&(_.callback=W),N=_A(u,_,h),N!==null&&(Io(N,u,h),zA(N,u,h))}function uM(u,h){if(u=u.memoizedState,u!==null&&u.dehydrated!==null){var N=u.retryLane;u.retryLane=N!==0&&N<h?N:h}}function pS(u,h){uM(u,h),(u=u.alternate)&&uM(u,h)}var Ht={},fS=Ry(),_n=Y8A(),ll=Object.assign,DS=Symbol.for("react.element"),bC=Symbol.for("react.transitional.element"),Zr=Symbol.for("react.portal"),TQ=Symbol.for("react.fragment"),yS=Symbol.for("react.strict_mode"),SS=Symbol.for("react.profiler"),hM=Symbol.for("react.provider"),WB=Symbol.for("react.consumer"),Ns=Symbol.for("react.context"),YQ=Symbol.for("react.forward_ref"),Rp=Symbol.for("react.suspense"),zB=Symbol.for("react.suspense_list"),Hu=Symbol.for("react.memo"),Wr=Symbol.for("react.lazy"),Ou=Symbol.for("react.offscreen"),dM=Symbol.for("react.memo_cache_sentinel"),wS=Symbol.iterator,Ql=Symbol.for("react.client.reference"),$t=fS.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE,Up,mS,VB=!1,XB=Array.isArray,Kp=A.rendererVersion,Pu=A.rendererPackageName,ju=A.extraDevToolsConfig,HQ=A.getPublicInstance,El=A.getRootHostContext,pM=A.getChildHostContext,$B=A.prepareForCommit,kS=A.resetAfterCommit,MS=A.createInstance,Gs=A.appendInitialChild,vC=A.finalizeInitialChildren,Ac=A.shouldSetTextContent,Fp=A.createTextInstance,NS=A.scheduleTimeout,Zu=A.cancelTimeout,ul=A.noTimeout,Rs=A.isPrimaryRenderer;A.warnsIfNotActing;var Jn=A.supportsMutation,Ra=A.supportsPersistence,Go=A.supportsHydration,GS=A.getInstanceFromNode;A.beforeActiveInstanceBlur,A.afterActiveInstanceBlur;var RS=A.preparePortalMount;A.prepareScopeUpdate,A.getInstanceFromScope;var oo=A.setCurrentUpdatePriority,gn=A.getCurrentUpdatePriority,Br=A.resolveUpdatePriority;A.resolveEventType,A.resolveEventTimeStamp;var ec=A.shouldAttemptEagerTransition,US=A.detachDeletedInstance;A.requestPostPaintCallback;var fM=A.maySuspendCommit,_C=A.preloadInstance,Ua=A.startSuspendingCommit,yI=A.suspendInstance,bp=A.waitForCommitToBeReady,ia=A.NotPendingTransition,ai=A.HostTransitionContext,xg=A.resetFormInstance;A.bindToConsole;var PI=A.supportsMicrotasks,vp=A.scheduleMicrotask,Us=A.supportsTestSelectors,hl=A.findFiberRoot,_p=A.getBoundingRect,Wu=A.getTextContent,Ks=A.isHiddenSubtree,pv=A.matchAccessibilityRole,SI=A.setFocusIfFocusable,KS=A.setupIntersectionObserver,FS=A.appendChild,DM=A.appendChildToContainer,yM=A.commitTextUpdate,fv=A.commitMount,bS=A.commitUpdate,vS=A.insertBefore,_S=A.insertInContainerBefore,Ro=A.removeChild,bI=A.removeChildFromContainer,zu=A.resetTextContent,Vu=A.hideInstance,Jp=A.hideTextInstance,JS=A.unhideInstance,JC=A.unhideTextInstance,Lp=A.clearContainer,LS=A.cloneInstance,qp=A.createContainerChildSet,qS=A.appendChildToContainerChildSet,SM=A.finalizeContainerChildren,xS=A.replaceContainerChildren,TS=A.cloneHiddenInstance,YS=A.cloneHiddenTextInstance,xp=A.isSuspenseInstancePending,Xu=A.isSuspenseInstanceFallback,wM=A.getSuspenseInstanceFallbackErrorDetails,Dv=A.registerSuspenseInstanceRetry,mM=A.canHydrateFormStateMarker,kM=A.isFormStateMarkerMatching,HS=A.getNextHydratableSibling,Tp=A.getFirstHydratableChild,MM=A.getFirstHydratableChildWithinContainer,NM=A.getFirstHydratableChildWithinSuspenseInstance,GM=A.canHydrateInstance,RM=A.canHydrateTextInstance,UM=A.canHydrateSuspenseInstance,yv=A.hydrateInstance,KM=A.hydrateTextInstance,OQ=A.hydrateSuspenseInstance,FM=A.getNextHydratableInstanceAfterSuspenseInstance,Yp=A.commitHydratedContainer,Hp=A.commitHydratedSuspenseInstance,bM=A.clearSuspenseBoundary,OS=A.clearSuspenseBoundaryFromContainer,vM=A.shouldDeleteUnhydratedTailInstances;A.diffHydratedPropsForDevWarnings,A.diffHydratedTextForDevWarnings,A.describeHydratableInstanceForDevWarnings;var _M=A.validateHydratableInstance,JM=A.validateHydratableTextInstance,Ka=A.supportsResources,PS=A.isHostHoistableType,Op=A.getHoistableRoot,Pp=A.getResource,jS=A.acquireResource,ZS=A.releaseResource,WS=A.hydrateHoistable,zS=A.mountHoistable,VS=A.unmountHoistable,Sv=A.createHoistableInstance,XS=A.prepareToCommitHoistables,LM=A.mayResourceSuspendCommit,$S=A.preloadResource,Aw=A.suspendResource,Ln=A.supportsSingletons,ew=A.resolveSingletonInstance,wv=A.clearSingleton,mv=A.acquireSingletonInstance,qM=A.releaseSingletonInstance,PQ=A.isHostSingletonType,$u=[],LC=-1,dl={},ga=Math.clz32?Math.clz32:k,Ah=Math.log,xM=Math.LN2,jQ=128,eh=4194304,ZQ=_n.unstable_scheduleCallback,th=_n.unstable_cancelCallback,TM=_n.unstable_shouldYield,YM=_n.unstable_requestPaint,qn=_n.unstable_now,tw=_n.unstable_ImmediatePriority,HM=_n.unstable_UserBlockingPriority,jp=_n.unstable_NormalPriority,Zp=_n.unstable_IdlePriority,OM=_n.log,iw=_n.unstable_setDisableYieldValue,WQ=null,Ia=null,Fa=typeof Object.is=="function"?Object.is:O,Wp=new WeakMap,oI=[],wI=0,ih=null,gh=0,ba=[],va=0,zr=null,Fs=1,cr="",fn=S(null),Ih=S(null),Vr=S(null),zQ=S(null),ao=null,xn=null,og=!1,_a=null,lr=!1,nh=Error(g(519)),Ja=[],tc=0,VQ=0,XQ=null,pl=null,oh=!1,ah=!1,Xr=!1,ic=0,rh=null,zp=0,na=0,gc=null,qC=!1,$Q=!1,sh=Object.prototype.hasOwnProperty,Jg=Error(g(460)),gw=Error(g(474)),Vp={then:function(){}},fl=null,bs=null,Qr=0,Ic=Ut(!0),Iw=Ut(!1),vs=S(null),La=S(0),qa=S(null),Er=null,jI=S(0),_s=0,mi=null,yg=null,vI=null,ur=!1,aI=!1,xC=!1,Ch=0,mI=0,AE=null,PM=0,Xp=function(){return{lastEffect:null,events:null,stores:null,memoCache:null}},ag={readContext:di,use:GA,useCallback:Me,useContext:Me,useEffect:Me,useImperativeHandle:Me,useLayoutEffect:Me,useInsertionEffect:Me,useMemo:Me,useReducer:Me,useRef:Me,useState:Me,useDebugValue:Me,useDeferredValue:Me,useTransition:Me,useSyncExternalStore:Me,useId:Me};ag.useCacheRefresh=Me,ag.useMemoCache=Me,ag.useHostTransitionStatus=Me,ag.useFormState=Me,ag.useActionState=Me,ag.useOptimistic=Me;var ZI={readContext:di,use:GA,useCallback:function(u,h){return QA().memoizedState=[u,h===void 0?null:h],u},useContext:di,useEffect:Ds,useImperativeHandle:function(u,h,N){N=N!=null?N.concat([u]):null,wa(4194308,4,ZA.bind(null,h,u),N)},useLayoutEffect:function(u,h){return wa(4194308,4,u,h)},useInsertionEffect:function(u,h){wa(4,2,u,h)},useMemo:function(u,h){var N=QA();h=h===void 0?null:h;var _=u();if(xC){Y(!0);try{u()}finally{Y(!1)}}return N.memoizedState=[_,h],_},useReducer:function(u,h,N){var _=QA();if(N!==void 0){var T=N(h);if(xC){Y(!0);try{N(h)}finally{Y(!1)}}}else T=h;return _.memoizedState=_.baseState=T,u={pending:null,lanes:0,dispatch:null,lastRenderedReducer:u,lastRenderedState:T},_.queue=u,u=u.dispatch=ka.bind(null,mi,u),[_.memoizedState,u]},useRef:function(u){var h=QA();return u={current:u},h.memoizedState=u},useState:function(u){u=ei(u);var h=u.queue,N=Ng.bind(null,mi,h);return h.dispatch=N,[u.memoizedState,N]},useDebugValue:$e,useDeferredValue:function(u,h){var N=QA();return Mg(N,u,h)},useTransition:function(){var u=ei(!1);return u=So.bind(null,mi,u.queue,!0,!1),QA().memoizedState=u,[!1,u]},useSyncExternalStore:function(u,h,N){var _=mi,T=QA();if(og){if(N===void 0)throw Error(g(407));N=N()}else{if(N=h(),xi===null)throw Error(g(349));(bi&60)!==0||Mt(_,h,N)}T.memoizedState=N;var W={value:N,getSnapshot:h};return T.queue=W,Ds(Ri.bind(null,_,W,u),[u]),_.flags|=2048,fI(9,Zt.bind(null,_,W,N,h),{destroy:void 0},null),N},useId:function(){var u=QA(),h=xi.identifierPrefix;if(og){var N=cr,_=Fs;N=(_&~(1<<32-ga(_)-1)).toString(32)+N,h=":"+h+"R"+N,N=Ch++,0<N&&(h+="H"+N.toString(32)),h+=":"}else N=PM++,h=":"+h+"r"+N.toString(32)+":";return u.memoizedState=h},useCacheRefresh:function(){return QA().memoizedState=DI.bind(null,mi)}};ZI.useMemoCache=oe,ZI.useHostTransitionStatus=zo,ZI.useFormState=vg,ZI.useActionState=vg,ZI.useOptimistic=function(u){var h=QA();h.memoizedState=h.baseState=u;var N={pending:null,lanes:0,dispatch:null,lastRenderedReducer:null,lastRenderedState:null};return h.queue=N,h=wo.bind(null,mi,!0,N),N.dispatch=h,[u,h]};var ro={readContext:di,use:GA,useCallback:Nt,useContext:di,useEffect:ce,useImperativeHandle:Le,useInsertionEffect:ze,useLayoutEffect:At,useMemo:wi,useReducer:Qt,useRef:Ao,useState:function(){return Qt(Xe)},useDebugValue:$e,useDeferredValue:function(u,h){var N=JA();return en(N,yg.memoizedState,u,h)},useTransition:function(){var u=Qt(Xe)[0],h=JA().memoizedState;return[typeof u=="boolean"?u:ee(u),h]},useSyncExternalStore:it,useId:$g};ro.useCacheRefresh=FB,ro.useMemoCache=oe,ro.useHostTransitionStatus=zo,ro.useFormState=Zg,ro.useActionState=Zg,ro.useOptimistic=function(u,h){var N=JA();return yt(N,yg,u,h)};var nc={readContext:di,use:GA,useCallback:Nt,useContext:di,useEffect:ce,useImperativeHandle:Le,useInsertionEffect:ze,useLayoutEffect:At,useMemo:wi,useReducer:Dt,useRef:Ao,useState:function(){return Dt(Xe)},useDebugValue:$e,useDeferredValue:function(u,h){var N=JA();return yg===null?Mg(N,u,h):en(N,yg.memoizedState,u,h)},useTransition:function(){var u=Dt(Xe)[0],h=JA().memoizedState;return[typeof u=="boolean"?u:ee(u),h]},useSyncExternalStore:it,useId:$g};nc.useCacheRefresh=FB,nc.useMemoCache=oe,nc.useHostTransitionStatus=zo,nc.useFormState=Qn,nc.useActionState=Qn,nc.useOptimistic=function(u,h){var N=JA();return yg!==null?yt(N,yg,u,h):(N.baseState=u,[u,N.queue.dispatch])};var $p={isMounted:function(u){return(u=u._reactInternals)?B(u)===u:!1},enqueueSetState:function(u,h,N){u=u._reactInternals;var _=No(),T=WA(_);T.payload=h,N!=null&&(T.callback=N),h=_A(u,T,_),h!==null&&(Io(h,u,_),zA(h,u,_))},enqueueReplaceState:function(u,h,N){u=u._reactInternals;var _=No(),T=WA(_);T.tag=1,T.payload=h,N!=null&&(T.callback=N),h=_A(u,T,_),h!==null&&(Io(h,u,_),zA(h,u,_))},enqueueForceUpdate:function(u,h){u=u._reactInternals;var N=No(),_=WA(N);_.tag=2,h!=null&&(_.callback=h),h=_A(u,_,N),h!==null&&(Io(h,u,N),zA(h,u,N))}},nw=typeof reportError=="function"?reportError:function(u){if(typeof window=="object"&&typeof window.ErrorEvent=="function"){var h=new window.ErrorEvent("error",{bubbles:!0,cancelable:!0,message:typeof u=="object"&&u!==null&&typeof u.message=="string"?String(u.message):String(u),error:u});if(!window.dispatchEvent(h))return}else if(typeof process=="object"&&typeof process.emit=="function"){process.emit("uncaughtException",u);return}},jM=Error(g(461)),_I=!1,so={dehydrated:null,treeContext:null,retryLane:0},oa=S(null),oc=null,kI=null,ZM=typeof AbortController<"u"?AbortController:function(){var u=[],h=this.signal={aborted:!1,addEventListener:function(N,_){u.push(_)}};this.abort=function(){h.aborted=!0,u.forEach(function(N){return N()})}},TC=_n.unstable_scheduleCallback,Dl=_n.unstable_NormalPriority,Gg={$$typeof:Ns,Consumer:null,Provider:null,_currentValue:null,_currentValue2:null,_threadCount:0},Af=$t.S;$t.S=function(u,h){typeof h=="object"&&h!==null&&typeof h.then=="function"&&ne(u,h),Af!==null&&Af(u,h)};var YC=S(null),In=!1,uI=!1,ac=!1,eE=typeof WeakSet=="function"?WeakSet:Set,MI=null,yl=!1,JI=null,aa=!1,Uo=null,Sl=8192,ef={getCacheForType:function(u){var h=di(Gg),N=h.data.get(u);return N===void 0&&(N=u(),h.data.set(u,N)),N}},Bh=0,tf=1,gf=2,tg=3,Rg=4;if(typeof Symbol=="function"&&Symbol.for){var ki=Symbol.for;Bh=ki("selector.component"),tf=ki("selector.has_pseudo_class"),gf=ki("selector.role"),tg=ki("selector.test_id"),Rg=ki("selector.text")}var Zi=typeof WeakMap=="function"?WeakMap:Map,Ot=0,xi=null,ui=null,bi=0,Tg=0,LI=null,Ug=!1,xa=!1,HC=!1,$r=0,ig=0,Ta=0,As=0,Co=0,ra=0,OC=0,tE=null,Ya=null,iE=!1,Js=0,hI=1/0,es=null,Ha=null,hr=!1,PC=null,wl=0,If=0,ml=null,kl=0,Ko=null;return Ht.attemptContinuousHydration=function(u){if(u.tag===13){var h=DA(u,67108864);h!==null&&Io(h,u,67108864),pS(u,67108864)}},Ht.attemptHydrationAtCurrentPriority=function(u){if(u.tag===13){var h=No(),N=DA(u,h);N!==null&&Io(N,u,h),pS(u,h)}},Ht.attemptSynchronousHydration=function(u){switch(u.tag){case 3:if(u=u.stateNode,u.current.memoizedState.isDehydrated){var h=m(u.pendingLanes);if(h!==0){for(u.pendingLanes|=2,u.entangledLanes|=2;h;){var N=1<<31-ga(h);u.entanglements[1]|=N,h&=~N}NA(u),(Ot&6)===0&&(hI=qn()+500,OA(0))}}break;case 13:h=DA(u,2),h!==null&&Io(h,u,2),QS(),pS(u,2)}},Ht.batchedUpdates=function(u,h){return u(h)},Ht.createComponentSelector=function(u){return{$$typeof:Bh,value:u}},Ht.createContainer=function(u,h,N,_,T,W,lA,TA,le,qe){return pn(u,h,!1,null,N,_,W,lA,TA,le,qe,null)},Ht.createHasPseudoClassSelector=function(u){return{$$typeof:tf,value:u}},Ht.createHydrationContainer=function(u,h,N,_,T,W,lA,TA,le,qe,rt,mt,Gt){return u=pn(N,_,!0,u,T,W,TA,le,qe,rt,mt,Gt),u.context=Yu(null),N=u.current,_=No(),T=WA(_),T.callback=h??null,_A(N,T,_),u.current.lanes=_,J(u,_),NA(u),u},Ht.createPortal=function(u,h,N){var _=3<arguments.length&&arguments[3]!==void 0?arguments[3]:null;return{$$typeof:Zr,key:_==null?null:""+_,children:u,containerInfo:h,implementation:N}},Ht.createRoleSelector=function(u){return{$$typeof:gf,value:u}},Ht.createTestNameSelector=function(u){return{$$typeof:tg,value:u}},Ht.createTextSelector=function(u){return{$$typeof:Rg,value:u}},Ht.defaultOnCaughtError=function(u){},Ht.defaultOnRecoverableError=function(u){nw(u)},Ht.defaultOnUncaughtError=function(u){nw(u)},Ht.deferredUpdates=function(u){var h=$t.T,N=gn();try{return oo(32),$t.T=null,u()}finally{oo(N),$t.T=h}},Ht.discreteUpdates=function(u,h,N,_,T){var W=$t.T,lA=gn();try{return oo(2),$t.T=null,u(h,N,_,T)}finally{oo(lA),$t.T=W,Ot===0&&(hI=qn()+500)}},Ht.findAllNodes=Mo,Ht.findBoundingRects=function(u,h){if(!Us)throw Error(g(363));h=Mo(u,h),u=[];for(var N=0;N<h.length;N++)u.push(_p(h[N]));for(h=u.length-1;0<h;h--){N=u[h];for(var _=N.x,T=_+N.width,W=N.y,lA=W+N.height,TA=h-1;0<=TA;TA--)if(h!==TA){var le=u[TA],qe=le.x,rt=qe+le.width,mt=le.y,Gt=mt+le.height;if(_>=qe&&W>=mt&&T<=rt&&lA<=Gt){u.splice(h,1);break}else if(_!==qe||N.width!==le.width||Gt<W||mt>lA){if(!(W!==mt||N.height!==le.height||rt<_||qe>T)){qe>_&&(le.width+=qe-_,le.x=_),rt<T&&(le.width=T-qe),u.splice(h,1);break}}else{mt>W&&(le.height+=mt-W,le.y=W),Gt<lA&&(le.height=lA-mt),u.splice(h,1);break}}}return u},Ht.findHostInstance=dS,Ht.findHostInstanceWithNoPortals=function(u){return u=E(u),u=u!==null?y(u):null,u===null?null:HQ(u.stateNode)},Ht.findHostInstanceWithWarning=function(u){return dS(u)},Ht.flushPassiveEffects=dn,Ht.flushSyncFromReconciler=function(u){var h=Ot;Ot|=1;var N=$t.T,_=gn();try{if(oo(2),$t.T=null,u)return u()}finally{oo(_),$t.T=N,Ot=h,(Ot&6)===0&&OA(0)}},Ht.flushSyncWork=QS,Ht.focusWithin=function(u,h){if(!Us)throw Error(g(363));for(u=wp(u),h=cM(u,h),h=Array.from(h),u=0;u<h.length;){var N=h[u++],_=N.tag;if(!Ks(N)){if((_===5||_===26||_===27)&&SI(N.stateNode))return!0;for(N=N.child;N!==null;)h.push(N),N=N.sibling}}return!1},Ht.getFindAllNodesFailureDescription=function(u,h){if(!Us)throw Error(g(363));var N=0,_=[];u=[wp(u),0];for(var T=0;T<u.length;){var W=u[T++],lA=W.tag,TA=u[T++],le=h[TA];if((lA!==5&&lA!==26&&lA!==27||!Ks(W))&&(LQ(W,le)&&(_.push(PB(le)),TA++,TA>N&&(N=TA)),TA<h.length))for(W=W.child;W!==null;)u.push(W,TA),W=W.sibling}if(N<h.length){for(u=[];N<h.length;N++)u.push(PB(h[N]));return`findAllNodes was able to match part of the selector:
  `+(_.join(" > ")+`

No matching component was found for:
  `)+u.join(" > ")}return null},Ht.getPublicRootInstance=function(u){if(u=u.current,!u.child)return null;switch(u.child.tag){case 27:case 5:return HQ(u.child.stateNode);default:return u.child.stateNode}},Ht.injectIntoDevTools=function(){var u={bundleType:0,version:Kp,rendererPackageName:Pu,currentDispatcherRef:$t,findFiberByHostInstance:GS,reconcilerVersion:"19.0.0"};if(ju!==null&&(u.rendererConfig=ju),typeof __REACT_DEVTOOLS_GLOBAL_HOOK__>"u")u=!1;else{var h=__REACT_DEVTOOLS_GLOBAL_HOOK__;if(h.isDisabled||!h.supportsFiber)u=!0;else{try{WQ=h.inject(u),Ia=h}catch{}u=!!h.checkDCE}}return u},Ht.isAlreadyRendering=function(){return!1},Ht.observeVisibleRects=function(u,h,N,_){if(!Us)throw Error(g(363));u=Mo(u,h);var T=KS(u,N,_).disconnect;return{disconnect:function(){T()}}},Ht.shouldError=function(){return null},Ht.shouldSuspend=function(){return!1},Ht.startHostTransition=function(u,h,N,_){if(u.tag!==5)throw Error(g(476));var T=ma(u).queue;So(u,T,h,ia,N===null?i:function(){var W=ma(u).next.queue;return lI(u,W,{},No()),N(_)})},Ht.updateContainer=function(u,h,N,_){var T=h.current,W=No();return EM(T,W,u,h,N,_),W},Ht.updateContainerSync=function(u,h,N,_){return h.tag===0&&dn(),EM(h.current,2,u,h,N,_),2},Ht},t.exports.default=t.exports,Object.defineProperty(t.exports,"__esModule",{value:!0})}(xq)),xq.exports}var y9;function O8A(){return y9||(y9=1,qq.exports=H8A()),qq.exports}var P8A=O8A();const j8A=Td(P8A);var Hq={exports:{}},Oq={};/**
 * @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 S9;function Z8A(){return S9||(S9=1,function(t){function A(q,Y){var O=q.length;q.push(Y);A:for(;0<O;){var $=O-1>>>1,gA=q[$];if(0<g(gA,Y))q[$]=Y,q[O]=gA,O=$;else break A}}function e(q){return q.length===0?null:q[0]}function i(q){if(q.length===0)return null;var Y=q[0],O=q.pop();if(O!==Y){q[0]=O;A:for(var $=0,gA=q.length,z=gA>>>1;$<z;){var X=2*($+1)-1,sA=q[X],rA=X+1,mA=q[rA];if(0>g(sA,O))rA<gA&&0>g(mA,sA)?(q[$]=mA,q[rA]=O,$=rA):(q[$]=sA,q[X]=O,$=X);else if(rA<gA&&0>g(mA,O))q[$]=mA,q[rA]=O,$=rA;else break A}}return Y}function g(q,Y){var O=q.sortIndex-Y.sortIndex;return O!==0?O: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 n=Date,o=n.now();t.unstable_now=function(){return n.now()-o}}var a=[],r=[],s=1,B=null,c=3,E=!1,D=!1,y=!1,S=typeof setTimeout=="function"?setTimeout:null,f=typeof clearTimeout=="function"?clearTimeout:null,M=typeof setImmediate<"u"?setImmediate:null;function k(q){for(var Y=e(r);Y!==null;){if(Y.callback===null)i(r);else if(Y.startTime<=q)i(r),Y.sortIndex=Y.expirationTime,A(a,Y);else break;Y=e(r)}}function m(q){if(y=!1,k(q),!D)if(e(a)!==null)D=!0,P();else{var Y=e(r);Y!==null&&j(m,Y.startTime-q)}}var U=!1,F=-1,b=5,K=-1;function R(){return!(t.unstable_now()-K<b)}function G(){if(U){var q=t.unstable_now();K=q;var Y=!0;try{A:{D=!1,y&&(y=!1,f(F),F=-1),E=!0;var O=c;try{e:{for(k(q),B=e(a);B!==null&&!(B.expirationTime>q&&R());){var $=B.callback;if(typeof $=="function"){B.callback=null,c=B.priorityLevel;var gA=$(B.expirationTime<=q);if(q=t.unstable_now(),typeof gA=="function"){B.callback=gA,k(q),Y=!0;break e}B===e(a)&&i(a),k(q)}else i(a);B=e(a)}if(B!==null)Y=!0;else{var z=e(r);z!==null&&j(m,z.startTime-q),Y=!1}}break A}finally{B=null,c=O,E=!1}Y=void 0}}finally{Y?J():U=!1}}}var J;if(typeof M=="function")J=function(){M(G)};else if(typeof MessageChannel<"u"){var x=new MessageChannel,H=x.port2;x.port1.onmessage=G,J=function(){H.postMessage(null)}}else J=function(){S(G,0)};function P(){U||(U=!0,J())}function j(q,Y){F=S(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_continueExecution=function(){D||E||(D=!0,P())},t.unstable_forceFrameRate=function(q){0>q||125<q||(b=0<q?Math.floor(1e3/q):5)},t.unstable_getCurrentPriorityLevel=function(){return c},t.unstable_getFirstCallbackNode=function(){return e(a)},t.unstable_next=function(q){switch(c){case 1:case 2:case 3:var Y=3;break;default:Y=c}var O=c;c=Y;try{return q()}finally{c=O}},t.unstable_pauseExecution=function(){},t.unstable_requestPaint=function(){},t.unstable_runWithPriority=function(q,Y){switch(q){case 1:case 2:case 3:case 4:case 5:break;default:q=3}var O=c;c=q;try{return Y()}finally{c=O}},t.unstable_scheduleCallback=function(q,Y,O){var $=t.unstable_now();switch(typeof O=="object"&&O!==null?(O=O.delay,O=typeof O=="number"&&0<O?$+O:$):O=$,q){case 1:var gA=-1;break;case 2:gA=250;break;case 5:gA=1073741823;break;case 4:gA=1e4;break;default:gA=5e3}return gA=O+gA,q={id:s++,callback:Y,priorityLevel:q,startTime:O,expirationTime:gA,sortIndex:-1},O>$?(q.sortIndex=O,A(r,q),e(a)===null&&q===e(r)&&(y?(f(F),F=-1):y=!0,j(m,O-$))):(q.sortIndex=gA,A(a,q),D||E||(D=!0,P())),q},t.unstable_shouldYield=R,t.unstable_wrapCallback=function(q){var Y=c;return function(){var O=c;c=Y;try{return q.apply(this,arguments)}finally{c=O}}}}(Oq)),Oq}var w9;function W8A(){return w9||(w9=1,Hq.exports=Z8A()),Hq.exports}var m9=W8A();function F1(t,A,e){if(!t)return;if(e(t)===!0)return t;let i=A?t.return:t.child;for(;i;){const g=F1(i,A,e);if(g)return g;i=A?null:i.sibling}}function MoA(t){try{return Object.defineProperties(t,{_currentRenderer:{get(){return null},set(){}},_currentRenderer2:{get(){return null},set(){}}})}catch{return t}}const b1=MoA(p.createContext(null));class NoA extends p.Component{render(){return p.createElement(b1.Provider,{value:this._reactInternals},this.props.children)}}function GoA(){const t=p.useContext(b1);if(t===null)throw new Error("its-fine: useFiber must be called within a <FiberProvider />!");const A=p.useId();return p.useMemo(()=>{for(const e of[t,t?.alternate]){if(!e)continue;const i=F1(e,!1,g=>{let I=g.memoizedState;for(;I;){if(I.memoizedState===A)return!0;I=I.next}});if(i)return i}},[t,A])}const z8A=Symbol.for("react.context"),V8A=t=>t!==null&&typeof t=="object"&&"$$typeof"in t&&t.$$typeof===z8A;function X8A(){const t=GoA(),[A]=p.useState(()=>new Map);A.clear();let e=t;for(;e;){const i=e.type;V8A(i)&&i!==b1&&!A.has(i)&&A.set(i,p.use(MoA(i))),e=e.return}return A}function $8A(){const t=X8A();return p.useMemo(()=>Array.from(t.keys()).reduce((A,e)=>i=>p.createElement(A,null,p.createElement(e.Provider,{...i,value:t.get(e)})),A=>p.createElement(NoA,{...A})),[t])}function RoA(t){let A=t.root;for(;A.getState().previousRoot;)A=A.getState().previousRoot;return A}const UoA=t=>t&&t.isOrthographicCamera,A5A=t=>t&&t.hasOwnProperty("current"),e5A=t=>t!=null&&(typeof t=="string"||typeof t=="number"||t.isColor),gM=((t,A)=>typeof window<"u"&&(((t=window.document)==null?void 0:t.createElement)||((A=window.navigator)==null?void 0:A.product)==="ReactNative"))()?p.useLayoutEffect:p.useEffect;function KoA(t){const A=p.useRef(t);return gM(()=>void(A.current=t),[t]),A}function t5A(){const t=GoA(),A=$8A();return p.useMemo(()=>({children:e})=>{const g=!!F1(t,!0,I=>I.type===p.StrictMode)?p.StrictMode:p.Fragment;return Q.jsx(g,{children:Q.jsx(A,{children:e})})},[t,A])}function i5A({set:t}){return gM(()=>(t(new Promise(()=>null)),()=>t(!1)),[t]),null}const g5A=(t=>(t=class extends p.Component{constructor(...e){super(...e),this.state={error:!1}}componentDidCatch(e){this.props.set(e)}render(){return this.state.error?null:this.props.children}},t.getDerivedStateFromError=()=>({error:!0}),t))();function FoA(t){var A;const e=typeof window<"u"?(A=window.devicePixelRatio)!=null?A:2:1;return Array.isArray(t)?Math.min(Math.max(t[0],e),t[1]):t}function Of(t){var A;return(A=t.__r3f)==null?void 0:A.root.getState()}const GI={obj:t=>t===Object(t)&&!GI.arr(t)&&typeof t!="function",fun:t=>typeof t=="function",str:t=>typeof t=="string",num:t=>typeof t=="number",boo:t=>typeof t=="boolean",und:t=>t===void 0,nul:t=>t===null,arr:t=>Array.isArray(t),equ(t,A,{arrays:e="shallow",objects:i="reference",strict:g=!0}={}){if(typeof t!=typeof A||!!t!=!!A)return!1;if(GI.str(t)||GI.num(t)||GI.boo(t))return t===A;const I=GI.obj(t);if(I&&i==="reference")return t===A;const n=GI.arr(t);if(n&&e==="reference")return t===A;if((n||I)&&t===A)return!0;let o;for(o in t)if(!(o in A))return!1;if(I&&e==="shallow"&&i==="shallow"){for(o in g?A:t)if(!GI.equ(t[o],A[o],{strict:g,objects:"reference"}))return!1}else for(o in g?A:t)if(t[o]!==A[o])return!1;if(GI.und(o)){if(n&&t.length===0&&A.length===0||I&&Object.keys(t).length===0&&Object.keys(A).length===0)return!0;if(t!==A)return!1}return!0}};function I5A(t){const A={nodes:{},materials:{},meshes:{}};return t&&t.traverse(e=>{e.name&&(A.nodes[e.name]=e),e.material&&!A.materials[e.material.name]&&(A.materials[e.material.name]=e.material),e.isMesh&&!A.meshes[e.name]&&(A.meshes[e.name]=e)}),A}function n5A(t){t.type!=="Scene"&&(t.dispose==null||t.dispose());for(const A in t){const e=t[A];e?.type!=="Scene"&&(e==null||e.dispose==null||e.dispose())}}const boA=["children","key","ref"];function o5A(t){const A={};for(const e in t)boA.includes(e)||(A[e]=t[e]);return A}function tF(t,A,e,i){const g=t;let I=g?.__r3f;return I||(I={root:A,type:e,parent:null,children:[],props:o5A(i),object:g,eventCount:0,handlers:{},isHidden:!1},g&&(g.__r3f=I)),I}function z0(t,A){let e=t[A];if(!A.includes("-"))return{root:t,key:A,target:e};e=t;for(const g of A.split("-")){var i;A=g,t=e,e=(i=e)==null?void 0:i[A]}return{root:t,key:A,target:e}}const k9=/-\d+$/;function iF(t,A){if(GI.str(A.props.attach)){if(k9.test(A.props.attach)){const g=A.props.attach.replace(k9,""),{root:I,key:n}=z0(t.object,g);Array.isArray(I[n])||(I[n]=[])}const{root:e,key:i}=z0(t.object,A.props.attach);A.previousAttach=e[i],e[i]=A.object}else GI.fun(A.props.attach)&&(A.previousAttach=A.props.attach(t.object,A.object))}function gF(t,A){if(GI.str(A.props.attach)){const{root:e,key:i}=z0(t.object,A.props.attach),g=A.previousAttach;g===void 0?delete e[i]:e[i]=g}else A.previousAttach==null||A.previousAttach(t.object,A.object);delete A.previousAttach}const LY=[...boA,"args","dispose","attach","object","onUpdate","dispose"],M9=new Map;function a5A(t){let A=M9.get(t.constructor);try{A||(A=new t.constructor,M9.set(t.constructor,A))}catch{}return A}function r5A(t,A){const e={};for(const i in A)if(!LY.includes(i)&&!GI.equ(A[i],t.props[i])){e[i]=A[i];for(const g in A)g.startsWith(`${i}-`)&&(e[g]=A[g])}for(const i in t.props){if(LY.includes(i)||A.hasOwnProperty(i))continue;const{root:g,key:I}=z0(t.object,i);if(g.constructor&&g.constructor.length===0){const n=a5A(g);GI.und(n)||(e[I]=n[I])}else e[I]=0}return e}const s5A=["map","emissiveMap","sheenColorMap","specularColorMap","envMap"],C5A=/^on(Pointer|Click|DoubleClick|ContextMenu|Wheel)/;function GE(t,A){var e;const i=t.__r3f,g=i&&RoA(i).getState(),I=i?.eventCount;for(const o in A){let a=A[o];if(LY.includes(o))continue;if(i&&C5A.test(o)){typeof a=="function"?i.handlers[o]=a:delete i.handlers[o],i.eventCount=Object.keys(i.handlers).length;continue}if(a===void 0)continue;let{root:r,key:s,target:B}=z0(t,o);if(B instanceof fy&&a instanceof fy)B.mask=a.mask;else if(B instanceof wt&&e5A(a))B.set(a);else if(B!==null&&typeof B=="object"&&typeof B.set=="function"&&typeof B.copy=="function"&&a!=null&&a.constructor&&B.constructor===a.constructor)B.copy(a);else if(B!==null&&typeof B=="object"&&typeof B.set=="function"&&Array.isArray(a))typeof B.fromArray=="function"?B.fromArray(a):B.set(...a);else if(B!==null&&typeof B=="object"&&typeof B.set=="function"&&typeof a=="number")typeof B.setScalar=="function"?B.setScalar(a):B.set(a);else{var n;r[s]=a,g&&!g.linear&&s5A.includes(s)&&(n=r[s])!=null&&n.isTexture&&r[s].format===da&&r[s].type===QC&&(r[s].colorSpace=Hn)}}if(i!=null&&i.parent&&g!=null&&g.internal&&(e=i.object)!=null&&e.isObject3D&&I!==i.eventCount){const o=i.object,a=g.internal.interaction.indexOf(o);a>-1&&g.internal.interaction.splice(a,1),i.eventCount&&o.raycast!==null&&g.internal.interaction.push(o)}return i&&i.props.attach===void 0&&(i.object.isBufferGeometry?i.props.attach="geometry":i.object.isMaterial&&(i.props.attach="material")),i&&oS(i),t}function oS(t){var A;if(!t.parent)return;t.props.onUpdate==null||t.props.onUpdate(t.object);const e=(A=t.root)==null||A.getState==null?void 0:A.getState();e&&e.internal.frames===0&&e.invalidate()}function B5A(t,A){t.manual||(UoA(t)?(t.left=A.width/-2,t.right=A.width/2,t.top=A.height/2,t.bottom=A.height/-2):t.aspect=A.width/A.height,t.updateProjectionMatrix())}const Za=t=>t?.isObject3D;function YG(t){return(t.eventObject||t.object).uuid+"/"+t.index+t.instanceId}function voA(t,A,e,i){const g=e.get(A);g&&(e.delete(A),e.size===0&&(t.delete(i),g.target.releasePointerCapture(i)))}function c5A(t,A){const{internal:e}=t.getState();e.interaction=e.interaction.filter(i=>i!==A),e.initialHits=e.initialHits.filter(i=>i!==A),e.hovered.forEach((i,g)=>{(i.eventObject===A||i.object===A)&&e.hovered.delete(g)}),e.capturedMap.forEach((i,g)=>{voA(e.capturedMap,A,i,g)})}function l5A(t){function A(a){const{internal:r}=t.getState(),s=a.offsetX-r.initialClick[0],B=a.offsetY-r.initialClick[1];return Math.round(Math.sqrt(s*s+B*B))}function e(a){return a.filter(r=>["Move","Over","Enter","Out","Leave"].some(s=>{var B;return(B=r.__r3f)==null?void 0:B.handlers["onPointer"+s]}))}function i(a,r){const s=t.getState(),B=new Set,c=[],E=r?r(s.internal.interaction):s.internal.interaction;for(let f=0;f<E.length;f++){const M=Of(E[f]);M&&(M.raycaster.camera=void 0)}s.previousRoot||s.events.compute==null||s.events.compute(a,s);function D(f){const M=Of(f);if(!M||!M.events.enabled||M.raycaster.camera===null)return[];if(M.raycaster.camera===void 0){var k;M.events.compute==null||M.events.compute(a,M,(k=M.previousRoot)==null?void 0:k.getState()),M.raycaster.camera===void 0&&(M.raycaster.camera=null)}return M.raycaster.camera?M.raycaster.intersectObject(f,!0):[]}let y=E.flatMap(D).sort((f,M)=>{const k=Of(f.object),m=Of(M.object);return!k||!m?f.distance-M.distance:m.events.priority-k.events.priority||f.distance-M.distance}).filter(f=>{const M=YG(f);return B.has(M)?!1:(B.add(M),!0)});s.events.filter&&(y=s.events.filter(y,s));for(const f of y){let M=f.object;for(;M;){var S;(S=M.__r3f)!=null&&S.eventCount&&c.push({...f,eventObject:M}),M=M.parent}}if("pointerId"in a&&s.internal.capturedMap.has(a.pointerId))for(let f of s.internal.capturedMap.get(a.pointerId).values())B.has(YG(f.intersection))||c.push(f.intersection);return c}function g(a,r,s,B){if(a.length){const c={stopped:!1};for(const E of a){let D=Of(E.object);if(D||E.object.traverseAncestors(y=>{const S=Of(y);if(S)return D=S,!1}),D){const{raycaster:y,pointer:S,camera:f,internal:M}=D,k=new wA(S.x,S.y,0).unproject(f),m=R=>{var G,J;return(G=(J=M.capturedMap.get(R))==null?void 0:J.has(E.eventObject))!=null?G:!1},U=R=>{const G={intersection:E,target:r.target};M.capturedMap.has(R)?M.capturedMap.get(R).set(E.eventObject,G):M.capturedMap.set(R,new Map([[E.eventObject,G]])),r.target.setPointerCapture(R)},F=R=>{const G=M.capturedMap.get(R);G&&voA(M.capturedMap,E.eventObject,G,R)};let b={};for(let R in r){let G=r[R];typeof G!="function"&&(b[R]=G)}let K={...E,...b,pointer:S,intersections:a,stopped:c.stopped,delta:s,unprojectedPoint:k,ray:y.ray,camera:f,stopPropagation(){const R="pointerId"in r&&M.capturedMap.get(r.pointerId);if((!R||R.has(E.eventObject))&&(K.stopped=c.stopped=!0,M.hovered.size&&Array.from(M.hovered.values()).find(G=>G.eventObject===E.eventObject))){const G=a.slice(0,a.indexOf(E));I([...G,E])}},target:{hasPointerCapture:m,setPointerCapture:U,releasePointerCapture:F},currentTarget:{hasPointerCapture:m,setPointerCapture:U,releasePointerCapture:F},nativeEvent:r};if(B(K),c.stopped===!0)break}}}return a}function I(a){const{internal:r}=t.getState();for(const s of r.hovered.values())if(!a.length||!a.find(B=>B.object===s.object&&B.index===s.index&&B.instanceId===s.instanceId)){const c=s.eventObject.__r3f;if(r.hovered.delete(YG(s)),c!=null&&c.eventCount){const E=c.handlers,D={...s,intersections:a};E.onPointerOut==null||E.onPointerOut(D),E.onPointerLeave==null||E.onPointerLeave(D)}}}function n(a,r){for(let s=0;s<r.length;s++){const B=r[s].__r3f;B==null||B.handlers.onPointerMissed==null||B.handlers.onPointerMissed(a)}}function o(a){switch(a){case"onPointerLeave":case"onPointerCancel":return()=>I([]);case"onLostPointerCapture":return r=>{const{internal:s}=t.getState();"pointerId"in r&&s.capturedMap.has(r.pointerId)&&requestAnimationFrame(()=>{s.capturedMap.has(r.pointerId)&&(s.capturedMap.delete(r.pointerId),I([]))})}}return function(s){const{onPointerMissed:B,internal:c}=t.getState();c.lastEvent.current=s;const E=a==="onPointerMove",D=a==="onClick"||a==="onContextMenu"||a==="onDoubleClick",S=i(s,E?e:void 0),f=D?A(s):0;a==="onPointerDown"&&(c.initialClick=[s.offsetX,s.offsetY],c.initialHits=S.map(k=>k.eventObject)),D&&!S.length&&f<=2&&(n(s,c.interaction),B&&B(s)),E&&I(S);function M(k){const m=k.eventObject,U=m.__r3f;if(!(U!=null&&U.eventCount))return;const F=U.handlers;if(E){if(F.onPointerOver||F.onPointerEnter||F.onPointerOut||F.onPointerLeave){const b=YG(k),K=c.hovered.get(b);K?K.stopped&&k.stopPropagation():(c.hovered.set(b,k),F.onPointerOver==null||F.onPointerOver(k),F.onPointerEnter==null||F.onPointerEnter(k))}F.onPointerMove==null||F.onPointerMove(k)}else{const b=F[a];b?(!D||c.initialHits.includes(m))&&(n(s,c.interaction.filter(K=>!c.initialHits.includes(K))),b(k)):D&&c.initialHits.includes(m)&&n(s,c.interaction.filter(K=>!c.initialHits.includes(K)))}}g(S,s,f,M)}}return{handlePointer:o}}const N9=t=>!!(t!=null&&t.render),_oA=p.createContext(null),Q5A=(t,A)=>{const e=J8A((o,a)=>{const r=new wA,s=new wA,B=new wA;function c(f=a().camera,M=s,k=a().size){const{width:m,height:U,top:F,left:b}=k,K=m/U;M.isVector3?B.copy(M):B.set(...M);const R=f.getWorldPosition(r).distanceTo(B);if(UoA(f))return{width:m/f.zoom,height:U/f.zoom,top:F,left:b,factor:1,distance:R,aspect:K};{const G=f.fov*Math.PI/180,J=2*Math.tan(G/2)*R,x=J*(m/U);return{width:x,height:J,top:F,left:b,factor:m/x,distance:R,aspect:K}}}let E;const D=f=>o(M=>({performance:{...M.performance,current:f}})),y=new Ze;return{set:o,get:a,gl:null,camera:null,raycaster:null,events:{priority:1,enabled:!0,connected:!1},scene:null,xr:null,invalidate:(f=1)=>t(a(),f),advance:(f,M)=>A(f,M,a()),legacy:!1,linear:!1,flat:!1,controls:null,clock:new M1,pointer:y,mouse:y,frameloop:"always",onPointerMissed:void 0,performance:{current:1,min:.5,max:1,debounce:200,regress:()=>{const f=a();E&&clearTimeout(E),f.performance.current!==f.performance.min&&D(f.performance.min),E=setTimeout(()=>D(a().performance.max),f.performance.debounce)}},size:{width:0,height:0,top:0,left:0},viewport:{initialDpr:0,dpr:0,width:0,height:0,top:0,left:0,aspect:0,distance:0,factor:0,getCurrentViewport:c},setEvents:f=>o(M=>({...M,events:{...M.events,...f}})),setSize:(f,M,k=0,m=0)=>{const U=a().camera,F={width:f,height:M,top:k,left:m};o(b=>({size:F,viewport:{...b.viewport,...c(U,s,F)}}))},setDpr:f=>o(M=>{const k=FoA(f);return{viewport:{...M.viewport,dpr:k,initialDpr:M.viewport.initialDpr||k}}}),setFrameloop:(f="always")=>{const M=a().clock;M.stop(),M.elapsedTime=0,f!=="never"&&(M.start(),M.elapsedTime=0),o(()=>({frameloop:f}))},previousRoot:void 0,internal:{interaction:[],hovered:new Map,subscribers:[],initialClick:[0,0],initialHits:[],capturedMap:new Map,lastEvent:p.createRef(),active:!1,frames:0,priority:0,subscribe:(f,M,k)=>{const m=a().internal;return m.priority=m.priority+(M>0?1:0),m.subscribers.push({ref:f,priority:M,store:k}),m.subscribers=m.subscribers.sort((U,F)=>U.priority-F.priority),()=>{const U=a().internal;U!=null&&U.subscribers&&(U.priority=U.priority-(M>0?1:0),U.subscribers=U.subscribers.filter(F=>F.ref!==f))}}}}}),i=e.getState();let g=i.size,I=i.viewport.dpr,n=i.camera;return e.subscribe(()=>{const{camera:o,size:a,viewport:r,gl:s,set:B}=e.getState();if(a.width!==g.width||a.height!==g.height||r.dpr!==I){g=a,I=r.dpr,B5A(o,a),r.dpr>0&&s.setPixelRatio(r.dpr);const c=typeof HTMLCanvasElement<"u"&&s.domElement instanceof HTMLCanvasElement;s.setSize(a.width,a.height,c)}o!==n&&(n=o,B(c=>({viewport:{...c.viewport,...c.viewport.getCurrentViewport(o)}})))}),e.subscribe(o=>t(o)),e};function JoA(){const t=p.useContext(_oA);if(!t)throw new Error("R3F: Hooks can only be used within the Canvas component!");return t}function PE(t=e=>e,A){return JoA()(t,A)}function IM(t,A=0){const e=JoA(),i=e.getState().internal.subscribe,g=KoA(t);return gM(()=>i(g,A,e),[A,i,e]),null}const G9=new WeakMap,E5A=t=>{var A;return typeof t=="function"&&(t==null||(A=t.prototype)==null?void 0:A.constructor)===t};function LoA(t,A){return function(e,...i){let g;return E5A(e)?(g=G9.get(e),g||(g=new e,G9.set(e,g))):g=e,t&&t(g),Promise.all(i.map(I=>new Promise((n,o)=>g.load(I,a=>{Za(a?.scene)&&Object.assign(a,I5A(a.scene)),n(a)},A,a=>o(new Error(`Could not load ${I}: ${a?.message}`))))))}}function nM(t,A,e,i){const g=Array.isArray(A)?A:[A],I=koA(LoA(e,i),[t,...g],{equal:GI.equ});return Array.isArray(A)?I:I[0]}nM.preload=function(t,A,e){const i=Array.isArray(A)?A:[A];return q8A(LoA(e),[t,...i])};nM.clear=function(t,A){const e=Array.isArray(A)?A:[A];return x8A([t,...e])};function u5A(t){const A=j8A(t);return A.injectIntoDevTools({bundleType:0,rendererPackageName:"@react-three/fiber",version:p.version}),A}const qoA=0,wy={},h5A=/^three(?=[A-Z])/,Qv=t=>`${t[0].toUpperCase()}${t.slice(1)}`;let d5A=0;const p5A=t=>typeof t=="function";function f5A(t){if(p5A(t)){const A=`${d5A++}`;return wy[A]=t,A}else Object.assign(wy,t)}function xoA(t,A){const e=Qv(t),i=wy[e];if(t!=="primitive"&&!i)throw new Error(`R3F: ${e} is not part of the THREE namespace! Did you forget to extend? See: https://docs.pmnd.rs/react-three-fiber/api/objects#using-3rd-party-objects-declaratively`);if(t==="primitive"&&!A.object)throw new Error("R3F: Primitives without 'object' are invalid!");if(A.args!==void 0&&!Array.isArray(A.args))throw new Error("R3F: The args prop must be an array!")}function D5A(t,A,e){var i;return t=Qv(t)in wy?t:t.replace(h5A,""),xoA(t,A),t==="primitive"&&(i=A.object)!=null&&i.__r3f&&delete A.object.__r3f,tF(A.object,e,t,A)}function y5A(t){if(!t.isHidden){var A;t.props.attach&&(A=t.parent)!=null&&A.object?gF(t.parent,t):Za(t.object)&&(t.object.visible=!1),t.isHidden=!0,oS(t)}}function ToA(t){if(t.isHidden){var A;t.props.attach&&(A=t.parent)!=null&&A.object?iF(t.parent,t):Za(t.object)&&t.props.visible!==!1&&(t.object.visible=!0),t.isHidden=!1,oS(t)}}function v1(t,A,e){const i=A.root.getState();if(!(!t.parent&&t.object!==i.scene)){if(!A.object){var g,I;const n=wy[Qv(A.type)];A.object=(g=A.props.object)!=null?g:new n(...(I=A.props.args)!=null?I:[]),A.object.__r3f=A}if(GE(A.object,A.props),A.props.attach)iF(t,A);else if(Za(A.object)&&Za(t.object)){const n=t.object.children.indexOf(e?.object);if(e&&n!==-1){const o=t.object.children.indexOf(A.object);if(o!==-1){t.object.children.splice(o,1);const a=o<n?n-1:n;t.object.children.splice(a,0,A.object)}else A.object.parent=t.object,t.object.children.splice(n,0,A.object),A.object.dispatchEvent({type:"added"}),t.object.dispatchEvent({type:"childadded",child:A.object})}else t.object.add(A.object)}for(const n of A.children)v1(A,n);oS(A)}}function Pq(t,A){A&&(A.parent=t,t.children.push(A),v1(t,A))}function R9(t,A,e){if(!A||!e)return;A.parent=t;const i=t.children.indexOf(e);i!==-1?t.children.splice(i,0,A):t.children.push(A),v1(t,A,e)}function YoA(t){if(typeof t.dispose=="function"){const A=()=>{try{t.dispose()}catch{}};typeof IS_REACT_ACT_ENVIRONMENT<"u"?A():m9.unstable_scheduleCallback(m9.unstable_IdlePriority,A)}}function qY(t,A,e){if(!A)return;A.parent=null;const i=t.children.indexOf(A);i!==-1&&t.children.splice(i,1),A.props.attach?gF(t,A):Za(A.object)&&Za(t.object)&&(t.object.remove(A.object),c5A(RoA(A),A.object));const g=A.props.dispose!==null&&e!==!1;for(let I=A.children.length-1;I>=0;I--){const n=A.children[I];qY(A,n,g)}A.children.length=0,delete A.object.__r3f,g&&A.type!=="primitive"&&A.object.type!=="Scene"&&YoA(A.object),e===void 0&&oS(A)}function S5A(t,A){for(const e of[t,t.alternate])if(e!==null)if(typeof e.ref=="function"){e.refCleanup==null||e.refCleanup();const i=e.ref(A);typeof i=="function"&&(e.refCleanup=i)}else e.ref&&(e.ref.current=A)}const XR=[];function w5A(){for(const[e]of XR){const i=e.parent;if(i){e.props.attach?gF(i,e):Za(e.object)&&Za(i.object)&&i.object.remove(e.object);for(const g of e.children)g.props.attach?gF(e,g):Za(g.object)&&Za(e.object)&&e.object.remove(g.object)}e.isHidden&&ToA(e),e.object.__r3f&&delete e.object.__r3f,e.type!=="primitive"&&YoA(e.object)}for(const[e,i,g]of XR){e.props=i;const I=e.parent;if(I){var t,A;const n=wy[Qv(e.type)];e.object=(t=e.props.object)!=null?t:new n(...(A=e.props.args)!=null?A:[]),e.object.__r3f=e,S5A(g,e.object),GE(e.object,e.props),e.props.attach?iF(I,e):Za(e.object)&&Za(I.object)&&I.object.add(e.object);for(const o of e.children)o.props.attach?iF(e,o):Za(o.object)&&Za(e.object)&&e.object.add(o.object);oS(e)}}XR.length=0}const jq=()=>{},U9={};let HG=qoA;const m5A=0,k5A=4,xY=u5A({isPrimaryRenderer:!1,warnsIfNotActing:!1,supportsMutation:!0,supportsPersistence:!1,supportsHydration:!1,createInstance:D5A,removeChild:qY,appendChild:Pq,appendInitialChild:Pq,insertBefore:R9,appendChildToContainer(t,A){const e=t.getState().scene.__r3f;!A||!e||Pq(e,A)},removeChildFromContainer(t,A){const e=t.getState().scene.__r3f;!A||!e||qY(e,A)},insertInContainerBefore(t,A,e){const i=t.getState().scene.__r3f;!A||!e||!i||R9(i,A,e)},getRootHostContext:()=>U9,getChildHostContext:()=>U9,commitUpdate(t,A,e,i,g){var I,n,o;xoA(A,i);let a=!1;if((t.type==="primitive"&&e.object!==i.object||((I=i.args)==null?void 0:I.length)!==((n=e.args)==null?void 0:n.length)||(o=i.args)!=null&&o.some((s,B)=>{var c;return s!==((c=e.args)==null?void 0:c[B])}))&&(a=!0),a)XR.push([t,{...i},g]);else{const s=r5A(t,i);Object.keys(s).length&&(Object.assign(t.props,s),GE(t.object,s))}(g.sibling===null||(g.flags&k5A)===m5A)&&w5A()},finalizeInitialChildren:()=>!1,commitMount(){},getPublicInstance:t=>t?.object,prepareForCommit:()=>null,preparePortalMount:t=>tF(t.getState().scene,t,"",{}),resetAfterCommit:()=>{},shouldSetTextContent:()=>!1,clearContainer:()=>!1,hideInstance:y5A,unhideInstance:ToA,createTextInstance:jq,hideTextInstance:jq,unhideTextInstance:jq,scheduleTimeout:typeof setTimeout=="function"?setTimeout:void 0,cancelTimeout:typeof clearTimeout=="function"?clearTimeout:void 0,noTimeout:-1,getInstanceFromNode:()=>null,beforeActiveInstanceBlur(){},afterActiveInstanceBlur(){},detachDeletedInstance(){},prepareScopeUpdate(){},getInstanceFromScope:()=>null,shouldAttemptEagerTransition:()=>!1,trackSchedulerEvent:()=>{},resolveEventType:()=>null,resolveEventTimeStamp:()=>-1.1,requestPostPaintCallback(){},maySuspendCommit:()=>!1,preloadInstance:()=>!0,startSuspendingCommit(){},suspendInstance(){},waitForCommitToBeReady:()=>null,NotPendingTransition:null,HostTransitionContext:p.createContext(null),setCurrentUpdatePriority(t){HG=t},getCurrentUpdatePriority(){return HG},resolveUpdatePriority(){var t;if(HG!==qoA)return HG;switch(typeof window<"u"&&((t=window.event)==null?void 0:t.type)){case"click":case"contextmenu":case"dblclick":case"pointercancel":case"pointerdown":case"pointerup":return ZR.DiscreteEventPriority;case"pointermove":case"pointerout":case"pointerover":case"pointerenter":case"pointerleave":case"wheel":return ZR.ContinuousEventPriority;default:return ZR.DefaultEventPriority}},resetFormInstance(){}}),qd=new Map,Pf={objects:"shallow",strict:!1};function M5A(t,A){if(!A&&typeof HTMLCanvasElement<"u"&&t instanceof HTMLCanvasElement&&t.parentElement){const{width:e,height:i,top:g,left:I}=t.parentElement.getBoundingClientRect();return{width:e,height:i,top:g,left:I}}else if(!A&&typeof OffscreenCanvas<"u"&&t instanceof OffscreenCanvas)return{width:t.width,height:t.height,top:0,left:0};return{width:0,height:0,top:0,left:0,...A}}function N5A(t){const A=qd.get(t),e=A?.fiber,i=A?.store,g=typeof reportError=="function"?reportError:console.error,I=i||Q5A(HY,F9),n=e||xY.createContainer(I,ZR.ConcurrentRoot,null,!1,null,"",g,g,g,null);A||qd.set(t,{fiber:n,store:I});let o,a,r=!1,s=null;return{async configure(B={}){let c;s=new Promise(z=>c=z);let{gl:E,size:D,scene:y,events:S,onCreated:f,shadows:M=!1,linear:k=!1,flat:m=!1,legacy:U=!1,orthographic:F=!1,frameloop:b="always",dpr:K=[1,2],performance:R,raycaster:G,camera:J,onPointerMissed:x}=B,H=I.getState(),P=H.gl;if(!H.gl){const z={canvas:t,powerPreference:"high-performance",antialias:!0,alpha:!0},X=typeof E=="function"?await E(z):E;N9(X)?P=X:P=new yoA({...z,...E}),H.set({gl:P})}let j=H.raycaster;j||H.set({raycaster:j=new QoA});const{params:q,...Y}=G||{};if(GI.equ(Y,j,Pf)||GE(j,{...Y}),GI.equ(q,j.params,Pf)||GE(j,{params:{...j.params,...q}}),!H.camera||H.camera===a&&!GI.equ(a,J,Pf)){a=J;const z=J?.isCamera,X=z?J:F?new IS(0,0,0,0,.1,1e3):new jn(75,0,.1,1e3);z||(X.position.z=5,J&&(GE(X,J),X.manual||("aspect"in J||"left"in J||"right"in J||"bottom"in J||"top"in J)&&(X.manual=!0,X.updateProjectionMatrix())),!H.camera&&!(J!=null&&J.rotation)&&X.lookAt(0,0,0)),H.set({camera:X}),j.camera=X}if(!H.scene){let z;y!=null&&y.isScene?(z=y,tF(z,I,"",{})):(z=new g1,tF(z,I,"",{}),y&&GE(z,y)),H.set({scene:z})}S&&!H.events.handlers&&H.set({events:S(I)});const O=M5A(t,D);if(GI.equ(O,H.size,Pf)||H.setSize(O.width,O.height,O.top,O.left),K&&H.viewport.dpr!==FoA(K)&&H.setDpr(K),H.frameloop!==b&&H.setFrameloop(b),H.onPointerMissed||H.set({onPointerMissed:x}),R&&!GI.equ(R,H.performance,Pf)&&H.set(z=>({performance:{...z.performance,...R}})),!H.xr){var $;const z=(rA,mA)=>{const IA=I.getState();IA.frameloop!=="never"&&F9(rA,!0,IA,mA)},X=()=>{const rA=I.getState();rA.gl.xr.enabled=rA.gl.xr.isPresenting,rA.gl.xr.setAnimationLoop(rA.gl.xr.isPresenting?z:null),rA.gl.xr.isPresenting||HY(rA)},sA={connect(){const rA=I.getState().gl;rA.xr.addEventListener("sessionstart",X),rA.xr.addEventListener("sessionend",X)},disconnect(){const rA=I.getState().gl;rA.xr.removeEventListener("sessionstart",X),rA.xr.removeEventListener("sessionend",X)}};typeof(($=P.xr)==null?void 0:$.addEventListener)=="function"&&sA.connect(),H.set({xr:sA})}if(P.shadowMap){const z=P.shadowMap.enabled,X=P.shadowMap.type;if(P.shadowMap.enabled=!!M,GI.boo(M))P.shadowMap.type=Pm;else if(GI.str(M)){var gA;const sA={basic:GIA,percentage:Fb,soft:Pm,variance:eB};P.shadowMap.type=(gA=sA[M])!=null?gA:Pm}else GI.obj(M)&&Object.assign(P.shadowMap,M);(z!==P.shadowMap.enabled||X!==P.shadowMap.type)&&(P.shadowMap.needsUpdate=!0)}return Qg.enabled=!U,r||(P.outputColorSpace=k?Cu:Hn,P.toneMapping=m?Tc:Wk),H.legacy!==U&&H.set(()=>({legacy:U})),H.linear!==k&&H.set(()=>({linear:k})),H.flat!==m&&H.set(()=>({flat:m})),E&&!GI.fun(E)&&!N9(E)&&!GI.equ(E,P,Pf)&&GE(P,E),o=f,r=!0,c(),this},render(B){return!r&&!s&&this.configure(),s.then(()=>{xY.updateContainer(Q.jsx(G5A,{store:I,children:B,onCreated:o,rootElement:t}),n,null,()=>{})}),I},unmount(){HoA(t)}}}function G5A({store:t,children:A,onCreated:e,rootElement:i}){return gM(()=>{const g=t.getState();g.set(I=>({internal:{...I.internal,active:!0}})),e&&e(g),t.getState().events.connected||g.events.connect==null||g.events.connect(i)},[]),Q.jsx(_oA.Provider,{value:t,children:A})}function HoA(t,A){const e=qd.get(t),i=e?.fiber;if(i){const g=e?.store.getState();g&&(g.internal.active=!1),xY.updateContainer(null,i,null,()=>{g&&setTimeout(()=>{try{var I,n,o,a;g.events.disconnect==null||g.events.disconnect(),(I=g.gl)==null||(n=I.renderLists)==null||n.dispose==null||n.dispose(),(o=g.gl)==null||o.forceContextLoss==null||o.forceContextLoss(),(a=g.gl)!=null&&a.xr&&g.xr.disconnect(),n5A(g.scene),qd.delete(t)}catch{}},500)})}}const R5A=new Set,U5A=new Set,K5A=new Set;function Zq(t,A){if(t.size)for(const{callback:e}of t.values())e(A)}function A0(t,A){switch(t){case"before":return Zq(R5A,A);case"after":return Zq(U5A,A);case"tail":return Zq(K5A,A)}}let Wq,zq;function TY(t,A,e){let i=A.clock.getDelta();A.frameloop==="never"&&typeof t=="number"&&(i=t-A.clock.elapsedTime,A.clock.oldTime=A.clock.elapsedTime,A.clock.elapsedTime=t),Wq=A.internal.subscribers;for(let g=0;g<Wq.length;g++)zq=Wq[g],zq.ref.current(zq.store.getState(),i,e);return!A.internal.priority&&A.gl.render&&A.gl.render(A.scene,A.camera),A.internal.frames=Math.max(0,A.internal.frames-1),A.frameloop==="always"?1:A.internal.frames}let IF=!1,YY=!1,Vq,K9,jf;function OoA(t){K9=requestAnimationFrame(OoA),IF=!0,Vq=0,A0("before",t),YY=!0;for(const e of qd.values()){var A;jf=e.store.getState(),jf.internal.active&&(jf.frameloop==="always"||jf.internal.frames>0)&&!((A=jf.gl.xr)!=null&&A.isPresenting)&&(Vq+=TY(t,jf))}if(YY=!1,A0("after",t),Vq===0)return A0("tail",t),IF=!1,cancelAnimationFrame(K9)}function HY(t,A=1){var e;if(!t)return qd.forEach(i=>HY(i.store.getState(),A));(e=t.gl.xr)!=null&&e.isPresenting||!t.internal.active||t.frameloop==="never"||(A>1?t.internal.frames=Math.min(60,t.internal.frames+A):YY?t.internal.frames=2:t.internal.frames=1,IF||(IF=!0,requestAnimationFrame(OoA)))}function F9(t,A=!0,e,i){if(A&&A0("before",t),e)TY(t,e,i);else for(const g of qd.values())TY(t,g.store.getState());A&&A0("after",t)}const Xq={onClick:["click",!1],onContextMenu:["contextmenu",!1],onDoubleClick:["dblclick",!1],onWheel:["wheel",!0],onPointerDown:["pointerdown",!0],onPointerUp:["pointerup",!0],onPointerLeave:["pointerleave",!0],onPointerMove:["pointermove",!0],onPointerCancel:["pointercancel",!0],onLostPointerCapture:["lostpointercapture",!0]};function F5A(t){const{handlePointer:A}=l5A(t);return{priority:1,enabled:!0,compute(e,i,g){i.pointer.set(e.offsetX/i.size.width*2-1,-(e.offsetY/i.size.height)*2+1),i.raycaster.setFromCamera(i.pointer,i.camera)},connected:void 0,handlers:Object.keys(Xq).reduce((e,i)=>({...e,[i]:A(i)}),{}),update:()=>{var e;const{events:i,internal:g}=t.getState();(e=g.lastEvent)!=null&&e.current&&i.handlers&&i.handlers.onPointerMove(g.lastEvent.current)},connect:e=>{const{set:i,events:g}=t.getState();if(g.disconnect==null||g.disconnect(),i(I=>({events:{...I.events,connected:e}})),g.handlers)for(const I in g.handlers){const n=g.handlers[I],[o,a]=Xq[I];e.addEventListener(o,n,{passive:a})}},disconnect:()=>{const{set:e,events:i}=t.getState();if(i.connected){if(i.handlers)for(const g in i.handlers){const I=i.handlers[g],[n]=Xq[g];i.connected.removeEventListener(n,I)}e(g=>({events:{...g.events,connected:void 0}}))}}}}function b9(t,A){let e;return(...i)=>{window.clearTimeout(e),e=window.setTimeout(()=>t(...i),A)}}function b5A({debounce:t,scroll:A,polyfill:e,offsetSize:i}={debounce:0,scroll:!1,offsetSize:!1}){const g=e||(typeof window>"u"?class{}:window.ResizeObserver);if(!g)throw new Error("This browser does not support ResizeObserver out of the box. See: https://github.com/react-spring/react-use-measure/#resize-observer-polyfills");const[I,n]=p.useState({left:0,top:0,width:0,height:0,bottom:0,right:0,x:0,y:0}),o=p.useRef({element:null,scrollContainers:null,resizeObserver:null,lastBounds:I,orientationHandler:null}),a=t?typeof t=="number"?t:t.scroll:null,r=t?typeof t=="number"?t:t.resize:null,s=p.useRef(!1);p.useEffect(()=>(s.current=!0,()=>void(s.current=!1)));const[B,c,E]=p.useMemo(()=>{const f=()=>{if(!o.current.element)return;const{left:M,top:k,width:m,height:U,bottom:F,right:b,x:K,y:R}=o.current.element.getBoundingClientRect(),G={left:M,top:k,width:m,height:U,bottom:F,right:b,x:K,y:R};o.current.element instanceof HTMLElement&&i&&(G.height=o.current.element.offsetHeight,G.width=o.current.element.offsetWidth),Object.freeze(G),s.current&&!L5A(o.current.lastBounds,G)&&n(o.current.lastBounds=G)};return[f,r?b9(f,r):f,a?b9(f,a):f]},[n,i,a,r]);function D(){o.current.scrollContainers&&(o.current.scrollContainers.forEach(f=>f.removeEventListener("scroll",E,!0)),o.current.scrollContainers=null),o.current.resizeObserver&&(o.current.resizeObserver.disconnect(),o.current.resizeObserver=null),o.current.orientationHandler&&("orientation"in screen&&"removeEventListener"in screen.orientation?screen.orientation.removeEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.removeEventListener("orientationchange",o.current.orientationHandler))}function y(){o.current.element&&(o.current.resizeObserver=new g(E),o.current.resizeObserver.observe(o.current.element),A&&o.current.scrollContainers&&o.current.scrollContainers.forEach(f=>f.addEventListener("scroll",E,{capture:!0,passive:!0})),o.current.orientationHandler=()=>{E()},"orientation"in screen&&"addEventListener"in screen.orientation?screen.orientation.addEventListener("change",o.current.orientationHandler):"onorientationchange"in window&&window.addEventListener("orientationchange",o.current.orientationHandler))}const S=f=>{!f||f===o.current.element||(D(),o.current.element=f,o.current.scrollContainers=PoA(f),y())};return _5A(E,!!A),v5A(c),p.useEffect(()=>{D(),y()},[A,E,c]),p.useEffect(()=>D,[]),[S,I,B]}function v5A(t){p.useEffect(()=>{const A=t;return window.addEventListener("resize",A),()=>void window.removeEventListener("resize",A)},[t])}function _5A(t,A){p.useEffect(()=>{if(A){const e=t;return window.addEventListener("scroll",e,{capture:!0,passive:!0}),()=>void window.removeEventListener("scroll",e,!0)}},[t,A])}function PoA(t){const A=[];if(!t||t===document.body)return A;const{overflow:e,overflowX:i,overflowY:g}=window.getComputedStyle(t);return[e,i,g].some(I=>I==="auto"||I==="scroll")&&A.push(t),[...A,...PoA(t.parentElement)]}const J5A=["x","y","top","bottom","left","right","width","height"],L5A=(t,A)=>J5A.every(e=>t[e]===A[e]);function q5A({ref:t,children:A,fallback:e,resize:i,style:g,gl:I,events:n=F5A,eventSource:o,eventPrefix:a,shadows:r,linear:s,flat:B,legacy:c,orthographic:E,frameloop:D,dpr:y,performance:S,raycaster:f,camera:M,scene:k,onPointerMissed:m,onCreated:U,...F}){p.useMemo(()=>f5A(M8A),[]);const b=t5A(),[K,R]=b5A({scroll:!0,debounce:{scroll:50,resize:0},...i}),G=p.useRef(null),J=p.useRef(null);p.useImperativeHandle(t,()=>G.current);const x=KoA(m),[H,P]=p.useState(!1),[j,q]=p.useState(!1);if(H)throw H;if(j)throw j;const Y=p.useRef(null);gM(()=>{const $=G.current;if(R.width>0&&R.height>0&&$){Y.current||(Y.current=N5A($));async function gA(){await Y.current.configure({gl:I,scene:k,events:n,shadows:r,linear:s,flat:B,legacy:c,orthographic:E,frameloop:D,dpr:y,performance:S,raycaster:f,camera:M,size:R,onPointerMissed:(...z)=>x.current==null?void 0:x.current(...z),onCreated:z=>{z.events.connect==null||z.events.connect(o?A5A(o)?o.current:o:J.current),a&&z.setEvents({compute:(X,sA)=>{const rA=X[a+"X"],mA=X[a+"Y"];sA.pointer.set(rA/sA.size.width*2-1,-(mA/sA.size.height)*2+1),sA.raycaster.setFromCamera(sA.pointer,sA.camera)}}),U?.(z)}}),Y.current.render(Q.jsx(b,{children:Q.jsx(g5A,{set:q,children:Q.jsx(p.Suspense,{fallback:Q.jsx(i5A,{set:P}),children:A??null})})}))}gA()}}),p.useEffect(()=>{const $=G.current;if($)return()=>HoA($)},[]);const O=o?"none":"auto";return Q.jsx("div",{ref:J,style:{position:"relative",width:"100%",height:"100%",overflow:"hidden",pointerEvents:O,...g},...F,children:Q.jsx("div",{ref:K,style:{width:"100%",height:"100%"},children:Q.jsx("canvas",{ref:G,style:{display:"block"},children:e})})})}function x5A(t){return Q.jsx(NoA,{children:Q.jsx(q5A,{...t})})}const T5A=parseInt(jk.replace(/\D+/g,""));function Y5A(t,A=1e-4){A=Math.max(A,Number.EPSILON);const e={},i=t.getIndex(),g=t.getAttribute("position"),I=i?i.count:g.count;let n=0;const o=Object.keys(t.attributes),a={},r={},s=[],B=["getX","getY","getZ","getW"];for(let y=0,S=o.length;y<S;y++){const f=o[y];a[f]=[];const M=t.morphAttributes[f];M&&(r[f]=new Array(M.length).fill(0).map(()=>[]))}const c=Math.log10(1/A),E=Math.pow(10,c);for(let y=0;y<I;y++){const S=i?i.getX(y):y;let f="";for(let M=0,k=o.length;M<k;M++){const m=o[M],U=t.getAttribute(m),F=U.itemSize;for(let b=0;b<F;b++)f+=`${~~(U[B[b]](S)*E)},`}if(f in e)s.push(e[f]);else{for(let M=0,k=o.length;M<k;M++){const m=o[M],U=t.getAttribute(m),F=t.morphAttributes[m],b=U.itemSize,K=a[m],R=r[m];for(let G=0;G<b;G++){const J=B[G];if(K.push(U[J](S)),F)for(let x=0,H=F.length;x<H;x++)R[x].push(F[x][J](S))}}e[f]=n,s.push(n),n++}}const D=t.clone();for(let y=0,S=o.length;y<S;y++){const f=o[y],M=t.getAttribute(f),k=new M.array.constructor(a[f]),m=new eg(k,M.itemSize,M.normalized);if(D.setAttribute(f,m),f in r)for(let U=0;U<r[f].length;U++){const F=t.morphAttributes[f][U],b=new F.array.constructor(r[f][U]),K=new eg(b,F.itemSize,F.normalized);D.morphAttributes[f][U]=K}}return D.setIndex(s),D}function v9(t,A){if(A===onA)return t;if(A===VK||A===zP){let e=t.getIndex();if(e===null){const n=[],o=t.getAttribute("position");if(o!==void 0){for(let a=0;a<o.count;a++)n.push(a);t.setIndex(n),e=t.getIndex()}else return t}const i=e.count-2,g=[];if(e)if(A===VK)for(let n=1;n<=i;n++)g.push(e.getX(0)),g.push(e.getX(n)),g.push(e.getX(n+1));else for(let n=0;n<i;n++)n%2===0?(g.push(e.getX(n)),g.push(e.getX(n+1)),g.push(e.getX(n+2))):(g.push(e.getX(n+2)),g.push(e.getX(n+1)),g.push(e.getX(n)));g.length/3;const I=t.clone();return I.setIndex(g),I.clearGroups(),I}else return t}function nF(t){if(typeof TextDecoder<"u")return new TextDecoder().decode(t);let A="";for(let e=0,i=t.length;e<i;e++)A+=String.fromCharCode(t[e]);try{return decodeURIComponent(escape(A))}catch{return A}}const td="srgb",rQ="srgb-linear",_9=3001,H5A=3e3;class _1 extends Sa{constructor(A){super(A),this.dracoLoader=null,this.ktx2Loader=null,this.meshoptDecoder=null,this.pluginCallbacks=[],this.register(function(e){return new W5A(e)}),this.register(function(e){return new z5A(e)}),this.register(function(e){return new IZA(e)}),this.register(function(e){return new nZA(e)}),this.register(function(e){return new oZA(e)}),this.register(function(e){return new X5A(e)}),this.register(function(e){return new $5A(e)}),this.register(function(e){return new AZA(e)}),this.register(function(e){return new eZA(e)}),this.register(function(e){return new Z5A(e)}),this.register(function(e){return new tZA(e)}),this.register(function(e){return new V5A(e)}),this.register(function(e){return new gZA(e)}),this.register(function(e){return new iZA(e)}),this.register(function(e){return new P5A(e)}),this.register(function(e){return new aZA(e)}),this.register(function(e){return new rZA(e)})}load(A,e,i,g){const I=this;let n;if(this.resourcePath!=="")n=this.resourcePath;else if(this.path!==""){const r=OE.extractUrlBase(A);n=OE.resolveURL(r,this.path)}else n=OE.extractUrlBase(A);this.manager.itemStart(A);const o=function(r){g&&g(r),I.manager.itemError(A),I.manager.itemEnd(A)},a=new Es(this.manager);a.setPath(this.path),a.setResponseType("arraybuffer"),a.setRequestHeader(this.requestHeader),a.setWithCredentials(this.withCredentials),a.load(A,function(r){try{I.parse(r,n,function(s){e(s),I.manager.itemEnd(A)},o)}catch(s){o(s)}},i,o)}setDRACOLoader(A){return this.dracoLoader=A,this}setDDSLoader(){throw new Error('THREE.GLTFLoader: "MSFT_texture_dds" no longer supported. Please update to "KHR_texture_basisu".')}setKTX2Loader(A){return this.ktx2Loader=A,this}setMeshoptDecoder(A){return this.meshoptDecoder=A,this}register(A){return this.pluginCallbacks.indexOf(A)===-1&&this.pluginCallbacks.push(A),this}unregister(A){return this.pluginCallbacks.indexOf(A)!==-1&&this.pluginCallbacks.splice(this.pluginCallbacks.indexOf(A),1),this}parse(A,e,i,g){let I;const n={},o={};if(typeof A=="string")I=JSON.parse(A);else if(A instanceof ArrayBuffer)if(nF(new Uint8Array(A.slice(0,4)))===joA){try{n[$i.KHR_BINARY_GLTF]=new sZA(A)}catch(s){g&&g(s);return}I=JSON.parse(n[$i.KHR_BINARY_GLTF].content)}else I=JSON.parse(nF(new Uint8Array(A)));else I=A;if(I.asset===void 0||I.asset.version[0]<2){g&&g(new Error("THREE.GLTFLoader: Unsupported asset. glTF versions >=2.0 are supported."));return}const a=new yZA(I,{path:e||this.resourcePath||"",crossOrigin:this.crossOrigin,requestHeader:this.requestHeader,manager:this.manager,ktx2Loader:this.ktx2Loader,meshoptDecoder:this.meshoptDecoder});a.fileLoader.setRequestHeader(this.requestHeader);for(let r=0;r<this.pluginCallbacks.length;r++){const s=this.pluginCallbacks[r](a);s.name,o[s.name]=s,n[s.name]=!0}if(I.extensionsUsed)for(let r=0;r<I.extensionsUsed.length;++r){const s=I.extensionsUsed[r],B=I.extensionsRequired||[];switch(s){case $i.KHR_MATERIALS_UNLIT:n[s]=new j5A;break;case $i.KHR_DRACO_MESH_COMPRESSION:n[s]=new CZA(I,this.dracoLoader);break;case $i.KHR_TEXTURE_TRANSFORM:n[s]=new BZA;break;case $i.KHR_MESH_QUANTIZATION:n[s]=new cZA;break;default:B.indexOf(s)>=0&&o[s]}}a.setExtensions(n),a.setPlugins(o),a.parse(i,g)}parseAsync(A,e){const i=this;return new Promise(function(g,I){i.parse(A,e,g,I)})}}function O5A(){let t={};return{get:function(A){return t[A]},add:function(A,e){t[A]=e},remove:function(A){delete t[A]},removeAll:function(){t={}}}}const $i={KHR_BINARY_GLTF:"KHR_binary_glTF",KHR_DRACO_MESH_COMPRESSION:"KHR_draco_mesh_compression",KHR_LIGHTS_PUNCTUAL:"KHR_lights_punctual",KHR_MATERIALS_CLEARCOAT:"KHR_materials_clearcoat",KHR_MATERIALS_DISPERSION:"KHR_materials_dispersion",KHR_MATERIALS_IOR:"KHR_materials_ior",KHR_MATERIALS_SHEEN:"KHR_materials_sheen",KHR_MATERIALS_SPECULAR:"KHR_materials_specular",KHR_MATERIALS_TRANSMISSION:"KHR_materials_transmission",KHR_MATERIALS_IRIDESCENCE:"KHR_materials_iridescence",KHR_MATERIALS_ANISOTROPY:"KHR_materials_anisotropy",KHR_MATERIALS_UNLIT:"KHR_materials_unlit",KHR_MATERIALS_VOLUME:"KHR_materials_volume",KHR_TEXTURE_BASISU:"KHR_texture_basisu",KHR_TEXTURE_TRANSFORM:"KHR_texture_transform",KHR_MESH_QUANTIZATION:"KHR_mesh_quantization",KHR_MATERIALS_EMISSIVE_STRENGTH:"KHR_materials_emissive_strength",EXT_MATERIALS_BUMP:"EXT_materials_bump",EXT_TEXTURE_WEBP:"EXT_texture_webp",EXT_TEXTURE_AVIF:"EXT_texture_avif",EXT_MESHOPT_COMPRESSION:"EXT_meshopt_compression",EXT_MESH_GPU_INSTANCING:"EXT_mesh_gpu_instancing"};class P5A{constructor(A){this.parser=A,this.name=$i.KHR_LIGHTS_PUNCTUAL,this.cache={refs:{},uses:{}}}_markDefs(){const A=this.parser,e=this.parser.json.nodes||[];for(let i=0,g=e.length;i<g;i++){const I=e[i];I.extensions&&I.extensions[this.name]&&I.extensions[this.name].light!==void 0&&A._addNodeRef(this.cache,I.extensions[this.name].light)}}_loadLight(A){const e=this.parser,i="light:"+A;let g=e.cache.get(i);if(g)return g;const I=e.json,a=((I.extensions&&I.extensions[this.name]||{}).lights||[])[A];let r;const s=new wt(16777215);a.color!==void 0&&s.setRGB(a.color[0],a.color[1],a.color[2],rQ);const B=a.range!==void 0?a.range:0;switch(a.type){case"directional":r=new m1(s),r.target.position.set(0,0,-1),r.add(r.target);break;case"point":r=new w1(s),r.distance=B;break;case"spot":r=new S1(s),r.distance=B,a.spot=a.spot||{},a.spot.innerConeAngle=a.spot.innerConeAngle!==void 0?a.spot.innerConeAngle:0,a.spot.outerConeAngle=a.spot.outerConeAngle!==void 0?a.spot.outerConeAngle:Math.PI/4,r.angle=a.spot.outerConeAngle,r.penumbra=1-a.spot.innerConeAngle/a.spot.outerConeAngle,r.target.position.set(0,0,-1),r.add(r.target);break;default:throw new Error("THREE.GLTFLoader: Unexpected light type: "+a.type)}return r.position.set(0,0,0),r.decay=2,xl(r,a),a.intensity!==void 0&&(r.intensity=a.intensity),r.name=e.createUniqueName(a.name||"light_"+A),g=Promise.resolve(r),e.cache.add(i,g),g}getDependency(A,e){if(A==="light")return this._loadLight(e)}createNodeAttachment(A){const e=this,i=this.parser,I=i.json.nodes[A],o=(I.extensions&&I.extensions[this.name]||{}).light;return o===void 0?null:this._loadLight(o).then(function(a){return i._getNodeRef(e.cache,o,a)})}}class j5A{constructor(){this.name=$i.KHR_MATERIALS_UNLIT}getMaterialType(){return ls}extendParams(A,e,i){const g=[];A.color=new wt(1,1,1),A.opacity=1;const I=e.pbrMetallicRoughness;if(I){if(Array.isArray(I.baseColorFactor)){const n=I.baseColorFactor;A.color.setRGB(n[0],n[1],n[2],rQ),A.opacity=n[3]}I.baseColorTexture!==void 0&&g.push(i.assignTexture(A,"map",I.baseColorTexture,td))}return Promise.all(g)}}class Z5A{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_EMISSIVE_STRENGTH}extendMaterialParams(A,e){const g=this.parser.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=g.extensions[this.name].emissiveStrength;return I!==void 0&&(e.emissiveIntensity=I),Promise.resolve()}}class W5A{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_CLEARCOAT}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];if(n.clearcoatFactor!==void 0&&(e.clearcoat=n.clearcoatFactor),n.clearcoatTexture!==void 0&&I.push(i.assignTexture(e,"clearcoatMap",n.clearcoatTexture)),n.clearcoatRoughnessFactor!==void 0&&(e.clearcoatRoughness=n.clearcoatRoughnessFactor),n.clearcoatRoughnessTexture!==void 0&&I.push(i.assignTexture(e,"clearcoatRoughnessMap",n.clearcoatRoughnessTexture)),n.clearcoatNormalTexture!==void 0&&(I.push(i.assignTexture(e,"clearcoatNormalMap",n.clearcoatNormalTexture)),n.clearcoatNormalTexture.scale!==void 0)){const o=n.clearcoatNormalTexture.scale;e.clearcoatNormalScale=new Ze(o,o)}return Promise.all(I)}}class z5A{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_DISPERSION}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const g=this.parser.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=g.extensions[this.name];return e.dispersion=I.dispersion!==void 0?I.dispersion:0,Promise.resolve()}}class V5A{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_IRIDESCENCE}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];return n.iridescenceFactor!==void 0&&(e.iridescence=n.iridescenceFactor),n.iridescenceTexture!==void 0&&I.push(i.assignTexture(e,"iridescenceMap",n.iridescenceTexture)),n.iridescenceIor!==void 0&&(e.iridescenceIOR=n.iridescenceIor),e.iridescenceThicknessRange===void 0&&(e.iridescenceThicknessRange=[100,400]),n.iridescenceThicknessMinimum!==void 0&&(e.iridescenceThicknessRange[0]=n.iridescenceThicknessMinimum),n.iridescenceThicknessMaximum!==void 0&&(e.iridescenceThicknessRange[1]=n.iridescenceThicknessMaximum),n.iridescenceThicknessTexture!==void 0&&I.push(i.assignTexture(e,"iridescenceThicknessMap",n.iridescenceThicknessTexture)),Promise.all(I)}}class X5A{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_SHEEN}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[];e.sheenColor=new wt(0,0,0),e.sheenRoughness=0,e.sheen=1;const n=g.extensions[this.name];if(n.sheenColorFactor!==void 0){const o=n.sheenColorFactor;e.sheenColor.setRGB(o[0],o[1],o[2],rQ)}return n.sheenRoughnessFactor!==void 0&&(e.sheenRoughness=n.sheenRoughnessFactor),n.sheenColorTexture!==void 0&&I.push(i.assignTexture(e,"sheenColorMap",n.sheenColorTexture,td)),n.sheenRoughnessTexture!==void 0&&I.push(i.assignTexture(e,"sheenRoughnessMap",n.sheenRoughnessTexture)),Promise.all(I)}}class $5A{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_TRANSMISSION}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];return n.transmissionFactor!==void 0&&(e.transmission=n.transmissionFactor),n.transmissionTexture!==void 0&&I.push(i.assignTexture(e,"transmissionMap",n.transmissionTexture)),Promise.all(I)}}class AZA{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_VOLUME}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];e.thickness=n.thicknessFactor!==void 0?n.thicknessFactor:0,n.thicknessTexture!==void 0&&I.push(i.assignTexture(e,"thicknessMap",n.thicknessTexture)),e.attenuationDistance=n.attenuationDistance||1/0;const o=n.attenuationColor||[1,1,1];return e.attenuationColor=new wt().setRGB(o[0],o[1],o[2],rQ),Promise.all(I)}}class eZA{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_IOR}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const g=this.parser.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=g.extensions[this.name];return e.ior=I.ior!==void 0?I.ior:1.5,Promise.resolve()}}class tZA{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_SPECULAR}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];e.specularIntensity=n.specularFactor!==void 0?n.specularFactor:1,n.specularTexture!==void 0&&I.push(i.assignTexture(e,"specularIntensityMap",n.specularTexture));const o=n.specularColorFactor||[1,1,1];return e.specularColor=new wt().setRGB(o[0],o[1],o[2],rQ),n.specularColorTexture!==void 0&&I.push(i.assignTexture(e,"specularColorMap",n.specularColorTexture,td)),Promise.all(I)}}class iZA{constructor(A){this.parser=A,this.name=$i.EXT_MATERIALS_BUMP}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];return e.bumpScale=n.bumpFactor!==void 0?n.bumpFactor:1,n.bumpTexture!==void 0&&I.push(i.assignTexture(e,"bumpMap",n.bumpTexture)),Promise.all(I)}}class gZA{constructor(A){this.parser=A,this.name=$i.KHR_MATERIALS_ANISOTROPY}getMaterialType(A){const i=this.parser.json.materials[A];return!i.extensions||!i.extensions[this.name]?null:pC}extendMaterialParams(A,e){const i=this.parser,g=i.json.materials[A];if(!g.extensions||!g.extensions[this.name])return Promise.resolve();const I=[],n=g.extensions[this.name];return n.anisotropyStrength!==void 0&&(e.anisotropy=n.anisotropyStrength),n.anisotropyRotation!==void 0&&(e.anisotropyRotation=n.anisotropyRotation),n.anisotropyTexture!==void 0&&I.push(i.assignTexture(e,"anisotropyMap",n.anisotropyTexture)),Promise.all(I)}}class IZA{constructor(A){this.parser=A,this.name=$i.KHR_TEXTURE_BASISU}loadTexture(A){const e=this.parser,i=e.json,g=i.textures[A];if(!g.extensions||!g.extensions[this.name])return null;const I=g.extensions[this.name],n=e.options.ktx2Loader;if(!n){if(i.extensionsRequired&&i.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setKTX2Loader must be called before loading KTX2 textures");return null}return e.loadTextureImage(A,I.source,n)}}class nZA{constructor(A){this.parser=A,this.name=$i.EXT_TEXTURE_WEBP,this.isSupported=null}loadTexture(A){const e=this.name,i=this.parser,g=i.json,I=g.textures[A];if(!I.extensions||!I.extensions[e])return null;const n=I.extensions[e],o=g.images[n.source];let a=i.textureLoader;if(o.uri){const r=i.options.manager.getHandler(o.uri);r!==null&&(a=r)}return this.detectSupport().then(function(r){if(r)return i.loadTextureImage(A,n.source,a);if(g.extensionsRequired&&g.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: WebP required by asset but unsupported.");return i.loadTexture(A)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(A){const e=new Image;e.src="data:image/webp;base64,UklGRiIAAABXRUJQVlA4IBYAAAAwAQCdASoBAAEADsD+JaQAA3AAAAAA",e.onload=e.onerror=function(){A(e.height===1)}})),this.isSupported}}class oZA{constructor(A){this.parser=A,this.name=$i.EXT_TEXTURE_AVIF,this.isSupported=null}loadTexture(A){const e=this.name,i=this.parser,g=i.json,I=g.textures[A];if(!I.extensions||!I.extensions[e])return null;const n=I.extensions[e],o=g.images[n.source];let a=i.textureLoader;if(o.uri){const r=i.options.manager.getHandler(o.uri);r!==null&&(a=r)}return this.detectSupport().then(function(r){if(r)return i.loadTextureImage(A,n.source,a);if(g.extensionsRequired&&g.extensionsRequired.indexOf(e)>=0)throw new Error("THREE.GLTFLoader: AVIF required by asset but unsupported.");return i.loadTexture(A)})}detectSupport(){return this.isSupported||(this.isSupported=new Promise(function(A){const e=new Image;e.src="data:image/avif;base64,AAAAIGZ0eXBhdmlmAAAAAGF2aWZtaWYxbWlhZk1BMUIAAADybWV0YQAAAAAAAAAoaGRscgAAAAAAAAAAcGljdAAAAAAAAAAAAAAAAGxpYmF2aWYAAAAADnBpdG0AAAAAAAEAAAAeaWxvYwAAAABEAAABAAEAAAABAAABGgAAABcAAAAoaWluZgAAAAAAAQAAABppbmZlAgAAAAABAABhdjAxQ29sb3IAAAAAamlwcnAAAABLaXBjbwAAABRpc3BlAAAAAAAAAAEAAAABAAAAEHBpeGkAAAAAAwgICAAAAAxhdjFDgQAMAAAAABNjb2xybmNseAACAAIABoAAAAAXaXBtYQAAAAAAAAABAAEEAQKDBAAAAB9tZGF0EgAKCBgABogQEDQgMgkQAAAAB8dSLfI=",e.onload=e.onerror=function(){A(e.height===1)}})),this.isSupported}}class aZA{constructor(A){this.name=$i.EXT_MESHOPT_COMPRESSION,this.parser=A}loadBufferView(A){const e=this.parser.json,i=e.bufferViews[A];if(i.extensions&&i.extensions[this.name]){const g=i.extensions[this.name],I=this.parser.getDependency("buffer",g.buffer),n=this.parser.options.meshoptDecoder;if(!n||!n.supported){if(e.extensionsRequired&&e.extensionsRequired.indexOf(this.name)>=0)throw new Error("THREE.GLTFLoader: setMeshoptDecoder must be called before loading compressed files");return null}return I.then(function(o){const a=g.byteOffset||0,r=g.byteLength||0,s=g.count,B=g.byteStride,c=new Uint8Array(o,a,r);return n.decodeGltfBufferAsync?n.decodeGltfBufferAsync(s,B,c,g.mode,g.filter).then(function(E){return E.buffer}):n.ready.then(function(){const E=new ArrayBuffer(s*B);return n.decodeGltfBuffer(new Uint8Array(E),s,B,c,g.mode,g.filter),E})})}else return null}}class rZA{constructor(A){this.name=$i.EXT_MESH_GPU_INSTANCING,this.parser=A}createNodeMesh(A){const e=this.parser.json,i=e.nodes[A];if(!i.extensions||!i.extensions[this.name]||i.mesh===void 0)return null;const g=e.meshes[i.mesh];for(const r of g.primitives)if(r.mode!==Ws.TRIANGLES&&r.mode!==Ws.TRIANGLE_STRIP&&r.mode!==Ws.TRIANGLE_FAN&&r.mode!==void 0)return null;const n=i.extensions[this.name].attributes,o=[],a={};for(const r in n)o.push(this.parser.getDependency("accessor",n[r]).then(s=>(a[r]=s,a[r])));return o.length<1?null:(o.push(this.parser.createNodeMesh(A)),Promise.all(o).then(r=>{const s=r.pop(),B=s.isGroup?s.children:[s],c=r[0].count,E=[];for(const D of B){const y=new Ai,S=new wA,f=new Kn,M=new wA(1,1,1),k=new o1(D.geometry,D.material,c);for(let m=0;m<c;m++)a.TRANSLATION&&S.fromBufferAttribute(a.TRANSLATION,m),a.ROTATION&&f.fromBufferAttribute(a.ROTATION,m),a.SCALE&&M.fromBufferAttribute(a.SCALE,m),k.setMatrixAt(m,y.compose(S,f,M));for(const m in a)if(m==="_COLOR_0"){const U=a[m];k.instanceColor=new Fd(U.array,U.itemSize,U.normalized)}else m!=="TRANSLATION"&&m!=="ROTATION"&&m!=="SCALE"&&D.geometry.setAttribute(m,a[m]);ng.prototype.copy.call(k,D),this.parser.assignFinalMaterial(k),E.push(k)}return s.isGroup?(s.clear(),s.add(...E),s):E[0]}))}}const joA="glTF",Vw=12,J9={JSON:1313821514,BIN:5130562};class sZA{constructor(A){this.name=$i.KHR_BINARY_GLTF,this.content=null,this.body=null;const e=new DataView(A,0,Vw);if(this.header={magic:nF(new Uint8Array(A.slice(0,4))),version:e.getUint32(4,!0),length:e.getUint32(8,!0)},this.header.magic!==joA)throw new Error("THREE.GLTFLoader: Unsupported glTF-Binary header.");if(this.header.version<2)throw new Error("THREE.GLTFLoader: Legacy binary file detected.");const i=this.header.length-Vw,g=new DataView(A,Vw);let I=0;for(;I<i;){const n=g.getUint32(I,!0);I+=4;const o=g.getUint32(I,!0);if(I+=4,o===J9.JSON){const a=new Uint8Array(A,Vw+I,n);this.content=nF(a)}else if(o===J9.BIN){const a=Vw+I;this.body=A.slice(a,a+n)}I+=n}if(this.content===null)throw new Error("THREE.GLTFLoader: JSON content not found.")}}class CZA{constructor(A,e){if(!e)throw new Error("THREE.GLTFLoader: No DRACOLoader instance provided.");this.name=$i.KHR_DRACO_MESH_COMPRESSION,this.json=A,this.dracoLoader=e,this.dracoLoader.preload()}decodePrimitive(A,e){const i=this.json,g=this.dracoLoader,I=A.extensions[this.name].bufferView,n=A.extensions[this.name].attributes,o={},a={},r={};for(const s in n){const B=OY[s]||s.toLowerCase();o[B]=n[s]}for(const s in A.attributes){const B=OY[s]||s.toLowerCase();if(n[s]!==void 0){const c=i.accessors[A.attributes[s]],E=LD[c.componentType];r[B]=E.name,a[B]=c.normalized===!0}}return e.getDependency("bufferView",I).then(function(s){return new Promise(function(B,c){g.decodeDracoFile(s,function(E){for(const D in E.attributes){const y=E.attributes[D],S=a[D];S!==void 0&&(y.normalized=S)}B(E)},o,r,rQ,c)})})}}class BZA{constructor(){this.name=$i.KHR_TEXTURE_TRANSFORM}extendTexture(A,e){return(e.texCoord===void 0||e.texCoord===A.channel)&&e.offset===void 0&&e.rotation===void 0&&e.scale===void 0||(A=A.clone(),e.texCoord!==void 0&&(A.channel=e.texCoord),e.offset!==void 0&&A.offset.fromArray(e.offset),e.rotation!==void 0&&(A.rotation=e.rotation),e.scale!==void 0&&A.repeat.fromArray(e.scale),A.needsUpdate=!0),A}}class cZA{constructor(){this.name=$i.KHR_MESH_QUANTIZATION}}class ZoA extends gS{constructor(A,e,i,g){super(A,e,i,g)}copySampleValue_(A){const e=this.resultBuffer,i=this.sampleValues,g=this.valueSize,I=A*g*3+g;for(let n=0;n!==g;n++)e[n]=i[I+n];return e}interpolate_(A,e,i,g){const I=this.resultBuffer,n=this.sampleValues,o=this.valueSize,a=o*2,r=o*3,s=g-e,B=(i-e)/s,c=B*B,E=c*B,D=A*r,y=D-r,S=-2*E+3*c,f=E-c,M=1-S,k=f-c+B;for(let m=0;m!==o;m++){const U=n[y+m+o],F=n[y+m+a]*s,b=n[D+m+o],K=n[D+m]*s;I[m]=M*U+k*F+S*b+f*K}return I}}const lZA=new Kn;class QZA extends ZoA{interpolate_(A,e,i,g){const I=super.interpolate_(A,e,i,g);return lZA.fromArray(I).normalize().toArray(I),I}}const Ws={POINTS:0,LINES:1,LINE_LOOP:2,LINE_STRIP:3,TRIANGLES:4,TRIANGLE_STRIP:5,TRIANGLE_FAN:6},LD={5120:Int8Array,5121:Uint8Array,5122:Int16Array,5123:Uint16Array,5125:Uint32Array,5126:Float32Array},L9={9728:ho,9729:HI,9984:vb,9985:_D,9986:Vh,9987:oC},q9={33071:Bs,33648:By,10497:su},$q={SCALAR:1,VEC2:2,VEC3:3,VEC4:4,MAT2:4,MAT3:9,MAT4:16},OY={POSITION:"position",NORMAL:"normal",TANGENT:"tangent",...T5A>=152?{TEXCOORD_0:"uv",TEXCOORD_1:"uv1",TEXCOORD_2:"uv2",TEXCOORD_3:"uv3"}:{TEXCOORD_0:"uv",TEXCOORD_1:"uv2"},COLOR_0:"color",WEIGHTS_0:"skinWeight",JOINTS_0:"skinIndex"},pE={scale:"scale",translation:"position",rotation:"quaternion",weights:"morphTargetInfluences"},EZA={CUBICSPLINE:void 0,LINEAR:hy,STEP:uy},Ax={OPAQUE:"OPAQUE",MASK:"MASK",BLEND:"BLEND"};function uZA(t){return t.DefaultMaterial===void 0&&(t.DefaultMaterial=new vd({color:16777215,emissive:0,metalness:1,roughness:1,transparent:!1,depthTest:!0,side:jc})),t.DefaultMaterial}function Fh(t,A,e){for(const i in e.extensions)t[i]===void 0&&(A.userData.gltfExtensions=A.userData.gltfExtensions||{},A.userData.gltfExtensions[i]=e.extensions[i])}function xl(t,A){A.extras!==void 0&&typeof A.extras=="object"&&Object.assign(t.userData,A.extras)}function hZA(t,A,e){let i=!1,g=!1,I=!1;for(let r=0,s=A.length;r<s;r++){const B=A[r];if(B.POSITION!==void 0&&(i=!0),B.NORMAL!==void 0&&(g=!0),B.COLOR_0!==void 0&&(I=!0),i&&g&&I)break}if(!i&&!g&&!I)return Promise.resolve(t);const n=[],o=[],a=[];for(let r=0,s=A.length;r<s;r++){const B=A[r];if(i){const c=B.POSITION!==void 0?e.getDependency("accessor",B.POSITION):t.attributes.position;n.push(c)}if(g){const c=B.NORMAL!==void 0?e.getDependency("accessor",B.NORMAL):t.attributes.normal;o.push(c)}if(I){const c=B.COLOR_0!==void 0?e.getDependency("accessor",B.COLOR_0):t.attributes.color;a.push(c)}}return Promise.all([Promise.all(n),Promise.all(o),Promise.all(a)]).then(function(r){const s=r[0],B=r[1],c=r[2];return i&&(t.morphAttributes.position=s),g&&(t.morphAttributes.normal=B),I&&(t.morphAttributes.color=c),t.morphTargetsRelative=!0,t})}function dZA(t,A){if(t.updateMorphTargets(),A.weights!==void 0)for(let e=0,i=A.weights.length;e<i;e++)t.morphTargetInfluences[e]=A.weights[e];if(A.extras&&Array.isArray(A.extras.targetNames)){const e=A.extras.targetNames;if(t.morphTargetInfluences.length===e.length){t.morphTargetDictionary={};for(let i=0,g=e.length;i<g;i++)t.morphTargetDictionary[e[i]]=i}}}function pZA(t){let A;const e=t.extensions&&t.extensions[$i.KHR_DRACO_MESH_COMPRESSION];if(e?A="draco:"+e.bufferView+":"+e.indices+":"+ex(e.attributes):A=t.indices+":"+ex(t.attributes)+":"+t.mode,t.targets!==void 0)for(let i=0,g=t.targets.length;i<g;i++)A+=":"+ex(t.targets[i]);return A}function ex(t){let A="";const e=Object.keys(t).sort();for(let i=0,g=e.length;i<g;i++)A+=e[i]+":"+t[e[i]]+";";return A}function PY(t){switch(t){case Int8Array:return 1/127;case Uint8Array:return 1/255;case Int16Array:return 1/32767;case Uint16Array:return 1/65535;default:throw new Error("THREE.GLTFLoader: Unsupported normalized accessor component type.")}}function fZA(t){return t.search(/\.jpe?g($|\?)/i)>0||t.search(/^data\:image\/jpeg/)===0?"image/jpeg":t.search(/\.webp($|\?)/i)>0||t.search(/^data\:image\/webp/)===0?"image/webp":"image/png"}const DZA=new Ai;class yZA{constructor(A={},e={}){this.json=A,this.extensions={},this.plugins={},this.options=e,this.cache=new O5A,this.associations=new Map,this.primitiveCache={},this.nodeCache={},this.meshCache={refs:{},uses:{}},this.cameraCache={refs:{},uses:{}},this.lightCache={refs:{},uses:{}},this.sourceCache={},this.textureCache={},this.nodeNamesUsed={};let i=!1,g=!1,I=-1;typeof navigator<"u"&&typeof navigator.userAgent<"u"&&(i=/^((?!chrome|android).)*safari/i.test(navigator.userAgent)===!0,g=navigator.userAgent.indexOf("Firefox")>-1,I=g?navigator.userAgent.match(/Firefox\/([0-9]+)\./)[1]:-1),typeof createImageBitmap>"u"||i||g&&I<98?this.textureLoader=new toA(this.options.manager):this.textureLoader=new soA(this.options.manager),this.textureLoader.setCrossOrigin(this.options.crossOrigin),this.textureLoader.setRequestHeader(this.options.requestHeader),this.fileLoader=new Es(this.options.manager),this.fileLoader.setResponseType("arraybuffer"),this.options.crossOrigin==="use-credentials"&&this.fileLoader.setWithCredentials(!0)}setExtensions(A){this.extensions=A}setPlugins(A){this.plugins=A}parse(A,e){const i=this,g=this.json,I=this.extensions;this.cache.removeAll(),this.nodeCache={},this._invokeAll(function(n){return n._markDefs&&n._markDefs()}),Promise.all(this._invokeAll(function(n){return n.beforeRoot&&n.beforeRoot()})).then(function(){return Promise.all([i.getDependencies("scene"),i.getDependencies("animation"),i.getDependencies("camera")])}).then(function(n){const o={scene:n[0][g.scene||0],scenes:n[0],animations:n[1],cameras:n[2],asset:g.asset,parser:i,userData:{}};return Fh(I,o,g),xl(o,g),Promise.all(i._invokeAll(function(a){return a.afterRoot&&a.afterRoot(o)})).then(function(){for(const a of o.scenes)a.updateMatrixWorld();A(o)})}).catch(e)}_markDefs(){const A=this.json.nodes||[],e=this.json.skins||[],i=this.json.meshes||[];for(let g=0,I=e.length;g<I;g++){const n=e[g].joints;for(let o=0,a=n.length;o<a;o++)A[n[o]].isBone=!0}for(let g=0,I=A.length;g<I;g++){const n=A[g];n.mesh!==void 0&&(this._addNodeRef(this.meshCache,n.mesh),n.skin!==void 0&&(i[n.mesh].isSkinnedMesh=!0)),n.camera!==void 0&&this._addNodeRef(this.cameraCache,n.camera)}}_addNodeRef(A,e){e!==void 0&&(A.refs[e]===void 0&&(A.refs[e]=A.uses[e]=0),A.refs[e]++)}_getNodeRef(A,e,i){if(A.refs[e]<=1)return i;const g=i.clone(),I=(n,o)=>{const a=this.associations.get(n);a!=null&&this.associations.set(o,a);for(const[r,s]of n.children.entries())I(s,o.children[r])};return I(i,g),g.name+="_instance_"+A.uses[e]++,g}_invokeOne(A){const e=Object.values(this.plugins);e.push(this);for(let i=0;i<e.length;i++){const g=A(e[i]);if(g)return g}return null}_invokeAll(A){const e=Object.values(this.plugins);e.unshift(this);const i=[];for(let g=0;g<e.length;g++){const I=A(e[g]);I&&i.push(I)}return i}getDependency(A,e){const i=A+":"+e;let g=this.cache.get(i);if(!g){switch(A){case"scene":g=this.loadScene(e);break;case"node":g=this._invokeOne(function(I){return I.loadNode&&I.loadNode(e)});break;case"mesh":g=this._invokeOne(function(I){return I.loadMesh&&I.loadMesh(e)});break;case"accessor":g=this.loadAccessor(e);break;case"bufferView":g=this._invokeOne(function(I){return I.loadBufferView&&I.loadBufferView(e)});break;case"buffer":g=this.loadBuffer(e);break;case"material":g=this._invokeOne(function(I){return I.loadMaterial&&I.loadMaterial(e)});break;case"texture":g=this._invokeOne(function(I){return I.loadTexture&&I.loadTexture(e)});break;case"skin":g=this.loadSkin(e);break;case"animation":g=this._invokeOne(function(I){return I.loadAnimation&&I.loadAnimation(e)});break;case"camera":g=this.loadCamera(e);break;default:if(g=this._invokeOne(function(I){return I!=this&&I.getDependency&&I.getDependency(A,e)}),!g)throw new Error("Unknown type: "+A);break}this.cache.add(i,g)}return g}getDependencies(A){let e=this.cache.get(A);if(!e){const i=this,g=this.json[A+(A==="mesh"?"es":"s")]||[];e=Promise.all(g.map(function(I,n){return i.getDependency(A,n)})),this.cache.add(A,e)}return e}loadBuffer(A){const e=this.json.buffers[A],i=this.fileLoader;if(e.type&&e.type!=="arraybuffer")throw new Error("THREE.GLTFLoader: "+e.type+" buffer type is not supported.");if(e.uri===void 0&&A===0)return Promise.resolve(this.extensions[$i.KHR_BINARY_GLTF].body);const g=this.options;return new Promise(function(I,n){i.load(OE.resolveURL(e.uri,g.path),I,void 0,function(){n(new Error('THREE.GLTFLoader: Failed to load buffer "'+e.uri+'".'))})})}loadBufferView(A){const e=this.json.bufferViews[A];return this.getDependency("buffer",e.buffer).then(function(i){const g=e.byteLength||0,I=e.byteOffset||0;return i.slice(I,I+g)})}loadAccessor(A){const e=this,i=this.json,g=this.json.accessors[A];if(g.bufferView===void 0&&g.sparse===void 0){const n=$q[g.type],o=LD[g.componentType],a=g.normalized===!0,r=new o(g.count*n);return Promise.resolve(new eg(r,n,a))}const I=[];return g.bufferView!==void 0?I.push(this.getDependency("bufferView",g.bufferView)):I.push(null),g.sparse!==void 0&&(I.push(this.getDependency("bufferView",g.sparse.indices.bufferView)),I.push(this.getDependency("bufferView",g.sparse.values.bufferView))),Promise.all(I).then(function(n){const o=n[0],a=$q[g.type],r=LD[g.componentType],s=r.BYTES_PER_ELEMENT,B=s*a,c=g.byteOffset||0,E=g.bufferView!==void 0?i.bufferViews[g.bufferView].byteStride:void 0,D=g.normalized===!0;let y,S;if(E&&E!==B){const f=Math.floor(c/E),M="InterleavedBuffer:"+g.bufferView+":"+g.componentType+":"+f+":"+g.count;let k=e.cache.get(M);k||(y=new r(o,f*E,g.count*E/s),k=new Xk(y,E/s),e.cache.add(M,k)),S=new Bu(k,a,c%E/s,D)}else o===null?y=new r(g.count*a):y=new r(o,c,g.count*a),S=new eg(y,a,D);if(g.sparse!==void 0){const f=$q.SCALAR,M=LD[g.sparse.indices.componentType],k=g.sparse.indices.byteOffset||0,m=g.sparse.values.byteOffset||0,U=new M(n[1],k,g.sparse.count*f),F=new r(n[2],m,g.sparse.count*a);o!==null&&(S=new eg(S.array.slice(),S.itemSize,S.normalized));for(let b=0,K=U.length;b<K;b++){const R=U[b];if(S.setX(R,F[b*a]),a>=2&&S.setY(R,F[b*a+1]),a>=3&&S.setZ(R,F[b*a+2]),a>=4&&S.setW(R,F[b*a+3]),a>=5)throw new Error("THREE.GLTFLoader: Unsupported itemSize in sparse BufferAttribute.")}}return S})}loadTexture(A){const e=this.json,i=this.options,I=e.textures[A].source,n=e.images[I];let o=this.textureLoader;if(n.uri){const a=i.manager.getHandler(n.uri);a!==null&&(o=a)}return this.loadTextureImage(A,I,o)}loadTextureImage(A,e,i){const g=this,I=this.json,n=I.textures[A],o=I.images[e],a=(o.uri||o.bufferView)+":"+n.sampler;if(this.textureCache[a])return this.textureCache[a];const r=this.loadImageSource(e,i).then(function(s){s.flipY=!1,s.name=n.name||o.name||"",s.name===""&&typeof o.uri=="string"&&o.uri.startsWith("data:image/")===!1&&(s.name=o.uri);const c=(I.samplers||{})[n.sampler]||{};return s.magFilter=L9[c.magFilter]||HI,s.minFilter=L9[c.minFilter]||oC,s.wrapS=q9[c.wrapS]||su,s.wrapT=q9[c.wrapT]||su,g.associations.set(s,{textures:A}),s}).catch(function(){return null});return this.textureCache[a]=r,r}loadImageSource(A,e){const i=this,g=this.json,I=this.options;if(this.sourceCache[A]!==void 0)return this.sourceCache[A].then(B=>B.clone());const n=g.images[A],o=self.URL||self.webkitURL;let a=n.uri||"",r=!1;if(n.bufferView!==void 0)a=i.getDependency("bufferView",n.bufferView).then(function(B){r=!0;const c=new Blob([B],{type:n.mimeType});return a=o.createObjectURL(c),a});else if(n.uri===void 0)throw new Error("THREE.GLTFLoader: Image "+A+" is missing URI and bufferView");const s=Promise.resolve(a).then(function(B){return new Promise(function(c,E){let D=c;e.isImageBitmapLoader===!0&&(D=function(y){const S=new FI(y);S.needsUpdate=!0,c(S)}),e.load(OE.resolveURL(B,I.path),D,void 0,E)})}).then(function(B){return r===!0&&o.revokeObjectURL(a),xl(B,n),B.userData.mimeType=n.mimeType||fZA(n.uri),B}).catch(function(B){throw B});return this.sourceCache[A]=s,s}assignTexture(A,e,i,g){const I=this;return this.getDependency("texture",i.index).then(function(n){if(!n)return null;if(i.texCoord!==void 0&&i.texCoord>0&&(n=n.clone(),n.channel=i.texCoord),I.extensions[$i.KHR_TEXTURE_TRANSFORM]){const o=i.extensions!==void 0?i.extensions[$i.KHR_TEXTURE_TRANSFORM]:void 0;if(o){const a=I.associations.get(n);n=I.extensions[$i.KHR_TEXTURE_TRANSFORM].extendTexture(n,o),I.associations.set(n,a)}}return g!==void 0&&(typeof g=="number"&&(g=g===_9?td:rQ),"colorSpace"in n?n.colorSpace=g:n.encoding=g===td?_9:H5A),A[e]=n,n})}assignFinalMaterial(A){const e=A.geometry;let i=A.material;const g=e.attributes.tangent===void 0,I=e.attributes.color!==void 0,n=e.attributes.normal===void 0;if(A.isPoints){const o="PointsMaterial:"+i.uuid;let a=this.cache.get(o);a||(a=new Vb,Wn.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,a.sizeAttenuation=!1,this.cache.add(o,a)),i=a}else if(A.isLine){const o="LineBasicMaterial:"+i.uuid;let a=this.cache.get(o);a||(a=new ya,Wn.prototype.copy.call(a,i),a.color.copy(i.color),a.map=i.map,this.cache.add(o,a)),i=a}if(g||I||n){let o="ClonedMaterial:"+i.uuid+":";g&&(o+="derivative-tangents:"),I&&(o+="vertex-colors:"),n&&(o+="flat-shading:");let a=this.cache.get(o);a||(a=i.clone(),I&&(a.vertexColors=!0),n&&(a.flatShading=!0),g&&(a.normalScale&&(a.normalScale.y*=-1),a.clearcoatNormalScale&&(a.clearcoatNormalScale.y*=-1)),this.cache.add(o,a),this.associations.set(a,this.associations.get(i))),i=a}A.material=i}getMaterialType(){return vd}loadMaterial(A){const e=this,i=this.json,g=this.extensions,I=i.materials[A];let n;const o={},a=I.extensions||{},r=[];if(a[$i.KHR_MATERIALS_UNLIT]){const B=g[$i.KHR_MATERIALS_UNLIT];n=B.getMaterialType(),r.push(B.extendParams(o,I,e))}else{const B=I.pbrMetallicRoughness||{};if(o.color=new wt(1,1,1),o.opacity=1,Array.isArray(B.baseColorFactor)){const c=B.baseColorFactor;o.color.setRGB(c[0],c[1],c[2],rQ),o.opacity=c[3]}B.baseColorTexture!==void 0&&r.push(e.assignTexture(o,"map",B.baseColorTexture,td)),o.metalness=B.metallicFactor!==void 0?B.metallicFactor:1,o.roughness=B.roughnessFactor!==void 0?B.roughnessFactor:1,B.metallicRoughnessTexture!==void 0&&(r.push(e.assignTexture(o,"metalnessMap",B.metallicRoughnessTexture)),r.push(e.assignTexture(o,"roughnessMap",B.metallicRoughnessTexture))),n=this._invokeOne(function(c){return c.getMaterialType&&c.getMaterialType(A)}),r.push(Promise.all(this._invokeAll(function(c){return c.extendMaterialParams&&c.extendMaterialParams(A,o)})))}I.doubleSided===!0&&(o.side=sB);const s=I.alphaMode||Ax.OPAQUE;if(s===Ax.BLEND?(o.transparent=!0,o.depthWrite=!1):(o.transparent=!1,s===Ax.MASK&&(o.alphaTest=I.alphaCutoff!==void 0?I.alphaCutoff:.5)),I.normalTexture!==void 0&&n!==ls&&(r.push(e.assignTexture(o,"normalMap",I.normalTexture)),o.normalScale=new Ze(1,1),I.normalTexture.scale!==void 0)){const B=I.normalTexture.scale;o.normalScale.set(B,B)}if(I.occlusionTexture!==void 0&&n!==ls&&(r.push(e.assignTexture(o,"aoMap",I.occlusionTexture)),I.occlusionTexture.strength!==void 0&&(o.aoMapIntensity=I.occlusionTexture.strength)),I.emissiveFactor!==void 0&&n!==ls){const B=I.emissiveFactor;o.emissive=new wt().setRGB(B[0],B[1],B[2],rQ)}return I.emissiveTexture!==void 0&&n!==ls&&r.push(e.assignTexture(o,"emissiveMap",I.emissiveTexture,td)),Promise.all(r).then(function(){const B=new n(o);return I.name&&(B.name=I.name),xl(B,I),e.associations.set(B,{materials:A}),I.extensions&&Fh(g,B,I),B})}createUniqueName(A){const e=dg.sanitizeNodeName(A||"");return e in this.nodeNamesUsed?e+"_"+ ++this.nodeNamesUsed[e]:(this.nodeNamesUsed[e]=0,e)}loadGeometries(A){const e=this,i=this.extensions,g=this.primitiveCache;function I(o){return i[$i.KHR_DRACO_MESH_COMPRESSION].decodePrimitive(o,e).then(function(a){return x9(a,o,e)})}const n=[];for(let o=0,a=A.length;o<a;o++){const r=A[o],s=pZA(r),B=g[s];if(B)n.push(B.promise);else{let c;r.extensions&&r.extensions[$i.KHR_DRACO_MESH_COMPRESSION]?c=I(r):c=x9(new fi,r,e),g[s]={primitive:r,promise:c},n.push(c)}}return Promise.all(n)}loadMesh(A){const e=this,i=this.json,g=this.extensions,I=i.meshes[A],n=I.primitives,o=[];for(let a=0,r=n.length;a<r;a++){const s=n[a].material===void 0?uZA(this.cache):this.getDependency("material",n[a].material);o.push(s)}return o.push(e.loadGeometries(n)),Promise.all(o).then(function(a){const r=a.slice(0,a.length-1),s=a[a.length-1],B=[];for(let E=0,D=s.length;E<D;E++){const y=s[E],S=n[E];let f;const M=r[E];if(S.mode===Ws.TRIANGLES||S.mode===Ws.TRIANGLE_STRIP||S.mode===Ws.TRIANGLE_FAN||S.mode===void 0)f=I.isSkinnedMesh===!0?new n1(y,M):new Cn(y,M),f.isSkinnedMesh===!0&&f.normalizeSkinWeights(),S.mode===Ws.TRIANGLE_STRIP?f.geometry=v9(f.geometry,zP):S.mode===Ws.TRIANGLE_FAN&&(f.geometry=v9(f.geometry,VK));else if(S.mode===Ws.LINES)f=new RB(y,M);else if(S.mode===Ws.LINE_STRIP)f=new mQ(y,M);else if(S.mode===Ws.LINE_LOOP)f=new a1(y,M);else if(S.mode===Ws.POINTS)f=new r1(y,M);else throw new Error("THREE.GLTFLoader: Primitive mode unsupported: "+S.mode);Object.keys(f.geometry.morphAttributes).length>0&&dZA(f,I),f.name=e.createUniqueName(I.name||"mesh_"+A),xl(f,I),S.extensions&&Fh(g,f,S),e.assignFinalMaterial(f),B.push(f)}for(let E=0,D=B.length;E<D;E++)e.associations.set(B[E],{meshes:A,primitives:E});if(B.length===1)return I.extensions&&Fh(g,B[0],I),B[0];const c=new $l;I.extensions&&Fh(g,c,I),e.associations.set(c,{meshes:A});for(let E=0,D=B.length;E<D;E++)c.add(B[E]);return c})}loadCamera(A){let e;const i=this.json.cameras[A],g=i[i.type];if(g)return i.type==="perspective"?e=new jn($P.radToDeg(g.yfov),g.aspectRatio||1,g.znear||1,g.zfar||2e6):i.type==="orthographic"&&(e=new IS(-g.xmag,g.xmag,g.ymag,-g.ymag,g.znear,g.zfar)),i.name&&(e.name=this.createUniqueName(i.name)),xl(e,i),Promise.resolve(e)}loadSkin(A){const e=this.json.skins[A],i=[];for(let g=0,I=e.joints.length;g<I;g++)i.push(this._loadNodeShallow(e.joints[g]));return e.inverseBindMatrices!==void 0?i.push(this.getDependency("accessor",e.inverseBindMatrices)):i.push(null),Promise.all(i).then(function(g){const I=g.pop(),n=g,o=[],a=[];for(let r=0,s=n.length;r<s;r++){const B=n[r];if(B){o.push(B);const c=new Ai;I!==null&&c.fromArray(I.array,r*16),a.push(c)}}return new $k(o,a)})}loadAnimation(A){const e=this.json,i=this,g=e.animations[A],I=g.name?g.name:"animation_"+A,n=[],o=[],a=[],r=[],s=[];for(let B=0,c=g.channels.length;B<c;B++){const E=g.channels[B],D=g.samplers[E.sampler],y=E.target,S=y.node,f=g.parameters!==void 0?g.parameters[D.input]:D.input,M=g.parameters!==void 0?g.parameters[D.output]:D.output;y.node!==void 0&&(n.push(this.getDependency("node",S)),o.push(this.getDependency("accessor",f)),a.push(this.getDependency("accessor",M)),r.push(D),s.push(y))}return Promise.all([Promise.all(n),Promise.all(o),Promise.all(a),Promise.all(r),Promise.all(s)]).then(function(B){const c=B[0],E=B[1],D=B[2],y=B[3],S=B[4],f=[];for(let M=0,k=c.length;M<k;M++){const m=c[M],U=E[M],F=D[M],b=y[M],K=S[M];if(m===void 0)continue;m.updateMatrix&&m.updateMatrix();const R=i._createAnimationTracks(m,U,F,b,K);if(R)for(let G=0;G<R.length;G++)f.push(R[G])}return new Sy(I,void 0,f)})}createNodeMesh(A){const e=this.json,i=this,g=e.nodes[A];return g.mesh===void 0?null:i.getDependency("mesh",g.mesh).then(function(I){const n=i._getNodeRef(i.meshCache,g.mesh,I);return g.weights!==void 0&&n.traverse(function(o){if(o.isMesh)for(let a=0,r=g.weights.length;a<r;a++)o.morphTargetInfluences[a]=g.weights[a]}),n})}loadNode(A){const e=this.json,i=this,g=e.nodes[A],I=i._loadNodeShallow(A),n=[],o=g.children||[];for(let r=0,s=o.length;r<s;r++)n.push(i.getDependency("node",o[r]));const a=g.skin===void 0?Promise.resolve(null):i.getDependency("skin",g.skin);return Promise.all([I,Promise.all(n),a]).then(function(r){const s=r[0],B=r[1],c=r[2];c!==null&&s.traverse(function(E){E.isSkinnedMesh&&E.bind(c,DZA)});for(let E=0,D=B.length;E<D;E++)s.add(B[E]);return s})}_loadNodeShallow(A){const e=this.json,i=this.extensions,g=this;if(this.nodeCache[A]!==void 0)return this.nodeCache[A];const I=e.nodes[A],n=I.name?g.createUniqueName(I.name):"",o=[],a=g._invokeOne(function(r){return r.createNodeMesh&&r.createNodeMesh(A)});return a&&o.push(a),I.camera!==void 0&&o.push(g.getDependency("camera",I.camera).then(function(r){return g._getNodeRef(g.cameraCache,I.camera,r)})),g._invokeAll(function(r){return r.createNodeAttachment&&r.createNodeAttachment(A)}).forEach(function(r){o.push(r)}),this.nodeCache[A]=Promise.all(o).then(function(r){let s;if(I.isBone===!0?s=new Wb:r.length>1?s=new $l:r.length===1?s=r[0]:s=new ng,s!==r[0])for(let B=0,c=r.length;B<c;B++)s.add(r[B]);if(I.name&&(s.userData.name=I.name,s.name=n),xl(s,I),I.extensions&&Fh(i,s,I),I.matrix!==void 0){const B=new Ai;B.fromArray(I.matrix),s.applyMatrix4(B)}else I.translation!==void 0&&s.position.fromArray(I.translation),I.rotation!==void 0&&s.quaternion.fromArray(I.rotation),I.scale!==void 0&&s.scale.fromArray(I.scale);return g.associations.has(s)||g.associations.set(s,{}),g.associations.get(s).nodes=A,s}),this.nodeCache[A]}loadScene(A){const e=this.extensions,i=this.json.scenes[A],g=this,I=new $l;i.name&&(I.name=g.createUniqueName(i.name)),xl(I,i),i.extensions&&Fh(e,I,i);const n=i.nodes||[],o=[];for(let a=0,r=n.length;a<r;a++)o.push(g.getDependency("node",n[a]));return Promise.all(o).then(function(a){for(let s=0,B=a.length;s<B;s++)I.add(a[s]);const r=s=>{const B=new Map;for(const[c,E]of g.associations)(c instanceof Wn||c instanceof FI)&&B.set(c,E);return s.traverse(c=>{const E=g.associations.get(c);E!=null&&B.set(c,E)}),B};return g.associations=r(I),I})}_createAnimationTracks(A,e,i,g,I){const n=[],o=A.name?A.name:A.uuid,a=[];pE[I.path]===pE.weights?A.traverse(function(c){c.morphTargetInfluences&&a.push(c.name?c.name:c.uuid)}):a.push(o);let r;switch(pE[I.path]){case pE.weights:r=_d;break;case pE.rotation:r=Jd;break;case pE.position:case pE.scale:r=Ld;break;default:switch(i.itemSize){case 1:r=_d;break;case 2:case 3:default:r=Ld;break}break}const s=g.interpolation!==void 0?EZA[g.interpolation]:hy,B=this._getArrayFromAccessor(i);for(let c=0,E=a.length;c<E;c++){const D=new r(a[c]+"."+pE[I.path],e.array,B,s);g.interpolation==="CUBICSPLINE"&&this._createCubicSplineTrackInterpolant(D),n.push(D)}return n}_getArrayFromAccessor(A){let e=A.array;if(A.normalized){const i=PY(e.constructor),g=new Float32Array(e.length);for(let I=0,n=e.length;I<n;I++)g[I]=e[I]*i;e=g}return e}_createCubicSplineTrackInterpolant(A){A.createInterpolant=function(i){const g=this instanceof Jd?QZA:ZoA;return new g(this.times,this.values,this.getValueSize()/3,i)},A.createInterpolant.isInterpolantFactoryMethodGLTFCubicSpline=!0}}function SZA(t,A,e){const i=A.attributes,g=new Zo;if(i.POSITION!==void 0){const o=e.json.accessors[i.POSITION],a=o.min,r=o.max;if(a!==void 0&&r!==void 0){if(g.set(new wA(a[0],a[1],a[2]),new wA(r[0],r[1],r[2])),o.normalized){const s=PY(LD[o.componentType]);g.min.multiplyScalar(s),g.max.multiplyScalar(s)}}else return}else return;const I=A.targets;if(I!==void 0){const o=new wA,a=new wA;for(let r=0,s=I.length;r<s;r++){const B=I[r];if(B.POSITION!==void 0){const c=e.json.accessors[B.POSITION],E=c.min,D=c.max;if(E!==void 0&&D!==void 0){if(a.setX(Math.max(Math.abs(E[0]),Math.abs(D[0]))),a.setY(Math.max(Math.abs(E[1]),Math.abs(D[1]))),a.setZ(Math.max(Math.abs(E[2]),Math.abs(D[2]))),c.normalized){const y=PY(LD[c.componentType]);a.multiplyScalar(y)}o.max(a)}}}g.expandByVector(o)}t.boundingBox=g;const n=new po;g.getCenter(n.center),n.radius=g.min.distanceTo(g.max)/2,t.boundingSphere=n}function x9(t,A,e){const i=A.attributes,g=[];function I(n,o){return e.getDependency("accessor",n).then(function(a){t.setAttribute(o,a)})}for(const n in i){const o=OY[n]||n.toLowerCase();o in t.attributes||g.push(I(i[n],o))}if(A.indices!==void 0&&!t.index){const n=e.getDependency("accessor",A.indices).then(function(o){t.setIndex(o)});g.push(n)}return xl(t,A),SZA(t,A,e),Promise.all(g).then(function(){return A.targets!==void 0?hZA(t,A.targets,e):t})}const tx=new WeakMap;class wZA extends Sa{constructor(A){super(A),this.decoderPath="",this.decoderConfig={},this.decoderBinary=null,this.decoderPending=null,this.workerLimit=4,this.workerPool=[],this.workerNextTaskID=1,this.workerSourceURL="",this.defaultAttributeIDs={position:"POSITION",normal:"NORMAL",color:"COLOR",uv:"TEX_COORD"},this.defaultAttributeTypes={position:"Float32Array",normal:"Float32Array",color:"Float32Array",uv:"Float32Array"}}setDecoderPath(A){return this.decoderPath=A,this}setDecoderConfig(A){return this.decoderConfig=A,this}setWorkerLimit(A){return this.workerLimit=A,this}load(A,e,i,g){const I=new Es(this.manager);I.setPath(this.path),I.setResponseType("arraybuffer"),I.setRequestHeader(this.requestHeader),I.setWithCredentials(this.withCredentials),I.load(A,n=>{const o={attributeIDs:this.defaultAttributeIDs,attributeTypes:this.defaultAttributeTypes,useUniqueIDs:!1};this.decodeGeometry(n,o).then(e).catch(g)},i,g)}decodeDracoFile(A,e,i,g){const I={attributeIDs:i||this.defaultAttributeIDs,attributeTypes:g||this.defaultAttributeTypes,useUniqueIDs:!!i};this.decodeGeometry(A,I).then(e)}decodeGeometry(A,e){for(const a in e.attributeTypes){const r=e.attributeTypes[a];r.BYTES_PER_ELEMENT!==void 0&&(e.attributeTypes[a]=r.name)}const i=JSON.stringify(e);if(tx.has(A)){const a=tx.get(A);if(a.key===i)return a.promise;if(A.byteLength===0)throw new Error("THREE.DRACOLoader: Unable to re-decode a buffer with different settings. Buffer has already been transferred.")}let g;const I=this.workerNextTaskID++,n=A.byteLength,o=this._getWorker(I,n).then(a=>(g=a,new Promise((r,s)=>{g._callbacks[I]={resolve:r,reject:s},g.postMessage({type:"decode",id:I,taskConfig:e,buffer:A},[A])}))).then(a=>this._createGeometry(a.geometry));return o.catch(()=>!0).then(()=>{g&&I&&this._releaseTask(g,I)}),tx.set(A,{key:i,promise:o}),o}_createGeometry(A){const e=new fi;A.index&&e.setIndex(new eg(A.index.array,1));for(let i=0;i<A.attributes.length;i++){const g=A.attributes[i],I=g.name,n=g.array,o=g.itemSize;e.setAttribute(I,new eg(n,o))}return e}_loadLibrary(A,e){const i=new Es(this.manager);return i.setPath(this.decoderPath),i.setResponseType(e),i.setWithCredentials(this.withCredentials),new Promise((g,I)=>{i.load(A,g,void 0,I)})}preload(){return this._initDecoder(),this}_initDecoder(){if(this.decoderPending)return this.decoderPending;const A=typeof WebAssembly!="object"||this.decoderConfig.type==="js",e=[];return A?e.push(this._loadLibrary("draco_decoder.js","text")):(e.push(this._loadLibrary("draco_wasm_wrapper.js","text")),e.push(this._loadLibrary("draco_decoder.wasm","arraybuffer"))),this.decoderPending=Promise.all(e).then(i=>{const g=i[0];A||(this.decoderConfig.wasmBinary=i[1]);const I=mZA.toString(),n=["/* draco decoder */",g,"","/* worker */",I.substring(I.indexOf("{")+1,I.lastIndexOf("}"))].join(`
`);this.workerSourceURL=URL.createObjectURL(new Blob([n]))}),this.decoderPending}_getWorker(A,e){return this._initDecoder().then(()=>{if(this.workerPool.length<this.workerLimit){const g=new Worker(this.workerSourceURL);g._callbacks={},g._taskCosts={},g._taskLoad=0,g.postMessage({type:"init",decoderConfig:this.decoderConfig}),g.onmessage=function(I){const n=I.data;switch(n.type){case"decode":g._callbacks[n.id].resolve(n);break;case"error":g._callbacks[n.id].reject(n);break;default:}},this.workerPool.push(g)}else this.workerPool.sort(function(g,I){return g._taskLoad>I._taskLoad?-1:1});const i=this.workerPool[this.workerPool.length-1];return i._taskCosts[A]=e,i._taskLoad+=e,i})}_releaseTask(A,e){A._taskLoad-=A._taskCosts[e],delete A._callbacks[e],delete A._taskCosts[e]}debug(){}dispose(){for(let A=0;A<this.workerPool.length;++A)this.workerPool[A].terminate();return this.workerPool.length=0,this}}function mZA(){let t,A;onmessage=function(n){const o=n.data;switch(o.type){case"init":t=o.decoderConfig,A=new Promise(function(s){t.onModuleLoaded=function(B){s({draco:B})},DracoDecoderModule(t)});break;case"decode":const a=o.buffer,r=o.taskConfig;A.then(s=>{const B=s.draco,c=new B.Decoder,E=new B.DecoderBuffer;E.Init(new Int8Array(a),a.byteLength);try{const D=e(B,c,E,r),y=D.attributes.map(S=>S.array.buffer);D.index&&y.push(D.index.array.buffer),self.postMessage({type:"decode",id:o.id,geometry:D},y)}catch(D){self.postMessage({type:"error",id:o.id,error:D.message})}finally{B.destroy(E),B.destroy(c)}});break}};function e(n,o,a,r){const s=r.attributeIDs,B=r.attributeTypes;let c,E;const D=o.GetEncodedGeometryType(a);if(D===n.TRIANGULAR_MESH)c=new n.Mesh,E=o.DecodeBufferToMesh(a,c);else if(D===n.POINT_CLOUD)c=new n.PointCloud,E=o.DecodeBufferToPointCloud(a,c);else throw new Error("THREE.DRACOLoader: Unexpected geometry type.");if(!E.ok()||c.ptr===0)throw new Error("THREE.DRACOLoader: Decoding failed: "+E.error_msg());const y={index:null,attributes:[]};for(const S in s){const f=self[B[S]];let M,k;if(r.useUniqueIDs)k=s[S],M=o.GetAttributeByUniqueId(c,k);else{if(k=o.GetAttributeId(c,n[s[S]]),k===-1)continue;M=o.GetAttribute(c,k)}y.attributes.push(g(n,o,c,S,f,M))}return D===n.TRIANGULAR_MESH&&(y.index=i(n,o,c)),n.destroy(c),y}function i(n,o,a){const s=a.num_faces()*3,B=s*4,c=n._malloc(B);o.GetTrianglesUInt32Array(a,B,c);const E=new Uint32Array(n.HEAPF32.buffer,c,s).slice();return n._free(c),{array:E,itemSize:1}}function g(n,o,a,r,s,B){const c=B.num_components(),D=a.num_points()*c,y=D*s.BYTES_PER_ELEMENT,S=I(n,s),f=n._malloc(y);o.GetAttributeDataArrayForAllPoints(a,B,S,y,f);const M=new s(n.HEAPF32.buffer,f,D).slice();return n._free(f),{name:r,array:M,itemSize:c}}function I(n,o){switch(o){case Float32Array:return n.DT_FLOAT32;case Int8Array:return n.DT_INT8;case Int16Array:return n.DT_INT16;case Int32Array:return n.DT_INT32;case Uint8Array:return n.DT_UINT8;case Uint16Array:return n.DT_UINT16;case Uint32Array:return n.DT_UINT32}}}let OG;const ix=()=>{if(OG)return OG;const t=" ",A=" ",e=new Uint8Array([0,97,115,109,1,0,0,0,1,4,1,96,0,0,3,3,2,0,0,5,3,1,0,1,12,1,0,10,22,2,12,0,65,0,65,0,65,0,252,10,0,0,11,7,0,65,0,253,15,26,11]),i=new Uint8Array([32,0,65,253,3,1,2,34,4,106,6,5,11,8,7,20,13,33,12,16,128,9,116,64,19,113,127,15,10,21,22,14,255,66,24,54,136,107,18,23,192,26,114,118,132,17,77,101,130,144,27,87,131,44,45,74,156,154,70,167]);if(typeof WebAssembly!="object")return{supported:!1};let g=t;WebAssembly.validate(e)&&(g=A);let I;const n=WebAssembly.instantiate(o(g),{}).then(B=>{I=B.instance,I.exports.__wasm_call_ctors()});function o(B){const c=new Uint8Array(B.length);for(let D=0;D<B.length;++D){const y=B.charCodeAt(D);c[D]=y>96?y-71:y>64?y-65:y>47?y+4:y>46?63:62}let E=0;for(let D=0;D<B.length;++D)c[E++]=c[D]<60?i[c[D]]:(c[D]-60)*64+c[++D];return c.buffer.slice(0,E)}function a(B,c,E,D,y,S){const f=I.exports.sbrk,M=E+3&-4,k=f(M*D),m=f(y.length),U=new Uint8Array(I.exports.memory.buffer);U.set(y,m);const F=B(k,E,D,m,y.length);if(F===0&&S&&S(k,M,D),c.set(U.subarray(k,k+E*D)),f(k-f(0)),F!==0)throw new Error(`Malformed buffer data: ${F}`)}const r={0:"",1:"meshopt_decodeFilterOct",2:"meshopt_decodeFilterQuat",3:"meshopt_decodeFilterExp",NONE:"",OCTAHEDRAL:"meshopt_decodeFilterOct",QUATERNION:"meshopt_decodeFilterQuat",EXPONENTIAL:"meshopt_decodeFilterExp"},s={0:"meshopt_decodeVertexBuffer",1:"meshopt_decodeIndexBuffer",2:"meshopt_decodeIndexSequence",ATTRIBUTES:"meshopt_decodeVertexBuffer",TRIANGLES:"meshopt_decodeIndexBuffer",INDICES:"meshopt_decodeIndexSequence"};return OG={ready:n,supported:!0,decodeVertexBuffer(B,c,E,D,y){a(I.exports.meshopt_decodeVertexBuffer,B,c,E,D,I.exports[r[y]])},decodeIndexBuffer(B,c,E,D){a(I.exports.meshopt_decodeIndexBuffer,B,c,E,D)},decodeIndexSequence(B,c,E,D){a(I.exports.meshopt_decodeIndexSequence,B,c,E,D)},decodeGltfBuffer(B,c,E,D,y,S){a(I.exports[s[y]],B,c,E,D,I.exports[r[S]])}},OG};function kZA(t,A){if(typeof t!="object"||!t)return t;var e=t[Symbol.toPrimitive];if(e!==void 0){var i=e.call(t,A);if(typeof i!="object")return i;throw new TypeError("@@toPrimitive must return a primitive value.")}return(A==="string"?String:Number)(t)}function MZA(t){var A=kZA(t,"string");return typeof A=="symbol"?A:A+""}function NZA(t,A,e){return(A=MZA(A))in t?Object.defineProperty(t,A,{value:e,enumerable:!0,configurable:!0,writable:!0}):t[A]=e,t}function T9(t,A){var e=Object.keys(t);if(Object.getOwnPropertySymbols){var i=Object.getOwnPropertySymbols(t);A&&(i=i.filter(function(g){return Object.getOwnPropertyDescriptor(t,g).enumerable})),e.push.apply(e,i)}return e}function Pg(t){for(var A=1;A<arguments.length;A++){var e=arguments[A]!=null?arguments[A]:{};A%2?T9(Object(e),!0).forEach(function(i){NZA(t,i,e[i])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(e)):T9(Object(e)).forEach(function(i){Object.defineProperty(t,i,Object.getOwnPropertyDescriptor(e,i))})}return t}const GZA=new Kn;new Wo;const RZA=new wA;new ng;const jE=new Ai,xo=new wA,QB=new Kn,xd=new wA,UZA=t=>{const[A,e,i]=t;return new wA(A,e,i)},Y9=({x:t,y:A,z:e,w:i})=>GZA.set(t,A,e,i),KZA=t=>{if(Array.isArray(t))return new vD(t[0],t[1],t[2]);if(typeof t=="number")return new vD(t,t,t);{const A=t;return new vD(A.x,A.y,A.z)}},FZA={fixed:1,dynamic:0,kinematicPosition:2,kinematicVelocity:3},WoA=t=>FZA[t],bZA=(t,A)=>{const e=Array.from(t);for(let i=0;i<t.length/3;i++)e[i*3]*=A.x,e[i*3+1]*=A.y,e[i*3+2]*=A.z;return e},zoA=t=>t?t instanceof Kn?[t.x,t.y,t.z,t.w]:t instanceof wA||t instanceof Wo?[t.x,t.y,t.z]:Array.isArray(t)?t:[t]:[0];function fE(t){const A=p.useRef(void 0);return A.current===void 0&&(A.current={value:typeof t=="function"?t():t}),A.current.value}const vZA=t=>{const A=p.useRef(t),e=p.useRef(0),i=p.useRef(0);p.useEffect(()=>{A.current=t},[t]),p.useEffect(()=>{const g=()=>{const I=performance.now(),n=I-i.current;e.current=requestAnimationFrame(g),A.current(n/1e3),i.current=I};return e.current=requestAnimationFrame(g),()=>cancelAnimationFrame(e.current)},[])},_ZA=({onStep:t,updatePriority:A})=>(IM((e,i)=>{t(i)},A),null),JZA=({onStep:t})=>(vZA(A=>{t(A)}),null),LZA=({onStep:t,type:A,updatePriority:e})=>A==="independent"?ke.createElement(JZA,{onStep:t}):ke.createElement(_ZA,{onStep:t,updatePriority:e});var qZA=p.memo(LZA);function xZA(t,A){if(t==null)return{};var e={};for(var i in t)if({}.hasOwnProperty.call(t,i)){if(A.indexOf(i)!==-1)continue;e[i]=t[i]}return e}function oF(t,A){if(t==null)return{};var e,i,g=xZA(t,A);if(Object.getOwnPropertySymbols){var I=Object.getOwnPropertySymbols(t);for(i=0;i<I.length;i++)e=I[i],A.indexOf(e)===-1&&{}.propertyIsEnumerable.call(t,e)&&(g[e]=t[e])}return g}const TZA=["mass","linearDamping","angularDamping","type","onCollisionEnter","onCollisionExit","onIntersectionEnter","onIntersectionExit","onContactForce","children","canSleep","ccd","gravityScale","softCcdPrediction","ref"],YZA=(t,A,e)=>{const i=A.slice();if(t==="heightfield"){const I=i[3];return I.x*=e.x,I.x*=e.y,I.x*=e.z,i}if(t==="trimesh"||t==="convexHull")return i[0]=bZA(i[0],e),i;const g=[e.x,e.y,e.z,e.x,e.x];return i.map((I,n)=>g[n]*I)},HZA=(t,A,e,i)=>{const g=YZA(t.shape,t.args,e),I=zI[t.shape](...g);return A.createCollider(I,i?.())},OZA=["shape","args"],H9="Please pick ONLY ONE of the `density`, `mass` and `massProperties` options.",PZA=(t,A)=>{if(A.density!==void 0){if(A.mass!==void 0||A.massProperties!==void 0)throw new Error(H9);t.setDensity(A.density);return}if(A.mass!==void 0){if(A.massProperties!==void 0)throw new Error(H9);t.setMass(A.mass);return}A.massProperties!==void 0&&t.setMassProperties(A.massProperties.mass,A.massProperties.centerOfMass,A.massProperties.principalAngularInertia,A.massProperties.angularInertiaLocalFrame)},VoA={sensor:(t,A)=>{t.setSensor(A)},collisionGroups:(t,A)=>{t.setCollisionGroups(A)},solverGroups:(t,A)=>{t.setSolverGroups(A)},friction:(t,A)=>{t.setFriction(A)},frictionCombineRule:(t,A)=>{t.setFrictionCombineRule(A)},restitution:(t,A)=>{t.setRestitution(A)},restitutionCombineRule:(t,A)=>{t.setRestitutionCombineRule(A)},activeCollisionTypes:(t,A)=>{t.setActiveCollisionTypes(A)},contactSkin:(t,A)=>{t.setContactSkin(A)},quaternion:()=>{},position:()=>{},rotation:()=>{},scale:()=>{}},XoA=Object.keys(VoA),jZA=(t,A,e)=>{const i=e.get(t.handle);if(i){var g;const I=i.object.parent.getWorldScale(RZA),n=(g=i.worldParent)===null||g===void 0?void 0:g.matrixWorld.clone().invert();i.object.updateWorldMatrix(!0,!1),jE.copy(i.object.matrixWorld),n&&jE.premultiply(n),jE.decompose(xo,QB,xd),t.parent()?(t.setTranslationWrtParent({x:xo.x*I.x,y:xo.y*I.y,z:xo.z*I.z}),t.setRotationWrtParent(QB)):(t.setTranslation({x:xo.x*I.x,y:xo.y*I.y,z:xo.z*I.z}),t.setRotation(QB)),XoA.forEach(o=>{if(o in A){const a=A[o];VoA[o](t,a,A)}}),PZA(t,A)}},ZZA=(t,A,e)=>{const i=p.useMemo(()=>XoA.flatMap(g=>zoA(A[g])),[A]);p.useEffect(()=>{const g=t();jZA(g,A,e)},[...i,t])},WZA=t=>{let A=!1;return t.traverseAncestors(e=>{e.userData.r3RapierType==="MeshCollider"&&(A=!0)}),A},zZA=(t,A,e)=>({collider:t,worldParent:e||void 0,object:A}),VZA={cuboid:"cuboid",ball:"ball",hull:"convexHull",trimesh:"trimesh"},XZA=({object:t,ignoreMeshColliders:A=!0,options:e})=>{const i=[];t.updateWorldMatrix(!0,!1);const g=t.matrixWorld.clone().invert(),I=n=>{if("isMesh"in n){if(A&&WZA(n))return;const o=n.getWorldScale(xd),a=VZA[e.colliders||"cuboid"];n.updateWorldMatrix(!0,!1),jE.copy(n.matrixWorld).premultiply(g).decompose(xo,QB,xd);const r=new Wo().setFromQuaternion(QB,"XYZ"),{geometry:s}=n,{args:B,offset:c}=$ZA(s,e.colliders||"cuboid"),E=Pg(Pg({},AaA(e)),{},{args:B,shape:a,rotation:[r.x,r.y,r.z],position:[xo.x+c.x*o.x,xo.y+c.y*o.y,xo.z+c.z*o.z],scale:[o.x,o.y,o.z]});i.push(E)}};return e.includeInvisible?t.traverse(I):t.traverseVisible(I),i},$ZA=(t,A)=>{switch(A){case"cuboid":{t.computeBoundingBox();const{boundingBox:i}=t,g=i.getSize(new wA);return{args:[g.x/2,g.y/2,g.z/2],offset:i.getCenter(new wA)}}case"ball":{t.computeBoundingSphere();const{boundingSphere:i}=t;return{args:[i.radius],offset:i.center}}case"trimesh":{var e;const i=t.index?t.clone():Y5A(t);return{args:[i.attributes.position.array,(e=i.index)===null||e===void 0?void 0:e.array],offset:new wA}}case"hull":return{args:[t.clone().attributes.position.array],offset:new wA}}return{args:[],offset:new wA}},$oA=t=>({collision:!!(t!=null&&t.onCollisionEnter||t!=null&&t.onCollisionExit||t!=null&&t.onIntersectionEnter||t!=null&&t.onIntersectionExit),contactForce:!!(t!=null&&t.onContactForce)}),AWA=(t,A,e,i={})=>{const{onCollisionEnter:g,onCollisionExit:I,onIntersectionEnter:n,onIntersectionExit:o,onContactForce:a}=A;p.useEffect(()=>{const r=t();if(r){const{collision:s,contactForce:B}=$oA(A),c=s||i.collision,E=B||i.contactForce;c&&E?r.setActiveEvents(Xl.COLLISION_EVENTS|Xl.CONTACT_FORCE_EVENTS):c?r.setActiveEvents(Xl.COLLISION_EVENTS):E&&r.setActiveEvents(Xl.CONTACT_FORCE_EVENTS),e.set(r.handle,{onCollisionEnter:g,onCollisionExit:I,onIntersectionEnter:n,onIntersectionExit:o,onContactForce:a})}return()=>{r&&e.delete(r.handle)}},[g,I,n,o,a,i])},AaA=(t={})=>oF(t,TZA),Ev=()=>{const t=p.useContext(eaA);if(!t)throw new Error("react-three-rapier: useRapier must be used within <Physics />!");return t},J1=(t,A,e=!0)=>{const[i,g]=p.useState([]);return p.useEffect(()=>{t.current&&A.colliders!==!1&&g(XZA({object:t.current,options:A,ignoreMeshColliders:e}))},[A.colliders]),i},eWA=p.memo(()=>{const{world:t}=Ev(),A=p.useRef(null);return IM(()=>{const e=A.current;if(!e)return;const i=t.debugRender(),g=new fi;g.setAttribute("position",new eg(i.vertices,3)),g.setAttribute("color",new eg(i.colors,4)),e.geometry.dispose(),e.geometry=g}),ke.createElement("group",null,ke.createElement("lineSegments",{ref:A,frustumCulled:!1},ke.createElement("lineBasicMaterial",{color:16777215,vertexColors:!0}),ke.createElement("bufferGeometry",null)))}),tWA=t=>{let A;const e={get(n,o){return A||(A=t()),Reflect.get(A,o)},set(n,o,a){return A||(A=t()),Reflect.set(A,o,a)}};return{proxy:new Proxy({},e),reset:()=>{A=void 0},set:n=>{A=n}}},eaA=p.createContext(void 0),PG=(t,A)=>{var e,i,g,I,n,o;return{target:{rigidBody:t.rigidBody.object,collider:t.collider.object,colliderObject:(e=t.collider.state)===null||e===void 0?void 0:e.object,rigidBodyObject:(i=t.rigidBody.state)===null||i===void 0?void 0:i.object},other:{rigidBody:A.rigidBody.object,collider:A.collider.object,colliderObject:(g=A.collider.state)===null||g===void 0?void 0:g.object,rigidBodyObject:(I=A.rigidBody.state)===null||I===void 0?void 0:I.object},rigidBody:A.rigidBody.object,collider:A.collider.object,colliderObject:(n=A.collider.state)===null||n===void 0?void 0:n.object,rigidBodyObject:(o=A.rigidBody.state)===null||o===void 0?void 0:o.object}},O9=async()=>{let t=await pi(()=>Promise.resolve().then(()=>B2A),void 0,import.meta.url);return await t.init(),t},iWA=t=>{const{colliders:A="cuboid",children:e,timeStep:i=1/60,paused:g=!1,interpolate:I=!0,updatePriority:n,updateLoop:o="follow",debug:a=!1,gravity:r=[0,-9.81,0],allowedLinearError:s=.001,predictionDistance:B=.002,numSolverIterations:c=4,numAdditionalFrictionIterations:E=4,numInternalPgsIterations:D=1,minIslandSize:y=128,maxCcdSubsteps:S=1,contactNaturalFrequency:f=30,lengthUnit:M=1}=t,k=koA(O9,["@react-thee/rapier",O9]),{invalidate:m}=PE(),U=fE(()=>new Map),F=fE(()=>new Map),b=fE(()=>new Map),K=fE(()=>new Map),R=fE(()=>new qP(!1)),G=fE(()=>new Set),J=fE(()=>new Set),{proxy:x,reset:H,set:P}=fE(()=>tWA(()=>new k.World(UZA(r))));p.useEffect(()=>()=>{x.free(),H()},[]),p.useEffect(()=>{x.gravity=KZA(r),x.integrationParameters.numSolverIterations=c,x.integrationParameters.numAdditionalFrictionIterations=E,x.integrationParameters.numInternalPgsIterations=D,x.integrationParameters.normalizedAllowedLinearError=s,x.integrationParameters.minIslandSize=y,x.integrationParameters.maxCcdSubsteps=S,x.integrationParameters.normalizedPredictionDistance=B,x.lengthUnit=M,x.integrationParameters.contact_natural_frequency=f},[x,...r,c,E,D,s,y,S,B,M,f]);const j=p.useCallback(gA=>{var z;const X=x.getCollider(gA),sA=K.get(gA),rA=F.get(gA),mA=X==null||(z=X.parent())===null||z===void 0?void 0:z.handle,IA=mA!==void 0?x.getRigidBody(mA):void 0,uA=IA&&mA!==void 0?b.get(mA):void 0,KA=mA!==void 0?U.get(mA):void 0;return{collider:{object:X,events:sA,state:rA},rigidBody:{object:IA,events:uA,state:KA}}},[]),[q]=p.useState({previousState:{},accumulator:0}),Y=p.useCallback(gA=>{const z=x,X=i==="vary",sA=$P.clamp(gA,0,.5),rA=IA=>{G.forEach(uA=>{uA.current(z)}),z.timestep=IA,z.step(R),J.forEach(uA=>{uA.current(z)})};if(X)rA(sA);else for(q.accumulator+=sA;q.accumulator>=i;)I&&(q.previousState={},z.forEachRigidBody(IA=>{q.previousState[IA.handle]={position:IA.translation(),rotation:IA.rotation()}})),rA(i),q.accumulator-=i;const mA=X||!I||g?1:q.accumulator/i;U.forEach((IA,uA)=>{const KA=z.getRigidBody(uA),FA=b.get(uA);if(FA!=null&&FA.onSleep||FA!=null&&FA.onWake){if(KA.isSleeping()&&!IA.isSleeping){var RA;FA==null||(RA=FA.onSleep)===null||RA===void 0||RA.call(FA)}if(!KA.isSleeping()&&IA.isSleeping){var MA;FA==null||(MA=FA.onWake)===null||MA===void 0||MA.call(FA)}IA.isSleeping=KA.isSleeping()}if(!KA||KA.isSleeping()&&!("isInstancedMesh"in IA.object)||!IA.setMatrix)return;let oA=KA.translation(),AA=KA.rotation(),tA=q.previousState[uA];tA&&(jE.compose(tA.position,Y9(tA.rotation),IA.scale).premultiply(IA.invertedWorldMatrix).decompose(xo,QB,xd),IA.meshType=="mesh"&&(IA.object.position.copy(xo),IA.object.quaternion.copy(QB))),jE.compose(oA,Y9(AA),IA.scale).premultiply(IA.invertedWorldMatrix).decompose(xo,QB,xd),IA.meshType=="instancedMesh"?IA.setMatrix(jE):(IA.object.position.lerp(xo,mA),IA.object.quaternion.slerp(QB,mA))}),R.drainCollisionEvents((IA,uA,KA)=>{const FA=j(IA),RA=j(uA);if(!(FA!=null&&FA.collider.object)||!(RA!=null&&RA.collider.object))return;const MA=PG(FA,RA),oA=PG(RA,FA);if(KA)z.contactPair(FA.collider.object,RA.collider.object,(he,ve)=>{var bA,pA,Re,CA,EA,yA,xA,XA;(bA=FA.rigidBody.events)===null||bA===void 0||(pA=bA.onCollisionEnter)===null||pA===void 0||pA.call(bA,Pg(Pg({},MA),{},{manifold:he,flipped:ve})),(Re=RA.rigidBody.events)===null||Re===void 0||(CA=Re.onCollisionEnter)===null||CA===void 0||CA.call(Re,Pg(Pg({},oA),{},{manifold:he,flipped:ve})),(EA=FA.collider.events)===null||EA===void 0||(yA=EA.onCollisionEnter)===null||yA===void 0||yA.call(EA,Pg(Pg({},MA),{},{manifold:he,flipped:ve})),(xA=RA.collider.events)===null||xA===void 0||(XA=xA.onCollisionEnter)===null||XA===void 0||XA.call(xA,Pg(Pg({},oA),{},{manifold:he,flipped:ve}))});else{var AA,tA,iA,hA,DA,dA,SA,NA;(AA=FA.rigidBody.events)===null||AA===void 0||(tA=AA.onCollisionExit)===null||tA===void 0||tA.call(AA,MA),(iA=RA.rigidBody.events)===null||iA===void 0||(hA=iA.onCollisionExit)===null||hA===void 0||hA.call(iA,oA),(DA=FA.collider.events)===null||DA===void 0||(dA=DA.onCollisionExit)===null||dA===void 0||dA.call(DA,MA),(SA=RA.collider.events)===null||SA===void 0||(NA=SA.onCollisionExit)===null||NA===void 0||NA.call(SA,oA)}if(KA){if(z.intersectionPair(FA.collider.object,RA.collider.object)){var OA,Qe,nA,eA,UA,HA,Se,ne;(OA=FA.rigidBody.events)===null||OA===void 0||(Qe=OA.onIntersectionEnter)===null||Qe===void 0||Qe.call(OA,MA),(nA=RA.rigidBody.events)===null||nA===void 0||(eA=nA.onIntersectionEnter)===null||eA===void 0||eA.call(nA,oA),(UA=FA.collider.events)===null||UA===void 0||(HA=UA.onIntersectionEnter)===null||HA===void 0||HA.call(UA,MA),(Se=RA.collider.events)===null||Se===void 0||(ne=Se.onIntersectionEnter)===null||ne===void 0||ne.call(Se,oA)}}else{var Oe,VA,de,te,WA,_A,zA,ge;(Oe=FA.rigidBody.events)===null||Oe===void 0||(VA=Oe.onIntersectionExit)===null||VA===void 0||VA.call(Oe,MA),(de=RA.rigidBody.events)===null||de===void 0||(te=de.onIntersectionExit)===null||te===void 0||te.call(de,oA),(WA=FA.collider.events)===null||WA===void 0||(_A=WA.onIntersectionExit)===null||_A===void 0||_A.call(WA,MA),(zA=RA.collider.events)===null||zA===void 0||(ge=zA.onIntersectionExit)===null||ge===void 0||ge.call(zA,oA)}}),R.drainContactForceEvents(IA=>{var uA,KA,FA,RA,MA,oA,AA,tA;const iA=j(IA.collider1()),hA=j(IA.collider2());if(!(iA!=null&&iA.collider.object)||!(hA!=null&&hA.collider.object))return;const DA=PG(iA,hA),dA=PG(hA,iA);(uA=iA.rigidBody.events)===null||uA===void 0||(KA=uA.onContactForce)===null||KA===void 0||KA.call(uA,Pg(Pg({},DA),{},{totalForce:IA.totalForce(),totalForceMagnitude:IA.totalForceMagnitude(),maxForceDirection:IA.maxForceDirection(),maxForceMagnitude:IA.maxForceMagnitude()})),(FA=hA.rigidBody.events)===null||FA===void 0||(RA=FA.onContactForce)===null||RA===void 0||RA.call(FA,Pg(Pg({},dA),{},{totalForce:IA.totalForce(),totalForceMagnitude:IA.totalForceMagnitude(),maxForceDirection:IA.maxForceDirection(),maxForceMagnitude:IA.maxForceMagnitude()})),(MA=iA.collider.events)===null||MA===void 0||(oA=MA.onContactForce)===null||oA===void 0||oA.call(MA,Pg(Pg({},DA),{},{totalForce:IA.totalForce(),totalForceMagnitude:IA.totalForceMagnitude(),maxForceDirection:IA.maxForceDirection(),maxForceMagnitude:IA.maxForceMagnitude()})),(AA=hA.collider.events)===null||AA===void 0||(tA=AA.onContactForce)===null||tA===void 0||tA.call(AA,Pg(Pg({},dA),{},{totalForce:IA.totalForce(),totalForceMagnitude:IA.totalForceMagnitude(),maxForceDirection:IA.maxForceDirection(),maxForceMagnitude:IA.maxForceMagnitude()}))}),z.forEachActiveRigidBody(()=>{m()})},[g,i,I,x]),O=p.useMemo(()=>({rapier:k,world:x,setWorld:gA=>{P(gA)},physicsOptions:{colliders:A,gravity:r},rigidBodyStates:U,colliderStates:F,rigidBodyEvents:b,colliderEvents:K,beforeStepCallbacks:G,afterStepCallbacks:J,isPaused:g,isDebug:a,step:Y}),[g,Y,a,A,r]),$=p.useCallback(gA=>{g||Y(gA)},[g,Y]);return ke.createElement(eaA.Provider,{value:O},ke.createElement(qZA,{onStep:$,type:o,updatePriority:n}),a&&ke.createElement(eWA,null),e)};function fo(){return fo=Object.assign?Object.assign.bind():function(t){for(var A=1;A<arguments.length;A++){var e=arguments[A];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},fo.apply(null,arguments)}const L1=(t,A=null)=>{const e=p.useRef(A);return t&&typeof t!="function"?(t.current||(t.current=e.current),t):e},taA=(t,A,e)=>{const i=p.useRef(void 0),g=p.useCallback(()=>(i.current||(i.current=t()),i.current),e);return p.useEffect(()=>{const I=g(),n=()=>A(I);return()=>{n(),i.current=void 0}},[g]),g},gWA=t=>{var A;const e=WoA(t?.type||"dynamic"),i=new AC(e);return i.canSleep=(A=t?.canSleep)!==null&&A!==void 0?A:!0,i},IWA=({rigidBody:t,object:A,setMatrix:e,getMatrix:i,worldScale:g,meshType:I="mesh"})=>{A.updateWorldMatrix(!0,!1);const n=A.parent.matrixWorld.clone().invert();return{object:A,rigidBody:t,invertedWorldMatrix:n,setMatrix:e||(o=>{A.matrix.copy(o)}),getMatrix:i||(o=>o.copy(A.matrix)),scale:g||A.getWorldScale(xd).clone(),isSleeping:!1,meshType:I}},nWA=["args","colliders","canSleep"],iaA={gravityScale:(t,A)=>{t.setGravityScale(A,!0)},additionalSolverIterations(t,A){t.setAdditionalSolverIterations(A)},linearDamping:(t,A)=>{t.setLinearDamping(A)},angularDamping:(t,A)=>{t.setAngularDamping(A)},dominanceGroup:(t,A)=>{t.setDominanceGroup(A)},enabledRotations:(t,[A,e,i])=>{t.setEnabledRotations(A,e,i,!0)},enabledTranslations:(t,[A,e,i])=>{t.setEnabledTranslations(A,e,i,!0)},lockRotations:(t,A)=>{t.lockRotations(A,!0)},lockTranslations:(t,A)=>{t.lockTranslations(A,!0)},angularVelocity:(t,[A,e,i])=>{t.setAngvel({x:A,y:e,z:i},!0)},linearVelocity:(t,[A,e,i])=>{t.setLinvel({x:A,y:e,z:i},!0)},ccd:(t,A)=>{t.enableCcd(A)},softCcdPrediction:(t,A)=>{t.setSoftCcdPrediction(A)},userData:(t,A)=>{t.userData=A},type(t,A){t.setBodyType(WoA(A),!0)},position:()=>{},rotation:()=>{},quaternion:()=>{},scale:()=>{}},gaA=Object.keys(iaA),oWA=(t,A,e,i=!0)=>{if(!t)return;const g=e.get(t.handle);g&&(i&&(g.object.updateWorldMatrix(!0,!1),jE.copy(g.object.matrixWorld).decompose(xo,QB,xd),t.setTranslation(xo,!1),t.setRotation(QB,!1)),gaA.forEach(I=>{I in A&&iaA[I](t,A[I])}))},aWA=(t,A,e,i=!0)=>{const g=p.useMemo(()=>gaA.flatMap(I=>zoA(A[I])),[A]);p.useEffect(()=>{const I=t();oWA(I,A,e,i)},g)},rWA=(t,A,e)=>{const{onWake:i,onSleep:g,onCollisionEnter:I,onCollisionExit:n,onIntersectionEnter:o,onIntersectionExit:a,onContactForce:r}=A,s={onWake:i,onSleep:g,onCollisionEnter:I,onCollisionExit:n,onIntersectionEnter:o,onIntersectionExit:a,onContactForce:r};p.useEffect(()=>{const B=t();return e.set(B.handle,s),()=>{e.delete(B.handle)}},[i,g,I,n,o,a,r])},sWA=({x:t,y:A,z:e}={x:0,y:0,z:0})=>new wA(t,A,e),ps=p.memo(t=>{const{children:A,position:e,rotation:i,quaternion:g,scale:I,name:n}=t,{world:o,colliderEvents:a,colliderStates:r}=Ev(),s=oaA(),B=L1(t.ref),c=p.useRef(null),E=OZA.flatMap(S=>Array.isArray(t[S])?t[S]:[t[S]]),D=taA(()=>{const S=c.current.getWorldScale(sWA()),f=HZA(t,o,S,s?.getRigidBody);return typeof t.ref=="function"&&t.ref(f),B.current=f,f},S=>{o.getCollider(S.handle)&&o.removeCollider(S,!0)},[...E,s]);p.useEffect(()=>{const S=D();return r.set(S.handle,zZA(S,c.current,s?.ref.current)),()=>{r.delete(S.handle)}},[D]);const y=p.useMemo(()=>Pg(Pg({},AaA(s?.options)),t),[t,s?.options]);return ZZA(D,y,r),AWA(D,y,a,$oA(s?.options)),ke.createElement("object3D",{position:e,rotation:i,quaternion:g,scale:I,ref:c,name:n},A)}),CWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"cuboid",ref:A})));CWA.displayName="CuboidCollider";const BWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"roundCuboid",ref:A})));BWA.displayName="RoundCuboidCollider";const cWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"ball",ref:A})));cWA.displayName="BallCollider";const lWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"capsule",ref:A})));lWA.displayName="CapsuleCollider";const QWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"heightfield",ref:A})));QWA.displayName="HeightfieldCollider";const EWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"trimesh",ref:A})));EWA.displayName="TrimeshCollider";const uWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"cone",ref:A})));uWA.displayName="ConeCollider";const hWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"roundCone",ref:A})));hWA.displayName="RoundConeCollider";const IaA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"cylinder",ref:A})));IaA.displayName="CylinderCollider";IaA.displayName="RoundCylinderCollider";const dWA=ke.forwardRef((t,A)=>ke.createElement(ps,fo({},t,{shape:"convexHull",ref:A})));dWA.displayName="ConvexHullCollider";const pWA=["ref","children","type","position","rotation","scale","quaternion","transformState"],naA=p.createContext(void 0),oaA=()=>p.useContext(naA),AQ=p.memo(t=>{const{ref:A,children:e,type:i,position:g,rotation:I,scale:n,quaternion:o,transformState:a}=t,r=oF(t,pWA),s=p.useRef(null),B=L1(A),{world:c,rigidBodyStates:E,physicsOptions:D,rigidBodyEvents:y}=Ev(),S=p.useMemo(()=>Pg(Pg(Pg({},D),t),{},{children:void 0}),[D,t]),f=nWA.flatMap(U=>Array.isArray(S[U])?[...S[U]]:S[U]),M=J1(s,S),k=taA(()=>{const U=gWA(S),F=c.createRigidBody(U);return typeof A=="function"&&A(F),B.current=F,F},U=>{c.getRigidBody(U.handle)&&c.removeRigidBody(U)},f);p.useEffect(()=>{const U=k(),F=IWA({rigidBody:U,object:s.current});return E.set(U.handle,t.transformState?t.transformState(F):F),()=>{E.delete(U.handle)}},[k]),aWA(k,S,E),rWA(k,S,y);const m=p.useMemo(()=>({ref:s,getRigidBody:k,options:S}),[k]);return ke.createElement(naA.Provider,{value:m},ke.createElement("object3D",fo({ref:s},r,{position:g,rotation:I,quaternion:o,scale:n}),e,M.map((U,F)=>ke.createElement(ps,fo({key:F},U)))))});AQ.displayName="RigidBody";const fWA=p.memo(t=>{const{children:A,type:e}=t,{physicsOptions:i}=Ev(),g=p.useRef(null),{options:I}=oaA(),n=p.useMemo(()=>Pg(Pg(Pg({},i),I),{},{children:void 0,colliders:e}),[i,I]),o=J1(g,n,!1);return ke.createElement("object3D",{ref:g,userData:{r3RapierType:"MeshCollider"}},A,o.map((a,r)=>ke.createElement(ps,fo({key:r},a))))});fWA.displayName="MeshCollider";const DWA=["ref"],yWA=["children","instances","colliderNodes","position","rotation","quaternion","scale"],SWA=p.memo(t=>{let{ref:A}=t,e=oF(t,DWA);const i=L1(A,[]),g=p.useRef(null),I=p.useRef(null),{children:n,instances:o,colliderNodes:a=[],position:r,rotation:s,quaternion:B,scale:c}=e,E=oF(e,yWA),D=J1(g,Pg(Pg({},e),{},{children:void 0})),y=()=>{const f=I.current.children[0];if(f&&"isInstancedMesh"in f)return f};p.useEffect(()=>{const f=y();f&&f.instanceMatrix.setUsage(hnA)},[]);const S=(f,M)=>{const k=y();return k?Pg(Pg({},f),{},{getMatrix:m=>(k.getMatrixAt(M,m),m),setMatrix:m=>{k.setMatrixAt(M,m),k.instanceMatrix.needsUpdate=!0},meshType:"instancedMesh"}):f};return ke.createElement("object3D",fo({ref:g},E,{position:r,rotation:s,quaternion:B,scale:c}),ke.createElement("object3D",{ref:I},n),o?.map((f,M)=>ke.createElement(AQ,fo({},E,f,{ref:k=>{i.current[M]=k},transformState:k=>S(k,M)}),ke.createElement(ke.Fragment,null,a.map((k,m)=>ke.createElement(p.Fragment,{key:m},k)),D.map((k,m)=>ke.createElement(ps,fo({key:m},k)))))))});SWA.displayName="InstancedRigidBodies";function jY(){return jY=Object.assign?Object.assign.bind():function(t){for(var A=1;A<arguments.length;A++){var e=arguments[A];for(var i in e)({}).hasOwnProperty.call(e,i)&&(t[i]=e[i])}return t},jY.apply(null,arguments)}const wWA=t=>t;function mWA(t,A=wWA){const e=ke.useSyncExternalStore(t.subscribe,ke.useCallback(()=>A(t.getState()),[t,A]),ke.useCallback(()=>A(t.getInitialState()),[t,A]));return ke.useDebugValue(e),e}const P9=t=>{const A=SoA(t),e=i=>mWA(A,i);return Object.assign(e,A),e},kWA=t=>t?P9(t):P9;let jG=null,aaA="https://www.gstatic.com/draco/versioned/decoders/1.5.5/";function raA(t=!0,A=!0,e){return i=>{e&&e(i),t&&(jG||(jG=new wZA),jG.setDecoderPath(typeof t=="string"?t:aaA),i.setDRACOLoader(jG)),A&&i.setMeshoptDecoder(typeof ix=="function"?ix():ix)}}const id=(t,A,e,i)=>nM(_1,t,raA(A,e,i));id.preload=(t,A,e,i)=>nM.preload(_1,t,raA(A,e,i));id.clear=t=>nM.clear(_1,t);id.setDecoderPath=t=>{aaA=t};function MWA(t,A,e){const i=PE(E=>E.size),g=PE(E=>E.viewport),I=typeof t=="number"?t:i.width*g.dpr,n=i.height*g.dpr,o=(typeof t=="number"?e:t)||{},{samples:a=0,depth:r,...s}=o,B=r??o.depthBuffer,c=p.useMemo(()=>{const E=new SB(I,n,{minFilter:HI,magFilter:HI,type:Bp,...s});return B&&(E.depthTexture=new $b(I,n,ir)),E.samples=a,E},[]);return p.useLayoutEffect(()=>{c.setSize(I,n),a&&(c.samples=a)},[a,c,I,n]),p.useEffect(()=>()=>c.dispose(),[]),c}const NWA=t=>typeof t=="function",GWA=p.forwardRef(({envMap:t,resolution:A=256,frames:e=1/0,children:i,makeDefault:g,...I},n)=>{const o=PE(({set:S})=>S),a=PE(({camera:S})=>S),r=PE(({size:S})=>S),s=p.useRef(null);p.useImperativeHandle(n,()=>s.current,[]);const B=p.useRef(null),c=MWA(A);p.useLayoutEffect(()=>{I.manual||s.current.updateProjectionMatrix()},[r,I]),p.useLayoutEffect(()=>{s.current.updateProjectionMatrix()}),p.useLayoutEffect(()=>{if(g){const S=a;return o(()=>({camera:s.current})),()=>o(()=>({camera:S}))}},[s,g,o]);let E=0,D=null;const y=NWA(i);return IM(S=>{y&&(e===1/0||E<e)&&(B.current.visible=!1,S.gl.setRenderTarget(c),D=S.scene.background,t&&(S.scene.background=t),S.gl.render(S.scene,s.current),S.scene.background=D,S.gl.setRenderTarget(null),B.current.visible=!0,E++)}),p.createElement(p.Fragment,null,p.createElement("orthographicCamera",jY({left:r.width/-2,right:r.width/2,top:r.height/2,bottom:r.height/-2,ref:s},I),!y&&i),p.createElement("group",{ref:B},y&&i(c.texture)))}),RWA=2e3,UWA=5e3,j9=.08;function Z9({result:t,position:A,rollTrigger:e,noAnimation:i=!1,active:g=!0,chargeLevel:I=0}){const[n,o]=p.useState("/models/dice.glb");p.useEffect(()=>{try{id.preload?.("/models/dice_red_white.glb"),id.preload?.("/models/dice_green_gold.glb"),id.preload?.("/models/dice.glb")}catch{}},[]),p.useEffect(()=>{let q=!1;return(async()=>{try{const Y=await jo();let O="/models/dice.glb";Y?.diceColorTheme==="dice_red_white"?O="/models/dice_red_white.glb":Y?.diceColorTheme==="dice_green_gold"&&(O="/models/dice_green_gold.glb"),q||o(O)}catch{}})(),()=>{q=!0}},[]);const a=id(n),r=p.useMemo(()=>{const q=a.scene.clone(!0);return q.traverse(Y=>{if(Y?.isMesh&&Y.material){const O=Array.isArray(Y.material)?Y.material:[Y.material];for(const $ of O){if($&&"envMapIntensity"in $)try{$.envMapIntensity=Math.max(1,Number($.envMapIntensity||.9))}catch{}if($&&"metalness"in $)try{$.metalness=Math.min(.9,Math.max(.2,Number($.metalness||.5)))}catch{}if($&&"roughness"in $)try{$.roughness=Math.min(.9,Math.max(.2,Number($.roughness||.55)))}catch{}}}}),q},[a.scene]),s=p.useRef(null),B=p.useRef(null),c=p.useRef(null),E=p.useRef(!1),D=p.useRef(!1),y=p.useRef(null),S=p.useRef(!1),f=p.useRef(0),M=p.useRef({x:0,y:0,z:0}),k=p.useRef({x:0,y:0,z:0}),m=p.useRef(new Wo),U=p.useRef(new Kn),F=p.useRef(null),b=p.useRef(0);b.current=I;const K=p.useCallback(q=>{if(!A)return;const Y=s.current;if(!Y)return;Y.wakeUp?.(),Y.setLinvel({x:0,y:0,z:0},!0),Y.setAngvel({x:0,y:0,z:0},!0),Y.setRotation({x:0,y:0,z:0,w:1},!0);const O=.3+q*.7,$=M.current,gA=k.current,z=-A[0],X=-A[2],sA=Math.sqrt(z*z+X*X)||1,rA=25*O;$.x=z/sA*rA+(Math.random()-.5)*8*O,$.y=8+10*O,$.z=X/sA*rA+(Math.random()-.5)*8*O,gA.x=(Math.random()-.5)*120*O,gA.y=(Math.random()-.5)*120*O,gA.z=(Math.random()-.5)*120*O,Y.setTranslation({x:A[0],y:2.6,z:A[2]},!0),Y.setLinvel($,!0),Y.setAngvel(gA,!0),Y.wakeUp?.()},[A]);p.useCallback(()=>{K(.6)},[K]),p.useEffect(()=>{const q=s.current;if(q)if(g)q.wakeUp?.();else{E.current=!1;try{q.setLinvel({x:0,y:0,z:0},!0),q.setAngvel({x:0,y:0,z:0},!0),q.sleep?.()}catch{}if(D.current){D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null);try{js()}catch{}}}},[g]),p.useEffect(()=>()=>{try{y.current&&(window.clearTimeout(y.current),y.current=null),js()}catch{}},[]);const R=p.useRef(K);R.current=K,p.useEffect(()=>{if(i||!A||!g||typeof e!="number"||e<=0)return;c.current&&(window.clearTimeout(c.current),c.current=null),B.current=Date.now(),E.current=!0,f.current=0,F.current=null;const q=s.current;if(q)try{q.wakeUp?.(),q.setLinvel({x:0,y:0,z:0},!0),q.setAngvel({x:0,y:0,z:0},!0)}catch{}if(S.current=!0,!D.current){D.current=!0;try{LlA({volume:.5,playbackRate:1})}catch{}y.current&&window.clearTimeout(y.current),y.current=window.setTimeout(()=>{if(D.current){D.current=!1;try{js()}catch{}}y.current&&(window.clearTimeout(y.current),y.current=null)},5e3)}},[e,g,i,A]),p.useEffect(()=>{if(!(e>0)&&(E.current&&(E.current=!1),D.current)){D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null);try{js()}catch{}}},[e]),p.useEffect(()=>{if(i||!A||!g)return;if(!B.current||!E.current){const O=s.current;if(!O)return;try{O.setLinvel({x:0,y:0,z:0},!0),O.setAngvel({x:0,y:0,z:0},!0)}catch{}if(t){const $=ON[t];if($){const gA=m.current,z=U.current;gA.set($[0],$[1],$[2]),z.setFromEuler(gA);try{O.setRotation(z,!0)}catch{}try{O.setTranslation({x:A[0],y:2,z:A[2]},!0)}catch{}}}try{O.sleep?.()}catch{}return}if(!t)return;const q=Date.now()-(B.current??Date.now()),Y=Math.max(0,RWA-q);return c.current&&(window.clearTimeout(c.current),c.current=null),c.current=window.setTimeout(()=>{if(E.current=!1,D.current){D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null);try{js()}catch{}}const O=s.current;if(!O)return;try{const z=O.translation(),X=4.2,sA=z.x,rA=z.z,mA=Math.sqrt(sA*sA+rA*rA);if(mA>X){const IA=X/mA;F.current={x:sA*IA,z:rA*IA}}else F.current={x:sA,z:rA}}catch{F.current={x:A[0],z:A[2]}}const $=F.current.x,gA=F.current.z;try{O.setLinvel({x:0,y:0,z:0},!0),O.setAngvel({x:0,y:0,z:0},!0),O.setTranslation({x:$,y:2,z:gA},!0)}catch{}if(t){const z=ON[t];if(z){const X=m.current,sA=U.current;X.set(z[0],z[1],z[2]),sA.setFromEuler(X);try{O.setRotation(sA,!0)}catch{}}}if(B.current=null,D.current){D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null);try{js()}catch{}}try{O.sleep?.()}catch{}},Y),()=>{c.current&&(window.clearTimeout(c.current),c.current=null)}},[e,t,A,i,g]);const G=p.useRef(0),J=p.useRef(!1),x=p.useRef(!1),H=p.useRef(0),P=10,j=p.useRef(0);return IM((q,Y)=>{const O=s.current;if(!O)return;const $=5,gA=1,z=4;try{const sA=O.translation(),rA=sA.x,mA=sA.z,IA=Math.sqrt(rA*rA+mA*mA);let uA=!1,KA=sA.x,FA=sA.y,RA=sA.z;if(IA>$){const MA=($-.3)/IA;KA=rA*MA,RA=mA*MA,uA=!0;const oA=O.linvel(),AA=(oA.x*rA+oA.z*mA)/(IA*IA);AA>0&&O.setLinvel({x:oA.x-2*AA*rA,y:oA.y,z:oA.z-2*AA*mA},!0)}if(FA<gA){FA=.5,uA=!0;const MA=O.linvel();O.setLinvel({x:MA.x,y:Math.abs(MA.y)+2,z:MA.z},!0)}if(FA>z){FA=z-.5,uA=!0;const MA=O.linvel();O.setLinvel({x:MA.x,y:-Math.abs(MA.y)*.5,z:MA.z},!0)}uA&&O.setTranslation({x:KA,y:FA,z:RA},!0)}catch{}const X=b.current;if(X>0&&!E.current&&g){O.wakeUp?.(),j.current+=Y;const sA=j.current,rA=.15+X*.6,mA=18+X*30,IA=Math.sin(sA*mA)*rA,uA=Math.cos(sA*mA*1.3)*rA,KA=A?.[0]??0,FA=A?.[2]??0;O.setTranslation({x:KA+IA,y:2,z:FA+uA},!0);const RA=.3+X*1.2;O.setAngvel({x:Math.sin(sA*mA*.7)*RA,y:0,z:Math.cos(sA*mA*.9)*RA},!0);return}if(X===0&&j.current>0&&!E.current&&(j.current=0),E.current&&g){if(B.current&&Date.now()-B.current>UWA){if(E.current=!1,D.current){D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null);try{js()}catch{}}try{O.setLinvel({x:0,y:0,z:0},!0),O.setAngvel({x:0,y:0,z:0},!0),O.setTranslation({x:A?.[0]??0,y:2,z:A?.[2]??0},!0)}catch{}if(t){const RA=ON[t];if(RA){const MA=m.current,oA=U.current;MA.set(RA[0],RA[1],RA[2]),oA.setFromEuler(MA);try{O.setRotation(oA,!0)}catch{}}}B.current=null;try{O.sleep?.()}catch{}return}G.current+=Y,f.current++,J.current=!1,x.current=!1,H.current=0;try{O.wakeUp?.()}catch{}if(S.current){S.current=!1;try{R.current(b.current)}catch{}}const sA=f.current<=15,rA=O.angvel(),mA=Math.sqrt(rA.x*rA.x+rA.y*rA.y+rA.z*rA.z),IA=sA?40:25;if(mA<IA){const RA=IA-mA+15;O.setAngvel({x:rA.x+(Math.random()-.5)*RA,y:rA.y+(Math.random()-.5)*RA,z:rA.z+(Math.random()-.5)*RA},!0)}const uA=O.linvel();if(Math.sqrt(uA.x*uA.x+uA.y*uA.y+uA.z*uA.z)<(sA?8:4)&&O.setLinvel({x:(Math.random()-.5)*12,y:Math.max(uA.y,6),z:(Math.random()-.5)*12},!0),G.current>=.15){const RA={x:(Math.random()-.5)*10,y:4,z:(Math.random()-.5)*10};O.applyImpulse(RA,!0),O.applyTorqueImpulse({x:(Math.random()-.5)*15,y:(Math.random()-.5)*15,z:(Math.random()-.5)*15},!0),G.current=0}return}if(g&&!E.current&&t)try{const sA=O.linvel(),rA=O.angvel(),mA=Math.abs(sA.x)+Math.abs(sA.y)+Math.abs(sA.z),IA=Math.abs(rA.x)+Math.abs(rA.y)+Math.abs(rA.z);O.setLinvel({x:0,y:0,z:0},!0),O.setAngvel({x:0,y:0,z:0},!0);const uA=ON[t];if(uA){const RA=m.current,MA=U.current;RA.set(uA[0],uA[1],uA[2]),MA.setFromEuler(RA),O.setRotation(MA,!0)}const KA=F.current?.x??A?.[0]??0,FA=F.current?.z??A?.[2]??0;O.setTranslation({x:KA,y:2,z:FA},!0),J.current=!0,mA<j9&&IA<j9?(H.current++,H.current>=P&&(x.current=!0)):H.current=0,O.sleep?.()}catch{}}),p.useEffect(()=>()=>{if(E.current=!1,c.current&&window.clearTimeout(c.current),B.current=null,D.current){D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null);try{js()}catch{}}},[]),p.useEffect(()=>{const q=()=>{try{D.current&&(D.current=!1,y.current&&(window.clearTimeout(y.current),y.current=null),js())}catch{}},Y=()=>{document.visibilityState==="hidden"&&q()},O=()=>q(),$=()=>q();return document.addEventListener("visibilitychange",Y),window.addEventListener("pagehide",O),window.addEventListener("beforeunload",$),()=>{document.removeEventListener("visibilitychange",Y),window.removeEventListener("pagehide",O),window.removeEventListener("beforeunload",$)}},[]),Q.jsx(AQ,{ref:s,position:A,colliders:"cuboid",mass:1,linearDamping:.3,angularDamping:.3,restitution:.8,friction:.5,ccd:!0,children:Q.jsx("primitive",{object:r,scale:31.25,visible:g})})}const wr=6.5,KWA=wr+.65,FWA=[[3,1,0],[-1.5,1,2.6],[-1.5,1,-2.6]],bWA=[[-3,1,0],[3,1,0]],qD=24,aF=3,vWA=1.2,_WA=1,rF=wr-_WA,JWA=2*rF*Math.sin(Math.PI/qD),LWA=Array.from({length:qD},(t,A)=>{const e=A*2*Math.PI/qD;return{position:[Math.cos(e)*rF,aF/2,Math.sin(e)*rF],rotation:[0,-e+Math.PI/2,0],width:JWA,height:aF,thickness:vWA}}),gx=5,qWA=wr,xWA=1,TWA=1.4,saA=[];for(let t=0;t<gx;t++){const A=t/gx,e=(t+1)/gx,i=(A+e)/2,g=aF+i*(qWA-aF),I=Math.max(.5,rF*Math.cos(i*(Math.PI/2))),n=2*I*Math.sin(Math.PI/qD),o=i*(Math.PI/2);for(let a=0;a<qD;a++){const r=a*2*Math.PI/qD;saA.push({position:[Math.cos(r)*I,g,Math.sin(r)*I],rotation:[o,-r+Math.PI/2,0],width:n,height:TWA,thickness:xWA})}}function W9(){return Q.jsxs(Q.Fragment,{children:[LWA.map((t,A)=>Q.jsx(AQ,{type:"fixed",colliders:"cuboid",position:t.position,rotation:t.rotation,restitution:.85,friction:.3,children:Q.jsxs("mesh",{visible:!1,children:[Q.jsx("boxGeometry",{args:[t.width,t.height,t.thickness]}),Q.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})},`bwall-${A}`)),saA.map((t,A)=>Q.jsx(AQ,{type:"fixed",colliders:"cuboid",position:t.position,rotation:t.rotation,restitution:.85,friction:.3,children:Q.jsxs("mesh",{visible:!1,children:[Q.jsx("boxGeometry",{args:[t.width,t.height,t.thickness]}),Q.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})},`dome-${A}`))]})}const YWA={uTime:{value:0}},HWA=`
    varying vec2 vUv;
    void main() {
        vUv = uv;
        gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    }
`,OWA=`
    varying vec2 vUv;
    uniform float uTime;

    void main() {
        vec2 uv = vUv - 0.5;          // centre-relative (‒0.5 → 0.5)
        float d = length(uv) * 2.0;   // 0 at centre, 1 at edge

        // Discard outside the dome circle
        if (d > 1.0) discard;

        // ── 1. Glass thickness — thicker at rim, thinnest at apex ─────
        // Simulates cross-section of a hemisphere: thickness ∝ sqrt(1-r²) inverted
        float thickness = 1.0 - sqrt(max(1.0 - d * d, 0.0));

        // ── 2. Thick glass rim band ─────────────────────────────────────
        // The base of the bell jar is *much* thicker — bright ring.
        // Uses a soft inner ramp + hard outer cutoff.
        float rimInner = smoothstep(0.72, 0.92, d);    // ramp up toward edge
        float rimOuter = 1.0 - smoothstep(0.96, 1.0, d); // fade right at edge
        float rimBand = rimInner * rimOuter;
        // Modulate brightness around the ring — brighter on top-left (light dir)
        float rimAngle = atan(uv.y, uv.x);
        float rimLit = 0.55 + 0.45 * sin(rimAngle + 0.8); // peak upper-left
        float rim = rimBand * rimLit * 0.65;

        // ── 3. Primary specular — large window reflection ───────────────
        // Upper-left crescent: large bright reflection like a window/light
        vec2 specCenter = vec2(-0.12, 0.16);
        float specDist = length(uv - specCenter);
        // Elongate slightly (wider than tall) for a wide window highlight
        vec2 specUV = (uv - specCenter) * vec2(1.0, 1.4);
        float specD = length(specUV);
        float spec = (1.0 - smoothstep(0.0, 0.30, specD)) * 0.38;
        // Strengthen near the rim for that curved-glass reflection feel
        spec *= 0.4 + 0.6 * smoothstep(0.2, 0.7, d);

        // ── 4. Secondary specular — smaller opposite reflection ────────
        vec2 spec2Center = vec2(0.15, -0.12);
        float spec2D = length(uv - spec2Center);
        float spec2 = (1.0 - smoothstep(0.0, 0.18, spec2D)) * 0.14;
        spec2 *= smoothstep(0.15, 0.5, d);

        // ── 5. Shadow vignette — subtle darkening at the rim ────────────
        float shadow = smoothstep(0.5, 1.0, d) * 0.30;

        // ── 6. Faint glass tint — very slight green/blue ────────────────
        // Real glass has a faint colour; barely visible but adds realism
        float tintStrength = thickness * 0.03;
        vec3 glassTint = vec3(0.85, 0.95, 0.88); // slight green glass tint

        // ── 7. Animated shimmer — subtle orbiting light glints ─────────────
        // Primary glint — small, gentle sweeping arc
        float a1 = uTime * 0.60;
        vec2 shimP1 = vec2(cos(a1) * 0.34, sin(a1) * 0.28);
        float shimD1 = length(uv - shimP1);
        float rimBias1 = smoothstep(0.15, 0.75, d);
        float shim1 = (1.0 - smoothstep(0.0, 0.14, shimD1)) * 0.22 * rimBias1;

        // Secondary glint — opposite orbit, small
        float a2 = uTime * 0.78 + 3.14159;
        vec2 shimP2 = vec2(cos(a2) * 0.28, sin(a2) * 0.24);
        float shimD2 = length(uv - shimP2);
        float shim2 = (1.0 - smoothstep(0.0, 0.12, shimD2)) * 0.16 * smoothstep(0.10, 0.60, d);

        // Top-edge shimmer — bright arc hugging the upper rim
        // uv.y > 0 = top of dome; combine with rim proximity for a concentrated band
        float topBias = smoothstep(0.0, 0.35, uv.y);           // strongest at top
        float rimProx = smoothstep(0.65, 0.92, d);             // only near the edge
        float topShim = topBias * rimProx * 0.70;
        // Add a slow drift so it breathes
        float topDrift = 0.85 + 0.15 * sin(uTime * 0.55);
        topShim *= topDrift;

        // Bottom-centre shimmer — gentle glint near middle-bottom of the dome
        vec2 botCenter = vec2(0.0, -0.22);
        float botD = length(uv - botCenter);
        float botShim = (1.0 - smoothstep(0.0, 0.16, botD)) * 0.60;
        // Slow breathe offset from the top shimmer
        botShim *= 0.80 + 0.20 * sin(uTime * 0.45 + 1.0);

        // Bottom-left shimmer — soft glint offset to the left
        vec2 blCenter = vec2(-0.22, -0.18);
        float blD = length(uv - blCenter);
        float blShim = (1.0 - smoothstep(0.0, 0.18, blD)) * 1.00;
        blShim *= 0.82 + 0.18 * sin(uTime * 0.50 + 2.2);

        float shimmer = shim1 + shim2 + topShim + botShim + blShim;

        // ── Composite ─────────────────────────────────────────────────
        float highlight = rim + spec + spec2 + shimmer;

        // Base: glass tint colour (faint green).
        // Dark component (shadow) pulls toward black.
        // Bright component (highlights) pushes toward white.
        vec3 col = mix(glassTint * tintStrength, vec3(1.0), highlight);

        // Alpha: combine shadow + highlight + base tint transparency
        float alpha = max(shadow, highlight) + tintStrength;
        alpha = clamp(alpha, 0.0, 1.0);

        gl_FragColor = vec4(col, alpha);
    }
`;function z9(){const t=p.useMemo(()=>new EC({uniforms:i1.clone(YWA),vertexShader:HWA,fragmentShader:OWA,transparent:!0,depthWrite:!1}),[]);return IM((A,e)=>{t.uniforms.uTime.value+=e}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.012,0],children:[Q.jsx("circleGeometry",{args:[KWA,128]}),Q.jsx("primitive",{object:t,attach:"material"})]})}function PWA({results:t,rollTrigger:A,preRollTrigger:e,showDice:i,gameMode:g="cee-lo",gameState:I,noAnimation:n=!1,chargeLevel:o=0}){const{scheduleReveal:a}=kQ(),r=e??0,s=FWA,B=bWA,c=p.useMemo(()=>{try{const f=navigator.userAgent;return/iPad|iPhone|iPod/.test(f)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}catch{return!1}},[]);p.useEffect(()=>{A>0&&a(2e3)},[A,a]);const E=PE(),D=p.useMemo(()=>({felt:new vd({color:"#0e3a20",roughness:.95,metalness:.02}),rim:new vd({color:"gold",roughness:.4,metalness:.85,envMapIntensity:.6})}),[]),y=()=>(p.useEffect(()=>{if(!c)return;const{gl:f,scene:M}=E;let k=Date.now();const m=15e3;function U(){try{M.traverse(K=>{const R=K.material;R&&(Array.isArray(R)?R.forEach(G=>{G.needsUpdate=!0,G.map&&(G.map.needsUpdate=!0)}):(R.needsUpdate=!0,R.map&&(R.map.needsUpdate=!0)))});try{f.outputColorSpace=Hn}catch{}try{f.toneMapping=Wk}catch{}f.setClearColor("#000000",0)}catch{}}function F(){document.visibilityState==="visible"?Date.now()-k>m&&U():k=Date.now()}function b(){U()}document.addEventListener("visibilitychange",F);try{f?.domElement?.addEventListener("webglcontextrestored",b,!1)}catch{}return()=>{document.removeEventListener("visibilitychange",F);try{f?.domElement?.removeEventListener("webglcontextrestored",b,!1)}catch{}}},[c]),null),S=()=>Q.jsxs(Q.Fragment,{children:[Q.jsx("ambientLight",{intensity:.8}),Q.jsx("hemisphereLight",{args:["#ffffff","#0e3a20",.45],position:[0,6,0]})]});if(g==="craps"){const f=t?.[0],M=t?.[1];return Q.jsx(AQ,{type:"fixed",children:Q.jsxs("group",{children:[Q.jsx(y,{}),Q.jsx(S,{}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.001,0],children:[Q.jsx("circleGeometry",{args:[wr,128]}),Q.jsx("primitive",{object:D.felt,attach:"material"})]}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,0],castShadow:!0,children:[Q.jsx("ringGeometry",{args:[wr-.15,wr+.2,128]}),Q.jsx("primitive",{object:D.rim,attach:"material"})]}),Q.jsx(z9,{}),Q.jsx(AQ,{type:"fixed",colliders:"cuboid",position:[0,-.5,0],friction:.9,restitution:.15,children:Q.jsxs("mesh",{visible:!1,children:[Q.jsx("boxGeometry",{args:[wr*2,1,wr*2]}),Q.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})}),Q.jsx(W9,{}),i&&B.map((k,m)=>Q.jsx(Z9,{position:k,result:m===0?f:M,rollTrigger:A,spinTrigger:r,noAnimation:n,active:!n,chargeLevel:o},m))]})})}return Q.jsx(AQ,{type:"fixed",children:Q.jsxs("group",{children:[Q.jsx(y,{}),Q.jsx(S,{}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.001,0],children:[Q.jsx("circleGeometry",{args:[wr,128]}),Q.jsx("primitive",{object:D.felt,attach:"material"})]}),Q.jsx(AQ,{type:"fixed",colliders:"cuboid",position:[0,-.5,0],friction:.9,restitution:.15,children:Q.jsxs("mesh",{visible:!1,children:[Q.jsx("boxGeometry",{args:[wr*2,1,wr*2]}),Q.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})}),Q.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,0],castShadow:!0,children:[Q.jsx("ringGeometry",{args:[wr-.15,wr+.2,128]}),Q.jsx("primitive",{object:D.rim,attach:"material"})]}),Q.jsx(z9,{}),Q.jsx(W9,{}),i&&s.map((f,M)=>Q.jsx(Z9,{position:f,result:t?.[M],rollTrigger:A,spinTrigger:r,noAnimation:n,active:!n,chargeLevel:o},M))]})})}let RE=null;const Xw=()=>{if(RE){try{const t=RE.domElement,A=t?.getContext("webgl")||t?.getContext("webgl2");if(A){const e=A.getExtension("WEBGL_lose_context");e&&e.loseContext()}}catch{}try{RE.dispose()}catch{}try{RE.forceContextLoss?.()}catch{}RE=null}};class jWA extends ke.Component{state={hasError:!1};static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(A,e){r0.error("CanvasErrorBoundary caught",{message:A?.message,stack:A?.stack?.slice(0,500)}),(A?.message?.includes("autoReset")||A?.message?.includes("undefined is not an object"))&&this.props.onError()}reset(){this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}}function ZWA(){const{size:t,camera:A}=PE();return ke.useEffect(()=>{const e=Math.min(t.width,t.height)/2,i=wr+.75,g=A.position,I=Math.sqrt(g.x*g.x+g.y*g.y+g.z*g.z),n=I>.1&&g.y>.1?g.y/I:1,o=n<.95?1+(1-n)*.6:1,a=e/(i*o),r=A;r.zoom=a,r.updateProjectionMatrix()},[t.width,t.height,A]),null}function CaA({isWaiting:t,rollTrigger:A,results:e,preRollTrigger:i,gameMode:g="cee-lo",gameState:I,diceSettled:n,chargeLevel:o=0,cameraAngle:a=0}){const r=g==="craps",[s,B]=ke.useState(!0),[c,E]=ke.useState(0),[D,y]=ke.useState(!1),[S,f]=ke.useState(0),M=2;ke.useEffect(()=>{let O=!0;return(async()=>{try{const $=await jo();if(!O)return;B($.showAnimations!==!1)}catch{}})(),()=>{O=!1}},[]),ke.useCallback(async()=>{const O=!s;B(O);try{const $=await jo();await VE({...$,showAnimations:O})}catch{}},[s]);const k=ke.useMemo(()=>{if(s&&!D)return null;const O=Array.isArray(e)?e:void 0;if(!O)return null;const $=(r?O.slice(0,2):O).filter(gA=>typeof gA=="number"&&gA>=1&&gA<=6);return $.length===0?null:$},[e,s,r,D]),U=Xc()?.throttleVideoForAnimation,F=ke.useRef(A);ke.useEffect(()=>{U&&(A>F.current&&U(!0).catch(()=>{}),F.current=A)},[A,U]),ke.useEffect(()=>{if(U&&n&&e){const O=setTimeout(()=>{U(!1).catch(()=>{})},500);return()=>clearTimeout(O)}},[n,e,U]);const[b,K]=ke.useState(0);ke.useEffect(()=>{if(!r)return;const O=$=>{const gA=$.detail?.streak??0;let z=0;gA>=7?z=5:gA>=5?z=4:gA>=4?z=3:gA>=3?z=2:gA>=2&&(z=1),K(z)};return window.addEventListener("craps:streak",O),()=>window.removeEventListener("craps:streak",O)},[r]);const R=b>0?`dice-halo dice-halo--active dice-halo--level-${b}`:"dice-halo",[G,J]=ke.useState(null),x=ke.useRef(0),[H,P]=ke.useState(0);ke.useEffect(()=>{if(r)return;const O=$=>{const gA=$.detail?.result;(gA==="win"||gA==="lose")&&(x.current+=1,J(gA),P(z=>gA==="win"?z+1:0))};return window.addEventListener("ceelo:result",O),()=>window.removeEventListener("ceelo:result",O)},[r]),ke.useEffect(()=>{if(!G)return;const O=setTimeout(()=>J(null),1900);return()=>clearTimeout(O)},[G,x.current]);const j=G?`dice-halo dice-halo--ceelo dice-halo--ceelo-${G}`:"",q=ke.useMemo(()=>H>=7?5:H>=5?4:H>=4?3:H>=3?2:H>=2?1:0,[H]),Y=q>0?`dice-halo dice-halo--active dice-halo--level-${q}`:"dice-halo";return Q.jsxs("div",{className:"dice-board-wrap",children:[r&&Q.jsx("div",{className:R,"aria-hidden":!0}),!r&&q>0&&Q.jsx("div",{className:Y,"aria-hidden":!0}),!r&&G&&Q.jsx("div",{className:j,"aria-hidden":!0},x.current),Q.jsxs("div",{className:"dice-board-canvas","data-testid":"dice-board",children:[D?Q.jsxs("div",{className:"dice-board-canvas__error",role:"alert",children:[Q.jsx("p",{children:"3D rendering unavailable"}),Q.jsx("p",{className:"dice-board-canvas__error-hint",children:"Dice results will show as static images"})]}):S>0&&S<=M?Q.jsx("div",{className:"dice-board-canvas__recovering",role:"status","aria-live":"polite",children:Q.jsxs("p",{children:["Restoring 3D graphics... (attempt ",S,"/",M,")"]})}):Q.jsx(jWA,{onError:()=>{Xw(),setTimeout(()=>{S<M?(f(O=>O+1),E(O=>O+1)):y(!0)},300)},children:Q.jsxs(x5A,{shadows:!0,orthographic:!0,gl:{alpha:!0,antialias:!0,powerPreference:"high-performance"},style:{background:"transparent"},onCreated:({gl:O})=>{if(Xw(),!O||!O.getContext){if(S<M){f(IA=>IA+1),setTimeout(()=>E(IA=>IA+1),300);return}y(!0);return}let $;try{if($=O.getContext(),!$||!$.getShaderPrecisionFormat)throw new Error("Context missing required methods")}catch{try{const uA=O.domElement,KA=uA?.getContext("webgl")||uA?.getContext("webgl2");if(KA){const FA=KA.getExtension("WEBGL_lose_context");if(FA&&(FA.restoreContext(),S<M)){f(RA=>RA+1),setTimeout(()=>E(RA=>RA+1),200);return}}}catch{}S>=M?y(!0):(f(uA=>uA+1),setTimeout(()=>E(uA=>uA+1),300));return}RE=O,S>0&&f(0);try{O.setClearColor(0,0)}catch{}try{O.outputColorSpace=Hn}catch{}try{const IA=Hn??void 0;IA!=null&&(O.outputEncoding=IA)}catch{}try{O.toneMapping=Wk}catch{}try{O.toneMappingExposure=1}catch{}try{O.physicallyCorrectLights=!0}catch{}const gA=O?.domElement;let z=!1;const X=IA=>{try{IA.preventDefault?.()}catch{}r0.error("DiceBoard WebGL context LOST",{retries:S}),z=!0,Xw(),f(0),setTimeout(()=>E(uA=>uA+1),300)},sA=IA=>{try{IA.preventDefault?.()}catch{}r0.info("DiceBoard WebGL context RESTORED"),setTimeout(()=>{y(!1),f(0),E(uA=>uA+1)},300)};try{gA?.addEventListener("webglcontextlost",X,!1),gA?.addEventListener("webglcontextrestored",sA,!1)}catch{}const rA=()=>{z&&(Xw(),setTimeout(()=>E(IA=>IA+1),300))},mA=()=>{try{z&&document.visibilityState==="visible"&&(Xw(),setTimeout(()=>E(IA=>IA+1),300))}catch{}};try{window.addEventListener("pageshow",rA)}catch{}try{document.addEventListener("visibilitychange",mA)}catch{}try{const IA=()=>{try{gA?.removeEventListener("webglcontextlost",X,!1)}catch{}try{gA?.removeEventListener("webglcontextrestored",sA,!1)}catch{}try{window.removeEventListener("pageshow",rA)}catch{}try{document.removeEventListener("visibilitychange",mA)}catch{}RE===O&&(RE=null)},uA=O.dispose?.bind(O);O.dispose=()=>{try{IA()}catch{}uA&&uA()}}catch{}},children:[Q.jsx(GWA,{makeDefault:!0,position:[0,20*Math.cos(a),20*Math.sin(a)],near:.1,far:100,zoom:16,rotation:[-(Math.PI/2-a),0,0]}),Q.jsx(ZWA,{}),Q.jsx("ambientLight",{intensity:.7}),Q.jsx("directionalLight",{position:[6,12,6],intensity:1.1,castShadow:!0}),Q.jsx(iWA,{gravity:[0,-9.8,0],children:Q.jsx(PWA,{rollTrigger:A,results:e,preRollTrigger:i,showDice:s,gameMode:g,gameState:I,noAnimation:!s,chargeLevel:o})})]},c)},`eb-${c}`),k&&k.length>0&&Q.jsx("div",{className:"dice-board-canvas__faces","aria-label":"Dice faces","aria-live":"polite",children:Q.jsx(aO,{dice:k})})]})]})}const WWA=Object.freeze(Object.defineProperty({__proto__:null,default:CaA},Symbol.toStringTag,{value:"Module"})),BaA=50,ZG=BaA/1200,zWA=({disabled:t,busy:A=!1,onClick:e,onPressStart:i,onChargeChange:g,label:I="ROLL"})=>{const n=t||A,o=p.useRef(!1),a=p.useRef(0),r=p.useRef(null),s=p.useRef(g);s.current=g,p.useEffect(()=>()=>{r.current&&clearInterval(r.current)},[]);const B=p.useCallback(()=>{a.current=0,s.current?.(0),r.current&&clearInterval(r.current),r.current=window.setInterval(()=>{a.current=Math.min(1,a.current+ZG),s.current?.(a.current),a.current>=.25&&a.current<.25+ZG*1.5?Xa("Light"):a.current>=.6&&a.current<.6+ZG*1.5?Xa("Medium"):a.current>=.95&&a.current<.95+ZG*1.5&&Xa("Heavy")},BaA)},[]),c=p.useCallback(()=>{r.current&&(clearInterval(r.current),r.current=null),s.current?.(0)},[]),E=p.useCallback(()=>{n||o.current||(o.current=!0,Cg(),i?.(),B())},[n,i,B]),D=p.useRef(0),y=p.useCallback(async()=>{if(o.current){o.current=!1,c(),D.current=Date.now()+400,e();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await Xa("Heavy")}},[e,c]),S=p.useCallback(async f=>{if(o.current||Date.now()<D.current){f.preventDefault();return}if(!n){i?.(),s.current?.(1),e(),s.current?.(0);try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await Xa("Heavy")}},[n,e,i]);return Q.jsx("div",{className:"zentara-roll-wrapper",children:Q.jsxs("button",{type:"button",className:"zentara-roll-btn",onClick:S,onPointerDown:E,onPointerUp:y,onPointerCancel:y,onPointerLeave:y,disabled:n,"aria-label":A?"Rolling dice":"Roll dice","aria-busy":A||void 0,children:[A&&Q.jsx("span",{className:"zentara-roll-spinner","aria-hidden":"true"}),Q.jsx("span",{className:"zentara-roll-halo","aria-hidden":"true"}),Q.jsx("span",{className:"zentara-roll-label","aria-live":"polite",children:A?"...":I})]})})},V9=ke.memo(zWA),VWA=420,XWA=({phase:t,pendingEffect:A,isMyTurn:e,inJail:i,onRoll:g,onBuy:I,onSkipBuy:n,onPayRent:o,onPayTax:a,onResolveCard:r,onPayBail:s,children:B})=>{const c=p.useRef(null),E=p.useRef(t);return p.useEffect(()=>{if(t!==E.current){E.current=t;const D=c.current;if(!D)return;D.style.pointerEvents="none";const y=setTimeout(()=>{D.style.pointerEvents=""},VWA);return()=>{clearTimeout(y),D.style.pointerEvents=""}}},[t]),e?Q.jsxs("div",{className:"zentara-action-bar",ref:c,children:[Q.jsxs("div",{className:"zentara-action-bar__left",children:[t==="pre-roll"&&!i&&Q.jsx(V9,{onClick:g,label:"ROLL DICE"}),t==="pre-roll"&&i&&Q.jsxs(Q.Fragment,{children:[Q.jsx(V9,{onClick:g,label:"ROLL"}),Q.jsx("button",{className:"zentara-btn zentara-btn--secondary",onClick:s,children:"Bribe Guards"})]}),t==="action"&&A?.action==="buy-prompt"&&Q.jsxs(Q.Fragment,{children:[Q.jsxs("button",{className:"zentara-btn zentara-btn--primary",onClick:I,children:["Capture (",A.amount,")"]}),Q.jsx("button",{className:"zentara-btn zentara-btn--secondary",onClick:n,children:"Pass"})]}),t==="action"&&A?.action==="pay-rent"&&Q.jsxs("button",{className:"zentara-btn zentara-btn--danger",onClick:o,children:["Take Damage (",A.amount,")"]}),t==="action"&&A?.action==="pay-tax"&&Q.jsxs("button",{className:"zentara-btn zentara-btn--danger",onClick:a,children:["Pay Levy (",A.amount,")"]}),t==="action"&&A?.action==="draw-card"&&Q.jsxs("div",{className:"zentara-card-prompt",children:[A.cardText&&Q.jsx("span",{className:"zentara-card-prompt__text",children:A.cardText}),Q.jsx("button",{className:`zentara-btn ${(A.amount??0)>=0?"zentara-btn--primary":"zentara-btn--danger"}`,onClick:r,children:(A.amount??0)>=0?`Loot ${A.amount}`:`Pay ${Math.abs(A.amount??0)}`})]})]}),B&&Q.jsx("div",{className:"zentara-action-bar__right",children:B})]}):Q.jsxs("div",{className:"zentara-action-bar",children:[Q.jsx("div",{className:"zentara-action-bar__left",children:Q.jsx("span",{className:"zentara-action-bar__waiting",children:"Waiting for opponent…"})}),B&&Q.jsx("div",{className:"zentara-action-bar__right",children:B})]})},$WA=ke.memo(XWA),AzA={start:"🚀",planet:"⚔️",station:"🛰️",asteroid:"☄️",nebula:"🌌",wormhole:"🌀",tax:"💸",jail:"🔒","go-to-jail":"🕳️","free-parking":"🅿️"},ezA=({tile:t,property:A,ownerName:e})=>{if(!t)return Q.jsx("div",{className:"zentara-tile-card zentara-tile-card--empty",children:Q.jsx("span",{className:"zentara-tile-card__hint",children:"Tap a tile for info"})});const i=t.group?gP[t.group]:"#1e3a5f",g=AzA[t.type]??"✦",I=A!=null,n=t.rent?.[A?.upgradeLevel??0];return Q.jsxs("div",{className:"zentara-tile-card",children:[Q.jsx("div",{className:"zentara-tile-card__accent",style:{background:i}}),Q.jsxs("div",{className:"zentara-tile-card__body",children:[Q.jsxs("div",{className:"zentara-tile-card__header",children:[Q.jsx("span",{className:"zentara-tile-card__icon",children:g}),Q.jsx("span",{className:"zentara-tile-card__name",children:t.name})]}),Q.jsx("div",{className:"zentara-tile-card__status",children:I?`Controlled by ${e??"Unknown"}`:t.cost!=null?"Uncontrolled":t.type.replace("-"," ")}),t.cost!=null&&Q.jsxs("div",{className:"zentara-tile-card__stats",children:["Capture ✦",t.cost,n!=null&&Q.jsxs(Q.Fragment,{children:[" · Damage ✦",n]})]})]})]})},tzA=ke.memo(ezA),izA={position:"fixed",inset:0,zIndex:200,display:"flex",alignItems:"center",justifyContent:"center",background:"rgba(0,0,0,0.7)",backdropFilter:"blur(4px)"},gzA={background:"#0d1b2a",border:"1px solid #1e3a5f",borderRadius:12,padding:20,width:"85vw",maxWidth:340,color:"#c0d0e8",fontFamily:"Rubik, sans-serif"},IzA=({tile:t,property:A,ownerName:e,onClose:i})=>{if(!t)return null;const g=t.group?gP[t.group]:"#1e3a5f";return Q.jsx("div",{style:izA,onClick:i,children:Q.jsxs("div",{style:gzA,onClick:I=>I.stopPropagation(),children:[Q.jsx("div",{style:{height:6,borderRadius:3,background:g,marginBottom:12}}),Q.jsx("h3",{style:{margin:"0 0 8px",fontFamily:"Orbitron, monospace",fontSize:16,color:"#fff"},children:t.name}),Q.jsx("p",{style:{margin:"0 0 4px",fontSize:13,opacity:.7,textTransform:"capitalize"},children:t.type.replace("-"," ")}),t.cost!=null&&Q.jsxs("p",{style:{margin:"4px 0",fontSize:14},children:["Capture Cost: ",Q.jsx("strong",{children:t.cost})," credits"]}),t.rent&&Q.jsxs("div",{style:{fontSize:12,marginTop:8,opacity:.8},children:[Q.jsxs("div",{children:["Damage: ",t.rent[0]]}),t.rent.slice(1).map((I,n)=>Q.jsxs("div",{children:["Arms Lv.",n+1,": ",I]},n))]}),A&&Q.jsxs("div",{style:{marginTop:12,fontSize:13,borderTop:"1px solid #1e3a5f",paddingTop:8},children:[Q.jsxs("div",{children:["Commander: ",e??"Unknown"]}),Q.jsxs("div",{children:["Arms Level: ",A.upgradeLevel]}),A.mortgaged&&Q.jsx("div",{style:{color:"#ff5252"},children:"Decommissioned"})]}),Q.jsx("button",{onClick:i,style:{marginTop:16,width:"100%",padding:"8px 0",borderRadius:6,border:"1px solid #1e3a5f",background:"transparent",color:"#6b7fa3",cursor:"pointer",fontFamily:"Orbitron, monospace"},children:"Close"})]})})},nzA=ke.memo(IzA);function ozA({playerId:t,properties:A,tiles:e}){const i=p.useMemo(()=>{const g=new Set,I=[];for(const n of A){if(n.ownerId!==t)continue;const o=e[n.tileId];o?.group&&!g.has(o.group)&&(g.add(o.group),I.push(gP[o.group]??"#1e3a5f"))}return I},[t,A,e]);return i.length===0?null:Q.jsx("div",{style:{display:"flex",gap:3,justifyContent:"center",marginTop:2},children:i.map((g,I)=>Q.jsx("span",{style:{width:6,height:6,borderRadius:"50%",background:g,display:"inline-block"}},I))})}const azA=({players:t,properties:A,tiles:e,currentPlayerId:i,localPlayerId:g,roundNumber:I})=>{const n=p.useMemo(()=>t.map(r=>({id:r.id,name:r.displayName,balance:r.bankrupt?0:r.credits,avatarUrl:r.avatarUrl})),[t]),o=p.useMemo(()=>({phase:"rolling",banker:"",turnHistory:[],sideBets:[],wagerPool:{totalAmount:0,wagers:[]},currentRollerId:i,bankRoll:null,turnOrder:t.map(r=>r.id),turnIndex:t.findIndex(r=>r.id===i),roundSeq:I,gameMode:"craps"}),[i,t,I]),a=p.useMemo(()=>r=>Q.jsx(ozA,{playerId:r.id,properties:A,tiles:e}),[A,e]);return Q.jsx(Tk,{players:n,meId:g,gameState:o,currentRollerId:i,singlePlayer:!0,hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,renderFacesOverride:a,gameTitle:"Zentara",className:"zentara-player-panel"})},rzA=ke.memo(azA),szA=3e3,CzA=1800,BzA=({players:t,localPlayerId:A,savedState:e,onSaveAndExit:i})=>{const{gameState:g,events:I,pendingEffect:n,rollTrigger:o,actions:a}=SYA(t,e),r=qr(),[s,B]=p.useState(null),c=p.useRef(void 0),E=p.useRef(0),D=p.useCallback(Y=>g.players.find(O=>O.id===Y)?.displayName??"Player",[g.players]),y=p.useCallback(Y=>g.board[Y]?.name??`Tile ${Y}`,[g.board]);p.useEffect(()=>{if(I.length<=E.current){E.current=I.length;return}const Y=I.slice(E.current);E.current=I.length;for(const O of Y){const $="playerId"in O?O.playerId:"payerId"in O?O.payerId:null,gA=$?D($):"Player";switch(O.type){case"buy":r.info(`${gA} captured ${y(O.tileId)}`,`-${O.cost} credits`);break;case"pay-rent":r.info(`${gA} took damage!`,`-${O.amount} credits`);break;case"tax":r.info(`${gA} paid supply levy`,`-${O.amount} credits`);break;case"card":r.info(`${gA} received intel`,O.text);break;case"jail":r.info(`${gA} detained!`,O.reason==="triple-doubles"?"Triple doubles":"");break;case"jail-free":r.info(`${gA} escaped detention`,O.method==="pay"?"Bribed guards":O.method==="roll-doubles"?"Rolled doubles":"Used intel");break;case"upgrade":r.info(`${gA} armed ${y(O.tileId)}`,`Arms Level ${O.level}`);break;case"bankrupt":r.info(`${gA}'s fleet destroyed!`);break}}},[I,A,D,y,r]);const S=p.useRef(n);p.useEffect(()=>{if(n&&n!==S.current&&n.action==="pay-rent"){const Y=n.tileId,O=g.properties.find($=>$.tileId===Y);O&&O.ownerId===A&&r.info("Damage Inflicted!",`+${n.amount} credits`)}S.current=n},[n,g.properties,A]),p.useEffect(()=>(g.currentTurn.phase==="done"&&!g.finished&&(clearTimeout(c.current),c.current=setTimeout(()=>a.endTurn(),CzA)),()=>{clearTimeout(c.current)}),[g.currentTurn.phase,g.finished]);const[f,M]=p.useState(g),k=p.useRef(void 0),m=p.useRef(o);p.useEffect(()=>(o!==m.current?(m.current=o,clearTimeout(k.current),k.current=setTimeout(()=>{M(g)},szA)):M(g),()=>clearTimeout(k.current)),[g,o]);const U=g.players[g.currentPlayerIndex],F=U?.id===A;kYA({isMyTurn:F,phase:g.currentTurn.phase,pendingEffect:n,inJail:U?.inJail??!1,credits:U?.credits??0,actions:a});const b=p.useCallback(Y=>{const O=g.board[Y]??null;B(O)},[g.board]),K=s??g.board[U?.tileIndex??0]??null,R=K?g.properties.find(Y=>Y.tileId===K.id)??null:null,G=R?g.players.find(Y=>Y.id===R.ownerId)?.displayName??null:null,J=p.useCallback(()=>{n&&a.buyProperty(n.tileId)},[n,a.buyProperty]),x=p.useRef(void 0),H=p.useRef(o),P=p.useMemo(()=>{o!==H.current&&(H.current=o,x.current=void 0);const Y=g.currentTurn.diceValues;if(Y){const O=[Y[0],Y[1],0];return x.current=O,O}return x.current},[g.currentTurn.diceValues,o]),j=s?g.properties.find(Y=>Y.tileId===s.id)??null:null,q=j?g.players.find(Y=>Y.id===j.ownerId)?.displayName??null:null;return Q.jsxs("div",{className:"zentara-screen",children:[Q.jsx(rzA,{players:g.players,properties:g.properties,tiles:g.board,currentPlayerId:U?.id??"",localPlayerId:A,roundNumber:g.roundNumber}),Q.jsxs("div",{className:"zentara-game-body",children:[Q.jsx("div",{className:"zentara-board-area",children:Q.jsx(zYA,{gameState:f,onTileClick:b})}),Q.jsxs("div",{className:"zentara-controls-row",children:[Q.jsx("div",{className:"zentara-dice-globe-row",children:Q.jsx(CaA,{isWaiting:!1,rollTrigger:o,results:P,gameMode:"craps"})}),Q.jsxs("div",{className:"zentara-controls-right",children:[Q.jsx(tzA,{tile:K,property:R,ownerName:G}),Q.jsxs("div",{className:"zentara-menu-grid",children:[Q.jsx("button",{className:"zentara-menu-btn",children:"Players"}),Q.jsx("button",{className:"zentara-menu-btn",children:"Intel"}),Q.jsx("button",{className:"zentara-menu-btn",children:"Chat"}),Q.jsx("button",{className:"zentara-menu-btn",onClick:()=>{a.saveGame(),i&&i()},children:"Save & Exit"})]})]})]}),Q.jsx($WA,{phase:g.currentTurn.phase,pendingEffect:n,isMyTurn:F,inJail:U?.inJail??!1,onRoll:a.roll,onBuy:J,onSkipBuy:a.skipBuy,onPayRent:a.payRent,onPayTax:a.payTax,onResolveCard:a.resolveCard,onPayBail:a.payBailAction})]}),Q.jsx(nzA,{tile:s,property:j,ownerName:q,onClose:()=>B(null)}),g.finished&&Q.jsxs("div",{className:"zentara-win-overlay",children:[Q.jsx("div",{className:"zentara-win-title",children:"⚔️ War Over"}),Q.jsxs("div",{className:"zentara-win-name",children:[g.players.find(Y=>Y.id===g.winnerId)?.displayName??"Unknown"," claims victory!"]})]})]})},q1=()=>{const{matchId:t}=by(),A=Di(),e=ke.useMemo(()=>{const g=rIA();return g&&g.matchId===t?g:null},[t]),i=e?e.players.map(g=>({id:g.id,name:g.displayName})):[{id:"local-p1",name:"You"},{id:"local-p2",name:"Opponent"}];return Q.jsx(BzA,{players:i,localPlayerId:"local-p1",savedState:e,onSaveAndExit:()=>A("/lobby")},t)};function czA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby",g=/^\/room\//.test(e)||/^\/poker\/room\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g),(i||g)&&(document.body.classList.remove("profile-page-body"),document.body.classList.remove("messages-page-body"));const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}document.documentElement.scrollTop=0,document.body.scrollTop=0;const o=()=>{const a=document.getElementById("root");a&&(a.scrollTop=0,a.style.removeProperty("overflow"),a.style.removeProperty("overflow-y"));const r=document.querySelector(".home-fixed-root");r&&(r.scrollTop=0,r.style.removeProperty("overflow"),r.style.removeProperty("overflow-y"),r.style.removeProperty("height"),r.style.removeProperty("min-height"))};o(),requestAnimationFrame(()=>{o()})}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/admin",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(Oy,{})}),Q.jsx(Ce,{path:"/room/:roomId",element:Q.jsx(Yk,{})}),Q.jsx(Ce,{path:"/poker",element:Q.jsx(tP,{})}),Q.jsx(Ce,{path:"/poker/mock",element:Q.jsx(iP,{})}),Q.jsx(Ce,{path:"/poker/room/:roomId",element:Q.jsx(eP,{})}),Q.jsx(Ce,{path:"/zentara",element:Q.jsx(IP,{})}),Q.jsx(Ce,{path:"/zentara/match/:matchId",element:Q.jsx(q1,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/button-sandbox",element:Q.jsx(Hk,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/lobby",replace:!0})})]})}function lzA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby",g=/^\/room\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g);const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/admin",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(Oy,{})}),Q.jsx(Ce,{path:"/room/:roomId",element:Q.jsx(Yk,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/button-sandbox",element:Q.jsx(Hk,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/lobby",replace:!0})})]})}function QzA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby",g=/^\/room\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g);const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/admin",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(Oy,{})}),Q.jsx(Ce,{path:"/room/:roomId",element:Q.jsx(Yk,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/button-sandbox",element:Q.jsx(Hk,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/lobby",replace:!0})})]})}function EzA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby",g=/^\/poker\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g);const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/admin",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(Oy,{})}),Q.jsx(Ce,{path:"/poker",element:Q.jsx(tP,{})}),Q.jsx(Ce,{path:"/poker/mock",element:Q.jsx(iP,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/button-sandbox",element:Q.jsx(Hk,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{})}),Q.jsx(Ce,{path:"/poker/room/:roomId",element:Q.jsx(eP,{})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/poker",replace:!0})})]})}const ZY=kWA(t=>({user:null,token:null,roomId:null,seed:null,startAt:null,endAt:null,driftMs:0,gameMode:"wordsearch",letters:void 0,questions:void 0,set:A=>t(A),setSession:A=>t(e=>({...e,roomId:A.roomId??e.roomId,seed:A.seed??e.seed,startAt:A.startAt??e.startAt,endAt:A.endAt??e.endAt,driftMs:A.driftMs??e.driftMs,gameMode:A.gameMode??e.gameMode,letters:A.letters??e.letters,questions:A.questions??e.questions}))}));function caA({letters:t,onSubmit:A,disabled:e,cellSize:i=64,onTap:g}){const I=t.length,n=t[0]?.length??0,[o,a]=p.useState([]),r=p.useRef(!1),s=p.useRef(null),B=(K,R)=>{const G=Math.abs(K.r-R.r),J=Math.abs(K.c-R.c);return G<=1&&J<=1&&!(G===0&&J===0)},c=K=>{if(K.length<2)return!0;for(let R=1;R<K.length;R++)if(!B(K[R-1],K[R]))return!1;return!0},E=p.useCallback(K=>o.findIndex(R=>R.r===K.r&&R.c===K.c),[o]),D=()=>a([]),y=(K,R)=>{const G=s.current;if(!G)return null;const J=G.getBoundingClientRect(),x=J.width/n,H=J.height/I,P=(K-J.left)/x,j=(R-J.top)/H,q=Math.floor(P),Y=Math.floor(j);if(Y<0||Y>=I||q<0||q>=n)return null;if(r.current&&o.length>0){const O=Math.abs(P-q-.5),$=Math.abs(j-Y-.5);if(O+$>.52)return null}return{r:Y,c:q}},S=K=>{if(e)return;if(o.length===0){a([K]),rd({volume:.3}),xt("Light"),g?.(K);return}const R=o[o.length-1];if(!R||R.r===K.r&&R.c===K.c)return;const G=E(K);if(G>=0){G===o.length-2&&(a(J=>J.slice(0,-1)),xt("Light"));return}B(R,K)?(a(J=>[...J,K]),rd({volume:.3}),xt("Light"),g?.(K)):(a(J=>{const x=[...J];let H=x[x.length-1];const P=I+n;for(let j=0;j<P&&!(H.r===K.r&&H.c===K.c);j++){const q=Math.sign(K.r-H.r),Y=Math.sign(K.c-H.c),O={r:H.r+q,c:H.c+Y};if(x.some($=>$.r===O.r&&$.c===O.c))break;x.push(O),H=O}return x}),rd({volume:.3}),xt("Light"),g?.(K))},f=K=>{r.current=!0;const R=y(K.clientX,K.clientY);R&&S(R)},M=K=>{if(!r.current)return;const R=y(K.clientX,K.clientY);R&&S(R)},k=()=>{r.current&&(r.current=!1,o.length>=3&&c(o)&&(xt("Medium"),A(o)),D())},m=(n-1)*3,U=(I-1)*3,F=`min(calc((100vw - 48px - ${m}px) / ${n}), calc((100vh - 180px - ${U}px) / ${I}), calc((100dvh - 180px - ${U}px) / ${I}), ${i}px)`,b=p.useMemo(()=>({gridTemplateColumns:`repeat(${n}, ${F})`,gridTemplateRows:`repeat(${I}, ${F})`,touchAction:"none"}),[n,I,F]);return Q.jsx("div",{ref:s,onPointerDown:f,onPointerMove:M,onPointerUp:k,onPointerCancel:()=>r.current=!1,style:b,className:"skillsGrid",children:t.map((K,R)=>K.map((G,J)=>{const x=E({r:R,c:J}),H=x>=0;return Q.jsxs("div",{className:["skillsCell",H?"skillsCell--selected":"skillsCell--idle",e?"skillsCell--disabled":""].join(" "),style:{width:F,height:F},children:[G,H&&Q.jsx("span",{className:"skillsCellIndex",children:x+1})]},`${R}-${J}`)}))})}function uzA({letters:t,foundWords:A,onSubmit:e,disabled:i,myScore:g=0}){const[I,n]=p.useState(""),[o,a]=p.useState([]),[r,s]=p.useState(null),[B,c]=p.useState(!1);p.useRef(null);const E=p.useMemo(()=>{const f=new Map;for(const M of t)f.set(M,(f.get(M)||0)+1);return f},[t]);p.useCallback(f=>{const M=new Map(E);for(const k of o){const m=t[k];M.set(m,(M.get(m)||0)-1)}for(const k of f.toUpperCase()){const m=M.get(k)||0;if(m<=0)return!1;M.set(k,m-1)}return!0},[E,o,t]);const D=f=>{if(i||B)return;if(o.includes(f)){const k=o.indexOf(f);a(o.slice(0,k)),n(m=>m.slice(0,k))}else a([...o,f]),n(k=>k+t[f]);s(null)},y=()=>{a([]),n(""),s(null)},S=async()=>{if(i||B||I.length<3)return;const f=I.toUpperCase();if(A.includes(f)){s("Already found!");return}c(!0),s(null),e(f),y(),c(!1)};return p.useEffect(()=>{const f=M=>{if(i||B)return;if(M.key==="Enter"){S();return}if(M.key==="Backspace"){o.length>0&&(a(m=>m.slice(0,-1)),n(m=>m.slice(0,-1)));return}if(M.key==="Escape"){y();return}const k=M.key.toUpperCase();if(/^[A-Z]$/.test(k)){const m=t.findIndex((U,F)=>U===k&&!o.includes(F));m!==-1&&(a(U=>[...U,m]),n(U=>U+k),s(null))}};return window.addEventListener("keydown",f),()=>window.removeEventListener("keydown",f)},[i,B,t,o]),Q.jsxs("div",{className:"anagrams-container",children:[Q.jsxs("div",{className:"anagrams-score",children:["Score: ",Q.jsx("strong",{children:g})]}),Q.jsx("div",{className:"anagrams-letters",children:t.map((f,M)=>Q.jsx("button",{className:`anagrams-letter ${o.includes(M)?"selected":""}`,onClick:()=>D(M),disabled:i||B,children:f},M))}),Q.jsxs("div",{className:"anagrams-input-area",children:[Q.jsx("div",{className:"anagrams-current-word",children:I||Q.jsx("span",{className:"placeholder",children:"Tap letters to form a word"})}),r&&Q.jsx("div",{className:"anagrams-error",children:r})]}),Q.jsxs("div",{className:"anagrams-actions",children:[Q.jsx("button",{className:"anagrams-btn clear",onClick:y,disabled:i||B||I.length===0,children:"Clear"}),Q.jsx("button",{className:"anagrams-btn submit",onClick:S,disabled:i||B||I.length<3,children:B?"...":"Submit"})]}),A.length>0&&Q.jsxs("div",{className:"anagrams-found-words",children:[Q.jsxs("div",{className:"found-label",children:["Your words (",A.length,"):"]}),Q.jsx("div",{className:"found-list",children:A.map((f,M)=>Q.jsx("span",{className:"found-word",children:f},M))})]})]})}function hzA({questions:t,currentQuestionIndex:A,onAnswer:e,myAnswers:i={},disabled:g,myScore:I=0}){const[n,o]=p.useState(null),[a,r]=p.useState(!1),[s,B]=p.useState(!1),[c,E]=p.useState(null),D=t[A],y=i[A]!==void 0&&i[A].isCorrect!==void 0,S=i[A];p.useEffect(()=>{o(null),B(!1),E(null),r(!1)},[A]);const f=async m=>{g||a||y||(o(m),r(!0),e(A,m))};p.useEffect(()=>{const m=i[A];m&&m.isCorrect!==void 0&&(E({isCorrect:m.isCorrect,correctIndex:m.correctIndex??-1}),B(!0),r(!1))},[i,A]);const M=m=>{const U=["trivia-answer"];if(y||s){const F=S?.correctIndex??c?.correctIndex,b=S?.answer??n;m===F?U.push("correct"):m===b&&m!==F&&U.push("incorrect")}else n===m&&U.push("selected");return U.join(" ")},k={easy:"#4ade80",medium:"#fbbf24",hard:"#f87171"};return D?Q.jsxs("div",{className:"trivia-container",children:[Q.jsxs("div",{className:"trivia-score",children:["Score: ",Q.jsx("strong",{children:I})]}),Q.jsxs("div",{className:"trivia-progress",children:[Q.jsxs("span",{className:"progress-text",children:["Question ",A+1," of ",t.length]}),Q.jsx("div",{className:"progress-bar",children:Q.jsx("div",{className:"progress-fill",style:{width:`${(A+1)/t.length*100}%`}})})]}),Q.jsxs("div",{className:"trivia-meta",children:[Q.jsx("span",{className:"trivia-category",children:D.category}),Q.jsx("span",{className:"trivia-difficulty",style:{color:k[D.difficulty]},children:D.difficulty.toUpperCase()})]}),Q.jsx("div",{className:"trivia-question",children:D.question}),Q.jsx("div",{className:"trivia-answers",children:D.answers.map((m,U)=>Q.jsxs("button",{className:M(U),onClick:()=>f(U),disabled:g||a||y,children:[Q.jsx("span",{className:"answer-letter",children:String.fromCharCode(65+U)}),Q.jsx("span",{className:"answer-text",children:m}),(y||s)&&Q.jsxs("span",{className:"answer-indicator",children:[U===(S?.correctIndex??c?.correctIndex)&&"✓",U===(S?.answer??n)&&U!==(S?.correctIndex??c?.correctIndex)&&"✗"]})]},U))}),(s||y)&&Q.jsx("div",{className:`trivia-feedback ${S?.isCorrect??c?.isCorrect?"correct":"incorrect"}`,children:S?.isCorrect??c?.isCorrect?"✓ Correct!":"✗ Wrong answer"}),Q.jsx("style",{children:X9})]}):Q.jsxs("div",{className:"trivia-container",children:[Q.jsxs("div",{className:"trivia-complete",children:[Q.jsx("h2",{children:"🎉 Quiz Complete!"}),Q.jsx("p",{children:"Waiting for final results..."})]}),Q.jsx("style",{children:X9})]})}const X9=`
    .trivia-container {
        display: flex;
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 12px;
        max-width: 500px;
        margin: 0 auto;
        overflow-y: auto;
        max-height: calc(100vh - 180px);
        -webkit-overflow-scrolling: touch;
    }
    .trivia-score {
        font-size: 16px;
        color: #ffd700;
        text-align: center;
        width: 100%;
    }
    .trivia-score strong {
        font-size: 20px;
    }
    .trivia-progress {
        width: 100%;
        text-align: center;
    }
    .progress-text {
        font-size: 12px;
        color: #888;
        margin-bottom: 6px;
        display: block;
    }
    .progress-bar {
        height: 4px;
        background: #2a2a4a;
        border-radius: 2px;
        overflow: hidden;
    }
    .progress-fill {
        height: 100%;
        background: linear-gradient(90deg, #4a7c59, #5d9b70);
        transition: width 0.3s ease;
    }
    .trivia-meta {
        display: flex;
        justify-content: space-between;
        width: 100%;
        font-size: 12px;
    }
    .trivia-category {
        color: #888;
        text-transform: uppercase;
        letter-spacing: 1px;
    }
    .trivia-difficulty {
        font-weight: bold;
    }
    .trivia-question {
        font-size: 18px;
        font-weight: 600;
        color: #fff;
        text-align: center;
        line-height: 1.3;
        padding: 12px;
        background: rgba(255,255,255,0.05);
        border-radius: 12px;
        width: 100%;
    }
    .trivia-answers {
        width: 100%;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }
    .trivia-answer {
        display: flex;
        align-items: center;
        gap: 10px;
        padding: 12px 14px;
        background: linear-gradient(145deg, #2a2a4a, #1a1a2e);
        border: 2px solid #4a4a6a;
        border-radius: 10px;
        color: #fff;
        font-size: 15px;
        cursor: pointer;
        transition: all 0.2s ease;
        text-align: left;
    }
    .trivia-answer:hover:not(:disabled) {
        border-color: #6a6a8a;
        transform: translateX(4px);
    }
    .trivia-answer.selected {
        border-color: #5d9b70;
        background: rgba(74, 124, 89, 0.2);
    }
    .trivia-answer.correct {
        border-color: #4ade80;
        background: rgba(74, 222, 128, 0.2);
    }
    .trivia-answer.incorrect {
        border-color: #f87171;
        background: rgba(248, 113, 113, 0.2);
    }
    .trivia-answer:disabled {
        cursor: not-allowed;
        opacity: 0.7;
    }
    .answer-letter {
        width: 28px;
        height: 28px;
        display: flex;
        align-items: center;
        justify-content: center;
        background: rgba(255,255,255,0.1);
        border-radius: 6px;
        font-weight: bold;
        font-size: 14px;
        flex-shrink: 0;
    }
    .answer-text {
        flex: 1;
    }
    .answer-indicator {
        font-size: 18px;
        font-weight: bold;
        flex-shrink: 0;
    }
    .trivia-answer.correct .answer-indicator {
        color: #4ade80;
    }
    .trivia-answer.incorrect .answer-indicator {
        color: #f87171;
    }
    .trivia-feedback {
        font-size: 18px;
        font-weight: bold;
        padding: 12px 24px;
        border-radius: 8px;
        animation: fadeIn 0.3s ease;
    }
    .trivia-feedback.correct {
        color: #4ade80;
        background: rgba(74, 222, 128, 0.1);
    }
    .trivia-feedback.incorrect {
        color: #f87171;
        background: rgba(248, 113, 113, 0.1);
    }
    .trivia-complete {
        text-align: center;
        padding: 40px 20px;
    }
    .trivia-complete h2 {
        font-size: 24px;
        margin-bottom: 8px;
    }
    .trivia-complete p {
        color: #888;
    }
    @keyframes fadeIn {
        from { opacity: 0; transform: translateY(-10px); }
        to { opacity: 1; transform: translateY(0); }
    }
`,dzA={wordsearch:[{title:"Swipe to Form Words",description:"Drag your finger across adjacent letters to create words. Each letter can only be used once per word.",icon:"👆"},{title:"Minimum 3 Letters",description:"Words must be at least 3 letters long. Longer words score more points!",icon:"📝"},{title:"Race the Clock",description:"Find as many words as possible before time runs out. Beat the bot to win!",icon:"⏱️"}],anagrams:[{title:"Unscramble Letters",description:"You'll be given a set of jumbled letters. Form valid words using those letters.",icon:"🔤"},{title:"Type or Tap",description:"Type your words and press Enter to submit. Each valid word earns points.",icon:"⌨️"},{title:"Longer = Better",description:"Longer words score more points. Try to find the longest words possible!",icon:"🏆"}],trivia:[{title:"Answer Questions",description:"You'll be shown multiple choice questions. Select the correct answer.",icon:"❓"},{title:"Speed Matters",description:"Answer quickly! Faster correct answers earn bonus points.",icon:"⚡"},{title:"Stay Sharp",description:"Questions span various topics. Test your knowledge and beat your opponent!",icon:"🧠"}]},pzA=[{title:"Entry Fee",description:"Choose your entry fee before starting. Win double your entry (minus 10% house fee)!",icon:"💰"},{title:"Pick Your Duration",description:"Select 30, 60, or 90 second rounds. Longer rounds = more chances to score.",icon:"⏰"}];function fzA({open:t,onClose:A,gameMode:e="wordsearch"}){const[i,g]=p.useState(0),I=[...dzA[e],...pzA],n=I.length,o=p.useCallback(()=>{nr.set({key:`skillsOnboarding_${e}`,value:"1"}),g(0),A()},[A,e]),a=p.useCallback(()=>{i<n-1?g(E=>E+1):o()},[i,n,o]),r=p.useCallback(()=>{i>0&&g(E=>E-1)},[i]);if(p.useEffect(()=>{t&&g(0)},[t]),p.useEffect(()=>{if(!t)return;const E=D=>{D.key==="Escape"&&o(),(D.key==="ArrowRight"||D.key==="Enter")&&a(),D.key==="ArrowLeft"&&r()};return window.addEventListener("keydown",E),()=>window.removeEventListener("keydown",E)},[t,o,a,r]),p.useEffect(()=>{if(t)try{!!(window.__E2E===!0||window.location?.search?.includes("e2e=1")||window.sessionStorage?.getItem("e2e")==="1")&&(nr.set({key:`skillsOnboarding_${e}`,value:"1"}),setTimeout(()=>A(),0))}catch{}},[t,A,e]),!t)return null;const s=I[i],B=i===n-1,c=e==="wordsearch"?"Word Search":e==="anagrams"?"Anagrams":"Trivia";return Q.jsxs("div",{className:"skills-onb-modal",role:"dialog","aria-modal":"true","aria-label":`How to play ${c}`,children:[Q.jsx("div",{className:"skills-onb-backdrop",onClick:o}),Q.jsxs("div",{className:"skills-onb-card",onClick:E=>E.stopPropagation(),children:[Q.jsx("button",{className:"skills-onb-close",onClick:o,"aria-label":"Close",children:Q.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:Q.jsx("path",{d:"M18 6L6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})}),Q.jsxs("header",{className:"skills-onb-header",children:[Q.jsx("span",{className:"skills-onb-badge",children:c}),Q.jsx("h2",{className:"skills-onb-title",children:"How to Play"})]}),Q.jsxs("div",{className:"skills-onb-content",children:[Q.jsx("div",{className:"skills-onb-icon","aria-hidden":"true",children:s.icon}),Q.jsx("h3",{className:"skills-onb-step-title",children:s.title}),Q.jsx("p",{className:"skills-onb-step-desc",children:s.description})]}),Q.jsx("div",{className:"skills-onb-dots","aria-label":`Step ${i+1} of ${n}`,children:I.map((E,D)=>Q.jsx("button",{className:`skills-onb-dot ${D===i?"active":""}`,onClick:()=>g(D),"aria-label":`Go to step ${D+1}`},D))}),Q.jsxs("div",{className:"skills-onb-actions",children:[i>0&&Q.jsx("button",{className:"skills-onb-btn skills-onb-btn--ghost",onClick:r,children:"Back"}),Q.jsx("button",{className:"skills-onb-btn skills-onb-btn--primary",onClick:a,children:B?"Let's Play!":"Next"})]})]})]})}function DzA(t){const[A,e]=p.useState(!1),[i,g]=p.useState(!1);p.useEffect(()=>{(async()=>{try{const{value:n}=await nr.get({key:`skillsOnboarding_${t}`});e(n!=="1")}catch{e(!0)}g(!0)})()},[t]);const I=p.useCallback(()=>{e(!1)},[]);return{showOnboarding:i&&A,closeOnboarding:I}}const yzA=[50,100,250,500],SzA=[30,60,90];function $9(t,A=8,e=8){let i=2166136261;for(const o of t)i=(i^o.charCodeAt(0))*16777619;const g=()=>((i=Math.imul(i^i>>>13,1274126177))>>>0)/2**32,I="EEEEAAAAIIONNRRTTLLSSUU DD GBCMP FHVWY KJX QZ".replace(/\s/g,""),n=()=>I[Math.floor(g()*I.length)]||"E";return Array.from({length:A},()=>Array.from({length:e},()=>n()))}const wzA=3e3;function mzA({isMultiplayer:t,activeGameMode:A,selectedStake:e,setSelectedStake:i,selectedDuration:g,setSelectedDuration:I,myBalance:n,stakeError:o,hasStarted:a,onStart:r,onShowHelp:s,isAuthenticated:B=!0,onLogin:c,isAdEnabled:E=!1,roomStake:D,roomDuration:y}){const S=E&&t,[f,M]=p.useState(S);p.useEffect(()=>{if(!S){M(!1);return}const m=setTimeout(()=>M(!1),wzA);return()=>clearTimeout(m)},[S]);const k=async m=>{I(m);try{const{Preferences:U}=await pi(async()=>{const{Preferences:F}=await Promise.resolve().then(()=>iC);return{Preferences:F}},void 0,import.meta.url);await U.set({key:"selectedSkillsDuration",value:String(m)})}catch{}};return Q.jsxs("div",{className:"skillsStartContainer",children:[Q.jsxs("div",{className:"skillsStartScrollable",children:[Q.jsx("h2",{className:"skillsStartTitle",children:t?"Skills Lounge":A==="anagrams"?"Anagram Challenge":A==="trivia"?"Trivia Challenge":"Word Search Challenge"}),Q.jsx("p",{className:"skillsStartDesc",children:t?"Click Ready when ready to play!":"Choose your entry fee!"}),t&&(typeof D=="number"||typeof y=="number")&&Q.jsxs("div",{className:"skillsRoomInfo",children:[Q.jsx("p",{className:"skillsRoomInfoTitle",children:"Room Settings"}),Q.jsxs("div",{className:"skillsRoomInfoDetails",children:[typeof D=="number"&&Q.jsxs("span",{className:"skillsRoomInfoItem",children:["💰 ",D===0?"Free Play":`${D.toLocaleString()} Credits`]}),typeof y=="number"&&Q.jsxs("span",{className:"skillsRoomInfoItem",children:["⏱️ ",y," seconds"]}),typeof D=="number"&&D>0&&Q.jsxs("span",{className:"skillsRoomInfoItem skillsRoomInfoWin",children:["🏆 Win: ",Math.floor(D*2*.9).toLocaleString()]})]}),typeof D=="number"&&D>n&&Q.jsxs("p",{className:"skillsRoomInfoWarning",children:["⚠️ You need ",D.toLocaleString()," credits to play"]})]}),!B&&c&&Q.jsxs("div",{className:"promo-banner",role:"region","aria-label":"Login banner",children:[Q.jsx("div",{className:"promo-banner__content",children:Q.jsx("span",{className:"promo-banner__title",children:"Login to save progress"})}),Q.jsx("button",{className:"btn gold-fill",onClick:c,"aria-label":"Login",children:"Login"})]}),Q.jsx("button",{className:"skillsHowToPlay",onClick:s,"aria-label":"How to play",children:"❓ How to Play"}),!t&&Q.jsxs("div",{className:"skillsStakeSelector",children:[Q.jsx("p",{className:"skillsStakeLabel",children:"Entry Fee:"}),Q.jsx("div",{className:"skillsStakeOptions",children:yzA.map(m=>Q.jsx("button",{className:`skillsStakeBtn ${e===m?"selected":""} ${n<m?"disabled":""}`,onClick:()=>i(m),disabled:n<m,children:m},m))}),Q.jsxs("p",{className:"skillsStakePot",children:["Win: ",Q.jsx("span",{className:"skillsStakeWin",children:Math.floor(e*2*.9)})," credits"]})]}),!t&&Q.jsxs("div",{className:"skillsDurationSelector",children:[Q.jsx("p",{className:"skillsDurationLabel",children:"Game Duration:"}),Q.jsx("div",{className:"skillsDurationOptions",children:SzA.map(m=>Q.jsxs("button",{className:`skillsDurationBtn ${g===m?"selected":""}`,onClick:()=>k(m),children:[m,"s"]},m))})]}),o&&Q.jsx("p",{className:"skillsStakeError",children:o})]}),Q.jsx("div",{className:"home-cta buttonRow",children:Q.jsx("div",{className:"skillsStartButtonFixed",children:Q.jsx("button",{id:"btn-play-game",className:"btn gold-fill skillsStartBtn",onClick:r,disabled:f||a||!t&&n<e,style:f?{opacity:.5,pointerEvents:"none"}:void 0,children:t?"Ready Up":`Play for ${e} Credits`})})})]})}const kzA=3e3,MzA=0,fD=new Map,e0=new Map;async function NzA(t){const A=encodeURIComponent(t);try{const e=await fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${A}`);if(e.ok){const g=(await e.json())?.[0]?.meanings?.[0],I=g?.definitions?.[0]?.definition;if(I)return{definition:I,partOfSpeech:g?.partOfSpeech}}}catch{}try{const e=await fetch(`https://en.wiktionary.org/api/rest_v1/page/definition/${A}`);if(e.ok){const i=await e.json(),I=(i?.en??Object.values(i??{})[0])?.[0],n=I?.definitions?.[0]?.definition;if(n)return{definition:n.replace(/<[^>]+>/g,""),partOfSpeech:I?.partOfSpeech?.toLowerCase()}}}catch{}throw new Error("no definition found")}function GzA(t,A){const e=t.toLowerCase();if(fD.has(e))return;fD.set(e,"loading");const i=new Set;e0.set(e,i),i.add(A),NzA(e).then(g=>fD.set(e,g)).catch(()=>fD.set(e,"error")).finally(()=>{e0.get(e)?.forEach(g=>g()),e0.delete(e)})}function AX({word:t,points:A,isValid:e}){const[i,g]=p.useState(!1),[,I]=p.useState(0),n=p.useRef(null),o=p.useRef(null),a=t.toLowerCase();p.useEffect(()=>{const E=()=>I(D=>D+1);return e0.get(a)?.add(E),()=>{e0.get(a)?.delete(E)}},[a]);const r=p.useCallback(()=>{if(i){g(!1);return}g(!0),fD.has(a)||GzA(a,()=>I(E=>E+1))},[i,a]),s=p.useCallback(E=>{(E.key==="Enter"||E.key===" ")&&(E.preventDefault(),r())},[r]);p.useEffect(()=>{if(!i||!n.current||!o.current)return;const E=n.current.getBoundingClientRect(),D=o.current,y=D.getBoundingClientRect();let S=E.left+E.width/2-y.width/2,f=E.top-y.height-10;S=Math.max(8,Math.min(S,window.innerWidth-y.width-8)),f<8&&(f=E.bottom+10),D.style.left=`${S}px`,D.style.top=`${f}px`}),p.useEffect(()=>{if(!i)return;const E=D=>{n.current&&!n.current.contains(D.target)&&g(!1)};return document.addEventListener("pointerdown",E,!0),()=>document.removeEventListener("pointerdown",E,!0)},[i]);const B=e?"roundSummaryWord roundSummaryWordValid":"roundSummaryWord roundSummaryWordInvalid",c=fD.get(a)??null;return Q.jsxs("span",{ref:n,className:`${B} wordDefWrapper`,onClick:r,onKeyDown:s,role:"button",tabIndex:0,children:[t," ",Q.jsxs("small",{children:["(",A,")"]}),i&&Q.jsxs("span",{ref:o,className:"wordDefTooltip",children:[c==="loading"&&Q.jsx("em",{children:"Loading…"}),c==="error"&&Q.jsx("em",{children:"Definition not available"}),c&&typeof c=="object"&&Q.jsxs(Q.Fragment,{children:[c.partOfSpeech&&Q.jsx("strong",{className:"wordDefPos",children:c.partOfSpeech}),Q.jsx("span",{className:"wordDefText",children:c.definition})]})]})]})}function RzA({myScore:t,players:A,scores:e,winnerId:i,iWon:g,isDraw:I,winnings:n,selectedStake:o,isMultiplayer:a,meId:r,roundSummary:s,winStreak:B,isAdEnabled:c=!1,onPlayAgain:E}){const D=c?kzA:MzA,[y,S]=p.useState(D>0);p.useEffect(()=>{if(D<=0){S(!1);return}const F=setTimeout(()=>S(!1),D);return()=>clearTimeout(F)},[D]);const f=s?.playerWords&&Object.keys(s.playerWords).length>0||s?.rejectedWords&&Object.keys(s.rejectedWords).length>0,M=s?.playerAnswers&&s?.questions&&Object.keys(s.playerAnswers).length>0,k=F=>F===r?"You":A.find(K=>K.id===F)?.name||"Bot",m=[...A].sort((F,b)=>F.id===r?-1:b.id===r?1:(e[b.id]??0)-(e[F.id]??0)),U=i?k(i):void 0;return Q.jsxs("div",{className:"roundEnd",children:[Q.jsxs("div",{className:"roundEndRow",style:{flexWrap:"wrap",gap:"0.25rem 0.75rem"},children:[m.map(F=>Q.jsxs("span",{className:"roundEndScore",style:F.id===i?{color:"var(--gold, #f5c542)"}:void 0,children:[k(F.id),": ",Q.jsx("strong",{children:e[F.id]??0})]},F.id)),Q.jsxs("span",{className:"roundEndResult",children:[g?"🏆 You Win!":I?"🤝 Draw":`😔 ${U??"Opponent"} Wins`,g&&n>0&&Q.jsxs("span",{className:"roundEndWinnings",children:["+",n.toLocaleString()]}),!g&&!I&&Q.jsxs("span",{className:"roundEndLoss",children:["-",o]})]}),g&&B>=2&&Q.jsxs("div",{className:"roundEndStreak",children:[Q.jsx("span",{className:"roundEndStreakFire",children:"🔥"}),Q.jsx("span",{className:"roundEndStreakCount",children:B}),Q.jsx("span",{className:"roundEndStreakLabel",children:"Win Streak!"})]})]}),Q.jsx("div",{className:"home-cta buttonRow",children:Q.jsx("button",{id:"btn-play-again",className:"btn gold-fill cta-btn primaryButton",onClick:E,disabled:y,style:y?{opacity:.5,pointerEvents:"none"}:void 0,children:a?"Ready Up":"Play Again"})}),f&&Q.jsxs("div",{className:"roundSummaryScrollable",children:[Q.jsx("p",{className:"roundSummaryTitle",children:"Words Found"}),(()=>{const F=new Set([...Object.keys(s?.playerWords||{}),...Object.keys(s?.rejectedWords||{})]);return Array.from(F).map(b=>{const K=k(b),R=s?.playerWords?.[b]||[],G=s?.rejectedWords?.[b]||[];return Q.jsxs("div",{className:"roundSummaryPlayer",children:[Q.jsxs("span",{className:"roundSummaryLabel",children:[K,":"]}),Q.jsxs("div",{className:"roundSummaryWordsList",children:[R.length>0?R.map((J,x)=>Q.jsx(AX,{word:J.word,points:J.points,isValid:!0},x)):!G.length&&Q.jsx("span",{className:"roundSummaryNone",children:"No words"}),G.length>0&&G.map((J,x)=>Q.jsx(AX,{word:J,points:0,isValid:!1},`rej-${x}`))]})]},b)})})()]}),M&&Q.jsxs("div",{className:"roundSummaryScrollable",children:[Q.jsx("p",{className:"roundSummaryTitle",children:"Answers"}),Object.entries(s.playerAnswers).map(([F,b])=>{const K=k(F);return Q.jsxs("div",{className:"roundSummaryPlayer",children:[Q.jsxs("span",{className:"roundSummaryLabel",children:[K,":"]}),Q.jsx("div",{className:"roundSummaryAnswersList",children:b.length>0?b.map((R,G)=>Q.jsxs("span",{className:`roundSummaryAnswer ${R.correct?"roundSummaryAnswerCorrect":"roundSummaryAnswerWrong"}`,children:["Q",R.questionIndex+1,": ",R.correct?"✓":"✗"]},G)):Q.jsx("span",{className:"roundSummaryNone",children:"No answers"})})]},F)})]})]})}function UzA({countdown:t}){return Q.jsx("div",{className:"skillsCountdownOverlay",children:Q.jsx("div",{className:"skillsCountdownNumber",children:t})})}function KzA({readyCount:t,totalPlayers:A}){return Q.jsxs("div",{className:"skillsWaitingContainer",children:[Q.jsx("div",{className:"skillsWaitingSpinner"}),Q.jsxs("p",{className:"skillsWaitingText",children:["Waiting for players... (",t,"/",A," ready)"]})]})}function FzA({message:t}){return Q.jsx("div",{className:"skillsInvalidWord",children:Q.jsx("span",{className:"skillsInvalidWordText",children:t})})}function bzA({onRetry:t}){return Q.jsx("div",{className:"card alertCard",role:"alert",children:Q.jsxs("div",{className:"alertRow",children:[Q.jsx("span",{className:"alertText",children:"⚠️ Connection lost. Reconnecting…"}),Q.jsx("button",{className:"btn btn-secondary alertBtn",onClick:t,children:"Retry"})]})})}function vzA(t){const{meId:A,setConnected:e,setScores:i,setRoundEnded:g,setWinnerId:I,setPlayers:n,setGameState:o,setHasStarted:a,setWinnings:r,setWinStreak:s,setRoundSummary:B,setMyAnagramWords:c,setClaimedWordPaths:E,setMyTriviaAnswers:D,setCurrentTriviaQuestion:y,setCountdown:S,isMultiplayer:f,roundEnded:M,endRef:k,onWordClaimed:m}=t,{setSession:U}=ZY(),{win:F,lose:b}=qr(),{onHandEnd:K}=zy(),R=p.useCallback(G=>{const J=new Set;return G.filter(x=>!x?.id||J.has(x.id)?!1:(J.add(x.id),!0))},[]);$n({onSkillsRejoinedRoom:G=>{if(G?.room){if(G.room.players){const J=R(G.room.players);n(J)}G.room.gameState&&(o(G.room.gameState),G.room.gameState.scores&&i(G.room.gameState.scores)),e(!0)}},onPlayerPresenceUpdate:G=>{if(!G)return;const{playerId:J,status:x}=G;!J||!x||J===A&&e(x==="active")},onSkillsSessionInfo:G=>{U({roomId:G.roomId,seed:G.seed,startAt:G.startAt,endAt:G.endAt,driftMs:G.driftMs,gameMode:G.gameMode||"wordsearch",letters:G.letters,questions:G.questions}),E([]),c([]),y(0),D({})},onAnagramsWordFound:G=>{G.playerId===A&&c(J=>[...J,G.word])},onTriviaAnswer:G=>{G.playerId===A&&D(J=>({...J,[G.questionIndex]:{answer:G.questionIndex,isCorrect:G.isCorrect,correctIndex:G.correctIndex}}))},onTriviaNextQuestion:G=>{y(G.questionIndex)},onRoomUpdateState:G=>{const J=new Set(["skills","wordsearch","anagrams","trivia"]),x=G.room?.gameMode||G.gameState?.gameMode||G.room?.gameState?.gameMode;if(!x||!J.has(x))return;const H=G.room?.players||[],P=R(H);P.length>0&&n(O=>{const $=new Map;return O.forEach(gA=>{typeof gA.balance=="number"&&$.set(gA.id,gA.balance)}),P.map(gA=>{if(typeof gA.balance=="number")return gA;const z=$.get(gA.id);return typeof z=="number"?{...gA,balance:z}:gA})});const j=G.gameState||{};o(j),j.phase==="playing"&&j.seed&&!ZY.getState().seed&&U({roomId:G.room?.id,seed:j.seed,startAt:j.startAt,endAt:j.endAt,gameMode:j.gameMode,letters:j.anagramsData?.letters,questions:j.triviaData?.questions?.map(O=>({id:O.id,question:O.question,answers:O.answers,category:O.category,difficulty:O.difficulty}))});const q=G.gameState?.phase,Y=G.gameState?.readyMap?.[A||""]||!1;q==="waiting"&&!M&&(I(void 0),r(0),Y||a(!1),i({}),B(null),E([]),c([]),D({}),y(0)),q!=="playing"&&!M&&G.gameState?.scores&&i(G.gameState.scores)},onSkillsRoundStart:G=>{i({}),g(!1),I(void 0),B(null),E([]),c([]),D({}),y(0),U({roomId:G.roomId,seed:G.seed,startAt:G.startAt,endAt:G.endAt}),f&&(a(!0),S(3))},onSkillsScoreUpdate:G=>{G.scores&&i(G.scores)},onSkillsRoundEnd:G=>{if(g(!0),G.scores&&i(G.scores),G.winnerId)if(I(G.winnerId),G.winnerId===A){Nx();const J=typeof G.winnings=="number"?G.winnings:0;F("Winner!",J>0?`+Z$${J.toLocaleString()}`:void 0)}else Gx(),b("Better Luck Next Time");typeof G.winnings=="number"&&r(G.winnings),s(typeof G.winnerStreak=="number"?G.winnerStreak:0),B({playerWords:G.playerWords,rejectedWords:G.rejectedWords,playerAnswers:G.playerAnswers,questions:G.questions}),k.current=Date.now(),K()},onPlayerBalanceUpdated:({playerId:G,balance:J})=>{n(x=>{if(!Array.isArray(x))return x;const H=x.findIndex(q=>String(q.id)===String(G));if(H===-1)return x;const P=x.slice(),j=P[H];return typeof j?.balance=="number"&&j.balance===J?x:(P[H]={...j,balance:J},P)})},onOtherPlayerJoined:G=>{if(!G?.room?.players)return;const J=new Set(["skills","wordsearch","anagrams","trivia"]),x=G.room?.gameMode||G.gameState?.gameMode||G.room?.gameState?.gameMode;if(!x||!J.has(x))return;const H=G.room.players||[],P=R(H);n(P)},onOtherLeft:G=>{if(!G?.room?.players)return;const J=new Set(["skills","wordsearch","anagrams","trivia"]),x=G.room?.gameMode||G.gameState?.gameMode||G.room?.gameState?.gameMode;if(!x||!J.has(x))return;const H=G.room.players||[],P=R(H);n(P),G.gameState&&o(G.gameState)},onSkillsWordClaimed:G=>{m?.(G)}})}let _zA=!1;function eX(t,A){try{_zA||l2()}catch{}}let WG=null,JzA=1;function LzA(){return WG||(WG=Dm(n0||"",{path:"/socket.io",transports:["websocket","polling"],autoConnect:!1,reconnection:!0,reconnectionAttempts:1/0,withCredentials:!0,auth:{platform:"web"}}),WG)}async function qzA(){const t=LzA();try{const A=await Nn();t.auth={...t.auth||{},platform:"web",token:A}}catch{}t.connected||t.connect()}function xzA(){return JzA++}function TzA(){return n0}const tX=TzA();async function YzA(){if(!tX)return null;try{let t;try{t=await Nn()}catch{}const A={Accept:"application/json"};t&&(A.Authorization=`Bearer ${t}`);const e=await fetch(`${tX}/api/auth/me`,{credentials:"include",headers:A});if(e.ok)return await e.json();if(e.status===204||e.status===401){if(e.status===401&&t)try{await Hd()}catch{}return null}return null}catch{return null}}function HzA({endAt:t,isActive:A,totalSeconds:e=30}){const[i,g]=p.useState(e),I=p.useRef(null);p.useEffect(()=>{if(!A||!t){g(e),I.current&&(cancelAnimationFrame(I.current),I.current=null);return}const s=()=>{const B=Date.now(),c=Math.max(0,Math.ceil((t-B)/1e3));g(c),c>0?I.current=requestAnimationFrame(s):I.current=null};return s(),()=>{I.current&&(cancelAnimationFrame(I.current),I.current=null)}},[t,A,e]);const n=A&&t!==void 0,o=i<=15,a=i<=5,r=i/e*100;return Q.jsxs("div",{className:["poker-turn-timer",n?"":"poker-turn-timer--hidden",o?"poker-turn-timer--urgent":"",a?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!n,children:[Q.jsxs("div",{className:"poker-turn-timer__ring",children:[Q.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[Q.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),Q.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${r} 100`})]}),Q.jsx("div",{className:"poker-turn-timer__number",children:i})]}),Q.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Time Left"})]})}function OzA(t){const{endAt:A,isRoundActive:e,scores:i,meId:g}=t,I=p.useMemo(()=>Q.jsx(HzA,{endAt:A,isActive:!!e&&!!A,totalSeconds:30}),[A,e]),n=p.useMemo(()=>{if(!(!i||!e))return o=>{const a=i[o.id]??0,r=o.id===g;return Q.jsxs("div",{className:`skills-player-score ${r?"skills-player-score--me":""}`,children:[Q.jsx("span",{className:"skills-score-value",children:a}),Q.jsx("span",{className:"skills-score-label",children:"pts"})]})}},[i,e,g]);return Q.jsx(Tk,{...t,className:"skills-player-panel",hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerCommsLeftSlot:I,renderFacesOverride:n})}function sF(){const{roomId:t,seed:A,startAt:e,endAt:i,driftMs:g,setSession:I,set:n,user:o,gameMode:a,letters:r,questions:s}=ZY(),{meId:B,user:c}=Yi(),E=Xn(),{cancelAd:D,isAdEnabled:y}=zy(),S=Di(),[f]=C2(),{roomId:M}=by(),k=M||f.get("roomId"),m=f.get("mode"),U=f.get("e2e")==="1",[F,b]=p.useState(!0),[K,R]=p.useState({}),G=p.useRef(!1),[J,x]=p.useState(!1),[H,P]=p.useState(),[j,q]=p.useState([]),[Y,O]=p.useState({}),[$,gA]=p.useState(!1),[z,X]=p.useState(null),[sA,rA]=p.useState(null),[mA,IA]=p.useState(null),[uA,KA]=p.useState(100),[FA,RA]=p.useState(30),[MA,oA]=p.useState(null),[AA,tA]=p.useState(0),[iA,hA]=p.useState(0),[DA,dA]=p.useState(),[SA,NA]=p.useState(),[OA,Qe]=p.useState(!1),[nA,eA]=p.useState(void 0),[UA,HA]=p.useState(null),{active:Se,fire:ne,onComplete:Oe}=VO(),VA=p.useRef(0),de=["loss-a","loss-b","loss-c"],te=()=>{const ZA=de[VA.current%de.length];return VA.current+=1,ZA},[WA,_A]=p.useState(m||"wordsearch"),[zA,ge]=p.useState([]),[he,ve]=p.useState(0),[bA,pA]=p.useState({}),[Re,CA]=p.useState([]),EA=p.useRef(null);p.useRef(null);const yA=p.useRef({});yA.current=K;const xA=p.useRef(null),XA=p.useRef(null),{skillsSubmit:pe,skillsSingleStart:be,skillsReady:It,skillsJoinRoom:Ut,anagramsSubmit:pg,triviaAnswer:Ge}=OI(),{joinRoom:lt,leaveRoom:Rt}=Xc(),Yt=p.useRef(Rt);Yt.current=Rt;const st=B||o?.id;p.useEffect(()=>{n({seed:null,startAt:null,endAt:null,roomId:null,letters:void 0,questions:void 0}),xA.current=null,XA.current=null},[]),p.useEffect(()=>{if(!E)return;const ZA=()=>{xA.current=null,ti.current=!1};return E.on("connect",ZA),()=>{E.off("connect",ZA)}},[E]),p.useEffect(()=>{if(!k)return;const ZA=()=>{xA.current=null};return window.addEventListener("ad:complete",ZA),()=>{window.removeEventListener("ad:complete",ZA)}},[k]),p.useEffect(()=>{if(m){_A(m);return}(async()=>{try{const{Preferences:ZA}=await pi(async()=>{const{Preferences:$e}=await Promise.resolve().then(()=>iC);return{Preferences:$e}},void 0,import.meta.url),{value:Le}=await ZA.get({key:"selectedSkillsGameMode"});(Le==="wordsearch"||Le==="anagrams"||Le==="trivia")&&_A(Le)}catch{}})()},[m]),p.useEffect(()=>{(async()=>{try{const{Preferences:ZA}=await pi(async()=>{const{Preferences:Nt}=await Promise.resolve().then(()=>iC);return{Preferences:Nt}},void 0,import.meta.url),{value:Le}=await ZA.get({key:"selectedSkillsDuration"}),$e=parseInt(Le||"",10);($e===30||$e===60||$e===90)&&RA($e)}catch{}})()},[]),p.useEffect(()=>{(async()=>{try{const ZA=await jo();ZA.botDifficultyLevel&&ZA.botDifficultyLevel>=1&&ZA.botDifficultyLevel<=9&&eA(ZA.botDifficultyLevel)}catch{}})()},[]);const Be=c?.balance??0,jA=!!c,Me=(()=>{try{return c?.isGuest===!0}catch{return!1}})(),We=!jA||Me,at=p.useCallback(()=>S("/login"),[S]),kA=st?K[st]??0:0,ae=j.find(ZA=>ZA.id!==st),Ye=ae?.id,Pt=ae?.name||"Bot";Ye&&K[Ye];const jt=!!k;j.find(ZA=>ZA.id===st)?.isReady||Y?.readyMap?.[st||""];const QA=p.useMemo(()=>{const ZA=new Set;let Le=j.filter(Nt=>!Nt?.id||ZA.has(Nt.id)?!1:(ZA.add(Nt.id),!0)).map(Nt=>Nt.id===st&&typeof Nt.balance!="number"&&typeof c?.balance=="number"?{...Nt,balance:c.balance}:Nt);const $e=typeof st=="string"&&st.length>0;return Le.length===0&&$e&&c&&(Le=[{id:st,name:c.name||c.email||"You",balance:c.balance??0,avatarUrl:c.avatarUrl??void 0}]),Le},[j,st,c?.balance,c?.name,c?.email,c?.avatarUrl,c]),JA=Y?.everyoneReady||!1,ee=Y?.phase||"waiting",GA=m||Y?.gameMode||a||WA,{showOnboarding:oe,closeOnboarding:Xe}=DzA(GA),Qt=U?"demo-screenshot-seed-12345":null,nt=A||Y?.seed||Qt,Dt=U?"playing":ee,it=r||Y?.anagramsData?.letters,Mt=s||Y?.triviaData?.questions,Zt=Dt==="playing"&&!!nt&&!J&&GA==="wordsearch",Ri=Dt==="playing"&&!J&&GA==="anagrams"&&((it?.length??0)>0||U),Ui=Dt==="playing"&&!J&&GA==="trivia"&&((Mt?.length??0)>0||U),qi=p.useCallback(ZA=>{CA(Le=>Le.some($e=>$e.word===ZA.word)?Le:[...Le,{word:ZA.word,playerId:ZA.playerId,path:ZA.path}])},[]);vzA({meId:st,setConnected:b,setScores:R,setRoundEnded:x,setWinnerId:P,setPlayers:q,setGameState:O,setHasStarted:gA,setWinnings:tA,setWinStreak:hA,setRoundSummary:HA,setMyAnagramWords:ge,setClaimedWordPaths:CA,setMyTriviaAnswers:pA,setCurrentTriviaQuestion:ve,setCountdown:X,onWordClaimed:qi,isMultiplayer:jt,roundEnded:J,endRef:EA}),p.useEffect(()=>{if(J||!st)return;const ZA=K[st]??0,Le=Object.entries(K).filter(([Nt])=>Nt!==st).map(([,Nt])=>Nt),$e=Math.max(0,...Le);$e>0&&ZA<$e&&(G.current=!0)},[K,st,J]),p.useEffect(()=>{if(!J||!H||!st)return;if(!(H===st)){ne(te(),{displayMs:2e3});return}const Le=K[st]??0,$e=Object.entries(K).filter(([wi])=>wi!==st).map(([,wi])=>wi),Nt=Math.max(0,...$e);Nt===0&&Le>0?ne("skills-perfect",{displayMs:3e3}):Nt>0&&Le>=Nt*2?ne("skills-dominate",{displayMs:2500}):G.current?ne("skills-comeback",{displayMs:3e3}):iA>=3?ne("streak-3",{displayMs:2500}):ne("big-win",{displayMs:2500}),G.current=!1},[J,H,st,K,iA,ne]),p.useEffect(()=>{const ZA=Y;ZA?.phase==="playing"&&Array.isArray(ZA?.claimedWords)&&ZA.claimedWords.length>0&&CA(ZA.claimedWords)},[Y]),p.useEffect(()=>{$||A?pd():J||MF({volume:.0125})},[$,J,A]);const ei=p.useRef(k);p.useEffect(()=>{ei.current!==k&&(HA(null),x(!1),P(void 0),tA(0),R({}),G.current=!1,CA([]),ge([]),ve(0),pA({}),ei.current=k)},[k]),p.useEffect(()=>{k&&xA.current!==k&&(xA.current=k,Ut(k).then(async ZA=>{if(ZA?.ok&&ZA?.data){if(n({roomId:ZA.data.roomId}),ZA.data.room?.players){const Le=ZA.data.room.players,$e=new Set,Nt=Le.filter(wi=>!wi?.id||$e.has(wi.id)?!1:($e.add(wi.id),!0));q(Nt)}if(ZA.data.room?.gameState&&O(ZA.data.room.gameState),XA.current!==k)try{await lt(k),XA.current=k}catch{}}else xA.current=null}).catch(()=>{xA.current=null}))},[k,Ut,n,lt]),p.useEffect(()=>()=>{XA.current&&Yt.current()},[]),p.useEffect(()=>{l2(),YzA().then(ZA=>n({user:ZA}))},[n]),p.useEffect(()=>{if(!i||J||!$)return;const ZA=()=>{Date.now()+g>=i&&!J&&$&&x(!0)};ZA();const Le=i-(Date.now()+g);if(Le>0){const $e=setTimeout(ZA,Le+3e3);return()=>clearTimeout($e)}},[i,g,J,$]),p.useEffect(()=>{if(!$)return;let ZA;(async()=>{try{const{App:$e}=await pi(async()=>{const{App:wi}=await Promise.resolve().then(()=>Z6);return{App:wi}},void 0,import.meta.url),Nt=await $e.addListener("appStateChange",wi=>{if(wi.isActive){const Mg=Date.now()+g;i&&Mg>=i&&!J&&$&&x(!0)}});ZA=()=>{try{Nt.remove()}catch{}}}catch{}})();const Le=()=>{if(document.visibilityState==="visible"){const $e=Date.now()+g;i&&$e>=i&&!J&&$&&x(!0)}};return document.addEventListener("visibilitychange",Le),()=>{ZA?.(),document.removeEventListener("visibilitychange",Le)}},[i,g,J,$]);const yt=Date.now()+g,Si=!!i&&yt<(i??0),ti=p.useRef(!1),Xg=p.useCallback(async()=>{if(!ti.current){ti.current=!0;try{const ZA=await be(uA,GA,FA,nA);ZA&&!ZA.ok?(ti.current=!1,gA(!1),X(null),ZA.error!=="insufficient_balance"&&ZA.error!=="already_starting"&&oA(ZA.error||"Failed to start game")):ZA?.data?(ti.current=!1,ZA.data.spLevel&&dA(ZA.data.spLevel),ZA.data.levelName&&NA(ZA.data.levelName),I({...ZA.data,gameMode:ZA.data.gameMode||GA}),O(Le=>({...Le,phase:"playing",gameMode:ZA.data.gameMode||GA,stake:ZA.data.stake,pot:ZA.data.pot}))):ti.current=!1}catch{ti.current=!1}}},[be,uA,FA,GA,nA]),cI=p.useCallback(async()=>{if(oA(null),jt){const ZA=k||t;ZA&&(D(),gA(!0),await It(ZA));return}if(!$&&Be<uA){oA(`Insufficient balance. Need ${uA} credits.`);return}pd(),gA(!0),X(3)},[jt,uA,GA,m,WA,a,Y?.gameMode,Be,k,t,It,D]),bg=p.useCallback(async()=>{ti.current=!1,n({seed:null,startAt:null,endAt:null,roomId:null,letters:void 0,questions:void 0}),x(!1),gA(!0),X(null),tA(0),R({}),G.current=!1,CA([]),P(void 0),HA(null),ge([]),ve(0),pA({}),jt&&k?(D(),await It(k)):(gA(!1),q([]),O({}))},[n,jt,k,It,D]);p.useEffect(()=>{if(z===null)return;if(z>0&&rd({volume:.3}),z===0){rd({volume:.5}),X(null),jt||Xg();return}const ZA=setTimeout(()=>{X(Le=>Le!==null&&Le>0?Le-1:null)},1e3);return()=>clearTimeout(ZA)},[z,Xg,jt]);const yo=p.useMemo(()=>A?$9(A):[],[A]),ci=p.useMemo(()=>Re.filter(ZA=>ZA.playerId===st).map(ZA=>ZA.word),[Re,st]),vg=p.useMemo(()=>Re.filter(ZA=>ZA.playerId!==st).map(ZA=>ZA.word),[Re,st]),Zg=p.useCallback(async ZA=>{!Si||!t||J||ZA.length<3||await pg(t,ZA.toUpperCase())},[Si,t,J,pg]),fg=p.useCallback(async(ZA,Le)=>{!Si||!t||J||(pA($e=>({...$e,[ZA]:{answer:Le,isCorrect:void 0,correctIndex:void 0}})),await Ge(t,ZA,Le))},[Si,t,J,Ge]),kg=async ZA=>{if(!Si||!t||J||ZA.length<3)return;const Le=ZA.map(({r:wi,c:Mg})=>yo[wi]?.[Mg]||"").join("").toUpperCase();if(Le.length<3)return;const $e=xzA();eX("word_submit",{len:ZA.length});const Nt=await pe(t,ZA,Le,Date.now(),$e);Nt&&Nt.valid?(IA("valid"),_lA({volume:.4}),setTimeout(()=>IA(null),400)):Nt&&!Nt.valid&&(IA("invalid"),setTimeout(()=>IA(null),400),Nt.error==="invalid_word"?rA(`"${Le}" is not a word`):Nt.error==="word_already_used"?rA(`"${Le}" already used`):Nt.error==="word_claimed"?rA(`"${Le}" already taken`):(Nt.error==="path_not_contiguous"||Nt.error==="path_has_duplicates")&&rA("Invalid path"),setTimeout(()=>rA(null),800))},Qn=ZA=>{eX()},fI=!Zt&&!Ri&&!Ui&&!$&&!J,Ao=$&&!Zt&&!Ri&&!Ui&&jt&&!JA&&!J,wa=j.filter(ZA=>Y?.readyMap?.[ZA.id]).length,sr=j.length,Ds=H===st,ce=!H&&J,ze=p.useMemo(()=>({...Y,gameMode:"skills"}),[Y]),At=`skillsPage${mA==="valid"?" skillsFlashValid":""}${mA==="invalid"?" skillsFlashInvalid":""}`;return Q.jsxs("main",{className:At,children:[Q.jsx(OzA,{players:QA,gameState:ze,roomId:t||k||"",meId:st||"",endAt:i??void 0,isRoundActive:Si,scores:K,hideAvatars:fI}),Q.jsx("div",{className:"skillsBody",children:Q.jsxs("div",{className:"skillsContainer",children:[!F&&Q.jsx(bzA,{onRetry:()=>qzA()}),fI&&Q.jsx(mzA,{isMultiplayer:jt,activeGameMode:GA,selectedStake:uA,setSelectedStake:KA,selectedDuration:FA,setSelectedDuration:RA,myBalance:Be,stakeError:MA,hasStarted:$,onStart:cI,onShowHelp:()=>Qe(!0),isAuthenticated:!We,onLogin:at,isAdEnabled:y,roomStake:Y?.stake,roomDuration:Y?.duration}),Ao&&Q.jsx(KzA,{readyCount:wa,totalPlayers:sr}),z!==null&&Q.jsx(UzA,{countdown:z}),sA&&Q.jsx(FzA,{message:sA}),Zt&&Q.jsx("section",{className:"card gridCard",children:Q.jsx(caA,{letters:$9(nt),onSubmit:kg,onTap:Qn,disabled:!Si||J||U})}),Zt&&(ci.length>0||vg.length>0)&&Q.jsxs("div",{className:"foundWordsList",children:[ci.length>0&&Q.jsxs("div",{className:"foundWordsColumn foundWordsColumn--me",children:[Q.jsx("span",{className:"foundWordsLabel",children:"You"}),Q.jsx("div",{className:"foundWordsTags",children:ci.map(ZA=>Q.jsx("span",{className:"foundWordTag foundWordTag--me",children:ZA},ZA))})]}),vg.length>0&&Q.jsxs("div",{className:"foundWordsColumn foundWordsColumn--opp",children:[Q.jsx("span",{className:"foundWordsLabel",children:Pt}),Q.jsx("div",{className:"foundWordsTags",children:vg.map(ZA=>Q.jsx("span",{className:"foundWordTag foundWordTag--opp",children:ZA},ZA))})]})]}),Ri&&it&&Q.jsx(uzA,{letters:it,foundWords:zA,onSubmit:Zg,disabled:!Si||J,myScore:kA}),Ui&&Mt&&Q.jsx(hzA,{questions:Mt,currentQuestionIndex:he,onAnswer:fg,myAnswers:bA,disabled:!Si||J,myScore:kA}),J&&Q.jsx(RzA,{myScore:kA,players:QA,scores:K,winnerId:H,iWon:Ds,isDraw:ce,winnings:AA,selectedStake:uA,isMultiplayer:jt,roundSummary:UA,meId:st,winStreak:iA,isAdEnabled:y,onPlayAgain:bg})]})}),Q.jsx(fzA,{open:oe||OA,onClose:()=>{Xe(),Qe(!1)},gameMode:GA}),Se&&Q.jsx(zO,{show:!0,variant:Se.variant,displayMs:Se.displayMs,zoomDurationMs:Se.zoomDurationMs,fadeDurationMs:Se.fadeDurationMs,ariaLabel:Se.ariaLabel,onComplete:Oe})]})}function PzA({startAt:t,endAt:A,driftMs:e=0}){const[i,g]=p.useState(()=>Date.now());p.useEffect(()=>{const a=setInterval(()=>g(Date.now()),100);return()=>clearInterval(a)},[]);const I=p.useMemo(()=>A?Math.max(0,A-(i+e)):0,[i,A,e]),n=Math.ceil(I/1e3),o=n<=10?"text-red-500":n<=20?"text-yellow-500":"text-casino-gold";return Q.jsxs("div",{"aria-live":"polite",className:`text-3xl font-bold ${o} transition-colors duration-300 drop-shadow-lg`,children:[n,"s"]})}function jzA(t,A=8,e=8){let i=2166136261;for(const o of t)i=(i^o.charCodeAt(0))*16777619;const g=()=>((i=Math.imul(i^i>>>13,1274126177))>>>0)/2**32,I="EEEEAAAAIIONNRRTTLLSSUU DD GBCMP FHVWY KJX QZ".replace(/\s/g,""),n=()=>I[Math.floor(g()*I.length)]||"E";return Array.from({length:A},()=>Array.from({length:e},()=>n()))}function laA(){const{roomId:t}=by(),A=Di(),{meId:e}=Yi(),[i,g]=p.useState(null),[I,n]=p.useState(null),[o,a]=p.useState([]),[r,s]=p.useState([]),[B,c]=p.useState(!1),[E,D]=p.useState(!0),[y,S]=p.useState(null),[f,M]=p.useState(!1),[k,m]=p.useState(null),{skillsSpectatorJoin:U,skillsSpectatorLeave:F}=OI(),b=p.useRef(!1);$n({onSkillsSpectatorState:z=>{z.roomId===t&&(g(z.room),n(z.gameState),a(z.room?.players||[]),s(z.room?.spectators||[]),c(z.isSpectator??!0),D(!1),S(null))},onSkillsSpectatorUpdate:z=>{z.roomId===t&&(n(z.gameState),z.players&&a(z.players),z.spectators&&s(z.spectators))},onSkillsSpectatorJoined:z=>{z.roomId===t&&z.spectator&&!r.find(X=>X.id===z.spectator.id)&&s(X=>[...X,z.spectator])},onSkillsSpectatorLeft:z=>{z.roomId===t&&s(X=>X.filter(sA=>sA.id!==z.spectatorId))},onSkillsScoreUpdate:z=>{z.roomId===t&&n(X=>X&&{...X,scores:z.scores})},onSkillsRoundEnd:z=>{z.roomId===t&&(M(!0),z.winnerId&&m(z.winnerId),z.scores&&n(X=>X&&{...X,scores:z.scores,phase:"finished"}))},onSkillsRoundStart:z=>{z.roomId===t&&(M(!1),m(null),n(X=>X&&{...X,phase:"playing",seed:z.seed,startAt:z.startAt,endAt:z.endAt,scores:{}}))}}),p.useEffect(()=>{if(!(!t||b.current))return b.current=!0,U(t).then(z=>{z.ok||(S(z.error||"Failed to join as spectator"),D(!1))}).catch(z=>{S("Failed to join as spectator"),D(!1)}),()=>{F(t),b.current=!1}},[t,U,F]);const K=p.useMemo(()=>I?.seed?jzA(I.seed):null,[I?.seed]),R=o[0],G=o[1],J=R?I?.scores[R.id]??0:0,x=G?I?.scores[G.id]??0:0,H=I?.wordsearchData?.foundWords[R?.id]||I?.anagramsData?.foundWords[R?.id]||[],P=I?.wordsearchData?.foundWords[G?.id]||I?.anagramsData?.foundWords[G?.id]||[],j=I?.triviaData?.playerAnswers[R?.id]||{},q=I?.triviaData?.playerAnswers[G?.id]||{},Y=I?.gameMode||"wordsearch",O=I?.phase==="playing",$=I?.phase==="waiting",gA=I?.phase==="finished"||f;return E?Q.jsxs("div",{className:"skills-spectate-loading",children:[Q.jsx("div",{className:"skills-loading-spinner"}),Q.jsx("p",{children:"Joining as spectator..."})]}):y?Q.jsxs("div",{className:"skills-spectate-error",children:[Q.jsx("h2",{children:"Unable to Spectate"}),Q.jsx("p",{children:y}),Q.jsx("button",{onClick:()=>A("/lobby"),children:"Return to Lobby"})]}):Q.jsxs("div",{className:"skills-spectate-container",children:[Q.jsxs("div",{className:"skills-spectate-header",children:[Q.jsxs("div",{className:"spectator-badge",children:[Q.jsx("span",{className:"spectator-icon",children:"👁️"}),Q.jsx("span",{children:"Spectating"})]}),Q.jsx("button",{className:"spectate-leave-btn",onClick:()=>A("/lobby"),children:"Leave"})]}),r.length>0&&Q.jsxs("div",{className:"spectator-count",children:[r.length," spectator",r.length!==1?"s":""," watching"]}),$&&Q.jsx("div",{className:"skills-spectate-waiting",children:Q.jsx("h3",{children:"Waiting for players to ready up..."})}),O&&I?.endAt&&Q.jsx("div",{className:"skills-spectate-timer",children:Q.jsx(PzA,{endAt:I.endAt})}),Q.jsxs("div",{className:"skills-spectate-players",children:[Q.jsxs("div",{className:"skills-spectate-player player-1",children:[Q.jsxs("div",{className:"spectator-player-info",children:[Q.jsx("span",{className:"spectator-player-name",children:R?.name||"Player 1"}),Q.jsxs("span",{className:"spectator-player-score",children:[J," pts"]})]}),(Y==="wordsearch"||Y==="anagrams")&&H.length>0&&Q.jsxs("div",{className:"spectator-words",children:[Q.jsxs("h4",{children:["Words Found: ",H.length]}),Q.jsx("div",{className:"words-list",children:H.slice(-5).map((z,X)=>Q.jsx("span",{className:"found-word",children:z},X))})]}),Y==="trivia"&&Q.jsx("div",{className:"spectator-trivia-progress",children:Q.jsxs("span",{children:["Questions answered: ",Object.keys(j).length]})})]}),Q.jsxs("div",{className:"skills-spectate-center",children:[Y==="wordsearch"&&K&&O&&Q.jsx("div",{className:"spectator-grid",children:Q.jsx(caA,{letters:K,onSubmit:()=>{},disabled:!0,cellSize:40})}),Y==="anagrams"&&I?.anagramsData&&O&&Q.jsx("div",{className:"spectator-anagrams",children:Q.jsx("div",{className:"anagram-letters",children:I.anagramsData.letters.map((z,X)=>Q.jsx("span",{className:"letter-tile",children:z},X))})}),Y==="trivia"&&I?.triviaData&&O&&Q.jsx("div",{className:"spectator-trivia",children:Q.jsxs("div",{className:"trivia-question",children:[Q.jsxs("span",{className:"question-number",children:["Q",I.triviaData.currentQuestion+1," / ",I.triviaData.questions.length]}),Q.jsx("p",{children:I.triviaData.questions[I.triviaData.currentQuestion]?.question})]})}),gA&&Q.jsxs("div",{className:"spectator-result",children:[Q.jsxs("h2",{children:[k===R?.id?R?.name:G?.name," Wins!"]}),Q.jsxs("div",{className:"final-scores",children:[Q.jsxs("span",{children:[R?.name,": ",J]}),Q.jsxs("span",{children:[G?.name,": ",x]})]})]})]}),Q.jsxs("div",{className:"skills-spectate-player player-2",children:[Q.jsxs("div",{className:"spectator-player-info",children:[Q.jsx("span",{className:"spectator-player-name",children:G?.name||"Player 2"}),Q.jsxs("span",{className:"spectator-player-score",children:[x," pts"]})]}),(Y==="wordsearch"||Y==="anagrams")&&P.length>0&&Q.jsxs("div",{className:"spectator-words",children:[Q.jsxs("h4",{children:["Words Found: ",P.length]}),Q.jsx("div",{className:"words-list",children:P.slice(-5).map((z,X)=>Q.jsx("span",{className:"found-word",children:z},X))})]}),Y==="trivia"&&Q.jsx("div",{className:"spectator-trivia-progress",children:Q.jsxs("span",{children:["Questions answered: ",Object.keys(q).length]})})]})]}),Q.jsxs("div",{className:"skills-spectate-mode",children:[Y==="wordsearch"&&"🔤 Word Search",Y==="anagrams"&&"🔠 Anagrams",Y==="trivia"&&"❓ Trivia"]})]})}function ZzA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby"||e==="/",g=/^\/skills\/(play|room)/.test(e)||/^\/room\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g);const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(Oy,{})}),Q.jsx(Ce,{path:"/room/:roomId",element:Q.jsx(Yk,{})}),Q.jsx(Ce,{path:"/skills/play",element:Q.jsx(sF,{})}),Q.jsx(Ce,{path:"/skills/room/:roomId",element:Q.jsx(sF,{})}),Q.jsx(Ce,{path:"/skills/spectate/:roomId",element:Q.jsx(laA,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{defaultMode:"skills"})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/lobby",replace:!0})})]})}function WzA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby",g=/^\/room\//.test(e)||/^\/poker\/room\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g);const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/admin",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(Oy,{})}),Q.jsx(Ce,{path:"/room/:roomId",element:Q.jsx(Yk,{})}),Q.jsx(Ce,{path:"/poker",element:Q.jsx(tP,{})}),Q.jsx(Ce,{path:"/poker/mock",element:Q.jsx(iP,{})}),Q.jsx(Ce,{path:"/poker/room/:roomId",element:Q.jsx(eP,{})}),Q.jsx(Ce,{path:"/skills/play",element:Q.jsx(sF,{})}),Q.jsx(Ce,{path:"/skills/room/:roomId",element:Q.jsx(sF,{})}),Q.jsx(Ce,{path:"/skills/spectate/:roomId",element:Q.jsx(laA,{})}),Q.jsx(Ce,{path:"/zentara",element:Q.jsx(IP,{})}),Q.jsx(Ce,{path:"/zentara/match/:matchId",element:Q.jsx(q1,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/button-sandbox",element:Q.jsx(Hk,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/lobby",replace:!0})})]})}function zzA(){const t=Di(),A=ln();return p.useEffect(()=>{const i=new URLSearchParams(window.location.search).get("redirect");i&&t(i),Kr()},[t]),p.useEffect(()=>{Kr(A.pathname)},[A.pathname]),p.useEffect(()=>{try{const e=A.pathname||"",i=e==="/lobby",g=/^\/match\//.test(e);(()=>{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",i),document.body.classList.toggle("page-gameroom",g);const n=document.documentElement;if(i||g){n.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),n.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),n.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else n.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),n.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),n.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[A.pathname]),Q.jsxs(Yd,{children:[Q.jsxs(Ce,{element:Q.jsx(Vd,{}),children:[Q.jsx(Ce,{path:"/verify",element:Q.jsx(gp,{})}),Q.jsx(Ce,{path:"/review-login",element:Q.jsx(Ip,{})}),Q.jsx(Ce,{path:"/qa-login",element:Q.jsx(np,{})}),Q.jsx(Ce,{path:"/login",element:Q.jsx(zd,{})}),Q.jsx(Ce,{path:"/verification-failed",element:Q.jsx(Pd,{})})]}),Q.jsx(Ce,{path:"/add-chips",element:Q.jsx(ip,{})}),Q.jsxs(Ce,{element:Q.jsx(Od,{}),children:[Q.jsx(Ce,{path:"/profile",element:Q.jsx($d,{})}),Q.jsx(Ce,{path:"/player/:playerId",element:Q.jsx(Ap,{})}),Q.jsx(Ce,{path:"/messages",element:Q.jsx(ep,{})}),Q.jsx(Ce,{path:"/settings",element:Q.jsx(tp,{})}),Q.jsx(Ce,{path:"/admin",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/",element:Q.jsx(An,{to:"/lobby",replace:!0})}),Q.jsx(Ce,{path:"/lobby",element:Q.jsx(IP,{})}),Q.jsx(Ce,{path:"/zentara/match/:matchId",element:Q.jsx(q1,{})})]}),Q.jsx(Ce,{path:"/disclaimer",element:Q.jsx(op,{})}),Q.jsx(Ce,{path:"/support",element:Q.jsx(ap,{})}),Q.jsx(Ce,{path:"/privacy",element:Q.jsx(rp,{})}),Q.jsx(Ce,{path:"/terms",element:Q.jsx(sp,{})}),Q.jsx(Ce,{path:"/how-to-play",element:Q.jsx(pu,{})}),Q.jsx(Ce,{path:"*",element:Q.jsx(An,{to:"/lobby",replace:!0})})]})}const VzA="ceelolounge",iX=$CA.toLowerCase(),XzA=new Set(["","verify","auth","ceelolounge","review-login","qa-login"]);function Ix(t){return!t||t.length===0||t.length>2048||!/^[A-Za-z0-9._-]+$/.test(t)?null:t}function $zA(t){try{const A=new URL(t),e=A.protocol.replace(":","").toLowerCase(),i=(A.hostname||"").toLowerCase(),g=(A.pathname||"").toLowerCase(),I=e===VzA,n=A.protocol==="https:",o=g.endsWith("/verify")||g.includes("/auth/verify"),a=g.endsWith("/review-login")||g.includes("/review-login"),r=g.endsWith("/qa-login")||g.includes("/qa-login");if(I){if(!XzA.has(i)||!o&&!a&&!r&&!(i==="verify"||i==="review-login"||i==="qa-login")&&!((i===""||i==="ceelolounge")&&(g==="/"||g==="")))return null}else if(n){if(iX&&i!==iX||!o&&!a&&!r)return null}else return null;const s=Ix(A.searchParams.get("token"));if(s)return s;const B=g.split("/").filter(Boolean),c=B.lastIndexOf("verify");return c>=0&&B[c+1]?Ix(B[c+1]):B.length===1&&!["verify","auth","review-login","qa-login"].includes(B[0])?Ix(B[0]):null}catch{return null}}function AVA(){const t=Di(),A=p.useRef(null);return p.useEffect(()=>{let e;const i=g=>{if(!g||A.current===g)return;const I=$zA(g);if(I){A.current=g;try{const n=new URL(g),o=(n.pathname||"").toLowerCase(),a=(n.hostname||"").toLowerCase(),r=o.includes("/review-login")||a==="review-login"?"/review-login":o.includes("/qa-login")||a==="qa-login"?"/qa-login":"/verify";t(`${r}?token=${encodeURIComponent(I)}`,{replace:!0})}catch{t(`/verify?token=${encodeURIComponent(I)}`,{replace:!0})}}};return er.getLaunchUrl().then(g=>i(g?.url)).catch(()=>{}),(async()=>e=await er.addListener("appUrlOpen",({url:g})=>i(g)))(),()=>e?.remove?.()},[t]),null}function eVA(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 tVA(){const{info:t}=qr();return $n({onCrapsBetError:A=>{try{const{title:e,subtitle:i}=eVA(A);t(e,i)}catch{}}}),null}function x1(t,{strict:A=!0}={}){return!t||typeof t!="string"?!1:A?/^0x[0-9a-fA-F]*$/.test(t):t.startsWith("0x")}function gX(t){return x1(t,{strict:!1})?Math.ceil((t.length-2)/2):t.length}const QaA="2.37.9";let nx={getDocsUrl:({docsBaseUrl:t,docsPath:A="",docsSlug:e})=>A?`${t??"https://viem.sh"}${A}${e?`#${e}`:""}`:void 0,version:`viem@${QaA}`},KB=class WY extends Error{constructor(A,e={}){const i=e.cause instanceof WY?e.cause.details:e.cause?.message?e.cause.message:e.details,g=e.cause instanceof WY&&e.cause.docsPath||e.docsPath,I=nx.getDocsUrl?.({...e,docsPath:g}),n=[A||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...I?[`Docs: ${I}`]:[],...i?[`Details: ${i}`]:[],...nx.version?[`Version: ${nx.version}`]:[]].join(`
`);super(n,e.cause?{cause:e.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=i,this.docsPath=g,this.metaMessages=e.metaMessages,this.name=e.name??this.name,this.shortMessage=A,this.version=QaA}walk(A){return EaA(this,A)}};function EaA(t,A){return A?.(t)?t:t&&typeof t=="object"&&"cause"in t&&t.cause!==void 0?EaA(t.cause,A):A?null:t}class iVA extends KB{constructor({address:A}){super(`Address "${A}" is invalid.`,{metaMessages:["- Address must be a hex value of 20 bytes (40 hex characters).","- Address must match its checksum counterpart."],name:"InvalidAddressError"})}}class uaA extends KB{constructor({size:A,targetSize:e,type:i}){super(`${i.charAt(0).toUpperCase()}${i.slice(1).toLowerCase()} size (${A}) exceeds padding size (${e}).`,{name:"SizeExceedsPaddingSizeError"})}}function aS(t,{dir:A,size:e=32}={}){return typeof t=="string"?gVA(t,{dir:A,size:e}):IVA(t,{dir:A,size:e})}function gVA(t,{dir:A,size:e=32}={}){if(e===null)return t;const i=t.replace("0x","");if(i.length>e*2)throw new uaA({size:Math.ceil(i.length/2),targetSize:e,type:"hex"});return`0x${i[A==="right"?"padEnd":"padStart"](e*2,"0")}`}function IVA(t,{dir:A,size:e=32}={}){if(e===null)return t;if(t.length>e)throw new uaA({size:t.length,targetSize:e,type:"bytes"});const i=new Uint8Array(e);for(let g=0;g<e;g++){const I=A==="right";i[I?g:e-g-1]=t[I?g:t.length-g-1]}return i}class nVA extends KB{constructor({max:A,min:e,signed:i,size:g,value:I}){super(`Number "${I}" is not in safe ${g?`${g*8}-bit ${i?"signed":"unsigned"} `:""}integer range ${A?`(${e} to ${A})`:`(above ${e})`}`,{name:"IntegerOutOfRangeError"})}}class oVA extends KB{constructor({givenSize:A,maxSize:e}){super(`Size cannot exceed ${e} bytes. Given size: ${A} bytes.`,{name:"SizeOverflowError"})}}function oM(t,{size:A}){if(gX(t)>A)throw new oVA({givenSize:gX(t),maxSize:A})}const aVA=Array.from({length:256},(t,A)=>A.toString(16).padStart(2,"0"));function u6A(t,A={}){return typeof t=="number"||typeof t=="bigint"?my(t,A):typeof t=="string"?daA(t,A):typeof t=="boolean"?rVA(t,A):haA(t,A)}function rVA(t,A={}){const e=`0x${Number(t)}`;return typeof A.size=="number"?(oM(e,{size:A.size}),aS(e,{size:A.size})):e}function haA(t,A={}){let e="";for(let g=0;g<t.length;g++)e+=aVA[t[g]];const i=`0x${e}`;return typeof A.size=="number"?(oM(i,{size:A.size}),aS(i,{dir:"right",size:A.size})):i}function my(t,A={}){const{signed:e,size:i}=A,g=BigInt(t);let I;i?e?I=(1n<<BigInt(i)*8n-1n)-1n:I=2n**(BigInt(i)*8n)-1n:typeof t=="number"&&(I=BigInt(Number.MAX_SAFE_INTEGER));const n=typeof I=="bigint"&&e?-I-1n:0;if(I&&g>I||g<n){const a=typeof t=="bigint"?"n":"";throw new nVA({max:I?`${I}${a}`:void 0,min:`${n}${a}`,signed:e,size:i,value:`${t}${a}`})}const o=`0x${(e&&g<0?(1n<<BigInt(i*8))+BigInt(g):g).toString(16)}`;return i?aS(o,{size:i}):o}const sVA=new TextEncoder;function daA(t,A={}){const e=sVA.encode(t);return haA(e,A)}const CVA=new TextEncoder;function BVA(t,A={}){return typeof t=="number"||typeof t=="bigint"?lVA(t,A):typeof t=="boolean"?cVA(t,A):x1(t)?paA(t,A):faA(t,A)}function cVA(t,A={}){const e=new Uint8Array(1);return e[0]=Number(t),typeof A.size=="number"?(oM(e,{size:A.size}),aS(e,{size:A.size})):e}const Jl={zero:48,nine:57,A:65,F:70,a:97,f:102};function IX(t){if(t>=Jl.zero&&t<=Jl.nine)return t-Jl.zero;if(t>=Jl.A&&t<=Jl.F)return t-(Jl.A-10);if(t>=Jl.a&&t<=Jl.f)return t-(Jl.a-10)}function paA(t,A={}){let e=t;A.size&&(oM(e,{size:A.size}),e=aS(e,{dir:"right",size:A.size}));let i=e.slice(2);i.length%2&&(i=`0${i}`);const g=i.length/2,I=new Uint8Array(g);for(let n=0,o=0;n<g;n++){const a=IX(i.charCodeAt(o++)),r=IX(i.charCodeAt(o++));if(a===void 0||r===void 0)throw new KB(`Invalid byte sequence ("${i[o-2]}${i[o-1]}" in "${i}").`);I[n]=a*16+r}return I}function lVA(t,A){const e=my(t,A);return paA(e)}function faA(t,A={}){const e=CVA.encode(t);return typeof A.size=="number"?(oM(e,{size:A.size}),aS(e,{dir:"right",size:A.size})):e}const zG=BigInt(2**32-1),nX=BigInt(32);function QVA(t,A=!1){return A?{h:Number(t&zG),l:Number(t>>nX&zG)}:{h:Number(t>>nX&zG)|0,l:Number(t&zG)|0}}function EVA(t,A=!1){const e=t.length;let i=new Uint32Array(e),g=new Uint32Array(e);for(let I=0;I<e;I++){const{h:n,l:o}=QVA(t[I],A);[i[I],g[I]]=[n,o]}return[i,g]}const uVA=(t,A,e)=>t<<e|A>>>32-e,hVA=(t,A,e)=>A<<e|t>>>32-e,dVA=(t,A,e)=>A<<e-32|t>>>64-e,pVA=(t,A,e)=>t<<e-32|A>>>64-e;/*! noble-hashes - MIT License (c) 2022 Paul Miller (paulmillr.com) */function fVA(t){return t instanceof Uint8Array||ArrayBuffer.isView(t)&&t.constructor.name==="Uint8Array"}function oX(t){if(!Number.isSafeInteger(t)||t<0)throw new Error("positive integer expected, got "+t)}function CF(t,...A){if(!fVA(t))throw new Error("Uint8Array expected");if(A.length>0&&!A.includes(t.length))throw new Error("Uint8Array expected of length "+A+", got length="+t.length)}function aX(t,A=!0){if(t.destroyed)throw new Error("Hash instance has been destroyed");if(A&&t.finished)throw new Error("Hash#digest() has already been called")}function DVA(t,A){CF(t);const e=A.outputLen;if(t.length<e)throw new Error("digestInto() expects output buffer of length at least "+e)}function yVA(t){return new Uint32Array(t.buffer,t.byteOffset,Math.floor(t.byteLength/4))}function DaA(...t){for(let A=0;A<t.length;A++)t[A].fill(0)}const SVA=new Uint8Array(new Uint32Array([287454020]).buffer)[0]===68;function wVA(t){return t<<24&4278190080|t<<8&16711680|t>>>8&65280|t>>>24&255}function mVA(t){for(let A=0;A<t.length;A++)t[A]=wVA(t[A]);return t}const rX=SVA?t=>t:mVA;function kVA(t){if(typeof t!="string")throw new Error("string expected");return new Uint8Array(new TextEncoder().encode(t))}function yaA(t){return typeof t=="string"&&(t=kVA(t)),CF(t),t}class MVA{}function NVA(t){const A=i=>t().update(yaA(i)).digest(),e=t();return A.outputLen=e.outputLen,A.blockLen=e.blockLen,A.create=()=>t(),A}const GVA=BigInt(0),$w=BigInt(1),RVA=BigInt(2),UVA=BigInt(7),KVA=BigInt(256),FVA=BigInt(113),SaA=[],waA=[],maA=[];for(let t=0,A=$w,e=1,i=0;t<24;t++){[e,i]=[i,(2*e+3*i)%5],SaA.push(2*(5*i+e)),waA.push((t+1)*(t+2)/2%64);let g=GVA;for(let I=0;I<7;I++)A=(A<<$w^(A>>UVA)*FVA)%KVA,A&RVA&&(g^=$w<<($w<<BigInt(I))-$w);maA.push(g)}const kaA=EVA(maA,!0),bVA=kaA[0],vVA=kaA[1],sX=(t,A,e)=>e>32?dVA(t,A,e):uVA(t,A,e),CX=(t,A,e)=>e>32?pVA(t,A,e):hVA(t,A,e);function _VA(t,A=24){const e=new Uint32Array(10);for(let i=24-A;i<24;i++){for(let n=0;n<10;n++)e[n]=t[n]^t[n+10]^t[n+20]^t[n+30]^t[n+40];for(let n=0;n<10;n+=2){const o=(n+8)%10,a=(n+2)%10,r=e[a],s=e[a+1],B=sX(r,s,1)^e[o],c=CX(r,s,1)^e[o+1];for(let E=0;E<50;E+=10)t[n+E]^=B,t[n+E+1]^=c}let g=t[2],I=t[3];for(let n=0;n<24;n++){const o=waA[n],a=sX(g,I,o),r=CX(g,I,o),s=SaA[n];g=t[s],I=t[s+1],t[s]=a,t[s+1]=r}for(let n=0;n<50;n+=10){for(let o=0;o<10;o++)e[o]=t[n+o];for(let o=0;o<10;o++)t[n+o]^=~e[(o+2)%10]&e[(o+4)%10]}t[0]^=bVA[i],t[1]^=vVA[i]}DaA(e)}class T1 extends MVA{constructor(A,e,i,g=!1,I=24){if(super(),this.pos=0,this.posOut=0,this.finished=!1,this.destroyed=!1,this.enableXOF=!1,this.blockLen=A,this.suffix=e,this.outputLen=i,this.enableXOF=g,this.rounds=I,oX(i),!(0<A&&A<200))throw new Error("only keccak-f1600 function is supported");this.state=new Uint8Array(200),this.state32=yVA(this.state)}clone(){return this._cloneInto()}keccak(){rX(this.state32),_VA(this.state32,this.rounds),rX(this.state32),this.posOut=0,this.pos=0}update(A){aX(this),A=yaA(A),CF(A);const{blockLen:e,state:i}=this,g=A.length;for(let I=0;I<g;){const n=Math.min(e-this.pos,g-I);for(let o=0;o<n;o++)i[this.pos++]^=A[I++];this.pos===e&&this.keccak()}return this}finish(){if(this.finished)return;this.finished=!0;const{state:A,suffix:e,pos:i,blockLen:g}=this;A[i]^=e,(e&128)!==0&&i===g-1&&this.keccak(),A[g-1]^=128,this.keccak()}writeInto(A){aX(this,!1),CF(A),this.finish();const e=this.state,{blockLen:i}=this;for(let g=0,I=A.length;g<I;){this.posOut>=i&&this.keccak();const n=Math.min(i-this.posOut,I-g);A.set(e.subarray(this.posOut,this.posOut+n),g),this.posOut+=n,g+=n}return A}xofInto(A){if(!this.enableXOF)throw new Error("XOF is not possible for this instance");return this.writeInto(A)}xof(A){return oX(A),this.xofInto(new Uint8Array(A))}digestInto(A){if(DVA(A,this),this.finished)throw new Error("digest() was already called");return this.writeInto(A),this.destroy(),A}digest(){return this.digestInto(new Uint8Array(this.outputLen))}destroy(){this.destroyed=!0,DaA(this.state)}_cloneInto(A){const{blockLen:e,suffix:i,outputLen:g,rounds:I,enableXOF:n}=this;return A||(A=new T1(e,i,g,n,I)),A.state32.set(this.state32),A.pos=this.pos,A.posOut=this.posOut,A.finished=this.finished,A.rounds=I,A.suffix=i,A.outputLen=g,A.enableXOF=n,A.destroyed=this.destroyed,A}}const JVA=(t,A,e)=>NVA(()=>new T1(A,t,e)),LVA=JVA(1,136,256/8);function qVA(t,A){return LVA(x1(t,{strict:!1})?BVA(t):t)}class Y1 extends Map{constructor(A){super(),Object.defineProperty(this,"maxSize",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.maxSize=A}get(A){const e=super.get(A);return super.has(A)&&e!==void 0&&(this.delete(A),super.set(A,e)),e}set(A,e){if(super.set(A,e),this.maxSize&&this.size>this.maxSize){const i=this.keys().next().value;i&&this.delete(i)}return this}}const xVA=/^0x[a-fA-F0-9]{40}$/,ox=new Y1(8192);function TVA(t,A){const{strict:e=!0}=A??{},i=`${t}.${e}`;if(ox.has(i))return ox.get(i);const g=xVA.test(t)?t.toLowerCase()===t?!0:e?MaA(t)===t:!0:!1;return ox.set(i,g),g}const ax=new Y1(8192);function MaA(t,A){if(ax.has(`${t}.${A}`))return ax.get(`${t}.${A}`);const e=t.substring(2).toLowerCase(),i=qVA(faA(e)),g=e.split("");for(let n=0;n<40;n+=2)i[n>>1]>>4>=8&&g[n]&&(g[n]=g[n].toUpperCase()),(i[n>>1]&15)>=8&&g[n+1]&&(g[n+1]=g[n+1].toUpperCase());const I=`0x${g.join("")}`;return ax.set(`${t}.${A}`,I),I}function gd(t,A){if(!TVA(t,{strict:!1}))throw new iVA({address:t});return MaA(t,A)}function YVA(t){return typeof t=="string"?{address:t,type:"json-rpc"}:t}const hd=(t,A,e)=>JSON.stringify(t,(i,g)=>typeof g=="bigint"?g.toString():g,e),H1=t=>t;class t0 extends KB{constructor({body:A,cause:e,details:i,headers:g,status:I,url:n}){super("HTTP request failed.",{cause:e,details:i,metaMessages:[I&&`Status: ${I}`,`URL: ${H1(n)}`,A&&`Request body: ${hd(A)}`].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=A,this.headers=g,this.status=I,this.url=n}}class NaA extends KB{constructor({body:A,error:e,url:i}){super("RPC Request failed.",{cause:e,details:e.message,metaMessages:[`URL: ${H1(i)}`,`Request body: ${hd(A)}`],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=e.code,this.data=e.data}}class BX extends KB{constructor({body:A,url:e}){super("The request took too long to respond.",{details:"The request timed out.",metaMessages:[`URL: ${H1(e)}`,`Request body: ${hd(A)}`],name:"TimeoutError"})}}const HVA=-1;class xr extends KB{constructor(A,{code:e,docsPath:i,metaMessages:g,name:I,shortMessage:n}){super(n,{cause:A,docsPath:i,metaMessages:g||A?.metaMessages,name:I||"RpcError"}),Object.defineProperty(this,"code",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.name=I||A.name,this.code=A instanceof NaA?A.code:e??HVA}}class fs extends xr{constructor(A,e){super(A,e),Object.defineProperty(this,"data",{enumerable:!0,configurable:!0,writable:!0,value:void 0}),this.data=e.data}}class V0 extends xr{constructor(A){super(A,{code:V0.code,name:"ParseRpcError",shortMessage:"Invalid JSON was received by the server. An error occurred on the server while parsing the JSON text."})}}Object.defineProperty(V0,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32700});class X0 extends xr{constructor(A){super(A,{code:X0.code,name:"InvalidRequestRpcError",shortMessage:"JSON is not a valid request object."})}}Object.defineProperty(X0,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32600});class $0 extends xr{constructor(A,{method:e}={}){super(A,{code:$0.code,name:"MethodNotFoundRpcError",shortMessage:`The method${e?` "${e}"`:""} does not exist / is not available.`})}}Object.defineProperty($0,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32601});class Ak extends xr{constructor(A){super(A,{code:Ak.code,name:"InvalidParamsRpcError",shortMessage:["Invalid parameters were provided to the RPC method.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(Ak,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32602});class ky extends xr{constructor(A){super(A,{code:ky.code,name:"InternalRpcError",shortMessage:"An internal error was received."})}}Object.defineProperty(ky,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32603});class ek extends xr{constructor(A){super(A,{code:ek.code,name:"InvalidInputRpcError",shortMessage:["Missing or invalid parameters.","Double check you have provided the correct parameters."].join(`
`)})}}Object.defineProperty(ek,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32e3});class tk extends xr{constructor(A){super(A,{code:tk.code,name:"ResourceNotFoundRpcError",shortMessage:"Requested resource not found."}),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ResourceNotFoundRpcError"})}}Object.defineProperty(tk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32001});class ZE extends xr{constructor(A){super(A,{code:ZE.code,name:"ResourceUnavailableRpcError",shortMessage:"Requested resource not available."})}}Object.defineProperty(ZE,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32002});class ik extends xr{constructor(A){super(A,{code:ik.code,name:"TransactionRejectedRpcError",shortMessage:"Transaction creation failed."})}}Object.defineProperty(ik,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32003});class Id extends xr{constructor(A,{method:e}={}){super(A,{code:Id.code,name:"MethodNotSupportedRpcError",shortMessage:`Method${e?` "${e}"`:""} is not supported.`})}}Object.defineProperty(Id,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32004});class My extends xr{constructor(A){super(A,{code:My.code,name:"LimitExceededRpcError",shortMessage:"Request exceeds defined limit."})}}Object.defineProperty(My,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32005});class gk extends xr{constructor(A){super(A,{code:gk.code,name:"JsonRpcVersionUnsupportedError",shortMessage:"Version of JSON-RPC protocol is not supported."})}}Object.defineProperty(gk,"code",{enumerable:!0,configurable:!0,writable:!0,value:-32006});class Yn extends fs{constructor(A){super(A,{code:Yn.code,name:"UserRejectedRequestError",shortMessage:"User rejected the request."})}}Object.defineProperty(Yn,"code",{enumerable:!0,configurable:!0,writable:!0,value:4001});class Ik extends fs{constructor(A){super(A,{code:Ik.code,name:"UnauthorizedProviderError",shortMessage:"The requested method and/or account has not been authorized by the user."})}}Object.defineProperty(Ik,"code",{enumerable:!0,configurable:!0,writable:!0,value:4100});class nk extends fs{constructor(A,{method:e}={}){super(A,{code:nk.code,name:"UnsupportedProviderMethodError",shortMessage:`The Provider does not support the requested method${e?` " ${e}"`:""}.`})}}Object.defineProperty(nk,"code",{enumerable:!0,configurable:!0,writable:!0,value:4200});class ok extends fs{constructor(A){super(A,{code:ok.code,name:"ProviderDisconnectedError",shortMessage:"The Provider is disconnected from all chains."})}}Object.defineProperty(ok,"code",{enumerable:!0,configurable:!0,writable:!0,value:4900});class ak extends fs{constructor(A){super(A,{code:ak.code,name:"ChainDisconnectedError",shortMessage:"The Provider is not connected to the requested chain."})}}Object.defineProperty(ak,"code",{enumerable:!0,configurable:!0,writable:!0,value:4901});class cu extends fs{constructor(A){super(A,{code:cu.code,name:"SwitchChainError",shortMessage:"An error occurred when attempting to switch chain."})}}Object.defineProperty(cu,"code",{enumerable:!0,configurable:!0,writable:!0,value:4902});class rk extends fs{constructor(A){super(A,{code:rk.code,name:"UnsupportedNonOptionalCapabilityError",shortMessage:"This Wallet does not support a capability that was not marked as optional."})}}Object.defineProperty(rk,"code",{enumerable:!0,configurable:!0,writable:!0,value:5700});class sk extends fs{constructor(A){super(A,{code:sk.code,name:"UnsupportedChainIdError",shortMessage:"This Wallet does not support the requested chain ID."})}}Object.defineProperty(sk,"code",{enumerable:!0,configurable:!0,writable:!0,value:5710});class Ck extends fs{constructor(A){super(A,{code:Ck.code,name:"DuplicateIdError",shortMessage:"There is already a bundle submitted with this ID."})}}Object.defineProperty(Ck,"code",{enumerable:!0,configurable:!0,writable:!0,value:5720});class Bk extends fs{constructor(A){super(A,{code:Bk.code,name:"UnknownBundleIdError",shortMessage:"This bundle id is unknown / has not been submitted"})}}Object.defineProperty(Bk,"code",{enumerable:!0,configurable:!0,writable:!0,value:5730});class ck extends fs{constructor(A){super(A,{code:ck.code,name:"BundleTooLargeError",shortMessage:"The call bundle is too large for the Wallet to process."})}}Object.defineProperty(ck,"code",{enumerable:!0,configurable:!0,writable:!0,value:5740});class lk extends fs{constructor(A){super(A,{code:lk.code,name:"AtomicReadyWalletRejectedUpgradeError",shortMessage:"The Wallet can support atomicity after an upgrade, but the user rejected the upgrade."})}}Object.defineProperty(lk,"code",{enumerable:!0,configurable:!0,writable:!0,value:5750});class Qk extends fs{constructor(A){super(A,{code:Qk.code,name:"AtomicityNotSupportedError",shortMessage:"The wallet does not support atomic execution but the request requires it."})}}Object.defineProperty(Qk,"code",{enumerable:!0,configurable:!0,writable:!0,value:5760});class OVA extends xr{constructor(A){super(A,{name:"UnknownRpcError",shortMessage:"An unknown RPC error occurred."})}}function PVA(){let t=()=>{},A=()=>{};return{promise:new Promise((i,g)=>{t=i,A=g}),resolve:t,reject:A}}const rx=new Map;function jVA({fn:t,id:A,shouldSplitBatch:e,wait:i=0,sort:g}){const I=async()=>{const s=a();n();const B=s.map(({args:c})=>c);B.length!==0&&t(B).then(c=>{g&&Array.isArray(c)&&c.sort(g);for(let E=0;E<s.length;E++){const{resolve:D}=s[E];D?.([c[E],c])}}).catch(c=>{for(let E=0;E<s.length;E++){const{reject:D}=s[E];D?.(c)}})},n=()=>rx.delete(A),o=()=>a().map(({args:s})=>s),a=()=>rx.get(A)||[],r=s=>rx.set(A,[...a(),s]);return{flush:n,async schedule(s){const{promise:B,resolve:c,reject:E}=PVA();return e?.([...o(),s])&&I(),a().length>0?(r({args:s,resolve:c,reject:E}),B):(r({args:s,resolve:c,reject:E}),setTimeout(I,i),B)}}}const VG=new Y1(8192);function ZVA(t,{enabled:A=!0,id:e}){if(!A||!e)return t();if(VG.get(e))return VG.get(e);const i=t().finally(()=>VG.delete(e));return VG.set(e,i),i}async function WVA(t){return new Promise(A=>setTimeout(A,t))}function GaA(t,{delay:A=100,retryCount:e=2,shouldRetry:i=()=>!0}={}){return new Promise((g,I)=>{const n=async({count:o=0}={})=>{const a=async({error:r})=>{const s=typeof A=="function"?A({count:o,error:r}):A;s&&await WVA(s),n({count:o+1})};try{const r=await t();g(r)}catch(r){if(o<e&&await i({count:o,error:r}))return a({error:r});I(r)}};n()})}function zVA(t,A={}){return async(e,i={})=>{const{dedupe:g=!1,methods:I,retryDelay:n=150,retryCount:o=3,uid:a}={...A,...i},{method:r}=e;if(I?.exclude?.includes(r))throw new Id(new Error("method not supported"),{method:r});if(I?.include&&!I.include.includes(r))throw new Id(new Error("method not supported"),{method:r});const s=g?daA(`${a}.${hd(e)}`):void 0;return ZVA(()=>GaA(async()=>{try{return await t(e)}catch(B){const c=B;switch(c.code){case V0.code:throw new V0(c);case X0.code:throw new X0(c);case $0.code:throw new $0(c,{method:e.method});case Ak.code:throw new Ak(c);case ky.code:throw new ky(c);case ek.code:throw new ek(c);case tk.code:throw new tk(c);case ZE.code:throw new ZE(c);case ik.code:throw new ik(c);case Id.code:throw new Id(c,{method:e.method});case My.code:throw new My(c);case gk.code:throw new gk(c);case Yn.code:throw new Yn(c);case Ik.code:throw new Ik(c);case nk.code:throw new nk(c);case ok.code:throw new ok(c);case ak.code:throw new ak(c);case cu.code:throw new cu(c);case rk.code:throw new rk(c);case sk.code:throw new sk(c);case Ck.code:throw new Ck(c);case Bk.code:throw new Bk(c);case ck.code:throw new ck(c);case lk.code:throw new lk(c);case Qk.code:throw new Qk(c);case 5e3:throw new Yn(c);default:throw B instanceof KB?B:new OVA(c)}}},{delay:({count:B,error:c})=>{if(c&&c instanceof t0){const E=c?.headers?.get("Retry-After");if(E?.match(/\d/))return Number.parseInt(E,10)*1e3}return~~(1<<B)*n},retryCount:o,shouldRetry:({error:B})=>VVA(B)}),{enabled:g,id:s})}}function VVA(t){return"code"in t&&typeof t.code=="number"?t.code===-1||t.code===My.code||t.code===ky.code:t instanceof t0&&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 RaA(t){return{formatters:void 0,fees:void 0,serializers:void 0,...t}}function UaA(t,{errorInstance:A=new Error("timed out"),timeout:e,signal:i}){return new Promise((g,I)=>{(async()=>{let n;try{const o=new AbortController;e>0&&(n=setTimeout(()=>{i?o.abort():I(A)},e)),g(await t({signal:o?.signal||null}))}catch(o){o?.name==="AbortError"&&I(A),I(o)}finally{clearTimeout(n)}})()})}function XVA(){return{current:0,take(){return this.current++},reset(){this.current=0}}}const cX=XVA();function $VA(t,A={}){return{async request(e){const{body:i,fetchFn:g=A.fetchFn??fetch,onRequest:I=A.onRequest,onResponse:n=A.onResponse,timeout:o=A.timeout??1e4}=e,a={...A.fetchOptions??{},...e.fetchOptions??{}},{headers:r,method:s,signal:B}=a;try{const c=await UaA(async({signal:D})=>{const y={...a,body:Array.isArray(i)?hd(i.map(k=>({jsonrpc:"2.0",id:k.id??cX.take(),...k}))):hd({jsonrpc:"2.0",id:i.id??cX.take(),...i}),headers:{"Content-Type":"application/json",...r},method:s||"POST",signal:B||(o>0?D:null)},S=new Request(t,y),f=await I?.(S,y)??{...y,url:t};return await g(f.url??t,f)},{errorInstance:new BX({body:i,url:t}),timeout:o,signal:!0});n&&await n(c);let E;if(c.headers.get("Content-Type")?.startsWith("application/json"))E=await c.json();else{E=await c.text();try{E=JSON.parse(E||"{}")}catch(D){if(c.ok)throw D;E={error:E}}}if(!c.ok)throw new t0({body:i,details:hd(E.error)||c.statusText,headers:c.headers,status:c.status,url:t});return E}catch(c){throw c instanceof t0||c instanceof BX?c:new t0({body:i,cause:c,url:t})}}}}const $R="2.21.2",A9A=()=>`@wagmi/core@${$R}`;var KaA=function(t,A,e,i){if(e==="a"&&!i)throw new TypeError("Private accessor was defined without a getter");if(typeof A=="function"?t!==A||!i:!A.has(t))throw new TypeError("Cannot read private member from an object whose class did not declare it");return e==="m"?i:e==="a"?i.call(t):i?i.value:A.get(t)},BF,FaA;class Ek extends Error{get docsBaseUrl(){return"https://wagmi.sh/core"}get version(){return A9A()}constructor(A,e={}){super(),BF.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 i=e.cause instanceof Ek?e.cause.details:e.cause?.message?e.cause.message:e.details,g=e.cause instanceof Ek&&e.cause.docsPath||e.docsPath;this.message=[A||"An error occurred.","",...e.metaMessages?[...e.metaMessages,""]:[],...g?[`Docs: ${this.docsBaseUrl}${g}.html${e.docsSlug?`#${e.docsSlug}`:""}`]:[],...i?[`Details: ${i}`]:[],`Version: ${this.version}`].join(`
`),e.cause&&(this.cause=e.cause),this.details=i,this.docsPath=g,this.metaMessages=e.metaMessages,this.shortMessage=A}walk(A){return KaA(this,BF,"m",FaA).call(this,this,A)}}BF=new WeakSet,FaA=function t(A,e){return e?.(A)?A:A.cause?KaA(this,BF,"m",t).call(this,A.cause,e):A};class cF extends Ek{constructor(){super("Chain not configured."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ChainNotConfiguredError"})}}const zY=256;let XG=zY,$G;function baA(t=11){if(!$G||XG+t>zY*2){$G="",XG=0;for(let A=0;A<zY;A++)$G+=(256+Math.random()*256|0).toString(16).substring(1)}return $G.substring(XG,XG+++t)}function e9A(t){const{batch:A,chain:e,ccipRead:i,key:g="base",name:I="Base Client",type:n="base"}=t,o=t.experimental_blockTag??(typeof e?.experimental_preconfirmationTime=="number"?"pending":void 0),a=e?.blockTime??12e3,r=Math.min(Math.max(Math.floor(a/2),500),4e3),s=t.pollingInterval??r,B=t.cacheTime??s,c=t.account?YVA(t.account):void 0,{config:E,request:D,value:y}=t.transport({chain:e,pollingInterval:s}),S={...E,...y},f={account:c,batch:A,cacheTime:B,ccipRead:i,chain:e,key:g,name:I,pollingInterval:s,request:D,transport:S,type:n,uid:baA(),...o?{experimental_blockTag:o}:{}};function M(k){return m=>{const U=m(k);for(const b in f)delete U[b];const F={...k,...U};return Object.assign(F,{extend:M(F)})}}return Object.assign(f,{extend:M(f)})}function t9A({key:t,methods:A,name:e,request:i,retryCount:g=3,retryDelay:I=150,timeout:n,type:o},a){const r=baA();return{config:{key:t,methods:A,name:e,request:i,retryCount:g,retryDelay:I,timeout:n,type:o},request:zVA(i,{methods:A,retryCount:g,retryDelay:I,uid:r}),value:a}}class i9A extends KB{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 lX(t,A={}){const{batch:e,fetchFn:i,fetchOptions:g,key:I="http",methods:n,name:o="HTTP JSON-RPC",onFetchRequest:a,onFetchResponse:r,retryDelay:s,raw:B}=A;return({chain:c,retryCount:E,timeout:D})=>{const{batchSize:y=1e3,wait:S=0}=typeof e=="object"?e:{},f=A.retryCount??E,M=D??A.timeout??1e4,k=t||c?.rpcUrls.default.http[0];if(!k)throw new i9A;const m=$VA(k,{fetchFn:i,fetchOptions:g,onRequest:a,onResponse:r,timeout:M});return t9A({key:I,methods:n,name:o,async request({method:U,params:F}){const b={method:U,params:F},{schedule:K}=jVA({id:k,wait:S,shouldSplitBatch(x){return x.length>y},fn:x=>m.request({body:x}),sort:(x,H)=>x.id-H.id}),R=async x=>e?K(x):[await m.request({body:x})],[{error:G,result:J}]=await R(b);if(B)return{error:G,result:J};if(G)throw new NaA({body:b,error:G,url:k});return J},retryCount:f,retryDelay:s,timeout:M,type:"http"},{fetchOptions:g,url:k})}}let sx=!1;async function g9A(t,A={}){if(sx)return[];sx=!0,t.setState(r=>({...r,status:r.current?"reconnecting":"connecting"}));const e=[];if(A.connectors?.length)for(const r of A.connectors){let s;typeof r=="function"?s=t._internal.connectors.setup(r):s=r,e.push(s)}else e.push(...t.connectors);let i;try{i=await t.storage?.getItem("recentConnectorId")}catch{}const g={};for(const[,r]of t.state.connections)g[r.connector.id]=1;i&&(g[i]=0);const I=Object.keys(g).length>0?[...e].sort((r,s)=>(g[r.id]??10)-(g[s.id]??10)):e;let n=!1;const o=[],a=[];for(const r of I){const s=await r.getProvider().catch(()=>{});if(!s||a.some(E=>E===s)||!await r.isAuthorized())continue;const c=await r.connect({isReconnecting:!0}).catch(()=>null);c&&(r.emitter.off("connect",t._internal.events.connect),r.emitter.on("change",t._internal.events.change),r.emitter.on("disconnect",t._internal.events.disconnect),t.setState(E=>{const D=new Map(n?E.connections:new Map).set(r.uid,{accounts:c.accounts,chainId:c.chainId,connector:r});return{...E,current:n?E.current:r.uid,connections:D}}),o.push({accounts:c.accounts,chainId:c.chainId,connector:r}),a.push(s),n=!0)}return(t.state.status==="reconnecting"||t.state.status==="connecting")&&(n?t.setState(r=>({...r,status:"connected"})):t.setState(r=>({...r,connections:new Map,current:null,status:"disconnected"}))),sx=!1,o}class kE extends Ek{constructor(){super("Provider not found."),Object.defineProperty(this,"name",{enumerable:!0,configurable:!0,writable:!0,value:"ProviderNotFoundError"})}}uv.type="injected";function uv(t={}){const{shimDisconnect:A=!0,unstable_shimAsyncInject:e}=t;function i(){const a=t.target;if(typeof a=="function"){const r=a();if(r)return r}return typeof a=="object"?a:typeof a=="string"?{...I9A[a]??{id:a,name:`${a[0].toUpperCase()}${a.slice(1)}`,provider:`is${a[0].toUpperCase()}${a.slice(1)}`}}:{id:"injected",name:"Injected",provider(r){return r?.ethereum}}}let g,I,n,o;return a=>({get icon(){return i().icon},get id(){return i().id},get name(){return i().name},get supportsSimulation(){return!0},type:uv.type,async setup(){const r=await this.getProvider();r?.on&&t.target&&(n||(n=this.onConnect.bind(this),r.on("connect",n)),g||(g=this.onAccountsChanged.bind(this),r.on("accountsChanged",g)))},async connect({chainId:r,isReconnecting:s,withCapabilities:B}={}){const c=await this.getProvider();if(!c)throw new kE;let E=[];if(s)E=await this.getAccounts().catch(()=>[]);else if(A)try{E=(await c.request({method:"wallet_requestPermissions",params:[{eth_accounts:{}}]}))[0]?.caveats?.[0]?.value?.map(y=>gd(y)),E.length>0&&(E=await this.getAccounts())}catch(D){const y=D;if(y.code===Yn.code)throw new Yn(y);if(y.code===ZE.code)throw y}try{!E?.length&&!s&&(E=(await c.request({method:"eth_requestAccounts"})).map(S=>gd(S))),n&&(c.removeListener("connect",n),n=void 0),g||(g=this.onAccountsChanged.bind(this),c.on("accountsChanged",g)),I||(I=this.onChainChanged.bind(this),c.on("chainChanged",I)),o||(o=this.onDisconnect.bind(this),c.on("disconnect",o));let D=await this.getChainId();return r&&D!==r&&(D=(await this.switchChain({chainId:r}).catch(S=>{if(S.code===Yn.code)throw S;return{id:D}}))?.id??D),A&&await a.storage?.removeItem(`${this.id}.disconnected`),t.target||await a.storage?.setItem("injected.connected",!0),{accounts:B?E.map(y=>({address:y,capabilities:{}})):E,chainId:D}}catch(D){const y=D;throw y.code===Yn.code?new Yn(y):y.code===ZE.code?new ZE(y):y}},async disconnect(){const r=await this.getProvider();if(!r)throw new kE;I&&(r.removeListener("chainChanged",I),I=void 0),o&&(r.removeListener("disconnect",o),o=void 0),n||(n=this.onConnect.bind(this),r.on("connect",n));try{await UaA(()=>r.request({method:"wallet_revokePermissions",params:[{eth_accounts:{}}]}),{timeout:100})}catch{}A&&await a.storage?.setItem(`${this.id}.disconnected`,!0),t.target||await a.storage?.removeItem("injected.connected")},async getAccounts(){const r=await this.getProvider();if(!r)throw new kE;return(await r.request({method:"eth_accounts"})).map(B=>gd(B))},async getChainId(){const r=await this.getProvider();if(!r)throw new kE;const s=await r.request({method:"eth_chainId"});return Number(s)},async getProvider(){if(typeof window>"u")return;let r;const s=i();return typeof s.provider=="function"?r=s.provider(window):typeof s.provider=="string"?r=AU(window,s.provider):r=s.provider,r&&!r.removeListener&&("off"in r&&typeof r.off=="function"?r.removeListener=r.off:r.removeListener=()=>{}),r},async isAuthorized(){try{if(A&&await a.storage?.getItem(`${this.id}.disconnected`)||!t.target&&!await a.storage?.getItem("injected.connected"))return!1;if(!await this.getProvider()){if(e!==void 0&&e!==!1){const c=async()=>(typeof window<"u"&&window.removeEventListener("ethereum#initialized",c),!!await this.getProvider()),E=typeof e=="number"?e:1e3;if(await Promise.race([...typeof window<"u"?[new Promise(y=>window.addEventListener("ethereum#initialized",()=>y(c()),{once:!0}))]:[],new Promise(y=>setTimeout(()=>y(c()),E))]))return!0}throw new kE}return!!(await GaA(()=>this.getAccounts())).length}catch{return!1}},async switchChain({addEthereumChainParameter:r,chainId:s}){const B=await this.getProvider();if(!B)throw new kE;const c=a.chains.find(D=>D.id===s);if(!c)throw new cu(new cF);const E=new Promise(D=>{const y=S=>{"chainId"in S&&S.chainId===s&&(a.emitter.off("change",y),D())};a.emitter.on("change",y)});try{return await Promise.all([B.request({method:"wallet_switchEthereumChain",params:[{chainId:my(s)}]}).then(async()=>{await this.getChainId()===s&&a.emitter.emit("change",{chainId:s})}),E]),c}catch(D){const y=D;if(y.code===4902||y?.data?.originalError?.code===4902)try{const{default:S,...f}=c.blockExplorers??{};let M;r?.blockExplorerUrls?M=r.blockExplorerUrls:S&&(M=[S.url,...Object.values(f).map(U=>U.url)]);let k;r?.rpcUrls?.length?k=r.rpcUrls:k=[c.rpcUrls.default?.http[0]??""];const m={blockExplorerUrls:M,chainId:my(s),chainName:r?.chainName??c.name,iconUrls:r?.iconUrls,nativeCurrency:r?.nativeCurrency??c.nativeCurrency,rpcUrls:k};return await Promise.all([B.request({method:"wallet_addEthereumChain",params:[m]}).then(async()=>{if(await this.getChainId()===s)a.emitter.emit("change",{chainId:s});else throw new Yn(new Error("User rejected switch after adding network."))}),E]),c}catch(S){throw new Yn(S)}throw y.code===Yn.code?new Yn(y):new cu(y)}},async onAccountsChanged(r){if(r.length===0)this.onDisconnect();else if(a.emitter.listenerCount("connect")){const s=(await this.getChainId()).toString();this.onConnect({chainId:s}),A&&await a.storage?.removeItem(`${this.id}.disconnected`)}else a.emitter.emit("change",{accounts:r.map(s=>gd(s))})},onChainChanged(r){const s=Number(r);a.emitter.emit("change",{chainId:s})},async onConnect(r){const s=await this.getAccounts();if(s.length===0)return;const B=Number(r.chainId);a.emitter.emit("connect",{accounts:s,chainId:B});const c=await this.getProvider();c&&(n&&(c.removeListener("connect",n),n=void 0),g||(g=this.onAccountsChanged.bind(this),c.on("accountsChanged",g)),I||(I=this.onChainChanged.bind(this),c.on("chainChanged",I)),o||(o=this.onDisconnect.bind(this),c.on("disconnect",o)))},async onDisconnect(r){const s=await this.getProvider();r&&r.code===1013&&s&&(await this.getAccounts()).length||(a.emitter.emit("disconnect"),s&&(I&&(s.removeListener("chainChanged",I),I=void 0),o&&(s.removeListener("disconnect",o),o=void 0),n||(n=this.onConnect.bind(this),s.on("connect",n))))}})}const I9A={coinbaseWallet:{id:"coinbaseWallet",name:"Coinbase Wallet",provider(t){return t?.coinbaseWalletExtension?t.coinbaseWalletExtension:AU(t,"isCoinbaseWallet")}},metaMask:{id:"metaMask",name:"MetaMask",provider(t){return AU(t,A=>{if(!A.isMetaMask||A.isBraveWallet&&!A._events&&!A._state)return!1;const e=["isApexWallet","isAvalanche","isBitKeep","isBlockWallet","isKuCoinWallet","isMathWallet","isOkxWallet","isOKExWallet","isOneInchIOSWallet","isOneInchAndroidWallet","isOpera","isPhantom","isPortal","isRabby","isTokenPocket","isTokenary","isUniswapWallet","isZerion"];for(const i of e)if(A[i])return!1;return!0})}},phantom:{id:"phantom",name:"Phantom",provider(t){return t?.phantom?.ethereum?t.phantom?.ethereum:AU(t,"isPhantom")}}};function AU(t,A){function e(g){return typeof A=="function"?A(g):typeof A=="string"?g[A]:!0}const i=t.ethereum;if(i?.providers)return i.providers.find(g=>e(g));if(i&&e(i))return i}function n9A(t){if(typeof window>"u")return;const A=e=>t(e.detail);return window.addEventListener("eip6963:announceProvider",A),window.dispatchEvent(new CustomEvent("eip6963:requestProvider")),()=>window.removeEventListener("eip6963:announceProvider",A)}function o9A(){const t=new Set;let A=[];const e=()=>n9A(g=>{A.some(({info:I})=>I.uuid===g.info.uuid)||(A=[...A,g],t.forEach(I=>I(A,{added:[g]})))});let i=e();return{_listeners(){return t},clear(){t.forEach(g=>g([],{removed:[...A]})),A=[]},destroy(){this.clear(),t.clear(),i?.()},findProvider({rdns:g}){return A.find(I=>I.info.rdns===g)},getProviders(){return A},reset(){this.clear(),i?.(),i=e()},subscribe(g,{emitImmediately:I}={}){return t.add(g),I&&g(A,{added:A}),()=>t.delete(g)}}}const a9A=t=>(A,e,i)=>{const g=i.subscribe;return i.subscribe=(n,o,a)=>{let r=n;if(o){const s=a?.equalityFn||Object.is;let B=n(i.getState());r=c=>{const E=n(c);if(!s(B,E)){const D=B;o(B=E,D)}},a?.fireImmediately&&o(B,B)}return g(r)},t(A,e,i)},r9A=a9A;function s9A(t,A){let e;try{e=t()}catch{return}return{getItem:g=>{var I;const n=a=>a===null?null:JSON.parse(a,void 0),o=(I=e.getItem(g))!=null?I:null;return o instanceof Promise?o.then(n):n(o)},setItem:(g,I)=>e.setItem(g,JSON.stringify(I,void 0)),removeItem:g=>e.removeItem(g)}}const VY=t=>A=>{try{const e=t(A);return e instanceof Promise?e:{then(i){return VY(i)(e)},catch(i){return this}}}catch(e){return{then(i){return this},catch(i){return VY(i)(e)}}}},C9A=(t,A)=>(e,i,g)=>{let I={storage:s9A(()=>localStorage),partialize:y=>y,version:0,merge:(y,S)=>({...S,...y}),...A},n=!1;const o=new Set,a=new Set;let r=I.storage;if(!r)return t((...y)=>{e(...y)},i,g);const s=()=>{const y=I.partialize({...i()});return r.setItem(I.name,{state:y,version:I.version})},B=g.setState;g.setState=(y,S)=>{B(y,S),s()};const c=t((...y)=>{e(...y),s()},i,g);g.getInitialState=()=>c;let E;const D=()=>{var y,S;if(!r)return;n=!1,o.forEach(M=>{var k;return M((k=i())!=null?k:c)});const f=((S=I.onRehydrateStorage)==null?void 0:S.call(I,(y=i())!=null?y:c))||void 0;return VY(r.getItem.bind(r))(I.name).then(M=>{if(M)if(typeof M.version=="number"&&M.version!==I.version){if(I.migrate)return[!0,I.migrate(M.state,M.version)]}else return[!1,M.state];return[!1,void 0]}).then(M=>{var k;const[m,U]=M;if(E=I.merge(U,(k=i())!=null?k:c),e(E,!0),m)return s()}).then(()=>{f?.(E,void 0),E=i(),n=!0,a.forEach(M=>M(E))}).catch(M=>{f?.(void 0,M)})};return g.persist={setOptions:y=>{I={...I,...y},y.storage&&(r=y.storage)},clearStorage:()=>{r?.removeItem(I.name)},getOptions:()=>I,rehydrate:()=>D(),hasHydrated:()=>n,onHydrate:y=>(o.add(y),()=>{o.delete(y)}),onFinishHydration:y=>(a.add(y),()=>{a.delete(y)})},I.skipHydration||D(),E||c},B9A=C9A,QX=t=>{let A;const e=new Set,i=(r,s)=>{const B=typeof r=="function"?r(A):r;if(!Object.is(B,A)){const c=A;A=s??(typeof B!="object"||B===null)?B:Object.assign({},A,B),e.forEach(E=>E(A,c))}},g=()=>A,o={setState:i,getState:g,getInitialState:()=>a,subscribe:r=>(e.add(r),()=>e.delete(r))},a=A=t(i,g,o);return o},Cx=t=>t?QX(t):QX;var Bx={exports:{}},EX;function c9A(){return EX||(EX=1,function(t){var A=Object.prototype.hasOwnProperty,e="~";function i(){}Object.create&&(i.prototype=Object.create(null),new i().__proto__||(e=!1));function g(a,r,s){this.fn=a,this.context=r,this.once=s||!1}function I(a,r,s,B,c){if(typeof s!="function")throw new TypeError("The listener must be a function");var E=new g(s,B||a,c),D=e?e+r:r;return a._events[D]?a._events[D].fn?a._events[D]=[a._events[D],E]:a._events[D].push(E):(a._events[D]=E,a._eventsCount++),a}function n(a,r){--a._eventsCount===0?a._events=new i:delete a._events[r]}function o(){this._events=new i,this._eventsCount=0}o.prototype.eventNames=function(){var r=[],s,B;if(this._eventsCount===0)return r;for(B in s=this._events)A.call(s,B)&&r.push(e?B.slice(1):B);return Object.getOwnPropertySymbols?r.concat(Object.getOwnPropertySymbols(s)):r},o.prototype.listeners=function(r){var s=e?e+r:r,B=this._events[s];if(!B)return[];if(B.fn)return[B.fn];for(var c=0,E=B.length,D=new Array(E);c<E;c++)D[c]=B[c].fn;return D},o.prototype.listenerCount=function(r){var s=e?e+r:r,B=this._events[s];return B?B.fn?1:B.length:0},o.prototype.emit=function(r,s,B,c,E,D){var y=e?e+r:r;if(!this._events[y])return!1;var S=this._events[y],f=arguments.length,M,k;if(S.fn){switch(S.once&&this.removeListener(r,S.fn,void 0,!0),f){case 1:return S.fn.call(S.context),!0;case 2:return S.fn.call(S.context,s),!0;case 3:return S.fn.call(S.context,s,B),!0;case 4:return S.fn.call(S.context,s,B,c),!0;case 5:return S.fn.call(S.context,s,B,c,E),!0;case 6:return S.fn.call(S.context,s,B,c,E,D),!0}for(k=1,M=new Array(f-1);k<f;k++)M[k-1]=arguments[k];S.fn.apply(S.context,M)}else{var m=S.length,U;for(k=0;k<m;k++)switch(S[k].once&&this.removeListener(r,S[k].fn,void 0,!0),f){case 1:S[k].fn.call(S[k].context);break;case 2:S[k].fn.call(S[k].context,s);break;case 3:S[k].fn.call(S[k].context,s,B);break;case 4:S[k].fn.call(S[k].context,s,B,c);break;default:if(!M)for(U=1,M=new Array(f-1);U<f;U++)M[U-1]=arguments[U];S[k].fn.apply(S[k].context,M)}}return!0},o.prototype.on=function(r,s,B){return I(this,r,s,B,!1)},o.prototype.once=function(r,s,B){return I(this,r,s,B,!0)},o.prototype.removeListener=function(r,s,B,c){var E=e?e+r:r;if(!this._events[E])return this;if(!s)return n(this,E),this;var D=this._events[E];if(D.fn)D.fn===s&&(!c||D.once)&&(!B||D.context===B)&&n(this,E);else{for(var y=0,S=[],f=D.length;y<f;y++)(D[y].fn!==s||c&&!D[y].once||B&&D[y].context!==B)&&S.push(D[y]);S.length?this._events[E]=S.length===1?S[0]:S:n(this,E)}return this},o.prototype.removeAllListeners=function(r){var s;return r?(s=e?e+r:r,this._events[s]&&n(this,s)):(this._events=new i,this._eventsCount=0),this},o.prototype.off=o.prototype.removeListener,o.prototype.addListener=o.prototype.on,o.prefixed=e,o.EventEmitter=o,t.exports=o}(Bx)),Bx.exports}var l9A=c9A();const Q9A=Td(l9A);class E9A{constructor(A){Object.defineProperty(this,"uid",{enumerable:!0,configurable:!0,writable:!0,value:A}),Object.defineProperty(this,"_emitter",{enumerable:!0,configurable:!0,writable:!0,value:new Q9A})}on(A,e){this._emitter.on(A,e)}once(A,e){this._emitter.once(A,e)}off(A,e){this._emitter.off(A,e)}emit(A,...e){const i=e[0];this._emitter.emit(A,{uid:this.uid,...i})}listenerCount(A){return this._emitter.listenerCount(A)}}function u9A(t){return new E9A(t)}function h9A(t,A){return JSON.parse(t,(e,i)=>{let g=i;return g?.__type==="bigint"&&(g=BigInt(g.value)),g?.__type==="Map"&&(g=new Map(g.value)),A?.(e,g)??g})}function uX(t,A){return t.slice(0,A).join(".")||"."}function hX(t,A){const{length:e}=t;for(let i=0;i<e;++i)if(t[i]===A)return i+1;return 0}function d9A(t,A){const e=typeof t=="function",i=typeof A=="function",g=[],I=[];return function(o,a){if(typeof a=="object")if(g.length){const r=hX(g,this);r===0?g[g.length]=this:(g.splice(r),I.splice(r)),I[I.length]=o;const s=hX(g,a);if(s!==0)return i?A.call(this,o,a,uX(I,s)):`[ref=${uX(I,s)}]`}else g[0]=a,I[0]=o;return e?t.call(this,o,a):a}}function p9A(t,A,e,i){return JSON.stringify(t,d9A((g,I)=>{let n=I;return typeof n=="bigint"&&(n={__type:"bigint",value:I.toString()}),n instanceof Map&&(n={__type:"Map",value:Array.from(I.entries())}),A?.(g,n)??n},i),e??void 0)}function vaA(t){const{deserialize:A=h9A,key:e="wagmi",serialize:i=p9A,storage:g=_aA}=t;function I(n){return n instanceof Promise?n.then(o=>o).catch(()=>null):n}return{...g,key:e,async getItem(n,o){const a=g.getItem(`${e}.${n}`),r=await I(a);return r?A(r)??null:o??null},async setItem(n,o){const a=`${e}.${n}`;o===null?await I(g.removeItem(a)):await I(g.setItem(a,i(o)))},async removeItem(n){await I(g.removeItem(`${e}.${n}`))}}}const _aA={getItem:()=>null,setItem:()=>{},removeItem:()=>{}};function f9A(){const t=typeof window<"u"&&window.localStorage?window.localStorage:_aA;return{getItem(A){return t.getItem(A)},removeItem(A){t.removeItem(A)},setItem(A,e){try{t.setItem(A,e)}catch{}}}}const XY=256;let AR=XY,eR;function D9A(t=11){if(!eR||AR+t>XY*2){eR="",AR=0;for(let A=0;A<XY;A++)eR+=(256+Math.random()*256|0).toString(16).substring(1)}return eR.substring(AR,AR+++t)}function y9A(t){const{multiInjectedProviderDiscovery:A=!0,storage:e=vaA({storage:f9A()}),syncConnectedChain:i=!0,ssr:g=!1,...I}=t,n=typeof window<"u"&&A?o9A():void 0,o=Cx(()=>I.chains),a=Cx(()=>{const U=[],F=new Set;for(const b of I.connectors??[]){const K=r(b);if(U.push(K),!g&&K.rdns){const R=typeof K.rdns=="string"?[K.rdns]:K.rdns;for(const G of R)F.add(G)}}if(!g&&n){const b=n.getProviders();for(const K of b)F.has(K.info.rdns)||U.push(r(s(K)))}return U});function r(U){const F=u9A(D9A()),b={...U({emitter:F,chains:o.getState(),storage:e,transports:I.transports}),emitter:F,uid:F.uid};return F.on("connect",k),b.setup?.(),b}function s(U){const{info:F}=U,b=U.provider;return uv({target:{...F,id:F.rdns,provider:b}})}const B=new Map;function c(U={}){const F=U.chainId??S.getState().chainId,b=o.getState().find(R=>R.id===F);if(U.chainId&&!b)throw new cF;{const R=B.get(S.getState().chainId);if(R&&!b)return R;if(!b)throw new cF}{const R=B.get(F);if(R)return R}let K;if(I.client)K=I.client({chain:b});else{const R=b.id,G=o.getState().map(H=>H.id),J={},x=Object.entries(I);for(const[H,P]of x)if(!(H==="chains"||H==="client"||H==="connectors"||H==="transports"))if(typeof P=="object")if(R in P)J[H]=P[R];else{if(G.some(q=>q in P))continue;J[H]=P}else J[H]=P;K=e9A({...J,chain:b,batch:J.batch??{multicall:!0},transport:H=>I.transports[R]({...H,connectors:a})})}return B.set(F,K),K}function E(){return{chainId:o.getState()[0].id,connections:new Map,current:null,status:"disconnected"}}let D;const y="0.0.0-canary-";$R.startsWith(y)?D=Number.parseInt($R.replace(y,""),10):D=Number.parseInt($R.split(".")[0]??"0",10);const S=Cx(r9A(e?B9A(E,{migrate(U,F){if(F===D)return U;const b=E(),K=f(U,b.chainId);return{...b,chainId:K}},name:"store",partialize(U){return{connections:{__type:"Map",value:Array.from(U.connections.entries()).map(([F,b])=>{const{id:K,name:R,type:G,uid:J}=b.connector;return[F,{...b,connector:{id:K,name:R,type:G,uid:J}}]})},chainId:U.chainId,current:U.current}},merge(U,F){typeof U=="object"&&U&&"status"in U&&delete U.status;const b=f(U,F.chainId);return{...F,...U,chainId:b}},skipHydration:g,storage:e,version:D}):E));S.setState(E());function f(U,F){return U&&typeof U=="object"&&"chainId"in U&&typeof U.chainId=="number"&&o.getState().some(b=>b.id===U.chainId)?U.chainId:F}i&&S.subscribe(({connections:U,current:F})=>F?U.get(F)?.chainId:void 0,U=>{if(o.getState().some(b=>b.id===U))return S.setState(b=>({...b,chainId:U??b.chainId}))}),n?.subscribe(U=>{const F=new Set,b=new Set;for(const R of a.getState())if(F.add(R.id),R.rdns){const G=typeof R.rdns=="string"?[R.rdns]:R.rdns;for(const J of G)b.add(J)}const K=[];for(const R of U){if(b.has(R.info.rdns))continue;const G=r(s(R));F.has(G.id)||K.push(G)}e&&!S.persist.hasHydrated()||a.setState(R=>[...R,...K],!0)});function M(U){S.setState(F=>{const b=F.connections.get(U.uid);return b?{...F,connections:new Map(F.connections).set(U.uid,{accounts:U.accounts??b.accounts,chainId:U.chainId??b.chainId,connector:b.connector})}:F})}function k(U){S.getState().status==="connecting"||S.getState().status==="reconnecting"||S.setState(F=>{const b=a.getState().find(K=>K.uid===U.uid);return b?(b.emitter.listenerCount("connect")&&b.emitter.off("connect",M),b.emitter.listenerCount("change")||b.emitter.on("change",M),b.emitter.listenerCount("disconnect")||b.emitter.on("disconnect",m),{...F,connections:new Map(F.connections).set(U.uid,{accounts:U.accounts,chainId:U.chainId,connector:b}),current:U.uid,status:"connected"}):F})}function m(U){S.setState(F=>{const b=F.connections.get(U.uid);if(b){const R=b.connector;R.emitter.listenerCount("change")&&b.connector.emitter.off("change",M),R.emitter.listenerCount("disconnect")&&b.connector.emitter.off("disconnect",m),R.emitter.listenerCount("connect")||b.connector.emitter.on("connect",k)}if(F.connections.delete(U.uid),F.connections.size===0)return{...F,connections:new Map,current:null,status:"disconnected"};const K=F.connections.values().next().value;return{...F,connections:new Map(F.connections),current:K.connector.uid}})}return{get chains(){return o.getState()},get connectors(){return a.getState()},storage:e,getClient:c,get state(){return S.getState()},setState(U){let F;typeof U=="function"?F=U(S.getState()):F=U;const b=E();typeof F!="object"&&(F=b),Object.keys(b).some(R=>!(R in F))&&(F=b),S.setState(F,!0)},subscribe(U,F,b){return S.subscribe(U,F,b?{...b,fireImmediately:b.emitImmediately}:void 0)},_internal:{mipd:n,async revalidate(){const U=S.getState(),F=U.connections;let b=U.current;for(const[,K]of F){const R=K.connector;R.isAuthorized&&await R.isAuthorized()||(F.delete(R.uid),b===R.uid&&(b=null))}S.setState(K=>({...K,connections:F,current:b}))},store:S,ssr:!!g,syncConnectedChain:i,transports:I.transports,chains:{setState(U){const F=typeof U=="function"?U(o.getState()):U;if(F.length!==0)return o.setState(F,!0)},subscribe(U){return o.subscribe(U)}},connectors:{providerDetailToConnector:s,setup:r,setState(U){return a.setState(typeof U=="function"?U(a.getState()):U,!0)},subscribe(U){return a.subscribe(U)}},events:{change:M,connect:k,disconnect:m}}}}function S9A(t,A){const{initialState:e,reconnectOnMount:i}=A;return e&&!t._internal.store.persist.hasHydrated()&&t.setState({...e,chainId:t.chains.some(g=>g.id===e.chainId)?e.chainId:t.chains[0].id,connections:i?e.connections:new Map,status:i?"reconnecting":"disconnected"}),{async onMount(){t._internal.ssr&&(await t._internal.store.persist.rehydrate(),t._internal.mipd&&t._internal.connectors.setState(g=>{const I=new Set;for(const a of g??[])if(a.rdns){const r=Array.isArray(a.rdns)?a.rdns:[a.rdns];for(const s of r)I.add(s)}const n=[],o=t._internal.mipd?.getProviders()??[];for(const a of o){if(I.has(a.info.rdns))continue;const r=t._internal.connectors.providerDetailToConnector(a),s=t._internal.connectors.setup(r);n.push(s)}return[...g,...n]})),i?g9A(t):t.storage&&t.setState(g=>({...g,connections:new Map}))}}}const w9A={getItem(t){return typeof window>"u"?null:m9A(document.cookie,t)??null},setItem(t,A){typeof window>"u"||(document.cookie=`${t}=${A};path=/;samesite=Lax`)},removeItem(t){typeof window>"u"||(document.cookie=`${t}=;max-age=-1;path=/`)}};function m9A(t,A){const e=t.split("; ").find(i=>i.startsWith(`${A}=`));if(e)return e.substring(A.length+1)}function k9A(t){const{chain:A}=t,e=A.rpcUrls.default.http[0];if(!t.transports)return[e];const i=t.transports?.[A.id]?.({chain:A});return(i?.value?.transports||[i]).map(({value:I})=>I?.url||e)}function M9A(t){const{children:A,config:e,initialState:i,reconnectOnMount:g=!0}=t,{onMount:I}=S9A(e,{initialState:i,reconnectOnMount:g});e._internal.ssr||I();const n=p.useRef(!0);return p.useEffect(()=>{if(n.current&&e._internal.ssr)return I(),()=>{n.current=!1}},[]),A}const N9A=p.createContext(void 0);function G9A(t){const{children:A,config:e}=t,i={value:e};return p.createElement(M9A,t,p.createElement(N9A.Provider,i,A))}var hv=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(){}},R9A={setTimeout:(t,A)=>setTimeout(t,A),clearTimeout:t=>clearTimeout(t),setInterval:(t,A)=>setInterval(t,A),clearInterval:t=>clearInterval(t)},U9A=class{#A=R9A;#e=!1;setTimeoutProvider(t){this.#A=t}setTimeout(t,A){return this.#A.setTimeout(t,A)}clearTimeout(t){this.#A.clearTimeout(t)}setInterval(t,A){return this.#A.setInterval(t,A)}clearInterval(t){this.#A.clearInterval(t)}},$Y=new U9A;function K9A(t){setTimeout(t,0)}var dv=typeof window>"u"||"Deno"in globalThis;function tB(){}function F9A(t,A){return typeof t=="function"?t(A):t}function b9A(t){return typeof t=="number"&&t>=0&&t!==1/0}function v9A(t,A){return Math.max(t+(A||0)-Date.now(),0)}function A2(t,A){return typeof t=="function"?t(A):t}function _9A(t,A){return typeof t=="function"?t(A):t}function dX(t,A){const{type:e="all",exact:i,fetchStatus:g,predicate:I,queryKey:n,stale:o}=t;if(n){if(i){if(A.queryHash!==O1(n,A.options))return!1}else if(!hk(A.queryKey,n))return!1}if(e!=="all"){const a=A.isActive();if(e==="active"&&!a||e==="inactive"&&a)return!1}return!(typeof o=="boolean"&&A.isStale()!==o||g&&g!==A.state.fetchStatus||I&&!I(A))}function pX(t,A){const{exact:e,status:i,predicate:g,mutationKey:I}=t;if(I){if(!A.options.mutationKey)return!1;if(e){if(uk(A.options.mutationKey)!==uk(I))return!1}else if(!hk(A.options.mutationKey,I))return!1}return!(i&&A.state.status!==i||g&&!g(A))}function O1(t,A){return(A?.queryKeyHashFn||uk)(t)}function uk(t){return JSON.stringify(t,(A,e)=>e2(e)?Object.keys(e).sort().reduce((i,g)=>(i[g]=e[g],i),{}):e)}function hk(t,A){return t===A?!0:typeof t!=typeof A?!1:t&&A&&typeof t=="object"&&typeof A=="object"?Object.keys(A).every(e=>hk(t[e],A[e])):!1}var J9A=Object.prototype.hasOwnProperty;function JaA(t,A){if(t===A)return t;const e=fX(t)&&fX(A);if(!e&&!(e2(t)&&e2(A)))return A;const g=(e?t:Object.keys(t)).length,I=e?A:Object.keys(A),n=I.length,o=e?new Array(n):{};let a=0;for(let r=0;r<n;r++){const s=e?r:I[r],B=t[s],c=A[s];if(B===c){o[s]=B,(e?r<g:J9A.call(t,s))&&a++;continue}if(B===null||c===null||typeof B!="object"||typeof c!="object"){o[s]=c;continue}const E=JaA(B,c);o[s]=E,E===B&&a++}return g===n&&a===g?t:o}function fX(t){return Array.isArray(t)&&t.length===Object.keys(t).length}function e2(t){if(!DX(t))return!1;const A=t.constructor;if(A===void 0)return!0;const e=A.prototype;return!(!DX(e)||!e.hasOwnProperty("isPrototypeOf")||Object.getPrototypeOf(t)!==Object.prototype)}function DX(t){return Object.prototype.toString.call(t)==="[object Object]"}function L9A(t){return new Promise(A=>{$Y.setTimeout(A,t)})}function q9A(t,A,e){return typeof e.structuralSharing=="function"?e.structuralSharing(t,A):e.structuralSharing!==!1?JaA(t,A):A}function x9A(t,A,e=0){const i=[...t,A];return e&&i.length>e?i.slice(1):i}function T9A(t,A,e=0){const i=[A,...t];return e&&i.length>e?i.slice(0,-1):i}var P1=Symbol();function LaA(t,A){return!t.queryFn&&A?.initialPromise?()=>A.initialPromise:!t.queryFn||t.queryFn===P1?()=>Promise.reject(new Error(`Missing queryFn: '${t.queryHash}'`)):t.queryFn}var Y9A=class extends hv{#A;#e;#t;constructor(){super(),this.#t=t=>{if(!dv&&window.addEventListener){const A=()=>t();return window.addEventListener("visibilitychange",A,!1),()=>{window.removeEventListener("visibilitychange",A)}}}}onSubscribe(){this.#e||this.setEventListener(this.#t)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#t=t,this.#e?.(),this.#e=t(A=>{typeof A=="boolean"?this.setFocused(A):this.onFocus()})}setFocused(t){this.#A!==t&&(this.#A=t,this.onFocus())}onFocus(){const t=this.isFocused();this.listeners.forEach(A=>{A(t)})}isFocused(){return typeof this.#A=="boolean"?this.#A:globalThis.document?.visibilityState!=="hidden"}},qaA=new Y9A;function H9A(){let t,A;const e=new Promise((g,I)=>{t=g,A=I});e.status="pending",e.catch(()=>{});function i(g){Object.assign(e,g),delete e.resolve,delete e.reject}return e.resolve=g=>{i({status:"fulfilled",value:g}),t(g)},e.reject=g=>{i({status:"rejected",reason:g}),A(g)},e}var O9A=K9A;function P9A(){let t=[],A=0,e=o=>{o()},i=o=>{o()},g=O9A;const I=o=>{A?t.push(o):g(()=>{e(o)})},n=()=>{const o=t;t=[],o.length&&g(()=>{i(()=>{o.forEach(a=>{e(a)})})})};return{batch:o=>{let a;A++;try{a=o()}finally{A--,A||n()}return a},batchCalls:o=>(...a)=>{I(()=>{o(...a)})},schedule:I,setNotifyFunction:o=>{e=o},setBatchNotifyFunction:o=>{i=o},setScheduler:o=>{g=o}}}var Va=P9A(),j9A=class extends hv{#A=!0;#e;#t;constructor(){super(),this.#t=t=>{if(!dv&&window.addEventListener){const A=()=>t(!0),e=()=>t(!1);return window.addEventListener("online",A,!1),window.addEventListener("offline",e,!1),()=>{window.removeEventListener("online",A),window.removeEventListener("offline",e)}}}}onSubscribe(){this.#e||this.setEventListener(this.#t)}onUnsubscribe(){this.hasListeners()||(this.#e?.(),this.#e=void 0)}setEventListener(t){this.#t=t,this.#e?.(),this.#e=t(this.setOnline.bind(this))}setOnline(t){this.#A!==t&&(this.#A=t,this.listeners.forEach(e=>{e(t)}))}isOnline(){return this.#A}},lF=new j9A;function Z9A(t){return Math.min(1e3*2**t,3e4)}function xaA(t){return(t??"online")==="online"?lF.isOnline():!0}var t2=class extends Error{constructor(t){super("CancelledError"),this.revert=t?.revert,this.silent=t?.silent}};function TaA(t){let A=!1,e=0,i;const g=H9A(),I=()=>g.status!=="pending",n=y=>{if(!I()){const S=new t2(y);c(S),t.onCancel?.(S)}},o=()=>{A=!0},a=()=>{A=!1},r=()=>qaA.isFocused()&&(t.networkMode==="always"||lF.isOnline())&&t.canRun(),s=()=>xaA(t.networkMode)&&t.canRun(),B=y=>{I()||(i?.(),g.resolve(y))},c=y=>{I()||(i?.(),g.reject(y))},E=()=>new Promise(y=>{i=S=>{(I()||r())&&y(S)},t.onPause?.()}).then(()=>{i=void 0,I()||t.onContinue?.()}),D=()=>{if(I())return;let y;const S=e===0?t.initialPromise:void 0;try{y=S??t.fn()}catch(f){y=Promise.reject(f)}Promise.resolve(y).then(B).catch(f=>{if(I())return;const M=t.retry??(dv?0:3),k=t.retryDelay??Z9A,m=typeof k=="function"?k(e,f):k,U=M===!0||typeof M=="number"&&e<M||typeof M=="function"&&M(e,f);if(A||!U){c(f);return}e++,t.onFail?.(e,f),L9A(m).then(()=>r()?void 0:E()).then(()=>{A?c(f):D()})})};return{promise:g,status:()=>g.status,cancel:n,continue:()=>(i?.(),g),cancelRetry:o,continueRetry:a,canStart:s,start:()=>(s()?D():E().then(D),g)}}var YaA=class{#A;destroy(){this.clearGcTimeout()}scheduleGc(){this.clearGcTimeout(),b9A(this.gcTime)&&(this.#A=$Y.setTimeout(()=>{this.optionalRemove()},this.gcTime))}updateGcTime(t){this.gcTime=Math.max(this.gcTime||0,t??(dv?1/0:300*1e3))}clearGcTimeout(){this.#A&&($Y.clearTimeout(this.#A),this.#A=void 0)}},W9A=class extends YaA{#A;#e;#t;#g;#i;#n;#o;constructor(t){super(),this.#o=!1,this.#n=t.defaultOptions,this.setOptions(t.options),this.observers=[],this.#g=t.client,this.#t=this.#g.getQueryCache(),this.queryKey=t.queryKey,this.queryHash=t.queryHash,this.#A=yX(this.options),this.state=t.state??this.#A,this.scheduleGc()}get meta(){return this.options.meta}get promise(){return this.#i?.promise}setOptions(t){if(this.options={...this.#n,...t},this.updateGcTime(this.options.gcTime),this.state&&this.state.data===void 0){const A=yX(this.options);A.data!==void 0&&(this.setData(A.data,{updatedAt:A.dataUpdatedAt,manual:!0}),this.#A=A)}}optionalRemove(){!this.observers.length&&this.state.fetchStatus==="idle"&&this.#t.remove(this)}setData(t,A){const e=q9A(this.state.data,t,this.options);return this.#I({data:e,type:"success",dataUpdatedAt:A?.updatedAt,manual:A?.manual}),e}setState(t,A){this.#I({type:"setState",state:t,setStateOptions:A})}cancel(t){const A=this.#i?.promise;return this.#i?.cancel(t),A?A.then(tB).catch(tB):Promise.resolve()}destroy(){super.destroy(),this.cancel({silent:!0})}reset(){this.destroy(),this.setState(this.#A)}isActive(){return this.observers.some(t=>_9A(t.options.enabled,this)!==!1)}isDisabled(){return this.getObserversCount()>0?!this.isActive():this.options.queryFn===P1||this.state.dataUpdateCount+this.state.errorUpdateCount===0}isStatic(){return this.getObserversCount()>0?this.observers.some(t=>A2(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:!v9A(this.state.dataUpdatedAt,t)}onFocus(){this.observers.find(A=>A.shouldFetchOnWindowFocus())?.refetch({cancelRefetch:!1}),this.#i?.continue()}onOnline(){this.observers.find(A=>A.shouldFetchOnReconnect())?.refetch({cancelRefetch:!1}),this.#i?.continue()}addObserver(t){this.observers.includes(t)||(this.observers.push(t),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",query:this,observer:t}))}removeObserver(t){this.observers.includes(t)&&(this.observers=this.observers.filter(A=>A!==t),this.observers.length||(this.#i&&(this.#o?this.#i.cancel({revert:!0}):this.#i.cancelRetry()),this.scheduleGc()),this.#t.notify({type:"observerRemoved",query:this,observer:t}))}getObserversCount(){return this.observers.length}invalidate(){this.state.isInvalidated||this.#I({type:"invalidate"})}async fetch(t,A){if(this.state.fetchStatus!=="idle"&&this.#i?.status()!=="rejected"){if(this.state.data!==void 0&&A?.cancelRefetch)this.cancel({silent:!0});else if(this.#i)return this.#i.continueRetry(),this.#i.promise}if(t&&this.setOptions(t),!this.options.queryFn){const o=this.observers.find(a=>a.options.queryFn);o&&this.setOptions(o.options)}const e=new AbortController,i=o=>{Object.defineProperty(o,"signal",{enumerable:!0,get:()=>(this.#o=!0,e.signal)})},g=()=>{const o=LaA(this.options,A),r=(()=>{const s={client:this.#g,queryKey:this.queryKey,meta:this.meta};return i(s),s})();return this.#o=!1,this.options.persister?this.options.persister(o,r,this):o(r)},n=(()=>{const o={fetchOptions:A,options:this.options,queryKey:this.queryKey,client:this.#g,state:this.state,fetchFn:g};return i(o),o})();this.options.behavior?.onFetch(n,this),this.#e=this.state,(this.state.fetchStatus==="idle"||this.state.fetchMeta!==n.fetchOptions?.meta)&&this.#I({type:"fetch",meta:n.fetchOptions?.meta}),this.#i=TaA({initialPromise:A?.initialPromise,fn:n.fetchFn,onCancel:o=>{o instanceof t2&&o.revert&&this.setState({...this.#e,fetchStatus:"idle"}),e.abort()},onFail:(o,a)=>{this.#I({type:"failed",failureCount:o,error:a})},onPause:()=>{this.#I({type:"pause"})},onContinue:()=>{this.#I({type:"continue"})},retry:n.options.retry,retryDelay:n.options.retryDelay,networkMode:n.options.networkMode,canRun:()=>!0});try{const o=await this.#i.start();if(o===void 0)throw new Error(`${this.queryHash} data is undefined`);return this.setData(o),this.#t.config.onSuccess?.(o,this),this.#t.config.onSettled?.(o,this.state.error,this),o}catch(o){if(o instanceof t2){if(o.silent)return this.#i.promise;if(o.revert){if(this.state.data===void 0)throw o;return this.state.data}}throw this.#I({type:"error",error:o}),this.#t.config.onError?.(o,this),this.#t.config.onSettled?.(this.state.data,o,this),o}finally{this.scheduleGc()}}#I(t){const A=e=>{switch(t.type){case"failed":return{...e,fetchFailureCount:t.failureCount,fetchFailureReason:t.error};case"pause":return{...e,fetchStatus:"paused"};case"continue":return{...e,fetchStatus:"fetching"};case"fetch":return{...e,...z9A(e.data,this.options),fetchMeta:t.meta??null};case"success":const i={...e,data:t.data,dataUpdateCount:e.dataUpdateCount+1,dataUpdatedAt:t.dataUpdatedAt??Date.now(),error:null,isInvalidated:!1,status:"success",...!t.manual&&{fetchStatus:"idle",fetchFailureCount:0,fetchFailureReason:null}};return this.#e=t.manual?i:void 0,i;case"error":const g=t.error;return{...e,error:g,errorUpdateCount:e.errorUpdateCount+1,errorUpdatedAt:Date.now(),fetchFailureCount:e.fetchFailureCount+1,fetchFailureReason:g,fetchStatus:"idle",status:"error"};case"invalidate":return{...e,isInvalidated:!0};case"setState":return{...e,...t.state}}};this.state=A(this.state),Va.batch(()=>{this.observers.forEach(e=>{e.onQueryUpdate()}),this.#t.notify({query:this,type:"updated",action:t})})}};function z9A(t,A){return{fetchFailureCount:0,fetchFailureReason:null,fetchStatus:xaA(A.networkMode)?"fetching":"paused",...t===void 0&&{error:null,status:"pending"}}}function yX(t){const A=typeof t.initialData=="function"?t.initialData():t.initialData,e=A!==void 0,i=e?typeof t.initialDataUpdatedAt=="function"?t.initialDataUpdatedAt():t.initialDataUpdatedAt:0;return{data:A,dataUpdateCount:0,dataUpdatedAt:e?i??Date.now():0,error:null,errorUpdateCount:0,errorUpdatedAt:0,fetchFailureCount:0,fetchFailureReason:null,fetchMeta:null,isInvalidated:!1,status:e?"success":"pending",fetchStatus:"idle"}}function SX(t){return{onFetch:(A,e)=>{const i=A.options,g=A.fetchOptions?.meta?.fetchMore?.direction,I=A.state.data?.pages||[],n=A.state.data?.pageParams||[];let o={pages:[],pageParams:[]},a=0;const r=async()=>{let s=!1;const B=D=>{Object.defineProperty(D,"signal",{enumerable:!0,get:()=>(A.signal.aborted?s=!0:A.signal.addEventListener("abort",()=>{s=!0}),A.signal)})},c=LaA(A.options,A.fetchOptions),E=async(D,y,S)=>{if(s)return Promise.reject();if(y==null&&D.pages.length)return Promise.resolve(D);const M=(()=>{const F={client:A.client,queryKey:A.queryKey,pageParam:y,direction:S?"backward":"forward",meta:A.options.meta};return B(F),F})(),k=await c(M),{maxPages:m}=A.options,U=S?T9A:x9A;return{pages:U(D.pages,k,m),pageParams:U(D.pageParams,y,m)}};if(g&&I.length){const D=g==="backward",y=D?V9A:wX,S={pages:I,pageParams:n},f=y(i,S);o=await E(S,f,D)}else{const D=t??I.length;do{const y=a===0?n[0]??i.initialPageParam:wX(i,o);if(a>0&&y==null)break;o=await E(o,y),a++}while(a<D)}return o};A.options.persister?A.fetchFn=()=>A.options.persister?.(r,{client:A.client,queryKey:A.queryKey,meta:A.options.meta,signal:A.signal},e):A.fetchFn=r}}}function wX(t,{pages:A,pageParams:e}){const i=A.length-1;return A.length>0?t.getNextPageParam(A[i],A,e[i],e):void 0}function V9A(t,{pages:A,pageParams:e}){return A.length>0?t.getPreviousPageParam?.(A[0],A,e[0],e):void 0}var X9A=class extends YaA{#A;#e;#t;#g;constructor(t){super(),this.#A=t.client,this.mutationId=t.mutationId,this.#t=t.mutationCache,this.#e=[],this.state=t.state||$9A(),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.#e.includes(t)||(this.#e.push(t),this.clearGcTimeout(),this.#t.notify({type:"observerAdded",mutation:this,observer:t}))}removeObserver(t){this.#e=this.#e.filter(A=>A!==t),this.scheduleGc(),this.#t.notify({type:"observerRemoved",mutation:this,observer:t})}optionalRemove(){this.#e.length||(this.state.status==="pending"?this.scheduleGc():this.#t.remove(this))}continue(){return this.#g?.continue()??this.execute(this.state.variables)}async execute(t){const A=()=>{this.#i({type:"continue"})},e={client:this.#A,meta:this.options.meta,mutationKey:this.options.mutationKey};this.#g=TaA({fn:()=>this.options.mutationFn?this.options.mutationFn(t,e):Promise.reject(new Error("No mutationFn found")),onFail:(I,n)=>{this.#i({type:"failed",failureCount:I,error:n})},onPause:()=>{this.#i({type:"pause"})},onContinue:A,retry:this.options.retry??0,retryDelay:this.options.retryDelay,networkMode:this.options.networkMode,canRun:()=>this.#t.canRun(this)});const i=this.state.status==="pending",g=!this.#g.canStart();try{if(i)A();else{this.#i({type:"pending",variables:t,isPaused:g}),await this.#t.config.onMutate?.(t,this,e);const n=await this.options.onMutate?.(t,e);n!==this.state.context&&this.#i({type:"pending",context:n,variables:t,isPaused:g})}const I=await this.#g.start();return await this.#t.config.onSuccess?.(I,t,this.state.context,this,e),await this.options.onSuccess?.(I,t,this.state.context,e),await this.#t.config.onSettled?.(I,null,this.state.variables,this.state.context,this,e),await this.options.onSettled?.(I,null,t,this.state.context,e),this.#i({type:"success",data:I}),I}catch(I){try{throw await this.#t.config.onError?.(I,t,this.state.context,this,e),await this.options.onError?.(I,t,this.state.context,e),await this.#t.config.onSettled?.(void 0,I,this.state.variables,this.state.context,this,e),await this.options.onSettled?.(void 0,I,t,this.state.context,e),I}finally{this.#i({type:"error",error:I})}}finally{this.#t.runNext(this)}}#i(t){const A=e=>{switch(t.type){case"failed":return{...e,failureCount:t.failureCount,failureReason:t.error};case"pause":return{...e,isPaused:!0};case"continue":return{...e,isPaused:!1};case"pending":return{...e,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{...e,data:t.data,failureCount:0,failureReason:null,error:null,status:"success",isPaused:!1};case"error":return{...e,data:void 0,error:t.error,failureCount:e.failureCount+1,failureReason:t.error,isPaused:!1,status:"error"}}};this.state=A(this.state),Va.batch(()=>{this.#e.forEach(e=>{e.onMutationUpdate(t)}),this.#t.notify({mutation:this,type:"updated",action:t})})}};function $9A(){return{context:void 0,data:void 0,error:null,failureCount:0,failureReason:null,isPaused:!1,status:"idle",variables:void 0,submittedAt:0}}var AXA=class extends hv{constructor(t={}){super(),this.config=t,this.#A=new Set,this.#e=new Map,this.#t=0}#A;#e;#t;build(t,A,e){const i=new X9A({client:t,mutationCache:this,mutationId:++this.#t,options:t.defaultMutationOptions(A),state:e});return this.add(i),i}add(t){this.#A.add(t);const A=tR(t);if(typeof A=="string"){const e=this.#e.get(A);e?e.push(t):this.#e.set(A,[t])}this.notify({type:"added",mutation:t})}remove(t){if(this.#A.delete(t)){const A=tR(t);if(typeof A=="string"){const e=this.#e.get(A);if(e)if(e.length>1){const i=e.indexOf(t);i!==-1&&e.splice(i,1)}else e[0]===t&&this.#e.delete(A)}}this.notify({type:"removed",mutation:t})}canRun(t){const A=tR(t);if(typeof A=="string"){const i=this.#e.get(A)?.find(g=>g.state.status==="pending");return!i||i===t}else return!0}runNext(t){const A=tR(t);return typeof A=="string"?this.#e.get(A)?.find(i=>i!==t&&i.state.isPaused)?.continue()??Promise.resolve():Promise.resolve()}clear(){Va.batch(()=>{this.#A.forEach(t=>{this.notify({type:"removed",mutation:t})}),this.#A.clear(),this.#e.clear()})}getAll(){return Array.from(this.#A)}find(t){const A={exact:!0,...t};return this.getAll().find(e=>pX(A,e))}findAll(t={}){return this.getAll().filter(A=>pX(t,A))}notify(t){Va.batch(()=>{this.listeners.forEach(A=>{A(t)})})}resumePausedMutations(){const t=this.getAll().filter(A=>A.state.isPaused);return Va.batch(()=>Promise.all(t.map(A=>A.continue().catch(tB))))}};function tR(t){return t.options.scope?.id}var eXA=class extends hv{constructor(t={}){super(),this.config=t,this.#A=new Map}#A;build(t,A,e){const i=A.queryKey,g=A.queryHash??O1(i,A);let I=this.get(g);return I||(I=new W9A({client:t,queryKey:i,queryHash:g,options:t.defaultQueryOptions(A),state:e,defaultOptions:t.getQueryDefaults(i)}),this.add(I)),I}add(t){this.#A.has(t.queryHash)||(this.#A.set(t.queryHash,t),this.notify({type:"added",query:t}))}remove(t){const A=this.#A.get(t.queryHash);A&&(t.destroy(),A===t&&this.#A.delete(t.queryHash),this.notify({type:"removed",query:t}))}clear(){Va.batch(()=>{this.getAll().forEach(t=>{this.remove(t)})})}get(t){return this.#A.get(t)}getAll(){return[...this.#A.values()]}find(t){const A={exact:!0,...t};return this.getAll().find(e=>dX(A,e))}findAll(t={}){const A=this.getAll();return Object.keys(t).length>0?A.filter(e=>dX(t,e)):A}notify(t){Va.batch(()=>{this.listeners.forEach(A=>{A(t)})})}onFocus(){Va.batch(()=>{this.getAll().forEach(t=>{t.onFocus()})})}onOnline(){Va.batch(()=>{this.getAll().forEach(t=>{t.onOnline()})})}},tXA=class{#A;#e;#t;#g;#i;#n;#o;#I;constructor(t={}){this.#A=t.queryCache||new eXA,this.#e=t.mutationCache||new AXA,this.#t=t.defaultOptions||{},this.#g=new Map,this.#i=new Map,this.#n=0}mount(){this.#n++,this.#n===1&&(this.#o=qaA.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#A.onFocus())}),this.#I=lF.subscribe(async t=>{t&&(await this.resumePausedMutations(),this.#A.onOnline())}))}unmount(){this.#n--,this.#n===0&&(this.#o?.(),this.#o=void 0,this.#I?.(),this.#I=void 0)}isFetching(t){return this.#A.findAll({...t,fetchStatus:"fetching"}).length}isMutating(t){return this.#e.findAll({...t,status:"pending"}).length}getQueryData(t){const A=this.defaultQueryOptions({queryKey:t});return this.#A.get(A.queryHash)?.state.data}ensureQueryData(t){const A=this.defaultQueryOptions(t),e=this.#A.build(this,A),i=e.state.data;return i===void 0?this.fetchQuery(t):(t.revalidateIfStale&&e.isStaleByTime(A2(A.staleTime,e))&&this.prefetchQuery(A),Promise.resolve(i))}getQueriesData(t){return this.#A.findAll(t).map(({queryKey:A,state:e})=>{const i=e.data;return[A,i]})}setQueryData(t,A,e){const i=this.defaultQueryOptions({queryKey:t}),I=this.#A.get(i.queryHash)?.state.data,n=F9A(A,I);if(n!==void 0)return this.#A.build(this,i).setData(n,{...e,manual:!0})}setQueriesData(t,A,e){return Va.batch(()=>this.#A.findAll(t).map(({queryKey:i})=>[i,this.setQueryData(i,A,e)]))}getQueryState(t){const A=this.defaultQueryOptions({queryKey:t});return this.#A.get(A.queryHash)?.state}removeQueries(t){const A=this.#A;Va.batch(()=>{A.findAll(t).forEach(e=>{A.remove(e)})})}resetQueries(t,A){const e=this.#A;return Va.batch(()=>(e.findAll(t).forEach(i=>{i.reset()}),this.refetchQueries({type:"active",...t},A)))}cancelQueries(t,A={}){const e={revert:!0,...A},i=Va.batch(()=>this.#A.findAll(t).map(g=>g.cancel(e)));return Promise.all(i).then(tB).catch(tB)}invalidateQueries(t,A={}){return Va.batch(()=>(this.#A.findAll(t).forEach(e=>{e.invalidate()}),t?.refetchType==="none"?Promise.resolve():this.refetchQueries({...t,type:t?.refetchType??t?.type??"active"},A)))}refetchQueries(t,A={}){const e={...A,cancelRefetch:A.cancelRefetch??!0},i=Va.batch(()=>this.#A.findAll(t).filter(g=>!g.isDisabled()&&!g.isStatic()).map(g=>{let I=g.fetch(void 0,e);return e.throwOnError||(I=I.catch(tB)),g.state.fetchStatus==="paused"?Promise.resolve():I}));return Promise.all(i).then(tB)}fetchQuery(t){const A=this.defaultQueryOptions(t);A.retry===void 0&&(A.retry=!1);const e=this.#A.build(this,A);return e.isStaleByTime(A2(A.staleTime,e))?e.fetch(A):Promise.resolve(e.state.data)}prefetchQuery(t){return this.fetchQuery(t).then(tB).catch(tB)}fetchInfiniteQuery(t){return t.behavior=SX(t.pages),this.fetchQuery(t)}prefetchInfiniteQuery(t){return this.fetchInfiniteQuery(t).then(tB).catch(tB)}ensureInfiniteQueryData(t){return t.behavior=SX(t.pages),this.ensureQueryData(t)}resumePausedMutations(){return lF.isOnline()?this.#e.resumePausedMutations():Promise.resolve()}getQueryCache(){return this.#A}getMutationCache(){return this.#e}getDefaultOptions(){return this.#t}setDefaultOptions(t){this.#t=t}setQueryDefaults(t,A){this.#g.set(uk(t),{queryKey:t,defaultOptions:A})}getQueryDefaults(t){const A=[...this.#g.values()],e={};return A.forEach(i=>{hk(t,i.queryKey)&&Object.assign(e,i.defaultOptions)}),e}setMutationDefaults(t,A){this.#i.set(uk(t),{mutationKey:t,defaultOptions:A})}getMutationDefaults(t){const A=[...this.#i.values()],e={};return A.forEach(i=>{hk(t,i.mutationKey)&&Object.assign(e,i.defaultOptions)}),e}defaultQueryOptions(t){if(t._defaulted)return t;const A={...this.#t.queries,...this.getQueryDefaults(t.queryKey),...t,_defaulted:!0};return A.queryHash||(A.queryHash=O1(A.queryKey,A)),A.refetchOnReconnect===void 0&&(A.refetchOnReconnect=A.networkMode!=="always"),A.throwOnError===void 0&&(A.throwOnError=!!A.suspense),!A.networkMode&&A.persister&&(A.networkMode="offlineFirst"),A.queryFn===P1&&(A.enabled=!1),A}defaultMutationOptions(t){return t?._defaulted?t:{...this.#t.mutations,...t?.mutationKey&&this.getMutationDefaults(t.mutationKey),...t,_defaulted:!0}}clear(){this.#A.clear(),this.#e.clear()}},iXA=p.createContext(void 0),gXA=({client:t,children:A})=>(p.useEffect(()=>(t.mount(),()=>{t.unmount()}),[t]),Q.jsx(iXA.Provider,{value:t,children:A}));const HaA=RaA({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}}}),OaA=RaA({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}}});j1.type="walletConnect";function j1(t){const A=t.isNewChainsStale??!0;let e,i;const g="eip155";let I,n,o,a,r,s;return B=>({id:"walletConnect",name:"WalletConnect",type:j1.type,async setup(){const c=await this.getProvider().catch(()=>null);c&&(o||(o=this.onConnect.bind(this),c.on("connect",o)),r||(r=this.onSessionDelete.bind(this),c.on("session_delete",r)))},async connect({chainId:c,withCapabilities:E,...D}={}){try{const y=await this.getProvider();if(!y)throw new kE;a||(a=this.onDisplayUri,y.on("display_uri",a));let S=c;if(!S){const m=await B.storage?.getItem("state")??{};B.chains.some(F=>F.id===m.chainId)?S=m.chainId:S=B.chains[0]?.id}if(!S)throw new Error("No chains found on connector.");const f=await this.isChainsStale();if(y.session&&f&&await y.disconnect(),!y.session||f){const m=B.chains.filter(U=>U.id!==S).map(U=>U.id);await y.connect({optionalChains:[S,...m],..."pairingTopic"in D?{pairingTopic:D.pairingTopic}:{}}),this.setRequestedChainsIds(B.chains.map(U=>U.id))}const M=(await y.enable()).map(m=>gd(m));let k=await this.getChainId();return c&&k!==c&&(k=(await this.switchChain({chainId:c}).catch(U=>{if(U.code===Yn.code&&U.cause?.message!=="Missing or invalid. request() method: wallet_addEthereumChain")throw U;return{id:k}}))?.id??k),a&&(y.removeListener("display_uri",a),a=void 0),o&&(y.removeListener("connect",o),o=void 0),I||(I=this.onAccountsChanged.bind(this),y.on("accountsChanged",I)),n||(n=this.onChainChanged.bind(this),y.on("chainChanged",n)),s||(s=this.onDisconnect.bind(this),y.on("disconnect",s)),r||(r=this.onSessionDelete.bind(this),y.on("session_delete",r)),{accounts:E?M.map(m=>({address:m,capabilities:{}})):M,chainId:k}}catch(y){throw/(user rejected|connection request reset)/i.test(y?.message)?new Yn(y):y}},async disconnect(){const c=await this.getProvider();try{await c?.disconnect()}catch(E){if(!/No matching key/i.test(E.message))throw E}finally{n&&(c?.removeListener("chainChanged",n),n=void 0),s&&(c?.removeListener("disconnect",s),s=void 0),o||(o=this.onConnect.bind(this),c?.on("connect",o)),I&&(c?.removeListener("accountsChanged",I),I=void 0),r&&(c?.removeListener("session_delete",r),r=void 0),this.setRequestedChainsIds([])}},async getAccounts(){return(await this.getProvider()).accounts.map(E=>gd(E))},async getProvider({chainId:c}={}){async function E(){const D=B.chains.map(S=>S.id);if(!D.length)return;const{EthereumProvider:y}=await pi(async()=>{const{EthereumProvider:S}=await import("./index.es-t2J44IRw.js").then(f=>f.Y);return{EthereumProvider:S}},[],import.meta.url);return await y.init({...t,disableProviderPing:!0,optionalChains:D,projectId:t.projectId,rpcMap:Object.fromEntries(B.chains.map(S=>{const[f]=k9A({chain:S,transports:B.transports});return[S.id,f]})),showQrModal:t.showQrModal??!0})}return e||(i||(i=E()),e=await i,e?.events.setMaxListeners(Number.POSITIVE_INFINITY)),c&&await this.switchChain?.({chainId:c}),e},async getChainId(){return(await this.getProvider()).chainId},async isAuthorized(){try{const[c,E]=await Promise.all([this.getAccounts(),this.getProvider()]);return c.length?await this.isChainsStale()&&E.session?(await E.disconnect().catch(()=>{}),!1):!0:!1}catch{return!1}},async switchChain({addEthereumChainParameter:c,chainId:E}){const D=await this.getProvider();if(!D)throw new kE;const y=B.chains.find(S=>S.id===E);if(!y)throw new cu(new cF);try{await Promise.all([new Promise(f=>{const M=({chainId:k})=>{k===E&&(B.emitter.off("change",M),f())};B.emitter.on("change",M)}),D.request({method:"wallet_switchEthereumChain",params:[{chainId:my(E)}]})]);const S=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...S,E]),y}catch(S){const f=S;if(/(user rejected)/i.test(f.message))throw new Yn(f);try{let M;c?.blockExplorerUrls?M=c.blockExplorerUrls:M=y.blockExplorers?.default.url?[y.blockExplorers?.default.url]:[];let k;c?.rpcUrls?.length?k=c.rpcUrls:k=[...y.rpcUrls.default.http];const m={blockExplorerUrls:M,chainId:my(E),chainName:c?.chainName??y.name,iconUrls:c?.iconUrls,nativeCurrency:c?.nativeCurrency??y.nativeCurrency,rpcUrls:k};await D.request({method:"wallet_addEthereumChain",params:[m]});const U=await this.getRequestedChainsIds();return this.setRequestedChainsIds([...U,E]),y}catch(M){throw new Yn(M)}}},onAccountsChanged(c){c.length===0?this.onDisconnect():B.emitter.emit("change",{accounts:c.map(E=>gd(E))})},onChainChanged(c){const E=Number(c);B.emitter.emit("change",{chainId:E})},async onConnect(c){const E=Number(c.chainId),D=await this.getAccounts();B.emitter.emit("connect",{accounts:D,chainId:E})},async onDisconnect(c){this.setRequestedChainsIds([]),B.emitter.emit("disconnect");const E=await this.getProvider();I&&(E.removeListener("accountsChanged",I),I=void 0),n&&(E.removeListener("chainChanged",n),n=void 0),s&&(E.removeListener("disconnect",s),s=void 0),r&&(E.removeListener("session_delete",r),r=void 0),o||(o=this.onConnect.bind(this),E.on("connect",o))},onDisplayUri(c){B.emitter.emit("message",{type:"display_uri",data:c})},onSessionDelete(){this.onDisconnect()},getNamespaceChainsIds(){return e?e.session?.namespaces[g]?.accounts?.map(E=>Number.parseInt(E.split(":")[1]||"",10))??[]:[]},async getRequestedChainsIds(){return await B.storage?.getItem(this.requestedChainsStorageKey)??[]},async isChainsStale(){if(!A)return!1;const c=B.chains.map(y=>y.id),E=this.getNamespaceChainsIds();if(E.length&&!E.some(y=>c.includes(y)))return!1;const D=await this.getRequestedChainsIds();return!c.every(y=>D.includes(y))},async setRequestedChainsIds(c){await B.storage?.setItem(this.requestedChainsStorageKey,c)},get requestedChainsStorageKey(){return`${this.id}.requestedChains`}})}var IXA={};const nXA=[HaA,OaA],oXA=new tXA,aXA=vaA({storage:w9A});function rXA(){const t=!!(import.meta.vitest||typeof process<"u"&&IXA?.VITEST_WORKER_ID),A=[uv({shimDisconnect:!0})];if(!t)try{A.push(j1({projectId:"demo",showQrModal:!0}))}catch{}return y9A({chains:nXA,multiInjectedProviderDiscovery:!0,transports:{[HaA.id]:lX(),[OaA.id]:lX()},connectors:A,ssr:!1,storage:aXA,syncConnectedChain:!0})}function sXA({children:t}){const A=rXA();return Q.jsx(G9A,{config:A,children:Q.jsx(gXA,{client:oXA,children:t})})}p.createContext(void 0);const PaA=p.createContext(void 0);async function CXA(){try{const t=new AbortController,A=setTimeout(()=>t.abort(),5e3),e=await fetch("/api/features",{cache:"no-store",signal:t.signal});return clearTimeout(A),e.ok?await e.json():null}catch{return null}}function BXA({children:t}){const[A,e]=p.useState(!1),[i,g]=p.useState(!1),I=async()=>{const n=await CXA();g(!!n?.features?.wallet),e(!0)};return p.useEffect(()=>{const n=I(),o=window.setTimeout(()=>{e(a=>!0)},6e3);return n.finally(()=>clearTimeout(o)),()=>clearTimeout(o)},[]),Q.jsx(PaA.Provider,{value:{loaded:A,walletEnabled:i,refresh:I},children:t})}function cXA(){return p.useContext(PaA)??{loaded:!0,walletEnabled:!1,refresh:()=>{}}}var mX;(function(t){t.Dark="DARK",t.Light="LIGHT",t.Default="DEFAULT"})(mX||(mX={}));var kX;(function(t){t.StatusBar="STATUS_BAR",t.NavigationBar="NAVIGATION_BAR"})(kX||(kX={}));const cx=mB("SafeArea",{web:()=>pi(()=>import("./web-DCafJTin.js"),[],import.meta.url).then(t=>new t.SafeAreaWeb)});class jaA extends ke.Component{state={hasError:!1};static getDerivedStateFromError(A){return{hasError:!0,error:A}}componentDidCatch(A,e){this.props.onError?.(A,e),mx.error("ErrorBoundary caught",{message:A?.message,stack:A?.stack?.slice(0,1e3),componentStack:e?.componentStack?.slice(0,500)})}handleReset=()=>{this.setState({hasError:!1,error:void 0}),this.props.onReset?.()};render(){return this.state.hasError?this.props.fallback?Q.jsx(Q.Fragment,{children:this.props.fallback}):Q.jsxs("div",{className:"error-boundary",role:"alert",style:{padding:16},children:[Q.jsx("h2",{children:"Something went wrong"}),Q.jsx("p",{children:"Please refresh or return to the previous screen."}),Q.jsx("button",{className:"felt-btn",onClick:this.handleReset,children:"Try again"})]}):this.props.children}}var MX;(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"})(MX||(MX={}));const i0=mB("LocalNotifications",{web:()=>pi(()=>import("./web-D1atVMKN.js"),[],import.meta.url).then(t=>new t.LocalNotificationsWeb)});let iR=null,NX=!1;async function lXA(){if(iR)return iR;if(NX)return null;NX=!0;try{const t=await pi(()=>import("./index-DQuxOAfX.js"),[],import.meta.url);return t?.FirebaseMessaging&&typeof t.FirebaseMessaging.getToken=="function"?(iR=t.FirebaseMessaging,iR):null}catch{return null}}let GX=!1,Ny=null;async function ZaA(t={}){if(GX)return;GX=!0;const A=Li.getPlatform();if(!(A==="ios"||A==="android"))return;const i=t.enableLocal!==!1,g=t.enablePush!==!1;if(i)try{await QXA()}catch{}if(g)try{await EXA(t.onPushToken)}catch{}}async function QXA(){try{if((await i0.requestPermissions()).display!=="granted")return}catch{}try{await i0.createChannel?.({id:"default",name:"General",description:"General notifications",importance:4,visibility:1,sound:void 0,lights:!0,vibration:!0})}catch{}try{i0.addListener("localNotificationActionPerformed",t=>{const A=t?.notification?.extra;A?.type&&WaA({notification:{data:A}})})}catch{}}async function EXA(t){const A=await lXA();if(A){try{if((await A.requestPermissions()).receive!=="granted")return}catch{return}try{const{token:e}=await A.getToken();if(e){Ny=e;try{t?.(e)}catch{}Gy(e)}}catch{}A.addListener("tokenReceived",({token:e})=>{Ny=e;try{t?.(e)}catch{}Gy(e)}),A.addListener("notificationReceived",e=>{const i=e?.notification,g=i?.title,I=i?.body;if(!g)return;const n=i?.data&&typeof i.data=="object"?{...i.data}:void 0;zaA(g,I||"",n).catch(()=>{})}),A.addListener("notificationActionPerformed",e=>{WaA(e)})}}let eU=!1,lx=!1,iD=0,i2=0;const RX=10,uXA=5e3;function hXA(){const t=globalThis?.APP_TARGET||"ceelo";switch(t){case"skills":return"com.zentaraone.skillslounge";case"craps":return"com.zentaraone.crapslounge";case"ceelo":return"com.zentaraone.ceelolounge";case"poker":return"com.zentaraone.pokerlounge";default:return t}}function Gy(t){const A=t||Ny;if(!A||eU&&A===Ny||lx)return;const e=Li.getPlatform();if(e==="web")return;const i=xcA();if(!i?.connected){iD++,iD<=RX&&setTimeout(()=>Gy(A),2e3);return}const g=hXA();A.substring(0,20)+""+A.substring(A.length-10),lx=!0,i.emit("push:register_token",{token:A,platform:e,appId:g},I=>{lx=!1,I?.success?(eU=!0,iD=0,i2=Date.now()):!eU&&iD<RX&&(iD++,setTimeout(()=>Gy(A),3e3))})}function dXA(){if(Ny){const t=Date.now();if(t-i2<uXA)return;i2=t,eU=!1,iD=0,Gy(Ny)}}function WaA(t){const A=t?.notification?.data;if(A)switch(A.type){case"game_invite":if(A.roomId){const e=A.gameType||"";let i;e==="poker"?i=`/poker/room/${A.roomId}`:e==="skills"?i=`/skills/room/${A.roomId}`:i=`/room/${A.roomId}`,window.location.href=i}break;case"friend_request":window.location.href="/profile";break;case"friend_accepted":window.location.href="/profile";break;case"message":A.senderId?window.location.href=`/messages?peer=${encodeURIComponent(A.senderId)}`:window.location.href="/messages";break;default:window.location.href="/lobby";break}}async function zaA(t,A,e){if(!(Li.getPlatform()==="ios"||Li.getPlatform()==="android"))return;try{if((await i0.checkPermissions()).display!=="granted")return}catch{}const I={notifications:[{id:Math.floor(Date.now()%2147483647),title:t,body:A,schedule:{at:new Date(Date.now()+10)},smallIcon:"ic_stat_name",channelId:"default",extra:e}]};try{await i0.schedule(I)}catch{}}const pXA=Object.freeze(Object.defineProperty({__proto__:null,initNotifications:ZaA,reRegisterPushToken:dXA,registerPushTokenWithServer:Gy,scheduleLocalNow:zaA},Symbol.toStringTag,{value:"Module"}));function fXA({cooldownMs:t=5e3,initialGraceMs:A=900}){const e=Xn(),{room:i}=Cs(),g=p.useRef(0),I=p.useRef(!1),n=p.useRef(!1),o=p.useRef(Date.now());return p.useEffect(()=>{(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})();const a=Date.now();try{window.__fgMountedAt=a}catch{}},[]),p.useEffect(()=>{let a=[],r=!1;const s=(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})(),B=async(f,M=!1)=>{if(r)return;const k=Date.now();if(!(!M&&k-o.current<A)&&!I.current&&!(!M&&k-g.current<t)){I.current=!0;try{const m=i?.id||void 0;if(e)if(s)try{const U=await Kx(e,ht.BOTS_NUDGE,{roomId:m},{timeoutMs:5e3});try{window.__fgLastAck=U}catch{}}catch{}else await x6(e,ht.BOTS_NUDGE,{roomId:m});g.current=k}catch{}finally{I.current=!1}}},c=async(f,M=!1)=>{if(r)return;const k=Date.now();if(!(!M&&k-o.current<A)&&!n.current){if(n.current=!0,!M&&k-g.current<t){n.current=!1;return}try{const m=i?.id||void 0;if(!e)return;try{await wm(e)}catch{}try{(await Kx(e,ht.ROOM_REFRESH_STATE,{roomId:m},{timeoutMs:5e3}))?.ok,g.current=k}catch{}}catch{}finally{n.current=!1}}};try{window.__fgNudge=(f,M)=>{B(f||"manual",!!M)}}catch{}(async()=>{try{const f=await er.addListener("appStateChange",M=>{if(!r)if(M.isActive)(async()=>{try{await wm(e)}catch{}B("native_appstate_active",!0),c("native_appstate_active")})();else try{ad(e,"BotNudgeOnForeground: appStateChange inactive")}catch{}});try{window.__fgAppStateListener=!0}catch{}a.push(()=>{try{f.remove()}catch{}})}catch{}})(),(async()=>{try{const f=await er.addListener("pause",()=>{try{window?.Capacitor?.isNativePlatform&&ad(e,"BotNudgeOnForeground: pause event")}catch{}});try{window.__fgPauseListener=!0}catch{}a.push(()=>{try{f.remove()}catch{}})}catch{}})(),(async()=>{try{const f=await er.addListener("resume",async()=>{try{await wm(e)}catch{}B("native_resume",!0),c("native_resume")});try{window.__fgResumeListener=!0}catch{}a.push(()=>{try{f.remove()}catch{}})}catch{}})();const E=()=>{r||document.visibilityState==="visible"&&(B(),c())};document.addEventListener("visibilitychange",E),a.push(()=>document.removeEventListener("visibilitychange",E));const D=()=>{r||(B(),c())},y=()=>{r||(B(),c())};window.addEventListener("focus",D),window.addEventListener("pageshow",y),a.push(()=>{window.removeEventListener("focus",D),window.removeEventListener("pageshow",y)});const S=setTimeout(()=>{B(),c()},2500);return a.push(()=>clearTimeout(S)),()=>{r=!0,a.forEach(f=>{try{f()}catch{}})}},[e,i?.id,t]),null}function vo(){try{const t=performance.memory;return t?{usedJSHeapMB:Math.round(t.usedJSHeapSize/1048576),totalJSHeapMB:Math.round(t.totalJSHeapSize/1048576),limitJSHeapMB:Math.round(t.jsHeapSizeLimit/1048576)}:void 0}catch{return}}function DXA(){const t=Xn(),A=p.useRef(Date.now());return p.useEffect(()=>{let e=!1;const i=[];Tn.info("NativeCrashLogger mounted",{mem:vo()});async function g(){const I=[er.addListener("appStateChange",o=>{e||(o.isActive?Tn.info("appStateChange → ACTIVE",{mem:vo(),since:Date.now()-A.current}):Tn.warn("appStateChange → INACTIVE",{mem:vo()}))}),er.addListener("pause",()=>{e||Tn.warn("PAUSE (backgrounded)",{mem:vo()})}),er.addListener("resume",()=>{e||Tn.info("RESUME (foregrounded)",{mem:vo()})}),er.addListener("backButton",()=>{e||Tn.info("BACK_BUTTON pressed")})],n=await Promise.allSettled(I);for(const o of n)if(o.status==="fulfilled")if(e)try{o.value.remove()}catch{}else i.push(o.value)}return g().catch(()=>{}),()=>{e=!0,i.forEach(I=>{try{I.remove()}catch{}})}},[]),p.useEffect(()=>{const e=()=>{document.visibilityState==="hidden"?Tn.warn("visibility → HIDDEN",{mem:vo()}):Tn.info("visibility → VISIBLE",{mem:vo()})},i=()=>Tn.info("network → ONLINE"),g=()=>Tn.warn("network → OFFLINE"),I=()=>Tn.error("PAGE FREEZE (frozen)",{mem:vo()}),n=a=>Tn.warn("pagehide",{persisted:a.persisted,mem:vo()}),o=a=>Tn.info("pageshow",{persisted:a.persisted,mem:vo()});return document.addEventListener("visibilitychange",e),window.addEventListener("online",i),window.addEventListener("offline",g),window.addEventListener("freeze",I),window.addEventListener("pagehide",n),window.addEventListener("pageshow",o),()=>{document.removeEventListener("visibilitychange",e),window.removeEventListener("online",i),window.removeEventListener("offline",g),window.removeEventListener("freeze",I),window.removeEventListener("pagehide",n),window.removeEventListener("pageshow",o)}},[]),p.useEffect(()=>{if(!t)return;const e=t,i=()=>Sc.info("CONNECTED",{id:e.id,transport:e.io?.engine?.transport?.name}),g=s=>Sc.warn("DISCONNECTED",{reason:s,mem:vo()}),I=s=>Sc.error("CONNECT_ERROR",{message:s?.message,type:s?.type}),n=s=>Sc.info("RECONNECTED",{attempt:s}),o=s=>Sc.debug("reconnect_attempt",{attempt:s}),a=s=>Sc.warn("reconnect_error",{message:s?.message}),r=()=>Sc.error("RECONNECT_FAILED (gave up)");return e.on("connect",i),e.on("disconnect",g),e.on("connect_error",I),e.io?.on?.("reconnect",n),e.io?.on?.("reconnect_attempt",o),e.io?.on?.("reconnect_error",a),e.io?.on?.("reconnect_failed",r),()=>{e.off("connect",i),e.off("disconnect",g),e.off("connect_error",I),e.io?.off?.("reconnect",n),e.io?.off?.("reconnect_attempt",o),e.io?.off?.("reconnect_error",a),e.io?.off?.("reconnect_failed",r)}},[t]),p.useEffect(()=>{const e=g=>{r0.error("WebGL CONTEXT LOST",{tagName:g.target?.tagName,mem:vo()})},i=g=>{r0.info("WebGL context restored",{tagName:g.target?.tagName})};return document.addEventListener("webglcontextlost",e,!0),document.addEventListener("webglcontextrestored",i,!0),()=>{document.removeEventListener("webglcontextlost",e,!0),document.removeEventListener("webglcontextrestored",i,!0)}},[]),p.useEffect(()=>{const e=g=>{try{const I=g.message||"";if(I.includes("websocket error")||I.includes("WebSocket"))return;mx.error("window.error",{message:I,filename:g.filename,line:g.lineno,col:g.colno,stack:g.error?.stack?.slice?.(0,1e3),mem:vo()})}catch{}},i=g=>{try{const I=g.reason,n=typeof I=="string"?I:I?.message||"unhandledrejection";if(I?.name==="AbortError"||n?.includes?.("aborted"))return;mx.error("unhandledrejection",{message:n?.slice?.(0,500),stack:(I?.stack||"").slice?.(0,1e3),mem:vo()})}catch{}};return window.addEventListener("error",e),window.addEventListener("unhandledrejection",i),()=>{window.removeEventListener("error",e),window.removeEventListener("unhandledrejection",i)}},[]),p.useEffect(()=>{if(!performance.memory)return;const e=setInterval(()=>{const i=vo();i&&i.usedJSHeapMB>150&&Tn.warn("HIGH_MEMORY",i)},3e4);return()=>clearInterval(e)},[]),p.useEffect(()=>{if(typeof PerformanceObserver>"u")return;let e=null;try{e=new PerformanceObserver(i=>{for(const g of i.getEntries()){const I=Math.round(g.duration);I>200&&Tn.warn("LONG_TASK",{durationMs:I,name:g.name,startTime:Math.round(g.startTime),mem:vo()})}}),e.observe({type:"longtask",buffered:!1})}catch{}return()=>{try{e?.disconnect()}catch{}}},[]),p.useEffect(()=>{let g=Date.now();const I=setInterval(()=>{const n=Date.now(),o=n-g;o>5e3&&Tn.error("EVENT_LOOP_STALL",{gapMs:o,expectedMs:2e3,mem:vo()}),g=n},2e3);return()=>clearInterval(I)},[]),p.useEffect(()=>{try{window.__dumpLogs=()=>a0(),window.__dumpCrashLogs=()=>f2()}catch{}},[]),null}function yXA(){const[t,A]=p.useState(()=>{try{return window.localStorage?.getItem("sfxDebug")==="1"}catch{return!1}}),[e,i]=p.useState([]),g=200,I=p.useRef(null);if(p.useEffect(()=>{if(!t)return;const o=a=>{try{const r=a.detail;i(s=>{const B=[...s,r];return B.length>g&&B.splice(0,B.length-g),B})}catch{}};return window.addEventListener("sfx:debug",o),()=>window.removeEventListener("sfx:debug",o)},[t]),!t)return null;const n=p.useMemo(()=>e.map(o=>{const r=[new Date(o.t||Date.now()).toLocaleTimeString(),o.kind];return o.key&&r.push(o.key),o.volume!=null&&r.push(`v=${o.volume}`),o.rate!=null&&r.push(`r=${o.rate}`),o.reason&&r.push(`(${o.reason})`),r.join(" ")}),[e]);return p.useEffect(()=>{try{I.current?.scrollTo({top:I.current.scrollHeight})}catch{}},[n.length]),Q.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:[Q.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[Q.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"SFX Debug"}),Q.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[Q.jsx("button",{className:"btn btn-xxs",onClick:()=>i([]),children:"Clear"}),Q.jsx("button",{className:"btn btn-xxs",onClick:()=>{A(!1);try{localStorage.removeItem("sfxDebug")}catch{}},children:"Close"})]})]}),Q.jsx("div",{ref:I,style:{maxHeight:196,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:n.map((o,a)=>Q.jsx("div",{children:o},a))})]})}function SXA(){const[t,A]=p.useState(()=>{try{const a=new URL(window.location.href).searchParams.get("rtcDebug")==="1",r=window.localStorage?.getItem("rtcDebug")==="1",s=window.__RTC_DEBUG__===!0;return a||r||s}catch{return!1}}),[e,i]=p.useState(()=>{try{return a0().filter(o=>o?.tag==="RTC")}catch{return[]}}),g=400,I=p.useRef(null);if(p.useEffect(()=>{const o=r=>{r.key==="rtcDebug"&&A(r.newValue==="1")};window.addEventListener("storage",o),window.rtcDebugOpen=()=>A(!0),window.rtcDebugClose=()=>A(!1);const a=()=>{try{new URL(window.location.href).searchParams.get("rtcDebug")==="1"&&A(!0)}catch{}};return window.addEventListener("popstate",a),()=>{window.removeEventListener("storage",o),window.removeEventListener("popstate",a);try{delete window.rtcDebugOpen,delete window.rtcDebugClose}catch{}}},[]),p.useEffect(()=>{if(!t)return;const o=a=>{try{const r=a.detail;if(!r||r.tag!=="RTC")return;i(s=>{const B=[...s,r];return B.length>g&&B.splice(0,B.length-g),B})}catch{}};return window.addEventListener("fe:log",o),()=>window.removeEventListener("fe:log",o)},[t]),!t)return null;const n=p.useMemo(()=>e.map(o=>{const a=new Date(o.t||Date.now()).toLocaleTimeString(),r=o.level?.toUpperCase?.()||"LOG",s=o.msg||"",B=o.data?JSON.stringify(o.data):"";return`${a} ${r} ${s} ${B}`}),[e]);return p.useEffect(()=>{try{I.current?.scrollTo({top:I.current.scrollHeight})}catch{}},[n.length]),Q.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:[Q.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[Q.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"RTC Debug"}),Q.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[Q.jsx("button",{className:"btn btn-xxs",onClick:()=>i([]),children:"Clear"}),Q.jsx("button",{className:"btn btn-xxs",onClick:()=>{try{navigator.clipboard.writeText(JSON.stringify(e,null,2))}catch{}},children:"Copy"}),Q.jsx("button",{className:"btn btn-xxs",onClick:()=>{A(!1);try{localStorage.removeItem("rtcDebug"),window.__RTC_DEBUG__=!1}catch{}},children:"Close"})]})]}),Q.jsx("div",{ref:I,style:{maxHeight:212,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:n.map((o,a)=>Q.jsx("div",{children:o},a))})]})}function wXA(){const{meId:t}=Yi(),A=Di(),e=ln(),{info:i,onIdle:g}=qr(),{room:I,setRoom:n}=Cs(),{leaveRoom:o}=Xc(),a=ke.useRef(!1);return ke.useEffect(()=>{const r=e.pathname||"";/^\/(room|poker\/room)\//.test(r)||(a.current=!1)},[e.pathname]),$n({onPlayerBalanceUpdated:({playerId:r,balance:s})=>{if(!(!t||r!==t)&&typeof s=="number"&&!(s>0)&&!a.current&&!uF){a.current=!0;try{I?.id&&typeof o=="function"&&o(I.id)}catch{}try{n?.(null)}catch{}try{i("Out of Chips","Returning to Lobby…")}catch{}try{A("/lobby",{replace:!0})}catch{}}}}),null}function mXA(t){switch(t){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";case"skills":return"Skills Duel";case"zentara":return"Zentara";default:return t}}function kXA(){const t=eIA(),A=Di(),e=p.useRef(null),{getGameRoute:i}=G2(),g=t?.currentInvite;if(p.useEffect(()=>{if(!g)return;const a=s=>{s.key==="Escape"&&t?.dismissCurrentInvite()},r=s=>{e.current&&!e.current.contains(s.target)&&t?.dismissCurrentInvite()};return document.addEventListener("keydown",a),document.addEventListener("mousedown",r),()=>{document.removeEventListener("keydown",a),document.removeEventListener("mousedown",r)}},[g,t]),!g)return null;const I=async()=>{const a=await t?.acceptInvite(g.inviteId);if(a?.ok&&a.roomId){const r=i(g.gameMode,a.roomId);A(r)}},n=()=>{t?.declineInvite(g.inviteId)},o=Q.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:Q.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Game invite",ref:e,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:[Q.jsx("button",{className:"modal-close",onClick:n,"aria-label":"Close",style:{position:"absolute",top:8,right:8,background:"none",border:"none",color:"#fff",fontSize:"1.5rem",cursor:"pointer",opacity:.7},children:"×"}),Q.jsx("h3",{className:"modal-title",style:{marginBottom:12,textAlign:"center",color:"#fff"},children:"🎲 Game Invite"}),Q.jsxs("div",{style:{textAlign:"center",marginBottom:16,color:"#fff"},children:[Q.jsxs("p",{style:{fontSize:"1rem",margin:"8px 0"},children:[Q.jsx("strong",{children:g.fromUserName})," has invited you to play"]}),Q.jsx("p",{style:{fontSize:"1.25rem",fontWeight:600,color:"var(--gold, #ffc107)",margin:"8px 0"},children:mXA(g.gameMode)}),Q.jsxs("p",{style:{fontSize:"0.875rem",opacity:.8,margin:"4px 0"},children:["Room: ",g.roomName]})]}),Q.jsxs("div",{style:{display:"flex",gap:12,marginTop:20,justifyContent:"center"},children:[Q.jsx("button",{className:"felt-btn btn--ghost",onClick:n,style:{minWidth:100},children:"Decline"}),Q.jsx("button",{className:"felt-btn felt-btn--primary",onClick:I,style:{minWidth:100},children:"Join Game"})]})]})});return Zc.createPortal(o,document.body)}function MXA(){const t=Xn(),A=p.useRef(0);return p.useEffect(()=>{let e;const i=()=>{try{const g=CR(),I=g.length?g[g.length-1].ts:0,n=Date.now();if(!t.connected&&n-I>2e4&&n-A.current>1e4){A.current=n;try{CB(t,"SocketWatchdog")}catch{}}}catch{}e=setTimeout(i,2e3),e.unref?.()};return i(),()=>clearTimeout(e)},[t]),null}function NXA({children:t,skip:A=!1,maxWaitMs:e=4e3}){const[i,g]=p.useState(!1),[I,n]=p.useState({loaded:0,total:0}),[o,a]=p.useState(!1),r=Li.isNativePlatform();p.useEffect(()=>{(!r||A)&&g(!0)},[r,A]);const s=p.useCallback(async()=>{if(o)return;a(!0);try{await Cg()}catch{}await RlA(e)||U4(),g(!0)},[o,e]);return p.useEffect(()=>{if(!o||i)return;const B=setInterval(()=>{const c=GlA();n(c),U4()&&g(!0)},50);return()=>clearInterval(B)},[o,i]),i?Q.jsx(Q.Fragment,{children:t}):Q.jsx("div",{className:"sound-preload-screen",onClick:s,onTouchStart:s,children:Q.jsx("div",{className:"sound-preload-content",children:o?Q.jsxs(Q.Fragment,{children:[Q.jsx("p",{className:"sound-preload-status",children:"Loading game..."}),I.total>0&&Q.jsx("div",{className:"sound-preload-progress",children:Q.jsx("div",{className:"sound-preload-progress-bar",style:{width:`${Math.round(I.loaded/I.total*100)}%`}})})]}):Q.jsxs(Q.Fragment,{children:[Q.jsx(bH,{}),Q.jsx("p",{className:"sound-preload-tap",children:"Start"})]})})})}function GXA(){const t=MQ();return p.useEffect(()=>{const A=e=>{const i=e?.detail?.amount;typeof i=="number"&&i>0&&t.success(`+${i.toLocaleString()} daily credits added!`,{title:"Daily Bonus",duration:4500})};return window.addEventListener("daily-grant",A),()=>window.removeEventListener("daily-grant",A)},[t]),null}function RXA(){return iIA(),null}const UX=["#ffd700","#f4c430","#ff6b6b","#4ecdc4","#45b7d1","#96ceb4","#ff9ff3","#54a0ff","#5f27cd","#ee5a24","#0abde3","#10ac84"],UXA=6e3;function KXA(t=40){return p.useMemo(()=>Array.from({length:t},(A,e)=>({left:`${Math.random()*100}%`,background:UX[e%UX.length],animationDelay:`${Math.random()*.8}s`,animationDuration:`${1.8+Math.random()*1.2}s`,width:`${5+Math.random()*6}px`,height:`${5+Math.random()*6}px`,borderRadius:Math.random()>.5?"50%":"2px"})),[t])}function FXA(){const t=Xn(),{refreshUser:A}=Yi(),[e,i]=p.useState(null),g=KXA();p.useEffect(()=>{if(!t)return;const a=r=>{!r||typeof r.newLevel!="number"||(i(r),A({force:!0}))};return t.on("sp:level_up",a),()=>{t.off("sp:level_up",a)}},[t,A]),p.useEffect(()=>{if(!e)return;const a=window.setTimeout(()=>i(null),UXA);return()=>window.clearTimeout(a)},[e]);const I=p.useCallback(()=>i(null),[]);if(!e)return null;const n=e.levelName||uY.find(a=>a.level===e.newLevel)?.name||`Level ${e.newLevel}`,o=Q.jsx("div",{className:"levelup-backdrop",onClick:I,role:"dialog","aria-modal":"true","aria-label":"Level up celebration",children:Q.jsxs("div",{className:"levelup-card",onClick:a=>a.stopPropagation(),children:[Q.jsx("div",{className:"levelup-confetti",children:g.map((a,r)=>Q.jsx("div",{className:"levelup-confetti-piece",style:a},r))}),Q.jsx("div",{className:"levelup-stars",children:"⭐⭐⭐"}),Q.jsx("p",{className:"levelup-title",children:"Level Up!"}),Q.jsx("p",{className:"levelup-level",children:e.newLevel}),Q.jsx("p",{className:"levelup-name",children:n}),Q.jsx("p",{className:"levelup-subtitle",children:"New bots and themes unlocked"}),Q.jsx("button",{className:"levelup-btn",onClick:I,children:"Let’s Go"})]})});return Zc.createPortal(o,document.body)}const Zf=$cA(),bXA=Zf==="skills"?ZzA:Zf==="ceelo"?lzA:Zf==="craps"?QzA:Zf==="poker"?EzA:Zf==="zentara"?zzA:Zf==="unified"?WzA:czA;try{const t=Li.getPlatform();if((t==="ios"||t==="android")&&(Promise.resolve(cx.enable?.({config:{customColorsForSystemBars:!0,statusBarColor:"#00000000",statusBarContent:"light",navigationBarColor:"#00000000",navigationBarContent:"light"}})).catch(()=>{}),Wy().catch(A=>{})),t==="ios"||t==="android"){let A=0,e=0;const I=t==="ios"?47:36,n=async()=>{try{const a=await cx.getSafeAreaInsets?.(),r=Math.round(a?.insets?.top??a?.top??0),s=Math.round(a?.insets?.bottom??a?.bottom??0),B=window.innerHeight>window.innerWidth;B&&r>0&&(A=r),B&&s>0&&(e=s);const c=B?r>0?r:A:r,E=B?s>0?s:e:s,D=Math.max(c,I),y=document.documentElement;y.style.setProperty("--safe-top-global",`${D}px`),y.style.setProperty("--safe-bottom",`${E}px`),y.style.transform="translateZ(0)",requestAnimationFrame(()=>{y.style.transform=""})}catch{const a=document.documentElement;a.style.transform="translateZ(0)",requestAnimationFrame(()=>{a.style.transform=""})}};n();const o=()=>{setTimeout(n,50),setTimeout(n,150),setTimeout(n,300),setTimeout(n,500)};window.addEventListener("orientationchange",o),window.addEventListener("resize",n);try{cx.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(Li.getPlatform()==="android"){const e=()=>{let i=24;const g=window.visualViewport;if(g&&typeof window.innerHeight=="number"){const I=Math.max(0,Math.round(window.innerHeight-(g.height+g.offsetTop)));I>0&&I<64&&(i=I)}document.documentElement.style.setProperty("--android-safe-area-bottom",`${i}px`),document.documentElement.style.setProperty("--android-safe-area-top","36px"),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 vXA(){const{loaded:t,walletEnabled:A}=cXA(),e=Di(),i=ln(),g=p.useRef(null),I=p.useRef(Date.now());return p.useEffect(()=>{const a=()=>{g.current&&window.clearTimeout(g.current),g.current=window.setTimeout(()=>{i.pathname!=="/lobby"&&e("/lobby",{replace:!0})},24e4)},r=()=>{I.current=Date.now(),a()};a();const s=()=>r(),B=()=>r(),c=()=>{document.visibilityState==="visible"&&r()};return window.addEventListener("pointerdown",s,{capture:!0}),window.addEventListener("keydown",B,{capture:!0}),document.addEventListener("visibilitychange",c),()=>{g.current&&window.clearTimeout(g.current),window.removeEventListener("pointerdown",s,{capture:!0}),window.removeEventListener("keydown",B,{capture:!0}),document.removeEventListener("visibilitychange",c)}},[e,i.pathname]),t?(o=>A?Q.jsx(sXA,{children:o}):Q.jsx(Q.Fragment,{children:o}))(Q.jsx(ZcA,{children:Q.jsx(ZSA,{children:Q.jsxs(VqA,{children:[Q.jsx(AVA,{}),Q.jsx(jlA,{children:Q.jsx(cwA,{children:Q.jsxs(PcA,{children:[Q.jsx(tVA,{}),Q.jsx(ZKA,{children:Q.jsx(YKA,{children:Q.jsx(rNA,{children:Q.jsx(yxA,{children:Q.jsx(sNA,{children:Q.jsx(zKA,{children:Q.jsxs(AlA,{children:[Q.jsx(GXA,{}),Q.jsxs(jaA,{children:[Q.jsx(bXA,{}),Q.jsx(kXA,{}),Q.jsx(wXA,{}),Q.jsx(fXA,{}),Q.jsx(DXA,{}),Q.jsx(yXA,{}),Q.jsx(SXA,{}),Q.jsx(MXA,{}),Q.jsx(FXA,{})]})]})})})})})})})]})})})]})})})):Q.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[Q.jsx(Po,{className:"page-home-screen"}),Q.jsx("div",{className:"home-preloader",children:Q.jsx("div",{className:"home-preloader__spinner"})})]})}function _XA(){return p.useEffect(()=>{const t={current:null};return t.current=()=>{try{Cg()}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)}},[]),p.useEffect(()=>{try{ZaA()}catch{}},[]),Q.jsxs(NXA,{maxWaitMs:5e3,children:[Q.jsx(RXA,{}),Q.jsx(GcA,{children:Q.jsx(sCA,{children:Q.jsx(BXA,{children:Q.jsx(vXA,{})})})})]})}function JXA(t){const A=t?.healthIntervalMs??8e3,e=t?.maxRetriesPerPlay??3;t?.debug;const[i,g]=p.useState(!1),[I,n]=p.useState(!1),[o,a]=p.useState(1),r=p.useRef({plays:0,failures:0,recovered:0,rebuilds:0}),s=p.useRef({}),B=p.useRef(!0),c=p.useRef(!1),E=p.useRef(null),D=(...F)=>{},y=p.useCallback(()=>{if(i||c.current)return;c.current=!0;const F=()=>{try{TlA?.(),g(!0),D("activated via user gesture")}catch{}window.removeEventListener("pointerdown",F),window.removeEventListener("touchstart",F),window.removeEventListener("keydown",F)};window.addEventListener("pointerdown",F,{passive:!0,once:!0}),window.addEventListener("touchstart",F,{passive:!0,once:!0}),window.addEventListener("keydown",F,{passive:!0,once:!0})},[i,D]);p.useEffect(()=>{y()},[y]);const S=F=>{try{typeof b4=="function"&&(b4(F),r.current.rebuilds+=1,D("rebuild asset",F))}catch{}},f=p.useCallback(async(F,b)=>{if(I&&!b?.allowDuringMute)return!1;i||y();const K=b?.volume??o;let R=0;const G=()=>new Promise(J=>{let x=!1;const H=P=>{x||(x=!0,J(P))};try{const P=YlA?.(F,{volume:K,rate:b?.rate,loop:b?.loop});P&&typeof P.then=="function"?P.then(()=>H(!0)).catch(()=>H(!1)):setTimeout(()=>H(!0),0)}catch{H(!1)}});for(;R<=e;){if(await G())return r.current.plays+=1,R>0&&(r.current.recovered+=1),s.current[F]=0,!0;if(R+=1,r.current.failures+=1,s.current[F]=(s.current[F]||0)+1,s.current[F]>=3&&S(F),R>e)break;await new Promise(x=>setTimeout(x,60*R))}return!1},[I,i,y,o,e,D]),M=p.useCallback(F=>{try{HlA?.(F)}catch{}},[]),k=p.useCallback(F=>{n(F)},[]),m=p.useCallback(F=>{a(Math.max(0,Math.min(1,F)))},[]);return p.useEffect(()=>{const F=async()=>{if(!B.current||!i)return;const b=r.current,K=b.plays+b.failures;if(K>=4){const R=b.failures/(K||1);if(R>.4){D("elevated failure ratio",R.toFixed(2),"running probe");try{await f("__probe__",{volume:0,allowDuringMute:!0})||(g(!1),c.current=!1,y(),D("probe failed → deactivated, awaiting gesture"))}catch{}}}};return E.current=window.setInterval(F,A),()=>{E.current&&window.clearInterval(E.current)}},[A,i,f,y,D]),p.useEffect(()=>{const F=()=>{document.visibilityState==="visible"&&i&&f("__probe__",{volume:0,allowDuringMute:!0})};return document.addEventListener("visibilitychange",F),()=>document.removeEventListener("visibilitychange",F)},[i,f]),p.useEffect(()=>()=>{B.current=!1},[]),{play:f,preload:M,setMuted:k,setVolume:m,activationPrompt:y,isActivated:i,isMuted:I,volume:o,stats:r.current}}function LXA({children:t,config:A}){return JXA(A),Q.jsx(Q.Fragment,{children:t})}const qXA=[{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 xXA({id:t,variant:A}){const e=qXA.find(I=>I.id===t);if(!e)return Q.jsx("div",{style:{color:"#fff",padding:40},children:"Avatar not found"});const i=(A||"").toLowerCase(),g=i==="win"?"win":i==="lose"?"lose":i==="push"?"push":"";return Q.jsxs("div",{className:"avatar-shot"+(g?` variant-${g}`:""),children:[Q.jsxs("div",{className:"avatar-shot__frame",children:[Q.jsx("img",{src:e.file,alt:e.label,className:"avatar-shot__img"}),g&&Q.jsx("div",{className:"avatar-shot__fx fx-"+g})]}),Q.jsx("div",{className:"avatar-shot__label",children:e.label})]})}function TXA(t,A){const e=/^\/capture\/avatar\/([a-z])$/i.exec(t);if(!e)return null;const g=new URLSearchParams(A).get("variant")||void 0;return{id:e[1].toLowerCase(),variant:g}}const YXA=[{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"}],VaA={"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 HXA(t){const A=/^\/capture\/cee-lo\/([a-z0-9-]+)$/i.exec(t);if(!A)return null;const e=A[1];return VaA[e]?{scene:e}:null}function OXA({scene:t}){const A=VaA[t];return A?Q.jsx("div",{className:"cl-scene"+(A.shake?" fx-bg-shake":""),"data-scene":t,children:Q.jsxs("div",{className:"cl-table",children:[Q.jsx(PXA,{banker:A.banker,results:A.results,chipDeltas:A.chipDeltas}),Q.jsx(jXA,{dice:A.dice,rolling:A.rolling}),A.point!=null&&A.point!==void 0&&Q.jsx(WXA,{point:A.point}),A.showRoll&&Q.jsx(zXA,{}),A.roundSummary&&Q.jsx(VXA,{text:A.roundSummary})]})}):Q.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function PXA({banker:t,results:A,chipDeltas:e}){return Q.jsx("div",{className:"cl-seats",children:YXA.map(i=>{const g=A?.[i.id]||"idle";return Q.jsxs("div",{className:"cl-seat"+(i.id===t?" is-banker":"")+(g!=="idle"?` res-${g}`:""),children:[Q.jsxs("div",{className:"cl-seat__avatar",children:[Q.jsx("img",{src:i.avatar,alt:i.name}),g!=="idle"&&Q.jsx("div",{className:"cl-seat__fx fx-"+g})]}),Q.jsx("div",{className:"cl-seat__name",children:i.name}),e?.[i.id]&&Q.jsx("div",{className:"cl-seat__delta",children:e[i.id]})]},i.id)})})}function jXA({dice:t,rolling:A}){return Q.jsx("div",{className:"cl-dice","aria-label":"dice",children:t.map((e,i)=>Q.jsx(ZXA,{value:e,rolling:A},i))})}function ZXA({value:t,rolling:A}){const e=t===0?"?":String(t);return Q.jsx("div",{className:"cl-die"+(A?" is-rolling":""),children:e})}function WXA({point:t}){return Q.jsxs("div",{className:"cl-point",children:["POINT: ",t]})}function zXA(){return Q.jsx("div",{className:"cl-roll-btn",children:"ROLL"})}function VXA({text:t}){return Q.jsx("div",{className:"cl-summary",children:t})}async function XXA(){try{const t=window.location.protocol;if(!(t==="capacitor:"||t==="ionic:"))return;let e=null;try{e=window.Capacitor?.Plugins?.Keyboard||null}catch{}try{const I=window.visualViewport,n=s=>{try{document.documentElement.classList.toggle("kb-open",!!s),document.body.classList.toggle("kb-open",!!s)}catch{}};let o=I?.height??window.innerHeight;const a=()=>{try{o=I?.height??window.innerHeight}catch{}},r=()=>{try{const s=I?.height??window.innerHeight,B=Math.max(0,o-s);n(B>60)}catch{}};I?(I.addEventListener("resize",r),I.addEventListener("scroll",r)):(window.addEventListener("resize",r),window.addEventListener("orientationchange",()=>{a(),r()})),window.addEventListener("focusin",s=>{const B=s?.target;!!B&&(B.tagName==="INPUT"||B.tagName==="TEXTAREA"||B.isContentEditable)&&n(!0)}),window.addEventListener("focusout",()=>{window.setTimeout(r,120)}),window.setTimeout(()=>{a(),r()},50)}catch{}if(e)try{await e.setResizeMode({mode:"none"})}catch{}const i=()=>{try{document.documentElement.classList.add("kb-open"),document.body.classList.add("kb-open")}catch{}},g=()=>{try{document.documentElement.classList.remove("kb-open"),document.body.classList.remove("kb-open")}catch{}};try{e?.addListener?.("keyboardWillShow",i)}catch{}try{e?.addListener?.("keyboardDidShow",i)}catch{}try{e?.addListener?.("keyboardWillHide",g)}catch{}try{e?.addListener?.("keyboardDidHide",g)}catch{}}catch{}}const KX="fe:crashlog:sent_ts";function $XA(){try{return Li.getPlatform()}catch{return"web"}}function A6A(){try{return"ceelo"}catch{return"unknown"}}async function e6A(){try{const t=f2();if(!t.length)return;const A=Number(localStorage.getItem(KX)||"0"),e=Math.max(...t.map(I=>I.t));if(e<=A)return;const i=Ea(),g=await fetch(`${i}/api/telemetry/logs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({logs:t.slice(-80),platform:$XA(),userAgent:navigator.userAgent,appTarget:A6A(),sessionId:sessionStorage.getItem("sid")||void 0})});g.ok?(localStorage.setItem(KX,String(e)),KcA(),Tn.info("crash logs uploaded",{count:t.length})):Tn.warn("crash log upload failed",{status:g.status})}catch(t){try{Tn.warn("crash log upload error",{err:String(t)})}catch{}}}try{e6A()}catch{}try{window.addEventListener("error",t=>{}),window.addEventListener("unhandledrejection",t=>{})}catch{}document.addEventListener("click",t=>{const A=t.target;if(!A)return;const e=A.closest('button, a, [role="button"], .felt-btn, .gold-link');if(e&&!e.closest("[data-no-global-haptic]")&&!(e.tagName==="BUTTON"&&e.disabled)&&e.getAttribute("aria-disabled")!=="true")try{xt("Light")}catch{}},{passive:!0});try{l2()}catch{}try{const t=window,A=t.location.protocol==="capacitor:"||t.location.protocol==="ionic:",e=/^(localhost|127\.0\.0\.1)$/.test(t.location.hostname),i=document.querySelector("script[data-adsbygoogle]");if(!A&&!e&&!i){const g=document.createElement("script");g.async=!0,g.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4219446894372985",g.crossOrigin="anonymous",g.setAttribute("data-adsbygoogle","1"),g.onload=()=>{const I=window.adsbygoogle||[];try{I.push({})}catch{}},document.head.appendChild(g)}}catch{}try{const t="sess:initialized";EB.get(t).then(A=>{if(!A)return EB.clearSessionKeys().then(()=>EB.set(t,"1"))}).catch(()=>{})}catch{}function t6A(){window.__APP_MOUNTED__=!0,p.useEffect(()=>{try{const A=window.Capacitor?.getPlatform?.();(A==="ios"||A==="android")&&t6().catch(()=>{})}catch{}},[]);try{const A=window.Capacitor?.getPlatform?.();(A==="ios"||A==="android")&&Promise.resolve().then(()=>{try{Ll.notifyAppReady()}catch{}})}catch{}return Q.jsx(_XA,{})}function Qx(){try{const t=TXA(window.location.pathname,window.location.search);if(t){document.body.classList.add("ad-capture"),n_.createRoot(document.getElementById("root")).render(Q.jsx(p.StrictMode,{children:Q.jsx(xXA,{id:t.id,variant:t.variant})}));return}const A=HXA(window.location.pathname);if(A){document.body.classList.add("ad-capture"),n_.createRoot(document.getElementById("root")).render(Q.jsx(p.StrictMode,{children:Q.jsx(OXA,{scene:A.scene})}));return}}catch{}n_.createRoot(document.getElementById("root")).render(Q.jsx(p.StrictMode,{children:Q.jsx(jaA,{children:Q.jsx(LXA,{config:{debug:!1},children:Q.jsx(t6A,{})})})}))}function i6A(){try{(()=>{try{const e=window.Capacitor?.getPlatform?.();return e==="ios"||e==="android"?!0:/^(capacitor:|ionic:)/i.test(window.location?.protocol||"")}catch{return!1}})()?(async()=>{try{await eC.init()}catch{}Qx();try{await XXA()}catch{}try{eC.healthCheck().catch(()=>{})}catch{}})():Qx()}catch{Qx()}}window.APP_TARGET||i6A();export{KB as B,Li as C,Rm as I,wj as N,ik as T,Yn as U,zX as W,pi as _,I6A as a,t9A as b,g6A as c,Td as g,lX as h,iC as i,mB as r,u6A as t,WVA as w};
