const __vite__mapDeps=(i,m=__vite__mapDeps,d=(m.f||(m.f=["./web-BTFOTSSY.js","./index-Ec65i0Q1.js","./three-Cs75aIhT.js","./react-CYZQF_UV.js","./livekit-IBzVVcEu.js","./web-DaKYmqjJ.js","./web-SQ5KxhSQ.js","./web-B8_nOh3P.js","./index-aexKVPj4.js","./lottie-D9lozOg2.js","./InAppReviewService-C19lpMDu.js","./web-B39ynL7L.js","./web3-D0IbNXhH.js","./web-UU6e-RmY.js","./index-Dh9Wyl3x.js","./TurretPreview-DS4z-mdm.js","./ShipPackPreview-DzfsKUAI.js","./ShipPackPreview-BeBfSYkD.css","./BroadcasterLive-D6NMA-d_.js","./BroadcasterLive-DDgCvhq9.css","./web-Dt2-ChTe.js","./index-BFC0Lur1.js"])))=>i.map(i=>d[i]);
var u3=Object.defineProperty;var d3=(e,t,r)=>t in e?u3(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r;var Wr=(e,t,r)=>d3(e,typeof t!="symbol"?t+"":t,r);import{a as l,j as a,c as ws,R as ot,d as ml}from"./react-CYZQF_UV.js";import{_ as Cr,u as zl,C as Xn,E as ej,Q as Q_,a as zs,R as Mc,b as hm,M as Ua,S as p3,U as f3,V as An,c as Ea,A as Vy,d as gm,O as m3,P as h3,e as Hy,f as la,B as rx,g as Gd,h as g3,i as os,j as Qc,k as Al,l as y3,m as b3,n as v3,o as _3,D as Wb,H as w3,F as x3,W as A3,p as k3,q as Hi,r as dd,G as tf,s as G1,t as X1,v as S3,T as tj,w as E3,x as P3,L as C3,y as R3,z as Vg,I as Mo,J as T3,K as Y1,N as j3,X as Z1,Y as rj,Z as I3,$ as N3,a0 as Zm,a1 as K1,a2 as M3,a3 as Lp,a4 as L3}from"./three-Cs75aIhT.js";import{r as Kl,C as zr,S as Km}from"./index-Ec65i0Q1.js";import{g as nx,T as hl,R as D3,V as O3,b as Bi,C as Gb}from"./livekit-IBzVVcEu.js";import{W as z3,Q as B3,a as F3,i as U3,w as q3,c as V3,p as nj,h as Q1,m as aj,b as H3,d as W3}from"./web3-D0IbNXhH.js";/**
 * 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 J1="popstate";function G3(e={}){function t(n,s){let{pathname:o,search:i,hash:c}=n.location;return J_("",{pathname:o,search:i,hash:c},s.state&&s.state.usr||null,s.state&&s.state.key||"default")}function r(n,s){return typeof s=="string"?s:Vf(s)}return Y3(t,r,null,e)}function Qn(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function yo(e,t){if(!e){typeof console<"u"&&console.warn(t);try{throw new Error(t)}catch{}}}function X3(){return Math.random().toString(36).substring(2,10)}function $1(e,t){return{usr:e.state,key:e.key,idx:t}}function J_(e,t,r=null,n){return{pathname:typeof e=="string"?e:e.pathname,search:"",hash:"",...typeof t=="string"?pp(t):t,state:r,key:t&&t.key||n||X3()}}function Vf({pathname:e="/",search:t="",hash:r=""}){return t&&t!=="?"&&(e+=t.charAt(0)==="?"?t:"?"+t),r&&r!=="#"&&(e+=r.charAt(0)==="#"?r:"#"+r),e}function pp(e){let t={};if(e){let r=e.indexOf("#");r>=0&&(t.hash=e.substring(r),e=e.substring(0,r));let n=e.indexOf("?");n>=0&&(t.search=e.substring(n),e=e.substring(0,n)),e&&(t.pathname=e)}return t}function Y3(e,t,r,n={}){let{window:s=document.defaultView,v5Compat:o=!1}=n,i=s.history,c="POP",u=null,p=d();p==null&&(p=0,i.replaceState({...i.state,idx:p},""));function d(){return(i.state||{idx:null}).idx}function f(){c="POP";let y=d(),x=y==null?null:y-p;p=y,u&&u({action:c,location:g.location,delta:x})}function m(y,x){c="PUSH";let v=J_(g.location,y,x);p=d()+1;let A=$1(v,p),_=g.createHref(v);try{i.pushState(A,"",_)}catch(w){if(w instanceof DOMException&&w.name==="DataCloneError")throw w;s.location.assign(_)}o&&u&&u({action:c,location:g.location,delta:1})}function h(y,x){c="REPLACE";let v=J_(g.location,y,x);p=d();let A=$1(v,p),_=g.createHref(v);i.replaceState(A,"",_),o&&u&&u({action:c,location:g.location,delta:0})}function b(y){return Z3(y)}let g={get action(){return c},get location(){return e(s,i)},listen(y){if(u)throw new Error("A history only accepts one active listener");return s.addEventListener(J1,f),u=y,()=>{s.removeEventListener(J1,f),u=null}},createHref(y){return t(s,y)},createURL:b,encodeLocation(y){let x=b(y);return{pathname:x.pathname,search:x.search,hash:x.hash}},push:m,replace:h,go(y){return i.go(y)}};return g}function Z3(e,t=!1){let r="http://localhost";typeof window<"u"&&(r=window.location.origin!=="null"?window.location.origin:window.location.href),Qn(r,"No window.location.(origin|href) available to create URL");let n=typeof e=="string"?e:Vf(e);return n=n.replace(/ $/,"%20"),!t&&n.startsWith("//")&&(n=r+n),new URL(n,r)}function sj(e,t,r="/"){return K3(e,t,r,!1)}function K3(e,t,r,n){let s=typeof t=="string"?pp(t):t,o=rl(s.pathname||"/",r);if(o==null)return null;let i=oj(e);Q3(i);let c=null;for(let u=0;c==null&&u<i.length;++u){let p=l4(o);c=o4(i[u],p,n)}return c}function oj(e,t=[],r=[],n=""){let s=(o,i,c)=>{let u={relativePath:c===void 0?o.path||"":c,caseSensitive:o.caseSensitive===!0,childrenIndex:i,route:o};u.relativePath.startsWith("/")&&(Qn(u.relativePath.startsWith(n),`Absolute route path "${u.relativePath}" nested under path "${n}" is not valid. An absolute child route path must start with the combined path of all its parent routes.`),u.relativePath=u.relativePath.slice(n.length));let p=Zi([n,u.relativePath]),d=r.concat(u);o.children&&o.children.length>0&&(Qn(o.index!==!0,`Index routes must not have child routes. Please remove all child routes from route path "${p}".`),oj(o.children,t,d,p)),!(o.path==null&&!o.index)&&t.push({path:p,score:a4(p,o.index),routesMeta:d})};return e.forEach((o,i)=>{var c;if(o.path===""||!((c=o.path)!=null&&c.includes("?")))s(o,i);else for(let u of ij(o.path))s(o,i,u)}),t}function ij(e){let t=e.split("/");if(t.length===0)return[];let[r,...n]=t,s=r.endsWith("?"),o=r.replace(/\?$/,"");if(n.length===0)return s?[o,""]:[o];let i=ij(n.join("/")),c=[];return c.push(...i.map(u=>u===""?o:[o,u].join("/"))),s&&c.push(...i),c.map(u=>e.startsWith("/")&&u===""?"/":u)}function Q3(e){e.sort((t,r)=>t.score!==r.score?r.score-t.score:s4(t.routesMeta.map(n=>n.childrenIndex),r.routesMeta.map(n=>n.childrenIndex)))}var J3=/^:[\w-]+$/,$3=3,e4=2,t4=1,r4=10,n4=-2,eS=e=>e==="*";function a4(e,t){let r=e.split("/"),n=r.length;return r.some(eS)&&(n+=n4),t&&(n+=e4),r.filter(s=>!eS(s)).reduce((s,o)=>s+(J3.test(o)?$3:o===""?t4:r4),n)}function s4(e,t){return e.length===t.length&&e.slice(0,-1).every((n,s)=>n===t[s])?e[e.length-1]-t[t.length-1]:0}function o4(e,t,r=!1){let{routesMeta:n}=e,s={},o="/",i=[];for(let c=0;c<n.length;++c){let u=n[c],p=c===n.length-1,d=o==="/"?t:t.slice(o.length)||"/",f=Hg({path:u.relativePath,caseSensitive:u.caseSensitive,end:p},d),m=u.route;if(!f&&p&&r&&!n[n.length-1].route.index&&(f=Hg({path:u.relativePath,caseSensitive:u.caseSensitive,end:!1},d)),!f)return null;Object.assign(s,f.params),i.push({params:s,pathname:Zi([o,f.pathname]),pathnameBase:p4(Zi([o,f.pathnameBase])),route:m}),f.pathnameBase!=="/"&&(o=Zi([o,f.pathnameBase]))}return i}function Hg(e,t){typeof e=="string"&&(e={path:e,caseSensitive:!1,end:!0});let[r,n]=i4(e.path,e.caseSensitive,e.end),s=t.match(r);if(!s)return null;let o=s[0],i=o.replace(/(.)\/+$/,"$1"),c=s.slice(1);return{params:n.reduce((p,{paramName:d,isOptional:f},m)=>{if(d==="*"){let b=c[m]||"";i=o.slice(0,o.length-b.length).replace(/(.)\/+$/,"$1")}const h=c[m];return f&&!h?p[d]=void 0:p[d]=(h||"").replace(/%2F/g,"/"),p},{}),pathname:o,pathnameBase:i,pattern:e}}function i4(e,t=!1,r=!0){yo(e==="*"||!e.endsWith("*")||e.endsWith("/*"),`Route path "${e}" will be treated as if it were "${e.replace(/\*$/,"/*")}" because the \`*\` character must always follow a \`/\` in the pattern. To get rid of this warning, please change the route path to "${e.replace(/\*$/,"/*")}".`);let n=[],s="^"+e.replace(/\/*\*?$/,"").replace(/^\/*/,"/").replace(/[\\.*+^${}|()[\]]/g,"\\$&").replace(/\/:([\w-]+)(\?)?/g,(i,c,u)=>(n.push({paramName:c,isOptional:u!=null}),u?"/?([^\\/]+)?":"/([^\\/]+)"));return e.endsWith("*")?(n.push({paramName:"*"}),s+=e==="*"||e==="/*"?"(.*)$":"(?:\\/(.+)|\\/*)$"):r?s+="\\/*$":e!==""&&e!=="/"&&(s+="(?:(?=\\/|$))"),[new RegExp(s,t?void 0:"i"),n]}function l4(e){try{return e.split("/").map(t=>decodeURIComponent(t).replace(/\//g,"%2F")).join("/")}catch(t){return yo(!1,`The URL path "${e}" could not be decoded because it is a malformed URL segment. This is probably due to a bad percent encoding (${t}).`),e}}function rl(e,t){if(t==="/")return e;if(!e.toLowerCase().startsWith(t.toLowerCase()))return null;let r=t.endsWith("/")?t.length-1:t.length,n=e.charAt(r);return n&&n!=="/"?null:e.slice(r)||"/"}function c4(e,t="/"){let{pathname:r,search:n="",hash:s=""}=typeof e=="string"?pp(e):e;return{pathname:r?r.startsWith("/")?r:u4(r,t):t,search:f4(n),hash:m4(s)}}function u4(e,t){let r=t.replace(/\/+$/,"").split("/");return e.split("/").forEach(s=>{s===".."?r.length>1&&r.pop():s!=="."&&r.push(s)}),r.length>1?r.join("/"):"/"}function Xb(e,t,r,n){return`Cannot include a '${e}' character in a manually specified \`to.${t}\` field [${JSON.stringify(n)}].  Please separate it out to the \`to.${r}\` field. Alternatively you may provide the full path as a string in <Link to="..."> and the router will parse it for you.`}function d4(e){return e.filter((t,r)=>r===0||t.route.path&&t.route.path.length>0)}function ax(e){let t=d4(e);return t.map((r,n)=>n===t.length-1?r.pathname:r.pathnameBase)}function sx(e,t,r,n=!1){let s;typeof e=="string"?s=pp(e):(s={...e},Qn(!s.pathname||!s.pathname.includes("?"),Xb("?","pathname","search",s)),Qn(!s.pathname||!s.pathname.includes("#"),Xb("#","pathname","hash",s)),Qn(!s.search||!s.search.includes("#"),Xb("#","search","hash",s)));let o=e===""||s.pathname==="",i=o?"/":s.pathname,c;if(i==null)c=r;else{let f=t.length-1;if(!n&&i.startsWith("..")){let m=i.split("/");for(;m[0]==="..";)m.shift(),f-=1;s.pathname=m.join("/")}c=f>=0?t[f]:"/"}let u=c4(s,c),p=i&&i!=="/"&&i.endsWith("/"),d=(o||i===".")&&r.endsWith("/");return!u.pathname.endsWith("/")&&(p||d)&&(u.pathname+="/"),u}var Zi=e=>e.join("/").replace(/\/\/+/g,"/"),p4=e=>e.replace(/\/+$/,"").replace(/^\/*/,"/"),f4=e=>!e||e==="?"?"":e.startsWith("?")?e:"?"+e,m4=e=>!e||e==="#"?"":e.startsWith("#")?e:"#"+e;function h4(e){return e!=null&&typeof e.status=="number"&&typeof e.statusText=="string"&&typeof e.internal=="boolean"&&"data"in e}var lj=["POST","PUT","PATCH","DELETE"];new Set(lj);var g4=["GET",...lj];new Set(g4);var fp=l.createContext(null);fp.displayName="DataRouter";var Wy=l.createContext(null);Wy.displayName="DataRouterState";l.createContext(!1);var cj=l.createContext({isTransitioning:!1});cj.displayName="ViewTransition";var y4=l.createContext(new Map);y4.displayName="Fetchers";var b4=l.createContext(null);b4.displayName="Await";var Vo=l.createContext(null);Vo.displayName="Navigation";var ym=l.createContext(null);ym.displayName="Location";var wo=l.createContext({outlet:null,matches:[],isDataRoute:!1});wo.displayName="Route";var ox=l.createContext(null);ox.displayName="RouteError";function v4(e,{relative:t}={}){Qn(mp(),"useHref() may be used only in the context of a <Router> component.");let{basename:r,navigator:n}=l.useContext(Vo),{hash:s,pathname:o,search:i}=bm(e,{relative:t}),c=o;return r!=="/"&&(c=o==="/"?r:Zi([r,o])),n.createHref({pathname:c,search:i,hash:s})}function mp(){return l.useContext(ym)!=null}function Ia(){return Qn(mp(),"useLocation() may be used only in the context of a <Router> component."),l.useContext(ym).location}var uj="You should call navigate() in a React.useEffect(), not when your component is first rendered.";function dj(e){l.useContext(Vo).static||l.useLayoutEffect(e)}function Hr(){let{isDataRoute:e}=l.useContext(wo);return e?M4():_4()}function _4(){Qn(mp(),"useNavigate() may be used only in the context of a <Router> component.");let e=l.useContext(fp),{basename:t,navigator:r}=l.useContext(Vo),{matches:n}=l.useContext(wo),{pathname:s}=Ia(),o=JSON.stringify(ax(n)),i=l.useRef(!1);return dj(()=>{i.current=!0}),l.useCallback((u,p={})=>{if(yo(i.current,uj),!i.current)return;if(typeof u=="number"){r.go(u);return}let d=sx(u,JSON.parse(o),s,p.relative==="path");e==null&&t!=="/"&&(d.pathname=d.pathname==="/"?t:Zi([t,d.pathname])),(p.replace?r.replace:r.push)(d,p.state,p)},[t,r,o,s,e])}var w4=l.createContext(null);function x4(e){let t=l.useContext(wo).outlet;return t&&l.createElement(w4.Provider,{value:e},t)}function hp(){let{matches:e}=l.useContext(wo),t=e[e.length-1];return t?t.params:{}}function bm(e,{relative:t}={}){let{matches:r}=l.useContext(wo),{pathname:n}=Ia(),s=JSON.stringify(ax(r));return l.useMemo(()=>sx(e,JSON.parse(s),n,t==="path"),[e,s,n,t])}function A4(e,t){return pj(e,t)}function pj(e,t,r,n){var x;Qn(mp(),"useRoutes() may be used only in the context of a <Router> component.");let{navigator:s}=l.useContext(Vo),{matches:o}=l.useContext(wo),i=o[o.length-1],c=i?i.params:{},u=i?i.pathname:"/",p=i?i.pathnameBase:"/",d=i&&i.route;{let v=d&&d.path||"";fj(u,!d||v.endsWith("*")||v.endsWith("*?"),`You rendered descendant <Routes> (or called \`useRoutes()\`) at "${u}" (under <Route path="${v}">) 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="${v}"> to <Route path="${v==="/"?"*":`${v}/*`}">.`)}let f=Ia(),m;if(t){let v=typeof t=="string"?pp(t):t;Qn(p==="/"||((x=v.pathname)==null?void 0:x.startsWith(p)),`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 "${p}" but pathname "${v.pathname}" was given in the \`location\` prop.`),m=v}else m=f;let h=m.pathname||"/",b=h;if(p!=="/"){let v=p.replace(/^\//,"").split("/");b="/"+h.replace(/^\//,"").split("/").slice(v.length).join("/")}let g=sj(e,{pathname:b});yo(d||g!=null,`No routes matched location "${m.pathname}${m.search}${m.hash}" `),yo(g==null||g[g.length-1].route.element!==void 0||g[g.length-1].route.Component!==void 0||g[g.length-1].route.lazy!==void 0,`Matched leaf route at location "${m.pathname}${m.search}${m.hash}" does not have an element or Component. This means it will render an <Outlet /> with a null value by default resulting in an "empty" page.`);let y=C4(g&&g.map(v=>Object.assign({},v,{params:Object.assign({},c,v.params),pathname:Zi([p,s.encodeLocation?s.encodeLocation(v.pathname).pathname:v.pathname]),pathnameBase:v.pathnameBase==="/"?p:Zi([p,s.encodeLocation?s.encodeLocation(v.pathnameBase).pathname:v.pathnameBase])})),o,r,n);return t&&y?l.createElement(ym.Provider,{value:{location:{pathname:"/",search:"",hash:"",state:null,key:"default",...m},navigationType:"POP"}},y):y}function k4(){let e=N4(),t=h4(e)?`${e.status} ${e.statusText}`:e instanceof Error?e.message:JSON.stringify(e),r=e instanceof Error?e.stack:null,n="rgba(200,200,200, 0.5)",s={padding:"0.5rem",backgroundColor:n},o={padding:"2px 4px",backgroundColor:n},i=null;return console.error("Error handled by React Router default ErrorBoundary:",e),i=l.createElement(l.Fragment,null,l.createElement("p",null,"💿 Hey developer 👋"),l.createElement("p",null,"You can provide a way better UX than this when your app throws errors by providing your own ",l.createElement("code",{style:o},"ErrorBoundary")," or"," ",l.createElement("code",{style:o},"errorElement")," prop on your route.")),l.createElement(l.Fragment,null,l.createElement("h2",null,"Unexpected Application Error!"),l.createElement("h3",{style:{fontStyle:"italic"}},t),r?l.createElement("pre",{style:s},r):null,i)}var S4=l.createElement(k4,null),E4=class extends l.Component{constructor(e){super(e),this.state={location:e.location,revalidation:e.revalidation,error:e.error}}static getDerivedStateFromError(e){return{error:e}}static getDerivedStateFromProps(e,t){return t.location!==e.location||t.revalidation!=="idle"&&e.revalidation==="idle"?{error:e.error,location:e.location,revalidation:e.revalidation}:{error:e.error!==void 0?e.error:t.error,location:t.location,revalidation:e.revalidation||t.revalidation}}componentDidCatch(e,t){console.error("React Router caught the following error during render",e,t)}render(){return this.state.error!==void 0?l.createElement(wo.Provider,{value:this.props.routeContext},l.createElement(ox.Provider,{value:this.state.error,children:this.props.component})):this.props.children}};function P4({routeContext:e,match:t,children:r}){let n=l.useContext(fp);return n&&n.static&&n.staticContext&&(t.route.errorElement||t.route.ErrorBoundary)&&(n.staticContext._deepestRenderedBoundaryId=t.route.id),l.createElement(wo.Provider,{value:e},r)}function C4(e,t=[],r=null,n=null){if(e==null){if(!r)return null;if(r.errors)e=r.matches;else if(t.length===0&&!r.initialized&&r.matches.length>0)e=r.matches;else return null}let s=e,o=r==null?void 0:r.errors;if(o!=null){let u=s.findIndex(p=>p.route.id&&(o==null?void 0:o[p.route.id])!==void 0);Qn(u>=0,`Could not find a matching route for errors on route IDs: ${Object.keys(o).join(",")}`),s=s.slice(0,Math.min(s.length,u+1))}let i=!1,c=-1;if(r)for(let u=0;u<s.length;u++){let p=s[u];if((p.route.HydrateFallback||p.route.hydrateFallbackElement)&&(c=u),p.route.id){let{loaderData:d,errors:f}=r,m=p.route.loader&&!d.hasOwnProperty(p.route.id)&&(!f||f[p.route.id]===void 0);if(p.route.lazy||m){i=!0,c>=0?s=s.slice(0,c+1):s=[s[0]];break}}}return s.reduceRight((u,p,d)=>{let f,m=!1,h=null,b=null;r&&(f=o&&p.route.id?o[p.route.id]:void 0,h=p.route.errorElement||S4,i&&(c<0&&d===0?(fj("route-fallback",!1,"No `HydrateFallback` element provided to render during initial hydration"),m=!0,b=null):c===d&&(m=!0,b=p.route.hydrateFallbackElement||null)));let g=t.concat(s.slice(0,d+1)),y=()=>{let x;return f?x=h:m?x=b:p.route.Component?x=l.createElement(p.route.Component,null):p.route.element?x=p.route.element:x=u,l.createElement(P4,{match:p,routeContext:{outlet:u,matches:g,isDataRoute:r!=null},children:x})};return r&&(p.route.ErrorBoundary||p.route.errorElement||d===0)?l.createElement(E4,{location:r.location,revalidation:r.revalidation,component:h,error:f,children:y(),routeContext:{outlet:null,matches:g,isDataRoute:!0}}):y()},null)}function ix(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function R4(e){let t=l.useContext(fp);return Qn(t,ix(e)),t}function T4(e){let t=l.useContext(Wy);return Qn(t,ix(e)),t}function j4(e){let t=l.useContext(wo);return Qn(t,ix(e)),t}function lx(e){let t=j4(e),r=t.matches[t.matches.length-1];return Qn(r.route.id,`${e} can only be used on routes that contain a unique "id"`),r.route.id}function I4(){return lx("useRouteId")}function N4(){var n;let e=l.useContext(ox),t=T4("useRouteError"),r=lx("useRouteError");return e!==void 0?e:(n=t.errors)==null?void 0:n[r]}function M4(){let{router:e}=R4("useNavigate"),t=lx("useNavigate"),r=l.useRef(!1);return dj(()=>{r.current=!0}),l.useCallback(async(s,o={})=>{yo(r.current,uj),r.current&&(typeof s=="number"?e.navigate(s):await e.navigate(s,{fromRouteId:t,...o}))},[e,t])}var tS={};function fj(e,t,r){!t&&!tS[e]&&(tS[e]=!0,yo(!1,r))}l.memo(L4);function L4({routes:e,future:t,state:r}){return pj(e,void 0,r,t)}function qn({to:e,replace:t,state:r,relative:n}){Qn(mp(),"<Navigate> may be used only in the context of a <Router> component.");let{static:s}=l.useContext(Vo);yo(!s,"<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:o}=l.useContext(wo),{pathname:i}=Ia(),c=Hr(),u=sx(e,ax(o),i,n==="path"),p=JSON.stringify(u);return l.useEffect(()=>{c(JSON.parse(p),{replace:t,state:r,relative:n})},[c,p,n,t,r]),null}function mj(e){return x4(e.context)}function qe(e){Qn(!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 D4({basename:e="/",children:t=null,location:r,navigationType:n="POP",navigator:s,static:o=!1}){Qn(!mp(),"You cannot render a <Router> inside another <Router>. You should never have more than one in your app.");let i=e.replace(/^\/*/,"/"),c=l.useMemo(()=>({basename:i,navigator:s,static:o,future:{}}),[i,s,o]);typeof r=="string"&&(r=pp(r));let{pathname:u="/",search:p="",hash:d="",state:f=null,key:m="default"}=r,h=l.useMemo(()=>{let b=rl(u,i);return b==null?null:{location:{pathname:b,search:p,hash:d,state:f,key:m},navigationType:n}},[i,u,p,d,f,m,n]);return yo(h!=null,`<Router basename="${i}"> is not able to match the URL "${u}${p}${d}" because it does not start with the basename, so the <Router> won't render anything.`),h==null?null:l.createElement(Vo.Provider,{value:c},l.createElement(ym.Provider,{children:t,value:h}))}function cu({children:e,location:t}){return A4($_(e),t)}function $_(e,t=[]){let r=[];return l.Children.forEach(e,(n,s)=>{if(!l.isValidElement(n))return;let o=[...t,s];if(n.type===l.Fragment){r.push.apply(r,$_(n.props.children,o));return}Qn(n.type===qe,`[${typeof n.type=="string"?n.type:n.type.name}] is not a <Route> component. All component children of <Routes> must be a <Route> or <React.Fragment>`),Qn(!n.props.index||!n.props.children,"An index route cannot have child routes.");let i={id:n.props.id||o.join("-"),caseSensitive:n.props.caseSensitive,element:n.props.element,Component:n.props.Component,index:n.props.index,path:n.props.path,loader:n.props.loader,action:n.props.action,hydrateFallbackElement:n.props.hydrateFallbackElement,HydrateFallback:n.props.HydrateFallback,errorElement:n.props.errorElement,ErrorBoundary:n.props.ErrorBoundary,hasErrorBoundary:n.props.hasErrorBoundary===!0||n.props.ErrorBoundary!=null||n.props.errorElement!=null,shouldRevalidate:n.props.shouldRevalidate,handle:n.props.handle,lazy:n.props.lazy};n.props.children&&(i.children=$_(n.props.children,o)),r.push(i)}),r}var gg="get",yg="application/x-www-form-urlencoded";function Gy(e){return e!=null&&typeof e.tagName=="string"}function O4(e){return Gy(e)&&e.tagName.toLowerCase()==="button"}function z4(e){return Gy(e)&&e.tagName.toLowerCase()==="form"}function B4(e){return Gy(e)&&e.tagName.toLowerCase()==="input"}function F4(e){return!!(e.metaKey||e.altKey||e.ctrlKey||e.shiftKey)}function U4(e,t){return e.button===0&&(!t||t==="_self")&&!F4(e)}function e0(e=""){return new URLSearchParams(typeof e=="string"||Array.isArray(e)||e instanceof URLSearchParams?e:Object.keys(e).reduce((t,r)=>{let n=e[r];return t.concat(Array.isArray(n)?n.map(s=>[r,s]):[[r,n]])},[]))}function q4(e,t){let r=e0(e);return t&&t.forEach((n,s)=>{r.has(s)||t.getAll(s).forEach(o=>{r.append(s,o)})}),r}var Qm=null;function V4(){if(Qm===null)try{new FormData(document.createElement("form"),0),Qm=!1}catch{Qm=!0}return Qm}var H4=new Set(["application/x-www-form-urlencoded","multipart/form-data","text/plain"]);function Yb(e){return e!=null&&!H4.has(e)?(yo(!1,`"${e}" is not a valid \`encType\` for \`<Form>\`/\`<fetcher.Form>\` and will default to "${yg}"`),null):e}function W4(e,t){let r,n,s,o,i;if(z4(e)){let c=e.getAttribute("action");n=c?rl(c,t):null,r=e.getAttribute("method")||gg,s=Yb(e.getAttribute("enctype"))||yg,o=new FormData(e)}else if(O4(e)||B4(e)&&(e.type==="submit"||e.type==="image")){let c=e.form;if(c==null)throw new Error('Cannot submit a <button> or <input type="submit"> without a <form>');let u=e.getAttribute("formaction")||c.getAttribute("action");if(n=u?rl(u,t):null,r=e.getAttribute("formmethod")||c.getAttribute("method")||gg,s=Yb(e.getAttribute("formenctype"))||Yb(c.getAttribute("enctype"))||yg,o=new FormData(c,e),!V4()){let{name:p,type:d,value:f}=e;if(d==="image"){let m=p?`${p}.`:"";o.append(`${m}x`,"0"),o.append(`${m}y`,"0")}else p&&o.append(p,f)}}else{if(Gy(e))throw new Error('Cannot submit element that is not <form>, <button>, or <input type="submit|image">');r=gg,n=null,s=yg,i=e}return o&&s==="text/plain"&&(i=o,o=void 0),{action:n,method:r.toLowerCase(),encType:s,formData:o,body:i}}Object.getOwnPropertyNames(Object.prototype).sort().join("\0");function cx(e,t){if(e===!1||e===null||typeof e>"u")throw new Error(t)}function G4(e,t,r){let n=typeof e=="string"?new URL(e,typeof window>"u"?"server://singlefetch/":window.location.origin):e;return n.pathname==="/"?n.pathname=`_root.${r}`:t&&rl(n.pathname,t)==="/"?n.pathname=`${t.replace(/\/$/,"")}/_root.${r}`:n.pathname=`${n.pathname.replace(/\/$/,"")}.${r}`,n}async function X4(e,t){if(e.id in t)return t[e.id];try{let r=await import(e.module);return t[e.id]=r,r}catch(r){return console.error(`Error loading route module \`${e.module}\`, reloading page...`),console.error(r),window.__reactRouterContext&&window.__reactRouterContext.isSpaMode,window.location.reload(),new Promise(()=>{})}}function Y4(e){return e==null?!1:e.href==null?e.rel==="preload"&&typeof e.imageSrcSet=="string"&&typeof e.imageSizes=="string":typeof e.rel=="string"&&typeof e.href=="string"}async function Z4(e,t,r){let n=await Promise.all(e.map(async s=>{let o=t.routes[s.route.id];if(o){let i=await X4(o,r);return i.links?i.links():[]}return[]}));return $4(n.flat(1).filter(Y4).filter(s=>s.rel==="stylesheet"||s.rel==="preload").map(s=>s.rel==="stylesheet"?{...s,rel:"prefetch",as:"style"}:{...s,rel:"prefetch"}))}function rS(e,t,r,n,s,o){let i=(u,p)=>r[p]?u.route.id!==r[p].route.id:!0,c=(u,p)=>{var d;return r[p].pathname!==u.pathname||((d=r[p].route.path)==null?void 0:d.endsWith("*"))&&r[p].params["*"]!==u.params["*"]};return o==="assets"?t.filter((u,p)=>i(u,p)||c(u,p)):o==="data"?t.filter((u,p)=>{var f;let d=n.routes[u.route.id];if(!d||!d.hasLoader)return!1;if(i(u,p)||c(u,p))return!0;if(u.route.shouldRevalidate){let m=u.route.shouldRevalidate({currentUrl:new URL(s.pathname+s.search+s.hash,window.origin),currentParams:((f=r[0])==null?void 0:f.params)||{},nextUrl:new URL(e,window.origin),nextParams:u.params,defaultShouldRevalidate:!0});if(typeof m=="boolean")return m}return!0}):[]}function K4(e,t,{includeHydrateFallback:r}={}){return Q4(e.map(n=>{let s=t.routes[n.route.id];if(!s)return[];let o=[s.module];return s.clientActionModule&&(o=o.concat(s.clientActionModule)),s.clientLoaderModule&&(o=o.concat(s.clientLoaderModule)),r&&s.hydrateFallbackModule&&(o=o.concat(s.hydrateFallbackModule)),s.imports&&(o=o.concat(s.imports)),o}).flat(1))}function Q4(e){return[...new Set(e)]}function J4(e){let t={},r=Object.keys(e).sort();for(let n of r)t[n]=e[n];return t}function $4(e,t){let r=new Set;return new Set(t),e.reduce((n,s)=>{let o=JSON.stringify(J4(s));return r.has(o)||(r.add(o),n.push({key:o,link:s})),n},[])}function hj(){let e=l.useContext(fp);return cx(e,"You must render this element inside a <DataRouterContext.Provider> element"),e}function eB(){let e=l.useContext(Wy);return cx(e,"You must render this element inside a <DataRouterStateContext.Provider> element"),e}var ux=l.createContext(void 0);ux.displayName="FrameworkContext";function gj(){let e=l.useContext(ux);return cx(e,"You must render this element inside a <HydratedRouter> element"),e}function tB(e,t){let r=l.useContext(ux),[n,s]=l.useState(!1),[o,i]=l.useState(!1),{onFocus:c,onBlur:u,onMouseEnter:p,onMouseLeave:d,onTouchStart:f}=t,m=l.useRef(null);l.useEffect(()=>{if(e==="render"&&i(!0),e==="viewport"){let g=x=>{x.forEach(v=>{i(v.isIntersecting)})},y=new IntersectionObserver(g,{threshold:.5});return m.current&&y.observe(m.current),()=>{y.disconnect()}}},[e]),l.useEffect(()=>{if(n){let g=setTimeout(()=>{i(!0)},100);return()=>{clearTimeout(g)}}},[n]);let h=()=>{s(!0)},b=()=>{s(!1),i(!1)};return r?e!=="intent"?[o,m,{}]:[o,m,{onFocus:Dp(c,h),onBlur:Dp(u,b),onMouseEnter:Dp(p,h),onMouseLeave:Dp(d,b),onTouchStart:Dp(f,h)}]:[!1,m,{}]}function Dp(e,t){return r=>{e&&e(r),r.defaultPrevented||t(r)}}function rB({page:e,...t}){let{router:r}=hj(),n=l.useMemo(()=>sj(r.routes,e,r.basename),[r.routes,e,r.basename]);return n?l.createElement(aB,{page:e,matches:n,...t}):null}function nB(e){let{manifest:t,routeModules:r}=gj(),[n,s]=l.useState([]);return l.useEffect(()=>{let o=!1;return Z4(e,t,r).then(i=>{o||s(i)}),()=>{o=!0}},[e,t,r]),n}function aB({page:e,matches:t,...r}){let n=Ia(),{manifest:s,routeModules:o}=gj(),{basename:i}=hj(),{loaderData:c,matches:u}=eB(),p=l.useMemo(()=>rS(e,t,u,s,n,"data"),[e,t,u,s,n]),d=l.useMemo(()=>rS(e,t,u,s,n,"assets"),[e,t,u,s,n]),f=l.useMemo(()=>{if(e===n.pathname+n.search+n.hash)return[];let b=new Set,g=!1;if(t.forEach(x=>{var A;let v=s.routes[x.route.id];!v||!v.hasLoader||(!p.some(_=>_.route.id===x.route.id)&&x.route.id in c&&((A=o[x.route.id])!=null&&A.shouldRevalidate)||v.hasClientLoader?g=!0:b.add(x.route.id))}),b.size===0)return[];let y=G4(e,i,"data");return g&&b.size>0&&y.searchParams.set("_routes",t.filter(x=>b.has(x.route.id)).map(x=>x.route.id).join(",")),[y.pathname+y.search]},[i,c,n,s,p,t,e,o]),m=l.useMemo(()=>K4(d,s),[d,s]),h=nB(d);return l.createElement(l.Fragment,null,f.map(b=>l.createElement("link",{key:b,rel:"prefetch",as:"fetch",href:b,...r})),m.map(b=>l.createElement("link",{key:b,rel:"modulepreload",href:b,...r})),h.map(({key:b,link:g})=>l.createElement("link",{key:b,nonce:r.nonce,...g})))}function sB(...e){return t=>{e.forEach(r=>{typeof r=="function"?r(t):r!=null&&(r.current=t)})}}var yj=typeof window<"u"&&typeof window.document<"u"&&typeof window.document.createElement<"u";try{yj&&(window.__reactRouterVersion="7.8.0")}catch{}function oB({basename:e,children:t,window:r}){let n=l.useRef();n.current==null&&(n.current=G3({window:r,v5Compat:!0}));let s=n.current,[o,i]=l.useState({action:s.action,location:s.location}),c=l.useCallback(u=>{l.startTransition(()=>i(u))},[i]);return l.useLayoutEffect(()=>s.listen(c),[s,c]),l.createElement(D4,{basename:e,children:t,location:o.location,navigationType:o.action,navigator:s})}var bj=/^(?:[a-z][a-z0-9+.-]*:|\/\/)/i,Xs=l.forwardRef(function({onClick:t,discover:r="render",prefetch:n="none",relative:s,reloadDocument:o,replace:i,state:c,target:u,to:p,preventScrollReset:d,viewTransition:f,...m},h){let{basename:b}=l.useContext(Vo),g=typeof p=="string"&&bj.test(p),y,x=!1;if(typeof p=="string"&&g&&(y=p,yj))try{let P=new URL(window.location.href),k=p.startsWith("//")?new URL(P.protocol+p):new URL(p),E=rl(k.pathname,b);k.origin===P.origin&&E!=null?p=E+k.search+k.hash:x=!0}catch{yo(!1,`<Link to="${p}"> contains an invalid URL which will probably break when clicked - please update to a valid URL path.`)}let v=v4(p,{relative:s}),[A,_,w]=tB(n,m),j=uB(p,{replace:i,state:c,target:u,preventScrollReset:d,relative:s,viewTransition:f});function T(P){t&&t(P),P.defaultPrevented||j(P)}let R=l.createElement("a",{...m,...w,href:y||v,onClick:x||o?t:T,ref:sB(h,_),target:u,"data-discover":!g&&r==="render"?"true":void 0});return A&&!g?l.createElement(l.Fragment,null,R,l.createElement(rB,{page:v})):R});Xs.displayName="Link";var iB=l.forwardRef(function({"aria-current":t="page",caseSensitive:r=!1,className:n="",end:s=!1,style:o,to:i,viewTransition:c,children:u,...p},d){let f=bm(i,{relative:p.relative}),m=Ia(),h=l.useContext(Wy),{navigator:b,basename:g}=l.useContext(Vo),y=h!=null&&hB(f)&&c===!0,x=b.encodeLocation?b.encodeLocation(f).pathname:f.pathname,v=m.pathname,A=h&&h.navigation&&h.navigation.location?h.navigation.location.pathname:null;r||(v=v.toLowerCase(),A=A?A.toLowerCase():null,x=x.toLowerCase()),A&&g&&(A=rl(A,g)||A);const _=x!=="/"&&x.endsWith("/")?x.length-1:x.length;let w=v===x||!s&&v.startsWith(x)&&v.charAt(_)==="/",j=A!=null&&(A===x||!s&&A.startsWith(x)&&A.charAt(x.length)==="/"),T={isActive:w,isPending:j,isTransitioning:y},R=w?t:void 0,P;typeof n=="function"?P=n(T):P=[n,w?"active":null,j?"pending":null,y?"transitioning":null].filter(Boolean).join(" ");let k=typeof o=="function"?o(T):o;return l.createElement(Xs,{...p,"aria-current":R,className:P,ref:d,style:k,to:i,viewTransition:c},typeof u=="function"?u(T):u)});iB.displayName="NavLink";var lB=l.forwardRef(({discover:e="render",fetcherKey:t,navigate:r,reloadDocument:n,replace:s,state:o,method:i=gg,action:c,onSubmit:u,relative:p,preventScrollReset:d,viewTransition:f,...m},h)=>{let b=fB(),g=mB(c,{relative:p}),y=i.toLowerCase()==="get"?"get":"post",x=typeof c=="string"&&bj.test(c),v=A=>{if(u&&u(A),A.defaultPrevented)return;A.preventDefault();let _=A.nativeEvent.submitter,w=(_==null?void 0:_.getAttribute("formmethod"))||i;b(_||A.currentTarget,{fetcherKey:t,method:w,navigate:r,replace:s,state:o,relative:p,preventScrollReset:d,viewTransition:f})};return l.createElement("form",{ref:h,method:y,action:g,onSubmit:n?u:v,...m,"data-discover":!x&&e==="render"?"true":void 0})});lB.displayName="Form";function cB(e){return`${e} must be used within a data router.  See https://reactrouter.com/en/main/routers/picking-a-router.`}function vj(e){let t=l.useContext(fp);return Qn(t,cB(e)),t}function uB(e,{target:t,replace:r,state:n,preventScrollReset:s,relative:o,viewTransition:i}={}){let c=Hr(),u=Ia(),p=bm(e,{relative:o});return l.useCallback(d=>{if(U4(d,t)){d.preventDefault();let f=r!==void 0?r:Vf(u)===Vf(p);c(e,{replace:f,state:n,preventScrollReset:s,relative:o,viewTransition:i})}},[u,c,p,r,n,t,e,s,o,i])}function gp(e){yo(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 t=l.useRef(e0(e)),r=l.useRef(!1),n=Ia(),s=l.useMemo(()=>q4(n.search,r.current?null:t.current),[n.search]),o=Hr(),i=l.useCallback((c,u)=>{const p=e0(typeof c=="function"?c(new URLSearchParams(s)):c);r.current=!0,o("?"+p,u)},[o,s]);return[s,i]}var dB=0,pB=()=>`__${String(++dB)}__`;function fB(){let{router:e}=vj("useSubmit"),{basename:t}=l.useContext(Vo),r=I4();return l.useCallback(async(n,s={})=>{let{action:o,method:i,encType:c,formData:u,body:p}=W4(n,t);if(s.navigate===!1){let d=s.fetcherKey||pB();await e.fetch(d,r,s.action||o,{preventScrollReset:s.preventScrollReset,formData:u,body:p,formMethod:s.method||i,formEncType:s.encType||c,flushSync:s.flushSync})}else await e.navigate(s.action||o,{preventScrollReset:s.preventScrollReset,formData:u,body:p,formMethod:s.method||i,formEncType:s.encType||c,replace:s.replace,state:s.state,fromRouteId:r,flushSync:s.flushSync,viewTransition:s.viewTransition})},[e,t,r])}function mB(e,{relative:t}={}){let{basename:r}=l.useContext(Vo),n=l.useContext(wo);Qn(n,"useFormAction must be used inside a RouteContext");let[s]=n.matches.slice(-1),o={...bm(e||".",{relative:t})},i=Ia();if(e==null){o.search=i.search;let c=new URLSearchParams(o.search),u=c.getAll("index");if(u.some(d=>d==="")){c.delete("index"),u.filter(f=>f).forEach(f=>c.append("index",f));let d=c.toString();o.search=d?`?${d}`:""}}return(!e||e===".")&&s.route.index&&(o.search=o.search?o.search.replace(/^\?/,"?index&"):"?index"),r!=="/"&&(o.pathname=o.pathname==="/"?r:Zi([r,o.pathname])),Vf(o)}function hB(e,{relative:t}={}){let r=l.useContext(cj);Qn(r!=null,"`useViewTransitionState` must be used within `react-router-dom`'s `RouterProvider`.  Did you accidentally import `RouterProvider` from `react-router`?");let{basename:n}=vj("useViewTransitionState"),s=bm(e,{relative:t});if(!r.isTransitioning)return!1;let o=rl(r.currentLocation.pathname,n)||r.currentLocation.pathname,i=rl(r.nextLocation.pathname,n)||r.nextLocation.pathname;return Hg(s.pathname,i)!=null||Hg(s.pathname,o)!=null}const Hf=Kl("SocialLogin",{web:()=>Cr(()=>import("./web-BTFOTSSY.js"),__vite__mapDeps([0,1,2,3,4]),import.meta.url).then(e=>new e.SocialLoginWeb)}),gB={SOCKET:{NEEDS_PREMIUM:"premium_membership_required"}},yB=(()=>{var e;try{if(typeof window>"u")return!1;const t=(((e=window.location)==null?void 0:e.protocol)||"").toLowerCase();return t==="capacitor:"||t==="ionic:"}catch{return!1}})(),bB=(()=>{var e;try{if(typeof window>"u")return!1;const t=((e=window.location)==null?void 0:e.hostname)||"";return t==="localhost"||t==="127.0.0.1"}catch{return!1}})();function vB(){var e,t;try{const r=((e=window.localStorage)==null?void 0:e.getItem("api:url"))||((t=window.sessionStorage)==null?void 0:t.getItem("api:url"));if(r&&/^https?:\/\//i.test(r))return r.replace(/\/$/,"")}catch{}return null}const Wf=(()=>{const e=vB();return e||(yB?"https://dicelounge.app":bB?"http://localhost:4000":"https://dicelounge.app")})(),_B=globalThis==null?void 0:globalThis.APP_TARGET;var FT,UT;const wB=(UT=(FT=globalThis==null?void 0:globalThis.process)==null?void 0:FT.env)==null?void 0:UT.APP_TARGET;let t0;var qT,VT;try{t0=(VT=(qT=import.meta)==null?void 0:qT.env)==null?void 0:VT.VITE_APP_TARGET}catch{t0=void 0}const xB=_B??wB??t0,Oa=xB??"unified",Zb=Oa==="ceelo",qc=Oa==="craps",Vc=Oa==="poker",vm=Oa==="skills",No=Oa==="zentara",vc=Oa==="unified",AB="rcb_eaWheJLZtWHJDCzyjruqCITeZlrK",nS={ceelo:"goog_TshzudibKBufFkwSWOodGwQAzMI",craps:"goog_FJlwnXjmdmVYKAbOkaiNyICWjkd",poker:"goog_AwODgwTGrKmYPFStHgslgZENzyG",unified:"goog_TshzudibKBufFkwSWOodGwQAzMI",skills:"goog_iGrdhumdjhzgNbIWxdHFjChutDX",zentara:"goog_BNlqWfFLFTMPnLmGhHhcfdOsACj"},kB=nS[Oa]??nS.ceelo,aS={ceelo:"appl_YhZbXhNlphlrxochELLsdNJajdp",craps:"appl_uCBrYNXSOUzHdUNnkbfMaNxBxXI",poker:"appl_SKqhTdSJqfYQQGUjeFYzVZoSBqA",skills:"appl_OSFruGMgnsBocgEzWxpUyLYtskV",zentara:"appl_mpxyEsCoRtxMImTCLdZVnAUhtpJ",unified:"appl_YhZbXhNlphlrxochELLsdNJajdp"},SB=aS[Oa]??aS.ceelo,EB="false",Xy="default",PB="com.zentaraone.ceeloLounge.chips",Yy=PB,CB="com.zentaraone.ceeloLounge.chips1000",RB="com.zentaraone.crapsLounge.chips_1000",TB="com.zentaraone.pokerLounge.chips_1000",Zy=qc?RB:Vc?TB:CB,jB="",dx="Premium",IB="AIzaSyCmll0lLOqadkCyjlrM-bb5H4n1L8eMxkE",NB="dice-lounge.firebaseapp.com",MB="dice-lounge",LB="1:423374558927:web:283377221554368e57c9ba",DB="G-MYPNJQR9RN",OB="dicelounge.app",zB="PEcc15f3HTqKKafnvHp1yRrbxrS8ji1kzZ4dyS4R+fI=",BB="193765381581-rucls0d90bmpkqaj0ginhp87chgjq70j.apps.googleusercontent.com",_m="193765381581-s0a3p66cb39cdfum20jrm0d2e87jmlu8.apps.googleusercontent.com",FB=_m,UB=_m,qB=_m,VB=_m,HB=qc?FB:Vc?UB:vm?qB:No?VB:_m,WB="com.zentaraone.ceeloLounge.service",GB="com.zentaraone.crapsLounge.service",XB="com.zentaraone.pokerLounge.service",YB="com.zentaraone.skillslounge.service",ZB="com.zentaraone.zentara.service",KB=qc?GB:Vc?XB:vm?YB:No?ZB:WB,QB="https://dicelounge.app/api/auth/apple/callback",JB="com.zentaraone.ceeloLounge",$B="com.zentaraone.crapsLounge",e6="com.zentaraone.pokerLounge",t6="com.zentaraone.skillslounge",r6="com.zentaraone.zentara",n6=qc?$B:Vc?e6:vm?t6:No?r6:JB,sS={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/7146732580",unified:"ca-app-pub-4219446894372985/2712849620"},oS={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/4221411683",unified:"ca-app-pub-4219446894372985/9898216833"},a6=sS[Oa]??sS.ceelo,iS=oS[Oa]??oS.ceelo,lS={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/9288049883",unified:"ca-app-pub-4219446894372985/3451216225"},cS={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/1647101696",unified:"ca-app-pub-4219446894372985/2394103660"},s6=lS[Oa]??lS.ceelo,uS=cS[Oa]??cS.ceelo,bl=100,dS=30,_j=3,wj=3,xj=40,_c=6e4,sd=800,o6=!1,Ky=Kl("SecureStoragePlugin",{web:()=>Cr(()=>import("./web-DaKYmqjJ.js"),__vite__mapDeps([5,1,2,3,4]),import.meta.url).then(e=>new e.SecureStoragePluginWeb)}),i6=Object.freeze(Object.defineProperty({__proto__:null,SecureStoragePlugin:Ky},Symbol.toStringTag,{value:"Module"})),Va=Kl("Preferences",{web:()=>Cr(()=>import("./web-SQ5KxhSQ.js"),__vite__mapDeps([6,1,2,3,4]),import.meta.url).then(e=>new e.PreferencesWeb)}),Do=Object.freeze(Object.defineProperty({__proto__:null,Preferences:Va},Symbol.toStringTag,{value:"Module"})),Jm="sess:";async function pS(e){const{value:t}=await Va.get({key:e});return t??null}async function fS(e,t){await Va.set({key:e,value:t})}async function Kb(e){await Va.remove({key:e})}const zo={async get(e){return pS(e)},async set(e,t){await fS(e,t)},async remove(e){await Kb(e)},async setSession(e,t){await fS(Jm+e,t)},async getSession(e){return pS(Jm+e)},async removeSession(e){return Kb(Jm+e)},async clearSessionKeys(){var e;try{const r=((e=(await Va.keys()).keys)==null?void 0:e.filter(n=>n.startsWith(Jm)))||[];await Promise.all(r.map(n=>Kb(n)))}catch{}}};async function Xd(e){try{const t=await zo.getSession(e);return t?JSON.parse(t):null}catch{return null}}async function Qy(e,t){try{await zo.setSession(e,JSON.stringify(t))}catch{}}async function Yd(e){try{await zo.removeSession(e)}catch{}}const Zd="session_token",px=zr.isNativePlatform();async function Jc(e){px?await Ky.set({key:Zd,value:e}):await zo.setSession(Zd,e)}async function Jn(){if(px)try{const{value:t}=await Ky.get({key:Zd});return t||void 0}catch{return}return await zo.getSession(Zd)||void 0}async function Ql(){if(px)try{await Ky.remove({key:Zd})}catch{}else await zo.removeSession(Zd)}const l6=Object.freeze(Object.defineProperty({__proto__:null,clearToken:Ql,getToken:Jn,setToken:Jc},Symbol.toStringTag,{value:"Module"})),Fu={done:!1};function mS(e){if(!e)return"";const t=String(e);return t.length<=12?t:`${t.slice(0,6)}…${t.slice(-6)}`}function gs(e,t){try{console.log(`[NativeAuth] ${e}`,t??"")}catch{}}async function c6(){const e=zr.getPlatform(),t={mode:"online"},r=BB,n=HB;t.clientId=r,t.webClientId=r,t.mode="online",t.iOSClientId=n;const s={mode:"online"},o=e==="ios"?n6:KB,i=QB;s.clientId=o,e!=="ios"&&i&&(s.redirectUrl=i),gs("initialize",{platform:e,hasIOS:!0,googleKeys:Object.keys(t),ids:{web:mS(r),iOS:mS(n)},apple:!0}),await Hf.initialize({...Object.keys(t).length?{google:t}:{},...Object.keys(s).length?{apple:s}:{}})}async function Kd(e=!1){if(!(!e&&Fu.done)){if(!e&&Fu.promise)return Fu.promise;Fu.promise=c6().then(()=>{Fu.done=!0}).catch(t=>{throw Fu.promise=void 0,console.warn("[NativeAuth] SocialLogin initialize failed; will retry on next attempt",t),t})}}async function Aj(){try{await Kd()}catch(e){gs("prewarm:err",String(e))}}function u6(){var e,t;try{const r=zr.getPlatform();if(r==="ios"||r==="android")return!0;const n=typeof window<"u"?window:{};return(e=n.Capacitor)!=null&&e.isNativePlatform?!!n.Capacitor.isNativePlatform:!!((t=n.webkit)!=null&&t.messageHandlers)}catch{return!1}}async function d6(){var p,d,f,m,h,b,g;await Kd(!0),gs("apple:login:start");const t=zr.getPlatform()==="android"?{}:{scopes:["email","name"]},r=await Hf.login({provider:"apple",options:t}),n=(p=r==null?void 0:r.result)==null?void 0:p.idToken,s=(d=r==null?void 0:r.result)==null?void 0:d.profile,o=(s==null?void 0:s.email)||void 0,i=(s==null?void 0:s.givenName)||((m=(f=s==null?void 0:s.name)==null?void 0:f.split(" "))==null?void 0:m[0]),c=(s==null?void 0:s.familyName)||((g=(b=(h=s==null?void 0:s.name)==null?void 0:h.split(" "))==null?void 0:b.slice(1))==null?void 0:g.join(" ")),u=[i,c].filter(Boolean).join(" ").trim()||(s==null?void 0:s.name)||void 0;if(gs("apple:login:result",{hasIdToken:!!n,hasEmail:!!o}),!n)throw new Error("Apple did not return an id token");return{provider:"apple",idToken:n,email:o,name:u}}async function p6(){var e,t,r,n;await Kd(!0);try{gs("google:login:start");const o=zr.getPlatform()==="android"?{}:{scopes:["email","profile"]},i=await Hf.login({provider:"google",options:o});gs("google:login:response",{hasResult:!!(i!=null&&i.result),keys:i&&typeof i=="object"?Object.keys(i):[],resultKeys:i!=null&&i.result?Object.keys(i.result):[]});const c=(e=i==null?void 0:i.result)==null?void 0:e.idToken,u=(t=i==null?void 0:i.result)==null?void 0:t.profile,p=(u==null?void 0:u.email)||void 0,d=(u==null?void 0:u.name)||[u==null?void 0:u.givenName,u==null?void 0:u.familyName].filter(Boolean).join(" ").trim()||void 0;if(gs("google:login:result",{hasIdToken:!!c,hasProfile:!!u,hasEmail:!!p}),!c)throw new Error("Google did not return an id token");return{provider:"google",idToken:c,email:p,name:d}}catch(s){const o=s,i={type:Object.prototype.toString.call(o),message:o==null?void 0:o.message,name:o==null?void 0:o.name,code:o==null?void 0:o.code,status:o==null?void 0:o.status,keys:o&&typeof o=="object"?Object.keys(o):[],raw:o};gs("google:login:err",i);const c=String((o==null?void 0:o.message)||"").toLowerCase();if(c.includes("developer console")||c.includes("config")||c.includes("clientid")||(o==null?void 0:o.code)===28444)try{gs("google:login:err:attempt-reinit"),await Kd(!0);const u=zr.getPlatform(),p=await Hf.login({provider:"google",options:u==="android"?{}:{scopes:["email","profile"]}});gs("google:login:retry:response",{hasResult:!!(p!=null&&p.result)});const d=(r=p==null?void 0:p.result)==null?void 0:r.idToken,f=(n=p==null?void 0:p.result)==null?void 0:n.profile,m=(f==null?void 0:f.email)||void 0,h=(f==null?void 0:f.name)||[f==null?void 0:f.givenName,f==null?void 0:f.familyName].filter(Boolean).join(" ").trim()||void 0;if(!d)throw new Error("Google did not return an id token (retry)");return{provider:"google",idToken:d,email:m,name:h}}catch(u){gs("google:login:err:reinit-failed",String(u))}throw o}}async function f6(e,t){try{await Kd()}catch{}try{await Hf.logout({provider:e}),gs("signOut",{provider:e,ok:!0})}catch(r){gs("signOut:err",String(r))}try{await new Promise(r=>setTimeout(r,120)),await Kd(!0),gs("signOut:reinit:ok")}catch(r){gs("signOut:reinit:err",String(r))}if((t==null?void 0:t.clearLocal)!==!1)try{await Ql()}catch{}}const Ed={isNativePlatform:u6,signInWithAppleNative:d6,signInWithGoogleNative:p6,signOut:f6,prewarmNativeAuth:Aj};let Ko;function m6(){var e,t;try{const r=(t=(e=zr)==null?void 0:e.getPlatform)==null?void 0:t.call(e);if(r)return r==="android"}catch{}try{return typeof navigator<"u"&&/Android/i.test(navigator.userAgent)}catch{return!1}}function h6(){var e,t;try{const r=(t=(e=zr)==null?void 0:e.getPlatform)==null?void 0:t.call(e);if(r)return r==="ios"}catch{}try{return typeof navigator<"u"&&/iPhone|iPad|iPod/i.test(navigator.userAgent)}catch{return!1}}function g6(){var e,t,r,n;try{const s=(t=(e=zr)==null?void 0:e.getPlatform)==null?void 0:t.call(e);return s&&["ios","android"].includes(s)?!0:!!((n=(r=window.Capacitor)==null?void 0:r.isNativePlatform)!=null&&n.call(r))}catch{return!1}}function y6(){var e,t;try{const r=((e=window.localStorage)==null?void 0:e.getItem("api:url"))||((t=window.sessionStorage)==null?void 0:t.getItem("api:url"));if(r&&/^https?:\/\//i.test(r))return r.replace(/\/+$/,"")}catch{}return null}function za(){var o;if(Ko)return Ko;const e=m6(),t=h6(),r=g6();if(e||t&&r)return Ko="https://dicelounge.app",Ko;let n=null;if(!e&&!(t&&r)&&(n=y6()),n)return Ko=n,Ko;let s=!1;try{const i=(o=window.location)==null?void 0:o.hostname;s=i==="localhost"||i==="127.0.0.1"}catch{}return s&&!(t&&r)?(Ko="http://localhost:4000",Ko):(Ko="https://dicelounge.app",Ko)}const Tl=za();let wc=null,od=0,id=null;const b6=1e4;async function Jy(e){const t=(e==null?void 0:e.force)===!0,r=e==null?void 0:e.signal;return!t&&wc&&Date.now()-od<b6?wc:!t&&id?id:(id=(async()=>{var o,i;try{let c=!1;try{c=!!((o=Ed.isNativePlatform)!=null&&o.call(Ed))}catch{c=!1}let u=null;try{u=await Jn()??null}catch{u=null}if(!t&&!u&&c)return null;const p=!!u,d={Accept:"application/json"};p&&u&&(d.Authorization=`Bearer ${u}`);const f=await fetch(`${Tl}/api/auth/me`,{credentials:"include",headers:d,signal:r});if(f.ok){const m=await f.json();if(wc=m,od=Date.now(),(i=m==null?void 0:m.dailyGrant)!=null&&i.granted&&m.dailyGrant.amount)try{window.dispatchEvent(new CustomEvent("daily-grant",{detail:{amount:m.dailyGrant.amount}}))}catch{}return m}if(f.status===204)return wc=null,od=Date.now(),null;if(f.status===401){if(!p&&u){const m=await fetch(`${Tl}/api/auth/me`,{credentials:"include",headers:{Accept:"application/json",Authorization:`Bearer ${u}`},signal:r});if(m.ok){const h=await m.json();return wc=h,od=Date.now(),h}if(m.status===401)try{await Ql()}catch{}}return wc=null,od=Date.now(),null}return null}catch(c){return(c==null?void 0:c.name)==="AbortError",null}})().finally(()=>{id=null}),await id)}async function kj(e){let t=null;try{t=await Jn()??null}catch{t=null}try{await fetch(`${Tl}/api/auth/logout`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json",...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({email:e})})}catch{}try{await Ql()}catch{}try{wc=null,od=0,id=null}catch{}}async function v6(e){const r=await(await fetch(`${Tl}/api/auth/verify-app?token=${encodeURIComponent(e)}`,{method:"GET",credentials:"include"})).json().catch(()=>({}));try{if(r&&(r.success||r.ok||r.token)){const{clearInviter:n}=await Cr(async()=>{const{clearInviter:s}=await Promise.resolve().then(()=>ske);return{clearInviter:s}},void 0,import.meta.url);n()}}catch{}return r}async function _6(e){try{if(Ed.isNativePlatform())throw console.warn("[AuthServices] startOAuth called on native; blocking"),new Error("startOAuth is not allowed on native")}catch{}try{const t=await fetch(`${Tl}/api/auth/${e}`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(t.ok){const r=await t.json().catch(()=>({ok:!1}));if(r!=null&&r.ok&&(r!=null&&r.url))return window.location.assign(r.url),{ok:!0,url:r.url}}return window.location.assign(`${Tl}/api/auth/${e}`),{ok:!1}}catch{try{window.location.assign(`${Tl}/api/auth/${e}`)}catch{}return{ok:!1}}}async function w6(){try{const e=await fetch(`${Tl}/api/auth/guest`,{method:"POST",headers:{Accept:"application/json"},credentials:"include"});if(!e.ok)return{ok:!1};const t=await e.json().catch(()=>({ok:!1}));return{ok:!!(t!=null&&t.ok),token:t==null?void 0:t.token}}catch{return{ok:!1}}}var x6={};let Qb=!1,Qd=null,Uu=null;function A6(){return{apiKey:IB,authDomain:NB,projectId:MB,appId:LB,measurementId:DB}}function _f(){return typeof window<"u"&&typeof document<"u"}function Sj(){if(!_f())return!1;if(Uu!==null)return Uu;try{const e=new URL(window.location.href);if(e.searchParams.has("debug_analytics")||e.searchParams.has("firebase_analytics_debug_mode")||window.localStorage.getItem("analytics:debug")==="1")return Uu=!0}catch{}return Uu=!1}function wf(...e){Sj()&&console.info("[analytics]",...e)}async function fx(){if(Qb||!_f())return;try{if(typeof navigator<"u"&&/jsdom|playwright/i.test(navigator.userAgent||"")||typeof window<"u"&&window.__E2E===!0||typeof process<"u"&&(x6.VITEST||!1)){Qb=!0,wf("skip:init (test env heuristic)");return}}catch{}const e=A6();try{const[{initializeApp:t},{getAnalytics:r}]=await Promise.all([Cr(()=>import("./firebase-COmdod-u.js").then(s=>s.b),[],import.meta.url),Cr(()=>import("./firebase-COmdod-u.js").then(s=>s.c),[],import.meta.url)]),n=t({apiKey:e.apiKey,authDomain:e.authDomain,projectId:e.projectId,appId:e.appId,measurementId:e.measurementId});Qd=r(n),wf("init:ok",{measurementId:e.measurementId})}catch(t){Qd=null,wf("init:fail",{error:(t==null?void 0:t.message)||String(t)})}finally{Qb=!0}}function $c(e,t){if(Qd)try{Cr(async()=>{const{logEvent:r}=await import("./firebase-COmdod-u.js").then(n=>n.c);return{logEvent:r}},[],import.meta.url).then(({logEvent:r})=>{const n=t||{};Sj()&&(n.debug_mode=!0);try{r(Qd,e,n),wf("event",{eventName:e,params:n})}catch{}})}catch{}}function Ms(e,t){const r=_f()?window.location.href:void 0,n=e??(_f()?window.location.pathname:void 0),s=_f()?document.title:void 0;$c("page_view",{page_location:r,page_path:n,page_title:s})}function Jb(e){!Qd||!e||Cr(async()=>{const{setUserId:t}=await import("./firebase-COmdod-u.js").then(r=>r.c);return{setUserId:t}},[],import.meta.url).then(({setUserId:t})=>{try{t(Qd,e)}catch{}wf("userId:set",{userId:e})})}async function k6(e){const t=new Set([]);try{await Va.clear()}catch{}try{if(typeof window<"u"){try{const r={};if(t.size>0)for(let n=0;n<window.localStorage.length;n++){const s=window.localStorage.key(n);s&&t.has(s)&&(r[s]=window.localStorage.getItem(s))}if(window.localStorage.clear(),t.size>0)for(const n of Object.keys(r)){const s=r[n];s!=null&&window.localStorage.setItem(n,s)}}catch{}try{window.sessionStorage.clear()}catch{}}}catch{}}const Ci=Object.create(null);Ci.open="0";Ci.close="1";Ci.ping="2";Ci.pong="3";Ci.message="4";Ci.upgrade="5";Ci.noop="6";const bg=Object.create(null);Object.keys(Ci).forEach(e=>{bg[Ci[e]]=e});const r0={type:"error",data:"parser error"},Ej=typeof Blob=="function"||typeof Blob<"u"&&Object.prototype.toString.call(Blob)==="[object BlobConstructor]",Pj=typeof ArrayBuffer=="function",Cj=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e&&e.buffer instanceof ArrayBuffer,mx=({type:e,data:t},r,n)=>Ej&&t instanceof Blob?r?n(t):hS(t,n):Pj&&(t instanceof ArrayBuffer||Cj(t))?r?n(t):hS(new Blob([t]),n):n(Ci[e]+(t||"")),hS=(e,t)=>{const r=new FileReader;return r.onload=function(){const n=r.result.split(",")[1];t("b"+(n||""))},r.readAsDataURL(e)};function gS(e){return e instanceof Uint8Array?e:e instanceof ArrayBuffer?new Uint8Array(e):new Uint8Array(e.buffer,e.byteOffset,e.byteLength)}let $b;function S6(e,t){if(Ej&&e.data instanceof Blob)return e.data.arrayBuffer().then(gS).then(t);if(Pj&&(e.data instanceof ArrayBuffer||Cj(e.data)))return t(gS(e.data));mx(e,!1,r=>{$b||($b=new TextEncoder),t($b.encode(r))})}const yS="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",rf=typeof Uint8Array>"u"?[]:new Uint8Array(256);for(let e=0;e<yS.length;e++)rf[yS.charCodeAt(e)]=e;const E6=e=>{let t=e.length*.75,r=e.length,n,s=0,o,i,c,u;e[e.length-1]==="="&&(t--,e[e.length-2]==="="&&t--);const p=new ArrayBuffer(t),d=new Uint8Array(p);for(n=0;n<r;n+=4)o=rf[e.charCodeAt(n)],i=rf[e.charCodeAt(n+1)],c=rf[e.charCodeAt(n+2)],u=rf[e.charCodeAt(n+3)],d[s++]=o<<2|i>>4,d[s++]=(i&15)<<4|c>>2,d[s++]=(c&3)<<6|u&63;return p},P6=typeof ArrayBuffer=="function",hx=(e,t)=>{if(typeof e!="string")return{type:"message",data:Rj(e,t)};const r=e.charAt(0);return r==="b"?{type:"message",data:C6(e.substring(1),t)}:bg[r]?e.length>1?{type:bg[r],data:e.substring(1)}:{type:bg[r]}:r0},C6=(e,t)=>{if(P6){const r=E6(e);return Rj(r,t)}else return{base64:!0,data:e}},Rj=(e,t)=>{switch(t){case"blob":return e instanceof Blob?e:new Blob([e]);case"arraybuffer":default:return e instanceof ArrayBuffer?e:e.buffer}},Tj="",R6=(e,t)=>{const r=e.length,n=new Array(r);let s=0;e.forEach((o,i)=>{mx(o,!1,c=>{n[i]=c,++s===r&&t(n.join(Tj))})})},T6=(e,t)=>{const r=e.split(Tj),n=[];for(let s=0;s<r.length;s++){const o=hx(r[s],t);if(n.push(o),o.type==="error")break}return n};function j6(){return new TransformStream({transform(e,t){S6(e,r=>{const n=r.length;let s;if(n<126)s=new Uint8Array(1),new DataView(s.buffer).setUint8(0,n);else if(n<65536){s=new Uint8Array(3);const o=new DataView(s.buffer);o.setUint8(0,126),o.setUint16(1,n)}else{s=new Uint8Array(9);const o=new DataView(s.buffer);o.setUint8(0,127),o.setBigUint64(1,BigInt(n))}e.data&&typeof e.data!="string"&&(s[0]|=128),t.enqueue(s),t.enqueue(r)})}})}let ev;function $m(e){return e.reduce((t,r)=>t+r.length,0)}function eh(e,t){if(e[0].length===t)return e.shift();const r=new Uint8Array(t);let n=0;for(let s=0;s<t;s++)r[s]=e[0][n++],n===e[0].length&&(e.shift(),n=0);return e.length&&n<e[0].length&&(e[0]=e[0].slice(n)),r}function I6(e,t){ev||(ev=new TextDecoder);const r=[];let n=0,s=-1,o=!1;return new TransformStream({transform(i,c){for(r.push(i);;){if(n===0){if($m(r)<1)break;const u=eh(r,1);o=(u[0]&128)===128,s=u[0]&127,s<126?n=3:s===126?n=1:n=2}else if(n===1){if($m(r)<2)break;const u=eh(r,2);s=new DataView(u.buffer,u.byteOffset,u.length).getUint16(0),n=3}else if(n===2){if($m(r)<8)break;const u=eh(r,8),p=new DataView(u.buffer,u.byteOffset,u.length),d=p.getUint32(0);if(d>Math.pow(2,21)-1){c.enqueue(r0);break}s=d*Math.pow(2,32)+p.getUint32(4),n=3}else{if($m(r)<s)break;const u=eh(r,s);c.enqueue(hx(o?u:ev.decode(u),t)),n=0}if(s===0||s>e){c.enqueue(r0);break}}}})}const jj=4;function Pa(e){if(e)return N6(e)}function N6(e){for(var t in Pa.prototype)e[t]=Pa.prototype[t];return e}Pa.prototype.on=Pa.prototype.addEventListener=function(e,t){return this._callbacks=this._callbacks||{},(this._callbacks["$"+e]=this._callbacks["$"+e]||[]).push(t),this};Pa.prototype.once=function(e,t){function r(){this.off(e,r),t.apply(this,arguments)}return r.fn=t,this.on(e,r),this};Pa.prototype.off=Pa.prototype.removeListener=Pa.prototype.removeAllListeners=Pa.prototype.removeEventListener=function(e,t){if(this._callbacks=this._callbacks||{},arguments.length==0)return this._callbacks={},this;var r=this._callbacks["$"+e];if(!r)return this;if(arguments.length==1)return delete this._callbacks["$"+e],this;for(var n,s=0;s<r.length;s++)if(n=r[s],n===t||n.fn===t){r.splice(s,1);break}return r.length===0&&delete this._callbacks["$"+e],this};Pa.prototype.emit=function(e){this._callbacks=this._callbacks||{};for(var t=new Array(arguments.length-1),r=this._callbacks["$"+e],n=1;n<arguments.length;n++)t[n-1]=arguments[n];if(r){r=r.slice(0);for(var n=0,s=r.length;n<s;++n)r[n].apply(this,t)}return this};Pa.prototype.emitReserved=Pa.prototype.emit;Pa.prototype.listeners=function(e){return this._callbacks=this._callbacks||{},this._callbacks["$"+e]||[]};Pa.prototype.hasListeners=function(e){return!!this.listeners(e).length};const $y=typeof Promise=="function"&&typeof Promise.resolve=="function"?t=>Promise.resolve().then(t):(t,r)=>r(t,0),po=typeof self<"u"?self:typeof window<"u"?window:Function("return this")(),M6="arraybuffer";function Ij(e,...t){return t.reduce((r,n)=>(e.hasOwnProperty(n)&&(r[n]=e[n]),r),{})}const L6=po.setTimeout,D6=po.clearTimeout;function eb(e,t){t.useNativeTimers?(e.setTimeoutFn=L6.bind(po),e.clearTimeoutFn=D6.bind(po)):(e.setTimeoutFn=po.setTimeout.bind(po),e.clearTimeoutFn=po.clearTimeout.bind(po))}const O6=1.33;function z6(e){return typeof e=="string"?B6(e):Math.ceil((e.byteLength||e.size)*O6)}function B6(e){let t=0,r=0;for(let n=0,s=e.length;n<s;n++)t=e.charCodeAt(n),t<128?r+=1:t<2048?r+=2:t<55296||t>=57344?r+=3:(n++,r+=4);return r}function Nj(){return Date.now().toString(36).substring(3)+Math.random().toString(36).substring(2,5)}function F6(e){let t="";for(let r in e)e.hasOwnProperty(r)&&(t.length&&(t+="&"),t+=encodeURIComponent(r)+"="+encodeURIComponent(e[r]));return t}function U6(e){let t={},r=e.split("&");for(let n=0,s=r.length;n<s;n++){let o=r[n].split("=");t[decodeURIComponent(o[0])]=decodeURIComponent(o[1])}return t}class q6 extends Error{constructor(t,r,n){super(t),this.description=r,this.context=n,this.type="TransportError"}}class gx extends Pa{constructor(t){super(),this.writable=!1,eb(this,t),this.opts=t,this.query=t.query,this.socket=t.socket,this.supportsBinary=!t.forceBase64}onError(t,r,n){return super.emitReserved("error",new q6(t,r,n)),this}open(){return this.readyState="opening",this.doOpen(),this}close(){return(this.readyState==="opening"||this.readyState==="open")&&(this.doClose(),this.onClose()),this}send(t){this.readyState==="open"&&this.write(t)}onOpen(){this.readyState="open",this.writable=!0,super.emitReserved("open")}onData(t){const r=hx(t,this.socket.binaryType);this.onPacket(r)}onPacket(t){super.emitReserved("packet",t)}onClose(t){this.readyState="closed",super.emitReserved("close",t)}pause(t){}createUri(t,r={}){return t+"://"+this._hostname()+this._port()+this.opts.path+this._query(r)}_hostname(){const t=this.opts.hostname;return t.indexOf(":")===-1?t:"["+t+"]"}_port(){return this.opts.port&&(this.opts.secure&&+(this.opts.port!==443)||!this.opts.secure&&Number(this.opts.port)!==80)?":"+this.opts.port:""}_query(t){const r=F6(t);return r.length?"?"+r:""}}class V6 extends gx{constructor(){super(...arguments),this._polling=!1}get name(){return"polling"}doOpen(){this._poll()}pause(t){this.readyState="pausing";const r=()=>{this.readyState="paused",t()};if(this._polling||!this.writable){let n=0;this._polling&&(n++,this.once("pollComplete",function(){--n||r()})),this.writable||(n++,this.once("drain",function(){--n||r()}))}else r()}_poll(){this._polling=!0,this.doPoll(),this.emitReserved("poll")}onData(t){const r=n=>{if(this.readyState==="opening"&&n.type==="open"&&this.onOpen(),n.type==="close")return this.onClose({description:"transport closed by the server"}),!1;this.onPacket(n)};T6(t,this.socket.binaryType).forEach(r),this.readyState!=="closed"&&(this._polling=!1,this.emitReserved("pollComplete"),this.readyState==="open"&&this._poll())}doClose(){const t=()=>{this.write([{type:"close"}])};this.readyState==="open"?t():this.once("open",t)}write(t){this.writable=!1,R6(t,r=>{this.doWrite(r,()=>{this.writable=!0,this.emitReserved("drain")})})}uri(){const t=this.opts.secure?"https":"http",r=this.query||{};return this.opts.timestampRequests!==!1&&(r[this.opts.timestampParam]=Nj()),!this.supportsBinary&&!r.sid&&(r.b64=1),this.createUri(t,r)}}let Mj=!1;try{Mj=typeof XMLHttpRequest<"u"&&"withCredentials"in new XMLHttpRequest}catch{}const H6=Mj;function W6(){}class G6 extends V6{constructor(t){if(super(t),typeof location<"u"){const r=location.protocol==="https:";let n=location.port;n||(n=r?"443":"80"),this.xd=typeof location<"u"&&t.hostname!==location.hostname||n!==t.port}}doWrite(t,r){const n=this.request({method:"POST",data:t});n.on("success",r),n.on("error",(s,o)=>{this.onError("xhr post error",s,o)})}doPoll(){const t=this.request();t.on("data",this.onData.bind(this)),t.on("error",(r,n)=>{this.onError("xhr poll error",r,n)}),this.pollXhr=t}}let Pd=class vg extends Pa{constructor(t,r,n){super(),this.createRequest=t,eb(this,n),this._opts=n,this._method=n.method||"GET",this._uri=r,this._data=n.data!==void 0?n.data:null,this._create()}_create(){var t;const r=Ij(this._opts,"agent","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","autoUnref");r.xdomain=!!this._opts.xd;const n=this._xhr=this.createRequest(r);try{n.open(this._method,this._uri,!0);try{if(this._opts.extraHeaders){n.setDisableHeaderCheck&&n.setDisableHeaderCheck(!0);for(let s in this._opts.extraHeaders)this._opts.extraHeaders.hasOwnProperty(s)&&n.setRequestHeader(s,this._opts.extraHeaders[s])}}catch{}if(this._method==="POST")try{n.setRequestHeader("Content-type","text/plain;charset=UTF-8")}catch{}try{n.setRequestHeader("Accept","*/*")}catch{}(t=this._opts.cookieJar)===null||t===void 0||t.addCookies(n),"withCredentials"in n&&(n.withCredentials=this._opts.withCredentials),this._opts.requestTimeout&&(n.timeout=this._opts.requestTimeout),n.onreadystatechange=()=>{var s;n.readyState===3&&((s=this._opts.cookieJar)===null||s===void 0||s.parseCookies(n.getResponseHeader("set-cookie"))),n.readyState===4&&(n.status===200||n.status===1223?this._onLoad():this.setTimeoutFn(()=>{this._onError(typeof n.status=="number"?n.status:0)},0))},n.send(this._data)}catch(s){this.setTimeoutFn(()=>{this._onError(s)},0);return}typeof document<"u"&&(this._index=vg.requestsCount++,vg.requests[this._index]=this)}_onError(t){this.emitReserved("error",t,this._xhr),this._cleanup(!0)}_cleanup(t){if(!(typeof this._xhr>"u"||this._xhr===null)){if(this._xhr.onreadystatechange=W6,t)try{this._xhr.abort()}catch{}typeof document<"u"&&delete vg.requests[this._index],this._xhr=null}}_onLoad(){const t=this._xhr.responseText;t!==null&&(this.emitReserved("data",t),this.emitReserved("success"),this._cleanup())}abort(){this._cleanup()}};Pd.requestsCount=0;Pd.requests={};if(typeof document<"u"){if(typeof attachEvent=="function")attachEvent("onunload",bS);else if(typeof addEventListener=="function"){const e="onpagehide"in po?"pagehide":"unload";addEventListener(e,bS,!1)}}function bS(){for(let e in Pd.requests)Pd.requests.hasOwnProperty(e)&&Pd.requests[e].abort()}const X6=function(){const e=Lj({xdomain:!1});return e&&e.responseType!==null}();class Y6 extends G6{constructor(t){super(t);const r=t&&t.forceBase64;this.supportsBinary=X6&&!r}request(t={}){return Object.assign(t,{xd:this.xd},this.opts),new Pd(Lj,this.uri(),t)}}function Lj(e){const t=e.xdomain;try{if(typeof XMLHttpRequest<"u"&&(!t||H6))return new XMLHttpRequest}catch{}if(!t)try{return new po[["Active"].concat("Object").join("X")]("Microsoft.XMLHTTP")}catch{}}const Dj=typeof navigator<"u"&&typeof navigator.product=="string"&&navigator.product.toLowerCase()==="reactnative";class Z6 extends gx{get name(){return"websocket"}doOpen(){const t=this.uri(),r=this.opts.protocols,n=Dj?{}:Ij(this.opts,"agent","perMessageDeflate","pfx","key","passphrase","cert","ca","ciphers","rejectUnauthorized","localAddress","protocolVersion","origin","maxPayload","family","checkServerIdentity");this.opts.extraHeaders&&(n.headers=this.opts.extraHeaders);try{this.ws=this.createSocket(t,r,n)}catch(s){return this.emitReserved("error",s)}this.ws.binaryType=this.socket.binaryType,this.addEventListeners()}addEventListeners(){this.ws.onopen=()=>{this.opts.autoUnref&&this.ws._socket.unref(),this.onOpen()},this.ws.onclose=t=>this.onClose({description:"websocket connection closed",context:t}),this.ws.onmessage=t=>this.onData(t.data),this.ws.onerror=t=>this.onError("websocket error",t)}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const n=t[r],s=r===t.length-1;mx(n,this.supportsBinary,o=>{try{this.doWrite(n,o)}catch{}s&&$y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){typeof this.ws<"u"&&(this.ws.onerror=()=>{},this.ws.close(),this.ws=null)}uri(){const t=this.opts.secure?"wss":"ws",r=this.query||{};return this.opts.timestampRequests&&(r[this.opts.timestampParam]=Nj()),this.supportsBinary||(r.b64=1),this.createUri(t,r)}}const tv=po.WebSocket||po.MozWebSocket;class K6 extends Z6{createSocket(t,r,n){return Dj?new tv(t,r,n):r?new tv(t,r):new tv(t)}doWrite(t,r){this.ws.send(r)}}class Q6 extends gx{get name(){return"webtransport"}doOpen(){try{this._transport=new WebTransport(this.createUri("https"),this.opts.transportOptions[this.name])}catch(t){return this.emitReserved("error",t)}this._transport.closed.then(()=>{this.onClose()}).catch(t=>{this.onError("webtransport error",t)}),this._transport.ready.then(()=>{this._transport.createBidirectionalStream().then(t=>{const r=I6(Number.MAX_SAFE_INTEGER,this.socket.binaryType),n=t.readable.pipeThrough(r).getReader(),s=j6();s.readable.pipeTo(t.writable),this._writer=s.writable.getWriter();const o=()=>{n.read().then(({done:c,value:u})=>{c||(this.onPacket(u),o())}).catch(c=>{})};o();const i={type:"open"};this.query.sid&&(i.data=`{"sid":"${this.query.sid}"}`),this._writer.write(i).then(()=>this.onOpen())})})}write(t){this.writable=!1;for(let r=0;r<t.length;r++){const n=t[r],s=r===t.length-1;this._writer.write(n).then(()=>{s&&$y(()=>{this.writable=!0,this.emitReserved("drain")},this.setTimeoutFn)})}}doClose(){var t;(t=this._transport)===null||t===void 0||t.close()}}const J6={websocket:K6,webtransport:Q6,polling:Y6},$6=/^(?:(?![^:@\/?#]+:[^:@\/]*@)(http|https|ws|wss):\/\/)?((?:(([^:@\/?#]*)(?::([^:@\/?#]*))?)?@)?((?:[a-f0-9]{0,4}:){2,7}[a-f0-9]{0,4}|[^:\/?#]*)(?::(\d*))?)(((\/(?:[^?#](?![^?#\/]*\.[^?#\/.]+(?:[?#]|$)))*\/?)?([^?#\/]*))(?:\?([^#]*))?(?:#(.*))?)/,eF=["source","protocol","authority","userInfo","user","password","host","port","relative","path","directory","file","query","anchor"];function n0(e){if(e.length>8e3)throw"URI too long";const t=e,r=e.indexOf("["),n=e.indexOf("]");r!=-1&&n!=-1&&(e=e.substring(0,r)+e.substring(r,n).replace(/:/g,";")+e.substring(n,e.length));let s=$6.exec(e||""),o={},i=14;for(;i--;)o[eF[i]]=s[i]||"";return r!=-1&&n!=-1&&(o.source=t,o.host=o.host.substring(1,o.host.length-1).replace(/;/g,":"),o.authority=o.authority.replace("[","").replace("]","").replace(/;/g,":"),o.ipv6uri=!0),o.pathNames=tF(o,o.path),o.queryKey=rF(o,o.query),o}function tF(e,t){const r=/\/{2,9}/g,n=t.replace(r,"/").split("/");return(t.slice(0,1)=="/"||t.length===0)&&n.splice(0,1),t.slice(-1)=="/"&&n.splice(n.length-1,1),n}function rF(e,t){const r={};return t.replace(/(?:^|&)([^&=]*)=?([^&]*)/g,function(n,s,o){s&&(r[s]=o)}),r}const a0=typeof addEventListener=="function"&&typeof removeEventListener=="function",_g=[];a0&&addEventListener("offline",()=>{_g.forEach(e=>e())},!1);class jl extends Pa{constructor(t,r){if(super(),this.binaryType=M6,this.writeBuffer=[],this._prevBufferLen=0,this._pingInterval=-1,this._pingTimeout=-1,this._maxPayload=-1,this._pingTimeoutTime=1/0,t&&typeof t=="object"&&(r=t,t=null),t){const n=n0(t);r.hostname=n.host,r.secure=n.protocol==="https"||n.protocol==="wss",r.port=n.port,n.query&&(r.query=n.query)}else r.host&&(r.hostname=n0(r.host).host);eb(this,r),this.secure=r.secure!=null?r.secure:typeof location<"u"&&location.protocol==="https:",r.hostname&&!r.port&&(r.port=this.secure?"443":"80"),this.hostname=r.hostname||(typeof location<"u"?location.hostname:"localhost"),this.port=r.port||(typeof location<"u"&&location.port?location.port:this.secure?"443":"80"),this.transports=[],this._transportsByName={},r.transports.forEach(n=>{const s=n.prototype.name;this.transports.push(s),this._transportsByName[s]=n}),this.opts=Object.assign({path:"/engine.io",agent:!1,withCredentials:!1,upgrade:!0,timestampParam:"t",rememberUpgrade:!1,addTrailingSlash:!0,rejectUnauthorized:!0,perMessageDeflate:{threshold:1024},transportOptions:{},closeOnBeforeunload:!1},r),this.opts.path=this.opts.path.replace(/\/$/,"")+(this.opts.addTrailingSlash?"/":""),typeof this.opts.query=="string"&&(this.opts.query=U6(this.opts.query)),a0&&(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"})},_g.push(this._offlineEventListener))),this.opts.withCredentials&&(this._cookieJar=void 0),this._open()}createTransport(t){const r=Object.assign({},this.opts.query);r.EIO=jj,r.transport=t,this.id&&(r.sid=this.id);const n=Object.assign({},this.opts,{query:r,socket:this,hostname:this.hostname,secure:this.secure,port:this.port},this.opts.transportOptions[t]);return new this._transportsByName[t](n)}_open(){if(this.transports.length===0){this.setTimeoutFn(()=>{this.emitReserved("error","No transports available")},0);return}const t=this.opts.rememberUpgrade&&jl.priorWebsocketSuccess&&this.transports.indexOf("websocket")!==-1?"websocket":this.transports[0];this.readyState="opening";const r=this.createTransport(t);r.open(),this.setTransport(r)}setTransport(t){this.transport&&this.transport.removeAllListeners(),this.transport=t,t.on("drain",this._onDrain.bind(this)).on("packet",this._onPacket.bind(this)).on("error",this._onError.bind(this)).on("close",r=>this._onClose("transport close",r))}onOpen(){this.readyState="open",jl.priorWebsocketSuccess=this.transport.name==="websocket",this.emitReserved("open"),this.flush()}_onPacket(t){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing")switch(this.emitReserved("packet",t),this.emitReserved("heartbeat"),t.type){case"open":this.onHandshake(JSON.parse(t.data));break;case"ping":this._sendPacket("pong"),this.emitReserved("ping"),this.emitReserved("pong"),this._resetPingTimeout();break;case"error":const r=new Error("server error");r.code=t.data,this._onError(r);break;case"message":this.emitReserved("data",t.data),this.emitReserved("message",t.data);break}}onHandshake(t){this.emitReserved("handshake",t),this.id=t.sid,this.transport.query.sid=t.sid,this._pingInterval=t.pingInterval,this._pingTimeout=t.pingTimeout,this._maxPayload=t.maxPayload,this.onOpen(),this.readyState!=="closed"&&this._resetPingTimeout()}_resetPingTimeout(){this.clearTimeoutFn(this._pingTimeoutTimer);const t=this._pingInterval+this._pingTimeout;this._pingTimeoutTime=Date.now()+t,this._pingTimeoutTimer=this.setTimeoutFn(()=>{this._onClose("ping timeout")},t),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 t=this._getWritablePackets();this.transport.send(t),this._prevBufferLen=t.length,this.emitReserved("flush")}}_getWritablePackets(){if(!(this._maxPayload&&this.transport.name==="polling"&&this.writeBuffer.length>1))return this.writeBuffer;let r=1;for(let n=0;n<this.writeBuffer.length;n++){const s=this.writeBuffer[n].data;if(s&&(r+=z6(s)),n>0&&r>this._maxPayload)return this.writeBuffer.slice(0,n);r+=2}return this.writeBuffer}_hasPingExpired(){if(!this._pingTimeoutTime)return!0;const t=Date.now()>this._pingTimeoutTime;return t&&(this._pingTimeoutTime=0,$y(()=>{this._onClose("ping timeout")},this.setTimeoutFn)),t}write(t,r,n){return this._sendPacket("message",t,r,n),this}send(t,r,n){return this._sendPacket("message",t,r,n),this}_sendPacket(t,r,n,s){if(typeof r=="function"&&(s=r,r=void 0),typeof n=="function"&&(s=n,n=null),this.readyState==="closing"||this.readyState==="closed")return;n=n||{},n.compress=n.compress!==!1;const o={type:t,data:r,options:n};this.emitReserved("packetCreate",o),this.writeBuffer.push(o),s&&this.once("flush",s),this.flush()}close(){const t=()=>{this._onClose("forced close"),this.transport.close()},r=()=>{this.off("upgrade",r),this.off("upgradeError",r),t()},n=()=>{this.once("upgrade",r),this.once("upgradeError",r)};return(this.readyState==="opening"||this.readyState==="open")&&(this.readyState="closing",this.writeBuffer.length?this.once("drain",()=>{this.upgrading?n():t()}):this.upgrading?n():t()),this}_onError(t){if(jl.priorWebsocketSuccess=!1,this.opts.tryAllTransports&&this.transports.length>1&&this.readyState==="opening")return this.transports.shift(),this._open();this.emitReserved("error",t),this._onClose("transport error",t)}_onClose(t,r){if(this.readyState==="opening"||this.readyState==="open"||this.readyState==="closing"){if(this.clearTimeoutFn(this._pingTimeoutTimer),this.transport.removeAllListeners("close"),this.transport.close(),this.transport.removeAllListeners(),a0&&(this._beforeunloadEventListener&&removeEventListener("beforeunload",this._beforeunloadEventListener,!1),this._offlineEventListener)){const n=_g.indexOf(this._offlineEventListener);n!==-1&&_g.splice(n,1)}this.readyState="closed",this.id=null,this.emitReserved("close",t,r),this.writeBuffer=[],this._prevBufferLen=0}}}jl.protocol=jj;class nF extends jl{constructor(){super(...arguments),this._upgrades=[]}onOpen(){if(super.onOpen(),this.readyState==="open"&&this.opts.upgrade)for(let t=0;t<this._upgrades.length;t++)this._probe(this._upgrades[t])}_probe(t){let r=this.createTransport(t),n=!1;jl.priorWebsocketSuccess=!1;const s=()=>{n||(r.send([{type:"ping",data:"probe"}]),r.once("packet",f=>{if(!n)if(f.type==="pong"&&f.data==="probe"){if(this.upgrading=!0,this.emitReserved("upgrading",r),!r)return;jl.priorWebsocketSuccess=r.name==="websocket",this.transport.pause(()=>{n||this.readyState!=="closed"&&(d(),this.setTransport(r),r.send([{type:"upgrade"}]),this.emitReserved("upgrade",r),r=null,this.upgrading=!1,this.flush())})}else{const m=new Error("probe error");m.transport=r.name,this.emitReserved("upgradeError",m)}}))};function o(){n||(n=!0,d(),r.close(),r=null)}const i=f=>{const m=new Error("probe error: "+f);m.transport=r.name,o(),this.emitReserved("upgradeError",m)};function c(){i("transport closed")}function u(){i("socket closed")}function p(f){r&&f.name!==r.name&&o()}const d=()=>{r.removeListener("open",s),r.removeListener("error",i),r.removeListener("close",c),this.off("close",u),this.off("upgrading",p)};r.once("open",s),r.once("error",i),r.once("close",c),this.once("close",u),this.once("upgrading",p),this._upgrades.indexOf("webtransport")!==-1&&t!=="webtransport"?this.setTimeoutFn(()=>{n||r.open()},200):r.open()}onHandshake(t){this._upgrades=this._filterUpgrades(t.upgrades),super.onHandshake(t)}_filterUpgrades(t){const r=[];for(let n=0;n<t.length;n++)~this.transports.indexOf(t[n])&&r.push(t[n]);return r}}let aF=class extends nF{constructor(t,r={}){const n=typeof t=="object"?t:r;(!n.transports||n.transports&&typeof n.transports[0]=="string")&&(n.transports=(n.transports||["polling","websocket","webtransport"]).map(s=>J6[s]).filter(s=>!!s)),super(t,n)}};function sF(e,t="",r){let n=e;r=r||typeof location<"u"&&location,e==null&&(e=r.protocol+"//"+r.host),typeof e=="string"&&(e.charAt(0)==="/"&&(e.charAt(1)==="/"?e=r.protocol+e:e=r.host+e),/^(https?|wss?):\/\//.test(e)||(typeof r<"u"?e=r.protocol+"//"+e:e="https://"+e),n=n0(e)),n.port||(/^(http|ws)$/.test(n.protocol)?n.port="80":/^(http|ws)s$/.test(n.protocol)&&(n.port="443")),n.path=n.path||"/";const o=n.host.indexOf(":")!==-1?"["+n.host+"]":n.host;return n.id=n.protocol+"://"+o+":"+n.port+t,n.href=n.protocol+"://"+o+(r&&r.port===n.port?"":":"+n.port),n}const oF=typeof ArrayBuffer=="function",iF=e=>typeof ArrayBuffer.isView=="function"?ArrayBuffer.isView(e):e.buffer instanceof ArrayBuffer,Oj=Object.prototype.toString,lF=typeof Blob=="function"||typeof Blob<"u"&&Oj.call(Blob)==="[object BlobConstructor]",cF=typeof File=="function"||typeof File<"u"&&Oj.call(File)==="[object FileConstructor]";function yx(e){return oF&&(e instanceof ArrayBuffer||iF(e))||lF&&e instanceof Blob||cF&&e instanceof File}function wg(e,t){if(!e||typeof e!="object")return!1;if(Array.isArray(e)){for(let r=0,n=e.length;r<n;r++)if(wg(e[r]))return!0;return!1}if(yx(e))return!0;if(e.toJSON&&typeof e.toJSON=="function"&&arguments.length===1)return wg(e.toJSON(),!0);for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)&&wg(e[r]))return!0;return!1}function uF(e){const t=[],r=e.data,n=e;return n.data=s0(r,t),n.attachments=t.length,{packet:n,buffers:t}}function s0(e,t){if(!e)return e;if(yx(e)){const r={_placeholder:!0,num:t.length};return t.push(e),r}else if(Array.isArray(e)){const r=new Array(e.length);for(let n=0;n<e.length;n++)r[n]=s0(e[n],t);return r}else if(typeof e=="object"&&!(e instanceof Date)){const r={};for(const n in e)Object.prototype.hasOwnProperty.call(e,n)&&(r[n]=s0(e[n],t));return r}return e}function dF(e,t){return e.data=o0(e.data,t),delete e.attachments,e}function o0(e,t){if(!e)return e;if(e&&e._placeholder===!0){if(typeof e.num=="number"&&e.num>=0&&e.num<t.length)return t[e.num];throw new Error("illegal attachments")}else if(Array.isArray(e))for(let r=0;r<e.length;r++)e[r]=o0(e[r],t);else if(typeof e=="object")for(const r in e)Object.prototype.hasOwnProperty.call(e,r)&&(e[r]=o0(e[r],t));return e}const pF=["connect","connect_error","disconnect","disconnecting","newListener","removeListener"],fF=5;var vn;(function(e){e[e.CONNECT=0]="CONNECT",e[e.DISCONNECT=1]="DISCONNECT",e[e.EVENT=2]="EVENT",e[e.ACK=3]="ACK",e[e.CONNECT_ERROR=4]="CONNECT_ERROR",e[e.BINARY_EVENT=5]="BINARY_EVENT",e[e.BINARY_ACK=6]="BINARY_ACK"})(vn||(vn={}));class mF{constructor(t){this.replacer=t}encode(t){return(t.type===vn.EVENT||t.type===vn.ACK)&&wg(t)?this.encodeAsBinary({type:t.type===vn.EVENT?vn.BINARY_EVENT:vn.BINARY_ACK,nsp:t.nsp,data:t.data,id:t.id}):[this.encodeAsString(t)]}encodeAsString(t){let r=""+t.type;return(t.type===vn.BINARY_EVENT||t.type===vn.BINARY_ACK)&&(r+=t.attachments+"-"),t.nsp&&t.nsp!=="/"&&(r+=t.nsp+","),t.id!=null&&(r+=t.id),t.data!=null&&(r+=JSON.stringify(t.data,this.replacer)),r}encodeAsBinary(t){const r=uF(t),n=this.encodeAsString(r.packet),s=r.buffers;return s.unshift(n),s}}function vS(e){return Object.prototype.toString.call(e)==="[object Object]"}class bx extends Pa{constructor(t){super(),this.reviver=t}add(t){let r;if(typeof t=="string"){if(this.reconstructor)throw new Error("got plaintext data when reconstructing a packet");r=this.decodeString(t);const n=r.type===vn.BINARY_EVENT;n||r.type===vn.BINARY_ACK?(r.type=n?vn.EVENT:vn.ACK,this.reconstructor=new hF(r),r.attachments===0&&super.emitReserved("decoded",r)):super.emitReserved("decoded",r)}else if(yx(t)||t.base64)if(this.reconstructor)r=this.reconstructor.takeBinaryData(t),r&&(this.reconstructor=null,super.emitReserved("decoded",r));else throw new Error("got binary data when not reconstructing a packet");else throw new Error("Unknown type: "+t)}decodeString(t){let r=0;const n={type:Number(t.charAt(0))};if(vn[n.type]===void 0)throw new Error("unknown packet type "+n.type);if(n.type===vn.BINARY_EVENT||n.type===vn.BINARY_ACK){const o=r+1;for(;t.charAt(++r)!=="-"&&r!=t.length;);const i=t.substring(o,r);if(i!=Number(i)||t.charAt(r)!=="-")throw new Error("Illegal attachments");n.attachments=Number(i)}if(t.charAt(r+1)==="/"){const o=r+1;for(;++r&&!(t.charAt(r)===","||r===t.length););n.nsp=t.substring(o,r)}else n.nsp="/";const s=t.charAt(r+1);if(s!==""&&Number(s)==s){const o=r+1;for(;++r;){const i=t.charAt(r);if(i==null||Number(i)!=i){--r;break}if(r===t.length)break}n.id=Number(t.substring(o,r+1))}if(t.charAt(++r)){const o=this.tryParse(t.substr(r));if(bx.isPayloadValid(n.type,o))n.data=o;else throw new Error("invalid payload")}return n}tryParse(t){try{return JSON.parse(t,this.reviver)}catch{return!1}}static isPayloadValid(t,r){switch(t){case vn.CONNECT:return vS(r);case vn.DISCONNECT:return r===void 0;case vn.CONNECT_ERROR:return typeof r=="string"||vS(r);case vn.EVENT:case vn.BINARY_EVENT:return Array.isArray(r)&&(typeof r[0]=="number"||typeof r[0]=="string"&&pF.indexOf(r[0])===-1);case vn.ACK:case vn.BINARY_ACK:return Array.isArray(r)}}destroy(){this.reconstructor&&(this.reconstructor.finishedReconstruction(),this.reconstructor=null)}}class hF{constructor(t){this.packet=t,this.buffers=[],this.reconPack=t}takeBinaryData(t){if(this.buffers.push(t),this.buffers.length===this.reconPack.attachments){const r=dF(this.reconPack,this.buffers);return this.finishedReconstruction(),r}return null}finishedReconstruction(){this.reconPack=null,this.buffers=[]}}const gF=Object.freeze(Object.defineProperty({__proto__:null,Decoder:bx,Encoder:mF,get PacketType(){return vn},protocol:fF},Symbol.toStringTag,{value:"Module"}));function Io(e,t,r){return e.on(t,r),function(){e.off(t,r)}}const yF=Object.freeze({connect:1,connect_error:1,disconnect:1,disconnecting:1,newListener:1,removeListener:1});class zj extends Pa{constructor(t,r,n){super(),this.connected=!1,this.recovered=!1,this.receiveBuffer=[],this.sendBuffer=[],this._queue=[],this._queueSeq=0,this.ids=0,this.acks={},this.flags={},this.io=t,this.nsp=r,n&&n.auth&&(this.auth=n.auth),this._opts=Object.assign({},n),this.io._autoConnect&&this.open()}get disconnected(){return!this.connected}subEvents(){if(this.subs)return;const t=this.io;this.subs=[Io(t,"open",this.onopen.bind(this)),Io(t,"packet",this.onpacket.bind(this)),Io(t,"error",this.onerror.bind(this)),Io(t,"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(...t){return t.unshift("message"),this.emit.apply(this,t),this}emit(t,...r){var n,s,o;if(yF.hasOwnProperty(t))throw new Error('"'+t.toString()+'" is a reserved event name');if(r.unshift(t),this._opts.retries&&!this.flags.fromQueue&&!this.flags.volatile)return this._addToQueue(r),this;const i={type:vn.EVENT,data:r};if(i.options={},i.options.compress=this.flags.compress!==!1,typeof r[r.length-1]=="function"){const d=this.ids++,f=r.pop();this._registerAckCallback(d,f),i.id=d}const c=(s=(n=this.io.engine)===null||n===void 0?void 0:n.transport)===null||s===void 0?void 0:s.writable,u=this.connected&&!(!((o=this.io.engine)===null||o===void 0)&&o._hasPingExpired());return this.flags.volatile&&!c||(u?(this.notifyOutgoingListeners(i),this.packet(i)):this.sendBuffer.push(i)),this.flags={},this}_registerAckCallback(t,r){var n;const s=(n=this.flags.timeout)!==null&&n!==void 0?n:this._opts.ackTimeout;if(s===void 0){this.acks[t]=r;return}const o=this.io.setTimeoutFn(()=>{delete this.acks[t];for(let c=0;c<this.sendBuffer.length;c++)this.sendBuffer[c].id===t&&this.sendBuffer.splice(c,1);r.call(this,new Error("operation has timed out"))},s),i=(...c)=>{this.io.clearTimeoutFn(o),r.apply(this,c)};i.withError=!0,this.acks[t]=i}emitWithAck(t,...r){return new Promise((n,s)=>{const o=(i,c)=>i?s(i):n(c);o.withError=!0,r.push(o),this.emit(t,...r)})}_addToQueue(t){let r;typeof t[t.length-1]=="function"&&(r=t.pop());const n={id:this._queueSeq++,tryCount:0,pending:!1,args:t,flags:Object.assign({fromQueue:!0},this.flags)};t.push((s,...o)=>n!==this._queue[0]?void 0:(s!==null?n.tryCount>this._opts.retries&&(this._queue.shift(),r&&r(s)):(this._queue.shift(),r&&r(null,...o)),n.pending=!1,this._drainQueue())),this._queue.push(n),this._drainQueue()}_drainQueue(t=!1){if(!this.connected||this._queue.length===0)return;const r=this._queue[0];r.pending&&!t||(r.pending=!0,r.tryCount++,this.flags=r.flags,this.emit.apply(this,r.args))}packet(t){t.nsp=this.nsp,this.io._packet(t)}onopen(){typeof this.auth=="function"?this.auth(t=>{this._sendConnectPacket(t)}):this._sendConnectPacket(this.auth)}_sendConnectPacket(t){this.packet({type:vn.CONNECT,data:this._pid?Object.assign({pid:this._pid,offset:this._lastOffset},t):t})}onerror(t){this.connected||this.emitReserved("connect_error",t)}onclose(t,r){this.connected=!1,delete this.id,this.emitReserved("disconnect",t,r),this._clearAcks()}_clearAcks(){Object.keys(this.acks).forEach(t=>{if(!this.sendBuffer.some(n=>String(n.id)===t)){const n=this.acks[t];delete this.acks[t],n.withError&&n.call(this,new Error("socket has been disconnected"))}})}onpacket(t){if(t.nsp===this.nsp)switch(t.type){case vn.CONNECT:t.data&&t.data.sid?this.onconnect(t.data.sid,t.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 vn.EVENT:case vn.BINARY_EVENT:this.onevent(t);break;case vn.ACK:case vn.BINARY_ACK:this.onack(t);break;case vn.DISCONNECT:this.ondisconnect();break;case vn.CONNECT_ERROR:this.destroy();const n=new Error(t.data.message);n.data=t.data.data,this.emitReserved("connect_error",n);break}}onevent(t){const r=t.data||[];t.id!=null&&r.push(this.ack(t.id)),this.connected?this.emitEvent(r):this.receiveBuffer.push(Object.freeze(r))}emitEvent(t){if(this._anyListeners&&this._anyListeners.length){const r=this._anyListeners.slice();for(const n of r)n.apply(this,t)}super.emit.apply(this,t),this._pid&&t.length&&typeof t[t.length-1]=="string"&&(this._lastOffset=t[t.length-1])}ack(t){const r=this;let n=!1;return function(...s){n||(n=!0,r.packet({type:vn.ACK,id:t,data:s}))}}onack(t){const r=this.acks[t.id];typeof r=="function"&&(delete this.acks[t.id],r.withError&&t.data.unshift(null),r.apply(this,t.data))}onconnect(t,r){this.id=t,this.recovered=r&&this._pid===r,this._pid=r,this.connected=!0,this.emitBuffered(),this.emitReserved("connect"),this._drainQueue(!0)}emitBuffered(){this.receiveBuffer.forEach(t=>this.emitEvent(t)),this.receiveBuffer=[],this.sendBuffer.forEach(t=>{this.notifyOutgoingListeners(t),this.packet(t)}),this.sendBuffer=[]}ondisconnect(){this.destroy(),this.onclose("io server disconnect")}destroy(){this.subs&&(this.subs.forEach(t=>t()),this.subs=void 0),this.io._destroy(this)}disconnect(){return this.connected&&this.packet({type:vn.DISCONNECT}),this.destroy(),this.connected&&this.onclose("io client disconnect"),this}close(){return this.disconnect()}compress(t){return this.flags.compress=t,this}get volatile(){return this.flags.volatile=!0,this}timeout(t){return this.flags.timeout=t,this}onAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.push(t),this}prependAny(t){return this._anyListeners=this._anyListeners||[],this._anyListeners.unshift(t),this}offAny(t){if(!this._anyListeners)return this;if(t){const r=this._anyListeners;for(let n=0;n<r.length;n++)if(t===r[n])return r.splice(n,1),this}else this._anyListeners=[];return this}listenersAny(){return this._anyListeners||[]}onAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.push(t),this}prependAnyOutgoing(t){return this._anyOutgoingListeners=this._anyOutgoingListeners||[],this._anyOutgoingListeners.unshift(t),this}offAnyOutgoing(t){if(!this._anyOutgoingListeners)return this;if(t){const r=this._anyOutgoingListeners;for(let n=0;n<r.length;n++)if(t===r[n])return r.splice(n,1),this}else this._anyOutgoingListeners=[];return this}listenersAnyOutgoing(){return this._anyOutgoingListeners||[]}notifyOutgoingListeners(t){if(this._anyOutgoingListeners&&this._anyOutgoingListeners.length){const r=this._anyOutgoingListeners.slice();for(const n of r)n.apply(this,t.data)}}}function yp(e){e=e||{},this.ms=e.min||100,this.max=e.max||1e4,this.factor=e.factor||2,this.jitter=e.jitter>0&&e.jitter<=1?e.jitter:0,this.attempts=0}yp.prototype.duration=function(){var e=this.ms*Math.pow(this.factor,this.attempts++);if(this.jitter){var t=Math.random(),r=Math.floor(t*this.jitter*e);e=Math.floor(t*10)&1?e+r:e-r}return Math.min(e,this.max)|0};yp.prototype.reset=function(){this.attempts=0};yp.prototype.setMin=function(e){this.ms=e};yp.prototype.setMax=function(e){this.max=e};yp.prototype.setJitter=function(e){this.jitter=e};class i0 extends Pa{constructor(t,r){var n;super(),this.nsps={},this.subs=[],t&&typeof t=="object"&&(r=t,t=void 0),r=r||{},r.path=r.path||"/socket.io",this.opts=r,eb(this,r),this.reconnection(r.reconnection!==!1),this.reconnectionAttempts(r.reconnectionAttempts||1/0),this.reconnectionDelay(r.reconnectionDelay||1e3),this.reconnectionDelayMax(r.reconnectionDelayMax||5e3),this.randomizationFactor((n=r.randomizationFactor)!==null&&n!==void 0?n:.5),this.backoff=new yp({min:this.reconnectionDelay(),max:this.reconnectionDelayMax(),jitter:this.randomizationFactor()}),this.timeout(r.timeout==null?2e4:r.timeout),this._readyState="closed",this.uri=t;const s=r.parser||gF;this.encoder=new s.Encoder,this.decoder=new s.Decoder,this._autoConnect=r.autoConnect!==!1,this._autoConnect&&this.open()}reconnection(t){return arguments.length?(this._reconnection=!!t,t||(this.skipReconnect=!0),this):this._reconnection}reconnectionAttempts(t){return t===void 0?this._reconnectionAttempts:(this._reconnectionAttempts=t,this)}reconnectionDelay(t){var r;return t===void 0?this._reconnectionDelay:(this._reconnectionDelay=t,(r=this.backoff)===null||r===void 0||r.setMin(t),this)}randomizationFactor(t){var r;return t===void 0?this._randomizationFactor:(this._randomizationFactor=t,(r=this.backoff)===null||r===void 0||r.setJitter(t),this)}reconnectionDelayMax(t){var r;return t===void 0?this._reconnectionDelayMax:(this._reconnectionDelayMax=t,(r=this.backoff)===null||r===void 0||r.setMax(t),this)}timeout(t){return arguments.length?(this._timeout=t,this):this._timeout}maybeReconnectOnOpen(){!this._reconnecting&&this._reconnection&&this.backoff.attempts===0&&this.reconnect()}open(t){if(~this._readyState.indexOf("open"))return this;this.engine=new aF(this.uri,this.opts);const r=this.engine,n=this;this._readyState="opening",this.skipReconnect=!1;const s=Io(r,"open",function(){n.onopen(),t&&t()}),o=c=>{this.cleanup(),this._readyState="closed",this.emitReserved("error",c),t?t(c):this.maybeReconnectOnOpen()},i=Io(r,"error",o);if(this._timeout!==!1){const c=this._timeout,u=this.setTimeoutFn(()=>{s(),o(new Error("timeout")),r.close()},c);this.opts.autoUnref&&u.unref(),this.subs.push(()=>{this.clearTimeoutFn(u)})}return this.subs.push(s),this.subs.push(i),this}connect(t){return this.open(t)}onopen(){this.cleanup(),this._readyState="open",this.emitReserved("open");const t=this.engine;this.subs.push(Io(t,"ping",this.onping.bind(this)),Io(t,"data",this.ondata.bind(this)),Io(t,"error",this.onerror.bind(this)),Io(t,"close",this.onclose.bind(this)),Io(this.decoder,"decoded",this.ondecoded.bind(this)))}onping(){this.emitReserved("ping")}ondata(t){try{this.decoder.add(t)}catch(r){this.onclose("parse error",r)}}ondecoded(t){$y(()=>{this.emitReserved("packet",t)},this.setTimeoutFn)}onerror(t){this.emitReserved("error",t)}socket(t,r){let n=this.nsps[t];return n?this._autoConnect&&!n.active&&n.connect():(n=new zj(this,t,r),this.nsps[t]=n),n}_destroy(t){const r=Object.keys(this.nsps);for(const n of r)if(this.nsps[n].active)return;this._close()}_packet(t){const r=this.encoder.encode(t);for(let n=0;n<r.length;n++)this.engine.write(r[n],t.options)}cleanup(){this.subs.forEach(t=>t()),this.subs.length=0,this.decoder.destroy()}_close(){this.skipReconnect=!0,this._reconnecting=!1,this.onclose("forced close")}disconnect(){return this._close()}onclose(t,r){var n;this.cleanup(),(n=this.engine)===null||n===void 0||n.close(),this.backoff.reset(),this._readyState="closed",this.emitReserved("close",t,r),this._reconnection&&!this.skipReconnect&&this.reconnect()}reconnect(){if(this._reconnecting||this.skipReconnect)return this;const t=this;if(this.backoff.attempts>=this._reconnectionAttempts)this.backoff.reset(),this.emitReserved("reconnect_failed"),this._reconnecting=!1;else{const r=this.backoff.duration();this._reconnecting=!0;const n=this.setTimeoutFn(()=>{t.skipReconnect||(this.emitReserved("reconnect_attempt",t.backoff.attempts),!t.skipReconnect&&t.open(s=>{s?(t._reconnecting=!1,t.reconnect(),this.emitReserved("reconnect_error",s)):t.onreconnect()}))},r);this.opts.autoUnref&&n.unref(),this.subs.push(()=>{this.clearTimeoutFn(n)})}}onreconnect(){const t=this.backoff.attempts;this._reconnecting=!1,this.backoff.reset(),this.emitReserved("reconnect",t)}}const Op={};function xf(e,t){typeof e=="object"&&(t=e,e=void 0),t=t||{};const r=sF(e,t.path||"/socket.io"),n=r.source,s=r.id,o=r.path,i=Op[s]&&o in Op[s].nsps,c=t.forceNew||t["force new connection"]||t.multiplex===!1||i;let u;return c?u=new i0(n,t):(Op[s]||(Op[s]=new i0(n,t)),u=Op[s]),r.query&&!t.query&&(t.query=r.queryKey),u.socket(r.path,t)}Object.assign(xf,{Manager:i0,Socket:zj,io:xf,connect:xf});function Hc(e,t){try{if(!e){console.debug("[socket] disconnect skipped (no socket)",{tag:t});return}const r={tag:t,id:e.id,connected:e.connected,active:e.active};console.debug("[socket] disconnect invoked",r),e.disconnect()}catch(r){try{console.warn("[socket] disconnect error",{tag:t,err:r})}catch{}}}function Bj(e,t){var r;try{if(!e){console.debug("[socket] close skipped (no socket)",{tag:t});return}console.debug("[socket] close invoked",{tag:t,id:e.id}),(r=e.close)==null||r.call(e)}catch(n){try{console.warn("[socket] close error",{tag:t,err:n})}catch{}}}const Fj=l.createContext(void 0),bF=({children:e})=>{const[t,r]=l.useState(!0),[n,s]=l.useState(0),o=l.useCallback(()=>r(!0),[]),i=l.useCallback(()=>s(d=>d+1),[]),c=l.useCallback(()=>s(0),[]),u=l.useCallback(d=>{r(!1),setTimeout(()=>r(!0),d)},[]),p=l.useCallback(()=>r(!1),[]);return l.useEffect(()=>{if(typeof window>"u"||!(typeof window.location<"u"&&window.location.search.includes("e2e=1")))return;const f={triggerSpin:i,scheduleReveal:u,resetReveal:p,resetSpin:c};try{window.__diceRevealTest=f}catch{}return()=>{try{delete window.__diceRevealTest}catch{}}},[i,u,p,c]),a.jsx(Fj.Provider,{value:{reveal:t,triggerReveal:o,scheduleReveal:u,resetReveal:p,triggerSpin:i,rollTrigger:n,resetSpin:c},children:e})},Ti=()=>{const e=l.useContext(Fj);if(!e)throw new Error("useDiceReveal must be used within a DiceRevealProvider");return e},rv={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"ceelo",VITE_OTA:"1",VITE_OTA_MANIFEST_URL:"https://cdn.dicelounge.app/ota/manifest.json"},Gf=500,Uj=new Array(Gf);let Af=0,Wg=0;const vx="fe:crashlog",vF=80;function qj(){try{const e=Xf().slice(-vF).map(t=>{var r;return{t:t.t,level:t.level,tag:t.tag,msg:t.msg,...t.data!==void 0?{data:typeof t.data=="string"?t.data:(r=JSON.stringify(t.data))==null?void 0:r.slice(0,200)}:{}}});localStorage.setItem(vx,JSON.stringify(e))}catch{}}function _x(){try{const e=localStorage.getItem(vx);return e?JSON.parse(e):[]}catch{return[]}}function _F(){try{localStorage.removeItem(vx)}catch{}}let nv=null;function wF(){nv||(nv=setTimeout(()=>{nv=null,qj()},2e3))}function xF(){var e;try{if(typeof window<"u"&&((e=window.localStorage)==null?void 0:e.getItem("logs:disable"))==="1"||typeof import.meta<"u"&&(rv==null?void 0:rv.VITE_LOGS_DISABLED)==="1")return!1}catch{}return!0}function AF(e){Uj[Af]=e,Af=(Af+1)%Gf,Wg=Math.min(Wg+1,Gf);try{window.dispatchEvent(new CustomEvent("fe:log",{detail:e}))}catch{}e.level==="error"||e.level==="warn"?qj():wF()}function Xf(){const e=[],t=Wg;for(let r=0;r<t;r++){const n=(Af-t+r+Gf)%Gf,s=Uj[n];s&&e.push(s)}return e}function kF(){Af=0,Wg=0}function Ca(e,t,r,n){const s={t:Date.now(),tag:e,level:t,msg:r,data:n};if(xF()){const o=`[${new Date(s.t).toISOString()}][${e}/${t}]`;try{const i=n===void 0?[]:[n];t==="error"?console.error(o,r,...i):t==="warn"?console.warn(o,r,...i):t==="debug"?console.debug(o,r,...i):console.log(o,r,...i)}catch{}AF(s)}}const Ar={debug:(e,t)=>Ca("RTC","debug",e,t),info:(e,t)=>Ca("RTC","info",e,t),warn:(e,t)=>Ca("RTC","warn",e,t),error:(e,t)=>Ca("RTC","error",e,t)},La={debug:(e,t)=>Ca("LIFE","debug",e,t),info:(e,t)=>Ca("LIFE","info",e,t),warn:(e,t)=>Ca("LIFE","warn",e,t),error:(e,t)=>Ca("LIFE","error",e,t)},io={debug:(e,t)=>Ca("SOCK","debug",e,t),info:(e,t)=>Ca("SOCK","info",e,t),warn:(e,t)=>Ca("SOCK","warn",e,t),error:(e,t)=>Ca("SOCK","error",e,t)},Ws={debug:(e,t)=>Ca("GL","debug",e,t),info:(e,t)=>Ca("GL","info",e,t),warn:(e,t)=>Ca("GL","warn",e,t),error:(e,t)=>Ca("GL","error",e,t)},l0={debug:(e,t)=>Ca("ERR","debug",e,t),info:(e,t)=>Ca("ERR","info",e,t),warn:(e,t)=>Ca("ERR","warn",e,t),error:(e,t)=>Ca("ERR","error",e,t)};try{window.rtcLogs=Xf,window.rtcLogsClear=kF,window.feLogs=Xf,window.feCrashLogs=_x}catch{}const wx=l.createContext(null);let Da=null,_S="",nf=0,th=0;const wS=1200;let xx=!1,rh=0;const Vj=2e3;function is(e,t,r){var o,i,c,u;if(!e||e.connected||e.active)return!1;let n="";try{n=String(((o=e.auth)==null?void 0:o.token)||((u=(c=(i=e==null?void 0:e.io)==null?void 0:i.opts)==null?void 0:c.auth)==null?void 0:u.token)||"")}catch{n=""}if(!n&&!(r!=null&&r.allowCookieSession))return io.debug("safeSocketConnect SKIPPED - no auth token",{source:t}),!1;if(xx)return io.warn("safeSocketConnect SKIPPED - session superseded",{source:t}),console.log("[safeSocketConnect] SKIPPED - session superseded",{source:t}),!1;const s=Date.now();if(s<rh)return io.debug("safeSocketConnect SKIPPED - debounce",{source:t,msRemaining:rh-s}),console.log("[safeSocketConnect] SKIPPED - connect already in progress",{source:t,msRemaining:rh-s}),!1;rh=s+Vj,io.info("safeSocketConnect calling connect()",{source:t,socketId:e.id}),console.log("[safeSocketConnect] calling socket.connect()",{source:t,socketId:e.id});try{e.connect()}catch{}return!0}function SF(){xx=!1}function Hj(){xx=!0,console.log("[SocketContext] Session superseded by another device/tab - auto-reconnect disabled")}function Ax(e=2e3){try{nf=Date.now()+Math.max(0,e|0)}catch{}}function bp(){return Da}function EF(e=2e3){try{Ax(e)}catch{}try{Da==null||Da.removeAllListeners()}catch{}try{Hc(Da,"SocketContext: hardDisconnectSocket")}catch{}}function PF(){const e=Da;if(e){try{e.auth={}}catch{}try{e.__authSig=""}catch{}try{Hc(e,"SocketContext: logout refresh")}catch{}}}function CF(e){const t=(()=>{var c;try{return typeof window<"u"&&/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})(),r=(()=>{try{return typeof window<"u"?window.location.search:""}catch{return""}})(),s=/(?:[?&])wsOnly=1/.test(r)||(()=>{try{return localStorage.getItem("socket:wsOnly")==="1"}catch{return!1}})()?["websocket"]:["websocket","polling"],o=window.APP_TARGET||"ceelo",i=xf(e,{path:"/socket.io",withCredentials:!0,transports:s,upgrade:s.length>1,timeout:25e3,autoConnect:!1,extraHeaders:t?{Origin:e}:void 0,auth:{appTarget:o}});return i.on("connect_error",c=>{try{i.__lastConnectErr={ts:Date.now(),reason:(c==null?void 0:c.message)||""}}catch{}}),i}function RF(e){var t;if(Da&&_S===e)return Da;if(Da){try{Da.removeAllListeners()}catch{}try{Bj(Da,"SocketContext: getSharedSocket replace")}catch{}Da=null}Da=CF(e),_S=e;try{if(typeof window<"u"){(((t=window.location)==null?void 0:t.search)||"").includes("e2e=1")&&(window.__SOCKET=Da,window.__sharedSocket=Da,window.hardDisconnectSocket=EF,window.suspendSocketAutoConnect=Ax);try{if(!window.__clientErrMon){window.__clientErrMon=!0;const n=o=>{try{const i=window.__sharedSocket||Da;if(!i)return;i.connected?i.emit("client_error",o):(i.__pendingClientErrors=i.__pendingClientErrors||[],i.__pendingClientErrors.push(o))}catch{}},s=()=>{let o="web";try{const i=navigator.userAgent||"";/iPhone|iPad|iPod/i.test(i)?o="ios":/Android/i.test(i)?o="android":o="web"}catch{}return{platform:o,userAgent:typeof navigator<"u"?navigator.userAgent:"",ts:Date.now()}};window.addEventListener("error",o=>{var i,c,u;try{if(!o.error&&!o.message)return;const p=o.message||"";if(p.includes("websocket error")||p.includes("WebSocket"))return;n({message:p||"error",stack:(u=(c=(i=o.error)==null?void 0:i.stack)==null?void 0:c.slice)==null?void 0:u.call(c,0,5e3),filename:o.filename,line:o.lineno,col:o.colno,...s()})}catch{}}),window.addEventListener("unhandledrejection",o=>{var i,c,u,p,d;try{const f=o.reason,m=typeof f=="string"?f:(f==null?void 0:f.message)||"unhandledrejection";if((f==null?void 0:f.name)==="AbortError"||(i=m==null?void 0:m.includes)!=null&&i.call(m,"aborted")||(c=m==null?void 0:m.includes)!=null&&c.call(m,"The operation was aborted"))return;n({message:((u=m==null?void 0:m.slice)==null?void 0:u.call(m,0,500))||"unhandledrejection",stack:(d=(p=(f==null?void 0:f.stack)||"").slice)==null?void 0:d.call(p,0,5e3),...s()})}catch{}}),Da.on("connect",()=>{try{const o=Da,i=o==null?void 0:o.__pendingClientErrors;Array.isArray(i)&&i.length&&i.splice(0,i.length).forEach(u=>{try{o.emit("client_error",u)}catch{}})}catch{}})}}catch{}}}catch{}return Da}function TF({children:e}){const{user:t,initialized:r}=Zr(),n=za(),s=l.useMemo(()=>RF(n),[n]),{resetSpin:o}=Ti();return l.useEffect(()=>{if(!r)return;let i=!1;return(async()=>{const c=d=>{try{s.__authSig=d}catch{}},u=()=>{try{return String(s.__authSig||"")}catch{return""}},p=d=>{var h;const f=Math.max(0,nf-Date.now());if(f<=0)return d();const m=setTimeout(()=>{i||d()},f);(h=m.unref)==null||h.call(m)};if(t){const d=await Jn();if(i)return;if(d){const f=u(),m=`t:${d}`;s.auth={token:d};try{s.__allowCookieAuth=!1}catch{}if(c(m),s.disconnected)p(()=>{i||(is(s,"SocketContext:auth-token-connect"),o())});else if(f!==m){const h=Date.now();h-th>=wS&&(th=h,p(()=>{if(!i){try{Hc(s,"SocketContext: auth change soft reconnect")}catch{}setTimeout(()=>{i||(is(s,"SocketContext:auth-change-reconnect"),o())},100)}}))}}else{const f=u(),m="c:*";try{s.auth={}}catch{}try{s.__allowCookieAuth=!0}catch{}if(c(m),s.disconnected)p(()=>{i||(is(s,"SocketContext:cookie-session-connect",{allowCookieSession:!0}),o())});else if(f!==m){const h=Date.now();h-th>=wS&&(th=h,p(()=>{if(!i){try{Hc(s,"SocketContext: cookie auth soft reconnect")}catch{}setTimeout(()=>{i||(is(s,"SocketContext:cookie-auth-reconnect",{allowCookieSession:!0}),o())},100)}}))}}}else try{s.__allowCookieAuth=!1}catch{}})(),()=>{i=!0}},[r,t,s]),l.useEffect(()=>{const i=async()=>{if(Date.now()<nf)return;const c=await Jn();if(!c){if(t){try{s.auth={},s.__authSig="c:*",s.__allowCookieAuth=!0}catch{}o();return}try{s.auth={},s.__authSig="",s.__allowCookieAuth=!1}catch{}try{s.disconnected||Hc(s,"SocketContext: skip reconnect without token")}catch{}return}s.auth={token:c};try{s.__authSig=`t:${c}`,s.__allowCookieAuth=!1}catch{}o()};return s.on("reconnect_attempt",i),()=>{s.off("reconnect_attempt",i)}},[s,o,t]),l.useEffect(()=>{let i=!1,c=null;const u=async p=>{if(String((p==null?void 0:p.message)||"")==="INVALID_TOKEN"){try{s.disconnect()}catch{}try{await Ql()}catch{}if(!i){try{s.auth={},s.__authSig="c:*",s.__allowCookieAuth=!!t}catch{}t&&(c=setTimeout(()=>{i||is(s,"SocketContext:invalid-token-cookie-fallback",{allowCookieSession:!0})},Vj+100))}}};return s.on("connect_error",u),()=>{i=!0,c&&clearTimeout(c),s.off("connect_error",u)}},[s,t]),l.useEffect(()=>{const i=async c=>{try{await Jc(c)}catch{}s.auth=c?{token:c}:{};try{s.__authSig=c?`t:${c}`:""}catch{}};return s.on("auth:rotate",i),()=>{s.off("auth:rotate",i)}},[s]),l.useEffect(()=>{let i=!1;const c=async()=>{if(!i&&!(Date.now()<nf)&&s.disconnected){try{const m=await Jn();if(i)return;if(m){s.auth={token:m};try{s.__authSig=`t:${m}`,s.__allowCookieAuth=!1}catch{}}else{if(!t)return;try{s.auth={},s.__authSig="c:*",s.__allowCookieAuth=!0}catch{}}}catch{}if(s.disconnected){const m=!!(s!=null&&s.__allowCookieAuth);is(s,"SocketContext:refreshAuthAndConnect",{allowCookieSession:m}),o()}}},u=()=>{try{document.visibilityState==="visible"&&c()}catch{}},p=()=>c(),d=()=>c(),f=()=>c();return window.addEventListener("visibilitychange",u),window.addEventListener("focus",p),window.addEventListener("pageshow",d),window.addEventListener("online",f),()=>{i=!0,window.removeEventListener("visibilitychange",u),window.removeEventListener("focus",p),window.removeEventListener("pageshow",d),window.removeEventListener("online",f)}},[s,o,t]),l.useEffect(()=>{const i=()=>{try{s.removeAllListeners()}catch{}try{Bj(s,"SocketContext: beforeunload")}catch{}};return window.addEventListener("beforeunload",i),()=>{window.removeEventListener("beforeunload",i)}},[s]),l.useEffect(()=>{let i=!1;const c=5e3,u=15e3,p=2e3;let d=!1;const m=setInterval(()=>{var x;if(i)return;try{if(document.visibilityState==="hidden")return}catch{}if(Date.now()<nf||!s||d)return;const h=s.connected,b=(x=s==null?void 0:s.data)==null?void 0:x.lastAckAt;if(!h){try{const v=!!(s!=null&&s.__allowCookieAuth);is(s,"SocketContext:health-poll-disconnected",{allowCookieSession:v})}catch{}return}if(b&&Date.now()-b<u)return;d=!0;let g=!1;const y=setTimeout(()=>{if(!g){g=!0,d=!1;try{s.disconnect()}catch{}setTimeout(()=>{if(!i)try{const v=!!(s!=null&&s.__allowCookieAuth);is(s,"SocketContext:health-poll-timeout-reconnect",{allowCookieSession:v})}catch{}},100)}},p);try{s.emit("health:ping",{},v=>{if(!g){g=!0,clearTimeout(y),d=!1;try{s.data=s.data||{},s.data.lastAckAt=Date.now(),s.data.lastAckEvent="health:ping"}catch{}try{if(v&&typeof v.ts=="number"){const A=Date.now()-v.ts;s.__lastRttMs=A}v&&typeof v.lagMs=="number"&&(s.__lastServerLagMs=v.lagMs)}catch{}}})}catch{d=!1}},c);return()=>{i=!0,clearInterval(m)}},[s]),a.jsx(wx.Provider,{value:s,children:e})}function Na(){const e=l.useContext(wx);if(!e)throw new Error("useSocket must be used within a SocketProvider");return e}const Wj=l.createContext({user:null,loading:!0,initialized:!1,refreshUser:async()=>{},logout:async()=>{},meId:"",updateBalance:()=>{}}),Zr=()=>l.useContext(Wj);function jF(e){if(!e)return null;if(typeof e=="object"&&"authenticated"in e){const t=e;return t.authenticated?t.user??null:null}return e}const IF=({children:e})=>{const[t,r]=l.useState(null),[n,s]=l.useState(""),[o,i]=l.useState(!0),[c,u]=l.useState(!1),p=Ia(),d=l.useRef(null),f=l.useRef(!0);l.useEffect(()=>(f.current=!0,()=>{f.current=!1}),[]);const m=l.useCallback(async y=>{var w;if(d.current){if(!(y!=null&&y.force))return d.current;try{await d.current}catch{}}const x=new URLSearchParams(p.search);if((()=>{var j,T;try{if(x.get("e2e")==="1"||typeof window<"u"&&(window.__E2E===!0||(T=(j=window.location)==null?void 0:j.search)!=null&&T.includes("e2e=1")||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1"))return!0}catch{}return!1})()){let j=1e3;try{const T=(w=window.sessionStorage)==null?void 0:w.getItem("e2e_balance"),R=T?Number(T):NaN;Number.isFinite(R)&&(j=R)}catch{}r({id:"e2e-user",name:"E2E",email:"e2e@example.com",balance:j,botChatDisabled:!1,ceeloBotsPerRoom:null,crapsBotsPerRoom:null,pokerBotsPerRoom:null}),s("e2e-user"),i(!1),u(!0);return}const A=async()=>{r(null),s("");try{Jb(null)}catch{}};i(!0);const _=(async()=>{try{const j=await Jy(),T=jF(j);if(T){SF(),r(T),s((T==null?void 0:T.id)||"");try{Jb(T.id||null)}catch{}}else await A()}catch{if(!f.current)return;await A()}finally{i(!1),u(!0),d.current=null}})();return d.current=_,_},[]);l.useEffect(()=>{m()},[m]);const h=l.useCallback(y=>{f.current&&r(x=>!x||x.balance===y?x:{...x,balance:y})},[]),b=l.useCallback(async()=>{const y=t==null?void 0:t.email;try{try{Ax(2500)}catch{}y&&await kj(y);try{await fetch("/api/auth/clear",{method:"POST",credentials:"include"})}catch{}}finally{if(!f.current)return;try{await Ql()}catch{}try{await k6()}catch{}r(null),s("");try{Jb(null)}catch{}try{PF()}catch{}try{(await Cr(()=>Promise.resolve().then(()=>FAe),void 0,import.meta.url)).disconnectSocket()}catch{}}},[t==null?void 0:t.email]),g=l.useMemo(()=>({user:t,loading:o,initialized:c,refreshUser:m,logout:b,meId:n,updateBalance:h}),[t,o,c,m,b,n,h]);return a.jsx(Wj.Provider,{value:g,children:e})},NF=(()=>{var e,t;try{return(t=(e=import.meta)==null?void 0:e.env)==null?void 0:t.VITE_APP_TARGET}catch{return}})();function MF(){var e;try{const t=(e=window.localStorage)==null?void 0:e.getItem("app_target_lock");if(t==="ceelo"||t==="craps"||t==="poker"||t==="skills"||t==="zentara"||t==="unified")return t}catch{}}function LF(e){var t;try{(t=window.localStorage)==null||t.setItem("app_target_lock",e)}catch{}}const xS=(()=>{try{return zr.getPlatform()}catch{return"web"}})(),Gj=MF()??NF??Oa;(xS==="ios"||xS==="android")&&LF(Gj);const kx=Gj,Cd=kx==="zentara";function DF(){return kx}if(typeof document<"u"){const t={zentara:"zentara-body"}[kx];if(t){const r=()=>{var n;(n=document.body)==null||n.classList.add(t)};document.body?r():document.addEventListener("DOMContentLoaded",r,{once:!0})}}function Ja({className:e}){return l.useEffect(()=>(document.body.classList.add(e),()=>{document.body.classList.remove(e),window.scrollTo(0,0),document.body.scrollTop=0,document.documentElement.scrollTop=0}),[e]),null}function uu(){const{user:e,loading:t,initialized:r}=Zr(),n=Ia(),o=new URLSearchParams(n.search).get("e2e")==="1",i=n.pathname||"",c=/^\/poker\/room\//.test(i),u=/^\/room\//.test(i),p=/^\/(lobby|zentara\/)/.test(i);return!r||t?a.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[a.jsx(Ja,{className:"page-home-screen"}),a.jsx("div",{className:"home-preloader",children:a.jsx("div",{className:"home-preloader__spinner"})})]}):!e&&!o&&!(c||u||p)?a.jsx(qn,{to:"/lobby",replace:!0,state:{from:n}}):a.jsx(mj,{})}function du(){return a.jsxs("div",{style:{padding:24},children:[a.jsx("h2",{children:"Verification failed"}),a.jsx("p",{children:"Your login link is invalid or expired. Please request a new one."})]})}const Xj=l.createContext(null);function OF({children:e}){const[t,r]=l.useState([]),n=l.useRef({}),s=l.useCallback(d=>{r(m=>m.filter(h=>h.id!==d));const f=n.current[d];f&&(window.clearTimeout(f),delete n.current[d])},[]),o=l.useCallback(d=>{const f=crypto.randomUUID(),m={id:f,duration:3500,...d};r(b=>[...b,m]);const h=m.duration??3500;return h>0&&(n.current[f]=window.setTimeout(()=>s(f),h)),f},[s]),i=l.useCallback((d,f={})=>o({message:d,variant:"success",...f}),[o]),c=l.useCallback((d,f={})=>o({message:d,variant:"error",...f}),[o]),u=l.useCallback((d,f={})=>o({message:d,variant:"info",...f}),[o]),p=l.useMemo(()=>({show:o,success:i,error:c,info:u,dismiss:s}),[o,i,c,u,s]);return a.jsxs(Xj.Provider,{value:p,children:[e,ws.createPortal(a.jsx("div",{className:"toast-root","aria-live":"polite","aria-atomic":"true",children:t.map(d=>a.jsxs("div",{className:`toast-item toast-${d.variant}`,role:"status",onClick:()=>s(d.id),children:[d.title&&a.jsx("div",{className:"toast-title",children:d.title}),d.message&&a.jsx("div",{className:"toast-message",children:d.message}),a.jsx("button",{className:"toast-close","aria-label":"Dismiss",onClick:f=>{f.stopPropagation(),s(d.id)},children:"×"})]},d.id))}),document.body)]})}function ji(){const e=l.useContext(Xj);if(!e){const t=()=>"noop";return{show:()=>"noop",success:t,error:t,info:t,dismiss:()=>{}}}return e}const Yj={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(Yj);const tr=new Proxy(Yj,{set(){throw new TypeError("SocketEvents is read-only")},defineProperty(){throw new TypeError("SocketEvents is read-only")},deleteProperty(){throw new TypeError("SocketEvents is read-only")}}),zF="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=",AS=""+new URL("flash-1UjQ_pjl.m4a",import.meta.url).href,kS=""+new URL("swoosh-DWLYYP2o.m4a",import.meta.url).href,Zj=""+new URL("dice_whirr_merged-kYY8GDzo.m4a",import.meta.url).href,BF=""+new URL("loss-MbFJ6Xyb.m4a",import.meta.url).href,FF=""+new URL("winner-C_feQyA8.m4a",import.meta.url).href,UF=""+new URL("win-BofsSXdy.m4a",import.meta.url).href,qF=""+new URL("ante_up-BNJNkzdg.m4a",import.meta.url).href,VF=""+new URL("push-D8ciTeGD.m4a",import.meta.url).href,HF=""+new URL("your_turn-r-y-lDUH.m4a",import.meta.url).href,WF=""+new URL("point_set-BYYb2H7O.m4a",import.meta.url).href,GF=""+new URL("place_hit-B397CGff.m4a",import.meta.url).href,XF=""+new URL("yes-D6HNwLBK.m4a",import.meta.url).href,YF=""+new URL("smashing-CDhgl1WN.m4a",import.meta.url).href,ZF=""+new URL("love_you-ClILzZiq.m4a",import.meta.url).href,KF=""+new URL("gangster-BuThOTHu.m4a",import.meta.url).href,QF=""+new URL("skills_win-B9044Qtf.m4a",import.meta.url).href,JF=""+new URL("skills_lose-C2hT1pjV.m4a",import.meta.url).href,Kj=""+new URL("skills_lobby-Wq3LgbVY.m4a",import.meta.url).href,$F=""+new URL("zentara_theme-CMLmkTk1.m4a",import.meta.url).href,e8=""+new URL("zentara_explosion1-CjEhUDBF.mp3",import.meta.url).href,t8=""+new URL("zentara_explosion2-C8nIQN_s.mp3",import.meta.url).href,r8=""+new URL("zentara_explosion3-BTB3rcDN.mp3",import.meta.url).href,n8=""+new URL("zentara_fanfare-BovxnerY.mp3",import.meta.url).href,a8="data:audio/mpeg;base64, ",s8=""+new URL("zentara_laser_burst-BEbiHJjZ.mp3",import.meta.url).href,o8=""+new URL("zentara_scan-DPmtrIPS.mp3",import.meta.url).href,i8=""+new URL("zentara_move-B9jZ_pmx.mp3",import.meta.url).href,pu=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),Ki=typeof window<"u"?window.Capacitor:void 0,tb=!!Ki&&typeof Ki.isNativePlatform=="function"&&Ki.isNativePlatform();var HT;const mn=Ki&&(((HT=Ki.Plugins)==null?void 0:HT.NativeAudio)||Ki.NativeAudio)||void 0,Jl=tb&&!!mn,Jd=tb&&pu,l8=tb&&!pu;let $a=!1,xs=!0,Yf=null;const Sx=500;function c8(){return!!xs}function SS(e){if(xs=!!e,!xs)try{Zg(),Jf()}catch{}}const u8=["vYes","vSmashing","vLove","vGangster"],bs={click:zF,flash:AS,chip:kS,win:FF,winDing:UF,lose:BF,push:VF,cardSwoosh:kS,placeBets:qF,yourTurn:HF,vYes:XF,vSmashing:YF,vLove:ZF,vGangster:KF,pointSet:WF,placeHit:GF,betPlaced:AS,skillsWin:QF,skillsLose:JF,skillsLobby:Kj,zentaraExplosion1:e8,zentaraExplosion2:t8,zentaraExplosion3:r8,zentaraFanfare:n8,zentaraLaser:a8,zentaraLaserBurst:s8,zentaraScan:o8,zentaraFuture:i8},ES=["flash","win","winDing","lose","push","chip","cardSwoosh","placeBets","yourTurn","pointSet","vYes","vSmashing","vLove","vGangster","placeHit"],d8=3,p8=4,Qj=4,Jj=6,f8=e=>e==="zentaraLaser"||e==="zentaraLaserBurst"?Jj:e.startsWith("zentaraExplosion")?Qj:1,$j=Jd?1:pu?2:8;let av=0,Ex=!1;function eI(){const e=performance.now();Ex=av>0&&e-av>50,av=e,requestAnimationFrame(eI)}typeof requestAnimationFrame<"u"&&requestAnimationFrame(eI);const tI={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},Gg={},nl={};let Bl=0,rI=0;const sv=new WeakMap;let ov=!1;const PS=[];function Zf(e){PS.push(e),!ov&&(ov=!0,requestAnimationFrame(()=>{ov=!1;const t=PS.splice(0);for(const r of t)r()}))}const Ys=new Set,iv=new Map,Kf=new Map;function Fl(e){const t=Date.now(),r=Kf.get(e)||{count:0,last:0};r.count=Math.min(5,r.count+1),r.last=t,Kf.set(e,r)}function rb(e){e?Kf.delete(e):Kf.clear()}function nb(e){const t=Kf.get(e);if(!t)return!0;const r=Date.now(),n=2e3*Math.min(3,t.count);return r-t.last>n}function m8(e){try{const t=String(e||"");if(!t)return null;if(/^https?:\/\//i.test(t))return{path:t,isUrl:!0};if(/^data:/i.test(t))return null;if(/^file:\/\//i.test(t))return{path:t,isUrl:!0};if(/^capacitor:\/\//i.test(t)){const n=new URL(t).pathname||"";return n.startsWith("/assets/")?{path:`public${n}`,isUrl:!1}:n.startsWith("/public/")?{path:n.replace(/^\//,""),isUrl:!1}:{path:t,isUrl:!0}}return t.startsWith("./assets/")?{path:`public/${t.slice(2)}`,isUrl:!1}:t.startsWith("assets/")?{path:`public/${t}`,isUrl:!1}:t.startsWith("/assets/")?{path:`public${t}`,isUrl:!1}:t.startsWith("public/")?{path:t,isUrl:!1}:t.startsWith("/public/")?{path:t.slice(1),isUrl:!1}:{path:`public/${t.replace(/^\.\//,"")}`,isUrl:!1}}catch{return null}}const Xg=new Map,CS=Jd?100:20;async function h8(e){if(!(mn!=null&&mn.getDuration))return!0;try{const t=await mn.getDuration({assetId:e});return t&&typeof t.duration=="number"&&t.duration>0}catch{return!1}}async function Qf(e,t){if(!Jl||!mn)throw new Error("Native audio not available");if(Ys.has(e))return;const r=iv.get(e);if(r){if(await r,!Ys.has(e))throw new Error("Asset preload failed");return}try{const n=m8(t);if(!n)throw Fl(e),new Error("Failed to resolve asset path");const s=(async()=>{await mn.preload({assetId:e,assetPath:n.path,audioChannelNum:f8(e)}),Ys.add(e),Xg.set(e,Date.now())})();iv.set(e,s),await s.finally(()=>{iv.delete(e)})}catch(n){throw Fl(e),n}}async function g8(e,t,r){if(!Jl||!mn)throw new Error("Native audio not available");if(!nb(e))throw new Error("Native audio cooldown active");try{if(await Qf(e,t),!Ys.has(e))throw new Error("Asset not loaded");const n=Xg.get(e)||0,s=Date.now()-n;if(s<CS&&await new Promise(o=>setTimeout(o,CS-s)),Jd&&!await h8(e)){try{await mn.unload({assetId:e})}catch{}throw Ys.delete(e),Xg.delete(e),new Error("Asset verification failed - native player not ready")}if((r==null?void 0:r.volume)!=null&&mn.setVolume)try{await mn.setVolume({assetId:e,volume:ps(r.volume,0,1)})}catch{}try{await mn.play({assetId:e})}catch{await new Promise(i=>setTimeout(i,30)),await mn.play({assetId:e})}r!=null&&r.durationMs&&r.durationMs>0&&window.setTimeout(()=>{try{mn.stop({assetId:e})}catch{}},Math.max(10,Math.floor(r.durationMs)))}catch(n){throw Fl(e),n}}function Px(e){const t=new Audio(bs[e]);t.preload="auto";try{t.playsInline=!0}catch{}try{t.setAttribute("playsinline",""),t.setAttribute("webkit-playsinline","")}catch{}try{t.muted=!1}catch{}try{t.volume=1}catch{}return t.addEventListener("ended",()=>bi(e,t)),t}function $l(e){let t=nl[e];if(!t){const r=nI(e);t={free:[],busy:new Set,size:0};for(let n=0;n<r;n++)t.free.push(Px(e)),t.size++;nl[e]=t}return t}function nI(e){return e==="flash"?p8:e==="zentaraLaser"||e==="zentaraLaserBurst"?Jj:e.startsWith("zentaraExplosion")?Qj:d8}function Cx(e){const t=nI(e),r=$l(e);if(r.free.length>0)return r.free.pop();if(r.size<t){const n=Px(e);return r.size++,n}return null}function bi(e,t){const r=nl[e];r&&r.busy.has(t)&&(r.busy.delete(t),r.free.push(t),Bl=Math.max(0,Bl-1))}function Rx(){Object.keys(tI).forEach(e=>delete Gg[e])}function y8(){try{Ys.clear(),Xg.clear(),rb()}catch{}}function ab(e,t=800){const r=sv.get(e);if(r)return r;const n=new Promise(s=>{try{if(e.readyState>=2){s(!0);return}let o=!1;const i=()=>{try{e.removeEventListener("canplaythrough",c)}catch{}try{e.removeEventListener("loadeddata",c)}catch{}try{e.removeEventListener("error",u)}catch{}},c=()=>{o||(o=!0,i(),s(!0))},u=()=>{o||(o=!0,i(),s(!1))};e.addEventListener("canplaythrough",c,{once:!0}),e.addEventListener("loadeddata",c,{once:!0}),e.addEventListener("error",u,{once:!0});try{e.load()}catch{}window.setTimeout(()=>{o||(o=!0,i(),s(e.readyState>=2))},Math.max(200,Math.min(4e3,t)))}catch{s(!1)}});return sv.set(e,n),n.finally(()=>{sv.delete(e)}),n}let nh=null,_a=null,Qi=null,Yg=!1;function Zg(){Object.keys(nl).forEach(e=>{const t=nl[e];t&&[...t.busy].forEach(r=>{try{r.pause(),r.currentTime=0}catch{}bi(e,r)})});try{nh&&(nh.pause(),nh.currentTime=0)}catch{}try{_a&&(_a.pause(),_a.currentTime=0)}catch{}nh=null,_a=null;try{}catch{}try{const e=Object.keys(bs);for(const t of e){const r=kl==null?void 0:kl[t];if(r){try{r.pause(),r.currentTime=0}catch{}kl[t]=null}Ji[t]&&(window.clearTimeout(Ji[t]),delete Ji[t])}if(Jl&&mn){for(const t of Object.keys(bs))if(Ys.has(t)){try{pd(mn.stop({assetId:t}))}catch{}try{mn.unload&&pd(mn.unload({assetId:t}))}catch{}try{Ys.delete(t)}catch{}}if(Ys.has("loop_dice_whirr")){try{pd(mn.stop({assetId:"loop_dice_whirr"}))}catch{}try{mn.unload&&pd(mn.unload({assetId:"loop_dice_whirr"}))}catch{}try{Ys.delete("loop_dice_whirr"),rb("loop_dice_whirr")}catch{}}Yg=!1}}catch{}Bl=0,Rx()}let aI=!1;function kf(e){aI=!!e}let RS=0;const b8=1500;async function v8(e,t){if(!xs||aI)return!1;const r=Date.now();if(r-RS<b8)return!1;if(RS=r,Jd&&mn&&nb(e))try{return(async()=>{try{if(await Qf(e,bs[e]),Ys.has(e)){if(mn.setVolume)try{await mn.setVolume({assetId:e,volume:ps(t,0,1)})}catch{}await mn.play({assetId:e})}}catch{Fl(e)}})(),!0}catch{Fl(e)}if(!$a||pu&&Ex)return!1;try{const n=Cx(e);if(!n){const o=new Audio(bs[e]);return o.volume=ga(e,t),o.play().catch(()=>{}),!0}return $l(e).busy.add(n),Bl++,n.currentTime=0,n.volume=ga(e,t),n.play().catch(()=>bi(e,n)),!0}catch{return!1}}const _8={3:"vGangster",4:"vLove",5:"vSmashing",6:"vYes",7:"vSmashing"};async function TS(e,t=.5){const r=_8[e>=7?7:e];return r?v8(r,t):!1}function sb(e,t){if(!xs||!$a||Bl>=$j)return;const r=Cx(e);if(!r)return;$l(e).busy.add(r),Bl++;try{r.currentTime=0,(t==null?void 0:t.volume)!=null&&(r.volume=ga(e,t.volume)),(t==null?void 0:t.rate)!=null&&(r.playbackRate=ps(t.rate,.25,4));const s=t!=null&&t.durationMs&&t.durationMs>0?window.setTimeout(()=>{try{r.pause(),r.currentTime=0}catch{}bi(e,r)},Math.max(10,Math.floor(t.durationMs))):null;Zf(()=>{r.play().catch(()=>{s&&window.clearTimeout(s),bi(e,r)})})}catch{bi(e,r)}}async function ja(e,t){if(!xs)return;const r=Date.now();if(r<rI||pu&&Ex&&e!=="win"&&e!=="lose"&&!(Jd&&(e==="zentaraLaser"||e==="zentaraLaserBurst")))return;const n=tI[e]??0;if(n>0){const i=Gg[e]??0;if(r-i<n)return}if(Gg[e]=r,Jd&&mn&&nb(e)){(async()=>{try{await g8(e,bs[e],{volume:t==null?void 0:t.volume,durationMs:t==null?void 0:t.durationMs})}catch{Fl(e)}})();return}if(!$a||Yf&&r-Yf<Sx)return;if(l8){sb(e,t);return}if(Bl>=$j)return;const s=Cx(e);if(!s)return;$l(e).busy.add(s),Bl++;try{s.currentTime=0,(t==null?void 0:t.volume)!=null&&(s.volume=ga(e,t.volume)),(t==null?void 0:t.rate)!=null&&(s.playbackRate=ps(t.rate,.25,4));const i=t!=null&&t.durationMs&&t.durationMs>0?window.setTimeout(()=>{try{s.pause(),s.currentTime=0}catch{}bi(e,s)},Math.max(10,Math.floor(t.durationMs))):null;if(!await ab(s,1e3)){Zf(()=>{s.play().catch(()=>{i&&window.clearTimeout(i),bi(e,s)})});return}Zf(()=>{s.play().catch(()=>{i&&window.clearTimeout(i),bi(e,s)})})}catch{bi(e,s)}}const ps=(e,t,r)=>Math.min(r,Math.max(t,e)),w8={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,zentaraLaser:.14,zentaraLaserBurst:.12,lobbyMusic:.03};function ga(e,t){const r=ps(t,0,1);if(pu){const n=w8[e];if(typeof n=="number")return ps(Math.max(r,n),0,1)}return r}function c0(){pu&&(Object.keys(nl).forEach(e=>{const t=e,r=nl[t];r&&r.free.forEach(n=>{try{n.pause(),n.src=bs[t],n.load()}catch{}})}),Rx())}function x8(){try{Zg()}catch{}try{Il()}catch{}try{Jf()}catch{}}function A8(){y8();try{c0()}catch{}Rx()}var WT;try{const e=Ki&&(((WT=Ki.Plugins)==null?void 0:WT.App)||Ki.App)||void 0;tb&&(e!=null&&e.addListener)&&e.addListener("appStateChange",t=>{!!(t&&t.isActive)?A8():x8()})}catch{}let Kg=null,Tc=!1,ld=0,sI=0;function lv(){return!Jl||Tc}function k8(){return{loaded:ld,total:sI}}async function S8(e=5e3){if(!Jl||Tc||!Kg)return!0;try{return await Promise.race([Kg,new Promise((t,r)=>setTimeout(()=>r(new Error("timeout")),e))]),!0}catch{return!1}}async function yn(){if(!$a){$a=!0,Yf=Date.now(),rI=Date.now()+Sx,Object.keys(bs).forEach(e=>{try{$l(e)}catch{}});try{$d()}catch{}try{if(Jl&&mn){const e=Object.keys(bs);sI=e.length,ld=0,Tc=!1,Kg=(async()=>{for(const r of ES)try{await Qf(r,bs[r]),ld++,await new Promise(n=>setTimeout(n,15))}catch{ld++}const t=e.filter(r=>!ES.includes(r));for(const r of t)try{await Qf(r,bs[r]),ld++,await new Promise(n=>setTimeout(n,15))}catch{ld++}Tc=!0})(),Kg.catch(()=>{Tc=!0})}else Tc=!0}catch{Tc=!0}}}function Tx(){return!!$a}function $d(e){const t=e&&e.length?e:Object.keys(bs);for(const r of t)$l(r).free.forEach(s=>{try{s.load()}catch{}})}async function Qg(e,t=800){const r=e&&e.length?e:Object.keys(bs),n=o=>new Promise(i=>{try{const u=$l(o).free[0]||Px(o);ab(u,t).then(i)}catch{i(!1)}});return(await Promise.all(r.map(n))).every(Boolean)}if(typeof document<"u"){const e=()=>{document.visibilityState==="hidden"?(Zg(),Il(),Jf()):c0()};document.addEventListener("visibilitychange",e),window.addEventListener("pagehide",()=>{Zg(),Il(),Jf()}),window.addEventListener("pageshow",()=>c0())}function gi(e){const r=ps((e==null?void 0:e.volume)??.01,0,1)*.5;ja("flash",{volume:ga("flash",r),rate:e==null?void 0:e.rate})}function E8(e){ja("chip",{volume:ga("chip",(e==null?void 0:e.volume)??.25),durationMs:(e==null?void 0:e.durationMs)??500,rate:e==null?void 0:e.playbackRate})}function P8(e){ja("cardSwoosh",{volume:ga("cardSwoosh",e==null?void 0:e.volume),rate:(e==null?void 0:e.playbackRate)??1})}function jx(e){ja("lose",{volume:ga("lose",(e==null?void 0:e.volume)??.1)})}function oI(e){ja("push",{volume:ga("push",(e==null?void 0:e.volume)??.1)})}function C8(e){const t=ps(e==null?void 0:e.volume,0,1),r=ga("win",t);ja("winDing",{volume:.025}),ja("win",{volume:ga("win",ps(r*.35,0,1))})}function u0(e){ja("winDing",{volume:ga("winDing",(e==null?void 0:e.volume)??.15),rate:e==null?void 0:e.rate})}function d0(e){ja("placeBets",{volume:ga("placeBets",(e==null?void 0:e.volume)??.65)})}function jS(e){ja("pointSet",{volume:ga("pointSet",(e==null?void 0:e.volume)??.15)})}function R8(e){ja("betPlaced",{volume:ga("betPlaced",e==null?void 0:e.volume)})}function p0(e){ja("skillsWin",{volume:ga("skillsWin",(e==null?void 0:e.volume)??.5)}),ja("win",{volume:ga("win",.35)})}function f0(e){ja("skillsLose",{volume:ga("skillsLose",(e==null?void 0:e.volume)??.4)})}let Wi=null,m0=!1;function ob(e){if(!(!xs||!$a)&&!(m0&&Wi))try{Wi||(Wi=new Audio(Kj),Wi.loop=!0),Wi.volume=ga("lobbyMusic",(e==null?void 0:e.volume)??.075),Wi.play().then(()=>{m0=!0}).catch(()=>{})}catch{}}function Il(){if(Wi)try{Wi.pause(),Wi.currentTime=0,m0=!1}catch{}}const T8=.72,j8={music:{defaultVolume:.1,trim:1},explosion:{defaultVolume:.24,trim:.9},fanfare:{defaultVolume:.2,trim:.45},laser:{defaultVolume:.26,trim:.62},scan:{defaultVolume:.18,trim:.78},move:{defaultVolume:.08,trim:.7}};function fu(e,t){const r=j8[e];return ps((t??r.defaultVolume)*r.trim*T8,0,1)}let Gi=null,h0=!1;function I8(e){if(!(!xs||!$a)&&!(h0&&Gi))try{Gi||(Gi=new Audio($F),Gi.loop=!0),Gi.volume=ga("lobbyMusic",fu("music",e==null?void 0:e.volume)),Gi.play().then(()=>{h0=!0}).catch(()=>{})}catch{}}function Jf(){if(Gi)try{Gi.pause(),Gi.currentTime=0,h0=!1}catch{}}const IS=["zentaraExplosion1","zentaraExplosion2","zentaraExplosion3"];let cv=0;function Xa(e){if(!xs||!$a)return;const t=IS[cv%IS.length];cv++,sb(t,{volume:fu("explosion",e==null?void 0:e.volume),rate:.96+cv%3*.035})}function NS(e){!xs||!$a||sb("zentaraFanfare",{volume:fu("fanfare",e==null?void 0:e.volume)})}function Lo(e){!xs||!$a||ja("zentaraLaser",{volume:fu("laser",e==null?void 0:e.volume)})}function N8(e){!xs||!$a||ja("zentaraLaserBurst",{volume:fu("laser",e==null?void 0:e.volume)})}function Sf(e){!xs||!$a||sb("zentaraScan",{volume:fu("scan",e==null?void 0:e.volume)})}function M8(e){ja("zentaraFuture",{volume:fu("move",e==null?void 0:e.volume)})}function MS(e){const t=ps((e==null?void 0:e.sfxVolume)??.15,0,1);ja("winDing",{volume:ps(t*.25,0,1)}),window.setTimeout(()=>{ja("placeHit",{volume:ga("placeHit",t)})},90)}async function iI(e,t=150){return new Promise(r=>{try{const s=Math.max(10,Math.floor(t/10));let o=0;const i=e.volume,c=window.setInterval(()=>{o++;const u=o/10;if(e.volume=Math.max(0,i*(1-u)),o>=10){window.clearInterval(c);try{e.pause(),e.currentTime=0}catch{}e.volume=i,r()}},s)}catch{try{e.pause(),e.currentTime=0}catch{}r()}})}function L8(e){if(!xs)return;const t=ps(e==null?void 0:e.volume,0,1),r=ps(e==null?void 0:e.playbackRate,.25,4);let n=!1;if(Jl&&mn&&nb("loop_dice_whirr")){try{Qf("loop_dice_whirr",Zj).then(async()=>{try{if(Yg||(mn.loop?await mn.loop({assetId:"loop_dice_whirr"}):await mn.play({assetId:"loop_dice_whirr"}),Yg=!0),mn.setVolume)try{await mn.setVolume({assetId:"loop_dice_whirr",volume:t})}catch{}}catch{Fl("loop_dice_whirr"),uv(t,r)}}).catch(()=>{Fl("loop_dice_whirr"),uv(t,r)}),n=!0}catch{}if(n){try{Qi&&window.clearTimeout(Qi),Qi=window.setTimeout(()=>{try{oo()}catch{}},8e3)}catch{}return}}$a&&uv(t,r)}function uv(e,t){if($a)try{if(!_a){_a=new Audio(Zj),_a.loop=!0,_a.preload="auto";try{_a.playsInline=!0}catch{}ab(_a,800)}if(!_a.paused){_a.volume=e,_a.playbackRate=t;return}_a.volume=e,_a.playbackRate=t,_a.currentTime=0,Zf(()=>{_a&&_a.play().catch(()=>{})}),Qi&&window.clearTimeout(Qi),Qi=window.setTimeout(()=>{try{oo()}catch{}},8e3)}catch{}}function oo(){if(Qi&&(window.clearTimeout(Qi),Qi=null),Jl&&mn)try{try{pd(mn.stop({assetId:"loop_dice_whirr"}))}catch{}try{mn.unload&&pd(mn.unload({assetId:"loop_dice_whirr"}))}catch{}try{Ys.delete("loop_dice_whirr"),rb("loop_dice_whirr")}catch{}Yg=!1}catch{}try{_a&&iI(_a,120)}catch{}}function pd(e){try{return e&&typeof e.then=="function"?e.catch(()=>{}):Promise.resolve()}catch{return Promise.resolve()}}const kl={},Ji={};function lI(e,t){u8.includes(e)||ja(e,{volume:t==null?void 0:t.volume,rate:t==null?void 0:t.rate,durationMs:t==null?void 0:t.durationMs})}function D8(e,t){if(!(!xs||!$a)&&!(Yf&&Date.now()-Yf<Sx))try{let r=kl[e];if(!r){r=new Audio(bs[e]),r.loop=!0,r.preload="auto";try{r.playsInline=!0}catch{}kl[e]=r,ab(r,800)}const n=ps((t==null?void 0:t.volume)??.1,0,1),s=ps((t==null?void 0:t.rate)??1,.25,4);if(!r.paused){r.volume=n,r.playbackRate=s;return}r.volume=n,r.playbackRate=s,r.currentTime=0,Zf(()=>{r.play().catch(()=>{})}),Ji[e]&&window.clearTimeout(Ji[e]);const o=Math.max(5e3,Math.min(6e4,(t==null?void 0:t.maxMs)??15e3));Ji[e]=window.setTimeout(()=>{try{cI(e)}catch{}},o)}catch{}}async function cI(e){try{Ji[e]&&(window.clearTimeout(Ji[e]),delete Ji[e]);const t=kl[e];if(!t)return;await iI(t,120),kl[e]=null}catch{}}function dv(){try{yn()}catch{}}async function pv(e,t){try{if(e==="__probe__")return Promise.resolve(!!$a);const r=e;return r in bs?t!=null&&t.loop?(D8(r,{volume:t.volume,rate:t.rate}),!0):(lI(r,{volume:t==null?void 0:t.volume,rate:t==null?void 0:t.rate}),!0):!1}catch{return!1}}function fv(e){try{$d(e)}catch{}}function LS(e){try{const t=e;try{cI(t)}catch{}const r=nl[t];if(r){try{[...r.busy].forEach(n=>{try{n.pause(),n.currentTime=0}catch{}})}catch{}delete nl[t]}try{delete Gg[t]}catch{}try{Ys.delete(t),rb(t)}catch{}try{$l(t)}catch{}}catch{}}const O8=(()=>{var e,t;try{return!!((t=(e=import.meta)==null?void 0:e.env)!=null&&t.DEV)}catch{return!1}})(),Sl=[];function g0(e,t){try{Sl.push({event:e,ts:Date.now(),mode:t}),Sl.length>12&&Sl.shift()}catch{}}function li(){return[...Sl]}function Ef(e,t=2e3){var s,o,i,c;if(e.connected)return Promise.resolve();const r=!!(e!=null&&e.__allowCookieAuth);return!String(((s=e==null?void 0:e.auth)==null?void 0:s.token)||((c=(i=(o=e==null?void 0:e.io)==null?void 0:o.opts)==null?void 0:i.auth)==null?void 0:c.token)||"")&&!r?Promise.reject(new Error("NO_AUTH_TOKEN")):(is(e,"emit.ensureConnected",{allowCookieSession:r}),new Promise((u,p)=>{var y;let d=!1;const f=()=>{d||(d=!0,b(),u())},m=x=>{d||(d=!0,b(),p(x??new Error("socket connect error")))},h=()=>{d||(d=!0,b(),p(new Error("socket connect timeout")))},b=()=>{try{e.off("connect",f)}catch{}try{e.off("connect_error",m)}catch{}clearTimeout(g)},g=setTimeout(h,Math.max(300,t));(y=g.unref)==null||y.call(g),e.once("connect",f),e.once("connect_error",m)}))}async function y0(e,t,r,n){var i,c,u,p,d,f,m,h;try{dI(t)}catch{}const s=(n==null?void 0:n.timeoutMs)??15e3;try{await Ef(e)}catch(b){const g=String((b==null?void 0:b.message)||b||"");if(/socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)|timeout/i.test(g)){try{const y=!!(e!=null&&e.__allowCookieAuth);is(e,"emit.ts:emitAck-ensureConnected-fallback",{allowCookieSession:y})}catch{}await new Promise(y=>{const x=setTimeout(()=>y(),800);e.once("connect",()=>{clearTimeout(x),y()})})}else throw b}g0(t,"ack");const o=()=>new Promise((b,g)=>{e.timeout(s).emit(t,r,(y,x)=>y?g(y):x?b(x):g(new Error("No ack payload received")))});try{return await o()}catch(b){const g=String((b==null?void 0:b.message)||b||"");try{if(/operation has timed out|timeout/i.test(g)){const y=(u=(c=(i=e==null?void 0:e.io)==null?void 0:i.engine)==null?void 0:c.transport)==null?void 0:u.name,x=(r==null?void 0:r.roomId)||null,v=((p=Sl[Sl.length-1])==null?void 0:p.event)||"unknown";$c("socket_ack_timeout",{event:String(t),scope:String(t).includes("craps")?"craps":String(t).includes("poker")?"poker":"other",roomId:x,lastEvent:v,timeoutMs:s,connected:!!e.connected,transport:y||"unknown",phase:"initial"}),console.warn("[client][timeout]",{event:String(t),roomId:x,lastEvent:v,timeoutMs:s,ts:Date.now()})}}catch{}if(/socket has been disconnected|the socket is disconnected/i.test(g)||/connect_error|transport close|transport error/i.test(g)){try{const y=!!(e!=null&&e.__allowCookieAuth);is(e,"emit.ts:emitAck-disconnect-retry",{allowCookieSession:y})}catch{}try{await new Promise(y=>{const x=setTimeout(()=>y(),1e3);e.once("connect",()=>{clearTimeout(x),y()})})}catch{}try{return await o()}catch(y){const x=String((y==null?void 0:y.message)||y||"");try{if(/operation has timed out|timeout/i.test(x)){const v=(m=(f=(d=e==null?void 0:e.io)==null?void 0:d.engine)==null?void 0:f.transport)==null?void 0:m.name,A=(r==null?void 0:r.roomId)||null,_=((h=Sl[Sl.length-1])==null?void 0:h.event)||"unknown";$c("socket_ack_timeout",{event:String(t),scope:String(t).includes("craps")?"craps":String(t).includes("poker")?"poker":"other",roomId:A,lastEvent:_,timeoutMs:s,connected:!!e.connected,transport:v||"unknown",phase:"retry"}),console.warn("[client][timeout][retry]",{event:String(t),roomId:A,lastEvent:_,timeoutMs:s,ts:Date.now()})}}catch{}throw y}}throw b}}async function uI(e,t,r){try{dI(t)}catch{}try{await Ef(e),g0(t,"ff"),e.emit(t,r)}catch(n){const s=String((n==null?void 0:n.message)||n||"");if(/NO_AUTH_TOKEN|socket connect timeout|socket has been disconnected|the socket is disconnected|connect_error|transport (?:close|error)|timeout/i.test(s)){try{const o=!!(e!=null&&e.__allowCookieAuth);is(e,"emit.ts:emitFF-fallback",{allowCookieSession:o})}catch{}if(await new Promise(o=>{const i=setTimeout(()=>o(),800);e.once("connect",()=>{clearTimeout(i),o()})}),!e.connected)return;g0(t,"ff"),e.emit(t,r);return}try{$c("socket_ff_emit_error",{event:String(t),message:s.slice(0,180),connected:!!e.connected})}catch{}if(O8)try{console.warn("[emitFF] unexpected error",{event:String(t),message:s,connected:!!e.connected})}catch{}return}}function dI(e){new Set([tr.ROLL_DICE,tr.PLACE_MAIN_BET,tr.CREATE_SIDE_BET,tr.ACCEPT_SIDE_BET,tr.CANCEL_SIDE_BET,tr.POKER_ACT,"poker:start_hand","craps:roll"]).has(e)&&yn()}const pI=za();async function z8(e,t,r="usd"){return await(await fetch(`${pI}/api/payment/chips`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({amount:e,userId:t,currency:r})})).json()}async function B8(e,t){return await(await fetch(`${pI}/api/payment/membership`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({planId:e,userId:t})})).json()}const DS={createChipsCheckout:z8,createMembershipCheckout:B8},fI=l.createContext(void 0),F8=({children:e})=>{const[t,r]=l.useState("idle"),[n,s]=l.useState(null),[o,i]=l.useState(!1),[c,u]=l.useState(!1),p=l.useCallback(async(f,m,h="usd")=>{r("loading"),s(null);try{const b=await DS.createChipsCheckout(f,m,h);return b.url?(r("success"),b.url):(r("error"),s(b.error||"Unable to start chips checkout"),null)}catch(b){return r("error"),s(b.message||"Unable to start chips checkout"),null}},[]),d=l.useCallback(async(f,m)=>{r("loading"),s(null);try{const h=await DS.createMembershipCheckout(f,m);return h.url?(r("success"),h.url):(r("error"),s(h.error||"Unable to start membership checkout"),null)}catch(h){return r("error"),s(h.message||"Unable to start membership checkout"),null}},[]);return a.jsx(fI.Provider,{value:{status:t,error:n,startChipsCheckout:p,startMembershipCheckout:d,setStatus:r,setError:s,membershipModalOpen:o,setMembershipModalOpen:i,chipsModalOpen:c,setChipsModalOpen:u},children:e})};function wm(){const e=l.useContext(fI);return e||{status:"idle",error:null,startChipsCheckout:async()=>null,startMembershipCheckout:async()=>null,setStatus:()=>{},setError:()=>{},membershipModalOpen:!1,setMembershipModalOpen:()=>{},chipsModalOpen:!1,setChipsModalOpen:()=>{}}}function qs(){const e=typeof globalThis<"u"?globalThis.crypto:void 0;try{if(e&&typeof e.randomUUID=="function")return e.randomUUID()}catch{}try{if(e&&typeof e.getRandomValues=="function"){const c=new Uint8Array(16);e.getRandomValues(c),c[6]=c[6]&15|64,c[8]=c[8]&63|128;const u=Array.from(c,p=>p.toString(16).padStart(2,"0")).join("");return`${u.slice(0,8)}-${u.slice(8,12)}-${u.slice(12,16)}-${u.slice(16,20)}-${u.slice(20)}`}}catch{}const t=()=>Math.floor(Math.random()*4294967295).toString(16).padStart(8,"0"),r=t(),n=t().slice(0,4),s=("4"+t()).slice(0,4),o=((8+Math.floor(Math.random()*4)).toString(16)+t()).slice(0,4),i=(t()+t()).slice(0,12);return`${r}-${n}-${s}-${o}-${i}`}function U8(e,t){const r=l.useCallback(async()=>{if(!e)throw new Error("Socket unavailable");if(e.connected)return e;try{!e.active&&e.disconnected&&is(e,"useEmitter.ensureConnected"),await new Promise(o=>{const i=setTimeout(()=>o(),4e3);e.once("connect",()=>{clearTimeout(i),o()})})}catch{}return e},[e]),n=l.useCallback(async(o,i,c)=>{const u=await r();let p=i;if(i&&typeof i=="object"&&!i.eventId)try{p={...i,eventId:qs()}}catch{}const d={room_create:3e4,poker_room_create:3e4},f=(c==null?void 0:c.timeoutMs)||15e3,m=o in d?d[o]:f,h={...c,timeoutMs:m},b=async()=>y0(u,o,p,h);let g,y=0;const x=2,v=async()=>{try{return await b()}catch(A){const _=String((A==null?void 0:A.message)||A||"");if(/NO_AUTH_TOKEN/i.test(_))return{ok:!1,error:"NO_AUTH_TOKEN"};const w=/socket connect timeout/i.test(_)||/ETIMEDOUT/i.test(_)||/timeout/i.test(_),j=/socket has been disconnected/i.test(_)||/the socket is disconnected/i.test(_);if((w||j||/connect_error|transport close|transport error/i.test(_))&&y<x){y++;const k=(/create/i.test(o)?1500:800)*Math.pow(2,y-1);try{e&&e.disconnected&&is(e,"useSocketEmitters:backoff-retry"),await new Promise(E=>{const M=setTimeout(()=>E(),k);e==null||e.once("connect",()=>{clearTimeout(M),E()})})}catch{}return v()}else throw A}};g=await v();try{if(g&&g.ok===!1&&(g.error==="rate_limited"||/rate[_-]?limited/i.test(g.error||""))){console.debug("[socket][rate_limited]",{event:String(o),ts:Date.now()});try{t&&t(String(o))}catch{}}}catch{}return g},[r,t]),s=l.useCallback(async(o,i)=>{const c=await r();return uI(c,o,i)},[r]);return{ack:n,send:s}}function sa(){const e=Na(),{info:t}=ji(),r=l.useRef(0),n=l.useCallback(se=>{const je=Date.now();if(!(je-r.current<1200)){r.current=je;try{t("Please wait a moment - you're doing that too quickly.",{duration:2500})}catch{}}},[t]),{ack:s,send:o}=U8(e,n),{setMembershipModalOpen:i}=wm(),{user:c}=Zr(),u=l.useCallback(se=>{const je=(()=>{const Ke={};try{if(Ke.name=String(se.name||"").trim().slice(0,60),(se.isPrivate===!0||se.isPrivate===!1)&&(Ke.isPrivate=!!se.isPrivate),(se.singlePlayer===!0||se.singlePlayer===!1)&&(Ke.singlePlayer=!!se.singlePlayer),typeof se.botsPerRoom=="number"&&Number.isInteger(se.botsPerRoom)&&(Ke.botsPerRoom=se.botsPerRoom),(se.gameMode==="cee-lo"||se.gameMode==="craps"||se.gameMode==="zentara")&&(Ke.gameMode=se.gameMode),typeof se.botLevel=="number"&&se.botLevel>=1&&se.botLevel<=9&&(Ke.botLevel=se.botLevel),se.gameMode==="zentara"&&se.gameRules&&typeof se.gameRules=="object"){const Me={};se.gameRules.disableRaid===!0&&(Me.disableRaid=!0),se.gameRules.disableSpyStrike===!0&&(Me.disableSpyStrike=!0),Object.keys(Me).length>0&&(Ke.gameRules=Me)}}catch{}return Ke})(),Oe=Date.now();try{console.log("[socket][createRoom] emitting",{sanitized:je,timestamp:Oe})}catch{}return s(tr.CREATE_ROOM,je).then(Ke=>{var wt,at;const Me=Date.now()-Oe;try{console.log("[socket][createRoom] response",{ok:Ke==null?void 0:Ke.ok,roomId:((wt=Ke==null?void 0:Ke.room)==null?void 0:wt.roomId)??((at=Ke==null?void 0:Ke.room)==null?void 0:at.id),duration:Me,error:Ke==null?void 0:Ke.error,res:Ke}),Ke&&Ke.ok===!1&&console.warn("[socket][createRoom] ack error",Ke.error)}catch{}return Ke})},[s,i,c]),p=l.useCallback(async se=>{const je=Date.now();console.log("[joinRoom] attempting join",{roomId:se,timestamp:je,socketConnected:e==null?void 0:e.connected});const Oe=async()=>s(tr.JOIN_ROOM,{roomId:se});let Ke=await Oe();const Me=Date.now()-je;if(console.log("[joinRoom] first attempt result",{roomId:se,ok:Ke==null?void 0:Ke.ok,duration:Me,error:Ke==null?void 0:Ke.error}),Ke&&Ke.ok===!1&&/Room not found/i.test(String(Ke.error||""))){console.warn("[useSocketEmitters] Room not found on first join attempt, retrying...",{roomId:se,res:Ke,firstAttemptDuration:Me});try{await new Promise(Dt=>setTimeout(Dt,120))}catch{}const wt=Date.now();Ke=await Oe();const at=Date.now()-wt;Ke&&Ke.ok===!1?console.error("[useSocketEmitters] Room not found after retry",{roomId:se,res:Ke,retryDuration:at,totalDuration:Date.now()-je}):console.log("[useSocketEmitters] Retry successful",{roomId:se,retryDuration:at,totalDuration:Date.now()-je})}if(Ke&&Ke.ok===!1&&Ke.error===gB.SOCKET.NEEDS_PREMIUM)try{i(!0)}catch{}return Ke},[s,i]),d=l.useCallback(se=>s(tr.LEAVE_ROOM,{roomId:se}),[s]),f=l.useCallback(se=>o(tr.LEAVE_ROOM,{roomId:se}),[o]),m=l.useCallback((se,je,Oe,Ke,Me)=>s("skills:submit",{roomId:se,path:je,word:Oe,tsClient:Ke,seq:Me}),[s]),h=l.useCallback((se,je,Oe,Ke,Me)=>s("skills:tap",{roomId:se,r:je,c:Oe,tsClient:Ke,seq:Me}),[s]),b=l.useCallback((se,je)=>s("anagrams:submit",{roomId:se,word:je}),[s]),g=l.useCallback((se,je,Oe)=>s("trivia:answer",{roomId:se,questionIndex:je,answerIndex:Oe}),[s]),y=l.useCallback(se=>s(tr.ROLL_DICE,{roomId:se}),[s]),x=l.useCallback(se=>s(tr.CONFIRM_BETS,{roomId:se}),[s]),v=l.useCallback((se,je)=>s(tr.CRAPS_PLACE_PASS,{roomId:se,amount:je}),[s]);l.useCallback((se,je)=>s(tr.CRAPS_PLACE_DONT_PASS,{roomId:se,amount:je}),[s]);const A=l.useCallback((se,je,Oe)=>s(tr.CRAPS_PLACE_ODDS,{roomId:se,amount:je,passType:Oe}),[s]),_=l.useCallback((se,je,Oe)=>s(tr.CRAPS_PLACE_PLACE,{roomId:se,amount:je,point:Oe}),[s]),w=l.useCallback((se,je)=>s(tr.CRAPS_PLACE_FIELD,{roomId:se,amount:je}),[s]),j=l.useCallback((se,je,Oe)=>s(tr.CRAPS_PLACE_BIG,{roomId:se,amount:je,kind:Oe}),[s]),T=l.useCallback((se,je)=>s(tr.CRAPS_PLACE_COME,{roomId:se,amount:je}),[s]),R=l.useCallback((se,je)=>s(tr.CRAPS_PLACE_DONT_COME,{roomId:se,amount:je}),[s]),P=l.useCallback((se,je,Oe)=>s(tr.CRAPS_PLACE_COME_ODDS,{roomId:se,point:je,amount:Oe}),[s]),k=l.useCallback((se,je,Oe)=>s(tr.CRAPS_PLACE_DONT_COME_ODDS,{roomId:se,point:je,amount:Oe}),[s]),E=l.useCallback((se,je)=>s(tr.CRAPS_TOGGLE_PLACE_WORKING,{roomId:se,working:je}),[s]),M=l.useCallback(async se=>{try{const je=G.current.get(se)||[],Oe=$.current.get(se);if(Oe&&(clearTimeout(Oe),$.current.delete(se)),je.length>0)if(G.current.delete(se),je.length>1)await s("craps:add_bets_batch",{roomId:se,bets:je,eventId:qs()});else{const{type:Ke,amount:Me}=je[0];await s("craps:add_bet",{roomId:se,type:Ke,amount:Me,eventId:qs()})}}catch{}try{const je=de.current.get(se)||[],Oe=ie.current.get(se);if(Oe&&(clearTimeout(Oe),ie.current.delete(se)),je.length>0)if(de.current.delete(se),je.length>1)await s("craps:remove_bets_batch",{roomId:se,bets:je,eventId:qs()});else{const{type:Ke,amount:Me}=je[0];await s("craps:remove_bet",{roomId:se,type:Ke,amount:Me,eventId:qs()})}}catch{}},[s]),C=l.useCallback(async se=>{try{if(!se)return console.debug("[socket][crapsRoll] blocked: no roomId"),{ok:!1,error:"no_room"}}catch{}try{await M(se)}catch{}return s(tr.CRAPS_ROLL,{roomId:se})},[s,M]),I=l.useCallback(se=>s(tr.CRAPS_READY,{roomId:se}),[s]),L=l.useCallback((se,je)=>s(tr.CRAPS_FETCH_HISTORY,{roomId:se,...je||{}}),[s]),N=l.useCallback(se=>s("craps:get_state",{roomId:se}),[s]),S=l.useCallback(se=>s("craps:join_order",{roomId:se}),[s]),F=l.useCallback(se=>s("craps:leave_order",{roomId:se}),[s]),D=l.useCallback(se=>s("craps:pass_turn",{roomId:se}),[s]),H=l.useCallback((se,je)=>s("craps:set_order",{roomId:se,order:je}),[s]),W=l.useCallback(se=>s("craps:reset_shooter",{roomId:se}),[s]),G=l.useRef(new Map),$=l.useRef(new Map),K=80,de=l.useRef(new Map),ie=l.useRef(new Map),we=80,he=l.useCallback(se=>s("craps:list_bets",{roomId:se,eventId:qs()}),[s]),Ae=l.useCallback((se,je,Oe)=>{const Ke=G.current.get(se)||[];Ke.push({type:je,amount:Oe}),G.current.set(se,Ke);const Me=$.current.get(se);Me&&clearTimeout(Me);const wt=setTimeout(()=>{const at=G.current.get(se)||[];if(at.length!==0)if(G.current.delete(se),$.current.delete(se),at.length>1)s("craps:add_bets_batch",{roomId:se,bets:at,eventId:qs()});else{const{type:Dt,amount:Ut}=at[0];s("craps:add_bet",{roomId:se,type:Dt,amount:Ut,eventId:qs()})}},K);return $.current.set(se,wt),Promise.resolve({ok:!0})},[s]),Fe=l.useCallback((se,je)=>s("craps:add_bets_batch",{roomId:se,bets:je,eventId:qs()}),[s]),U=l.useCallback((se,je)=>s("craps:remove_bets_batch",{roomId:se,bets:je,eventId:qs()}),[s]),V=l.useCallback((se,je,Oe)=>{const Ke=de.current.get(se)||[];Ke.push({type:je,amount:Oe}),de.current.set(se,Ke);const Me=ie.current.get(se);Me&&clearTimeout(Me);const wt=setTimeout(()=>{const at=de.current.get(se)||[];if(at.length!==0)if(de.current.delete(se),ie.current.delete(se),at.length>1)s("craps:remove_bets_batch",{roomId:se,bets:at,eventId:qs()});else{const{type:Dt,amount:Ut}=at[0];s("craps:remove_bet",{roomId:se,type:Dt,amount:Ut,eventId:qs()})}},we);return ie.current.set(se,wt),Promise.resolve({ok:!0})},[s]),z=l.useCallback(se=>s("craps:clear_bets",{roomId:se,eventId:qs()}),[s]),O=l.useCallback(se=>s("craps:summarize",{roomId:se}),[s]),q=l.useCallback(se=>s(tr.BANKER_GIVE_UP,{roomId:se}),[s]),X=l.useCallback(async()=>{const se=async()=>s(tr.GET_ROOMS_LIST,{});let je=await se();return je&&je.ok===!1&&je.error==="invalid_payload"&&(await new Promise(Oe=>setTimeout(Oe,80)),je=await se()),je},[s]),Z=l.useCallback((se,je)=>s(tr.SPECTATE_SET,{roomId:se,spectate:je}),[s]),Q=l.useCallback(async(se,je)=>{const Oe=await s(tr.PLACE_MAIN_BET,{roomId:se,amount:je});try{$c("bet_place",{game:"cee-lo",type:"MAIN",amount:je})}catch{}return Oe},[s]),oe=l.useCallback((se,je)=>s(tr.CANCEL_MAIN_BET,{roomId:se,wagerId:je}),[s]),ce=l.useCallback((se,je)=>s(tr.CREATE_SIDE_BET,{roomId:se,...je}),[s]),_e=l.useCallback((se,je)=>s(tr.ACCEPT_SIDE_BET,{roomId:se,wagerId:je}),[s]),re=l.useCallback((se,je)=>s(tr.CANCEL_SIDE_BET,{roomId:se,wagerId:je}),[s]),pe=l.useCallback(async se=>{if(!se)return{ok:!1,error:"no_room"};const je={roomId:se};try{console.debug("[socket][getWagers] emit",je)}catch{}const Oe=await s(tr.GET_WAGERS,je);if(Oe&&Oe.ok===!1)try{console.warn("[socket][getWagers] ack error",Oe.error)}catch{}return Oe},[s]),ee=l.useCallback(se=>s(tr.RTC_JOIN,{roomId:se}),[s]),xe=l.useCallback(se=>{var je,Oe;try{(Oe=(je=e==null?void 0:e.volatile)==null?void 0:je.emit)==null||Oe.call(je,tr.RTC_LEAVE,{roomId:se})}catch{}},[e]),Le=l.useCallback(async(se,je,Oe)=>{try{await o(tr.RTC_SIGNAL,{roomId:se,toPeerId:je,payload:Oe})}catch(Ke){const Me=String((Ke==null?void 0:Ke.message)||Ke||"");if(/disconnect|timeout|transport/i.test(Me)){await new Promise(wt=>setTimeout(wt,200));try{await o(tr.RTC_SIGNAL,{roomId:se,toPeerId:je,payload:Oe})}catch{}}}},[o]),Ge=l.useCallback((se,je)=>s(tr.RTC_SET_CAMERA_OWNER,{roomId:se,ownerId:je}),[s]),_t=l.useCallback(async(se,je)=>{try{if(!se)return{ok:!1,error:"no_room"};const Oe=await s(tr.RTC_SET_VIDEO_ENABLED,{roomId:se,enabled:je});return Oe.ok||console.error("Failed to set video enabled:",Oe.error),Oe}catch(Oe){console.error("Error setting video enabled:",Oe)}},[s,i]),Xe=l.useCallback((se,je)=>s(tr.ROOM_SEND_MESSAGE,{roomId:se,text:je}),[s]),bt=l.useCallback((se,je)=>s(tr.ROOM_FETCH_HISTORY,{roomId:se,sinceTs:je}),[s]),Pt=l.useCallback((se,je)=>s(tr.DM_SEND_MESSAGE,{toUserId:se,text:je}),[s]),kt=l.useCallback((se,je)=>s(tr.DM_FETCH_HISTORY,{peerUserId:se,sinceTs:je}),[s]),Ee=l.useCallback(()=>s(tr.LOBBY_JOIN,{}),[s]),le=l.useCallback(()=>o(tr.LOBBY_LEAVE,{}),[o]),De=l.useCallback(()=>s(tr.LOBBY_LIST,{}),[s]),Ye=l.useCallback(se=>s(tr.DELETE_ROOM,{roomId:se}),[s]),Re=l.useCallback(()=>s(tr.USER_GET_BALANCE,void 0),[s]),et=l.useCallback((se,je)=>s(tr.SEND_FRIEND_REQUEST,{toUserId:se,message:je}),[s]),rt=l.useCallback(se=>s(tr.CANCEL_FRIEND_REQUEST,{requestId:se}),[s]),ne=l.useCallback((se,je)=>s(tr.RESPOND_FRIEND_REQUEST,{requestId:se,action:je}),[s]),ue=l.useCallback(se=>s(tr.UNFRIEND,{otherId:se}),[s]),B=l.useCallback(se=>s(tr.BLOCK_USER,{blockedId:se}),[s]),fe=l.useCallback(se=>s(tr.UNBLOCK_USER,{blockedId:se}),[s]),ye=l.useCallback(()=>s(tr.SOCIAL_GET_LIST,void 0),[s]),ve=l.useCallback((se,je,Oe)=>s(tr.GAME_INVITE_SEND,{roomId:se,toUserId:je,gameMode:Oe}),[s]),ke=l.useCallback((se,je)=>s(tr.GAME_INVITE_RESPOND,{inviteId:se,action:je}),[s]),Ue=l.useCallback((se,je)=>s(tr.QUICK_MATCH_JOIN,{gameMode:se,botsPerRoom:je}),[s]),ct=l.useCallback(()=>s(tr.QUICK_MATCH_LEAVE,void 0),[s]),dt=l.useCallback(()=>s(tr.QUICK_MATCH_STATUS,void 0),[s]),Rt=l.useCallback(()=>s(tr.SOCIAL_ONLINE_FRIENDS,void 0),[s]),jr=l.useCallback(se=>s(tr.USER_UPDATE_PROFILE,se),[s]),Qe=l.useCallback(se=>s(tr.BOTS_NUDGE,{roomId:se??null}),[s]),Mt=l.useCallback(se=>s(tr.ROOM_REFRESH_STATE,{roomId:se??null}),[s]),lr=l.useCallback((se,je)=>o("player:visibility",{roomId:se,visible:je}),[o]),zt=l.useCallback(async(se,je,Oe,Ke,Me)=>s("skills:single_start",{stake:se,gameMode:je,duration:Oe,botLevel:Ke,autoplay:Me}),[s]),br=l.useCallback(async(se,je,Oe)=>s("skills:autoplay_start",{gameMode:se,duration:je,botLevel:Oe}),[s]),fr=l.useCallback(async se=>s("skills:ready",{roomId:se}),[s]),ur=l.useCallback(async se=>s("skills:room_create",se),[s]),Ie=l.useCallback(async se=>s("skills:join_room",{roomId:se}),[s]),yt=l.useCallback(async se=>s("skills:leave_room",{roomId:se}),[s]),St=l.useCallback(async se=>s("skills:spectator_join",{roomId:se}),[s]),Xt=l.useCallback(async se=>s("skills:spectator_leave",{roomId:se}),[s]);return{createRoom:u,joinRoom:p,leaveRoom:d,leaveRoomTearDown:f,getRoomsList:X,setSpectate:Z,bankerGiveUp:q,pokerCreateRoom:l.useCallback(se=>{const je={...se};let Oe=je.maxPlayers;if((typeof Oe!="number"||!Number.isInteger(Oe)||Oe<1||Oe>4)&&(Oe=je.singlePlayer?1:4),je.maxPlayers=Oe,typeof je.startingStack=="number"){const Ke=Math.max(500,Math.min(1e6,Math.floor(je.startingStack)));je.startingStack=Ke}je.eliminationMode?je.eliminationMode={enabled:!0}:delete je.eliminationMode,typeof je.botLevel=="number"&&je.botLevel>=1&&je.botLevel<=9||delete je.botLevel;try{console.debug("[socket][pokerCreateRoom] emitting",je)}catch{}return s(tr.POKER_ROOM_CREATE,je)},[s,c,i]),pokerDeleteRoom:l.useCallback(se=>s(tr.POKER_ROOM_DELETE,{roomId:se}),[s]),pokerJoinRoom:l.useCallback(async se=>s(tr.POKER_JOIN_ROOM,{roomId:se}),[s]),pokerStartHand:l.useCallback(se=>s(tr.POKER_START_HAND,{roomId:se}),[s]),pokerFold:l.useCallback(se=>s(tr.POKER_ACT,{roomId:se,action:"fold"}),[s]),pokerCheck:l.useCallback(se=>s(tr.POKER_ACT,{roomId:se,action:"check"}),[s]),pokerCall:l.useCallback(se=>s(tr.POKER_ACT,{roomId:se,action:"call"}),[s]),pokerBet:l.useCallback((se,je)=>s(tr.POKER_ACT,{roomId:se,action:"bet",amount:je}),[s]),pokerRaise:l.useCallback((se,je)=>s(tr.POKER_ACT,{roomId:se,action:"raise",amount:je}),[s]),pokerFetchHistory:l.useCallback((se,je,Oe)=>s(tr.POKER_FETCH_HISTORY,{roomId:se,limit:je,beforeSeq:Oe}),[s]),rollDice:y,confirmBets:x,crapsPlacePass:v,crapsRoll:C,crapsPlaceOdds:A,crapsPlacePlace:_,crapsPlaceField:w,crapsPlaceBig:j,crapsPlaceCome:T,crapsPlaceDontCome:R,crapsPlaceComeOdds:P,crapsPlaceDontComeOdds:k,crapsTogglePlaceWorking:E,crapsReady:I,crapsFetchHistory:L,crapsGetState:N,crapsJoinOrder:S,crapsLeaveOrder:F,crapsPassTurn:D,crapsSetOrder:H,crapsResetShooter:W,crapsListBets:he,crapsAddBet:Ae,crapsBatchAddBets:Fe,crapsRemoveBet:V,crapsBatchRemoveBets:U,crapsClearBets:z,crapsSummarizeBets:O,placeMainBet:Q,cancelMainBet:oe,createSideBet:ce,acceptSideBet:_e,cancelSideBet:re,getWagers:pe,rtcJoin:ee,rtcLeave:xe,rtcSignal:Le,rtcSetCameraOwner:Ge,rtcSetVideoEnabled:_t,roomSendMessage:Xe,roomFetchHistory:bt,dmSendMessage:Pt,dmFetchHistory:kt,lobbyJoin:Ee,lobbyLeave:le,lobbyList:De,deleteRoom:Ye,getUserBalance:Re,sendFriendRequest:et,cancelFriendRequest:rt,respondFriendRequest:ne,unfriend:ue,blockUser:B,unblockUser:fe,getFriendsList:ye,sendGameInvite:ve,respondGameInvite:ke,quickMatchJoin:Ue,quickMatchLeave:ct,quickMatchStatus:dt,getOnlineFriends:Rt,updateProfile:jr,botsNudge:Qe,refreshRoomState:Mt,sendVisibilityChange:lr,skillsSubmit:m,skillsTap:h,skillsSingleStart:zt,skillsAutoplayStart:br,skillsReady:fr,skillsRoomCreate:ur,skillsJoinRoom:Ie,skillsLeaveRoom:yt,skillsSpectatorJoin:St,skillsSpectatorLeave:Xt,anagramsSubmit:b,triviaAnswer:g}}const vt={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 Ba(e){const t=Na(),r=l.useRef(e);l.useEffect(()=>{r.current=e},[e]),l.useEffect(()=>{var c,u;if(typeof window>"u"||!(((u=(c=window.location)==null?void 0:c.search)==null?void 0:u.includes("e2e=1"))||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1"))return;const s=window;s.__crapsHandlersBus||(s.__crapsHandlersBus={onCrapsRollResult:new Set,onCrapsBetResults:new Set,onCrapsPointSet:new Set,onCrapsPointMade:new Set,_buffer:{onCrapsRollResult:[],onCrapsBetResults:[],onCrapsPointSet:[],onCrapsPointMade:[],push(p,d){const f=this[p];f.push(d),f.length>20&&f.shift()}}}),(()=>{const p=s.__crapsHandlers||{};p&&p.__wrappedByBus||(s.__crapsHandlers={onCrapsRollResult:d=>{var f,m;try{s.__crapsHandlersBus._buffer.push("onCrapsRollResult",d)}catch{}s.__crapsHandlersBus.onCrapsRollResult.forEach(h=>{try{h(d)}catch{}});try{const h=s.__flashTest;(s.__E2E===!0||((m=(f=s.location)==null?void 0:f.search)==null?void 0:m.includes("e2e=1"))||s.sessionStorage&&s.sessionStorage.getItem("e2e")==="1")&&h&&h.info}catch{}try{typeof p.onCrapsRollResult=="function"&&p.onCrapsRollResult(d)}catch{}},onCrapsBetResults:d=>{var f,m;try{s.__crapsHandlersBus._buffer.push("onCrapsBetResults",d)}catch{}s.__crapsHandlersBus.onCrapsBetResults.forEach(h=>{try{h(d)}catch{}});try{const h=s.__flashTest;if(!(!(s.__E2E===!0||((m=(f=s.location)==null?void 0:f.search)==null?void 0:m.includes("e2e=1"))||s.sessionStorage&&s.sessionStorage.getItem("e2e")==="1")||!h)){const g=Array.isArray(d==null?void 0:d.settlements)?d.settlements:[],y=g.filter(A=>typeof(A==null?void 0:A.betType)=="string"&&A.betType.startsWith("place")&&A.outcome==="WIN"),x=g.filter(A=>(A.betType==="pass"||A.betType==="dontPass")&&A.outcome==="WIN"),v=g.filter(A=>(A.betType==="pass"||A.betType==="dontPass")&&A.outcome==="LOSE");if(y.length>0&&typeof h.win=="function"){const A=y.reduce((_,w)=>_+(Number(w.payout)||0),0);h.win(y.length>1?"Place Wins":"Place Win",A?`+${A}`:void 0)}else if(x.length>0&&typeof h.win=="function"){const A=x.reduce((_,w)=>_+(Number(w.payout)||0)+(Number(w.amount)||0),0);h.win("Line Win",A?`+${A}`:void 0)}else if(v.length>0&&typeof h.lose=="function"){const A=v.reduce((_,w)=>_+(Number(w.amount)||0),0);h.lose("Line Lose",A?`-${A}`:void 0)}}}catch{}try{typeof p.onCrapsBetResults=="function"&&p.onCrapsBetResults(d)}catch{}},onCrapsPointSet:d=>{var f,m,h;try{s.__crapsHandlersBus._buffer.push("onCrapsPointSet",d)}catch{}s.__crapsHandlersBus.onCrapsPointSet.forEach(b=>{try{b(d)}catch{}});try{const b=s.__flashTest;if((s.__E2E===!0||((m=(f=s.location)==null?void 0:f.search)==null?void 0:m.includes("e2e=1"))||s.sessionStorage&&s.sessionStorage.getItem("e2e")==="1")&&b&&typeof b.info=="function"){const y=d&&(d.point??((h=d==null?void 0:d.state)==null?void 0:h.point));b.info("Point Set",y?`${y} is the point`:void 0)}}catch{}try{typeof p.onCrapsPointSet=="function"&&p.onCrapsPointSet(d)}catch{}},onCrapsPointMade:d=>{var f,m,h;try{s.__crapsHandlersBus._buffer.push("onCrapsPointMade",d)}catch{}s.__crapsHandlersBus.onCrapsPointMade.forEach(b=>{try{b(d)}catch{}});try{const b=s.__flashTest;if((s.__E2E===!0||((m=(f=s.location)==null?void 0:f.search)==null?void 0:m.includes("e2e=1"))||s.sessionStorage&&s.sessionStorage.getItem("e2e")==="1")&&b&&typeof b.win=="function"){const y=d&&(d.point??((h=d==null?void 0:d.state)==null?void 0:h.point));b.win("Point Made",y?`${y} hit`:void 0)}}catch{}try{typeof p.onCrapsPointMade=="function"&&p.onCrapsPointMade(d)}catch{}},__wrappedByBus:!0})})();const i={onCrapsRollResult:p=>{var d,f;return(f=(d=r.current).onCrapsRollResult)==null?void 0:f.call(d,p)},onCrapsBetResults:p=>{var d,f;return(f=(d=r.current).onCrapsBetResults)==null?void 0:f.call(d,p)},onCrapsPointSet:p=>{var d,f;return(f=(d=r.current).onCrapsPointSet)==null?void 0:f.call(d,p)},onCrapsPointMade:p=>{var d,f;return(f=(d=r.current).onCrapsPointMade)==null?void 0:f.call(d,p)}};s.__crapsHandlersBus.onCrapsRollResult.add(i.onCrapsRollResult),s.__crapsHandlersBus.onCrapsBetResults.add(i.onCrapsBetResults),s.__crapsHandlersBus.onCrapsPointSet.add(i.onCrapsPointSet),s.__crapsHandlersBus.onCrapsPointMade.add(i.onCrapsPointMade);try{const p=s.__crapsHandlersBus._buffer;if(p){for(const d of p.onCrapsRollResult)try{i.onCrapsRollResult(d)}catch{}for(const d of p.onCrapsBetResults)try{i.onCrapsBetResults(d)}catch{}for(const d of p.onCrapsPointSet)try{i.onCrapsPointSet(d)}catch{}for(const d of p.onCrapsPointMade)try{i.onCrapsPointMade(d)}catch{}}}catch{}return()=>{try{s.__crapsHandlersBus.onCrapsRollResult.delete(i.onCrapsRollResult),s.__crapsHandlersBus.onCrapsBetResults.delete(i.onCrapsBetResults),s.__crapsHandlersBus.onCrapsPointSet.delete(i.onCrapsPointSet),s.__crapsHandlersBus.onCrapsPointMade.delete(i.onCrapsPointMade)}catch{}}},[]),l.useEffect(()=>{if(!t)return;const n=ne=>{var ue,B;return(B=(ue=r.current).onLobbyRooms)==null?void 0:B.call(ue,ne)},s=ne=>{var ue,B;return(B=(ue=r.current).onRoomCreated)==null?void 0:B.call(ue,ne)},o=ne=>{var ue,B;return(B=(ue=r.current).onRoomUpdated)==null?void 0:B.call(ue,ne)},i=ne=>{var ue,B;return(B=(ue=r.current).onRoomDeleted)==null?void 0:B.call(ue,ne)},c=ne=>{var ue,B;return(B=(ue=r.current).onJoinedRoom)==null?void 0:B.call(ue,ne)},u=ne=>{var ue,B;return(B=(ue=r.current).onRejoinedRoom)==null?void 0:B.call(ue,ne)},p=ne=>{var ue,B,fe,ye,ve,ke,Ue;console.log("[socket] received other_player_joined_room",{roomId:(ue=ne==null?void 0:ne.room)==null?void 0:ue.id,playersCount:(fe=(B=ne==null?void 0:ne.room)==null?void 0:B.players)==null?void 0:fe.length,playerIds:(ve=(ye=ne==null?void 0:ne.room)==null?void 0:ye.players)==null?void 0:ve.map(ct=>ct==null?void 0:ct.id)}),(Ue=(ke=r.current).onOtherPlayerJoined)==null||Ue.call(ke,ne)},d=ne=>{var ue,B,fe,ye,ve,ke,Ue;console.log("[socket] received other_player_left_room",{roomId:(ue=ne==null?void 0:ne.room)==null?void 0:ue.id,playersCount:(fe=(B=ne==null?void 0:ne.room)==null?void 0:B.players)==null?void 0:fe.length,playerIds:(ve=(ye=ne==null?void 0:ne.room)==null?void 0:ye.players)==null?void 0:ve.map(ct=>ct==null?void 0:ct.id)}),(Ue=(ke=r.current).onOtherLeft)==null||Ue.call(ke,ne)},f=ne=>{var ue,B;return(B=(ue=r.current).onBankerChanged)==null?void 0:B.call(ue,ne)},m=ne=>{var ue,B;return(B=(ue=r.current).onDiceRolled)==null?void 0:B.call(ue,ne)},h=()=>{var ne,ue;return(ue=(ne=r.current).onNotYourTurn)==null?void 0:ue.call(ne)},b=ne=>{var ue,B;return(B=(ue=r.current).onOtaUpdateAvailable)==null?void 0:B.call(ue,ne)},g=ne=>{var ue,B;return(B=(ue=r.current).onBetsUpdated)==null?void 0:B.call(ue,ne)},y=ne=>{var ue,B;return(B=(ue=r.current).onGetWagers)==null?void 0:B.call(ue,ne)},x=ne=>{var ue,B;return(B=(ue=r.current).onPlayerBalanceUpdated)==null?void 0:B.call(ue,ne)},v=ne=>{var ue,B;return(B=(ue=r.current).onSideBetCreated)==null?void 0:B.call(ue,ne)},A=ne=>{var ue,B;return(B=(ue=r.current).onSideBetAccepted)==null?void 0:B.call(ue,ne)},_=ne=>{var ue,B;return(B=(ue=r.current).onSideBetCanceled)==null?void 0:B.call(ue,ne)},w=ne=>{var ue,B;return(B=(ue=r.current).onForceLogout)==null?void 0:B.call(ue,ne)},j=ne=>{var ue,B;return(B=(ue=r.current).onError)==null?void 0:B.call(ue,ne)},T=ne=>{var ue,B;return(B=(ue=r.current).onRtcSignal)==null?void 0:B.call(ue,ne)},R=ne=>{var ue,B;return(B=(ue=r.current).onRtcPeerJoined)==null?void 0:B.call(ue,ne)},P=ne=>{var ue,B;return(B=(ue=r.current).onRtcPeerLeft)==null?void 0:B.call(ue,ne)},k=ne=>{var ue,B;return(B=(ue=r.current).onRtcCameraOwnerChanged)==null?void 0:B.call(ue,ne)},E=ne=>{var ue,B;return(B=(ue=r.current).onRtcVideoEnabled)==null?void 0:B.call(ue,ne)},M=ne=>{var ue,B;return(B=(ue=r.current).onRoomMessage)==null?void 0:B.call(ue,ne)},C=ne=>{var ue,B;return(B=(ue=r.current).onRoomHistory)==null?void 0:B.call(ue,ne)},I=ne=>{var ue,B;return(B=(ue=r.current).onDmMessage)==null?void 0:B.call(ue,ne)},L=ne=>{var ue,B;return(B=(ue=r.current).onDmHistory)==null?void 0:B.call(ue,ne)},N=ne=>{var ue,B;return(B=(ue=r.current).onFairnessReveal)==null?void 0:B.call(ue,ne)},S=ne=>{var ue,B;return(B=(ue=r.current).onFriendRequestReceived)==null?void 0:B.call(ue,ne)},F=ne=>{var ue,B;return(B=(ue=r.current).onFriendRequestCancelled)==null?void 0:B.call(ue,ne)},D=ne=>{var ue,B;return(B=(ue=r.current).onFriendRequestResponded)==null?void 0:B.call(ue,ne)},H=ne=>{var ue,B;return(B=(ue=r.current).onUnfriended)==null?void 0:B.call(ue,ne)},W=ne=>{var ue,B;return(B=(ue=r.current).onUserBlocked)==null?void 0:B.call(ue,ne)},G=ne=>{var ue,B;return(B=(ue=r.current).onUserUnblocked)==null?void 0:B.call(ue,ne)},$=ne=>{var ue,B;return(B=(ue=r.current).onGameInviteReceived)==null?void 0:B.call(ue,ne)},K=ne=>{var ue,B;return(B=(ue=r.current).onGameInviteCancelled)==null?void 0:B.call(ue,ne)},de=ne=>{var ue,B;return(B=(ue=r.current).onTurnOrderUpdated)==null?void 0:B.call(ue,ne)},ie=ne=>{var ue,B;return(B=(ue=r.current).onSpectatorsUpdated)==null?void 0:B.call(ue,ne)},we=ne=>{var ue,B;return(B=(ue=r.current).onPlayerProfileUpdated)==null?void 0:B.call(ue,ne)},he=ne=>{var ue,B;return(B=(ue=r.current).onPlayerPresenceUpdate)==null?void 0:B.call(ue,ne)},Ae=ne=>{var ue,B;return(B=(ue=r.current).onPokerMyHole)==null?void 0:B.call(ue,ne)},Fe=ne=>{var ue,B;return(B=(ue=r.current).onPokerWinners)==null?void 0:B.call(ue,ne)},U=ne=>{var ue,B;return(B=(ue=r.current).onPokerRevealAll)==null?void 0:B.call(ue,ne)},V=ne=>{var ue,B;return(B=(ue=r.current).onPokerTimedOut)==null?void 0:B.call(ue,ne)},z=ne=>{var ue,B;return(B=(ue=r.current).onPokerMyBalance)==null?void 0:B.call(ue,ne)},O=ne=>{var ue,B;return(B=(ue=r.current).onRoomUpdateState)==null?void 0:B.call(ue,ne)},q=ne=>ne&&(!ne.dice&&typeof ne.d1=="number"&&typeof ne.d2=="number"&&(ne.dice=[ne.d1,ne.d2]),ne.dice&&(typeof ne.d1!="number"||typeof ne.d2!="number")&&(ne.d1=ne.dice[0],ne.d2=ne.dice[1]),ne.shooterId!==void 0&&ne.currentRollerId===void 0&&(ne.currentRollerId=ne.shooterId),ne.nextShooterId!==void 0&&ne.nextRollerId===void 0&&(ne.nextRollerId=ne.nextShooterId),ne),X=ne=>{var ue,B;(B=(ue=r.current).onCrapsRollResult)==null||B.call(ue,q(ne))},Z=ne=>{var ue,B;(B=(ue=r.current).onCrapsReadyUpdate)==null||B.call(ue,ne)},Q=ne=>{var ue,B;(B=(ue=r.current).onCrapsBetsUpdate)==null||B.call(ue,ne)},oe=ne=>{var ue,B;(B=(ue=r.current).onCrapsBetDelta)==null||B.call(ue,ne)},ce=ne=>{var ue,B;(B=(ue=r.current).onCrapsBetResults)==null||B.call(ue,ne)},_e=ne=>{var ue,B;(B=(ue=r.current).onCrapsBetError)==null||B.call(ue,ne)},re=ne=>{var ue,B;(B=(ue=r.current).onCrapsPointSet)==null||B.call(ue,ne)},pe=ne=>{var ue,B;(B=(ue=r.current).onCrapsPointMade)==null||B.call(ue,ne)},ee=ne=>{var ue,B;return(B=(ue=r.current).onSkillsRejoinedRoom)==null?void 0:B.call(ue,ne)},xe=ne=>{var ue,B;return(B=(ue=r.current).onSkillsScoreUpdate)==null?void 0:B.call(ue,ne)},Le=ne=>{var ue,B;return(B=(ue=r.current).onSkillsRoundStart)==null?void 0:B.call(ue,ne)},Ge=ne=>{var ue,B;return(B=(ue=r.current).onSkillsRoundEnd)==null?void 0:B.call(ue,ne)},_t=ne=>{var ue,B;return(B=(ue=r.current).onSkillsSessionInfo)==null?void 0:B.call(ue,ne)},Xe=ne=>{var ue,B;return(B=(ue=r.current).onAnagramsWordFound)==null?void 0:B.call(ue,ne)},bt=ne=>{var ue,B;return(B=(ue=r.current).onTriviaAnswer)==null?void 0:B.call(ue,ne)},Pt=ne=>{var ue,B;return(B=(ue=r.current).onTriviaNextQuestion)==null?void 0:B.call(ue,ne)},kt=ne=>{var ue,B;return(B=(ue=r.current).onSkillsSpectatorState)==null?void 0:B.call(ue,ne)},Ee=ne=>{var ue,B;return(B=(ue=r.current).onSkillsSpectatorUpdate)==null?void 0:B.call(ue,ne)},le=ne=>{var ue,B;return(B=(ue=r.current).onSkillsSpectatorJoined)==null?void 0:B.call(ue,ne)},De=ne=>{var ue,B;return(B=(ue=r.current).onSkillsSpectatorLeft)==null?void 0:B.call(ue,ne)},Ye=ne=>{var ue,B;return(B=(ue=r.current).onSkillsWordClaimed)==null?void 0:B.call(ue,ne)},Re=()=>{t.on(vt.LOBBY_ROOMS,n),t.on(vt.ROOM_CREATED,s);try{t.on(vt.POKER_ROOM_CREATED,s)}catch{}try{t.on(vt.SKILLS_ROOM_CREATED,s)}catch{}t.on(vt.ROOM_UPDATED,o);try{t.on(vt.POKER_ROOM_UPDATED,o)}catch{}t.on(vt.ROOM_DELETED,i);try{t.on(vt.POKER_ROOM_DELETED,i)}catch{}t.on(vt.JOINED_ROOM,c);try{t.on(vt.POKER_JOINED_ROOM,c)}catch{}t.on(vt.REJOINED_ROOM,u),t.on(vt.OTHER_JOINED,p),t.on(vt.POKER_OTHER_JOINED,p),t.on(vt.OTHER_LEFT,d),t.on(vt.BANKER_CHANGED,f),t.on(vt.DICE_ROLLED,m),t.on(vt.NOT_YOUR_TURN,h),t.on(vt.OTA_UPDATE_AVAILABLE,b),t.on(vt.BETS_UPDATED,g),t.on(vt.GET_WAGERS,y),t.on(vt.PLAYER_BALANCE_UPDATED,x),t.on(vt.SIDE_BET_CREATED,v),t.on(vt.SIDE_BET_ACCEPTED,A),t.on(vt.SIDE_BET_CANCELED,_),t.on(vt.FORCE_LOGOUT,w),t.on(vt.ERROR,j),t.on(vt.RTC_SIGNAL,T),t.on(vt.RTC_PEER_JOINED,R),t.on(vt.RTC_PEER_LEFT,P),t.on(vt.RTC_CAMERA_OWNER_CHANGED,k),t.on(vt.RTC_VIDEO_ENABLED,E),t.on(vt.ROOM_MESSAGE,M),t.on(vt.ROOM_HISTORY,C),t.on(vt.DM_MESSAGE,I),t.on(vt.DM_HISTORY,L),t.on(vt.FAIRNESS_REVEAL,N),t.on(vt.FRIEND_REQUEST_RECEIVED,S),t.on(vt.FRIEND_REQUEST_CANCELLED,F),t.on(vt.FRIEND_REQUEST_RESPONDED,D),t.on(vt.UNFRIENDED,H),t.on(vt.USER_BLOCKED,W),t.on(vt.USER_UNBLOCKED,G),t.on(vt.GAME_INVITE_RECEIVED,$),t.on(vt.GAME_INVITE_CANCELLED,K),t.on(vt.TURN_ORDER_UPDATED,de),t.on(vt.SPECTATORS_UPDATED,ie),t.on(vt.PLAYER_PROFILE_UPDATED,we),t.on(vt.PLAYER_PRESENCE_UPDATE,he),t.on(vt.CRAPS_ROLL,X),t.on(vt.CRAPS_READY_UPDATE,Z),t.on(vt.CRAPS_BETS_UPDATE,Q),t.on(vt.CRAPS_BET_DELTA,oe),t.on(vt.CRAPS_BET_RESULTS,ce),t.on(vt.CRAPS_BET_ERROR,_e),t.on(vt.CRAPS_POINT_SET,re),t.on(vt.CRAPS_POINT_MADE,pe),t.on(vt.POKER_MY_HOLE,Ae),t.on(vt.POKER_WINNERS,Fe),t.on(vt.POKER_REVEAL_ALL,U),t.on(vt.POKER_TIMED_OUT,V),t.on(vt.POKER_MY_BALANCE,z),t.on(vt.ROOM_UPDATE_STATE,O);const ne=ue=>{var B,fe;return(fe=(B=r.current).onCrapsState)==null?void 0:fe.call(B,ue)};return t.on(vt.CRAPS_STATE,ne),t.on("skills:rejoined_room",ee),t.on(vt.SKILLS_SCORE_UPDATE,xe),t.on(vt.SKILLS_ROUND_START,Le),t.on(vt.SKILLS_ROUND_END,Ge),t.on("skills:session_info",_t),t.on("anagrams:word_found",Xe),t.on("trivia:answer",bt),t.on("trivia:next_question",Pt),t.on("skills:spectator_state",kt),t.on("skills:spectator_update",Ee),t.on("skills:spectator_joined",le),t.on("skills:spectator_left",De),t.on("skills:word_claimed",Ye),()=>{t.off(vt.LOBBY_ROOMS,n),t.off(vt.ROOM_CREATED,s);try{t.off(vt.POKER_ROOM_CREATED,s)}catch{}try{t.off(vt.SKILLS_ROOM_CREATED,s)}catch{}t.off(vt.ROOM_UPDATED,o);try{t.off(vt.POKER_ROOM_UPDATED,o)}catch{}t.off(vt.ROOM_DELETED,i);try{t.off(vt.POKER_ROOM_DELETED,i)}catch{}t.off(vt.JOINED_ROOM,c);try{t.off(vt.POKER_JOINED_ROOM,c)}catch{}t.off(vt.REJOINED_ROOM,u),t.off(vt.OTHER_JOINED,p);try{t.off(vt.POKER_OTHER_JOINED,p)}catch{}t.off(vt.OTHER_LEFT,d),t.off(vt.BANKER_CHANGED,f),t.off(vt.DICE_ROLLED,m),t.off(vt.NOT_YOUR_TURN,h),t.off(vt.OTA_UPDATE_AVAILABLE,b),t.off(vt.BETS_UPDATED,g),t.off(vt.GET_WAGERS,y),t.off(vt.PLAYER_BALANCE_UPDATED,x),t.off(vt.SIDE_BET_CREATED,v),t.off(vt.SIDE_BET_ACCEPTED,A),t.off(vt.SIDE_BET_CANCELED,_),t.off(vt.FORCE_LOGOUT,w),t.off(vt.ERROR,j),t.off(vt.RTC_SIGNAL,T),t.off(vt.RTC_PEER_JOINED,R),t.off(vt.RTC_PEER_LEFT,P),t.off(vt.RTC_CAMERA_OWNER_CHANGED,k),t.off(vt.RTC_VIDEO_ENABLED,E),t.off(vt.ROOM_MESSAGE,M),t.off(vt.ROOM_HISTORY,C),t.off(vt.DM_MESSAGE,I),t.off(vt.DM_HISTORY,L),t.off(vt.FAIRNESS_REVEAL,N),t.off(vt.FRIEND_REQUEST_RECEIVED,S),t.off(vt.FRIEND_REQUEST_CANCELLED,F),t.off(vt.FRIEND_REQUEST_RESPONDED,D),t.off(vt.UNFRIENDED,H),t.off(vt.USER_BLOCKED,W),t.off(vt.USER_UNBLOCKED,G),t.off(vt.GAME_INVITE_RECEIVED,$),t.off(vt.GAME_INVITE_CANCELLED,K),t.off(vt.TURN_ORDER_UPDATED,de),t.off(vt.SPECTATORS_UPDATED,ie),t.off(vt.PLAYER_PROFILE_UPDATED,we),t.off(vt.PLAYER_PRESENCE_UPDATE,he),t.off(vt.CRAPS_ROLL,X),t.off(vt.CRAPS_READY_UPDATE,Z),t.off(vt.CRAPS_BETS_UPDATE,Q),t.off(vt.CRAPS_BET_DELTA,oe),t.off(vt.CRAPS_BET_RESULTS,ce),t.off(vt.CRAPS_BET_ERROR,_e),t.off(vt.CRAPS_POINT_SET,re),t.off(vt.CRAPS_POINT_MADE,pe),t.off(vt.POKER_MY_HOLE,Ae),t.off(vt.POKER_WINNERS,Fe),t.off(vt.POKER_REVEAL_ALL,U),t.off(vt.POKER_TIMED_OUT,V),t.off(vt.POKER_MY_BALANCE,z),t.off(vt.ROOM_UPDATE_STATE,O),t.off(vt.CRAPS_STATE,ne),t.off("skills:rejoined_room",ee),t.off(vt.SKILLS_SCORE_UPDATE,xe),t.off(vt.SKILLS_ROUND_START,Le),t.off(vt.SKILLS_ROUND_END,Ge),t.off("skills:session_info",_t),t.off("anagrams:word_found",Xe),t.off("trivia:answer",bt),t.off("trivia:next_question",Pt),t.off("skills:spectator_state",kt),t.off("skills:spectator_update",Ee),t.off("skills:spectator_joined",le),t.off("skills:spectator_left",De),t.off("skills:word_claimed",Ye)}};let et=Re();const rt=()=>{try{et&&et()}catch{}et=Re();try{Cr(async()=>{const{reRegisterPushToken:ne}=await Promise.resolve().then(()=>Ake);return{reRegisterPushToken:ne}},void 0,import.meta.url).then(({reRegisterPushToken:ne})=>{ne()}).catch(()=>{})}catch{}};return t.on("connect",rt),t.on("reconnect",rt),()=>{t.off("connect",rt),t.off("reconnect",rt);try{et&&et()}catch{}}},[t])}function ib(){const{getRoomsList:e,createRoom:t,lobbyJoin:r,lobbyLeave:n}=sa(),[s,o]=l.useState({public:[],private:[]}),[i,c]=l.useState(!0),[u,p]=l.useState(null),{setMembershipModalOpen:d}=wm(),{resetSpin:f}=Ti(),m=globalThis.__lastRoomsFetchAt||(globalThis.__lastRoomsFetchAt={}),h=600,b=(T,R)=>{switch(T){case"skills":return`/skills/play?roomId=${R}`;case"zentara":return`/zentara/room/${R}`;case"cee-lo":return`/room/${R}`;case"craps":return`/room/${R}`;case"poker":return`/poker/room/${R}`;default:return`/room/${R}`}},g=l.useCallback(async()=>{const T=Date.now(),R=m.t||0;if(!(T-R<h)){m.t=T,c(!0),p(null);try{const P=await e();if(P!=null&&P.ok){const k=P.public&&P.private?{public:P.public,private:P.private}:null,E=P.data||P.roomsList||{},M=E.public&&E.private?{public:E.public,private:E.private}:null,C=k||M||{public:[],private:[]};o({public:Array.isArray(C.public)?C.public:[],private:Array.isArray(C.private)?C.private:[]})}else throw new Error((P==null?void 0:P.error)??"Failed to load rooms.")}catch(P){p((P==null?void 0:P.message)??"Failed to load rooms.")}finally{c(!1)}}},[e]),y=globalThis.__lobbyState||(globalThis.__lobbyState={refCount:0,joined:!1}),x=l.useCallback(async(T=!1)=>{y.refCount++,(!y.joined||T)&&(y.joined=!0,await r())},[r]),v=l.useCallback(async()=>{y.refCount=Math.max(0,y.refCount-1),y.refCount===0&&y.joined&&(y.joined=!1,await n())},[n]),A=globalThis.__createRoomGuard||(globalThis.__createRoomGuard={}),_=800,w=l.useCallback(async T=>{var M,C,I,L;const R=Date.now(),P=A.lastAt||0;if(R-P<_&&A.inFlight)try{return await A.inFlight}catch{}const k=async()=>{let S=0;if(R-P<_){const F=_-(R-P);await new Promise(D=>setTimeout(D,Math.max(50,F)))}for(;S<3;){S++;const F=await t({name:T.name,isPrivate:T.isPrivate,singlePlayer:T.singlePlayer,gameMode:T.gameMode,botLevel:T.botLevel,gameRules:T.gameRules});if(!F||F.ok===!0||(F==null?void 0:F.ok)===!1&&F.error!=="rate_limited"&&!/rate[_-]?limited/i.test(F.error||""))return F;const D=180*S,H=Math.floor(Math.random()*140);await new Promise(W=>setTimeout(W,D+H))}return t({name:T.name,isPrivate:T.isPrivate,singlePlayer:T.singlePlayer,gameMode:T.gameMode,botLevel:T.botLevel,gameRules:T.gameRules})};c(!0),p(null),A.lastAt=Date.now();const E=k();A.inFlight=E;try{const N=await E;if(!(N!=null&&N.ok))return N;const S=N.room||((M=N.roomsList)==null?void 0:M.room)||null;if(S){const F={roomId:S.roomId,name:S.name,createdAt:S.createdAt,maxPlayers:S.maxPlayers,currentPlayers:((C=S.players)==null?void 0:C.length)??1,phase:((I=S.gameState)==null?void 0:I.phase)??"waiting",private:!!S.private,gameMode:S.gameMode||((L=S.gameState)==null?void 0:L.gameMode)||"cee-lo"};o(D=>D.public.some(H=>H.roomId===F.roomId)||D.private.some(H=>H.roomId===F.roomId)?D:F.private?{...D,private:[F,...D.private]}:{...D,public:[F,...D.public]})}else await g();return f(),N}catch(N){const S=(N==null?void 0:N.message)??"Failed to create room.";throw p(S),N}finally{c(!1),A.inFlight=null}},[t,g,d,f]),j=Na();return l.useEffect(()=>(x(),()=>{v()}),[]),l.useEffect(()=>{if(!j)return;let T=!0;const R=async()=>{if(T){T=!1;return}console.log("[useLobbyRooms] socket reconnected, re-joining lobby and refreshing rooms"),await x(!0),await g()},P=()=>{y.joined=!1,console.log("[useLobbyRooms] socket disconnected, reset lobby joined state")};return j.on("connect",R),j.on("disconnect",P),()=>{j.off("connect",R),j.off("disconnect",P)}},[j,x,g]),l.useEffect(()=>{g()},[g]),Ba({onRoomCreated:T=>{o(R=>T.private?{...R,private:[T,...R.private.filter(P=>P.roomId!==T.roomId)]}:{...R,public:[T,...R.public.filter(P=>P.roomId!==T.roomId)]})},onRoomDeleted:({roomId:T})=>{o(R=>({public:R.public.filter(P=>P.roomId!==T),private:R.private.filter(P=>P.roomId!==T)}))},onRoomUpdated:T=>{o(R=>({public:R.public.map(P=>P.roomId===T.roomId?{...P,currentPlayers:T.currentPlayers??P.currentPlayers,phase:T.phase??P.phase}:P),private:R.private.map(P=>P.roomId===T.roomId?{...P,currentPlayers:T.currentPlayers??P.currentPlayers,phase:T.phase??P.phase}:P)}))}}),{roomsList:s,loading:i,error:u,refreshRooms:g,createRoom:w,getGameRoute:b}}const q8=[0,100,250,500,1e3,2500,5e3],V8=[15,30,45,60,90,120],H8=[{value:"wordsearch",label:"🔤 Word Search"},{value:"anagrams",label:"🔀 Anagrams"},{value:"trivia",label:"❓ Trivia"}];function W8({gameMode:e}){const[t,r]=l.useState(""),[n,s]=l.useState(2),[o,i]=l.useState(!1),[c,u]=l.useState(!1),[p,d]=l.useState(!1),[f,m]=l.useState(1e3),[h,b]=l.useState(100),[g,y]=l.useState(30),[x,v]=l.useState("wordsearch"),[A,_]=l.useState(!1),[w,j]=l.useState(!1),[T,R]=l.useState(!1),[P,k]=l.useState(null),[E,M]=l.useState(null),C=Hr(),{createRoom:I}=ib(),{pokerCreateRoom:L,skillsRoomCreate:N}=sa(),S=e==="skills",F=async D=>{var H,W,G;D.preventDefault(),k(null),R(!0);try{const $=e||"cee-lo";let K;if($==="zentara"?K=await I({name:t,maxPlayers:n,isPrivate:o,singlePlayer:c,gameMode:"zentara",gameRules:A||w?{disableRaid:A,disableSpyStrike:w}:void 0}):$==="poker"?K=await L({name:t,maxPlayers:n,isPrivate:o,singlePlayer:c,eliminationMode:p,startingStack:f}):$==="skills"?K=await N({name:t,maxPlayers:n,isPrivate:o,stake:h,duration:g,gameMode:x}):K=await I({name:t,maxPlayers:n,isPrivate:o,singlePlayer:c,gameMode:$}),!(K!=null&&K.ok))k((K==null?void 0:K.error)||"Failed to create room");else{const de=(K==null?void 0:K.room)??((H=K==null?void 0:K.roomsList)==null?void 0:H.room)??((W=K==null?void 0:K.data)==null?void 0:W.room)??null,ie=(de==null?void 0:de.roomId)??(de==null?void 0:de.id)??(K==null?void 0:K.roomId)??((G=K==null?void 0:K.data)==null?void 0:G.roomId);C(ie?$==="poker"?`/poker/room/${ie}`:$==="skills"?`/skills/room/${ie}`:$==="zentara"?`/zentara/room/${ie}`:`/room/${ie}`:$==="poker"?"/poker":$==="skills"?"/skills/play":$==="zentara"?"/zentara":"/")}}catch($){console.error($),k("Unexpected error")}finally{R(!1)}};return E?a.jsxs("div",{className:"create-room-success",children:[a.jsx("h2",{children:"Room Created!"}),a.jsxs("p",{children:["Your room ",a.jsx("strong",{children:E.name})," (ID: ",a.jsx("code",{children:E.roomId}),") has been created."]})]}):a.jsxs("form",{className:"create-room-form",onSubmit:F,children:[a.jsx("h2",{children:"Create a New Room"}),a.jsxs("label",{children:["Room Name",a.jsx("input",{type:"text",value:t,onChange:D=>r(D.target.value),required:!0,disabled:T,className:"create-room-input",placeholder:"Enter room name"})]}),a.jsxs("label",{children:["Max Players",a.jsx("input",{type:"number",value:n,min:2,max:S?4:10,className:"create-room-input",onChange:D=>s(Number(D.target.value)),required:!0,disabled:T})]}),S&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:["Game Mode",a.jsx("select",{value:x,onChange:D=>v(D.target.value),className:"create-room-input",disabled:T,children:H8.map(D=>a.jsx("option",{value:D.value,children:D.label},D.value))})]}),a.jsxs("label",{children:["Bet Amount",a.jsx("select",{value:h,onChange:D=>b(Number(D.target.value)),className:"create-room-input",disabled:T,children:q8.map(D=>a.jsx("option",{value:D,children:D===0?"Free Play":`${D.toLocaleString()} Credits`},D))})]}),a.jsxs("label",{children:["Game Duration",a.jsx("select",{value:g,onChange:D=>y(Number(D.target.value)),className:"create-room-input",disabled:T,children:V8.map(D=>a.jsxs("option",{value:D,children:[D," seconds"]},D))})]})]}),e==="poker"&&a.jsxs("label",{children:["Buy-In Amount",a.jsx("input",{type:"number",value:f,min:500,max:25e3,step:100,className:"create-room-input",onChange:D=>m(Math.max(500,Math.min(25e3,Number(D.target.value)))),required:!0,disabled:T})]}),e==="poker"&&!c&&a.jsxs("label",{className:"create-room-elim-toggle",children:[a.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:p,onChange:D=>d(D.target.checked),disabled:T}),"Elimination Mode",a.jsx("span",{className:"create-room-elim-hint",children:"Players lose shields on losses & get knocked out"})]}),e==="zentara"&&a.jsxs(a.Fragment,{children:[a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:A,onChange:D=>_(D.target.checked),disabled:T}),"Disable Resource Raid"]}),a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:w,onChange:D=>j(D.target.checked),disabled:T}),"Disable Spy Strike"]})]}),a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:o,onChange:D=>i(D.target.checked),disabled:T}),"Private room (invite only)"]}),P&&a.jsx("p",{className:"error",children:P}),a.jsx("button",{className:"felt-btn",type:"submit",disabled:T,children:T?"Creating...":"Create Room"})]})}function mI(e){l.useEffect(()=>{if(!(typeof document>"u")){if(e){try{kf(!0)}catch{}try{oo()}catch{}try{document.body.classList.add("modal-open")}catch{}}else{try{kf(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}return()=>{try{kf(!1)}catch{}try{document.body.classList.remove("modal-open")}catch{}}}},[e])}function G8({open:e,onClose:t,gameMode:r}){const[n,s]=l.useState(r||"cee-lo");mI(!!e),l.useEffect(()=>{const i=c=>{c.key==="Escape"&&t()};return e&&document.addEventListener("keydown",i),()=>document.removeEventListener("keydown",i)},[e,t]),l.useEffect(()=>{r&&s(r)},[r]);const o=n==="craps"?"Craps":n==="poker"?"Poker":n==="skills"?"Skills":n==="zentara"?"Zentara":"Cee‑Lo";return e?a.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:t,children:a.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Create a room",onClick:i=>i.stopPropagation(),children:[a.jsx("button",{className:"modal-close",onClick:t,"aria-label":"Close",children:"×"}),a.jsx("h3",{className:"modal-title",children:"Create a Room"}),a.jsxs("p",{"aria-live":"polite",className:"modal-subtitle",children:["Game mode: ",a.jsx("strong",{children:o})]}),a.jsx(W8,{gameMode:n})]})}):null}function OS({rooms:e,title:t,onJoinClick:r,spectateMode:n}){const s=Hr(),[o,i]=l.useState(null);if(e.length===0)return a.jsx("div",{className:"room-list",children:"No rooms available."});const c=async(u,p)=>{if(!o){i(u);try{if(r&&await r(),n&&p==="skills")return s(`/skills/spectate/${u}`);if(p==="poker")return s(`/poker/room/${u}`);if(p==="skills")return s(`/skills/room/${u}`);if(p==="zentara")return s(`/zentara/room/${u}`);s(`/room/${u}`)}catch(d){console.error("[RoomList] join failed:",d),i(null)}}};return a.jsxs("div",{className:"room-list",children:[a.jsx("h3",{children:t}),a.jsx("ul",{children:[...new Set(e)].filter(u=>!u.singlePlayer&&!u.quickMatch).map(u=>a.jsxs("li",{className:"room-list__item",children:[a.jsxs("div",{className:"room-list__info",children:[a.jsx("span",{className:"room-list__name",children:u.name}),u.private&&a.jsx("span",{className:"room-list__private",children:"🔒"}),a.jsxs("span",{className:"room-list__players",children:[u.currentPlayers,"/",u.maxPlayers]}),a.jsx("span",{className:"room-list__phase",children:u.phase??"waiting"}),u.gameMode&&a.jsx("span",{className:"room-list__mode",title:"Game Mode",children:u.gameMode}),u.gameMode==="skills"&&a.jsxs(a.Fragment,{children:[typeof u.stake=="number"&&a.jsxs("span",{className:"room-list__stake",title:"Bet Amount",children:["💰 ",u.stake===0?"Free":u.stake.toLocaleString()]}),typeof u.duration=="number"&&a.jsxs("span",{className:"room-list__duration",title:"Game Duration",children:["⏱️ ",u.duration,"s"]})]}),a.jsx("span",{className:"room-list__created",children:new Date(u.createdAt).toLocaleTimeString()})]}),a.jsx("button",{className:`btn btn--join ${n&&u.gameMode==="skills"?"btn--spectate":""} ${o===u.roomId?"btn--loading":""}`,"data-game-mode":u.gameMode,onClick:()=>c(u.roomId,u.gameMode),disabled:o!==null,children:o===u.roomId?a.jsx("span",{className:"btn-spinner"}):n&&u.gameMode==="skills"?"👁️ Spectate":"Join"})]},u.roomId))})]})}function X8({open:e,onClose:t,isPrivate:r,setIsPrivate:n,roomsList:s,onJoinClick:o,loading:i}){const c=l.useRef(null),[u,p]=l.useState(!1);return l.useEffect(()=>{if(!e)return;const d=m=>{m.key==="Escape"&&t()},f=m=>{c.current&&!c.current.contains(m.target)&&t()};return document.addEventListener("keydown",d),document.addEventListener("mousedown",f),()=>{document.removeEventListener("keydown",d),document.removeEventListener("mousedown",f)}},[e,t]),e?a.jsx("div",{className:"modal-backdrop",role:"presentation",children:a.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Browse Rooms",ref:c,children:[a.jsx("button",{className:"modal-close",onClick:t,"aria-label":"Close",children:"×"}),a.jsx("h3",{className:"modal-title",children:"Browse Rooms"}),a.jsxs("div",{style:{display:"flex",gap:16,marginBottom:12,flexWrap:"wrap"},children:[a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:r,onChange:d=>n(d.target.checked)}),a.jsxs("span",{children:[r?"Private":"Public"," Rooms"]})]}),a.jsxs("label",{style:{display:"inline-flex",alignItems:"center",gap:8},children:[a.jsx("input",{type:"checkbox",className:"create-room-checkbox",checked:u,onChange:d=>p(d.target.checked)}),a.jsx("span",{children:"👁️ Spectate Mode"})]})]}),i?a.jsx("div",{style:{display:"flex",justifyContent:"center",alignItems:"center",padding:"32px 0"},children:a.jsx("div",{className:"home-preloader__spinner",style:{width:32,height:32}})}):r?s.private.length?a.jsx(OS,{title:"Private Rooms",rooms:s.private,onJoinClick:o,spectateMode:u}):a.jsx("p",{children:"No private rooms available."}):s.public.length?a.jsx(OS,{title:"Public Rooms",rooms:s.public,onJoinClick:o,spectateMode:u}):a.jsx("p",{children:"No public rooms available."})]})}):null}function Y8({anchorRef:e,open:t,onClose:r,items:n}){const s=l.useRef(null);return l.useEffect(()=>{if(!t)return;const o=c=>{var f,m;const u=c.target,p=!!((f=s.current)!=null&&f.contains(u)),d=!!((m=e.current)!=null&&m.contains(u));!p&&!d&&r()},i=c=>{c.key==="Escape"&&r()};return document.addEventListener("mousedown",o,!0),document.addEventListener("keydown",i),()=>{document.removeEventListener("mousedown",o,!0),document.removeEventListener("keydown",i)}},[t,r,e]),t?a.jsx("div",{ref:s,className:"settings-menu",role:"menu","aria-orientation":"vertical",children:n.map(o=>a.jsxs("button",{className:"settings-menu__item",role:"menuitem",onClick:()=>{var i;(i=o.onClick)==null||i.call(o),r()},children:[o.label,(o.badge??0)>0&&a.jsx("span",{className:"settings-menu__badge",children:o.badge>99?"99+":o.badge})]},o.key))}):null}const Sa={diceAudio:!0,backgroundMusic:!0,chatAudio:!1,video:!1,showAnimations:!0,showCelebrationImages:!0,lastGameMode:"cee-lo",diceColorTheme:"dice_white_black",theme:"dark",zentaraBotCount:3},hI="app:settings:v1";async function ma(){try{const{value:e}=await Va.get({key:hI});if(!e)return{...Sa};const t=JSON.parse(e);return{...Sa,...t}}catch{return{...Sa}}}async function $i(e){await Va.set({key:hI,value:JSON.stringify(e)});try{window.dispatchEvent(new CustomEvent("app:settings",{detail:e}))}catch{}}const gI=Object.freeze(Object.defineProperty({__proto__:null,DEFAULT_SETTINGS:Sa,loadSettings:ma,saveSettings:$i},Symbol.toStringTag,{value:"Module"})),vs=Kl("App",{web:()=>Cr(()=>import("./web-B8_nOh3P.js"),__vite__mapDeps([7,1,2,3,4]),import.meta.url).then(e=>new e.AppWeb)}),xm=Object.freeze(Object.defineProperty({__proto__:null,App:vs},Symbol.toStringTag,{value:"Module"}));var Z8=Object.create,yI=Object.defineProperty,K8=Object.getOwnPropertyDescriptor,Q8=(e,t)=>(t=Symbol[e])?t:Symbol.for("Symbol."+e),bI=e=>{throw TypeError(e)},vI=(e,t,r)=>t in e?yI(e,t,{enumerable:!0,configurable:!0,writable:!0,value:r}):e[t]=r,J8=e=>[,,,Z8(null)],_I=["class","method","getter","setter","accessor","field","value","get","set"],wI=e=>e!==void 0&&typeof e!="function"?bI("Function expected"):e,$8=(e,t,r,n,s)=>({kind:_I[e],name:t,metadata:n,addInitializer:o=>r._?bI("Already initialized"):s.push(wI(o||null))}),eU=(e,t)=>vI(t,Q8("metadata"),e[3]),tU=(e,t,r,n)=>{for(var s=0,o=e[t>>1],i=o&&o.length;s<i;s++)o[s].call(r);return n},rU=(e,t,r,n,s,o)=>{for(var i,c,u,p,d=t&7,f=!1,m=!1,h=2,b=_I[d+5],g=e[h]||(e[h]=[]),y=(s=s.prototype,K8(s,r)),x=n.length-1;x>=0;x--)u=$8(d,r,c={},e[3],g),u.static=f,u.private=m,p=u.access={has:v=>r in v},p.get=v=>v[r],d>2,i=(0,n[x])(y[b],u),c._=1,wI(i)&&(y[b]=i);return y&&yI(s,r,y),s},ar=(e,t,r)=>vI(e,typeof t!="symbol"?t+"":t,r);const nU="5";typeof window<"u"&&(window.__svelte||(window.__svelte={v:new Set})).v.add(nU);const Ix=1,Nx=2,xI=4,aU=8,sU=16,oU=1,iU=2,lU=4,cU=8,uU=16,dU=1,pU=2,fU=4,mU=1,hU=2,Cs=Symbol(),$f="http://www.w3.org/2000/svg";function gU(e){return e.endsWith("capture")&&e!=="gotpointercapture"&&e!=="lostpointercapture"}const yU=["beforeinput","click","change","dblclick","contextmenu","focusin","focusout","input","keydown","keyup","mousedown","mousemove","mouseout","mouseover","mouseup","pointerdown","pointermove","pointerout","pointerover","pointerup","touchend","touchmove","touchstart"];function bU(e){return yU.includes(e)}const vU={formnovalidate:"formNoValidate",ismap:"isMap",nomodule:"noModule",playsinline:"playsInline",readonly:"readOnly",defaultvalue:"defaultValue",defaultchecked:"defaultChecked",srcobject:"srcObject"};function _U(e){return e=e.toLowerCase(),vU[e]??e}const wU=["touchstart","touchmove"];function xU(e){return wU.includes(e)}const AU=!1;var lb=Array.isArray,kU=Array.prototype.indexOf,Mx=Array.from,SU=Object.defineProperty,Nl=Object.getOwnPropertyDescriptor,AI=Object.getOwnPropertyDescriptors,EU=Object.prototype,PU=Array.prototype,Lx=Object.getPrototypeOf;function cd(e){return typeof e=="function"}const Rn=()=>{};function CU(e){return e()}function b0(e){for(var t=0;t<e.length;t++)e[t]()}const Uo=2,kI=4,Am=8,cb=16,Ho=32,km=64,Jg=128,mu=256,$g=512,Ls=1024,Ul=2048,Sm=4096,xi=8192,vp=16384,SI=32768,ec=65536,RU=1<<17,TU=1<<19,EI=1<<20,Ml=Symbol("$state"),PI=Symbol("legacy props"),jU=Symbol("");function CI(e){return e===this.v}function RI(e,t){return e!=e?t==t:e!==t||e!==null&&typeof e=="object"||typeof e=="function"}function Dx(e){return!RI(e,this.v)}function IU(e){throw new Error("https://svelte.dev/e/effect_in_teardown")}function NU(){throw new Error("https://svelte.dev/e/effect_in_unowned_derived")}function MU(e){throw new Error("https://svelte.dev/e/effect_orphan")}function LU(){throw new Error("https://svelte.dev/e/effect_update_depth_exceeded")}function DU(e){throw new Error("https://svelte.dev/e/props_invalid_value")}function OU(){throw new Error("https://svelte.dev/e/state_descriptors_fixed")}function zU(){throw new Error("https://svelte.dev/e/state_prototype_fixed")}function BU(){throw new Error("https://svelte.dev/e/state_unsafe_local_read")}function FU(){throw new Error("https://svelte.dev/e/state_unsafe_mutation")}let _p=!1,UU=!1;function qU(){_p=!0}function Gs(e,t){var r={f:0,v:e,reactions:null,equals:CI,rv:0,wv:0};return r}function $r(e){return TI(Gs(e))}function ub(e,t=!1){var r;const n=Gs(e);return t||(n.equals=Dx),_p&&kn!==null&&kn.l!==null&&((r=kn.l).s??(r.s=[])).push(n),n}function To(e,t=!1){return TI(ub(e,t))}function TI(e){return Ln!==null&&Ln.f&Uo&&(Ai===null?JU([e]):Ai.push(e)),e}function $t(e,t){return Ln!==null&&qx()&&Ln.f&(Uo|cb)&&(Ai===null||!Ai.includes(e))&&FU(),v0(e,t)}function v0(e,t){return e.equals(t)||(e.v,e.v=t,e.wv=GI(),jI(e,Ul),qx()&&on!==null&&on.f&Ls&&!(on.f&Ho)&&(ls!==null&&ls.includes(e)?(Wo(on,Ul),mb(on)):Ll===null?$U([e]):Ll.push(e))),t}function jI(e,t){var r=e.reactions;if(r!==null)for(var n=qx(),s=r.length,o=0;o<s;o++){var i=r[o],c=i.f;!(c&Ul)&&(!n&&i===on||(Wo(i,t),c&(Ls|mu)&&(c&Uo?jI(i,Sm):mb(i))))}}let Ox=!1;function Ir(e,t=null,r){if(typeof e!="object"||e===null||Ml in e)return e;const n=Lx(e);if(n!==EU&&n!==PU)return e;var s=new Map,o=lb(e),i=Gs(0);o&&s.set("length",Gs(e.length));var c;return new Proxy(e,{defineProperty(u,p,d){(!("value"in d)||d.configurable===!1||d.enumerable===!1||d.writable===!1)&&OU();var f=s.get(p);return f===void 0?(f=Gs(d.value),s.set(p,f)):$t(f,Ir(d.value,c)),!0},deleteProperty(u,p){var d=s.get(p);if(d===void 0)p in u&&s.set(p,Gs(Cs));else{if(o&&typeof p=="string"){var f=s.get("length"),m=Number(p);Number.isInteger(m)&&m<f.v&&$t(f,m)}$t(d,Cs),zS(i)}return!0},get(u,p,d){var f;if(p===Ml)return e;var m=s.get(p),h=p in u;if(m===void 0&&(!h||(f=Nl(u,p))!=null&&f.writable)&&(m=Gs(Ir(h?u[p]:Cs,c)),s.set(p,m)),m!==void 0){var b=ae(m);return b===Cs?void 0:b}return Reflect.get(u,p,d)},getOwnPropertyDescriptor(u,p){var d=Reflect.getOwnPropertyDescriptor(u,p);if(d&&"value"in d){var f=s.get(p);f&&(d.value=ae(f))}else if(d===void 0){var m=s.get(p),h=m==null?void 0:m.v;if(m!==void 0&&h!==Cs)return{enumerable:!0,configurable:!0,value:h,writable:!0}}return d},has(u,p){var d;if(p===Ml)return!0;var f=s.get(p),m=f!==void 0&&f.v!==Cs||Reflect.has(u,p);if(f!==void 0||on!==null&&(!m||(d=Nl(u,p))!=null&&d.writable)){f===void 0&&(f=Gs(m?Ir(u[p],c):Cs),s.set(p,f));var h=ae(f);if(h===Cs)return!1}return m},set(u,p,d,f){var m,h=s.get(p),b=p in u;if(o&&p==="length")for(var g=d;g<h.v;g+=1){var y=s.get(g+"");y!==void 0?$t(y,Cs):g in u&&(y=Gs(Cs),s.set(g+"",y))}h===void 0?(!b||(m=Nl(u,p))!=null&&m.writable)&&(h=Gs(void 0),$t(h,Ir(d,c)),s.set(p,h)):(b=h.v!==Cs,$t(h,Ir(d,c)));var x=Reflect.getOwnPropertyDescriptor(u,p);if(x!=null&&x.set&&x.set.call(f,d),!b){if(o&&typeof p=="string"){var v=s.get("length"),A=Number(p);Number.isInteger(A)&&A>=v.v&&$t(v,A+1)}zS(i)}return!0},ownKeys(u){ae(i);var p=Reflect.ownKeys(u).filter(m=>{var h=s.get(m);return h===void 0||h.v!==Cs});for(var[d,f]of s)f.v!==Cs&&!(d in u)&&p.push(d);return p},setPrototypeOf(){zU()}})}function zS(e,t=1){$t(e,e.v+t)}var BS,II,NI;function VU(){if(BS===void 0){BS=window;var e=Element.prototype,t=Node.prototype;II=Nl(t,"firstChild").get,NI=Nl(t,"nextSibling").get,e.__click=void 0,e.__className="",e.__attributes=null,e.__styles=null,e.__e=void 0,Text.prototype.__t=void 0}}function Em(e=""){return document.createTextNode(e)}function eu(e){return II.call(e)}function db(e){return NI.call(e)}function At(e,t){return eu(e)}function Ur(e,t){{var r=eu(e);return r instanceof Comment&&r.data===""?db(r):r}}function sr(e,t=1,r=!1){let n=e;for(;t--;)n=db(n);return n}function HU(e){e.textContent=""}function Tt(e){var t=Uo|Ul;on===null?t|=mu:on.f|=EI;var r=Ln!==null&&Ln.f&Uo?Ln:null;const n={children:null,ctx:kn,deps:null,equals:CI,f:t,fn:e,reactions:null,rv:0,v:null,wv:0,parent:r??on};return r!==null&&(r.children??(r.children=[])).push(n),n}function Rd(e){const t=Tt(e);return t.equals=Dx,t}function MI(e){var t=e.children;if(t!==null){e.children=null;for(var r=0;r<t.length;r+=1){var n=t[r];n.f&Uo?zx(n):bo(n)}}}function WU(e){for(var t=e.parent;t!==null;){if(!(t.f&Uo))return t;t=t.parent}return null}function LI(e){var t,r=on;Ds(WU(e));try{MI(e),t=XI(e)}finally{Ds(r)}return t}function DI(e){var t=LI(e),r=(Lc||e.f&mu)&&e.deps!==null?Sm:Ls;Wo(e,r),e.equals(t)||(e.v=t,e.wv=GI())}function zx(e){MI(e),tm(e,0),Wo(e,vp),e.v=e.children=e.deps=e.ctx=e.reactions=null}function OI(e){on===null&&Ln===null&&MU(),Ln!==null&&Ln.f&mu&&NU(),Ux&&IU()}function GU(e,t){var r=t.last;r===null?t.last=t.first=e:(r.next=e,e.prev=r,t.last=e)}function wp(e,t,r,n=!0){var s=(e&km)!==0,o=on,i={ctx:kn,deps:null,deriveds:null,nodes_start:null,nodes_end:null,f:e|Ul,first:null,fn:t,last:null,next:null,parent:s?null:o,prev:null,teardown:null,transitions:null,wv:0};if(r){var c=Td;try{FS(!0),Cm(i),i.f|=SI}catch(d){throw bo(i),d}finally{FS(c)}}else t!==null&&mb(i);var u=r&&i.deps===null&&i.first===null&&i.nodes_start===null&&i.teardown===null&&(i.f&EI)===0;if(!u&&!s&&n&&(o!==null&&GU(i,o),Ln!==null&&(Ln.f&Uo)!==0)){var p=Ln;(p.children??(p.children=[])).push(i)}return i}function zI(e){const t=wp(Am,null,!1);return Wo(t,Ls),t.teardown=e,t}function ep(e){OI();var t=on!==null&&(on.f&Ho)!==0&&kn!==null&&!kn.m;if(t){var r=kn;(r.e??(r.e=[])).push({fn:e,effect:on,reaction:Ln})}else{var n=pb(e);return n}}function XU(e){return OI(),fb(e)}function YU(e){const t=wp(km,e,!0);return(r={})=>new Promise(n=>{r.outro?tu(t,()=>{bo(t),n(void 0)}):(bo(t),n(void 0))})}function pb(e){return wp(kI,e,!1)}function Qo(e,t){var r=kn,n={effect:null,ran:!1};r.l.r1.push(n),n.effect=fb(()=>{e(),!n.ran&&(n.ran=!0,$t(r.l.r2,!0),al(t))})}function ZU(){var e=kn;fb(()=>{if(ae(e.l.r2)){for(var t of e.l.r1){var r=t.effect;r.f&Ls&&Wo(r,Sm),xp(r)&&Cm(r),t.ran=!1}e.l.r2.v=!1}})}function fb(e){return wp(Am,e,!0)}function rr(e){return tc(e)}function tc(e,t=0){return wp(Am|cb|t,e,!0)}function mo(e,t=!0){return wp(Am|Ho,e,!0,t)}function BI(e){var t=e.teardown;if(t!==null){const r=Ux,n=Ln;US(!0),vo(null);try{t.call(null)}finally{US(r),vo(n)}}}function FI(e){var t=e.deriveds;if(t!==null){e.deriveds=null;for(var r=0;r<t.length;r+=1)zx(t[r])}}function UI(e,t=!1){var r=e.first;for(e.first=e.last=null;r!==null;){var n=r.next;bo(r,t),r=n}}function KU(e){for(var t=e.first;t!==null;){var r=t.next;!(t.f&Ho)&&bo(t),t=r}}function bo(e,t=!0){var r=!1;if((t||e.f&TU)&&e.nodes_start!==null){for(var n=e.nodes_start,s=e.nodes_end;n!==null;){var o=n===s?null:db(n);n.remove(),n=o}r=!0}UI(e,t&&!r),FI(e),tm(e,0),Wo(e,vp);var i=e.transitions;if(i!==null)for(const u of i)u.stop();BI(e);var c=e.parent;c!==null&&c.first!==null&&qI(e),e.next=e.prev=e.teardown=e.ctx=e.deps=e.fn=e.nodes_start=e.nodes_end=null}function qI(e){var t=e.parent,r=e.prev,n=e.next;r!==null&&(r.next=n),n!==null&&(n.prev=r),t!==null&&(t.first===e&&(t.first=n),t.last===e&&(t.last=r))}function tu(e,t){var r=[];Bx(e,r,!0),VI(r,()=>{bo(e),t&&t()})}function VI(e,t){var r=e.length;if(r>0){var n=()=>--r||t();for(var s of e)s.out(n)}else t()}function Bx(e,t,r){if(!(e.f&xi)){if(e.f^=xi,e.transitions!==null)for(const i of e.transitions)(i.is_global||r)&&t.push(i);for(var n=e.first;n!==null;){var s=n.next,o=(n.f&ec)!==0||(n.f&Ho)!==0;Bx(n,t,o?r:!1),n=s}}}function em(e){HI(e,!0)}function HI(e,t){if(e.f&xi){xp(e)&&Cm(e),e.f^=xi;for(var r=e.first;r!==null;){var n=r.next,s=(r.f&ec)!==0||(r.f&Ho)!==0;HI(r,s?t:!1),r=n}if(e.transitions!==null)for(const o of e.transitions)(o.is_global||t)&&o.in()}}let _0=!1,w0=[];function QU(){_0=!1;const e=w0.slice();w0=[],b0(e)}function hu(e){_0||(_0=!0,queueMicrotask(QU)),w0.push(e)}function Fx(e){throw new Error("https://svelte.dev/e/lifecycle_outside_component")}let Pf=!1,ey=!1,ty=null,Td=!1,Ux=!1;function FS(e){Td=e}function US(e){Ux=e}let x0=[],Cf=0,Ln=null;function vo(e){Ln=e}let on=null;function Ds(e){on=e}let Ai=null;function JU(e){Ai=e}let ls=null,Vs=0,Ll=null;function $U(e){Ll=e}let WI=1,A0=0,Lc=!1,kn=null;function qS(e){kn=e}function GI(){return++WI}function qx(){return!_p||kn!==null&&kn.l===null}function xp(e){var t,r=e.f;if(r&Ul)return!0;if(r&Sm){var n=e.deps,s=(r&mu)!==0;if(n!==null){var o,i,c=(r&$g)!==0,u=s&&on!==null&&!Lc,p=n.length;if(c||u){for(o=0;o<p;o++)i=n[o],(c||!((t=i==null?void 0:i.reactions)!=null&&t.includes(e)))&&(i.reactions??(i.reactions=[])).push(e);c&&(e.f^=$g)}for(o=0;o<p;o++)if(i=n[o],xp(i)&&DI(i),i.wv>e.wv)return!0}(!s||on!==null&&!Lc)&&Wo(e,Ls)}return!1}function eq(e,t){for(var r=t;r!==null;){if(r.f&Jg)try{r.fn(e);return}catch{r.f^=Jg}r=r.parent}throw Pf=!1,e}function tq(e){return(e.f&vp)===0&&(e.parent===null||(e.parent.f&Jg)===0)}function mv(){Pf=!1}function Pm(e,t,r,n){if(Pf){if(r===null&&(Pf=!1),tq(t))throw e;return}r!==null&&(Pf=!0);{eq(e,t);return}}function XI(e){var t,r=ls,n=Vs,s=Ll,o=Ln,i=Lc,c=Ai,u=kn,p=e.f;ls=null,Vs=0,Ll=null,Ln=p&(Ho|km)?null:e,Lc=!Td&&(p&mu)!==0,Ai=null,kn=e.ctx,A0++;try{var d=(0,e.fn)(),f=e.deps;if(ls!==null){var m;if(tm(e,Vs),f!==null&&Vs>0)for(f.length=Vs+ls.length,m=0;m<ls.length;m++)f[Vs+m]=ls[m];else e.deps=f=ls;if(!Lc)for(m=Vs;m<f.length;m++)((t=f[m]).reactions??(t.reactions=[])).push(e)}else f!==null&&Vs<f.length&&(tm(e,Vs),f.length=Vs);return d}finally{ls=r,Vs=n,Ll=s,Ln=o,Lc=i,Ai=c,kn=u}}function rq(e,t){let r=t.reactions;if(r!==null){var n=kU.call(r,e);if(n!==-1){var s=r.length-1;s===0?r=t.reactions=null:(r[n]=r[s],r.pop())}}r===null&&t.f&Uo&&(ls===null||!ls.includes(t))&&(Wo(t,Sm),!(t.f&(mu|$g))&&(t.f^=$g),tm(t,0))}function tm(e,t){var r=e.deps;if(r!==null)for(var n=t;n<r.length;n++)rq(e,r[n])}function Cm(e){var t=e.f;if(!(t&vp)){Wo(e,Ls);var r=on,n=kn;on=e;try{t&cb?KU(e):UI(e),FI(e),BI(e);var s=XI(e);e.teardown=typeof s=="function"?s:null,e.wv=WI;var o=e.deps,i;AU&&UU&&e.f&Ul}catch(c){Pm(c,e,r,n||e.ctx)}finally{on=r}}}function nq(){if(Cf>1e3){Cf=0;try{LU()}catch(e){if(ty!==null)Pm(e,ty,null);else throw e}}Cf++}function aq(e){var t=e.length;if(t!==0){nq();var r=Td;Td=!0;try{for(var n=0;n<t;n++){var s=e[n];!(s.f&Ls)&&(s.f^=Ls);var o=[];YI(s,o),sq(o)}}finally{Td=r}}}function sq(e){var t=e.length;if(t!==0)for(var r=0;r<t;r++){var n=e[r];if(!(n.f&(vp|xi)))try{xp(n)&&(Cm(n),n.deps===null&&n.first===null&&n.nodes_start===null&&(n.teardown===null?qI(n):n.fn=null))}catch(s){Pm(s,n,null,n.ctx)}}}function oq(){if(ey=!1,Cf>1001)return;const e=x0;x0=[],aq(e),ey||(Cf=0,ty=null)}function mb(e){ey||(ey=!0,queueMicrotask(oq)),ty=e;for(var t=e;t.parent!==null;){t=t.parent;var r=t.f;if(r&(km|Ho)){if(!(r&Ls))return;t.f^=Ls}}x0.push(t)}function YI(e,t){var r=e.first,n=[];e:for(;r!==null;){var s=r.f,o=(s&Ho)!==0,i=o&&(s&Ls)!==0,c=r.next;if(!i&&!(s&xi))if(s&Am){if(o)r.f^=Ls;else try{xp(r)&&Cm(r)}catch(f){Pm(f,r,null,r.ctx)}var u=r.first;if(u!==null){r=u;continue}}else s&kI&&n.push(r);if(c===null){let f=r.parent;for(;f!==null;){if(e===f)break e;var p=f.next;if(p!==null){r=p;continue e}f=f.parent}}r=c}for(var d=0;d<n.length;d++)u=n[d],t.push(u),YI(u,t)}function ae(e){var t,r=e.f,n=(r&Uo)!==0;if(n&&r&vp){var s=LI(e);return zx(e),s}if(Ln!==null){Ai!==null&&Ai.includes(e)&&BU();var o=Ln.deps;e.rv<A0&&(e.rv=A0,ls===null&&o!==null&&o[Vs]===e?Vs++:ls===null?ls=[e]:ls.push(e),Ll!==null&&on!==null&&on.f&Ls&&!(on.f&Ho)&&Ll.includes(e)&&(Wo(on,Ul),mb(on)))}else if(n&&e.deps===null)for(var i=e,c=i.parent,u=i;c!==null;)if(c.f&Uo){var p=c;u=p,c=p.parent}else{var d=c;(t=d.deriveds)!=null&&t.includes(u)||(d.deriveds??(d.deriveds=[])).push(u);break}return n&&(i=e,xp(i)&&DI(i)),e.v}function al(e){const t=Ln;try{return Ln=null,e()}finally{Ln=t}}const iq=-7169;function Wo(e,t){e.f=e.f&iq|t}function fs(e){return ZI().get(e)}function hv(e,t){return ZI().set(e,t),t}function ZI(e){return kn===null&&Fx(),kn.c??(kn.c=new Map(lq(kn)||void 0))}function lq(e){let t=e.p;for(;t!==null;){const r=t.c;if(r!==null)return r;t=t.p}return null}function Lr(e,t=!1,r){kn={p:kn,c:null,e:null,m:!1,s:e,x:null,l:null},_p&&!t&&(kn.l={s:null,u:null,r1:[],r2:Gs(!1)})}function Dr(e){const t=kn;if(t!==null){e!==void 0&&(t.x=e);const i=t.e;if(i!==null){var r=on,n=Ln;t.e=null;try{for(var s=0;s<i.length;s++){var o=i[s];Ds(o.effect),vo(o.reaction),pb(o.fn)}}finally{Ds(r),vo(n)}}kn=t.p,t.m=!0}return e||{}}function xg(e){if(!(typeof e!="object"||!e||e instanceof EventTarget)){if(Ml in e)k0(e);else if(!Array.isArray(e))for(let t in e){const r=e[t];typeof r=="object"&&r&&Ml in r&&k0(r)}}}function k0(e,t=new Set){if(typeof e=="object"&&e!==null&&!(e instanceof EventTarget)&&!t.has(e)){t.add(e),e instanceof Date&&e.getTime();for(let n in e)try{k0(e[n],t)}catch{}const r=Lx(e);if(r!==Object.prototype&&r!==Array.prototype&&r!==Map.prototype&&r!==Set.prototype&&r!==Date.prototype){const n=AI(r);for(let s in n){const o=n[s].get;if(o)try{o.call(e)}catch{}}}}}function cq(e,t){if(t){const r=document.body;e.autofocus=!0,hu(()=>{document.activeElement===r&&e.focus()})}}function uq(e){var t=Ln,r=on;vo(null),Ds(null);try{return e()}finally{vo(t),Ds(r)}}const KI=new Set,S0=new Set;function QI(e,t,r,n){function s(o){if(n.capture||af.call(t,o),!o.cancelBubble)return uq(()=>r.call(this,o))}return e.startsWith("pointer")||e.startsWith("touch")||e==="wheel"?hu(()=>{t.addEventListener(e,s,n)}):t.addEventListener(e,s,n),s}function vi(e,t,r,n,s){var o={capture:n,passive:s},i=QI(e,t,r,o);(t===document.body||t===window||t===document)&&zI(()=>{t.removeEventListener(e,i,o)})}function hb(e){for(var t=0;t<e.length;t++)KI.add(e[t]);for(var r of S0)r(e)}function af(e){var t,r=this,n=r.ownerDocument,s=e.type,o=((t=e.composedPath)==null?void 0:t.call(e))||[],i=o[0]||e.target,c=0,u=e.__root;if(u){var p=o.indexOf(u);if(p!==-1&&(r===document||r===window)){e.__root=r;return}var d=o.indexOf(r);if(d===-1)return;p<=d&&(c=p)}if(i=o[c]||e.target,i!==r){SU(e,"currentTarget",{configurable:!0,get(){return i||n}});var f=Ln,m=on;vo(null),Ds(null);try{for(var h,b=[];i!==null;){var g=i.assignedSlot||i.parentNode||i.host||null;try{var y=i["__"+s];if(y!==void 0&&!i.disabled)if(lb(y)){var[x,...v]=y;x.apply(i,[e,...v])}else y.call(i,e)}catch(A){h?b.push(A):h=A}if(e.cancelBubble||g===r||g===null)break;i=g}if(h){for(let A of b)queueMicrotask(()=>{throw A});throw h}}finally{e.__root=r,delete e.currentTarget,vo(f),Ds(m)}}}function Vx(e){var t=document.createElement("template");return t.innerHTML=e,t.content}function ru(e,t){var r=on;r.nodes_start===null&&(r.nodes_start=e,r.nodes_end=t)}function Gt(e,t){var r=(t&mU)!==0,n=(t&hU)!==0,s,o=!e.startsWith("<!>");return()=>{s===void 0&&(s=Vx(o?e:"<!>"+e),r||(s=eu(s)));var i=n?document.importNode(s,!0):s.cloneNode(!0);if(r){var c=eu(i),u=i.lastChild;ru(c,u)}else ru(i,i);return i}}function Ii(e,t,r="svg"){var n=!e.startsWith("<!>"),s=`<${r}>${n?e:"<!>"+e}</${r}>`,o;return()=>{if(!o){var i=Vx(s),c=eu(i);o=eu(c)}var u=o.cloneNode(!0);return ru(u,u),u}}function Cn(e=""){{var t=Em(e+"");return ru(t,t),t}}function hn(){var e=document.createDocumentFragment(),t=document.createComment(""),r=Em();return e.append(t,r),ru(t,r),e}function Ze(e,t){e!==null&&e.before(t)}let ry=!0;function VS(e){ry=e}function cn(e,t){var r=t==null?"":typeof t=="object"?t+"":t;r!==(e.__t??(e.__t=e.nodeValue))&&(e.__t=r,e.nodeValue=r==null?"":r+"")}function E0(e,t){return dq(e,t)}const qu=new Map;function dq(e,{target:t,anchor:r,props:n={},events:s,context:o,intro:i=!0}){VU();var c=new Set,u=f=>{for(var m=0;m<f.length;m++){var h=f[m];if(!c.has(h)){c.add(h);var b=xU(h);t.addEventListener(h,af,{passive:b});var g=qu.get(h);g===void 0?(document.addEventListener(h,af,{passive:b}),qu.set(h,1)):qu.set(h,g+1)}}};u(Mx(KI)),S0.add(u);var p=void 0,d=YU(()=>{var f=r??t.appendChild(Em());return mo(()=>{if(o){Lr({});var m=kn;m.c=o}s&&(n.$$events=s),ry=i,p=e(f,n)||{},ry=!0,o&&Dr()}),()=>{var m;for(var h of c){t.removeEventListener(h,af);var b=qu.get(h);--b===0?(document.removeEventListener(h,af),qu.delete(h)):qu.set(h,b)}S0.delete(u),f!==r&&((m=f.parentNode)==null||m.removeChild(f))}});return P0.set(p,d),p}let P0=new WeakMap;function Ag(e,t){const r=P0.get(e);return r?(P0.delete(e),r(t)):Promise.resolve()}function gr(e,t,r=!1){var n=e,s=null,o=null,i=Cs,c=r?ec:0,u=!1;const p=(f,m=!0)=>{u=!0,d(m,f)},d=(f,m)=>{i!==(i=f)&&(i?(s?em(s):m&&(s=mo(()=>m(n))),o&&tu(o,()=>{o=null})):(o?em(o):m&&(o=mo(()=>m(n))),s&&tu(s,()=>{s=null})))};tc(()=>{u=!1,t(p),u||d(null,null)},c)}function tp(e,t){return t}function pq(e,t,r,n){for(var s=[],o=t.length,i=0;i<o;i++)Bx(t[i].e,s,!0);var c=o>0&&s.length===0&&r!==null;if(c){var u=r.parentNode;HU(u),u.append(r),n.clear(),_l(e,t[0].prev,t[o-1].next)}VI(s,()=>{for(var p=0;p<o;p++){var d=t[p];c||(n.delete(d.k),_l(e,d.prev,d.next)),bo(d.e,!c)}})}function rp(e,t,r,n,s,o=null){var i=e,c={flags:t,items:new Map,first:null},u=(t&xI)!==0;if(u){var p=e;i=p.appendChild(Em())}var d=null,f=!1;tc(()=>{var m=r(),h=lb(m)?m:m==null?[]:Mx(m),b=h.length;if(!(f&&b===0)){f=b===0;{var g=Ln;fq(h,c,i,s,t,(g.f&xi)!==0,n)}o!==null&&(b===0?d?em(d):d=mo(()=>o(i)):d!==null&&tu(d,()=>{d=null})),r()}})}function fq(e,t,r,n,s,o,i,c){var u,p,d,f,m=(s&aU)!==0,h=(s&(Ix|Nx))!==0,b=e.length,g=t.items,y=t.first,x=y,v,A=null,_,w=[],j=[],T,R,P,k;if(m)for(k=0;k<b;k+=1)T=e[k],R=i(T,k),P=g.get(R),P!==void 0&&((u=P.a)==null||u.measure(),(_??(_=new Set)).add(P));for(k=0;k<b;k+=1){if(T=e[k],R=i(T,k),P=g.get(R),P===void 0){var E=x?x.e.nodes_start:r;A=hq(E,t,A,A===null?t.first:A.next,T,R,k,n,s),g.set(R,A),w=[],j=[],x=A.next;continue}if(h&&mq(P,T,k,s),P.e.f&xi&&(em(P.e),m&&((p=P.a)==null||p.unfix(),(_??(_=new Set)).delete(P))),P!==x){if(v!==void 0&&v.has(P)){if(w.length<j.length){var M=j[0],C;A=M.prev;var I=w[0],L=w[w.length-1];for(C=0;C<w.length;C+=1)HS(w[C],M,r);for(C=0;C<j.length;C+=1)v.delete(j[C]);_l(t,I.prev,L.next),_l(t,A,I),_l(t,L,M),x=M,A=L,k-=1,w=[],j=[]}else v.delete(P),HS(P,x,r),_l(t,P.prev,P.next),_l(t,P,A===null?t.first:A.next),_l(t,A,P),A=P;continue}for(w=[],j=[];x!==null&&x.k!==R;)(o||!(x.e.f&xi))&&(v??(v=new Set)).add(x),j.push(x),x=x.next;if(x===null)continue;P=x}w.push(P),A=P,x=P.next}if(x!==null||v!==void 0){for(var N=v===void 0?[]:Mx(v);x!==null;)(o||!(x.e.f&xi))&&N.push(x),x=x.next;var S=N.length;if(S>0){var F=s&xI&&b===0?r:null;if(m){for(k=0;k<S;k+=1)(d=N[k].a)==null||d.measure();for(k=0;k<S;k+=1)(f=N[k].a)==null||f.fix()}pq(t,N,F,g)}}m&&hu(()=>{var D;if(_!==void 0)for(P of _)(D=P.a)==null||D.apply()}),on.first=t.first&&t.first.e,on.last=A&&A.e}function mq(e,t,r,n){n&Ix&&v0(e.v,t),n&Nx?v0(e.i,r):e.i=r}function hq(e,t,r,n,s,o,i,c,u,p){var d=(u&Ix)!==0,f=(u&sU)===0,m=d?f?ub(s):Gs(s):s,h=u&Nx?Gs(i):i,b={i:h,v:m,k:o,a:null,e:null,prev:r,next:n};try{return b.e=mo(()=>c(e,m,h),Ox),b.e.prev=r&&r.e,b.e.next=n&&n.e,r===null?t.first=b:(r.next=b,r.e.next=b.e),n!==null&&(n.prev=b,n.e.prev=b.e),b}finally{}}function HS(e,t,r){for(var n=e.next?e.next.e.nodes_start:r,s=t?t.e.nodes_start:r,o=e.e.nodes_start;o!==n;){var i=db(o);s.before(o),o=i}}function _l(e,t,r){t===null?e.first=r:(t.next=r,t.e.next=r&&r.e),r!==null&&(r.prev=t,r.e.prev=t&&t.e)}function rc(e,t,r,n,s){var o=e,i="",c;tc(()=>{i!==(i=t()??"")&&(c!==void 0&&(bo(c),c=void 0),i!==""&&(c=mo(()=>{var u=i+"",p=Vx(u);ru(eu(p),p.lastChild),o.before(p)})))})}function gq(e,t,r,n,s){var o,i=(o=t.$$slots)==null?void 0:o[r],c=!1;i===!0&&(i=t.children,c=!0),i===void 0||i(e,c?()=>n:n)}function ya(e,t,...r){var n=e,s=Rn,o;tc(()=>{s!==(s=t())&&(o&&(bo(o),o=null),o=mo(()=>s(n,...r)))},ec)}function yq(e,t,r){var n=e,s,o;tc(()=>{s!==(s=t())&&(o&&(tu(o),o=null),s&&(o=mo(()=>r(n,s))))},ec)}function ny(e,t,r,n,s,o){var i,c,u=null,p=e,d;tc(()=>{const f=t()||null;var m=f==="svg"?$f:null;f!==i&&(d&&(f===null?tu(d,()=>{d=null,c=null}):f===c?em(d):(bo(d),VS(!1))),f&&f!==c&&(d=mo(()=>{if(u=m?document.createElementNS(m,f):document.createElement(f),ru(u,u),n){var h=u.appendChild(Em());n(u,h)}on.nodes_end=u,p.before(u)})),i=f,i&&(c=i),VS(!0))},ec)}function Tr(e,t){hu(()=>{var r=e.getRootNode(),n=r.host?r:r.head??r.ownerDocument.head;if(!n.querySelector("#"+t.hash)){const s=document.createElement("style");s.id=t.hash,s.textContent=t.code,n.appendChild(s)}})}function JI(e){var t,r,n="";if(typeof e=="string"||typeof e=="number")n+=e;else if(typeof e=="object")if(Array.isArray(e)){var s=e.length;for(t=0;t<s;t++)e[t]&&(r=JI(e[t]))&&(n&&(n+=" "),n+=r)}else for(r in e)e[r]&&(n&&(n+=" "),n+=r);return n}function bq(){for(var e,t,r=0,n="",s=arguments.length;r<s;r++)(e=arguments[r])&&(t=JI(e))&&(n&&(n+=" "),n+=t);return n}function $I(e){return typeof e=="object"?bq(e):e??""}function vq(e,t){t?e.hasAttribute("selected")||e.setAttribute("selected",""):e.removeAttribute("selected")}function kr(e,t,r,n){var s=e.__attributes??(e.__attributes={});s[t]!==(s[t]=r)&&(t==="style"&&"__styles"in e&&(e.__styles={}),t==="loading"&&(e[jU]=r),r==null?e.removeAttribute(t):typeof r!="string"&&eN(e).includes(t)?e[t]=r:e.setAttribute(t,r))}function ay(e,t,r,n,s=!1,o=!1,i=!1){var c=t||{},u=e.tagName==="OPTION";for(var p in t)p in r||(r[p]=null);r.class&&(r.class=$I(r.class)),n!==void 0&&(r.class=r.class?r.class+" "+n:n);var d=eN(e),f=e.__attributes??(e.__attributes={});for(const x in r){let v=r[x];if(u&&x==="value"&&v==null){e.value=e.__value="",c[x]=v;continue}var m=c[x];if(v!==m){c[x]=v;var h=x[0]+x[1];if(h!=="$$"){if(h==="on"){const A={},_="$$"+x;let w=x.slice(2);var b=bU(w);if(gU(w)&&(w=w.slice(0,-7),A.capture=!0),!b&&m){if(v!=null)continue;e.removeEventListener(w,c[_],A),c[_]=null}if(v!=null)if(b)e[`__${w}`]=v,hb([w]);else{let j=function(T){c[x].call(this,T)};c[_]=QI(w,e,j,A)}else b&&(e[`__${w}`]=void 0)}else if(x==="style"&&v!=null)e.style.cssText=v+"";else if(x==="autofocus")cq(e,!!v);else if(x==="__value"||x==="value"&&v!=null)e.value=e[x]=e.__value=v;else if(x==="selected"&&u)vq(e,v);else{var g=x;s||(g=_U(g));var y=g==="defaultValue"||g==="defaultChecked";if(v==null&&!o&&!y)if(f[x]=null,g==="value"||g==="checked"){let A=e;if(g==="value"){let _=A.defaultValue;A.removeAttribute(g),A.defaultValue=_}else{let _=A.defaultChecked;A.removeAttribute(g),A.defaultChecked=_}}else e.removeAttribute(x);else y||d.includes(g)&&(o||typeof v!="string")?e[g]=v:typeof v!="function"&&kr(e,g,v)}x==="style"&&"__styles"in e&&(e.__styles={})}}}return c}var WS=new Map;function eN(e){var t=WS.get(e.nodeName);if(t)return t;WS.set(e.nodeName,t=[]);for(var r,n=e,s=Element.prototype;s!==n;){r=AI(n);for(var o in r)r[o].set&&t.push(o);n=Lx(n)}return t}function _q(e,t,r){var n=e.__className,s=tN(t,r);(n!==s||Ox)&&(s===""?e.removeAttribute("class"):e.setAttribute("class",s),e.__className=s)}function ql(e,t,r){var n=e.__className,s=tN(t,r);(n!==s||Ox)&&(t==null&&!r?e.removeAttribute("class"):e.className=s,e.__className=s)}function tN(e,t){return(e??"")+(t?" "+t:"")}function el(e,t,r){if(r){if(e.classList.contains(t))return;e.classList.add(t)}else{if(!e.classList.contains(t))return;e.classList.remove(t)}}const wq=()=>performance.now(),Yi={tick:e=>requestAnimationFrame(e),now:()=>wq(),tasks:new Set};function rN(){const e=Yi.now();Yi.tasks.forEach(t=>{t.c(e)||(Yi.tasks.delete(t),t.f())}),Yi.tasks.size!==0&&Yi.tick(rN)}function xq(e){let t;return Yi.tasks.size===0&&Yi.tick(rN),{promise:new Promise(r=>{Yi.tasks.add(t={c:e,f:r})}),abort(){Yi.tasks.delete(t)}}}function ah(e,t){e.dispatchEvent(new CustomEvent(t))}function Aq(e){if(e==="float")return"cssFloat";if(e==="offset")return"cssOffset";if(e.startsWith("--"))return e;const t=e.split("-");return t.length===1?t[0]:t[0]+t.slice(1).map(r=>r[0].toUpperCase()+r.slice(1)).join("")}function GS(e){const t={},r=e.split(";");for(const n of r){const[s,o]=n.split(":");if(!s||o===void 0)break;const i=Aq(s.trim());t[i]=o.trim()}return t}const kq=e=>e;function nN(e,t,r,n){var s=(e&dU)!==0,o=(e&pU)!==0,i=s&&o,c=(e&fU)!==0,u=i?"both":s?"in":"out",p,d=t.inert,f,m;function h(){var v=Ln,A=on;vo(null),Ds(null);try{return p??(p=r()(t,(n==null?void 0:n())??{},{direction:u}))}finally{vo(v),Ds(A)}}var b={is_global:c,in(){var v;if(t.inert=d,!s){m==null||m.abort(),(v=m==null?void 0:m.reset)==null||v.call(m);return}o||f==null||f.abort(),ah(t,"introstart"),f=C0(t,h(),m,1,()=>{ah(t,"introend"),f==null||f.abort(),f=p=void 0})},out(v){if(!o){v==null||v(),p=void 0;return}t.inert=!0,ah(t,"outrostart"),m=C0(t,h(),f,0,()=>{ah(t,"outroend"),v==null||v()})},stop:()=>{f==null||f.abort(),m==null||m.abort()}},g=on;if((g.transitions??(g.transitions=[])).push(b),s&&ry){var y=c;if(!y){for(var x=g.parent;x&&x.f&ec;)for(;(x=x.parent)&&!(x.f&cb););y=!x||(x.f&SI)!==0}y&&pb(()=>{al(()=>b.in())})}}function C0(e,t,r,n,s){var o=n===1;if(cd(t)){var i,c=!1;return hu(()=>{if(!c){var y=t({direction:o?"in":"out"});i=C0(e,y,r,n,s)}}),{abort:()=>{c=!0,i==null||i.abort()},deactivate:()=>i.deactivate(),reset:()=>i.reset(),t:()=>i.t()}}if(r==null||r.deactivate(),!(t!=null&&t.duration))return s(),{abort:Rn,deactivate:Rn,reset:Rn,t:()=>n};const{delay:u=0,css:p,tick:d,easing:f=kq}=t;var m=[];if(o&&r===void 0&&(d&&d(0,1),p)){var h=GS(p(0,1));m.push(h,h)}var b=()=>1-n,g=e.animate(m,{duration:u});return g.onfinish=()=>{var y=(r==null?void 0:r.t())??1-n;r==null||r.abort();var x=n-y,v=t.duration*Math.abs(x),A=[];if(v>0){if(p)for(var _=Math.ceil(v/16.666666666666668),w=0;w<=_;w+=1){var j=y+x*f(w/_),T=p(j,1-j);A.push(GS(T))}b=()=>{var R=g.currentTime;return y+x*f(R/v)},d&&xq(()=>{if(g.playState!=="running")return!1;var R=b();return d(R,1-R),!0})}g=e.animate(A,{duration:v,fill:"forwards"}),g.onfinish=()=>{b=()=>n,d==null||d(n,1-n),s()}},{abort:()=>{g&&(g.cancel(),g.effect=null,g.onfinish=Rn)},deactivate:()=>{s=Rn},reset:()=>{n===0&&(d==null||d(1,0))},t:()=>b()}}function XS(e,t){return e===t||(e==null?void 0:e[Ml])===t}function aN(e={},t,r,n){return pb(()=>{var s,o;return fb(()=>{s=o,o=[],al(()=>{e!==r(...o)&&(t(e,...o),s&&XS(r(...s),e)&&t(null,...s))})}),()=>{hu(()=>{o&&XS(r(...o),e)&&t(null,...o)})}}),e}function xo(e=!1){const t=kn,r=t.l.u;if(!r)return;let n=()=>xg(t.s);if(e){let s=0,o={};const i=Tt(()=>{let c=!1;const u=t.s;for(const p in u)u[p]!==o[p]&&(o[p]=u[p],c=!0);return c&&s++,s});n=()=>ae(i)}r.b.length&&XU(()=>{YS(t,n),b0(r.b)}),ep(()=>{const s=al(()=>r.m.map(CU));return()=>{for(const o of s)typeof o=="function"&&o()}}),r.a.length&&ep(()=>{YS(t,n),b0(r.a)})}function YS(e,t){if(e.l.s)for(const r of e.l.s)ae(r);t()}function sN(e,t){var r,n=(r=e.$$events)==null?void 0:r[t.type],s=lb(n)?n.slice():n==null?[]:[n];for(var o of s)o.call(this,t)}function _o(e){kn===null&&Fx(),_p&&kn.l!==null?Sq(kn).m.push(e):ep(()=>{const t=al(e);if(typeof t=="function")return t})}function Rm(e){kn===null&&Fx(),_o(()=>()=>al(e))}function Sq(e){var t=e.l;return t.u??(t.u={a:[],b:[],m:[]})}function Eq(e,t,r){if(e==null)return t(void 0),Rn;const n=al(()=>e.subscribe(t,r));return n.unsubscribe?()=>n.unsubscribe():n}let sh=!1;function Bs(e,t,r){const n=r[t]??(r[t]={store:null,source:ub(void 0),unsubscribe:Rn});if(n.store!==e)if(n.unsubscribe(),n.store=e??null,e==null)n.source.v=void 0,n.unsubscribe=Rn;else{var s=!0;n.unsubscribe=Eq(e,o=>{s?n.source.v=o:$t(n.source,o)}),s=!1}return ae(n.source)}function Fs(){const e={};return zI(()=>{for(var t in e)e[t].unsubscribe()}),e}function Pq(e){var t=sh;try{return sh=!1,[e(),sh]}finally{sh=t}}const Cq={get(e,t){if(!e.exclude.includes(t))return e.props[t]},set(e,t){return!1},getOwnPropertyDescriptor(e,t){if(!e.exclude.includes(t)&&t in e.props)return{enumerable:!0,configurable:!0,value:e.props[t]}},has(e,t){return e.exclude.includes(t)?!1:t in e.props},ownKeys(e){return Reflect.ownKeys(e.props).filter(t=>!e.exclude.includes(t))}};function nc(e,t,r){return new Proxy({props:e,exclude:t},Cq)}const Rq={get(e,t){let r=e.props.length;for(;r--;){let n=e.props[r];if(cd(n)&&(n=n()),typeof n=="object"&&n!==null&&t in n)return n[t]}},set(e,t,r){let n=e.props.length;for(;n--;){let s=e.props[n];cd(s)&&(s=s());const o=Nl(s,t);if(o&&o.set)return o.set(r),!0}return!1},getOwnPropertyDescriptor(e,t){let r=e.props.length;for(;r--;){let n=e.props[r];if(cd(n)&&(n=n()),typeof n=="object"&&n!==null&&t in n){const s=Nl(n,t);return s&&!s.configurable&&(s.configurable=!0),s}}},has(e,t){if(t===Ml||t===PI)return!1;for(let r of e.props)if(cd(r)&&(r=r()),r!=null&&t in r)return!0;return!1},ownKeys(e){const t=[];for(let r of e.props){cd(r)&&(r=r());for(const n in r)t.includes(n)||t.push(n)}return t}};function sl(...e){return new Proxy({props:e},Rq)}function ZS(e){for(var t=on,r=on;t!==null&&!(t.f&(Ho|km));)t=t.parent;try{return Ds(t),e()}finally{Ds(r)}}function _r(e,t,r,n){var s,o=(r&oU)!==0,i=!_p||(r&iU)!==0,c=(r&cU)!==0,u=(r&uU)!==0,p=!1,d;c?[d,p]=Pq(()=>e[t]):d=e[t];var f=Ml in e||PI in e,m=((s=Nl(e,t))==null?void 0:s.set)??(f&&c&&t in e?R=>e[t]=R:void 0),h=n,b=!0,g=!1,y=()=>(g=!0,b&&(b=!1,u?h=al(n):h=n),h);d===void 0&&n!==void 0&&(m&&i&&DU(),d=y(),m&&m(d));var x;if(i)x=()=>{var R=e[t];return R===void 0?y():(b=!0,g=!1,R)};else{var v=ZS(()=>(o?Tt:Rd)(()=>e[t]));v.f|=RU,x=()=>{var R=ae(v);return R!==void 0&&(h=void 0),R===void 0?h:R}}if(!(r&lU))return x;if(m){var A=e.$$legacy;return function(R,P){return arguments.length>0?((!i||!P||A||p)&&m(P?x():R),R):x()}}var _=!1,w=!1,j=ub(d),T=ZS(()=>Tt(()=>{var R=x(),P=ae(j);return _?(_=!1,w=!0,P):(w=!1,j.v=R)}));return o||(T.equals=Dx),function(R,P){if(arguments.length>0){const k=P?ae(T):i&&c?Ir(R):R;return T.equals(k)||(_=!0,$t(j,k),g&&h!==void 0&&(h=k),al(()=>ae(T))),R}return ae(T)}}function KS(e,t){var r=on,n=Ln,s=kn;Ds(e),vo(e),qS(e.ctx);try{t()}finally{Ds(r),vo(n),qS(s)}}function Tq(e,t,r){var n=e,s;tc(()=>{var o=on,i=!1;o.fn=c=>{var u=t.onerror;let p=t.failed;if(!u&&!p||i)throw c;var d=()=>{tu(s),KS(o,()=>{i=!1,s=mo(()=>r(n)),mv()})};u==null||u(c,d),s&&bo(s),p&&hu(()=>{KS(o,()=>{i=!0;try{s=mo(()=>{p(n,()=>c,()=>d)})}catch(f){Pm(f,o,null,o.ctx)}mv(),i=!1})})},s=mo(()=>r(n)),mv()},ec|Jg)}var Ra=(e=>(e[e.UnknownError=0]="UnknownError",e[e.UserCancelledError=1]="UserCancelledError",e[e.StoreProblemError=2]="StoreProblemError",e[e.PurchaseNotAllowedError=3]="PurchaseNotAllowedError",e[e.PurchaseInvalidError=4]="PurchaseInvalidError",e[e.ProductNotAvailableForPurchaseError=5]="ProductNotAvailableForPurchaseError",e[e.ProductAlreadyPurchasedError=6]="ProductAlreadyPurchasedError",e[e.ReceiptAlreadyInUseError=7]="ReceiptAlreadyInUseError",e[e.InvalidReceiptError=8]="InvalidReceiptError",e[e.MissingReceiptFileError=9]="MissingReceiptFileError",e[e.NetworkError=10]="NetworkError",e[e.InvalidCredentialsError=11]="InvalidCredentialsError",e[e.UnexpectedBackendResponseError=12]="UnexpectedBackendResponseError",e[e.InvalidAppUserIdError=14]="InvalidAppUserIdError",e[e.OperationAlreadyInProgressError=15]="OperationAlreadyInProgressError",e[e.UnknownBackendError=16]="UnknownBackendError",e[e.InvalidAppleSubscriptionKeyError=17]="InvalidAppleSubscriptionKeyError",e[e.IneligibleError=18]="IneligibleError",e[e.InsufficientPermissionsError=19]="InsufficientPermissionsError",e[e.PaymentPendingError=20]="PaymentPendingError",e[e.InvalidSubscriberAttributesError=21]="InvalidSubscriberAttributesError",e[e.LogOutWithAnonymousUserError=22]="LogOutWithAnonymousUserError",e[e.ConfigurationError=23]="ConfigurationError",e[e.UnsupportedError=24]="UnsupportedError",e[e.EmptySubscriberAttributesError=25]="EmptySubscriberAttributesError",e[e.CustomerInfoError=28]="CustomerInfoError",e[e.SignatureVerificationError=36]="SignatureVerificationError",e[e.InvalidEmailError=38]="InvalidEmailError",e))(Ra||{});class Rf{static getPublicMessage(t){switch(t){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(t){switch(t){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(t){return t in Tf?t:null}static convertPurchaseFlowErrorCodeToErrorCode(t){switch(t){case Mn.ErrorSettingUpPurchase:return 2;case Mn.ErrorChargingPayment:return 20;case Mn.NetworkError:return 10;case Mn.MissingEmailError:return 4;case Mn.AlreadyPurchasedError:return 6;default:return 0}}}var Tf=(e=>(e[e.BackendInvalidPlatform=7e3]="BackendInvalidPlatform",e[e.BackendInvalidEmail=7012]="BackendInvalidEmail",e[e.BackendStoreProblem=7101]="BackendStoreProblem",e[e.BackendCannotTransferPurchase=7102]="BackendCannotTransferPurchase",e[e.BackendInvalidReceiptToken=7103]="BackendInvalidReceiptToken",e[e.BackendInvalidAppStoreSharedSecret=7104]="BackendInvalidAppStoreSharedSecret",e[e.BackendInvalidPaymentModeOrIntroPriceNotProvided=7105]="BackendInvalidPaymentModeOrIntroPriceNotProvided",e[e.BackendProductIdForGoogleReceiptNotProvided=7106]="BackendProductIdForGoogleReceiptNotProvided",e[e.BackendInvalidPlayStoreCredentials=7107]="BackendInvalidPlayStoreCredentials",e[e.BackendInternalServerError=7110]="BackendInternalServerError",e[e.BackendEmptyAppUserId=7220]="BackendEmptyAppUserId",e[e.BackendInvalidAuthToken=7224]="BackendInvalidAuthToken",e[e.BackendInvalidAPIKey=7225]="BackendInvalidAPIKey",e[e.BackendBadRequest=7226]="BackendBadRequest",e[e.BackendPlayStoreQuotaExceeded=7229]="BackendPlayStoreQuotaExceeded",e[e.BackendPlayStoreInvalidPackageName=7230]="BackendPlayStoreInvalidPackageName",e[e.BackendPlayStoreGenericError=7231]="BackendPlayStoreGenericError",e[e.BackendUserIneligibleForPromoOffer=7232]="BackendUserIneligibleForPromoOffer",e[e.BackendInvalidAppleSubscriptionKey=7234]="BackendInvalidAppleSubscriptionKey",e[e.BackendSubscriberNotFound=7259]="BackendSubscriberNotFound",e[e.BackendInvalidSubscriberAttributes=7263]="BackendInvalidSubscriberAttributes",e[e.BackendInvalidSubscriberAttributesBody=7264]="BackendInvalidSubscriberAttributesBody",e[e.BackendProductIDsMalformed=7662]="BackendProductIDsMalformed",e[e.BackendAlreadySubscribedError=7772]="BackendAlreadySubscribedError",e[e.BackendPaymentGatewayGenericError=7773]="BackendPaymentGatewayGenericError",e[e.BackendOfferNotFound=7814]="BackendOfferNotFound",e[e.BackendNoMXRecordsFound=7834]="BackendNoMXRecordsFound",e[e.BackendInvalidOperationSession=7877]="BackendInvalidOperationSession",e[e.BackendPurchaseCannotBeCompleted=7878]="BackendPurchaseCannotBeCompleted",e[e.BackendEmailIsRequired=7879]="BackendEmailIsRequired",e[e.BackendGatewaySetupErrorStripeTaxNotActive=7898]="BackendGatewaySetupErrorStripeTaxNotActive",e[e.BackendGatewaySetupErrorInvalidTaxOriginAddress=7899]="BackendGatewaySetupErrorInvalidTaxOriginAddress",e[e.BackendGatewaySetupErrorMissingRequiredPermission=7900]="BackendGatewaySetupErrorMissingRequiredPermission",e[e.BackendGatewaySetupErrorSandboxModeOnly=7901]="BackendGatewaySetupErrorSandboxModeOnly",e))(Tf||{});class ra extends Error{constructor(t,r,n,s){super(r),ar(this,"toString",()=>`PurchasesError(code: ${Ra[this.errorCode]}, message: ${this.message})`),this.errorCode=t,this.underlyingErrorMessage=n,this.extra=s}static getForBackendError(t,r){const n=Rf.getErrorCodeForBackendErrorCode(t);return new ra(n,Rf.getPublicMessage(n),r,{backendErrorCode:t})}static getForPurchasesFlowError(t){return new ra(Rf.convertPurchaseFlowErrorCodeToErrorCode(t.errorCode),t.message,t.underlyingErrorMessage)}}class jq extends Error{constructor(){super("Purchases must be configured before calling getInstance")}}var sf=(e=>(e.Started="started",e.InProgress="in_progress",e.Succeeded="succeeded",e.Failed="failed",e))(sf||{}),ud=(e=>(e[e.SetupIntentCreationFailed=1]="SetupIntentCreationFailed",e[e.PaymentMethodCreationFailed=2]="PaymentMethodCreationFailed",e[e.PaymentChargeFailed=3]="PaymentChargeFailed",e[e.SetupIntentCompletionFailed=4]="SetupIntentCompletionFailed",e[e.AlreadyPurchased=5]="AlreadyPurchased",e))(ud||{}),Hs=(e=>(e[e.Silent=0]="Silent",e[e.Error=1]="Error",e[e.Warn=2]="Warn",e[e.Info=3]="Info",e[e.Debug=4]="Debug",e[e.Verbose=5]="Verbose",e))(Hs||{});class Jr{static setLogLevel(t){this.logLevel=t}static log(t,r=this.logLevel){const n=`[Purchases] ${t}`;if(!(this.logLevel<r||r===Hs.Silent))switch(r){case Hs.Error:console.error(n);break;case Hs.Warn:console.warn(n);break;case Hs.Info:console.info(n);break;case Hs.Debug:console.debug(n);break;case Hs.Verbose:console.debug(n);break}}static errorLog(t){this.log(t,Hs.Error)}static warnLog(t){this.log(t,Hs.Warn)}static infoLog(t){this.log(t,Hs.Info)}static debugLog(t){this.log(t,Hs.Debug)}static verboseLog(t){this.log(t,Hs.Verbose)}}ar(Jr,"logLevel",Hs.Silent);function Iq(e){var t;return e.operation.redemption_info?{redeemUrl:((t=e.operation.redemption_info)==null?void 0:t.redeem_url)??null}:null}var Mn=(e=>(e[e.ErrorSettingUpPurchase=0]="ErrorSettingUpPurchase",e[e.ErrorChargingPayment=1]="ErrorChargingPayment",e[e.UnknownError=2]="UnknownError",e[e.NetworkError=3]="NetworkError",e[e.MissingEmailError=4]="MissingEmailError",e[e.AlreadyPurchasedError=5]="AlreadyPurchasedError",e[e.StripeTaxNotActive=6]="StripeTaxNotActive",e[e.StripeInvalidTaxOriginAddress=7]="StripeInvalidTaxOriginAddress",e[e.StripeMissingRequiredPermission=8]="StripeMissingRequiredPermission",e))(Mn||{});class Un extends Error{constructor(t,r,n,s,o){super(r),this.errorCode=t,this.underlyingErrorMessage=n,this.purchasesErrorCode=s,this.extra=o}getErrorCode(){var t;return((t=this.extra)==null?void 0:t.backendErrorCode)??this.purchasesErrorCode??this.errorCode}static fromPurchasesError(t,r){var n;let s;return t.errorCode===Ra.ProductAlreadyPurchasedError?s=5:t.errorCode===Ra.InvalidEmailError?s=4:t.errorCode===Ra.NetworkError?s=3:s=Un.fromBackendErrorCode((n=t.extra)==null?void 0:n.backendErrorCode)??r,new Un(s,t.message,t.underlyingErrorMessage,t.errorCode,t.extra)}static fromBackendErrorCode(t){switch(t){case Tf.BackendGatewaySetupErrorStripeTaxNotActive:return 6;case Tf.BackendGatewaySetupErrorInvalidTaxOriginAddress:return 7;case Tf.BackendGatewaySetupErrorMissingRequiredPermission:return 8;default:return null}}}class Nq{constructor(t,r,n=10){ar(this,"operationSessionId",null),ar(this,"backend"),ar(this,"eventsTracker"),ar(this,"maxNumberAttempts"),ar(this,"waitMSBetweenAttempts",1e3),this.backend=t,this.eventsTracker=r,this.maxNumberAttempts=n}async checkoutStart(t,r,n,s,o,i){try{const c=this.eventsTracker.getTraceId(),u=await this.backend.postCheckoutStart(t,r,s,n,c,o,i);return this.operationSessionId=u.operation_session_id,u}catch(c){if(c instanceof ra)throw Un.fromPurchasesError(c,0);{const u="Unknown error starting purchase: "+String(c);throw Jr.errorLog(u),new Un(2,u)}}}async checkoutCalculateTax(t,r,n){const s=this.operationSessionId;if(!s)throw new Un(0,"No purchase started");try{return await this.backend.postCheckoutCalculateTax(s,t,r,n)}catch(o){if(o instanceof ra)throw Un.fromPurchasesError(o,0);{const i="Unknown error calculating tax: "+String(o);throw Jr.errorLog(i),new Un(2,i)}}}async checkoutComplete(t){const r=this.operationSessionId;if(!r)throw new Un(0,"No purchase started");try{return await this.backend.postCheckoutComplete(r,t)}catch(n){if(n instanceof ra)throw Un.fromPurchasesError(n,0);{const s="Unknown error starting purchase: "+String(n);throw Jr.errorLog(s),new Un(2,s)}}}async pollCurrentPurchaseForCompletion(){const t=this.operationSessionId;if(!t)throw new Un(0,"No purchase in progress");return new Promise((r,n)=>{const s=(o=1)=>{if(o>this.maxNumberAttempts){this.clearPurchaseInProgress(),n(new Un(2,"Max attempts reached trying to get successful purchase status"));return}this.backend.getCheckoutStatus(t).then(i=>{const c=i.operation.store_transaction_identifier,u=i.operation.product_identifier,p=i.operation.purchase_date?isNaN(Date.parse(i.operation.purchase_date))?null:new Date(i.operation.purchase_date):null;switch(i.operation.status){case sf.Started:case sf.InProgress:setTimeout(()=>s(o+1),this.waitMSBetweenAttempts);break;case sf.Succeeded:if(this.clearPurchaseInProgress(),!c||!u||!p){n(new Un(2,"Missing required fields in operation response."));return}r({redemptionInfo:Iq(i),operationSessionId:t,storeTransactionIdentifier:c,productIdentifier:u,purchaseDate:p});return;case sf.Failed:this.clearPurchaseInProgress(),this.handlePaymentError(i.operation.error,n)}}).catch(i=>{const c=Un.fromPurchasesError(i,3);n(c)})};s()})}clearPurchaseInProgress(){this.operationSessionId=null}handlePaymentError(t,r){if(t==null){r(new Un(2,"Got an error status but error field is empty."));return}switch(t.code){case ud.SetupIntentCreationFailed:r(new Un(0,"Setup intent creation failed"));return;case ud.PaymentMethodCreationFailed:r(new Un(0,"Payment method creation failed"));return;case ud.PaymentChargeFailed:r(new Un(1,"Payment charge failed"));return;case ud.SetupIntentCompletionFailed:r(new Un(0,"Setup intent completion failed"));return;case ud.AlreadyPurchased:r(new Un(5,"Purchased was already completed"));return;default:r(new Un(2,"Unknown error code received"));return}}}const Ks="rcb-ui-translator",jd="en",Mq={"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"},Lq={"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."},Dq={"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."},Oq={"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}} بتحصيل رسوم منك وفقًا لشروطها حتى تقوم بالإلغاء."},zq={"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."},Bq={"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}} 按照其条款向您收费，直到您取消订阅。"},Fq={"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}} 根據其條款向您收費，直到您取消為止。"},Uq={"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."},qq={"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."},Vq={"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."},Hq={"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."},Wq={"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."},Gq={"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."},Xq={"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."},Yq={"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}} να σας χρεώνει σύμφωνα με τους όρους της έως ότου ακυρώσετε."},Zq={"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}} לחייב אותך בהתאם לתנאים שלהם עד שתבטל."},Kq={"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}} को रद्द करने तक उनकी शर्तों के अनुसार आपसे शुल्क लेने की अनुमति देने के लिए सहमत हैं."},Qq={"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."},Jq={"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."},$q={"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}}が利用規約に従って課金することを許可することに同意したことになります。"},e7={"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}}이 약관에 따라 요금을 청구하는 데 동의하는 것입니다."},t7={"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."},r7={"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."},n7={"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."},a7={"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."},s7={"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."},o7={"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}} будет взимать с вас плату в соответствии с их условиями до тех пор, пока вы не отмените подписку."},i7={"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."},l7={"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."},c7={"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}} เรียกเก็บเงินจากคุณตามข้อกำหนดจนกว่าคุณจะยกเลิก"},u7={"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."},d7={"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}} стягувати з вас плату відповідно до їхніх умов, поки ви не скасуєте підписку."},p7={"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 vr=(e=>(e.PeriodsWeek="periods.week",e.PeriodsMonth="periods.month",e.PeriodsYear="periods.year",e.PeriodsDay="periods.day",e.PeriodsWeekShort="periods.weekShort",e.PeriodsMonthShort="periods.monthShort",e.PeriodsYearShort="periods.yearShort",e.PeriodsDayShort="periods.dayShort",e.PeriodsLifetime="periods.lifetime",e.PeriodsWeekPlural="periods.weekPlural",e.PeriodsMonthPlural="periods.monthPlural",e.PeriodsYearPlural="periods.yearPlural",e.PeriodsDayPlural="periods.dayPlural",e.PeriodsWeekFrequency="periods.weekFrequency",e.PeriodsMonthFrequency="periods.monthFrequency",e.PeriodsYearFrequency="periods.yearFrequency",e.PeriodsDayFrequency="periods.dayFrequency",e.PeriodsPerWeekFrequency="periods.perWeekFrequency",e.PeriodsPerMonthFrequency="periods.perMonthFrequency",e.PeriodsPerYearFrequency="periods.perYearFrequency",e.PeriodsPerDayFrequency="periods.perDayFrequency",e.PeriodsUnknownFrequency="periods.unknownFrequency",e.PeriodsWeekFrequencyPlural="periods.weekFrequencyPlural",e.PeriodsMonthFrequencyPlural="periods.monthFrequencyPlural",e.PeriodsYearFrequencyPlural="periods.yearFrequencyPlural",e.PeriodsDayFrequencyPlural="periods.dayFrequencyPlural",e.ProductInfoProductTitle="product_info.product_title",e.ProductInfoProductDescription="product_info.product_description",e.ProductInfoProductPrice="product_info.product_price",e.ProductInfoFreeTrialDuration="product_info.free_trial_duration",e.ProductInfoPriceAfterFreeTrial="product_info.price_after_free_trial",e.ProductInfoIntroPricePhaseAfterTrial="product_info.intro_price_phase_after_trial",e.ProductInfoIntroPricePhasePaidOnce="product_info.intro_price_phase_paid_once",e.ProductInfoIntroPricePhase="product_info.intro_price_phase",e.ProductInfoPriceAfterIntroPrice="product_info.price_after_intro_price",e.ProductInfoAfterTrial="product_info.after_trial",e.ProductInfoAfter="product_info.after",e.ProductInfoPriceTotalDueToday="product_info.total_due_today",e.ProductInfoSubscribeTo="product_info.subscribe_to",e.ProductInfoRenewalFrequency="product_info.renewal_frequency",e.ProductInfoContinuesUntilCancelled="product_info.continues_until_cancelled",e.ProductInfoCancelAnytime="product_info.cancel_anytime",e.PaymentEntryPagePaymentStepTitle="payment_entry_page.payment_step_title",e.PaymentEntryPageTrialSubscriptionTermsInfo="payment_entry_page.trial_subscription_terms_info",e.PaymentEntryPageSubscriptionTermsInfo="payment_entry_page.subscription_terms_info",e.PaymentEntryPageOtpTermsInfo="payment_entry_page.otp_terms_info",e.PaymentEntryPageSubscriptionInfo="payment_entry_page.subscription_info",e.PaymentEntryPageButtonPay="payment_entry_page.button_pay",e.PaymentEntryPageButtonStartTrial="payment_entry_page.button_start_trial",e.PaymentEntryPageButtonWithPrice="payment_entry_page.button_with_price",e.PaymentEntryPageButtonPaymentMethod="payment_entry_page.button_payment_method",e.PaymentEntryPageExpressCheckoutDivider="payment_entry_page.express_checkout_divider",e.SuccessPagePurchaseSuccessful="success_page.purchase_successful",e.SuccessPageButtonClose="success_page.button_close",e.ErrorPageCloseButtonTitle="error_page.close_button_title",e.ErrorPageIfErrorPersists="error_page.if_error_persists",e.ErrorPageTroubleAccessing="error_page.trouble_accessing",e.ErrorPageErrorTitleAlreadySubscribed="error_page.error_title_already_subscribed",e.ErrorPageErrorTitleAlreadyPurchased="error_page.error_title_already_purchased",e.ErrorPageErrorTitleOtherErrors="error_page.error_title_other_errors",e.ErrorPageErrorTitleStripeTaxNotActive="error_page.error_title_stripe_tax_not_active",e.ErrorPageErrorTitleStripeInvalidTaxOriginAddress="error_page.error_title_stripe_invalid_tax_origin_address",e.ErrorPageErrorTitleStripeMissingRequiredPermission="error_page.error_title_stripe_missing_required_permission",e.ErrorPageErrorMessageAlreadySubscribed="error_page.error_message_already_subscribed",e.ErrorPageErrorMessageAlreadyPurchased="error_page.error_message_already_purchased",e.ErrorPageErrorMessageMissingEmailError="error_page.error_message_missing_email_error",e.ErrorPageErrorMessageInvalidEmailError="error_page.error_message_invalid_email_error",e.ErrorPageErrorMessageNetworkError="error_page.error_message_network_error",e.ErrorPageErrorMessageErrorChargingPayment="error_page.error_message_error_charging_payment",e.ErrorPageErrorMessageErrorSettingUpPurchase="error_page.error_message_error_setting_up_purchase",e.ErrorPageErrorMessageUnknownError="error_page.error_message_unknown_error",e.ErrorPageErrorMessageInvalidTaxLocation="error_page.error_message_invalid_tax_location",e.ErrorPageErrorMessageStripeTaxNotActive="error_page.error_message_stripe_tax_not_active",e.ErrorPageErrorMessageStripeInvalidTaxOriginAddress="error_page.error_message_stripe_invalid_tax_origin_address",e.ErrorPageErrorMessageStripeMissingRequiredPermission="error_page.error_message_stripe_missing_required_permission",e.ErrorPageErrorMessageOnlyInSandbox="error_page.error_only_in_sandbox",e.ErrorButtonTryAgain="error_page.button_try_again",e.ErrorButtonClose="error_page.button_close",e.PaywallVariablesPricePerPeriod="paywall_variables.price_per_period",e.PaywallVariablesSubRelativeDiscount="paywall_variables.sub_relative_discount",e.PaywallVariablesTotalPriceAndPerMonth="paywall_variables.total_price_and_per_month",e.PricingDropdownShowDetails="pricing_dropdown.show_details",e.PricingDropdownHideDetails="pricing_dropdown.hide_details",e.PricingTotalExcludingTax="pricing_table.total_excluding_tax",e.PricingTableTrialEnds="pricing_table.trial_ends",e.PricingTableTotalDueToday="pricing_table.total_due_today",e.PricingTableTax="pricing_table.tax",e.PricingTableEnterBillingAddressToCalculate="pricing_table.enter_billing_address_to_calculate",e.PricingTableEnterStateOrPostalCodeToCalculate="pricing_table.enter_state_or_postal_code_to_calculate",e.PricingTableEnterPostalCodeToCalculate="pricing_table.enter_postal_code_to_calculate",e.NavbarHeaderDetails="navbar_header.details",e.NavbarBackButton="navbar_header.back_button",e.PriceUpdateTitle="price_update.title",e.PriceUpdateBaseMessage="price_update.base_message",e.PriceUpdateTrialMessage="price_update.trial_message",e.ApplePayFreeTrial="apple_pay.free_trial",e))(vr||{});const f7={en:Mq,es:Lq,it:Dq,ar:Oq,ca:zq,zh_Hans:Bq,zh_Hant:Fq,hr:Uq,cs:qq,da:Vq,nl:Hq,fi:Wq,fr:Gq,de:Xq,el:Yq,he:Zq,hi:Kq,hu:Qq,id:Jq,ja:$q,ko:e7,ms:t7,no:r7,pl:n7,pt:a7,ro:s7,ru:o7,sk:i7,sv:l7,th:c7,tr:u7,uk:d7,vi:p7};var Ka=(e=>(e.Year="year",e.Month="month",e.Week="week",e.Day="day",e))(Ka||{});function oN(e){const t=e.match(/^PT?([0-9]+)([MDYW])$/);if(!t||t.length<3)return Jr.errorLog(`Invalid ISO 8601 duration format: ${e}`),null;const r=parseInt(t[1]);switch(t[2]){case"Y":return{number:r,unit:"year"};case"M":return{number:r,unit:"month"};case"W":return{number:r,unit:"week"};case"D":return{number:r,unit:"day"};default:return Jr.errorLog(`Invalid ISO 8601 unit duration format: ${e}`),null}}function R0(e,t,r){if(!r)return null;let n=new Date(e);switch(t.unit){case"year":n.getDate()===29&&n.getMonth()===1&&t.number!==4?n.setFullYear(n.getFullYear()+t.number,n.getMonth(),28):n.setFullYear(n.getFullYear()+t.number,n.getMonth(),n.getDate());break;case"month":n.setMonth(n.getMonth()+t.number,n.getDate()),n.getDate()!==e.getDate()&&(n=new Date(e),n.setMonth(n.getMonth()+t.number+1,0));break;case"week":n.setDate(n.getDate()+t.number*7);break;case"day":n.setDate(n.getDate()+t.number);break}return n}const m7=e=>e/1e6,Dl=(e,t,r,n={})=>{const s=m7(e),o={style:"currency",currency:t,currencyDisplay:"symbol",...n,minimumFractionDigits:n.maximumFractionDigits};return new Intl.NumberFormat(r,o).format(s).replace("US$","$")},h7=(e,t)=>{const r=oN(e);return r?t.translatePeriod(r.number,r.unit)||`${r.number} ${r.unit}s`:e},g7=e=>{try{return e.charAt(0).toUpperCase()+e.slice(1)}catch{return e}},fd={noWhitespace:!1,short:!1},iN={useMultipleWords:!1};class gb{constructor(t={},r=jd,n=jd){ar(this,"locales",{}),this.selectedLocale=r,this.defaultLocale=n;const s={};Object.entries(f7).forEach(([o,i])=>{s[o]=new QS(i,o)}),this.locales=s,t&&this.override(t)}static fallback(){return new gb}override(t){Object.entries(t).forEach(([r,n])=>{this.locales[r]=new QS({...this.locales[r].labels||{},...n},this.getLanguageCodeString(r))})}formatPrice(t,r){const n={currencyDisplay:"narrowSymbol"};t===0&&(n.maximumFractionDigits=0);try{return Dl(t,r,this.locale,n)}catch{Jr.errorLog(`Failed to create a price formatter for locale: ${this.locale}`)}try{return Dl(t,r,this.fallbackLocale,n)}catch{Jr.errorLog(`Failed to create a price formatter for locale: ${this.fallbackLocale}`)}return Dl(t,r,jd,n)}get locale(){var t;return((t=this.getLocaleInstance(this.selectedLocale))==null?void 0:t.localeKey)||this.getLanguageCodeString(this.selectedLocale)}get fallbackLocale(){var t;return((t=this.getLocaleInstance(this.defaultLocale))==null?void 0:t.localeKey)||this.getLanguageCodeString(this.defaultLocale)}getLanguageCodeString(t){return t.split("_")[0].split("-")[0]}getLocaleInstance(t){const r=this.getLanguageCodeString(t);return this.locales[t]||this.locales[r]}translate(t,r){const n=this.getLocaleInstance(this.selectedLocale),s=this.getLocaleInstance(this.defaultLocale);return(n==null?void 0:n.translate(t,r))||(s==null?void 0:s.translate(t,r))||""}formatCountry(t){return new Intl.DisplayNames([this.locale],{type:"region"}).of(t)||t}translatePeriod(t,r,n=fd){const s=this.getLocaleInstance(this.selectedLocale),o=this.getLocaleInstance(this.defaultLocale);return(s==null?void 0:s.translatePeriod(t,r,n))||(o==null?void 0:o.translatePeriod(t,r,n))}translatePeriodUnit(t,r=fd){const n=this.getLocaleInstance(this.selectedLocale),s=this.getLocaleInstance(this.defaultLocale);return(n==null?void 0:n.translatePeriodUnit(t,r))||(s==null?void 0:s.translatePeriodUnit(t,r))}translatePeriodFrequency(t,r,n=iN){const s=this.getLocaleInstance(this.selectedLocale),o=this.getLocaleInstance(this.defaultLocale);return(s==null?void 0:s.translatePeriodFrequency(t,r,n))||(o==null?void 0:o.translatePeriodFrequency(t,r,n))}translateDate(t,r={}){const n=this.getLocaleInstance(this.selectedLocale),s=this.getLocaleInstance(this.defaultLocale);return(n==null?void 0:n.translateDate(t,r))||(s==null?void 0:s.translateDate(t,r))}}class QS{constructor(t={},r){this.labels=t,this.localeKey=r}replaceVariables(t,r){return Object.entries(r).reduce((n,[s,o])=>n.replace(`{{${s}}}`,`${o??""}`),t)}translate(t,r){const n=this.labels[t];if(n)return this.replaceVariables(n,r||{})}translatePeriod(t,r,n=fd){var s;const{noWhitespace:o,short:i}={...fd,...n},c=i?`periods.${r}Short`:Math.abs(t)===1?`periods.${r}`:`periods.${r}Plural`;return(s=this.translate(c,{amount:t.toString()}))==null?void 0:s.replace(" ",o?"":" ")}translatePeriodUnit(t,r=fd){var n;const{noWhitespace:s,short:o}={...fd,...r},i=`periods.${t}${o?"Short":""}`;return(n=this.translate(i,{amount:""}))==null?void 0:n.replace(" ",s?"":" ")}translatePeriodFrequency(t,r,n=iN){const s=n==null?void 0:n.useMultipleWords,o=Math.abs(t)===1?`periods.${s===!0?"per":""}${s?g7(r.toString()):r}Frequency`:`periods.${r}FrequencyPlural`;return this.translate(o,{amount:t.toString()})}translateDate(t,r={}){return t.toLocaleDateString(this.localeKey,r)}}qU();const y7=`<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 b7=Gt('<div style="color:var(--rc-color-primary);"><!></div>');function lN(e){var t=b7(),r=At(t);rc(r,()=>y7),Ze(e,t)}var T0;(function(e){e.body_s="p",e.body_m="p",e.body_l="p",e.body_xl="p",e.heading_xs="h6",e.heading_s="h5",e.heading_m="h4",e.heading_l="h3",e.heading_xl="h2",e.heading_xxl="h1"})(T0||(T0={}));var sy;(function(e){e[e.extra_light=100]="extra_light",e[e.thin=200]="thin",e[e.light=300]="light",e[e.regular=400]="regular",e[e.medium=500]="medium",e[e.semibold=600]="semibold",e[e.bold=700]="bold",e[e.extra_bold=800]="extra_bold",e[e.black=900]="black"})(sy||(sy={}));var oy;(function(e){e.body_s="13px",e.body_m="14px",e.body_l="15px",e.body_xl="16px",e.heading_xs="14px",e.heading_s="16px",e.heading_m="18px",e.heading_l="20px",e.heading_xl="26px",e.heading_xxl="32px"})(oy||(oy={}));var iy;(function(e){e.leading="start",e.center="center",e.trailing="end"})(iy||(iy={}));var j0;(function(e){e.vertical="column",e.horizontal="row",e.zlayer="zstack"})(j0||(j0={}));var I0;(function(e){e.top="flex-start",e.leading="flex-start",e.center="center",e.bottom="flex-end",e.trailing="flex-end"})(I0||(I0={}));var N0;(function(e){e.space_between="space-between",e.space_around="space-around",e.space_evenly="space-evenly",e.start="flex-start",e.center="center",e.end="flex-end"})(N0||(N0={}));const v7=["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"],_7=({value:e="",variableDictionary:t})=>t?v7.reduce((r,n)=>{var s;return r.replaceAll(`{{ ${n} }}`,((s=t[n])==null?void 0:s.toString())||"N/A")},e):e;function cN(e,t,r,n){var s;if(!e)return"";const o=(s=n[r])==null?void 0:s[e];return(n[t]||{})[e]?n[t][e]:o}function Hx({text_lid:e,locale:t,defaultLocale:r,labels:n,variableDictionary:s}){if(!e)return"";const o=cN(e,t,r,n);return _7({value:o,variableDictionary:s})}const Vu=[];function w7(e,t){return{subscribe:uN(e,t).subscribe}}function uN(e,t=Rn){let r=null;const n=new Set;function s(c){if(RI(e,c)&&(e=c,r)){const u=!Vu.length;for(const p of n)p[1](),Vu.push(p,e);if(u){for(let p=0;p<Vu.length;p+=2)Vu[p][0](Vu[p+1]);Vu.length=0}}}function o(c){s(c(e))}function i(c,u=Rn){const p=[c,u];return n.add(p),n.size===1&&(r=t(s,o)||Rn),c(e),()=>{n.delete(p),n.size===0&&r&&(r(),r=null)}}return{set:s,update:o,subscribe:i}}const dN=w7(!1,e=>{if(typeof window<"u"){const t=window.matchMedia("(prefers-color-scheme: dark)");e(t.matches);const r=n=>e(n.matches);return t.addEventListener("change",r),()=>t.removeEventListener("change",r)}return()=>{}}),fo="light",M0="#000000",x7="#FFFFFF";function JS(e,t){const r={[`--${t}-block-start`]:"0px",[`--${t}-inline-end`]:"0px",[`--${t}-block-end`]:"0px",[`--${t}-inline-start`]:"0px"};return!e||!t||Object.assign(r,{[`--${t}-block-start`]:`${e.top??0}px`,[`--${t}-inline-end`]:`${e.trailing??0}px`,[`--${t}-block-end`]:`${e.bottom??0}px`,[`--${t}-inline-start`]:`${e.leading??0}px`}),r}function A7(e){return T0[e]}function tl({colorMap:e,colorMode:t=fo,fallback:r="FFFFFF"}){if(!e)return r;const n=e[t]||e[fo];let s="";switch(n.type){case"hex":case"alias":return n.value??r;case"linear":return s=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`linear-gradient(${n.degrees}deg, ${s})`;case"radial":return s=(n.points||[]).map(o=>`${o.color} ${o.percent}%`).join(", "),`radial-gradient(${s})`;default:return r}}function pN(e,t=fo){if(!e)return"";const r=tl({colorMap:e.color,colorMode:t});return`${e.width}px solid ${r}`}function ly(e){return{"--border-start-start-radius":`${e.top_leading}px`,"--border-start-end-radius":`${e.top_trailing}px`,"--border-end-start-radius":`${e.bottom_leading}px`,"--border-end-end-radius":`${e.bottom_trailing}px`}}function yb({background_color:e,border:t,margin:r,padding:n,color:s,colorMode:o=fo,shape:i,shadow:c}){const u={"--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"initial","--text-color":"initial","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none"};return n&&Object.assign(u,JS(n,"padding")),r&&Object.assign(u,JS(r,"margin")),e&&(u["--background"]=tl({colorMap:e,colorMode:o,fallback:"transparent"})),s&&(u["--text-color"]=tl({colorMap:s,colorMode:o,fallback:M0})),t&&(u["--border"]=pN(t,o)),(i==null?void 0:i.type)==="rectangle"&&i.corners&&Object.assign(u,ly(i.corners)),(i==null?void 0:i.type)==="pill"&&Object.assign(u,ly({bottom_leading:9999,bottom_trailing:9999,top_leading:9999,top_trailing:9999})),c&&(u["--shadow"]=`${c.x}px ${c.y}px ${c.radius}px 
      ${tl({colorMap:c.color,colorMode:o,fallback:M0})}`),u}function $S(e){return e.type==="fixed"?`${e.value}px`:e.type==="fit"?"fit-content":e.type==="fill"?navigator.userAgent.match(/firefox|fxios/i)?"-moz-available":"-webkit-fill-available":"initial"}function Tm(e){const t={"--width":"initial","--height":"initial","--flex":"initial"},r=$S(e.width),n=$S(e.height),s=e.width.type==="fill"||e.height.type==="fill";return Object.assign(t,{"--width":r,"--height":n,"--flex":s?"initial":"0 1 auto"}),t}function fN(e){const t={"--inset":"initial","--transform":"initial"};switch(e.alignment){case"top_leading":t["--inset"]="0 auto auto 0";break;case"top":t["--inset"]="auto auto auto 50%",t["--transform"]="translate(-50%, 0)";break;case"top_trailing":t["--inset"]="0 0 auto auto";break;case"leading":t["--inset"]="50% 0 50% 0",t["--transform"]="translate(0, -50%)";break;case"center":t["--inset"]="50% auto auto 50%",t["--transform"]="translate(-50%, -50%)";break;case"trailing":t["--inset"]="50% 0 50% auto",t["--transform"]="translate(0, -50%)";break;case"bottom_leading":t["--inset"]="auto auto 0 0";break;case"bottom":t["--inset"]="auto 50% 0 auto",t["--transform"]="translate(50%, 0)";break;case"bottom_trailing":t["--inset"]="auto 0 0 auto";break}return t}function k7(e){const t={"--direction":"initial","--alignment":"initial","--distribution":"initial","--position":"relative","--inset":"initial","--transform":"initial"};return e.type!=="zlayer"&&(Object.assign(t,{"--direction":j0[e.type],"--alignment":I0[e.alignment]}),e.distribution&&Object.assign(t,{"--distribution":N0[e.distribution]})),t}function S7(e,t=fo){var r,n;const{font_size:s,horizontal_alignment:o,font_weight:i,font_name:c,color:u}=e,p={"--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(p,{"--text-align":iy[o]||iy.leading,"--font-weight":sy[i]||sy.regular,"--font-size":oy[s]||oy.body_m,"--font-family":c||"sans-serif"}),u&&(((r=u[t])==null?void 0:r.type)==="linear"||((n=u[t])==null?void 0:n.type)==="radial")&&Object.assign(p,{"--background-clip":"text","--text-fill-color":"transparent","--background":tl({colorMap:u,colorMode:t})}),p}function Qs(e){return Object.entries(e).map(([t,r])=>`${t}: ${r}`).join("; ")}function E7(e){const t=n=>{if(n.type==="package"&&n.is_selected_by_default)return n;if(n.components&&Array.isArray(n.components))for(const s of n.components){const o=t(s);if(o)return o}if(n.stack!==void 0){const s=t(n.stack);if(s)return s}},r=t(e.components_config.base.stack);if(r!==void 0)return r.package_id}const Wx=(e,t)=>t?P7(t).reduce((r,n)=>{var s;if(e){const o=((s=e==null?void 0:e.states)==null?void 0:s[n])||{};return{...r,...o}}return r},{}):{},P7=e=>e?Object.entries(e).reduce((t,[r,n])=>(n&&t.push(r),t),[]):[];function Ao(e,t){return e?t?Object.entries(e).reduce((r,[n,s])=>{const o=n.replace(/^--/,`${t}-`);return r[`--${o}`]=s,r},{}):e:{}}function C7(e){const{mask_shape:t,imageAspectRatio:r}=e;let n="";return(t==null?void 0:t.type)==="concave"?n=`M 0 0 
              H 100 
              V ${r*100} 
              Q 50 ${r*80} 0 ${r*100} 
              Z`:(t==null?void 0:t.type)==="convex"?n=`M 0 0 
              H 100 
              V ${r*80} 
              Q 50 ${r*120} 0 ${r*80} 
              Z`:n=`M 0 0 H 100 V ${r*100} H 0 Z`,n}const R7=e=>{const t={"--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px"};return e!=null&&e.corners&&Object.assign(t,ly(e.corners)),t};function T7(e){var t,r,n;if(((r=(t=e.color_overlay)==null?void 0:t[e.purchaseState.colorMode])==null?void 0:r.type)!=="linear")return{x1:"0%",y1:"0%",x2:"0%",y2:"0%"};const{color_overlay:s}=e,o=((n=s==null?void 0:s[fo])==null?void 0:n.degrees)||0,i="50%",c="0%",u=`${Math.round(50+Math.sin((o+90)*Math.PI/90)*50)}%`,p=`${Math.round(50-Math.cos((o+90)*Math.PI/90)*50)}%`;return{x1:i,y1:c,x2:u,y2:p}}const mN={light:{type:"hex",value:M0}},j7={light:{type:"hex",value:x7}},Gx=e=>{const{font_size:t="body_m",color:r=mN,background_color:n=j7,padding:s,margin:o,size:i,purchaseState:c}=e,u={"--width":"unset","--height":"unset","--text-align":"initial","--font-weight":"initial","--font-size":"initial","--font-family":"sans-serif","--background-clip":"unset","--text-fill-color":"unset","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--flex":"0 1 auto"},p=Wx(e.overrides,e.componentState),d=A7(t),f=S7({...e,...p},c.colorMode),m=yb({background_color:n,color:r,margin:o,padding:s,colorMode:c.colorMode,...p}),h=Tm({...i,...p}),b={...u,...m,...f,...h};return{textStyles:Ao(b,"text"),tagToRender:d}};function I7(e,t,r){const n={"--width":"unset","--height":"unset","--flex":"0 1 auto","--margin-block-start":"0px","--margin-inline-end":"0px","--margin-block-end":"0px","--margin-inline-start":"0px","--padding-block-start":"0px","--padding-inline-end":"0px","--padding-block-end":"0px","--padding-inline-start":"0px","--background":"transparent","--text-color":"inherit","--border":"none","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px","--shadow":"none","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(n,yb({background_color:r,...e}),Tm(t)),Object.assign(n,e.zStackChildStyles);const s=Ao(n,"text");return Qs(s)}function N7(e){const t={"--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:r,textStyles:n}=Gx(e);return Object.assign(t,n),{tagToRender:r,textStyles:Qs(t)}}function M7(e){return e?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((t,{regexp:r,output:n})=>t.replaceAll(r,n),e):""}const L7={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 hN(e,t){Lr(t,!0),Tr(e,L7);const r=_r(t,"styleVariables",3,""),n=_r(t,"component",3,"p");var s=hn(),o=Ur(s);ny(o,n,!1,(i,c)=>{let u;rr(()=>u=ay(i,u,{id:t.id,style:r(),class:"rc-pw-text-block"},"svelte-1wz4si8",i.namespaceURI===$f,i.nodeName.includes("-")));var p=hn(),d=Ur(p);ya(d,()=>t.children??Rn),Ze(c,p)}),Ze(e,s),Dr()}var D7=Gt('<span class="rc-pw-text-wrapper svelte-11gzifq"><!></span>');const O7={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 z7(e,t){Lr(t,!0),Tr(e,O7);const r=nc(t,["$$slots","$$events","$$legacy","id","labels","text_lid","purchaseState","variableDictionary","background_color","size"]),n=Tt(()=>N7({id:t.id,labels:t.labels,text_lid:t.text_lid,purchaseState:t.purchaseState,background_color:t.background_color,size:t.size,...r})),s=Tt(()=>ae(n).tagToRender),o=Tt(()=>ae(n).textStyles),i=Tt(()=>I7(r,t.size,t.background_color)),c=Tt(()=>Hx({text_lid:t.text_lid,locale:t.purchaseState.locale,defaultLocale:t.purchaseState.defaultLocale,labels:t.labels,variableDictionary:t.variableDictionary})),u=Tt(()=>M7(ae(c)));var p=D7(),d=At(p);hN(d,{get styleVariables(){return ae(o)},get component(){return ae(s)},get id(){return t.id},children:(f,m)=>{var h=hn(),b=Ur(h);rc(b,()=>ae(u)),Ze(f,h)},$$slots:{default:!0}}),rr(()=>kr(p,"style",ae(i))),Ze(e,p),Dr()}const B7=e=>{const{background_color:t,margin:r,padding:n,spacing:s,size:o,border:i,shape:c,shadow:u,dimension:p,componentState:d,overrides:f,purchaseState:m,zStackChildStyles:h}=e,b={"--flex":"0 1 auto","--height":"initial","--width":"initial","--spacing":`${s||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"},g=Wx(f,d);Object.assign(b,yb({background_color:t,margin:r,padding:n,border:i,colorMode:m.colorMode,shape:c,shadow:u,...g}),k7({...p,...g}),Tm({...o,...g})),Object.assign(b,h);const y=Ao(b,"stack");return Qs(y)};function F7(e){var t,r,n,s,o,i;const{badge:c}=e;if(!c)return"";const u={"--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(u,fN({alignment:c.alignment}),yb({...c,background_color:c.background_color,color:c.color,colorMode:e.purchaseState.colorMode})),c.style==="overlay"&&(u["--margin-block-start"]="0px",u["--margin-block-end"]="0px",u["--transform"]=oh(c,0,-(((t=e.border)==null?void 0:t.width)||0))),c.style==="edge_to_edge")if(u["--margin-block-start"]="0px",u["--margin-block-end"]="0px",u["--margin-inline-start"]="0px",u["--margin-inline-end"]="0px",c.alignment==="top"||c.alignment==="bottom"){u["--badge-width"]=`calc(100% + ${(((r=e.border)==null?void 0:r.width)||0)*2}px)`,u["--z-index"]="-1";const d=Math.max(((s=(n=e.shape)==null?void 0:n.corners)==null?void 0:s.top_leading)||0,((i=(o=e.shape)==null?void 0:o.corners)==null?void 0:i.top_trailing)||0);c.alignment==="top"&&(u["--padding-block-end"]=`${d+c.padding.bottom}px`,u["--transform"]=oh(c,d)),c.alignment==="bottom"&&(u["--padding-block-start"]=`${d+c.padding.top}px`,u["--transform"]=oh(c,-d))}else u["--transform"]=oh(c),Object.assign(u,U7(e));const p=Ao(u,"stack-badge");return Qs(p)}const eE={top_leading:"bottom_trailing",top_trailing:"bottom_leading",bottom_leading:"top_trailing",bottom_trailing:"top_leading"},tE={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 U7(e){var t,r,n;const s={"--border-end-start-radius":"0px","--border-end-end-radius":"0px","--border-start-start-radius":"0px","--border-start-end-radius":"0px"},{badge:o}=e;if(!o)return s;const i=((t=e.border)==null?void 0:t.width)||0,c=o.alignment;return s[tE[eE[c]]]=`${(r=o.shape)==null?void 0:r.corners[eE[c]]}px`,s[tE[c]]=`${((n=e.shape)==null?void 0:n.corners[c])-i}px`,s}function oh(e,t=0,r=0){if(!e)return"";if(e.style==="overlay"){if(e.alignment==="top_leading")return`translate(${r}px, calc(-50% + ${t}px))`;if(e.alignment==="top_trailing")return`translate(calc(0% - ${r}px), calc(-50% + ${t}px))`;if(e.alignment==="bottom_leading")return`translate(${r}px, calc(50% + ${t}px))`;if(e.alignment==="bottom_trailing")return`translate(calc(0% - ${r}px), calc(50% + ${t}px))`;if(e.alignment==="top")return`translate(calc(-50% + ${r}px), calc(-50% + ${t}px))`;if(e.alignment==="bottom")return`translate(calc(50% + ${r}px), calc(50% + ${t}px))`}if(e.style==="edge_to_edge"){if(e.alignment==="top")return`translate(calc(-50% + ${r}px), calc(-100% - ${t}px + 16px))`;if(e.alignment==="bottom")return`translate(calc(50% + ${r}px), calc(100% + ${t}px))`}return""}function q7(e){const{badge:t}=e;if(!t)return{tagToRender:"",textStyles:""};const{tagToRender:r,textStyles:n}=Gx({id:e.id,labels:e.labels,purchaseState:e.purchaseState,...t,components:[],type:"text",size:{width:{type:"fit"},height:{type:"fit"}},color:t==null?void 0:t.color,name:e.name}),s={...n,"--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px"},o=Qs(s);return{tagToRender:r,textStyles:o}}function V7(e){const{dimension:t}=e,r={"--inset":"initial","--transform":"initial","--position":"relative"};if(t.type!=="zlayer")return;const n=fN({...t});return Object.assign(r,{...n,"--position":"absolute"}),r}var H7=Gt('<span class="rc-pw-badge svelte-1b5bst5"><!></span>'),W7=Gt('<div class="rc-pw-stack-wrapper svelte-1b5bst5"><!> <div class="rc-pw-stack svelte-1b5bst5"></div></div>');const G7={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 jm(e,t){Lr(t,!0),Tr(e,G7);const r=nc(t,["$$slots","$$events","$$legacy","id","components","labels","onAction","purchaseState","variableDictionary","badge","zStackChildStyles"]),n=Tt(()=>B7({id:t.id,components:t.components,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,zStackChildStyles:t.zStackChildStyles,...r})),s=Tt(()=>F7({id:t.id,components:t.components,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,badge:t.badge,...r})),o=Tt(()=>V7({id:t.id,components:t.components,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,...r})),i=Tt(()=>{var b;return Hx({defaultLocale:t.purchaseState.defaultLocale,locale:t.purchaseState.locale,labels:t.labels,variableDictionary:t.variableDictionary,text_lid:(b=t.badge)==null?void 0:b.text_lid})}),c=Tt(()=>q7({id:t.id,components:t.components,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,variableDictionary:t.variableDictionary,badge:t.badge,...r})),u=Tt(()=>ae(c).tagToRender),p=Tt(()=>ae(c).textStyles);var d=W7(),f=At(d);{var m=b=>{var g=H7(),y=At(g);hN(y,{get styleVariables(){return ae(p)},get component(){return ae(u)},children:(x,v)=>{var A=Cn();rr(()=>cn(A,ae(i))),Ze(x,A)},$$slots:{default:!0}}),rr(()=>kr(g,"style",ae(s))),Ze(b,g)};gr(f,b=>{t.badge&&b(m)})}var h=sr(f,2);rp(h,21,()=>t.components,tp,(b,g,y)=>{var x=hn(),v=Ur(x);{var A=w=>{var j=Tt(()=>y>0?ae(o):void 0);cy(w,{get nodeData(){return ae(g)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary},get componentState(){return t.componentState},get zStackChildStyles(){return ae(j)}})},_=w=>{cy(w,{get nodeData(){return ae(g)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary},get componentState(){return t.componentState}})};gr(v,w=>{ae(o)?w(A):w(_,!1)})}Ze(b,x)}),rr(()=>{kr(d,"id",t.id),kr(d,"style",ae(n))}),Ze(e,d),Dr()}function X7({stack:e,zStackChildStyles:t}){var r,n;const s=((n=(r=e==null?void 0:e.size)==null?void 0:r.width)==null?void 0:n.type)==="fill"?"100%":"fit-content",o=Ao(t||{},"button");return Qs({...o,position:"var(--button-position, relative)",inset:"var(--button-inset, 0)",transform:"var(--button-transform, initial)",width:s})}const Y7={hash:"svelte-mx8s0a",code:""};function Z7(e,t){Lr(t,!0),Tr(e,Y7);const r=nc(t,["$$slots","$$events","$$legacy","stack","action","onAction","labels","purchaseState","variableDictionary"]),n=()=>{t.onAction&&t.onAction(t.action)},s=Tt(()=>X7({stack:t.stack,action:t.action,onAction:t.onAction,labels:t.labels,purchaseState:t.purchaseState,variableDictionary:t.variableDictionary,...r}));yN(e,{onclick:n,get style(){return ae(s)},class:"rc-pw-button",children:(o,i)=>{jm(o,sl(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}}))},$$slots:{default:!0}}),Dr()}function cy(e,t){Lr(t,!0);const r=Fs(),n=()=>Bs(dN,"$prefersDarkMode",r),s={stack:jm,text:z7,image:G9,button:Z7,purchase_button:Z9,package:$9,footer:gN,timeline:iV},o=m=>{if(s[m.type])return[s[m.type],m];const{fallback:h}=m;if(h&&s[h==null?void 0:h.type])return[s[h.type],h];throw new Error(`Invalid component type: ${m.type}`)},i=nc(t,["$$slots","$$events","$$legacy","nodeData","labels","onAction","purchaseState","variableDictionary","zStackChildStyles"]),c=Tt(()=>o(t.nodeData)),u=Tt(()=>ae(c)[0]),p=Tt(()=>ae(c)[1]);var d=hn(),f=Ur(d);return yq(f,()=>ae(u),(m,h)=>{h(m,sl(()=>ae(p)||{},{get labels(){return t.labels},get prefersDarkMode(){return n()},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary},get zStackChildStyles(){return t.zStackChildStyles}},()=>i,{children:(b,g)=>{var y=hn(),x=Ur(y);rp(x,17,()=>t.nodeData.components,tp,(v,A)=>{cy(v,sl({get nodeData(){return ae(A)},get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}},()=>i))}),Ze(b,y)},$$slots:{default:!0}}))}),Ze(e,d),Dr({getComponentClass:o})}function K7({background:e,colorMode:t}){const r={"--background":"initial"};(e==null?void 0:e.type)==="color"&&Object.assign(r,{"--background":tl({colorMap:e.value,colorMode:t,fallback:"transparent"})});const n=Ao(r,"paywall");return Qs(n)}function Q7(e,t){var r,n,s,o;if(((n=(r=e.components_config.base)==null?void 0:r.background)==null?void 0:n.type)!=="image")return"";const i=e.components_config.base.background;return((s=i.value[t])==null?void 0:s.original)||((o=i.value[fo])==null?void 0:o.original)}var J7=Gt('<div class="rc-pw-footer svelte-pg5jlz"><!></div>');const $7={hash:"svelte-pg5jlz",code:".rc-pw-footer.svelte-pg5jlz {position:sticky;bottom:0;transform:translateY(50%);width:100%;}"};function gN(e,t){Tr(e,$7);var r=J7(),n=At(r);jm(n,sl(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary},get onAction(){return t.onAction}})),rr(()=>kr(r,"id",t.id)),Ze(e,r)}var e9=Gt('<div class="rc-pw-paywall-background svelte-14bszwq"></div>'),t9=Gt('<div class="rc-pw-paywall-background rc-pw-image-container svelte-14bszwq"><img class="rc-pw-image svelte-14bszwq" alt=""></div>'),r9=Gt('<div class="rc-pw-paywall svelte-14bszwq"><!> <!> <!></div>');const n9={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 a9(e,t){Lr(t,!0),Tr(e,n9);const r=Fs(),n=()=>Bs(dN,"$prefersDarkMode",r),s=_r(t,"variablesPerPackage",19,()=>({}));let o=Ir({selectedPackageId:E7(t.paywallData),locale:t.selectedLocale||t.paywallData.default_locale,defaultLocale:t.paywallData.default_locale,variablesPerPackage:s(),colorMode:t.preferredColorMode||(n()?"dark":fo)}),i=$r(Ir(s()[o.selectedPackageId||""]));const c=(x,v)=>{var A;(A=t.onRestorePurchasesClicked)==null||A.call(t)},u=(x,v)=>{var A;(A=t.onBackClicked)==null||A.call(t)},p=(x,v)=>{var A,_;if(x.destination==="customer_center"&&((A=t.onVisitCustomerCenterClicked)==null||A.call(t)),!x.url)return;const w=cN(x.url.url_lid,o.locale,o.defaultLocale,t.paywallData.components_localizations);w&&((_=t.onNavigateToUrlClicked)==null||_.call(t,w))},d=(x,v)=>{o.selectedPackageId=v==null?void 0:v.packageId,v!=null&&v.packageId&&$t(i,Ir(s()[v.packageId]))},f=(x,v)=>{var A;o.selectedPackageId!==void 0&&((A=t.onPurchaseClicked)==null||A.call(t,o.selectedPackageId))},m=(x,v)=>{switch(x.type){case"select_package":d(x,v);break;case"navigate_to":p(x);break;case"navigate_back":u();break;case"restore_purchases":c();break;case"purchase":f();break}},h=Tt(()=>{var x;return K7({background:(x=t.paywallData.components_config.base)==null?void 0:x.background,colorMode:o.colorMode})}),b=Tt(()=>Q7(t.paywallData,o.colorMode));var g=hn(),y=Ur(g);Tq(y,{get onerror(){return t.onError}},x=>{var v=r9(),A=At(v);cy(A,{onAction:m,get nodeData(){return t.paywallData.components_config.base.stack},get labels(){return t.paywallData.components_localizations},get purchaseState(){return o},get variableDictionary(){return ae(i)}});var _=sr(A,2);{var w=P=>{gN(P,sl(()=>t.paywallData.components_config.base.sticky_footer,{get stack(){return t.paywallData.components_config.base.sticky_footer.stack},get labels(){return t.paywallData.components_localizations},get purchaseState(){return o},get variableDictionary(){return ae(i)},onAction:m}))};gr(_,P=>{t.paywallData.components_config.base.sticky_footer&&P(w)})}var j=sr(_,2);{var T=P=>{var k=e9();rr(()=>kr(k,"style",ae(h))),Ze(P,k)},R=P=>{var k=hn(),E=Ur(k);{var M=C=>{var I=t9(),L=At(I);rr(()=>kr(L,"src",ae(b))),Ze(C,I)};gr(E,C=>{var I;((I=t.paywallData.components_config.base.background)==null?void 0:I.type)==="image"&&C(M)},!0)}Ze(P,k)};gr(j,P=>{var k;((k=t.paywallData.components_config.base.background)==null?void 0:k.type)==="color"?P(T):P(R,!1)})}Ze(x,v)}),Ze(e,g),Dr()}const s9=(e,t)=>{var r;(r=t.onclick)==null||r.call(t)};var o9=Gt("<button><!></button>");const i9={hash:"svelte-1wpam0z",code:"button.svelte-1wpam0z {border:none;cursor:pointer;background:transparent;width:fit-content;}"};function yN(e,t){Lr(t,!0),Tr(e,i9);var r=o9();r.__click=[s9,t];var n=At(r);ya(n,()=>t.children??Rn),rr(()=>{ql(r,$I(t.class),"svelte-1wpam0z"),r.disabled=!t.onclick,kr(r,"style",t.style)}),Ze(e,r),Dr()}hb(["click"]);var l9=Gt('<div class="rcb-processing svelte-2j2b59"></div>');const c9={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 u9(e,t){Tr(e,c9);let r=_r(t,"size",8,"medium");const n={small:{width:"8px",offset:"10px"},medium:{width:"12px",offset:"20px"},large:{width:"16px",offset:"30px"}};var s=l9();rr(()=>kr(s,"style",`--shadow-offset: ${n[r()].offset??""}; --width: ${n[r()].width??""};`)),Ze(e,s)}var d9=Gt("<span><!></span>");const p9={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 f9(e,t){Lr(t,!0),Tr(e,p9);const r=_r(t,"size",3,"body-base");var n=d9(),s=At(n);ya(s,()=>t.children??Rn),rr(()=>ql(n,`rcb-typography rcb-typography-${r()??""} svelte-byrjto`)),Ze(e,n),Dr()}const m9={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"},h9={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"},bN={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},g9={...bN,"input-background":"color_form_bg",background:"color_form_bg"},y9={...bN,"input-background":"color_product_info_bg",background:"color_product_info_bg"},vN={"input-border-radius":"4px","input-button-border-radius":"8px"},b9={"input-border-radius":"0px","input-button-border-radius":"0px"},v9={"input-border-radius":"12px","input-button-border-radius":"9999px"},rE=vN,nE="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",Jo={regular:"400",medium:"500",semibold:"600"},lo={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},$o={120:"120%",130:"130%",140:"140%"},ei={tight:"0.20%",regular:"0"},wa={heading2xl:{fontSize:lo[28],lineHeight:$o[120],fontWeight:Jo.semibold,letterSpacing:ei.tight},headingXl:{fontSize:lo[24],lineHeight:$o[130],fontWeight:Jo.semibold,letterSpacing:ei.regular},headingLg:{fontSize:"20px",lineHeight:$o[130],fontWeight:Jo.semibold,letterSpacing:ei.regular},headingMd:{fontSize:"16px",lineHeight:$o[140],fontWeight:Jo.medium,letterSpacing:ei.regular},bodyBase:{fontSize:lo[16],lineHeight:$o[140],fontWeight:Jo.regular,letterSpacing:ei.regular},bodySmall:{fontSize:lo[14],lineHeight:$o[140],fontWeight:Jo.regular,letterSpacing:ei.regular},labelButton:{fontSize:lo[16],lineHeight:$o[140],fontWeight:Jo.regular,letterSpacing:ei.tight},labelDefault:{fontSize:lo[14],lineHeight:$o[140],fontWeight:Jo.regular,letterSpacing:ei.tight},captionDefault:{fontSize:lo[12],lineHeight:$o[140],fontWeight:Jo.regular,letterSpacing:ei.regular},captionLink:{fontSize:lo[12],lineHeight:$o[140],fontWeight:Jo.regular,letterSpacing:ei.regular}},ti={heading2xl:{...wa.heading2xl,fontSize:lo[36]},headingXl:{...wa.headingXl,fontSize:lo[32]},headingLg:{...wa.headingLg,fontSize:lo[24]},headingMd:{...wa.headingMd,fontSize:lo[18]},bodyBase:{...wa.bodyBase},bodySmall:{...wa.bodySmall},labelButton:{...wa.labelButton},labelDefault:{...wa.labelDefault},captionDefault:{...wa.captionDefault},captionLink:{...wa.captionLink}},_9={heading2xl:{mobile:wa.heading2xl,desktop:ti.heading2xl},headingXl:{desktop:ti.headingXl,mobile:wa.headingXl},headingLg:{desktop:ti.headingLg,mobile:wa.headingLg},headingMd:{desktop:ti.headingMd,mobile:wa.headingMd},bodyBase:{desktop:ti.bodyBase,mobile:wa.bodyBase},bodySmall:{desktop:ti.bodySmall,mobile:wa.bodySmall},labelButton:{desktop:ti.labelButton,mobile:wa.labelButton},labelDefault:{desktop:ti.labelDefault,mobile:wa.labelDefault},captionDefault:{desktop:ti.captionDefault,mobile:wa.captionDefault},captionLink:{desktop:ti.captionLink,mobile:wa.captionLink}},rm=e=>e.length==7?{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}:e.length==4?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null,Xx=({r:e,g:t,b:r,luminanceThreshold:n})=>{const s=o=>(o=o/255,o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4));return .2126*s(e)+.7152*s(t)+.0722*s(r)>n},Yx=.37,w9=(e,t=Yx)=>{const r=Xx({...e,luminanceThreshold:t})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.70)`,"grey-ui-dark":`rgba(${r},0.3)`,"grey-ui-light":`rgba(${r},0.1)`}};function x9(e,t,r){const n=rm(e)||{r:0,g:0,b:0},s=rm(t)||{r:255,g:255,b:255},o=Math.round(s.r*r+n.r*(1-r)),i=Math.round(s.g*r+n.g*(1-r)),c=Math.round(s.b*r+n.b*(1-r));return`#${gv(o)}${gv(i)}${gv(c)}`}function aE(e,t){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,t));let s=e,o=rm(e)||r;(isNaN(o.r)||isNaN(o.g)||isNaN(o.b))&&(o=r,s="#FFFFFF");const i=Xx({...o,luminanceThreshold:Yx})?"#000000":"#FFFFFF";return x9(s,i,n)}function gv(e){return e.toString(16).padStart(2,"0").toUpperCase()}const A9=(e,t,r,n=Yx)=>{const s={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(e!=null&&e.startsWith("#")){const o=rm(e);o!==null&&Object.assign(s,w9(o))}if(t!=null&&t.startsWith("#")){const o=rm(t);o!==null&&(s["primary-text"]=Xx({...o,luminanceThreshold:n})?"black":"white")}return s},k9=e=>({"primary-hover":aE(e,.1),"primary-pressed":aE(e,.15)}),S9=(e,t)=>e||t,E9=(e,t,r)=>{const n=Object.entries(e).map(([s,o])=>[s,S9(r?r[o]:null,t[s])]);return Object.fromEntries(n)},_N=(e,t,r)=>{const n=E9(e,t,r);return r?{...t,...n,...A9(n.background,n.primary,t),...k9(n.primary)}:{...t}},P9=e=>_N(y9,h9,e),wN=e=>_N(g9,m9,e),Zx=e=>{if(!e)return rE;switch(e.shapes){case"rounded":return vN;case"rectangle":return b9;case"pill":return v9;default:return rE}},uy=(e="",t)=>t.map(([r,n])=>`--rc-${e}-${r}: ${n}`).join("; "),C9=e=>{const t=uy("color",Object.entries(P9(e))),r=uy("shape",Object.entries(Zx(e)));return[t,r].join("; ")},R9=e=>{const t=uy("color",Object.entries(wN(e))),r=uy("shape",Object.entries(Zx(e)));return[t,r].join("; ")},T9=(e="",t)=>Object.entries(t).flatMap(([r,{desktop:n,mobile:s}])=>[`--rc-${e}-${r}-desktop: normal normal ${n.fontWeight} ${n.fontSize}/${n.lineHeight} ${nE}`,`--rc-${e}-${r}-mobile: normal normal ${s.fontWeight} ${s.fontSize}/${s.lineHeight} ${nE}`,`--rc-${e}-${r}-desktop-font-size: ${n.fontSize}`,`--rc-${e}-${r}-mobile-font-size: ${s.fontSize}`]).join("; "),j9=(e="",t)=>Object.entries(t).map(([r,{mobile:n,desktop:s}])=>`--rc-${e}-${r}-mobile: ${n};  --rc-${e}-${r}-desktop: ${s};`).join(" "),I9={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 N9=class{constructor(e){ar(this,"brandingAppearance"),e?this.brandingAppearance=e:this.brandingAppearance=void 0}get shape(){return Zx(this.brandingAppearance)}get formColors(){return wN(this.brandingAppearance)}get formStyleVars(){return R9(this.brandingAppearance)}get productInfoStyleVars(){return C9(this.brandingAppearance)}get spacing(){return I9}get textStyles(){return _9}get textStyleVars(){return T9("text",this.textStyles)}get spacingStyleVars(){return j9("spacing",this.spacing)}};var M9=Gt("<button><!></button>");const L9={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 xN(e,t){Lr(t,!0),Tr(e,L9);const r=_r(t,"intent",3,"primary"),n=_r(t,"disabled",3,!1),s=_r(t,"loading",3,!1),o=Tt(()=>new N9(t.brandingAppearance)),i=Tt(()=>ae(o).textStyleVars),c=Tt(()=>ae(o).spacingStyleVars),u=Tt(()=>ae(o).productInfoStyleVars),p=Tt(()=>ae(o).formStyleVars),d=Tt(()=>[t.styleOverrides,ae(i),ae(c),ae(u),ae(p)].join("; "));var f=M9();f.__click=function(...g){var y;(y=t.onclick)==null||y.apply(this,g)};var m=At(f);{var h=g=>{u9(g,{size:"small"})},b=g=>{f9(g,{size:"body-base",children:(y,x)=>{var v=hn(),A=Ur(v);gq(A,t,"default",{}),Ze(y,v)},$$slots:{default:!0}})};gr(m,g=>{s()?g(h):g(b,!1)})}rr(()=>{ql(f,`${`intent-${r()}`??""} svelte-td7xvm`),f.disabled=n(),kr(f,"data-testid",t.testId),kr(f,"type",t.type),kr(f,"style",ae(d))}),Ze(e,f),Dr()}hb(["click"]);const D9=e=>{const{size:t,overrides:r,componentState:n,zStackChildStyles:s}=e,o={"--height":"unset","--width":"unset","--clip-path":"none","--border-end-start-radius":"unset","--border-end-end-radius":"unset","--border-start-start-radius":"unset","--border-start-end-radius":"unset","--position":"relative","--inset":"0","--transform":"initial"},i=Wx(r,n);Object.assign(o,s),Object.assign(o,Tm({...t,...i})),Object.assign(o,R7(e.mask_shape));const c=Ao(o,"image"),u=C7(e),p=T7(e);return{imageStyles:Qs(c),maskPath:u,linearGradientAngle:p}};var O9=Ii('<ellipse cx="50" rx="50"></ellipse>'),z9=Ii("<path></path>"),B9=Ii("<stop></stop>"),F9=Ii("<linearGradient></linearGradient>"),U9=Ii("<stop></stop>"),q9=Ii('<radialGradient cx="50%" cy="50%" r="50%" fx="50%" fy="50%"></radialGradient>'),V9=Ii('<linearGradient><stop offset="0%"></stop></linearGradient>'),H9=Gt('<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 W9={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 G9(e,t){Lr(t,!0),Tr(e,W9);const r=nc(t,["$$slots","$$events","$$legacy","id","source","purchaseState"]);let n=$r(0),s;function o(){s&&$t(n,s.naturalHeight/s.naturalWidth)}const i=Tt(()=>D9({id:t.id,colorMode:t.purchaseState.colorMode,source:t.source,purchaseState:t.purchaseState,...r,imageAspectRatio:ae(n)})),c=Tt(()=>ae(i).imageStyles),u=Tt(()=>ae(i).maskPath),p=Tt(()=>ae(i).linearGradientAngle),d=Tt(()=>{var R,P;const k=t.purchaseState.colorMode;return(R=t.source[k])!=null&&R.original?t.source[k].original:(P=t.source[fo])==null?void 0:P.original});var f=H9(),m=Ur(f);aN(m,R=>s=R,()=>s);var h=sr(m,2),b=At(h),g=At(b),y=At(g);{var x=R=>{var P=O9();rr(()=>{kr(P,"cy",ae(n)*50),kr(P,"ry",ae(n)*50)}),Ze(R,P)},v=R=>{var P=z9();rr(()=>kr(P,"d",ae(u))),Ze(R,P)};gr(y,R=>{var P;((P=t.mask_shape)==null?void 0:P.type)==="circle"?R(x):R(v,!1)})}var A=sr(g);{var _=R=>{var P=F9();rp(P,21,()=>{var k,E,M,C;return((E=(k=t.color_overlay)==null?void 0:k[t.purchaseState.colorMode])==null?void 0:E.points)||((C=(M=t.color_overlay)==null?void 0:M[fo])==null?void 0:C.points)||[]},tp,(k,E)=>{var M=B9();rr(()=>{kr(M,"offset",`${ae(E).percent}%`),kr(M,"style",`stop-color: ${ae(E).color}`)}),Ze(k,M)}),rr(()=>{kr(P,"id",`gradient-${t.id}`),kr(P,"x1",ae(p).x1),kr(P,"y1",ae(p).y1),kr(P,"x2",ae(p).x2),kr(P,"y2",ae(p).y2)}),Ze(R,P)},w=R=>{var P=hn(),k=Ur(P);{var E=C=>{var I=q9();rp(I,21,()=>{var L,N,S,F;return((N=(L=t.color_overlay)==null?void 0:L[t.purchaseState.colorMode])==null?void 0:N.points)||((F=(S=t.color_overlay)==null?void 0:S[fo])==null?void 0:F.points)||[]},tp,(L,N)=>{var S=U9();rr(()=>{kr(S,"offset",`${ae(N).percent}%`),kr(S,"style",`stop-color: ${ae(N).color}`)}),Ze(L,S)}),rr(()=>kr(I,"id",`gradient-${t.id}`)),Ze(C,I)},M=C=>{var I=hn(),L=Ur(I);{var N=S=>{var F=V9(),D=At(F);rr(()=>{var H,W,G;kr(F,"id",`gradient-${t.id}`),kr(D,"style",`stop-color: ${((H=t.color_overlay[t.purchaseState.colorMode])==null?void 0:H.value)||((G=(W=t.color_overlay)==null?void 0:W[fo])==null?void 0:G.value)}`)}),Ze(S,F)};gr(L,S=>{var F,D;((D=(F=t.color_overlay)==null?void 0:F[t.purchaseState.colorMode])==null?void 0:D.type)==="hex"&&S(N)},!0)}Ze(C,I)};gr(k,C=>{var I,L;((L=(I=t.color_overlay)==null?void 0:I[t.purchaseState.colorMode])==null?void 0:L.type)==="radial"?C(E):C(M,!1)},!0)}Ze(R,P)};gr(A,R=>{var P,k;((k=(P=t.color_overlay)==null?void 0:P[t.purchaseState.colorMode])==null?void 0:k.type)==="linear"?R(_):R(w,!1)})}var j=sr(b),T=sr(j);rr(()=>{kr(m,"src",ae(d)),kr(h,"id",`rc-pw-image-container-${t.id}`),kr(h,"style",ae(c)),kr(h,"viewBox",`0 0 100 ${ae(n)*100}`),kr(g,"id",`clip-path-${t.id}`),kr(j,"href",ae(d)),kr(j,"height",ae(n)*100),kr(j,"clip-path",`url(#clip-path-${t.id})`),kr(j,"id",t.id),kr(T,"height",ae(n)*100),kr(T,"clip-path",`url(#clip-path-${t.id})`),kr(T,"fill",`url(#gradient-${t.id})`)}),vi("load",m,o),Ze(e,f),Dr()}function X9({stack:e,zStackChildStyles:t}){const r=e.size.width.type==="fill"?"100%":"fit-content",n=Ao(t||{},"purchase-button");return Qs({...n,position:"var(--purchase-button-position, relative)",inset:"var(--purchase-button-inset, 0)",transform:"var(--purchase-button-transform, initial)",width:r})}const Y9={hash:"svelte-1x8zwdp",code:""};function Z9(e,t){Lr(t,!0),Tr(e,Y9);const r=nc(t,["$$slots","$$events","$$legacy","stack","labels","onAction","purchaseState","variableDictionary","zStackChildStyles"]),n=()=>{t.onAction&&t.onAction({type:"purchase"})},s=Tt(()=>X9({stack:t.stack,labels:t.labels,onAction:t.onAction,purchaseState:t.purchaseState,variableDictionary:t.variableDictionary,zStackChildStyles:t.zStackChildStyles,...r}));yN(e,{onclick:n,class:"rc-pw-purchase-button",get style(){return ae(s)},children:(o,i)=>{jm(o,sl(()=>t.stack,{get labels(){return t.labels},get purchaseState(){return t.purchaseState},get variableDictionary(){return t.variableDictionary}}))},$$slots:{default:!0}}),Dr()}const K9=(e,t)=>{e.preventDefault(),e.stopPropagation(),t.onAction&&t.onAction({type:"select_package"},{packageId:t.package_id})};var Q9=Gt('<button class="rc-pw-package svelte-123kamd"><!></button>');const J9={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 $9(e,t){Lr(t,!0),Tr(e,J9);const r=Tt(()=>{var c;return((c=t.purchaseState.variablesPerPackage)==null?void 0:c[t.package_id])||t.variableDictionary}),n=Tt(()=>{var c;return{selected:((c=t.purchaseState)==null?void 0:c.selectedPackageId)===t.package_id}}),s=Tt(()=>Qs(Ao(t.zStackChildStyles,"package")));var o=Q9();o.__click=[K9,t];var i=At(o);jm(i,sl(()=>t.stack,{get labels(){return t.labels},get onAction(){return t.onAction},get purchaseState(){return t.purchaseState},get componentState(){return ae(n)},get variableDictionary(){return ae(r)}})),rr(()=>{kr(o,"id",t.id),kr(o,"style",ae(s)),el(o,"selected",ae(n).selected)}),Ze(e,o),Dr()}hb(["click"]);function eV(e){const t={"--item-spacing":`${e.item_spacing}px`,"--width":"initial","--height":"initial","--flex":"0 1 auto","--position":"relative","--inset":"0","--transform":"initial"};Object.assign(t,Tm(e.size)),Object.assign(t,e.zStackChildStyles);const r=Ao(t,"timeline");return Qs(r)}function tV(e){var t,r,n,s,o,i,c,u,p,d;const f={"--icon-size":`${e.icon.width_and_height}px`,"--icon-padding":`${e.icon.padding}px`,"--icon-color":tl({colorMap:e.icon.color,colorMode:(t=e.purchaseState)==null?void 0:t.colorMode}),"--icon-background-color":tl({colorMap:(r=e.icon_background)==null?void 0:r.color,colorMode:e.purchaseState.colorMode}),"--icon-border":pN((n=e.icon_background)==null?void 0:n.border,(s=e.purchaseState)==null?void 0:s.colorMode),"--text-spacing":`${e.text_spacing}px`,"--border-start-start-radius":"0px","--border-start-end-radius":"0px","--border-end-start-radius":"0px","--border-end-end-radius":"0px","--connector-color":tl({colorMap:(o=e.connector)==null?void 0:o.color,colorMode:e.purchaseState.colorMode}),"--connector-width":`${((i=e.connector)==null?void 0:i.width)||0}px`,"--connector-top":"0px","--connector-height":`${e.item_spacing}px`};if(Object.assign(f,((u=(c=e.icon_background)==null?void 0:c.shape)==null?void 0:u.type)==="rectangle"?ly((d=(p=e.icon_background)==null?void 0:p.shape)==null?void 0:d.corners):{"--border-start-start-radius":"50%","--border-start-end-radius":"50%","--border-end-start-radius":"50%","--border-end-end-radius":"50%"}),e.connector){const h=e.connector.margin.top!==0,b=e.connector.margin.bottom!==0,g=e.icon.padding+e.icon.width_and_height/2;!h&&!b&&(f["--connector-height"]=`${e.item_spacing+g*2}px`,f["--connector-top"]="50%"),h&&b&&(f["--connector-height"]=`${e.item_spacing-e.connector.margin.top-e.connector.margin.bottom}px`,f["--connector-top"]=`calc(100% + ${e.connector.margin.top}px)`),!h&&b&&(f["--connector-height"]=`${e.item_spacing-e.connector.margin.bottom+g}px`,f["--connector-top"]="50%"),h&&!b&&(f["--connector-height"]=`${e.item_spacing+g}px`,f["--connector-top"]=`calc(100% + ${e.connector.margin.top}px)`)}const m=Ao(f,"timeline-item");return Qs(m)}function sE(e,t="title"){var r,n,s,o,i;const c={"--text-color":"inherit","--text-font-size":"initial","--text-font-weight":"initial","--text-horizontal-alignment":"initial","--text-margin-block-start":"0px","--text-margin-inline-end":"0px","--text-margin-block-end":"0px","--text-margin-inline-start":"0px","--text-padding-block-start":"0px","--text-padding-inline-end":"0px","--text-padding-block-end":"0px","--text-padding-inline-start":"0px"},u={color:((r=e[t])==null?void 0:r.color)||mN,font_size:((n=e[t])==null?void 0:n.font_size)||"body_m",font_weight:((s=e[t])==null?void 0:s.font_weight)||"regular",horizontal_alignment:((o=e[t])==null?void 0:o.horizontal_alignment)||"leading"},{tagToRender:p,textStyles:d}=Gx({...e,components:[],...u,size:{width:{type:"fit"},height:{type:"fit"}},type:"text",margin:{top:0,bottom:0,leading:0,trailing:0},padding:{top:0,bottom:0,leading:0,trailing:0},text_lid:""});Object.assign(c,d);const f=Qs(Ao(c,"timeline-item")),m=Hx({text_lid:(i=e[t])==null?void 0:i.text_lid,locale:e.purchaseState.locale,defaultLocale:e.purchaseState.defaultLocale,labels:e.labels,variableDictionary:e.variableDictionary});return{textStyles:f,tagToRender:p,textLabel:m}}var rV=Gt('<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 nV={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 aV(e,t){Lr(t,!0),Tr(e,nV);const r=nc(t,["$$slots","$$events","$$legacy"]),n=Tt(()=>tV(r)),s=Tt(()=>sE(r,"title")),o=Tt(()=>ae(s).tagToRender),i=Tt(()=>ae(s).textStyles),c=Tt(()=>ae(s).textLabel),u=Tt(()=>sE(r,"description")),p=Tt(()=>ae(u).tagToRender),d=Tt(()=>ae(u).textStyles),f=Tt(()=>ae(u).textLabel);var m=rV(),h=sr(At(m),2),b=At(h);ny(b,()=>ae(o),!1,(x,v)=>{let A;rr(()=>A=ay(x,A,{class:"rc-pw-timeline-item-content-title",style:ae(i)},"svelte-gjmo4g",x.namespaceURI===$f,x.nodeName.includes("-")));var _=Cn();rr(()=>cn(_,ae(c))),Ze(v,_)});var g=sr(b,2);{var y=x=>{var v=hn(),A=Ur(v);ny(A,()=>ae(p),!1,(_,w)=>{let j;rr(()=>j=ay(_,j,{class:"rc-pw-timeline-item-content-description",style:ae(d)},"svelte-gjmo4g",_.namespaceURI===$f,_.nodeName.includes("-")));var T=Cn();rr(()=>cn(T,ae(f))),Ze(w,T)}),Ze(x,v)};gr(g,x=>{ae(f)&&x(y)})}rr(()=>kr(m,"style",ae(n))),Ze(e,m),Dr()}var sV=Gt('<div class="rc-pw-timeline-container svelte-12g27vu"></div>');const oV={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 iV(e,t){Lr(t,!0),Tr(e,oV);const r=nc(t,["$$slots","$$events","$$legacy","items"]),n=Tt(()=>eV({items:t.items,...r}));var s=hn(),o=Ur(s);{var i=c=>{var u=sV();rp(u,21,()=>t.items,tp,(p,d,f)=>{var m=Tt(()=>`${t.id}-${f}`),h=Tt(()=>`${t.name}-${f}`);aV(p,sl(()=>ae(d),{get labels(){return t.labels},get id(){return ae(m)},get name(){return ae(h)},type:"timeline",get purchaseState(){return t.purchaseState},get text_spacing(){return t.text_spacing},get item_spacing(){return t.item_spacing}}))}),rr(()=>kr(u,"style",ae(n))),Ze(c,u)};gr(o,c=>{t.items.length&&c(i)})}Ze(e,s),Dr()}var lV=Gt('<footer class="rcb-modal-footer svelte-1f9z0o8"><!></footer>');const cV={hash:"svelte-1f9z0o8",code:"footer.svelte-1f9z0o8 {display:flex;flex-direction:column;}"};function uV(e,t){Lr(t,!1),Tr(e,cV);let r=_r(t,"children",8);xo();var n=lV(),s=At(n);ya(s,()=>r()??Rn),Ze(e,n),Dr()}const dV={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 pV(e,t){Lr(t,!1),Tr(e,dV);let r=_r(t,"as",8,"section"),n=_r(t,"children",8);xo();var s=hn(),o=Ur(s);ny(o,r,!1,(i,c)=>{ay(i,null,{class:"rcb-modal-section"},"svelte-1bzqb13",i.namespaceURI===$f,i.nodeName.includes("-"));var u=hn(),p=Ur(u);ya(p,()=>n()??Rn),Ze(c,u)}),Ze(e,s),Dr()}var fV=Gt("<div><!></div>");const mV={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 AN(e,t){Lr(t,!1),Tr(e,mV);let r=_r(t,"gap",8,"small"),n=_r(t,"align",8,"start"),s=_r(t,"children",8);xo();var o=fV(),i=At(o);ya(i,()=>s()??Rn),rr(()=>ql(o,`rcb-column gap-${r()??""} align-${n()??""} svelte-b5dygi`)),Ze(e,o),Dr()}var hV=Gt('<div class="rcb-row svelte-1seeuxq"><!></div>');const gV={hash:"svelte-1seeuxq",code:".rcb-row.svelte-1seeuxq {display:flex;flex-direction:row;justify-content:flex-start;}"};function yV(e,t){Lr(t,!1),Tr(e,gV);let r=_r(t,"children",8);xo();var n=hV(),s=At(n);ya(s,()=>r()??Rn),Ze(e,n),Dr()}var bV=Gt("<span><!></span>");const vV={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 _n(e,t){Lr(t,!0),Tr(e,vV);const r=_r(t,"size",3,"body-base"),n=_r(t,"branded",3,!1);var s=bV(),o=At(s);ya(o,()=>t.children??Rn),rr(()=>ql(s,`rcb-typography rcb-typography-${r()??""} ${(n()?"rcb-typography-branded":"")??""} svelte-orw2sj`)),Ze(e,s),Dr()}var _V=Gt("<div><!></div>"),wV=Gt('<span style="display: block;"><!></span>'),xV=Gt("<!> <!>",1),AV=Gt("<!> <!>",1),kV=Gt('<div class="rcb-modal-message svelte-w46z5s" data-type="error"><!></div>');const SV={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 EV(e,t){Lr(t,!0),Tr(e,SV);const r=_r(t,"title",3,null),n=_r(t,"icon",3,null),s=32;let o=$r(null),i=$r(!1),c;_o(()=>(ae(o)&&(c=new ResizeObserver(()=>{var d;$t(i,(((d=ae(o))==null?void 0:d.offsetHeight)??0)>s)}),c.observe(ae(o))),()=>{c==null||c.disconnect()}));var u=kV(),p=At(u);AN(p,{gap:"medium",align:"start",children:(d,f)=>{var m=AV(),h=Ur(m);yV(h,{children:(y,x)=>{var v=xV(),A=Ur(v);{var _=T=>{var R=_V(),P=At(R);ya(P,n),rr(()=>ql(R,`rcb-modal-message-icon ${(ae(i)?"large":"small")??""} svelte-w46z5s`)),Ze(T,R)};gr(A,T=>{n()&&T(_)})}var w=sr(A,2);{var j=T=>{var R=wV(),P=At(R);_n(P,{size:"heading-md",children:(k,E)=>{var M=Cn();rr(()=>cn(M,r())),Ze(k,M)},$$slots:{default:!0}}),aN(R,k=>$t(o,k),()=>ae(o)),Ze(T,R)};gr(w,T=>{r()&&T(j)})}Ze(y,v)},$$slots:{default:!0}});var b=sr(h,2);{var g=y=>{_n(y,{size:"body-small",children:(x,v)=>{var A=hn(),_=Ur(A);ya(_,()=>t.message??Rn),Ze(x,A)},$$slots:{default:!0}})};gr(b,y=>{t.message&&y(g)})}Ze(d,m)},$$slots:{default:!0}}),rr(()=>kr(u,"data-has-title",!!r())),Ze(e,u),Dr()}var PV=Gt('<div class="rcb-modal-message-icon svelte-c8cuu5"><!></div>'),CV=Gt("<!> <!>",1),RV=Gt('<div class="rcb-modal-message svelte-c8cuu5" data-type="success"><!></div>');const TV={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 jV(e,t){Lr(t,!0),Tr(e,TV);const r=_r(t,"title",3,null),n=_r(t,"icon",3,null);var s=RV(),o=At(s);AN(o,{gap:"large",align:"center",children:(i,c)=>{var u=CV(),p=Ur(u);{var d=h=>{var b=PV(),g=At(b);ya(g,n),Ze(h,b)};gr(p,h=>{n()&&h(d)})}var f=sr(p,2);{var m=h=>{_n(h,{size:"heading-md",children:(b,g)=>{var y=Cn();rr(()=>cn(y,r())),Ze(b,y)},$$slots:{default:!0}})};gr(f,h=>{r()&&h(m)})}Ze(i,u)},$$slots:{default:!0}}),rr(()=>kr(s,"data-has-title",!!r())),Ze(e,s),Dr()}const Kx="rcb-ui-events-tracker",Qx="branding";var IV=Gt('<div class="message-layout svelte-qavr33"><div class="message-layout-content svelte-qavr33"><!></div> <div class="message-layout-footer"><!></div></div>');const NV={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 Jx(e,t){Lr(t,!0),Tr(e,NV);let r=_r(t,"title",3,null),n=_r(t,"closeButtonTitle",3,"Go back to app"),s=_r(t,"icon",3,null),o=_r(t,"message",3,null);const i=fs(Qx);function c(){t.onDismiss()}var u=IV(),p=At(u),d=At(p);pV(d,{children:(h,b)=>{var g=hn(),y=Ur(g);{var x=A=>{jV(A,{get title(){return r()},get icon(){return s()}})},v=A=>{EV(A,{get title(){return r()},get icon(){return s()},get message(){return o()}})};gr(y,A=>{t.type==="success"?A(x):A(v,!1)})}Ze(h,g)},$$slots:{default:!0}});var f=sr(p,2),m=At(f);uV(m,{children:(h,b)=>{xN(h,{onclick:c,type:"submit",brandingAppearance:i,children:(g,y)=>{var x=Cn();rr(()=>cn(x,n())),Ze(g,x)},$$slots:{default:!0}})},$$slots:{default:!0}}),Ze(e,u),Dr()}function js(e,t){Lr(t,!0);const r=Fs(),n=()=>Bs(o,"$translator",r),s=_r(t,"key",3,""),o=fs(Ks),i=Tt(()=>s()?n().translate(s()||"",t.variables):void 0);var c=hn(),u=Ur(c);{var p=f=>{var m=Cn();rr(()=>cn(m,ae(i))),Ze(f,m)},d=f=>{var m=hn(),h=Ur(m);ya(h,()=>t.children??Rn),Ze(f,m)};gr(u,f=>{ae(i)?f(p):f(d,!1)})}Ze(e,c),Dr()}var MV=Gt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),LV=Gt('<p class="footer-caption svelte-1hbk6xu"><!></p>'),DV=Gt('<div class="footer-caption-container svelte-1hbk6xu"><!> <!> <p class="footer-caption svelte-1hbk6xu"><!></p></div>');const OV={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 zV(e,t){Lr(t,!1),Tr(e,OV);const r=Fs(),n=()=>Bs(y,"$translator",r),s=To(),o=To(),i=To(),c=To(),u=To(),p=To(),d=To(),f=To(),m=To(),h=To();let b=_r(t,"brandingInfo",8,null),g=_r(t,"purchaseOption",8,null);const y=fs(Ks);function x(E){return E!=null&&"base"in E}function v(E){return E!=null&&"basePrice"in E}function A(E){return E?E.trial?vr.PaymentEntryPageTrialSubscriptionTermsInfo:vr.PaymentEntryPageSubscriptionTermsInfo:vr.PaymentEntryPageOtpTermsInfo}Qo(()=>xg(g()),()=>{$t(s,x(g())?g():null)}),Qo(()=>xg(g()),()=>{$t(o,v(g())?g():null)}),Qo(()=>ae(s),()=>{$t(i,A(ae(s)))}),Qo(()=>ae(s),()=>{var E,M;$t(c,((E=ae(s))==null?void 0:E.introPrice)||((M=ae(s))==null?void 0:M.base))}),Qo(()=>(ae(o),ae(c)),()=>{var E,M;$t(u,((E=ae(o))==null?void 0:E.basePrice)||((M=ae(c))==null?void 0:M.price))}),Qo(()=>(ae(u),n()),()=>{$t(p,ae(u)?Dl(ae(u).amountMicros,ae(u).currency,n().locale||n().fallbackLocale):null)}),Qo(()=>(ae(c),n()),()=>{var E,M,C,I,L;$t(d,(E=ae(c))!=null&&E.period?n().translatePeriodFrequency(((C=(M=ae(c))==null?void 0:M.period)==null?void 0:C.number)||1,(L=(I=ae(c))==null?void 0:I.period)==null?void 0:L.unit,{useMultipleWords:!0}):null)}),Qo(()=>(ae(s),n(),R0),()=>{var E,M;$t(f,(M=(E=ae(s))==null?void 0:E.trial)!=null&&M.period?n().translateDate(R0(new Date,ae(s).trial.period,!0),{year:"numeric",month:"long",day:"numeric"}):null)}),Qo(()=>(xg(b()),ae(u),n(),ae(i),ae(p),ae(d),ae(f)),()=>{var E;$t(m,b()&&ae(u)?n().translate(ae(i),{appName:(E=b())==null?void 0:E.app_name,price:ae(p),perFrequency:ae(d),renewalDate:ae(f)}):null)}),Qo(()=>(ae(s),n(),vr),()=>{$t(h,ae(s)?n().translate(vr.PaymentEntryPageSubscriptionInfo):null)}),ZU(),xo();var _=DV(),w=At(_);{var j=E=>{var M=MV(),C=At(M);_n(C,{size:"caption-default",children:(I,L)=>{var N=Cn();rr(()=>cn(N,ae(m))),Ze(I,N)},$$slots:{default:!0}}),Ze(E,M)};gr(w,E=>{ae(m)&&E(j)})}var T=sr(w,2);{var R=E=>{var M=LV(),C=At(M);_n(C,{size:"caption-default",children:(I,L)=>{var N=Cn();rr(()=>cn(N,ae(h))),Ze(I,N)},$$slots:{default:!0}}),Ze(E,M)};gr(T,E=>{ae(h)&&E(R)})}var P=sr(T,2),k=At(P);_n(k,{size:"caption-default",children:(E,M)=>{js(E,{get key(){return vr.PaymentEntryPagePaymentStepTitle}})},$$slots:{default:!0}}),Ze(e,_),Dr()}var Os=(e=>(e.SDKInitialized="sdk_initialized",e.CheckoutSessionStart="checkout_session_start",e.CheckoutSessionEnd="checkout_session_end",e.CheckoutFlowError="checkout_flow_error",e.CheckoutPaymentTaxCalculation="checkout_payment_tax_calculation",e.CheckoutPaymentFormImpression="checkout_payment_form_impression",e.CheckoutPaymentFormError="checkout_payment_form_error",e.CheckoutPaymentFormDismiss="checkout_payment_form_dismiss",e.CheckoutPaymentFormSubmit="checkout_payment_form_submit",e.CheckoutPaymentFormGatewayError="checkout_payment_form_gateway_error",e.CheckoutPurchaseSuccessfulImpression="checkout_purchase_successful_impression",e.CheckoutPurchaseSuccessfulDismiss="checkout_purchase_successful_dismiss",e))(Os||{}),$x=(e=>(e.tax_collection_disabled="tax_collection_disabled",e.invalid_tax_location="invalid_tax_location",e.rate_limit_exceeded="rate_limit_exceeded",e.missing_required_permission="missing_required_permission",e.invalid_origin_address="invalid_origin_address",e.taxes_not_active="taxes_not_active",e.unexpected_gateway_error="unexpected_gateway_error",e))($x||{});function BV({errorCode:e,errorMessage:t}){return{eventName:Os.CheckoutFlowError,properties:{errorCode:e,errorMessage:t}}}function FV({errorCode:e,errorMessage:t}){return{eventName:Os.CheckoutPaymentFormError,properties:{errorCode:e,errorMessage:t}}}function UV({appearance:e,rcPackage:t,purchaseOptionToUse:r,customerEmail:n}){return{eventName:Os.CheckoutSessionStart,properties:{customizationColorButtonsPrimary:(e==null?void 0:e.color_buttons_primary)??null,customizationColorAccent:(e==null?void 0:e.color_accent)??null,customizationColorError:(e==null?void 0:e.color_error)??null,customizationColorProductInfoBg:(e==null?void 0:e.color_product_info_bg)??null,customizationColorFormBg:(e==null?void 0:e.color_form_bg)??null,customizationColorPageBg:(e==null?void 0:e.color_page_bg)??null,customizationFont:(e==null?void 0:e.font)??null,customizationShapes:(e==null?void 0:e.shapes)??null,customizationShowProductDescription:(e==null?void 0:e.show_product_description)??null,productInterval:t.webBillingProduct.normalPeriodDuration,productPrice:t.webBillingProduct.price.amountMicros,productCurrency:t.webBillingProduct.price.currency,selectedProductId:t.webBillingProduct.identifier,selectedPackageId:t.identifier,selectedPurchaseOption:r.id,customerEmailProvidedByDeveloper:!!n}}}function qV({redemptionInfo:e}){return{eventName:Os.CheckoutSessionEnd,properties:{outcome:"finished",withRedemptionInfo:!!e}}}function VV(){return{eventName:Os.CheckoutSessionEnd,properties:{outcome:"closed"}}}function HV({errorCode:e,errorMessage:t}){return{eventName:Os.CheckoutSessionEnd,properties:{outcome:"errored",errorCode:e,errorMessage:t}}}function WV({taxCalculation:e,taxCustomerDetails:t}){const r=e.failed_reason===$x.tax_collection_disabled?"disabled":e.failed_reason?"failed":e.tax_amount_in_micros===0?"not-taxed":"taxed",n=t===null?"auto":"form";return{eventName:Os.CheckoutPaymentTaxCalculation,properties:{outcome:r,ui_element:n,tax_inclusive:e.tax_inclusive,error_code:e.failed_reason??null}}}function GV({selectedPaymentMethod:e}){return{eventName:Os.CheckoutPaymentFormSubmit,properties:{selectedPaymentMethod:e??null}}}function XV({errorCode:e,errorMessage:t}){return{eventName:Os.CheckoutPaymentFormGatewayError,properties:{errorCode:e,errorMessage:t}}}const YV=`<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 ZV=Gt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-1sxpw7o"><!></div>');const KV={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 QV(e){Tr(e,KV);var t=ZV(),r=At(t);rc(r,()=>YV),Ze(e,t)}var JV=Gt('<div class="rcb-modal-loader svelte-102edf4"><!></div>');const $V={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 kN(e){Tr(e,$V);var t=JV(),r=At(t);QV(r),Ze(e,t)}function eH(e,t){var r,n;Lr(t,!0);const s=Fs(),o=()=>Bs(i,"$translator",s),i=fs(Ks),c=fs(Qx),u=Tt(()=>t.priceBreakdown?o().formatPrice(t.priceBreakdown.totalAmountInMicros,t.priceBreakdown.currency):null),p=(n=(r=t.subscriptionOption)==null?void 0:r.trial)==null?void 0:n.period,d=Tt(()=>p?o().translatePeriod(p.number,p.unit):null);xN(e,{get disabled(){return t.disabled},testId:"PayButton",brandingAppearance:c,children:(f,m)=>{var h=hn(),b=Ur(h);{var g=x=>{var v=Tt(()=>({trialPeriodLabel:ae(d)}));js(x,{get key(){return vr.PaymentEntryPageButtonStartTrial},get variables(){return ae(v)}})},y=x=>{var v=hn(),A=Ur(v);{var _=j=>{var T=Tt(()=>({formattedPrice:ae(u)}));js(j,{get key(){return vr.PaymentEntryPageButtonWithPrice},get variables(){return ae(T)}})},w=j=>{js(j,{get key(){return vr.PaymentEntryPageButtonPay}})};gr(A,j=>{ae(u)?j(_):j(w,!1)},!0)}Ze(x,v)};gr(b,x=>{var v;(v=t.subscriptionOption)!=null&&v.trial?x(g):x(y,!1)})}Ze(f,h)},$$slots:{default:!0}}),Dr()}const tH={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"},rH={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"},SN={error:"color_error",focus:"color_accent",accent:"color_accent",primary:"color_buttons_primary"},nH={...SN,"input-background":"color_form_bg",background:"color_form_bg"},aH={...SN,"input-background":"color_product_info_bg",background:"color_product_info_bg"},EN={"input-border-radius":"4px","input-button-border-radius":"8px"},sH={"input-border-radius":"0px","input-button-border-radius":"0px"},oH={"input-border-radius":"12px","input-button-border-radius":"9999px"},oE=EN,dy="-apple-system, BlinkMacSystemFont, avenir next, avenir, segoe ui, helvetica neue, helvetica, Cantarell, Ubuntu, roboto, noto, arial, sans-serif",PN="BrandCustomFont",iE=`${PN}, ${dy}`,ri={regular:"400",medium:"500",semibold:"600"},co={12:"12px",14:"14px",16:"16px",18:"18px",24:"24px",28:"28px",32:"32px",36:"36px"},ni={130:"130%",140:"140%"},ai={tight:"0.20%",regular:"0",loose:"0.20%"},xa={heading2xl:{fontSize:co[28],lineHeight:ni[130],fontWeight:ri.semibold,letterSpacing:ai.loose},headingXl:{fontSize:co[24],lineHeight:ni[130],fontWeight:ri.semibold,letterSpacing:ai.loose},headingLg:{fontSize:"20px",lineHeight:ni[130],fontWeight:ri.semibold,letterSpacing:ai.loose},headingMd:{fontSize:"16px",lineHeight:ni[140],fontWeight:ri.medium,letterSpacing:ai.regular},bodyBase:{fontSize:co[16],lineHeight:ni[140],fontWeight:ri.regular,letterSpacing:ai.regular},bodySmall:{fontSize:co[14],lineHeight:ni[140],fontWeight:ri.regular,letterSpacing:ai.regular},labelButton:{fontSize:co[16],lineHeight:ni[140],fontWeight:ri.semibold,letterSpacing:ai.tight},labelDefault:{fontSize:co[14],lineHeight:ni[140],fontWeight:ri.regular,letterSpacing:ai.tight},captionDefault:{fontSize:co[12],lineHeight:ni[140],fontWeight:ri.regular,letterSpacing:ai.regular},captionLink:{fontSize:co[12],lineHeight:ni[140],fontWeight:ri.regular,letterSpacing:ai.regular}},si={heading2xl:{...xa.heading2xl,fontSize:co[36]},headingXl:{...xa.headingXl,fontSize:co[32]},headingLg:{...xa.headingLg,fontSize:co[24]},headingMd:{...xa.headingMd,fontSize:co[18]},bodyBase:{...xa.bodyBase},bodySmall:{...xa.bodySmall},labelButton:{...xa.labelButton},labelDefault:{...xa.labelDefault},captionDefault:{...xa.captionDefault},captionLink:{...xa.captionLink}},L0={heading2xl:{mobile:xa.heading2xl,desktop:si.heading2xl},headingXl:{desktop:si.headingXl,mobile:xa.headingXl},headingLg:{desktop:si.headingLg,mobile:xa.headingLg},headingMd:{desktop:si.headingMd,mobile:xa.headingMd},bodyBase:{desktop:si.bodyBase,mobile:xa.bodyBase},bodySmall:{desktop:si.bodySmall,mobile:xa.bodySmall},labelButton:{desktop:si.labelButton,mobile:xa.labelButton},labelDefault:{desktop:si.labelDefault,mobile:xa.labelDefault},captionDefault:{desktop:si.captionDefault,mobile:xa.captionDefault},captionLink:{desktop:si.captionLink,mobile:xa.captionLink}},nm=e=>e.length==7?{r:parseInt(e.slice(1,3),16),g:parseInt(e.slice(3,5),16),b:parseInt(e.slice(5,7),16)}:e.length==4?{r:parseInt(e[1],16),g:parseInt(e[2],16),b:parseInt(e[3],16)}:null,eA=({r:e,g:t,b:r,luminanceThreshold:n})=>{const s=o=>(o=o/255,o<=.03928?o/12.92:Math.pow((o+.055)/1.055,2.4));return .2126*s(e)+.7152*s(t)+.0722*s(r)>n},tA=.37,iH=(e,t=tA)=>{const r=eA({...e,luminanceThreshold:t})?"0,0,0":"255,255,255";return{"grey-text-dark":`rgb(${r})`,"grey-text-light":`rgba(${r},0.70)`,"grey-ui-dark":`rgba(${r},0.3)`,"grey-ui-light":`rgba(${r},0.1)`}};function lH(e,t,r){const n=nm(e)||{r:0,g:0,b:0},s=nm(t)||{r:255,g:255,b:255},o=Math.round(s.r*r+n.r*(1-r)),i=Math.round(s.g*r+n.g*(1-r)),c=Math.round(s.b*r+n.b*(1-r));return`#${yv(o)}${yv(i)}${yv(c)}`}function lE(e,t){const r={r:255,g:255,b:255},n=Math.max(0,Math.min(1,t));let s=e,o=nm(e)||r;(isNaN(o.r)||isNaN(o.g)||isNaN(o.b))&&(o=r,s="#FFFFFF");const i=eA({...o,luminanceThreshold:tA})?"#000000":"#FFFFFF";return lH(s,i,n)}function yv(e){return e.toString(16).padStart(2,"0").toUpperCase()}const cH=(e,t,r,n=tA)=>{const s={"grey-text-dark":r["grey-text-dark"],"grey-text-light":r["grey-text-light"],"grey-ui-dark":r["grey-ui-dark"],"grey-ui-light":r["grey-ui-light"],"primary-text":r["primary-text"]};if(e!=null&&e.startsWith("#")){const o=nm(e);o!==null&&Object.assign(s,iH(o))}if(t!=null&&t.startsWith("#")){const o=nm(t);o!==null&&(s["primary-text"]=eA({...o,luminanceThreshold:n})?"black":"white")}return s},uH=e=>({"primary-hover":lE(e,.1),"primary-pressed":lE(e,.15)}),dH=(e,t)=>e||t,pH=(e,t,r)=>{const n=Object.entries(e).map(([s,o])=>[s,dH(r?r[o]:null,t[s])]);return Object.fromEntries(n)},CN=(e,t,r)=>{const n=pH(e,t,r);return r?{...t,...n,...cH(n.background,n.primary,t),...uH(n.primary)}:{...t}},fH=e=>CN(aH,rH,e),RN=e=>CN(nH,tH,e),rA=e=>{if(!e)return oE;switch(e.shapes){case"rounded":return EN;case"rectangle":return sH;case"pill":return oH;default:return oE}},py=(e="",t)=>t.map(([r,n])=>`--rc-${e}-${r}: ${n}`).join("; "),TN=e=>{const t=py("color",Object.entries(fH(e))),r=py("shape",Object.entries(rA(e)));return[t,r].join("; ")},mH=e=>{const t=py("color",Object.entries(RN(e))),r=py("shape",Object.entries(rA(e)));return[t,r].join("; ")},hH=(e="",t,r)=>Object.entries(t).flatMap(([n,{desktop:s,mobile:o}])=>{const i=`normal normal ${s.fontWeight} ${s.fontSize}/${s.lineHeight} ${dy}`,c=`normal normal ${o.fontWeight} ${o.fontSize}/${o.lineHeight} ${dy}`,u=`normal normal ${r==null?void 0:r.desktop.font_weight} ${r==null?void 0:r.desktop.font_size} ${iE}`,p=`normal normal ${r==null?void 0:r.mobile.font_weight} ${r==null?void 0:r.mobile.font_size} ${iE}`;return[`--rc-${e}-${n}-desktop: ${i}`,`--rc-${e}-${n}-mobile: ${c}`,`--rc-${e}-${n}-branded-desktop: ${r?u:i}`,`--rc-${e}-${n}-branded-mobile: ${r?p:c}`,`--rc-${e}-${n}-desktop-font-size: ${s.fontSize}`,`--rc-${e}-${n}-mobile-font-size: ${o.fontSize}`]}).join("; "),gH=(e="",t)=>Object.entries(t).map(([r,{mobile:n,desktop:s}])=>`--rc-${e}-${r}-mobile: ${n};  --rc-${e}-${r}-desktop: ${s};`).join(" "),yH={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 am{constructor(t){ar(this,"brandingAppearance"),t?this.brandingAppearance=t:this.brandingAppearance=void 0}get shape(){return rA(this.brandingAppearance)}get formColors(){return RN(this.brandingAppearance)}get formStyleVars(){return mH(this.brandingAppearance)}get productInfoStyleVars(){return TN(this.brandingAppearance)}get spacing(){return yH}get textStyles(){return L0}getTextStyleVars(t){return hH("text",this.textStyles,t)}get spacingStyleVars(){return gH("spacing",this.spacing)}}var jN="basil",bH=function(e){return e===3?"v3":e},IN="https://js.stripe.com",vH="".concat(IN,"/").concat(jN,"/stripe.js"),_H=/^https:\/\/js\.stripe\.com\/v3\/?(\?.*)?$/,wH=/^https:\/\/js\.stripe\.com\/(v3|[a-z]+)\/stripe\.js(\?.*)?$/,xH=function(e){return _H.test(e)||wH.test(e)},AH=function(){for(var e=document.querySelectorAll('script[src^="'.concat(IN,'"]')),t=0;t<e.length;t++){var r=e[t];if(xH(r.src))return r}return null},cE=function(e){var t="",r=document.createElement("script");r.src="".concat(vH).concat(t);var n=document.head||document.body;if(!n)throw new Error("Expected document.body not to be null. Stripe.js requires a <body> element.");return n.appendChild(r),r},kH=function(e,t){!e||!e._registerWrapper||e._registerWrapper({name:"stripe-js",version:"7.3.1",startTime:t})},zp=null,ih=null,lh=null,SH=function(e){return function(t){e(new Error("Failed to load Stripe.js",{cause:t}))}},EH=function(e,t){return function(){window.Stripe?e(window.Stripe):t(new Error("Stripe.js not available"))}},PH=function(e){return zp!==null?zp:(zp=new Promise(function(t,r){if(typeof window>"u"||typeof document>"u"){t(null);return}if(window.Stripe){t(window.Stripe);return}try{var n=AH();if(!(n&&e)){if(!n)n=cE(e);else if(n&&lh!==null&&ih!==null){var s;n.removeEventListener("load",lh),n.removeEventListener("error",ih),(s=n.parentNode)===null||s===void 0||s.removeChild(n),n=cE(e)}}lh=EH(t,r),ih=SH(r),n.addEventListener("load",lh),n.addEventListener("error",ih)}catch(o){r(o);return}}),zp.catch(function(t){return zp=null,Promise.reject(t)}))},CH=function(e,t,r){if(e===null)return null;var n=t[0],s=n.match(/^pk_test/),o=bH(e.version),i=jN;s&&o!==i&&console.warn("Stripe.js@".concat(o," was loaded on the page, but @stripe/stripe-js@").concat("7.3.1"," expected Stripe.js@").concat(i,". This may result in unexpected behavior. For more information, see https://docs.stripe.com/sdks/stripejs-versioning"));var c=e.apply(void 0,t);return kH(c,r),c},ch,NN=!1,MN=function(){return ch||(ch=PH(null).catch(function(e){return ch=null,Promise.reject(e)}),ch)};Promise.resolve().then(function(){return MN()}).catch(function(e){NN||console.warn(e)});var RH=function(){for(var e=arguments.length,t=new Array(e),r=0;r<e;r++)t[r]=arguments[r];NN=!0;var n=Date.now();return MN().then(function(s){return CH(s,t,n)})},D0=(e=>(e[e.ErrorLoadingStripe=0]="ErrorLoadingStripe",e[e.HandledFormError=1]="HandledFormError",e[e.UnhandledFormError=2]="UnhandledFormError",e))(D0||{});class kg{constructor(t,r,n){this.code=t,this.gatewayErrorCode=r,this.message=n}}const LN=class Sg{static getStripeLocale(t){if(["ca","hi","uk"].includes(t))return"auto";const r={zh_Hans:"zh",zh_Hant:"zh"};return Object.keys(r).includes(t)?r[t]:t}static async initializeStripe(t,r,n,s,o,i,c){if(!r||!t||!n)throw{code:0,gatewayErrorCode:void 0,message:"Stripe configuration is missing"};const u=await RH(r,{stripeAccount:t}).catch(g=>{throw this.mapInitializationError(g)});if(!u)throw{code:0,gatewayErrorCode:void 0,message:"Stripe client not found"};const p=new am(s==null?void 0:s.appearance),d=p.shape,f=p.formColors,m=p.textStyles,h=L0.bodyBase[c].fontSize||L0.bodyBase.mobile.fontSize;let b;try{b=u.elements({mode:n.mode,paymentMethodTypes:n.payment_method_types,setupFutureUsage:n.setup_future_usage,amount:n.amount,currency:n.currency,loader:"always",locale:o,appearance:{theme:"stripe",labels:"floating",variables:{borderRadius:d["input-border-radius"],focusBoxShadow:"none",colorDanger:f.error,colorTextPlaceholder:f["grey-text-light"],colorText:f["grey-text-dark"],colorTextSecondary:f["grey-text-light"],fontSizeBase:h,...i},rules:{".Input":{boxShadow:"none",paddingTop:"6px",paddingBottom:"6px",fontSize:h,border:`1px solid ${f["grey-ui-dark"]}`,backgroundColor:f["input-background"],color:f["grey-text-dark"]},".Input:focus":{border:`1px solid ${f.focus}`,outline:"none"},".Label":{fontWeight:m.labelDefault[c].fontWeight,lineHeight:"22px",color:f["grey-text-dark"]},".Label--floating":{opacity:"1"},".Input--invalid":{boxShadow:"none"}}}})}catch(g){throw this.mapInitializationError(g)}return{stripe:u,elements:b}}static async updateElementsConfiguration(t,r){t.update({mode:r.mode,paymentMethodTypes:r.payment_method_types,setupFutureUsage:r.setup_future_usage,amount:r.amount,currency:r.currency})}static isStripeHandledFormError(t){const r=t.type==="validation_error",n=t.type==="card_error"&&t.code&&this.FORM_VALIDATED_CARD_ERROR_CODES.includes(t.code);return r||n}static createPaymentElement(t,r){return t.create("payment",{business:r?{name:r}:void 0,layout:{type:"tabs"},terms:{applePay:"never",auBecsDebit:"never",bancontact:"never",card:"never",cashapp:"never",googlePay:"never",ideal:"never",paypal:"never",sepaDebit:"never",sofort:"never",usBankAccount:"never"}})}static createExpressCheckoutElement(t,r,n){const s={billingAddressRequired:r,emailRequired:!0,...n||{}};return t.create("expressCheckout",s)}static createLinkAuthenticationElement(t,r){return t.create("linkAuthentication",{defaultValues:{email:r??""}})}static async submitElements(t){const{error:r}=await t.submit();if(r)throw this.mapError(r)}static mapInitializationError(t){return new kg(0,t.code,t.message)}static mapError(t){return this.isStripeHandledFormError(t)?new kg(1,t.code,t.message):new kg(2,t.code,t.message)}static async confirmElements(t,r,n,s){const o={clientSecret:n,redirect:"if_required"},i=s?{...o,confirmParams:{confirmation_token:s}}:{...o,elements:r},c=n.startsWith("seti_");let u;if(c?u=await t.confirmSetup(i):u=await t.confirmPayment(i),u!=null&&u.error)throw this.mapError(u.error)}static async extractTaxCustomerDetails(t,r){var n,s;const{error:o,confirmationToken:i}=await r.createConfirmationToken({elements:t});if(o)throw this.mapError(o);const c=(s=(n=i.payment_method_preview)==null?void 0:n.billing_details)==null?void 0:s.address;return{customerDetails:{countryCode:(c==null?void 0:c.country)??void 0,postalCode:(c==null?void 0:c.postal_code)??void 0},confirmationTokenId:i.id}}static nextDateForPeriod(t,r){return t.unit===Ka.Year?(r.setFullYear(r.getFullYear()+t.number),r):t.unit===Ka.Month?(r.setMonth(r.getMonth()+t.number),r):t.unit===Ka.Week?(r.setDate(r.getDate()+t.number*7),r):(t.unit===Ka.Day&&r.setDate(r.getDate()+t.number),r)}static applePayPeriod(t){return t.unit===Ka.Week?{recurringPaymentIntervalUnit:"day",recurringPaymentIntervalCount:t.number*7}:{recurringPaymentIntervalUnit:t.unit,recurringPaymentIntervalCount:t.number}}static microsToMinimumAmountPrice(t,r){return["BIF","CLP","DJF","GNF","JPY","KMF","KRW","MGA","PYG","RWF","UGX","VND","VUV","XAF","XOF","XPF"].includes(r)?Math.floor(t/1e6):Math.floor(t/1e4)}static buildStripeExpressCheckoutOptionsForSubscription(t,r,n,s,o){var i;const c=Sg.microsToMinimumAmountPrice(r.totalAmountInMicros,r.currency),u=n.trial,p=(i=n.trial)==null?void 0:i.period,d=n.base.period,f=u&&p?Sg.nextDateForPeriod(p,new Date):void 0,m=d?Sg.applePayPeriod(d):{};return{applePay:{recurringPaymentRequest:{paymentDescription:t.title,managementURL:o,trialBilling:u?{label:s.translate(vr.ApplePayFreeTrial),amount:0}:void 0,regularBilling:{label:t.title,amount:c,recurringPaymentStartDate:f,...m}}}}}};ar(LN,"FORM_VALIDATED_CARD_ERROR_CODES",["card_declined","expired_card","incorrect_cvc","incorrect_number"]);let us=LN;var TH=Gt("<div></div>");function jH(e,t){Lr(t,!0);let r=null;const n="payment-element",s=async i=>{await t.onError(us.mapInitializationError(i.error))};_o(()=>{var i;try{r=us.createPaymentElement(t.elements,(i=t.brandingInfo)==null?void 0:i.app_name),r.mount(`#${n}`),r.on("ready",t.onReady),r.on("change",t.onChange),r.on("loaderror",s)}catch(c){t.onError(us.mapInitializationError(c))}}),Rm(()=>{r==null||r.destroy(),r=null});var o=TH();kr(o,"id",n),Ze(e,o),Dr()}var IH=Gt("<div></div>");function NH(e,t){Lr(t,!0);let r=null;const n="link-authentication-element",s=async i=>{await t.onError(us.mapInitializationError(i.error))};_o(()=>{try{r=us.createLinkAuthenticationElement(t.elements,t.email),r.mount(`#${n}`),r.on("ready",t.onReady),r.on("change",t.onChange),r.on("loaderror",s)}catch(i){t.onError(us.mapInitializationError(i))}}),Rm(()=>{r==null||r.destroy(),r=null});var o=IH();kr(o,"id",n),Ze(e,o),Dr()}var MH=Gt('<div class="text-separator svelte-ch0h61"><hr class="line svelte-ch0h61"> <span class="text svelte-ch0h61"><!></span> <hr class="line svelte-ch0h61"></div>');const LH={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 DH(e,t){Tr(e,LH);let r=_r(t,"text",8);var n=MH(),s=sr(At(n),2),o=At(s);_n(o,{size:"caption-default",children:(i,c)=>{var u=Cn();rr(()=>cn(u,r())),Ze(i,u)},$$slots:{default:!0}}),Ze(e,n)}var OH=Gt("<div></div> <!>",1);function zH(e,t){Lr(t,!0);const r=Fs(),n=()=>Bs(s,"$translator",r),s=fs(Ks);let o=null,i=$r(!1);const c="express-checkout-element",u=async g=>{const y={...t.expressCheckoutOptions?t.expressCheckoutOptions:{}};g.resolve(y)},p=async g=>{await t.onError(us.mapInitializationError(g.error))},d=async g=>{var y;t.onSubmit(g.expressPaymentType,((y=g.billingDetails)==null?void 0:y.email)??"")},f=async g=>{$t(i,!g.availablePaymentMethods),t.onReady()};_o(()=>{try{o=us.createExpressCheckoutElement(t.elements,t.billingAddressRequired,t.expressCheckoutOptions),o.mount(`#${c}`),o.on("ready",f),o.on("confirm",d),o.on("loaderror",p),o.on("click",u)}catch(g){t.onError(us.mapInitializationError(g))}}),Rm(()=>{o==null||o.destroy(),o=null});var m=hn(),h=Ur(m);{var b=g=>{var y=OH(),x=Ur(y);kr(x,"id",c);var v=sr(x,2),A=Tt(()=>n().translate(vr.PaymentEntryPageExpressCheckoutDivider));DH(v,{get text(){return ae(A)}}),Ze(g,y)};gr(h,g=>{ae(i)||g(b)})}Ze(e,m),Dr()}var BH=Gt('<div class="rc-elements svelte-6qa1vy"><!> <!> <!></div>');const FH={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 UH(e,t){Lr(t,!0),Tr(e,FH);const r=Fs(),n=()=>Bs(i,"$translator",r);let s=_r(t,"stripe",15,null),o=_r(t,"elements",15,null);const i=fs(Ks),c=us.getStripeLocale(n().locale||n().fallbackLocale);let u=$r(!1),p=$r(Ir(t.skipEmail)),d=$r(!1),f=$r(void 0),m=$r("mobile"),h=$r(void 0);function b(){window.matchMedia&&window.matchMedia("(max-width: 767px)").matches?$t(m,"mobile"):$t(m,"desktop"),$t(f,Ir({fontSizeBase:"14px",fontFamily:dy,spacingGridRow:"16px"}))}function g(){clearTimeout(ae(h)),$t(h,Ir(setTimeout(()=>{b()},150)))}const y=P=>{t.onError(P),t.onLoadingComplete()},x=async()=>{ae(p)||($t(p,!0),ae(p)&&ae(u)&&ae(d)&&t.onLoadingComplete())},v=async()=>{ae(d)||($t(d,!0),ae(p)&&ae(u)&&ae(d)&&t.onLoadingComplete())},A=async()=>{ae(u)||($t(u,!0),ae(p)&&ae(u)&&ae(d)&&t.onLoadingComplete())},_=async P=>{t.onPaymentInfoChange({complete:P.complete,paymentMethod:P.complete?P.value.type:void 0})},w=async P=>{t.onEmailChange(P.complete,P.value.email)};_o(()=>(window.addEventListener("resize",g),()=>{window.removeEventListener("resize",g)})),_o(async()=>{b(),!s()&&(o()||!t.stripeAccountId||!t.publishableApiKey||!t.elementsConfiguration||await us.initializeStripe(t.stripeAccountId,t.publishableApiKey,t.elementsConfiguration,t.brandingInfo,c,ae(f),ae(m)).then(({stripe:P,elements:k})=>{s(P),o(k)}).catch(P=>{t.onError(P)}))}),ep(()=>{t.elementsConfiguration&&o()&&us.updateElementsConfiguration(o(),t.elementsConfiguration)});var j=hn(),T=Ur(j);{var R=P=>{var k=BH(),E=At(k);zH(E,{get elements(){return o()},onError:y,onReady:v,get onSubmit(){return t.onExpressCheckoutElementSubmit},get expressCheckoutOptions(){return t.expressCheckoutOptions},get billingAddressRequired(){return t.billingAddressRequired}});var M=sr(E,2);{var C=L=>{NH(L,{get elements(){return o()},onReady:x,onChange:w,onError:y})};gr(M,L=>{t.skipEmail||L(C)})}var I=sr(M,2);jH(I,{get elements(){return o()},get brandingInfo(){return t.brandingInfo},onReady:A,onChange:_,onError:y}),Ze(P,k)};gr(T,P=>{o()&&P(R)})}Ze(e,j),Dr()}const qH=`<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 VH=Gt('<div class="rcb-ui-asset-icon svelte-1rk57mx"><!></div>');const HH={hash:"svelte-1rk57mx",code:".rcb-ui-asset-icon.svelte-1rk57mx {display:inline-block;width:1em;height:1em;}"};function DN(e){Tr(e,HH);var t=VH(),r=At(t);rc(r,()=>qH),Ze(e,t)}var WH=Gt('<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 GH={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 XH(e,t){Tr(e,GH);var r=WH(),n=At(r),s=At(n);DN(s);var o=sr(n,2),i=At(o),c=At(i);_n(c,{size:"body-small",children:(d,f)=>{var m=Cn();rr(()=>cn(m,t.title)),Ze(d,m)},$$slots:{default:!0}});var u=sr(i,2),p=At(u);_n(p,{size:"body-small",children:(d,f)=>{var m=Cn();rr(()=>cn(m,t.message)),Ze(d,m)},$$slots:{default:!0}}),Ze(e,r)}function YH(e,t){Lr(t,!0);const r=Fs(),n=()=>Bs(s,"$translator",r),s=fs(Ks);var o=Tt(()=>n().translate(vr.PriceUpdateTitle)),i=Tt(()=>{var c;return n().translate((c=t.subscriptionOption)!=null&&c.trial?vr.PriceUpdateTrialMessage:vr.PriceUpdateBaseMessage)});XH(e,{get title(){return ae(o)},get message(){return ae(i)}}),Dr()}function ON(e,t){if(e.productType==="subscription"){const r=t,n=r.introPrice?r.introPrice.price:r.base.price;if(n)return n}else return t.basePrice;return e.price}class uE extends Error{}var ZH=Gt('<div class="rc-loading svelte-dg9m6p"><!></div>'),KH=Gt('<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 QH={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 JH(e,t){var r,n,s;Lr(t,!0),Tr(e,QH);const o=Fs(),i=()=>Bs(u,"$translator",o),c=fs(Kx),u=fs(Ks),p=(r=t.productDetails.subscriptionOptions)==null?void 0:r[t.purchaseOption.id],d=ON(t.productDetails,t.purchaseOption);let f=$r(Ir(((n=t.defaultPriceBreakdown)==null?void 0:n.taxCalculationStatus)??((s=t.brandingInfo)!=null&&s.gateway_tax_collection_enabled?"unavailable":"disabled"))),m=$r(null),h=$r(null),b=$r(Ir(d.amountMicros)),g=$r(Ir(d.amountMicros)),y=Tt(()=>t.defaultPriceBreakdown??{currency:d.currency,totalAmountInMicros:ae(g),totalExcludingTaxInMicros:ae(b),taxCalculationStatus:ae(f),taxAmountInMicros:ae(m),taxBreakdown:ae(h)}),x=$r(Ir(t.gatewayParams.elements_configuration)),v=$r(null),A=$r(null),_=$r(null),w=$r(Ir(t.customerEmail??void 0)),j=$r(Ir(!!t.customerEmail)),T=$r(!0),R=$r(!1),P=$r(void 0),k=$r(void 0),E=$r(void 0),M=$r(!1),C=$r(null),I=Tt(()=>ae(T)||ae(M)?"loading":ae(k)?"error":"form"),L=$r("unavailable"),N=Tt(()=>!ae(M)&&ae(R)&&ae(j)&&(ae(f)==="disabled"||ae(f)==="calculated"||ae(f)==="miss-match")),S=Tt(()=>p&&t.managementUrl&&ae(y)?us.buildStripeExpressCheckoutOptionsForSubscription(t.productDetails,ae(y),p,i(),t.managementUrl):void 0);ep(()=>{t.onPriceBreakdownUpdated(ae(y))}),_o(async()=>{ae(f)==="unavailable"&&await F(null).catch(V)}),Rm(()=>{ae(C)&&(ae(C).abort(),$t(C,null))});async function F(le,De){await t.purchaseOperationHelper.checkoutCalculateTax(le==null?void 0:le.countryCode,le==null?void 0:le.postalCode,De).then(Ye=>{const Re=WV({taxCalculation:Ye,taxCustomerDetails:le});c.trackSDKEvent(Re),De==null||De.throwIfAborted(),Ye.failed_reason?!le&&Ye.failed_reason===$x.invalid_tax_location?$t(f,"pending"):$t(f,"disabled"):$t(f,"calculated"),$t(m,Ir(Ye.tax_amount_in_micros)),$t(b,Ir(Ye.total_excluding_tax_in_micros)),$t(g,Ir(Ye.total_amount_in_micros)),$t(h,Ir(Ye.tax_breakdown)),$t(x,Ir(Ye.gateway_params.elements_configuration)),$t(v,Ir(le))})}function D(){c.trackSDKEvent({eventName:Os.CheckoutPaymentFormImpression}),$t(T,!1)}async function H(le,De){$t(w,Ir(De)),$t(j,Ir(le)),await K()}async function W({complete:le,paymentMethod:De}){$t(P,Ir(De)),$t(R,Ir(le)),await K()}async function G(le){if(le==null||le.preventDefault(),ae(M))return;const De=GV({selectedPaymentMethod:ae(P)??null});c.trackSDKEvent(De),$t(M,!0),await de()?t.onContinue():$t(M,!1)}async function $(le,De){$t(P,Ir(le)),$t(w,Ir(t.customerEmail??De)),await G()}async function K(){ae(P)!=="card"||!ae(j)||!ae(R)||ae(M)||ae(f)==="disabled"||(ae(f)!=="loading"&&($t(L,Ir(ae(f))),$t(f,"loading")),await ie(async le=>{await we().then(()=>le.throwIfAborted()).then(()=>he(le)).then(()=>le.throwIfAborted()).catch(De=>{le.aborted||V(De)}).finally(()=>{ae(f)==="loading"&&!le.aborted&&$t(f,Ir(ae(L)))})}))}async function de(){return await ie(async le=>{const De=ae(g);let Ye;return await we().then(()=>le.throwIfAborted()).then(()=>he(le)).then(Re=>{Ye=Re}).then(()=>le.throwIfAborted()).then(Ae(De)).then(()=>le.throwIfAborted()).then(Fe).then(()=>le.throwIfAborted()).then(()=>U(Ye)).then(()=>le.throwIfAborted()).then(()=>!0).catch(Re=>(le.aborted||V(Re),!1))})}async function ie(le){ae(C)&&ae(C).abort(),$t(C,Ir(new AbortController));const De=ae(C).signal;try{return await le(De)}catch(Ye){if(Ye instanceof DOMException&&Ye.name==="AbortError")return Promise.resolve(void 0);throw Ye}}async function we(){ae(_)&&await us.submitElements(ae(_))}async function he(le){var De,Ye;if(ae(f)==="unavailable"||ae(f)==="disabled"||!ae(_)||!ae(A))return;const{customerDetails:Re,confirmationTokenId:et}=await us.extractTaxCustomerDetails(ae(_),ae(A));return le==null||le.throwIfAborted(),Re.postalCode===((De=ae(v))==null?void 0:De.postalCode)&&Re.countryCode===((Ye=ae(v))==null?void 0:Ye.countryCode)||await F(Re,le),et&&ae(P)!=="card"?et:void 0}function Ae(le){return()=>{if(ae(g)!==le)throw new uE}}async function Fe(){var le;const De=await t.purchaseOperationHelper.checkoutComplete(ae(w)),Ye=(le=De==null?void 0:De.gateway_params)==null?void 0:le.client_secret;Ye&&$t(E,Ir(Ye))}async function U(le){!ae(A)||!ae(_)||!ae(E)||await us.confirmElements(ae(A),ae(_),ae(E),le)}async function V(le){if(le instanceof uE)$t(f,"miss-match");else if(le instanceof Un){const De=FV({errorCode:le.errorCode.toString(),errorMessage:le.message});c.trackSDKEvent(De),le.errorCode===Mn.MissingEmailError?$t(k,Ir(i().translate(vr.ErrorPageErrorMessageInvalidEmailError,{email:ae(w)}))):t.onError(le)}else if(le instanceof kg)await z(le);else throw le}async function z(le){const De=XV({errorCode:le.gatewayErrorCode??"",errorMessage:le.message??""});c.trackSDKEvent(De),le.code===D0.HandledFormError||(le.code===D0.UnhandledFormError?$t(k,Ir(le.message)):t.onError(new Un(Mn.ErrorSettingUpPurchase,"Failed to initialize payment form",le.message)))}const O=()=>{$t(k,void 0)};var q=KH(),X=At(q);{var Z=le=>{var De=ZH(),Ye=At(De);kN(Ye),Ze(le,De)};gr(X,le=>{ae(I)==="loading"&&le(Z)})}var Q=sr(X,2);{var oe=le=>{var De=Tt(()=>i().translate(vr.ErrorButtonTryAgain));Jx(le,{title:null,type:"error",get closeButtonTitle(){return ae(De)},onDismiss:O,icon:Ye=>{lN(Ye)},message:Ye=>{var Re=Cn();rr(()=>cn(Re,ae(k))),Ze(Ye,Re)},$$slots:{icon:!0,message:!0}})};gr(Q,le=>{ae(I)==="error"&&le(oe)})}var ce=sr(Q,2),_e=At(ce),re=At(_e),pe=At(re),ee=Tt(()=>!!t.customerEmail),xe=Tt(()=>ae(f)!=="disabled");UH(pe,{get stripeAccountId(){return t.gatewayParams.stripe_account_id},get publishableApiKey(){return t.gatewayParams.publishable_api_key},get elementsConfiguration(){return ae(x)},get brandingInfo(){return t.brandingInfo},get skipEmail(){return ae(ee)},get billingAddressRequired(){return ae(xe)},onLoadingComplete:D,onError:z,onEmailChange:H,onPaymentInfoChange:W,onExpressCheckoutElementSubmit:$,get expressCheckoutOptions(){return ae(S)},get stripe(){return ae(A)},set stripe(le){$t(A,Ir(le))},get elements(){return ae(_)},set elements(le){$t(_,Ir(le))}});var Le=sr(re,2),Ge=At(Le);YH(Ge,{subscriptionOption:p});var _t=sr(Le,2),Xe=At(_t),bt=Tt(()=>!ae(N)),Pt=Tt(()=>{var le;return(le=t.brandingInfo)!=null&&le.gateway_tax_collection_enabled?ae(y):void 0});eH(Xe,{get disabled(){return ae(bt)},subscriptionOption:p,get priceBreakdown(){return ae(Pt)}});var kt=sr(Xe,2),Ee=At(kt);zV(Ee,{get brandingInfo(){return t.brandingInfo},get purchaseOption(){return t.purchaseOption}}),rr(()=>{el(_e,"invisible",ae(I)!=="form"),el(Le,"fully-hidden",ae(f)!=="miss-match"||ae(I)!=="form"),el(_t,"fully-hidden",ae(I)!=="form")}),vi("submit",ce,G),Ze(e,q),Dr()}function $H(e){return e!=null}var Wc=(e=>(e.Subscription="subscription",e.Consumable="consumable",e.NonConsumable="non_consumable",e))(Wc||{});const zN=e=>({amount:e.amount_micros/1e4,amountMicros:e.amount_micros,currency:e.currency,formattedPrice:Dl(e.amount_micros,e.currency)}),bv=e=>{const t=e.period_duration,r=e.price?zN(e.price):null,n=t?oN(t):null;let s=null,o=null,i=null;if(r!==null&&n!==null){const c=eW(n),u=1e4,p=Math.round(r.amountMicros*c.toWeek);s={amount:p/u,amountMicros:p,currency:r.currency,formattedPrice:Dl(p,r.currency)};const d=Math.round(r.amountMicros*c.toMonth);o={amount:d/u,amountMicros:d,currency:r.currency,formattedPrice:Dl(d,r.currency)};const f=Math.round(r.amountMicros*c.toYear);i={amount:f/u,amountMicros:f,currency:r.currency,formattedPrice:Dl(f,r.currency)}}return{periodDuration:t,period:n,cycleCount:e.cycle_count,price:r,pricePerWeek:s,pricePerMonth:o,pricePerYear:i}};function eW(e){const{number:t,unit:r}=e,n=7,s=30,o=365;let i;switch(r){case Ka.Day:i=t;break;case Ka.Week:i=t*n;break;case Ka.Month:i=t*s;break;case Ka.Year:i=t*o;break;default:i=0,Jr.errorLog(`Unknown period unit: ${r}`)}const c=i>0?n/i:0,u=i>0?s/i:0,p=i>0?o/i:0;return{toWeek:c,toMonth:u,toYear:p}}const tW=e=>e.base==null?(Jr.debugLog("Missing base phase for subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,base:bv(e.base),trial:e.trial?bv(e.trial):null,introPrice:e.intro_price?bv(e.intro_price):null},rW=e=>e.base_price==null?(Jr.debugLog("Missing base price for non-subscription option. Ignoring."),null):{id:e.id,priceId:e.price_id,basePrice:zN(e.base_price)},nW=(e,t)=>{const r=e.product_type;return r==="subscription"?sW(e,t,r):aW(e,t,r)},aW=(e,t,r)=>{const n={};if(Object.entries(e.purchase_options).forEach(([i,c])=>{const u=rW(c);u!=null&&(n[i]=u)}),Object.keys(n).length===0)return Jr.debugLog(`Product ${e.identifier} has no purchase options. Ignoring.`),null;const s=e.default_purchase_option_id,o=s&&s in e.purchase_options?n[s]:null;return o==null?(Jr.debugLog(`Product ${e.identifier} has no default purchase option. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:r,currentPrice:o.basePrice,normalPeriodDuration:null,presentedOfferingIdentifier:t.offeringIdentifier,presentedOfferingContext:t,defaultPurchaseOption:o,defaultSubscriptionOption:null,subscriptionOptions:{},defaultNonSubscriptionOption:o,price:o.basePrice,period:null,freeTrialPhase:null,introPricePhase:null}},sW=(e,t,r)=>{const n={};if(Object.entries(e.purchase_options).forEach(([c,u])=>{const p=tW(u);p!=null&&(n[c]=p)}),Object.keys(n).length===0)return Jr.debugLog(`Product ${e.identifier} has no subscription options. Ignoring.`),null;const s=e.default_purchase_option_id,o=s&&s in n?n[s]:null;if(o==null)return Jr.debugLog(`Product ${e.identifier} has no default subscription option. Ignoring.`),null;const i=o.base.price;return i==null?(Jr.debugLog(`Product ${e.identifier} default option has no base price. Ignoring.`),null):{identifier:e.identifier,displayName:e.title,title:e.title,description:e.description,productType:r,currentPrice:i,normalPeriodDuration:o.base.periodDuration,presentedOfferingIdentifier:t.offeringIdentifier,presentedOfferingContext:t,defaultPurchaseOption:o,defaultSubscriptionOption:o,subscriptionOptions:n,defaultNonSubscriptionOption:null,price:i,period:o.base.period,freeTrialPhase:o.trial,introPricePhase:o.introPrice}},oW=(e,t,r)=>{const n=r[t.platform_product_identifier];if(n===void 0)return null;const s=nW(n,e);return s===null?null:{identifier:t.identifier,rcBillingProduct:s,webBillingProduct:s,packageType:lW(t.identifier)}},iW=(e,t,r,n)=>{const s={offeringIdentifier:t.identifier,targetingContext:e&&n?{ruleId:n.rule_id,revision:n.revision}:null,placementIdentifier:null},o=t.packages.map(c=>oW(s,c,r)).filter($H),i={};for(const c of o)c!=null&&(i[c.identifier]=c);return o.length==0?null:{identifier:t.identifier,serverDescription:t.description,metadata:t.metadata,packagesById:i,availablePackages:o,lifetime:i.$rc_lifetime??null,annual:i.$rc_annual??null,sixMonth:i.$rc_six_month??null,threeMonth:i.$rc_three_month??null,twoMonth:i.$rc_two_month??null,monthly:i.$rc_monthly??null,weekly:i.$rc_weekly??null,paywall_components:t.paywall_components?t.paywall_components:null}};function lW(e){switch(e){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 e.startsWith("$rc_")?"unknown":"custom"}}var cW=Ii('<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 uW={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 uh(e,t){Tr(e,uW);let r=_r(t,"direction",8);var n=cW();rr(()=>_q(n,`arrow ${r()??""} svelte-1qexsu3`)),Ze(e,n)}var dW=Ii('<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 pW={hash:"svelte-r0zny8",code:".arrow-fill.svelte-r0zny8 {fill:var(--rc-color-grey-text-dark);}"};function fW(e){Tr(e,pW);var t=dW();Ze(e,t)}const mW=`<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 hW=Gt('<div style="color:var(--rc-color-gray-text-dark);"><!></div>');function gW(e){var t=hW(),r=At(t);rc(r,()=>mW),Ze(e,t)}const yW=`<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 bW=Gt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-wgufvv"><!></div>');const vW={hash:"svelte-wgufvv",code:"div.svelte-wgufvv {height:24px;width:24px;}"};function _W(e){Tr(e,vW);var t=bW(),r=At(t);rc(r,()=>yW),Ze(e,t)}const wW=`<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 xW=Gt('<div style="color:var(--rc-color-primary)"><!></div>');function BN(e){var t=xW(),r=At(t);rc(r,()=>wW),Ze(e,t)}var AW=Ii('<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 kW={hash:"svelte-1jpfelf",code:".arrow-fill.svelte-1jpfelf {fill:var(--arrow-fill-color, var(--rc-color-grey-text-dark));}"};function SW(e){Tr(e,kW);var t=AW();Ze(e,t)}const EW={cart:gW,error:lN,lock:_W,success:BN,back:fW,info:DN,close:SW,"chevron-left":uh,"chevron-right":uh,"chevron-up":uh,"chevron-down":uh};function sm(e,t){Lr(t,!0);const r=EW[t.name];let n=$r(Ir({}));if(t.name.startsWith("chevron")){const s=t.name.split("-")[1];$t(n,Ir({direction:s}))}r(e,sl(()=>ae(n))),Dr()}var PW=Gt('<span class="rc-sandbox-only-error svelte-1d8gf9n"><!></span> <br> <br>',1),CW=Gt('<!> <a class="svelte-1d8gf9n"> </a>.',1),RW=Gt("<!> <!>",1);const TW={hash:"svelte-1d8gf9n",code:"a.svelte-1d8gf9n {color:var(--rc-color-grey-text-dark);}.rc-sandbox-only-error.svelte-1d8gf9n {font-weight:bold;}"};function jW(e,t){Lr(t,!0),Tr(e,TW);const r=Fs(),n=()=>Bs(o,"$translator",r),s=Tt(()=>t.lastError??new Un(Mn.UnknownError,"Unknown error without state set.")),o=fs(Ks),i=Tt(()=>ae(s).errorCode===Mn.StripeTaxNotActive||ae(s).errorCode===Mn.StripeInvalidTaxOriginAddress||ae(s).errorCode===Mn.StripeMissingRequiredPermission);_o(()=>{Jr.errorLog(`Displayed error: ${Mn[ae(s).errorCode]}. Message: ${ae(s).message??"None"}. Underlying error: ${ae(s).underlyingErrorMessage??"None"}`)});function c(){return ae(s).errorCode===Mn.AlreadyPurchasedError?n().translate(vr.ErrorPageCloseButtonTitle,{appName:t.appName??"App"}):ae(i)?n().translate(vr.ErrorButtonClose):n().translate(vr.ErrorButtonTryAgain)}function u(){switch(ae(s).errorCode){case Mn.AlreadyPurchasedError:return t.productDetails.productType===Wc.Subscription?n().translate(vr.ErrorPageErrorTitleAlreadySubscribed,{productTitle:t.productDetails.title}):n().translate(vr.ErrorPageErrorTitleAlreadyPurchased,{productTitle:t.productDetails.title});case Mn.StripeTaxNotActive:return n().translate(vr.ErrorPageErrorTitleStripeTaxNotActive);case Mn.StripeInvalidTaxOriginAddress:return n().translate(vr.ErrorPageErrorTitleStripeInvalidTaxOriginAddress);case Mn.StripeMissingRequiredPermission:return n().translate(vr.ErrorPageErrorTitleStripeMissingRequiredPermission);default:return n().translate(vr.ErrorPageErrorTitleOtherErrors)}}function p(){const b=ae(s).getErrorCode();switch(ae(s).errorCode){case Mn.ErrorSettingUpPurchase:return n().translate(vr.ErrorPageErrorMessageErrorSettingUpPurchase,{errorCode:b});case Mn.ErrorChargingPayment:return n().translate(vr.ErrorPageErrorMessageErrorChargingPayment,{errorCode:b});case Mn.AlreadyPurchasedError:return t.productDetails.productType===Wc.Subscription?n().translate(vr.ErrorPageErrorMessageAlreadySubscribed,{errorCode:b}):n().translate(vr.ErrorPageErrorMessageAlreadyPurchased,{errorCode:b});case Mn.StripeTaxNotActive:return n().translate(vr.ErrorPageErrorMessageStripeTaxNotActive,{errorCode:b});case Mn.StripeInvalidTaxOriginAddress:return n().translate(vr.ErrorPageErrorMessageStripeInvalidTaxOriginAddress,{errorCode:b});case Mn.StripeMissingRequiredPermission:return n().translate(vr.ErrorPageErrorMessageStripeMissingRequiredPermission,{errorCode:b});case Mn.NetworkError:return n().translate(vr.ErrorPageErrorMessageNetworkError,{errorCode:b});default:return n().translate(vr.ErrorPageErrorMessageUnknownError,{errorCode:b})}}function d(){return ae(s).errorCode===Mn.AlreadyPurchasedError?vr.ErrorPageTroubleAccessing:vr.ErrorPageIfErrorPersists}function f(){return ae(s).errorCode===Mn.AlreadyPurchasedError?"success":"error"}var m=Tt(u),h=Tt(c);Jx(e,{get title(){return ae(m)},get onDismiss(){return t.onDismiss},type:"error",get closeButtonTitle(){return ae(h)},icon:b=>{var g=Tt(f);sm(b,{get name(){return ae(g)}})},message:b=>{var g=RW(),y=Ur(g);{var x=w=>{var j=PW(),T=Ur(j),R=At(T);js(R,{get key(){return vr.ErrorPageErrorMessageOnlyInSandbox}}),Ze(w,j)};gr(y,w=>{ae(i)&&w(x)})}var v=sr(y);rr(()=>cn(v,` ${p()??""} `));var A=sr(v);{var _=w=>{var j=CW(),T=Ur(j),R=Tt(d);js(T,{get key(){return ae(R)}});var P=sr(T,2),k=At(P);rr(()=>{kr(P,"href",`mailto:${t.supportEmail??""}`),cn(k,t.supportEmail)}),Ze(w,j)};gr(A,w=>{!ae(i)&&t.supportEmail&&w(_)})}Ze(b,g)},$$slots:{icon:!0,message:!0}}),Dr()}function IW(e,t){Lr(t,!1);const r=Fs(),n=()=>Bs(o,"$translator",r);let s=_r(t,"onContinue",8);const o=fs(Ks),i=fs(Kx);function c(){i.trackSDKEvent({eventName:Os.CheckoutPurchaseSuccessfulDismiss,properties:{ui_element:"go_back_to_app"}}),s()()}_o(()=>{i.trackSDKEvent({eventName:Os.CheckoutPurchaseSuccessfulImpression})}),xo();var u=Rd(()=>n().translate(vr.SuccessPagePurchaseSuccessful)),p=Rd(()=>n().translate(vr.SuccessPageButtonClose));Jx(e,{type:"success",get title(){return ae(u)},onDismiss:c,get closeButtonTitle(){return ae(p)},icon:d=>{BN(d)},$$slots:{icon:!0}}),Dr()}function NW(e){kN(e)}var MW=Gt('<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 LW={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 DW(e,t){Lr(t,!1),Tr(e,LW);const r=Fs(),n=()=>Bs(i,"$translator",r);let s=_r(t,"isExpanded",12,!0),o=_r(t,"children",8);const i=fs(Ks);function c(){s(!s())}xo();var u=MW(),p=At(u),d=At(p);_n(d,{size:"label-default",children:(v,A)=>{var _=hn(),w=Ur(_);{var j=R=>{var P=Cn();rr(()=>cn(P,n().translate(vr.PricingDropdownHideDetails))),Ze(R,P)},T=R=>{var P=Cn();rr(()=>cn(P,n().translate(vr.PricingDropdownShowDetails))),Ze(R,P)};gr(w,R=>{s()?R(j):R(T,!1)})}Ze(v,_)},$$slots:{default:!0}});var f=sr(d,2),m=At(f);{var h=v=>{sm(v,{name:"chevron-up"})},b=v=>{sm(v,{name:"chevron-down"})};gr(m,v=>{s()?v(h):v(b,!1)})}var g=sr(p,2),y=At(g),x=At(y);ya(x,()=>o()??Rn),rr(()=>{kr(p,"aria-expanded",s()),el(g,"collapsed",!s())}),vi("click",p,c),vi("keydown",p,v=>v.key==="Enter"||v.key===" "?c():null),Ze(e,u),Dr()}var OW=Gt('<div class="rcb-pricing-table-value-loading svelte-erv89n"><!></div>');const zW={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 BW(e,t){Lr(t,!1),Tr(e,zW);let r=_r(t,"children",8);xo();var n=OW(),s=At(n);ya(s,()=>r()??Rn),Ze(e,n),Dr()}var FW=Gt('<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>'),UW=Gt('<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>'),qW=Gt('<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>'),VW=Gt('<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),HW=Gt('<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>'),WW=Gt('<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 GW={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 XW(e,t){var r;Lr(t,!0),Tr(e,GW);const n=Fs(),s=()=>Bs(c,"$translator",n),o=h=>{var b=WW(),g=At(b);{var y=R=>{var P=VW(),k=Ur(P),E=At(k),M=At(E);_n(M,{size:"body-small",children:(F,D)=>{var H=Cn();rr(()=>cn(H,s().translate(vr.PricingTotalExcludingTax))),Ze(F,H)},$$slots:{default:!0}});var C=sr(E,2),I=At(C);_n(I,{size:"body-small",children:(F,D)=>{var H=Cn();rr(()=>cn(H,s().formatPrice(t.priceBreakdown.totalExcludingTaxInMicros,t.priceBreakdown.currency))),Ze(F,H)},$$slots:{default:!0}});var L=sr(k,2);{var N=F=>{var D=FW(),H=At(D),W=At(H);_n(W,{size:"body-small",children:(K,de)=>{var ie=Cn();rr(()=>cn(ie,s().translate(vr.PricingTableTax))),Ze(K,ie)},$$slots:{default:!0}});var G=sr(H,2),$=At(G);_n($,{size:"body-small",children:(K,de)=>{BW(K,{children:(ie,we)=>{var he=Cn();rr(()=>cn(he,s().formatPrice(1234e4,t.priceBreakdown.currency))),Ze(ie,he)},$$slots:{default:!0}})},$$slots:{default:!0}}),Ze(F,D)},S=F=>{var D=hn(),H=Ur(D);{var W=$=>{var K=UW(),de=At(K),ie=At(de);rr(()=>cn(ie,s().translate(vr.PricingTableTax)));var we=sr(de,2),he=At(we);_n(he,{size:"body-small",children:(Ae,Fe)=>{var U=Cn();rr(()=>cn(U,s().translate(vr.PricingTableEnterBillingAddressToCalculate))),Ze(Ae,U)},$$slots:{default:!0}}),Ze($,K)},G=$=>{var K=hn(),de=Ur(K);{var ie=we=>{var he=hn(),Ae=Ur(he);rp(Ae,17,()=>t.priceBreakdown.taxBreakdown,tp,(Fe,U)=>{var V=qW(),z=At(V),O=At(z);_n(O,{size:"body-small",children:(Z,Q)=>{var oe=Cn();rr(()=>cn(oe,ae(U).display_name)),Ze(Z,oe)},$$slots:{default:!0}});var q=sr(z,2),X=At(q);_n(X,{size:"body-small",children:(Z,Q)=>{var oe=Cn();rr(()=>cn(oe,s().formatPrice(ae(U).tax_amount_in_micros,t.priceBreakdown.currency))),Ze(Z,oe)},$$slots:{default:!0}}),Ze(Fe,V)}),Ze(we,he)};gr(de,we=>{t.priceBreakdown.taxBreakdown!==null&&we(ie)},!0)}Ze($,K)};gr(H,$=>{t.priceBreakdown.taxCalculationStatus==="pending"?$(W):$(G,!1)},!0)}Ze(F,D)};gr(L,F=>{t.priceBreakdown.taxCalculationStatus==="loading"?F(N):F(S,!1)})}Ze(R,P)};gr(g,R=>{ae(u)&&R(y)})}var x=sr(g,2);{var v=R=>{var P=HW(),k=At(P),E=At(k);_n(E,{size:"body-small",children:(I,L)=>{var N=Cn();rr(()=>cn(N,s().translate(vr.PricingTableTrialEnds,{formattedTrialEndDate:s().translateDate(ae(i),{dateStyle:"medium"})}))),Ze(I,N)},$$slots:{default:!0}});var M=sr(k,2),C=At(M);_n(C,{size:"body-small",children:(I,L)=>{var N=Cn();rr(()=>cn(N,s().formatPrice(t.priceBreakdown.totalAmountInMicros,t.priceBreakdown.currency))),Ze(I,N)},$$slots:{default:!0}}),Ze(R,P)};gr(x,R=>{ae(i)&&R(v)})}var A=sr(x,2),_=At(A),w=At(_);_n(w,{size:"body-small",children:(R,P)=>{var k=Cn();rr(()=>cn(k,s().translate(vr.PricingTableTotalDueToday))),Ze(R,k)},$$slots:{default:!0}});var j=sr(_,2),T=At(j);_n(T,{size:"body-small",children:(R,P)=>{var k=hn(),E=Ur(k);{var M=I=>{var L=Cn();rr(()=>cn(L,s().formatPrice(0,t.priceBreakdown.currency))),Ze(I,L)},C=I=>{var L=Cn();rr(()=>cn(L,s().formatPrice(t.priceBreakdown.totalAmountInMicros,t.priceBreakdown.currency))),Ze(I,L)};gr(E,I=>{ae(i)?I(M):I(C,!1)})}Ze(R,k)},$$slots:{default:!0}}),Ze(h,b)};let i=$r(null);(r=t.trialPhase)!=null&&r.period&&$t(i,Ir(R0(new Date,t.trialPhase.period,!0)));const c=fs(Ks),u=Tt(()=>t.priceBreakdown.taxCalculationStatus!=="unavailable"&&t.priceBreakdown.taxCalculationStatus!=="disabled"&&t.priceBreakdown.taxBreakdown&&t.priceBreakdown.taxBreakdown.length>0);var p=hn(),d=Ur(p);{var f=h=>{DW(h,{children:(b,g)=>{o(b)},$$slots:{default:!0}})},m=h=>{o(h)};gr(d,h=>{ae(u)?h(f):h(m,!1)})}Ze(e,p),Dr()}var YW=Gt('<div class="rcb-subscribe-to svelte-4fnm8t"><!></div>'),ZW=Gt('<span class="rcb-product-description svelte-4fnm8t"><!></span>'),KW=Gt('<div class="rcb-pricing-info-header svelte-4fnm8t"><!> <div class="rcb-product-title svelte-4fnm8t"><!></div> <!></div>');const QW={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 JW(e,t){Lr(t,!1),Tr(e,QW);let r=_r(t,"productDetails",8),n=_r(t,"showProductDescription",8);const s=r().productType===Wc.Subscription;xo();var o=KW(),i=At(o);{var c=m=>{var h=YW(),b=At(h);_n(b,{size:"body-base",children:(g,y)=>{var x=Rd(()=>({productTitle:r().title}));js(g,{get key(){return vr.ProductInfoSubscribeTo},get variables(){return ae(x)}})},$$slots:{default:!0}}),Ze(m,h)};gr(i,m=>{s&&m(c)})}var u=sr(i,2),p=At(u);_n(p,{size:"heading-lg",branded:!0,children:(m,h)=>{var b=Rd(()=>({productTitle:r().title}));js(m,{get key(){return vr.ProductInfoProductTitle},get variables(){return ae(b)}})},$$slots:{default:!0}});var d=sr(u,2);{var f=m=>{var h=ZW(),b=At(h);_n(b,{size:"body-small",children:(g,y)=>{var x=Rd(()=>({productDescription:r().description}));js(g,{get key(){return vr.ProductInfoProductDescription},get variables(){return ae(x)}})},$$slots:{default:!0}}),Ze(m,h)};gr(d,m=>{n()&&r().description&&m(f)})}Ze(e,o),Dr()}var $W=Gt("<div><!></div>"),eG=Gt("<div><!> <!></div>"),tG=Gt('<div class="rcb-product-price-container svelte-509gz3"><!> <!> <div><!> <!> <!></div></div>');const rG={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 nG(e,t){Lr(t,!0),Tr(e,rG);const r=Fs(),n=()=>Bs(s,"$translator",r),s=fs(Ks),o=Tt(()=>{var k;return(k=t.introPricePhase)!=null&&k.period&&n().translatePeriod(t.introPricePhase.period.number*t.introPricePhase.cycleCount,t.introPricePhase.period.unit)||""}),i=Tt(()=>"heading-lg"),c=Tt(()=>{var k;return(k=t.trialPhase)!=null&&k.periodDuration?"heading-md":"heading-lg"}),u=Tt(()=>{var k,E;return(k=t.trialPhase)!=null&&k.periodDuration||(E=t.introPricePhase)!=null&&E.periodDuration?"heading-md":"heading-lg"}),p=Tt(()=>{var k;return(k=t.trialPhase)==null?void 0:k.periodDuration}),d=Tt(()=>{var k;return(k=t.introPricePhase)==null?void 0:k.periodDuration}),f=Tt(()=>{var k;return((k=t.introPricePhase)==null?void 0:k.cycleCount)==1}),m=Tt(()=>{var k,E;return n().formatPrice(ae(d)?((E=(k=t.basePhase)==null?void 0:k.price)==null?void 0:E.amountMicros)??0:t.priceBreakdown.totalAmountInMicros,t.priceBreakdown.currency)}),h=Tt(()=>n().formatPrice(t.priceBreakdown.totalAmountInMicros,t.priceBreakdown.currency));var b=tG(),g=At(b);{var y=k=>{var E=$W(),M=At(E);_n(M,{get size(){return ae(i)},children:(C,I)=>{var L=Tt(()=>({trialDuration:h7(t.trialPhase.periodDuration,n())}));js(C,{get key(){return vr.ProductInfoFreeTrialDuration},get variables(){return ae(L)}})},$$slots:{default:!0}}),Ze(k,E)};gr(g,k=>{var E;(E=t.trialPhase)!=null&&E.periodDuration&&k(y)})}var x=sr(g,2);{var v=k=>{var E=eG(),M=At(E);_n(M,{get size(){return ae(c)},children:(N,S)=>{var F=Tt(()=>ae(p)?vr.ProductInfoIntroPricePhaseAfterTrial:vr.ProductInfoIntroPricePhase),D=Tt(()=>({introPriceDuration:ae(o),introPrice:ae(h)}));js(N,{get key(){return ae(F)},get variables(){return ae(D)}})},$$slots:{default:!0}});var C=sr(M,2);{var I=N=>{_n(N,{size:"body-small",children:(S,F)=>{js(S,{get key(){return vr.ProductInfoIntroPricePhasePaidOnce}})},$$slots:{default:!0}})},L=N=>{var S=hn(),F=Ur(S);{var D=H=>{_n(H,{size:"body-small",children:(W,G)=>{var $=Cn();rr(()=>cn($,n().translatePeriodFrequency(t.introPricePhase.period.number,t.introPricePhase.period.unit,{useMultipleWords:!0}))),Ze(W,$)},$$slots:{default:!0}})};gr(F,H=>{t.introPricePhase.period&&H(D)},!0)}Ze(N,S)};gr(C,N=>{ae(f)?N(I):N(L,!1)})}Ze(k,E)};gr(x,k=>{var E;(E=t.introPricePhase)!=null&&E.periodDuration&&k(v)})}var A=sr(x,2),_=At(A);_n(_,{get size(){return ae(u)},children:(k,E)=>{var M=Cn();rr(()=>cn(M,ae(m))),Ze(k,M)},$$slots:{default:!0}});var w=sr(_,2);{var j=k=>{_n(k,{size:"body-small",children:(E,M)=>{var C=Cn();rr(()=>cn(C,n().translatePeriodFrequency(t.basePhase.period.number,t.basePhase.period.unit,{useMultipleWords:!0}))),Ze(E,C)},$$slots:{default:!0}})};gr(w,k=>{var E;(E=t.basePhase)!=null&&E.period&&k(j)})}var T=sr(w,2);{var R=k=>{_n(k,{size:"body-small",children:(E,M)=>{js(E,{get key(){return vr.ProductInfoAfter}})},$$slots:{default:!0}})},P=k=>{var E=hn(),M=Ur(E);{var C=I=>{_n(I,{size:"body-small",children:(L,N)=>{js(L,{get key(){return vr.ProductInfoAfterTrial}})},$$slots:{default:!0}})};gr(M,I=>{ae(p)&&I(C)},!0)}Ze(k,E)};gr(T,k=>{ae(d)?k(R):k(P,!1)})}Ze(e,b),Dr()}var aG=Gt('<div class="rcb-pricing-info svelte-18guro7"><div class="rcb-pricing-info-header svelte-18guro7"><!> <!></div> <!></div>');const sG={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 oG(e,t){Tr(e,sG);let r=_r(t,"productDetails",8),n=_r(t,"purchaseOption",8),s=_r(t,"showProductDescription",8),o=_r(t,"priceBreakdown",8);const i=n(),c=i==null?void 0:i.base,u=i==null?void 0:i.trial,p=i==null?void 0:i.introPrice;var d=aG(),f=At(d),m=At(f);JW(m,{get productDetails(){return r()},get showProductDescription(){return s()}});var h=sr(m,2);nG(h,{get priceBreakdown(){return o()},basePhase:c,trialPhase:u,introPricePhase:p});var b=sr(f,2);XW(b,{get priceBreakdown(){return o()},trialPhase:u}),Ze(e,d)}const of=e=>`https://da08ctfrofx1b.cloudfront.net/${e}`;var iG=Gt('<div class="rcb-ui-container svelte-1h6xr8z"><!></div>');const lG={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 cG(e,t){Lr(t,!0),Tr(e,lG);const r=_r(t,"brandingAppearance",3,void 0),n=_r(t,"brandFontConfig",3,void 0),s=_r(t,"isInElement",3,!1),o=Tt(()=>new am(r()).getTextStyleVars(n())),i=Tt(()=>new am(r()).spacingStyleVars),c=Tt(()=>[ae(o),ae(i)].join("; ")),u=Tt(()=>{var m;return(m=n())!=null&&m.font_url?of(n().font_url):null}),p=async m=>{try{const h=new FontFace(PN,`url(${m})`);await h.load(),document.fonts.add(h)}catch(h){console.error("Failed to set brand font:",h)}};ep(()=>{ae(u)&&p(ae(u))});var d=iG(),f=At(d);ya(f,()=>t.children??Rn),rr(()=>{kr(d,"style",ae(c)),el(d,"fullscreen",!s()),el(d,"inside",s())}),Ze(e,d),Dr()}var uG=Gt('<div id="layout-query-container" class="svelte-1x4ow5d"><div class="rcb-ui-layout svelte-1x4ow5d"><!></div></div>');const dG={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 pG(e,t){Lr(t,!1),Tr(e,dG);let r=_r(t,"style",8,""),n=_r(t,"children",8);xo();var s=uG(),o=At(s),i=At(o);ya(i,()=>n()??Rn),rr(()=>kr(o,"style",r())),Ze(e,s),Dr()}const fG=e=>e;function mG(e){const t=e-1;return t*t*t+1}function dE(e){const t=typeof e=="string"&&e.match(/^\s*(-?[\d.]+)([^\s]*)\s*$/);return t?[parseFloat(t[1]),t[2]||"px"]:[e,"px"]}function hG(e,{delay:t=0,duration:r=400,easing:n=fG}={}){const s=+getComputedStyle(e).opacity;return{delay:t,duration:r,easing:n,css:o=>`opacity: ${o*s}`}}function gG(e,{delay:t=0,duration:r=400,easing:n=mG,x:s=0,y:o=0,opacity:i=0}={}){const c=getComputedStyle(e),u=+c.opacity,p=c.transform==="none"?"":c.transform,d=u*(1-i),[f,m]=dE(s),[h,b]=dE(o);return{delay:t,duration:r,easing:n,css:(g,y)=>`
			transform: ${p} translate(${(1-g)*f}${m}, ${(1-g)*h}${b});
			opacity: ${u-d*y}`}}var yG=Gt('<div><div class="layout-wrapper svelte-1w6qvx7"><div><!></div></div></div>');const bG={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 FN(e,t){Lr(t,!0),Tr(e,bG);const r=`rcb-${t.location}`;var n=yG();ql(n,`layout-wrapper-outer ${r??""} svelte-1w6qvx7`);var s=At(n),o=At(s);ql(o,`layout-content ${r??""} svelte-1w6qvx7`);var i=At(o);ya(i,()=>t.children??Rn),nN(3,o,()=>hG,()=>({duration:500,delay:50})),Ze(e,n),Dr()}var vG=Gt('<div class="navbar-body svelte-jz90ay"><!></div>'),_G=Gt('<div class="navbar-header svelte-jz90ay"><!></div> <!>',1),wG=Gt('<div class="rcb-ui-navbar svelte-jz90ay"><!></div>');const xG={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 AG(e,t){Lr(t,!0),Tr(e,xG);const r=_r(t,"brandingAppearance",3,void 0),n=Tt(()=>new am(r()).productInfoStyleVars);var s=wG(),o=At(s);FN(o,{location:"navbar",children:(i,c)=>{var u=_G(),p=Ur(u),d=At(p);ya(d,()=>t.headerContent??Rn);var f=sr(p,2);{var m=h=>{var b=vG(),g=At(b);ya(g,()=>t.bodyContent??Rn),Ze(h,b)};gr(f,h=>{t.bodyContent&&h(m)})}Ze(i,u)},$$slots:{default:!0}}),rr(()=>kr(s,"style",ae(n))),Ze(e,s),Dr()}var kG=Gt('<button class="rcb-close-button svelte-nssttr" data-testid="close-button"><!></button>');const SG={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 UN(e,t){Tr(e,SG);var r=kG(),n=At(r);sm(n,{name:"close"}),vi("click",r,function(s){sN.call(this,t,s)}),Ze(e,r)}const EG=`<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 PG=Gt('<div style="color:var(--rc-color-accent);" class="rcb-ui-asset-icon svelte-5vi85d"><!></div>');const CG={hash:"svelte-5vi85d",code:"div.svelte-5vi85d {height:12px;width:12px;}"};function RG(e){Tr(e,CG);var t=PG(),r=At(t);rc(r,()=>EG),Ze(e,t)}var TG=Gt('<span class="rcb-sandbox-text svelte-18xxdea">SANDBOX</span>'),jG=Gt('<span class="rcb-sandbox-text svelte-18xxdea">Share feedback</span>'),IG=Gt('<a class="rcb-ui-sandbox-banner-link svelte-18xxdea" target="_blank"><!> <!></a>'),NG=Gt('<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 MG={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 LG(e,t){Lr(t,!1),Tr(e,MG);let r=_r(t,"style",8,""),n=_r(t,"isInElement",8,!1),s=_r(t,"brandingInfo",8,null),o=To(!0);function i(){Jr.debugLog("closeBanner"),$t(o,!1)}xo();var c=hn(),u=Ur(c);{var p=d=>{var f=NG(),m=sr(At(f),2),h=At(m);_n(h,{size:"caption-default",children:(v,A)=>{var _=TG();Ze(v,_)},$$slots:{default:!0}});var b=sr(m,2),g=At(b);{var y=v=>{var A=IG(),_=At(A);RG(_);var w=sr(_,2);_n(w,{size:"caption-link",children:(j,T)=>{var R=jG();Ze(j,R)},$$slots:{default:!0}}),rr(()=>kr(A,"href",s().sandbox_configuration.checkout_feedback_form_url)),Ze(v,A)};gr(g,v=>{var A;(A=s())!=null&&A.sandbox_configuration&&v(y)})}var x=sr(g,2);UN(x,{$$events:{click:i}}),rr(()=>{kr(f,"style",r()),el(f,"isInElement",n())}),nN(2,f,()=>gG,()=>({y:-100,duration:300})),Ze(d,f)};gr(u,d=>{ae(o)&&d(p)})}Ze(e,c),Dr()}var DG=Gt('<div class="rcb-ui-main svelte-nr408n"><!></div>');const OG={hash:"svelte-nr408n",code:".rcb-ui-main.svelte-nr408n {flex:1;display:flex;background-color:var(--rc-color-background);}"};function zG(e,t){Lr(t,!0),Tr(e,OG);const r=Tt(()=>new am(t.brandingAppearance).formStyleVars);var n=DG(),s=At(n);FN(s,{location:"main-block",children:(o,i)=>{var c=hn(),u=Ur(c);ya(u,()=>t.children??Rn),Ze(o,c)},$$slots:{default:!0}}),rr(()=>kr(n,"style",ae(r))),Ze(e,n),Dr()}var BG=Gt("<!> <!>",1),FG=Gt("<!> <!>",1);function UG(e,t){Lr(t,!0);const r=Tt(()=>{var o;return TN((o=t.brandingInfo)==null?void 0:o.appearance)??""});var n=Tt(()=>{var o;return(o=t.brandingInfo)==null?void 0:o.appearance}),s=Tt(()=>{var o;return(o=t.brandingInfo)==null?void 0:o.brand_font_config});cG(e,{get brandingAppearance(){return ae(n)},get brandFontConfig(){return ae(s)},get isInElement(){return t.isInElement},children:(o,i)=>{var c=FG(),u=Ur(c);{var p=f=>{LG(f,{get style(){return ae(r)},get isInElement(){return t.isInElement},get brandingInfo(){return t.brandingInfo}})};gr(u,f=>{t.isSandbox&&f(p)})}var d=sr(u,2);pG(d,{get style(){return ae(r)},children:(f,m)=>{var h=BG(),b=Ur(h);{var g=v=>{var A=Tt(()=>{var _;return(_=t.brandingInfo)==null?void 0:_.appearance});AG(v,{get brandingAppearance(){return ae(A)},get headerContent(){return t.navbarHeaderContent},get bodyContent(){return t.navbarBodyContent}})};gr(b,v=>{(t.navbarHeaderContent||t.navbarBodyContent)&&v(g)})}var y=sr(b,2),x=Tt(()=>{var v;return(v=t.brandingInfo)==null?void 0:v.appearance});zG(y,{get brandingAppearance(){return ae(x)},children:(v,A)=>{var _=hn(),w=Ur(_);ya(w,()=>t.mainContent??Rn),Ze(v,_)},$$slots:{default:!0}}),Ze(f,h)},$$slots:{default:!0}}),Ze(o,c)},$$slots:{default:!0}}),Dr()}var qG=Gt('<source type="image/webp">'),VG=Gt('<picture class="rcb-app-icon-picture-container svelte-el1u77"><!> <img class="rcb-app-icon svelte-el1u77" alt="App icon"></picture>'),HG=Gt('<div class="rcb-app-icon loading svelte-el1u77"></div>');const WG={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 GG(e,t){Tr(e,WG);var r=hn(),n=Ur(r);{var s=i=>{var c=VG(),u=At(c);{var p=f=>{var m=qG();rr(()=>kr(m,"srcset",t.srcWebp)),Ze(f,m)};gr(u,f=>{t.srcWebp&&f(p)})}var d=sr(u,2);rr(()=>kr(d,"src",t.src)),Ze(i,c)},o=i=>{var c=HG();Ze(i,c)};gr(n,i=>{t.src?i(s):i(o,!1)})}Ze(e,r)}var XG=Gt('<button class="rcb-back-button svelte-9xjbko" data-testid="close-button"><!></button>');const YG={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 ZG(e,t){Tr(e,YG);var r=XG(),n=At(r);sm(n,{name:"back"}),vi("click",r,function(s){sN.call(this,t,s)}),Ze(e,r)}var KG=Gt('<source type="image/webp" class="rcb-app-icon svelte-19gv4gf">'),QG=Gt('<picture class="rcb-app-icon svelte-19gv4gf"><!> <img class="rcb-app-icon svelte-19gv4gf" alt="App icon"></picture>');const JG={hash:"svelte-19gv4gf",code:".rcb-app-icon.svelte-19gv4gf {height:32px;}"};function $G(e,t){Tr(e,JG);var r=QG(),n=At(r);{var s=i=>{var c=KG();rr(()=>kr(c,"srcset",t.srcWebp)),Ze(i,c)};gr(n,i=>{t.srcWebp&&i(s)})}var o=sr(n,2);rr(()=>kr(o,"src",t.src)),Ze(e,r)}var eX=Gt('<div class="rcb-back-wrapper svelte-11zapuq"><!></div>'),tX=Gt('<div class="rcb-close-wrapper svelte-11zapuq"><!></div>'),rX=Gt('<div class="rcb-header-wrapper svelte-11zapuq"><!> <div class="rcb-header svelte-11zapuq"><div class="rcb-title svelte-11zapuq"><!> <!></div></div> <!></div>');const nX={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 aX(e,t){Lr(t,!0),Tr(e,nX);const r=R=>R==null||R==null||R==""?null:R,n=Tt(()=>{var R;return r((R=t.brandingInfo)==null?void 0:R.app_icon)}),s=Tt(()=>{var R;return r((R=t.brandingInfo)==null?void 0:R.app_icon_webp)}),o=Tt(()=>{var R;return r((R=t.brandingInfo)==null?void 0:R.app_wordmark)}),i=Tt(()=>{var R;return r((R=t.brandingInfo)==null?void 0:R.app_wordmark_webp)}),c=Tt(()=>ae(n)?of(ae(n)):null),u=Tt(()=>ae(s)?of(ae(s)):null),p=Tt(()=>ae(o)?of(ae(o)):null),d=Tt(()=>ae(i)?of(ae(i)):null),f=()=>{t.onClose&&t.onClose()};var m=rX(),h=At(m);{var b=R=>{var P=eX(),k=At(P);ZG(k,{$$events:{click:f}}),Ze(R,P)};gr(h,R=>{t.showCloseButton&&R(b)})}var g=sr(h,2),y=At(g),x=At(y);{var v=R=>{$G(R,{get src(){return ae(p)},get srcWebp(){return ae(d)}})},A=R=>{var P=hn(),k=Ur(P);{var E=M=>{GG(M,{get src(){return ae(c)},get srcWebp(){return ae(u)}})};gr(k,M=>{ae(c)!==null&&ae(u)!==null&&M(E)},!0)}Ze(R,P)};gr(x,R=>{ae(p)!==null?R(v):R(A,!1)})}var _=sr(x,2);{var w=R=>{_n(R,{size:"body-base",children:(P,k)=>{var E=Cn();rr(()=>{var M;return cn(E,(M=t.brandingInfo)==null?void 0:M.app_name)}),Ze(P,E)},$$slots:{default:!0}})};gr(_,R=>{ae(p)===null&&R(w)})}var j=sr(g,2);{var T=R=>{var P=tX(),k=At(P);UN(k,{$$events:{click:f}}),Ze(R,P)};gr(j,R=>{t.showCloseButton&&R(T)})}rr(()=>el(m,"rcb-with-close-button",t.showCloseButton)),Ze(e,m),Dr()}var sX=Gt("<!> <!> <!> <!>",1);function oX(e,t){Lr(t,!0);const r=_r(t,"onClose",3,void 0),n=ON(t.productDetails,t.purchaseOptionToUse);let s=$r(Ir(t.defaultPriceBreakdown??{currency:n.currency,totalAmountInMicros:n.amountMicros,totalExcludingTaxInMicros:n.amountMicros,taxCalculationStatus:"unavailable",taxAmountInMicros:null,taxBreakdown:null}));const o=i=>{$t(s,Ir(i))};UG(e,{get brandingInfo(){return t.brandingInfo},get isInElement(){return t.isInElement},get isSandbox(){return t.isSandbox},get onClose(){return r()},navbarHeaderContent:i=>{var c=Tt(()=>!t.isInElement&&!!r());aX(i,{get brandingInfo(){return t.brandingInfo},get onClose(){return r()},get showCloseButton(){return ae(c)}})},navbarBodyContent:i=>{var c=Tt(()=>{var u,p;return((p=(u=t.brandingInfo)==null?void 0:u.appearance)==null?void 0:p.show_product_description)??!1});oG(i,{get productDetails(){return t.productDetails},get purchaseOption(){return t.purchaseOptionToUse},get showProductDescription(){return ae(c)},get priceBreakdown(){return ae(s)}})},mainContent:i=>{var c=sX(),u=Ur(c);{var p=y=>{NW(y)};gr(u,y=>{t.currentPage==="payment-entry-loading"&&y(p)})}var d=sr(u,2);{var f=y=>{JH(y,{get productDetails(){return t.productDetails},get purchaseOption(){return t.purchaseOptionToUse},get brandingInfo(){return t.brandingInfo},get purchaseOperationHelper(){return t.purchaseOperationHelper},get gatewayParams(){return t.gatewayParams},get managementUrl(){return t.managementUrl},get customerEmail(){return t.customerEmail},get defaultPriceBreakdown(){return t.defaultPriceBreakdown},get onContinue(){return t.onContinue},get onError(){return t.onError},onPriceBreakdownUpdated:o})};gr(d,y=>{t.currentPage==="payment-entry"&&y(f)})}var m=sr(d,2);{var h=y=>{var x=Tt(()=>{var A;return((A=t.brandingInfo)==null?void 0:A.support_email)??null}),v=Tt(()=>{var A;return((A=t.brandingInfo)==null?void 0:A.app_name)??null});jW(y,{get lastError(){return t.lastError},get productDetails(){return t.productDetails},get supportEmail(){return ae(x)},get onDismiss(){return t.closeWithError},get appName(){return ae(v)}})};gr(m,y=>{t.currentPage==="error"&&y(h)})}var b=sr(m,2);{var g=y=>{IW(y,{get onContinue(){return t.onContinue}})};gr(b,y=>{t.currentPage==="success"&&y(g)})}Ze(i,c)},$$slots:{navbarHeaderContent:!0,navbarBodyContent:!0,mainContent:!0}}),Dr()}function iX(e){return e.trim()===""?"You need to provide your email address to continue.":e.match(/^[^@]+@[^@]+\.[^@]+$/)?null:"Email is not valid. Please provide a valid email address."}function lX(e){if(e&&!e.match(/^[A-Z]{3}$/)){const t=`Currency code ${e} is not valid. Please provide a valid ISO 4217 currency code.`;throw Jr.errorLog(t),new ra(Ra.ConfigurationError,t)}}function cX(e,t){var r;Lr(t,!0);const n=_r(t,"customTranslations",19,()=>({})),s=_r(t,"skipSuccessPage",3,!1),o=t.customerEmail?iX(t.customerEmail):null;let i=$r(Ir(o?void 0:t.customerEmail)),c=t.rcPackage.webBillingProduct,u=$r(null);const p=t.rcPackage.webBillingProduct.identifier??null;let d=$r("payment-entry-loading"),f=$r(null),m=$r(Ir({})),h=$r(null),b=$r(null),g=$r(null),y=$r(null),x=new gb(n(),t.selectedLocale,t.defaultLocale),v=uN(x);hv(Ks,v),hv(Qx,(r=t.brandingInfo)==null?void 0:r.appearance),_o(()=>{t.isInElement||($t(b,Ir(document.documentElement.style.height)),$t(g,Ir(document.documentElement.style.overflow)),$t(y,Ir(document.body.style.height)),document.documentElement.style.height="100%",document.body.style.height="100%",document.documentElement.style.overflow="hidden")}),Rm(()=>{if(!t.isInElement){const R=(P,k,E)=>{E===""?P.style.removeProperty(k):P.style.setProperty(k,E)};R(document.documentElement,"height",ae(b)),R(document.body,"height",ae(y)),R(document.documentElement,"overflow",ae(g))}}),hv(Kx,t.eventsTracker),_o(async()=>{if(p===null){_(new Un(Mn.ErrorSettingUpPurchase,"Product ID was not set before purchase."));return}t.purchaseOperationHelper.checkoutStart(t.appUserId,p,t.purchaseOption,t.rcPackage.webBillingProduct.presentedOfferingContext,ae(i),t.metadata).then(R=>{$t(u,null),$t(d,"payment-entry"),$t(m,Ir(R.gateway_params)),$t(h,Ir(R.management_url))}).catch(R=>{if(R.errorCode===Mn.MissingEmailError)return $t(i,void 0),t.purchaseOperationHelper.checkoutStart(t.appUserId,p,t.purchaseOption,t.rcPackage.webBillingProduct.presentedOfferingContext,ae(i),t.metadata).then(P=>{$t(u,null),$t(d,"payment-entry"),$t(m,Ir(P.gateway_params)),$t(h,Ir(P.management_url))}).catch(P=>{_(P)});_(R)})});const A=()=>{if(ae(d)==="payment-entry"){t.purchaseOperationHelper.pollCurrentPurchaseForCompletion().then(R=>{$t(f,Ir(R)),s()?t.onFinished(R):$t(d,"success")}).catch(R=>{_(R)});return}if(ae(d)==="success"||ae(d)==="error"){t.onFinished(ae(f));return}$t(d,"success")},_=R=>{const P=BV({errorCode:R.getErrorCode().toString(),errorMessage:R.message});t.eventsTracker.trackSDKEvent(P),$t(u,Ir(R)),$t(d,"error")},w=()=>{t.onError(ae(u)??new Un(Mn.UnknownError,"Unknown error without state set."))};var j=Tt(()=>t.purchases.isSandbox()),T=Tt(()=>ae(i)??null);oX(e,{get isSandbox(){return ae(j)},get currentPage(){return ae(d)},get brandingInfo(){return t.brandingInfo},productDetails:c,get purchaseOptionToUse(){return t.purchaseOption},get lastError(){return ae(u)},get gatewayParams(){return ae(m)},get managementUrl(){return ae(h)},get purchaseOperationHelper(){return t.purchaseOperationHelper},get isInElement(){return t.isInElement},get customerEmail(){return ae(T)},closeWithError:w,onContinue:A,onError:_,get onClose(){return t.onClose}}),Dr()}function qN(e){return e==null?!0:new Date(e)>new Date}function uX(e,t,r,n){const s=t.product_identifier;if(s in r)return dX(e,t,r[s]);if(s in n)return pX(e,t,n[s]);throw new ra(Ra.CustomerInfoError,"Could not find entitlement product in subscriptions or non-subscriptions.")}function dX(e,t,r){return{identifier:e,isActive:qN(t.expires_date),willRenew:HN(t.expires_date,r),store:(r==null?void 0:r.store)??"unknown",latestPurchaseDate:new Date(t.purchase_date),originalPurchaseDate:new Date(t.purchase_date),expirationDate:fi(t.expires_date),productIdentifier:t.product_identifier,productPlanIdentifier:t.product_plan_identifier??null,unsubscribeDetectedAt:fi(r==null?void 0:r.unsubscribe_detected_at),billingIssueDetectedAt:fi(r==null?void 0:r.billing_issues_detected_at),isSandbox:(r==null?void 0:r.is_sandbox)??!1,periodType:(r==null?void 0:r.period_type)??"normal",ownershipType:(r==null?void 0:r.ownership_type)??"UNKNOWN"}}function pX(e,t,r){return{identifier:e,isActive:!0,willRenew:!1,store:r.store,latestPurchaseDate:new Date(t.purchase_date),originalPurchaseDate:new Date(r.original_purchase_date),expirationDate:null,productIdentifier:t.product_identifier,productPlanIdentifier:null,unsubscribeDetectedAt:null,billingIssueDetectedAt:null,isSandbox:r.is_sandbox,periodType:"normal",ownershipType:"UNKNOWN"}}function fX(e,t,r){const n={},s={};for(const o in e){const i=uX(o,e[o],t,r);n[o]=i,i.isActive&&(s[o]=i)}return{all:n,active:s}}function fi(e){return e==null?null:new Date(e)}function VN(e){const t=hX(e),r=e.subscriber,n=yX(r.non_subscriptions),s=Object.entries(e.subscriber.non_subscriptions).flatMap(([c,u])=>u.map(p=>({transactionIdentifier:p.id,productIdentifier:c,purchaseDate:new Date(p.purchase_date||p.original_purchase_date),storeTransactionId:p.store_transaction_id||null,store:p.store}))),o=new Date(e.request_date),i=Object.fromEntries(Object.entries(e.subscriber.subscriptions).map(([c,u])=>[c,{productIdentifier:c,purchaseDate:new Date(u.purchase_date),originalPurchaseDate:fi(u.original_purchase_date),expiresDate:fi(u.expires_date),store:u.store,unsubscribeDetectedAt:fi(u.unsubscribe_detected_at),isSandbox:u.is_sandbox,billingIssuesDetectedAt:fi(u.billing_issues_detected_at),gracePeriodExpiresDate:fi(u.grace_period_expires_date),ownershipType:u.ownership_type??"UNKNOWN",periodType:u.period_type,refundedAt:fi(u.refunded_at),storeTransactionId:u.store_transaction_id||null,isActive:qN(u.expires_date),willRenew:HN(u.expires_date,u)}]));return{entitlements:fX(r.entitlements,r.subscriptions,n),allExpirationDatesByProduct:t,allPurchaseDatesByProduct:mX(e,n),activeSubscriptions:gX(t),managementURL:r.management_url,requestDate:o,firstSeenDate:new Date(r.first_seen),originalPurchaseDate:fi(r.original_purchase_date),originalAppUserId:e.subscriber.original_app_user_id,nonSubscriptionTransactions:s,subscriptionsByProductIdentifier:i}}function HN(e,t){if(t==null)return!1;const r=t.store=="promotional",n=e==null,s=t.unsubscribe_detected_at!=null,o=t.billing_issues_detected_at!=null;return!(r||n||s||o)}function mX(e,t){const r={};for(const n in e.subscriber.subscriptions){const s=e.subscriber.subscriptions[n];r[n]=new Date(s.purchase_date)}for(const n in t){const s=t[n].purchase_date;s==null?r[n]=null:r[n]=new Date(s)}return r}function hX(e){const t={};for(const r in e.subscriber.subscriptions){const n=e.subscriber.subscriptions[r];n.expires_date==null?t[r]=null:t[r]=new Date(n.expires_date)}return t}function gX(e){const t=new Set,r=new Date;for(const n in e){const s=e[n];(s==null||s>r)&&t.add(n)}return t}function yX(e){const t={};for(const r in e){if(e[r].length===0)continue;const n=e[r].length;t[r]=e[r][n-1]}return t}const WN="1.13.1",bX="https://api.revenuecat.com",vX="https://e.revenue.cat";var fy;(function(e){e[e.CONTINUE=100]="CONTINUE",e[e.SWITCHING_PROTOCOLS=101]="SWITCHING_PROTOCOLS",e[e.PROCESSING=102]="PROCESSING",e[e.EARLY_HINTS=103]="EARLY_HINTS",e[e.OK=200]="OK",e[e.CREATED=201]="CREATED",e[e.ACCEPTED=202]="ACCEPTED",e[e.NON_AUTHORITATIVE_INFORMATION=203]="NON_AUTHORITATIVE_INFORMATION",e[e.NO_CONTENT=204]="NO_CONTENT",e[e.RESET_CONTENT=205]="RESET_CONTENT",e[e.PARTIAL_CONTENT=206]="PARTIAL_CONTENT",e[e.MULTI_STATUS=207]="MULTI_STATUS",e[e.MULTIPLE_CHOICES=300]="MULTIPLE_CHOICES",e[e.MOVED_PERMANENTLY=301]="MOVED_PERMANENTLY",e[e.MOVED_TEMPORARILY=302]="MOVED_TEMPORARILY",e[e.SEE_OTHER=303]="SEE_OTHER",e[e.NOT_MODIFIED=304]="NOT_MODIFIED",e[e.USE_PROXY=305]="USE_PROXY",e[e.TEMPORARY_REDIRECT=307]="TEMPORARY_REDIRECT",e[e.PERMANENT_REDIRECT=308]="PERMANENT_REDIRECT",e[e.BAD_REQUEST=400]="BAD_REQUEST",e[e.UNAUTHORIZED=401]="UNAUTHORIZED",e[e.PAYMENT_REQUIRED=402]="PAYMENT_REQUIRED",e[e.FORBIDDEN=403]="FORBIDDEN",e[e.NOT_FOUND=404]="NOT_FOUND",e[e.METHOD_NOT_ALLOWED=405]="METHOD_NOT_ALLOWED",e[e.NOT_ACCEPTABLE=406]="NOT_ACCEPTABLE",e[e.PROXY_AUTHENTICATION_REQUIRED=407]="PROXY_AUTHENTICATION_REQUIRED",e[e.REQUEST_TIMEOUT=408]="REQUEST_TIMEOUT",e[e.CONFLICT=409]="CONFLICT",e[e.GONE=410]="GONE",e[e.LENGTH_REQUIRED=411]="LENGTH_REQUIRED",e[e.PRECONDITION_FAILED=412]="PRECONDITION_FAILED",e[e.REQUEST_TOO_LONG=413]="REQUEST_TOO_LONG",e[e.REQUEST_URI_TOO_LONG=414]="REQUEST_URI_TOO_LONG",e[e.UNSUPPORTED_MEDIA_TYPE=415]="UNSUPPORTED_MEDIA_TYPE",e[e.REQUESTED_RANGE_NOT_SATISFIABLE=416]="REQUESTED_RANGE_NOT_SATISFIABLE",e[e.EXPECTATION_FAILED=417]="EXPECTATION_FAILED",e[e.IM_A_TEAPOT=418]="IM_A_TEAPOT",e[e.INSUFFICIENT_SPACE_ON_RESOURCE=419]="INSUFFICIENT_SPACE_ON_RESOURCE",e[e.METHOD_FAILURE=420]="METHOD_FAILURE",e[e.MISDIRECTED_REQUEST=421]="MISDIRECTED_REQUEST",e[e.UNPROCESSABLE_ENTITY=422]="UNPROCESSABLE_ENTITY",e[e.LOCKED=423]="LOCKED",e[e.FAILED_DEPENDENCY=424]="FAILED_DEPENDENCY",e[e.UPGRADE_REQUIRED=426]="UPGRADE_REQUIRED",e[e.PRECONDITION_REQUIRED=428]="PRECONDITION_REQUIRED",e[e.TOO_MANY_REQUESTS=429]="TOO_MANY_REQUESTS",e[e.REQUEST_HEADER_FIELDS_TOO_LARGE=431]="REQUEST_HEADER_FIELDS_TOO_LARGE",e[e.UNAVAILABLE_FOR_LEGAL_REASONS=451]="UNAVAILABLE_FOR_LEGAL_REASONS",e[e.INTERNAL_SERVER_ERROR=500]="INTERNAL_SERVER_ERROR",e[e.NOT_IMPLEMENTED=501]="NOT_IMPLEMENTED",e[e.BAD_GATEWAY=502]="BAD_GATEWAY",e[e.SERVICE_UNAVAILABLE=503]="SERVICE_UNAVAILABLE",e[e.GATEWAY_TIMEOUT=504]="GATEWAY_TIMEOUT",e[e.HTTP_VERSION_NOT_SUPPORTED=505]="HTTP_VERSION_NOT_SUPPORTED",e[e.INSUFFICIENT_STORAGE=507]="INSUFFICIENT_STORAGE",e[e.NETWORK_AUTHENTICATION_REQUIRED=511]="NETWORK_AUTHENTICATION_REQUIRED"})(fy||(fy={}));const _X=/^rcb_[a-zA-Z0-9_.-]+$/,wX=/^pdl_[a-zA-Z0-9_.-]+$/,xX=/^test_[a-zA-Z0-9_.-]+$/;function my(e){return e?e.startsWith("rcb_sb_"):!1}function AX(e){return e?_X.test(e):!1}function kX(e){return e?wX.test(e):!1}function lf(e){return e?xX.test(e):!1}async function Ro(e,t,r){const{apiKey:n,body:s,headers:o,httpConfig:i}=t,c=`${(i==null?void 0:i.proxyURL)??bX}${e.urlPath()}`;try{const u=await fetch(c,{method:e.method,headers:eM(n,o,i==null?void 0:i.additionalHeaders),body:EX(s),signal:r});return await SX(u,e),await u.json()}catch(u){throw u instanceof TypeError?new ra(Ra.NetworkError,Rf.getPublicMessage(Ra.NetworkError),u.message):u}}async function SX(e,t){const r=e.status;if(r>=fy.INTERNAL_SERVER_ERROR)vv(t,r,await e.text());else if(r>=fy.BAD_REQUEST){const n=await e.json(),s=n?JSON.stringify(n):null,o=n==null?void 0:n.code,i=n==null?void 0:n.message;if(o!=null){const c=Rf.convertCodeToBackendErrorCode(o);if(c==null)vv(t,r,s,o);else throw ra.getForBackendError(c,i)}else vv(t,r,s)}}function vv(e,t,r,n){throw new ra(Ra.UnknownBackendError,"Unknown backend error.",`Request: ${e.name}. Status code: ${t}. Body: ${r}.`,{backendErrorCode:n})}function EX(e){return e==null?null:JSON.stringify(e)}const GN="Authorization",XN="Content-Type",YN="Accept",ZN="X-Platform",KN="X-Version",QN="X-Platform-Flavor",JN="X-Platform-Flavor-Version",$N="X-Is-Sandbox",PX=new Set([GN,XN,YN,ZN,KN,$N,QN,JN]);function eM(e,t,r){let n={[GN]:`Bearer ${e}`,[XN]:"application/json",[YN]:"application/json",[ZN]:"web",[KN]:WN,[$N]:`${my(e)}`};const s=jc.getPlatformInfo();if(s){const o={[QN]:s.flavor,[JN]:s.version};n={...n,...o}}return t&&(n={...n,...t}),r&&(n={...r,...n}),n}const bb="/v1/subscribers",Ap="/rcbilling/v1";class CX{constructor(t){ar(this,"appUserId"),ar(this,"method","GET"),ar(this,"name","getOfferings"),this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${bb}/${t}/offerings`}}class RX{constructor(t,r,n){ar(this,"method","GET"),ar(this,"name","getProducts"),ar(this,"appUserId"),ar(this,"productIds"),ar(this,"currency"),this.appUserId=t,this.productIds=r,this.currency=n}urlPath(){const t=encodeURIComponent(this.appUserId),r=this.productIds.map(encodeURIComponent).join("&id="),n=this.currency?`&currency=${this.currency}`:"";return`${Ap}/subscribers/${t}/products?id=${r}${n}`}}class TX{constructor(t){ar(this,"method","GET"),ar(this,"name","getCustomerInfo"),ar(this,"appUserId"),this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${bb}/${t}`}}class jX{constructor(){ar(this,"method","GET"),ar(this,"name","getBrandingInfo")}urlPath(){return`${Ap}/branding`}}class IX{constructor(){ar(this,"method","POST"),ar(this,"name","postCheckoutStart")}urlPath(){return`${Ap}/checkout/start`}}class NX{constructor(t){ar(this,"method","POST"),ar(this,"name","postCheckoutCalculateTax"),ar(this,"operationSessionId"),this.operationSessionId=t}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/calculate_taxes`}}class MX{constructor(t){ar(this,"method","POST"),ar(this,"name","postCheckoutComplete"),ar(this,"operationSessionId"),this.operationSessionId=t}urlPath(){return`${Ap}/checkout/${this.operationSessionId}/complete`}}class LX{constructor(t){ar(this,"method","GET"),ar(this,"name","getCheckoutStatus"),ar(this,"operationSessionId"),this.operationSessionId=t}urlPath(){return`${Ap}/checkout/${this.operationSessionId}`}}class DX{constructor(t){ar(this,"method","POST"),ar(this,"name","setAttributes"),ar(this,"appUserId"),this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${bb}/${t}/attributes`}}class OX{constructor(){ar(this,"method","POST"),ar(this,"name","postReceipt")}urlPath(){return"/v1/receipts"}}class zX{constructor(t){ar(this,"method","GET"),ar(this,"name","getVirtualCurrencies"),ar(this,"appUserId"),this.appUserId=t}urlPath(){const t=encodeURIComponent(this.appUserId);return`${bb}/${t}/virtual_currencies`}}const O0={};class BX{constructor(t,r=O0){ar(this,"API_KEY"),ar(this,"httpConfig"),ar(this,"isSandbox"),this.API_KEY=t,this.httpConfig=r,this.isSandbox=my(t)}getIsSandbox(){return this.isSandbox}async getOfferings(t){return await Ro(new CX(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getCustomerInfo(t){return await Ro(new TX(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getProducts(t,r,n){return await Ro(new RX(t,r,n),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async getBrandingInfo(){return await Ro(new jX,{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async postCheckoutStart(t,r,n,s,o,i,c=void 0){const u={app_user_id:t,product_id:r,email:i,price_id:s.priceId,presented_offering_identifier:n.offeringIdentifier,trace_id:o};return c&&(u.metadata=c),s.id!=="base_option"&&(u.offer_id=s.id),n.targetingContext&&(u.applied_targeting_rule={rule_id:n.targetingContext.ruleId,revision:n.targetingContext.revision}),n.placementIdentifier&&(u.presented_placement_identifier=n.placementIdentifier),await Ro(new IX,{apiKey:this.API_KEY,body:u,httpConfig:this.httpConfig})}async postCheckoutCalculateTax(t,r,n,s){const o={country_code:r,postal_code:n};return await Ro(new NX(t),{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig},s)}async postCheckoutComplete(t,r){const n={email:r};return await Ro(new MX(t),{apiKey:this.API_KEY,body:n,httpConfig:this.httpConfig})}async getCheckoutStatus(t){return await Ro(new LX(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}async setAttributes(t,r){const n=Date.now(),s={};for(const[i,c]of Object.entries(r))s[i]={value:c,updated_at_ms:n};const o={attributes:s};return await Ro(new DX(t),{apiKey:this.API_KEY,body:o,httpConfig:this.httpConfig})}async postReceipt(t,r,n,s,o){let i=null;s.targetingContext&&(i={rule_id:s.targetingContext.ruleId,revision:s.targetingContext.revision});const c={fetch_token:n,product_id:r,app_user_id:t,presented_offering_identifier:s.offeringIdentifier,presented_placement_identifier:s.placementIdentifier,applied_targeting_rule:i,initiation_source:o};return await Ro(new OX,{apiKey:this.API_KEY,body:c,httpConfig:this.httpConfig})}async getVirtualCurrencies(t){return await Ro(new zX(t),{apiKey:this.API_KEY,httpConfig:this.httpConfig})}}function FX(e,t){if(!(AX(e)||lf(e)||kX(e)&&(t!=null&&t.allowPaddleAPIKey)))throw new ra(Ra.InvalidCredentialsError,"Invalid API key. Use your Web Billing API key.")}function pE(e){if(!e||new Set(["no_user","null","none","nil","(null)","NaN","\\x00","","unidentified","undefined","unknown"]).has(e)||e.includes("/"))throw new ra(Ra.InvalidAppUserIdError,'Provided user id: "'+(e??"[Not provided]")+'" is not valid. See https://www.revenuecat.com/docs/customers/user-ids#tips-for-setting-app-user-ids for more information.')}function UX(e){if(e!=null&&e.endsWith("/"))throw new ra(Ra.ConfigurationError,"Invalid proxy URL. The proxy URL should not end with a trailing slash.")}function qX(e){if(e){for(const t in e)if(PX.has(t))throw new ra(Ra.ConfigurationError,"Invalid additional headers. Some headers are reserved for internal use.")}}var tM=(e=>(e.Current="current",e))(tM||{});function VX(e,t){async function r(...n){return await this.preload(),await e.call(this,...n)}return r}const rM=(e,t)=>{const r={...e.webBillingProduct,presentedOfferingContext:{...e.webBillingProduct.presentedOfferingContext,placementIdentifier:t}};return{...e,webBillingProduct:r,rcBillingProduct:r}},dc=(e,t)=>e==null?null:rM(e,t),HX=(e,t,r)=>{const n=e.offering_ids_by_placement??null;if(n==null)return null;const s=e.fallback_offering_id??null;let o;if(r in n){const c=n[r]??null;if(c==null)return null;o=t[c],o==null&&(o=t[s])}else o=t[s];if(o==null)return null;const i=Object.fromEntries(Object.entries(o.packagesById).map(([c,u])=>[c,rM(u,r)]));return{...o,packagesById:i,availablePackages:Object.values(i),weekly:dc(o.weekly,r),monthly:dc(o.monthly,r),twoMonth:dc(o.twoMonth,r),threeMonth:dc(o.threeMonth,r),sixMonth:dc(o.sixMonth,r),annual:dc(o.annual,r),lifetime:dc(o.lifetime,r)}};function WX(e,t){const r={};t.product_details.forEach(o=>{r[o.identifier]=o});const n={};e.offerings.forEach(o=>{const i=o.identifier===e.current_offering_id,c=iW(i,o,r,e.targeting);c!=null&&(n[o.identifier]=c)});const s=e.current_offering_id?n[e.current_offering_id]??null:null;return Object.keys(n).length==0&&Jr.debugLog("Empty offerings. Please make sure you've configured offerings correctly in the RevenueCat dashboard and that the products are properly configured."),{all:n,current:s}}const GX=1000001;function XX(e){return e.webBillingProduct.defaultPurchaseOption}function fE(e,t,r,n=!1){return r.translate(vr.PaywallVariablesPricePerPeriod,{formattedPrice:e,period:t.base.period?r.translatePeriod(t.base.period.number,t.base.period.unit,{noWhitespace:!0,short:!n}):""})}function YX(e,t){return e.unit==="year"?t.translatePeriod(e.number*12,Ka.Month):t.translatePeriod(e.number,e.unit)}function ZX({price:e,period:t,translator:r}){const n=r.formatPrice(e.amountMicros,e.currency);return t?t.unit==="year"?r.formatPrice(e.amountMicros/12/4,e.currency):t.unit==="month"||t.unit==="week"&&t.number>1?r.formatPrice(e.amountMicros/t.number,e.currency):t.unit==="day"?r.formatPrice(e.amountMicros*7/t.number,e.currency):n:n}function KX({price:e,period:t,translator:r}){const n=r.formatPrice(e.amountMicros,e.currency);return!t||!t.number?n:t.unit==="year"?r.formatPrice(e.amountMicros/12,e.currency):t.unit==="month"&&t.number>1?r.formatPrice(e.amountMicros/t.number,e.currency):t.unit==="week"?r.formatPrice(e.amountMicros*4/t.number,e.currency):t.unit==="day"?r.formatPrice(e.amountMicros*30/t.number,e.currency):n}function mE({price:e,period:t,full:r=!1,translator:n}){if(!t||!t.number||t.unit===Ka.Month&&t.number==1)return n.formatPrice(e.amountMicros,e.currency);let s="";switch(t.unit){case Ka.Year:s=n.formatPrice(e.amountMicros/12,e.currency);break;case Ka.Month:s=n.formatPrice(e.amountMicros/t.number,e.currency);break;case Ka.Week:s=n.formatPrice(e.amountMicros*4/t.number,e.currency);break;case Ka.Day:s=n.formatPrice(e.amountMicros*30/t.number,e.currency);break}return n.translate(vr.PaywallVariablesTotalPriceAndPerMonth,{formattedPrice:n.formatPrice(e.amountMicros,e.currency),period:n.translatePeriod(t.number,t.unit,{noWhitespace:!0,short:!r}),formattedPricePerMonth:s,monthPeriod:n.translatePeriodUnit(Ka.Month,{noWhitespace:!0,short:!r})})}function QX(e,t){const r=e.availablePackages,n=r.reduce((s,o)=>{const i=s.webBillingProduct.price||s.webBillingProduct.price,c=o.webBillingProduct.price||o.webBillingProduct.price;return i.amountMicros>c.amountMicros?s:o});return r.reduce((s,o)=>(s[o.identifier]=JX(o,n,t),s),{})}function JX(e,t,r){const n=e.webBillingProduct,s=n.price||n.price,o=r.formatPrice(s.amountMicros,s.currency),i=XX(e),c=n.productType,u={product_name:n.title,price:o,price_per_period:"",price_per_period_full:"",total_price_and_per_month:"",total_price_and_per_month_full:"",sub_price_per_month:"",sub_price_per_week:"",sub_duration:"",sub_duration_in_months:"",sub_period:"",sub_period_length:"",sub_period_abbreviated:"",sub_offer_duration:void 0,sub_offer_duration_2:void 0,sub_offer_price:void 0,sub_offer_price_2:void 0,sub_relative_discount:""};if(c===Wc.Subscription&&i){u.price_per_period=fE(o,i,r),u.price_per_period_full=fE(o,i,r,!0);const p=n.period||i.base.period;u.total_price_and_per_month=mE({price:s,period:p,translator:r}),u.total_price_and_per_month_full=mE({price:s,period:p,full:!0,translator:r}),u.sub_price_per_month=KX({price:s,period:p,translator:r}),u.sub_price_per_week=ZX({price:s,period:p,translator:r}),u.sub_duration=r.translatePeriod(p==null?void 0:p.number,p==null?void 0:p.unit),u.sub_duration_in_months=YX(p,r),u.sub_period=r.translatePeriodFrequency(p==null?void 0:p.number,p==null?void 0:p.unit),u.sub_period_length=p?r.translatePeriodUnit(p.unit,{noWhitespace:!0}):void 0,u.sub_period_abbreviated=p?r.translatePeriodUnit(p.unit,{noWhitespace:!0,short:!0}):void 0;const d=s.amountMicros,f=(t.webBillingProduct.price||t.webBillingProduct.price).amountMicros,m=((f-d)*100/f).toFixed(0);u.sub_relative_discount=d===f?"":r.translate(vr.PaywallVariablesSubRelativeDiscount,{discount:m})}return(c===Wc.NonConsumable||c===Wc.Consumable)&&i&&(u.price=o,u.price_per_period=o,u.price_per_period_full=o,u.total_price_and_per_month=o,u.sub_price_per_month=o,u.sub_duration=r.translate(vr.PeriodsLifetime),u.sub_duration_in_months=r.translate(vr.PeriodsLifetime),u.sub_period=r.translate(vr.PeriodsLifetime),u.sub_price_per_week=void 0,u.sub_relative_discount=void 0,u.price_per_period_full=o,u.total_price_and_per_month_full=o,u.sub_period_length=void 0,u.sub_period_abbreviated=void 0),u}const Ga=[];for(let e=0;e<256;++e)Ga.push((e+256).toString(16).slice(1));function $X(e,t=0){return(Ga[e[t+0]]+Ga[e[t+1]]+Ga[e[t+2]]+Ga[e[t+3]]+"-"+Ga[e[t+4]]+Ga[e[t+5]]+"-"+Ga[e[t+6]]+Ga[e[t+7]]+"-"+Ga[e[t+8]]+Ga[e[t+9]]+"-"+Ga[e[t+10]]+Ga[e[t+11]]+Ga[e[t+12]]+Ga[e[t+13]]+Ga[e[t+14]]+Ga[e[t+15]]).toLowerCase()}let _v;const eY=new Uint8Array(16);function tY(){if(!_v){if(typeof crypto>"u"||!crypto.getRandomValues)throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");_v=crypto.getRandomValues.bind(crypto)}return _v(eY)}const rY=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto),hE={randomUUID:rY};function nM(e,t,r){var n;if(hE.randomUUID&&!e)return hE.randomUUID();e=e||{};const s=e.random??((n=e.rng)==null?void 0:n.call(e))??tY();if(s.length<16)throw new Error("Random bytes length must be >= 16");return s[6]=s[6]&15|64,s[8]=s[8]&63|128,$X(s)}var nY=/(%?)(%([sdijo]))/g;function aY(e,t){switch(t){case"s":return e;case"d":case"i":return Number(e);case"j":return JSON.stringify(e);case"o":{if(typeof e=="string")return e;const r=JSON.stringify(e);return r==="{}"||r==="[]"||/^\[object .+?\]$/.test(r)?e:r}}}function nA(e,...t){if(t.length===0)return e;let r=0,n=e.replace(nY,(s,o,i,c)=>{const u=t[r],p=aY(u,c);return o?s:(r++,p)});return r<t.length&&(n+=` ${t.slice(r).join(" ")}`),n=n.replace(/%{2,2}/g,"%"),n}var sY=2;function oY(e){if(!e.stack)return;const t=e.stack.split(`
`);t.splice(1,sY),e.stack=t.join(`
`)}var iY=class extends Error{constructor(e,...t){super(e),this.message=e,this.name="Invariant Violation",this.message=nA(e,...t),oY(this)}},aM=(e,t,...r)=>{if(!e)throw new iY(t,...r)};aM.as=(e,t,r,...n)=>{if(!t){const s=n.length===0?r:nA(r,...n);let o;try{o=Reflect.construct(e,[s])}catch{o=e(s)}throw o}};const lY="[MSW]";function aA(e,...t){const r=nA(e,...t);return`${lY} ${r}`}function cY(e,...t){console.warn(aA(e,...t))}function uY(e,...t){console.error(aA(e,...t))}const dY={formatMessage:aA,warn:cY,error:uY};function pY(){aM(typeof URL<"u",dY.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 sM=(e=>(e.HEAD="HEAD",e.GET="GET",e.POST="POST",e.PUT="PUT",e.PATCH="PATCH",e.OPTIONS="OPTIONS",e.DELETE="DELETE",e))(sM||{});pY();class fY{constructor(t,r,n,s){ar(this,"initialDelay"),ar(this,"maxDelay"),ar(this,"jitterPercent"),ar(this,"callback"),ar(this,"currentDelay"),ar(this,"timeoutId"),ar(this,"executingCallback",!1),this.initialDelay=t,this.currentDelay=t,this.maxDelay=r,this.jitterPercent=n,this.callback=s}tryFlush(){if(this.backingOff()){Jr.debugLog("Backing off, not flushing");return}this.clearTimeout(),this.executeCallbackWithRetries()}stop(){this.clearTimeout()}schedule(t){if(this.timeoutId!==void 0)return;const r=this.addJitter(t||this.currentDelay);this.timeoutId=setTimeout(()=>{this.timeoutId=void 0,this.executeCallbackWithRetries()},r)}backoff(){const t=this.currentDelay,r=Math.min(this.currentDelay*2,this.maxDelay);Jr.debugLog(`Backing next off to ${t}ms delay`),this.clearTimeout(),this.currentDelay=r,this.schedule(t)}reset(){this.currentDelay!==this.initialDelay&&(this.clearTimeout(),this.currentDelay=this.initialDelay)}async executeCallbackWithRetries(){if(this.executingCallback){Jr.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(t){const r=t*this.jitterPercent,n=t-r,s=t+r;return Math.floor(Math.random()*(s-n+1)+n)}}function oM(e){const t={};for(const r in e)if(Object.prototype.hasOwnProperty.call(e,r)){const n=r.replace(/([A-Z])/g,"_$1").toLowerCase(),s=e[r];s&&typeof s=="object"&&!Array.isArray(s)?t[n]=oM(s):t[n]=s}return t}class mY{constructor(t){ar(this,"EVENT_TYPE","web_billing"),ar(this,"id"),ar(this,"timestampMs"),ar(this,"data"),this.id=nM(),this.timestampMs=Date.now(),this.data=t}toJSON(){return oM({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 hY(e,t){const r=new URLSearchParams(window.location.search);return{libraryName:"purchases-js",libraryVersion:WN,locale:navigator.language,userAgent:navigator.userAgent,timeZone:Intl.DateTimeFormat().resolvedOptions().timeZone,screenWidth:screen.width,screenHeight:screen.height,utmSource:r.get("utm_source")??null,utmMedium:r.get("utm_medium")??null,utmCampaign:r.get("utm_campaign")??null,utmContent:r.get("utm_content")??null,utmTerm:r.get("utm_term")??null,pageReferrer:document.referrer,pageUrl:`${window.location.origin}${window.location.pathname}`,pageTitle:document.title,source:e,rcSource:t}}const gY=2e3,yY=5*6e4,bY=.1;class vY{constructor(t){ar(this,"apiKey"),ar(this,"eventsQueue",[]),ar(this,"eventsUrl"),ar(this,"flushManager"),ar(this,"traceId",nM()),ar(this,"appUserId"),ar(this,"isSilent"),ar(this,"rcSource"),this.apiKey=t.apiKey,this.eventsUrl=`${vX}/v1/events`,this.appUserId=t.appUserId,this.isSilent=t.silent||!1,this.rcSource=t.rcSource,this.flushManager=new fY(gY,yY,bY,this.flushEvents.bind(this))}async updateUser(t){this.appUserId=t}getTraceId(){return this.traceId}trackSDKEvent(t){this.trackEvent({...t,source:"sdk"})}trackExternalEvent(t){this.trackEvent({...t})}trackEvent(t){if(this.isSilent){Jr.verboseLog("Skipping event tracking, the EventsTracker is silent");return}try{const r=new mY({eventName:t.eventName,traceId:this.traceId,appUserId:this.appUserId,context:hY(t.source,this.rcSource),properties:t.properties||{}});this.eventsQueue.push(r),this.flushManager.tryFlush()}catch{Jr.errorLog(`Error while tracking event ${t.eventName}`)}}dispose(){this.flushManager.stop()}flushEvents(){if(this.eventsQueue.length===0)return Promise.resolve();const t=[...this.eventsQueue];return fetch(this.eventsUrl,{method:sM.POST,headers:eM(this.apiKey),body:JSON.stringify({events:t})}).then(r=>{if(r.status===200||r.status===201){this.eventsQueue.splice(0,t.length);return}else throw Jr.debugLog("Events failed to flush due to server error"),new Error("Events failed to flush due to server error")}).catch(r=>{throw Jr.debugLog("Error while flushing events"),r})}}const _Y=()=>{const e=new URLSearchParams(window.location.search),t=["utm_source","utm_medium","utm_campaign","utm_term","utm_content"],r={};return t.forEach(n=>{const s=e.get(n);s!==null&&(r[n]=s)}),r},wY=["app","embedded"],wv={autoCollectUTMAsMetadata:!0,collectAnalyticsEvents:!0};function z0(){if(crypto&&crypto.randomUUID)return crypto.randomUUID();const e=new Uint8Array(16);if(crypto&&crypto.getRandomValues)crypto.getRandomValues(e);else for(let r=0;r<16;r++)e[r]=Math.floor(Math.random()*256);e[6]=e[6]&15|64,e[8]=e[8]&63|128;const t=Array.from(e).map(r=>r.toString(16).padStart(2,"0"));return[t.slice(0,4).join(""),t.slice(4,6).join(""),t.slice(6,8).join(""),t.slice(8,10).join(""),t.slice(10,16).join("")].join("-")}var xY=Gt('<p class="svelte-11vxb6p"><strong>Free Trial:</strong> </p>'),AY=Gt('<p class="svelte-11vxb6p"><strong>Intro Price:</strong> </p>'),kY=Gt('<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 SY={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 EY(e,t){Lr(t,!1),Tr(e,SY);let r=_r(t,"productIdentifier",8),n=_r(t,"productType",8),s=_r(t,"basePrice",8),o=_r(t,"freeTrialPeriod",8,void 0),i=_r(t,"introPriceFormatted",8,void 0),c=_r(t,"onValidPurchase",8),u=_r(t,"onFailedPurchase",8),p=_r(t,"onCancel",8);function d(I){I.target===I.currentTarget&&p()()}xo();var f=kY(),m=At(f),h=At(m),b=sr(At(h),2),g=At(b),y=At(g),x=sr(At(y)),v=sr(y,2),A=sr(At(v)),_=sr(v,2),w=sr(At(_)),j=sr(_,2);{var T=I=>{var L=xY(),N=sr(At(L));rr(()=>cn(N,` ${o()??""}`)),Ze(I,L)};gr(j,I=>{o()&&I(T)})}var R=sr(j,2);{var P=I=>{var L=AY(),N=sr(At(L));rr(()=>cn(N,` ${i()??""}`)),Ze(I,L)};gr(R,I=>{i()&&I(P)})}var k=sr(b,2),E=At(k),M=sr(E,2),C=sr(M,2);rr(()=>{cn(x,` ${r()??""}`),cn(A,` ${n()??""}`),cn(w,` ${s()??""}`)}),vi("click",E,function(...I){var L;(L=c())==null||L.apply(this,I)}),vi("click",M,function(...I){var L;(L=u())==null||L.apply(this,I)}),vi("click",C,function(...I){var L;(L=p())==null||L.apply(this,I)}),vi("click",f,d),Ze(e,f),Dr()}async function iM(e,t,r){const n=new Date,s=`test_${n.getTime()}_${z0()}`,o=`test_store_operation_session_${z0()}`,i={storeTransactionId:s,productIdentifier:e.identifier,purchaseDate:n},c=await t.postReceipt(r,e.identifier,s,e.presentedOfferingContext,"purchase");return{customerInfo:VN(c),redemptionInfo:null,operationSessionId:o,storeTransaction:i}}function PY(e,t,r){const n=e.rcPackage.webBillingProduct,s=n.productType,o=n.freeTrialPhase,i=n.introPricePhase,c=n.price,u=p=>p?`${p.number} ${p.unit}${p.number>1?"s":""}`:"N/A";return new Promise((p,d)=>{var f;const m=document.createElement("div");document.body.appendChild(m);const h=()=>{b&&Ag(b),document.body.removeChild(m)};let b=null;b=E0(EY,{target:m,props:{productIdentifier:n.identifier,productType:s,basePrice:c.formattedPrice,freeTrialPeriod:o?u(o.period):void 0,introPriceFormatted:(f=i==null?void 0:i.price)==null?void 0:f.formattedPrice,onValidPurchase:async()=>{h();try{p(await iM(n,t,r))}catch(g){d(g)}},onFailedPurchase:()=>{h(),d(new ra(Ra.ProductNotAvailableForPurchaseError,"Simulated test purchase failure: no real transaction occurred"))},onCancel:()=>{h(),d(new ra(Ra.UserCancelledError))}}})})}class CY{constructor(){ar(this,"virtualCurrenciesCache",new Map),ar(this,"CACHE_EXPIRY_MS",5*60*1e3)}invalidateAllCaches(){this.virtualCurrenciesCache.clear()}cacheVirtualCurrencies(t,r){this.virtualCurrenciesCache.set(t,{data:r,lastUpdatedAt:Date.now()})}getCachedVirtualCurrencies(t,r=!1){const n=this.virtualCurrenciesCache.get(t);return this.getCachedData(n??null,r)}invalidateVirtualCurrenciesCache(t){this.virtualCurrenciesCache.delete(t)}getCachedData(t,r=!1){return t?r?t.data:Date.now()-t.lastUpdatedAt>=this.CACHE_EXPIRY_MS?null:t.data:null}}function RY(e){return{balance:e.balance,name:e.name,code:e.code,serverDescription:e.description??null}}function TY(e){const t={};for(const[r,n]of Object.entries(e.virtual_currencies))t[r]=RY(n);return{all:t}}const gE="$RCAnonymousID:";var lM,Eg;lM=[VX];const cf=class Rs{constructor(t,r,n=O0,s=wv){tU(Eg,5,this),ar(this,"_API_KEY"),ar(this,"_appUserId"),ar(this,"_brandingInfo",null),ar(this,"_loadingResourcesPromise",null),ar(this,"_flags"),ar(this,"backend"),ar(this,"purchaseOperationHelper"),ar(this,"eventsTracker"),ar(this,"inMemoryCache"),this._API_KEY=t,this._appUserId=r,this._flags={...wv,...s},my(t)?Jr.debugLog("Initializing Purchases SDK with Web billing sandbox API Key"):lf(t)&&Jr.debugLog("Initializing Purchases SDK with RC Test store API Key."),this.eventsTracker=new vY({apiKey:this._API_KEY,appUserId:this._appUserId,silent:!this._flags.collectAnalyticsEvents,rcSource:this._flags.rcSource??null}),this.backend=new BX(this._API_KEY,n),this.inMemoryCache=new CY,this.purchaseOperationHelper=new Nq(this.backend,this.eventsTracker),this.eventsTracker.trackSDKEvent({eventName:Os.SDKInitialized})}static setLogLevel(t){Jr.setLogLevel(t)}static setPlatformInfo(t){Rs._platformInfo=t}static getPlatformInfo(){return Rs._platformInfo}static getSharedInstance(){if(Rs.isConfigured())return Rs.instance;throw new jq}static isConfigured(){return Rs.instance!==void 0}static configure(t,r,n,s){Rs.instance!==void 0&&Jr.warnLog("Purchases is already initialized. You normally should only configure Purchases once. Creating and returning new instance.");let o;if(typeof t=="object"&&t!==null)o=t;else{if(typeof t!="string")throw new ra(Ra.ConfigurationError,"API key must be provided as a string");if(typeof r!="string")throw new ra(Ra.ConfigurationError,"App user ID must be provided as a string");o={apiKey:t,appUserId:r,httpConfig:n,flags:s}}return Rs.configureInternal(o),Rs.getSharedInstance()}static configureInternal(t){const{apiKey:r,appUserId:n,httpConfig:s,flags:o}=t,i=s??O0,c=o??wv;Rs.validateConfig(t),Rs.instance=new Rs(r,n,i,c)}static validateConfig(t){var r,n;FX(t.apiKey,t.flags),pE(t.appUserId),UX((r=t.httpConfig)==null?void 0:r.proxyURL),qX((n=t.httpConfig)==null?void 0:n.additionalHeaders)}async preload(){if(this.hasLoadedResources()){Jr.verboseLog("Purchases resources are loaded. Skipping.");return}if(this._loadingResourcesPromise!==null){Jr.verboseLog("Purchases resources are loading. Waiting."),await this._loadingResourcesPromise;return}return this._loadingResourcesPromise=this.fetchAndCacheBrandingInfo().catch(t=>{let r=`${t}`;t instanceof ra&&(r=`${t.message}. ${t.underlyingErrorMessage?`Underlying error: ${t.underlyingErrorMessage}`:""}`),Jr.errorLog(`Error fetching branding info: ${r}`)}).finally(()=>{this._loadingResourcesPromise=null}),this._loadingResourcesPromise}async fetchAndCacheBrandingInfo(){if(lf(this._API_KEY)){Jr.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(t){console.warn("This method is @experimental, Paywalls are not generally available but they will come soon!");let r=t.htmlTarget??document.getElementById("rcb-ui-pw-root");if(r===null){const m=document.createElement("div");m.id="rcb-ui-pw-root",m.className="rcb-ui-pw-root",m.style.zIndex=`${GX}`,document.body.appendChild(m),r=m}if(r===null)throw new Error("Could not generate a mount point for the billing widget");const n=r;n.innerHTML="";const s=t.offering;if(!s.paywall_components)throw new Error("You cannot use paywalls yet, they are coming soon!");const o=t.selectedLocale||navigator.language,i=new gb({},o,s.paywall_components.default_locale),c=m=>{var h;const b=s.availablePackages.find(g=>g.identifier===m);if(b===void 0)throw new Error(`No package found for ${m}`);return this.purchase({rcPackage:b,htmlTarget:t.purchaseHtmlTarget,customerEmail:t.customerEmail,selectedLocale:o,defaultLocale:((h=s.paywall_components)==null?void 0:h.default_locale)||jd})},u=m=>{var h;if(t.onNavigateToUrl){t.onNavigateToUrl(m);return}(h=window.open(m,"_blank"))==null||h.focus()},p=()=>{},d=()=>{if(t.onVisitCustomerCenter){t.onVisitCustomerCenter();return}},f=QX(s,i);return new Promise((m,h)=>{E0(a9,{target:n,props:{paywallData:s.paywall_components,selectedLocale:o,onNavigateToUrlClicked:u,onVisitCustomerCenterClicked:d,onBackClicked:()=>{if(t.onBack){t.onBack();return}n.innerHTML="",Jr.debugLog("Purchase cancelled by user"),h(new ra(Ra.UserCancelledError))},onRestorePurchasesClicked:p,onPurchaseClicked:b=>{c(b).then(g=>{m(g)}).catch(g=>h(g))},onError:b=>h(b),variablesPerPackage:f}})})}async getOfferings(t){lX(t==null?void 0:t.currency);const r=this._appUserId,n=await this.backend.getOfferings(r),s=(t==null?void 0:t.offeringIdentifier)===tM.Current?n.current_offering_id:t==null?void 0:t.offeringIdentifier;return s&&(n.offerings=n.offerings.filter(o=>o.identifier===s)),await this.getAllOfferings(n,r,t)}async getCurrentOfferingForPlacement(t,r){const n=this._appUserId,s=await this.backend.getOfferings(n),o=await this.getAllOfferings(s,n,r),i=s.placements??null;return i==null?null:HX(i,o.all,t)}async getAllOfferings(t,r,n){const s=t.offerings.flatMap(i=>i.packages).map(i=>i.platform_product_identifier),o=await this.backend.getProducts(r,s,n==null?void 0:n.currency);return this.logMissingProductIds(s,o.product_details),WX(t,o)}async isEntitledTo(t){const r=await this.getCustomerInfo();return t in r.entitlements.active}purchasePackage(t,r,n){return this.purchase({rcPackage:t,customerEmail:r,htmlTarget:n})}async purchase(t){var r;const{rcPackage:n,purchaseOption:s,htmlTarget:o,customerEmail:i,selectedLocale:c=jd,defaultLocale:u=jd,skipSuccessPage:p=!1}=t;if(lf(this._API_KEY)){const _=await PY(t,this.backend,this._appUserId);return this.inMemoryCache.invalidateAllCaches(),_}let d=o??document.getElementById("rcb-ui-root");if(d===null){const _=document.createElement("div");_.className="rcb-ui-root",document.body.appendChild(_),d=_}if(d===null)throw new Error("Could not generate a mount point for the billing widget");const f=d,m=this._appUserId;Jr.debugLog(`Presenting purchase form for package ${n.identifier}`);const h=c||u,b=s??n.webBillingProduct.defaultPurchaseOption,g=UV({appearance:(r=this._brandingInfo)==null?void 0:r.appearance,rcPackage:n,purchaseOptionToUse:b,customerEmail:i});this.eventsTracker.trackSDKEvent(g);const y={...this._flags.autoCollectUTMAsMetadata?_Y():{},...t.metadata||{}};let x=null;const v=this._brandingInfo;v&&t.brandingAppearanceOverride&&(v.appearance=t.brandingAppearanceOverride);const A=o!==void 0;return new Promise((_,w)=>{A||window.history.pushState({checkoutOpen:!0},"");const j=this._flags.rcSource&&wY.includes(this._flags.rcSource)?void 0:()=>{const T=VV();this.eventsTracker.trackSDKEvent(T),window.removeEventListener("popstate",j),x&&Ag(x),f.innerHTML="",Jr.debugLog("Purchase cancelled by user"),w(new ra(Ra.UserCancelledError))};!A&&j&&window.addEventListener("popstate",j),x=E0(cX,{target:f,props:{isInElement:A,appUserId:m,rcPackage:n,purchaseOption:b,customerEmail:i,onFinished:async T=>{const R=qV({redemptionInfo:T.redemptionInfo});this.eventsTracker.trackSDKEvent(R),this.inMemoryCache.invalidateAllCaches(),Jr.debugLog("Purchase finished"),x&&Ag(x),f.innerHTML="";const P={customerInfo:await this._getCustomerInfoForUserId(m),redemptionInfo:T.redemptionInfo,operationSessionId:T.operationSessionId,storeTransaction:{storeTransactionId:T.storeTransactionIdentifier,productIdentifier:n.webBillingProduct.identifier,purchaseDate:T.purchaseDate}};_(P)},onClose:j,onError:T=>{var R;const P=HV({errorCode:(R=T.errorCode)==null?void 0:R.toString(),errorMessage:T.message});this.eventsTracker.trackSDKEvent(P),x&&Ag(x),f.innerHTML="",w(ra.getForPurchasesFlowError(T))},purchases:this,eventsTracker:this.eventsTracker,brandingInfo:this._brandingInfo,purchaseOperationHelper:this.purchaseOperationHelper,selectedLocale:h,metadata:y,defaultLocale:u,customTranslations:t.labelsOverride,skipSuccessPage:p}})})}async _postSimulatedStoreReceipt(t){return await iM(t,this.backend,this._appUserId)}async getCustomerInfo(){return await this._getCustomerInfoForUserId(this._appUserId)}getAppUserId(){return this._appUserId}async setAttributes(t){return await this.getCustomerInfo(),await this.backend.setAttributes(this._appUserId,t)}async changeUser(t){return pE(t),this._appUserId=t,this.eventsTracker.updateUser(t),this.inMemoryCache.invalidateAllCaches(),await this.getCustomerInfo()}logMissingProductIds(t,r){const n={};r.forEach(o=>n[o.identifier]=o);const s=[];t.forEach(o=>{n[o]===void 0&&s.push(o)}),s.length>0&&Jr.debugLog(`Could not find product data for product ids:
        ${s.join()}.
        Please check that your product configuration is correct.`)}isSandbox(){return my(this._API_KEY)||lf(this._API_KEY)}isAnonymous(){return this._appUserId.startsWith(gE)}async getVirtualCurrencies(){return await this._getVirtualCurrenciesForUserId(this._appUserId)}getCachedVirtualCurrencies(){return this.inMemoryCache.getCachedVirtualCurrencies(this._appUserId,!0)}invalidateVirtualCurrenciesCache(){this.inMemoryCache.invalidateVirtualCurrenciesCache(this._appUserId)}close(){Rs.instance===this?(this.eventsTracker&&this.eventsTracker.dispose(),Rs.instance=void 0):Jr.warnLog("Trying to close a Purchases instance that is not the current instance. Ignoring.")}async _getCustomerInfoForUserId(t){const r=await this.backend.getCustomerInfo(t);return VN(r)}async _getVirtualCurrenciesForUserId(t){const r=this.inMemoryCache.getCachedVirtualCurrencies(t);if(r)return Jr.debugLog("Vending VirtualCurrencies from cache."),r;const n=await this.backend.getVirtualCurrencies(t),s=TY(n);return Jr.debugLog("VirtualCurrencies updated from the network."),this.inMemoryCache.cacheVirtualCurrencies(t,s),s}static generateRevenueCatAnonymousAppUserId(){return`${gE}${z0().replace(/-/g,"")}`}_trackEvent(t){this.eventsTracker.trackExternalEvent(t)}};Eg=J8(),rU(Eg,1,"purchase",lM,cf),eU(Eg,cf),ar(cf,"_platformInfo"),ar(cf,"instance");let jc=cf;function jY(e,t){const r=String(t||"");if(e==="web"&&!r.startsWith("web_")&&!r.startsWith("rcb"))throw new Error('RevenueCat Web requires a Web Billing key (starts with "web_"). Set VITE_RC_API_KEY_WEB.');e==="ios"&&!r.startsWith("appl_")&&console.warn('RevenueCat: expected iOS key to start with "appl_".'),e==="android"&&!r.startsWith("goog_")&&console.warn('RevenueCat: expected Android key to start with "goog_".')}function B0(e){const t=e==="web"?AB:e==="ios"?SB:kB;if(!t)throw new Error(`RevenueCat SDK key missing for ${e}. Add VITE_RC_API_KEY_* and restart.`);return jY(e,String(t)),String(t)}function cM(e){const t=(e??"").toString().trim();if(!t||t==="[Not provided]")throw new Error("Invalid appUserID for RevenueCat.");if(t.length>255)throw new Error("appUserID too long for RevenueCat (max 255).");return t}let mi=null,Ic=null,nu=null;function np(e){const t=(e??"").toString();return{length:t.length,empty:t.length===0}}function F0(e){return e?String(e).slice(0,4):null}async function IY(e){return mi||Ic||(Ic=(async()=>{const t=zr.getPlatform();if(console.debug("[RC] configureOnce platform:",t),t==="web"){const n=B0("web");if(typeof(jc==null?void 0:jc.configure)!="function")throw new Error("[RC] Web SDK load failed");try{console.debug("[RC] configure:begin",{platform:t,keyType:"web",keyPrefix:F0(n),appUserId:np(e),observerMode:!1}),await jc.configure({apiKey:n,appUserId:e,observerMode:!1}),console.debug("[RC] configure:success",{platform:t});try{hy()}catch{}}catch(s){throw console.error("[RC] Web configure failed:",s),new Error("Purchases are temporarily paused.")}return mi={platform:"web",Purchases:jc},mi}const r=B0(t==="ios"?"ios":"android");try{const n=await Cr(()=>import("./index-aexKVPj4.js"),__vite__mapDeps([8,2,3,4,1]),import.meta.url),s=n==null?void 0:n.Purchases;if(!s||typeof s.configure!="function")throw new Error("Capacitor Purchases plugin not available. Did you run `npx cap sync ios`?");try{console.debug("[RC] configure:begin",{platform:t,keyType:t==="ios"?"ios":"android",keyPrefix:F0(r),appUserId:np(e),observerMode:!1}),await s.configure({apiKey:r,appUserID:e,observerMode:!1}),console.debug("[RC] native configured on",t),console.debug("[RC] configure:success",{platform:t});try{hy()}catch{}}catch(o){throw console.error("[RC] Native configure failed:",o),new Error("Purchases are temporarily paused.")}return mi={platform:"native",Purchases:s},mi}catch(n){throw console.error("[RC] Failed to load native SDK:",n),n}})().catch(t=>{throw Ic=null,t}),Ic)}async function sA(e){const t=cM(e),r=await IY(t);if(nu!==t){try{const n=r.Purchases;typeof(n==null?void 0:n.logIn)=="function"&&(console.debug("[RC] identify:begin",{platform:zr.getPlatform(),appUserId:np(t)}),r.platform==="native"?await n.logIn({appUserID:t}):await n.logIn(t)),console.debug("[RC] logIn success"),console.debug("[RC] identify:done",{platform:zr.getPlatform()});try{hy()}catch{}}catch(n){console.warn("[RC] logIn failed or unsupported:",n)}nu=t}return r}function hs(){const e=mi;if(!(e!=null&&e.Purchases)){if(zr.getPlatform()==="web")try{const i=jc;if(typeof(i==null?void 0:i.getSharedInstance)=="function"){const c=i.getSharedInstance();if(c)return c}return null}catch{}return null}const t=zr.getPlatform(),r=e.Purchases;function n(o){const i=Object.create(o);return typeof o.getOfferings=="function"&&(i.getOfferings=async()=>{var p,d,f;const c=t;let u=null;try{u=F0(B0(c==="ios"?"ios":c==="android"?"android":"web"))}catch{}console.debug("[RC] getOfferings:start",{platform:c,appTarget:Oa,keyPrefix:u});try{const m=await o.getOfferings(),h=((p=m==null?void 0:m.current)==null?void 0:p.identifier)??(m==null?void 0:m.currentOfferingIdentifier)??null,b=(((d=m==null?void 0:m.current)==null?void 0:d.availablePackages)??(m==null?void 0:m.availablePackages)??[]).length;return console.debug("[RC] getOfferings:success",{platform:c,currentId:h,pkgCount:b}),m}catch(m){let h;try{h=((f=m==null?void 0:m.getErrorCode)==null?void 0:f.call(m))??(m==null?void 0:m.errorCode)??(m==null?void 0:m.code)}catch{}const b={platform:c,appTarget:Oa,offeringId:Xy,chipsPackageId:Yy,chipsProductId:Zy,keyPrefix:u,errorCode:h,message:m==null?void 0:m.message};throw console.error("[RC] getOfferings:error",b,m),m}}),i}if(t==="web"){if(typeof r.getSharedInstance=="function")try{const o=r.getSharedInstance();return n(o)}catch(o){return console.warn("[RC] getSharedInstance failed on web, falling back to module:",o),n(r)}return n(r)}const s=Object.create(r);return typeof r.purchasePackage=="function"&&(s.purchasePackage=o=>r.purchasePackage({aPackage:o})),n(s)}function hy(){const t={platform:zr.getPlatform(),user:np(nu),clientReady:!!mi,hasInitPromise:!!Ic,appTarget:Oa,offeringId:Xy,chipsPackageId:Yy,chipsProductId:Zy};console.debug("[RC] config:state",t);try{vs.getInfo().then(r=>{console.debug("[RC] config:bundle",{appId:r==null?void 0:r.id,appName:r==null?void 0:r.name,version:r==null?void 0:r.version,build:r==null?void 0:r.build})}).catch(()=>{})}catch{}}async function xc(){if(!nu)throw new Error("Cannot reconfigure RevenueCat before user identification.");return mi=null,Ic=null,sA(nu)}async function uM(e){const t=cM(e),r=mi;if(!r){console.warn("[RC] loginRevenueCat called before SDK initialized");return}try{const n=r.Purchases;typeof(n==null?void 0:n.logIn)=="function"?(console.debug("[RC] loginRevenueCat:begin",{newUser:np(t),previousUser:np(nu)}),r.platform==="native"?await n.logIn({appUserID:t}):await n.logIn(t),console.debug("[RC] loginRevenueCat:success"),nu=t):console.warn("[RC] logIn method not available on Purchases SDK")}catch(n){throw console.error("[RC] loginRevenueCat failed:",n),n}}const NY=Object.freeze(Object.defineProperty({__proto__:null,getPurchases:hs,initRevenueCat:sA,logRevenueCatConfig:hy,loginRevenueCat:uM,reconfigureRevenueCat:xc},Symbol.toStringTag,{value:"Module"})),dh="rc_anonymous_device_id";async function MY(){if(zr.isNativePlatform())try{const{SecureStoragePlugin:t}=await Cr(async()=>{const{SecureStoragePlugin:n}=await Promise.resolve().then(()=>i6);return{SecureStoragePlugin:n}},void 0,import.meta.url);try{const{value:n}=await t.get({key:dh});if(n&&n.length>10)return n}catch{}const r=`anon_${crypto.randomUUID()}`;return await t.set({key:dh,value:r}),console.log("[anonymousId] Created new anonymous device ID"),r}catch(t){console.warn("[anonymousId] SecureStorage failed, falling back to localStorage",t)}try{const t=localStorage.getItem(dh);if(t&&t.length>10)return t;const r=`anon_${crypto.randomUUID()}`;return localStorage.setItem(dh,r),console.log("[anonymousId] Created new anonymous device ID (localStorage)"),r}catch{return console.warn("[anonymousId] All storage failed, using ephemeral ID"),`anon_ephemeral_${crypto.randomUUID()}`}}function yE(e){return e.startsWith("anon_")}const Hu={BASE_URL:"./",DEV:!1,MODE:"production",PROD:!0,SSR:!1,VITE_APP_TARGET:"ceelo",VITE_OTA:"1",VITE_OTA_MANIFEST_URL:"https://cdn.dicelounge.app/ota/manifest.json"},bE=Xy,LY=Yy,vE=Zy,_E=dx,dM=String(EB).toLowerCase()==="true",Pg={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 xv(e,t){var r,n,s;try{const o=((r=t==null?void 0:t.getErrorCode)==null?void 0:r.call(t))??(t==null?void 0:t.errorCode)??(t==null?void 0:t.code),i=typeof o=="number"?Pg[o]||`Code${o}`:"Unknown",c=((n=t==null?void 0:t.extra)==null?void 0:n.backendErrorCode)??((s=t==null?void 0:t.extra)==null?void 0:s.code)??(t==null?void 0:t.backendErrorCode),u=(t==null?void 0:t.underlyingErrorMessage)||(t==null?void 0:t.nativeStack)||(t==null?void 0:t.stack),p=(t==null?void 0:t.message)||String(t);if(console.error(`${e} failed`,{code:o,name:i,backendErrorCode:c,message:p,underlying:u}),dM){const d=t!=null&&t.extra?{...t.extra}:void 0;console.debug("[RC] raw error (trimmed):",{keys:Object.keys(t||{}),extra:d,err:t})}}catch(o){console.error(`${e} failed (and logging failed)`,o)}}const pM=l.createContext({rc:null,ready:!1,error:null,isPremium:!1,anonymousBalance:null,buyChips:async()=>{},buySubscription:async()=>{},restorePurchases:async()=>{}});function DY({children:e}){const{user:t,refreshUser:r}=Zr(),[n,s]=l.useState(null),[o,i]=l.useState(!1),[c,u]=l.useState(null),[p,d]=l.useState(!1),[f,m]=l.useState(null),h=l.useRef(null),b=l.useCallback(()=>{try{r()}catch{}try{setTimeout(()=>{r().catch(()=>{})},1200)}catch{}},[r]);l.useEffect(()=>{let E=!1;return(async()=>{i(!1),u(null);try{const M=(t==null?void 0:t.id)??await MY(),C=h.current;if(t!=null&&t.id&&C&&yE(C)&&C!==t.id){console.log("[RevenueCat] User logged in, transferring purchases from anonymous ID");try{await uM(t.id),h.current=t.id;try{const F=(Hu==null?void 0:Hu.VITE_API_URL)||"",{getToken:D}=await Cr(async()=>{const{getToken:$}=await Promise.resolve().then(()=>l6);return{getToken:$}},void 0,import.meta.url),H=await D(),G=await(await fetch(`${F}/api/account/merge-anonymous`,{method:"POST",headers:{"Content-Type":"application/json",...H?{Authorization:`Bearer ${H}`}:{}},credentials:"include",body:JSON.stringify({anonymousId:C})})).json().catch(()=>({}));G!=null&&G.ok&&(G==null?void 0:G.mergedBalance)>0&&console.log(`[RevenueCat] Merged ${G.mergedBalance} chips from anonymous account`)}catch(F){console.warn("[RevenueCat] Failed to merge anonymous balance:",F)}b()}catch(F){console.warn("[RevenueCat] Failed to transfer anonymous purchases:",F)}}const I=await sA(M);h.current=M;let L=!1;const N=1e3,S=Date.now();for(;!E;){const D=hs()||(I==null?void 0:I.Purchases);if(D&&(typeof D.purchasePackage=="function"||typeof D.getOfferings=="function")){L=!0;break}if(Date.now()-S>N)break;await new Promise(H=>setTimeout(H,50))}!L&&(I==null?void 0:I.platform)==="web"&&(L=!0),E||(s(I),i(L))}catch(M){E||(u((M==null?void 0:M.message)||"Purchases are temporarily paused. Please try again later."),i(!1))}})(),()=>{E=!0}},[t==null?void 0:t.id,b]);const g=l.useCallback(async()=>{var E;try{const M=hs();if(!(M!=null&&M.getCustomerInfo))return;const C=await M.getCustomerInfo(),I=((E=C==null?void 0:C.entitlements)==null?void 0:E.active)||{},L=Object.keys(I).length>0;let N=!1;_E&&(N=!!(I!=null&&I[_E])||L),d(N)}catch{}},[]);l.useEffect(()=>{if(!o)return;g();const E=setInterval(g,6e4);return()=>clearInterval(E)},[o,g]);const y=l.useCallback(async()=>{if(t!=null&&t.id){m(null);return}const E=h.current;if(!E||!yE(E)){m(null);return}try{const M=(Hu==null?void 0:Hu.VITE_API_URL)||"",I=await(await fetch(`${M}/api/account/anonymous-balance?id=${encodeURIComponent(E)}`)).json().catch(()=>({}));I!=null&&I.ok&&typeof I.balance=="number"&&m(I.balance)}catch{}},[t==null?void 0:t.id]);l.useEffect(()=>{o&&y()},[o,y]);const x=l.useCallback(E=>{var M,C;return(M=E==null?void 0:E.all)!=null&&M[bE]?E.all[bE]:(E==null?void 0:E.current)||((C=E==null?void 0:E.all)==null?void 0:C.default)||null},[]),v=l.useCallback(E=>{var L,N;const M=[],C=S=>{var F;if(Array.isArray(S))for(const D of S){const H=(D==null?void 0:D.identifier)||((F=D==null?void 0:D.product)==null?void 0:F.identifier);H&&(M.find(W=>{var G;return((W==null?void 0:W.identifier)||((G=W==null?void 0:W.product)==null?void 0:G.identifier))===H})||M.push(D))}};C(((L=E==null?void 0:E.current)==null?void 0:L.availablePackages)||((N=E==null?void 0:E.current)==null?void 0:N.packages));const I=(E==null?void 0:E.all)||{};return Object.keys(I).forEach(S=>{var F,D;C(((F=I[S])==null?void 0:F.availablePackages)||((D=I[S])==null?void 0:D.packages))}),M},[]),A=E=>{var N,S,F,D,H,W,G;const M=E==null?void 0:E.packageType,C=String(((N=E==null?void 0:E.product)==null?void 0:N.type)||"").toUpperCase(),I=String(((S=E==null?void 0:E.product)==null?void 0:S.identifier)||(E==null?void 0:E.identifier)||""),L=String(((F=E==null?void 0:E.product)==null?void 0:F.title)||((D=E==null?void 0:E.product)==null?void 0:D.displayName)||"");return M==="MONTHLY"||M==="ANNUAL"||M==="SIX_MONTH"||M==="THREE_MONTH"||M==="TWO_MONTH"||C==="SUBSCRIPTION"||C==="SUBS"||C==="AUTO_RENEWABLE_SUBSCRIPTION"||!!((H=E==null?void 0:E.product)!=null&&H.subscriptionPeriod)||!!((W=E==null?void 0:E.product)!=null&&W.defaultSubscriptionOption)||!!((G=E==null?void 0:E.product)!=null&&G.subscriptionOptions)||/(month|year|annual|week|sub|subscription|premium|vip|membership|pro)/i.test(I)||/(month|year|annual|week|subscription|premium|vip|membership|pro)/i.test(L)},_=E=>{var I;const M=(I=E==null?void 0:E.product)==null?void 0:I.type,C=E==null?void 0:E.packageType;return!A(E)||M==="NON_SUBSCRIPTION"||M==="NON_CONSUMABLE"||C==="LIFETIME"},w=l.useCallback(E=>{const M=x(E),C=v(E);dM&&(console.debug("[RC] offerings(off):",M),console.debug("[RC] packages:",C)),/\s/.test(String(vE))&&console.warn("[RC] VITE_RC_CHIPS_PRODUCT_ID contains whitespace; verify product identifier in constants.ts matches App Store/Play Console (no spaces).");{const N=C.find(S=>(S==null?void 0:S.identifier)===LY);if(N)return N}{const N=C.find(S=>{var F;return((F=S==null?void 0:S.product)==null?void 0:F.identifier)===vE});if(N)return N}const I=C.find(N=>_(N));if(I)return I;const L=(M==null?void 0:M.availablePackages)||(M==null?void 0:M.packages)||[];return Array.isArray(L)&&L.length>0?L[0]:C[0]||null},[v,x]),j=l.useCallback(E=>{const M=x(E),C=v(E),I=H=>{var $,K,de;const W=String((H==null?void 0:H.identifier)||(($=H==null?void 0:H.product)==null?void 0:$.identifier)||""),G=String(((K=H==null?void 0:H.product)==null?void 0:K.title)||((de=H==null?void 0:H.product)==null?void 0:de.displayName)||"");return`${W} ${G}`},L=C.find(H=>(H==null?void 0:H.packageType)==="MONTHLY")||C.find(H=>((H==null?void 0:H.identifier)||"").toLowerCase().includes("month"));if(L)return L;const N=C.find(H=>(H==null?void 0:H.packageType)==="ANNUAL")||C.find(H=>((H==null?void 0:H.identifier)||"").toLowerCase().includes("year"));if(N)return N;const S=C.find(H=>A(H));if(S)return S;const F=C.find(H=>/(month|year|annual|week|subscription|premium|vip|membership|pro)/i.test(I(H)));if(F)return F;const D=(M==null?void 0:M.availablePackages)||(M==null?void 0:M.packages)||[];return Array.isArray(D)&&D.length>0?D[0]:C[0]||null},[v,x]),T=l.useCallback(async()=>{var I,L;if(!o)throw new Error("RevenueCat not ready");let E=hs();if(!(E!=null&&E.getOfferings)||!(E!=null&&E.purchasePackage))try{await xc(),E=hs()}catch{}if(!(E!=null&&E.getOfferings)||!(E!=null&&E.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 M=await E.getOfferings(),C=w(M);if(!C){const N=v(M);throw console.error("[RC] No chips package found. offerings.current:",M==null?void 0:M.current,"offerings.all keys:",Object.keys((M==null?void 0:M.all)||{}),"packages found:",N.map(S=>{var F,D;return{identifier:S==null?void 0:S.identifier,productId:(F=S==null?void 0:S.product)==null?void 0:F.identifier,type:(D=S==null?void 0:S.product)==null?void 0:D.type,packageType:S==null?void 0:S.packageType}})),new Error("No chips product configured")}try{try{await E.purchasePackage(C),b(),y()}catch(N){const S=String((N==null?void 0:N.message)||N);if(/already been destroyed/i.test(S))try{await xc();const F=hs();if(!(F!=null&&F.purchasePackage))throw N;await F.purchasePackage(C),b(),y();return}catch{}throw N}}catch(N){xv("[RC] purchasePackage(chips)",N);const S=((I=N==null?void 0:N.getErrorCode)==null?void 0:I.call(N))??(N==null?void 0:N.errorCode)??(N==null?void 0:N.code),F=typeof S=="number"?Pg[S]||`Code${S}`:"Unknown",D=((L=N==null?void 0:N.extra)==null?void 0:L.backendErrorCode)??(N==null?void 0:N.backendErrorCode),H=D===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 (${F}${typeof S=="number"?` ${S}`:""}${D?` | backend ${D}`:""}).${H}`)}},[o,w,v,b,y]),R=l.useCallback(async()=>{var I,L;if(!o)throw new Error("RevenueCat not ready");let E=hs();if(!(E!=null&&E.getOfferings)||!(E!=null&&E.purchasePackage))try{await xc(),E=hs()}catch{}if(!(E!=null&&E.getOfferings)||!(E!=null&&E.purchasePackage))throw new Error("Purchases not initialized");let M=await E.getOfferings(),C=j(M);if(!C)try{await new Promise(N=>setTimeout(N,350)),M=await E.getOfferings(),C=j(M)}catch{}if(!C)try{await xc();const N=hs();N!=null&&N.getOfferings&&(E=N,M=await N.getOfferings(),C=j(M))}catch{}if(!C)throw console.error("[RC] No subscription package found. Offerings:",M),new Error("No subscription package available");try{try{await E.purchasePackage(C),b(),g()}catch(N){const S=String((N==null?void 0:N.message)||N);if(/already been destroyed/i.test(S))try{await xc();const F=hs();if(!(F!=null&&F.purchasePackage))throw N;await F.purchasePackage(C),b(),g();return}catch{}throw N}}catch(N){xv("[RC] purchasePackage(subscription)",N);const S=((I=N==null?void 0:N.getErrorCode)==null?void 0:I.call(N))??(N==null?void 0:N.errorCode)??(N==null?void 0:N.code),F=typeof S=="number"?Pg[S]||`Code${S}`:"Unknown",D=((L=N==null?void 0:N.extra)==null?void 0:L.backendErrorCode)??(N==null?void 0:N.backendErrorCode),H=D===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 (${F}${typeof S=="number"?` ${S}`:""}${D?` | backend ${D}`:""}).${H}`)}},[o,j,b,g]),P=l.useCallback(async()=>{var M,C,I;if(!o)throw new Error("RevenueCat not ready");let E=hs();if(!(E!=null&&E.getCustomerInfo)||!(E!=null&&E.syncPurchases))try{await xc(),E=hs()}catch{}try{const L=await((M=E==null?void 0:E.getCustomerInfo)==null?void 0:M.call(E));if(!(E!=null&&E.syncPurchases))throw new Error("Restore Purchases not initialized");await(E==null?void 0:E.syncPurchases()),b(),g(),y()}catch(L){xv("[RC] restorePurchases",L);const N=((C=L==null?void 0:L.getErrorCode)==null?void 0:C.call(L))??(L==null?void 0:L.errorCode)??(L==null?void 0:L.code),S=typeof N=="number"?Pg[N]||`Code${N}`:"Unknown",F=((I=L==null?void 0:L.extra)==null?void 0:I.backendErrorCode)??(L==null?void 0:L.backendErrorCode);throw new Error(`Restore failed (${S}${typeof N=="number"?` ${N}`:""}${F?` | backend ${F}`:""}).`)}},[o,b,g,y]),k=l.useMemo(()=>({rc:n,ready:o,error:c,isPremium:p,anonymousBalance:f,buyChips:T,buySubscription:R,restorePurchases:P}),[n,o,c,p,f,T,R,P]);return a.jsx(pM.Provider,{value:k,children:e})}function fM(){return l.useContext(pM)}function OY({viral:e,onClose:t}){return e?a.jsx("div",{className:"viral-container",children:a.jsxs("div",{className:"viral-content",children:[a.jsx("img",{src:e.preview,alt:"Preview",className:"viral-preview",style:{width:e.width,height:e.height}}),a.jsx("video",{src:e.url,autoPlay:!0,loop:!0,muted:!0,className:"viral-video",style:{width:e.width,height:e.height}})]})}):null}const oA=""+new URL("avatars-BLAbFok_.webp",import.meta.url).href,iA=""+new URL("avatars2-BhCQ9Hmk.webp",import.meta.url).href,lA=""+new URL("bikini_avatars-D9_A_byG.webp",import.meta.url).href,cA=""+new URL("bikini_avatars2-CqEDCn9Y.webp",import.meta.url).href,uA=""+new URL("car_avatars-C2asmsaV.webp",import.meta.url).href,dA=""+new URL("cowboy_avatars-Dh4o-H8O.webp",import.meta.url).href,pA=""+new URL("surf_avatars-BNzNQWcq.webp",import.meta.url).href,fA=""+new URL("surf_avatars2-CP3KwVoE.webp",import.meta.url).href,mA=""+new URL("toy_avatars-CYoTJdP7.webp",import.meta.url).href,mM="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",hM="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",gM="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",yM="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",bM="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",vM="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",zY=0,BY=2500,ha={diceRevealDelayMs:zY,diceSettleClientMs:BY,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},gy=[oA,iA,lA,cA,uA,dA,pA,fA,mA];function FY(e){if(!e||!e.startsWith("sprite:"))return null;const t=e.slice(7).split("/"),r=Number(t[0]),n=Number(t[1]);return!Number.isFinite(r)||!Number.isFinite(n)||r<0||r>=gy.length?null:{sheetIdx:r,tile:n%6}}function UY(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return t%(gy.length*6)}function qY(e,t){const r=FY(e);if(r){const{sheetIdx:x,tile:v}=r,A=gy[x],_=2,w=3,j=v%_,T=Math.floor(v/_),R=_*100,P=x===4?400:w*100,k=R/100,E=P/100,M=j/(k-1)*100,C=x===8?T*37:E>1?T/(E-1)*100:0;return a.jsx("span",{className:"flash-avatar__sprite",style:{backgroundImage:`url(${A})`,backgroundSize:`${R}% ${P}%`,backgroundPosition:`${M}% ${C}%`},"aria-hidden":!0})}if(e)return a.jsx("img",{src:e,alt:t,className:"flash-avatar__img"});const n=UY(t),s=Math.floor(n/6),o=n%6,i=gy[s],c=2,u=3,p=o%c,d=Math.floor(o/c),f=c*100,m=s===4?400:u*100,h=f/100,b=m/100,g=p/(h-1)*100,y=s===8?d*37:b>1?d/(b-1)*100:0;return a.jsx("span",{className:"flash-avatar__sprite",style:{backgroundImage:`url(${i})`,backgroundSize:`${f}% ${m}%`,backgroundPosition:`${g}% ${y}%`},"aria-hidden":!0})}const VY={1:mM,2:hM,3:gM,4:yM,5:bM,6:vM};function _M(e){const t=/[⚀⚁⚂⚃⚄⚅]+/,r=e.match(t);if(!r)return e;const n=r[0],s=e.slice(r.index+n.length).trim(),o=[...n].map(i=>i.codePointAt(0)-9855);return a.jsxs("span",{className:"flash-dice-result",children:[a.jsx("span",{className:"flash-dice-faces",children:o.map((i,c)=>a.jsx("img",{src:VY[i],alt:`Dice ${i}`,className:"flash-die-face"},c))}),s&&a.jsx("span",{className:"flash-dice-label",children:s})]})}let ph=null;async function wM(){if(ph)return ph;const e=await Cr(()=>import("./lottie-D9lozOg2.js").then(t=>t.l),__vite__mapDeps([9,4]),import.meta.url);return ph=e!=null&&e.default&&e.default.loadAnimation?e.default:e,ph}let fh=null,mh=null;async function U0(e){if(e==="win"&&fh)return fh;if(e==="lose"&&mh)return mh;if(e==="win"){const t=await Cr(()=>import("./winning-lottie-CvaS4ZrO.js"),[],import.meta.url);return fh=t.default||t,fh}else{const t=await Cr(()=>import("./lose-lottie-C7Ut5v-G.js"),[],import.meta.url);return mh=t.default||t,mh}}const hA=l.createContext(null),HY={win:void 0,lose:void 0,push:void 0,roll:void 0,info:void 0},WY=typeof window<"u"&&window.requestIdleCallback||(e=>setTimeout(e,50));function GY(){if(typeof navigator>"u")return!1;const e=navigator.userAgent||"",t=navigator;return/iP(ad|hone|od)/.test(e)||t.platform==="MacIntel"&&t.maxTouchPoints>1}function wE(){WY(async()=>{try{await wM(),await Promise.allSettled([U0("win"),U0("lose")])}catch{}})}function xE(){var e,t,r;try{const n=document==null?void 0:document.body,s=!!((e=n==null?void 0:n.classList)!=null&&e.contains("page-poker-room")),o=!!document.querySelector(".mode-craps"),i=!!((t=n==null?void 0:n.classList)!=null&&t.contains("page-gameroom")&&!o),c=!!((r=n==null?void 0:n.classList)!=null&&r.contains("page-zentara"));return{isPoker:s,isCraps:o,isCeeLo:i,isZentara:c}}catch{return{isPoker:!1,isCraps:!1,isCeeLo:!1,isZentara:!1}}}function XY(e,t,r,n){return typeof t=="boolean"?t:n?!1:e==="lose"&&typeof r!="number"}function YY(e,t){if(!e)return!1;const r=e.kind==="roll"&&typeof e.title=="string"&&/\bpoint\b/i.test(e.title||"");return e.kind==="roll"&&typeof e.title=="string"&&/\bbanker\b/i.test(e.title||"")&&/\bpoint\b/i.test(e.title||""),t.isPoker||t.isCraps&&(e.kind==="win"||e.kind==="lose"||r)||t.isCeeLo&&(e.kind==="win"||e.kind==="lose"||e.kind==="push")}function ZY(){try{return document.querySelector(".card.player-panel, .card.craps-player-panel, .card.skills-player-panel")}catch{return null}}function Av(e){return typeof e!="string"?e:/[⚀⚁⚂⚃⚄⚅]/.test(e)?_M(e):xM(e)}function xM(e){if(typeof e!="string")return e;const t=e,r=[];let n=0;for(let s=0;s<t.length;s++){const o=t[s];if(o==="Z"||o==="z"){let i=s+1;for(;i<t.length&&(t[i]===" "||t[i]===" "||t[i]===" ");)i++;if(i<t.length&&/\d/.test(t[i])){r.push(a.jsx("span",{style:{textTransform:"none"},children:"z"},`z-${s}-${n++}`));continue}}r.push(o)}return a.jsx(a.Fragment,{children:r})}function KY(){l.useEffect(()=>{if(wE(),typeof window>"u")return;const e=()=>{wE(),window.removeEventListener("touchstart",e,!0),window.removeEventListener("pointerdown",e,!0)};return window.addEventListener("touchstart",e,!0),window.addEventListener("pointerdown",e,!0),()=>{window.removeEventListener("touchstart",e,!0),window.removeEventListener("pointerdown",e,!0)}},[])}function QY(e,t,r){l.useEffect(()=>{if(typeof t!="number"||t<0)return;const n=window.setTimeout(()=>r(),t);return()=>window.clearTimeout(n)},[t,r])}function JY(e){l.useEffect(()=>{let t=!1;const r=async()=>{try{if(!Tx())try{await yn()}catch{}const s=e==="win"?["winDing","win"]:e==="lose"?["lose"]:e==="push"?["push"]:[];if(s.length){try{$d(s)}catch{}try{await Qg(s,600)}catch{}}if(t)return;e==="lose"?jx({volume:.06}):e==="win"?C8({volume:.25}):e==="push"&&oI({volume:.04})}catch{}},n=window.setTimeout(()=>{r()},10);return()=>{t=!0,window.clearTimeout(n)}},[e])}function $Y(e){const{enabled:t,kind:r,targetRef:n,animationData:s,fallbackMap:o,isIOS:i,onComplete:c}=e,u=l.useRef(null);l.useEffect(()=>{if(!t||r!=="win"&&r!=="lose")return;let p=!1;return(async()=>{try{const d=await wM(),f=s||(r?o[r]:void 0)||await U0(r);if(p||!n.current||!f)return;u.current=d.loadAnimation({container:n.current,renderer:i?"canvas":"svg",autoplay:!0,loop:!1,animationData:f,subframe:!1,rendererSettings:{progressiveLoad:!0,hideOnTransparent:!0,preserveAspectRatio:"xMidYMid meet",dpr:Math.min(window.devicePixelRatio||1,1.5)}}),c&&u.current.addEventListener("complete",c)}catch{}})(),()=>{var d,f,m;p=!0;try{c&&u.current&&((f=(d=u.current).removeEventListener)==null||f.call(d,"complete",c)),(m=u.current)==null||m.destroy()}catch{}u.current=null,n.current&&(n.current.innerHTML="")}},[t,r,s,o,i,c,n])}function eZ({item:e,onDone:t,animations:r,zIndex:n}){const s=l.useRef(null),o=l.useRef(null),[i,c]=l.useState("enter"),u=l.useRef(!1),p=l.useCallback(()=>{u.current||(u.current=!0,t(e.id))},[t,e.id]),d=l.useCallback(()=>{c("leave"),window.setTimeout(p,320)},[p]);JY(e.kind),QY(e.id,e.duration,d);const f=l.useMemo(GY,[]),m=e.kind==="win"||e.kind==="lose";$Y({enabled:m,kind:e.kind,targetRef:o,animationData:e.animationData,fallbackMap:r,isIOS:f,onComplete:m&&e.autoDismissOnComplete?()=>{d()}:void 0});const h=e.title&&typeof e.title=="string"&&e.title.includes(":")?(()=>{const g=e.title.indexOf(":"),y=e.title.slice(0,g).trim(),x=e.title.slice(g+1).trim();return a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"flash-title__name",children:y}),a.jsx("span",{className:"flash-title__rest",children:Av(x)})]})})():a.jsx("span",{children:xM(e.title)}),b=typeof e.title=="string"&&/\bbanker\b/i.test(e.title)?{opacity:.9}:void 0;return a.jsxs("div",{ref:s,className:["flash-card",`flash-${e.kind??"info"}`,i==="leave"?"leave":i==="steady"?"steady":"enter"].join(" "),role:"status","data-testid":"flash-card","data-flash-kind":e.kind??"info",onClick:()=>e.dismissible&&d(),onAnimationEnd:g=>{g.target===s.current&&(i==="enter"&&c("steady"),i==="leave"&&p())},onTransitionEnd:g=>{g.target===s.current&&i==="leave"&&p()},style:{pointerEvents:"auto",zIndex:n},children:[(e.kind==="lose"||e.kind==="win")&&a.jsx("div",{className:"flash-lottie",ref:o}),e.icon&&a.jsx("div",{className:"flash-icon","aria-hidden":!0,children:e.icon}),a.jsxs("div",{className:"flash-body",children:[e.title&&a.jsx("div",{className:"flash-title"+(typeof e.title=="string"&&/\bbanker\b/i.test(e.title)?" flash-title--banker":""),"data-testid":"flash-title",style:b,children:h}),e.subtitle&&a.jsx("div",{className:"flash-subtitle","data-testid":"flash-subtitle",children:typeof e.subtitle=="string"&&e.subtitle.includes(`
`)?e.subtitle.split(`
`).map((g,y)=>{var v;const x=g.indexOf(":");if(x>0){const A=g.slice(0,x).trim(),_=g.slice(x+1).trim(),w=(v=e.playerAvatars)==null?void 0:v[y];return a.jsxs("span",{className:"flash-subtitle__player",children:[a.jsx("span",{className:"flash-avatar",children:qY(w==null?void 0:w.avatarUrl,A)}),a.jsx("strong",{className:"flash-subtitle__name",children:A}),a.jsx("span",{className:"flash-subtitle__result",children:_M(_)})]},y)}return a.jsx("span",{children:Av(g)},y)}):Av(e.subtitle)}),e.viral&&a.jsx(OY,{viral:e.viral,onClose:()=>{}})]})]})}function tZ({children:e,baseDurationMs:t=ha.flash.baseMs}){const[r,n]=l.useState([]),s=l.useRef(new Set),o=l.useRef({...HY}),i=l.useRef(""),c=l.useRef(0);KY();const u=l.useCallback(b=>{n(g=>g.filter(y=>y.id!==b))},[]),p=l.useCallback(()=>{n([])},[]),d=l.useCallback(b=>{o.current={...o.current,...b}},[]),f=l.useCallback(b=>{var j;const g=typeof crypto<"u"&&"randomUUID"in crypto?crypto.randomUUID():`${Date.now()}-${Math.random().toString(16).slice(2)}`,y=typeof document<"u"?xE():{isCraps:!1,isCeeLo:!1},x=y.isCeeLo,v=typeof b.duration=="number"?b.duration:x&&(b.kind==="win"||b.kind==="lose")?ha.flash.ceeLoShortMs:b.kind==="win"?ha.flash.winMs:b.kind==="info"&&b.subtitle?Math.max(t,1500+((((j=b.title)==null?void 0:j.length)??0)+(typeof b.subtitle=="string"?b.subtitle.length:0))*30):t,A={id:g,dismissible:!0,autoDismissOnComplete:XY(b.kind,b.autoDismissOnComplete,b.duration,x),...b,duration:v};x&&!A.subtitle&&(A.kind==="win"||A.kind==="lose"||A.kind==="push")&&(A.kind==="push"?A.subtitle="No Action":A.subtitle=A.kind==="win"?"You win this round":"You lose this round");const _=`${A.kind}|${A.title}|${A.subtitle??""}`,w=Date.now();if(_===i.current&&w-c.current<2e3)return g;i.current=_,c.current=w,console.log("[FlashOverlay] show()",{kind:A.kind,title:A.title,subtitle:A.subtitle,isCeeLo:x});try{const T=typeof location<"u"?new URLSearchParams(location.search):null;if(T&&T.get("flashDebug")==="1")try{localStorage.setItem("debug:flashes","1")}catch{}const R=typeof window<"u"?window:void 0;(!!(R!=null&&R.FLASH_DEBUG)||typeof localStorage<"u"&&localStorage.getItem("debug:flashes")==="1")&&x&&console.debug("[flash]",{kind:A.kind,title:A.title,subtitle:A.subtitle})}catch{}if(b.kind==="info"||b.kind==="roll")try{gi({volume:.15})}catch{}return n(T=>y.isCraps?[A]:[...T,A]),g},[t]);l.useEffect(()=>{if(r.length!==0||!s.current.size)return;const b=Array.from(s.current);s.current.clear(),b.forEach(g=>{try{g()}catch{}})},[r.length]);const m=l.useMemo(()=>{var b;return{show:f,roll:(g,y)=>f({kind:"roll",title:g,subtitle:y}),rollNow:(g,y)=>f({kind:"roll",title:g,subtitle:y}),win:(g,y,x,v,A)=>(Cr(()=>import("./InAppReviewService-C19lpMDu.js"),__vite__mapDeps([10,2,3,4,1]),import.meta.url).then(_=>_.maybePromptReview()).catch(()=>{}),f({kind:"win",title:g,subtitle:y,viral:x,animationData:v,...A})),lose:(g,y,x,v,A)=>f({kind:"lose",title:g,subtitle:y,viral:x,animationData:v,...A}),push:(g,y,x,v,A)=>f({kind:"push",title:g,subtitle:y,viral:x,animationData:v,...A}),info:(g,y)=>f({kind:"info",title:g,subtitle:y}),infoNow:(g,y)=>f({kind:"info",title:g,subtitle:y}),dismiss:u,clear:p,setFlashAnimations:d,activeKind:r.length?(b=r[r.length-1])==null?void 0:b.kind:void 0,hasActive:r.length>0,onIdle:g=>{r.length===0?setTimeout(g,0):s.current.add(g)}}},[f,u,p,d,r.length]),h=l.useMemo(()=>{var T;if(typeof document>"u")return null;const b=xE(),g=ZY(),y=r[0];if(!y)return null;const v=YY(y,b)&&g?g:document.body,A=v!==document.body,_=A&&b.isCeeLo&&(y.kind==="win"||y.kind==="lose"||y.kind==="push")&&(((T=y.playerAvatars)==null?void 0:T.length)??0)>=2,w=A&&b.isCeeLo&&(y.kind==="win"||y.kind==="lose"||y.kind==="push");return ws.createPortal(a.jsxs("div",{className:"flash-root"+(A?" flash-root--header":"")+(_?" flash-root--inline":"")+(w?" flash-root--ceelo":""),"aria-live":"polite","data-testid":"flash-overlay-root",children:[a.jsx(eZ,{item:y,onDone:u,animations:o.current,zIndex:2e3}),a.jsx("div",{className:"flash-backdrop"})]},y.id),v)},[r,u]);return l.useEffect(()=>{},[f]),a.jsxs(hA.Provider,{value:m,children:[e,h]})}function As(){const e=l.useContext(hA);if(!e)throw new Error("useFlashOverlay must be used within <FlashOverlayProvider>");return e}function vb(){const e=l.useContext(hA);if(e)return e;const t=()=>{},r=()=>"";return{show:r,roll:r,rollNow:t,win:t,lose:t,push:t,info:t,infoNow:t,dismiss:t,clear:t,setFlashAnimations:t,activeKind:void 0,hasActive:!1,onIdle:t}}const AE=Xy,rZ=Yy,nZ=Zy,aZ=jB,kE=dx;function kp(){const{user:e,refreshUser:t}=Zr(),{rc:r,ready:n,error:s,buyChips:o,buySubscription:i,restorePurchases:c}=fM(),{infoNow:u}=As(),[p,d]=l.useState(!1),[f,m]=l.useState(!1),[h,b]=l.useState(!1),[g,y]=l.useState(!1),[x,v]=l.useState(!1),[A,_]=l.useState(void 0),[w,j]=l.useState(void 0),[T,R]=l.useState(void 0),[P,k]=l.useState(void 0),[E,M]=l.useState(void 0),[C,I]=l.useState(void 0),[L,N]=l.useState(!1),S=zr.getPlatform()==="web",F=za(),D=!0,H=l.useMemo(()=>r==null?void 0:r.Purchases,[r]);l.useCallback(ie=>{var we,he;return(we=ie==null?void 0:ie.all)!=null&&we[AE]?ie.all[AE]:(ie==null?void 0:ie.current)||((he=ie==null?void 0:ie.all)==null?void 0:he.default)||null},[]);const W=l.useCallback(async()=>{var ie,we;try{const he=hs(),Ae=await((ie=he==null?void 0:he.getCustomerInfo)==null?void 0:ie.call(he));let Fe=!1;const U=((we=Ae==null?void 0:Ae.entitlements)==null?void 0:we.active)||{},V=Object.keys(U).length>0;kE&&(Fe=!!(U!=null&&U[kE])||V),v(Fe)}catch{}},[H,D]);l.useEffect(()=>{n&&D&&W()},[n,D,W]),l.useEffect(()=>{if(!n||!D)return;let ie=0;const we=6,he=setInterval(()=>{ie+=1,W(),ie>=we&&clearInterval(he)},500);return()=>clearInterval(he)},[n,D,W]),l.useEffect(()=>{let ie=!1;return(async()=>{var we,he,Ae,Fe;try{if(!n||!D)return;const U=hs(),V=await((we=U==null?void 0:U.getOfferings)==null?void 0:we.call(U));if(!V)return;const z=[],O=ee=>{Array.isArray(ee)&&ee.forEach(xe=>{xe&&z.push(xe)})};O(((he=V==null?void 0:V.current)==null?void 0:he.availablePackages)||((Ae=V==null?void 0:V.current)==null?void 0:Ae.packages)),V!=null&&V.all&&Object.values(V.all).forEach(ee=>O((ee==null?void 0:ee.availablePackages)||(ee==null?void 0:ee.packages)));const q=ee=>{var xe,Le,Ge;return(ee==null?void 0:ee.identifier)||((xe=ee==null?void 0:ee.product)==null?void 0:xe.identifier)||((Le=ee==null?void 0:ee.rcBillingProduct)==null?void 0:Le.identifier)||((Ge=ee==null?void 0:ee.webBillingProduct)==null?void 0:Ge.identifier)},X=ee=>(ee==null?void 0:ee.product)||(ee==null?void 0:ee.rcBillingProduct)||(ee==null?void 0:ee.webBillingProduct)||ee,Z=ee=>{const xe=X(ee);return!!((ee==null?void 0:ee.packageType)==="MONTHLY"||(ee==null?void 0:ee.packageType)==="ANNUAL"||xe!=null&&xe.subscriptionPeriod||xe!=null&&xe.period||xe!=null&&xe.defaultSubscriptionOption||xe!=null&&xe.productType&&/subscription/i.test(String(xe.productType)))},Q=ee=>{var xe,Le,Ge,_t;return(ee==null?void 0:ee.priceString)||((xe=ee==null?void 0:ee.price)==null?void 0:xe.formattedPrice)||((Le=ee==null?void 0:ee.currentPrice)==null?void 0:Le.formattedPrice)||(ee==null?void 0:ee.price)||((_t=(Ge=ee==null?void 0:ee.defaultPurchaseOption)==null?void 0:Ge.basePrice)==null?void 0:_t.formattedPrice)},oe=ee=>String((ee==null?void 0:ee.title)||(ee==null?void 0:ee.displayName)||""),ce=ee=>String((ee==null?void 0:ee.description)||""),_e=ee=>ee?z.find(xe=>q(xe)===ee):void 0;let re=_e(rZ)||_e(nZ);if(re||(re=z.find(ee=>!Z(ee))),re){const ee=X(re),xe=Q(ee),Le=oe(ee),Ge=ce(ee),_t=String(q(re)||""),Xe=De=>{const Ye=De.match(/\b(\d{1,3}(?:[\,\._\s]\d{3})*|\d{2,})\b/);if(!Ye)return null;const Re=Ye[1].replace(/[\._\s,]/g,""),et=parseInt(Re,10);return Number.isFinite(et)?et:null},bt=Xe(Le)??Xe(Ge)??Xe(_t),Pt=bt&&bt>0?bt:void 0,kt=Pt?new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(Pt):void 0,Ee=kt?`z${kt}`:"Z Credits",le=xe?`${Ee} for ${xe}`:void 0;ie||_(le),ie||R("Top up your Z Credits to keep playing.")}let pe=_e(aZ);if(pe||(pe=z.find(Le=>(Le==null?void 0:Le.packageType)==="MONTHLY"||/month/i.test(String(q(Le)||""))||/month/i.test(oe(X(Le))))||z.find(Le=>Z(Le)||/year|annual|week|month/i.test(String(q(Le)||"")))),ie||N(!!pe),pe){const ee=X(pe),xe=Q(ee),Le=xe?`${xe} Mo`:void 0;if(ie||j(Le),ie||k("Remove ads and unlock premium features."),ie||M(xe),!ie){let Ge="Auto-renewing";const _t=(pe==null?void 0:pe.packageType)||(ee==null?void 0:ee.subscriptionPeriod)||(ee==null?void 0:ee.period)||((Fe=ee==null?void 0:ee.defaultSubscriptionOption)==null?void 0:Fe.period),Xe=String(_t||"").toUpperCase();Xe.includes("MONTH")||Xe==="MONTHLY"||Xe==="P1M"?Ge="Monthly":Xe.includes("YEAR")||Xe==="ANNUAL"||Xe==="P1Y"?Ge="Annual":Xe.includes("WEEK")||Xe==="WEEKLY"||Xe==="P1W"?Ge="Weekly":(Xe.includes("DAY")||Xe==="P1D")&&(Ge="Daily"),I(Ge)}}}catch{}})(),()=>{ie=!0}},[n,D,H]);const G=async()=>{var ie;if(!p){if(d(!0),m(!0),!n){u("Purchases initializing…","Please try again in a moment."),m(!1),d(!1);return}try{await o(),u("Purchase complete","Chips will appear shortly.")}catch(we){let he=(we==null?void 0:we.message)||"Purchase unavailable right now. Please try again shortly.";try{const Ae=((ie=we==null?void 0:we.getErrorCode)==null?void 0:ie.call(we))??(we==null?void 0:we.errorCode)??(we==null?void 0:we.code),Fe=typeof Ae=="number"?Ae===3?"PurchaseNotAllowedError":Ae===2?"StoreProblemError":Ae===5?"ProductNotAvailableForPurchaseError":void 0:void 0;Fe==="PurchaseNotAllowedError"?he="Purchases not allowed for this Apple ID/device. Use an App Store sandbox account and ensure the Paid Apps Agreement is accepted.":Fe==="StoreProblemError"?he="App Store is currently unavailable. Please try again later or verify sandbox account is signed in to the device.":Fe==="ProductNotAvailableForPurchaseError"&&(he="Product not available. Verify the product identifier matches App Store Connect and RevenueCat configuration for this app target.")}catch{}u("Purchase failed",he)}finally{m(!1),d(!1)}}},$=async()=>{if(!p){if(d(!0),b(!0),!n){try{u("Purchases initializing…","Please try again in a moment.")}catch{}try{await(await Cr(async()=>{const{reconfigureRevenueCat:ie}=await Promise.resolve().then(()=>NY);return{reconfigureRevenueCat:ie}},void 0,import.meta.url)).reconfigureRevenueCat()}catch{}b(!1),d(!1);return}try{await i(),await W(),u("Subscription active","Thanks for supporting.")}finally{b(!1),d(!1)}}},K=async()=>{if(!p){if(d(!0),y(!0),!n)throw new Error("Payment service not ready");await c(),await W();try{const ie=await Jn();ie&&await fetch(`${F}/api/payment/revenuecat/restore`,{method:"POST",headers:{Authorization:`Bearer ${ie}`}})}catch{}try{await t()}catch{}try{setTimeout(()=>{t().catch(()=>{})},800)}catch{}try{setTimeout(()=>{t().catch(()=>{})},2e3)}catch{}u("Restored purchases","Your purchases have been restored."),y(!1),d(!1)}},de=l.useMemo(()=>!n||!D?"Initializing…":x?"Premium Active":"Go Premium",[x,n,D]);return{ready:n,error:s||null,busy:p,busyChips:f,busySubscription:h,premiumActive:x,hasPremiumPackage:L,premiumLabel:de,purchasesReady:D,isWeb:S,onBuyChips:G,onGoPremium:$,onRestore:K,chipsSubtitle:A,premiumSubtitle:w,chipsDescription:T,premiumDescription:P,premiumPrice:E,premiumInterval:C}}var jf;(function(e){e.Heavy="HEAVY",e.Medium="MEDIUM",e.Light="LIGHT"})(jf||(jf={}));var SE;(function(e){e.Success="SUCCESS",e.Warning="WARNING",e.Error="ERROR"})(SE||(SE={}));const Ac=Kl("Haptics",{web:()=>Cr(()=>import("./web-B39ynL7L.js"),__vite__mapDeps([11,1,2,3,4,12]),import.meta.url).then(e=>new e.HapticsWeb)}),sZ={Light:jf.Light,Medium:jf.Medium,Heavy:jf.Heavy},oZ={Light:10,Medium:20,Heavy:35};async function na(e="Light"){var t;try{await Ac.impact({style:sZ[e]});return}catch{}try{(t=navigator.vibrate)==null||t.call(navigator,oZ[e])}catch{}}function cr(e="Light"){na(e)}async function AM(){try{if(Ac!=null&&Ac.selectionStart){await Ac.selectionStart(),await Ac.selectionChanged(),await Ac.selectionEnd();return}}catch{}await na("Light")}const q0=Object.freeze(Object.defineProperty({__proto__:null,hapticClick:cr,hapticImpact:na,hapticSelection:AM},Symbol.toStringTag,{value:"Module"}));function gA({isPremium:e,className:t}){const[r,n]=l.useState(!1),{onGoPremium:s,busy:o,ready:i}=kp();if(!e)return null;const c=async()=>{try{n(!0);try{cr("Light")}catch{}await s()}finally{n(!1)}};return a.jsx("button",{className:t||"felt-btn","data-no-global-haptic":!0,onClick:c,disabled:r||o||!i||!1,"aria-busy":r||o,title:"Manage your subscription",children:r||o?"Processing…":"Manage"})}function kM({open:e,onClose:t,featureDescription:r}){const{user:n}=Zr(),{onGoPremium:s,onRestore:o,busy:i,premiumActive:c,hasPremiumPackage:u,premiumLabel:p,error:d,ready:f,premiumPrice:m,premiumInterval:h}=kp(),b=Hr(),{infoNow:g}=As(),y=async()=>{if(!(n!=null&&n.id)){try{b("/lobby")}catch{}try{t==null||t()}catch{}return}if(!(c||i))try{if(await s(),!c)return;t()}catch(A){const _=(A==null?void 0:A.message)||"Purchases are initializing… please try again in a moment.";try{g("Purchase unavailable",_)}catch{}}};if(!e)return null;const x=!!(n!=null&&n.id),v="$1.99";return a.jsx("div",{className:"modal-overlay",children:a.jsxs("div",{className:"modal",children:[a.jsx("button",{className:"modal-close","aria-label":"Close",onClick:t,children:"×"}),a.jsx("h3",{children:c?"Premium Active":`Go Premium for ${v}/mo!`}),a.jsx("p",{children:c?"Your premium membership is active.":r||"Creating rooms is a premium feature. Upgrade to unlock it and more."}),!c&&u&&a.jsx("button",{className:"gold-btn felt-btn",onClick:y,disabled:i,children:x?i?"Processing…":p:"Sign in to Upgrade"}),c&&a.jsx("div",{style:{marginTop:12},children:a.jsx(gA,{isPremium:!0})}),!c&&u&&a.jsxs("p",{className:"meta",style:{fontSize:12,opacity:.85},children:[a.jsx("strong",{children:"Premium Subscription"})," — ",m?`${m} `:v+" ",h?`(${h})`:"(Monthly)",". Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",a.jsx(Xs,{to:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",a.jsx(Xs,{to:"/terms",className:"legal-link",children:"Terms of Use"}),"."]}),d&&a.jsx("p",{className:"error",role:"alert",children:d}),!c&&u&&a.jsx("div",{style:{marginTop:8},children:a.jsx("button",{type:"button",className:"gold-link",onClick:o,disabled:!x||i||!f||!1,"aria-label":"Restore Purchases",title:"Restore Purchases",children:"Restore Purchases"})}),!x&&!c&&a.jsx("p",{className:"meta",children:"Please sign in to upgrade."}),!x&&d&&a.jsx("p",{className:"meta",children:"Purchases unavailable while signed out."})]})})}let Wu=null,EE=0;const iZ=3e4;function lZ(){const{user:e}=Zr(),[t,r]=l.useState(Wu),[n,s]=l.useState(!1),[o,i]=l.useState(!1),c=za(),u=l.useCallback(async(d=!1)=>{if(e){if(!d&&Wu&&Date.now()-EE<iZ){r(Wu);return}s(!0);try{const f=await Jn(),h=await(await fetch(`${c}/api/challenges/daily`,{credentials:"include",headers:{...f?{Authorization:`Bearer ${f}`}:{},Accept:"application/json"}})).json();h!=null&&h.ok&&(h!=null&&h.data)&&(Wu=h.data,EE=Date.now(),r(Wu))}catch{}finally{s(!1)}}},[e,c]),p=l.useCallback(async()=>{if(!e||o)return null;i(!0);try{const d=await Jn(),m=await(await fetch(`${c}/api/challenges/daily/claim`,{method:"POST",credentials:"include",headers:{...d?{Authorization:`Bearer ${d}`}:{},Accept:"application/json","Content-Type":"application/json"}})).json();return m!=null&&m.ok?(Wu=null,await u(!0),m.data):null}catch{return null}finally{i(!1)}},[e,o,c,u]);return l.useEffect(()=>{e&&u()},[e,u]),{data:t,loading:n,claiming:o,refresh:u,claim:p}}function ac({onClose:e,defaultMode:t}){const[r,n]=l.useState(t??"cee-lo"),s=!t,o=()=>s?a.jsxs("div",{className:"howto__toggle",role:"tablist","aria-label":"Select ruleset",children:[a.jsx("button",{type:"button",role:"tab","aria-selected":r==="cee-lo","aria-pressed":r==="cee-lo",onClick:()=>{n("cee-lo")},className:"felt-btn"+(r==="cee-lo"?" felt-btn--active":""),children:"Cee‑Lo"}),a.jsx("button",{type:"button",role:"tab","aria-selected":r==="craps","aria-pressed":r==="craps",onClick:()=>{n("craps")},className:"felt-btn"+(r==="craps"?" felt-btn--active":""),children:"Craps"}),a.jsx("button",{type:"button",role:"tab","aria-selected":r==="poker","aria-pressed":r==="poker",onClick:()=>{n("poker")},className:"felt-btn"+(r==="poker"?" felt-btn--active":""),children:"Poker"}),a.jsx("button",{type:"button",role:"tab","aria-selected":r==="skills","aria-pressed":r==="skills",onClick:()=>{n("skills")},className:"felt-btn"+(r==="skills"?" felt-btn--active":""),children:"Skills"})]}):null,i=a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Overview"}),a.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."})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Single‑Player Mode"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.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."]}),a.jsxs("li",{children:[a.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."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Auto pacing:"})," Rounds settle automatically and the next round starts after a short buffer."]}),a.jsxs("li",{children:[a.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."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Round Flow"}),a.jsxs("ol",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Banker sets the roll:"})," The banker rolls until they have a scoring result."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Challengers roll:"})," Each challenger rolls once a banker score exists."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Settle:"})," Wagers settle automatically with chip animations and a result flash."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Dice Scoring"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"456 (banker only):"})," Banker wins against everyone (auto‑win)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"123 (banker only):"})," Banker fails/pass this round (auto‑lose / pass)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Triples:"})," Three of a kind beats any point (higher triple beats lower)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Point:"})," A pair plus a singleton sets a point equal to the singleton value (1–6). Higher point wins."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Nothing:"})," No pair/triple and not 123/456 — banker re‑rolls; challenger non‑score."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Challenger 123/456:"})," Treated as a normal point (no auto outcome for challengers)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Tie:"})," Push (stake returned)."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Main Bets (vs Banker)"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Main bet wins if your roll outranks banker, loses if lower, pushes if equal."}),a.jsx("li",{children:"Banker auto results (456 / 123) settle immediately with no legacy sweep animation."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Side Bets"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Create offers on another player’s upcoming roll (e.g. “Under 4 on Alex”)."}),a.jsx("li",{children:"Only non‑subject players may accept; creator & subject excluded."}),a.jsx("li",{children:"Offer can be canceled until the subject rolls."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Visual Feedback"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Chip flights represent transfers; flashes show WIN / LOSE / PUSH."}),a.jsx("li",{children:"Push flashes appear shortly after resolution to keep pacing consistent."}),a.jsx("li",{children:"Haptics fire for meaningful outcomes (supported devices)."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Tips"}),a.jsxs("ul",{children:[a.jsx("li",{children:"High banker point (5 or 6) reduces challenger EV—size bets accordingly."}),a.jsx("li",{children:"Track patterns with the history view; variance can mask true edge short‑term."})]})]})]}),c=a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Overview"}),a.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."}),a.jsxs("p",{className:"howto__note howto__note--small",children:[a.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."]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Table Flow"}),a.jsxs("ol",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Come‑Out Roll:"})," Shooter rolls with no point established."]}),a.jsxs("li",{children:[a.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."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Point Phase:"})," Shooter keeps rolling until point repeats (Pass wins) or a 7 appears (Don’t Pass wins / seven‑out)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Shooter Rotation:"})," On seven‑out (or configured rotation rule) the dice pass to next player in order."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Pass / Don’t Pass Rules"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.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)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Point Phase:"})," Pass wins if point repeats before 7; Don’t Pass wins on 7 before point."]}),a.jsx("li",{children:"Payout: Even money (winning line bet returns principal + equal winnings; push returns principal)."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Place Bets (Implemented)"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Available only after a point is established."}),a.jsx("li",{children:"Remain on the table until a 7 (seven‑out) or player removes them (UI removal support pending future update)."}),a.jsx("li",{children:"Payout ratios (winnings only; principal stays): 4/10: 9:5 • 5/9: 7:5 • 6/8: 7:6."}),a.jsx("li",{children:"On seven‑out all active place bets lose and are cleared."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Planned Features"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Odds Bets:"})," True odds behind line & come bets (no house edge)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Come / Don’t Come:"})," Independent points established after the main point."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Field & Big 6/8:"})," One‑roll (Field) and even‑money (Big) bets with proper settlement."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Prop / Horn:"})," Center action (yo, any 7, craps, hardways) with single‑roll or multi‑roll resolution."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Readiness & Rolling"}),a.jsxs("ul",{children:[a.jsx("li",{children:"All players mark Ready between rolls; shooter auto‑ready on new shooter assignment."}),a.jsx("li",{children:"Countdown deadline (if shown) enforces timely rolls; expired deadlines may auto‑roll in later phases."}),a.jsx("li",{children:"Shooter must have an active Pass (or Don’t Pass if allowed by table config) before rolling."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Settlement Pipeline"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Server validates roll → computes line & place settlements → emits results → credits balances."}),a.jsx("li",{children:"Line WIN: principal + winnings credited. Line PUSH: principal only. Place WIN: winnings only (bet stays)."}),a.jsx("li",{children:"Seven‑out triggers removal of all unresolved place bets (auto clear broadcast)."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Payout Reference"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Pass / Don’t Pass:"})," 1:1"]}),a.jsxs("li",{children:[a.jsx("b",{children:"Place 4 / 10:"})," 9:5"]}),a.jsxs("li",{children:[a.jsx("b",{children:"Place 5 / 9:"})," 7:5"]}),a.jsxs("li",{children:[a.jsx("b",{children:"Place 6 / 8:"})," 7:6"]})]}),a.jsx("p",{className:"howto__note howto__note--tiny",children:"Fractions floored in current build; rounding rules may refine later."})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Strategy Notes (Basics)"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Place 6 & 8 have the lowest house edge among implemented place bets."}),a.jsx("li",{children:"Even‑money Pass vs Don’t Pass is preference until odds arrive (future true‑odds leverage)."}),a.jsx("li",{children:"Avoid overexposing bankroll pre‑odds: variance on early seven‑outs can be sharp."})]})]})]}),u=a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Overview"}),a.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."}),a.jsxs("p",{className:"howto__note howto__note--small",children:[a.jsx("b",{children:"Table Defaults:"})," Small blind 5, big blind 10, minimum buy‑in z1000, up to 6 seats."]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Buy‑In & Seating"}),a.jsxs("ul",{children:[a.jsxs("li",{children:["Joining a poker room requires at least ",a.jsx("b",{children:"z1000"})," balance (server‑enforced)."]}),a.jsx("li",{children:"When seated, your starting stack equals the minimum buy‑in (z1000)."}),a.jsx("li",{children:"Bots, when present, are seated with z1000 stacks."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Blinds & Turn Order"}),a.jsxs("ul",{children:[a.jsx("li",{children:"The dealer button rotates each hand. Players post small blind and big blind to start the pot."}),a.jsx("li",{children:"Pre‑flop action begins left of the big blind; on later streets it begins left of the button."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Actions"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Fold"})," — Surrender your hand; no further claim to the pot."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Check/Call"})," — Match the current bet to continue (or check for free when no bet is outstanding)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Bet/Raise"})," — Put chips in the pot. Min raise equals the last raise size; UI shows legal targets."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Streets & Dealing"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Pre‑flop:"})," Two private cards to each player."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Flop:"})," Three community cards."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Turn:"})," One community card."]}),a.jsxs("li",{children:[a.jsx("b",{children:"River:"})," One community card."]}),a.jsx("li",{children:"Short UI locks play during dealing animations to keep state consistent."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Pots, All‑In, Side Pots"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Contributions create the main pot and side pots automatically when stacks differ."}),a.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)."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Hand Ranking (Best 5 Cards)"}),a.jsx("ul",{children:a.jsx("li",{children:"Straight Flush (best) → Four of a Kind → Full House → Flush → Straight → Three of a Kind → Two Pair → One Pair → High Card."})})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Showdown"}),a.jsx("ul",{children:a.jsx("li",{children:"Remaining players reveal; best 5‑card hand wins each pot. If everyone else folds, last player takes the pot without showdown."})})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Tips"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Respect position: act later to gather more information."}),a.jsx("li",{children:"Size raises relative to the pot and prior aggression; avoid bet sizing tells."}),a.jsx("li",{children:"Tighten ranges out of position; widen on the button."})]})]})]}),p=a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Overview"}),a.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."})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Game Modes"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Word Search:"})," Find hidden words in a letter grid by swiping across letters."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Anagrams:"})," Form valid words from a pool of scrambled letters."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Trivia:"})," Answer multiple‑choice questions across various categories."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Word Search Rules"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Swipe across adjacent letters (horizontal, vertical, or diagonal) to form words."}),a.jsx("li",{children:"Words must be at least 3 letters long to score."}),a.jsx("li",{children:"Longer words earn more points: 3 letters = 1 pt, 4 letters = 2 pts, 5+ letters = 3+ pts."}),a.jsx("li",{children:"Each word can only be found once per round."}),a.jsx("li",{children:"The timer counts down—find as many words as possible before time expires."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Anagrams Rules"}),a.jsxs("ul",{children:[a.jsx("li",{children:"You're given a pool of letters—tap letters to select them and form words."}),a.jsx("li",{children:"Submit valid words to score points; invalid words don't count."}),a.jsx("li",{children:"Longer words earn more points."}),a.jsx("li",{children:"Letters reset after each submission, allowing multiple words per round."}),a.jsx("li",{children:"Race against the clock to find as many valid words as possible."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Trivia Rules"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Answer multiple‑choice questions from categories like Science, History, Sports, and more."}),a.jsx("li",{children:"Each question has a time limit—answer quickly for bonus points."}),a.jsx("li",{children:"Correct answers earn base points; faster answers earn time bonuses."}),a.jsx("li",{children:"Difficulty varies: Easy, Medium, and Hard questions with increasing point values."}),a.jsx("li",{children:"Questions are drawn from a pool of thousands—fresh challenges every game."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Scoring"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Word Search:"})," Points scale with word length (longer = better)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Anagrams:"})," Points scale with word length (longer = better)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Trivia:"})," Base points for correct answers + time bonus for fast responses."]}),a.jsx("li",{children:"Final score determines the winner of each duel."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Match Flow"}),a.jsxs("ol",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Matchmaking:"})," Find an opponent or play against AI."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Mode Selection:"})," Choose Word Search, Anagrams, or Trivia."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Challenge:"})," Both players compete on the same puzzle/questions simultaneously."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Results:"})," Scores are compared and the winner is declared."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Tips"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Word Search:"})," Start with the corners and edges—words often extend from boundaries."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Anagrams:"})," Look for common prefixes/suffixes (‑ing, ‑ed, un‑, re‑) to spot words faster."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Trivia:"})," Don't overthink—your first instinct is often correct. Manage time wisely."]}),a.jsx("li",{children:"Practice regularly to build vocabulary and improve pattern recognition."})]})]})]}),d=a.jsxs(a.Fragment,{children:[a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Overview"}),a.jsx("p",{children:"Zentara is a sci‑fi galactic conquest board game for 2–6 players. Capture planets, collect credits, deal hull damage, and be the last empire standing. Think of it as a space‑themed property strategy game."})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Setup"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Players:"})," 2–6 per match."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Starting Credits:"})," 1,500."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Starting Hull Points (HP):"})," 1,500 (max 1,500)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Board:"})," 40 tiles in a circular ring. All players start on Command Base (tile 0)."]}),a.jsx("li",{children:"Choose a galactic empire and place your token on Command Base."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Turn Structure"}),a.jsxs("ol",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Roll Dice:"})," Roll two dice and move forward that many tiles."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Resolve Tile:"})," The tile's effect triggers automatically."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Manage Assets:"})," Optionally upgrade, mortgage, sell, or trade properties."]}),a.jsxs("li",{children:[a.jsx("b",{children:"End Turn:"})," Play passes to the next player."]})]}),a.jsxs("p",{className:"howto__note howto__note--small",children:[a.jsx("b",{children:"Doubles:"})," Rolling doubles grants an extra roll. Three consecutive doubles sends you to Cryosleep."]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Tile Types"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Command Base:"})," Collect +200 credits when passing or landing."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Planets (22 tiles):"})," Buy unowned planets. Landing on an opponent's planet deals hull damage equal to rent."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Stations (4 tiles):"})," Cost 200 each. Rent scales with how many you own (25 → 50 → 100 → 200)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Asteroid (3 tiles):"})," Draw a chance card — gain or lose credits."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Nebula (3 tiles):"})," Draw a community card — gain or lose credits."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Tax (2 tiles):"})," Pay 200 (Supply Levy) or 100 (War Tax) credits."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Wormhole (2 tiles):"})," Teleport between Wormhole α and β."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Black Hole:"})," Go directly to Cryosleep."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Cryosleep:"})," Roll doubles to escape, or pay 50 credits to wake up."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Safe Harbor:"})," No effect — rest safely."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Planets & Upgrades"}),a.jsxs("ul",{children:[a.jsxs("li",{children:["Planets belong to 8 color groups. Own all planets in a group to ",a.jsx("b",{children:"double base rent"}),"."]}),a.jsxs("li",{children:["Upgrade planets up to ",a.jsx("b",{children:"5 arms levels"})," for dramatically higher rent."]}),a.jsx("li",{children:"You must own the full group before upgrading. Sell upgrades before mortgaging."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Hull Points & Elimination"}),a.jsxs("ul",{children:[a.jsxs("li",{children:["Landing on an opponent's planet deals ",a.jsx("b",{children:"hull damage"})," (HP loss) equal to rent. The owner earns those credits."]}),a.jsx("li",{children:"When HP hits 0: properties are repossessed at 50% value. Pay 200 credits for +50 HP to survive, or surrender."}),a.jsx("li",{children:"Last empire standing wins!"})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Ship Upgrades"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Armor (max level 3):"})," Each level reduces incoming hull damage by 15%. At max level you absorb 45% of all damage from enemy planets."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Weapons (max level 3):"})," Level 1 unlocks ",a.jsx("b",{children:"Auto‑Strike"})," — when you roll doubles and land on an enemy armed planet, you automatically destroy one arms level on that property. Higher levels add a dice bonus during Resource Raids."]}),a.jsx("li",{children:"Each upgrade costs 250 credits. Invest wisely — credits spent on your ship can't be spent on planets."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Heroes"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Hero Shop:"})," Open from the Zentara home screen. Browse heroes organized by empire and tier, then purchase with credits."]}),a.jsxs("li",{children:[a.jsx("b",{children:"6 tiers per empire:"})," Recruit (500) → Guardian (1,500) → Commander (4,000) → Warlord (10,000) → Champion (25,000) → Legend (60,000)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Auto‑equip:"})," When picking your empire before a match, your highest‑tier hero auto‑equips — no manual selection needed."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Attack bonus:"})," Boosts the rent you collect when opponents land on your properties (e.g. +20% at Tier 3)."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Defense bonus:"})," Reduces the rent you pay when landing on opponents' properties. Stacks with Ship Armor."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Empire specializations:"})," Offense empires (Crimson, Golden) get extra attack. Defense empires (Azure, Emerald) get extra defense. Balanced empires (Silver, Void) get base stats."]}),a.jsx("li",{children:"Heroes persist across matches — buy once, use forever."})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Resource Raids (FPS Mini‑Game)"}),a.jsxs("ul",{children:[a.jsxs("li",{children:["When your piece lands on a tile already occupied by an opponent, a ",a.jsx("b",{children:"Resource Raid"})," is triggered."]}),a.jsxs("li",{children:["A full‑screen ",a.jsx("b",{children:"first‑person space combat"})," mini‑game launches — you have ",a.jsx("b",{children:"17 seconds"})," to shoot down as many enemy ships as you can."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Tap/click"})," on enemy ships to fire your lasers. Each hit counts toward your score."]}),a.jsxs("li",{children:["Enemy ships will ",a.jsx("b",{children:"fire back"})," — green laser bolts flash across the screen. You can't dodge, but don't panic — focus on racking up kills."]}),a.jsx("li",{children:"Ships fly in from all directions, perform barrel rolls, and vary in distance. Lead your shots on fast‑moving targets."}),a.jsxs("li",{children:[a.jsx("b",{children:"Scoring:"})," Hit 30% or more of enemy ships to win the raid. The winner steals credits from the loser — base 30 credits plus 8 per hit."]}),a.jsxs("li",{children:["Your ",a.jsx("b",{children:"weapon level"})," gives you a bonus, making it easier to win raids. Upgrade weapons to gain an edge."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Spy Strike"}),a.jsxs("ul",{children:[a.jsxs("li",{children:["When an opponent completes a ",a.jsx("b",{children:"color group"}),", you can pay ",a.jsx("b",{children:"1,000 credits"})," to plant a covert ",a.jsx("b",{children:"spy"})," on that group (one spy per group)."]}),a.jsxs("li",{children:["The next time the spy’s owner lands on any tile in that group, a ",a.jsx("b",{children:"Spy Strike"})," is triggered instead of paying rent."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Phase A — Soldier Strike:"})," breach the defended station to advance."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Phase B — Sniper:"})," you have ",a.jsx("b",{children:"7 seconds"})," to line up and fire on the target. Miss the timer and the shot fails."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Win:"})," seize ownership of the ",a.jsx("i",{children:"entire color group"})," from the defender."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Lose:"})," pay a ",a.jsx("b",{children:"1,000-credit penalty"})," on top of the plant cost, then resolve normal rent (and any Hero Clash) as if you’d landed normally. The group enters a short siege cooldown."]}),a.jsxs("li",{children:["If the penalty would bankrupt you, the standard ",a.jsx("b",{children:"in-debt"})," flow handles it."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Multiplayer"}),a.jsxs("ul",{children:[a.jsxs("li",{children:[a.jsx("b",{children:"Create or join rooms:"})," Host a private room and share the code with friends, or join a public room to play with anyone."]}),a.jsxs("li",{children:[a.jsx("b",{children:"2–6 players:"})," Each player picks a unique galactic empire (faction). Once all players have chosen, the host starts the match."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Real‑time turns:"})," All players see dice rolls, piece movement, property purchases, and trades as they happen — no waiting for syncs."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Resource Raids in multiplayer:"})," When a raid triggers between two players, the involved players play the FPS mini‑game on their own device. Other players see a notification of the raid result."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Bots:"})," Fill empty slots with AI bots. Choose bot difficulty to keep the game competitive even with fewer human players."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Trading:"})," Propose trades with any player — offer properties and credits in exchange for theirs. Both sides must agree."]}),a.jsxs("li",{children:[a.jsx("b",{children:"Chat:"})," In‑game text chat lets you negotiate, trash‑talk, or coordinate — available throughout the match."]})]})]}),a.jsxs("section",{className:"howto__section",children:[a.jsx("h3",{children:"Tips"}),a.jsxs("ul",{children:[a.jsx("li",{children:"Completing color groups early doubles rent — prioritize group completion over scattered purchases."}),a.jsx("li",{children:"Stations are great income with low risk — owning all four yields 200 credits per landing."}),a.jsx("li",{children:"Manage HP carefully: over‑investing in planets can leave you vulnerable to hull damage."}),a.jsx("li",{children:"Use mortgage strategically to survive tough stretches — you can un‑mortgage later."}),a.jsx("li",{children:"Upgrading weapons early unlocks auto‑strike and gives you an edge in Resource Raids."}),a.jsx("li",{children:"Invest in heroes for your favorite empire — the defense bonus stacks with armor for huge damage reduction."}),a.jsx("li",{children:"In the FPS raid, focus on ships at medium distance — they're slower and easier to hit than close fly‑bys."}),a.jsx("li",{children:"In multiplayer, watch the board — if an opponent is heading toward your tile, a raid is incoming."})]})]})]});return a.jsxs("div",{className:"card how-to-play howto",children:[a.jsx("div",{className:"card-header howto__header",children:a.jsx("div",{className:"howto__header-row",children:a.jsx(o,{})})}),a.jsx("h2",{className:"howto__title",children:"How to Play"}),a.jsxs("div",{className:"card-body howto__body",children:[(r==="cee-lo"||r==="craps"||r==="poker")&&a.jsxs("div",{role:"note","aria-label":"Disclaimer",className:"howto__disclaimer",children:[a.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."]}),r==="cee-lo"?i:r==="craps"?c:r==="poker"?u:r==="zentara"?d:p]})]})}function cZ({open:e,onClose:t,defaultMode:r}){const n=l.useRef(null),s="howto-intro";return l.useEffect(()=>{if(!e)return;const o=c=>{c.key==="Escape"&&t()},i=c=>{n.current&&!n.current.contains(c.target)&&t()};return document.addEventListener("keydown",o),document.addEventListener("mousedown",i),()=>{document.removeEventListener("keydown",o),document.removeEventListener("mousedown",i)}},[e,t]),e?a.jsx("div",{className:"modal-backdrop",role:"presentation",children:a.jsxs("div",{className:"modal-panel modal-panel--fullscreen howto-modal",role:"dialog","aria-modal":"true","aria-label":"How to Play","aria-describedby":s,ref:n,children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:"How to Play"}),a.jsx("button",{className:"modal-close",onClick:t,"aria-label":"Close",children:"×"})]}),a.jsx(ac,{defaultMode:r})]})}):null}let Gu=null,PE=0;const uZ=6e4;let Bp=null;function SM(){const{user:e}=Zr(),[t,r]=l.useState(Gu),[n,s]=l.useState(!1),[o,i]=l.useState(null),c=za(),u=l.useCallback(async(p=!1)=>{if(e){if(!p&&Gu&&Date.now()-PE<uZ){r(Gu);return}if(Bp){await Bp,r(Gu);return}s(!0),i(null),Bp=(async()=>{try{const d=await Jn(),f=await fetch(`${c}/api/leaderboard/summary`,{credentials:"include",headers:{...d?{Authorization:`Bearer ${d}`}:{},Accept:"application/json"}});if(!(f.headers.get("content-type")||"").includes("application/json")){const b=await f.text();throw new Error(`Unexpected response (${f.status}). Not JSON. First bytes: ${b.slice(0,120)}`)}const h=await f.json();if(h!=null&&h.ok&&(h!=null&&h.data))Gu=h.data,PE=Date.now(),r(Gu);else throw new Error((h==null?void 0:h.error)||"Failed to load leaderboard")}catch(d){i((d==null?void 0:d.message)??"Failed to load leaderboard")}finally{s(!1),Bp=null}})(),await Bp}},[e]);return l.useEffect(()=>{e&&u()},[e,u]),{data:t,loading:n,error:o,refresh:u}}const dZ={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}],zentaraAllTime:[{rank:1,playerId:"demoZ1",name:"GalaxyKing",avatarUrl:null,credits:18400,wins:14},{rank:2,playerId:"demoZ2",name:"NovaQueen",avatarUrl:null,credits:13220,wins:11},{rank:3,playerId:"demoZ3",name:"StarLord",avatarUrl:null,credits:9180,wins:7}],zentaraWeekly:[{rank:1,playerId:"demoZ2",name:"NovaQueen",avatarUrl:null,credits:4280,wins:3},{rank:2,playerId:"demoZ4",name:"VoidRunner",avatarUrl:null,credits:3140,wins:2}],zentaraBiggestWin:[{rank:1,playerId:"demoZ1",name:"GalaxyKing",avatarUrl:null,credits:5840},{rank:2,playerId:"demoZ3",name:"StarLord",avatarUrl:null,credits:4310}],zentaraTopEmpires:[{rank:1,empire:"crimson-dominion",label:"Crimson Dominion",wins:22},{rank:2,empire:"azure-sovereignty",label:"Azure Sovereignty",wins:18},{rank:3,empire:"golden-imperium",label:"Golden Imperium",wins:14}]};function pZ({open:e,onClose:t}){var p;const[r]=gp(),n=r.get("e2e")==="1",{data:s,loading:o,error:i,refresh:c}=SM(),u=l.useMemo(()=>n?dZ:s,[n,s]);return l.useEffect(()=>{e&&!n&&c(!0)},[e,c,n]),e?a.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:t,children:a.jsxs("div",{className:"modal-panel modal-panel--fullscreen leaderboard-modal",role:"dialog","aria-modal":"true","aria-label":"Leaderboards",onClick:d=>d.stopPropagation(),children:[a.jsxs("div",{className:"modal-header",children:[a.jsx("h3",{className:"modal-title",children:"Leaderboards"}),a.jsx("button",{className:"modal-close",onClick:t,"aria-label":"Close",children:"×"})]}),!n&&o&&a.jsx("p",{children:"Loading…"}),!n&&i&&a.jsx("p",{className:"error",role:"status",children:i}),u&&a.jsxs("div",{className:"leaderboard-sections",children:[((p=u.skillsStreaks)==null?void 0:p.length)>0&&a.jsxs("section",{children:[a.jsx("h4",{children:"🔥 Skills Win Streaks"}),a.jsx("ol",{className:"lb-list",children:u.skillsStreaks.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:[d.bestStreak," best",d.currentStreak>0?` · ${d.currentStreak} now 🔥`:""]})]},d.playerId))})]}),a.jsxs("section",{children:[a.jsx("h4",{children:"Top Balances"}),a.jsx("ol",{className:"lb-list",children:u.topBalances.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:[d.balance.toLocaleString()," chips"]})]},d.playerId))})]}),a.jsxs("section",{children:[a.jsx("h4",{children:"Weekly Winners"}),a.jsx("ol",{className:"lb-list",children:u.weeklyWinners.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:["+",d.amount.toLocaleString()," chips"]})]},d.playerId))})]}),a.jsxs("section",{children:[a.jsx("h4",{children:"All‑Time Winners"}),a.jsx("ol",{className:"lb-list",children:u.allTimeWinners.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:["+",d.amount.toLocaleString()," chips"]})]},d.playerId))})]}),u.zentaraAllTime&&u.zentaraAllTime.length>0&&a.jsxs("section",{children:[a.jsx("h4",{children:"🪐 Zentara · Top Conquerors"}),a.jsx("ol",{className:"lb-list",children:u.zentaraAllTime.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:["✦",d.credits.toLocaleString()," · ",d.wins," win",d.wins===1?"":"s"]})]},d.playerId))})]}),u.zentaraWeekly&&u.zentaraWeekly.length>0&&a.jsxs("section",{children:[a.jsx("h4",{children:"🛰️ Zentara · This Week"}),a.jsx("ol",{className:"lb-list",children:u.zentaraWeekly.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:["✦",d.credits.toLocaleString()," · ",d.wins," win",d.wins===1?"":"s"]})]},d.playerId))})]}),u.zentaraBiggestWin&&u.zentaraBiggestWin.length>0&&a.jsxs("section",{children:[a.jsx("h4",{children:"💥 Zentara · Biggest Victories"}),a.jsx("ol",{className:"lb-list",children:u.zentaraBiggestWin.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.name}),a.jsxs("span",{className:"lb-metric",children:["✦",d.credits.toLocaleString()]})]},d.playerId))})]}),u.zentaraTopEmpires&&u.zentaraTopEmpires.length>0&&a.jsxs("section",{children:[a.jsx("h4",{children:"👑 Zentara · Empire Dominance"}),a.jsx("ol",{className:"lb-list",children:u.zentaraTopEmpires.map(d=>a.jsxs("li",{className:"lb-row",children:[a.jsxs("span",{className:"lb-rank",children:["#",d.rank]}),a.jsx("span",{className:"lb-name",children:d.label}),a.jsxs("span",{className:"lb-metric",children:[d.wins," win",d.wins===1?"":"s"]})]},d.empire))})]})]})]})}):null}function fZ({open:e,onClose:t,onGoLogin:r,title:n,message:s}){const o=l.useRef(null),i=Hr();if(l.useEffect(()=>{if(!e)return;const u=d=>{d.key==="Escape"&&t()},p=d=>{o.current&&!o.current.contains(d.target)&&t()};return document.addEventListener("keydown",u),document.addEventListener("mousedown",p),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",p)}},[e,t]),!e)return null;const c=()=>{try{(r??(()=>i("/lobby")))()}finally{t()}};return a.jsx("div",{className:"modal-backdrop",role:"presentation",children:a.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Login required",ref:o,children:[a.jsx("button",{className:"modal-close",onClick:t,"aria-label":"Close",children:"×"}),a.jsx("h3",{className:"modal-title",children:n??"Login Required"}),s?a.jsx("div",{style:{marginTop:8},children:s}):a.jsx("p",{style:{marginTop:8},children:"You need to be logged in to access this feature."}),a.jsxs("div",{style:{display:"flex",gap:12,marginTop:16,justifyContent:"flex-end"},children:[a.jsx("button",{className:"felt-btn btn--ghost",onClick:t,children:"Cancel"}),a.jsx("button",{className:"felt-btn felt-btn--primary",onClick:c,children:"Go to Home"})]})]})})}const di=Kl("CapacitorUpdater",{web:()=>Cr(()=>import("./web-UU6e-RmY.js"),__vite__mapDeps([13,1,2,3,4]),import.meta.url).then(e=>new e.CapacitorUpdaterWeb)});var V0={exports:{}};const mZ="2.0.0",EM=256,hZ=Number.MAX_SAFE_INTEGER||9007199254740991,gZ=16,yZ=EM-6,bZ=["major","premajor","minor","preminor","patch","prepatch","prerelease"];var _b={MAX_LENGTH:EM,MAX_SAFE_COMPONENT_LENGTH:gZ,MAX_SAFE_BUILD_LENGTH:yZ,MAX_SAFE_INTEGER:hZ,RELEASE_TYPES:bZ,SEMVER_SPEC_VERSION:mZ,FLAG_INCLUDE_PRERELEASE:1,FLAG_LOOSE:2},kv={};const vZ=typeof process=="object"&&kv&&kv.NODE_DEBUG&&/\bsemver\b/i.test(kv.NODE_DEBUG)?(...e)=>console.error("SEMVER",...e):()=>{};var wb=vZ;(function(e,t){const{MAX_SAFE_COMPONENT_LENGTH:r,MAX_SAFE_BUILD_LENGTH:n,MAX_LENGTH:s}=_b,o=wb;t=e.exports={};const i=t.re=[],c=t.safeRe=[],u=t.src=[],p=t.safeSrc=[],d=t.t={};let f=0;const m="[a-zA-Z0-9-]",h=[["\\s",1],["\\d",s],[m,n]],b=y=>{for(const[x,v]of h)y=y.split(`${x}*`).join(`${x}{0,${v}}`).split(`${x}+`).join(`${x}{1,${v}}`);return y},g=(y,x,v)=>{const A=b(x),_=f++;o(y,_,x),d[y]=_,u[_]=x,p[_]=A,i[_]=new RegExp(x,v?"g":void 0),c[_]=new RegExp(A,v?"g":void 0)};g("NUMERICIDENTIFIER","0|[1-9]\\d*"),g("NUMERICIDENTIFIERLOOSE","\\d+"),g("NONNUMERICIDENTIFIER",`\\d*[a-zA-Z-]${m}*`),g("MAINVERSION",`(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})\\.(${u[d.NUMERICIDENTIFIER]})`),g("MAINVERSIONLOOSE",`(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})\\.(${u[d.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASEIDENTIFIER",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIER]})`),g("PRERELEASEIDENTIFIERLOOSE",`(?:${u[d.NONNUMERICIDENTIFIER]}|${u[d.NUMERICIDENTIFIERLOOSE]})`),g("PRERELEASE",`(?:-(${u[d.PRERELEASEIDENTIFIER]}(?:\\.${u[d.PRERELEASEIDENTIFIER]})*))`),g("PRERELEASELOOSE",`(?:-?(${u[d.PRERELEASEIDENTIFIERLOOSE]}(?:\\.${u[d.PRERELEASEIDENTIFIERLOOSE]})*))`),g("BUILDIDENTIFIER",`${m}+`),g("BUILD",`(?:\\+(${u[d.BUILDIDENTIFIER]}(?:\\.${u[d.BUILDIDENTIFIER]})*))`),g("FULLPLAIN",`v?${u[d.MAINVERSION]}${u[d.PRERELEASE]}?${u[d.BUILD]}?`),g("FULL",`^${u[d.FULLPLAIN]}$`),g("LOOSEPLAIN",`[v=\\s]*${u[d.MAINVERSIONLOOSE]}${u[d.PRERELEASELOOSE]}?${u[d.BUILD]}?`),g("LOOSE",`^${u[d.LOOSEPLAIN]}$`),g("GTLT","((?:<|>)?=?)"),g("XRANGEIDENTIFIERLOOSE",`${u[d.NUMERICIDENTIFIERLOOSE]}|x|X|\\*`),g("XRANGEIDENTIFIER",`${u[d.NUMERICIDENTIFIER]}|x|X|\\*`),g("XRANGEPLAIN",`[v=\\s]*(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:\\.(${u[d.XRANGEIDENTIFIER]})(?:${u[d.PRERELEASE]})?${u[d.BUILD]}?)?)?`),g("XRANGEPLAINLOOSE",`[v=\\s]*(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:\\.(${u[d.XRANGEIDENTIFIERLOOSE]})(?:${u[d.PRERELEASELOOSE]})?${u[d.BUILD]}?)?)?`),g("XRANGE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAIN]}$`),g("XRANGELOOSE",`^${u[d.GTLT]}\\s*${u[d.XRANGEPLAINLOOSE]}$`),g("COERCEPLAIN",`(^|[^\\d])(\\d{1,${r}})(?:\\.(\\d{1,${r}}))?(?:\\.(\\d{1,${r}}))?`),g("COERCE",`${u[d.COERCEPLAIN]}(?:$|[^\\d])`),g("COERCEFULL",u[d.COERCEPLAIN]+`(?:${u[d.PRERELEASE]})?(?:${u[d.BUILD]})?(?:$|[^\\d])`),g("COERCERTL",u[d.COERCE],!0),g("COERCERTLFULL",u[d.COERCEFULL],!0),g("LONETILDE","(?:~>?)"),g("TILDETRIM",`(\\s*)${u[d.LONETILDE]}\\s+`,!0),t.tildeTrimReplace="$1~",g("TILDE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAIN]}$`),g("TILDELOOSE",`^${u[d.LONETILDE]}${u[d.XRANGEPLAINLOOSE]}$`),g("LONECARET","(?:\\^)"),g("CARETTRIM",`(\\s*)${u[d.LONECARET]}\\s+`,!0),t.caretTrimReplace="$1^",g("CARET",`^${u[d.LONECARET]}${u[d.XRANGEPLAIN]}$`),g("CARETLOOSE",`^${u[d.LONECARET]}${u[d.XRANGEPLAINLOOSE]}$`),g("COMPARATORLOOSE",`^${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]})$|^$`),g("COMPARATOR",`^${u[d.GTLT]}\\s*(${u[d.FULLPLAIN]})$|^$`),g("COMPARATORTRIM",`(\\s*)${u[d.GTLT]}\\s*(${u[d.LOOSEPLAIN]}|${u[d.XRANGEPLAIN]})`,!0),t.comparatorTrimReplace="$1$2$3",g("HYPHENRANGE",`^\\s*(${u[d.XRANGEPLAIN]})\\s+-\\s+(${u[d.XRANGEPLAIN]})\\s*$`),g("HYPHENRANGELOOSE",`^\\s*(${u[d.XRANGEPLAINLOOSE]})\\s+-\\s+(${u[d.XRANGEPLAINLOOSE]})\\s*$`),g("STAR","(<|>)?=?\\s*\\*"),g("GTE0","^\\s*>=\\s*0\\.0\\.0\\s*$"),g("GTE0PRE","^\\s*>=\\s*0\\.0\\.0-0\\s*$")})(V0,V0.exports);var Im=V0.exports;const _Z=Object.freeze({loose:!0}),wZ=Object.freeze({}),xZ=e=>e?typeof e!="object"?_Z:e:wZ;var yA=xZ;const CE=/^[0-9]+$/,PM=(e,t)=>{const r=CE.test(e),n=CE.test(t);return r&&n&&(e=+e,t=+t),e===t?0:r&&!n?-1:n&&!r?1:e<t?-1:1},AZ=(e,t)=>PM(t,e);var CM={compareIdentifiers:PM,rcompareIdentifiers:AZ};const hh=wb,{MAX_LENGTH:RE,MAX_SAFE_INTEGER:gh}=_b,{safeRe:yh,t:bh}=Im,kZ=yA,{compareIdentifiers:Xu}=CM;let SZ=class ci{constructor(t,r){if(r=kZ(r),t instanceof ci){if(t.loose===!!r.loose&&t.includePrerelease===!!r.includePrerelease)return t;t=t.version}else if(typeof t!="string")throw new TypeError(`Invalid version. Must be a string. Got type "${typeof t}".`);if(t.length>RE)throw new TypeError(`version is longer than ${RE} characters`);hh("SemVer",t,r),this.options=r,this.loose=!!r.loose,this.includePrerelease=!!r.includePrerelease;const n=t.trim().match(r.loose?yh[bh.LOOSE]:yh[bh.FULL]);if(!n)throw new TypeError(`Invalid Version: ${t}`);if(this.raw=t,this.major=+n[1],this.minor=+n[2],this.patch=+n[3],this.major>gh||this.major<0)throw new TypeError("Invalid major version");if(this.minor>gh||this.minor<0)throw new TypeError("Invalid minor version");if(this.patch>gh||this.patch<0)throw new TypeError("Invalid patch version");n[4]?this.prerelease=n[4].split(".").map(s=>{if(/^[0-9]+$/.test(s)){const o=+s;if(o>=0&&o<gh)return o}return s}):this.prerelease=[],this.build=n[5]?n[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(t){if(hh("SemVer.compare",this.version,this.options,t),!(t instanceof ci)){if(typeof t=="string"&&t===this.version)return 0;t=new ci(t,this.options)}return t.version===this.version?0:this.compareMain(t)||this.comparePre(t)}compareMain(t){return t instanceof ci||(t=new ci(t,this.options)),Xu(this.major,t.major)||Xu(this.minor,t.minor)||Xu(this.patch,t.patch)}comparePre(t){if(t instanceof ci||(t=new ci(t,this.options)),this.prerelease.length&&!t.prerelease.length)return-1;if(!this.prerelease.length&&t.prerelease.length)return 1;if(!this.prerelease.length&&!t.prerelease.length)return 0;let r=0;do{const n=this.prerelease[r],s=t.prerelease[r];if(hh("prerelease compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Xu(n,s)}while(++r)}compareBuild(t){t instanceof ci||(t=new ci(t,this.options));let r=0;do{const n=this.build[r],s=t.build[r];if(hh("build compare",r,n,s),n===void 0&&s===void 0)return 0;if(s===void 0)return 1;if(n===void 0)return-1;if(n===s)continue;return Xu(n,s)}while(++r)}inc(t,r,n){if(t.startsWith("pre")){if(!r&&n===!1)throw new Error("invalid increment argument: identifier is empty");if(r){const s=`-${r}`.match(this.options.loose?yh[bh.PRERELEASELOOSE]:yh[bh.PRERELEASE]);if(!s||s[1]!==r)throw new Error(`invalid identifier: ${r}`)}}switch(t){case"premajor":this.prerelease.length=0,this.patch=0,this.minor=0,this.major++,this.inc("pre",r,n);break;case"preminor":this.prerelease.length=0,this.patch=0,this.minor++,this.inc("pre",r,n);break;case"prepatch":this.prerelease.length=0,this.inc("patch",r,n),this.inc("pre",r,n);break;case"prerelease":this.prerelease.length===0&&this.inc("patch",r,n),this.inc("pre",r,n);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 s=Number(n)?1:0;if(this.prerelease.length===0)this.prerelease=[s];else{let o=this.prerelease.length;for(;--o>=0;)typeof this.prerelease[o]=="number"&&(this.prerelease[o]++,o=-2);if(o===-1){if(r===this.prerelease.join(".")&&n===!1)throw new Error("invalid increment argument: identifier already exists");this.prerelease.push(s)}}if(r){let o=[r,s];n===!1&&(o=[r]),Xu(this.prerelease[0],r)===0?isNaN(this.prerelease[1])&&(this.prerelease=o):this.prerelease=o}break}default:throw new Error(`invalid increment argument: ${t}`)}return this.raw=this.format(),this.build.length&&(this.raw+=`+${this.build.join(".")}`),this}};var ks=SZ;const TE=ks,EZ=(e,t,r=!1)=>{if(e instanceof TE)return e;try{return new TE(e,t)}catch(n){if(!r)return null;throw n}};var Sp=EZ;const PZ=Sp,CZ=(e,t)=>{const r=PZ(e,t);return r?r.version:null};var RZ=CZ;const TZ=Sp,jZ=(e,t)=>{const r=TZ(e.trim().replace(/^[=v]+/,""),t);return r?r.version:null};var IZ=jZ;const jE=ks,NZ=(e,t,r,n,s)=>{typeof r=="string"&&(s=n,n=r,r=void 0);try{return new jE(e instanceof jE?e.version:e,r).inc(t,n,s).version}catch{return null}};var MZ=NZ;const IE=Sp,LZ=(e,t)=>{const r=IE(e,null,!0),n=IE(t,null,!0),s=r.compare(n);if(s===0)return null;const o=s>0,i=o?r:n,c=o?n:r,u=!!i.prerelease.length;if(!!c.prerelease.length&&!u){if(!c.patch&&!c.minor)return"major";if(c.compareMain(i)===0)return c.minor&&!c.patch?"minor":"patch"}const d=u?"pre":"";return r.major!==n.major?d+"major":r.minor!==n.minor?d+"minor":r.patch!==n.patch?d+"patch":"prerelease"};var DZ=LZ;const OZ=ks,zZ=(e,t)=>new OZ(e,t).major;var BZ=zZ;const FZ=ks,UZ=(e,t)=>new FZ(e,t).minor;var qZ=UZ;const VZ=ks,HZ=(e,t)=>new VZ(e,t).patch;var WZ=HZ;const GZ=Sp,XZ=(e,t)=>{const r=GZ(e,t);return r&&r.prerelease.length?r.prerelease:null};var YZ=XZ;const NE=ks,ZZ=(e,t,r)=>new NE(e,r).compare(new NE(t,r));var Go=ZZ;const KZ=Go,QZ=(e,t,r)=>KZ(t,e,r);var JZ=QZ;const $Z=Go,eK=(e,t)=>$Z(e,t,!0);var tK=eK;const ME=ks,rK=(e,t,r)=>{const n=new ME(e,r),s=new ME(t,r);return n.compare(s)||n.compareBuild(s)};var bA=rK;const nK=bA,aK=(e,t)=>e.sort((r,n)=>nK(r,n,t));var sK=aK;const oK=bA,iK=(e,t)=>e.sort((r,n)=>oK(n,r,t));var lK=iK;const cK=Go,uK=(e,t,r)=>cK(e,t,r)>0;var xb=uK;const dK=Go,pK=(e,t,r)=>dK(e,t,r)<0;var vA=pK;const fK=Go,mK=(e,t,r)=>fK(e,t,r)===0;var RM=mK;const hK=Go,gK=(e,t,r)=>hK(e,t,r)!==0;var TM=gK;const yK=Go,bK=(e,t,r)=>yK(e,t,r)>=0;var _A=bK;const vK=Go,_K=(e,t,r)=>vK(e,t,r)<=0;var wA=_K;const wK=RM,xK=TM,AK=xb,kK=_A,SK=vA,EK=wA,PK=(e,t,r,n)=>{switch(t){case"===":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e===r;case"!==":return typeof e=="object"&&(e=e.version),typeof r=="object"&&(r=r.version),e!==r;case"":case"=":case"==":return wK(e,r,n);case"!=":return xK(e,r,n);case">":return AK(e,r,n);case">=":return kK(e,r,n);case"<":return SK(e,r,n);case"<=":return EK(e,r,n);default:throw new TypeError(`Invalid operator: ${t}`)}};var jM=PK;const CK=ks,RK=Sp,{safeRe:vh,t:_h}=Im,TK=(e,t)=>{if(e instanceof CK)return e;if(typeof e=="number"&&(e=String(e)),typeof e!="string")return null;t=t||{};let r=null;if(!t.rtl)r=e.match(t.includePrerelease?vh[_h.COERCEFULL]:vh[_h.COERCE]);else{const u=t.includePrerelease?vh[_h.COERCERTLFULL]:vh[_h.COERCERTL];let p;for(;(p=u.exec(e))&&(!r||r.index+r[0].length!==e.length);)(!r||p.index+p[0].length!==r.index+r[0].length)&&(r=p),u.lastIndex=p.index+p[1].length+p[2].length;u.lastIndex=-1}if(r===null)return null;const n=r[2],s=r[3]||"0",o=r[4]||"0",i=t.includePrerelease&&r[5]?`-${r[5]}`:"",c=t.includePrerelease&&r[6]?`+${r[6]}`:"";return RK(`${n}.${s}.${o}${i}${c}`,t)};var jK=TK;class IK{constructor(){this.max=1e3,this.map=new Map}get(t){const r=this.map.get(t);if(r!==void 0)return this.map.delete(t),this.map.set(t,r),r}delete(t){return this.map.delete(t)}set(t,r){if(!this.delete(t)&&r!==void 0){if(this.map.size>=this.max){const s=this.map.keys().next().value;this.delete(s)}this.map.set(t,r)}return this}}var NK=IK,Sv,LE;function Xo(){if(LE)return Sv;LE=1;const e=/\s+/g;class t{constructor(L,N){if(N=s(N),L instanceof t)return L.loose===!!N.loose&&L.includePrerelease===!!N.includePrerelease?L:new t(L.raw,N);if(L instanceof o)return this.raw=L.value,this.set=[[L]],this.formatted=void 0,this;if(this.options=N,this.loose=!!N.loose,this.includePrerelease=!!N.includePrerelease,this.raw=L.trim().replace(e," "),this.set=this.raw.split("||").map(S=>this.parseRange(S.trim())).filter(S=>S.length),!this.set.length)throw new TypeError(`Invalid SemVer Range: ${this.raw}`);if(this.set.length>1){const S=this.set[0];if(this.set=this.set.filter(F=>!g(F[0])),this.set.length===0)this.set=[S];else if(this.set.length>1){for(const F of this.set)if(F.length===1&&y(F[0])){this.set=[F];break}}}this.formatted=void 0}get range(){if(this.formatted===void 0){this.formatted="";for(let L=0;L<this.set.length;L++){L>0&&(this.formatted+="||");const N=this.set[L];for(let S=0;S<N.length;S++)S>0&&(this.formatted+=" "),this.formatted+=N[S].toString().trim()}}return this.formatted}format(){return this.range}toString(){return this.range}parseRange(L){const S=((this.options.includePrerelease&&h)|(this.options.loose&&b))+":"+L,F=n.get(S);if(F)return F;const D=this.options.loose,H=D?u[p.HYPHENRANGELOOSE]:u[p.HYPHENRANGE];L=L.replace(H,M(this.options.includePrerelease)),i("hyphen replace",L),L=L.replace(u[p.COMPARATORTRIM],d),i("comparator trim",L),L=L.replace(u[p.TILDETRIM],f),i("tilde trim",L),L=L.replace(u[p.CARETTRIM],m),i("caret trim",L);let W=L.split(" ").map(de=>v(de,this.options)).join(" ").split(/\s+/).map(de=>E(de,this.options));D&&(W=W.filter(de=>(i("loose invalid filter",de,this.options),!!de.match(u[p.COMPARATORLOOSE])))),i("range list",W);const G=new Map,$=W.map(de=>new o(de,this.options));for(const de of $){if(g(de))return[de];G.set(de.value,de)}G.size>1&&G.has("")&&G.delete("");const K=[...G.values()];return n.set(S,K),K}intersects(L,N){if(!(L instanceof t))throw new TypeError("a Range is required");return this.set.some(S=>x(S,N)&&L.set.some(F=>x(F,N)&&S.every(D=>F.every(H=>D.intersects(H,N)))))}test(L){if(!L)return!1;if(typeof L=="string")try{L=new c(L,this.options)}catch{return!1}for(let N=0;N<this.set.length;N++)if(C(this.set[N],L,this.options))return!0;return!1}}Sv=t;const r=NK,n=new r,s=yA,o=Ab(),i=wb,c=ks,{safeRe:u,t:p,comparatorTrimReplace:d,tildeTrimReplace:f,caretTrimReplace:m}=Im,{FLAG_INCLUDE_PRERELEASE:h,FLAG_LOOSE:b}=_b,g=I=>I.value==="<0.0.0-0",y=I=>I.value==="",x=(I,L)=>{let N=!0;const S=I.slice();let F=S.pop();for(;N&&S.length;)N=S.every(D=>F.intersects(D,L)),F=S.pop();return N},v=(I,L)=>(i("comp",I,L),I=j(I,L),i("caret",I),I=_(I,L),i("tildes",I),I=R(I,L),i("xrange",I),I=k(I,L),i("stars",I),I),A=I=>!I||I.toLowerCase()==="x"||I==="*",_=(I,L)=>I.trim().split(/\s+/).map(N=>w(N,L)).join(" "),w=(I,L)=>{const N=L.loose?u[p.TILDELOOSE]:u[p.TILDE];return I.replace(N,(S,F,D,H,W)=>{i("tilde",I,S,F,D,H,W);let G;return A(F)?G="":A(D)?G=`>=${F}.0.0 <${+F+1}.0.0-0`:A(H)?G=`>=${F}.${D}.0 <${F}.${+D+1}.0-0`:W?(i("replaceTilde pr",W),G=`>=${F}.${D}.${H}-${W} <${F}.${+D+1}.0-0`):G=`>=${F}.${D}.${H} <${F}.${+D+1}.0-0`,i("tilde return",G),G})},j=(I,L)=>I.trim().split(/\s+/).map(N=>T(N,L)).join(" "),T=(I,L)=>{i("caret",I,L);const N=L.loose?u[p.CARETLOOSE]:u[p.CARET],S=L.includePrerelease?"-0":"";return I.replace(N,(F,D,H,W,G)=>{i("caret",I,F,D,H,W,G);let $;return A(D)?$="":A(H)?$=`>=${D}.0.0${S} <${+D+1}.0.0-0`:A(W)?D==="0"?$=`>=${D}.${H}.0${S} <${D}.${+H+1}.0-0`:$=`>=${D}.${H}.0${S} <${+D+1}.0.0-0`:G?(i("replaceCaret pr",G),D==="0"?H==="0"?$=`>=${D}.${H}.${W}-${G} <${D}.${H}.${+W+1}-0`:$=`>=${D}.${H}.${W}-${G} <${D}.${+H+1}.0-0`:$=`>=${D}.${H}.${W}-${G} <${+D+1}.0.0-0`):(i("no pr"),D==="0"?H==="0"?$=`>=${D}.${H}.${W}${S} <${D}.${H}.${+W+1}-0`:$=`>=${D}.${H}.${W}${S} <${D}.${+H+1}.0-0`:$=`>=${D}.${H}.${W} <${+D+1}.0.0-0`),i("caret return",$),$})},R=(I,L)=>(i("replaceXRanges",I,L),I.split(/\s+/).map(N=>P(N,L)).join(" ")),P=(I,L)=>{I=I.trim();const N=L.loose?u[p.XRANGELOOSE]:u[p.XRANGE];return I.replace(N,(S,F,D,H,W,G)=>{i("xRange",I,S,F,D,H,W,G);const $=A(D),K=$||A(H),de=K||A(W),ie=de;return F==="="&&ie&&(F=""),G=L.includePrerelease?"-0":"",$?F===">"||F==="<"?S="<0.0.0-0":S="*":F&&ie?(K&&(H=0),W=0,F===">"?(F=">=",K?(D=+D+1,H=0,W=0):(H=+H+1,W=0)):F==="<="&&(F="<",K?D=+D+1:H=+H+1),F==="<"&&(G="-0"),S=`${F+D}.${H}.${W}${G}`):K?S=`>=${D}.0.0${G} <${+D+1}.0.0-0`:de&&(S=`>=${D}.${H}.0${G} <${D}.${+H+1}.0-0`),i("xRange return",S),S})},k=(I,L)=>(i("replaceStars",I,L),I.trim().replace(u[p.STAR],"")),E=(I,L)=>(i("replaceGTE0",I,L),I.trim().replace(u[L.includePrerelease?p.GTE0PRE:p.GTE0],"")),M=I=>(L,N,S,F,D,H,W,G,$,K,de,ie)=>(A(S)?N="":A(F)?N=`>=${S}.0.0${I?"-0":""}`:A(D)?N=`>=${S}.${F}.0${I?"-0":""}`:H?N=`>=${N}`:N=`>=${N}${I?"-0":""}`,A($)?G="":A(K)?G=`<${+$+1}.0.0-0`:A(de)?G=`<${$}.${+K+1}.0-0`:ie?G=`<=${$}.${K}.${de}-${ie}`:I?G=`<${$}.${K}.${+de+1}-0`:G=`<=${G}`,`${N} ${G}`.trim()),C=(I,L,N)=>{for(let S=0;S<I.length;S++)if(!I[S].test(L))return!1;if(L.prerelease.length&&!N.includePrerelease){for(let S=0;S<I.length;S++)if(i(I[S].semver),I[S].semver!==o.ANY&&I[S].semver.prerelease.length>0){const F=I[S].semver;if(F.major===L.major&&F.minor===L.minor&&F.patch===L.patch)return!0}return!1}return!0};return Sv}var Ev,DE;function Ab(){if(DE)return Ev;DE=1;const e=Symbol("SemVer ANY");class t{static get ANY(){return e}constructor(d,f){if(f=r(f),d instanceof t){if(d.loose===!!f.loose)return d;d=d.value}d=d.trim().split(/\s+/).join(" "),i("comparator",d,f),this.options=f,this.loose=!!f.loose,this.parse(d),this.semver===e?this.value="":this.value=this.operator+this.semver.version,i("comp",this)}parse(d){const f=this.options.loose?n[s.COMPARATORLOOSE]:n[s.COMPARATOR],m=d.match(f);if(!m)throw new TypeError(`Invalid comparator: ${d}`);this.operator=m[1]!==void 0?m[1]:"",this.operator==="="&&(this.operator=""),m[2]?this.semver=new c(m[2],this.options.loose):this.semver=e}toString(){return this.value}test(d){if(i("Comparator.test",d,this.options.loose),this.semver===e||d===e)return!0;if(typeof d=="string")try{d=new c(d,this.options)}catch{return!1}return o(d,this.operator,this.semver,this.options)}intersects(d,f){if(!(d instanceof t))throw new TypeError("a Comparator is required");return this.operator===""?this.value===""?!0:new u(d.value,f).test(this.value):d.operator===""?d.value===""?!0:new u(this.value,f).test(d.semver):(f=r(f),f.includePrerelease&&(this.value==="<0.0.0-0"||d.value==="<0.0.0-0")||!f.includePrerelease&&(this.value.startsWith("<0.0.0")||d.value.startsWith("<0.0.0"))?!1:!!(this.operator.startsWith(">")&&d.operator.startsWith(">")||this.operator.startsWith("<")&&d.operator.startsWith("<")||this.semver.version===d.semver.version&&this.operator.includes("=")&&d.operator.includes("=")||o(this.semver,"<",d.semver,f)&&this.operator.startsWith(">")&&d.operator.startsWith("<")||o(this.semver,">",d.semver,f)&&this.operator.startsWith("<")&&d.operator.startsWith(">")))}}Ev=t;const r=yA,{safeRe:n,t:s}=Im,o=jM,i=wb,c=ks,u=Xo();return Ev}const MK=Xo(),LK=(e,t,r)=>{try{t=new MK(t,r)}catch{return!1}return t.test(e)};var kb=LK;const DK=Xo(),OK=(e,t)=>new DK(e,t).set.map(r=>r.map(n=>n.value).join(" ").trim().split(" "));var zK=OK;const BK=ks,FK=Xo(),UK=(e,t,r)=>{let n=null,s=null,o=null;try{o=new FK(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===-1)&&(n=i,s=new BK(n,r))}),n};var qK=UK;const VK=ks,HK=Xo(),WK=(e,t,r)=>{let n=null,s=null,o=null;try{o=new HK(t,r)}catch{return null}return e.forEach(i=>{o.test(i)&&(!n||s.compare(i)===1)&&(n=i,s=new VK(n,r))}),n};var GK=WK;const Pv=ks,XK=Xo(),OE=xb,YK=(e,t)=>{e=new XK(e,t);let r=new Pv("0.0.0");if(e.test(r)||(r=new Pv("0.0.0-0"),e.test(r)))return r;r=null;for(let n=0;n<e.set.length;++n){const s=e.set[n];let o=null;s.forEach(i=>{const c=new Pv(i.semver.version);switch(i.operator){case">":c.prerelease.length===0?c.patch++:c.prerelease.push(0),c.raw=c.format();case"":case">=":(!o||OE(c,o))&&(o=c);break;case"<":case"<=":break;default:throw new Error(`Unexpected operation: ${i.operator}`)}}),o&&(!r||OE(r,o))&&(r=o)}return r&&e.test(r)?r:null};var ZK=YK;const KK=Xo(),QK=(e,t)=>{try{return new KK(e,t).range||"*"}catch{return null}};var JK=QK;const $K=ks,IM=Ab(),{ANY:eQ}=IM,tQ=Xo(),rQ=kb,zE=xb,BE=vA,nQ=wA,aQ=_A,sQ=(e,t,r,n)=>{e=new $K(e,n),t=new tQ(t,n);let s,o,i,c,u;switch(r){case">":s=zE,o=nQ,i=BE,c=">",u=">=";break;case"<":s=BE,o=aQ,i=zE,c="<",u="<=";break;default:throw new TypeError('Must provide a hilo val of "<" or ">"')}if(rQ(e,t,n))return!1;for(let p=0;p<t.set.length;++p){const d=t.set[p];let f=null,m=null;if(d.forEach(h=>{h.semver===eQ&&(h=new IM(">=0.0.0")),f=f||h,m=m||h,s(h.semver,f.semver,n)?f=h:i(h.semver,m.semver,n)&&(m=h)}),f.operator===c||f.operator===u||(!m.operator||m.operator===c)&&o(e,m.semver))return!1;if(m.operator===u&&i(e,m.semver))return!1}return!0};var xA=sQ;const oQ=xA,iQ=(e,t,r)=>oQ(e,t,">",r);var lQ=iQ;const cQ=xA,uQ=(e,t,r)=>cQ(e,t,"<",r);var dQ=uQ;const FE=Xo(),pQ=(e,t,r)=>(e=new FE(e,r),t=new FE(t,r),e.intersects(t,r));var fQ=pQ;const mQ=kb,hQ=Go;var gQ=(e,t,r)=>{const n=[];let s=null,o=null;const i=e.sort((d,f)=>hQ(d,f,r));for(const d of i)mQ(d,t,r)?(o=d,s||(s=d)):(o&&n.push([s,o]),o=null,s=null);s&&n.push([s,null]);const c=[];for(const[d,f]of n)d===f?c.push(d):!f&&d===i[0]?c.push("*"):f?d===i[0]?c.push(`<=${f}`):c.push(`${d} - ${f}`):c.push(`>=${d}`);const u=c.join(" || "),p=typeof t.raw=="string"?t.raw:String(t);return u.length<p.length?u:t};const UE=Xo(),AA=Ab(),{ANY:Cv}=AA,Fp=kb,kA=Go,yQ=(e,t,r={})=>{if(e===t)return!0;e=new UE(e,r),t=new UE(t,r);let n=!1;e:for(const s of e.set){for(const o of t.set){const i=vQ(s,o,r);if(n=n||i!==null,i)continue e}if(n)return!1}return!0},bQ=[new AA(">=0.0.0-0")],qE=[new AA(">=0.0.0")],vQ=(e,t,r)=>{if(e===t)return!0;if(e.length===1&&e[0].semver===Cv){if(t.length===1&&t[0].semver===Cv)return!0;r.includePrerelease?e=bQ:e=qE}if(t.length===1&&t[0].semver===Cv){if(r.includePrerelease)return!0;t=qE}const n=new Set;let s,o;for(const h of e)h.operator===">"||h.operator===">="?s=VE(s,h,r):h.operator==="<"||h.operator==="<="?o=HE(o,h,r):n.add(h.semver);if(n.size>1)return null;let i;if(s&&o){if(i=kA(s.semver,o.semver,r),i>0)return null;if(i===0&&(s.operator!==">="||o.operator!=="<="))return null}for(const h of n){if(s&&!Fp(h,String(s),r)||o&&!Fp(h,String(o),r))return null;for(const b of t)if(!Fp(h,String(b),r))return!1;return!0}let c,u,p,d,f=o&&!r.includePrerelease&&o.semver.prerelease.length?o.semver:!1,m=s&&!r.includePrerelease&&s.semver.prerelease.length?s.semver:!1;f&&f.prerelease.length===1&&o.operator==="<"&&f.prerelease[0]===0&&(f=!1);for(const h of t){if(d=d||h.operator===">"||h.operator===">=",p=p||h.operator==="<"||h.operator==="<=",s){if(m&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===m.major&&h.semver.minor===m.minor&&h.semver.patch===m.patch&&(m=!1),h.operator===">"||h.operator===">="){if(c=VE(s,h,r),c===h&&c!==s)return!1}else if(s.operator===">="&&!Fp(s.semver,String(h),r))return!1}if(o){if(f&&h.semver.prerelease&&h.semver.prerelease.length&&h.semver.major===f.major&&h.semver.minor===f.minor&&h.semver.patch===f.patch&&(f=!1),h.operator==="<"||h.operator==="<="){if(u=HE(o,h,r),u===h&&u!==o)return!1}else if(o.operator==="<="&&!Fp(o.semver,String(h),r))return!1}if(!h.operator&&(o||s)&&i!==0)return!1}return!(s&&p&&!o&&i!==0||o&&d&&!s&&i!==0||m||f)},VE=(e,t,r)=>{if(!e)return t;const n=kA(e.semver,t.semver,r);return n>0?e:n<0||t.operator===">"&&e.operator===">="?t:e},HE=(e,t,r)=>{if(!e)return t;const n=kA(e.semver,t.semver,r);return n<0?e:n>0||t.operator==="<"&&e.operator==="<="?t:e};var _Q=yQ;const Rv=Im,WE=_b,wQ=ks,GE=CM,xQ=Sp,AQ=RZ,kQ=IZ,SQ=MZ,EQ=DZ,PQ=BZ,CQ=qZ,RQ=WZ,TQ=YZ,jQ=Go,IQ=JZ,NQ=tK,MQ=bA,LQ=sK,DQ=lK,OQ=xb,zQ=vA,BQ=RM,FQ=TM,UQ=_A,qQ=wA,VQ=jM,HQ=jK,WQ=Ab(),GQ=Xo(),XQ=kb,YQ=zK,ZQ=qK,KQ=GK,QQ=ZK,JQ=JK,$Q=xA,eJ=lQ,tJ=dQ,rJ=fQ,nJ=gQ,aJ=_Q;var sJ={parse:xQ,valid:AQ,clean:kQ,inc:SQ,diff:EQ,major:PQ,minor:CQ,patch:RQ,prerelease:TQ,compare:jQ,rcompare:IQ,compareLoose:NQ,compareBuild:MQ,sort:LQ,rsort:DQ,gt:OQ,lt:zQ,eq:BQ,neq:FQ,gte:UQ,lte:qQ,cmp:VQ,coerce:HQ,Comparator:WQ,Range:GQ,satisfies:XQ,toComparators:YQ,maxSatisfying:ZQ,minSatisfying:KQ,minVersion:QQ,validRange:JQ,outside:$Q,gtr:eJ,ltr:tJ,intersects:rJ,simplifyRange:nJ,subset:aJ,SemVer:wQ,re:Rv.re,src:Rv.src,tokens:Rv.t,SEMVER_SPEC_VERSION:WE.SEMVER_SPEC_VERSION,RELEASE_TYPES:WE.RELEASE_TYPES,compareIdentifiers:GE.compareIdentifiers,rcompareIdentifiers:GE.rcompareIdentifiers};const Yu=nx(sJ),Tv={},yy="https://updates.dicelounge.app";function oJ(){const t=String("ceelo").trim().toLowerCase();let r=t==="craps"||t==="ceelo"||t==="poker"||t==="skills"||t==="zentara"?`${yy}/${t}/manifest.json`:`${yy}/manifest.json`;r=r.replace(/manifest\.jjson$/i,"manifest.json");try{rn("OTA_MANIFEST_URL_RESOLVE",{target:t,url:r})}catch{}return r}function pi(){return Date.now()}function Up(){var e;try{const t=globalThis.Capacitor,r=(e=t==null?void 0:t.getPlatform)==null?void 0:e.call(t);return r==="ios"||r==="android"}catch{return!1}}function rn(e,t){console.log(`[OTA] ${e}`,t)}function XE(e){if(!e)return"0.0.0";let t=e.replace(/^v/i,"").trim();const r=/^(\d+)\.0(\d+)$/.exec(t);if(r)return`${r[1]}.0.${parseInt(r[2],10)}`;const n=/^(\d+)\.(\d+)$/.exec(t);return n?`${n[1]}.${n[2]}.0`:t}function iJ(e){try{const t=new URL(e);return`${t.protocol}//${t.host}`===yy}catch{return!1}}async function lJ(e){if(!iJ(e))throw new Error("Manifest origin not allowed");const t=pi(),r=await fetch(e,{cache:"no-store",redirect:"error"});if(!r.ok)throw new Error(`HTTP ${r.status}`);const n=await r.json();return rn("OTA_CHECK_FETCH",{ms:pi()-t}),n}async function cJ(e){const t=await e.arrayBuffer(),r=await crypto.subtle.digest("SHA-256",t);return Array.from(new Uint8Array(r)).map(n=>n.toString(16).padStart(2,"0")).join("")}const YE=globalThis.OTA_PUBLIC_KEY_B64||(Tv==null?void 0:Tv.VITE_OTA_PUBKEY)||zB,jv=!0,uJ=50*1024*1024,dJ=/^(\d{12,14}|v?\d+\.\d+\.\d+(?:[-+].+)?)$/;async function pJ(){try{let e=Uint8Array.from(atob(YE),t=>t.charCodeAt(0));if(e.length>40&&e[0]===48)try{const t=e.slice(-32);t.length===32&&(e=t)}catch{}try{return await crypto.subtle.importKey("raw",e,{name:"Ed25519"},!1,["verify"])}catch{try{rn("OTA_KEY_IMPORT_FAIL",{len:e.length})}catch{}return{legacyRaw:e}}}catch(e){try{rn("OTA_KEY_PARSE_FAIL",{error:e==null?void 0:e.message})}catch{}return null}}const fJ=pJ();async function mJ(e,t){if(!e||!e.startsWith("ed25519:"))return!1;const r=e.slice(8);let n;try{n=Uint8Array.from(atob(r),c=>c.charCodeAt(0))}catch{return!1}const s=await fJ;if(!s)return!1;const o=`${t.webVersion}|${t.minNativeVersion}|${t.url}|${t.sha256}`,i=new TextEncoder().encode(o);try{const c=new Uint8Array(n);if(s.legacyRaw){try{rn("OTA_VERIFY_UNSUPPORTED_ENV",{note:"allow_fallback_without_webcrypto_ed25519"})}catch{}return!0}return await crypto.subtle.verify({name:"Ed25519"},s,c,i)}catch{return!1}}class hJ{constructor(){Wr(this,"nativeVersion",null);Wr(this,"activeWebVersion",null);Wr(this,"pendingUpdateVersion",null);Wr(this,"previousWebVersion",null);Wr(this,"lastAppliedSha256",null)}async init(){var o;if(!Up()){rn("OTA_INIT_SKIP_WEB",{});return}const t=pi(),r=await vs.getInfo();this.nativeVersion=r.version;const n=await Va.get({key:"ota_state"});if(n.value)try{const i=JSON.parse(n.value);this.activeWebVersion=i.activeWebVersion,this.pendingUpdateVersion=i.pendingUpdateVersion,this.previousWebVersion=i.previousWebVersion,this.lastAppliedSha256=i.lastAppliedSha256??null}catch{}const s=await di.current().catch(()=>null);s!=null&&s.version&&!this.activeWebVersion&&(this.activeWebVersion=s.version,await this.writePersist()),((o=s==null?void 0:s.bundle)==null?void 0:o.status)==="builtin"&&this.activeWebVersion&&(rn("OTA_STALE_DETECT",{reason:"builtin_active_but_persisted_web_version",activeWebVersion:this.activeWebVersion}),this.activeWebVersion=null,this.pendingUpdateVersion=null,await this.writePersist(),await this.clearCaches()),rn("OTA_INIT",{ms:pi()-t,nativeVersion:this.nativeVersion,currentWebVersion:this.activeWebVersion})}getVersions(){return{nativeVersion:this.nativeVersion,webVersion:this.activeWebVersion}}async checkForUpdate(t){const r=(t==null?void 0:t.force)===!0;let n=this.nativeVersion||null;if(!n&&Up())try{n=(await vs.getInfo()).version||null,this.nativeVersion=n,rn("OTA_NATIVE_VERSION_SYNC",{nativeVersion:n})}catch(s){rn("OTA_NATIVE_VERSION_SYNC_FAIL",{error:s==null?void 0:s.message})}n=n||"0.0.0";try{const s=oJ(),o=await lJ(s),i=o==null?void 0:o.latest;if(!(i!=null&&i.webVersion)||!(i!=null&&i.minNativeVersion)||!(i!=null&&i.url)||!(i!=null&&i.sha256))return{available:!1,reason:"INVALID_MANIFEST",nativeVersion:n,currentWebVersion:this.activeWebVersion};try{rn("OTA_MANIFEST_DEBUG",{fetchedVersion:i.webVersion,hasSig:!!i.sig,sigPrefix:i.sig?i.sig.slice(0,18):null,urlHost:(()=>{try{return new URL(i.url).host}catch{return"parse_err"}})()})}catch{}if(jv&&!i.sig)return rn("OTA_CHECK",{reason:"INVALID_MANIFEST",note:"sig_missing_but_required"}),{available:!1,reason:"INVALID_MANIFEST",nativeVersion:n,currentWebVersion:this.activeWebVersion};if(!dJ.test(i.webVersion))return rn("OTA_CHECK",{reason:"INVALID_MANIFEST",note:"version_pattern",version:i.webVersion}),{available:!1,reason:"INVALID_MANIFEST",nativeVersion:n,currentWebVersion:this.activeWebVersion};if(!/^https:\/\//.test(i.url))return rn("OTA_CHECK",{reason:"INVALID_MANIFEST",note:"url_scheme"}),{available:!1,reason:"INVALID_MANIFEST",nativeVersion:n,currentWebVersion:this.activeWebVersion};if(!/^[a-f0-9]{64}$/i.test(i.sha256))return rn("OTA_CHECK",{reason:"INVALID_MANIFEST",note:"sha256_format"}),{available:!1,reason:"INVALID_MANIFEST",nativeVersion:n,currentWebVersion:this.activeWebVersion};const c=XE(n),u=XE(i.minNativeVersion),p=Yu.coerce(u)||"0.0.0",d=Yu.coerce(c)||"0.0.0",f=Yu.gte(d,p);if(rn("OTA_VERSION_CHECK",{rawNative:n,normalizedNative:c,rawMin:i.minNativeVersion,normalizedMin:u,nativeOk:f}),!f)return rn("OTA_CHECK",{nativeVersion:n,normalizedNative:c,fromWebVersion:this.activeWebVersion,toWebVersion:i.webVersion,reason:"INCOMPATIBLE_NATIVE"}),{available:!1,reason:"INCOMPATIBLE_NATIVE",nativeVersion:n,currentWebVersion:this.activeWebVersion};if(!r&&this.pendingUpdateVersion&&this.pendingUpdateVersion===i.webVersion)return rn("OTA_CHECK",{nativeVersion:n,fromWebVersion:this.activeWebVersion,toWebVersion:i.webVersion,reason:"NO_NEW_VERSION",note:"pending_update_same_version"}),{available:!1,reason:"NO_NEW_VERSION",nativeVersion:n,currentWebVersion:this.activeWebVersion};r&&this.pendingUpdateVersion&&this.pendingUpdateVersion===i.webVersion&&(rn("OTA_CHECK_FORCE_CLEAR_PENDING",{pendingUpdateVersion:this.pendingUpdateVersion}),this.pendingUpdateVersion=null,await this.writePersist());const m=this.activeWebVersion;if(m&&m===i.webVersion)return rn("OTA_CHECK",{nativeVersion:n,fromWebVersion:m,toWebVersion:i.webVersion,reason:"NO_NEW_VERSION",note:"equal_string"}),{available:!1,reason:"NO_NEW_VERSION",nativeVersion:n,currentWebVersion:m};const h=m?Yu.valid(m):null,b=Yu.valid(i.webVersion);let g=!0;if(m)if(h&&b)g=Yu.gt(i.webVersion,m);else if(/^\d+$/.test(i.webVersion)&&/^\d+$/.test(m)){const v=Number(i.webVersion),A=Number(m);!Number.isNaN(v)&&!Number.isNaN(A)&&(g=v>A)}else g=i.webVersion>m;if(m&&!g)return rn("OTA_CHECK",{nativeVersion:n,fromWebVersion:m,toWebVersion:i.webVersion,reason:"NO_NEW_VERSION",note:"fallback_compare"}),{available:!1,reason:"NO_NEW_VERSION",nativeVersion:n,currentWebVersion:m};const y={...i};return rn("OTA_CHECK",{nativeVersion:n,fromWebVersion:m,toWebVersion:y.webVersion,reason:"OK"}),{available:!0,reason:"OK",release:y,nativeVersion:n,currentWebVersion:m}}catch(s){return rn("OTA_CHECK",{nativeVersion:n,fromWebVersion:this.activeWebVersion,error:(s==null?void 0:s.message)||String(s)}),{available:!1,reason:"NETWORK_ERROR",nativeVersion:n,currentWebVersion:this.activeWebVersion}}}async downloadUpdate(t,r){var g;if(!Up())throw new Error("OTA only applies on native platforms");const n=pi();r==null||r({stage:"downloading",percent:0});const s=new AbortController,o=setTimeout(()=>s.abort(),3e4),i=await fetch(t.url,{cache:"no-store",redirect:"error",signal:s.signal});if(clearTimeout(o),!i.ok||!i.body)throw new Error(`Download failed: ${i.status}`);const c=i.body.getReader(),u=[];let p=0;const d=Number(i.headers.get("content-length")||0);for(;;){const{done:y,value:x}=await c.read();if(y)break;if(x){if(u.push(x),p+=x.byteLength,p>uJ)throw new Error("SIZE_LIMIT");d>0&&(r==null||r({stage:"downloading",bytes:p,total:d,percent:Math.round(p/d*100)}))}}const f=new Blob(u,{type:"application/zip"});r==null||r({stage:"verifying"});const m=await cJ(f);if(m.toLowerCase()!==t.sha256.toLowerCase())throw rn("OTA_VERIFY_FAIL",{expected:t.sha256,got:m}),new Error("SHA256_MISMATCH");try{const y=new URL(t.url);if(`${y.protocol}//${y.host}`!==yy)throw new Error("ORIGIN_MISMATCH")}catch{throw new Error("ORIGIN_MISMATCH")}const h=!!t.sig;if(!await mJ(t.sig,t)){const y=h?"SIG_INVALID":"SIG_MISSING";if(rn("OTA_VERIFY_FAIL",{reason:y,require:jv}),y==="SIG_MISSING"&&jv)try{rn("OTA_VERIFY_FAIL_DETAIL",{releaseKeys:Object.keys(t),releaseVersion:t.webVersion,releaseUrl:t.url,sha256Len:(g=t.sha256)==null?void 0:g.length,note:"Signature field absent while signature required"})}catch{}throw new Error(y)}return rn("OTA_VERIFY_OK",{ms:pi()-n,size:p}),{blob:f}}async clearCaches(){try{if("caches"in window){const t=await caches.keys();await Promise.all(t.map(r=>caches.delete(r))),rn("OTA_CACHE_CLEAR",{type:"caches",count:t.length})}}catch(t){rn("OTA_CACHE_CLEAR_FAIL",{type:"caches",error:String(t)})}try{if("serviceWorker"in navigator){const t=await navigator.serviceWorker.getRegistrations();await Promise.all(t.map(r=>r.unregister())),rn("OTA_CACHE_CLEAR",{type:"serviceWorker",count:t.length})}}catch(t){rn("OTA_CACHE_CLEAR_FAIL",{type:"serviceWorker",error:String(t)})}}async applyUpdate(t,r){if(!Up())throw new Error("OTA only applies on native platforms");const n=pi();rn("OTA_APPLY",{toWebVersion:t.webVersion}),this.previousWebVersion=this.activeWebVersion,this.pendingUpdateVersion=t.webVersion,this.lastAppliedSha256=t.sha256,await this.writePersist(),await this.clearCaches();const s=6e4;try{rn("OTA_APPLY_DOWNLOAD_START",{url:t.url,version:t.webVersion});const o=di.download({url:t.url,version:t.webVersion}),i=new Promise((u,p)=>setTimeout(()=>p(new Error("OTA_APPLY_TIMEOUT")),s)),c=await Promise.race([o,i]);rn("OTA_APPLY_DOWNLOAD_DONE",{bundleId:c.id}),await di.set({id:c.id}),rn("OTA_APPLY",{ms:pi()-n,fromWebVersion:this.previousWebVersion,toWebVersion:t.webVersion})}catch(o){throw rn("OTA_APPLY_ERROR",{error:(o==null?void 0:o.message)||String(o),url:t.url}),o}}async healthCheck(){if(!Up())return!0;const t=this.pendingUpdateVersion;if(!t)return!0;if(await this.tryFetchHealth(2e3).catch(()=>!1)||await this.waitForAppMounted(5e3).catch(()=>!1)){this.activeWebVersion=t,this.pendingUpdateVersion=null;try{await di.notifyAppReady()}catch{}await this.writePersist();try{const n=window;n.__OTA_ACTIVATED__=!0,n.__OTA_ACTIVATED_VERSION__=this.activeWebVersion;try{window.dispatchEvent(new CustomEvent("ota:activated",{detail:{webVersion:this.activeWebVersion}}))}catch{}}catch{}return rn("OTA_HEALTH_OK",{active:this.activeWebVersion}),this.cleanupOldBundles(),!0}return await this.rollbackIfBootFails(),!1}async tryFetchHealth(t){try{const r=new AbortController,n=setTimeout(()=>r.abort(),t),s=await fetch("/health",{signal:r.signal,cache:"no-store"});return clearTimeout(n),s.ok}catch{return!1}}async waitForAppMounted(t){const r=pi(),n=window;for(;pi()-r<t;){if(n.__APP_MOUNTED__)return!0;await new Promise(s=>setTimeout(s,100))}return!1}async rollbackIfBootFails(){try{await this.clearCaches(),await di.reset(),this.pendingUpdateVersion=null,this.activeWebVersion=this.previousWebVersion??null,await this.writePersist(),rn("OTA_ROLLBACK",{toWebVersion:this.activeWebVersion}),location.reload()}catch(t){rn("OTA_ROLLBACK_FAIL",{error:t==null?void 0:t.message})}}async cleanupOldBundles(){var t;try{const r=await di.list(),n=await di.current().catch(()=>null),s=(t=n==null?void 0:n.bundle)==null?void 0:t.id;for(const o of r.bundles||[])if(o.id&&o.id!==s&&o.status!=="builtin")try{await di.delete({id:o.id}),rn("OTA_BUNDLE_CLEANUP",{deletedId:o.id})}catch{}}catch(r){rn("OTA_BUNDLE_CLEANUP_FAIL",{error:r==null?void 0:r.message})}}async writePersist(){const t={activeWebVersion:this.activeWebVersion??null,pendingUpdateVersion:this.pendingUpdateVersion??null,previousWebVersion:this.previousWebVersion??null,lastAppliedSha256:this.lastAppliedSha256??null};await Va.set({key:"ota_state",value:JSON.stringify(t)})}}const ys=new hJ,ZE="ota:lastCheckAt",gJ=18e4;function yJ(){try{const e=globalThis.__E2E_OTA_COOLDOWN_MS;if(typeof e=="number"&&e>=0)return e}catch{}return gJ}function bJ(){const[e,t]=l.useState(ys.getVersions()),[r,n]=l.useState(!1),[s,o]=l.useState(null),[i,c]=l.useState({stage:"idle"}),u=l.useRef(null);l.useEffect(()=>{t(ys.getVersions())},[]);const p=l.useCallback(async()=>{n(!0);try{try{const h=Date.now(),b=await zo.get(ZE),g=b?Number(b):0;if(g&&h-g<yJ()){n(!1);return}}catch{}const m=await ys.checkForUpdate();if(m.available&&m.release){o(m),u.current=m.release;try{const h=window;if(!h.__OTA_AUTO_APPLY_RUNNING__){h.__OTA_AUTO_APPLY_RUNNING__=!0,c({stage:"downloading",percent:0});const{blob:b}=await ys.downloadUpdate(m.release,g=>c(g));c({stage:"applying"}),await ys.applyUpdate(m.release,b)}}catch(h){console.error("[OTA] Auto-apply failed:",(h==null?void 0:h.message)||h),c({stage:"error",error:(h==null?void 0:h.message)||"Update failed"});try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}}else m.reason==="NO_NEW_VERSION"?(o(null),u.current=null):o(m);try{await zo.set(ZE,String(Date.now()))}catch{}}finally{n(!1)}},[]),d=l.useCallback(async()=>{const m=u.current;if(!m)return;c({stage:"downloading",percent:0});const{blob:h}=await ys.downloadUpdate(m,b=>c(b));c({stage:"applying"}),await ys.applyUpdate(m,h)},[]),f=l.useCallback(()=>{c({stage:"idle"})},[]);return l.useEffect(()=>{p()},[p]),{current:e,checking:r,available:s,progress:i,applyNow:d,later:f}}function vJ({available:e,progress:t,applyNow:r,later:n}){if(!zr.isNativePlatform()||!(e!=null&&e.available)||!e.release)return null;const s=e.release,o=t.percent??0,i=t.stage!=="error",c=t.stage==="downloading"?`Downloading update… ${o}%`:t.stage==="verifying"?"Verifying update…":t.stage==="applying"?"Installing update…":t.stage==="error"?`Update failed: ${t.error||"Unknown error"}`:"Preparing update…";return a.jsx("div",{className:"ota-overlay",children:a.jsxs("div",{className:"ota-overlay-content",children:[a.jsx("div",{className:"ota-overlay-icon","aria-hidden":!0,children:"🔄"}),a.jsxs("h2",{className:"ota-overlay-title",children:["Updating to ",s.webVersion]}),a.jsx("p",{className:"ota-overlay-status",children:c}),i&&a.jsx("div",{className:"ota-overlay-progress",children:a.jsx("div",{className:"ota-overlay-progress-bar",style:{width:`${Math.min(100,o)}%`}})}),t.stage==="error"&&a.jsx("button",{className:"ota-overlay-retry",onClick:r,children:"Retry"})]})})}function _J({cooldownMs:e=3e4}){const t=l.useRef(!1);return l.useEffect(()=>{let r=[];async function n(i){if(!t.current){t.current=!0;try{const c=await ys.checkForUpdate();if(c.available&&c.release){try{const p=window;if(p.__OTA_AUTO_APPLY_RUNNING__)return;p.__OTA_AUTO_APPLY_RUNNING__=!0}catch{}const{blob:u}=await ys.downloadUpdate(c.release,p=>{});await ys.applyUpdate(c.release,u),setTimeout(()=>{try{window.location.reload()}catch{}},500)}}catch(c){c==null||c.message;try{window.__OTA_AUTO_APPLY_RUNNING__=!1}catch{}}finally{t.current=!1}}}(async()=>{try{const i=await vs.addListener("appStateChange",c=>{c.isActive&&n("native_foreground")});r.push(()=>{try{i.remove()}catch{}})}catch{}})();const s=()=>{document.visibilityState==="visible"&&n()};document.addEventListener("visibilitychange",s),r.push(()=>document.removeEventListener("visibilitychange",s));const o=setTimeout(()=>n(),4e3);return r.push(()=>clearTimeout(o)),()=>{r.forEach(i=>{try{i()}catch{}})}},[e]),null}const wJ=za(),xJ={zentara:"Come play Zentara with me on Dice Lounge — we both get 1,000 chips when you join.",craps:"Let's roll some Craps on Dice Lounge — we both get 1,000 chips when you join.","cee-lo":"Play Cee-Lo with me on Dice Lounge — we both get 1,000 chips when you join.",poker:"Sit at my Poker table on Dice Lounge — we both get 1,000 chips when you join.",skills:"Run a Skills round with me on Dice Lounge — we both get 1,000 chips when you join."},AJ="Join me on Dice Lounge — we both get 1,000 chips when you sign up.";async function kJ(e,t){const r=`${t}
${e}`;try{const n=window.navigator;if(typeof(n==null?void 0:n.share)=="function")return await n.share({title:"Dice Lounge",text:t,url:e}),"shared"}catch(n){if((n==null?void 0:n.name)==="AbortError")return"shared"}try{return await navigator.clipboard.writeText(r),"copied"}catch{}try{return window.location.href=`sms:?body=${encodeURIComponent(r)}`,"shared"}catch{return"failed"}}function NM({className:e,style:t,label:r,gameMode:n}){const[s,o]=l.useState(!1),[i,c]=l.useState(null),u=l.useCallback(async()=>{if(!s){o(!0),c(null);try{const p=await Jn(),f=await(await fetch(`${wJ}/api/referral/link`,{method:"GET",credentials:"include",headers:p?{Authorization:`Bearer ${p}`}:void 0})).json().catch(()=>({})),m=typeof(f==null?void 0:f.url)=="string"?f.url:"";if(!m){c("Sign in to invite friends");return}const h=n&&xJ[n]||AJ,b=await kJ(m,h);c(b==="shared"?"Invite sent":b==="copied"?"Link copied!":"Couldn't share — try again")}catch{c("Couldn't share — try again")}finally{o(!1),setTimeout(()=>c(null),2200)}}},[s,n]);return a.jsxs("button",{type:"button",onClick:u,disabled:s,className:e,"aria-label":"Invite a friend",style:{display:"inline-flex",alignItems:"center",gap:8,padding:"10px 16px",borderRadius:999,border:"1px solid rgba(255,255,255,0.18)",background:s?"rgba(60,60,60,0.6)":"linear-gradient(135deg, #5e60ce 0%, #4ea8de 100%)",color:"#fff",fontSize:14,fontWeight:600,cursor:s?"default":"pointer",boxShadow:"0 4px 14px rgba(0,0,0,0.35)",position:"relative",...t},children:[a.jsx("span",{"aria-hidden":!0,style:{fontSize:16},children:"+1k"}),a.jsx("span",{children:r||"Invite a Friend"}),i&&a.jsx("span",{role:"status","aria-live":"polite",style:{position:"absolute",top:"calc(100% + 8px)",left:"50%",transform:"translateX(-50%)",whiteSpace:"nowrap",background:"rgba(8,14,32,0.92)",color:"#e8efff",padding:"6px 10px",borderRadius:8,fontSize:12,pointerEvents:"none"},children:i})]})}function SJ(){const e=l.useRef(0),t=5e3;return l.useEffect(()=>{if(zr.getPlatform()!=="ios")return;const r=[];async function n(o){const i=Date.now();if(!(i-e.current<t)){e.current=i;try{const c=await Jn();if(!c)return;const u=String(Wf??"https://dicelounge.app").replace(/\/+$/,"");await fetch(`${u}/api/push/clear-badge`,{method:"POST",headers:{"Content-Type":"application/json",Authorization:`Bearer ${c}`}})}catch{}}}(async()=>{try{const o=await vs.addListener("appStateChange",i=>{i.isActive&&n("native_foreground")});r.push(()=>{try{o.remove()}catch{}})}catch{}})();const s=setTimeout(()=>n(),1e3);return r.push(()=>clearTimeout(s)),()=>{r.forEach(o=>{try{o()}catch{}})}},[]),null}const EJ="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 Gc(){return a.jsxs("footer",{className:"lp-footer",children:[a.jsxs("nav",{className:"lp-footer__links","aria-label":"Footer",children:[a.jsx(Xs,{to:"/disclaimer",className:"lp-footer__link",children:"Disclaimer (18+)"}),a.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),a.jsx(Xs,{to:"/privacy",className:"lp-footer__link",children:"Privacy Policy"}),a.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),a.jsx(Xs,{to:"/terms",className:"lp-footer__link",children:"Terms of Use"}),a.jsx("span",{className:"lp-dot","aria-hidden":!0,children:"•"}),a.jsx(Xs,{to:"/support",className:"lp-footer__link",children:"Support"})]}),a.jsx("p",{className:"lp-footnote",role:"note",children:"For entertainment purposes only. No real-money gambling or prizes."}),a.jsxs("p",{className:"lp-copy",children:["© ",new Date().getFullYear()," Zentara One LLC. All rights reserved."]})]})}const H0=""+new URL("logo-Bd_WWMIU.webp",import.meta.url).href,PJ=""+new URL("ceelo-icon-DBUGq3gk.webp",import.meta.url).href,CJ=""+new URL("craps-icon-Cxbu5IDi.webp",import.meta.url).href,RJ=""+new URL("poker-icon-D9lS6jix.webp",import.meta.url).href,TJ=""+new URL("skills-icon-BWMGnrDl.webp",import.meta.url).href,jJ=""+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 W0(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function IJ(e){if(Array.isArray(e))return e}function NJ(e){if(Array.isArray(e))return W0(e)}function MJ(e,t){if(!(e instanceof t))throw new TypeError("Cannot call a class as a function")}function LJ(e,t){for(var r=0;r<t.length;r++){var n=t[r];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(e,MM(n.key),n)}}function DJ(e,t,r){return t&&LJ(e.prototype,t),Object.defineProperty(e,"prototype",{writable:!1}),e}function Cg(e,t){var r=typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(!r){if(Array.isArray(e)||(r=SA(e))||t){r&&(e=r);var n=0,s=function(){};return{s,n:function(){return n>=e.length?{done:!0}:{done:!1,value:e[n++]}},e:function(u){throw u},f:s}}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 o,i=!0,c=!1;return{s:function(){r=r.call(e)},n:function(){var u=r.next();return i=u.done,u},e:function(u){c=!0,o=u},f:function(){try{i||r.return==null||r.return()}finally{if(c)throw o}}}}function bn(e,t,r){return(t=MM(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function OJ(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function zJ(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,o,i,c=[],u=!0,p=!1;try{if(o=(r=r.call(e)).next,t===0){if(Object(r)!==r)return;u=!1}else for(;!(u=(n=o.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(d){p=!0,s=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(p)throw s}}return c}}function BJ(){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 FJ(){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 KE(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function Zt(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?KE(Object(r),!0).forEach(function(n){bn(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):KE(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Sb(e,t){return IJ(e)||zJ(e,t)||SA(e,t)||BJ()}function qo(e){return NJ(e)||OJ(e)||SA(e)||FJ()}function UJ(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function MM(e){var t=UJ(e,"string");return typeof t=="symbol"?t:t+""}function by(e){"@babel/helpers - typeof";return by=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},by(e)}function SA(e,t){if(e){if(typeof e=="string")return W0(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?W0(e,t):void 0}}var QE=function(){},EA={},LM={},DM=null,OM={mark:QE,measure:QE};try{typeof window<"u"&&(EA=window),typeof document<"u"&&(LM=document),typeof MutationObserver<"u"&&(DM=MutationObserver),typeof performance<"u"&&(OM=performance)}catch{}var qJ=EA.navigator||{},JE=qJ.userAgent,$E=JE===void 0?"":JE,Vl=EA,Yn=LM,eP=DM,wh=OM;Vl.document;var dl=!!Yn.documentElement&&!!Yn.head&&typeof Yn.addEventListener=="function"&&typeof Yn.createElement=="function",zM=~$E.indexOf("MSIE")||~$E.indexOf("Trident/"),Iv,VJ=/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)?[\-\ ]/,HJ=/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,BM={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"}},WJ={GROUP:"duotone-group",PRIMARY:"primary",SECONDARY:"secondary"},FM=["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"],ms="classic",Nm="duotone",UM="sharp",qM="sharp-duotone",VM="chisel",HM="etch",WM="jelly",GM="jelly-duo",XM="jelly-fill",YM="notdog",ZM="notdog-duo",KM="slab",QM="slab-press",JM="thumbprint",$M="whiteboard",GJ="Classic",XJ="Duotone",YJ="Sharp",ZJ="Sharp Duotone",KJ="Chisel",QJ="Etch",JJ="Jelly",$J="Jelly Duo",e$="Jelly Fill",t$="Notdog",r$="Notdog Duo",n$="Slab",a$="Slab Press",s$="Thumbprint",o$="Whiteboard",eL=[ms,Nm,UM,qM,VM,HM,WM,GM,XM,YM,ZM,KM,QM,JM,$M];Iv={},bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(Iv,ms,GJ),Nm,XJ),UM,YJ),qM,ZJ),VM,KJ),HM,QJ),WM,JJ),GM,$J),XM,e$),YM,t$),bn(bn(bn(bn(bn(Iv,ZM,r$),KM,n$),QM,a$),JM,s$),$M,o$);var i$={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"}},l$={"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"}},c$=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}]]),u$={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"}},tL=["fak","fa-kit","fakd","fa-kit-duotone"],tP={kit:{fak:"kit","fa-kit":"kit"},"kit-duotone":{fakd:"kit-duotone","fa-kit-duotone":"kit-duotone"}},d$=["kit"],p$="kit",f$="kit-duotone",m$="Kit",h$="Kit Duotone";bn(bn({},p$,m$),f$,h$);var g$={kit:{"fa-kit":"fak"}},y$={"Font Awesome Kit":{400:"fak",normal:"fak"},"Font Awesome Kit Duotone":{400:"fakd",normal:"fakd"}},b$={kit:{fak:"fa-kit"}},rP={kit:{kit:"fak"},"kit-duotone":{"kit-duotone":"fakd"}},Nv,xh={GROUP:"duotone-group",SWAP_OPACITY:"swap-opacity",PRIMARY:"primary",SECONDARY:"secondary"},v$=["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"],_$="classic",w$="duotone",x$="sharp",A$="sharp-duotone",k$="chisel",S$="etch",E$="jelly",P$="jelly-duo",C$="jelly-fill",R$="notdog",T$="notdog-duo",j$="slab",I$="slab-press",N$="thumbprint",M$="whiteboard",L$="Classic",D$="Duotone",O$="Sharp",z$="Sharp Duotone",B$="Chisel",F$="Etch",U$="Jelly",q$="Jelly Duo",V$="Jelly Fill",H$="Notdog",W$="Notdog Duo",G$="Slab",X$="Slab Press",Y$="Thumbprint",Z$="Whiteboard";Nv={},bn(bn(bn(bn(bn(bn(bn(bn(bn(bn(Nv,_$,L$),w$,D$),x$,O$),A$,z$),k$,B$),S$,F$),E$,U$),P$,q$),C$,V$),R$,H$),bn(bn(bn(bn(bn(Nv,T$,W$),j$,G$),I$,X$),N$,Y$),M$,Z$);var K$="kit",Q$="kit-duotone",J$="Kit",$$="Kit Duotone";bn(bn({},K$,J$),Q$,$$);var eee={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"}},tee={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"]},G0={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"}},ree=["fa-solid","fa-regular","fa-light","fa-thin","fa-duotone","fa-brands","fa-semibold"],rL=["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(v$,ree),nee=["solid","regular","light","thin","duotone","brands","semibold"],nL=[1,2,3,4,5,6,7,8,9,10],aee=nL.concat([11,12,13,14,15,16,17,18,19,20]),see=["aw","fw","pull-left","pull-right"],oee=[].concat(qo(Object.keys(tee)),nee,see,["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",xh.GROUP,xh.SWAP_OPACITY,xh.PRIMARY,xh.SECONDARY]).concat(nL.map(function(e){return"".concat(e,"x")})).concat(aee.map(function(e){return"w-".concat(e)})),iee={"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"}},ol="___FONT_AWESOME___",X0=16,aL="fa",sL="svg-inline--fa",au="data-fa-i2svg",Y0="data-fa-pseudo-element",lee="data-fa-pseudo-element-pending",PA="data-prefix",CA="data-icon",nP="fontawesome-i2svg",cee="async",uee=["HTML","HEAD","STYLE","SCRIPT"],oL=["::before","::after",":before",":after"],iL=function(){try{return!0}catch{return!1}}();function Mm(e){return new Proxy(e,{get:function(r,n){return n in r?r[n]:r[ms]}})}var lL=Zt({},BM);lL[ms]=Zt(Zt(Zt(Zt({},{"fa-duotone":"duotone"}),BM[ms]),tP.kit),tP["kit-duotone"]);var dee=Mm(lL),Z0=Zt({},u$);Z0[ms]=Zt(Zt(Zt(Zt({},{duotone:"fad"}),Z0[ms]),rP.kit),rP["kit-duotone"]);var aP=Mm(Z0),K0=Zt({},G0);K0[ms]=Zt(Zt({},K0[ms]),b$.kit);var cL=Mm(K0),Q0=Zt({},eee);Q0[ms]=Zt(Zt({},Q0[ms]),g$.kit);Mm(Q0);var pee=VJ,uL="fa-layers-text",fee=HJ,mee=Zt({},i$);Mm(mee);var hee=["class","data-prefix","data-icon","data-fa-transform","data-fa-mask"],Mv=WJ,gee=[].concat(qo(d$),qo(oee)),If=Vl.FontAwesomeConfig||{};function yee(e){var t=Yn.querySelector("script["+e+"]");if(t)return t.getAttribute(e)}function bee(e){return e===""?!0:e==="false"?!1:e==="true"?!0:e}if(Yn&&typeof Yn.querySelector=="function"){var vee=[["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"]];vee.forEach(function(e){var t=Sb(e,2),r=t[0],n=t[1],s=bee(yee(r));s!=null&&(If[n]=s)})}var dL={styleDefault:"solid",familyDefault:ms,cssPrefix:aL,replacementClass:sL,autoReplaceSvg:!0,autoAddCss:!0,searchPseudoElements:!1,searchPseudoElementsWarnings:!0,searchPseudoElementsFullScan:!1,observeMutations:!0,mutateApproach:"async",keepOriginalSource:!0,measurePerformance:!1,showMissingIcons:!0};If.familyPrefix&&(If.cssPrefix=If.familyPrefix);var ap=Zt(Zt({},dL),If);ap.autoReplaceSvg||(ap.observeMutations=!1);var Rr={};Object.keys(dL).forEach(function(e){Object.defineProperty(Rr,e,{enumerable:!0,set:function(r){ap[e]=r,Nf.forEach(function(n){return n(Rr)})},get:function(){return ap[e]}})});Object.defineProperty(Rr,"familyPrefix",{enumerable:!0,set:function(t){ap.cssPrefix=t,Nf.forEach(function(r){return r(Rr)})},get:function(){return ap.cssPrefix}});Vl.FontAwesomeConfig=Rr;var Nf=[];function _ee(e){return Nf.push(e),function(){Nf.splice(Nf.indexOf(e),1)}}var Zu=X0,_i={size:16,x:0,y:0,rotate:0,flipX:!1,flipY:!1};function wee(e){if(!(!e||!dl)){var t=Yn.createElement("style");t.setAttribute("type","text/css"),t.innerHTML=e;for(var r=Yn.head.childNodes,n=null,s=r.length-1;s>-1;s--){var o=r[s],i=(o.tagName||"").toUpperCase();["STYLE","LINK"].indexOf(i)>-1&&(n=o)}return Yn.head.insertBefore(t,n),e}}var xee="0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";function sP(){for(var e=12,t="";e-- >0;)t+=xee[Math.random()*62|0];return t}function Ep(e){for(var t=[],r=(e||[]).length>>>0;r--;)t[r]=e[r];return t}function RA(e){return e.classList?Ep(e.classList):(e.getAttribute("class")||"").split(" ").filter(function(t){return t})}function pL(e){return"".concat(e).replace(/&/g,"&amp;").replace(/"/g,"&quot;").replace(/'/g,"&#39;").replace(/</g,"&lt;").replace(/>/g,"&gt;")}function Aee(e){return Object.keys(e||{}).reduce(function(t,r){return t+"".concat(r,'="').concat(pL(e[r]),'" ')},"").trim()}function Eb(e){return Object.keys(e||{}).reduce(function(t,r){return t+"".concat(r,": ").concat(e[r].trim(),";")},"")}function TA(e){return e.size!==_i.size||e.x!==_i.x||e.y!==_i.y||e.rotate!==_i.rotate||e.flipX||e.flipY}function kee(e){var t=e.transform,r=e.containerWidth,n=e.iconWidth,s={transform:"translate(".concat(r/2," 256)")},o="translate(".concat(t.x*32,", ").concat(t.y*32,") "),i="scale(".concat(t.size/16*(t.flipX?-1:1),", ").concat(t.size/16*(t.flipY?-1:1),") "),c="rotate(".concat(t.rotate," 0 0)"),u={transform:"".concat(o," ").concat(i," ").concat(c)},p={transform:"translate(".concat(n/2*-1," -256)")};return{outer:s,inner:u,path:p}}function See(e){var t=e.transform,r=e.width,n=r===void 0?X0:r,s=e.height,o=s===void 0?X0:s,i="";return zM?i+="translate(".concat(t.x/Zu-n/2,"em, ").concat(t.y/Zu-o/2,"em) "):i+="translate(calc(-50% + ".concat(t.x/Zu,"em), calc(-50% + ").concat(t.y/Zu,"em)) "),i+="scale(".concat(t.size/Zu*(t.flipX?-1:1),", ").concat(t.size/Zu*(t.flipY?-1:1),") "),i+="rotate(".concat(t.rotate,"deg) "),i}var Eee=`: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 fL(){var e=aL,t=sL,r=Rr.cssPrefix,n=Rr.replacementClass,s=Eee;if(r!==e||n!==t){var o=new RegExp("\\.".concat(e,"\\-"),"g"),i=new RegExp("\\--".concat(e,"\\-"),"g"),c=new RegExp("\\.".concat(t),"g");s=s.replace(o,".".concat(r,"-")).replace(i,"--".concat(r,"-")).replace(c,".".concat(n))}return s}var oP=!1;function Lv(){Rr.autoAddCss&&!oP&&(wee(fL()),oP=!0)}var Pee={mixout:function(){return{dom:{css:fL,insertCss:Lv}}},hooks:function(){return{beforeDOMElementCreation:function(){Lv()},beforeI2svg:function(){Lv()}}}},il=Vl||{};il[ol]||(il[ol]={});il[ol].styles||(il[ol].styles={});il[ol].hooks||(il[ol].hooks={});il[ol].shims||(il[ol].shims=[]);var Oo=il[ol],mL=[],hL=function(){Yn.removeEventListener("DOMContentLoaded",hL),vy=1,mL.map(function(t){return t()})},vy=!1;dl&&(vy=(Yn.documentElement.doScroll?/^loaded|^c/:/^loaded|^i|^c/).test(Yn.readyState),vy||Yn.addEventListener("DOMContentLoaded",hL));function Cee(e){dl&&(vy?setTimeout(e,0):mL.push(e))}function Lm(e){var t=e.tag,r=e.attributes,n=r===void 0?{}:r,s=e.children,o=s===void 0?[]:s;return typeof e=="string"?pL(e):"<".concat(t," ").concat(Aee(n),">").concat(o.map(Lm).join(""),"</").concat(t,">")}function iP(e,t,r){if(e&&e[t]&&e[t][r])return{prefix:t,iconName:r,icon:e[t][r]}}var Dv=function(t,r,n,s){var o=Object.keys(t),i=o.length,c=r,u,p,d;for(n===void 0?(u=1,d=t[o[0]]):(u=0,d=n);u<i;u++)p=o[u],d=c(d,t[p],p,t);return d};function gL(e){return qo(e).length!==1?null:e.codePointAt(0).toString(16)}function lP(e){return Object.keys(e).reduce(function(t,r){var n=e[r],s=!!n.icon;return s?t[n.iconName]=n.icon:t[r]=n,t},{})}function yL(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{},n=r.skipHooks,s=n===void 0?!1:n,o=lP(t);typeof Oo.hooks.addPack=="function"&&!s?Oo.hooks.addPack(e,lP(t)):Oo.styles[e]=Zt(Zt({},Oo.styles[e]||{}),o),e==="fas"&&yL("fa",t)}var om=Oo.styles,Ree=Oo.shims,bL=Object.keys(cL),Tee=bL.reduce(function(e,t){return e[t]=Object.keys(cL[t]),e},{}),jA=null,vL={},_L={},wL={},xL={},AL={};function jee(e){return~gee.indexOf(e)}function Iee(e,t){var r=t.split("-"),n=r[0],s=r.slice(1).join("-");return n===e&&s!==""&&!jee(s)?s:null}var kL=function(){var t=function(o){return Dv(om,function(i,c,u){return i[u]=Dv(c,o,{}),i},{})};vL=t(function(s,o,i){if(o[3]&&(s[o[3]]=i),o[2]){var c=o[2].filter(function(u){return typeof u=="number"});c.forEach(function(u){s[u.toString(16)]=i})}return s}),_L=t(function(s,o,i){if(s[i]=i,o[2]){var c=o[2].filter(function(u){return typeof u=="string"});c.forEach(function(u){s[u]=i})}return s}),AL=t(function(s,o,i){var c=o[2];return s[i]=i,c.forEach(function(u){s[u]=i}),s});var r="far"in om||Rr.autoFetchSvg,n=Dv(Ree,function(s,o){var i=o[0],c=o[1],u=o[2];return c==="far"&&!r&&(c="fas"),typeof i=="string"&&(s.names[i]={prefix:c,iconName:u}),typeof i=="number"&&(s.unicodes[i.toString(16)]={prefix:c,iconName:u}),s},{names:{},unicodes:{}});wL=n.names,xL=n.unicodes,jA=Pb(Rr.styleDefault,{family:Rr.familyDefault})};_ee(function(e){jA=Pb(e.styleDefault,{family:Rr.familyDefault})});kL();function IA(e,t){return(vL[e]||{})[t]}function Nee(e,t){return(_L[e]||{})[t]}function Dc(e,t){return(AL[e]||{})[t]}function SL(e){return wL[e]||{prefix:null,iconName:null}}function Mee(e){var t=xL[e],r=IA("fas",e);return t||(r?{prefix:"fas",iconName:r}:null)||{prefix:null,iconName:null}}function Hl(){return jA}var EL=function(){return{prefix:null,iconName:null,rest:[]}};function Lee(e){var t=ms,r=bL.reduce(function(n,s){return n[s]="".concat(Rr.cssPrefix,"-").concat(s),n},{});return eL.forEach(function(n){(e.includes(r[n])||e.some(function(s){return Tee[n].includes(s)}))&&(t=n)}),t}function Pb(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.family,n=r===void 0?ms:r,s=dee[n][e];if(n===Nm&&!e)return"fad";var o=aP[n][e]||aP[n][s],i=e in Oo.styles?e:null,c=o||i||null;return c}function Dee(e){var t=[],r=null;return e.forEach(function(n){var s=Iee(Rr.cssPrefix,n);s?r=s:n&&t.push(n)}),{iconName:r,rest:t}}function cP(e){return e.sort().filter(function(t,r,n){return n.indexOf(t)===r})}var uP=rL.concat(tL);function Cb(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.skipLookups,n=r===void 0?!1:r,s=null,o=cP(e.filter(function(h){return uP.includes(h)})),i=cP(e.filter(function(h){return!uP.includes(h)})),c=o.filter(function(h){return s=h,!FM.includes(h)}),u=Sb(c,1),p=u[0],d=p===void 0?null:p,f=Lee(o),m=Zt(Zt({},Dee(i)),{},{prefix:Pb(d,{family:f})});return Zt(Zt(Zt({},m),Fee({values:e,family:f,styles:om,config:Rr,canonical:m,givenPrefix:s})),Oee(n,s,m))}function Oee(e,t,r){var n=r.prefix,s=r.iconName;if(e||!n||!s)return{prefix:n,iconName:s};var o=t==="fa"?SL(s):{},i=Dc(n,s);return s=o.iconName||i||s,n=o.prefix||n,n==="far"&&!om.far&&om.fas&&!Rr.autoFetchSvg&&(n="fas"),{prefix:n,iconName:s}}var zee=eL.filter(function(e){return e!==ms||e!==Nm}),Bee=Object.keys(G0).filter(function(e){return e!==ms}).map(function(e){return Object.keys(G0[e])}).flat();function Fee(e){var t=e.values,r=e.family,n=e.canonical,s=e.givenPrefix,o=s===void 0?"":s,i=e.styles,c=i===void 0?{}:i,u=e.config,p=u===void 0?{}:u,d=r===Nm,f=t.includes("fa-duotone")||t.includes("fad"),m=p.familyDefault==="duotone",h=n.prefix==="fad"||n.prefix==="fa-duotone";if(!d&&(f||m||h)&&(n.prefix="fad"),(t.includes("fa-brands")||t.includes("fab"))&&(n.prefix="fab"),!n.prefix&&zee.includes(r)){var b=Object.keys(c).find(function(y){return Bee.includes(y)});if(b||p.autoFetchSvg){var g=c$.get(r).defaultShortPrefixId;n.prefix=g,n.iconName=Dc(n.prefix,n.iconName)||n.iconName}}return(n.prefix==="fa"||o==="fa")&&(n.prefix=Hl()||"fas"),n}var Uee=function(){function e(){MJ(this,e),this.definitions={}}return DJ(e,[{key:"add",value:function(){for(var r=this,n=arguments.length,s=new Array(n),o=0;o<n;o++)s[o]=arguments[o];var i=s.reduce(this._pullDefinitions,{});Object.keys(i).forEach(function(c){r.definitions[c]=Zt(Zt({},r.definitions[c]||{}),i[c]),yL(c,i[c]),kL()})}},{key:"reset",value:function(){this.definitions={}}},{key:"_pullDefinitions",value:function(r,n){var s=n.prefix&&n.iconName&&n.icon?{0:n}:n;return Object.keys(s).map(function(o){var i=s[o],c=i.prefix,u=i.iconName,p=i.icon,d=p[2];r[c]||(r[c]={}),d.length>0&&d.forEach(function(f){typeof f=="string"&&(r[c][f]=p)}),r[c][u]=p}),r}}])}(),dP=[],md={},Id={},qee=Object.keys(Id);function Vee(e,t){var r=t.mixoutsTo;return dP=e,md={},Object.keys(Id).forEach(function(n){qee.indexOf(n)===-1&&delete Id[n]}),dP.forEach(function(n){var s=n.mixout?n.mixout():{};if(Object.keys(s).forEach(function(i){typeof s[i]=="function"&&(r[i]=s[i]),by(s[i])==="object"&&Object.keys(s[i]).forEach(function(c){r[i]||(r[i]={}),r[i][c]=s[i][c]})}),n.hooks){var o=n.hooks();Object.keys(o).forEach(function(i){md[i]||(md[i]=[]),md[i].push(o[i])})}n.provides&&n.provides(Id)}),r}function J0(e,t){for(var r=arguments.length,n=new Array(r>2?r-2:0),s=2;s<r;s++)n[s-2]=arguments[s];var o=md[e]||[];return o.forEach(function(i){t=i.apply(null,[t].concat(n))}),t}function su(e){for(var t=arguments.length,r=new Array(t>1?t-1:0),n=1;n<t;n++)r[n-1]=arguments[n];var s=md[e]||[];s.forEach(function(o){o.apply(null,r)})}function Wl(){var e=arguments[0],t=Array.prototype.slice.call(arguments,1);return Id[e]?Id[e].apply(null,t):void 0}function $0(e){e.prefix==="fa"&&(e.prefix="fas");var t=e.iconName,r=e.prefix||Hl();if(t)return t=Dc(r,t)||t,iP(PL.definitions,r,t)||iP(Oo.styles,r,t)}var PL=new Uee,Hee=function(){Rr.autoReplaceSvg=!1,Rr.observeMutations=!1,su("noAuto")},Wee={i2svg:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{};return dl?(su("beforeI2svg",t),Wl("pseudoElements2svg",t),Wl("i2svg",t)):Promise.reject(new Error("Operation requires a DOM of some kind."))},watch:function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.autoReplaceSvgRoot;Rr.autoReplaceSvg===!1&&(Rr.autoReplaceSvg=!0),Rr.observeMutations=!0,Cee(function(){Xee({autoReplaceSvgRoot:r}),su("watch",t)})}},Gee={icon:function(t){if(t===null)return null;if(by(t)==="object"&&t.prefix&&t.iconName)return{prefix:t.prefix,iconName:Dc(t.prefix,t.iconName)||t.iconName};if(Array.isArray(t)&&t.length===2){var r=t[1].indexOf("fa-")===0?t[1].slice(3):t[1],n=Pb(t[0]);return{prefix:n,iconName:Dc(n,r)||r}}if(typeof t=="string"&&(t.indexOf("".concat(Rr.cssPrefix,"-"))>-1||t.match(pee))){var s=Cb(t.split(" "),{skipLookups:!0});return{prefix:s.prefix||Hl(),iconName:Dc(s.prefix,s.iconName)||s.iconName}}if(typeof t=="string"){var o=Hl();return{prefix:o,iconName:Dc(o,t)||t}}}},Js={noAuto:Hee,config:Rr,dom:Wee,parse:Gee,library:PL,findIconDefinition:$0,toHtml:Lm},Xee=function(){var t=arguments.length>0&&arguments[0]!==void 0?arguments[0]:{},r=t.autoReplaceSvgRoot,n=r===void 0?Yn:r;(Object.keys(Oo.styles).length>0||Rr.autoFetchSvg)&&dl&&Rr.autoReplaceSvg&&Js.dom.i2svg({node:n})};function Rb(e,t){return Object.defineProperty(e,"abstract",{get:t}),Object.defineProperty(e,"html",{get:function(){return e.abstract.map(function(n){return Lm(n)})}}),Object.defineProperty(e,"node",{get:function(){if(dl){var n=Yn.createElement("div");return n.innerHTML=e.html,n.children}}}),e}function Yee(e){var t=e.children,r=e.main,n=e.mask,s=e.attributes,o=e.styles,i=e.transform;if(TA(i)&&r.found&&!n.found){var c=r.width,u=r.height,p={x:c/u/2,y:.5};s.style=Eb(Zt(Zt({},o),{},{"transform-origin":"".concat(p.x+i.x/16,"em ").concat(p.y+i.y/16,"em")}))}return[{tag:"svg",attributes:s,children:t}]}function Zee(e){var t=e.prefix,r=e.iconName,n=e.children,s=e.attributes,o=e.symbol,i=o===!0?"".concat(t,"-").concat(Rr.cssPrefix,"-").concat(r):o;return[{tag:"svg",attributes:{style:"display: none;"},children:[{tag:"symbol",attributes:Zt(Zt({},s),{},{id:i}),children:n}]}]}function Kee(e){var t=["aria-label","aria-labelledby","title","role"];return t.some(function(r){return r in e})}function NA(e){var t=e.icons,r=t.main,n=t.mask,s=e.prefix,o=e.iconName,i=e.transform,c=e.symbol,u=e.maskId,p=e.extra,d=e.watchable,f=d===void 0?!1:d,m=n.found?n:r,h=m.width,b=m.height,g=[Rr.replacementClass,o?"".concat(Rr.cssPrefix,"-").concat(o):""].filter(function(w){return p.classes.indexOf(w)===-1}).filter(function(w){return w!==""||!!w}).concat(p.classes).join(" "),y={children:[],attributes:Zt(Zt({},p.attributes),{},{"data-prefix":s,"data-icon":o,class:g,role:p.attributes.role||"img",viewBox:"0 0 ".concat(h," ").concat(b)})};!Kee(p.attributes)&&!p.attributes["aria-hidden"]&&(y.attributes["aria-hidden"]="true"),f&&(y.attributes[au]="");var x=Zt(Zt({},y),{},{prefix:s,iconName:o,main:r,mask:n,maskId:u,transform:i,symbol:c,styles:Zt({},p.styles)}),v=n.found&&r.found?Wl("generateAbstractMask",x)||{children:[],attributes:{}}:Wl("generateAbstractIcon",x)||{children:[],attributes:{}},A=v.children,_=v.attributes;return x.children=A,x.attributes=_,c?Zee(x):Yee(x)}function pP(e){var t=e.content,r=e.width,n=e.height,s=e.transform,o=e.extra,i=e.watchable,c=i===void 0?!1:i,u=Zt(Zt({},o.attributes),{},{class:o.classes.join(" ")});c&&(u[au]="");var p=Zt({},o.styles);TA(s)&&(p.transform=See({transform:s,width:r,height:n}),p["-webkit-transform"]=p.transform);var d=Eb(p);d.length>0&&(u.style=d);var f=[];return f.push({tag:"span",attributes:u,children:[t]}),f}function Qee(e){var t=e.content,r=e.extra,n=Zt(Zt({},r.attributes),{},{class:r.classes.join(" ")}),s=Eb(r.styles);s.length>0&&(n.style=s);var o=[];return o.push({tag:"span",attributes:n,children:[t]}),o}var Ov=Oo.styles;function ew(e){var t=e[0],r=e[1],n=e.slice(4),s=Sb(n,1),o=s[0],i=null;return Array.isArray(o)?i={tag:"g",attributes:{class:"".concat(Rr.cssPrefix,"-").concat(Mv.GROUP)},children:[{tag:"path",attributes:{class:"".concat(Rr.cssPrefix,"-").concat(Mv.SECONDARY),fill:"currentColor",d:o[0]}},{tag:"path",attributes:{class:"".concat(Rr.cssPrefix,"-").concat(Mv.PRIMARY),fill:"currentColor",d:o[1]}}]}:i={tag:"path",attributes:{fill:"currentColor",d:o}},{found:!0,width:t,height:r,icon:i}}var Jee={found:!1,width:512,height:512};function $ee(e,t){!iL&&!Rr.showMissingIcons&&e&&console.error('Icon with name "'.concat(e,'" and prefix "').concat(t,'" is missing.'))}function tw(e,t){var r=t;return t==="fa"&&Rr.styleDefault!==null&&(t=Hl()),new Promise(function(n,s){if(r==="fa"){var o=SL(e)||{};e=o.iconName||e,t=o.prefix||t}if(e&&t&&Ov[t]&&Ov[t][e]){var i=Ov[t][e];return n(ew(i))}$ee(e,t),n(Zt(Zt({},Jee),{},{icon:Rr.showMissingIcons&&e?Wl("missingIconAbstract")||{}:{}}))})}var fP=function(){},rw=Rr.measurePerformance&&wh&&wh.mark&&wh.measure?wh:{mark:fP,measure:fP},uf='FA "7.0.0"',ete=function(t){return rw.mark("".concat(uf," ").concat(t," begins")),function(){return CL(t)}},CL=function(t){rw.mark("".concat(uf," ").concat(t," ends")),rw.measure("".concat(uf," ").concat(t),"".concat(uf," ").concat(t," begins"),"".concat(uf," ").concat(t," ends"))},MA={begin:ete,end:CL},Rg=function(){};function mP(e){var t=e.getAttribute?e.getAttribute(au):null;return typeof t=="string"}function tte(e){var t=e.getAttribute?e.getAttribute(PA):null,r=e.getAttribute?e.getAttribute(CA):null;return t&&r}function rte(e){return e&&e.classList&&e.classList.contains&&e.classList.contains(Rr.replacementClass)}function nte(){if(Rr.autoReplaceSvg===!0)return Tg.replace;var e=Tg[Rr.autoReplaceSvg];return e||Tg.replace}function ate(e){return Yn.createElementNS("http://www.w3.org/2000/svg",e)}function ste(e){return Yn.createElement(e)}function RL(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},r=t.ceFn,n=r===void 0?e.tag==="svg"?ate:ste:r;if(typeof e=="string")return Yn.createTextNode(e);var s=n(e.tag);Object.keys(e.attributes||[]).forEach(function(i){s.setAttribute(i,e.attributes[i])});var o=e.children||[];return o.forEach(function(i){s.appendChild(RL(i,{ceFn:n}))}),s}function ote(e){var t=" ".concat(e.outerHTML," ");return t="".concat(t,"Font Awesome fontawesome.com "),t}var Tg={replace:function(t){var r=t[0];if(r.parentNode)if(t[1].forEach(function(s){r.parentNode.insertBefore(RL(s),r)}),r.getAttribute(au)===null&&Rr.keepOriginalSource){var n=Yn.createComment(ote(r));r.parentNode.replaceChild(n,r)}else r.remove()},nest:function(t){var r=t[0],n=t[1];if(~RA(r).indexOf(Rr.replacementClass))return Tg.replace(t);var s=new RegExp("".concat(Rr.cssPrefix,"-.*"));if(delete n[0].attributes.id,n[0].attributes.class){var o=n[0].attributes.class.split(" ").reduce(function(c,u){return u===Rr.replacementClass||u.match(s)?c.toSvg.push(u):c.toNode.push(u),c},{toNode:[],toSvg:[]});n[0].attributes.class=o.toSvg.join(" "),o.toNode.length===0?r.removeAttribute("class"):r.setAttribute("class",o.toNode.join(" "))}var i=n.map(function(c){return Lm(c)}).join(`
`);r.setAttribute(au,""),r.innerHTML=i}};function hP(e){e()}function TL(e,t){var r=typeof t=="function"?t:Rg;if(e.length===0)r();else{var n=hP;Rr.mutateApproach===cee&&(n=Vl.requestAnimationFrame||hP),n(function(){var s=nte(),o=MA.begin("mutate");e.map(s),o(),r()})}}var LA=!1;function jL(){LA=!0}function nw(){LA=!1}var _y=null;function gP(e){if(eP&&Rr.observeMutations){var t=e.treeCallback,r=t===void 0?Rg:t,n=e.nodeCallback,s=n===void 0?Rg:n,o=e.pseudoElementsCallback,i=o===void 0?Rg:o,c=e.observeMutationsRoot,u=c===void 0?Yn:c;_y=new eP(function(p){if(!LA){var d=Hl();Ep(p).forEach(function(f){if(f.type==="childList"&&f.addedNodes.length>0&&!mP(f.addedNodes[0])&&(Rr.searchPseudoElements&&i(f.target),r(f.target)),f.type==="attributes"&&f.target.parentNode&&Rr.searchPseudoElements&&i([f.target],!0),f.type==="attributes"&&mP(f.target)&&~hee.indexOf(f.attributeName))if(f.attributeName==="class"&&tte(f.target)){var m=Cb(RA(f.target)),h=m.prefix,b=m.iconName;f.target.setAttribute(PA,h||d),b&&f.target.setAttribute(CA,b)}else rte(f.target)&&s(f.target)})}}),dl&&_y.observe(u,{childList:!0,attributes:!0,characterData:!0,subtree:!0})}}function ite(){_y&&_y.disconnect()}function lte(e){var t=e.getAttribute("style"),r=[];return t&&(r=t.split(";").reduce(function(n,s){var o=s.split(":"),i=o[0],c=o.slice(1);return i&&c.length>0&&(n[i]=c.join(":").trim()),n},{})),r}function cte(e){var t=e.getAttribute("data-prefix"),r=e.getAttribute("data-icon"),n=e.innerText!==void 0?e.innerText.trim():"",s=Cb(RA(e));return s.prefix||(s.prefix=Hl()),t&&r&&(s.prefix=t,s.iconName=r),s.iconName&&s.prefix||(s.prefix&&n.length>0&&(s.iconName=Nee(s.prefix,e.innerText)||IA(s.prefix,gL(e.innerText))),!s.iconName&&Rr.autoFetchSvg&&e.firstChild&&e.firstChild.nodeType===Node.TEXT_NODE&&(s.iconName=e.firstChild.data)),s}function ute(e){var t=Ep(e.attributes).reduce(function(r,n){return r.name!=="class"&&r.name!=="style"&&(r[n.name]=n.value),r},{});return t}function dte(){return{iconName:null,prefix:null,transform:_i,symbol:!1,mask:{iconName:null,prefix:null,rest:[]},maskId:null,extra:{classes:[],styles:{},attributes:{}}}}function yP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{styleParser:!0},r=cte(e),n=r.iconName,s=r.prefix,o=r.rest,i=ute(e),c=J0("parseNodeAttributes",{},e),u=t.styleParser?lte(e):[];return Zt({iconName:n,prefix:s,transform:_i,mask:{iconName:null,prefix:null,rest:[]},maskId:null,symbol:!1,extra:{classes:o,styles:u,attributes:i}},c)}var pte=Oo.styles;function IL(e){var t=Rr.autoReplaceSvg==="nest"?yP(e,{styleParser:!1}):yP(e);return~t.extra.classes.indexOf(uL)?Wl("generateLayersText",e,t):Wl("generateSvgReplacementMutation",e,t)}function fte(){return[].concat(qo(tL),qo(rL))}function bP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;if(!dl)return Promise.resolve();var r=Yn.documentElement.classList,n=function(f){return r.add("".concat(nP,"-").concat(f))},s=function(f){return r.remove("".concat(nP,"-").concat(f))},o=Rr.autoFetchSvg?fte():FM.concat(Object.keys(pte));o.includes("fa")||o.push("fa");var i=[".".concat(uL,":not([").concat(au,"])")].concat(o.map(function(d){return".".concat(d,":not([").concat(au,"])")})).join(", ");if(i.length===0)return Promise.resolve();var c=[];try{c=Ep(e.querySelectorAll(i))}catch{}if(c.length>0)n("pending"),s("complete");else return Promise.resolve();var u=MA.begin("onTree"),p=c.reduce(function(d,f){try{var m=IL(f);m&&d.push(m)}catch(h){iL||h.name==="MissingIcon"&&console.error(h)}return d},[]);return new Promise(function(d,f){Promise.all(p).then(function(m){TL(m,function(){n("active"),n("complete"),s("pending"),typeof t=="function"&&t(),u(),d()})}).catch(function(m){u(),f(m)})})}function mte(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:null;IL(e).then(function(r){r&&TL([r],t)})}function hte(e){return function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=(t||{}).icon?t:$0(t||{}),s=r.mask;return s&&(s=(s||{}).icon?s:$0(s||{})),e(n,Zt(Zt({},r),{},{mask:s}))}}var gte=function(t){var r=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},n=r.transform,s=n===void 0?_i:n,o=r.symbol,i=o===void 0?!1:o,c=r.mask,u=c===void 0?null:c,p=r.maskId,d=p===void 0?null:p,f=r.classes,m=f===void 0?[]:f,h=r.attributes,b=h===void 0?{}:h,g=r.styles,y=g===void 0?{}:g;if(t){var x=t.prefix,v=t.iconName,A=t.icon;return Rb(Zt({type:"icon"},t),function(){return su("beforeDOMElementCreation",{iconDefinition:t,params:r}),NA({icons:{main:ew(A),mask:u?ew(u.icon):{found:!1,width:null,height:null,icon:{}}},prefix:x,iconName:v,transform:Zt(Zt({},_i),s),symbol:i,maskId:d,extra:{attributes:b,styles:y,classes:m}})})}},yte={mixout:function(){return{icon:hte(gte)}},hooks:function(){return{mutationObserverCallbacks:function(r){return r.treeCallback=bP,r.nodeCallback=mte,r}}},provides:function(t){t.i2svg=function(r){var n=r.node,s=n===void 0?Yn:n,o=r.callback,i=o===void 0?function(){}:o;return bP(s,i)},t.generateSvgReplacementMutation=function(r,n){var s=n.iconName,o=n.prefix,i=n.transform,c=n.symbol,u=n.mask,p=n.maskId,d=n.extra;return new Promise(function(f,m){Promise.all([tw(s,o),u.iconName?tw(u.iconName,u.prefix):Promise.resolve({found:!1,width:512,height:512,icon:{}})]).then(function(h){var b=Sb(h,2),g=b[0],y=b[1];f([r,NA({icons:{main:g,mask:y},prefix:o,iconName:s,transform:i,symbol:c,maskId:p,extra:d,watchable:!0})])}).catch(m)})},t.generateAbstractIcon=function(r){var n=r.children,s=r.attributes,o=r.main,i=r.transform,c=r.styles,u=Eb(c);u.length>0&&(s.style=u);var p;return TA(i)&&(p=Wl("generateAbstractTransformGrouping",{main:o,transform:i,containerWidth:o.width,iconWidth:o.width})),n.push(p||o.icon),{children:n,attributes:s}}}},bte={mixout:function(){return{layer:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.classes,o=s===void 0?[]:s;return Rb({type:"layer"},function(){su("beforeDOMElementCreation",{assembler:r,params:n});var i=[];return r(function(c){Array.isArray(c)?c.map(function(u){i=i.concat(u.abstract)}):i=i.concat(c.abstract)}),[{tag:"span",attributes:{class:["".concat(Rr.cssPrefix,"-layers")].concat(qo(o)).join(" ")},children:i}]})}}}},vte={mixout:function(){return{counter:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{};n.title;var s=n.classes,o=s===void 0?[]:s,i=n.attributes,c=i===void 0?{}:i,u=n.styles,p=u===void 0?{}:u;return Rb({type:"counter",content:r},function(){return su("beforeDOMElementCreation",{content:r,params:n}),Qee({content:r.toString(),extra:{attributes:c,styles:p,classes:["".concat(Rr.cssPrefix,"-layers-counter")].concat(qo(o))}})})}}}},_te={mixout:function(){return{text:function(r){var n=arguments.length>1&&arguments[1]!==void 0?arguments[1]:{},s=n.transform,o=s===void 0?_i:s,i=n.classes,c=i===void 0?[]:i,u=n.attributes,p=u===void 0?{}:u,d=n.styles,f=d===void 0?{}:d;return Rb({type:"text",content:r},function(){return su("beforeDOMElementCreation",{content:r,params:n}),pP({content:r,transform:Zt(Zt({},_i),o),extra:{attributes:p,styles:f,classes:["".concat(Rr.cssPrefix,"-layers-text")].concat(qo(c))}})})}}},provides:function(t){t.generateLayersText=function(r,n){var s=n.transform,o=n.extra,i=null,c=null;if(zM){var u=parseInt(getComputedStyle(r).fontSize,10),p=r.getBoundingClientRect();i=p.width/u,c=p.height/u}return Promise.resolve([r,pP({content:r.innerHTML,width:i,height:c,transform:s,extra:o,watchable:!0})])}}},NL=new RegExp('"',"ug"),vP=[1105920,1112319],_P=Zt(Zt(Zt(Zt({},{FontAwesome:{normal:"fas",400:"fas"}}),l$),iee),y$),aw=Object.keys(_P).reduce(function(e,t){return e[t.toLowerCase()]=_P[t],e},{}),wte=Object.keys(aw).reduce(function(e,t){var r=aw[t];return e[t]=r[900]||qo(Object.entries(r))[0][1],e},{});function xte(e){var t=e.replace(NL,"");return gL(qo(t)[0]||"")}function Ate(e){var t=e.getPropertyValue("font-feature-settings").includes("ss01"),r=e.getPropertyValue("content"),n=r.replace(NL,""),s=n.codePointAt(0),o=s>=vP[0]&&s<=vP[1],i=n.length===2?n[0]===n[1]:!1;return o||i||t}function kte(e,t){var r=e.replace(/^['"]|['"]$/g,"").toLowerCase(),n=parseInt(t),s=isNaN(n)?"normal":n;return(aw[r]||{})[s]||wte[r]}function wP(e,t){var r="".concat(lee).concat(t.replace(":","-"));return new Promise(function(n,s){if(e.getAttribute(r)!==null)return n();var o=Ep(e.children),i=o.filter(function(j){return j.getAttribute(Y0)===t})[0],c=Vl.getComputedStyle(e,t),u=c.getPropertyValue("font-family"),p=u.match(fee),d=c.getPropertyValue("font-weight"),f=c.getPropertyValue("content");if(i&&!p)return e.removeChild(i),n();if(p&&f!=="none"&&f!==""){var m=c.getPropertyValue("content"),h=kte(u,d),b=xte(m),g=p[0].startsWith("FontAwesome"),y=Ate(c),x=IA(h,b),v=x;if(g){var A=Mee(b);A.iconName&&A.prefix&&(x=A.iconName,h=A.prefix)}if(x&&!y&&(!i||i.getAttribute(PA)!==h||i.getAttribute(CA)!==v)){e.setAttribute(r,v),i&&e.removeChild(i);var _=dte(),w=_.extra;w.attributes[Y0]=t,tw(x,h).then(function(j){var T=NA(Zt(Zt({},_),{},{icons:{main:j,mask:EL()},prefix:h,iconName:v,extra:w,watchable:!0})),R=Yn.createElementNS("http://www.w3.org/2000/svg","svg");t==="::before"?e.insertBefore(R,e.firstChild):e.appendChild(R),R.outerHTML=T.map(function(P){return Lm(P)}).join(`
`),e.removeAttribute(r),n()}).catch(s)}else n()}else n()})}function Ste(e){return Promise.all([wP(e,"::before"),wP(e,"::after")])}function Ete(e){return e.parentNode!==document.head&&!~uee.indexOf(e.tagName.toUpperCase())&&!e.getAttribute(Y0)&&(!e.parentNode||e.parentNode.tagName!=="svg")}var Pte=function(t){return!!t&&oL.some(function(r){return t.includes(r)})},Cte=function(t){if(!t)return[];for(var r=new Set,n=[t],s=[/(?=\s:)/,new RegExp("(?<=\\)\\)?[^,]*,)")],o=function(){var h=c[i];n=n.flatMap(function(b){return b.split(h).map(function(g){return g.replace(/,\s*$/,"").trim()})})},i=0,c=s;i<c.length;i++)o();n=n.flatMap(function(m){return m.includes("(")?m:m.split(",").map(function(h){return h.trim()})});var u=Cg(n),p;try{for(u.s();!(p=u.n()).done;){var d=p.value;if(Pte(d)){var f=oL.reduce(function(m,h){return m.replace(h,"")},d);f!==""&&f!=="*"&&r.add(f)}}}catch(m){u.e(m)}finally{u.f()}return r};function xP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1;if(dl){var r;if(t)r=e;else if(Rr.searchPseudoElementsFullScan)r=e.querySelectorAll("*");else{var n=new Set,s=Cg(document.styleSheets),o;try{for(s.s();!(o=s.n()).done;){var i=o.value;try{var c=Cg(i.cssRules),u;try{for(c.s();!(u=c.n()).done;){var p=u.value,d=Cte(p.selectorText),f=Cg(d),m;try{for(f.s();!(m=f.n()).done;){var h=m.value;n.add(h)}}catch(g){f.e(g)}finally{f.f()}}}catch(g){c.e(g)}finally{c.f()}}catch(g){Rr.searchPseudoElementsWarnings&&console.warn("Font Awesome: cannot parse stylesheet: ".concat(i.href," (").concat(g.message,`)
If it declares any Font Awesome CSS pseudo-elements, they will not be rendered as SVG icons. Add crossorigin="anonymous" to the <link>, enable searchPseudoElementsFullScan for slower but more thorough DOM parsing, or suppress this warning by setting searchPseudoElementsWarnings to false.`))}}}catch(g){s.e(g)}finally{s.f()}if(!n.size)return;var b=Array.from(n).join(", ");try{r=e.querySelectorAll(b)}catch{}}return new Promise(function(g,y){var x=Ep(r).filter(Ete).map(Ste),v=MA.begin("searchPseudoElements");jL(),Promise.all(x).then(function(){v(),nw(),g()}).catch(function(){v(),nw(),y()})})}}var Rte={hooks:function(){return{mutationObserverCallbacks:function(r){return r.pseudoElementsCallback=xP,r}}},provides:function(t){t.pseudoElements2svg=function(r){var n=r.node,s=n===void 0?Yn:n;Rr.searchPseudoElements&&xP(s)}}},AP=!1,Tte={mixout:function(){return{dom:{unwatch:function(){jL(),AP=!0}}}},hooks:function(){return{bootstrap:function(){gP(J0("mutationObserverCallbacks",{}))},noAuto:function(){ite()},watch:function(r){var n=r.observeMutationsRoot;AP?nw():gP(J0("mutationObserverCallbacks",{observeMutationsRoot:n}))}}}},kP=function(t){var r={size:16,x:0,y:0,flipX:!1,flipY:!1,rotate:0};return t.toLowerCase().split(" ").reduce(function(n,s){var o=s.toLowerCase().split("-"),i=o[0],c=o.slice(1).join("-");if(i&&c==="h")return n.flipX=!0,n;if(i&&c==="v")return n.flipY=!0,n;if(c=parseFloat(c),isNaN(c))return n;switch(i){case"grow":n.size=n.size+c;break;case"shrink":n.size=n.size-c;break;case"left":n.x=n.x-c;break;case"right":n.x=n.x+c;break;case"up":n.y=n.y-c;break;case"down":n.y=n.y+c;break;case"rotate":n.rotate=n.rotate+c;break}return n},r)},jte={mixout:function(){return{parse:{transform:function(r){return kP(r)}}}},hooks:function(){return{parseNodeAttributes:function(r,n){var s=n.getAttribute("data-fa-transform");return s&&(r.transform=kP(s)),r}}},provides:function(t){t.generateAbstractTransformGrouping=function(r){var n=r.main,s=r.transform,o=r.containerWidth,i=r.iconWidth,c={transform:"translate(".concat(o/2," 256)")},u="translate(".concat(s.x*32,", ").concat(s.y*32,") "),p="scale(".concat(s.size/16*(s.flipX?-1:1),", ").concat(s.size/16*(s.flipY?-1:1),") "),d="rotate(".concat(s.rotate," 0 0)"),f={transform:"".concat(u," ").concat(p," ").concat(d)},m={transform:"translate(".concat(i/2*-1," -256)")},h={outer:c,inner:f,path:m};return{tag:"g",attributes:Zt({},h.outer),children:[{tag:"g",attributes:Zt({},h.inner),children:[{tag:n.icon.tag,children:n.icon.children,attributes:Zt(Zt({},n.icon.attributes),h.path)}]}]}}}},zv={x:0,y:0,width:"100%",height:"100%"};function SP(e){var t=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!0;return e.attributes&&(e.attributes.fill||t)&&(e.attributes.fill="black"),e}function Ite(e){return e.tag==="g"?e.children:[e]}var Nte={hooks:function(){return{parseNodeAttributes:function(r,n){var s=n.getAttribute("data-fa-mask"),o=s?Cb(s.split(" ").map(function(i){return i.trim()})):EL();return o.prefix||(o.prefix=Hl()),r.mask=o,r.maskId=n.getAttribute("data-fa-mask-id"),r}}},provides:function(t){t.generateAbstractMask=function(r){var n=r.children,s=r.attributes,o=r.main,i=r.mask,c=r.maskId,u=r.transform,p=o.width,d=o.icon,f=i.width,m=i.icon,h=kee({transform:u,containerWidth:f,iconWidth:p}),b={tag:"rect",attributes:Zt(Zt({},zv),{},{fill:"white"})},g=d.children?{children:d.children.map(SP)}:{},y={tag:"g",attributes:Zt({},h.inner),children:[SP(Zt({tag:d.tag,attributes:Zt(Zt({},d.attributes),h.path)},g))]},x={tag:"g",attributes:Zt({},h.outer),children:[y]},v="mask-".concat(c||sP()),A="clip-".concat(c||sP()),_={tag:"mask",attributes:Zt(Zt({},zv),{},{id:v,maskUnits:"userSpaceOnUse",maskContentUnits:"userSpaceOnUse"}),children:[b,x]},w={tag:"defs",children:[{tag:"clipPath",attributes:{id:A},children:Ite(m)},_]};return n.push(w,{tag:"rect",attributes:Zt({fill:"currentColor","clip-path":"url(#".concat(A,")"),mask:"url(#".concat(v,")")},zv)}),{children:n,attributes:s}}}},Mte={provides:function(t){var r=!1;Vl.matchMedia&&(r=Vl.matchMedia("(prefers-reduced-motion: reduce)").matches),t.missingIconAbstract=function(){var n=[],s={fill:"currentColor"},o={attributeType:"XML",repeatCount:"indefinite",dur:"2s"};n.push({tag:"path",attributes:Zt(Zt({},s),{},{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 i=Zt(Zt({},o),{},{attributeName:"opacity"}),c={tag:"circle",attributes:Zt(Zt({},s),{},{cx:"256",cy:"364",r:"28"}),children:[]};return r||c.children.push({tag:"animate",attributes:Zt(Zt({},o),{},{attributeName:"r",values:"28;14;28;28;14;28;"})},{tag:"animate",attributes:Zt(Zt({},i),{},{values:"1;0;1;1;0;1;"})}),n.push(c),n.push({tag:"path",attributes:Zt(Zt({},s),{},{opacity:"1",d:"M263.7,312h-16c-6.6,0-12-5.4-12-12c0-71,77.4-63.9,77.4-107.8c0-20-17.8-40.2-57.4-40.2c-29.1,0-44.3,9.6-59.2,28.7 c-3.9,5-11.1,6-16.2,2.4l-13.1-9.2c-5.6-3.9-6.9-11.8-2.6-17.2c21.2-27.2,46.4-44.7,91.2-44.7c52.3,0,97.4,29.8,97.4,80.2 c0,67.6-77.4,63.5-77.4,107.8C275.7,306.6,270.3,312,263.7,312z"}),children:r?[]:[{tag:"animate",attributes:Zt(Zt({},i),{},{values:"1;0;0;0;0;1;"})}]}),r||n.push({tag:"path",attributes:Zt(Zt({},s),{},{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:Zt(Zt({},i),{},{values:"0;0;1;1;0;0;"})}]}),{tag:"g",attributes:{class:"missing"},children:n}}}},Lte={hooks:function(){return{parseNodeAttributes:function(r,n){var s=n.getAttribute("data-fa-symbol"),o=s===null?!1:s===""?!0:s;return r.symbol=o,r}}}},Dte=[Pee,yte,bte,vte,_te,Rte,Tte,jte,Nte,Mte,Lte];Vee(Dte,{mixoutsTo:Js});Js.noAuto;Js.config;Js.library;Js.dom;var sw=Js.parse;Js.findIconDefinition;Js.toHtml;var Ote=Js.icon;Js.layer;Js.text;Js.counter;var ML={exports:{}},zte="SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED",Bte=zte,Fte=Bte;function LL(){}function DL(){}DL.resetWarningCache=LL;var Ute=function(){function e(n,s,o,i,c,u){if(u!==Fte){var p=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 p.name="Invariant Violation",p}}e.isRequired=e;function t(){return e}var r={array:e,bigint:e,bool:e,func:e,number:e,object:e,string:e,symbol:e,any:e,arrayOf:t,element:e,elementType:e,instanceOf:t,node:e,objectOf:t,oneOf:t,oneOfType:t,shape:t,exact:t,checkPropTypes:DL,resetWarningCache:LL};return r.PropTypes=r,r};ML.exports=Ute();var qte=ML.exports;const ln=nx(qte);var Vte={};function ow(e,t){(t==null||t>e.length)&&(t=e.length);for(var r=0,n=Array(t);r<t;r++)n[r]=e[r];return n}function Hte(e){if(Array.isArray(e))return e}function Wte(e){if(Array.isArray(e))return ow(e)}function wl(e,t,r){return(t=$te(t))in e?Object.defineProperty(e,t,{value:r,enumerable:!0,configurable:!0,writable:!0}):e[t]=r,e}function Gte(e){if(typeof Symbol<"u"&&e[Symbol.iterator]!=null||e["@@iterator"]!=null)return Array.from(e)}function Xte(e,t){var r=e==null?null:typeof Symbol<"u"&&e[Symbol.iterator]||e["@@iterator"];if(r!=null){var n,s,o,i,c=[],u=!0,p=!1;try{if(o=(r=r.call(e)).next,t!==0)for(;!(u=(n=o.call(r)).done)&&(c.push(n.value),c.length!==t);u=!0);}catch(d){p=!0,s=d}finally{try{if(!u&&r.return!=null&&(i=r.return(),Object(i)!==i))return}finally{if(p)throw s}}return c}}function Yte(){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 Zte(){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 EP(e,t){var r=Object.keys(e);if(Object.getOwnPropertySymbols){var n=Object.getOwnPropertySymbols(e);t&&(n=n.filter(function(s){return Object.getOwnPropertyDescriptor(e,s).enumerable})),r.push.apply(r,n)}return r}function hi(e){for(var t=1;t<arguments.length;t++){var r=arguments[t]!=null?arguments[t]:{};t%2?EP(Object(r),!0).forEach(function(n){wl(e,n,r[n])}):Object.getOwnPropertyDescriptors?Object.defineProperties(e,Object.getOwnPropertyDescriptors(r)):EP(Object(r)).forEach(function(n){Object.defineProperty(e,n,Object.getOwnPropertyDescriptor(r,n))})}return e}function Kte(e,t){if(e==null)return{};var r,n,s=Qte(e,t);if(Object.getOwnPropertySymbols){var o=Object.getOwnPropertySymbols(e);for(n=0;n<o.length;n++)r=o[n],t.indexOf(r)===-1&&{}.propertyIsEnumerable.call(e,r)&&(s[r]=e[r])}return s}function Qte(e,t){if(e==null)return{};var r={};for(var n in e)if({}.hasOwnProperty.call(e,n)){if(t.indexOf(n)!==-1)continue;r[n]=e[n]}return r}function PP(e,t){return Hte(e)||Xte(e,t)||OL(e,t)||Yte()}function iw(e){return Wte(e)||Gte(e)||OL(e)||Zte()}function Jte(e,t){if(typeof e!="object"||!e)return e;var r=e[Symbol.toPrimitive];if(r!==void 0){var n=r.call(e,t);if(typeof n!="object")return n;throw new TypeError("@@toPrimitive must return a primitive value.")}return(t==="string"?String:Number)(e)}function $te(e){var t=Jte(e,"string");return typeof t=="symbol"?t:t+""}function wy(e){"@babel/helpers - typeof";return wy=typeof Symbol=="function"&&typeof Symbol.iterator=="symbol"?function(t){return typeof t}:function(t){return t&&typeof Symbol=="function"&&t.constructor===Symbol&&t!==Symbol.prototype?"symbol":typeof t},wy(e)}function OL(e,t){if(e){if(typeof e=="string")return ow(e,t);var r={}.toString.call(e).slice(8,-1);return r==="Object"&&e.constructor&&(r=e.constructor.name),r==="Map"||r==="Set"?Array.from(e):r==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(r)?ow(e,t):void 0}}var ere="7.0.0-alpha1",lw;try{var tre=require("@fortawesome/fontawesome-svg-core/package.json");lw=tre.version}catch{lw=Vte.FA_VERSION||"7.0.0-alpha8"}function rre(e){var t=e.beat,r=e.fade,n=e.beatFade,s=e.bounce,o=e.shake,i=e.flash,c=e.spin,u=e.spinPulse,p=e.spinReverse,d=e.pulse,f=e.fixedWidth,m=e.inverse,h=e.border,b=e.listItem,g=e.flip,y=e.size,x=e.rotation,v=e.pull,A=e.swapOpacity,_=e.rotateBy,w=e.widthAuto,j=nre(lw,ere),T=wl(wl(wl(wl(wl(wl({"fa-beat":t,"fa-fade":r,"fa-beat-fade":n,"fa-bounce":s,"fa-shake":o,"fa-flash":i,"fa-spin":c,"fa-spin-reverse":p,"fa-spin-pulse":u,"fa-pulse":d,"fa-fw":f,"fa-inverse":m,"fa-border":h,"fa-li":b,"fa-flip":g===!0,"fa-flip-horizontal":g==="horizontal"||g==="both","fa-flip-vertical":g==="vertical"||g==="both"},"fa-".concat(y),typeof y<"u"&&y!==null),"fa-rotate-".concat(x),typeof x<"u"&&x!==null&&x!==0),"fa-pull-".concat(v),typeof v<"u"&&v!==null),"fa-swap-opacity",A),"fa-rotate-by",j&&_),"fa-width-auto",j&&w);return Object.keys(T).map(function(R){return T[R]?R:null}).filter(function(R){return R})}function nre(e,t){for(var r=e.split("-"),n=PP(r,2),s=n[0],o=n[1],i=t.split("-"),c=PP(i,2),u=c[0],p=c[1],d=s.split("."),f=u.split("."),m=0;m<Math.max(d.length,f.length);m++){var h=d[m]||"0",b=f[m]||"0",g=parseInt(h,10),y=parseInt(b,10);if(g!==y)return g>y}for(var x=0;x<Math.max(d.length,f.length);x++){var v=d[x]||"0",A=f[x]||"0";if(v!==A&&v.length!==A.length)return v.length<A.length}return!(o&&!p)}function are(e){return e=e-0,e===e}function zL(e){return are(e)?e:(e=e.replace(/[\-_\s]+(.)?/g,function(t,r){return r?r.toUpperCase():""}),e.substr(0,1).toLowerCase()+e.substr(1))}var sre=["style"];function ore(e){return e.charAt(0).toUpperCase()+e.slice(1)}function ire(e){return e.split(";").map(function(t){return t.trim()}).filter(function(t){return t}).reduce(function(t,r){var n=r.indexOf(":"),s=zL(r.slice(0,n)),o=r.slice(n+1).trim();return s.startsWith("webkit")?t[ore(s)]=o:t[s]=o,t},{})}function BL(e,t){var r=arguments.length>2&&arguments[2]!==void 0?arguments[2]:{};if(typeof t=="string")return t;var n=(t.children||[]).map(function(u){return BL(e,u)}),s=Object.keys(t.attributes||{}).reduce(function(u,p){var d=t.attributes[p];switch(p){case"class":u.attrs.className=d,delete t.attributes.class;break;case"style":u.attrs.style=ire(d);break;default:p.indexOf("aria-")===0||p.indexOf("data-")===0?u.attrs[p.toLowerCase()]=d:u.attrs[zL(p)]=d}return u},{attrs:{}}),o=r.style,i=o===void 0?{}:o,c=Kte(r,sre);return s.attrs.style=hi(hi({},s.attrs.style),i),e.apply(void 0,[t.tag,hi(hi({},s.attrs),c)].concat(iw(n)))}var FL=!1;try{FL=!0}catch{}function lre(){if(!FL&&console&&typeof console.error=="function"){var e;(e=console).error.apply(e,arguments)}}function CP(e){if(e&&wy(e)==="object"&&e.prefix&&e.iconName&&e.icon)return e;if(sw.icon)return sw.icon(e);if(e===null)return null;if(e&&wy(e)==="object"&&e.prefix&&e.iconName)return e;if(Array.isArray(e)&&e.length===2)return{prefix:e[0],iconName:e[1]};if(typeof e=="string")return{prefix:"fas",iconName:e}}function Bv(e,t){return Array.isArray(t)&&t.length>0||!Array.isArray(t)&&t?wl({},e,t):{}}var RP={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},Gl=ot.forwardRef(function(e,t){var r=hi(hi({},RP),e),n=r.icon,s=r.mask,o=r.symbol,i=r.className,c=r.title,u=r.titleId,p=r.maskId,d=CP(n),f=Bv("classes",[].concat(iw(rre(r)),iw((i||"").split(" ")))),m=Bv("transform",typeof r.transform=="string"?sw.transform(r.transform):r.transform),h=Bv("mask",CP(s)),b=Ote(d,hi(hi(hi(hi({},f),m),h),{},{symbol:o,title:c,titleId:u,maskId:p}));if(!b)return lre("Could not find icon",d),null;var g=b.abstract,y={ref:t};return Object.keys(r).forEach(function(x){RP.hasOwnProperty(x)||(y[x]=r[x])}),cre(g[0],y)});Gl.displayName="FontAwesomeIcon";Gl.propTypes={beat:ln.bool,border:ln.bool,beatFade:ln.bool,bounce:ln.bool,className:ln.string,fade:ln.bool,flash:ln.bool,mask:ln.oneOfType([ln.object,ln.array,ln.string]),maskId:ln.string,fixedWidth:ln.bool,inverse:ln.bool,flip:ln.oneOf([!0,!1,"horizontal","vertical","both"]),icon:ln.oneOfType([ln.object,ln.array,ln.string]),listItem:ln.bool,pull:ln.oneOf(["right","left"]),pulse:ln.bool,rotation:ln.oneOf([0,90,180,270]),rotateBy:ln.bool,shake:ln.bool,size:ln.oneOf(["2xs","xs","sm","lg","xl","2xl","1x","2x","3x","4x","5x","6x","7x","8x","9x","10x"]),spin:ln.bool,spinPulse:ln.bool,spinReverse:ln.bool,symbol:ln.oneOfType([ln.bool,ln.string]),title:ln.string,titleId:ln.string,transform:ln.oneOfType([ln.string,ln.object]),swapOpacity:ln.bool,widthAuto:ln.bool};var cre=BL.bind(null,ot.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 ure={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"]},dre={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"]},pre=dre,fre={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"]},mre={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"]},hre=mre;const gre=[{key:"cee-lo",title:"CEE-LO",tagline:"Fast • Social • Casual",icon:PJ},{key:"craps",title:"CRAPS",tagline:"High Energy • Strategy",icon:CJ},{key:"poker",title:"POKER",tagline:"Skill-Based • Competitive",icon:RJ},{key:"skills",title:"SKILLS",tagline:"Challenge • Mastery",icon:TJ},{key:"zentara",title:"ZENTARA",tagline:"Conquer • Build • Dominate",icon:jJ}];function yre({selectedMode:e,onSelectMode:t,slides:r=gre,interval:n=4e3,width:s=140,height:o=140,className:i=""}){const[c,u]=l.useState(0),[p,d]=l.useState(!1);l.useEffect(()=>{if(e){const _=r.findIndex(w=>w.key===e);_>=0&&_!==c&&u(_)}},[e,r,c]),l.useEffect(()=>{if(p||e||n<=0)return;const _=setInterval(()=>{u(w=>(w+1)%r.length)},n);return()=>clearInterval(_)},[p,e,n,r.length]);const f=l.useCallback(_=>{u(_),d(!0),t==null||t(r[_].key)},[t,r]),[m,h]=l.useState(null),b=l.useCallback(_=>{h(_.touches[0].clientX)},[]),g=l.useCallback(_=>{if(m===null)return;const w=_.changedTouches[0].clientX-m;if(Math.abs(w)>50){const T=w>0?-1:1,R=(c+T+r.length)%r.length;f(R)}h(null)},[m,c,r.length,f]),y=r[c],x=l.useCallback(_=>{_.currentTarget.src=H0},[]),v=l.useCallback(_=>{_.stopPropagation();const w=(c-1+r.length)%r.length;f(w)},[c,r.length,f]),A=l.useCallback(_=>{_.stopPropagation();const w=(c+1)%r.length;f(w)},[c,r.length,f]);return a.jsxs("div",{className:`logo-slideshow ${i}`,onTouchStart:b,onTouchEnd:g,onClick:()=>f(c),role:"button",tabIndex:0,"aria-label":`Select ${y.title}`,children:[a.jsx("button",{className:"logo-slideshow__chevron logo-slideshow__chevron--left",onClick:v,"aria-label":"Previous game",type:"button",children:a.jsx(Gl,{icon:pre})}),a.jsx("div",{className:"logo-slideshow__track",children:r.map((_,w)=>a.jsxs("div",{className:`logo-slideshow__slide ${w===c?"logo-slideshow__slide--active":""}`,"aria-hidden":w!==c,children:[a.jsx("img",{src:_.icon,alt:_.title,width:s,height:o,className:"logo-slideshow__icon",onError:x,loading:w===0?"eager":"lazy"}),a.jsx("div",{className:"logo-slideshow__tagline",children:_.tagline})]},_.key))}),a.jsx("button",{className:"logo-slideshow__chevron logo-slideshow__chevron--right",onClick:A,"aria-label":"Next game",type:"button",children:a.jsx(Gl,{icon:hre})})]})}const bre=""+new URL("logo-256-CalulGNO.webp",import.meta.url).href,vre=""+new URL("logo-420-D7JbtaQr.webp",import.meta.url).href,_re=""+new URL("logo-256-BQd-RHpb.avif",import.meta.url).href,wre=""+new URL("logo-420-CxzlrsyU.avif",import.meta.url).href,xre=""+new URL("zentara-icon-transparent-HQ2ticUo.webp",import.meta.url).href;function UL({width:e=180,height:t=180,tagline:r,className:n=""}){var g,y;const s=((y=(g=import.meta)==null?void 0:g.env)==null?void 0:y.VITE_APP_TARGET)??"";let o="";try{o=(window==null?void 0:window.APP_TARGET)??""}catch{}const i=String(s||o).toLowerCase(),c=i==="cee-lo"?"ceelo":i,u=c==="craps"||c==="poker"||c==="ceelo"||c==="skills"||c==="zentara",p=i==="zentara"?"Zentara Lounge":i==="poker"?"Zentara One Poker Lounge":i==="craps"?"Zentara One Craps Lounge":i==="skills"?"Zentara One Skills Lounge":"Zentara One Dice Lounge",f=r??(c==="skills"?"Think Fast. Play Smart. Win Big.":c==="craps"?"Roll the Dice. Beat the House.":c==="poker"?"Ante Up. Bluff. Win Big.":c==="ceelo"?"Street Rules. Real Stakes.":c==="zentara"?"Conquer the Galaxy.":"Play. Roll. Win. Together!"),m=typeof window<"u"?window:{};let h=m.APP_ICON_PNG||"./icon.png",b=m.APP_ICON_512||"./icon-512.webp";return c==="zentara"&&(b=xre),a.jsxs("div",{className:`logo-hero ${n}`,"data-testid":"logo-hero",children:[u?a.jsxs("picture",{children:[a.jsx("source",{type:"image/webp",srcSet:b,sizes:"(max-width: 600px) 60vw, 420px"}),a.jsx("img",{width:e,height:t,src:b||h,alt:p,decoding:"async",loading:"eager",fetchPriority:"high",style:{maxWidth:"100%",height:"auto"},onError:x=>{try{x.currentTarget.src=H0}catch{}}})]}):a.jsxs("picture",{children:[a.jsx("source",{type:"image/avif",srcSet:`${_re} 256w, ${wre} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),a.jsx("source",{type:"image/webp",srcSet:`${bre} 256w, ${vre} 420w`,sizes:"(max-width: 600px) 60vw, 420px"}),a.jsx("img",{width:e,height:t,src:H0,alt:p,decoding:"async",loading:"eager",fetchPriority:"high",sizes:"(max-width:600px) 60vw, 420px",style:{maxWidth:"100%",height:"auto"}})]}),f&&a.jsx("span",{className:"gold-link",children:f})]})}const qL=l.createContext(void 0),Are=({children:e})=>{const{user:t}=Zr(),[r,n]=l.useState([]),[s,o]=l.useState([]),[i,c]=l.useState([]),{blockUser:u,unblockUser:p,getFriendsList:d,sendFriendRequest:f,unfriend:m,respondFriendRequest:h}=sa(),b=l.useCallback(async()=>{try{const R=await d();R!=null&&R.ok&&(Array.isArray(R.friendsProfiles)&&n(R.friendsProfiles),Array.isArray(R.friendRequests)&&o(R.friendRequests),Array.isArray(R.blockedProfiles)&&c(R.blockedProfiles))}catch{}},[d]);Ba({onFriendRequestReceived:R=>{R!=null&&R.request&&o(P=>[...P.filter(k=>k.id!==R.request.id),R.request])},onFriendRequestCancelled:R=>{R!=null&&R.requestId&&o(P=>P.filter(k=>k.id!==R.requestId))},onFriendRequestResponded:R=>{R!=null&&R.requestId&&(R!=null&&R.action)&&(o(P=>P.map(k=>k.id===R.requestId?{...k,status:R.action==="ACCEPT"?"ACCEPTED":"DECLINED"}:k)),R.action==="ACCEPT"&&b())},onUnfriended:R=>{R!=null&&R.byUserId&&n(P=>P.filter(k=>k.id!==R.byUserId))},onUserBlocked:R=>{R!=null&&R.byUserId&&c(P=>P.find(k=>k.id===R.byUserId)?P:[...P,{id:R.byUserId}])},onUserUnblocked:R=>{R!=null&&R.byUserId&&c(P=>P.filter(k=>k.id!==R.byUserId))}}),l.useEffect(()=>{b()},[]);const g=l.useCallback(R=>{if(!(t!=null&&t.id)||s.some(M=>M.status==="PENDING"&&M.fromUserId===t.id&&M.toUserId===R))return;const k=`temp:${Date.now()}:${R}`,E={id:k,fromUserId:t.id,toUserId:R,message:void 0,status:"PENDING",createdAt:new Date().toISOString(),respondedAt:void 0,fromUser:{id:t.id,name:t.name??null,avatarUrl:t.avatarUrl??null},toUser:i.find(M=>M.id===R)??r.find(M=>M.id===R)??{id:R,name:null,avatarUrl:null}};o(M=>[...M,E]),f(R).then(M=>{M!=null&&M.ok?M.request?o(C=>[...C.filter(I=>!(I.id===k||I.fromUserId===t.id&&I.toUserId===R&&I.id.startsWith("temp:"))),M.request]):b():o(C=>C.filter(I=>I.id!==k))}).catch(()=>{o(M=>M.filter(C=>C.id!==k))})},[f,b,t==null?void 0:t.id,t==null?void 0:t.name,i,r,s]),y=l.useCallback(R=>{m(R).then(P=>{P!=null&&P.ok&&n(k=>k.filter(E=>E.id!==R))}).catch(()=>{})},[m]),x=l.useCallback(R=>{o(P=>[...P.filter(k=>k.id!==R.id),R])},[]),v=l.useCallback(R=>{o(P=>P.map(k=>k.id===R.id?R:k))},[]),A=l.useCallback(R=>{o(P=>P.filter(k=>k.id!==R))},[]),_=l.useCallback(async(R,P)=>{try{const k=await h(R,P);k!=null&&k.ok&&await b()}catch{}},[h,b]),w=l.useCallback(async R=>{(await u(R)).ok&&c(k=>k.find(E=>E.id===R)?k:[...k,{id:R}])},[u]),j=l.useCallback(async R=>{(await p(R)).ok&&c(k=>k.filter(E=>E.id!==R))},[p]),T=l.useCallback(R=>!!i.find(P=>P.id===R),[i]);return a.jsx(qL.Provider,{value:{friends:r,friendRequests:s,blockedUsers:i,addFriend:g,removeFriend:y,addFriendRequest:x,updateFriendRequest:v,removeFriendRequest:A,respondToFriendRequest:_,blockUser:w,unblockUser:j,isBlocked:T,refreshSocial:b},children:e})};function sc(){const e=l.useContext(qL);if(!e)throw new Error("useSocial must be used within a SocialProvider");return e}const VL=l.createContext(null),Dm=()=>l.useContext(VL),pc=e=>`room:${e}`,ao=(e,t)=>`dm:${[e,t].sort().join("|")}`,TP=e=>{if(!e.startsWith("dm:"))return null;const r=e.slice(3).split("|");return r.length===2?r:null},Fv=(e,t)=>e.ts===t.ts?e.id<t.id?-1:e.id>t.id?1:0:e.ts-t.ts,jP=()=>"tmp:"+Math.random().toString(36).slice(2)+Date.now().toString(36),Uv=e=>({id:e.id,ts:e.ts,senderId:e.fromUserId,text:e.text,roomId:e.roomId}),qv=e=>({id:e.id,ts:e.ts,senderId:e.fromUserId,text:e.text,toUserId:e.toUserId});function kre({children:e}){const{user:t}=Zr(),r=(t==null?void 0:t.id)??"anon",{roomSendMessage:n,roomFetchHistory:s,dmSendMessage:o,dmFetchHistory:i}=sa(),[c,u]=l.useState({}),[p,d]=l.useState({}),[f,m]=l.useState(null),[h,b]=l.useState({}),g=l.useRef(new Set),{info:y}=vb(),x=G=>G?G.length>100?G.slice(0,100)+"…":G:"",v=l.useCallback((G,$,K)=>{if($!=null&&$.length&&(u(de=>{const ie=de[G]??[],we=new Map;for(const Ae of ie)Ae!=null&&Ae.id&&we.set(Ae.id,Ae);for(const Ae of $){if(!(Ae!=null&&Ae.id))continue;const Fe=we.get(Ae.id);we.set(Ae.id,{...Fe??{},...Ae,pending:!1,error:void 0})}const he=Array.from(we.values()).sort(Fv);return{...de,[G]:he}}),G.startsWith("dm:")&&(K!=null&&K.fromPeerId))){const de=K.fromPeerId,ie=ao(r,de),we=f===de,he=$.filter(Ae=>Ae.senderId===de).length;he>0&&!we&&d(Ae=>({...Ae,[ie]:(Ae[ie]??0)+he}))}},[f,r]),A=l.useCallback((G,$,K)=>{u(de=>{const ie=(de[G]??[]).slice();return ie.push($),ie.sort(Fv),{...de,[G]:ie}}),(async()=>{try{const de=await K();if(!(de!=null&&de.ok)||!de.id)throw new Error((de==null?void 0:de.error)||"send failed");const ie=de.id;g.current.add(ie),u(we=>{const he=we[G]??[],Ae=he.some(U=>U.id===ie);let Fe;return Ae?Fe=he.filter(U=>U.id!==$.id):Fe=he.map(U=>U.id===$.id?{...U,id:ie,pending:!1,error:void 0}:U),Fe.sort(Fv),{...we,[G]:Fe}})}catch(de){u(ie=>{const we=(ie[G]??[]).map(he=>he.id===$.id?{...he,pending:!1,error:(de==null?void 0:de.message)||"send failed"}:he);return{...ie,[G]:we}})}})()},[]),_=l.useCallback(G=>{u($=>{if(!$[G])return $;const K={...$};return delete K[G],K}),G.startsWith("dm:")&&(d($=>{if(!(G in $))return $;const K={...$};return delete K[G],K}),b($=>{if(!(G in $))return $;const K={...$};return delete K[G],K}))},[]),w=l.useCallback(G=>(c[G]??[]).some($=>$.pending),[c]),j=l.useCallback(G=>{const $=pc(G);return H(G),(c[$]??[]).slice()},[c]),T=l.useCallback((G,$)=>{const K=($??"").trim();if(!K)return null;const de=pc(G),ie=jP(),we={id:ie,ts:Date.now(),senderId:r,text:K,roomId:G,pending:!0};return A(de,we,()=>n(G,K)),ie},[r,n,A]),R=l.useCallback(G=>_(pc(G)),[_]),P=l.useCallback(G=>w(pc(G)),[w]),k=l.useCallback(async G=>{const $=ao(r,G);if(!h[$])try{const K=await(i==null?void 0:i(G));if(K!=null&&K.ok&&Array.isArray(K.messages)){const de=K.messages.map(qv);v($,de),d(ie=>({...ie,[$]:0}))}}finally{b(K=>({...K,[$]:!0}))}},[i,v,r,h]),E=l.useCallback(G=>{const $=ao(r,G);return k(G),(c[$]??[]).slice()},[c,r,k]),M=l.useCallback((G,$)=>{const K=($??"").trim();if(!K)return null;const de=ao(r,G),ie=jP(),we={id:ie,ts:Date.now(),senderId:r,text:K,toUserId:G,pending:!0};return A(de,we,()=>o(G,K)),ie},[r,A,o]),C=l.useCallback(G=>_(ao(r,G)),[_,r]),I=l.useCallback(G=>w(ao(r,G)),[w,r]),L=l.useCallback(G=>{const $=ao(r,G);d(K=>{if(!($ in K))return K;const de={...K};return de[$]=0,de})},[r]),N=l.useCallback(G=>{m(G),G&&(L(G),k(G))},[L,k]),S=l.useCallback(G=>{const $=[];for(const[K,de]of Object.entries(c??{})){if(!K.startsWith("dm:"))continue;const ie=TP(K);if(!ie)continue;const we=ie[0]===r?ie[1]:ie[0];if(G&&we!==G)continue;const he=de[de.length-1];$.push({peerUserId:we,last:he,unread:(p==null?void 0:p[K])??0,hasPending:de.some(Ae=>Ae.pending)})}return $.sort((K,de)=>{var ie,we;return(((ie=de.last)==null?void 0:ie.ts)??0)-(((we=K.last)==null?void 0:we.ts)??0)}),$},[c,p,r]),F=l.useCallback(G=>{const $=new Set(G);let K=0;for(const[de,ie]of Object.entries(p)){if(ie<=0)continue;const we=TP(de);if(!we)continue;const he=we[0]===r?we[1]:we[0];$.has(he)&&(K+=ie)}return K},[p,r]),D=l.useCallback(G=>{const $=ao(r,G);return(p==null?void 0:p[$])??0},[p,r]);async function H(G){const $=pc(G);if(!(c[$]??[]).length)try{const K=await(s==null?void 0:s(G));if(K!=null&&K.ok&&Array.isArray(K.messages)){const de=K.messages.map(Uv);v($,de)}}catch{}}Ba({onRoomMessage:G=>{if(!(!(G!=null&&G.id)||!G.roomId)&&!g.current.has(G.id)){g.current.add(G.id),v(pc(G.roomId),[Uv(G)]);try{y("Message",x(G.text))}catch{}}},onRoomHistory:({roomId:G,messages:$})=>{!G||!Array.isArray($)||v(pc(G),$.map(Uv))},onDmMessage:G=>{if(!(G!=null&&G.id))return;const $=G.fromUserId===r?G.toUserId:G.fromUserId;if(!$)return;const K=ao(r,$),de=qv(G);if(v(K,[de],{fromPeerId:G.fromUserId!==r?G.fromUserId:void 0}),G.fromUserId!==r)try{y("Direct Message",x(G.text))}catch{}f===$&&d(ie=>({...ie,[K]:0}))},onDmHistory:({peerUserId:G,messages:$})=>{if(!G||!Array.isArray($))return;const K=ao(r,G);v(K,$.map(qv)),f===G&&d(de=>({...de,[K]:0})),b(de=>({...de,[K]:!0}))}});const W=l.useMemo(()=>({getRoomMessages:j,sendRoomMessage:T,clearRoom:R,roomHasPending:P,getDmMessages:E,sendDmMessage:M,clearDm:C,dmHasPending:I,getDmSummary:S,markDmRead:L,setActiveDm:N,loadDmHistory:k,threads:c,getTotalFriendUnread:F,getUnreadForPeer:D}),[j,T,R,P,E,M,C,I,S,L,N,k,c,F,D]);return a.jsx(VL.Provider,{value:W,children:e})}const Sre=5e3;function Ere(){const{quickMatchJoin:e,quickMatchLeave:t,quickMatchStatus:r}=sa(),n=Na(),s=Hr(),[o,i]=l.useState({status:"idle"}),[c,u]=l.useState({}),p=l.useRef(!0),d=l.useRef(o);d.current=o;const f=l.useRef(null),m=l.useCallback(()=>{f.current!=null&&(clearTimeout(f.current),f.current=null)},[]);l.useEffect(()=>{if(!n)return;const g=A=>{m(),d.current.status!=="idle"&&(i({status:"found",roomId:A.roomId,route:A.route,gameMode:A.gameMode,opponent:A.opponent}),p.current&&setTimeout(()=>{s(A.route),setTimeout(()=>i({status:"idle"}),500)},1500))},y=A=>{A!=null&&A.queueSizes&&u(A.queueSizes)},x=()=>{n.off("quick_match:found",g),n.off("quick_match:waiting",y),n.on("quick_match:found",g),n.on("quick_match:waiting",y)};x(),n.on("connect",x);const v=()=>{d.current.status==="searching"&&(r==null||r().then(A=>{A!=null&&A.ok&&A.queueSizes&&u(A.queueSizes)}).catch(()=>{}))};return n.on("connect",v),()=>{n.off("quick_match:found",g),n.off("quick_match:waiting",y),n.off("connect",x),n.off("connect",v)}},[n,s,r,m]),l.useEffect(()=>m,[m]);const h=l.useCallback(async(g,y)=>{m(),i({status:"searching",gameMode:g});const x=(y==null?void 0:y.timeoutMs)??Sre;if(x>0&&(y!=null&&y.onTimeout)){const v=y.onTimeout;f.current=window.setTimeout(()=>{f.current=null,d.current.status==="searching"&&(async()=>{try{await t()}catch{}if(d.current.status==="searching"){i({status:"idle"});try{v()}catch{}}})()},x)}try{const v=g==="zentara"?Math.max(1,Math.min(5,(await ma()).zentaraBotCount??Sa.zentaraBotCount??3)):void 0,A=await e(g,v);A!=null&&A.ok?A.matched||A.queueSizes&&u(A.queueSizes):(m(),i({status:"idle"}))}catch{m(),i({status:"idle"})}},[e,t,m]),b=l.useCallback(async()=>{m();try{await t()}catch{}i({status:"idle"})},[t,m]);return{state:o,queueSizes:c,join:h,leave:b}}function IP({gameMode:e,disabled:t,onFallbackToSinglePlayer:r}){const{state:n,leave:s,join:o}=Ere(),i=l.useCallback(()=>{e&&(cr("Medium"),n.status==="searching"?s():n.status==="idle"&&o(e,r?{onTimeout:r}:void 0))},[e,n.status,o,s,r]),c=n.status==="searching",u=n.status==="found";return a.jsx("button",{className:`btn gold-outline cta-btn primaryButton${c?" quick-match-btn--searching":""}${u?" quick-match-btn--found":""}`,onClick:i,disabled:t||!e||u,"aria-label":c?"Cancel Quick Match":u?"Match Found!":"Quick Match",type:"button",children:u?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"qm-icon","aria-hidden":!0,children:"🎯"}),a.jsx("span",{className:"qm-label",children:"Match Found!"})]}):c?a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"qm-spinner","aria-hidden":!0}),a.jsx("span",{className:"qm-label",children:"Searching…"}),a.jsx("span",{className:"qm-cancel",children:"✕"})]}):a.jsxs(a.Fragment,{children:[a.jsx("span",{className:"qm-icon","aria-hidden":!0,children:"⚡"}),a.jsx("span",{className:"qm-label",children:"Quick Match"})]})})}const Pre="purple",Cre="cyan",Rre="orange",Tre="red",jre="yellow",Ire="green",Nre="blue",Mre="magenta",cw=Pre,Nd=Cre,Md=Rre,Ld=Tre,Dd=jre,Od=Ire,zd=Nre,im=Mre,NP=[{id:0,name:"Command Base",type:"start"},{id:1,name:"Alpha Centauri",type:"planet",group:cw,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:cw,cost:60,rent:[4,20,60,180,320,450],upgradeCost:50},{id:4,name:"Void Flux",type:"tax"},{id:5,name:"Outpost Alpha",type:"station",cost:200},{id:6,name:"Kepler-22b",type:"planet",group:Nd,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:Nd,cost:100,rent:[6,30,90,270,400,550],upgradeCost:50},{id:9,name:"Kepler-62f",type:"planet",group:Nd,cost:120,rent:[8,40,100,300,450,600],upgradeCost:50},{id:10,name:"Cryosleep Chamber",type:"jail"},{id:11,name:"Trappist-1d",type:"planet",group:Md,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:Md,cost:140,rent:[10,50,150,450,625,750],upgradeCost:100},{id:14,name:"Trappist-1f",type:"planet",group:Md,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:Ld,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:Ld,cost:180,rent:[14,70,200,550,750,950],upgradeCost:100},{id:19,name:"Tau Ceti f",type:"planet",group:Ld,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:Dd,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:Dd,cost:220,rent:[18,90,250,700,875,1050],upgradeCost:150},{id:24,name:"Gliese 581g",type:"planet",group:Dd,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:Od,cost:260,rent:[22,110,330,800,975,1150],upgradeCost:150},{id:27,name:"Cancri 55f",type:"planet",group:Od,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:Od,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:zd,cost:300,rent:[26,130,390,900,1100,1275],upgradeCost:200},{id:32,name:"Kapteyn c",type:"planet",group:zd,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:zd,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:im,cost:350,rent:[35,175,500,1100,1300,1500],upgradeCost:200},{id:38,name:"Dark Matter Surge",type:"tax"},{id:39,name:"Zentara",type:"planet",group:im,cost:400,rent:[50,200,600,1400,1700,2e3],upgradeCost:200}],MP=[{id:0,name:"Command Base",type:"start"},{id:1,name:"Kepler-62f",type:"planet",group:Nd,cost:120,rent:[8,40,100,300,450,600],upgradeCost:50},{id:2,name:"Kepler-22b",type:"planet",group:Nd,cost:100,rent:[6,30,90,270,400,550],upgradeCost:50},{id:3,name:"Cryosleep Chamber",type:"jail"},{id:4,name:"Trappist-1d",type:"planet",group:Md,cost:140,rent:[10,50,150,450,625,750],upgradeCost:100},{id:5,name:"Trappist-1f",type:"planet",group:Md,cost:160,rent:[12,60,180,500,700,900],upgradeCost:100},{id:6,name:"Nebula Storm",type:"nebula"},{id:7,name:"Ross 128b",type:"planet",group:Ld,cost:180,rent:[14,70,200,550,750,950],upgradeCost:100},{id:8,name:"Tau Ceti f",type:"planet",group:Ld,cost:200,rent:[16,80,220,600,800,1e3],upgradeCost:100},{id:9,name:"Outpost Alpha",type:"station",cost:200},{id:10,name:"Gliese 667Cc",type:"planet",group:Dd,cost:220,rent:[18,90,250,700,875,1050],upgradeCost:150},{id:11,name:"Gliese 581g",type:"planet",group:Dd,cost:240,rent:[20,100,300,750,925,1100],upgradeCost:150},{id:12,name:"Nebula Gateway",type:"nebula"},{id:13,name:"Cancri 55f",type:"planet",group:Od,cost:260,rent:[22,110,330,800,975,1150],upgradeCost:150},{id:14,name:"HD 40307g",type:"planet",group:Od,cost:280,rent:[24,120,360,850,1025,1200],upgradeCost:150},{id:15,name:"Black Hole",type:"go-to-jail"},{id:16,name:"Kapteyn c",type:"planet",group:zd,cost:300,rent:[26,130,390,900,1100,1275],upgradeCost:200},{id:17,name:"Wolf 1061c",type:"planet",group:zd,cost:320,rent:[28,150,450,1e3,1200,1400],upgradeCost:200},{id:18,name:"Pandora",type:"planet",group:im,cost:350,rent:[35,175,500,1100,1300,1500],upgradeCost:200},{id:19,name:"Zentara",type:"planet",group:im,cost:400,rent:[50,200,600,1400,1700,2e3],upgradeCost:200}],HL={startingCredits:1500,passStartBonus:200,jailBailCost:50,armorUpgradeCost:200,weaponUpgradeCost:250,armorDamageReduction:.15,maxArmorLevel:3,maxWeaponLevel:3},Lre={tiles:NP,tileCount:NP.length,...HL},Dre={tiles:MP,tileCount:MP.length,...HL},Ore={[cw]:"#7b2ff2",[Nd]:"#00e5ff",[Md]:"#ff9100",[Ld]:"#ff1744",[Dd]:"#ffd600",[Od]:"#00e676",[zd]:"#2979ff",[im]:"#e040fb"};function zre(e){const t=e.type==="tax"?"void-drain":e.type;return{id:e.id,name:e.name,type:t,group:e.group,cost:e.cost,rent:e.rent,upgradeCost:e.upgradeCost}}function WL(e){return{tiles:e.tiles.map(zre),tileCount:e.tileCount,startingCredits:e.startingCredits,passStartBonus:e.passStartBonus,jailBailCost:e.jailBailCost,armorUpgradeCost:e.armorUpgradeCost,weaponUpgradeCost:e.weaponUpgradeCost,armorDamageReduction:e.armorDamageReduction,maxArmorLevel:e.maxArmorLevel,maxWeaponLevel:e.maxWeaponLevel}}const an=WL(Lre),Bre=WL(Dre);function xy(e){return e==="standard"?Bre:an}const ka=Ore,Tb="zentara_saved_game";function GL(e){const{board:t,...r}=e;localStorage.setItem(Tb,JSON.stringify(r))}function Fre(){return localStorage.getItem(Tb)!==null}function XL(){const e=localStorage.getItem(Tb);if(!e)return null;try{const t=JSON.parse(e);if(!t.matchId||!Array.isArray(t.players)||t.players.length<2)return null;for(const r of t.players)r.armorLevel==null&&(r.armorLevel=0),r.weaponLevel==null&&(r.weaponLevel=0);return{...t,board:xy(t.boardSize).tiles}}catch{return null}}function uw(){localStorage.removeItem(Tb)}const Ure=""+new URL("azure-sovereignty-t1-DmX6oKNg.webp",import.meta.url).href,DA=Object.freeze(Object.defineProperty({__proto__:null,default:Ure},Symbol.toStringTag,{value:"Module"})),qre=""+new URL("azure-sovereignty-t2-HrQch5a7.webp",import.meta.url).href,OA=Object.freeze(Object.defineProperty({__proto__:null,default:qre},Symbol.toStringTag,{value:"Module"})),Vre=""+new URL("azure-sovereignty-t3-DXjh05IZ.webp",import.meta.url).href,zA=Object.freeze(Object.defineProperty({__proto__:null,default:Vre},Symbol.toStringTag,{value:"Module"})),Hre=""+new URL("azure-sovereignty-t4-DGQWyj9i.webp",import.meta.url).href,BA=Object.freeze(Object.defineProperty({__proto__:null,default:Hre},Symbol.toStringTag,{value:"Module"})),Wre=""+new URL("azure-sovereignty-t5-DskYl0iv.webp",import.meta.url).href,FA=Object.freeze(Object.defineProperty({__proto__:null,default:Wre},Symbol.toStringTag,{value:"Module"})),Gre=""+new URL("azure-sovereignty-t6-B08urHNJ.webp",import.meta.url).href,UA=Object.freeze(Object.defineProperty({__proto__:null,default:Gre},Symbol.toStringTag,{value:"Module"})),Xre=""+new URL("crimson-dominion-t1-Vf8IUB_D.webp",import.meta.url).href,qA=Object.freeze(Object.defineProperty({__proto__:null,default:Xre},Symbol.toStringTag,{value:"Module"})),Yre=""+new URL("crimson-dominion-t2-R4fcfwor.webp",import.meta.url).href,VA=Object.freeze(Object.defineProperty({__proto__:null,default:Yre},Symbol.toStringTag,{value:"Module"})),Zre=""+new URL("crimson-dominion-t3-Dq48yda7.webp",import.meta.url).href,HA=Object.freeze(Object.defineProperty({__proto__:null,default:Zre},Symbol.toStringTag,{value:"Module"})),Kre=""+new URL("crimson-dominion-t4-jQ3WbC0q.webp",import.meta.url).href,WA=Object.freeze(Object.defineProperty({__proto__:null,default:Kre},Symbol.toStringTag,{value:"Module"})),Qre=""+new URL("crimson-dominion-t5-BxD0z7Ym.webp",import.meta.url).href,GA=Object.freeze(Object.defineProperty({__proto__:null,default:Qre},Symbol.toStringTag,{value:"Module"})),Jre=""+new URL("crimson-dominion-t6-DdFNyKQB.webp",import.meta.url).href,XA=Object.freeze(Object.defineProperty({__proto__:null,default:Jre},Symbol.toStringTag,{value:"Module"})),$re=""+new URL("emerald-collective-t1-BFDYbRJC.webp",import.meta.url).href,YA=Object.freeze(Object.defineProperty({__proto__:null,default:$re},Symbol.toStringTag,{value:"Module"})),ene=""+new URL("emerald-collective-t2-B0HN4oSa.webp",import.meta.url).href,ZA=Object.freeze(Object.defineProperty({__proto__:null,default:ene},Symbol.toStringTag,{value:"Module"})),tne=""+new URL("emerald-collective-t3-bX8hcHMX.webp",import.meta.url).href,KA=Object.freeze(Object.defineProperty({__proto__:null,default:tne},Symbol.toStringTag,{value:"Module"})),rne=""+new URL("emerald-collective-t4-Bfmm0OcF.webp",import.meta.url).href,QA=Object.freeze(Object.defineProperty({__proto__:null,default:rne},Symbol.toStringTag,{value:"Module"})),nne=""+new URL("emerald-collective-t5-Bgb0YdAC.webp",import.meta.url).href,JA=Object.freeze(Object.defineProperty({__proto__:null,default:nne},Symbol.toStringTag,{value:"Module"})),ane=""+new URL("emerald-collective-t6-BTeZLW--.webp",import.meta.url).href,$A=Object.freeze(Object.defineProperty({__proto__:null,default:ane},Symbol.toStringTag,{value:"Module"})),sne=""+new URL("golden-imperium-t1-2Ac07vhL.webp",import.meta.url).href,ek=Object.freeze(Object.defineProperty({__proto__:null,default:sne},Symbol.toStringTag,{value:"Module"})),one=""+new URL("golden-imperium-t2-B1z9wYCA.webp",import.meta.url).href,tk=Object.freeze(Object.defineProperty({__proto__:null,default:one},Symbol.toStringTag,{value:"Module"})),ine=""+new URL("golden-imperium-t3-sQgzUnhL.webp",import.meta.url).href,rk=Object.freeze(Object.defineProperty({__proto__:null,default:ine},Symbol.toStringTag,{value:"Module"})),lne=""+new URL("golden-imperium-t4-QLhb8vtv.webp",import.meta.url).href,nk=Object.freeze(Object.defineProperty({__proto__:null,default:lne},Symbol.toStringTag,{value:"Module"})),cne=""+new URL("golden-imperium-t5-ztz2kNG1.webp",import.meta.url).href,ak=Object.freeze(Object.defineProperty({__proto__:null,default:cne},Symbol.toStringTag,{value:"Module"})),une=""+new URL("golden-imperium-t6-Cw2Zjnaw.webp",import.meta.url).href,sk=Object.freeze(Object.defineProperty({__proto__:null,default:une},Symbol.toStringTag,{value:"Module"})),dne=""+new URL("silver-pact-t1-dcR9QgEE.webp",import.meta.url).href,ok=Object.freeze(Object.defineProperty({__proto__:null,default:dne},Symbol.toStringTag,{value:"Module"})),pne=""+new URL("silver-pact-t2-BpNmnrg8.webp",import.meta.url).href,ik=Object.freeze(Object.defineProperty({__proto__:null,default:pne},Symbol.toStringTag,{value:"Module"})),fne=""+new URL("silver-pact-t3-wI2PlS3S.webp",import.meta.url).href,lk=Object.freeze(Object.defineProperty({__proto__:null,default:fne},Symbol.toStringTag,{value:"Module"})),mne=""+new URL("silver-pact-t4-BCVdufU2.webp",import.meta.url).href,ck=Object.freeze(Object.defineProperty({__proto__:null,default:mne},Symbol.toStringTag,{value:"Module"})),hne=""+new URL("silver-pact-t5-CvVwxwL3.webp",import.meta.url).href,uk=Object.freeze(Object.defineProperty({__proto__:null,default:hne},Symbol.toStringTag,{value:"Module"})),gne=""+new URL("silver-pact-t6-AkEiFdAv.webp",import.meta.url).href,dk=Object.freeze(Object.defineProperty({__proto__:null,default:gne},Symbol.toStringTag,{value:"Module"})),yne=""+new URL("void-enclave-t1-CT6bXzYA.webp",import.meta.url).href,pk=Object.freeze(Object.defineProperty({__proto__:null,default:yne},Symbol.toStringTag,{value:"Module"})),bne=""+new URL("void-enclave-t2-B5lyWeE-.webp",import.meta.url).href,fk=Object.freeze(Object.defineProperty({__proto__:null,default:bne},Symbol.toStringTag,{value:"Module"})),vne=""+new URL("void-enclave-t3-D_btJABX.webp",import.meta.url).href,mk=Object.freeze(Object.defineProperty({__proto__:null,default:vne},Symbol.toStringTag,{value:"Module"})),_ne=""+new URL("void-enclave-t4-CnK-DAE8.webp",import.meta.url).href,hk=Object.freeze(Object.defineProperty({__proto__:null,default:_ne},Symbol.toStringTag,{value:"Module"})),wne=""+new URL("void-enclave-t5-BazUHlmh.webp",import.meta.url).href,gk=Object.freeze(Object.defineProperty({__proto__:null,default:wne},Symbol.toStringTag,{value:"Module"})),xne=""+new URL("void-enclave-t6-DftImh4t.webp",import.meta.url).href,yk=Object.freeze(Object.defineProperty({__proto__:null,default:xne},Symbol.toStringTag,{value:"Module"})),YL=za();async function Ane(){try{const e=await Jn(),t=await fetch(`${YL}/api/heroes/mine`,{credentials:"include",headers:e?{Authorization:`Bearer ${e}`}:{}});return t.ok?(await t.json()).heroes:[]}catch{return[]}}async function kne(e){try{const t=await Jn(),r=await fetch(`${YL}/api/heroes/buy`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",...t?{Authorization:`Bearer ${t}`}:{}},body:JSON.stringify({heroId:e})});if(r.ok){const s=await r.json();return{ok:!0,hero:s.hero,balance:s.balance}}return{ok:!1,error:(await r.json().catch(()=>({error:"UNKNOWN"}))).error}}catch{return{ok:!1,error:"NETWORK_ERROR"}}}const ZL={1:"Recruit",2:"Guardian",3:"Commander",4:"Warlord",5:"Champion",6:"Legend"},KL={"crimson-dominion":"offense","silver-pact":"balanced","azure-sovereignty":"defense","golden-imperium":"offense","emerald-collective":"defense","void-enclave":"balanced"},QL={1:{cost:500,baseAttack:.05,baseDefense:.05},2:{cost:1500,baseAttack:.12,baseDefense:.1},3:{cost:4e3,baseAttack:.2,baseDefense:.18},4:{cost:1e4,baseAttack:.3,baseDefense:.25},5:{cost:25e3,baseAttack:.42,baseDefense:.35},6:{cost:6e4,baseAttack:.55,baseDefense:.45}},Sne=.08,Ene=.05,Pne=.05,Cne=.08;function El(e,t){const r=QL[t],n=KL[e];let s=r.baseAttack,o=r.baseDefense;return n==="offense"?(s+=Sne,o=Math.max(0,o-Ene)):n==="defense"&&(s=Math.max(0,s-Pne),o+=Cne),{attack:s,defense:o}}const bk=[{id:"crimson-dominion-t1",name:"Firebrand",empire:"crimson-dominion",tier:1,title:"Ember Initiate",description:"A young recruit who proved their worth by walking barefoot across the Molten Flats. Their burning resolve lights the way for greener soldiers."},{id:"crimson-dominion-t2",name:"Scorcher",empire:"crimson-dominion",tier:2,title:"Flame Warden",description:"Keeper of the Crimson Watch-fires that never extinguish. Scorcher patrols the volcanic borderlands, turning intruders to cinder."},{id:"crimson-dominion-t3",name:"Inferno",empire:"crimson-dominion",tier:3,title:"Blaze Commander",description:"Forged in the eruption of Mount Karath, Inferno commands battalions of flame-sworn soldiers and leaves scorched earth in every campaign."},{id:"crimson-dominion-t4",name:"Warmaster",empire:"crimson-dominion",tier:4,title:"Crimson General",description:"A tactical genius who orchestrated the Siege of Ashhold with zero retreats. Warmaster's battle plans are studied in every war academy."},{id:"crimson-dominion-t5",name:"Hellion",empire:"crimson-dominion",tier:5,title:"Infernal Champion",description:"Born from the heart of a dying star, Hellion wields twin blades that burn with an unquenchable fury feared across all six empires."},{id:"crimson-dominion-t6",name:"Pyraxus the Eternal",empire:"crimson-dominion",tier:6,title:"Legendary Firelord",description:"Ancient beyond reckoning, Pyraxus has razed and rebuilt the Dominion three times over. They say his heartbeat is the pulse of every volcano."},{id:"silver-pact-t1",name:"Scout",empire:"silver-pact",tier:1,title:"Pact Initiate",description:"Fleet-footed messenger of the Silver Council, trained to navigate the Mirrored Wastes where no compass works."},{id:"silver-pact-t2",name:"Ranger",empire:"silver-pact",tier:2,title:"Silver Blade",description:"Dual-wielding outrider who guards the trade caravans between allied territories. Ranger never sleeps twice in the same camp."},{id:"silver-pact-t3",name:"Sentinel",empire:"silver-pact",tier:3,title:"Pact Commander",description:"Sentinel holds the Argent Bridge—the only passage between the eastern and western realms—and has never let it fall."},{id:"silver-pact-t4",name:"Vanguard",empire:"silver-pact",tier:4,title:"Silver Warlord",description:"A decorated strategist who united three feuding clans under a single banner. Vanguard fights at the front, never from behind."},{id:"silver-pact-t5",name:"Arbiter",empire:"silver-pact",tier:5,title:"Swift Champion",description:"Judge and executioner sworn to the Pact's highest law. Arbiter can settle any dispute—by word or by blade—before sunset."},{id:"silver-pact-t6",name:"Lysara the Swift",empire:"silver-pact",tier:6,title:"Legendary Arbiter",description:"They say Lysara once outran a thunderbolt. Her silver armor is woven from moonlight, and her judgement is absolute."},{id:"azure-sovereignty-t1",name:"Acolyte",empire:"azure-sovereignty",tier:1,title:"Azure Initiate",description:"A student of the Tidal Archives who channels the sea's patience into unbreakable wards."},{id:"azure-sovereignty-t2",name:"Scholar",empire:"azure-sovereignty",tier:2,title:"Wisdom Keeper",description:"Keeper of the Sovereignty's forbidden scrolls. Scholar can recite ten thousand defensive runes from memory."},{id:"azure-sovereignty-t3",name:"Archon",empire:"azure-sovereignty",tier:3,title:"Shield Commander",description:"Archon raised the Great Coral Barrier that protects the capital from siege. Armies break against their shields like waves on rock."},{id:"azure-sovereignty-t4",name:"High Sage",empire:"azure-sovereignty",tier:4,title:"Azure Warlord",description:"Master of deep-water strategy, High Sage commands from the sunken war-temple and sees every battlefield through enchanted tide pools."},{id:"azure-sovereignty-t5",name:"Oracle",empire:"azure-sovereignty",tier:5,title:"Aegis Champion",description:"Gifted with foresight drawn from the Abyssal Currents, Oracle has never been struck by a blow they did not choose to receive."},{id:"azure-sovereignty-t6",name:"Thalonis the Wise",empire:"azure-sovereignty",tier:6,title:"Legendary Archon",description:"First of the Azure bloodline, Thalonis shaped the ocean floor into fortress walls. His wisdom echoes in every crashing wave."},{id:"golden-imperium-t1",name:"Merchant",empire:"golden-imperium",tier:1,title:"Gold Initiate",description:"Sharp-eyed trader who turned a single coin into an armory. Merchant knows that every war is won in the marketplace first."},{id:"golden-imperium-t2",name:"Baron",empire:"golden-imperium",tier:2,title:"Gold Baron",description:"Lavish and ruthless, Baron controls the amber mines that fund the Imperium's endless expansion."},{id:"golden-imperium-t3",name:"Magnate",empire:"golden-imperium",tier:3,title:"Imperial Commander",description:"Magnate's golden legions march in gilded armor that blinds their foes before a single blow is struck."},{id:"golden-imperium-t4",name:"Overlord",empire:"golden-imperium",tier:4,title:"Gold Warlord",description:"Ruler of the Sunspire Citadel, Overlord levies tribute from three continents and crushes dissent with coin or cannon."},{id:"golden-imperium-t5",name:"Tyrant",empire:"golden-imperium",tier:5,title:"Imperial Champion",description:"Tyrant seized power in a single night and has held it ever since. Their throne is forged from the weapons of fallen rivals."},{id:"golden-imperium-t6",name:"Aurelion the Gilded",empire:"golden-imperium",tier:6,title:"Legendary Emperor",description:"The immortal founder of the Imperium whose golden touch once blessed an entire kingdom. Aurelion's riches are said to be infinite."},{id:"emerald-collective-t1",name:"Seedling",empire:"emerald-collective",tier:1,title:"Grove Initiate",description:"Freshly bonded to the Great Root network, Seedling can feel enemy footsteps through the forest floor."},{id:"emerald-collective-t2",name:"Warden",empire:"emerald-collective",tier:2,title:"Root Warden",description:"Guardian of the Thornwall Perimeter, Warden commands living vines that entangle trespassers before they see daylight."},{id:"emerald-collective-t3",name:"Keeper",empire:"emerald-collective",tier:3,title:"Forest Commander",description:"Keeper orchestrates the ancient treant legions that have defended the Verdant Heartland for a thousand seasons."},{id:"emerald-collective-t4",name:"Elder",empire:"emerald-collective",tier:4,title:"Grove Warlord",description:"Centuries old and rooted deep, Elder channels the strength of the entire forest canopy into impenetrable bark-shields."},{id:"emerald-collective-t5",name:"Primarch",empire:"emerald-collective",tier:5,title:"Nature Champion",description:"Primarch is both judge and jury of the Collective, wielding nature's wrath—storms, quakes, and regrowth—as weapons of war."},{id:"emerald-collective-t6",name:"Verdaxis the Rooted",empire:"emerald-collective",tier:6,title:"Legendary Primarch",description:"The oldest living being in any realm, Verdaxis remembers the world before empires. Their roots span continents and their canopy shelters nations."},{id:"void-enclave-t1",name:"Shade",empire:"void-enclave",tier:1,title:"Shadow Initiate",description:"A whisper in the dark, Shade slips between dimensions to gather secrets that others would kill to keep."},{id:"void-enclave-t2",name:"Wraith",empire:"void-enclave",tier:2,title:"Void Stalker",description:"Neither alive nor dead, Wraith haunts the space between worlds and strikes from angles that shouldn't exist."},{id:"void-enclave-t3",name:"Specter",empire:"void-enclave",tier:3,title:"Shadow Commander",description:"Specter leads the Hollow Legion—an army that leaves no footprints, casts no shadows, and takes no prisoners."},{id:"void-enclave-t4",name:"Revenant",empire:"void-enclave",tier:4,title:"Void Warlord",description:"Killed seven times and returned each dawn, Revenant has forgotten the meaning of defeat. Death itself refuses them."},{id:"void-enclave-t5",name:"Phantom",empire:"void-enclave",tier:5,title:"Shadow Champion",description:"Phantom exists in all places at once, a living paradox whose attacks land before they are even launched."},{id:"void-enclave-t6",name:"Nyx the Unseen",empire:"void-enclave",tier:6,title:"Legendary Phantom",description:"No one has ever truly seen Nyx—only the aftermath. The Enclave's eternal sovereign rules from a throne that exists outside of time."}],Ta=Object.fromEntries(bk.map(e=>[e.id,e]));function dw(e){return bk.filter(t=>t.empire===e)}function vk(){const[e,t]=l.useState([]),[r,n]=l.useState(!0),[s,o]=l.useState(!1),i=l.useCallback(async()=>{n(!0);const d=await Ane();t(d),n(!1)},[]);l.useEffect(()=>{i()},[i]);const c=l.useMemo(()=>new Set(e.map(d=>d.heroId)),[e]),u=l.useCallback(async d=>{if(s)return{ok:!1,error:"BUSY"};o(!0);const f=await kne(d);return f.ok&&t(m=>[...m,f.hero]),o(!1),f},[s]),p=l.useCallback(d=>{const f=e.filter(m=>m.empire===d);return f.length===0?null:f.reduce((m,h)=>h.tier>m.tier?h:m)},[e]);return{roster:bk,owned:e,ownedIds:c,loading:r,buying:s,buy:u,refresh:i,bestHeroForEmpire:p,getHeroModifiers:El,HERO_TIER_STATS:QL,HERO_BY_ID:Ta,getHeroesForEmpire:dw}}const wi={"crimson-dominion":{name:"The Crimson Dominion",motto:"Through fire, sovereignty.",lore:"Born from the ashes of the First Stellar Collapse, the Crimson Dominion rose when Warlord Drakon unified the warring clans of the Pyrrhus Nebula under a single blood-red banner. Their empire is built on a rigid military caste — every citizen is a soldier first. The Dominion believes that only through relentless conquest can order be imposed on the chaos of the galaxy. Their dreadnought fleets are feared across every quadrant, and their dragon sigil has become synonymous with overwhelming force."},"silver-pact":{name:"The Silver Pact",motto:"Swift wings, sharp eyes.",lore:"The Silver Pact began as a coalition of independent traders and scouts who banded together for mutual defence along the Frostline Corridor. Over centuries, their mercantile federation evolved into a formidable intelligence network. Pact operatives are the fastest pilots in the galaxy, flying interceptor-class vessels that strike before enemies can react. They value freedom, speed, and information above all else — and they never forget a debt."},"azure-sovereignty":{name:"The Azure Sovereignty",motto:"Wisdom crowns the worthy.",lore:"The oldest surviving civilisation in the Zentara sector, the Azure Sovereignty traces its lineage to the philosopher-kings of Oceanus Prime. Their society is governed by the Council of Stars — twelve scholars elected by merit alone. The Sovereignty commands titan-class war machines fused with ancient technology that no other faction has been able to replicate. They fight not for conquest, but to preserve the knowledge and balance of the galaxy."},"golden-imperium":{name:"The Golden Imperium",motto:"All stars bow to gold.",lore:"What began as the wealthiest mining corporation in the outer rim became a galactic superpower when Emperor Aurelian declared independence from the old republic. The Golden Imperium controls the largest reserve of Zentarium — the rare element that powers warp drives. Their opulent battle cruisers are gilded monuments to excess, but beneath the splendour lies ruthless economic warfare. They buy what they cannot conquer, and conquer what they cannot buy."},"emerald-collective":{name:"The Emerald Collective",motto:"One root, infinite branches.",lore:"The Collective emerged from the bio-engineered forest worlds of the Verdant Reach, where sentient plant-networks achieved consciousness and merged with their human custodians. Every member of the Collective shares a faint psychic bond through the Root — a living neural web that spans their territory. They deploy colossal bio-mechanical walkers that regenerate in battle. The Collective does not seek dominion; it seeks to grow, to connect, and to outlast all others."},"void-enclave":{name:"The Void Enclave",motto:"From shadow, certainty.",lore:"No one knows when the Void Enclave was truly founded — that is by design. Operating from cloaked stations hidden in the darkest reaches of uncharted space, the Enclave is part spy network, part cult, part shadow government. Their stealth destroyers can phase through sensor grids undetected. Led by the enigmatic Archon, they manipulate galactic politics from the shadows. By the time you see the Enclave, they have already won."}};function Yr(e){var t;return((t=wi[e])==null?void 0:t.name)??"Unknown Fleet"}const _k=""+new URL("piece_0-Bszryx6y.webp",import.meta.url).href,wk=""+new URL("piece_1-Cv-uF1qp.webp",import.meta.url).href,xk=""+new URL("piece_2-BtsgKQre.webp",import.meta.url).href,Ak=""+new URL("piece_3-jPIn8UPt.webp",import.meta.url).href,kk=""+new URL("piece_4-CVIaULeN.webp",import.meta.url).href,Sk=""+new URL("piece_5-BbmWhI1d.webp",import.meta.url).href,Rne=""+new URL("board_azure_t1-uhzyJ5O2.png",import.meta.url).href,Tne=""+new URL("board_azure_t2-7WFg6SFe.png",import.meta.url).href,jne=""+new URL("board_azure_t3-DFyQ1yFA.png",import.meta.url).href,Ine=""+new URL("board_azure_t4--LjmjFOc.png",import.meta.url).href,Nne=""+new URL("board_azure_t5-kCVv9B_8.png",import.meta.url).href,Mne=""+new URL("board_azure_t6-JV5uCTqU.png",import.meta.url).href,Lne=""+new URL("board_crimson_t1-BwxUw8u0.png",import.meta.url).href,Dne=""+new URL("board_crimson_t2-6NEJAqMc.png",import.meta.url).href,One=""+new URL("board_crimson_t3-BWlzMzt2.png",import.meta.url).href,zne=""+new URL("board_crimson_t4-D8Jc5yCO.png",import.meta.url).href,Bne=""+new URL("board_crimson_t5-D6RFLgkV.png",import.meta.url).href,Fne=""+new URL("board_crimson_t6-gnYH98X_.png",import.meta.url).href,Une=""+new URL("board_emerald_t1-B2egbD2-.png",import.meta.url).href,qne=""+new URL("board_emerald_t2-BQCAt0fS.png",import.meta.url).href,Vne=""+new URL("board_emerald_t3-Bi2inM_Z.png",import.meta.url).href,Hne=""+new URL("board_emerald_t4-Fpn-yafL.png",import.meta.url).href,Wne=""+new URL("board_emerald_t5-ChEu-JPO.png",import.meta.url).href,Gne=""+new URL("board_emerald_t6-C6qK5wVr.png",import.meta.url).href,Xne=""+new URL("board_golden_t1-wUo-Md-J.png",import.meta.url).href,Yne=""+new URL("board_golden_t2-DpOComt8.png",import.meta.url).href,Zne=""+new URL("board_golden_t3-Cr04-aIZ.png",import.meta.url).href,Kne=""+new URL("board_golden_t4-DmLVdFD-.png",import.meta.url).href,Qne=""+new URL("board_golden_t5-BO_7glbk.png",import.meta.url).href,Jne=""+new URL("board_golden_t6-Cn2N92HZ.png",import.meta.url).href,$ne=""+new URL("board_silver_t1-Dk3k-NaJ.png",import.meta.url).href,eae=""+new URL("board_silver_t2-gY9z7Ocy.png",import.meta.url).href,tae=""+new URL("board_silver_t3-DxuzmvQw.png",import.meta.url).href,rae=""+new URL("board_silver_t4-CkoaQVfe.png",import.meta.url).href,nae=""+new URL("board_silver_t5-B63wrBnz.png",import.meta.url).href,aae=""+new URL("board_silver_t6-cX56Pc6H.png",import.meta.url).href,sae=""+new URL("board_void_t1-DDec7uko.png",import.meta.url).href,oae=""+new URL("board_void_t2-HWwY4zjd.png",import.meta.url).href,iae=""+new URL("board_void_t3-Bm65kPQF.png",import.meta.url).href,lae=""+new URL("board_void_t4-DpFcFdts.png",import.meta.url).href,cae=""+new URL("board_void_t5-4mh4n7wE.png",import.meta.url).href,uae=""+new URL("board_void_t6-BnFIOu4n.png",import.meta.url).href,Ri={MINIMAP_STEP_MS:150,FLIGHT_DURATION_MS:3350,LIFTOFF_DELAY_MS:1e3,BOARD_ROTATE_MS:1500,SNAP_BUFFER_MS:50,LAND_PHASE_MS:800,DESTROY_BLAST_MS:1300},dae=""+new URL("board_crimson-Bbfxhd3p.webp",import.meta.url).href,pae=""+new URL("board_silver-Cng7mb9O.webp",import.meta.url).href,fae=""+new URL("board_azure-BFKhjmxp.webp",import.meta.url).href,mae=""+new URL("board_golden-CanbSjjJ.webp",import.meta.url).href,hae=""+new URL("board_emerald-DJHSvo6l.webp",import.meta.url).href,gae=""+new URL("board_void-5g3WxUBA.webp",import.meta.url).href,yae=""+new URL("board_crimson_still-iwJEtNQX.webp",import.meta.url).href,bae=""+new URL("board_silver_still-BzHbQUh7.webp",import.meta.url).href,vae=""+new URL("board_azure_still-W7WJD2Dq.webp",import.meta.url).href,_ae=""+new URL("board_golden_still-CYKBiKVV.webp",import.meta.url).href,wae=""+new URL("board_emerald_still-Cf5Bc4Q4.webp",import.meta.url).href,xae=""+new URL("board_void_still-C_C-otYo.webp",import.meta.url).href,Aae=Object.assign({"../../assets/optimized/board_azure_t1.png":Rne,"../../assets/optimized/board_azure_t2.png":Tne,"../../assets/optimized/board_azure_t3.png":jne,"../../assets/optimized/board_azure_t4.png":Ine,"../../assets/optimized/board_azure_t5.png":Nne,"../../assets/optimized/board_azure_t6.png":Mne,"../../assets/optimized/board_crimson_t1.png":Lne,"../../assets/optimized/board_crimson_t2.png":Dne,"../../assets/optimized/board_crimson_t3.png":One,"../../assets/optimized/board_crimson_t4.png":zne,"../../assets/optimized/board_crimson_t5.png":Bne,"../../assets/optimized/board_crimson_t6.png":Fne,"../../assets/optimized/board_emerald_t1.png":Une,"../../assets/optimized/board_emerald_t2.png":qne,"../../assets/optimized/board_emerald_t3.png":Vne,"../../assets/optimized/board_emerald_t4.png":Hne,"../../assets/optimized/board_emerald_t5.png":Wne,"../../assets/optimized/board_emerald_t6.png":Gne,"../../assets/optimized/board_golden_t1.png":Xne,"../../assets/optimized/board_golden_t2.png":Yne,"../../assets/optimized/board_golden_t3.png":Zne,"../../assets/optimized/board_golden_t4.png":Kne,"../../assets/optimized/board_golden_t5.png":Qne,"../../assets/optimized/board_golden_t6.png":Jne,"../../assets/optimized/board_silver_t1.png":$ne,"../../assets/optimized/board_silver_t2.png":eae,"../../assets/optimized/board_silver_t3.png":tae,"../../assets/optimized/board_silver_t4.png":rae,"../../assets/optimized/board_silver_t5.png":nae,"../../assets/optimized/board_silver_t6.png":aae,"../../assets/optimized/board_void_t1.png":sae,"../../assets/optimized/board_void_t2.png":oae,"../../assets/optimized/board_void_t3.png":iae,"../../assets/optimized/board_void_t4.png":lae,"../../assets/optimized/board_void_t5.png":cae,"../../assets/optimized/board_void_t6.png":uae}),JL={};for(const[e,t]of Object.entries(Aae)){const r=e.split("/").pop();r&&(JL[r]=t)}const kae={"crimson-dominion":"crimson","silver-pact":"silver","azure-sovereignty":"azure","golden-imperium":"golden","emerald-collective":"emerald","void-enclave":"void"};function Sae(e,t,r){const n=kae[e];return JL[`board_${n}_t${t}.png`]??r}const Eae={"crimson-dominion":dae,"silver-pact":pae,"azure-sovereignty":fae,"golden-imperium":mae,"emerald-collective":hae,"void-enclave":gae},$L={"crimson-dominion":yae,"silver-pact":bae,"azure-sovereignty":vae,"golden-imperium":_ae,"emerald-collective":wae,"void-enclave":xae},df=150,Ay=df*.75,Ku=Ay,Qu=Ay,Pae=.72,Cae=zr.getPlatform()==="android";for(const e of[...Object.values(Eae),...Object.values($L)]){const t=new Image;t.src=e}const Rae=1e3,Tae=350,eD=l.forwardRef(({initialX:e,initialY:t,shape:r,isCurrentPlayer:n,rotation:s=0,rotationTransition:o=!1,zoom:i=10,label:c,isMoving:u=!1,isLanding:p=!1,sizeScale:d=1,pickerPiece:f=!1,tier:m=1,outlineFilterId:h},b)=>{const g=Sae(r,m,$L[r]),[y,x]=l.useState(!1);l.useEffect(()=>{if(!u){x(!1);return}if(p){const R=setTimeout(()=>x(!1),Tae);return()=>clearTimeout(R)}const T=setTimeout(()=>x(!0),Rae);return()=>clearTimeout(T)},[u,p]);const v=u&&y,A=Math.min(Math.max(1,5/i),1.5),_=l.useMemo(()=>u?p?{transform:`scale(${d})`,transition:`transform ${Ri.LAND_PHASE_MS}ms cubic-bezier(0.42, 0, 0.32, 1)`,willChange:"transform"}:{transform:"scale(1)",transition:`transform ${Ri.LIFTOFF_DELAY_MS}ms cubic-bezier(0.25, 0.46, 0.45, 0.94)`,willChange:"transform"}:{transform:`scale(${d})`,transition:"transform 600ms ease-out",willChange:"transform"},[u,p,d]),w="zentara-piece-shadow",j={filter:"none"};return a.jsx("g",{ref:b,transform:`translate(${e},${t})`,children:a.jsx("g",{style:{transform:`scale(${A})`,transition:"transform 0.4s cubic-bezier(0.4, 0, 0.2, 1)",willChange:"transform"},children:a.jsx("g",{style:_,children:a.jsxs("g",{className:"zentara-piece-rotation",style:{transform:`rotate(${s}deg)`,transition:o?"transform 1.5s cubic-bezier(0.4, 0, 0.2, 1)":"none",willChange:"transform"},children:[a.jsxs("g",{transform:f?void 0:`scale(${Pae} 1)`,children:[u&&a.jsx("image",{className:`zentara-piece-shadow-img${!v||p?"":" zentara-piece-shadow-img--hidden"}`,href:g,x:-Ku/2,y:-Qu/2+Ay*.06,width:Ku,height:Qu,preserveAspectRatio:"xMidYMid meet",pointerEvents:"none",filter:`url(#${w})`}),a.jsxs("g",{className:u?"zentara-piece-fly":n?"zentara-piece-float":"",style:{willChange:"transform",transform:"translateZ(0)"},children:[!f&&h&&a.jsx("image",{className:`zentara-piece-outline${n?" zentara-piece-outline--active":""}`,href:g,x:-Ku/2,y:-Qu/2,width:Ku,height:Qu,preserveAspectRatio:"xMidYMid meet",pointerEvents:"none",filter:`url(#${h})`}),a.jsx("image",{className:`zentara-piece-img${n?" zentara-piece-img--active":""}${u?" zentara-piece-img--moving":""}`,href:g,x:f?-df:-Ku/2,y:f?-df:-Qu/2,width:f?df*2:Ku,height:f?df*2:Qu,preserveAspectRatio:"xMidYMid meet",style:j})]})]}),c&&(()=>{const T=c==="Cryosleep",R=T?"❄  CRYOSLEEP":"VISITING";return a.jsx("text",{x:0,y:Ay*.28,textAnchor:"middle",...Cae?{lengthAdjust:"spacingAndGlyphs",textLength:T?78:50}:{},className:`zentara-piece-label${T?" zentara-piece-label--cryo":" zentara-piece-label--visiting"}`,children:R})})()]})})})})});eD.displayName="ZentaraPlayerPiece";const tD=ot.memo(eD),LP={"crimson-dominion":_k,"silver-pact":wk,"azure-sovereignty":xk,"golden-imperium":Ak,"emerald-collective":kk,"void-enclave":Sk},jae=Object.assign({"../../assets/heroes/azure-sovereignty-t1.webp":DA,"../../assets/heroes/azure-sovereignty-t2.webp":OA,"../../assets/heroes/azure-sovereignty-t3.webp":zA,"../../assets/heroes/azure-sovereignty-t4.webp":BA,"../../assets/heroes/azure-sovereignty-t5.webp":FA,"../../assets/heroes/azure-sovereignty-t6.webp":UA,"../../assets/heroes/crimson-dominion-t1.webp":qA,"../../assets/heroes/crimson-dominion-t2.webp":VA,"../../assets/heroes/crimson-dominion-t3.webp":HA,"../../assets/heroes/crimson-dominion-t4.webp":WA,"../../assets/heroes/crimson-dominion-t5.webp":GA,"../../assets/heroes/crimson-dominion-t6.webp":XA,"../../assets/heroes/emerald-collective-t1.webp":YA,"../../assets/heroes/emerald-collective-t2.webp":ZA,"../../assets/heroes/emerald-collective-t3.webp":KA,"../../assets/heroes/emerald-collective-t4.webp":QA,"../../assets/heroes/emerald-collective-t5.webp":JA,"../../assets/heroes/emerald-collective-t6.webp":$A,"../../assets/heroes/golden-imperium-t1.webp":ek,"../../assets/heroes/golden-imperium-t2.webp":tk,"../../assets/heroes/golden-imperium-t3.webp":rk,"../../assets/heroes/golden-imperium-t4.webp":nk,"../../assets/heroes/golden-imperium-t5.webp":ak,"../../assets/heroes/golden-imperium-t6.webp":sk,"../../assets/heroes/silver-pact-t1.webp":ok,"../../assets/heroes/silver-pact-t2.webp":ik,"../../assets/heroes/silver-pact-t3.webp":lk,"../../assets/heroes/silver-pact-t4.webp":ck,"../../assets/heroes/silver-pact-t5.webp":uk,"../../assets/heroes/silver-pact-t6.webp":dk,"../../assets/heroes/void-enclave-t1.webp":pk,"../../assets/heroes/void-enclave-t2.webp":fk,"../../assets/heroes/void-enclave-t3.webp":mk,"../../assets/heroes/void-enclave-t4.webp":hk,"../../assets/heroes/void-enclave-t5.webp":gk,"../../assets/heroes/void-enclave-t6.webp":yk}),Xi={};for(const[e,t]of Object.entries(jae)){const r=e.split("/").pop().replace(".webp","");Xi[r]=t.default}const Ol={"crimson-dominion":"#ff3a3a","silver-pact":"#b0c4de","azure-sovereignty":"#4488ff","golden-imperium":"#ffaa00","emerald-collective":"#39ff14","void-enclave":"#cc44ff"},Iae=["crimson-dominion","silver-pact","azure-sovereignty","golden-imperium","emerald-collective","void-enclave"],rD=({taken:e=[],onSelect:t,heading:r,bestHeroForEmpire:n,onBack:s})=>{const[o,i]=l.useState(null),c=o&&n?n(o):null,u=c?Ta[c.heroId]:null,p=u?El(u.empire,u.tier):null,d=o?wi[o]:null,f=o?a.jsx("div",{className:"zpp__selected-piece",style:{"--faction-color":Ol[o]},children:a.jsx("svg",{viewBox:"-120 -60 240 120",preserveAspectRatio:"xMidYMid meet","aria-label":`${wi[o].name} board piece`,children:a.jsx(tD,{initialX:0,initialY:0,isCurrentPlayer:!0,shape:o,pickerPiece:!0,tier:(u==null?void 0:u.tier)??1})})}):null;return a.jsxs("div",{className:"zpp",children:[a.jsx("div",{className:"zpp__backdrop"}),a.jsxs("div",{className:"zpp__card",children:[a.jsxs("div",{className:"zpp__header",children:[s&&a.jsx("button",{type:"button",onClick:s,className:"zpp__back",children:"← Back"}),a.jsx("h2",{className:"zpp__heading",children:r??"Choose Your Empire"}),a.jsx("div",{className:"zpp__button-container",children:o?a.jsx("button",{className:"zpp__confirm",onClick:()=>t(o),children:"Start"}):a.jsx("button",{className:"zpp__confirm",disabled:!0,children:"Select"})})]}),a.jsx("div",{className:"zpp__faction-container",children:a.jsx("div",{className:"zpp__grid",children:Iae.map(m=>{const h=wi[m],b=Ol[m],g=e.includes(m),y=o===m;return a.jsxs("button",{className:`zpp__faction${y?" zpp__faction--selected":""}${g?" zpp__faction--taken":""}`,style:{"--faction-color":b},disabled:g,onClick:()=>i(m),title:g?`${h.name} (Taken)`:h.name,children:[a.jsx("img",{className:"zpp__piece-img",src:LP[m],alt:h.name}),a.jsx("span",{className:"zpp__name",children:h.name}),a.jsx("span",{className:"zpp__motto",children:h.motto}),g&&a.jsx("span",{className:"zpp__taken-badge",children:"Taken"})]},m)})})}),a.jsx("div",{className:"zpp__scroll-wrapper",children:o&&d&&a.jsxs("section",{className:"zpp__dossier",style:{"--faction-color":Ol[o]},children:[a.jsxs("div",{className:"zpp__dossier-summary",children:[a.jsx("div",{className:"zpp__portrait-frame",children:a.jsx("img",{src:u&&Xi[u.id]?Xi[u.id]:LP[o],alt:(u==null?void 0:u.name)??d.name,className:`zpp__portrait${u?"":" zpp__portrait--emblem"}`})}),a.jsxs("div",{className:"zpp__hero-info",children:[a.jsx("span",{className:"zpp__hero-label",children:u?"Equipped Hero":"Empire Fleet"}),a.jsx("span",{className:"zpp__hero-name",children:(u==null?void 0:u.name)??d.name}),a.jsx("span",{className:"zpp__hero-title",children:u?`${u.title} · ${ZL[u.tier]}`:d.motto}),p?a.jsxs("span",{className:"zpp__hero-stats",children:[a.jsxs("span",{children:["⚔ +",Math.round(p.attack*100),"%"]}),a.jsxs("span",{children:["🛡 +",Math.round(p.defense*100),"%"]})]}):a.jsx("span",{className:"zpp__hero-stats zpp__hero-stats--standard",children:"Standard command vessel"})]}),a.jsxs("div",{className:"zpp__ship-bay",children:[a.jsx("span",{className:"zpp__ship-label",children:"Flagship"}),f]})]}),a.jsx("p",{className:"zpp__lore",children:d.lore})]})})]})]})};var pw={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/
 */(function(e,t){(function(r,n){var s={};s.version="0.4.1",s.settings={currency:{symbol:"$",format:"%s%v",decimal:".",thousand:",",precision:2,grouping:3},number:{precision:0,grouping:3,thousand:",",decimal:"."}};var o=Array.prototype.map,i=Array.isArray,c=Object.prototype.toString;function u(A){return!!(A===""||A&&A.charCodeAt&&A.substr)}function p(A){return i?i(A):c.call(A)==="[object Array]"}function d(A){return A&&c.call(A)==="[object Object]"}function f(A,_){var w;A=A||{},_=_||{};for(w in _)_.hasOwnProperty(w)&&A[w]==null&&(A[w]=_[w]);return A}function m(A,_,w){var j=[],T,R;if(!A)return j;if(o&&A.map===o)return A.map(_,w);for(T=0,R=A.length;T<R;T++)j[T]=_.call(w,A[T],T,A);return j}function h(A,_){return A=Math.round(Math.abs(A)),isNaN(A)?_:A}function b(A){var _=s.settings.currency.format;return typeof A=="function"&&(A=A()),u(A)&&A.match("%v")?{pos:A,neg:A.replace("-","").replace("%v","-%v"),zero:A}:!A||!A.pos||!A.pos.match("%v")?u(_)?s.settings.currency.format={pos:_,neg:_.replace("%v","-%v"),zero:_}:_:A}var g=s.unformat=s.parse=function(A,_){if(p(A))return m(A,function(T){return g(T,_)});if(A=A||0,typeof A=="number")return A;_=_||s.settings.number.decimal;var w=new RegExp("[^0-9-"+_+"]",["g"]),j=parseFloat((""+A).replace(/\((.*)\)/,"-$1").replace(w,"").replace(_,"."));return isNaN(j)?0:j},y=s.toFixed=function(A,_){_=h(_,s.settings.number.precision);var w=Math.pow(10,_);return(Math.round(s.unformat(A)*w)/w).toFixed(_)},x=s.formatNumber=s.format=function(A,_,w,j){if(p(A))return m(A,function(M){return x(M,_,w,j)});A=g(A);var T=f(d(_)?_:{precision:_,thousand:w,decimal:j},s.settings.number),R=h(T.precision),P=A<0?"-":"",k=parseInt(y(Math.abs(A||0),R),10)+"",E=k.length>3?k.length%3:0;return P+(E?k.substr(0,E)+T.thousand:"")+k.substr(E).replace(/(\d{3})(?=\d)/g,"$1"+T.thousand)+(R?T.decimal+y(Math.abs(A),R).split(".")[1]:"")},v=s.formatMoney=function(A,_,w,j,T,R){if(p(A))return m(A,function(M){return v(M,_,w,j,T,R)});A=g(A);var P=f(d(_)?_:{symbol:_,precision:w,thousand:j,decimal:T,format:R},s.settings.currency),k=b(P.format),E=A>0?k.pos:A<0?k.neg:k.zero;return E.replace("%s",P.symbol).replace("%v",x(Math.abs(A),h(P.precision),P.thousand,P.decimal))};s.formatColumn=function(A,_,w,j,T,R){if(!A)return[];var P=f(d(_)?_:{symbol:_,precision:w,thousand:j,decimal:T,format:R},s.settings.currency),k=b(P.format),E=k.pos.indexOf("%s")<k.pos.indexOf("%v"),M=0,C=m(A,function(I,L){if(p(I))return s.formatColumn(I,P);I=g(I);var N=I>0?k.pos:I<0?k.neg:k.zero,S=N.replace("%s",P.symbol).replace("%v",x(Math.abs(I),h(P.precision),P.thousand,P.decimal));return S.length>M&&(M=S.length),S});return m(C,function(I,L){return u(I)&&I.length<M?E?I.replace(P.symbol,P.symbol+new Array(M-I.length+1).join(" ")):new Array(M-I.length+1).join(" ")+I:I})},e.exports&&(t=e.exports=s),t.accounting=s})()})(pw,pw.exports);var Nae=pw.exports;const ki=nx(Nae),Mae=Object.assign({"../../assets/heroes/azure-sovereignty-t1.webp":DA,"../../assets/heroes/azure-sovereignty-t2.webp":OA,"../../assets/heroes/azure-sovereignty-t3.webp":zA,"../../assets/heroes/azure-sovereignty-t4.webp":BA,"../../assets/heroes/azure-sovereignty-t5.webp":FA,"../../assets/heroes/azure-sovereignty-t6.webp":UA,"../../assets/heroes/crimson-dominion-t1.webp":qA,"../../assets/heroes/crimson-dominion-t2.webp":VA,"../../assets/heroes/crimson-dominion-t3.webp":HA,"../../assets/heroes/crimson-dominion-t4.webp":WA,"../../assets/heroes/crimson-dominion-t5.webp":GA,"../../assets/heroes/crimson-dominion-t6.webp":XA,"../../assets/heroes/emerald-collective-t1.webp":YA,"../../assets/heroes/emerald-collective-t2.webp":ZA,"../../assets/heroes/emerald-collective-t3.webp":KA,"../../assets/heroes/emerald-collective-t4.webp":QA,"../../assets/heroes/emerald-collective-t5.webp":JA,"../../assets/heroes/emerald-collective-t6.webp":$A,"../../assets/heroes/golden-imperium-t1.webp":ek,"../../assets/heroes/golden-imperium-t2.webp":tk,"../../assets/heroes/golden-imperium-t3.webp":rk,"../../assets/heroes/golden-imperium-t4.webp":nk,"../../assets/heroes/golden-imperium-t5.webp":ak,"../../assets/heroes/golden-imperium-t6.webp":sk,"../../assets/heroes/silver-pact-t1.webp":ok,"../../assets/heroes/silver-pact-t2.webp":ik,"../../assets/heroes/silver-pact-t3.webp":lk,"../../assets/heroes/silver-pact-t4.webp":ck,"../../assets/heroes/silver-pact-t5.webp":uk,"../../assets/heroes/silver-pact-t6.webp":dk,"../../assets/heroes/void-enclave-t1.webp":pk,"../../assets/heroes/void-enclave-t2.webp":fk,"../../assets/heroes/void-enclave-t3.webp":mk,"../../assets/heroes/void-enclave-t4.webp":hk,"../../assets/heroes/void-enclave-t5.webp":gk,"../../assets/heroes/void-enclave-t6.webp":yk}),fw={};for(const[e,t]of Object.entries(Mae)){const r=e.split("/").pop().replace(".webp","");fw[r]=t.default}const Lae=["crimson-dominion","silver-pact","azure-sovereignty","golden-imperium","emerald-collective","void-enclave"],Dae={"crimson-dominion":"🐉","silver-pact":"🦅","azure-sovereignty":"🔱","golden-imperium":"👑","emerald-collective":"🌿","void-enclave":"👁️"},Oae={offense:"⚔ Offense",defense:"🛡 Defense",balanced:"⚖ Balanced"},zae=({onClose:e})=>{const{roster:t,ownedIds:r,loading:n,buying:s,buy:o,HERO_TIER_STATS:i,getHeroModifiers:c}=vk(),{user:u,updateBalance:p}=Zr(),d=(u==null?void 0:u.balance)??0,[f,m]=l.useState("crimson-dominion"),[h,b]=l.useState(null),[g,y]=l.useState(null),x=l.useMemo(()=>t.filter(A=>A.empire===f).sort((A,_)=>A.tier-_.tier),[t,f]);l.useEffect(()=>{const A=[...x].reverse().find(_=>r.has(_.id));y(A??x[0]??null)},[x,r]);const v=async A=>{b(null);const _=await o(A.id);_.ok?(b({heroId:A.id}),p(_.balance)):b({heroId:A.id,error:_.error})};return a.jsxs("div",{className:"hero-shop",children:[a.jsx("div",{className:"hero-shop__backdrop",onClick:e}),a.jsxs("div",{className:"hero-shop__panel",children:[a.jsxs("div",{className:"hero-shop__header",children:[a.jsx("h2",{className:"hero-shop__title",children:"HERO COMMAND"}),a.jsxs("div",{className:"hero-shop__balance",children:["Balance: ",ki.formatMoney(d,"",0)]}),a.jsx("button",{className:"hero-shop__close",onClick:e,children:"✕"})]}),a.jsx("div",{className:"hero-shop__tabs",children:Lae.map(A=>{const _=wi[A],w=Ol[A],j=A===f;return a.jsxs("button",{className:`hero-shop__tab${j?" hero-shop__tab--active":""}`,style:{"--tab-color":w},onClick:()=>{m(A),b(null)},children:[a.jsx("span",{children:Dae[A]}),a.jsx("span",{className:"hero-shop__tab-name",children:_.name.replace("The ","")})]},A)})}),a.jsx("div",{className:"hero-shop__spec",children:Oae[KL[f]]??"Balanced"}),a.jsx("div",{className:"hero-shop__grid",children:n?a.jsx("div",{className:"hero-shop__loading",children:"Loading heroes…"}):x.map(A=>{const _=r.has(A.id),w=(g==null?void 0:g.id)===A.id;return a.jsxs("div",{className:`hero-card${_?" hero-card--owned":""}${w?" hero-card--selected":""}`,style:{"--card-color":Ol[A.empire]},onClick:()=>y(A),children:[fw[A.id]&&a.jsx("img",{src:fw[A.id],alt:A.name,className:"hero-card__img",loading:"lazy"}),_&&a.jsx("div",{className:"hero-card__owned-pip",children:"✓"})]},A.id)})}),g&&(()=>{const A=r.has(g.id),_=i[g.tier],w=c(g.empire,g.tier),j=d>=_.cost,T=(h==null?void 0:h.heroId)===g.id&&h.error,R=(h==null?void 0:h.heroId)===g.id&&!h.error;return a.jsxs("div",{className:"hero-detail",children:[a.jsxs("div",{className:"hero-detail__info",children:[a.jsxs("span",{className:"hero-detail__tier",children:["T",g.tier]}),a.jsx("span",{className:"hero-detail__name",children:g.name}),a.jsx("span",{className:"hero-detail__title",children:g.title}),a.jsx("p",{className:"hero-detail__desc",children:g.description}),a.jsxs("span",{className:"hero-detail__stats",children:[a.jsxs("span",{className:"hero-card__stat hero-card__stat--atk",children:["⚔ +",Math.round(w.attack*100),"%"]}),a.jsxs("span",{className:"hero-card__stat hero-card__stat--def",children:["🛡 +",Math.round(w.defense*100),"%"]})]})]}),A?a.jsx("div",{className:"hero-detail__owned",children:"OWNED"}):a.jsx("button",{className:"hero-card__buy-btn hero-detail__buy",disabled:s||!j,onClick:()=>v(g),children:s?"…":ki.formatMoney(_.cost,"",0)}),T&&a.jsx("span",{className:"hero-card__error",children:h.error==="INSUFFICIENT_CREDITS"?"Not enough credits":"Failed"}),R&&a.jsx("span",{className:"hero-card__success",children:"Recruited!"})]})})()]})]})};/*!
 * 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 Bae={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"]},Fae={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 Uae=Bae,qae=Fae,Vae=(()=>{try{const e=zr.getPlatform();return e==="ios"||e==="android"}catch{return!1}})(),DP="single_player_guest_id",OP="public_single_player_guest_id";function zP(e){if(!e)return null;try{const[,t]=e.split(".");if(!t)return null;const r=t.replace(/-/g,"+").replace(/_/g,"/"),n=r.padEnd(Math.ceil(r.length/4)*4,"="),s=JSON.parse(atob(n));return typeof(s==null?void 0:s.sub)=="string"&&s.sub?s.sub:null}catch{return null}}function Hae(){var r,n;try{const s=(r=window.localStorage)==null?void 0:r.getItem(OP);if(s)return s}catch{}const e=`guest_${Math.random().toString(36).slice(2)}_${Date.now().toString(36)}`,t=(()=>{var s;try{return((s=crypto.randomUUID)==null?void 0:s.call(crypto))||e}catch{return e}})();try{(n=window.localStorage)==null||n.setItem(OP,t)}catch{}return t}async function Wae(e){const t=await fetch(`${za()}/api/rooms/create-single`,{method:"POST",headers:{Accept:"application/json","Content-Type":"application/json"},credentials:"include",body:JSON.stringify({guestId:Hae(),name:e.name,maxPlayers:1,gameMode:e.gameMode})}),r=await t.json().catch(()=>({}));if(!t.ok)throw new Error((r==null?void 0:r.error)||"Failed to create guest room.");return r}let Ah=null;function gu(){const{available:e,progress:t,applyNow:r,later:n}=bJ(),{membershipModalOpen:s,setMembershipModalOpen:o}=wm(),i=Hr(),{roomsList:c,loading:u,createRoom:p,getGameRoute:d,refreshRooms:f}=ib(),{pokerCreateRoom:m,getUserBalance:h}=sa(),{logout:b,user:g,refreshUser:y}=Zr(),{friends:x}=sc(),{getTotalFriendUnread:v}=Dm(),A=l.useMemo(()=>v(x.map(Me=>Me.id)),[v,x]),{refresh:_}=SM();l.useEffect(()=>{_()},[_]);const[w,j]=l.useState(!1),[T,R]=l.useState(!1),[P,k]=l.useState(!1),[E,M]=l.useState(!1),[C,I]=l.useState(!1),[L,N]=l.useState(!1),S="ceelo",F=(()=>{try{return(window==null?void 0:window.APP_TARGET)??""}catch{return""}})(),D=(S||F).toString().toLowerCase().trim(),H=D==="craps"?"craps":D==="poker"?"poker":D==="skills"?"skills":D==="zentara"?"zentara":D==="cee-lo"||D==="ceelo"?"cee-lo":null,[W,G]=l.useState(H??Ah??null),[$,K]=l.useState(!1),[de,ie]=l.useState(!1),[we,he]=l.useState(!1),[Ae,Fe]=l.useState("wordsearch"),U=l.useRef(null),{info:V,error:z}=ji(),{clear:O}=As();l.useEffect(()=>{try{O()}catch{}},[O]),l.useEffect(()=>{H&&W!==H&&G(H)},[H,W]),l.useEffect(()=>{(async()=>{try{const{Preferences:Me}=await Cr(async()=>{const{Preferences:at}=await Promise.resolve().then(()=>Do);return{Preferences:at}},void 0,import.meta.url),{value:wt}=await Me.get({key:"selectedSkillsGameMode"});(wt==="wordsearch"||wt==="anagrams"||wt==="trivia")&&Fe(wt)}catch{}})()},[]),l.useEffect(()=>{if(!H){if(Ah){G(Ah);return}(async()=>{try{const{Preferences:Me}=await Cr(async()=>{const{Preferences:at}=await Promise.resolve().then(()=>Do);return{Preferences:at}},void 0,import.meta.url),{value:wt}=await Me.get({key:"selectedGameMode"});G(wt==="cee-lo"||wt==="craps"||wt==="poker"||wt==="skills"||wt==="zentara"?wt:"cee-lo")}catch{G("cee-lo")}})()}},[H]),l.useEffect(()=>{H||W&&(Ah=W,(async()=>{try{const{Preferences:Me}=await Cr(async()=>{const{Preferences:wt}=await Promise.resolve().then(()=>Do);return{Preferences:wt}},void 0,import.meta.url);await Me.set({key:"selectedGameMode",value:W})}catch{}})())},[W,H]),l.useEffect(()=>{H!=="zentara"&&ob({volume:.0125})},[H]),l.useEffect(()=>{const Me=()=>{window.scrollTo(0,0),document.body.scrollTop=0,document.documentElement.scrollTop=0;const Dt=document.getElementById("root");Dt&&(Dt.scrollTop=0)};Me();const wt=requestAnimationFrame(Me),at=setTimeout(Me,50);return()=>{cancelAnimationFrame(wt),clearTimeout(at)}},[]);const q=l.useMemo(()=>{const Me=H??W;if(!Me)return c;const wt=at=>at.filter(Dt=>(Dt.gameMode||"cee-lo")===Me);return{public:wt(c.public),private:wt(c.private)}},[c,H,W]),X=l.useRef(null),Z=l.useCallback(()=>{cr("Light")},[]),Q=l.useCallback(()=>{try{gi({volume:.5})}catch{}},[]),oe=l.useCallback(()=>{try{yn()}catch{}},[]),ce=l.useCallback(Me=>{oe(),Me!==W?(Z(),Q(),G(Me)):(Z(),Q())},[W,Z,Q,oe]),_e=l.useRef(null),re=l.useRef(null),[pe,ee]=l.useState(1),[xe,Le]=l.useState(null),Ge=l.useCallback(()=>{const Me=re.current,wt=_e.current;if(!Me||!wt)return;const at=Me.style.transform;Me.style.transform="none";const Dt=Me.scrollHeight,Ut=window.innerHeight;let ft=Math.min(1,Ut/Dt);ee(ft),Le(Dt*ft),Me.style.transform=at},[]);l.useLayoutEffect(()=>{Ge()},[Ge,W]),l.useEffect(()=>{const Me=new ResizeObserver(()=>requestAnimationFrame(Ge)),wt=re.current;wt&&Me.observe(wt),window.addEventListener("resize",Ge);const at=setTimeout(Ge,250),Dt=setTimeout(Ge,800);return()=>{Me.disconnect(),window.removeEventListener("resize",Ge),clearTimeout(at),clearTimeout(Dt)}},[Ge]);const _t=l.useCallback(()=>{i("/profile")},[i]),Xe=l.useCallback(()=>{i("/messages")},[i]);l.useCallback(()=>{i("/settings")},[i]);const bt=l.useCallback(()=>{i("/add-chips")},[i]),Pt=l.useCallback(()=>{i("/lounge")},[i]),kt=l.useCallback(()=>{i("/lobby")},[i]),Ee=l.useCallback(()=>{oe(),Z(),Q(),b()},[b,Z,Q,oe]),le=async()=>{var Me;try{const wt=g&&typeof g.balance=="number"?Number(g.balance):null;if(wt!=null)return wt;try{await Promise.resolve(y())}catch{}const at=g&&typeof g.balance=="number"?Number(g.balance):null;if(at!=null)return at}catch{}try{const wt=await(h==null?void 0:h());if(wt!=null&&wt.ok&&typeof((Me=wt.data)==null?void 0:Me.balance)=="number")return Number(wt.data.balance)}catch{}return null},De=l.useCallback(async Me=>{var at,Dt,Ut;const wt=(Me==null?void 0:Me.showToast)!==!1;if(g!=null&&g.id)return!0;try{let ft=await Jn().catch(()=>null);if(!ft){const dr=await w6();if(!(dr!=null&&dr.ok)||!dr.token)return wt&&V("Please sign in from home to start a game.",{duration:3e3}),!1;ft=dr.token,await Jc(ft);const Vt=((at=dr==null?void 0:dr.user)==null?void 0:at.id)||zP(ft);if(Vt)try{(Dt=window.sessionStorage)==null||Dt.setItem(DP,Vt)}catch{}}if(!ft)return wt&&V("Please sign in from home to start a game.",{duration:3e3}),!1;const wr=zP(ft);if(wr)try{(Ut=window.sessionStorage)==null||Ut.setItem(DP,wr)}catch{}try{const dr=bp();if(dr){if(!dr.connected&&dr.active)try{dr.disconnect()}catch{}dr.auth={token:ft},dr.__authSig=`t:${ft}`,dr.__allowCookieAuth=!1,is(dr,"HomeScreen:guest-single-player")}}catch{}return!0}catch(ft){return console.warn("[single-player] guest session failed",ft),wt&&V("Please sign in from home to start a game.",{duration:3e3}),!1}},[V,g==null?void 0:g.id]),Ye=l.useCallback(async()=>{oe(),Z(),Q(),console.log(g);try{if((g==null?void 0:g.isGuest)===!0){N(!0);return}}catch{}if(W==="poker")try{const Me=await le();if(Me!=null&&Me<1e3){K(!0);return}}catch{}R(!0)},[oe,Z,Q,W,g,y,o]),Re=l.useCallback(async()=>{console.log("[HomeScreen] handleOpenRooms called"),oe(),Z(),Q();try{if((g==null?void 0:g.isGuest)===!0){console.log("[HomeScreen] Guest gate triggered"),N(!0);return}}catch{}if(W==="poker")try{const Me=await le();if(Me!=null&&Me<1e3){K(!0);return}}catch{}console.log("[HomeScreen] Opening rooms modal"),f(),k(!0)},[oe,Z,Q,W,g,y,o,f]),et=l.useCallback(()=>{var wt;const Me=document.activeElement;(wt=Me==null?void 0:Me.blur)==null||wt.call(Me)},[]);l.useCallback(()=>{et(),Re()},[et,Re]),l.useCallback(()=>{et(),Ye()},[et,Ye]);const{meId:rt}=Zr(),ne=l.useCallback(async Me=>{var at,Dt,Ut;const wt=!!(Me!=null&&Me.fromQuickMatch);if(oe(),!!W&&!C){I(!0),ie(!0),Z(),Q(),U.current&&clearTimeout(U.current),U.current=window.setTimeout(()=>{ie(!1),V("Try again.",{duration:3e3})},15e3);try{let ft;const wr=await ma(),dr=wr.botDifficultyLevel&&wr.botDifficultyLevel>=1&&wr.botDifficultyLevel<=9?wr.botDifficultyLevel:void 0;if((W==="cee-lo"||W==="craps"||W==="poker")&&!await De({showToast:W==="poker"}))if(W==="cee-lo"||W==="craps")ft=await Wae({gameMode:W,name:"Single Player Room"});else return;switch(W){case"poker":ft=ft||await m({name:"Single Player Room",singlePlayer:!0,botLevel:dr});break;case"cee-lo":case"craps":ft=ft||await p({singlePlayer:!0,name:"Single Player Room",gameMode:W,botLevel:dr});break;case"skills":i(`/skills/play?mode=${Ae}`);return;case"zentara":i(`/zentara/match/${crypto.randomUUID()}${wt?"?qm=1":""}`);return;default:ft=await p({singlePlayer:!0,name:"Single Player Room"});break}try{window.location.search.includes("e2e=1")&&(window.__handleCreateSingleRes=ft)}catch{}const Vt=(ft==null?void 0:ft.room)??((at=ft==null?void 0:ft.roomsList)==null?void 0:at.room)??((Dt=ft==null?void 0:ft.data)==null?void 0:Dt.room)??null,Je=(()=>{var Te;try{return window.location.search.includes("e2e=1")||window.__E2E===!0||((Te=window.sessionStorage)==null?void 0:Te.getItem("e2e"))==="1"}catch{return!1}})(),mt=(Vt==null?void 0:Vt.roomId)??(Vt==null?void 0:Vt.id)??(ft==null?void 0:ft.roomId)??((Ut=ft==null?void 0:ft.data)==null?void 0:Ut.roomId);if(mt){if(U.current&&(clearTimeout(U.current),U.current=null),Vt)try{window.__PRESEEDED_ROOM=Vt}catch{}const Te=Je?"?e2e=1":"",Ve=d(W,mt)+Te;console.log(Ve,"roomPath",W),i(Ve)}else if(ft!=null&&ft.error){const Te=(()=>{var tt;try{return window.location.search.includes("e2e=1")||window.__E2E===!0||((tt=window.sessionStorage)==null?void 0:tt.getItem("e2e"))==="1"}catch{return!1}})(),Ve=String(ft.error||"");if(!Te&&/insufficient|minimum buy-in/i.test(Ve)){K(!0);return}}}catch(ft){console.warn(ft);const wr=(()=>{var dr;try{return window.location.search.includes("e2e=1")||window.__E2E===!0||((dr=window.sessionStorage)==null?void 0:dr.getItem("e2e"))==="1"}catch{return!1}})();if(wr){const dr=`e2e-${Math.random().toString(36).slice(2,8)}`;try{window.__handleCreateSingleRes={ok:!0,roomId:dr}}catch{}const Vt=wr?"&e2e=1":"";i(W==="poker"?`/poker/room/${dr}?m=${W}${Vt}`:`/room/${dr}?m=${W}${Vt}`)}else{const dr=String((ft==null?void 0:ft.message)??ft??"");/insufficient|minimum buy-in/i.test(dr)?K(!0):console.warn("[room:create] thrown",(ft==null?void 0:ft.message)??ft)}}finally{I(!1),ie(!1),U.current&&(clearTimeout(U.current),U.current=null)}}},[oe,p,Z,Q,i,C,W,rt,V,Ae,m,d,De]),ue=l.useCallback(Me=>()=>{oe(),Z(),Q(),Me()},[oe,Z,Q]);g==null||g.membershipTier;const B=!!g,fe=(()=>{try{return(g==null?void 0:g.isGuest)===!0}catch{return!1}})(),ye=l.useMemo(()=>{const Me=[{key:"chips",label:"Shop",onClick:ue(bt)}];return B&&!fe&&(Me.unshift({key:"profile",label:"Profile",onClick:ue(_t)}),Me.splice(1,0,{key:"messages",label:"Messages",onClick:ue(Xe),badge:A}),H==="cee-lo"&&Me.splice(1,0,{key:"lounge",label:"Lounge",onClick:ue(Pt)}),Me.push({key:"logout",label:"Log Out",onClick:ue(Ee)})),Me},[ue,_t,Xe,bt,Pt,Ee,B,fe,A,H]),[ve,ke]=l.useState(!1),[Ue,ct]=l.useState(!1),dt=l.useCallback(async Me=>{const wt=Me==="google"?ke:ct;wt(!0);try{try{await kj("");const at=za();await fetch(`${at}/api/auth/clear`,{method:"POST",credentials:"include"}).catch(()=>{})}catch{}if(Vae){const at=Me==="apple"?await Ed.signInWithAppleNative():await Ed.signInWithGoogleNative(),Dt=za(),Ut=await fetch(`${Dt}/api/auth/oauth/mobile-verify`,{method:"POST",credentials:"include",headers:{"Content-Type":"application/json",Accept:"application/json"},body:JSON.stringify({provider:at.provider,idToken:at.idToken,email:at.email,name:at.name})});if(!Ut.ok)throw new Error("Native verify failed");const ft=await Ut.json();if(ft!=null&&ft.ok&&(ft!=null&&ft.token)){try{await Jc(ft.token)}catch{}await y({force:!0})}else throw new Error("No token")}else await _6(Me)}catch(at){console.warn("[home-auth]",Me,(at==null?void 0:at.message)??at),z("Sign-in failed. Please try again.")}finally{wt(!1)}},[y,z]),[Rt,jr]=l.useState(!1);l.useEffect(()=>{(H??W)==="zentara"&&jr(Fre())},[H,W]);const Qe=l.useCallback(()=>{const Me=XL();Me&&i(`/zentara/match/${Me.matchId}`)},[i]),Mt=l.useCallback(Me=>{Me.stopPropagation(),oe(),Z(),Q(),M(wt=>!wt)},[oe,Z,Q]),lr=l.useCallback(()=>M(!1),[]),zt=l.useCallback(()=>R(!1),[]),br=l.useCallback(()=>k(!1),[]),fr=l.useCallback(()=>o(!1),[o]),[ur,Ie]=l.useState(!1),yt=l.useCallback(()=>{oe(),Z(),Q(),Ie(!0)},[oe,Z,Q]),St=l.useCallback(()=>Ie(!1),[]),[Xt,se]=l.useState(!1),je=l.useCallback(()=>{oe(),Z(),Q(),se(!0)},[oe,Z,Q]),Oe=l.useCallback(()=>se(!1),[]),Ke=H==="zentara"?"theme-zentara":H==="skills"?"theme-skills":"theme-casino";return a.jsxs("div",{className:`HomeScreen ${Ke} home-fixed-root`,children:[a.jsx(Ja,{className:"page-home-screen"}),a.jsx(_J,{}),a.jsx(SJ,{}),a.jsxs("div",{className:"logout-container home-header-row",children:[a.jsxs("a",{id:"btn-how-to-play",className:"home-header-link",title:"How to Play","aria-label":"How to Play",onClick:yt,role:"button",children:[a.jsx("img",{src:EJ,alt:"How to Play",className:"home-header-icon"}),a.jsx("span",{className:"home-header-link-label",children:"Help"})]}),a.jsxs("button",{className:"home-header-leaderboard",onClick:je,"aria-label":"View Leaderboards",type:"button",children:[a.jsx("span",{className:"home-header-leaderboard-icon","aria-hidden":!0,children:"🏆"}),a.jsx("span",{className:"home-header-leaderboard-label",children:"Leaderboards"})]}),g&&!fe&&a.jsx(NM,{gameMode:H==="zentara"?"zentara":H==="skills"?"skills":void 0,style:{padding:"6px 12px",fontSize:12},label:"Invite +1k"}),a.jsxs("button",{ref:X,className:"settings-toggle",title:"Menu","aria-label":A>0?`Menu (${A} unread messages)`:"Menu","aria-haspopup":"menu","aria-expanded":E,onClick:Mt,style:{width:38,height:38,borderRadius:"50%",background:g!=null&&g.avatarUrl?`url(${g.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:[!(g!=null&&g.avatarUrl)&&a.jsx("span",{style:{fontSize:"20px",lineHeight:1},children:"👤"}),A>0&&a.jsx("span",{className:"settings-unread-badge","aria-label":`${A} unread`,children:A>99?"99+":A})]}),a.jsx(Y8,{anchorRef:X,open:E,onClose:lr,items:ye})]}),a.jsx("div",{ref:_e,className:`home-fit-shell ${Ke}`,children:a.jsxs("div",{ref:re,className:"home-fit-content",style:pe<1?{transform:`scale(${pe})`,transformOrigin:"top center"}:void 0,children:[H!=="zentara"&&a.jsx(Gae,{onPlay:()=>ne(),playDisabled:!W||C}),!H&&a.jsx(yre,{selectedMode:H??W,onSelectMode:H?void 0:ce,interval:H?0:4e3}),H&&a.jsx(UL,{width:240,height:240,tagline:""}),H==="skills"&&a.jsx("div",{className:"skills-mode-selector",children:[{value:"wordsearch",label:"🔤 WORDS"},{value:"anagrams",label:"🔀 ANAGRAMS"},{value:"trivia",label:"❓ TRIVIA"}].map(({value:Me,label:wt})=>a.jsx("button",{className:Ae===Me?"active":"",onClick:async()=>{Z(),Q(),Fe(Me);try{const{Preferences:at}=await Cr(async()=>{const{Preferences:Dt}=await Promise.resolve().then(()=>Do);return{Preferences:Dt}},void 0,import.meta.url);await at.set({key:"selectedSkillsGameMode",value:Me})}catch{}},children:wt},Me))}),a.jsxs("section",{className:"home-cta buttonRow","aria-label":"Actions",children:[(!B||fe)&&a.jsxs("div",{className:`promo-banner promo-banner--login-row ${H?`promo-banner--${H}`:""}`,role:"region","aria-label":"Login banner",children:[a.jsx("span",{className:"promo-banner__title",children:"Sign in to play online"}),a.jsxs("div",{className:"promo-banner__oauth-row",children:[a.jsxs("button",{className:"promo-oauth-btn promo-oauth-btn--google",onClick:()=>dt("google"),disabled:ve||Ue,"aria-label":"Continue with Google",children:[a.jsx(Gl,{icon:Uae}),a.jsx("span",{children:"Google"})]}),a.jsxs("button",{className:"promo-oauth-btn promo-oauth-btn--apple",onClick:()=>dt("apple"),disabled:ve||Ue,"aria-label":"Continue with Apple",children:[a.jsx(Gl,{icon:qae}),a.jsx("span",{children:"Apple"})]})]})]}),a.jsx("div",{className:"cta-spotlight","aria-hidden":!0}),Rt&&(H??W)==="zentara"&&a.jsx("button",{className:"btn gold-fill cta-btn primaryButton",onClick:Qe,"aria-label":"Continue Game",children:"Continue Game"}),a.jsx("button",{id:"btn-single-player",className:`btn ${Rt&&(H??W)==="zentara"?"gold-outline":"gold-fill"} cta-btn primaryButton`,onClick:()=>ne(),disabled:!W||C,"aria-label":Rt&&(H??W)==="zentara"?"New Game":"Single Player",children:Rt&&(H??W)==="zentara"?"New Game":"Single Player"}),H==="zentara"?a.jsxs(a.Fragment,{children:[B&&!fe&&a.jsx(IP,{gameMode:H??W,disabled:!W||C,onFallbackToSinglePlayer:()=>ne({fromQuickMatch:!0})}),B&&!fe&&a.jsx("button",{className:"btn gold-outline cta-btn primaryButton CreateRoomButton",onClick:Ye,disabled:!W,"aria-label":"Create Room",children:"Create Room"}),a.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:()=>he(!0),"aria-label":"Heroes",children:"🦸 Heroes"})]}):a.jsxs("div",{className:`cta-row-pair ${H==="cee-lo"?"cta-row-pair--ceelo-social":""}`,children:[B&&!fe&&a.jsx(IP,{gameMode:H??W,disabled:!W||C,onFallbackToSinglePlayer:()=>ne({fromQuickMatch:!0})}),B&&!fe&&a.jsx("button",{className:"btn gold-outline cta-btn primaryButton CreateRoomButton",onClick:Ye,disabled:!W,"aria-label":"Create Room",children:"Create Room"}),H==="cee-lo"&&B&&!fe&&a.jsx("button",{className:"btn gold-outline cta-btn primaryButton",onClick:ue(Pt),"aria-label":"Open Lounge",children:"Lounge"})]})]})]})}),a.jsx(G8,{open:T,onClose:zt,gameMode:W??"cee-lo"}),a.jsx(X8,{open:P,onClose:br,isPrivate:w,setIsPrivate:j,roomsList:q,onJoinClick:f,loading:u}),a.jsx(kM,{open:s,onClose:fr,planId:g==null?void 0:g.membershipTier}),a.jsx(cZ,{open:ur,onClose:St,defaultMode:H??void 0}),a.jsx(pZ,{open:Xt,onClose:Oe}),a.jsx(fZ,{open:L,onClose:()=>N(!1),onGoLogin:()=>kt(),title:"Login Required",message:a.jsx(a.Fragment,{children:"Please log in to access Settings and Multiplayer."})}),a.jsx(vJ,{available:e,progress:t,applyNow:r,later:n}),we&&a.jsx(zae,{onClose:()=>he(!1)}),a.jsx(Gc,{})]})}function Gae({onPlay:e,playDisabled:t}){const{data:r,claiming:n,claim:s,refresh:o}=lZ();if(l.useEffect(()=>{const h=setInterval(()=>void o(!0),3e4);return()=>clearInterval(h)},[o]),!r)return a.jsxs("button",{className:"daily-challenge-banner",onClick:e,disabled:t,type:"button","aria-label":"Daily Challenge",children:[a.jsx("span",{className:"daily-challenge-icon","aria-hidden":!0,children:"🎯"}),a.jsxs("span",{className:"daily-challenge-text",children:[a.jsx("span",{className:"daily-challenge-label",children:"Daily Challenge"}),a.jsx("span",{className:"daily-challenge-reward",children:"Play & earn bonus coins"})]}),a.jsx("span",{className:"daily-challenge-go","aria-hidden":!0,children:"▸"})]});const{description:i,target:c,progress:u,reward:p,completed:d,claimed:f}=r,m=async()=>{d&&!f&&!n?await s()&&o(!0):d||e()};return a.jsxs("button",{className:`daily-challenge-banner${f?" daily-challenge-banner--claimed":d?" daily-challenge-banner--ready":""}`,onClick:m,disabled:f||n||t&&!d,type:"button","aria-label":f?"Challenge completed":d?"Claim reward":i,children:[a.jsx("span",{className:"daily-challenge-icon","aria-hidden":!0,children:f?"✅":d?"🎉":"🎯"}),a.jsxs("span",{className:"daily-challenge-text",children:[a.jsx("span",{className:"daily-challenge-label",children:f?"Challenge Complete!":"Daily Challenge"}),a.jsx("span",{className:"daily-challenge-reward",children:f?"Come back tomorrow!":d?`Claim +${p.toLocaleString()} coins!`:a.jsxs(a.Fragment,{children:[i," — ",a.jsxs("strong",{children:["+",p.toLocaleString()]})," coins"]})})]}),!f&&a.jsx("span",{className:"daily-challenge-go","aria-hidden":!0,children:d?n?"…":"💰":`${u}/${c}`})]})}function yu(){const{user:e,loading:t,initialized:r,refreshUser:n}=Zr(),s=!!(e!=null&&e.email&&/@guest\.local$/i.test(e.email));return l.useEffect(()=>{!r&&!t&&n()},[r,t,n]),!r||t?a.jsx("div",{className:"app-loading",children:"Loading…"}):e&&!s?a.jsx(qn,{to:"/lobby",replace:!0}):a.jsx(mj,{})}const BP=15e3,Xae=1e4,nD=l.createContext(null),Yae=()=>l.useContext(nD);function Zae({children:e}){const{user:t}=Zr(),r=Na(),n=t==null?void 0:t.id,s=!!(t!=null&&t.email&&/@guest\.local$/i.test(t.email)),o=!!n&&!s,i=l.useRef(null),[c,u]=l.useState(null),p=l.useRef(null);l.useEffect(()=>{p.current=c},[c]);const[d,f]=l.useState(!1),[m,h]=l.useState(!1),[b,g]=l.useState(null),[y,x]=l.useState(!1),v=l.useRef(null),[A,_]=l.useState([]),[w,j]=l.useState(null),[T,R]=l.useState(!1),[P,k]=l.useState(!1),[E,M]=l.useState(null),[C,I]=l.useState(null),L=l.useRef(null);l.useEffect(()=>{L.current=C},[C]);const N=l.useCallback(z=>{var Z;const O=z??i.current;if(!O){_([]),j(null);return}const q=[];O.remoteParticipants.forEach(Q=>{var _e,re;const oe=(_e=Q.getTrackPublication(hl.Source.Camera))==null?void 0:_e.track,ce=(re=Q.getTrackPublication(hl.Source.Microphone))==null?void 0:re.track;q.push({id:Q.identity,name:Q.name||Q.identity,isSelf:!1,audioEnabled:Q.isMicrophoneEnabled,videoEnabled:Q.isCameraEnabled,isSpeaking:Q.isSpeaking,videoTrack:oe||void 0,audioTrack:ce||void 0})}),_(q);const X=O.localParticipant;if(X){const Q=X.getTrackPublication(hl.Source.Camera),oe=Q==null?void 0:Q.track,ce=(Z=X.getTrackPublication(hl.Source.Microphone))==null?void 0:Z.track;console.log("[LiveKit] updateParticipants - localVideoTrack:",oe),j({id:X.identity,name:X.name||X.identity,isSelf:!0,audioEnabled:X.isMicrophoneEnabled,videoEnabled:X.isCameraEnabled,isSpeaking:X.isSpeaking,videoTrack:oe||void 0,audioTrack:ce||void 0}),M(oe||null),R(X.isMicrophoneEnabled),k(X.isCameraEnabled)}},[]),S=l.useRef(null),F=l.useRef(!1),D=l.useRef(0),H=3,W=l.useCallback(async z=>{if(!o||!r){g("Not authenticated");return}if(!(p.current===z&&i.current)){if(v.current&&(clearTimeout(v.current),v.current=null),i.current){const O=i.current;i.current=null;try{const q=O.localParticipant;if(q){try{await q.setCameraEnabled(!1)}catch{}try{await q.setMicrophoneEnabled(!1)}catch{}}O.disconnect()}catch(q){console.warn("[LiveKit] Error disconnecting previous room:",q)}}f(!1),u(null),console.log("[LiveKit] Room queued for lazy connect:",z),I(z),x(!1),R(!1),k(!1),g(null)}},[o,r]),G=l.useCallback(async(z,O=0)=>{if(!o||!r)return g("Not authenticated"),!1;if(p.current===z&&i.current)return!0;if(S.current===z&&O===0)return console.log("[LiveKit] Connect already in progress for room:",z),!1;if(O===0&&(D.current=0),i.current){const q=i.current;i.current=null;try{const X=q.localParticipant;if(X){try{await X.setCameraEnabled(!1)}catch{}try{await X.setMicrophoneEnabled(!1)}catch{}}q.disconnect()}catch(X){console.warn("[LiveKit] Error disconnecting previous room:",X)}}S.current=z,F.current=!1,h(!0),g(null);try{const q=await new Promise((re,pe)=>{const ee=setTimeout(()=>{pe(new Error("livekit_join timed out"))},Xae);r.emit("livekit_join",{roomId:z},xe=>{clearTimeout(ee),re(xe)})});if(F.current)return console.log("[LiveKit] Join aborted for room:",z),S.current=null,!1;if(!(q!=null&&q.ok))throw new Error((q==null?void 0:q.error)||"Failed to get LiveKit token");const{token:X,url:Z,iceServers:Q}=q,oe={};Q&&Array.isArray(Q)&&Q.length>0&&(oe.iceServers=Q,oe.iceTransportPolicy="all",console.log("[LiveKit] Using custom ICE servers:",Q.length,"servers"));const ce=new D3({adaptiveStream:!0,dynacast:!0,videoCaptureDefaults:{resolution:O3.h540.resolution}});await ce.prepareConnection(Z,X),ce.on(Bi.Connected,()=>{console.log("[LiveKit] Connected to room"),f(!0),h(!1),N(ce)}),ce.on(Bi.ParticipantConnected,re=>{console.log("[LiveKit] Participant connected:",re.identity),N(ce)}),ce.on(Bi.ParticipantDisconnected,re=>{console.log("[LiveKit] Participant disconnected:",re.identity),N(ce)}),ce.on(Bi.TrackSubscribed,(re,pe,ee)=>{console.log("[LiveKit] Track subscribed:",re.kind,ee.identity),N(ce)}),ce.on(Bi.TrackUnsubscribed,(re,pe,ee)=>{console.log("[LiveKit] Track unsubscribed:",re.kind,ee.identity),N(ce)}),ce.on(Bi.LocalTrackPublished,(re,pe)=>{if(console.log("[LiveKit] Local track published:",re.kind,"track:",re.track),N(ce),re.kind===hl.Kind.Video){let ee=0;const xe=()=>{var Ge;if(i.current!==ce&&ee>0)return;if((Ge=pe.getTrackPublication(hl.Source.Camera))==null?void 0:Ge.track){N(ce);return}ee++<8&&setTimeout(xe,75)};setTimeout(xe,50)}}),ce.on(Bi.LocalTrackUnpublished,(re,pe)=>{console.log("[LiveKit] Local track unpublished:",re.kind),N(ce)}),ce.on(Bi.ActiveSpeakersChanged,()=>{N(ce)}),ce.on(Bi.ConnectionStateChanged,re=>{if(i.current===ce)if(console.log("[LiveKit] Connection state changed:",re),re===Gb.Disconnected){i.current=null,f(!1),N(),I(z);const pe=p.current;pe&&!F.current&&z===pe&&(console.log("[LiveKit] Unexpected disconnect, attempting auto-reconnect to:",z),setTimeout(()=>{!F.current&&p.current===z&&G(z,0)},1500))}else re===Gb.Reconnecting?console.log("[LiveKit] Connection reconnecting..."):re===Gb.Connected&&(console.log("[LiveKit] Connection restored"),f(!0))});const _e=Object.keys(oe).length>0?{rtcConfig:oe}:void 0;return await ce.connect(Z,X,_e),F.current?(console.log("[LiveKit] Join aborted during connect, disconnecting"),ce.disconnect(),S.current=null,!1):(i.current=ce,u(z),I(null),S.current=null,f(!0),h(!1),N(ce),!0)}catch(q){if(console.error("[LiveKit] Join error:",q,"attempt:",O+1),O<H&&!F.current){const X=Math.min(1e3*Math.pow(2,O),5e3);if(console.log(`[LiveKit] Retrying join in ${X}ms (attempt ${O+2}/${H+1})`),S.current=null,await new Promise(Z=>setTimeout(Z,X)),!F.current)return D.current=O+1,G(z,O+1)}return g((q==null?void 0:q.message)||"Failed to join room"),h(!1),u(null),S.current=null,x(!0),!1}},[o,r,N]),$=l.useCallback(async()=>{v.current&&(clearTimeout(v.current),v.current=null),F.current=!0,S.current=null,I(null);const z=i.current;if(z){i.current=null;try{const O=z.localParticipant;if(O){console.log("[LiveKit] Disabling local tracks before disconnect");try{O.isCameraEnabled&&await O.setCameraEnabled(!1)}catch(q){console.warn("[LiveKit] Error disabling camera:",q)}try{O.isMicrophoneEnabled&&await O.setMicrophoneEnabled(!1)}catch(q){console.warn("[LiveKit] Error disabling mic:",q)}}console.log("[LiveKit] Disconnecting from room"),z.disconnect()}catch(O){console.warn("[LiveKit] Error disconnecting room:",O)}}f(!1),h(!1),u(null),_([]),j(null),M(null),R(!1),k(!1)},[]),K=l.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null);const z=i.current;if(!z)return;const O=z.localParticipant;if(!O||O.isMicrophoneEnabled||O.isCameraEnabled)return;let q=!1;if(z.remoteParticipants.forEach(X=>{(X.isMicrophoneEnabled||X.isCameraEnabled)&&(q=!0)}),q){console.log("[LiveKit] All local tracks off but remote participants are publishing — staying connected");return}console.log(`[LiveKit] All tracks off, no remote publishers — will auto-disconnect in ${BP/1e3}s`),v.current=setTimeout(()=>{v.current=null;const X=i.current;if(!X)return;const Z=X.localParticipant;if(Z&&(Z.isMicrophoneEnabled||Z.isCameraEnabled))return;let Q=!1;if(X.remoteParticipants.forEach(ce=>{(ce.isMicrophoneEnabled||ce.isCameraEnabled)&&(Q=!0)}),Q)return;console.log("[LiveKit] Idle timeout — disconnecting to save billing minutes");const oe=p.current;i.current=null;try{X.disconnect()}catch{}f(!1),u(null),_([]),j(null),M(null),oe&&I(oe)},BP)},[]),de=l.useCallback(()=>{v.current&&(clearTimeout(v.current),v.current=null,console.log("[LiveKit] Idle disconnect cancelled — track re-enabled"))},[]),ie=l.useCallback(async()=>{if(i.current)return i.current;const z=L.current;return z?(console.log("[LiveKit] Lazy-connecting to room:",z),await G(z)?i.current:null):(console.warn("[LiveKit] No pending room to connect to"),null)},[G]),we=l.useCallback((z,O)=>{let q=0;const X=()=>{var Q;if(i.current!==z)return;if((Q=z.localParticipant.getTrackPublication(O))==null?void 0:Q.track){N(z);return}q++<8&&setTimeout(X,75)};setTimeout(X,50)},[N]),he=l.useCallback(async()=>{const z=await ie();if(z)try{const O=!z.localParticipant.isMicrophoneEnabled;O&&de(),await z.localParticipant.setMicrophoneEnabled(O),R(O),O||K()}catch(O){console.error("[LiveKit] Toggle mic error:",O)}},[ie,de,K]),Ae=l.useCallback(async()=>{const z=await ie();if(z)try{const O=!z.localParticipant.isCameraEnabled;O&&de(),await z.localParticipant.setCameraEnabled(O),k(O),N(z),O&&we(z,hl.Source.Camera),O||K()}catch(O){console.error("[LiveKit] Toggle video error:",O)}},[ie,N,de,K]),Fe=l.useCallback(async z=>{if(z){de();const O=await ie();if(!O)return;try{await O.localParticipant.setMicrophoneEnabled(!0),R(!0)}catch(q){console.error("[LiveKit] Set mic error:",q)}}else{const O=i.current;if(!O){R(!1);return}try{await O.localParticipant.setMicrophoneEnabled(!1),R(!1),K()}catch(q){console.error("[LiveKit] Set mic error:",q)}}},[ie,de,K]),U=l.useCallback(async z=>{if(z){de();const O=await ie();if(!O)return;try{await O.localParticipant.setCameraEnabled(!0),k(!0),N(O),we(O,hl.Source.Camera)}catch(q){console.error("[LiveKit] Set video error:",q)}}else{const O=i.current;if(!O){k(!1);return}try{await O.localParticipant.setCameraEnabled(!1),k(!1),N(O),K()}catch(q){console.error("[LiveKit] Set video error:",q)}}},[ie,N,de,K]);l.useEffect(()=>()=>{v.current&&(clearTimeout(v.current),v.current=null),F.current=!0,S.current=null;const z=i.current;if(z){i.current=null;try{const O=z.localParticipant;if(O){try{O.setCameraEnabled(!1)}catch{}try{O.setMicrophoneEnabled(!1)}catch{}}z.disconnect()}catch{}}},[]);const V={connected:d,connecting:m,error:b,liveKitFailed:y,joinRoom:W,leaveRoom:$,currentRoomId:c,pendingRoomId:C,participants:A,localParticipant:w,micEnabled:T,videoEnabled:P,toggleMic:he,toggleVideo:Ae,setMicEnabled:Fe,setVideoEnabled:U,localVideoTrack:E};return a.jsx(nD.Provider,{value:V,children:e})}const aD=l.createContext(null),Kae=()=>l.useContext(aD);function Hn(e){return e.connectionState==="closed"||e.signalingState==="closed"}function kh(e){if(e)try{e.getTracks().forEach(t=>t.stop())}catch{}}function Qae(e){var t,r;try{const n=((t=e.getAudioTracks)==null?void 0:t.call(e))||[],s=((r=e.getVideoTracks)==null?void 0:r.call(e))||[],o=n.map(c=>({id:c.id,kind:c.kind,enabled:c.enabled,ready:c.readyState})),i=s.map(c=>{var u;return{id:c.id,kind:c.kind,enabled:c.enabled,ready:c.readyState,settings:((u=c.getSettings)==null?void 0:u.call(c))||void 0}});return{id:e.id,audioTracks:o.length,videoTracks:i.length,audio:o,video:i}}catch{return{id:e==null?void 0:e.id}}}const Jae=(()=>{if(typeof navigator>"u")return!1;const e=navigator.userAgent||navigator.vendor||window.opera||"";return/iPad|iPhone|iPod/.test(e)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1})();function qp(e,t){const r=new Set,n=[],s=o=>{const i=Array.isArray(o.urls)?o.urls:o.urls?[o.urls]:[];for(const c of i){if(!c||typeof c!="string")continue;const u=c.trim();if(u.startsWith("stun:")){const p=`${u}|`;r.has(p)||(r.add(p),n.push({urls:u}));continue}if(u.startsWith("turn:")||u.startsWith("turns:")){const p=o.username,d=o.credential;if(p&&d){const f=`${u}|${p}|${d}`;r.has(f)||(r.add(f),n.push({urls:u,username:p,credential:d}))}}}};return(e||[]).forEach(s),n.length===0&&t.forEach(s),n.length?n:t}function $ae(e,t){if(!t.heartbeat){try{t.dc||(t.dc=t.pc.createDataChannel("ka",{negotiated:!1,ordered:!0}))}catch{}t.heartbeat=window.setInterval(()=>{var r;try{((r=t.dc)==null?void 0:r.readyState)==="open"&&t.dc.send("ping")}catch{}},12e3)}}function Vp(e){var t;e.heartbeat&&(clearInterval(e.heartbeat),e.heartbeat=void 0);try{(t=e.dc)==null||t.close()}catch{}e.dc=void 0}function ese({children:e}){const{user:t}=Zr(),r=Na(),n=t==null?void 0:t.id,s=!!(t!=null&&t.email&&/@guest\.local$/i.test(t.email)),o=!!n&&!s;function i(B,fe){try{const ye=window;ye.__rtcVideoDisableReasons||(ye.__rtcVideoDisableReasons=[]),ye.__rtcVideoDisableReasons.push({t:Date.now(),reason:B,...fe?{data:fe}:{}});try{mw(`video:disable:${B}`)}catch{}}catch{}}const{rtcJoin:c,rtcSignal:u,rtcLeave:p,rtcSetVideoEnabled:d}=sa(),f=l.useRef(new Map),[m,h]=l.useState({}),b=null,[g,y]=l.useState({}),[x,v]=l.useState(void 0),A=l.useRef(void 0),_=l.useRef(void 0),w=l.useRef(""),j=l.useRef(new Map),T=l.useRef(new Map),[R,P]=l.useState(!1),[k,E]=l.useState(!1),M=[{urls:"stun:stun.l.google.com:19302"},{urls:"stun:stun1.l.google.com:19302"}],C=l.useRef([...M]),[I,L]=l.useState(0),N=l.useRef(null);l.useRef([]);const S=l.useRef({audio:!1,video:!1}),F=I>0||k||R,D=l.useCallback(async()=>{var B;try{const fe=navigator;(B=fe==null?void 0:fe.wakeLock)!=null&&B.request&&!N.current&&(N.current=await fe.wakeLock.request("screen"),N.current.addEventListener("release",()=>{}))}catch{}},[]),H=l.useCallback(async()=>{var B,fe;try{await((fe=(B=N.current)==null?void 0:B.release)==null?void 0:fe.call(B))}catch{}N.current=null},[]);l.useEffect(()=>(Ar.debug("wakeLock:effect",{need:F}),F?D():H(),()=>{H()}),[F,D,H]),l.useEffect(()=>{const B=()=>{document.visibilityState==="visible"&&F&&D()};return document.addEventListener("visibilitychange",B),()=>document.removeEventListener("visibilitychange",B)},[F,D]);const W=(()=>{var B,fe;try{return((fe=(B=window.Capacitor)==null?void 0:B.getPlatform)==null?void 0:fe.call(B))==="ios"}catch{return!1}})();async function G(B,fe){var ye;if(!o||S.current[fe])return null;S.current[fe]=!0;try{if(!((ye=navigator.mediaDevices)!=null&&ye.getUserMedia))return console.error(`[RTC] getUserMedia not available for ${fe}`),Ar.error("gUM:not-available",{kind:fe,isNativeIOS:W}),null;console.log(`[RTC] Requesting ${fe} with constraints:`,B);const ve=await navigator.mediaDevices.getUserMedia(B);return console.log(`[RTC] getUserMedia ${fe} success:`,ve==null?void 0:ve.getTracks().map(ke=>({id:ke.id,kind:ke.kind,readyState:ke.readyState}))),ve}catch(ve){return console.error(`[RTC] getUserMedia ${fe} failed:`,ve==null?void 0:ve.name,ve==null?void 0:ve.message,ve),Ar.error("gUM:failed",{kind:fe,errName:ve==null?void 0:ve.name,errMsg:ve==null?void 0:ve.message,isNativeIOS:W}),null}finally{S.current[fe]=!1}}async function $(){if(!o)return;if(_.current)return _.current;const B=await G({audio:!0,video:!1},"audio");if(B){const fe=B.getAudioTracks()[0];fe&&(fe.enabled=!1),_.current=B}return _.current}async function K(){if(!o)return;if(A.current)return A.current;const fe=await G({audio:!1,video:Jae?{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 fe&&(A.current=fe,v(fe),Ar.info("ensureVideo:acquired",Qae(fe))),A.current}function de(){var fe;const B=((fe=A.current)==null?void 0:fe.getVideoTracks())??[];console.log("[RTC] releaseVideo called, stopping",B.length,"video tracks");try{B.forEach(ye=>{console.log("[RTC] stopping video track",ye.id,ye.readyState),ye.stop()})}catch(ye){console.error("[RTC] releaseVideo error",ye)}A.current=void 0,v(void 0)}function ie(){var B,fe;try{(fe=(B=_.current)==null?void 0:B.getAudioTracks())==null||fe.forEach(ye=>ye.stop())}catch{}_.current=void 0}const we=l.useRef(new Map),[he,Ae]=l.useState({});function Fe(B,fe){var br;if(we.current.get(B))return;const ye=((br=fe==null?void 0:fe.getAudioTracks)==null?void 0:br.call(fe))??[];if(!ye.length||ye.every(fr=>fr.readyState!=="live"))return;let ve;try{ve=new AudioContext}catch(fr){Ar.warn("vad:audiocontext-failed",{pid:B,err:String(fr)});return}let ke,Ue;try{ke=ve.createMediaStreamSource(fe),Ue=ve.createAnalyser(),Ue.fftSize=2048,ke.connect(Ue)}catch(fr){Ar.warn("vad:setup-failed",{pid:B,err:String(fr)});try{ve.close()}catch{}return}const ct=new Uint8Array(Ue.fftSize);let dt=0;const Rt=.04,jr=.02;let Qe=!1,Mt=!1;const lr=()=>{if(!Mt){try{Ue.getByteTimeDomainData(ct);let fr=0;for(let Ie=0;Ie<ct.length;Ie++){const yt=(ct[Ie]-128)/128;fr+=yt*yt}const ur=Math.sqrt(fr/ct.length);!Qe&&ur>=Rt?(Qe=!0,Ae(Ie=>Ie[B]===!0?Ie:{...Ie,[B]:!0})):Qe&&ur<=jr&&(Qe=!1,Ae(Ie=>Ie[B]===!1?Ie:{...Ie,[B]:!1}))}catch{}Mt||(dt=requestAnimationFrame(lr))}};dt=requestAnimationFrame(lr);const zt=()=>{Mt=!0,cancelAnimationFrame(dt);try{ke.disconnect()}catch{}try{Ue.disconnect()}catch{}ve.close().catch(()=>{})};we.current.set(B,zt)}function U(B){const fe=we.current.get(B);fe&&(fe(),we.current.delete(B)),Ae(ye=>{if(!(B in ye))return ye;const ve={...ye};return delete ve[B],ve})}function V(B,fe){try{return Hn(B)?void 0:B.getTransceivers().find(ye=>{var ve;return((ve=ye.receiver.track)==null?void 0:ve.kind)===fe})??B.getTransceivers().find(ye=>{var ve;return((ve=ye.sender.track)==null?void 0:ve.kind)===fe})??B.getTransceivers()[fe==="audio"?0:1]}catch{return}}function z(B,fe){var ye;try{return Hn(B)?void 0:B.getSenders().find(ve=>{var ke;return((ke=ve.track)==null?void 0:ke.kind)===fe})??((ye=V(B,fe))==null?void 0:ye.sender)}catch{return}}async function O(B,fe){var ye;try{if(Hn(B))return;const ve=((ye=fe==null?void 0:fe.getAudioTracks)==null?void 0:ye.call(fe)[0])??null,ke=z(B,"audio");ke&&await ke.replaceTrack(ve)}catch(ve){Ar.warn("upsertAudioTrack:failed",{err:String(ve)})}}async function q(B,fe){var ye;try{if(Hn(B))return;const ve=((ye=fe==null?void 0:fe.getVideoTracks)==null?void 0:ye.call(fe)[0])??null,ke=z(B,"video");console.log("[RTC] upsertVideoTrack",{hasTrack:!!ve,hasSender:!!ke,trackId:ve==null?void 0:ve.id,trackState:ve==null?void 0:ve.readyState}),ke?(await ke.replaceTrack(ve),console.log("[RTC] upsertVideoTrack: track replaced successfully")):console.warn("[RTC] upsertVideoTrack: no sender found for video")}catch(ve){Ar.warn("upsertVideoTrack:failed",{err:String(ve)}),console.error("[RTC] upsertVideoTrack failed:",ve)}}async function X(B,fe){try{const ye=fe.pc,ve=Date.now();let ke=0,Ue=0;(await ye.getStats()).forEach(Rt=>{Rt.type==="outbound-rtp"&&!Rt.isRemote&&(ke+=Rt.bytesSent??0),Rt.type==="inbound-rtp"&&!Rt.isRemote&&(Ue+=Rt.bytesReceived??0)});const dt=T.current.get(B);T.current.set(B,{t:ve,up:ke,down:Ue}),dt&&ye.connectionState==="connected"&&ke===dt.up&&Ue===dt.down&&ve-dt.t>2e4&&await ee(B,fe)}catch{}}function Z(B,fe){if(j.current.get(B))return;const ye=window.setInterval(()=>X(B,fe),1e4);j.current.set(B,ye)}function Q(B){const fe=j.current.get(B);fe&&(clearInterval(fe),j.current.delete(B)),T.current.delete(B)}function oe(){const B=typeof window<"u"?new URL(window.location.href):null,fe=typeof localStorage<"u"&&(localStorage.getItem("rtcRelayOnly")==="1"||localStorage.getItem("rtcRelayOnly")==="true")||(B==null?void 0:B.searchParams.get("rtcRelay"))==="1"||(B==null?void 0:B.searchParams.get("rtcRelay"))==="true",ye=!!_e._compat,ve=!!(fe||ye),ke={iceServers:qp(C.current,M),bundlePolicy:"balanced",iceTransportPolicy:ve?"relay":"all",rtcpMuxPolicy:"require",iceCandidatePoolSize:2},Ue=ke.iceServers.some(dt=>(Array.isArray(dt.urls)?dt.urls:[dt.urls]).some(jr=>jr.startsWith("turn:")||jr.startsWith("turns:")));console.log("[RTC] newPc config",{relayOnly:ve,hasTurn:Ue,iceTransportPolicy:ke.iceTransportPolicy,serverCount:ke.iceServers.length,servers:ke.iceServers.map(dt=>({urls:dt.urls,hasCredentials:!!(dt.username&&dt.credential)}))}),Ar.debug("pc:new",{relayOnly:ve,iceTransportPolicy:ke.iceTransportPolicy,iceServers:(ke.iceServers||[]).map(dt=>{var Rt;return typeof dt.urls=="string"?dt.urls:(Rt=dt.urls)==null?void 0:Rt[0]})});let ct;try{ct=new RTCPeerConnection(ke)}catch(dt){Ar.error("pc:new-failed",{err:String(dt),servers:ke.iceServers});const Rt={...ke,iceServers:M};ct=new RTCPeerConnection(Rt)}return ct.addTransceiver("audio",{direction:"sendrecv"}),ct.addTransceiver("video",{direction:"sendrecv"}),ct}async function ce(B,fe){try{const ye=await fe.getStats(),ve={};ye.forEach(Ue=>{Ue&&Ue.id&&(ve[Ue.id]=Ue)});let ke;if(ye.forEach(Ue=>{Ue.type==="transport"&&Ue.selectedCandidatePairId&&ve[Ue.selectedCandidatePairId]&&(ke=ve[Ue.selectedCandidatePairId])}),ke||ye.forEach(Ue=>{Ue.type==="candidate-pair"&&(Ue.selected||Ue.state==="succeeded")&&(ke=Ue)}),ke){const Ue=ve[ke.localCandidateId],ct=ve[ke.remoteCandidateId];Ar.info("ice:selected",{peerId:B,state:ke.state,nominated:ke.nominated,bytesSent:ke.bytesSent,bytesReceived:ke.bytesReceived,local:Ue?{type:Ue.candidateType,protocol:Ue.protocol,address:Ue.address,port:Ue.port}:void 0,remote:ct?{type:ct.candidateType,protocol:ct.protocol,address:ct.address,port:ct.port}:void 0})}else Ar.debug("ice:selected:none",{peerId:B})}catch(ye){Ar.error("ice:selected-failed",{peerId:B,err:String(ye)})}}async function _e(){try{if(_e._ran)return;_e._ran=!0;const B={iceServers:qp(C.current,M),bundlePolicy:"balanced",iceTransportPolicy:"all"},fe=new RTCPeerConnection(B),ye={host:0,srflx:0,relay:0,prflx:0};fe.onicecandidate=Rt=>{if(!Rt.candidate)return;const Qe=(Rt.candidate.candidate||"").match(/ typ ([a-z]+)/),Mt=(Qe==null?void 0:Qe[1])||"unknown";ye[Mt]===void 0&&(ye[Mt]=0),ye[Mt]+=1},fe.createDataChannel("probe");const ve=await fe.createOffer({iceRestart:!1});await fe.setLocalDescription(ve),await new Promise(Rt=>setTimeout(Rt,4e3));try{fe.close()}catch{}const ke=(ye.relay||0)>0,Ue=(ye.srflx||0)>0,ct=(ye.host||0)>0,dt=ke&&!Ue&&ct;if(dt){Ar.warn("ice:probe-forcing-relay",{counts:ye,reason:"no-srflx"}),_e._compat=!0;try{localStorage.setItem("rtcRelayOnly","1")}catch{}}else!ke&&!Ue&&Ar.error("ice:probe-restricted-network",{counts:ye,warning:"Voice/video may not work"});Ar.info("ice:probe",{counts:ye,relayOK:ke,srflxOK:Ue,needsRelayOnly:dt})}catch(B){Ar.error("ice:probe-failed",{err:String(B)})}}function re(B){let fe=f.current.get(B);if(fe)return fe;const ye=oe(),ve={pc:ye,iceBuffer:[],makingOffer:!1,ignoreOffer:!1,isSettingRemoteAnswerPending:!1};return ye.onicecandidate=ke=>{ke.candidate&&(Ar.debug("pc:icecandidate",{peerId:B,ctype:ke.candidate.type,proto:ke.candidate.protocol,addr:ke.candidate.address,port:ke.candidate.port}),u(w.current,B,{ice:ke.candidate.toJSON()}).catch(console.error))},ye.ontrack=ke=>{if(Ar.info("pc:ontrack",{peerId:B,kind:ke.track.kind,id:ke.track.id}),console.log("[RTC] ontrack received",{peerId:B,kind:ke.track.kind,trackId:ke.track.id,readyState:ke.track.readyState,muted:ke.track.muted}),h(Ue=>{const ct=Ue[B]??new MediaStream;return ct.getTracks().includes(ke.track)||(ct.addTrack(ke.track),console.log("[RTC] Track added to stream",{peerId:B,kind:ke.track.kind,streamId:ct.id,trackCount:ct.getTracks().length}),ke.track.addEventListener("ended",()=>{Ar.debug("pc:track-ended",{peerId:B,kind:ke.track.kind,id:ke.track.id}),console.log("[RTC] Track ended",{peerId:B,kind:ke.track.kind}),h(dt=>{const Rt=dt[B];if(!Rt)return dt;try{Rt.removeTrack(ke.track)}catch{}return{...dt,[B]:Rt}}),ke.track.kind==="video"&&y(dt=>({...dt,[B]:!1}))}),ke.track.kind==="video"&&(ke.track.addEventListener("mute",()=>{console.log("[RTC] Video track muted",{peerId:B,trackId:ke.track.id}),y(dt=>({...dt,[B]:!1}))}),ke.track.addEventListener("unmute",()=>{console.log("[RTC] Video track unmuted",{peerId:B,trackId:ke.track.id,readyState:ke.track.readyState}),ke.track.readyState==="live"&&y(dt=>({...dt,[B]:!0}))}))),{...Ue,[B]:ct}}),ke.track.kind==="video"){const Ue=ke.track.readyState==="live"&&!ke.track.muted;console.log("[RTC] Video track received, setting remoteVideoFlags",{peerId:B,isLive:Ue,muted:ke.track.muted}),y(ct=>({...ct,[B]:Ue}))}},ye.onnegotiationneeded=()=>{Ar.debug("pc:onnegotiationneeded",{peerId:B})},ye.onconnectionstatechange=()=>{const{connectionState:ke}=ye,Ue=ye.iceConnectionState;if(Ar.info("pc:state",{peerId:B,state:ke,ice:Ue}),console.log("[RTC] connectionstatechange",{peerId:B,connectionState:ke,iceConnectionState:Ue,signalingState:ye.signalingState}),ke==="connected"&&(ve.degradedAt=null,ve.iceRestartCount=0,ve.rebuildAttempts=0,$ae(B,ve),Z(B,ve),setTimeout(()=>ce(B,ye),500)),ke==="closed"&&(Vp(ve),Q(B)),(ke==="disconnected"||pe(ke,Ue))&&!ve.degradedAt&&(ve.degradedAt=Date.now()),ke==="disconnected"&&ve.degradedAt){const dt=Date.now()-ve.degradedAt;dt>3e3&&dt<8e3?ee(B,ve):dt>=8e3&&(Ar.warn("pc:prolonged-disconnect",{peerId:B,degradedMs:dt}),_t(B))}pe(ke,Ue)&&ee(B,ve)},ye.oniceconnectionstatechange=()=>{const ke=ye.iceConnectionState;Ar.debug("pc:ice-state",{peerId:B,ice:ke}),console.log("[RTC] iceconnectionstatechange",{peerId:B,iceConnectionState:ke,connectionState:ye.connectionState}),ke==="failed"&&ee(B,ve),ke==="disconnected"&&setTimeout(()=>{!Hn(ye)&&ye.iceConnectionState==="disconnected"&&(Ar.warn("ice:prolonged-disconnect",{peerId:B}),ee(B,ve))},4e3)},ye.onicegatheringstatechange=()=>{console.log("[RTC] icegatheringstatechange",{peerId:B,iceGatheringState:ye.iceGatheringState})},ye.ondatachannel=ke=>{if(ke.channel.label==="ka"){const Ue=ke.channel;ve.dc=Ue,Ar.debug("pc:datachannel",{peerId:B,label:Ue.label,state:Ue.readyState})}},f.current.set(B,ve),L(f.current.size),Ar.info("peer:new",{peerId:B}),ve}function pe(B,fe){return B==="failed"||fe==="failed"}async function ee(B,fe){if(Hn(fe.pc))return;const ye=Date.now(),ve=fe.lastIceRestartAt,ke=fe.iceRestartCount??0,Ue=Math.min(1e4*Math.pow(2,ke),6e4);if(!(ve&&ye-ve<Ue)){if(ke>=3){Ar.warn("ice:restart-exhausted",{peerId:B,restartCount:ke}),fe.iceRestartCount=0,await _t(B);return}if(Ar.warn("ice:restart",{peerId:B,attempt:ke+1}),!(fe.makingOffer||Hn(fe.pc))&&(fe.pc.signalingState!=="stable"&&await bt(fe.pc),!Hn(fe.pc)))try{const ct=await fe.pc.createOffer({iceRestart:!0});if(Hn(fe.pc))return;await fe.pc.setLocalDescription(ct),await u(w.current,B,{sdp:fe.pc.localDescription}),fe.lastIceRestartAt=ye,fe.iceRestartCount=ke+1}catch(ct){Ar.error("ice:restart-failed",{peerId:B,err:String(ct)}),fe.iceRestartCount=0,await _t(B)}}}const xe=l.useRef(new Map),Le=3,Ge=3e4;async function _t(B){const fe=xe.current.get(B)??{count:0,lastAt:0},ye=Date.now();if(ye-fe.lastAt>Ge*3&&(fe.count=0),fe.count>=Le){const ct=Ge-(ye-fe.lastAt);if(ct>0){Ar.warn("rebuild:rate-limited",{peerId:B,attempts:fe.count,waitMs:ct}),setTimeout(()=>{xe.current.delete(B),_t(B)},ct);return}fe.count=0}fe.count++,fe.lastAt=ye,xe.current.set(B,fe),Ar.info("rebuild:peer",{peerId:B,attempt:fe.count});const ve=f.current.get(B);if(ve){Vp(ve);try{ve.pc.close()}catch{}f.current.delete(B)}h(ct=>{if(!ct[B])return ct;const dt={...ct};return kh(dt[B]),delete dt[B],dt}),U(B),y(ct=>{const{[B]:dt,...Rt}=ct;return Rt});const{pc:ke}=re(B);await De(ke);const Ue=f.current.get(B);await Pt(B,ke,Ue)}function Xe(B){return B.signalingState==="stable"}function bt(B){return B.signalingState==="stable"||Hn(B)?Promise.resolve():new Promise(fe=>{const ye=()=>{const ve=B.signalingState;(ve==="stable"||ve==="closed")&&(B.removeEventListener("signalingstatechange",ye),fe())};B.addEventListener("signalingstatechange",ye)})}async function Pt(B,fe,ye){var ve;try{if(Hn(fe)||(Xe(fe)||await bt(fe),!Xe(fe)||ye.makingOffer||Hn(fe)))return;ye.makingOffer=!0,Ar.debug("sdp:offer",{peerId:B}),console.log("[RTC] Creating offer for peer",{peerId:B,signalingState:fe.signalingState});const ke=await fe.createOffer();if(Hn(fe)){ye.makingOffer=!1;return}await fe.setLocalDescription(ke),console.log("[RTC] Sending offer via rtcSignal",{peerId:B,room:w.current,type:(ve=fe.localDescription)==null?void 0:ve.type}),await u(w.current,B,{sdp:fe.localDescription})}catch(ke){Ar.warn("safeRenegotiate:failed",{peerId:B,err:String(ke)})}finally{ye.makingOffer=!1}}const kt=l.useCallback(async B=>{if(B!==k){if(!o){E(!1),i("preferences:init"),E(!1);return}if(E(B),n&&y(fe=>({...fe,[n]:B})),B){try{kf(!0)}catch{}if(!await K()){E(!1),n&&y(ke=>({...ke,[n]:!1}));return}for(const[ke,Ue]of f.current)await q(Ue.pc,A.current),await Pt(ke,Ue.pc,Ue);const ye=()=>{try{kf(!1)}catch{}};let ve=!1;for(const[,ke]of f.current){const Ue=ke.pc,ct=()=>{!ve&&Ue.connectionState==="connected"&&(ve=!0,ye(),Ue.removeEventListener("connectionstatechange",ct))};Ue.addEventListener("connectionstatechange",ct)}window.setTimeout(()=>{ve||ye()},2500)}else{console.log("[RTC] setVideoEnabled(false) - disabling camera");for(const[fe,ye]of f.current)console.log("[RTC] removing video track from peer",fe),await q(ye.pc,void 0),await Pt(fe,ye.pc,ye);de()}d(w.current,B).catch(()=>{});try{mw(B?"videoEnabled:on":"videoEnabled:off")}catch{}}},[k,n,o,t==null?void 0:t.membershipTier,f,K,q,Pt,de,d]),Ee=async B=>{var ye,ve;if(!o){P(!1);return}if(P(B),B&&!_.current&&!await $()){P(!1);return}const fe=(ve=(ye=_.current)==null?void 0:ye.getAudioTracks)==null?void 0:ve.call(ye)[0];fe&&(fe.enabled=B);for(const[,ke]of f.current)await O(ke.pc,_.current)},le=B=>{var ye,ve,ke;if(B===n)return!!((ve=(ye=A.current)==null?void 0:ye.getVideoTracks)!=null&&ve.call(ye).some(Ue=>Ue.readyState==="live"));const fe=m[B];return!!((ke=fe==null?void 0:fe.getVideoTracks)!=null&&ke.call(fe).some(Ue=>Ue.readyState==="live"))},De=async B=>{if(!Hn(B)){if(!o){await O(B,void 0),await q(B,void 0);return}try{if(await $(),k&&await K(),Hn(B))return;Ar.debug("attachLocalTracks",{audio:!!(R&&_.current),video:!!(k&&A.current)}),await O(B,R?_.current:void 0),await q(B,k?A.current:void 0)}catch(fe){Ar.warn("attachLocalTracks:failed",{err:String(fe)})}}},Ye=l.useRef(0),Re=90*60*1e3;l.useEffect(()=>{if(!w.current||f.current.size===0)return;const B=async()=>{const ye=Date.now();if(!(ye-Ye.current<Re)){Ar.info("ice:refresh-credentials",{roomId:w.current});try{const ve=await c(w.current);if(ve!=null&&ve.ok&&Array.isArray(ve.iceServers)&&ve.iceServers.length){const ke=qp([...M,...ve.iceServers],M);C.current=ke,Ye.current=ye,Ar.debug("ice:credentials-refreshed",{count:ke.length})}}catch(ve){Ar.warn("ice:refresh-failed",{err:String(ve)})}}},fe=window.setInterval(B,6e4);return()=>clearInterval(fe)},[I,c]);const et=async B=>{var Ue;if(console.log("[RTC] joinRtc called",{roomId:B,isAuthed:o,meId:n,isGuest:s,userEmail:t==null?void 0:t.email}),!o||!n){console.warn("[RTC] joinRtc skipped: not authenticated",{isAuthed:o,meId:n,isGuest:s});return}w.current=B,Ar.info("rtc:join",{roomId:B});const fe=3,ye=150;let ve=null,ke=null;for(let ct=0;ct<fe&&(ve=await c(B),console.log("[RTC] joinRtc raw response",{ok:ve==null?void 0:ve.ok,attempt:ct,iceServersCount:(Ue=ve==null?void 0:ve.iceServers)==null?void 0:Ue.length}),!(ve!=null&&ve.ok||(ke=(ve==null?void 0:ve.error)||"rtc_join failed",!/not a member|room not found/i.test(ke||"")||ct>=fe-1)));ct++)Ar.warn("rtc:join:retry",{roomId:B,attempt:ct+1,error:ke}),await new Promise(Rt=>setTimeout(Rt,ye*(ct+1)));if(!(ve!=null&&ve.ok))throw new Error(ke||"rtc_join failed");if(Array.isArray(ve.iceServers)&&ve.iceServers.length){const ct=qp([...M,...ve.iceServers],M);C.current=ct,Ye.current=Date.now();const dt=ct.some(Rt=>(Array.isArray(Rt.urls)?Rt.urls:[Rt.urls]).some(Qe=>Qe.startsWith("turn:")||Qe.startsWith("turns:")));console.log("[RTC] joinRtc received ICE servers",{count:ct.length,hasTurn:dt,servers:ct.map(Rt=>({urls:Rt.urls,hasCredentials:!!(Rt.username&&Rt.credential)}))}),Ar.debug("rtc:ice-servers",{count:ct.length,servers:ct.map(Rt=>Rt.urls).slice(0,4)})}else C.current=[...M],Ye.current=Date.now();if(_e(),k&&!A.current){const ct=await K();ct&&v(ct)}for(const ct of ve.peers.filter(dt=>dt!==n)){const{pc:dt}=re(ct);await De(dt);const Rt=f.current.get(ct);await Pt(ct,dt,Rt)}L(f.current.size)},rt=B=>{var fe,ye,ve,ke;!B||w.current&&w.current,Ar.info("rtc:leave",{roomId:B});try{p(B)}catch{}for(const[,Ue]of f.current){Vp(Ue);try{Ue.pc.close()}catch{}}f.current.clear(),L(0),w.current=void 0,H(),h(Ue=>(Object.values(Ue).forEach(kh),{}));for(const Ue of Array.from(we.current.keys()))U(Ue);(ye=(fe=_.current)==null?void 0:fe.getTracks())==null||ye.forEach(Ue=>Ue.stop()),(ke=(ve=A.current)==null?void 0:ve.getTracks())==null||ke.forEach(Ue=>Ue.stop()),_.current=void 0,A.current=void 0,v(void 0),y({})},ne=async(B,fe)=>{},ue=async()=>{o&&await kt(!0)};return l.useEffect(()=>{if(!k||!w.current||f.current.size===0)return;const B=async()=>{var ve;if(!k||!A.current)return;const ye=A.current.getVideoTracks()[0];if(!((!ye||ye.readyState!=="live")&&(console.log("[RTC] Health check: local video track not live, re-acquiring"),Ar.warn("health:video-track-dead"),A.current=void 0,!await K()))){for(const[ke,Ue]of f.current)if(!Hn(Ue.pc))try{const ct=Ue.pc.getSenders().find(jr=>{var Qe;return((Qe=jr.track)==null?void 0:Qe.kind)==="video"}),dt=ct==null?void 0:ct.track,Rt=(ve=A.current)==null?void 0:ve.getVideoTracks()[0];Rt&&(!dt||dt.id!==Rt.id)&&(console.log("[RTC] Health check: re-attaching video track to peer",{peerId:ke}),Ar.info("health:reattach-video",{peerId:ke}),await q(Ue.pc,A.current),await Pt(ke,Ue.pc,Ue))}catch(ct){Ar.warn("health:check-failed",{peerId:ke,err:String(ct)})}}},fe=window.setInterval(B,5e3);return B(),()=>clearInterval(fe)},[k,I]),l.useEffect(()=>{if(!r||!o)return;const B=async()=>{const fe=w.current;if(fe){Ar.info("socket:reconnect:rtc-rejoin",{roomId:fe,peerCount:f.current.size}),console.log("[RTC] Socket reconnected, re-joining RTC room",{roomId:fe});for(const[,ye]of f.current){Vp(ye);try{ye.pc.close()}catch{}}f.current.clear(),L(0),h(ye=>(Object.values(ye).forEach(kh),{})),y({});try{const ye=await c(fe);if(!(ye!=null&&ye.ok)){Ar.warn("socket:reconnect:rtc-rejoin-failed",{roomId:fe,error:ye==null?void 0:ye.error});return}if(Array.isArray(ye.iceServers)&&ye.iceServers.length){const ve=qp([...M,...ye.iceServers],M);C.current=ve,Ye.current=Date.now()}for(const ve of ye.peers.filter(ke=>ke!==n)){const{pc:ke}=re(ve);await De(ke);const Ue=f.current.get(ve);await Pt(ve,ke,Ue)}L(f.current.size),Ar.info("socket:reconnect:rtc-rejoin-success",{roomId:fe,peerCount:f.current.size})}catch(ye){Ar.error("socket:reconnect:rtc-rejoin-error",{roomId:fe,err:String(ye)})}}};return r.on("connect",B),r.on("reconnect",B),()=>{r.off("connect",B),r.off("reconnect",B)}},[r,o,n,c]),l.useEffect(()=>{var fe,ye;const B=(ye=(fe=_.current)==null?void 0:fe.getAudioTracks)==null?void 0:ye.call(fe)[0];R&&B&&_.current?Fe(n,_.current):U(n)},[_.current,n,R]),l.useEffect(()=>{for(const[B,fe]of Object.entries(m))(fe==null?void 0:fe.getAudioTracks().some(ve=>ve.enabled))&&Fe(B,fe);for(const B of we.current.keys())B!==n&&!m[B]&&U(B)},[m,n]),Ba({onRtcPeerJoined:async({peerId:B})=>{if(Ar.info("sig:peer-joined",{peerId:B}),!(!w.current||B===n))try{const{pc:fe}=re(B);if(Hn(fe))return;await De(fe);const ye=f.current.get(B);ye&&!Hn(fe)&&await Pt(B,fe,ye)}catch(fe){Ar.warn("sig:peer-joined:failed",{peerId:B,err:String(fe)})}},onRtcPeerLeft:({peerId:B})=>{Ar.info("sig:peer-left",{peerId:B});const fe=f.current.get(B);if(fe){Vp(fe),Q(B);try{fe.pc.close()}catch{}}f.current.delete(B),L(f.current.size),h(ye=>{const ve={...ye};return kh(ve[B]),delete ve[B],ve}),U(B),y(ye=>{const{[B]:ve,...ke}=ye;return ke})},onRtcSignal:async({fromPeerId:B,payload:fe})=>{var ke;let ye,ve;try{ye=re(B),ve=ye.pc}catch(Ue){Ar.warn("sig:getPeer-failed",{fromPeerId:B,err:String(Ue)});return}if(Hn(ve)){Ar.debug("sig:pc-closed",{fromPeerId:B});return}try{if(fe.sdp){if(Ar.debug("sig:sdp",{fromPeerId:B,type:fe.sdp.type}),console.log("[RTC] Received SDP",{fromPeerId:B,type:fe.sdp.type,signalingState:ve.signalingState}),Hn(ve))return;const Ue=fe.sdp;if(Ue.type==="answer"&&Xe(ve)){Ar.debug("sig:stale-answer-ignored",{fromPeerId:B,signalingState:ve.signalingState}),console.log("[RTC] Ignoring stale answer (connection already stable)",{fromPeerId:B});return}const ct=Xe(ve)||ye.isSettingRemoteAnswerPending,dt=Ue.type==="offer"&&!ct;if(ye.ignoreOffer=!(n<B)&&dt,ye.ignoreOffer){console.log("[RTC] Ignoring offer due to collision",{fromPeerId:B});return}if(Ue.type==="answer"&&(ye.isSettingRemoteAnswerPending=!0),dt&&(console.log("[RTC] Rolling back due to offer collision",{fromPeerId:B}),Hn(ve)||await ve.setLocalDescription({type:"rollback"})),Hn(ve))return;if(await ve.setRemoteDescription(Ue),console.log("[RTC] Set remote description",{fromPeerId:B,type:Ue.type,signalingState:ve.signalingState}),ye.isSettingRemoteAnswerPending=!1,Ue.type==="offer"&&!Hn(ve)){const Rt=await ve.createAnswer();if(Hn(ve))return;await ve.setLocalDescription(Rt),console.log("[RTC] Sending answer",{fromPeerId:B,type:(ke=ve.localDescription)==null?void 0:ke.type}),await u(w.current,B,{sdp:ve.localDescription})}for(;ye.iceBuffer.length&&!Hn(ve);){const Rt=ye.iceBuffer.shift();try{await ve.addIceCandidate(Rt)}catch{}}}else if(fe.ice){if(Ar.debug("sig:ice",{fromPeerId:B,hasRemote:!!ve.remoteDescription}),Hn(ve))return;const Ue=fe.ice;if(ve.remoteDescription)try{await ve.addIceCandidate(Ue)}catch{}else ye.iceBuffer.push(Ue)}}catch(Ue){const ct=String(Ue);Ar.error("sig:error",{fromPeerId:B,err:ct}),console.error("[RTC] Signal error",{fromPeerId:B,err:ct}),(ct.includes("order of m-lines")||ct.includes("m-line")||ct.includes("InvalidAccessError"))&&(console.log("[RTC] M-line mismatch detected, rebuilding peer",{fromPeerId:B}),Ar.warn("sig:mline-mismatch-rebuild",{fromPeerId:B}),await _t(B))}},onRtcVideoEnabled:({playerId:B,enabled:fe})=>{Ar.debug("sig:video-enabled",{playerId:B,enabled:fe}),y(ye=>({...ye,[B]:!!fe}))}}),l.useEffect(()=>{let B=!0;return(async()=>{try{const fe=await ma();if(!B)return;E(!1),n&&y(ye=>({...ye,[n]:!1})),P(o?!!fe.chatAudio:!1)}catch{}})(),()=>{B=!1}},[n,o]),l.useEffect(()=>{o||(P(!1),k&&i("auth:lost"),E(!1),n&&y(B=>({...B,[n]:!1})),(async()=>{for(const[B,fe]of f.current)await O(fe.pc,void 0),await q(fe.pc,void 0),await Pt(B,fe.pc,fe).catch(()=>{})})(),ie(),de())},[o,n]),l.useEffect(()=>{const B=fe=>{const ye=fe.detail;ye&&(typeof ye.video=="boolean"&&ye.video===!1&&(E(!1),y(ve=>({...ve,[n]:!1}))),typeof ye.chatAudio=="boolean"&&P(ye.chatAudio))};return window.addEventListener("app:settings",B),()=>window.removeEventListener("app:settings",B)},[n]),l.useEffect(()=>{const B=()=>{if(document.visibilityState==="visible")for(const[ve,ke]of f.current)ee(ve,ke)},fe=()=>{for(const[ve,ke]of f.current)ee(ve,ke)},ye=()=>{for(const[ve,ke]of f.current)ee(ve,ke)};return document.addEventListener("visibilitychange",B),window.addEventListener("online",fe),window.addEventListener("offline",ye),()=>{document.removeEventListener("visibilitychange",B),window.removeEventListener("online",fe),window.removeEventListener("offline",ye)}},[]),l.useEffect(()=>{try{const B=window;B.__rtcCtxInternal||(B.__rtcCtxInternal={}),B.__rtcCtxInternal.peers=f.current,B.__rtcCtxInternal.myVideoRef=A,B.__rtcCtxInternal.videoEnabledState={current:k}}catch{}},[k,x,I]),a.jsx(aD.Provider,{value:{videoEnabled:k,setVideoEnabled:kt,enableCamera:ue,joinRtc:et,leaveRtc:rt,cameraOwnerId:b,setCameraOwner:ne,remoteStreams:m,myVideo:x,micEnabled:R,setMicEnabled:Ee,hasVideo:le,speaking:he,remoteVideoFlags:g},children:e})}function tse(e){const t=[];for(const[r,n]of e)try{const s=n.pc;t.push({id:r,state:s.connectionState,ice:s.iceConnectionState,signaling:s.signalingState})}catch{}return t}function mw(e){var t,r,n,s;try{const o=window,i=o.__rtcCtxInternal||{},c=i.peers||new Map,u=(t=i.myVideoRef)==null?void 0:t.current,p=(r=u==null?void 0:u.getVideoTracks)==null?void 0:r.call(u)[0],d={t:Date.now(),label:e,videoEnabled:(n=i.videoEnabledState)==null?void 0:n.current,hasStream:!!u,trackState:p==null?void 0:p.readyState,muted:p==null?void 0:p.muted,peers:tse(c),activePeerCount:c.size};o.__rtcDiag||(o.__rtcDiag=[]),o.__rtcDiag.push(d),o.__rtcDiag.length>200&&o.__rtcDiag.splice(0,o.__rtcDiag.length-200),(s=o.dispatchEvent)==null||s.call(o,new CustomEvent("rtc:diag",{detail:d}))}catch{}}try{queueMicrotask(()=>{const e=window;e.__rtcCtxInternal||(e.__rtcCtxInternal={}),e.__dumpRtcDiag=mw})}catch{}function Yo(){var M;const e=Yae(),t=Kae(),r=!!e&&!e.liveKitFailed,n=e==null?void 0:e.joinRoom,s=e==null?void 0:e.leaveRoom,o=e==null?void 0:e.setVideoEnabled,i=e==null?void 0:e.setMicEnabled,c=t==null?void 0:t.joinRtc,u=t==null?void 0:t.leaveRtc,p=t==null?void 0:t.setVideoEnabled,d=t==null?void 0:t.setMicEnabled,f=l.useRef(c);f.current=c;const m=l.useRef(u);m.current=u;const h=l.useRef(p);h.current=p;const b=l.useRef(d);b.current=d;const g=(e==null?void 0:e.liveKitFailed)??!1,y=(e==null?void 0:e.pendingRoomId)??null;l.useEffect(()=>{g&&y&&f.current&&(console.log("[useUnifiedRtc] LiveKit failed — falling back to mesh P2P for room:",y),Promise.resolve(f.current(y)).catch(C=>{console.error("[useUnifiedRtc] Mesh fallback join failed:",C)}))},[g,y]);const x=l.useCallback(async C=>{r&&n?await n(C):f.current&&await Promise.resolve(f.current(C))},[r,n]),v=l.useCallback(async C=>{r&&s?await s():m.current&&m.current(C)},[r,s]),A=l.useCallback(async C=>{r&&o?await o(C):h.current&&await h.current(C)},[r,o]),_=l.useCallback(async C=>{r&&i?await i(C):b.current&&await b.current(C)},[r,i]),w=l.useMemo(()=>{if(r){const C={};e.localParticipant&&(C[e.localParticipant.id]=e.localParticipant.isSpeaking);for(const I of e.participants)C[I.id]=I.isSpeaking;return C}return(t==null?void 0:t.speaking)??{}},[r,e==null?void 0:e.localParticipant,e==null?void 0:e.participants,t==null?void 0:t.speaking]),j=l.useRef(null),T=l.useMemo(()=>{var I,L,N,S;if(!r)return t==null?void 0:t.myVideo;const C=((I=e.localParticipant)==null?void 0:I.videoTrack)||e.localVideoTrack;if(C){if(C.mediaStream instanceof MediaStream){const D=C.mediaStream,H=((L=D.getVideoTracks()[0])==null?void 0:L.id)??"";return((N=j.current)==null?void 0:N.trackId)===H?j.current.ms:(j.current={trackId:H,ms:D},D)}const F=C.mediaStreamTrack;if(F instanceof MediaStreamTrack){if(((S=j.current)==null?void 0:S.trackId)===F.id)return j.current.ms;const D=new MediaStream;return D.addTrack(F),j.current={trackId:F.id,ms:D},D}}j.current=null},[r,(M=e==null?void 0:e.localParticipant)==null?void 0:M.videoTrack,e==null?void 0:e.localVideoTrack,t==null?void 0:t.myVideo]),R=l.useRef({}),P=l.useMemo(()=>{if(!r)return(t==null?void 0:t.remoteStreams)??{};const C={},I=R.current,L=new Set;for(const N of e.participants){const S=N.videoTrack&&"mediaStreamTrack"in N.videoTrack?N.videoTrack.mediaStreamTrack:null,F=N.audioTrack&&"mediaStreamTrack"in N.audioTrack?N.audioTrack.mediaStreamTrack:null;if(!S&&!F)continue;const D=(S==null?void 0:S.id)??"",H=(F==null?void 0:F.id)??"";L.add(N.id);const W=I[N.id];if(W&&W.videoId===D&&W.audioId===H){C[N.id]=W.ms;continue}const G=new MediaStream;S&&G.addTrack(S),F&&G.addTrack(F),I[N.id]={videoId:D,audioId:H,ms:G},C[N.id]=G}for(const N of Object.keys(I))L.has(N)||delete I[N];return C},[r,e==null?void 0:e.participants,t==null?void 0:t.remoteStreams]),k=l.useMemo(()=>{if(!r)return t==null?void 0:t.remoteVideoFlags;const C={};e.localParticipant&&(C[e.localParticipant.id]=e.localParticipant.videoEnabled);for(const I of e.participants)C[I.id]=I.videoEnabled;return C},[r,e==null?void 0:e.localParticipant,e==null?void 0:e.participants,t==null?void 0:t.remoteVideoFlags]),E=l.useMemo(()=>{if(r){const C=e.localParticipant;if(C&&(C.audioEnabled||C.videoEnabled))return!0;for(const I of e.participants)if(I.audioEnabled||I.videoEnabled)return!0;return!1}return T?!0:Object.keys((t==null?void 0:t.remoteStreams)??{}).length>0},[r,e==null?void 0:e.localParticipant,e==null?void 0:e.participants,t==null?void 0:t.remoteStreams,T]);return l.useMemo(()=>({joinRoom:x,leaveRoom:v,connected:(r?!!(e!=null&&e.connected):((t==null?void 0:t.activePeerCount)??0)>0)&&E,videoEnabled:r?!!(e!=null&&e.videoEnabled):(t==null?void 0:t.videoEnabled)??!1,setVideoEnabled:A,localVideoTrack:r?(e==null?void 0:e.localVideoTrack)??null:(t==null?void 0:t.myVideo)??null,micEnabled:r?!!(e!=null&&e.micEnabled):(t==null?void 0:t.micEnabled)??!1,setMicEnabled:_,speaking:w,participants:r?(e==null?void 0:e.participants)??[]:[],localParticipant:r?(e==null?void 0:e.localParticipant)??null:null,remoteStreams:P,myVideo:T,remoteVideoFlags:k,throttleVideoForAnimation:t==null?void 0:t.throttleVideoForAnimation,mode:r?"livekit":"mesh"}),[x,v,A,_,w,r,e,t,T,P,k,E])}const sD=l.createContext(null),Is=()=>l.useContext(sD),Vv={};function rse({children:e}){const{user:t,meId:r}=Zr(),n=r||(t==null?void 0:t.id),{resetSpin:s}=Ti(),o=Hr(),{joinRoom:i,leaveRoom:c,setSpectate:u,pokerJoinRoom:p,getRoomsList:d}=sa(),[f,m]=l.useState(()=>{try{const k=window.__PRESEEDED_ROOM;if(k&&typeof k=="object")return delete window.__PRESEEDED_ROOM,k}catch{}return null}),{leaveRoom:h,joinRoom:b}=Yo(),g=l.useRef(n);l.useEffect(()=>{const k=g.current;g.current=n,k&&n&&k!==n&&m(E=>{if(!E)return E;console.log("[RoomContext] identity changed (%s → %s), clearing stale room %s",k,n,E.id);try{h(E.id)}catch{}return null})},[n,h]);const y=l.useRef({}),x=l.useMemo(()=>((f==null?void 0:f.gameState)??{}).phase==="waiting"||f===null,[f]),v=l.useCallback(async k=>{var E,M,C,I,L,N;try{const S=await i(k);if(!(S!=null&&S.ok))throw new Error((S==null?void 0:S.error)||"Failed to join room");try{s()}catch{}if(console.log("joined room*********",S.room),m(S.room),(E=S.room)!=null&&E.singlePlayer)console.log("[RoomContext] skipping joinRtc for single-player room");else{console.log("[RoomContext] calling joinRtc for room",(M=S.room)==null?void 0:M.id);try{await Promise.resolve(b==null?void 0:b(k))}catch(F){console.error("[RoomContext] joinRtc error:",F)}}if(!((C=S.room)!=null&&C.singlePlayer))try{const F=await(d==null?void 0:d()),H=(F&&(Array.isArray(F==null?void 0:F.rooms)?F.rooms:Array.isArray((I=F==null?void 0:F.data)==null?void 0:I.rooms)?F.data.rooms:[])||[]).find(W=>(W==null?void 0:W.id)===k);H&&Array.isArray(H.players)&&m(W=>{if(!W||W.id!==k)return W;const G=Array.isArray(W.players)?W.players:[],$=new Map(G.map(de=>[de.id,de])),K=H.players.map(de=>{const ie=$.get(de.id);if(ie){const we=de.name&&de.name!=="Bot"&&de.name!=="Player"?de.name:ie.name&&ie.name!=="Bot"&&ie.name!=="Player"?ie.name:de.name||ie.name,he=de.avatarUrl??ie.avatarUrl??null;return{...ie,...de,name:we,avatarUrl:he}}return de});for(const de of G)K.some(ie=>ie.id===de.id)||K.push(de);return{...W,players:K}})}catch{}return{ok:!0,room:S.room}}catch(S){try{if(!(typeof window<"u"&&(((N=(L=window.location)==null?void 0:L.search)==null?void 0:N.includes("e2e=1"))||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")))throw S;const D=Date.now(),H=n||"e2e-user",W=(t==null?void 0:t.name)||"E2E User",G={id:k,name:"E2E Room",gameMode:"craps",createdAt:D,updatedAt:D,bankerId:"bank",players:[{id:H,name:W,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:H,turnOrder:[H],roundSeq:1,crapsPassBets:[{playerId:H,amount:10}],crapsDontPassBets:[],crapsPlaceBets:[]}};try{s()}catch{}m(G);return}catch{throw S}}},[i,s,b,d,n,t==null?void 0:t.name]),A=l.useCallback(async()=>{if(f){try{await h(f.id)}catch{}try{await c(f.id)}finally{m(null)}}},[c,h,f]),_=l.useCallback((k,E)=>{if(!E)return k;if(!k)return E;try{const M=Array.isArray(k.players)?k.players:[],C=Array.isArray(E.players)?E.players:[];let I;if(C.length===0&&M.length>0)I=M;else if(M.length===0)I=C;else{const L=new Map(M.map(S=>[String(S.id),S])),N=new Map(C.map(S=>[String(S.id),S]));I=[];for(const[S,F]of N.entries()){const D=L.get(S);D?I.push({...D,...F,name:F.name||D.name,avatarUrl:F.avatarUrl??D.avatarUrl}):I.push(F)}}return{...k,...E,players:I}}catch{return E||k}},[]);Ba({onJoinedRoom:({room:k})=>{try{s()}catch{}m(E=>_(E,k))},onOtherPlayerJoined:({room:k})=>m(E=>_(E,k)),onOtherLeft:({room:k})=>{let E=!1,M=null;if(m(C=>{var L,N;const I=_(C,k);try{const S=Array.isArray(k==null?void 0:k.players)?k==null?void 0:k.players:Array.isArray(I==null?void 0:I.players)?I.players:[],F=String(n||""),D=F&&S.some(H=>String(H==null?void 0:H.id)===F);if(D&&C)try{delete y.current[String(C.id||"")]}catch{}if(!D&&C){if(!!(k!=null&&k.singlePlayer||I!=null&&I.singlePlayer)||((L=k==null?void 0:k.gameState)==null?void 0:L.gameMode)==="zentara"||((N=I==null?void 0:I.gameState)==null?void 0:N.gameMode)==="zentara")return I;const G=String(C.id||""),$=y.current[G]||0,K=Date.now();return $?K-$<1500?I:(E=!0,M=String(C.id),delete y.current[G],null):(y.current[G]=K,I)}}catch{}return I}),E){try{M&&(h==null||h(M))}catch{}try{o("/lobby",{replace:!0})}catch{}}},onSpectatorsUpdated:({spectators:k})=>{m(E=>E&&{...E,gameState:{...E.gameState,spectators:k}})},onPlayerProfileUpdated:({playerId:k,name:E,avatarUrl:M})=>{m(C=>{if(!C)return C;const I=C.players.map(L=>L.id!==k?L:{...L,...E!==void 0&&{name:E},...M!==void 0&&{avatarUrl:M}});return{...C,players:I}})},onBetsUpdated:({room:k})=>{k&&m(E=>{if(!E)return k;try{const M=new Map(E.players.map(L=>[L.id,L])),C=new Map((k.players||[]).map(L=>[L.id,L])),I=E.players.map(L=>{const N=C.get(L.id);if(!N)return L;const S={...L,...N};return(!N.name||N.name==="Player"||N.name==="Anonymous")&&L.name&&L.name!=="Player"&&L.name!=="Anonymous"&&(S.name=L.name),N.avatarUrl==null&&L.avatarUrl&&(S.avatarUrl=L.avatarUrl),S});for(const[L,N]of C.entries())M.has(L)||I.push(N);return{...E,gameState:k.gameState??E.gameState,name:k.name??E.name,maxPlayers:k.maxPlayers??E.maxPlayers,private:k.private??E.private,singlePlayer:k.singlePlayer??E.singlePlayer,players:I}}catch{return E}})},onBankerChanged:k=>{m(E=>!E||E.id!==k.roomId?E:{...E,gameState:{...E.gameState,banker:k.bankerId,currentRollerId:k.currentRollerId,roundSeq:k.roundSeq,bankRoll:null}})},onForceLogout:k=>{(k==null?void 0:k.reason)==="session_superseded"&&Hj();try{f!=null&&f.id&&h(f.id)}catch{}m(null)},onRoomUpdateState:({roomId:k,gameState:E,room:M})=>{const C=(M==null?void 0:M.gameState)??E;if(!C)return;const I=Array.isArray(M==null?void 0:M.players)?M.players:[];let L=!1,N=null;if(m(S=>{var D;const F=H=>{if(!I.length)return H;const W=new Map(H.map(G=>[G.id,G]));for(const G of I){const $=W.get(G.id);if($){const K=!G.name||G.name==="Player"||G.name==="Anonymous",de={...$,...G};K&&$.name&&$.name!=="Player"&&$.name!=="Anonymous"&&(de.name=$.name),G.avatarUrl==null&&$.avatarUrl&&(de.avatarUrl=$.avatarUrl),W.set(G.id,de)}else W.set(G.id,G)}return Array.from(W.values())};try{if(I.length&&S&&S.id===k){const H=String(n||"");if(H){const W=I.some(G=>String(G==null?void 0:G.id)===H);if(W)try{delete y.current[String(S.id||"")]}catch{}if(!W){if(!!(M!=null&&M.singlePlayer||S!=null&&S.singlePlayer))return{...S,players:F(S.players),gameState:C};if((C==null?void 0:C.gameMode)==="zentara"||((D=S==null?void 0:S.gameState)==null?void 0:D.gameMode)==="zentara")return{...S,players:F(S.players),gameState:C};const K=String(S.id||""),de=y.current[K]||0,ie=Date.now();return de?ie-de<1500?{...S,players:F(S.players),gameState:C}:(L=!0,N=String(S.id),delete y.current[K],null):(y.current[K]=ie,{...S,players:F(S.players),gameState:C})}}}}catch{}return S&&S.id===k?{...S,players:F(S.players),gameState:C}:S||{id:k,players:I,gameState:C}}),L){try{N&&(h==null||h(N))}catch{}try{o("/lobby",{replace:!0})}catch{}}},onPlayerBalanceUpdated:({playerId:k,balance:E})=>{console.log("[RoomContext] onPlayerBalanceUpdated received",{playerId:k,balance:E}),m(M=>{if(!M)return M;const C=M.players.findIndex(N=>N.id===k);if(console.log("[RoomContext] onPlayerBalanceUpdated processing",{playerId:k,balance:E,idx:C,playersCount:M.players.length}),C<0){const N=[...M.players,{id:k,balance:E}];return{...M,players:N}}const I=M.players[C];if(typeof(I==null?void 0:I.balance)=="number"&&I.balance===E)return M;const L=M.players.slice();return L[C]={...I,balance:E},{...M,players:L}})},onError:k=>{console.warn("Socket error:",k);try{const E=(li==null?void 0:li())||[],M=Date.now(),C=[...E].filter(I=>M-I.ts<1200).slice(-1)[0];C&&console.debug("[socket][error-source]",{event:C.event,mode:C.mode,ts:C.ts})}catch{}}});const w=l.useMemo(()=>({room:f,isWaiting:x,joinRoom:v,leaveRoom:A,setRoom:m,setSpectatingForMe:async k=>{if(f)try{return await u(f.id,k)}catch(E){return{ok:!1,error:(E==null?void 0:E.message)||"Failed"}}}}),[f,x,v,A,u]),j=Na(),T=l.useRef(0),R=l.useRef(!1),P=l.useCallback(async()=>{var M,C;const k=Date.now();if(k-(T.current||0)<800)return;T.current=k;const E=f==null?void 0:f.id;if(!E){try{const L=((li==null?void 0:li())||[]).slice(-1)[0];if(L&&String(L.event).toLowerCase().includes("create_room")&&k-(L.ts||0)<1500)return}catch{}return}try{const L=((li==null?void 0:li())||[]).slice(-1)[0];L&&String(L.event).toLowerCase().includes("create_room")&&k-(L.ts||0)<1500&&await new Promise(S=>setTimeout(S,1100))}catch{}try{const I=(f==null?void 0:f.gameMode)==="poker";let L;if(I&&typeof p=="function"){const N=Vv[E];if(N)L=await N;else{const S=p(E);Vv[E]=S;try{L=await S}finally{delete Vv[E]}}}else L=await i(E);if(L!=null&&L.ok){try{s()}catch{}if(m(L.room),!((M=L.room)!=null&&M.singlePlayer))try{await Promise.resolve(b==null?void 0:b(E))}catch{}try{const N=await(d==null?void 0:d()),F=(N&&(Array.isArray(N==null?void 0:N.rooms)?N.rooms:Array.isArray((C=N==null?void 0:N.data)==null?void 0:C.rooms)?N.data.rooms:[])||[]).find(D=>(D==null?void 0:D.id)===E);F&&Array.isArray(F.players)&&m(D=>!D||D.id!==E?D:{...D,players:F.players})}catch{}}}catch(I){console.warn("[room] rejoin after reconnect failed",I)}},[f==null?void 0:f.id,p,i,s,b,d]);return l.useEffect(()=>{var I;if(!j)return;const k=L=>{L!=="io client disconnect"&&(R.current=!0)},E=()=>{R.current&&(R.current=!1,P())},M=()=>{P()},C=()=>{P()};j.on("disconnect",k),j.on("connect",E);try{j.io.on("reconnect",M)}catch{}try{(I=j.on)==null||I.call(j,"reconnect",C)}catch{}return()=>{var L;j.off("disconnect",k),j.off("connect",E);try{j.io.off("reconnect",M)}catch{}try{(L=j.off)==null||L.call(j,"reconnect",C)}catch{}}},[j,P]),l.useEffect(()=>{const k=()=>{try{document.visibilityState==="visible"&&(R.current||!(j!=null&&j.connected))&&P()}catch{}},E=()=>{(R.current||!(j!=null&&j.connected))&&P()},M=()=>{(R.current||!(j!=null&&j.connected))&&P()},C=()=>{console.log("[RoomContext] ad:complete event received, triggering room rejoin"),P()};return window.addEventListener("visibilitychange",k),window.addEventListener("focus",E),window.addEventListener("pageshow",M),window.addEventListener("ad:complete",C),()=>{window.removeEventListener("visibilitychange",k),window.removeEventListener("focus",E),window.removeEventListener("pageshow",M),window.removeEventListener("ad:complete",C)}},[j,P]),a.jsx(sD.Provider,{value:w,children:e})}const Sh=globalThis.__lastWagersFetchAt||(globalThis.__lastWagersFetchAt={}),FP=500;function jb(e,t){const r=Na(),{room:n}=Is(),s=e&&t?`betsnap:${e}:${t}`:null,[o,i]=l.useState(()=>({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[],playerBalance:null}));l.useEffect(()=>{s&&(async()=>{try{const U=await Xd(s);if(!(U!=null&&U.mainWagerId))return;i(V=>V.open.some(O=>O.type==="MAIN"&&O.playerId===t)?V:{...V,roundSeq:U.roundSeq||V.roundSeq,open:[...V.open,{id:U.mainWagerId,type:"MAIN",playerId:t,acceptedById:null,amount:0,roundSeq:U.roundSeq}]})}catch{}})()},[s,t]),l.useEffect(()=>{s&&(async()=>{try{const U=await Xd(s);if(!U)return;U!=null&&U.mainWagerId&&i(V=>V.open.some(O=>O.type==="MAIN"&&O.playerId===t)?V:{...V,roundSeq:U.roundSeq||V.roundSeq,open:[...V.open,{id:U.mainWagerId,type:"MAIN",playerId:t,acceptedById:null,amount:0,roundSeq:U.roundSeq}]})}catch{}})()},[s,t]);const{getWagers:c,createSideBet:u,cancelSideBet:p,acceptSideBet:d,placeMainBet:f,cancelMainBet:m}=sa(),[h,b]=l.useState([]),g=l.useRef(new Set),y=l.useRef(new Set),[x,v]=l.useState(0),A=l.useRef(null);l.useEffect(()=>{if(A.current===null){A.current=e;return}i({roundSeq:1,open:[],settled:[],openAll:[],settledAll:[]}),b([]),g.current.clear(),y.current.clear(),v(0),s&&Yd(s)},[e,s]),Ba({onBetsUpdated:U=>{s&&(async()=>{try{const q=U.open.find(X=>X.type==="MAIN"&&X.playerId===t);q?await Qy(s,{roundSeq:U.roundSeq,mainWagerId:q.id}):await Yd(s)}catch{}})(),i(U);const V=U.settled.filter(q=>q.roundSeq===U.roundSeq);b(V.filter(q=>!g.current.has(q.id)));const O=(U.open||[]).filter(q=>q.type==="SIDE"&&!q.acceptedById&&q.playerId!==t&&q.subjectId!==t).filter(q=>!y.current.has(q.id));v(O.length)}});const[_,w]=l.useState([]);l.useEffect(()=>{w([])},[e]),l.useEffect(()=>{const U=Array.isArray(o.settledAll)?o.settledAll:[];U.length===0&&_.length===0||w(V=>{if(U.length===0)return V;const z=new Map;for(const q of V)z.set(q.id,q);for(const q of U)z.set(q.id,q);return Array.from(z.values()).sort((q,X)=>{const Z=Number(q.roundSeq||0),Q=Number(X.roundSeq||0);return Q!==Z?Q-Z:String(X.id).localeCompare(String(q.id))})})},[o.settledAll]),l.useEffect(()=>{if(!e)return;let U=null;const V=()=>{const O=Date.now(),q=Sh[e]||0;O-q<FP||(Sh[e]=O,U=window.setTimeout(()=>{try{c(e)}catch{}},300))};if((n==null?void 0:n.id)===e)return V(),()=>{U&&clearTimeout(U)};const z=window.setTimeout(()=>{V()},500);return()=>{U&&clearTimeout(U),clearTimeout(z)}},[e,n==null?void 0:n.id,c]),l.useEffect(()=>{if(!r)return;const U={current:0},V={current:r.connected},z=()=>{if(!e||(n==null?void 0:n.id)!==e)return;const Z=Date.now();if(!(Z-U.current<400)&&!(Z-(Sh[e]||0)<FP)){U.current=Z,Sh[e]=Z;try{y.current.clear(),v(0),g.current.clear(),setTimeout(()=>{try{c(e)}catch{}},300)}catch{}}},O=()=>{if(!V.current){V.current=!0;return}z()},q=()=>{z()},X=()=>{document.visibilityState==="visible"&&z()};return r.on("connect",O),window.addEventListener("ad:complete",q),window.addEventListener("visibilitychange",X),()=>{r.off("connect",O),window.removeEventListener("ad:complete",q),window.removeEventListener("visibilitychange",X)}},[r,e,n==null?void 0:n.id,c]),l.useEffect(()=>{b([]),g.current.clear()},[o.roundSeq]);const j=l.useMemo(()=>{var U;return(U=o.openAll)==null?void 0:U.filter(V=>V.type==="MAIN")},[o.openAll]),T=l.useMemo(()=>o.open.find(U=>U.type==="MAIN"&&U.playerId===t),[o.open,t]),R=l.useMemo(()=>{var U;return(U=o.openAll)==null?void 0:U.filter(V=>V.type==="SIDE")},[o.openAll]),P=l.useMemo(()=>o.open.filter(U=>U.type==="SIDE"&&(U.playerId===t||U.acceptedById===t)),[o.open,t]),k=l.useMemo(()=>o.settled.filter(U=>U.playerId===t||U.acceptedById===t),[o.settled,t]);l.useMemo(()=>_.filter(U=>U.playerId===t||U.acceptedById===t),[_,t]);const E=l.useMemo(()=>o.open.filter(U=>U.playerId===t||U.acceptedById===t).reduce((U,V)=>U+(V.amount||0),0),[o.open,t]),[M,C]=l.useState([]);l.useEffect(()=>{const U=setTimeout(()=>{C(_.filter(V=>V.playerId===t||V.acceptedById===t))},ha.mySettledDelayMs);return()=>clearTimeout(U)},[_,t]);const[I,L]=l.useState(null);l.useEffect(()=>{const U=setTimeout(()=>{L(o.playerBalance)},ha.balanceDelayMs);return()=>clearTimeout(U)},[o.playerBalance]);const[N,S]=l.useState([]);l.useEffect(()=>{const U=setTimeout(()=>{S(_)},ha.settledAllDelayMs);return()=>clearTimeout(U)},[_]);const F=l.useMemo(()=>o.open.filter(U=>U.type==="SIDE"&&!U.acceptedById&&U.subjectId!==t&&U.playerId!==t),[o.open,t]),D=()=>b(U=>{if(U.length===0)return U;const[V,...z]=U;return g.current.add(V.id),z}),H=U=>b(V=>(g.current.add(U),V.filter(z=>z.id!==U))),W=l.useCallback(()=>{for(const U of F)y.current.add(U.id);v(0)},[F]),G=l.useCallback(async U=>{var V;try{const z=await u(e,{amount:Math.floor(U.amount),subjectId:U.subjectId,predicate:U.predicate,oddsBp:U.oddsBp});return z!=null&&z.ok?{ok:!0,betId:((V=z==null?void 0:z.wager)==null?void 0:V.id)||(z==null?void 0:z.id)||U.clientBetId}:{ok:!1,error:(z==null?void 0:z.error)||"Failed to place side bet"}}catch(z){return{ok:!1,error:(z==null?void 0:z.message)||"Failed to place side bet"}}},[e,u]),$=l.useCallback(async U=>{try{const V=await p(e,U);return V!=null&&V.ok?{ok:!0}:{ok:!1,error:(V==null?void 0:V.error)||"Failed to cancel side bet"}}catch(V){return{ok:!1,error:(V==null?void 0:V.message)||"Failed to cancel side bet"}}},[e,p]),K=l.useCallback(async U=>{try{const V=await d(e,U);return V!=null&&V.ok?{ok:!0}:{ok:!1,error:(V==null?void 0:V.error)||"Failed to accept side bet"}}catch(V){return{ok:!1,error:(V==null?void 0:V.message)||"Failed to accept side bet"}}},[e,d]),de=l.useCallback(async U=>{var V;try{const z=await f(e,Math.floor(U));return z!=null&&z.ok?{ok:!0,wagerId:((V=z==null?void 0:z.wager)==null?void 0:V.id)||(z==null?void 0:z.id)}:{ok:!1,error:(z==null?void 0:z.error)||"Failed to place main bet"}}catch(z){return{ok:!1,error:(z==null?void 0:z.message)||"Failed to place main bet"}}},[e,f]),ie=l.useCallback(async U=>{try{const V=await m(e,U);return V!=null&&V.ok?{ok:!0}:{ok:!1,error:(V==null?void 0:V.error)||"Failed to cancel main bet"}}catch(V){return{ok:!1,error:(V==null?void 0:V.message)||"Failed to cancel main bet"}}},[e,m]),[we,he]=l.useState([]),Ae=l.useRef(o.roundSeq),Fe=l.useRef(new Set);return l.useEffect(()=>{Ae.current!==o.roundSeq&&(Ae.current=o.roundSeq,Fe.current.clear(),he([]));const U=o.settledAll.filter(V=>V.roundSeq===o.roundSeq&&!Fe.current.has(V.id));if(U.length>0){U.forEach(z=>Fe.current.add(z.id)),he(U);const V=setTimeout(()=>he([]),1e3);return()=>clearTimeout(V)}},[o.settledAll,o.roundSeq]),{roundSeq:o.roundSeq,openAll:o.openAll,open:o.open,settled:o.settled,settledAll:N,myOpenMain:T,myOpenSides:P,openAllMain:j,openAllSides:R,mySettledThisRound:k,mySettledAll:M,myExposure:E,unseenSettledWagers:h,consumeNextUnseen:D,markAsSeen:H,offersToMe:F,newOfferCount:x,markOffersAsSeen:W,placeSideBet:G,cancelSideBet:$,acceptSideBet:K,placeMainBet:de,cancelMainBet:ie,playerBalance:I,newSettlements:we}}function UP(e){return e==="WIN"?"LOSE":e==="LOSE"?"WIN":e}function ky(e){const t=Math.round(Number(e)||0);try{return`z${new Intl.NumberFormat(void 0,{maximumFractionDigits:0}).format(t)}`}catch{return`z${t}`}}function ou(e,t){if(!e)return{myResult:"",myPayout:0,label:""};const r=e.playerId,n=t===r,s=e.acceptedById,o=s!=null&&t===s;if(e.type==="MAIN"){if(!(n||o))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(e.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(n){const i=qP(e);return{myResult:e.result,myPayout:e.result==="WIN"?i:0,label:kc(e.result,e.result==="WIN"?i:0,e.amount)}}else{const i=UP(e.result),c=nse(e);return{myResult:i,myPayout:i==="WIN"?c:0,label:kc(i,i==="WIN"?c:0,e.amount)}}}if(e.type==="SIDE"){const i=t===e.acceptedById;if(!(n||i))return{myResult:"N/A",myPayout:0,label:"Not your bet"};if(e.result==="PUSH")return{myResult:"PUSH",myPayout:0,label:"Push"};if(n){const c=qP(e),u=e.result==="WIN"?c:0,p={myResult:e.result,myPayout:u,label:kc(e.result,u,e.amount)};if(p.myResult==="WIN"&&p.myPayout<=0){const d=typeof e.payout=="number"&&e.payout>0?e.payout:e.amount;return{myResult:p.myResult,myPayout:d,label:kc(p.myResult,d,e.amount)}}return p}else{const c=UP(e.result),u=ase(e),p=c==="WIN"?u:0,d={myResult:c,myPayout:p,label:kc(c,p,e.amount)};if(d.myResult==="WIN"&&d.myPayout<=0){const f=typeof e.payout=="number"&&e.payout>0?e.payout:e.amount;return{myResult:d.myResult,myPayout:f,label:kc(d.myResult,f,e.amount)}}return d}}return{myResult:"PUSH",myPayout:0,label:"Push"}}function qP(e){return typeof e.payout=="number"?e.payout:e.amount}function nse(e){return e.amount}function ase(e){return typeof e.oddsBp=="number"&&e.oddsBp!==1e4&&typeof e.payout=="number"?e.payout:e.amount}function kc(e,t,r){return e==="WIN"?`won ${ky(Math.max(0,t))}`:e==="LOSE"?`lost ${ky(Math.max(0,r))}`:e==="PUSH"?"Push":e}function sse(e){return!e||e.length===0?0:e.reduce((t,r)=>t+Number((r==null?void 0:r.amount)||0),0)}function oD({meId:e,items:t,onClose:r,nameOf:n,crapsRollHistory:s,gameMode:o,crapsLedgerItems:i}){const c=t,u=o==="craps",p={};for(const f of c){const m=(f==null?void 0:f.acceptedById)===e?f==null?void 0:f.playerId:f==null?void 0:f.acceptedById;if(!m)continue;const h=ou(f,e);let b=0;h.myResult==="WIN"?b=Number(h.myPayout??0):h.myResult==="LOSE"&&(b=-Number((f==null?void 0:f.amount)??0)),p[m]=(p[m]??0)+b}const d=Object.entries(p).map(([f,m])=>({id:f,name:(n==null?void 0:n(f))||f,delta:m})).sort((f,m)=>m.delta-f.delta);return a.jsxs("div",{className:"results-modal",children:[a.jsx("div",{className:"results-modal__backdrop",onClick:r}),a.jsxs("div",{className:"results-modal__card card",children:[a.jsxs("div",{className:"results-modal__header",children:[a.jsx("h3",{children:"Your Results (this game)"}),a.jsx("button",{className:"btn btn--ghost",onClick:r,children:"Close"})]}),!u&&d.length>0&&a.jsx("div",{className:"results-modal__deltas",children:a.jsx("ul",{className:"results-modal__deltas-list",children:d.map(({id:f,name:m,delta:h})=>a.jsxs("li",{className:`results-modal__delta ${h>=0?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[m,": ",h>=0?"+":"","z",ki.formatMoney(h,"",0)]},f))})}),u&&a.jsxs(a.Fragment,{children:[(()=>{const f=sse(i),m=f>=0,h=Math.abs(f);return i?a.jsx("div",{className:"results-modal__deltas",children:a.jsxs("div",{className:`results-modal__delta ${m?"results-modal__delta--pos":"results-modal__delta--neg"}`,children:[a.jsx("strong",{children:"Total won/lost:"})," ",m?"+":"-","z",ki.formatMoney(h,"",0)]})}):null})(),a.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[((i==null?void 0:i.length)??0)===0&&a.jsx("li",{className:"betitem",children:"No history yet."}),(i||[]).map((f,m)=>{var A,_,w,j,T,R;const h=Number(f.amount||0),b=h>=0,g=Math.abs(h),x=new Date(f.ts).toLocaleTimeString([],{hour:"2-digit",minute:"2-digit"});let v="";if(f.kind==="BET_PLACED")v=`Placed ${(A=f.meta)!=null&&A.betType?String(f.meta.betType):"bet"}`;else if(f.kind==="REFUND")v=`Refund ${(_=f.meta)!=null&&_.betType?String(f.meta.betType):"chips"}`;else if(f.kind==="BET_SETTLED"){const P=Array.isArray((w=f.meta)==null?void 0:w.settlements)?f.meta.settlements:[],k=P[0]||null,E=k!=null&&k.betType?String(k.betType):(j=f.meta)!=null&&j.betType?String(f.meta.betType):"bet",M=h>0?"WIN":h<0?"LOSE":"PUSH",C=(R=(T=f.meta)==null?void 0:T.roll)!=null&&R.total?` on ${f.meta.roll.total}`:"",I=P.length>1?` (+${P.length-1} more)`:"";v=`Settled: ${E} ${M}${C}${I}`}return a.jsx("li",{className:"betitem results-modal__bet-row",children:a.jsxs("span",{children:[x," — ",v," ",b?"+":"-","z",ki.formatMoney(g,"",0)]})},f.id||m)})]})]}),!u&&a.jsxs("ul",{className:"betlist results-list",role:"log","aria-live":"polite",children:[c.length===0&&a.jsx("li",{className:"betitem",children:"No results yet."}),c.map((f,m)=>{const h=(f==null?void 0:f.acceptedById)===e?f==null?void 0:f.playerId:f==null?void 0:f.acceptedById,b=(()=>{var v,A,_,w;const x=f;return(x==null?void 0:x.acceptedById)===e?(x==null?void 0:x.playerName)||((v=x==null?void 0:x.player)==null?void 0:v.name)||(x==null?void 0:x.playerEmail)||((A=x==null?void 0:x.player)==null?void 0:A.email):(x==null?void 0:x.bankerName)||((_=x==null?void 0:x.banker)==null?void 0:_.name)||(x==null?void 0:x.bankerEmail)||((w=x==null?void 0:x.banker)==null?void 0:w.email)})(),g=(n==null?void 0:n(h))||b||h||"Unknown",y=kc(...(()=>{const x=ou(f,e);return[x.myResult,x.myPayout,f.amount]})());return a.jsx("li",{className:"betitem results-modal__bet-row",children:a.jsxs("span",{children:["Round ",f.roundSeq," ",y," vs ",g]})},m)})]})]})]})}var VP;(function(e){e.Dark="DARK",e.Light="LIGHT",e.Default="DEFAULT"})(VP||(VP={}));var HP;(function(e){e.Body="body",e.Ionic="ionic",e.Native="native",e.None="none"})(HP||(HP={}));const Eh=Kl("Keyboard"),ose=e=>{if(e<1e3)return String(e);const t=e/1e3;return`${Number.isInteger(t)?t.toFixed(0):t.toFixed(1)}K`};function iD({onPlaceBet:e,onCancelBet:t,disabled:r=!1,showCancel:n=!1,min:s=1,max:o,defaultValue:i=25,heading:c,quickAmounts:u=[],onAmountChange:p}){const[d,f]=l.useState(i),m=l.useRef(!1),[h,b]=l.useState(0),g=l.useRef(null);l.useEffect(()=>{if(!zr.isNativePlatform())return;Eh.setAccessoryBarVisible({isVisible:!0});const j=Eh.addListener("keyboardWillShow",R=>b(R.keyboardHeight)),T=Eh.addListener("keyboardWillHide",()=>b(0));return()=>{Eh.setAccessoryBarVisible({isVisible:!1}),j.then(R=>R.remove()),T.then(R=>R.remove())}},[]);const y=l.useCallback(j=>{const T=j.target.value.replace(/[^0-9]/g,""),R=T===""?0:parseInt(T,10),P=o!=null?Math.min(R,o):R;f(P),p==null||p(P)},[o,p]),x=l.useCallback(()=>{var T;if(m.current||r||n)return;const j=Math.max(s,Math.floor(d));j<=0||(m.current=!0,cr("Light"),(T=g.current)==null||T.blur(),e(j),setTimeout(()=>{m.current=!1},600))},[r,n,d,s,e]),v=l.useCallback(()=>{n&&(cr("Light"),t())},[n,t]),A=l.useCallback(j=>{if(r||n)return;cr("Light");const T=o!=null?Math.min(j,o):j;f(T),p==null||p(T)},[r,o,p,n]),_=!r&&!n&&d>=s,w=u.length>0;return a.jsxs("div",{className:`bet-amount-input${r||n?" bet-amount-input--locked":""}`,children:[c&&a.jsx("div",{className:"bet-amount-input__heading",children:c}),w&&a.jsx("div",{className:"bet-amount-input__quick","aria-label":"Quick bet amounts",children:u.map(j=>a.jsxs("button",{type:"button",className:`bet-amount-input__quick-btn${d===j?" bet-amount-input__quick-btn--active":""}`,onClick:()=>A(j),disabled:r||n,"aria-pressed":d===j,children:["ℤ",ose(j)]},j))}),a.jsxs("div",{className:`bet-amount-input__group ${r?"bet-amount-input__group--disabled":""}`,children:[a.jsxs("div",{className:"bet-amount-input__field",children:[a.jsx("button",{className:"bet-amount-input__cancel",onClick:v,disabled:!n,children:"Cancel"}),a.jsx("span",{className:"bet-amount-input__symbol",children:"ℤ"}),a.jsx("input",{ref:g,type:"text",inputMode:"numeric",pattern:"[0-9]*",enterKeyHint:"done",className:`bet-amount-input__input${n?" bet-amount-input__input--active-bet":""}`,value:d||"",onChange:y,onKeyDown:j=>{j.key==="Enter"&&_&&(j.currentTarget.blur(),x())},disabled:r||n,"aria-label":"Bet amount",autoComplete:"off"})]}),a.jsx("button",{className:"bet-amount-input__place-btn",onClick:x,disabled:!_,"aria-label":"Place bet",children:"Place Bet"})]}),h>0&&ws.createPortal(a.jsxs("div",{className:"bet-amount-input__kb-bar",style:{bottom:h,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:[a.jsx("span",{style:{fontSize:12,fontWeight:600,textTransform:"uppercase",letterSpacing:"0.04em",color:"#D9CCA7",flexShrink:0},children:"Bet Amount"}),a.jsxs("span",{style:{flex:1,fontSize:24,fontWeight:600,color:"#F5E9CA",textAlign:"center"},children:["ℤ ",d||0]}),a.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:j=>{j.preventDefault(),_&&x()},disabled:!_,children:"Place Bet"})]}),document.body)]})}const ise=""+new URL("roll-btn-web-wZ6ex-aH.webp",import.meta.url).href,lD=50,Ph=lD/1200;function cD({disabled:e,busy:t=!1,onClick:r,onPressStart:n,onChargeChange:s,label:o="ROLL",className:i,"aria-label":c,useImage:u=!0,"data-testid":p}){const d=e||t,f=l.useRef(!1),m=l.useRef(0),h=l.useRef(null),b=l.useRef(s);b.current=s,l.useEffect(()=>()=>{h.current&&(clearInterval(h.current),h.current=null)},[]);const g=l.useCallback(()=>{var _;m.current=0,(_=b.current)==null||_.call(b,0),h.current&&clearInterval(h.current),h.current=window.setInterval(()=>{var w;m.current=Math.min(1,m.current+Ph),(w=b.current)==null||w.call(b,m.current),m.current>=.25&&m.current<.25+Ph*1.5?na("Light"):m.current>=.6&&m.current<.6+Ph*1.5?na("Medium"):m.current>=.95&&m.current<.95+Ph*1.5&&na("Heavy")},lD)},[]),y=l.useCallback(()=>{var _;h.current&&(clearInterval(h.current),h.current=null),(_=b.current)==null||_.call(b,0)},[]),x=l.useCallback(()=>{d||f.current||(f.current=!0,yn(),n==null||n(),g())},[d,n,g]),v=l.useCallback(async()=>{if(f.current){f.current=!1,y();try{const _=window;_.__rtcDiag||(_.__rtcDiag=[]),_.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),_.__dumpRtcDiag&&_.__dumpRtcDiag("ui:rollButtonClick")}catch{}r();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await na("Heavy")}},[r,y]),A=l.useCallback(async _=>{var w,j;if(f.current){_.preventDefault();return}if(!d){n==null||n(),(w=b.current)==null||w.call(b,1);try{const T=window;T.__rtcDiag||(T.__rtcDiag=[]),T.__rtcDiag.push({t:Date.now(),label:"ui:rollButtonClick"}),T.__dumpRtcDiag&&T.__dumpRtcDiag("ui:rollButtonClick")}catch{}r(),(j=b.current)==null||j.call(b,0);try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await na("Heavy")}},[d,r,n]);return a.jsx("div",{className:["roll-wrapper",i].filter(Boolean).join(" "),children:a.jsxs("button",{type:"button",className:["roll",u?"roll--image":"",d?"is-disabled":""].join(" "),onClick:A,onPointerDown:x,onPointerUp:v,onPointerCancel:v,onPointerLeave:v,disabled:d,"aria-label":c??(t?"Rolling dice":"Roll dice"),"aria-busy":t||void 0,"data-testid":p,children:[u&&a.jsx("img",{src:ise,alt:"",className:"roll__img",draggable:!1}),t&&a.jsx("span",{className:"roll__spinner","aria-hidden":"true"}),a.jsx("span",{className:"roll__halo","aria-hidden":"true"}),!u&&a.jsx("span",{className:"roll__gloss","aria-hidden":"true"}),!u&&a.jsx("span",{className:"roll__label","aria-live":"polite",children:t?"ROLLING…":o})]})})}function lse({roomId:e,meId:t,bankerId:r,players:n,className:s,hasBankRoll:o,gameState:i,gameplay:c,onChargeChange:u}){const d=i.gameMode==="cee-lo",f=d?100:10,[m,h]=l.useState(f),b=m,[g,y]=l.useState(!1),[x,v]=l.useState(!1),A=ji(),w=(i.banker??(d?i.currentRollerId:void 0)??r)===t,{settled:j,myOpenMain:T,placeMainBet:R,cancelMainBet:P}=jb(e,t),[k,E]=l.useState(!1);l.useEffect(()=>{T&&k&&E(!1)},[T,k]),l.useEffect(()=>{if(!k||T)return;const he=setTimeout(()=>E(!1),5e3);return()=>clearTimeout(he)},[k,T]);const M=(c==null?void 0:c.handleRoll)??(()=>{}),C=!!(c!=null&&c.canRoll);c==null||c.lastRollerId;const I=(c==null?void 0:c.diceSettled)??!0,L=(i==null?void 0:i.betsLocked)??!1;i==null||i.roundSeq;const N=!!(i!=null&&i.bankRoll),S=N,[F,D]=l.useState(!1),H=l.useRef(L),W=l.useRef(null);l.useEffect(()=>(H.current&&!L&&(D(!0),W.current&&window.clearTimeout(W.current),W.current=window.setTimeout(()=>{D(!1),W.current=null},3e3)),L&&W.current&&(window.clearTimeout(W.current),W.current=null,D(!1)),H.current=L,()=>{W.current&&window.clearTimeout(W.current)}),[L]);const G=l.useCallback(async he=>{var Fe;try{yn()}catch{}if(g)return;const Ae=Math.floor(he??b);if(Ae<=0){A.info("Enter a bet amount.");return}if(!N){if(L||S){A.info("Bets are closed.");return}if((Fe=i==null?void 0:i.spectators)!=null&&Fe.includes(t)){A.info("Exit spectate to place a bet.");return}try{y(!0);const U=await R(Ae);if(!(U!=null&&U.ok)){A.error((U==null?void 0:U.error)||"Bet rejected");return}E(!0)}catch(U){console.error("place_main_bet failed",U)}finally{y(!1)}}},[g,b,o,L,S,i,R]),$=l.useCallback(async()=>{try{yn()}catch{}if(T)try{const he=await P(T.id);he.ok||A.error(he.error||"Failed to cancel bet")}catch(he){console.error(he),A.error((he==null?void 0:he.message)??"Failed to cancel bet")}},[P,T,A]),de=((i==null?void 0:i.spectators)??[]).includes(t),ie=g||de||S||L||k,we=w?"Banker":de?"Spectating":T||k?"Bet Locked":S||L?"Bets Closed":"Main Bet";return a.jsxs("div",{className:["betpanel",s].filter(Boolean).join(" "),children:[a.jsxs("section",{className:"betpanel__section",children:[d&&a.jsxs("div",{className:"betpanel__ceelo-head",children:[a.jsx("span",{className:"betpanel__ceelo-status",children:we}),!w&&a.jsx("span",{className:"betpanel__ceelo-amount",children:T?`ℤ${T.amount}`:`ℤ${m}`})]}),a.jsx("div",{className:"betpanel__row betpanel__row--roll",children:a.jsx(cD,{disabled:!C||de,busy:!I,onClick:M,onChargeChange:u,useImage:!1,className:"roll-wrapper--rect","data-testid":"roll-button"})}),!w&&a.jsx("div",{className:"betpanel__row",children:a.jsx(iD,{onPlaceBet:G,onCancelBet:$,disabled:ie,showCancel:!!T&&!N,defaultValue:f,quickAmounts:d?[50,100,250,500,1e3,2500,5e3,1e4]:void 0,onAmountChange:h})})]}),x&&a.jsx(oD,{meId:t,items:j,onClose:()=>v(!1)})]})}const cse="useandom-26T198340PX75pxJACKVERYMINDBUSHWOLF_GQZbfghjklqvwyzrict";let Hv=(e=21)=>{let t="",r=crypto.getRandomValues(new Uint8Array(e|=0));for(;e--;)t+=cse[r[e]&63];return t};const uD=l.createContext({});function use(e){const t=l.useRef(null);return t.current===null&&(t.current=e()),t.current}const Ek=typeof window<"u",dse=Ek?l.useLayoutEffect:l.useEffect,Pk=l.createContext(null);function Ck(e,t){e.indexOf(t)===-1&&e.push(t)}function Rk(e,t){const r=e.indexOf(t);r>-1&&e.splice(r,1)}const ll=(e,t,r)=>r>t?t:r<e?e:r;let Tk=()=>{};const cl={},dD=e=>/^-?(?:\d+(?:\.\d+)?|\.\d+)$/u.test(e);function pD(e){return typeof e=="object"&&e!==null}const fD=e=>/^0[^.\s]+$/u.test(e);function jk(e){let t;return()=>(t===void 0&&(t=e()),t)}const ho=e=>e,pse=(e,t)=>r=>t(e(r)),Om=(...e)=>e.reduce(pse),lm=(e,t,r)=>{const n=t-e;return n===0?1:(r-e)/n};class Ik{constructor(){this.subscriptions=[]}add(t){return Ck(this.subscriptions,t),()=>Rk(this.subscriptions,t)}notify(t,r,n){const s=this.subscriptions.length;if(s)if(s===1)this.subscriptions[0](t,r,n);else for(let o=0;o<s;o++){const i=this.subscriptions[o];i&&i(t,r,n)}}getSize(){return this.subscriptions.length}clear(){this.subscriptions.length=0}}const Si=e=>e*1e3,Ei=e=>e/1e3;function mD(e,t){return t?e*(1e3/t):0}const hD=(e,t,r)=>(((1-3*r+3*t)*e+(3*r-6*t))*e+3*t)*e,fse=1e-7,mse=12;function hse(e,t,r,n,s){let o,i,c=0;do i=t+(r-t)/2,o=hD(i,n,s)-e,o>0?r=i:t=i;while(Math.abs(o)>fse&&++c<mse);return i}function zm(e,t,r,n){if(e===t&&r===n)return ho;const s=o=>hse(o,0,1,e,r);return o=>o===0||o===1?o:hD(s(o),t,n)}const gD=e=>t=>t<=.5?e(2*t)/2:(2-e(2*(1-t)))/2,yD=e=>t=>1-e(1-t),bD=zm(.33,1.53,.69,.99),Nk=yD(bD),vD=gD(Nk),_D=e=>(e*=2)<1?.5*Nk(e):.5*(2-Math.pow(2,-10*(e-1))),Mk=e=>1-Math.sin(Math.acos(e)),wD=yD(Mk),xD=gD(Mk),gse=zm(.42,0,1,1),yse=zm(0,0,.58,1),AD=zm(.42,0,.58,1),bse=e=>Array.isArray(e)&&typeof e[0]!="number",kD=e=>Array.isArray(e)&&typeof e[0]=="number",vse={linear:ho,easeIn:gse,easeInOut:AD,easeOut:yse,circIn:Mk,circInOut:xD,circOut:wD,backIn:Nk,backInOut:vD,backOut:bD,anticipate:_D},_se=e=>typeof e=="string",WP=e=>{if(kD(e)){Tk(e.length===4);const[t,r,n,s]=e;return zm(t,r,n,s)}else if(_se(e))return vse[e];return e},Ch=["setup","read","resolveKeyframes","preUpdate","update","preRender","render","postRender"];function wse(e,t){let r=new Set,n=new Set,s=!1,o=!1;const i=new WeakSet;let c={delta:0,timestamp:0,isProcessing:!1};function u(d){i.has(d)&&(p.schedule(d),e()),d(c)}const p={schedule:(d,f=!1,m=!1)=>{const b=m&&s?r:n;return f&&i.add(d),b.has(d)||b.add(d),d},cancel:d=>{n.delete(d),i.delete(d)},process:d=>{if(c=d,s){o=!0;return}s=!0,[r,n]=[n,r],r.forEach(u),r.clear(),s=!1,o&&(o=!1,p.process(d))}};return p}const xse=40;function SD(e,t){let r=!1,n=!0;const s={delta:0,timestamp:0,isProcessing:!1},o=()=>r=!0,i=Ch.reduce((A,_)=>(A[_]=wse(o),A),{}),{setup:c,read:u,resolveKeyframes:p,preUpdate:d,update:f,preRender:m,render:h,postRender:b}=i,g=()=>{const A=cl.useManualTiming?s.timestamp:performance.now();r=!1,cl.useManualTiming||(s.delta=n?1e3/60:Math.max(Math.min(A-s.timestamp,xse),1)),s.timestamp=A,s.isProcessing=!0,c.process(s),u.process(s),p.process(s),d.process(s),f.process(s),m.process(s),h.process(s),b.process(s),s.isProcessing=!1,r&&t&&(n=!1,e(g))},y=()=>{r=!0,n=!0,s.isProcessing||e(g)};return{schedule:Ch.reduce((A,_)=>{const w=i[_];return A[_]=(j,T=!1,R=!1)=>(r||y(),w.schedule(j,T,R)),A},{}),cancel:A=>{for(let _=0;_<Ch.length;_++)i[Ch[_]].cancel(A)},state:s,steps:i}}const{schedule:Kn,cancel:Xl,state:Ya,steps:Wv}=SD(typeof requestAnimationFrame<"u"?requestAnimationFrame:ho,!0);let jg;function Ase(){jg=void 0}const Ns={now:()=>(jg===void 0&&Ns.set(Ya.isProcessing||cl.useManualTiming?Ya.timestamp:performance.now()),jg),set:e=>{jg=e,queueMicrotask(Ase)}},ED=e=>t=>typeof t=="string"&&t.startsWith(e),Lk=ED("--"),kse=ED("var(--"),Dk=e=>kse(e)?Sse.test(e.split("/*")[0].trim()):!1,Sse=/var\(--(?:[\w-]+\s*|[\w-]+\s*,(?:\s*[^)(\s]|\s*\((?:[^)(]|\([^)(]*\))*\))+\s*)\)$/iu,Pp={test:e=>typeof e=="number",parse:parseFloat,transform:e=>e},cm={...Pp,transform:e=>ll(0,1,e)},Rh={...Pp,default:1},Mf=e=>Math.round(e*1e5)/1e5,Ok=/-?(?:\d+(?:\.\d+)?|\.\d+)/gu;function Ese(e){return e==null}const Pse=/^(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))$/iu,zk=(e,t)=>r=>!!(typeof r=="string"&&Pse.test(r)&&r.startsWith(e)||t&&!Ese(r)&&Object.prototype.hasOwnProperty.call(r,t)),PD=(e,t,r)=>n=>{if(typeof n!="string")return n;const[s,o,i,c]=n.match(Ok);return{[e]:parseFloat(s),[t]:parseFloat(o),[r]:parseFloat(i),alpha:c!==void 0?parseFloat(c):1}},Cse=e=>ll(0,255,e),Gv={...Pp,transform:e=>Math.round(Cse(e))},Oc={test:zk("rgb","red"),parse:PD("red","green","blue"),transform:({red:e,green:t,blue:r,alpha:n=1})=>"rgba("+Gv.transform(e)+", "+Gv.transform(t)+", "+Gv.transform(r)+", "+Mf(cm.transform(n))+")"};function Rse(e){let t="",r="",n="",s="";return e.length>5?(t=e.substring(1,3),r=e.substring(3,5),n=e.substring(5,7),s=e.substring(7,9)):(t=e.substring(1,2),r=e.substring(2,3),n=e.substring(3,4),s=e.substring(4,5),t+=t,r+=r,n+=n,s+=s),{red:parseInt(t,16),green:parseInt(r,16),blue:parseInt(n,16),alpha:s?parseInt(s,16)/255:1}}const hw={test:zk("#"),parse:Rse,transform:Oc.transform},Bm=e=>({test:t=>typeof t=="string"&&t.endsWith(e)&&t.split(" ").length===1,parse:parseFloat,transform:t=>`${t}${e}`}),vl=Bm("deg"),Pi=Bm("%"),Vr=Bm("px"),Tse=Bm("vh"),jse=Bm("vw"),GP={...Pi,parse:e=>Pi.parse(e)/100,transform:e=>Pi.transform(e*100)},hd={test:zk("hsl","hue"),parse:PD("hue","saturation","lightness"),transform:({hue:e,saturation:t,lightness:r,alpha:n=1})=>"hsla("+Math.round(e)+", "+Pi.transform(Mf(t))+", "+Pi.transform(Mf(r))+", "+Mf(cm.transform(n))+")"},Aa={test:e=>Oc.test(e)||hw.test(e)||hd.test(e),parse:e=>Oc.test(e)?Oc.parse(e):hd.test(e)?hd.parse(e):hw.parse(e),transform:e=>typeof e=="string"?e:e.hasOwnProperty("red")?Oc.transform(e):hd.transform(e),getAnimatableNone:e=>{const t=Aa.parse(e);return t.alpha=0,Aa.transform(t)}},Ise=/(?:#[\da-f]{3,8}|(?:rgb|hsl)a?\((?:-?[\d.]+%?[,\s]+){2}-?[\d.]+%?\s*(?:[,/]\s*)?(?:\b\d+(?:\.\d+)?|\.\d+)?%?\))/giu;function Nse(e){var t,r;return isNaN(e)&&typeof e=="string"&&(((t=e.match(Ok))==null?void 0:t.length)||0)+(((r=e.match(Ise))==null?void 0:r.length)||0)>0}const CD="number",RD="color",Mse="var",Lse="var(",XP="${}",Dse=/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 um(e){const t=e.toString(),r=[],n={color:[],number:[],var:[]},s=[];let o=0;const c=t.replace(Dse,u=>(Aa.test(u)?(n.color.push(o),s.push(RD),r.push(Aa.parse(u))):u.startsWith(Lse)?(n.var.push(o),s.push(Mse),r.push(u)):(n.number.push(o),s.push(CD),r.push(parseFloat(u))),++o,XP)).split(XP);return{values:r,split:c,indexes:n,types:s}}function TD(e){return um(e).values}function jD(e){const{split:t,types:r}=um(e),n=t.length;return s=>{let o="";for(let i=0;i<n;i++)if(o+=t[i],s[i]!==void 0){const c=r[i];c===CD?o+=Mf(s[i]):c===RD?o+=Aa.transform(s[i]):o+=s[i]}return o}}const Ose=e=>typeof e=="number"?0:Aa.test(e)?Aa.getAnimatableNone(e):e;function zse(e){const t=TD(e);return jD(e)(t.map(Ose))}const Yl={test:Nse,parse:TD,createTransformer:jD,getAnimatableNone:zse};function Xv(e,t,r){return r<0&&(r+=1),r>1&&(r-=1),r<1/6?e+(t-e)*6*r:r<1/2?t:r<2/3?e+(t-e)*(2/3-r)*6:e}function Bse({hue:e,saturation:t,lightness:r,alpha:n}){e/=360,t/=100,r/=100;let s=0,o=0,i=0;if(!t)s=o=i=r;else{const c=r<.5?r*(1+t):r+t-r*t,u=2*r-c;s=Xv(u,c,e+1/3),o=Xv(u,c,e),i=Xv(u,c,e-1/3)}return{red:Math.round(s*255),green:Math.round(o*255),blue:Math.round(i*255),alpha:n}}function Sy(e,t){return r=>r>0?t:e}const aa=(e,t,r)=>e+(t-e)*r,Yv=(e,t,r)=>{const n=e*e,s=r*(t*t-n)+n;return s<0?0:Math.sqrt(s)},Fse=[hw,Oc,hd],Use=e=>Fse.find(t=>t.test(e));function YP(e){const t=Use(e);if(!t)return!1;let r=t.parse(e);return t===hd&&(r=Bse(r)),r}const ZP=(e,t)=>{const r=YP(e),n=YP(t);if(!r||!n)return Sy(e,t);const s={...r};return o=>(s.red=Yv(r.red,n.red,o),s.green=Yv(r.green,n.green,o),s.blue=Yv(r.blue,n.blue,o),s.alpha=aa(r.alpha,n.alpha,o),Oc.transform(s))},gw=new Set(["none","hidden"]);function qse(e,t){return gw.has(e)?r=>r<=0?e:t:r=>r>=1?t:e}function Vse(e,t){return r=>aa(e,t,r)}function Bk(e){return typeof e=="number"?Vse:typeof e=="string"?Dk(e)?Sy:Aa.test(e)?ZP:Gse:Array.isArray(e)?ID:typeof e=="object"?Aa.test(e)?ZP:Hse:Sy}function ID(e,t){const r=[...e],n=r.length,s=e.map((o,i)=>Bk(o)(o,t[i]));return o=>{for(let i=0;i<n;i++)r[i]=s[i](o);return r}}function Hse(e,t){const r={...e,...t},n={};for(const s in r)e[s]!==void 0&&t[s]!==void 0&&(n[s]=Bk(e[s])(e[s],t[s]));return s=>{for(const o in n)r[o]=n[o](s);return r}}function Wse(e,t){const r=[],n={color:0,var:0,number:0};for(let s=0;s<t.values.length;s++){const o=t.types[s],i=e.indexes[o][n[o]],c=e.values[i]??0;r[s]=c,n[o]++}return r}const Gse=(e,t)=>{const r=Yl.createTransformer(t),n=um(e),s=um(t);return n.indexes.var.length===s.indexes.var.length&&n.indexes.color.length===s.indexes.color.length&&n.indexes.number.length>=s.indexes.number.length?gw.has(e)&&!s.values.length||gw.has(t)&&!n.values.length?qse(e,t):Om(ID(Wse(n,s),s.values),r):Sy(e,t)};function ND(e,t,r){return typeof e=="number"&&typeof t=="number"&&typeof r=="number"?aa(e,t,r):Bk(e)(e,t)}const Xse=e=>{const t=({timestamp:r})=>e(r);return{start:(r=!0)=>Kn.update(t,r),stop:()=>Xl(t),now:()=>Ya.isProcessing?Ya.timestamp:Ns.now()}},MD=(e,t,r=10)=>{let n="";const s=Math.max(Math.round(t/r),2);for(let o=0;o<s;o++)n+=Math.round(e(o/(s-1))*1e4)/1e4+", ";return`linear(${n.substring(0,n.length-2)})`},Ey=2e4;function Fk(e){let t=0;const r=50;let n=e.next(t);for(;!n.done&&t<Ey;)t+=r,n=e.next(t);return t>=Ey?1/0:t}function Yse(e,t=100,r){const n=r({...e,keyframes:[0,t]}),s=Math.min(Fk(n),Ey);return{type:"keyframes",ease:o=>n.next(s*o).value/t,duration:Ei(s)}}const Zse=5;function LD(e,t,r){const n=Math.max(t-Zse,0);return mD(r-e(n),t-n)}const oa={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},Zv=.001;function Kse({duration:e=oa.duration,bounce:t=oa.bounce,velocity:r=oa.velocity,mass:n=oa.mass}){let s,o,i=1-t;i=ll(oa.minDamping,oa.maxDamping,i),e=ll(oa.minDuration,oa.maxDuration,Ei(e)),i<1?(s=p=>{const d=p*i,f=d*e,m=d-r,h=yw(p,i),b=Math.exp(-f);return Zv-m/h*b},o=p=>{const f=p*i*e,m=f*r+r,h=Math.pow(i,2)*Math.pow(p,2)*e,b=Math.exp(-f),g=yw(Math.pow(p,2),i);return(-s(p)+Zv>0?-1:1)*((m-h)*b)/g}):(s=p=>{const d=Math.exp(-p*e),f=(p-r)*e+1;return-Zv+d*f},o=p=>{const d=Math.exp(-p*e),f=(r-p)*(e*e);return d*f});const c=5/e,u=Jse(s,o,c);if(e=Si(e),isNaN(u))return{stiffness:oa.stiffness,damping:oa.damping,duration:e};{const p=Math.pow(u,2)*n;return{stiffness:p,damping:i*2*Math.sqrt(n*p),duration:e}}}const Qse=12;function Jse(e,t,r){let n=r;for(let s=1;s<Qse;s++)n=n-e(n)/t(n);return n}function yw(e,t){return e*Math.sqrt(1-t*t)}const $se=["duration","bounce"],eoe=["stiffness","damping","mass"];function KP(e,t){return t.some(r=>e[r]!==void 0)}function toe(e){let t={velocity:oa.velocity,stiffness:oa.stiffness,damping:oa.damping,mass:oa.mass,isResolvedFromDuration:!1,...e};if(!KP(e,eoe)&&KP(e,$se))if(e.visualDuration){const r=e.visualDuration,n=2*Math.PI/(r*1.2),s=n*n,o=2*ll(.05,1,1-(e.bounce||0))*Math.sqrt(s);t={...t,mass:oa.mass,stiffness:s,damping:o}}else{const r=Kse(e);t={...t,...r,mass:oa.mass},t.isResolvedFromDuration=!0}return t}function Py(e=oa.visualDuration,t=oa.bounce){const r=typeof e!="object"?{visualDuration:e,keyframes:[0,1],bounce:t}:e;let{restSpeed:n,restDelta:s}=r;const o=r.keyframes[0],i=r.keyframes[r.keyframes.length-1],c={done:!1,value:o},{stiffness:u,damping:p,mass:d,duration:f,velocity:m,isResolvedFromDuration:h}=toe({...r,velocity:-Ei(r.velocity||0)}),b=m||0,g=p/(2*Math.sqrt(u*d)),y=i-o,x=Ei(Math.sqrt(u/d)),v=Math.abs(y)<5;n||(n=v?oa.restSpeed.granular:oa.restSpeed.default),s||(s=v?oa.restDelta.granular:oa.restDelta.default);let A;if(g<1){const w=yw(x,g);A=j=>{const T=Math.exp(-g*x*j);return i-T*((b+g*x*y)/w*Math.sin(w*j)+y*Math.cos(w*j))}}else if(g===1)A=w=>i-Math.exp(-x*w)*(y+(b+x*y)*w);else{const w=x*Math.sqrt(g*g-1);A=j=>{const T=Math.exp(-g*x*j),R=Math.min(w*j,300);return i-T*((b+g*x*y)*Math.sinh(R)+w*y*Math.cosh(R))/w}}const _={calculatedDuration:h&&f||null,next:w=>{const j=A(w);if(h)c.done=w>=f;else{let T=w===0?b:0;g<1&&(T=w===0?Si(b):LD(A,w,j));const R=Math.abs(T)<=n,P=Math.abs(i-j)<=s;c.done=R&&P}return c.value=c.done?i:j,c},toString:()=>{const w=Math.min(Fk(_),Ey),j=MD(T=>_.next(w*T).value,w,30);return w+"ms "+j},toTransition:()=>{}};return _}Py.applyToOptions=e=>{const t=Yse(e,100,Py);return e.ease=t.ease,e.duration=Si(t.duration),e.type="keyframes",e};function bw({keyframes:e,velocity:t=0,power:r=.8,timeConstant:n=325,bounceDamping:s=10,bounceStiffness:o=500,modifyTarget:i,min:c,max:u,restDelta:p=.5,restSpeed:d}){const f=e[0],m={done:!1,value:f},h=R=>c!==void 0&&R<c||u!==void 0&&R>u,b=R=>c===void 0?u:u===void 0||Math.abs(c-R)<Math.abs(u-R)?c:u;let g=r*t;const y=f+g,x=i===void 0?y:i(y);x!==y&&(g=x-f);const v=R=>-g*Math.exp(-R/n),A=R=>x+v(R),_=R=>{const P=v(R),k=A(R);m.done=Math.abs(P)<=p,m.value=m.done?x:k};let w,j;const T=R=>{h(m.value)&&(w=R,j=Py({keyframes:[m.value,b(m.value)],velocity:LD(A,R,m.value),damping:s,stiffness:o,restDelta:p,restSpeed:d}))};return T(0),{calculatedDuration:null,next:R=>{let P=!1;return!j&&w===void 0&&(P=!0,_(R),T(R)),w!==void 0&&R>=w?j.next(R-w):(!P&&_(R),m)}}}function roe(e,t,r){const n=[],s=r||cl.mix||ND,o=e.length-1;for(let i=0;i<o;i++){let c=s(e[i],e[i+1]);if(t){const u=Array.isArray(t)?t[i]||ho:t;c=Om(u,c)}n.push(c)}return n}function noe(e,t,{clamp:r=!0,ease:n,mixer:s}={}){const o=e.length;if(Tk(o===t.length),o===1)return()=>t[0];if(o===2&&t[0]===t[1])return()=>t[1];const i=e[0]===e[1];e[0]>e[o-1]&&(e=[...e].reverse(),t=[...t].reverse());const c=roe(t,n,s),u=c.length,p=d=>{if(i&&d<e[0])return t[0];let f=0;if(u>1)for(;f<e.length-2&&!(d<e[f+1]);f++);const m=lm(e[f],e[f+1],d);return c[f](m)};return r?d=>p(ll(e[0],e[o-1],d)):p}function aoe(e,t){const r=e[e.length-1];for(let n=1;n<=t;n++){const s=lm(0,t,n);e.push(aa(r,1,s))}}function soe(e){const t=[0];return aoe(t,e.length-1),t}function ooe(e,t){return e.map(r=>r*t)}function ioe(e,t){return e.map(()=>t||AD).splice(0,e.length-1)}function Lf({duration:e=300,keyframes:t,times:r,ease:n="easeInOut"}){const s=bse(n)?n.map(WP):WP(n),o={done:!1,value:t[0]},i=ooe(r&&r.length===t.length?r:soe(t),e),c=noe(i,t,{ease:Array.isArray(s)?s:ioe(t,s)});return{calculatedDuration:e,next:u=>(o.value=c(u),o.done=u>=e,o)}}const loe=e=>e!==null;function Uk(e,{repeat:t,repeatType:r="loop"},n,s=1){const o=e.filter(loe),c=s<0||t&&r!=="loop"&&t%2===1?0:o.length-1;return!c||n===void 0?o[c]:n}const coe={decay:bw,inertia:bw,tween:Lf,keyframes:Lf,spring:Py};function DD(e){typeof e.type=="string"&&(e.type=coe[e.type])}class qk{constructor(){this.updateFinished()}get finished(){return this._finished}updateFinished(){this._finished=new Promise(t=>{this.resolve=t})}notifyFinished(){this.resolve()}then(t,r){return this.finished.then(t,r)}}const uoe=e=>e/100;class Vk extends qk{constructor(t){super(),this.state="idle",this.startTime=null,this.isStopped=!1,this.currentTime=0,this.holdTime=null,this.playbackSpeed=1,this.stop=()=>{var n,s;const{motionValue:r}=this.options;r&&r.updatedAt!==Ns.now()&&this.tick(Ns.now()),this.isStopped=!0,this.state!=="idle"&&(this.teardown(),(s=(n=this.options).onStop)==null||s.call(n))},this.options=t,this.initAnimation(),this.play(),t.autoplay===!1&&this.pause()}initAnimation(){const{options:t}=this;DD(t);const{type:r=Lf,repeat:n=0,repeatDelay:s=0,repeatType:o,velocity:i=0}=t;let{keyframes:c}=t;const u=r||Lf;u!==Lf&&typeof c[0]!="number"&&(this.mixKeyframes=Om(uoe,ND(c[0],c[1])),c=[0,100]);const p=u({...t,keyframes:c});o==="mirror"&&(this.mirroredGenerator=u({...t,keyframes:[...c].reverse(),velocity:-i})),p.calculatedDuration===null&&(p.calculatedDuration=Fk(p));const{calculatedDuration:d}=p;this.calculatedDuration=d,this.resolvedDuration=d+s,this.totalDuration=this.resolvedDuration*(n+1)-s,this.generator=p}updateTime(t){const r=Math.round(t-this.startTime)*this.playbackSpeed;this.holdTime!==null?this.currentTime=this.holdTime:this.currentTime=r}tick(t,r=!1){const{generator:n,totalDuration:s,mixKeyframes:o,mirroredGenerator:i,resolvedDuration:c,calculatedDuration:u}=this;if(this.startTime===null)return n.next(0);const{delay:p=0,keyframes:d,repeat:f,repeatType:m,repeatDelay:h,type:b,onUpdate:g,finalKeyframe:y}=this.options;this.speed>0?this.startTime=Math.min(this.startTime,t):this.speed<0&&(this.startTime=Math.min(t-s/this.speed,this.startTime)),r?this.currentTime=t:this.updateTime(t);const x=this.currentTime-p*(this.playbackSpeed>=0?1:-1),v=this.playbackSpeed>=0?x<0:x>s;this.currentTime=Math.max(x,0),this.state==="finished"&&this.holdTime===null&&(this.currentTime=s);let A=this.currentTime,_=n;if(f){const R=Math.min(this.currentTime,s)/c;let P=Math.floor(R),k=R%1;!k&&R>=1&&(k=1),k===1&&P--,P=Math.min(P,f+1),!!(P%2)&&(m==="reverse"?(k=1-k,h&&(k-=h/c)):m==="mirror"&&(_=i)),A=ll(0,1,k)*c}const w=v?{done:!1,value:d[0]}:_.next(A);o&&(w.value=o(w.value));let{done:j}=w;!v&&u!==null&&(j=this.playbackSpeed>=0?this.currentTime>=s:this.currentTime<=0);const T=this.holdTime===null&&(this.state==="finished"||this.state==="running"&&j);return T&&b!==bw&&(w.value=Uk(d,this.options,y,this.speed)),g&&g(w.value),T&&this.finish(),w}then(t,r){return this.finished.then(t,r)}get duration(){return Ei(this.calculatedDuration)}get time(){return Ei(this.currentTime)}set time(t){var r;t=Si(t),this.currentTime=t,this.startTime===null||this.holdTime!==null||this.playbackSpeed===0?this.holdTime=t:this.driver&&(this.startTime=this.driver.now()-t/this.playbackSpeed),(r=this.driver)==null||r.start(!1)}get speed(){return this.playbackSpeed}set speed(t){this.updateTime(Ns.now());const r=this.playbackSpeed!==t;this.playbackSpeed=t,r&&(this.time=Ei(this.currentTime))}play(){var s,o;if(this.isStopped)return;const{driver:t=Xse,startTime:r}=this.options;this.driver||(this.driver=t(i=>this.tick(i))),(o=(s=this.options).onPlay)==null||o.call(s);const n=this.driver.now();this.state==="finished"?(this.updateFinished(),this.startTime=n):this.holdTime!==null?this.startTime=n-this.holdTime:this.startTime||(this.startTime=r??n),this.state==="finished"&&this.speed<0&&(this.startTime+=this.calculatedDuration),this.holdTime=null,this.state="running",this.driver.start()}pause(){this.state="paused",this.updateTime(Ns.now()),this.holdTime=this.currentTime}complete(){this.state!=="running"&&this.play(),this.state="finished",this.holdTime=null}finish(){var t,r;this.notifyFinished(),this.teardown(),this.state="finished",(r=(t=this.options).onComplete)==null||r.call(t)}cancel(){var t,r;this.holdTime=null,this.startTime=0,this.tick(0),this.teardown(),(r=(t=this.options).onCancel)==null||r.call(t)}teardown(){this.state="idle",this.stopDriver(),this.startTime=this.holdTime=null}stopDriver(){this.driver&&(this.driver.stop(),this.driver=void 0)}sample(t){return this.startTime=0,this.tick(t,!0)}attachTimeline(t){var r;return this.options.allowFlatten&&(this.options.type="keyframes",this.options.ease="linear",this.initAnimation()),(r=this.driver)==null||r.stop(),t.observe(this)}}function doe(e){for(let t=1;t<e.length;t++)e[t]??(e[t]=e[t-1])}const zc=e=>e*180/Math.PI,vw=e=>{const t=zc(Math.atan2(e[1],e[0]));return _w(t)},poe={x:4,y:5,translateX:4,translateY:5,scaleX:0,scaleY:3,scale:e=>(Math.abs(e[0])+Math.abs(e[3]))/2,rotate:vw,rotateZ:vw,skewX:e=>zc(Math.atan(e[1])),skewY:e=>zc(Math.atan(e[2])),skew:e=>(Math.abs(e[1])+Math.abs(e[2]))/2},_w=e=>(e=e%360,e<0&&(e+=360),e),QP=vw,JP=e=>Math.sqrt(e[0]*e[0]+e[1]*e[1]),$P=e=>Math.sqrt(e[4]*e[4]+e[5]*e[5]),foe={x:12,y:13,z:14,translateX:12,translateY:13,translateZ:14,scaleX:JP,scaleY:$P,scale:e=>(JP(e)+$P(e))/2,rotateX:e=>_w(zc(Math.atan2(e[6],e[5]))),rotateY:e=>_w(zc(Math.atan2(-e[2],e[0]))),rotateZ:QP,rotate:QP,skewX:e=>zc(Math.atan(e[4])),skewY:e=>zc(Math.atan(e[1])),skew:e=>(Math.abs(e[1])+Math.abs(e[4]))/2};function ww(e){return e.includes("scale")?1:0}function xw(e,t){if(!e||e==="none")return ww(t);const r=e.match(/^matrix3d\(([-\d.e\s,]+)\)$/u);let n,s;if(r)n=foe,s=r;else{const c=e.match(/^matrix\(([-\d.e\s,]+)\)$/u);n=poe,s=c}if(!s)return ww(t);const o=n[t],i=s[1].split(",").map(hoe);return typeof o=="function"?o(i):i[o]}const moe=(e,t)=>{const{transform:r="none"}=getComputedStyle(e);return xw(r,t)};function hoe(e){return parseFloat(e.trim())}const Cp=["transformPerspective","x","y","z","translateX","translateY","translateZ","scale","scaleX","scaleY","rotate","rotateX","rotateY","rotateZ","skew","skewX","skewY"],Rp=new Set(Cp),eC=e=>e===Pp||e===Vr,goe=new Set(["x","y","z"]),yoe=Cp.filter(e=>!goe.has(e));function boe(e){const t=[];return yoe.forEach(r=>{const n=e.getValue(r);n!==void 0&&(t.push([r,n.get()]),n.set(r.startsWith("scale")?1:0))}),t}const Xc={width:({x:e},{paddingLeft:t="0",paddingRight:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),height:({y:e},{paddingTop:t="0",paddingBottom:r="0"})=>e.max-e.min-parseFloat(t)-parseFloat(r),top:(e,{top:t})=>parseFloat(t),left:(e,{left:t})=>parseFloat(t),bottom:({y:e},{top:t})=>parseFloat(t)+(e.max-e.min),right:({x:e},{left:t})=>parseFloat(t)+(e.max-e.min),x:(e,{transform:t})=>xw(t,"x"),y:(e,{transform:t})=>xw(t,"y")};Xc.translateX=Xc.x;Xc.translateY=Xc.y;const Yc=new Set;let Aw=!1,kw=!1,Sw=!1;function OD(){if(kw){const e=Array.from(Yc).filter(n=>n.needsMeasurement),t=new Set(e.map(n=>n.element)),r=new Map;t.forEach(n=>{const s=boe(n);s.length&&(r.set(n,s),n.render())}),e.forEach(n=>n.measureInitialState()),t.forEach(n=>{n.render();const s=r.get(n);s&&s.forEach(([o,i])=>{var c;(c=n.getValue(o))==null||c.set(i)})}),e.forEach(n=>n.measureEndState()),e.forEach(n=>{n.suspendedScrollY!==void 0&&window.scrollTo(0,n.suspendedScrollY)})}kw=!1,Aw=!1,Yc.forEach(e=>e.complete(Sw)),Yc.clear()}function zD(){Yc.forEach(e=>{e.readKeyframes(),e.needsMeasurement&&(kw=!0)})}function voe(){Sw=!0,zD(),OD(),Sw=!1}class Hk{constructor(t,r,n,s,o,i=!1){this.state="pending",this.isAsync=!1,this.needsMeasurement=!1,this.unresolvedKeyframes=[...t],this.onComplete=r,this.name=n,this.motionValue=s,this.element=o,this.isAsync=i}scheduleResolve(){this.state="scheduled",this.isAsync?(Yc.add(this),Aw||(Aw=!0,Kn.read(zD),Kn.resolveKeyframes(OD))):(this.readKeyframes(),this.complete())}readKeyframes(){const{unresolvedKeyframes:t,name:r,element:n,motionValue:s}=this;if(t[0]===null){const o=s==null?void 0:s.get(),i=t[t.length-1];if(o!==void 0)t[0]=o;else if(n&&r){const c=n.readValue(r,i);c!=null&&(t[0]=c)}t[0]===void 0&&(t[0]=i),s&&o===void 0&&s.set(t[0])}doe(t)}setFinalKeyframe(){}measureInitialState(){}renderEndStyles(){}measureEndState(){}complete(t=!1){this.state="complete",this.onComplete(this.unresolvedKeyframes,this.finalKeyframe,t),Yc.delete(this)}cancel(){this.state==="scheduled"&&(Yc.delete(this),this.state="pending")}resume(){this.state==="pending"&&this.scheduleResolve()}}const _oe=e=>e.startsWith("--");function woe(e,t,r){_oe(t)?e.style.setProperty(t,r):e.style[t]=r}const xoe=jk(()=>window.ScrollTimeline!==void 0),Aoe={};function koe(e,t){const r=jk(e);return()=>Aoe[t]??r()}const BD=koe(()=>{try{document.createElement("div").animate({opacity:0},{easing:"linear(0, 1)"})}catch{return!1}return!0},"linearEasing"),pf=([e,t,r,n])=>`cubic-bezier(${e}, ${t}, ${r}, ${n})`,tC={linear:"linear",ease:"ease",easeIn:"ease-in",easeOut:"ease-out",easeInOut:"ease-in-out",circIn:pf([0,.65,.55,1]),circOut:pf([.55,0,1,.45]),backIn:pf([.31,.01,.66,-.59]),backOut:pf([.33,1.53,.69,.99])};function FD(e,t){if(e)return typeof e=="function"?BD()?MD(e,t):"ease-out":kD(e)?pf(e):Array.isArray(e)?e.map(r=>FD(r,t)||tC.easeOut):tC[e]}function Soe(e,t,r,{delay:n=0,duration:s=300,repeat:o=0,repeatType:i="loop",ease:c="easeOut",times:u}={},p=void 0){const d={[t]:r};u&&(d.offset=u);const f=FD(c,s);Array.isArray(f)&&(d.easing=f);const m={delay:n,duration:s,easing:Array.isArray(f)?"linear":f,fill:"both",iterations:o+1,direction:i==="reverse"?"alternate":"normal"};return p&&(m.pseudoElement=p),e.animate(d,m)}function UD(e){return typeof e=="function"&&"applyToOptions"in e}function Eoe({type:e,...t}){return UD(e)&&BD()?e.applyToOptions(t):(t.duration??(t.duration=300),t.ease??(t.ease="easeOut"),t)}class Poe extends qk{constructor(t){if(super(),this.finishedTime=null,this.isStopped=!1,!t)return;const{element:r,name:n,keyframes:s,pseudoElement:o,allowFlatten:i=!1,finalKeyframe:c,onComplete:u}=t;this.isPseudoElement=!!o,this.allowFlatten=i,this.options=t,Tk(typeof t.type!="string");const p=Eoe(t);this.animation=Soe(r,n,s,p,o),p.autoplay===!1&&this.animation.pause(),this.animation.onfinish=()=>{if(this.finishedTime=this.time,!o){const d=Uk(s,this.options,c,this.speed);this.updateMotionValue?this.updateMotionValue(d):woe(r,n,d),this.animation.cancel()}u==null||u(),this.notifyFinished()}}play(){this.isStopped||(this.animation.play(),this.state==="finished"&&this.updateFinished())}pause(){this.animation.pause()}complete(){var t,r;(r=(t=this.animation).finish)==null||r.call(t)}cancel(){try{this.animation.cancel()}catch{}}stop(){if(this.isStopped)return;this.isStopped=!0;const{state:t}=this;t==="idle"||t==="finished"||(this.updateMotionValue?this.updateMotionValue():this.commitStyles(),this.isPseudoElement||this.cancel())}commitStyles(){var t,r;this.isPseudoElement||(r=(t=this.animation).commitStyles)==null||r.call(t)}get duration(){var r,n;const t=((n=(r=this.animation.effect)==null?void 0:r.getComputedTiming)==null?void 0:n.call(r).duration)||0;return Ei(Number(t))}get time(){return Ei(Number(this.animation.currentTime)||0)}set time(t){this.finishedTime=null,this.animation.currentTime=Si(t)}get speed(){return this.animation.playbackRate}set speed(t){t<0&&(this.finishedTime=null),this.animation.playbackRate=t}get state(){return this.finishedTime!==null?"finished":this.animation.playState}get startTime(){return Number(this.animation.startTime)}set startTime(t){this.animation.startTime=t}attachTimeline({timeline:t,observe:r}){var n;return this.allowFlatten&&((n=this.animation.effect)==null||n.updateTiming({easing:"linear"})),this.animation.onfinish=null,t&&xoe()?(this.animation.timeline=t,ho):r(this)}}const qD={anticipate:_D,backInOut:vD,circInOut:xD};function Coe(e){return e in qD}function Roe(e){typeof e.ease=="string"&&Coe(e.ease)&&(e.ease=qD[e.ease])}const rC=10;class Toe extends Poe{constructor(t){Roe(t),DD(t),super(t),t.startTime&&(this.startTime=t.startTime),this.options=t}updateMotionValue(t){const{motionValue:r,onUpdate:n,onComplete:s,element:o,...i}=this.options;if(!r)return;if(t!==void 0){r.set(t);return}const c=new Vk({...i,autoplay:!1}),u=Si(this.finishedTime??this.time);r.setWithVelocity(c.sample(u-rC).value,c.sample(u).value,rC),c.stop()}}const nC=(e,t)=>t==="zIndex"?!1:!!(typeof e=="number"||Array.isArray(e)||typeof e=="string"&&(Yl.test(e)||e==="0")&&!e.startsWith("url("));function joe(e){const t=e[0];if(e.length===1)return!0;for(let r=0;r<e.length;r++)if(e[r]!==t)return!0}function Ioe(e,t,r,n){const s=e[0];if(s===null)return!1;if(t==="display"||t==="visibility")return!0;const o=e[e.length-1],i=nC(s,t),c=nC(o,t);return!i||!c?!1:joe(e)||(r==="spring"||UD(r))&&n}function Ew(e){e.duration=0,e.type}const Noe=new Set(["opacity","clipPath","filter","transform"]),Moe=jk(()=>Object.hasOwnProperty.call(Element.prototype,"animate"));function Loe(e){var d;const{motionValue:t,name:r,repeatDelay:n,repeatType:s,damping:o,type:i}=e;if(!(((d=t==null?void 0:t.owner)==null?void 0:d.current)instanceof HTMLElement))return!1;const{onUpdate:u,transformTemplate:p}=t.owner.getProps();return Moe()&&r&&Noe.has(r)&&(r!=="transform"||!p)&&!u&&!n&&s!=="mirror"&&o!==0&&i!=="inertia"}const Doe=40;class Ooe extends qk{constructor({autoplay:t=!0,delay:r=0,type:n="keyframes",repeat:s=0,repeatDelay:o=0,repeatType:i="loop",keyframes:c,name:u,motionValue:p,element:d,...f}){var b;super(),this.stop=()=>{var g,y;this._animation&&(this._animation.stop(),(g=this.stopTimeline)==null||g.call(this)),(y=this.keyframeResolver)==null||y.cancel()},this.createdAt=Ns.now();const m={autoplay:t,delay:r,type:n,repeat:s,repeatDelay:o,repeatType:i,name:u,motionValue:p,element:d,...f},h=(d==null?void 0:d.KeyframeResolver)||Hk;this.keyframeResolver=new h(c,(g,y,x)=>this.onKeyframesResolved(g,y,m,!x),u,p,d),(b=this.keyframeResolver)==null||b.scheduleResolve()}onKeyframesResolved(t,r,n,s){this.keyframeResolver=void 0;const{name:o,type:i,velocity:c,delay:u,isHandoff:p,onUpdate:d}=n;this.resolvedAt=Ns.now(),Ioe(t,o,i,c)||((cl.instantAnimations||!u)&&(d==null||d(Uk(t,n,r))),t[0]=t[t.length-1],Ew(n),n.repeat=0);const m={startTime:s?this.resolvedAt?this.resolvedAt-this.createdAt>Doe?this.resolvedAt:this.createdAt:this.createdAt:void 0,finalKeyframe:r,...n,keyframes:t},h=!p&&Loe(m)?new Toe({...m,element:m.motionValue.owner.current}):new Vk(m);h.finished.then(()=>this.notifyFinished()).catch(ho),this.pendingTimeline&&(this.stopTimeline=h.attachTimeline(this.pendingTimeline),this.pendingTimeline=void 0),this._animation=h}get finished(){return this._animation?this.animation.finished:this._finished}then(t,r){return this.finished.finally(t).then(()=>{})}get animation(){var t;return this._animation||((t=this.keyframeResolver)==null||t.resume(),voe()),this._animation}get duration(){return this.animation.duration}get time(){return this.animation.time}set time(t){this.animation.time=t}get speed(){return this.animation.speed}get state(){return this.animation.state}set speed(t){this.animation.speed=t}get startTime(){return this.animation.startTime}attachTimeline(t){return this._animation?this.stopTimeline=this.animation.attachTimeline(t):this.pendingTimeline=t,()=>this.stop()}play(){this.animation.play()}pause(){this.animation.pause()}complete(){this.animation.complete()}cancel(){var t;this._animation&&this.animation.cancel(),(t=this.keyframeResolver)==null||t.cancel()}}const zoe=/^var\(--(?:([\w-]+)|([\w-]+), ?([a-zA-Z\d ()%#.,-]+))\)/u;function Boe(e){const t=zoe.exec(e);if(!t)return[,];const[,r,n,s]=t;return[`--${r??n}`,s]}function VD(e,t,r=1){const[n,s]=Boe(e);if(!n)return;const o=window.getComputedStyle(t).getPropertyValue(n);if(o){const i=o.trim();return dD(i)?parseFloat(i):i}return Dk(s)?VD(s,t,r+1):s}function Wk(e,t){return(e==null?void 0:e[t])??(e==null?void 0:e.default)??e}const HD=new Set(["width","height","top","left","right","bottom",...Cp]),Foe={test:e=>e==="auto",parse:e=>e},WD=e=>t=>t.test(e),GD=[Pp,Vr,Pi,vl,jse,Tse,Foe],aC=e=>GD.find(WD(e));function Uoe(e){return typeof e=="number"?e===0:e!==null?e==="none"||e==="0"||fD(e):!0}const qoe=new Set(["brightness","contrast","saturate","opacity"]);function Voe(e){const[t,r]=e.slice(0,-1).split("(");if(t==="drop-shadow")return e;const[n]=r.match(Ok)||[];if(!n)return e;const s=r.replace(n,"");let o=qoe.has(t)?1:0;return n!==r&&(o*=100),t+"("+o+s+")"}const Hoe=/\b([a-z-]*)\(.*?\)/gu,Pw={...Yl,getAnimatableNone:e=>{const t=e.match(Hoe);return t?t.map(Voe).join(" "):e}},sC={...Pp,transform:Math.round},Woe={rotate:vl,rotateX:vl,rotateY:vl,rotateZ:vl,scale:Rh,scaleX:Rh,scaleY:Rh,scaleZ:Rh,skew:vl,skewX:vl,skewY:vl,distance:Vr,translateX:Vr,translateY:Vr,translateZ:Vr,x:Vr,y:Vr,z:Vr,perspective:Vr,transformPerspective:Vr,opacity:cm,originX:GP,originY:GP,originZ:Vr},Gk={borderWidth:Vr,borderTopWidth:Vr,borderRightWidth:Vr,borderBottomWidth:Vr,borderLeftWidth:Vr,borderRadius:Vr,radius:Vr,borderTopLeftRadius:Vr,borderTopRightRadius:Vr,borderBottomRightRadius:Vr,borderBottomLeftRadius:Vr,width:Vr,maxWidth:Vr,height:Vr,maxHeight:Vr,top:Vr,right:Vr,bottom:Vr,left:Vr,padding:Vr,paddingTop:Vr,paddingRight:Vr,paddingBottom:Vr,paddingLeft:Vr,margin:Vr,marginTop:Vr,marginRight:Vr,marginBottom:Vr,marginLeft:Vr,backgroundPositionX:Vr,backgroundPositionY:Vr,...Woe,zIndex:sC,fillOpacity:cm,strokeOpacity:cm,numOctaves:sC},Goe={...Gk,color:Aa,backgroundColor:Aa,outlineColor:Aa,fill:Aa,stroke:Aa,borderColor:Aa,borderTopColor:Aa,borderRightColor:Aa,borderBottomColor:Aa,borderLeftColor:Aa,filter:Pw,WebkitFilter:Pw},XD=e=>Goe[e];function YD(e,t){let r=XD(e);return r!==Pw&&(r=Yl),r.getAnimatableNone?r.getAnimatableNone(t):void 0}const Xoe=new Set(["auto","none","0"]);function Yoe(e,t,r){let n=0,s;for(;n<e.length&&!s;){const o=e[n];typeof o=="string"&&!Xoe.has(o)&&um(o).values.length&&(s=e[n]),n++}if(s&&r)for(const o of t)e[o]=YD(r,s)}class Zoe extends Hk{constructor(t,r,n,s,o){super(t,r,n,s,o,!0)}readKeyframes(){const{unresolvedKeyframes:t,element:r,name:n}=this;if(!r||!r.current)return;super.readKeyframes();for(let u=0;u<t.length;u++){let p=t[u];if(typeof p=="string"&&(p=p.trim(),Dk(p))){const d=VD(p,r.current);d!==void 0&&(t[u]=d),u===t.length-1&&(this.finalKeyframe=p)}}if(this.resolveNoneKeyframes(),!HD.has(n)||t.length!==2)return;const[s,o]=t,i=aC(s),c=aC(o);if(i!==c)if(eC(i)&&eC(c))for(let u=0;u<t.length;u++){const p=t[u];typeof p=="string"&&(t[u]=parseFloat(p))}else Xc[n]&&(this.needsMeasurement=!0)}resolveNoneKeyframes(){const{unresolvedKeyframes:t,name:r}=this,n=[];for(let s=0;s<t.length;s++)(t[s]===null||Uoe(t[s]))&&n.push(s);n.length&&Yoe(t,n,r)}measureInitialState(){const{element:t,unresolvedKeyframes:r,name:n}=this;if(!t||!t.current)return;n==="height"&&(this.suspendedScrollY=window.pageYOffset),this.measuredOrigin=Xc[n](t.measureViewportBox(),window.getComputedStyle(t.current)),r[0]=this.measuredOrigin;const s=r[r.length-1];s!==void 0&&t.getValue(n,s).jump(s,!1)}measureEndState(){var c;const{element:t,name:r,unresolvedKeyframes:n}=this;if(!t||!t.current)return;const s=t.getValue(r);s&&s.jump(this.measuredOrigin,!1);const o=n.length-1,i=n[o];n[o]=Xc[r](t.measureViewportBox(),window.getComputedStyle(t.current)),i!==null&&this.finalKeyframe===void 0&&(this.finalKeyframe=i),(c=this.removedTransforms)!=null&&c.length&&this.removedTransforms.forEach(([u,p])=>{t.getValue(u).set(p)}),this.resolveNoneKeyframes()}}function Koe(e,t,r){if(e instanceof EventTarget)return[e];if(typeof e=="string"){let n=document;const s=(r==null?void 0:r[e])??n.querySelectorAll(e);return s?Array.from(s):[]}return Array.from(e)}const ZD=(e,t)=>t&&typeof e=="number"?t.transform(e):e;function Qoe(e){return pD(e)&&"offsetHeight"in e}const oC=30,Joe=e=>!isNaN(parseFloat(e));class $oe{constructor(t,r={}){this.canTrackVelocity=null,this.events={},this.updateAndNotify=n=>{var o;const s=Ns.now();if(this.updatedAt!==s&&this.setPrevFrameValue(),this.prev=this.current,this.setCurrent(n),this.current!==this.prev&&((o=this.events.change)==null||o.notify(this.current),this.dependents))for(const i of this.dependents)i.dirty()},this.hasAnimated=!1,this.setCurrent(t),this.owner=r.owner}setCurrent(t){this.current=t,this.updatedAt=Ns.now(),this.canTrackVelocity===null&&t!==void 0&&(this.canTrackVelocity=Joe(this.current))}setPrevFrameValue(t=this.current){this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt}onChange(t){return this.on("change",t)}on(t,r){this.events[t]||(this.events[t]=new Ik);const n=this.events[t].add(r);return t==="change"?()=>{n(),Kn.read(()=>{this.events.change.getSize()||this.stop()})}:n}clearListeners(){for(const t in this.events)this.events[t].clear()}attach(t,r){this.passiveEffect=t,this.stopPassiveEffect=r}set(t){this.passiveEffect?this.passiveEffect(t,this.updateAndNotify):this.updateAndNotify(t)}setWithVelocity(t,r,n){this.set(r),this.prev=void 0,this.prevFrameValue=t,this.prevUpdatedAt=this.updatedAt-n}jump(t,r=!0){this.updateAndNotify(t),this.prev=t,this.prevUpdatedAt=this.prevFrameValue=void 0,r&&this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}dirty(){var t;(t=this.events.change)==null||t.notify(this.current)}addDependent(t){this.dependents||(this.dependents=new Set),this.dependents.add(t)}removeDependent(t){this.dependents&&this.dependents.delete(t)}get(){return this.current}getPrevious(){return this.prev}getVelocity(){const t=Ns.now();if(!this.canTrackVelocity||this.prevFrameValue===void 0||t-this.updatedAt>oC)return 0;const r=Math.min(this.updatedAt-this.prevUpdatedAt,oC);return mD(parseFloat(this.current)-parseFloat(this.prevFrameValue),r)}start(t){return this.stop(),new Promise(r=>{this.hasAnimated=!0,this.animation=t(r),this.events.animationStart&&this.events.animationStart.notify()}).then(()=>{this.events.animationComplete&&this.events.animationComplete.notify(),this.clearAnimation()})}stop(){this.animation&&(this.animation.stop(),this.events.animationCancel&&this.events.animationCancel.notify()),this.clearAnimation()}isAnimating(){return!!this.animation}clearAnimation(){delete this.animation}destroy(){var t,r;(t=this.dependents)==null||t.clear(),(r=this.events.destroy)==null||r.notify(),this.clearListeners(),this.stop(),this.stopPassiveEffect&&this.stopPassiveEffect()}}function sp(e,t){return new $oe(e,t)}const{schedule:Xk}=SD(queueMicrotask,!1),jo={x:!1,y:!1};function KD(){return jo.x||jo.y}function eie(e){return e==="x"||e==="y"?jo[e]?null:(jo[e]=!0,()=>{jo[e]=!1}):jo.x||jo.y?null:(jo.x=jo.y=!0,()=>{jo.x=jo.y=!1})}function QD(e,t){const r=Koe(e),n=new AbortController,s={passive:!0,...t,signal:n.signal};return[r,s,()=>n.abort()]}function iC(e){return!(e.pointerType==="touch"||KD())}function tie(e,t,r={}){const[n,s,o]=QD(e,r),i=c=>{if(!iC(c))return;const{target:u}=c,p=t(u,c);if(typeof p!="function"||!u)return;const d=f=>{iC(f)&&(p(f),u.removeEventListener("pointerleave",d))};u.addEventListener("pointerleave",d,s)};return n.forEach(c=>{c.addEventListener("pointerenter",i,s)}),o}const JD=(e,t)=>t?e===t?!0:JD(e,t.parentElement):!1,Yk=e=>e.pointerType==="mouse"?typeof e.button!="number"||e.button<=0:e.isPrimary!==!1,rie=new Set(["BUTTON","INPUT","SELECT","TEXTAREA","A"]);function nie(e){return rie.has(e.tagName)||e.tabIndex!==-1}const Ig=new WeakSet;function lC(e){return t=>{t.key==="Enter"&&e(t)}}function Kv(e,t){e.dispatchEvent(new PointerEvent("pointer"+t,{isPrimary:!0,bubbles:!0}))}const aie=(e,t)=>{const r=e.currentTarget;if(!r)return;const n=lC(()=>{if(Ig.has(r))return;Kv(r,"down");const s=lC(()=>{Kv(r,"up")}),o=()=>Kv(r,"cancel");r.addEventListener("keyup",s,t),r.addEventListener("blur",o,t)});r.addEventListener("keydown",n,t),r.addEventListener("blur",()=>r.removeEventListener("keydown",n),t)};function cC(e){return Yk(e)&&!KD()}function sie(e,t,r={}){const[n,s,o]=QD(e,r),i=c=>{const u=c.currentTarget;if(!cC(c))return;Ig.add(u);const p=t(u,c),d=(h,b)=>{window.removeEventListener("pointerup",f),window.removeEventListener("pointercancel",m),Ig.has(u)&&Ig.delete(u),cC(h)&&typeof p=="function"&&p(h,{success:b})},f=h=>{d(h,u===window||u===document||r.useGlobalTarget||JD(u,h.target))},m=h=>{d(h,!1)};window.addEventListener("pointerup",f,s),window.addEventListener("pointercancel",m,s)};return n.forEach(c=>{(r.useGlobalTarget?window:c).addEventListener("pointerdown",i,s),Qoe(c)&&(c.addEventListener("focus",p=>aie(p,s)),!nie(c)&&!c.hasAttribute("tabindex")&&(c.tabIndex=0))}),o}function $D(e){return pD(e)&&"ownerSVGElement"in e}function oie(e){return $D(e)&&e.tagName==="svg"}const ds=e=>!!(e&&e.getVelocity),iie=[...GD,Aa,Yl],lie=e=>iie.find(WD(e)),e5=l.createContext({transformPagePoint:e=>e,isStatic:!1,reducedMotion:"never"});function cie(e=!0){const t=l.useContext(Pk);if(t===null)return[!0,null];const{isPresent:r,onExitComplete:n,register:s}=t,o=l.useId();l.useEffect(()=>{if(e)return s(o)},[e]);const i=l.useCallback(()=>e&&n&&n(o),[o,n,e]);return!r&&n?[!1,i]:[!0]}const t5=l.createContext({strict:!1}),uC={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"]},op={};for(const e in uC)op[e]={isEnabled:t=>uC[e].some(r=>!!t[r])};function uie(e){for(const t in e)op[t]={...op[t],...e[t]}}const die=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 Cy(e){return e.startsWith("while")||e.startsWith("drag")&&e!=="draggable"||e.startsWith("layout")||e.startsWith("onTap")||e.startsWith("onPan")||e.startsWith("onLayout")||die.has(e)}let r5=e=>!Cy(e);function pie(e){typeof e=="function"&&(r5=t=>t.startsWith("on")?!Cy(t):e(t))}try{pie(require("@emotion/is-prop-valid").default)}catch{}function fie(e,t,r){const n={};for(const s in e)s==="values"&&typeof e.values=="object"||(r5(s)||r===!0&&Cy(s)||!t&&!Cy(s)||e.draggable&&s.startsWith("onDrag"))&&(n[s]=e[s]);return n}const Ib=l.createContext({});function Nb(e){return e!==null&&typeof e=="object"&&typeof e.start=="function"}function dm(e){return typeof e=="string"||Array.isArray(e)}const Zk=["animate","whileInView","whileFocus","whileHover","whileTap","whileDrag","exit"],Kk=["initial",...Zk];function Mb(e){return Nb(e.animate)||Kk.some(t=>dm(e[t]))}function n5(e){return!!(Mb(e)||e.variants)}function mie(e,t){if(Mb(e)){const{initial:r,animate:n}=e;return{initial:r===!1||dm(r)?r:void 0,animate:dm(n)?n:void 0}}return e.inherit!==!1?t:{}}function hie(e){const{initial:t,animate:r}=mie(e,l.useContext(Ib));return l.useMemo(()=>({initial:t,animate:r}),[dC(t),dC(r)])}function dC(e){return Array.isArray(e)?e.join(" "):e}const pm={};function gie(e){for(const t in e)pm[t]=e[t],Lk(t)&&(pm[t].isCSSVariable=!0)}function a5(e,{layout:t,layoutId:r}){return Rp.has(e)||e.startsWith("origin")||(t||r!==void 0)&&(!!pm[e]||e==="opacity")}const yie={x:"translateX",y:"translateY",z:"translateZ",transformPerspective:"perspective"},bie=Cp.length;function vie(e,t,r){let n="",s=!0;for(let o=0;o<bie;o++){const i=Cp[o],c=e[i];if(c===void 0)continue;let u=!0;if(typeof c=="number"?u=c===(i.startsWith("scale")?1:0):u=parseFloat(c)===0,!u||r){const p=ZD(c,Gk[i]);if(!u){s=!1;const d=yie[i]||i;n+=`${d}(${p}) `}r&&(t[i]=p)}}return n=n.trim(),r?n=r(t,s?"":n):s&&(n="none"),n}function Qk(e,t,r){const{style:n,vars:s,transformOrigin:o}=e;let i=!1,c=!1;for(const u in t){const p=t[u];if(Rp.has(u)){i=!0;continue}else if(Lk(u)){s[u]=p;continue}else{const d=ZD(p,Gk[u]);u.startsWith("origin")?(c=!0,o[u]=d):n[u]=d}}if(t.transform||(i||r?n.transform=vie(t,e.transform,r):n.transform&&(n.transform="none")),c){const{originX:u="50%",originY:p="50%",originZ:d=0}=o;n.transformOrigin=`${u} ${p} ${d}`}}const Jk=()=>({style:{},transform:{},transformOrigin:{},vars:{}});function s5(e,t,r){for(const n in t)!ds(t[n])&&!a5(n,r)&&(e[n]=t[n])}function _ie({transformTemplate:e},t){return l.useMemo(()=>{const r=Jk();return Qk(r,t,e),Object.assign({},r.vars,r.style)},[t])}function wie(e,t){const r=e.style||{},n={};return s5(n,r,e),Object.assign(n,_ie(e,t)),n}function xie(e,t){const r={},n=wie(e,t);return e.drag&&e.dragListener!==!1&&(r.draggable=!1,n.userSelect=n.WebkitUserSelect=n.WebkitTouchCallout="none",n.touchAction=e.drag===!0?"none":`pan-${e.drag==="x"?"y":"x"}`),e.tabIndex===void 0&&(e.onTap||e.onTapStart||e.whileTap)&&(r.tabIndex=0),r.style=n,r}const Aie={offset:"stroke-dashoffset",array:"stroke-dasharray"},kie={offset:"strokeDashoffset",array:"strokeDasharray"};function Sie(e,t,r=1,n=0,s=!0){e.pathLength=1;const o=s?Aie:kie;e[o.offset]=Vr.transform(-n);const i=Vr.transform(t),c=Vr.transform(r);e[o.array]=`${i} ${c}`}function o5(e,{attrX:t,attrY:r,attrScale:n,pathLength:s,pathSpacing:o=1,pathOffset:i=0,...c},u,p,d){if(Qk(e,c,p),u){e.style.viewBox&&(e.attrs.viewBox=e.style.viewBox);return}e.attrs=e.style,e.style={};const{attrs:f,style:m}=e;f.transform&&(m.transform=f.transform,delete f.transform),(m.transform||f.transformOrigin)&&(m.transformOrigin=f.transformOrigin??"50% 50%",delete f.transformOrigin),m.transform&&(m.transformBox=(d==null?void 0:d.transformBox)??"fill-box",delete f.transformBox),t!==void 0&&(f.x=t),r!==void 0&&(f.y=r),n!==void 0&&(f.scale=n),s!==void 0&&Sie(f,s,o,i,!1)}const i5=()=>({...Jk(),attrs:{}}),l5=e=>typeof e=="string"&&e.toLowerCase()==="svg";function Eie(e,t,r,n){const s=l.useMemo(()=>{const o=i5();return o5(o,t,l5(n),e.transformTemplate,e.style),{...o.attrs,style:{...o.style}}},[t]);if(e.style){const o={};s5(o,e.style,e),s.style={...o,...s.style}}return s}const Pie=["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 $k(e){return typeof e!="string"||e.includes("-")?!1:!!(Pie.indexOf(e)>-1||/[A-Z]/u.test(e))}function Cie(e,t,r,{latestValues:n},s,o=!1){const c=($k(e)?Eie:xie)(t,n,s,e),u=fie(t,typeof e=="string",o),p=e!==l.Fragment?{...u,...c,ref:r}:{},{children:d}=t,f=l.useMemo(()=>ds(d)?d.get():d,[d]);return l.createElement(e,{...p,children:f})}function pC(e){const t=[{},{}];return e==null||e.values.forEach((r,n)=>{t[0][n]=r.get(),t[1][n]=r.getVelocity()}),t}function e1(e,t,r,n){if(typeof t=="function"){const[s,o]=pC(n);t=t(r!==void 0?r:e.custom,s,o)}if(typeof t=="string"&&(t=e.variants&&e.variants[t]),typeof t=="function"){const[s,o]=pC(n);t=t(r!==void 0?r:e.custom,s,o)}return t}function Ng(e){return ds(e)?e.get():e}function Rie({scrapeMotionValuesFromProps:e,createRenderState:t},r,n,s){return{latestValues:Tie(r,n,s,e),renderState:t()}}function Tie(e,t,r,n){const s={},o=n(e,{});for(const m in o)s[m]=Ng(o[m]);let{initial:i,animate:c}=e;const u=Mb(e),p=n5(e);t&&p&&!u&&e.inherit!==!1&&(i===void 0&&(i=t.initial),c===void 0&&(c=t.animate));let d=r?r.initial===!1:!1;d=d||i===!1;const f=d?c:i;if(f&&typeof f!="boolean"&&!Nb(f)){const m=Array.isArray(f)?f:[f];for(let h=0;h<m.length;h++){const b=e1(e,m[h]);if(b){const{transitionEnd:g,transition:y,...x}=b;for(const v in x){let A=x[v];if(Array.isArray(A)){const _=d?A.length-1:0;A=A[_]}A!==null&&(s[v]=A)}for(const v in g)s[v]=g[v]}}}return s}const c5=e=>(t,r)=>{const n=l.useContext(Ib),s=l.useContext(Pk),o=()=>Rie(e,t,n,s);return r?o():use(o)};function t1(e,t,r){var o;const{style:n}=e,s={};for(const i in n)(ds(n[i])||t.style&&ds(t.style[i])||a5(i,e)||((o=r==null?void 0:r.getValue(i))==null?void 0:o.liveStyle)!==void 0)&&(s[i]=n[i]);return s}const jie=c5({scrapeMotionValuesFromProps:t1,createRenderState:Jk});function u5(e,t,r){const n=t1(e,t,r);for(const s in e)if(ds(e[s])||ds(t[s])){const o=Cp.indexOf(s)!==-1?"attr"+s.charAt(0).toUpperCase()+s.substring(1):s;n[o]=e[s]}return n}const Iie=c5({scrapeMotionValuesFromProps:u5,createRenderState:i5}),Nie=Symbol.for("motionComponentSymbol");function gd(e){return e&&typeof e=="object"&&Object.prototype.hasOwnProperty.call(e,"current")}function Mie(e,t,r){return l.useCallback(n=>{n&&e.onMount&&e.onMount(n),t&&(n?t.mount(n):t.unmount()),r&&(typeof r=="function"?r(n):gd(r)&&(r.current=n))},[t])}const r1=e=>e.replace(/([a-z])([A-Z])/gu,"$1-$2").toLowerCase(),Lie="framerAppearId",d5="data-"+r1(Lie),p5=l.createContext({});function Die(e,t,r,n,s){var g,y;const{visualElement:o}=l.useContext(Ib),i=l.useContext(t5),c=l.useContext(Pk),u=l.useContext(e5).reducedMotion,p=l.useRef(null);n=n||i.renderer,!p.current&&n&&(p.current=n(e,{visualState:t,parent:o,props:r,presenceContext:c,blockInitialAnimation:c?c.initial===!1:!1,reducedMotionConfig:u}));const d=p.current,f=l.useContext(p5);d&&!d.projection&&s&&(d.type==="html"||d.type==="svg")&&Oie(p.current,r,s,f);const m=l.useRef(!1);l.useInsertionEffect(()=>{d&&m.current&&d.update(r,c)});const h=r[d5],b=l.useRef(!!h&&!((g=window.MotionHandoffIsComplete)!=null&&g.call(window,h))&&((y=window.MotionHasOptimisedAnimation)==null?void 0:y.call(window,h)));return dse(()=>{d&&(m.current=!0,window.MotionIsMounted=!0,d.updateFeatures(),d.scheduleRenderMicrotask(),b.current&&d.animationState&&d.animationState.animateChanges())}),l.useEffect(()=>{d&&(!b.current&&d.animationState&&d.animationState.animateChanges(),b.current&&(queueMicrotask(()=>{var x;(x=window.MotionHandoffMarkAsComplete)==null||x.call(window,h)}),b.current=!1),d.enteringChildren=void 0)}),d}function Oie(e,t,r,n){const{layoutId:s,layout:o,drag:i,dragConstraints:c,layoutScroll:u,layoutRoot:p,layoutCrossfade:d}=t;e.projection=new r(e.latestValues,t["data-framer-portal-id"]?void 0:f5(e.parent)),e.projection.setOptions({layoutId:s,layout:o,alwaysMeasureLayout:!!i||c&&gd(c),visualElement:e,animationType:typeof o=="string"?o:"both",initialPromotionConfig:n,crossfade:d,layoutScroll:u,layoutRoot:p})}function f5(e){if(e)return e.options.allowProjection!==!1?e.projection:f5(e.parent)}function Qv(e,{forwardMotionProps:t=!1}={},r,n){r&&uie(r);const s=$k(e)?Iie:jie;function o(c,u){let p;const d={...l.useContext(e5),...c,layoutId:zie(c)},{isStatic:f}=d,m=hie(c),h=s(c,f);if(!f&&Ek){Bie();const b=Fie(d);p=b.MeasureLayout,m.visualElement=Die(e,h,d,n,b.ProjectionNode)}return a.jsxs(Ib.Provider,{value:m,children:[p&&m.visualElement?a.jsx(p,{visualElement:m.visualElement,...d}):null,Cie(e,c,Mie(h,m.visualElement,u),h,f,t)]})}o.displayName=`motion.${typeof e=="string"?e:`create(${e.displayName??e.name??""})`}`;const i=l.forwardRef(o);return i[Nie]=e,i}function zie({layoutId:e}){const t=l.useContext(uD).id;return t&&e!==void 0?t+"-"+e:e}function Bie(e,t){l.useContext(t5).strict}function Fie(e){const{drag:t,layout:r}=op;if(!t&&!r)return{};const n={...t,...r};return{MeasureLayout:t!=null&&t.isEnabled(e)||r!=null&&r.isEnabled(e)?n.MeasureLayout:void 0,ProjectionNode:n.ProjectionNode}}function Uie(e,t){if(typeof Proxy>"u")return Qv;const r=new Map,n=(o,i)=>Qv(o,i,e,t),s=(o,i)=>n(o,i);return new Proxy(s,{get:(o,i)=>i==="create"?n:(r.has(i)||r.set(i,Qv(i,void 0,e,t)),r.get(i))})}function m5({top:e,left:t,right:r,bottom:n}){return{x:{min:t,max:r},y:{min:e,max:n}}}function qie({x:e,y:t}){return{top:t.min,right:e.max,bottom:t.max,left:e.min}}function Vie(e,t){if(!t)return e;const r=t({x:e.left,y:e.top}),n=t({x:e.right,y:e.bottom});return{top:r.y,left:r.x,bottom:n.y,right:n.x}}function Jv(e){return e===void 0||e===1}function Cw({scale:e,scaleX:t,scaleY:r}){return!Jv(e)||!Jv(t)||!Jv(r)}function Sc(e){return Cw(e)||h5(e)||e.z||e.rotate||e.rotateX||e.rotateY||e.skewX||e.skewY}function h5(e){return fC(e.x)||fC(e.y)}function fC(e){return e&&e!=="0%"}function Ry(e,t,r){const n=e-r,s=t*n;return r+s}function mC(e,t,r,n,s){return s!==void 0&&(e=Ry(e,s,n)),Ry(e,r,n)+t}function Rw(e,t=0,r=1,n,s){e.min=mC(e.min,t,r,n,s),e.max=mC(e.max,t,r,n,s)}function g5(e,{x:t,y:r}){Rw(e.x,t.translate,t.scale,t.originPoint),Rw(e.y,r.translate,r.scale,r.originPoint)}const hC=.999999999999,gC=1.0000000000001;function Hie(e,t,r,n=!1){const s=r.length;if(!s)return;t.x=t.y=1;let o,i;for(let c=0;c<s;c++){o=r[c],i=o.projectionDelta;const{visualElement:u}=o.options;u&&u.props.style&&u.props.style.display==="contents"||(n&&o.options.layoutScroll&&o.scroll&&o!==o.root&&bd(e,{x:-o.scroll.offset.x,y:-o.scroll.offset.y}),i&&(t.x*=i.x.scale,t.y*=i.y.scale,g5(e,i)),n&&Sc(o.latestValues)&&bd(e,o.latestValues))}t.x<gC&&t.x>hC&&(t.x=1),t.y<gC&&t.y>hC&&(t.y=1)}function yd(e,t){e.min=e.min+t,e.max=e.max+t}function yC(e,t,r,n,s=.5){const o=aa(e.min,e.max,s);Rw(e,t,r,o,n)}function bd(e,t){yC(e.x,t.x,t.scaleX,t.scale,t.originX),yC(e.y,t.y,t.scaleY,t.scale,t.originY)}function y5(e,t){return m5(Vie(e.getBoundingClientRect(),t))}function Wie(e,t,r){const n=y5(e,r),{scroll:s}=t;return s&&(yd(n.x,s.offset.x),yd(n.y,s.offset.y)),n}const bC=()=>({translate:0,scale:1,origin:0,originPoint:0}),vd=()=>({x:bC(),y:bC()}),vC=()=>({min:0,max:0}),fa=()=>({x:vC(),y:vC()}),Ty={current:null},n1={current:!1};function b5(){if(n1.current=!0,!!Ek)if(window.matchMedia){const e=window.matchMedia("(prefers-reduced-motion)"),t=()=>Ty.current=e.matches;e.addEventListener("change",t),t()}else Ty.current=!1}const Gie=new WeakMap;function Xie(e,t,r){for(const n in t){const s=t[n],o=r[n];if(ds(s))e.addValue(n,s);else if(ds(o))e.addValue(n,sp(s,{owner:e}));else if(o!==s)if(e.hasValue(n)){const i=e.getValue(n);i.liveStyle===!0?i.jump(s):i.hasAnimated||i.set(s)}else{const i=e.getStaticValue(n);e.addValue(n,sp(i!==void 0?i:s,{owner:e}))}}for(const n in r)t[n]===void 0&&e.removeValue(n);return t}const _C=["AnimationStart","AnimationComplete","Update","BeforeLayoutMeasure","LayoutMeasure","LayoutAnimationStart","LayoutAnimationComplete"];class Yie{scrapeMotionValuesFromProps(t,r,n){return{}}constructor({parent:t,props:r,presenceContext:n,reducedMotionConfig:s,blockInitialAnimation:o,visualState:i},c={}){this.current=null,this.children=new Set,this.isVariantNode=!1,this.isControllingVariants=!1,this.shouldReduceMotion=null,this.values=new Map,this.KeyframeResolver=Hk,this.features={},this.valueSubscriptions=new Map,this.prevMotionValues={},this.events={},this.propEventSubscriptions={},this.notifyUpdate=()=>this.notify("Update",this.latestValues),this.render=()=>{this.current&&(this.triggerBuild(),this.renderInstance(this.current,this.renderState,this.props.style,this.projection))},this.renderScheduledAt=0,this.scheduleRender=()=>{const m=Ns.now();this.renderScheduledAt<m&&(this.renderScheduledAt=m,Kn.render(this.render,!1,!0))};const{latestValues:u,renderState:p}=i;this.latestValues=u,this.baseTarget={...u},this.initialValues=r.initial?{...u}:{},this.renderState=p,this.parent=t,this.props=r,this.presenceContext=n,this.depth=t?t.depth+1:0,this.reducedMotionConfig=s,this.options=c,this.blockInitialAnimation=!!o,this.isControllingVariants=Mb(r),this.isVariantNode=n5(r),this.isVariantNode&&(this.variantChildren=new Set),this.manuallyAnimateOnMount=!!(t&&t.current);const{willChange:d,...f}=this.scrapeMotionValuesFromProps(r,{},this);for(const m in f){const h=f[m];u[m]!==void 0&&ds(h)&&h.set(u[m])}}mount(t){var r;this.current=t,Gie.set(t,this),this.projection&&!this.projection.instance&&this.projection.mount(t),this.parent&&this.isVariantNode&&!this.isControllingVariants&&(this.removeFromVariantTree=this.parent.addVariantChild(this)),this.values.forEach((n,s)=>this.bindToMotionValue(s,n)),n1.current||b5(),this.shouldReduceMotion=this.reducedMotionConfig==="never"?!1:this.reducedMotionConfig==="always"?!0:Ty.current,(r=this.parent)==null||r.addChild(this),this.update(this.props,this.presenceContext)}unmount(){var t;this.projection&&this.projection.unmount(),Xl(this.notifyUpdate),Xl(this.render),this.valueSubscriptions.forEach(r=>r()),this.valueSubscriptions.clear(),this.removeFromVariantTree&&this.removeFromVariantTree(),(t=this.parent)==null||t.removeChild(this);for(const r in this.events)this.events[r].clear();for(const r in this.features){const n=this.features[r];n&&(n.unmount(),n.isMounted=!1)}this.current=null}addChild(t){this.children.add(t),this.enteringChildren??(this.enteringChildren=new Set),this.enteringChildren.add(t)}removeChild(t){this.children.delete(t),this.enteringChildren&&this.enteringChildren.delete(t)}bindToMotionValue(t,r){this.valueSubscriptions.has(t)&&this.valueSubscriptions.get(t)();const n=Rp.has(t);n&&this.onBindTransform&&this.onBindTransform();const s=r.on("change",i=>{this.latestValues[t]=i,this.props.onUpdate&&Kn.preRender(this.notifyUpdate),n&&this.projection&&(this.projection.isTransformDirty=!0),this.scheduleRender()});let o;window.MotionCheckAppearSync&&(o=window.MotionCheckAppearSync(this,t,r)),this.valueSubscriptions.set(t,()=>{s(),o&&o(),r.owner&&r.stop()})}sortNodePosition(t){return!this.current||!this.sortInstanceNodePosition||this.type!==t.type?0:this.sortInstanceNodePosition(this.current,t.current)}updateFeatures(){let t="animation";for(t in op){const r=op[t];if(!r)continue;const{isEnabled:n,Feature:s}=r;if(!this.features[t]&&s&&n(this.props)&&(this.features[t]=new s(this)),this.features[t]){const o=this.features[t];o.isMounted?o.update():(o.mount(),o.isMounted=!0)}}}triggerBuild(){this.build(this.renderState,this.latestValues,this.props)}measureViewportBox(){return this.current?this.measureInstanceViewportBox(this.current,this.props):fa()}getStaticValue(t){return this.latestValues[t]}setStaticValue(t,r){this.latestValues[t]=r}update(t,r){(t.transformTemplate||this.props.transformTemplate)&&this.scheduleRender(),this.prevProps=this.props,this.props=t,this.prevPresenceContext=this.presenceContext,this.presenceContext=r;for(let n=0;n<_C.length;n++){const s=_C[n];this.propEventSubscriptions[s]&&(this.propEventSubscriptions[s](),delete this.propEventSubscriptions[s]);const o="on"+s,i=t[o];i&&(this.propEventSubscriptions[s]=this.on(s,i))}this.prevMotionValues=Xie(this,this.scrapeMotionValuesFromProps(t,this.prevProps,this),this.prevMotionValues),this.handleChildMotionValue&&this.handleChildMotionValue()}getProps(){return this.props}getVariant(t){return this.props.variants?this.props.variants[t]: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(t){const r=this.getClosestVariantNode();if(r)return r.variantChildren&&r.variantChildren.add(t),()=>r.variantChildren.delete(t)}addValue(t,r){const n=this.values.get(t);r!==n&&(n&&this.removeValue(t),this.bindToMotionValue(t,r),this.values.set(t,r),this.latestValues[t]=r.get())}removeValue(t){this.values.delete(t);const r=this.valueSubscriptions.get(t);r&&(r(),this.valueSubscriptions.delete(t)),delete this.latestValues[t],this.removeValueFromRenderState(t,this.renderState)}hasValue(t){return this.values.has(t)}getValue(t,r){if(this.props.values&&this.props.values[t])return this.props.values[t];let n=this.values.get(t);return n===void 0&&r!==void 0&&(n=sp(r===null?void 0:r,{owner:this}),this.addValue(t,n)),n}readValue(t,r){let n=this.latestValues[t]!==void 0||!this.current?this.latestValues[t]:this.getBaseTargetFromProps(this.props,t)??this.readValueFromInstance(this.current,t,this.options);return n!=null&&(typeof n=="string"&&(dD(n)||fD(n))?n=parseFloat(n):!lie(n)&&Yl.test(r)&&(n=YD(t,r)),this.setBaseTarget(t,ds(n)?n.get():n)),ds(n)?n.get():n}setBaseTarget(t,r){this.baseTarget[t]=r}getBaseTarget(t){var o;const{initial:r}=this.props;let n;if(typeof r=="string"||typeof r=="object"){const i=e1(this.props,r,(o=this.presenceContext)==null?void 0:o.custom);i&&(n=i[t])}if(r&&n!==void 0)return n;const s=this.getBaseTargetFromProps(this.props,t);return s!==void 0&&!ds(s)?s:this.initialValues[t]!==void 0&&n===void 0?void 0:this.baseTarget[t]}on(t,r){return this.events[t]||(this.events[t]=new Ik),this.events[t].add(r)}notify(t,...r){this.events[t]&&this.events[t].notify(...r)}scheduleRenderMicrotask(){Xk.render(this.render)}}class v5 extends Yie{constructor(){super(...arguments),this.KeyframeResolver=Zoe}sortInstanceNodePosition(t,r){return t.compareDocumentPosition(r)&2?1:-1}getBaseTargetFromProps(t,r){return t.style?t.style[r]:void 0}removeValueFromRenderState(t,{vars:r,style:n}){delete r[t],delete n[t]}handleChildMotionValue(){this.childSubscription&&(this.childSubscription(),delete this.childSubscription);const{children:t}=this.props;ds(t)&&(this.childSubscription=t.on("change",r=>{this.current&&(this.current.textContent=`${r}`)}))}}function _5(e,{style:t,vars:r},n,s){const o=e.style;let i;for(i in t)o[i]=t[i];s==null||s.applyProjectionStyles(o,n);for(i in r)o.setProperty(i,r[i])}function Zie(e){return window.getComputedStyle(e)}class Kie extends v5{constructor(){super(...arguments),this.type="html",this.renderInstance=_5}readValueFromInstance(t,r){var n;if(Rp.has(r))return(n=this.projection)!=null&&n.isProjecting?ww(r):moe(t,r);{const s=Zie(t),o=(Lk(r)?s.getPropertyValue(r):s[r])||0;return typeof o=="string"?o.trim():o}}measureInstanceViewportBox(t,{transformPagePoint:r}){return y5(t,r)}build(t,r,n){Qk(t,r,n.transformTemplate)}scrapeMotionValuesFromProps(t,r,n){return t1(t,r,n)}}const w5=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 Qie(e,t,r,n){_5(e,t,void 0,n);for(const s in t.attrs)e.setAttribute(w5.has(s)?s:r1(s),t.attrs[s])}class Jie extends v5{constructor(){super(...arguments),this.type="svg",this.isSVGTag=!1,this.measureInstanceViewportBox=fa}getBaseTargetFromProps(t,r){return t[r]}readValueFromInstance(t,r){if(Rp.has(r)){const n=XD(r);return n&&n.default||0}return r=w5.has(r)?r:r1(r),t.getAttribute(r)}scrapeMotionValuesFromProps(t,r,n){return u5(t,r,n)}build(t,r,n){o5(t,r,this.isSVGTag,n.transformTemplate,n.style)}renderInstance(t,r,n,s){Qie(t,r,n,s)}mount(t){this.isSVGTag=l5(t.tagName),super.mount(t)}}const $ie=(e,t)=>$k(e)?new Jie(t):new Kie(t,{allowProjection:e!==l.Fragment});function Bd(e,t,r){const n=e.getProps();return e1(n,t,r!==void 0?r:n.custom,e)}const Tw=e=>Array.isArray(e);function ele(e,t,r){e.hasValue(t)?e.getValue(t).set(r):e.addValue(t,sp(r))}function tle(e){return Tw(e)?e[e.length-1]||0:e}function rle(e,t){const r=Bd(e,t);let{transitionEnd:n={},transition:s={},...o}=r||{};o={...o,...n};for(const i in o){const c=tle(o[i]);ele(e,i,c)}}function nle(e){return!!(ds(e)&&e.add)}function jw(e,t){const r=e.getValue("willChange");if(nle(r))return r.add(t);if(!r&&cl.WillChange){const n=new cl.WillChange("auto");e.addValue("willChange",n),n.add(t)}}function x5(e){return e.props[d5]}const ale=e=>e!==null;function sle(e,{repeat:t,repeatType:r="loop"},n){const s=e.filter(ale),o=t&&r!=="loop"&&t%2===1?0:s.length-1;return s[o]}const ole={type:"spring",stiffness:500,damping:25,restSpeed:10},ile=e=>({type:"spring",stiffness:550,damping:e===0?2*Math.sqrt(550):30,restSpeed:10}),lle={type:"keyframes",duration:.8},cle={type:"keyframes",ease:[.25,.1,.35,1],duration:.3},ule=(e,{keyframes:t})=>t.length>2?lle:Rp.has(e)?e.startsWith("scale")?ile(t[1]):ole:cle;function dle({when:e,delay:t,delayChildren:r,staggerChildren:n,staggerDirection:s,repeat:o,repeatType:i,repeatDelay:c,from:u,elapsed:p,...d}){return!!Object.keys(d).length}const a1=(e,t,r,n={},s,o)=>i=>{const c=Wk(n,e)||{},u=c.delay||n.delay||0;let{elapsed:p=0}=n;p=p-Si(u);const d={keyframes:Array.isArray(r)?r:[null,r],ease:"easeOut",velocity:t.getVelocity(),...c,delay:-p,onUpdate:m=>{t.set(m),c.onUpdate&&c.onUpdate(m)},onComplete:()=>{i(),c.onComplete&&c.onComplete()},name:e,motionValue:t,element:o?void 0:s};dle(c)||Object.assign(d,ule(e,d)),d.duration&&(d.duration=Si(d.duration)),d.repeatDelay&&(d.repeatDelay=Si(d.repeatDelay)),d.from!==void 0&&(d.keyframes[0]=d.from);let f=!1;if((d.type===!1||d.duration===0&&!d.repeatDelay)&&(Ew(d),d.delay===0&&(f=!0)),(cl.instantAnimations||cl.skipAnimations)&&(f=!0,Ew(d),d.delay=0),d.allowFlatten=!c.type&&!c.ease,f&&!o&&t.get()!==void 0){const m=sle(d.keyframes,c);if(m!==void 0){Kn.update(()=>{d.onUpdate(m),d.onComplete()});return}}return c.isSync?new Vk(d):new Ooe(d)};function ple({protectedKeys:e,needsAnimating:t},r){const n=e.hasOwnProperty(r)&&t[r]!==!0;return t[r]=!1,n}function A5(e,t,{delay:r=0,transitionOverride:n,type:s}={}){let{transition:o=e.getDefaultTransition(),transitionEnd:i,...c}=t;n&&(o=n);const u=[],p=s&&e.animationState&&e.animationState.getState()[s];for(const d in c){const f=e.getValue(d,e.latestValues[d]??null),m=c[d];if(m===void 0||p&&ple(p,d))continue;const h={delay:r,...Wk(o||{},d)},b=f.get();if(b!==void 0&&!f.isAnimating&&!Array.isArray(m)&&m===b&&!h.velocity)continue;let g=!1;if(window.MotionHandoffAnimation){const x=x5(e);if(x){const v=window.MotionHandoffAnimation(x,d,Kn);v!==null&&(h.startTime=v,g=!0)}}jw(e,d),f.start(a1(d,f,m,e.shouldReduceMotion&&HD.has(d)?{type:!1}:h,e,g));const y=f.animation;y&&u.push(y)}return i&&Promise.all(u).then(()=>{Kn.update(()=>{i&&rle(e,i)})}),u}function k5(e,t,r,n=0,s=1){const o=Array.from(e).sort((p,d)=>p.sortNodePosition(d)).indexOf(t),i=e.size,c=(i-1)*n;return typeof r=="function"?r(o,i):s===1?o*n:c-o*n}function Iw(e,t,r={}){var u;const n=Bd(e,t,r.type==="exit"?(u=e.presenceContext)==null?void 0:u.custom:void 0);let{transition:s=e.getDefaultTransition()||{}}=n||{};r.transitionOverride&&(s=r.transitionOverride);const o=n?()=>Promise.all(A5(e,n,r)):()=>Promise.resolve(),i=e.variantChildren&&e.variantChildren.size?(p=0)=>{const{delayChildren:d=0,staggerChildren:f,staggerDirection:m}=s;return fle(e,t,p,d,f,m,r)}:()=>Promise.resolve(),{when:c}=s;if(c){const[p,d]=c==="beforeChildren"?[o,i]:[i,o];return p().then(()=>d())}else return Promise.all([o(),i(r.delay)])}function fle(e,t,r=0,n=0,s=0,o=1,i){const c=[];for(const u of e.variantChildren)u.notify("AnimationStart",t),c.push(Iw(u,t,{...i,delay:r+(typeof n=="function"?0:n)+k5(e.variantChildren,u,n,s,o)}).then(()=>u.notify("AnimationComplete",t)));return Promise.all(c)}function mle(e,t,r={}){e.notify("AnimationStart",t);let n;if(Array.isArray(t)){const s=t.map(o=>Iw(e,o,r));n=Promise.all(s)}else if(typeof t=="string")n=Iw(e,t,r);else{const s=typeof t=="function"?Bd(e,t,r.custom):t;n=Promise.all(A5(e,s,r))}return n.then(()=>{e.notify("AnimationComplete",t)})}function S5(e,t){if(!Array.isArray(t))return!1;const r=t.length;if(r!==e.length)return!1;for(let n=0;n<r;n++)if(t[n]!==e[n])return!1;return!0}const hle=Kk.length;function E5(e){if(!e)return;if(!e.isControllingVariants){const r=e.parent?E5(e.parent)||{}:{};return e.props.initial!==void 0&&(r.initial=e.props.initial),r}const t={};for(let r=0;r<hle;r++){const n=Kk[r],s=e.props[n];(dm(s)||s===!1)&&(t[n]=s)}return t}const gle=[...Zk].reverse(),yle=Zk.length;function ble(e){return t=>Promise.all(t.map(({animation:r,options:n})=>mle(e,r,n)))}function vle(e){let t=ble(e),r=wC(),n=!0;const s=u=>(p,d)=>{var m;const f=Bd(e,d,u==="exit"?(m=e.presenceContext)==null?void 0:m.custom:void 0);if(f){const{transition:h,transitionEnd:b,...g}=f;p={...p,...g,...b}}return p};function o(u){t=u(e)}function i(u){const{props:p}=e,d=E5(e.parent)||{},f=[],m=new Set;let h={},b=1/0;for(let y=0;y<yle;y++){const x=gle[y],v=r[x],A=p[x]!==void 0?p[x]:d[x],_=dm(A),w=x===u?v.isActive:null;w===!1&&(b=y);let j=A===d[x]&&A!==p[x]&&_;if(j&&n&&e.manuallyAnimateOnMount&&(j=!1),v.protectedKeys={...h},!v.isActive&&w===null||!A&&!v.prevProp||Nb(A)||typeof A=="boolean")continue;const T=_le(v.prevProp,A);let R=T||x===u&&v.isActive&&!j&&_||y>b&&_,P=!1;const k=Array.isArray(A)?A:[A];let E=k.reduce(s(x),{});w===!1&&(E={});const{prevResolvedValues:M={}}=v,C={...M,...E},I=S=>{R=!0,m.has(S)&&(P=!0,m.delete(S)),v.needsAnimating[S]=!0;const F=e.getValue(S);F&&(F.liveStyle=!1)};for(const S in C){const F=E[S],D=M[S];if(h.hasOwnProperty(S))continue;let H=!1;Tw(F)&&Tw(D)?H=!S5(F,D):H=F!==D,H?F!=null?I(S):m.add(S):F!==void 0&&m.has(S)?I(S):v.protectedKeys[S]=!0}v.prevProp=A,v.prevResolvedValues=E,v.isActive&&(h={...h,...E}),n&&e.blockInitialAnimation&&(R=!1);const L=j&&T;R&&(!L||P)&&f.push(...k.map(S=>{const F={type:x};if(typeof S=="string"&&n&&!L&&e.manuallyAnimateOnMount&&e.parent){const{parent:D}=e,H=Bd(D,S);if(D.enteringChildren&&H){const{delayChildren:W}=H.transition||{};F.delay=k5(D.enteringChildren,e,W)}}return{animation:S,options:F}}))}if(m.size){const y={};if(typeof p.initial!="boolean"){const x=Bd(e,Array.isArray(p.initial)?p.initial[0]:p.initial);x&&x.transition&&(y.transition=x.transition)}m.forEach(x=>{const v=e.getBaseTarget(x),A=e.getValue(x);A&&(A.liveStyle=!0),y[x]=v??null}),f.push({animation:y})}let g=!!f.length;return n&&(p.initial===!1||p.initial===p.animate)&&!e.manuallyAnimateOnMount&&(g=!1),n=!1,g?t(f):Promise.resolve()}function c(u,p){var f;if(r[u].isActive===p)return Promise.resolve();(f=e.variantChildren)==null||f.forEach(m=>{var h;return(h=m.animationState)==null?void 0:h.setActive(u,p)}),r[u].isActive=p;const d=i(u);for(const m in r)r[m].protectedKeys={};return d}return{animateChanges:i,setActive:c,setAnimateFunction:o,getState:()=>r,reset:()=>{r=wC(),n=!0}}}function _le(e,t){return typeof t=="string"?t!==e:Array.isArray(t)?!S5(t,e):!1}function fc(e=!1){return{isActive:e,protectedKeys:{},needsAnimating:{},prevResolvedValues:{}}}function wC(){return{animate:fc(!0),whileInView:fc(),whileHover:fc(),whileTap:fc(),whileDrag:fc(),whileFocus:fc(),exit:fc()}}class oc{constructor(t){this.isMounted=!1,this.node=t}update(){}}class wle extends oc{constructor(t){super(t),t.animationState||(t.animationState=vle(t))}updateAnimationControlsSubscription(){const{animate:t}=this.node.getProps();Nb(t)&&(this.unmountControls=t.subscribe(this.node))}mount(){this.updateAnimationControlsSubscription()}update(){const{animate:t}=this.node.getProps(),{animate:r}=this.node.prevProps||{};t!==r&&this.updateAnimationControlsSubscription()}unmount(){var t;this.node.animationState.reset(),(t=this.unmountControls)==null||t.call(this)}}let xle=0;class Ale extends oc{constructor(){super(...arguments),this.id=xle++}update(){if(!this.node.presenceContext)return;const{isPresent:t,onExitComplete:r}=this.node.presenceContext,{isPresent:n}=this.node.prevPresenceContext||{};if(!this.node.animationState||t===n)return;const s=this.node.animationState.setActive("exit",!t);r&&!t&&s.then(()=>{r(this.id)})}mount(){const{register:t,onExitComplete:r}=this.node.presenceContext||{};r&&r(this.id),t&&(this.unmount=t(this.id))}unmount(){}}const kle={animation:{Feature:wle},exit:{Feature:Ale}};function fm(e,t,r,n={passive:!0}){return e.addEventListener(t,r,n),()=>e.removeEventListener(t,r)}function Fm(e){return{point:{x:e.pageX,y:e.pageY}}}const Sle=e=>t=>Yk(t)&&e(t,Fm(t));function Df(e,t,r,n){return fm(e,t,Sle(r),n)}const P5=1e-4,Ele=1-P5,Ple=1+P5,C5=.01,Cle=0-C5,Rle=0+C5;function _s(e){return e.max-e.min}function Tle(e,t,r){return Math.abs(e-t)<=r}function xC(e,t,r,n=.5){e.origin=n,e.originPoint=aa(t.min,t.max,e.origin),e.scale=_s(r)/_s(t),e.translate=aa(r.min,r.max,e.origin)-e.originPoint,(e.scale>=Ele&&e.scale<=Ple||isNaN(e.scale))&&(e.scale=1),(e.translate>=Cle&&e.translate<=Rle||isNaN(e.translate))&&(e.translate=0)}function Of(e,t,r,n){xC(e.x,t.x,r.x,n?n.originX:void 0),xC(e.y,t.y,r.y,n?n.originY:void 0)}function AC(e,t,r){e.min=r.min+t.min,e.max=e.min+_s(t)}function jle(e,t,r){AC(e.x,t.x,r.x),AC(e.y,t.y,r.y)}function kC(e,t,r){e.min=t.min-r.min,e.max=e.min+_s(t)}function zf(e,t,r){kC(e.x,t.x,r.x),kC(e.y,t.y,r.y)}function so(e){return[e("x"),e("y")]}const R5=({current:e})=>e?e.ownerDocument.defaultView:null,SC=(e,t)=>Math.abs(e-t);function Ile(e,t){const r=SC(e.x,t.x),n=SC(e.y,t.y);return Math.sqrt(r**2+n**2)}class T5{constructor(t,r,{transformPagePoint:n,contextWindow:s=window,dragSnapToOrigin:o=!1,distanceThreshold:i=3}={}){if(this.startEvent=null,this.lastMoveEvent=null,this.lastMoveEventInfo=null,this.handlers={},this.contextWindow=window,this.updatePoint=()=>{if(!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const m=e_(this.lastMoveEventInfo,this.history),h=this.startEvent!==null,b=Ile(m.offset,{x:0,y:0})>=this.distanceThreshold;if(!h&&!b)return;const{point:g}=m,{timestamp:y}=Ya;this.history.push({...g,timestamp:y});const{onStart:x,onMove:v}=this.handlers;h||(x&&x(this.lastMoveEvent,m),this.startEvent=this.lastMoveEvent),v&&v(this.lastMoveEvent,m)},this.handlePointerMove=(m,h)=>{this.lastMoveEvent=m,this.lastMoveEventInfo=$v(h,this.transformPagePoint),Kn.update(this.updatePoint,!0)},this.handlePointerUp=(m,h)=>{this.end();const{onEnd:b,onSessionEnd:g,resumeAnimation:y}=this.handlers;if(this.dragSnapToOrigin&&y&&y(),!(this.lastMoveEvent&&this.lastMoveEventInfo))return;const x=e_(m.type==="pointercancel"?this.lastMoveEventInfo:$v(h,this.transformPagePoint),this.history);this.startEvent&&b&&b(m,x),g&&g(m,x)},!Yk(t))return;this.dragSnapToOrigin=o,this.handlers=r,this.transformPagePoint=n,this.distanceThreshold=i,this.contextWindow=s||window;const c=Fm(t),u=$v(c,this.transformPagePoint),{point:p}=u,{timestamp:d}=Ya;this.history=[{...p,timestamp:d}];const{onSessionStart:f}=r;f&&f(t,e_(u,this.history)),this.removeListeners=Om(Df(this.contextWindow,"pointermove",this.handlePointerMove),Df(this.contextWindow,"pointerup",this.handlePointerUp),Df(this.contextWindow,"pointercancel",this.handlePointerUp))}updateHandlers(t){this.handlers=t}end(){this.removeListeners&&this.removeListeners(),Xl(this.updatePoint)}}function $v(e,t){return t?{point:t(e.point)}:e}function EC(e,t){return{x:e.x-t.x,y:e.y-t.y}}function e_({point:e},t){return{point:e,delta:EC(e,j5(t)),offset:EC(e,Nle(t)),velocity:Mle(t,.1)}}function Nle(e){return e[0]}function j5(e){return e[e.length-1]}function Mle(e,t){if(e.length<2)return{x:0,y:0};let r=e.length-1,n=null;const s=j5(e);for(;r>=0&&(n=e[r],!(s.timestamp-n.timestamp>Si(t)));)r--;if(!n)return{x:0,y:0};const o=Ei(s.timestamp-n.timestamp);if(o===0)return{x:0,y:0};const i={x:(s.x-n.x)/o,y:(s.y-n.y)/o};return i.x===1/0&&(i.x=0),i.y===1/0&&(i.y=0),i}function Lle(e,{min:t,max:r},n){return t!==void 0&&e<t?e=n?aa(t,e,n.min):Math.max(e,t):r!==void 0&&e>r&&(e=n?aa(r,e,n.max):Math.min(e,r)),e}function PC(e,t,r){return{min:t!==void 0?e.min+t:void 0,max:r!==void 0?e.max+r-(e.max-e.min):void 0}}function Dle(e,{top:t,left:r,bottom:n,right:s}){return{x:PC(e.x,r,s),y:PC(e.y,t,n)}}function CC(e,t){let r=t.min-e.min,n=t.max-e.max;return t.max-t.min<e.max-e.min&&([r,n]=[n,r]),{min:r,max:n}}function Ole(e,t){return{x:CC(e.x,t.x),y:CC(e.y,t.y)}}function zle(e,t){let r=.5;const n=_s(e),s=_s(t);return s>n?r=lm(t.min,t.max-n,e.min):n>s&&(r=lm(e.min,e.max-s,t.min)),ll(0,1,r)}function Ble(e,t){const r={};return t.min!==void 0&&(r.min=t.min-e.min),t.max!==void 0&&(r.max=t.max-e.min),r}const Nw=.35;function Fle(e=Nw){return e===!1?e=0:e===!0&&(e=Nw),{x:RC(e,"left","right"),y:RC(e,"top","bottom")}}function RC(e,t,r){return{min:TC(e,t),max:TC(e,r)}}function TC(e,t){return typeof e=="number"?e:e[t]||0}const Ule=new WeakMap;class qle{constructor(t){this.openDragLock=null,this.isDragging=!1,this.currentDirection=null,this.originPoint={x:0,y:0},this.constraints=!1,this.hasMutatedConstraints=!1,this.elastic=fa(),this.latestPointerEvent=null,this.latestPanInfo=null,this.visualElement=t}start(t,{snapToCursor:r=!1,distanceThreshold:n}={}){const{presenceContext:s}=this.visualElement;if(s&&s.isPresent===!1)return;const o=f=>{const{dragSnapToOrigin:m}=this.getProps();m?this.pauseAnimation():this.stopAnimation(),r&&this.snapToCursor(Fm(f).point)},i=(f,m)=>{const{drag:h,dragPropagation:b,onDragStart:g}=this.getProps();if(h&&!b&&(this.openDragLock&&this.openDragLock(),this.openDragLock=eie(h),!this.openDragLock))return;this.latestPointerEvent=f,this.latestPanInfo=m,this.isDragging=!0,this.currentDirection=null,this.resolveConstraints(),this.visualElement.projection&&(this.visualElement.projection.isAnimationBlocked=!0,this.visualElement.projection.target=void 0),so(x=>{let v=this.getAxisMotionValue(x).get()||0;if(Pi.test(v)){const{projection:A}=this.visualElement;if(A&&A.layout){const _=A.layout.layoutBox[x];_&&(v=_s(_)*(parseFloat(v)/100))}}this.originPoint[x]=v}),g&&Kn.postRender(()=>g(f,m)),jw(this.visualElement,"transform");const{animationState:y}=this.visualElement;y&&y.setActive("whileDrag",!0)},c=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m;const{dragPropagation:h,dragDirectionLock:b,onDirectionLock:g,onDrag:y}=this.getProps();if(!h&&!this.openDragLock)return;const{offset:x}=m;if(b&&this.currentDirection===null){this.currentDirection=Vle(x),this.currentDirection!==null&&g&&g(this.currentDirection);return}this.updateAxis("x",m.point,x),this.updateAxis("y",m.point,x),this.visualElement.render(),y&&y(f,m)},u=(f,m)=>{this.latestPointerEvent=f,this.latestPanInfo=m,this.stop(f,m),this.latestPointerEvent=null,this.latestPanInfo=null},p=()=>so(f=>{var m;return this.getAnimationState(f)==="paused"&&((m=this.getAxisMotionValue(f).animation)==null?void 0:m.play())}),{dragSnapToOrigin:d}=this.getProps();this.panSession=new T5(t,{onSessionStart:o,onStart:i,onMove:c,onSessionEnd:u,resumeAnimation:p},{transformPagePoint:this.visualElement.getTransformPagePoint(),dragSnapToOrigin:d,distanceThreshold:n,contextWindow:R5(this.visualElement)})}stop(t,r){const n=t||this.latestPointerEvent,s=r||this.latestPanInfo,o=this.isDragging;if(this.cancel(),!o||!s||!n)return;const{velocity:i}=s;this.startAnimation(i);const{onDragEnd:c}=this.getProps();c&&Kn.postRender(()=>c(n,s))}cancel(){this.isDragging=!1;const{projection:t,animationState:r}=this.visualElement;t&&(t.isAnimationBlocked=!1),this.panSession&&this.panSession.end(),this.panSession=void 0;const{dragPropagation:n}=this.getProps();!n&&this.openDragLock&&(this.openDragLock(),this.openDragLock=null),r&&r.setActive("whileDrag",!1)}updateAxis(t,r,n){const{drag:s}=this.getProps();if(!n||!Th(t,s,this.currentDirection))return;const o=this.getAxisMotionValue(t);let i=this.originPoint[t]+n[t];this.constraints&&this.constraints[t]&&(i=Lle(i,this.constraints[t],this.elastic[t])),o.set(i)}resolveConstraints(){var o;const{dragConstraints:t,dragElastic:r}=this.getProps(),n=this.visualElement.projection&&!this.visualElement.projection.layout?this.visualElement.projection.measure(!1):(o=this.visualElement.projection)==null?void 0:o.layout,s=this.constraints;t&&gd(t)?this.constraints||(this.constraints=this.resolveRefConstraints()):t&&n?this.constraints=Dle(n.layoutBox,t):this.constraints=!1,this.elastic=Fle(r),s!==this.constraints&&n&&this.constraints&&!this.hasMutatedConstraints&&so(i=>{this.constraints!==!1&&this.getAxisMotionValue(i)&&(this.constraints[i]=Ble(n.layoutBox[i],this.constraints[i]))})}resolveRefConstraints(){const{dragConstraints:t,onMeasureDragConstraints:r}=this.getProps();if(!t||!gd(t))return!1;const n=t.current,{projection:s}=this.visualElement;if(!s||!s.layout)return!1;const o=Wie(n,s.root,this.visualElement.getTransformPagePoint());let i=Ole(s.layout.layoutBox,o);if(r){const c=r(qie(i));this.hasMutatedConstraints=!!c,c&&(i=m5(c))}return i}startAnimation(t){const{drag:r,dragMomentum:n,dragElastic:s,dragTransition:o,dragSnapToOrigin:i,onDragTransitionEnd:c}=this.getProps(),u=this.constraints||{},p=so(d=>{if(!Th(d,r,this.currentDirection))return;let f=u&&u[d]||{};i&&(f={min:0,max:0});const m=s?200:1e6,h=s?40:1e7,b={type:"inertia",velocity:n?t[d]:0,bounceStiffness:m,bounceDamping:h,timeConstant:750,restDelta:1,restSpeed:10,...o,...f};return this.startAxisValueAnimation(d,b)});return Promise.all(p).then(c)}startAxisValueAnimation(t,r){const n=this.getAxisMotionValue(t);return jw(this.visualElement,t),n.start(a1(t,n,0,r,this.visualElement,!1))}stopAnimation(){so(t=>this.getAxisMotionValue(t).stop())}pauseAnimation(){so(t=>{var r;return(r=this.getAxisMotionValue(t).animation)==null?void 0:r.pause()})}getAnimationState(t){var r;return(r=this.getAxisMotionValue(t).animation)==null?void 0:r.state}getAxisMotionValue(t){const r=`_drag${t.toUpperCase()}`,n=this.visualElement.getProps(),s=n[r];return s||this.visualElement.getValue(t,(n.initial?n.initial[t]:void 0)||0)}snapToCursor(t){so(r=>{const{drag:n}=this.getProps();if(!Th(r,n,this.currentDirection))return;const{projection:s}=this.visualElement,o=this.getAxisMotionValue(r);if(s&&s.layout){const{min:i,max:c}=s.layout.layoutBox[r];o.set(t[r]-aa(i,c,.5))}})}scalePositionWithinConstraints(){if(!this.visualElement.current)return;const{drag:t,dragConstraints:r}=this.getProps(),{projection:n}=this.visualElement;if(!gd(r)||!n||!this.constraints)return;this.stopAnimation();const s={x:0,y:0};so(i=>{const c=this.getAxisMotionValue(i);if(c&&this.constraints!==!1){const u=c.get();s[i]=zle({min:u,max:u},this.constraints[i])}});const{transformTemplate:o}=this.visualElement.getProps();this.visualElement.current.style.transform=o?o({},""):"none",n.root&&n.root.updateScroll(),n.updateLayout(),this.resolveConstraints(),so(i=>{if(!Th(i,t,null))return;const c=this.getAxisMotionValue(i),{min:u,max:p}=this.constraints[i];c.set(aa(u,p,s[i]))})}addListeners(){if(!this.visualElement.current)return;Ule.set(this.visualElement,this);const t=this.visualElement.current,r=Df(t,"pointerdown",u=>{const{drag:p,dragListener:d=!0}=this.getProps();p&&d&&this.start(u)}),n=()=>{const{dragConstraints:u}=this.getProps();gd(u)&&u.current&&(this.constraints=this.resolveRefConstraints())},{projection:s}=this.visualElement,o=s.addEventListener("measure",n);s&&!s.layout&&(s.root&&s.root.updateScroll(),s.updateLayout()),Kn.read(n);const i=fm(window,"resize",()=>this.scalePositionWithinConstraints()),c=s.addEventListener("didUpdate",({delta:u,hasLayoutChanged:p})=>{this.isDragging&&p&&(so(d=>{const f=this.getAxisMotionValue(d);f&&(this.originPoint[d]+=u[d].translate,f.set(f.get()+u[d].translate))}),this.visualElement.render())});return()=>{i(),r(),o(),c&&c()}}getProps(){const t=this.visualElement.getProps(),{drag:r=!1,dragDirectionLock:n=!1,dragPropagation:s=!1,dragConstraints:o=!1,dragElastic:i=Nw,dragMomentum:c=!0}=t;return{...t,drag:r,dragDirectionLock:n,dragPropagation:s,dragConstraints:o,dragElastic:i,dragMomentum:c}}}function Th(e,t,r){return(t===!0||t===e)&&(r===null||r===e)}function Vle(e,t=10){let r=null;return Math.abs(e.y)>t?r="y":Math.abs(e.x)>t&&(r="x"),r}class Hle extends oc{constructor(t){super(t),this.removeGroupControls=ho,this.removeListeners=ho,this.controls=new qle(t)}mount(){const{dragControls:t}=this.node.getProps();t&&(this.removeGroupControls=t.subscribe(this.controls)),this.removeListeners=this.controls.addListeners()||ho}unmount(){this.removeGroupControls(),this.removeListeners()}}const jC=e=>(t,r)=>{e&&Kn.postRender(()=>e(t,r))};class Wle extends oc{constructor(){super(...arguments),this.removePointerDownListener=ho}onPointerDown(t){this.session=new T5(t,this.createPanHandlers(),{transformPagePoint:this.node.getTransformPagePoint(),contextWindow:R5(this.node)})}createPanHandlers(){const{onPanSessionStart:t,onPanStart:r,onPan:n,onPanEnd:s}=this.node.getProps();return{onSessionStart:jC(t),onStart:jC(r),onMove:n,onEnd:(o,i)=>{delete this.session,s&&Kn.postRender(()=>s(o,i))}}}mount(){this.removePointerDownListener=Df(this.node.current,"pointerdown",t=>this.onPointerDown(t))}update(){this.session&&this.session.updateHandlers(this.createPanHandlers())}unmount(){this.removePointerDownListener(),this.session&&this.session.end()}}const Mg={hasAnimatedSinceResize:!0,hasEverUpdated:!1};function IC(e,t){return t.max===t.min?0:e/(t.max-t.min)*100}const Hp={correct:(e,t)=>{if(!t.target)return e;if(typeof e=="string")if(Vr.test(e))e=parseFloat(e);else return e;const r=IC(e,t.target.x),n=IC(e,t.target.y);return`${r}% ${n}%`}},Gle={correct:(e,{treeScale:t,projectionDelta:r})=>{const n=e,s=Yl.parse(e);if(s.length>5)return n;const o=Yl.createTransformer(e),i=typeof s[0]!="number"?1:0,c=r.x.scale*t.x,u=r.y.scale*t.y;s[0+i]/=c,s[1+i]/=u;const p=aa(c,u,.5);return typeof s[2+i]=="number"&&(s[2+i]/=p),typeof s[3+i]=="number"&&(s[3+i]/=p),o(s)}};let t_=!1;class Xle extends l.Component{componentDidMount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n,layoutId:s}=this.props,{projection:o}=t;gie(Yle),o&&(r.group&&r.group.add(o),n&&n.register&&s&&n.register(o),t_&&o.root.didUpdate(),o.addEventListener("animationComplete",()=>{this.safeToRemove()}),o.setOptions({...o.options,onExitComplete:()=>this.safeToRemove()})),Mg.hasEverUpdated=!0}getSnapshotBeforeUpdate(t){const{layoutDependency:r,visualElement:n,drag:s,isPresent:o}=this.props,{projection:i}=n;return i&&(i.isPresent=o,t_=!0,s||t.layoutDependency!==r||r===void 0||t.isPresent!==o?i.willUpdate():this.safeToRemove(),t.isPresent!==o&&(o?i.promote():i.relegate()||Kn.postRender(()=>{const c=i.getStack();(!c||!c.members.length)&&this.safeToRemove()}))),null}componentDidUpdate(){const{projection:t}=this.props.visualElement;t&&(t.root.didUpdate(),Xk.postRender(()=>{!t.currentAnimation&&t.isLead()&&this.safeToRemove()}))}componentWillUnmount(){const{visualElement:t,layoutGroup:r,switchLayoutGroup:n}=this.props,{projection:s}=t;t_=!0,s&&(s.scheduleCheckAfterUnmount(),r&&r.group&&r.group.remove(s),n&&n.deregister&&n.deregister(s))}safeToRemove(){const{safeToRemove:t}=this.props;t&&t()}render(){return null}}function I5(e){const[t,r]=cie(),n=l.useContext(uD);return a.jsx(Xle,{...e,layoutGroup:n,switchLayoutGroup:l.useContext(p5),isPresent:t,safeToRemove:r})}const Yle={borderRadius:{...Hp,applyTo:["borderTopLeftRadius","borderTopRightRadius","borderBottomLeftRadius","borderBottomRightRadius"]},borderTopLeftRadius:Hp,borderTopRightRadius:Hp,borderBottomLeftRadius:Hp,borderBottomRightRadius:Hp,boxShadow:Gle};function Zle(e,t,r){const n=ds(e)?e:sp(e);return n.start(a1("",n,t,r)),n.animation}const Kle=(e,t)=>e.depth-t.depth;class Qle{constructor(){this.children=[],this.isDirty=!1}add(t){Ck(this.children,t),this.isDirty=!0}remove(t){Rk(this.children,t),this.isDirty=!0}forEach(t){this.isDirty&&this.children.sort(Kle),this.isDirty=!1,this.children.forEach(t)}}function Jle(e,t){const r=Ns.now(),n=({timestamp:s})=>{const o=s-r;o>=t&&(Xl(n),e(o-t))};return Kn.setup(n,!0),()=>Xl(n)}const N5=["TopLeft","TopRight","BottomLeft","BottomRight"],$le=N5.length,NC=e=>typeof e=="string"?parseFloat(e):e,MC=e=>typeof e=="number"||Vr.test(e);function ece(e,t,r,n,s,o){s?(e.opacity=aa(0,r.opacity??1,tce(n)),e.opacityExit=aa(t.opacity??1,0,rce(n))):o&&(e.opacity=aa(t.opacity??1,r.opacity??1,n));for(let i=0;i<$le;i++){const c=`border${N5[i]}Radius`;let u=LC(t,c),p=LC(r,c);if(u===void 0&&p===void 0)continue;u||(u=0),p||(p=0),u===0||p===0||MC(u)===MC(p)?(e[c]=Math.max(aa(NC(u),NC(p),n),0),(Pi.test(p)||Pi.test(u))&&(e[c]+="%")):e[c]=p}(t.rotate||r.rotate)&&(e.rotate=aa(t.rotate||0,r.rotate||0,n))}function LC(e,t){return e[t]!==void 0?e[t]:e.borderRadius}const tce=M5(0,.5,wD),rce=M5(.5,.95,ho);function M5(e,t,r){return n=>n<e?0:n>t?1:r(lm(e,t,n))}function DC(e,t){e.min=t.min,e.max=t.max}function no(e,t){DC(e.x,t.x),DC(e.y,t.y)}function OC(e,t){e.translate=t.translate,e.scale=t.scale,e.originPoint=t.originPoint,e.origin=t.origin}function zC(e,t,r,n,s){return e-=t,e=Ry(e,1/r,n),s!==void 0&&(e=Ry(e,1/s,n)),e}function nce(e,t=0,r=1,n=.5,s,o=e,i=e){if(Pi.test(t)&&(t=parseFloat(t),t=aa(i.min,i.max,t/100)-i.min),typeof t!="number")return;let c=aa(o.min,o.max,n);e===o&&(c-=t),e.min=zC(e.min,t,r,c,s),e.max=zC(e.max,t,r,c,s)}function BC(e,t,[r,n,s],o,i){nce(e,t[r],t[n],t[s],t.scale,o,i)}const ace=["x","scaleX","originX"],sce=["y","scaleY","originY"];function FC(e,t,r,n){BC(e.x,t,ace,r?r.x:void 0,n?n.x:void 0),BC(e.y,t,sce,r?r.y:void 0,n?n.y:void 0)}function UC(e){return e.translate===0&&e.scale===1}function L5(e){return UC(e.x)&&UC(e.y)}function qC(e,t){return e.min===t.min&&e.max===t.max}function oce(e,t){return qC(e.x,t.x)&&qC(e.y,t.y)}function VC(e,t){return Math.round(e.min)===Math.round(t.min)&&Math.round(e.max)===Math.round(t.max)}function D5(e,t){return VC(e.x,t.x)&&VC(e.y,t.y)}function HC(e){return _s(e.x)/_s(e.y)}function WC(e,t){return e.translate===t.translate&&e.scale===t.scale&&e.originPoint===t.originPoint}class ice{constructor(){this.members=[]}add(t){Ck(this.members,t),t.scheduleRender()}remove(t){if(Rk(this.members,t),t===this.prevLead&&(this.prevLead=void 0),t===this.lead){const r=this.members[this.members.length-1];r&&this.promote(r)}}relegate(t){const r=this.members.findIndex(s=>t===s);if(r===0)return!1;let n;for(let s=r;s>=0;s--){const o=this.members[s];if(o.isPresent!==!1){n=o;break}}return n?(this.promote(n),!0):!1}promote(t,r){const n=this.lead;if(t!==n&&(this.prevLead=n,this.lead=t,t.show(),n)){n.instance&&n.scheduleRender(),t.scheduleRender(),t.resumeFrom=n,r&&(t.resumeFrom.preserveOpacity=!0),n.snapshot&&(t.snapshot=n.snapshot,t.snapshot.latestValues=n.animationValues||n.latestValues),t.root&&t.root.isUpdating&&(t.isLayoutDirty=!0);const{crossfade:s}=t.options;s===!1&&n.hide()}}exitAnimationComplete(){this.members.forEach(t=>{const{options:r,resumingFrom:n}=t;r.onExitComplete&&r.onExitComplete(),n&&n.options.onExitComplete&&n.options.onExitComplete()})}scheduleRender(){this.members.forEach(t=>{t.instance&&t.scheduleRender(!1)})}removeLeadSnapshot(){this.lead&&this.lead.snapshot&&(this.lead.snapshot=void 0)}}function lce(e,t,r){let n="";const s=e.x.translate/t.x,o=e.y.translate/t.y,i=(r==null?void 0:r.z)||0;if((s||o||i)&&(n=`translate3d(${s}px, ${o}px, ${i}px) `),(t.x!==1||t.y!==1)&&(n+=`scale(${1/t.x}, ${1/t.y}) `),r){const{transformPerspective:p,rotate:d,rotateX:f,rotateY:m,skewX:h,skewY:b}=r;p&&(n=`perspective(${p}px) ${n}`),d&&(n+=`rotate(${d}deg) `),f&&(n+=`rotateX(${f}deg) `),m&&(n+=`rotateY(${m}deg) `),h&&(n+=`skewX(${h}deg) `),b&&(n+=`skewY(${b}deg) `)}const c=e.x.scale*t.x,u=e.y.scale*t.y;return(c!==1||u!==1)&&(n+=`scale(${c}, ${u})`),n||"none"}const r_=["","X","Y","Z"],cce=1e3;let uce=0;function n_(e,t,r,n){const{latestValues:s}=t;s[e]&&(r[e]=s[e],t.setStaticValue(e,0),n&&(n[e]=0))}function O5(e){if(e.hasCheckedOptimisedAppear=!0,e.root===e)return;const{visualElement:t}=e.options;if(!t)return;const r=x5(t);if(window.MotionHasOptimisedAnimation(r,"transform")){const{layout:s,layoutId:o}=e.options;window.MotionCancelOptimisedAnimation(r,"transform",Kn,!(s||o))}const{parent:n}=e;n&&!n.hasCheckedOptimisedAppear&&O5(n)}function z5({attachResizeListener:e,defaultParent:t,measureScroll:r,checkIsScrollRoot:n,resetTransform:s}){return class{constructor(i={},c=t==null?void 0:t()){this.id=uce++,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(fce),this.nodes.forEach(yce),this.nodes.forEach(bce),this.nodes.forEach(mce)},this.resolvedRelativeTargetAt=0,this.hasProjected=!1,this.isVisible=!0,this.animationProgress=0,this.sharedNodes=new Map,this.latestValues=i,this.root=c?c.root||c:this,this.path=c?[...c.path,c]:[],this.parent=c,this.depth=c?c.depth+1:0;for(let u=0;u<this.path.length;u++)this.path[u].shouldResetTransform=!0;this.root===this&&(this.nodes=new Qle)}addEventListener(i,c){return this.eventHandlers.has(i)||this.eventHandlers.set(i,new Ik),this.eventHandlers.get(i).add(c)}notifyListeners(i,...c){const u=this.eventHandlers.get(i);u&&u.notify(...c)}hasListeners(i){return this.eventHandlers.has(i)}mount(i){if(this.instance)return;this.isSVG=$D(i)&&!oie(i),this.instance=i;const{layoutId:c,layout:u,visualElement:p}=this.options;if(p&&!p.current&&p.mount(i),this.root.nodes.add(this),this.parent&&this.parent.children.add(this),this.root.hasTreeAnimated&&(u||c)&&(this.isLayoutDirty=!0),e){let d,f=0;const m=()=>this.root.updateBlockedByResize=!1;Kn.read(()=>{f=window.innerWidth}),e(i,()=>{const h=window.innerWidth;h!==f&&(f=h,this.root.updateBlockedByResize=!0,d&&d(),d=Jle(m,250),Mg.hasAnimatedSinceResize&&(Mg.hasAnimatedSinceResize=!1,this.nodes.forEach(YC)))})}c&&this.root.registerSharedNode(c,this),this.options.animate!==!1&&p&&(c||u)&&this.addEventListener("didUpdate",({delta:d,hasLayoutChanged:f,hasRelativeLayoutChanged:m,layout:h})=>{if(this.isTreeAnimationBlocked()){this.target=void 0,this.relativeTarget=void 0;return}const b=this.options.transition||p.getDefaultTransition()||Ace,{onLayoutAnimationStart:g,onLayoutAnimationComplete:y}=p.getProps(),x=!this.targetLayout||!D5(this.targetLayout,h),v=!f&&m;if(this.options.layoutRoot||this.resumeFrom||v||f&&(x||!this.currentAnimation)){this.resumeFrom&&(this.resumingFrom=this.resumeFrom,this.resumingFrom.resumingFrom=void 0);const A={...Wk(b,"layout"),onPlay:g,onComplete:y};(p.shouldReduceMotion||this.options.layoutRoot)&&(A.delay=0,A.type=!1),this.startAnimation(A),this.setAnimationOrigin(d,v)}else f||YC(this),this.isLead()&&this.options.onExitComplete&&this.options.onExitComplete();this.targetLayout=h})}unmount(){this.options.layoutId&&this.willUpdate(),this.root.nodes.remove(this);const i=this.getStack();i&&i.remove(this),this.parent&&this.parent.children.delete(this),this.instance=void 0,this.eventHandlers.clear(),Xl(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(vce),this.animationId++)}getTransformTemplate(){const{visualElement:i}=this.options;return i&&i.getProps().transformTemplate}willUpdate(i=!0){if(this.root.hasTreeAnimated=!0,this.root.isUpdateBlocked()){this.options.onExitComplete&&this.options.onExitComplete();return}if(window.MotionCancelOptimisedAnimation&&!this.hasCheckedOptimisedAppear&&O5(this),!this.root.isUpdating&&this.root.startUpdate(),this.isLayoutDirty)return;this.isLayoutDirty=!0;for(let d=0;d<this.path.length;d++){const f=this.path[d];f.shouldResetTransform=!0,f.updateScroll("snapshot"),f.options.layoutRoot&&f.willUpdate(!1)}const{layoutId:c,layout:u}=this.options;if(c===void 0&&!u)return;const p=this.getTransformTemplate();this.prevTransformTemplateValue=p?p(this.latestValues,""):void 0,this.updateSnapshot(),i&&this.notifyListeners("willUpdate")}update(){if(this.updateScheduled=!1,this.isUpdateBlocked()){this.unblockUpdate(),this.clearAllSnapshots(),this.nodes.forEach(GC);return}if(this.animationId<=this.animationCommitId){this.nodes.forEach(XC);return}this.animationCommitId=this.animationId,this.isUpdating?(this.isUpdating=!1,this.nodes.forEach(gce),this.nodes.forEach(dce),this.nodes.forEach(pce)):this.nodes.forEach(XC),this.clearAllSnapshots();const c=Ns.now();Ya.delta=ll(0,1e3/60,c-Ya.timestamp),Ya.timestamp=c,Ya.isProcessing=!0,Wv.update.process(Ya),Wv.preRender.process(Ya),Wv.render.process(Ya),Ya.isProcessing=!1}didUpdate(){this.updateScheduled||(this.updateScheduled=!0,Xk.read(this.scheduleUpdate))}clearAllSnapshots(){this.nodes.forEach(hce),this.sharedNodes.forEach(_ce)}scheduleUpdateProjection(){this.projectionUpdateScheduled||(this.projectionUpdateScheduled=!0,Kn.preRender(this.updateProjection,!1,!0))}scheduleCheckAfterUnmount(){Kn.postRender(()=>{this.isLayoutDirty?this.root.didUpdate():this.root.checkUpdateFailed()})}updateSnapshot(){this.snapshot||!this.instance||(this.snapshot=this.measure(),this.snapshot&&!_s(this.snapshot.measuredBox.x)&&!_s(this.snapshot.measuredBox.y)&&(this.snapshot=void 0))}updateLayout(){if(!this.instance||(this.updateScroll(),!(this.options.alwaysMeasureLayout&&this.isLead())&&!this.isLayoutDirty))return;if(this.resumeFrom&&!this.resumeFrom.instance)for(let u=0;u<this.path.length;u++)this.path[u].updateScroll();const i=this.layout;this.layout=this.measure(!1),this.layoutCorrected=fa(),this.isLayoutDirty=!1,this.projectionDelta=void 0,this.notifyListeners("measure",this.layout.layoutBox);const{visualElement:c}=this.options;c&&c.notify("LayoutMeasure",this.layout.layoutBox,i?i.layoutBox:void 0)}updateScroll(i="measure"){let c=!!(this.options.layoutScroll&&this.instance);if(this.scroll&&this.scroll.animationId===this.root.animationId&&this.scroll.phase===i&&(c=!1),c&&this.instance){const u=n(this.instance);this.scroll={animationId:this.root.animationId,phase:i,isRoot:u,offset:r(this.instance),wasRoot:this.scroll?this.scroll.isRoot:u}}}resetTransform(){if(!s)return;const i=this.isLayoutDirty||this.shouldResetTransform||this.options.alwaysMeasureLayout,c=this.projectionDelta&&!L5(this.projectionDelta),u=this.getTransformTemplate(),p=u?u(this.latestValues,""):void 0,d=p!==this.prevTransformTemplateValue;i&&this.instance&&(c||Sc(this.latestValues)||d)&&(s(this.instance,p),this.shouldResetTransform=!1,this.scheduleRender())}measure(i=!0){const c=this.measurePageBox();let u=this.removeElementScroll(c);return i&&(u=this.removeTransform(u)),kce(u),{animationId:this.root.animationId,measuredBox:c,layoutBox:u,latestValues:{},source:this.id}}measurePageBox(){var p;const{visualElement:i}=this.options;if(!i)return fa();const c=i.measureViewportBox();if(!(((p=this.scroll)==null?void 0:p.wasRoot)||this.path.some(Sce))){const{scroll:d}=this.root;d&&(yd(c.x,d.offset.x),yd(c.y,d.offset.y))}return c}removeElementScroll(i){var u;const c=fa();if(no(c,i),(u=this.scroll)!=null&&u.wasRoot)return c;for(let p=0;p<this.path.length;p++){const d=this.path[p],{scroll:f,options:m}=d;d!==this.root&&f&&m.layoutScroll&&(f.wasRoot&&no(c,i),yd(c.x,f.offset.x),yd(c.y,f.offset.y))}return c}applyTransform(i,c=!1){const u=fa();no(u,i);for(let p=0;p<this.path.length;p++){const d=this.path[p];!c&&d.options.layoutScroll&&d.scroll&&d!==d.root&&bd(u,{x:-d.scroll.offset.x,y:-d.scroll.offset.y}),Sc(d.latestValues)&&bd(u,d.latestValues)}return Sc(this.latestValues)&&bd(u,this.latestValues),u}removeTransform(i){const c=fa();no(c,i);for(let u=0;u<this.path.length;u++){const p=this.path[u];if(!p.instance||!Sc(p.latestValues))continue;Cw(p.latestValues)&&p.updateSnapshot();const d=fa(),f=p.measurePageBox();no(d,f),FC(c,p.latestValues,p.snapshot?p.snapshot.layoutBox:void 0,d)}return Sc(this.latestValues)&&FC(c,this.latestValues),c}setTargetDelta(i){this.targetDelta=i,this.root.scheduleUpdateProjection(),this.isProjectionDirty=!0}setOptions(i){this.options={...this.options,...i,crossfade:i.crossfade!==void 0?i.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!==Ya.timestamp&&this.relativeParent.resolveTargetDelta(!0)}resolveTargetDelta(i=!1){var m;const c=this.getLead();this.isProjectionDirty||(this.isProjectionDirty=c.isProjectionDirty),this.isTransformDirty||(this.isTransformDirty=c.isTransformDirty),this.isSharedProjectionDirty||(this.isSharedProjectionDirty=c.isSharedProjectionDirty);const u=!!this.resumingFrom||this!==c;if(!(i||u&&this.isSharedProjectionDirty||this.isProjectionDirty||(m=this.parent)!=null&&m.isProjectionDirty||this.attemptToResolveRelativeTarget||this.root.updateBlockedByResize))return;const{layout:d,layoutId:f}=this.options;if(!(!this.layout||!(d||f))){if(this.resolvedRelativeTargetAt=Ya.timestamp,!this.targetDelta&&!this.relativeTarget){const h=this.getClosestProjectingParent();h&&h.layout&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=fa(),this.relativeTargetOrigin=fa(),zf(this.relativeTargetOrigin,this.layout.layoutBox,h.layout.layoutBox),no(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}if(!(!this.relativeTarget&&!this.targetDelta)&&(this.target||(this.target=fa(),this.targetWithTransforms=fa()),this.relativeTarget&&this.relativeTargetOrigin&&this.relativeParent&&this.relativeParent.target?(this.forceRelativeParentToResolveTarget(),jle(this.target,this.relativeTarget,this.relativeParent.target)):this.targetDelta?(this.resumingFrom?this.target=this.applyTransform(this.layout.layoutBox):no(this.target,this.layout.layoutBox),g5(this.target,this.targetDelta)):no(this.target,this.layout.layoutBox),this.attemptToResolveRelativeTarget)){this.attemptToResolveRelativeTarget=!1;const h=this.getClosestProjectingParent();h&&!!h.resumingFrom==!!this.resumingFrom&&!h.options.layoutScroll&&h.target&&this.animationProgress!==1?(this.relativeParent=h,this.forceRelativeParentToResolveTarget(),this.relativeTarget=fa(),this.relativeTargetOrigin=fa(),zf(this.relativeTargetOrigin,this.target,h.target),no(this.relativeTarget,this.relativeTargetOrigin)):this.relativeParent=this.relativeTarget=void 0}}}getClosestProjectingParent(){if(!(!this.parent||Cw(this.parent.latestValues)||h5(this.parent.latestValues)))return this.parent.isProjecting()?this.parent:this.parent.getClosestProjectingParent()}isProjecting(){return!!((this.relativeTarget||this.targetDelta||this.options.layoutRoot)&&this.layout)}calcProjection(){var b;const i=this.getLead(),c=!!this.resumingFrom||this!==i;let u=!0;if((this.isProjectionDirty||(b=this.parent)!=null&&b.isProjectionDirty)&&(u=!1),c&&(this.isSharedProjectionDirty||this.isTransformDirty)&&(u=!1),this.resolvedRelativeTargetAt===Ya.timestamp&&(u=!1),u)return;const{layout:p,layoutId:d}=this.options;if(this.isTreeAnimating=!!(this.parent&&this.parent.isTreeAnimating||this.currentAnimation||this.pendingAnimation),this.isTreeAnimating||(this.targetDelta=this.relativeTarget=void 0),!this.layout||!(p||d))return;no(this.layoutCorrected,this.layout.layoutBox);const f=this.treeScale.x,m=this.treeScale.y;Hie(this.layoutCorrected,this.treeScale,this.path,c),i.layout&&!i.target&&(this.treeScale.x!==1||this.treeScale.y!==1)&&(i.target=i.layout.layoutBox,i.targetWithTransforms=fa());const{target:h}=i;if(!h){this.prevProjectionDelta&&(this.createProjectionDeltas(),this.scheduleRender());return}!this.projectionDelta||!this.prevProjectionDelta?this.createProjectionDeltas():(OC(this.prevProjectionDelta.x,this.projectionDelta.x),OC(this.prevProjectionDelta.y,this.projectionDelta.y)),Of(this.projectionDelta,this.layoutCorrected,h,this.latestValues),(this.treeScale.x!==f||this.treeScale.y!==m||!WC(this.projectionDelta.x,this.prevProjectionDelta.x)||!WC(this.projectionDelta.y,this.prevProjectionDelta.y))&&(this.hasProjected=!0,this.scheduleRender(),this.notifyListeners("projectionUpdate",h))}hide(){this.isVisible=!1}show(){this.isVisible=!0}scheduleRender(i=!0){var c;if((c=this.options.visualElement)==null||c.scheduleRender(),i){const u=this.getStack();u&&u.scheduleRender()}this.resumingFrom&&!this.resumingFrom.instance&&(this.resumingFrom=void 0)}createProjectionDeltas(){this.prevProjectionDelta=vd(),this.projectionDelta=vd(),this.projectionDeltaWithTransform=vd()}setAnimationOrigin(i,c=!1){const u=this.snapshot,p=u?u.latestValues:{},d={...this.latestValues},f=vd();(!this.relativeParent||!this.relativeParent.options.layoutRoot)&&(this.relativeTarget=this.relativeTargetOrigin=void 0),this.attemptToResolveRelativeTarget=!c;const m=fa(),h=u?u.source:void 0,b=this.layout?this.layout.source:void 0,g=h!==b,y=this.getStack(),x=!y||y.members.length<=1,v=!!(g&&!x&&this.options.crossfade===!0&&!this.path.some(xce));this.animationProgress=0;let A;this.mixTargetDelta=_=>{const w=_/1e3;ZC(f.x,i.x,w),ZC(f.y,i.y,w),this.setTargetDelta(f),this.relativeTarget&&this.relativeTargetOrigin&&this.layout&&this.relativeParent&&this.relativeParent.layout&&(zf(m,this.layout.layoutBox,this.relativeParent.layout.layoutBox),wce(this.relativeTarget,this.relativeTargetOrigin,m,w),A&&oce(this.relativeTarget,A)&&(this.isProjectionDirty=!1),A||(A=fa()),no(A,this.relativeTarget)),g&&(this.animationValues=d,ece(d,p,this.latestValues,w,v,x)),this.root.scheduleUpdateProjection(),this.scheduleRender(),this.animationProgress=w},this.mixTargetDelta(this.options.layoutRoot?1e3:0)}startAnimation(i){var c,u,p;this.notifyListeners("animationStart"),(c=this.currentAnimation)==null||c.stop(),(p=(u=this.resumingFrom)==null?void 0:u.currentAnimation)==null||p.stop(),this.pendingAnimation&&(Xl(this.pendingAnimation),this.pendingAnimation=void 0),this.pendingAnimation=Kn.update(()=>{Mg.hasAnimatedSinceResize=!0,this.motionValue||(this.motionValue=sp(0)),this.currentAnimation=Zle(this.motionValue,[0,1e3],{...i,velocity:0,isSync:!0,onUpdate:d=>{this.mixTargetDelta(d),i.onUpdate&&i.onUpdate(d)},onStop:()=>{},onComplete:()=>{i.onComplete&&i.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 i=this.getStack();i&&i.exitAnimationComplete(),this.resumingFrom=this.currentAnimation=this.animationValues=void 0,this.notifyListeners("animationComplete")}finishAnimation(){this.currentAnimation&&(this.mixTargetDelta&&this.mixTargetDelta(cce),this.currentAnimation.stop()),this.completeAnimation()}applyTransformsToTarget(){const i=this.getLead();let{targetWithTransforms:c,target:u,layout:p,latestValues:d}=i;if(!(!c||!u||!p)){if(this!==i&&this.layout&&p&&B5(this.options.animationType,this.layout.layoutBox,p.layoutBox)){u=this.target||fa();const f=_s(this.layout.layoutBox.x);u.x.min=i.target.x.min,u.x.max=u.x.min+f;const m=_s(this.layout.layoutBox.y);u.y.min=i.target.y.min,u.y.max=u.y.min+m}no(c,u),bd(c,d),Of(this.projectionDeltaWithTransform,this.layoutCorrected,c,d)}}registerSharedNode(i,c){this.sharedNodes.has(i)||this.sharedNodes.set(i,new ice),this.sharedNodes.get(i).add(c);const p=c.options.initialPromotionConfig;c.promote({transition:p?p.transition:void 0,preserveFollowOpacity:p&&p.shouldPreserveFollowOpacity?p.shouldPreserveFollowOpacity(c):void 0})}isLead(){const i=this.getStack();return i?i.lead===this:!0}getLead(){var c;const{layoutId:i}=this.options;return i?((c=this.getStack())==null?void 0:c.lead)||this:this}getPrevLead(){var c;const{layoutId:i}=this.options;return i?(c=this.getStack())==null?void 0:c.prevLead:void 0}getStack(){const{layoutId:i}=this.options;if(i)return this.root.sharedNodes.get(i)}promote({needsReset:i,transition:c,preserveFollowOpacity:u}={}){const p=this.getStack();p&&p.promote(this,u),i&&(this.projectionDelta=void 0,this.needsReset=!0),c&&this.setOptions({transition:c})}relegate(){const i=this.getStack();return i?i.relegate(this):!1}resetSkewAndRotation(){const{visualElement:i}=this.options;if(!i)return;let c=!1;const{latestValues:u}=i;if((u.z||u.rotate||u.rotateX||u.rotateY||u.rotateZ||u.skewX||u.skewY)&&(c=!0),!c)return;const p={};u.z&&n_("z",i,p,this.animationValues);for(let d=0;d<r_.length;d++)n_(`rotate${r_[d]}`,i,p,this.animationValues),n_(`skew${r_[d]}`,i,p,this.animationValues);i.render();for(const d in p)i.setStaticValue(d,p[d]),this.animationValues&&(this.animationValues[d]=p[d]);i.scheduleRender()}applyProjectionStyles(i,c){if(!this.instance||this.isSVG)return;if(!this.isVisible){i.visibility="hidden";return}const u=this.getTransformTemplate();if(this.needsReset){this.needsReset=!1,i.visibility="",i.opacity="",i.pointerEvents=Ng(c==null?void 0:c.pointerEvents)||"",i.transform=u?u(this.latestValues,""):"none";return}const p=this.getLead();if(!this.projectionDelta||!this.layout||!p.target){this.options.layoutId&&(i.opacity=this.latestValues.opacity!==void 0?this.latestValues.opacity:1,i.pointerEvents=Ng(c==null?void 0:c.pointerEvents)||""),this.hasProjected&&!Sc(this.latestValues)&&(i.transform=u?u({},""):"none",this.hasProjected=!1);return}i.visibility="";const d=p.animationValues||p.latestValues;this.applyTransformsToTarget();let f=lce(this.projectionDeltaWithTransform,this.treeScale,d);u&&(f=u(d,f)),i.transform=f;const{x:m,y:h}=this.projectionDelta;i.transformOrigin=`${m.origin*100}% ${h.origin*100}% 0`,p.animationValues?i.opacity=p===this?d.opacity??this.latestValues.opacity??1:this.preserveOpacity?this.latestValues.opacity:d.opacityExit:i.opacity=p===this?d.opacity!==void 0?d.opacity:"":d.opacityExit!==void 0?d.opacityExit:0;for(const b in pm){if(d[b]===void 0)continue;const{correct:g,applyTo:y,isCSSVariable:x}=pm[b],v=f==="none"?d[b]:g(d[b],p);if(y){const A=y.length;for(let _=0;_<A;_++)i[y[_]]=v}else x?this.options.visualElement.renderState.vars[b]=v:i[b]=v}this.options.layoutId&&(i.pointerEvents=p===this?Ng(c==null?void 0:c.pointerEvents)||"":"none")}clearSnapshot(){this.resumeFrom=this.snapshot=void 0}resetTree(){this.root.nodes.forEach(i=>{var c;return(c=i.currentAnimation)==null?void 0:c.stop()}),this.root.nodes.forEach(GC),this.root.sharedNodes.clear()}}}function dce(e){e.updateLayout()}function pce(e){var r;const t=((r=e.resumeFrom)==null?void 0:r.snapshot)||e.snapshot;if(e.isLead()&&e.layout&&t&&e.hasListeners("didUpdate")){const{layoutBox:n,measuredBox:s}=e.layout,{animationType:o}=e.options,i=t.source!==e.layout.source;o==="size"?so(f=>{const m=i?t.measuredBox[f]:t.layoutBox[f],h=_s(m);m.min=n[f].min,m.max=m.min+h}):B5(o,t.layoutBox,n)&&so(f=>{const m=i?t.measuredBox[f]:t.layoutBox[f],h=_s(n[f]);m.max=m.min+h,e.relativeTarget&&!e.currentAnimation&&(e.isProjectionDirty=!0,e.relativeTarget[f].max=e.relativeTarget[f].min+h)});const c=vd();Of(c,n,t.layoutBox);const u=vd();i?Of(u,e.applyTransform(s,!0),t.measuredBox):Of(u,n,t.layoutBox);const p=!L5(c);let d=!1;if(!e.resumeFrom){const f=e.getClosestProjectingParent();if(f&&!f.resumeFrom){const{snapshot:m,layout:h}=f;if(m&&h){const b=fa();zf(b,t.layoutBox,m.layoutBox);const g=fa();zf(g,n,h.layoutBox),D5(b,g)||(d=!0),f.options.layoutRoot&&(e.relativeTarget=g,e.relativeTargetOrigin=b,e.relativeParent=f)}}}e.notifyListeners("didUpdate",{layout:n,snapshot:t,delta:u,layoutDelta:c,hasLayoutChanged:p,hasRelativeLayoutChanged:d})}else if(e.isLead()){const{onExitComplete:n}=e.options;n&&n()}e.options.transition=void 0}function fce(e){e.parent&&(e.isProjecting()||(e.isProjectionDirty=e.parent.isProjectionDirty),e.isSharedProjectionDirty||(e.isSharedProjectionDirty=!!(e.isProjectionDirty||e.parent.isProjectionDirty||e.parent.isSharedProjectionDirty)),e.isTransformDirty||(e.isTransformDirty=e.parent.isTransformDirty))}function mce(e){e.isProjectionDirty=e.isSharedProjectionDirty=e.isTransformDirty=!1}function hce(e){e.clearSnapshot()}function GC(e){e.clearMeasurements()}function XC(e){e.isLayoutDirty=!1}function gce(e){const{visualElement:t}=e.options;t&&t.getProps().onBeforeLayoutMeasure&&t.notify("BeforeLayoutMeasure"),e.resetTransform()}function YC(e){e.finishAnimation(),e.targetDelta=e.relativeTarget=e.target=void 0,e.isProjectionDirty=!0}function yce(e){e.resolveTargetDelta()}function bce(e){e.calcProjection()}function vce(e){e.resetSkewAndRotation()}function _ce(e){e.removeLeadSnapshot()}function ZC(e,t,r){e.translate=aa(t.translate,0,r),e.scale=aa(t.scale,1,r),e.origin=t.origin,e.originPoint=t.originPoint}function KC(e,t,r,n){e.min=aa(t.min,r.min,n),e.max=aa(t.max,r.max,n)}function wce(e,t,r,n){KC(e.x,t.x,r.x,n),KC(e.y,t.y,r.y,n)}function xce(e){return e.animationValues&&e.animationValues.opacityExit!==void 0}const Ace={duration:.45,ease:[.4,0,.1,1]},QC=e=>typeof navigator<"u"&&navigator.userAgent&&navigator.userAgent.toLowerCase().includes(e),JC=QC("applewebkit/")&&!QC("chrome/")?Math.round:ho;function $C(e){e.min=JC(e.min),e.max=JC(e.max)}function kce(e){$C(e.x),$C(e.y)}function B5(e,t,r){return e==="position"||e==="preserve-aspect"&&!Tle(HC(t),HC(r),.2)}function Sce(e){var t;return e!==e.root&&((t=e.scroll)==null?void 0:t.wasRoot)}const Ece=z5({attachResizeListener:(e,t)=>fm(e,"resize",t),measureScroll:()=>({x:document.documentElement.scrollLeft||document.body.scrollLeft,y:document.documentElement.scrollTop||document.body.scrollTop}),checkIsScrollRoot:()=>!0}),a_={current:void 0},F5=z5({measureScroll:e=>({x:e.scrollLeft,y:e.scrollTop}),defaultParent:()=>{if(!a_.current){const e=new Ece({});e.mount(window),e.setOptions({layoutScroll:!0}),a_.current=e}return a_.current},resetTransform:(e,t)=>{e.style.transform=t!==void 0?t:"none"},checkIsScrollRoot:e=>window.getComputedStyle(e).position==="fixed"}),Pce={pan:{Feature:Wle},drag:{Feature:Hle,ProjectionNode:F5,MeasureLayout:I5}};function eR(e,t,r){const{props:n}=e;e.animationState&&n.whileHover&&e.animationState.setActive("whileHover",r==="Start");const s="onHover"+r,o=n[s];o&&Kn.postRender(()=>o(t,Fm(t)))}class Cce extends oc{mount(){const{current:t}=this.node;t&&(this.unmount=tie(t,(r,n)=>(eR(this.node,n,"Start"),s=>eR(this.node,s,"End"))))}unmount(){}}class Rce extends oc{constructor(){super(...arguments),this.isActive=!1}onFocus(){let t=!1;try{t=this.node.current.matches(":focus-visible")}catch{t=!0}!t||!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=Om(fm(this.node.current,"focus",()=>this.onFocus()),fm(this.node.current,"blur",()=>this.onBlur()))}unmount(){}}function tR(e,t,r){const{props:n}=e;if(e.current instanceof HTMLButtonElement&&e.current.disabled)return;e.animationState&&n.whileTap&&e.animationState.setActive("whileTap",r==="Start");const s="onTap"+(r==="End"?"":r),o=n[s];o&&Kn.postRender(()=>o(t,Fm(t)))}class Tce extends oc{mount(){const{current:t}=this.node;t&&(this.unmount=sie(t,(r,n)=>(tR(this.node,n,"Start"),(s,{success:o})=>tR(this.node,s,o?"End":"Cancel")),{useGlobalTarget:this.node.props.globalTapTarget}))}unmount(){}}const Mw=new WeakMap,s_=new WeakMap,jce=e=>{const t=Mw.get(e.target);t&&t(e)},Ice=e=>{e.forEach(jce)};function Nce({root:e,...t}){const r=e||document;s_.has(r)||s_.set(r,{});const n=s_.get(r),s=JSON.stringify(t);return n[s]||(n[s]=new IntersectionObserver(Ice,{root:e,...t})),n[s]}function Mce(e,t,r){const n=Nce(t);return Mw.set(e,r),n.observe(e),()=>{Mw.delete(e),n.unobserve(e)}}const Lce={some:0,all:1};class Dce extends oc{constructor(){super(...arguments),this.hasEnteredView=!1,this.isInView=!1}startObserver(){this.unmount();const{viewport:t={}}=this.node.getProps(),{root:r,margin:n,amount:s="some",once:o}=t,i={root:r?r.current:void 0,rootMargin:n,threshold:typeof s=="number"?s:Lce[s]},c=u=>{const{isIntersecting:p}=u;if(this.isInView===p||(this.isInView=p,o&&!p&&this.hasEnteredView))return;p&&(this.hasEnteredView=!0),this.node.animationState&&this.node.animationState.setActive("whileInView",p);const{onViewportEnter:d,onViewportLeave:f}=this.node.getProps(),m=p?d:f;m&&m(u)};return Mce(this.node.current,i,c)}mount(){this.startObserver()}update(){if(typeof IntersectionObserver>"u")return;const{props:t,prevProps:r}=this.node;["amount","margin","root"].some(Oce(t,r))&&this.startObserver()}unmount(){}}function Oce({viewport:e={}},{viewport:t={}}={}){return r=>e[r]!==t[r]}const zce={inView:{Feature:Dce},tap:{Feature:Tce},focus:{Feature:Rce},hover:{Feature:Cce}},Bce={layout:{ProjectionNode:F5,MeasureLayout:I5}},Fce={...kle,...zce,...Pce,...Bce},Zs=Uie(Fce,$ie);function Uce(){!n1.current&&b5();const[e]=l.useState(Ty.current);return e}const qce="_panelRoot_cg615_1",Vce="_crapsPlaceTile_cg615_43",Hce="_mobileShow_cg615_64",Wce="_mobileHide_cg615_68",Gce="_spotBtn_cg615_95",Xce="_spotRow_cg615_108",Yce="_actions_cg615_120",Zce="_actionBtn_cg615_124",Kce="_amountBadge_cg615_130",Qce="_badgeMinus_cg615_137",Jce="_crapsStatusBar_cg615_148",$ce="_crapsStatusText_cg615_154",eue="_crapsHighlight_cg615_162",tue="_crapsPlaceRow_cg615_179",rue="_crapsBetTile_cg615_190",nue="_crapsActionsBar_cg615_198",aue="_crapsActionButton_cg615_202",sue="_crapsActionButtonPrimary_cg615_207",oue="_crapsActionButtonSecondary_cg615_208",iue="_crapsMainBets_cg615_214",lue="_disabled_cg615_334",cue="_spotBtnTopRow_cg615_520",uue="_lineWin_cg615_571",due="_lineLose_cg615_576",pue="_linePush_cg615_581",fue="_outcomeBadge_cg615_586",mue="_locked_cg615_600",hue="_amountBadgeDisabled_cg615_628",gue="_lockIcon_cg615_634",yue="_aggBadge_cg615_674",bue="_rollBtn_cg615_890",vue="_rollIcon_cg615_897",_ue="_clear_cg615_923",wue="_errorLive_cg615_940",xue="_tooltip_cg615_948",Aue="_betInfoBtn_cg615_972",kue="_betInfoModalOverlay_cg615_1000",Sue="_betInfoModal_cg615_1000",Eue="_betInfoHeader_cg615_1034",Pue="_betInfoClose_cg615_1050",Cue="_betInfoContent_cg615_1071",Rue="_betInfoItem_cg615_1079",Tue="_shake_cg615_1165",jue="_attnHalo_cg615_1213",Iue="_crapsAtsLabel_cg615_1335",Nue="_crapsIronCrossBtn_cg615_1355",Mue="_crapsMinusBadge_cg615_1470",Lue="_rollHaloActive_cg615_1657",Due="_crapsClearIcon_cg615_1770",Oue="_particle_cg615_1804",zue="_particleContainer_cg615_1810",Bue="_floatingWinAmount_cg615_1860",Fue="_countdownBadge_cg615_1975",Uue="_countdownUrgent_cg615_1998",que="_countdownCritical_cg615_2005",Vue="_chipPickerWrapper_cg615_2329",Hue="_chipPickerToggle_cg615_2334",Wue="_chipPickerToggleOpen_cg615_2377",Gue="_chipPickerChip_cg615_2387",Xue="_chipPickerDropdown_cg615_2391",Yue="_chipPickerOption_cg615_2413",Zue="_chipPickerOptionSelected_cg615_2422",Kue="_chipPickerChipSelected_cg615_2426",Que="_crapsAtsSection_cg615_2446",qt={panelRoot:qce,crapsPlaceTile:Vce,mobileShow:Hce,mobileHide:Wce,spotBtn:Gce,spotRow:Xce,actions:Yce,actionBtn:Zce,amountBadge:Kce,badgeMinus:Qce,crapsStatusBar:Jce,crapsStatusText:$ce,crapsHighlight:eue,crapsPlaceRow:tue,crapsBetTile:rue,crapsActionsBar:nue,crapsActionButton:aue,crapsActionButtonPrimary:sue,crapsActionButtonSecondary:oue,crapsMainBets:iue,disabled:lue,spotBtnTopRow:cue,lineWin:uue,lineLose:due,linePush:pue,outcomeBadge:fue,locked:mue,amountBadgeDisabled:hue,lockIcon:gue,aggBadge:yue,rollBtn:bue,rollIcon:vue,clear:_ue,errorLive:wue,tooltip:xue,betInfoBtn:Aue,betInfoModalOverlay:kue,betInfoModal:Sue,betInfoHeader:Eue,betInfoClose:Pue,betInfoContent:Cue,betInfoItem:Rue,shake:Tue,attnHalo:jue,crapsAtsLabel:Iue,crapsIronCrossBtn:Nue,crapsMinusBadge:Mue,rollHaloActive:Lue,crapsClearIcon:Due,particle:Oue,particleContainer:zue,floatingWinAmount:Bue,countdownBadge:Fue,countdownUrgent:Uue,countdownCritical:que,chipPickerWrapper:Vue,chipPickerToggle:Hue,chipPickerToggleOpen:Wue,chipPickerChip:Gue,chipPickerDropdown:Xue,chipPickerOption:Yue,chipPickerOptionSelected:Zue,chipPickerChipSelected:Kue,crapsAtsSection:Que},Jue={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 $ue({open:e,onClose:t}){const r=l.useRef(null);if(l.useEffect(()=>{if(!e)return;const s=i=>{i.key==="Escape"&&t()},o=i=>{r.current&&!r.current.contains(i.target)&&t()};return document.addEventListener("keydown",s),document.addEventListener("mousedown",o),()=>{document.removeEventListener("keydown",s),document.removeEventListener("mousedown",o)}},[e,t]),!e)return null;const n=a.jsx("div",{className:qt.betInfoModalOverlay,role:"presentation",children:a.jsxs("div",{className:qt.betInfoModal,role:"dialog","aria-modal":"true","aria-label":"Craps Bet Guide",ref:r,children:[a.jsxs("div",{className:qt.betInfoHeader,children:[a.jsx("h3",{children:"Craps Bet Guide"}),a.jsx("button",{className:qt.betInfoClose,onClick:t,"aria-label":"Close",children:"✕"})]}),a.jsx("div",{className:qt.betInfoContent,children:Object.entries(Jue).map(([s,{title:o,description:i}])=>a.jsxs("div",{className:qt.betInfoItem,children:[a.jsx("strong",{children:o}),a.jsx("p",{children:i})]},s))})]})});return ws.createPortal(n,document.body)}const ede="_atsProgressContainer_bok0p_3",tde="_inline_bok0p_15",rde="_atsSection_bok0p_25",nde="_complete_bok0p_42",ade="_justCompleted_bok0p_47",sde="_atsSectionAll_bok0p_66",ode="_atsSectionHeader_bok0p_75",ide="_atsSectionLabel_bok0p_84",lde="_atsSectionCount_bok0p_97",cde="_atsNumberRow_bok0p_107",ude="_atsNumber_bok0p_107",dde="_hit_bok0p_138",pde="_atsCompleteText_bok0p_160",fde="_atsLockedBadge_bok0p_181",Dn={atsProgressContainer:ede,inline:tde,atsSection:rde,complete:nde,justCompleted:ade,atsSectionAll:sde,atsSectionHeader:ode,atsSectionLabel:ide,atsSectionCount:lde,atsNumberRow:cde,atsNumber:ude,hit:dde,atsCompleteText:pde,atsLockedBadge:fde},mde=[2,3,4,5,6],hde=[8,9,10,11,12];function gde({hitNumbers:e,smallProgress:t,tallProgress:r,allProgress:n,betsLocked:s,lastCompletedCategory:o,inline:i=!1}){const c=f=>e.includes(f),u=t===5,p=r===5,d=n===10;return a.jsxs("div",{className:`${Dn.atsProgressContainer} ${i?Dn.inline:""}`,children:[a.jsxs("div",{className:`${Dn.atsSection} ${u?Dn.complete:""} ${o==="small"?Dn.justCompleted:""}`,children:[a.jsxs("div",{className:Dn.atsSectionHeader,children:[a.jsx("span",{className:Dn.atsSectionLabel,children:"SMALL"}),a.jsxs("span",{className:Dn.atsSectionCount,children:[t,"/5"]})]}),a.jsx("div",{className:Dn.atsNumberRow,children:mde.map(f=>a.jsx("div",{className:`${Dn.atsNumber} ${c(f)?Dn.hit:""}`,"aria-label":`${f} ${c(f)?"hit":"not hit"}`,children:f},f))})]}),a.jsxs("div",{className:`${Dn.atsSection} ${Dn.atsSectionAll} ${d?Dn.complete:""} ${o==="all"?Dn.justCompleted:""}`,children:[a.jsxs("div",{className:Dn.atsSectionHeader,children:[a.jsx("span",{className:Dn.atsSectionLabel,children:"ALL"}),a.jsxs("span",{className:Dn.atsSectionCount,children:[n,"/10"]})]}),d&&a.jsx("div",{className:Dn.atsCompleteText,children:"🎉"}),s&&!d&&a.jsx("div",{className:Dn.atsLockedBadge,children:"LOCKED"})]}),a.jsxs("div",{className:`${Dn.atsSection} ${p?Dn.complete:""} ${o==="tall"?Dn.justCompleted:""}`,children:[a.jsxs("div",{className:Dn.atsSectionHeader,children:[a.jsx("span",{className:Dn.atsSectionLabel,children:"TALL"}),a.jsxs("span",{className:Dn.atsSectionCount,children:[r,"/5"]})]}),a.jsx("div",{className:Dn.atsNumberRow,children:hde.map(f=>a.jsx("div",{className:`${Dn.atsNumber} ${c(f)?Dn.hit:""}`,"aria-label":`${f} ${c(f)?"hit":"not hit"}`,children:f},f))})]})]})}const oi={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"},o_={hitNumbers:[],smallProgress:0,tallProgress:0,allProgress:0,betsLocked:!1};function yde(e){const t=Na(),[r,n]=l.useState(o_),[s,o]=l.useState(null);l.useEffect(()=>{if(!s)return;const c=setTimeout(()=>o(null),3e3);return()=>clearTimeout(c)},[s]),l.useEffect(()=>{if(!t||!e)return;const c=m=>{console.log("[useCrapsAts] Received ATS progress:",m,"current roomId:",e),m.roomId===e&&n({hitNumbers:m.hitNumbers,smallProgress:m.smallProgress,tallProgress:m.tallProgress,allProgress:m.allProgress,betsLocked:m.betsLocked})},u=m=>{m.roomId===e&&o("small")},p=m=>{m.roomId===e&&o("tall")},d=m=>{m.roomId===e&&o("all")},f=m=>{m.roomId===e&&(n(o_),o(null))};return t.on(oi.PROGRESS,c),t.on(oi.SMALL_COMPLETE,u),t.on(oi.TALL_COMPLETE,p),t.on(oi.ALL_COMPLETE,d),t.on(oi.RESET,f),()=>{t.off(oi.PROGRESS,c),t.off(oi.SMALL_COMPLETE,u),t.off(oi.TALL_COMPLETE,p),t.off(oi.ALL_COMPLETE,d),t.off(oi.RESET,f)}},[t,e]);const i=l.useCallback(c=>r.hitNumbers.includes(c),[r.hitNumbers]);return{atsProgress:r,lastCompletedCategory:s,isNumberHit:i,reset:()=>n(o_)}}const _d=e=>`z${e.toLocaleString(void 0,{maximumFractionDigits:0})}`;function Bo({value:e,onAdd:t,onClear:r,disabled:n,selectedTimes:s=0,style:o,mini:i=!1,className:c,hideValue:u=!1}){const p=s>0,f=["casino-chip",`chip--v${e>=5e3?5e3:e>=1e3?1e3:e>=500?500:e>=100?100:e>=25?25:e>=10?10:e>=5?5:1}`,n?"is-disabled":"",p?"is-selected":"",i?"chip-container--mini":"",c||""].filter(Boolean).join(" "),m=!!t&&!n;return a.jsxs("div",{style:o,className:"chip-container",children:[a.jsxs("button",{type:"button",className:f,onClick:m?()=>{t==null||t(e)}:void 0,disabled:!m,"aria-label":`Add ${_d(Number(e))}`,title:`Add ${_d(Number(e))}`,style:m?void 0:{pointerEvents:"none"},children:[!u&&a.jsx("span",{className:"chip__value",children:e>=1e3?`${(Number(e)/1e3).toLocaleString(void 0,{maximumFractionDigits:e>=1e4?0:1})}k`:e}),p&&m&&a.jsxs("span",{className:"chip__count",children:["×",s]})]}),p&&m&&!!r&&a.jsx("button",{type:"button",className:"chip-clear","aria-label":`Clear ${_d(Number(e))} chip`,title:`Clear ${_d(Number(e))} chip`,onClick:h=>{h.stopPropagation(),r(e)},children:"×"})]})}function Za(e){return`z${e}`}function uo(e,t){return e.filter(r=>r.type===t).reduce((r,n)=>r+n.amount,0)}function bde(e,t){return e*t}function rR(e,t,r){const{phase:n,point:s,balance:o,pendingBets:i,minBet:c,maxBet:u,oddsMultiple:p,committedAddBack:d=0}=r,f=i.reduce((_,w)=>_+w.amount,0),m=uo(i,e),h=f+t,b=o+d;if(h>b)return{ok:!1,reason:"Insufficient balance"};const g=e==="pass"||e==="dontPass",y=e==="come"||e==="dontCome",x=e==="oddsPass"||e==="oddsDontPass",v=e.startsWith("place");if(g){if(n!=="comeOut"&&s)return{ok:!1,reason:"Line bets locked after point"};if(m===0&&t<c)return{ok:!1,reason:`Minimum ${Za(c)}`}}if(y){if(!s)return{ok:!1,reason:"Come bets only after point"};if(m===0&&t<c)return{ok:!1,reason:`Minimum ${Za(c)}`};if(m+t>u)return{ok:!1,reason:`Max ${Za(u)}`}}if(x){if(!s)return{ok:!1,reason:"Point required for odds"};const w=uo(i,e==="oddsPass"?"pass":"dontPass");if(!w)return{ok:!1,reason:"Need line bet first"};const j=bde(w,e==="oddsPass"?p.pass:p.dontPass);if(m+t>j)return{ok:!1,reason:`Max odds ${Za(j)}`}}if(v){if(!s)return{ok:!1,reason:"Place bets only in point phase"};if(m===0&&t<c)return{ok:!1,reason:`Minimum ${Za(c)}`};if(m+t>u)return{ok:!1,reason:`Max ${Za(u)}`}}if(e==="field"||e==="big6"||e==="big8"){if(m===0&&t<c)return{ok:!1,reason:`Minimum ${Za(c)}`};if(m+t>u)return{ok:!1,reason:`Max ${Za(u)}`}}if(e==="atsSmall"||e==="atsTall"||e==="atsAll"){if(m===0&&t<c)return{ok:!1,reason:`Minimum ${Za(c)}`};if(m+t>u)return{ok:!1,reason:`Max ${Za(u)}`}}return{ok:!0}}const vde=[{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"}],_de=[{key:"atsSmall",label:"Small"},{key:"atsTall",label:"Tall"},{key:"atsAll",label:"All"}],wde=[{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 xde(e,t){const[r,n]=l.useState(25);return l.useEffect(()=>{if(e.length&&!e.includes(r)){const s=e[0];n(s);return}},[e,r]),{selectedChip:r,setSelectedChip:n}}function Ade(e){const{pendingBets:t,myPlayerPlaceTotal:r,myCommittedByType:n}=e;return l.useMemo(()=>typeof r=="number"&&r>0||["place4","place5","place6","place8","place9","place10"].some(o=>Number(n[o]||0)>0)?!0:t.some(o=>o.type.startsWith("place")&&o.amount>0),[r,t,n])}function kde(e,t,r){const n=l.useRef(null);l.useEffect(()=>{t!==n.current&&(n.current=null)},[t]),l.useEffect(()=>{if(!e||!t||n.current===t)return;const s=r.current||document.querySelector(`.${qt.crapsPlaceRow}`),o=s?s.querySelector(`.${qt.crapsIronCrossBtn}`):document.querySelector(`.${qt.crapsIronCrossBtn}`);if(!o)return;const i=window.setTimeout(()=>{try{o.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},50);return n.current=t,()=>window.clearTimeout(i)},[e,t,r])}function Sde(e,t){const r=l.useRef(null);l.useEffect(()=>{if(!e){r.current=null;return}if(r.current===e)return;const n=t.current||document.querySelector(`.${qt.crapsPlaceRow}`),s=n?n.querySelector(`.${qt.crapsAtsLabel}`):document.querySelector(`.${qt.crapsAtsLabel}`);if(!s)return;const o=window.setTimeout(()=>{try{s.scrollIntoView({behavior:"smooth",block:"nearest",inline:"nearest"})}catch{}},100);return r.current=e,()=>window.clearTimeout(o)},[e,t])}function Ede(e,t,r){const n=l.useRef(null);l.useEffect(()=>{if(!e||n.current===e)return;n.current=e;const s=window.setTimeout(()=>{const o=t.current||document.querySelector(`.${qt.crapsMainBets}`),i=r.current||document.querySelector(`.${qt.crapsPlaceRow}`),c=(u,p)=>{if(!u)return;const d=u.scrollWidth,f=u.clientWidth;d<=f||window.setTimeout(()=>{u.scrollTo({left:d,behavior:"smooth"}),window.setTimeout(()=>{u.scrollTo({left:0,behavior:"smooth"})},600)},p)};c(o,0),c(i,150)},500);return()=>window.clearTimeout(s)},[e,t,r])}function Pde(e){const{phase:t,point:r,balance:n,pendingBets:s,minBet:o,maxBet:i,oddsMultiple:c,myPlayerLineTotals:u,myPlayerPlaceTotal:p}=e;return l.useMemo(()=>{const d=((u==null?void 0:u.pass)??0)+((u==null?void 0:u.dontPass)??0)+(p??0),f=uo(s,"pass")+uo(s,"dontPass")+uo(s,"place4")+uo(s,"place5")+uo(s,"place6")+uo(s,"place8")+uo(s,"place9")+uo(s,"place10"),m=Math.max(0,f-d);return{phase:t,point:r,balance:n,pendingBets:s,minBet:o,maxBet:i,oddsMultiple:c,committedAddBack:d+m}},[t,r,n,s,o,i,c,u==null?void 0:u.pass,u==null?void 0:u.dontPass,p])}function Cde(e,t){return l.useCallback(r=>{const n=e.find(o=>o.type===r),s=Number(t[r]||0);return n?n.amount===s?s:Math.max(0,n.amount):Math.max(0,s)},[e,t])}function Rde(e,t,r){const n=l.useRef(new Map),s=5e3;l.useEffect(()=>{if(!e.length){n.current.clear();return}const o=Date.now();for(const u of e){const p=`${u.type}:${u.amount}`;n.current.has(p)||n.current.set(p,o)}const i=new Set(e.map(u=>`${u.type}:${u.amount}`));for(const u of n.current.keys())i.has(u)||n.current.delete(u);const c=e.filter(u=>{const p=Number(t[u.type]||0);if(u.amount===0&&p>0)return!0;if(u.amount===p)return!1;const d=`${u.type}:${u.amount}`,f=n.current.get(d)||o;return o-f>s?(console.warn("[CrapsBettingPanel] Pruning stuck pending bet (timeout)",{type:u.type,amount:u.amount,committed:p}),!1):!0});c.length!==e.length&&r(c)},[e,t,r])}function Tde(e){const{recentSettlements:t,meId:r,myPlayerLineTotals:n}=e,s=l.useMemo(()=>{if(!t.length||!r)return{};const p=t.filter(f=>(f.betType==="pass"||f.betType==="dontPass")&&f.playerId===r),d={};for(const f of p)(f.betType==="pass"?((n==null?void 0:n.pass)??0)>0:((n==null?void 0:n.dontPass)??0)>0)&&(d[f.betType]=f.outcome);return d},[t,r,n==null?void 0:n.pass,n==null?void 0:n.dontPass]),o=l.useMemo(()=>{if(!t.length||!r)return{};const p=t.filter(f=>f.betType.startsWith("place")&&f.playerId===r),d={};for(const f of p)d[f.betType]=f.outcome;return d},[t,r]),i=l.useMemo(()=>{if(!t.length||!r)return{};const p=t.filter(f=>f.betType==="field"&&f.playerId===r),d={};for(const f of p)d[f.betType]=f.outcome;return d},[t,r]),c=l.useMemo(()=>{if(!t.length||!r)return{};const p=t.filter(f=>(f.betType==="big6"||f.betType==="big8")&&f.playerId===r),d={};for(const f of p)d[f.betType]=f.outcome;return d},[t,r]),u=l.useMemo(()=>{if(!t.length||!r)return{};const p=t.filter(f=>(f.betType==="come"||f.betType==="dontCome")&&f.playerId===r),d={};for(const f of p)d[f.betType]=f.outcome;return d},[t,r]);return{lineOutcomeMap:s,placeOutcomeMap:o,fieldOutcomeMap:i,bigOutcomeMap:c,comeOutcomeMap:u}}function jde(e,t){l.useEffect(()=>{const r=document.querySelectorAll(e),n=[];return r.forEach(s=>{if(s.querySelector(`.${qt.particleContainer}`))return;const o=document.createElement("div");o.className=qt.particleContainer,s.appendChild(o);const i=()=>{const u=document.createElement("div");u.className=qt.particle;const p=Math.random()*100,d=(Math.random()-.5)*40,f=-(80+Math.random()*60),m=1.8+Math.random()*1,h=Math.random()*.3;u.style.setProperty("--start-x",`${p}%`),u.style.setProperty("--drift-x",`${d}px`),u.style.setProperty("--rise-y",`${f}px`),u.style.setProperty("--duration",`${m}s`),u.style.setProperty("--delay",`${h}s`),u.style.left="0",u.style.bottom="0",o.appendChild(u),window.setTimeout(()=>u.remove(),(m+h)*1e3)},c=window.setInterval(i,400+Math.random()*300);n.push(c),i(),window.setTimeout(i,150),window.setTimeout(i,300)}),()=>{n.forEach(s=>window.clearInterval(s)),r.forEach(s=>{var o;return(o=s.querySelector(`.${qt.particleContainer}`))==null?void 0:o.remove()})}},[e,t])}function Ide(e){const{recentSettlements:t,meId:r,winSelector:n,floatingClass:s}=e,o=l.useRef(new Set),i=l.useRef(0);l.useEffect(()=>{if(t.length===0&&i.current>0&&o.current.clear(),i.current=t.length,!t.length||!r)return;const u=t.map((d,f)=>({s:d,idx:f})).filter(({s:d})=>d.playerId===r&&d.outcome==="WIN"&&d.payout>0).filter(({s:d,idx:f})=>{const m=`${d.betType}|${d.amount}|${d.payout}|${f}`;return o.current.has(m)?!1:(o.current.add(m),!0)});if(!u.length)return;const p=window.setTimeout(()=>{const d={};u.forEach(({s:m})=>{d[m.betType]=m.payout}),document.querySelectorAll(n).forEach(m=>{const h=m.getAttribute("data-bet-type");if(!h)return;const b=d[h];if(!b)return;try{m.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})}catch{}const g=()=>{const y=m.getBoundingClientRect(),x=document.createElement("div");x.className=s,x.textContent=`+${Za(b)}`,x.style.left=`${y.left+y.width/2}px`,x.style.top=`${y.top}px`,document.body.appendChild(x),window.setTimeout(()=>x.remove(),2500)};h.startsWith("place")?window.setTimeout(g,500):g()})},50);return()=>window.clearTimeout(p)},[t,r,n,s])}function U5(e){const{roomId:t,balance:r,phase:n,point:s,shooterName:o,minBet:i,maxBet:c,oddsMultiple:u,chips:p,pendingBets:d,onChangeBets:f,onClearAll:m,disabled:h,onRoll:b,canRoll:g,myPlayerPlaceTotal:y,readyPlayers:x=[],meId:v,onBetDelta:A,onBetsBatch:_,showReadyButton:w,onReadyClick:j,readyStateLabel:T,readyButtonDisabled:R,countdownSeconds:P=0,recentSettlements:k=[],myPlayerLineTotals:E,othersTotals:M,myCommittedByType:C={},onPassTurn:I,canPassTurn:L,onChargeChange:N}=e,S=h,{selectedChip:F,setSelectedChip:D}=xde(p),{atsProgress:H,lastCompletedCategory:W}=yde(t??null),[G,$]=l.useState(!1),[K,de]=l.useState(),[ie,we]=l.useState(),{info:he}=vb(),Ae=l.useRef(!1),Fe=l.useRef(null),U=l.useRef(0),V=50,z=V/1200,O=n==="comeOut"&&!s,q=n==="point"&&!!s,X=!1,Z=l.useRef(null),Q=l.useRef(null),oe=l.useRef(null),ce=l.useRef(H.betsLocked),_e=Ade({pendingBets:d,myPlayerPlaceTotal:y,myCommittedByType:C}),re=n==="point"&&!!s&&!_e;kde(re,s,Q),Sde(W,Q),Ede(t,Z,Q),l.useEffect(()=>{const Qe=ce.current,Mt=H.betsLocked;ce.current=Mt,Qe!==Mt&&(Mt&&oe.current?oe.current.scrollTo({left:oe.current.scrollWidth,behavior:"smooth"}):!Mt&&oe.current&&oe.current.scrollTo({left:0,behavior:"smooth"}))},[H.betsLocked]);const pe=l.useCallback(()=>{Ae.current||(Ae.current=!0,yn(),U.current=0,N==null||N(0),Fe.current&&clearInterval(Fe.current),Fe.current=setInterval(()=>{U.current=Math.min(1,U.current+z),N==null||N(U.current),U.current>=.95?cr("Heavy"):U.current>=.6?cr("Medium"):U.current>=.25&&cr("Light")},V))},[N]),ee=l.useCallback(()=>{if(Ae.current){if(Ae.current=!1,Fe.current&&(clearInterval(Fe.current),Fe.current=null),U.current=0,N==null||N(0),n==="point"&&!_e)try{he("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}b==null||b()}},[n,_e,he,b,N]),xe=Pde({phase:n,point:s,balance:r,pendingBets:d,minBet:i,maxBet:c,oddsMultiple:u,myPlayerLineTotals:E,myPlayerPlaceTotal:y}),Le=Cde(d,C);Rde(d,C,f);const Ge=l.useMemo(()=>{const Qe=uo(d,"pass")>0||uo(d,"dontPass")>0,Mt=((E==null?void 0:E.pass)??0)>0||((E==null?void 0:E.dontPass)??0)>0,lr=Le("pass")>0||Le("dontPass")>0;return Qe||Mt||lr},[d,E==null?void 0:E.pass,E==null?void 0:E.dontPass,Le]),{lineOutcomeMap:_t,placeOutcomeMap:Xe,fieldOutcomeMap:bt,bigOutcomeMap:Pt,comeOutcomeMap:kt}=Tde({recentSettlements:k,meId:v,myPlayerLineTotals:E}),Ee=l.useMemo(()=>`.${qt.spotBtn}[data-win-outcome="true"]`,[]),le=l.useMemo(()=>JSON.stringify({lineOutcomeMap:_t,placeOutcomeMap:Xe,fieldOutcomeMap:bt,bigOutcomeMap:Pt,comeOutcomeMap:kt}),[_t,Xe,bt,Pt,kt]);jde(Ee,le),Ide({recentSettlements:k,meId:v,winSelector:Ee,floatingClass:qt.floatingWinAmount});const De=l.useMemo(()=>{const Qe=new Set;for(const Mt of d){const lr=Number(C[Mt.type]||0);Mt.amount!==lr&&Qe.add(Mt.type)}return Qe},[d,C]),Ye=l.useRef(new Set);l.useEffect(()=>{const Qe=Ye.current,Mt=De;for(const lr of Qe)if(!Mt.has(lr)){try{R8({volume:.03})}catch{}break}Ye.current=new Set(Mt)},[De]),De.size>0,l.useMemo(()=>De.size>0,[De]);const Re=l.useCallback((Qe,Mt)=>{if(Mt===0)return;const lr=d.find(fr=>fr.type===Qe);if(Mt>0){const fr=Mt,{ok:ur,reason:Ie}=rR(Qe,fr,xe);if(!ur){if(de(Ie),we(Qe),Ie==="Insufficient balance")try{he("Insufficient funds","Add chips to place this bet")}catch{}window.setTimeout(()=>we(void 0),600);return}if(lr)f(d.map(yt=>yt===lr?{...yt,amount:yt.amount+fr}:yt));else{const yt=Number(C[Qe]||0);f([...d,{id:Hv(),type:Qe,amount:yt+fr}])}A==null||A(Qe,fr);return}let zt=(lr==null?void 0:lr.amount)??0;if(!lr){const fr=Number(C[Qe]||0);if(fr<=0)return;zt=fr}const br=zt+Mt;f(lr?d.map(fr=>fr===lr?{...fr,amount:Math.max(0,br)}:fr):[...d,{id:Hv(),type:Qe,amount:Math.max(0,br)}]),A==null||A(Qe,Mt)},[d,f,i,C,xe,A,he]),et=l.useCallback((Qe,Mt)=>{const lr=Qe==="oddsPass",zt=Qe==="oddsDontPass",br=Qe==="atsSmall"||Qe==="atsTall"||Qe==="atsAll",fr=Qe==="pass"||Qe==="dontPass"?q:lr?n!=="point"||!s||Le("pass")===0:zt?n!=="point"||!s||Le("dontPass")===0:Qe.startsWith("place")||Qe==="come"||Qe==="dontCome"?!s:br?n!=="comeOut"||H.betsLocked:!1,ur=Qe==="pass"||Qe==="dontPass",Ie=Qe==="come"||Qe==="dontCome",yt=!Qe.startsWith("place"),St=ur&&q,Xt=ur?_t[Qe]:Qe==="field"?bt[Qe]:Qe==="big6"||Qe==="big8"?Pt[Qe]:Ie?kt[Qe]:void 0,se=Xt==="WIN"?qt.lineWin:Xt==="LOSE"?qt.lineLose:Xt==="PUSH"?qt.linePush:"",je=ur&&O&&!Ge,Oe=[qt.spotBtn,qt.crapsBetTile,Qe.startsWith("place")?qt.crapsPlaceTile:"",fr?qt.locked:"",ie===Qe?qt.shake:"",se,je?qt.attnHalo:"",Qe.startsWith("place")&&re?qt.attnHalo:""],Ke=h||X,Me=M&&typeof M[Qe]=="number"?M[Qe]:0,wt=Le(Qe);if(yt){const Ut=[...Oe,qt.spotBtnTopRow,"gold-link",Ke?qt.disabled:""].filter(Boolean).join(" ");return a.jsxs(Zs.a,{role:"button",tabIndex:0,"aria-disabled":Ke||void 0,className:Ut,"data-bet-type":Qe,"data-attn":je?"need-line":void 0,"data-has-bet":wt>0?"true":"false","data-win-outcome":Xt==="WIN"?"true":"false","data-no-global-haptic":!0,"aria-label":`Place bet on ${Mt}, +${F}`,onClick:ft=>{ft.preventDefault(),!fr&&!Ke&&(yn(),cr("Light"),Re(Qe,F))},onKeyDown:ft=>{(ft.key==="Enter"||ft.key===" ")&&!fr&&!Ke&&(ft.preventDefault(),yn(),cr("Light"),Re(Qe,F))},whileTap:{scale:.94},children:[Mt,Me>0&&a.jsx("div",{className:qt.aggBadge,"aria-label":`Others ${Mt} total ${Za(Me)}`,children:Za(Me)}),wt>0&&a.jsxs("div",{className:qt.amountBadge+(St?" "+qt.amountBadgeDisabled:""),"aria-disabled":St||void 0,children:[!St&&a.jsx("span",{role:"button",tabIndex:0,className:[qt.badgeMinus,qt.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${Mt}`,onClick:ft=>{ft.stopPropagation(),yn(),cr("Light"),Re(Qe,-F)},onKeyDown:ft=>{(ft.key==="Enter"||ft.key===" ")&&(ft.preventDefault(),ft.stopPropagation(),yn(),cr("Light"),Re(Qe,-F))},children:"−"}),Za(wt),St&&a.jsx("span",{className:qt.lockIcon,"aria-hidden":"true",children:"🔒"}),Xt&&a.jsx("span",{className:qt.outcomeBadge,"aria-label":`Outcome ${Xt}`,children:Xt==="WIN"?"✓":Xt==="LOSE"?"✕":"⟳"})]}),ie===Qe&&K&&a.jsx("div",{className:qt.tooltip,children:K})]},Qe)}const at=Qe.startsWith("place")?Xe[Qe]:Qe==="field"?bt[Qe]:Qe==="big6"||Qe==="big8"?Pt[Qe]:void 0,Dt=Oe.filter(Boolean).join(" ");return a.jsxs(Zs.button,{type:"button",className:Dt,"data-bet-type":Qe,"data-attn":Qe.startsWith("place")&&re?"need-places":void 0,"data-has-bet":wt>0?"true":"false","data-win-outcome":Xt==="WIN"||at==="WIN"?"true":"false","aria-label":`Place bet on ${Mt}, +${F}`,onClick:()=>{!fr&&!Ke&&(yn(),cr("Light"),Re(Qe,F))},disabled:h||X,whileTap:{scale:.94},children:[Mt,Me>0&&a.jsx("div",{className:qt.aggBadge,"aria-label":`Others ${Mt} total ${Za(Me)}`,children:Za(Me)}),wt>0&&a.jsxs("div",{className:qt.amountBadge+(St?" "+qt.amountBadgeDisabled:""),"aria-disabled":St||void 0,children:[!St&&a.jsx("span",{role:"button",tabIndex:0,className:[qt.badgeMinus,qt.crapsMinusBadge].join(" "),"aria-label":`Remove chip from ${Mt}`,onClick:Ut=>{Ut.stopPropagation(),yn(),cr("Light"),Re(Qe,-F)},onKeyDown:Ut=>{(Ut.key==="Enter"||Ut.key===" ")&&(Ut.preventDefault(),Ut.stopPropagation(),yn(),cr("Light"),Re(Qe,-F))},children:"−"}),Za(wt),St&&a.jsx("span",{className:qt.lockIcon,"aria-hidden":"true",children:"🔒"}),Xt&&a.jsx("span",{className:qt.outcomeBadge,"aria-label":`Outcome ${Xt}`,children:Xt==="WIN"?"✓":Xt==="LOSE"?"✕":"⟳"})]}),ie===Qe&&K&&a.jsx("div",{className:qt.tooltip,children:K})]},Qe)},[Re,h,X,Le,K,ie,O,Ge,re,F,q,n,s,_t,Xe,bt,Pt,kt,M,H.betsLocked]),rt=l.useMemo(()=>{const Qe=[...vde],Mt=(lr,zt,br)=>{const fr=Qe.findIndex(ur=>ur.key===lr);fr>=0&&!Qe.some(ur=>ur.key===zt)&&Qe.splice(fr+1,0,{key:zt,label:br})};return Mt("pass","oddsPass","Odds Pass"),Mt("dontPass","oddsDontPass","Odds Don't"),Qe},[]),ne=l.useMemo(()=>rt.map(Qe=>et(Qe.key,Qe.label)),[rt,et]),ue=l.useMemo(()=>wde.map(Qe=>et(Qe.key,Qe.label)),[et]),B=l.useMemo(()=>_de.map(Qe=>et(Qe.key,Qe.label)),[et]),fe=l.useCallback(()=>{if(h||X)return;yn(),cr("Light");const Qe=["place4","place5","place6","place8","place9","place10"],Mt=[];for(const zt of Qe){d.find(Ie=>Ie.type===zt);const br=F,{ok:fr,reason:ur}=rR(zt,br,xe);if(!fr){if(de(ur),we(zt),ur==="Insufficient balance")try{he("Insufficient funds","Add chips to place All Places bet")}catch{}window.setTimeout(()=>we(void 0),600);return}Mt.push({type:zt,delta:br})}let lr=[...d];for(const{type:zt,delta:br}of Mt){const fr=lr.find(ur=>ur.type===zt);if(fr)lr=lr.map(ur=>ur===fr?{...ur,amount:ur.amount+br}:ur);else{const ur=Number(C[zt]||0);lr.push({id:Hv(),type:zt,amount:ur+br})}}f(lr),_?_(Mt.map(({type:zt,delta:br})=>({type:zt,amount:br}))):A&&Mt.forEach(({type:zt,delta:br})=>A(zt,br))},[h,X,d,F,i,xe,f,C,_,A,he]),ye=!!w,ve=ye?T||"Ready":"Roll",ke=ye?!!R:S||g===!1,Ue=!ye&&!ke&&g!==!1&&(n!=="point"||_e),[ct,dt]=l.useState(!1),Rt=l.useRef(null);l.useEffect(()=>{if(!ct)return;const Qe=Mt=>{Rt.current&&!Rt.current.contains(Mt.target)&&dt(!1)};return document.addEventListener("mousedown",Qe),()=>document.removeEventListener("mousedown",Qe)},[ct]);const jr=o;return a.jsxs("div",{className:[qt.panelRoot,h?qt.disabled:""].join(" "),children:[a.jsxs("div",{className:qt.crapsStatusBar,children:[a.jsxs("div",{className:qt.chipPickerWrapper,ref:Rt,children:[a.jsx("div",{className:[qt.chipPickerToggle,ct?qt.chipPickerToggleOpen:""].join(" "),onClick:()=>{yn(),cr("Light"),dt(Qe=>!Qe)},role:"button",tabIndex:0,"aria-label":`Selected chip ${F}, click to change`,"aria-expanded":ct,onKeyDown:Qe=>{(Qe.key==="Enter"||Qe.key===" ")&&(Qe.preventDefault(),yn(),cr("Light"),dt(Mt=>!Mt))},children:a.jsx(Bo,{value:F,mini:!0,className:qt.chipPickerChip,onAdd:()=>{yn(),cr("Light"),dt(Qe=>!Qe)}})}),ct&&a.jsx("div",{className:qt.chipPickerDropdown,children:p.map(Qe=>a.jsx("div",{className:[qt.chipPickerOption,Qe===F?qt.chipPickerOptionSelected:""].join(" "),children:a.jsx(Bo,{value:Qe,mini:!0,className:Qe===F?qt.chipPickerChipSelected:"",onAdd:()=>{yn(),AM(),D(Qe),dt(!1)}})},Qe))})]}),a.jsxs("span",{className:qt.crapsStatusText,children:[a.jsx("span",{className:qt.mobileHide,children:n==="comeOut"?"COME-OUT":"POINT"}),a.jsx("span",{className:qt.mobileShow,children:n==="comeOut"?"CO":"PT"})," • ",a.jsx("span",{className:qt.mobileHide,children:"SHOOTER: "}),a.jsx("strong",{className:qt.crapsHighlight,children:jr})," • ",a.jsx("span",{className:qt.mobileHide,children:"POINT: "}),a.jsx("span",{className:qt.mobileShow,children:"P: "}),a.jsx("strong",{className:qt.crapsHighlight,children:s??"—"})]}),a.jsx("button",{type:"button",className:qt.betInfoBtn,onClick:()=>{cr("Light"),$(!0)},"aria-label":"Show bet information",children:a.jsx(Gl,{icon:fre})})]}),a.jsx($ue,{open:G,onClose:()=>$(!1)}),a.jsx("div",{className:[qt.spotRow,qt.crapsMainBets].join(" "),ref:Z,children:ne}),a.jsxs("div",{className:qt.crapsPlaceRow,ref:Q,children:[ue,a.jsx("button",{type:"button",className:[qt.spotBtn,qt.crapsBetTile,qt.crapsIronCrossBtn].join(" "),onClick:fe,disabled:!s||h||X,"aria-label":"Place All Places (4/5/6/8/9/10)",children:"All Places"})]}),a.jsxs("div",{className:qt.crapsAtsSection,ref:oe,children:[a.jsx("span",{className:qt.crapsAtsLabel,children:"ATS"}),B,a.jsx(gde,{hitNumbers:H.hitNumbers,smallProgress:H.smallProgress,tallProgress:H.tallProgress,allProgress:H.allProgress,betsLocked:H.betsLocked,lastCompletedCategory:W,inline:!0})]}),a.jsx("div",{className:qt.crapsActionsBar,children:a.jsxs("div",{className:qt.actions,children:[a.jsxs("button",{type:"button",className:[qt.actionBtn,qt.rollBtn,qt.crapsActionButton,qt.crapsActionButtonPrimary,Ue?qt.rollHaloActive:""].join(" "),onClick:Qe=>{if(ye){if(R)return;try{yn(),cr("Light")}catch{}j==null||j();return}if(Ae.current){Qe.preventDefault();return}if(!ke){N==null||N(1),yn(),cr("Medium");try{n==="point"&&!_e&&he("No Place bet","Add a Place bet (e.g., 6 or 8) before rolling")}catch{}b==null||b(),N==null||N(0)}},onPointerDown:()=>{ye||ke||(pe(),cr("Medium"))},onPointerUp:()=>{ye||ee()},onPointerCancel:()=>{ee()},onPointerLeave:()=>{ee()},disabled:ke,"aria-label":ye?"Mark ready":"Roll dice",children:[!ye&&a.jsx(Gl,{icon:ure,className:qt.rollIcon,"aria-hidden":"true"}),ve,ye&&P>0&&a.jsx("span",{className:[qt.countdownBadge,P<=5?qt.countdownCritical:P<=10?qt.countdownUrgent:""].join(" "),"aria-label":`${P} seconds remaining`,children:P})]}),!w&&L&&I&&a.jsx("button",{type:"button",className:[qt.actionBtn,qt.crapsActionButton,qt.crapsActionButtonSecondary].join(" "),onClick:()=>{console.log("[CrapsBettingPanel] Pass button clicked");try{yn(),cr("Light")}catch{}I()},"aria-label":"Pass dice to next shooter",children:"Pass"}),a.jsxs("button",{type:"button",className:[qt.actionBtn,qt.clear,qt.crapsActionButton,qt.crapsActionButtonSecondary].join(" "),onClick:()=>{yn(),cr("Light"),m()},"aria-label":"Clear all bets",children:[a.jsx("span",{className:qt.crapsClearIcon,"aria-hidden":"true",children:"✕"})," Clear"]})]})}),a.jsx("div",{className:qt.errorLive,"aria-live":"polite",children:K||""})]})}function Nde(e,t){const{crapsGetState:r,crapsJoinOrder:n,crapsLeaveOrder:s,crapsSetOrder:o,crapsRoll:i,crapsResetShooter:c,crapsReady:u,crapsPassTurn:p}=sa(),d=(t==null?void 0:t.enabled)??!0;return{getState:f=>d&&e?r(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0,joinOrder:f=>d&&e?n(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0,leaveOrder:f=>d&&e?s(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0,setOrder:(f,m)=>d&&e?o(e,f).then(h=>(m==null||m(h),h)).catch(h=>(m==null||m({ok:!1,error:(h==null?void 0:h.message)||"ERR"}),{ok:!1,error:(h==null?void 0:h.message)||"ERR"})):void 0,roll:f=>d&&e?i(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0,resetShooter:f=>d&&e?c(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0,ready:f=>d&&e?u(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0,passTurn:f=>d&&e?p(e).then(m=>(f==null||f(m),m)).catch(m=>(f==null||f({ok:!1,error:(m==null?void 0:m.message)||"ERR"}),{ok:!1,error:(m==null?void 0:m.message)||"ERR"})):void 0}}let Wp={},Mde=1;function q5(e){var V;const{roomId:t,myPlayerId:r,autoJoinOrder:n=!0,onRoll:s,onState:o}=e,{crapsReady:i}=sa(),c=(()=>{try{return Is&&Is()}catch{return null}})(),u=(c==null?void 0:c.room)??null,p=(c==null?void 0:c.setRoom)??(()=>{}),f=((V=u==null?void 0:u.gameState)==null?void 0:V.gameMode)==="craps",m=Nde(t,{enabled:f}),h=l.useMemo(()=>{const z=u==null?void 0:u.gameState;return!z||z.gameMode!=="craps"?null:{point:z.crapsPoint??null,currentRollerId:z.currentRollerId??null,turnOrder:z.turnOrder??[]}},[u==null?void 0:u.gameState]),[b,g]=l.useState(null),[y,x]=l.useState([]),[v,A]=l.useState(!1),_=l.useRef(!1),[w,j]=l.useState([]),[T,R]=l.useState(null),[P,k]=l.useState([]),E=l.useRef(null),M=l.useRef(null),C=l.useRef(null),I=l.useRef(null),L=l.useRef(null),{triggerSpin:N}=Ti(),S=l.useRef(null),F=l.useRef(null),D=l.useRef(null),H=2e3,W=600,G=l.useMemo(()=>!!(r&&(h!=null&&h.turnOrder.includes(r))),[r,h==null?void 0:h.turnOrder]),$=l.useCallback(()=>{var z;if(f){try{console.debug("[craps][requestState]")}catch{}(z=m.getState)==null||z.call(m)}},[m,f]),K=l.useCallback(z=>{var O;!f||!t||_.current||(_.current=!0,(O=m.joinOrder)==null||O.call(m,q=>{_.current=!1,z==null||z(q==null?void 0:q.ok,q==null?void 0:q.data)}))},[m,t,f]),de=l.useCallback(z=>{var O;!f||!t||_.current||(_.current=!0,(O=m.leaveOrder)==null||O.call(m,q=>{_.current=!1,z==null||z(q==null?void 0:q.ok,q==null?void 0:q.data)}))},[m,t,f]),ie=l.useCallback((z,O)=>{var q;!f||!t||_.current||(_.current=!0,(q=m.setOrder)==null||q.call(m,z,X=>{_.current=!1,O==null||O(X==null?void 0:X.ok,X==null?void 0:X.data)}))},[m,t,f]),we=l.useCallback(z=>{var O;if(!f||!t||_.current){try{console.debug("[craps][roll_emit][blocked]",{isCraps:f,roomIdPresent:!!t,pendingAck:_.current})}catch{}return}try{console.debug("[craps][roll_emit][start]",{roomId:t})}catch{}_.current=!0,A(!0),g(null),D.current=Date.now(),N();try{const q=(O=m.roll)==null?void 0:O.call(m);q&&typeof q.then=="function"?q.then(X=>{const Z=!!(X!=null&&X.ok),Q=String((X==null?void 0:X.error)||"");try{console.debug("[craps][roll_emit][ack]",{ok:Z,err:Q})}catch{}if(_.current=!1,!Z)try{const oe=/invalid_payload/i.test(Q),ce=/no_room/i.test(Q),_e=/forbidden|unauthorized/i.test(Q);if(oe||ce||_e){console.warn("[craps][roll_emit][ack_reject]",{err:Q}),F.current&&(window.clearTimeout(F.current),F.current=null),A(!1),D.current=null,$(),z==null||z(!1,X==null?void 0:X.data);return}}catch{}try{F.current&&(window.clearTimeout(F.current),F.current=null),F.current=window.setTimeout(()=>{try{console.warn("[craps][roll_emit][fallback_clear_rolling]")}catch{}A(!1),D.current=null,F.current=null},Math.max(H,4e3))}catch{}z==null||z(Z,X==null?void 0:X.data)}).catch(()=>{try{console.warn("[craps][roll_emit][ack_error]")}catch{}_.current=!1,A(!1),D.current=null;try{$()}catch{}z==null||z(!1)}):(_.current=!1,A(!1),D.current=null,z==null||z(!1))}catch{try{console.warn("[craps][roll_emit][exception]")}catch{}_.current=!1,A(!1),D.current=null,z==null||z(!1)}},[m,t,f]),he=l.useCallback(z=>{var O;if(!(!f||!t||_.current)){_.current=!0;try{const q=(O=m.resetShooter)==null?void 0:O.call(m);q&&typeof q.then=="function"?q.then(X=>{_.current=!1,z==null||z(!!(X!=null&&X.ok),X==null?void 0:X.data)}).catch(()=>{_.current=!1,z==null||z(!1)}):(_.current=!1,z==null||z(!1))}catch{_.current=!1,z==null||z(!1)}}},[m,t,f]),Ae=l.useCallback(z=>{var O;if(console.log("[craps][passTurn] called",{isCraps:f,roomId:t,pendingAck:_.current}),!f||!t||_.current){console.log("[craps][passTurn] blocked",{isCraps:f,roomId:t,pendingAck:_.current});return}_.current=!0;try{const q=(O=m.passTurn)==null?void 0:O.call(m);console.log("[craps][passTurn] api.passTurn() returned",{isPromise:!!(q&&typeof q.then=="function")}),q&&typeof q.then=="function"?q.then(X=>{console.log("[craps][passTurn] resolved",X),_.current=!1,z==null||z(!!(X!=null&&X.ok),X==null?void 0:X.data)}).catch(X=>{console.log("[craps][passTurn] rejected",X),_.current=!1,z==null||z(!1)}):(console.log("[craps][passTurn] api returned undefined"),_.current=!1,z==null||z(!1))}catch(q){console.log("[craps][passTurn] exception",q),_.current=!1,z==null||z(!1)}},[m,t,f]),Fe=l.useRef(0);Fe.current===0&&(Fe.current=Mde++);const U=l.useMemo(()=>t?Wp[t]?Wp[t]===Fe.current:(Wp[t]=Fe.current,!0):!1,[t]);return l.useEffect(()=>()=>{try{t&&Wp[t]===Fe.current&&delete Wp[t]}catch{}},[t]),Ba({onJoinedRoom:({room:z})=>{if(U)try{if(!t||!z||z.id!==t)return;if(I.current){const O=I.current.cb;I.current=null,(async()=>{try{const q=await i(t);O==null||O(!!(q!=null&&q.ok),q==null?void 0:q.data)}catch{O==null||O(!1)}})()}}catch{}},onRejoinedRoom:({room:z})=>{if(U)try{if(!t||!z||z.id!==t)return;if(I.current){const O=I.current.cb;I.current=null,(async()=>{try{const q=await i(t);O==null||O(!!(q!=null&&q.ok),q==null?void 0:q.data)}catch{O==null||O(!1)}})()}}catch{}},onCrapsState:z=>{var Z,Q,oe,ce,_e,re,pe;if(!U||!t||z.roomId!==t)return;const O=((Z=z.state)==null?void 0:Z.currentRollerId)??((Q=z.state)==null?void 0:Q.currentShooterId)??((oe=z.state)==null?void 0:oe.shooterId)??null,q=((ce=z.state)==null?void 0:ce.turnOrder)||((_e=z.state)==null?void 0:_e.shooterOrder)||[],X=((re=z.state)==null?void 0:re.point)??((pe=z.state)==null?void 0:pe.crapsPoint)??null;try{console.debug("[craps][state]",{point:X,currentRollerId:O,turnOrderLen:q.length})}catch{}try{p(ee=>{if(!ee||ee.id!==t)return ee;const xe=ee.gameState||{},Le=X?"point":"come-out";return{...ee,gameState:{...xe,gameMode:xe.gameMode||"craps",crapsPoint:X,currentRollerId:O,turnOrder:q,crapsPhase:Le}}})}catch{}try{o==null||o({point:X,currentRollerId:O,turnOrder:q})}catch{}n&&r&&!q.includes(r)&&K()},onCrapsPointSet:z=>{if(U)try{if(!t||(z==null?void 0:z.roomId)!==t)return;const O=(z==null?void 0:z.point)??(z==null?void 0:z.crapsPoint)??null;try{console.debug("[craps][point_set]",{newPoint:O})}catch{}p(q=>{if(!q||q.id!==t)return q;const X={...q.gameState||{}};return O!=null&&(X.crapsPoint=O,X.crapsPhase="point"),{...q,gameState:X}})}catch{}},onCrapsRollResult:z=>{if(!U||!t||(z==null?void 0:z.roomId)!==t)return;let O,q;if(Array.isArray(z==null?void 0:z.dice)?[O,q]=z.dice:(O=z==null?void 0:z.d1,q=z==null?void 0:z.d2),typeof O!="number"||typeof q!="number")return;const X=typeof z.total=="number"?z.total:O+q,Z=z.currentRollerId??z.currentShooterId??z.shooterId??null,Q=z.nextRollerId??z.nextShooterId??z.nextShooter??null;try{console.debug("[craps][roll_result]",{dice:[O,q],total:X,point:z.point??z.crapsPoint??null,currentRollerId:Z,nextRollerId:Q})}catch{}const oe={roomId:z.roomId,dice:[O,q],total:X,point:z.point??z.crapsPoint??null,currentRollerId:Z,nextRollerId:Q,events:Array.isArray(z.events)?z.events:[],resolutions:z.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1}};D.current||(D.current=Date.now(),g(null),N());try{_.current=!1,A(!0),S.current&&(window.clearTimeout(S.current),S.current=null);const ce=D.current?Date.now()-D.current:0,_e=Math.max(H-ce,0)+W;S.current=window.setTimeout(()=>{A(!1),D.current=null,S.current=null},_e),F.current&&(window.clearTimeout(F.current),F.current=null)}catch{}g(oe),x(ce=>{const _e=Date.now(),re=30,pe=900;for(let Le=0;Le<ce.length&&Le<5;Le++){const Ge=ce[Le];if(Ge.dice[0]===oe.dice[0]&&Ge.dice[1]===oe.dice[1]&&_e-Ge.ts<pe)return ce}const xe=[{...oe,ts:_e,phase:oe.point?"point":"come-out"},...ce];xe.length>re&&(xe.length=re);try{if(t){const Le={v:1,roomId:t,ts:_e,items:xe};Qy(`craps-roll-history:${t}`,Le)}}catch{}return xe});try{const ce=Q||null;j(ce?[ce]:[]),R(null)}catch{}try{(z.gameState||z.point!==void 0||z.currentRollerId!==void 0||z.nextRollerId!==void 0)&&p(ce=>{if(!ce||ce.id!==t)return ce;const re={...ce.gameState||{}};(z.point!==void 0||z.crapsPoint!==void 0)&&(re.crapsPoint=z.point??z.crapsPoint);const pe=Q??Z;return pe!==void 0&&(re.currentRollerId=pe),(Array.isArray(z.turnOrder)||Array.isArray(z.shooterOrder))&&(re.turnOrder=z.turnOrder||z.shooterOrder),re.gameMode||(re.gameMode="craps"),re.crapsPhase=re.crapsPoint?"point":"come-out",{...ce,gameState:re}})}catch{}s==null||s(oe)},onCrapsReadyUpdate:z=>{if(U)try{const O=Array.isArray(z==null?void 0:z.readyPlayers)?z.readyPlayers:void 0,q=Array.isArray(z==null?void 0:z.requiredReadyPlayers)?z.requiredReadyPlayers:void 0,X=z&&Object.prototype.hasOwnProperty.call(z,"deadline"),Z=X?typeof z.deadline=="number"?z.deadline:null:void 0,Q=(oe,ce)=>{if(!oe&&!ce)return!0;if(!oe||!ce||oe.length!==ce.length)return!1;for(let _e=0;_e<oe.length;_e++)if(oe[_e]!==ce[_e])return!1;return!0};O&&(Q(E.current,O)||(E.current=O.slice(),j(O))),q&&(Q(M.current,q)||(M.current=q.slice(),k(q))),X&&C.current!==Z&&(C.current=Z===void 0?C.current:Z,R(Z))}catch{}},onCrapsBetsUpdate:z=>{if(U)try{const O=(z==null?void 0:z.snapshot)||{},q=new Set(["currentRollerId","turnOrder","crapsPoint","crapsPhase"]);p(X=>{if(!X||X.id!==t)return X;const Z={...X.gameState||{}};for(const Q of Object.keys(O))q.has(Q)||(Z[Q]=O[Q]);return Z.gameMode||(Z.gameMode="craps"),{...X,gameState:Z}})}catch{}}}),l.useEffect(()=>{!t||!f||U&&$()},[t,f]),l.useEffect(()=>{try{const z=u==null?void 0:u.gameState;if(!z||z.gameMode!=="craps")return;const O=z.crapsReadiness;O&&(Array.isArray(O.readyPlayers)&&j(O.readyPlayers),Array.isArray(O.requiredReadyPlayers)&&k(O.requiredReadyPlayers),Object.prototype.hasOwnProperty.call(O,"deadline")&&R(typeof O.deadline=="number"?O.deadline:null))}catch{}},[u==null?void 0:u.gameState]),l.useEffect(()=>{if(!f||!t||!U)return;let z=0;const O=500,q=()=>{try{const oe=Date.now();if(oe-z<O)return;z=oe,$()}catch{}},X=()=>{document.visibilityState==="visible"&&q()},Z=()=>{q()},Q=()=>{q()};return window.addEventListener("visibilitychange",X),window.addEventListener("focus",Z),window.addEventListener("ad:complete",Q),()=>{window.removeEventListener("visibilitychange",X),window.removeEventListener("focus",Z),window.removeEventListener("ad:complete",Q)}},[f,t,$,U]),l.useEffect(()=>{t&&(async()=>{try{const z=await Xd(`craps-roll-history:${t}`);if(!z)return;if(z&&z.v===1&&Array.isArray(z.items)){if(typeof z.ts=="number"&&Date.now()-z.ts>72e5)return;const q=[];for(const X of z.items)if(!(!X||!Array.isArray(X.dice)||X.dice.length!==2)&&!(typeof X.total!="number"||typeof X.ts!="number")&&(q.push({roomId:t,dice:[Number(X.dice[0]),Number(X.dice[1])],total:Number(X.total),point:typeof X.point=="number"?X.point:X.point??null,currentRollerId:X.currentRollerId??null,nextRollerId:X.nextRollerId??null,events:Array.isArray(X.events)?X.events.slice(0,8):[],resolutions:X.resolutions||{passLineWins:!1,passLineLosses:!1,pushes:!1},ts:X.ts,phase:X.phase==="point"?"point":"come-out"}),q.length>=30))break;q.length&&x(q)}}catch{}})()},[t]),l.useEffect(()=>()=>{S.current&&(window.clearTimeout(S.current),S.current=null),F.current&&(window.clearTimeout(F.current),F.current=null),L.current&&(window.clearTimeout(L.current),L.current=null)},[]),{shooterState:h,lastRoll:b,rollHistory:y,rolling:v,inTurnOrder:G,joinOrder:K,leaveOrder:de,setOrder:ie,roll:we,resetShooter:he,passTurn:Ae,requestState:$,readyPlayers:w,readinessDeadline:T,requiredReadyPlayers:P,ready:z=>{if(!t||!f)return;const O=!!(u&&u.id===t);if(r&&!w.includes(r)&&j(q=>[...q,r]),T||R(Date.now()+5e3),!O){I.current={cb:z,at:Date.now()};try{L.current&&(window.clearTimeout(L.current),L.current=null),L.current=window.setTimeout(async()=>{var q,X;try{if(!I.current)return;const Z=await i(t),Q=(q=I.current)==null?void 0:q.cb;I.current=null,Q==null||Q(!!(Z!=null&&Z.ok),Z==null?void 0:Z.data)}catch{const Z=(X=I.current)==null?void 0:X.cb;I.current=null,Z==null||Z(!1)}finally{L.current&&(window.clearTimeout(L.current),L.current=null)}},600)}catch{}return}(async()=>{try{const q=await i(t);if(!(q!=null&&q.ok)){const X=String((q==null?void 0:q.error)||"");try{console.warn("[craps][ready] ack error",{err:X,roomId:t})}catch{}const Z=/forbidden|unauthorized/i.test(X),Q=/ready_failed/i.test(X);if(Z||Q){try{$()}catch{}try{const oe=await i(t);z==null||z(!!(oe!=null&&oe.ok),oe==null?void 0:oe.data);return}catch{}}z==null||z(!1);return}z==null||z(!0,q==null?void 0:q.data)}catch{try{setTimeout(async()=>{try{const q=await i(t);z==null||z(!!(q!=null&&q.ok),q==null?void 0:q.data)}catch{z==null||z(!1)}},400)}catch{z==null||z(!1)}}})()},iAmReady:!!(r&&w.includes(r)),clearRollHistory:()=>{x([]);try{t&&Yd(`craps-roll-history:${t}`)}catch{}}}}function Lde(e){const{roomId:t,userId:r,shooterState:n,roomGameState:s,myLineFromUnified:o,betsLastUpdated:i}=e;if(!t||!r)return!1;const c=s==null?void 0:s.currentRollerId,u=(n==null?void 0:n.currentRollerId)||null;if(!!!(r&&(c?c===r:u===r)))return!1;let d;const f=s==null?void 0:s.crapsPassBets,m=s==null?void 0:s.crapsDontPassBets;if(Array.isArray(f)||Array.isArray(m))d=!!(f!=null&&f.some(g=>g.playerId===r&&g.amount>0)||m!=null&&m.some(g=>g.playerId===r&&g.amount>0));else if(typeof i=="number")if(i===0)d=!0;else{const g=Number((o==null?void 0:o.pass)||0),y=Number((o==null?void 0:o.dontPass)||0);d=g>0||y>0}else{const g=Number((o==null?void 0:o.pass)||0),y=Number((o==null?void 0:o.dontPass)||0);d=g>0||y>0}if(!d)return!1;const h=Array.isArray(n==null?void 0:n.turnOrder)&&n.turnOrder.length?n.turnOrder:Array.isArray(s==null?void 0:s.turnOrder)?s.turnOrder:[];return!!(r&&h.includes(r))}const i_=new Map,l_={pass:[],dontPass:[],odds:[],place:[],field:[],big:[],come:[],dontCome:[],ats:[],lastUpdated:0};function V5(e){const{roomId:t,myPlayerId:r,autoListOnMount:n=!0,autoClearSettlementsMs:s=8e3}=e;Na();const{room:o,setRoom:i}=Is(),[c,u]=l.useState(l_),p=l.useRef(l_),[d,f]=l.useState([]),[m,h]=l.useState(null),[b,g]=l.useState(null),[y,x]=l.useState(null),[v,A]=l.useState([]),[_,w]=l.useState([]),[j,T]=l.useState(null),R=l.useRef(null),P=l.useRef(!1),k=l.useRef(0),E=l.useRef(new Map),{crapsListBets:M,crapsAddBet:C,crapsRemoveBet:I,crapsClearBets:L,crapsSummarizeBets:N}=sa(),S=l.useCallback(O=>{if(!t)return;const q=i_.get(t);if(q)return O&&q.then(Z=>O(Z)).catch(Z=>O({ok:!1,error:String((Z==null?void 0:Z.message)||Z)})),q;const X=M(t);return i_.set(t,X),X.finally(()=>{i_.delete(t)}),O&&X.then(Z=>O(Z)).catch(Z=>O({ok:!1,error:String((Z==null?void 0:Z.message)||Z)})),X},[M,t]),F=l.useCallback((O,q)=>{!r||q<=0||u(X=>{const Z={...X,lastUpdated:Date.now()};if(O==="pass")X.pass.find(oe=>oe.playerId===r)?Z.pass=X.pass.map(oe=>oe.playerId===r?{...oe,amount:oe.amount+q}:oe):Z.pass=[...X.pass,{playerId:r,amount:q}];else if(O==="dontPass")X.dontPass.find(oe=>oe.playerId===r)?Z.dontPass=X.dontPass.map(oe=>oe.playerId===r?{...oe,amount:oe.amount+q}:oe):Z.dontPass=[...X.dontPass,{playerId:r,amount:q}];else if(O.startsWith("place")){const Q=O.match(/^place(\d+)$/);if(Q){const oe=Number(Q[1]);X.place.find(_e=>_e.playerId===r&&_e.point===oe)?Z.place=X.place.map(_e=>_e.playerId===r&&_e.point===oe?{..._e,amount:_e.amount+q}:_e):Z.place=[...X.place,{playerId:r,point:oe,amount:q}]}}return p.current=Z,Z})},[r]),D=l.useCallback((O,q,X)=>{if(!t)return;F(O,q);const Z=C(t,O,q);return X&&Z.then(Q=>X(Q)).catch(Q=>X({ok:!1,error:String((Q==null?void 0:Q.message)||Q)})),Z},[C,t,F]),H=l.useCallback((O,q)=>{!r||q<=0||u(X=>{const Z={...X,lastUpdated:Date.now()};if(O==="pass"){const Q=[...Z.pass||[]],oe=Q.findIndex(ce=>ce.playerId===r);oe!==-1&&(Q[oe]={...Q[oe],amount:Math.max(0,Q[oe].amount-q)},Q[oe].amount===0&&Q.splice(oe,1)),Z.pass=Q}else if(O==="dontPass"){const Q=[...Z.dontPass||[]],oe=Q.findIndex(ce=>ce.playerId===r);oe!==-1&&(Q[oe]={...Q[oe],amount:Math.max(0,Q[oe].amount-q)},Q[oe].amount===0&&Q.splice(oe,1)),Z.dontPass=Q}else if(O.startsWith("place")){const Q=O.replace("place",""),oe=parseInt(Q,10);if(!isNaN(oe)){const ce=[...Z.place||[]],_e=ce.findIndex(re=>re.playerId===r&&re.point===oe);_e!==-1&&(ce[_e]={...ce[_e],amount:Math.max(0,ce[_e].amount-q)},ce[_e].amount===0&&ce.splice(_e,1)),Z.place=ce}}return p.current=Z,Z})},[r]),W=l.useCallback((O,q,X)=>{if(!t)return;H(O,q);const Z=I(t,O,q);return X&&Z.then(Q=>X(Q)).catch(Q=>X({ok:!1,error:String((Q==null?void 0:Q.message)||Q)})),Z},[I,t,H]),G=l.useCallback(O=>{if(!t)return;const q=L(t);return O&&q.then(X=>O(X)).catch(X=>O({ok:!1,error:String((X==null?void 0:X.message)||X)})),q},[L,t]),$=l.useCallback(O=>{if(!t)return;const q=N(t);return O&&q.then(X=>O(X)).catch(X=>O({ok:!1,error:String((X==null?void 0:X.message)||X)})),q},[N,t]),K=t&&r?`crapsbets:${t}:${r}`:null,de=30*60*1e3,ie=l.useCallback(async()=>{if(K)try{const O=await Xd(K);if(!O)return;const q=O.pass,X=O.dontPass,Z=Array.isArray(O.place)?O.place:[],Q=typeof O.ts=="number"?O.ts:void 0;if(Q&&Date.now()-Q>de||!(Z!=null&&Z.length)&&!q&&!X)return;u(oe=>{if(oe.lastUpdated!==0||oe.place.length+oe.pass.length+oe.dontPass.length>0)return oe;const ce={...oe};return q&&(ce.pass=[{playerId:r,amount:q}]),X&&(ce.dontPass=[{playerId:r,amount:X}]),Z!=null&&Z.length&&(ce.place=Z.map(_e=>({playerId:r,point:_e.point,amount:_e.amount}))),ce.lastUpdated=Date.now(),p.current=ce,ce})}catch{}},[K,r]);l.useEffect(()=>{ie()},[ie]);const we=l.useCallback(async()=>{var O,q;if(!(!K||!r||!t))try{const X=await Xd(K);if(!X)return;const Z=Number(X.pass||0),Q=Number(X.dontPass||0),oe=Array.isArray(X.place)?X.place:[],ce=Date.now();try{await S()}catch{}const _e=Date.now()+1200;for(;(p.current.lastUpdated||0)<=ce&&Date.now()<_e;)await new Promise(_t=>setTimeout(_t,120));if((p.current.lastUpdated||0)<=ce)return;const re=p.current,pe=((O=(re.pass||[]).find(_t=>_t.playerId===r))==null?void 0:O.amount)||0,ee=((q=(re.dontPass||[]).find(_t=>_t.playerId===r))==null?void 0:q.amount)||0,xe={};for(const _t of re.place||[])_t.playerId===r&&(xe[_t.point]=(xe[_t.point]||0)+_t.amount);const Le=Math.max(0,Z-pe),Ge=Math.max(0,Q-ee);if(Le>0)try{await C(t,"pass",Le)}catch{}if(Ge>0)try{await C(t,"dontPass",Ge)}catch{}for(const _t of oe){const Xe=Number(_t.point),bt=Number(_t.amount||0),Pt=Number(xe[Xe]||0),kt=Math.max(0,bt-Pt);if(kt>0)try{const Ee=`place${Xe}`;await C(t,Ee,kt)}catch{}}}catch{}},[K,r,t,S,c,C]),he=l.useCallback(O=>{!O||typeof O!="object"||u(q=>{const X={pass:Array.isArray(O.crapsPassBets)?O.crapsPassBets:q.pass,dontPass:Array.isArray(O.crapsDontPassBets)?O.crapsDontPassBets:q.dontPass,odds:Array.isArray(O.crapsOddsBets)?O.crapsOddsBets:q.odds,place:Array.isArray(O.crapsPlaceBets)?O.crapsPlaceBets:q.place,field:Array.isArray(O.crapsFieldBets)?O.crapsFieldBets:q.field,big:Array.isArray(O.crapsBigBets)?O.crapsBigBets:q.big,come:Array.isArray(O.crapsComeBets)?O.crapsComeBets:q.come,dontCome:Array.isArray(O.crapsDontComeBets)?O.crapsDontComeBets:q.dontCome,ats:Array.isArray(O.crapsAtsBets)?O.crapsAtsBets:q.ats,lastUpdated:Date.now()};return p.current=X,X})},[]),Ae=l.useCallback((O,q,X)=>{if(!t||O!==t)return;f(q),k.current+=1;const Z={...X||{},_seq:k.current};h(Z);try{i(oe=>{if(!oe||oe.id!==t)return oe;const ce={...oe.gameState||{}};return ce.lastCrapsSettlementsTs=Date.now(),ce.lastCrapsSettlements=q,{...oe,gameState:ce}})}catch{}const Q=new Map;for(const oe of q)oe.outcome==="WIN"&&oe.playerId&&Q.set(oe.playerId,(Q.get(oe.playerId)||0)+1);for(const[oe,ce]of Q){const _e=E.current.get(oe)||0,re=_e+ce;if(E.current.set(oe,re),_e>=6&&re>_e)TS(7,.55);else for(const pe of[3,4,5,6])if(_e<pe&&re>=pe){TS(pe,.55);break}if(oe===r)try{window.dispatchEvent(new CustomEvent("craps:streak",{detail:{streak:re}}))}catch{}}R.current&&clearTimeout(R.current),R.current=setTimeout(()=>f([]),s)},[t,i,s]);Ba({onCrapsRollResult:O=>{try{if(!t||(O==null?void 0:O.roomId)!==t)return;const q=Array.isArray(O==null?void 0:O.events)?O.events:[],X=q.includes("crapsOut")||q.includes("CRAPS_OUT"),Z=q.includes("sevenOut")||q.includes("SEVEN_OUT");if(X||Z){E.current.clear();try{window.dispatchEvent(new CustomEvent("craps:streak",{detail:{streak:0}}))}catch{}}if(Z){u(Q=>{if(!Q.place.length)return Q;const oe={...Q,place:[],lastUpdated:Date.now()};return p.current=oe,oe});try{i(Q=>{if(!Q||Q.id!==t)return Q;const oe={...Q.gameState||{}};return oe.crapsPlaceBets=[],{...Q,gameState:oe}})}catch{}}}catch{}},onJoinedRoom:async({room:O})=>{try{if(O!=null&&O.id&&O.id===t){try{await S()}catch{}try{await we()}catch{}}}catch{}},onRejoinedRoom:async({room:O})=>{try{if(O!=null&&O.id&&O.id===t){try{await S()}catch{}try{await we()}catch{}}}catch{}},onCrapsReadyUpdate:O=>{try{if(console.log("[useCrapsBetsUnified] onCrapsReadyUpdate received",O),Array.isArray(O==null?void 0:O.readyPlayers)&&A(O.readyPlayers),Array.isArray(O==null?void 0:O.requiredReadyPlayers)&&w(O.requiredReadyPlayers),O&&Object.prototype.hasOwnProperty.call(O,"deadline")){const q=typeof O.deadline=="number"?O.deadline:null;T(q)}}catch{}},onCrapsBetsUpdate:O=>{if(!t||(O==null?void 0:O.roomId)!==t)return;const q=O==null?void 0:O.snapshot;if(q){he(q);const X=new Set(["currentRollerId","turnOrder","crapsPoint","crapsPhase"]);try{i(Z=>{if(!Z||Z.id!==t)return Z;const Q={...Z.gameState||{}};for(const oe of Object.keys(q))X.has(oe)||(Q[oe]=q[oe]);return Q.gameMode||(Q.gameMode="craps"),{...Z,gameState:Q}})}catch{}}K&&r&&(async()=>{var X,Z;try{const Q=((X=((q==null?void 0:q.crapsPassBets)||[]).find(re=>re.playerId===r))==null?void 0:X.amount)||0,oe=((Z=((q==null?void 0:q.crapsDontPassBets)||[]).find(re=>re.playerId===r))==null?void 0:Z.amount)||0,ce=((q==null?void 0:q.crapsPlaceBets)||[]).filter(re=>re.playerId===r).map(re=>({point:re.point,amount:re.amount})),_e={v:1,ts:Date.now(),pass:Q,dontPass:oe,place:ce};Q||oe||ce.length?await Qy(K,_e):await Yd(K)}catch{}})()},onCrapsBetResults:O=>{const q=Array.isArray(O==null?void 0:O.settlements)?O.settlements:[];Ae(O==null?void 0:O.roomId,q,O==null?void 0:O.roll)},onCrapsPointSet:O=>{if(!t||(O==null?void 0:O.roomId)!==t)return;const q=O.currentRollerId||O.nextRollerId||"unknown",X=`ptSet:${O.point}:${Array.isArray(O.dice)?O.dice.join("-"):""}:${q}`;g({...O,_key:X});try{i(Z=>{if(!Z||Z.id!==t)return Z;const Q={...Z.gameState||{}};return Q.gameMode=Q.gameMode||"craps",Q.crapsPoint=typeof O.point=="number"?O.point:O.point??null,Q.crapsPhase=Q.crapsPoint?"point":"come-out",O.currentRollerId!==void 0&&(Q.currentRollerId=O.currentRollerId),Array.isArray(O.turnOrder)&&(Q.turnOrder=O.turnOrder),{...Z,gameState:Q}})}catch{}},onCrapsPointMade:O=>{if(!t||(O==null?void 0:O.roomId)!==t)return;const q=O.currentRollerId||O.nextRollerId||"unknown",X=`ptMade:${O.point}:${Array.isArray(O.dice)?O.dice.join("-"):""}:${q}`;x({...O,_key:X});try{i(Z=>{if(!Z||Z.id!==t)return Z;const Q={...Z.gameState||{}};return Q.gameMode=Q.gameMode||"craps",Q.crapsPoint=null,Q.crapsPhase="come-out",O.nextRollerId!==void 0&&(Q.currentRollerId=O.nextRollerId),Array.isArray(O.turnOrder)&&(Q.turnOrder=O.turnOrder),{...Z,gameState:Q}})}catch{}}}),l.useEffect(()=>{if(!t){u(l_),P.current=!1,f([]),h(null);return}const O=o==null?void 0:o.gameState;O&&(O.crapsPassBets||O.crapsDontPassBets)&&he(O),n&&!P.current&&(P.current=!0,S())},[t]),l.useEffect(()=>{if(!t)return;const O=async()=>{await new Promise(q=>setTimeout(q,300));try{await S()}catch{}try{await we()}catch{}};return window.addEventListener("ad:complete",O),()=>{window.removeEventListener("ad:complete",O)}},[t,S,we]),l.useEffect(()=>()=>{R.current&&clearTimeout(R.current)},[]);const Fe=l.useMemo(()=>c.pass.reduce((O,q)=>O+q.amount,0),[c.pass]),U=l.useMemo(()=>c.dontPass.reduce((O,q)=>O+q.amount,0),[c.dontPass]),V=l.useMemo(()=>c.field.reduce((O,q)=>O+q.amount,0),[c.field]),z=l.useMemo(()=>r?{pass:c.pass.filter(O=>O.playerId===r).reduce((O,q)=>O+q.amount,0),dontPass:c.dontPass.filter(O=>O.playerId===r).reduce((O,q)=>O+q.amount,0)}:{pass:0,dontPass:0},[c.pass,c.dontPass,r]);return{betsState:c,recentSettlements:d,lastSettlementRoll:m,_persistKey:K,passTotal:Fe,dontPassTotal:U,fieldTotal:V,myLine:z,listBets:S,addBet:D,removeBet:W,clearBets:G,summarize:$,clearRecentSettlements:()=>f([]),pointSetEvent:b,pointMadeEvent:y,readyPlayers:v,requiredReadyPlayers:_,readinessDeadline:j}}function Dde(){try{if(typeof window>"u")return!1;const e=window;return e.__E2E===!0||typeof e.location<"u"&&!!e.location.search&&e.location.search.includes("e2e=1")||typeof e.sessionStorage<"u"&&e.sessionStorage.getItem("e2e")==="1"}catch{return!1}}function Fi(e,t){if(!Array.isArray(e)||!t)return 0;let r=0;for(const n of e)n.playerId===t&&(r+=Number(n.amount)||0);return r}function Gp(e,t){if(!Array.isArray(e)||!t)return 0;let r=0;for(const n of e)n.playerId!==t&&(r+=Number(n.amount)||0);return r}function mc(e,t,r){if(!Array.isArray(e)||!t)return 0;let n=0;for(const s of e)s.playerId===t&&r(s)&&(n+=Number(s.amount)||0);return n}function nR(e,t,r){if(!Array.isArray(e)||!t)return 0;let n=0;for(const s of e)s.playerId!==t&&r(s)&&(n+=Number(s.amount)||0);return n}function Ode(e,t){const r={};if(!Array.isArray(e)||!t)return r;for(const n of e){if(n.playerId!==t)continue;const s=Number(n.point);r[s]=(r[s]||0)+(Number(n.amount)||0)}return r}function Ju(e,t,r){if(!Array.isArray(e)||!t)return 0;let n=0;for(const s of e)s.playerId!==t&&Number(s.point)===r&&(n+=Number(s.amount)||0);return n}function zde(e,t){const[r,n]=l.useState(e.point),[s,o]=l.useState(e.phase);return l.useEffect(()=>{t&&(n(e.point),o(e.phase))},[t,e.point,e.phase]),{displayPoint:r,displayPhase:s}}function Bde({balance:e,meId:t,readyPlayers:r,onChargeChange:n,onRollAffordanceChange:s}){var Pt,kt,Ee;const{user:o,meId:i}=Zr(),{room:c,setRoom:u}=Is(),p=(c==null?void 0:c.id)??null,d=l.useMemo(()=>Dde(),[]),f=l.useMemo(()=>{if(i)return i;const le=o;return(le==null?void 0:le.id)??(le==null?void 0:le.email)??""},[o,i]),m=l.useMemo(()=>t||f,[t,f]),[h,b]=l.useState([]),{shooterState:g,roll:y,rolling:x,readyPlayers:v,ready:A,passTurn:_}=q5({roomId:p,myPlayerId:m}),w=V5({roomId:p,myPlayerId:m}),j=l.useMemo(()=>Array.isArray(r)?r:Array.isArray(w.readyPlayers)&&w.readyPlayers.length>0?w.readyPlayers:v,[r,w.readyPlayers,v]),T=l.useMemo(()=>({addBet:w.addBet,removeBet:w.removeBet,clearBets:w.clearBets}),[w.addBet,w.removeBet,w.clearBets]),R=w.betsState||{},P=R.pass||[],k=R.dontPass||[],E=R.place||[],M=R.field||[],C=R.big||[],I=R.come||[],L=R.dontCome||[],N=R.odds||[],S=R.ats||[],F=l.useMemo(()=>Ode(E,m),[E,m]),D=l.useMemo(()=>{let le=0;for(const De of[4,5,6,8,9,10])le+=F[De]||0;return le},[F]),H=l.useMemo(()=>{var Ue,ct;const le={};if(!m)return le;const De=((Ue=w.myLine)==null?void 0:Ue.pass)??Fi(P,m),Ye=((ct=w.myLine)==null?void 0:ct.dontPass)??Fi(k,m);De>0&&(le.pass=De),Ye>0&&(le.dontPass=Ye);for(const dt of[4,5,6,8,9,10]){const Rt=F[dt]||0;Rt>0&&(le[`place${dt}`]=Rt)}const Re=Fi(M,m);Re>0&&(le.field=Re);const et=mc(C,m,dt=>dt.kind==="big6");et>0&&(le.big6=et);const rt=mc(C,m,dt=>dt.kind==="big8");rt>0&&(le.big8=rt);const ne=Fi(I,m);ne>0&&(le.come=ne);const ue=Fi(L,m);ue>0&&(le.dontCome=ue);const B=mc(N,m,dt=>dt.passType==="pass");B>0&&(le.oddsPass=B);const fe=mc(N,m,dt=>dt.passType==="dontPass");fe>0&&(le.oddsDontPass=fe);const ye=mc(S,m,dt=>dt.kind==="atsSmall");ye>0&&(le.atsSmall=ye);const ve=mc(S,m,dt=>dt.kind==="atsTall");ve>0&&(le.atsTall=ve);const ke=mc(S,m,dt=>dt.kind==="atsAll");return ke>0&&(le.atsAll=ke),le},[m,(Pt=w.myLine)==null?void 0:Pt.pass,(kt=w.myLine)==null?void 0:kt.dontPass,P,k,F,M,C,I,L,N,S]),W=l.useMemo(()=>{const le=m;return le?{pass:Gp(P,le),dontPass:Gp(k,le),field:Gp(M,le),big6:nR(C,le,De=>De.kind==="big6"),big8:nR(C,le,De=>De.kind==="big8"),come:Gp(I,le),dontCome:Gp(L,le),place4:Ju(E,le,4),place5:Ju(E,le,5),place6:Ju(E,le,6),place8:Ju(E,le,8),place9:Ju(E,le,9),place10:Ju(E,le,10)}:{}},[m,P,k,M,C,I,L,E]),G=l.useCallback(le=>b(le),[]),$=l.useRef(0),K=l.useCallback(()=>{if(!p||!m||!h.length)return;const le=Date.now();if(!(le-$.current<1e3)){$.current=le;try{const De=Fi(P,m),Ye=Fi(k,m),Re=F;for(const et of h){const rt=et.type;let ne=0;if(rt==="pass")ne=De;else if(rt==="dontPass")ne=Ye;else if(rt.startsWith("place")){const fe=parseInt(rt.replace("place",""),10);ne=Re[fe]||0}else continue;const ue=Math.max(0,Number(et.amount)||0),B=Math.max(0,ue-ne);if(B>0)try{T.addBet(rt,B)}catch{}}}catch{}}},[p,m,h,P,k,F,T]);Ba({onJoinedRoom:({room:le})=>{(le==null?void 0:le.id)===p&&K()},onRejoinedRoom:({room:le})=>{(le==null?void 0:le.id)===p&&K()}}),l.useEffect(()=>{if(!m)return;const le=h.filter(De=>{if(De.type==="pass")return!(Fi(P,m)>=De.amount);if(De.type==="dontPass")return!(Fi(k,m)>=De.amount);if(De.type.startsWith("place")){const Ye=parseInt(De.type.replace("place",""),10);return!((F[Ye]||0)>=De.amount)}return!0});le.length!==h.length&&b(le)},[m,P,k,F,h]),l.useEffect(()=>{if(!p||!m||!u||!d)return;const le=c==null?void 0:c.gameState,De=le==null?void 0:le.currentRollerId;if(!De||De!==m)return;const Ye=le==null?void 0:le.crapsPassBets,Re=le==null?void 0:le.crapsDontPassBets;if(!(Ye!=null&&Ye.some(rt=>rt.playerId===m&&rt.amount>0)||Re!=null&&Re.some(rt=>rt.playerId===m&&rt.amount>0)))try{u(rt=>{if(!rt||rt.id!==p)return rt;const ne=rt.gameState||{},ue=Array.isArray(ne.crapsPassBets)?ne.crapsPassBets.slice():[];return ue.push({playerId:m,amount:10}),{...rt,gameState:{...ne,crapsPassBets:ue,gameMode:ne.gameMode||"craps"}}})}catch{}},[p,c==null?void 0:c.gameState,m,u,d]);const de=l.useCallback((le,De)=>{p&&(De>0?T.addBet(le,De):De<0&&T.removeBet(le,Math.abs(De)))},[p,T]),ie=l.useMemo(()=>{const le=c==null?void 0:c.gameState;if((le==null?void 0:le.gameMode)==="craps"){const De=le.crapsPhase||(g!=null&&g.point?"point":"comeOut");return{point:le.crapsPoint??(g==null?void 0:g.point)??null,phase:De==="point"?"point":"comeOut"}}return{point:(g==null?void 0:g.point)??null,phase:g!=null&&g.point?"point":"comeOut"}},[c==null?void 0:c.gameState,g]),{reveal:we}=Ti(),{displayPoint:he,displayPhase:Ae}=zde(ie,we);l.useEffect(()=>{if(ie.point==null&&we){const le=h.filter(De=>!De.type.startsWith("place"));le.length!==h.length&&b(le)}},[ie.point,we,h]);const Fe=c==null?void 0:c.gameState,U=w.readinessDeadline??null,V=w.requiredReadyPlayers??[],z=Lde({roomId:p,userId:f,shooterState:g,roomGameState:Fe,myLineFromUnified:w.myLine,betsLastUpdated:(Ee=w.betsState)==null?void 0:Ee.lastUpdated}),O=d?!0:z&&!x;l.useEffect(()=>(s==null||s({canRoll:O,roll:()=>y()}),()=>{s==null||s({canRoll:!1,roll:()=>{}})}),[O,s,y]),l.useEffect(()=>{try{if(!d)return;window.__debugCanRoll={canRoll:O,userId:o==null?void 0:o.id,rolling:x,shooterState:g,roomGS:Fe,readyPlayers:j,requiredReadyPlayers:V,readinessDeadline:U}}catch{}},[O,o,x,g,Fe,j,V,U,d]);const q=!p,X=l.useMemo(()=>{var De;const le=(De=c==null?void 0:c.gameState)==null?void 0:De.currentRollerId;return m?le===m:!1},[c==null?void 0:c.gameState,m]),Z=l.useMemo(()=>{const le=X&&ie.phase==="comeOut"&&ie.point===null;return console.log("[CrapsBetSection] canPassTurn",{isCurrentShooter:X,phase:ie.phase,point:ie.point,result:le}),le},[X,ie.phase,ie.point]),Q=!!(m&&j.includes(m)),[oe,ce]=l.useState(!1);l.useEffect(()=>{Q&&ce(!1)},[Q]);const _e=l.useRef(null),re=l.useCallback(()=>{if(!(!p||!m||oe||Q)){ce(!0);try{A()}catch{}_e.current&&window.clearTimeout(_e.current),_e.current=window.setTimeout(()=>{ce(!1)},5e3)}},[p,m,oe,Q,A]);l.useEffect(()=>()=>{_e.current&&window.clearTimeout(_e.current)},[]);const[pe,ee]=l.useState(Date.now());l.useEffect(()=>{if(!U)return;const le=window.setInterval(()=>ee(Date.now()),1e3);return()=>window.clearInterval(le)},[U]);const xe=U?Math.max(0,Math.ceil((U-pe)/1e3)):0,Le=l.useMemo(()=>{var le,De;try{const Ye=((le=c==null?void 0:c.gameState)==null?void 0:le.currentRollerId)??null;if(!Ye)return null;const Re=(De=c==null?void 0:c.players)==null?void 0:De.find(et=>et.id===Ye);return(Re==null?void 0:Re.name)||(Re==null?void 0:Re.id)||null}catch{return null}},[c==null?void 0:c.gameState,c==null?void 0:c.players]),Ge=5,_t=500,Xe=l.useMemo(()=>[1,5,10,25,100],[]);return a.jsx(U5,{roomId:p,balance:e,point:he,phase:Ae,shooterName:Le,minBet:Ge,maxBet:_t,oddsMultiple:{pass:3,dontPass:3,place:1},chips:Xe,pendingBets:h,onChangeBets:G,onClearAll:()=>{b([]),T.clearBets()},disabled:q,onRoll:()=>y(),canRoll:O,myPlayerPlaceTotal:D,myCommittedByType:H,readyPlayers:j,meId:m,onBetDelta:de,showReadyButton:!X,onReadyClick:re,readyStateLabel:"Ready",readyButtonDisabled:x||oe||Q,countdownSeconds:xe,recentSettlements:w.recentSettlements,myPlayerLineTotals:w.myLine,othersTotals:W,onPassTurn:()=>{console.log("[CrapsBetSection] onPassTurn called, invoking passTurn()"),_()},canPassTurn:Z,onChargeChange:n})}function Fde({balance:e,meId:t,readyPlayers:r,onChargeChange:n,onRollAffordanceChange:s}){return a.jsx("div",{className:"craps-bet-panel",children:a.jsx(Bde,{balance:e,meId:t,readyPlayers:r,onChargeChange:n,onRollAffordanceChange:s})})}function aR({missions:e,streak:t,completedCount:r,totalCount:n}){const s=e.find(i=>!i.completed)||e[0],o=s!=null&&s.target?Math.min(100,Math.round(s.progress/s.target*100)):0;return a.jsxs("section",{className:"daily-missions","aria-label":"Daily missions",children:[a.jsxs("div",{className:"daily-missions__head",children:[a.jsx("span",{className:"daily-missions__title",children:"Daily"}),a.jsxs("span",{className:"daily-missions__meta",children:[r,"/",n," · ",t,"d streak"]})]}),a.jsxs("div",{className:`daily-missions__focus${s!=null&&s.completed?" daily-missions__focus--done":""}`,children:[a.jsx("span",{className:"daily-missions__label",children:(s==null?void 0:s.label)||"Missions complete"}),a.jsx("b",{className:"daily-missions__count",children:s!=null&&s.completed?"Done":`${(s==null?void 0:s.progress)||0}/${(s==null?void 0:s.target)||0}`}),a.jsx("div",{className:"daily-missions__bar","aria-hidden":"true",children:a.jsx("span",{style:{width:`${o}%`}})})]})]})}function Ude(){var f;const{infoNow:e}=As(),{room:t}=Is(),{meId:r}=Zr(),n=(t==null?void 0:t.gameMode)||((f=t==null?void 0:t.gameState)==null?void 0:f.gameMode),s=n==="craps",o=n==="cee-lo"||!n,i=!(t!=null&&t.singlePlayer),c=l.useRef({roundSeq:0,seen:new Set}),u=l.useRef(new Map),p=l.useRef(new Map),d=m=>{if(!m)return"Unknown";const h=((t==null?void 0:t.players)||[]).find(b=>b.id===m);return(h==null?void 0:h.name)||"Player"};return Ba({onBetsUpdated:m=>{try{const h=Number((m==null?void 0:m.roundSeq)??0)||0,b=Array.isArray(m==null?void 0:m.openAll)?m.openAll:[];c.current.roundSeq!==h&&(c.current={roundSeq:h,seen:new Set},p.current.clear());const g=c.current.seen;if(g.size===0&&b.length>0){for(const v of b)v!=null&&v.id&&g.add(v.id);p.current=new Map(b.filter(Boolean).map(v=>[v.id,v]));return}const y=p.current,x=new Map(b.filter(Boolean).map(v=>[v.id,v]));for(const v of b)if(!(!v||!v.id)&&!g.has(v.id)){if(g.add(v.id),v.type==="MAIN"){if(!(o&&i)||s&&r&&v.playerId===r)continue;const A=d(v.playerId),_=Math.max(0,Math.trunc(Number(v.amount)||0));_>0&&e("Main bet placed",`+z${_} — ${A}`)}else if(v.type==="SIDE"){const A=d(v.subjectId),_=Math.max(0,Math.trunc(Number(v.amount)||0));if(v.acceptedById){const w=d(v.acceptedById);_>0&&e("Side bet accepted",`z${_} — ${w} on ${A}`)}else{if(s&&r&&v.playerId===r)continue;_>0&&e("Side bet created",`+z${_} — on ${A}`)}}}for(const[v,A]of y.entries()){const _=x.get(v);if(A&&A.type==="SIDE"&&_&&_.type==="SIDE"&&!A.acceptedById&&_.acceptedById){const w=d(_.subjectId),j=Math.max(0,Math.trunc(Number(_.amount)||0)),T=d(_.acceptedById);j>0&&e("Side bet accepted",`z${j} — ${T} on ${w}`)}}for(const[v,A]of y.entries()){if((A==null?void 0:A.type)!=="SIDE")continue;if(!x.has(v)&&!A.acceptedById){const w=d(A.subjectId),j=Math.max(0,Math.trunc(Number(A.amount)||0));j>0&&e("Side bet cancelled",`-z${j} — on ${w}`)}}p.current=x}catch{}},onCrapsBetsUpdate:m=>{try{const h=(m==null?void 0:m.snapshot)||{},b=u.current,g=new Map,y=(A,_)=>{g.set(A,(g.get(A)||0)+(Number.isFinite(_)?_:0))},x=A=>{const _=A.split("|"),w=_[0],j=_[1]||"",T=d(w);if(j.startsWith("place:"))return`Place ${j.split(":")[1]} — ${T}`;switch(j){case"pass":return`Pass — ${T}`;case"dontPass":return`Don't Pass — ${T}`;case"field":return`Field — ${T}`;case"big6":return`Big 6 — ${T}`;case"big8":return`Big 8 — ${T}`;default:return`${j} — ${T}`}},v=A=>Array.isArray(A)?A:[];for(const{playerId:A,amount:_}of v(h.crapsPassBets))y(`${A}|pass`,_);for(const{playerId:A,amount:_}of v(h.crapsDontPassBets))y(`${A}|dontPass`,_);for(const{playerId:A,amount:_}of v(h.crapsFieldBets))y(`${A}|field`,_);for(const{playerId:A,kind:_,amount:w}of v(h.crapsBigBets))y(`${A}|${_}`,w);for(const{playerId:A,point:_,amount:w}of v(h.crapsPlaceBets))y(`${A}|place:${_}`,w);for(const{playerId:A,amount:_,status:w,point:j}of v(h.crapsComeBets))y(`${A}|come${w==="POINT"&&j?":"+j:""}`,_);for(const{playerId:A,amount:_,status:w,point:j}of v(h.crapsDontComeBets))y(`${A}|dontCome${w==="POINT"&&j?":"+j:""}`,_);if(b.size===0){u.current=g;return}for(const[A,_]of g.entries()){const w=b.get(A)||0,j=Math.trunc(_-w);if(j>0){if(r&&A.startsWith(r+"|"))continue;e("Bet Placed",`+z${j} — ${x(A)}`)}}u.current=g}catch{}}}),l.useEffect(()=>{},[]),null}function qde(e,t){const{rollDice:r,placeMainBet:n,cancelMainBet:s,createSideBet:o,acceptSideBet:i,cancelSideBet:c,confirmBets:u,bankerGiveUp:p,setSpectate:d,getWagers:f}=sa(),m=h=>{if(e)try{return h()}catch(b){return Promise.resolve({ok:!1,error:(b==null?void 0:b.message)||"ERR"})}};return{roll:h=>m(()=>r(e).then(b=>(h==null||h(b),b)).catch(b=>{const g={ok:!1,error:(b==null?void 0:b.message)||"ERR"};return h==null||h(g),g})),confirmBets:h=>m(()=>u(e).then(b=>(h==null||h(b),b)).catch(b=>{const g={ok:!1,error:(b==null?void 0:b.message)||"ERR"};return h==null||h(g),g})),placeMain:(h,b)=>m(()=>n(e,h).then(g=>(b==null||b(g),g)).catch(g=>{const y={ok:!1,error:(g==null?void 0:g.message)||"ERR"};return b==null||b(y),y})),cancelMain:(h,b)=>m(()=>s(e,h).then(g=>(b==null||b(g),g)).catch(g=>{const y={ok:!1,error:(g==null?void 0:g.message)||"ERR"};return b==null||b(y),y})),createSide:(h,b,g)=>m(()=>o(e,{amount:h,...b||{}}).then(y=>(g==null||g(y),y)).catch(y=>{const x={ok:!1,error:(y==null?void 0:y.message)||"ERR"};return g==null||g(x),x})),acceptSide:(h,b)=>m(()=>i(e,h).then(g=>(b==null||b(g),g)).catch(g=>{const y={ok:!1,error:(g==null?void 0:g.message)||"ERR"};return b==null||b(y),y})),cancelSide:(h,b)=>m(()=>c(e,h).then(g=>(b==null||b(g),g)).catch(g=>{const y={ok:!1,error:(g==null?void 0:g.message)||"ERR"};return b==null||b(y),y})),giveUpBank:h=>m(()=>p(e).then(b=>(h==null||h(b),b)).catch(b=>{const g={ok:!1,error:(b==null?void 0:b.message)||"ERR"};return h==null||h(g),g})),spectate:(h,b)=>m(()=>d(e,h).then(g=>(b==null||b(g),g)).catch(g=>{const y={ok:!1,error:(g==null?void 0:g.message)||"ERR"};return b==null||b(y),y})),refreshWagers:()=>{if(e)try{f(e)}catch{}}}}function Vde(e){const{isMyTurn:t,isBanker:r,diceSettled:n,hasMainBetPlaced:s,bankPointExists:o,roundEnded:i}=e;return t?n?i?{canRoll:!1,reason:"Round transition in progress"}:r&&o?{canRoll:!1,reason:"Banker point established"}:!r&&!s?{canRoll:!1,reason:"Place a main bet first"}:{canRoll:!0}:{canRoll:!1,reason:"Dice not settled"}:{canRoll:!1,reason:"Not your turn"}}const jh=Object.create(null);function Hde(){switch(Oa){case"ceelo":return"cee-lo";case"craps":return"craps";case"poker":return"poker";case"skills":return"skills";default:return null}}function sR(e){var n,s;const t=Hde();if(!t)return!0;const r=((n=e==null?void 0:e.gameState)==null?void 0:n.gameMode)||((s=e==null?void 0:e.gameState)==null?void 0:s.mode);return r?r===t:!0}function oR(e,t){if(!t)return"Anonymous";const r=e.find(n=>n.id===t);return(r==null?void 0:r.name)||"Anonymous"}function Wde(e){switch((e||"").toLowerCase()){case"beatsbank":return"Beats Banker";case"losestobank":return"Loses to Banker";case"tiesbank":return"Ties Banker";default:return e||"Side Bet"}}function c_(e,t){const[r,n]=l.useState(t),s=l.useRef(!1);return l.useEffect(()=>{if(!e)return;let o=!1;return(async()=>{try{const i=await Xd(e);!o&&i!==null&&n(i)}catch{}s.current=!0})(),()=>{o=!0}},[e]),l.useEffect(()=>{e&&s.current&&(async()=>{try{await Qy(e,r)}catch{}})()},[e,r]),[r,n]}function s1(e,t,r){var kt;const{info:n}=vb(),s=(r==null?void 0:r.autoJoin)??!0,o=Hr(),i=ji(),{leaveRoom:c}=sa(),{joinRoom:u}=Is(),p=u,d=qde(e||null),{reveal:f,rollTrigger:m,triggerSpin:h}=Ti(),{user:b}=Zr(),[g,y]=l.useState(null),{room:x}=Is(),v=(()=>{try{return Is&&Is()}catch{return null}})(),A=(v==null?void 0:v.setRoom)??null;l.useRef(null);const[_,w]=l.useState(!0),[j,T]=l.useState(null),[R,P]=l.useState(null),k=l.useRef(null),E=l.useRef(null),M=l.useRef(null);l.useRef([]);const[C,I]=l.useState(!0),[L,N]=l.useState(void 0),[S,F]=c_(e?`gp:${e}:${t}:deadline`:void 0,30),[D,H]=c_(e?`gp:${e}:${t}:serverNow`:void 0,30),[W,G]=c_(e?`gp:${e}:${t}:feed`:void 0,[]),[$,K]=l.useState([]),[de,ie]=l.useState(null),[we,he]=l.useState([]),[Ae,Fe]=l.useState(!1),[U,V]=l.useState(!1),z=l.useRef(null),O=l.useRef(null);l.useEffect(()=>{e&&(async()=>{try{await Yd(`gp:${e}:${t}:diceSettled`),await Yd(`gp:${e}:${t}:diceResults`)}catch{}})()},[e,t]),l.useEffect(()=>()=>{z.current&&(window.clearTimeout(z.current),z.current=null)},[]),l.useEffect(()=>{var Ye,Re;if(!g||!g.singlePlayer){Fe(!1),V(!1),z.current&&(window.clearTimeout(z.current),z.current=null),O.current=null;return}const le=(((Ye=g.gameState)==null?void 0:Ye.gameMode)||((Re=g.gameState)==null?void 0:Re.mode))==="craps"?1:3;if(g.players.length>=le+1){U||V(!0),Fe(!1),z.current&&(window.clearTimeout(z.current),z.current=null),O.current=null;return}U||(z.current||(z.current=window.setTimeout(()=>{Fe(!0),z.current=null},250)),O.current?Date.now()>O.current&&(V(!0),Fe(!1)):O.current=Date.now()+5e3)},[g,U]);const q=(r==null?void 0:r.listeners)??!0;Ba(q?{onJoinedRoom:({room:Ee})=>{y(Ee),G(le=>[{kind:"system",message:`You joined ${Ee.name}`,ts:Date.now()},...le]);try{C===!1&&(E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{C===!1&&!k.current&&I(!0),E.current=null},ha.diceSettleClientMs));const le=(Ee==null?void 0:Ee.gameState)||{};!(le!=null&&le.bankRoll)&&!(le!=null&&le.lastRoll)&&C===!1&&!k.current&&I(!0)}catch{}},onRejoinedRoom:({room:Ee})=>{sR(Ee)&&(y(Ee),G(le=>[{kind:"system",message:`Rejoined ${Ee.name}`,ts:Date.now()},...le]))},onOtherLeft:({room:Ee})=>{y(Ee)},onOtherPlayerJoined:({room:Ee})=>{y(Ee),G(le=>[{kind:"system",message:"Another player joined.",ts:Date.now()},...le])},onSpectatorsUpdated:Ee=>{const{spectators:le,roundSeq:De}=Ee||{};y(Ye=>{var et;if(!Ye)return Ye;const Re=(et=Ye.gameState)==null?void 0:et.roundSeq;return typeof De=="number"&&typeof Re=="number"&&De!==Re?Ye:{...Ye,gameState:{...Ye.gameState,spectators:le??[]}}})},onDiceRolled:Ee=>{const{rollerId:le,results:De,rank:Ye,room:Re,deadline:et,serverNow:rt}=Ee;F(et),I(!1),E.current&&(window.clearTimeout(E.current),E.current=null),k.current&&window.clearTimeout(k.current),M.current=Date.now(),N(void 0),h();const ne=2e3,ue=600,B=M.current?Date.now()-M.current:0,fe=Math.max(ne-B,0)+ue;k.current=window.setTimeout(()=>{I(!0),M.current=null,Re&&y(ye=>ye?{...ye,...Re,spLevel:Re.spLevel??ye.spLevel,levelName:Re.levelName??ye.levelName}:Re),k.current=null},fe),H(rt),P(le),N(De)},onBetsUpdated:Ee=>{var le;(le=Ee.room)!=null&&le.players&&y(De=>{if(!De)return De;const Ye=Array.isArray(Ee.room.players)?Ee.room.players:[];if(!Ye.length)return De;const Re=new Map((De.players??[]).map(et=>[et.id,et]));for(const et of Ye){const rt=Re.get(et.id);Re.set(et.id,rt?{...rt,...et}:et)}return{...De,players:Array.from(Re.values())}})},onSideBetCreated:Ee=>{if(!Ee||Ee.acceptedById||!Ee.subjectId||Ee.subjectId!==t)return;const De=`${oR((g==null?void 0:g.players)??[],Ee.playerId)} offered: ${Wde(Ee.predicate)} for z${Ee.amount}`;i.info(De,{title:"New Side Bet"})},onLobbyRooms:void 0,onNotYourTurn:()=>{G(Ee=>[{kind:"system",message:"It’s not your turn.",ts:Date.now()},...Ee])},onForceLogout:Ee=>{(Ee==null?void 0:Ee.reason)==="session_superseded"?(Hj(),G(le=>[{kind:"system",message:"You logged in from another device.",ts:Date.now()},...le])):G(le=>[{kind:"system",message:"You were logged out.",ts:Date.now()},...le]),o("/lobby",{replace:!0})},onError:Ee=>T(Ee),onBankerChanged:Ee=>{Ee!=null&&Ee.roomId&&y(le=>!le||le.id!==Ee.roomId?le:{...le,gameState:{...le.gameState,banker:Ee.bankerId,currentRollerId:Ee.currentRollerId,roundSeq:Ee.roundSeq,bankRoll:null}})},onTurnOrderUpdated:Ee=>{if(!Ee.room||!Ee.room.gameState)return;y(Ee.room);const le=oR(Ee.room.players,Ee.banker);G(De=>[{kind:"system",message:`${le} is now the banker for the new round.`,ts:Date.now()},...De])},onRoomUpdateState:Ee=>{const{roomId:le,gameState:De,room:Ye}=Ee||{},Re=(Ye==null?void 0:Ye.gameState)??De;if(!le||!Re||!sR(Ye??{gameState:Re}))return;const et=Array.isArray(Ye==null?void 0:Ye.players)?Ye.players:[],rt=ne=>{if(!et.length)return ne;const ue=new Map(ne.map(B=>[B.id,B]));for(const B of et){const fe=ue.get(B.id);ue.set(B.id,fe?{...fe,...B}:B)}return Array.from(ue.values())};y(ne=>{var ve;if(!ne||ne.id!==le)return{...ne,gameState:Re,...et.length?{players:et}:{}};const ue=(ve=ne.gameState)==null?void 0:ve.roundSeq,B=Re==null?void 0:Re.roundSeq,fe=typeof ue=="number"&&typeof B=="number"&&ue!==B,ye={...ne,players:rt(ne.players??[]),gameState:{...ne.gameState,...Re}};if(fe&&!k.current){try{I(!0)}catch{}try{N(void 0)}catch{}try{P(null)}catch{}}return ye})}}:{}),l.useEffect(()=>()=>{k.current&&(window.clearTimeout(k.current),k.current=null),E.current&&(window.clearTimeout(E.current),E.current=null)},[]),l.useEffect(()=>{C===!1&&!k.current?(E.current&&window.clearTimeout(E.current),E.current=window.setTimeout(()=>{if(C===!1){k.current||I(!0);try{k.current&&window.clearTimeout(k.current)}catch{}k.current=null}E.current=null},ha.diceSettleClientMs)):C===!0&&E.current&&(window.clearTimeout(E.current),E.current=null)},[C]);const Z=l.useRef(null),Q=l.useRef(void 0),oe=l.useRef(!1);Z.current=p,l.useEffect(()=>{if(!s)return;let Ee=!1;if(Q.current!==e)return Q.current=e,oe.current=!1,(async()=>{var Ye,Re,et,rt,ne;if(!e){T("No room id provided."),w(!1);return}if(w(!0),T(null),!Z.current){T("No join ref");return}const le=(()=>{var ue,B;try{return typeof window<"u"&&(((B=(ue=window.location)==null?void 0:ue.search)==null?void 0:B.includes("e2e=1"))||window.__E2E===!0||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")}catch{return!1}})();let De=null;try{const ue=()=>le?Promise.race([Z.current(e),new Promise(ye=>setTimeout(()=>ye({ok:!1,error:"e2e-timeout"}),1800))]):Z.current(e),B=jh[e]||ue();jh[e]=B;try{De=await B}finally{delete jh[e]}}catch(ue){if(delete jh[e],!le){T((ue==null?void 0:ue.message)||"Failed to join room."),w(!1);return}}if(typeof window<"u"&&(window.__e2eJoinAttempt={roomId:e,res:De,ts:Date.now()}),!Ee){if(!(De!=null&&De.ok)){if(!le){T((De==null?void 0:De.error)??"Failed to join room."),w(!1);return}const ue=Date.now(),B=(b==null?void 0:b.id)||"e2e-user",fe=(b==null?void 0:b.name)||"E2E User",ve=((()=>{try{const dt=new URLSearchParams(window.location.search).get("m");return dt==="cee-lo"||dt==="craps"?dt:null}catch{return null}})()||(e!=null&&e.toLowerCase().includes("ceelo")?"cee-lo":"craps"))==="cee-lo",ke=[{id:B,name:fe,isReady:!0,balance:1e3},{id:"bank",name:"Bank",isReady:!0,balance:1e6}],Ue=ve?{id:e,name:"E2E Cee-Lo Room",gameMode:"cee-lo",createdAt:ue,updatedAt:ue,bankerId:B,players:ke,gameState:{gameMode:"cee-lo",currentRollerId:B,banker:B,turnOrder:[B],roundSeq:1,bankRoll:null,turnHistory:[]}}:{id:e,name:"E2E Craps Room",gameMode:"craps",createdAt:ue,updatedAt:ue,bankerId:"bank",players:ke,gameState:{gameMode:"craps",crapsPoint:null,currentRollerId:B,turnOrder:[B],roundSeq:1,crapsPassBets:[],crapsDontPassBets:[],crapsPlaceBets:[]}};y(Ue);try{A==null||A(Ue)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:Ue.id,players:Ue.players.map(ct=>ct.id),gameMode:Ue.gameState.gameMode,ts:Date.now()}),w(!1);return}y(De.room);try{A==null||A(De.room)}catch{}typeof window<"u"&&(window.__e2eRoomHydrated={id:(Ye=De.room)==null?void 0:Ye.id,players:(et=(Re=De.room)==null?void 0:Re.players)==null?void 0:et.map(ue=>ue.id),gameMode:(ne=(rt=De.room)==null?void 0:rt.gameState)==null?void 0:ne.gameMode,ts:Date.now()});try{$c("room_join",{roomId:e})}catch{}w(!1)}})(),()=>{Ee=!0,Q.current===e&&(Q.current=void 0)}},[e,s]);const ce=l.useMemo(()=>{if(!g||!t)return!1;const Ee=g.gameState||{};return((Ee==null?void 0:Ee.gameMode)??"cee-lo")==="craps",(Ee==null?void 0:Ee.currentRollerId)===t},[g,t]),_e=l.useMemo(()=>{if(!g||!t)return!1;const Ee=g.gameState||{},le=(Ee==null?void 0:Ee.gameMode)??"cee-lo";return((Ee==null?void 0:Ee.banker)??(le==="cee-lo"?Ee==null?void 0:Ee.currentRollerId:void 0))===t},[g,t]),{open:re,openAll:pe}=jb(e,t),ee=l.useMemo(()=>(re||[]).some(Ee=>Ee.type==="MAIN"&&Number(Ee.amount)>0),[re]),xe=l.useMemo(()=>(pe||[]).some(Ee=>Ee.type==="MAIN"),[pe]),Le=((kt=g==null?void 0:g.gameState)==null?void 0:kt.currentRollerId)??null,Ge=l.useMemo(()=>{const Ee=(g==null?void 0:g.gameState)||(x==null?void 0:x.gameState)||{},le=(Ee==null?void 0:Ee.gameMode)??"cee-lo",De=!!(Ee!=null&&Ee.roundEnded);if(le==="craps"){const et=!!ce&&!!C&&!De;return ie(et?null:ce?C?"Round transition in progress":"Dice not settled":"Not your turn"),he([]),et}if(!(Ee!=null&&Ee.currentRollerId))return ie("Initializing…"),he([]),!1;if(_e&&!xe)return ie("Waiting for bets"),he([]),!1;const Ye=!!(Ee!=null&&Ee.bankRoll),Re=Vde({isMyTurn:ce,isBanker:_e,diceSettled:C,hasMainBetPlaced:ee,bankPointExists:Ye,roundEnded:De});return ie(Re.reason??null),he([]),Re.canRoll},[g==null?void 0:g.gameState,x==null?void 0:x.gameState,ce,_e,ee,C,xe,g==null?void 0:g.singlePlayer]),_t=l.useCallback(()=>{e&&(c(e),o("/lobby"))},[e,c,o]),Xe=l.useCallback(()=>{if(e&&Ge){if(_e&&!xe){try{n("Waiting for bets")}catch{}return}if(!_e&&!ee){try{n("No open challenges")}catch{}return}try{$c("roll_click",{game:"cee-lo",role:_e?"banker":"challenger"})}catch{}try{k.current&&(window.clearTimeout(k.current),k.current=null),E.current&&(window.clearTimeout(E.current),E.current=null)}catch{}N(void 0),I(!1),M.current=Date.now(),h(),k.current=window.setTimeout(()=>{I(!0),M.current=null,k.current=null},8e3),(async()=>{const Ee=await d.roll(),le=(Ee==null?void 0:Ee.error)||(Ee==null?void 0:Ee.message)||"";if(!Ee||Ee.ok===!1){if(k.current&&(window.clearTimeout(k.current),k.current=null),M.current=null,I(!0),/no open main bets/i.test(le)){const De=!!(g!=null&&g.singlePlayer);try{d.refreshWagers()}catch{}if(!De||!_e)try{n("No open challenges")}catch{}return}return}})()}},[e,d,h,Ge,_e,ee,xe,g==null?void 0:g.gameState]),bt=l.useCallback(async()=>{var Ee;if(e)return(Ee=d.giveUpBank)==null?void 0:Ee.call(d)},[e,d]),Pt=l.useCallback(async Ee=>{var le;if(e)return(le=d.spectate)==null?void 0:le.call(d,Ee)},[e,d]);return{room:g,joining:_,botsHydrating:Ae,error:j,isMyTurn:ce,isBanker:_e,lastRollerId:R,rollTrigger:m,diceSettled:C,diceResults:L,deadline:S,serverNow:D,canRoll:Ge,canRollReason:de,canRollBlocking:we,handleRoll:Xe,handleLeave:_t,giveUpBank:bt,setSpectateMode:Pt,currentRollerId:Le,readyPlayers:$}}function Gde({meId:e,players:t,openSideBets:r,onCancelSideBet:n,onAcceptSideBet:s,offersToMe:o=[],newOffersCount:i=0,onOffersSeen:c,disabled:u=!1,betsLocked:p,hasBankRoll:d,hasRolledThisRound:f}){const m=ji(),[h,b]=l.useState(!1),g=l.useRef(null),y=l.useMemo(()=>{var T,R;if(typeof window<"u"&&((R=(T=window.location)==null?void 0:T.search)!=null&&R.includes("e2e=1"))){const P=window.__e2eSideBets;if(Array.isArray(P)&&P.length>0)return P}return o},[o]);l.useEffect(()=>{h&&(c==null||c())},[h,c]);const x=l.useCallback(async(T,R)=>{if(!s)return;if(R&&(f!=null&&f(R))){m.info("Subject already rolled. Side bets are closed for this subject.");return}try{yn()}catch{}const P=await s(T);P.ok||m.error(P.error||"Failed to accept side bet")},[s,f,m]),v=l.useCallback((T,R)=>{const P=(R||"").toLowerCase();return P==="beatsbank"||P==="subject_beats_banker"?`${T} beats Banker`:P==="losestobank"||P==="subject_loses_to_banker"?`${T} loses to Banker`:P==="tiesbank"||P==="subject_push"||P==="subject_ties_banker"?`${T} ties Banker`:`${T} side bet`},[]),A=l.useCallback(T=>{var R;return T?T==="house_global"||T==="house"?"House":((R=t.find(P=>P.id===T))==null?void 0:R.name)||"Player":"Player"},[t]);l.useEffect(()=>{const T=R=>{g.current&&!g.current.contains(R.target)&&b(!1)};return h&&document.addEventListener("mousedown",T),()=>document.removeEventListener("mousedown",T)},[h]);const _=!d&&!u,w=((y==null?void 0:y.length)??0)>0&&_&&!h,j=_?"btn btn--casino-action"+(w?" btn--casino-action--pulse":""):"btn btn--casino-action"+(_?"":" is-disabled");return a.jsxs("div",{className:"side-bet-panel",children:[a.jsxs("a",{onClick:()=>{try{c==null||c()}catch{}_&&b(!0)},className:j,"aria-disabled":_?void 0:"true",title:_?void 0:"Side bets closed",children:[a.jsx("span",{className:"btn--casino-action__icon",children:"🎰"}),"Side bets",i>0&&a.jsx("span",{className:"sidebet-badge","aria-label":`${i} new offer${i>1?"s":""}`,children:i})]}),h&&a.jsx("div",{className:"side-bet-panel__modal",children:a.jsxs("div",{className:"side-bet-panel__modal-content",ref:g,children:[a.jsx("h3",{className:"side-bet-panel__title",children:"Side Bets"}),a.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Offers to you",children:y.length>0?y.map(T=>{const R=A(T.subjectId),P=v(R,T.predicate),k=T.subjectId,E=(f==null?void 0:f(k))??!1,M=k===e;return a.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[a.jsxs("div",{className:"side-bet-panel__wager-info",children:[a.jsx("span",{className:"side-bet-panel__wager-amount",children:a.jsx(Bo,{mini:!0,value:T.amount})}),a.jsx("span",{className:"side-bet-panel__wager-label",children:P})]}),s&&a.jsx("button",{className:"felt-btn felt-btn--primary",onClick:()=>x(T.id,k),disabled:u||E||M||d,title:d?"Dealer rolled – side bets closed":E?"Subject already rolled this round":M?"Cannot bet on yourself":"Accept this side bet",children:"Accept"})]},T.id)}):a.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:a.jsx("span",{className:"side-bet-panel__empty",children:"No offers right now."})})}),a.jsx("h3",{className:"side-bet-panel__title",style:{marginTop:14},children:"Active side bets"}),a.jsx("div",{className:"side-bet-panel__list",role:"list","aria-label":"Your active side bets",children:r&&r.length>0?r.map(T=>{const R=A(T.subjectId),P=v(R,T.predicate),k=T.acceptedById,E=T.playerId===e,M=k===e,C=A(E?k||void 0:T.playerId),I=(E||M)&&!d&&!!n,L=!E&&!M?"Only a party to the bet can cancel":d?"Dealer rolled – side bets closed":n?void 0:"Cancel not available";return a.jsxs("div",{className:"side-bet-panel__list-item",role:"listitem",children:[a.jsxs("div",{className:"side-bet-panel__wager-info",style:{flex:1},children:[a.jsx("span",{className:"side-bet-panel__wager-amount",children:a.jsx(Bo,{mini:!0,value:T.amount})}),a.jsxs("span",{className:"side-bet-panel__wager-label",children:[P,a.jsx("span",{style:{display:"block",fontSize:"0.85em",opacity:.8},children:k?`with ${C}`:"awaiting taker"})]})]}),a.jsx("button",{className:"felt-btn "+(I?"felt-btn--danger":"felt-btn--secondary"),"aria-label":"Cancel side bet",title:I?"Cancel this side bet":L||"Cannot cancel",disabled:!I||!!u,onClick:async()=>{if(!I)return;try{yn()}catch{}const N=await n(T.id);N.ok||m.error(N.error||"Failed to cancel side bet")},children:"Cancel"})]},`active-${T.id}`)}):a.jsx("div",{className:"side-bet-panel__list-item side-bet-panel__list-item--empty",role:"listitem",children:a.jsx("span",{className:"side-bet-panel__empty",children:"No active side bets."})})}),a.jsx("div",{className:"side-bet-panel__cta",children:a.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>b(!1),style:{marginTop:8},children:"Close"})})]})})]})}function Xde({roomId:e,meId:t,bankerId:r,players:n,gameState:s,gameplay:o}){const i=ji(),c=r===t,{myOpenMain:u,myOpenSides:p,placeSideBet:d,cancelSideBet:f,acceptSideBet:m,offersToMe:h,newOfferCount:b,markOffersAsSeen:g}=jb(e,t),y=s1(e,t,{autoJoin:!1}),x=(o==null?void 0:o.giveUpBank)??y.giveUpBank,v=(o==null?void 0:o.setSpectateMode)??y.setSpectateMode,A=!!(s!=null&&s.betsLocked),_=!!(s!=null&&s.bankRoll),w=(s==null?void 0:s.spectators)??[],j=w.includes(t),R=!c&&!A&&!_&&!!!u,P=c&&!A&&!_,k=l.useCallback(async()=>{try{yn()}catch{}const I=await v(!j);I&&!I.ok&&i.error(I.error||"Failed to update spectate mode")},[v,j,i]),E=l.useCallback(async()=>{try{yn()}catch{}try{}catch{}try{await na("Medium")}catch{}const I=await x();I&&!I.ok&&i.error(I.error||"Failed to pass bank")},[x,i]),M=(s==null?void 0:s.roundSeq)??1,C=l.useMemo(()=>{const I=(s==null?void 0:s.turnHistory)??[];return!I||!Array.isArray(I)?[]:typeof(s==null?void 0:s.roundSeq)=="number"?I.filter(L=>(L.roundSeq??M)===M):I},[s,M]);return a.jsxs(a.Fragment,{children:[c&&a.jsxs("button",{className:"btn btn--casino-action btn--casino-action--pass-bank",disabled:!P,onClick:E,"aria-label":"Pass Bank",children:[a.jsx("span",{className:"btn--casino-action__icon",children:"👑"}),"Pass Bank"]}),!c&&a.jsxs("div",{className:"betpanel__row betpanel__row--spectate",children:[a.jsx("div",{"aria-label":"Side bets",children:a.jsx(Gde,{isBanker:c,openSideBets:p,meId:t,players:n,onPlaceSideBet:I=>d({subjectId:I.playerId,predicate:I.predicate,amount:I.amount,clientBetId:I.clientBetId}),onCancelSideBet:f,onAcceptSideBet:m,offersToMe:h,newOffersCount:b,onOffersSeen:g,roomId:e,betsLocked:A,disabled:w.includes(t),hasBankRoll:_,hasRolledThisRound:I=>!!I&&C.some(L=>L.playerId===I&&(L.roundSeq??M)===M)})}),a.jsxs("button",{className:`btn btn--casino-action${j?" btn--casino-action--active":""}`,onClick:k,disabled:!R,"aria-pressed":j,"aria-label":j?"Stop spectating this round":"Spectate this round",children:[a.jsx("span",{className:"btn--casino-action__icon",children:j?"👁️":"👀"}),j?"Spectating":"Spectate"]})]})]})}function go({className:e,title:t,...r}){return a.jsxs("svg",{width:36,height:36,viewBox:"0 0 24 24",fill:"none",xmlns:"http://www.w3.org/2000/svg",className:e,"aria-hidden":t?void 0:!0,role:t?"img":"presentation",...r,children:[t?a.jsx("title",{children:t}):null,a.jsx("path",{d:"M19 12H5m0 0l7-7m-7 7l7 7",stroke:"currentColor",strokeWidth:2,strokeLinecap:"round",strokeLinejoin:"round"})]})}const Yde=new TextEncoder;function Zde(e){const t=e instanceof Uint8Array?e:new Uint8Array(e);return Array.from(t).map(r=>r.toString(16).padStart(2,"0")).join("")}async function Kde(e){const t=await crypto.subtle.digest("SHA-256",Yde.encode(e));return Zde(t)}async function Qde(e,t){return!e||!t?!1:(await Kde(e)).toLowerCase()===t.toLowerCase()}const u_=(e,t)=>`${e}:${t}`;function H5(e){const[t,r]=l.useState({}),[n,s]=l.useState({}),o=l.useRef({});l.useEffect(()=>{r({}),s({}),o.current={}},[e]),Ba({onDiceRolled:u=>{var h,b;const p=u==null?void 0:u.fairness,d=u==null?void 0:u.rollerId,f=(p==null?void 0:p.roundSeq)??((b=(h=u==null?void 0:u.room)==null?void 0:h.gameState)==null?void 0:b.roundSeq);if(!p||!d||typeof f!="number")return;const m=u_(f,d);r(g=>g[m]?g:{...g,[m]:p}),delete o.current[m]},onCrapsRollResult:u=>{var h;const p=u==null?void 0:u.fairness,d=((h=u==null?void 0:u.fairness)==null?void 0:h.rollerId)||(u==null?void 0:u.currentRollerId),f=p==null?void 0:p.roundSeq;if(!p||!d||typeof f!="number")return;const m=u_(f,d);r(b=>b[m]?b:{...b,[m]:p}),delete o.current[m]},onFairnessReveal:u=>{typeof(u==null?void 0:u.roundSeq)!="number"||!u.commit||!u.serverSeed||s(p=>{const d=p[u.roundSeq];if(!d||d.commit!==u.commit)for(const f of Object.keys(o.current))f.startsWith(`${u.roundSeq}:`)&&delete o.current[f];return{...p,[u.roundSeq]:{commit:u.commit,serverSeed:u.serverSeed}}})}});const i=l.useCallback(async(u,p,d)=>{const f=u_(p,u);if(o.current[f])return o.current[f];const m=t[f],h=n[p];if(!m||!h)return o.current[f]="unverifiable","unverifiable";const g=await Qde(h.serverSeed,m.commit)?"verified":"bad-commit";return o.current[f]=g,g},[t,n]),c=l.useMemo(()=>{const u=Object.keys(n).map(p=>Number(p)).filter(p=>!Number.isNaN(p));return u.length?Math.max(...u):void 0},[n]);return{proofs:t,reveals:n,verifyFor:i,lastRoundWithReveal:c}}const Fo=o6;let ia=null,ff=null,mf=null,iR=!1;async function Um(){if(ia)return!0;try{const e=await Cr(()=>import("./index-Dh9Wyl3x.js"),__vite__mapDeps([14,2,3,4,1]),import.meta.url);return ia=e.AdMob,ff=e.RewardAdPluginEvents,mf=e.InterstitialAdPluginEvents,console.log("[NativeAdService] AdMob plugin loaded"),!0}catch(e){return console.warn("[NativeAdService] AdMob plugin not available:",e),!1}}let iu=!1,hf=!1,d_=!1;const Jde=45e3;function Pl(e){var t;try{(t=e==null?void 0:e.remove)==null||t.call(e)}catch{}}function W5(){return{adId:G5(),isTesting:Fo,immersiveMode:!1}}function $de(){const e=zr.getPlatform();return e==="web"||e==="ios"?!1:e==="ios"||e==="android"}async function Tp(){if(iu)return!0;const e=zr.getPlatform();if(e==="web")return console.log("[NativeAdService] Skipping AdMob init on web"),!1;if(console.log(`[NativeAdService] Initializing AdMob — platform=${e} testMode=${Fo}`),iR||(iR=!0,console.log("[NativeAdService] Active native ad config",{appTarget:Oa,platform:e,testMode:Fo,interstitialAdUnitId:G5(),rewardedAdUnitId:o1()})),!await Um()||!ia)return console.error("[NativeAdService] Plugin load failed — cannot initialize"),!1;try{return await ia.initialize({requestTrackingAuthorization:!0,initializeForTesting:Fo}),iu=!0,console.log("[NativeAdService] AdMob initialized successfully"),!0}catch(r){return console.error("[NativeAdService] AdMob initialization failed:",r),!1}}function o1(){const e=zr.getPlatform();return e==="ios"?a6:iS}function G5(){const e=zr.getPlatform();return e==="ios"?s6:uS}async function X5(){if(zr.getPlatform()==="web"||!await Um()||!ia)return!1;iu||await Tp();try{const r=o1();return console.log(`[NativeAdService] prepareRewardVideoAd adId=${r} isTesting=${Fo}`),await ia.prepareRewardVideoAd({adId:r,isTesting:Fo}),hf=!0,console.log("[NativeAdService] Rewarded ad prepared successfully"),!0}catch(r){return console.error("[NativeAdService] Failed to prepare rewarded ad:",r),!1}}async function epe(){return zr.getPlatform()==="web"?{ok:!1,error:"NOT_NATIVE"}:!await Um()||!ia?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!iu&&!await Tp()?{ok:!1,error:"INIT_FAILED"}:new Promise(async r=>{let n=!1,s,o;const i=await ia.addListener(ff.Rewarded,f=>{console.log("[NativeAdService] User rewarded:",f),n=!0,s=(f==null?void 0:f.type)||"chips",o=(f==null?void 0:f.amount)||bl}),c=await ia.addListener(ff.Dismissed,()=>{console.log("[NativeAdService] Ad dismissed, rewarded:",n),d(),r(n?{ok:!0,rewardType:s,rewardAmount:o}:{ok:!1,error:"AD_DISMISSED"})}),u=await ia.addListener(ff.FailedToShow,f=>{console.error("[NativeAdService] Ad failed to show:",f),d(),r({ok:!1,error:"FAILED_TO_SHOW"})}),p=await ia.addListener(ff.FailedToLoad,f=>{console.error("[NativeAdService] Rewarded ad failed to load:",f),hf=!1,d(),r({ok:!1,error:"FAILED_TO_LOAD"})}),d=()=>{Pl(i),Pl(c),Pl(u),Pl(p)};try{if(hf)console.log("[NativeAdService] Rewarded ad already prepared, skipping load");else{const f=o1();console.log(`[NativeAdService] prepareRewardVideoAd (in show) adId=${f} isTesting=${Fo}`),await ia.prepareRewardVideoAd({adId:f,isTesting:Fo})}hf=!1,console.log("[NativeAdService] Calling showRewardVideoAd..."),await ia.showRewardVideoAd()}catch(f){hf=!1,console.error("[NativeAdService] Error showing ad:",f),d(),r({ok:!1,error:(f==null?void 0:f.message)||"UNKNOWN_ERROR"})}})}async function xl(){if(!$de())return console.log("[NativeAdService] Interstitial disabled or unsupported on this platform"),!1;if(!await Um()||!ia)return!1;iu||await Tp();try{const t=W5();return console.log(`[NativeAdService] prepareInterstitial adId=${t.adId} isTesting=${Fo}`),await ia.prepareInterstitial(t),console.log("[NativeAdService] Interstitial ad prepared successfully"),!0}catch(t){return console.error("[NativeAdService] Failed to prepare interstitial ad:",t),!1}}async function gf(){const e=zr.getPlatform();return e==="web"?{ok:!1,error:"NOT_NATIVE"}:e==="ios"?{ok:!1,error:"IOS_INTERSTITIAL_DISABLED"}:!await Um()||!ia?{ok:!1,error:"PLUGIN_NOT_AVAILABLE"}:!iu&&!await Tp()?{ok:!1,error:"INIT_FAILED"}:d_?(console.warn("[NativeAdService] Interstitial show skipped: another interstitial is already active"),{ok:!1,error:"ALREADY_SHOWING"}):(console.log(`[NativeAdService] showInterstitialAd — initialized=${iu} testMode=${Fo}`),new Promise(async r=>{d_=!0;let n=!1,s=null,o=null,i=null,c=null,u=null;const p=()=>{Pl(o),Pl(i),Pl(c),Pl(u)},d=f=>{n||(n=!0,s&&clearTimeout(s),d_=!1,p(),r(f))};s=setTimeout(()=>{console.warn("[NativeAdService] Interstitial timed out waiting for native close/fail callback"),d({ok:!1,error:"DISMISS_TIMEOUT"})},Jde),o=await ia.addListener(mf.Dismissed,()=>{console.log("[NativeAdService] Interstitial dismissed ✓"),d({ok:!0}),xl().catch(()=>{})}),i=await ia.addListener(mf.Showed,()=>{console.log("[NativeAdService] Interstitial showed ✓")}),c=await ia.addListener(mf.FailedToLoad,f=>{console.error("[NativeAdService] Interstitial failed to load:",JSON.stringify(f)),d({ok:!1,error:"FAILED_TO_LOAD"})}),u=await ia.addListener(mf.FailedToShow,f=>{console.error("[NativeAdService] Interstitial failed to show:",JSON.stringify(f)),d({ok:!1,error:"FAILED_TO_SHOW"})});try{const f=W5();console.log(`[NativeAdService] prepareInterstitial (in show) adId=${f.adId} isTesting=${Fo}`),await ia.prepareInterstitial(f),console.log("[NativeAdService] Calling showInterstitial..."),await ia.showInterstitial()}catch(f){console.error("[NativeAdService] Error showing interstitial:",f),d({ok:!1,error:(f==null?void 0:f.message)||"UNKNOWN_ERROR"})}}))}function Y5(){const e=zr.getPlatform();return e==="ios"||e==="android"}const p_={initializeAdMob:Tp,prepareRewardedAd:X5,showRewardedAd:epe,prepareInterstitialAd:xl,showInterstitialAd:gf,isNativeAdSupported:Y5},lR=dx,cR=_j,uR=wj,Ih=xj,$u="ad:complete",Z5=l.createContext({onHandEnd:async()=>{},onCrapsShooterTurnEnd:async()=>{},onZentaraTurnEnd:async()=>{},showAdNow:async()=>{},cancelAd:()=>{},isAdEnabled:!1,isAdShowing:!1,adConfig:{handsPerAd:_j,crapsShooterTurnsPerAd:wj,minIntervalMs:_c,displayDelayMs:sd,zentaraTurnsPerAd:xj}}),bu=()=>l.useContext(Z5);function tpe({children:e}){const[t,r]=l.useState(!1),[n,s]=l.useState(!1),o=Y5(),i=!t&&o;l.useEffect(()=>{console.log(`[AdContext] isAdEnabled=${i} isPremium=${t} isNative=${o}`)},[i,t,o]);const c=l.useRef(!1),u=l.useRef(0),p=l.useRef(0),d=l.useRef(0),f=l.useRef(0),m=l.useRef(!1),h=l.useRef(null),b=()=>{try{h.current&&clearTimeout(h.current),document.body.style.pointerEvents="none",h.current=setTimeout(()=>{document.body.style.pointerEvents="",h.current=null},750)}catch{}};l.useEffect(()=>{const w=async()=>{var T,R;try{const P=hs();if(!P)return;const k=await((T=P.getCustomerInfo)==null?void 0:T.call(P)),E=((R=k==null?void 0:k.entitlements)==null?void 0:R.active)||{},M=Object.keys(E).length>0;let C=!1;lR&&(C=!!(E!=null&&E[lR])||M),r(C)}catch{}};w();const j=setInterval(w,6e4);return()=>clearInterval(j)},[]),l.useEffect(()=>{i&&xl().catch(()=>{})},[i]);const g=l.useCallback(async()=>{if(!i||c.current)return;const w=Date.now();if(!(w-f.current<_c)&&(u.current+=1,!(u.current<cR))){c.current=!0,u.current=0,f.current=w;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}if(s(!0),m.current=!1,await new Promise(j=>setTimeout(j,sd)),m.current){console.log("[AdContext] Ad cancelled during delay phase"),c.current=!1,s(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($u))}catch{}return}try{await gf()}catch(j){console.warn("[AdContext] Failed to show interstitial:",j)}finally{b(),c.current=!1,s(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($u))}catch{}xl().catch(()=>{})}}},[i]),y=l.useCallback(async()=>{if(!i||c.current)return;const w=Date.now();if(!(w-f.current<_c)&&(p.current+=1,!(p.current<uR))){c.current=!0,p.current=0,f.current=w;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}s(!0),await new Promise(j=>setTimeout(j,sd));try{await gf()}catch(j){console.warn("[AdContext] Failed to show interstitial (craps shooter turn):",j)}finally{b(),c.current=!1,s(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($u))}catch{}xl().catch(()=>{})}}},[i]),x=l.useCallback(async()=>{if(console.log(`[AdContext] onZentaraTurnEnd — enabled=${i} showing=${c.current} turns=${d.current+1}/${Ih} sinceLastAd=${Date.now()-f.current}ms`),!i||c.current)return;const w=Date.now();if(w-f.current<_c){console.log(`[AdContext] Skipping ad — min interval not met (${w-f.current}ms < ${_c}ms)`);return}if(d.current+=1,d.current<Ih){console.log(`[AdContext] Skipping ad — need ${Ih} turns, have ${d.current}`);return}c.current=!0,d.current=0,f.current=w;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}s(!0),await new Promise(j=>setTimeout(j,sd));try{await gf()}catch(j){console.warn("[AdContext] Failed to show interstitial (zentara turn):",j)}finally{b(),c.current=!1,s(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($u))}catch{}xl().catch(()=>{})}},[i]),v=l.useCallback(async w=>{if(!i||c.current)return;const j=Date.now();if(!(!(w!=null&&w.ignoreMinInterval)&&j-f.current<_c)){c.current=!0,u.current=0,p.current=0,d.current=0,f.current=j;try{window.__adShowingDoNotDisconnect=!0,window.__adShowingPauseGame=!0}catch{}s(!0),await new Promise(T=>setTimeout(T,sd));try{await gf()}catch(T){console.warn("[AdContext] Failed to show interstitial (showAdNow):",T)}finally{b(),c.current=!1,s(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($u))}catch{}xl().catch(()=>{})}}},[i]),A=l.useCallback(()=>{if(c.current){console.log("[AdContext] cancelAd() called — aborting pending ad"),m.current=!0,c.current=!1,s(!1);try{window.__adShowingDoNotDisconnect=!1,window.__adShowingPauseGame=!1}catch{}try{window.dispatchEvent(new CustomEvent($u))}catch{}}},[]),_={handsPerAd:cR,crapsShooterTurnsPerAd:uR,zentaraTurnsPerAd:Ih,minIntervalMs:_c,displayDelayMs:sd};return a.jsx(Z5.Provider,{value:{onHandEnd:g,onCrapsShooterTurnEnd:y,onZentaraTurnEnd:x,showAdNow:v,cancelAd:A,isAdEnabled:i,isAdShowing:n,adConfig:_},children:e})}const K5=za();async function rpe(e){if(!e)return null;try{const t=await Jn(),r=`${K5}/api/rooms/${encodeURIComponent(e)}/craps-history?playerScope=me&limit=200`,s=await(await fetch(r,{credentials:"include",cache:"no-store",headers:t?{Authorization:`Bearer ${t}`}:void 0})).json();return s&&s.ok&&s.data&&Array.isArray(s.data.items)?s.data.items:null}catch{return null}}async function npe(e){if(!e)return null;try{const t=await Jn(),n=await(await fetch(`${K5}/api/rooms/${encodeURIComponent(e)}/settlements?playerScope=me&limit=500`,{credentials:"include",cache:"no-store",headers:t?{Authorization:`Bearer ${t}`}:void 0})).json();return n&&n.ok&&n.data&&Array.isArray(n.data.items)?n.data.items:null}catch{return null}}const i1=[oA,iA,lA,cA,uA,dA,pA,fA,mA];function ape(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return t%(i1.length*6)}function spe(e){if(!e||!e.startsWith("sprite:"))return null;const t=e.slice(7).split("/"),r=Number(t[0]),n=Number(t[1]);return!Number.isFinite(r)||!Number.isFinite(n)||r<0||r>=i1.length?null:{sheetIdx:r,tile:n%6}}function dR({seed:e,sheetIdx:t,tile:r}){const n=ape(e),s=t??Math.floor(n/6),o=r??n%6,i=i1[s],c=2,u=3,p=o%c,d=Math.floor(o/c),f=c*100,m=s===4?400:u*100,h=f/100,b=m/100,g=p/(h-1)*100,y=s===8?d*37:b>1?d/(b-1)*100:0,x={display:"block",width:"100%",height:"100%",borderRadius:"8px",backgroundImage:`url(${i})`,backgroundSize:`${f}% ${m}%`,backgroundPosition:`${g}% ${y}%`,backgroundRepeat:"no-repeat"};return a.jsx("span",{className:"avatar-sprite",style:x,"aria-hidden":!0})}function ope({stream:e,labelFallback:t,muted:r=!0,forceHideVideo:n=!1,active:s=!1,avatarUrl:o}){const i=l.useRef(null),[c,u]=l.useState(!1),[p,d]=l.useState(!1);l.useEffect(()=>{d(!1)},[o]);const f=l.useCallback(()=>e?e.getVideoTracks().some(y=>y.readyState==="live"&&y.enabled!==!1&&!y.muted):!1,[e]);l.useEffect(()=>{if(!e){u(!1);return}const y=()=>u(f());y();const x=new Set,v=_=>{x.has(_)||(x.add(_),_.addEventListener("mute",y),_.addEventListener("unmute",y),_.addEventListener("ended",y))};for(const _ of e.getVideoTracks())v(_);const A=()=>{y();for(const _ of e.getVideoTracks())v(_)};return e.addEventListener("addtrack",A),e.addEventListener("removetrack",A),()=>{for(const _ of x)_.removeEventListener("mute",y),_.removeEventListener("unmute",y),_.removeEventListener("ended",y);e.removeEventListener("addtrack",A),e.removeEventListener("removetrack",A)}},[e,f]),l.useEffect(()=>{const y=i.current;if(!y||!e)return;const x=()=>{f()&&u(!0)},v=setInterval(()=>{const A=f(),_=y.readyState>=2;u(w=>_&&A&&!w?!0:!A&&w?!1:w)},1e3);return y.addEventListener("canplay",x),y.addEventListener("playing",x),()=>{clearInterval(v),y.removeEventListener("canplay",x),y.removeEventListener("playing",x)}},[e,f]),l.useEffect(()=>{const y=i.current;if(!y)return;let x=0;const v=4,A=T=>{if(!e||!e.getVideoTracks().some(k=>k.readyState==="live"&&k.enabled!==!1)||!y.paused&&y.readyState>=2)return;const P=y.play();P==null||P.catch(()=>{if(x<v){const k=150+x*200;x++,setTimeout(()=>A(`${T}:retry${x}`),k)}else try{window.dispatchEvent(new CustomEvent("rtc:videoStall",{detail:{reason:T}}))}catch{}})},_=()=>A("ui"),w=()=>{document.hidden||A("visibility")},j=()=>{if(!e||!y)return;const T=e.getVideoTracks()[0];T&&T.readyState==="live"&&y.paused&&A("pause-event")};return window.addEventListener("ui:roll",_),window.addEventListener("ui:placeMainBet",_),window.addEventListener("ui:cancelMainBet",_),document.addEventListener("visibilitychange",w),y.addEventListener("pause",j),()=>{window.removeEventListener("ui:roll",_),window.removeEventListener("ui:placeMainBet",_),window.removeEventListener("ui:cancelMainBet",_),document.removeEventListener("visibilitychange",w),y.removeEventListener("pause",j)}},[e]),l.useLayoutEffect(()=>{const y=i.current;if(y){try{y.setAttribute("playsinline","true"),y.setAttribute("webkit-playsinline","true"),y.setAttribute("muted",r?"true":"false"),y.disablePictureInPicture=!0}catch{}if(y.srcObject!==e&&(y.srcObject=e??null),e){y.muted=!!r;const x=()=>{y.play().catch(()=>{setTimeout(()=>{y.play().catch(()=>{})},160)})};x(),y.onloadedmetadata=x}else y.onloadedmetadata=null}},[e,r]);const m=!n&&!!e&&c,h=l.useMemo(()=>spe(o),[o]),b=l.useCallback(()=>d(!0),[]),g=h?a.jsx(dR,{seed:t,sheetIdx:h.sheetIdx,tile:h.tile}):o&&!p?a.jsx("img",{src:o,alt:t,className:"avatar-uploaded",style:{width:"100%",height:"100%",objectFit:"cover"},onError:b}):a.jsx(dR,{seed:t});return n||!e?a.jsx("div",{className:`avatar-shell is-avatar ${s?"is-rolling":""}`,children:g}):a.jsxs("div",{className:`avatar-shell ${s?" is-rolling":""}`,style:{position:"relative",overflow:"hidden"},children:[a.jsx("div",{className:`avatar-image ${s?"is-rolling":""}`,style:{position:"absolute",inset:0,opacity:m?0:1,transition:"opacity 160ms ease",display:"flex",alignItems:"center",justifyContent:"center",background:"radial-gradient(circle at 30% 35%, #2e2e2e, #141414)"},children:g}),a.jsx("video",{ref:i,playsInline:!0,autoPlay:!0,muted:r,className:"avatar-video",style:{width:"100%",height:"100%",objectFit:"cover",background:"#000",position:"relative",opacity:m?1:0,transition:"opacity 160ms ease"}})]})}function ipe(e,t){return!(e.forceHideVideo!==t.forceHideVideo||e.muted!==t.muted||e.stream!==t.stream||e.avatarUrl!==t.avatarUrl||e.active!==t.active||e.labelFallback!==t.labelFallback)}const lpe=l.memo(ope,ipe);function cpe(e){var o,i;const r=e.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(((o=r[0])==null?void 0:o[0])??"").toUpperCase(),s=(((i=r[1])==null?void 0:i[0])??"").toUpperCase();return n+s||n||"?"}function l1(e){if(!e||e.length!==3)return"nothing";const t=new Set(e);if(t.size===1)return"triple";const r=[...e].sort().join("");return r==="123"?"123":r==="456"?"456":t.size===2?"point":"nothing"}function Bf(e,t){return l1(e)}function pR(e,t,r,n,s){if(!e)return null;if(e===r)return s||null;for(let o=t.length-1;o>=0;o--){const i=t[o];if(i.playerId===e&&Array.isArray(i.result)&&i.result.length===3)return i.result}return null}function f_(e){if(!e||e.length!==3)return{score:0,label:"—",kind:"invalid"};const t=l1(e);if(t==="456")return{score:1e4,label:"4-5-6 (Auto Win)",kind:t};if(t==="123")return{score:2e3,label:"1-2-3 (Auto Lose)",kind:t};if(t==="triple"){const r=e[0];return{score:8e3+r*100,label:`Triple ${r}s`,kind:t}}if(t==="point"){const r={};for(const s of e)r[s]=(r[s]||0)+1;let n;for(const[s,o]of Object.entries(r))if(o===1){n=Number(s);break}return n==null?{score:0,label:e.slice().sort().join("-"),kind:"nothing"}:{score:4e3+n*100,label:`Point ${n}`,kind:t,point:n}}return t==="nothing"?{score:0,label:e.slice().sort().join("-"),kind:t}:{score:0,label:e.slice().sort().join("-"),kind:t}}function Q5(e){const{anchorRect:t,anchorEl:r,onClose:n,onMessages:s,onSendMoney:o,onAddFriend:i,onUnfriend:c,onBlockUser:u,onViewProfile:p,isFriend:d,isBlocked:f,hideAddFriend:m}=e,[h,b]=l.useState({top:0,left:0}),[g,y]=l.useState(!1),x=l.useRef(null),v=l.useRef(Date.now());if(l.useLayoutEffect(()=>{if(!t)return;b({top:t.bottom+8,left:t.left}),v.current=Date.now(),y(!0)},[t]),l.useLayoutEffect(()=>{if(!t||!x.current)return;const w=x.current.getBoundingClientRect(),j=window.innerWidth,T=window.innerHeight,R=8,P=window.visualViewport,k=P?P.offsetTop:0,E=parseInt(getComputedStyle(document.documentElement).getPropertyValue("padding-top"))||0;let M=t.bottom+R,C=t.left;C+w.width>j-R&&(C=Math.max(R,j-w.width-R)),M+w.height>T-R&&(M=Math.max(R+E+k,t.top-w.height-R)),M<R+E+k&&(M=R+E+k),C<R&&(C=R),b({top:M,left:C})},[t,g]),l.useEffect(()=>{const _=P=>{if(Date.now()-v.current<120)return;const k=P.target;r&&(r===k||r.contains(k))||x.current&&(x.current.contains(k)||n())},w=P=>{P.key==="Escape"&&n()};let j=null;const T=()=>{Date.now()-v.current<120||(j&&window.clearTimeout(j),j=window.setTimeout(()=>n(),120))},R=T;return document.addEventListener("mousedown",_),window.addEventListener("keydown",w),window.addEventListener("scroll",T,{passive:!0,capture:!0}),window.addEventListener("resize",R),()=>{document.removeEventListener("mousedown",_),window.removeEventListener("keydown",w),window.removeEventListener("scroll",T,{capture:!0}),window.removeEventListener("resize",R),j&&window.clearTimeout(j)}},[n,r]),!t)return null;const A=a.jsxs("div",{className:"avatar-context-menu",style:{top:h.top,left:h.left},ref:x,role:"menu","aria-label":"Player actions",onMouseDown:_=>_.stopPropagation(),children:[p&&a.jsx("button",{role:"menuitem",onClick:()=>{p(),n()},className:"avatar-context-menu__item",children:"View Profile"}),s&&a.jsx("button",{role:"menuitem",onClick:()=>{s==null||s(),n()},className:"avatar-context-menu__item",children:"Messages"}),!d&&!m&&i&&a.jsx("button",{role:"menuitem",onClick:()=>{i(),n()},className:"avatar-context-menu__item",disabled:!!d||!!f||!i,title:d?"Already friends":f?"User is blocked":"Add Friend",children:d?"Friend ✓":"Add Friend"}),d&&c&&a.jsx("button",{role:"menuitem",onClick:()=>{c(),n()},className:"avatar-context-menu__item",children:"Unfriend"}),a.jsx("button",{role:"menuitem",onClick:()=>{u==null||u(),n()},className:"avatar-context-menu__item",disabled:!u,title:f?"Unblock user":"Block user",children:f?"Unblock":"Block"})]});return typeof document<"u"?ws.createPortal(A,document.body):A}function J5({targetId:e,anchorRect:t,anchorEl:r,onClose:n,onOpenDM:s,onOpenSendMoney:o,meId:i}){const{friends:c,friendRequests:u,isBlocked:p,blockUser:d,unblockUser:f,addFriend:m,removeFriend:h}=sc();Hr();const b=u.some(g=>g.status==="PENDING"&&g.fromUserId===i&&g.toUserId===e);return a.jsx(Q5,{anchorRect:t,anchorEl:r,onClose:n,onMessages:s?()=>{s(e),n()}:void 0,onSendMoney:()=>{o==null||o(e),n()},hideAddFriend:b,onAddFriend:()=>{!c.find(g=>g.id===e)&&!p(e)&&m(e)},onUnfriend:()=>{c.find(g=>g.id===e)&&h(e)},onBlockUser:async()=>{p(e)?await f(e):await d(e)},isFriend:!!c.find(g=>g.id===e),isBlocked:p(e)})}const upe=l.forwardRef(function({id:t,display:r,isCurrentRoller:n,isMe:s,balance:o,isSpectating:i=!1,folded:c=!1,tags:u,stream:p,diceResult:d,onOpenMenu:f,showMenu:m,menuProps:h,forceHideVideo:b,actDeadlineTs:g,avatarUrl:y,showActingTimerRing:x=!0,presenceStatus:v},A){const _=cpe(r);return a.jsxs(Zs.li,{layout:!0,layoutDependency:t,transition:{type:"spring",stiffness:420,damping:38,mass:.6},ref:A,className:["player","player--avatar",n?"is-rolling":"",s?"is-me":"",c?"player--folded":""].join(" "),"data-player-id":t,title:`${r}${u.length?" · "+u.join(" · "):""}`,"aria-label":`${r}${u.length?", "+u.join(", "):""}`,children:[a.jsxs("div",{className:["avatar-ring",n?"is-rolling":""].join(" "),onClick:w=>{w.stopPropagation(),f(t,w.currentTarget)},onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),f(t,w.currentTarget))},role:"button",tabIndex:0,"aria-haspopup":"menu","aria-expanded":m,children:[a.jsx(lpe,{active:n,stream:p,labelFallback:_,muted:s,forceHideVideo:b,avatarUrl:y}),typeof o=="number"&&a.jsx("div",{className:"avatar-balance-pill","aria-label":`Balance ${ky(o)}`,children:ky(o)})]}),s&&a.jsx("span",{className:"status-dot","aria-hidden":!0}),!s&&v&&a.jsx("span",{className:`presence-dot presence-dot--${v}`,"aria-label":v==="active"?"Online":"Away"}),a.jsxs("div",{className:"player-mini",children:[a.jsxs("div",{className:"player-name",children:[a.jsx("span",{className:"player-name__text",children:r}),u.includes("B")&&a.jsx("span",{className:"player-tag tag--B","aria-label":"Banker",children:"BANK"}),u.includes("D")&&a.jsx("span",{className:"player-tag tag--D","aria-label":"Dealer",children:"D"}),u.includes("SB")&&a.jsx("span",{className:"player-tag tag--SB","aria-label":"Small blind",children:"SB"}),u.includes("BB")&&a.jsx("span",{className:"player-tag tag--BB","aria-label":"Big blind",children:"BB"})]}),i&&a.jsx("div",{className:"player-spectating","aria-label":"spectating",children:"spectating"}),a.jsx("div",{className:"player-faces",children:d??a.jsx("span",{style:{display:"inline-block",height:22},"aria-hidden":!0})})]}),m&&h&&a.jsx(J5,{...h})]})}),$5=[oA,iA,lA,cA,uA,dA,pA,fA,mA];function dpe(e){let t=0;for(let r=0;r<e.length;r++)t=t*31+e.charCodeAt(r)>>>0;return t%($5.length*6)}function ppe({seed:e}){const t=dpe(e),r=Math.floor(t/6),n=t%6,s=$5[r],o=2,i=3,c=n%o,u=Math.floor(n/o),p={display:"block",width:"100%",height:"100%",borderRadius:"8px",backgroundImage:`url(${s})`,backgroundSize:`${o*100}% ${i*100}%`,backgroundPosition:`${c*(100/(o-1))}% ${u*(100/(i-1))}%`,backgroundRepeat:"no-repeat"};return a.jsx("span",{className:"avatar-sprite",style:p,"aria-hidden":!0})}function Lg({players:e,meId:t,className:r,showBalance:n=!1,onPlayerClick:s,renderActions:o}){return a.jsx("div",{className:["card",r].filter(Boolean).join(" "),children:a.jsx("ul",{className:"players players--avatars",role:"list",children:e.map((i,c)=>{const u=i.id??String(c),p=i.name??u;return a.jsxs("li",{className:["player","player--avatar",u===t?"is-me":""].join(" "),"data-player-id":u,title:p,"aria-label":p,onClick:()=>s==null?void 0:s(u),role:s?"button":void 0,tabIndex:s?0:-1,onKeyDown:d=>{s&&(d.key==="Enter"||d.key===" ")&&(d.preventDefault(),s(u))},children:[a.jsx("div",{className:"avatar-ring","aria-hidden":!0,children:a.jsx("div",{className:"video-bubble",children:a.jsx(ppe,{seed:i.id})})}),u===t&&a.jsx("span",{className:"status-dot","aria-hidden":!0}),a.jsxs("div",{className:"player-info",children:[a.jsx("div",{className:"player-name",children:p}),n&&a.jsx("div",{className:"player-bank",children:a.jsxs("b",{children:["$",i.balance??0]})})]}),o==null?void 0:o(i)]},u)})})})}function c1(){const[e,t]=l.useState(null),[r,n]=l.useState(null),[s,o]=l.useState(null);return{forUserId:e,anchorRect:r,anchorEl:s,openFor:(u,p)=>{p&&(t(u),o(p),n(p.getBoundingClientRect()))},close:()=>{t(null),n(null),o(null)}}}function eO({players:e,meId:t,className:r,onOpenDM:n,onOpenSendMoney:s,renderActionsOverride:o}){const{forUserId:i,anchorRect:c,anchorEl:u,openFor:p,close:d}=c1(),f=(h,b)=>{!b||h===t||p(h,b)},m=()=>d();return a.jsxs("div",{className:r,children:[a.jsx(Lg,{className:"card",players:e,meId:t,showBalance:!1,renderActions:o?h=>o(h):h=>a.jsx("button",{className:"btn btn-xs",onClick:b=>f(h.id,b.currentTarget),"aria-haspopup":"menu","aria-expanded":i===h.id,style:{marginLeft:"auto"},children:"⋯"})}),!o&&i&&a.jsx(J5,{targetId:i,anchorRect:c,anchorEl:u,onClose:m,onOpenDM:n,onOpenSendMoney:s,meId:t})]})}function fpe(e,t,r,n){const s=l.useRef(new Map),o=l.useRef(new Map),[i,c]=l.useState(0),u=l.useRef(n),p=l.useRef(0),d=l.useCallback(f=>{s.current.get(f)||(s.current.set(f,!0),o.current.set(f,performance.now()),c(m=>m+1))},[]);return l.useEffect(()=>{u.current!==n&&(s.current.clear(),o.current.clear(),p.current=0,c(f=>f+1),u.current=n)},[n]),l.useEffect(()=>{for(let f=p.current;f<e.length;f++){const m=e[f],h=m.result;Bf(h,m.playerId===t)!=="nothing"&&d(m.playerId)}p.current=e.length},[e,d,t]),l.useEffect(()=>{var m;if(!t||!((m=r.bankRoll)!=null&&m.raw))return;Bf(r.bankRoll.raw)!=="nothing"&&d(t)},[t,r.bankRoll,d]),{revealedPlayers:s.current,revealTimesRef:o,revealVersion:i,markRevealed:d}}function mpe(e){if(!e)return"Side Bet";switch(e.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 e}}function hpe(e){if(!e)return"side bet";switch(e.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 e}}function u1(e,t){if(!e)return{outcome:null,isChallenger:!1,needsAnimation:!1};const r=e.type==="MAIN"||e.type==="SIDE"?e.type:e.predicate||e.subjectId?"SIDE":"MAIN";let n=null,s=!1,o=!1,i,c=typeof e.result=="string"?e.result.toUpperCase():"",u=!1;if(!c||!["WIN","LOSE","PUSH","TIE"].includes(c)){const f=ou(e,t);f&&f.myResult&&(c=f.myResult.toUpperCase(),u=!0)}const p=c==="WIN"||c==="LOSE",d=c==="PUSH"||c==="TIE";if(!p&&!d)return{outcome:null,isChallenger:!1,needsAnimation:!1};if(u)return p?n=c==="WIN"?"win":"lose":n="push",o=p,{outcome:n,isChallenger:s,subtitle:i,needsAnimation:o};if(r==="MAIN"){const f=e.acceptedById||e.bankerId,m=e.playerId;if(!f||!m)return{outcome:null,isChallenger:!1,needsAnimation:!1};p?(t===m?(n=c==="WIN"?"win":"lose",s=!0):t===f?n=c==="WIN"?"lose":"win":n=null,o=!0):d&&((t===m||t===f)&&(n="push"),o=!0)}else{const f=e.playerId,m=e.acceptedById||void 0;if(p?(t===f?(n=c==="WIN"?"win":"lose",s=!0):t===m?n=c==="WIN"?"lose":"win":n=null,o=!!(f&&m)):d&&((t===f||t===m)&&(n="push"),o=!1),e.predicate||e.subjectId){const h=[];e.predicate&&h.push(mpe(e.predicate)),e.subjectId&&h.push(`on ${e.subjectId}`),h.length&&(i=h.join(" "))}}return{outcome:n,isChallenger:s,subtitle:i,needsAnimation:o}}function gpe(e,t){const r=e.acceptedById||e.bankerId,n=e.playerId;if(!r||!n)return null;let s,o;const i=String(e.result||"").toUpperCase();if(i==="WIN")s=r,o=n;else if(i==="LOSE")s=n,o=r;else return null;if(!s||!o||s===o)return null;const c=t(s),u=t(o);if(!c||!u||Math.hypot(u.x-c.x,u.y-c.y)<4)return null;const d=Number(e.amount)||1;return{id:`${s}-${o}-${e.id}-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,settlementId:String(e.id),amount:d,fromId:s,toId:o,startX:c.x,startY:c.y,endX:u.x,endY:u.y}}function tO(e,t,r,n){if(!Array.isArray(e)||e.length===0)return[];const s=[];for(const o of e){if(!o)continue;const i=o.type?o.type:o.predicate||o.subjectId?"SIDE":"MAIN",c={...o,type:i};c.type==="MAIN"&&!c.acceptedById&&!c.bankerId&&n&&(c.bankerId=n||void 0),!(typeof c.roundSeq!="number"||c.roundSeq!==t)&&(r.has(c.id)||(r.add(c.id),s.push(c)))}return s}const ype={1:mM,2:hM,3:gM,4:yM,5:bM,6:vM};function rO({dice:e}){return!e||!e.length?null:a.jsx("div",{className:"dice-results-icons",style:{display:"flex",gap:2},children:e.map((t,r)=>a.jsx("img",{src:ype[t],alt:`Dice face ${t}`,style:{width:22,height:22,borderRadius:"4px"}},r))})}function d1(){const[e,t]=l.useState(!1),[r,n]=l.useState(!0);l.useEffect(()=>{let o=!0;return(async()=>{try{const i=await ma();o&&(n(i.showAnimations!==!1),t(!0))}catch{o&&t(!0)}})(),()=>{o=!1}},[]);const s=l.useCallback(async o=>{const i=typeof o=="boolean"?o:!r;n(i);try{const c=await ma(),u={...Sa,...c,showAnimations:i};await $i(u)}catch{}},[r]);return{ready:e,showAnimations:r,toggleAnimations:s}}const nO=[1,5,10,25,100,500];var Dg=(e=>(e.FREE="FREE",e.PREMIUM="PREMIUM",e))(Dg||{});const Nh={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]},bpe=[500,100,25,10,5,1],m_=20;function p1(e){const t=[];let r=Math.max(1,Math.floor(e));for(const n of bpe){for(;r>=n&&(t.push(n),r-=n,!(t.length>=m_)););if(t.length>=m_)break}return r>0&&t.length<m_&&t.push(r),t.length===0&&t.push(1),t}function aO({anim:e,onComplete:t}){const{showAnimations:r}=d1(),n=r===!1,s=l.useRef(!1),o=l.useRef(e).current,{amount:i,startX:c,startY:u,endX:p,endY:d}=o,f=l.useRef([]);if(f.current.length===0){const h=p1(i),b=Math.max(0,o.startDelaySec??.25),g=Math.min(8,Math.ceil(h.length/2)),y=(h.length-1)/2;f.current=h.map((x,v)=>({id:`${e.id}-sub-${v}`,value:x,delay:b+v*.05,yOffset:(v-y)*(g>1?4:0)}))}const m=l.useCallback(()=>{s.current||(s.current=!0,t())},[t]);return l.useEffect(()=>{if(n)return Promise.resolve().then(()=>{try{m()}catch{}}),()=>{};const h=f.current.map(x=>x.delay),g=(h.length?Math.max(...h):0)*1e3+900,y=window.setTimeout(m,g);return()=>{window.clearTimeout(y)}},[n,m]),n?null:a.jsx("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:5},children:(()=>{const h=f.current.map(b=>b.delay);return h.length&&Math.min(...h),f.current.map((b,g)=>{const y=c-18,x=p-18,v=u-18+b.yOffset,A=d-18+b.yOffset;return a.jsx(Zs.div,{initial:{x:y,y:v,scale:.85,opacity:0},animate:{x,y:A,scale:1.05+g%3*.03,opacity:1},transition:{delay:b.delay,type:"spring",stiffness:150,damping:20,duration:.55+g%4*.03},onAnimationComplete:()=>{g===f.current.length-1&&m()},style:{position:"absolute"},children:a.jsx(Bo,{mini:!0,value:b.value,className:"chip--flight"})},b.id)})})()})}const Lw=new Set;function vpe(e){return Lw.add(e),()=>Lw.delete(e)}function _pe(e){e&&Lw.forEach(t=>{try{t(e)}catch{}})}function wpe({newSettlements:e,roundSeqNow:t,getAvatarCenter:r,getPlayerName:n,myId:s,bankerDice:o,bankerId:i,isPartyReady:c,onAnimCompleteBySettlement:u}){const[p,d]=l.useState([]),[f,m]=l.useState([]),h=l.useRef(new Set),b=l.useRef(new Set),g=l.useRef(null),y=l.useRef(new Set),x=l.useCallback(P=>(b.current.add(P),P),[]),v=l.useCallback(()=>{b.current.forEach(P=>clearTimeout(P)),b.current.clear(),g.current!=null&&(cancelAnimationFrame(g.current),g.current=null)},[]);l.useEffect(()=>()=>{v()},[v]);const A=l.useCallback(P=>r(P),[r]),_=l.useCallback(P=>gpe(P,A),[A]),w=l.useCallback((P,k=0)=>{if(c&&(P==null?void 0:P.type)==="MAIN"){const F=P==null?void 0:P.playerId,D=(P==null?void 0:P.acceptedById)||(P==null?void 0:P.bankerId);if(!(!!F&&c(F)&&!!D&&c(D))){x(setTimeout(()=>w(P,k),120));return}}const M=(P==null?void 0:P.acceptedById)||(P==null?void 0:P.bankerId),C=P==null?void 0:P.playerId;if(!M||!C){if(k>25)return;const F=80+k*60;x(setTimeout(()=>w(P,k+1),F));return}const I=String(P.result||"").toUpperCase();let L,N;if(I==="WIN"?(L=M,N=C):I==="LOSE"&&(L=C,N=M),L&&N){const F=A(L),D=A(N);if(!F||!D){if(k>25)return;if(k<5&&typeof requestAnimationFrame<"u")g.current=requestAnimationFrame(()=>w(P,k+1));else{const H=80+k*60;x(setTimeout(()=>w(P,k+1),H))}return}}if(k>25)return;const S=_(P);if(!S){const F=80+k*60;k<5&&typeof requestAnimationFrame<"u"?g.current=requestAnimationFrame(()=>w(P,k+1)):x(setTimeout(()=>w(P,k+1),F));return}d(F=>[...F,[S]])},[_,c,x]);l.useEffect(()=>{if(!e.length)return;const P=tO(e,t,h.current,i);for(const k of P){if(y.current.has(k.id))continue;y.current.add(k.id);const{outcome:E,needsAnimation:M}=u1(k,s);M&&x(setTimeout(()=>w(k),200))}},[e,t,s,i,w]),l.useEffect(()=>{f.length===0&&p.length>0&&(m(p[0]),d(P=>P.slice(1)))},[f.length,p]);const j=l.useCallback(P=>{m(k=>{const E=k.filter(C=>C.id!==P),M=k.find(C=>C.id===P);try{M!=null&&M.settlementId&&typeof u=="function"&&u(M.settlementId),M!=null&&M.settlementId&&(_pe(M.settlementId),h.current.add(M.settlementId))}catch{}return E})},[u]),T=l.useCallback(()=>{v(),d([]),m([]),h.current.clear(),y.current.clear()},[v]),R=l.useCallback(P=>{P!=null&&P.length&&d(k=>[...k,P])},[]);return{activeBatch:f,handleAnimItemComplete:j,resetForRound:T,queueBatch:R}}function xpe(){const{hasActive:e}=As(),t=l.useRef([]),r=l.useRef(!1),n=l.useRef(null),s=l.useRef(new Set),o=l.useCallback(()=>{na("Light").catch(()=>{})},[]),i=()=>typeof performance<"u"&&performance.now?performance.now():Date.now(),c=(ha==null?void 0:ha.diceToChipDelayMs)+600,u=l.useCallback(()=>{if(r.current)return;r.current=!0;const m=()=>{n.current&&(window.clearTimeout(n.current),n.current=null);const h=t.current;if(!h.length){r.current=!1;return}const b=h[0],g=i();if(g<b.readyAt){n.current=window.setTimeout(m,Math.min(500,Math.max(20,b.readyAt-g)));return}if(b.revealGate){const x=b.revealGate,v=x.challengerId?x.getRevealTime(x.challengerId):void 0,A=x.bankerId?x.getRevealTime(x.bankerId):void 0;if(typeof v=="number"&&typeof A=="number"){const w=Math.max(v,A)+x.postRevealDelayMs;if(g<w){const j=Math.min(w-g,1e3);n.current=window.setTimeout(m,Math.max(50,j));return}}else if(g-b.enqueuedAt<c){n.current=window.setTimeout(m,120);return}}try{o()}catch{}try{b.run()}catch{}const y=h.shift();y!=null&&y.key&&s.current.add(y.key),n.current=window.setTimeout(m,0)};m()},[o]),p=l.useCallback((m,h)=>{const b=Math.max(0,typeof(h==null?void 0:h.delayMs)=="number"?h.delayMs:0),g=i(),y=g+(h!=null&&h.immediate?0:b);if(h!=null&&h.key){if(s.current.has(h.key))return;s.current.add(h.key)}t.current.push({run:m,readyAt:y,revealGate:h==null?void 0:h.revealGate,key:h==null?void 0:h.key,enqueuedAt:g}),u()},[u]),d=l.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),r.current=!1,u()},[u]),f=l.useCallback(()=>{n.current&&(window.clearTimeout(n.current),n.current=null),t.current=[],r.current=!1},[]);return{schedule:p,nudge:d,clear:f,hasActive:e}}function Ape({newSettlements:e,roundSeqNow:t,myId:r,bankerDice:n,getPlayerName:s,getPlayerAvatarUrl:o,getPlayerDice:i,getRevealTime:c,postRevealDelayMs:u=0,bankerId:p}){const{win:d,lose:f,push:m}=As(),h=l.useRef(new Set),{schedule:b,nudge:g,clear:y}=xpe(),x=l.useRef(null),v=l.useRef(!1),A=l.useRef(!1);l.useRef(new Set);const _=l.useRef(new Set),w=l.useRef(null);l.useEffect(()=>{const P=n;if(!P||P.length!==3){x.current=null,v.current=!1;return}const k={};for(const C of P)k[C]=(k[C]||0)+1;const E=Object.keys(k).map(Number);E.length===2&&E.some(C=>k[C]===1)?x.current=E.find(C=>k[C]===1):x.current=null;try{const C=[...P].sort((I,L)=>I-L).join(",");v.current=C==="4,5,6",A.current=C==="1,2,3"}catch{v.current=!1,A.current=!1}},[n]);const j=l.useCallback((P,k)=>{const E=k||`${t}:${P}:${Date.now()}`;_.current.has(E)||(_.current.add(E),P==="win"?(u0({volume:.18}),window.setTimeout(()=>{try{lI("win",{volume:.4})}catch{}},90)):P==="lose"?jx({volume:.08}):oI({volume:.09}))},[t]),T=l.useCallback((P,k,E,M,C,I,L,N)=>{if(j(P,N),P==="win"||P==="lose")try{window.dispatchEvent(new CustomEvent("ceelo:result",{detail:{result:P}}))}catch{}const S=k?" Clutch":"",F=I?I.replace(/^(won|lost)\s*/i,"").trim():"",D=L!=null&&L.length?{playerAvatars:L}:void 0;if(M)P==="win"?d(`${M}${S}`,E,void 0,void 0,D):P==="lose"?f(M,E,void 0,void 0,D):m(M,E,void 0,void 0,D);else if(C)P==="win"?d("win",E,void 0,void 0,D):P==="lose"?f("lose",E,void 0,void 0,D):m("push",E,void 0,void 0,D);else{const H=F?`Won ${F}!${S}`:`You Won!${S}`,W=F?`Lost ${F}!`:"You Lost!";P==="win"?d(H,E,void 0,void 0,D):P==="lose"?f(W,E,void 0,void 0,D):m("Push!",E,void 0,void 0,D)}},[j,d,f,m]),R=l.useCallback((P,k,E,M,C,I={})=>{const L=k&&(x.current??0)>=5&&P==="win";b(()=>T(P,L,E,M,C,void 0,void 0,I.key),I)},[b,T]);l.useEffect(()=>{const P=tO(e,t,h.current,p);if(P.length)for(const k of P){const{outcome:E,isChallenger:M,subtitle:C,needsAnimation:I}=u1(k,r);if(!E)continue;let L=C,N=!1;if(k.type==="SIDE"){const he=k.subjectId&&s(k.subjectId)||k.subjectId||"Player",Ae=hpe(k.predicate);let Fe;E==="win"?Fe=`${he} ${Ae}`:E==="lose"?Ae==="beats banker"?Fe=`${he} does not beat banker`:Ae==="loses to banker"?Fe=`${he} does not lose to banker`:Ae==="ties banker"?Fe=`${he} does not tie banker`:Fe=`${he} ${Ae}`:Fe=`${he} ${Ae}`,L=Fe,N=!0}else C&&k.subjectId&&C.includes("on ")&&(L=C.replace(/on \S+$/,`on ${s(k.subjectId)||k.subjectId}`));try{const he=ou(k,r);if(he&&he.label&&!(k.type==="SIDE"&&N)){const Fe=String(he.label||"").trim(),U=String(L||"").trim();if(U.length===0)L=Fe;else if(Fe.length>0){const V=U.toLowerCase(),z=Fe.toLowerCase();V.includes(z)||(L=`${U} — ${Fe}`)}}}catch{}E==="push"&&((L||"").trim()||(L="No Action"));const S=k.type==="SIDE"?k.subjectId||void 0:k.playerId,F=k.type==="SIDE"?p:k.acceptedById||k.bankerId||p,D=!!(v.current||A.current),H=D||k.type==="SIDE"?!1:I,W=D?!0:!H,G=!D&&H?ha.diceToChipDelayMs+50:0,$=S,K=F,de=c?ha.revealFlashPostDelayMs:0,ie=c&&!D?{getRevealTime:c,challengerId:$,bankerId:K,postRevealDelayMs:de}:void 0,we=ie?0:H?G:0;if(k.type==="MAIN"){let he;try{const z=ou(k,r);he=String((z==null?void 0:z.label)||"").trim()||void 0}catch{}let Ae,Fe;try{const z=k,O=(Array.isArray(z.bankerDice)&&z.bankerDice.length===3?z.bankerDice:null)||(i&&p?i(p):null),q=(Array.isArray(z.challengerDice)&&z.challengerDice.length===3?z.challengerDice:null)||(i?i(k.playerId):null);console.log("[useSettlementFlashes] dice source",{fromPayload:{banker:z.bankerDice,challenger:z.challengerDice},fromState:{banker:i&&p?i(p):"n/a",challenger:i?i(k.playerId):"n/a"},resolved:{bankerD:O,challengerD:q},outcome:E,playerId:k.playerId});const X=["","⚀","⚁","⚂","⚃","⚄","⚅"],Z=re=>re.slice().sort((pe,ee)=>pe-ee).map(pe=>X[pe]||String(pe)).join(""),Q=p&&s(p)||"Banker",oe=s(k.playerId)||"Challenger",ce={name:Q,avatarUrl:p&&o?o(p):void 0},_e={name:oe,avatarUrl:o?o(k.playerId):void 0};if(O&&q){const re=f_(O),pe=f_(q),ee=new Set(["456","123","triple","point"]);if(ee.has(re.kind)&&ee.has(pe.kind)){const Le=`${Q}: ${Z(O)} ${re.label}`,Ge=`${oe}: ${Z(q)} ${pe.label}`;re.score>=pe.score?(Ae=`${Le}
${Ge}`,Fe=[ce,_e]):(Ae=`${Ge}
${Le}`,Fe=[_e,ce])}}else if(O){const re=f_(O);(re.kind==="456"||re.kind==="123")&&(Ae=`${p&&s(p)||"Banker"}: ${Z(O)} ${re.label}`)}}catch{}console.log("[useSettlementFlashes] capturedReason",{capturedReason:Ae,capturedLabel:he,outcome:E});let U;E==="push"?U=Ae||"No Action":Ae?U=Ae:U=he||"",console.log("[useSettlementFlashes] FINAL subtitle",{capturedSubtitle:U,outcome:E}),b(()=>{T(E,M,U,void 0,N,he,Fe,String(k.id))},{immediate:D?!0:W&&!ie,delayMs:we,revealGate:ie,key:String(k.id)})}else R(E,M,L,void 0,N,{immediate:D?!0:W&&!ie,delayMs:we,revealGate:ie,key:String(k.id)})}},[e,t,r,s,R,p]),l.useEffect(()=>{if(!(v.current||A.current)||w.current===t||Array.isArray(e)&&e.some(H=>(H==null?void 0:H.roundSeq)===t))return;const E=v.current,M=p&&s(p)||"Banker",C=["","⚀","⚁","⚂","⚃","⚄","⚅"],L=n?` ${(H=>H.slice().sort((W,G)=>W-G).map(W=>C[W]||String(W)).join(""))(n)}`:"",N=E?`${M}:${L} 4‑5‑6`:`${M}:${L} 1‑2‑3`,S=E?"All challengers lose":"All challengers win",F=p&&r&&p===r,D=E?F?"win":"lose":F?"lose":"win";b(()=>T(D,!1,S,N,!0,void 0,void 0,`auto-${t}`),{immediate:!0,key:`auto-${t}`}),w.current=t},[e,t,r,p,b,T]),l.useEffect(()=>{const P=vpe(k=>{try{g()}catch{}});return()=>{try{P()}catch{}}},[g]),l.useEffect(()=>()=>{try{y()}catch{}},[y])}function sO({open:e,onClose:t,message:r}){const n=Hr(),s=r||"You must be logged in.",o=l.useCallback(()=>{n("/lobby")},[n]);if(!e)return null;const i=a.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Login required",children:[a.jsx("div",{className:"results-modal__backdrop",onClick:t}),a.jsxs("div",{className:"results-modal__card card",onClick:c=>c.stopPropagation(),children:[a.jsxs("div",{className:"results-modal__header",children:[a.jsx("h3",{children:"Login required"}),a.jsx("button",{type:"button","aria-label":"Close",className:"btn btn--ghost",onClick:t,children:"✕"})]}),a.jsxs("div",{style:{padding:16},children:[a.jsx("p",{style:{marginBottom:16},children:s}),a.jsxs("div",{style:{display:"flex",gap:8,justifyContent:"flex-end"},children:[a.jsx("button",{className:"btn btn--ghost",onClick:t,children:"Cancel"}),a.jsx("button",{className:"btn btn--primary",onClick:o,children:"Go to Home"})]})]})]})]});return ws.createPortal(i,document.body)}function kpe({isUserTurn:e=!1,onOpen:t,isConnected:r=!0}){const{micEnabled:n,videoEnabled:s,speaking:o}=Yo(),[i,c]=l.useState(!1),u=l.useRef(null),d=l.useCallback(()=>r?n?Object.values(o).some(Boolean)?"speaking":"connected":"muted":"disconnected",[r,n,o])(),f=l.useCallback(()=>{if(!(!r||e)){try{cr("Light")}catch{}t()}},[r,e,t]),m=l.useCallback(()=>{r&&(u.current=setTimeout(()=>{if(c(!0),e){try{cr("Medium")}catch{}t()}},500))},[r,e,t]),h=l.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),setTimeout(()=>c(!1),1500)},[]),b=l.useCallback(()=>{u.current&&(clearTimeout(u.current),u.current=null),c(!1)},[]),g=d==="muted"?"Muted":d==="disconnected"?"Voice disconnected":"Voice connected",y=n||s,x=["comms-btn",`comms-btn--${d}`,y?"comms-btn--active":"",e?"comms-btn--turn":""].filter(Boolean).join(" ");return a.jsxs("div",{className:"comms-btn-container",children:[a.jsxs("button",{type:"button",className:x,onClick:f,onPointerDown:m,onPointerUp:h,onPointerLeave:b,onPointerCancel:b,"aria-label":g,"aria-pressed":n,style:{opacity:e?.75:1,pointerEvents:"auto"},children:[d==="speaking"&&a.jsx("span",{className:"comms-btn__pulse","aria-hidden":"true"}),a.jsxs("span",{className:"comms-btn__icon-wrap",children:[a.jsx(Spe,{}),d==="muted"&&a.jsx("span",{className:"comms-btn__slash","aria-hidden":"true"})]})]}),i&&a.jsx("div",{className:"comms-btn__tooltip",role:"tooltip",children:g})]})}function Spe(){return a.jsx("svg",{className:"comms-btn__svg",viewBox:"0 0 24 24",fill:"currentColor","aria-hidden":"true",children:a.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 Epe({open:e,onClose:t,roomId:r,onLeaveVoice:n,onBlockReport:s}){const{micEnabled:o,setMicEnabled:i,videoEnabled:c,setVideoEnabled:u,leaveRoom:p}=Yo(),[d,f]=l.useState(100),[m,h]=l.useState(!1),[b,g]=l.useState(!1),y=l.useRef(null),x=l.useCallback(T=>{T.target===T.currentTarget&&t()},[t]);l.useEffect(()=>{if(!e)return;const T=R=>{R.key==="Escape"&&t()};return document.addEventListener("keydown",T),()=>document.removeEventListener("keydown",T)},[e,t]),l.useEffect(()=>{if(!e||!y.current)return;const T=y.current.querySelector('button, input, [tabindex]:not([tabindex="-1"])');T==null||T.focus()},[e]);const v=l.useCallback(async()=>{if(!m){try{cr("Light")}catch{}h(!0);try{await i(!o)}catch{}finally{h(!1)}}},[o,i,m]),A=l.useCallback(async()=>{if(!b){try{cr("Light")}catch{}g(!0);try{await u(!c)}catch{}finally{g(!1)}}},[c,u,b]),_=l.useCallback(T=>{const R=parseInt(T.target.value,10);f(R);try{window.dispatchEvent(new CustomEvent("comms:volume",{detail:{volume:R/100}}))}catch{}},[]),w=l.useCallback(()=>{try{cr("Medium")}catch{}p(r),n==null||n(),t()},[r,p,n,t]),j=l.useCallback(()=>{try{cr("Medium")}catch{}s==null||s(),t()},[s,t]);return e?ws.createPortal(a.jsx("div",{className:"comms-drawer-backdrop",onClick:x,"aria-modal":"true",role:"dialog",children:a.jsxs("div",{ref:y,className:"comms-drawer",role:"document","aria-label":"Communication settings",children:[a.jsx("div",{className:"comms-drawer__handle","aria-hidden":"true"}),a.jsxs("div",{className:"comms-drawer__header",children:[a.jsx("h2",{className:"comms-drawer__title",children:"Voice & Video"}),a.jsx("button",{type:"button",className:"comms-drawer__close",onClick:t,"aria-label":"Close",children:"✕"})]}),a.jsxs("div",{className:"comms-drawer__content",children:[a.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${o?"comms-drawer__row--active":""} ${m?"comms-drawer__row--activating":""}`,onClick:v,"aria-pressed":o,disabled:m,children:[a.jsx("span",{className:"comms-drawer__row-icon",children:o?"🎙️":"🔇"}),a.jsx("span",{className:"comms-drawer__row-label",children:m?"Activating…":o?"Microphone On":"Microphone Off"}),m?a.jsx("span",{className:"comms-drawer__spinner",role:"status","aria-label":"Activating"}):a.jsx("span",{className:`comms-drawer__toggle ${o?"comms-drawer__toggle--on":""}`,children:a.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),a.jsxs("button",{type:"button",className:`comms-drawer__row comms-drawer__row--toggle ${c?"comms-drawer__row--active":""} ${b?"comms-drawer__row--activating":""}`,onClick:A,"aria-pressed":c,disabled:b,children:[a.jsx("span",{className:"comms-drawer__row-icon",children:c?"📹":"📷"}),a.jsx("span",{className:"comms-drawer__row-label",children:b?"Activating…":c?"Camera On":"Camera Off"}),b?a.jsx("span",{className:"comms-drawer__spinner",role:"status","aria-label":"Activating"}):a.jsx("span",{className:`comms-drawer__toggle ${c?"comms-drawer__toggle--on":""}`,children:a.jsx("span",{className:"comms-drawer__toggle-knob"})})]}),a.jsxs("div",{className:"comms-drawer__row comms-drawer__row--slider",children:[a.jsx("span",{className:"comms-drawer__row-icon",children:"🔊"}),a.jsx("span",{className:"comms-drawer__row-label",children:"Volume"}),a.jsx("input",{type:"range",min:"0",max:"100",value:d,onChange:_,className:"comms-drawer__slider","aria-label":"Volume"}),a.jsxs("span",{className:"comms-drawer__slider-value",children:[d,"%"]})]}),a.jsx("hr",{className:"comms-drawer__divider"}),a.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:w,children:[a.jsx("span",{className:"comms-drawer__row-icon",children:"🚪"}),a.jsx("span",{className:"comms-drawer__row-label",children:"Leave Voice"})]}),s&&a.jsxs("button",{type:"button",className:"comms-drawer__row comms-drawer__row--danger",onClick:j,children:[a.jsx("span",{className:"comms-drawer__row-icon",children:"🚫"}),a.jsx("span",{className:"comms-drawer__row-label",children:"Block / Report Player"})]})]}),a.jsx("div",{className:"comms-drawer__footer",children:a.jsx("p",{children:"All changes are saved automatically"})})]})}),document.body):null}function oO({roomId:e,isUserTurn:t=!1,leftSlot:r,singlePlayer:n}){Yo();const{user:s}=Zr(),[o,i]=l.useState(!1),[c,u]=l.useState(!1),[p,d]=l.useState(c8()),f=(()=>{try{return(s==null?void 0:s.isGuest)===!0}catch{return!1}})(),m=l.useCallback(b=>()=>{try{cr("Light")}catch{}try{}catch{}b()},[]);l.useEffect(()=>{let b=!0;return(async()=>{try{const g=await ma();if(!b)return;const y=!!g.diceAudio;d(y),SS(y)}catch{}})(),()=>{b=!1}},[]),m(()=>{const b=!p;if(d(b),SS(b),b)try{yn()}catch{}(async()=>{try{const y={...await ma(),diceAudio:b};await $i(y)}catch{}})()}),l.useMemo(()=>p?"Mute sounds":"Unmute sounds",[p]);const h=l.useCallback(()=>{if(f){i(!0);return}u(!0)},[f]);return a.jsxs(a.Fragment,{children:[r,a.jsx("div",{className:"poker-header-comms",role:"group","aria-label":"communications controls",children:a.jsx(kpe,{isUserTurn:t,onOpen:h,isConnected:!!e&&!n})}),a.jsx(Epe,{open:c,onClose:()=>u(!1),roomId:e}),a.jsx(sO,{open:o,onClose:()=>i(!1)})]})}const iO=l.createContext(void 0),Ppe=({children:e})=>{const[t,r]=l.useState([]),[n,s]=l.useState(null),{sendGameInvite:o,respondGameInvite:i}=sa(),c=ji();Ba({onGameInviteReceived:m=>{const h={inviteId:m.inviteId,fromUserId:m.fromUserId,fromUserName:m.fromUserName,roomId:m.roomId,roomName:m.roomName,gameMode:m.gameMode,receivedAt:Date.now()};r(b=>[...b,h]),s(b=>b||h)},onGameInviteCancelled:m=>{r(h=>h.filter(b=>b.inviteId!==m.inviteId)),s(h=>(h==null?void 0:h.inviteId)===m.inviteId?null:h),c==null||c.info(m.reason||"Game invite was cancelled")}}),l.useEffect(()=>{const m=setInterval(()=>{const h=Date.now(),b=2*60*1e3;r(g=>g.filter(y=>h-y.receivedAt<b))},1e4);return()=>clearInterval(m)},[]);const u=l.useCallback(async(m,h,b)=>{try{const g=await o(m,h,b);if(g&&g.ok)return c==null||c.success("Invite sent!"),{ok:!0};{const y=(g==null?void 0:g.error)||"Failed to send invite";return c==null||c.error(y),{ok:!1,error:y}}}catch(g){const y=(g==null?void 0:g.message)||"Failed to send invite";return c==null||c.error(y),{ok:!1,error:y}}},[o,c]),p=l.useCallback(async m=>{const h=t.find(b=>b.inviteId===m);if(!h)return{ok:!1};try{const b=await i(m,"accept");return b&&b.ok?(r(g=>g.filter(y=>y.inviteId!==m)),s(null),{ok:!0,roomId:h.roomId,gameMode:h.gameMode}):{ok:!1}}catch{return{ok:!1}}},[t,i]),d=l.useCallback(m=>{i(m,"decline").catch(()=>{}),r(h=>h.filter(b=>b.inviteId!==m)),s(h=>(h==null?void 0:h.inviteId)===m?t.filter(g=>g.inviteId!==m)[0]||null:h)},[t,i]),f=l.useCallback(()=>{n&&d(n.inviteId)},[n,d]);return a.jsx(iO.Provider,{value:{pendingInvites:t,currentInvite:n,sendInvite:u,acceptInvite:p,declineInvite:d,dismissCurrentInvite:f},children:e})};function lO(){return l.useContext(iO)}function cO({roomId:e,gameMode:t,className:r}){const[n,s]=l.useState(!1),[o,i]=l.useState(null),[c,u]=l.useState(new Set),p=l.useRef(null),d=lO(),{friends:f}=sc();l.useEffect(()=>{if(!n)return;const g=x=>{x.key==="Escape"&&s(!1)},y=x=>{p.current&&!p.current.contains(x.target)&&s(!1)};return document.addEventListener("keydown",g),document.addEventListener("mousedown",y),()=>{document.removeEventListener("keydown",g),document.removeEventListener("mousedown",y)}},[n]);const m=async g=>{if(d){i(g);try{(await d.sendInvite(e,g,t)).ok&&u(x=>new Set([...x,g]))}finally{i(null)}}},h=g=>{switch(g){case"cee-lo":return"Cee-Lo";case"craps":return"Craps";case"poker":return"Poker";default:return g}};if(!d)return null;const b=n?a.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:a.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Invite friends",ref:p,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:[a.jsx("button",{className:"modal-close",onClick:()=>s(!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:"×"}),a.jsxs("h3",{className:"modal-title",style:{marginBottom:16,textAlign:"center"},children:["Invite Friends to ",h(t)]}),f.length===0?a.jsxs("p",{style:{textAlign:"center",opacity:.7,padding:"20px 0"},children:["You don't have any friends yet.",a.jsx("br",{}),"Add friends from your profile to invite them to games!"]}):a.jsx("ul",{style:{listStyle:"none",padding:0,margin:0},children:f.map(g=>{const y=c.has(g.id),x=o===g.id;return a.jsxs("li",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",padding:"12px 0",borderBottom:"1px solid rgba(255,255,255,0.1)"},children:[a.jsx("span",{style:{fontWeight:500},children:g.name||"Anonymous"}),y?a.jsx("span",{style:{color:"var(--success, #4caf50)",fontSize:"0.875rem"},children:"✓ Invited"}):a.jsx("button",{className:"felt-btn felt-btn--sm felt-btn--primary",onClick:()=>m(g.id),disabled:x,style:{minWidth:70},children:x?"...":"Invite"})]},g.id)})}),a.jsx("div",{style:{marginTop:20,textAlign:"center"},children:a.jsx("button",{className:"felt-btn btn--ghost",onClick:()=>s(!1),children:"Close"})})]})}):null;return a.jsxs(a.Fragment,{children:[a.jsx("a",{className:`gold-link ${r||""}`,onClick:()=>s(!0),title:"Invite a friend to this game","aria-label":"Invite friend",style:{padding:"0px 10px",fontSize:"2.5rem",lineHeight:1},children:"+"}),b&&ws.createPortal(b,document.body)]})}function Lb(e){var Bn,xr,Zn,$n;const{roomName:t,players:r,bankerId:n,currentRollerId:s,meId:o,gameState:i,roomId:c,onOpenDM:u,onOpenSendMoney:p,showHeader:d=!0,className:f,lite:m=!1,hideDiceResults:h,disableBankerFlash:b,crapsRollHistory:g,lastRollerId:y,hideSideBets:x,hideAvatars:v,renderFacesOverride:A,headerCommsLeftSlot:_}=e;if(m)return a.jsx(eO,{players:r,meId:o,className:f,onOpenDM:u,onOpenSendMoney:p});const{handleLeave:w}=s1(c,o,{autoJoin:!1}),j=Hr(),{onBuyChips:T,busy:R,ready:P,isWeb:k}=kp(),{onHandEnd:E}=bu(),M=Yo(),{remoteStreams:C,myVideo:I,remoteVideoFlags:L}=M,{proofs:N,reveals:S,verifyFor:F}=H5(c),{user:D,updateBalance:H}=Zr(),W=(()=>{try{return(D==null?void 0:D.isGuest)===!0}catch{return!1}})(),[G,$]=l.useState(!1),[K,de]=l.useState(!1),[ie,we]=l.useState({}),{settledAll:he,playerBalance:Ae,mySettledAll:Fe,newSettlements:U,openAllMain:V}=jb(c,o),{leaveRoom:z,skillsLeaveRoom:O}=sa();i==null||i.betsLocked;const q=l.useCallback(()=>{const Be=i==null?void 0:i.gameMode;if(Be==="poker"){c&&z(c),j("/lobby");return}if(Be==="skills"){c&&O(c),j("/");return}w()},[i,c,z,O,j,w]),X=l.useCallback(Be=>()=>{try{cr("Light")}catch{}try{}catch{}Be()},[]),Z=l.useMemo(()=>{var Be;return(Be=r.find(ut=>ut.id===o))==null?void 0:Be.balance},[r,o]),Q=i==null?void 0:i.gameMode,oe=(()=>{const Be=typeof Ae=="number"?Ae:void 0,ut=typeof Z=="number"?Z:void 0;if(Q==="craps")return ut??Be??0;if(Q==="poker"){const be=Be??ut??0,nt=(Array.isArray(i==null?void 0:i.pokerSeats)?i.pokerSeats:[]).find(Bt=>Bt.playerId===o),it=nt&&typeof nt.stack=="number"?nt.stack:0;return be+it}return Be??ut??0})(),[ce,_e]=l.useState(oe),[re,pe]=l.useState(!1),ee=l.useRef(oe),xe=l.useRef(new Set),Le=l.useRef({}),Ge=l.useRef(0),_t=5e3,Xe=l.useRef({}),[bt,Pt]=l.useState(0);l.useEffect(()=>{Date.now()-Ge.current<_t||ee.current!==oe&&(ee.current=oe,_e(oe))},[oe]);const kt=l.useMemo(()=>{if((i==null?void 0:i.gameMode)!=="poker")return null;const ut=Array.isArray(i==null?void 0:i.pokerSeats)?i.pokerSeats:[],be=new Set;for(const Se of ut)Se!=null&&Se.playerId&&be.add(String(Se.playerId));return be},[i==null?void 0:i.gameMode,i==null?void 0:i.pokerSeats]),Ee=l.useCallback(Be=>{const ut=i==null?void 0:i.gameMode;if(ut==="poker"){const be=typeof Be.balance=="number"?Be.balance:0,nt=(Array.isArray(i==null?void 0:i.pokerSeats)?i.pokerSeats:[]).find(Bt=>Bt.playerId===Be.id);if(nt&&typeof nt.stack=="number")return Math.max(0,nt.stack);const it=typeof(nt==null?void 0:nt.committed)=="number"?nt.committed:0;return Math.max(0,be-it)}return ut==="craps"&&Be.id!==o&&typeof Xe.current[Be.id]=="number"?Xe.current[Be.id]:Be.id===o?Number(ce??0):typeof Be.balance=="number"?Be.balance:0},[i,o,ce,bt]),le=l.useMemo(()=>{var be;const Be=i==null?void 0:i.gameMode;return Be==="poker"?kt?r.filter(Se=>kt.has(Se.id)):r:Be==="craps"||Be==="skills"||(i==null?void 0:i.mode)==="single"||((be=e.roomId)==null?void 0:be.includes("single"))?r:r.filter(Se=>{var it,Bt;return Se.id===o||(it=Se.id)!=null&&it.startsWith("bot_")||(Bt=Se.id)!=null&&Bt.startsWith("craps_bot_")?!0:Ee(Se)>0})},[r,kt,i==null?void 0:i.gameMode,i==null?void 0:i.mode,o,Ee,e.roomId]),De=l.useMemo(()=>Object.fromEntries(le.map(Be=>[Be.id,Be])),[le]),Ye=l.useRef(void 0),Re=l.useRef(new Map);l.useEffect(()=>{if((i==null?void 0:i.gameMode)!=="poker")return;const ut=e.roomId||"unknown";Ye.current!==ut&&(Ye.current=ut,Re.current=new Map);const be=Re.current;let Se=-1;be.forEach(nt=>{nt>Se&&(Se=nt)});for(const nt of le)be.has(nt.id)||(Se+=1,be.set(nt.id,Se))},[le,e.roomId,i==null?void 0:i.gameMode]);const et=l.useMemo(()=>{const Be=i==null?void 0:i.gameMode;if(Be==="poker"){const Se=Re.current;return le.map(nt=>nt.id).slice().sort((nt,it)=>(Se.get(nt)??0)-(Se.get(it)??0))}if(Be==="skills")return le.map(Se=>Se.id);const ut=Array.isArray(i==null?void 0:i.turnOrder)?i.turnOrder:[],be=(()=>{if(!ut.length)return le.map(Bt=>Bt.id);const Se=new Set(le.map(Bt=>Bt.id)),nt=ut.filter(Bt=>Se.has(Bt)),it=le.map(Bt=>Bt.id).filter(Bt=>!nt.includes(Bt));return[...nt,...it]})();if(e.localFirst&&o){const Se=be.indexOf(o);if(Se>0)return[...be.slice(Se),...be.slice(0,Se)]}return be},[le,r,i==null?void 0:i.turnOrder,i==null?void 0:i.gameMode,e.localFirst,o]),rt=i.roundSeq??1;l.useEffect(()=>{if(!(!U||!U.length)){for(const Be of U){if(!Be||Be.roundSeq!==rt||xe.current.has(Be.id))continue;const ut={...Be,type:Be.type||(Be.predicate||Be.subjectId?"SIDE":"MAIN")},be=u1(ut,o);if(!be.outcome)continue;xe.current.add(Be.id);let Se=0,nt=0;try{const er=ou(Be,o);er&&(er.myResult==="WIN"?Se=er.myPayout||0:er.myResult==="LOSE"&&(nt=Be.amount||0))}catch{}const it=Se>0?Se:nt>0?-nt:0;if(it===0)continue;const Bt=be.needsAnimation?2e3:0,ir=window.setTimeout(()=>{_e(er=>er+it),pe(!0),window.setTimeout(()=>pe(!1),2e3),delete Le.current[Be.id]},Bt);Le.current[Be.id]=ir}return()=>{Object.values(Le.current).forEach(Be=>window.clearTimeout(Be)),Le.current={}}}},[U,rt,o]);const ne=l.useMemo(()=>typeof i.roundSeq=="number"?(i.turnHistory??[]).filter(Be=>Be.roundSeq===i.roundSeq):i.turnHistory??[],[i.turnHistory,i.roundSeq]),[ue,B]=l.useState(!1),[fe,ye]=l.useState(0),[ve,ke]=l.useState(void 0);l.useEffect(()=>{if(!(!U||!U.length||(i==null?void 0:i.gameMode)==="poker"))for(const ut of U){if(!ut||ut.roundSeq!==rt||ut.playerId!==o)continue;const be=ou(ut,o);if(be&&be.myResult==="LOSE"){const Se=Number(ut.amount||0);ye(Se>0?Se:0),ke(void 0),B(!0);break}}},[U,rt,o,i]);const[Ue,ct]=l.useState(null),[dt,Rt]=l.useState(null),[jr,Qe]=l.useState(!1),[Mt,lr]=l.useState(!1),zt=l.useRef(null),[br,fr]=l.useState(new Map),{sendVisibilityChange:ur}=sa();l.useEffect(()=>{ct(null)},[c]);const Ie=l.useCallback(async()=>{if(c)try{const Be=await rpe(c);Be&&ct(Be)}catch{}},[c]),yt=l.useCallback(async()=>{if(c)try{Qe(!0);const Be=await npe(c);Rt(Be||null)}catch{Rt(null)}finally{Qe(!1)}},[c]);l.useEffect(()=>{Mt&&(i==null?void 0:i.gameMode)==="craps"&&Ie()},[Mt,i,Ie]),l.useEffect(()=>{if(!c||!N||typeof N!="object")return;let Be=!1;const ut=rt,be=`${ut}:`,Se=Object.keys(N||{}).filter(nt=>nt.startsWith(be));if(Se.length)return Se.forEach(nt=>{const it=nt.split(":")[1];it&&(async()=>{try{const Bt=await F(it,ut);Be||we(ir=>ir[nt]===Bt?ir:{...ir,[nt]:Bt})}catch{Be||we(Bt=>Bt[nt]==="unverifiable"?Bt:{...Bt,[nt]:"unverifiable"})}})()}),()=>{Be=!0}},[N,S,F,c,rt]);const St=l.useMemo(()=>{var Be;if(!n)return null;for(let ut=ne.length-1;ut>=0;ut--){const be=ne[ut];if(be.playerId===n&&Array.isArray(be.result)&&be.result.length===3){const Se=be.result;if(Bf(Se)!=="nothing")return Se}}if((Be=i.bankRoll)!=null&&Be.raw&&Array.isArray(i.bankRoll.raw)&&i.bankRoll.raw.length===3){const ut=i.bankRoll.raw;if(Bf(ut)!=="nothing")return ut}return null},[n,ne,i.bankRoll]),{revealedPlayers:Xt,revealTimesRef:se}=fpe(ne,n,i,rt),{show:je,roll:Oe,activeKind:Ke,hasActive:Me,onIdle:wt,info:at}=As(),Dt=l.useRef(null),Ut=l.useRef(null);l.useEffect(()=>{if(!(Q!=="craps"&&Q!=="poker"&&Q!=="skills")||!St||St.length!==3||l1(St)!=="point")return;const ut={};for(const it of St)ut[it]=(ut[it]||0)+1;const be=Object.keys(ut).map(Number).find(it=>ut[it]===1);if(be==null)return;const Se=`${rt}:${be}`;if(Dt.current===Se)return;Ut.current&&window.clearTimeout(Ut.current);const nt=[...St];Ut.current=window.setTimeout(()=>{var hr;if(Ut.current=null,Dt.current===Se)return;Dt.current=Se;const it=n&&((hr=r.find(J=>J.id===n))==null?void 0:hr.name),Bt=["","⚀","⚁","⚂","⚃","⚄","⚅"],ir=J=>J.slice().sort(($e,jt)=>$e-jt).map($e=>Bt[$e]||String($e)).join(""),er=`${it||"Banker"}'s Point`,mr=`${ir(nt)} — point is ${be}`;Oe(er,mr)},ha.revealFlashPostDelayMs)},[St,rt,Q,n,r,Oe]);const ft=l.useRef(new Set),wr=l.useRef(!1);l.useEffect(()=>{if(!wr.current){const Be=new Set(r.map(ut=>String(ut.id)));ft.current=Be,wr.current=!0}},[r]);const dr=l.useMemo(()=>{const Be=new Map;try{const ut=Array.isArray(V)?V:[];for(const be of ut){const Se=be==null?void 0:be.roundSeq;typeof Se=="number"&&Se!==rt||be&&be.playerId&&typeof be.amount=="number"&&Be.set(be.playerId,be.amount)}}catch{}return Be},[V,rt]),Vt=l.useRef({});l.useRef(0),l.useRef(null),Ba({onOtherPlayerJoined:({room:Be})=>{try{if(!Be||!Array.isArray(Be.players))return;const ut=ft.current,be=new Set(Be.players.map(nt=>String(nt.id)));if(!wr.current){ft.current=be,wr.current=!0;return}const Se=[...be].filter(nt=>!ut.has(nt));if(Se.length>0){const nt=new Map(Be.players.map(it=>[String(it.id),it]));for(const it of Se){if(it===o)continue;const Bt=nt.get(it),ir=(Bt==null?void 0:Bt.name)||(Bt==null?void 0:Bt.email)||it;try{at&&at("Player Joined",String(ir))}catch{}}}ft.current=be}catch{}},onOtherLeft:({room:Be})=>{try{if(!Be||!Array.isArray(Be.players))return;const ut=ft.current,be=new Set(Be.players.map(nt=>String(nt.id)));if(!wr.current){ft.current=be,wr.current=!0;return}const Se=[...ut].filter(nt=>!be.has(nt));if(Se.length>0){const nt=new Map;try{r.forEach(it=>nt.set(String(it.id),it.name||it.email||String(it.id)))}catch{}for(const it of Se){if(it===o)continue;const Bt=nt.get(it)||it;try{at&&at("Player Left",String(Bt))}catch{}}}ft.current=be}catch{}},onPlayerBalanceUpdated:({playerId:Be,balance:ut})=>{if(Be!==o){Xe.current[Be]=ut,Pt(be=>be+1);return}Ge.current=Date.now(),Object.values(Le.current).forEach(be=>window.clearTimeout(be)),Le.current={},xe.current.clear(),ee.current=ut,_e(ut),H(ut),pe(!0),window.setTimeout(()=>pe(!1),2e3)},onCrapsBetResults:Be=>{!Be||Be.roomId!==c||(zt.current&&window.clearTimeout(zt.current),zt.current=window.setTimeout(()=>{Ie()},350))},onCrapsBetsUpdate:Be=>{!Be||Be.roomId!==c||(zt.current&&window.clearTimeout(zt.current),zt.current=window.setTimeout(()=>{Ie()},250))},onCrapsPointSet:Be=>{!Be||Be.roomId!==c||(zt.current&&window.clearTimeout(zt.current),zt.current=window.setTimeout(()=>{Ie()},300))},onCrapsPointMade:Be=>{!Be||Be.roomId!==c||(zt.current&&window.clearTimeout(zt.current),zt.current=window.setTimeout(()=>{Ie()},300))},onPlayerPresenceUpdate:Be=>{if(!Be||Be.roomId!==c)return;const{playerId:ut,status:be}=Be;!ut||!be||fr(Se=>{const nt=new Map(Se);return nt.set(ut,be),nt})}}),l.useEffect(()=>()=>{zt.current&&window.clearTimeout(zt.current)},[]),l.useEffect(()=>{if(!c)return;const Be=()=>{const be=!document.hidden;ur(c,be)};ur(c,!document.hidden),document.addEventListener("visibilitychange",Be);let ut=null;return(async()=>{try{const{App:be}=await Cr(async()=>{const{App:Se}=await Promise.resolve().then(()=>xm);return{App:Se}},void 0,import.meta.url);ut=await be.addListener("appStateChange",Se=>{ur(c,Se.isActive)})}catch{}})(),()=>{document.removeEventListener("visibilitychange",Be),ut&&typeof ut.remove=="function"&&ut.remove()}},[c,ur]);const Je=l.useCallback(Be=>{let ut=Vt.current[Be];if(ut&&ut.getAttribute("data-player-id")!==Be&&(ut=null),!ut)try{const nt=window.CSS&&typeof window.CSS.escape=="function"?window.CSS.escape(Be):String(Be).replace(/[^a-zA-Z0-9_-]/g,"_");ut=document.querySelector(`.players.players--avatars [data-player-id="${nt}"]`)}catch{}if(!ut)return null;const be=ut.querySelector(".avatar-ring");let Se=null;if(be)Se=be.getBoundingClientRect();else try{Se=ut.getBoundingClientRect()}catch{}return!Se||Se.width===0&&Se.height===0?null:{x:Se.left+Se.width/2,y:Se.top+Se.height/2}},[]),mt=l.useRef(ne.length),Te=l.useRef(null),Ve=l.useRef(null),tt=l.useRef(null);l.useEffect(()=>{mt.current=ne.length},[rt]),l.useEffect(()=>{tt.current=null},[rt]);const{forUserId:Et,anchorRect:Qt,anchorEl:or,openFor:Ht,close:Lt}=c1(),nr=(Be,ut)=>{!ut||Be===o||Ht(Be,ut)},Mr=()=>Lt(),Br=l.useMemo(()=>{const Be=new Map;for(const ut of r)Be.set(ut.id,ut.name||ut.email||ut.id);for(const ut of he){const be=ut==null?void 0:ut.playerId,Se=ut==null?void 0:ut.bankerId;be&&!Be.has(be)&&Be.set(be,be),Se&&!Be.has(Se)&&Be.set(Se,Se)}return Be},[r,he]),wn=l.useCallback(Be=>Br.get(Be||"")||Be||"Unknown",[Br]),Kt=l.useCallback(Be=>wn(Be),[wn]),Jt=l.useMemo(()=>{const Be=new Map;for(const ut of r)ut.avatarUrl&&Be.set(ut.id,ut.avatarUrl);return Be},[r]),un=l.useCallback(Be=>Jt.get(Be),[Jt]),Tn=l.useCallback(Be=>pR(Be,ne,n,i.bankRoll,St),[ne,n,i.bankRoll,St]);Ape({newSettlements:U,roundSeqNow:rt,myId:o,bankerDice:St,getPlayerName:Kt,getPlayerAvatarUrl:un,getPlayerDice:Tn,getRevealTime:Be=>{var ut,be;return(be=(ut=se==null?void 0:se.current)==null?void 0:ut.get)==null?void 0:be.call(ut,Be)},postRevealDelayMs:0,bankerId:n});const Kr=l.useRef(null);l.useEffect(()=>{!((i==null?void 0:i.gameMode)==="cee-lo"||(i==null?void 0:i.gameMode)==="ceeLo"||!(i!=null&&i.gameMode))||!U.length||!U.filter(be=>be.playerId===o||be.bankerId===o).length||Kr.current!==rt&&(Kr.current=rt,!(e.singlePlayer&&r.filter(Se=>Se.id.startsWith("bot_")&&(Se.balance??0)>0).length===0)&&setTimeout(async()=>{try{await E()}catch{}},2500))},[U,rt,o,i,E,e.singlePlayer,r]);const Er=(i==null?void 0:i.gameMode)==="cee-lo"||(i==null?void 0:i.gameMode)==="ceeLo"||!(i!=null&&i.gameMode);i==null||i.gameMode;const yr=l.useCallback(Be=>{var nt,it;if(!Er)return!0;if(!Be||!(Xt.get(Be)===!0))return!1;const be=(it=(nt=se==null?void 0:se.current)==null?void 0:nt.get)==null?void 0:it.call(nt,Be);return(typeof be=="number"?performance.now()-be:0)>=ha.diceToChipDelayMs},[Er,Xt,se]),{activeBatch:xn,handleAnimItemComplete:gn,resetForRound:dn}=wpe({newSettlements:U,roundSeqNow:rt,getAvatarCenter:Je,getPlayerName:Kt,myId:o,bankerDice:St,bankerId:n,isPartyReady:yr});l.useEffect(()=>{dn()},[rt,dn]);const Gr=l.useRef(null),Sn=l.useRef(null),Gn=l.useMemo(()=>{var ut;if((i==null?void 0:i.gameMode)==="poker"){const be=Number((i==null?void 0:i.pokerUiLockedUntilTs)||0),Se=be>0&&Date.now()<be,nt=7e3;Se&&Gr.current==null&&(Gr.current=Date.now());const it=Gr.current||0,Bt=it>0?Date.now()-it:Number.POSITIVE_INFINITY,ir=Se&&Bt<=nt,er=Array.isArray(i==null?void 0:i.pokerSeats)?i.pokerSeats:[],mr=typeof(i==null?void 0:i.pokerActingSeat)=="number"?i.pokerActingSeat:void 0,hr=typeof mr=="number"&&((ut=er.find(J=>J.seatIndex===mr))==null?void 0:ut.playerId)||null;return ir?Sn.current??hr??null:(Sn.current=hr??null,Gr.current=null,hr??null)}return((i==null?void 0:i.currentRollerId)??s)||null},[i==null?void 0:i.gameMode,i==null?void 0:i.pokerSeats,i==null?void 0:i.pokerActingSeat,i==null?void 0:i.currentRollerId,s]);l.useEffect(()=>{const Be=Ve.current,ut=Gn||void 0;if(!Be||!ut||tt.current===ut)return;const be=Vt.current[ut];if(!be)return;const Se=()=>{try{const nt=Be.getBoundingClientRect(),it=be.getBoundingClientRect(),Bt=it.left-nt.left+Be.scrollLeft,ir=Math.max(0,Math.min(Bt-Be.clientWidth/2+it.width/2,Be.scrollWidth-Be.clientWidth));Be.scrollTo({left:ir,behavior:"smooth"}),tt.current=ut}catch{}};return Te.current&&clearTimeout(Te.current),Te.current=setTimeout(()=>{typeof requestAnimationFrame<"u"?requestAnimationFrame(Se):Se()},100),()=>{Te.current&&(clearTimeout(Te.current),Te.current=null)}},[Gn,et]);const en=e.campaignProgress?e.campaignProgress.isMaxLevel?100:e.campaignProgress.total>0?Math.min(100,e.campaignProgress.current/e.campaignProgress.total*100):0:0,Ce=!!(e.campaignProgress&&e.singlePlayer&&!K);return l.useEffect(()=>{de(!1)},[(Bn=e.campaignProgress)==null?void 0:Bn.level,(xr=e.campaignProgress)==null?void 0:xr.current,(Zn=e.campaignProgress)==null?void 0:Zn.total,($n=e.campaignProgress)==null?void 0:$n.progressLabel]),a.jsxs("div",{className:["card",f].filter(Boolean).join(" "),style:{position:"relative"},children:[d&&a.jsxs("div",{className:"card-header card-header--two-rows",children:[a.jsxs("div",{className:"card-header-row",children:[a.jsxs("div",{className:"header-slot header-slot--left",children:[a.jsx("a",{className:"gold-link white-link",onClick:X(q),"aria-label":"Back",style:{display:"flex"},children:a.jsx(go,{className:"icon",style:{color:"var(--gold, #caa64d)"}})}),(()=>{const Be=R||!P||!1,ut=Be?"Balance (login to Buy 1000 Z Credits)":k?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",be=Be?"Login to Buy 1000 Z Credits":k?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",Se=X(()=>{if(W){$(!0);return}T()});return a.jsx("a",{className:"gold-link balance-display"+(Be?" disabled":"")+(re?" balance--pulse":""),role:"button","aria-label":ut,title:be,"aria-disabled":Be||void 0,onClick:Se,children:a.jsxs("b",{children:[a.jsx("span",{className:"lowercase",children:"z"}),ki.formatMoney(ce,"",0)]})})})(),Q!=="skills"&&a.jsx("a",{role:"button",className:"gold-link white-link header-history-link"+(e.historyHalo?" history-halo":""),onClick:X(()=>{if(W){$(!0);return}const Be=i==null?void 0:i.gameMode;Be==="craps"?(Ie(),lr(!0)):Be==="poker"?e.onOpenHistory&&e.onOpenHistory():yt().then(()=>lr(!0))}),"aria-haspopup":"dialog","aria-controls":"my-bets-modal",children:"History"}),c&&!W&&!e.singlePlayer&&a.jsx(cO,{roomId:c,gameMode:(i==null?void 0:i.gameMode)||"cee-lo"})]}),a.jsx("div",{className:"header-slot header-slot--right",children:a.jsx(oO,{roomId:c,leftSlot:_,singlePlayer:e.singlePlayer})})]}),Ce&&e.campaignProgress&&a.jsxs("div",{className:"campaign-progress","aria-label":"Single-player campaign progress",children:[a.jsx("button",{type:"button",className:"campaign-progress__close","aria-label":"Hide campaign progress",onClick:Be=>{Be.stopPropagation(),de(!0)},children:a.jsx("span",{"aria-hidden":"true",children:"x"})}),a.jsxs("div",{className:"campaign-progress__copy",children:[a.jsxs("strong",{children:["Level ",e.campaignProgress.level]}),a.jsx("span",{children:e.campaignProgress.levelName})]}),a.jsxs("div",{className:"campaign-progress__goal",children:[a.jsx("b",{children:e.campaignProgress.progressLabel}),a.jsx("span",{children:e.campaignProgress.isMaxLevel?"Highest level reached":e.campaignProgress.goalLabel??`Reach Level ${e.campaignProgress.level+1}`})]}),a.jsx("div",{className:"campaign-progress__track","aria-hidden":"true",children:a.jsx("span",{style:{width:`${en}%`}})})]})]}),xn.length>0&&a.jsxs("div",{style:{position:"fixed",inset:0,pointerEvents:"none",zIndex:1e4},children:[xn.map(Be=>a.jsx(aO,{anim:Be,onComplete:()=>gn(Be.id)},Be.id)),!1]}),a.jsx("div",{className:"chip-fly-container",children:!v&&a.jsx(Zs.ul,{className:"players players--avatars",role:"list",ref:Ve,layout:!0,transition:{type:"spring",stiffness:420,damping:38,mass:.6},children:et.map(Be=>{var ht;const ut=(i==null?void 0:i.currentRollerId)??s,be=De[Be];if(!be)return null;const Se=be.id,nt=[];if((i==null?void 0:i.gameMode)==="poker"){const It=i,Ct=Array.isArray(It.pokerSeats)?It.pokerSeats:[],pr=typeof It.pokerDealerSeat=="number"?It.pokerDealerSeat:void 0,Pr=Ct.find(Nr=>Nr.playerId===Se);if(Pr&&typeof pr=="number"){Pr.seatIndex===pr&&nt.push("D");const Nr=Ct.filter(Qr=>!!Qr.playerId).map(Qr=>Qr.seatIndex).sort((Qr,jn)=>Qr-jn),Sr=Nr.length;if(Sr>=2){const Qr=Nr.indexOf(pr);if(Qr!==-1){let jn,ca;Sr===2?(jn=pr,ca=Nr[(Qr+1)%Sr]):(jn=Nr[(Qr+1)%Sr],ca=Nr[(Qr+2)%Sr]),Pr.seatIndex===jn&&nt.push("SB"),typeof ca=="number"&&Pr.seatIndex===ca&&nt.push("BB")}}}}Er&&n&&Se===n&&nt.push("B"),Se===ut&&!Xt.get(Se)&&nt.push("Rolling"),Se===ut&&nt.push("Shooter");let it=!1;if((i==null?void 0:i.gameMode)==="poker"){const It=i,Ct=typeof It.pokerActingSeat=="number"?It.pokerActingSeat:void 0;typeof Ct=="number"&&Array.isArray(It.pokerSeats)&&(it=((ht=It.pokerSeats.find(Pr=>Pr.seatIndex===Ct))==null?void 0:ht.playerId)===Se)}else it=Se===ut;let Bt=!1;if((i==null?void 0:i.gameMode)==="poker"){const Ct=(Array.isArray(i==null?void 0:i.pokerSeats)?i.pokerSeats:[]).find(pr=>pr.playerId===Se);Ct&&String(Ct.status||"").toLowerCase()==="folded"&&(Bt=!0)}const ir=Se===o?I:C[Se],er=L[Se]?ir:void 0,mr=!h&&Xt.get(Se)?pR(Se,ne,n,i.bankRoll,St):null;let hr=!h&&mr&&Array.isArray(mr)&&mr.length===3&&!mr.every(It=>It===0)&&Bf(mr)!=="nothing"?a.jsx(rO,{dice:mr}):null;const $e=(i.spectators??[]).includes(Se);let jt;if(A)jt=A(be);else if($e)jt=null;else if(Er&&!Xt.get(Se)){const It=dr.get(Se);jt=typeof It=="number"&&It>0?a.jsxs("span",{className:"player-bet-pill","aria-label":`Bet z${ki.formatMoney(It,"",0)}`,children:["z",ki.formatMoney(It,"",0)]}):null}else jt=hr;const Yt=(i==null?void 0:i.gameMode)==="poker",Ot=Ee(be),Pe=Number.isFinite(Ot)?Ot:void 0;return a.jsx(upe,{ref:It=>{Vt.current[Se]=It},id:Se,display:be.name??be.email??Se,isCurrentRoller:it,isMe:Se===o,balance:Pe,isSpectating:$e,folded:Bt,tags:nt,stream:er,isMuted:Se===o,diceResult:jt,onOpenMenu:(It,Ct)=>nr(It,Ct),showMenu:Et===Se,menuProps:Et===Se?{targetId:Se,anchorRect:Qt,anchorEl:or,onClose:Mr,onOpenDM:u,onOpenSendMoney:p,meId:o}:null,forceHideVideo:!L[Se],avatarUrl:be.avatarUrl,showActingTimerRing:Yt,presenceStatus:br.get(Se)},Se)})})}),Mt&&a.jsx(oD,{onClose:()=>lr(!1),items:Array.isArray(dt)&&dt.length>0?dt:Fe,meId:o,nameOf:wn,crapsRollHistory:g,gameMode:i==null?void 0:i.gameMode,crapsLedgerItems:(Ue||[]).slice().sort((Be,ut)=>Number(ut.ts)-Number(Be.ts))}),a.jsx(sO,{open:G,onClose:()=>$(!1),message:"This feature is for logged in users."})]})}const Cpe={pass:"Pass Line",dontPass:"Don't Pass",field:"Field",big6:"Big 6",big8:"Big 8",come:"Come",dontCome:"Don't Come",atsSmall:"ATS Small",atsTall:"ATS Tall",atsAll:"ATS All"};function Rpe(e){return e.startsWith("place")?`Place ${e.replace("place","")}`:Cpe[e]??e}function Tpe(e,t){return{net:e.reduce((n,s)=>s.outcome==="WIN"?n+s.payout:s.outcome==="LOSE"?n-s.amount:n,0),rollTotal:t,settlements:e}}function jpe(e){return e.outcome==="WIN"?`+z${e.payout}`:e.outcome==="LOSE"?`-z${e.amount}`:"Returned"}function Ipe({summary:e}){const t=e.net>0?"win":e.net<0?"lose":"push",r=e.net>0?"You Won":e.net<0?"You Lost":"No Change";return a.jsxs("section",{className:`craps-roll-result craps-roll-result--${t}`,"aria-live":"polite","aria-label":"Your roll result",children:[a.jsxs("div",{className:"craps-roll-result__header",children:[a.jsxs("div",{children:[a.jsx("span",{className:"craps-roll-result__eyebrow",children:typeof e.rollTotal=="number"?`Roll ${e.rollTotal}`:"Roll Result"}),a.jsx("strong",{children:r})]}),a.jsxs("b",{className:"craps-roll-result__net",children:[e.net>0?"+":e.net<0?"-":"","z",Math.abs(e.net)]})]}),a.jsx("div",{className:"craps-roll-result__rows",children:e.settlements.map((n,s)=>a.jsxs("div",{className:"craps-roll-result__row",children:[a.jsx("span",{children:Rpe(n.betType)}),a.jsx("b",{className:`craps-roll-result__amount craps-roll-result__amount--${n.outcome.toLowerCase()}`,children:jpe(n)})]},`${n.betType}-${n.outcome}-${s}`))})]})}function Npe(e){const{gameState:t,roomId:r,meId:n}=e,{show:s,rollNow:o}=As(),{onHandEnd:i}=bu(),c=l.useRef(null),u=l.useRef(new Set),p=l.useRef(null),d=l.useRef(null),f=l.useRef(null),m=l.useRef(null),h=l.useRef(null),b=l.useRef(null),[g,y]=l.useState(null),{reveal:x}=Ti(),{recentSettlements:v,lastSettlementRoll:A,pointSetEvent:_,pointMadeEvent:w}=V5({roomId:r||null,myPlayerId:n}),j=l.useCallback((T,R,P,k,E)=>{if(c.current===E||u.current.has(E))return;(()=>{c.current=E,u.current.add(E),s({kind:T==="roll"?"roll":T,title:R,subtitle:P,duration:k})})()},[s]);return l.useEffect(()=>{if(!_||!r||_.roomId!==r)return;const T=_._key;c.current===T||u.current.has(T)||(p.current={key:T,point:_.point},d.current&&clearTimeout(d.current),x&&(d.current=setTimeout(()=>{const R=p.current;if(R){if(u.current.has(R.key)){p.current=null;return}c.current=R.key,u.current.add(R.key);try{jS({volume:.15})}catch{}typeof o=="function"?o("Point Established",`${R.point} is the point`):s({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),p.current=null}},ha.revealFlashPostDelayMs)))},[_,r,o,s,x]),l.useEffect(()=>{!x||!p.current||(d.current&&clearTimeout(d.current),d.current=setTimeout(()=>{const R=p.current;if(R){if(u.current.has(R.key)){p.current=null;return}c.current=R.key,u.current.add(R.key);try{jS({volume:.15})}catch{}typeof o=="function"?o("Point Established",`${R.point} is the point`):s({kind:"roll",title:"Point Established",subtitle:`${R.point} is the point`,duration:1e3}),p.current=null}},ha.revealFlashPostDelayMs))},[x,o,s]),l.useEffect(()=>{w&&(!r||w.roomId!==r||(f.current={key:w._key,point:w.point},m.current&&clearTimeout(m.current),x&&(m.current=setTimeout(()=>{const T=f.current;if(T){if(u.current.has(T.key)){f.current=null;return}j("win","Point Made!",`${T.point} hit`,1300,T.key);try{MS({sfxVolume:.15,voiceVolume:.55})}catch{}try{window.dispatchEvent(new CustomEvent("craps:point_made",{detail:{point:T.point}}))}catch{}f.current=null}},ha.revealFlashPostDelayMs))))},[w,r,j,x]),l.useEffect(()=>{!x||!f.current||(m.current&&clearTimeout(m.current),m.current=setTimeout(()=>{const R=f.current;if(R){if(u.current.has(R.key)){f.current=null;return}j("win","Point Made!",`${R.point} hit`,1300,R.key);try{MS({sfxVolume:.15,voiceVolume:.55})}catch{}try{window.dispatchEvent(new CustomEvent("craps:point_made",{detail:{point:R.point}}))}catch{}f.current=null}},ha.revealFlashPostDelayMs))},[x,j]),l.useEffect(()=>()=>{d.current&&clearTimeout(d.current),m.current&&clearTimeout(m.current),b.current&&clearTimeout(b.current)},[]),l.useEffect(()=>{var oe,ce,_e,re;if(!v.length)return;const T=(()=>{var pe,ee;try{return typeof window<"u"&&(window.__E2E===!0||((ee=(pe=window.location)==null?void 0:pe.search)==null?void 0:ee.includes("e2e=1")))}catch{return!1}})(),R=n||(T?(t==null?void 0:t.currentRollerId)||"e2e-user":void 0),P=pe=>{const ee=pe.betType;return ee==="pass"||ee==="dontPass"||ee.startsWith("place")||ee==="field"||ee==="big6"||ee==="big8"||ee==="come"||ee==="dontCome"||ee==="atsSmall"||ee==="atsTall"||ee==="atsAll"},k=v.filter(pe=>(R?pe.playerId===R:!0)&&P(pe));if(!k.length)return;const E=(A==null?void 0:A._seq)||0,M=typeof(A==null?void 0:A.total)=="number"?A.total:Array.isArray(A==null?void 0:A.dice)?A.dice[0]+A.dice[1]:"",C=k.map(pe=>`${pe.betType}:${pe.outcome}:${pe.amount}:${pe.payout}`).sort().join("|"),I=`${E}:${M}:${C}`;if(h.current===I)return;h.current=I;const L=k.filter(pe=>pe.betType==="pass"||pe.betType==="dontPass"),N=k.filter(pe=>pe.betType.startsWith("place")&&pe.outcome==="WIN"),S=k.filter(pe=>pe.betType==="field"),F=k.filter(pe=>pe.betType==="big6"||pe.betType==="big8"),D=k.filter(pe=>pe.betType==="come"||pe.betType==="dontCome"),H=k.filter(pe=>pe.betType==="atsSmall"||pe.betType==="atsTall"||pe.betType==="atsAll"),W=L.some(pe=>pe.outcome==="WIN"),G=N.length>0,$=S.some(pe=>pe.outcome==="WIN"),K=F.some(pe=>pe.outcome==="WIN"),de=D.some(pe=>pe.outcome==="WIN"),ie=H.some(pe=>pe.outcome==="WIN"),we=H.some(pe=>pe.outcome==="LOSE"),he=L.some(pe=>pe.outcome==="LOSE"),Ae=S.some(pe=>pe.outcome==="LOSE"),Fe=F.some(pe=>pe.outcome==="LOSE"),U=D.some(pe=>pe.outcome==="LOSE"),V=D.some(pe=>pe.outcome==="PUSH"),z=!W&&!he&&L.some(pe=>pe.outcome==="PUSH");let O="",q="";y(Tpe(k,typeof M=="number"?M:void 0)),b.current&&clearTimeout(b.current),b.current=setTimeout(()=>y(null),4500);const X=typeof M=="number"?M:Number(M),Z=A==null?void 0:A.currentRollerId,Q=N.some(pe=>{const ee=Number(String(pe.betType).replace(/^place/,""));return Number.isFinite(ee)&&ee===X});if(ie){const pe=H.filter(Le=>Le.outcome==="WIN"),ee=pe.reduce((Le,Ge)=>Le+Ge.payout,0),xe=pe.map(Le=>Le.betType==="atsAll"?"ALL":Le.betType==="atsSmall"?"SMALL":Le.betType==="atsTall"?"TALL":Le.betType);O=pe.length>1?`ATS ${xe.join(" & ")}!`:`ATS ${xe[0]}!`,q=`+${ee}`,s({kind:"win",title:O,subtitle:q,duration:2e3});try{window.dispatchEvent(new CustomEvent("craps:ats_win",{detail:{payout:ee,bets:xe}}))}catch{}return}if(W){if(G&&Q&&n&&Z===n){const ee=N.reduce((xe,Le)=>xe+Le.payout,0);O=N.length>1?"Place Wins":"Place Win",q=`+${ee}`,s({kind:"win",title:O,subtitle:q,duration:1e3});return}const pe=L.filter(ee=>ee.outcome==="WIN").reduce((ee,xe)=>ee+(xe.payout+xe.amount),0);O="Line Win",q=`+${pe}`,s({kind:"win",title:O,subtitle:q,duration:1100});return}if(G){const pe=N.reduce((ee,xe)=>ee+xe.payout,0);O=N.length>1?"Place Wins":"Place Win",q=`+${pe}`,s({kind:"win",title:O,subtitle:q,duration:1e3});try{window.dispatchEvent(new CustomEvent("craps:place_win",{detail:{payout:pe,count:N.length}}))}catch{}return}if($){const pe=S.filter(ee=>ee.outcome==="WIN").reduce((ee,xe)=>ee+xe.payout,0);O="Field Win",q=`+${pe}`,s({kind:"win",title:O,subtitle:q,duration:1e3});return}if(K){const pe=F.filter(Le=>Le.outcome==="WIN"),ee=pe.reduce((Le,Ge)=>Le+Ge.payout,0);O=pe.length>1?"Big Wins":((oe=pe[0])==null?void 0:oe.betType)==="big6"?"Big 6 Win":"Big 8 Win",q=`+${ee}`,s({kind:"win",title:O,subtitle:q,duration:1e3});return}if(de){const pe=D.filter(Le=>Le.outcome==="WIN"),ee=pe.reduce((Le,Ge)=>Le+Ge.payout,0);O=pe.length>1?"Come Wins":((ce=pe[0])==null?void 0:ce.betType)==="dontCome"?"DC Win":"Come Win",q=`+${ee}`,s({kind:"win",title:O,subtitle:q,duration:1e3});return}if(he){const pe=L.filter(ee=>ee.outcome==="LOSE").reduce((ee,xe)=>ee+xe.amount,0);O="Line Lose",q=`-${pe}`,s({kind:"lose",title:O,subtitle:q,duration:1100});return}if(Ae){const pe=S.filter(ee=>ee.outcome==="LOSE").reduce((ee,xe)=>ee+xe.amount,0);O="Field Lose",q=`-${pe}`,s({kind:"lose",title:O,subtitle:q,duration:1e3});return}if(Fe){const pe=F.filter(Le=>Le.outcome==="LOSE"),ee=pe.reduce((Le,Ge)=>Le+Ge.amount,0);O=pe.length>1?"Big Bets Lose":((_e=pe[0])==null?void 0:_e.betType)==="big6"?"Big 6 Lose":"Big 8 Lose",q=`-${ee}`,s({kind:"lose",title:O,subtitle:q,duration:1e3});return}if(U){const pe=D.filter(Le=>Le.outcome==="LOSE"),ee=pe.reduce((Le,Ge)=>Le+Ge.amount,0);O=pe.length>1?"Come Bets Lose":((re=pe[0])==null?void 0:re.betType)==="dontCome"?"DC Lose":"Come Lose",q=`-${ee}`,s({kind:"lose",title:O,subtitle:q,duration:1e3});return}if(V){O="DC Push",q="No action",s({kind:"push",title:O,subtitle:q,duration:1e3});return}if(z){O="Line Push",q="No action",s({kind:"push",title:O,subtitle:q,duration:1e3});return}if(we){const ee=H.filter(xe=>xe.outcome==="LOSE").reduce((xe,Le)=>xe+Le.amount,0);O="ATS Busted",q=`-${ee}`,s({kind:"lose",title:O,subtitle:q,duration:1200});return}try{i()}catch{}},[v,n,A,s,i]),a.jsxs(a.Fragment,{children:[a.jsx(Lb,{...e,hideDiceResults:!0,className:"craps-player-panel"}),g&&a.jsx(Ipe,{summary:g})]})}function Mpe(e){return a.jsx(Lb,{...e,headerCommsLeftSlot:void 0})}function Lpe({deadlineTs:e,isActive:t,showTurnLabel:r=!0}){const[n,s]=l.useState(30),o=l.useRef(null);l.useEffect(()=>{if(!t||!e){s(30),o.current&&(cancelAnimationFrame(o.current),o.current=null);return}const d=()=>{const f=Date.now(),m=Math.max(0,Math.ceil((e-f)/1e3));s(m),m>0?o.current=requestAnimationFrame(d):o.current=null};return d(),()=>{o.current&&(cancelAnimationFrame(o.current),o.current=null)}},[e,t]);const i=t&&n!==30,c=n<=10,u=n<=5,p=n/30*100;return a.jsxs("div",{className:["poker-turn-timer",i?"":"poker-turn-timer--hidden",c?"poker-turn-timer--urgent":"",u?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!i,children:[a.jsxs("div",{className:"poker-turn-timer__ring",children:[a.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[a.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),a.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${p} 100`})]}),a.jsx("div",{className:"poker-turn-timer__number",children:n})]}),r&&a.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Your Turn"})]})}function h_({state:e,startingShields:t,maxTokens:r}){if(e.eliminated)return a.jsxs("div",{className:"elim-badge elim-badge--eliminated","aria-label":`Eliminated — ${Dpe(e.place??0)} place`,children:[a.jsx("span",{className:"elim-badge__out",children:"OUT"}),typeof e.place=="number"&&e.place>0&&a.jsxs("span",{className:"elim-badge__place",children:["#",e.place]})]});const n=[];for(let o=0;o<t;o++)n.push(a.jsx("span",{className:`elim-badge__shield ${o<e.shields?"elim-badge__shield--active":"elim-badge__shield--lost"}`,"aria-hidden":!0,children:"🛡"},`s${o}`));const s=[];for(let o=0;o<r;o++)s.push(a.jsx("span",{className:`elim-badge__token ${o<e.penaltyTokens?"elim-badge__token--active":""}`,"aria-hidden":!0},`t${o}`));return a.jsxs("div",{className:"elim-badge","aria-label":`Shields: ${e.shields}/${t}, Tokens: ${e.penaltyTokens}/${r}`,children:[a.jsx("span",{className:"elim-badge__shields",children:n}),e.penaltyTokens>0&&a.jsx("span",{className:"elim-badge__tokens",children:s}),e.winStreak>=2&&a.jsxs("span",{className:"elim-badge__streak","aria-label":`${e.winStreak} win streak`,children:["🔥",e.winStreak]})]})}function Dpe(e){const t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])}function f1(e){const t=l.useMemo(()=>e.headerExtras,[e.headerExtras]),r=l.useMemo(()=>{var d;const u=Array.isArray((d=e.gameState)==null?void 0:d.pokerSeats)?e.gameState.pokerSeats:[],p=new Map;for(const f of u){const m=(f.totalCommitted||0)+(f.committed||0);p.set(f.playerId,m)}return p},[e.gameState]),n=l.useMemo(()=>{var d;const u=Array.isArray((d=e.gameState)==null?void 0:d.pokerSeats)?e.gameState.pokerSeats:[],p=new Set;for(const f of u)f!=null&&f.playerId&&String(f.status||"").toLowerCase()==="folded"&&p.add(f.playerId);return p},[e.gameState]),s=l.useMemo(()=>{const u=new Map,p=Array.isArray(e.revealedHands)?e.revealedHands:[];for(const d of p)d!=null&&d.playerId&&Array.isArray(d.hole)&&d.hole.length===2&&u.set(String(d.playerId),d.hole);return u},[e.revealedHands]),o=l.useMemo(()=>u=>{var h,b,g,y,x,v,A,_;const p=(h=e.elimConfig)!=null&&h.enabled?(b=e.elimStates)==null?void 0:b[u.id]:void 0,d=s.get(u.id);if(d&&d.length===2){const w=({value:j})=>{const T=String(j||"").toUpperCase(),R=T.slice(0,-1),P=T.slice(-1),k=R==="T"?"10":R,E=P==="H"||P==="D",M=P==="H"?"♥":P==="D"?"♦":P==="C"?"♣":"♠";return a.jsxs("div",{className:["poker-card","poker-card--mini",E?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":`${k} of ${P}`,children:[a.jsx("span",{className:"poker-card__rank",style:{fontSize:14},children:k}),a.jsx("span",{className:"poker-card__suit",style:{fontSize:11},children:M})]})};return a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"poker-avatar__faces","aria-label":"hole-cards",children:[a.jsx(w,{value:d[0]}),a.jsx(w,{value:d[1]})]}),p&&a.jsx(h_,{state:p,startingShields:((g=e.elimConfig)==null?void 0:g.startingShields)??3,maxTokens:((y=e.elimConfig)==null?void 0:y.maxTokens)??3})]})}if(n.has(u.id))return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"poker-avatar__bet","aria-label":"Folded",children:"Folded"}),p&&a.jsx(h_,{state:p,startingShields:((x=e.elimConfig)==null?void 0:x.startingShields)??3,maxTokens:((v=e.elimConfig)==null?void 0:v.maxTokens)??3})]});const m=`z${(r.get(u.id)||0).toLocaleString("en-US")}`;return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"poker-avatar__bet","aria-label":`Total bet ${m}`,children:m}),p&&a.jsx(h_,{state:p,startingShields:((A=e.elimConfig)==null?void 0:A.startingShields)??3,maxTokens:((_=e.elimConfig)==null?void 0:_.maxTokens)??3})]})},[s,r,n,e.elimConfig,e.elimStates]);if(e.lite)return a.jsx(eO,{className:"",players:e.players,meId:e.meId,onOpenDM:e.onOpenDM,onOpenSendMoney:e.onOpenSendMoney,renderActionsOverride:u=>o({id:u.id})});const i=l.useMemo(()=>{var f;const u=Array.isArray((f=e.gameState)==null?void 0:f.pokerSeats)?e.gameState.pokerSeats:[],p=new Map,d=new Set;for(const m of u){if(!m||!m.playerId)continue;const h=typeof m.stack=="number"?m.stack:void 0;typeof h=="number"&&p.set(String(m.playerId),h),d.add(String(m.playerId))}return e.players.map(m=>{const h=p.get(String(m.id));return typeof h=="number"?{...m,balance:h}:m})},[e.players]),c=l.useMemo(()=>a.jsx(Lpe,{deadlineTs:e.turnDeadlineTs,isActive:!!e.isBettingStreet&&!!e.turnDeadlineTs,showTurnLabel:!!e.isHeroTurn}),[e.turnDeadlineTs,e.isBettingStreet,e.isHeroTurn]);return a.jsx(Lb,{...e,className:"player-panel",players:i,hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerExtras:t,headerCommsLeftSlot:c,renderFacesOverride:u=>o(u)})}function fR(e){var r;const t=((r=e.gameState)==null?void 0:r.gameMode)||"cee-lo";return t==="craps"?a.jsx(Npe,{...e}):t==="poker"?a.jsx(f1,{...e}):a.jsx(Mpe,{...e})}function Ope(){const{remoteStreams:e}=Yo(),t=l.useRef({}),[r,n]=l.useState(!1),s=async i=>{const c=i.srcObject;if(!c||!c.getAudioTracks().length)return!1;try{return await i.play(),!0}catch{return!1}};l.useEffect(()=>{let i=!1;for(const[u,p]of Object.entries(e)){const d=t.current[u];d&&d.srcObject!==p&&(d.srcObject=p)}(async()=>{for(const u of Object.values(t.current)){if(!u)continue;await s(u)||(i=!0)}n(i)})();for(const u of Object.keys(t.current))if(!e[u]){const p=t.current[u];if(p){try{p.pause()}catch{}p.srcObject=null}delete t.current[u]}},[e]);const o=async()=>{for(const i of Object.values(t.current))i&&await s(i);n(!1)};return a.jsxs(a.Fragment,{children:[Object.keys(e).map(i=>a.jsx("audio",{ref:c=>{t.current[i]=c},autoPlay:!0,playsInline:!0,muted:!1,style:{display:"none"},onError:c=>{var u;console.warn("remote audio error",i,(u=c==null?void 0:c.currentTarget)==null?void 0:u.error)}},i)),r&&a.jsx("button",{onClick:o,style:{position:"fixed",bottom:16,right:16,zIndex:9999,padding:"8px 12px",borderRadius:8,fontWeight:700,color:"#fff"},children:"Tap to enable audio"})]})}const zpe="_overlay_d52xd_3",Bpe="_overlayClosed_d52xd_15",Fpe="_drawer_d52xd_22",Upe="_drawerClosed_d52xd_59",qpe="_header_d52xd_72",Vpe="_headerTitle_d52xd_82",Hpe="_closeBtn_d52xd_91",Wpe="_body_d52xd_108",Gpe="_threadList_d52xd_115",Xpe="_noPeers_d52xd_132",Ype="_threadBtn_d52xd_140",Zpe="_threadBtnActive_d52xd_163",Kpe="_avatar_d52xd_169",Qpe="_threadLabel_d52xd_189",Jpe="_threadName_d52xd_195",$pe="_threadPreview_d52xd_204",efe="_unreadBadge_d52xd_212",tfe="_activeThread_d52xd_229",rfe="_scroller_d52xd_237",nfe="_scrollerEmpty_d52xd_251",afe="_message_d52xd_258",sfe="_messageMine_d52xd_275",ofe="_messageContent_d52xd_284",ife="_messageTime_d52xd_297",lfe="_pending_d52xd_308",cfe="_error_d52xd_316",ufe="_composer_d52xd_324",dfe="_composerInput_d52xd_336",pfe="_composerSend_d52xd_363",ffe="_composerSendDisabled_d52xd_389",Nn={overlay:zpe,overlayClosed:Bpe,drawer:Fpe,drawerClosed:Upe,header:qpe,headerTitle:Vpe,closeBtn:Hpe,body:Wpe,threadList:Gpe,noPeers:Xpe,threadBtn:Ype,threadBtnActive:Zpe,avatar:Kpe,threadLabel:Qpe,threadName:Jpe,threadPreview:$pe,unreadBadge:efe,activeThread:tfe,scroller:rfe,scrollerEmpty:nfe,message:afe,messageMine:sfe,messageContent:ofe,messageTime:ife,pending:lfe,error:cfe,composer:ufe,composerInput:dfe,composerSend:pfe,composerSendDisabled:ffe};function mfe(e){var o,i;if(!e)return"?";const r=e.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(((o=r[0])==null?void 0:o[0])??"").toUpperCase(),s=(((i=r[1])==null?void 0:i[0])??"").toUpperCase();return n+s||n||"?"}function hfe({open:e,onClose:t,peers:r,initialPeerId:n}){const{user:s}=Zr(),o=(s==null?void 0:s.id)??(s==null?void 0:s.email)??"",{getDmSummary:i,getDmMessages:c,sendDmMessage:u,markDmRead:p,setActiveDm:d,threads:f,loadDmHistory:m}=Dm(),[h,b]=l.useState(n??null),[g,y]=l.useState(""),x=l.useRef(!1),v=l.useRef(null);l.useEffect(()=>{if(!e){x.current=!1;return}if(x.current)return;x.current=!0;let C=null;if(n)C=n;else{const I=i(),L=I==null?void 0:I.find(N=>N.unread>0);L?C=L.peerUserId:h?C=h:r.length&&(C=r[0].id)}C&&C!==h&&(b(C),d(C),m(C))},[e,n,r,h,i,d]),l.useEffect(()=>{!e||!h||v.current!==h&&(v.current=h,p(h))},[e,h,p]);const A=l.useRef(null);l.useEffect(()=>(e?(A.current=document.body.style.overflow,document.body.style.overflow="hidden"):A.current!==null&&(document.body.style.overflow=A.current,A.current=null),()=>{A.current!==null&&(document.body.style.overflow=A.current,A.current=null)}),[e]),l.useEffect(()=>{e&&requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[e]),l.useEffect(()=>{const C=window.visualViewport;if(!C)return;const I=()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight+1e3)};return C.addEventListener("resize",I),()=>{C.removeEventListener("resize",I)}},[]);const _=l.useMemo(()=>h?(f==null?void 0:f[ao(h,o)])??[]:[],[h,e,f]),w=l.useMemo(()=>i()??[],[e,_.length]),j=l.useMemo(()=>{const C=new Map;return w.forEach(I=>C.set(I.peerUserId,I)),C},[w]),T=l.useRef(null);l.useEffect(()=>{T.current&&(T.current.scrollTop=T.current.scrollHeight+1e3)},[_.length,h,e]);const R=C=>{b(C),d(C),p(C)},P=()=>{if(!h)return;const C=g.trim();if(!C)return;u(h,C)&&y("")},k=C=>{C.key==="Enter"&&!C.shiftKey&&(C.preventDefault(),P())},E=C=>{const I=r.find(L=>L.id===C);return(I==null?void 0:I.name)||(I==null?void 0:I.email)||C},M=C=>{const I=j.get(C);return I!=null&&I.last?((I.last.senderId===o?"You: ":"")+I.last.text).trim():""};return a.jsxs(a.Fragment,{children:[a.jsx("div",{"aria-hidden":!e,onClick:t,className:`${Nn.overlay} ${e?"":Nn.overlayClosed}`}),a.jsxs("aside",{"aria-hidden":!e,role:"dialog","aria-label":"Direct Messages",className:`${Nn.drawer} ${e?"":Nn.drawerClosed}`,onClick:C=>C.stopPropagation(),children:[a.jsxs("div",{className:Nn.header,children:[a.jsx("strong",{className:Nn.headerTitle,children:"Messages"}),a.jsx("button",{onClick:t,className:Nn.closeBtn,"aria-label":"Close messages",children:"✕"})]}),a.jsxs("div",{className:Nn.body,children:[a.jsxs("div",{className:Nn.threadList,children:[r.length===0&&a.jsx("div",{className:Nn.noPeers,children:"No other players yet."}),r.map(C=>{var F;const I=C.id===h,L=mfe(C.name||C.email||C.id),N=((F=j.get(C.id))==null?void 0:F.unread)??0,S=M(C.id);return a.jsxs("button",{onClick:()=>R(C.id),className:`${Nn.threadBtn} ${I?Nn.threadBtnActive:""}`,title:E(C.id),children:[a.jsx("div",{className:Nn.avatar,"aria-hidden":!0,children:L}),a.jsxs("div",{className:Nn.threadLabel,children:[a.jsx("div",{className:Nn.threadName,children:E(C.id)}),a.jsx("div",{className:Nn.threadPreview,children:S})]}),N>0&&a.jsx("span",{"aria-label":`${N} unread`,className:Nn.unreadBadge,children:N>99?"99+":N})]},C.id)})]}),a.jsxs("div",{className:Nn.activeThread,children:[a.jsxs("div",{ref:T,className:Nn.scroller,children:[!h&&a.jsx("div",{className:Nn.scrollerEmpty,children:"Select a conversation to begin."}),h&&_.map(C=>{const I=C.senderId===o,L=new Date(C.ts),N=L.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return a.jsxs("div",{className:`${Nn.message} ${I?Nn.messageMine:""}`,title:L.toLocaleString(),children:[a.jsx("div",{className:Nn.messageContent,children:C.text}),a.jsx("div",{className:Nn.messageTime,children:N}),C.pending&&a.jsx("div",{className:Nn.pending,children:"sending…"}),C.error&&a.jsx("div",{className:Nn.error,children:C.error})]},C.id)})]}),a.jsxs("div",{className:Nn.composer,children:[a.jsx("input",{value:g,onChange:C=>y(C.target.value),onKeyDown:k,placeholder:h?`Message ${E(h)}…`:"Pick a conversation…",disabled:!h,className:Nn.composerInput}),a.jsx("button",{onClick:P,disabled:!h||g.trim()==="",className:`${Nn.composerSend} ${!h||g.trim()===""?Nn.composerSendDisabled:""}`,children:"Send"})]})]})]})]})]})}const gfe=""+new URL("fairness-BcL04fcA.webp",import.meta.url).href;function uO({state:e}){const r={verified:{label:"Verified",cls:"fairness--ok",icon:"✓"},"bad-commit":{label:"Bad commit",cls:"fairness--bad",icon:"!"},mismatch:{label:"Mismatch",cls:"fairness--bad",icon:"!"},unverifiable:{label:"Unverified",cls:"fairness--dim",icon:"x"}}[e];return a.jsx("span",{className:`fairness ${r.cls}`,title:r.label,"aria-label":r.label,children:e==="verified"?a.jsx("img",{src:gfe,alt:"Fairness verified",className:"fairness-img"}):r.icon})}function yfe({roomId:e,lastRollerId:t,roundSeq:r,className:n,autoHideMs:s}){const{verifyFor:o,lastRoundWithReveal:i,proofs:c,reveals:u}=H5(e),[p,d]=l.useState("unverifiable"),f=l.useRef(0),[m,h]=l.useState({}),[b,g]=l.useState(!0),y=l.useMemo(()=>typeof r!="number"||!c?[]:Object.keys(c).filter(w=>w.startsWith(`${r}:`)),[c,r]),x=l.useMemo(()=>t||y.length&&y[y.length-1].split(":")[1]||null,[t,y]);l.useEffect(()=>{let w=!1;if(!o||!e||typeof r!="number"||!x)return d("unverifiable"),()=>{w=!0};const j=++f.current;return(async()=>{try{const T=await o(x,r);!w&&j===f.current&&d(T)}catch{!w&&j===f.current&&d("unverifiable")}})(),()=>{w=!0}},[o,e,x,r,y.length]),l.useEffect(()=>{if(!o||typeof r!="number")return;let w=!1;return y.forEach(j=>{const T=j.split(":")[1];T&&(async()=>{try{const R=await o(T,r);w||h(P=>P[j]===R?P:{...P,[j]:R})}catch{w||h(R=>R[j]==="unverifiable"?R:{...R,[j]:"unverifiable"})}})()}),()=>{w=!0}},[o,y,r,i]);const v=typeof r=="number"?!!(u!=null&&u[r]):!1;if(l.useEffect(()=>{if(!s||s<=0||!v)return;g(!0);const w=window.setTimeout(()=>g(!1),s);return()=>window.clearTimeout(w)},[s,r,v]),!v||!b)return null;const A=y.filter(w=>m[w]==="verified").length,_=(()=>{if(y.length>1){if(A===y.length)return"All Verified";if(A>0)return`${A}/${y.length} Verified`}switch(p){case"verified":return"Provably Fair";case"bad-commit":return"Commit Mismatch";case"mismatch":return"Mismatch";default:return y.length?"Unverified":"Awaiting Reveal"}})();return a.jsxs("div",{className:["fairness-status-bar",n].filter(Boolean).join(" "),style:{display:"flex",alignItems:"center",gap:12,padding:"6px 12px",borderRadius:8,background:"rgba(0,0,0,.55)",backdropFilter:"blur(8px)",fontSize:12,lineHeight:1,color:"#fff",pointerEvents:"auto",boxShadow:"0 2px 6px rgba(0,0,0,.4)"},children:[a.jsx(uO,{state:p}),a.jsxs("div",{style:{display:"flex",flexDirection:"column"},children:[a.jsx("span",{style:{fontWeight:600},children:_}),typeof r=="number"&&a.jsxs("span",{style:{opacity:.75},children:["Round ",r]})]})]})}function dO({open:e,onClose:t,title:r,tagline:n,steps:s,primaryLabel:o,persistKey:i="seenOnboardingV1",secondaryLabel:c="Log In",onSecondary:u,targetSelector:p=".home-mode-toggle-row",coachText:d="Pick a game mode"}){const f=Hr(),{user:m,loading:h}=Zr(),b=l.useMemo(()=>{if(h)return!1;const _=(m==null?void 0:m.email)||"";return!_||/@guest\.local$/i.test(_)},[m==null?void 0:m.email,h]),g=l.useCallback(()=>{try{i&&Va.set({key:i,value:"1"})}catch{}t()},[t,i]);l.useEffect(()=>{if(!e)return;function _(w){w.key==="Escape"&&g()}return window.addEventListener("keydown",_),()=>window.removeEventListener("keydown",_)},[e,g]);const[y,x]=l.useState(null),v=l.useCallback(()=>{try{if(!e){x(null);return}const _=p?document.querySelector(p):null;if(!_){x(null);return}const w=_.getBoundingClientRect();x({top:w.top,left:w.left,width:w.width,height:w.height})}catch{x(null)}},[e,p]);if(l.useLayoutEffect(()=>{v()},[v]),l.useEffect(()=>{if(!e)return;const _=()=>v(),w=()=>v();window.addEventListener("resize",_),window.addEventListener("scroll",w,!0);const j=setInterval(v,400);return()=>{window.removeEventListener("resize",_),window.removeEventListener("scroll",w,!0),clearInterval(j)}},[e,v]),l.useEffect(()=>{if(e)try{(()=>{var w;try{return!!(window.__E2E===!0||typeof((w=window.location)==null?void 0:w.search)=="string"&&window.location.search.includes("e2e=1")||typeof window.sessionStorage<"u"&&window.sessionStorage.getItem("e2e")==="1")}catch{return!1}})()&&(i&&Va.set({key:i,value:"1"}),setTimeout(()=>{try{t()}catch{}},0))}catch{}},[e,t,i]),!e)return null;const A=Array.isArray(s)&&s.length?s:["Create or join a room","Place bets, roll dice, or deal cards","Win chips and share the fun"];return a.jsxs("div",{className:"onb-modal",role:"dialog","aria-modal":"true","aria-label":"Welcome to Dice Lounge",children:[a.jsx("div",{className:"onb-backdrop",onClick:g}),a.jsxs("div",{className:"onb-card",onClick:_=>_.stopPropagation(),children:[a.jsx("button",{type:"button",className:"onb-close",onClick:g,"aria-label":"Close",children:"✕"}),a.jsxs("header",{className:"onb-header",children:[a.jsx("h2",{className:"onb-title",children:r||"Dice Lounge"}),a.jsx("p",{className:"onb-tagline",children:n||"Roll, chat, and play with friends."})]}),a.jsx("ol",{className:"onb-steps","aria-label":"Getting started steps",children:A.map((_,w)=>a.jsx("li",{className:"onb-step",children:_},w))}),a.jsx("div",{className:"onb-cta-row",children:c&&b&&a.jsx("button",{type:"button",className:"onb-btn onb-btn--ghost felt-btn",onClick:u||(()=>f("/lobby")),children:c})})]}),y&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"onb-highlight","aria-hidden":!0,style:{top:Math.max(0,y.top-8),left:Math.max(0,y.left-8),width:y.width+16,height:y.height+16}}),a.jsx("div",{className:"onb-coachmark",role:"note","aria-label":d,style:{top:Math.max(0,y.top-14),left:y.left+y.width/2},children:a.jsx("span",{className:"onb-coachmark__label",children:d})})]})]})}const mR=["Maya Banks","Jules Carter","Nico Reed","Tessa Cole","Rico Morgan","Mona Blake"];function Db(){const e=l.useRef(null),t=l.useRef(!1),r=l.useRef(!1),n=l.useCallback(async()=>{if(r.current=!0,!(t.current||e.current)){t.current=!0;try{"wakeLock"in navigator&&(e.current=await navigator.wakeLock.request("screen"),e.current.addEventListener("release",()=>{e.current=null}))}catch(o){console.debug("[wakeLock] Failed to acquire:",o)}finally{t.current=!1}}},[]),s=l.useCallback(async()=>{if(r.current=!1,!!e.current)try{await e.current.release(),e.current=null}catch(o){console.debug("[wakeLock] Failed to release:",o)}},[]);return l.useEffect(()=>{const o=()=>{document.visibilityState==="visible"&&r.current&&e.current===null&&!t.current&&n()};return document.addEventListener("visibilitychange",o),()=>{document.removeEventListener("visibilitychange",o),s()}},[n,s]),{acquire:n,release:s}}const bfe={"cee-lo":[{id:"ceelo_rounds",label:"Finish 5 Cee Lo hands",target:5,event:"ceelo:result"},{id:"ceelo_wins",label:"Win 3 Cee Lo hands",target:3,event:"ceelo:result",match:e=>(e==null?void 0:e.result)==="win"},{id:"ceelo_clean",label:"Avoid a loss twice",target:2,event:"ceelo:result",match:e=>(e==null?void 0:e.result)==="win"||(e==null?void 0:e.result)==="push"}],craps:[{id:"craps_points",label:"Make 2 points",target:2,event:"craps:point_made"},{id:"craps_place",label:"Hit 3 place wins",target:3,event:"craps:place_win"},{id:"craps_big",label:"Trigger a big table win",target:1,event:"craps:ats_win"}]},pO=(e=new Date)=>{const t=e.getFullYear(),r=String(e.getMonth()+1).padStart(2,"0"),n=String(e.getDate()).padStart(2,"0");return`${t}-${r}-${n}`},vfe=e=>{const[t,r,n]=e.split("-").map(Number),s=new Date(t,r-1,n);return s.setDate(s.getDate()-1),pO(s)},fO=(e,t)=>`community_missions_v1:${e}:${t||"guest"}`,Mh=e=>({dateKey:e,streak:1,lastPlayedDateKey:e,progress:{},completed:{}});function hR(e,t){const r=pO();try{const n=window.localStorage.getItem(fO(e,t));if(!n)return Mh(r);const s=JSON.parse(n);if(s.dateKey===r)return{...Mh(r),...s};const o=s.dateKey===vfe(r)?Math.max(1,(s.streak||1)+1):1;return{...Mh(r),streak:o,lastPlayedDateKey:r}}catch{return Mh(r)}}function _fe(e,t,r){try{window.localStorage.setItem(fO(e,t),JSON.stringify(r))}catch{}}function wfe(e,t){const r=ji(),n=bfe[e],[s,o]=l.useState(()=>hR(e,t));l.useEffect(()=>{o(hR(e,t))},[e,t]),l.useEffect(()=>{_fe(e,t,s)},[e,t,s]);const i=l.useCallback((p,d)=>{o(f=>{let m=!1;const h={...f.progress},b={...f.completed};for(const g of n){if(g.event!==p||g.match&&!g.match(d)||b[g.id])continue;const y=Math.min(g.target,(h[g.id]||0)+1);h[g.id]=y,m=!0,y>=g.target&&(b[g.id]=!0,r.success(g.label,{title:"Daily mission complete",duration:4200}))}return m?{...f,progress:h,completed:b}:f})},[n,r]);l.useEffect(()=>{const d=Array.from(new Set(n.map(f=>f.event))).map(f=>{const m=h=>i(f,h.detail);return window.addEventListener(f,m),()=>window.removeEventListener(f,m)});return()=>d.forEach(f=>f())},[n,i]);const c=l.useMemo(()=>n.map(p=>{const d=Math.min(p.target,s.progress[p.id]||0);return{id:p.id,label:p.label,target:p.target,progress:d,completed:!!s.completed[p.id]||d>=p.target}}),[n,s.completed,s.progress]),u=c.filter(p=>p.completed).length;return{missions:c,streak:s.streak,completedCount:u,totalCount:c.length}}const gR=["#ffd700","#ff6b6b","#4fc3f7","#81c784","#ba68c8","#ffb74d","#f06292","#aed581"],xfe=50;function Afe(e){const t=gR[e%gR.length],r=Math.random()*100,n=Math.random()*2,s=2+Math.random()*2,o=6+Math.random()*6,i=Math.random()*360,c=["square","rect","circle"],u=c[e%c.length];return a.jsx("span",{className:`lms-confetti__piece lms-confetti__piece--${u}`,style:{left:`${r}%`,animationDelay:`${n}s`,animationDuration:`${s}s`,backgroundColor:t,width:u==="rect"?`${o*.5}px`:`${o}px`,height:`${o}px`,transform:`rotate(${i}deg)`}},e)}function mO({winnerName:e,bonus:t,isHero:r,onDismiss:n,onPlayAgain:s,playAgainBusy:o}){const[i,c]=l.useState(!1);l.useEffect(()=>{requestAnimationFrame(()=>c(!0))},[]);const u=l.useMemo(()=>Array.from({length:xfe},(p,d)=>Afe(d)),[]);return a.jsxs("div",{className:`lms-overlay ${i?"lms-overlay--visible":""}`,onClick:n,children:[a.jsx("div",{className:"lms-confetti","aria-hidden":"true",children:u}),a.jsxs("div",{className:"lms-content",children:[a.jsx("div",{className:"lms-trophy",children:"🏆"}),a.jsx("div",{className:"lms-title",children:r?"Last One Standing!":`${e} Wins!`}),a.jsx("div",{className:"lms-subtitle",children:r?"All opponents eliminated — you dominate the table!":`${e} outlasted everyone at the table!`}),r&&t>0&&a.jsxs("div",{className:"lms-bonus",children:[a.jsx("span",{className:"lms-bonus__label",children:"Bonus Reward"}),a.jsxs("span",{className:"lms-bonus__amount",children:["+z",t.toLocaleString()]})]}),a.jsxs("div",{className:"lms-actions",children:[s&&a.jsx("button",{type:"button",className:"lms-dismiss lms-dismiss--primary",onClick:p=>{p.stopPropagation(),s()},disabled:o,style:o?{opacity:.5,pointerEvents:"none"}:void 0,children:o?"Starting…":"Play Again"}),a.jsx("button",{type:"button",className:s?"lms-dismiss lms-dismiss--secondary":"lms-dismiss",onClick:n,children:s?"Lobby":"Continue"})]})]})]})}const kfe=2e3,Sfe=2500,Efe=400,Pfe=1e3,m1=({show:e,variant:t,onComplete:r,zoomDurationMs:n=kfe,displayMs:s=Sfe,fadeDurationMs:o=Efe,ariaLabel:i,contained:c=!1})=>{const[u,p]=l.useState(!1),[d,f]=l.useState(!1),[m,h]=l.useState(!1),[b,g]=l.useState(!1),y=l.useRef({bleed:null,fade:null,complete:null,raf:null}),x=l.useRef(r);if(l.useEffect(()=>{x.current=r},[r]),l.useEffect(()=>(e?(y.current.bleed&&clearTimeout(y.current.bleed),y.current.fade&&clearTimeout(y.current.fade),y.current.complete&&clearTimeout(y.current.complete),y.current.raf&&cancelAnimationFrame(y.current.raf),p(!0),f(!1),h(!1),g(!1),y.current.raf=requestAnimationFrame(()=>{y.current.raf=requestAnimationFrame(()=>{y.current.raf=null,f(!0)})}),y.current.bleed=setTimeout(()=>{g(!0)},Math.min(Pfe,s)),y.current.fade=setTimeout(()=>{h(!0)},s),y.current.complete=setTimeout(()=>{p(!1),f(!1),h(!1),g(!1),x.current()},s+o)):(y.current.bleed&&clearTimeout(y.current.bleed),y.current.fade&&clearTimeout(y.current.fade),y.current.complete&&clearTimeout(y.current.complete),y.current.raf&&cancelAnimationFrame(y.current.raf),p(!1),f(!1),h(!1),g(!1)),()=>{y.current.bleed&&clearTimeout(y.current.bleed),y.current.fade&&clearTimeout(y.current.fade),y.current.complete&&clearTimeout(y.current.complete),y.current.raf&&cancelAnimationFrame(y.current.raf)}),[e,s,o]),!u)return null;const v=a.jsx("div",{className:`celebration-overlay ${c?"celebration-overlay--contained":""} ${b?"celebration-overlay--bleed-through":"celebration-overlay--foreground"} ${m?"celebration-overlay--fadeout":""}`,"data-testid":`celebration-${t}`,style:{"--celebration-fade-ms":`${o}ms`},children:a.jsx("div",{className:"celebration-container",children:a.jsx("div",{className:`celebration-image celebration-image--${t} ${d?"celebration-image--animating":""}`,style:{"--celebration-zoom-ms":`${n}ms`},role:"img","aria-label":i||`${t} celebration`})})});return c?v:ws.createPortal(v,document.body)},Cfe=500;function h1(){const[e,t]=l.useState(null),[r,n]=l.useState(Sa.showCelebrationImages!==!1),s=l.useRef([]),o=l.useRef(null),i=l.useCallback(()=>{if(s.current.length===0){o.current=null,t(null);return}const p=s.current.shift();p&&(o.current=p,t(p))},[]),c=l.useCallback((p,d)=>{if(!r)return;const f={variant:p,...d};if(s.current.push(f),!o.current){const m=s.current.shift();o.current=m,t(m)}},[r]),u=l.useCallback(()=>{o.current=null,t(null),setTimeout(()=>i(),Cfe)},[i]);return l.useEffect(()=>{let p=!0;ma().then(f=>{p&&n(f.showCelebrationImages!==!1)}).catch(()=>{p&&n(Sa.showCelebrationImages!==!1)});const d=f=>{const m=f.detail;m&&typeof m.showCelebrationImages=="boolean"&&n(m.showCelebrationImages)};return window.addEventListener("app:settings",d),()=>{p=!1,window.removeEventListener("app:settings",d)}},[]),l.useEffect(()=>{r||(s.current=[],o.current=null,t(null))},[r]),l.useEffect(()=>{},[c]),{active:e,fire:c,onComplete:u}}function Rfe(e){var p,d,f,m,h;const{total:t,point:r,events:n,resolutions:s}=e,o=[],i=!r&&(t===7||t===11);i&&(s!=null&&s.passLineWins)&&o.push({variant:"natural",displayMs:2500});const c=((p=n==null?void 0:n.includes)==null?void 0:p.call(n,"point_made"))||((d=n==null?void 0:n.includes)==null?void 0:d.call(n,"POINT_MADE"))||((f=n==null?void 0:n.some)==null?void 0:f.call(n,b=>b.startsWith("pointMade:")));c&&o.push({variant:"point-made",displayMs:3e3});const u=((m=n==null?void 0:n.includes)==null?void 0:m.call(n,"sevenOut"))||((h=n==null?void 0:n.includes)==null?void 0:h.call(n,"SEVEN_OUT"))||t===7&&!!(s!=null&&s.passLineLosses);return u&&o.push({variant:"generic-loss",displayMs:2e3}),{celebrations:o,sevenOut:u,isNatural:i,pointMade:!!c}}const ul=[{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"}],yR=l.lazy(()=>Cr(()=>Promise.resolve().then(()=>Pge),void 0,import.meta.url)),Tfe="single_player_guest_id";function qm(){var Vt,Je,mt,Te,Ve,tt,Et,Qt,or,Ht,Lt,nr,Mr,Br,wn,Kt,Jt,un,Tn,Kr,Er,yr,xn,gn,dn,Gr,Sn,Gn,en,Ce,Bn,xr,Zn,$n,Be,ut;const{roomId:e}=hp(),t=Hr(),{user:r,meId:n}=Zr(),{error:s}=ji();wm();const o=Db();l.useEffect(()=>(o.acquire(),()=>{o.release()}),[o]),l.useEffect(()=>{const be=()=>{try{Tx()||yn()}catch{}};be();const Se=["pointerdown","touchstart","mousedown","click","keydown"];return Se.forEach(nt=>{document.addEventListener(nt,be,{once:!0,capture:!0})}),()=>{Se.forEach(nt=>{document.removeEventListener(nt,be,{capture:!0})})}},[]);const i=(()=>{var be;try{return((be=window.sessionStorage)==null?void 0:be.getItem(Tfe))||""}catch{return""}})(),c=n||(r==null?void 0:r.id)||(r==null?void 0:r.email)||i||"",[u,p]=l.useState(0),{rollTrigger:d,resetSpin:f}=Ti(),[m,h]=l.useState(0),b=l.useRef(null),g=s1(e,c,{autoJoin:!0}),{room:y,joining:x,error:v,lastRollerId:A,deadline:_,serverNow:w,diceSettled:j}=g,T=q5({roomId:e||null,myPlayerId:c,autoJoinOrder:!0}),R=((Vt=y==null?void 0:y.gameState)==null?void 0:Vt.gameMode)==="craps"?T.shooterState:null,P=l.useMemo(()=>{var Se;const be=y==null?void 0:y.gameState;if((be==null?void 0:be.gameMode)==="craps"){const nt=((Se=T.lastRoll)==null?void 0:Se.point)??null,it=nt??be.crapsPoint??null,Bt=R?{...R}:{},ir={...be,...Bt,crapsPoint:it,lastRoll:T.lastRoll};return ir.crapsPhase=it?"point":"come-out",ir}return be},[y==null?void 0:y.gameState,R,T.lastRoll]),k=l.useMemo(()=>{var be;if(((be=y==null?void 0:y.gameState)==null?void 0:be.gameMode)==="craps"){const Se=T.lastRoll;return Se&&Array.isArray(Se.dice)?[Se.dice[0],Se.dice[1],0]:void 0}return g.diceResults},[(Je=y==null?void 0:y.gameState)==null?void 0:Je.gameMode,T.lastRoll,g.diceResults]),E=l.useRef(()=>{}),[M,C]=l.useState(!1),I=l.useCallback(be=>{E.current=be.roll,C(Se=>Se===be.canRoll?Se:be.canRoll)},[]),L=l.useMemo(()=>{const be=P==null?void 0:P.spectators;return Array.isArray(be)&&!!c&&be.includes(c)},[P,c]),N=!!(g!=null&&g.canRoll)&&!L,S=l.useCallback(()=>{var be;N&&((be=g==null?void 0:g.handleRoll)==null||be.call(g))},[g,N]),F=l.useCallback(()=>{var be;if(M){h(1);try{(be=E.current)==null||be.call(E)}finally{window.setTimeout(()=>h(0),120)}}},[M]),D=l.useMemo(()=>{var er,mr;if(((er=y==null?void 0:y.gameState)==null?void 0:er.gameMode)!=="craps")return[];const be=(y==null?void 0:y.players)??[],Se=(R==null?void 0:R.turnOrder)||((mr=y==null?void 0:y.gameState)==null?void 0:mr.turnOrder)||[];if(!Se.length)return be;const nt=new Map(be.map(hr=>[hr.id,hr])),it=new Set(Se),Bt=Se.map((hr,J)=>{const $e=nt.get(hr);if($e)return $e;const jt=hr.includes("craps_bot_")||hr.includes("bot_");return{id:hr,name:jt?mR[J%mR.length]||`Bot ${J+1}`:"Player",isReady:!0,balance:jt?500:0,avatarUrl:null,isBot:jt}}),ir=be.filter(hr=>!it.has(hr.id)&&!hr.isBot);return[...Bt,...ir]},[(mt=y==null?void 0:y.gameState)==null?void 0:mt.gameMode,y==null?void 0:y.players,R==null?void 0:R.turnOrder,(Te=y==null?void 0:y.gameState)==null?void 0:Te.turnOrder]),H=l.useMemo(()=>{var $e,jt,Yt,Ot,Pe;if(!(y!=null&&y.singlePlayer))return;const be=($e=y==null?void 0:y.gameState)==null?void 0:$e.gameMode;if(be!=="craps"&&be!=="cee-lo")return;const Se=be==="craps"?r==null?void 0:r.spLevelCraps:r==null?void 0:r.spLevelCeelo,nt=Number((y==null?void 0:y.spLevel)??((jt=y==null?void 0:y.gameState)==null?void 0:jt._spLevel)??Se??1),it=Number.isFinite(nt)&&nt>0?nt:1,Bt=new Map;if(be==="craps")for(const ht of D)Bt.set(String((ht==null?void 0:ht.id)??""),ht);for(const ht of(y==null?void 0:y.players)??[])Bt.set(String((ht==null?void 0:ht.id)??""),ht);const ir=(Yt=y==null?void 0:y.gameState)==null?void 0:Yt._botBalances;for(const[ht,It]of Object.entries(ir??{}))Bt.has(ht)||Bt.set(ht,{id:ht,isBot:!0,balance:It});const er=Array.from(Bt.values()).filter(ht=>(ht==null?void 0:ht.isBot)||String((ht==null?void 0:ht.id)??"").includes("bot_")),mr=er.filter(ht=>{const It=ir==null?void 0:ir[String((ht==null?void 0:ht.id)??"")];return Number(It??(ht==null?void 0:ht.balance)??0)<=0}).length,hr=(y==null?void 0:y.levelName)??((Ot=y==null?void 0:y.gameState)==null?void 0:Ot._levelName)??((Pe=ul.find(ht=>ht.level===it))==null?void 0:Pe.name)??`Level ${it}`,J=er.length;return{level:it,levelName:hr,current:mr,total:J,progressLabel:`${mr}/${J} bots defeated`,goalLabel:`Defeat every bot to reach Level ${it+1}`,isMaxLevel:it>=ul.length}},[y==null?void 0:y.singlePlayer,y==null?void 0:y.gameState,y==null?void 0:y.spLevel,y==null?void 0:y.levelName,y==null?void 0:y.players,D,r==null?void 0:r.spLevelCraps,r==null?void 0:r.spLevelCeelo]),{onCrapsShooterTurnEnd:W,cancelAd:G}=bu(),$=l.useRef(null);l.useEffect(()=>{var it;if(((it=y==null?void 0:y.gameState)==null?void 0:it.gameMode)!=="craps")return;const be=T.lastRoll;if(!be||$.current===be)return;$.current=be;const{currentRollerId:Se,nextRollerId:nt}=be;Se&&nt&&Se!==nt&&W()},[T.lastRoll,(Ve=y==null?void 0:y.gameState)==null?void 0:Ve.gameMode,W]);const K=l.useRef(null),[de,ie]=l.useState(1),[we,he]=l.useState(null),[Ae,Fe]=l.useState(!1),[U,V]=l.useState(void 0),[z,O]=l.useState(null),[q,X]=l.useState(null),Z=l.useMemo(()=>((y==null?void 0:y.players)??[]).filter(be=>be.id!==c).map(be=>({id:be.id,name:be.name})),[y==null?void 0:y.players,c]),Q=((tt=y==null?void 0:y.gameState)==null?void 0:tt.phase)==="waiting"&&!d,oe=(((Et=y==null?void 0:y.gameState)==null?void 0:Et.gameMode)||"cee-lo")==="cee-lo"&&!!((Qt=y==null?void 0:y.gameState)!=null&&Qt.roundEnded),ce=typeof((or=y==null?void 0:y.gameState)==null?void 0:or.roundSeq)=="number"?(y==null?void 0:y.gameState).roundSeq:0;l.useEffect(()=>{oe&&q!==ce&&O(ce)},[q,ce,oe]),l.useEffect(()=>{O(null),X(null)},[e]),l.useEffect(()=>{Q?ob({volume:.0125}):Il()},[Q]);const _e=l.useCallback(be=>{V(be),Fe(!0)},[]),re=l.useCallback(()=>{Fe(!1),V(void 0)},[]),pe=l.useRef(void 0);l.useEffect(()=>{var Se,nt,it;const be=(Se=y==null?void 0:y.gameState)==null?void 0:Se.roundSeq;if(typeof be=="number"&&pe.current!==void 0&&be!==pe.current&&(p(0),(((nt=y==null?void 0:y.gameState)==null?void 0:nt.gameMode)||"cee-lo")==="cee-lo")){const Bt=(it=y==null?void 0:y.gameState)==null?void 0:it.banker,ir=Bt&&c&&Bt===c;try{ir||d0({volume:.6})}catch{}}typeof be=="number"&&(pe.current=be)},[(Ht=y==null?void 0:y.gameState)==null?void 0:Ht.roundSeq]);const ee=Na(),{joinRoom:xe}=Is(),[Le,Ge]=l.useState(!1);l.useCallback(async()=>{if(!Le&&!(!ee||!e)){Ge(!0);try{if(xe)try{await xe(e)}catch(be){console.warn("[manualRefresh] joinRoom failed",be)}}catch(be){console.warn("[manualRefresh] failed",be)}finally{Ge(!1)}}},[Le,ee,e,xe]),l.useEffect(()=>{if(!ee)return;const be=()=>{try{f()}catch{}};return ee.on("disconnect",be),()=>{ee.off("disconnect",be)}},[ee,f]),l.useEffect(()=>{if(!ee||!c)return;const be=Se=>{var nt;if(!(!Se||Se.winnerId!==c)){console.log("[game] last man standing (server event)",{myId:c});try{G()}catch{}Ie({winnerId:c}),(nt=B.current)==null||nt.call(B,"last-man",{displayMs:3e3})}};return ee.on("ceelo:last_man_standing",be),ee.on("craps:last_man_standing",be),()=>{ee.off("ceelo:last_man_standing",be),ee.off("craps:last_man_standing",be)}},[ee,c,G]),l.useEffect(()=>{if(!ee||!c)return;const be=Se=>{!Se||Se.playerId!==c||(console.log("[ceelo] player busted (server event)",{myId:c}),se(!0))};return ee.on("ceelo:player_busted",be),()=>{ee.off("ceelo:player_busted",be)}},[ee,c]),l.useEffect(()=>{se(!1)},[e]),l.useEffect(()=>{requestAnimationFrame(()=>{window.scrollTo({top:0,left:0,behavior:"instant"})})},[]);const[_t,Xe]=l.useState(()=>typeof window>"u"?!1:window.innerWidth>window.innerHeight);l.useEffect(()=>{const be=()=>Xe(window.innerWidth>window.innerHeight);window.addEventListener("resize",be);const Se=setTimeout(be,0);return()=>{window.removeEventListener("resize",be),clearTimeout(Se)}},[]),l.useEffect(()=>{v&&s(v,{title:"Room Error",duration:5e3})},[v,s]);const bt=l.useRef(0),Pt=l.useRef(!1),kt=l.useRef(!1),Ee=l.useRef(!1),le=l.useRef(!1),De=l.useRef(null),Ye=l.useRef(null),[Re,et]=l.useState(0),{active:rt,fire:ne,onComplete:ue}=h1(),B=l.useRef(ne);B.current=ne;const fe=l.useRef(0),ye=l.useRef(null),ve=l.useRef(0),ke=l.useRef(0),Ue=l.useRef(0),ct=l.useRef(0),dt=l.useRef(0),Rt=["ceelo-noir-win"],jr=["craps-noir-win"],Qe=["loss-ceelo","loss-craps"],Mt=["loss-craps","loss-ceelo"],lr=()=>{const be=Rt[Ue.current%Rt.length];return Ue.current+=1,be},zt=()=>{const be=jr[ct.current%jr.length];return ct.current+=1,be},br=()=>{const be=Qe[dt.current%Qe.length];return dt.current+=1,be},fr=()=>{const be=Mt[dt.current%Mt.length];return dt.current+=1,be},[ur,Ie]=l.useState(null),[yt,St]=l.useState(!1),[Xt,se]=l.useState(!1);l.useEffect(()=>{},[c,ne]);const{createRoom:je}=sa(),[Oe,Ke]=l.useState(),Me=l.useRef(null);l.useEffect(()=>{var it,Bt,ir;const be=((it=y==null?void 0:y.gameState)==null?void 0:it.gameMode)||"cee-lo",Se=(Bt=y==null?void 0:y.gameState)==null?void 0:Bt.currentRollerId,nt=!!((ir=y==null?void 0:y.gameState)!=null&&ir.roundEnded);if(be==="cee-lo"){if(nt){Ke(void 0),Me.current=null;return}Se&&Se!==Me.current&&(Me.current=Se,Ke(Date.now()+3e4))}},[(Lt=y==null?void 0:y.gameState)==null?void 0:Lt.currentRollerId,(nr=y==null?void 0:y.gameState)==null?void 0:nr.roundEnded,(Mr=y==null?void 0:y.gameState)==null?void 0:Mr.gameMode]);const[wt,at]=l.useState(!1);l.useEffect(()=>{var nt;const be=(nt=y==null?void 0:y.gameState)==null?void 0:nt.gameMode;if(!be)return;let Se=!0;return(async()=>{try{const{Preferences:it}=await Cr(async()=>{const{Preferences:er}=await Promise.resolve().then(()=>Do);return{Preferences:er}},void 0,import.meta.url),Bt=be==="craps"?"onb_craps_v1":"onb_ceelo_v1",{value:ir}=await it.get({key:Bt});if(!Se)return;at(ir!=="1")}catch{if(!Se)return;at(!0)}})(),()=>{Se=!1}},[(Br=y==null?void 0:y.gameState)==null?void 0:Br.gameMode]);const Dt=l.useCallback(()=>{var Se;const be=(Se=y==null?void 0:y.gameState)==null?void 0:Se.gameMode;(async()=>{try{const{Preferences:nt}=await Cr(async()=>{const{Preferences:it}=await Promise.resolve().then(()=>Do);return{Preferences:it}},void 0,import.meta.url);await nt.set({key:be==="craps"?"onb_craps_v1":"onb_ceelo_v1",value:"1"})}catch{}at(!1)})()},[(wn=y==null?void 0:y.gameState)==null?void 0:wn.gameMode]);l.useEffect(()=>{var er;if(((er=y==null?void 0:y.gameState)==null?void 0:er.gameMode)==="craps"){Pt.current=!1,kt.current=!1;return}const be=g==null?void 0:g.diceResults;if(!be||be.length!==3){Pt.current=!1,kt.current=!1,Ee.current=!1,De.current=null;return}const Se=be.join(",");if(Se===De.current)return;De.current=Se;const nt=[...be].sort().join(","),it=nt==="4,5,6",Bt=it||nt==="1,2,3",ir=be[0]===be[1]&&be[1]===be[2];Ee.current=ir,Pt.current=Bt,kt.current=it},[g==null?void 0:g.diceResults,(Kt=y==null?void 0:y.gameState)==null?void 0:Kt.gameMode]),l.useEffect(()=>{var ir,er;if(((ir=y==null?void 0:y.gameState)==null?void 0:ir.gameMode)==="craps"){Ye.current=null;return}const be=(er=y==null?void 0:y.gameState)==null?void 0:er.bankRoll;if(!be||!Array.isArray(be.raw)||be.raw.length!==3){Ye.current=null;return}const Se=be.raw,nt={};for(const mr of Se)nt[mr]=(nt[mr]||0)+1;const it=Object.keys(nt).map(Number);it.length===2&&it.some(mr=>nt[mr]===1)?Ye.current=it.find(mr=>nt[mr]===1)||null:Ye.current=null},[(Jt=y==null?void 0:y.gameState)==null?void 0:Jt.bankRoll,(un=y==null?void 0:y.gameState)==null?void 0:un.gameMode]),l.useEffect(()=>{var jt,Yt;if(((jt=y==null?void 0:y.gameState)==null?void 0:jt.gameMode)==="craps"){le.current=!1;return}const be=(Yt=y==null?void 0:y.gameState)==null?void 0:Yt.banker;if(be&&c&&be===c){le.current=!1;return}const nt=Ye.current;if(!nt||nt<1){le.current=!1;return}const it=g==null?void 0:g.diceResults;if(!it||it.length!==3){le.current=!1;return}const ir=[...it].sort((Ot,Pe)=>Ot-Pe).join(",")==="4,5,6",er={};for(const Ot of it)er[Ot]=(er[Ot]||0)+1;const mr=Object.keys(er).map(Number),hr=mr.length===1,$e=mr.length===2&&mr.some(Ot=>er[Ot]===1)?mr.find(Ot=>er[Ot]===1):null;le.current=ir||hr||$e!==null&&$e>nt},[g==null?void 0:g.diceResults,y==null?void 0:y.gameState,c,(Tn=y==null?void 0:y.gameState)==null?void 0:Tn.gameMode]),l.useEffect(()=>{var Se;if(!(g!=null&&g.diceSettled))return;const be=Date.now();if(Pt.current||kt.current||Ee.current||le.current){if(be-bt.current<800){Pt.current=!1,kt.current=!1,Ee.current=!1,le.current=!1;return}bt.current=be;const nt=(y==null?void 0:y.singlePlayer)===!0,it=(Se=y==null?void 0:y.gameState)==null?void 0:Se.banker,Bt=it&&c&&it===c,ir=A,er=ir==null?void 0:ir.startsWith("bot_");!er&&(nt||ir&&c&&ir===c||!Bt)&&(kt.current?ne("bang-bang-456",{displayMs:3e3,zoomDurationMs:2500}):Ee.current&&ne("trips",{displayMs:2500})),le.current&&!er&&ne("clutch",{displayMs:2500}),Pt.current=!1,kt.current=!1,Ee.current=!1,le.current=!1,et(J=>J+1)}},[g==null?void 0:g.diceSettled,A,c,y==null?void 0:y.singlePlayer,(Kr=y==null?void 0:y.gameState)==null?void 0:Kr.banker,ne]),l.useEffect(()=>{var nt;if((((nt=y==null?void 0:y.gameState)==null?void 0:nt.gameMode)||"cee-lo")!=="cee-lo")return;const Se=it=>{var ir;const Bt=(ir=it.detail)==null?void 0:ir.result;if(Bt==="win"){ke.current+=1;const er=ke.current;er>=5&&er%5===0?ne("streak-5",{displayMs:3500}):er>=3&&er%3===0?ne("streak-3",{displayMs:3e3}):ne(lr(),{displayMs:2e3})}else Bt==="lose"&&(ke.current=0,ne(br(),{displayMs:2e3}))};return window.addEventListener("ceelo:result",Se),()=>window.removeEventListener("ceelo:result",Se)},[(Er=y==null?void 0:y.gameState)==null?void 0:Er.gameMode,ne]),l.useEffect(()=>{var hr;if(((hr=y==null?void 0:y.gameState)==null?void 0:hr.gameMode)!=="craps")return;const be=T.lastRoll;if(!be||ye.current===be)return;ye.current=be;const{total:Se,point:nt,resolutions:it,events:Bt}=be,ir=Rfe({total:Se,point:nt,events:Bt??[],resolutions:it??{passLineWins:!1,passLineLosses:!1,pushes:!1}});let er=null;it!=null&&it.passLineWins?(fe.current+=1,fe.current>=5?(er="streak-5",fe.current=0):fe.current>=2&&(er="hot-streak")):it!=null&&it.passLineLosses&&(fe.current=0);const mr=ir.celebrations[0];if(mr){const J=mr.variant==="generic-loss"?fr():mr.variant;ne(J,{displayMs:mr.displayMs})}else er?ne(er,{displayMs:er==="streak-5"?3500:3e3}):it!=null&&it.passLineWins&&ne(zt(),{displayMs:2e3})},[T.lastRoll,(yr=y==null?void 0:y.gameState)==null?void 0:yr.gameMode,ne]),l.useEffect(()=>{var Yt;if((((Yt=y==null?void 0:y.gameState)==null?void 0:Yt.gameMode)||"cee-lo")!=="cee-lo")return;const Se=y==null?void 0:y.gameState,nt=(Se==null?void 0:Se.roundSeq)??0,it=(Se==null?void 0:Se.turnHistory)??[],Bt=it.filter(Ot=>Ot.roundSeq===nt),ir=Bt.find(Ot=>Ot.playerId===c),er=Bt.filter(Ot=>Ot.playerId!==c);if(console.log("[sweep-check]",{roundEnded:Se==null?void 0:Se.roundEnded,roundSeq:nt,lastSweepSeq:ve.current,banker:Se==null?void 0:Se.banker,myId:c,bankerMatch:(Se==null?void 0:Se.banker)===c,historyLen:it.length,roundEntryCount:Bt.length,bankerEntry:ir?{rank:ir.rank,playerId:ir.playerId}:null,challengerCount:er.length,challengers:er.map(Ot=>{var Pe;return{playerId:(Pe=Ot.playerId)==null?void 0:Pe.slice(0,8),rank:Ot.rank}}),allLost:ir?er.every(Ot=>Ot.rank<ir.rank):!1}),!(Se!=null&&Se.roundEnded))return;const mr=Se.roundSeq??0;if(mr<=ve.current)return;const hr=Se.banker;if(!hr||hr!==c)return;const J=Bt.find(Ot=>Ot.playerId===c),$e=Bt.filter(Ot=>Ot.playerId!==c);!J||$e.length<2||!$e.every(Ot=>Ot.rank<J.rank)||(ve.current=mr,console.log("[sweep-check] 🎉 FIRING ceelo-sweep celebration",{roundSeq:mr}),ne("ceelo-sweep",{displayMs:3e3}))},[(xn=y==null?void 0:y.gameState)==null?void 0:xn.roundEnded,(gn=y==null?void 0:y.gameState)==null?void 0:gn.roundSeq,(dn=y==null?void 0:y.gameState)==null?void 0:dn.gameMode,c,ne]),l.useEffect(()=>{var nt;if(((nt=y==null?void 0:y.gameState)==null?void 0:nt.gameMode)!=="craps")return;const be=()=>{ne(zt(),{displayMs:2e3})},Se=()=>{ne("craps-big-win",{displayMs:3500})};return window.addEventListener("craps:place_win",be),window.addEventListener("craps:ats_win",Se),()=>{window.removeEventListener("craps:place_win",be),window.removeEventListener("craps:ats_win",Se)}},[(Gr=y==null?void 0:y.gameState)==null?void 0:Gr.gameMode,ne]);const Ut=wfe(((Sn=y==null?void 0:y.gameState)==null?void 0:Sn.gameMode)==="craps"?"craps":"cee-lo",c);if(x)return a.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[a.jsx(Ja,{className:"page-home-screen"}),a.jsx("div",{className:"home-preloader",children:a.jsx("div",{className:"home-preloader__spinner"})})]});if(!y)return console.error('[Gameroom] Rendering "Room not found" error',{roomId:e,error:v,joining:x}),a.jsxs("div",{className:"HomeScreen theme-casino",children:[a.jsx(Ja,{className:"page-gameroom"}),a.jsx("div",{className:"room-grid-fit",children:a.jsxs("div",{className:"error-grid",children:[a.jsx("p",{className:"error text-center",children:"Room not found."}),a.jsx("button",{className:"felt-btn felt-btn--secondary",onClick:()=>t("/lobby"),children:"Back to lobby"})]})})]});const ft=((Gn=y.gameState)==null?void 0:Gn.gameMode)==="craps",wr=((en=y.gameState)==null?void 0:en.gameMode)!=="craps";return a.jsxs(jfe,{className:ft?"mode-craps":wr?"mode-ceelo":void 0,bgShakeTrigger:Re,children:[a.jsx(Ja,{className:"page-gameroom"}),a.jsx(Ude,{}),a.jsx(dO,{open:wt,onClose:Dt,title:ft?"Craps":"Cee‑Lo",tagline:ft?"Place your bets and roll the point.":"Banker vs challengers. Roll to win.",steps:ft?["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:ft?"onb_craps_v1":"onb_ceelo_v1"}),a.jsxs("div",{className:"room-grid-fit",style:!_t&&we&&!ft?{height:we}:void 0,children:[a.jsx("div",{className:"fairness-container",children:a.jsx(yfe,{roomId:e,lastRollerId:A,roundSeq:(Ce=y==null?void 0:y.gameState)==null?void 0:Ce.roundSeq,autoHideMs:ft?3e3:void 0})}),a.jsxs("div",{ref:K,className:"room-grid"+(ft?" room-grid--craps":"")+(de<.999?" room-grid--scaled":""),style:de<.999?{transform:`scale(${de})`,transformOrigin:"top center",height:we||void 0}:void 0,children:[rt&&a.jsx(m1,{show:!0,contained:!0,variant:rt.variant,displayMs:rt.displayMs,zoomDurationMs:rt.zoomDurationMs,fadeDurationMs:rt.fadeDurationMs,ariaLabel:rt.ariaLabel,onComplete:ue}),ft?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"players-row",children:a.jsx(fR,{className:"PlayerPanel",roomId:e,roomName:y.name,players:D,bankerId:(Bn=y.gameState)==null?void 0:Bn.banker,currentRollerId:(xr=y.gameState)==null?void 0:xr.currentRollerId,meId:c,gameState:P,lastRollerId:A,onOpenDM:_e,onOpenSendMoney:()=>{},crapsRollHistory:T.rollHistory,singlePlayer:y==null?void 0:y.singlePlayer,campaignProgress:H})}),a.jsx("div",{className:"stage",ref:b,children:a.jsx("div",{className:"table-wrap",children:a.jsx("div",{className:`felt ${Q?"is-muted":""}`,children:a.jsx(yR,{isWaiting:Q,rollTrigger:d,results:k,preRollTrigger:u,gameMode:(Zn=y.gameState)==null?void 0:Zn.gameMode,gameState:P,chargeLevel:m,shimmerColor:"#f5d78e",rollEnabled:M,onRollRequest:F})})})}),a.jsxs("div",{className:"bets-wrapper bets-wrapper--craps",children:[a.jsx(aR,{...Ut}),(()=>{const be=y.players.find(nt=>nt.id===c),Se=(be==null?void 0:be.balance)??(r==null?void 0:r.balance)??1e3;return a.jsx(Fde,{meId:c,balance:Se,onChargeChange:h,onRollAffordanceChange:I})})()]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"players-row",children:a.jsx(fR,{className:"player-panel",roomId:e,roomName:y.name,players:y.gameState.turnOrder.map(be=>y.players.find(Se=>Se.id===be)).filter(be=>!!be),bankerId:($n=y.gameState)==null?void 0:$n.banker,currentRollerId:(Be=y.gameState)==null?void 0:Be.currentRollerId,meId:c,gameState:P,lastRollerId:A,onOpenDM:_e,onOpenSendMoney:()=>{},singlePlayer:y==null?void 0:y.singlePlayer,turnDeadlineTs:Oe,campaignProgress:H})}),a.jsx("div",{className:"stage",ref:b,children:a.jsx("div",{className:"table-wrap",children:a.jsx("div",{className:`felt ${Q?"is-muted":""}`,children:a.jsx(yR,{isWaiting:Q,rollTrigger:d,results:k,preRollTrigger:u,gameMode:(ut=y.gameState)==null?void 0:ut.gameMode,gameState:P,chargeLevel:m,shimmerColor:"#f5d78e",rollEnabled:N,onRollRequest:S})})})}),a.jsxs("div",{className:"bet-panel",children:[a.jsx(aR,{...Ut}),!1,a.jsx("div",{className:"bets-wrapper",children:a.jsx(lse,{gameState:y.gameState,roundEnded:y.gameState.roundEnded,roomId:e,meId:c,bankerId:y.gameState.banker,hasBankRoll:!!y.gameState.bankRoll,players:y.players,timeLeft:{deadline:_,serverNow:w},showPassBank:!1,showSpectateRow:!1,gameplay:g,onChargeChange:h})}),a.jsx("div",{className:"spectate-wrapper",children:a.jsx(Xde,{roomId:e,meId:c,bankerId:y.gameState.banker,players:y.players,gameState:P,gameplay:g})})]})]})]})]}),a.jsx(Ope,{}),a.jsx(hfe,{open:Ae,onClose:re,peers:Z,initialPeerId:U}),ur&&a.jsx(mO,{winnerName:(()=>{const be=((y==null?void 0:y.players)??[]).find(Se=>Se.id===ur.winnerId);return(be==null?void 0:be.name)||"You"})(),bonus:0,isHero:!0,onDismiss:()=>{Ie(null),t("/lobby")},playAgainBusy:yt,onPlayAgain:async()=>{var be,Se,nt;if(!yt){try{const{hapticClick:it}=await Cr(async()=>{const{hapticClick:Bt}=await Promise.resolve().then(()=>q0);return{hapticClick:Bt}},void 0,import.meta.url);it("Medium")}catch{}St(!0);try{const{loadSettings:it}=await Cr(async()=>{const{loadSettings:$e}=await Promise.resolve().then(()=>gI);return{loadSettings:$e}},void 0,import.meta.url),Bt=await it(),ir=Bt.botDifficultyLevel&&Bt.botDifficultyLevel>=1&&Bt.botDifficultyLevel<=9?Bt.botDifficultyLevel:void 0,er=((be=y==null?void 0:y.gameState)==null?void 0:be.gameMode)||"cee-lo",mr=await je({name:"Single Player Room",singlePlayer:!0,gameMode:er,botLevel:ir}),hr=(mr==null?void 0:mr.room)??((Se=mr==null?void 0:mr.data)==null?void 0:Se.room)??null,J=(hr==null?void 0:hr.roomId)??(hr==null?void 0:hr.id)??(mr==null?void 0:mr.roomId)??((nt=mr==null?void 0:mr.data)==null?void 0:nt.roomId);J?(Ie(null),t(`/room/${J}`,{replace:!0})):(console.warn("[game:play_again] no room id in response",mr),St(!1))}catch(it){console.error("[game:play_again] error",it),St(!1)}}}}),Xt&&a.jsx("div",{className:"busted-overlay",onClick:()=>{se(!1),t("/lobby")},children:a.jsxs("div",{className:"busted-overlay__card",onClick:be=>be.stopPropagation(),children:[a.jsx("h2",{children:"You're Busted!"}),a.jsx("p",{children:"Your balance hit zero. Buy more credits to keep playing."}),a.jsxs("div",{className:"busted-overlay__actions",children:[a.jsx("button",{className:"felt-btn felt-btn--halo",onClick:()=>{se(!1),t("/add-chips")},children:"Buy Credits"}),a.jsx("button",{className:"felt-btn",onClick:()=>{se(!1),t("/lobby")},children:"Back to Lobby"})]})]})})]})}function jfe({children:e,className:t,bgShakeTrigger:r}){const n=l.useRef(null),s=l.useRef(!0),{showAnimations:o}=d1();return l.useEffect(()=>{n.current&&n.current.classList.remove("fx-bg-shake")},[]),l.useEffect(()=>{if(!n.current||typeof r!="number"||o===!1)return;if(s.current||r===0){s.current=!1;return}n.current.classList.remove("fx-bg-shake"),n.current.offsetHeight,n.current.classList.add("fx-bg-shake");const i=()=>{var c;(c=n.current)==null||c.classList.remove("fx-bg-shake")};return n.current.addEventListener("animationend",i,{once:!0}),()=>{var c;(c=n.current)==null||c.removeEventListener("animationend",i)}},[r,o]),a.jsx("div",{ref:n,className:"room-shell"+(t?` ${t}`:""),children:e})}function Ife(e=3e4){const{friends:t}=sc(),{getOnlineFriends:r}=sa(),[n,s]=l.useState(new Set),[o,i]=l.useState(!0),c=l.useCallback(async()=>{try{const p=await r();p!=null&&p.ok&&Array.isArray(p.online)&&s(new Set(p.online))}catch{}i(!1)},[r]);return l.useEffect(()=>{c();const p=setInterval(c,e);return()=>clearInterval(p)},[c,e]),l.useEffect(()=>{c()},[t.length,c]),{onlineFriends:t.filter(p=>n.has(p.id)).map(p=>({...p,isOnline:!0})),loading:o,refresh:c}}function Nfe({gameMode:e}){const{onlineFriends:t,loading:r}=Ife(),{user:n}=Zr();return!n||r||t.length===0?null:a.jsxs("div",{className:"online-friends",role:"region","aria-label":"Online Friends",children:[a.jsxs("div",{className:"online-friends__header",children:[a.jsx("span",{className:"online-friends__dot","aria-hidden":!0}),a.jsxs("span",{className:"online-friends__title",children:[t.length," Friend",t.length>1?"s":""," Online"]})]}),a.jsx("div",{className:"online-friends__scroll",children:t.map(s=>a.jsx(Mfe,{friend:s,gameMode:e},s.id))})]})}function Mfe({friend:e,gameMode:t}){const r=e.name??"Player",n=r.charAt(0).toUpperCase();return a.jsxs("div",{className:"online-friend-chip",title:r,children:[a.jsxs("div",{className:"online-friend-chip__avatar",style:e.avatarUrl?{backgroundImage:`url(${e.avatarUrl})`}:void 0,children:[!e.avatarUrl&&a.jsx("span",{className:"online-friend-chip__initial",children:n}),a.jsx("span",{className:"online-friend-chip__status","aria-hidden":!0})]}),a.jsx("span",{className:"online-friend-chip__name",children:r.length>8?r.slice(0,7)+"…":r})]})}const Lh="theme-light",Dh="theme-dark";function Oh(e){const t=document.documentElement,r=document.body;e==="light"?(t.classList.add(Lh),t.classList.remove(Dh),r.classList.add(Lh),r.classList.remove(Dh)):(t.classList.add(Dh),t.classList.remove(Lh),r.classList.add(Dh),r.classList.remove(Lh))}function hO(){const[e,t]=l.useState(!1),[r,n]=l.useState("dark");l.useEffect(()=>{let i=!0;return(async()=>{try{const u=(await ma()).theme??"dark";i&&(n(u),Oh(u),t(!0))}catch{i&&(Oh("dark"),t(!0))}})(),()=>{i=!1}},[]),l.useEffect(()=>{e&&Oh(r)},[r,e]);const s=l.useCallback(async i=>{n(i),Oh(i);try{const c=await ma(),u={...Sa,...c,theme:i};await $i(u)}catch{}},[]),o=l.useCallback(async()=>{await s(r==="dark"?"light":"dark")},[r,s]);return{ready:e,theme:r,setTheme:s,toggleTheme:o}}const Lfe=""+new URL("ceelo-icon-DBUGq3gk.webp",import.meta.url).href,Dfe=""+new URL("craps-icon-Cxbu5IDi.webp",import.meta.url).href,Ofe=""+new URL("poker-icon-D9lS6jix.webp",import.meta.url).href,zfe=""+new URL("skills-icon-BWMGnrDl.webp",import.meta.url).href,Bfe=""+new URL("zentara-icon-CtcCkOmF.webp",import.meta.url).href;function Ffe(){const e=Na(),t=Hr(),{user:r}=Zr(),{friends:n,friendRequests:s,blockedUsers:o,addFriend:i}=sc(),[c,u]=l.useState(""),[p,d]=l.useState([]),[f,m]=l.useState(!1),[h,b]=l.useState(null),[g,y]=l.useState(new Set),x=l.useRef(null),v=l.useCallback(j=>{if(!e||!j.trim()||j.trim().length<2){d([]),b(null);return}m(!0),b(null),e.emit(tr.SOCIAL_SEARCH_PLAYERS,{query:j.trim()},T=>{if(m(!1),T.ok&&T.players){const R=T.players.map(P=>({...P,isFriend:n.some(k=>k.id===P.id),isPending:s.some(k=>(k.fromUserId===P.id||k.toUserId===P.id)&&k.status==="PENDING"),isBlocked:o.some(k=>k.id===P.id)}));d(R)}else b(T.error||"Search failed"),d([])})},[e,n,s,o]);l.useEffect(()=>(x.current&&clearTimeout(x.current),c.trim().length>=2?x.current=setTimeout(()=>{v(c)},300):(d([]),b(null)),()=>{x.current&&clearTimeout(x.current)}),[c,v]);const A=l.useCallback(j=>{g.has(j)||(i(j),y(T=>new Set([...T,j])))},[i,g]),_=j=>j.isFriend?"Friends":j.isPending||g.has(j.id)?"Pending":j.isBlocked?"Blocked":"Add Friend",w=j=>j.isFriend||j.isPending||j.isBlocked||g.has(j.id);return r?a.jsxs("div",{className:"friend-search",children:[a.jsx("div",{className:"friend-search-header",children:a.jsx("h3",{children:"Find Friends"})}),a.jsxs("div",{className:"friend-search-input-wrapper",children:[a.jsx("input",{type:"text",className:"friend-search-input",placeholder:"Search by username...",value:c,onChange:j=>u(j.target.value),autoComplete:"off",autoCapitalize:"off"}),f&&a.jsx("span",{className:"friend-search-spinner",children:"⟳"})]}),h&&a.jsx("div",{className:"friend-search-error",children:h}),p.length>0&&a.jsx("ul",{className:"friend-search-results",children:p.map(j=>a.jsxs("li",{className:"friend-search-result",children:[a.jsx("div",{className:"friend-search-avatar",onClick:()=>t(`/player/${j.id}`),style:{cursor:"pointer"},children:j.avatarUrl?a.jsx("img",{src:j.avatarUrl,alt:j.name||"User"}):a.jsx("div",{className:"friend-search-avatar-placeholder",children:(j.name||"?")[0].toUpperCase()})}),a.jsx("span",{className:"friend-search-name",onClick:()=>t(`/player/${j.id}`),style:{cursor:"pointer"},children:j.name}),a.jsx("button",{className:`friend-search-btn ${w(j)?"disabled":""}`,onClick:()=>A(j.id),disabled:w(j),children:_(j)})]},j.id))}),c.trim().length>=2&&!f&&p.length===0&&!h&&a.jsx("div",{className:"friend-search-empty",children:"No users found"}),c.trim().length>0&&c.trim().length<2&&a.jsx("div",{className:"friend-search-hint",children:"Enter at least 2 characters"})]}):null}function vu(){const e=Hr(),{user:t,refreshUser:r,logout:n}=Zr(),{updateProfile:s}=sa(),{membershipModalOpen:o,setMembershipModalOpen:i}=wm(),{isPremium:c}=fM(),{friends:u,friendRequests:p,blockedUsers:d,refreshSocial:f,isBlocked:m,blockUser:h,unblockUser:b,removeFriend:g,respondToFriendRequest:y}=sc(),{getUnreadForPeer:x}=Dm(),{forUserId:v,anchorRect:A,anchorEl:_,openFor:w,close:j}=c1(),[T,R]=l.useState(null),[P,k]=l.useState(null),E=l.useCallback((Je,mt,Te,Ve)=>{w(Je,mt),R(Te),k(Ve||null)},[w]),M=l.useCallback(()=>{j(),R(null),k(null)},[j]),[C,I]=l.useState((t==null?void 0:t.name)??""),[L,N]=l.useState((t==null?void 0:t.email)??""),[S,F]=l.useState((t==null?void 0:t.avatarUrl)??""),[D,H]=l.useState(!1),[W,G]=l.useState(null),[$,K]=l.useState(!1),[de,ie]=l.useState(null),[we,he]=l.useState(!1),[Ae,Fe]=l.useState(null),[U,V]=l.useState("received"),[z,O]=l.useState("idle"),[q,X]=l.useState(0),[Z,Q]=l.useState(null),oe=l.useRef(null),{onBuyChips:ce,onGoPremium:_e,onRestore:re,busy:pe,busyChips:ee,ready:xe,isWeb:Le,premiumActive:Ge,hasPremiumPackage:_t,premiumLabel:Xe,premiumSubtitle:bt,premiumDescription:Pt,premiumPrice:kt,premiumInterval:Ee}=kp(),[le,De]=l.useState(!!(t!=null&&t.botChatDisabled)),[Ye,Re]=l.useState((t==null?void 0:t.ceeloBotsPerRoom)??null),[et,rt]=l.useState((t==null?void 0:t.crapsBotsPerRoom)??null),[ne,ue]=l.useState((t==null?void 0:t.pokerBotsPerRoom)??null),[B,fe]=l.useState((t==null?void 0:t.sex)??""),[ye,ve]=l.useState((t==null?void 0:t.location)??""),[ke,Ue]=l.useState((t==null?void 0:t.age)!=null?String(t.age):""),[ct,dt]=l.useState((t==null?void 0:t.interests)??""),[Rt,jr]=l.useState((t==null?void 0:t.aboutMe)??"");l.useEffect(()=>{I((t==null?void 0:t.name)??""),N((t==null?void 0:t.email)??""),F((t==null?void 0:t.avatarUrl)??""),De(!!(t!=null&&t.botChatDisabled)),Re((t==null?void 0:t.ceeloBotsPerRoom)??null),rt((t==null?void 0:t.crapsBotsPerRoom)??null),ue((t==null?void 0:t.pokerBotsPerRoom)??null),fe((t==null?void 0:t.sex)??""),ve((t==null?void 0:t.location)??""),Ue((t==null?void 0:t.age)!=null?String(t.age):""),dt((t==null?void 0:t.interests)??""),jr((t==null?void 0:t.aboutMe)??"")},[t==null?void 0:t.id,t==null?void 0:t.name,t==null?void 0:t.email,t==null?void 0:t.avatarUrl,t==null?void 0:t.botChatDisabled,t==null?void 0:t.ceeloBotsPerRoom,t==null?void 0:t.crapsBotsPerRoom,t==null?void 0:t.pokerBotsPerRoom,t==null?void 0:t.sex,t==null?void 0:t.location,t==null?void 0:t.age,t==null?void 0:t.interests,t==null?void 0:t.aboutMe]),l.useEffect(()=>{f()},[]);const Qe=l.useCallback(async()=>{H(!0),G(null);try{const Je={};C!==(t==null?void 0:t.name)&&(Je.name=C),L!==(t==null?void 0:t.email)&&(Je.email=L),S!==(t==null?void 0:t.avatarUrl)&&(Je.avatarUrl=S),typeof le=="boolean"&&(Je.botChatDisabled=le);const mt=B.trim()||null;mt!==((t==null?void 0:t.sex)??null)&&(Je.sex=mt);const Te=ye.trim()||null;Te!==((t==null?void 0:t.location)??null)&&(Je.location=Te);const Ve=ke.trim()?Number(ke.trim()):null;Ve!==((t==null?void 0:t.age)??null)&&(Je.age=Ve);const tt=ct.trim()||null;tt!==((t==null?void 0:t.interests)??null)&&(Je.interests=tt);const Et=Rt.trim()||null;Et!==((t==null?void 0:t.aboutMe)??null)&&(Je.aboutMe=Et);const Qt=vc||Zb,or=vc||qc,Ht=vc||Vc;Qt&&Ye!==((t==null?void 0:t.ceeloBotsPerRoom)??null)&&(Je.ceeloBotsPerRoom=Ye),or&&et!==((t==null?void 0:t.crapsBotsPerRoom)??null)&&(Je.crapsBotsPerRoom=et),Ht&&ne!==((t==null?void 0:t.pokerBotsPerRoom)??null)&&(Je.pokerBotsPerRoom=ne);const Lt=await s(Je);if(!(Lt!=null&&Lt.ok))G((Lt==null?void 0:Lt.error)||"Failed to save");else{try{await r({force:!0})}catch{}await f()}}catch(Je){G((Je==null?void 0:Je.message)||"Failed to save")}finally{H(!1)}},[C,L,S,t,s,f,r,Ye,et,ne,le,B,ye,ke,ct,Rt]),Mt=l.useCallback(async Je=>{m(Je)?await b(Je):await h(Je)},[m,h,b]),lr=l.useCallback(Je=>{g(Je)},[g]),zt=l.useCallback(Je=>{e(`/messages?peer=${encodeURIComponent(Je)}`)},[e]),br=l.useCallback(async Je=>{await y(Je.id,"ACCEPT")},[y]);l.useCallback(async Je=>{await y(Je.id,"DECLINE")},[y]);const fr=l.useCallback(async Je=>{K(!0),ie(null);try{if(Je.size>5242880){ie("File size must be less than 5MB");return}if(!["image/jpeg","image/jpg","image/png","image/webp","image/gif"].includes(Je.type)){ie("File must be a valid image (JPEG, PNG, WebP, or GIF)");return}const Ve=new FormData;Ve.append("avatar",Je);const tt=String(Wf??"http://localhost:4000").replace(/\/+$/,"");let Et={},Qt;try{const nr=await Jn();nr&&(Et={Authorization:`Bearer ${nr}`},Qt=nr)}catch{}const or=new URL(`${tt}/api/avatar/upload`);Qt&&or.searchParams.set("token",Qt);const Ht=await fetch(or.toString(),{method:"POST",body:Ve,headers:Et,credentials:"include"});if(!Ht.ok){const nr=await Ht.json().catch(()=>({error:"Upload failed"}));throw new Error(nr.error||`Upload failed with status ${Ht.status}`)}const Lt=await Ht.json();Lt.avatarUrl&&F(Lt.avatarUrl)}catch(mt){console.error("[avatar] upload error:",mt),ie((mt==null?void 0:mt.message)||"Failed to upload avatar")}finally{K(!1)}},[]),ur=l.useCallback(Je=>{var Te;const mt=(Te=Je.target.files)==null?void 0:Te[0];mt&&fr(mt),oe.current&&(oe.current.value="")},[fr]),Ie=l.useCallback(()=>{var Te;if(!((t==null?void 0:t.membershipTier)==="PREMIUM"||c)){try{i(!0)}catch{}return}(Te=oe.current)==null||Te.click()},[t,c,i]),yt=l.useMemo(()=>{const Je=new Map;for(const mt of u)Je.set(mt.id,mt);for(const mt of d)Je.has(mt.id)||Je.set(mt.id,mt);return Je},[u,d]),St=l.useMemo(()=>p.map(Je=>{const mt=(t==null?void 0:t.id)===Je.toUserId,Te=mt?Je.fromUserId:Je.toUserId;if(!Te)return null;const Ve=(mt?Je.fromUser:Je.toUser)||yt.get(Te),tt=(Ve==null?void 0:Ve.name)??Te,Et=(Ve==null?void 0:Ve.avatarUrl)??void 0;return{id:Te,name:tt,avatarUrl:Et,_req:Je,_incoming:mt}}).filter(Boolean),[p,t==null?void 0:t.id,yt]),{showAnimations:Xt,toggleAnimations:se,ready:je}=d1();hO();const[Oe,Ke]=l.useState(Sa.diceColorTheme),[Me,wt]=l.useState(void 0),[at,Dt]=l.useState(Sa.zentaraBotCount??1);l.useEffect(()=>{(async()=>{try{const Je=await ma();Ke(Je.diceColorTheme??Sa.diceColorTheme),wt(Je.botDifficultyLevel),Dt(Je.zentaraBotCount??Sa.zentaraBotCount??1)}catch{Ke(Sa.diceColorTheme)}})()},[]);const Ut=l.useCallback(async Je=>{try{const mt=await ma(),Te={...Sa,...mt,botDifficultyLevel:Je};await $i(Te),wt(Je)}catch{}},[]),ft=l.useCallback(async Je=>{const mt=Math.max(1,Math.min(5,Je));try{const Te=await ma(),Ve={...Sa,...Te,zentaraBotCount:mt};await $i(Ve),Dt(mt)}catch{}},[]),wr=l.useCallback(async Je=>{try{const mt=await ma(),Te={...Sa,...mt,diceColorTheme:Je};await $i(Te),Ke(Je)}catch{}},[]),dr=l.useCallback(()=>i(!1),[i]);l.useEffect(()=>{r()},[]);const Vt=l.useCallback(async()=>{try{if(Fe(null),!window.confirm("Are you sure you want to permanently delete your account? This action cannot be undone."))return;const mt=String(Wf??"http://localhost:4000").replace(/\/+$/,"");let Te;try{const tt=await Jn();tt&&(Te={Authorization:`Bearer ${tt}`})}catch{}const Ve=await fetch(`${mt}/api/account`,{method:"DELETE",credentials:"include",headers:Te});if(!Ve.ok){const tt=await Ve.json().catch(()=>({error:"Deletion failed"}));throw new Error(tt.error||`Failed with status ${Ve.status}`)}console.log("[account-delete] account deleted successfully",Ve)}catch(Je){Fe((Je==null?void 0:Je.message)||"Failed to delete account")}finally{n()}},[e]);return a.jsxs("div",{className:`${No?"theme-zentara":"theme-casino"} home-fixed-root add-chips`,children:[a.jsx(Ja,{className:"profile-page-body"}),a.jsx("div",{className:"logout-container  home-header-row",children:a.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}history.back()},children:[a.jsx(go,{className:"icon"})," Back"]})}),a.jsx("div",{className:"profile-page",children:a.jsx("div",{className:"home-fit-shell",children:a.jsxs("div",{className:"home-fit-content",children:[a.jsx(Nfe,{}),a.jsxs("div",{className:"profile-content",children:[a.jsx("div",{className:"profile-avatar-section",children:a.jsxs("div",{className:"profile-avatar-card",children:[a.jsxs("div",{className:"profile-avatar-header",children:[a.jsx("span",{className:"profile-avatar-label",children:"Avatar"}),a.jsx("span",{className:"profile-avatar-badge",children:"PREMIUM"})]}),a.jsxs("div",{className:"profile-avatar-content",children:[a.jsx("div",{className:"profile-avatar-preview",children:S?a.jsx("img",{src:S,alt:"Avatar preview",className:"profile-avatar-img"}):a.jsx("div",{className:"profile-avatar-placeholder",children:a.jsx("span",{children:"No Avatar"})})}),a.jsxs("div",{className:"profile-avatar-actions",children:[a.jsx("input",{ref:oe,type:"file",accept:"image/jpeg,image/jpg,image/png,image/webp,image/gif",onChange:ur,disabled:$,style:{display:"none"}}),a.jsx("button",{className:"profile-avatar-upload-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}Ie()},disabled:$,children:$?"Uploading...":"Upload Avatar"}),a.jsx("div",{className:"profile-avatar-hint",children:"Max 5MB • JPEG, PNG, WebP, or GIF"}),de&&a.jsxs("div",{className:"error-message",style:{marginTop:"8px"},children:[de,de.includes("Premium")&&a.jsx("div",{style:{marginTop:"8px"},children:a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}_e()},style:{fontSize:"0.9em",padding:"6px 12px"},children:"Upgrade to Premium"})})]})]})]})]})}),a.jsx("div",{className:"profile-section",children:a.jsx(Ffe,{})}),a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Friends:"}),u.length?a.jsx("div",{className:"friends-scroll",children:a.jsx(Lg,{className:"friends-panel",players:u,meId:(t==null?void 0:t.id)||"",onPlayerClick:Je=>{const mt=document.querySelector(`[data-player-id="${Je}"]`),Te=mt==null?void 0:mt.querySelector(".avatar-ring");Te&&E(Je,Te,"friends")},renderActions:Je=>{const mt=x(Je.id);return mt<=0?null:a.jsx("span",{className:"friend-unread-badge","aria-label":`${mt} unread message${mt>1?"s":""}`,children:mt>99?"99+":mt})}})}):a.jsx("span",{children:"No friends yet"})]}),a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Friend Requests:"}),a.jsxs("div",{className:"request-tab-toggle",children:[a.jsx("button",{className:`request-tab-btn${U==="received"?" active":""}`,onClick:()=>V("received"),children:"Received"}),a.jsx("button",{className:`request-tab-btn${U==="sent"?" active":""}`,onClick:()=>V("sent"),children:"Sent"})]}),(()=>{const Je=St.filter(mt=>U==="received"?mt._incoming:!mt._incoming);return Je.length?a.jsx("div",{className:"friends-scroll",children:a.jsx(Lg,{className:"friends-panel",players:Je,meId:(t==null?void 0:t.id)||"",onPlayerClick:mt=>{const Te=document.querySelector(`[data-player-id="${mt}"]`),Ve=Te==null?void 0:Te.querySelector(".avatar-ring"),tt=St.find(Et=>Et.id===mt);Ve&&(tt!=null&&tt._req)&&E(mt,Ve,"requests",{id:tt._req.id,incoming:!!tt._incoming})}})}):a.jsxs("span",{children:["No ",U," requests"]})})()]}),a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Blocked Users:"}),d.length?a.jsx("div",{className:"friends-scroll",children:a.jsx(Lg,{className:"friends-panel",players:d,meId:(t==null?void 0:t.id)||"",onPlayerClick:Je=>{const mt=document.querySelector(`[data-player-id="${Je}"]`),Te=mt==null?void 0:mt.querySelector(".avatar-ring");Te&&E(Je,Te,"blocked")}})}):a.jsx("span",{children:"No blocked users"})]}),v&&A&&T&&a.jsx(Q5,{anchorRect:A,anchorEl:_,onClose:M,onViewProfile:()=>{e(`/player/${v}`),M()},onMessages:T==="friends"?()=>{zt(v),M()}:void 0,onUnfriend:T==="friends"?()=>{lr(v),M()}:void 0,onBlockUser:T!=="requests"?async()=>{await Mt(v),M()}:void 0,isFriend:T==="friends",isBlocked:T==="blocked",...T==="requests"&&(P!=null&&P.incoming)?{onAddFriend:()=>{br({id:P.id}),M()},hideAddFriend:!1}:{}}),a.jsxs("div",{className:"profile-row profile-row--two",children:[a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Name:"}),a.jsx("div",{className:"editable-field",children:a.jsx("input",{type:"text",value:C,onChange:Je=>I(Je.target.value),disabled:D})})]}),a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Email:"}),a.jsx("div",{className:"editable-field",children:a.jsx("input",{type:"email",value:L,onChange:Je=>N(Je.target.value),disabled:D})})]})]}),a.jsxs("div",{className:"profile-row profile-row--two",children:[a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Sex:"}),a.jsx("div",{className:"editable-field",children:a.jsxs("select",{value:B,onChange:Je=>fe(Je.target.value),disabled:D,"aria-label":"Sex",children:[a.jsx("option",{value:"",children:"Prefer not to say"}),a.jsx("option",{value:"Male",children:"Male"}),a.jsx("option",{value:"Female",children:"Female"}),a.jsx("option",{value:"Non-binary",children:"Non-binary"})]})})]}),a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Age:"}),a.jsx("div",{className:"editable-field",children:a.jsxs("select",{value:ke,onChange:Je=>Ue(Je.target.value),disabled:D,"aria-label":"Age",children:[a.jsx("option",{value:"",children:"Prefer not to say"}),Array.from({length:103},(Je,mt)=>mt+18).map(Je=>a.jsx("option",{value:Je,children:Je},Je))]})})]})]}),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Location:"}),a.jsx("div",{className:"editable-field",children:a.jsx("input",{type:"text",value:ye,onChange:Je=>ve(Je.target.value),disabled:D,placeholder:"e.g. Chicago, IL",maxLength:120,"aria-label":"Location"})})]})}),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Interests:"}),a.jsx("div",{className:"editable-field",children:a.jsx("input",{type:"text",value:ct,onChange:Je=>dt(Je.target.value),disabled:D,placeholder:"e.g. Poker, Sports, Music",maxLength:500,"aria-label":"Interests"})})]})}),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"About Me:"}),a.jsx("div",{className:"editable-field",children:a.jsx("textarea",{value:Rt,onChange:Je=>jr(Je.target.value),disabled:D,placeholder:"Tell other players about yourself...",maxLength:500,rows:3,"aria-label":"About Me",style:{resize:"vertical",minHeight:60}})})]})}),(()=>{const Je=vc||Zb,mt=vc||qc,Te=vc||Vc;return a.jsxs(a.Fragment,{children:[(Je||mt)&&a.jsxs("div",{className:"profile-row profile-row--two",children:[Je&&a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Single‑player bots (Cee‑Lo):"}),a.jsxs("div",{className:"editable-field",children:[a.jsxs("select",{value:Ye==null?"":String(Ye),onChange:Ve=>{const tt=Ve.target.value;Re(tt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(tt)))))},disabled:D,"aria-label":"Preferred number of bots in single-player Cee‑Lo rooms",children:[a.jsx("option",{value:"",children:"Default (3 bots)"}),Array.from({length:5}).map((Ve,tt)=>a.jsx("option",{value:tt,children:tt},tt))]}),a.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]}),mt&&a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Single‑player bots (Craps):"}),a.jsxs("div",{className:"editable-field",children:[a.jsxs("select",{value:et==null?"":String(et),onChange:Ve=>{const tt=Ve.target.value;rt(tt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(tt)))))},disabled:D,"aria-label":"Preferred number of bots in single-player Craps rooms",children:[a.jsx("option",{value:"",children:"Default (2 bots)"}),Array.from({length:5}).map((Ve,tt)=>a.jsx("option",{value:tt,children:tt},tt))]}),a.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})]}),Te&&a.jsx("div",{className:"profile-row profile-row--two",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Single‑player bots (Poker):"}),a.jsxs("div",{className:"editable-field",children:[a.jsxs("select",{value:ne==null?"":String(ne),onChange:Ve=>{const tt=Ve.target.value;ue(tt===""?null:Math.max(0,Math.min(8,Math.trunc(Number(tt)))))},disabled:D,"aria-label":"Preferred number of bots in single-player Poker rooms",children:[a.jsx("option",{value:"",children:"Default (3 bots)"}),Array.from({length:5}).map((Ve,tt)=>a.jsx("option",{value:tt,children:tt},tt))]}),a.jsx("div",{className:"subtle",children:"Applies when you create single‑player rooms."})]})]})})]})})(),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Bot Difficulty:"}),a.jsxs("div",{className:"editable-field",children:[(()=>{var Ve;const Je=(()=>{const tt=t;return tt?qc?tt.spLevelCraps??1:Zb?tt.spLevelCeelo??1:Vc?tt.spLevelPoker??1:Math.max(tt.spLevelCeelo??1,tt.spLevelCraps??1,tt.spLevelPoker??1,tt.spLevelSkills??1):1})(),mt=Math.max(1,Math.min(9,Je)),Te=((Ve=ul.find(tt=>tt.level===mt))==null?void 0:Ve.name)??`Level ${mt}`;return a.jsxs("select",{value:Me??"",onChange:tt=>{const Et=tt.target.value;Ut(Et===""?void 0:Number(Et))},"aria-label":"Bot difficulty level for single-player games",children:[a.jsxs("option",{value:"",children:["Default — ",mt,". ",Te]}),ul.map(tt=>{const Et=tt.level>mt;return a.jsxs("option",{value:tt.level,disabled:Et,children:[Et?"🔒 ":"",tt.level,". ",tt.name,Et?" (locked)":""]},tt.level)})]})})(),a.jsx("div",{className:"subtle",children:"Controls bot difficulty in all single-player games."})]})]})}),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Zentara Opponents:"}),a.jsxs("div",{className:"editable-field",children:[a.jsx("select",{value:at,onChange:Je=>ft(Number(Je.target.value)),"aria-label":"Number of bot opponents in Zentara singleplayer",children:[1,2,3,4,5].map(Je=>a.jsxs("option",{value:Je,children:[Je," bot",Je>1?"s":""]},Je))}),a.jsx("div",{className:"subtle",children:"Default bot opponents for Zentara singleplayer (1–5)."})]})]})}),a.jsx("div",{className:"profile-row",children:a.jsx("div",{className:"profile-section",children:a.jsxs("div",{className:"editable-field",children:[a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}Qe()},disabled:D,children:D?"Saving...":"Save Profile"}),W&&a.jsx("div",{className:"error-message",children:W})]})})}),a.jsxs("div",{className:"profile-row profile-row--two",children:[a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Animations:"}),a.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:8},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[a.jsx("input",{type:"checkbox",disabled:!je,checked:!!Xt,onChange:()=>se(),"aria-label":Xt?"Disable animations (dice physics, chip flights, background shake)":"Enable animations (dice physics, chip flights, background shake)"}),a.jsx("span",{children:Xt?"Enabled":"Disabled"})]}),a.jsx("div",{className:"subtle",style:{opacity:.7},children:Xt?"Full motion effects active.":"Reduced motion: static dice & suppressed decorative effects."})]})]}),a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Dice Color (Cee‑Lo & Craps):"}),a.jsxs("div",{className:"editable-field",style:{display:"flex",alignItems:"center",gap:12,flexWrap:"wrap"},children:[a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[a.jsx("input",{type:"radio",name:"dice-color",value:"dice_red_white",checked:Oe==="dice_red_white",onChange:()=>wr("dice_red_white"),"aria-label":"Use red/white dice"}),a.jsx("span",{children:"Red/White"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[a.jsx("input",{type:"radio",name:"dice-color",value:"dice_green_gold",checked:Oe==="dice_green_gold",onChange:()=>wr("dice_green_gold"),"aria-label":"Use green/gold dice"}),a.jsx("span",{children:"Green/Gold"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[a.jsx("input",{type:"radio",name:"dice-color",value:"dice_white_black",checked:Oe==="dice_white_black",onChange:()=>wr("dice_white_black"),"aria-label":"Use white/black dice (default)"}),a.jsx("span",{children:"White/Black"})]}),a.jsxs("label",{style:{display:"flex",alignItems:"center",gap:6,fontSize:13},children:[a.jsx("input",{type:"radio",name:"dice-color",value:"dice_blue_silver",checked:Oe==="dice_blue_silver",onChange:()=>wr("dice_blue_silver"),"aria-label":"Use blue/silver dice"}),a.jsx("span",{children:"Blue/Silver"})]})]})]})]}),!No&&a.jsx("div",{className:"profile-row profile-row--two",children:a.jsxs("div",{className:"profile-section",children:[a.jsxs("strong",{children:["Balance: ",ki.formatMoney(t==null?void 0:t.balance,"",2)]}),a.jsx("div",{className:"editable-field",children:a.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{ce()}catch{}},disabled:D||pe||!xe||!1,"aria-label":Le?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",title:Le?"Buy 1000 Z Credits":"Buy 1000 Z Credits (App Store / Play)",children:ee?"Purchasing...":"Buy Credits"})}),a.jsx("strong",{children:"Restore:"}),a.jsx("div",{className:"editable-field",children:a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{re()}catch{}},disabled:pe||!xe||!1,title:"Restore Purchases","aria-label":"Restore Purchases",children:"Restore"})})]})}),a.jsx("div",{className:"profile-row profile-row--two",children:a.jsxs("div",{className:"profile-section",children:[a.jsxs("strong",{children:["Membership:                                         ",(t==null?void 0:t.membershipTier)===Dg.PREMIUM?"Premium Active":"Free",a.jsx("span",{className:"badge","aria-live":"polite",children:(t==null?void 0:t.membershipTier)===Dg.PREMIUM?"P":""})]}),a.jsxs("div",{className:"editable-field",children:[(t==null?void 0:t.membershipTier)===Dg.PREMIUM?a.jsx(gA,{isPremium:!0,className:"felt-btn"}):_t&&a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}try{_e()}catch{}},disabled:pe,"aria-label":Xe,title:Xe,children:"Go Premium"}),!Ge&&_t&&a.jsx("div",{className:"meta",style:{marginTop:6},children:(()=>{const Je="$1.99",mt="Monthly",Te=kt||Je,Ve=Ee||mt,tt=bt||`${Te} Mo`,Et=Pt||"Remove ads and unlock premium features.";return a.jsxs(a.Fragment,{children:[tt&&a.jsx("div",{className:"subtle","aria-hidden":!0,children:tt}),a.jsx("div",{className:"legal-note","aria-hidden":!0,children:Et}),a.jsxs("div",{className:"legal-note",role:"note",children:[a.jsx("strong",{children:"Premium Subscription"})," — ",Te," (",Ve,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",a.jsx(Xs,{to:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",a.jsx(Xs,{to:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})})()})]})]})}),a.jsx(Ufe,{}),zr.isNativePlatform()&&a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Software Update:"}),a.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,disabled:z==="checking"||z==="downloading"||z==="applying",onClick:async()=>{try{cr("Light")}catch{}O("checking"),Q(null),X(0);try{const Je=await ys.checkForUpdate({force:!0});if(Je.available&&Je.release){O("downloading");const{blob:mt}=await ys.downloadUpdate(Je.release,Te=>{X(Te.percent??0)});O("applying"),await ys.applyUpdate(Je.release,mt),setTimeout(()=>{try{window.location.reload()}catch{}},500)}else O("up-to-date")}catch(Je){O("error"),Q((Je==null?void 0:Je.message)||"Update failed")}},"aria-label":"Check for Updates",title:"Check for Updates",children:z==="checking"?"Checking…":z==="downloading"?`Downloading… ${q}%`:z==="applying"?"Installing…":z==="up-to-date"?"Up to Date ✓":"Check for Updates"}),z==="error"&&Z&&a.jsx("div",{className:"error-message",children:Z})]})]})}),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Session:"}),a.jsx("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",gap:8},children:a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}n(),e("/lobby")},"aria-label":"Log Out",title:"Log Out",children:"Log Out"})})]})}),a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Account:"}),a.jsxs("div",{className:"editable-field",style:{display:"flex",flexDirection:"column",gap:8},children:[a.jsx("div",{className:"legal-note",children:"Deleting your account is permanent and cannot be undone."}),a.jsx("button",{className:"felt-btn felt-btn--danger","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}Vt()},disabled:we,"aria-label":"Delete Account",title:"Delete Account",children:we?"Deleting…":"Delete Account"}),Ae&&a.jsx("div",{className:"error-message",children:Ae})]})]})})]})]})})}),a.jsx(kM,{open:o,onClose:dr,planId:t==null?void 0:t.membershipTier,featureDescription:"Upload custom avatars and create multiplayer rooms with Premium membership."}),a.jsx(Gc,{})]})}const bR=[{key:"ceelo",name:"Cee-Lo Lounge",tagline:"Street dice with style",icon:Lfe,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:Dfe,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:Ofe,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:zfe,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:Bfe,android:"https://play.google.com/store/apps/details?id=com.zentaraone.zentara",ios:"https://apps.apple.com/br/app/zentara-galaxy-conquest/id6761544336"}];function Ufe(){const e=(()=>{try{return zr.isNativePlatform()}catch{return!1}})(),t=(()=>{try{return zr.getPlatform()}catch{return"web"}})(),r=bR.filter(o=>o.key!==Oa),n=vc?bR:r;if(n.length===0)return null;const s=o=>t==="ios"?o.ios:o.android;return a.jsx("div",{className:"profile-row",children:a.jsxs("div",{className:"profile-section",children:[a.jsx("strong",{children:"Our Other Apps"}),a.jsx("div",{className:"other-apps-grid",children:n.map(o=>{const i=s(o);return a.jsxs("a",{className:"other-app-card",href:i||"#",target:"_blank",rel:"noopener noreferrer","aria-label":`Get ${o.name}`,...i?{}:{"aria-disabled":"true",onClick:c=>c.preventDefault()},children:[a.jsx("img",{className:"other-app-icon",src:o.icon,alt:`${o.name} icon`,width:56,height:56,loading:"lazy"}),a.jsxs("div",{className:"other-app-info",children:[a.jsx("div",{className:"other-app-name",children:o.name}),a.jsx("div",{className:"other-app-tagline",children:o.tagline})]}),a.jsx("span",{className:"other-app-cta",children:i?e?"Get":"View":"Soon"})]},o.key)})})]})})}function _u(){const{playerId:e}=hp(),t=Hr(),r=Na(),{user:n}=Zr(),{friends:s,friendRequests:o,blockedUsers:i,addFriend:c}=sc(),[u,p]=l.useState(null),[d,f]=l.useState(!0),[m,h]=l.useState(null),[b,g]=l.useState(!1),[y,x]=l.useState(!1),v=(n==null?void 0:n.id)===e,A=s.some(M=>M.id===e),_=o.some(M=>(M.fromUserId===e||M.toUserId===e)&&M.status==="PENDING"),w=i.some(M=>M.id===e),j=l.useCallback(()=>{window.history.length>1?t(-1):t("/")},[t]);l.useEffect(()=>{if(!r||!e)return;let M=!1;return f(!0),h(null),r.emit("social:get_profile",{playerId:e},C=>{M||(f(!1),C.ok&&C.player?p(C.player):h(C.error||"Player not found"))}),()=>{M=!0}},[r,e]);const T=l.useCallback(async()=>{if(!(!e||A||_||w||b||y||u!=null&&u.isBot)){x(!0);try{await c(e),g(!0)}catch{g(!1)}finally{x(!1)}}},[e,A,_,w,b,y,c,u==null?void 0:u.isBot]),R=l.useCallback(()=>{e&&t(`/messages?peer=${encodeURIComponent(e)}`)},[e,t]);if(d)return a.jsxs("div",{className:`${Cd?"theme-zentara":"theme-casino"} home-fixed-root`,children:[a.jsx(Ja,{className:"profile-page-body"}),a.jsx("div",{className:"logout-container home-header-row",children:a.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}j()},children:[a.jsx(go,{className:"icon"})," Back"]})}),a.jsx("div",{className:"profile-page",children:a.jsx("div",{className:"home-fit-shell",children:a.jsx("div",{className:"home-fit-content",children:a.jsx("div",{className:"player-profile-loading",children:"Loading profile…"})})})}),a.jsx(Gc,{})]});if(m||!u)return a.jsxs("div",{className:`${Cd?"theme-zentara":"theme-casino"} home-fixed-root`,children:[a.jsx(Ja,{className:"profile-page-body"}),a.jsx("div",{className:"logout-container home-header-row",children:a.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}j()},children:[a.jsx(go,{className:"icon"})," Back"]})}),a.jsx("div",{className:"profile-page",children:a.jsx("div",{className:"home-fit-shell",children:a.jsx("div",{className:"home-fit-content",children:a.jsx("div",{className:"player-profile-error",children:m||"Player not found"})})})}),a.jsx(Gc,{})]});const P=u.isBot===!0,k=v||P?null:A?"Friends":_||b?"Pending":w?"Blocked":y?"Sending…":"Add Friend",E=v||P||A||_||w||b||y;return a.jsxs("div",{className:`${Cd?"theme-zentara":"theme-casino"} home-fixed-root add-chips`,children:[a.jsx(Ja,{className:"profile-page-body"}),a.jsx("div",{className:"logout-container home-header-row",children:a.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}j()},children:[a.jsx(go,{className:"icon"})," Back"]})}),a.jsx("div",{className:"profile-page",children:a.jsx("div",{className:"home-fit-shell",children:a.jsx("div",{className:"home-fit-content",children:a.jsxs("div",{className:"profile-content",children:[a.jsxs("div",{className:"pp-header-card",children:[a.jsx("div",{className:"pp-avatar",children:u.avatarUrl?a.jsx("img",{src:u.avatarUrl,alt:u.name||"Player",className:"pp-avatar-img"}):a.jsx("div",{className:"pp-avatar-placeholder",children:(u.name||"?")[0].toUpperCase()})}),a.jsxs("div",{className:"pp-header-info",children:[a.jsxs("h2",{className:"pp-name",children:[u.name||"Anonymous",P&&a.jsx("span",{className:"pp-bot-badge",children:"Bot"})]}),a.jsxs("div",{className:"pp-meta-row",children:[u.age&&a.jsxs("span",{className:"pp-meta-tag",children:[u.age," yrs"]}),u.sex&&a.jsx("span",{className:"pp-meta-tag",children:u.sex}),u.location&&a.jsx("span",{className:"pp-meta-tag",children:u.location})]})]})]}),!v&&!P&&a.jsxs("div",{className:"pp-actions",children:[k&&a.jsx("button",{className:"felt-btn pp-action-btn",onClick:()=>{try{cr("Light")}catch{}T()},disabled:E,children:k}),A&&a.jsx("button",{className:"felt-btn pp-action-btn",onClick:()=>{try{cr("Light")}catch{}R()},children:"Message"})]}),u.aboutMe&&a.jsxs("div",{className:"pp-section",children:[a.jsx("h3",{className:"pp-section-title",children:"About"}),a.jsx("p",{className:"pp-section-body",children:u.aboutMe})]}),u.interests&&a.jsxs("div",{className:"pp-section",children:[a.jsx("h3",{className:"pp-section-title",children:"Interests"}),a.jsx("div",{className:"pp-interests",children:u.interests.split(/[,;]+/).map(M=>M.trim()).filter(Boolean).map((M,C)=>a.jsx("span",{className:"pp-interest-tag",children:M},C))})]})]})})})}),a.jsx(Gc,{})]})}function qfe(e){var o,i;if(!e)return"?";const r=e.split("@")[0].trim().split(/[\s._-]+/).filter(Boolean),n=(((o=r[0])==null?void 0:o[0])??"").toUpperCase(),s=(((i=r[1])==null?void 0:i[0])??"").toUpperCase();return n+s||n||"?"}function wu(){const e=Hr(),[t]=gp(),{user:r}=Zr(),n=(r==null?void 0:r.id)??(r==null?void 0:r.email)??"",{friends:s}=sc(),{getDmSummary:o,sendDmMessage:i,markDmRead:c,setActiveDm:u,threads:p,loadDmHistory:d}=Dm(),[f,m]=l.useState(null),[h,b]=l.useState(""),g=l.useRef(null),y=l.useRef(null),x=l.useRef(!1);l.useEffect(()=>{if(x.current)return;x.current=!0;const E=t.get("peer");if(E){m(E),u(E),d(E),e("/messages",{replace:!0});return}const M=o(),C=M==null?void 0:M.find(L=>L.unread>0);let I=null;C?I=C.peerUserId:s.length&&(I=s[0].id),I&&(m(I),u(I),d(I))},[s,o,u,d,t,e]),l.useEffect(()=>{f&&y.current!==f&&(y.current=f,c(f))},[f,c]);const v=l.useMemo(()=>f?(p==null?void 0:p[ao(f,n)])??[]:[],[f,p,n]),A=l.useMemo(()=>o()??[],[o,v.length]),_=l.useMemo(()=>{const E=new Map;return A.forEach(M=>E.set(M.peerUserId,M)),E},[A]);l.useEffect(()=>{g.current&&(g.current.scrollTop=g.current.scrollHeight)},[v.length,f]);const w=l.useCallback(E=>{m(E),u(E),c(E),d(E)},[u,c,d]),j=l.useCallback(()=>{if(!f)return;const E=h.trim();if(!E)return;i(f,E)&&b("")},[f,h,i]),T=E=>{E.key==="Enter"&&!E.shiftKey&&(E.preventDefault(),j())},R=l.useCallback(E=>{const M=s.find(C=>C.id===E);return(M==null?void 0:M.name)||E},[s]),P=l.useCallback(E=>{const M=_.get(E);return M!=null&&M.last?((M.last.senderId===n?"You: ":"")+M.last.text).trim():""},[_,n]),k=l.useCallback(()=>{try{cr("Light")}catch{}e(-1)},[e]);return a.jsxs("div",{className:`${Cd?"theme-zentara":"theme-casino"} home-fixed-root messages-page`,children:[a.jsx(Ja,{className:"messages-page-body"}),a.jsx("div",{className:"logout-container  home-header-row",children:a.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:k,children:[a.jsx(go,{className:"icon"})," Back"]})}),a.jsxs("div",{className:"messages-container",children:[a.jsxs("div",{className:"messages-thread-list",children:[s.length===0&&a.jsx("div",{className:"messages-no-friends",children:"Add friends from your Profile to start messaging."}),s.map(E=>{var N;const M=E.id===f,C=qfe(E.name||E.id),I=((N=_.get(E.id))==null?void 0:N.unread)??0,L=P(E.id);return a.jsxs("button",{onClick:()=>w(E.id),className:`messages-thread-btn ${M?"messages-thread-btn--active":""}`,title:R(E.id),children:[a.jsx("div",{className:"messages-avatar","aria-hidden":!0,children:C}),a.jsxs("div",{className:"messages-thread-label",children:[a.jsx("div",{className:"messages-thread-name",children:R(E.id)}),a.jsx("div",{className:"messages-thread-preview",children:L})]}),I>0&&a.jsx("span",{"aria-label":`${I} unread`,className:"messages-unread-badge",children:I>99?"99+":I})]},E.id)})]}),a.jsxs("div",{className:"messages-active-thread",children:[a.jsxs("div",{ref:g,className:"messages-scroller",children:[!f&&a.jsx("div",{className:"messages-empty",children:"Select a conversation to begin."}),f&&v.length===0&&a.jsx("div",{className:"messages-empty",children:"No messages yet. Say hello!"}),f&&v.length>0&&v.map(E=>{const M=E.senderId===n,C=new Date(E.ts),I=C.toLocaleTimeString([],{hour:"numeric",minute:"2-digit"});return a.jsxs("div",{className:`messages-message ${M?"messages-message--mine":""}`,title:C.toLocaleString(),children:[a.jsx("div",{className:"messages-message-content",children:E.text}),a.jsx("div",{className:"messages-message-time",children:I}),E.pending&&a.jsx("div",{className:"messages-pending",children:"sending…"}),E.error&&a.jsx("div",{className:"messages-error",children:E.error})]},E.id)})]}),a.jsxs("div",{className:"messages-composer",children:[a.jsx("input",{value:h,onChange:E=>b(E.target.value),onKeyDown:T,placeholder:f?`Message ${R(f)}…`:"Pick a conversation…",disabled:!f,className:"messages-composer-input"}),a.jsx("button",{onClick:j,disabled:!f||h.trim()==="",className:`messages-composer-send ${!f||h.trim()===""?"messages-composer-send--disabled":""}`,children:"Send"})]})]})]}),a.jsx(Gc,{})]})}const Vfe=Array.from({length:30},(e,t)=>({width:t%3===0?3:2,height:t%3===0?3:2,opacity:.1+t%5*.06,left:`${(t*137+50)%100}%`,top:`${(t*251+30)%100}%`}));function xu(){const e=Hr(),{logout:t}=Zr(),[r,n]=l.useState(Sa),[s,o]=l.useState(!1),i=l.useRef(null);l.useEffect(()=>{let p=!0;return(async()=>{const d=await ma();p&&(n(d),o(!0))})(),()=>{p=!1,i.current&&window.clearTimeout(i.current)}},[]),l.useEffect(()=>{s&&(i.current&&window.clearTimeout(i.current),i.current=window.setTimeout(()=>{$i(r).catch(()=>{})},200))},[r,s]);const c=p=>n(d=>({...d,[p]:!d[p]})),u=()=>{try{cr("Light")}catch{}t(),e("/lobby")};return Cd?a.jsxs("div",{className:"zentara-settings",children:[a.jsx("div",{className:"zentara-settings__stars",children:Vfe.map((p,d)=>a.jsx("div",{className:"zentara-settings__star",style:{width:p.width,height:p.height,opacity:p.opacity,left:p.left,top:p.top}},d))}),a.jsxs("div",{className:"zentara-settings__content",children:[a.jsxs("button",{className:"zentara-settings__back",onClick:()=>history.back(),children:[a.jsx("img",{src:"/icons/arrow-left.svg",alt:"","aria-hidden":!0,className:"icon"}),"Back"]}),a.jsx("h1",{className:"zentara-settings__title",children:"Settings"}),[["diceAudio","Dice Audio"],["backgroundMusic","Background Music"],["chatAudio","Chat Audio"],["video","Video"]].map(([p,d])=>a.jsxs("div",{className:"zentara-settings__card",children:[a.jsx("span",{className:"zentara-settings__label",children:d}),a.jsxs("label",{className:"zentara-settings__toggle",children:[a.jsx("input",{type:"checkbox",checked:!!r[p],onChange:()=>c(p),disabled:!s}),a.jsx("span",{className:"zentara-settings__toggle-track"})]})]},p)),a.jsx("div",{className:"zentara-settings__divider"}),a.jsxs("div",{className:"zentara-settings__card",children:[a.jsxs("div",{children:[a.jsx("span",{className:"zentara-settings__label",children:"Opponents"}),a.jsx("div",{className:"zentara-settings__hint",children:"Bots in singleplayer (1–5)"})]}),a.jsx("select",{className:"zentara-settings__select",value:r.zentaraBotCount??1,onChange:p=>n(d=>({...d,zentaraBotCount:Number(p.target.value)})),disabled:!s,"aria-label":"Number of bot opponents in Zentara singleplayer",children:[1,2,3,4,5].map(p=>a.jsxs("option",{value:p,children:[p," bot",p>1?"s":""]},p))})]}),a.jsx("div",{className:"zentara-settings__divider"}),[["zentaraDisableRaid","Disable Resource Raid"],["zentaraDisableSpyStrike","Disable Spy Strike"]].map(([p,d])=>a.jsxs("div",{className:"zentara-settings__card",children:[a.jsx("span",{className:"zentara-settings__label",children:d}),a.jsxs("label",{className:"zentara-settings__toggle",children:[a.jsx("input",{type:"checkbox",checked:!!r[p],onChange:()=>c(p),disabled:!s}),a.jsx("span",{className:"zentara-settings__toggle-track"})]})]},p)),a.jsx("div",{className:"zentara-settings__divider"}),a.jsx("button",{className:"zentara-settings__logout","data-no-global-haptic":!0,onClick:u,"aria-label":"Log Out",children:"Log Out"})]})]}):a.jsxs("div",{className:"settings-page",children:[a.jsxs("a",{className:"gold-link white-link",onClick:()=>history.back(),children:[a.jsx("img",{src:"/icons/arrow-left.svg",alt:"","aria-hidden":!0,className:"icon"})," Back"]}),a.jsx("div",{className:"settings-section",children:a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:r.diceAudio,onChange:()=>c("diceAudio"),disabled:!s}),"Dice Audio"]})}),a.jsx("div",{className:"settings-section",children:a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:r.backgroundMusic,onChange:()=>c("backgroundMusic"),disabled:!s}),"Background Music"]})}),a.jsx("div",{className:"settings-section",children:a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:r.chatAudio,onChange:()=>c("chatAudio"),disabled:!s}),"In-Room Chat Audio"]})}),a.jsx("div",{className:"settings-section",children:a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:r.video,onChange:()=>c("video"),disabled:!s}),"Video"]})}),a.jsxs("div",{className:"settings-section",children:[a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:r.showCelebrationImages!==!1,onChange:()=>c("showCelebrationImages"),disabled:!s}),"Celebration Images"]}),a.jsx("span",{className:"settings-section__hint",children:"Show full-screen win/loss artwork in Cee Lo and Craps."})]}),a.jsxs("div",{className:"settings-section",children:[a.jsx("label",{children:"Zentara Opponents"}),a.jsx("select",{value:r.zentaraBotCount??1,onChange:p=>n(d=>({...d,zentaraBotCount:Number(p.target.value)})),disabled:!s,"aria-label":"Number of bot opponents in Zentara singleplayer",style:{marginLeft:8,padding:"4px 8px",borderRadius:6},children:[1,2,3,4,5].map(p=>a.jsxs("option",{value:p,children:[p," bot",p>1?"s":""]},p))})]}),a.jsx("div",{className:"settings-section",children:a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:!!r.zentaraDisableRaid,onChange:()=>c("zentaraDisableRaid"),disabled:!s}),"Zentara: Disable Resource Raid"]})}),a.jsx("div",{className:"settings-section",children:a.jsxs("label",{children:[a.jsx("input",{type:"checkbox",checked:!!r.zentaraDisableSpyStrike,onChange:()=>c("zentaraDisableSpyStrike"),disabled:!s}),"Zentara: Disable Spy Strike"]})}),a.jsx("div",{className:"settings-section",style:{marginTop:24},children:a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:u,"aria-label":"Log Out",title:"Log Out",children:"Log Out"})})]})}const gO=za();async function Hfe(){try{const e=await Jn(),t=await fetch(`${gO}/api/ad-reward`,{method:"POST",headers:{"Content-Type":"application/json",...e?{Authorization:`Bearer ${e}`}:{}},credentials:"include"});if(!t.ok){const n=await t.json();return{ok:!1,error:n.error,retryInMs:n.retryInMs}}return{ok:!0,balance:(await t.json()).balance}}catch(e){return console.error("Error claiming ad reward:",e),{ok:!1,error:"NETWORK_ERROR"}}}async function Wfe(){try{const e=await Jn(),t=await fetch(`${gO}/api/ad-reward/status`,{method:"GET",headers:{"Content-Type":"application/json",...e?{Authorization:`Bearer ${e}`}:{}},credentials:"include"});return t.ok?{ok:!0,nextAt:(await t.json()).nextAt}:{ok:!1,error:(await t.json()).error,nextAt:null}}catch(e){return console.error("Error fetching ad reward cooldown:",e),{ok:!1,error:"NETWORK_ERROR",nextAt:null}}}const vR={claimAdReward:Hfe,getAdRewardCooldown:Wfe};function Au(){const{busy:e,busyChips:t,ready:r,error:n,premiumActive:s,hasPremiumPackage:o,premiumLabel:i,isWeb:c,onBuyChips:u,onGoPremium:p,onRestore:d,chipsSubtitle:f,premiumSubtitle:m,chipsDescription:h,premiumDescription:b,premiumPrice:g,premiumInterval:y}=kp(),{refreshUser:x}=Zr(),{infoNow:v}=As(),[A,_]=l.useState(!1),[w,j]=l.useState(0),[T,R]=l.useState(()=>Date.now()),P=Math.max(0,w-T),k=P>0,E=p_.isNativeAdSupported(),M=!s&&E&&!vm,C=l.useCallback(Fe=>{const U=Math.ceil(Fe/1e3),V=Math.floor(U/60),z=U%60;return`${V}m ${z}s`},[]);l.useEffect(()=>{M&&(async()=>{try{const Fe=await vR.getAdRewardCooldown();Fe!=null&&Fe.ok&&Fe.nextAt&&Fe.nextAt>Date.now()&&j(Fe.nextAt)}catch(Fe){console.error("[AddChips] Failed to fetch ad cooldown:",Fe)}})()},[M]),l.useEffect(()=>{!M||k||p_.prepareRewardedAd().catch(()=>{})},[M,k]),l.useEffect(()=>{if(!k)return;const Fe=setInterval(()=>R(Date.now()),1e3);return()=>clearInterval(Fe)},[k]);const I=l.useCallback(async()=>{if(!(A||k||!M)){cr("Light"),_(!0);try{const Fe=await p_.showRewardedAd();if(!Fe.ok){Fe.error==="AD_DISMISSED"?v==null||v("Ad skipped - watch the full ad to earn credits!"):v==null||v(`Ad unavailable: ${Fe.error}`),_(!1);return}const U=await vR.claimAdReward();if(U.ok){const V=dS*60*1e3;j(Date.now()+V),v==null||v(No?`+${bl} Z Credits added to your fleet!`:`+${bl} Z Credits earned!`);try{x()}catch{}}else if(U.error==="COOLDOWN_ACTIVE"){const V=U.retryInMs??dS*60*1e3;j(Date.now()+V),v==null||v("Please wait before watching another ad.")}else v==null||v(`Reward failed: ${U.error}`)}catch(Fe){console.error("[AddChips] Watch ad error:",Fe),v==null||v("Something went wrong. Please try again.")}finally{_(!1)}}},[A,k,M,v,x]),L="$1.99",N="Monthly",S=g||L,F=y||N,D=m||`${S} Mo`,H=b||"Remove ads and unlock premium features.",W="$1.99 for 1,000 Zentara Credits",G="Buy Zentara Credits to keep playing.",$=f||W,K=h||G,de=()=>{try{cr("Light")}catch{}try{u()}catch{}},ie=()=>{try{cr("Light")}catch{}try{p()}catch{}},we=()=>{try{cr("Light")}catch{}try{d()}catch{}},he=!s&&(o||!c),Ae=o||!c;return a.jsxs("div",{className:`${Cd?"theme-zentara":"theme-casino"} home-fixed-root add-chips`,children:[a.jsx(Ja,{className:"profile-page-body"}),a.jsx("div",{className:"logout-container  home-header-row",children:a.jsxs("a",{className:"gold-link white-link gold-link--mini","data-no-global-haptic":!0,onClick:()=>{try{cr("Light")}catch{}history.back()},children:[a.jsx(go,{className:"icon"})," Back"]})}),a.jsx("div",{className:"home-fit-shell",children:a.jsxs("div",{className:"home-fit-content",children:[n&&a.jsx("div",{className:"error-message",role:"alert",children:n}),!n&&r&&!1,a.jsxs("div",{className:"home-action-buttons",children:[M&&a.jsxs("div",{className:"outline-action-btn-wrapper",children:[a.jsx("button",{className:"felt-btn felt-btn--secondary","data-no-global-haptic":!0,onClick:I,disabled:A||k,"aria-label":`Watch ad for ${bl} free credits`,title:`Watch ad for ${bl} free credits`,style:No?{background:"linear-gradient(135deg, #0d1b2a 0%, #0a1628 100%)",borderColor:"#00e5ff",color:"#00e5ff",fontFamily:"Orbitron, monospace"}:{background:"linear-gradient(135deg, #2d5a2d 0%, #1a3d1a 100%)",borderColor:"#4a8f4a"},children:A?"Loading Ad…":k?`Available in ${C(P)}`:No?`📡 WATCH AD → +${bl} Z CREDITS`:`🎬 WATCH AD → +${bl}`}),a.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[a.jsxs("div",{className:"subtle","aria-hidden":!0,children:["Free ",bl," Z Credits"]}),a.jsx("div",{className:"hint","aria-hidden":!0,children:No?"Watch a short video to earn free Z Credits!":"Watch a short video to earn free credits!"})]})]}),!No&&a.jsxs("div",{className:"outline-action-btn-wrapper",children:[a.jsx("button",{className:"felt-btn felt-btn--halo","data-no-global-haptic":!0,onClick:de,disabled:e||!r||!1,"aria-label":"Buy 1000 Z Credits",title:"Buy 1000 Z Credits",children:t?"Purchasing…":"BUY Z CREDITS"}),a.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[a.jsx("div",{className:"subtle","aria-hidden":!0,children:$}),a.jsx("div",{className:"hint","aria-hidden":!0,children:K})]})]}),a.jsxs("div",{className:"outline-action-btn-wrapper",children:[he&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:ie,disabled:e,"aria-label":i,title:i,children:"GO PREMIUM"}),a.jsxs("div",{className:"meta",style:{marginTop:6,textAlign:"center"},children:[D&&a.jsx("div",{className:"subtle","aria-hidden":!0,children:D}),a.jsx("div",{className:"hint","aria-hidden":!0,children:H}),a.jsxs("div",{className:"legal-note",role:"note",style:{marginTop:8,fontSize:12,opacity:.85},children:[a.jsx("strong",{children:"Premium Subscription"})," — ",S," (",F,"). Auto‑renews until canceled. Manage or cancel in account settings on your device. See our ",a.jsx(Xs,{to:"/privacy",className:"legal-link",children:"Privacy Policy"})," and ",a.jsx(Xs,{to:"/terms",className:"legal-link",children:"Terms of Use"}),"."]})]})]}),s&&a.jsx("div",{style:{textAlign:"center"},children:a.jsx(gA,{isPremium:!0})})]}),Ae&&a.jsx("div",{className:"outline-action-btn-wrapper",children:a.jsxs("button",{className:"felt-btn","data-no-global-haptic":!0,onClick:we,disabled:e||!r||!1,"aria-label":"Restore Purchases",title:"Restore Purchases",children:["RESTORE",a.jsx("br",{}),"PURCHASES"]})})]})]})}),a.jsx(Gc,{})]})}function g1({open:e,onClose:t,title:r="Error",message:n}){return mI(!!e),l.useEffect(()=>{const s=o=>{o.key==="Escape"&&t()};return e&&document.addEventListener("keydown",s),()=>document.removeEventListener("keydown",s)},[e,t]),e?a.jsx("div",{className:"modal-backdrop",role:"presentation",onClick:t,children:a.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":r,onClick:s=>s.stopPropagation(),children:[a.jsx("button",{className:"modal-close",onClick:t,"aria-label":"Close",children:"×"}),a.jsx("h3",{className:"modal-title",children:r}),a.jsx("p",{className:"modal-subtitle",role:"alert",children:n}),a.jsx("div",{style:{display:"flex",justifyContent:"flex-end",gap:8,marginTop:12},children:a.jsx("button",{className:"btn close-btn",onClick:t,"aria-label":"Close",children:"Close"})})]})}):null}function ku(){const[e,t]=l.useState("verifying"),r=Hr(),{refreshUser:n}=Zr();l.useEffect(()=>{(async()=>{const c=new URLSearchParams(window.location.search).get("token");if(!c)return t("error");try{const u=await v6(c);if(u!=null&&u.success){u.token&&await Jc(u.token);try{await n({force:!0})}catch{}try{setTimeout(()=>{n({force:!0}).catch(()=>{})},400)}catch{}if(await Jy()){t("success");return}t("success")}else t("error")}catch{t("error")}})()},[r,n]),l.useEffect(()=>{if(e!=="success")return;const o=window.setTimeout(()=>{try{r("/?redirect=/lobby",{replace:!0})}catch{window.location.href=`${window.location.origin}/?redirect=/lobby`}},1200);return()=>{window.clearTimeout(o)}},[e,r]);const s=o=>o==="verifying"?a.jsxs(a.Fragment,{children:[a.jsx("p",{children:"Verifying your magic link..."}),a.jsx("button",{className:"landing-btn-secondary",onClick:()=>r("/lobby"),style:{marginTop:16},"aria-label":"Back to Home",children:"Back to Home"})]}):o==="success"?a.jsx("p",{children:"Verification successful! Redirecting to the lobby..."}):a.jsxs(a.Fragment,{children:[a.jsx(g1,{open:!0,onClose:()=>r("/lobby"),title:"Verification failed",message:"Verification failed. Please try again."}),a.jsx("button",{className:"landing-btn-secondary",onClick:()=>r("/lobby"),style:{marginTop:16},"aria-label":"Back to Home",children:"Back to Home"})]});return a.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[a.jsx(Ja,{className:"page-home-screen"}),a.jsx("div",{style:{minHeight:"100vh",display:"flex",alignItems:"center",justifyContent:"center",textAlign:"center",padding:"0 16px"},children:a.jsx("div",{children:s(e)})})]})}function Su(){const[e,t]=l.useState("verifying"),[r,n]=l.useState(!1),s=Hr(),o=za();return l.useEffect(()=>{(async()=>{const u=new URLSearchParams(window.location.search).get("token");if(!u){t("error");return}try{const p=await fetch(`${o}/api/auth/review-login?token=${encodeURIComponent(u)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!p.ok){t("error");return}let d=null;try{const f=await p.json().catch(()=>null);f!=null&&f.token&&await Jc(f.token)}catch{}if(d=await Jy(),d){t("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else t("error")}catch{t("error")}})()},[o,s]),l.useEffect(()=>{e==="error"&&n(!0)},[e]),e==="verifying"?a.jsx("p",{children:"Signing you in for review…"}):e==="success"?a.jsx("p",{children:"Success! Redirecting to the lobby…"}):a.jsx(a.Fragment,{children:a.jsx(g1,{open:r,onClose:()=>n(!1),title:"Review login failed",message:"Review login failed. Please check your link."})})}function Eu(){const[e,t]=l.useState("verifying"),[r,n]=l.useState(!1),s=Hr(),o=za();return l.useEffect(()=>{(async()=>{const u=new URLSearchParams(window.location.search).get("token");if(!u){t("error");return}try{const p=await fetch(`${o}/api/auth/qa-login?token=${encodeURIComponent(u)}`,{method:"GET",credentials:"include",redirect:"follow"});if(!p.ok){t("error");return}try{const f=await p.json().catch(()=>null);f!=null&&f.token&&await Jc(f.token)}catch{}if(await Jy()){t("success"),window.location.href=`${window.location.origin}/?redirect=/lobby`;return}else t("error")}catch{t("error")}})()},[o,s]),l.useEffect(()=>{e==="error"&&n(!0)},[e]),e==="verifying"?a.jsx("p",{children:"Signing you in for QA…"}):e==="success"?a.jsx("p",{children:"Success! Redirecting to the lobby…"}):a.jsx(a.Fragment,{children:a.jsx(g1,{open:r,onClose:()=>n(!1),title:"QA login failed",message:"QA login failed. Please check your link."})})}function Dw({busy:e=!1,label:t="Cancel Bet",disabled:r,...n}){const s=r||e;return a.jsxs("button",{type:"button",className:`cancel-btn ${e?"is-busy":""} ${s?"is-disabled":""}`,disabled:s,"aria-busy":e||void 0,"aria-label":t,"aria-live":"polite",...n,children:[a.jsx("span",{className:"cancel-btn__content",children:"X"}),e&&a.jsx("span",{className:"cancel-btn__spinner","aria-hidden":"true"})]})}function yO({disabled:e,onClick:t,busy:r=!1,label:n="✓",mini:s=!1}){return a.jsx("button",{disabled:e||r,onClick:t,className:`place-bet-btn ${s?"place-bet-btn--mini":""} ${r?"busy":""}`,"aria-label":"Place Bet",children:r?"Placing...":n})}function Gfe({show:e,open:t,isBanker:r,meId:n,players:s,labelPrefix:o="Main Bet: "}){const i=l.useMemo(()=>t.filter(m=>m.type==="MAIN"),[t]),[c,u]=l.useState(!1),p=l.useMemo(()=>i==null?void 0:i.filter(m=>r?!0:m.playerId===n||m.acceptedById===n),[i,r,n]),d=l.useMemo(()=>p.reduce((m,h)=>m+(h.amount||0),0),[p]),f=m=>{var h;return((h=s.find(b=>b.id===m))==null?void 0:h.name)||m};return a.jsxs(a.Fragment,{children:[a.jsx(Zs.div,{className:`betToken ${e?"open":""}`,initial:{opacity:0,scale:.8},animate:{opacity:e?1:0,scale:e?1:.8},transition:{type:"spring",stiffness:320,damping:26},children:a.jsx("a",{role:"button","aria-haspopup":"dialog","aria-expanded":c,onClick:()=>{u(!0)},title:"Show my bets",className:"gold-link",children:a.jsxs("span",{className:"betToken__amount",children:[o,_d(d??0)]})})}),c&&a.jsxs("div",{className:"results-modal",role:"dialog","aria-modal":"true","aria-label":"Your bets",children:[a.jsx("div",{className:"results-modal__backdrop",onClick:()=>u(!1)}),a.jsxs("div",{className:"results-modal__card card",children:[a.jsxs("div",{className:"results-modal__header",children:[a.jsx("h3",{style:{margin:0},children:"Your Open Main Bets"}),a.jsx("button",{className:"btn btn--ghost",onClick:()=>u(!1),children:"Close"})]}),p.length===0?a.jsx("ul",{className:"betlist results-list",children:a.jsx("li",{className:"betitem",children:"No applicable bets."})}):a.jsx("ul",{className:"betlist results-list",children:p.map(m=>a.jsx("li",{className:"betitem",children:a.jsxs("div",{style:{display:"flex",alignItems:"center",gap:12},children:[a.jsxs(a.Fragment,{children:[" ",p1(m.amount).map(h=>a.jsx(Bo,{mini:!0,value:h}))]}),a.jsxs("div",{className:"betitem__info",children:[a.jsxs("div",{className:"betitem__title",children:[f(m.playerId)," ",a.jsx("span",{className:"betSummary__dash",children:"—"})," BET"]}),a.jsxs("div",{className:"betitem__meta",children:["Amount: ",a.jsx("strong",{children:_d(m.amount??0)}),m.acceptedById?` • matched by ${f(m.acceptedById)}`:" • (pending)"]})]})]})},m.id))})]})]})]})}const Xfe={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 bO({selectedTimes:e,onAdd:t,onClear:r,onPlaceBet:n,onCancelBet:s,disabled:o,collapsed:i=!1,collapseLabel:c="Placed bet",miniChips:u=!1,betTokenProps:{isBanker:p,meId:d,open:f,players:m,show:h,labelPrefix:b},hasBankRoll:g,betsLocked:y,myOpenMain:x,mainAmt:v,heading:A,rollerMeta:_}){const w=nO,j=Uce(),T=l.useCallback(()=>{cr("Light")},[]),R=l.useRef(!1),P=!!y,k=!!g,E=!o&&!P&&!k&&!p&&!x,M=l.useCallback(()=>{R.current||!E||(R.current=!0,T(),n==null||n(),setTimeout(()=>{R.current=!1},600))},[E,n,T]),C=l.useCallback(L=>{if(!(o||P)){T();try{}catch{}t==null||t(L)}},[o,P,t,T]),I=l.useCallback(()=>{o||k||!x||(T(),s==null||s())},[o,k,x,s,T]);return a.jsxs("div",{className:`chipRackOuter ${E?"chipRackOuter--active":""}`,children:[v>0&&!x&&a.jsxs("div",{className:"chipRack__total","aria-label":`Total bet: ${v}${_?` vs ${_.name}${_.hasHistory?` (${_.label})`:""}`:""}`,children:[a.jsx("span",{className:"chipRack__totalSymbol",children:"ℤ"}),v.toLocaleString(),_&&a.jsxs("span",{className:"chipRack__totalMeta",children:[a.jsx("span",{className:"chipRack__totalMeta__vs",children:"vs"}),a.jsx("span",{className:"chipRack__totalMeta__name",children:_.name}),_.hasHistory&&a.jsxs("span",{className:`chipRack__totalMeta__record ${_.net>0?"chipRack__totalMeta__record--up":_.net<0?"chipRack__totalMeta__record--down":""}`,children:["(",_.label,")"]})]})]}),a.jsxs("div",{className:"chipRackContainer",children:[a.jsxs("div",{className:`chipRack ${o?"chipRack--disabled":""} ${i?"chipRack--collapsed":"chipRack--open"}`,children:[a.jsx("div",{className:"chipRack__collapseTarget","aria-label":c}),a.jsx(Zs.div,{className:"chipRack__scroller",role:"listbox","aria-label":"Bet chips",initial:!1,style:{pointerEvents:o||P||i||x?"none":"auto"},children:w.map(L=>{const N=(e[L]??0)>0;return a.jsx(Zs.div,{role:"option","aria-selected":N,variants:j?void 0:Xfe,layout:!0,className:"chipRack__chipWrapper",children:a.jsx(Bo,{value:L,onAdd:C,onClear:r,disabled:!E,selectedTimes:e[L]??0,mini:u,"data-chip":L})},L)})})]}),a.jsxs("div",{className:"chipRack__placeWrap","aria-disabled":!E,style:{pointerEvents:E?"auto":"none"},"data-allowed":E?"true":"false",children:[E&&a.jsx("div",{className:"chipRack__bounceArrow","aria-hidden":"true",children:"▼"}),a.jsx("div",{className:"chipRack__placeInner",children:a.jsx(yO,{onClick:M,disabled:!E,mini:u})}),E&&a.jsx("div",{className:"chipRack__halo","aria-hidden":"true"})]}),a.jsxs("div",{className:"chipRack__amount","aria-live":"polite","aria-atomic":"true",children:[a.jsx(Zs.div,{children:a.jsx(Dw,{onClick:I,disabled:o||k||!x})}),a.jsx(Gfe,{isBanker:p,meId:d,open:f,players:m,show:h,labelPrefix:b})]})]})]})}function Yfe({fly:e,onComplete:t}){const r=l.useRef({startX:e.startX,startY:e.startY,endX:e.endX,endY:e.endY,amount:e.amount}).current,n=l.useRef(null);l.useEffect(()=>{const o=ha.chipFlyDurationMs,i=0,c=100;n.current=window.setTimeout(()=>{try{E8({playbackRate:1.25})}catch{}},i+c);const u=setTimeout(t,o+600);return()=>{clearTimeout(u),n.current&&(window.clearTimeout(n.current),n.current=null)}},[t]);const s=18;return l.useRef(null),a.jsx(Zs.div,{initial:{position:"fixed",left:r.startX-s,top:r.startY-s,zIndex:1e4,opacity:0,scale:.9},animate:{left:r.endX-s,top:r.endY-s,opacity:1,scale:1},transition:{type:"spring",stiffness:120,damping:20,duration:ha.chipFlyDurationMs/1e3},onAnimationComplete:t,style:{pointerEvents:"none"},children:a.jsx(Bo,{mini:!0,value:r.amount,disabled:!0,className:"chip--flight",selectedTimes:0})})}function Ff({label:e,subtitle:t,onClick:r,className:n,disabled:s,imageName:o,imgSrc:i,size:c="md",ariaLabel:u,showHalo:p}){const d=["gold-btn",`gold-btn--${c}`,i||o?"gold-btn--image":"gold-btn--styled",n||""].filter(Boolean).join(" "),f=o?`/ui/buttons/${o}.webp`:void 0,m=i||f;return a.jsxs("button",{type:"button",className:d,onClick:r,disabled:s,"aria-label":u||e,children:[p&&a.jsx("span",{className:"gold-btn__halo","aria-hidden":!0}),m&&a.jsx("span",{className:"gold-btn__media","aria-hidden":!0,children:a.jsxs("picture",{children:[a.jsx("source",{srcSet:m,type:"image/webp"}),a.jsx("img",{src:m,alt:"",loading:"lazy"})]})}),a.jsxs("span",{className:"gold-btn__text",children:[a.jsx("span",{className:"gold-btn__label",children:e}),t?a.jsx("span",{className:"gold-btn__sub","aria-hidden":!0,children:t}):null]})]})}function yi({label:e,subtitle:t,onClick:r,disabled:n,size:s="md",ariaLabel:o,className:i,variant:c="pill",showHalo:u}){const p=[i,c==="circle"?"poker-action--circle":""].filter(Boolean).join(" "),[d,f]=ot.useState(!1),m=ot.useCallback(()=>{try{yn()}catch{}f(!1),requestAnimationFrame(()=>{f(!0),window.setTimeout(()=>f(!1),260)});try{cr("Light")}catch{}try{}catch{}typeof r=="function"&&r()},[r]),h=typeof u=="boolean"?u:!n;return a.jsx("span",{className:["poker-action-spring",d?"is-spring":""].filter(Boolean).join(" "),"data-no-global-haptic":!0,children:a.jsx(Ff,{label:e,subtitle:t,onClick:m,disabled:n,size:s,ariaLabel:o,className:p,showHalo:h})})}function Vm(){const e=[{id:"bet1",type:"MAIN",playerId:"player1",acceptedById:"banker1",amount:100},{id:"bet2",type:"MAIN",playerId:"player2",acceptedById:null,amount:50}],t=[{id:"player1",name:"Alice"},{id:"player2",name:"Bob"},{id:"banker1",name:"Banker"}],[r,n]=l.useState({1:0,5:0,10:1,25:0,100:0}),[s,o]=l.useState(10),[i,c]=l.useState(!1),[u,p]=l.useState(!1),[d,f]=l.useState([]),m=l.useRef(null),h=l.useRef({c1:null,c2:null,c3:null,c4:null}),b=R=>{if(!R)return null;const P=R.getBoundingClientRect();return{x:P.left+P.width/2,y:P.top+P.height/2}},g=l.useCallback((R,P,k)=>{const E=b(R),M=b(P);if(!E||!M)return;const I={id:`flight-${Date.now()}-${Math.random().toString(36).slice(2,7)}`,amount:k,fromId:"sandbox-from",toId:"sandbox-to",startX:E.x,startY:E.y,endX:M.x,endY:M.y,active:!0};f(L=>[...L,I])},[]),y=()=>{g(h.current.c1,m.current,25)},x=()=>{["c1","c2","c3","c4"].forEach((R,P)=>{setTimeout(()=>g(h.current[R],m.current,5*(P+1)),P*40)})},v=()=>{["c1","c2","c3","c4"].forEach((R,P)=>{setTimeout(()=>g(m.current,h.current[R],10*(P+1)),P*40)})},A=R=>{f(P=>P.filter(k=>k.id!==R))},_=R=>{n(P=>({...P,[R]:(P[R]||0)+1})),o(P=>P+R)},w=R=>{n(P=>({...P,[R]:0})),o(P=>P-R*(r[R]||0))},j=()=>{c(!0),p(!0),console.log(`[sandbox] Bet placed with amount: $${s}`)},T=()=>{c(!1),p(!1),n({1:0,5:0,10:0,25:0,100:0}),o(0),console.log("[sandbox] Bet canceled")};return a.jsxs("div",{className:"button-sandbox",children:[a.jsx("h1",{children:"Button Sandbox"}),a.jsx(Ja,{className:"profile-page"}),a.jsxs("section",{style:{marginBottom:28},children:[a.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"ChipFly Test"}),a.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:[a.jsxs("div",{style:{display:"flex",gap:12,flexWrap:"wrap"},children:[a.jsx("button",{className:"felt-btn felt-btn--mini",onClick:y,children:"Single Flight"}),a.jsx("button",{className:"felt-btn felt-btn--mini",onClick:x,children:"Sweep 456"}),a.jsx("button",{className:"felt-btn felt-btn--mini",onClick:v,children:"Sweep 123"}),a.jsx("button",{className:"felt-btn felt-btn--mini",onClick:()=>f([]),style:{background:"#933",borderColor:"#600"},children:"Clear Flights"})]}),a.jsxs("div",{style:{position:"relative",minHeight:170,marginTop:8,display:"flex",justifyContent:"space-between",alignItems:"center",padding:"0 12px"},children:[a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c1","c2"].map(R=>a.jsx("div",{ref:P=>{h.current[R]=P},children:a.jsx(Bo,{mini:!0,value:5,disabled:!0,className:"chip--flight"})},R))}),a.jsxs("div",{ref:m,children:[a.jsx(Bo,{mini:!0,value:100,disabled:!0,className:"chip--flight"}),a.jsx("div",{style:{textAlign:"center",marginTop:4,fontSize:11,opacity:.7},children:"Banker"})]}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:14},children:["c3","c4"].map(R=>a.jsx("div",{ref:P=>{h.current[R]=P},children:a.jsx(Bo,{mini:!0,value:25,disabled:!0,className:"chip--flight"})},R))})]})]}),d.map(R=>a.jsx(Yfe,{fly:R,onComplete:()=>A(R.id)},R.id))]}),a.jsxs("section",{style:{marginBottom:28},children:[a.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Flash Overlays"}),a.jsxs("div",{className:"flash-preview__row",children:[a.jsx("div",{className:"flash-preview__header",children:a.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:a.jsx("div",{className:"flash-card flash-win",children:a.jsxs("div",{className:"flash-body",children:[a.jsxs("div",{className:"flash-title",children:[a.jsx("span",{className:"flash-title__name",children:"ALICE"}),a.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),a.jsxs("div",{className:"flash-subtitle",children:[a.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})})}),a.jsx("div",{className:"flash-preview__header",children:a.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:a.jsx("div",{className:"flash-card flash-lose",children:a.jsxs("div",{className:"flash-body",children:[a.jsxs("div",{className:"flash-title",children:[a.jsx("span",{className:"flash-title__name",children:"BANKER"}),a.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),a.jsxs("div",{className:"flash-subtitle",children:[a.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})})}),a.jsx("div",{className:"flash-preview__header",children:a.jsx("div",{className:"flash-root flash-root--header","aria-hidden":!0,children:a.jsx("div",{className:"flash-card flash-push",children:a.jsxs("div",{className:"flash-body",children:[a.jsx("div",{className:"flash-title",children:"PUSH"}),a.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})})]}),a.jsxs("div",{className:"flash-preview__row",children:[a.jsx("div",{className:"flash-frame",children:a.jsx("div",{className:"flash-card flash-win","aria-hidden":!0,children:a.jsxs("div",{className:"flash-body",children:[a.jsxs("div",{className:"flash-title",children:[a.jsx("span",{className:"flash-title__name",children:"ALICE"}),a.jsx("span",{className:"flash-title__rest",children:"WINS"})]}),a.jsxs("div",{className:"flash-subtitle",children:[a.jsx("span",{className:"keep-lower",children:"z"}),"250"]})]})})}),a.jsx("div",{className:"flash-frame",children:a.jsx("div",{className:"flash-card flash-lose","aria-hidden":!0,children:a.jsxs("div",{className:"flash-body",children:[a.jsxs("div",{className:"flash-title",children:[a.jsx("span",{className:"flash-title__name",children:"BANKER"}),a.jsx("span",{className:"flash-title__rest",children:"LOSES"})]}),a.jsxs("div",{className:"flash-subtitle",children:[a.jsx("span",{className:"keep-lower",children:"z"}),"120"]})]})})}),a.jsx("div",{className:"flash-frame",children:a.jsx("div",{className:"flash-card flash-push","aria-hidden":!0,children:a.jsxs("div",{className:"flash-body",children:[a.jsx("div",{className:"flash-title",children:"PUSH"}),a.jsx("div",{className:"flash-subtitle",children:"No Action"})]})})})]})]}),a.jsxs("section",{style:{marginBottom:28},children:[a.jsx("h2",{style:{fontSize:16,margin:"4px 0 12px"},children:"Poker Action Buttons"}),a.jsxs("div",{className:"poker-actions",role:"group","aria-label":"Poker action buttons",style:{display:"flex",gap:12,flexWrap:"wrap",alignItems:"center"},children:[a.jsx(yi,{label:"Check",ariaLabel:"Check",size:"md",className:"poker-action--green poker-action--secondary poker-action--check",onClick:()=>{}}),a.jsx(yi,{label:"Call",subtitle:"z120",ariaLabel:"Call 120",size:"md",className:"poker-action--green poker-action--primary poker-action--call",onClick:()=>{}}),a.jsx(yi,{label:"Bet",subtitle:"z250",ariaLabel:"Bet 250",size:"md",className:"poker-action--flat poker-action--secondary poker-action--bet",onClick:()=>{}}),a.jsx(yi,{label:"Raise",subtitle:"z400",ariaLabel:"Raise 400",size:"md",className:"poker-action--flat poker-action--secondary poker-action--raise",onClick:()=>{}}),a.jsx(yi,{label:"Fold",ariaLabel:"Fold",size:"md",className:"poker-action--flat poker-action--danger poker-action--fold",onClick:()=>{}})]})]}),a.jsxs("div",{className:"button-grid",children:[a.jsx("div",{className:"button-item",children:a.jsx(cD,{onClick:()=>{},label:"ROLL",busy:!1,disabled:!1})}),a.jsx("div",{className:"button-item",children:a.jsx(Dw,{onClick:()=>console.log("[sandbox] Cancel Bet Button Clicked"),busy:!1,disabled:!1,label:"Cancel Bet"})}),a.jsx("div",{className:"button-item",children:i?a.jsx(Dw,{onClick:T,busy:!1,disabled:!1,label:"Cancel Bet"}):a.jsx(yO,{disabled:s<=0,onClick:j,busy:!1,label:"✓"})}),a.jsx("div",{className:"button-item",children:a.jsx(bO,{selectedTimes:r,onAdd:_,onClear:w,disabled:i,collapsed:u,collapseLabel:"Chip Rack",betTokenProps:{isBanker:!1,meId:"player1",open:e,players:t,show:i},onPlaceBet:j,onCancelBet:T,mainAmt:s})}),a.jsx("div",{className:"button-item",children:a.jsx(uO,{state:"verified"})})]})]})}function Pu(){const e=Hr(),t=()=>{window.history.length>1?e(-1):e("/lobby",{replace:!0})};return a.jsx("div",{className:"disclaimer-screen",children:a.jsxs("div",{className:"disclaimer-panel",children:[a.jsxs("button",{type:"button",className:"disclaimer-back",onClick:t,"aria-label":"Back",children:[a.jsx(go,{className:"icon"})," Back"]}),a.jsx("div",{className:"disclaimer-accent-bar"}),a.jsx("h1",{className:"disclaimer-title",children:"Disclaimer"}),a.jsxs("div",{className:"disclaimer-body",children:[a.jsxs("p",{children:[a.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."]}),a.jsx("p",{children:"Virtual chips used in gameplay have no cash value and cannot be redeemed for real money, goods, or services."}),a.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."}),a.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."}),a.jsx("p",{children:"If you or someone you know has a gambling problem and needs help, please contact your local gambling support hotline."})]}),a.jsxs("div",{className:"disclaimer-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function Cu(){const e=Hr();return a.jsx("div",{className:"legal-screen",children:a.jsxs("div",{className:"legal-panel",children:[a.jsx("div",{className:"legal-accent-bar"}),a.jsxs("div",{className:"legal-header",children:[a.jsxs("button",{type:"button",className:"legal-back",onClick:()=>e(-1),"aria-label":"Go back",children:[a.jsx(go,{className:"icon"}),"Back"]}),a.jsx("h1",{className:"legal-title",children:"Support"})]}),a.jsxs("div",{className:"legal-body",children:[a.jsx("p",{children:"Need help with Zentara One Dice Lounge? We're here for you."}),a.jsxs("p",{children:["Email us at"," ",a.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."]}),a.jsx("p",{children:"Please include your device, OS version, and a brief description of the issue."})]}),a.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function Ru(){const e=Hr();return a.jsx("div",{className:"legal-screen",children:a.jsxs("div",{className:"legal-panel",children:[a.jsx("div",{className:"legal-accent-bar"}),a.jsxs("div",{className:"legal-header",children:[a.jsxs("button",{type:"button",className:"legal-back",onClick:()=>e(-1),"aria-label":"Go back",children:[a.jsx(go,{className:"icon"}),"Back"]}),a.jsx("h1",{className:"legal-title",children:"Privacy Policy"})]}),a.jsxs("div",{className:"legal-body",children:[a.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."}),a.jsxs("p",{children:["For questions or data requests, contact"," ",a.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),a.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}function Tu(){const e=Hr();return a.jsx("div",{className:"legal-screen",children:a.jsxs("div",{className:"legal-panel",children:[a.jsx("div",{className:"legal-accent-bar"}),a.jsxs("div",{className:"legal-header",children:[a.jsxs("button",{type:"button",className:"legal-back",onClick:()=>e(-1),"aria-label":"Go back",children:[a.jsx(go,{className:"icon"}),"Back"]}),a.jsx("h1",{className:"legal-title",children:"Terms of Use"})]}),a.jsxs("div",{className:"legal-body",children:[a.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.'}),a.jsx("h2",{children:"1. Apple Standard EULA"}),a.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:"," ",a.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/"}),"."]}),a.jsx("h2",{children:"2. Subscriptions and Billing"}),a.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."}),a.jsx("h2",{children:"3. Refunds"}),a.jsx("p",{children:"Refunds for purchases made via the App Store are handled by Apple directly, per Apple policies."}),a.jsx("h2",{children:"4. Acceptable Use"}),a.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."}),a.jsx("h2",{children:"5. Privacy"}),a.jsxs("p",{children:["Please review our"," ",a.jsx(Xs,{className:"legal-link",to:"/privacy",children:"Privacy Policy"})," ","to understand how we collect and use information."]}),a.jsx("h2",{children:"6. Contact"}),a.jsxs("p",{children:["Questions? Contact"," ",a.jsx("a",{href:"mailto:support@zentaraone.com",className:"legal-link",children:"support@zentaraone.com"}),"."]})]}),a.jsxs("div",{className:"legal-footer",children:["© ",new Date().getFullYear()," Zentara One. All rights reserved."]})]})})}za();const _R={GET:!0,HEAD:!0};function Zfe(e){const{baseURL:t,getToken:r,onUnauthorized:n,defaultTimeoutMs:s=12e3,defaultHeaders:o={"Content-Type":"application/json"},retry:i={attempts:2,backoffMs:400,retryOn:[408,429,500,502,503,504]}}=e;async function c(h,b={}){var v;const g=((v=b.method)==null?void 0:v.toUpperCase())||"GET",y=_R[g]?(i.attempts??2)+1:1;let x;for(let A=0;A<y;A++){const _=new AbortController,w=setTimeout(()=>_.abort(),b.timeoutMs??s);try{const j=await Promise.resolve(r()),T=await fetch(Kfe(t,h),{...b,headers:{...o,...b.headers||{},...j?{Authorization:`Bearer ${j}`}:{}},signal:_.signal});if(clearTimeout(w),T.status===401)throw n==null||n(),wR("Unauthorized",T.status,await xR(T));if((i.retryOn??[]).includes(T.status)&&A<y-1){await AR((i.backoffMs??400)*(A+1));continue}if(!T.ok)throw wR(`HTTP ${T.status}`,T.status,await xR(T));return(T.headers.get("content-type")||"").includes("application/json")?await T.json():await T.text()}catch(j){if(clearTimeout(w),x=j,A<y-1&&_R[g]){await AR((i.backoffMs??400)*(A+1));continue}break}}throw x}return{get:(h,b)=>c(h,{...b,method:"GET"}),post:(h,b,g)=>c(h,{...g,method:"POST",body:b==null?void 0:JSON.stringify(b)}),put:(h,b,g)=>c(h,{...g,method:"PUT",body:b==null?void 0:JSON.stringify(b)}),patch:(h,b,g)=>c(h,{...g,method:"PATCH",body:b==null?void 0:JSON.stringify(b)}),del:(h,b)=>c(h,{...b,method:"DELETE"}),fetch:c}}function Kfe(e,t){return!e.endsWith("/")&&!t.startsWith("/")?`${e}/${t}`:e.endsWith("/")&&t.startsWith("/")?e+t.slice(1):e+t}function wR(e,t,r){const n=new Error(e);return n.status=t,n.body=r,n}async function xR(e){try{return await e.json()}catch{try{return await e.text()}catch{return null}}}const AR=e=>new Promise(t=>setTimeout(t,e)),R1e=Zfe({baseURL:za(),getToken:()=>Jn().then(e=>e??null),onUnauthorized:()=>{Ql()},defaultTimeoutMs:12e3});function y1({children:e,header:t,footer:r,overlay:n,showAvatarBacks:s=!1}){return a.jsxs("div",{className:"poker-room-shell","aria-label":"Poker Room","data-game-mode":"poker","data-show-avatar-backs":s?"1":void 0,children:[a.jsx(Ja,{className:"page-poker-room"}),a.jsx("div",{className:"poker-room-bg"}),a.jsxs("div",{className:"poker-room-foreground",role:"main",children:[t,a.jsx("div",{className:"poker-room-content",children:e}),r]}),n]})}function vO({cards:e,firstRevealed:t=!0,bothRevealed:r=!0}){const[n,s]=Array.isArray(e)?e:[];return!n&&!s?null:a.jsxs("div",{className:"holecards","aria-label":"hole-cards",children:[a.jsx(kR,{value:n,revealed:!!t||!!r}),a.jsx(kR,{value:s,revealed:!!r})]})}function kR({value:e,revealed:t=!1}){if(!e)return a.jsx("span",{className:"poker-card"+(t?" revealed":""),"aria-hidden":!0});const{rank:r,suit:n}=Qfe(e),s=n==="hearts"||n==="diamonds";return a.jsxs("div",{className:["poker-card",s?"poker-card--red":"",t?"revealed":""].filter(Boolean).join(" "),"aria-label":`${r} of ${n}`,children:[a.jsx("span",{className:"poker-card__rank",children:r}),a.jsx("span",{className:"poker-card__suit",children:Jfe(n)})]})}function Qfe(e){const t=String(e||"").trim().toUpperCase(),r=t.slice(0,-1),n=t.slice(-1);return{rank:r==="T"?"10":r,suit:n==="H"?"hearts":n==="D"?"diamonds":n==="C"?"clubs":"spades"}}function Jfe(e){switch(e){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function $fe({gameState:e,players:t,winners:r,hands:n,durationMs:s,meId:o}){const i=l.useRef(null),c=l.useRef(null),u=l.useRef(null),{info:p}=As();l.useEffect(()=>{const d=i.current,f=e||{};i.current=f;const m=f==null?void 0:f.pokerLastAction;if(m&&typeof m.seq=="number"){const S=(Array.isArray(f==null?void 0:f.pokerSeats)?f.pokerSeats:[]).find(F=>F.seatIndex===m.seatIndex);if(S){const F=t.find(K=>K.id===S.playerId),D=(F==null?void 0:F.name)||(F==null?void 0:F.email)||"Player";let H;const W=K=>typeof K=="number"?`z${K.toLocaleString("en-US")}`:"";switch((m.action||"").toLowerCase()){case"fold":H="Fold";break;case"check":H="Check";break;case"call":H=`Call ${W(m.amountDelta)}`;break;case"bet":H=`Bet ${W(m.amountDelta)}`;break;case"raise":H=m.toBet?`Raise to ${W(m.toBet)}`:`Raise ${W(m.amountDelta)}`;break;default:H="Action";break}const $=`srv:${Number((f==null?void 0:f.pokerRoundSeq)||0)||0}:${m.seq}`;u.current!==$&&(p(`${D}: ${H}`,void 0),u.current=$),c.current=m.seq;return}}if(!d)return;const h=(d==null?void 0:d.pokerPhase)??"waiting",b=(f==null?void 0:f.pokerPhase)??"waiting";if(h!==b&&h==="waiting"&&b==="pre-flop")return;const g=Array.isArray(d==null?void 0:d.pokerSeats)?d.pokerSeats:[],y=Array.isArray(f==null?void 0:f.pokerSeats)?f.pokerSeats:[];if(!y.length)return;const x=N=>{const S=new Map;for(const F of N)S.set(F.seatIndex,F);return S},v=x(g),A=x(y),_=d==null?void 0:d.pokerActingSeat,w=f==null?void 0:f.pokerActingSeat,j=(d==null?void 0:d.pokerCurrentBet)||0,T=(f==null?void 0:f.pokerCurrentBet)||0;let R=null,P=null;for(const N of y){const S=v.get(N.seatIndex);if(S&&(S.status==="active"||S.status==="all-in")&&N.status==="folded"){R=N,P="Fold";break}}if(!P)for(const N of y){const S=v.get(N.seatIndex);if(!S)continue;const F=(N.committed||0)-(S.committed||0);if(F>0){R=N,j===0?P=`Bet z${F}`:T>j?P=`Raise to z${T}`:P=`Call z${F}`;break}}if(!P&&_!=null&&w!=null&&_!==w){const N=v.get(_),S=A.get(_);N&&S&&N.status==="active"&&S.status==="active"&&(N.committed||0)===(S.committed||0)&&(R=S,P="Check")}if(!P||!R)return;const k=t.find(N=>N.id===R.playerId),M=`${(k==null?void 0:k.name)||(k==null?void 0:k.email)||"Player"}: ${P}`,C=Number((f==null?void 0:f.pokerRoundSeq)||0)||0;try{const N=typeof window<"u"?window:void 0,S=N&&N.__pokerWinnersFlashGuard;if(S&&S.roundSeq===C)return}catch{}const I=Number((R==null?void 0:R.committed)||0),L=`heur:${C}:${R.seatIndex}:${P}:${I}:${T}`;u.current!==L&&(p(M,void 0),u.current=L)},[e,t,p,s])}function SR({enabled:e,onComplete:t,perCardSec:r=.55,staggerSec:n=.12,origin:s,handKey:o,getTargets:i,passes:c=2}){const u=l.useRef(null),[p,d]=l.useState([]),[f,m]=l.useState(!1),h=l.useMemo(()=>{if(!u.current)return{x:0,y:0};const y=u.current.getBoundingClientRect(),x=(s==null?void 0:s.xPct)??.5,v=(s==null?void 0:s.yPct)??.78;return{x:y.width*x,y:y.height*v}},[s,u.current]);l.useEffect(()=>{if(!e)return;const g=u.current;if(!g||typeof window>"u")return;let y=[];if(typeof i=="function")try{y=i(g)||[]}catch{y=[]}else{const x=g.getBoundingClientRect();y=Array.from(document.querySelectorAll(".poker-room-header .avatar-ring")).map(A=>{const _=A.getBoundingClientRect();return{x:(_.left+_.right)/2-x.left,y:(_.top+_.bottom)/2-x.top}})}d(y)},[e,o,i]),l.useEffect(()=>{if(!e)return;try{$d(["cardSwoosh"])}catch{}(async()=>{const v=await Qg(["cardSwoosh"],900);m(v)})();const g=p.length*Math.max(1,c);if(g===0){const v=setTimeout(()=>t==null?void 0:t(),10);return()=>clearTimeout(v)}const y=(g-1)*n+r,x=setTimeout(()=>t==null?void 0:t(),y*1e3);return()=>clearTimeout(x)},[e,p,r,n,t,c]);const b=l.useMemo(()=>{const g=[],y=Math.max(1,c);for(let x=0;x<y;x++)for(let v=0;v<p.length;v++){const A=x*p.length+v;g.push({key:`card-${x}-${v}`,delay:A*n,to:p[v]})}return g},[p,c,n,o]);return l.useEffect(()=>{if(!e||!b.length||!f)return;const g=[],x=typeof navigator<"u"&&/iPad|iPhone|iPod/.test(navigator.userAgent)?70:0;let v=0,A=!0;for(const _ of b){const w=Math.max(0,(_.delay||0)*1e3),T=Math.max(w+(A?30:0),v+x),R=window.setTimeout(()=>{try{P8({volume:.0125})}catch{}},T);v=T,A=!1,g.push(R)}return()=>{g.forEach(_=>window.clearTimeout(_))}},[e,b,f]),!e||!f?null:a.jsx("div",{ref:u,className:"poker-dealing-layer","aria-hidden":!0,style:{willChange:"transform, opacity"},children:b.map(g=>a.jsx(Zs.div,{className:"poker-dealing-card",initial:{x:h.x,y:h.y,opacity:0},animate:{x:g.to.x,y:g.to.y,opacity:1},transition:{duration:r,delay:g.delay,ease:"easeOut"},style:{willChange:"transform, opacity",backfaceVisibility:"hidden"}},g.key))})}function eme({players:e,entries:t,onClose:r}){const n=ot.useCallback((i,c)=>{var u;return((u=e.find(p=>p.id===i))==null?void 0:u.name)||`Seat ${c+1}`},[e]),s=ot.useCallback(i=>{if(!i||typeof i.category!="number")return;const c=i.category|0,u=Array.isArray(i.tiebreak)?i.tiebreak:[],p=f=>"23456789TJQKA"[Math.max(0,Math.min(12,f))]||"?",d=f=>({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"})[p(f)]||p(f);switch(c){case 8:return`Straight Flush (${d(u[0]??0)} high)`;case 7:return`Four of a Kind (${d(u[0]??0)}s)`;case 6:return`Full House (${d(u[0]??0)}s over ${d(u[1]??0)}s)`;case 5:return`Flush (${[u[0],u[1],u[2],u[3],u[4]].filter(f=>f!=null).map(f=>p(f)).join("")})`;case 4:return`Straight (${d(u[0]??0)} high)`;case 3:return`Three of a Kind (${d(u[0]??0)}s)`;case 2:return`Two Pair (${d(u[0]??0)}s & ${d(u[1]??0)}s)`;case 1:return`One Pair (${d(u[0]??0)}s)`;default:return`High Card (${d(u[0]??0)})`}},[]),o=ot.useMemo(()=>[...t].sort((i,c)=>c.roundSeq-i.roundSeq),[t]);return a.jsxs("div",{className:"results-modal","data-testid":"poker-history-modal",children:[a.jsx("div",{className:"results-modal__backdrop",onClick:r}),a.jsxs("div",{className:"results-modal__card card",style:{maxWidth:900},children:[a.jsxs("div",{className:"results-modal__header",children:[a.jsx("h3",{children:"Poker History"}),a.jsx("button",{className:"btn btn--ghost",onClick:r,"aria-label":"Close History",children:"Close"})]}),o.length===0&&a.jsx("div",{children:"No hands yet."}),a.jsx("div",{style:{display:"flex",flexDirection:"column",gap:12,maxHeight:"70vh",overflow:"auto"},children:o.map(i=>a.jsxs("div",{className:"card",style:{padding:10,background:"rgba(255,255,255,0.05)"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"center",justifyContent:"space-between",gap:8,marginBottom:8},children:[a.jsxs("div",{style:{fontWeight:600},children:["Hand ",i.roundSeq]}),a.jsxs("div",{"aria-label":"pot",children:["Pot: z",i.pot||0]})]}),a.jsx("div",{"aria-label":"seats",style:{display:"grid",gridTemplateColumns:"repeat(auto-fit, minmax(220px, 1fr))",gap:8},children:(i.seats&&i.seats.length?i.seats:i.hands.map(c=>({playerId:c.playerId,seatIndex:c.seatIndex}))).map((c,u)=>{const p=i.winners.find(g=>g.playerId===c.playerId),d=n(c.playerId,c.seatIndex),f=!!p,m=String(c.status||"").toLowerCase()==="folded",h=s(c.rank||(p==null?void 0:p.rank)),b=typeof(p==null?void 0:p.amount)=="number"?p.amount:0;return a.jsxs("div",{className:["poker-history__seat",f?"is-winner":""].filter(Boolean).join(" "),style:{padding:8,borderRadius:6,background:f?"rgba(40,180,80,0.15)":"rgba(255,255,255,0.06)"},children:[a.jsx("div",{style:{fontWeight:600,marginBottom:4},children:d}),a.jsx("div",{style:{fontSize:13,opacity:.9},children:m?a.jsx("span",{children:"Folded"}):a.jsx("span",{children:h||"—"})}),a.jsx("div",{style:{fontSize:13,opacity:.9,marginTop:2},children:b>0?a.jsxs("span",{children:["Winnings: z",b]}):a.jsx("span",{children:"Winnings: z0"})})]},`s-${i.roundSeq}-${u}`)})})]},i.roundSeq))})]})]})}const Ow=["A","K","Q","J","10","9","8","7","6","5","4","3","2"],tme={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 _O(e){const t=String(e||"").trim().toUpperCase();if(!t)return null;const r=t.slice(0,-1),n=r==="T"?"10":r;return Ow.includes(n)?n:null}function wO(e){return e.map(_O).filter(t=>t!==null)}function b1(e){const t=wO(e),r={};for(const n of t)r[n]=(r[n]||0)+1;return Object.entries(r).filter(([,n])=>n>=2).map(([n])=>n)}function rme(e){return b1(e).length>0}function nme(e){const t=wO(e);if(t.length===0)return null;let r=null,n=Ow.length;for(const s of t){const o=Ow.indexOf(s);o!==-1&&o<n&&(n=o,r=s)}return r}function ame(e){const t=nme(e);return t?`${tme[t]} High`:null}function sme(e,t){if(t<0||t>=e.length)return!1;const r=_O(e[t]);return r?b1(e).includes(r):!1}function ome(e){const t=[];if(!e||e.length===0)return t;rme(e)&&t.push({label:"Paired Board",type:"paired"});const r=ame(e);return r&&t.push({label:r,type:"high"}),t}function ime(e){return e<0||e>4?null:e<=2?"flop":e===3?"turn":"river"}function lme({boardCards:e}){const t=ome(e);return a.jsx("div",{className:"board-badges","aria-label":"Board state indicators",children:t.map((r,n)=>a.jsx("span",{className:`board-badge board-badge--${r.type}`,role:"status","aria-live":"polite",children:r.label},`${r.type}-${n}`))})}function cme({winner:e,eliminatedOrder:t,finalStates:r,nameOf:n,meId:s,onDismiss:o}){const i=[];e&&i.push({playerId:e,place:1});const c=[...t].reverse();for(const p of c){const d=r[p],f=(d==null?void 0:d.place)??i.length+1;p!==e&&i.push({playerId:p,place:f})}const u=e===s;return a.jsxs("div",{className:"elim-gameover",onClick:o,children:[a.jsx("div",{className:"elim-gameover__title",children:u?"🏆 You Win!":"Game Over"}),a.jsx("div",{className:"elim-gameover__subtitle",children:u?"Last player standing — champion!":e?`${n(e)} wins the tournament!`:"Tournament complete"}),a.jsx("ol",{className:"elim-gameover__standings",children:i.map(p=>{const d=p.place===1,f=p.playerId===s,m=["elim-gameover__row",d?"elim-gameover__row--winner":"",f?"elim-gameover__row--hero":""].filter(Boolean).join(" ");return a.jsxs("li",{className:m,children:[a.jsx("span",{className:"elim-gameover__place-num",children:p.place===1?"🥇":p.place===2?"🥈":p.place===3?"🥉":`#${p.place}`}),a.jsxs("span",{className:"elim-gameover__player-name",children:[n(p.playerId),f?" (You)":""]})]},p.playerId)})}),a.jsx("button",{type:"button",className:"elim-gameover__dismiss",onClick:o,children:"OK"})]})}function ER(e){if(e==null||!e)return"";const t=["th","st","nd","rd"],r=e%100;return e+(t[(r-20)%10]||t[r]||t[0])}function ume(e){const t=String(e||"").trim().toUpperCase(),r=t.slice(0,-1),n=t.slice(-1);return{rank:r==="T"?"10":r,suit:n==="H"?"hearts":n==="D"?"diamonds":n==="C"?"clubs":"spades"}}function dme(e){switch(e){case"hearts":return"♥";case"diamonds":return"♦";case"clubs":return"♣";case"spades":return"♠";default:return"?"}}function pme({value:e,concealed:t,position:r,isPaired:n,animateEntrance:s}){if(!e)return null;const{rank:o,suit:i}=ume(e),u=["poker-card","poker-card--board",i==="hearts"||i==="diamonds"?"poker-card--red":"",r?`poker-card--${r}`:"",n?"poker-card--paired":"",s?"poker-card--enter":""].filter(Boolean).join(" ");return a.jsxs("div",{className:u,style:t?{visibility:"hidden"}:void 0,"aria-label":`${o} of ${i}`,children:[a.jsx("span",{className:"poker-card__rank",children:o}),a.jsx("span",{className:"poker-card__suit",children:dme(i)})]})}const Xp=Object.create(null),g_=Object.create(null);function v1(){var Lu,Du,So,Oi,jp,ic;const{roomId:e}=hp(),{user:t,refreshUser:r}=Zr(),n=Na(),{onHandEnd:s,isAdShowing:o}=bu(),i=String((t==null?void 0:t.id)??(t==null?void 0:t.email)??""),{joinRoom:c,leaveRoom:u,connected:p,participants:d,localParticipant:f}=Yo(),m=Db(),{active:h,fire:b,onComplete:g}=h1(),y=ot.useRef(0),x=["loss-a","loss-b","loss-c"],v=()=>{const Y=x[y.current%x.length];return y.current+=1,Y};l.useEffect(()=>{const Y=()=>{try{Tx()||yn()}catch{}};Y();const ge=["pointerdown","touchstart","mousedown","click","keydown"];return ge.forEach(Ne=>{document.addEventListener(Ne,Y,{once:!0,capture:!0})}),()=>{ge.forEach(Ne=>{document.removeEventListener(Ne,Y,{capture:!0})})}},[]);const{pokerJoinRoom:A,pokerStartHand:_,pokerCreateRoom:w,pokerFold:j,pokerCheck:T,pokerCall:R,pokerBet:P,pokerRaise:k,pokerFetchHistory:E}=sa(),M=Hr(),{info:C,win:I,onIdle:L,show:N}=As(),[S,F]=l.useState(null);l.useEffect(()=>{var Ne;const Y=(Ne=S==null?void 0:S.gameState)==null?void 0:Ne.pokerPhase;return Y&&Y!=="waiting"?m.acquire():m.release(),()=>{m.release()}},[S==null?void 0:S.gameState,m]),l.useEffect(()=>{var Ne;const Y=(Ne=S==null?void 0:S.gameState)==null?void 0:Ne.pokerPhase;!Y||Y==="waiting"?ob({volume:.0125}):Il()},[S==null?void 0:S.gameState]);const[D,H]=l.useState(!1),W=ot.useRef(!1),[G,$]=l.useState(null),[K,de]=l.useState(!1),[ie,we]=l.useState(!1),[he,Ae]=l.useState(!1),Fe=ot.useRef(!1),U=ot.useRef(!1),V=ot.useRef(null);ot.useEffect(()=>{Fe.current=he},[he]),ot.useEffect(()=>{U.current=K},[K]),ot.useEffect(()=>{V.current=G},[G]),ot.useEffect(()=>{W.current=D},[D]),ot.useEffect(()=>{(!G||G.length!==2)&&(De.current=0)},[G]);const z=ot.useRef(null),O=ot.useRef(0);ot.useRef(0);const q=ot.useRef(null),X=ot.useRef(null),Z=ot.useRef(null),[Q,oe]=l.useState(0),[ce,_e]=l.useState(0),[re,pe]=l.useState([]),[ee,xe]=l.useState([]),[Le,Ge]=l.useState(!1),[_t,Xe]=l.useState([]),bt=ot.useRef(0),Pt=ot.useRef(0),kt=ot.useRef(0),Ee=ot.useRef(!1),le=ot.useRef(null),De=ot.useRef(0),Ye=ot.useRef(void 0),Re=ot.useRef(0),[et,rt]=ot.useState([]),ne=ot.useRef(0),ue=ot.useRef(0),B=ot.useRef(0),[fe,ye]=ot.useState(!1),ve=ot.useRef(0),ke=ot.useRef(new Set),Ue=ot.useRef(null),ct=ot.useRef(null),[dt,Rt]=l.useState(0),[jr,Qe]=l.useState(0),[Mt,lr]=ot.useState(new Set),zt=ot.useRef([]),br=ot.useRef(null),fr=ot.useRef(0),ur=!0,[Ie,yt]=l.useState(!0),St=ot.useRef(0),Xt=ot.useRef(null),se=ot.useRef(null),je=ot.useRef(null),[Oe,Ke]=l.useState(null),[Me,wt]=l.useState({}),[at,Dt]=l.useState([]),[Ut,ft]=l.useState(null),[wr,dr]=l.useState(null);ot.useEffect(()=>{var ge;const Y=S==null?void 0:S.gameState;Y&&(ge=Y.pokerElimination)!=null&&ge.enabled&&(Ke({enabled:!0,startingShields:Y.pokerElimination.startingShields??3,maxTokens:Y.pokerElimination.maxTokens??3}),Y.pokerEliminationState&&wt(Y.pokerEliminationState),Y.pokerEliminatedOrder&&Dt(Y.pokerEliminatedOrder))},[S==null?void 0:S.gameState]);const[Vt,Je]=l.useState(null),mt=ot.useMemo(()=>t?t.id:"",[t]),[Te,Ve]=l.useState(!1);l.useEffect(()=>{let Y=!0;return(async()=>{try{const{Preferences:ge}=await Cr(async()=>{const{Preferences:He}=await Promise.resolve().then(()=>Do);return{Preferences:He}},void 0,import.meta.url),{value:Ne}=await ge.get({key:"onb_poker_v1"});if(!Y)return;Ve(Ne!=="1")}catch{if(!Y)return;Ve(!0)}})(),()=>{Y=!1}},[]);const tt=ot.useCallback(()=>{(async()=>{try{const{Preferences:Y}=await Cr(async()=>{const{Preferences:ge}=await Promise.resolve().then(()=>Do);return{Preferences:ge}},void 0,import.meta.url);await Y.set({key:"onb_poker_v1",value:"1"})}catch{}Ve(!1)})()},[]);ot.useEffect(()=>{let Y=!1,ge=null,Ne=null,He=null;const ze=lt=>{try{const Nt=lt.getBoundingClientRect();if(Nt&&isFinite(Nt.height)){const Vn=typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(max-width: 480px)").matches?85:Math.round(Nt.height);document.body.style.setProperty("--poker-header-height",`${Vn}px`)}}catch{}},st=()=>{if(Y||typeof document>"u")return;const lt=document.querySelector(".card-header.card-header--two-rows");if(lt){Xt.current=lt;try{ge=new ResizeObserver(()=>ze(lt)),ge.observe(lt)}catch{He=()=>ze(lt),window.addEventListener("resize",He)}ze(lt)}};if(st(),!Xt.current)try{Ne=window.setTimeout(st,0)}catch{}return()=>{Y=!0;try{document.body.style.removeProperty("--poker-header-height")}catch{}if(ge)try{ge.disconnect()}catch{}if(He){try{window.removeEventListener("resize",He)}catch{}He=null}if(Ne!=null){try{clearTimeout(Ne)}catch{}Ne=null}}},[]);const Et=ot.useCallback(Y=>{var ge;try{const He=document.body.querySelector(`li.player--avatar[data-player-id="${Y}"]`),st=(ge=(He==null?void 0:He.querySelector(".avatar-ring"))||He)==null?void 0:ge.getBoundingClientRect();return st?{x:st.left+st.width/2,y:st.top+st.height/2}:null}catch{return null}},[]),Qt=ot.useCallback(()=>{try{const Y=le.current;if(!Y)return null;const ge=Y.querySelectorAll(".poker-pot-stack");if(!ge||ge.length===0){const lt=Y.getBoundingClientRect();return lt?{x:lt.left+lt.width/2,y:lt.top+lt.height/2}:null}let Ne=1/0,He=1/0,ze=-1/0,st=-1/0;return ge.forEach(lt=>{const Nt=lt.getBoundingClientRect();Nt&&(Ne=Math.min(Ne,Nt.left),He=Math.min(He,Nt.top),ze=Math.max(ze,Nt.right),st=Math.max(st,Nt.bottom))}),!isFinite(Ne)||!isFinite(He)||!isFinite(ze)||!isFinite(st)?null:{x:(Ne+ze)/2,y:(He+st)/2}}catch{return null}},[]);l.useEffect(()=>{L(()=>{var Y;try{const ge=ee||[];if(!ge.length)return;St.current=Date.now();const Ne=Qt();if(!Ne)return;const He=[],ze=Number(ce||((Y=S==null?void 0:S.gameState)==null?void 0:Y.pokerRoundSeq)||0)||Date.now();if(ze&&ne.current===ze)return;ge.forEach((st,lt)=>{const Nt=Et(st.playerId);Nt&&He.push({id:`poker-pot-${ze}-${lt}`,amount:Math.max(1,Number(st.amount||0)),fromId:"pot",toId:st.playerId,startX:Ne.x,startY:Ne.y,endX:Nt.x,endY:Nt.y})}),He.length&&(ne.current=ze,ue.current=ze,B.current=He.length,rt(st=>[...st,...He]),yt(!1))}catch{}})},[ee,ce,S==null?void 0:S.gameState]),l.useEffect(()=>{var st;const Y=(st=S==null?void 0:S.gameState)==null?void 0:st.pokerPhase,ge=Array.isArray(ee)&&ee.length>0&&Y!=="pre-flop"?ee.map(lt=>String(lt.playerId)):[],Ne=ke.current,He=new Set(ge),ze=(lt,Nt)=>{try{const Ft=document.querySelector(`li.player--avatar[data-player-id="${lt}"]`);Ft&&(Nt?Ft.classList.add("player--winner-shake"):Ft.classList.remove("player--winner-shake"))}catch{}};return Ne.forEach(lt=>{He.has(lt)||ze(lt,!1)}),He.forEach(lt=>{Ne.has(lt)||ze(lt,!0)}),ke.current=He,()=>{ke.current.forEach(lt=>ze(lt,!1)),ke.current.clear()}},[ee,S==null?void 0:S.gameState]),l.useEffect(()=>{try{window.__pokerRoomMounted=Date.now()}catch{}},[]),l.useEffect(()=>()=>{if(zt.current.forEach(Y=>clearTimeout(Y)),zt.current=[],br.current&&(clearTimeout(br.current),br.current=null),q.current!=null&&(clearTimeout(q.current),q.current=null),X.current!=null&&(clearTimeout(X.current),X.current=null),z.current!=null){try{clearTimeout(z.current)}catch{}z.current=null}Z.current=null;try{const Y=String(e||"");if(Y&&V.current&&V.current.length===2){const ge=(S==null?void 0:S.gameState)||{},Ne=Number((ge==null?void 0:ge.pokerRoundSeq)||De.current||0)||0;Xp[Y]={myHole:V.current.slice(),roundSeq:Ne,first:!!ie,both:!!K,ts:Date.now()};try{const He=window;He&&(He.__pokerHoleDiag=He.__pokerHoleDiag||[],He.__pokerHoleDiag.push({kind:"persist_hole_on_unmount",at:Date.now(),round:Ne}))}catch{}}}catch{}},[]),l.useEffect(()=>{const Y=String(e||"");if(Y)try{const ge=Xp[Y];if(!ge)return;if(!(Date.now()-(ge.ts||0)<3e4)){delete Xp[Y];return}if(Array.isArray(ge.myHole)&&ge.myHole.length===2){$(ge.myHole.slice()),De.current=Number(ge.roundSeq||0)||De.current||0,ge.first&&we(!0),ge.both&&de(!0);try{const He=window;He&&(He.__pokerHoleDiag=He.__pokerHoleDiag||[],He.__pokerHoleDiag.push({kind:"restore_persisted_hole_on_mount",at:Date.now(),round:ge.roundSeq}))}catch{}}}catch{}},[e]);function or(Y){if(!Y||typeof Y.category!="number")return;const ge=Y.category|0,Ne=Array.isArray(Y.tiebreak)?Y.tiebreak:[],He=st=>"23456789TJQKA"[Math.max(0,Math.min(12,st))]||"?",ze=st=>({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"})[He(st)]||He(st);switch(ge){case 8:return`Straight Flush (${ze(Ne[0]??0)} high)`;case 7:return`Four of a Kind (${ze(Ne[0]??0)}s)`;case 6:return`Full House (${ze(Ne[0]??0)}s over ${ze(Ne[1]??0)}s)`;case 5:return`Flush (${[Ne[0],Ne[1],Ne[2],Ne[3],Ne[4]].filter(st=>st!=null).map(st=>He(st)).join("")})`;case 4:return`Straight (${ze(Ne[0]??0)} high)`;case 3:return`Three of a Kind (${ze(Ne[0]??0)}s)`;case 2:return`Two Pair (${ze(Ne[0]??0)}s & ${ze(Ne[1]??0)}s)`;case 1:return`One Pair (${ze(Ne[0]??0)}s)`;default:return`High Card (${ze(Ne[0]??0)})`}}l.useEffect(()=>{if(!e)return;let Y=!1;const ge=A,Ne=r;return(async()=>{if(Ue.current!==e&&!(S&&S.id===e))try{const He=g_[e]||(async()=>ge(e))();g_[e]=He;const ze=await He;if(!Y&&(ze!=null&&ze.ok)){Ue.current=e,F(ze.room);try{c&&ct.current!==e&&(await Promise.resolve(c(e)),ct.current=e)}catch(st){console.warn("[poker] RTC join failed",st)}try{await Ne()}catch{}}else if(!Y&&ze&&!ze.ok)try{C("Poker",ze.error||"Failed to join room")}catch{}}catch(He){console.warn("[poker] join failed",He)}finally{delete g_[e]}})(),()=>{Y=!0,Ue.current===e&&(Ue.current=null),u&&ct.current===e&&(ct.current=null,u().catch(()=>{}))}},[e]);const Ht=ot.useCallback((Y,ge)=>{if(!Y||Y.id&&(ge!=null&&ge.id)&&Y.id!==ge.id)return ge;try{const Ne=Array.isArray(Y.players)?Y.players:[],He=Array.isArray(ge==null?void 0:ge.players)?ge.players:[];if(He.length===0&&Ne.length>0)return{...Y,...ge,players:Ne};const ze=He.map(st=>{const lt=Ne.find(Nt=>String(Nt.id)===String(st.id));return lt?{...lt,...st}:st});return{...Y,...ge,players:ze}}catch{return ge||Y}},[]);Ba({onJoinedRoom:({room:Y})=>{try{if(Y&&Y.id===e){F(ge=>ge&&ge.id===Y.id?Ht(ge,Y):Y),Ue.current=e||null;try{const ge=Y==null?void 0:Y.gameState;if(!W.current&&ge&&typeof ge.pokerPhase=="string"&&ge.pokerPhase.length>0){H(!0);const Ne=ge.pokerPhase;Ne&&Ne!=="pre-flop"&&Ne!=="waiting"&&Ae(!1)}}catch{}}}catch{}},onRejoinedRoom:({room:Y})=>{try{if(Y&&Y.id===e){F(ge=>ge&&ge.id===Y.id?Ht(ge,Y):Y),Ue.current=e||null,Ae(!1);try{const ge=Y==null?void 0:Y.gameState;!W.current&&ge&&typeof ge.pokerPhase=="string"&&ge.pokerPhase.length>0&&H(!0)}catch{}}}catch{}},onOtherPlayerJoined:({room:Y})=>{try{Y&&Y.id===e&&F(ge=>ge&&ge.id===Y.id?Ht(ge,Y):Y)}catch{}},onOtherLeft:({room:Y})=>{try{Y&&Y.id===e&&F(ge=>ge&&ge.id===Y.id?Ht(ge,Y):Y)}catch{}},onPlayerBalanceUpdated:({playerId:Y,balance:ge})=>{F(Ne=>{if(!Ne||!Array.isArray(Ne.players))return Ne;const He=Ne.players.findIndex(lt=>String(lt.id)===String(Y));if(He===-1)return Ne;const ze=Ne.players.slice(),st=ze[He];return typeof(st==null?void 0:st.balance)=="number"&&st.balance===ge?Ne:(ze[He]={...st,balance:ge},{...Ne,players:ze})})},onPokerMyBalance:({roomId:Y,seatIndex:ge,stack:Ne,committed:He})=>{Y===e&&F(ze=>{if(!ze||!ze.gameState)return ze;const st=Array.isArray(ze.gameState.pokerSeats)?[...ze.gameState.pokerSeats]:[],lt=st.findIndex(Ft=>(Ft==null?void 0:Ft.seatIndex)===ge);if(lt===-1)return ze;const Nt=st[lt];return Nt.stack===Ne&&Nt.committed===He?ze:(st[lt]={...Nt,stack:Ne,committed:He},{...ze,gameState:{...ze.gameState,pokerSeats:st}})})},onRoomUpdateState:Y=>{var ze,st,lt,Nt,Ft,Vn,On,En,zn,ns,ba,Pn,pn,ea,Ha,Fn;if(!Y||Y.roomId!==e)return;if(console.log("[poker] onRoomUpdateState",{roomId:Y.roomId,phase:(st=(ze=Y==null?void 0:Y.room)==null?void 0:ze.gameState)==null?void 0:st.pokerPhase,roundSeq:(Nt=(lt=Y==null?void 0:Y.room)==null?void 0:lt.gameState)==null?void 0:Nt.pokerRoundSeq,seatCount:(On=(Vn=(Ft=Y==null?void 0:Y.room)==null?void 0:Ft.gameState)==null?void 0:Vn.pokerSeats)==null?void 0:On.length,hasMyHole:!!(Y!=null&&Y.myHole&&Array.isArray(Y.myHole)&&Y.myHole.length===2)}),Y.myHole&&Array.isArray(Y.myHole)&&Y.myHole.length===2){const Or=Number(((zn=(En=Y==null?void 0:Y.room)==null?void 0:En.gameState)==null?void 0:zn.pokerRoundSeq)||0);if(!V.current||V.current.length!==2||De.current&&De.current!==Or){$(Y.myHole),Or>0&&(De.current=Or),O.current=Date.now();try{const fn=typeof window<"u"?window:void 0;fn&&(fn.__pokerHoleDiag=fn.__pokerHoleDiag||[],fn.__pokerHoleDiag.push({kind:"hole_from_state",at:Date.now(),round:Or}))}catch{}const Fr=(ba=(ns=Y==null?void 0:Y.room)==null?void 0:ns.gameState)==null?void 0:ba.pokerPhase;!Fe.current&&Fr!=="pre-flop"&&(we(!0),setTimeout(()=>de(!0),180))}}F(Or=>{try{const Fr=Y==null?void 0:Y.room,fn=Fr==null?void 0:Fr.gameState;if(!Or||Or.id&&Or.id!==Y.roomId)return Fr&&Fr.id===Y.roomId?Fr:Or;let tn=fn?{...Or,gameState:fn}:{...Or};return Fr&&Fr.id===Or.id&&(tn=Ht(tn,Fr),fn&&(tn.gameState=fn)),tn}catch{return Or}});try{const Or=(Pn=Y==null?void 0:Y.room)==null?void 0:Pn.gameState;!W.current&&Or&&typeof Or.pokerPhase=="string"&&Or.pokerPhase.length>0&&H(!0)}catch{}const ge=(ea=(pn=Y==null?void 0:Y.room)==null?void 0:pn.gameState)==null?void 0:ea.pokerPhase,Ne=Number(((Fn=(Ha=Y==null?void 0:Y.room)==null?void 0:Ha.gameState)==null?void 0:Fn.pokerRoundSeq)||0),He=Ye.current;if(Ye.current=ge,(ge||"")==="pre-flop"){const Or=Ne>0&&Ne!==bt.current&&Ne!==Pt.current,Fr=!He||["waiting","showdown","complete"].includes(String(He));if(Or&&Fr){if(de(!1),we(!1),V.current&&V.current.length===2)if(De.current===0){De.current=Ne;try{const tn=typeof window<"u"?window:void 0;tn&&(tn.__pokerHoleDiag=tn.__pokerHoleDiag||[],tn.__pokerHoleDiag.push({kind:"assign_hole_round_on_preflop",at:Date.now(),round:Ne}))}catch{}}else if(De.current!==Ne){$(null);try{const tn=String(e||"");tn&&delete Xp[tn]}catch{}try{const tn=typeof window<"u"?window:void 0;tn&&(tn.__pokerHoleDiag=tn.__pokerHoleDiag||[],tn.__pokerHoleDiag.push({kind:"clear_hole_new_round",at:Date.now(),toRound:Ne,prevHoleRound:De.current}))}catch{}}else try{const tn=typeof window<"u"?window:void 0;tn&&(tn.__pokerHoleDiag=tn.__pokerHoleDiag||[],tn.__pokerHoleDiag.push({kind:"keep_hole_new_round",at:Date.now(),round:Ne}))}catch{}else De.current=0;Pt.current=Ne,fr.current=Date.now(),oe(Ne);try{$d(["cardSwoosh"])}catch{}const fn=Re.current!==Ne;fn&&(Re.current=Ne),(async()=>{if(await Qg(["cardSwoosh"],900),Ae(!0),fn)try{d0({volume:.6})}catch{}})()}else if(Or&&!Fr)try{const fn=window;fn&&(fn.__pokerHoleDiag=fn.__pokerHoleDiag||[],fn.__pokerHoleDiag.push({kind:"skip_preflop_midhand",at:Date.now(),round:Ne,prevPhase:He}))}catch{}_e(0),pe([]),xe([]),yt(!0)}else if((ge||"")==="waiting"){if(de(!1),we(!1),Ae(!1),z.current!=null){try{clearTimeout(z.current)}catch{}z.current=null}oe(Or=>Or+1),Pt.current=0,V.current||(De.current=0);try{const Or=String(e||"");Or&&!V.current&&delete Xp[Or]}catch{}}},onPokerMyHole:Y=>{var ge,Ne,He;if(!(!Y||Y.roomId!==e)&&Array.isArray(Y.hole)&&Y.hole.length===2){$(Y.hole);try{const lt=(S==null?void 0:S.gameState)||{},Nt=Number((lt==null?void 0:lt.pokerRoundSeq)||0);Nt>0&&(De.current=Nt)}catch{}O.current=Date.now();try{const lt=typeof window<"u"?window:void 0;lt&&(lt.__pokerHoleDiag=lt.__pokerHoleDiag||[],lt.__pokerHoleDiag.push({kind:"hole",at:Date.now(),phase:(ge=S==null?void 0:S.gameState)==null?void 0:ge.pokerPhase,dealing:Fe.current,round:Number(((Ne=S==null?void 0:S.gameState)==null?void 0:Ne.pokerRoundSeq)||0)}))}catch{}const st=(((He=S==null?void 0:S.gameState)==null?void 0:He.pokerPhase)||"")==="pre-flop";if(W.current)if(!he&&!st)we(!0),setTimeout(()=>de(!0),180);else{if(z.current!=null){try{clearTimeout(z.current)}catch{}z.current=null}try{z.current=window.setTimeout(()=>{if(U.current||!V.current||V.current.length!==2)return;const lt=Date.now();if(Fe.current&&lt-(O.current||lt)>3e3&&Ae(!1),!W.current&&lt-(O.current||lt)<4e3){try{z.current=window.setTimeout(()=>{},500)}catch{}return}we(!0),de(!0);try{const Ft=typeof window<"u"?window:void 0;Ft&&(Ft.__pokerHoleDiag=Ft.__pokerHoleDiag||[],Ft.__pokerHoleDiag.push({kind:"fallback_reveal",at:lt}))}catch{}},1800)}catch{}}}},onPokerRevealAll:Y=>{var He,ze,st;if(!Y||Y.roomId!==e)return;const ge=Number((Y==null?void 0:Y.roundSeq)||0),Ne=Number(((He=S==null?void 0:S.gameState)==null?void 0:He.pokerRoundSeq)||0);if(ge&&Ne){const lt=ge===Ne,Nt=Ne===ge+1;if(!lt&&!Nt)return}if(!(ce&&ce===ge)&&Array.isArray(Y.hands)){pe(Y.hands.filter(Nt=>Array.isArray(Nt==null?void 0:Nt.hole)&&Nt.hole.length===2)),_e(ge||Ne||Date.now());const lt=Array.isArray(ee)&&ee.length>0?ee:[];if((ge||Ne)&&lt.length>0){const Nt=Number(ge||Ne),Vn=lt.reduce((On,En)=>On+(Number(En.amount)||0),0)||Number(((st=(ze=S==null?void 0:S.gameState)==null?void 0:ze.wagerPool)==null?void 0:st.totalAmount)||0)||0;Xe(On=>{var ns;const En=On.findIndex(ba=>ba.roundSeq===Nt),zn={roundSeq:Nt,ts:Date.now(),winners:lt.slice(),hands:(Y.hands||[]).slice(),pot:Vn,seats:Array.isArray((ns=S==null?void 0:S.gameState)==null?void 0:ns.pokerSeats)?S.gameState.pokerSeats.map(ba=>{var Pn,pn;return{playerId:ba.playerId,seatIndex:ba.seatIndex,status:ba.status,rank:((Pn=lt.find(ea=>ea.playerId===ba.playerId))==null?void 0:Pn.rank)||void 0,winnings:(pn=lt.find(ea=>ea.playerId===ba.playerId))==null?void 0:pn.amount}}):void 0};if(En>=0){const ba=On.slice();return ba[En]=zn,ba}return[...On,zn].slice(-20)})}}},onPokerWinners:Y=>{var ze,st,lt,Nt,Ft,Vn,On,En,zn,ns,ba;if(!Y||Y.roomId!==e)return;const ge=Number((Y==null?void 0:Y.roundSeq)||0),Ne=Number(((ze=S==null?void 0:S.gameState)==null?void 0:ze.pokerRoundSeq)||0);if(ge&&Ne){const Pn=ge===Ne,pn=Ne===ge+1;if(!Pn&&!pn)return}ce&&ce===ge?xe(Pn=>Pn.length?Pn:Array.isArray(Y.winners)?Y.winners:[]):(xe(Array.isArray(Y.winners)?Y.winners:[]),ce||_e(ge||Ne||Date.now()));try{const Pn=Number(ge||Ne||0)||0;if(Pn&&kt.current!==Pn){const pn=Array.isArray(Y.winners)?Y.winners:[],Ha=pn.slice().sort((Fr,fn)=>String(Fr.playerId).localeCompare(String(fn.playerId))).map(Fr=>`${Fr.playerId}:${Number(Fr.amount)||0}:${Number(Fr.seatIndex)||0}:${Fr.rank&&Number(Fr.rank.category)||-1}`).join("|"),Fn=typeof window<"u"?window:void 0,Or=Fn&&Fn.__pokerWinnersFlashGuard;if(!Or||Or.roundSeq!==Pn||Or.content!==Ha){const Fr=pn.find(da=>da&&da.rank&&typeof da.rank.category=="number"),fn=or(Fr==null?void 0:Fr.rank),to=pn.reduce((da,lc)=>da+(Number(lc.amount)||0),0)||Number(((lt=(st=S==null?void 0:S.gameState)==null?void 0:st.wagerPool)==null?void 0:lt.totalAmount)||0)||0,pl=to>0?`Pot: z${to}`:void 0,Es=[fn,pl].filter(Boolean).join(" ");Fn&&(Fn.__pokerWinnersFlashGuard={roundSeq:Pn,content:Ha,at:Date.now()});try{Fn&&(Fn.__pokerWinnersFlashed=!0)}catch{}const Wm=String((t==null?void 0:t.id)??(t==null?void 0:t.email)??"");if(pn.some(da=>String(da.playerId)===Wm)){const da=pn.find(Eo=>String(Eo.playerId)===Wm),lc=Number((da==null?void 0:da.amount)||0),Ip=lc>0?`You won: z${lc}`:"You won!";try{N({kind:"win",title:Ip,subtitle:Es,duration:4e3})}catch{}try{p0()}catch{}try{Fn&&(Fn.__E2E===!0||(((Nt=Fn.location)==null?void 0:Nt.search)||"").includes("e2e=1"))&&(Fn.__pokerWinnersFlashed={title:Ip,subtitle:Es,roundSeq:Pn,at:Date.now(),__viaServer:!0})}catch{}try{const Eo=((Ft=da==null?void 0:da.rank)==null?void 0:Ft.category)??((Vn=Fr==null?void 0:Fr.rank)==null?void 0:Vn.category),Ou=((On=da==null?void 0:da.rank)==null?void 0:On.tiebreak)??((En=Fr==null?void 0:Fr.rank)==null?void 0:En.tiebreak)??[];typeof Eo=="number"?Eo===8&&Ou[0]===12?b("royal-flush",{displayMs:4e3}):Eo===8?b("straight-flush",{displayMs:3500}):Eo===7?b("quads",{displayMs:3e3}):Eo===6?b("full-house",{displayMs:2500}):Eo===5?b("flush",{displayMs:2500}):Eo===4&&b("straight",{displayMs:2500}):pn.length===1&&!Fr&&b("poker-bluff",{displayMs:2500})}catch{}}kt.current=Pn}}}catch{}try{const Pn=String((t==null?void 0:t.id)??(t==null?void 0:t.email)??""),pn=Array.isArray(Y.winners)?Y.winners:[];if(!pn.some(Ha=>String(Ha.playerId)===Pn)){let Ha=0;const Or=(Array.isArray((zn=S==null?void 0:S.gameState)==null?void 0:zn.pokerSeats)?S.gameState.pokerSeats:[]).find(Es=>String(Es.playerId||"")===Pn),Fr=Number((Or==null?void 0:Or.committed)||0),fn=Number((Or==null?void 0:Or.returned)||0);Fr>0&&(Ha=Math.max(0,Fr-(Number.isFinite(fn)?fn:0)));const tn=pn.find(Es=>Es&&Es.rank&&typeof Es.rank.category=="number"),to=tn?`Winner: ${or(tn.rank)}`:void 0,pl=Ha>0?`You lost: z${Ha}`:"You lost";try{L(()=>{try{N({kind:"lose",title:pl,subtitle:to})}catch{}try{f0()}catch{}try{b(v(),{displayMs:2e3})}catch{}})}catch{}}}catch{}try{const Pn=Number(ge||Ne||0);Pn&&ve.current!==Pn&&(ve.current=Pn,ye(!0),setTimeout(()=>ye(!1),5200))}catch{}const He=Array.isArray(re)&&re.length>0?re:[];if((ge||Ne)&&He.length>0){const Pn=Number(ge||Ne),pn=Array.isArray(Y.winners)?Y.winners:[],Ha=pn.reduce((Fn,Or)=>Fn+(Number(Or.amount)||0),0)||Number(((ba=(ns=S==null?void 0:S.gameState)==null?void 0:ns.wagerPool)==null?void 0:ba.totalAmount)||0)||0;Xe(Fn=>{var fn;const Or=Fn.findIndex(tn=>tn.roundSeq===Pn),Fr={roundSeq:Pn,ts:Date.now(),winners:pn.slice(),hands:He.slice(),pot:Ha,seats:Array.isArray((fn=S==null?void 0:S.gameState)==null?void 0:fn.pokerSeats)?S.gameState.pokerSeats.map(tn=>{var to,pl;return{playerId:tn.playerId,seatIndex:tn.seatIndex,status:tn.status,rank:((to=pn.find(Es=>Es.playerId===tn.playerId))==null?void 0:to.rank)||void 0,winnings:(pl=pn.find(Es=>Es.playerId===tn.playerId))==null?void 0:pl.amount}}):void 0};if(Or>=0){const tn=Fn.slice();return tn[Or]=Fr,tn}return[...Fn,Fr].slice(-20)})}try{s()}catch{}},onPokerTimedOut:Y=>{try{if(!Y||Y.roomId!==e)return;const ge=String((t==null?void 0:t.id)??(t==null?void 0:t.email)??"");if(Y.playerId!==ge)return;const Ne=Y.action==="check"?"auto-check":"auto-fold";Vb(`🕒 Timed out — ${Ne}`)}catch{}}}),l.useEffect(()=>{if(!n||!e)return;const Y=He=>{He.roomId===e&&(console.log("[poker] start_ready_update",He),Pr(He.readyPlayers||[]),Sr(He.requiredPlayers||[]),He.allReady&&(Pe(!1),Rt(0)))},ge=He=>{He.roomId===e&&(console.log("[poker] start_countdown",He),Rt(He.endsAt),Pr(He.readyPlayers||[]),Sr(He.requiredPlayers||[]))},Ne=He=>{He.roomId===e&&(console.log("[poker] start_countdown_cancelled",He),Rt(0),Qe(0))};return n.on("poker:start_ready_update",Y),n.on("poker:start_countdown",ge),n.on("poker:start_countdown_cancelled",Ne),()=>{n.off("poker:start_ready_update",Y),n.off("poker:start_countdown",ge),n.off("poker:start_countdown_cancelled",Ne)}},[n,e]),l.useEffect(()=>{if(!n||!e)return;const Y=ze=>{(ze==null?void 0:ze.roomId)===e&&(console.log("[poker:elimination] update",ze),ze.config&&Ke({enabled:!0,startingShields:ze.config.startingShields??3,maxTokens:ze.config.maxTokens??3}),ze.states&&wt(ze.states),ze.eliminatedOrder&&Dt(ze.eliminatedOrder))},ge=ze=>{if((ze==null?void 0:ze.roomId)!==e)return;console.log("[poker:elimination] eliminated",ze);const st=ze.place??"";if(ze.playerId===mt)try{N({kind:"lose",title:"Eliminated!",subtitle:`You finished in ${ER(st)} place`,duration:4e3})}catch{}},Ne=ze=>{var st,lt;if((ze==null?void 0:ze.roomId)===e&&(console.log("[poker:elimination] player_eliminated",ze),ze.playerId&&ze.playerId!==mt)){const Nt=((lt=(st=S==null?void 0:S.players)==null?void 0:st.find(Ft=>Ft.id===ze.playerId))==null?void 0:lt.name)||"A player";dr({text:`${Nt} eliminated!`,sub:ze.place?`${ER(ze.place)} place`:void 0}),setTimeout(()=>dr(null),3e3)}},He=ze=>{if((ze==null?void 0:ze.roomId)===e){console.log("[poker:elimination] gameover",ze),ft({winner:ze.winner,eliminatedOrder:ze.eliminatedOrder||[],finalStates:ze.finalStates||{}});try{ze.winner===mt?p0():f0()}catch{}}};return n.on("poker:elimination_update",Y),n.on("poker:eliminated",ge),n.on("poker:player_eliminated",Ne),n.on("poker:elimination_gameover",He),()=>{n.off("poker:elimination_update",Y),n.off("poker:eliminated",ge),n.off("poker:player_eliminated",Ne),n.off("poker:elimination_gameover",He)}},[n,e,mt,S==null?void 0:S.players]);const Lt=ot.useRef(0);l.useEffect(()=>{if(!n||!mt)return;const Y=ge=>{var Ne;!ge||((Ne=ge.winner)==null?void 0:Ne.userId)!==mt||(console.log("[poker] last man standing (server event)",{meId:mt,bonus:ge.bonus}),Je({winnerUserId:mt,bonus:ge.bonus??0}))};return n.on("poker:last_man_standing",Y),()=>{n.off("poker:last_man_standing",Y)}},[n,mt]),l.useEffect(()=>{const Y=S==null?void 0:S.gameState;if(!Y||!mt)return;const ge=Y.pokerPhase;if(ge!=="complete"&&ge!=="waiting")return;const Ne=Array.isArray(Y.pokerSeats)?Y.pokerSeats.filter(st=>!!(st!=null&&st.playerId)):[],He=Ne.filter(st=>(st.stack??0)>0);if(He.length!==1||He[0].playerId!==mt)return;const ze=Number(Y.pokerRoundSeq||0);ze<=0||ze===Lt.current||(Lt.current=ze,console.log("[poker] last man standing detected (client)",{meId:mt,roundSeq:ze,phase:ge,totalSeats:Ne.length,aliveSeats:He.length}),Je({winnerUserId:mt,bonus:0}))},[S==null?void 0:S.gameState,mt]),l.useEffect(()=>{if(!dt||dt<=Date.now()){Qe(0);return}const Y=()=>{const Ne=Math.max(0,Math.ceil((dt-Date.now())/1e3));Qe(Ne),Ne<=0&&Rt(0)};Y();const ge=setInterval(Y,1e3);return()=>clearInterval(ge)},[dt]);const nr=ot.useRef("waiting");l.useEffect(()=>{var ze;const Y=((ze=S==null?void 0:S.gameState)==null?void 0:ze.pokerPhase)||"waiting",ge=nr.current;nr.current=Y;const Ne=!["waiting","complete"].includes(Y),He=!["waiting","complete"].includes(ge);return(Ne||Y==="waiting"&&He)&&(Pr([]),Sr([]),Rt(0),Qe(0),Pe(!1)),He&&!Ne?($e(!0),clearTimeout(jt.current),jt.current=setTimeout(()=>$e(!1),1500)):Ne&&(clearTimeout(jt.current),$e(!1)),()=>clearTimeout(jt.current)},[(Lu=S==null?void 0:S.gameState)==null?void 0:Lu.pokerPhase]),l.useEffect(()=>{const Y=S==null?void 0:S.gameState;if(!Y)return;const ge=Y==null?void 0:Y.pokerPhase,Ne=Number((Y==null?void 0:Y.pokerRoundSeq)||0);if((ge||"")==="pre-flop"&&Ne>0&&Ne!==bt.current&&Ne!==Pt.current){if(console.log("[poker] triggering initial dealing animation for roundSeq",Ne),de(!1),we(!1),V.current&&V.current.length===2)if(De.current===0){De.current=Ne;try{const ze=typeof window<"u"?window:void 0;ze&&(ze.__pokerHoleDiag=ze.__pokerHoleDiag||[],ze.__pokerHoleDiag.push({kind:"assign_hole_round_on_initial_preflop",at:Date.now(),round:Ne}))}catch{}}else if(De.current!==Ne){$(null);try{const ze=typeof window<"u"?window:void 0;ze&&(ze.__pokerHoleDiag=ze.__pokerHoleDiag||[],ze.__pokerHoleDiag.push({kind:"clear_hole_initial_preflop",at:Date.now(),toRound:Ne,prevHoleRound:De.current}))}catch{}}else try{const ze=typeof window<"u"?window:void 0;ze&&(ze.__pokerHoleDiag=ze.__pokerHoleDiag||[],ze.__pokerHoleDiag.push({kind:"keep_hole_initial_preflop",at:Date.now(),round:Ne}))}catch{}else De.current=0;Pt.current=Ne,fr.current=Date.now(),oe(Ne);try{$d(["cardSwoosh"])}catch{}const He=Re.current!==Ne;He&&(Re.current=Ne),(async()=>{if(await Qg(["cardSwoosh"],900),Ae(!0),He)try{d0({volume:.6})}catch{}})()}},[S==null?void 0:S.gameState]),ot.useEffect(()=>{var Y;try{const ge=typeof window<"u"?window:void 0;if(!(!!ge&&(ge.__E2E===!0||typeof((Y=ge.location)==null?void 0:Y.search)=="string"&&ge.location.search.includes("e2e=1")||ge.sessionStorage&&ge.sessionStorage.getItem("e2e")==="1")))return;const He=(e||"").startsWith("e2e-"),ze=!S||!S.gameState||!Array.isArray(S.gameState.pokerSeats);if(!He||!ze||Ee.current)return;Ee.current=!0;try{window.__pokerFallbackArmed=Date.now()}catch{}const st=setTimeout(()=>{try{const lt=Date.now()%1e5,Nt={playerId:String(mt||i||"hero"),seatIndex:0,amount:120,rank:{category:1,tiebreak:[12,7,5,4,2]}},Ft=[{playerId:String(mt||i||"hero"),seatIndex:0,hole:["Ah","Ad"]},{playerId:"bot1",seatIndex:1,hole:["Kc","Qs"]},{playerId:"bot2",seatIndex:2,hole:["9h","9s"]},{playerId:"bot3",seatIndex:3,hole:["7d","6d"]}];xe([Nt]),pe(Ft),_e(lt);const Vn=`You: +z${Number(Nt.amount||0)}`,On=`Pot: z${Number(Nt.amount||0)}`,En=`${or(Nt.rank)} ${On}`;try{window.__pokerWinnersFlashed={title:Vn,subtitle:En,roundSeq:lt,at:Date.now(),__fallback:!0}}catch{}try{window.__pokerFallbackFired=Date.now()}catch{}}catch{}},5500);return()=>clearTimeout(st)}catch{}},[]),ot.useEffect(()=>{var Y;try{const ge=typeof window<"u"?window:void 0;if(!(!!ge&&(ge.__E2E===!0||typeof((Y=ge.location)==null?void 0:Y.search)=="string"&&ge.location.search.includes("e2e=1")||ge.sessionStorage&&ge.sessionStorage.getItem("e2e")==="1")))return;const He=setTimeout(()=>{try{if(window.__pokerWinnersFlashed)return;const ze=Date.now()%1e5,st={playerId:String(mt||i||"hero"),seatIndex:0,amount:80,rank:{category:1,tiebreak:[11,9,6,4,2]}},lt=[{playerId:String(mt||i||"hero"),seatIndex:0,hole:["As","Ad"]}];xe([st]),pe(lt),_e(ze);const Nt=`You: +z${Number(st.amount||0)}`,Ft=`Pot: z${Number(st.amount||0)}`,Vn=`${or(st.rank)} ${Ft}`;try{window.__pokerWinnersFlashed={title:Nt,subtitle:Vn,roundSeq:ze,at:Date.now(),__safety:!0}}catch{}}catch{}},1e4);return()=>clearTimeout(He)}catch{}},[I,mt,i]),l.useEffect(()=>{var Ne;const Y=(Ne=S==null?void 0:S.gameState)==null?void 0:Ne.pokerPhase,ge=["flop","turn","river","showdown"].includes(Y||"");D&&ge&&G&&G.length===2&&!K&&!he&&(we(!0),de(!0))},[S==null?void 0:S.gameState,G,K,he,D]),l.useEffect(()=>{var Ne;const ge=(((Ne=S==null?void 0:S.gameState)==null?void 0:Ne.pokerPhase)||"")==="pre-flop";if(D&&ge&&!he&&G&&G.length===2&&!K){we(!0);const He=setTimeout(()=>de(!0),220);return()=>clearTimeout(He)}},[he,S==null?void 0:S.gameState,G,K,D]),l.useEffect(()=>{if(!D||!G||G.length!==2||K)return;const Y=setTimeout(()=>{!U.current&&V.current&&V.current.length===2&&(we(!0),setTimeout(()=>de(!0),180))},300);return()=>clearTimeout(Y)},[D,G,K]),l.useEffect(()=>()=>{De.current=0},[]);const Mr=(S==null?void 0:S.name)||"Poker Room",Br=l.useMemo(()=>(Array.isArray(S==null?void 0:S.players)?S.players:[]).map(ge=>({id:String(ge.id??""),name:String(ge.name||ge.email||ge.id||""),balance:typeof ge.balance=="number"?ge.balance:0,avatarUrl:ge.avatarUrl||void 0})),[S==null?void 0:S.players]),wn=ot.useRef(0),Kt=l.useMemo(()=>{var On,En;if(!(S!=null&&S.singlePlayer))return;const Y=Array.isArray((On=S==null?void 0:S.gameState)==null?void 0:On.pokerSeats),ge=Y?S.gameState.pokerSeats:[],Ne=new Set(ge.map(zn=>String((zn==null?void 0:zn.playerId)??"")).filter(zn=>zn.startsWith("poker_bot_"))),He=new Set([...Ne,...Br.map(zn=>zn.id).filter(zn=>zn.startsWith("poker_bot_")),...Object.keys(Me).filter(zn=>zn.startsWith("poker_bot_"))]);wn.current=Math.max(wn.current,He.size);const ze=wn.current,st=Object.entries(Me).filter(([zn,ns])=>zn.startsWith("poker_bot_")&&(ns==null?void 0:ns.eliminated)).length,lt=Y?Math.max(st,ze-Ne.size):st,Nt=Number((S==null?void 0:S.spLevel)??(t==null?void 0:t.spLevelPoker)??1),Ft=Number.isFinite(Nt)&&Nt>0?Nt:1,Vn=(S==null?void 0:S.levelName)??((En=ul.find(zn=>zn.level===Ft))==null?void 0:En.name)??`Level ${Ft}`;return{level:Ft,levelName:Vn,current:lt,total:ze,progressLabel:`${lt}/${ze} bots eliminated`,goalLabel:`Eliminate every bot to reach Level ${Ft+1}`,isMaxLevel:Ft>=ul.length}},[S==null?void 0:S.singlePlayer,S==null?void 0:S.gameState,S==null?void 0:S.spLevel,S==null?void 0:S.levelName,Br,Me,t==null?void 0:t.spLevelPoker]);ot.useCallback((Y,ge)=>{var Ne;return((Ne=Br.find(He=>He.id===Y))==null?void 0:Ne.name)||`Seat ${ge+1}`},[Br]);const Jt=l.useMemo(()=>S!=null&&S.gameState?S.gameState:{gameMode:"poker",roundSeq:1},[S==null?void 0:S.gameState]);$fe({gameState:Jt,players:Br,winners:ee,hands:re,meId:mt});const[un]=l.useState(()=>Date.now()),Tn=l.useMemo(()=>{var ge;const Y=(ge=S==null?void 0:S.gameState)==null?void 0:ge.pokerPhase;return Y==="pre-flop"||Y==="flop"||Y==="turn"||Y==="river"||Y==="showdown"},[S==null?void 0:S.gameState]),Kr=Number(((Du=S==null?void 0:S.gameState)==null?void 0:Du.pokerUiLockedUntilTs)||0),Er=Kr>0&&Date.now()<Kr,yr=7e3,xn=ot.useRef(null);ot.useEffect(()=>{var ge;const Y=String(((ge=S==null?void 0:S.gameState)==null?void 0:ge.pokerPhase)||"");Er?xn.current==null&&(xn.current=Date.now()):Y==="waiting"&&(xn.current=null)},[Er,S==null?void 0:S.gameState]);const gn=xn.current??(fr.current||0),dn=gn>0?Date.now()-gn:Number.POSITIVE_INFINITY,Gr=Er&&dn<=yr,[,Sn]=ot.useReducer(Y=>Y+1,0);ot.useEffect(()=>{if(!Er)return;const Y=gn>0?gn+yr:Number.POSITIVE_INFINITY,ge=Kr>0?Kr:Number.POSITIVE_INFINITY,Ne=Math.min(Y,ge);if(!isFinite(Ne))return;const He=Math.max(0,Math.min(15e3,Math.ceil(Ne-Date.now()+2))),ze=window.setTimeout(()=>{try{Sn()}catch{}},He);return()=>{window.clearTimeout(ze)}},[Er,Kr,gn,yr]);const Gn=l.useMemo(()=>{const Y=(S==null?void 0:S.gameState)||{},ge=(Y==null?void 0:Y.pokerPhase)||"",Ne=Array.isArray(Y==null?void 0:Y.pokerCommunity)?Y.pokerCommunity:[];return ge==="flop"?Ne.length>=3&&![0,1,2].some(He=>Mt.has(He)):ge==="turn"?Ne.length>=4&&!Mt.has(3):ge==="river"?Ne.length>=5&&!Mt.has(4):!0},[S==null?void 0:S.gameState,Mt]),en=((So=S==null?void 0:S.gameState)==null?void 0:So.pokerPhase)||"",Ce=["showdown","complete"].includes(en),Bn=Date.now()-un<800||!Tn||he||Gr||!Gn||Ce,{isBettingStreet:xr,isHeroTurn:Zn,heroStatus:$n,toCall:Be,canCheck:ut,canCall:be,canBet:Se,canRaise:nt,showActions:it,minRaiseTo:Bt,currentBet:ir,heroStack:er,turnDeadlineTs:mr}=l.useMemo(()=>{const Y=(S==null?void 0:S.gameState)||{},ge=(Y==null?void 0:Y.pokerPhase)||"",Ne=["pre-flop","flop","turn","river"].includes(ge),ze=(Array.isArray(Y==null?void 0:Y.pokerSeats)?Y.pokerSeats:[]).find(Fn=>String(Fn.playerId)===String(mt)),st=typeof(Y==null?void 0:Y.pokerActingSeat)=="number"?Y.pokerActingSeat:void 0,lt=!!ze&&typeof st=="number"&&ze.seatIndex===st,Nt=Number((Y==null?void 0:Y.pokerCurrentBet)||0),Ft=Number((ze==null?void 0:ze.committed)||0),Vn=Number((ze==null?void 0:ze.stack)||0),On=String((ze==null?void 0:ze.status)||"active"),En=Math.max(0,Nt-Ft),zn=En===0&&On==="active",ns=En>0&&On==="active"&&Vn>0,ba=Nt===0&&On==="active"&&Vn>0,Pn=Nt>0&&On==="active"&&Vn>0,pn=Ne&&!!ze&&On==="active",ea=Number((Y==null?void 0:Y.pokerMinRaiseTo)||0),Ha=Number((Y==null?void 0:Y.pokerTurnDeadlineTs)||0)||void 0;return{isBettingStreet:Ne,isHeroTurn:lt,heroStatus:On,toCall:En,canCheck:zn,canCall:ns,canBet:ba,canRaise:Pn,showActions:pn,minRaiseTo:ea,currentBet:Nt,heroStack:Vn,turnDeadlineTs:Ha}},[S==null?void 0:S.gameState,mt]),hr=Bn||!Zn||$n!=="active",[J,$e]=l.useState(!1),jt=ot.useRef(void 0),Yt=l.useMemo(()=>{const Y=(S==null?void 0:S.gameState)||{},ge=(Y==null?void 0:Y.pokerPhase)||"waiting",Ne=Array.isArray(Y==null?void 0:Y.pokerSeats)?Y.pokerSeats:[];return["waiting","complete"].includes(ge)&&Ne.length>=2&&!he&&!Gr&&!!e&&!o&&!J},[S==null?void 0:S.gameState,he,Gr,e,o,J]),[Ot,Pe]=l.useState(!1),ht=l.useMemo(()=>{if(!e||!(S!=null&&S.singlePlayer))return!1;const Y=(S==null?void 0:S.gameState)||{},ge=(Y==null?void 0:Y.pokerPhase)||"waiting";if(ge!=="waiting"&&ge!=="complete")return!1;const Ne=Array.isArray(Y==null?void 0:Y.pokerSeats)?Y.pokerSeats.filter(ze=>!!(ze!=null&&ze.playerId)):[],He=Ne.find(ze=>String(ze.playerId||"")===mt);return!!(Ne.length<=1&&He||!He||He&&Number(He.stack||0)===0)},[S==null?void 0:S.gameState,S==null?void 0:S.singlePlayer,e,mt]),[It,Ct]=l.useState(!1),[pr,Pr]=l.useState([]),[Nr,Sr]=l.useState([]),Qr=l.useMemo(()=>pr.includes(mt),[pr,mt]),jn=ot.useCallback(()=>{q.current!=null&&(clearTimeout(q.current),q.current=null),X.current!=null&&(clearTimeout(X.current),X.current=null),Z.current=null},[]),[ca,es]=l.useState(0),Fa=ca,[In,ts]=l.useState(!1),[rs,Ma]=l.useState(null),ua=mt,Ni=!!Tn&&!he&&!(Array.isArray(re)&&re.length>0),[eo,ju]=l.useState({active:!1,key:0,indices:[]}),Mi=ot.useRef(0);l.useEffect(()=>{var He;const ge=(Array.isArray((He=S==null?void 0:S.gameState)==null?void 0:He.pokerCommunity)?S.gameState.pokerCommunity:[]).length,Ne=Mi.current;if(ge>Ne){const ze=Array.from({length:ge-Ne},(st,lt)=>Ne+lt);lr(st=>{const lt=new Set(st);return ze.forEach(Nt=>lt.add(Nt)),lt}),br.current&&(clearTimeout(br.current),br.current=null),br.current=window.setTimeout(()=>{ju({active:!0,key:Date.now(),indices:ze}),br.current=null},3e3),Mi.current=ge}else Mi.current=ge},[S==null?void 0:S.gameState]),ot.useEffect(()=>{const Y=je.current;if(!Y)return;Y.style.marginTop=Y.style.marginTop==="0px"?"0.01px":"0px";const ge=window.setTimeout(()=>{Y&&(Y.style.marginTop="")},0);return()=>window.clearTimeout(ge)},[he,K,ie,In]);const Li=(Y,ge)=>{!Y&&ge&&C("Poker",ge)},Iu=async()=>{if(!e)return;jn();const Y=await T(e);Li(Y==null?void 0:Y.ok,Y==null?void 0:Y.error)},Ss=async()=>{if(!e)return;jn();const Y=await R(e);Li(Y==null?void 0:Y.ok,Y==null?void 0:Y.error)},Nu=async()=>{if(!e)return;jn();const Y=await j(e);Li(Y==null?void 0:Y.ok,Y==null?void 0:Y.error)},Fb=()=>{hr||!Se||(Ma("bet"),ts(!0))},Mu=()=>{hr||!nt||(Ma("raise"),ts(!0))},Ub=async Y=>{if(!e||!rs)return;jn();let ge=Y??Fa;if(rs==="bet"){(!ge||ge<=0)&&(ge=Math.max(1,Bt||1));const Ne=Math.floor(ge),He=await P(e,Ne);Li(He==null?void 0:He.ok,He==null?void 0:He.error),He!=null&&He.ok&&(es(0),ts(!1),Ma(null))}else if(rs==="raise"){if(!ge||ge<=0){const ze=Math.max(0,Bt-ir);ge=Math.max(1,ze)}ge=Math.min(ge,Math.max(0,er));const Ne=Math.floor(ge),He=await k(e,Ne);Li(He==null?void 0:He.ok,He==null?void 0:He.error),He!=null&&He.ok&&(es(0),ts(!1),Ma(null))}},qb=()=>{es(0),ts(!1),Ma(null)},[ko,Di]=ot.useState(null),Vb=ot.useCallback(Y=>{try{const ge=Et(mt);ge&&Di({x:ge.x,y:Math.max(0,ge.y-70),text:Y});const Ne=document.querySelector(`li.player--avatar[data-player-id="${mt}"]`);Ne&&(Ne.classList.add("player--timeout"),setTimeout(()=>{try{Ne.classList.remove("player--timeout")}catch{}},2500)),setTimeout(()=>Di(null),2600)}catch{}},[Et,mt]);l.useEffect(()=>{(hr||!it)&&(ts(!1),Ma(null),es(0))},[hr,it]);const Zo=ot.useRef(0);return l.useEffect(()=>{const Y=S==null?void 0:S.gameState;if(!Y)return;const ge=Y==null?void 0:Y.pokerLastAction;if(!ge||typeof ge.seq!="number"||Zo.current===ge.seq)return;const Ne=String(ge.action||"").toLowerCase();if(!["bet","raise","call"].includes(Ne)){Zo.current=ge.seq;return}const He=Math.max(0,Number(ge.amountDelta||0));if(He<=0){Zo.current=ge.seq;return}const st=(Array.isArray(Y==null?void 0:Y.pokerSeats)?Y.pokerSeats:[]).find(Nt=>Nt.seatIndex===ge.seatIndex),lt=st!=null&&st.playerId?String(st.playerId):void 0;L(()=>{try{const Nt=Qt();if(!Nt)return;const Ft=lt?Et(lt):null;if(!Ft)return;const Vn=`poker-commit-${ge.seq}-${lt||ge.seatIndex}-${Date.now()}`;rt(On=>[...On,{id:`${Vn}-to-pot`,amount:He,fromId:lt||`seat:${ge.seatIndex}`,toId:"pot",startX:Ft.x,startY:Ft.y,endX:Nt.x,endY:Nt.y,startDelaySec:.1}])}catch{}}),Zo.current=ge.seq},[S==null?void 0:S.gameState,L,Et,ur]),a.jsxs(a.Fragment,{children:[a.jsx(Ja,{className:"page-poker-room"}),a.jsx(dO,{open:Te,onClose:tt,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"}),a.jsxs(y1,{showAvatarBacks:Ni,overlay:h?a.jsx(m1,{show:!0,contained:!0,variant:h.variant,displayMs:h.displayMs,zoomDurationMs:h.zoomDurationMs,fadeDurationMs:h.fadeDurationMs,ariaLabel:h.ariaLabel,onComplete:g}):null,header:a.jsx("div",{className:"poker-room-header",children:a.jsx(f1,{roomName:Mr,roomId:e,players:Br,meId:ua,gameState:Jt,lastRollerId:null,showHeader:!0,revealedHands:re,historyHalo:fe,singlePlayer:S==null?void 0:S.singlePlayer,campaignProgress:Kt,turnDeadlineTs:mr,isBettingStreet:xr,isHeroTurn:Zn,elimConfig:Oe,elimStates:Me,onOpenHistory:async()=>{var Y;if(Ge(!0),!!e)try{const ge=await E(e,20);if(ge!=null&&ge.ok&&Array.isArray((Y=ge==null?void 0:ge.data)==null?void 0:Y.items)){const Ne=ge.data.items;Xe(He=>{const ze=Ne.map(lt=>({roundSeq:Number(lt.seq||lt.roundSeq||0),ts:Number(lt.endedAt||lt.createdAt||Date.now()),pot:Number(lt.mainPot||lt.pot||0),winners:Array.isArray(lt.seats)?lt.seats.filter(Nt=>(Nt.winnings||0)>0).map(Nt=>({playerId:Nt.playerId,seatIndex:Nt.seatIndex,amount:Nt.winnings||0,rank:Nt.rank?Nt.rank:Nt.handRank!=null?{category:Nt.handRank,tiebreak:Nt.tiebreak||[]}:void 0})):[],hands:Array.isArray(lt.seats)?lt.seats.map(Nt=>({playerId:Nt.playerId,seatIndex:Nt.seatIndex,hole:Array.isArray(Nt.hole)?Nt.hole:Array.isArray(Nt.holeCards)?Nt.holeCards:[]})):[],seats:Array.isArray(lt.seats)?lt.seats.map(Nt=>({playerId:Nt.playerId,seatIndex:Nt.seatIndex,status:Nt.status,rank:Nt.rank?Nt.rank:Nt.handRank!=null?{category:Nt.handRank,tiebreak:Nt.tiebreak||[]}:void 0,winnings:Nt.winnings})):void 0})),st=new Map;for(const lt of[...He,...ze])st.set(lt.roundSeq,lt);return Array.from(st.values()).sort((lt,Nt)=>Nt.roundSeq-lt.roundSeq).slice(0,20)})}}catch(ge){console.warn("[poker] fetch_history failed",ge)}}})}),children:[a.jsx(SR,{enabled:he,handKey:Q,perCardSec:.6,staggerSec:.14,onComplete:()=>{Ae(!1);const Y=Pt.current;if(Y>0&&(bt.current=Y),G&&!K&&(we(!0),setTimeout(()=>de(!0),200)),z.current!=null){try{clearTimeout(z.current)}catch{}z.current=null}try{const ge=typeof window<"u"?window:void 0;ge&&(ge.__pokerHoleDiag=ge.__pokerHoleDiag||[],ge.__pokerHoleDiag.push({kind:"dealing_complete",at:Date.now()}))}catch{}}}),a.jsx(SR,{enabled:eo.active,handKey:`board-${eo.key}`,perCardSec:.5,staggerSec:.12,passes:1,getTargets:Y=>{var ge;try{const Ne=Y.getBoundingClientRect(),He=(ge=Y.ownerDocument)==null?void 0:ge.querySelector(".poker-board");if(!He)return[];const ze=Array.from(He.querySelectorAll(".poker-card"));return eo.indices.map(lt=>{const Nt=ze[lt];if(!Nt)return null;const Ft=Nt.getBoundingClientRect();return{x:(Ft.left+Ft.right)/2-Ne.left,y:(Ft.top+Ft.bottom)/2-Ne.top}}).filter(Boolean)}catch{return[]}},onComplete:()=>{const Y=eo.indices.slice();if(ju(ge=>({...ge,active:!1})),Y.length>0){lr(Ne=>{const He=new Set(Ne);return Y.forEach(ze=>He.add(ze)),He});const ge=window.setTimeout(()=>{lr(Ne=>{const He=new Set(Ne);return Y.forEach(ze=>He.delete(ze)),He})},250);zt.current.push(ge)}}}),a.jsxs("div",{className:"poker-mock",children:[ht&&!Yt&&a.jsx("div",{className:"poker-start-hand",children:a.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",It?"is-busy":""].filter(Boolean).join(" "),"aria-label":"Play Again",disabled:It,onClick:async()=>{var Y,ge,Ne;if(!It){try{const{hapticClick:He}=await Cr(async()=>{const{hapticClick:ze}=await Promise.resolve().then(()=>q0);return{hapticClick:ze}},void 0,import.meta.url);He("Medium")}catch{}Ct(!0);try{const{loadSettings:He}=await Cr(async()=>{const{loadSettings:Vn}=await Promise.resolve().then(()=>gI);return{loadSettings:Vn}},void 0,import.meta.url),ze=await He(),st=ze.botDifficultyLevel&&ze.botDifficultyLevel>=1&&ze.botDifficultyLevel<=9?ze.botDifficultyLevel:void 0,lt=await w({name:"Single Player Room",singlePlayer:!0,botLevel:st}),Nt=(lt==null?void 0:lt.room)??((Y=lt==null?void 0:lt.roomsList)==null?void 0:Y.room)??((ge=lt==null?void 0:lt.data)==null?void 0:ge.room)??null,Ft=(Nt==null?void 0:Nt.roomId)??(Nt==null?void 0:Nt.id)??(lt==null?void 0:lt.roomId)??((Ne=lt==null?void 0:lt.data)==null?void 0:Ne.roomId);if(Ft){try{window.__PRESEEDED_ROOM=Nt}catch{}M(`/poker/room/${Ft}`,{replace:!0})}else{console.warn("[poker:play_again] no room id in response",lt);try{C("Poker",(lt==null?void 0:lt.error)||"Unable to create room")}catch{}Ct(!1)}}catch(He){console.error("[poker:play_again] error",He);try{C("Poker","Unable to create room")}catch{}Ct(!1)}}},children:"Play Again"})}),Yt&&a.jsxs("div",{className:"poker-start-hand",children:[jr>0&&a.jsxs("div",{className:"poker-start-hand__countdown",children:["Starting in ",jr,"s"]}),Nr.length>1&&a.jsxs("div",{className:"poker-start-hand__readiness",children:[pr.length,"/",Nr.length," ready"]}),a.jsx("button",{type:"button",className:["gold-link","poker-start-hand__btn",Ot?"is-busy":"",Qr?"is-ready":""].filter(Boolean).join(" "),"aria-label":Qr?"Waiting for others":"Start Hand",disabled:Ot||Qr,onClick:async()=>{if(e){try{const{hapticClick:Y}=await Cr(async()=>{const{hapticClick:ge}=await Promise.resolve().then(()=>q0);return{hapticClick:ge}},void 0,import.meta.url);Y("Medium")}catch{}console.log("[poker:start_hand] button clicked",{roomId:e}),Pe(!0);try{const Y=await _(e);if(console.log("[poker:start_hand] response",Y),Y!=null&&Y.countdown&&(console.log("[poker:start_hand] countdown started",{endsAt:Y==null?void 0:Y.countdown}),Rt(Y==null?void 0:Y.countdown)),Y!=null&&Y.waiting){console.log("[poker:start_hand] waiting for other players",{readyPlayers:Y==null?void 0:Y.readyPlayers,requiredPlayers:Y==null?void 0:Y.requiredPlayers}),Pr((Y==null?void 0:Y.readyPlayers)||[]),Sr((Y==null?void 0:Y.requiredPlayers)||[]);return}if(!(Y!=null&&Y.ok)){console.warn("[poker:start_hand] error response",Y);try{C("Poker",(Y==null?void 0:Y.error)||"Unable to start hand")}catch{}}Pe(!1)}catch(Y){console.error("[poker:start_hand] exception",Y);try{C("Poker","Unable to start hand")}catch{}Pe(!1)}}},children:Qr?"✓ Ready":"Start Hand"})]}),a.jsxs("div",{className:"poker-mock__table",children:[a.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),a.jsxs("div",{className:"poker-board-wrap",children:[a.jsx("div",{className:"poker-pot","aria-label":"poker-pot",ref:le,style:Ie?void 0:{visibility:"hidden"},children:(()=>{var Ne;const Y=Number(((Ne=Jt==null?void 0:Jt.wagerPool)==null?void 0:Ne.totalAmount)||0),ge=p1(Y);return Object.entries(ge.reduce((He,ze)=>{const st=String(ze);return He[st]=(He[st]||0)+1,He},{})).sort((He,ze)=>Number(ze[0])-Number(He[0])),a.jsx("div",{className:"poker-pot__wrap",children:a.jsxs("div",{className:"poker-pot__context","aria-live":"polite",children:[a.jsxs("span",{className:"poker-pot__stack-info",children:["You: z",er]}),a.jsx("span",{className:"poker-pot__divider","aria-hidden":"true",children:"•"}),a.jsxs("span",{className:`poker-pot__pot-info ${Be>0&&er>0&&Be/er>=.25?"poker-pot__pot-info--high":""}`,children:[Be>0?`To Call: z${Be}`:`Pot: z${Y}`,Be>0&&er>0&&Be/er>=.5&&a.jsxs("span",{className:"poker-pot__high-pct","aria-label":"High percentage of stack",children:[Math.round(Be/er*100),"%"]})]})]})})})()}),a.jsx(lme,{boardCards:Array.isArray((Oi=S==null?void 0:S.gameState)==null?void 0:Oi.pokerCommunity)?S.gameState.pokerCommunity:[]}),a.jsx("div",{className:"poker-board poker-community","aria-label":"community-cards",children:Array.isArray((jp=S==null?void 0:S.gameState)==null?void 0:jp.pokerCommunity)&&S.gameState.pokerCommunity.map((Y,ge)=>{const Ne=Mt.has(ge)||ge>=(Mi.current||0),He=S.gameState.pokerCommunity,ze=ime(ge),st=sme(He,ge),lt=ze==="river"&&He.length===5;return a.jsx(pme,{value:Y,concealed:Ne,position:ze,isPaired:st,animateEntrance:lt&&!Ne},`${Y}-${ge}`)})}),Array.isArray((ic=S==null?void 0:S.gameState)==null?void 0:ic.pokerCommunity)&&S.gameState.pokerCommunity.length>0&&(()=>{const Y=S.gameState.pokerCommunity;return b1(Y).length>0?a.jsxs("div",{className:"poker-hole__board-hint","aria-label":"Board is paired",title:"Paired board",children:[a.jsx("span",{className:"poker-hole__board-icon","aria-hidden":"true",children:"≡"}),a.jsx("span",{className:"poker-hole__board-text",children:"Paired Board"})]}):null})(),a.jsx("div",{className:["poker-hole",he?"poker-hole--concealed":"",K?"is-revealed":"",!K&&ie?"is-partial":"",Zn&&!hr?"poker-hole--active-turn":""].filter(Boolean).join(" "),"aria-label":"hole-cards",ref:se,children:a.jsxs("div",{className:"poker-hole-stack",children:[a.jsx("div",{className:"poker-hole-label","aria-hidden":!0,children:"--"}),ie,K,a.jsx(vO,{cards:G,firstRevealed:!!ie,bothRevealed:!!K})]})})]}),ko&&a.jsx("div",{className:"poker-timeout-toast","aria-live":"polite",style:{position:"fixed",left:ko.x,top:ko.y,transform:"translate(-50%, -100%)"},children:ko.text})]}),Le&&a.jsx(eme,{players:Br,entries:_t,onClose:()=>Ge(!1)}),et.length>0&&a.jsx(aO,{anim:et[0],onComplete:()=>{et[0],rt(Y=>Y.slice(1))}},et[0].id)]}),a.jsxs("div",{className:"poker-actions-wrap",ref:je,children:[a.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented",Zn&&!hr?"poker-actions--halo":""].filter(Boolean).join(" "),role:"group","aria-label":"Action buttons","aria-disabled":hr||void 0,children:[ut&&a.jsx(yi,{label:"Check",ariaLabel:"Check",size:"md",disabled:hr,onClick:Iu,className:"poker-action--flat poker-action--secondary poker-action--check"}),!ut&&be&&a.jsx(yi,{label:"Call",subtitle:`z${Be}`,ariaLabel:`Call ${Be}`,size:"md",disabled:hr,onClick:Ss,className:"poker-action--flat poker-action--primary poker-action--call"}),Se&&a.jsx(yi,{label:"Bet",subtitle:Fa>0?`z${Fa}`:void 0,ariaLabel:"Bet",size:"md",disabled:hr,onClick:Fb,className:"poker-action--green poker-action--secondary poker-action--bet"}),!Se&&nt&&a.jsx(yi,{label:"Raise",subtitle:Fa>0?`z${Fa}`:void 0,ariaLabel:"Raise",size:"md",disabled:hr,onClick:Mu,className:["poker-action--green","poker-action--secondary","poker-action--raise",rs==="raise"&&In?"raise-active":""].filter(Boolean).join(" ")}),$n==="active"&&a.jsx(yi,{label:"Fold",ariaLabel:"Fold",size:"md",disabled:hr,onClick:Nu,className:"poker-action--flat poker-action--danger poker-action--fold"})]}),a.jsx("div",{className:"poker-chiprack",style:In?void 0:{visibility:"hidden",pointerEvents:"none"},children:a.jsx(iD,{onPlaceBet:Ub,onCancelBet:qb,disabled:hr,defaultValue:Math.max(1,Bt||1),max:er>0?er:void 0})})]})]}),wr&&a.jsxs("div",{className:"elim-toast",children:[a.jsx("div",{className:"elim-toast__text",children:wr.text}),wr.sub&&a.jsx("div",{className:"elim-toast__sub",children:wr.sub})]}),Ut&&a.jsx(cme,{winner:Ut.winner,eliminatedOrder:Ut.eliminatedOrder,finalStates:Ut.finalStates,nameOf:Y=>{const ge=Br.find(Ne=>Ne.id===Y);return(ge==null?void 0:ge.name)||Y.slice(0,6)},meId:ua,onDismiss:()=>ft(null)}),Vt&&a.jsx(mO,{winnerName:(()=>{var ge;const Y=Br.find(Ne=>Ne.id===Vt.winnerUserId);return(Y==null?void 0:Y.name)||((ge=Vt.winnerUserId)==null?void 0:ge.slice(0,6))||"Winner"})(),bonus:Vt.bonus,isHero:Vt.winnerUserId===ua,onDismiss:()=>Je(null)})]})}function _1(){const e=Hr(),{user:t}=Zr(),[r,n]=l.useState(!1),s=(()=>{var i;try{return window.location.search.includes("e2e=1")||window.__E2E===!0||((i=window.sessionStorage)==null?void 0:i.getItem("e2e"))==="1"}catch{return!1}})(),o=l.useCallback(()=>{if(!(Number((t==null?void 0:t.balance)??0)>=1e3)){n(!0);return}const c=`e2e-${Math.random().toString(36).slice(2,8)}`;e(`/poker/room/${c}?m=poker`)},[e,t==null?void 0:t.balance]);return a.jsxs(y1,{header:a.jsx("div",{className:"poker-room-header",role:"banner",children:a.jsx("h1",{className:"poker-title","aria-label":"Poker Room",children:"Poker"})}),children:[s&&a.jsx("div",{className:"poker-room-controls",role:"group","aria-label":"poker e2e controls",children:a.jsx("button",{type:"button",onClick:o,"aria-label":"Create Game",children:"Create Game"})}),s&&a.jsx("div",{className:"poker-actions-wrap",children:a.jsxs("div",{className:["poker-actions","poker-actions--group","poker-actions--segmented","poker-actions--halo"].join(" "),role:"group","aria-label":"Action buttons",children:[a.jsx(Ff,{label:"Check",ariaLabel:"Check",size:"md",onClick:()=>{},className:"poker-action--flat"}),a.jsx(Ff,{label:"Bet",ariaLabel:"Bet",size:"md",onClick:()=>{},className:"poker-action--flat"}),a.jsx(Ff,{label:"Fold",ariaLabel:"Fold",size:"md",onClick:()=>{},className:"poker-action--flat poker-action--fold"})]})})]})}const hc=(e,t)=>({rank:e,suit:t}),Yp={name:"Texas Hold’em",pot:295,community:[hc("5","♠"),hc("8","♦"),hc("A","♣"),hc("10","♣"),hc("2","♥")],players:[{id:"p1",name:"Hero",stack:295,bet:25,isHero:!0,isActing:!0,hole:[hc("K","♠"),hc("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}]},fme=[{kind:"call",amount:25},{kind:"fold"},{kind:"check"},{kind:"bet",amount:0},{kind:"raise",to:0}];function PR(e){switch(e.kind){case"check":return"CHECK";case"fold":return"FOLD";case"call":return"CALL";case"bet":return e.amount&&e.amount>0?`BET ${e.amount}`:"BET";case"raise":return e.to&&e.to>0?`RAISE ${e.to}`:"RAISE"}}function CR(e){return`${e.rank}${e.suit}`}function mme(e={1:0,5:0,10:0,25:0,100:0,500:0}){const[t,r]=l.useState(e),n=l.useMemo(()=>nO.reduce((c,u)=>c+u*(t[u]??0),0),[t]),s=l.useCallback(c=>{r(u=>({...u,[c]:(u[c]??0)+1}))},[]),o=l.useCallback(c=>{r(u=>u[c]?{...u,[c]:0}:u)},[]),i=l.useCallback(()=>{r({1:0,5:0,10:0,25:0,100:0,500:0})},[]);return{rack:t,totalAmount:n,addChip:s,clearChip:o,clearAllChips:i}}function w1(){const{user:e}=Zr(),[t,r]=ot.useState(!1),n=Yp.players.find(m=>m.isHero),s=Yp.players.map(m=>({id:m.id,name:m.name,balance:m.bet??0})),o={gameMode:"poker"},i=typeof window<"u"&&window.location.search.includes("e2e=1"),{rack:c,totalAmount:u,addChip:p,clearChip:d,clearAllChips:f}=mme();return a.jsx(a.Fragment,{children:a.jsx(y1,{header:a.jsx("div",{className:"poker-room-header",children:a.jsx(f1,{roomName:Yp.name,players:s,meId:n.id,gameState:o,lastRollerId:null,showHeader:!0})}),children:a.jsxs("div",{className:"poker-mock",children:[i&&a.jsx("div",{className:"poker-e2e-bar",children:a.jsx("button",{className:"felt-btn","aria-label":"Create Game",onClick:()=>{if(!(Number((e==null?void 0:e.balance)??0)>=1e3)){r(!0);return}const h="e2e_"+Math.random().toString(36).slice(2,8);window.location.assign(`/poker/room/${h}`)},children:"Create Game"})}),a.jsxs("div",{className:"poker-mock__table",children:[a.jsx("div",{className:"poker-mock__table-ring","aria-hidden":!0}),a.jsx("div",{className:"poker-board",children:Yp.community.map((m,h)=>{const b=m.suit==="♥"||m.suit==="♦";return a.jsxs("div",{className:["poker-card",b?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":CR(m),children:[a.jsx("span",{className:"poker-card__rank",children:m.rank}),a.jsx("span",{className:"poker-card__suit",children:m.suit})]},h)})}),a.jsxs("div",{className:"poker-pot",children:["$",Yp.pot]})]}),(n==null?void 0:n.hole)&&a.jsx("div",{className:"poker-hole",children:n.hole.map((m,h)=>{const b=m.suit==="♥"||m.suit==="♦";return a.jsxs("div",{className:["poker-card",b?"poker-card--red":""].filter(Boolean).join(" "),"aria-label":CR(m),children:[a.jsx("span",{className:"poker-card__rank",children:m.rank}),a.jsx("span",{className:"poker-card__suit",children:m.suit})]},h)})}),a.jsx("div",{className:"poker-actions-wrap",children:a.jsx("div",{className:"poker-actions",children:fme.map((m,h)=>a.jsx(Ff,{label:PR(m),ariaLabel:PR(m),size:"md",onClick:()=>{}},h))})}),a.jsx("div",{className:"poker-chiprack",children:a.jsx(bO,{selectedTimes:c,onAdd:p,onClear:d,onPlaceBet:()=>{f()},onCancelBet:()=>{f()},disabled:!1,collapsed:!1,miniChips:!0,mainAmt:u,betTokenProps:{isBanker:!1,meId:n.id,open:[],players:s,show:!0}})})]})})})}function xO(){const e=Math.floor(Math.random()*6)+1,t=Math.floor(Math.random()*6)+1;return[e,t]}function AO(e){return e[0]===e[1]}function hme(e,t,r){const n=(e+t)%r,s=e+t>=r;return{newTile:n,passedStart:s}}function gme(e,t,r){const n=[];let s=e;for(;s!==t;)s=(s+1)%r,n.push(s);return n}function yme(e,t){return{...e,credits:e.credits+t.passStartBonus}}function bme(e,t,r){const n=t[0]+t[1],{newTile:s,passedStart:o}=hme(e.tileIndex,n,r.tileCount),i=gme(e.tileIndex,s,r.tileCount);let c={...e,tileIndex:s};return o&&(c=yme(c,r)),{player:c,passedStart:o,path:i}}function Uf(e,t){return{...e,tileIndex:t,inJail:!0,jailTurnsLeft:3}}function vme(e,t,r){if(AO(t))return{player:{...e,inJail:!1,jailTurnsLeft:0},escaped:!0,method:"roll-doubles"};const n=e.jailTurnsLeft-1;return n<=0?{player:{...e,inJail:!1,jailTurnsLeft:0,credits:e.credits-r},escaped:!0,method:"pay"}:{player:{...e,jailTurnsLeft:n},escaped:!1,method:null}}function _me(e,t){return{...e,inJail:!1,jailTurnsLeft:0,credits:e.credits-t}}function wme(e,t,r){return t.filter(n=>{var s;return n.ownerId===e&&!n.dormant&&((s=r[n.tileId])==null?void 0:s.type)==="station"}).length}function xme(e,t,r,n){return e.rent?e.rent[t.upgradeLevel]??e.rent[0]??0:0}function Ame(e,t,r){const n=wme(e,t,r);return n<=0?0:25*Math.pow(2,n-1)}const kme=[{text:"Intercepted enemy supply convoy! Gain 150 energy.",amount:150},{text:"Asteroid barrage hit your fleet! Lose 100 energy for repairs.",amount:-100},{text:"Stealth mission success. Gain 50 energy.",amount:50},{text:"Hull breach from enemy fire! Lose 200 energy for repairs.",amount:-200},{text:"Salvaged weapons from derelict warship. Gain 75 energy.",amount:75},{text:"Debris field damaged shields! Lose 50 energy for repairs.",amount:-50},{text:"Black market intel sold for profit. Gain 120 energy.",amount:120},{text:"Pirate ambush in the asteroid belt! Lose 80 energy.",amount:-80},{text:"Discovered rare mineral deposit. Gain 200 energy.",amount:200},{text:"Navigation error caused fuel waste. Lose 60 energy.",amount:-60},{text:"Bounty collected on rogue warship. Gain 100 energy.",amount:100},{text:"Emergency hull patching required. Lose 150 energy.",amount:-150},{text:"Captured enemy communications array. Gain 80 energy.",amount:80},{text:"Micro-meteorite swarm impact! Lose 40 energy.",amount:-40},{text:"Sold surplus munitions to allied fleet. Gain 60 energy.",amount:60},{text:"Engine coolant leak detected. Lose 120 energy for repairs.",amount:-120},{text:"Warp jump to Zentara!",amount:0,moveTo:39},{text:"Hyperspace route locked to Ross 128b.",amount:0,moveTo:16},{text:"Fleet recall to Trappist-1d.",amount:0,moveTo:11},{text:"Advance to nearest Outpost. If unowned, you may claim it.",amount:0,moveToNearest:"station"},{text:"Advance to nearest Outpost. If unowned, you may claim it.",amount:0,moveToNearest:"station"},{text:"Warp malfunction! Go back 3 tiles.",amount:0,moveRelative:-3},{text:"Report to Command Base.",amount:0,moveTo:0},{text:"Detained by Galactic Authority! Entering Cryosleep.",amount:0,goToJail:!0}],Sme=[{text:"Intercepted enemy supply convoy! Gain 150 energy.",amount:150},{text:"Asteroid barrage hit your fleet! Lose 100 energy for repairs.",amount:-100},{text:"Stealth mission success. Gain 50 energy.",amount:50},{text:"Hull breach from enemy fire! Lose 200 energy for repairs.",amount:-200},{text:"Salvaged weapons from derelict warship. Gain 75 energy.",amount:75},{text:"Debris field damaged shields! Lose 50 energy for repairs.",amount:-50},{text:"Black market intel sold for profit. Gain 120 energy.",amount:120},{text:"Pirate ambush in the asteroid belt! Lose 80 energy.",amount:-80},{text:"Discovered rare mineral deposit. Gain 200 energy.",amount:200},{text:"Navigation error caused fuel waste. Lose 60 energy.",amount:-60},{text:"Bounty collected on rogue warship. Gain 100 energy.",amount:100},{text:"Emergency hull patching required. Lose 150 energy.",amount:-150},{text:"Warp jump to Zentara!",amount:0,moveTo:19},{text:"Hyperspace route to Tau Ceti f.",amount:0,moveTo:8},{text:"Fleet recall to Trappist-1f.",amount:0,moveTo:6},{text:"Advance to nearest Outpost. If unowned, you may claim it.",amount:0,moveToNearest:"station"},{text:"Warp malfunction! Go back 3 tiles.",amount:0,moveRelative:-3},{text:"Report to Command Base.",amount:0,moveTo:0},{text:"Detained by Galactic Authority! Entering Cryosleep.",amount:0,goToJail:!0}],Eme=[{text:"War council grants reinforcements. Gain 200 energy.",amount:200},{text:"Fleet maintenance overdue. Lose 150 energy.",amount:-150},{text:"Weapons upgrade bonus. Gain 100 energy.",amount:100},{text:"Tactical systems overhaul. Lose 75 energy.",amount:-75},{text:"Arms trade dividend. Gain 50 energy.",amount:50},{text:"Reactor core replacement. Lose 125 energy.",amount:-125},{text:"Allied fleet sent tribute. Gain 175 energy.",amount:175},{text:"Crew quarantine protocol activated. Lose 90 energy.",amount:-90},{text:"Nebula sensor array detected hidden cache. Gain 125 energy.",amount:125},{text:"Life support systems failing. Lose 110 energy.",amount:-110},{text:"Diplomatic envoy rewarded your empire. Gain 80 energy.",amount:80},{text:"Fuel depot contamination. Lose 60 energy for cleanup.",amount:-60},{text:"Recovered escape pod with classified data. Gain 150 energy.",amount:150},{text:"Gravity well anomaly damaged thrusters. Lose 100 energy.",amount:-100},{text:"Resource tithe from conquered sector. Gain 90 energy.",amount:90},{text:"Ion storm fried navigation circuits. Lose 175 energy.",amount:-175},{text:"Shore leave approved. Report to Command Base.",amount:0,moveTo:0},{text:"Detained for smuggling contraband! Entering Cryosleep.",amount:0,goToJail:!0},{text:"Emergency warp to Gliese 667Cc for repairs.",amount:0,moveTo:21},{text:"Navigate to Pandora for a diplomatic summit.",amount:0,moveTo:37}],Pme=[{text:"War council grants reinforcements. Gain 200 energy.",amount:200},{text:"Fleet maintenance overdue. Lose 150 energy.",amount:-150},{text:"Weapons upgrade bonus. Gain 100 energy.",amount:100},{text:"Tactical systems overhaul. Lose 75 energy.",amount:-75},{text:"Arms trade dividend. Gain 50 energy.",amount:50},{text:"Reactor core replacement. Lose 125 energy.",amount:-125},{text:"Allied fleet sent tribute. Gain 175 energy.",amount:175},{text:"Crew quarantine protocol activated. Lose 90 energy.",amount:-90},{text:"Shore leave approved. Report to Command Base.",amount:0,moveTo:0},{text:"Detained for smuggling contraband! Entering Cryosleep.",amount:0,goToJail:!0},{text:"Emergency warp to Gliese 581g for repairs.",amount:0,moveTo:11}];function x1(e,t,r,n){const s=n.length<=20;switch(e.type){case"planet":{const o=r.find(c=>c.tileId===e.id);if(!o)return{tileId:e.id,action:"buy-prompt",amount:e.cost};if(o.ownerId===t.id||o.dormant)return{tileId:e.id,action:"none"};const i=xme(e,o);return{tileId:e.id,action:"energy-toll",amount:i}}case"station":{const o=r.find(c=>c.tileId===e.id);if(!o)return{tileId:e.id,action:"buy-prompt",amount:e.cost};if(o.ownerId===t.id||o.dormant)return{tileId:e.id,action:"none"};const i=Ame(o.ownerId,r,n);return{tileId:e.id,action:"energy-toll",amount:i}}case"void-drain":return{tileId:e.id,action:"void-drain",amount:100};case"go-to-jail":return{tileId:e.id,action:"go-to-jail"};case"wormhole":{const o=n.filter(p=>p.type==="wormhole").sort((p,d)=>p.id-d.id),i=o.findIndex(p=>p.id===e.id),c=i>=0?i%2===0?i+1:i-1:-1,u=c>=0?o[c]:void 0;return{tileId:e.id,action:"wormhole",targetTile:(u==null?void 0:u.id)??e.id}}case"asteroid":{const o=s?Sme:kme,i=o[Math.floor(Math.random()*o.length)],c={tileId:e.id,action:"draw-card",amount:i.amount,cardText:i.text};if(i.goToJail)c.cardGoToJail=!0;else if(i.moveTo!==void 0)c.cardMoveTo=i.moveTo;else if(i.moveToNearest==="station"){const u=n.filter(d=>d.type==="station").map(d=>d.id).sort((d,f)=>d-f),p=u.filter(d=>d>t.tileIndex);c.cardMoveTo=p.length>0?p[0]:u[0]}else i.moveRelative!==void 0&&(c.cardMoveTo=((t.tileIndex+i.moveRelative)%n.length+n.length)%n.length);return c}case"nebula":{const o=s?Pme:Eme,i=o[Math.floor(Math.random()*o.length)],c={tileId:e.id,action:"draw-card",amount:i.amount,cardText:i.text};return i.goToJail?c.cardGoToJail=!0:i.moveTo!==void 0&&(c.cardMoveTo=i.moveTo),c}default:return{tileId:e.id,action:"none"}}}function kO(e){const t=e.findIndex(r=>r.type==="jail");return t>=0?t:10}function SO(e){return{playerId:e,phase:"pre-roll",diceValues:null,doublesCount:0,rolledDoubles:!1,landedTile:null,strikeUsed:!1}}function Cme(e,t){var y,x,v,A;const r=[];if(e.finished||e.currentTurn.phase!=="pre-roll")return{state:e,events:r,effect:null};const n={...e.currentTurn},s=e.players.findIndex(_=>_.id===n.playerId);if(s===-1)return{state:e,events:r,effect:null};if(e.players[s].depleted)return{state:e,events:r,effect:null};const o={...an,tileCount:e.board.length},i=kO(e.board);let c={...e.players[s]};const u=t??xO();n.diceValues=u,r.push({type:"roll",playerId:c.id,dice:u});const p=AO(u);if(n.doublesCount=p?n.doublesCount+1:0,n.rolledDoubles=p,n.doublesCount>=3){c=Uf(c,i),r.push({type:"jail",playerId:c.id,reason:"triple-doubles"}),n.phase="done",n.landedTile=i;const _=[...e.players];return _[s]=c,{state:{...e,players:_,currentTurn:n,pendingEffect:null},events:r,effect:null}}if(c.inJail){const{player:_,escaped:w,method:j}=vme(c,u,o.jailBailCost);if(c=_,!w){n.phase="done";const T=[...e.players];return T[s]=c,{state:{...e,players:T,currentTurn:n,pendingEffect:null},events:r,effect:null}}r.push({type:"jail-free",playerId:c.id,method:j})}const{player:d,passedStart:f}=bme(c,u,o);c=d,r.push({type:"move",playerId:c.id,from:e.players[s].tileIndex,to:c.tileIndex,passedStart:f}),n.landedTile=c.tileIndex,n.phase="landed";const m=[...e.players];m[s]=c;const h=e.board[c.tileIndex],b=h?x1(h,c,e.properties,e.board):null;if(b&&b.action==="go-to-jail")return r.push({type:"jail",playerId:c.id,reason:"go-to-jail"}),n.phase="landed",m[s]=c,{state:{...e,players:m,currentTurn:n,pendingEffect:null,pendingTeleport:{playerId:c.id,targetTile:i,reason:"go-to-jail",postPhase:"done"}},events:r,effect:null};if(b&&b.action==="wormhole"&&b.targetTile!=null)return n.phase="landed",m[s]=c,{state:{...e,players:m,currentTurn:n,pendingEffect:null,pendingTeleport:{playerId:c.id,targetTile:b.targetTile,reason:"wormhole",postPhase:p?"pre-roll":"done"}},events:r,effect:null};!b||b.action==="none"?n.phase=p?"pre-roll":"done":n.phase="action";let g=b??null;if(g&&g.action==="energy-toll"){const _=e.properties.find(j=>j.tileId===g.tileId),w=_?e.players.find(j=>j.id===_.ownerId):null;if(c.heroId&&Ta[c.heroId]&&(w!=null&&w.heroId)&&Ta[w.heroId]){const j=e.board[g.tileId],T=j==null?void 0:j.group;T&&e.board.map((k,E)=>k.group===T?E:-1).filter(k=>k>=0).every(k=>e.properties.some(E=>E.tileId===k&&E.ownerId===_.ownerId))&&(g={...g,action:"hero-clash"})}}if(!((y=e.gameRules)!=null&&y.disableSpyStrike)&&h&&h.type==="planet"&&h.group&&((x=e.spies)!=null&&x[h.group])){const _=h.group,w=e.spies[_],j=((v=e.spyKinds)==null?void 0:v[_])??"monopoly";if(w===c.id){const T=e.properties.find(E=>E.tileId===h.id),R=T==null?void 0:T.ownerId,P=j==="foothold";let k;if(P)if(R&&R!==c.id)k=R;else{const E=e.board.filter(N=>N.group===_),M=new Map;for(const N of E){const S=(A=e.properties.find(D=>D.tileId===N.id))==null?void 0:A.ownerId;if(!S||S===c.id)continue;const F=M.get(S);F?F.count+=1:M.set(S,{count:1,firstTile:N.id})}let C,I=0,L=Number.POSITIVE_INFINITY;for(const[N,S]of M)(S.count>I||S.count===I&&S.firstTile<L)&&(C=N,I=S.count,L=S.firstTile);k=C}else if(R&&R!==c.id){const E=e.board.filter(C=>C.group===_).map(C=>C.id);E.length>0&&E.every(C=>e.properties.some(I=>I.tileId===C&&I.ownerId===R&&!I.dormant))&&(k=R)}k&&(g={tileId:h.id,action:"spy-clash",group:_,spyOwnerId:w,defenderId:k,step:"puzzle"},n.phase="action")}}return{state:{...e,players:m,currentTurn:n,pendingEffect:g},events:r,effect:g}}function Rme(e){const t=e.pendingTeleport;if(!t)return e;const r=e.players.findIndex(i=>i.id===t.playerId);if(r===-1)return e;let n={...e.players[r]};t.reason==="go-to-jail"?n=Uf(n,kO(e.board)):n={...n,tileIndex:t.targetTile};const s=[...e.players];s[r]=n;const o={...e.currentTurn,phase:t.postPhase,landedTile:t.targetTile};return{...e,players:s,currentTurn:o,pendingTeleport:null}}function Tme(e){var s,o;const t=e.players.filter(i=>!i.depleted);if(t.length<=1)return{...e,finished:!0,winnerId:((s=t[0])==null?void 0:s.id)??null};let r=(e.currentPlayerIndex+1)%e.players.length;for(;(o=e.players[r])!=null&&o.depleted;)r=(r+1)%e.players.length;const n=r<=e.currentPlayerIndex?e.roundNumber+1:e.roundNumber;return{...e,currentPlayerIndex:r,currentTurn:SO(e.players[r].id),roundNumber:n,pendingEffect:null}}const Zc=1e3,Kc=500,EO=1e3,PO=500,CO=3,Fd={bullseye:.55,hit:1.4,graze:2.4},y_=["crimson-dominion","silver-pact","azure-sovereignty","golden-imperium","emerald-collective","void-enclave"],RR=["#ff3a3a","#b0c4de","#4488ff","#ffaa00","#39ff14","#cc44ff"];function Ud(e,t,r,n){const s=r[t];if(!(s!=null&&s.group))return 5;const o=r.map((m,h)=>m.group===s.group?h:-1).filter(m=>m>=0),i=o.length;if(i<=1)return 5;if(o.filter(m=>n.some(h=>h.tileId===m&&h.ownerId===e)).length<i)return 0;const u=o.map(m=>{const h=n.find(b=>b.tileId===m&&b.ownerId===e);return h?h.upgradeLevel:0}),p=Math.min(...u),d=n.find(m=>m.tileId===t&&m.ownerId===e),f=d?d.upgradeLevel:0;return f>p?f:Math.min(f+1,5)}function jme(e,t){const r=new Map;for(const o of e){if(!o.group)continue;const i=r.get(o.group);i?i.push(o.id):r.set(o.group,[o.id])}let n=!1;const s=t.map(o=>{if(o.upgradeLevel<=0)return o;const i=e[o.tileId];if(!(i!=null&&i.group))return o;const c=r.get(i.group);return!c||c.length<=1||c.every(p=>t.some(d=>d.tileId===p&&d.ownerId===o.ownerId))?o:(n=!0,{...o,upgradeLevel:0})});return n?s:t}function Ime(e,t,r,n,s){const o=n??y_[r%y_.length],i=y_.indexOf(o);return{id:e,displayName:t,credits:an.startingCredits,tileIndex:0,inJail:!1,jailTurnsLeft:0,depleted:!1,piece:o,pieceColor:RR[i>=0?i:r%RR.length],armorLevel:0,weaponLevel:0,heroId:s}}function Nme(e,t,r){const n=e.map((o,i)=>Ime(o.id,o.name,i,o.piece,o.heroId)),s=xy(t);return{matchId:crypto.randomUUID(),boardSize:t,players:n,properties:[],currentTurn:SO(n[0].id),currentPlayerIndex:0,board:s.tiles,roundNumber:1,finished:!1,winnerId:null,pendingEffect:null,...r&&(r.disableRaid||r.disableSpyStrike)?{gameRules:{disableRaid:!!r.disableRaid,disableSpyStrike:!!r.disableSpyStrike}}:{}}}function TR(e,t,r){if(!t.group||!t.spyOwnerId||!t.defenderId)return e;const n=e.currentPlayerIndex,s=e.players[n];if(s.id!==t.spyOwnerId)return e;const o=e.players.find(A=>A.id===t.defenderId);if(!o)return e;const i={...e.currentTurn},c=e.board.filter(A=>A.group===t.group).map(A=>A.id),u=e.properties.filter(A=>c.includes(A.tileId)&&A.ownerId===o.id).length,d=c.length>0&&u===c.length?EO:PO,f=s.credits-d,m=[...e.players],h=e.properties;m[n]={...s,credits:f};const b={...e.spies??{}};delete b[t.group];const g=Object.keys(b).length>0?b:void 0,y={...e.siegeCooldowns??{},[t.group]:e.roundNumber+CO};if(r.push({type:"spy-resolved",spyOwnerId:s.id,defenderId:o.id,group:t.group,winnerId:o.id,tileIds:c,penalty:d}),f<=0){if(h.filter(w=>w.ownerId===s.id).length>0)return{...e,players:m,properties:h,currentTurn:{...i,phase:"in-debt"},pendingEffect:null,spies:g,siegeCooldowns:y};m[n]={...m[n],credits:0,bankrupt:!0},r.push({type:"bankrupt",playerId:s.id});const _=i.rolledDoubles?"pre-roll":"done";return{...e,players:m,properties:h,currentTurn:{...i,phase:_},pendingEffect:null,spies:g,siegeCooldowns:y}}const x=e.board[t.tileId];if(!x){const A=i.rolledDoubles?"pre-roll":"done";return{...e,players:m,properties:h,currentTurn:{...i,phase:A},pendingEffect:null,spies:g,siegeCooldowns:y}}let v=x1(x,m[n],h,e.board);if(v&&v.action==="energy-toll"){const A=m[n];A.heroId&&Ta[A.heroId]&&o.heroId&&Ta[o.heroId]&&x.group&&c.every(j=>h.some(T=>T.tileId===j&&T.ownerId===o.id&&!T.dormant))&&(v={...v,action:"hero-clash"})}if(!v||v.action==="none"){const A=i.rolledDoubles?"pre-roll":"done";return{...e,players:m,properties:h,currentTurn:{...i,phase:A},pendingEffect:null,spies:g,siegeCooldowns:y}}return{...e,players:m,properties:h,currentTurn:{...i,phase:"action"},pendingEffect:v,spies:g,siegeCooldowns:y}}function Mme(e,t,r,n,s=!1){const[o,i]=l.useState(()=>t??Nme(e,r,n)),c=l.useRef(o);c.current=o;const[u,p]=l.useState([]),[d,f]=l.useState(0),m=l.useRef(!1),h=l.useRef([]),b=l.useRef(!1);l.useEffect(()=>{if(b.current){const U=h.current;h.current=[],b.current=!1,p(U)}else if(h.current.length>0){const U=h.current;h.current=[],p(V=>[...V,...U])}}),l.useEffect(()=>{i(U=>{const V=jme(U.board,U.properties);return V===U.properties?U:{...U,properties:V}})},[o.properties,o.board]);const g=l.useCallback(()=>{if(m.current)return;m.current=!0;const U=xO(),V=c.current,z=V.players.find(q=>q.id===V.currentTurn.playerId),O=!V.finished&&V.currentTurn.phase==="pre-roll"&&!!z&&!z.depleted;i(q=>{const X=q.players.find(Q=>Q.id===q.currentTurn.playerId);if(q.finished||q.currentTurn.phase!=="pre-roll"||!X||X.depleted)return q;const Z=Cme(q,U);return b.current=!0,h.current=Z.events,Z.state}),O&&f(q=>q+1),m.current=!1},[]),y=l.useCallback(U=>{i(V=>{var _e;if(V.finished||V.currentTurn.phase!=="action"||((_e=V.pendingEffect)==null?void 0:_e.action)!=="buy-prompt"||U!==V.pendingEffect.tileId)return V;const z=V.board[U];if(!(z!=null&&z.cost))return V;const O=V.currentPlayerIndex,q=V.players[O];if(!q||q.depleted||q.id!==V.currentTurn.playerId||q.credits<z.cost)return V;const X={...q,credits:q.credits-z.cost},Z=[...V.players];Z[O]=X;const Q=[...V.properties,{tileId:U,ownerId:q.id,upgradeLevel:0,dormant:!1}];h.current.push({type:"buy",playerId:q.id,tileId:U,cost:z.cost});const oe=V.currentTurn.rolledDoubles?"pre-roll":"done",ce={...V.currentTurn,phase:oe};return{...V,players:Z,properties:Q,currentTurn:ce,pendingEffect:null}})},[]),x=l.useCallback(()=>{i(U=>{const V=U.pendingEffect;if(!V||V.action!=="energy-toll")return U;const z=U.currentPlayerIndex,O=U.players[z],q=V.amount??0,X=O.armorLevel*an.armorDamageReduction,Z=Math.max(1,Math.round(q*(1-X)));let Q=U.properties;if(O.weaponLevel>=1&&U.currentTurn.rolledDoubles&&!U.currentTurn.strikeUsed){const Ge=Q.findIndex(_t=>_t.tileId===V.tileId&&_t.ownerId!==O.id&&_t.upgradeLevel>0&&!_t.dormant);if(Ge!==-1){Q=[...Q];const _t=Q[Ge],Xe=_t.upgradeLevel-1;Q[Ge]={..._t,upgradeLevel:Xe},h.current.push({type:"strike",playerId:O.id,tileId:V.tileId,newLevel:Xe})}}const oe=Q.find(Ge=>Ge.tileId===V.tileId);if(!oe)return U;const ce=O.credits-Z,_e={...O,credits:ce},re=U.players.findIndex(Ge=>Ge.id===oe.ownerId),pe=[...U.players];pe[z]=_e,re!==-1&&(pe[re]={...pe[re],credits:pe[re].credits+Z}),h.current.push({type:"energy-toll",payerId:O.id,ownerId:oe.ownerId,tileId:V.tileId,amount:Z});const ee=Q!==U.properties,xe={...U.currentTurn,strikeUsed:ee?!0:U.currentTurn.strikeUsed};if(ce<=0){if(Q.filter(_t=>_t.ownerId===O.id).length>0)return{...U,players:pe,properties:Q,currentTurn:{...xe,phase:"in-debt"},pendingEffect:null};pe[z]={..._e,credits:0,depleted:!0},h.current.push({type:"depleted",playerId:O.id})}const Le=xe.rolledDoubles?"pre-roll":"done";return{...U,players:pe,properties:Q,currentTurn:{...xe,phase:Le},pendingEffect:null}})},[]),v=l.useCallback(()=>{i(U=>{const V=U.pendingEffect;if(!V||V.action!=="hero-clash")return U;const z=U.currentPlayerIndex,O=U.players[z],q=V.amount??0,X=U.properties.find(ue=>ue.tileId===V.tileId);if(!X)return U;const Z=U.players.find(ue=>ue.id===X.ownerId);if(!Z)return U;const Q=O.heroId?Ta[O.heroId]:null,oe=Z!=null&&Z.heroId?Ta[Z.heroId]:null;if(!Q||!oe)return U;const ce=Math.floor(Math.random()*6)+1,_e=Math.floor(Math.random()*6)+1,re=ce+_e,pe=Math.floor(Math.random()*6)+1,ee=Math.floor(Math.random()*6)+1,xe=pe+ee,Le=El(Q.empire,Q.tier).defense,Ge=El(oe.empire,oe.tier).attack,_t=Math.min(Le*re/7,.9),Xe=Math.min(Ge*xe/7,3),bt=O.armorLevel*an.armorDamageReduction;let Pt=U.properties;if(O.weaponLevel>=1&&U.currentTurn.rolledDoubles&&!U.currentTurn.strikeUsed){const ue=Pt.findIndex(B=>B.tileId===V.tileId&&B.ownerId!==O.id&&B.upgradeLevel>0&&!B.dormant);if(ue!==-1){Pt=[...Pt];const B=Pt[ue],fe=B.upgradeLevel-1;Pt[ue]={...B,upgradeLevel:fe},h.current.push({type:"strike",playerId:O.id,tileId:V.tileId,newLevel:fe})}}const kt=Math.round(q*(1+Xe)),Ee=Math.max(1,Math.round(kt*(1-bt)*(1-_t)));h.current.push({type:"hero-clash",attackerId:Z.id,defenderId:O.id,tileId:V.tileId,attackDice:[pe,ee],defenseDice:[ce,_e],attackHeroId:oe.id,defenseHeroId:Q.id,baseDamage:q,finalDamage:Ee});const le=O.credits-Ee,De={...O,credits:le},Ye=U.players.findIndex(ue=>ue.id===X.ownerId),Re=[...U.players];Re[z]=De,Ye!==-1&&(Re[Ye]={...Re[Ye],credits:Re[Ye].credits+Ee}),h.current.push({type:"energy-toll",payerId:O.id,ownerId:X.ownerId,tileId:V.tileId,amount:Ee});const et=Pt!==U.properties,rt={...U.currentTurn,strikeUsed:et?!0:U.currentTurn.strikeUsed};if(le<=0){if(Pt.filter(fe=>fe.ownerId===O.id).length>0)return{...U,players:Re,properties:Pt,currentTurn:{...rt,phase:"in-debt"},pendingEffect:null};Re[z]={...De,credits:0,depleted:!0},h.current.push({type:"depleted",playerId:O.id});const B=rt.rolledDoubles?"pre-roll":"done";return{...U,players:Re,properties:Pt,currentTurn:{...rt,phase:B},pendingEffect:null}}const ne=rt.rolledDoubles?"pre-roll":"done";return{...U,players:Re,properties:Pt,currentTurn:{...rt,phase:ne},pendingEffect:null}})},[]),A=l.useCallback(()=>{i(U=>{const V=U.pendingEffect;if(!V||V.action!=="void-drain")return U;const z=U.currentPlayerIndex,O=V.amount??0,q=U.players[z].credits-O,X={...U.players[z],credits:q},Z=[...U.players];if(Z[z]=X,h.current.push({type:"void-drain",playerId:X.id,amount:O}),q<=0){if(U.properties.filter(_e=>_e.ownerId===X.id).length>0)return{...U,players:Z,currentTurn:{...U.currentTurn,phase:"in-debt"},pendingEffect:null};Z[z]={...X,credits:0,depleted:!0},h.current.push({type:"depleted",playerId:X.id})}const Q=U.currentTurn.rolledDoubles?"pre-roll":"done",oe={...U.currentTurn,phase:Q};return{...U,players:Z,currentTurn:oe,pendingEffect:null}})},[]),_=l.useCallback(()=>{i(U=>{var Q;const V=U.pendingEffect;if(!V||V.action!=="draw-card")return U;const z=U.currentPlayerIndex,O=V.amount??0,q=((Q=U.board[V.tileId])==null?void 0:Q.type)==="asteroid"?"asteroid":"nebula";h.current.push({type:"card",playerId:U.players[z].id,deck:q,text:V.cardText??""});const X=[...U.players];if(V.cardGoToJail){const oe=U.board.findIndex(ce=>ce.type==="jail");return X[z]=Uf(U.players[z],oe>=0?oe:10),h.current.push({type:"jail",playerId:X[z].id,reason:"go-to-jail"}),{...U,players:X,currentTurn:{...U.currentTurn,phase:"done",rolledDoubles:!1},pendingEffect:null}}if(V.cardMoveTo!==void 0){const oe=U.players[z].tileIndex,ce=V.cardMoveTo,_e=ce<oe;let re={...U.players[z],tileIndex:ce};_e&&(re={...re,credits:re.credits+an.passStartBonus}),O!==0&&(re={...re,credits:re.credits+O}),X[z]=re,h.current.push({type:"move",playerId:re.id,from:oe,to:ce,passedStart:_e});const pe=U.board[ce];if(pe){const xe=x1(pe,re,U.properties,U.board);if(xe.action==="go-to-jail"){const Le=U.board.findIndex(Ge=>Ge.type==="jail");return X[z]=Uf(U.players[z],Le>=0?Le:10),h.current.push({type:"jail",playerId:X[z].id,reason:"go-to-jail"}),{...U,players:X,currentTurn:{...U.currentTurn,phase:"done",rolledDoubles:!1},pendingEffect:null}}if(xe.action!=="none")return{...U,players:X,currentTurn:{...U.currentTurn,phase:"action"},pendingEffect:xe}}const ee=U.currentTurn.rolledDoubles?"pre-roll":"done";return{...U,players:X,currentTurn:{...U.currentTurn,phase:ee},pendingEffect:null}}if(O>=0)X[z]={...U.players[z],credits:U.players[z].credits+O};else{const oe=Math.abs(O),ce=U.players[z].credits-oe;if(X[z]={...U.players[z],credits:ce},ce<=0){if(U.properties.filter(re=>re.ownerId===U.players[z].id).length>0)return{...U,players:X,currentTurn:{...U.currentTurn,phase:"in-debt"},pendingEffect:null};X[z]={...X[z],credits:0,depleted:!0},h.current.push({type:"depleted",playerId:U.players[z].id})}}const Z=U.currentTurn.rolledDoubles?"pre-roll":"done";return{...U,players:X,currentTurn:{...U.currentTurn,phase:Z},pendingEffect:null}})},[]),w=l.useCallback(()=>{i(U=>{const V=U.currentPlayerIndex,z=U.board.findIndex(Z=>Z.type==="jail"),O=Uf(U.players[V],z>=0?z:10),q=[...U.players];q[V]=O,h.current.push({type:"jail",playerId:O.id,reason:"go-to-jail"});const X={...U.currentTurn,phase:"done"};return{...U,players:q,currentTurn:X,pendingEffect:null}})},[]),j=l.useCallback(()=>{i(U=>Rme(U))},[]),T=l.useCallback(()=>{i(U=>{const V=U.currentPlayerIndex,z=_me(U.players[V],an.jailBailCost),O=[...U.players];return O[V]=z,h.current.push({type:"jail-free",playerId:z.id,method:"pay"}),{...U,players:O}})},[]),R=l.useCallback(()=>{i(U=>U.currentTurn.phase!=="done"?U:Tme(U)),h.current=[],b.current=!1,p([])},[]),P=l.useCallback(()=>{i(U=>(GL(U),U))},[]);l.useEffect(()=>{o.finished&&uw()},[o.finished]);const k=l.useCallback(()=>{i(U=>{var O;if(U.currentTurn.phase!=="action"||((O=U.pendingEffect)==null?void 0:O.action)!=="buy-prompt")return U;const V=U.currentTurn.rolledDoubles?"pre-roll":"done",z={...U.currentTurn,phase:V};return{...U,currentTurn:z,pendingEffect:null}})},[]),E=l.useCallback(U=>{i(V=>{const z=V.currentPlayerIndex,O=V.players[z],q=V.properties.findIndex(_e=>_e.tileId===U&&_e.ownerId===O.id);if(q===-1)return V;const X=V.properties[q];if(X.dormant)return V;const Z=V.board[U];if(!(Z!=null&&Z.upgradeCost)||O.credits<Z.upgradeCost)return V;const Q=Ud(O.id,U,V.board,V.properties);if(X.upgradeLevel>=Q)return V;const oe=[...V.players];oe[z]={...O,credits:O.credits-Z.upgradeCost};const ce=[...V.properties];return ce[q]={...X,upgradeLevel:X.upgradeLevel+1},h.current.push({type:"upgrade",playerId:O.id,tileId:U,level:X.upgradeLevel+1}),{...V,players:oe,properties:ce}})},[]),M=l.useCallback(U=>{i(V=>{const z=V.currentPlayerIndex,O=V.players[z],q=V.properties.findIndex(_e=>_e.tileId===U&&_e.ownerId===O.id);if(q===-1)return V;const X=V.properties[q],Z=V.board[U];if(!(Z!=null&&Z.cost))return V;if(X.dormant){const _e=Math.floor(Z.cost*.3);if(O.credits<_e)return V;const re=[...V.players];re[z]={...O,credits:O.credits-_e};const pe=[...V.properties];return pe[q]={...X,dormant:!1},h.current.push({type:"reactivate",playerId:O.id,tileId:U}),{...V,players:re,properties:pe}}if(X.upgradeLevel>0)return V;const Q=Math.floor(Z.cost/4),oe=[...V.players];oe[z]={...O,credits:O.credits+Q};const ce=[...V.properties];return ce[q]={...X,dormant:!0},h.current.push({type:"dormant",playerId:O.id,tileId:U}),{...V,players:oe,properties:ce}})},[]),[C,I]=l.useState(null),L=l.useCallback(U=>{i(V=>{const z=V.currentPlayerIndex,O=V.players[z],q=V.properties.findIndex(_e=>_e.tileId===U&&_e.ownerId===O.id);if(q===-1||V.properties[q].upgradeLevel>0)return V;const Z=V.board[U];if(!(Z!=null&&Z.cost))return V;const Q=Math.floor(Z.cost/2),oe=[...V.players];oe[z]={...O,credits:O.credits+Q};const ce=V.properties.filter((_e,re)=>re!==q);return h.current.push({type:"sell",playerId:O.id,tileId:U,amount:Q}),{...V,players:oe,properties:ce}})},[]),N=l.useCallback(U=>{i(V=>{if(V.currentTurn.phase!=="in-debt")return V;const z=V.currentPlayerIndex,O=V.players[z],q=V.properties.findIndex(_e=>_e.tileId===U&&_e.ownerId===O.id);if(q===-1||V.properties[q].upgradeLevel>0)return V;const Z=V.board[U];if(!(Z!=null&&Z.cost))return V;const Q=Math.floor(Z.cost/2),oe=[...V.players];oe[z]={...O,credits:O.credits+Q};const ce=V.properties.filter((_e,re)=>re!==q);return h.current.push({type:"debt-sell",playerId:O.id,tileId:U,amount:Q}),{...V,players:oe,properties:ce}})},[]),S=l.useCallback(U=>{i(V=>{if(V.currentTurn.phase!=="in-debt")return V;const z=V.currentPlayerIndex,O=V.players[z],q=V.properties.findIndex(_e=>_e.tileId===U&&_e.ownerId===O.id);if(q===-1)return V;const X=V.properties[q];if(X.upgradeLevel<=0)return V;const Z=V.board[U];if(!(Z!=null&&Z.upgradeCost))return V;const Q=Math.floor(Z.upgradeCost/2),oe=[...V.players];oe[z]={...O,credits:O.credits+Q};const ce=[...V.properties];return ce[q]={...X,upgradeLevel:X.upgradeLevel-1},h.current.push({type:"debt-liquidate-arm",playerId:O.id,tileId:U,level:X.upgradeLevel-1,refund:Q}),{...V,players:oe,properties:ce}})},[]),F=l.useCallback(()=>{i(U=>{if(U.currentTurn.phase!=="in-debt")return U;const V=U.currentPlayerIndex,z=U.players[V],O=U.properties.filter(Z=>Z.ownerId===z.id);if(z.credits<=0&&O.length>0)return U;const q=[...U.players];z.credits<=0&&O.length===0&&(q[V]={...z,credits:0,depleted:!0},h.current.push({type:"depleted",playerId:z.id}));const X=U.currentTurn.rolledDoubles?"pre-roll":"done";return{...U,players:q,currentTurn:{...U.currentTurn,phase:X}}})},[]),D=l.useCallback(U=>{i(V=>{const z=V.currentPlayerIndex,O=V.players[z],q=V.properties.findIndex(ee=>ee.tileId===U&&ee.ownerId!==O.id&&ee.upgradeLevel>0&&!ee.dormant);if(q===-1)return V;const X=V.properties[q],Z=V.board[U];if(!(Z!=null&&Z.group)||!Z.upgradeCost)return V;const Q=V.board.filter(ee=>ee.group===Z.group).map(ee=>ee.id),oe=V.properties.filter(ee=>Q.includes(ee.tileId)&&ee.ownerId===O.id&&!ee.dormant).length;if(oe<=0)return V;const ce=Z.upgradeCost*(Q.length-oe+1);if(O.credits<ce)return V;const _e=X.upgradeLevel-1,re=[...V.players];re[z]={...O,credits:O.credits-ce};const pe=[...V.properties];return pe[q]={...X,upgradeLevel:_e},h.current.push({type:"sabotage",playerId:O.id,tileId:U,cost:ce,newLevel:_e}),{...V,players:re,properties:pe}})},[]),H=l.useCallback((U,V,z,O,q,X)=>{const Z=c.current,Q=Z.players.find(re=>re.id===U);if(!Q||Q.depleted||!z.every(re=>Z.properties.some(pe=>pe.tileId===re&&pe.ownerId===Q.id&&pe.upgradeLevel===0))||O>0&&Q.credits<O)return;const ce=Z.players.find(re=>re.id===V);!ce||ce.depleted||!q.every(re=>Z.properties.some(pe=>pe.tileId===re&&pe.ownerId===V&&pe.upgradeLevel===0))||X>0&&ce.credits<X||I({id:crypto.randomUUID(),offerer:{playerId:Q.id,propertyIds:z,credits:O},recipient:{playerId:V,propertyIds:q,credits:X},status:"pending"})},[]),W=l.useCallback(()=>{const U=C;!U||U.status!=="pending"||(i(V=>{const z=V.players.findIndex(re=>re.id===U.offerer.playerId),O=V.players.findIndex(re=>re.id===U.recipient.playerId);if(z===-1||O===-1)return V;const q=V.players[z],X=V.players[O];if(U.offerer.credits>0&&q.credits<U.offerer.credits||U.recipient.credits>0&&X.credits<U.recipient.credits)return V;const Z=U.offerer.propertyIds.every(re=>V.properties.some(pe=>pe.tileId===re&&pe.ownerId===U.offerer.playerId&&pe.upgradeLevel===0)),Q=U.recipient.propertyIds.every(re=>V.properties.some(pe=>pe.tileId===re&&pe.ownerId===U.recipient.playerId&&pe.upgradeLevel===0));if(!Z||!Q)return V;const oe=[...V.players],ce=U.offerer.credits-U.recipient.credits;oe[z]={...q,credits:q.credits-ce},oe[O]={...X,credits:X.credits+ce};const _e=V.properties.map(re=>U.offerer.propertyIds.includes(re.tileId)&&re.ownerId===U.offerer.playerId?{...re,ownerId:U.recipient.playerId}:U.recipient.propertyIds.includes(re.tileId)&&re.ownerId===U.recipient.playerId?{...re,ownerId:U.offerer.playerId}:re);return h.current.push({type:"trade",offererId:U.offerer.playerId,recipientId:U.recipient.playerId,offererProps:U.offerer.propertyIds,recipientProps:U.recipient.propertyIds,offererCredits:U.offerer.credits,recipientCredits:U.recipient.credits}),{...V,players:oe,properties:_e}}),I(null))},[C]),G=l.useCallback(()=>{const U=C;U&&h.current.push({type:"trade-declined",offererId:U.offerer.playerId,recipientId:U.recipient.playerId}),I(null)},[C]),$=l.useCallback(()=>{i(U=>{const V=U.currentPlayerIndex,z=U.players[V];if(z.armorLevel>=an.maxArmorLevel||z.credits<an.armorUpgradeCost)return U;const O=z.armorLevel+1,q=[...U.players];return q[V]={...z,credits:z.credits-an.armorUpgradeCost,armorLevel:O},h.current.push({type:"upgrade-armor",playerId:z.id,level:O,cost:an.armorUpgradeCost}),{...U,players:q}})},[]),K=l.useCallback(()=>{i(U=>{const V=U.currentPlayerIndex,z=U.players[V];if(z.weaponLevel>=an.maxWeaponLevel||z.credits<an.weaponUpgradeCost)return U;const O=z.weaponLevel+1,q=[...U.players];return q[V]={...z,credits:z.credits-an.weaponUpgradeCost,weaponLevel:O},h.current.push({type:"upgrade-weapon",playerId:z.id,level:O,cost:an.weaponUpgradeCost}),{...U,players:q}})},[]),de=l.useCallback(()=>{i(U=>{const V=U.currentPlayerIndex,z=U.players[V];if(z.armorLevel<=0)return U;const O=Math.floor(an.armorUpgradeCost/2),q=z.armorLevel-1,X=[...U.players];return X[V]={...z,credits:z.credits+O,armorLevel:q},h.current.push({type:"liquidate-armor",playerId:z.id,level:q,refund:O}),{...U,players:X}})},[]),ie=l.useCallback(()=>{i(U=>{const V=U.currentPlayerIndex,z=U.players[V];if(z.weaponLevel<=0)return U;const O=Math.floor(an.weaponUpgradeCost/2),q=z.weaponLevel-1,X=[...U.players];return X[V]={...z,credits:z.credits+O,weaponLevel:q},h.current.push({type:"liquidate-weapon",playerId:z.id,level:q,refund:O}),{...U,players:X}})},[]),we=l.useCallback(U=>{U&&i(V=>{var pe,ee,xe;const z=U.winnerId,O=(pe=V.players[V.currentPlayerIndex])==null?void 0:pe.id,q=U.attackerId??O,X=U.defenderId??((ee=V.players.find(Le=>{var Ge;return Le.id!==q&&!Le.depleted&&!Le.inJail&&Le.tileIndex===((Ge=V.players[V.currentPlayerIndex])==null?void 0:Ge.tileIndex)}))==null?void 0:ee.id)??((xe=V.players.find(Le=>Le.id!==q))==null?void 0:xe.id);if(!q||!X)return V;const Z=z===q?X:q,Q=V.players.findIndex(Le=>Le.id===z),oe=V.players.findIndex(Le=>Le.id===Z);if(Q===-1||oe===-1)return V;const ce=Number.isFinite(U.creditsStolen)?Math.max(0,Math.floor(U.creditsStolen)):0,_e=Math.min(ce,V.players[oe].credits),re=[...V.players];return re[Q]={...re[Q],credits:re[Q].credits+_e},re[oe]={...re[oe],credits:Math.max(0,re[oe].credits-_e)},h.current.push({type:"raid",attackerId:q,defenderId:X,winnerId:z,creditsStolen:_e}),{...V,players:re}})},[]),he=l.useCallback(U=>{i(V=>{var Xe,bt,Pt;if((Xe=V.gameRules)!=null&&Xe.disableSpyStrike)return V;const z=V.currentTurn.phase;if(z==="in-debt"||z!=="action"&&z!=="pre-roll"&&z!=="done"||V.pendingEffect)return V;const O=V.players[V.currentPlayerIndex];if(!O||O.bankrupt)return V;const q=V.board[O.tileIndex];if(!q||q.type!=="planet"||q.group!==U||(bt=V.spies)!=null&&bt[U])return V;const X=((Pt=V.siegeCooldowns)==null?void 0:Pt[U])??0;if(V.roundNumber<X)return V;const Z=V.board.filter(kt=>kt.group===U).map(kt=>kt.id);if(Z.length===0)return V;const Q=new Map(Z.map(kt=>{var Ee;return[kt,(Ee=V.properties.find(le=>le.tileId===kt))==null?void 0:Ee.ownerId]})),oe=Z.filter(kt=>Q.get(kt)===O.id).length,ce=Z.filter(kt=>Q.get(kt)!==O.id),_e=Z.some(kt=>{const Ee=Q.get(kt);return!!Ee&&Ee!==O.id}),re=Q.get(Z[0]),pe=!!re&&re!==O.id&&Z.every(kt=>V.properties.some(Ee=>Ee.tileId===kt&&Ee.ownerId===re&&!Ee.dormant));let ee=null,xe=0;if(s&&oe>0&&_e)ee="foothold",xe=Kc;else if(s&&pe)ee="monopoly",xe=Zc;else if(oe===0){const kt=Q.get(Z[0]);if(!kt||kt===O.id||!Z.every(le=>V.properties.some(De=>De.tileId===le&&De.ownerId===kt&&!De.dormant)))return V;ee="monopoly",xe=Zc}else if(ce.length>0&&ce.every(kt=>!!Q.get(kt)))ee="foothold",xe=Kc;else return V;if(O.credits<xe)return V;const Le=[...V.players];Le[V.currentPlayerIndex]={...O,credits:O.credits-xe};const Ge={...V.spies??{},[U]:O.id},_t={...V.spyKinds??{},[U]:ee};return h.current.push({type:"spy-plant",playerId:O.id,group:U,cost:xe}),{...V,players:Le,spies:Ge,spyKinds:_t}})},[s]),Ae=l.useCallback(U=>{i(V=>{const z=V.pendingEffect;return!z||z.action!=="spy-clash"||z.step!=="puzzle"||V.currentTurn.phase!=="action"||!z.group||!z.spyOwnerId||!z.defenderId||V.players[V.currentPlayerIndex].id!==z.spyOwnerId?V:(h.current.push({type:"spy-puzzle-result",spyOwnerId:z.spyOwnerId,defenderId:z.defenderId,group:z.group,success:U}),U?{...V,pendingEffect:{...z,step:"shot"}}:TR(V,z,h.current))})},[]),Fe=l.useCallback(U=>{i(V=>{const z=V.pendingEffect;if(!z||z.action!=="spy-clash"||z.step!=="shot"||V.currentTurn.phase!=="action"||!z.group||!z.spyOwnerId||!z.defenderId)return V;const O=V.players[V.currentPlayerIndex];if(O.id!==z.spyOwnerId)return V;const q=V.players.findIndex(xe=>xe.id===z.defenderId);if(q===-1)return V;const X=V.players[q];if(h.current.push({type:"spy-shot-result",spyOwnerId:z.spyOwnerId,defenderId:z.defenderId,group:z.group,outcome:U}),U==="miss")return TR(V,z,h.current);const Z={...V.currentTurn},Q=V.board.filter(xe=>xe.group===z.group).map(xe=>xe.id),oe=V.properties.map(xe=>Q.includes(xe.tileId)&&xe.ownerId!==O.id?(h.current.push({type:"seizure",attackerId:O.id,defenderId:X.id,tileId:xe.tileId,group:z.group}),{...xe,ownerId:O.id}):xe),ce=[...V.players];if(X.heroId){const xe=X.heroId;ce[q]={...X,heroId:void 0,formerHeroId:xe,heroVanquishedById:O.id},h.current.push({type:"hero-vanquished",vanquisherId:O.id,victimId:X.id,formerHeroId:xe})}const _e={...V.spies??{}};delete _e[z.group];const re=Object.keys(_e).length>0?_e:void 0,pe={...V.siegeCooldowns??{},[z.group]:V.roundNumber+CO};h.current.push({type:"spy-resolved",spyOwnerId:O.id,defenderId:X.id,group:z.group,winnerId:O.id,tileIds:Q});const ee=Z.rolledDoubles?"pre-roll":"done";return{...V,players:ce,properties:oe,currentTurn:{...Z,phase:ee},pendingEffect:null,spies:re,siegeCooldowns:pe}})},[]);return{gameState:o,events:u,pendingEffect:o.pendingEffect,pendingTrade:C,rollTrigger:d,actions:{roll:g,buyProperty:y,payRent:x,heroClashRoll:v,payTax:A,resolveCard:_,goToJail:w,payBailAction:T,endTurn:R,skipBuy:k,upgradeProperty:E,mortgageProperty:M,sellProperty:L,debtSell:N,debtLiquidateArm:S,debtResolve:F,sabotageProperty:D,proposeTrade:H,acceptTrade:W,declineTrade:G,saveGame:P,upgradeArmor:$,upgradeWeapon:K,liquidateArmor:de,liquidateWeapon:ie,applyTeleport:j,resolveRaid:we,plantSpy:he,spyPuzzleResult:Ae,spyShotResult:Fe}}}const jy=new Map;let zh=null;function zw(){if(jy.size===0)return;const e=bp();if(e)for(const[t,r]of jy)try{e.emit("client:broadcast-register",{gameId:t,gameMode:r.gameType,name:r.name??null,playerCount:r.playerCount??1,phase:r.phase??null})}catch{}}function RO(){const e=bp();if(!(!e||zh===e)){if(zh)try{zh.off("connect",zw)}catch{}zh=e;try{e.on("connect",zw)}catch{}}}function Lme(e,t,r){if(!e||!Array.isArray(r)||r.length===0)return;RO();const n=bp();if(n)try{n.emit("client:game-events",{gameId:e,gameType:t,events:r})}catch{}}function Dme(e,t,r){e&&(jy.set(e,{gameType:t,...r}),RO(),zw())}function Ome(e){if(!e)return;jy.delete(e);const t=bp();if(t)try{t.emit("client:broadcast-unregister",{gameId:e})}catch{}}function ss(e,t){if(!e||!t)return null;const r=e.players.find(n=>n.id===t);if(!r)return null;if(r.piece){const n=Yr(r.piece);if(n&&n!=="Unknown Fleet")return n}return r.displayName??null}function gc(e,t){return t==null?null:e.find(r=>r.id===t)??null}function zme(e,t){var r;if(!(!e||!t))return(r=e.players.find(n=>n.id===t))==null?void 0:r.credits}function Bme(e,t,r,n){return e.map(s=>{const o={roundNumber:n==null?void 0:n.roundNumber,phase:(n==null?void 0:n.phase)??null};switch(s.type){case"roll":{o.playerName=ss(t,s.playerId),o.dice=s.dice,o.amount=s.dice[0]+s.dice[1];break}case"move":{o.playerName=ss(t,s.playerId),o.from=s.from,o.to=s.to,o.passedStart=s.passedStart;const i=gc(r,s.to);o.tileId=s.to,o.tileName=(i==null?void 0:i.name)??null,o.tileGroup=(i==null?void 0:i.group)??null;break}case"buy":{o.playerName=ss(t,s.playerId),o.tileId=s.tileId;const i=gc(r,s.tileId);o.tileName=(i==null?void 0:i.name)??null,o.tileGroup=(i==null?void 0:i.group)??null,o.amount=s.cost;break}case"energy-toll":{o.playerName=ss(t,s.payerId),o.otherName=ss(t,s.ownerId),o.tileId=s.tileId;const i=gc(r,s.tileId);o.tileName=(i==null?void 0:i.name)??null,o.tileGroup=(i==null?void 0:i.group)??null,o.amount=s.amount,o.playerCredits=zme(t,s.payerId);break}case"upgrade":case"sabotage":{o.playerName=ss(t,s.playerId),o.tileId=s.tileId;const i=gc(r,s.tileId);o.tileName=(i==null?void 0:i.name)??null,o.tileGroup=(i==null?void 0:i.group)??null,o.level=s.level??s.newLevel,o.amount=s.cost;break}case"dormant":case"reactivate":case"repossess":case"sell":{o.playerName=ss(t,s.playerId),o.tileId=s.tileId;const i=gc(r,s.tileId);o.tileName=(i==null?void 0:i.name)??null,o.tileGroup=(i==null?void 0:i.group)??null,"amount"in s&&(o.amount=s.amount);break}case"jail":case"jail-free":case"depleted":case"win":{o.playerName=ss(t,s.playerId);break}case"card":{o.playerName=ss(t,s.playerId);break}case"void-drain":{o.playerName=ss(t,s.playerId),o.amount=s.amount;break}case"trade":{o.playerName=ss(t,s.offererId),o.otherName=ss(t,s.recipientId);break}case"seizure":{o.playerName=ss(t,s.attackerId),o.otherName=ss(t,s.defenderId),o.tileId=s.tileId;const i=gc(r,s.tileId);o.tileName=(i==null?void 0:i.name)??null,o.tileGroup=(i==null?void 0:i.group)??null;break}case"upgrade-armor":{o.playerName=ss(t,s.playerId),o.level=s.level,o.amount=s.cost;break}default:{const i=s;if(i.playerId&&(o.playerName=ss(t,i.playerId)),i.tileId!=null){o.tileId=i.tileId;const c=gc(r,i.tileId);o.tileName=(c==null?void 0:c.name)??null,o.tileGroup=(c==null?void 0:c.group)??null}typeof i.amount=="number"&&(o.amount=i.amount)}}return{type:s.type,raw:s,meta:o}})}const Fme=3e3,Ui=3e3,Ume=3e3,qme=Ume+750,Vme=500,Hme=750;function Wme({isMyTurn:e,phase:t,pendingEffect:r,pendingTrade:n,inJail:s,credits:o,botPlayerIds:i,currentPlayerId:c,properties:u,board:p,actions:d,gameFinished:f,players:m,spies:h,siegeCooldowns:b,roundNumber:g,autoplay:y=!1}){const x=l.useRef(null),v=l.useRef(null),A=l.useRef(null);l.useEffect(()=>{if(!n||n.status!=="pending"||!i.includes(n.recipient.playerId))return;const _=setTimeout(()=>{const w=n.recipient.playerId,j=(P,k)=>{const E=p[P],M=(E==null?void 0:E.cost)??100,C=u.find(L=>L.tileId===P),I=((C==null?void 0:C.upgradeLevel)??0)*Math.round(((E==null?void 0:E.upgradeCost)??M)*.6);if(k==="offerer"&&(E!=null&&E.group)){const N=p.filter(F=>F.group===E.group).map(F=>F.id).filter(F=>F!==P),S=N.filter(F=>u.some(D=>D.tileId===F&&D.ownerId===w&&!D.dormant)).length;if(N.length>0&&S===N.length)return Math.round(M*2.5)+I;if(S>0)return Math.round(M*1.6)+I}if(k==="recipient"&&(E!=null&&E.group)){const N=p.filter(F=>F.group===E.group).map(F=>F.id).filter(F=>F!==P),S=N.filter(F=>u.some(D=>D.tileId===F&&D.ownerId===w&&!D.dormant)).length;return S===0?Math.round(M*.8)+I:S===N.length?Math.round(M*1.8)+I:Math.round(M*1)+I}return M+I},T=n.offerer.credits+n.offerer.propertyIds.reduce((P,k)=>P+j(k,"offerer"),0),R=n.recipient.credits+n.recipient.propertyIds.reduce((P,k)=>P+j(k,"recipient"),0);T>=R*.85?d.acceptTrade():d.declineTrade()},Ui);return()=>clearTimeout(_)},[n,i,d,p,u]),l.useEffect(()=>{var j,T;if(e||f||!i.includes(c))return;const _=()=>{x.current&&clearTimeout(x.current)};if((t==="pre-roll"||t==="action"||t==="done")&&!r&&d.plantSpy&&m&&o>=Kc&&A.current!==`${c}|${g??0}`&&(((j=m.find(R=>R.id===c))==null?void 0:j.heroLockoutTurnsRemaining)??0)===0){const R=`${c}|${g??0}`,P=m.find(E=>E.id===c),k=P?p[P.tileIndex]:null;if(k&&k.type==="planet"&&k.group){const E=k.group,M=(b==null?void 0:b[E])??0,C=!(h!=null&&h[E]),I=(g??0)>=M;if(C&&I){const L=p.filter(N=>N.group===E).map(N=>N.id);if(L.length>0){const N=new Map(L.map($=>{var K;return[$,(K=u.find(de=>de.tileId===$))==null?void 0:K.ownerId]})),S=L.filter($=>N.get($)===c).length,F=L.filter($=>N.get($)!==c);let D=!1;const H=L.some($=>{const K=N.get($);return!!K&&K!==c}),W=N.get(L[0]),G=!!W&&W!==c&&L.every($=>u.some(K=>K.tileId===$&&K.ownerId===W&&!K.dormant));if(y&&S>0&&H)D=o>=Kc;else if(y&&G)D=o>=Zc;else if(S===0){const $=N.get(L[0]);D=!!$&&$!==c&&L.every(de=>u.some(ie=>ie.tileId===de&&ie.ownerId===$&&!ie.dormant))&&o>=Zc}else F.length>0&&F.every($=>!!N.get($))&&(D=o>=Kc);if(D)return A.current=R,x.current=setTimeout(()=>{var $;($=d.plantSpy)==null||$.call(d,E),x.current=setTimeout(()=>{t==="pre-roll"?d.roll():d.endTurn()},Hme)},Vme),_}}}}if(t==="pre-roll"){const R=`${c}|${g??0}`;if(d.proposeTrade&&v.current!==R&&!n&&m){const k=[],E=u.filter(C=>C.ownerId===c&&!C.dormant);for(const C of E){const I=p[C.tileId];if(!I||I.type!=="planet"||!I.group)continue;const L=p.filter(D=>D.group===I.group).map(D=>D.id);if(L.length<2)continue;const N=L.filter(D=>D!==C.tileId),S=new Map;for(const D of N){const H=(T=u.find(W=>W.tileId===D))==null?void 0:T.ownerId;!H||H===c||S.set(H,(S.get(H)??0)+1)}const F=C.upgradeLevel*Math.round((I.upgradeCost??I.cost??100)*.6);for(const[D,H]of S){const W=m.find(de=>de.id===D&&!de.depleted);if(!W)continue;const G=H===N.length,$=G?1.6:1.05,K=Math.min(Math.max(0,W.credits-30),Math.max(20,Math.round((I.cost??100)*$)+F));K<=0||k.push({rivalId:D,offerTileIds:[C.tileId],askCredits:K,requestTileIds:[],giveCredits:0,priority:(G?100:10)+H})}if(S.size===0)for(const D of m){if(D.id===c||D.depleted)continue;const H=Math.min(Math.max(0,D.credits-30),Math.max(20,Math.round((I.cost??100)*.95)+F));H<=0||k.push({rivalId:D.id,offerTileIds:[C.tileId],askCredits:H,requestTileIds:[],giveCredits:0,priority:1})}}const M=new Map;for(const C of E){const I=p[C.tileId];I!=null&&I.group&&M.set(I.group,(M.get(I.group)??0)+1)}for(const C of p){if(!C||C.type!=="planet"||!C.group)continue;const I=u.find(K=>K.tileId===C.id);if(!I||I.ownerId===c||I.dormant)continue;const L=m.find(K=>K.id===I.ownerId&&!K.depleted);if(!L)continue;const N=p.filter(K=>K.group===C.group).map(K=>K.id);if(N.length<2)continue;const S=M.get(C.group)??0,F=N.length,D=S===F-1;let H,W;if(D)H=1.6,W=90;else if(S>0)H=1.2,W=8+S;else{if(o<250)continue;const K=N.every(de=>u.some(ie=>ie.tileId===de&&ie.ownerId===L.id&&!ie.dormant));H=K?1:.95,W=K?4:2}const G=I.upgradeLevel*Math.round((C.upgradeCost??C.cost??100)*.6),$=Math.min(o-30,Math.max(20,Math.round((C.cost??100)*H)+G));$<=0||k.push({rivalId:L.id,offerTileIds:[],askCredits:0,requestTileIds:[C.id],giveCredits:$,priority:W})}if(k.length>0){k.sort((I,L)=>L.priority-I.priority);const C=k[0];return v.current=R,x.current=setTimeout(()=>{var I;(I=d.proposeTrade)==null||I.call(d,c,C.rivalId,C.offerTileIds,C.giveCredits,C.requestTileIds,C.askCredits)},Ui),_}}const P=u.filter(k=>k.ownerId===c&&!k.dormant&&k.upgradeLevel<Ud(c,k.tileId,p,u)).map(k=>{var E;return{...k,cost:((E=p[k.tileId])==null?void 0:E.upgradeCost)??1/0}}).filter(k=>k.cost<=o).sort((k,E)=>k.cost-E.cost);P.length>0?x.current=setTimeout(()=>{d.upgradeProperty(P[0].tileId)},Ui):x.current=setTimeout(()=>{s&&o>=an.jailBailCost&&d.payBailAction(),d.roll()},Fme)}else if(t==="action"&&r)x.current=setTimeout(()=>{var R,P;switch(r.action){case"buy-prompt":r.amount!=null&&o>=r.amount?d.buyProperty(r.tileId):d.skipBuy();break;case"energy-toll":d.payRent();break;case"hero-clash":d.heroClashRoll();break;case"void-drain":d.payTax();break;case"draw-card":d.resolveCard();break;case"spy-clash":if(y)break;if(r.step==="shot"){const k=Math.random(),E=k<.15?"bullseye":k<.55?"hit":k<.8?"graze":"miss";(R=d.spyShotResult)==null||R.call(d,E)}else{const k=Math.random()<.65;(P=d.spyPuzzleResult)==null||P.call(d,k)}break;default:d.endTurn()}},Ui);else if(t==="action"&&!r)x.current=setTimeout(()=>{d.endTurn()},Ui);else if(t==="in-debt"){const R=u.filter(E=>E.ownerId===c).map(E=>{var M;return{...E,value:((M=p[E.tileId])==null?void 0:M.cost)??0}}).sort((E,M)=>E.value-M.value),P=R.find(E=>E.upgradeLevel>0),k=R.find(E=>E.upgradeLevel<=0);o<=0&&R.length>0?k?x.current=setTimeout(()=>{d.debtSell(k.tileId)},Ui):P?x.current=setTimeout(()=>{d.debtLiquidateArm(P.tileId)},Ui):x.current=setTimeout(()=>{d.debtResolve()},Ui):x.current=setTimeout(()=>{d.debtResolve()},Ui)}else t==="done"&&(x.current=setTimeout(()=>{d.endTurn()},qme));return _},[e,t,r,n,s,o,i,c,u,p,d,f,m,h,b,g,y])}const Gme=""+new URL("azzure_turret_1-BSF6kRPN.png",import.meta.url).href,Xme=""+new URL("azzure_turret_2-BS9BQ0Wh.png",import.meta.url).href,Yme=""+new URL("azzure_turret_3-wzqgy1Re.png",import.meta.url).href,Zme=""+new URL("azzure_turret_4-DszsO8pE.png",import.meta.url).href,Kme=""+new URL("azzure_turret_5-BDNt-52F.png",import.meta.url).href,Qme="data:image/png;base64, ",Jme=""+new URL("crimson_turret_2-Dzdivnfl.png",import.meta.url).href,$me=""+new URL("crimson_turret_3-FCW5cjNx.png",import.meta.url).href,ehe=""+new URL("crimson_turret_4-x6XdwjO_.png",import.meta.url).href,the=""+new URL("crimson_turret_5-COBT408e.png",import.meta.url).href,rhe=""+new URL("emerald_turret_1-BAxyQCsm.png",import.meta.url).href,nhe=""+new URL("emerald_turret_2-Cb5EKOec.png",import.meta.url).href,ahe=""+new URL("emerald_turret_3-Djy1RF5l.png",import.meta.url).href,she=""+new URL("emerald_turret_4-Dvqo9xGL.png",import.meta.url).href,ohe=""+new URL("emerald_turret_5-DbPXnTsf.png",import.meta.url).href,ihe=""+new URL("gold_turret_1-ouFUy0uc.png",import.meta.url).href,lhe=""+new URL("gold_turret_2-lUsFpFSb.png",import.meta.url).href,che=""+new URL("gold_turret_3-DdV6hrcF.png",import.meta.url).href,uhe=""+new URL("gold_turret_4-DTvBKETa.png",import.meta.url).href,dhe=""+new URL("gold_turret_5-BoxTnz4z.png",import.meta.url).href,phe=""+new URL("silver_turret_1-BruS00ga.png",import.meta.url).href,fhe=""+new URL("silver_turret_2-BIg82_xi.png",import.meta.url).href,mhe=""+new URL("silver_turret_3-CJ-TtmjD.png",import.meta.url).href,hhe=""+new URL("silver_turret_4-Db8itTac.png",import.meta.url).href,ghe=""+new URL("silver_turret_5-BuHepi2d.png",import.meta.url).href,yhe=""+new URL("void_turret_1-CR92XhVP.png",import.meta.url).href,bhe=""+new URL("void_turret_2-CTH3oOBV.png",import.meta.url).href,vhe=""+new URL("void_turret_3-BoJPDIYG.png",import.meta.url).href,_he=""+new URL("void_turret_4-BAmR9i7p.png",import.meta.url).href,whe=""+new URL("void_turret_5-D-M1TouY.png",import.meta.url).href,TO=[{wedge:"M934.09,162.59 A840,840 0 0 1 1065.91,162.59 L1056.49,282.22 A720,720 0 0 0 943.51,282.22 Z",fill:"#1a237e",strip:null,stripColor:null},{wedge:"M1065.91,162.59 A840,840 0 0 1 1196.09,183.21 L1168.08,299.89 A720,720 0 0 0 1056.49,282.22 Z",fill:"#0d1b2a",strip:"M1065.91,162.59 A840,840 0 0 1 1196.09,183.21 L1192.36,198.77 A824,824 0 0 0 1064.65,178.54 Z",stripColor:"#7b2ff2"},{wedge:"M1196.09,183.21 A840,840 0 0 1 1321.45,223.94 L1275.53,334.81 A720,720 0 0 0 1168.08,299.89 Z",fill:"#4a148c",strip:null,stripColor:null},{wedge:"M1321.45,223.94 A840,840 0 0 1 1438.90,283.78 L1376.20,386.10 A720,720 0 0 0 1275.53,334.81 Z",fill:"#0d1b2a",strip:"M1321.45,223.94 A840,840 0 0 1 1438.90,283.78 L1430.54,297.42 A824,824 0 0 0 1315.33,238.72 Z",stripColor:"#7b2ff2"},{wedge:"M1438.90,283.78 A840,840 0 0 1 1545.54,361.26 L1467.60,452.51 A720,720 0 0 0 1376.20,386.10 Z",fill:"#b71c1c",strip:null,stripColor:null},{wedge:"M1545.54,361.26 A840,840 0 0 1 1638.74,454.46 L1547.49,532.40 A720,720 0 0 0 1467.60,452.51 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M1638.74,454.46 A840,840 0 0 1 1716.22,561.10 L1613.90,623.80 A720,720 0 0 0 1547.49,532.40 Z",fill:"#0d1b2a",strip:"M1638.74,454.46 A840,840 0 0 1 1716.22,561.10 L1702.58,569.46 A824,824 0 0 0 1626.57,464.85 Z",stripColor:"#00e5ff"},{wedge:"M1716.22,561.10 A840,840 0 0 1 1776.06,678.55 L1665.19,724.47 A720,720 0 0 0 1613.90,623.80 Z",fill:"#1b5e20",strip:null,stripColor:null},{wedge:"M1776.06,678.55 A840,840 0 0 1 1816.79,803.91 L1700.11,831.92 A720,720 0 0 0 1665.19,724.47 Z",fill:"#0d1b2a",strip:"M1776.06,678.55 A840,840 0 0 1 1816.79,803.91 L1801.23,807.64 A824,824 0 0 0 1761.28,684.67 Z",stripColor:"#00e5ff"},{wedge:"M1816.79,803.91 A840,840 0 0 1 1837.41,934.09 L1717.78,943.51 A720,720 0 0 0 1700.11,831.92 Z",fill:"#0d1b2a",strip:"M1816.79,803.91 A840,840 0 0 1 1837.41,934.09 L1821.46,935.35 A824,824 0 0 0 1801.23,807.64 Z",stripColor:"#00e5ff"},{wedge:"M1837.41,934.09 A840,840 0 0 1 1837.41,1065.91 L1717.78,1056.49 A720,720 0 0 0 1717.78,943.51 Z",fill:"#e65100",strip:null,stripColor:null},{wedge:"M1837.41,1065.91 A840,840 0 0 1 1816.79,1196.09 L1700.11,1168.08 A720,720 0 0 0 1717.78,1056.49 Z",fill:"#0d1b2a",strip:"M1837.41,1065.91 A840,840 0 0 1 1816.79,1196.09 L1801.23,1192.36 A824,824 0 0 0 1821.46,1064.65 Z",stripColor:"#ff9100"},{wedge:"M1816.79,1196.09 A840,840 0 0 1 1776.06,1321.45 L1665.19,1275.53 A720,720 0 0 0 1700.11,1168.08 Z",fill:"#006064",strip:null,stripColor:null},{wedge:"M1776.06,1321.45 A840,840 0 0 1 1716.22,1438.90 L1613.90,1376.20 A720,720 0 0 0 1665.19,1275.53 Z",fill:"#0d1b2a",strip:"M1776.06,1321.45 A840,840 0 0 1 1716.22,1438.90 L1702.58,1430.54 A824,824 0 0 0 1761.28,1315.33 Z",stripColor:"#ff9100"},{wedge:"M1716.22,1438.90 A840,840 0 0 1 1638.74,1545.54 L1547.49,1467.60 A720,720 0 0 0 1613.90,1376.20 Z",fill:"#0d1b2a",strip:"M1716.22,1438.90 A840,840 0 0 1 1638.74,1545.54 L1626.57,1535.15 A824,824 0 0 0 1702.58,1430.54 Z",stripColor:"#ff9100"},{wedge:"M1638.74,1545.54 A840,840 0 0 1 1545.54,1638.74 L1467.60,1547.49 A720,720 0 0 0 1547.49,1467.60 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M1545.54,1638.74 A840,840 0 0 1 1438.90,1716.22 L1376.20,1613.90 A720,720 0 0 0 1467.60,1547.49 Z",fill:"#0d1b2a",strip:"M1545.54,1638.74 A840,840 0 0 1 1438.90,1716.22 L1430.54,1702.58 A824,824 0 0 0 1535.15,1626.57 Z",stripColor:"#ff1744"},{wedge:"M1438.90,1716.22 A840,840 0 0 1 1321.45,1776.06 L1275.53,1665.19 A720,720 0 0 0 1376.20,1613.90 Z",fill:"#4a148c",strip:null,stripColor:null},{wedge:"M1321.45,1776.06 A840,840 0 0 1 1196.09,1816.79 L1168.08,1700.11 A720,720 0 0 0 1275.53,1665.19 Z",fill:"#0d1b2a",strip:"M1321.45,1776.06 A840,840 0 0 1 1196.09,1816.79 L1192.36,1801.23 A824,824 0 0 0 1315.33,1761.28 Z",stripColor:"#ff1744"},{wedge:"M1196.09,1816.79 A840,840 0 0 1 1065.91,1837.41 L1056.49,1717.78 A720,720 0 0 0 1168.08,1700.11 Z",fill:"#0d1b2a",strip:"M1196.09,1816.79 A840,840 0 0 1 1065.91,1837.41 L1064.65,1821.46 A824,824 0 0 0 1192.36,1801.23 Z",stripColor:"#ff1744"},{wedge:"M1065.91,1837.41 A840,840 0 0 1 934.09,1837.41 L943.51,1717.78 A720,720 0 0 0 1056.49,1717.78 Z",fill:"#2e7d32",strip:null,stripColor:null},{wedge:"M934.09,1837.41 A840,840 0 0 1 803.91,1816.79 L831.92,1700.11 A720,720 0 0 0 943.51,1717.78 Z",fill:"#0d1b2a",strip:"M934.09,1837.41 A840,840 0 0 1 803.91,1816.79 L807.64,1801.23 A824,824 0 0 0 935.35,1821.46 Z",stripColor:"#ffd600"},{wedge:"M803.91,1816.79 A840,840 0 0 1 678.55,1776.06 L724.47,1665.19 A720,720 0 0 0 831.92,1700.11 Z",fill:"#1b5e20",strip:null,stripColor:null},{wedge:"M678.55,1776.06 A840,840 0 0 1 561.10,1716.22 L623.80,1613.90 A720,720 0 0 0 724.47,1665.19 Z",fill:"#0d1b2a",strip:"M678.55,1776.06 A840,840 0 0 1 561.10,1716.22 L569.46,1702.58 A824,824 0 0 0 684.67,1761.28 Z",stripColor:"#ffd600"},{wedge:"M561.10,1716.22 A840,840 0 0 1 454.46,1638.74 L532.40,1547.49 A720,720 0 0 0 623.80,1613.90 Z",fill:"#0d1b2a",strip:"M561.10,1716.22 A840,840 0 0 1 454.46,1638.74 L464.85,1626.57 A824,824 0 0 0 569.46,1702.58 Z",stripColor:"#ffd600"},{wedge:"M454.46,1638.74 A840,840 0 0 1 361.26,1545.54 L452.51,1467.60 A720,720 0 0 0 532.40,1547.49 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M361.26,1545.54 A840,840 0 0 1 283.78,1438.90 L386.10,1376.20 A720,720 0 0 0 452.51,1467.60 Z",fill:"#0d1b2a",strip:"M361.26,1545.54 A840,840 0 0 1 283.78,1438.90 L297.42,1430.54 A824,824 0 0 0 373.43,1535.15 Z",stripColor:"#00e676"},{wedge:"M283.78,1438.90 A840,840 0 0 1 223.94,1321.45 L334.81,1275.53 A720,720 0 0 0 386.10,1376.20 Z",fill:"#0d1b2a",strip:"M283.78,1438.90 A840,840 0 0 1 223.94,1321.45 L238.72,1315.33 A824,824 0 0 0 297.42,1430.54 Z",stripColor:"#00e676"},{wedge:"M223.94,1321.45 A840,840 0 0 1 183.21,1196.09 L299.89,1168.08 A720,720 0 0 0 334.81,1275.53 Z",fill:"#006064",strip:null,stripColor:null},{wedge:"M183.21,1196.09 A840,840 0 0 1 162.59,1065.91 L282.22,1056.49 A720,720 0 0 0 299.89,1168.08 Z",fill:"#0d1b2a",strip:"M183.21,1196.09 A840,840 0 0 1 162.59,1065.91 L178.54,1064.65 A824,824 0 0 0 198.77,1192.36 Z",stripColor:"#00e676"},{wedge:"M162.59,1065.91 A840,840 0 0 1 162.59,934.09 L282.22,943.51 A720,720 0 0 0 282.22,1056.49 Z",fill:"#d50000",strip:null,stripColor:null},{wedge:"M162.59,934.09 A840,840 0 0 1 183.21,803.91 L299.89,831.92 A720,720 0 0 0 282.22,943.51 Z",fill:"#0d1b2a",strip:"M162.59,934.09 A840,840 0 0 1 183.21,803.91 L198.77,807.64 A824,824 0 0 0 178.54,935.35 Z",stripColor:"#2979ff"},{wedge:"M183.21,803.91 A840,840 0 0 1 223.94,678.55 L334.81,724.47 A720,720 0 0 0 299.89,831.92 Z",fill:"#0d1b2a",strip:"M183.21,803.91 A840,840 0 0 1 223.94,678.55 L238.72,684.67 A824,824 0 0 0 198.77,807.64 Z",stripColor:"#2979ff"},{wedge:"M223.94,678.55 A840,840 0 0 1 283.78,561.10 L386.10,623.80 A720,720 0 0 0 334.81,724.47 Z",fill:"#4a148c",strip:null,stripColor:null},{wedge:"M283.78,561.10 A840,840 0 0 1 361.26,454.46 L452.51,532.40 A720,720 0 0 0 386.10,623.80 Z",fill:"#0d1b2a",strip:"M283.78,561.10 A840,840 0 0 1 361.26,454.46 L373.43,464.85 A824,824 0 0 0 297.42,569.46 Z",stripColor:"#2979ff"},{wedge:"M361.26,454.46 A840,840 0 0 1 454.46,361.26 L532.40,452.51 A720,720 0 0 0 452.51,532.40 Z",fill:"#37474f",strip:null,stripColor:null},{wedge:"M454.46,361.26 A840,840 0 0 1 561.10,283.78 L623.80,386.10 A720,720 0 0 0 532.40,452.51 Z",fill:"#1b5e20",strip:null,stripColor:null},{wedge:"M561.10,283.78 A840,840 0 0 1 678.55,223.94 L724.47,334.81 A720,720 0 0 0 623.80,386.10 Z",fill:"#0d1b2a",strip:"M561.10,283.78 A840,840 0 0 1 678.55,223.94 L684.67,238.72 A824,824 0 0 0 569.46,297.42 Z",stripColor:"#e040fb"},{wedge:"M678.55,223.94 A840,840 0 0 1 803.91,183.21 L831.92,299.89 A720,720 0 0 0 724.47,334.81 Z",fill:"#b71c1c",strip:null,stripColor:null},{wedge:"M803.91,183.21 A840,840 0 0 1 934.09,162.59 L943.51,282.22 A720,720 0 0 0 831.92,299.89 Z",fill:"#0d1b2a",strip:"M803.91,183.21 A840,840 0 0 1 934.09,162.59 L935.35,178.54 A824,824 0 0 0 807.64,198.77 Z",stripColor:"#e040fb"}],Iy=1e3,Ny=780,Bw=40,A1=Array.from({length:Bw},(e,t)=>{const r=t*360/Bw-90,n=r*Math.PI/180;return{x:Iy+Ny*Math.cos(n),y:Iy+Ny*Math.sin(n),rotation:r+90}});function jO(e){return e===Bw?A1:Array.from({length:e},(t,r)=>{const n=r*360/e-90,s=n*Math.PI/180;return{x:Iy+Ny*Math.cos(s),y:Iy+Ny*Math.sin(s),rotation:n+90}})}function qd(e,t,r,n){return n===r||((e*360/n-90+t)%360+360)%360<=180?e:(e+r)%n}const xhe=Ri.FLIGHT_DURATION_MS,jR=Ri.LIFTOFF_DELAY_MS,IO=Ri.BOARD_ROTATE_MS,Ahe=`transform ${IO}ms cubic-bezier(0.4, 0, 0.2, 1)`,IR=1e3,b_=Ri.DESTROY_BLAST_MS;function khe(e){return e<=1?1:e===2?.72:e===3?.62:e===4?.54:e===5?.48:.44}function She(e){return e<=1?1:e===2?.62:e===3?.52:e===4?.44:e===5?.39:.35}function Ehe(e,t){if(t<=1)return{dx:0,dy:0,headingDeg:0};if(t<=6){const v=-Math.PI/2,A=t===2?42:38,_={1:[0],2:[0,3],3:[0,2,4],4:[0,2,3,5],5:[0,1,2,4,5],6:[0,1,2,3,4,5]},w=_[t]??_[6],j=w[e%w.length],T=v+j*(2*Math.PI/6),R=Math.round(Math.cos(T)*A*100)/100,P=Math.round(Math.sin(T)*A*100)/100,k=Math.atan2(-P,-R)*180/Math.PI;return{dx:R,dy:P,headingDeg:k}}const r=[6,10,14];let n=0,s=e,o=t,i=r[0];for(;n<r.length-1&&s>=i;)s-=i,o-=i,n+=1,i=Math.min(r[n],Math.max(o,1));const c=42,u=16,p=20,d=c/(2*Math.sin(Math.PI/Math.max(i,2))),f=Math.max(p,d)+n*u,h=-Math.PI/2+2*Math.PI*s/Math.max(i,1),b=Math.round(Math.cos(h)*f*100)/100,g=Math.round(Math.sin(h)*f*100)/100,y=Math.atan2(-g,-b)*180/Math.PI;return{dx:b,dy:g,headingDeg:y}}function Phe(e,t){const r={1:[{dx:0,dy:0}],2:[{dx:-30,dy:-2},{dx:30,dy:-2}],3:[{dx:-30,dy:-14},{dx:30,dy:-14},{dx:0,dy:24}],4:[{dx:-32,dy:-16},{dx:32,dy:-16},{dx:-32,dy:18},{dx:32,dy:18}],5:[{dx:-34,dy:-18},{dx:0,dy:-20},{dx:34,dy:-18},{dx:-18,dy:20},{dx:18,dy:20}],6:[{dx:-39,dy:-21},{dx:0,dy:-23},{dx:39,dy:-21},{dx:-39,dy:24},{dx:0,dy:26},{dx:39,dy:24}]};if(t<=1)return{dx:0,dy:0,headingDeg:0};const n=r[Math.min(6,t)]??r[6],s=n[e%n.length],o=Math.atan2(-s.dy,-s.dx)*180/Math.PI;return{dx:s.dx,dy:s.dy,headingDeg:o}}const Che=0,Rhe=({players:e,currentPlayerId:t,onMoveStart:r,onFlightStart:n,onArrival:s,zoom:o=10,boardRotation:i=0,tileCount:c=40,gameTileCount:u,jailTileIndex:p=10,onlyCurrentPlayer:d=!1})=>{const f=u??c,m=c===40?A1:jO(c),[h,b]=l.useState(()=>{const N={};for(const S of e)N[S.id]=S.tileIndex;return N}),[g,y]=l.useState(new Set),[x,v]=l.useState(new Set),[A,_]=l.useState({}),[w,j]=l.useState(new Set),T=l.useRef({}),R=l.useRef({}),P=l.useRef({}),[k,E]=l.useState({});l.useEffect(()=>{for(const N of e){const S=N.tileIndex,F=T.current[N.id];if(F===void 0){T.current[N.id]=S,b(W=>({...W,[N.id]:S}));continue}if(F===S)continue;T.current[N.id]=S,clearTimeout(P.current[N.id+"_rotate"]),clearTimeout(P.current[N.id+"_snap"]),clearTimeout(P.current[N.id+"_arrive"]),clearTimeout(P.current[N.id+"_landed"]);const D=N.id===t;y(W=>{const G=new Set(W);return G.add(N.id),G}),_(W=>({...W,[N.id]:i})),D&&(n==null||n()),P.current[N.id+"_rotate"]=setTimeout(()=>{D&&(r==null||r(F,S))},jR);const H=jR+IO+Ri.SNAP_BUFFER_MS;P.current[N.id+"_snap"]=setTimeout(()=>{b(W=>({...W,[N.id]:S})),_(W=>{const G={...W};return delete G[N.id],G}),j(W=>{const G=new Set(W);return G.add(N.id),G}),v(W=>{const G=new Set(W);return G.add(N.id),G})},H),P.current[N.id+"_landed"]=setTimeout(()=>{j(W=>{const G=new Set(W);return G.delete(N.id),G})},H+100),P.current[N.id+"_arrive"]=setTimeout(()=>{y(W=>{const G=new Set(W);return G.delete(N.id),G}),v(W=>{const G=new Set(W);return G.delete(N.id),G}),D&&(s==null||s(S))},xhe)}},[e,t,r,n,s]),l.useEffect(()=>{const N=new Set(e.map(S=>S.id));for(const S of e){const F=R.current[S.id]??!1;if(R.current[S.id]=S.depleted,F||!S.depleted)continue;const D=h[S.id]??S.tileIndex;console.log("[PIECE EXPLOSION] Triggering for",S.displayName,"at tile",D,"duration:",b_,"ms"),E(H=>({...H,[S.id]:{tileIndex:D}})),clearTimeout(P.current[S.id+"_destroy"]),P.current[S.id+"_destroy"]=setTimeout(()=>{console.log("[PIECE EXPLOSION] Removing piece",S.displayName,"after",b_,"ms"),E(H=>{if(!H[S.id])return H;const W={...H};return delete W[S.id],W})},b_)}E(S=>{let F=!1;const D={};for(const[H,W]of Object.entries(S)){if(!N.has(H)){F=!0,clearTimeout(P.current[H+"_destroy"]);continue}D[H]=W}return F?D:S})},[e,h]),l.useEffect(()=>()=>{for(const N of Object.values(P.current))clearTimeout(N)},[]);const M=l.useMemo(()=>e.filter(N=>(!d||N.id===t)&&(!N.depleted||!!k[N.id])),[e,k,d,t]),C=l.useMemo(()=>{const N=new Map;for(const S of M){const F=h[S.id]??S.tileIndex,D=N.get(F)??[];D.push(S),N.set(F,D)}return N},[M,h]),I=l.useMemo(()=>[...M].sort((N,S)=>(N.id===t?1:0)-(S.id===t?1:0)),[M,t]),L=N=>`zentara-piece-outline-${N.replace(/[^a-zA-Z0-9_-]/g,"-")}`;return a.jsxs("g",{id:"piece-layer",children:[a.jsxs("defs",{children:[a.jsx("filter",{id:"zentara-piece-shadow",x:"0%",y:"0%",width:"100%",height:"100%",children:a.jsx("feColorMatrix",{type:"matrix",values:"0 0 0 0 0  0 0 0 0 0  0 0 0 0 0  0 0 0 1 0"})}),I.map(N=>a.jsxs("filter",{id:L(N.id),x:"-35%",y:"-35%",width:"170%",height:"170%",colorInterpolationFilters:"sRGB",children:[a.jsx("feMorphology",{in:"SourceAlpha",operator:"dilate",radius:"2.2",result:"expanded"}),a.jsx("feFlood",{floodColor:N.pieceColor||"#ffffff",floodOpacity:"0.95",result:"factionColor"}),a.jsx("feComposite",{in:"factionColor",in2:"expanded",operator:"in",result:"coloredExpanded"}),a.jsx("feComposite",{in:"coloredExpanded",in2:"SourceAlpha",operator:"out",result:"outline"}),a.jsx("feGaussianBlur",{in:"outline",stdDeviation:"1.4",result:"softOutline"}),a.jsxs("feMerge",{children:[a.jsx("feMergeNode",{in:"softOutline"}),a.jsx("feMergeNode",{in:"outline"})]})]},`outline-filter-${N.id}`))]}),I.map(N=>{var Z;const S=h[N.id]??N.tileIndex,F=A[N.id],H=qd(S,F!==void 0?F:i,f,c),W=m[H];if(!W)return null;const G=C.get(S)??[N],$=G.indexOf(N),K=S===0,de=K?Phe($,G.length):Ehe($,G.length),ie=K?She(G.length):khe(G.length),we=g.has(N.id),he=N.tileIndex===p&&S===p&&!we?N.inJail?"Cryosleep":"Visiting":void 0,Ae=de.headingDeg+Che,Fe=W,U=qd(N.tileIndex,i,f,c),V=m[U],z=we&&Fe&&V&&N.tileIndex!==S?Math.atan2(V.y-Fe.y,V.x-Fe.x)*180/Math.PI:Ae,O=F!==void 0?{transformOrigin:`${IR}px ${IR}px`,transform:`rotate(${F-i}deg)`,transition:Ahe,willChange:"transform"}:void 0,q=k[N.id]??null,X={transform:`translate(${de.dx}px, ${de.dy}px)`};return a.jsx("g",{style:O,children:a.jsxs("g",{className:"zentara-piece-slot",style:X,children:[a.jsx(tD,{initialX:W.x,initialY:W.y,shape:N.piece,isCurrentPlayer:N.id===t,rotation:F!==void 0?-F:-i,rotationTransition:F===void 0&&!w.has(N.id),zoom:o,label:he,isMoving:we,isLanding:x.has(N.id),landedHeading:Ae,flightHeading:z,sizeScale:ie,pieceColor:N.pieceColor,outlineFilterId:L(N.id),tier:(N.heroId?(Z=Ta[N.heroId])==null?void 0:Z.tier:void 0)??1}),q&&a.jsxs("g",{transform:`translate(${W.x},${W.y})`,pointerEvents:"none",children:[a.jsxs("circle",{r:22,fill:"none",stroke:"rgba(255,190,60,0.85)",strokeWidth:14,opacity:1,children:[a.jsx("animate",{attributeName:"opacity",from:"1",to:"0",dur:"1.2s",fill:"freeze"}),a.jsx("animate",{attributeName:"r",from:"22",to:"172",dur:"1.2s",fill:"freeze"}),a.jsx("animate",{attributeName:"stroke-width",from:"14",to:"2",dur:"1.2s",fill:"freeze"})]}),a.jsxs("circle",{r:14,fill:"rgba(255,120,40,0.35)",opacity:.9,children:[a.jsx("animate",{attributeName:"opacity",from:"0.9",to:"0",dur:"1.1s",fill:"freeze"}),a.jsx("animate",{attributeName:"r",from:"14",to:"124",dur:"1.1s",fill:"freeze"})]}),a.jsxs("circle",{r:8,fill:"rgba(255,245,190,0.7)",opacity:1,children:[a.jsx("animate",{attributeName:"opacity",from:"1",to:"0",dur:"0.9s",fill:"freeze"}),a.jsx("animate",{attributeName:"r",from:"8",to:"78",dur:"0.9s",fill:"freeze"})]})]})]})},`piece-${N.id}`)})]})},The=ot.memo(Rhe),NO="data:image/webp;base64, ",MO="data:image/webp;base64, ",k1="data:image/webp;base64, ",S1="data:image/webp;base64, ",LO="data:image/webp;base64, ",Fw="data:image/webp;base64,UklGRjILAABXRUJQVlA4ICYLAADwKwCdASqAAIAAPlEgjkSjoiEVi6WcOAUEtQxPk+1AIvj+A/i3ox2D+8b3yTK2z/jP+B7G/MA8br9Zvc3+4fqI/WX9pPeK/0vqx/vHqD/0X/MdZz6Df65emR+7Xwjft/+6ntVf/+tZc6fuj205SkSDtv/VcP/xJ/svJp/puA5AJ+e/1D/eflvzG/YD/VbEr5f7AH82/u3oYfUHo/+m//L7iP84/t3/R7Fnol/sAf8jDX/85LEDU3Nhwz0qQTDoSxEBXnD0WKbVqZVvtlP+EcbVOtMBrz4HqeqbjtHy9MJc7toFIzxNWBRZxF3edFcSqgCg6TaLhpGJ7gQTPrXJT96MlastDx/yltuCyIvRqU88QTQWsRSEqElYdrwW07fBt0lctefmFvNTAWvEp7g98CW0hCQ1ITwqZR98aJYYw2LDwooSfDt5DuBkESyD0LLm/7jSirHLncuDkGTJmREyIhbBHGXeTj1b8yAA/v4HbeHAACFubZsENQTt3b8uMvw9e2fN8gzsZmngr11NPWwibOWm9hc8j/Z24UZ/J+Z152x/hNSZ3LxsEURyFLVFv3vX4EeAbnH6wLGAaur4buiPuqYcTgS5uOc067iI+1S8jhmA0sScd+SOEbyVa7Ix4J0Y84H9UO9zP5UWWrl66DBk9IAvk8MouA4bLQJTOFXg1UTHBo1+c4qZsOGhWfibahaVVoDPZYA3ud9SJi/lFs0zD9oBqf7Ca14VHxxWSNk6569z9SudJp/M4FVmJ2S2p+RdCLgdMKpKIh2SgsehpQdpNHmShtYQnBueUgNrCBanFLz4GWimY4fa7h8LB/xJlEF3YC0raSUQEYooNw3ngCQsbAM5YIqVlO9JVnZz/lrDp//sIox9gdfg8whG43ePD0l2/ya8/2yA3lIJgToSQzBJi7+ojESpZUGzp6LscwlKyJ/vPg4VBezgHpP5qfo+xBW3fWFRe9A54K0t6ARjKCA+be8DyTOcFCJ0fv/dleqihupaTgSF0WytTb0k4zaikWn+msixl9PK/wbD2Xsk6dEHAkMo1fvn7//VWgLVXRm5dqvTKWvn6xYC04sLnQimqpZoepE7fd2DY54Jqm481g11jPyWKzirsRJuccjYq3gyW5gPbWhTZV+5zZDv3oCAiNd/0YMBzqZeuW84ENpl8w23V7nm2jNeWbUd4jiPZCCvdk9qGXs5m36ASA8U3YfMJeJP1bH9tOdYhbQo02/c3p3vWOrFZY5aUyW4TkDWVwpbpD/rNTPuhZZrMpxJ9wZfb+FTa6McEcx/vv2rWDt3II/QJYmPe3CNi5De4SfMM32ZM1qkNxraibHUyqr/4ZowP+e8P3L0qgY4RPt1Z8+2FXvwVQoXhB65tqwx+Uf9RV85jvYx6R3pC2UFuW/xvltxFRMQ7xw1B/7CRj1Oepghurb/C5GuJNZzvM0txtd5EPuV5IYQc9gNZary0B/LsM5PoUeHqNTLUpDuEn0snX29nBPU70dEe/b9ohCWbSN8h5ZO1TfYP6l8k4X7p8AryKWqtRpi/w7mXW+DdFLWKkMLytIQhWiuOJtgz6BWcikef4/rb6IkAIA8oo7QY9SYnXEf2EGiiQ4OufIy4ZwMPhn/Eb6h8pLuplvsg/Yn7HO/zXa1Atvrz7izopRwynCoFu7zg/5Xe+1Y/O2S2XPUQpe4PgRXdRDkXN1m2nAHdqV/Yl75yobP4LbL94qXFN3s1wryHDp+48NCbLfzL4wDFO7LVcQeduWFRSufRac1PXYbeMNIPvHman7RvjWi2Go8nLYI5gN2bzoDDk6bphNU02LeVS4/qeuHYsHBAmUvUX5SMAMUDS8k9b186/Wi/McRTHTx+if4mKl9+uafb8eU7wrWHMKbWgi70cD+KajY3T/vfpW2UHdPdKcxB09xV/20n6eHkMMItUbIcDlfL1IR3WJZfsgx/1waxrAZ1kauESTWRzzruF2MBgV0lXDxO0K4ImN2ewfOBUw9ekuy/xadilwKJ/hQuZO+/qMT3+NG3wswM9XDNCkuRVoNoPVyVFaAodKzr+X2CLcrjhdtaEifeeV63EgB3+5RRWin2kTbDR34byHl03kdr90aSdQ6wDJ8vwNDcqoKy2OAnLCf5hxNt+LKP0NPlBC4W7ifaeLpLHMPeTsP/9kKuJqpzW9Dg39bgbuz1pmCi26KxRxn+iHqXhzv/HvKLNriUDDeQxJAi/DkwPmj0iISVIb7MpjVwJH7a+TIfVTUHBzAmCWkgw3KJUtt5IuLiG9OfummH+q9NSeE7TSoNxaf+bYYzw5xssGp0SYJ5o7RTHwqIdydP/fwKhzZF7P1YKijd/U7uQILRBfWqxfasXg3vcFBZC7FUqINsQsEQjcyDmVJJ2KwVwl2sKE4H5kp81pZvtVM/dCN6VcKsMEapQkHEf2/Yj/TcpAA+xFu+3KJ+bj+FY9HO1kkr0pEjOpN4kGU1xpQDtltG0YIXXINfPVio4mr37p11CbUloI6P/wiNfwIQeE4ywogegMKZYMNwlCjQpE27PWrmLhxw47oJo4w5a8r9IcnYp+UliiVOOZeryqfYlfO0//Q1TpwVchjiEM0Q6LH8CK9BRruUQefneG1rDhirhlB3+2vTdPHQGh9dfVNfgS1DgaRmXTySi2/3pNBAj0qIj0xhBuO1r92DJHEqM2hm+8+dJ2kkjpa1ylvrCWOTSfReD27a1fw05sNV1O+91UacMjubHZRJI9FGM1Uk2KX9/nZ+MsHNP4lxEEfkJkG8vVjTkgRKGoJllOgk9I8FVN26tAc83k0MBoE4IkE3L+SKW/dYVSALfW8S942PaoH+me0Au8a8FHXyzHJUB5Cjp+ddJdmf+Ro/Wmc55q9Pv7f8/lwWzMuyk7uakPHvvhDLc9wgSHx1GvgCOMRnNQyaab6hyn6pXO8b0S7zC+cD2A75QgbsF0pbT9kkpJksyr41pZHKT2YcpsWASKQ1Lit6quXfRRUpYOfH/Bn5jy0C2nAAOAKfYMT7BjVkPzFPa9tF3VXENrN9JZ2Ww3CWrwTsz7B+5wWnTL1/NE5lflX+M3dN3MOCwhp7aIr1fz4zml2ZffIFKrIX4w2RPAn/RcgZk8pqLY5SX79sNcb9pwG8oP6o3lSM0q1TzRcOOx4gEV31Nie66LkOSHO9OGeHCev2pbTmOi2vIGKSDNIKb/cZSEA7+16ezDq//h3YkCi5D+rXi16tF3K57z3/WzG6jHd5T2OGnPV1ylC27fPlFptyTp4F6q0nNJgbQ3+ydw4VBso3JrpSOgZa2/4ElrfHBfMmqDO/OVRdpFeGLS5b0Ow3kO8xZG5o/L+4K6ddVO8ffp3e3i0jRBCW1hT6lT4gseeQkGHtGl/85Fw4XxDHmd/Ru9XM/T3FzCvgm8Hmy1IF+Bl3/XbLFH+M69R/uHHx7/zA+WmDqY6vOom0n4iDs4OuBBRcldBxwhtEFxz/yqRfWXoH/az+StEZulkrgxadtbCcfUiYoSKitUenWvWVfpGXk3YfP/4JLCZAh03W0T+pEOFXU9WMpfJt8p6uivr4dDXTvNaH9OG6t8/1IpRL/BOVHjmPOIIjEIjD8poMu9hwuHJ+I/P6JFIO/haUrBKNvNMzUK6y6DVbVWDK0Y//tKxSG95QtBXiNq3+Jvz5rR/6KLRWkNmU9U+/HnZyidsnn63O25Dxj5VokAc+hcVa42o7wF5PhUBU7KTs046XlPcFcyYUmF5RDuFD1dIAzA/hxwqCR3XNrg/uAbzpsSyGUyh3JjCrEeaAj5b8p55ZTSgFj3pZvvBxXnlvE4kbteDcgmxTYgAAAAA",DO=""+new URL("tile_station-BU45WlAz.webp",import.meta.url).href,OO="data:image/webp;base64, ",zO="data:image/webp;base64,UklGRk4LAABXRUJQVlA4IEILAAAQLQCdASqAAIAAPlEgjEUjoiEVjAYYOAUEswBqQk6ljkqWH/D/hzlbCxWH/U/+iPYA/UP9XOvp+0XqS/Zn1x/SH/qvUA/znUAehX5bX7l/Bd/a/+R+1/theoBa3+gn2+oO9q/7/8oeS35EagX47/Ot/jsf6BHsB9m/2/pszVrrnjN6AH8v/u//W9WDPM9Sf+j3B/5n/Zv+V2IvQ5/bdGAIO6SZ6eclIr/9OjX5AKqIzKlusmkdQ1bCEVswGO4SAW4xJFt1zZ0ZkvpYMd/PdbjIrm8iONKy2H70A9TVKBSiYq+sm5i27sYJomy4HarM/6X4nwWc8ip8nQm0sV/1b5ucksYLE8CUa80/NlVq3nu9A/KyJfq+PYBjyWrYcI5ciePei3bpZUmVS8wExk/WR452Fcx2iUr+nolvQpNb+tm5uVr1h2GbAiI3sUdWQ+AveMhPy/LCU9WntOu1CnEjP5Vi9nfa+ZoCWdNKu1RDT5kheQAA/v586yfQABpzbgQ/GyviVQXzfOjRO1J0msj36dPweZYt+KEArYmNAxAj3VgAj4leYDz0lORAe51emrIf4kSCM8KJ0eTXkct5PTfTe+Ij3SAdY1QDcpw3OhC+hd165UlVLHZ9bigB8h6fHIFU4JvPhCrftRfdUrWHxXwpmAk2GHTI7NwAQegB7J+0/Ux6ZdS3NbAcFo/B3QEj5orF//Nt1nDxRXcWE+3g0FTpKJEN6fvB8rYB1XQU8x9umCeoizHZkgm92cuMDoOTspILNOLd280eCAkrLKa884RIYm+DNxlCXmJf2QUh2CJ+GXM4F1ke3yVskUl9cDjjvYPaUb7fxE44QFtXFsTENaNhJkGzJ6TiOnHpw0ELVlYd0UF2Er9TW0Ry8s5nQiIIFArFb02+LNKoGbwE4O+OjGqxIZu8CTF00o/bgBHk6U0/jWRZfFyYT7QC6Xm9jhmH3p/gXEXY8/SokyiO4imXC7id89PL1OMI8SPUzi/RjfgrG/wb3X/w1NzisXwRUtu8T7SD1GdnvjbVfL7bgcO7anhzNaEOZQNgw5Pff8UdJ8AV4YUniKriJxPWjIivIsv78YiVdqzGyD69/CoOdlWzVrpepWpgP2Fr+Z9GmrXDVYcFuRyy2eZtOw9rjDv9QNsSKzm545J7Bdq0gYDYD2NrbkJHExD2ilWI+hHTnnh/W7Baus20carwsCSX5Wz1ZVU7Erxjta+FQ3ZJy0jmeIhaqZgazvqulw2uOlkIQRdjhAxaYvVx4hU082gxTb0YMEGAxvN/s/nSYf3uv0DSHLB6NUyhI0cfQR/J5BpWE7Fz8H0qgjauuwR50FxjN77UWsMFfP31F1VVfXmtcQhnLa/fwJwwoiSEYxs1DwURovLXFnkswLFnecaPmDHa00ABXG2B4zjamHTAUGmawOiNiMG0Ne7YiNiUpBRkXtl5aZHIuAdoOln433y4qhwZfrg/WIgOryuyUHQcNPsk45XwjYWrKO8HlvoS/5/igyhkyRTsAm/pjfiI7DaoSLWiCALdySrI5xC7b+/WH5y6U8BxEGW5Fs6BR2Xh8fdzcALeMDvJ6l3bWljb3Pe+pcbB2eJOH80Y51+0lQcYi/6O/IiiPie/EbfNm/LkuVRetRKpvmpHtT9ytwgMtn1IGMNcIxjm7NPeJc4+pul908Gbn70CpsfIQ/Od2U7kyGL6Bu29tG615baJjLojt3ARfsoMuunr6XyJo0LvfSVimpsr38cw2DqrfBoGNRr4YhScM+4IpaSQ9vHGqHLq6H+zZ5ayIAbu9Acmw0pADRl7uHN15x98mwZExhmGLdr2Ei63LnKdjOMxqiD0p22S7DEJS45KfZGlAN63263cO57j3QZilkqPzT1+3W7hpZLJpfQqQPQztKyEAeL4kWuQPd48u3+YxiQeslw/OCScB438ylk8AYCbQl3FAw02/Wt1wOSLGQFp5Xh8OfZsOJYu0ocl0R++oMLMmOdVC5FwrnECk8O69BkX98OUyy7u0QcpWBgXtHsyHZSGdZUeFmgIRiM6izM2VDcPmrn4uHZWW9nAK/7IXPiqlFdcyV/9S11qJfdRlIZpmO3LlWCwmb2X9Cfr+F3izTqn/vkF645WXbb9I8GK3dUMnUgPYm9HrKq8MNYkbncLqdRb//FT/4Ex43MYV83AuRbi9dAD1quEKAuCKJqHVFf1LE6d6ljXy8lelc1+6SkjY5u+FGVwch65nITiN8IZk44knJ0ud/N4nbdacfrlqYcwQoDcEUPBSOREPL+BHpZEA++k4cLlt3L82yfd08Vkt6bsYNnWWLznY7WjfQG5EP3b+MKhqL0FEjmsxEUXFIxsLB0q7JdF5p/Lutf+m9hlMYRRBqMVli7N92NzIi37ek48Q1alqClgTCTjr2ep9FEioEKOSFi6VLbSnv1BGDKRZr9bG8PdHqSbLhYhOhRQ3cWEyBwsQyWk/1Vy8yVEFYQyZ4hpy/86F3wqYj2X/kD96hvRwI334NcLyJqmOZ30mVZg6gNW/EceTDXseuXzKqXd/67y9dmVLeEC7EY8+a1kH71oI/KXScmkKZoPaLd9gncx2ATboKspDKEOXg90h1B8MovJHniZzHOvg1x/vXPso+P+EOgsDMEL3oyu+iGsSeTW+GEqjx2epeFti3JELi3v7Ip8kZ7cU2yTwJNdaTB65Efwiz4v20xQWoDop86cgqVYKG9kyQ9QkbDuW2dz2P6ySVyFLIJPUsDHT1hc8kn79gz55LPBnWgcm9kOHsWmnY0nGCK4u+IJjW823Z3wJrY+uLPF/32WCOdVbrFfzZe57UxPFbkmrwB/YPEccjeDdndNrTk+v64ZCGAHW04fwSecUh3YLCBrRRIf/bXvK7E7KqMl6e71297k5atDxAP6a1xrJvxd0vOB2W4fsfnOGE/07KlUhaSmDimpz3Kwwc6fYq/+jmNlOWvRNZsnvCtHhTG5xSq/sS9U/48Z6MJi5ZU7quET36hA+YFA07WWsfLmZAk9DOz2bRU2dpUx6f8EmUsC3eLeS3WSUfHlZOsox1P9D6f0eIu13H8AoB7pGGteRu6ShCeqvTEcqXqQtjZGssqkZS80hYEAFJZzkFGy/lg5JXu32ZyF3lJar9TxRutaJyjRA66MWmQ/6bqQZ4WUGSliVZhnN6i25fW173N/LwrWGBLL/b6F9um50U2sqpce736cY2hIT97Rz7GZ1/qVD+pT/qJ1CelARtlVV8TxGwZTso4YnNMQP/4pNs8F684+EyVUNzCFemxA7zCn1I1aYrWBi4a4tsgrt5lXBSCsnNruFWfA7wWUuKk6QxlLYYbM//GQ3B4bIzH97WIBvb+4xxPo3D/TCAg3YAd8ZOPA0nsrNsupgrYpxB7Rx2k9JPf6mwfEsEsI4JuhuZiNlKYAM6lKo6yVZl10B2R2YhB4aIoVUOM1yvpA9/fmRLwB5pGI3AyiW0bWguFLG+qf3/TTC/d7/lVO+S/Ohmfkqep8MmqD/zQXur3f7Bh//xGVq6Vxb9eFF3ZXImBBZU7OrywimSDauI97kTEq0HqSpXq78Cf3rTcfmA6V8sh+2AmUyWnMmVQJaIS787nhmmNIKFe6Xl8L+1012xfZPwC8nfoM4v357hpmeKOM9x/+PEflE8GrUw9NlIPxDxKVLKp/lCAKzE55aJOsdluLZl5eu3B/cQGruT1mHo2vxU4phP7ONH5D7RxVrD15ZWuv4DU3H16g9wMLYq9/k+7r/4I/qif/AP/i6U89HJIWEDhVFXCoEvSnIyEcvtC03FkCLQ1xDelANRc4dsYG5EjUoQYTndZ6TR8KTsUAuId+bELEirzOxMfS07EpwnMAN/nHQAAAAA==",BO="data:image/webp;base64, ",E1=""+new URL("explosion-CCKtR9yS.webp",import.meta.url).href,jhe=Object.assign({"../../assets/optimized/azzure_turret_1.png":Gme,"../../assets/optimized/azzure_turret_2.png":Xme,"../../assets/optimized/azzure_turret_3.png":Yme,"../../assets/optimized/azzure_turret_4.png":Zme,"../../assets/optimized/azzure_turret_5.png":Kme,"../../assets/optimized/crimson_turret_1.png":Qme,"../../assets/optimized/crimson_turret_2.png":Jme,"../../assets/optimized/crimson_turret_3.png":$me,"../../assets/optimized/crimson_turret_4.png":ehe,"../../assets/optimized/crimson_turret_5.png":the,"../../assets/optimized/emerald_turret_1.png":rhe,"../../assets/optimized/emerald_turret_2.png":nhe,"../../assets/optimized/emerald_turret_3.png":ahe,"../../assets/optimized/emerald_turret_4.png":she,"../../assets/optimized/emerald_turret_5.png":ohe,"../../assets/optimized/gold_turret_1.png":ihe,"../../assets/optimized/gold_turret_2.png":lhe,"../../assets/optimized/gold_turret_3.png":che,"../../assets/optimized/gold_turret_4.png":uhe,"../../assets/optimized/gold_turret_5.png":dhe,"../../assets/optimized/silver_turret_1.png":phe,"../../assets/optimized/silver_turret_2.png":fhe,"../../assets/optimized/silver_turret_3.png":mhe,"../../assets/optimized/silver_turret_4.png":hhe,"../../assets/optimized/silver_turret_5.png":ghe,"../../assets/optimized/void_turret_1.png":yhe,"../../assets/optimized/void_turret_2.png":bhe,"../../assets/optimized/void_turret_3.png":vhe,"../../assets/optimized/void_turret_4.png":_he,"../../assets/optimized/void_turret_5.png":whe}),Ihe=Object.fromEntries(Object.entries(jhe).map(([e,t])=>[e.split("/").pop()??e,t])),Nhe={"crimson-dominion":"crimson","silver-pact":"silver","azure-sovereignty":"azzure","golden-imperium":"gold","emerald-collective":"emerald","void-enclave":"void"},Mhe={"crimson-dominion":0,"silver-pact":0,"azure-sovereignty":0,"golden-imperium":135,"emerald-collective":0,"void-enclave":135},Lhe={"crimson-dominion":!1,"silver-pact":!1,"azure-sovereignty":!1,"golden-imperium":!0,"emerald-collective":!1,"void-enclave":!0};function Dhe(e,t){const r=Nhe[e],n=Math.max(1,Math.min(5,Math.trunc(t))),s=`${r}_turret_${n}.png`;return Ihe[s]??null}const NR=zr.getPlatform()==="android",sn=1e3,ip=780,Qa=ip-60,qa=ip+60,Hm=40,lu=360/Hm,wd=80,Zp=sn-qa-wd,Bh=(qa+wd)*2,Ohe={start:NO,planet:MO,asteroid:k1,nebula:S1,wormhole:LO,"void-drain":Fw,station:DO,jail:OO,"go-to-jail":zO,"free-parking":BO},zhe=["#283593","#2d1060","#6a1b9a","#2d1060","#c62828","#455a64","#0c3545","#2e7d32","#0c3545","#0c3545","#ef6c00","#3d2010","#00838f","#3d2010","#3d2010","#455a64","#3d1018","#6a1b9a","#3d1018","#3d1018","#43a047","#3d3008","#2e7d32","#3d3008","#3d3008","#455a64","#103520","#103520","#00838f","#103520","#e53935","#102050","#102050","#6a1b9a","#102050","#455a64","#2e7d32","#351040","#c62828","#351040"],Uw=["#283593","#2d1060","#0c3545","#0c3545","#ef6c00","#3d2010","#3d2010","#6a1b9a","#3d1018","#3d1018","#455a64","#3d3008","#3d3008","#6a1b9a","#103520","#103520","#e53935","#102050","#102050","#351040"];function Bhe(e){return e===20?Uw:zhe}const Fhe=Array.from({length:Hm},(e,t)=>{const r=-90+t*lu,n=r*Math.PI/180;return{cx:sn+ip*Math.cos(n),cy:sn+ip*Math.sin(n),baseRot:r+90}});function v_(e,t){const r=((e+t)%360+360)%360,n=r>90&&r<270;return{angleDeg:n?e+180:e,flipped:n}}const MR=Qa+14,Uhe=Array.from({length:Hm},(e,t)=>{const r=-90+t*lu-lu*.4,n=r*Math.PI/180;return{x:sn+MR*Math.cos(n),y:sn+MR*Math.sin(n),rot:r+90}}),qhe=Array.from({length:Hm},(e,t)=>{const r=-90+t*lu+lu*.38,n=r*Math.PI/180,s=Qa+8;return{x:sn+s*Math.cos(n),y:sn+s*Math.sin(n),rot:r+90}}),Vhe=[18,24,32,42,54],Hhe=[.6,.75,.9,1.1,1.4],Whe=Array.from({length:Hm},(e,t)=>{const n=(-90+t*lu-lu/2)*Math.PI/180;return{x1:sn+Qa*Math.cos(n),y1:sn+Qa*Math.sin(n),x2:sn+(Qa-12)*Math.cos(n),y2:sn+(Qa-12)*Math.sin(n)}}),__=e=>/^#[0-9a-f]{3,8}$/i.test(e);function Cl(e,t){const r=e*Math.PI/180;return{x:sn+t*Math.cos(r),y:sn+t*Math.sin(r)}}function cs(e){return e.toFixed(2)}function Ghe(e,t){const r=360/t,n=-90+e*r,s=Cl(n-r/2,qa),o=Cl(n+r/2,qa),i=Cl(n-r/2,Qa),c=Cl(n+r/2,Qa);return`M${cs(s.x)},${cs(s.y)} A${qa},${qa} 0 0 1 ${cs(o.x)},${cs(o.y)} L${cs(c.x)},${cs(c.y)} A${Qa},${Qa} 0 0 0 ${cs(i.x)},${cs(i.y)} Z`}const Fh=qa-16;function Xhe(e,t){const r=360/t,n=-90+e*r,s=Cl(n-r/2,qa),o=Cl(n+r/2,qa),i=Cl(n-r/2,Fh),c=Cl(n+r/2,Fh);return`M${cs(s.x)},${cs(s.y)} A${qa},${qa} 0 0 1 ${cs(o.x)},${cs(o.y)} L${cs(c.x)},${cs(c.y)} A${Fh},${Fh} 0 0 0 ${cs(i.x)},${cs(i.y)} Z`}const Yhe={purple:"#7b2ff2",cyan:"#00e5ff",orange:"#ff9100",red:"#ff1744",yellow:"#ffd600",green:"#00e676",blue:"#2979ff",magenta:"#e040fb"};function FO(e){const t=e.length;return Array.from({length:t},(r,n)=>{const s=e[n],o=s!=null&&s.group?Yhe[s.group]??null:null;return{wedge:Ghe(n,t),fill:"#0d1b2a",strip:o?Xhe(n,t):null,stripColor:o}})}const LR=new Map([[40,TO]]);function Zhe(e){if(e.length===40)return TO;const t=LR.get(e.length);if(t)return t;const r=FO(e);return LR.set(e.length,r),r}function Khe(e){const t=360/e,r=Qa+14;return{positions:Array.from({length:e},(n,s)=>{const o=-90+s*t,i=o*Math.PI/180;return{cx:sn+ip*Math.cos(i),cy:sn+ip*Math.sin(i),baseRot:o+90}}),badgePositions:Array.from({length:e},(n,s)=>{const o=-90+s*t-t*.4,i=o*Math.PI/180;return{x:sn+r*Math.cos(i),y:sn+r*Math.sin(i),rot:o+90}}),turretPositions:Array.from({length:e},(n,s)=>{const o=-90+s*t+3,i=o*Math.PI/180;return{x:sn+r*Math.cos(i),y:sn+r*Math.sin(i),rot:-90+s*t+90}}),tickMarks:Array.from({length:e},(n,s)=>{const o=-90+s*t-t/2,i=o*Math.PI/180;return{x1:sn+Qa*Math.cos(i),y1:sn+Qa*Math.sin(i),x2:sn+(Qa-12)*Math.cos(i),y2:sn+(Qa-12)*Math.sin(i)}})}}const DR=new Map([[40,{positions:Fhe,badgePositions:Uhe,turretPositions:qhe,tickMarks:Whe}]]);function Qhe(e){const t=DR.get(e);if(t)return t;const r=Khe(e);return DR.set(e,r),r}const Jhe=({tiles:e,onTileClick:t,children:r,rotationDeg:n=0,mini:s=!1,properties:o=[],players:i=[],liftedTile:c,laserBeamTile:u,laserBeamSeq:p=0,blastDamage:d=50,suppressDarkOverlay:f=!1,ringRef:m,currentPlayerTile:h,currentPlayerColor:b="#bfefff"})=>{const g=e.length,y=0,[x,v]=l.useState(!1);l.useEffect(()=>{if(u==null){v(!1);return}v(!1);const C=setTimeout(()=>v(!0),y+16);return()=>{clearTimeout(C),v(!1)}},[u,p]);const A=g===20,_=A?40:g,w=Qhe(_),j=l.useMemo(()=>A?FO([...e,...e]):Zhe(e),[g]),T=A?[...Uw,...Uw]:Bhe(g),R=_===40?A1:jO(_),P=h==null?null:qd(h,n,g,_),k=l.useMemo(()=>{const C={"crimson-dominion":"C","silver-pact":"S","azure-sovereignty":"A","golden-imperium":"G","emerald-collective":"E","void-enclave":"V"},I=new Map;if(typeof window<"u"&&new URLSearchParams(window.location.search).get("debugTurrets")==="1"){const N=["crimson-dominion","silver-pact","azure-sovereignty","golden-imperium","emerald-collective","void-enclave"],S={"crimson-dominion":"#ff4444","silver-pact":"#cfd5e4","azure-sovereignty":"#5aa9ff","golden-imperium":"#ffc744","emerald-collective":"#5af0a0","void-enclave":"#c084ff"};for(let F=0;F<e.length;F++){const D=N[F%N.length];I.set(F,{color:S[D],letter:C[D],upgradeLevel:5,piece:D})}return I}for(const N of o){if(N.dormant)continue;const S=i.find(F=>F.id===N.ownerId);S&&I.set(N.tileId,{color:__(S.pieceColor)?S.pieceColor:"#ff4444",letter:C[S.piece]??"?",upgradeLevel:N.upgradeLevel,piece:S.piece})}return I},[o,i,e]);l.useMemo(()=>{const C=new Set;for(const I of i)C.add(I.tileIndex);return C},[i]);const E=l.useMemo(()=>u==null?null:qd(u,n,g,_),[u,n,g,_]),M=l.useMemo(()=>{if(!x||u==null||s||E==null)return null;const C=R[E];if(!C)return null;const I=o.find(D=>D.tileId===u),L=I==null?void 0:I.ownerId,N=L?i.find(D=>D.id===L):null,S=N!=null&&N.pieceColor&&__(N.pieceColor)?N.pieceColor:"#ff4444",F=Math.min(3,Math.max(.35,d/100));return{cx:C.x,cy:C.y,color:S,scale:F}},[x,u,E,R,o,i,s,d]);return l.useMemo(()=>{if(!x||u==null||s||E==null)return null;const C=R[E];if(!C)return null;const I=o.find(D=>D.tileId===u),L=I==null?void 0:I.ownerId;if(!L)return null;const N=i.find(D=>D.id===L),S=N!=null&&N.pieceColor&&__(N.pieceColor)?N.pieceColor:"#ff4444",F=[];for(const D of o){if(D.ownerId!==L||D.upgradeLevel<=0)continue;const H=qd(D.tileId,n,g,_),W=w.turretPositions[H];W&&F.push({x1:W.x,y1:W.y,x2:C.x,y2:C.y,delay:F.length*.07,color:S})}return F.length>0?F:null},[x,u,E,o,i,s,w,R,n,g,_]),a.jsxs("svg",{viewBox:`${Zp} ${Zp} ${Bh} ${Bh}`,className:"zentara-svg",children:[a.jsx("rect",{x:Zp,y:Zp,width:Bh,height:Bh,fill:"transparent"}),a.jsxs("g",{ref:m,style:{transformOrigin:`${sn}px ${sn}px`,transform:`rotate(${n}deg)`},className:s?"zentara-ring-group--mini":"zentara-ring-group",children:[!s&&a.jsxs("defs",{children:[a.jsxs("radialGradient",{id:"zentara-orbit-outer-grad",cx:"50%",cy:"50%",r:"50%",children:[a.jsx("stop",{offset:"92%",stopColor:"#3a80b0",stopOpacity:"0"}),a.jsx("stop",{offset:"98%",stopColor:"#5ab0e0",stopOpacity:"0.9"}),a.jsx("stop",{offset:"100%",stopColor:"#3a80b0",stopOpacity:"0.3"})]}),a.jsxs("radialGradient",{id:"zentara-orbit-inner-grad",cx:"50%",cy:"50%",r:"50%",children:[a.jsx("stop",{offset:"93%",stopColor:"#1e4a6e",stopOpacity:"0.15"}),a.jsx("stop",{offset:"100%",stopColor:"#3a80b0",stopOpacity:"0.55"})]}),a.jsxs("linearGradient",{id:"zentara-tile-deck",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",stopColor:"#d8e2e8"}),a.jsx("stop",{offset:"42%",stopColor:"#aebbc4"}),a.jsx("stop",{offset:"100%",stopColor:"#667582"})]}),a.jsxs("linearGradient",{id:"zentara-command-deck",x1:"0%",y1:"0%",x2:"0%",y2:"100%",children:[a.jsx("stop",{offset:"0%",stopColor:"#f4f8fa"}),a.jsx("stop",{offset:"48%",stopColor:"#d5dfe4"}),a.jsx("stop",{offset:"100%",stopColor:"#8d9ba5"})]}),a.jsxs("linearGradient",{id:"zentara-tile-sheen",x1:"0%",y1:"0%",x2:"100%",y2:"100%",children:[a.jsx("stop",{offset:"0%",stopColor:"#ffffff",stopOpacity:"0.34"}),a.jsx("stop",{offset:"38%",stopColor:"#ffffff",stopOpacity:"0.04"}),a.jsx("stop",{offset:"72%",stopColor:"#07111c",stopOpacity:"0.12"}),a.jsx("stop",{offset:"100%",stopColor:"#02070d",stopOpacity:"0.34"})]})]}),!s&&a.jsx("circle",{cx:sn,cy:sn,r:qa+4,fill:"none",stroke:"#5ab0e0",strokeWidth:6,opacity:.18}),a.jsx("circle",{cx:sn,cy:sn,r:qa,fill:"none",stroke:"#3a80b0",strokeWidth:2.5,opacity:.55,className:s||NR?void 0:"zentara-orbit-ring"}),!s&&!NR&&a.jsx("circle",{cx:sn,cy:sn,r:qa-8,fill:"none",stroke:"#8eeaff",strokeWidth:3,strokeLinecap:"round",strokeDasharray:"38 180",opacity:.55,className:"zentara-orbit-scan"}),a.jsx("circle",{cx:sn,cy:sn,r:Qa,fill:"none",stroke:"#1e4a6e",strokeWidth:1.5,opacity:.45}),!s&&a.jsx("circle",{cx:sn,cy:sn,r:Qa-3,fill:"none",stroke:"#1e4a6e",strokeWidth:.6,opacity:.25}),!s&&w.tickMarks.map((C,I)=>a.jsx("line",{x1:C.x1,y1:C.y1,x2:C.x2,y2:C.y2,stroke:"#1e4a6e",strokeWidth:1,opacity:.25},`tick-${I}`)),a.jsx("defs",{children:j.map((C,I)=>a.jsx("clipPath",{id:`tile-clip-${I}`,clipPathUnits:"userSpaceOnUse",children:a.jsx("path",{d:C.wedge})},`clip-${I}`))}),j.map((C,I)=>{const L=e[I%g],N=w.positions[I],S=(L==null?void 0:L.type)==="start",F=I>=g;return a.jsxs("g",{"data-visual-tile":I,onClick:!s&&!F&&t?()=>t(L.id):void 0,className:`${!s&&!F&&t?"zentara-tile-group":""}${c===I?" zentara-tile-lifted":""}`,style:c===I?{transformOrigin:`${N.cx}px ${N.cy}px`}:void 0,children:[a.jsx("path",{d:C.wedge,fill:S?"url(#zentara-command-deck)":"url(#zentara-tile-deck)"}),!s&&L&&N&&a.jsxs(a.Fragment,{children:[a.jsx("path",{d:C.wedge,fill:T[I%T.length]??"#34506a",opacity:S?.08:.16}),a.jsx("path",{d:C.wedge,fill:"url(#zentara-tile-sheen)"})]}),C.strip&&a.jsx("path",{d:C.strip,fill:C.stripColor??"#607d8b",opacity:.96}),C.strip&&!s&&a.jsx("path",{d:C.strip,fill:"none",stroke:"#ffffff",strokeWidth:1,strokeOpacity:.42}),a.jsx("path",{d:C.wedge,fill:"none",stroke:"#020812",strokeWidth:3.2,strokeOpacity:.82}),a.jsx("path",{d:C.wedge,fill:"none",stroke:"#a8d9ef",strokeWidth:.9,strokeOpacity:.48}),!s&&P===I&&a.jsxs(a.Fragment,{children:[a.jsx("path",{d:C.wedge,fill:b,opacity:.2,className:"zentara-current-tile-light"}),a.jsx("path",{d:C.wedge,fill:"none",stroke:b,strokeWidth:5,strokeOpacity:1,className:"zentara-current-tile-edge"}),a.jsx("path",{d:C.wedge,fill:"none",stroke:"#ffffff",strokeWidth:1.2,strokeOpacity:.7,className:"zentara-current-tile-edge"})]}),!s&&a.jsxs(a.Fragment,{children:[a.jsx("path",{d:C.wedge,fill:"#f7fcff",opacity:.72,className:"zentara-moving-tile-wedge"}),a.jsx("path",{d:C.wedge,fill:"none",stroke:b,strokeWidth:5,strokeOpacity:1,className:"zentara-moving-tile-edge"})]})]},I)}),!s&&e.length>0&&w.positions.map((C,I)=>{var oe;const L=e[I%g];if(!L)return null;const{angleDeg:N,flipped:S}=v_(C.baseRot,n),F=S?-28:28,D=L.name,H=15;let W;if(D.length>10&&D.includes(" ")){const ce=Math.floor(D.length/2),re=[...D.matchAll(/ /g)].map(pe=>pe.index).reduce((pe,ee)=>Math.abs(ee-ce)<Math.abs(pe-ce)?ee:pe);W=[D.slice(0,re),D.slice(re+1)]}else W=[D];const G=I%g,$=k.get(G);let K=null;if($&&L.rent&&L.rent.length>0){const ce=Math.max(0,Math.min(L.rent.length-1,$.upgradeLevel));K=`⚡ ${L.rent[ce]}`}else typeof L.cost=="number"&&L.cost>0&&(K=`◈ ${L.cost}`);const de=W.length*H+14,ie=Math.max(...W.map(ce=>ce.length*8.2+32)),we=C.cy+F,he=(oe=j[I])==null?void 0:oe.stripColor,Ae=he??"rgba(100,170,255,0.45)",Fe=he?1.8:1,U=he?`${he}55`:"rgba(80,150,255,0.18)",V=L.type==="start",z=V?"rgba(32,55,72,0.78)":Ae,O=V?1.4:Fe,q=V?"rgba(178,225,242,0.28)":U,X=V?"rgba(226,235,239,0.9)":"rgba(6,12,32,0.92)",Z=V?"rgba(255,255,255,0.82)":"rgba(160,210,255,0.3)",Q=V?"#071525":"#dce8ff";return a.jsxs("g",{pointerEvents:"none",style:{transform:`rotate(${N}deg)`,transformOrigin:`${C.cx}px ${C.cy}px`},opacity:I>=g?.7:1,children:[(()=>{const _e=F>=0?-1:1,re=we+_e*(de/2+18+3),pe=`tile-icon-clip-${I}`,ee=C.cy+_e*52;return a.jsxs(a.Fragment,{children:[a.jsx("defs",{children:a.jsx("clipPath",{id:pe,clipPathUnits:"userSpaceOnUse",children:a.jsx("circle",{cx:C.cx,cy:re,r:18})})}),a.jsx("image",{href:Ohe[L.type],x:C.cx-18,y:re-18,width:18*2,height:18*2,preserveAspectRatio:"xMidYMid slice",clipPath:`url(#${pe})`,opacity:.95}),K&&(()=>{const xe=K.length*6.4+12,Le=14,Ge=he??"rgba(140,200,255,0.6)";return a.jsxs(a.Fragment,{children:[a.jsx("rect",{x:C.cx-xe/2,y:ee-Le/2,width:xe,height:Le,rx:4,ry:4,fill:"rgba(6,12,32,0.88)",stroke:Ge,strokeWidth:1}),a.jsx("text",{x:C.cx,y:ee+.5,textAnchor:"middle",dominantBaseline:"central",fontSize:10.5,fontWeight:700,fontFamily:"Orbitron, monospace",fill:"#ffffff",letterSpacing:"0.6px",children:K})]})})()]})})(),a.jsx("rect",{x:C.cx-ie/2-1,y:we-de/2-1,width:ie+2,height:de+2,rx:7,ry:7,fill:"none",stroke:q,strokeWidth:2}),a.jsx("rect",{x:C.cx-ie/2,y:we-de/2,width:ie,height:de,rx:6,ry:6,fill:X,stroke:z,strokeWidth:O}),a.jsx("line",{x1:C.cx-ie/2+9,y1:we-de/2+1,x2:C.cx+ie/2-9,y2:we-de/2+1,stroke:Z,strokeWidth:.9,strokeLinecap:"round"}),a.jsx("text",{x:C.cx,y:we-(W.length-1)*H/2,textAnchor:"middle",dominantBaseline:"central",fontSize:13,fontWeight:900,fontFamily:"Orbitron, monospace",fill:Q,letterSpacing:"1px",style:V?{textTransform:"uppercase"}:void 0,className:V?void 0:"zentara-tile-symbol",children:W.map((ce,_e)=>a.jsx("tspan",{x:C.cx,dy:_e===0?0:H,children:ce},_e))})]},`cap-${I}`)}),!s&&Array.from(k.entries()).flatMap(([C,{color:I,letter:L}])=>(A?[C,C+g]:[C]).map(S=>{const F=w.badgePositions[S];if(!F)return null;const{angleDeg:D}=v_(F.rot,n);return a.jsxs("g",{style:{transform:`translate(${F.x}px, ${F.y}px) rotate(${D}deg)`},className:"zentara-badge",pointerEvents:"none",children:[a.jsx("rect",{x:-14,y:-14,width:28,height:28,rx:3,fill:I,opacity:.25,className:"zentara-badge-glow"}),a.jsx("rect",{x:-11,y:-11,width:22,height:22,rx:2,fill:I,stroke:"rgba(255,255,255,0.6)",strokeWidth:1.2}),a.jsx("text",{x:0,y:.8,textAnchor:"middle",dominantBaseline:"central",fill:"#000",fontSize:10,fontFamily:"Orbitron, monospace",fontWeight:"bold",children:L})]},`badge-${S}`)})),!s&&a.jsx("defs",{children:Array.from(new Set(Array.from(k.values()).filter(C=>C.upgradeLevel>0).map(C=>`${C.color}|${Math.max(1,Math.min(5,C.upgradeLevel))}`))).map(C=>{const[I,L]=C.split("|"),N=Number(L),S=Hhe[N-1]??1,F=parseInt(I.slice(1,3),16)/255,D=parseInt(I.slice(3,5),16)/255,H=parseInt(I.slice(5,7),16)/255;return a.jsxs("filter",{id:`turret-glow-${I.replace("#","")}-${N}`,x:"-100%",y:"-100%",width:"300%",height:"300%",children:[a.jsx("feColorMatrix",{type:"matrix",values:`${F} 0 0 0 0  0 ${D} 0 0 0  0 0 ${H} 0 0  0 0 0 1 0`,result:"tinted"}),a.jsx("feDropShadow",{in:"tinted",dx:"0",dy:"0",stdDeviation:3*S,floodColor:I,floodOpacity:Math.min(1,.9*S)}),a.jsx("feDropShadow",{dx:"0",dy:"0",stdDeviation:7*S,floodColor:I,floodOpacity:Math.min(.8,.45*S)})]},`turret-glow-${I}-${N}`)})}),!s&&Array.from(k.entries()).flatMap(([C,{upgradeLevel:I,piece:L,color:N}])=>{var D;if(I<=0)return[];const S=A?[C,C+g]:[C],F=x&&u!=null&&((D=k.get(u))==null?void 0:D.color)===N;return S.map(H=>{const W=w.turretPositions[H];if(!W)return null;const G=Dhe(L,I);if(!G)return null;const $=R[H],K=Mhe[L]??0;let de;$?de=Math.atan2($.y-W.y,$.x-W.x)*180/Math.PI+180+K:de=v_(W.rot,n).angleDeg+K;const ie=Vhe[Math.max(0,Math.min(4,I-1))],we=Math.max(1,Math.min(5,I)),he=`turret-glow-${N.replace("#","")}-${we}`,Ae=-ie/2,Fe=-ie/2,U=Ae+ie*.08,V=Fe+ie*.5;return a.jsx("g",{style:{transform:`translate(${W.x}px, ${W.y}px) scale(1.69)`},pointerEvents:"none",className:"zentara-turret-glow",children:a.jsx("g",{className:"zentara-turret-rotor",style:{transform:`rotate(${de}deg)`},children:a.jsxs("g",{style:Lhe[L]?{transform:"scale(-1, 1)"}:void 0,children:[a.jsx("g",{className:F?"zentara-turret-recoil":void 0,children:a.jsx("image",{href:G,x:Ae,y:Fe,width:ie,height:ie,preserveAspectRatio:"xMidYMid meet",filter:`url(#${he})`})}),F&&a.jsxs("g",{className:"zentara-muzzle-flash",pointerEvents:"none",children:[a.jsx("ellipse",{cx:U,cy:V,rx:ie*.2,ry:ie*.11,fill:N,opacity:.85}),a.jsx("ellipse",{cx:U,cy:V,rx:ie*.1,ry:ie*.055,fill:"#fff8e0"})]})]})})},`turret-${H}`)})}),r,!1,M&&(()=>{const C=140*M.scale;return a.jsx("image",{href:E1,x:M.cx-C/2,y:M.cy-C/2,width:C,height:C,className:"zentara-blast-explosion",pointerEvents:"none"})})()]}),s&&a.jsx("path",{d:`M${sn},${sn} L${sn},${Zp} A${qa+wd},${qa+wd} 0 0 1 ${sn+(qa+wd)*Math.sin(Math.PI)},${sn-(qa+wd)*Math.cos(Math.PI)} Z`,fill:"rgba(123, 47, 242, 0.08)",stroke:"rgba(123, 47, 242, 0.3)",strokeWidth:3})]})};function $he(e,t){return e.tiles===t.tiles&&e.rotationDeg===t.rotationDeg&&e.properties===t.properties&&e.players===t.players&&e.laserBeamTile===t.laserBeamTile&&e.blastDamage===t.blastDamage&&e.liftedTile===t.liftedTile&&e.currentPlayerTile===t.currentPlayerTile&&e.currentPlayerColor===t.currentPlayerColor&&e.suppressDarkOverlay===t.suppressDarkOverlay&&e.mini===t.mini&&e.ringRef===t.ringRef}const ege=ot.memo(Jhe,$he);function Uh(e,t){return 180-e*(360/t)}function w_(e,t,r,n){const s=360*r/n;let o=t-e;return o=(o%s+s*1.5)%s-s/2,e+o}function tge(e,t,r,n,s){const i=-((r-t+n)%n)*(360/s);return e+i}function rge(e){return e.roundNumber===1&&e.currentPlayerIndex===0&&e.currentTurn.phase==="pre-roll"&&e.currentTurn.diceValues===null&&e.players.every(t=>t.tileIndex===0)}const nge=1.5,age=2.25,OR=[nge,age],sge=zr.isNativePlatform(),oge=({gameState:e,onTileClick:t,zoomOverride:r,onPieceArrival:n,onPieceMoveStart:s,onZoomChange:o,focusTileIndex:i,toggleZoomRef:c,laserBeamTile:u,laserBeamSeq:p,blastDamage:d,suppressDarkOverlay:f=!0,children:m})=>{var O,q,X;const h=((O=e.players[e.currentPlayerIndex])==null?void 0:O.id)??"",b=((q=e.players[e.currentPlayerIndex])==null?void 0:q.tileIndex)??0,g=((X=e.players[e.currentPlayerIndex])==null?void 0:X.pieceColor)??"#bfefff",y=e.board.length,x=rge(e),v=y===20?40:y,[A,_]=l.useState(()=>Uh(b,v)),w=l.useRef([]),j=l.useRef(null),T=l.useRef(null),[R,P]=l.useState(0),k=OR[R],E=r??k,M=l.useCallback(()=>P(Z=>(Z+1)%OR.length),[]);l.useEffect(()=>(c&&(c.current=M),()=>{c&&(c.current=null)}),[M,c]),l.useEffect(()=>{o==null||o(E)},[E,o]);const C=l.useCallback(Z=>{Z.propertyName==="scale"&&requestAnimationFrame(()=>_(Q=>Q+.001))},[]),I=l.useRef(e.currentPlayerIndex);l.useEffect(()=>{if(!e.finished&&e.currentPlayerIndex!==I.current){I.current=e.currentPlayerIndex;const Z=setTimeout(()=>_(Q=>w_(Q,Uh(b,v),y,v)),1200);return()=>clearTimeout(Z)}},[e.currentPlayerIndex,b,e.finished,y,v]);const[L,N]=l.useState(null),S=l.useRef(void 0),F=l.useRef(null),D=l.useRef(null),H=l.useCallback(()=>{var Z;T.current!=null&&(cancelAnimationFrame(T.current),T.current=null);for(const Q of w.current)clearTimeout(Q);w.current=[],(Z=j.current)==null||Z.classList.remove("zentara-tile--moving-lit"),j.current=null},[]);l.useEffect(()=>H,[H]);const W=l.useCallback((Z,Q)=>{var ee;H();const oe=qd(Z,Fe.current,y,v),ce=Fe.current,_e=tge(ce,Z,Q,y,v),re=(Q-Z+y)%y,pe=xe=>{var _t;const Le=D.current;if(!Le)return;(_t=j.current)==null||_t.classList.remove("zentara-tile--moving-lit");const Ge=Le.querySelector(`[data-visual-tile="${xe}"]`);Ge==null||Ge.classList.add("zentara-tile--moving-lit"),j.current=Ge};if((ee=F.current)==null||ee.classList.add("zentara-board-container--piece-moving"),T.current=requestAnimationFrame(()=>{T.current=null,_(_e)}),!sge){pe(oe);for(let xe=1;xe<=re;xe+=1){const Le=(xe-.5)/Math.max(re,1),Ge=Ri.BOARD_ROTATE_MS*Le,_t=(oe+xe)%v;w.current.push(setTimeout(()=>pe(_t),Ge))}}},[y,H,v]);l.useEffect(()=>{i!=null&&_(Z=>w_(Z,Uh(i,v),y,v))},[i,y,v]);const G=l.useCallback(Z=>{var Q;H(),_(oe=>w_(oe,Uh(Z,v),y,v)),clearTimeout(S.current),N(null),(Q=F.current)==null||Q.classList.remove("zentara-board-container--piece-moving"),n==null||n()},[n,y,H,v]),$=l.useRef({active:!1,startAngle:0,startRot:0}),K=l.useRef(null),de=l.useRef(null),ie=l.useRef([]),we=l.useRef(null),he=l.useCallback(()=>{we.current!=null&&(cancelAnimationFrame(we.current),we.current=null)},[]),Ae=l.useCallback((Z,Q)=>{const oe=F.current;if(!oe)return 0;const ce=oe.getBoundingClientRect(),_e=ce.left+ce.width/2,re=ce.top+ce.height/2;return Math.atan2(Q-re,Z-_e)*(180/Math.PI)},[]),Fe=l.useRef(A);Fe.current=A;const U=l.useCallback(Z=>{var ce,_e,re,pe,ee,xe;if(Z.button!==0)return;(_e=(ce=Z.target).setPointerCapture)==null||_e.call(ce,Z.pointerId),he();const Q=parseFloat(((ee=(pe=(re=D.current)==null?void 0:re.style.transform)==null?void 0:pe.match(/rotate\(([^)]+)deg\)/))==null?void 0:ee[1])??"NaN"),oe=Number.isFinite(Q)?Q:Fe.current;$.current={active:!0,startAngle:Ae(Z.clientX,Z.clientY),startRot:oe},ie.current=[{rot:oe,t:performance.now()}],(xe=F.current)==null||xe.classList.add("zentara-board-container--dragging")},[Ae,he]),V=l.useCallback(Z=>{if(!$.current.active)return;const oe=Ae(Z.clientX,Z.clientY)-$.current.startAngle,ce=$.current.startRot+oe;K.current=ce;const _e=D.current;_e&&(_e.style.transform=`rotate(${ce}deg)`);const re=ie.current,pe=performance.now();for(re.push({rot:ce,t:pe});re.length>2&&pe-re[0].t>80;)re.shift();de.current==null&&(de.current=requestAnimationFrame(()=>{de.current=null,K.current!=null&&$.current.active&&_(K.current)}))},[Ae]),z=l.useCallback(()=>{var Q;if(!$.current.active)return;$.current.active=!1,(Q=F.current)==null||Q.classList.remove("zentara-board-container--dragging"),de.current!=null&&(cancelAnimationFrame(de.current),de.current=null),K.current!=null&&(_(K.current),K.current=null);const Z=ie.current;if(Z.length>=2){const oe=Z[Z.length-1],ce=Z[0],_e=oe.t-ce.t;let re=_e>0?(oe.rot-ce.rot)/_e:0;if(Math.abs(re)>.08){re>1.6&&(re=1.6),re<-1.6&&(re=-1.6);const ee=.01;let xe=oe.rot,Le=performance.now();const Ge=()=>{const _t=performance.now(),Xe=_t-Le;Le=_t,xe+=re*Xe,re*=Math.exp(-.0042*Xe);const bt=D.current;bt&&(bt.style.transform=`rotate(${xe}deg)`),_(xe),Math.abs(re)>ee?we.current=requestAnimationFrame(Ge):we.current=null};we.current=requestAnimationFrame(Ge)}}ie.current=[]},[]);return l.useEffect(()=>{const Z=F.current;if(!Z)return;const Q=oe=>{oe.preventDefault()};return Z.addEventListener("wheel",Q,{passive:!1}),()=>Z.removeEventListener("wheel",Q)},[]),a.jsx("div",{ref:F,onPointerDown:U,onPointerMove:V,onPointerUp:z,onPointerCancel:z,className:"zentara-board-container",children:a.jsxs("div",{className:"zentara-board-inner",style:{scale:String(E)},onTransitionEnd:C,children:[a.jsx(ege,{tiles:e.board,onTileClick:t,rotationDeg:A,properties:e.properties,players:e.players,liftedTile:L,laserBeamTile:u,laserBeamSeq:p,blastDamage:d,ringRef:D,currentPlayerTile:b,currentPlayerColor:g,children:a.jsx(The,{players:e.players,currentPlayerId:h,onMoveStart:W,onFlightStart:s,onArrival:G,zoom:E,boardRotation:A,tileCount:v,gameTileCount:y,jailTileIndex:e.board.findIndex(Z=>Z.type==="jail"),onlyCurrentPlayer:x})}),m]})})},ige=ot.memo(oge),lge=2e3,cge=5e3,zR=.08,Ec="/models/dice.glb",BR=new URL(""+new URL("dice-GytAQsgt.glb",import.meta.url).href,import.meta.url).href;function qh(e){if(/^(?:[a-z]+:)?\/\//i.test(e)||e.startsWith("data:")||e.startsWith("blob:"))return e;const[t,r=""]=e.split("?");if(t.replace(/^\.?\//,"/")===Ec)return r?`${BR}?${r}`:BR;const s="./";return`${s.endsWith("/")?s:`${s}/`}${e.replace(/^\.?\//,"")}`}function FR({result:e,position:t,rollTrigger:r,noAnimation:n=!1,active:s=!0,chargeLevel:o=0,modelOverride:i}){const[c,u]=l.useState(qh(i||Ec)),p=l.useMemo(()=>{try{const H=(i||c).split("?")[1];if(!H)return null;const G=new URLSearchParams(H).get("tint");return G&&/^#[0-9a-f]{3,8}$/i.test(G)?G:null}catch{return null}},[i,c]);l.useEffect(()=>{var D,H;try{(H=(D=zl).preload)==null||H.call(D,qh(Ec))}catch{}},[]),l.useEffect(()=>{if(i){u(qh(i));return}let D=!1;return(async()=>{try{const H=await ma();let W=Ec;(H==null?void 0:H.diceColorTheme)==="dice_red_white"?W=`${Ec}?tint=%23c81e1e`:(H==null?void 0:H.diceColorTheme)==="dice_green_gold"?W=`${Ec}?tint=%2316a34a`:(H==null?void 0:H.diceColorTheme)==="dice_blue_silver"&&(W=`${Ec}?tint=%232563eb`),D||u(qh(W))}catch{}})(),()=>{D=!0}},[i]);const d=l.useMemo(()=>c.split("?")[0],[c]),f=zl(d),m=l.useMemo(()=>{const D=f.scene.clone(!0),H=p?new Xn(p):null;return D.traverse(W=>{var G;if(W!=null&&W.isMesh&&W.material){const $=Array.isArray(W.material)?W.material:[W.material];for(const K of $){for(const de of["map","normalMap","roughnessMap","metalnessMap","emissiveMap","aoMap","bumpMap","displacementMap","alphaMap","envMap"]){const ie=K==null?void 0:K[de];if(ie&&typeof ie=="object"&&"needsUpdate"in ie)try{ie.needsUpdate=!0}catch{}}if(K&&typeof K.name=="string"&&K.name.startsWith("pips_")){try{(G=K.color)==null||G.set("#0a0a0a")}catch{}try{K.metalness=.15}catch{}try{K.roughness=.7}catch{}if("envMapIntensity"in K)try{K.envMapIntensity=.6}catch{}continue}if(H&&K&&K.color)try{K.color.copy(H)}catch{}if(K&&"envMapIntensity"in K)try{K.envMapIntensity=Math.max(1,Number(K.envMapIntensity||.9))}catch{}if(K&&"metalness"in K)try{K.metalness=Math.min(.9,Math.max(.2,Number(K.metalness||.5)))}catch{}if(K&&"roughness"in K)try{K.roughness=Math.min(.9,Math.max(.2,Number(K.roughness||.55)))}catch{}}}}),D},[f.scene,p]),h=l.useRef(null),b=l.useRef(null),g=l.useRef(null),y=l.useRef(!1),x=l.useRef(!1),v=l.useRef(null),A=l.useRef(!1),_=l.useRef(0),w=l.useRef({x:0,y:0,z:0}),j=l.useRef({x:0,y:0,z:0}),T=l.useRef(new ej),R=l.useRef(new Q_),P=l.useRef(null),k=l.useRef(0);k.current=o;const E=l.useCallback(D=>{var he,Ae;if(!t)return;const H=h.current;if(!H)return;(he=H.wakeUp)==null||he.call(H),H.setLinvel({x:0,y:0,z:0},!0),H.setAngvel({x:0,y:0,z:0},!0),H.setRotation({x:0,y:0,z:0,w:1},!0);const W=.3+D*.7,G=w.current,$=j.current,K=-t[0],de=-t[2],ie=Math.sqrt(K*K+de*de)||1,we=25*W;G.x=K/ie*we+(Math.random()-.5)*8*W,G.y=8+10*W,G.z=de/ie*we+(Math.random()-.5)*8*W,$.x=(Math.random()-.5)*120*W,$.y=(Math.random()-.5)*120*W,$.z=(Math.random()-.5)*120*W,H.setTranslation({x:t[0],y:2.6,z:t[2]},!0),H.setLinvel(G,!0),H.setAngvel($,!0),(Ae=H.wakeUp)==null||Ae.call(H)},[t]);l.useCallback(()=>{E(.6)},[E]),l.useEffect(()=>{var H,W;const D=h.current;if(D)if(s)(W=D.wakeUp)==null||W.call(D);else{y.current=!1;try{D.setLinvel({x:0,y:0,z:0},!0),D.setAngvel({x:0,y:0,z:0},!0),(H=D.sleep)==null||H.call(D)}catch{}if(x.current){x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null);try{oo()}catch{}}}},[s]),l.useEffect(()=>()=>{try{v.current&&(window.clearTimeout(v.current),v.current=null),oo()}catch{}},[]);const M=l.useRef(E);M.current=E,l.useEffect(()=>{var H;if(n||!t||!s||typeof r!="number"||r<=0)return;g.current&&(window.clearTimeout(g.current),g.current=null),b.current=Date.now(),y.current=!0,_.current=0,P.current=null;const D=h.current;if(D)try{(H=D.wakeUp)==null||H.call(D),D.setLinvel({x:0,y:0,z:0},!0),D.setAngvel({x:0,y:0,z:0},!0)}catch{}if(A.current=!0,!x.current){x.current=!0;try{L8({volume:.075,playbackRate:1})}catch{}v.current&&window.clearTimeout(v.current),v.current=window.setTimeout(()=>{if(x.current){x.current=!1;try{oo()}catch{}}v.current&&(window.clearTimeout(v.current),v.current=null)},5e3)}},[r,s,n,t]),l.useEffect(()=>{if(!(r>0)&&(y.current&&(y.current=!1),x.current)){x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null);try{oo()}catch{}}},[r]),l.useEffect(()=>{var W;if(n||!t||!s)return;if(!b.current||!y.current){const G=h.current;if(!G)return;try{G.setLinvel({x:0,y:0,z:0},!0),G.setAngvel({x:0,y:0,z:0},!0)}catch{}if(e){const $=Nh[e];if($){const K=T.current,de=R.current;K.set($[0],$[1],$[2]),de.setFromEuler(K);try{G.setRotation(de,!0)}catch{}try{G.setTranslation({x:t[0],y:2,z:t[2]},!0)}catch{}}}try{(W=G.sleep)==null||W.call(G)}catch{}return}if(!e)return;const D=Date.now()-(b.current??Date.now()),H=Math.max(0,lge-D);return g.current&&(window.clearTimeout(g.current),g.current=null),g.current=window.setTimeout(()=>{var de;if(y.current=!1,x.current){x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null);try{oo()}catch{}}const G=h.current;if(!G)return;try{const ie=G.translation(),we=4.2,he=ie.x,Ae=ie.z,Fe=Math.sqrt(he*he+Ae*Ae);if(Fe>we){const U=we/Fe;P.current={x:he*U,z:Ae*U}}else P.current={x:he,z:Ae}}catch{P.current={x:t[0],z:t[2]}}const $=P.current.x,K=P.current.z;try{G.setLinvel({x:0,y:0,z:0},!0),G.setAngvel({x:0,y:0,z:0},!0),G.setTranslation({x:$,y:2,z:K},!0)}catch{}if(e){const ie=Nh[e];if(ie){const we=T.current,he=R.current;we.set(ie[0],ie[1],ie[2]),he.setFromEuler(we);try{G.setRotation(he,!0)}catch{}}}if(b.current=null,x.current){x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null);try{oo()}catch{}}try{(de=G.sleep)==null||de.call(G)}catch{}},H),()=>{g.current&&(window.clearTimeout(g.current),g.current=null)}},[r,e,t,n,s]);const C=l.useRef(0),I=l.useRef(!1),L=l.useRef(!1),N=l.useRef(0),S=10,F=l.useRef(0);return zs((D,H)=>{var ie,we,he,Ae,Fe,U;const W=h.current;if(!W)return;const G=5,$=1,K=4;try{const V=W.translation(),z=V.x,O=V.z,q=Math.sqrt(z*z+O*O);let X=!1,Z=V.x,Q=V.y,oe=V.z;if(q>G){const ce=(G-.3)/q;Z=z*ce,oe=O*ce,X=!0;const _e=W.linvel(),re=(_e.x*z+_e.z*O)/(q*q);re>0&&W.setLinvel({x:_e.x-2*re*z,y:_e.y,z:_e.z-2*re*O},!0)}if(Q<$){Q=.5,X=!0;const ce=W.linvel();W.setLinvel({x:ce.x,y:Math.abs(ce.y)+2,z:ce.z},!0)}if(Q>K){Q=K-.5,X=!0;const ce=W.linvel();W.setLinvel({x:ce.x,y:-Math.abs(ce.y)*.5,z:ce.z},!0)}X&&W.setTranslation({x:Z,y:Q,z:oe},!0)}catch{}const de=k.current;if(de>0&&!y.current&&s){(ie=W.wakeUp)==null||ie.call(W),F.current+=H;const V=F.current,z=.15+de*.6,O=18+de*30,q=Math.sin(V*O)*z,X=Math.cos(V*O*1.3)*z,Z=(t==null?void 0:t[0])??0,Q=(t==null?void 0:t[2])??0;W.setTranslation({x:Z+q,y:2,z:Q+X},!0);const oe=.3+de*1.2;W.setAngvel({x:Math.sin(V*O*.7)*oe,y:0,z:Math.cos(V*O*.9)*oe},!0);return}if(de===0&&F.current>0&&!y.current&&(F.current=0),y.current&&s){if(b.current&&Date.now()-b.current>cge){if(y.current=!1,x.current){x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null);try{oo()}catch{}}try{W.setLinvel({x:0,y:0,z:0},!0),W.setAngvel({x:0,y:0,z:0},!0),W.setTranslation({x:(t==null?void 0:t[0])??0,y:2,z:(t==null?void 0:t[2])??0},!0)}catch{}if(e){const oe=Nh[e];if(oe){const ce=T.current,_e=R.current;ce.set(oe[0],oe[1],oe[2]),_e.setFromEuler(ce);try{W.setRotation(_e,!0)}catch{}}}b.current=null;try{(we=W.sleep)==null||we.call(W)}catch{}return}C.current+=H,_.current++,I.current=!1,L.current=!1,N.current=0;try{(he=W.wakeUp)==null||he.call(W)}catch{}if(A.current){A.current=!1;try{M.current(k.current)}catch{}}const V=_.current<=15,z=W.angvel(),O=Math.sqrt(z.x*z.x+z.y*z.y+z.z*z.z),q=V?40:25;if(O<q){const oe=q-O+15;W.setAngvel({x:z.x+(Math.random()-.5)*oe,y:z.y+(Math.random()-.5)*oe,z:z.z+(Math.random()-.5)*oe},!0)}const X=W.linvel();if(Math.sqrt(X.x*X.x+X.y*X.y+X.z*X.z)<(V?8:4)&&W.setLinvel({x:(Math.random()-.5)*12,y:Math.max(X.y,6),z:(Math.random()-.5)*12},!0),C.current>=.15){const oe={x:(Math.random()-.5)*10,y:4,z:(Math.random()-.5)*10};W.applyImpulse(oe,!0),W.applyTorqueImpulse({x:(Math.random()-.5)*15,y:(Math.random()-.5)*15,z:(Math.random()-.5)*15},!0),C.current=0}return}if(s&&!y.current&&e)try{const V=W.linvel(),z=W.angvel(),O=Math.abs(V.x)+Math.abs(V.y)+Math.abs(V.z),q=Math.abs(z.x)+Math.abs(z.y)+Math.abs(z.z);W.setLinvel({x:0,y:0,z:0},!0),W.setAngvel({x:0,y:0,z:0},!0);const X=Nh[e];if(X){const oe=T.current,ce=R.current;oe.set(X[0],X[1],X[2]),ce.setFromEuler(oe),W.setRotation(ce,!0)}const Z=((Ae=P.current)==null?void 0:Ae.x)??(t==null?void 0:t[0])??0,Q=((Fe=P.current)==null?void 0:Fe.z)??(t==null?void 0:t[2])??0;W.setTranslation({x:Z,y:2,z:Q},!0),I.current=!0,O<zR&&q<zR?(N.current++,N.current>=S&&(L.current=!0)):N.current=0,(U=W.sleep)==null||U.call(W)}catch{}}),l.useEffect(()=>()=>{if(y.current=!1,g.current&&window.clearTimeout(g.current),b.current=null,x.current){x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null);try{oo()}catch{}}},[]),l.useEffect(()=>{const D=()=>{try{x.current&&(x.current=!1,v.current&&(window.clearTimeout(v.current),v.current=null),oo())}catch{}},H=()=>{document.visibilityState==="hidden"&&D()},W=()=>D(),G=()=>D();return document.addEventListener("visibilitychange",H),window.addEventListener("pagehide",W),window.addEventListener("beforeunload",G),()=>{document.removeEventListener("visibilitychange",H),window.removeEventListener("pagehide",W),window.removeEventListener("beforeunload",G)}},[]),a.jsx(Mc,{ref:h,position:t,colliders:"cuboid",mass:1,linearDamping:.3,angularDamping:.3,restitution:.8,friction:.5,ccd:!0,children:a.jsx("primitive",{object:m,scale:31.25,visible:s})})}const Ts=6.5,uge=Ts+.65,UR=[[3,1,0],[-1.5,1,2.6],[-1.5,1,-2.6]],qR=[[-3,1,0],[3,1,0]],Vd=24,My=3,dge=1.2,pge=1,Ly=Ts-pge,fge=2*Ly*Math.sin(Math.PI/Vd),mge=Array.from({length:Vd},(e,t)=>{const r=t*2*Math.PI/Vd;return{position:[Math.cos(r)*Ly,My/2,Math.sin(r)*Ly],rotation:[0,-r+Math.PI/2,0],width:fge,height:My,thickness:dge}}),x_=5,hge=Ts,gge=1,yge=1.4,UO=[];for(let e=0;e<x_;e++){const t=e/x_,r=(e+1)/x_,n=(t+r)/2,s=My+n*(hge-My),o=Math.max(.5,Ly*Math.cos(n*(Math.PI/2))),i=2*o*Math.sin(Math.PI/Vd),c=n*(Math.PI/2);for(let u=0;u<Vd;u++){const p=u*2*Math.PI/Vd;UO.push({position:[Math.cos(p)*o,s,Math.sin(p)*o],rotation:[c,-p+Math.PI/2,0],width:i,height:yge,thickness:gge})}}function VR(){return a.jsxs(a.Fragment,{children:[mge.map((e,t)=>a.jsx(Mc,{type:"fixed",colliders:"cuboid",position:e.position,rotation:e.rotation,restitution:.85,friction:.3,children:a.jsxs("mesh",{visible:!1,children:[a.jsx("boxGeometry",{args:[e.width,e.height,e.thickness]}),a.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})},`bwall-${t}`)),UO.map((e,t)=>a.jsx(Mc,{type:"fixed",colliders:"cuboid",position:e.position,rotation:e.rotation,restitution:.85,friction:.3,children:a.jsxs("mesh",{visible:!1,children:[a.jsx("boxGeometry",{args:[e.width,e.height,e.thickness]}),a.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})},`dome-${t}`))]})}const bge={uTime:{value:0},uShimmerColor:{value:new An(1,1,1)}},vge=`
    varying vec2 vUv;
    void main() {
        vUv = uv;
        gl_Position = projectionMatrix * modelViewMatrix * vec4(position, 1.0);
    }
`,_ge=`
    varying vec2 vUv;
    uniform float uTime;
    uniform vec3 uShimmerColor;

    void main() {
        vec2 uv = vUv - 0.5;          // centre-relative (-0.5 to 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 profile (hemisphere cross-section) ─────
        float thickness = 1.0 - sqrt(max(1.0 - d * d, 0.0));

        // ── 2. Fresnel rim — sharp bright edge (real glass is brightest at glancing angles) ─
        // Tight inner ramp gives a crisp, defined ring rather than a fuzzy glow
        float fresnel = pow(d, 6.0) * 0.75;
        // Directional lighting bias — upper-left is brightest
        float rimAngle = atan(uv.y, uv.x);
        float rimLit = 0.50 + 0.50 * sin(rimAngle + 0.8);
        float rimHighlight = smoothstep(0.82, 0.95, d) * rimLit * 0.90;
        // Hard outer cutoff at glass edge
        float edgeFade = 1.0 - smoothstep(0.96, 1.0, d);
        float rim = (fresnel + rimHighlight) * edgeFade;

        // ── 3. Gold-rim contact ring — thin bright line right at the base ─
        float contactRing = smoothstep(0.92, 0.96, d) * (1.0 - smoothstep(0.96, 0.98, d)) * 0.60;

        // ── 4. Primary specular — crisp window reflection ───────────────
        // Upper-left crescent: tight, bright reflection like a studio softbox
        vec2 specCenter = vec2(-0.10, 0.14);
        vec2 specUV = (uv - specCenter) * vec2(1.0, 1.5);
        float specD = length(specUV);
        // Use pow for a tighter, more concentrated highlight
        float spec = pow(max(1.0 - specD / 0.22, 0.0), 3.0) * 0.55;
        // Strengthen near the rim (curved glass concentrates reflections at edges)
        spec *= 0.3 + 0.7 * smoothstep(0.15, 0.65, d);

        // ── 5. Secondary specular — smaller opposite kick ──────────────
        vec2 spec2Center = vec2(0.14, -0.10);
        float spec2D = length(uv - spec2Center);
        float spec2 = pow(max(1.0 - spec2D / 0.14, 0.0), 3.0) * 0.22;
        spec2 *= smoothstep(0.10, 0.45, d);

        // ── 6. Shadow vignette — keep extremely faint so center stays clear ─
        float shadow = smoothstep(0.72, 1.0, d) * 0.02;
        // Directional: darker opposite the light
        shadow *= 0.6 + 0.4 * (1.0 - rimLit);

        // ── 7. Glass body tint — very faint aqua/green ─────────────────
        float tintStrength = thickness * 0.0012;
        vec3 glassTint = vec3(0.80, 0.96, 0.90);

        // ── 8. Animated caustic shimmer — large rectangular sweep ───────
        // One large orbiting rectangular glint
        float a1 = uTime * 0.50;
        vec2 shimP1 = vec2(cos(a1) * 0.28, sin(a1) * 0.24);
        vec2 shimDelta = uv - shimP1;
        // Rectangular falloff: wide horizontally, narrow vertically
        float shimRx = max(1.0 - abs(shimDelta.x) / 0.12, 0.0);
        float shimRy = max(1.0 - abs(shimDelta.y) / 0.12, 0.0);
        float shim1 = shimRx * shimRy * 0.90;
        shim1 *= smoothstep(0.62, 0.95, d);

        // Top-edge arc shimmer — bright wide band hugging upper rim
        float topBias = smoothstep(-0.10, 0.35, uv.y);
        float rimProx = smoothstep(0.55, 0.93, d);
        float topShim = topBias * rimProx * 1.15;
        topShim *= 0.72 + 0.28 * sin(uTime * 0.90);

        // Moving rim glint: a bright narrow sweep orbiting the ring so shimmer is readable.
        float sweepAngle = atan(uv.y, uv.x);
        float sweepCore = pow(max(0.0, cos(sweepAngle - (uTime * 1.9))), 14.0);
        float sweepBand = smoothstep(0.80, 0.90, d) * (1.0 - smoothstep(0.94, 0.99, d));
        float rimSweep = sweepCore * sweepBand * 2.4;

        // Interior caustic shimmer: subtle moving light inside the glass body.
        vec2 inP1 = vec2(cos(uTime * 0.85) * 0.16, sin(uTime * 0.72) * 0.14);
        vec2 inP2 = vec2(cos(uTime * -0.64 + 1.2) * 0.11, sin(uTime * -0.93 + 0.4) * 0.10);
        float inBlob1 = pow(max(1.0 - length((uv - inP1) * vec2(0.95, 1.25)) / 0.46, 0.0), 2.0);
        float inBlob2 = pow(max(1.0 - length((uv - inP2) * vec2(1.1, 0.95)) / 0.37, 0.0), 2.1);
        float inWave = 0.5 + 0.5 * sin((uv.x * 10.0) + (uv.y * 7.5) + (uTime * 3.1));
        float interiorMask = 1.0 - smoothstep(0.70, 0.98, d);
        float interiorShimmer = ((inBlob1 * 1.05) + (inBlob2 * 0.95) + (inWave * 0.62)) * interiorMask;

        float shimmer = (shim1 * 1.85) + (topShim * 1.55) + rimSweep;

        // ── Composite ─────────────────────────────────────────────────
        // Keep highlights near edges for a true glass-only look.
        float edgeMask = smoothstep(0.58, 0.96, d);
        float shimmerEdge = shimmer * smoothstep(0.50, 0.93, d);
        float baseHighlight = rim + contactRing + (spec * edgeMask) + (spec2 * edgeMask);
        float highlight = baseHighlight + (shimmerEdge * edgeMask);

        // Glass colour: very faint tint with bright highlights (tinted by uShimmerColor)
        vec3 col = mix(glassTint * tintStrength, uShimmerColor, highlight * 0.9);
        col += uShimmerColor * (rimSweep * 0.12);
        col += uShimmerColor * (interiorShimmer * 0.28);

        // Alpha: highlights are opaque-ish, base glass is very transparent
        // Keep the dome body highly transparent; preserve only subtle reflections.
        float alpha = (baseHighlight * 0.16) + ((shimmerEdge * edgeMask) * 0.46) + (shadow * 0.15) + (tintStrength * 0.25);
        // Keep rim sheen, but allow subtle interior shimmer visibility.
        alpha *= smoothstep(0.52, 0.9, d);
        alpha += interiorShimmer * 0.22;
        alpha = clamp(alpha, 0.0, 0.28);

        gl_FragColor = vec4(col, alpha);
    }
`;function HR({shimmerColor:e}){const t=l.useMemo(()=>new p3({uniforms:f3.clone(bge),vertexShader:vge,fragmentShader:_ge,transparent:!0,depthWrite:!1}),[]);return l.useEffect(()=>{if(e){const r=new Xn(e);t.uniforms.uShimmerColor.value.set(r.r,r.g,r.b)}else t.uniforms.uShimmerColor.value.set(1,1,1)},[e,t]),zs((r,n)=>{t.uniforms.uTime.value+=n}),a.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,.012,0],children:[a.jsx("circleGeometry",{args:[uge,128]}),a.jsx("primitive",{object:t,attach:"material"})]})}function wge({results:e,rollTrigger:t,preRollTrigger:r,showDice:n,gameMode:s="cee-lo",gameState:o,noAnimation:i=!1,chargeLevel:c=0,feltColor:u,shimmerColor:p,numberOfDice:d,diceModels:f}){const{scheduleReveal:m}=Ti(),h=r??0,b=l.useMemo(()=>{if(!u)return!1;const j=u.trim().toLowerCase();return j==="transparent"||j==="rgba(0,0,0,0)"||j==="rgba(0, 0, 0, 0)"},[u]),g=d?UR.slice(0,d):UR,y=d?qR.slice(0,d):qR,x=l.useMemo(()=>{try{const j=navigator.userAgent;return/iPad|iPhone|iPod/.test(j)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1}catch{return!1}},[]);l.useEffect(()=>{t>0&&m(2e3)},[t,m]);const v=hm(),A=l.useMemo(()=>({felt:new Ua({color:b?"#0e3a20":u??"#0e3a20",roughness:.95,metalness:.02,transparent:b,opacity:b?0:1,depthWrite:!b}),rim:new Ua({color:"gold",roughness:.4,metalness:.85,envMapIntensity:.6})}),[u,b]),_=()=>(l.useEffect(()=>{var C;if(!x)return;const{gl:j,scene:T}=v;let R=Date.now();const P=15e3;function k(){try{T.traverse(I=>{const L=I.material;L&&(Array.isArray(L)?L.forEach(N=>{N.needsUpdate=!0,N.map&&(N.map.needsUpdate=!0)}):(L.needsUpdate=!0,L.map&&(L.map.needsUpdate=!0)))});try{j.outputColorSpace=Ea}catch{}try{j.toneMapping=Vy}catch{}j.setClearColor("#000000",0)}catch{}}function E(){document.visibilityState==="visible"?Date.now()-R>P&&k():R=Date.now()}function M(){k()}document.addEventListener("visibilitychange",E);try{(C=j==null?void 0:j.domElement)==null||C.addEventListener("webglcontextrestored",M,!1)}catch{}return()=>{var I;document.removeEventListener("visibilitychange",E);try{(I=j==null?void 0:j.domElement)==null||I.removeEventListener("webglcontextrestored",M,!1)}catch{}}},[x]),null),w=()=>a.jsxs(a.Fragment,{children:[a.jsx("ambientLight",{intensity:.8}),a.jsx("hemisphereLight",{args:["#ffffff",b?"#0e3a20":u??"#0e3a20",.45],position:[0,6,0]})]});if(s==="craps"){const j=e==null?void 0:e[0],T=e==null?void 0:e[1];return a.jsx(Mc,{type:"fixed",children:a.jsxs("group",{children:[a.jsx(_,{}),a.jsx(w,{}),a.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.001,0],children:[a.jsx("circleGeometry",{args:[Ts,128]}),a.jsx("primitive",{object:A.felt,attach:"material"})]}),a.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,0],castShadow:!0,children:[a.jsx("ringGeometry",{args:[Ts-.15,Ts+.2,128]}),a.jsx("primitive",{object:A.rim,attach:"material"})]}),a.jsx(HR,{shimmerColor:p}),a.jsx(Mc,{type:"fixed",colliders:"cuboid",position:[0,-.5,0],friction:.9,restitution:.15,children:a.jsxs("mesh",{visible:!1,children:[a.jsx("boxGeometry",{args:[Ts*2,1,Ts*2]}),a.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})}),a.jsx(VR,{}),n&&y.map((R,P)=>a.jsx(FR,{position:R,result:P===0?j:T,rollTrigger:t,spinTrigger:h,noAnimation:i,active:!i,chargeLevel:c,modelOverride:f==null?void 0:f[P]},P))]})})}return a.jsx(Mc,{type:"fixed",children:a.jsxs("group",{children:[a.jsx(_,{}),a.jsx(w,{}),a.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,-.001,0],children:[a.jsx("circleGeometry",{args:[Ts,128]}),a.jsx("primitive",{object:A.felt,attach:"material"})]}),a.jsx(Mc,{type:"fixed",colliders:"cuboid",position:[0,-.5,0],friction:.9,restitution:.15,children:a.jsxs("mesh",{visible:!1,children:[a.jsx("boxGeometry",{args:[Ts*2,1,Ts*2]}),a.jsx("meshStandardMaterial",{transparent:!0,opacity:0})]})}),a.jsxs("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,0],castShadow:!0,children:[a.jsx("ringGeometry",{args:[Ts-.15,Ts+.2,128]}),a.jsx("primitive",{object:A.rim,attach:"material"})]}),a.jsx(HR,{shimmerColor:p}),a.jsx(VR,{}),n&&g.map((j,T)=>a.jsx(FR,{position:j,result:e==null?void 0:e[T],rollTrigger:t,spinTrigger:h,noAnimation:i,active:!i,chargeLevel:c,modelOverride:f==null?void 0:f[T]},T))]})})}let Og=null,zg=null;function WR(e){Og=e}function GR(e){zg=e}function A_(){try{Og==null||Og()}catch{}}function XR(){try{zg==null||zg()}catch{}}let xd=null;const Ob=typeof navigator<"u"&&(/iPad|iPhone|iPod/.test(navigator.userAgent)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1),xge=Ob?[1,1]:[1,1.5],Age=!Ob,qO={alpha:!0,antialias:!Ob,powerPreference:"high-performance"};function VO(e){if(!e)return!1;try{if(typeof e.isContextLost=="function"&&e.isContextLost())return!1;const t=e.getShaderPrecisionFormat(e.VERTEX_SHADER,e.HIGH_FLOAT),r=e.getShaderPrecisionFormat(e.FRAGMENT_SHADER,e.MEDIUM_FLOAT);return!!(t&&r&&typeof t.precision=="number"&&typeof r.precision=="number")}catch{return!1}}function kge(){if(typeof document>"u")return!1;try{const e=document.createElement("canvas");e.width=16,e.height=16;const t=qO,r=e.getContext("webgl2",t)||e.getContext("webgl",t)||e.getContext("experimental-webgl",t);return VO(r)}catch{return!1}}const ui=()=>{var t,r;const e=xd;if(xd=null,e){try{(r=(t=e.renderLists)==null?void 0:t.dispose)==null||r.call(t)}catch{}try{e.dispose()}catch{}}};function HO(){ui()}class Sge extends ot.Component{constructor(){super(...arguments);Wr(this,"state",{hasError:!1})}static getDerivedStateFromError(){return{hasError:!0}}componentDidCatch(r,n){var o;Ws.error("CanvasErrorBoundary caught",{message:r==null?void 0:r.message,stack:(o=r==null?void 0:r.stack)==null?void 0:o.slice(0,500)}),console.error("[DiceBoard] Canvas error boundary caught:",r,n);const s=(r==null?void 0:r.message)||"";(s.includes("autoReset")||s.includes("undefined is not an object")||s.includes("precision")||s.includes("reading null")||s.includes("getShaderPrecisionFormat")||s.includes("WebGL")||s.includes("reading 'precision'"))&&this.props.onError()}reset(){this.setState({hasError:!1})}render(){return this.state.hasError?null:this.props.children}}function Ege(){const{size:e,camera:t}=hm();return ot.useEffect(()=>{const r=Math.min(e.width,e.height)/2,n=Ts+.75,s=t.position,o=Math.sqrt(s.x*s.x+s.y*s.y+s.z*s.z),i=o>.1&&s.y>.1?s.y/o:1,c=i<.95?1+(1-i)*.6:1,u=r/(n*c),p=t;p.zoom=u,p.updateProjectionMatrix()},[e.width,e.height,t]),null}function WO({isWaiting:e,rollTrigger:t,results:r,preRollTrigger:n,gameMode:s="cee-lo",gameState:o,diceSettled:i,chargeLevel:c=0,cameraAngle:u=0,feltColor:p,shimmerColor:d,numberOfDice:f,diceModels:m,rollEnabled:h=!1,onRollRequest:b}){const g=s==="craps",[y,x]=ot.useState(!0),[v,A]=ot.useState(null),_=ot.useRef(null),[w,j]=ot.useState(0),[T,R]=ot.useState(!1),[P,k]=ot.useState(!1),[E,M]=ot.useState(0),C=ot.useRef(0),I=ot.useRef(!0),L=ot.useRef(null),N=ot.useRef(null),S=Ob?8:2,F=ot.useCallback(()=>{I.current&&(ui(),R(!0))},[]),D=ot.useCallback(()=>{C.current=Math.min(C.current+1,S+1),M(C.current)},[]),H=ot.useCallback(()=>{C.current=0,M(0)},[]),W=ot.useCallback(()=>{L.current!=null&&(window.clearTimeout(L.current),L.current=null)},[]),G=ot.useCallback(()=>{N.current!=null&&(window.clearTimeout(N.current),N.current=null)},[]),$=ot.useCallback(re=>{I.current&&(W(),k(!1),L.current=window.setTimeout(()=>{L.current=null,I.current&&j(pe=>pe+1)},Math.max(16,re)))},[W]),K=ot.useCallback(()=>{I.current&&(W(),ui(),H(),R(!1),k(!1),$(50))},[W,H,$]);ot.useEffect(()=>(I.current=!0,WR(ui),GR(K),()=>{I.current=!1,WR(null),GR(null),W(),G(),ui()}),[G,W,K]),ot.useEffect(()=>{if(T)return;let re=!1;G();const pe=()=>{var xe;if(re||!I.current)return;if(kge()){k(!0),C.current>0&&H();return}k(!1);const ee=C.current;try{(xe=Ws.warn)==null||xe.call(Ws,"DiceBoard WebGL preflight failed",{attempt:ee,max:S})}catch{}if(ee<S){D();const Le=Math.min(2200,350*Math.pow(1.55,ee));N.current=window.setTimeout(pe,Le)}else F()};return pe(),()=>{re=!0,G()}},[D,w,G,F,H,T]),ot.useEffect(()=>{let re=!1;const pe=_t=>{var Pt,kt;if(re)return;const Xe=xd;if(!Xe)return;let bt=!1;try{const Ee=(Pt=Xe.getContext)==null?void 0:Pt.call(Xe);bt=!!(Ee&&typeof Ee.isContextLost=="function"&&Ee.isContextLost())}catch{bt=!0}if(bt){try{(kt=Ws.warn)==null||kt.call(Ws,"DiceBoard probe detected lost WebGL context, forcing fresh remount",{source:_t})}catch{}ui(),H(),$(250)}},ee=()=>{document.visibilityState==="visible"&&pe("visibilitychange")},xe=()=>pe("pageshow"),Le=_t=>{var Pt,kt;const Xe=_t.reason,bt=Xe&&(Xe.message||String(Xe))||"";if(!re&&(bt.includes("reading 'precision'")||bt.includes("getShaderPrecisionFormat")||bt.includes("WebGLRenderer")||bt.includes("WebGLCapabilities")||bt.includes("initGLContext"))){try{(Pt=Ws.warn)==null||Pt.call(Ws,"DiceBoard caught WebGL init rejection, scheduling remount",{msg:bt.slice(0,200)})}catch{}ui();const Ee=C.current,le=Math.min(1600,400*Math.pow(2,Ee));Ee<S?(D(),$(le)):!re&&I.current&&F();try{(kt=_t.preventDefault)==null||kt.call(_t)}catch{}}};document.addEventListener("visibilitychange",ee),window.addEventListener("pageshow",xe),window.addEventListener("unhandledrejection",Le);let Ge=null;return(async()=>{var _t;try{const{App:Xe}=await Cr(async()=>{const{App:bt}=await Promise.resolve().then(()=>xm);return{App:bt}},void 0,import.meta.url);if(re)return;if(Ge=await Xe.addListener("resume",()=>pe("capacitor-resume")),re){try{await((_t=Ge==null?void 0:Ge.remove)==null?void 0:_t.call(Ge))}catch{}Ge=null}}catch{}})(),()=>{var _t;re=!0;try{document.removeEventListener("visibilitychange",ee)}catch{}try{window.removeEventListener("pageshow",xe)}catch{}try{window.removeEventListener("unhandledrejection",Le)}catch{}try{(_t=Ge==null?void 0:Ge.remove)==null||_t.call(Ge)}catch{}Ge=null}},[D,F,H,$]),ot.useEffect(()=>{let re=!0;return(async()=>{try{const pe=await ma();if(!re)return;x(pe.showAnimations!==!1)}catch{}})(),()=>{re=!1}},[]),ot.useCallback(async()=>{const re=!y;x(re);try{const pe=await ma();await $i({...pe,showAnimations:re})}catch{}},[y]);const de=ot.useMemo(()=>{if(y&&!T)return null;const re=Array.isArray(r)?r:void 0;if(!re)return null;const pe=(g?re.slice(0,2):re).filter(ee=>typeof ee=="number"&&ee>=1&&ee<=6);return pe.length===0?null:pe},[r,y,g,T]),ie=Yo(),we=ie==null?void 0:ie.throttleVideoForAnimation,he=ot.useRef(t);ot.useEffect(()=>{we&&(t>he.current&&we(!0).catch(()=>{}),he.current=t)},[t,we]),ot.useEffect(()=>{if(we&&i&&r){const re=setTimeout(()=>{we(!1).catch(()=>{})},500);return()=>clearTimeout(re)}},[i,r,we]);const[Ae,Fe]=ot.useState(0);ot.useEffect(()=>{if(!g)return;const re=pe=>{var Le;const ee=((Le=pe.detail)==null?void 0:Le.streak)??0;let xe=0;ee>=7?xe=5:ee>=5?xe=4:ee>=4?xe=3:ee>=3?xe=2:ee>=2&&(xe=1),Fe(xe)};return window.addEventListener("craps:streak",re),()=>window.removeEventListener("craps:streak",re)},[g]);const U=Ae>0?`dice-halo dice-halo--active dice-halo--level-${Ae}`:"dice-halo";ot.useEffect(()=>{var et;if(!g){A(null);return}const re=o==null?void 0:o.lastRoll;if(!re||!Array.isArray(re.dice))return;const pe=String(re.timestamp??`${re.dice.join("-")}-${re.total}-${((et=re.events)==null?void 0:et.join("|"))??""}`);if(_.current===pe)return;_.current=pe;const ee=Number(re.total??re.dice[0]+re.dice[1]),xe=new Set((re.events??[]).map(rt=>String(rt).toUpperCase())),Le=re.resolutions??{},Ge=Number(re.point??(o==null?void 0:o.crapsPoint)??0)||null,_t=xe.has("POINT_MADE")||[...xe].some(rt=>rt.startsWith("POINTMADE:")),Xe=xe.has("SEVEN_OUT")||xe.has("SEVENOUT")||ee===7&&!!Le.passLineLosses,bt=xe.has("POINT_SET"),Pt=!Ge&&(ee===7||ee===11)&&!!Le.passLineWins,kt=re.dice[0]===re.dice[1]&&[4,6,8,10].includes(ee);let Ee=`Rolled ${ee}`,le=`${re.dice[0]} + ${re.dice[1]}`,De="neutral";_t?(Ee="Point Made",le=`${ee} hits clean`,De="win"):Pt?(Ee=ee===11?"Yo Eleven":"Natural Seven",le="Come-out winner",De="win"):Xe?(Ee="Seven Out",le="Dice pass to the next shooter",De="loss"):bt?(Ee=`Point Is ${Ge??ee}`,le="Hit it again before seven",De="point"):kt&&(Ee=`Hard ${ee}`,le=`${re.dice[0]} the hard way`,De="win");const Ye=window.setTimeout(()=>{A({key:pe,total:ee,title:Ee,detail:le,tone:De})},650),Re=window.setTimeout(()=>{A(rt=>(rt==null?void 0:rt.key)===pe?null:rt)},2450);return()=>{window.clearTimeout(Ye),window.clearTimeout(Re)}},[o==null?void 0:o.lastRoll,g]);const[V,z]=ot.useState(null),O=ot.useRef(0),[q,X]=ot.useState(0);ot.useEffect(()=>{if(g)return;const re=pe=>{var xe;const ee=(xe=pe.detail)==null?void 0:xe.result;(ee==="win"||ee==="lose")&&(O.current+=1,z(ee),X(Le=>ee==="win"?Le+1:0))};return window.addEventListener("ceelo:result",re),()=>window.removeEventListener("ceelo:result",re)},[g]),ot.useEffect(()=>{if(!V)return;const re=setTimeout(()=>z(null),1900);return()=>clearTimeout(re)},[V,O.current]);const Z=V?`dice-halo dice-halo--ceelo dice-halo--ceelo-${V}`:"",Q=ot.useMemo(()=>q>=7?5:q>=5?4:q>=4?3:q>=3?2:q>=2?1:0,[q]),oe=Q>0?`dice-halo dice-halo--active dice-halo--level-${Q}`:"dice-halo",ce=ot.useCallback(()=>{!h||e||!b||b()},[e,b,h]),_e=ot.useCallback(re=>{!h||e||re.key!=="Enter"&&re.key!==" "||(re.preventDefault(),ce())},[ce,e,h]);return a.jsxs("div",{className:`dice-board-wrap${h&&!e?" dice-board-wrap--rollable":""}${v?` dice-board-wrap--craps-impact dice-board-wrap--${v.tone}`:""}`,role:h&&!e?"button":void 0,tabIndex:h&&!e?0:void 0,"aria-label":h&&!e?"Roll dice":void 0,onClick:ce,onKeyDown:_e,children:[g&&a.jsx("div",{className:U,"aria-hidden":!0}),v&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"craps-roll-impact-ring","aria-hidden":!0},`pulse-${v.key}`),a.jsxs("div",{className:"craps-roll-moment",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"craps-roll-moment__total",children:v.total}),a.jsxs("span",{className:"craps-roll-moment__copy",children:[a.jsx("strong",{children:v.title}),a.jsx("small",{children:v.detail})]})]},`moment-${v.key}`)]}),!g&&Q>0&&a.jsx("div",{className:oe,"aria-hidden":!0}),!g&&V&&a.jsx("div",{className:Z,"aria-hidden":!0},O.current),a.jsxs("div",{className:"dice-board-canvas","data-testid":"dice-board",children:[T?a.jsxs("div",{className:"dice-board-canvas__error",role:"alert",children:[a.jsx("p",{children:"3D rendering unavailable"}),a.jsx("p",{className:"dice-board-canvas__error-hint",children:"Dice results will show as static images"}),a.jsx("button",{className:"dice-board-canvas__retry",type:"button",onClick:K,children:"Retry 3D"})]}):!P||E>0&&E<=S?a.jsx("div",{className:"dice-board-canvas__recovering",role:"status","aria-live":"polite",children:a.jsxs("p",{children:["Restoring 3D graphics... (attempt ",E,"/",S,")"]})}):a.jsx(Sge,{onError:()=>{console.warn("[DiceBoard] Error boundary triggered, attempting recovery"),ui(),setTimeout(()=>{C.current<S?(D(),$(0)):F()},300)},children:a.jsxs(gm,{shadows:Age,orthographic:!0,dpr:xge,gl:qO,style:{background:"transparent"},onCreated:({gl:re})=>{var Le;if(ui(),!re||!re.getContext){if(console.error("[DiceBoard] WebGL context creation failed"),C.current<S){console.warn(`[DiceBoard] Attempting context recovery (attempt ${C.current+1}/${S})`),D(),$(300);return}console.error("[DiceBoard] Max retry attempts reached, falling back to static"),F();return}let pe;try{if(pe=re.getContext(),!VO(pe))throw new Error("Context missing required methods")}catch(Ge){console.error("[DiceBoard] WebGL context test failed:",Ge),C.current>=S?(console.error("[DiceBoard] Max retry attempts reached, falling back to static"),F()):(D(),$(300));return}xd=re,C.current>0&&(console.log("[DiceBoard] Context restored successfully after retries"),H());try{re.setClearColor(0,0)}catch(Ge){console.error("[DiceBoard] setClearColor failed:",Ge)}try{re.outputColorSpace=Ea}catch{}try{Ea!=null&&(re.outputEncoding=Ea)}catch{}try{re.toneMapping=Vy}catch{}try{re.toneMappingExposure=1}catch{}try{re.physicallyCorrectLights=!0}catch{}const ee=re==null?void 0:re.domElement,xe=Ge=>{var _t;try{(_t=Ge.preventDefault)==null||_t.call(Ge)}catch{}Ws.error("DiceBoard WebGL context LOST",{retries:C.current}),console.warn("[DiceBoard] WebGL context lost event detected"),ui(),H(),$(300)};try{ee==null||ee.addEventListener("webglcontextlost",xe,!1)}catch{}try{const Ge=()=>{try{ee==null||ee.removeEventListener("webglcontextlost",xe,!1)}catch{}xd===re&&(xd=null)},_t=(Le=re.dispose)==null?void 0:Le.bind(re);re.dispose=()=>{try{Ge()}catch{}_t&&_t()}}catch{}},children:[a.jsx(m3,{makeDefault:!0,position:[0,20*Math.cos(u),20*Math.sin(u)],near:.1,far:100,zoom:16,rotation:[-(Math.PI/2-u),0,0]}),a.jsx(Ege,{}),a.jsx("ambientLight",{intensity:.7}),a.jsx("directionalLight",{position:[6,12,6],intensity:1.1,castShadow:!0}),a.jsx(h3,{gravity:[0,-9.8,0],children:a.jsx(wge,{rollTrigger:t,results:r,preRollTrigger:n,showDice:y,gameMode:s,gameState:o,noAnimation:!y,chargeLevel:c,feltColor:p,shimmerColor:d,numberOfDice:f,diceModels:m})})]},w)},`eb-${w}`),de&&de.length>0&&a.jsx("div",{className:"dice-board-canvas__faces","aria-label":"Dice faces","aria-live":"polite",children:a.jsx(rO,{dice:de})})]})]})}const Pge=Object.freeze(Object.defineProperty({__proto__:null,default:WO,disposeDiceBoardRenderer:HO},Symbol.toStringTag,{value:"Module"})),GO=50,Vh=GO/1200,Cge=({disabled:e,busy:t=!1,onClick:r,onPressStart:n,onChargeChange:s,label:o="ROLL"})=>{const i=e||t,c=l.useRef(!1),u=l.useRef(0),p=l.useRef(null),d=l.useRef(s);d.current=s,l.useEffect(()=>()=>{p.current&&clearInterval(p.current)},[]);const f=l.useCallback(()=>{var A;u.current=0,(A=d.current)==null||A.call(d,0),p.current&&clearInterval(p.current),p.current=window.setInterval(()=>{var _;u.current=Math.min(1,u.current+Vh),(_=d.current)==null||_.call(d,u.current),u.current>=.25&&u.current<.25+Vh*1.5?na("Light"):u.current>=.6&&u.current<.6+Vh*1.5?na("Medium"):u.current>=.95&&u.current<.95+Vh*1.5&&na("Heavy")},GO)},[]),m=l.useCallback(()=>{var A;p.current&&(clearInterval(p.current),p.current=null),(A=d.current)==null||A.call(d,0)},[]),h=l.useRef(0),b=l.useCallback(()=>{try{window.dispatchEvent(new CustomEvent("ui:roll-interaction"))}catch{}},[]),g=l.useCallback(A=>{i||c.current||(A.preventDefault(),A.stopPropagation(),A.currentTarget.setPointerCapture(A.pointerId),c.current=!0,b(),yn(),n==null||n(),f())},[i,b,n,f]),y=l.useCallback(async A=>{if(A.preventDefault(),A.stopPropagation(),!!c.current){c.current=!1,A.currentTarget.hasPointerCapture(A.pointerId)&&A.currentTarget.releasePointerCapture(A.pointerId),m(),h.current=Date.now()+400,b(),r();try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await na("Heavy")}},[b,r,m]),x=l.useCallback(A=>{A.stopPropagation(),c.current&&(c.current=!1,A.currentTarget.hasPointerCapture(A.pointerId)&&A.currentTarget.releasePointerCapture(A.pointerId),m())},[m]),v=l.useCallback(async A=>{var _,w;if(A.stopPropagation(),c.current||Date.now()<h.current){A.preventDefault();return}if(!i){b(),n==null||n(),(_=d.current)==null||_.call(d,1),r(),(w=d.current)==null||w.call(d,0);try{window.dispatchEvent(new CustomEvent("ui:roll"))}catch{}await na("Heavy")}},[i,b,r,n]);return a.jsx("div",{className:"zentara-roll-wrapper",children:a.jsxs("button",{type:"button",className:"zentara-roll-btn",onClick:v,onPointerDown:g,onPointerUp:y,onPointerCancel:x,disabled:i,"aria-label":t?"Rolling dice":"Roll dice","aria-busy":t||void 0,children:[t&&a.jsx("span",{className:"zentara-roll-spinner","aria-hidden":"true"}),a.jsx("span",{className:"zentara-roll-halo","aria-hidden":"true"}),a.jsx("span",{className:"zentara-roll-label","aria-live":"polite",children:t?"...":o})]})})},YR=ot.memo(Cge),Rge=420,ZR=e=>a.jsxs("span",{className:"zentara-balance-pill",children:["Balance: ",e]}),Tge=({phase:e,pendingEffect:t,isMyTurn:r,inJail:n,onRoll:s,onRollPressStart:o,onRollChargeChange:i,onBuy:c,onSkipBuy:u,onPayRent:p,onHeroClashRoll:d,onPayTax:f,onResolveCard:m,onPayBail:h,onPlantSpy:b,plantSpyEligibleGroup:g=null,plantSpyCost:y=1e3,suppressBuyPrompt:x=!1,buyInProgress:v=!1,tileOwnedByMe:A=!1,credits:_,upgradeableCount:w=0,armableCount:j=0,onArmPlanets:T,clashPhase:R="idle",children:P})=>{const k=R!=="idle",E=l.useRef(null),M=l.useRef(e);return l.useEffect(()=>{if(e!==M.current){M.current=e;const C=E.current;if(!C)return;C.style.pointerEvents="none";const I=setTimeout(()=>{C.style.pointerEvents=""},Rge);return()=>{clearTimeout(I),C.style.pointerEvents=""}}},[e]),r?a.jsxs("div",{className:"zentara-action-bar",ref:E,children:[a.jsxs("div",{className:"zentara-action-bar__left",children:[!k&&e==="pre-roll"&&!n&&a.jsxs(a.Fragment,{children:[a.jsx(YR,{onClick:s,onPressStart:o,onChargeChange:i,label:"ROLL DICE"}),j>0&&T&&a.jsxs("button",{className:"zentara-btn zentara-btn--secondary zentara-btn--arm",onClick:T,title:w>0?"Arm planets":"Not enough credits to arm",disabled:w===0,children:[a.jsx("span",{className:"zentara-btn--arm__full",children:"🔫 Arm Planets"}),a.jsx("span",{className:"zentara-btn--arm__short",children:"🔫 Arm"})]})]}),!k&&e==="pre-roll"&&n&&a.jsxs(a.Fragment,{children:[a.jsx(YR,{onClick:s,onPressStart:o,onChargeChange:i,label:"ROLL"}),a.jsx("button",{className:"zentara-btn zentara-btn--secondary",onClick:h,children:"Wake Up"}),ZR(_)]}),!k&&e==="rolling"&&a.jsx("span",{className:"zentara-action-bar__waiting",children:"Rolling…"}),e==="action"&&(t==null?void 0:t.action)==="buy-prompt"&&!x&&a.jsxs(a.Fragment,{children:[a.jsx("button",{className:"zentara-btn zentara-btn--secondary zentara-btn--prompt-pulse",onClick:u,disabled:v||A,children:"Pass"}),ZR(_)]}),e==="action"&&(t==null?void 0:t.action)==="draw-card"&&t.cardText&&a.jsx("span",{className:"zentara-card-prompt__text",children:t.cardText})]}),(e==="action"||P||g)&&!k&&a.jsxs("div",{className:"zentara-action-bar__right",children:[e==="action"&&(t==null?void 0:t.action)==="buy-prompt"&&!x&&a.jsxs("button",{className:"zentara-btn zentara-btn--primary zentara-btn--prompt-pulse",onClick:c,disabled:v||A||_<(t.amount??0),children:["Capture (",t.amount,")"]}),e==="action"&&(t==null?void 0:t.action)==="draw-card"&&a.jsx("span",{className:"zentara-action-bar__waiting",children:t.cardMoveTo!==void 0||t.cardGoToJail?"Warping…":(t.amount??0)>=0?`Looting +${t.amount} credits…`:`Energy draining… (-${Math.abs(t.amount??0)})`}),e==="action"&&(t==null?void 0:t.action)==="energy-toll"&&a.jsxs("span",{className:"zentara-action-bar__waiting",children:["Taking damage… (-",t.amount," credits)"]}),e==="action"&&(t==null?void 0:t.action)==="hero-clash"&&!k&&a.jsx("button",{className:"zentara-btn zentara-btn--primary",onClick:d,children:"⚔️ Hero Clash! Roll"}),e==="action"&&(t==null?void 0:t.action)==="spy-clash"&&!k&&a.jsx("span",{className:"zentara-action-bar__waiting",children:"🕵️ Spy Strike in progress…"}),r&&g&&!t&&!k&&(e==="action"||e==="pre-roll"||e==="done")&&a.jsxs("button",{className:"zentara-btn zentara-btn--secondary",onClick:()=>b==null?void 0:b(g),disabled:_<y,title:`Plant a spy on the ${g} group`,children:["🕵️ Plant Spy (",y,")"]}),e==="action"&&(t==null?void 0:t.action)==="void-drain"&&a.jsxs("span",{className:"zentara-action-bar__waiting",children:["Energy draining to the cosmos… (-",t.amount," credits)"]}),P]})]}):P?a.jsx("div",{className:"zentara-action-bar",children:a.jsx("div",{className:"zentara-action-bar__right",children:P})}):null},jge=ot.memo(Tge),Ige={start:NO,planet:MO,station:DO,asteroid:k1,nebula:S1,wormhole:LO,tax:Fw,"void-drain":Fw,jail:OO,"go-to-jail":zO,"free-parking":BO},Nge={start:"Launch Gate",jail:"Cryosleep Chamber","go-to-jail":"Black Hole","free-parking":"Rest Stop",wormhole:"Wormhole",asteroid:"Asteroid Field",nebula:"Nebula",tax:"Void Drain","void-drain":"Void Drain",station:"Space Station"},Mge={start:"Collect ✦200 energy each time you pass.",planet:"Capture this planet and upgrade its defenses to collect an energy toll from rivals.",station:"Space station — energy toll scales with the number of outposts you control.",asteroid:"Incoming asteroid! Draw a card — fortune or disaster awaits.",nebula:"Drifting through a nebula… draw a card to see what you find.",wormhole:"A rift in space — teleport to the paired wormhole.",tax:"The cosmos claims its due. Your energy drains into the void.","void-drain":"The cosmos claims its due. Your energy drains into the void.",jail:"Cryosleep Chamber — just visiting, unless you've been frozen.","go-to-jail":"Gravitational pull drags you straight into cryosleep.","free-parking":"A quiet sector of space. Rest here — nothing happens."},ta={0:"The last jump gate still standing from the Old Federation. Every fleet musters here.",1:"The closest star system to Sol — 4.37 light-years away. A prized first colony.",2:"Sensor ghosts dance in the ionised gas. Some say lost ships broadcast here forever.",3:"Tidally locked to its red dwarf star — one side in perpetual daylight, the other frozen.",4:"Galactic customs checkpoint. All cargo is taxed at ✦200 before passage.",5:"First-ring relay outpost. Provides fuel, repairs and encrypted comms to passing fleets.",6:"An ocean world with twice Earth's gravity — ideal for submarine fleet bases.",7:"A dense belt of iron-nickel asteroids. Rich salvage, but collisions are frequent.",8:"Slightly larger than Earth with a 112-day year. Its amber skies hide ancient ruins.",9:"Located in the habitable zone of Kepler-62. Thick clouds shroud a lush surface.",10:"Maximum-security cryosleep facility. Triple-layered stasis fields prevent any escape.",11:"One of seven known TRAPPIST worlds. Volcanic vents power its geothermal forges.",12:"A stable spatial rift linked to Wormhole β — instantaneous travel across the sector.",13:"Mild surface temperature and low radiation make this a premium colony world.",14:"The outermost habitable TRAPPIST planet. Ice-capped but mineral-rich beneath.",15:"Mid-range waystation with rotating habitat ring. Popular with mercenary crews.",16:"Orbits a quiet red dwarf only 11 light-years from Sol. A strategic forward base.",17:"Violent electromagnetic storms scramble navigation — tread carefully.",18:"A super-Earth candidate with a 168-day orbit. Its twin moons light the night sky.",19:"The furthest Tau Ceti colony — harsh winters but vast tundra mining operations.",20:"Neutral territory by treaty. All fleets stand down inside the beacon perimeter.",21:"Orbits within a triple-star system. Three sunsets paint the sky every evening.",22:"A rogue asteroid storm — fragment impacts can cripple shields in seconds.",23:"Slightly smaller than Earth. Underground cavern cities shelter millions from solar flares.",24:"Tidally heated, with surface geysers erupting every few hours. Rich in rare isotopes.",25:"Deep-space listening post. Its long-range arrays detect fleet movements sectors away.",26:"A diamond-core super-Earth. Surface temperatures melt hull plating — orbit only.",27:"The cooler sibling of 55e. Automated mining drones extract carbon nanomaterials.",28:"Exit point of the spatial rift from Wormhole α. Gravitational tides can be rough.",29:"A massive super-Earth with 8× Earth's mass. High gravity breeds tough colonists.",30:"Singularity detected — gravitational pull is inescapable. Straight to cryosleep.",31:"Orbits one of the oldest known stars — 11 billion years old. Ancient relics abound.",32:"The outer companion to Kapteyn b. Frozen methane lakes cover its dark surface.",33:"A shimmering gateway nebula — the gas refracts light into dazzling prismatic arcs.",34:"A rocky world just 14 light-years away. Its thin atmosphere crackles with static.",35:"The final frontier outpost before deep void. Last chance to resupply or repair.",36:"A sudden meteor shower — Loss or fortune depends on your shield configuration.",37:"A mythical jungle world. Bio-luminescent flora and apex predators rule the canopy.",38:"War-effort contribution. All empires pay ✦100 to fund the galactic defense grid.",39:"The legendary throne world at the galaxy's heart. Whoever holds Zentara rules all."},Lge={"Alpha Centauri":ta[1],"Proxima B":ta[3],"Kepler-22b":ta[6],"Kepler-442b":ta[8],"Kepler-62f":ta[9],"Trappist-1d":ta[11],"Trappist-1e":ta[13],"Trappist-1f":ta[14],"Ross 128b":ta[16],"Tau Ceti e":ta[18],"Tau Ceti f":ta[19],"Gliese 667Cc":ta[21],"Gliese 581d":ta[23],"Gliese 581g":ta[24],"Cancri 55e":ta[26],"Cancri 55f":ta[27],"HD 40307g":ta[29],"Kapteyn b":ta[31],"Kapteyn c":ta[32],"Wolf 1061c":ta[34],Pandora:ta[37],Zentara:ta[39]},Dge=({tile:e,property:t,ownerName:r,ownerColor:n,planetContent:s,onClick:o})=>{var x;if(!e)return a.jsx("div",{className:"zentara-tile-card zentara-tile-card--empty",children:a.jsx("span",{className:"zentara-tile-card__hint",children:"Tap a tile for info"})});const i=e.group?ka[e.group]:"#1e3a5f",c=(s==null?void 0:s.imageUrl)??Ige[e.type],u=Mge[e.type]??"",p=(s==null?void 0:s.lore)??(e.type==="planet"?Lge[e.name]:ta[e.id])??"",d=t!=null,f=(t==null?void 0:t.upgradeLevel)??0,m=(x=e.rent)==null?void 0:x[f],b=d?["Unfortified","Shield I","Shield II","Shield III","Shield IV","Fortress"][f]??"Unfortified":null,g=d?"⬢".repeat(f)+"⬡".repeat(5-f):null,y=d&&b?`${b}  ${g}`:u;return a.jsxs("div",{className:"zentara-tile-card",onClick:o,style:{cursor:o?"pointer":void 0},children:[a.jsx("div",{className:"zentara-tile-card__accent",style:{background:i}}),a.jsxs("div",{className:"zentara-tile-card__body",children:[a.jsxs("div",{className:"zentara-tile-card__header",children:[c&&a.jsx("img",{className:"zentara-tile-card__img",src:c,alt:e.type}),a.jsx("span",{className:"zentara-tile-card__name",children:e.name})]}),y&&a.jsx("div",{className:`zentara-tile-card__desc${["station","asteroid","nebula","wormhole"].includes(e.type)&&!d?" zentara-tile-card__desc--breach":""}`,children:y}),p&&a.jsx("div",{className:"zentara-tile-card__fact",children:p}),a.jsx("div",{className:"zentara-tile-card__status",style:d&&n?{color:n}:void 0,children:d?`Controlled by ${r??"Unknown"}`:e.cost!=null?"Uncontrolled":Nge[e.type]??e.type.replace(/-/g," ")}),e.cost!=null&&a.jsx("div",{className:"zentara-tile-card__stats",children:d?m!=null?a.jsxs(a.Fragment,{children:["Damage ✦",m]}):null:a.jsxs(a.Fragment,{children:["Capture ✦",e.cost,m!=null&&a.jsxs(a.Fragment,{children:[" · Damage ✦",m]})]})})]})]})},Oge=ot.memo(Dge),zge={start:"Launch Gate",jail:"Cryosleep Chamber","go-to-jail":"Black Hole","free-parking":"Rest Stop",wormhole:"Wormhole",asteroid:"Asteroid Field",nebula:"Nebula",tax:"Void Drain","void-drain":"Void Drain",station:"Space Station"},Bge=({tile:e,property:t,ownerName:r,isOwnedByMe:n,canAffordUpgrade:s,onClose:o,onUpgrade:i,onMortgage:c,onSell:u,onSabotage:p,sabotageCost:d,credits:f,groupOwned:m,groupTotal:h,planetContent:b})=>{if(!e)return null;const g=e.group?ka[e.group]:"#1e3a5f",y=f!=null&&d!=null&&f>=d;return a.jsx("div",{className:"zentara-tmodal-overlay",onClick:o,children:a.jsxs("div",{className:"zentara-tmodal-card",onClick:x=>x.stopPropagation(),children:[a.jsx("div",{className:"zentara-tmodal__strip",style:{background:g}}),a.jsx("h3",{className:"zentara-tmodal__name",children:e.name}),(b==null?void 0:b.imageUrl)&&a.jsx("img",{className:"zentara-tmodal__planet-image",src:b.imageUrl,alt:""}),a.jsx("p",{className:"zentara-tmodal__type",children:zge[e.type]??e.type.replace(/-/g," ")}),(b==null?void 0:b.lore)&&a.jsx("p",{className:"zentara-tmodal__lore",children:b.lore}),e.cost!=null&&a.jsxs("p",{className:"zentara-tmodal__cost",children:["Capture Cost: ",a.jsx("strong",{children:e.cost})," energy",f!=null&&a.jsxs("span",{className:"zentara-tmodal__balance-pill",children:["Balance: ",f]})]}),e.rent&&a.jsxs("div",{className:"zentara-tmodal__rent",children:[a.jsxs("div",{children:["Damage: ",e.rent[0]]}),e.rent.slice(1).map((x,v)=>a.jsxs("div",{children:["Arms Lv.",v+1,": ",x]},v))]}),t&&a.jsxs("div",{className:"zentara-tmodal__owner-section",children:[a.jsxs("div",{children:["Commander: ",r??"Unknown"]}),a.jsxs("div",{children:["Arms Level: ",t.upgradeLevel]}),t.dormant&&a.jsx("div",{className:"zentara-tmodal__mortgaged",children:"Decommissioned"})]}),e.group&&h!=null&&h>1&&n&&a.jsxs("div",{className:"zentara-tmodal__sector-box",children:[a.jsxs("div",{className:"zentara-tmodal__sector-row",children:[a.jsx("span",{className:"zentara-tmodal__sector-label",style:{color:g},children:"Sector Control"}),a.jsxs("span",{className:"zentara-tmodal__sector-count","data-full":m===h?"true":void 0,children:[m,"/",h]})]}),a.jsx("div",{className:"zentara-tmodal__sector-bars",children:Array.from({length:h}).map((x,v)=>a.jsx("div",{className:"zentara-tmodal__sector-bar",style:{background:v<(m??0)?g:"rgba(255,255,255,0.12)"}},v))}),m!=null&&m<h&&a.jsxs("div",{className:"zentara-tmodal__sector-warn",children:["⚠ Capture all ",h," planets in this sector to unlock arming"]}),m===h&&t&&t.upgradeLevel<5&&a.jsx("div",{className:"zentara-tmodal__sector-ok",children:"✓ Full sector control — arming unlocked"})]}),n&&t&&!t.dormant&&a.jsxs("div",{className:"zentara-tmodal__actions",children:[t.upgradeLevel<5&&e.upgradeCost!=null&&a.jsxs("button",{onClick:()=>i==null?void 0:i(e.id),disabled:!s,className:"zentara-tmodal__action-btn zentara-tmodal__action-btn--arm",children:["Arm (",e.upgradeCost,")"]}),t.upgradeLevel===0&&a.jsx("button",{onClick:()=>c==null?void 0:c(e.id),className:"zentara-tmodal__action-btn zentara-tmodal__action-btn--decommission",children:"Decommission"}),t.upgradeLevel===0&&a.jsxs("button",{onClick:()=>u==null?void 0:u(e.id),className:"zentara-tmodal__action-btn zentara-tmodal__action-btn--sell",children:["Sell (",Math.floor((e.cost??0)/2),")"]})]}),n&&(t==null?void 0:t.dormant)&&a.jsxs("button",{onClick:()=>c==null?void 0:c(e.id),className:"zentara-tmodal__action-btn--recommission",children:["Recommission (",Math.floor((e.cost??0)*.3),")"]}),!n&&t&&t.upgradeLevel>0&&d!=null&&a.jsxs("button",{onClick:()=>p==null?void 0:p(e.id),disabled:!y,className:"zentara-tmodal__action-btn--sabotage",children:["Sabotage Arms (",d,")"]}),a.jsx("button",{onClick:o,className:"zentara-tmodal__close-btn",children:"Close"})]})})},Fge=ot.memo(Bge),XO=({playerId:e,credits:t,properties:r,board:n,onUpgrade:s,onClose:o})=>{const i=l.useMemo(()=>{const c=[];for(const u of r){if(u.ownerId!==e||u.dormant)continue;const p=n[u.tileId];if(!(p!=null&&p.upgradeCost))continue;const d=Ud(e,u.tileId,n,r);u.upgradeLevel>=d||p.upgradeCost>t||c.push({property:u,tile:p,maxLevel:d})}return c.sort((u,p)=>(u.tile.group??"").localeCompare(p.tile.group??"")||u.tile.id-p.tile.id),c},[e,t,r,n]);return ws.createPortal(a.jsx("div",{className:"zentara-arm-overlay",onClick:o,children:a.jsxs("div",{className:"zentara-arm-card",onClick:c=>c.stopPropagation(),children:[a.jsx("h3",{className:"zentara-arm-title",children:"Arm Properties"}),i.length===0?a.jsx("p",{className:"zentara-arm-empty",children:"No properties available to arm."}):a.jsx("ul",{className:"zentara-arm-list",children:i.map(({property:c,tile:u})=>{const p=u.group?ka[u.group]:"#1e3a5f";return a.jsxs("li",{className:"zentara-arm-row",onClick:()=>s(c.tileId),children:[a.jsx("span",{className:"zentara-arm-row__color",style:{background:p}}),a.jsx("span",{className:"zentara-arm-row__name",children:u.name}),a.jsxs("span",{className:"zentara-arm-row__level",children:["Lv ",c.upgradeLevel," → ",c.upgradeLevel+1]}),a.jsxs("span",{className:"zentara-arm-row__cost",children:["⚡",u.upgradeCost]})]},c.tileId)})}),a.jsx("button",{className:"zentara-arm-close",onClick:o,children:"Close"})]})}),document.body)},Uge={"crimson-dominion":_k,"silver-pact":wk,"azure-sovereignty":xk,"golden-imperium":Ak,"emerald-collective":kk,"void-enclave":Sk};function qge({playerId:e,properties:t,tiles:r}){const n=l.useMemo(()=>{const s=[];for(const o of t){if(o.ownerId!==e)continue;const i=r[o.tileId];i!=null&&i.group&&s.push({color:ka[i.group]??"#1e3a5f",dormant:o.dormant})}return s.sort((o,i)=>o.color.localeCompare(i.color)),s},[e,t,r]);return n.length===0?null:a.jsx("div",{className:"property-dots",children:n.map((s,o)=>a.jsx("span",{className:`property-dot${s.dormant?" property-dot--dormant":""}`,style:{background:s.color}},o))})}function Vge({track:e,stream:t}){const r=l.useRef(null);return l.useEffect(()=>{const n=r.current;if(n){if(e!=null&&e.attach)return e.attach(n),()=>{e.detach(n)};if(t){n.srcObject!==t&&(n.srcObject=t);let s=0;const o=()=>{n.play().catch(()=>{s<3&&(s++,setTimeout(o,150+s*200))})};o(),n.onloadedmetadata=o;const i=()=>{const u=t.getVideoTracks()[0];u&&u.readyState==="live"&&o()},c=()=>{document.hidden||o()};return n.addEventListener("pause",i),document.addEventListener("visibilitychange",c),()=>{n.removeEventListener("pause",i),document.removeEventListener("visibilitychange",c),n.onloadedmetadata=null,n.srcObject=null}}}},[e,t]),a.jsx("video",{ref:r,autoPlay:!0,playsInline:!0,muted:!0,style:{position:"absolute",inset:0,width:"100%",height:"100%",objectFit:"cover",borderRadius:"50%",zIndex:1}})}const KR={type:"spring",stiffness:420,damping:38,mass:.6},Hge=({players:e,properties:t,tiles:r,currentPlayerId:n,localPlayerId:s,onSaveAndExit:o,onAvatarClick:i,roomId:c,onUpgradeProperty:u,upgradeableCount:p})=>{const d=Hr(),{user:f}=Zr(),{remoteStreams:m,myVideo:h,remoteVideoFlags:b}=Yo(),{onBuyChips:g}=kp(),y=(()=>{try{return(f==null?void 0:f.isGuest)===!0}catch{return!1}})(),x=l.useRef(null),[v,A]=l.useState(!1),_=e.find(R=>R.id===s);_!=null&&_.depleted||_==null||_.credits;const w=l.useCallback(R=>()=>{try{cr("Light")}catch{}try{}catch{}R()},[]),j=l.useCallback(()=>{if(o){o();return}d(-1)},[o,d]);l.useCallback(()=>{y||g()},[y,g]);const T=l.useMemo(()=>e.map(R=>R.id),[e]);return a.jsxs("div",{className:"card zentara-player-panel zentara-landscape-panel",children:[a.jsx("div",{className:"card-header card-header--two-rows",children:a.jsxs("div",{className:"card-header-row",children:[a.jsx("div",{className:"header-slot header-slot--left",children:a.jsx("a",{className:"gold-link white-link",onClick:w(j),"aria-label":"Back",style:{display:"flex"},children:a.jsx(go,{className:"icon",style:{color:"var(--gold, #caa64d)"}})})}),a.jsx("div",{className:"header-slot header-slot--center",children:a.jsx("div",{className:"chip-fly-container",children:a.jsx(Zs.ul,{className:"players players--avatars",role:"list",ref:x,layout:!0,transition:KR,children:T.map(R=>{const P=e.find(M=>M.id===R);if(!P)return null;const k=P.depleted?0:P.credits,E=R===n;return a.jsxs(Zs.li,{layout:!0,transition:KR,className:["player","player--avatar",E?"is-rolling":"",R===s?"is-me":""].join(" "),"data-player-id":R,onClick:()=>i==null?void 0:i(R),style:{cursor:"pointer"},children:[a.jsxs("div",{className:`avatar-ring${E?" is-rolling":""}`,style:{position:"relative"},children:[(()=>{const M=R===s?h:m[R];return((b==null?void 0:b[R])??!1)&&M?a.jsx(Vge,{stream:M}):null})(),a.jsx("img",{src:Uge[P.piece],alt:P.piece,className:"zentara-piece-avatar",style:{width:"100%",height:"100%",objectFit:"contain",borderRadius:"50%"}}),a.jsxs("div",{className:"avatar-balance-pill",children:[a.jsx("span",{children:"Power"}),a.jsx("strong",{children:ki.formatMoney(k,"",0)})]})]}),a.jsx(qge,{playerId:R,properties:t,tiles:r}),R===s&&E&&(p??0)>0&&a.jsx("button",{className:"zentara-arm-btn",onClick:M=>{M.stopPropagation(),A(!0)},title:"Arm properties",children:"🔫"}),a.jsxs("div",{className:"player-mini",children:[a.jsx("div",{className:"player-name",children:a.jsx("span",{className:"player-name__text",children:Yr(P.piece)})}),(P.armorLevel>0||P.weaponLevel>0||P.heroId)&&a.jsxs("div",{className:"zentara-ship-badges",children:[P.heroId&&Ta[P.heroId]&&a.jsxs("span",{className:"zentara-ship-badge zentara-ship-badge--hero",title:`${Ta[P.heroId].name} (${ZL[Ta[P.heroId].tier]})`,children:["🦸",Ta[P.heroId].tier]}),P.armorLevel>0&&a.jsxs("span",{className:"zentara-ship-badge zentara-ship-badge--armor",title:`Armor ${P.armorLevel}`,children:["🛡",P.armorLevel]}),P.weaponLevel>0&&a.jsxs("span",{className:"zentara-ship-badge zentara-ship-badge--weapon",title:`Weapons ${P.weaponLevel}`,children:["⚔",P.weaponLevel]})]})]})]},R)})})})}),a.jsx("div",{className:"header-slot header-slot--right"})]})}),v&&u&&a.jsx(XO,{playerId:s,credits:(_==null?void 0:_.credits)??0,properties:t,board:r,onUpgrade:u,onClose:()=>A(!1)})]})},Wge=ot.memo(Hge),qw=40,YO=50,ZO=50,Ad=44,kd=39.5,Gge=41.75,Hh=3.8,QR=Ri.MINIMAP_STEP_MS,JR={cursor:"pointer",pointerEvents:"auto"},Xge={"crimson-dominion":"#ff3a3a","silver-pact":"#b0c4de","azure-sovereignty":"#4488ff","golden-imperium":"#ffaa00","emerald-collective":"#39ff14","void-enclave":"#cc44ff"},Yge={purple:"#7b2ff2",cyan:"#00e5ff",orange:"#ff9100",red:"#ff1744",yellow:"#ffd600",green:"#00e676",blue:"#2979ff",magenta:"#e040fb"};function yf(e,t){const r=t*Math.PI/180;return{x:YO+e*Math.cos(r),y:ZO+e*Math.sin(r)}}function Zge(e,t){const r=Math.min(.55,t*.08),n=e-t/2+r,s=e+t/2-r,o=yf(Ad,n),i=yf(Ad,s),c=yf(kd,s),u=yf(kd,n),p=s-n>180?1:0;return[`M ${o.x.toFixed(3)} ${o.y.toFixed(3)}`,`A ${Ad} ${Ad} 0 ${p} 1 ${i.x.toFixed(3)} ${i.y.toFixed(3)}`,`L ${c.x.toFixed(3)} ${c.y.toFixed(3)}`,`A ${kd} ${kd} 0 ${p} 0 ${u.x.toFixed(3)} ${u.y.toFixed(3)}`,"Z"].join(" ")}function KO(e){const t=360/e;return Array.from({length:e},(r,n)=>{const s=-90+n*t;return{...yf(Gge,s),angleDeg:s,path:Zge(s,t)}})}const Kge=KO(qw),Qge=({players:e,currentPlayerId:t,properties:r=[],tiles:n=[],onTileClick:s})=>{const o=n.length||qw,i=o===qw?Kge:KO(o),c=l.useMemo(()=>{const h=new Map;for(const b of r){if(!b.ownerId)continue;const g=e.find(y=>y.id===b.ownerId);g&&h.set(b.tileId,g.pieceColor)}return h},[r,e]),u=l.useMemo(()=>e.filter(h=>!h.depleted),[e]),[p,d]=l.useState(()=>{const h={};for(const b of e)h[b.id]=b.tileIndex;return h}),f=l.useRef({}),m=l.useRef({});return l.useEffect(()=>{const h=new Set(u.map(b=>b.id));for(const b of Object.keys(m.current))h.has(b)||(clearTimeout(m.current[b]),delete m.current[b])},[u]),l.useEffect(()=>{for(const h of u){const b=h.tileIndex,g=f.current[h.id];if(g===void 0){f.current[h.id]=b,d(j=>({...j,[h.id]:b}));continue}if(g===b)continue;f.current[h.id]=b,clearTimeout(m.current[h.id]);const y=(b-g+o)%o,x=y>o/2,v=x?-1:1,A=x?o-y:y;let _=0;const w=()=>{_++,d(j=>{const T=j[h.id]??g;return{...j,[h.id]:(T+v+o)%o}}),_<A&&(m.current[h.id]=setTimeout(w,QR))};A>0&&(m.current[h.id]=setTimeout(w,QR))}},[u]),l.useEffect(()=>()=>{for(const h of Object.values(m.current))clearTimeout(h)},[]),a.jsxs("svg",{viewBox:"0 0 100 100",className:"zentara-minimap","aria-label":"Board minimap",children:[a.jsx("circle",{cx:YO,cy:ZO,r:(Ad+kd)/2,fill:"none",stroke:"rgba(0,229,255,0.18)",strokeWidth:Ad-kd+1.2,opacity:.52}),i.map((h,b)=>{const g=n[b],x=(g!=null&&g.group?Yge[g.group]:void 0)??"rgba(86, 98, 116, 0.92)",v=c.get(b);return a.jsx("path",{d:h.path,fill:v??x,stroke:v?"rgba(255,255,255,0.88)":"rgba(2,8,18,0.9)",strokeWidth:v?.52:.38,opacity:v?1:.94,style:s?JR:void 0,onClick:s?()=>s(b):void 0},b)}),u.map(h=>{const b=p[h.id]??h.tileIndex,g=i[b];if(!g)return null;const y=h.id===t;return a.jsx("rect",{x:g.x-Hh/2,y:g.y-Hh/2,width:Hh,height:Hh,rx:.8,fill:Xge[h.piece]??h.pieceColor,stroke:y?"#eaffff":"rgba(0,0,0,0.76)",strokeWidth:y?1.8:1,opacity:1,transform:`rotate(${g.angleDeg+45} ${g.x} ${g.y})`,className:y?"zentara-minimap-current-player":void 0,filter:y?"drop-shadow(0 0 3px rgba(0,229,255,0.8))":"drop-shadow(0 0 2px rgba(0,0,0,0.6))",style:s?JR:void 0,onClick:s?()=>s(h.tileIndex):void 0},h.id)})]})},Jge=ot.memo(Qge),$ge=({localPlayer:e,otherPlayers:t,properties:r,tiles:n,onPropose:s,onClose:o})=>{var T,R;const[i,c]=l.useState(((T=t[0])==null?void 0:T.id)??""),[u,p]=l.useState([]),[d,f]=l.useState(0),[m,h]=l.useState([]),[b,g]=l.useState(0),y=l.useMemo(()=>r.filter(P=>P.ownerId===e.id&&P.upgradeLevel===0),[r,e.id]),x=l.useMemo(()=>r.filter(P=>P.ownerId===i&&P.upgradeLevel===0),[r,i]),v=(P,k,E)=>k(M=>M.includes(E)?M.filter(C=>C!==E):[...M,E]),A=P=>{var k;return((k=n[P])==null?void 0:k.name)??`#${P}`},_=P=>{var k;return(k=n[P])==null?void 0:k.group},w=i&&(u.length>0||d>0||m.length>0||b>0),j=P=>{c(P),h([]),g(0)};return a.jsxs(a.Fragment,{children:[a.jsx("h3",{className:"zentara-trade-card__title",children:"Propose Trade"}),a.jsx("div",{className:"zentara-trade-card__section-title",children:"Trade With"}),a.jsx("div",{className:"zentara-trade-card__chip-row",children:t.map(P=>a.jsxs("button",{onClick:()=>j(P.id),className:"zentara-trade-chip",style:{background:i===P.id?"#1e3a5f":"transparent",color:i===P.id?"#fff":"#6b7fa3"},children:[Yr(P.piece)," (",P.credits,"cr)"]},P.id))}),a.jsx("div",{className:"zentara-trade-card__section-title",children:"You Give"}),y.length===0?a.jsx("div",{className:"zentara-trade-card__empty",children:"No properties to offer"}):a.jsx("div",{className:"zentara-trade-card__chip-row zentara-trade-card__chip-row--tight",children:y.map(P=>{const k=u.includes(P.tileId),E=_(P.tileId);return a.jsx("button",{onClick:()=>v(u,p,P.tileId),className:"zentara-trade-chip",style:{background:k?E?ka[E]:"#1e3a5f":"transparent",color:k?"#fff":"#c0d0e8",borderColor:E?ka[E]:"#1e3a5f",opacity:P.dormant?.4:1},children:A(P.tileId)},P.tileId)})}),a.jsxs("div",{className:"zentara-trade-card__credits-row",children:[a.jsx("label",{className:"zentara-trade-card__credits-label",children:"Credits:"}),a.jsx("input",{type:"range",min:0,max:e.credits,value:d,onChange:P=>f(Number(P.target.value)),className:"zentara-trade-card__credits-slider"}),a.jsx("span",{className:"zentara-trade-card__credits-value",children:d})]}),a.jsx("div",{className:"zentara-trade-card__section-title",children:"You Receive"}),x.length===0?a.jsx("div",{className:"zentara-trade-card__empty",children:"They have no properties"}):a.jsx("div",{className:"zentara-trade-card__chip-row zentara-trade-card__chip-row--tight",children:x.map(P=>{const k=m.includes(P.tileId),E=_(P.tileId);return a.jsx("button",{onClick:()=>v(m,h,P.tileId),className:"zentara-trade-chip",style:{background:k?E?ka[E]:"#1e3a5f":"transparent",color:k?"#fff":"#c0d0e8",borderColor:E?ka[E]:"#1e3a5f",opacity:P.dormant?.4:1},children:A(P.tileId)},P.tileId)})}),a.jsxs("div",{className:"zentara-trade-card__credits-row",children:[a.jsx("label",{className:"zentara-trade-card__credits-label",children:"Credits:"}),a.jsx("input",{type:"range",min:0,max:((R=t.find(P=>P.id===i))==null?void 0:R.credits)??0,value:b,onChange:P=>g(Number(P.target.value)),className:"zentara-trade-card__credits-slider"}),a.jsx("span",{className:"zentara-trade-card__credits-value",children:b})]}),a.jsxs("div",{className:"zentara-trade-card__btn-row",children:[a.jsx("button",{onClick:o,className:"zentara-trade-btn zentara-trade-btn--cancel",children:"Cancel"}),a.jsx("button",{disabled:!w,onClick:()=>w&&s(i,u,d,m,b),className:"zentara-trade-btn zentara-trade-btn--propose",children:"Send Offer"})]})]})},eye=({trade:e,players:t,tiles:r,onAccept:n,onDecline:s})=>{const o=(()=>{const p=t.find(d=>d.id===e.offerer.playerId);return p?Yr(p.piece):"Unknown Fleet"})(),i=p=>{var d;return((d=r[p])==null?void 0:d.name)??`#${p}`},c=p=>{var d;return(d=r[p])==null?void 0:d.group},u=({propIds:p})=>a.jsx("div",{className:"zentara-trade-card__chip-row zentara-trade-card__chip-row--tight",style:{marginTop:4},children:p.map(d=>{const f=c(d);return a.jsx("span",{className:"zentara-trade-chip zentara-trade-chip--default",style:{background:f?ka[f]:"#1e3a5f",color:"#fff"},children:i(d)},d)})});return a.jsxs(a.Fragment,{children:[a.jsxs("h3",{className:"zentara-trade-card__title",children:["Trade Offer from ",o]}),a.jsx("div",{className:"zentara-trade-card__section-title",children:"They Give"}),e.offerer.propertyIds.length>0&&a.jsx(u,{propIds:e.offerer.propertyIds}),e.offerer.credits>0&&a.jsxs("div",{className:"zentara-trade-card__credits-info",children:["+",e.offerer.credits," credits"]}),e.offerer.propertyIds.length===0&&e.offerer.credits===0&&a.jsx("div",{className:"zentara-trade-card__nothing",children:"Nothing"}),a.jsx("div",{className:"zentara-trade-card__section-title",children:"You Give"}),e.recipient.propertyIds.length>0&&a.jsx(u,{propIds:e.recipient.propertyIds}),e.recipient.credits>0&&a.jsxs("div",{className:"zentara-trade-card__credits-info",children:["+",e.recipient.credits," credits"]}),e.recipient.propertyIds.length===0&&e.recipient.credits===0&&a.jsx("div",{className:"zentara-trade-card__nothing",children:"Nothing"}),a.jsxs("div",{className:"zentara-trade-card__btn-row",children:[a.jsx("button",{onClick:s,className:"zentara-trade-btn zentara-trade-btn--decline",children:"Decline"}),a.jsx("button",{onClick:n,className:"zentara-trade-btn zentara-trade-btn--accept",children:"Accept"})]})]})},tye=({open:e,mode:t,localPlayer:r,players:n,properties:s,tiles:o,pendingTrade:i,onPropose:c,onAccept:u,onDecline:p,onClose:d})=>{if(!e)return null;const f=n.filter(m=>m.id!==r.id&&!m.depleted);return a.jsx("div",{className:"zentara-trade-overlay",onClick:d,children:a.jsx("div",{className:"zentara-trade-card",onClick:m=>m.stopPropagation(),children:t==="propose"?a.jsx($ge,{localPlayer:r,otherPlayers:f,properties:s,tiles:o,onPropose:c,onClose:d}):i?a.jsx(eye,{trade:i,players:n,tiles:o,onAccept:u,onDecline:p}):null})})},rye=ot.memo(tye),nye=({players:e,properties:t,tiles:r,currentPlayerId:n,open:s,onClose:o})=>a.jsxs(a.Fragment,{children:[s&&a.jsx("div",{onClick:o,className:"zentara-drawer-backdrop"}),a.jsxs("div",{className:`zentara-drawer${s?" zentara-drawer--open":""}`,children:[a.jsxs("div",{className:"zentara-drawer__header",children:[a.jsx("h3",{className:"zentara-drawer__title",children:"Players"}),a.jsx("button",{onClick:o,className:"zentara-drawer__close",children:"✕"})]}),e.map(i=>{const c=t.filter(d=>d.ownerId===i.id).sort((d,f)=>{var m,h;return(((m=r[d.tileId])==null?void 0:m.group)??"").localeCompare(((h=r[f.tileId])==null?void 0:h.group)??"")}),u=i.maxHp>0?Math.round(i.hp/i.maxHp*100):0,p=i.hp>i.maxHp*.6?"#00e676":i.hp>i.maxHp*.25?"#ffab00":"#ff1744";return a.jsxs("div",{className:`zentara-drawer__player${i.depleted?" zentara-drawer__player--bankrupt":""}`,children:[a.jsxs("div",{className:"zentara-drawer__player-row",children:[a.jsx("span",{className:"zentara-drawer__color-swatch",style:{background:i.pieceColor,boxShadow:i.id===n?`0 0 6px ${i.pieceColor}`:"none"}}),a.jsx("strong",{className:"zentara-drawer__player-name",children:Yr(i.piece)}),i.depleted&&a.jsx("span",{className:"zentara-drawer__status--destroyed",children:"(Destroyed)"}),i.inJail&&a.jsx("span",{className:"zentara-drawer__status--detained",children:"(Cryosleep)"})]}),a.jsxs("div",{className:"zentara-drawer__credits",children:["Credits: ",a.jsx("strong",{children:i.credits})]}),a.jsxs("div",{className:"zentara-drawer__hp-track",children:[a.jsx("div",{className:"zentara-drawer__hp-fill",style:{width:`${u}%`,background:p,boxShadow:`0 0 6px ${p}`}}),a.jsxs("span",{className:"zentara-drawer__hp-label",children:["♥ ",i.hp,"/",i.maxHp]})]}),c.length>0&&a.jsx("div",{className:"zentara-drawer__props",children:c.map(d=>{const f=r[d.tileId],m=f!=null&&f.group?ka[f.group]:"#1e3a5f";return a.jsx("span",{className:"zentara-drawer__prop-chip",style:{background:m,opacity:d.dormant?.4:1},children:(f==null?void 0:f.name)??`#${d.tileId}`},d.tileId)})})]},i.id)})]})]}),aye=ot.memo(nye),sye=({open:e,onClose:t,roomId:r,localPlayerId:n,players:s,injectedMessages:o,onLocalSend:i})=>{const c=Dm(),[u,p]=l.useState([]),[d,f]=l.useState(""),m=l.useRef(null),h=l.useRef(null),b=!!r,g=l.useMemo(()=>{if(b)return c.getRoomMessages(r);if(!o||o.length===0)return u;const _=new Map;for(const w of u)_.set(w.id,w);for(const w of o)_.has(w.id)||_.set(w.id,w);return Array.from(_.values()).sort((w,j)=>w.ts-j.ts||w.id.localeCompare(j.id))},[b,c,r,u,o]);l.useEffect(()=>{e&&m.current&&(m.current.scrollTop=m.current.scrollHeight)},[e,g.length]),l.useEffect(()=>{e&&setTimeout(()=>{var _;return(_=h.current)==null?void 0:_.focus()},350)},[e]);const y=l.useCallback(_=>{const w=s.find(j=>j.id===_);return w?Yr(w.piece):"Unknown"},[s]),x=l.useCallback(_=>{const w=s.find(j=>j.id===_);return(w==null?void 0:w.pieceColor)??"#6b7fa3"},[s]),v=l.useCallback(()=>{const _=d.trim();if(_){if(b)c.sendRoomMessage(r,_);else{const w={id:`local-${Date.now()}-${Math.random()}`,ts:Date.now(),senderId:n,text:_,roomId:"local"};p(j=>[...j,w]);try{i==null||i(w)}catch{}}f("")}},[d,b,r,c,n,i]),A=l.useCallback(_=>{_.key==="Enter"&&!_.shiftKey&&(_.preventDefault(),v())},[v]);return a.jsxs(a.Fragment,{children:[e&&a.jsx("div",{onClick:t,className:"zentara-drawer-backdrop"}),a.jsxs("div",{className:`zentara-chat-drawer${e?" zentara-chat-drawer--open":""}`,children:[a.jsxs("div",{className:"zentara-drawer__header",children:[a.jsx("h3",{className:"zentara-drawer__title",children:"Chat"}),a.jsx("button",{onClick:t,className:"zentara-drawer__close",children:"✕"})]}),a.jsxs("div",{className:"zentara-chat-messages",ref:m,children:[g.length===0&&a.jsx("p",{className:"zentara-chat-empty",children:"No messages yet. Say something!"}),g.map(_=>{const w=_.senderId===n;return a.jsxs("div",{className:`zentara-chat-bubble${w?" zentara-chat-bubble--me":""}`,children:[!w&&a.jsx("span",{className:"zentara-chat-sender",style:{color:x(_.senderId)},children:y(_.senderId)}),a.jsx("span",{className:"zentara-chat-text",children:_.text}),_.pending&&a.jsx("span",{className:"zentara-chat-pending",children:"…"})]},_.id)})]}),a.jsxs("div",{className:"zentara-chat-input-row",children:[a.jsx("input",{ref:h,type:"text",className:"zentara-chat-input",placeholder:"Type a message…",value:d,onChange:_=>f(_.target.value),onKeyDown:A,maxLength:200}),a.jsx("button",{className:"zentara-btn zentara-btn--primary zentara-chat-send",onClick:v,disabled:!d.trim(),children:"Send"})]})]})]})},oye=ot.memo(sye),iye=4500,lye=({latest:e,players:t,onOpen:r,hidden:n})=>{const[s,o]=l.useState(null);if(l.useEffect(()=>{if(!e||n)return;o(e);const p=setTimeout(()=>o(null),iye);return()=>clearTimeout(p)},[e,n]),!s||n)return null;const i=t.find(p=>p.id===s.senderId),c=i?Yr(i.piece):"Bot",u=(i==null?void 0:i.pieceColor)??"#6b7fa3";return a.jsxs("div",{role:"button","aria-label":"Open chat",onClick:r,style:{position:"fixed",top:14,left:"50%",transform:"translateX(-50%)",zIndex:10010,maxWidth:"88vw",minWidth:220,background:"rgba(8,14,32,0.92)",color:"#e8efff",padding:"10px 14px",borderRadius:14,border:`1px solid ${u}`,boxShadow:"0 8px 24px rgba(0,0,0,0.5), 0 0 0 1px rgba(255,255,255,0.05) inset",fontFamily:"system-ui, sans-serif",fontSize:14,lineHeight:1.3,cursor:"pointer",animation:"zentara-chat-toast-in 220ms ease-out",pointerEvents:"auto"},children:[a.jsxs("div",{style:{display:"flex",alignItems:"baseline",gap:8},children:[a.jsx("span",{style:{color:u,fontWeight:700,fontSize:12,letterSpacing:.3},children:c}),a.jsx("span",{style:{opacity:.5,fontSize:11},children:"· tap to open chat"})]}),a.jsx("div",{style:{marginTop:2},children:s.text}),a.jsx("style",{children:`
                @keyframes zentara-chat-toast-in {
                    from { opacity: 0; transform: translate(-50%, -8px); }
                    to   { opacity: 1; transform: translate(-50%, 0); }
                }
            `})]})},cye=15e3,uye=5e3,dye=22e3,pye=8e3,$R=7e3,fye=900,mye=700,hye=700,gye=900,Bg=globalThis.__zentaraActiveBotChatSessions||new Set;globalThis.__zentaraActiveBotChatSessions=Bg;const pa=(...e)=>{console.log("[autoplay-bot-chat]",...e)},yye=[/\b(stop|quit|enough|no more)\s+(chat|chatting|talking|messaging)/i,/\b(shut\s*up|be\s*quiet|leave\s+me\s+alone|don'?t\s+(chat|talk|message))\b/i,/\bno\s+(chat|chit-?chat|talking)\b/i,/\bplease\s+stop\b/i];function bye(e){return yye.some(t=>t.test(e))}function vye({enabled:e,gameMode:t,bots:r,localPlayerId:n,requireHumanEngagement:s=!0,getSituation:o,onMessage:i,getHistory:c,controlsRef:u}){const p=l.useRef(i),d=l.useRef(o),f=l.useRef(c),m=l.useRef(n);p.current=i,d.current=o,f.current=c,m.current=n;const h=l.useRef(u);h.current=u,l.useEffect(()=>{if(!e||r.length===0){pa("skip mount",{enabled:e,botCount:r.length});return}const b=[t,s?"quickmatch":"autoplay",...r.map(C=>C.id).sort()].join(":");if(Bg.has(b)){pa("skip duplicate session",{sessionKey:b});return}Bg.add(b),pa("mount",{enabled:e,gameMode:t,bots:r.map(C=>C.name),mode:s?"quickmatch":"autoplay"});let g=!1,y=null;const x=new Set,v=za(),A=()=>{Bg.delete(b)};if(!s){const C=Sye({apiBase:v,gameMode:t,bots:r,onMessageRef:p,getSituationRef:d,getHistoryRef:f,isCancelled:()=>g,scheduleNext:L=>{g||(y=setTimeout(C,L))}}),I=1500+Math.random()*1e3;return pa(`[autoplay] first tick in ${Math.round(I)}ms`),y=setTimeout(C,I),()=>{g=!0,y&&clearTimeout(y);for(const L of x)clearTimeout(L);x.clear(),A(),pa("unmount (autoplay)")}}let _=0,w=!1,j=!1;const T=[...r].sort(()=>Math.random()-.5),R=()=>{var L;if(j)return!0;const C=((L=f.current)==null?void 0:L.call(f))??[],I=m.current;return I&&C.some(N=>N.senderId===I&&bye(N.text))?(j=!0,pa("human asked bots to stop — silencing chat"),!0):!1},P=async(C,I,L,N,S)=>{var W,G;if(g||R())return;if(w){pa(`[${C}] suppressed - request already in flight`);return}const F=Date.now();if(S&&F-_<$R){pa(`[${C}] suppressed — within ${$R}ms of previous line`);return}_=F;const D=(W=f.current)==null?void 0:W.call(f);pa(`[${C}] POST /api/bot-chat/one-liner`,{gameMode:t,style:I,speakerId:L,bots:r.length,situation:N,historyLen:(D==null?void 0:D.length)??0});const H=performance.now();w=!0;try{const $=await fetch(`${v}/api/bot-chat/one-liner`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({gameMode:t,style:I,speakerId:L,bots:r,situation:N,history:D})});if(g)return;const K=Math.round(performance.now()-H);if(!$.ok){pa(`[${C}] ✗ HTTP ${$.status} in ${K}ms`);return}const de=await $.json();if(g)return;if(de!=null&&de.ok&&((G=de.message)!=null&&G.text)){const ie=de.message;pa(`[${C}] ✓ message in ${K}ms`,{senderId:ie.senderId,text:ie.text,fallback:!!de.fallback}),p.current({id:ie.id,senderId:ie.senderId,text:ie.text,ts:ie.ts,roomId:"autoplay"})}else pa(`[${C}] ∅ no message in ${K}ms`,{reason:de==null?void 0:de.reason})}catch($){pa(`[${C}] ✗ network error`,$)}finally{w=!1}},k=async()=>{if(g||R())return;const C=T.shift();if(!C){pa("intro round complete — switching to event-driven mode");return}if(await P("intro","intro",C.id,void 0,!1),g||T.length===0)return;const I=dye+Math.random()*pye;pa(`next intro in ${Math.round(I/1e3)}s (${T.length} remaining)`),y=setTimeout(k,I)},E=cye+Math.random()*uye;pa(`first intro in ${Math.round(E/1e3)}s`),y=setTimeout(k,E);const M={notifyGameEvent:C=>{if(g||R())return;const I=fye+Math.random()*mye,L=setTimeout(()=>{x.delete(L),P("event","game",void 0,C,!0)},I);x.add(L)},notifyHumanMessage:C=>{if(g||R())return;const I=hye+Math.random()*gye,L=setTimeout(()=>{x.delete(L),P("human-reply","converse",void 0,void 0,!1)},I);x.add(L)}};return h.current&&(h.current.current=M),()=>{g=!0,y&&clearTimeout(y);for(const C of x)clearTimeout(C);x.clear(),h.current&&h.current.current===M&&(h.current.current=null),A(),pa("unmount (quickmatch)")}},[e,t,s,JSON.stringify(r.map(b=>b.id))])}const _ye=12e3,wye=8e3,xye=15e3,Aye=12e3;function kye(e,t){var n;const r=e.toLowerCase();for(const s of t){const o=(n=(s.name||"").split(/\s+/)[0])==null?void 0:n.toLowerCase();if(!o)continue;if(new RegExp(`(^|[^a-z0-9])@?${o}\\b`,"i").test(r))return s}return null}function Sye(e){const{apiBase:t,gameMode:r,bots:n,onMessageRef:s,getSituationRef:o,getHistoryRef:i,isCancelled:c,scheduleNext:u}=e;let p=0,d=0,f;const m=[...n].sort(()=>Math.random()-.5),h=.55,b=.15,g=.25,y=()=>{const A=Math.random();return A<h?"converse":A<h+b?"game":A<h+b+g?"smalltalk":"trending"},x=A=>{const _=A[A.length-1];if(_){const T=kye(_.text,n);if(T&&T.id!==_.senderId)return T}const w=n.filter(T=>T.id!==f),j=w.length>0?w:n;return j[Math.floor(Math.random()*j.length)]};return async()=>{var R,P,k,E;if(c())return;p+=1;const A=p;let _,w;if(m.length>0){const M=m.shift();_="intro",w=M.id,f=M.id}else{const M=((R=i.current)==null?void 0:R.call(i))??[],C=x(M);w=C.id,f=C.id,_=y()}const j=(P=i.current)==null?void 0:P.call(i),T=_==="converse"||_==="game"?(k=o.current)==null?void 0:k.call(o):void 0;pa(`[autoplay] tick ${A} → ${_} (speaker=${w})`);try{const M=await fetch(`${t}/api/bot-chat/one-liner`,{method:"POST",headers:{"Content-Type":"application/json"},credentials:"include",body:JSON.stringify({gameMode:r,style:_,speakerId:w,bots:n,situation:T,history:j})});if(c())return;if(M.ok){const C=await M.json();if(C!=null&&C.ok&&((E=C.message)!=null&&E.text)){const I=C.message;pa(`[autoplay] tick ${A} ✓`,{senderId:I.senderId,text:I.text,fallback:!!C.fallback}),s.current({id:I.id,senderId:I.senderId,text:I.text,ts:I.ts,roomId:"autoplay"}),d+=1}else pa(`[autoplay] tick ${A} ∅`,{reason:C==null?void 0:C.reason})}}catch(M){pa(`[autoplay] tick ${A} ✗ network error`,M)}finally{if(!c()){const M=m.length>0?_ye+Math.random()*wye:xye+Math.random()*Aye;u(M)}}}}const Eye={"crimson-dominion":_k,"silver-pact":wk,"azure-sovereignty":xk,"golden-imperium":Ak,"emerald-collective":kk,"void-enclave":Sk},Pye=({player:e,properties:t,tiles:r,isCurrentPlayer:n,onClose:s,onTileClick:o})=>{var c;if(!e)return null;const i=t.filter(u=>u.ownerId===e.id).sort((u,p)=>{var d,f;return(((d=r[u.tileId])==null?void 0:d.group)??"").localeCompare(((f=r[p.tileId])==null?void 0:f.group)??"")});return a.jsx("div",{className:"zentara-pinfo-overlay",onClick:s,children:a.jsxs("div",{className:"zentara-pinfo-card",onClick:u=>u.stopPropagation(),children:[a.jsxs("div",{className:"zentara-pinfo__header",children:[a.jsx("div",{className:"zentara-pinfo__avatar",style:{border:`2px solid ${e.pieceColor}`,boxShadow:n?`0 0 10px ${e.pieceColor}`:"none",background:e.pieceColor+"22"},children:a.jsx("img",{src:Eye[e.piece],alt:e.piece,className:"zentara-pinfo__avatar-img"})}),a.jsxs("div",{children:[a.jsx("h3",{className:"zentara-pinfo__name",children:Yr(e.piece)}),a.jsxs("div",{className:"zentara-pinfo__badges",children:[n&&a.jsx("span",{className:"zentara-pinfo__badge zentara-pinfo__badge--current",children:"Current Turn"}),e.depleted&&a.jsx("span",{className:"zentara-pinfo__badge zentara-pinfo__badge--destroyed",children:"Destroyed"}),e.inJail&&a.jsx("span",{className:"zentara-pinfo__badge zentara-pinfo__badge--detained",children:"In Cryosleep"})]})]})]}),wi[e.piece]&&a.jsxs("div",{className:"zentara-pinfo__lore",children:[a.jsx("div",{className:"zentara-pinfo__lore-name",children:wi[e.piece].name}),a.jsxs("div",{className:"zentara-pinfo__lore-motto",children:['"',wi[e.piece].motto,'"']}),a.jsx("p",{className:"zentara-pinfo__lore-text",children:wi[e.piece].lore})]}),a.jsxs("div",{className:"zentara-pinfo__credits",children:["Credits: ",a.jsx("strong",{children:e.credits})]}),a.jsxs("div",{className:"zentara-pinfo__position",children:["Position: ",((c=r[e.tileIndex])==null?void 0:c.name)??`Tile ${e.tileIndex}`]}),i.length>0&&a.jsxs("div",{className:"zentara-pinfo__colonies",children:[a.jsxs("div",{className:"zentara-pinfo__colonies-label",children:["Colonies (",i.length,")"]}),a.jsx("div",{className:"zentara-pinfo__colony-list",children:i.map(u=>{const p=r[u.tileId],d=p!=null&&p.group?ka[p.group]:"#1e3a5f";return a.jsxs("span",{className:"zentara-pinfo__colony-chip",onClick:()=>o==null?void 0:o(u.tileId),style:{background:d,opacity:u.dormant?.4:1,cursor:o?"pointer":void 0},children:[(p==null?void 0:p.name)??`#${u.tileId}`,u.upgradeLevel>0&&` ★${u.upgradeLevel}`]},u.tileId)})})]}),i.length===0&&a.jsx("div",{className:"zentara-pinfo__no-colonies",children:"No colonies captured"}),a.jsx("button",{onClick:s,className:"zentara-pinfo__close-btn",children:"Close"})]})})},Cye=ot.memo(Pye);function Rye(e,t){const r=l.useRef(0);return l.useCallback((...n)=>{const s=Date.now();s-r.current>=t&&(r.current=s,e(...n))},[e,t])}const Tye=["/videos/space-conquest-1.mp4","/videos/space-conquest-2.mp4","/videos/zentara_game_intro.mp4","/videos/planet-capture.mp4","/videos/team-destroyed-1.mp4","/videos/team-destroyed-2.mp4","/videos/team-destroyed-3.mp4","/videos/fleet-ambush.mp4","/videos/empire-strike.mp4","/videos/broadside-salvo.mp4","/videos/jail-detention.mp4"],jye={"/videos/zentara_game_intro.mp4":"/videos/zentara_game_intro.mp4","/videos/capture-planet.mp4":"/videos/planet-capture.mp4","/videos/resource-strike.mp4":"/videos/empire-strike.mp4","/videos/board-movement.mp4":"/videos/space-conquest-2.mp4","/videos/social-friends.mp4":"/videos/space-conquest-2.mp4","/videos/social.mp4":"/videos/space-conquest-2.mp4","/videos/trade.mp4":"/videos/space-conquest-2.mp4"};let Vw=!1;const Hw=new Map,Fg=new Set,e2=new Set;let Ug=0;async function Iye(e){if(!(Hw.has(e)||Fg.has(e))){Fg.add(e);try{const t=await fetch(e,{cache:"force-cache"});if(!t.ok)return;const r=await t.blob(),n=URL.createObjectURL(r);Hw.set(e,n)}catch{}finally{Fg.delete(e)}}}function QO(e){return jye[e]??e}function Nye(e){const t=QO(e);return Hw.get(t)??t}function t2(e){const t=QO(e);e2.has(t)||(e2.add(t),Ug+=1,Iye(t).finally(()=>{Ug=Math.max(0,Ug-1)}))}function r2(){return Ug===0&&Fg.size===0}async function Mye(e=5e3){return!Vw||r2()?!0:new Promise(t=>{const r=Date.now(),n=window.setInterval(()=>{if(r2()){window.clearInterval(n),t(!0);return}Date.now()-r>=Math.max(250,e)&&(window.clearInterval(n),t(!1))},50)})}function Lye(e=[]){if(!(zr.isNativePlatform()&&zr.getPlatform()==="ios")){if(!Vw){Vw=!0;let t=0;for(const r of Tye)window.setTimeout(()=>{t2(r)},t*50),t+=1}for(const t of e)queueMicrotask(()=>{t2(t)})}}const Dye=2,Oye=2500,zye=({src:e,onEnd:t,coatOfArms:r,caption:n})=>{const s=l.useMemo(()=>{try{return zr.getPlatform()}catch{return"web"}},[]),o=l.useRef(zr.isNativePlatform()).current,i=o&&s==="ios",c=l.useMemo(()=>Nye(e),[e]),u=l.useRef(!1),[p,d]=l.useState(!1),f=l.useRef(null),[m,h]=l.useState("loading"),b=l.useRef(m);b.current=m,l.useEffect(()=>{u.current=!1,d(!1),h("loading")},[e]);const g=l.useRef(t);g.current=t;const y=l.useCallback(()=>{u.current||(u.current=!0,g.current())},[]);l.useEffect(()=>{if(m==="failed"){const _=setTimeout(()=>d(!0),400),w=setTimeout(y,Oye);return()=>{clearTimeout(_),clearTimeout(w)}}if(m==="loading"){const _=f.current;if(!_)return;let w=!1,j=0;const R=setTimeout(()=>{w||b.current!=="loading"||(console.warn("[ZENTARA] Cutscene load timeout, falling back",{src:e}),h("failed"))},i?7e3:3500),P=()=>{w||b.current!=="loading"||_.play().then(()=>{},()=>{w||b.current!=="loading"||(j<3?(j++,setTimeout(P,300*j)):h("failed"))})};try{_.pause(),_.currentTime=0,o&&_.load()}catch{}if(_.readyState<2){const k=()=>{_.removeEventListener("canplay",k),P()};return _.addEventListener("canplay",k),setTimeout(P,100),()=>{w=!0,clearTimeout(R),_.removeEventListener("canplay",k)}}return P(),()=>{w=!0,clearTimeout(R)}}if(m==="playing"){const _=f.current,w=_==null?void 0:_.duration,T=(typeof w=="number"&&Number.isFinite(w)&&w>0?w:4)*1e3,R=setTimeout(y,Math.min(T+1e3,12e3)),P=setTimeout(()=>d(!0),Math.max(0,T-2e3));let k=(_==null?void 0:_.currentTime)??0,E=0;const M=setInterval(()=>{const C=f.current;if(!C||C.ended||C.paused){clearInterval(M);return}C.currentTime===k?(E++,E>=2&&(console.warn("[ZENTARA] Cutscene stalled, force-dismissing"),clearInterval(M),y())):(E=0,k=C.currentTime)},2e3);return()=>{clearTimeout(R),clearTimeout(P),clearInterval(M)}}},[m,y,o,i,e]),l.useEffect(()=>{if(m==="failed")return;const _=()=>{if(document.hidden)return;const w=f.current;if(!(!w||w.ended)&&w.paused){let j=0;const T=()=>{w.play().catch(()=>{j<2?(j++,setTimeout(T,300)):(console.warn("[ZENTARA] Failed to resume video on foreground"),y())})};T()}};return document.addEventListener("visibilitychange",_),()=>document.removeEventListener("visibilitychange",_)},[m,y]);const x=l.useCallback(()=>{const _=f.current;!_||!r||p||_.duration&&_.currentTime>=_.duration-Dye&&d(!0)},[r,p]),v=Rye(x,200);if(m==="failed")return a.jsxs("div",{className:"zentara-cutscene-overlay",children:[a.jsx("div",{className:"zentara-cutscene-flash"}),a.jsx("div",{className:"zentara-cutscene-ring"}),r&&p&&a.jsx("img",{src:r,alt:"",className:"zentara-cutscene-emblem"}),n&&a.jsx("div",{className:"zentara-cutscene-caption",children:n})]});const A=m==="playing";return a.jsxs("div",{className:"zentara-cutscene-overlay",children:[a.jsx("video",{ref:f,src:c,autoPlay:!0,muted:!0,playsInline:!0,preload:"auto",onEnded:y,onError:()=>h("failed"),onCanPlay:()=>{var _;(_=f.current)==null||_.play().catch(()=>{})},onPlaying:()=>{m==="loading"&&h("playing")},onTimeUpdate:v,className:"zentara-cutscene-video",style:A?void 0:{opacity:0}},c),r&&p&&a.jsx("img",{src:r,alt:"",className:"zentara-cutscene-emblem"}),n&&a.jsx("div",{className:"zentara-cutscene-caption",children:n})]})},P1={"crimson-dominion":{pack:"CosmicShark",skinColor:"Red",accentColor:"#ff3344",emissionSuffix:"Emission",tierVariants:{1:"02",2:"06",3:"10",4:"13",5:"14",6:"16"}},"silver-pact":{pack:"CosmicShark",skinColor:"White",accentColor:"#c0d8ff",emissionSuffix:"Emission",tierVariants:{1:"02",2:"06",3:"10",4:"13",5:"14",6:"16"}},"azure-sovereignty":{pack:"CosmicShark",skinColor:"Blue",accentColor:"#3399ff",emissionSuffix:"Emission",tierVariants:{1:"02",2:"06",3:"10",4:"13",5:"14",6:"16"}},"golden-imperium":{pack:"CosmicShark",skinColor:"Yellow",accentColor:"#ffcc33",emissionSuffix:"Emission",tierVariants:{1:"02",2:"06",3:"10",4:"13",5:"14",6:"16"}},"emerald-collective":{pack:"CosmicShark",skinColor:"Green",accentColor:"#33ff88",emissionSuffix:"Emission",tierVariants:{1:"02",2:"06",3:"10",4:"13",5:"14",6:"16"}},"void-enclave":{pack:"CosmicShark",skinColor:"Purple",accentColor:"#aa55ff",emissionSuffix:"Emission",tierVariants:{1:"02",2:"06",3:"10",4:"13",5:"14",6:"16"}}},C1="/models/zentara/ships",Bye=`${C1}/CosmicShark`,Fye={"crimson-dominion":"18","silver-pact":"16","azure-sovereignty":"02","golden-imperium":"01","emerald-collective":"06","void-enclave":"17"};function JO(e,t){const r=P1[e],n=r.tierVariants[t];return`${C1}/${r.pack}/${r.pack}${n}.glb`}function Uye(e){return`${Bye}/CosmicShark${Fye[e]}.obj`}function $O(e,t){const r=P1[e],n=`${C1}/${r.pack}/Textures/${r.pack}`;return{diffuse:`${n}_${r.skinColor}.webp`,normal:`${n}_Normal.webp`,metallic:`${n}_Metallic.webp`,roughness:`${n}_Roughness.webp`,emission:`${n}_${r.emissionSuffix}.webp`}}const ez={"spy-plant":4300,"hero-clash":4700,wormhole:4200,"raid-victory":4400},zb="#41d8ff";function qye(e){return e*e*(3-2*e)}function Vye(e){return Math.max(0,Math.min(1,e))}function Ww(e,t=zb){return e!=null&&e.pieceColor&&/^#[0-9a-f]{3,8}$/i.test(e.pieceColor)?e.pieceColor:t}function Hye(e){var t;return(e.heroId?(t=Ta[e.heroId])==null?void 0:t.tier:void 0)??1}function Wye(){const e=l.useRef(null),t=l.useMemo(()=>{const n=new Float32Array(2280);let s=13933;const o=()=>(s=s*16807%2147483647,(s-1)/2147483646);for(let c=0;c<760;c+=1)n[c*3]=(o()-.5)*54,n[c*3+1]=(o()-.5)*28,n[c*3+2]=-o()*55+10;const i=new rx;return i.setAttribute("position",new Gd(n,3)),i},[]);return l.useEffect(()=>()=>t.dispose(),[t]),zs((r,n)=>{e.current&&(e.current.position.z+=n*1.2,e.current.position.z>10&&(e.current.position.z=0))}),a.jsx("points",{ref:e,geometry:t,children:a.jsx("pointsMaterial",{color:"#d9f6ff",size:.055,transparent:!0,opacity:.82,sizeAttenuation:!0})})}function Gye({color:e=zb}){return a.jsx("group",{children:a.jsx("pointLight",{color:e,intensity:1.7,distance:2.8})})}function Xye({color:e,tailZ:t,hullWidth:r}){const n=l.useMemo(()=>{const i=document.createElement("canvas");i.width=128,i.height=128;const c=i.getContext("2d");if(c){const p=c.createRadialGradient(64,64,0,64,64,64);p.addColorStop(0,"rgba(255,255,255,0.9)"),p.addColorStop(.18,"rgba(255,255,255,0.38)"),p.addColorStop(.55,"rgba(255,255,255,0.1)"),p.addColorStop(1,"rgba(255,255,255,0)"),c.fillStyle=p,c.fillRect(0,0,128,128)}const u=new Qc(i);return u.colorSpace=Ea,u},[]),s=l.useRef(null),o=Al.clamp(r*.38,.44,.9);return l.useEffect(()=>()=>n.dispose(),[n]),zs(({clock:i})=>{var u;const c=.96+Math.sin(i.elapsedTime*9)*.06;(u=s.current)==null||u.scale.set(o*c,o*c,1)}),a.jsxs("group",{position:[0,0,t+.18],children:[a.jsx("pointLight",{color:e,intensity:1.8,distance:2.4,decay:2}),a.jsx("sprite",{ref:s,scale:[o,o,1],renderOrder:20,children:a.jsx("spriteMaterial",{map:n,color:e,transparent:!0,opacity:.7,blending:la,depthWrite:!1,depthTest:!1,toneMapped:!1})})]})}function Yye({piece:e,tier:t,color:r}){const n=JO(e,t),s=zl(n),o=$O(e),i=Hy([o.diffuse,o.normal,o.metallic,o.roughness,o.emission]),c=l.useMemo(()=>new Xn(r),[r]),u=l.useMemo(()=>{const[p,d,f,m,h]=i;p.colorSpace=Ea,h.colorSpace=Ea;for(const j of i)j.flipY=!1,j.anisotropy=4,j.needsUpdate=!0;const b=s.scene.clone(!0);b.traverse(j=>{const T=j;!T.isMesh||!T.material||(T.material=new Ua({map:p,normalMap:d,metalnessMap:f,roughnessMap:m,emissiveMap:h,emissive:c,emissiveIntensity:.72,metalness:.74,roughness:.44,envMapIntensity:1.25}))});const y=new os().setFromObject(b).getSize(new An),x=Math.max(y.x,y.y,y.z)||1;b.scale.setScalar(1.65/x),b.updateMatrixWorld(!0);const A=new os().setFromObject(b).getCenter(new An);b.position.sub(A),b.updateMatrixWorld(!0);const _=new os().setFromObject(b),w=_.getSize(new An);return{object:b,tailZ:_.max.z,hullWidth:Math.max(w.x,w.y)}},[c,s.scene,i]);return a.jsxs("group",{rotation:[-.08,0,0],children:[a.jsx("primitive",{object:u.object,dispose:null}),a.jsx(Xye,{color:`#${c.getHexString()}`,tailZ:u.tailZ,hullWidth:u.hullWidth})]})}function Dy({player:e,color:t}){const r=(e==null?void 0:e.piece)??"azure-sovereignty",n=e?Hye(e):1,s=e?Ww(e,t):t;return a.jsx(l.Suspense,{fallback:a.jsx(Gye,{color:s}),children:a.jsx(Yye,{piece:r,tier:n,color:s})})}function n2({color:e,progress:t}){const r=.7+t*4.2,n=Math.max(0,1-t);return a.jsxs("mesh",{rotation:[Math.PI/2,0,0],scale:[r,r,r],children:[a.jsx("torusGeometry",{args:[1,.015,8,96]}),a.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n*.82,blending:la,depthWrite:!1})]})}function Zye({player:e,color:t}){return a.jsx("group",{scale:.24,rotation:[.35,Math.PI*.56,.2],children:a.jsx(Dy,{player:e,color:t})})}function a2({player:e,color:t,side:r}){const n=r==="left"?-1:1,s=r==="left"?0:Math.PI,o=[{position:[0,.08,0],scale:.48},{position:[n*.6,.34,.36],scale:.42},{position:[n*.62,-.2,.42],scale:.42},{position:[n*1.18,.48,.85],scale:.36},{position:[n*1.2,-.36,.92],scale:.36}];return a.jsx("group",{children:o.map((i,c)=>a.jsx("group",{position:i.position,rotation:[0,s,0],scale:i.scale,children:a.jsx(Dy,{player:e,color:t})},c))})}function ed({color:e,start:t,end:r,opacity:n}){const s=l.useMemo(()=>new g3([new An(...t),new An((t[0]+r[0])/2,(t[1]+r[1])/2+.18,(t[2]+r[2])/2),new An(...r)]),[t,r]);return a.jsxs("mesh",{children:[a.jsx("tubeGeometry",{args:[s,16,.025,8,!1]}),a.jsx("meshBasicMaterial",{color:e,transparent:!0,opacity:n,blending:la,toneMapped:!1})]})}function Kye({kind:e,attacker:t,defender:r,groupColor:n=zb}){const s=l.useRef(null),o=Ww(t,"#41d8ff"),i=Ww(r,"#ff4d6d"),c=n||o,u=l.useRef(null),p=l.useRef(null),d=l.useRef(null),f=l.useRef(null),m=l.useRef(null),h=l.useRef(null),{camera:b}=hm(),g=Hy("/zentara/planets/zentara.webp");l.useMemo(()=>(g.colorSpace=Ea,g.anisotropy=4,g.needsUpdate=!0,g),[g]),zs(({clock:w})=>{s.current===null&&(s.current=w.elapsedTime);const j=w.elapsedTime-s.current,T=ez[e]/1e3,R=Vye(j/T),P=qye(R);if(b.position.set(Math.sin(R*Math.PI*.75)*1.3,2+Math.sin(R*Math.PI)*.42,6.5-P*2.1),b.lookAt(0,.25,-1.2),f.current&&(f.current.rotation.y+=.18/60,f.current.rotation.x=-.18),d.current&&d.current.position.set(-2.2+P*2.15,1.35-P*.95,-1.25-P*.5),u.current&&(u.current.position.x=e==="hero-clash"?-3.35+P*1.7:-2.8+P*1.25,u.current.position.y=.25+Math.sin(j*2)*.05,u.current.rotation.y=e==="hero-clash"?-.1+Math.sin(j*.9)*.025:-.18+Math.sin(j*.9)*.04),p.current&&(p.current.position.x=e==="hero-clash"?3.35-P*1.7:2.75-P*.8,p.current.position.y=.2+Math.cos(j*1.8)*.05,p.current.rotation.y=e==="hero-clash"?.1:Math.PI+.22),m.current&&(m.current.rotation.z=j*1.6,m.current.scale.setScalar(.8+Math.sin(j*5)*.025+P*.75)),h.current){const k=e==="hero-clash"?Math.max(0,1-Math.abs(R-.58)/.16):Math.max(0,1-Math.abs(R-.72)/.22);h.current.intensity=.5+k*7}});const y=e==="hero-clash"||e==="raid-victory",x=e==="spy-plant",v=e==="wormhole",A=e==="hero-clash",_=e==="spy-plant"?.35:.7;return a.jsxs(a.Fragment,{children:[a.jsx("color",{attach:"background",args:["#020611"]}),a.jsx("ambientLight",{intensity:1.05}),a.jsx("hemisphereLight",{args:["#d7ecff","#172038",1.25]}),a.jsx("directionalLight",{position:[4,6,5],intensity:2.35,color:"#dceeff"}),a.jsx("directionalLight",{position:[-4,2.8,3],intensity:.9,color:o}),a.jsx("pointLight",{ref:h,position:[0,.8,-1.8],color:c,intensity:1.2,distance:8}),a.jsx(Wye,{}),a.jsxs("group",{ref:u,position:[-2.8,.25,-1.3],rotation:[.22,-.18,-.08],scale:.82,children:[a.jsx("pointLight",{position:[.1,.65,1.1],color:"#ffffff",intensity:1.9,distance:3.2,decay:1.6}),a.jsx("pointLight",{position:[-.8,-.25,.35],color:o,intensity:2,distance:2.8,decay:1.6}),A?a.jsx(a2,{player:t,color:o,side:"left"}):a.jsx(Dy,{player:t,color:o})]}),(e==="hero-clash"||e==="raid-victory")&&a.jsxs("group",{ref:p,position:[2.75,.2,-2.15],rotation:[.12,Math.PI+.22,.04],scale:.95,children:[a.jsx("pointLight",{position:[.1,.65,1.1],color:"#ffffff",intensity:1.8,distance:3.2,decay:1.6}),a.jsx("pointLight",{position:[.8,-.25,.35],color:i,intensity:1.8,distance:2.8,decay:1.6}),A?a.jsx(a2,{player:r,color:i,side:"right"}):a.jsx(Dy,{player:r,color:i})]}),a.jsxs("mesh",{ref:f,position:[.75,-1,-2.65],scale:e==="wormhole"?.62:1,children:[a.jsx("sphereGeometry",{args:[1.05,48,32]}),a.jsx("meshStandardMaterial",{map:g,color:e==="wormhole"?"#9bb8ff":"#ffffff",roughness:.78,metalness:.04,emissive:c,emissiveIntensity:.08})]}),a.jsxs("mesh",{position:[.75,-1,-2.65],rotation:[Math.PI/2,0,0],children:[a.jsx("torusGeometry",{args:[1.24,.012,8,120]}),a.jsx("meshBasicMaterial",{color:c,transparent:!0,opacity:.35,blending:la})]}),x&&a.jsxs(a.Fragment,{children:[a.jsxs("group",{ref:d,children:[a.jsx("pointLight",{position:[0,.45,.7],color:"#ffffff",intensity:2.6,distance:2.1,decay:1.4}),a.jsx("pointLight",{position:[.35,-.15,.1],color:o,intensity:2.4,distance:1.8,decay:1.4}),a.jsx(Zye,{player:t,color:o})]}),a.jsx(n2,{color:c,progress:_}),a.jsx(n2,{color:c,progress:.64})]}),y&&a.jsx(a.Fragment,{children:A?a.jsxs(a.Fragment,{children:[a.jsx(ed,{color:o,start:[-1.5,.42,-1.35],end:[1.45,.2,-2.02],opacity:.82}),a.jsx(ed,{color:o,start:[-1.85,-.02,-1.12],end:[1.18,-.22,-1.78],opacity:.62}),a.jsx(ed,{color:i,start:[1.58,.34,-1.9],end:[-1.08,.08,-1.28],opacity:.72}),a.jsx(ed,{color:"#ffffff",start:[-1.5,.45,-1.35],end:[1.45,.22,-2.02],opacity:.28})]}):a.jsxs(a.Fragment,{children:[a.jsx(ed,{color:o,start:[-1.2,.2,-1.35],end:[1.78,.18,-2],opacity:.88}),a.jsx(ed,{color:"#ffffff",start:[-1.2,.22,-1.35],end:[1.78,.18,-2],opacity:.4})]})}),v&&a.jsx("group",{ref:m,position:[0,.2,-2.7],children:Array.from({length:8}).map((w,j)=>a.jsxs("mesh",{rotation:[0,0,j/8*Math.PI],children:[a.jsx("torusGeometry",{args:[.82+j*.12,.012,8,96]}),a.jsx("meshBasicMaterial",{color:j%2?"#8ee8ff":c,transparent:!0,opacity:.6-j*.045,blending:la})]},j))})]})}function Qye(e){switch(e){case"spy-plant":return"Covert asset deployed";case"hero-clash":return"Fleet engagement";case"wormhole":return"Wormhole transit";case"raid-victory":return"Raid victory";default:return"Cutscene"}}function Jye({kind:e,attacker:t,defender:r,groupColor:n=zb,caption:s,onEnd:o}){const i=l.useRef(!1);l.useEffect(()=>{i.current=!1;const u=window.setTimeout(()=>{i.current||(i.current=!0,o())},ez[e]);return()=>window.clearTimeout(u)},[e,o]);const c=()=>{i.current||(i.current=!0,o())};return a.jsxs("div",{className:"zentara-realtime-cutscene",role:"dialog","aria-label":"Zentara cinematic cutscene",children:[a.jsx(gm,{gl:{antialias:!0,alpha:!1,powerPreference:"high-performance"},dpr:[1,1.5],camera:{position:[0,2.15,6.5],fov:46,near:.1,far:80},children:a.jsx(Kye,{kind:e,attacker:t,defender:r,groupColor:n})}),a.jsx("div",{className:"zentara-realtime-cutscene__vignette"}),a.jsx("div",{className:"zentara-realtime-cutscene__bars","aria-hidden":"true"}),a.jsxs("div",{className:"zentara-realtime-cutscene__copy",children:[a.jsx("span",{children:e.replace("-"," ").toUpperCase()}),a.jsx("strong",{children:s??Qye(e)})]}),a.jsx("button",{className:"zentara-realtime-cutscene__skip",type:"button",onClick:c,children:"Skip"})]})}const $ye=7600,ebe=4,s2=[[0,.5,-1.5],[-4.2,2.5,-4.2],[4.1,2.65,-4.8],[.15,4.4,-7]];function tbe(e){var t;return(e.heroId?(t=Ta[e.heroId])==null?void 0:t.tier:void 0)??1}function rbe(){const e=l.useRef(null),t=l.useMemo(()=>{const n=new Float32Array(2700);let s=21791;const o=()=>(s=s*16807%2147483647,(s-1)/2147483646);for(let c=0;c<900;c+=1)n[c*3]=(o()-.5)*55,n[c*3+1]=(o()-.5)*32,n[c*3+2]=-o()*48+8;const i=new rx;return i.setAttribute("position",new Gd(n,3)),i},[]);return zs((r,n)=>{e.current&&(e.current.position.z+=n*1.35,e.current.position.z>12&&(e.current.position.z=0))}),a.jsx("points",{ref:e,geometry:t,children:a.jsx("pointsMaterial",{color:"#d8efff",size:.065,transparent:!0,opacity:.88,sizeAttenuation:!0})})}function nbe({color:e,tailZ:t,hullWidth:r}){const n=l.useRef(null),s=l.useRef(null),o=l.useRef(null),i=l.useMemo(()=>{const d=document.createElement("canvas");d.width=128,d.height=128;const f=d.getContext("2d");if(f){const h=f.createRadialGradient(64,64,0,64,64,64);h.addColorStop(0,"rgba(255,255,255,0.85)"),h.addColorStop(.14,"rgba(255,255,255,0.42)"),h.addColorStop(.42,"rgba(255,255,255,0.12)"),h.addColorStop(1,"rgba(255,255,255,0)"),f.fillStyle=h,f.fillRect(0,0,128,128)}const m=new Qc(d);return m.colorSpace=Ea,m},[]),c=Al.clamp(r*.42,.52,1.05),u=c*.28,p=Al.clamp(r*.16,.13,.34);return l.useEffect(()=>()=>i.dispose(),[i]),zs(({clock:d})=>{var m,h,b;const f=.96+Math.sin(d.elapsedTime*8)*.045;(m=n.current)==null||m.scale.set(c*f,c*f,1),(h=s.current)==null||h.scale.set(u*f,u*f,1),(b=o.current)==null||b.scale.set(u*f,u*f,1)}),a.jsxs("group",{position:[0,0,t+.34],children:[a.jsx("pointLight",{color:e,intensity:2.4,distance:2.2,decay:2}),a.jsx("sprite",{ref:n,scale:[c,c,1],renderOrder:20,children:a.jsx("spriteMaterial",{map:i,color:e,transparent:!0,opacity:.62,blending:la,depthWrite:!1,depthTest:!1,toneMapped:!1})}),a.jsx("sprite",{ref:s,position:[-p,0,.03],scale:[u,u,1],renderOrder:21,children:a.jsx("spriteMaterial",{map:i,color:"#f5fdff",transparent:!0,opacity:.95,blending:la,depthWrite:!1,depthTest:!1,toneMapped:!1})}),a.jsx("sprite",{ref:o,position:[p,0,.03],scale:[u,u,1],renderOrder:21,children:a.jsx("spriteMaterial",{map:i,color:"#f5fdff",transparent:!0,opacity:.95,blending:la,depthWrite:!1,depthTest:!1,toneMapped:!1})})]})}function abe({player:e,index:t}){const r=l.useRef(null),n=tbe(e),s=JO(e.piece,n),o=zl(s),i=$O(e.piece),c=Hy([i.diffuse,i.normal,i.metallic,i.roughness,i.emission]),u=l.useMemo(()=>new Xn(e.pieceColor||"#8fe9ff"),[e.pieceColor]),p=l.useMemo(()=>{const[d,f,m,h,b]=c;d.colorSpace=Ea,b.colorSpace=Ea;for(const j of c)j.flipY=!1,j.anisotropy=4,j.needsUpdate=!0;const g=o.scene.clone(!0);g.traverse(j=>{const T=j;!T.isMesh||!T.material||(T.material=new Ua({map:d,normalMap:f,metalnessMap:m,roughnessMap:h,emissiveMap:b,emissive:u,emissiveIntensity:.65,metalness:.72,roughness:.46,envMapIntensity:1.35}))});const x=new os().setFromObject(g).getSize(new An),v=Math.max(x.x,x.y,x.z)||1;g.scale.setScalar(4.6/v),g.updateMatrixWorld(!0);const A=new os().setFromObject(g).getCenter(new An);g.position.sub(A),g.updateMatrixWorld(!0);const _=new os().setFromObject(g),w=_.getSize(new An);return{object:g,tailZ:_.max.z,hullWidth:Math.max(w.x,w.y)}},[u,o.scene,c]);return zs(({clock:d})=>{if(!r.current)return;const f=d.elapsedTime,m=Al.smoothstep(f,t*.22,2.4+t*.2),h=s2[t]??s2[0];r.current.position.set(h[0]+(1-m)*(t%2===0?11:-11),h[1]-(1-m)*5+Math.sin(f*.7+t)*.1,h[2]-(1-m)*24-f*.15),r.current.rotation.set(-.12+Math.sin(f*.5+t)*.035,Math.sin(f*.34+t)*.08,(1-m)*(t%2===0?-.7:.7)+Math.sin(f*.45+t)*.04);const b=t===0?1.5:.9-t*.06;r.current.scale.setScalar(b*Math.max(.01,m))}),a.jsxs("group",{ref:r,rotation:[-.12,0,0],children:[a.jsx("primitive",{object:p.object,dispose:null}),a.jsx(nbe,{color:`#${u.getHexString()}`,tailZ:p.tailZ,hullWidth:p.hullWidth})]})}function sbe(){const{camera:e}=hm();return zs(({clock:t})=>{const r=t.elapsedTime,n=Al.smoothstep(r,0,6.8);e.position.set(Al.lerp(7.2,.4,n),Al.lerp(5.8,3.2,n),Al.lerp(17,12.2,n)),e.lookAt(0,1.7,-3.4)}),null}function obe(){const e=Hy("/zentara/planets/zentara.webp");return l.useEffect(()=>{e.colorSpace=Ea,e.anisotropy=4,e.needsUpdate=!0},[e]),a.jsxs("group",{position:[0,-12.5,-11],scale:[1.55,1,1.2],rotation:[-.06,-.28,.02],children:[a.jsxs("mesh",{children:[a.jsx("sphereGeometry",{args:[10,96,48]}),a.jsx("meshStandardMaterial",{map:e,color:"#ffffff",emissive:"#081329",emissiveIntensity:.12,roughness:.88,metalness:.02})]}),a.jsxs("mesh",{scale:[1.012,1.012,1.012],children:[a.jsx("sphereGeometry",{args:[10.05,96,48]}),a.jsx("meshBasicMaterial",{color:"#74d8ff",transparent:!0,opacity:.13,blending:la,side:y3,depthWrite:!1})]})]})}function ibe({players:e}){return a.jsxs(a.Fragment,{children:[a.jsx("color",{attach:"background",args:["#01030b"]}),a.jsx("fog",{attach:"fog",args:["#03081b",18,48]}),a.jsx("hemisphereLight",{args:["#d9eeff","#11152b",2.4]}),a.jsx("ambientLight",{intensity:1.25,color:"#d8eaff"}),a.jsx("directionalLight",{position:[7,10,12],intensity:6.5,color:"#fff4dd"}),a.jsx("directionalLight",{position:[-9,4,6],intensity:4.2,color:"#72cfff"}),a.jsx("directionalLight",{position:[3,-2,-12],intensity:3.8,color:"#b178ff"}),a.jsx("pointLight",{position:[0,3,8],intensity:42,distance:32,decay:1.6,color:"#ffffff"}),a.jsx(rbe,{}),a.jsxs(l.Suspense,{fallback:null,children:[a.jsx(obe,{}),e.slice(0,ebe).map((t,r)=>a.jsx(abe,{player:t,index:r},t.id))]}),a.jsx(sbe,{})]})}const lbe=({players:e,skipEnabled:t,onComplete:r})=>{const n=l.useRef(!1),s=()=>{n.current||(n.current=!0,r())};return l.useEffect(()=>{const o=window.setTimeout(s,$ye);return()=>window.clearTimeout(o)},[]),a.jsxs("div",{className:"zentara-fleet-intro",onClick:t?s:void 0,role:"presentation",children:[a.jsx(gm,{camera:{position:[7.2,5.8,17],fov:38,near:.1,far:100},dpr:[1,1.5],gl:{antialias:!0,alpha:!1,powerPreference:"high-performance",toneMapping:Vy,toneMappingExposure:1.35},children:a.jsx(ibe,{players:e})}),a.jsx("div",{className:"zentara-fleet-intro__grade"}),a.jsx("div",{className:"zentara-fleet-intro__flare"}),a.jsxs("div",{className:"zentara-fleet-intro__copy",children:[a.jsx("div",{className:"zentara-fleet-intro__eyebrow",children:"The frontier is unclaimed"}),a.jsx("div",{className:"zentara-fleet-intro__title",children:"ZENTARA"}),a.jsx("div",{className:"zentara-fleet-intro__rule"}),a.jsx("div",{className:"zentara-fleet-intro__subtitle",children:"Conquer the galaxy. Command your empire."})]}),a.jsx("div",{className:"zentara-fleet-intro__status",children:t?"Tap to deploy":"Fleet approaching"})]})},cbe={asteroid:k1,nebula:S1},ube=({deck:e,text:t,amount:r,rollerName:n,rollerColor:s,onDismiss:o,autoDismissMs:i})=>{const c=e==="asteroid"?"Asteroid Event":"Nebula Intel",u=ot.useRef(o);return ot.useEffect(()=>{u.current=o},[o]),ot.useEffect(()=>{if(!i||i<=0)return;const p=window.setTimeout(()=>{var d;(d=u.current)==null||d.call(u)},i);return()=>window.clearTimeout(p)},[i]),a.jsx("div",{className:"zentara-card-backdrop",onClick:o,children:a.jsxs("div",{className:"zentara-card","data-deck":e,onClick:p=>p.stopPropagation(),children:[a.jsx("div",{className:"zentara-card-art-wrap",children:a.jsx("img",{className:"zentara-card-art",src:cbe[e],alt:c})}),a.jsx("div",{className:"zentara-card-title",children:c}),a.jsxs("div",{className:"zentara-card-roller",children:[a.jsx("span",{className:"zentara-card-roller-dot",style:{background:s}}),a.jsx("span",{className:"zentara-card-roller-name",children:n})]}),a.jsx("div",{className:"zentara-card-divider"}),a.jsx("div",{className:"zentara-card-text",children:t}),r!==0&&a.jsxs("div",{className:`zentara-card-amount ${r>=0?"positive":"negative"}`,children:[r>=0?"+":"",r," energy"]}),a.jsx("button",{className:"zentara-card-dismiss",onClick:o,children:"Dismiss ✕"})]})})},tz=""+new URL("mission-briefing-BujJMjA8.webp",import.meta.url).href,dbe=({factionName:e,factionColor:t,group:r,groupColor:n,cost:s,onConfirm:o,onCancel:i,autoDismissMs:c})=>{const u=ot.useRef(i);ot.useEffect(()=>{u.current=i},[i]),ot.useEffect(()=>{if(!c||c<=0)return;const f=window.setTimeout(()=>u.current(),c);return()=>window.clearTimeout(f)},[c]);const p=r.toUpperCase(),d=s>=1e3?"MONOPOLY INFILTRATION":"FOOTHOLD INFILTRATION";return a.jsx("div",{className:"zentara-spy-deploy-backdrop",children:a.jsxs("section",{className:"zentara-spy-deploy-card",style:{"--spy-faction":t,"--spy-group":n},role:"dialog","aria-modal":"true","aria-labelledby":"zentara-spy-deploy-title",children:[a.jsxs("div",{className:"zentara-spy-deploy-art",children:[a.jsx("img",{src:tz,alt:""}),a.jsx("div",{className:"zentara-spy-deploy-classified",children:"CLASSIFIED // SPY STRIKE"})]}),a.jsx("button",{type:"button",className:"zentara-spy-deploy-cancel",onClick:i,"aria-label":"Cancel spy deployment",children:"Cancel"}),a.jsxs("div",{className:"zentara-spy-deploy-body",children:[a.jsx("div",{className:"zentara-spy-deploy-kicker",children:d}),a.jsx("h2",{id:"zentara-spy-deploy-title",children:"Deploy Covert Asset?"}),a.jsxs("p",{className:"zentara-spy-deploy-lore",children:[e," intelligence is prepared to embed a sleeper cell inside the"," ",a.jsxs("strong",{children:[p," sector"]}),". Once deployed, the operative will remain hidden, feeding false coordinates and waiting for your fleet to return."]}),a.jsxs("div",{className:"zentara-spy-deploy-sequence",children:[a.jsxs("div",{children:[a.jsx("span",{children:"Trigger"}),"Your fleet next lands on any ",p," planet."]}),a.jsxs("div",{children:[a.jsx("span",{children:"Phase A"}),"Soldier Strike: breach the ground defenses."]}),a.jsxs("div",{children:[a.jsx("span",{children:"Phase B"}),"Sniper: eliminate the defending hero."]})]}),a.jsxs("div",{className:"zentara-spy-deploy-outcome success",children:[a.jsx("strong",{children:"Mission success"}),"Vanquish the defender's hero and seize the entire ",p," group."]}),a.jsxs("div",{className:"zentara-spy-deploy-outcome failure",children:[a.jsx("strong",{children:"Mission failure"}),"The spy is exposed. Lose ",PO.toLocaleString()," energy against a partial holding or ",EO.toLocaleString()," against a full monopoly, then face normal rent and any hero clash."]}),a.jsxs("p",{className:"zentara-spy-deploy-footnote",children:["Confirm to spend ",s.toLocaleString()," energy and deploy the asset. A change in control may invalidate the mission before activation."]}),a.jsx("button",{type:"button",onClick:o,children:"Acknowledge & Deploy"})]})]})})},rz=17e3,nz=700,az=2500,Gw=3,sz=5,o2=30,i2=8,pbe=.12;function fbe(){return Math.floor((rz-az)/nz)}function mbe(e=Math.random){const t=fbe();let r=0;for(let n=0;n<t;n+=1)r+=Gw+Math.floor(e()*(sz-Gw+1));return Math.max(1,r)}function Oy(e,t,r,n){const s=Math.max(1,Math.floor(t)),o=Math.max(0,Math.min(s,Math.floor(e))),i=s-o,c=Math.ceil(s*pbe),u=Math.max(0,c+n.weaponLevel-r.weaponLevel),p=o>=u,d=o+r.weaponLevel,f=i+n.weaponLevel,m=p?Math.min(o2+o*i2,n.credits):Math.min(o2+Math.floor(o*i2*.5),r.credits);return{attackerRoll:o,defenderRoll:i,attackerTotal:d,defenderTotal:f,winnerId:p?r.id:n.id,creditsStolen:Math.max(0,m),finalHits:o,totalSpawned:s}}const hbe=""+new URL("fps_soundtrack-DPaQcdtT.m4a",import.meta.url).href,Hd=""+new URL("zentara_bg_planet-D7XktRqs.webp",import.meta.url).href,gbe=""+new URL("bogies_intro-CcVJ01Lv.webp",import.meta.url).href,ybe=""+new URL("raid_torpedo-uTmsDgFP.webp",import.meta.url).href,bbe=""+new URL("enemy_crimson_bank2-BT7rb74W.webp",import.meta.url).href,vbe=""+new URL("enemy_crimson_bank4-BCMi3o3A.webp",import.meta.url).href,_be=""+new URL("enemy_crimson_bank6-CXlmAW_2.webp",import.meta.url).href,wbe=""+new URL("enemy_silver_bank2-DvdISIck.webp",import.meta.url).href,xbe=""+new URL("enemy_silver_bank4-C8sYDjrv.webp",import.meta.url).href,Abe=""+new URL("enemy_silver_bank6-LEedzbJQ.webp",import.meta.url).href,kbe=""+new URL("enemy_azure_bank2-CB0VkvKZ.webp",import.meta.url).href,Sbe=""+new URL("enemy_azure_bank4-Bz4T-snu.webp",import.meta.url).href,Ebe=""+new URL("enemy_azure_bank6-Covwy4o4.webp",import.meta.url).href,Pbe=""+new URL("enemy_golden_bank2-D0C8kMEZ.webp",import.meta.url).href,Cbe=""+new URL("enemy_golden_bank4-Dc5WWR8O.webp",import.meta.url).href,Rbe=""+new URL("enemy_golden_bank6-LOlFOFuT.webp",import.meta.url).href,Tbe=""+new URL("enemy_emerald_bank2-5IgU95Qn.webp",import.meta.url).href,jbe=""+new URL("enemy_emerald_bank4-BG8NH3Zr.webp",import.meta.url).href,Ibe=""+new URL("enemy_emerald_bank6-C0p50Ap6.webp",import.meta.url).href,Nbe=""+new URL("enemy_void_bank2-BOmN2a0s.webp",import.meta.url).href,Mbe=""+new URL("enemy_void_bank4-dsAjcFRS.webp",import.meta.url).href,Lbe=""+new URL("enemy_void_bank6-D3jYjyIh.webp",import.meta.url).href,Dbe="data:image/webp;base64, ",Obe="data:image/webp;base64, ",zbe="data:image/webp;base64, ",Bbe="data:image/webp;base64, ",Fbe="data:image/webp;base64, ",Ube="data:image/webp;base64, ",qbe="data:image/webp;base64, ",Vbe="data:image/webp;base64, ",Hbe="data:image/webp;base64, ",Wbe="data:image/webp;base64, ",Gbe="data:image/webp;base64, ",Xbe="data:image/webp;base64, ",Ybe="data:image/webp;base64, ",Zbe="data:image/webp;base64, ",Kbe="data:image/webp;base64, ",Qbe="data:image/webp;base64, ",Jbe="data:image/webp;base64, ",$be="data:image/webp;base64, ",eve="data:image/webp;base64, ",tve="data:image/webp;base64, ",rve="data:image/webp;base64, ",nve="data:image/webp;base64, ",ave="data:image/webp;base64, ",sve="data:image/webp;base64,UklGRqAJAABXRUJQVlA4WAoAAAAQAAAA/wEA/wAAQUxQSFwCAAABoFtbmyRJ+Q35DUnxM6SN+XwZFRn1syPYIdkJdoiD9gmZlZWbUMEWETEBMfw//D/8P/w//D/8P/w//D/8P/w//D/8P/z/z0GQlCTbkkh0NdLL1upqa63ZltDFQNmqdS5PznNrtoXeRdvv13dl57nZFnoWbddy6Nxso1vRdi17zvP8qJRqG52Kdi1b57nW2ppX2/yoVNtdirbfK+sffvLNT356Q6k2OxTsVtY/+eSL77xjm+d5gzqU7Hntky+++9W7t3kupdjuT7JrWa1/+eDWqq3uBLuVUkr1WU+TOWVkZi+p1ecVjsnMjMzMeJ6UhB5Bu/nk3CFzysycMmN/eNkrzq8HmZmRmW8gVuNQSWR0SF7Cysgp30AAIBD9lr6sAMQVAXQF+MpCnBYgScnr7Am6lC0cA5CUvFUiEV0Rvjz3AEjJT0okokfqeuYDgKTkp0US0TF9hyIl7yiSiE6ZU2ZkRgRu4XmRRPTIzCkjc3oDCYJEBO9FJBHdMXPKzJzyDQQAArFVNyGSiM6YOWVkThmrAGLfm9CSq3j1ZeRyyoyT0rf78js9fIuMAAAC0V3hW1T0WICk5Nt88ZHEaQCSku/3pQcvcQxAUvItkwTitc8FY1eQpOT9JXF5JSK6IBDbQVLyzpJIEhRioy5DRFcESMo7SiJJALFOLzcFr8HohiApPymRJIB4nvSS8RAkqQsQ0Qspr0skCSCOlW2LjHX6kiSiJ2IZ5wUQmx9JJKETiER0ZZIEYiNAaSeRRPRyAOBWADH8P/w//D/8P/w//D/8P/w//D/8P/w//D/8PwwOVlA4IB4HAACwOwCdASoAAgABPhkMhUIhBCpnCgQAYS0t34+TPJeSIML3d6z6G+aL6Y+f1so7/K4I7/EPwz8F/8J4d+M33L7Ocj75nvf+EuHf8l+LV0LwdPqH+etnGNH/nepD/rfcd7hvor/nf474Cf5j/Tf9L+ZHey9Fz9ZAgmQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXPECgyC54gUGQXOba3bxfLvBBOyE8cuL8hdzfiszMXsgnmZi9j1VOqDLpldbq2gRc3/+1G/Yi3TG4L0NitG0BxAaOR90sOqeWZwNZfjt/2iy2elH/j4QIkquwxiZi9kE8zMXoU+6ihSBYtTW86IEyELLkAVSds3etdaVBisP9Cklz/f3lWmAs5v+QVM+NCFYlJUCnXD4jpSOzC+3OTWz5J6ulXbXw9p4rMzF7IJ5l0lkF4DAYDXspPQinbl+P+8NT7AGVxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAoMgueIFBkFzxAn/AAA/v/9IsAAAAAAAAAAGF/UGcrjeGUmznfjVi4pLO5GYPXYffy/9sXaAfxoLlqP/DP2O19R2Z//Fuc6RbZ0/5sZ95OZ/ZOuq/8oYhs+79YD8ijjHyBFSEMuwWs9jLbDZA2HzoMGu9nzRt1p0teCML/ExGRpo8eYqGPr/wPhSkttcZcx4Q1YWZbTh9smK2uetAmjOhRA/+1/X+fb3iKlaTNUUbcQ2/4YS+JZ3qoxCJIDE/koKgKpEofw+qI3Lv00uK87peZJmcpTHUa8RX9ZpS1b1f/mLMdVjASsT7jbtXSa4hnMsS/u4vzVr/NBj1guF1lT+vKcvU5nmjoEIOkgGa2cXyFC/9RLeUHTeJCzC2+Kyxw1/AY2WvRKbuUaYicwdwVKLRxl+Iz3tX01+P0Df/WmKjuEwIDCdNOkOsjTyP2zhj9hBjn4VSsYpFonAGhT8q2qO1WEd6vdAnxHbZDVs8bcUerVIbNdIJrWM8KoDF1bBmkN2Ymh2xcQX8cEoOub/5KAy9HFzIAXeCy7vaqVuZk0LRGgcmkzUlnFwTk2gNBf6OuptbWUsu1S+QLvu7DGAMYtJL1CmFxnDSCmwMqoEFqQvf08+uxa3FhhQOSeCWxw9J1RiHXUZXA/9Xp731GTIHewvVupKLUbzhHcGNwvZNvZ6fXMwis6rv8akHvr6gkSoe03EVehYb5hQCkNXR5YL3Co9RjAtxH2Xu99o4Y6d9O0OhvUb092VvXlvBndEZd4QrY4u/aqowW0E+Lr6ML2xli/5p1i6CtGuXJjUb01Asuv8zbYzmofjL7VGK6XNnmGJIXxSN1mkuy6bZFiPJjiAax5xNR9IlU7Gzn2sPxaDWrbSISDlsl3q0vmnHjN4IlHtaqdPUODMfzBXhx4ZIhdaMPiMWSas4EA+rQwRbvn+YGco47wyuKt89NV5+GU3G5AgDVbTszkMYaMyrlzwjD+nZQd2bQ441w958PaDY41j80CJVeDAUfKuTG5Crfa1XnmSAwGeUDzQaNm80VfD/AAOA08j94+/4yMfFkBVewyULxcFuDI7i1aMfjphEW9b8NGUgVsoYid25r9KfesZckwXkCIJqUSJbFcjatoXYslShtuVya+Y2TEEqSi0tIusXtc78sj/LIFqhqSHaYOSkFB3hhez36dufCD+anWY5/TFu+Gp3bHJ9uztPeXlbVmON/e610l0RCDB+0JS6mG1SzYE5VfmXvDmJUtGpnx4lTT80DLY7SSftbvfeEQN8h0bgSCeRWmNwQ63Ru65Jc/qgnGoA6UVwlkpnVdrF9Wepn+mU9PtBNSTljx1SuOMiaFrLjxMX7FFQWPRs591dwc0dsKqYaPd9go0wj5grePAs4PKPR3Y+wlBywBejOV7zu4NQR0K01wC3KyySxGrVUSbODazCiVYrU0TKR1Mwm01rsr3MV13x+VQIP9JlAGhIyhr2BFnMVeJLPSlmmsfOxENcyh7eFNtJB/Z5xUlDClU1C33J9x6ZC1nZgR4tsvla5Z04H/dU5AOcLpdM/xs7mbcIhNz4VQsVOsE8J+Z9+x6DXuar5prZmTeXOUaNIv0IiNr3k5npFl/0VWfnm4Z++suiOuQI/dtrCUjon9yysyTb412pUswX8CrKpj/Vj8+iWHATJGsQnfXef7wclVLWxvomxpIx1SSPxX5qO7Lz9KnBpeIAAACIA/w87H5xkfFgowNAGpym+NJXYEiM+0gPIdLKB+QmhTJoaA0IR0y2DtiIGdP6gcK9iaQzgWhoQgpwLg0BnaBZXnoDOhAAAA",ove="data:image/webp;base64, ",ive="data:image/webp;base64, ",lve=""+new URL("enemy_azure_headon_bank5-i9H_e-T1.webp",import.meta.url).href,cve=""+new URL("enemy_golden_headon_bank3-BAwmOiOE.webp",import.meta.url).href,uve="data:image/webp;base64, ",dve="data:image/webp;base64, ",pve="data:image/webp;base64, ",fve="data:image/webp;base64, ",mve="data:image/webp;base64,UklGRv4KAABXRUJQVlA4WAoAAAAQAAAA/wEA/wAAQUxQSFECAAABBrqRbTuSnGdKmXJNGVPKl1UhQ312LCfgQIEDFdCeUNXVRVqYD/bviYgJcPd/93/3f/d/93/3f/d/93/3f/d/93/3f/f/Pwc1QtouO21QU4NazkyrAGWn1cQ0Zjknf/HyTpgpO9W6xrI/n1683PmLuexUyxrLnl4e+sVctprVWPb0cs8v4JY9la1GNZanl1u/YLJnapUvbnkqu0mNZX/2cv31u29+qrs3eCqPDUrl+eX6Oz59VzvOX8CGbFBZZu3dp+9+rd3nL3hpl92esjy9XJ3+qoNnpnI2J5V5aXuqs55mQATQSibXeVPHDIABfP9I2moRlGeffNxhQACG2F+1bBXnzxsDYOBJo1fj0LQhGiSXcA6BeNJo29jRbqnLpuy4ouymoLpyKk4rA6RrnZaQl7JTx8hAuramQdEUVZdnDxnSdWcaFC0yr2duyEC67k5A0TDrESbYtWMCikY5CAJs6yHcnyMoWuSACNCTRozBYR5LAormOCAA86TRtrFjaz6IBBSNcUAEiFiVHfs+iFyOq3ruG8xSECcd6+E++51e9RAJyzZ2NFfVQ8xosTKQrof5zAfoNDKQrsf7rKda6hgZSNdDBuR43mdB7CqAdO2fNssroWiCcmwXkK6d0wYQqdiYl0HRFGUga8e0AWTHOrXcZK5BNEMBWXemAWTH/VBL4qYA8gIoWiFZ62kA2XFslu2EWKcuCYqWqGWcV3ZsvpUGlCdIUDRlADk2yqR3SkDRymWbrbaj+7/7v/u/+7/7v/u/+7/7v/u/+7/7v/u/+78bHABWUDgghggAAFBAAJ0BKgACAAE+GQyFQiEEFrsNBABhLS3fj5M5HXuKcypzv39eu30Lpp8/0HeJj/afVX6Ov5N/tfUB/GP7H/yvbs9G/oAf07+wdYZ6AHlqftP8H/7d/ux7Qv/5ziL+d/g1+nPkz/XvC/xm+7vaqrHeG+SP+8ea7EvXK/Qv9J+ZFyXxc+gl/r+ZL6M/5PuDfy7+o/6r+0/uX3tPRr/XIGldTwBMYhdO6ngCYxC6d1PAExiF07qeAJjELp3U8ATGIXTup4AmMQundTwBMYhdO6ngCYxC6d1PAExiF07qeAJjELp3U8ATGIXTup4AmMQundTwBMYhdO6ngCXjlodCMHVA0aLiSYApRoH1QundTwBMYhdO6nf/9YU4VpeNy1TBhxfRZJpzdWsIGgkz0yqFs/0gKHLOBskV0kx1ovi3fzzuJNTqdSXMn0KLIRNUkFzieXiF07pyE4CEqe7MWqODSAT3SCfpV7ZrROU8FC8kLCCnXUYDjAfC20ZhnhXKBhfZHxcMaTep7gZnAAWKgY+JcuN5qWOMQc31PAExiF06Rpnq0y1YFXLmZLvtN23bdryvqnLxC6d1PAExiF07qeAJjELp3U8ATGIXTup4AmMQundTwBMYhdO6ngCYxC6d1PAExiF07qeAJjELp3U8ATGIXTup4AmMQundTwBMYhdO6ngCYxC6d1PAExiF0qAA/v/6RYAAAAAAAhPU2769DQbeVPfZ2YBeyGLpm0RitdpFKxg+a/ifUpeY/mX/GFvwOjksTomBitASHtU7Rve7HnqV7FDJtTz4eD/+7YDbTUb87igTvXge8k+H1ngbEG8FMqG0jQWVJiZrmioAeDtl1L/zoX50pHVfm1eU3y8j+cXkSEJo1P/NDR+8HE15P15G/OVwsfcZj7GUsX3M3/pZnrYv5P9gv/2coOpr0BqRh8AOx8pkjcV1SIphig+HQRxlGj83RUhtJgt0eSi/7aCf//tLigp8s4liwNoxpFnzMS+ZQa/nEYgw6nEBmKAc+6jlcM9Tr7fyX/+LVF8hsv8IBKIzFt1h9QKhdSmYiervI42NtCGbI/WvfVUSZrufK075uqSvXoq/dLG+xrbsP/aKFmZv6XlVTQo/9qbVLHpOEjv2ZgyWVH5Ob7DBjtM/8EkguOs1iejZ9+bDoJ0H/v8oP/rTK936rIwAB0psSodjw/9yCM/2Mf+TJXqjXipJwRylF0uE7h2hWbpVJifdqHlL3c1Ov4+IFXx4wSrFsqQbHigBmAtDfsblTP7m6nMVXPjUhfQG+YnZaUUqK2A2V1LHyesY4dFieONIHT40RZtBfempR3snglzZB8GrNcovq5DDtWjOMwEZWoawU87yEflruo3Cluw/8VTk5axX4YWNdUup3tvlQN4HpAfAmdxSVVS41FIrCqnMEBdn0l/Tylw63hOzhdhzEofuz3s2nh6rfxRRnjOIF/JQvgQ1mpqQTBiio1pjZy3Jnw64TCWOtE94D9sz3HiCtIu6AZJTT8inBJZpLr5Pmn6GpcmSZ9I87/U+Qy28wvj5Qsg6gTRIeRQmyuPPJmqnPIcaSI0xhN9m1E/rvbFVilBwPLB/diXFQDMtuJrBFvQj2xQ3BVL8Owlxj2rHS5AuG8R9ys7XlOf6t1O6MnXNA9z1V9oyhcNnOn8j1bxiHqd797l/aklaWBB3Ypspa5jCZKNw+S6WbeOslByOG8Q5suaFwT+DmMp6Y8Yscc6bJzf6p5pjaW8xvJBWJtBoJ+gK2YBcU9QttRteIA2B40OneH9876p/dHYN71+lXqoy29aKfn6cxcPDfEPzRCn4gILbq5hP20bgZZKw4RBf/wYf+rKQzaaJiPXrenkf2gn5UAyvjkS+2iC+HYbqZ4xmazIMAtcmEnPIH74cdmj/TXBBWHbKXU4sgVdm9S6r44GEx63ShIzKiAkdAnR0Z5hPX+/f2OmuXtxEhpa47vW9DxFaeulEuf0MQheawJmzwwO3g/iSRrus3LjcIIARQFiofZu+uI/xKRoOAk3jbKsDHpD+ja0zx1SP+0PSIRJbLOpXwBnZsbESpchmUmJqSZ4uy37VirH2t39tzXPf/G5ntCMYAY0+OXccu/YWCtkR/pI3z2mWmhyVKbT+mxGBMTfVb9dshq0NNBZWBS7yiKKTdzr/NYLt/iBs3ArsCQm2T1DAvE0+XqaR3m4/Ijd7gKWt6ytn1TefVaJHGDMymIjEeKXxfvHBga2DpL5OOoTPtVFK9S6tHQ2p+CuoyfXaL2bqlF8Y/aA0S74afP445e2NEuRlpB59nDHwNQWL6pba8RukJMPw3qWquifzie+eIg+9/zpHTzpDgL7gXoBgNWUtNcxY+jh9Rmx59M+c7C8Jo/4nXXhsBsqo6C7vO4FFNzBR++ehrnbom/UFnEsKRlknDau/Id+sKU2qxxojQCL2QXoXwLCj7ewINp0l1H4nnr7KCkd96SOK94eJiURjhSrBr4Jbb2AqnvchxwWk6aQpulcjTqBmafnHWkYGZYOdECS5LHu2E+HddPWeHGDEkdNd7epCuHDFPKPxHCuUrqOohvgPXIuvH6QbOvXgjunCCLq9btveqQzEZs1Ohh8yx0sXy22BQ32PywaapsYjDsqI4twfJhpYkgUI+2FdhEPzJBdcqudKtFKWZftc1WQA7AV8tvPqHpliYrhzI5K1J9/9WNyFvvViv3cTz7qHS2pNCrf1psoe1TTamt9doEUT+xaLkkk3m3tb/FQoWskDUdg8KEf19SX3exZ6TE1/+7sjNfwOjBU/VLR2659ZfPHj2bYvulTnANSvTMdD83evUZUmuCy1spVYRTawAACjUZTavPfQVFJdTW2yH+wdrZbKVyr/4z7VlxGyNv41g5IB6AsPJ7Ist1vN3OAar/B8+EhAGqQAAAAAAAAAAAA=",hve="data:image/webp;base64, ",gve="data:image/webp;base64, ",yve=""+new URL("enemy_void_headon_bank5-uqlOncyY.webp",import.meta.url).href,bve=""+new URL("cockpit_red-D9Z7CCYz.webp",import.meta.url).href,vve=""+new URL("cockpit_silver-CYcc-KqK.webp",import.meta.url).href,_ve=""+new URL("cockpit_blue-JbBctwkd.webp",import.meta.url).href,wve=""+new URL("cockpit_gold-OYjriaOU.webp",import.meta.url).href,xve=""+new URL("cockpit_green-Bh4QHBHC.webp",import.meta.url).href,Ave=""+new URL("cockpit_black-DplLg93u.webp",import.meta.url).href,kve=""+new URL("cockpit_legacy_crimson_turret_1-DrDnrMz8.png",import.meta.url).href,Sve=""+new URL("cockpit_legacy_crimson_turret_2-VkMAD65W.png",import.meta.url).href,Eve=""+new URL("cockpit_legacy_crimson_turret_3-BW1HBR1o.png",import.meta.url).href,Pve=""+new URL("cockpit_legacy_crimson_turret_4-BRDgMiwJ.png",import.meta.url).href,Cve=""+new URL("cockpit_legacy_crimson_turret_5-BAf9UZqT.png",import.meta.url).href,Rve=""+new URL("cockpit_legacy_crimson_turret_6-Bdt8rLXS.png",import.meta.url).href,Tve=""+new URL("cockpit_legacy_silver_turret_1-DSOfodaj.png",import.meta.url).href,jve=""+new URL("cockpit_legacy_silver_turret_2-tAnK_626.png",import.meta.url).href,Ive=""+new URL("cockpit_legacy_silver_turret_3-BMtF9R9P.png",import.meta.url).href,Nve=""+new URL("cockpit_legacy_silver_turret_4-pPzY36b0.png",import.meta.url).href,Mve=""+new URL("cockpit_legacy_silver_turret_5-C8OJNHF7.png",import.meta.url).href,Lve=""+new URL("cockpit_legacy_silver_turret_6-CyE7D_WC.png",import.meta.url).href,Dve=""+new URL("cockpit_legacy_gold_turret_1-AxxZC0ic.png",import.meta.url).href,Ove=""+new URL("cockpit_legacy_gold_turret_2-BZsPbqyX.png",import.meta.url).href,zve=""+new URL("cockpit_legacy_gold_turret_3-CbpKpXzT.png",import.meta.url).href,Bve=""+new URL("cockpit_legacy_gold_turret_4-B2JEPHJw.png",import.meta.url).href,Fve=""+new URL("cockpit_legacy_gold_turret_5-B8Secc75.png",import.meta.url).href,Uve=""+new URL("cockpit_legacy_gold_turret_6-Cv44-Nbd.png",import.meta.url).href,qve=""+new URL("cockpit_legacy_azzure_turret_1-KU89WC9_.png",import.meta.url).href,Vve=""+new URL("cockpit_legacy_azzure_turret_2-CC7hQ0xE.png",import.meta.url).href,Hve=""+new URL("cockpit_legacy_azzure_turret_3-Bjzduy1w.png",import.meta.url).href,Wve=""+new URL("cockpit_legacy_azzure_turret_4-BcUI99jC.png",import.meta.url).href,Gve=""+new URL("cockpit_legacy_azzure_turret_5-Cv2ra0mr.png",import.meta.url).href,Xve=""+new URL("cockpit_legacy_azzure_turret_6-CiNSaI5P.png",import.meta.url).href,Yve=""+new URL("cockpit_legacy_void_turret_1-DhGgm8Nz.png",import.meta.url).href,Zve=""+new URL("cockpit_legacy_void_turret_2-DCCuuayW.png",import.meta.url).href,Kve=""+new URL("cockpit_legacy_void_turret_3-CX2YTDou.png",import.meta.url).href,Qve=""+new URL("cockpit_legacy_void_turret_4-D_mbGRwe.png",import.meta.url).href,Jve=""+new URL("cockpit_legacy_void_turret_5-Bktw9bbQ.png",import.meta.url).href,$ve=""+new URL("cockpit_legacy_void_turret_6-B_CLoEvm.png",import.meta.url).href,e_e=""+new URL("cockpit_legacy_emerald_turret_1-BqJwnLMP.png",import.meta.url).href,t_e=""+new URL("cockpit_legacy_emerald_turret_2-CpcpGDUL.png",import.meta.url).href,r_e=""+new URL("cockpit_legacy_emerald_turret_3-DgrTzw2E.png",import.meta.url).href,n_e=""+new URL("cockpit_legacy_emerald_turret_4-ChFGDzar.png",import.meta.url).href,a_e=""+new URL("cockpit_legacy_emerald_turret_5-CQQYvOlj.png",import.meta.url).href,s_e=""+new URL("cockpit_legacy_emerald_turret_6-BA7NzSGw.png",import.meta.url).href,o_e=""+new URL("battleship_crimson-BP8YBbHm.webp",import.meta.url).href,i_e=""+new URL("battleship_silver-Bny1kROS.webp",import.meta.url).href,l_e=""+new URL("battleship_azure-Bq1rJGy2.webp",import.meta.url).href,c_e=""+new URL("battleship_golden-Aq15Jmcg.webp",import.meta.url).href,u_e=""+new URL("battleship_emerald-CE5hNTxV.webp",import.meta.url).href,d_e=""+new URL("battleship_void-y7zwWNtK.webp",import.meta.url).href,oz=hbe,p_e=gbe,Zl=e=>{if(typeof Image>"u")return null;const t=new Image;return t.src=e,t},f_e={"crimson-dominion":[bbe,vbe,_be],"silver-pact":[wbe,xbe,Abe],"azure-sovereignty":[kbe,Sbe,Ebe],"golden-imperium":[Pbe,Cbe,Rbe],"emerald-collective":[Tbe,jbe,Ibe],"void-enclave":[Nbe,Mbe,Lbe]},m_e={"crimson-dominion":[Dbe,Obe,zbe],"silver-pact":[Bbe,Fbe,Ube],"azure-sovereignty":[qbe,Vbe,Hbe],"golden-imperium":[Wbe,Gbe,Xbe],"emerald-collective":[Ybe,Zbe,Kbe],"void-enclave":[Qbe,Jbe,$be]},h_e={"crimson-dominion":[eve,tve,rve],"silver-pact":[nve,ave,sve],"azure-sovereignty":[ove,ive,lve],"golden-imperium":[cve,uve,dve],"emerald-collective":[pve,fve,mve],"void-enclave":[hve,gve,yve]},g_e={"crimson-dominion":bve,"silver-pact":vve,"azure-sovereignty":_ve,"golden-imperium":wve,"emerald-collective":xve,"void-enclave":Ave},iz={"crimson-dominion":"#ff1744","silver-pact":"#b0bec5","azure-sovereignty":"#448aff","golden-imperium":"#ffc400","emerald-collective":"#69f0ae","void-enclave":"#d500f9"},ii=Zl(E1),Kp=Zl(ybe),y_e=Zl(Hd),lz={};for(const[e,t]of Object.entries(g_e)){const r=Zl(t);r&&(lz[e]=r)}const b_e={"crimson-dominion":[kve,Sve,Eve,Pve,Cve,Rve],"silver-pact":[Tve,jve,Ive,Nve,Mve,Lve],"azure-sovereignty":[qve,Vve,Hve,Wve,Gve,Xve],"golden-imperium":[Dve,Ove,zve,Bve,Fve,Uve],"emerald-collective":[e_e,t_e,r_e,n_e,a_e,s_e],"void-enclave":[Yve,Zve,Kve,Qve,Jve,$ve]},R1={};for(const[e,t]of Object.entries(b_e))R1[e]=t.map(r=>Zl(r));const v_e=R1["crimson-dominion"],__e={"crimson-dominion":o_e,"silver-pact":i_e,"azure-sovereignty":l_e,"golden-imperium":c_e,"emerald-collective":u_e,"void-enclave":d_e},cz={};for(const[e,t]of Object.entries(__e))cz[e]=Zl(t);const w_e=()=>{try{return zr.getPlatform()}catch{return"web"}},zy=w_e(),uz=zy==="android",T1=zy==="ios",$s=zy==="ios"||zy==="android",x_e=T1?1:$s?1.25:2,l2=T1?22:$s?16:0,A_e=()=>{var e;if(typeof window>"u"||typeof navigator>"u")return!1;try{if(navigator.maxTouchPoints>0||(e=window.matchMedia)!=null&&e.call(window,"(pointer: coarse)").matches)return!0}catch{}return!1},k_e=()=>{var e,t;if(typeof window>"u")return!1;try{return!!((e=window.matchMedia)!=null&&e.call(window,"(pointer: fine)").matches||(t=window.matchMedia)!=null&&t.call(window,"(hover: hover)").matches)}catch{return!1}},S_e=A_e(),E_e=k_e(),c2=!$s||E_e||!S_e;function td(e,t){let r=0;for(let n=0;n<e.length;n+=1){const s=e[n];t(s)&&(e[r]=s,r+=1)}e.length=r}const rd=128,Bc=48;let k_=null,Wh=null,S_=null;function P_e(){if(k_)return k_;const e=document.createElement("canvas");e.width=rd,e.height=rd;const t=e.getContext("2d"),r=rd/2,n=t.createRadialGradient(r,r,0,r,r,r);n.addColorStop(0,"rgba(255,180,60,0.3)"),n.addColorStop(.5,"rgba(255,100,20,0.15)"),n.addColorStop(1,"rgba(255,40,0,0)"),t.fillStyle=n,t.fillRect(0,0,rd,rd);const s=rd*.2,o=t.createRadialGradient(r,r,0,r,r,s);return o.addColorStop(0,"rgba(255,255,220,0.7)"),o.addColorStop(.5,"rgba(255,200,80,0.4)"),o.addColorStop(1,"rgba(255,120,20,0)"),t.fillStyle=o,t.beginPath(),t.arc(r,r,s,0,Math.PI*2),t.fill(),k_=e,e}function C_e(){if(Wh)return Wh;const e=(t,r)=>{const n=document.createElement("canvas");n.width=Bc,n.height=Bc;const s=n.getContext("2d"),o=Bc/2,i=Bc/2,c=s.createRadialGradient(o,o,0,o,o,i);return c.addColorStop(0,"#ffffff"),c.addColorStop(.4,r),c.addColorStop(1,t),s.fillStyle=c,s.beginPath(),s.arc(o,o,i,0,Math.PI*2),s.fill(),n};return Wh={hit:e("rgba(0,255,170,0)","#00ffaa"),miss:e("rgba(255,68,68,0)","#ff4444")},Wh}function R_e(){if(S_)return S_;const e=document.createElement("canvas");e.width=Bc,e.height=Bc;const t=e.getContext("2d"),r=Bc/2,n=t.createRadialGradient(r,r,0,r,r,r);return n.addColorStop(0,"#ffffff"),n.addColorStop(.35,"#aaffcc"),n.addColorStop(1,"rgba(0,255,102,0)"),t.fillStyle=n,t.beginPath(),t.arc(r,r,r,0,Math.PI*2),t.fill(),S_=e,e}const u2={};function T_e(e,t){const r=u2[e];if(r&&Math.abs(r.cachedR-t)<5)return r.canvas;const n=Math.ceil(t*2),s=document.createElement("canvas");s.width=n,s.height=n;const o=s.getContext("2d"),i=n/2,c=o.createRadialGradient(i,i,0,i,i,t);return c.addColorStop(0,`${iz[e]}44`),c.addColorStop(1,"transparent"),o.fillStyle=c,o.fillRect(0,0,n,n),u2[e]={canvas:s,cachedR:t},s}const dz=1,d2=.012,j_e=5.6,E_=e=>{const t=1-Math.max(e.z,0)/dz,r=t*t;return(d2+(j_e-d2)*r+(e.z<0?Math.abs(e.z)*3:0))*e.sizeScale},I_e=(e,t,r)=>{const n=t*.5,s=r*.5,o=e.x-n,i=e.y-s,c=1-Math.max(0,Math.min(1,e.z/dz)),u=Math.sign(e.visualVx),p=Math.sign(o),d=u!==0&&u===p?o*c*.025:0,f=e.visualVx+d,m=e.spriteIndex%3;let h=m;const b=90,g=30;m===1?f<-b?h=0:f>b&&(h=2):m===0?f>-g&&(h=1):f<g&&(h=1);const y=-i/(r*.5),x=-e.visualVy/280,A=y+x*.3>.05;return e.z<.34&&!A?h+6:A?h+3:h},N_e=e=>{const r=Math.max(-1,Math.min(1,e.visualVx/380)),n=Math.max(-1,Math.min(1,e.visualVy/520));return r*.26+n*.06};class pz{constructor(t){Wr(this,"audio",null);Wr(this,"fadeTimer",null);Wr(this,"volume");Wr(this,"fadeMs");Wr(this,"fadeSteps");Wr(this,"src");this.src=t.src,this.volume=t.volume??.1875,this.fadeMs=t.fadeMs??800,this.fadeSteps=t.fadeSteps??16}play(){if(this.audio)return;const t=new Audio(this.src);t.loop=!0,t.volume=this.volume,t.play().catch(()=>{}),this.audio=t}stop(){const t=this.audio;if(!t)return;this.clearFade();const r=this.fadeMs/this.fadeSteps,n=t.volume;let s=0;this.fadeTimer=window.setInterval(()=>{s+=1,t.volume=Math.max(0,n*(1-s/this.fadeSteps)),s>=this.fadeSteps&&(this.clearFade(),t.pause(),this.audio=null)},r)}dispose(){this.clearFade(),this.audio&&(this.audio.pause(),this.audio=null)}clearFade(){this.fadeTimer!==null&&(window.clearInterval(this.fadeTimer),this.fadeTimer=null)}}function M_e(e){const t=e.rng??Math.random,r=e.width,n=e.height,s=r/2,o=n/2,i=t(),c=i<.1?"bankout":i<.25?"attack":i<.75?"strafe":"weave",u=c==="bankout"?.05:c==="attack"?.7:c==="strafe"?1.2:.95,p=t()<.5?-1:1,d=t()<.7?-1:1,f=t(),m=f<.18?"vertical":f<.5?"horizontal":"lateral";let h=(.45+t()*.55)*u,b=(.45+t()*.6)*u*.85;m==="vertical"?(h*=.1+t()*.15,b=(.85+t()*.5)*u):m==="horizontal"&&(b*=.1+t()*.15,h=(.85+t()*.5)*u);let g=s+p*r*h,y=o+d*n*b;const x=Math.min(r,n)*(c==="bankout"?.22:m==="lateral"?.38:.24),v=g-s,A=y-o,_=Math.hypot(v,A);if(_<x){const I=_>.001?v/_:p,L=_>.001?A/_:-.4*d;g=s+I*x,y=o+L*x}let w,j;if(e.overrideZ!==void 0)w=r*(.08+t()*.84),j=n*(.08+t()*.64);else if(m==="horizontal"){const I=-p;w=s+I*r*(.55+t()*.25),j=o+(t()-.5)*n*.55}else{const I=r*e.battleshipAnchorX,L=n*e.battleshipAnchorY,N=Math.min(r,n)*.2,S=t()*Math.PI*2,F=t()*N;w=I+Math.cos(S)*F,j=L+Math.sin(S)*F*.75}const T=e.zSpeedMin+t()*(e.zSpeedMax-e.zSpeedMin),R=c==="strafe"?T*1.25:c==="bankout"?T*1.3:c==="attack"?T*.92:T,P=e.overrideZ??e.zFar,k=Math.max(.1,P/R),E=e.overrideZ!==void 0?.55:.35,M=(g-w)/k*E,C=(y-j)/k*E;return{id:e.allocId(),x:w,y:j,vx:M,vy:C,z:P,zSpeed:R,alive:!0,spawnTime:e.now,color:e.factionColor,pieceKey:e.faction,sizeScale:.7+t()*.7,wobblePhase:t()*Math.PI*2,wobbleAmp:c==="weave"?6+t()*6:2+t()*4,wobbleFreq:.8+t()*1.4,flybyPlayed:!1,prevY:j,visualVy:0,spriteIndex:1,prevSpriteIndex:1,spriteFadeStart:0,targetX:g,targetY:y,visualVx:M,bankVx:M,profile:c,weavePhase:t()*Math.PI*2,renderScale:0,renderCosR:0,renderSinR:0,spinRate:t()<.1?(t()<.5?-1:1)*(.9+t()*.6):0}}const p2=(e,t)=>{const r=Math.hypot(e,t);return r<.001?null:{x:e/r,y:t/r}},L_e=(e,t,r)=>{const n=Math.hypot(e.vx,e.vy);return n>=24?{x:e.vx/n,y:e.vy/n}:p2(e.targetX-e.x,e.targetY-e.y)??p2(e.targetX-t,e.targetY-r)??{x:0,y:-1}},D_e=(e,t,r,n,s,o)=>{const i=r-e,c=n-t,u=Math.hypot(i,c),p=Math.max(0,s*o);if(u<=p||u<.001)return{vx:r,vy:n};const d=p/u;return{vx:e+i*d,vy:t+c*d}},O_e=(e,t,r,n,s)=>{const o=e*r.x+t*r.y,i=e-r.x*o,c=t-r.y*o,u=Math.exp(-5*n*s),p=o+380*n*s;return{vx:r.x*p+i*u,vy:r.y*p+c*u}},By=1e3,fz=1800,mz=.8,z_e=uz?0:$s?24:50,B_e=$s?4:7,f2=["#4a148c","#0d47a1","#004d40","#b71c1c","#1a237e","#311b92","#01579b","#1b5e20"],F_e=$s?36:100,Fy=50,hz=160,gz=.75,U_e=$s?130:80,q_e=$s?900:500,yc=(e,t)=>e+Math.random()*(t-e);function V_e(){const e=Math.random()*Math.PI*2;return{angle:e,cosAngle:Math.cos(e),sinAngle:Math.sin(e),dist:Math.random()*.15,speed:By+Math.random()*(fz-By),brightness:.3+Math.random()*.7,length:.5+Math.random()*1.5}}function H_e(){return Array.from({length:z_e},()=>{const e=V_e();return e.dist=Math.random()*mz,e})}function W_e(){return Array.from({length:B_e},()=>({x:Math.random(),y:Math.random(),radius:.1+Math.random()*.18,color:f2[Math.floor(Math.random()*f2.length)],alpha:.04+Math.random()*.06,driftX:(Math.random()-.5)*.006,driftY:(Math.random()-.5)*.006}))}function G_e(){return Array.from({length:F_e},()=>({angle:Math.random()*Math.PI*2,dist:Math.random()*gz,speed:Fy+Math.random()*(hz-Fy),size:.4+Math.random()*1.2,alpha:.12+Math.random()*.3}))}const m2=$s?4:6,h2=400;function X_e(e,t){const r=[];for(let n=0;n<m2;n+=1){const s=Math.PI*2*n/m2+Math.random()*.5,o=80+Math.random()*120;r.push({x:e,y:t,vx:Math.cos(s)*o,vy:Math.sin(s)*o,life:h2,maxLife:h2})}return r}const Y_e=1,Uy={"crimson-dominion":{body:9047834,accent:16720440,emissive:5570568,metalness:.3,roughness:.7,flame:16724770},"silver-pact":{body:13161180,accent:6976640,emissive:2107440,metalness:.55,roughness:.55,flame:12571903},"azure-sovereignty":{body:1063562,accent:5154303,emissive:662602,metalness:.4,roughness:.65,flame:3386111},"golden-imperium":{body:12093466,accent:16766515,emissive:4861960,metalness:.6,roughness:.55,flame:16763972},"emerald-collective":{body:1006128,accent:5635994,emissive:665624,metalness:.3,roughness:.7,flame:6750122},"void-enclave":{body:1707818,accent:12796159,emissive:2754628,metalness:.45,roughness:.65,flame:12607743}},Z_e=.62,K_e=320,Q_e=.18,J_e=260,$_e=.55,g2=.18,e0e=.75;class t0e{constructor(){Wr(this,"renderer",null);Wr(this,"scene");Wr(this,"camera");Wr(this,"ambient");Wr(this,"keyLight");Wr(this,"rimLight");Wr(this,"shipTemplate",null);Wr(this,"shipPool",[]);Wr(this,"shipMeshById",new Map);Wr(this,"freeShipMeshes",[]);Wr(this,"modelReady",!1);Wr(this,"modelPromise",null);Wr(this,"widthCss",0);Wr(this,"heightCss",0);Wr(this,"mountedCanvas",null);Wr(this,"shipMaterials",[]);Wr(this,"thrusterGlowMat",null);Wr(this,"cockpitMat",null);Wr(this,"currentScheme",Uy["crimson-dominion"]);Wr(this,"currentFaction","crimson-dominion");Wr(this,"contextLost",!1);Wr(this,"onContextLost",null);Wr(this,"onContextRestored",null);Wr(this,"_loggedFirstRender",!1);this.scene=new b3,this.camera=new v3(-1,1,1,-1,.1,2e3),this.camera.position.set(0,0,500),this.camera.lookAt(0,0,0),this.ambient=new _3(6977704,.32),this.keyLight=new Wb(16773588,1.95),this.keyLight.position.set(2,4,6),this.rimLight=new Wb(7129343,1.05),this.rimLight.position.set(-3,-1,-2);const t=new Wb(16751962,.45);t.position.set(0,-5,2);const r=new w3(6983360,1053208,.65);this.scene.add(this.ambient,this.keyLight,this.rimLight,t,r),this.scene.fog=new x3(329485,500.55,501.05)}mount(t,r){return this.mountedCanvas===t&&this.renderer?this.modelPromise??Promise.resolve():(this.renderer&&this.renderer.dispose(),this.renderer=new A3({canvas:t,alpha:!0,antialias:!0,premultipliedAlpha:!0,powerPreference:"high-performance"}),this.renderer.setClearColor(0,0),this.renderer.toneMapping=Vy,this.renderer.toneMappingExposure=1.18,this.renderer.outputColorSpace=Ea,this.mountedCanvas=t,this.contextLost=!1,this.onContextLost=n=>{n.preventDefault(),this.contextLost=!0},this.onContextRestored=()=>{this.contextLost=!1},t.addEventListener("webglcontextlost",this.onContextLost,!1),t.addEventListener("webglcontextrestored",this.onContextRestored,!1),this.modelPromise||(this.modelPromise=this.loadModel(r)),this.modelPromise)}resize(t,r,n){this.renderer&&(t<=0||r<=0||(console.log("[Raid3D] resize",{widthCss:t,heightCss:r,dpr:n}),this.widthCss=t,this.heightCss=r,this.renderer.setPixelRatio(n),this.renderer.setSize(t,r,!1),this.camera.left=-t/2,this.camera.right=t/2,this.camera.top=r/2,this.camera.bottom=-r/2,this.camera.updateProjectionMatrix()))}setShipPoses(t){if(!this.modelReady||!this.shipTemplate)return;const r=new Set(t.map(n=>n.id));for(const[n,s]of this.shipMeshById)r.has(n)||(this.shipMeshById.delete(n),s.visible=!1,this.freeShipMeshes.push(s));for(const n of t){if(this.shipMeshById.has(n.id))continue;let s=this.freeShipMeshes.pop();s||(s=this.shipTemplate.clone(!0),this.shipPool.push(s),this.scene.add(s)),this.shipMeshById.set(n.id,s)}for(let n=0;n<t.length;n++){const s=t[n],o=this.shipMeshById.get(s.id);if(!o)continue;const i=200,c=s.x<-i||s.x>this.widthCss+i,u=s.y<-i||s.y>this.heightCss+i;if(c||u){o.visible=!1;continue}o.visible=!0,o.position.x=s.x-this.widthCss/2,o.position.y=-(s.y-this.heightCss/2),o.position.z=-s.z;const p=performance.now()*.001,d=n*1.731,f=Math.max(0,Math.min(1,1-s.z/Y_e)),m=Math.min(f,.85),h=m*m*m,g=(.04+(8.4-.04)*h)*s.sizeScale*e0e;o.scale.setScalar(g);const y=y2(s.bankVx/K_e,-1,1)*Z_e,x=.012*f,v=.04*f,A=f>.55?-((f-.55)/.45)*.22:0,_=y2(s.visualVy/J_e,-1,1)*Q_e+Math.sin(p*1.7+d)*x+A,w=y*$_e+Math.sin(p*1.3+d*.7)*x;let j=y+Math.sin(p*.9+d*1.2)*v;if(s.spinRate&&s.spawnTime){const R=(performance.now()-s.spawnTime)/1e3,P=Math.PI*2.5,k=s.spinRate*R,E=Math.sign(k)*Math.min(Math.abs(k),P);j+=E}const T=o.userData;if(T.spawnTime!==s.spawnTime&&(T.spawnTime=s.spawnTime,T.rot&&(T.rot.init=!1)),!T.rot||!T.rot.init)T.rot={p:_,y:w,r:j,init:!0};else{const P=s.visualVx*s.bankVx<0&&Math.abs(s.bankVx)>70?.38:g2;T.rot.p+=(_-T.rot.p)*g2,T.rot.y+=(w-T.rot.y)*P,T.rot.r+=(j-T.rot.r)*P}o.rotation.set(T.rot.p,T.rot.y,T.rot.r,"YXZ")}}setShipPose(t){this.setShipPoses([t])}setVisible(t){for(const r of this.shipPool)r.visible=t}setFactionScheme(t){const r=Uy[t];r&&(this.currentScheme=r,this.currentFaction=t,this.applyFactionColor())}applyFactionColor(){const t=this.currentScheme,r=new Xn(t.body),n=new Xn(t.accent),s=new Xn(t.emissive);if(this.shipMaterials.length===1&&!!this.shipMaterials[0].map){const i=new Xn(t.accent);this.shipMaterials[0].emissive.copy(i),this.shipMaterials[0].needsUpdate=!0}else for(let i=0;i<this.shipMaterials.length;i++){const c=this.shipMaterials[i],u=this.shipMaterials.length>1&&i%2===1,p=u?n:r,d=p.clone().lerp(new Xn(16777215),u?.22:.16);d.multiplyScalar(u?1.28:1.2),c.color.copy(d),c.emissive.copy(s).lerp(p,u?.5:.35),c.emissiveIntensity=u?.42:.28,c.metalness=t.metalness,c.roughness=Math.max(.32,t.roughness*.82),c.envMapIntensity=Math.max(c.envMapIntensity,u?1.05:.9),c.needsUpdate=!0}if(this.thrusterGlowMat&&(this.thrusterGlowMat.color.set(t.flame),this.thrusterGlowMat.needsUpdate=!0),this.cockpitMat){const i=new Xn(t.accent);this.cockpitMat.color.copy(i).lerp(new Xn(16777215),.2).multiplyScalar(.42),this.cockpitMat.emissive.copy(i),this.cockpitMat.emissiveIntensity=.8,this.cockpitMat.envMapIntensity=Math.max(this.cockpitMat.envMapIntensity,1.1),this.cockpitMat.needsUpdate=!0}}render(){if(this.renderer&&!this.contextLost&&!(this.widthCss<=0||this.heightCss<=0)){if(this._loggedFirstRender||(this._loggedFirstRender=!0,console.log("[Raid3D] first render",{w:this.widthCss,h:this.heightCss,sceneChildren:this.scene.children.length,poolSize:this.shipPool.length})),this.thrusterGlowMat){const t=performance.now()*.001,r=.88+.12*Math.sin(t*28)*Math.sin(t*11),n=.88+.12*Math.sin(t*4.2)*Math.cos(t*2.1);this.thrusterGlowMat.opacity=.82*r*n}try{this.renderer.render(this.scene,this.camera)}catch(t){this.contextLost=!0,console.warn("[Raid3D] render aborted (context likely lost)",t)}}}dispose(){for(const t of this.shipPool)this.scene.remove(t),t.traverse(r=>{var s,o,i;const n=r;if(n.isMesh){(o=(s=n.geometry)==null?void 0:s.dispose)==null||o.call(s);const c=n.material;Array.isArray(c)?c.forEach(u=>{var p;return(p=u.dispose)==null?void 0:p.call(u)}):(i=c==null?void 0:c.dispose)==null||i.call(c)}});if(this.shipPool=[],this.shipMeshById.clear(),this.freeShipMeshes=[],this.shipTemplate=null,this.mountedCanvas&&(this.onContextLost&&this.mountedCanvas.removeEventListener("webglcontextlost",this.onContextLost,!1),this.onContextRestored&&this.mountedCanvas.removeEventListener("webglcontextrestored",this.onContextRestored,!1)),this.onContextLost=null,this.onContextRestored=null,this.renderer){try{const t=this.renderer.getContext().getExtension("WEBGL_lose_context");t==null||t.loseContext()}catch{}this.renderer.dispose()}this.renderer=null,this.modelReady=!1,this.modelPromise=null,this.mountedCanvas=null}async loadModel(t){if(/\.glb($|\?)/i.test(t))return this.loadGLBModel(t);const r=new k3;let n;try{try{const F=await fetch(t,{method:"HEAD"});F.ok||console.warn("[Raid3D] HEAD probe failed",t,F.status,F.statusText)}catch(F){console.warn("[Raid3D] HEAD probe threw",t,F)}n=await r.loadAsync(t),console.log("[Raid3D] OBJ loaded",t)}catch(F){console.warn("[Raid3D] OBJ load failed, using fallback box",t,F);const D=new Hi(new dd(.2,.2,.2),new Ua({color:16711935,emissive:4456516})),H=new tf;H.add(D),this.shipTemplate=H,this.modelReady=!0;return}const s=new os().setFromObject(n),o=new An;s.getSize(o);const i=150,c=Math.max(o.x,o.y,o.z),u=c>0?i/c:1;n.scale.set(u*.7,u*1.25,u);const p=new os().setFromObject(n),d=new An;p.getCenter(d),n.position.sub(d),n.rotation.x=0;const f=new tf;f.add(n),this.shipMaterials=[];const m=0,h=1,b=2,g=3,y=new Ua({color:12700640,metalness:.42,roughness:.52,emissive:1185831,emissiveIntensity:.28,envMapIntensity:.9}),x=new Ua({color:1778224,metalness:.42,roughness:.16,emissive:791072,emissiveIntensity:.8,envMapIntensity:1.1}),v=new Ua({color:10398659,metalness:.38,roughness:.56,emissive:1054506,emissiveIntensity:.42,envMapIntensity:1.05}),A=new Ua({color:5858420,metalness:.55,roughness:.42,emissive:4856325,emissiveIntensity:1,envMapIntensity:.95}),_=r0e().albedo;P_(y,_,.03,.62),P_(v,_,.03,.56),P_(A,_,.038,.52);const w=[y,x,v,A];this.shipMaterials.push(y,v,A),this.cockpitMat=x;let j=0;f.traverse(F=>{if(F.type!=="Mesh")return;const D=F,H=D.geometry,W=H.getAttribute("position");if(!W)return;H.computeBoundingBox();const G=H.boundingBox,$=(G.min.x+G.max.x)/2,K=G.max.x-G.min.x||1,de=G.max.y-G.min.y||1,ie=G.max.z-G.min.z||1,we=W.count/3,he=[[],[],[],[]];for(let U=0;U<we;U++){const V=U*3,z=W.getX(V),O=W.getY(V),q=W.getZ(V),X=W.getX(V+1),Z=W.getY(V+1),Q=W.getZ(V+1),oe=W.getX(V+2),ce=W.getY(V+2),_e=W.getZ(V+2),re=(z+X+oe)/3,pe=(O+Z+ce)/3,ee=(q+Q+_e)/3,xe=(re-$)/(K*.5),Le=(pe-G.min.y)/de,Ge=(ee-G.min.z)/ie;let _t;Ge<.22?_t=g:Le>.7&&Ge>.3&&Ge<.78&&Math.abs(xe)<.35?_t=h:Math.abs(xe)>.55&&Le<.55?_t=b:_t=m,he[_t].push(V,V+1,V+2)}const Ae=[],Fe=[];for(let U=0;U<4;U++)if(he[U].length!==0){Fe.push({start:Ae.length,count:he[U].length,matIndex:U});for(const V of he[U])Ae.push(V)}H.setIndex(new Gd(new Uint32Array(Ae),1)),H.clearGroups();for(const U of Fe)H.addGroup(U.start,U.count,U.matIndex);H.computeVertexNormals(),D.material=w,D.frustumCulled=!1,j++}),this.applyFactionColor(),console.log("[Raid3D] OBJ segmented meshCount",j);const T=new os().setFromObject(f),R=Math.max(.1,T.max.z-T.min.z),P=T.min.z,k=R*.85,E=document.createElement("canvas");E.width=128,E.height=128;const M=E.getContext("2d");if(M){const F=M.createRadialGradient(64,64,0,64,64,64);F.addColorStop(0,"rgba(255,200,140,1)"),F.addColorStop(.35,"rgba(255,140,60,0.55)"),F.addColorStop(1,"rgba(255,80,20,0)"),M.fillStyle=F,M.fillRect(0,0,128,128)}const C=new Qc(E);C.colorSpace=Ea;const I=new G1({map:C,color:16755268,transparent:!0,blending:la,depthWrite:!1,fog:!1});this.thrusterGlowMat=I;const L=new X1(I),N=k*1.6;L.scale.set(N,N,1),L.position.set(0,0,P-k*.15),L.renderOrder=0,f.add(L),this.shipTemplate=f,this.modelReady=!0;const S=new os().setFromObject(f);console.log("[Raid3D] mesh added",{children:this.scene.children.length,bbox:{min:S.min.toArray(),max:S.max.toArray()}})}async loadGLBModel(t){if(!this.renderer)throw new Error("renderer not mounted");const r=P1[this.currentFaction],n=t.match(/\/ships\/([^/]+)\//),s=n?n[1]:r.pack,o=`/models/zentara/ships/${s}/Textures/${s}`,i={diffuse:`${o}_${r.skinColor}.webp`,normal:`${o}_Normal.webp`,metallic:`${o}_Metallic.webp`,roughness:`${o}_Roughness.webp`,emission:`${o}_${r.emissionSuffix}.webp`},c=new S3,u=new tj,p=(F,D)=>new Promise((H,W)=>{u.load(F,G=>{D&&(G.colorSpace=Ea),G.flipY=!1,G.anisotropy=8,G.minFilter=C3,G.magFilter=R3,G.generateMipmaps=!0,H(G)},void 0,W)});let d,f;try{const[F,D,H,W,G,$]=await Promise.all([c.loadAsync(t),p(i.diffuse,!0),p(i.normal,!1),p(i.metallic,!1),p(i.roughness,!1),p(i.emission,!0)]);d=F.scene,f={diffuse:D,normal:H,metallic:W,roughness:G,emission:$},console.log("[Raid3D] GLB loaded",t,"faction",this.currentFaction)}catch(F){console.warn("[Raid3D] GLB load failed, using fallback box",t,F);const D=new Hi(new dd(.2,.2,.2),new Ua({color:16711935,emissive:4456516})),H=new tf;H.add(D),this.shipTemplate=H,this.modelReady=!0;return}const m=new Xn(this.currentScheme.accent),h=new Ua({map:f.diffuse,normalMap:f.normal,metalnessMap:f.metallic,roughnessMap:f.roughness,emissiveMap:f.emission,emissive:m,emissiveIntensity:1.2,metalness:1,roughness:1,envMapIntensity:1});this.shipMaterials=[h],this.cockpitMat=null,d.traverse(F=>{const D=F;D.isMesh&&(D.material=h,D.frustumCulled=!1)});const b=new E3(this.renderer);b.compileEquirectangularShader();const g=b.fromScene(new P3,.04).texture;this.scene.environment=g,b.dispose();const y=new os().setFromObject(d),x=new An;y.getSize(x);const v=Math.max(x.x,x.y,x.z),A=v>0?150/v:1;d.scale.setScalar(A),d.rotation.set(0,0,0),d.updateMatrixWorld(!0);const _=new os().setFromObject(d),w=new An;_.getCenter(w),d.position.sub(w);const j=new tf;j.add(d);const T=new os().setFromObject(j),R=Math.max(.1,T.max.z-T.min.z),P=T.min.z,k=R*.85,E=document.createElement("canvas");E.width=128,E.height=128;const M=E.getContext("2d");if(M){const F=M.createRadialGradient(64,64,0,64,64,64);F.addColorStop(0,"rgba(255,200,140,1)"),F.addColorStop(.35,"rgba(255,140,60,0.55)"),F.addColorStop(1,"rgba(255,80,20,0)"),M.fillStyle=F,M.fillRect(0,0,128,128)}const C=new Qc(E);C.colorSpace=Ea;const I=new G1({map:C,color:this.currentScheme.flame,transparent:!0,blending:la,depthWrite:!1,fog:!1});this.thrusterGlowMat=I;const L=new X1(I),N=k*1.6;L.scale.set(N,N,1),L.position.set(0,0,P-k*.15),j.add(L),this.shipTemplate=j,this.modelReady=!0;const S=new os().setFromObject(j);console.log("[Raid3D] GLB mesh added",{bbox:{min:S.min.toArray(),max:S.max.toArray()}})}}function y2(e,t,r){return e<t?t:e>r?r:e}function P_(e,t,r,n){t.wrapS=t.wrapT=Vg,e.onBeforeCompile=s=>{s.uniforms.uPlatingTex={value:t},s.uniforms.uPlatingScale={value:r},s.uniforms.uPlatingStrength={value:n},s.vertexShader=s.vertexShader.replace("#include <common>",`#include <common>
varying vec3 vLocalPos;
varying vec3 vLocalNormal;`).replace("#include <begin_vertex>",`#include <begin_vertex>
vLocalPos = position;
vLocalNormal = normal;`),s.fragmentShader=s.fragmentShader.replace("#include <common>",`#include <common>
varying vec3 vLocalPos;
varying vec3 vLocalNormal;
uniform sampler2D uPlatingTex;
uniform float uPlatingScale;
uniform float uPlatingStrength;`).replace("#include <map_fragment>",`
                vec3 tn = abs(normalize(vLocalNormal));
                tn = pow(tn, vec3(4.0));
                tn /= (tn.x + tn.y + tn.z);
                vec3 p = vLocalPos * uPlatingScale;
                vec3 sx = texture2D(uPlatingTex, p.yz).rgb;
                vec3 sy = texture2D(uPlatingTex, p.xz).rgb;
                vec3 sz = texture2D(uPlatingTex, p.xy).rgb;
                vec3 plating = sx * tn.x + sy * tn.y + sz * tn.z;
                float lum = dot(plating, vec3(0.299, 0.587, 0.114));
                // Blend: 1.0 = no change, lum near 0 darkens (panel seams).
                float modAmt = mix(1.0, lum * 1.4, uPlatingStrength);
                diffuseColor.rgb *= modAmt;
                `)},e.needsUpdate=!0}function r0e(){const t=document.createElement("canvas");t.width=t.height=512;const r=t.getContext("2d"),n=r.createImageData(512,512);for(let i=0;i<n.data.length;i+=4){const c=160+(Math.random()*80|0);n.data[i]=c,n.data[i+1]=c,n.data[i+2]=c,n.data[i+3]=255}r.putImageData(n,0,0);for(let i=0;i<18;i++){const c=Math.random()*512,u=Math.random()*512,p=30+Math.random()*80,d=r.createRadialGradient(c,u,0,c,u,p);d.addColorStop(0,`rgba(${30+Math.random()*30|0}, ${30+Math.random()*30|0}, ${30+Math.random()*30|0}, 0.30)`),d.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=d,r.fillRect(c-p,u-p,p*2,p*2)}r.globalAlpha=.18;for(let i=0;i<60;i++){const c=Math.random()*512,u=1+Math.random()*4,p=r.createLinearGradient(c,0,c,512);p.addColorStop(0,"rgba(30,30,40,0)"),p.addColorStop(.4,"rgba(30,30,40,1)"),p.addColorStop(1,"rgba(10,10,20,0)"),r.fillStyle=p,r.fillRect(c,0,u,512)}r.globalAlpha=1,r.lineCap="butt";const s=[[4,3,"rgba(15,17,22,0.95)"],[6,2,"rgba(20,22,28,0.85)"],[10,1.5,"rgba(25,27,34,0.7)"],[16,1,"rgba(30,32,38,0.55)"]];for(const[i,c,u]of s){r.strokeStyle=u,r.lineWidth=c;const p=512/i;for(let d=0;d<=i;d++){const f=Math.round(d*p)+.5;r.beginPath(),r.moveTo(f,0),r.lineTo(f,512),r.stroke(),r.beginPath(),r.moveTo(0,f),r.lineTo(512,f),r.stroke()}}r.strokeStyle="rgba(15,17,22,0.85)",r.lineWidth=2;for(let i=0;i<6;i++){const c=Math.random()*512,u=Math.random()*512,p=60+Math.random()*200,d=(Math.random()<.5?0:Math.PI/2)+(Math.random()-.5)*.5;r.beginPath(),r.moveTo(c,u),r.lineTo(c+Math.cos(d)*p,u+Math.sin(d)*p),r.stroke()}for(let i=0;i<200;i++){const c=Math.random()*512,u=Math.random()*512,p=1+Math.random()*1.4;r.fillStyle=`rgba(${15+Math.random()*25|0},${15+Math.random()*25|0},${20+Math.random()*25|0},0.85)`,r.beginPath(),r.arc(c,u,p,0,Math.PI*2),r.fill()}r.strokeStyle="rgba(220,225,235,0.35)",r.lineWidth=.8;for(let i=0;i<24;i++){const c=Math.random()*512,u=Math.random()*512,p=8+Math.random()*30,d=Math.random()*Math.PI*2;r.beginPath(),r.moveTo(c,u),r.lineTo(c+Math.cos(d)*p,u+Math.sin(d)*p),r.stroke()}const o=new Qc(t);return o.wrapS=o.wrapT=Vg,o.repeat.set(4,4),o.anisotropy=4,o.colorSpace=Ea,{albedo:o}}const qi=rz,n0e=nz,b2=Gw,a0e=sz,s0e=.84,o0e=.8,i0e=.28,v2=.62,_2=.34,w2=.08,l0e=.2,c0e=20,C_=900,u0e=180,d0e=90,nd=20,x2=30,Gh=200,ad=800,R_=800,p0e=.65,f0e=.012,A2=[1500,6e3,10500],m0e=.375,h0e=56,k2=26,T_=2,j_=60,g0e=8,S2=450,E2=560,Xh=1,y0e=.36,b0e=.9,v0e=2.4,_0e=1.1,w0e=.6,x0e=1.6,A0e=.6,k0e=1100,S0e=.68,E0e=320,P0e=.5,C0e=.5,R0e=2.4,T0e=1.8,j0e=1.3,I0e=.4,N0e=3.2,M0e=az,P2=40,L0e=1500,D0e=252,C2=6,O0e=5,z0e=105,B0e=600,F0e=640,U0e=140,R2=380,T2=1200,q0e=320,V0e=820,Yh=$s?11:16,Zh=18,Kh=.07,H0e=1400,W0e=Math.PI*1.1,j2=$s?12:18,G0e=900,I2=.028,X0e=.38,Y0e=18,Z0e=200,N2=e=>{const t=(e??"").match(/t(\d)$/);return t?Math.min(6,Math.max(1,parseInt(t[1],10))):null},yz=({attacker:e,defender:t,onComplete:r,tileBackgroundImage:n,onProgress:s,isSpectator:o=!1,botPilot:i=!1,isLocalDefender:c=!1,confirmedResult:u=null})=>{const p=e.piece,d=t.piece,f=l.useRef(null),m=l.useRef(null),h=l.useRef(null),b=l.useRef(null),g=l.useRef(null),y=l.useRef(!1),x=l.useRef(1),[v,A]=l.useState("countdown"),[_,w]=l.useState(3),[j,T]=l.useState(0),[R,P]=l.useState(qi),[k,E]=l.useState(null),[M,C]=l.useState(!1),[I,L]=l.useState(!1),N=l.useMemo(()=>n?Zl(n):y_e,[n]),S=n??Hd,[F,D]=l.useState(0),H=l.useRef([]),W=l.useRef([]),G=l.useRef([]),$=l.useRef([]),K=l.useRef([]),de=l.useRef([]),ie=l.useRef(0),we=l.useRef(0),he=l.useRef(0),Ae=l.useRef([]),Fe=l.useRef([]),U=l.useRef([]),V=l.useRef([[],[],[]]),z=l.useRef([[],[],[]]),O=l.useRef(0),q=l.useRef({x:0,y:0}),X=l.useRef(null),Z=l.useRef({x:0,y:0}),Q=l.useRef({dx:0,dy:0}),oe=l.useRef(null),ce=l.useRef({up:!1,down:!1,left:!1,right:!1}),_e=l.useRef(0),re=l.useRef(0),[pe,ee]=l.useState(0),xe=l.useRef(0),Le=l.useRef(0),Ge=l.useRef(0),_t=l.useRef(0),Xe=l.useRef(0),bt=l.useRef(0),Pt=l.useRef(0),kt=l.useRef({x:0,y:0,untilTs:0,nextBurstTs:0,tilt:0,targetTilt:0}),Ee=l.useRef({initialized:!1,prevX:0,prevY:0,bankVel:0,pitchVel:0}),le=l.useRef(null),De=l.useRef([]),Ye=l.useRef(null),Re=l.useRef(!1),et=l.useRef(-1),rt=l.useRef(-1e3),ne=l.useRef(0),ue=l.useRef(0),B=l.useRef(0),fe=l.useRef({w:0,h:0}),ye=l.useRef(0),ve=l.useRef(M),ke=l.useRef(o),Ue=l.useRef(s),ct=l.useRef(p);l.useRef(0),l.useRef(0),ve.current=M,ke.current=o,Ue.current=s,ct.current=p;const dt=l.useRef(1);dt.current=N2(e.heroId)??1;const Rt=l.useRef(0),jr=l.useRef(0),Qe=l.useRef(0),Mt=l.useRef(null),lr=l.useRef(0),zt=l.useRef({w:0,h:0}),br=l.useRef(null),fr=l.useRef({w:0,h:0}),ur=l.useRef(null),Ie=l.useRef(0),yt=l.useRef({w:0,h:0}),St=l.useRef([]);l.useEffect(()=>{const Te=[...f_e[d],...m_e[d],...h_e[d]];St.current=Te.map(Ve=>Zl(Ve)).filter(Ve=>!!Ve)},[d]);const Xt=l.useCallback(()=>{var Mr;const Te=m.current;if(!Te)return;const Ve=Math.min(window.devicePixelRatio||1,x_e),tt=Te.clientWidth,Et=Te.clientHeight;if(tt<=0||Et<=0)return;const Qt=Math.round(tt*Ve),or=Math.round(Et*Ve),Ht=Te.width!==Qt||Te.height!==or;if(Ht&&(Te.width=Qt,Te.height=or),x.current=Ve,fe.current={w:tt,h:Et},ye.current=Math.sqrt(tt/2*(tt/2)+Et/2*(Et/2)),(Mr=g.current)==null||Mr.resize(tt,Et,Ve),h.current&&!Ht){h.current.setTransform(Ve,0,0,Ve,0,0);return}const nr=typeof navigator<"u"&&/Android/i.test(navigator.userAgent)?Te.getContext("2d"):Te.getContext("2d",{desynchronized:!0});nr&&(nr.setTransform(Ve,0,0,Ve,0,0),h.current=nr)},[]),se=l.useCallback((Te,Ve)=>{const tt=X_e(Te,Ve);for(let Et=0;Et<tt.length;Et+=1)W.current.push(tt[Et])},[]),je=l.useCallback((Te,Ve)=>{const{w:tt,h:Et}=fe.current;!tt||!Et||H.current.push(M_e({width:tt,height:Et,faction:d,factionColor:iz[d],allocId:()=>xe.current++,now:Te,overrideZ:Ve,battleshipAnchorX:v2,battleshipAnchorY:_2,zSpeedMin:y0e,zSpeedMax:b0e,zFar:Xh}))},[d]),Oe=l.useCallback(Te=>Oy(Te,re.current,e,t),[e,t]),Ke=l.useCallback(Te=>{if(v!=="playing"||o)return;const Ve=performance.now();if(Ve-Le.current>=qi)return;const{x:Et,y:Qt}=q.current;if(Et<=0||Qt<=0)return;Te==="bot"&&Lo({volume:.12}),B.current=Ve;const{w:or,h:Ht}=fe.current;let Lt=!1;const Mr=.6+(dt.current-1)*.28,Br=or*.06,wn=Ht*.3,Kt=Er=>{const yr=Math.atan2(Qt-Ht,Et-Er);return{bx:Er+Math.cos(yr)*wn,by:Ht+Math.sin(yr)*wn}},{bx:Jt,by:un}=Kt(or/2-Br),{bx:Tn,by:Kr}=Kt(or/2+Br);for(const Er of H.current){if(!Er.alive)continue;const yr=Er.renderScale>0?Er.renderScale:E_(Er),xn=Math.sqrt(Math.max(.5,yr)),gn=x2*xn*Mr,dn=gn*gn,Gr=Er.x-Et,Sn=Er.y-Qt;if(Gr*Gr+Sn*Sn>dn)continue;Er.alive=!1,_e.current+=1,T(_e.current),se(Er.x,Er.y);const Gn=1-Math.max(Er.z,0)/Xh,en=1+Gn*Gn*4,Ce=Math.max(yr,p0e);$.current.push({x:Er.x,y:Er.y,vx:Er.vx*en,vy:Er.vy*en,life:ad,maxLife:ad,color:Er.color,maxRadius:R_*Ce*Mr}),Xa({volume:.03}),Lt=!0;break}if(!Lt)for(const Er of de.current){if(!Er.alive)continue;const yr=Math.max(0,1-Er.z),xn=k2+(h0e-k2)*yr,gn=xn*xn*Mr,dn=Er.x-Et,Gr=Er.y-Qt;if(!(dn*dn+Gr*Gr>gn)){Er.alive=!1,se(Er.x,Er.y),$.current.push({x:Er.x,y:Er.y,vx:0,vy:0,life:ad*.7,maxLife:ad*.7,color:"#ff5530",maxRadius:R_*.55*Mr}),Xa({volume:.04}),Lt=!0;break}}G.current.push({x1:Jt,y1:un,x2:Et-C2,y2:Qt,life:Gh,maxLife:Gh,hit:Lt,width:Mr},{x1:Tn,y1:Kr,x2:Et+C2,y2:Qt,life:Gh,maxLife:Gh,hit:Lt,width:Mr})},[o,v,se]),Me=l.useCallback(()=>{for(const Te of De.current)clearTimeout(Te);De.current=[]},[]),wt=l.useCallback(()=>{if(v!=="playing"||o)return;const Te=performance.now();if(!(Te-bt.current<B0e)){bt.current=Te,N8({volume:.22}),Me(),Ke("player");for(let Ve=1;Ve<O0e;Ve+=1){const tt=setTimeout(()=>{De.current=De.current.filter(Et=>Et!==tt),Ke("player")},Ve*z0e);De.current.push(tt)}}},[Me,Ke,o,v]),at=l.useCallback(()=>{if(i){const Te=performance.now();if(Te-Xe.current<P2)return;Xe.current=Te,Ke("bot");return}wt()},[i,Ke,wt]),Dt=l.useCallback(()=>{Re.current=!1,Ye.current&&(Ye.current(),Ye.current=null),le.current&&(clearInterval(le.current),le.current=null)},[]),Ut=l.useCallback(()=>{if(!(v!=="playing"||o)){if(!Re.current){Re.current=!0;const Te=()=>Dt();window.addEventListener("pointerup",Te,!0),window.addEventListener("pointercancel",Te,!0),window.addEventListener("mouseup",Te,!0),window.addEventListener("touchend",Te,!0),window.addEventListener("touchcancel",Te,!0),Ye.current=()=>{window.removeEventListener("pointerup",Te,!0),window.removeEventListener("pointercancel",Te,!0),window.removeEventListener("mouseup",Te,!0),window.removeEventListener("touchend",Te,!0),window.removeEventListener("touchcancel",Te,!0)}}at(),!le.current&&(le.current=setInterval(()=>{at()},F0e))}},[at,o,v]);l.useEffect(()=>{v!=="playing"&&(Dt(),Me())},[Me,v,Dt]),l.useEffect(()=>()=>Me(),[Me]),l.useEffect(()=>{if(o||i)return;const Te=Qt=>{const or=Qt,Ht=or==null?void 0:or.tagName;return Ht==="INPUT"||Ht==="TEXTAREA"||Ht==="SELECT"||!!(or!=null&&or.isContentEditable)},Ve=(Qt,or)=>{const Ht=ce.current;switch(Qt){case"KeyW":case"ArrowUp":return Ht.up=or,!0;case"KeyS":case"ArrowDown":return Ht.down=or,!0;case"KeyA":case"ArrowLeft":return Ht.left=or,!0;case"KeyD":case"ArrowRight":return Ht.right=or,!0;default:return!1}},tt=Qt=>{if(!Te(Qt.target)){if(Ve(Qt.code,!0)){Qt.preventDefault();return}if(Qt.code==="Space"||Qt.code==="KeyF"){Qt.preventDefault(),Qt.repeat||Ut();return}Qt.code==="Enter"&&(Qt.preventDefault(),Qt.repeat||at())}},Et=Qt=>{if(Ve(Qt.code,!1)){Qt.preventDefault();return}(Qt.code==="Space"||Qt.code==="KeyF")&&(Qt.preventDefault(),Dt())};return window.addEventListener("keydown",tt),window.addEventListener("keyup",Et),()=>{window.removeEventListener("keydown",tt),window.removeEventListener("keyup",Et),ce.current={up:!1,down:!1,left:!1,right:!1},Dt()}},[i,at,o,Ut,Dt]),l.useEffect(()=>{const Te=()=>Dt(),Ve=()=>{document.visibilityState!=="visible"&&Dt()};return window.addEventListener("blur",Te),document.addEventListener("visibilitychange",Ve),()=>{window.removeEventListener("blur",Te),document.removeEventListener("visibilitychange",Ve),Dt()}},[Dt]),l.useEffect(()=>{if(v!=="countdown")return;const Te=performance.now(),Ve=_*1e3,tt=Te+Ve;let Et=0,Qt=_,or=!1;const Ht=()=>{or||(or=!0,w(0),A("playing"))},Lt=()=>{if(or)return;const Mr=Math.max(0,tt-performance.now()),Br=Math.ceil(Mr/1e3);if(Br!==Qt){if(Qt=Br,Br<=0){Ht();return}w(Br)}Et=requestAnimationFrame(Lt)};Et=requestAnimationFrame(Lt);const nr=window.setTimeout(Ht,Ve+750);return()=>{cancelAnimationFrame(Et),window.clearTimeout(nr)}},[v,o]);const ft=l.useRef(null);l.useEffect(()=>{ft.current||(ft.current=new pz({src:oz}));const Te=ft.current;if(v==="countdown")Te.play();else if(v==="result")return Te.stop(),()=>Te.dispose()},[v]),l.useEffect(()=>()=>{var Te;(Te=ft.current)==null||Te.dispose()},[]),l.useEffect(()=>()=>{const Te=Ve=>{if(Ve)try{Ve.width=0,Ve.height=0}catch{}};Te(m.current),Te(b.current),Te(Mt.current),Te(br.current),Te(ur.current),Mt.current=null,br.current=null,ur.current=null},[]),l.useEffect(()=>{const Te=[m.current,b.current].filter(Et=>!!Et);if(Te.length===0)return;const Ve=Et=>{Et.preventDefault(),L(!0)},tt=()=>L(!1);for(const Et of Te)Et.addEventListener("webglcontextlost",Ve,!1),Et.addEventListener("webglcontextrestored",tt,!1),Et.addEventListener("contextlost",Ve,!1),Et.addEventListener("contextrestored",tt,!1);return()=>{for(const Et of Te)Et.removeEventListener("webglcontextlost",Ve,!1),Et.removeEventListener("webglcontextrestored",tt,!1),Et.removeEventListener("contextlost",Ve,!1),Et.removeEventListener("contextrestored",tt,!1)}},[]),l.useEffect(()=>{if(v!=="playing")return;const Te=b.current;if(!Te)return;console.log("[Raid3D] mount effect canvas",{client:[Te.clientWidth,Te.clientHeight],offset:[Te.offsetWidth,Te.offsetHeight]});const Ve=new t0e;Ve.setFactionScheme(d),g.current=Ve,y.current=!1;let tt=!1;return Ve.mount(Te,Uye(d)).then(()=>{if(tt)return;y.current=!0;let{w:Et,h:Qt}=fe.current;(Et<=0||Qt<=0)&&(Et=Te.clientWidth,Qt=Te.clientHeight),Ve.resize(Et,Qt,x.current||window.devicePixelRatio||1),console.log("[Raid3D] scene ready",{w:Et,h:Qt})}).catch(Et=>{console.warn("[Raid3D] failed to load ship model",Et)}),()=>{tt=!0,y.current=!1,Ve.dispose(),g.current===Ve&&(g.current=null)}},[v,d]),l.useEffect(()=>{if(o||i)return;const Te=f.current,Ve=m.current;if(!Te||!Ve)return;const tt=Ht=>{const Lt=Ve.getBoundingClientRect();return{x:Ht.clientX-Lt.left,y:Ht.clientY-Lt.top}},Et=Ht=>{q.current=tt(Ht)},Qt=Ht=>{const Lt=Ht.target;Lt instanceof Element&&(Lt.closest(".raid-fps-fire-btn")||Lt.closest(".raid-fps-pad-zone"))||(Ht.preventDefault(),q.current=tt(Ht),at())},or=Ht=>{const Lt=Ht.changedTouches[0],nr=tt(Lt),{h:Mr}=fe.current;nr.y>Mr-D0e||(Ht.preventDefault(),q.current=nr,at())};return Te.addEventListener("touchstart",or,{passive:!1}),c2&&(Te.addEventListener("mousemove",Et),Te.addEventListener("mousedown",Qt)),()=>{Te.removeEventListener("touchstart",or),c2&&(Te.removeEventListener("mousemove",Et),Te.removeEventListener("mousedown",Qt))}},[at,o,i]),l.useEffect(()=>{if(!i||v!=="playing")return;let Te=0,Ve=performance.now();const tt=window.setInterval(()=>{at()},P2);let Et=-1,Qt=0,or=0,Ht=0,Lt=0,nr=0,Mr=0,Br=0,wn=Math.random()*Math.PI*2,Kt=Math.random()*Math.PI*2;const Jt=Tn=>{const Kr=!Tn&&Math.random()<.25,Er=Tn?5:Kr?70:22;Qt=(Math.random()-.5)*Er,or=(Math.random()-.5)*Er;const yr=Tn?60+Math.random()*60:110+Math.random()*110;Ht=performance.now()+yr,Lt=0,nr=0},un=()=>{const Tn=performance.now(),Kr=Math.min(.08,(Tn-Ve)/1e3);Ve=Tn,wn+=Kr*1.8,Mr=Math.sin(wn)*1.8+Math.sin(wn*2.3)*.8,Br=Math.cos(wn*.9)*1.5+Math.cos(wn*2.7)*.6,Kt+=Kr*5.2;const Er=Math.sin(Kt)*16+Math.sin(Kt*.37)*9,yr=Math.cos(Kt*.83)*12+Math.sin(Kt*1.7)*6,{w:xn,h:gn}=fe.current;if(xn>0&&gn>0){q.current.x<=0&&q.current.y<=0&&(q.current={x:xn/2,y:gn/2});let dn=null,Gr=1/0;const Sn=q.current.x,Gn=q.current.y;for(const en of de.current){if(!en.alive)continue;const Ce=en.x-Sn,Bn=en.y-Gn,xr=Ce*Ce+Bn*Bn;xr<Gr&&(Gr=xr,dn={x:en.x,y:en.y,id:-1e3-en.id})}if(!dn)for(const en of H.current){if(!en.alive||en.z>.85)continue;const Ce=en.x-Sn,Bn=en.y-Gn,xr=Ce*Ce+Bn*Bn;xr<Gr&&(Gr=xr,dn={x:en.x,y:en.y,id:en.id})}if(dn)if(dn.id!==Et&&(Et=dn.id,Jt(dn.id<=-1e3)),Tn<Ht)q.current.x+=Mr*Kr*.4,q.current.y+=Br*Kr*.4;else{const en=dn.id<=-1e3,Ce=dn.x+Qt+Mr+(en?0:Er),Bn=dn.y+or+Br+(en?0:yr),xr=Ce-Sn,Zn=Bn-Gn,$n=Math.sqrt(xr*xr+Zn*Zn),ut=Math.min(en?1400:1100,$n*6),be=$n>.1?xr/$n*ut:0,Se=$n>.1?Zn/$n*ut:0,nt=Math.min(1,(en?12:9)*Kr);Lt+=(be-Lt)*nt,nr+=(Se-nr)*nt,q.current.x=Sn+Lt*Kr,q.current.y=Gn+nr*Kr}else Et=-1,Lt*=Math.max(0,1-3*Kr),nr*=Math.max(0,1-3*Kr),q.current.x=Math.max(24,Math.min(xn-24,q.current.x+Lt*Kr+Er*Kr*5)),q.current.y=Math.max(24,Math.min(gn-24,q.current.y+nr*Kr+yr*Kr*4))}Te=requestAnimationFrame(un)};return Te=requestAnimationFrame(un),()=>{cancelAnimationFrame(Te),window.clearInterval(tt)}},[i,v,at]),l.useEffect(()=>{if(v!=="playing")return;Xt();let Te=0;const Ve=()=>{Te||(Te=requestAnimationFrame(()=>{Te=0,Xt()}))};window.addEventListener("resize",Ve);const tt=typeof window<"u"?window.visualViewport:null;tt==null||tt.addEventListener("resize",Ve),Le.current=performance.now(),Ge.current=0,et.current=-1,re.current=0,ee(0),_e.current=0,T(0),O.current=0,E(null),kt.current={x:0,y:0,untilTs:0,nextBurstTs:performance.now()+yc(R2,T2),tilt:0,targetTilt:0},Ee.current={initialized:!1,prevX:0,prevY:0,bankVel:0,pitchVel:0},H.current=[],W.current=[],G.current=[],$.current=[],K.current=[],de.current=[],ie.current=0,we.current=0,D(0),he.current=0,Ae.current=H_e(),Fe.current=W_e(),U.current=G_e();const{w:Et,h:Qt}=fe.current;q.current.x<=0&&q.current.y<=0&&(q.current={x:Et/2,y:Qt/2});let or=performance.now();ue.current=0;const Ht=Lt=>{const nr=Math.min((Lt-or)/1e3,.05);or=Lt;const Mr=Lt-Le.current;Ue.current&&Mr-rt.current>=500&&(rt.current=Mr,Ue.current({hits:_e.current,totalSpawned:re.current,elapsedMs:Math.round(Mr),durationMs:qi,status:"active"}));const Br=Math.max(0,qi-Mr),wn=Math.ceil(Br/1e3);if(wn!==et.current&&(et.current=wn,P(Br)),Mr>=qi+L0e&&(H.current=[]),Br<=0&&H.current.length===0){A("result");return}if(Mr<100&&re.current===0){const J=6+Math.floor(Math.random()*3);for(let $e=0;$e<J;$e++)je(Lt,.35+Math.random()*.5),re.current+=1;ee(re.current)}if(Br>M0e&&Mr-Ge.current>=n0e){const J=b2+Math.floor(Math.random()*(a0e-b2+1));for(let $e=0;$e<J;$e+=1)je(Lt),re.current+=1;ee(re.current),Ge.current=Mr}const{w:Kt,h:Jt}=fe.current;if(!o&&Br>0)for(;ie.current<A2.length&&Mr>=A2[ie.current];){const J=Kt*(.15+Math.random()*.7),$e=Jt*(.1+Math.random()*.35),jt=Kt*.5+(Math.random()-.5)*Kt*.12,Yt=Jt*.78;he.current+=1,de.current.push({id:he.current,x:J,y:$e,z:1,originX:J,originY:$e,targetX:jt,targetY:Yt,spawnMs:Lt,alive:!0}),ie.current+=1}td(de.current,J=>{if(!J.alive)return!1;if(J.z-=m0e*nr,J.z<=0){we.current+=1,D(we.current);const jt=kt.current;return jt.untilTs=Lt+700,jt.targetTilt=yc(-Kh*2,Kh*2),K.current.push({x1:J.targetX,y1:J.targetY,x2:J.targetX,y2:J.targetY,life:380,maxLife:380,color:"#ff3344"}),se(J.targetX,J.targetY),$.current.push({x:J.targetX,y:J.targetY,vx:0,vy:0,life:ad,maxLife:ad,color:"#ff5522",maxRadius:R_*1.2}),Xa({volume:.06}),!1}const $e=1-J.z;return J.x=J.originX+(J.targetX-J.originX)*$e,J.y=J.originY+(J.targetY-J.originY)*$e,!0});const{dx:un,dy:Tn}=Q.current,Kr=Math.sqrt(un*un+Tn*Tn);if(Kr>g0e){const J=Math.min(Kr/j_,1);q.current.x+=un/Kr*J*S2*nr,q.current.y+=Tn/Kr*J*S2*nr}const Er=ce.current,yr=(Er.right?1:0)-(Er.left?1:0),xn=(Er.down?1:0)-(Er.up?1:0);if(yr!==0||xn!==0){const J=Math.sqrt(yr*yr+xn*xn)||1;q.current.x+=yr/J*E2*nr,q.current.y+=xn/J*E2*nr}q.current.x=Math.max(0,Math.min(Kt,q.current.x)),q.current.y=Math.max(0,Math.min(Jt,q.current.y));{const J=Ee.current;if(J.initialized){const $e=(q.current.x-J.prevX)/Math.max(nr,.001),jt=(q.current.y-J.prevY)/Math.max(nr,.001);J.bankVel=J.bankVel*.94+$e*.06,J.pitchVel=J.pitchVel*.94+jt*.06}J.prevX=q.current.x,J.prevY=q.current.y,J.initialized=!0}const gn=Ee.current.bankVel/H0e*W0e,dn=Math.cos(gn),Gr=Math.sin(gn),Sn=Kt/2*(1-dn)+Jt/2*Gr,Gn=Jt/2*(1-dn)-Kt/2*Gr;td(H.current,J=>{if(!J.alive)return!1;const $e=J.x,jt=J.y,Yt=1-Math.max(J.z,0)/Xh,Ot=1+Yt*.75+(J.z<0?Math.abs(J.z)*2:0);J.z-=J.zSpeed*Ot*nr;const Pe=J.z<=S0e,ht=Pe?0:1,It=Pe?1:0;let Ct=J.vx;if(Pe&&(J.commitDirX===void 0||J.commitDirY===void 0)){const In=L_e(J,Kt/2,Jt/2);J.commitDirX=In.x,J.commitDirY=In.y}if(ht>0){const In=J.targetX-J.x,ts=J.targetY-J.y,rs=Math.max(.25,J.z/J.zSpeed);let Ma=In/rs,ua=ts/rs;if(J.profile==="weave"){const Iu=(Lt-J.spawnTime)/1e3,Ss=E0e*(P0e+Yt*C0e);Ma+=Math.sin(Iu*R0e+J.weavePhase)*Ss,ua+=Math.cos(Iu*T0e+J.weavePhase*j0e)*Ss*I0e}Ct=Ma;let Ni=v0e;J.profile==="strafe"?Ni=_0e-Yt*w0e:J.profile==="weave"?Ni=x0e:J.profile==="bankout"&&(Ni=A0e);const eo=1-Math.exp(-Ni*nr),ju=J.vx+(Ma-J.vx)*eo,Mi=J.vy+(ua-J.vy)*eo,Li=D_e(J.vx,J.vy,ju,Mi,k0e,nr);J.vx=Li.vx,J.vy=Li.vy}if(It>0&&J.commitDirX!==void 0&&J.commitDirY!==void 0){const In=O_e(J.vx,J.vy,{x:J.commitDirX,y:J.commitDirY},It,nr);J.vx=In.vx,J.vy=In.vy,Ct=J.commitDirX*Math.max(160,Math.hypot(J.vx,J.vy))}const pr=1+Yt*Yt*N0e,Pr=J.z<0?Math.abs(J.z)*14:0,Nr=pr+Pr;if(J.x+=J.vx*Nr*nr,J.y+=J.vy*Nr*nr,J.z>0&&J.profile!=="weave"){const In=(Lt-J.spawnTime)/1e3,ts=Math.sin(In*J.wobbleFreq*Math.PI*2+J.wobblePhase)*J.wobbleAmp*Yt,rs=Math.cos(In*J.wobbleFreq*Math.PI*2+J.wobblePhase*1.3)*J.wobbleAmp*.6*Yt;J.x+=ts*nr*1.2,J.y+=rs*nr*1.2}const Sr=(J.x-$e)/Math.max(nr,1e-4),Qr=(J.y-jt)/Math.max(nr,1e-4);J.visualVx=J.visualVx*.72+Sr*.28,J.visualVy=J.visualVy*.72+Qr*.28;const jn=1-Math.exp(-10*nr);J.bankVx+=(Ct-J.bankVx)*jn,J.prevY=J.y;{const In=I_e(J,Kt,Jt);In!==J.spriteIndex&&(J.prevSpriteIndex=J.spriteIndex,J.spriteFadeStart=Lt,J.spriteIndex=In)}J.renderScale=E_(J);const ca=N_e(J);if(J.renderCosR=Math.cos(ca)*J.renderScale,J.renderSinR=Math.sin(ca)*J.renderScale,!J.flybyPlayed&&J.z<.12&&(J.flybyPlayed=!0,Lt-_t.current>300&&(_t.current=Lt)),J.z>.05&&J.z<.7&&Math.random()<f0e&&K.current.length<12&&(K.current.push({x1:J.x,y1:J.y,x2:Kt/2+(Math.random()-.5)*Kt*.4,y2:Jt*(.7+Math.random()*.3),life:75+Math.random()*50,maxLife:125,color:"#00ff66"}),Lt-Pt.current>U0e&&(Pt.current=Lt,Lo({volume:.012}))),J.z>Xh*.3)return!0;const es=u0e*J.renderScale/2,Fa=d0e*J.renderScale/2;return J.x>-es&&J.x<Kt+es&&J.y>-Fa&&J.y<Jt+Fa}),td(W.current,J=>(J.life-=nr*1e3,J.life<=0?!1:(J.x+=J.vx*nr,J.y+=J.vy*nr,!0))),td(G.current,J=>(J.life-=nr*1e3,J.life>0)),td($.current,J=>{if(J.life-=nr*1e3,J.life<=0)return!1;const jt=2+(1-J.life/J.maxLife)*6;return J.x+=J.vx*jt*nr,J.y+=J.vy*jt*nr,!0}),td(K.current,J=>(J.life-=nr*1e3,J.life>0)),jr.current+=1,Lt-Qe.current>=1e3&&(Rt.current=jr.current,jr.current=0,Qe.current=Lt);const en=m.current,Ce=h.current??(en==null?void 0:en.getContext("2d"))??null;if(!en||!Ce){ne.current=requestAnimationFrame(Ht);return}if(h.current=Ce,!(l2<=0||Lt-ue.current>=l2)){ne.current=requestAnimationFrame(Ht);return}ue.current=Lt;const xr=x.current;if(Ce.setTransform(xr*dn,xr*Gr,xr*-Gr,xr*dn,xr*Sn,xr*Gn),N!=null&&N.complete&&N.naturalWidth>0){const J=Lt-Le.current,$e=Math.min(1,Math.max(0,J/qi)),jt=1+i0e*(.45+$e*.55),Yt=Math.hypot(Kt,Jt)/Math.min(Kt,Jt)+.08,Ot=Yt*jt,Pe=Kt*s0e,ht=Jt*o0e,It=(1-Yt)*Kt/2,Ct=(1-Yt)*Jt/2,pr=Pe+jt*(It-Pe),Pr=ht+jt*(Ct-ht),Nr=(q.current.x-Kt/2)/Kt*Kt*I2,Sr=(q.current.y-Jt/2)/Jt*Jt*(I2*.6);Ce.drawImage(N,pr+Nr,Pr+Sr,Ot*Kt,Ot*Jt)}else Ce.fillStyle="#0a0a1a",Ce.fillRect(0,0,Kt,Jt);if(Lt-lr.current>q_e||zt.current.w!==Kt||zt.current.h!==Jt){for(const $e of Fe.current){const jt=lr.current===0?0:(Lt-lr.current)/1e3;$e.x+=$e.driftX*jt,$e.y+=$e.driftY*jt,$e.x<-.25&&($e.x+=1.5),$e.x>1.25&&($e.x-=1.5),$e.y<-.25&&($e.y+=1.5),$e.y>1.25&&($e.y-=1.5)}if(!Mt.current||zt.current.w!==Kt||zt.current.h!==Jt){const $e=document.createElement("canvas");$e.width=Kt,$e.height=Jt,Mt.current=$e,zt.current={w:Kt,h:Jt}}const J=Mt.current.getContext("2d");J.clearRect(0,0,Kt,Jt);for(const $e of Fe.current){const jt=$e.x*Kt,Yt=$e.y*Jt,Ot=$e.radius*Math.max(Kt,Jt),Pe=J.createRadialGradient(jt,Yt,0,jt,Yt,Ot);Pe.addColorStop(0,$e.color),Pe.addColorStop(1,"transparent"),J.globalAlpha=$e.alpha,J.fillStyle=Pe,J.fillRect(jt-Ot,Yt-Ot,Ot*2,Ot*2)}J.globalAlpha=1,lr.current=Lt}Mt.current&&Ce.drawImage(Mt.current,0,0);const $n=Kt/2,Be=Jt/2,ut=ye.current;if(!uz&&ut>0){for(const $e of Ae.current)$e.dist+=$e.speed/ut*nr,$e.dist>mz&&($e.angle=Math.random()*Math.PI*2,$e.cosAngle=Math.cos($e.angle),$e.sinAngle=Math.sin($e.angle),$e.speed=By+Math.random()*(fz-By),$e.brightness=.3+Math.random()*.7,$e.length=.5+Math.random()*1.5,$e.dist=.01);for(const $e of U.current)$e.dist+=$e.speed/ut*nr,$e.dist>gz&&($e.angle=Math.random()*Math.PI*2,$e.speed=Fy+Math.random()*(hz-Fy),$e.size=.4+Math.random()*1.2,$e.alpha=.12+Math.random()*.3,$e.dist=.01);if(Lt-Ie.current>U_e||yt.current.w!==Kt||yt.current.h!==Jt){if(!ur.current||yt.current.w!==Kt||yt.current.h!==Jt){const Ot=document.createElement("canvas");Ot.width=Kt,Ot.height=Jt,ur.current=Ot,yt.current={w:Kt,h:Jt}}const $e=ur.current.getContext("2d");$e.clearRect(0,0,Kt,Jt);const jt=V.current;jt[0].length=0,jt[1].length=0,jt[2].length=0;for(const Ot of Ae.current){const Pe=Ot.dist*ut,ht=Ot.cosAngle,It=Ot.sinAngle,Ct=$n+ht*Pe,pr=Be+It*Pe,Pr=Ot.length*(3+8*Ot.dist),Nr=Ot.brightness*Math.min(Ot.dist/.2,1)*.6,Sr=Ot.dist<.3?0:Ot.dist<.6?1:2;jt[Sr].push([Ct,pr,Ct-ht*Pr,pr-It*Pr,Nr])}$e.strokeStyle="#cce0ff",$e.globalAlpha=.5,[.8,1.3,2].forEach((Ot,Pe)=>{if(jt[Pe].length){$e.lineWidth=Ot,$e.beginPath();for(const[ht,It,Ct,pr]of jt[Pe])$e.moveTo(ht,It),$e.lineTo(Ct,pr);$e.stroke()}}),$e.globalAlpha=1;const Yt=z.current;Yt[0].length=0,Yt[1].length=0,Yt[2].length=0;for(const Ot of U.current){const Pe=Ot.dist*ut,ht=$n+Math.cos(Ot.angle)*Pe,It=Be+Math.sin(Ot.angle)*Pe,Ct=Ot.alpha*Math.min(Ot.dist/.08,1),pr=Ct<.15?0:Ct<.3?1:2;Yt[pr].push([ht,It,Ot.size])}$e.fillStyle="#8899bb",[.1,.22,.38].forEach((Ot,Pe)=>{if(Yt[Pe].length){$e.globalAlpha=Ot,$e.beginPath();for(const[ht,It,Ct]of Yt[Pe])$e.moveTo(ht+Ct,It),$e.arc(ht,It,Ct,0,Math.PI*2);$e.fill()}}),$e.globalAlpha=1,Ie.current=Lt}ur.current&&Ce.drawImage(ur.current,0,0)}{const J=cz[d];if(J!=null&&J.complete&&J.naturalWidth>0){const $e=Math.min(1,Math.max(0,Mr/qi)),jt=$e*$e,Yt=Jt*(w2+(l0e-w2)*jt),Ot=J.naturalWidth/J.naturalHeight,Pe=Yt*Ot,ht=Kt*v2,It=Jt*_2;if(O.current===0){const Ct=Yt*1.4,pr=T_e(d,Ct);Ce.drawImage(pr,ht-Ct,It-Ct,Ct*2,Ct*2)}if(Ce.globalAlpha=.82+jt*.18,Ce.drawImage(J,ht-Pe/2,It-Yt/2,Pe,Yt),Ce.globalAlpha=1,O.current===0&&_e.current>=c0e&&(O.current=Lt),O.current>0&&(ii!=null&&ii.complete)&&ii.naturalWidth>0){const Ct=Lt-O.current;for(let pr=0;pr<3;pr++){const Pr=(Ct+pr*(C_/3))%C_/C_,Nr=Yt*(.5+Pr*2.1),Sr=(1-Pr)*(pr===0?.9:.65);Ce.globalAlpha=Sr,Ce.drawImage(ii,ht-Nr/2,It-Nr/2,Nr,Nr)}Ce.globalAlpha=1}}}const be=H.current;for(let J=1;J<be.length;J++){const $e=be[J];let jt=J-1;for(;jt>=0&&be[jt].z<$e.z;)be[jt+1]=be[jt],jt--;be[jt+1]=$e}const Se=g.current,nt=y.current&&Se!==null;Se&&nt&&Se.setShipPoses(be.map(J=>({id:J.id,x:J.x,y:J.y,z:J.z,visualVx:J.visualVx,bankVx:J.bankVx,visualVy:J.visualVy,sizeScale:J.sizeScale,spinRate:J.spinRate,spawnTime:J.spawnTime}))),Se&&Se.render(),P_e(),Math.max(St.current.length,1),Ce.globalCompositeOperation="source-over";for(const J of be);Ce.setTransform(xr*dn,xr*Gr,xr*-Gr,xr*dn,xr*Sn,xr*Gn),Ce.globalAlpha=1,Ce.globalAlpha=.7,Ce.fillStyle="#ff8c00",Ce.beginPath();for(const J of W.current){const $e=3*(J.life/J.maxLife)+1;Ce.moveTo(J.x+$e,J.y),Ce.arc(J.x,J.y,$e,0,Math.PI*2)}Ce.fill(),Ce.globalAlpha=1;const it=C_e();for(const J of G.current){const $e=1-J.life/J.maxLife,jt=J.x1+(J.x2-J.x1)*$e,Yt=J.y1+(J.y2-J.y1)*$e,Ot=J.life>J.maxLife*.2?1:J.life/(J.maxLife*.2),Pe=J.hit?"#00ffaa":"#ff4444",ht=(J.hit?18:13)*(J.width??1),It=Math.max($e-.15,0),Ct=J.x1+(J.x2-J.x1)*It,pr=J.y1+(J.y2-J.y1)*It;Ce.globalAlpha=Ot*.3,Ce.strokeStyle=Pe,Ce.lineWidth=ht*.8,Ce.lineCap="round",Ce.beginPath(),Ce.moveTo(Ct,pr),Ce.lineTo(jt,Yt),Ce.stroke(),Ce.globalAlpha=Ot*.25,Ce.fillStyle=Pe,Ce.beginPath(),Ce.arc(jt,Yt,ht*2.5,0,Math.PI*2),Ce.fill(),Ce.globalAlpha=Ot;const Pr=J.hit?it.hit:it.miss;Ce.drawImage(Pr,jt-ht,Yt-ht,ht*2,ht*2)}Ce.globalAlpha=1;for(const J of $.current){const $e=1-J.life/J.maxLife,jt=1-(1-$e)*(1-$e)*(1-$e),Yt=J.maxRadius*2*(.01+jt*.99);Ce.globalAlpha=.7*($e<.5?1:1-($e-.5)/.5),ii!=null&&ii.complete&&ii.naturalWidth>0?Ce.drawImage(ii,J.x-Yt/2,J.y-Yt/2,Yt,Yt):(Ce.fillStyle=J.color,Ce.beginPath(),Ce.arc(J.x,J.y,Yt/2,0,Math.PI*2),Ce.fill())}Ce.globalAlpha=1;const Bt=R_e();for(const J of de.current){if(!J.alive)continue;const $e=Math.max(0,1-J.z),jt=8+$e*34,Yt=.55+.45*Math.sin((Lt-J.spawnMs)*.018),Ot=J.x-J.originX,Pe=J.y-J.originY,ht=Math.hypot(Ot,Pe)||1,It=Ot/ht,Ct=Pe/ht,pr=-Ct,Pr=It,Nr=jt*2.7,Sr=jt*.72,Qr=J.x-It*Nr,jn=J.y-Ct*Nr,ca=jt*(3.8+Yt*1.2),es=Qr-It*ca,Fa=jn-Ct*ca,In=Ce.createLinearGradient(J.originX,J.originY,J.x,J.y);if(In.addColorStop(0,"rgba(255, 102, 51, 0)"),In.addColorStop(.65,"rgba(255, 55, 22, 0.48)"),In.addColorStop(1,"rgba(255, 214, 105, 0.92)"),Ce.globalAlpha=.45+$e*.5,Ce.fillStyle=In,Ce.beginPath(),Ce.moveTo(J.originX,J.originY),Ce.lineTo(Qr+pr*Sr,jn+Pr*Sr),Ce.lineTo(Qr-pr*Sr,jn-Pr*Sr),Ce.closePath(),Ce.fill(),Ce.globalAlpha=.72+Yt*.22,Ce.fillStyle="#ff4a1f",Ce.beginPath(),Ce.moveTo(Qr+pr*Sr*.55,jn+Pr*Sr*.55),Ce.lineTo(es,Fa),Ce.lineTo(Qr-pr*Sr*.55,jn-Pr*Sr*.55),Ce.closePath(),Ce.fill(),Ce.globalAlpha=.92,Ce.strokeStyle="#fff2b0",Ce.lineWidth=Math.max(1.5,jt*.18),Ce.beginPath(),Ce.moveTo(Qr,jn),Ce.lineTo(Qr-It*ca*.72,jn-Ct*ca*.72),Ce.stroke(),Ce.globalAlpha=1,Kp!=null&&Kp.complete&&Kp.naturalWidth>0){const ts=jt*5,rs=jt*2.5;Ce.save(),Ce.translate(J.x-It*jt*.9,J.y-Ct*jt*.9),Ce.rotate(Math.atan2(Ct,It)+Math.PI),Ce.drawImage(Kp,-ts/2,-rs/2,ts,rs),Ce.restore()}else Ce.fillStyle="#4a1015",Ce.strokeStyle="#ff6b39",Ce.lineWidth=Math.max(1.5,jt*.12),Ce.beginPath(),Ce.moveTo(J.x+It*jt*.9,J.y+Ct*jt*.9),Ce.lineTo(J.x-It*Nr*.78+pr*Sr,J.y-Ct*Nr*.78+Pr*Sr),Ce.lineTo(Qr+pr*Sr*1.65,jn+Pr*Sr*1.65),Ce.lineTo(Qr-pr*Sr*1.65,jn-Pr*Sr*1.65),Ce.lineTo(J.x-It*Nr*.78-pr*Sr,J.y-Ct*Nr*.78-Pr*Sr),Ce.closePath(),Ce.fill(),Ce.stroke();Ce.globalAlpha=.95,Ce.fillStyle="#fff4c2",Ce.beginPath(),Ce.arc(J.x+It*jt*.35,J.y+Ct*jt*.35,jt*.42,0,Math.PI*2),Ce.fill(),Ce.globalAlpha=(.25+$e*.35)*Yt,Ce.strokeStyle="#ff3028",Ce.lineWidth=Math.max(1.5,jt*.08),Ce.beginPath(),Ce.arc(J.x,J.y,jt*(1.5+Yt*.45),0,Math.PI*2),Ce.stroke(),Ce.globalAlpha*=.55,Ce.beginPath(),Ce.arc(J.x,J.y,jt*(2.5+Yt*.7),0,Math.PI*2),Ce.stroke()}Ce.globalAlpha=1;for(const J of K.current){const $e=1-J.life/J.maxLife,jt=J.x1+(J.x2-J.x1)*$e,Yt=J.y1+(J.y2-J.y1)*$e,Ot=J.life>J.maxLife*.2?1:J.life/(J.maxLife*.2),Pe=14,ht=Math.max($e-.12,0),It=J.x1+(J.x2-J.x1)*ht,Ct=J.y1+(J.y2-J.y1)*ht;Ce.globalAlpha=Ot*.3,Ce.strokeStyle=J.color,Ce.lineWidth=Pe*.7,Ce.lineCap="round",Ce.beginPath(),Ce.moveTo(It,Ct),Ce.lineTo(jt,Yt),Ce.stroke(),Ce.globalAlpha=Ot*.2,Ce.fillStyle=J.color,Ce.beginPath(),Ce.arc(jt,Yt,Pe*3,0,Math.PI*2),Ce.fill(),Ce.globalAlpha=Ot,Ce.drawImage(Bt,jt-Pe,Yt-Pe,Pe*2,Pe*2)}if(Ce.globalAlpha=1,K.current.length>0){let J=0;for(const jt of K.current){const Yt=jt.life/jt.maxLife;Yt>J&&(J=Yt)}const $e=J*($s?.18:.35);Ce.globalAlpha=$e,Ce.fillStyle="#00ff50",Ce.fillRect(0,0,Kt,Jt),Ce.globalAlpha=1}if(Ce.setTransform(xr,0,0,xr,0,0),!br.current||fr.current.w!==Kt||fr.current.h!==Jt){const J=document.createElement("canvas");J.width=Kt,J.height=Jt;const $e=J.getContext("2d"),jt=$e.createRadialGradient(Kt/2,Jt/2,Math.min(Kt,Jt)*.35,Kt/2,Jt/2,Math.max(Kt,Jt)*.75);jt.addColorStop(0,"transparent"),jt.addColorStop(1,"rgba(0,0,0,0.45)"),$e.fillStyle=jt,$e.fillRect(0,0,Kt,Jt),br.current=J,fr.current={w:Kt,h:Jt}}Ce.drawImage(br.current,0,0);const{x:ir,y:er}=q.current;if(ir>0&&er>0&&!ke.current){Ce.globalAlpha=.25,Ce.strokeStyle="#00ffaa",Ce.lineWidth=6,Ce.beginPath(),Ce.arc(ir,er,nd,0,Math.PI*2),Ce.stroke(),Ce.globalAlpha=1,Ce.lineWidth=1.5,Ce.beginPath(),Ce.arc(ir,er,nd,0,Math.PI*2),Ce.stroke();const J=6;Ce.beginPath(),Ce.moveTo(ir-nd-J,er),Ce.lineTo(ir-J,er),Ce.moveTo(ir+J,er),Ce.lineTo(ir+nd+J,er),Ce.moveTo(ir,er-nd-J),Ce.lineTo(ir,er-J),Ce.moveTo(ir,er+J),Ce.lineTo(ir,er+nd+J),Ce.stroke(),Ce.fillStyle="#00ffaa",Ce.beginPath(),Ce.arc(ir,er,2,0,Math.PI*2),Ce.fill()}if(X.current!==null){const{x:J,y:$e}=Z.current,{dx:jt,dy:Yt}=Q.current,Ot=Math.min(Math.sqrt(jt*jt+Yt*Yt),j_),Pe=Math.atan2(Yt,jt);Ce.save(),Ce.globalAlpha=.25,Ce.strokeStyle="#00ffaa",Ce.lineWidth=2,Ce.beginPath(),Ce.arc(J,$e,j_,0,Math.PI*2),Ce.stroke(),Ce.globalAlpha=.5,Ce.fillStyle="#00ffaa",Ce.beginPath(),Ce.arc(J+Math.cos(Pe)*Ot,$e+Math.sin(Pe)*Ot,16,0,Math.PI*2),Ce.fill(),Ce.restore()}const mr=lz[ct.current];if(mr!=null&&mr.complete&&mr.naturalWidth>0){const J=kt.current;Lt>=J.nextBurstTs&&(J.untilTs=Lt+yc(q0e,V0e),J.nextBurstTs=Lt+yc(R2,T2),J.targetTilt=yc(-Kh,Kh)),Lt<=J.untilTs?(J.x=yc(-Yh,Yh),J.y=yc(-Yh,Yh)):(J.x=0,J.y=0,J.targetTilt=0),J.tilt+=(J.targetTilt-J.tilt)*Math.min(1,nr*3);const $e=Ee.current,jt=Math.max(-j2,Math.min(j2,$e.pitchVel/G0e)),Yt=J.tilt,Ot=Math.cos(Yt),Pe=Math.sin(Yt),ht=Kt/2,It=Jt/2;Ce.setTransform(xr*Ot,xr*Pe,xr*-Pe,xr*Ot,xr*(ht*(1-Ot)+It*Pe),xr*(It*(1-Ot)-ht*Pe)),Ce.globalAlpha=.35,Ce.drawImage(mr,-Zh+J.x,-Zh+J.y+jt,Kt+Zh*2,Jt+Zh*2),Ce.setTransform(xr,0,0,xr,0,0),Ce.globalAlpha=1}{const J=Jt*.3,$e=Kt*.06,Yt=(R1[ct.current]??v_e)[dt.current-1];if(Yt!=null&&Yt.complete&&Yt.naturalWidth>0){const Ot=Lt-B.current,Pe=Math.max(0,1-Ot/Z0e),ht=Math.sin(Pe*Math.PI)*Y0e,It=J*(Yt.naturalWidth/Yt.naturalHeight),{x:Ct,y:pr}=q.current,Pr=Jt,Nr=Kt/2-$e,Sr=Math.atan2(pr-Pr,Ct-Nr)+Math.PI/2,Qr=Math.cos(Sr),jn=Math.sin(Sr);Ce.setTransform(xr*Qr,xr*jn,xr*-jn,xr*Qr,xr*(Nr-jn*ht),xr*(Pr+Qr*ht)),Ce.globalAlpha=X0e,Ce.drawImage(Yt,-It/2,-J,It,J);const ca=Kt/2+$e,es=Math.atan2(pr-Pr,Ct-ca)+Math.PI/2,Fa=Math.cos(es),In=Math.sin(es);Ce.setTransform(xr*-Fa,xr*-In,xr*-In,xr*Fa,xr*(ca-In*ht),xr*(Pr+Fa*ht)),Ce.drawImage(Yt,-It/2,-J,It,J),Ce.setTransform(xr,0,0,xr,0,0),Ce.globalAlpha=1}}if(ve.current){Ce.save(),Ce.strokeStyle="rgba(255,255,0,0.35)",Ce.lineWidth=1;for(const J of H.current)Ce.beginPath(),Ce.arc(J.x,J.y,x2*E_(J),0,Math.PI*2),Ce.stroke();Ce.fillStyle="rgba(0,0,0,0.7)",Ce.fillRect(8,Jt-110,220,100),Ce.font="12px monospace",Ce.fillStyle="#0f0",Ce.fillText(`FPS: ${Rt.current}`,16,Jt-90),Ce.fillText(`Ships: ${H.current.length}`,16,Jt-74),Ce.fillText(`Spawned: ${re.current}`,16,Jt-58),Ce.fillText(`Lasers: ${G.current.length}`,16,Jt-42),Ce.fillText(`Hits: ${_e.current}`,16,Jt-26),Ce.restore()}const hr=1500;Br<hr&&(Ce.fillStyle=`rgba(0,0,0,${1-Br/hr})`,Ce.fillRect(0,0,Kt,Jt)),ne.current=requestAnimationFrame(Ht)};return ne.current=requestAnimationFrame(Ht),()=>{var Lt;cancelAnimationFrame(ne.current),Te&&cancelAnimationFrame(Te),window.removeEventListener("resize",Ve),tt==null||tt.removeEventListener("resize",Ve),(Lt=oe.current)==null||Lt.call(oe)}},[v,Xt,je,N]),l.useEffect(()=>{var tt;if(v!=="result")return;const Te=Oe(_e.current);(tt=Ue.current)==null||tt.call(Ue,{hits:_e.current,totalSpawned:re.current,elapsedMs:qi,durationMs:qi,status:"complete"}),E(c?u?{...Te,winnerId:u.winnerId,creditsStolen:u.creditsStolen}:null:Te);const Ve=window.setTimeout(()=>{r({...Te,finalHits:_e.current,totalSpawned:re.current})},3e3);return()=>window.clearTimeout(Ve)},[Oe,r,v,c,u,o,e.id]);const wr=l.useMemo(()=>Yr(d),[d]),dr=l.useMemo(()=>Yr(p),[p]),Vt=l.useMemo(()=>N2(e.heroId),[e.heroId]),Je=k?Math.max(1,k.attackerRoll+k.defenderRoll):Math.max(1,pe),mt=v==="result"&&!!k&&k.winnerId===e.id;return a.jsxs("div",{ref:f,className:"raid-fps-overlay",children:[a.jsx("canvas",{ref:m,className:"raid-fps-canvas"}),a.jsx("canvas",{ref:b,className:"raid-fps-3d-canvas"}),I&&a.jsx("img",{src:S,alt:"","aria-hidden":"true",className:"raid-fps-context-lost-bg",draggable:!1}),a.jsxs("div",{className:"raid-fps-hud",children:[a.jsxs("div",{className:"raid-fps-hud-left",children:[a.jsx("span",{className:"raid-fps-label",children:c?"COVER FIRE":"HITS"}),a.jsx("span",{className:"raid-fps-value",children:j})]}),a.jsxs("div",{className:"raid-fps-hud-center",children:[a.jsx("span",{className:"raid-fps-title",children:c?`Defending against ${dr}`:`Raid on ${wr}`}),Vt&&a.jsxs("span",{className:"raid-fps-subtitle",children:["Hero Level ",Vt]}),!c&&!o&&a.jsx("span",{className:"raid-fps-hull-pips","aria-label":`Hull integrity: ${T_-F} of ${T_}`,children:Array.from({length:T_}).map((Te,Ve)=>a.jsx("span",{className:`raid-fps-hull-pip${Ve<F?" raid-fps-hull-pip--lost":""}`},Ve))})]}),a.jsxs("div",{className:"raid-fps-hud-right",children:[a.jsx("span",{className:"raid-fps-label",children:"TIME"}),a.jsxs("span",{className:"raid-fps-value",children:[Math.ceil(R/1e3),"s"]})]})]}),!1,v==="countdown"&&a.jsxs("div",{className:"raid-fps-countdown",children:[a.jsx("img",{src:p_e,alt:"","aria-hidden":"true",className:"raid-fps-countdown-video",draggable:!1}),a.jsx("div",{className:"raid-fps-countdown-overlay"}),a.jsx("div",{className:"raid-fps-countdown-alert",children:"Enemy fighters detected"}),a.jsx("div",{className:"raid-fps-countdown-label",children:"Prepare to defend"}),Vt&&a.jsxs("div",{className:"raid-fps-countdown-hero",children:[dr," Hero Level ",Vt]}),a.jsx("div",{className:"raid-fps-countdown-num",children:_||"GO!"})]}),v==="result"&&!k&&c&&a.jsxs("div",{className:"raid-fps-result",children:[a.jsx("div",{className:"raid-fps-result-title",children:"Calculating outcome…"}),a.jsx("div",{className:"raid-fps-result-stats",children:"Awaiting battle report"})]}),v==="result"&&k&&(()=>{const Te=!o,Ve=Te&&c?!mt:mt,tt=Te?Ve?c?`${wr} defended!`:`${dr} wins the raid!`:c?`${dr} broke through!`:`${wr} defended!`:mt?`${dr} wins the raid!`:`${wr} defended!`,Et=Te?Ve?"+":"-":mt?"+":"-",Qt=!c;return a.jsxs("div",{className:"raid-fps-result",children:[a.jsx("div",{className:`raid-fps-result-title ${Ve?"win":"lose"}`,children:tt}),Qt&&a.jsxs("div",{className:"raid-fps-result-stats",children:[j," / ",Je," ships destroyed"]}),a.jsxs("div",{className:"raid-fps-result-credits",children:[Et,k.creditsStolen," energy"]})]})})(),o&&v!=="result"&&a.jsx("div",{className:"raid-fps-spectator-badge",children:"SPECTATING"}),(v==="countdown"||v==="playing"&&!o)&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-no-global-haptic":!0,className:`raid-fps-pad-zone${v==="countdown"?" raid-fps-control-preview":""}`,onTouchStart:Te=>{Te.stopPropagation();const Ve=Te.changedTouches[0];X.current=Ve.identifier;const tt=m.current;if(tt){const Ht=tt.getBoundingClientRect();Z.current={x:Ve.clientX-Ht.left,y:Ve.clientY-Ht.top}}Q.current={dx:0,dy:0};const Et=Ht=>{for(let Lt=0;Lt<Ht.changedTouches.length;Lt+=1){const nr=Ht.changedTouches[Lt];if(nr.identifier!==X.current)continue;const Mr=m.current;if(!Mr)return;const Br=Mr.getBoundingClientRect();Q.current={dx:nr.clientX-Br.left-Z.current.x,dy:nr.clientY-Br.top-Z.current.y}}},Qt=()=>{X.current=null,Q.current={dx:0,dy:0},document.removeEventListener("touchmove",Et),document.removeEventListener("touchend",or),document.removeEventListener("touchcancel",or),oe.current=null},or=Ht=>{for(let Lt=0;Lt<Ht.changedTouches.length;Lt+=1)if(Ht.changedTouches[Lt].identifier===X.current){Qt();break}};oe.current=Qt,document.addEventListener("touchmove",Et,{passive:!0}),document.addEventListener("touchend",or),document.addEventListener("touchcancel",or)},onMouseDown:Te=>{Te.stopPropagation(),Te.preventDefault(),X.current=-1;const Ve=m.current;if(Ve){const or=Ve.getBoundingClientRect();Z.current={x:Te.clientX-or.left,y:Te.clientY-or.top}}Q.current={dx:0,dy:0};const tt=or=>{const Ht=m.current;if(!Ht)return;const Lt=Ht.getBoundingClientRect();Q.current={dx:or.clientX-Lt.left-Z.current.x,dy:or.clientY-Lt.top-Z.current.y}},Et=()=>{X.current=null,Q.current={dx:0,dy:0},document.removeEventListener("mousemove",tt),document.removeEventListener("mouseup",Qt),oe.current=null},Qt=()=>Et();oe.current=Et,document.addEventListener("mousemove",tt),document.addEventListener("mouseup",Qt)},children:a.jsxs("div",{className:"raid-fps-pad-icon",children:[a.jsxs("svg",{width:"56",height:"56",viewBox:"0 0 48 48",fill:"none",children:[a.jsx("circle",{cx:"24",cy:"24",r:"22",stroke:"rgba(0,255,170,0.5)",strokeWidth:"2.5"}),a.jsx("circle",{cx:"24",cy:"24",r:"8",fill:"rgba(0,255,170,0.35)"}),a.jsx("path",{d:"M24 6 L24 14 M24 34 L24 42 M6 24 L14 24 M34 24 L42 24",stroke:"rgba(0,255,170,0.5)",strokeWidth:"2.5",strokeLinecap:"round"})]}),a.jsx("span",{className:"raid-fps-pad-label",children:"AIM"})]})}),a.jsx("button",{"data-no-global-haptic":!0,className:`raid-fps-fire-btn${v==="countdown"?" raid-fps-control-preview":""}`,onPointerDown:Te=>{Te.stopPropagation(),Te.preventDefault();try{Te.currentTarget.setPointerCapture(Te.pointerId)}catch{}Ut()},onPointerUp:Te=>{Te.stopPropagation();try{Te.currentTarget.releasePointerCapture(Te.pointerId)}catch{}Dt()},onPointerCancel:Te=>{Te.stopPropagation();try{Te.currentTarget.releasePointerCapture(Te.pointerId)}catch{}Dt()},onClick:Te=>{Te.stopPropagation(),v==="playing"&&!le.current&&at()},children:"FIRE"})]})]})},K0e=["⬡","◈","✦","⬢","◉","⧫","Δ","Ψ","Σ"],bf=[3,4,5],I_=bf.reduce((e,t)=>e+t,0),Q0e=[350,260,190],J0e=90,$0e=2200,Qh=900,M2=1800,Qp=5e3,bz=({attacker:e,defender:t,onComplete:r,isSpectator:n=!1})=>{const[s,o]=l.useState("intro"),[i,c]=l.useState(3),[u,p]=l.useState(0),[d,f]=l.useState([]),[m,h]=l.useState(null),[b,g]=l.useState([]),[y,x]=l.useState(!1),[v,A]=l.useState(null),[_,w]=l.useState(null),[j,T]=l.useState(Qp/1e3),R=l.useRef(0),P=l.useRef(r);P.current=r;const k=l.useRef([]),E=l.useCallback(()=>{k.current.forEach(clearTimeout),k.current=[]},[]),M=l.useCallback((H,W)=>{const G=setTimeout(H,W);k.current.push(G)},[]);l.useEffect(()=>E,[E]);const C=l.useCallback(H=>{E();const W=bf[H],G=Array.from({length:W},()=>Math.floor(Math.random()*9));p(H),f(G),g([]),h(null),o("reveal")},[E]);l.useEffect(()=>{if(s!=="intro")return;R.current=0;const H=setTimeout(()=>{c(3),o("countdown")},$0e);return()=>clearTimeout(H)},[s]),l.useEffect(()=>{s==="countdown"&&(E(),M(()=>c(2),Qh),M(()=>c(1),Qh*2),M(()=>c("GO!"),Qh*3),M(()=>C(0),Qh*3+600))},[s,E,M,C]),l.useEffect(()=>{if(s!=="reveal"||d.length===0)return;T(Qp/1e3),E();const H=Q0e[u];let W=500;for(let G=0;G<d.length;G++){const $=d[G];M(()=>h($),W),W+=H,M(()=>h(null),W),W+=J0e}M(()=>o("input"),W+100)},[s,u,d,E,M]);const I=l.useRef([]);l.useEffect(()=>{I.current=b},[b]),l.useEffect(()=>{if(s!=="input"||n)return;T(Qp/1e3);const H=Date.now(),W=window.setInterval(()=>{const $=Date.now()-H,K=Math.max(0,Math.ceil((Qp-$)/1e3));T(K)},200),G=window.setTimeout(()=>{o($=>{if($!=="input")return $;const K=I.current;let de=0;for(let we=0;we<K.length&&K[we]===d[we];we++)de++;R.current+=de,x(!1);const ie=u+1;return M(()=>{if(ie>=bf.length){const we=Oy(R.current,I_,e,t);w(we),o("result"),P.current(we)}else C(ie)},M2),"roundResult"})},Qp);return()=>{window.clearInterval(W),window.clearTimeout(G)}},[s,n,d,u,e,t,M,C]);const L=l.useCallback(H=>{if(s!=="input"||n)return;const W=[...b,H],G=W.length-1,$=d[G]===H;if(na($?"Light":"Medium").catch(()=>{}),A({cell:H,ok:$}),M(()=>A(null),250),!$||W.length===d.length){let K=0;for(let we=0;we<W.length&&W[we]===d[we];we++)K++;R.current+=K;const de=$&&W.length===d.length;x(de),g(W),o("roundResult"),na(de?"Heavy":"Medium").catch(()=>{});const ie=u+1;M(()=>{if(ie>=bf.length){const we=Oy(R.current,I_,e,t);w(we),o("result"),na(we.winnerId===e.id?"Heavy":"Medium").catch(()=>{}),P.current(we)}else C(ie)},M2)}else g(W)},[s,n,b,d,u,e,t,M,C]),N=H=>H.piece.replace(/-/g," ").replace(/\b\w/g,W=>W.toUpperCase()),S=N(e),F=N(t),D=(_==null?void 0:_.winnerId)===e.id;return a.jsxs("div",{className:"zcb-overlay",children:[s==="intro"&&a.jsxs("div",{className:"zcb-intro",children:[a.jsx("div",{className:"zcb-intro-alert",children:"⚠ INTRUSION DETECTED ⚠"}),a.jsxs("div",{className:"zcb-intro-title",children:["DECRYPTION",a.jsx("br",{}),"BREACH"]}),a.jsxs("div",{className:"zcb-intro-vs",children:[a.jsx("span",{className:"zcb-intro-atk",children:S}),a.jsx("span",{className:"zcb-intro-arrow",children:"⟶"}),a.jsx("span",{className:"zcb-intro-def",children:F})]}),a.jsx("div",{className:"zcb-intro-rule"}),a.jsx("div",{className:"zcb-intro-body",children:a.jsx("span",{className:"zcb-intro-body-line",children:"Memorize the flashing sequence — then tap it back, in order."})}),a.jsx("div",{className:"zcb-intro-blink",children:"INITIALIZING ENCRYPTION BREACH…"})]}),s==="countdown"&&a.jsxs("div",{className:"zcb-countdown",children:[a.jsx("div",{className:"zcb-countdown-label",children:"DECRYPTION BREACH"}),a.jsx("div",{className:`zcb-countdown-num${i==="GO!"?" zcb-countdown-go":""}`,children:i},String(i)),a.jsx("div",{className:"zcb-countdown-sub",children:i==="GO!"?"MEMORIZE THE SEQUENCE":"PREPARE"})]}),(s==="reveal"||s==="input"||s==="roundResult")&&a.jsxs("div",{className:"zcb-game",children:[a.jsxs("div",{className:"zcb-game-left",children:[a.jsxs("div",{className:"zcb-game-header",children:[a.jsx("div",{className:"zcb-game-title",children:"DECRYPTION BREACH"}),a.jsxs("div",{className:"zcb-game-round",children:["LAYER ",u+1," / ",bf.length]})]}),a.jsxs("div",{className:`zcb-status-bar${s==="roundResult"?y?" zcb-status-pass":" zcb-status-fail":""}`,children:[s==="reveal"&&"OBSERVE…",s==="input"&&!n&&`${b.length} / ${d.length} — ${j}s`,s==="input"&&n&&"DECRYPTING…",s==="roundResult"&&(y?"✓ CRACKED":"✗ FAILED")]}),s==="input"&&!n&&a.jsx("div",{className:"zcb-progress",children:d.map((H,W)=>a.jsx("span",{className:`zcb-pip${W<b.length?" zcb-pip-done":""}`},W))})]}),a.jsx("div",{className:"zcb-grid",children:K0e.map((H,W)=>{const G=m===W,$=(v==null?void 0:v.cell)===W,K=$&&(v==null?void 0:v.ok),de=$&&!(v!=null&&v.ok),ie=["zcb-cell",G?"zcb-cell--lit":"",K?"zcb-cell--ok":"",de?"zcb-cell--bad":"",s==="input"&&!n?"zcb-cell--active":""].filter(Boolean).join(" ");return a.jsx("button",{className:ie,onPointerDown:()=>L(W),disabled:s!=="input"||n,children:H},W)})})]}),s==="result"&&_&&a.jsxs("div",{className:"zcb-result",children:[a.jsx("div",{className:`zcb-result-verdict${D?" zcb-result-win":" zcb-result-lose"}`,children:D?`BREACH
SUCCESSFUL`:`ENCRYPTION
HELD`}),a.jsxs("div",{className:"zcb-result-score",children:[R.current," / ",I_," sequences cracked"]}),a.jsx("div",{className:"zcb-result-credits",children:D?`${S} extracted ✦${_.creditsStolen}`:`${F} repelled the breach`})]})]})},L2=""+new URL("zentara_bg_station-CAwho_RD.webp",import.meta.url).href,ewe=""+new URL("zentara_bg_asteroid-JpVBwON4.webp",import.meta.url).href,twe=""+new URL("zentara_bg_wormhole-ByrGMZDT.webp",import.meta.url).href,D2=""+new URL("zentara_bg_tax-D9cuUCQx.webp",import.meta.url).href,rwe=""+new URL("zentara_bg_jail-CSIhqvMO.webp",import.meta.url).href,nwe=""+new URL("zentara_bg_go-to-jail-Cn-gffQl.webp",import.meta.url).href,awe=""+new URL("zentara_bg_free-parking-BZgv5fD7.webp",import.meta.url).href,swe=""+new URL("galaxy_bg-EkKFwwxn.webp",import.meta.url).href,owe=9e4,iwe=1800,lwe=2400,cwe=900,vz=200,Wd=120,uwe=240,O2=1200,dwe=2400,pwe=1.4,_z=1200,lp=2e3,Fc=5,fwe=9,mwe=-14,hwe=-26,Jh=2.2,gwe=4,ywe=9,bwe=-1.5,vwe=-7,z2=55,_we=7,wwe=2200,xwe=800,N_=110,Awe=18,kwe=3,Swe=380,Ewe=950,Pwe=14,Cwe=.32,Rwe=3.2,Twe=.62,jwe=18,Iwe=24,M_=.08,B2=-3.4,F2=3.4,U2=-50,q2=3,$h=100,Nwe=T1?1:$s?1.25:1.75;function V2(e,t,r,n){const s=r?e.id:t.id,i=n?Math.min(vz,(r?t:e).credits):0;return{attackerRoll:r?1:0,defenderRoll:r?0:1,attackerTotal:r?1:0,defenderTotal:r?0:1,winnerId:s,creditsStolen:Math.max(0,i),finalHits:r?1:0,totalSpawned:1}}const eg={muzzle:{x:0,y:40,z:0},weapon:{x:0,y:0,z:0,tiltX:-.08,tiltY:0,tiltZ:0},forceMuzzle:!1},wz="/zentara/soldier/enemy-soldier.glb?v=7";zl.preload(wz);const Mwe=({enemy:e,empireId:t})=>{const r=l.useRef(null),n=l.useRef(null),s=l.useRef(null),o=l.useRef(null),i=l.useRef(null),c=l.useRef(null),u=l.useRef(null),p=l.useRef({x:0,y:0,leanZ:0}),d=l.useRef(null),f=l.useMemo(()=>{const M=new Xn(e.color).multiplyScalar(2.6);return new Mo({color:M,transparent:!0,opacity:0,blending:la,depthWrite:!1,toneMapped:!1})},[e.color]),{scene:m,animations:h}=zl(wz),b=l.useMemo(()=>T3.clone(m),[m]);l.useLayoutEffect(()=>{b.traverse(M=>{const C=M;if(!C.isSkinnedMesh||!C.skeleton)return;const I=new Set;if(C.skeleton.bones.forEach((H,W)=>{/head|neck/i.test(H.name)&&I.add(W)}),I.size===0)return;const L=C.geometry,N=L.getAttribute("skinIndex"),S=L.getAttribute("skinWeight");if(!N||!S)return;const F=L.getAttribute("position").count,D=new Float32Array(F*3);for(let H=0;H<F;H++){let W=0;for(let $=0;$<4;$++){const K=N.getComponent(H,$);I.has(K)&&(W+=S.getComponent(H,$))}const G=W>.5;D[H*3+0]=G?0:1,D[H*3+1]=G?0:1,D[H*3+2]=G?0:1}L.setAttribute("color",new Gd(D,3))})},[b]),l.useLayoutEffect(()=>{const M=new Y1(3.5,12,8),C=new Mo({color:16734746,toneMapped:!1}),I=[];return b.traverse(L=>{if(/shoulder/i.test(L.name)&&!/end/i.test(L.name)){const N=new Hi(M,C);N.position.set(0,0,4),N.renderOrder=5,L.add(N),I.push(N)}}),()=>{I.forEach(L=>{var N;return(N=L.parent)==null?void 0:N.remove(L)}),M.dispose(),C.dispose()}},[b]);const g=l.useRef(null);l.useLayoutEffect(()=>{b.traverse(M=>{!g.current&&/hips$/i.test(M.name)&&(g.current=M)})},[b]);const y=l.useMemo(()=>h.map(M=>{const C=M.clone();return C.tracks=C.tracks.filter(I=>!/Hips\.position/i.test(I.name)),C}),[h]);l.useLayoutEffect(()=>{if(b.traverse(I=>{(I.isSkinnedMesh||I.isMesh)&&(I.frustumCulled=!1)}),!r.current)return;r.current.updateWorldMatrix(!0,!0);let M=1/0;const C=new An;if(b.traverse(I=>{I.isBone&&(I.getWorldPosition(C),C.y<M&&(M=C.y))}),isFinite(M)){const I=r.current.position.y,L=r.current.scale.y||1,N=(I-M)/L;b.position.y+=N}else b.position.y+=1},[b]);const{actions:x,names:v}=j3(y,b),A=l.useMemo(()=>{const M=new Xn(e.color),C=[];return b.traverse(I=>{const L=I;if(!L.isMesh)return;const N=F=>{const D=F.clone();D.color&&(D.color.lerp(M,.45),D.color.multiplyScalar(.55)),D.emissive||(D.emissive=new Xn(0)),D.emissive.copy(M).multiplyScalar(.22),D.emissiveIntensity=.1,D.metalness=Math.min(1,(D.metalness??0)+.25),D.roughness=Math.max(.25,(D.roughness??.6)-.1),D.vertexColors=!0;const H={value:M.clone()};return D.onBeforeCompile=W=>{W.uniforms.uFaction=H,W.vertexShader=W.vertexShader.replace("void main() {",`varying vec3 vBindPos;
void main() {`).replace("#include <begin_vertex>",`#include <begin_vertex>
vBindPos = position;`),W.fragmentShader=W.fragmentShader.replace("void main() {",`uniform vec3 uFaction;
varying vec3 vBindPos;
void main() {`).replace("#include <emissivemap_fragment>",`#include <emissivemap_fragment>
                             // Per-vertex head/body mask (1 = body, 0 = head).
                             vec3 vMask = vec3(1.0);
                             #ifdef USE_COLOR
                                vMask = vColor;
                             #endif
                             // Gate the base faction emissive by the head mask.
                             totalEmissiveRadiance *= vMask;

                             // ── Procedural emissive armor strips ─────
                             // Two thin horizontal bands at chest and waist
                             // height in object space (un-skinned position).
                             // Bind-pose Y values measured from GLB inspect:
                             //   chest ≈ 1.45m, waist ≈ 1.00m (model is ~1.79 tall).
                             float chestBand = exp(-pow((vBindPos.y - 1.45) * 26.0, 2.0));
                             float waistBand = exp(-pow((vBindPos.y - 1.00) * 32.0, 2.0));
                             float stripGlow = chestBand * 1.2 + waistBand * 0.7;
                             totalEmissiveRadiance += stripGlow * uFaction * vMask;

                             // ── Crisper fresnel rim ──────────────────
                             // Boosted slightly now that the base armor is
                             // darker — rim lighting carries the silhouette.
                             vec3 rimViewDir = normalize(vViewPosition);
                             float rim = pow(1.0 - clamp(dot(rimViewDir, normal), 0.0, 1.0), 2.2);
                             totalEmissiveRadiance += rim * uFaction * 1.25 * vMask;
                            `)},D.needsUpdate=!0,C.push(D),D},S=L.material;L.material=Array.isArray(S)?S.map(N):N(S)}),C},[b,e.color]),_=M=>v.includes(M),w=l.useMemo(()=>v.filter(M=>M==="die"||M.startsWith("die-")||M.startsWith("die_")||/^die\d+$/.test(M)),[v]),j=(M,C,I,L)=>{if(M==="dead")return w.length===0?null:((!u.current||!w.includes(u.current))&&(u.current=w[Math.random()*w.length|0]),u.current);u.current&&(u.current=null);const N=C*Math.cos(L),S=.22;return N>S&&_("walk-right")?"walk-right":N<-S&&_("walk-left")?"walk-left":I?_("run")?"run":_("walk")?"walk":_("idle")?"idle":null:_("aim")?"aim":_("idle")?"idle":null},T=M=>{const C=c.current;if(M===C)return;const I=C?x[C]:null,L=M?x[M]:null;if(!(M!==null&&!L)){if(c.current=M,L){L.enabled=!0;const N=L.time,S=L.getClip();L.reset();const F=!!M&&(M==="die"||M.startsWith("die-")||M.startsWith("die_")||/^die\d+$/.test(M));N>0&&S.duration>0&&!F&&(L.time=N%S.duration),F?(L.setLoop(I3,1),L.clampWhenFinished=!0,L.timeScale=1):(L.setLoop(Z1,1/0),L.clampWhenFinished=!1,M==="walk-left"||M==="walk-right"?L.timeScale=S.duration>0?S.duration/.68:2.5:M==="run"?L.timeScale=.8:M==="walk"?L.timeScale=1.05:L.timeScale=1),L.fadeIn(.22).play()}I&&I!==L&&I.fadeOut(.22)}};l.useEffect(()=>{if(v.length===0)return;const M=["aim","idle","run","walk"].find(I=>v.includes(I));if(!M)return;const C=x[M];C&&(C.isRunning()||(C.reset(),C.setLoop(Z1,1/0),C.fadeIn(.05).play(),c.current=M))},[v,x]);const R=l.useMemo(()=>new Mo({color:1114112,transparent:!0,opacity:.75,depthTest:!1}),[]),P=l.useMemo(()=>new Mo({color:16729173,transparent:!0,opacity:.95,depthTest:!1}),[]),k=l.useMemo(()=>xz(),[]),E=l.useMemo(()=>new Mo({color:16767078,transparent:!0,opacity:0,blending:la,depthWrite:!1}),[]);return l.useLayoutEffect(()=>{const M=[],C=new tf;C.name="enemy-weapon",C.frustumCulled=!1,i.current=C;const I=new Ua({color:1710621,metalness:.7,roughness:.45,emissive:0}),L=new Ua({color:2763312,metalness:.6,roughness:.55}),N=new dd(5,22,5.5),S=new Hi(N,I);S.position.set(0,12,0),C.add(S);const F=new rj(1.3,1.3,18,10),D=new Hi(F,I);D.position.set(0,30,.5),C.add(D);const H=new dd(4,11,5),W=new Hi(H,L);W.position.set(0,-5,.2),C.add(W);const G=new dd(3.6,5,9),$=new Hi(G,L);$.position.set(0,8,-6),C.add($);const K=new dd(3.4,3.4,7),de=new Hi(K,L);de.position.set(0,0,-4.2),C.add(de),C.rotation.x=eg.weapon.tiltX,M.push(()=>{N.dispose(),F.dispose(),H.dispose(),G.dispose(),K.dispose(),I.dispose(),L.dispose()});const ie=new Y1(1.2,12,10),we=new Hi(ie,E);we.position.set(0,40,0),we.renderOrder=6,we.frustumCulled=!1,C.add(we),o.current=we,M.push(()=>{ie.dispose(),o.current===we&&(o.current=null)});let he=null;return b.traverse(Ae=>{he||/righthand$/i.test(Ae.name)&&(he=Ae)}),he||b.traverse(Ae=>{he||/right(forearm|arm)$/i.test(Ae.name)&&(he=Ae)}),he&&(he.add(C),M.push(()=>{var Ae;(Ae=C.parent)==null||Ae.remove(C)})),()=>{M.forEach(Ae=>Ae()),i.current===C&&(i.current=null)}},[b,E]),l.useLayoutEffect(()=>{var M;(M=r.current)==null||M.position.set(e.pos[0],e.pos[1],e.pos[2])},[]),l.useEffect(()=>()=>{A.forEach(M=>M.dispose()),R.dispose(),P.dispose(),E.dispose(),f.dispose()},[A,R,P,E,f]),zs((M,C)=>{const I=r.current;if(!I)return;const L=performance.now(),N=e.spawnedAt?L-e.spawnedAt:1/0,S=N<lp,F=S?Math.max(0,Math.min(1,N/lp)):1;if(d.current)if(S){d.current.visible=!0;const Z=Math.sin(F*Math.PI),Q=.85+.15*Math.sin(L*.05);f.opacity=Math.min(.5,(Z*Q+.15)*.5);const oe=Math.min(1,F*2);d.current.scale.y=oe,d.current.position.y=3+(1-oe)*3}else d.current.visible&&(d.current.visible=!1);const D=.9,H=S?F<D?0:Math.min(1,(F-D)/(1-D)):1;for(let Z=0;Z<A.length;Z++){const Q=A[Z];S?(Q.transparent=!0,Q.opacity=H):Q.opacity!==1&&(Q.transparent=!1,Q.opacity=1)}const W=!S||F>=D;b.visible!==W&&(b.visible=W),T(j(e.state,e.strafeDirX??0,e.isAdvancing??!1,e.yaw??0));const $=e.state==="aim"||e.state==="fire"?Math.max(-1,Math.min(1,e.strafeDirX??0)):0,K=Math.abs($),de=L*.006,ie=-$*.08,we=Math.sin(de*8)*.012*K,he=Math.sin(de*6)*.012*K,Ae=1-Math.exp(-10*C);p.current.leanZ+=(ie-p.current.leanZ)*Ae,p.current.y+=(we-p.current.y)*Ae,p.current.x+=(he-p.current.x)*Ae;const Fe=e.pos[0]+p.current.x,U=e.pos[1]+p.current.y,V=e.pos[2];if(I.position.x=Fe,I.position.y=U,I.position.z=V,e.state!=="dead"){let Q=(e.yaw??0)-I.rotation.y;Q-=Math.round(Q/(2*Math.PI))*(2*Math.PI),I.rotation.y+=Q*Math.min(1,16*C),I.rotation.z+=(p.current.leanZ-I.rotation.z)*Ae}e.state==="dead"&&(I.position.y=-.95);const z=!!(e.flashUntilAt&&e.flashUntilAt>L),O=e.color;for(let Z=0;Z<A.length;Z++){const Q=A[Z];z?(Q.emissive.setRGB(1,1,1),Q.emissiveIntensity=1.4):(Q.emissive.set(O).multiplyScalar(.35),Q.emissiveIntensity=.25)}if(o.current){const Q=!!(e.muzzleUntilAt&&e.muzzleUntilAt>L)||eg.forceMuzzle;E.opacity=Q?.95:0;const oe=Q?1+Math.sin(L*.08)*.2:.001;o.current.scale.setScalar(oe);const ce=eg.muzzle;o.current.position.set(ce.x,ce.y,ce.z)}if(i.current){const Z=eg.weapon;i.current.position.set(Z.x,Z.y,Z.z),i.current.rotation.set(Z.tiltX,Z.tiltY,Z.tiltZ)}const q=e.maxHp||100,X=Math.max(0,Math.min(1,e.hp/q));n.current&&(n.current.scale.x=X,n.current.position.x=-.3*(1-X),P.color.setHex(X>.5?6750106:X>.25?16766515:16724804)),s.current&&(s.current.visible=!1)}),a.jsxs("group",{ref:r,scale:1.45,children:[a.jsx("mesh",{position:[0,.012,0],rotation:[-Math.PI/2,0,0],scale:[1.1,.7,1],material:k,renderOrder:-1,children:a.jsx("planeGeometry",{args:[1,1]})}),a.jsx("primitive",{object:b}),a.jsx("mesh",{ref:d,material:f,position:[0,3,0],renderOrder:500,visible:!1,children:a.jsx("cylinderGeometry",{args:[.55,.4,6,24,1,!0]})}),a.jsxs("group",{ref:s,position:[0,2.05,0],children:[a.jsx("mesh",{material:R,renderOrder:999,children:a.jsx("planeGeometry",{args:[.62,.09]})}),a.jsx("mesh",{ref:n,material:P,position:[0,0,.001],renderOrder:1e3,children:a.jsx("planeGeometry",{args:[.6,.07]})})]})]})},L_=[-3,-1.5,0,1.5,3],Lwe=.35,Dwe=.35,Owe=.4,zwe=1,tg=160,H2=280,W2=600,Bwe=1400,Fwe=1400,Uwe=200;function G2(e,t){return e*(1+(Math.random()*2-1)*t)}function X2(e){return Math.max(0,Math.min(1,e))}function Y2(e,t,r){return e<t?Math.min(t,e+r):e>t?Math.max(t,e-r):t}const Z2=2.2,qwe=3.2,Vwe=7.5,Hwe=10,Wwe=6.5,Gwe=9,Xwe=.9,Ywe=1.8,K2=-6,Zwe=2.6,Kwe=1.2,Q2=.45,Qwe=.35;function Jwe(e,t){if(t.length!==0)for(const r of t){const n=r.hx+Q2,s=Qwe+Q2,o=e[0]-r.x,i=e[2]-r.z;if(Math.abs(o)>=n||Math.abs(i)>=s)continue;const c=n-Math.abs(o),u=s-Math.abs(i);c<u?e[0]=r.x+(o>=0?n:-n):e[2]=r.z+(i>=0?s:-s)}}class J2{constructor(){Wr(this,"nextLaneSwapAt",0);Wr(this,"firstShotArmedAt",0);Wr(this,"targetX",0);Wr(this,"engageZ",K2);Wr(this,"velX",0);Wr(this,"velZ",0);Wr(this,"burstRemaining",0)}init(t){const r=t+lp;this.firstShotArmedAt=r+uwe+Uwe+Math.random()*Fwe,this.nextLaneSwapAt=t,this.targetX=Number.NaN,this.engageZ=K2+(Math.random()-.5)*2*Zwe,this.velX=0,this.velZ=0,this.burstRemaining=0}tick({now:t,dt:r,camera:n,self:s,combatants:o,cover:i}){if(s.state==="dead")return null;if(s.spawnedAt&&t-s.spawnedAt<lp)return this.velX=0,this.velZ=0,s.strafeDirX=0,s.isAdvancing=!1,null;const c=s.team==="ally",u=c||s.pos[2]>=this.engageZ-.05;if(c)this.velX=0,this.velZ=0,s.strafeDirX=0,s.isAdvancing=!1;else{if(Number.isNaN(this.targetX)&&(this.targetX=s.pos[0]),t>=this.nextLaneSwapAt){const R=o.filter(E=>E!==s&&E.team===s.team&&E.state!=="dead"),P=L_.filter(E=>{if(Math.abs(E-s.pos[0])<=.5)return!1;for(const M of R)if(Math.abs(E-M.pos[0])<Kwe)return!1;return!0});let k;if(P.length>0)k=P[Math.floor(Math.random()*P.length)]??0;else{let E=L_[0]??0,M=-1/0;for(const C of L_){if(Math.abs(C-s.pos[0])<=.5)continue;let I=1/0;for(const L of R){const N=Math.abs(C-L.pos[0]);N<I&&(I=N)}I>M&&(M=I,E=C)}k=E}this.targetX=k,this.nextLaneSwapAt=t+O2+Math.random()*(dwe-O2)}const x=this.engageZ-s.pos[2],v=x>.03?qwe*X2(x/Ywe):0,A=Math.abs(v)>Math.abs(this.velZ)?Wwe:Gwe;this.velZ=Y2(this.velZ,v,A*r),Math.abs(this.velZ)<.02&&(this.velZ=0),s.pos[2]=Math.min(this.engageZ,s.pos[2]+this.velZ*r),s.pos[2]>=this.engageZ-.01&&(s.pos[2]=Math.min(s.pos[2],this.engageZ),this.velZ=0),s.isAdvancing=this.velZ>.16||!u&&x>.35;const _=this.targetX-s.pos[0],w=Math.abs(_)>.03?Math.sign(_)*Z2*X2(Math.abs(_)/Xwe):0,j=Math.abs(w)>Math.abs(this.velX)?Vwe:Hwe;this.velX=Y2(this.velX,w,j*r),Math.abs(this.velX)<.02&&(this.velX=0);const T=s.pos[0]+this.velX*r;_>0&&T>=this.targetX||_<0&&T<=this.targetX?(s.pos[0]=this.targetX,this.velX=0):s.pos[0]=T,s.strafeDirX=Math.max(-1,Math.min(1,this.velX/Z2))}if(i&&i.length>0){const x=s.pos[0],v=s.pos[2];Jwe(s.pos,i),Math.abs(s.pos[0]-x)>.001&&(this.velX=0),Math.abs(s.pos[2]-v)>.001&&(this.velZ=0,s.isAdvancing=!1)}if(t<this.firstShotArmedAt)return null;let p=null,d=null,f=1/0;const m=s.pos[0],h=s.pos[2];if(c)for(const x of o){if(x.team!=="enemy"||x.state==="dead")continue;const v=x.pos[0]-m,A=x.pos[2]-h,_=v*v+A*A;_<f&&(f=_,p=x.id,d=new An(x.pos[0],x.pos[1]+1.05,x.pos[2]))}else{const x=n.position.x-m,v=n.position.z-h;f=(x*x+v*v)*Cwe,p=null,d=n.position.clone();for(const _ of o){if(_.team!=="ally"||_.state==="dead")continue;const w=_.pos[0]-m,j=_.pos[2]-h,T=w*w+j*j;T<f&&(f=T,p=_.id,d=new An(_.pos[0],_.pos[1]+1.05,_.pos[2]))}}if(!d)return null;const b=c?xwe:Swe,g=c?wwe:Ewe,y=c?_we:Pwe;if(s.state==="patrol"&&t>=s.nextActionAt){s.state="aim";const v=this.burstRemaining>0?b*.25:b;return s.aimEndsAt=t+G2(v,Lwe),null}if(s.state==="aim"&&t>=s.aimEndsAt){s.state="fire",s.muzzleUntilAt=t+90;let x;this.burstRemaining>0?(this.burstRemaining-=1,x=tg+Math.random()*(H2-tg)):Math.random()<Owe?(this.burstRemaining=1+Math.floor(Math.random()*zwe),x=tg+Math.random()*(H2-tg)):x=G2(g,Dwe),s.nextActionAt=t+x;const v=new An(s.pos[0]+.18,s.pos[1]+1.05,s.pos[2]+(c?-.6:.6)),A=d.clone(),_=pwe*Math.PI/180;return A.x+=(Math.random()-.5)*2*Math.tan(_)*6,A.y+=(Math.random()-.5)*2*Math.tan(_)*6,{muzzle:v,aimEnd:A,damage:y,targetId:p}}return s.state==="fire"&&t>=s.nextActionAt&&(s.state="patrol",this.burstRemaining===0&&t-(s.muzzleUntilAt??0)<g*.5&&Math.random()<.7?s.nextActionAt=t+W2+Math.random()*(Bwe-W2):s.nextActionAt=t+300+Math.random()*500),null}}const $we=Math.cos(kwe*Math.PI/180),D_=2.4,$2=1.4,eT=new An,tT=new An,exe=900,txe=140,Jp=140,gl=16,rT=2200,O_=16;let $p=null;function rxe(){if($p)return $p;const e=128,t=document.createElement("canvas");t.width=t.height=e;const r=t.getContext("2d"),n=r.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);return n.addColorStop(0,"rgba(255,255,255,1)"),n.addColorStop(.18,"rgba(255,140,140,0.95)"),n.addColorStop(.45,"rgba(255,60,80,0.55)"),n.addColorStop(.75,"rgba(120,20,40,0.18)"),n.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=n,r.fillRect(0,0,e,e),$p=new Qc(t),$p.colorSpace=Ea,$p}let rg=null;function nxe(){if(rg)return rg;const e=128,t=document.createElement("canvas");t.width=t.height=e;const r=t.getContext("2d"),n=r.createRadialGradient(e/2,e/2,0,e/2,e/2,e/2);return n.addColorStop(0,"rgba(0,0,0,0.85)"),n.addColorStop(.35,"rgba(0,0,0,0.55)"),n.addColorStop(.7,"rgba(0,0,0,0.18)"),n.addColorStop(1,"rgba(0,0,0,0)"),r.fillStyle=n,r.fillRect(0,0,e,e),rg=new Qc(t),rg}let ng=null;function xz(){return ng||(ng=new Mo({map:nxe(),color:0,transparent:!0,opacity:.65,depthWrite:!1,toneMapped:!1,fog:!1}),ng)}const Az=new tj,kz="/zentara/soldier";function axe(e,t){const r=Az.load(`${kz}/${e}`);return r.wrapS=Vg,r.wrapT=Vg,r.repeat.set(t[0],t[1]),r.anisotropy=4,r.colorSpace=Ea,r}function sxe({position:e}){const t=l.useRef(null);return zs(()=>{const r=t.current;if(!r)return;const n=performance.now()*.0026;r.intensity=1.3+1.1*Math.sin(n)}),a.jsx("pointLight",{ref:t,position:e,color:16767053,distance:14,decay:1.7,intensity:1.3})}const oxe=l.forwardRef(function({yawRef:t,pitchRef:r,killsRef:n,totalSpawnedRef:s,playerHpRef:o,botHpRef:i,enemyAccent:c,allyAccent:u,enemyEmpire:p,allyEmpire:d,activeRef:f,moveRef:m,adsRef:h,onPlayerDied:b,onShotFired:g,onEnemyFired:y,onCombatantFired:x,onEnemyKilled:v,onLockChange:A,botPilot:_=!1},w){const{camera:j,scene:T,gl:R}=hm(),P=l.useMemo(()=>{const Re=new Xn(c),et={h:0,s:0,l:0};return Re.getHSL(et),Re.setHSL(et.h,Math.min(.55,et.s*.7),.04),Re},[c]);l.useEffect(()=>{},[T,P]);const k=l.useRef([]),E=l.useRef([]),[,M]=ot.useReducer(Re=>Re+1,0),C=l.useRef(1),I=l.useRef(0),L=l.useRef(!1);l.useRef(null);const N=l.useRef(new Map),S=l.useRef(null),F=l.useRef(!1),D=l.useRef(!1),H=l.useRef({x:0,z:0}),W=l.useRef(0),G=l.useRef(0),$=l.useRef(0),K=l.useRef(0),de=l.useCallback((Re,et)=>{const rt=performance.now(),ne=Math.max(0,$.current+K.current-rt);Re>=G.current*(ne/Math.max(1,K.current))&&(G.current=Re,$.current=rt,K.current=et)},[]),ie=l.useRef([]),we=l.useRef(null),he=l.useRef(new Float32Array(gl*6)),Ae=l.useRef(new Float32Array(gl*6));if(!we.current){const Re=new rx;Re.setAttribute("position",new Gd(he.current,3)),Re.setAttribute("color",new Gd(Ae.current,3)),Re.setDrawRange(0,gl*2),we.current=Re}const Fe=l.useMemo(()=>new N3({vertexColors:!0,transparent:!0,opacity:1,blending:la,depthWrite:!1,linewidth:2}),[]),U=l.useRef(null),V=l.useMemo(()=>{const Re=new rj(1,1,1,8,1,!0);return Re.translate(0,.5,0),Re},[]),z=l.useMemo(()=>new Mo({transparent:!0,opacity:1,blending:la,depthWrite:!1,toneMapped:!1,fog:!1}),[]);function O(Re,et,rt,ne=Jp,ue=null){const B=performance.now(),fe={a:Re.clone(),aLocal:ue?ue.clone():null,b:et.clone(),length:Math.max(.5,Re.distanceTo(et)),color:new Xn(rt),bornAt:B,untilAt:B+ne},ye=ie.current;ye.length<gl?ye.push(fe):ye[C.current++%gl]=fe}const q=l.useRef([]),X=l.useRef(null),Z=l.useRef(0),Q=l.useMemo(()=>new Zm(1,1),[]),oe=l.useMemo(()=>new Mo({map:rxe(),transparent:!0,depthWrite:!1,blending:la,toneMapped:!1}),[]);function ce(Re,et){const rt=Z.current++%O_;q.current[rt]={pos:Re.clone(),bornAt:performance.now(),color:new Xn(et)}}function _e(Re,et,rt=80){if(et.y>=-1e-4)return null;const ne=-Re.y/et.y;return ne<=0||ne>rt?null:Re.clone().add(et.clone().multiplyScalar(ne))}const re=l.useMemo(()=>axe("corridor-floor.webp",[6,40]),[]),pe=l.useMemo(()=>new Ua({color:16777215,map:re,metalness:.35,roughness:.7,emissive:2238513,emissiveIntensity:.12}),[re]),ee=l.useMemo(()=>new Ua({color:2106930,metalness:.5,roughness:.5,emissive:c,emissiveIntensity:.06}),[c]),xe=l.useMemo(()=>new Ua({color:1448483,metalness:.45,roughness:.55,emissive:10466559,emissiveIntensity:.1}),[]),Le=l.useMemo(()=>new Mo({color:c,transparent:!0,opacity:.9,blending:la,depthWrite:!1,toneMapped:!1}),[c]),Ge=l.useMemo(()=>new Ua({color:1185312,metalness:.55,roughness:.35,emissive:c,emissiveIntensity:.55}),[c]),_t=l.useMemo(()=>new Mo({color:c,transparent:!0,opacity:.55,blending:la,depthWrite:!1,toneMapped:!1,fog:!1}),[c]),Xe=l.useMemo(()=>{const Re=Az.load(`${kz}/cover/cover-barricade-low.webp`);return Re.anisotropy=4,Re.colorSpace=Ea,Re},[]),bt=l.useMemo(()=>new Ua({map:Xe,transparent:!0,alphaTest:.12,depthWrite:!0,side:K1,metalness:.55,roughness:.6,emissive:1711914,emissiveIntensity:.45}),[Xe]),Pt=l.useMemo(()=>new Zm(D_,$2),[]),kt=l.useMemo(()=>new Zm(D_*.92,.06),[]),Ee=l.useMemo(()=>new Mo({color:10478847,transparent:!0,opacity:.85,blending:la,depthWrite:!1,toneMapped:!1,side:K1}),[]),le=l.useMemo(()=>new Zm(1,1),[]),De=l.useMemo(()=>xz(),[]);l.useEffect(()=>()=>{bt.dispose(),Xe.dispose(),Pt.dispose(),kt.dispose(),Ee.dispose(),le.dispose()},[bt,Xe,Pt,kt,Ee,le]);const Ye=l.useCallback((Re,et)=>{const rt=E.current;if(!rt.length)return null;const ne=et.z-Re.z;if(Math.abs(ne)<1e-4)return null;let ue=1/0,B=null;for(let fe=0;fe<rt.length;fe++){const ye=rt[fe],ve=(ye.z-Re.z)/ne;if(ve<=.001||ve>=.999)continue;const ke=Re.x+(et.x-Re.x)*ve,Ue=Re.y+(et.y-Re.y)*ve;ke<ye.x-ye.hx||ke>ye.x+ye.hx||Ue<0||Ue>2*ye.hy||ve<ue&&(ue=ve,B=new An(ke,Ue,ye.z))}return B},[]);return l.useEffect(()=>(j.position.set(0,1.6,0),j.rotation.order="YXZ",I.current=performance.now(),()=>{pe.dispose(),re.dispose(),ee.dispose(),xe.dispose(),Le.dispose(),Ge.dispose(),_t.dispose()}),[j,pe,ee,xe,Le,Ge,_t,re]),l.useImperativeHandle(w,()=>({fire:()=>{if(!f.current||F.current)return;const Re=performance.now(),et=h.current?.006:.014;W.current=Math.min(.05,W.current+et);const rt=new An(0,0,-1).applyQuaternion(j.quaternion).normalize(),ne=j.position,ue=[[.55,.45],[1.05,.55],[1.65,.38]];let fe=80,ye=null;for(const Ie of k.current)if(!(Ie.state==="dead"||Ie.team!=="enemy")&&!(Ie.spawnedAt&&Re-Ie.spawnedAt<lp))for(let yt=0;yt<ue.length;yt++){const[St,Xt]=ue[yt],se=Ie.pos[0]-ne.x,je=Ie.pos[1]+St-ne.y,Oe=Ie.pos[2]-ne.z,Ke=rt.x*se+rt.y*je+rt.z*Oe;if(Ke<=0||Ke>=fe)continue;const Me=se-rt.x*Ke,wt=je-rt.y*Ke,at=Oe-rt.z*Ke;Me*Me+wt*wt+at*at>Xt*Xt||(fe=Ke,ye=Ie)}const ve=new An(0,0,-1).applyQuaternion(j.quaternion),ke=!!h.current;let Ue=ke?0:.55,ct=ke?-.08:-.2;const dt=R.domElement,Rt=dt==null?void 0:dt.getBoundingClientRect();if(!ke&&Rt&&Rt.width>0&&Rt.height>0){const Ie=document.querySelector(".soldier-weapon-wrap");if(Ie){const yt=Ie.getBoundingClientRect();if(yt.width>0&&yt.height>0){const St=yt.right-.97*yt.width,Xt=yt.bottom-.875*yt.height;Ue=(St-Rt.left)/Rt.width*2-1,ct=-((Xt-Rt.top)/Rt.height*2-1)}}}const Qe=new An(Ue,ct,-1).unproject(j).sub(j.position).normalize(),Mt=j.position.clone().add(Qe.multiplyScalar(1.2)),lr=Mt.clone().sub(j.position).applyQuaternion(j.quaternion.clone().invert()),zt=ve.clone().normalize(),br=Ie=>{const yt=Math.max(.5,Ie.x*zt.x+Ie.y*zt.y+Ie.z*zt.z-(j.position.x*zt.x+j.position.y*zt.y+j.position.z*zt.z));return Mt.clone().add(zt.clone().multiplyScalar(yt))};if(!ye){const Ie=_e(j.position,zt,80),yt=Ie||j.position.clone().add(zt.clone().multiplyScalar(40)),St=Ye(j.position,yt);St?(O(Mt,br(St),u,Jp,lr),ce(St,u)):(O(Mt,br(yt),u,Jp,lr),Ie&&ce(Ie,u)),g==null||g(!1);return}const fr=new An(ye.pos[0],ye.pos[1]+1.05,ye.pos[2]),ur=Ye(ne,fr);if(ur){O(Mt,br(ur),u,Jp,lr),ce(ur,u),g==null||g(!1);return}O(Mt,br(fr),u,Jp,lr),ye.hp-=Awe,ye.flashUntilAt=Re+txe,ye.hp<=0&&(ye.state="dead",ye.nextActionAt=Re+exe,n.current+=1,S.current=null,N.current.delete(ye.id),v==null||v()),g==null||g(!0),M()}}),[f,j,n,g,v,Ye]),zs((Re,et)=>{if(!f.current||F.current){for(const Oe of k.current)Oe.state!=="dead"&&(Oe.strafeDirX!==0&&(Oe.strafeDirX=0),Oe.isAdvancing&&(Oe.isAdvancing=!1));H.current.x=0,H.current.z=0;return}const rt=Math.min(et,.05),ne=performance.now(),ue=ne-I.current;if(!L.current&&ue>=_z){L.current=!0;const Oe=[],Ke=(Te,Ve,tt,Et=[])=>{const or=Math.min(Ve,tt),Ht=Math.max(Ve,tt);let Lt=[0,(or+Ht)*.5];for(let nr=0;nr<24;nr++){const Mr=(Math.random()*2-1)*Te,Br=or+Math.random()*(Ht-or);Lt=[Mr,Br];let wn=!0;for(let Kt=0;Kt<Oe.length;Kt++){const Jt=Oe[Kt][0]-Mr,un=Oe[Kt][1]-Br;if(Jt*Jt+un*un<Jh*Jh){wn=!1;break}}if(wn)for(let Kt=0;Kt<Et.length;Kt++){const Jt=Et[Kt][0]-Mr,un=Et[Kt][1]-Br;if(Jt*Jt+un*un<Jh*Jh){wn=!1;break}}if(wn)break}return Oe.push(Lt),Lt},Me=4,wt=-9,at=-13,Dt=8.5,Ut=3.2,ft=[],wr=[];for(let Te=0;Te<Me;Te++){let Ve=0,tt=(wt+at)*.5;for(let Et=0;Et<24;Et++){const Qt=(Math.random()*2-1)*Dt,or=at+Math.random()*(wt-at);let Ht=!0;for(let Lt=0;Lt<ft.length;Lt++){const nr=ft[Lt][0]-Qt,Mr=ft[Lt][1]-or;if(nr*nr+Mr*Mr<Ut*Ut){Ht=!1;break}}if(Ve=Qt,tt=or,Ht)break}ft.push([Ve,tt]),wr.push({x:Ve,z:tt,hx:D_*.5,hy:$2*.5})}E.current=wr;const dr=wr.map(Te=>[Te.x,Te.z]);for(let Te=0;Te<Fc;Te++){const[Ve,tt]=Ke(fwe,mwe,hwe,dr),Et={id:C.current++,pos:[Ve,0,tt],hp:Wd,maxHp:Wd,state:"patrol",aimEndsAt:0,nextActionAt:ne+600+Math.random()*2400,color:c,lane:0,spawnedAt:ne,team:"enemy"};k.current.push(Et);const Qt=new J2;Qt.init(ne),N.current.set(Et.id,Qt)}const Vt=j.position.x,Je=j.position.z,mt=[[Vt,Je],...dr];Oe.length=0;for(let Te=0;Te<gwe;Te++){const[Ve,tt]=Ke(ywe,bwe,vwe,mt),Et={id:C.current++,pos:[Vt+Ve,0,Je+tt],hp:z2,maxHp:z2,state:"patrol",aimEndsAt:0,nextActionAt:ne+800+Math.random()*2600,color:u,lane:0,spawnedAt:ne,team:"ally"};k.current.push(Et);const Qt=new J2;Qt.init(ne),N.current.set(Et.id,Qt)}s.current=Fc,i.current=Fc*Wd,M()}const B=k.current;let fe=0;for(const Oe of B){if(Oe.state==="dead")continue;const Ke=N.current.get(Oe.id);if(!Ke)continue;const Me=Ke.tick({now:ne,dt:rt,camera:j,self:Oe,combatants:B,cover:E.current});if(Me){const wt=Oe.team==="ally";x==null||x(wt);const at=wt?6750105:6741503,Dt=Ye(Me.muzzle,Me.aimEnd);if(Dt){O(Me.muzzle,Dt,at,80),ce(Dt,wt?4521864:5623039);continue}if(O(Me.muzzle,Me.aimEnd,at,80),Me.targetId===null){const ft=Me.aimEnd.clone().sub(Me.muzzle),wr=ft.length()||1;ft.divideScalar(wr);const Vt=j.position.clone().sub(Me.muzzle).dot(ft);Me.muzzle.clone().add(ft.multiplyScalar(Vt)).distanceTo(j.position)<=.55&&Vt>0&&Vt<=wr+.5&&(o.current=Math.max(0,o.current-Me.damage),de(.05,220),y==null||y(),o.current<=0&&!F.current&&(F.current=!0,b()))}else{const Ut=B.find(ft=>ft.id===Me.targetId);Ut&&Ut.state!=="dead"&&(Ut.hp-=Me.damage,Ut.flashUntilAt=ne+110,Ut.hp<=0&&(Ut.state="dead",Ut.nextActionAt=ne+9999e3,N.current.delete(Ut.id),Ut.team==="enemy"&&(n.current+=1,S.current===Ut.id&&(S.current=null),v==null||v())))}}if(Oe.team==="ally"){let wt=1/0,at=Oe.pos[0],Dt=Oe.pos[2]-1;for(const Ut of B){if(Ut.team!=="enemy"||Ut.state==="dead")continue;const ft=Ut.pos[0]-Oe.pos[0],wr=Ut.pos[2]-Oe.pos[2],dr=ft*ft+wr*wr;dr<wt&&(wt=dr,at=Ut.pos[0],Dt=Ut.pos[2])}Oe.yaw=Math.atan2(at-Oe.pos[0],Dt-Oe.pos[2])}else Oe.yaw=Math.atan2(j.position.x-Oe.pos[0],j.position.z-Oe.pos[2]);Oe.team==="enemy"&&(fe+=Math.max(0,Oe.hp))}if(L.current&&(i.current=fe),W.current*=Math.exp(-14*rt),_){let Oe=null,Ke=1/0;for(const Me of k.current){if(Me.team!=="enemy"||Me.state==="dead")continue;const wt=Me.pos[0]-j.position.x,at=Me.pos[2]-j.position.z,Dt=wt*wt+at*at;Dt<Ke&&(Ke=Dt,Oe=Me)}if(Oe){const Me=Oe.pos[0],wt=(Oe.pos[1]??0)+1.5,at=Oe.pos[2],Dt=Me-j.position.x,Ut=wt-j.position.y,ft=at-j.position.z,wr=Math.sqrt(Dt*Dt+ft*ft),dr=Math.atan2(-Dt,-ft),Vt=Math.atan2(Ut,Math.max(.001,wr)),Je=1-Math.exp(-14*rt);let mt=dr-t.current;for(;mt>Math.PI;)mt-=2*Math.PI;for(;mt<-Math.PI;)mt+=2*Math.PI;Math.abs(mt)<.018&&Math.abs(Vt-r.current)<.018?(t.current=dr,r.current=Vt):(t.current=t.current+mt*Je,r.current=r.current+(Vt-r.current)*Je)}}let ye=0,ve=0;if(K.current>0){const Oe=(ne-$.current)/K.current;if(Oe<1){const Ke=G.current*(1-Oe);ye=(Math.random()-.5)*Ke,ve=(Math.random()-.5)*Ke}else K.current=0,G.current=0}if(j.rotation.y=t.current+ve,j.rotation.x=r.current+W.current+ye,j instanceof M3){const Oe=h.current?45:70,Ke=1-Math.exp(-8*rt),Me=j.fov+(Oe-j.fov)*Ke;Math.abs(Me-j.fov)>.01&&(j.fov=Me,j.updateProjectionMatrix())}const ke=m.current,Ue=H.current;let ct=0,dt=0;if(ke&&(ke.x!==0||ke.z!==0)){const Oe=t.current,Ke=-Math.sin(Oe),Me=-Math.cos(Oe),wt=Math.cos(Oe),at=-Math.sin(Oe),Dt=Math.hypot(ke.x,ke.z),Ut=Dt<=M_?0:Math.min(1,(Dt-M_)/(1-M_)),ft=Dt||1,wr=ke.x/ft,dr=ke.z/ft,Vt=Rwe*(h.current?Twe:1)*Ut;ct=(Ke*dr+wt*wr)*Vt,dt=(Me*dr+at*wr)*Vt}const Rt=ct-Ue.x,jr=dt-Ue.z,Qe=Math.hypot(Rt,jr),Mt=(ct===0&&dt===0?Iwe:jwe)*rt;if(Qe<=Mt||Qe<1e-4)Ue.x=ct,Ue.z=dt;else{const Oe=Mt/Qe;Ue.x+=Rt*Oe,Ue.z+=jr*Oe}(Math.abs(Ue.x)>1e-4||Math.abs(Ue.z)>1e-4)&&(j.position.x+=Ue.x*rt,j.position.z+=Ue.z*rt,j.position.x=Math.max(B2,Math.min(F2,j.position.x)),j.position.z=Math.max(U2,Math.min(q2,j.position.z)),(j.position.x<=B2&&Ue.x<0||j.position.x>=F2&&Ue.x>0)&&(Ue.x=0),(j.position.z<=U2&&Ue.z<0||j.position.z>=q2&&Ue.z>0)&&(Ue.z=0));const lr=new An(0,0,-1).applyQuaternion(j.quaternion);let zt=null,br=$we;const fr=j.position;for(const Oe of k.current){if(Oe.state==="dead"||Oe.team==="ally"||Oe.spawnedAt&&ne-Oe.spawnedAt<lp)continue;const Ke=Oe.pos[0]-fr.x,Me=Oe.pos[1]+1-fr.y,wt=Oe.pos[2]-fr.z,at=Math.hypot(Ke,Me,wt)||1,Dt=(lr.x*Ke+lr.y*Me+lr.z*wt)/at;if(Dt>br){if(eT.copy(fr),tT.set(Oe.pos[0],Oe.pos[1]+1,Oe.pos[2]),Ye(eT,tT))continue;br=Dt,zt=Oe.id}}S.current=zt;const ur=zt!==null;ur!==D.current&&(D.current=ur,A==null||A(ur));const Ie=he.current,yt=Ae.current,St=ie.current;for(let Oe=0;Oe<gl;Oe++){const Ke=St[Oe],Me=Oe*6;Ke&&Ke.untilAt>ne?(Ie[Me+0]=Ke.a.x,Ie[Me+1]=Ke.a.y,Ie[Me+2]=Ke.a.z,Ie[Me+3]=Ke.b.x,Ie[Me+4]=Ke.b.y,Ie[Me+5]=Ke.b.z,yt[Me+0]=Ke.color.r,yt[Me+1]=Ke.color.g,yt[Me+2]=Ke.color.b,yt[Me+3]=Ke.color.r,yt[Me+4]=Ke.color.g,yt[Me+5]=Ke.color.b):(Ie[Me+0]=0,Ie[Me+1]=-1e3,Ie[Me+2]=0,Ie[Me+3]=0,Ie[Me+4]=-1e3,Ie[Me+5]=0,yt[Me+0]=0,yt[Me+1]=0,yt[Me+2]=0,yt[Me+3]=0,yt[Me+4]=0,yt[Me+5]=0)}const Xt=we.current;Xt&&(Xt.getAttribute("position").needsUpdate=!0,Xt.getAttribute("color").needsUpdate=!0);const se=U.current;if(se){const Oe=new An,Ke=new Q_,Me=new An(0,1,0),wt=new Xn,at=new Lp().makeTranslation(0,-1e4,0);for(let Dt=0;Dt<gl;Dt++){const Ut=St[Dt];if(!Ut||Ut.untilAt<=ne){se.setMatrixAt(Dt,at),se.instanceColor&&wt.setRGB(0,0,0).toArray(se.instanceColor.array,Dt*3);continue}const ft=Math.max(1,Ut.untilAt-Ut.bornAt),wr=Math.min(1,(ne-Ut.bornAt)/ft);Ut.aLocal&&(Ut.a.copy(Ut.aLocal).applyQuaternion(j.quaternion).add(j.position),Ut.b.set(0,0,-1).applyQuaternion(j.quaternion).multiplyScalar(Ut.length).add(Ut.a)),Oe.subVectors(Ut.b,Ut.a);const dr=Oe.length()||1e-4;Oe.divideScalar(dr);const Vt=Math.min(dr,1.2),Je=Math.min(dr,wr*(dr+Vt)),mt=Math.max(0,Je-Vt),Te=Ut.a.clone().add(Oe.clone().multiplyScalar(mt)),Ve=Math.max(1e-4,Je-mt);Ke.setFromUnitVectors(Me,Oe);const tt=.02,Et=new Lp().compose(Te,Ke,new An(tt,Ve,tt));se.setMatrixAt(Dt,Et);const Qt=1-wr*wr;se.setColorAt(Dt,wt.copy(Ut.color).multiplyScalar(Qt))}se.instanceMatrix.needsUpdate=!0,se.instanceColor&&(se.instanceColor.needsUpdate=!0)}const je=X.current;if(je){const Oe=new Lp,Ke=new Xn,Me=new Lp().makeTranslation(0,-1e4,0);for(let wt=0;wt<O_;wt++){const at=q.current[wt],Dt=at?ne-at.bornAt:1/0;if(!at||Dt>rT){je.setMatrixAt(wt,Me),je.instanceColor&&Ke.setRGB(0,0,0).toArray(je.instanceColor.array,wt*3);continue}const Ut=Dt/rT,ft=.05+Ut*.07;Oe.makeRotationX(-Math.PI/2).setPosition(at.pos.x,.02,at.pos.z).scale(new An(ft,ft,ft));const wr=new Lp().compose(new An(at.pos.x,.02,at.pos.z),new Q_().setFromEuler(new ej(-Math.PI/2,0,0)),new An(ft,ft,ft));je.setMatrixAt(wt,wr);const dr=1-Ut;je.setColorAt(wt,Ke.copy(at.color).multiplyScalar(dr))}je.instanceMatrix.needsUpdate=!0,je.instanceColor&&(je.instanceColor.needsUpdate=!0)}}),l.useEffect(()=>()=>{var Re;k.current=[],ie.current=[],q.current=[],Fe.dispose(),(Re=we.current)==null||Re.dispose(),z.dispose(),V.dispose(),oe.dispose(),Q.dispose()},[Fe,oe,Q,z,V]),a.jsxs(a.Fragment,{children:[a.jsx("fogExp2",{attach:"fog",args:[P.getHex(),.022]}),a.jsx("ambientLight",{intensity:1.6}),a.jsx("hemisphereLight",{color:15397375,groundColor:4864552,intensity:.95}),a.jsx("directionalLight",{position:[3,8,2],intensity:1.7,castShadow:!1}),a.jsx("directionalLight",{position:[-3,6,-8],intensity:.85}),a.jsx("pointLight",{position:[0,3.7,-3],distance:11,color:16777215,intensity:1.4,decay:1.6}),a.jsx("pointLight",{position:[0,3.7,-9],distance:11,color:16777215,intensity:1.3,decay:1.6}),a.jsx("pointLight",{position:[0,3.7,-15],distance:11,color:16777215,intensity:1.2,decay:1.6}),a.jsx("pointLight",{position:[0,3.7,-21],distance:11,color:16777215,intensity:1.1,decay:1.6}),a.jsx("pointLight",{position:[0,3.2,-30],distance:20,color:c,intensity:1.2}),a.jsx("pointLight",{position:[0,2.2,2],distance:9,color:16773336,intensity:.7}),a.jsx(sxe,{position:[0,3.4,-12]}),a.jsx("mesh",{rotation:[-Math.PI/2,0,0],position:[0,0,-78],material:pe,children:a.jsx("planeGeometry",{args:[24,160]})}),k.current.map(Re=>a.jsx(Mwe,{enemy:Re,empireId:Re.team==="ally"?d:p},Re.id)),E.current.map((Re,et)=>a.jsxs("group",{children:[a.jsx("mesh",{position:[Re.x,.015,Re.z+.02],rotation:[-Math.PI/2,0,0],geometry:le,material:De,scale:[Re.hx*2*1.35,Re.hy*1.2,1],renderOrder:-1}),a.jsx("mesh",{position:[Re.x,Re.hy,Re.z],geometry:Pt,material:bt}),a.jsx("mesh",{position:[Re.x,Re.hy*2-.04,Re.z+.01],geometry:kt,material:Ee})]},`cover-${et}`)),a.jsx("instancedMesh",{ref:U,args:[V,z,gl],frustumCulled:!1}),a.jsx("instancedMesh",{ref:X,args:[Q,oe,O_],frustumCulled:!1})]})}),ixe=new URL(""+new URL("rifle-viewmodel-C29ujLaF.webp",import.meta.url).href,import.meta.url).href,lxe=new URL(""+new URL("rifle-muzzle-flash-B8EJ_3SY.webp",import.meta.url).href,import.meta.url).href,cxe=new URL(""+new URL("blood-burst-DiPNfQU_.webp",import.meta.url).href,import.meta.url).href,nT=.0042,aT=.0034,ag=.55,sg=.85,Sz=({attacker:e,defender:t,onComplete:r,botPilot:n=!1,previewMode:s=!1,tileBackgroundImage:o,skipBonus:i=!1})=>{const[c,u]=l.useState(s?"playing":"intro"),[p,d]=l.useState({playerHp:$h,botHp:Wd*Fc,kills:0}),[f,m]=l.useState(null),h=l.useRef(null),b=l.useRef(null),g=l.useRef(0),y=l.useRef(0),x=l.useRef(0),v=l.useRef(0),A=l.useRef($h),_=l.useRef(Wd*Fc),w=l.useRef(!1),j=l.useRef(0),T=l.useRef(r);T.current=r;const R=l.useRef(!1),P=l.useRef(0),[,k]=l.useState(0),E=l.useRef($h),M=l.useRef(0),[,C]=l.useState(0),I=l.useRef(null),[L,N]=l.useState(!1),S=l.useRef(0),[,F]=l.useState(0),D=l.useRef(0),[,H]=l.useState(0),[W,G]=l.useState([]),$=l.useRef(0),[K,de]=l.useState(!1),ie=l.useRef(!1),we=l.useCallback(Ie=>{ie.current=Ie,de(Ie)},[]),he=l.useRef(null),Ae=l.useRef(null),Fe=l.useRef(new Set),U=l.useCallback((Ie,yt)=>{const St=window.setTimeout(()=>{Fe.current.delete(St),Ie()},yt);return Fe.current.add(St),St},[]);l.useEffect(()=>()=>{for(const St of Fe.current)window.clearTimeout(St);Fe.current.clear(),I.current!=null&&(window.clearInterval(I.current),I.current=null);const Ie=Ae.current;if(Ie)for(Ie.traverse(St=>{const Xt=St;if(Xt.geometry&&typeof Xt.geometry.dispose=="function")try{Xt.geometry.dispose()}catch{}const se=Xt.material;if(se){const je=Array.isArray(se)?se:[se];for(const Oe of je)try{Oe.dispose()}catch{}}});Ie.children.length;)Ie.remove(Ie.children[0]);const yt=he.current;if(yt){try{yt.dispose()}catch{}try{const Xt=yt.getContext();Xt&&!Xt.isContextLost()&&yt.forceContextLoss()}catch{}const St=yt.domElement;St&&St.parentElement&&(St.width=1,St.height=1),he.current=null}Ae.current=null},[]);const V=l.useRef(null);l.useEffect(()=>{var yt;if(s){(yt=V.current)==null||yt.stop();return}V.current||(V.current=new pz({src:oz}));const Ie=V.current;c==="intro"||c==="playing"?Ie.play():c==="result"&&Ie.stop()},[c,s]),l.useEffect(()=>()=>{var Ie;(Ie=V.current)==null||Ie.dispose(),V.current=null},[]);const z=l.useRef({x:0,z:0}),O=l.useRef({w:!1,a:!1,s:!1,d:!1}),q=l.useRef(!1),[X,Z]=l.useState(!1),Q=.5,oe=l.useRef(null),[ce,_e]=l.useState(0),[re,pe]=l.useState(!1),ee=l.useCallback(()=>{const Ie=O.current,yt=(Ie.d?1:0)+(Ie.a?-1:0),St=(Ie.w?1:0)+(Ie.s?-1:0);z.current={x:yt,z:St}},[]);l.useEffect(()=>{if(c!=="playing"||X){_e(0);return}const Ie=.97,yt=.875,St=-137,Xt=()=>{const Oe=oe.current;if(!Oe)return;const Ke=Oe.getBoundingClientRect();if(Ke.width<=0||Ke.height<=0)return;const Me=Ke.right-Ie*Ke.width,wt=Ke.bottom-yt*Ke.height,at=window.innerWidth*.5,Dt=window.innerHeight*.5,Ut=Math.atan2(Dt-wt,at-Me)*(180/Math.PI);_e(Ut-St)},se=window.requestAnimationFrame(Xt),je=new ResizeObserver(Xt);return oe.current&&je.observe(oe.current),window.addEventListener("resize",Xt),window.addEventListener("orientationchange",Xt),()=>{window.cancelAnimationFrame(se),je.disconnect(),window.removeEventListener("resize",Xt),window.removeEventListener("orientationchange",Xt)}},[c,X]);const[xe,Le]=l.useState({active:!1,baseX:0,baseY:0,knobX:0,knobY:0}),Ge=l.useRef(null),_t=l.useMemo(()=>{const Ie=Uy[t.piece];return(Ie==null?void 0:Ie.accent)??16724804},[t.piece]),Xe=l.useMemo(()=>{const Ie=Uy[e.piece];return(Ie==null?void 0:Ie.accent)??6750105},[e.piece]),bt=l.useCallback(Ie=>{if(!R.current){R.current=!0,w.current=!1,m(Ie),u("result");try{Xa({volume:.5})}catch{}U(()=>T.current(Ie),lwe)}},[e,U]),Pt=l.useCallback(()=>{bt(V2(e,t,!1,!0))},[e,t,bt]),kt=l.useCallback(Ie=>{bt(V2(e,t,!0,Ie))},[e,t,bt]),Ee=l.useCallback(Ie=>{h.current===null&&(h.current=Ie,w.current=!1,u("kill-cam"),U(()=>{Ie?i||n?kt(n?Math.random()<.6:!0):u("codebreaker"):Pt()},cwe))},[Pt,kt,U,i,n]);l.useCallback(Ie=>{R.current||h.current!==null||Ee(Ie)},[Ee]),l.useEffect(()=>{if(!n||c!=="playing")return;z.current={x:0,z:0};const Ie=window.setInterval(()=>{var yt;if(w.current&&ie.current){(yt=b.current)==null||yt.fire();try{Lo({volume:.22})}catch{}}},N_);return()=>{window.clearInterval(Ie),z.current={x:0,z:0}}},[n,c]),l.useEffect(()=>{if(s){j.current=performance.now(),w.current=!0;return}if(c!=="intro")return;const Ie=window.setTimeout(()=>{j.current=performance.now(),w.current=!0,u("playing")},iwe);return()=>window.clearTimeout(Ie)},[c,s]),l.useEffect(()=>{if(c!=="playing")return;let Ie=0;const yt=()=>{const St=A.current,Xt=_.current;St<E.current&&(M.current=performance.now()+280,C(wt=>wt+1)),E.current=St,d({playerHp:St,botHp:Xt,kills:x.current});const se=z.current,je=!!(se&&(se.x!==0||se.z!==0));pe(wt=>wt!==je?je:wt);const Oe=performance.now()-j.current,Ke=_z+200;if(!s&&Oe>=Ke&&Xt<=0&&h.current===null){Ee(!0);return}const Me=performance.now()-j.current;if(!s&&Me>=owe&&h.current===null){Ee(St>=Xt);return}Ie=requestAnimationFrame(yt)};return Ie=requestAnimationFrame(yt),()=>cancelAnimationFrame(Ie)},[c,Ee]);const le=l.useRef({active:!1,lastX:0,lastY:0}),De=l.useCallback(Ie=>{var yt,St;w.current&&(le.current={active:!0,lastX:Ie.clientX,lastY:Ie.clientY},(St=(yt=Ie.target).setPointerCapture)==null||St.call(yt,Ie.pointerId))},[]),Ye=l.useCallback(Ie=>{const yt=le.current;if(!yt.active)return;const St=Ie.clientX-yt.lastX,Xt=Ie.clientY-yt.lastY;yt.lastX=Ie.clientX,yt.lastY=Ie.clientY;const se=q.current?Q:1;g.current=Math.max(-sg,Math.min(sg,g.current-St*nT*se)),y.current=Math.max(-ag,Math.min(ag,y.current-Xt*aT*se))},[]),Re=l.useCallback(()=>{le.current.active=!1},[]),et=l.useCallback(()=>{var Ie;if(w.current){(Ie=b.current)==null||Ie.fire();try{Lo({volume:.28})}catch{}}},[]),rt=l.useRef(null),ne=l.useCallback(Ie=>{var yt,St;if(Ie.preventDefault(),!!w.current){et(),N(!0),I.current!=null&&window.clearInterval(I.current),I.current=window.setInterval(et,N_);try{(St=(yt=Ie.target).setPointerCapture)==null||St.call(yt,Ie.pointerId)}catch{}rt.current={id:Ie.pointerId,lastX:Ie.clientX,lastY:Ie.clientY}}},[et]),ue=l.useCallback(Ie=>{const yt=rt.current;if(!yt||yt.id!==Ie.pointerId)return;const St=Ie.clientX-yt.lastX,Xt=Ie.clientY-yt.lastY;yt.lastX=Ie.clientX,yt.lastY=Ie.clientY;const se=q.current?Q:1;g.current=Math.max(-sg,Math.min(sg,g.current-St*nT*se)),y.current=Math.max(-ag,Math.min(ag,y.current-Xt*aT*se))},[]),B=l.useCallback(()=>{N(!1),I.current!=null&&(window.clearInterval(I.current),I.current=null),rt.current=null},[]);l.useEffect(()=>()=>{I.current!=null&&window.clearInterval(I.current)},[]);const fe=l.useCallback(()=>{if(!w.current)return;const Ie=!q.current;q.current=Ie,Z(Ie)},[]),ye=l.useCallback(Ie=>{!w.current&&Ie||q.current!==Ie&&(q.current=Ie,Z(Ie))},[]);l.useEffect(()=>{const Ie=Xt=>{Xt.button===2&&ye(!0)},yt=Xt=>{Xt.button===2&&ye(!1)},St=Xt=>{Xt.preventDefault()};return window.addEventListener("mousedown",Ie),window.addEventListener("mouseup",yt),window.addEventListener("contextmenu",St),()=>{window.removeEventListener("mousedown",Ie),window.removeEventListener("mouseup",yt),window.removeEventListener("contextmenu",St)}},[ye]),l.useEffect(()=>{const Ie=se=>{const je=se,Oe=je==null?void 0:je.tagName;return Oe==="INPUT"||Oe==="TEXTAREA"||Oe==="SELECT"||!!(je!=null&&je.isContentEditable)},yt=(se,je)=>{const Oe=O.current;switch(se){case"KeyW":case"ArrowUp":Oe.w=je;break;case"KeyS":case"ArrowDown":Oe.s=je;break;case"KeyA":case"ArrowLeft":Oe.a=je;break;case"KeyD":case"ArrowRight":Oe.d=je;break;default:return}return ee(),!0},St=se=>{if(!w.current||Ie(se.target))return;if(yt(se.code,!0)){se.preventDefault();return}if(se.code==="Space"||se.code==="KeyF"){if(se.preventDefault(),se.repeat)return;N(!0),et(),I.current!=null&&window.clearInterval(I.current),I.current=window.setInterval(et,N_);return}(se.code==="ShiftLeft"||se.code==="ShiftRight")&&(se.preventDefault(),ye(!0))},Xt=se=>{if(yt(se.code,!1)){se.preventDefault();return}if(se.code==="Space"||se.code==="KeyF"){se.preventDefault(),B();return}(se.code==="ShiftLeft"||se.code==="ShiftRight")&&(se.preventDefault(),ye(!1))};return window.addEventListener("keydown",St),window.addEventListener("keyup",Xt),()=>{window.removeEventListener("keydown",St),window.removeEventListener("keyup",Xt),B(),ye(!1)}},[et,B,ee,ye]);const ve=56,ke=l.useCallback(Ie=>{var yt,St;w.current&&Ge.current==null&&(Ge.current=Ie.pointerId,(St=(yt=Ie.target).setPointerCapture)==null||St.call(yt,Ie.pointerId),Le({active:!0,baseX:Ie.clientX,baseY:Ie.clientY,knobX:Ie.clientX,knobY:Ie.clientY}),z.current={x:0,z:0})},[]),Ue=l.useCallback(Ie=>{Ge.current===Ie.pointerId&&Le(yt=>{if(!yt.active)return yt;const St=Ie.clientX-yt.baseX,Xt=Ie.clientY-yt.baseY,se=Math.hypot(St,Xt),je=Math.min(se,ve),Oe=se>0?St/se:0,Ke=se>0?Xt/se:0,Me=je/ve;return z.current={x:Oe*Me,z:-Ke*Me},{...yt,knobX:yt.baseX+Oe*je,knobY:yt.baseY+Ke*je}})},[]),ct=l.useCallback(Ie=>{Ge.current===Ie.pointerId&&(Ge.current=null,Le({active:!1,baseX:0,baseY:0,knobX:0,knobY:0}),ee())},[ee]),dt=(f==null?void 0:f.winnerId)===e.id,Rt=performance.now(),jr=P.current>Rt,Qe=M.current>Rt,Mt=S.current>Rt,lr=D.current>Rt,zt="/zentara/soldier/intro-key-art.webp",br=dt?"/zentara/soldier/result-win.webp":"/zentara/soldier/result-loss.webp",fr=`#${Xe.toString(16).padStart(6,"0")}`,ur=`#${_t.toString(16).padStart(6,"0")}`;return a.jsxs("div",{className:`soldier-raid-root${X?" ads":""}`,style:{"--soldier-ally":fr,"--soldier-enemy":ur},role:"dialog","aria-modal":"true","aria-label":"Ground Assault",children:[a.jsxs("div",{className:"soldier-raid-canvas-wrap",style:o?{backgroundImage:`url(${o})`,backgroundSize:"cover",backgroundPosition:"center",backgroundRepeat:"no-repeat"}:void 0,children:[a.jsx(gm,{dpr:[1,Nwe],camera:{fov:70,near:.1,far:80,position:[0,1.6,0]},gl:{antialias:!1,powerPreference:"low-power",alpha:!0},onCreated:({gl:Ie,scene:yt})=>{he.current=Ie,Ae.current=yt,Ie.setClearColor(new Xn(0),0),Ie.shadowMap.enabled=!1},children:a.jsx(oxe,{ref:b,yawRef:g,pitchRef:y,killsRef:x,totalSpawnedRef:v,playerHpRef:A,botHpRef:_,activeRef:w,moveRef:z,adsRef:q,enemyAccent:_t,allyAccent:Xe,allyEmpire:e.piece,enemyEmpire:t.piece,botPilot:n,onPlayerDied:()=>{s||Ee(!1)},onShotFired:Ie=>{P.current=performance.now()+90,k(yt=>yt+1),Ie&&(D.current=performance.now()+180,H(yt=>yt+1))},onEnemyFired:()=>{M.current=performance.now()+200,C(Ie=>Ie+1)},onCombatantFired:Ie=>{try{Lo({volume:Ie?.14:.18})}catch{}},onEnemyKilled:()=>{S.current=performance.now()+320,F(St=>St+1);const Ie=++$.current,yt=performance.now();G(St=>[...St,{id:Ie,bornAt:yt}]),U(()=>{G(St=>St.filter(Xt=>Xt.id!==Ie))},900)},onLockChange:we})}),a.jsx("div",{className:"soldier-vignette","aria-hidden":"true"}),a.jsx("div",{className:"soldier-color-grade","aria-hidden":"true"}),c==="playing"&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:`soldier-weapon-wrap${X?" ads":""}`,"aria-hidden":"true",ref:oe,children:a.jsxs("div",{className:`soldier-weapon-pivot${X?" ads":""}`,style:{transform:X?"none":`rotate(${ce.toFixed(3)}deg)`},children:[a.jsx("img",{src:ixe,alt:"","aria-hidden":"true",className:`soldier-viewmodel${X?" ads":""}${L?" firing":""}${jr?" recoil":""}${re?" walking":""}`,draggable:!1}),jr&&!X&&a.jsx("img",{src:lxe,alt:"","aria-hidden":"true",className:"soldier-muzzle-flash",draggable:!1})]})}),Mt&&a.jsx("img",{src:cxe,alt:"","aria-hidden":"true",className:"soldier-blood-burst",draggable:!1})]}),Qe&&a.jsx("div",{className:"soldier-damage-vignette"})]}),!n&&a.jsx("div",{className:"soldier-look-pad",onPointerDown:De,onPointerMove:Ye,onPointerUp:Re,onPointerCancel:Re}),!n&&a.jsx("div",{className:"soldier-move-pad",onPointerDown:ke,onPointerMove:Ue,onPointerUp:ct,onPointerCancel:ct,children:xe.active&&a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"soldier-move-stick-base",style:{left:xe.baseX,top:xe.baseY}}),a.jsx("div",{className:"soldier-move-stick-knob",style:{left:xe.knobX,top:xe.knobY}})]})}),!s&&a.jsxs("div",{className:"soldier-hud",children:[a.jsx("div",{className:"soldier-hud-top duel",children:a.jsxs("div",{className:"soldier-duel-portrait enemy",children:[a.jsx("span",{className:"soldier-duel-role",children:"Hostile force"}),a.jsx("span",{className:"soldier-duel-name",children:Yr(t.piece)}),a.jsx("div",{className:"soldier-duel-hp-bar enemy",children:a.jsx("div",{className:"soldier-duel-hp-fill enemy",style:{width:`${Math.max(0,Math.min(100,p.botHp/(Wd*Fc)*100))}%`}})}),a.jsx("span",{className:"soldier-duel-hp-value",children:Math.max(0,Math.ceil(p.botHp))})]})}),c==="playing"&&a.jsx("div",{className:`soldier-reticle${K?" locked":""}`}),c==="playing"&&lr&&a.jsx("div",{className:"soldier-hit-marker","aria-hidden":"true"}),c==="playing"&&a.jsxs("div",{className:"soldier-kill-counter","aria-label":"Enemies down",children:[a.jsx("span",{className:"soldier-kill-counter-value",children:p.kills}),a.jsx("span",{className:"soldier-kill-counter-sep",children:"/"}),a.jsx("span",{className:"soldier-kill-counter-total",children:Fc})]}),c==="playing"&&W.length>0&&a.jsx("div",{className:"soldier-kill-toast-stack","aria-hidden":"true",children:W.map(Ie=>a.jsx("span",{className:"soldier-kill-toast",children:"ENEMY DOWN"},Ie.id))}),a.jsxs("div",{className:"soldier-duel-portrait player",children:[a.jsx("span",{className:"soldier-duel-role",children:"Strike team"}),a.jsx("span",{className:"soldier-duel-name",children:Yr(e.piece)}),a.jsx("div",{className:"soldier-hp-bar",children:a.jsx("div",{className:"soldier-hp-bar-fill",style:{width:`${Math.max(0,Math.min(100,p.playerHp/$h*100))}%`}})}),a.jsx("span",{className:"soldier-duel-hp-value",children:Math.max(0,Math.ceil(p.playerHp))})]})]}),c==="playing"&&!n&&a.jsxs("button",{type:"button",className:`soldier-fire-btn${L?" active":""}`,onPointerDown:ne,onPointerMove:ue,onPointerUp:B,onPointerCancel:B,"aria-label":"Fire",children:[a.jsx("span",{className:"soldier-fire-btn-icon","aria-hidden":"true"}),a.jsx("span",{className:"soldier-fire-btn-label",children:"FIRE"})]}),c==="playing"&&!n&&a.jsxs("button",{type:"button",className:`soldier-ads-btn${X?" active":""}`,onPointerDown:Ie=>{Ie.preventDefault(),fe()},"aria-label":"Aim Down Sights","aria-pressed":X,children:[a.jsx("span",{className:"soldier-ads-btn-icon","aria-hidden":"true"}),a.jsx("span",{className:"soldier-ads-btn-label",children:"ADS"})]}),!s&&c==="intro"&&a.jsxs("div",{className:"soldier-splash",style:{backgroundImage:`linear-gradient(180deg, rgba(2,5,10,0.28), rgba(2,5,10,0.82)), url(${zt})`},children:[a.jsx("span",{className:"soldier-splash-kicker",children:"Tactical encounter"}),a.jsx("h2",{children:"Faction Duel"}),a.jsxs("p",{children:[Yr(e.piece)," vs. ",Yr(t.piece)]}),a.jsxs("p",{children:["1v1 — eliminate your opponent to claim ",vz," energy."]})]}),c==="kill-cam"&&a.jsx("div",{className:`soldier-kill-cam ${h.current?"win":"loss"}`,children:a.jsx("span",{className:"soldier-kill-cam-text",children:h.current?"ENEMY DOWN":"ELIMINATED"})}),c==="codebreaker"&&a.jsx(bz,{attacker:e,defender:t,onComplete:Ie=>kt(Ie.winnerId===e.id)}),c==="result"&&f&&a.jsxs("div",{className:`soldier-splash ${dt?"win":"loss"}`,style:{backgroundImage:`linear-gradient(180deg, rgba(2,5,10,0.24), rgba(2,5,10,0.82)), url(${br})`},children:[a.jsx("span",{className:"soldier-splash-kicker",children:"Combat report"}),a.jsx("h2",{children:dt?"Duel Won":"Duel Lost"}),f.creditsStolen>0&&a.jsxs("p",{children:["✦ ",f.creditsStolen.toLocaleString()," energy ",dt?"seized":"forfeited"]})]})]})},uxe=Object.freeze(Object.defineProperty({__proto__:null,default:Sz},Symbol.toStringTag,{value:"Module"})),Ez="/models/zentara_ship.glb",z_=2.4,dxe=.4,pxe=6;function fxe({tint:e}){const t=l.useRef(null),r=l.useRef(performance.now()),n=zl(Ez),s=l.useMemo(()=>{const o=n.scene.clone(!0),i=new os().setFromObject(o),c=new An;i.getSize(c);const p=2/(Math.max(c.x,c.y,c.z)||1);o.scale.setScalar(p);const d=new os().setFromObject(o),f=new An;if(d.getCenter(f),o.position.sub(f),e){const m=new Xn(e);o.traverse(h=>{const b=h;if(b.isMesh&&b.material){const g=b.material.clone();"color"in g&&g.color.lerp(m,.55),b.material=g}})}return o},[n.scene,e]);return zs(()=>{if(!t.current)return;const o=(performance.now()-r.current)/1e3,i=Math.min(1,o/pxe),c=1-Math.pow(1-i,3),u=z_+(dxe-z_)*c;t.current.scale.setScalar(u);const p=o,d=Math.sin(p*.55)*.55+Math.sin(p*1.7)*.12;t.current.rotation.z=d,t.current.rotation.y=Math.PI+Math.sin(p*.45)*.18,t.current.position.y=Math.sin(p*.6)*.08,t.current.position.x=Math.sin(p*.33)*.18+d*.12}),a.jsxs("group",{ref:t,rotation:[-.18,Math.PI,0],scale:z_,children:[a.jsx("primitive",{object:s}),a.jsx(sT,{tint:e,offsetX:-.35}),a.jsx(sT,{tint:e,offsetX:.35})]})}function sT({tint:e,offsetX:t}){const r=l.useRef(null),n=l.useRef(null),s=l.useRef(null),o=l.useRef(null),i=l.useRef(null),c=l.useRef(null),u=l.useMemo(()=>new Xn("#e6f4ff"),[]),p=l.useMemo(()=>{const d=new Xn("#6cb8ff");return e&&d.lerp(new Xn(e),.5),d},[e]);return zs(()=>{const d=performance.now()*.001,f=.82+.18*Math.sin(d*33+t*5)*Math.sin(d*11),m=.88+.12*Math.sin(d*4.2),h=f*m;if(n.current&&r.current){n.current.opacity=Math.min(1,1.4*h);const b=1+.12*Math.sin(d*9+t*7);r.current.scale.set(b,b*1.4,1)}if(o.current&&s.current){o.current.opacity=.95*h;const b=1+.22*Math.sin(d*6+t*3);s.current.scale.set(b,b*1.15,1)}if(c.current&&i.current){c.current.opacity=.7*h;const b=1+.45*Math.sin(d*7+t*2);i.current.scale.set(.95,b,1)}}),a.jsxs("group",{position:[t,-.05,-1],children:[a.jsxs("mesh",{ref:s,children:[a.jsx("planeGeometry",{args:[1.6,1.6]}),a.jsx("meshBasicMaterial",{ref:o,color:p,transparent:!0,opacity:.95,blending:la,depthWrite:!1,toneMapped:!1})]}),a.jsxs("mesh",{ref:r,children:[a.jsx("planeGeometry",{args:[.8,.8]}),a.jsx("meshBasicMaterial",{ref:n,color:u,transparent:!0,opacity:1,blending:la,depthWrite:!1,toneMapped:!1})]}),a.jsxs("mesh",{ref:i,position:[0,-.7,-.05],children:[a.jsx("planeGeometry",{args:[.55,2.2]}),a.jsx("meshBasicMaterial",{ref:c,color:p,transparent:!0,opacity:.7,blending:la,depthWrite:!1,toneMapped:!1})]})]})}const Pz=({tint:e,size:t=140})=>a.jsx("div",{style:{width:t,height:t,pointerEvents:"none"},children:a.jsxs(gm,{orthographic:!0,camera:{position:[0,0,5],zoom:32,near:.1,far:100},gl:{alpha:!0,antialias:!0,powerPreference:"high-performance"},style:{background:"transparent"},children:[a.jsx("ambientLight",{intensity:.55}),a.jsx("directionalLight",{position:[3,4,5],intensity:1.3,color:"#fff1d4"}),a.jsx("directionalLight",{position:[-3,-1,-2],intensity:.7,color:"#6cc8ff"}),a.jsx(l.Suspense,{fallback:null,children:a.jsx(fxe,{tint:e})})]})});var GT,XT;try{(XT=(GT=zl).preload)==null||XT.call(GT,Ez)}catch{}const mm=18,og=26,ig=3,oT=1100,iT=3500,lg=22,mxe=.16,hxe=.24,gxe={1:1,2:1.2,3:1.4,4:1.6,5:1.8,6:2},cg=1e4,B_=2,lT=5e3,ug=2e3,yxe=600,yl=["READY","3","2","1","FIRE"],cT="zentara.sniper.coachmark.v1",bxe=Fd.bullseye*mm,vxe=Fd.hit*mm,F_=Fd.graze*mm,Cz=({defender:e,onComplete:t,groupColor:r="#9d4edd",botPilot:n=!1})=>{const[s,o]=l.useState(!1),[i,c]=l.useState(null),[u,p]=l.useState(!1),[d,f]=l.useState(null),[m,h]=l.useState(!1),[b,g]=l.useState(B_),y=l.useRef("miss"),x=l.useMemo(()=>{const Xe=e.heroId?Ta[e.heroId]:void 0,bt=(Xe==null?void 0:Xe.tier)??1;return mxe*gxe[bt]},[e.heroId]),[v,A]=l.useState(null),[_,w]=l.useState(0),j=l.useRef(!1),[T,R]=l.useState(()=>{if(typeof window>"u")return!1;try{return window.localStorage.getItem(cT)!=="seen"}catch{return!1}}),P=l.useRef(typeof window<"u"&&window.__sniperDebug===!0),k=l.useRef(null),E=l.useRef(null),M=l.useRef(null),C=l.useRef(null),I=l.useRef(null),L=l.useRef(null),N=l.useRef(null),S=l.useRef(null),F=l.useRef(performance.now()),D=l.useRef({x:0,y:0}),H=l.useRef({x:0,y:0}),W=l.useRef(0),G=l.useRef((Math.random()-.5)*lg),$=l.useRef({x:0,y:0}),K=l.useRef({up:!1,down:!1,left:!1,right:!1}),de=l.useRef(null),ie=l.useRef("none"),we=1,he=220,Ae=260,Fe=l.useCallback((Xe,bt)=>{const Pt=Math.sqrt(Xe*Xe+bt*bt);if(Pt>he){const kt=he/Pt;$.current={x:Xe*kt,y:bt*kt}}else $.current={x:Xe,y:bt}},[]);l.useEffect(()=>{if(P.current){j.current=!0,w(yl.length-1);return}let Xe=0;w(Xe);const bt=window.setInterval(()=>{if(Xe+=1,Xe>=yl.length){window.clearInterval(bt),j.current=!0,F.current=performance.now(),w(yl.length);return}w(Xe),na("Light").catch(()=>{})},yxe);return()=>window.clearInterval(bt)},[]),l.useEffect(()=>{Sf({volume:.35})},[]),l.useEffect(()=>{let Xe=0;const bt=()=>{const Pt=performance.now(),kt=(Pt-F.current)/1e3,Ee=I.current;if(!Ee){Xe=requestAnimationFrame(bt);return}const le=Ee.clientWidth,De=Ee.clientHeight,Ye=le/2+Math.sin(kt*Math.PI*2*x)*le*hxe,Re=De/2+Math.cos(kt*Math.PI*2*x*.6)*30;D.current={x:Ye,y:Re};const et=M.current;et&&(et.style.left=`${Ye}px`,et.style.top=`${Re}px`);const rt=C.current;if(rt){const zt=Ye-W.current,br=Math.max(-18,Math.min(18,zt*1.2));rt.style.transform=`rotate(${br}deg)`}W.current=Ye;let ne=og;if(i!==null){const zt=Pt-i;zt<=oT?ne=og-(og-ig)*(zt/oT):zt<=iT?ne=ig:ne=ig+(og-ig)*Math.min(1,(zt-iT)/600)}const ue=Math.sin(kt*1.7)*ne+Math.cos(kt*.9)*ne*.4+G.current,B=Math.cos(kt*1.3)*ne+Math.sin(kt*2.1)*ne*.3,fe=$.current,ye=ue+fe.x,ve=B+fe.y;H.current={x:le/2+ye,y:De/2+ve};const ke=k.current;ke&&(ke.style.transform=`translate(calc(-50% + ${ye}px), calc(-50% + ${ve}px))`);const Ue=E.current;if(Ue){const zt=Math.max(20,ne*4);Ue.style.width=`${zt}px`,Ue.style.height=`${zt}px`}const ct=H.current.x-Ye,dt=H.current.y-Re,Rt=Math.sqrt(ct*ct+dt*dt);let jr="none";if(Rt<=bxe?jr="bullseye":Rt<=vxe?jr="hit":Rt<=F_&&(jr="graze"),jr!==ie.current){const zt=ie.current;ie.current=jr,ke&&(ke.classList.toggle("locked-graze",jr==="graze"),ke.classList.toggle("locked-hit",jr==="hit"),ke.classList.toggle("locked-bullseye",jr==="bullseye")),u||(jr==="bullseye"&&zt!=="bullseye"?na("Medium").catch(()=>{}):jr==="hit"&&(zt==="none"||zt==="graze")&&na("Light").catch(()=>{}))}const Qe=S.current;Qe&&(Qe.textContent=`RANGE ▸ ${(Rt/mm).toFixed(1)}°`);const Mt=j.current?Math.max(0,cg-(Pt-F.current)):cg,lr=N.current;if(lr){lr.textContent=`⏱ ${(Mt/1e3).toFixed(1)}s`;const zt=Mt<ug;lr.classList.toggle("zentara-sniper-hud-block--urgent",zt)}if(Ee){let zt=0;Mt<ug?zt=1:Mt<lT&&(zt=.5*(1-(Mt-ug)/(lT-ug))),Ee.style.setProperty("--pressure",zt.toFixed(3))}u||(Xe=requestAnimationFrame(bt))};return Xe=requestAnimationFrame(bt),()=>cancelAnimationFrame(Xe)},[i,u,x]);const U=l.useCallback(()=>{u||(o(!0),c(performance.now()),na("Light").catch(()=>{}))},[u]),V=l.useCallback(()=>{o(!1),setTimeout(()=>c(null),50)},[]),z=l.useCallback(Xe=>{de.current={x:Xe.clientX,y:Xe.clientY,ax:$.current.x,ay:$.current.y};try{Xe.currentTarget.setPointerCapture(Xe.pointerId)}catch{}},[]),O=l.useCallback(Xe=>{const bt=de.current;if(!bt)return;const Pt=bt.ax+(Xe.clientX-bt.x)*we,kt=bt.ay+(Xe.clientY-bt.y)*we;Fe(Pt,kt)},[Fe]),q=l.useCallback(Xe=>{de.current=null;try{Xe.currentTarget.releasePointerCapture(Xe.pointerId)}catch{}},[]),X=l.useCallback(Xe=>{u||Xe.target.closest(".zentara-sniper-btn, .zentara-sniper-controls, .zentara-sniper-pad-zone, .zentara-sniper-fire-btn")||z(Xe)},[u,z]),Z=O,Q=q,oe=l.useCallback(Xe=>{u||(Xe.stopPropagation(),U(),z(Xe))},[u,U,z]),ce=l.useCallback(Xe=>{de.current&&(Xe.stopPropagation(),O(Xe))},[O]),_e=l.useCallback(Xe=>{!de.current&&!s||(Xe.stopPropagation(),q(Xe),V())},[s,q,V]),re=l.useCallback(()=>{const Xe=L.current;Xe&&Xe.classList.remove("active");const bt=I.current;bt&&bt.classList.remove("zentara-sniper-overlay--slowmo");const Pt=M.current;Pt&&Pt.classList.remove("zentara-sniper-target--hit"),$.current={x:0,y:0},de.current=null,G.current=(Math.random()-.5)*lg,F.current=performance.now(),y.current="miss",g(B_),o(!1),c(null),h(!1),f(null),p(!1),A(null)},[]),pe={miss:0,graze:1,hit:2,bullseye:3},ee=l.useCallback(()=>{const Xe=L.current;Xe&&Xe.classList.remove("active");const bt=I.current;bt&&bt.classList.remove("zentara-sniper-overlay--slowmo");const Pt=M.current;Pt&&Pt.classList.remove("zentara-sniper-target--hit"),$.current={x:0,y:0},de.current=null,G.current=(Math.random()-.5)*lg,F.current=performance.now(),o(!1),c(null),h(!1),f(null),p(!1),A(null)},[]),xe=l.useCallback(()=>{if(u||!j.current&&!P.current)return;p(!0),h(!0),na("Heavy").catch(()=>{}),Lo({volume:.8}),setTimeout(()=>h(!1),120);const Xe=H.current.x-D.current.x,bt=H.current.y-D.current.y,kt=Math.sqrt(Xe*Xe+bt*bt)/mm;let Ee="miss";kt<=Fd.bullseye?Ee="bullseye":kt<=Fd.hit?Ee="hit":kt<=Fd.graze&&(Ee="graze");const le=L.current,De=I.current;if(le&&De){const Ye=De.getBoundingClientRect(),Re=Ye.width/2,et=Ye.height-8,rt=D.current.x,ne=D.current.y;le.setAttribute("x1",String(Re)),le.setAttribute("y1",String(et)),le.setAttribute("x2",String(rt)),le.setAttribute("y2",String(ne));const ue=Ee==="miss"?"#ff4d4d":Ee==="graze"?"#ffa500":Ee==="hit"?"#41e077":"#ffd700";le.setAttribute("stroke",ue),le.classList.add("active")}pe[Ee]>pe[y.current]&&(y.current=Ee),setTimeout(()=>{if(f(Ee),Ee!=="miss"){Xa({volume:.7});const et=I.current;et&&et.classList.add("zentara-sniper-overlay--slowmo");const rt=M.current;rt&&rt.classList.add("zentara-sniper-target--hit"),A({id:performance.now(),x:D.current.x,y:D.current.y})}const Ye=b-1;g(Ye);const Re=Ye<=0||Ee!=="miss";P.current?Re||setTimeout(ee,1200):Re?setTimeout(()=>t(y.current),Ee==="miss"?1500:2e3):setTimeout(ee,1200)},250)},[u,t,b,ee,pe]),Le=l.useRef(null),Ge=l.useRef(xe);Ge.current=xe,l.useEffect(()=>{if(!n||u||!j.current)return;const Xe=String(b);if(Le.current===Xe)return;Le.current=Xe;const bt=setTimeout(()=>{const kt=D.current,Ee=H.current,le=(Math.random()-.5)*F_*1.8,De=(Math.random()-.5)*F_*1.8;$.current.x+=kt.x-Ee.x+le,$.current.y+=kt.y-Ee.y+De},500),Pt=setTimeout(()=>Ge.current(),1400);return()=>{clearTimeout(bt),clearTimeout(Pt)}},[n,u,_,b]),l.useEffect(()=>{let Xe=0,bt=performance.now();const Pt=Ye=>{const Re=Ye,et=Re==null?void 0:Re.tagName;return et==="INPUT"||et==="TEXTAREA"||et==="SELECT"||!!(Re!=null&&Re.isContentEditable)},kt=(Ye,Re)=>{const et=K.current;switch(Ye){case"KeyW":case"ArrowUp":return et.up=Re,!0;case"KeyS":case"ArrowDown":return et.down=Re,!0;case"KeyA":case"ArrowLeft":return et.left=Re,!0;case"KeyD":case"ArrowRight":return et.right=Re,!0;default:return!1}},Ee=()=>{const Ye=performance.now(),Re=Math.min(.05,Math.max(0,(Ye-bt)/1e3));if(bt=Ye,!u){const et=K.current,rt=(et.right?1:0)-(et.left?1:0),ne=(et.down?1:0)-(et.up?1:0);if(rt!==0||ne!==0){const ue=Math.sqrt(rt*rt+ne*ne)||1,B=$.current;Fe(B.x+rt/ue*Ae*Re,B.y+ne/ue*Ae*Re)}}Xe=requestAnimationFrame(Ee)},le=Ye=>{if(!Pt(Ye.target)){if(kt(Ye.code,!0)){Ye.preventDefault();return}if(Ye.code==="ShiftLeft"||Ye.code==="ShiftRight"){Ye.preventDefault(),Ye.repeat||U();return}(Ye.code==="Space"||Ye.code==="Enter"||Ye.code==="KeyF")&&(Ye.preventDefault(),!Ye.repeat&&!u&&xe())}},De=Ye=>{if(kt(Ye.code,!1)){Ye.preventDefault();return}(Ye.code==="ShiftLeft"||Ye.code==="ShiftRight")&&(Ye.preventDefault(),V())};return Xe=requestAnimationFrame(Ee),window.addEventListener("keydown",le),window.addEventListener("keyup",De),()=>{cancelAnimationFrame(Xe),window.removeEventListener("keydown",le),window.removeEventListener("keyup",De),K.current={up:!1,down:!1,left:!1,right:!1},V()}},[V,xe,u,Fe,U]),l.useEffect(()=>{if(u||P.current)return;const Xe=window.setInterval(()=>{if(j.current&&performance.now()-F.current>=cg&&(window.clearInterval(Xe),!u)){p(!0),f("miss");const bt=b-1;g(bt),bt<=0?setTimeout(()=>t(y.current),1500):setTimeout(ee,1200)}},100);return()=>window.clearInterval(Xe)},[u,t,b,ee]);const _t=l.useCallback(()=>{R(!1);try{window.localStorage.setItem(cT,"seen")}catch{}},[]);return l.useEffect(()=>{if(!T||_<yl.length)return;const Xe=window.setTimeout(_t,2e3);return()=>window.clearTimeout(Xe)},[T,_t,_]),a.jsxs("div",{className:"zentara-sniper-overlay",ref:I,onPointerDown:X,onPointerMove:Z,onPointerUp:Q,onPointerCancel:Q,style:{touchAction:"none",cursor:u?"default":"crosshair"},children:[a.jsx("div",{className:"zentara-sniper-stars zentara-sniper-stars--back"}),a.jsx("div",{className:"zentara-sniper-stars zentara-sniper-stars--front"}),a.jsx("div",{className:"zentara-sniper-target",ref:M,children:a.jsx("div",{className:"zentara-sniper-target-bank",ref:C,children:a.jsx(Pz,{tint:e.pieceColor,size:140})})}),a.jsx("div",{className:"zentara-sniper-scope"}),a.jsx("svg",{className:"zentara-sniper-tracer-svg",overflow:"visible","aria-hidden":"true",children:a.jsx("line",{ref:L,x1:"0",y1:"0",x2:"0",y2:"0"})}),v&&a.jsx("img",{src:E1,alt:"","aria-hidden":"true",className:"zentara-sniper-impact-explosion zentara-blast-explosion",style:{left:v.x,top:v.y}},v.id),a.jsxs("div",{className:"zentara-sniper-reticle",ref:k,children:[a.jsx("div",{className:"zentara-sniper-stability-ring",ref:E}),a.jsx("div",{className:"zentara-sniper-dot"}),a.jsx("div",{className:"zentara-sniper-wind-arrow",style:{"--wind-mag":`${Math.abs(G.current)/lg}`,"--wind-dir":G.current>=0?"1":"-1"},"aria-hidden":"true"})]}),a.jsx("div",{className:"zentara-sniper-pressure-vignette"}),a.jsx("div",{className:"zentara-sniper-hud zentara-sniper-hud--top-left",children:a.jsxs("div",{className:"zentara-sniper-hud-block",children:["TARGET ▸ ",e.displayName.toUpperCase()]})}),a.jsxs("div",{className:"zentara-sniper-hud zentara-sniper-hud--top-right",children:[a.jsxs("div",{className:"zentara-sniper-hud-block",style:{color:r,borderColor:r},children:["🔫 ",b,"/",B_]}),a.jsxs("div",{className:"zentara-sniper-hud-block",ref:N,style:{color:r,borderColor:r},children:["⏱ ",(cg/1e3).toFixed(1),"s"]})]}),a.jsx("div",{className:"zentara-sniper-hud zentara-sniper-hud--bottom-center",children:a.jsx("div",{className:"zentara-sniper-hud-block zentara-sniper-hud-block--range",ref:S,children:"RANGE ▸ —"})}),!u&&a.jsxs(a.Fragment,{children:[a.jsx("div",{"data-no-global-haptic":!0,className:`zentara-sniper-pad-zone${s?" active":""}`,onPointerDown:oe,onPointerMove:ce,onPointerUp:_e,onPointerCancel:_e,children:a.jsxs("div",{className:"zentara-sniper-pad-icon",children:[a.jsxs("svg",{width:"56",height:"56",viewBox:"0 0 48 48",fill:"none",children:[a.jsx("circle",{cx:"24",cy:"24",r:"22",stroke:"rgba(0,255,200,0.55)",strokeWidth:"2.5"}),a.jsx("circle",{cx:"24",cy:"24",r:"8",fill:"rgba(0,255,200,0.4)"}),a.jsx("path",{d:"M24 6 L24 14 M24 34 L24 42 M6 24 L14 24 M34 24 L42 24",stroke:"rgba(0,255,200,0.55)",strokeWidth:"2.5",strokeLinecap:"round"})]}),a.jsx("span",{className:"zentara-sniper-pad-label",children:s?"STEADY":"AIM"})]})}),a.jsx("button",{"data-no-global-haptic":!0,className:"zentara-sniper-fire-btn",onClick:Xe=>{Xe.stopPropagation(),xe()},children:"FIRE"})]}),u&&P.current&&d&&a.jsxs("div",{className:"zentara-sniper-controls zentara-sniper-controls--debug",children:[a.jsx("button",{className:"zentara-sniper-btn zentara-sniper-btn--fire",onClick:re,children:"🔁 RESET (DEBUG)"}),a.jsx("button",{className:"zentara-sniper-btn zentara-sniper-btn--aim",onClick:()=>t(d),children:"✓ RESOLVE"})]}),m&&a.jsx("div",{className:"zentara-sniper-flash"}),!j.current&&_<yl.length&&!P.current&&a.jsx("div",{className:"zentara-sniper-ready-overlay","aria-hidden":"true",children:a.jsx("div",{className:`zentara-sniper-ready-step zentara-sniper-ready-step--${yl[_].toLowerCase()}`,children:yl[_]},_)}),T&&_>=yl.length&&a.jsxs("div",{className:"zentara-sniper-coachmark",onClick:Xe=>{Xe.stopPropagation(),_t()},children:[a.jsx("div",{className:"zentara-sniper-coachmark-line",children:"DRAG anywhere to aim"}),a.jsx("div",{className:"zentara-sniper-coachmark-line",children:"HOLD the AIM pad to steady"}),a.jsx("div",{className:"zentara-sniper-coachmark-line",children:"TAP FIRE to shoot"})]}),d&&a.jsxs("div",{className:`zentara-sniper-result ${d}`,children:[d==="bullseye"&&"🎯 BULLSEYE",d==="hit"&&"✅ HIT",d==="graze"&&"↘ GRAZE",d==="miss"&&"❌ MISS"]})]})},_xe=2400,wxe=({attacker:e,defender:t,groupColor:r="#9d4edd",onComplete:n})=>{const[s,o]=l.useState(null),i=l.useRef(!1),c=l.useRef(null);l.useEffect(()=>{let p=!1;return fetch("/zentara/spy-strike/sniper-intro.mp4",{method:"HEAD"}).then(d=>{p||o(d.ok)}).catch(()=>{p||o(!1)}),()=>{p=!0}},[]),l.useEffect(()=>{Sf({volume:.5})},[]);const u=()=>{i.current||(i.current=!0,n())};return l.useEffect(()=>{if(s)return;const p=window.setTimeout(u,_xe);return()=>window.clearTimeout(p)},[s]),a.jsx("div",{className:"zentara-sniper-intro",style:{"--group-color":r},onClick:u,children:s?a.jsx("video",{ref:c,className:"zentara-sniper-intro-video",src:"/zentara/spy-strike/sniper-intro.mp4",autoPlay:!0,muted:!0,playsInline:!0,onEnded:u,onError:()=>o(!1)}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"zentara-sniper-intro-stars zentara-sniper-intro-stars--back"}),a.jsx("div",{className:"zentara-sniper-intro-stars zentara-sniper-intro-stars--mid"}),a.jsx("div",{className:"zentara-sniper-intro-stars zentara-sniper-intro-stars--front"}),a.jsx("div",{className:"zentara-sniper-intro-nebula"}),a.jsx("div",{className:"zentara-sniper-intro-target",children:a.jsx(Pz,{tint:t.pieceColor,size:120})}),a.jsx("div",{className:"zentara-sniper-intro-iris"}),a.jsxs("div",{className:"zentara-sniper-intro-reticle",children:[a.jsx("div",{className:"zentara-sniper-intro-crosshair zentara-sniper-intro-crosshair--v"}),a.jsx("div",{className:"zentara-sniper-intro-crosshair zentara-sniper-intro-crosshair--h"}),a.jsx("div",{className:"zentara-sniper-intro-tickring"})]}),a.jsxs("div",{className:"zentara-sniper-intro-hud",children:[a.jsx("div",{className:"zentara-sniper-intro-hud-line",children:"SCOPE ACQUIRING…"}),a.jsxs("div",{className:"zentara-sniper-intro-hud-line zentara-sniper-intro-hud-line--target",children:["TARGET ▸ ",t.displayName.toUpperCase()]}),a.jsxs("div",{className:"zentara-sniper-intro-hud-line zentara-sniper-intro-hud-line--shooter",children:["SHOOTER ▸ ",e.displayName.toUpperCase()]})]}),a.jsx("div",{className:"zentara-sniper-intro-skip",children:"TAP TO SKIP"})]})})},xxe=""+new URL("breach-success-B5KvPAf1.webp",import.meta.url).href,Axe=""+new URL("spy-exposed-j5AkCokU.webp",import.meta.url).href,kxe=Object.assign({"../../assets/heroes/azure-sovereignty-t1.webp":DA,"../../assets/heroes/azure-sovereignty-t2.webp":OA,"../../assets/heroes/azure-sovereignty-t3.webp":zA,"../../assets/heroes/azure-sovereignty-t4.webp":BA,"../../assets/heroes/azure-sovereignty-t5.webp":FA,"../../assets/heroes/azure-sovereignty-t6.webp":UA,"../../assets/heroes/crimson-dominion-t1.webp":qA,"../../assets/heroes/crimson-dominion-t2.webp":VA,"../../assets/heroes/crimson-dominion-t3.webp":HA,"../../assets/heroes/crimson-dominion-t4.webp":WA,"../../assets/heroes/crimson-dominion-t5.webp":GA,"../../assets/heroes/crimson-dominion-t6.webp":XA,"../../assets/heroes/emerald-collective-t1.webp":YA,"../../assets/heroes/emerald-collective-t2.webp":ZA,"../../assets/heroes/emerald-collective-t3.webp":KA,"../../assets/heroes/emerald-collective-t4.webp":QA,"../../assets/heroes/emerald-collective-t5.webp":JA,"../../assets/heroes/emerald-collective-t6.webp":$A,"../../assets/heroes/golden-imperium-t1.webp":ek,"../../assets/heroes/golden-imperium-t2.webp":tk,"../../assets/heroes/golden-imperium-t3.webp":rk,"../../assets/heroes/golden-imperium-t4.webp":nk,"../../assets/heroes/golden-imperium-t5.webp":ak,"../../assets/heroes/golden-imperium-t6.webp":sk,"../../assets/heroes/silver-pact-t1.webp":ok,"../../assets/heroes/silver-pact-t2.webp":ik,"../../assets/heroes/silver-pact-t3.webp":lk,"../../assets/heroes/silver-pact-t4.webp":ck,"../../assets/heroes/silver-pact-t5.webp":uk,"../../assets/heroes/silver-pact-t6.webp":dk,"../../assets/heroes/void-enclave-t1.webp":pk,"../../assets/heroes/void-enclave-t2.webp":fk,"../../assets/heroes/void-enclave-t3.webp":mk,"../../assets/heroes/void-enclave-t4.webp":hk,"../../assets/heroes/void-enclave-t5.webp":gk,"../../assets/heroes/void-enclave-t6.webp":yk}),Rz={};var YT;for(const[e,t]of Object.entries(kxe)){const r=(YT=e.split("/").pop())==null?void 0:YT.replace(".webp","");r&&(Rz[r]=t.default)}const j1=e=>e.trim().toLowerCase()==="you";function Sxe(e,t=!0){return j1(e)?t?"You":"you":e}function Exe(e,t){return j1(e)?a.jsxs(a.Fragment,{children:["You close in on ",a.jsx("strong",{children:t}),"."]}):a.jsxs(a.Fragment,{children:[a.jsx("strong",{children:e})," closes in on ",a.jsx("strong",{children:t}),"."]})}function uT(e){return j1(e)?"your":/s$/i.test(e)?`${e}'`:`${e}'s`}function Pxe(e){return e.charAt(0).toUpperCase()+e.slice(1)}const Cxe=1500,Rxe=2200;function dT({player:e,role:t,align:r}){const n=e.heroId?Rz[e.heroId]:void 0;return a.jsxs("div",{className:`zentara-spystrike-combatant zentara-spystrike-combatant--${r}`,style:{"--combatant-color":e.pieceColor},children:[n?a.jsx("img",{src:n,alt:"",className:"zentara-spystrike-combatant__portrait"}):a.jsx("span",{className:"zentara-spystrike-combatant__fallback","aria-hidden":"true",children:e.displayName.slice(0,1).toUpperCase()}),a.jsxs("span",{className:"zentara-spystrike-combatant__copy",children:[a.jsx("small",{children:t}),a.jsx("strong",{children:e.displayName})]})]})}function pT({attacker:e,defender:t}){return a.jsxs(a.Fragment,{children:[a.jsx(dT,{player:e,role:"Operative",align:"left"}),a.jsx(dT,{player:t,role:"Target",align:"right"})]})}const fT=({pendingEffect:e,attacker:t,defender:r,groupColor:n="#9d4edd",onPuzzleResult:s,onShotResult:o,botPilot:i=!1})=>{var y,x;const c=e.step??"puzzle",[u,p]=l.useState(c==="shot"?"sniper-intro":"intro"),[d,f]=l.useState(null),[m,h]=l.useState(null),b=l.useRef(!1),g=l.useRef(!1);if(l.useEffect(()=>{c==="shot"&&u==="puzzle-result"&&d&&p("sniper-intro")},[c,u,d]),l.useEffect(()=>{if(u!=="puzzle-result"||d===null||b.current)return;const v=setTimeout(()=>{b.current=!0,s(d)},Cxe);return()=>clearTimeout(v)},[u,d,s]),l.useEffect(()=>{if(u!=="shot-result"||m===null||g.current)return;const v=setTimeout(()=>{g.current=!0,o(m)},Rxe);return()=>clearTimeout(v)},[u,m,o]),l.useEffect(()=>{if(!i)return;let v=!1;const A=_=>new Promise(w=>setTimeout(w,_));return(async()=>{if(u==="intro"){if(await A(1800),v)return;p("puzzle");return}})(),()=>{v=!0}},[i,u]),u==="intro")return a.jsx("div",{className:"zentara-spystrike-overlay",children:a.jsxs("div",{className:"zentara-spystrike-card zentara-spystrike-scene",style:{borderColor:n,"--spystrike-scene":`url("${tz}")`},children:[a.jsxs("div",{className:"zentara-spystrike-eyebrow",children:["SPY STRIKE — ",(y=e.group)==null?void 0:y.toUpperCase()]}),a.jsx("h2",{className:"zentara-spystrike-title",children:"🕵️ Operation Authorized"}),a.jsx("h3",{children:"Proceed with mission."}),a.jsx(pT,{attacker:t,defender:r}),a.jsxs("div",{className:"zentara-spystrike-body",children:[a.jsx("p",{children:Exe(t.displayName,r.displayName)}),a.jsxs("ol",{className:"zentara-spystrike-objectives",children:[a.jsxs("li",{children:[a.jsx("strong",{children:"Phase A — Soldier Strike"}),": breach the defended station."]}),a.jsxs("li",{children:[a.jsx("strong",{children:"Phase B — Sniper"}),": line up the target."]})]}),a.jsxs("p",{className:"zentara-spystrike-warning",children:["Failure at either phase: ",a.jsx("strong",{children:"1,000c penalty"})," + planet rent + hero clash."]}),a.jsxs("p",{className:"zentara-spystrike-reward",children:["Success: ",a.jsxs("strong",{children:["vanquish ",uT(r.displayName)," hero"]})," + seize the entire group."]})]}),a.jsx("button",{className:"zentara-spystrike-cta",style:{background:n},onClick:()=>p("puzzle"),children:"BEGIN SOLDIER STRIKE →"})]})});if(u==="puzzle")return a.jsx(Sz,{attacker:t,defender:r,botPilot:i,skipBonus:!0,onComplete:v=>{const A=v.winnerId===t.id;f(A),p("puzzle-result")}});if(u==="puzzle-result"){const v=d===!0;return a.jsx("div",{className:"zentara-spystrike-overlay",children:a.jsxs("div",{className:"zentara-spystrike-card zentara-spystrike-scene",style:{borderColor:v?"#41e077":"#ff4d4d","--spystrike-scene":`url("${v?xxe:Axe}")`},children:[a.jsxs("div",{className:"zentara-spystrike-eyebrow",children:["PHASE A ",v?"COMPLETE":"FAILED"]}),a.jsx("h2",{className:"zentara-spystrike-title",children:v?"⚔️ Station Breached":"🛡️ Strike Repelled"}),a.jsx(pT,{attacker:t,defender:r}),v?a.jsx("p",{className:"zentara-spystrike-body",children:"Soldier Strike successful. Stand by for the sniper phase."}):a.jsx("p",{className:"zentara-spystrike-body",children:"The strike team is defeated. Penalties applied — stand your ground for the rent & hero clash."})]})})}if(u==="sniper-intro")return a.jsx(wxe,{attacker:t,defender:r,groupColor:n,onComplete:()=>p("sniper")});if(u==="sniper")return a.jsx(Cz,{defender:r,groupColor:n,botPilot:i,onComplete:v=>{h(v),p("shot-result")}});if(u==="shot-result"){const v=m!==null&&m!=="miss",A=v?"#41e077":"#ff4d4d",_={bullseye:"BULLSEYE",hit:"CLEAN HIT",graze:"GRAZING SHOT",miss:"SHOT MISSED"};return a.jsx("div",{className:"zentara-spystrike-overlay",children:a.jsxs("div",{className:"zentara-spystrike-card",style:{borderColor:A},children:[a.jsxs("div",{className:"zentara-spystrike-eyebrow",children:["PHASE B ",v?"COMPLETE":"FAILED"]}),a.jsx("h2",{className:"zentara-spystrike-title",children:v?"🎯 Target Down":"💨 Target Escaped"}),a.jsxs("div",{className:"zentara-spystrike-body",children:[a.jsx("p",{style:{fontSize:18,fontWeight:600,color:A,margin:"4px 0 12px"},children:m?_[m]:""}),v?a.jsx(a.Fragment,{children:a.jsxs("p",{className:"zentara-spystrike-reward",children:[a.jsx("strong",{children:Pxe(uT(r.displayName))})," hero is vanquished. The entire",a.jsxs("strong",{children:[" ",(x=e.group)==null?void 0:x.toUpperCase()]})," group falls to ",a.jsx("strong",{children:Sxe(t.displayName,!1)}),"."]})}):a.jsx(a.Fragment,{children:a.jsxs("p",{className:"zentara-spystrike-warning",children:["The spy is exposed. ",a.jsx("strong",{children:"1,000c penalty"})," applied — and you still owe planet rent and a hero clash on landing."]})})]})]})})}return null},Txe=(()=>{try{return zr.isNativePlatform()}catch{return!1}})(),Xw="onb_zentara_v4",U_=[{title:"Welcome, Commander",body:"Zentara is a galactic conquest board game. Command your empire across 40 star systems — capture planets, arm them with defenses, and destroy your rivals.",video:"/videos/planet-capture.mp4",details:["2–6 players — last empire standing wins","Starting credits: 1,500 · Starting HP: 1,500"]},{title:"Capture Planets",body:"Land on an unowned planet and capture it for your empire. Own all planets in a color group to unlock arming — boosting energy toll up to 5 levels.",video:"/videos/space-conquest-1.mp4",details:["22 capturable planets across 8 color groups","Arm evenly — no planet can be 2+ levels ahead"]},{title:"Fleet Combat",body:"When you land on an enemy planet, their turrets deal HP damage to your fleet. Heavy damage triggers a devastating fleet ambush!",video:"/videos/fleet-ambush.mp4",details:["Damage scales with arming level","Opponent earns credits from the damage dealt"]},{title:"Ship Upgrades",body:"Upgrade your flagship with armor to reduce incoming damage and weapons to auto-strike enemy defenses when you roll doubles.",video:"/videos/empire-strike.mp4",details:["🛡️ Armor — 200c per level (15% reduction each)","⚔️ Weapons — 250c per level (destroy enemy arms)"]},{title:"Spy Strike",body:"When an enemy completes a color group, plant a covert spy on it for 1,000 credits. The next time the spy’s owner lands on that group, a Spy Strike triggers — hijack the group on success, lose big on failure.",video:"/videos/empire-strike.mp4",details:["Plant cost: 1,000c · Failure penalty: 1,000c (on top of plant cost)","Phase A — Soldier Strike: breach the defended station","Phase B — Sniper: 7 seconds to hit the target","Win: take ownership of the entire color group","Lose: pay penalty + normal rent + any hero clash"]},{title:"Galactic Conquest",body:"Trade planets, form alliances, navigate wormholes, and survive cryosleep. The last empire standing claims victory over Zentara!",video:"/videos/space-conquest-2.mp4",details:["Trade properties and credits with rivals","Rolling doubles grants an extra roll","Three doubles → forced into cryosleep!"]}],jxe=({open:e,onClose:t})=>{const[r,n]=l.useState(0),[s,o]=l.useState(!1),[i,c]=l.useState(!1),u=l.useRef(null),p=U_.length,d=l.useCallback(()=>{Va.set({key:Xw,value:"1"}),n(0),t()},[t]),f=l.useCallback(x=>{x===r||s||(o(!0),setTimeout(()=>{n(x),o(!1)},300))},[r,s]),m=l.useCallback(()=>{r<p-1?f(r+1):d()},[r,p,f,d]),h=l.useCallback(()=>{r>0&&f(r-1)},[r,f]);if(l.useEffect(()=>{e&&(n(0),o(!1),c(!1))},[e]),l.useEffect(()=>{if(!e)return;const x=v=>{v.key==="Escape"&&d(),(v.key==="ArrowRight"||v.key==="Enter")&&m(),v.key==="ArrowLeft"&&h()};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[e,d,m,h]),l.useEffect(()=>{if(!e)return;const x=u.current;if(!x)return;let v=!1;c(!1),x.currentTime=0;let A=0;const _=()=>{v||x.play().catch(()=>{v||A<3&&(A++,setTimeout(_,200*A))})};if(x.readyState<2){const w=()=>{x.removeEventListener("canplay",w),_()};return x.addEventListener("canplay",w),setTimeout(_,100),()=>{v=!0,x.removeEventListener("canplay",w)}}return _(),()=>{v=!0}},[e,r]),l.useEffect(()=>{if(!e||i)return;const x=setTimeout(()=>c(!0),1500);return()=>clearTimeout(x)},[e,r,i]),l.useEffect(()=>{var x,v,A;if(e)try{(window.__E2E===!0||((v=(x=window.location)==null?void 0:x.search)==null?void 0:v.includes("e2e=1"))||((A=window.sessionStorage)==null?void 0:A.getItem("e2e"))==="1")&&(Va.set({key:Xw,value:"1"}),setTimeout(t,0))}catch{}},[e,t]),!e)return null;const b=U_[r],g=r===p-1,y=(r+1)/p*100;return a.jsxs("div",{className:"z-onb-vid",role:"dialog","aria-modal":"true","aria-label":"Zentara Tutorial",onClick:()=>{var x;(x=u.current)==null||x.play().catch(()=>{})},children:[a.jsx("video",{ref:u,className:"z-onb-vid__bg",src:b.video,autoPlay:!0,muted:!0,loop:!0,playsInline:!0,preload:"auto",controls:!1,onCanPlay:()=>{var x;(x=u.current)==null||x.play().catch(()=>{})},onError:()=>c(!0),onPlaying:()=>{setTimeout(()=>c(!0),Txe?500:0)},style:i?void 0:{opacity:0}},b.video),a.jsx("div",{className:"z-onb-vid__overlay"}),a.jsx("div",{className:"z-onb-vid__progress",children:a.jsx("div",{className:"z-onb-vid__progress-fill",style:{width:`${y}%`}})}),a.jsx("button",{className:"z-onb-vid__skip",onClick:d,children:"Skip"}),a.jsxs("div",{className:`z-onb-vid__content${s?" z-onb-vid__content--out":""}`,children:[a.jsxs("div",{className:"z-onb-vid__step-num",children:[r+1," / ",p]}),a.jsx("h2",{className:"z-onb-vid__title",children:b.title}),a.jsx("p",{className:"z-onb-vid__body",children:b.body}),b.details&&a.jsx("ul",{className:"z-onb-vid__details",children:b.details.map((x,v)=>a.jsx("li",{children:x},v))})]}),a.jsx("div",{className:"z-onb-vid__dots",children:U_.map((x,v)=>a.jsx("button",{className:`z-onb-vid__dot${v===r?" z-onb-vid__dot--active":""}`,onClick:()=>f(v),"aria-label":`Go to step ${v+1}`},v))}),a.jsxs("div",{className:"z-onb-vid__nav",children:[r>0?a.jsx("button",{className:"z-onb-vid__btn z-onb-vid__btn--ghost",onClick:h,children:"Back"}):a.jsx("span",{}),a.jsx("button",{className:"z-onb-vid__btn z-onb-vid__btn--primary",onClick:m,children:g?"Begin Conquest":"Next"})]})]})};function Ixe(){const[e,t]=l.useState(!1),[r,n]=l.useState(!1);return l.useEffect(()=>{(async()=>{try{const{value:s}=await Va.get({key:Xw});t(s!=="1")}catch{t(!0)}n(!0)})()},[]),{showOnboardingVideo:e&&r,onboardingReady:r,dismissOnboardingVideo:()=>t(!1)}}const Nxe=""+new URL("logo-Ds4ViVZo.webp",import.meta.url).href,Tz={version:1,generatedAt:null,planets:{}};let Uc=null,dg=null;function ef(e){return e.toLowerCase().replace(/[^a-z0-9]+/g,"-").replace(/^-|-$/g,"")}function Mxe(){const e="".trim();return e?e.endsWith(".json")?e:`${e.replace(/\/$/,"")}/manifest.json`:"/zentara/planets/manifest.json"}function Lxe(e){if(/^(https?:|data:|blob:)/i.test(e))return e;const t="".trim();if(!t)return e;const r=t.endsWith(".json")?t.slice(0,t.lastIndexOf("/")):t.replace(/\/$/,""),n=e.split("/").pop();return n?`${r}/${n}`:e}async function Dxe(){return Uc||(dg||(dg=fetch(Mxe(),{cache:"no-cache"}).then(async e=>{if(!e.ok)throw new Error(`planet manifest ${e.status}`);const t=await e.json(),r=Object.fromEntries(Object.entries(t.planets??{}).map(([n,s])=>[n,{...s,imageUrl:Lxe(s.imageUrl)}]));return Uc={...t,planets:r},Uc}).catch(()=>Tz).finally(()=>{dg=null})),dg)}function Oxe(){const[e,t]=l.useState((Uc==null?void 0:Uc.planets)??Tz.planets);return l.useEffect(()=>{let r=!0;return Dxe().then(n=>{r&&t(n.planets)}),()=>{r=!1}},[]),e}const jz=/^#[0-9a-f]{3,8}$/i,q_=(e,t)=>e&&jz.test(e)?e:t,mT="/models/dice.glb";function zxe(e){const t=e!=null&&e.pieceColor&&jz.test(e.pieceColor)?e.pieceColor:null;return t?`${mT}?tint=${encodeURIComponent(t)}`:mT}const pg={start:L2,planet:Hd,station:L2,asteroid:ewe,nebula:swe,wormhole:twe,tax:D2,"void-drain":D2,jail:rwe,"go-to-jail":nwe,"free-parking":awe},Bxe=ot.lazy(()=>Cr(()=>Promise.resolve().then(()=>uxe),void 0,import.meta.url)),Fxe=new Set(["start","jail","go-to-jail","free-parking"]),Uxe=3e3,qxe=1200,Vxe=450,Hxe=2400,Wxe=700,V_=Ri.FLIGHT_DURATION_MS/4,Gxe=650,bc=["/videos/space-conquest-1.mp4","/videos/space-conquest-2.mp4","/videos/planet-capture.mp4"],hT=["/videos/team-destroyed-2.mp4","/videos/team-destroyed-1.mp4","/videos/team-destroyed-3.mp4"],Xxe=20,Yw=({players:e,localPlayerId:t,savedState:r,onSaveAndExit:n,multiplayerActions:s,multiplayerEvents:o,multiplayerPendingEffect:i,multiplayerPendingTrade:c,multiplayerRollTrigger:u,multiplayerRaidActivity:p,roomId:d,boardSize:f,autoplay:m=!1,botChatEnabled:h=!1,gameRules:b})=>{var O1,z1,B1,F1,U1,q1,V1,H1,W1;const g=Hr(),y=l.useRef(new Set),x=l.useRef((te,me)=>{const We=globalThis.setTimeout(()=>{y.current.delete(We),te()},me);return y.current.add(We),We}),v=l.useRef(te=>{te!==void 0&&(globalThis.clearTimeout(te),y.current.delete(te))});l.useEffect(()=>()=>{y.current.forEach(te=>globalThis.clearTimeout(te)),y.current.clear()},[]);const A=Mme(e,r,f,b,m),_=!!s,w=_?r:A.gameState,j=_?o??[]:A.events,T=_?i??null:A.pendingEffect,R=_?c??null:A.pendingTrade,P=_?u??0:A.rollTrigger,k=_?s:A.actions,E=l.useRef(k);E.current=k;const M=Oxe(),{showAdNow:C,onZentaraTurnEnd:I,isAdShowing:L}=bu(),N=l.useRef(L);N.current=L;const S=As(),{showOnboardingVideo:F,onboardingReady:D,dismissOnboardingVideo:H}=Ixe(),[W,G]=l.useState(null),[$,K]=l.useState(null),de=l.useRef(null),ie=l.useCallback(()=>{try{cr("Light")}catch{}},[]),we=Db();l.useEffect(()=>(we.acquire(),()=>{we.release()}),[we]),l.useEffect(()=>()=>{try{HO()}catch{}},[]),l.useEffect(()=>{var pt;const te=he.current,me=te==null?void 0:te.matchId;if(!me)return;const We=Bme(j,te,(te==null?void 0:te.board)??[],{roundNumber:te==null?void 0:te.roundNumber,phase:((pt=te==null?void 0:te.currentTurn)==null?void 0:pt.phase)??null});Lme(me,"zentara",We)},[j]),l.useEffect(()=>{var me,We;if(_)return;const te=w==null?void 0:w.matchId;if(te)return Dme(te,"zentara",{name:"Zentara · SP",playerCount:((me=w==null?void 0:w.players)==null?void 0:me.length)??1,phase:((We=w==null?void 0:w.currentTurn)==null?void 0:We.phase)??null}),()=>{Ome(te)}},[_,w==null?void 0:w.matchId,(O1=w==null?void 0:w.players)==null?void 0:O1.length,(z1=w==null?void 0:w.currentTurn)==null?void 0:z1.phase]);const he=l.useRef(w);he.current=w,l.useEffect(()=>{if(_)return;const te=()=>{const pt=he.current;pt&&!pt.finished&&GL(pt)},me=()=>{document.visibilityState==="hidden"&&te()};document.addEventListener("visibilitychange",me);let We;return(async()=>{try{const{App:pt}=await Cr(async()=>{const{App:xt}=await Promise.resolve().then(()=>xm);return{App:xt}},void 0,import.meta.url),gt=await pt.addListener("appStateChange",xt=>{xt.isActive||te()});We=()=>{try{gt.remove()}catch{}}}catch{}})(),()=>{te(),document.removeEventListener("visibilitychange",me),We==null||We()}},[_]),l.useEffect(()=>(I8(),()=>{Jf()}),[]),l.useEffect(()=>(document.body.classList.add("page-zentara"),()=>{document.body.classList.remove("page-zentara")}),[]);const[Ae,Fe]=l.useState(null),[U,V]=l.useState(!1),[z,O]=l.useState(!1),[q,X]=l.useState(!1),[Z,Q]=l.useState(!1),[oe,ce]=l.useState([]),[_e,re]=l.useState(0),[pe,ee]=l.useState(null),xe=h&&!m&&!_,Le=l.useMemo(()=>xe?e.filter(te=>te.id!==t).map(te=>({id:te.id,name:te.name})):[],[xe,e,t]),Ge=l.useRef(!1),_t=l.useRef(null);vye({enabled:xe,gameMode:"zentara",bots:Le,localPlayerId:t,requireHumanEngagement:!0,controlsRef:_t,getSituation:()=>{var We,pt;const te=(We=w==null?void 0:w.players)==null?void 0:We.find(gt=>{var xt;return gt.id===((xt=w==null?void 0:w.currentTurn)==null?void 0:xt.playerId)}),me=((pt=w==null?void 0:w.currentTurn)==null?void 0:pt.phase)??"pre-roll";return te?`It's ${te.displayName}'s turn (phase: ${me}) in a Zentara match. React briefly in character.`:"It's a chill moment in a Zentara match."},getHistory:()=>oe.slice(-8).map(te=>{var me;return{author:((me=e.find(We=>We.id===te.senderId))==null?void 0:me.name)||"Bot",text:te.text,senderId:te.senderId}}),onMessage:te=>{ce(me=>{var gt;if(me.some(xt=>xt.id===te.id))return console.log("[zentara-autoplay-chat] dropped duplicate id",te.id),me;const We=8e3;return me.some(xt=>xt.senderId===te.senderId&&xt.text===te.text&&Math.abs(xt.ts-te.ts)<We)?(console.log("[zentara-autoplay-chat] dropped near-duplicate text",{senderId:te.senderId,text:te.text}),me):(console.log("[zentara-autoplay-chat] message received",{id:te.id,from:((gt=e.find(xt=>xt.id===te.senderId))==null?void 0:gt.name)||te.senderId,text:te.text,drawerOpen:Ge.current,total:me.length+1}),[...me,te])}),Ge.current||(ee(te),re(me=>me+1))}}),Ge.current=q,l.useEffect(()=>{q&&(re(0),ee(null))},[q]);const Xe=l.useRef(0);l.useEffect(()=>{if(!xe){Xe.current=j.length;return}if(j.length<=Xe.current){Xe.current=j.length;return}const te=j.slice(Xe.current);Xe.current=j.length;const me=_t.current;if(!me)return;const We=gt=>{var xt;return gt&&((xt=w.players.find(Wt=>Wt.id===gt))==null?void 0:xt.displayName)||"someone"},pt=gt=>{var xt;return((xt=w.board[gt])==null?void 0:xt.name)??`planet ${gt}`};for(const gt of te){let xt=null;switch(gt.type){case"buy":{const Wt=gt.cost??0;Wt>=200&&(xt=`${We(gt.playerId)} just captured ${pt(gt.tileId)} for ${Wt} energy — a high-value pickup.`);break}case"upgrade":{const Wt=gt.level??0;Wt>=3&&(xt=`${We(gt.playerId)} just armed ${pt(gt.tileId)} to Arms Level ${Wt}.`);break}case"strike":xt=`${We(gt.playerId)} struck ${pt(gt.tileId)}.`;break;case"seizure":xt=`${We(gt.attackerId)} seized ${pt(gt.tileId)} from ${We(gt.defenderId)}.`;break;case"hero-clash":{const Wt=gt.finalDamage??0;Wt>=30&&(xt=`Hero clash between ${We(gt.attackerId)} and ${We(gt.defenderId)} — ${Wt} damage dealt.`);break}case"hero-vanquished":xt=`${We(gt.vanquisherId)} vanquished ${We(gt.victimId)}'s hero!`;break;case"hero-restored":xt=`${We(gt.playerId)}'s hero rejoined the fleet.`;break;case"raid":{const Wt=gt.creditsStolen??0;xt=`Raid: ${We(gt.winnerId)} took ${Wt} energy.`;break}case"spy-shot-result":{const Wt=gt.outcome,qr=We(gt.spyOwnerId),nn=We(gt.defenderId);Wt==="bullseye"?xt=`${qr}'s spy bullseyed ${nn}.`:Wt==="hit"?xt=`${qr}'s spy hit ${nn}.`:Wt==="graze"?xt=`${qr}'s spy grazed ${nn}.`:Wt==="miss"&&(xt=`${qr}'s spy missed ${nn}.`);break}case"bankrupt":xt=`${We(gt.playerId)} just went bankrupt.`;break;case"win":xt=`${We(gt.playerId)} just won the match!`;break}if(xt){me.notifyGameEvent(xt);break}}},[j,xe,m,w.players,w.board]);const[bt,Pt]=l.useState(!1),[kt,Ee]=l.useState(null),[le,De]=l.useState(!1),Ye=l.useRef(0),Re=l.useRef(void 0),[et,rt]=l.useState(null),[ne,ue]=l.useState(void 0),B=l.useCallback(te=>{ue(te),E.current.upgradeProperty(te)},[]),[fe,ye]=l.useState(!1),[ve,ke]=l.useState(null),[Ue,ct]=l.useState(0),[dt,Rt]=l.useState(50),jr=l.useRef(void 0),Qe=l.useCallback((te,me=1400)=>{ke(te),ct(We=>We+1),v.current(jr.current),jr.current=x.current(()=>ke(null),me)},[]),[Mt,lr]=l.useState("idle"),[zt,br]=l.useState(void 0),[fr,ur]=l.useState(0),[Ie,yt]=l.useState(""),[St,Xt]=l.useState(null),se=l.useRef(void 0),je=l.useRef(void 0),Oe=l.useRef(void 0),[Ke,Me]=l.useState(!1),[wt,at]=l.useState(!1),[Dt,Ut]=l.useState(!1),[ft,wr]=l.useState(!1),dr=l.useRef(!1),[Vt,Je]=l.useState(null),[mt,Te]=l.useState(null),[Ve,tt]=l.useState(null),[Et,Qt]=l.useState(null),[or,Ht]=l.useState(null),Lt=l.useRef([]),nr=l.useRef(Math.floor(Math.random()*bc.length)),Mr=200,Br=1800,wn=400,Kt=l.useCallback((te,me=Gxe)=>{te&&x.current(te,me)},[]),Jt=l.useCallback(te=>{v.current(je.current),v.current(Oe.current),Te(null),Me(!1),at(!1),dr.current=!1,wr(!1),lr("attack"),yt(`⚔️ ${te.attackerName} — Attack`),br([te.attackDice[0],te.attackDice[1],0]),ur(me=>me+1),v.current(se.current),se.current=x.current(()=>{lr("defense"),yt(`🛡 ${te.defenderName} — Defense`),br([te.defenseDice[0],te.defenseDice[1],0]),ur(me=>me+1),se.current=x.current(()=>{lr("result"),yt(""),br(void 0),Je({attackerName:te.attackerName,defenderName:te.defenderName,attackDice:te.attackDice,defenseDice:te.defenseDice,attackBoostPct:te.attackBoostPct,defenseReducePct:te.defenseReducePct,baseDamage:te.baseDamage,finalDamage:te.finalDamage,tileId:te.tileId,attackHeroId:te.attackHeroId,defendHeroId:te.defendHeroId})},2500)},2500)},[]),un=l.useCallback((te,me,We)=>{const pt=te.filter(Boolean);if(pt.length){if(Ve){Lt.current.push(...pt),Kt(We);return}Lt.current=pt.slice(1),Qt(me??null),tt(pt[0]),Kt(We)}},[Ve,Kt]),Tn=l.useCallback(()=>{if(!Vt||dr.current)return;dr.current=!0,lr("idle"),Je(null),wr(!1),Xt(null);const te=Vt.finalDamage;Rt(te),te<Mr&&ye(!0),Qe(Vt.tileId,1200),Lo(),x.current(()=>Xa(),400),te>=100&&x.current(()=>Xa(),700),te>=250&&x.current(()=>Xa(),1e3),te>=400&&x.current(()=>Xa(),1300),te>=Mr&&(v.current(Ma.current),Ma.current=x.current(()=>{const me=(Vt==null?void 0:Vt.attackerName)??"Attacker",We=(Vt==null?void 0:Vt.defenderName)??"Defender",pt=`${me} dealt ${te} damage to ${We}`;un(["/videos/fleet-ambush.mp4"],pt)},1200))},[Vt,un]);l.useEffect(()=>{if(!m||Mt!=="result"||!Vt)return;const te=x.current(()=>{Tn()},3500);return()=>v.current(te)},[m,Mt,Vt,Tn]);const Kr=l.useCallback((te,me,We)=>{const pt=!!(We!=null&&We.manualRoll);if(Xt(te),lr("intro"),Me(!1),at(pt),Je(null),br(void 0),yt(""),Te(me),v.current(se.current),v.current(je.current),v.current(Oe.current),pt){je.current=x.current(()=>{Me(!0)},Br);return}je.current=x.current(()=>{Jt({...me,attackHeroId:te.atk.heroId,defendHeroId:te.def.heroId})},Br+wn)},[Br,wn,Jt]),Er=l.useCallback(()=>{!wt||!Ke||!mt||!St||(v.current(je.current),Ut(!0),x.current(()=>{Jt({...mt,attackHeroId:St.atk.heroId,defendHeroId:St.def.heroId}),Ut(!1)},300))},[wt,Ke,mt,St,Jt]),[yr,xn]=l.useState(null),[gn,dn]=l.useState(null),[Gr,Sn]=l.useState(null),[Gn,en]=l.useState(!1),Ce=l.useRef(!1),Bn=l.useRef(!1),xr=l.useRef(void 0),Zn=l.useRef(void 0),[$n,Be]=l.useState(!1),[ut,be]=l.useState(null);l.useEffect(()=>{const te=()=>{Ye.current=Date.now()};return window.addEventListener("ui:roll",te),window.addEventListener("ui:roll-interaction",te),()=>{window.removeEventListener("ui:roll",te),window.removeEventListener("ui:roll-interaction",te)}},[]);const Se=l.useCallback(()=>Date.now()-Ye.current<Vxe,[]),nt=l.useCallback(()=>{Se()||n==null||n()},[n,Se]);l.useEffect(()=>(window.__explode=(te=(We=>(We=w.players[w.currentPlayerIndex])==null?void 0:We.tileIndex)()??0,me=100)=>{console.log("[EXPLOSION] 💥 tile",te,"damage",me),Rt(me),Qe(te,1400)},window.__fireLasers=window.__explode,window.__debugBlast=()=>Be(te=>!te),window.__testLasers=te=>{const me=w.properties,We=me.filter(qr=>qr.upgradeLevel>0);if(We.length===0){console.warn("[LASERS] No upgraded turrets on the board — buy & upgrade a property first");return}const pt=te??(new Set(We.map(nn=>nn.ownerId)),We[0].tileId),gt=me.find(qr=>qr.tileId===pt),xt=gt==null?void 0:gt.ownerId,Wt=xt?We.filter(qr=>qr.ownerId===xt).length:0;console.log(`[LASERS] 🔫 Firing ${Wt} turret beam(s) at tile ${pt}`+(xt?` (owner has ${Wt} armed properties)`:" (unowned — no beams will render)")),Rt(200),Qe(pt,2e3)},window.__raid=te=>{var Wt;const me=w.players[w.currentPlayerIndex],We=te??(w.currentPlayerIndex+1)%w.players.length,pt=w.players[We];if(!me||!pt){console.warn("[RAID] invalid player indices");return}console.log(`[RAID] 🎯 ${Yr(me.piece)} → ${Yr(pt.piece)}`);const gt=w.board[me.tileIndex],xt=(gt==null?void 0:gt.type)==="planet"?((Wt=M[ef(gt.name)])==null?void 0:Wt.imageUrl)??Hd:pg[(gt==null?void 0:gt.type)??"start"];xn({attacker:me,defender:pt,miniGame:"fps",tileImage:xt})},window.__codebreaker=te=>{const me=w.players[w.currentPlayerIndex],We=te??(w.currentPlayerIndex+1)%w.players.length,pt=w.players[We];if(!me||!pt){console.warn("[CODEBREAKER] invalid player indices");return}console.log(`[CODEBREAKER] 🔓 ${Yr(me.piece)} → ${Yr(pt.piece)}`),xn({attacker:me,defender:pt,miniGame:"codebreaker"})},window.__soldier=(te,me,We)=>{const pt=w.players[w.currentPlayerIndex],gt=te??(w.currentPlayerIndex+1)%w.players.length,xt=w.players[gt];if(!pt||!xt){console.warn("[SOLDIER FPS] invalid player indices");return}const Wt=w.board[pt.tileIndex],qr=me??(Wt&&Wt.type!=="planet"?Wt.type:"station"),nn=pg[qr];console.log(`[SOLDIER FPS] 🪖 ${Yr(pt.piece)} → ${Yr(xt.piece)} (bg=${qr}${We?", no codebreaker":""})`),xn({attacker:pt,defender:xt,miniGame:"soldier-fps",tileImage:nn,skipBonus:!!We})},window.__spystrike=(te,me,We="puzzle")=>{var qr;const pt=w.players[w.currentPlayerIndex],gt=te??(w.currentPlayerIndex+1)%w.players.length,xt=w.players[gt];if(!pt||!xt){console.warn("[SPY STRIKE] invalid player indices");return}const Wt=me??((qr=w.board.find(nn=>nn.type==="planet"&&nn.group))==null?void 0:qr.group)??"orion";console.log(`[SPY STRIKE] 🕵️ ${Yr(pt.piece)} → ${Yr(xt.piece)} (group: ${Wt}, step: ${We})`),dn({attacker:pt,defender:xt,group:Wt,step:We})},window.__sniper=(te,me)=>{var qr;const We=w.players[w.currentPlayerIndex],pt=te??(w.currentPlayerIndex+1)%w.players.length,gt=w.players[pt];if(!We||!gt){console.warn("[SNIPER] invalid player indices");return}const xt=me??((qr=w.board.find(nn=>nn.type==="planet"&&nn.group))==null?void 0:qr.group),Wt=xt&&ka[xt]||"#9d4edd";window.__sniperDebug!==!1&&(window.__sniperDebug=!0),console.log(`[SNIPER] 🎯 ${Yr(We.piece)} → ${Yr(gt.piece)} (color: ${Wt}, debug: ${!!window.__sniperDebug})`),Sn({attacker:We,defender:gt,groupColor:Wt,runKey:0})},window.__testHeroClash=(te,me,We)=>{const pt=te??w.currentPlayerIndex,gt=me??(pt+1)%w.players.length,xt=w.players[pt],Wt=w.players[gt];if(!xt||!Wt){console.warn("[HERO CLASH] invalid player indices");return}const qr=xt.heroId?Ta[xt.heroId]:null,nn=Wt.heroId?Ta[Wt.heroId]:null,as=Math.ceil(Math.random()*6),va=Math.ceil(Math.random()*6),Us=as+va,Ps=Math.ceil(Math.random()*6),Co=Math.ceil(Math.random()*6),cc=Ps+Co,uc=qr?El(qr.empire,qr.tier):{attack:0},ro=nn?El(nn.empire,nn.tier):{defense:0},fl=Math.min(uc.attack*Us,3),zi=Math.min(ro.defense*cc,.9),zu=100,Bu=Math.round(zu*(1+fl)),Ym=Math.max(1,Math.round(Bu*(1-zi))),Np=We??xt.tileIndex;console.log(`[HERO CLASH] ⚔️ ${Yr(xt.piece)} (${(qr==null?void 0:qr.name)??"no hero"} T${(qr==null?void 0:qr.tier)??0}) 🎲${as}+${va}=${Us} → atk ${(fl*100).toFixed(0)}% vs ${Yr(Wt.piece)} (${(nn==null?void 0:nn.name)??"no hero"} T${(nn==null?void 0:nn.tier)??0}) 🎲${Ps}+${Co}=${cc} → def ${(zi*100).toFixed(0)}% | base ${zu} → boosted ${Bu} → final ${Ym}`),Kr({atk:xt,def:Wt},{attackerName:Yr(xt.piece),defenderName:Yr(Wt.piece),attackDice:[as,va],defenseDice:[Ps,Co],attackBoostPct:Math.round(fl*100),defenseReducePct:Math.round(zi*100),baseDamage:zu,finalDamage:Ym,tileId:Np},{manualRoll:!0})},window.__cutscene=(te="victory",me)=>{const We=me??null;if(te==="destroyed"){un(hT,We??"Fleet destroyed!");return}if(te==="ambush"){un(["/videos/fleet-ambush.mp4"],We??"Fleet ambush!");return}if(te==="conquest"||te==="victory"){un(bc,We??"Victory!");return}if(te.startsWith("/videos/")){un([te],We);return}console.warn("[ZENTARA] Unknown cutscene kind. Use victory, conquest, destroyed, ambush, or a /videos/*.mp4 path.")},window.__cutscene3d=(te="spy-plant",me)=>{if(!["spy-plant","hero-clash","wormhole","raid-victory"].includes(te)){console.warn("[ZENTARA] Unknown realtime cutscene kind. Use spy-plant, hero-clash, wormhole, or raid-victory.");return}const pt=w.players[w.currentPlayerIndex]??null,gt=w.players.find(Wt=>Wt.id!==(pt==null?void 0:pt.id)&&!Wt.depleted)??null,xt=pt?w.board[pt.tileIndex]:null;Ht({kind:te,caption:me??void 0,attacker:pt,defender:gt,groupColor:xt!=null&&xt.group?ka[xt.group]??(pt==null?void 0:pt.pieceColor):pt==null?void 0:pt.pieceColor})},()=>{delete window.__explode,delete window.__fireLasers,delete window.__debugBlast,delete window.__testLasers,delete window.__raid,delete window.__codebreaker,delete window.__soldier,delete window.__spystrike,delete window.__sniper,delete window.__testHeroClash,delete window.__cutscene,delete window.__cutscene3d}),[w.players,w.currentPlayerIndex,w.board,Kr,un]);const[it,Bt]=l.useState(!1),[ir,er]=l.useState(!1),[mr,hr]=l.useState("idle"),[J,$e]=l.useState(null),[jt,Yt]=l.useState(null),Ot=l.useRef(!1);l.useEffect(()=>()=>v.current(Pe.current),[]);const Pe=l.useRef(void 0),[ht,It]=l.useState(!1),Ct=l.useRef(!1);l.useEffect(()=>{if(ne!=null){const te=x.current(()=>ue(void 0),400);return()=>v.current(te)}},[ne]);const pr=l.useRef(void 0),Pr=l.useRef(0),Nr=l.useRef(null);l.useEffect(()=>{if(!w.finished||Nr.current===w.matchId||Ve||or)return;const te=x.current(()=>{Nr.current!==w.matchId&&(Nr.current=w.matchId,C({ignoreMinInterval:!0}).catch(()=>{}))},400);return()=>v.current(te)},[w.matchId,w.finished,Ve,or,C]),l.useEffect(()=>{if(!m||!w.finished)return;const te=x.current(()=>{try{uw()}catch{}const me=typeof crypto<"u"&&crypto.randomUUID?crypto.randomUUID().slice(0,8):Math.random().toString(36).slice(2,10),pt=new URLSearchParams(window.location.search).get("bots"),gt=pt?`?autoplay=1&bots=${encodeURIComponent(pt)}`:"?autoplay=1";g(`/zentara/match/${me}${gt}`,{replace:!0})},12e3);return()=>v.current(te)},[m,w.finished,g]);const Sr=l.useCallback(te=>{const me=w.players.find(We=>We.id===te);return me?Yr(me.piece):"Unknown Fleet"},[w.players]),Qr=l.useCallback(te=>{var me;return((me=w.board[te])==null?void 0:me.name)??`Tile ${te}`},[w.board]);l.useEffect(()=>{if(j.length<=Pr.current){Pr.current=j.length;return}const te=j.slice(Pr.current);Pr.current=j.length;for(const me of te){const We="playerId"in me?me.playerId:"payerId"in me?me.payerId:null,pt=We?Sr(We):"Player",gt=!Ve;switch(me.type){case"move":"passedStart"in me&&me.passedStart&&gt&&S.info(`${pt} passed Command Base`,"+200 energy");break;case"buy":if(We!==t&&!Ve){NS(),nr.current=(nr.current+1)%bc.length;const xt=w.board[me.tileId],Wt=xt!=null&&xt.group?ka[xt.group]:void 0;Qt(a.jsxs(a.Fragment,{children:[a.jsx("span",{style:Wt?{color:Wt}:void 0,children:Qr(me.tileId)})," captured by ",pt]})),tt(bc[nr.current])}else gt&&S.info(`${pt} captured ${Qr(me.tileId)}`,`-${me.cost} energy`);break;case"energy-toll":{const xt=Sr(me.ownerId);gt&&S.info(`${pt} took damage!`,`-${me.amount} energy · ${xt} gained ✦${me.amount}`);break}case"void-drain":gt&&S.info(`${pt} paid supply levy`,`-${me.amount} energy`);break;case"card":gt&&S.info(`${pt} received intel`,me.text),Sf();break;case"jail":gt&&S.info(`${pt} entered cryosleep!`,me.reason==="triple-doubles"?"Triple doubles":""),jx();break;case"jail-free":gt&&S.info(`${pt} woke from cryosleep`,me.method==="pay"?"Paid wake-up fee":me.method==="roll-doubles"?"Rolled doubles":"Used intel");break;case"upgrade":ue(me.tileId),gt&&S.info(`${pt} armed ${Qr(me.tileId)}`,`Arms Level ${me.level}`);break;case"depleted":un(hT,`${pt}'s fleet destroyed!`),Xa();break;case"repossess":gt&&S.info(`${pt} lost ${Qr(me.tileId)}`,`+${me.amount} energy (seized by command)`);break;case"sell":gt&&S.info(`${pt} sold ${Qr(me.tileId)}`,`+${me.amount} energy`);break;case"debt-sell":gt&&S.info(`${pt} evacuated ${Qr(me.tileId)}`,`+${me.amount} energy (debt recovery)`);break;case"debt-liquidate-arm":gt&&S.info(`${pt} liquidated arms at ${Qr(me.tileId)}`,`Arms Level ${me.level} (+${me.refund} energy)`);break;case"trade":{const xt=Sr(me.offererId),Wt=Sr(me.recipientId);gt&&(me.offererId===t?S.info("Trade accepted",`${Wt} accepted your offer`):me.recipientId===t?S.info("Trade completed",`You accepted ${xt}'s offer`):S.info(`${xt} traded with ${Wt}`));break}case"trade-declined":{const xt=Sr(me.offererId),Wt=Sr(me.recipientId);gt&&(me.offererId===t?S.info("Trade declined",`${Wt} declined your offer`):me.recipientId===t&&S.info("Trade declined",`You declined ${xt}'s offer`));break}case"upgrade-armor":gt&&S.info(`${pt} reinforced armor`,`Shield Level ${me.level} (-${me.cost} energy)`);break;case"upgrade-weapon":gt&&S.info(`${pt} upgraded weapons`,`Weapon Level ${me.level} (-${me.cost} energy)`),Lo();break;case"liquidate-armor":gt&&We!==t&&S.info(`${pt} sold armor`,`Shield Level ${me.level} (+${me.refund} energy)`);break;case"liquidate-weapon":gt&&We!==t&&S.info(`${pt} sold weapons`,`Weapon Level ${me.level} (+${me.refund} energy)`);break;case"strike":gt&&S.info(`${pt} struck ${Qr(me.tileId)}!`,`Arms reduced to Level ${me.newLevel}`),Lo(),x.current(()=>Xa(),300);break;case"hero-clash":{const xt=Sr(me.attackerId),Wt=Sr(me.defenderId),qr=me.attackDice[0]+me.attackDice[1],nn=me.defenseDice[0]+me.defenseDice[1],as=Ta[me.attackHeroId],va=Ta[me.defenseHeroId],Us=as?El(as.empire,as.tier).attack:0,Ps=va?El(va.empire,va.tier).defense:0,Co=Math.round(Math.min(Us*qr/7,3)*100),cc=Math.round(Math.min(Ps*nn/7,.9)*100),uc=w.players.find(zi=>zi.id===me.attackerId)??null,ro=w.players.find(zi=>zi.id===me.defenderId)??null,fl=me.attackerId===t||me.defenderId===t;uc&&ro&&Kr({atk:uc,def:ro},{attackerName:xt,defenderName:Wt,attackDice:me.attackDice,defenseDice:me.defenseDice,attackBoostPct:Co,defenseReducePct:cc,baseDamage:me.baseDamage,finalDamage:me.finalDamage,tileId:me.tileId},{manualRoll:fl});break}case"raid":{const xt=Sr(me.attackerId),Wt=Sr(me.defenderId),qr=Sr(me.winnerId);gt&&S.info(`${qr} won the raid!`,`Stole ✦${me.creditsStolen} from ${me.winnerId===me.attackerId?Wt:xt}`);break}case"spy-shot-result":{const xt=Sr(me.spyOwnerId),Wt=Sr(me.defenderId),qr=(me.group??"").toUpperCase();if(gt)switch(me.outcome){case"bullseye":S.info(`🎯 ${xt}'s sniper — BULLSEYE`,`${Wt}'s hero down · ${qr} group seized`);break;case"hit":S.info(`✅ ${xt}'s sniper — CLEAN HIT`,`${Wt}'s hero down · ${qr} group seized`);break;case"graze":S.info(`↘ ${xt}'s sniper — GRAZING SHOT`,`${Wt}'s hero down · ${qr} group seized`);break;case"miss":S.info(`❌ ${xt}'s sniper — MISSED`,"Spy exposed · penalty + rent + hero clash");break}break}case"spy-plant":{const xt=w.players.find(Wt=>Wt.id===me.playerId)??null;Ht({kind:"spy-plant",attacker:xt,groupColor:ka[me.group]??(xt==null?void 0:xt.pieceColor),caption:`${xt?Yr(xt.piece):Sr(me.playerId)} deployed a covert asset`}),Sf();break}case"win":{const xt=w.players.find(Wt=>Wt.id===me.playerId)??null;M8(),un(bc,`${xt?Yr(xt.piece):Sr(me.playerId)} claims victory!`);break}}}},[j,t,Sr,Qr,S,Ve,Kr,un,w.players]),l.useEffect(()=>()=>{v.current(se.current),v.current(je.current),v.current(Oe.current)},[]);const jn=l.useRef(!1);l.useEffect(()=>{if(w.currentTurn.phase!=="done"){jn.current=!1;return}if(!(w.finished||!it||yr)&&!jn.current){jn.current=!0;try{I()}catch{}}},[w.currentTurn.phase,w.finished,it,yr,I]),l.useEffect(()=>{if(w.currentTurn.phase==="done"&&!w.finished&&it&&!yr&&!L&&!$){if(v.current(pr.current),Bn.current){pr.current=x.current(()=>{Bn.current=!1,E.current.endTurn()},2e3);return}pr.current=x.current(()=>{E.current.endTurn()},Uxe)}return()=>{v.current(pr.current)}},[w.currentTurn.phase,w.finished,it,yr,L,$]);const ca=l.useRef(void 0);l.useEffect(()=>{if(!(!it||!w.pendingTeleport))return v.current(ca.current),ca.current=x.current(()=>{Ct.current=!1,Bt(!1),E.current.applyTeleport()},600),()=>{v.current(ca.current)}},[it,w.pendingTeleport]);const es=l.useRef(void 0),Fa=l.useRef(void 0);l.useEffect(()=>(it||(v.current(Fa.current),Fa.current=x.current(()=>{Ct.current=!0,Bt(!0)},Xxe*300+800)),()=>{v.current(Fa.current)}),[it]),l.useEffect(()=>{if(yr){v.current(Zn.current),en(!0);return}en(!1)},[yr]),l.useEffect(()=>()=>{v.current(Zn.current)},[]);const In=l.useRef(!1),ts=["Unfortified","Shield I","Shield II","Shield III","Shield IV","Fortress"];l.useEffect(()=>{var xt;if(!it){In.current=!1;return}if(In.current)return;In.current=!0;const te=w.players[w.currentPlayerIndex];if(!te)return;const me=w.board[te.tileIndex];if(!me||me.type==="jail"||me.type==="go-to-jail"||T)return;const We=w.properties.find(Wt=>Wt.tileId===me.id),pt=We!=null&&We.ownerId?w.players.find(Wt=>Wt.id===We.ownerId):null;let gt;if(pt&&pt.id===te.id){const Wt=We.upgradeLevel,qr=ts[Wt]??"Unfortified",nn="⬢".repeat(Wt)+"⬡".repeat(5-Wt);gt=`Your Territory · ${qr} ${nn}`}else if(pt){const Wt=We.upgradeLevel,qr=ts[Wt]??"Unfortified",nn="⬢".repeat(Wt)+"⬡".repeat(5-Wt),as=(xt=me.rent)==null?void 0:xt[Wt];gt=`Captured by ${Yr(pt.piece)} · ${qr} ${nn}`+(as!=null?` · Damage ✦${as}`:"")+(We.dormant?" · Decommissioned":"")}else me.cost!=null?gt=`Uncontrolled · Capture ✦${me.cost}`:gt={start:"Collect energy",tax:"Supply levy",jail:"Cryosleep chamber","go-to-jail":"Forced cryosleep","free-parking":"Rest stop",wormhole:"Wormhole jump",asteroid:"Random event",nebula:"Intel briefing",station:"Space station"}[me.type]??me.type.replace("-"," ");Ve||S.info(`Landed on ${me.name}!`,gt)},[it,w.players,w.currentPlayerIndex,w.board,w.properties,T,Ve]),l.useEffect(()=>{Ce.current=!1},[P]),l.useEffect(()=>{var Us,Ps,Co,cc,uc;if(yr||Ce.current||!it||w.finished||T)return;const te=w.currentTurn.phase;if(te!=="done"&&te!=="pre-roll"||(Ce.current=!0,(Us=w.gameRules)!=null&&Us.disableRaid))return;const me=w.players[w.currentPlayerIndex];if(!me||me.depleted||me.inJail)return;const We=w.board[me.tileIndex];if(!We||Fxe.has(We.type))return;const pt=w.players.find(ro=>ro.id!==me.id&&!ro.depleted&&!ro.inJail&&ro.tileIndex===me.tileIndex);if(!pt)return;const gt=w.players.find(ro=>ro.id===t),xt=gt==null?void 0:gt.piece,Wt=me.id===t||me.id.startsWith("zentara_bot_")&&w.botControllerId===t;if(_&&!Wt)return;if(m?!0:!!xt&&xt!==me.piece&&xt!==pt.piece){if(m&&!_){const Mp=We.type==="planet"?"fps":"soldier-fps",c3=We.type==="planet"?((Ps=M[ef(We.name)])==null?void 0:Ps.imageUrl)??Hd:pg[We.type];xn({attacker:me,defender:pt,miniGame:Mp,botPilot:!0,tileImage:c3});return}const fl=mbe(),zi=Math.floor(Math.random()*(fl+1)),zu=Oy(zi,fl,me,pt),Bu=zu.winnerId,Ym=Bu===me.id?pt.id:me.id,Np=zu.creditsStolen;v.current(Zn.current),en(!0),Zn.current=x.current(()=>en(!1),Hxe),Np>0&&(!_||Wt)&&E.current.resolveRaid({attackerId:me.id,defenderId:pt.id,winnerId:Bu,creditsStolen:Np});const i3=Yr(((Co=w.players.find(Mp=>Mp.id===Bu))==null?void 0:Co.piece)??"crimson-dominion"),l3=Yr(((cc=w.players.find(Mp=>Mp.id===Ym))==null?void 0:cc.piece)??"crimson-dominion");S.info(`${i3} won the raid!`,`Stole ✦${Np} from ${l3}`),Bn.current=!0,v.current(xr.current),xr.current=x.current(()=>{Bn.current=!1},2e3);return}const nn=We.type==="planet"?"fps":"soldier-fps",as=We.type==="planet"?((uc=M[ef(We.name)])==null?void 0:uc.imageUrl)??Hd:pg[We.type],va=pt.id===t;xn(va?{attacker:pt,defender:me,miniGame:nn,tileImage:as}:{attacker:me,defender:pt,miniGame:nn,tileImage:as})},[it,T,w.currentTurn.phase,w.finished,yr,w.players,w.currentPlayerIndex,w.board,w.botControllerId,t,S,m,_,M]);const rs=l.useCallback(te=>{var pt,gt;if(!yr)return;const me=(pt=w.players[w.currentPlayerIndex])==null?void 0:pt.id,We=me===t||!!(me!=null&&me.startsWith("zentara_bot_"))&&w.botControllerId===t;if(!_||We){const xt=(gt=w.players[w.currentPlayerIndex])==null?void 0:gt.id,Wt=xt?yr.attacker.id===xt?yr.defender.id:yr.attacker.id:yr.defender.id;E.current.resolveRaid({attackerId:xt,defenderId:Wt,winnerId:te.winnerId,creditsStolen:te.creditsStolen,finalHits:te.finalHits,totalSpawned:te.totalSpawned,mode:yr.miniGame==="soldier-fps"?"soldier":"space"})}x.current(()=>Xa(),300),xn(null),Bn.current=!0,v.current(xr.current),xr.current=x.current(()=>{Bn.current=!1},2e3)},[yr,w.players,w.currentPlayerIndex,w.botControllerId,t,_]),Ma=l.useRef(void 0);l.useEffect(()=>{var te;if(!(w.currentTurn.phase!=="action"||!T||!it||!Ct.current)){if(T.action==="energy-toll"){const me=T.amount??50,We=w.players[w.currentPlayerIndex];return(()=>{console.log("[BLAST] Firing turret beams at tile",T.tileId,"damage",me),Rt(me),Qe(T.tileId,1200),me<Mr&&ye(!0),Lo(),x.current(()=>Xa(),400),me>=100&&x.current(()=>Xa(),700),me>=250&&x.current(()=>Xa(),1e3),me>=400&&x.current(()=>Xa(),1300),me>=Mr?(v.current(Ma.current),Ma.current=x.current(()=>{const gt=w.properties.find(nn=>nn.tileId===T.tileId),xt=gt!=null&&gt.ownerId?w.players.find(nn=>nn.id===gt.ownerId):null,Wt=xt?Yr(xt.piece):"Enemy",qr=We?Yr(We.piece):"Fleet";Qt(`${Wt} dealt ${me} damage to ${qr}`),tt("/videos/fleet-ambush.mp4"),Kt(()=>E.current.payRent())},1200)):(v.current(Ma.current),Ma.current=x.current(()=>{E.current.payRent()},1400))})(),()=>{v.current(Ma.current),v.current(jr.current)}}else if(T.action==="void-drain")ye(!0),v.current(es.current),es.current=x.current(()=>E.current.payTax(),qxe);else if(T.action==="draw-card"){const me=(te=w.board[T.tileId])==null?void 0:te.type;G({deck:me==="asteroid"?"asteroid":"nebula",text:T.cardText??"",amount:T.amount??0,autoDismissMs:3e3})}return()=>{v.current(es.current),v.current(Ma.current)}}},[w.currentTurn.phase,T,it]);const[ua,Ni]=l.useState(w),eo=l.useRef(P),[ju,Mi]=l.useState(void 0),[Li,Iu]=l.useState(1),[Ss,Nu]=l.useState(!1),[Fb,Mu]=l.useState(!1),[Ub,qb]=l.useState(0),ko=l.useRef(!1),Di=l.useRef(!1),Vb=l.useCallback(()=>{ko.current=!0,Di.current=!0,Nu(!1)},[]);l.useEffect(()=>(window.__intro=()=>{console.log("[ZENTARA] Replaying fleet intro"),ko.current=!1,Di.current=!0,Mu(!1),qb(te=>te+1),Nu(!0)},()=>{delete window.__intro}),[]),l.useEffect(()=>{if(D){if(F){Ss&&Nu(!1);return}m||ko.current||Di.current||Ss||Nu(!0)}},[D,F,m,Ss]),l.useEffect(()=>{if(!Ss){Mu(!1);return}Di.current=!0,Mu(!1);const te=x.current(()=>Mu(!0),700);return()=>v.current(te)},[Ss]),l.useEffect(()=>{if(Ss||!m&&!Di.current)return;ko.current||(ko.current=!0,ue(0),Mi(2));const te=x.current(()=>Mi(void 0),3500);return()=>v.current(te)},[Ss,m]);const{reveal:Zo}=Ti(),[Lu,Du]=l.useState(0),[So,Oi]=l.useState("idle"),jp=l.useRef(P),ic=l.useRef(setTimeout(()=>{})),Y=l.useCallback(()=>{Oi("charging"),Sf({volume:.12})},[]),ge=l.useCallback(te=>{Du(te),te===0&&Oi(me=>me==="charging"?"idle":me)},[]),Ne=l.useCallback(()=>{Du(0),Oi("launch"),E.current.roll()},[]),He=l.useRef(null),ze=l.useRef(!1);if(P!==eo.current){eo.current=P,ze.current=!0,He.current=w,Bt(!1),er(!1),It(!0),v.current(Pe.current);const te=ua.players[ua.currentPlayerIndex],me=te?ua.board[te.tileIndex]:void 0;$e((te==null?void 0:te.tileIndex)??null);const We=te?w.players.find(pt=>pt.id===te.id):w.players[w.currentPlayerIndex];Yt((We==null?void 0:We.tileIndex)??null),Ot.current=(te==null?void 0:te.inJail)===!0||(me==null?void 0:me.type)==="jail",Ot.current?hr("idle"):hr("liftoff")}l.useEffect(()=>{if(P!==eo.current){eo.current=P,Bt(!1),er(!1),It(!0);const te=ua.players[ua.currentPlayerIndex];te&&(ue(te.tileIndex),$e(te.tileIndex)),He.current=w}else He.current?He.current=w:Ni(w)},[w,P]),l.useEffect(()=>{if(Zo&&He.current){const te=He.current,me=x.current(()=>{He.current=null,ze.current=!1,Ni(te)},1e3);return()=>v.current(me)}},[Zo]),l.useEffect(()=>{P!==jp.current&&(jp.current=P,v.current(ic.current),Du(0),Oi("launch"))},[P]);const st=w.players[w.currentPlayerIndex],lt=(st==null?void 0:st.id)===t,Nt=kt!=null&&(T==null?void 0:T.action)==="buy-prompt"&&T.tileId===kt;l.useEffect(()=>{kt!=null&&((T==null?void 0:T.action)!=="buy-prompt"||T.tileId!==kt)&&Ee(null)},[T,kt]);const Ft=w.players.find(te=>te.id===t),Vn=l.useMemo(()=>Ft?w.properties.filter(te=>te.ownerId===t&&!te.dormant&&te.upgradeLevel<Ud(t,te.tileId,w.board,w.properties)).length:0,[w.properties,w.board,Ft,t]),On=l.useMemo(()=>Ft?w.properties.filter(te=>{var me;return te.ownerId===t&&!te.dormant&&te.upgradeLevel<Ud(t,te.tileId,w.board,w.properties)&&(((me=w.board[te.tileId])==null?void 0:me.upgradeCost)??1/0)<=Ft.credits}).length:0,[w.properties,w.board,Ft,t]),En=l.useMemo(()=>{var nn,as;if(!lt||!Ft||Ft.depleted||(nn=w.gameRules)!=null&&nn.disableSpyStrike||T||w.currentTurn.phase==="in-debt"||(Ft.heroLockoutTurnsRemaining??0)>0)return null;const te=w.board[Ft.tileIndex];if(!te||te.type!=="planet"||!te.group)return null;const me=te.group,We=w.spies;if(We!=null&&We[me])return null;const pt=w.siegeCooldowns,gt=(pt==null?void 0:pt[me])??0;if(w.roundNumber<gt)return null;const xt=w.board.filter(va=>va.group===me).map(va=>va.id);if(xt.length===0)return null;let Wt=0;const qr=[];for(const va of xt){const Us=w.properties.find(Ps=>Ps.tileId===va);if(!(Us!=null&&Us.ownerId))return null;Us.ownerId===t?Wt+=1:qr.push(va)}if(Wt===0){const va=(as=w.properties.find(Ps=>Ps.tileId===xt[0]))==null?void 0:as.ownerId;return!va||va===t||!xt.every(Ps=>w.properties.some(Co=>Co.tileId===Ps&&Co.ownerId===va))||Ft.credits<Zc?null:{group:me,cost:Zc}}return qr.length===0||Ft.credits<Kc?null:{group:me,cost:Kc}},[_,lt,Ft,t,T,w]),zn=(En==null?void 0:En.group)??null,ns=(En==null?void 0:En.cost)??Zc,ba=l.useCallback(te=>{!Ft||(En==null?void 0:En.group)!==te||K({factionName:Yr(Ft.piece),factionColor:q_(Ft.pieceColor,"#9d4edd"),group:te,groupColor:ka[te]??"#9d4edd",cost:En.cost})},[Ft,En]),Pn=l.useMemo(()=>w.players.filter(te=>!te.depleted&&(_?te.isBot||te.id.startsWith("zentara_bot_"):te.id!==t)).map(te=>te.id),[w.players,_,t]),pn=l.useMemo(()=>w.winnerId?w.players.find(te=>te.id===w.winnerId)??null:null,[w.players,w.winnerId]),ea=l.useMemo(()=>{if(!pn)return null;let te=0;for(const pt of w.properties.filter(gt=>gt.ownerId===pn.id)){const gt=w.board[pt.tileId];te+=(gt==null?void 0:gt.cost)??0,pt.upgradeLevel>0&&(gt!=null&&gt.upgradeCost)&&(te+=pt.upgradeLevel*gt.upgradeCost)}const me=pn.weaponLevel*an.weaponUpgradeCost,We=pn.armorLevel*an.armorUpgradeCost;return{credits:pn.credits,propertyValue:te,weaponValue:me,armorValue:We,total:Math.max(0,pn.credits+te+me+We)}},[pn,w.properties,w.board]);Wme({isMyTurn:lt,phase:w.currentTurn.phase,pendingEffect:T,pendingTrade:R,inJail:(st==null?void 0:st.inJail)??!1,credits:(st==null?void 0:st.credits)??0,botPlayerIds:Pn,currentPlayerId:(st==null?void 0:st.id)??"",properties:w.properties,board:w.board,actions:k,gameFinished:w.finished,players:w.players,spies:w.spies,siegeCooldowns:w.siegeCooldowns,roundNumber:w.roundNumber,autoplay:m});const Ha=l.useCallback(te=>{const me=w.board[te]??null;Fe(me)},[w.board]),Fn=Zo&&!ze.current,Or=Fn?w:ua,Fr=Or.players[Or.currentPlayerIndex],fn=Ae??Or.board[(Fr==null?void 0:Fr.tileIndex)??0]??null,tn=fn?Or.properties.find(te=>te.tileId===fn.id)??null:null,to=tn?Or.players.find(te=>te.id===tn.ownerId)??null:null,pl=to?Yr(to.piece):null,Es=to?q_(to.pieceColor,"#fff"):null,Wm=l.useCallback(()=>{if(!T||bt)return;Pt(!0),Ee(T.tileId),Re.current&&v.current(Re.current),Re.current=x.current(()=>{Pt(!1),Re.current=void 0},5e3),nr.current=(nr.current+1)%bc.length;const te=bc[nr.current],me=w.players[w.currentPlayerIndex],We=w.board[T.tileId],pt=(We==null?void 0:We.name)??`Tile ${T.tileId}`,gt=We!=null&&We.group?ka[We.group]:void 0;Qt(me?a.jsxs(a.Fragment,{children:[a.jsx("span",{style:gt?{color:gt}:void 0,children:pt})," captured by ",Yr(me.piece)]}):null),tt(te),Kt(()=>E.current.buyProperty(T.tileId)),NS()},[T,w.players,w.currentPlayerIndex,bt,Kt]);l.useEffect(()=>{(w.currentTurn.phase!=="action"||(T==null?void 0:T.action)!=="buy-prompt")&&(Pt(!1),Re.current&&(v.current(Re.current),Re.current=void 0))},[w.currentTurn.phase,T]);const I1=l.useCallback(()=>{bt||((T==null?void 0:T.action)==="buy-prompt"&&Ee(T.tileId),E.current.skipBuy())},[bt,T]),[da,lc]=l.useState(void 0),Ip=l.useRef(P);l.useEffect(()=>{P!==Ip.current&&(Ip.current=P,lc(void 0))},[P]),l.useEffect(()=>{const te=w.currentTurn.diceValues;te&&lc([te[0],te[1],0])},[w.currentTurn.diceValues]);const Eo=da;l.useEffect(()=>{!Zo||!da||So!=="launch"||(Oi("impact"),gi({volume:.05,rate:.85}),v.current(ic.current),ic.current=x.current(()=>{Oi("idle"),ic.current=setTimeout(()=>{})},1400))},[Zo,da,So]);const Ou=Mt==="attack"||Mt==="defense",N1=Ou?fr:P,n3=Ou?zt:Eo,Hb=mr!=="idle"&&jt!=null?jt:Fr==null?void 0:Fr.tileIndex,M1=Hb!=null?Or.board[Hb]??w.board[Hb]??null:null,Gm=mr==="liftoff"&&J!=null?Or.board[J]??M1:M1,a3=(Gm==null?void 0:Gm.type)??"start",Xm=Gm,L1=(Xm==null?void 0:Xm.type)==="planet"?M[ef(Xm.name)]??null:null,D1=(fn==null?void 0:fn.type)==="planet"?M[ef(fn.name)]??null:null,Po=Ae?w.properties.find(te=>te.tileId===Ae.id)??null:null,s3=Po?(()=>{const te=w.players.find(me=>me.id===Po.ownerId);return te?Yr(te.piece):null})():null,o3=!m&&!F&&!ko.current&&!Di.current;if(D&&Ss&&!F||!D&&o3){const te=D&&Ss;return a.jsx("div",{className:"zentara-screen","data-intro-active":"true",children:te&&a.jsx(lbe,{players:w.players,skipEnabled:Fb,onComplete:Vb},Ub)})}return a.jsxs("div",{className:"zentara-screen","data-tile-type":a3,"data-pieces-moving":ht&&!it||void 0,"data-ship-bg-phase":mr,"data-cutscene-active":Ve||or?"true":void 0,"data-raid-active":Gn?"true":void 0,"data-raid-mini":yr?"true":void 0,style:L1?{"--zentara-tile-bg":`url("${L1.imageUrl}")`}:void 0,children:[a.jsx("div",{className:"zentara-warp-background zentara-warp-background--forward","aria-hidden":"true"}),a.jsx("div",{className:"zentara-warp-background zentara-warp-background--reverse","aria-hidden":"true"}),a.jsxs("div",{className:"zentara-ambient-scene","aria-hidden":"true",children:[a.jsx("div",{className:"zentara-space-dust"}),a.jsx("div",{className:"zentara-ambient-light"}),a.jsxs("div",{className:"zentara-fleet-traffic",children:[a.jsx("i",{}),a.jsx("i",{}),a.jsx("i",{})]})]}),Gn&&!yr&&!Ve&&!or&&a.jsx("video",{className:"zentara-raid-bg-video",src:"/videos/empire-strike.mp4",autoPlay:!0,muted:!0,playsInline:!0,loop:!0,preload:"auto"}),p&&!yr&&a.jsxs("div",{className:"zentara-raid-live",role:"status","aria-live":"polite",children:[a.jsx("div",{className:"zentara-raid-live__label",children:p.status==="complete"?"RAID COMPLETE":"LIVE RAID"}),a.jsxs("strong",{children:[((B1=w.players.find(te=>te.id===p.attackerId))==null?void 0:B1.displayName)??"Attacker"," vs ",((F1=w.players.find(te=>te.id===p.defenderId))==null?void 0:F1.displayName)??"Defender"]}),a.jsxs("span",{children:[p.hits," hits · ",p.totalSpawned>0?Math.round(p.hits/p.totalSpawned*100):0,"% accuracy"]}),a.jsx("div",{className:"zentara-raid-live__track",children:a.jsx("i",{style:{width:`${Math.min(100,p.elapsedMs/p.durationMs*100)}%`}})})]}),Ve&&a.jsx(zye,{src:Ve,onEnd:()=>{const te=Lt.current.shift();if(te){tt(te);return}tt(null),Qt(null)}}),Ve&&Et&&a.jsx("div",{className:"zentara-cutscene-caption zentara-cutscene-caption--top",children:Et}),or&&ws.createPortal(a.jsx(Jye,{...or,onEnd:()=>Ht(null)}),document.body),a.jsx("img",{src:Nxe,alt:"Zentara",className:"zentara-game-logo"}),a.jsxs("div",{className:"zentara-main-row",children:[a.jsx("div",{className:"zentara-player-col",children:a.jsx(Wge,{players:w.players,properties:w.properties,tiles:w.board,currentPlayerId:(st==null?void 0:st.id)??"",localPlayerId:t,onSaveAndExit:n?nt:void 0,roomId:d,onAvatarClick:te=>{rt(te);const me=w.players.find(We=>We.id===te);me&&ue(me.tileIndex)},onUpgradeProperty:B,upgradeableCount:On})}),a.jsx("div",{className:"zentara-board-col",children:a.jsxs("div",{className:"zentara-board-area",children:[a.jsx(ige,{gameState:ua,onTileClick:Ha,zoomOverride:ju,onPieceArrival:()=>{if(Ct.current=!0,Bt(!0),er(!1),$e(null),v.current(Pe.current),Ot.current?hr("idle"):(hr("landing"),Pe.current=x.current(()=>{hr("idle"),Yt(null)},Wxe)),typeof window<"u"&&new URLSearchParams(window.location.search).get("debugTurrets")==="1"){const te=["crimson-dominion","silver-pact","azure-sovereignty","golden-imperium","emerald-collective","void-enclave"],me=he.current.players[he.current.currentPlayerIndex];if(me){const We=me.tileIndex;te[We%te.length]!==me.piece&&(Rt(80),Lo(),x.current(()=>Xa(),200),Qe(We,1400))}}},onPieceMoveStart:()=>{er(!0),v.current(Pe.current);const te=ua.players[ua.currentPlayerIndex];te&&Yt(te.tileIndex),Ot.current?hr("idle"):(hr("liftoff"),Pe.current=x.current(()=>{hr("warp"),Pe.current=x.current(()=>{hr("warp-exit"),Pe.current=x.current(()=>{$e(null),hr("landing")},V_)},V_)},V_))},onZoomChange:Iu,focusTileIndex:ne,toggleZoomRef:de,laserBeamTile:ve,laserBeamSeq:Ue,blastDamage:dt,suppressDarkOverlay:!!Ve||!!or||Gn}),a.jsx("div",{className:"zentara-top-hud",children:a.jsxs("div",{className:"zentara-dice-miniboard","aria-label":"Dice and board overview",children:[a.jsx("div",{className:"zentara-minimap-wrapper zentara-minimap-wrapper--around-dice",children:a.jsx(Jge,{players:ua.players,currentPlayerId:((U1=ua.players[ua.currentPlayerIndex])==null?void 0:U1.id)??"",properties:ua.properties,tiles:ua.board,onTileClick:ue})}),a.jsxs("div",{className:`zentara-dice-center zentara-dice-center--${So}`,"data-roll-phase":So,style:{"--player-color":q_(st==null?void 0:st.pieceColor,"#fff"),"--roll-charge":Lu},children:[a.jsxs("div",{className:"zentara-roll-console","aria-hidden":"true",children:[a.jsx("span",{className:"zentara-roll-console__ring zentara-roll-console__ring--outer"}),a.jsx("span",{className:"zentara-roll-console__ring zentara-roll-console__ring--inner"}),a.jsx("span",{className:"zentara-roll-console__scan"}),a.jsx("span",{className:"zentara-roll-console__impact"})]}),(()=>{const te=Mt==="attack"&&St?St.atk:Mt==="defense"&&St?St.def:st,me=zxe(te);return a.jsx(WO,{isWaiting:!1,rollTrigger:N1,results:n3,chargeLevel:Ou?0:Lu,gameMode:"craps",feltColor:"transparent",shimmerColor:"#7ec8f0",diceModels:[me,me]})})(),!Ou&&lt&&(So==="charging"||So==="launch")&&a.jsxs("div",{className:"zentara-roll-status","aria-live":"polite",children:[a.jsx("span",{className:"zentara-roll-status__eyebrow",children:So==="charging"?"COMMAND LINK":"VECTOR CAST"}),a.jsx("strong",{children:So==="charging"?`${Math.max(1,Math.round(Lu*100))}%`:"ROLLING"})]}),(Mt==="attack"||Mt==="defense")&&Ie&&a.jsx("div",{className:"zentara-clash-roll-label",children:Ie})]})]})}),Mt==="intro"&&St&&ws.createPortal(a.jsxs("div",{className:`zentara-clash-intro-overlay${wt?" zentara-clash-intro-overlay--manual-roll":""}${Dt?" zentara-clash-intro-overlay--closing":""}`,children:[a.jsxs("div",{className:"zentara-clash-intro-side zentara-clash-intro-side--left",style:{"--clash-faction-color":Ol[St.atk.piece]},children:[St.atk.heroId&&Xi[St.atk.heroId]?a.jsx("img",{className:"zentara-clash-intro-portrait",src:Xi[St.atk.heroId],alt:""}):a.jsx("div",{className:"zentara-clash-intro-portrait zentara-clash-intro-portrait--fallback"}),a.jsx("div",{className:"zentara-clash-intro-label",children:Yr(St.atk.piece)})]}),a.jsxs("div",{className:"zentara-clash-intro-vs",children:["⚔️",a.jsx("br",{}),"HERO",a.jsx("br",{}),"CLASH"]}),a.jsxs("div",{className:"zentara-clash-intro-side zentara-clash-intro-side--right",style:{"--clash-faction-color":Ol[St.def.piece]},children:[St.def.heroId&&Xi[St.def.heroId]?a.jsx("img",{className:"zentara-clash-intro-portrait zentara-clash-intro-portrait--flip",src:Xi[St.def.heroId],alt:""}):a.jsx("div",{className:"zentara-clash-intro-portrait zentara-clash-intro-portrait--fallback zentara-clash-intro-portrait--flip"}),a.jsx("div",{className:"zentara-clash-intro-label",children:Yr(St.def.piece)})]}),wt&&a.jsx("button",{className:"zentara-btn zentara-btn--primary zentara-clash-intro-roll-btn",onClick:Er,disabled:!Ke,children:Ke?"⚔️ Hero Roll Dice":"⚔️ Preparing Clash..."})]}),document.body),Mt==="result"&&Vt&&(()=>{const te=Vt.attackDice[0]+Vt.attackDice[1],me=Vt.defenseDice[0]+Vt.defenseDice[1],We=te>me,pt=We?Vt.attackHeroId:Vt.defendHeroId,gt=We?Vt.attackBoostPct:Vt.defenseReducePct,xt=We?"Attack Boost":"Defense Reduction";return a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"zentara-clash-result-backdrop"}),a.jsx("div",{className:"zentara-clash-result-overlay",onClick:Tn,children:a.jsxs("div",{className:"zentara-clash-result-panel",onClick:Wt=>Wt.stopPropagation(),children:[a.jsx("div",{className:"zentara-clash-result-title",children:"⚔️ Hero Clash Result"}),pt&&Xi[pt]&&a.jsxs("div",{className:"zentara-clash-result-hero-display",children:[a.jsx("img",{className:"zentara-clash-result-hero-image",src:Xi[pt],alt:"Winner Hero"}),a.jsxs("div",{className:"zentara-clash-result-hero-impact",children:[a.jsx("div",{className:"zentara-clash-result-hero-impact-label",children:xt}),a.jsxs("div",{className:"zentara-clash-result-hero-impact-value",children:["+",gt,"%"]})]})]}),a.jsxs("div",{className:`zentara-clash-result-row zentara-clash-result-row--attack ${We?"active":"inactive"}`,children:[a.jsx("span",{className:"zentara-clash-result-icon",children:"⚔️"}),a.jsxs("span",{className:"zentara-clash-result-name",children:[Vt.attackerName,We?" 🏆":""]}),a.jsxs("span",{className:"zentara-clash-result-dice",children:["🎲 ",Vt.attackDice[0]," + ",Vt.attackDice[1]," = ",te]}),a.jsxs("span",{className:"zentara-clash-result-pct",children:["+",Vt.attackBoostPct,"% boost"]})]}),a.jsxs("div",{className:`zentara-clash-result-row zentara-clash-result-row--defense ${We?"inactive":"active"}`,children:[a.jsx("span",{className:"zentara-clash-result-icon",children:"🛡"}),a.jsxs("span",{className:"zentara-clash-result-name",children:[Vt.defenderName,We?"":" 🏆"]}),a.jsxs("span",{className:"zentara-clash-result-dice",children:["🎲 ",Vt.defenseDice[0]," + ",Vt.defenseDice[1]," = ",me]}),a.jsxs("span",{className:"zentara-clash-result-pct",children:["−",Vt.defenseReducePct,"% block"]})]}),a.jsxs("div",{className:"zentara-clash-result-damage",children:[a.jsx("span",{className:"zentara-clash-result-damage-label",children:"Damage"}),a.jsxs("span",{className:"zentara-clash-result-damage-value",children:["✦",Vt.finalDamage]}),a.jsx("button",{className:"zentara-clash-calc-toggle",onClick:Wt=>{Wt.stopPropagation(),wr(!ft)},children:"i"}),ft&&a.jsx("div",{className:"zentara-clash-calculation-floating",children:a.jsxs("div",{className:"zentara-clash-calculation-card zentara-clash-calculation-tooltip",children:[a.jsx("div",{className:"zentara-clash-calculation-header",children:"Calculation"}),a.jsxs("div",{className:"zentara-clash-calculation-rows",children:[a.jsxs("div",{className:"zentara-clash-calculation-row",children:[a.jsx("span",{children:"Base Damage"}),a.jsxs("span",{style:{color:"#fff"},children:["✦",Vt.baseDamage]})]}),a.jsxs("div",{className:"zentara-clash-calculation-row zentara-clash-calculation-row--boost",children:[a.jsxs("span",{children:["+ Attack Boost (",Vt.attackBoostPct,"%)"]}),a.jsxs("span",{children:["+✦",Math.round(Vt.baseDamage*Vt.attackBoostPct/100)]})]}),a.jsxs("div",{className:"zentara-clash-calculation-row zentara-clash-calculation-row--block",children:[a.jsxs("span",{children:["- Defense Block (",Vt.defenseReducePct,"%)"]}),a.jsxs("span",{children:["−✦",Math.round(Vt.baseDamage*Vt.defenseReducePct/100)]})]}),a.jsxs("div",{className:"zentara-clash-calculation-row zentara-clash-calculation-row--final",children:[a.jsx("span",{children:"= Final Damage"}),a.jsxs("span",{children:["✦",Vt.finalDamage]})]})]})]})})]}),a.jsx("div",{className:"zentara-clash-result-continue",onClick:Tn,children:"Click to continue…"})]})})]})})(),$n&&a.jsxs("div",{style:{position:"absolute",top:8,left:8,zIndex:999,background:"rgba(0,0,0,0.85)",color:"#fff",padding:"10px 14px",borderRadius:8,fontSize:12,fontFamily:"monospace",display:"flex",flexDirection:"column",gap:6,minWidth:200},children:[a.jsx("div",{style:{fontWeight:700,fontSize:13,marginBottom:2},children:"Blast Debug"}),a.jsxs("label",{children:["Damage: ",dt," ",a.jsxs("span",{style:{opacity:.5},children:["(scale ",Math.min(3,Math.max(.35,dt/100)).toFixed(2),"×)"]}),a.jsx("input",{type:"range",min:2,max:1500,step:1,value:dt,onChange:te=>Rt(Number(te.target.value)),style:{width:"100%"}})]}),a.jsxs("label",{children:["Tile:",a.jsx("input",{type:"number",min:0,max:39,defaultValue:0,id:"__blast-tile",style:{width:50,marginLeft:6,background:"#222",color:"#fff",border:"1px solid #555",borderRadius:4,padding:"2px 4px"}})]}),a.jsx("div",{style:{display:"flex",gap:4,flexWrap:"wrap"},children:[2,10,50,100,300,800,1500].map(te=>a.jsx("button",{onClick:()=>{var We;Rt(te);const me=Number(((We=document.getElementById("__blast-tile"))==null?void 0:We.value)??0);Qe(me,1200)},style:{padding:"3px 8px",fontSize:11,background:"#333",color:"#fff",border:"1px solid #666",borderRadius:4,cursor:"pointer"},children:te},te))}),a.jsx("button",{onClick:()=>{var me;const te=Number(((me=document.getElementById("__blast-tile"))==null?void 0:me.value)??0);Qe(te,1200)},style:{padding:"4px 10px",fontSize:12,background:"#2563eb",color:"#fff",border:"none",borderRadius:4,cursor:"pointer"},children:"Fire 💥"}),a.jsx("button",{onClick:()=>Be(!1),style:{padding:"2px 8px",fontSize:11,background:"transparent",color:"#888",border:"1px solid #444",borderRadius:4,cursor:"pointer",alignSelf:"flex-end"},children:"Close"})]})]})}),a.jsx("div",{className:"zentara-floating-controls",children:a.jsx(oO,{roomId:d,singlePlayer:!d})}),a.jsxs("div",{className:`zentara-sidebar ${le?"zentara-sidebar--folded":""}`,"data-moving":!it||void 0,children:[a.jsxs("div",{className:"zentara-command-strip","aria-label":"Game commands",children:[a.jsx("button",{onClick:()=>{ie(),O(!0)},children:"Players"}),a.jsx("button",{disabled:!Ft||Ft.depleted,onClick:()=>{ie(),V(!0)},children:"Trade"}),a.jsxs("button",{onClick:()=>{Se()||(ie(),X(!0))},children:["Chat",_e>0&&a.jsx("span",{children:_e>9?"9+":_e})]}),!_&&a.jsx("button",{onClick:te=>{te.preventDefault(),te.stopPropagation(),!Se()&&(ie(),k.saveGame(),nt())},children:"Save & Exit"})]}),a.jsx("button",{type:"button",className:"zentara-sidebar__toggle",onClick:()=>{ie(),De(!le)},title:le?"Expand":"Fold","aria-label":le?"Expand sidebar":"Fold sidebar",children:le?"◀":"▶"}),lt&&a.jsx("div",{className:"zentara-your-turn",children:"Your Turn"}),it&&a.jsx(Oge,{tile:fn,property:tn,ownerName:pl,ownerColor:Es,planetContent:D1,onClick:()=>{ie(),fn&&Fe(fn)}}),lt&&w.currentTurn.phase==="pre-roll"&&Ft&&a.jsxs("div",{className:"zentara-ship-upgrade-row",children:[a.jsxs("button",{className:"zentara-menu-btn zentara-menu-btn--ship",disabled:Ft.armorLevel>=an.maxArmorLevel||Ft.credits<an.armorUpgradeCost,onClick:()=>{ie(),be("armor")},children:[a.jsx("span",{className:"ship-btn__icon",children:"🛡"}),a.jsxs("span",{className:"ship-btn__label",children:["Armor ",Ft.armorLevel,"/",an.maxArmorLevel]}),a.jsxs("span",{className:"ship-btn__cost",children:[an.armorUpgradeCost,"c"]})]}),a.jsxs("button",{className:"zentara-menu-btn zentara-menu-btn--ship",disabled:Ft.weaponLevel>=an.maxWeaponLevel||Ft.credits<an.weaponUpgradeCost,onClick:()=>{ie(),be("weapon")},children:[a.jsx("span",{className:"ship-btn__icon",children:"🚀"}),a.jsxs("span",{className:"ship-btn__label",children:["Weapons ",Ft.weaponLevel,"/",an.maxWeaponLevel]}),a.jsxs("span",{className:"ship-btn__cost",children:[an.weaponUpgradeCost,"c"]})]}),Ft.armorLevel>0&&a.jsxs("button",{className:"zentara-menu-btn zentara-menu-btn--ship zentara-menu-btn--liquidate",onClick:()=>{ie(),be("liquidate-armor")},children:[a.jsx("span",{className:"ship-btn__icon",children:"🛡"}),a.jsx("span",{className:"ship-btn__label",children:"Sell Armor"}),a.jsxs("span",{className:"ship-btn__cost",children:["+",Math.floor(an.armorUpgradeCost/2),"c"]})]}),Ft.weaponLevel>0&&a.jsxs("button",{className:"zentara-menu-btn zentara-menu-btn--ship zentara-menu-btn--liquidate",onClick:()=>{ie(),be("liquidate-weapon")},children:[a.jsx("span",{className:"ship-btn__icon",children:"🚀"}),a.jsx("span",{className:"ship-btn__label",children:"Sell Weapons"}),a.jsxs("span",{className:"ship-btn__cost",children:["+",Math.floor(an.weaponUpgradeCost/2),"c"]})]})]}),ut&&Ft&&a.jsx("div",{className:"zentara-ship-confirm-overlay",onClick:()=>be(null),children:a.jsxs("div",{className:"zentara-ship-confirm-card",onClick:te=>te.stopPropagation(),children:[ut==="armor"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"zentara-ship-confirm__icon",children:"🛡"}),a.jsx("h4",{className:"zentara-ship-confirm__title",children:"Upgrade Ship Armor"}),a.jsxs("p",{className:"zentara-ship-confirm__level",children:["Level ",Ft.armorLevel," → ",Ft.armorLevel+1]}),a.jsxs("p",{className:"zentara-ship-confirm__desc",children:["Each armor level reduces incoming hull damage by 15%. At level ",Ft.armorLevel+1,", you'll absorb ",a.jsxs("strong",{children:[(Ft.armorLevel+1)*15,"%"]})," of all damage when landing on enemy planets."]}),a.jsxs("p",{className:"zentara-ship-confirm__cost",children:["Cost: ",a.jsxs("strong",{children:[an.armorUpgradeCost," energy"]})]}),a.jsxs("p",{className:"zentara-ship-confirm__balance",children:["Balance after: ",Ft.credits-an.armorUpgradeCost," energy"]})]}):ut==="weapon"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"zentara-ship-confirm__icon",children:"🚀"}),a.jsx("h4",{className:"zentara-ship-confirm__title",children:"Upgrade Ship Weapons"}),a.jsxs("p",{className:"zentara-ship-confirm__level",children:["Level ",Ft.weaponLevel," → ",Ft.weaponLevel+1]}),a.jsx("p",{className:"zentara-ship-confirm__desc",children:Ft.weaponLevel===0?"Unlocks Strike — when you roll doubles and land on an enemy planet, automatically destroy one arms level on that property.":"Increases your strike power for Resource Raids. Higher weapon levels give you a dice bonus during raid roll-offs."}),a.jsxs("p",{className:"zentara-ship-confirm__cost",children:["Cost: ",a.jsxs("strong",{children:[an.weaponUpgradeCost," energy"]})]}),a.jsxs("p",{className:"zentara-ship-confirm__balance",children:["Balance after: ",Ft.credits-an.weaponUpgradeCost," energy"]})]}):ut==="liquidate-armor"?a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"zentara-ship-confirm__icon",children:"🛡"}),a.jsx("h4",{className:"zentara-ship-confirm__title",children:"Sell Ship Armor"}),a.jsxs("p",{className:"zentara-ship-confirm__level",children:["Level ",Ft.armorLevel," → ",Ft.armorLevel-1]}),a.jsxs("p",{className:"zentara-ship-confirm__desc",children:["Downgrade armor by one level. You'll lose 15% damage reduction (",Ft.armorLevel*15,"% → ",(Ft.armorLevel-1)*15,"%)."]}),a.jsxs("p",{className:"zentara-ship-confirm__cost",children:["Refund: ",a.jsxs("strong",{children:[Math.floor(an.armorUpgradeCost/2)," energy"]})]}),a.jsxs("p",{className:"zentara-ship-confirm__balance",children:["Balance after: ",Ft.credits+Math.floor(an.armorUpgradeCost/2)," energy"]})]}):a.jsxs(a.Fragment,{children:[a.jsx("div",{className:"zentara-ship-confirm__icon",children:"🚀"}),a.jsx("h4",{className:"zentara-ship-confirm__title",children:"Sell Ship Weapons"}),a.jsxs("p",{className:"zentara-ship-confirm__level",children:["Level ",Ft.weaponLevel," → ",Ft.weaponLevel-1]}),a.jsx("p",{className:"zentara-ship-confirm__desc",children:Ft.weaponLevel===1?"You will lose Strike ability entirely — no more automatic hits on enemy planets when rolling doubles.":"Downgrade weapons by one level. Your strike power for Resource Raids will decrease."}),a.jsxs("p",{className:"zentara-ship-confirm__cost",children:["Refund: ",a.jsxs("strong",{children:[Math.floor(an.weaponUpgradeCost/2)," energy"]})]}),a.jsxs("p",{className:"zentara-ship-confirm__balance",children:["Balance after: ",Ft.credits+Math.floor(an.weaponUpgradeCost/2)," energy"]})]}),a.jsxs("div",{className:"zentara-ship-confirm__buttons",children:[a.jsx("button",{className:"zentara-ship-confirm__btn zentara-ship-confirm__btn--cancel",onClick:()=>{ie(),be(null)},children:"Cancel"}),a.jsx("button",{className:`zentara-ship-confirm__btn ${ut.startsWith("liquidate")?"zentara-ship-confirm__btn--sell":"zentara-ship-confirm__btn--confirm"}`,onClick:()=>{ie(),ut==="armor"?k.upgradeArmor():ut==="weapon"?k.upgradeWeapon():ut==="liquidate-armor"?(k.liquidateArmor(),S.info(`${Sr(t)} sold armor`,`Shield Level ${Ft.armorLevel-1} (+${Math.floor(an.armorUpgradeCost/2)} energy)`)):(k.liquidateWeapon(),S.info(`${Sr(t)} sold weapons`,`Weapon Level ${Ft.weaponLevel-1} (+${Math.floor(an.weaponUpgradeCost/2)} energy)`)),be(null)},children:ut.startsWith("liquidate")?"Confirm Sale":"Confirm Upgrade"})]})]})}),a.jsx("div",{className:"zentara-sidebar-spacer"}),a.jsx(jge,{phase:Fn&&it?w.currentTurn.phase:Fn?"landed":"rolling",pendingEffect:Fn&&it?T:null,suppressBuyPrompt:Nt,buyInProgress:bt,tileOwnedByMe:!!((T==null?void 0:T.tileId)!=null&&w.properties.some(te=>te.tileId===T.tileId&&te.ownerId===t)),isMyTurn:lt,inJail:(st==null?void 0:st.inJail)??!1,onRoll:Ne,onRollPressStart:Y,onRollChargeChange:ge,onBuy:Wm,onSkipBuy:I1,onPayRent:k.payRent,onHeroClashRoll:k.heroClashRoll,onPayTax:k.payTax,onResolveCard:k.resolveCard,onPayBail:k.payBailAction,onPlantSpy:ba,plantSpyEligibleGroup:zn,plantSpyCost:ns,onArmPlanets:()=>Q(!0),credits:((q1=w.players.find(te=>te.id===t))==null?void 0:q1.credits)??0,upgradeableCount:On,armableCount:Vn})]})]}),a.jsx(Fge,{tile:Ae,property:Po,ownerName:s3,isOwnedByMe:(Po==null?void 0:Po.ownerId)===t,canAffordUpgrade:!!((Ae==null?void 0:Ae.upgradeCost)!=null&&Po&&(((V1=w.players.find(te=>te.id===t))==null?void 0:V1.credits)??0)>=Ae.upgradeCost&&Po.upgradeLevel<Ud(t,Ae.id,w.board,w.properties)),onClose:()=>Fe(null),onUpgrade:B,onMortgage:te=>k.mortgageProperty(te),onSell:te=>k.sellProperty(te),onSabotage:te=>k.sabotageProperty(te),sabotageCost:(()=>{if(!(Ae!=null&&Ae.group)||!Ae.upgradeCost||!Po||Po.ownerId===t||Po.upgradeLevel<=0)return null;const te=w.board.filter(We=>We.group===Ae.group).map(We=>We.id),me=w.properties.filter(We=>te.includes(We.tileId)&&We.ownerId===t&&!We.dormant).length;return me<=0?null:Ae.upgradeCost*(te.length-me+1)})(),credits:((H1=w.players.find(te=>te.id===t))==null?void 0:H1.credits)??0,groupOwned:(()=>{if(!(Ae!=null&&Ae.group))return;const te=w.board.filter(me=>me.group===Ae.group).map(me=>me.id);return w.properties.filter(me=>te.includes(me.tileId)&&me.ownerId===t).length})(),groupTotal:(()=>{if(Ae!=null&&Ae.group)return w.board.filter(te=>te.group===Ae.group).length})(),planetContent:D1}),a.jsx(Cye,{player:et?w.players.find(te=>te.id===et)??null:null,properties:w.properties,tiles:w.board,isCurrentPlayer:et===(st==null?void 0:st.id),onClose:()=>rt(null),onTileClick:te=>{Fe(w.board[te]??null),rt(null)}}),Z&&a.jsx(XO,{playerId:t,credits:((W1=w.players.find(te=>te.id===t))==null?void 0:W1.credits)??0,properties:w.properties,board:w.board,onUpgrade:B,onClose:()=>Q(!1)}),a.jsx(rye,{open:U&&!!Ft||!!R&&R.recipient.playerId===t,mode:R&&R.recipient.playerId===t?"review":"propose",localPlayer:Ft??st,players:w.players,properties:w.properties,tiles:w.board,pendingTrade:R,onPropose:(te,me,We,pt,gt)=>{var Wt;const xt=((Wt=Ft??st)==null?void 0:Wt.id)??t;k.proposeTrade(xt,te,me,We,pt,gt),V(!1)},onAccept:()=>{k.acceptTrade(),V(!1)},onDecline:()=>{k.declineTrade(),V(!1)},onClose:()=>V(!1)}),w.currentTurn.phase==="in-debt"&&lt&&a.jsx("div",{className:"zentara-debt-overlay",children:a.jsxs("div",{className:"zentara-debt-modal",children:[a.jsx("h2",{className:"zentara-debt-title",children:"⚠️ Fleet in Crisis"}),a.jsx("p",{className:"zentara-debt-subtitle",children:"Your energy is depleted! Sell properties to recover, or accept your fate."}),a.jsxs("p",{className:"zentara-debt-credits",children:["Energy: ",a.jsxs("span",{className:"zentara-debt-player-credits",children:["✦",(st==null?void 0:st.credits)??0]})]}),a.jsx("div",{className:"zentara-debt-props",children:w.properties.filter(te=>te.ownerId===t).map(te=>{const me=w.board[te.tileId];if(!(me!=null&&me.cost))return null;const We=Math.floor(me.cost/2),pt=me.upgradeCost?Math.floor(me.upgradeCost/2):0,gt=me.group?ka[me.group]:void 0;return a.jsxs("div",{className:"zentara-debt-prop-row",children:[a.jsxs("div",{className:"zentara-debt-prop-info",children:[gt&&a.jsx("span",{className:"zentara-debt-prop-dot",style:{"--prop-color":gt}}),a.jsx("span",{className:"zentara-debt-prop-name",children:me.name}),te.upgradeLevel>0&&a.jsxs("span",{className:"zentara-debt-prop-level",children:["Lv",te.upgradeLevel]})]}),a.jsxs("div",{className:"zentara-debt-actions",children:[te.upgradeLevel>0&&a.jsxs("button",{className:"zentara-debt-sell-btn zentara-debt-sell-btn--liquidate",onClick:()=>k.debtLiquidateArm(te.tileId),children:["Liquidate Arm +✦",pt]}),a.jsxs("button",{className:"zentara-debt-sell-btn",onClick:()=>k.debtSell(te.tileId),disabled:te.upgradeLevel>0,children:["Sell Planet +✦",We]})]})]},te.tileId)})}),a.jsx("button",{className:"zentara-debt-done-btn",onClick:()=>k.debtResolve(),disabled:((st==null?void 0:st.credits)??0)<=0&&w.properties.some(te=>te.ownerId===t),children:w.properties.filter(te=>te.ownerId===t).length===0?"Accept Fate":"Done Selling"})]})}),w.finished&&!Ve&&!or&&a.jsxs("div",{className:"zentara-win-overlay",children:[a.jsx("div",{className:"zentara-win-title",children:"⚔️ War Over"}),a.jsxs("div",{className:"zentara-win-name",children:[pn?Yr(pn.piece):"Unknown"," claims victory!"]}),a.jsxs("div",{className:"zentara-win-total",children:["Total Net Worth: ✦",(ea==null?void 0:ea.total)??(pn==null?void 0:pn.credits)??0]}),ea&&a.jsxs("div",{className:"zentara-win-breakdown",children:[a.jsxs("span",{children:["⚡ Energy: ✦",ea.credits]}),ea.propertyValue>0&&a.jsxs("span",{children:["🌍 Planets: ✦",ea.propertyValue]}),ea.weaponValue>0&&a.jsxs("span",{children:["🚀 Weapons: ✦",ea.weaponValue]}),ea.armorValue>0&&a.jsxs("span",{children:["🛡 Armor: ✦",ea.armorValue]})]}),a.jsxs("div",{className:"zentara-win-actions",children:[a.jsx("button",{className:"zentara-win-btn zentara-win-btn--primary",onClick:()=>{uw();const te=crypto.randomUUID().slice(0,8);g(`/zentara/match/${te}`)},children:"Play Again"}),a.jsx("button",{className:"zentara-win-btn zentara-win-btn--secondary",onClick:()=>{g("/lobby")},children:"Back to Lobby"})]}),a.jsx("div",{style:{marginTop:12,display:"flex",justifyContent:"center"},children:a.jsx(NM,{gameMode:"zentara"})})]}),W&&a.jsx(ube,{deck:W.deck,text:W.text,amount:W.amount,rollerName:st?Yr(st.piece):"Unknown Fleet",rollerColor:(st==null?void 0:st.pieceColor)??"#888",onDismiss:()=>{G(null),E.current.resolveCard()},autoDismissMs:W.autoDismissMs}),$&&a.jsx(dbe,{...$,onConfirm:()=>{E.current.plantSpy($.group),K(null)},onCancel:()=>K(null)}),yr&&yr.miniGame==="fps"&&a.jsx(yz,{attacker:yr.attacker,defender:yr.defender,onComplete:rs,tileBackgroundImage:yr.tileImage,botPilot:!!yr.botPilot,onProgress:_?te=>{var me,We;return(We=(me=E.current).reportRaidProgress)==null?void 0:We.call(me,{attackerId:yr.attacker.id,defenderId:yr.defender.id,...te})}:void 0}),yr&&yr.miniGame==="codebreaker"&&a.jsx(bz,{attacker:yr.attacker,defender:yr.defender,onComplete:rs}),yr&&yr.miniGame==="soldier-fps"&&a.jsx(ot.Suspense,{fallback:null,children:a.jsx(Bxe,{attacker:yr.attacker,defender:yr.defender,onComplete:rs,botPilot:!!yr.botPilot,tileBackgroundImage:yr.tileImage,skipBonus:!!yr.skipBonus})}),(T==null?void 0:T.action)==="spy-clash"&&(it||m)&&(T.spyOwnerId===t||m)&&(()=>{const te=w.players.find(gt=>gt.id===T.spyOwnerId),me=w.players.find(gt=>gt.id===T.defenderId);if(!te||!me)return null;const We=w.board[T.tileId],pt=m&&T.spyOwnerId!==t;return ws.createPortal(a.jsx(fT,{pendingEffect:T,attacker:te,defender:me,groupColor:We!=null&&We.group?ka[We.group]??"#9d4edd":"#9d4edd",onPuzzleResult:gt=>{var xt;return(xt=k.spyPuzzleResult)==null?void 0:xt.call(k,gt)},onShotResult:gt=>{var xt;return(xt=k.spyShotResult)==null?void 0:xt.call(k,gt)},botPilot:pt}),document.body)})(),gn&&(()=>{var me;const te={tileId:((me=w.board.find(We=>We.group===gn.group))==null?void 0:me.id)??0,action:"spy-clash",group:gn.group,spyOwnerId:gn.attacker.id,defenderId:gn.defender.id,step:gn.step};return a.jsx(fT,{pendingEffect:te,attacker:gn.attacker,defender:gn.defender,groupColor:ka[gn.group]??"#9d4edd",onPuzzleResult:We=>{console.log(`[SPY STRIKE DEBUG] puzzle result: ${We?"PASS → advancing to shot":"FAIL"}`),We?dn(pt=>pt&&{...pt,step:"shot"}):x.current(()=>dn(null),1800)},onShotResult:We=>{console.log(`[SPY STRIKE DEBUG] shot result: ${We}`),x.current(()=>dn(null),1800)}})})(),Gr&&a.jsxs(a.Fragment,{children:[a.jsx(Cz,{defender:Gr.defender,groupColor:Gr.groupColor,onComplete:te=>{console.log(`[SNIPER DEBUG] outcome: ${te}`),x.current(()=>Sn(null),1500)}},Gr.runKey),a.jsxs("div",{className:"zentara-sniper-debug-toolbar",children:[a.jsx("button",{type:"button",className:"zentara-sniper-debug-btn",onClick:()=>Sn(te=>te&&{...te,runKey:te.runKey+1}),children:"🔁 RESTART"}),a.jsx("button",{type:"button",className:"zentara-sniper-debug-btn zentara-sniper-debug-btn--close",onClick:()=>Sn(null),children:"✕ CLOSE"})]})]}),a.jsx(jxe,{open:F,onClose:H}),fe&&!Ve&&!or&&a.jsx("div",{className:"zentara-laser-flash",onAnimationEnd:()=>ye(!1)}),a.jsx(aye,{players:w.players,properties:w.properties,tiles:w.board,currentPlayerId:(st==null?void 0:st.id)??"",open:z,onClose:()=>O(!1)}),a.jsx(oye,{open:q,onClose:()=>X(!1),roomId:d,localPlayerId:t,players:w.players,injectedMessages:xe?oe:void 0,onLocalSend:xe&&!m?te=>{var me;ce(We=>We.some(pt=>pt.id===te.id)?We:[...We,te]),(me=_t.current)==null||me.notifyHumanMessage(te.text)}:void 0}),xe&&a.jsx(lye,{latest:pe,players:w.players,onOpen:()=>X(!0),hidden:q})]})},Xr={ROLL:"zentara:roll",BUY:"zentara:buy",SKIP_BUY:"zentara:skip-buy",PAY_RENT:"zentara:pay-rent",HERO_CLASH_ROLL:"zentara:hero-clash-roll",PAY_TAX:"zentara:pay-tax",RESOLVE_CARD:"zentara:resolve-card",PAY_BAIL:"zentara:pay-bail",APPLY_TELEPORT:"zentara:apply-teleport",END_TURN:"zentara:end-turn",UPGRADE:"zentara:upgrade",MORTGAGE:"zentara:mortgage",SELL:"zentara:sell",SABOTAGE:"zentara:sabotage",UPGRADE_ARMOR:"zentara:upgrade-armor",UPGRADE_WEAPON:"zentara:upgrade-weapon",LIQUIDATE_ARMOR:"zentara:liquidate-armor",LIQUIDATE_WEAPON:"zentara:liquidate-weapon",RESOLVE_RAID:"zentara:resolve-raid",RAID_PROGRESS:"zentara:raid-progress",DEBT_SELL:"zentara:debt-sell",DEBT_LIQUIDATE_ARM:"zentara:debt-liquidate-arm",DEBT_RESOLVE:"zentara:debt-resolve",PLANT_SPY:"zentara:plant-spy",SPY_PUZZLE_RESULT:"zentara:spy-puzzle-result",SPY_SHOT_RESULT:"zentara:spy-shot-result",PROPOSE_TRADE:"zentara:propose-trade",ACCEPT_TRADE:"zentara:accept-trade",DECLINE_TRADE:"zentara:decline-trade",SELECT_PIECE:"zentara:select-piece",START_MATCH:"zentara:start-match",GET_STATE:"zentara:get-state",STATE_UPDATE:"zentara:state-update",PIECE_SELECTED:"zentara:piece-selected",TRADE_PROPOSED:"zentara:trade-proposed",TRADE_RESOLVED:"zentara:trade-resolved",GAME_OVER:"zentara:game-over"};function fg(){return crypto.randomUUID()}function gT(e,t,r,n=1e4){return new Promise(s=>{const o=setTimeout(()=>s(null),n);e.emit(t,r,i=>{clearTimeout(o),s(i)})})}function yT(e){if(!e)return null;const t=String(e.action??"");return t==="pay-rent"?{...e,action:"energy-toll"}:t==="pay-tax"?{...e,action:"void-drain"}:e}function Yxe(e){const t=Na(),{meId:r,user:n}=Zr(),s=r??(n==null?void 0:n.id),{info:o}=vb(),[i,c]=l.useState(null),[u,p]=l.useState([]),[d,f]=l.useState(null),[m,h]=l.useState(0),[b,g]=l.useState(null),[y,x]=l.useState(!!(t!=null&&t.connected)),v=l.useRef(null),[A,_]=l.useState({}),w=Object.values(A);l.useEffect(()=>{if(!t)return;const ce=()=>{if(!t.connected){console.warn("[Zentara] requestState: socket not connected");return}console.log("[Zentara] Requesting game state for room",e),gT(t,Xr.GET_STATE,{roomId:e,eventId:fg()}).then(pe=>{if(pe!=null&&pe.ok&&pe.state){console.log("[Zentara] GET_STATE response OK, phase:",pe.state.currentTurn.phase);const ee={...pe.state,pendingEffect:yT(pe.state.pendingEffect),board:xy(pe.state.boardSize).tiles};for(const xe of ee.players)xe.armorLevel==null&&(xe.armorLevel=0),xe.weaponLevel==null&&(xe.weaponLevel=0);c(ee)}else console.warn("[Zentara] GET_STATE response not OK",pe)}).catch(pe=>{console.warn("[Zentara] GET_STATE error:",pe.message)})},_e=()=>{console.log("[Zentara] Socket connected"),x(!0),ce()},re=()=>{console.warn("[Zentara] Socket disconnected"),x(!1)};return t.on("connect",_e),t.on("disconnect",re),x(t.connected),t.connected&&ce(),()=>{t.off("connect",_e),t.off("disconnect",re)}},[t,e]),l.useEffect(()=>{if(!t)return;const ce=Le=>{var _t,Xe;console.log("[Zentara] STATE_UPDATE received",{phase:Le.state.currentTurn.phase,currentPlayerIdx:Le.state.currentPlayerIndex,pendingEffect:(_t=Le.state.pendingEffect)==null?void 0:_t.action,playersCount:Le.state.players.length});const Ge={...Le.state,pendingEffect:yT(Le.state.pendingEffect),board:xy(Le.state.boardSize).tiles};for(const bt of Ge.players)bt.armorLevel==null&&(bt.armorLevel=0),bt.weaponLevel==null&&(bt.weaponLevel=0);c(Ge),(Xe=Le.events)!=null&&Xe.length&&(p(bt=>[...bt,...Le.events]),Le.events.some(bt=>bt.type==="roll")&&h(bt=>bt+1))},_e=Le=>{f(Le.trade),v.current=Le.trade},re=Le=>{const Ge=v.current,_t=!!Ge&&Ge.id===Le.tradeId,Xe=Le.offererId??(_t?Ge.offerer.playerId:void 0),bt=Le.recipientId??(_t?Ge.recipient.playerId:void 0),Pt=Xe===s,kt=bt===s;Le.accepted?Pt&&o("Trade accepted","Your offer was accepted"):Pt?o("Trade declined","Your offer was declined"):kt&&o("Trade declined","You declined the offer"),_t&&(f(null),v.current=null)},pe=Le=>{},ee=Le=>{g(Le),Le.status==="complete"&&window.setTimeout(()=>g(Ge=>Ge===Le?null:Ge),2500)};console.log("[Zentara] Setting up socket listeners for room",e),t.on(Xr.STATE_UPDATE,ce),t.on(Xr.TRADE_PROPOSED,_e),t.on(Xr.TRADE_RESOLVED,re),t.on(Xr.GAME_OVER,pe),t.on(Xr.RAID_PROGRESS,ee);const xe=Le=>{_(Ge=>({...Ge,[Le.playerId]:Le.piece}))};return t.on(Xr.PIECE_SELECTED,xe),()=>{console.log("[Zentara] Cleaning up socket listeners for room",e),t.off(Xr.STATE_UPDATE,ce),t.off(Xr.TRADE_PROPOSED,_e),t.off(Xr.TRADE_RESOLVED,re),t.off(Xr.GAME_OVER,pe),t.off(Xr.RAID_PROGRESS,ee),t.off(Xr.PIECE_SELECTED,xe)}},[t,e,s,o]);const j=l.useCallback((ce,_e)=>{t!=null&&t.connected&&t.emit(ce,{roomId:e,eventId:fg(),..._e})},[t,e]),T=l.useCallback(async(ce,_e)=>{if(!(t!=null&&t.connected))return console.warn("[Zentara] startMatch: socket not connected"),!1;console.log("[Zentara] startMatch: sending START_MATCH with",ce.length,"players");const re=await gT(t,Xr.START_MATCH,{roomId:e,players:ce,boardSize:_e,eventId:fg()});return console.log("[Zentara] startMatch response:",re!=null&&re.ok?"OK":"FAILED"),!!(re&&re.ok)},[t,e]),R=l.useCallback(ce=>{t!=null&&t.connected&&t.emit(Xr.SELECT_PIECE,{roomId:e,piece:ce,eventId:fg()})},[t,e]),P=l.useCallback(()=>j(Xr.ROLL),[j]),k=l.useCallback(ce=>j(Xr.BUY,{tileId:ce}),[j]),E=l.useCallback(()=>j(Xr.SKIP_BUY),[j]),M=l.useCallback(()=>j(Xr.PAY_RENT),[j]),C=l.useCallback(()=>j(Xr.HERO_CLASH_ROLL),[j]),I=l.useCallback(()=>j(Xr.PAY_TAX),[j]),L=l.useCallback(()=>j(Xr.RESOLVE_CARD),[j]),N=l.useCallback(()=>j(Xr.APPLY_TELEPORT),[j]),S=l.useCallback(()=>j(Xr.PAY_BAIL),[j]),F=l.useCallback(()=>j(Xr.END_TURN),[j]),D=l.useCallback(ce=>j(Xr.UPGRADE,{tileId:ce}),[j]),H=l.useCallback(ce=>j(Xr.MORTGAGE,{tileId:ce}),[j]),W=l.useCallback(ce=>j(Xr.SELL,{tileId:ce}),[j]),G=l.useCallback(ce=>j(Xr.SABOTAGE,{tileId:ce}),[j]),$=l.useCallback(ce=>j(Xr.DEBT_SELL,{tileId:ce}),[j]),K=l.useCallback(ce=>j(Xr.DEBT_LIQUIDATE_ARM,{tileId:ce}),[j]),de=l.useCallback(()=>j(Xr.DEBT_RESOLVE),[j]),ie=l.useCallback(()=>{},[]),we=l.useCallback(()=>{},[]),he=l.useCallback((ce,_e,re,pe,ee)=>{j(Xr.PROPOSE_TRADE,{recipientId:ce,offererPropertyIds:_e,offererCredits:re,recipientPropertyIds:pe,recipientCredits:ee})},[j]),Ae=l.useCallback(()=>{const ce=v.current;ce&&j(Xr.ACCEPT_TRADE,{tradeId:ce.id})},[j]),Fe=l.useCallback(()=>{const ce=v.current;ce&&j(Xr.DECLINE_TRADE,{tradeId:ce.id})},[j]),U=l.useCallback(()=>j(Xr.UPGRADE_ARMOR,{}),[j]),V=l.useCallback(()=>j(Xr.UPGRADE_WEAPON,{}),[j]),z=l.useCallback(()=>j(Xr.LIQUIDATE_ARMOR,{}),[j]),O=l.useCallback(()=>j(Xr.LIQUIDATE_WEAPON,{}),[j]),q=l.useCallback(ce=>{j(Xr.RESOLVE_RAID,ce??{})},[j]),X=l.useCallback(ce=>{j(Xr.RAID_PROGRESS,ce)},[j]),Z=l.useCallback(ce=>j(Xr.PLANT_SPY,{group:ce}),[j]),Q=l.useCallback(ce=>j(Xr.SPY_PUZZLE_RESULT,{success:ce}),[j]),oe=l.useCallback(ce=>j(Xr.SPY_SHOT_RESULT,{outcome:ce}),[j]);return l.useEffect(()=>{var _e,re,pe;typeof window>"u"||!window.__E2E__||(window.__zentaraTestState=i?{ts:Date.now(),roomId:e,meId:r??null,phase:((_e=i.currentTurn)==null?void 0:_e.phase)??null,currentPlayerId:((re=i.players[i.currentPlayerIndex])==null?void 0:re.id)??null,currentPlayerIndex:i.currentPlayerIndex,pendingEffect:((pe=i.pendingEffect)==null?void 0:pe.action)??null,finished:!!i.finished,winnerId:i.winnerId??null,players:i.players.map(ee=>({id:ee.id,name:ee.displayName,credits:ee.credits,depleted:ee.depleted,tileIndex:ee.tileIndex})),turnHistoryLen:0,eventsLen:u.length}:{ts:Date.now(),roomId:e,meId:r??null,phase:null,finished:!1,players:[]})},[i,u.length,e,r]),{gameState:i,events:u,pendingEffect:(i==null?void 0:i.pendingEffect)??null,pendingTrade:d,rollTrigger:m,raidActivity:b,connected:y,takenPieces:w,piecesMap:A,selectPiece:R,startMatch:T,actions:{roll:P,buyProperty:k,payRent:M,heroClashRoll:C,payTax:I,resolveCard:L,goToJail:ie,payBailAction:S,endTurn:F,skipBuy:E,upgradeProperty:D,mortgageProperty:H,sellProperty:W,sabotageProperty:G,debtSell:$,debtLiquidateArm:K,debtResolve:de,proposeTrade:he,acceptTrade:Ae,declineTrade:Fe,saveGame:we,applyTeleport:N,upgradeArmor:U,upgradeWeapon:V,liquidateArmor:z,liquidateWeapon:O,resolveRaid:q,reportRaidProgress:X,plantSpy:Z,spyPuzzleResult:Q,spyShotResult:oe}}}const Zxe=({roomId:e})=>{var F;const{user:t,meId:r}=Zr(),n=Hr(),[s]=gp(),{room:o,joinRoom:i,leaveRoom:c}=Is(),{gameState:u,events:p,pendingEffect:d,pendingTrade:f,rollTrigger:m,raidActivity:h,connected:b,takenPieces:g,piecesMap:y,selectPiece:x,startMatch:v,actions:A}=Yxe(e),[_,w]=l.useState(!1),[j,T]=l.useState(null),[R,P]=l.useState(()=>s.get("boardSize")??"standard"),k=l.useRef(null),{bestHeroForEmpire:E}=vk(),M=l.useCallback(D=>{T(D),x(D)},[x]),C=l.useCallback(()=>{var D;(D=c==null?void 0:c(e))==null||D.catch(()=>{}),n("/zentara")},[c,e,n]);l.useEffect(()=>{!e||k.current===e||(k.current=e,i(e).catch(D=>console.warn("[Zentara] joinRoom failed",D)))},[e,i]);const I=ot.useMemo(()=>o!=null&&o.players?o.players.map(D=>({id:D.id||D.playerId||D.userId,name:D.displayName||D.name||D.username||"Player",avatarUrl:D.avatarUrl||void 0})):[],[o==null?void 0:o.players]),L=((F=o==null?void 0:o.players)==null?void 0:F[0])&&o.players[0].id===r,N=l.useCallback(async()=>{if(_||!L||I.length<2||!j)return;w(!0);const D=I.map(H=>{var G;const W=H.id===r?j:y[H.id]??void 0;return{...H,piece:W,heroId:H.id===r&&W?(G=E(W))==null?void 0:G.heroId:void 0}});await v(D,R),w(!1)},[_,L,I,v,j,r,y,E,R]);if(!u)return j?a.jsxs("div",{className:"zentara-match-container zentara-match-container--waiting",children:[a.jsx("h2",{className:"zentara-match-header",children:"Waiting for players..."}),j&&a.jsxs("div",{style:{fontSize:13,color:Ol[j]},className:"zentara-match-subtext",children:["Your empire: ",wi[j].name]}),a.jsxs("div",{className:"zentara-match-action-group",children:[a.jsxs("div",{style:{fontSize:14,opacity:.7},children:[I.length," / 2+ players joined"]}),L&&I.length>=2&&a.jsx("button",{onClick:N,disabled:_,className:"zentara-match-primary-btn zentara-match-primary-btn--compact",children:_?"Starting...":"Start Game"})]}),a.jsx("div",{className:"zentara-match-players-list",children:I.map(D=>a.jsxs("div",{className:"zentara-match-player-item",children:[D.name," ",D.id===r?"(you)":""]},D.id))}),a.jsx("button",{onClick:C,className:"zentara-match-back-btn",children:"Back"}),a.jsx(cO,{roomId:e,gameMode:"zentara"}),L&&I.length>=2&&a.jsx(a.Fragment,{children:a.jsx("div",{className:"zentara-match-size-selector",children:["standard","full"].map(D=>a.jsx("button",{onClick:()=>P(D),className:`zentara-match-size-btn zentara-match-size-btn--compact ${R===D?"zentara-match-size-btn--active":""}`,children:D==="standard"?"Standard (20 tiles)":"Full (40 tiles)"},D))})}),!b&&a.jsx("div",{className:"zentara-match-reconnect-notice",children:"Reconnecting..."})]}):a.jsx(rD,{taken:g,onSelect:M,bestHeroForEmpire:E,onBack:C});const S=u.players.map(D=>({id:D.id,name:D.displayName}));return a.jsx(Yw,{players:S,localPlayerId:r,savedState:u,onSaveAndExit:C,multiplayerActions:A,multiplayerEvents:p,multiplayerPendingEffect:d,multiplayerPendingTrade:f,multiplayerRollTrigger:m,multiplayerRaidActivity:h,roomId:e},e)},Kxe=["Rival","Nemesis","Warden","Phantom","Tyrant","Specter","Vortex","Hydra","Onyx","Ravager","Cipher","Hex","Eclipse","Talon","Vanguard","Reaper","Wraith","Sable","Khaos","Drake"],H_=["crimson-dominion","silver-pact","azure-sovereignty","golden-imperium","emerald-collective","void-enclave"],Qxe=({matchId:e})=>{const t=Hr(),[r]=gp(),n=r.get("autoplay")==="1",s=r.get("qm")==="1",[o,i]=l.useState(null),[c,u]=l.useState(!1),[p,d]=l.useState(!1),[f,m]=l.useState(null),[h,b]=l.useState("standard"),[g,y]=l.useState(!1),{bestHeroForEmpire:x}=vk(),v=ot.useMemo(()=>[...H_.filter(R=>R!==f)].sort(()=>Math.random()-.5),[f]),A=ot.useMemo(()=>[...Kxe].sort(()=>Math.random()-.5),[e]),_=ot.useMemo(()=>{if(!n)return null;const T=parseInt(r.get("bots")??"",10),R=Number.isFinite(T)?Math.max(2,Math.min(H_.length,T)):5,P=[...H_].sort(()=>Math.random()-.5).slice(0,R),k=["Vega","Orion","Lyra","Rigel","Nova","Cygnus"];return P.map((E,M)=>{const C=dw(E),I=C.length>0?C[Math.floor(Math.random()*C.length)]??C[0]:null;return{id:`auto-p${M+1}`,name:k[M]??`Bot ${M+1}`,piece:E,heroId:I==null?void 0:I.id,isBot:!0}})},[n,e,r]);if(l.useEffect(()=>{ma().then(T=>{i(Math.max(1,Math.min(5,T.zentaraBotCount??Sa.zentaraBotCount??1))),u(!!T.zentaraDisableRaid),d(!!T.zentaraDisableSpyStrike)}).catch(()=>i(Sa.zentaraBotCount??1))},[]),n&&_)return a.jsx(Yw,{players:_,localPlayerId:"__autoplay_observer__",onSaveAndExit:()=>t("/lobby"),boardSize:"standard",autoplay:!0,gameRules:{disableRaid:c,disableSpyStrike:!1}},e);if(o===null)return null;const w=(()=>{const T=XL();return T&&T.matchId===e?T:null})();if(!w&&!f)return a.jsx(rD,{onSelect:m,bestHeroForEmpire:x,onBack:()=>t("/zentara")});if(!w&&f&&!g)return a.jsxs("div",{className:"zentara-match-container zentara-match-container--board-size",children:[a.jsx("h2",{className:"zentara-match-header zentara-match-header--board-size",children:"Choose Board Size"}),["standard","full"].map(T=>a.jsx("button",{onClick:()=>b(T),className:`zentara-match-size-btn ${h===T?"zentara-match-size-btn--active":""}`,children:T==="standard"?"Standard — 20 tiles":"Full — 40 tiles"},T)),a.jsx("button",{onClick:()=>y(!0),className:"zentara-match-primary-btn",children:"Start Game"}),a.jsx("button",{onClick:()=>m(null),className:"zentara-match-back-btn zentara-match-back-btn--minimal",children:"← Back"})]});const j=w?w.players.map(T=>({id:T.id,name:T.displayName})):(()=>{const T=x(f),R=(T==null?void 0:T.tier)??0;return[{id:"local-p1",name:"You",piece:f,heroId:T==null?void 0:T.heroId},...Array.from({length:o},(P,k)=>{const E=v[k],M=dw(E).filter(I=>I.tier<=R),C=M.length>0?M[Math.floor(Math.random()*M.length)]:null;return{id:`local-p${k+2}`,name:A[k]??`Bot ${k+1}`,piece:E,heroId:C==null?void 0:C.id,isBot:!0}})]})();return a.jsx(Yw,{players:j,localPlayerId:"local-p1",savedState:w,onSaveAndExit:()=>t("/lobby"),boardSize:w?void 0:h,botChatEnabled:s,gameRules:{disableRaid:c,disableSpyStrike:p}},e)},cp=()=>{const{matchId:e,roomId:t}=hp(),[r]=gp(),n=t||r.get("roomId");return n?a.jsx(Zxe,{roomId:n}):a.jsx(Qxe,{matchId:e})},Jxe=l.lazy(()=>Cr(()=>import("./TurretPreview-DS4z-mdm.js"),__vite__mapDeps([15,3,4]),import.meta.url));l.lazy(()=>Cr(()=>import("./ShipPackPreview-DzfsKUAI.js"),__vite__mapDeps([16,3,4,2,17]),import.meta.url));function $xe(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby",s=/^\/room\//.test(r)||/^\/poker\/room\//.test(r);(()=>{var c;try{return/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s),(n||s)&&(document.body.classList.remove("profile-page-body"),document.body.classList.remove("messages-page-body"));const i=document.documentElement;if(n||s){i.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),i.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),i.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 c=()=>{const u=document.getElementById("root");u&&(u.scrollTop=0,u.style.removeProperty("overflow"),u.style.removeProperty("overflow-y"));const p=document.querySelector(".home-fixed-root");p&&(p.scrollTop=0,p.style.removeProperty("overflow"),p.style.removeProperty("overflow-y"),p.style.removeProperty("height"),p.style.removeProperty("min-height"))};c(),requestAnimationFrame(()=>{c()})}else i.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),i.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),i.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/admin",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/room/:roomId",element:a.jsx(qm,{})}),a.jsx(qe,{path:"/poker",element:a.jsx(_1,{})}),a.jsx(qe,{path:"/poker/mock",element:a.jsx(w1,{})}),a.jsx(qe,{path:"/poker/room/:roomId",element:a.jsx(v1,{})}),a.jsx(qe,{path:"/zentara",element:a.jsx(qn,{to:"/",replace:!0})}),a.jsx(qe,{path:"/zentara/match/:matchId",element:a.jsx(cp,{})}),a.jsx(qe,{path:"/zentara/room/:roomId",element:a.jsx(cp,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/button-sandbox",element:a.jsx(Vm,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{})}),a.jsx(qe,{path:"/turret-preview",element:a.jsx(l.Suspense,{fallback:null,children:a.jsx(Jxe,{})})}),a.jsx(qe,{path:"/ship-pack-preview",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/lobby",replace:!0})})]})}const Iz="ceelo_lounge_local_posts",bT="ceelo_lounge_reactions",vT="ceelo_lounge_added_players",eAe=[{id:"house-roll-456",author:"Ace Morgan",handle:"@banker-ace",badge:"Table highlight",body:"Walked into banker, rolled 4-5-6, and cleared two challengers before the next song hit.",stat:"4-5-6 · +28.4K",reactions:214,createdAt:"2m",kind:"highlight"},{id:"club-night-cap",author:"Cee-Lo Lounge",handle:"@official",badge:"Nightly event",body:"High Roller Night opens at 9 PM. Public tables, watcher chat, and streak cards for every table sweep.",stat:"Event · 9 PM",reactions:89,createdAt:"18m",kind:"club"},{id:"trips-flex",author:"Kai Reed",handle:"@trips-kai",badge:"Player post",body:"If the table says pass bank, that means the table is scared. Run it back.",stat:"3 wins · 1 streak",reactions:133,createdAt:"31m",kind:"post"}],tAe=[{id:"suggested-ace",name:"Ace Morgan",handle:"@banker-ace",tag:"12 table wins"},{id:"suggested-lua",name:"Lua Brooks",handle:"@last-roll-lua",tag:"5 win streak"},{id:"suggested-kai",name:"Kai Reed",handle:"@trips-kai",tag:"Top 10 today"}];function mg(e){return(e||"Player").trim().split(/\s+/).slice(0,2).map(r=>r.charAt(0).toUpperCase()).join("")||"P"}function rAe(){try{const e=window.localStorage.getItem(Iz),t=e?JSON.parse(e):[];return Array.isArray(t)?t:[]}catch{return[]}}function _T(e){try{const t=window.localStorage.getItem(e),r=t?JSON.parse(t):[];return new Set(Array.isArray(r)?r.filter(n=>typeof n=="string"):[])}catch{return new Set}}function wT(e,t){try{window.localStorage.setItem(e,JSON.stringify(Array.from(t)))}catch{}}function nAe(e){try{window.localStorage.setItem(Iz,JSON.stringify(e.slice(0,12)))}catch{}}function aAe(){const e=Hr(),{user:t}=Zr(),{roomsList:r,refreshRooms:n,loading:s}=ib(),[o,i]=l.useState(""),[c,u]=l.useState(()=>rAe()),[p,d]=l.useState(()=>_T(bT)),[f,m]=l.useState(()=>_T(vT));l.useEffect(()=>{n()},[n]);const h=l.useMemo(()=>[...(r==null?void 0:r.public)??[],...(r==null?void 0:r.private)??[]].filter(w=>{const j=((w==null?void 0:w.gameMode)||(w==null?void 0:w.mode)||"cee-lo").toString().toLowerCase();return j==="cee-lo"||j==="ceelo"}).slice(0,3),[r]),b=l.useMemo(()=>[...c,...eAe],[c]),g=l.useCallback(()=>{const _=o.trim();if(!_)return;cr("light");const w={id:`local-${Date.now()}`,author:(t==null?void 0:t.name)||"You",handle:"@your-table",avatarUrl:t==null?void 0:t.avatarUrl,badge:"Your post",body:_,stat:"Fresh from the lounge",reactions:0,createdAt:"now",kind:"post"};u(j=>{const T=[w,...j].slice(0,12);return nAe(T),T}),i("")},[o,t==null?void 0:t.avatarUrl,t==null?void 0:t.name]),y=l.useCallback(_=>{_&&(cr("light"),e(`/room/${_}?m=cee-lo`))},[e]),x=l.useCallback(_=>{cr("light"),d(w=>{const j=new Set(w);return j.has(_)?j.delete(_):j.add(_),wT(bT,j),j})},[]),v=l.useCallback(()=>{cr("light");const _=h[0],w=(_==null?void 0:_.roomId)||(_==null?void 0:_.id);if(w){e(`/room/${w}?m=cee-lo`);return}e("/lobby")},[h,e]),A=l.useCallback(_=>{cr("light"),m(w=>{const j=new Set(w);return j.has(_)?j.delete(_):j.add(_),wT(vT,j),j})},[]);return a.jsxs("main",{className:"ceelo-lounge",children:[a.jsx(Ja,{className:"page-ceelo-lounge"}),a.jsxs("header",{className:"ceelo-lounge__topbar",children:[a.jsx("button",{className:"ceelo-lounge__back",type:"button",onClick:()=>e("/lobby"),"aria-label":"Back to lobby",children:"←"}),a.jsxs("div",{children:[a.jsx("p",{children:"Cee-Lo Social"}),a.jsx("h1",{children:"The Lounge"})]}),a.jsx("button",{className:"ceelo-lounge__avatar",type:"button",onClick:()=>e("/profile"),"aria-label":"Open profile",children:t!=null&&t.avatarUrl?a.jsx("img",{src:t.avatarUrl,alt:""}):mg(t==null?void 0:t.name)})]}),a.jsxs("section",{className:"ceelo-lounge__hero","aria-label":"Lounge overview",children:[a.jsxs("div",{children:[a.jsx("p",{className:"ceelo-lounge__eyebrow",children:"Live table culture"}),a.jsx("h2",{children:"Follow players, flex rolls, and find the table everyone is watching."}),a.jsx("p",{className:"ceelo-lounge__lede",children:"The feed turns big hands, rematches, and banker pressure into moments players can follow between games."})]}),a.jsxs("div",{className:"ceelo-lounge__hero-actions",children:[a.jsx("button",{type:"button",onClick:()=>e("/lobby"),className:"ceelo-lounge__primary",children:"Play now"}),a.jsx("button",{type:"button",onClick:()=>n(),className:"ceelo-lounge__ghost",children:"Refresh tables"})]})]}),a.jsxs("section",{className:"ceelo-lounge__composer","aria-label":"Post to lounge",children:[a.jsxs("div",{className:"ceelo-lounge__composer-head",children:[a.jsx("span",{className:"ceelo-lounge__mini-avatar",children:mg(t==null?void 0:t.name)}),a.jsxs("div",{children:[a.jsx("strong",{children:"Share a table moment"}),a.jsx("span",{children:"Post a streak, call a rematch, or invite followers to watch."})]})]}),a.jsx("textarea",{value:o,onChange:_=>i(_.target.value.slice(0,220)),placeholder:"What just happened at your table?",maxLength:220}),a.jsxs("div",{className:"ceelo-lounge__composer-actions",children:[a.jsxs("span",{children:[o.length,"/220"]}),a.jsx("button",{type:"button",onClick:g,disabled:!o.trim(),children:"Post"})]})]}),a.jsxs("section",{className:"ceelo-lounge__grid",children:[a.jsxs("div",{className:"ceelo-lounge__feed","aria-label":"Activity feed",children:[a.jsxs("div",{className:"ceelo-lounge__section-title",children:[a.jsx("h2",{children:"Floor activity"}),a.jsxs("span",{children:[b.length," updates"]})]}),b.map(_=>a.jsxs("article",{className:`ceelo-post ceelo-post--${_.kind}`,children:[a.jsx("div",{className:"ceelo-post__avatar",children:_.avatarUrl?a.jsx("img",{src:_.avatarUrl,alt:""}):mg(_.author)}),a.jsxs("div",{className:"ceelo-post__body",children:[a.jsxs("div",{className:"ceelo-post__meta",children:[a.jsx("strong",{children:_.author}),a.jsx("span",{children:_.handle}),a.jsx("span",{children:_.createdAt})]}),a.jsx("p",{className:"ceelo-post__badge",children:_.badge}),a.jsx("p",{className:"ceelo-post__copy",children:_.body}),a.jsxs("div",{className:"ceelo-post__actions",children:[a.jsxs("button",{type:"button",onClick:()=>x(_.id),"aria-pressed":p.has(_.id),children:[p.has(_.id)?"Reacted":"React"," ",_.reactions+(p.has(_.id)?1:0)]}),a.jsx("button",{type:"button",onClick:v,children:"Run it back"}),a.jsx("span",{children:_.stat})]})]})]},_.id))]}),a.jsxs("aside",{className:"ceelo-lounge__side","aria-label":"Lounge sidebar",children:[a.jsxs("section",{className:"ceelo-side-card",children:[a.jsxs("div",{className:"ceelo-lounge__section-title",children:[a.jsx("h2",{children:"Watch now"}),a.jsx("span",{children:s?"Loading":`${h.length} live`})]}),h.length?h.map(_=>{var w;return a.jsxs("button",{className:"ceelo-live-room",type:"button",onClick:()=>y(_.roomId||_.id),children:[a.jsxs("span",{children:[a.jsx("strong",{children:_.name||"Open Cee-Lo Table"}),a.jsxs("small",{children:[((w=_.players)==null?void 0:w.length)??_.playerCount??0," seated"]})]}),a.jsx("em",{children:"Join"})]},_.roomId||_.id)}):a.jsxs("div",{className:"ceelo-empty-state",children:[a.jsx("strong",{children:"No public tables yet"}),a.jsx("span",{children:"Start one and the lounge has something to talk about."})]})]}),a.jsxs("section",{className:"ceelo-side-card",children:[a.jsxs("div",{className:"ceelo-lounge__section-title",children:[a.jsx("h2",{children:"Suggested players"}),a.jsx("span",{children:"Follow"})]}),tAe.map(_=>a.jsxs("div",{className:"ceelo-suggested-player",children:[a.jsx("span",{className:"ceelo-lounge__mini-avatar",children:mg(_.name)}),a.jsxs("div",{children:[a.jsx("strong",{children:_.name}),a.jsxs("small",{children:[_.handle," · ",_.tag]})]}),a.jsx("button",{type:"button",onClick:()=>A(_.id),"aria-pressed":f.has(_.id),children:f.has(_.id)?"Added":"Add"})]},_.id))]}),a.jsxs("section",{className:"ceelo-side-card ceelo-side-card--club",children:[a.jsx("p",{className:"ceelo-lounge__eyebrow",children:"Club preview"}),a.jsx("h2",{children:"Lounges are next"}),a.jsx("p",{children:"Private groups, weekly streak races, table hosts, and club leaderboards will make repeat play feel owned."}),a.jsx("button",{type:"button",onClick:()=>e("/messages"),children:"Open messages"})]})]})]})]})}function sAe(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby",s=/^\/room\//.test(r),o=r==="/lounge";(()=>{var u;try{return/^(capacitor:|ionic:)/i.test(((u=window.location)==null?void 0:u.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s);const c=document.documentElement;if(n||s){c.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),c.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),c.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else o?(c.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),c.style.setProperty("overflow-x","hidden","important"),document.body.style.setProperty("overflow-x","hidden","important"),c.style.setProperty("overflow-y","auto","important"),document.body.style.setProperty("overflow-y","auto","important"),c.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),c.style.removeProperty("height"),document.body.style.removeProperty("height"),c.style.setProperty("overscroll-behavior-x","none","important"),document.body.style.setProperty("overscroll-behavior-x","none","important")):(c.style.removeProperty("overflow"),c.style.removeProperty("overflow-x"),c.style.removeProperty("overflow-y"),document.body.style.removeProperty("overflow"),document.body.style.removeProperty("overflow-x"),document.body.style.removeProperty("overflow-y"),c.style.removeProperty("overscroll-behavior"),c.style.removeProperty("overscroll-behavior-x"),document.body.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior-x"),c.style.removeProperty("height"),document.body.style.removeProperty("height"))}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/lounge",element:a.jsx(aAe,{})}),a.jsx(qe,{path:"/admin",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/room/:roomId",element:a.jsx(qm,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/button-sandbox",element:a.jsx(Vm,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/lobby",replace:!0})})]})}function oAe(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby",s=/^\/room\//.test(r);(()=>{var c;try{return/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s);const i=document.documentElement;if(n||s){i.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),i.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),i.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else i.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),i.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),i.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/admin",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/room/:roomId",element:a.jsx(qm,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/button-sandbox",element:a.jsx(Vm,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/lobby",replace:!0})})]})}function iAe(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby",s=/^\/poker\//.test(r);(()=>{var c;try{return/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s);const i=document.documentElement;if(n||s){i.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),i.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),i.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else i.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),i.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),i.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/admin",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/poker",element:a.jsx(_1,{})}),a.jsx(qe,{path:"/poker/mock",element:a.jsx(w1,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/button-sandbox",element:a.jsx(Vm,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{})}),a.jsx(qe,{path:"/poker/room/:roomId",element:a.jsx(v1,{})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/poker",replace:!0})})]})}const Zw=L3(e=>({user:null,token:null,roomId:null,seed:null,startAt:null,endAt:null,driftMs:0,gameMode:"wordsearch",letters:void 0,questions:void 0,set:t=>e(t),setSession:t=>e(r=>({...r,roomId:t.roomId??r.roomId,seed:t.seed??r.seed,startAt:t.startAt??r.startAt,endAt:t.endAt??r.endAt,driftMs:t.driftMs??r.driftMs,gameMode:t.gameMode??r.gameMode,letters:t.letters??r.letters,questions:t.questions??r.questions}))}));function Nz({letters:e,onSubmit:t,disabled:r,cellSize:n=64,onTap:s,feedback:o,shakeKey:i,botTrail:c}){var L;const u=e.length,p=((L=e[0])==null?void 0:L.length)??0,[d,f]=l.useState([]),m=l.useRef(!1),h=l.useRef(null),[b,g]=l.useState(-1),y=l.useRef(c);y.current=c,l.useEffect(()=>{if(!c||!c.path||c.path.length===0){g(-1);return}g(0);const N=Math.max(220,Math.min(320,Math.floor(2e3/c.path.length))),S=[],F=c.mine===!0;F&&gi({volume:.6});for(let D=1;D<c.path.length;D++)S.push(window.setTimeout(()=>{g(D),F&&gi({volume:.6})},D*N));return S.push(window.setTimeout(()=>g(-1),c.path.length*N+900)),()=>{S.forEach(D=>window.clearTimeout(D))}},[c==null?void 0:c.nonce]);const x=l.useCallback(N=>!c||b<0?-1:c.path.slice(0,b+1).findIndex(F=>F.r===N.r&&F.c===N.c),[c,b]),v=(N,S)=>{const F=Math.abs(N.r-S.r),D=Math.abs(N.c-S.c);return F<=1&&D<=1&&!(F===0&&D===0)},A=N=>{if(N.length<2)return!0;for(let S=1;S<N.length;S++)if(!v(N[S-1],N[S]))return!1;return!0},_=l.useCallback(N=>d.findIndex(S=>S.r===N.r&&S.c===N.c),[d]),w=()=>f([]),j=(N,S)=>{const F=h.current;if(!F)return null;const D=F.getBoundingClientRect(),H=D.width/p,W=D.height/u,G=(N-D.left)/H,$=(S-D.top)/W,K=Math.floor(G),de=Math.floor($);if(de<0||de>=u||K<0||K>=p)return null;if(m.current&&d.length>0){const ie=Math.abs(G-K-.5),we=Math.abs($-de-.5);if(ie+we>.52)return null}return{r:de,c:K}},T=N=>{if(r)return;if(d.length===0){f([N]),gi({volume:.3}),cr("Light"),s==null||s(N);return}const S=d[d.length-1];if(!S||S.r===N.r&&S.c===N.c)return;const F=_(N);if(F>=0){F===d.length-2&&(f(D=>D.slice(0,-1)),cr("Light"));return}v(S,N)?(f(D=>[...D,N]),gi({volume:.3}),cr("Light"),s==null||s(N)):(f(D=>{const H=[...D];let W=H[H.length-1];const G=u+p;for(let $=0;$<G&&!(W.r===N.r&&W.c===N.c);$++){const K=Math.sign(N.r-W.r),de=Math.sign(N.c-W.c),ie={r:W.r+K,c:W.c+de};if(H.some(we=>we.r===ie.r&&we.c===ie.c))break;H.push(ie),W=ie}return H}),gi({volume:.3}),cr("Light"),s==null||s(N))},R=N=>{m.current=!0;const S=j(N.clientX,N.clientY);S&&T(S)},P=N=>{if(!m.current)return;const S=j(N.clientX,N.clientY);S&&T(S)},k=()=>{m.current&&(m.current=!1,d.length>=3&&A(d)&&(cr("Medium"),t(d)),w())},E=(p-1)*3,M=(u-1)*3,C=`min(calc((100vw - 48px - ${E}px) / ${p}), calc((100vh - 180px - ${M}px) / ${u}), calc((100dvh - 180px - ${M}px) / ${u}), ${n}px)`,I=l.useMemo(()=>({gridTemplateColumns:`repeat(${p}, ${C})`,gridTemplateRows:`repeat(${u}, ${C})`,touchAction:"none"}),[p,u,C]);return a.jsxs("div",{className:["skillsGridWrap",i?"skillsGridWrap--shake":""].join(" "),children:[a.jsx("div",{ref:h,onPointerDown:R,onPointerMove:P,onPointerUp:k,onPointerCancel:()=>m.current=!1,style:I,className:"skillsGrid",children:e.map((N,S)=>N.map((F,D)=>{const H=_({r:S,c:D}),W=H>=0,G=x({r:S,c:D}),$=G>=0;return a.jsxs("div",{className:["skillsCell",W?"skillsCell--selected":"skillsCell--idle",$&&!W?c!=null&&c.mine?"skillsCell--meTrail":"skillsCell--botTrail":"",r?"skillsCell--disabled":""].join(" "),style:{width:C,height:C},children:[F,W&&a.jsx("span",{className:"skillsCellIndex",children:H+1}),$&&!W&&a.jsx("span",{className:"skillsCellIndex skillsCellIndex--bot",children:G+1})]},`${S}-${D}`)}))}),o&&a.jsxs("span",{className:["skillsPointsBubble",o.points>=25?"skillsPointsBubble--big":""].join(" "),style:{left:`${(o.col+.5)/p*100}%`,top:`${(o.row+.5)/u*100}%`},children:["+",o.points]},o.nonce)]},i?`wrap-${i}`:"wrap")}function lAe({letters:e,foundWords:t,onSubmit:r,disabled:n,myScore:s=0}){const[o,i]=l.useState(""),[c,u]=l.useState([]),[p,d]=l.useState(null),[f,m]=l.useState(!1);l.useRef(null);const h=l.useMemo(()=>{const x=new Map;for(const v of e)x.set(v,(x.get(v)||0)+1);return x},[e]);l.useCallback(x=>{const v=new Map(h);for(const A of c){const _=e[A];v.set(_,(v.get(_)||0)-1)}for(const A of x.toUpperCase()){const _=v.get(A)||0;if(_<=0)return!1;v.set(A,_-1)}return!0},[h,c,e]);const b=x=>{if(n||f)return;if(c.includes(x)){const A=c.indexOf(x);u(c.slice(0,A)),i(_=>_.slice(0,A))}else u([...c,x]),i(A=>A+e[x]);d(null)},g=()=>{u([]),i(""),d(null)},y=async()=>{if(n||f||o.length<3)return;const x=o.toUpperCase();if(t.includes(x)){d("Already found!");return}m(!0),d(null),r(x),g(),m(!1)};return l.useEffect(()=>{const x=v=>{if(n||f)return;if(v.key==="Enter"){y();return}if(v.key==="Backspace"){c.length>0&&(u(_=>_.slice(0,-1)),i(_=>_.slice(0,-1)));return}if(v.key==="Escape"){g();return}const A=v.key.toUpperCase();if(/^[A-Z]$/.test(A)){const _=e.findIndex((w,j)=>w===A&&!c.includes(j));_!==-1&&(u(w=>[...w,_]),i(w=>w+A),d(null))}};return window.addEventListener("keydown",x),()=>window.removeEventListener("keydown",x)},[n,f,e,c]),a.jsxs("div",{className:"anagrams-container",children:[a.jsxs("div",{className:"anagrams-score",children:["Score: ",a.jsx("strong",{children:s})]}),a.jsx("div",{className:"anagrams-letters",children:e.map((x,v)=>a.jsx("button",{className:`anagrams-letter ${c.includes(v)?"selected":""}`,onClick:()=>b(v),disabled:n||f,children:x},v))}),a.jsxs("div",{className:"anagrams-input-area",children:[a.jsx("div",{className:"anagrams-current-word",children:o||a.jsx("span",{className:"placeholder",children:"Tap letters to form a word"})}),p&&a.jsx("div",{className:"anagrams-error",children:p})]}),a.jsxs("div",{className:"anagrams-actions",children:[a.jsx("button",{className:"anagrams-btn clear",onClick:g,disabled:n||f||o.length===0,children:"Clear"}),a.jsx("button",{className:"anagrams-btn submit",onClick:y,disabled:n||f||o.length<3,children:f?"...":"Submit"})]}),t.length>0&&a.jsxs("div",{className:"anagrams-found-words",children:[a.jsxs("div",{className:"found-label",children:["Your words (",t.length,"):"]}),a.jsx("div",{className:"found-list",children:t.map((x,v)=>a.jsx("span",{className:"found-word",children:x},v))})]})]})}function cAe({questions:e,currentQuestionIndex:t,onAnswer:r,myAnswers:n={},disabled:s,myScore:o=0}){const[i,c]=l.useState(null),[u,p]=l.useState(!1),[d,f]=l.useState(!1),[m,h]=l.useState(null),b=e[t],g=n[t]!==void 0&&n[t].isCorrect!==void 0,y=n[t];l.useEffect(()=>{c(null),f(!1),h(null),p(!1)},[t]);const x=async _=>{s||u||g||(c(_),p(!0),r(t,_))};l.useEffect(()=>{const _=n[t];_&&_.isCorrect!==void 0&&(h({isCorrect:_.isCorrect,correctIndex:_.correctIndex??-1}),f(!0),p(!1))},[n,t]);const v=_=>{const w=["trivia-answer"];if(g||d){const j=(y==null?void 0:y.correctIndex)??(m==null?void 0:m.correctIndex),T=(y==null?void 0:y.answer)??i;_===j?w.push("correct"):_===T&&_!==j&&w.push("incorrect")}else i===_&&w.push("selected");return w.join(" ")},A={easy:"#4ade80",medium:"#fbbf24",hard:"#f87171"};return b?a.jsxs("div",{className:"trivia-container",children:[a.jsxs("div",{className:"trivia-score",children:["Score: ",a.jsx("strong",{children:o})]}),a.jsxs("div",{className:"trivia-progress",children:[a.jsxs("span",{className:"progress-text",children:["Question ",t+1," of ",e.length]}),a.jsx("div",{className:"progress-bar",children:a.jsx("div",{className:"progress-fill",style:{width:`${(t+1)/e.length*100}%`}})})]}),a.jsxs("div",{className:"trivia-meta",children:[a.jsx("span",{className:"trivia-category",children:b.category}),a.jsx("span",{className:"trivia-difficulty",style:{color:A[b.difficulty]},children:b.difficulty.toUpperCase()})]}),a.jsx("div",{className:"trivia-question",children:b.question}),a.jsx("div",{className:"trivia-answers",children:b.answers.map((_,w)=>a.jsxs("button",{className:v(w),onClick:()=>x(w),disabled:s||u||g,children:[a.jsx("span",{className:"answer-letter",children:String.fromCharCode(65+w)}),a.jsx("span",{className:"answer-text",children:_}),(g||d)&&a.jsxs("span",{className:"answer-indicator",children:[w===((y==null?void 0:y.correctIndex)??(m==null?void 0:m.correctIndex))&&"✓",w===((y==null?void 0:y.answer)??i)&&w!==((y==null?void 0:y.correctIndex)??(m==null?void 0:m.correctIndex))&&"✗"]})]},w))}),(d||g)&&a.jsx("div",{className:`trivia-feedback ${(y==null?void 0:y.isCorrect)??(m==null?void 0:m.isCorrect)?"correct":"incorrect"}`,children:(y==null?void 0:y.isCorrect)??(m==null?void 0:m.isCorrect)?"✓ Correct!":"✗ Wrong answer"}),a.jsx("style",{children:xT})]}):a.jsxs("div",{className:"trivia-container",children:[a.jsxs("div",{className:"trivia-complete",children:[a.jsx("h2",{children:"🎉 Quiz Complete!"}),a.jsx("p",{children:"Waiting for final results..."})]}),a.jsx("style",{children:xT})]})}const xT=`
    .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); }
    }
`,uAe={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:"🧠"}]},dAe=[{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 pAe({open:e,onClose:t,gameMode:r="wordsearch"}){const[n,s]=l.useState(0),o=[...uAe[r],...dAe],i=o.length,c=l.useCallback(()=>{Va.set({key:`skillsOnboarding_${r}`,value:"1"}),s(0),t()},[t,r]),u=l.useCallback(()=>{n<i-1?s(h=>h+1):c()},[n,i,c]),p=l.useCallback(()=>{n>0&&s(h=>h-1)},[n]);if(l.useEffect(()=>{e&&s(0)},[e]),l.useEffect(()=>{if(!e)return;const h=b=>{b.key==="Escape"&&c(),(b.key==="ArrowRight"||b.key==="Enter")&&u(),b.key==="ArrowLeft"&&p()};return window.addEventListener("keydown",h),()=>window.removeEventListener("keydown",h)},[e,c,u,p]),l.useEffect(()=>{if(e)try{(()=>{var b,g,y;return!!(window.__E2E===!0||(g=(b=window.location)==null?void 0:b.search)!=null&&g.includes("e2e=1")||((y=window.sessionStorage)==null?void 0:y.getItem("e2e"))==="1")})()&&(Va.set({key:`skillsOnboarding_${r}`,value:"1"}),setTimeout(()=>t(),0))}catch{}},[e,t,r]),!e)return null;const d=o[n],f=n===i-1,m=r==="wordsearch"?"Word Search":r==="anagrams"?"Anagrams":"Trivia";return a.jsxs("div",{className:"skills-onb-modal",role:"dialog","aria-modal":"true","aria-label":`How to play ${m}`,children:[a.jsx("div",{className:"skills-onb-backdrop",onClick:c}),a.jsxs("div",{className:"skills-onb-card",onClick:h=>h.stopPropagation(),children:[a.jsx("button",{className:"skills-onb-close",onClick:c,"aria-label":"Close",children:a.jsx("svg",{width:"24",height:"24",viewBox:"0 0 24 24",fill:"none",stroke:"currentColor",strokeWidth:"2",children:a.jsx("path",{d:"M18 6L6 18M6 6l12 12",strokeLinecap:"round",strokeLinejoin:"round"})})}),a.jsxs("header",{className:"skills-onb-header",children:[a.jsx("span",{className:"skills-onb-badge",children:m}),a.jsx("h2",{className:"skills-onb-title",children:"How to Play"})]}),a.jsxs("div",{className:"skills-onb-content",children:[a.jsx("div",{className:"skills-onb-icon","aria-hidden":"true",children:d.icon}),a.jsx("h3",{className:"skills-onb-step-title",children:d.title}),a.jsx("p",{className:"skills-onb-step-desc",children:d.description})]}),a.jsx("div",{className:"skills-onb-dots","aria-label":`Step ${n+1} of ${i}`,children:o.map((h,b)=>a.jsx("button",{className:`skills-onb-dot ${b===n?"active":""}`,onClick:()=>s(b),"aria-label":`Go to step ${b+1}`},b))}),a.jsxs("div",{className:"skills-onb-actions",children:[n>0&&a.jsx("button",{className:"skills-onb-btn skills-onb-btn--ghost",onClick:p,children:"Back"}),a.jsx("button",{className:"skills-onb-btn skills-onb-btn--primary",onClick:u,children:f?"Let's Play!":"Next"})]})]})]})}function fAe(e){const[t,r]=l.useState(!1),[n,s]=l.useState(!1);l.useEffect(()=>{(async()=>{try{const{value:i}=await Va.get({key:`skillsOnboarding_${e}`});r(i!=="1")}catch{r(!0)}s(!0)})()},[e]);const o=l.useCallback(()=>{r(!1)},[]);return{showOnboarding:n&&t,closeOnboarding:o}}const mAe=[50,100,250,500],hAe=[30,60,90];function AT(e,t=8,r=8){let n=2166136261;for(const c of e)n=(n^c.charCodeAt(0))*16777619;const s=()=>((n=Math.imul(n^n>>>13,1274126177))>>>0)/2**32,o="EEEEAAAAIIONNRRTTLLSSUU DD GBCMP FHVWY KJX QZ".replace(/\s/g,""),i=()=>o[Math.floor(s()*o.length)]||"E";return Array.from({length:t},()=>Array.from({length:r},()=>i()))}const Mz=["Toy Box","Cowboys","Surfers","Speed Demons","Beach Club","Rookies","Wave Riders","Regulars","High Rollers"],Vi=5,kT=Mz.length;function Lz({level:e,levelName:t,winStreak:r,variant:n="expanded",previousWinStreak:s}){const o=Math.max(1,Math.min(kT,Math.floor(e||1))),i=o>=kT,c=t??Mz[o-1],u=Math.max(0,r)%Vi,p=r>0&&u===0?Vi:u,d=i?100:p/Vi*100,[f,m]=l.useState(()=>{if(s===void 0)return d;const b=Math.max(0,s)%Vi,g=s>0&&b===0?Vi:b;return i?100:g/Vi*100}),h=l.useRef(!0);return l.useEffect(()=>{if(h.current&&s!==void 0){h.current=!1;const b=requestAnimationFrame(()=>m(d));return()=>cancelAnimationFrame(b)}m(d)},[d,s]),a.jsxs("div",{className:`skillsLevelBadge skillsLevelBadge--${n}`,children:[a.jsxs("div",{className:"skillsLevelBadge__row",children:[a.jsxs("div",{className:"skillsLevelBadge__chip",children:[a.jsx("span",{className:"skillsLevelBadge__chipLv",children:"LV"}),a.jsx("span",{className:"skillsLevelBadge__chipNum",children:o})]}),a.jsxs("div",{className:"skillsLevelBadge__nameCol",children:[a.jsx("span",{className:"skillsLevelBadge__name",children:c}),i?a.jsx("span",{className:"skillsLevelBadge__sub skillsLevelBadge__sub--max",children:"⭐ Max league"}):a.jsxs("span",{className:"skillsLevelBadge__sub",children:[p," / ",Vi," wins to next league"]})]})]}),a.jsx("div",{className:`skillsLevelBadge__bar${i?" skillsLevelBadge__bar--max":""}`,role:"progressbar","aria-valuemin":0,"aria-valuemax":Vi,"aria-valuenow":i?Vi:p,"aria-label":`Level ${o} ${c} progress`,children:a.jsx("div",{className:"skillsLevelBadge__barFill",style:{width:`${f}%`}})})]})}function gAe({challenge:e}){const t=Math.min(100,Math.round(e.progress/e.goal*100));return a.jsxs("div",{className:["skillsDailyChallenge",e.completed?"skillsDailyChallenge--done":""].join(" "),children:[a.jsxs("div",{className:"skillsDailyChallenge__head",children:[a.jsx("span",{className:"skillsDailyChallenge__tag",children:"Daily Challenge"}),e.completed?a.jsx("span",{className:"skillsDailyChallenge__check",children:"✓ Done!"}):a.jsxs("span",{className:"skillsDailyChallenge__progress",children:[e.progress,"/",e.goal]})]}),a.jsx("div",{className:"skillsDailyChallenge__label",children:e.label}),a.jsx("div",{className:"skillsDailyChallenge__bar",children:a.jsx("div",{className:"skillsDailyChallenge__barFill",style:{width:`${t}%`}})})]})}const yAe=3e3;function bAe({isMultiplayer:e,activeGameMode:t,selectedStake:r,setSelectedStake:n,selectedDuration:s,setSelectedDuration:o,myBalance:i,stakeError:c,hasStarted:u,onStart:p,onShowHelp:d,isAuthenticated:f=!0,onLogin:m,isAdEnabled:h=!1,roomStake:b,roomDuration:g,spLevel:y,spLevelName:x,winStreak:v=0,dailyChallenge:A}){const _=h&&e,[w,j]=l.useState(_);l.useEffect(()=>{if(!_){j(!1);return}const R=setTimeout(()=>j(!1),yAe);return()=>clearTimeout(R)},[_]);const T=async R=>{o(R);try{const{Preferences:P}=await Cr(async()=>{const{Preferences:k}=await Promise.resolve().then(()=>Do);return{Preferences:k}},void 0,import.meta.url);await P.set({key:"selectedSkillsDuration",value:String(R)})}catch{}};return a.jsxs("div",{className:"skillsStartContainer",children:[a.jsxs("div",{className:"skillsStartScrollable",children:[a.jsx("h2",{className:"skillsStartTitle",children:e?"Skills Lounge":t==="anagrams"?"Anagram Challenge":t==="trivia"?"Trivia Challenge":"Word Search Challenge"}),a.jsx("p",{className:"skillsStartDesc",children:e?"Click Ready when ready to play!":"Choose your entry fee!"}),f&&typeof y=="number"&&a.jsx(Lz,{level:y,levelName:x,winStreak:v,variant:"expanded"}),A&&a.jsx(gAe,{challenge:A}),e&&(typeof b=="number"||typeof g=="number")&&a.jsxs("div",{className:"skillsRoomInfo",children:[a.jsx("p",{className:"skillsRoomInfoTitle",children:"Room Settings"}),a.jsxs("div",{className:"skillsRoomInfoDetails",children:[typeof b=="number"&&a.jsxs("span",{className:"skillsRoomInfoItem",children:["💰 ",b===0?"Free Play":`${b.toLocaleString()} Credits`]}),typeof g=="number"&&a.jsxs("span",{className:"skillsRoomInfoItem",children:["⏱️ ",g," seconds"]}),typeof b=="number"&&b>0&&a.jsxs("span",{className:"skillsRoomInfoItem skillsRoomInfoWin",children:["🏆 Win: ",Math.floor(b*2*.9).toLocaleString()]})]}),typeof b=="number"&&b>i&&a.jsxs("p",{className:"skillsRoomInfoWarning",children:["⚠️ You need ",b.toLocaleString()," credits to play"]})]}),!f&&m&&a.jsxs("div",{className:"promo-banner",role:"region","aria-label":"Sign in banner",children:[a.jsx("div",{className:"promo-banner__content",children:a.jsx("span",{className:"promo-banner__title",children:"Sign in from home to save progress"})}),a.jsx("button",{className:"btn gold-fill",onClick:m,"aria-label":"Go to home",children:"Go Home"})]}),a.jsx("button",{className:"skillsHowToPlay",onClick:d,"aria-label":"How to play",children:"❓ How to Play"}),!e&&a.jsxs("div",{className:"skillsStakeSelector",children:[a.jsx("p",{className:"skillsStakeLabel",children:"Entry Fee:"}),a.jsx("div",{className:"skillsStakeOptions",children:mAe.map(R=>a.jsx("button",{className:`skillsStakeBtn ${r===R?"selected":""} ${i<R?"disabled":""}`,onClick:()=>n(R),disabled:i<R,children:R},R))}),a.jsxs("p",{className:"skillsStakePot",children:["Win: ",a.jsx("span",{className:"skillsStakeWin",children:Math.floor(r*2*.9)})," credits"]})]}),!e&&a.jsxs("div",{className:"skillsDurationSelector",children:[a.jsx("p",{className:"skillsDurationLabel",children:"Game Duration:"}),a.jsx("div",{className:"skillsDurationOptions",children:hAe.map(R=>a.jsxs("button",{className:`skillsDurationBtn ${s===R?"selected":""}`,onClick:()=>T(R),children:[R,"s"]},R))})]}),c&&a.jsx("p",{className:"skillsStakeError",children:c})]}),a.jsx("div",{className:"home-cta buttonRow",children:a.jsx("div",{className:"skillsStartButtonFixed",children:a.jsx("button",{id:"btn-play-game",className:"btn gold-fill skillsStartBtn",onClick:p,disabled:w||u||!e&&i<r,style:w?{opacity:.5,pointerEvents:"none"}:void 0,children:e?"Ready Up":`Play for ${r} Credits`})})})]})}const vAe=3e3,_Ae=0,Sd=new Map,qf=new Map;async function wAe(e){var r,n,s,o,i,c,u;const t=encodeURIComponent(e);try{const p=await fetch(`https://api.dictionaryapi.dev/api/v2/entries/en/${t}`);if(p.ok){const d=await p.json(),f=(n=(r=d==null?void 0:d[0])==null?void 0:r.meanings)==null?void 0:n[0],m=(o=(s=f==null?void 0:f.definitions)==null?void 0:s[0])==null?void 0:o.definition;if(m)return{definition:m,partOfSpeech:f==null?void 0:f.partOfSpeech}}}catch{}try{const p=await fetch(`https://en.wiktionary.org/api/rest_v1/page/definition/${t}`);if(p.ok){const d=await p.json(),f=(d==null?void 0:d.en)??Object.values(d??{})[0],m=f==null?void 0:f[0],h=(c=(i=m==null?void 0:m.definitions)==null?void 0:i[0])==null?void 0:c.definition;if(h)return{definition:h.replace(/<[^>]+>/g,""),partOfSpeech:(u=m==null?void 0:m.partOfSpeech)==null?void 0:u.toLowerCase()}}}catch{}throw new Error("no definition found")}function xAe(e,t){const r=e.toLowerCase();if(Sd.has(r))return;Sd.set(r,"loading");const n=new Set;qf.set(r,n),n.add(t),wAe(r).then(s=>Sd.set(r,s)).catch(()=>Sd.set(r,"error")).finally(()=>{var s;(s=qf.get(r))==null||s.forEach(o=>o()),qf.delete(r)})}function ST({word:e,points:t,isValid:r}){const[n,s]=l.useState(!1),[,o]=l.useState(0),i=l.useRef(null),c=l.useRef(null),u=e.toLowerCase();l.useEffect(()=>{var b;const h=()=>o(g=>g+1);return(b=qf.get(u))==null||b.add(h),()=>{var g;(g=qf.get(u))==null||g.delete(h)}},[u]);const p=l.useCallback(()=>{if(n){s(!1);return}s(!0),Sd.has(u)||xAe(u,()=>o(h=>h+1))},[n,u]),d=l.useCallback(h=>{(h.key==="Enter"||h.key===" ")&&(h.preventDefault(),p())},[p]);l.useEffect(()=>{if(!n||!i.current||!c.current)return;const h=i.current.getBoundingClientRect(),b=c.current,g=b.getBoundingClientRect();let y=h.left+h.width/2-g.width/2,x=h.top-g.height-10;y=Math.max(8,Math.min(y,window.innerWidth-g.width-8)),x<8&&(x=h.bottom+10),b.style.left=`${y}px`,b.style.top=`${x}px`}),l.useEffect(()=>{if(!n)return;const h=b=>{i.current&&!i.current.contains(b.target)&&s(!1)};return document.addEventListener("pointerdown",h,!0),()=>document.removeEventListener("pointerdown",h,!0)},[n]);const f=r?"roundSummaryWord roundSummaryWordValid":"roundSummaryWord roundSummaryWordInvalid",m=Sd.get(u)??null;return a.jsxs("span",{ref:i,className:`${f} wordDefWrapper`,onClick:p,onKeyDown:d,role:"button",tabIndex:0,children:[e," ",a.jsxs("small",{children:["(",t,")"]}),n&&a.jsxs("span",{ref:c,className:"wordDefTooltip",children:[m==="loading"&&a.jsx("em",{children:"Loading…"}),m==="error"&&a.jsx("em",{children:"Definition not available"}),m&&typeof m=="object"&&a.jsxs(a.Fragment,{children:[m.partOfSpeech&&a.jsx("strong",{className:"wordDefPos",children:m.partOfSpeech}),a.jsx("span",{className:"wordDefText",children:m.definition})]})]})]})}function AAe({myScore:e,players:t,scores:r,winnerId:n,iWon:s,isDraw:o,winnings:i,selectedStake:c,isMultiplayer:u,meId:p,roundSummary:d,winStreak:f,isAdEnabled:m=!1,spLevel:h,spLevelName:b,onPlayAgain:g}){var C,I;const y=s?f:0,x=l.useRef(s?Math.max(0,f-1):y),v=m?vAe:_Ae,[A,_]=l.useState(v>0);l.useEffect(()=>{if(v<=0){_(!1);return}const L=setTimeout(()=>_(!1),v);return()=>clearTimeout(L)},[v]);const w=(d==null?void 0:d.playerWords)&&Object.keys(d.playerWords).length>0||(d==null?void 0:d.rejectedWords)&&Object.keys(d.rejectedWords).length>0,j=(d==null?void 0:d.playerAnswers)&&(d==null?void 0:d.questions)&&Object.keys(d.playerAnswers).length>0,T=L=>{if(L===p)return"You";const N=t.find(S=>S.id===L);return(N==null?void 0:N.name)||"Bot"},R=[...t].sort((L,N)=>L.id===p?-1:N.id===p?1:(r[N.id]??0)-(r[L.id]??0)),P=n?T(n):void 0,k=[];s&&k.push({label:"Round Won",value:"+1 XP"}),s&&f>=2&&k.push({label:`🔥 ${f}-win streak`,value:"streak alive"});let E=null;if(p&&((I=(C=d==null?void 0:d.playerWords)==null?void 0:C[p])!=null&&I.length))for(const L of d.playerWords[p])(!E||L.points>E.points)&&(E=L);E&&k.push({label:`Best word: ${E.word}`,value:`+${E.points} pts`});const M=s&&f>0&&f%5===0;return a.jsxs("div",{className:"roundEnd",children:[typeof h=="number"&&a.jsx(Lz,{level:h,levelName:b,winStreak:y,previousWinStreak:x.current,variant:"compact"}),a.jsxs("div",{className:"roundEndRow",style:{flexWrap:"wrap",gap:"0.25rem 0.75rem"},children:[R.map(L=>a.jsxs("span",{className:"roundEndScore",style:L.id===n?{color:"var(--gold, #f5c542)"}:void 0,children:[T(L.id),": ",a.jsx("strong",{children:r[L.id]??0})]},L.id)),a.jsxs("span",{className:"roundEndResult",children:[s?"🏆 You Win!":o?"🤝 Draw":`😔 ${P??"Opponent"} Wins`,s&&i>0&&a.jsxs("span",{className:"roundEndWinnings",children:["+",i.toLocaleString()]}),!s&&!o&&a.jsxs("span",{className:"roundEndLoss",children:["-",c]})]}),s&&f>=2&&a.jsxs("div",{className:"roundEndStreak",children:[a.jsx("span",{className:"roundEndStreakFire",children:"🔥"}),a.jsx("span",{className:"roundEndStreakCount",children:f}),a.jsx("span",{className:"roundEndStreakLabel",children:"Win Streak!"})]})]}),k.length>0&&a.jsxs("div",{className:["skillsXpBreakdown",M?"skillsXpBreakdown--levelup":""].join(" "),children:[M&&a.jsx("div",{className:"skillsXpBreakdown__title",children:"✨ LEAGUE UP! ✨"}),k.map((L,N)=>a.jsxs("div",{className:"skillsXpBreakdown__row",children:[a.jsx("span",{className:"skillsXpBreakdown__label",children:L.label}),a.jsx("span",{className:"skillsXpBreakdown__value",children:L.value})]},N))]}),a.jsx("div",{className:"home-cta buttonRow",children:a.jsx("button",{id:"btn-play-again",className:"btn gold-fill cta-btn primaryButton",onClick:g,disabled:A,style:A?{opacity:.5,pointerEvents:"none"}:void 0,children:u?"Ready Up":"Play Again"})}),w&&a.jsxs("div",{className:"roundSummaryScrollable",children:[a.jsx("p",{className:"roundSummaryTitle",children:"Words Found"}),(()=>{const L=new Set([...Object.keys((d==null?void 0:d.playerWords)||{}),...Object.keys((d==null?void 0:d.rejectedWords)||{})]);return Array.from(L).map(N=>{var H,W;const S=T(N),F=((H=d==null?void 0:d.playerWords)==null?void 0:H[N])||[],D=((W=d==null?void 0:d.rejectedWords)==null?void 0:W[N])||[];return a.jsxs("div",{className:"roundSummaryPlayer",children:[a.jsxs("span",{className:"roundSummaryLabel",children:[S,":"]}),a.jsxs("div",{className:"roundSummaryWordsList",children:[F.length>0?F.map((G,$)=>a.jsx(ST,{word:G.word,points:G.points,isValid:!0},$)):!D.length&&a.jsx("span",{className:"roundSummaryNone",children:"No words"}),D.length>0&&D.map((G,$)=>a.jsx(ST,{word:G,points:0,isValid:!1},`rej-${$}`))]})]},N)})})()]}),j&&a.jsxs("div",{className:"roundSummaryScrollable",children:[a.jsx("p",{className:"roundSummaryTitle",children:"Answers"}),Object.entries(d.playerAnswers).map(([L,N])=>{const S=T(L);return a.jsxs("div",{className:"roundSummaryPlayer",children:[a.jsxs("span",{className:"roundSummaryLabel",children:[S,":"]}),a.jsx("div",{className:"roundSummaryAnswersList",children:N.length>0?N.map((F,D)=>a.jsxs("span",{className:`roundSummaryAnswer ${F.correct?"roundSummaryAnswerCorrect":"roundSummaryAnswerWrong"}`,children:["Q",F.questionIndex+1,": ",F.correct?"✓":"✗"]},D)):a.jsx("span",{className:"roundSummaryNone",children:"No answers"})})]},L)})]})]})}function kAe({countdown:e}){return a.jsx("div",{className:"skillsCountdownOverlay",children:a.jsx("div",{className:"skillsCountdownNumber",children:e})})}function SAe({readyCount:e,totalPlayers:t}){return a.jsxs("div",{className:"skillsWaitingContainer",children:[a.jsx("div",{className:"skillsWaitingSpinner"}),a.jsxs("p",{className:"skillsWaitingText",children:["Waiting for players... (",e,"/",t," ready)"]})]})}function EAe({message:e}){return a.jsx("div",{className:"skillsInvalidWord",children:a.jsx("span",{className:"skillsInvalidWordText",children:e})})}function PAe({onRetry:e}){return a.jsx("div",{className:"card alertCard",role:"alert",children:a.jsxs("div",{className:"alertRow",children:[a.jsx("span",{className:"alertText",children:"⚠️ Connection lost. Reconnecting…"}),a.jsx("button",{className:"btn btn-secondary alertBtn",onClick:e,children:"Retry"})]})})}function CAe(e){const{meId:t,setConnected:r,setScores:n,setRoundEnded:s,setWinnerId:o,setPlayers:i,setGameState:c,setHasStarted:u,setWinnings:p,setWinStreak:d,setRoundSummary:f,setMyAnagramWords:m,setClaimedWordPaths:h,setMyTriviaAnswers:b,setCurrentTriviaQuestion:g,setCountdown:y,isMultiplayer:x,roundEnded:v,endRef:A,onWordClaimed:_}=e,{setSession:w}=Zw(),{win:j,lose:T}=As(),{onHandEnd:R}=bu(),P=l.useCallback(k=>{const E=new Set;return k.filter(M=>!(M!=null&&M.id)||E.has(M.id)?!1:(E.add(M.id),!0))},[]);Ba({onSkillsRejoinedRoom:k=>{var E,M;if(k!=null&&k.room){if(console.log("[skills] rejoined room via server reconnect",{roomId:k.room.id,phase:(E=k.room.gameState)==null?void 0:E.phase,playerCount:(M=k.room.players)==null?void 0:M.length}),k.room.players){const C=P(k.room.players);i(C)}k.room.gameState&&(c(k.room.gameState),k.room.gameState.scores&&n(k.room.gameState.scores)),r(!0)}},onPlayerPresenceUpdate:k=>{if(!k)return;const{playerId:E,status:M}=k;!E||!M||E===t&&r(M==="active")},onSkillsSessionInfo:k=>{w({roomId:k.roomId,seed:k.seed,startAt:k.startAt,endAt:k.endAt,driftMs:k.driftMs,gameMode:k.gameMode||"wordsearch",letters:k.letters,questions:k.questions}),h([]),m([]),g(0),b({})},onAnagramsWordFound:k=>{k.playerId===t&&m(E=>[...E,k.word])},onTriviaAnswer:k=>{k.playerId===t&&b(E=>({...E,[k.questionIndex]:{answer:k.questionIndex,isCorrect:k.isCorrect,correctIndex:k.correctIndex}}))},onTriviaNextQuestion:k=>{g(k.questionIndex)},onRoomUpdateState:k=>{var F,D,H,W,G,$,K,de,ie,we,he,Ae,Fe;const E=new Set(["skills","wordsearch","anagrams","trivia"]),M=((F=k.room)==null?void 0:F.gameMode)||((D=k.gameState)==null?void 0:D.gameMode)||((W=(H=k.room)==null?void 0:H.gameState)==null?void 0:W.gameMode);if(!M||!E.has(M))return;const C=((G=k.room)==null?void 0:G.players)||[],I=P(C);I.length>0&&i(U=>{const V=new Map;return U.forEach(z=>{typeof z.balance=="number"&&V.set(z.id,z.balance)}),I.map(z=>{if(typeof z.balance=="number")return z;const O=V.get(z.id);return typeof O=="number"?{...z,balance:O}:z})});const L=k.gameState||{};c(L),L.phase==="playing"&&L.seed&&!Zw.getState().seed&&(console.log("[SkillsSocketListeners] Recovering session from room:update_state",{seed:L.seed,gameMode:L.gameMode}),w({roomId:($=k.room)==null?void 0:$.id,seed:L.seed,startAt:L.startAt,endAt:L.endAt,gameMode:L.gameMode,letters:(K=L.anagramsData)==null?void 0:K.letters,questions:(ie=(de=L.triviaData)==null?void 0:de.questions)==null?void 0:ie.map(U=>({id:U.id,question:U.question,answers:U.answers,category:U.category,difficulty:U.difficulty}))}));const N=(we=k.gameState)==null?void 0:we.phase,S=((Ae=(he=k.gameState)==null?void 0:he.readyMap)==null?void 0:Ae[t||""])||!1;N==="waiting"&&!v&&(o(void 0),p(0),S||u(!1),n({}),f(null),h([]),m([]),b({}),g(0)),N!=="playing"&&!v&&((Fe=k.gameState)!=null&&Fe.scores)&&n(k.gameState.scores)},onSkillsRoundStart:k=>{n({}),s(!1),o(void 0),f(null),h([]),m([]),b({}),g(0),w({roomId:k.roomId,seed:k.seed,startAt:k.startAt,endAt:k.endAt}),x&&(u(!0),y(3))},onSkillsScoreUpdate:k=>{k.scores&&n(k.scores)},onSkillsRoundEnd:k=>{if(s(!0),k.scores&&n(k.scores),k.winnerId)if(o(k.winnerId),k.winnerId===t){p0();const E=typeof k.winnings=="number"?k.winnings:0;j("Winner!",E>0?`+Z$${E.toLocaleString()}`:void 0)}else f0(),T("Better Luck Next Time");typeof k.winnings=="number"&&p(k.winnings),d(typeof k.winnerStreak=="number"?k.winnerStreak:0),f({playerWords:k.playerWords,rejectedWords:k.rejectedWords,playerAnswers:k.playerAnswers,questions:k.questions}),A.current=Date.now(),R()},onPlayerBalanceUpdated:({playerId:k,balance:E})=>{i(M=>{if(!Array.isArray(M))return M;const C=M.findIndex(N=>String(N.id)===String(k));if(C===-1)return M;const I=M.slice(),L=I[C];return typeof(L==null?void 0:L.balance)=="number"&&L.balance===E?M:(I[C]={...L,balance:E},I)})},onOtherPlayerJoined:k=>{var L,N,S,F,D;if(!((L=k==null?void 0:k.room)!=null&&L.players))return;const E=new Set(["skills","wordsearch","anagrams","trivia"]),M=((N=k.room)==null?void 0:N.gameMode)||((S=k.gameState)==null?void 0:S.gameMode)||((D=(F=k.room)==null?void 0:F.gameState)==null?void 0:D.gameMode);if(!M||!E.has(M))return;const C=k.room.players||[],I=P(C);i(I)},onOtherLeft:k=>{var L,N,S,F,D;if(!((L=k==null?void 0:k.room)!=null&&L.players))return;const E=new Set(["skills","wordsearch","anagrams","trivia"]),M=((N=k.room)==null?void 0:N.gameMode)||((S=k.gameState)==null?void 0:S.gameMode)||((D=(F=k.room)==null?void 0:F.gameState)==null?void 0:D.gameMode);if(!M||!E.has(M))return;const C=k.room.players||[],I=P(C);i(I),k.gameState&&c(k.gameState)},onSkillsWordClaimed:k=>{_==null||_(k)}})}const Kw="skills:dailyChallenge:";function Dz(){const e=new Date,t=e.getUTCFullYear(),r=String(e.getUTCMonth()+1).padStart(2,"0"),n=String(e.getUTCDate()).padStart(2,"0");return`${t}-${r}-${n}`}function RAe(){const e=new Date,t=Date.UTC(e.getUTCFullYear(),0,0),r=Date.UTC(e.getUTCFullYear(),e.getUTCMonth(),e.getUTCDate());return Math.floor((r-t)/864e5)}const ET=[{kind:"find_long_word",label:"Find a 6-letter word",goal:1},{kind:"win_round",label:"Win a Skills round",goal:1},{kind:"score_100",label:"Score 100+ in a round",goal:1}];function TAe(){return ET[RAe()%ET.length]}function PT(){const e=Dz(),t=`${Kw}${e}`;try{const n=localStorage.getItem(t);if(n){const s=JSON.parse(n);if(s&&s.dateKey===e)return s}for(let s=0;s<localStorage.length;s++){const o=localStorage.key(s);if(o&&o.startsWith(Kw)&&o!==t)try{localStorage.removeItem(o)}catch{}}}catch{}return{...TAe(),progress:0,completed:!1,dateKey:e}}function jAe(e){try{localStorage.setItem(`${Kw}${e.dateKey}`,JSON.stringify(e))}catch{}}function IAe(){const[e,t]=l.useState(()=>PT()),r=l.useRef(e);l.useEffect(()=>{r.current=e},[e]),l.useEffect(()=>{const i=window.setInterval(()=>{if(r.current.dateKey!==Dz()){const c=PT();t(c)}},6e4);return()=>window.clearInterval(i)},[]);const n=l.useCallback(i=>{t(c=>{if(c.completed)return c;const u=i(c);if(u===c)return c;const p=Math.min(u.goal,Math.max(c.progress,u.progress)),d=p>=u.goal,f={...u,progress:p,completed:d};return jAe(f),f})},[]),s=l.useCallback(i=>{n(c=>c.kind==="win_round"&&i.iWon?{...c,progress:c.progress+1}:c.kind==="score_100"&&i.myScore>=100?{...c,progress:c.progress+1}:c)},[n]),o=l.useCallback(i=>{n(c=>c.kind==="find_long_word"&&i.length>=6?{...c,progress:c.progress+1}:c)},[n]);return{challenge:e,recordRoundResult:s,recordWord:o}}let NAe=!1;function CT(e,t){try{NAe||fx()}catch{}}const MAe=new Set(["room.ready","tapAck","score","roundEnd"]),RT=512,LAe=50;let Rl=null,Oz=1;const Pc=new Set;let Qw=0;function Bb(){return Rl||(Rl=xf(Wf||"",{path:"/socket.io",transports:["websocket","polling"],autoConnect:!1,reconnection:!0,reconnectionAttempts:1/0,reconnectionDelayMax:1e4,auth:{platform:"web"}}),Rl)}async function zz(){const e=Bb();let t;try{t=await Jn()}catch{t=void 0}if(!t){if(e.auth={platform:"web"},e.connected)try{e.disconnect()}catch{}return}e.auth={...e.auth||{},platform:"web",token:t},e.connected||e.connect()}function DAe(){if(Rl){try{Rl.removeAllListeners()}catch{}try{Rl.disconnect()}catch{}Rl=null}Oz=1,Pc.clear(),Qw=0}function OAe(e){const t=Bb(),r=(n,s)=>{MAe.has(n)&&e({type:n,payload:s})};return t.on("message",r),()=>{t.off("message",r)}}function zAe(e){const t=Bb();if(e.type==="tap"){const r=Date.now();if(r-Qw<LAe)return"throttled";Qw=r}if(e.type==="tap"||e.type==="submit"){if(Pc.has(e.payload.seq))return"duplicate";if(Pc.add(e.payload.seq),Pc.size>RT){const r=Pc.size-RT,n=Pc.values();for(let s=0;s<r;s++){const o=n.next().value;if(o===void 0)break;Pc.delete(o)}}}return t.connected?(t.emit("message",e.type,e.payload),"sent"):"disconnected"}function Bz(){return Oz++}function BAe(e,t){return e-t}const FAe=Object.freeze(Object.defineProperty({__proto__:null,computeDrift:BAe,connectSocket:zz,disconnectSocket:DAe,getSocket:Bb,nextSeq:Bz,onMessage:OAe,send:zAe},Symbol.toStringTag,{value:"Module"}));function UAe(){return Wf}const TT=UAe();async function qAe(){if(!TT)return null;try{let e;try{e=await Jn()}catch{}const t={Accept:"application/json"};e&&(t.Authorization=`Bearer ${e}`);const r=await fetch(`${TT}/api/auth/me`,{credentials:"include",headers:t});if(r.ok)return await r.json();if(r.status===204||r.status===401){if(r.status===401&&e)try{await Ql()}catch{}return null}return null}catch{return null}}function VAe({endAt:e,isActive:t,totalSeconds:r=30}){const[n,s]=l.useState(r),o=l.useRef(null);l.useEffect(()=>{if(!t||!e){s(r),o.current&&(cancelAnimationFrame(o.current),o.current=null);return}const d=()=>{const f=Date.now(),m=Math.max(0,Math.ceil((e-f)/1e3));s(m),m>0?o.current=requestAnimationFrame(d):o.current=null};return d(),()=>{o.current&&(cancelAnimationFrame(o.current),o.current=null)}},[e,t,r]);const i=t&&e!==void 0,c=n<=15,u=n<=5,p=n/r*100;return a.jsxs("div",{className:["poker-turn-timer",i?"":"poker-turn-timer--hidden",c?"poker-turn-timer--urgent":"",u?"poker-turn-timer--critical":""].filter(Boolean).join(" "),"aria-live":"polite","aria-atomic":"true",role:"timer","aria-hidden":!i,children:[a.jsxs("div",{className:"poker-turn-timer__ring",children:[a.jsxs("svg",{viewBox:"0 0 36 36",className:"poker-turn-timer__svg",children:[a.jsx("circle",{className:"poker-turn-timer__circle-bg",cx:"18",cy:"18",r:"16"}),a.jsx("circle",{className:"poker-turn-timer__circle-progress",cx:"18",cy:"18",r:"16",strokeDasharray:`${p} 100`})]}),a.jsx("div",{className:"poker-turn-timer__number",children:n})]}),a.jsx("div",{className:"poker-turn-timer__label","aria-hidden":"true",children:"Time Left"})]})}function HAe(e){const{endAt:t,isRoundActive:r,scores:n,meId:s}=e,o=l.useMemo(()=>a.jsx(VAe,{endAt:t,isActive:!!r&&!!t,totalSeconds:30}),[t,r]),i=l.useMemo(()=>{if(!(!n||!r))return c=>{const u=n[c.id]??0,p=c.id===s;return a.jsxs("div",{className:`skills-player-score ${p?"skills-player-score--me":""}`,children:[a.jsx("span",{className:"skills-score-value",children:u}),a.jsx("span",{className:"skills-score-label",children:"pts"})]})}},[n,r,s]);return a.jsx(Lb,{...e,className:"skills-player-panel",hideDiceResults:!0,disableBankerFlash:!0,hideSideBets:!0,headerCommsLeftSlot:o,renderFacesOverride:i})}function qy(){var jt,Yt,Ot;const{roomId:e,seed:t,startAt:r,endAt:n,driftMs:s,setSession:o,set:i,user:c,gameMode:u,letters:p,questions:d}=Zw(),{meId:f,user:m}=Zr(),h=Na(),{cancelAd:b,isAdEnabled:g}=bu(),y=Hr(),x=Db();l.useEffect(()=>(x.acquire(),()=>{x.release()}),[x]);const[v]=gp(),{roomId:A}=hp(),_=A||v.get("roomId"),w=v.get("mode"),j=v.get("e2e")==="1",T=v.get("autoplay")==="1",[R,P]=l.useState(!0),[k,E]=l.useState({}),M=l.useRef(!1),[C,I]=l.useState(!1),[L,N]=l.useState(),[S,F]=l.useState([]),[D,H]=l.useState({}),[W,G]=l.useState(!1),[$,K]=l.useState(null),[de,ie]=l.useState(null),[we,he]=l.useState(null),[Ae,Fe]=l.useState(null),[U,V]=l.useState(0),z=l.useRef(0),O=l.useRef(null);l.useEffect(()=>()=>{O.current&&window.clearTimeout(O.current)},[]);const[q,X]=l.useState(100),[Z,Q]=l.useState(30),[oe,ce]=l.useState(null),[_e,re]=l.useState(0),[pe,ee]=l.useState(0),[xe,Le]=l.useState(0),[Ge,_t]=l.useState(),[Xe,bt]=l.useState(),[Pt,kt]=l.useState(!1),[Ee,le]=l.useState(void 0),[De,Ye]=l.useState(null),{active:Re,fire:et,onComplete:rt}=h1(),{challenge:ne,recordRoundResult:ue,recordWord:B}=IAe(),fe=l.useRef(0),ye=["loss-a","loss-b","loss-c"],ve=()=>{const Pe=ye[fe.current%ye.length];return fe.current+=1,Pe},[ke,Ue]=l.useState(w||"wordsearch"),[ct,dt]=l.useState([]),[Rt,jr]=l.useState(0),[Qe,Mt]=l.useState({}),[lr,zt]=l.useState([]),br=l.useRef(null);l.useRef(null);const fr=l.useRef({});fr.current=k;const ur=l.useRef(null),Ie=l.useRef(null),{skillsSubmit:yt,skillsSingleStart:St,skillsReady:Xt,skillsJoinRoom:se,anagramsSubmit:je,triviaAnswer:Oe}=sa(),{joinRoom:Ke,leaveRoom:Me}=Yo(),wt=l.useRef(Me);wt.current=Me;const at=f||(c==null?void 0:c.id);l.useEffect(()=>{i({seed:null,startAt:null,endAt:null,roomId:null,letters:void 0,questions:void 0}),ur.current=null,Ie.current=null},[]),l.useEffect(()=>{if(!h)return;const Pe=()=>{console.log("[SkillsPlay] socket reconnected — resetting guards"),ur.current=null,Sn.current=!1};return h.on("connect",Pe),()=>{h.off("connect",Pe)}},[h]),l.useEffect(()=>{if(!_)return;const Pe=()=>{console.log("[SkillsPlay] ad:complete — resetting join guard for room",_),ur.current=null};return window.addEventListener("ad:complete",Pe),()=>{window.removeEventListener("ad:complete",Pe)}},[_]),l.useEffect(()=>{if(w){Ue(w);return}(async()=>{try{const{Preferences:Pe}=await Cr(async()=>{const{Preferences:It}=await Promise.resolve().then(()=>Do);return{Preferences:It}},void 0,import.meta.url),{value:ht}=await Pe.get({key:"selectedSkillsGameMode"});(ht==="wordsearch"||ht==="anagrams"||ht==="trivia")&&Ue(ht)}catch{}})()},[w]),l.useEffect(()=>{(async()=>{try{const{Preferences:Pe}=await Cr(async()=>{const{Preferences:Ct}=await Promise.resolve().then(()=>Do);return{Preferences:Ct}},void 0,import.meta.url),{value:ht}=await Pe.get({key:"selectedSkillsDuration"}),It=parseInt(ht||"",10);(It===30||It===60||It===90)&&Q(It)}catch{}})()},[]),l.useEffect(()=>{(async()=>{try{const Pe=await ma();Pe.botDifficultyLevel&&Pe.botDifficultyLevel>=1&&Pe.botDifficultyLevel<=9&&le(Pe.botDifficultyLevel)}catch{}})()},[]);const Dt=(m==null?void 0:m.balance)??0,Ut=!!m,ft=(()=>{try{return(m==null?void 0:m.isGuest)===!0}catch{return!1}})(),wr=!Ut||ft,dr=l.useCallback(()=>y("/lobby"),[y]),Vt=at?k[at]??0:0,Je=S.find(Pe=>Pe.id!==at),mt=Je==null?void 0:Je.id,Te=(Je==null?void 0:Je.name)||"Bot";mt&&k[mt];const Ve=!!_,tt=S.find(Pe=>Pe.id===at);tt!=null&&tt.isReady||(jt=D==null?void 0:D.readyMap)!=null&&jt[at||""];const Et=l.useMemo(()=>{const Pe=new Set;let ht=S.filter(Ct=>!(Ct!=null&&Ct.id)||Pe.has(Ct.id)?!1:(Pe.add(Ct.id),!0)).map(Ct=>Ct.id===at&&typeof Ct.balance!="number"&&typeof(m==null?void 0:m.balance)=="number"?{...Ct,balance:m.balance}:Ct);const It=typeof at=="string"&&at.length>0;return ht.length===0&&It&&m&&(ht=[{id:at,name:m.name||m.email||"You",balance:m.balance??0,avatarUrl:m.avatarUrl??void 0}]),ht},[S,at,m==null?void 0:m.balance,m==null?void 0:m.name,m==null?void 0:m.email,m==null?void 0:m.avatarUrl,m]),Qt=(D==null?void 0:D.everyoneReady)||!1,or=(D==null?void 0:D.phase)||"waiting",Ht=w||(D==null?void 0:D.gameMode)||u||ke,{showOnboarding:Lt,closeOnboarding:nr}=fAe(Ht),Mr=j?"demo-screenshot-seed-12345":null,Br=t||(D==null?void 0:D.seed)||Mr,wn=j?"playing":or,Kt=p||((Yt=D==null?void 0:D.anagramsData)==null?void 0:Yt.letters),Jt=d||((Ot=D==null?void 0:D.triviaData)==null?void 0:Ot.questions),un=wn==="playing"&&!!Br&&!C&&Ht==="wordsearch",Tn=wn==="playing"&&!C&&Ht==="anagrams"&&(((Kt==null?void 0:Kt.length)??0)>0||j),Kr=wn==="playing"&&!C&&Ht==="trivia"&&(((Jt==null?void 0:Jt.length)??0)>0||j),[Er,yr]=l.useState(null),xn=l.useCallback(Pe=>{zt(Ct=>Ct.some(pr=>pr.word===Pe.word)?Ct:[...Ct,{word:Pe.word,playerId:Pe.playerId,path:Pe.path}]);const ht=Pe.playerId===at,It=Array.isArray(Pe.path)&&Pe.path.length>0;if(It&&ht&&T&&yr({path:Pe.path,nonce:Date.now(),mine:!0}),T&&It&&ht){const Ct=Pe.word||"",pr=Math.max(220,Math.min(320,Math.floor(2e3/Pe.path.length))),Pr=Pe.path.length*pr+900,Nr=Pe.path[Pe.path.length-1],Sr=Ct.length*Ct.length;z.current=Math.min(z.current+1,8);const Qr=1+(z.current-1)*.07;window.setTimeout(()=>{he("valid");try{u0({volume:.6,rate:Qr})}catch{}setTimeout(()=>he(null),400),Nr&&(Fe({row:Nr.r,col:Nr.c,points:Sr,nonce:Date.now()}),O.current&&window.clearTimeout(O.current),O.current=window.setTimeout(()=>Fe(null),950)),(Ct.length>=6||z.current>=4)&&V(Date.now())},Pr)}},[at,T]);CAe({meId:at,setConnected:P,setScores:E,setRoundEnded:I,setWinnerId:N,setPlayers:F,setGameState:H,setHasStarted:G,setWinnings:re,setWinStreak:ee,setRoundSummary:Ye,setMyAnagramWords:dt,setClaimedWordPaths:zt,setMyTriviaAnswers:Mt,setCurrentTriviaQuestion:jr,setCountdown:K,onWordClaimed:xn,isMultiplayer:Ve,roundEnded:C,endRef:br}),l.useEffect(()=>{if(C||!at)return;const Pe=k[at]??0,ht=Object.entries(k).filter(([Ct])=>Ct!==at).map(([,Ct])=>Ct),It=Math.max(0,...ht);It>0&&Pe<It&&(M.current=!0)},[k,at,C]),l.useEffect(()=>{if(!C||!L||!at)return;const Pe=L===at;if(Le(Pe?pe:0),ue({iWon:Pe,myScore:k[at]??0}),!Pe){et(ve(),{displayMs:2e3});return}const ht=k[at]??0,It=Object.entries(k).filter(([pr])=>pr!==at).map(([,pr])=>pr),Ct=Math.max(0,...It);Ct===0&&ht>0?et("skills-perfect",{displayMs:3e3}):pe>0&&pe%5===0?et("streak-5",{displayMs:3500}):Ct>0&&ht>=Ct*2?et("skills-dominate",{displayMs:2500}):M.current?et("skills-comeback",{displayMs:3e3}):pe>=3?et("streak-3",{displayMs:2500}):et("big-win",{displayMs:2500}),M.current=!1},[C,L,at,k,pe,et,ue]),l.useEffect(()=>{const Pe=D;(Pe==null?void 0:Pe.phase)==="playing"&&Array.isArray(Pe==null?void 0:Pe.claimedWords)&&Pe.claimedWords.length>0&&zt(Pe.claimedWords)},[D]),l.useEffect(()=>{W||t?Il():C||ob({volume:.0125})},[W,C,t]);const gn=l.useRef(_);l.useEffect(()=>{gn.current!==_&&(Ye(null),I(!1),N(void 0),re(0),E({}),M.current=!1,zt([]),dt([]),jr(0),Mt({}),gn.current=_)},[_]),l.useEffect(()=>{_&&ur.current!==_&&(ur.current=_,se(_).then(async Pe=>{var ht,It;if(Pe!=null&&Pe.ok&&(Pe!=null&&Pe.data)){if(i({roomId:Pe.data.roomId}),(ht=Pe.data.room)!=null&&ht.players){const Ct=Pe.data.room.players,pr=new Set,Pr=Ct.filter(Nr=>!(Nr!=null&&Nr.id)||pr.has(Nr.id)?!1:(pr.add(Nr.id),!0));F(Pr)}if((It=Pe.data.room)!=null&&It.gameState&&H(Pe.data.room.gameState),Ie.current!==_)try{console.log("[SkillsPlay] Joining RTC room:",_),await Ke(_),Ie.current=_,console.log("[SkillsPlay] RTC room joined successfully:",_)}catch(Ct){console.error("[SkillsPlay] Failed to join RTC room:",Ct)}}else ur.current=null}).catch(()=>{ur.current=null}))},[_,se,i,Ke]),l.useEffect(()=>()=>{Ie.current&&(console.log("[SkillsPlay] Leaving RTC room on unmount"),wt.current())},[]),l.useEffect(()=>{fx(),qAe().then(Pe=>i({user:Pe}))},[i]),l.useEffect(()=>{if(!n||C||!W)return;const Pe=()=>{Date.now()+s>=n&&!C&&W&&(console.log("[SkillsPlay] Timer expired locally, triggering round end"),I(!0))};Pe();const ht=n-(Date.now()+s);if(ht>0){const It=setTimeout(Pe,ht+3e3);return()=>clearTimeout(It)}},[n,s,C,W]),l.useEffect(()=>{if(!W)return;let Pe;(async()=>{try{const{App:It}=await Cr(async()=>{const{App:pr}=await Promise.resolve().then(()=>xm);return{App:pr}},void 0,import.meta.url),Ct=await It.addListener("appStateChange",pr=>{if(pr.isActive){const Pr=Date.now()+s;n&&Pr>=n&&!C&&W&&(console.log("[SkillsPlay] App resumed after timer expired, triggering round end"),I(!0))}});Pe=()=>{try{Ct.remove()}catch{}}}catch{}})();const ht=()=>{if(document.visibilityState==="visible"){const It=Date.now()+s;n&&It>=n&&!C&&W&&(console.log("[SkillsPlay] Tab visible after timer expired, triggering round end"),I(!0))}};return document.addEventListener("visibilitychange",ht),()=>{Pe==null||Pe(),document.removeEventListener("visibilitychange",ht)}},[n,s,C,W]);const dn=Date.now()+s,Gr=!!n&&dn<(n??0),Sn=l.useRef(!1),Gn=l.useCallback(async()=>{if(!Sn.current){Sn.current=!0;try{console.log("[SkillsPlay] startGame() called",{selectedStake:q,activeGameMode:Ht,selectedDuration:Z,myBalance:Dt});const Pe=await St(q,Ht,Z,Ee,T);console.log("[SkillsPlay] startGame() result",{ok:Pe==null?void 0:Pe.ok,error:Pe==null?void 0:Pe.error,hasData:!!(Pe!=null&&Pe.data)}),Pe&&!Pe.ok?(console.log("[SkillsPlay] startGame() failed",{error:Pe.error,balance:Pe.balance,stake:Pe.stake}),Sn.current=!1,G(!1),K(null),Pe.error!=="insufficient_balance"&&Pe.error!=="already_starting"&&ce(Pe.error||"Failed to start game")):Pe!=null&&Pe.data?(Sn.current=!1,Pe.data.spLevel&&_t(Pe.data.spLevel),Pe.data.levelName&&bt(Pe.data.levelName),o({...Pe.data,gameMode:Pe.data.gameMode||Ht}),H(ht=>({...ht,phase:"playing",gameMode:Pe.data.gameMode||Ht,stake:Pe.data.stake,pot:Pe.data.pot}))):Sn.current=!1}catch{Sn.current=!1}}},[St,q,Z,Ht,Ee,T]),en=l.useCallback(async()=>{if(ce(null),console.log("[SkillsPlay] handleStart",{activeGameMode:Ht,urlGameMode:w,preferredGameMode:ke,gameMode:u,gameStateMode:D==null?void 0:D.gameMode,isMultiplayer:Ve}),Ve){const Pe=_||e;Pe&&(console.log("[skills:ready] sending immediately on handleStart",{effectiveRoomId:Pe}),b(),G(!0),await Xt(Pe));return}if(console.log("[SkillsPlay] handleStart() balance check",{hasStarted:W,myBalance:Dt,selectedStake:q,passes:Dt>=q}),!W&&Dt<q){console.log("[SkillsPlay] handleStart() CLIENT BALANCE CHECK FAILED",{myBalance:Dt,selectedStake:q}),ce(`Insufficient balance. Need ${q} credits.`);return}console.log("[SkillsPlay] handleStart() starting countdown"),Il(),G(!0),K(3)},[Ve,q,Ht,w,ke,u,D==null?void 0:D.gameMode,Dt,_,e,Xt,b]),Ce=l.useCallback(async()=>{Sn.current=!1,i({seed:null,startAt:null,endAt:null,roomId:null,letters:void 0,questions:void 0}),I(!1),G(!0),K(null),re(0),E({}),M.current=!1,zt([]),N(void 0),Ye(null),dt([]),jr(0),Mt({}),z.current=0,Fe(null),V(0),Ve&&_?(b(),await Xt(_)):(G(!1),F([]),H({}))},[i,Ve,_,Xt,b]),Bn=l.useRef(0);l.useEffect(()=>{T&&(q!==500&&X(500),Z!==90&&Q(90))},[T,q,Z]),l.useEffect(()=>{if(!T||Ve)return;const Pe=()=>{if(W||C||$!==null)return;if(!Ut){console.log("[SkillsPlay autoplay] waiting for auth before starting");return}const Ct=Date.now();Ct-Bn.current<5e3||(Bn.current=Ct,console.log("[SkillsPlay autoplay] kicking countdown",{selectedStake:q,activeGameMode:Ht,selectedDuration:Z,myBalance:Dt}),Il(),G(!0),K(3))},ht=window.setTimeout(Pe,1200),It=window.setInterval(Pe,3e3);return()=>{window.clearTimeout(ht),window.clearInterval(It)}},[T,Ve,W,C,$,Ut,q,Ht,Z,Dt]),l.useEffect(()=>{if(!T||Ve||!C)return;const Pe=window.setTimeout(()=>{Bn.current=0,Ce()},4e3);return()=>window.clearTimeout(Pe)},[T,Ve,C,Ce]),l.useEffect(()=>{if($===null)return;if($>0&&gi({volume:.3}),$===0){gi({volume:.5}),K(null),Ve||Gn();return}const Pe=setTimeout(()=>{K(ht=>ht!==null&&ht>0?ht-1:null)},1e3);return()=>clearTimeout(Pe)},[$,Gn,Ve]);const xr=l.useMemo(()=>t?AT(t):[],[t]),Zn=l.useMemo(()=>lr.filter(Pe=>Pe.playerId===at).map(Pe=>Pe.word),[lr,at]),$n=l.useMemo(()=>lr.filter(Pe=>Pe.playerId!==at).map(Pe=>Pe.word),[lr,at]),Be=l.useCallback(async Pe=>{!Gr||!e||C||Pe.length<3||await je(e,Pe.toUpperCase())},[Gr,e,C,je]),ut=l.useCallback(async(Pe,ht)=>{!Gr||!e||C||(Mt(It=>({...It,[Pe]:{answer:ht,isCorrect:void 0,correctIndex:void 0}})),await Oe(e,Pe,ht))},[Gr,e,C,Oe]),be=async Pe=>{if(!Gr||!e||C||Pe.length<3)return;const ht=Pe.map(({r:pr,c:Pr})=>{var Nr;return((Nr=xr[pr])==null?void 0:Nr[Pr])||""}).join("").toUpperCase();if(ht.length<3)return;const It=Bz();CT("word_submit",{len:Pe.length});const Ct=await yt(e,Pe,ht,Date.now(),It);if(Ct&&Ct.valid){z.current=Math.min(z.current+1,8);const pr=1+(z.current-1)*.07;he("valid"),u0({volume:.4,rate:pr}),setTimeout(()=>he(null),400);const Pr=Pe[Pe.length-1],Nr=typeof Ct.points=="number"?Ct.points:ht.length*ht.length;Pr&&(Fe({row:Pr.r,col:Pr.c,points:Nr,nonce:Date.now()}),O.current&&window.clearTimeout(O.current),O.current=window.setTimeout(()=>Fe(null),950)),(ht.length>=6||z.current>=4)&&V(Date.now()),B(ht)}else Ct&&!Ct.valid&&(z.current=0,he("invalid"),setTimeout(()=>he(null),400),Ct.error==="invalid_word"?ie(`"${ht}" is not a word`):Ct.error==="word_already_used"?ie(`"${ht}" already used`):Ct.error==="word_claimed"?ie(`"${ht}" already taken`):(Ct.error==="path_not_contiguous"||Ct.error==="path_has_duplicates")&&ie("Invalid path"),setTimeout(()=>ie(null),800))},Se=Pe=>{CT()},nt=!un&&!Tn&&!Kr&&!W&&!C,it=W&&!un&&!Tn&&!Kr&&Ve&&!Qt&&!C,Bt=S.filter(Pe=>{var ht;return(ht=D==null?void 0:D.readyMap)==null?void 0:ht[Pe.id]}).length,ir=S.length,er=L===at,mr=!L&&C,hr=l.useMemo(()=>({...D,gameMode:"skills"}),[D]),J=l.useMemo(()=>{var Pr;if(Ve)return;const Pe=Number(Ge??(m==null?void 0:m.spLevelSkills)??1),ht=Number.isFinite(Pe)&&Pe>0?Pe:1,It=Math.max(0,xe)%5,Ct=xe>0&&It===0?5:It,pr=Xe??((Pr=ul.find(Nr=>Nr.level===ht))==null?void 0:Pr.name)??`Level ${ht}`;return{level:ht,levelName:pr,current:Ct,total:5,progressLabel:`${Ct}/5 consecutive wins`,goalLabel:`Win 5 rounds in a row to reach Level ${ht+1}`,isMaxLevel:ht>=ul.length}},[Ve,Ge,Xe,m==null?void 0:m.spLevelSkills,xe]),$e=`skillsPage${we==="valid"?" skillsFlashValid":""}${we==="invalid"?" skillsFlashInvalid":""}`;return a.jsxs("main",{className:$e,children:[a.jsx(HAe,{players:Et,gameState:hr,roomId:e||_||"",meId:at||"",endAt:n??void 0,isRoundActive:Gr,scores:k,hideAvatars:nt,singlePlayer:!Ve,campaignProgress:J}),a.jsx("div",{className:"skillsBody",children:a.jsxs("div",{className:"skillsContainer",children:[!R&&a.jsx(PAe,{onRetry:()=>zz()}),nt&&a.jsx(bAe,{isMultiplayer:Ve,activeGameMode:Ht,selectedStake:q,setSelectedStake:X,selectedDuration:Z,setSelectedDuration:Q,myBalance:Dt,stakeError:oe,hasStarted:W,onStart:en,onShowHelp:()=>kt(!0),isAuthenticated:!wr,onLogin:dr,isAdEnabled:g,roomStake:D==null?void 0:D.stake,roomDuration:D==null?void 0:D.duration,spLevel:Ge??(m==null?void 0:m.spLevelSkills),spLevelName:Xe,winStreak:xe,dailyChallenge:ne}),it&&a.jsx(SAe,{readyCount:Bt,totalPlayers:ir}),$!==null&&a.jsx(kAe,{countdown:$}),de&&a.jsx(EAe,{message:de}),un&&a.jsx("section",{className:"card gridCard",children:a.jsx(Nz,{letters:AT(Br),onSubmit:be,onTap:Se,disabled:!Gr||C||j,feedback:Ae,shakeKey:U,botTrail:Er})}),un&&(Zn.length>0||$n.length>0)&&a.jsxs("div",{className:"foundWordsList",children:[Zn.length>0&&a.jsxs("div",{className:"foundWordsColumn foundWordsColumn--me",children:[a.jsx("span",{className:"foundWordsLabel",children:"You"}),a.jsx("div",{className:"foundWordsTags",children:Zn.map(Pe=>a.jsx("span",{className:"foundWordTag foundWordTag--me",children:Pe},Pe))})]}),$n.length>0&&a.jsxs("div",{className:"foundWordsColumn foundWordsColumn--opp",children:[a.jsx("span",{className:"foundWordsLabel",children:Te}),a.jsx("div",{className:"foundWordsTags",children:$n.map(Pe=>a.jsx("span",{className:"foundWordTag foundWordTag--opp",children:Pe},Pe))})]})]}),Tn&&Kt&&a.jsx(lAe,{letters:Kt,foundWords:ct,onSubmit:Be,disabled:!Gr||C,myScore:Vt}),Kr&&Jt&&a.jsx(cAe,{questions:Jt,currentQuestionIndex:Rt,onAnswer:ut,myAnswers:Qe,disabled:!Gr||C,myScore:Vt}),C&&a.jsx(AAe,{myScore:Vt,players:Et,scores:k,winnerId:L,iWon:er,isDraw:mr,winnings:_e,selectedStake:q,isMultiplayer:Ve,roundSummary:De,meId:at,winStreak:pe,isAdEnabled:g,spLevel:Ge??(m==null?void 0:m.spLevelSkills),spLevelName:Xe,onPlayAgain:Ce})]})}),a.jsx(pAe,{open:Lt||Pt,onClose:()=>{nr(),kt(!1)},gameMode:Ht}),Re&&a.jsx(m1,{show:!0,contained:!0,variant:Re.variant,displayMs:Re.displayMs,zoomDurationMs:Re.zoomDurationMs,fadeDurationMs:Re.fadeDurationMs,ariaLabel:Re.ariaLabel,onComplete:rt})]})}function WAe({startAt:e,endAt:t,driftMs:r=0}){const[n,s]=l.useState(()=>Date.now());l.useEffect(()=>{const u=setInterval(()=>s(Date.now()),100);return()=>clearInterval(u)},[]);const o=l.useMemo(()=>t?Math.max(0,t-(n+r)):0,[n,t,r]),i=Math.ceil(o/1e3),c=i<=10?"text-red-500":i<=20?"text-yellow-500":"text-casino-gold";return a.jsxs("div",{"aria-live":"polite",className:`text-3xl font-bold ${c} transition-colors duration-300 drop-shadow-lg`,children:[i,"s"]})}function GAe(e,t=8,r=8){let n=2166136261;for(const c of e)n=(n^c.charCodeAt(0))*16777619;const s=()=>((n=Math.imul(n^n>>>13,1274126177))>>>0)/2**32,o="EEEEAAAAIIONNRRTTLLSSUU DD GBCMP FHVWY KJX QZ".replace(/\s/g,""),i=()=>o[Math.floor(s()*o.length)]||"E";return Array.from({length:t},()=>Array.from({length:r},()=>i()))}function Fz(){var W,G,$,K,de,ie,we;const{roomId:e}=hp(),t=Hr(),{meId:r}=Zr(),[n,s]=l.useState(null),[o,i]=l.useState(null),[c,u]=l.useState([]),[p,d]=l.useState([]),[f,m]=l.useState(!1),[h,b]=l.useState(!0),[g,y]=l.useState(null),[x,v]=l.useState(!1),[A,_]=l.useState(null),{skillsSpectatorJoin:w,skillsSpectatorLeave:j}=sa(),T=l.useRef(!1);Ba({onSkillsSpectatorState:he=>{var Ae,Fe;console.log("[spectator] Got initial state:",he),he.roomId===e&&(s(he.room),i(he.gameState),u(((Ae=he.room)==null?void 0:Ae.players)||[]),d(((Fe=he.room)==null?void 0:Fe.spectators)||[]),m(he.isSpectator??!0),b(!1),y(null))},onSkillsSpectatorUpdate:he=>{console.log("[spectator] Got update:",he),he.roomId===e&&(i(he.gameState),he.players&&u(he.players),he.spectators&&d(he.spectators))},onSkillsSpectatorJoined:he=>{console.log("[spectator] Spectator joined:",he),he.roomId===e&&he.spectator&&!p.find(Ae=>Ae.id===he.spectator.id)&&d(Ae=>[...Ae,he.spectator])},onSkillsSpectatorLeft:he=>{console.log("[spectator] Spectator left:",he),he.roomId===e&&d(Ae=>Ae.filter(Fe=>Fe.id!==he.spectatorId))},onSkillsScoreUpdate:he=>{he.roomId===e&&i(Ae=>Ae&&{...Ae,scores:he.scores})},onSkillsRoundEnd:he=>{he.roomId===e&&(v(!0),he.winnerId&&_(he.winnerId),he.scores&&i(Ae=>Ae&&{...Ae,scores:he.scores,phase:"finished"}))},onSkillsRoundStart:he=>{he.roomId===e&&(v(!1),_(null),i(Ae=>Ae&&{...Ae,phase:"playing",seed:he.seed,startAt:he.startAt,endAt:he.endAt,scores:{}}))}}),l.useEffect(()=>{if(!(!e||T.current))return T.current=!0,console.log("[spectator] Joining room:",e),w(e).then(he=>{console.log("[spectator] Join response:",he),he.ok||(y(he.error||"Failed to join as spectator"),b(!1))}).catch(he=>{console.error("[spectator] Join error:",he),y("Failed to join as spectator"),b(!1)}),()=>{console.log("[spectator] Leaving room:",e),j(e),T.current=!1}},[e,w,j]);const R=l.useMemo(()=>o!=null&&o.seed?GAe(o.seed):null,[o==null?void 0:o.seed]),P=c[0],k=c[1],E=P?(o==null?void 0:o.scores[P.id])??0:0,M=k?(o==null?void 0:o.scores[k.id])??0:0,C=((W=o==null?void 0:o.wordsearchData)==null?void 0:W.foundWords[P==null?void 0:P.id])||((G=o==null?void 0:o.anagramsData)==null?void 0:G.foundWords[P==null?void 0:P.id])||[],I=(($=o==null?void 0:o.wordsearchData)==null?void 0:$.foundWords[k==null?void 0:k.id])||((K=o==null?void 0:o.anagramsData)==null?void 0:K.foundWords[k==null?void 0:k.id])||[],L=((de=o==null?void 0:o.triviaData)==null?void 0:de.playerAnswers[P==null?void 0:P.id])||{},N=((ie=o==null?void 0:o.triviaData)==null?void 0:ie.playerAnswers[k==null?void 0:k.id])||{},S=(o==null?void 0:o.gameMode)||"wordsearch",F=(o==null?void 0:o.phase)==="playing",D=(o==null?void 0:o.phase)==="waiting",H=(o==null?void 0:o.phase)==="finished"||x;return h?a.jsxs("div",{className:"skills-spectate-loading",children:[a.jsx("div",{className:"skills-loading-spinner"}),a.jsx("p",{children:"Joining as spectator..."})]}):g?a.jsxs("div",{className:"skills-spectate-error",children:[a.jsx("h2",{children:"Unable to Spectate"}),a.jsx("p",{children:g}),a.jsx("button",{onClick:()=>t("/lobby"),children:"Return to Lobby"})]}):a.jsxs("div",{className:"skills-spectate-container",children:[a.jsxs("div",{className:"skills-spectate-header",children:[a.jsxs("div",{className:"spectator-badge",children:[a.jsx("span",{className:"spectator-icon",children:"👁️"}),a.jsx("span",{children:"Spectating"})]}),a.jsx("button",{className:"spectate-leave-btn",onClick:()=>t("/lobby"),children:"Leave"})]}),p.length>0&&a.jsxs("div",{className:"spectator-count",children:[p.length," spectator",p.length!==1?"s":""," watching"]}),D&&a.jsx("div",{className:"skills-spectate-waiting",children:a.jsx("h3",{children:"Waiting for players to ready up..."})}),F&&(o==null?void 0:o.endAt)&&a.jsx("div",{className:"skills-spectate-timer",children:a.jsx(WAe,{endAt:o.endAt})}),a.jsxs("div",{className:"skills-spectate-players",children:[a.jsxs("div",{className:"skills-spectate-player player-1",children:[a.jsxs("div",{className:"spectator-player-info",children:[a.jsx("span",{className:"spectator-player-name",children:(P==null?void 0:P.name)||"Player 1"}),a.jsxs("span",{className:"spectator-player-score",children:[E," pts"]})]}),(S==="wordsearch"||S==="anagrams")&&C.length>0&&a.jsxs("div",{className:"spectator-words",children:[a.jsxs("h4",{children:["Words Found: ",C.length]}),a.jsx("div",{className:"words-list",children:C.slice(-5).map((he,Ae)=>a.jsx("span",{className:"found-word",children:he},Ae))})]}),S==="trivia"&&a.jsx("div",{className:"spectator-trivia-progress",children:a.jsxs("span",{children:["Questions answered: ",Object.keys(L).length]})})]}),a.jsxs("div",{className:"skills-spectate-center",children:[S==="wordsearch"&&R&&F&&a.jsx("div",{className:"spectator-grid",children:a.jsx(Nz,{letters:R,onSubmit:()=>{},disabled:!0,cellSize:40})}),S==="anagrams"&&(o==null?void 0:o.anagramsData)&&F&&a.jsx("div",{className:"spectator-anagrams",children:a.jsx("div",{className:"anagram-letters",children:o.anagramsData.letters.map((he,Ae)=>a.jsx("span",{className:"letter-tile",children:he},Ae))})}),S==="trivia"&&(o==null?void 0:o.triviaData)&&F&&a.jsx("div",{className:"spectator-trivia",children:a.jsxs("div",{className:"trivia-question",children:[a.jsxs("span",{className:"question-number",children:["Q",o.triviaData.currentQuestion+1," / ",o.triviaData.questions.length]}),a.jsx("p",{children:(we=o.triviaData.questions[o.triviaData.currentQuestion])==null?void 0:we.question})]})}),H&&a.jsxs("div",{className:"spectator-result",children:[a.jsxs("h2",{children:[A===(P==null?void 0:P.id)?P==null?void 0:P.name:k==null?void 0:k.name," Wins!"]}),a.jsxs("div",{className:"final-scores",children:[a.jsxs("span",{children:[P==null?void 0:P.name,": ",E]}),a.jsxs("span",{children:[k==null?void 0:k.name,": ",M]})]})]})]}),a.jsxs("div",{className:"skills-spectate-player player-2",children:[a.jsxs("div",{className:"spectator-player-info",children:[a.jsx("span",{className:"spectator-player-name",children:(k==null?void 0:k.name)||"Player 2"}),a.jsxs("span",{className:"spectator-player-score",children:[M," pts"]})]}),(S==="wordsearch"||S==="anagrams")&&I.length>0&&a.jsxs("div",{className:"spectator-words",children:[a.jsxs("h4",{children:["Words Found: ",I.length]}),a.jsx("div",{className:"words-list",children:I.slice(-5).map((he,Ae)=>a.jsx("span",{className:"found-word",children:he},Ae))})]}),S==="trivia"&&a.jsx("div",{className:"spectator-trivia-progress",children:a.jsxs("span",{children:["Questions answered: ",Object.keys(N).length]})})]})]}),a.jsxs("div",{className:"skills-spectate-mode",children:[S==="wordsearch"&&"🔤 Word Search",S==="anagrams"&&"🔠 Anagrams",S==="trivia"&&"❓ Trivia"]})]})}function XAe(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby"||r==="/",s=/^\/skills\/(play|room)/.test(r)||/^\/room\//.test(r);(()=>{var c;try{return/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s);const i=document.documentElement;if(n||s){i.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),i.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),i.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else i.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),i.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),i.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/room/:roomId",element:a.jsx(qm,{})}),a.jsx(qe,{path:"/skills/play",element:a.jsx(qy,{})}),a.jsx(qe,{path:"/skills/room/:roomId",element:a.jsx(qy,{})}),a.jsx(qe,{path:"/skills/spectate/:roomId",element:a.jsx(Fz,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{defaultMode:"skills"})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/lobby",replace:!0})})]})}const YAe=l.lazy(()=>Cr(()=>import("./BroadcasterLive-D6NMA-d_.js"),__vite__mapDeps([18,2,3,4,1,12,19]),import.meta.url)),ZAe=l.lazy(()=>Cr(()=>import("./TurretPreview-DS4z-mdm.js"),__vite__mapDeps([15,3,4]),import.meta.url));l.lazy(()=>Cr(()=>import("./ShipPackPreview-DzfsKUAI.js"),__vite__mapDeps([16,3,4,2,17]),import.meta.url));function KAe(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby",s=/^\/room\//.test(r)||/^\/poker\/room\//.test(r);(()=>{var c;try{return/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s);const i=document.documentElement;if(n||s){i.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),i.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),i.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else i.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),i.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),i.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/admin",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/broadcaster",element:a.jsx(l.Suspense,{fallback:null,children:a.jsx(YAe,{})})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/room/:roomId",element:a.jsx(qm,{})}),a.jsx(qe,{path:"/poker",element:a.jsx(_1,{})}),a.jsx(qe,{path:"/poker/mock",element:a.jsx(w1,{})}),a.jsx(qe,{path:"/poker/room/:roomId",element:a.jsx(v1,{})}),a.jsx(qe,{path:"/skills/play",element:a.jsx(qy,{})}),a.jsx(qe,{path:"/skills/room/:roomId",element:a.jsx(qy,{})}),a.jsx(qe,{path:"/skills/spectate/:roomId",element:a.jsx(Fz,{})}),a.jsx(qe,{path:"/zentara",element:a.jsx(qn,{to:"/",replace:!0})}),a.jsx(qe,{path:"/zentara/match/:matchId",element:a.jsx(cp,{})}),a.jsx(qe,{path:"/zentara/room/:roomId",element:a.jsx(cp,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/button-sandbox",element:a.jsx(Vm,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{})}),a.jsx(qe,{path:"/turret-preview",element:a.jsx(l.Suspense,{fallback:null,children:a.jsx(ZAe,{})})}),a.jsx(qe,{path:"/ship-pack-preview",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/lobby",replace:!0})})]})}const QAe=l.lazy(()=>Cr(()=>import("./BroadcasterLive-D6NMA-d_.js"),__vite__mapDeps([18,2,3,4,1,12,19]),import.meta.url)),JAe=l.lazy(()=>Cr(()=>import("./TurretPreview-DS4z-mdm.js"),__vite__mapDeps([15,3,4]),import.meta.url));l.lazy(()=>Cr(()=>import("./ShipPackPreview-DzfsKUAI.js"),__vite__mapDeps([16,3,4,2,17]),import.meta.url));function $Ae(){const e=Hr(),t=Ia();return l.useEffect(()=>{const n=new URLSearchParams(window.location.search).get("redirect");n&&e(n),Ms()},[e]),l.useEffect(()=>{Ms(t.pathname)},[t.pathname]),l.useEffect(()=>{try{const r=t.pathname||"",n=r==="/lobby",s=/^\/match\//.test(r);(()=>{var c;try{return/^(capacitor:|ionic:)/i.test(((c=window.location)==null?void 0:c.protocol)||"")}catch{return!1}})()?(document.body.classList.add("is-native-app"),document.documentElement.classList.add("is-native-app")):(document.body.classList.remove("is-native-app"),document.documentElement.classList.remove("is-native-app")),document.body.classList.toggle("page-home-screen",n),document.body.classList.toggle("page-gameroom",s);const i=document.documentElement;if(n||s){i.style.setProperty("overflow","hidden","important"),document.body.style.setProperty("overflow","hidden","important"),i.style.setProperty("overscroll-behavior","none","important"),document.body.style.setProperty("overscroll-behavior","none","important"),i.style.setProperty("height","100svh","important"),document.body.style.setProperty("height","100svh","important");try{window.scrollTo({top:0,left:0,behavior:"instant"})}catch{}}else i.style.removeProperty("overflow"),document.body.style.removeProperty("overflow"),i.style.removeProperty("overscroll-behavior"),document.body.style.removeProperty("overscroll-behavior"),i.style.removeProperty("height"),document.body.style.removeProperty("height")}catch{}},[t.pathname]),a.jsxs(cu,{children:[a.jsx(qe,{path:"/review-login",element:a.jsx(Su,{})}),a.jsxs(qe,{element:a.jsx(yu,{}),children:[a.jsx(qe,{path:"/verify",element:a.jsx(ku,{})}),a.jsx(qe,{path:"/qa-login",element:a.jsx(Eu,{})}),a.jsx(qe,{path:"/verification-failed",element:a.jsx(du,{})})]}),a.jsx(qe,{path:"/add-chips",element:a.jsx(Au,{})}),a.jsxs(qe,{element:a.jsx(uu,{}),children:[a.jsx(qe,{path:"/profile",element:a.jsx(vu,{})}),a.jsx(qe,{path:"/player/:playerId",element:a.jsx(_u,{})}),a.jsx(qe,{path:"/messages",element:a.jsx(wu,{})}),a.jsx(qe,{path:"/settings",element:a.jsx(xu,{})}),a.jsx(qe,{path:"/admin",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/broadcaster",element:a.jsx(l.Suspense,{fallback:null,children:a.jsx(QAe,{})})}),a.jsx(qe,{path:"/",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"/lobby",element:a.jsx(gu,{})}),a.jsx(qe,{path:"/zentara/match/:matchId",element:a.jsx(cp,{})}),a.jsx(qe,{path:"/zentara/room/:roomId",element:a.jsx(cp,{})})]}),a.jsx(qe,{path:"/disclaimer",element:a.jsx(Pu,{})}),a.jsx(qe,{path:"/support",element:a.jsx(Cu,{})}),a.jsx(qe,{path:"/privacy",element:a.jsx(Ru,{})}),a.jsx(qe,{path:"/terms",element:a.jsx(Tu,{})}),a.jsx(qe,{path:"/how-to-play",element:a.jsx(ac,{})}),a.jsx(qe,{path:"/turret-preview",element:a.jsx(l.Suspense,{fallback:null,children:a.jsx(JAe,{})})}),a.jsx(qe,{path:"/ship-pack-preview",element:a.jsx(qn,{to:"/lobby",replace:!0})}),a.jsx(qe,{path:"*",element:a.jsx(qn,{to:"/lobby",replace:!0})})]})}const eke="ceelolounge",jT=OB.toLowerCase(),tke=new Set(["","verify","auth","ceelolounge","review-login","qa-login"]);function W_(e){return!e||e.length===0||e.length>2048||!/^[A-Za-z0-9._-]+$/.test(e)?null:e}function rke(e){try{const t=new URL(e),r=t.protocol.replace(":","").toLowerCase(),n=(t.hostname||"").toLowerCase(),s=(t.pathname||"").toLowerCase(),o=r===eke,i=t.protocol==="https:",c=s.endsWith("/verify")||s.includes("/auth/verify"),u=s.endsWith("/review-login")||s.includes("/review-login"),p=s.endsWith("/qa-login")||s.includes("/qa-login");if(o){if(!tke.has(n)||!c&&!u&&!p&&!(n==="verify"||n==="review-login"||n==="qa-login")&&!((n===""||n==="ceelolounge")&&(s==="/"||s==="")))return null}else if(i){if(jT&&n!==jT||!c&&!u&&!p)return null}else return null;const d=W_(t.searchParams.get("token"));if(d)return d;const f=s.split("/").filter(Boolean),m=f.lastIndexOf("verify");return m>=0&&f[m+1]?W_(f[m+1]):f.length===1&&!["verify","auth","review-login","qa-login"].includes(f[0])?W_(f[0]):null}catch{return null}}function nke(){const e=Hr(),t=l.useRef(null);return l.useEffect(()=>{let r;const n=s=>{if(!s||t.current===s)return;const o=rke(s);if(!o){console.warn("Deep link ignored (not allowed or missing token)");return}t.current=s;try{const i=new URL(s),c=(i.pathname||"").toLowerCase(),u=(i.hostname||"").toLowerCase(),p=c.includes("/review-login")||u==="review-login"?"/review-login":c.includes("/qa-login")||u==="qa-login"?"/qa-login":"/verify";e(`${p}?token=${encodeURIComponent(o)}`,{replace:!0})}catch{e(`/verify?token=${encodeURIComponent(o)}`,{replace:!0})}};return vs.getLaunchUrl().then(s=>n(s==null?void 0:s.url)).catch(()=>{}),(async()=>r=await vs.addListener("appUrlOpen",({url:s})=>n(s)))(),()=>{var s;return(s=r==null?void 0:r.remove)==null?void 0:s.call(r)}},[e]),null}const Uz="dl_invited_by_v1",qz="dl_invited_by_ts_v1",Jw=/^[A-Za-z0-9_-]{16,64}$/;function IT(e,t){try{window.localStorage.setItem(e,t)}catch{}}function NT(e){try{window.localStorage.removeItem(e)}catch{}}function $w(e){!e||!Jw.test(e)||(IT(Uz,e),IT(qz,String(Date.now())))}function ake(){NT(Uz),NT(qz)}function Vz(){try{const e=new URL(window.location.href),t=e.searchParams.get("inviter");if(t&&Jw.test(t))return $w(t),t;const r=e.pathname.match(/(?:^|\/)i\/([^/?#]+)/i);if(r&&r[1]&&Jw.test(r[1]))return $w(r[1]),r[1]}catch{}return null}const ske=Object.freeze(Object.defineProperty({__proto__:null,captureInviterFromLocation:Vz,clearInviter:ake,rememberInviter:$w},Symbol.toStringTag,{value:"Module"}));function oke(e){switch(e.errorCode||""){case"UNAUTHORIZED":return{title:"Sign In Required",subtitle:"You must be logged in to bet."};case"BET_INVALID":return{title:"Invalid Bet",subtitle:e.error||"Bet not allowed."};case"BET_REJECTED":return{title:"Bet Rejected",subtitle:e.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:e.error||"Unable to place bet."}}}function ike(){const{info:e}=As();return Ba({onCrapsBetError:t=>{try{const{title:r,subtitle:n}=oke(t);e(r,n)}catch{}}}),null}var G_={};const lke=[aj,nj],cke=new F3,uke=H3({storage:W3});function dke(){const e=!!(import.meta.vitest||typeof process<"u"&&(G_!=null&&G_.VITEST_WORKER_ID)),t=[U3({shimDisconnect:!0})];if(e)console.info("[wallet] test environment detected – skipping walletConnect connector");else try{t.push(q3({projectId:"demo",showQrModal:!0}))}catch(r){console.warn("[wallet] walletConnect initialization skipped:",(r==null?void 0:r.message)||r)}return V3({chains:lke,multiInjectedProviderDiscovery:!0,transports:{[aj.id]:Q1(),[nj.id]:Q1()},connectors:t,ssr:!1,storage:uke,syncConnectedChain:!0})}function pke({children:e}){const t=dke();return a.jsx(z3,{config:t,children:a.jsx(B3,{client:cke,children:e})})}l.createContext(void 0);const Hz=l.createContext(void 0);async function fke(){try{const e=new AbortController,t=setTimeout(()=>e.abort(),5e3),r=await fetch("/api/features",{cache:"no-store",signal:e.signal});return clearTimeout(t),r.ok?await r.json():null}catch{return null}}function mke({children:e}){const[t,r]=l.useState(!1),[n,s]=l.useState(!1),o=async()=>{var c;const i=await fke();s(!!((c=i==null?void 0:i.features)!=null&&c.wallet)),r(!0)};return l.useEffect(()=>{const i=o(),c=window.setTimeout(()=>{r(u=>(u||console.warn("[features] fallback timeout - forcing loaded"),!0))},6e3);return i.finally(()=>clearTimeout(c)),()=>clearTimeout(c)},[]),a.jsx(Hz.Provider,{value:{loaded:t,walletEnabled:n,refresh:o},children:e})}function hke(){return l.useContext(Hz)??{loaded:!0,walletEnabled:!1,refresh:()=>{}}}class Wz extends ot.Component{constructor(){super(...arguments);Wr(this,"state",{hasError:!1});Wr(this,"handleReset",()=>{var r,n;this.setState({hasError:!1,error:void 0}),(n=(r=this.props).onReset)==null||n.call(r)})}static getDerivedStateFromError(r){return{hasError:!0,error:r}}componentDidCatch(r,n){var o,i,c,u;(i=(o=this.props).onError)==null||i.call(o,r,n),l0.error("ErrorBoundary caught",{message:r==null?void 0:r.message,stack:(c=r==null?void 0:r.stack)==null?void 0:c.slice(0,1e3),componentStack:(u=n==null?void 0:n.componentStack)==null?void 0:u.slice(0,500)}),typeof process<"u"&&!0||typeof import.meta<"u"&&!0||console.error("ErrorBoundary caught an error:",r,n)}render(){return this.state.hasError?this.props.fallback?a.jsx(a.Fragment,{children:this.props.fallback}):a.jsxs("div",{className:"error-boundary",role:"alert",style:{padding:16},children:[a.jsx("h2",{children:"Something went wrong"}),a.jsx("p",{children:"Please refresh or return to the previous screen."}),a.jsx("button",{className:"felt-btn",onClick:this.handleReset,children:"Try again"})]}):this.props.children}}var MT;(function(e){e[e.Sunday=1]="Sunday",e[e.Monday=2]="Monday",e[e.Tuesday=3]="Tuesday",e[e.Wednesday=4]="Wednesday",e[e.Thursday=5]="Thursday",e[e.Friday=6]="Friday",e[e.Saturday=7]="Saturday"})(MT||(MT={}));const Nc=Kl("LocalNotifications",{web:()=>Cr(()=>import("./web-Dt2-ChTe.js"),__vite__mapDeps([20,1,2,3,4]),import.meta.url).then(e=>new e.LocalNotificationsWeb)});let ex=null,LT=!1,hg=null;function gke(){return ex||LT?Promise.resolve():hg||(LT=!0,hg=Cr(()=>import("./index-BFC0Lur1.js"),__vite__mapDeps([21,2,3,4,1]),import.meta.url).then(e=>{const t=e.FirebaseMessaging;t&&typeof t.getToken=="function"?(ex=t,console.info("[Push] FirebaseMessaging plugin loaded successfully")):console.warn("[Push] FirebaseMessaging plugin not available (native rebuild required)")}).catch(e=>{console.warn("[Push] Failed to load FirebaseMessaging (OTA update on old app version?):",e)}),hg)}function yke(){return ex}let DT=!1,up=null;async function Gz(e={}){if(DT)return;DT=!0;const t=zr.getPlatform(),r=t==="ios"||t==="android";if(console.info(`[Push] initNotifications called - platform=${t} isNative=${r}`),!r){console.info("[Push] Not native platform, skipping push setup");return}const n=e.enableLocal!==!1,s=e.enablePush!==!1;if(console.info(`[Push] enableLocal=${n} enablePush=${s}`),n)try{await bke()}catch{}if(s)try{await vke(e.onPushToken)}catch(o){console.warn("[Push] Setup failed:",o)}}async function bke(){var e;try{if((await Nc.requestPermissions()).display!=="granted")return}catch{}try{await((e=Nc.createChannel)==null?void 0:e.call(Nc,{id:"default",name:"General",description:"General notifications",importance:4,visibility:1,sound:void 0,lights:!0,vibration:!0}))}catch{}try{Nc.addListener("localNotificationActionPerformed",t=>{var n,s;console.info("[LocalNotifications] action",t==null?void 0:t.actionId,(n=t==null?void 0:t.notification)==null?void 0:n.id);const r=(s=t==null?void 0:t.notification)==null?void 0:s.extra;r!=null&&r.type&&Xz({notification:{data:r}})})}catch{}}async function vke(e){console.info("[Push] setupPushNotifications starting..."),await gke();const t=yke();if(!t){console.warn("[Push] FirebaseMessaging not available, skipping push setup");return}try{console.info("[Push] Requesting permissions...");const r=await t.requestPermissions();if(console.info("[Push] Permission result:",JSON.stringify(r)),r.receive!=="granted"){console.warn("[Push] Permission not granted, receive=",r.receive);return}console.info("[Push] ✅ Permission granted")}catch(r){console.warn("[Push] Permission request failed:",r);return}try{console.info("[Push] Getting FCM token...");const{token:r}=await t.getToken();if(r){console.info("[Push] 🔥 FCM token received:",r.substring(0,20)+"..."),up=r;try{e==null||e(r)}catch{}dp(r)}else console.warn("[Push] getToken returned empty token")}catch(r){console.warn("[Push] Failed to get FCM token:",r)}t.addListener("tokenReceived",({token:r})=>{console.info("[Push] 🔥 FCM token refreshed:",r.substring(0,20)+"..."),up=r;try{e==null||e(r)}catch{}dp(r)}),t.addListener("notificationReceived",r=>{const n=r==null?void 0:r.notification,s=n==null?void 0:n.title,o=n==null?void 0:n.body;if(console.info("[Push] foreground received",s),!s)return;const i=n!=null&&n.data&&typeof n.data=="object"?{...n.data}:void 0;Yz(s,o||"",i).catch(()=>{})}),t.addListener("notificationActionPerformed",r=>{console.info("[Push] action performed",r),Xz(r)})}let qg=!1,X_=!1,Cc=0,tx=0;const Y_=10,_ke=5e3;function wke(){var t,r;const e=(globalThis==null?void 0:globalThis.APP_TARGET)||((r=(t=import.meta)==null?void 0:t.env)==null?void 0:r.VITE_APP_TARGET)||"";switch(e){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 e||"unknown"}}function dp(e){const t=e||up;if(!t){console.warn("[Push] registerPushTokenWithServer called but no token available");return}if(qg&&t===up){console.info("[Push] Token already registered, skipping");return}if(X_){console.info("[Push] Token registration already pending, skipping");return}const r=zr.getPlatform();if(r==="web"){console.info("[Push] Web platform, skipping token registration");return}const n=bp();if(console.info(`[Push] Socket state: exists=${!!n} connected=${n==null?void 0:n.connected}`),!(n!=null&&n.connected)){Cc++,Cc<=Y_?(console.info(`[Push] Socket not connected, will retry (${Cc}/${Y_})`),setTimeout(()=>dp(t),2e3)):console.warn("[Push] Max registration retries reached, giving up");return}const s=wke(),o=t.substring(0,20)+"..."+t.substring(t.length-10);console.info(`[Push] Registering token: ${o} platform=${r} appId=${s}`),X_=!0,n.emit("push:register_token",{token:t,platform:r,appId:s},i=>{X_=!1,i!=null&&i.success?(qg=!0,Cc=0,tx=Date.now(),console.info("[Push] ✅ Token registered with server successfully")):(console.warn("[Push] ❌ Token registration failed:",i==null?void 0:i.error),!qg&&Cc<Y_&&(Cc++,setTimeout(()=>dp(t),3e3)))})}function xke(){if(up){const e=Date.now();if(e-tx<_ke){console.info("[Push] Skipping re-register (debounce)");return}tx=e,qg=!1,Cc=0,console.info("[Push] Re-registering token after reconnect"),dp(up)}}function Xz(e){var r;const t=(r=e==null?void 0:e.notification)==null?void 0:r.data;if(console.info("[Push] handlePushActionFirebase",{data:t}),!!t)switch(t.type){case"game_invite":if(t.roomId){const n=t.gameType||"";let s;n==="poker"?s=`/poker/room/${t.roomId}`:n==="skills"?s=`/skills/room/${t.roomId}`:s=`/room/${t.roomId}`,console.info("[Push] Navigating to room:",s),window.location.href=s}break;case"friend_request":console.info("[Push] Navigating to profile for friend request"),window.location.href="/profile";break;case"friend_accepted":console.info("[Push] Navigating to profile for friend accepted"),window.location.href="/profile";break;case"message":t.senderId?(console.info("[Push] Navigating to messages screen with peer:",t.senderId),window.location.href=`/messages?peer=${encodeURIComponent(t.senderId)}`):(console.info("[Push] Navigating to messages screen (no senderId)"),window.location.href="/messages");break;default:console.info("[Push] Unknown notification type, navigating to lobby"),window.location.href="/lobby";break}}async function Yz(e,t,r){if(!(zr.getPlatform()==="ios"||zr.getPlatform()==="android"))return;try{if((await Nc.checkPermissions()).display!=="granted")return}catch{}const o={notifications:[{id:Math.floor(Date.now()%2147483647),title:e,body:t,schedule:{at:new Date(Date.now()+10)},smallIcon:"ic_stat_name",channelId:"default",extra:r}]};try{await Nc.schedule(o)}catch{}}const Ake=Object.freeze(Object.defineProperty({__proto__:null,initNotifications:Gz,reRegisterPushToken:xke,registerPushTokenWithServer:dp,scheduleLocalNow:Yz},Symbol.toStringTag,{value:"Module"}));function kke({cooldownMs:e=5e3,initialGraceMs:t=900}){const r=Na(),{room:n}=Is(),s=l.useRef(0),o=l.useRef(!1),i=l.useRef(!1),c=l.useRef(Date.now());return l.useEffect(()=>{(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})();const u=Date.now();try{window.__fgMountedAt=u}catch{}try{console.log("[fg] BotNudgeOnForeground mounted",{t:u,hint:"enable logs via ?debugForeground=1 or localStorage.setItem('debug:foreground','1')"})}catch{}},[]),l.useEffect(()=>{let u=[],p=!1;const d=(()=>{try{return typeof window<"u"&&window.location.search.includes("debugForeground=1")||typeof localStorage<"u"&&localStorage.getItem("debug:foreground")==="1"}catch{return!1}})(),f=async(x,v=!1)=>{if(p)return;const A=Date.now();if(!(!v&&A-c.current<t)&&!o.current&&!(!v&&A-s.current<e)){o.current=!0;try{const _=(n==null?void 0:n.id)||void 0;if(r)if(d)try{const w=await y0(r,tr.BOTS_NUDGE,{roomId:_},{timeoutMs:5e3});try{window.__fgLastAck=w}catch{}console.log("[fg] nudged bots (ack)",{reason:x,roomId:_,force:v,ack:w})}catch(w){console.warn("[fg] nudged bots (ack failed)",{reason:x,roomId:_,force:v,error:w==null?void 0:w.message})}else await uI(r,tr.BOTS_NUDGE,{roomId:_}),d&&console.log("[fg] nudged bots",{reason:x,roomId:_,force:v});s.current=A}catch{}finally{o.current=!1}}},m=async(x,v=!1)=>{if(p)return;const A=Date.now();if(!(!v&&A-c.current<t)&&!i.current){if(i.current=!0,!v&&A-s.current<e){i.current=!1;return}try{const _=(n==null?void 0:n.id)||void 0;if(!r)return;try{await Ef(r)}catch{}try{const w=await y0(r,tr.ROOM_REFRESH_STATE,{roomId:_},{timeoutMs:5e3});!(w!=null&&w.ok)&&d?console.warn("[fg] refresh_state nack",{reason:x,roomId:_,ack:w}):d&&console.log("[fg] refresh_state ack",{reason:x,roomId:_}),s.current=A}catch(w){d&&console.warn("[fg] refresh_state failed",{reason:x,roomId:_,error:w==null?void 0:w.message})}}catch{}finally{i.current=!1}}};try{window.__fgNudge=(x,v)=>{f(x||"manual",!!v)}}catch{}(async()=>{try{const x=await vs.addListener("appStateChange",v=>{if(!p)if(v.isActive)d&&console.log("[fg] appStateChange: active"),(async()=>{try{await Ef(r)}catch{}f("native_appstate_active",!0),m("native_appstate_active")})();else{d&&console.log("[fg] appStateChange: inactive");try{Hc(r,"BotNudgeOnForeground: appStateChange inactive")}catch{}}});d&&console.log("[fg] appStateChange listener attached");try{window.__fgAppStateListener=!0}catch{}u.push(()=>{try{x.remove()}catch{}})}catch{d&&console.log("[fg] appStateChange not available (web or plugin missing)")}})(),(async()=>{try{const x=await vs.addListener("pause",()=>{var v;d&&console.log("[fg] pause");try{(v=window==null?void 0:window.Capacitor)!=null&&v.isNativePlatform&&Hc(r,"BotNudgeOnForeground: pause event")}catch{}});d&&console.log("[fg] pause listener attached");try{window.__fgPauseListener=!0}catch{}u.push(()=>{try{x.remove()}catch{}})}catch{d&&console.log("[fg] pause not available")}})(),(async()=>{try{const x=await vs.addListener("resume",async()=>{d&&console.log("[fg] resume");try{await Ef(r)}catch{}f("native_resume",!0),m("native_resume")});d&&console.log("[fg] resume listener attached");try{window.__fgResumeListener=!0}catch{}u.push(()=>{try{x.remove()}catch{}})}catch{d&&console.log("[fg] resume not available")}})();const h=()=>{p||document.visibilityState==="visible"&&(d&&console.log("[fg] visibility: visible"),f("web_visibility"),m("web_visibility"))};document.addEventListener("visibilitychange",h),u.push(()=>document.removeEventListener("visibilitychange",h));const b=()=>{p||(d&&console.log("[fg] window focus"),f("web_focus"),m("web_focus"))},g=()=>{p||(d&&console.log("[fg] window pageshow"),f("web_pageshow"),m("web_pageshow"))};window.addEventListener("focus",b),window.addEventListener("pageshow",g),u.push(()=>{window.removeEventListener("focus",b),window.removeEventListener("pageshow",g)});const y=setTimeout(()=>{d&&console.log("[fg] initial_mount nudge"),f("initial_mount"),m("initial_mount")},2500);return u.push(()=>clearTimeout(y)),()=>{p=!0,u.forEach(x=>{try{x()}catch{}})}},[r,n==null?void 0:n.id,e]),null}function Wa(){try{const e=performance.memory;return e?{usedJSHeapMB:Math.round(e.usedJSHeapSize/1048576),totalJSHeapMB:Math.round(e.totalJSHeapSize/1048576),limitJSHeapMB:Math.round(e.jsHeapSizeLimit/1048576)}:void 0}catch{return}}function Ske(){const e=Na(),t=l.useRef(Date.now());return l.useEffect(()=>{let r=!1;const n=[];La.info("NativeCrashLogger mounted",{mem:Wa()});async function s(){const o=[vs.addListener("appStateChange",c=>{r||(c.isActive?La.info("appStateChange → ACTIVE",{mem:Wa(),since:Date.now()-t.current}):La.warn("appStateChange → INACTIVE",{mem:Wa()}))}),vs.addListener("pause",()=>{r||La.warn("PAUSE (backgrounded)",{mem:Wa()})}),vs.addListener("resume",()=>{r||La.info("RESUME (foregrounded)",{mem:Wa()})}),vs.addListener("backButton",()=>{r||La.info("BACK_BUTTON pressed")})],i=await Promise.allSettled(o);for(const c of i)if(c.status==="fulfilled")if(r)try{c.value.remove()}catch{}else n.push(c.value)}return s().catch(()=>{}),()=>{r=!0,n.forEach(o=>{try{o.remove()}catch{}})}},[]),l.useEffect(()=>{const r=()=>{document.visibilityState==="hidden"?La.warn("visibility → HIDDEN",{mem:Wa()}):La.info("visibility → VISIBLE",{mem:Wa()})},n=()=>La.info("network → ONLINE"),s=()=>La.warn("network → OFFLINE"),o=()=>La.error("PAGE FREEZE (frozen)",{mem:Wa()}),i=u=>La.warn("pagehide",{persisted:u.persisted,mem:Wa()}),c=u=>La.info("pageshow",{persisted:u.persisted,mem:Wa()});return document.addEventListener("visibilitychange",r),window.addEventListener("online",n),window.addEventListener("offline",s),window.addEventListener("freeze",o),window.addEventListener("pagehide",i),window.addEventListener("pageshow",c),()=>{document.removeEventListener("visibilitychange",r),window.removeEventListener("online",n),window.removeEventListener("offline",s),window.removeEventListener("freeze",o),window.removeEventListener("pagehide",i),window.removeEventListener("pageshow",c)}},[]),l.useEffect(()=>{var d,f,m,h,b,g,y,x;if(!e)return;const r=e,n=()=>{var v,A,_;return io.info("CONNECTED",{id:r.id,transport:(_=(A=(v=r.io)==null?void 0:v.engine)==null?void 0:A.transport)==null?void 0:_.name})},s=v=>io.warn("DISCONNECTED",{reason:v,mem:Wa()}),o=v=>{const A=String((v==null?void 0:v.message)||"");if(A==="NO_AUTH_TOKEN"){io.info("CONNECT_SKIPPED_NO_AUTH",{message:A,type:v==null?void 0:v.type});return}io.error("CONNECT_ERROR",{message:A,type:v==null?void 0:v.type})},i=v=>io.info("RECONNECTED",{attempt:v}),c=v=>io.debug("reconnect_attempt",{attempt:v}),u=v=>io.warn("reconnect_error",{message:v==null?void 0:v.message}),p=()=>io.error("RECONNECT_FAILED (gave up)");return r.on("connect",n),r.on("disconnect",s),r.on("connect_error",o),(f=(d=r.io)==null?void 0:d.on)==null||f.call(d,"reconnect",i),(h=(m=r.io)==null?void 0:m.on)==null||h.call(m,"reconnect_attempt",c),(g=(b=r.io)==null?void 0:b.on)==null||g.call(b,"reconnect_error",u),(x=(y=r.io)==null?void 0:y.on)==null||x.call(y,"reconnect_failed",p),()=>{var v,A,_,w,j,T,R,P;r.off("connect",n),r.off("disconnect",s),r.off("connect_error",o),(A=(v=r.io)==null?void 0:v.off)==null||A.call(v,"reconnect",i),(w=(_=r.io)==null?void 0:_.off)==null||w.call(_,"reconnect_attempt",c),(T=(j=r.io)==null?void 0:j.off)==null||T.call(j,"reconnect_error",u),(P=(R=r.io)==null?void 0:R.off)==null||P.call(R,"reconnect_failed",p)}},[e]),l.useEffect(()=>{const r=s=>{var o;Ws.error("WebGL CONTEXT LOST",{tagName:(o=s.target)==null?void 0:o.tagName,mem:Wa()})},n=s=>{var o;Ws.info("WebGL context restored",{tagName:(o=s.target)==null?void 0:o.tagName})};return document.addEventListener("webglcontextlost",r,!0),document.addEventListener("webglcontextrestored",n,!0),()=>{document.removeEventListener("webglcontextlost",r,!0),document.removeEventListener("webglcontextrestored",n,!0)}},[]),l.useEffect(()=>{const r=s=>{var o,i,c;try{const u=s.message||"";if(u.includes("websocket error")||u.includes("WebSocket"))return;l0.error("window.error",{message:u,filename:s.filename,line:s.lineno,col:s.colno,stack:(c=(i=(o=s.error)==null?void 0:o.stack)==null?void 0:i.slice)==null?void 0:c.call(i,0,1e3),mem:Wa()})}catch{}},n=s=>{var o,i,c,u;try{const p=s.reason,d=typeof p=="string"?p:(p==null?void 0:p.message)||"unhandledrejection";if((p==null?void 0:p.name)==="AbortError"||(o=d==null?void 0:d.includes)!=null&&o.call(d,"aborted")||d==="NO_AUTH_TOKEN")return;l0.error("unhandledrejection",{message:(i=d==null?void 0:d.slice)==null?void 0:i.call(d,0,500),stack:(u=(c=(p==null?void 0:p.stack)||"").slice)==null?void 0:u.call(c,0,1e3),mem:Wa()})}catch{}};return window.addEventListener("error",r),window.addEventListener("unhandledrejection",n),()=>{window.removeEventListener("error",r),window.removeEventListener("unhandledrejection",n)}},[]),l.useEffect(()=>{if(!performance.memory)return;const r=setInterval(()=>{const n=Wa();n&&n.usedJSHeapMB>150&&La.warn("HIGH_MEMORY",n)},3e4);return()=>clearInterval(r)},[]),l.useEffect(()=>{if(typeof PerformanceObserver>"u")return;let r=null;try{r=new PerformanceObserver(n=>{for(const s of n.getEntries()){const o=Math.round(s.duration);o>200&&La.warn("LONG_TASK",{durationMs:o,name:s.name,startTime:Math.round(s.startTime),mem:Wa()})}}),r.observe({type:"longtask",buffered:!1})}catch{}return()=>{try{r==null||r.disconnect()}catch{}}},[]),l.useEffect(()=>{let s=Date.now();const o=setInterval(()=>{const i=Date.now(),c=i-s;c>5e3&&La.error("EVENT_LOOP_STALL",{gapMs:c,expectedMs:2e3,mem:Wa()}),s=i},2e3);return()=>clearInterval(o)},[]),l.useEffect(()=>{try{window.__dumpLogs=()=>{const r=Xf();return console.table(r.map(n=>({time:new Date(n.t).toISOString().slice(11,23),tag:n.tag,level:n.level,msg:n.msg,data:n.data?JSON.stringify(n.data).slice(0,120):""}))),r},window.__dumpCrashLogs=()=>{const r=_x();return console.table(r.map(n=>{var s;return{time:new Date(n.t).toISOString().slice(11,23),tag:n.tag,level:n.level,msg:n.msg,data:typeof n.data=="string"?n.data.slice(0,120):(s=JSON.stringify(n.data))==null?void 0:s.slice(0,120)}})),r}}catch{}},[]),null}function Eke(){const[e,t]=l.useState(()=>{var c;try{return((c=window.localStorage)==null?void 0:c.getItem("sfxDebug"))==="1"}catch{return!1}}),[r,n]=l.useState([]),s=200,o=l.useRef(null);if(l.useEffect(()=>{if(!e)return;const c=u=>{try{const p=u.detail;n(d=>{const f=[...d,p];return f.length>s&&f.splice(0,f.length-s),f})}catch{}};return window.addEventListener("sfx:debug",c),()=>window.removeEventListener("sfx:debug",c)},[e]),!e)return null;const i=l.useMemo(()=>r.map(c=>{const p=[new Date(c.t||Date.now()).toLocaleTimeString(),c.kind];return c.key&&p.push(c.key),c.volume!=null&&p.push(`v=${c.volume}`),c.rate!=null&&p.push(`r=${c.rate}`),c.reason&&p.push(`(${c.reason})`),p.join(" ")}),[r]);return l.useEffect(()=>{var c;try{(c=o.current)==null||c.scrollTo({top:o.current.scrollHeight})}catch{}},[i.length]),a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[a.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"SFX Debug"}),a.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[a.jsx("button",{className:"btn btn-xxs",onClick:()=>n([]),children:"Clear"}),a.jsx("button",{className:"btn btn-xxs",onClick:()=>{t(!1);try{localStorage.removeItem("sfxDebug")}catch{}},children:"Close"})]})]}),a.jsx("div",{ref:o,style:{maxHeight:196,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:i.map((c,u)=>a.jsx("div",{children:c},u))})]})}function Pke(){const[e,t]=l.useState(()=>{var c;try{const p=new URL(window.location.href).searchParams.get("rtcDebug")==="1",d=((c=window.localStorage)==null?void 0:c.getItem("rtcDebug"))==="1",f=window.__RTC_DEBUG__===!0;return p||d||f}catch{return!1}}),[r,n]=l.useState(()=>{try{return Xf().filter(c=>(c==null?void 0:c.tag)==="RTC")}catch{return[]}}),s=400,o=l.useRef(null);if(l.useEffect(()=>{const c=p=>{p.key==="rtcDebug"&&t(p.newValue==="1")};window.addEventListener("storage",c),window.rtcDebugOpen=()=>t(!0),window.rtcDebugClose=()=>t(!1);const u=()=>{try{new URL(window.location.href).searchParams.get("rtcDebug")==="1"&&t(!0)}catch{}};return window.addEventListener("popstate",u),()=>{window.removeEventListener("storage",c),window.removeEventListener("popstate",u);try{delete window.rtcDebugOpen,delete window.rtcDebugClose}catch{}}},[]),l.useEffect(()=>{if(!e)return;const c=u=>{try{const p=u.detail;if(!p||p.tag!=="RTC")return;n(d=>{const f=[...d,p];return f.length>s&&f.splice(0,f.length-s),f})}catch{}};return window.addEventListener("fe:log",c),()=>window.removeEventListener("fe:log",c)},[e]),!e)return null;const i=l.useMemo(()=>r.map(c=>{var m,h;const u=new Date(c.t||Date.now()).toLocaleTimeString(),p=((h=(m=c.level)==null?void 0:m.toUpperCase)==null?void 0:h.call(m))||"LOG",d=c.msg||"",f=c.data?JSON.stringify(c.data):"";return`${u} ${p} ${d} ${f}`}),[r]);return l.useEffect(()=>{var c;try{(c=o.current)==null||c.scrollTo({top:o.current.scrollHeight})}catch{}},[i.length]),a.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:[a.jsxs("div",{style:{display:"flex",alignItems:"center",padding:"6px 8px",borderBottom:"1px solid rgba(255,255,255,0.15)"},children:[a.jsx("strong",{style:{fontSize:12,letterSpacing:.3},children:"RTC Debug"}),a.jsxs("div",{style:{marginLeft:"auto",display:"flex",gap:6},children:[a.jsx("button",{className:"btn btn-xxs",onClick:()=>n([]),children:"Clear"}),a.jsx("button",{className:"btn btn-xxs",onClick:()=>{try{navigator.clipboard.writeText(JSON.stringify(r,null,2))}catch{}},children:"Copy"}),a.jsx("button",{className:"btn btn-xxs",onClick:()=>{t(!1);try{localStorage.removeItem("rtcDebug"),window.__RTC_DEBUG__=!1}catch{}},children:"Close"})]})]}),a.jsx("div",{ref:o,style:{maxHeight:212,overflow:"auto",padding:"6px 8px",fontFamily:"monospace",fontSize:11,lineHeight:1.35},children:i.map((c,u)=>a.jsx("div",{children:c},u))})]})}function Cke(){const{meId:e}=Zr(),t=Hr(),r=Ia(),{info:n,onIdle:s}=As(),o=Is(),i=(o==null?void 0:o.room)??null,c=(o==null?void 0:o.setRoom)??null,{leaveRoom:u}=Yo(),p=ot.useRef(!1);return ot.useEffect(()=>{const d=r.pathname||"";/^\/(room|poker\/room)\//.test(d)||(p.current=!1)},[r.pathname]),Ba({onPlayerBalanceUpdated:({playerId:d,balance:f})=>{if(!(!e||d!==e)&&typeof f=="number"&&!(f>0)&&!p.current&&!vm){p.current=!0;try{i!=null&&i.id&&typeof u=="function"&&u(i.id)}catch{}try{c==null||c(null)}catch{}try{n("Out of Chips","Returning to Lobby…")}catch{}try{t("/lobby",{replace:!0})}catch{}}}}),null}function Rke(e){switch(e){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 e}}function Tke(){const e=lO(),t=Hr(),r=l.useRef(null),{getGameRoute:n}=ib(),s=e==null?void 0:e.currentInvite;if(l.useEffect(()=>{if(!s)return;const u=d=>{d.key==="Escape"&&(e==null||e.dismissCurrentInvite())},p=d=>{r.current&&!r.current.contains(d.target)&&(e==null||e.dismissCurrentInvite())};return document.addEventListener("keydown",u),document.addEventListener("mousedown",p),()=>{document.removeEventListener("keydown",u),document.removeEventListener("mousedown",p)}},[s,e]),!s)return null;const o=async()=>{const u=await(e==null?void 0:e.acceptInvite(s.inviteId));if(u!=null&&u.ok&&u.roomId){const p=n(s.gameMode,u.roomId);t(p)}},i=()=>{e==null||e.declineInvite(s.inviteId)},c=a.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:a.jsxs("div",{className:"modal-panel",role:"dialog","aria-modal":"true","aria-label":"Game invite",ref:r,style:{maxWidth:340,position:"relative",background:"linear-gradient(135deg, #1a1a2e 0%, #16213e 100%)",borderRadius:12,padding:"24px",boxShadow:"0 8px 32px rgba(0, 0, 0, 0.5)",border:"1px solid rgba(255, 215, 0, 0.2)"},children:[a.jsx("button",{className:"modal-close",onClick:i,"aria-label":"Close",style:{position:"absolute",top:8,right:8,background:"none",border:"none",color:"#fff",fontSize:"1.5rem",cursor:"pointer",opacity:.7},children:"×"}),a.jsx("h3",{className:"modal-title",style:{marginBottom:12,textAlign:"center",color:"#fff"},children:"🎲 Game Invite"}),a.jsxs("div",{style:{textAlign:"center",marginBottom:16,color:"#fff"},children:[a.jsxs("p",{style:{fontSize:"1rem",margin:"8px 0"},children:[a.jsx("strong",{children:s.fromUserName})," has invited you to play"]}),a.jsx("p",{style:{fontSize:"1.25rem",fontWeight:600,color:"var(--gold, #ffc107)",margin:"8px 0"},children:Rke(s.gameMode)}),a.jsxs("p",{style:{fontSize:"0.875rem",opacity:.8,margin:"4px 0"},children:["Room: ",s.roomName]})]}),a.jsxs("div",{style:{display:"flex",gap:12,marginTop:20,justifyContent:"center"},children:[a.jsx("button",{className:"felt-btn btn--ghost",onClick:i,style:{minWidth:100},children:"Decline"}),a.jsx("button",{className:"felt-btn felt-btn--primary",onClick:o,style:{minWidth:100},children:"Join Game"})]})]})});return ws.createPortal(c,document.body)}function jke(){const e=Na(),t=l.useRef(0);return l.useEffect(()=>{let r;const n=()=>{var s;try{const o=li(),i=o.length?o[o.length-1].ts:0,c=Date.now();if(!e.connected&&c-i>2e4&&c-t.current>1e4){t.current=c,console.warn("[watchdog] No emits in 20s and socket disconnected. Forcing connect attempt…",{lastEmitTs:i,emits:o});try{const u=!!(e!=null&&e.__allowCookieAuth);is(e,"SocketWatchdog",{allowCookieSession:u})}catch{}}}catch{}r=setTimeout(n,2e3),(s=r.unref)==null||s.call(r)};return n(),()=>clearTimeout(r)},[e]),null}function Ike({children:e,skip:t=!1,maxWaitMs:r=4e3,appTarget:n=""}){const[s,o]=l.useState(!1),[i,c]=l.useState({loaded:0,total:0}),[u,p]=l.useState(!1),d=l.useRef(!1),f=zr.isNativePlatform(),m=n==="zentara",h=i.total>0?Math.round(i.loaded/i.total*100):0;l.useEffect(()=>{(!f||t)&&o(!0)},[f,t]);const b=l.useCallback(async()=>{if(d.current)return;d.current=!0,p(!0);try{await yn()}catch{}Lye();const[g,y]=await Promise.all([S8(r),Mye(r)]);(g||lv())&&y||console.warn("[SoundPreloadScreen] Preload timeout, showing app",{audioReady:g||lv(),videosReady:y}),o(!0)},[r]);return l.useEffect(()=>{if(!u||s)return;const g=setInterval(()=>{const y=k8();c(y),lv()&&o(!0)},50);return()=>clearInterval(g)},[u,s]),s?a.jsx(a.Fragment,{children:e}):a.jsxs("div",{className:`sound-preload-screen${m?" sound-preload-screen--zentara":""}`,onClick:b,children:[m&&a.jsxs("div",{className:"sound-preload-atmosphere","aria-hidden":"true",children:[a.jsx("span",{className:"sound-preload-orbit sound-preload-orbit--outer"}),a.jsx("span",{className:"sound-preload-orbit sound-preload-orbit--inner"}),a.jsx("span",{className:"sound-preload-scanline"})]}),a.jsx("div",{className:"sound-preload-content",children:a.jsx("div",{className:"sound-preload-panel",children:u?a.jsxs("div",{className:"sound-preload-loading",role:"status","aria-live":"polite",children:[a.jsx("span",{className:"sound-preload-spinner","aria-hidden":"true"}),a.jsx("p",{className:"sound-preload-status",children:m?"Synchronizing audio systems":"Loading game"}),a.jsx("div",{className:"sound-preload-progress",children:a.jsx("div",{className:"sound-preload-progress-bar",style:{width:`${h}%`}})}),i.total>0&&a.jsxs("p",{className:"sound-preload-progress-label",children:[h,"%"]})]}):a.jsxs(a.Fragment,{children:[m&&a.jsx("p",{className:"sound-preload-eyebrow",children:"Galactic Command Link"}),a.jsx(UL,{className:"sound-preload-brand"}),a.jsx("p",{className:"sound-preload-prompt",children:m?"Enable audio to enter the command deck.":"Enable audio to begin."}),a.jsx("button",{className:"sound-preload-start",type:"button",children:m?"Enter Zentara":"Start"}),a.jsx("p",{className:"sound-preload-hint",children:"Tap once to initialize game audio"})]})})})]})}function Nke(){const e=ji();return l.useEffect(()=>{const t=r=>{var s;const n=(s=r==null?void 0:r.detail)==null?void 0:s.amount;typeof n=="number"&&n>0&&e.success(`+${n.toLocaleString()} daily credits added!`,{title:"Daily Bonus",duration:4500})};return window.addEventListener("daily-grant",t),()=>window.removeEventListener("daily-grant",t)},[e]),null}function Mke(){return hO(),null}const OT=["#ffd700","#f4c430","#ff6b6b","#4ecdc4","#45b7d1","#96ceb4","#ff9ff3","#54a0ff","#5f27cd","#ee5a24","#0abde3","#10ac84"],Lke=6e3;function Dke(e=40){return l.useMemo(()=>Array.from({length:e},(t,r)=>({left:`${Math.random()*100}%`,background:OT[r%OT.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"})),[e])}function Oke(){var p;const e=Na(),{refreshUser:t,meId:r}=Zr(),[n,s]=l.useState(null),o=Dke();l.useEffect(()=>{if(!e)return;const d=f=>{!f||typeof f.newLevel!="number"||f.playerId&&r&&f.playerId!==r||(s(f),t({force:!0}))};return e.on("sp:level_up",d),()=>{e.off("sp:level_up",d)}},[e,t,r]),l.useEffect(()=>{if(!n)return;const d=window.setTimeout(()=>s(null),Lke);return()=>window.clearTimeout(d)},[n]);const i=l.useCallback(()=>s(null),[]);if(!n)return null;const c=n.levelName||((p=ul.find(d=>d.level===n.newLevel))==null?void 0:p.name)||`Level ${n.newLevel}`,u=a.jsx("div",{className:"levelup-backdrop",onClick:i,role:"dialog","aria-modal":"true","aria-label":"Level up celebration",children:a.jsxs("div",{className:"levelup-card",onClick:d=>d.stopPropagation(),children:[a.jsx("div",{className:"levelup-confetti",children:o.map((d,f)=>a.jsx("div",{className:"levelup-confetti-piece",style:d},f))}),a.jsx("div",{className:"levelup-stars",children:"⭐⭐⭐"}),a.jsx("p",{className:"levelup-title",children:"Table Cleared"}),a.jsxs("p",{className:"levelup-level",children:[n.oldLevel," to ",n.newLevel]}),a.jsx("p",{className:"levelup-name",children:c}),a.jsxs("p",{className:"levelup-subtitle",children:["You defeated every bot. Level ",n.newLevel," opponents start with z",n.newLevel*1e3," and play more aggressively."]}),a.jsx("button",{className:"levelup-btn",onClick:i,children:"Let’s Go"})]})});return ws.createPortal(u,document.body)}const Rc=DF(),zke=Rc==="skills"?XAe:Rc==="ceelo"?sAe:Rc==="craps"?oAe:Rc==="poker"?iAe:Rc==="zentara"?$Ae:Rc==="unified"?KAe:$xe;var ZT,KT,QT,JT;try{const e=zr.getPlatform();if((e==="ios"||e==="android")&&(Promise.resolve((KT=(ZT=Km).enable)==null?void 0:KT.call(ZT,{config:{customColorsForSystemBars:!0,statusBarColor:"#00000000",statusBarContent:"light",navigationBarColor:"#00000000",navigationBarContent:"light"}})).catch(()=>{}),Tp().then(t=>{t&&(xl().catch(r=>console.warn("[App] AdMob interstitial warmup failed:",r)),X5().catch(r=>console.warn("[App] AdMob rewarded warmup failed:",r)))}).catch(t=>console.warn("[App] AdMob init failed:",t))),e==="ios"||e==="android"){let t=0,r=0;const o=e==="ios"?47:36,i=document.documentElement,c=async()=>{var p,d;try{const f=Km.getSafeAreaInsets;if(typeof f!="function")return;const m=await f.call(Km),h=Math.round(((p=m==null?void 0:m.insets)==null?void 0:p.top)??(m==null?void 0:m.top)??0),b=Math.round(((d=m==null?void 0:m.insets)==null?void 0:d.bottom)??(m==null?void 0:m.bottom)??0),g=window.innerHeight>window.innerWidth;g&&h>0&&(t=h),g&&b>0&&(r=b);const y=g?h>0?h:t:h,x=g?b>0?b:r:b,v=Math.max(y,o);i.style.setProperty("--safe-top-global",`${v}px`),i.style.setProperty("--safe-bottom",`${x}px`)}catch{}};c();const u=()=>{setTimeout(c,50),setTimeout(c,150),setTimeout(c,300),setTimeout(c,500)};window.addEventListener("orientationchange",u),window.addEventListener("resize",c);try{(JT=(QT=Km).addListener)==null||JT.call(QT,"safeAreaChanged",c)}catch{}if(e==="ios")try{document.documentElement.classList.add("is-native-app","platform-ios"),document.body.classList.add("is-native-app","platform-ios")}catch{}}}catch{}if(zr.getPlatform()==="android"){const r=()=>{let n=24;const s=window.visualViewport;if(s&&typeof window.innerHeight=="number"){const o=Math.max(0,Math.round(window.innerHeight-(s.height+s.offsetTop)));o>0&&o<64&&(n=o)}document.documentElement.style.setProperty("--android-safe-area-bottom",`${n}px`),document.documentElement.style.setProperty("--android-safe-area-top","36px"),document.documentElement.style.setProperty("--android-extra-bottom","24px")};r(),window.addEventListener("resize",r),window.addEventListener("orientationchange",()=>setTimeout(r,100));try{document.documentElement.classList.add("is-native-app","platform-android"),document.body.classList.add("is-native-app","platform-android")}catch{}}function Bke(){const{loaded:e,walletEnabled:t}=hke(),r=Hr(),n=Ia(),s=l.useRef(null),o=l.useRef(Date.now()),i=l.useCallback(u=>/^\/room\//.test(u)||/^\/poker\/room\//.test(u)||/^\/zentara\/(match|room)\//.test(u)||/^\/match\//.test(u),[]);return l.useEffect(()=>{const u=n.pathname||"";i(u)||A_()},[i,n.pathname]),l.useEffect(()=>{const u=()=>{if(document.visibilityState==="hidden"){A_();return}document.visibilityState==="visible"&&i(n.pathname||"")&&XR()};document.addEventListener("visibilitychange",u);let p=null,d=null,f=!1;return(async()=>{var m,h;try{const{App:b}=await Cr(async()=>{const{App:g}=await Promise.resolve().then(()=>xm);return{App:g}},void 0,import.meta.url);if(f)return;if(p=await b.addListener("pause",()=>{A_()}),d=await b.addListener("resume",()=>{i(n.pathname||"")&&XR()}),f){try{await((m=p==null?void 0:p.remove)==null?void 0:m.call(p))}catch{}try{await((h=d==null?void 0:d.remove)==null?void 0:h.call(d))}catch{}p=null,d=null}}catch{}})(),()=>{var m,h;f=!0;try{document.removeEventListener("visibilitychange",u)}catch{}try{(m=p==null?void 0:p.remove)==null||m.call(p)}catch{}try{(h=d==null?void 0:d.remove)==null||h.call(d)}catch{}p=null,d=null}},[i,n.pathname]),l.useEffect(()=>{try{Vz()}catch{}},[n.pathname,n.search]),l.useEffect(()=>{const p=()=>{s.current&&window.clearTimeout(s.current),s.current=window.setTimeout(()=>{n.search.includes("autoplay=1")||n.pathname!=="/lobby"&&r("/lobby",{replace:!0})},24e4)},d=()=>{o.current=Date.now(),p()};p();const f=()=>d(),m=()=>d(),h=()=>{document.visibilityState==="visible"&&d()};return window.addEventListener("pointerdown",f,{capture:!0}),window.addEventListener("keydown",m,{capture:!0}),document.addEventListener("visibilitychange",h),()=>{s.current&&window.clearTimeout(s.current),window.removeEventListener("pointerdown",f,{capture:!0}),window.removeEventListener("keydown",m,{capture:!0}),document.removeEventListener("visibilitychange",h)}},[r,n.pathname]),e?(u=>t?a.jsx(pke,{children:u}):a.jsx(a.Fragment,{children:u}))(a.jsx(IF,{children:a.jsx(DY,{children:a.jsxs(tpe,{children:[a.jsx(nke,{}),a.jsx(F8,{children:a.jsx(tZ,{children:a.jsxs(TF,{children:[a.jsx(ike,{}),a.jsx(ese,{children:a.jsx(Zae,{children:a.jsx(Are,{children:a.jsx(Ppe,{children:a.jsx(kre,{children:a.jsx(rse,{children:a.jsxs(OF,{children:[a.jsx(Nke,{}),a.jsxs(Wz,{children:[a.jsx(zke,{}),a.jsx(Tke,{}),a.jsx(Cke,{}),a.jsx(kke,{}),a.jsx(Ske,{}),a.jsx(Eke,{}),a.jsx(Pke,{}),a.jsx(jke,{}),a.jsx(Oke,{})]})]})})})})})})})]})})})]})})})):a.jsxs("div",{className:"HomeScreen theme-casino home-fixed-root",children:[a.jsx(Ja,{className:"page-home-screen"}),a.jsx("div",{className:"home-preloader",children:a.jsx("div",{className:"home-preloader__spinner"})})]})}function Fke(){return l.useEffect(()=>{const e={current:null};return e.current=()=>{try{yn()}catch{}e.current&&(window.removeEventListener("pointerdown",e.current,{capture:!0}),e.current=null)},window.addEventListener("pointerdown",e.current,{capture:!0}),()=>{e.current&&(window.removeEventListener("pointerdown",e.current,{capture:!0}),e.current=null)}},[]),l.useEffect(()=>{try{Gz()}catch{}},[]),a.jsxs(Ike,{maxWaitMs:5e3,appTarget:Rc,children:[a.jsx(Mke,{}),a.jsx(bF,{children:a.jsx(oB,{children:a.jsx(mke,{children:a.jsx(Bke,{})})})})]})}function Uke(e){const t=(e==null?void 0:e.healthIntervalMs)??8e3,r=(e==null?void 0:e.maxRetriesPerPlay)??3,n=!!(e!=null&&e.debug),[s,o]=l.useState(!1),[i,c]=l.useState(!1),[u,p]=l.useState(1),d=l.useRef({plays:0,failures:0,recovered:0,rebuilds:0}),f=l.useRef({}),m=l.useRef(!0),h=l.useRef(!1),b=l.useRef(null),g=(...T)=>{n&&console.log("[audio-engine]",...T)},y=l.useCallback(()=>{if(s||h.current)return;h.current=!0;const T=()=>{try{dv==null||dv(),o(!0),g("activated via user gesture")}catch(R){g("activation error",R)}window.removeEventListener("pointerdown",T),window.removeEventListener("touchstart",T),window.removeEventListener("keydown",T)};window.addEventListener("pointerdown",T,{passive:!0,once:!0}),window.addEventListener("touchstart",T,{passive:!0,once:!0}),window.addEventListener("keydown",T,{passive:!0,once:!0})},[s,g]);l.useEffect(()=>{y()},[y]);const x=T=>{try{typeof LS=="function"&&(LS(T),d.current.rebuilds+=1,g("rebuild asset",T))}catch(R){g("rebuild asset failed",T,R)}},v=l.useCallback(async(T,R)=>{if(i&&!(R!=null&&R.allowDuringMute))return!1;s||y();const P=(R==null?void 0:R.volume)??u;let k=0;const E=()=>new Promise(M=>{let C=!1;const I=L=>{C||(C=!0,M(L))};try{const L=pv==null?void 0:pv(T,{volume:P,rate:R==null?void 0:R.rate,loop:R==null?void 0:R.loop});L&&typeof L.then=="function"?L.then(()=>I(!0)).catch(()=>I(!1)):setTimeout(()=>I(!0),0)}catch(L){g("play throw",T,L),I(!1)}});for(;k<=r;){if(await E())return d.current.plays+=1,k>0&&(d.current.recovered+=1),f.current[T]=0,!0;if(k+=1,d.current.failures+=1,f.current[T]=(f.current[T]||0)+1,g("play failed",T,"attempt",k),f.current[T]>=3&&x(T),k>r)break;await new Promise(C=>setTimeout(C,60*k))}return!1},[i,s,y,u,r,g]),A=l.useCallback(T=>{try{fv==null||fv(T)}catch{}},[]),_=l.useCallback(T=>{c(T)},[]),w=l.useCallback(T=>{p(Math.max(0,Math.min(1,T)))},[]);return l.useEffect(()=>{const T=async()=>{if(!m.current||!s)return;const R=d.current,P=R.plays+R.failures;if(P>=4){const k=R.failures/(P||1);if(k>.4){g("elevated failure ratio",k.toFixed(2),"running probe");try{await v("__probe__",{volume:0,allowDuringMute:!0})||(o(!1),h.current=!1,y(),g("probe failed → deactivated, awaiting gesture"))}catch(E){g("probe error",E)}}}};return b.current=window.setInterval(T,t),()=>{b.current&&window.clearInterval(b.current)}},[t,s,v,y,g]),l.useEffect(()=>{const T=()=>{document.visibilityState==="visible"&&s&&v("__probe__",{volume:0,allowDuringMute:!0})};return document.addEventListener("visibilitychange",T),()=>document.removeEventListener("visibilitychange",T)},[s,v]),l.useEffect(()=>()=>{m.current=!1},[]),{play:v,preload:A,setMuted:_,setVolume:w,activationPrompt:y,isActivated:s,isMuted:i,volume:u,stats:d.current}}function qke({children:e,config:t}){return Uke(t),a.jsx(a.Fragment,{children:e})}const Vke=[{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 Hke({id:e,variant:t}){const r=Vke.find(o=>o.id===e);if(!r)return a.jsx("div",{style:{color:"#fff",padding:40},children:"Avatar not found"});const n=(t||"").toLowerCase(),s=n==="win"?"win":n==="lose"?"lose":n==="push"?"push":"";return a.jsxs("div",{className:"avatar-shot"+(s?` variant-${s}`:""),children:[a.jsxs("div",{className:"avatar-shot__frame",children:[a.jsx("img",{src:r.file,alt:r.label,className:"avatar-shot__img"}),s&&a.jsx("div",{className:"avatar-shot__fx fx-"+s})]}),a.jsx("div",{className:"avatar-shot__label",children:r.label})]})}function Wke(e,t){const r=/^\/capture\/avatar\/([a-z])$/i.exec(e);if(!r)return null;const s=new URLSearchParams(t).get("variant")||void 0;return{id:r[1].toLowerCase(),variant:s}}const Gke=[{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"}],Zz={"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 Xke(e){const t=/^\/capture\/cee-lo\/([a-z0-9-]+)$/i.exec(e);if(!t)return null;const r=t[1];return Zz[r]?{scene:r}:null}function Kz({scene:e}){const t=Zz[e];return t?a.jsx("div",{className:"cl-scene"+(t.shake?" fx-bg-shake":""),"data-scene":e,children:a.jsxs("div",{className:"cl-table",children:[a.jsx(Yke,{banker:t.banker,results:t.results,chipDeltas:t.chipDeltas}),a.jsx(Zke,{dice:t.dice,rolling:t.rolling}),t.point!=null&&t.point!==void 0&&a.jsx(Qke,{point:t.point}),t.showRoll&&a.jsx(Jke,{}),t.roundSummary&&a.jsx($ke,{text:t.roundSummary})]})}):a.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function Yke({banker:e,results:t,chipDeltas:r}){return a.jsx("div",{className:"cl-seats",children:Gke.map(n=>{const s=(t==null?void 0:t[n.id])||"idle";return a.jsxs("div",{className:"cl-seat"+(n.id===e?" is-banker":"")+(s!=="idle"?` res-${s}`:""),children:[a.jsxs("div",{className:"cl-seat__avatar",children:[a.jsx("img",{src:n.avatar,alt:n.name}),s!=="idle"&&a.jsx("div",{className:"cl-seat__fx fx-"+s})]}),a.jsx("div",{className:"cl-seat__name",children:n.name}),(r==null?void 0:r[n.id])&&a.jsx("div",{className:"cl-seat__delta",children:r[n.id]})]},n.id)})})}function Zke({dice:e,rolling:t}){return a.jsx("div",{className:"cl-dice","aria-label":"dice",children:e.map((r,n)=>a.jsx(Kke,{value:r,rolling:t},n))})}function Kke({value:e,rolling:t}){const r=e===0?"?":String(e);return a.jsx("div",{className:"cl-die"+(t?" is-rolling":""),children:r})}function Qke({point:e}){return a.jsxs("div",{className:"cl-point",children:["POINT: ",e]})}function Jke(){return a.jsx("div",{className:"cl-roll-btn",children:"ROLL"})}function $ke({text:e}){return a.jsx("div",{className:"cl-summary",children:e})}const vf={on:()=>vf,off:()=>vf,once:()=>vf,emit:()=>vf,connected:!1,id:"ad-stub"};function e1e(e,t,r){const[n,s]=l.useState(e),o=l.useRef(!1),i=l.useRef(-1);return l.useEffect(()=>{if(o.current)return;o.current=!0;const c=performance.now();try{window.__adStartDate=Date.now()}catch{}let u=0;const p=[...t].sort((f,m)=>f.at-m.at),d=()=>{const f=(performance.now()-c)/1e3;let m=i.current;const h=[];for(let b=i.current+1;b<p.length&&p[b].at<=f;b++)h.push(p[b].state),m=b;h.length>0&&(i.current=m,s(b=>h.reduce((g,y)=>({...g,...y}),b))),u=requestAnimationFrame(d)};return u=requestAnimationFrame(d),()=>cancelAnimationFrame(u)},[]),n}const t1e={phase:"comeOut",point:null,pendingBets:[],balance:5e3,everyoneReady:!1,showReadyButton:!0,canRoll:!1,shooterName:"You",othersTotals:{},flashLabel:null},Wn=(e,t)=>({id:`${e}-${t}-${Math.random().toString(36).slice(2,7)}`,type:e,amount:t}),Qz={comeout:[{at:.5,state:{pendingBets:[Wn("pass",100)]}},{at:1.6,state:{pendingBets:[Wn("pass",100),Wn("pass",100)]}},{at:2.4,state:{pendingBets:[Wn("pass",200),Wn("field",50)],othersTotals:{pass:350}}},{at:3.4,state:{everyoneReady:!0,showReadyButton:!1,canRoll:!0}},{at:5,state:{flashLabel:"NATURAL · 7",balance:5300}},{at:6.5,state:{flashLabel:null,pendingBets:[],canRoll:!1,everyoneReady:!1,showReadyButton:!0}}],"point-six":[{at:.3,state:{phase:"point",point:6,pendingBets:[Wn("pass",200)]}},{at:1,state:{pendingBets:[Wn("pass",200),Wn("place6",60)]}},{at:1.8,state:{pendingBets:[Wn("pass",200),Wn("place6",60),Wn("place8",60)]}},{at:2.6,state:{pendingBets:[Wn("pass",200),Wn("place6",60),Wn("place8",60),Wn("oddsPass",200)],othersTotals:{pass:500,place6:120}}},{at:3.5,state:{everyoneReady:!0,showReadyButton:!1,canRoll:!0}},{at:5.4,state:{flashLabel:"POINT · 6",balance:5660}},{at:7,state:{flashLabel:null,phase:"comeOut",point:null,pendingBets:[],canRoll:!1,everyoneReady:!1,showReadyButton:!0}}],highlight:[{at:.4,state:{pendingBets:[Wn("pass",100)]}},{at:1.2,state:{pendingBets:[Wn("pass",100),Wn("atsAll",25)]}},{at:2,state:{phase:"point",point:8,pendingBets:[Wn("pass",100),Wn("atsAll",25),Wn("oddsPass",100)]}},{at:2.8,state:{pendingBets:[Wn("pass",100),Wn("atsAll",25),Wn("oddsPass",100),Wn("place6",60),Wn("place8",60)]}},{at:3.6,state:{everyoneReady:!0,showReadyButton:!1,canRoll:!0,othersTotals:{pass:400,place6:120}}}]};function r1e(e,t){const r=/^\/capture\/craps-ad\/([a-z0-9-]+)$/i.exec(e);if(!r)return null;const n=r[1];return Qz[n]?{scene:n}:null}function n1e({scene:e}){const t=Qz[e],r=e1e(t1e,t),n=l.useMemo(()=>({onChangeBets:()=>{},onClearAll:()=>{},onRoll:()=>{},onPassTurn:()=>{},onReadyClick:()=>{},onBetDelta:()=>{},onBetsBatch:()=>{},onChargeChange:()=>{}}),[]);return a.jsx(wx.Provider,{value:vf,children:a.jsxs("div",{className:"craps-ad-stage","data-scene":e,children:[a.jsx("div",{className:"craps-ad-stage__panel",children:a.jsx(U5,{roomId:"ad-room",balance:r.balance,point:r.point,phase:r.phase,shooterName:r.shooterName,minBet:25,maxBet:2e3,oddsMultiple:{pass:5,dontPass:5,place:5},chips:[25,100,500,1e3],pendingBets:r.pendingBets,onChangeBets:n.onChangeBets,onClearAll:n.onClearAll,onRoll:n.onRoll,canRoll:r.canRoll,readyPlayers:r.everyoneReady?["ad-me","ad-bot"]:[],meId:"ad-me",everyoneReady:r.everyoneReady,showReadyButton:r.showReadyButton,onReadyClick:n.onReadyClick,readyStateLabel:r.everyoneReady?"Ready":"Get Ready",readyButtonDisabled:!1,countdownSeconds:0,myPlayerLineTotals:{pass:0,dontPass:0},othersTotals:r.othersTotals,myCommittedByType:{},canPassTurn:!1,onBetDelta:n.onBetDelta,onBetsBatch:n.onBetsBatch,onChargeChange:n.onChargeChange})}),r.flashLabel&&a.jsx("div",{className:"craps-ad-stage__flash",children:r.flashLabel},r.flashLabel)]})})}const Jz={"rolling-win":[{at:0,scene:"pre-roll"},{at:1,scene:"rolling"},{at:3.4,scene:"banker-456",flash:"4 · 5 · 6  WIN"},{at:6.2,scene:"payout",flash:null}],"point-chase":[{at:0,scene:"pre-roll"},{at:.8,scene:"rolling"},{at:2.6,scene:"banker-point",flash:"POINT · 6"},{at:4,scene:"rolling"},{at:5.6,scene:"challenger-win",flash:"CHALLENGER WINS"},{at:7.8,scene:"end-round",flash:null}],showdown:[{at:0,scene:"pre-roll"},{at:.6,scene:"rolling"},{at:2.4,scene:"push",flash:"PUSH"},{at:4.2,scene:"rolling"},{at:5.8,scene:"banker-456",flash:"TRIPS!"}]};function a1e(e){const t=/^\/capture\/cee-lo-ad\/([a-z0-9-]+)$/i.exec(e);return t&&Jz[t[1]]?{scene:t[1]}:null}function s1e({scene:e}){var i;const t=Jz[e],[r,n]=l.useState(0),[s,o]=l.useState(((i=t==null?void 0:t[0])==null?void 0:i.flash)??null);return l.useEffect(()=>{if(!t)return;try{window.__adStartDate=Date.now()}catch{}const c=performance.now();let u=0;const p=()=>{const d=(performance.now()-c)/1e3;let f=0;for(let m=0;m<t.length;m++)t[m].at<=d&&(f=m);n(f),o(t[f].flash??null),u=requestAnimationFrame(p)};return u=requestAnimationFrame(p),()=>cancelAnimationFrame(u)},[t]),t?a.jsxs("div",{className:"craps-ad-stage","data-ad":"cee-lo",children:[a.jsx("div",{className:"craps-ad-stage__panel",children:a.jsx(Kz,{scene:t[r].scene})}),s&&a.jsx("div",{className:"craps-ad-stage__flash",children:s},s)]}):a.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}const zT=(e,t,r,n)=>({id:e,displayName:t,credits:5e3,tileIndex:0,inJail:!1,jailTurnsLeft:0,depleted:!1,piece:r,pieceColor:n,armorLevel:1,weaponLevel:1}),$z={"raid-win":{confirmed:{winner:"attacker",attackerHits:28,defenderHits:4,credits:1200}},"raid-loss":{confirmed:{winner:"defender",attackerHits:6,defenderHits:22,credits:-800}}};function o1e(e){const t=/^\/capture\/zentara-ad\/([a-z0-9-]+)$/i.exec(e);return t&&$z[t[1]]?{scene:t[1]}:null}function i1e({scene:e}){const t=$z[e],r=l.useMemo(()=>zT("ad-att","Commander","crimson-dominion","#ff3a3a"),[]),n=l.useMemo(()=>zT("ad-def","Defender","azure-sovereignty","#3aa0ff"),[]);return l.useEffect(()=>{try{window.__adStartDate=Date.now()}catch{}},[]),t?a.jsx("div",{className:"craps-ad-stage","data-ad":"zentara-raid",children:a.jsx(yz,{attacker:r,defender:n,onComplete:()=>{},isSpectator:!1,confirmedResult:t.confirmed})}):a.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}const e3={"royal-flush":[{at:0,hole:["AH","KH"],holeRevealed:{first:!0,both:!1},board:[],pot:600,flash:null,win:null},{at:.6,holeRevealed:{first:!0,both:!0}},{at:1.4,board:["QH","JH","10H"],flash:"FLOP"},{at:2.4,flash:null},{at:3,board:["QH","JH","10H","2C"],flash:"TURN"},{at:4,flash:null},{at:4.8,board:["QH","JH","10H","2C","5D"],pot:1850},{at:5.8,flash:"ROYAL FLUSH",win:{amount:1850,label:"+1,850"}}],"full-house":[{at:0,hole:["8S","8D"],holeRevealed:{first:!0,both:!0},board:["8H","KS","KH"],pot:480,flash:"FLOP",win:null},{at:1.5,flash:null},{at:2.2,board:["8H","KS","KH","4C"],flash:"TURN"},{at:3.4,flash:null},{at:4.2,board:["8H","KS","KH","4C","2S"],pot:1100},{at:5.4,flash:"FULL HOUSE",win:{amount:1100,label:"+1,100"}}],"river-suckout":[{at:0,hole:["AC","AS"],holeRevealed:{first:!0,both:!0},board:["7H","8H","9H"],pot:320,flash:"FLOP",win:null},{at:1.4,flash:null},{at:2,board:["7H","8H","9H","KC"],flash:"TURN"},{at:3.2,flash:null},{at:4,board:["7H","8H","9H","KC","AH"],pot:1450},{at:5,flash:"RIVER · ACES",win:{amount:1450,label:"+1,450"}}]};function l1e(e){const t=/^\/capture\/poker-ad\/([a-z0-9-]+)$/i.exec(e);return t&&e3[t[1]]?{scene:t[1]}:null}const c1e={hole:[],holeRevealed:{first:!1,both:!1},board:[],pot:0,flash:null,win:null};function u1e({scene:e}){const t=e3[e],[r,n]=l.useState(c1e);return l.useEffect(()=>{if(!t)return;try{window.__adStartDate=Date.now()}catch{}const s=performance.now();let o=0,i=-1;const c=[...t].sort((p,d)=>p.at-d.at),u=()=>{const p=(performance.now()-s)/1e3;for(let d=i+1;d<c.length&&c[d].at<=p;d++){const f=c[d];n(m=>({hole:f.hole??m.hole,holeRevealed:f.holeRevealed?{first:f.holeRevealed.first??m.holeRevealed.first,both:f.holeRevealed.both??m.holeRevealed.both}:m.holeRevealed,board:f.board??m.board,pot:f.pot??m.pot,flash:f.flash!==void 0?f.flash:m.flash,win:f.win!==void 0?f.win:m.win})),i=d}o=requestAnimationFrame(u)};return o=requestAnimationFrame(u),()=>cancelAnimationFrame(o)},[t]),t?a.jsxs("div",{className:"craps-ad-stage poker-ad","data-ad":"poker",children:[a.jsxs("div",{className:"poker-ad__felt",children:[a.jsxs("div",{className:"poker-ad__pot",children:["POT · z",r.pot.toLocaleString()]}),a.jsx("div",{className:"poker-ad__board",children:[0,1,2,3,4].map(s=>a.jsx(d1e,{value:r.board[s]},s))}),a.jsx("div",{className:"poker-ad__hero",children:a.jsx(vO,{cards:r.hole,firstRevealed:r.holeRevealed.first,bothRevealed:r.holeRevealed.both})}),r.win&&a.jsx("div",{className:"poker-ad__chip-pop",children:r.win.label},r.win.label)]}),r.flash&&a.jsx("div",{className:"craps-ad-stage__flash",children:r.flash},r.flash)]}):a.jsx("div",{style:{color:"#fff"},children:"Scene not found"})}function d1e({value:e}){if(!e)return a.jsx("div",{className:"poker-ad__board-slot poker-ad__board-slot--empty"});const t=e==="10H"||e==="10S"||e==="10D"||e==="10C"?"10":e.slice(0,-1),r=e.slice(-1),n=r==="H"||r==="D",s=r==="H"?"♥":r==="D"?"♦":r==="C"?"♣":"♠";return a.jsxs("div",{className:`poker-ad__board-slot poker-ad__board-card ${n?"is-red":""}`,children:[a.jsx("span",{className:"poker-ad__board-rank",children:t}),a.jsx("span",{className:"poker-ad__board-suit",children:s})]})}const t3={"find-fortune":{word:"FORTUNE",score:1450,grid:[["F","A","B","C","D","L"],["Q","O","R","T","U","X"],["M","P","R","V","N","E"],["Z","S","T","I","O","P"],["W","A","L","K","M","R"],["B","C","D","E","F","G"]],path:[{r:0,c:0},{r:1,c:1},{r:1,c:2},{r:1,c:3},{r:1,c:4},{r:2,c:4},{r:2,c:5}]},"find-jackpot":{word:"JACKPOT",score:2200,grid:[["Z","X","Q","W","L","M"],["J","A","C","B","D","V"],["Y","P","K","P","F","N"],["T","R","O","O","E","S"],["I","L","M","T","X","A"],["B","C","D","E","F","G"]],path:[{r:1,c:0},{r:1,c:1},{r:1,c:2},{r:2,c:2},{r:2,c:3},{r:3,c:3},{r:4,c:3}]},"find-victory":{word:"VICTORY",score:1800,grid:[["V","A","B","X","M","P"],["Q","I","C","L","D","F"],["Z","X","C","T","E","G"],["L","M","N","O","R","H"],["P","Q","S","T","Y","U"],["W","A","E","I","O","U"]],path:[{r:0,c:0},{r:1,c:1},{r:2,c:2},{r:2,c:3},{r:3,c:3},{r:3,c:4},{r:4,c:4}]}};function p1e(e){const t=/^\/capture\/skills-ad\/([a-z0-9-]+)$/i.exec(e);return t&&t3[t[1]]?{scene:t[1]}:null}const Z_=320;function f1e({scene:e}){var d;const t=t3[e],[r,n]=l.useState(0),[s,o]=l.useState(!1);l.useEffect(()=>{if(!t)return;try{window.__adStartDate=Date.now()}catch{}let f=[];const m=window.setTimeout(()=>{for(let h=0;h<=t.path.length;h++)f.push(window.setTimeout(()=>n(h),h*Z_));f.push(window.setTimeout(()=>o(!0),t.path.length*Z_+400)),f.push(window.setTimeout(()=>{n(0),o(!1)},t.path.length*Z_+2400))},600);return f.push(m),()=>f.forEach(h=>clearTimeout(h))},[t]);const i=l.useMemo(()=>{if(!t)return new Map;const f=new Map;for(let m=0;m<r;m++){const{r:h,c:b}=t.path[m];f.set(`${h},${b}`,m+1)}return f},[t,r]);if(!t)return a.jsx("div",{style:{color:"#fff"},children:"Scene not found"});const c=t.grid.length,u=((d=t.grid[0])==null?void 0:d.length)??0,p=t.word.slice(0,r);return a.jsx("div",{className:"craps-ad-stage skills-ad","data-ad":"skills",children:a.jsxs("div",{className:"skills-ad__stage",children:[a.jsxs("div",{className:"skills-ad__prompt",children:[a.jsx("span",{className:"skills-ad__label",children:"FIND"}),a.jsx("span",{className:"skills-ad__word",children:t.word})]}),a.jsx("div",{className:"skillsGrid skills-ad__grid",style:{gridTemplateColumns:`repeat(${u}, var(--skills-ad-cell))`,gridTemplateRows:`repeat(${c}, var(--skills-ad-cell))`},children:t.grid.map((f,m)=>f.map((h,b)=>{const g=i.get(`${m},${b}`),y=g!=null;return a.jsxs("div",{className:["skillsCell",y?"skillsCell--selected":"skillsCell--idle",s&&y?"skills-ad__cell--win":""].join(" "),children:[h,y&&a.jsx("span",{className:"skillsCellIndex",children:g})]},`${m}-${b}`)}))}),a.jsx("div",{className:"skills-ad__trace",children:p.split("").map((f,m)=>a.jsx("span",{className:"skills-ad__trace-char",children:f},m))}),s&&a.jsxs("div",{className:"skills-ad__win",children:[a.jsx("span",{className:"skills-ad__win-word",children:t.word}),a.jsxs("span",{className:"skills-ad__win-points",children:["+",t.score]})]})]})})}async function m1e(){var e,t,r,n,s,o;try{const i=window.location.protocol;if(!(i==="capacitor:"||i==="ionic:"))return;let u=null;try{u=((t=(e=window.Capacitor)==null?void 0:e.Plugins)==null?void 0:t.Keyboard)||null}catch{}try{const f=window.visualViewport,m=y=>{try{document.documentElement.classList.toggle("kb-open",!!y),document.body.classList.toggle("kb-open",!!y)}catch{}};let h=(f==null?void 0:f.height)??window.innerHeight;const b=()=>{try{h=(f==null?void 0:f.height)??window.innerHeight}catch{}},g=()=>{try{const y=(f==null?void 0:f.height)??window.innerHeight,x=Math.max(0,h-y);m(x>60)}catch{}};f?(f.addEventListener("resize",g),f.addEventListener("scroll",g)):(window.addEventListener("resize",g),window.addEventListener("orientationchange",()=>{b(),g()})),window.addEventListener("focusin",y=>{const x=y==null?void 0:y.target;!!x&&(x.tagName==="INPUT"||x.tagName==="TEXTAREA"||x.isContentEditable)&&m(!0)}),window.addEventListener("focusout",()=>{window.setTimeout(g,120)}),window.setTimeout(()=>{b(),g()},50)}catch{}if(u)try{await u.setResizeMode({mode:"none"})}catch{}const p=()=>{try{document.documentElement.classList.add("kb-open"),document.body.classList.add("kb-open")}catch{}},d=()=>{try{document.documentElement.classList.remove("kb-open"),document.body.classList.remove("kb-open")}catch{}};try{(r=u==null?void 0:u.addListener)==null||r.call(u,"keyboardWillShow",p)}catch{}try{(n=u==null?void 0:u.addListener)==null||n.call(u,"keyboardDidShow",p)}catch{}try{(s=u==null?void 0:u.addListener)==null||s.call(u,"keyboardWillHide",d)}catch{}try{(o=u==null?void 0:u.addListener)==null||o.call(u,"keyboardDidHide",d)}catch{}}catch{}}const BT="fe:crashlog:sent_ts";function h1e(){try{return zr.getPlatform()}catch{return"web"}}function g1e(){try{return"ceelo"}catch{return"unknown"}}async function y1e(){try{const e=_x();if(!e.length)return;const t=Number(localStorage.getItem(BT)||"0"),r=Math.max(...e.map(o=>o.t));if(r<=t)return;const n=za(),s=await fetch(`${n}/api/telemetry/logs`,{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({logs:e.slice(-80),platform:h1e(),userAgent:navigator.userAgent,appTarget:g1e(),sessionId:sessionStorage.getItem("sid")||void 0})});s.ok?(localStorage.setItem(BT,String(r)),_F(),La.info("crash logs uploaded",{count:e.length})):La.warn("crash log upload failed",{status:s.status})}catch(e){try{La.warn("crash log upload error",{err:String(e)})}catch{}}}var $T;try{const e=window.Capacitor,t=($T=e==null?void 0:e.getPlatform)==null?void 0:$T.call(e);(t==="ios"||t==="android")&&Promise.resolve().then(()=>{try{di.notifyAppReady()}catch{}})}catch{}try{y1e()}catch{}try{window.addEventListener("error",e=>{console.error("[global error]",(e==null?void 0:e.error)||(e==null?void 0:e.message)||e)}),window.addEventListener("unhandledrejection",e=>{try{const t=e==null?void 0:e.reason;if((typeof t=="string"?t:t==null?void 0:t.message)==="NO_AUTH_TOKEN")return}catch{}console.error("[unhandled rejection]",(e==null?void 0:e.reason)||e)})}catch{}document.addEventListener("click",e=>{const t=e.target;if(!t)return;const r=t.closest('button, a, [role="button"], .felt-btn, .gold-link');if(r&&!r.closest("[data-no-global-haptic]")&&!(r.tagName==="BUTTON"&&r.disabled)&&r.getAttribute("aria-disabled")!=="true")try{cr("Light")}catch{}},{passive:!0});try{fx()}catch{}try{const e=window,t=e.location.protocol==="capacitor:"||e.location.protocol==="ionic:",r=/^(localhost|127\.0\.0\.1)$/.test(e.location.hostname),n=document.querySelector("script[data-adsbygoogle]");if(!t&&!r&&!n){const s=document.createElement("script");s.async=!0,s.src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-4219446894372985",s.crossOrigin="anonymous",s.setAttribute("data-adsbygoogle","1"),s.onload=()=>{const o=window.adsbygoogle||[];try{o.push({})}catch{}},document.head.appendChild(s)}}catch{}try{const e="sess:initialized";zo.get(e).then(t=>{if(!t)return zo.clearSessionKeys().then(()=>zo.set(e,"1"))}).catch(()=>{})}catch{}function b1e(){var e;window.__APP_MOUNTED__=!0,l.useEffect(()=>{var t;try{const r=window.Capacitor,n=(t=r==null?void 0:r.getPlatform)==null?void 0:t.call(r);(n==="ios"||n==="android")&&Aj().catch(()=>{})}catch{}},[]);try{const t=window.Capacitor,r=(e=t==null?void 0:t.getPlatform)==null?void 0:e.call(t);(r==="ios"||r==="android")&&Promise.resolve().then(()=>{try{di.notifyAppReady()}catch{}})}catch{}return a.jsx(Fke,{})}function K_(){try{const e=Wke(window.location.pathname,window.location.search);if(e){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(Hke,{id:e.id,variant:e.variant})}));return}const t=Xke(window.location.pathname);if(t){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(Kz,{scene:t.scene})}));return}const r=r1e(window.location.pathname,window.location.search);if(r){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(n1e,{scene:r.scene})}));return}const n=a1e(window.location.pathname);if(n){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(s1e,{scene:n.scene})}));return}const s=o1e(window.location.pathname);if(s){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(i1e,{scene:s.scene})}));return}const o=l1e(window.location.pathname);if(o){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(u1e,{scene:o.scene})}));return}const i=p1e(window.location.pathname);if(i){document.body.classList.add("ad-capture"),ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(f1e,{scene:i.scene})}));return}}catch{}ml.createRoot(document.getElementById("root")).render(a.jsx(l.StrictMode,{children:a.jsx(Wz,{children:a.jsx(qke,{config:{debug:!1},children:a.jsx(b1e,{})})})}))}function r3(){try{(()=>{var t,r;try{const n=window.Capacitor,s=(t=n==null?void 0:n.getPlatform)==null?void 0:t.call(n);return s==="ios"||s==="android"?!0:/^(capacitor:|ionic:)/i.test(((r=window.location)==null?void 0:r.protocol)||"")}catch{return!1}})()?(async()=>{try{await ys.init()}catch{}K_();try{await m1e()}catch{}try{ys.healthCheck().catch(()=>{})}catch{}})():K_()}catch{K_()}}function v1e(){r3()}window.APP_TARGET||r3();const T1e=Object.freeze(Object.defineProperty({__proto__:null,default:v1e},Symbol.toStringTag,{value:"Module"}));export{jf as I,SE as N,Jn as a,R1e as b,za as g,Do as i,xf as l,T1e as m};
