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]=`fa76b0bf-6962-49eb-a328-862f44325a42`,e._sentryDebugIdIdentifier=`sentry-dbid-fa76b0bf-6962-49eb-a328-862f44325a42`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{$m as t,Ag as n,ii as r,jg as i,ng as a,ti as o}from"./entry.client-mpghtlrl.js";import{t as s}from"./Announcer-b6q4a41y.js";import{c,l,r as u}from"./ControllerPairingContext-g12j6fyu.js";import{t as d}from"./useBackHandler-nc8l72js.js";import{c as f,d as p,u as m}from"./Styles-l5eym0go.js";import{t as h}from"./useShouldUseDialogNavigation-hy13sydb.js";import{t as g}from"./ControllerPairingHeader-fiafpaeq.js";import{SkipOver as _}from"./SkipOver-jqm71f5d.js";var v=n(),y=e(i(),1),b=a(),x=()=>{let e=(0,v.c)(40),{t:n}=t(`ControllerPairingFinish`),{isUsbConnection:i,controllerType:a,fullscreen:x,onClosed:S,goBackForDialog:C}=u(),[w,T]=(0,y.useState)(!1),E=l(),D=i??E,O=h(),k;e[0]!==O||e[1]!==S||e[2]!==C?(k=()=>{if(O){let e=S??C;e?e():window.history.back()}else T(!0)},e[0]=O,e[1]=S,e[2]=C,e[3]=k):k=e[3];let A=k,j;e[4]===A?j=e[5]:(j=()=>(A(),!0),e[4]=A,e[5]=j),d(j);let M=D?`usb`:`nonusb`,N;e[6]!==M||e[7]!==n?(N=n(`{connectionType, select, usb{Your controller is connected} other{Your controller is paired}}`,{shortKey:`controller_pair_finish_title_usb`,values:{connectionType:M}}),e[6]=M,e[7]=n,e[8]=N):N=e[8];let P=N,F,I;if(e[9]===A?(F=e[10],I=e[11]):(F=()=>{let e=setTimeout(A,5e3);return()=>{clearTimeout(e)}},I=[A],e[9]=A,e[10]=F,e[11]=I),(0,y.useEffect)(F,I),w){let t;return e[12]===Symbol.for(`react.memo_cache_sentinel`)?(t=(0,b.jsx)(_,{}),e[12]=t):t=e[12],t}let L=n(`{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:D?`usb`:`nonusb`}}),R;e[13]===x?R=e[14]:(R=m(x),e[13]=x,e[14]=R);let z;e[15]===P?z=e[16]:(z=(0,b.jsx)(g,{title:P,isSingleColumnLayout:!0}),e[15]=P,e[16]=z);let B=`${P}. ${L}`,V;e[17]===B?V=e[18]:(V=(0,b.jsx)(s,{announcements:{announcement:{text:B,priority:`polite`}}}),e[17]=B,e[18]=V);let H;e[19]===x?H=e[20]:(H=p(x),e[19]=x,e[20]=H);let U;e[21]===x?U=e[22]:(U=f(x),e[21]=x,e[22]=U);let W;e[23]===a?W=e[24]:(W=c(a),e[23]=a,e[24]=W);let G;e[25]===n?G=e[26]:(G=n(`Image depicting the controller has been paired`,{shortKey:`controller_pair_finish_image_alt`}),e[25]=n,e[26]=G);let K;e[27]!==U||e[28]!==W||e[29]!==G?(K=(0,b.jsx)(r,{className:U,illustration:W,size:`maxWidth`,alt:G}),e[27]=U,e[28]=W,e[29]=G,e[30]=K):K=e[30];let q;e[31]===Symbol.for(`react.memo_cache_sentinel`)?(q=(0,b.jsx)(o,{exitDirections:[],onKeyDown:()=>T(!0)}),e[31]=q):q=e[31];let J;e[32]!==H||e[33]!==K?(J=(0,b.jsxs)(`div`,{className:H,children:[K,q]}),e[32]=H,e[33]=K,e[34]=J):J=e[34];let Y;return e[35]!==R||e[36]!==z||e[37]!==V||e[38]!==J?(Y=(0,b.jsxs)(`div`,{className:R,children:[z,V,J]}),e[35]=R,e[36]=z,e[37]=V,e[38]=J,e[39]=Y):Y=e[39],Y};export{x as Finish};