try{let e=typeof window<`u`?window:typeof global<`u`?global:typeof globalThis<`u`?globalThis:typeof self<`u`?self:{},t=new e.Error().stack;t&&(e._sentryDebugIds=e._sentryDebugIds||{},e._sentryDebugIds[t]=`fcddf1dd-a0fb-4419-a5a0-be0f9d1758f4`,e._sentryDebugIdIdentifier=`sentry-dbid-fcddf1dd-a0fb-4419-a5a0-be0f9d1758f4`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{$m as t,Ag as n,C as r,Gm as i,Qh as a,Qm as o,Rn as s,Yh as c,Zm as l,_r as u,ah as d,cd as f,ei as p,jg as m,ng as h,xd as g,xn as _,xr as v,yn as y}from"./entry.client-mpghtlrl.js";import{x as b}from"./xds-react-components-ihgca01z.js";import{At as x,dr as S}from"./xds-icons-m106f2fc.js";var C=n(),w=h(),T=e=>{let t=(0,C.c)(7),{handlePress:n,buttonIcon:r,label1:i,label2:a}=e,o;bb0:switch(r){case`Edit`:{let e;t[0]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,w.jsx)(x,{}),t[0]=e):e=t[0],o=e;break bb0}case`Launch`:{let e;t[1]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,w.jsx)(S,{}),t[1]=e):e=t[1],o=e;break bb0}default:o=void 0}let s;return t[2]!==i||t[3]!==a||t[4]!==n||t[5]!==o?(s=(0,w.jsx)(b,{as:`button`,background:`invisible`,label1:i,label2:a,onPress:n,trailingIcon:o}),t[2]=i,t[3]=a,t[4]=n,t[5]=o,t[6]=s):s=t[6],s},E=e(m(),1),D=e=>{let n=(0,C.c)(5),{handlePress:r}=e,{t:i}=t(`SettingsAccountTab`),a;n[0]===i?a=n[1]:(a=i(`Get Game Pass`,{shortKey:`getGamepass_button_label`}),n[0]=i,n[1]=a);let o;return n[2]!==r||n[3]!==a?(o=(0,w.jsx)(v,{alignment:`center`,as:`button`,className:`w-full`,kind:`brand`,onPress:r,size:`large`,children:a}),n[2]=r,n[3]=a,n[4]=o):o=n[4],o},O=u(D,()=>{let{dialog:{mutations:e,keys:t},services:{contentAccess:n}}=l(),{mutate:r}=c(e.open.getOptions()),{mutate:i}=c(n.mutations.refreshContentAccess.getOptions()),{callerApplicationId:a,canOpenExternalLinks:o,locale:s}=_(),u=t.purchase.fullPath,f=t.qrCode.fullPath,p=(0,E.useCallback)(e=>{e.status===`Succeeded`&&i()},[i]);return{handlePress:(0,E.useCallback)(()=>{if(a){if(!o){r({key:f,props:{destUrl:y({productId:g,callerApplicationId:a,locale:s??void 0}),onClose:()=>{i()}}});return}r({key:u,props:{productId:g,callerApplicationId:a,sourceClientName:d.XEWeb,purchaseSource:`GetGamepassButton`,onExit:p}})}},[o,r,a,p,s,i,u,f])}}),k=e=>{let n=(0,C.c)(11),{handlePress:i,href:a,showQrCode:o}=e,{t:s}=t(`SettingsAccountTab`),c;n[0]===s?c=n[1]:(c=s(`Enter a code`,{shortKey:`enterCode_button_label`}),n[0]=s,n[1]=c);let l;n[2]===o?l=n[3]:(l=o?(0,w.jsx)(p,{icon:(0,w.jsx)(r,{}),size:`subtitle2`}):null,n[2]=o,n[3]=l);let u;n[4]!==c||n[5]!==l?(u=(0,w.jsxs)(`span`,{className:`flex flex-row justify-center gap-[8px]`,children:[c,l]}),n[4]=c,n[5]=l,n[6]=u):u=n[6];let d;return n[7]!==a||n[8]!==i||n[9]!==u?(d=(0,w.jsx)(v,{alignment:`center`,as:`a`,className:`w-full`,href:a,kind:`standard`,onPress:i,size:`large`,target:`_blank`,children:u}),n[7]=a,n[8]=i,n[9]=u,n[10]=d):d=n[10],d},A=u(k,()=>{let{capabilities:e}=l(),{data:t}=a(e.queries.canOpenExternalLinks.getOptions()),{trackUserAction:n}=o();return{handlePress:()=>{n(`NavigateToLink`,{destinationUrl:s,linkType:`external`},`Press`)},href:s,showQrCode:t===!1}}),j=e=>{let t=(0,C.c)(7),{isFullySignedIn:n,isXGPUSubscriber:r,isMarketSupported:i}=e,a=O.useComponent(),o=A.useComponent();if(!n||r||!i)return null;let s;t[0]===a?s=t[1]:(s=(0,w.jsx)(a,{}),t[0]=a,t[1]=s);let c;t[2]===o?c=t[3]:(c=(0,w.jsx)(o,{}),t[2]=o,t[3]=c);let l;return t[4]!==s||t[5]!==c?(l=(0,w.jsxs)(`div`,{className:`flex flex-col gap-[16px] self-stretch`,children:[s,c]}),t[4]=s,t[5]=c,t[6]=l):l=t[6],l},M=u(j,()=>{let{contentAccess:e}=l(),{data:t}=a(e.queries.gamepassAccess.getOptions()),{data:n}=a(e.queries.isMarketSupported.getOptions()),r=t===f.GamePassUltimate,{isFullySignedIn:o}=i();return{isFullySignedIn:o,isXGPUSubscriber:r,isMarketSupported:n??!1}});export{T as a,D as i,M as n,k as r,j as t};