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]=`b6667d02-d0bc-4c85-9a0a-fc681039faa6`,e._sentryDebugIdIdentifier=`sentry-dbid-b6667d02-d0bc-4c85-9a0a-fc681039faa6`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{Ag as t,Fg as n,Gn as r,Ig as i,Jn as a,lh as o}from"./entry.client-dr7r6s9a.js";import{t as s}from"./Announcer-ns276d3u.js";import{c,l,r as u}from"./ControllerPairingContext-lndsofbd.js";import{c as d,d as f,u as p}from"./Styles-pe7l89m3.js";import{t as m}from"./useShouldUseDialogNavigation-m43o5g92.js";import{t as h}from"./ControllerPairingHeader-o5r7pkm4.js";import{SkipOver as g}from"./SkipOver-glmwwlua.js";var _=n(),v=e(i(),1),y=t(),b=()=>{let e=(0,_.c)(38),{t}=o(`ControllerPairingFinish`),{isUsbConnection:n,controllerType:i,fullscreen:b,onClosed:x,goBackForDialog:S}=u(),[C,w]=(0,v.useState)(!1),T=l(),E=n??T,D=m(),O;e[0]!==D||e[1]!==x||e[2]!==S?(O=()=>{if(D){let e=x??S;e?e():window.history.back()}else w(!0)},e[0]=D,e[1]=x,e[2]=S,e[3]=O):O=e[3];let k=O,A=E?`usb`:`nonusb`,j;e[4]!==A||e[5]!==t?(j=t(`{connectionType, select, usb{Your controller is connected} other{Your controller is paired}}`,{shortKey:`controller_pair_finish_title_usb`,values:{connectionType:A}}),e[4]=A,e[5]=t,e[6]=j):j=e[6];let M=j,N,P;if(e[7]===k?(N=e[8],P=e[9]):(N=()=>{let e=setTimeout(k,5e3);return()=>{clearTimeout(e)}},P=[k],e[7]=k,e[8]=N,e[9]=P),(0,v.useEffect)(N,P),C){let t;return e[10]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,y.jsx)(g,{}),e[10]=t):t=e[10],t}let F=t(`{connectionType, select, usb{Connect your controller next time by plugging it into your TV's USB port} other{Your controller is paired}}`,{shortKey:`controller_pair_finish_connecttext_usb`,values:{connectionType:E?`usb`:`nonusb`}}),I;e[11]===b?I=e[12]:(I=p(b),e[11]=b,e[12]=I);let L;e[13]===M?L=e[14]:(L=(0,y.jsx)(h,{title:M,isSingleColumnLayout:!0}),e[13]=M,e[14]=L);let R=`${M}. ${F}`,z;e[15]===R?z=e[16]:(z=(0,y.jsx)(s,{announcements:{announcement:{text:R,priority:`polite`}}}),e[15]=R,e[16]=z);let B;e[17]===b?B=e[18]:(B=f(b),e[17]=b,e[18]=B);let V;e[19]===b?V=e[20]:(V=d(b),e[19]=b,e[20]=V);let H;e[21]===i?H=e[22]:(H=c(i),e[21]=i,e[22]=H);let U;e[23]===t?U=e[24]:(U=t(`Image depicting the controller has been paired`,{shortKey:`controller_pair_finish_image_alt`}),e[23]=t,e[24]=U);let W;e[25]!==V||e[26]!==H||e[27]!==U?(W=(0,y.jsx)(a,{className:V,illustration:H,size:`maxWidth`,alt:U}),e[25]=V,e[26]=H,e[27]=U,e[28]=W):W=e[28];let G;e[29]===Symbol.for(`react.memo_cache_sentinel`)?(G=(0,y.jsx)(r,{exitDirections:[],onKeyDown:()=>w(!0)}),e[29]=G):G=e[29];let K;e[30]!==B||e[31]!==W?(K=(0,y.jsxs)(`div`,{className:B,children:[W,G]}),e[30]=B,e[31]=W,e[32]=K):K=e[32];let q;return e[33]!==I||e[34]!==L||e[35]!==z||e[36]!==K?(q=(0,y.jsxs)(`div`,{className:I,children:[L,z,K]}),e[33]=I,e[34]=L,e[35]=z,e[36]=K,e[37]=q):q=e[37],q};export{b as Finish};