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]=`c2b5e407-758b-4e6f-8bdf-9bbba19472b8`,e._sentryDebugIdIdentifier=`sentry-dbid-c2b5e407-758b-4e6f-8bdf-9bbba19472b8`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{Ag as t,Eg as n,Fg as r,Ig as i,dn as a,lh as o,mr as s,sh as c,th as l,zp as u}from"./entry.client-dr7r6s9a.js";import{Ct as d}from"./workspace-leaf-files-mc5sghv7.js";import{t as f}from"./GameSessionDetails-ecycyzpq.js";import{t as p}from"./useEmitGameStreamDialogEvent-dljcy1v9.js";import{t as m}from"./useGameStreamProps-h4pgc81o.js";import{t as h}from"./useGameStreamDialogContext-ivl0rv5q.js";var g=e(i(),1),_=r(),v=(e,t)=>{try{let n=new URL(e).protocol.match(/^ms-xbl-(0x)?([0-9a-fA-F]+):/);if(n){let e=parseInt(n[2],16);if(e)return e.toString();t?.error(`Failed to parse titleId as an integer: ${n[2]??`Regex failed to extract titleId`}`)}else t?.error(`Failed to extract title ID from activation URL: ${e}`)}catch(n){t?.error(`Failed to parse title activation URL: ${e}, ${n}`)}},y=t(),b=e=>{let t=(0,_.c)(6),{productInfo:n,title:r,session:i,onClose:a}=e,o=f.useComponent(),s;return t[0]!==o||t[1]!==n||t[2]!==r||t[3]!==i||t[4]!==a?(s=(0,y.jsx)(o,{productInfo:n,title:r,session:i,onPlay:a,onActionButtonPress:a}),t[0]=o,t[1]=n,t[2]=r,t[3]=i,t[4]=a,t[5]=s):s=t[5],s},x=a(b,({launchUri:e,titleId:t})=>{let r=p(u.dialog.gameStream.titleActivation.fullPath,`complete`),{t:i}=o(`TitleActivationDialog`),{catalog:a}=c(),{setDialogShellProps:s}=h(),{data:l}=n(a.queries.productInfosByAlternateId.detailed.getOptions({id:t,idType:`XboxTitleId`})),f=i(`Launch {title}?`,{shortKey:`titleactivationdialog_launch_778187`,values:{title:l[0].ProductTitle}}),m={accessibleTitle:f,accessibleDescription:i(`The current game is trying to launch {title}.`,{shortKey:`titleactivationdialog_current_trying_launch_4c3495`,values:{title:l[0].ProductTitle}}),dismissable:!0,className:d,onWillClose:r};return(0,g.useEffect)(()=>{s(m)},[m,s]),{productInfo:l[0],title:f,session:{kind:`titleActivation`,titleId:t,payload:e},onClose:r}}),S=s(()=>{let e=m(`titleActivation`),t=l().getLogger(`TitleActivationDialog`),n=x.useComponent();if(!e)return null;let r=v(e.launchUri,t);return r?(0,y.jsx)(n,{launchUri:e.launchUri,titleId:r}):null},`TitleActivationDialog`);export{b as PureTitleActivationDialogContent,S as TitleActivationDialog,S as default,x as TitleActivationDialogContentConnection};