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]=`bd67d774-1199-4807-8a04-59c62bd1fbb8`,e._sentryDebugIdIdentifier=`sentry-dbid-bd67d774-1199-4807-8a04-59c62bd1fbb8`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{pg as e}from"./entry.client-dr7r6s9a.js";import{connectDevice as t,startScan as n,stopScan as r}from"./src-ln7rh653.js";var i=class{logger=new e(`WebOSBluetoothAdaptor`);async deviceScan(e,t,i){let a=!0;this.logger.info(`Starting Bluetooth scan`),i.addEventListener(`abort`,async()=>{a&&(a=!1,this.logger.info(`Scanning aborted by caller`),r())});let o=n(t=>{a&&t.devices&&(a=!1,this.logger.debug(`Found ${t.devices.length} devices`),e(t.devices.map(e=>({name:e.name,macAddress:e.address}))),o.cancel(),r())},e=>{t(Error(e.errorCode))})}async pairDevice(e,n,r,i){this.logger.info(`Pairing with device`),t(e,e=>{if(e?.event===`onConnectionStateChange`){let t=e?.values;t?.connected===!0&&t?.connecting===!1&&(this.logger.info(`Pairing successful`),n())}},e=>{r(Error(e.errorText))})}};export{i as WebOSBluetoothAdaptor};