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]=`a28e20a3-6fcd-438c-b708-7ad7ce62e6c4`,e._sentryDebugIdIdentifier=`sentry-dbid-a28e20a3-6fcd-438c-b708-7ad7ce62e6c4`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{$d as t,Ig as n,Og as r,Oo as i,eh as a,lh as o,lu as s,sh as c,th as l,uu as u,wg as d}from"./entry.client-dr7r6s9a.js";import{n as f}from"./auth-hooks-karaxdb8.js";var p=e(n(),1),m=({onDismiss:e}={})=>{let{dialog:{mutations:n,keys:m},gameStream:h}=c(),g=l().getLogger(`useStreamAwareSignIn`),{t:_}=o(`GameStream`),{locSignIn:v}=a(),[{data:y},{data:b}]=r({queries:[h.queries.instance.getOptions(),h.queries.streamState.getOptions()]}),{mutate:x}=d(n.open.getOptions()),{mutateAsync:S}=d(h.mutations.unblockNavigation),C=y?.sessionRequest?.titleInfo?.details.productId,w=f({returnUrl:C?t.products.byProductId.$buildPath({params:{productId:C}}):t.home.$path()}),T=b!==void 0&&!i.isNotStartedState(b)&&!s.isQueuedState(b)&&!u.isProvisioningState(b),E=(0,p.useCallback)(async()=>{y||g.debug(`No game stream instance to shutdown`),y?.shutdownSession({reason:`SigningIn`,skipFeedback:!0}),await S(),e?.(),w()},[y,S,e,w,g]);return{handleSignIn:(0,p.useCallback)(async()=>{T?x({key:m.confirmation.fullPath,props:{title:v(),prompt:_(`This will link your latest saved game progress to a new account. Any unsaved progress may be lost. Using an existing account will not link your progress.`,{shortKey:`sign_in_prompt_description`}),firstButton:{text:v(),kind:`brand`,onPress:E},secondButton:{text:_(`Keep playing`,{shortKey:`sign_in_prompt_cancel`}),kind:`standard`,onPress:()=>{e?.()}}}}):await E()},[T,E,x,v,_,e]),isInActiveStream:T}};export{m as t};