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]=`35adaa90-7108-461b-95d9-399a0dcba560`,e._sentryDebugIdIdentifier=`sentry-dbid-35adaa90-7108-461b-95d9-399a0dcba560`)}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,_r as s,jg as c,ng as l,pi as u,xr as d}from"./entry.client-mpghtlrl.js";import{Qt as f}from"./workspace-leaf-files-oergw4h0.js";import{t as p}from"./AnnouncementProvider-ice67845.js";import{t as m}from"./useAnnouncement-iefwapiq.js";import{n as h,t as g}from"./DialogShell-ga7ic6wy.js";var _=e(u(),1),v=n(),y=e(c(),1),b=l(),x=s(e=>{let n=(0,v.c)(21),{devices:i,isLoading:a,onPair:o,onTryAgain:s}=e,{t:c}=t(`BluetoothScanDevicesDialog`),{locAccessibilityItemEnumeration:l,locTryAgain:u}=r(),f;if(i&&i.length>0){let e;n[0]===c?e=n[1]:(e=c(`We've found these controllers`,{shortKey:`weve_found_controllers`}),n[0]=c,n[1]=e),f=e}else{let e;n[2]===c?e=n[3]:(e=c(`No controllers found`,{shortKey:`no_controllers_found`}),n[2]=c,n[3]=e),f=e}if(m(f),a){let e;return n[4]===Symbol.for(`react.memo_cache_sentinel`)?(e=(0,b.jsx)(`div`,{className:`flex flex-1 flex-col`,children:(0,b.jsx)(`div`,{className:`mb-4 text-noninteractive-content-primary-content !type-display1`,children:`\xA0`})}),n[4]=e):e=n[4],e}let p;n[5]===f?p=n[6]:(p=(0,b.jsx)(`div`,{className:`mb-4 text-noninteractive-content-primary-content !type-display1`,children:f}),n[5]=f,n[6]=p);let h;n[7]!==i.length||n[8]!==c?(h=i.length>0&&(0,b.jsx)(`div`,{className:`mb-8 text-noninteractive-content-primary-content type-subtitle1`,children:c(`Select which controller you would like to pair`,{shortKey:`select_controller_to_pair`})}),n[7]=i.length,n[8]=c,n[9]=h):h=n[9];let _;n[10]!==i||n[11]!==c||n[12]!==o||n[13]!==l||n[14]!==u||n[15]!==s?(_=i.length>0?(0,b.jsx)(g.ScrollContainer,{className:`relative flex h-full flex-col overflow-y-auto overflow-x-hidden rounded-md p-2 [--scrollbar-track-margin-top:var(--modal-spacing)]`,children:i.map((e,t)=>{let n=e.name.trim()||c(`Wireless controller`,{shortKey:`btscan_default_controller_name`});return(0,b.jsx)(d,{as:`button`,onPress:()=>o(e.macAddress),className:`mb-4 !min-h-component-item-menu-min-height w-full justify-start text-center text-noninteractive-content-primary-content !type-title2`,"aria-label":l(n,t+1,i.length),children:(0,b.jsx)(`div`,{className:`text-noninteractive-content-primary-content !type-section2`,children:n})},t)})}):(0,b.jsx)(`div`,{className:`flex flex-1 flex-col items-center justify-end pb-[var(--modal-spacing)]`,children:(0,b.jsx)(d,{as:`button`,onPress:s,className:`min-w-component-action-text-standard-min-width`,"data-auto-focus":!0,"aria-label":l(u(),1,1),children:u()})}),n[10]=i,n[11]=c,n[12]=o,n[13]=l,n[14]=u,n[15]=s,n[16]=_):_=n[16];let y;return n[17]!==p||n[18]!==h||n[19]!==_?(y=(0,b.jsxs)(b.Fragment,{children:[p,h,_]}),n[17]=p,n[18]=h,n[19]=_,n[20]=y):y=n[20],y},({onClose:e,...t})=>{let{bluetooth:n,dialog:{mutations:r}}=o(),{data:s,isLoading:c}=i(n.queries.scannedDevices.getOptions()),{mutate:l}=a(r.goBack.getOptions()),[u,d]=(0,y.useState)(!1);return{devices:s||[],isLoading:c,onPair:t=>{u||(e?.(t),l(),d(!0))},onTryAgain:()=>{u||(e?.(void 0,f.NoDevicesFoundScan),l(),d(!0))},...t}}),S=e=>{let t=(0,v.c)(9),n;t[0]===e?n=t[1]:({...n}=e,t[0]=e,t[1]=n);let r=h.useComponent(),i=x.useComponent(),a;t[2]===Symbol.for(`react.memo_cache_sentinel`)?(a=(0,_.default)(`modal-generic modal-floating flex h-[740px] w-[1020px] flex-col gap-layout-vertical-related-content-in-a-section-loose bg-container-backgrounds-elevation-background-level-2 bg-cover pb-[0px] pe-layout-horizontal-margin ps-layout-horizontal-margin pt-[60px]`),t[2]=a):a=t[2];let o;t[3]!==i||t[4]!==n?(o=(0,b.jsx)(p,{children:(0,b.jsx)(i,{...n})}),t[3]=i,t[4]=n,t[5]=o):o=t[5];let s;return t[6]!==r||t[7]!==o?(s=(0,b.jsx)(r,{className:a,children:o}),t[6]=r,t[7]=o,t[8]=s):s=t[8],s};export{S as BluetoothScanDevicesDialog,S as default};