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]=`00db0bf6-4cb3-4221-9235-0d13505221f9`,e._sentryDebugIdIdentifier=`sentry-dbid-00db0bf6-4cb3-4221-9235-0d13505221f9`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{$h as t,$m as n,Gu as r,Hm as i,Um as a,Yh as o,Zm as s,jg as c}from"./entry.client-mpghtlrl.js";import{n as l}from"./auth-hooks-dkb6uyrd.js";import{n as u,r as d,t as f}from"./QueuedState-lqa2scrl.js";var p=e(c(),1),m=({onDismiss:e}={})=>{let{dialog:{mutations:c,keys:m},gameStream:h}=s(),g=a().getLogger(`useStreamAwareSignIn`),{t:_}=n(`GameStream`),{locSignIn:v}=i(),[{data:y},{data:b}]=t({queries:[h.queries.instance.getOptions(),h.queries.streamState.getOptions()]}),{mutate:x}=o(c.open.getOptions()),{mutateAsync:S}=o(h.mutations.unblockNavigation),C=y?.sessionRequest?.titleInfo?.details.productId,w=l({returnUrl:C?r.products.byProductId.$buildPath({params:{productId:C}}):r.home.$path()}),T=!!b&&!d.isNotStartedState(b)&&!f.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};