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]=`a9b87696-9c46-4487-8f50-30e05b026ccc`,e._sentryDebugIdIdentifier=`sentry-dbid-a9b87696-9c46-4487-8f50-30e05b026ccc`)}catch{}import{o as e}from"./rolldown-runtime-eb2nym32.js";import{it as t}from"./xds-react-components-lks62tbl.js";import{Ag as n,Dg as ee,Fg as r,Gn as te,Ig as i,eh as ne,lh as a,or as o,sh as re,ut as ie,wg as ae}from"./entry.client-dr7r6s9a.js";import{at as oe}from"./xds-icons-d7khcnpi.js";import{r as se}from"./ControllerPairingContext-lndsofbd.js";import{r as ce}from"./routes-cum86uu1.js";import{d as le,r as ue,t as s}from"./Styles-pe7l89m3.js";import{t as de}from"./getControllerPairingRouterEnvironment-cyamx6ev.js";import{t as fe}from"./ControllerPairingHeader-o5r7pkm4.js";import{t as pe}from"./useInitialFocusIn-fziws25j.js";import{t as me}from"./useCaccsConnectedTranslation-ibv0e51d.js";var c=e(i(),1),he=e(o(),1),ge=r();function _e(){let e=(0,ge.c)(2),{t}=a(`ControllerPairingCaccsConfirmation`),n;return e[0]===t?n=e[1]:(n={locTitle:e=>t(`Connect to {name}?`,{shortKey:`caccs_confirmation_title`,values:{name:e}})},e[0]=t,e[1]=n),n}var l=n(),u=()=>{let e=(0,ge.c)(63),{locTitle:n}=_e(),{locCancel:r,locConnect:i}=ne(),{locTitle:a}=me(),{fullscreen:o,onClosed:u,initialPath:d}=se(),f=de(),{accs:p}=re(),[m,ve]=(0,c.useState)(!1),[ye,h]=(0,c.useState)(!1),be=(0,c.useRef)(!1),xe,g;e[0]!==d||e[1]!==u||e[2]!==f?(g=d?u:()=>f(-1),e[0]=d,e[1]=u,e[2]=f,e[3]=g):g=e[3],xe=g;let _=xe,Se=(0,c.useRef)(null);pe(Se);let v;e[4]===p.queries.accessoryState?v=e[5]:(v=p.queries.accessoryState.getOptions(),e[4]=p.queries.accessoryState,e[5]=v);let{data:y}=ee(v),b;e[6]===p.queries.sessionState?b=e[7]:(b=p.queries.sessionState.getOptions(),e[6]=p.queries.sessionState,e[7]=b);let{data:Ce}=ee(b),x=Ce?.type===`sessionConnected`&&Ce.clientActive,S=y?.accessoryId,C=y?.deviceDescription,w;e[8]===p.mutations.acceptAccessoryConfirmation?w=e[9]:(w=p.mutations.acceptAccessoryConfirmation.getOptions(),e[8]=p.mutations.acceptAccessoryConfirmation,e[9]=w);let{mutate:T}=ae(w),E;e[10]===p.mutations.rejectAccessoryConfirmation?E=e[11]:(E=p.mutations.rejectAccessoryConfirmation.getOptions(),e[10]=p.mutations.rejectAccessoryConfirmation,e[11]=E);let{mutate:D}=ae(E),O=ye||m,k;e[12]===Symbol.for(`react.memo_cache_sentinel`)?(k=()=>h(!1),e[12]=k):k=e[12];let we=k,A;e[13]!==S||e[14]!==T?(A=()=>{S&&(h(!0),T(S,{onError:we}))},e[13]=S,e[14]=T,e[15]=A):A=e[15];let j=A,M;e[16]!==S||e[17]!==D?(M=()=>{S&&(h(!0),D(S,{onError:we}))},e[16]=S,e[17]=D,e[18]=M):M=e[18];let N=M,P,F;e[19]!==y||e[20]!==_||e[21]!==x||e[22]!==f?(P=()=>{if(y){if(y.accessoryId&&(be.current=!0),!y.accessoryId){be.current&&_?.();return}y.deviceType===`VIRTUAL`&&(y.requiresConfirmation||(x?ve(!0):f(ce.path,{replace:!0})))}},F=[y,_,x,f],e[19]=y,e[20]=_,e[21]=x,e[22]=f,e[23]=P,e[24]=F):(P=e[23],F=e[24]),(0,c.useEffect)(P,F);let I;e[25]!==m||e[26]!==a||e[27]!==C||e[28]!==n?(I=m?a(C):n(C??``),e[25]=m,e[26]=a,e[27]=C,e[28]=n,e[29]=I):I=e[29];let L=I,R=`${ue(o)} !flex !h-full !flex-col !justify-between`,z;e[30]===L?z=e[31]:(z=(0,l.jsx)(fe,{title:L,isSingleColumnLayout:!0}),e[30]=L,e[31]=z);let B;e[32]===o?B=e[33]:(B=(0,he.default)(le(o),`justify-center`),e[32]=o,e[33]=B);let V;e[34]===B?V=e[35]:(V=(0,l.jsx)(`div`,{className:B}),e[34]=B,e[35]=V);let H=m&&`invisible`,U;e[36]===H?U=e[37]:(U=(0,he.default)(s.buttonContainer,H),e[36]=H,e[37]=U);let W;e[38]===Symbol.for(`react.memo_cache_sentinel`)?(W=(0,l.jsx)(oe,{}),e[38]=W):W=e[38];let G=!S||O,K;e[39]===i?K=e[40]:(K=i(),e[39]=i,e[40]=K);let q;e[41]!==j||e[42]!==G||e[43]!==K?(q=(0,l.jsx)(t,{as:`button`,size:`standard`,kind:`brand`,leadingIcon:W,alignment:`center`,onPressEnd:j,isDisabled:G,"data-auto-focus":!0,className:s.buttonSpacing,children:K}),e[41]=j,e[42]=G,e[43]=K,e[44]=q):q=e[44];let J;e[45]===Symbol.for(`react.memo_cache_sentinel`)?(J=(0,l.jsx)(ie,{}),e[45]=J):J=e[45];let Y;e[46]===r?Y=e[47]:(Y=r(),e[46]=r,e[47]=Y);let X;e[48]!==N||e[49]!==O||e[50]!==Y?(X=(0,l.jsx)(t,{as:`button`,size:`standard`,kind:`standard`,leadingIcon:J,alignment:`center`,onPressEnd:N,isDisabled:O,className:s.buttonSpacing,children:Y}),e[48]=N,e[49]=O,e[50]=Y,e[51]=X):X=e[51];let Z;e[52]!==q||e[53]!==X?(Z=(0,l.jsxs)(te,{className:`contents`,children:[q,X]}),e[52]=q,e[53]=X,e[54]=Z):Z=e[54];let Q;e[55]!==U||e[56]!==Z?(Q=(0,l.jsx)(`div`,{className:U,children:Z}),e[55]=U,e[56]=Z,e[57]=Q):Q=e[57];let $;return e[58]!==R||e[59]!==z||e[60]!==V||e[61]!==Q?($=(0,l.jsxs)(`div`,{className:R,ref:Se,children:[z,V,Q]}),e[58]=R,e[59]=z,e[60]=V,e[61]=Q,e[62]=$):$=e[62],$};export{u as CaccsConfirmation};