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]=`a6107f1b-b884-4b29-94fe-2b5fa505a123`,e._sentryDebugIdIdentifier=`sentry-dbid-a6107f1b-b884-4b29-94fe-2b5fa505a123`)}catch{}import{o as e}from"./rolldown-runtime-nx40z1zs.js";import{$m as t,Ag as n,Hm as r,Qh as i,Yh as a,Zm as o,ai as s,jg as c,ng as l,pi as u,xi as d,yr as f}from"./entry.client-mpghtlrl.js";import{ut as p}from"./xds-react-components-ihgca01z.js";import{r as m}from"./ControllerPairingContext-g12j6fyu.js";import{n as h,r as g}from"./routes-dojzucd0.js";import{r as _}from"./Styles-l5eym0go.js";import{t as v}from"./getControllerPairingRouterEnvironment-fiqysqef.js";import{t as y}from"./ControllerPairingHeader-fiafpaeq.js";var b=e(c(),1),x=e(u(),1),S=n();function C(){let e=(0,S.c)(2),{t:n}=t(`ControllerPairingCaccsPairing`),r;return e[0]===n?r=e[1]:(r={locAuthCodeLabel:()=>n(`caccs label`,{shortKey:`caccs_pairing_auth_code_label`}),locQrCodeAlt:()=>n(`caccs alt`,{shortKey:`caccs_pairing_qr_alt`}),locStep1Description:()=>n(`caccs step 1 description`,{shortKey:`caccs_pairing_step1_desc`}),locStep1Title:()=>n(`caccs step 1`,{shortKey:`caccs_pairing_step1_title`}),locStep2Description:()=>n(`caccs step 2 description`,{shortKey:`caccs_pairing_step2_desc`}),locStep2Title:()=>n(`caccs step 2`,{shortKey:`caccs_pairing_step2_title`}),locSubtitle:()=>n(`caccs subtitle`,{shortKey:`caccs_pairing_subtitle`}),locTitle:()=>n(`caccs`,{shortKey:`caccs_pairing_title`})},e[0]=n,e[1]=r),r}var w=l(),T=()=>{let{locTitle:e,locAuthCodeLabel:t}=C(),{locSomethingWentWrong:n,locGenericErrorSubheading:c,locTryAgain:l}=r(),{fullscreen:u}=m(),S=v(),{accs:T}=o(),{data:E,isLoading:D,isError:O,refetch:k}=i(T.queries.authorizationCode.getOptions()),A=E?.AuthorizationCode,{data:j}=i(T.queries.accessoryState.getOptions()),{mutate:M}=a(T.mutations.startAuthorizationCodeRefresh.getOptions()),N=(0,b.useRef)(!!E);return(0,b.useEffect)(()=>{N.current||M()},[M]),(0,b.useEffect)(()=>{!j?.accessoryId||j.deviceType!==`VIRTUAL`||(j.requiresConfirmation?S(h.path,{replace:!0}):S(g.path,{replace:!0,state:{autoDismiss:!0}}))},[j,S]),(0,w.jsxs)(`div`,{className:(0,x.default)(_(u),`!flex !flex-col !items-center`,O&&`!gap-0`),children:[(0,w.jsx)(y,{title:e()}),(0,w.jsx)(p,{className:`flex flex-1 flex-col items-center justify-center gap-layout-vertical-related-content-in-a-section-tight overflow-y-auto pe-4 sbar`,capturesFocus:!1,children:O?(0,w.jsx)(f,{illustration:`error`,title:n(),subtitle:c(),primaryButton:{text:l(),onPress:()=>k()},size:`small`}):D||!A?(0,w.jsx)(s,{children:(0,w.jsxs)(`div`,{className:`relative w-[12ch] type-display2`,children:[(0,w.jsx)(`span`,{className:`invisible`,"aria-hidden":`true`,children:`\xA0`}),(0,w.jsx)(d,{className:`absolute inset-0 rounded-regular`})]})}):(0,w.jsx)(`p`,{className:`text-noninteractive-content-primary-content type-display2`,role:`status`,"aria-label":`${t()}: ${A.split(``).join(` `)}`,children:A.split(``).join(` `)})})]})};export{T as CaccsPairing};