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]=`14b6f2e8-65a0-4521-96f9-5db8a8e9d391`,e._sentryDebugIdIdentifier=`sentry-dbid-14b6f2e8-65a0-4521-96f9-5db8a8e9d391`)}catch{}import"./rolldown-runtime-nx40z1zs.js";import{bh as e,nm as t,rm as n,xu as r}from"./entry.client-mpghtlrl.js";var i=class{hasMouseDevice=!1;hasKeyboardDevice=!1;registerForDeviceChange=async(e,t)=>{this.requestor||this.setupDeviceEventListeners(e,t)};hasMouseSupport(){return this.hasMouseDevice}hasKeyboardSupport(){return this.hasKeyboardDevice}getDeviceTypeCounts(){let e=navigator.getGamepads();return{gamepads:Array.from(e).filter(e=>e!==null).length,mouse:+!!this.hasMouseDevice,keyboard:+!!this.hasKeyboardDevice}}async fetchDevices(){let e=[],r=navigator.getGamepads();for(let n=0;n<r.length;n++)if(r[n]){let r=t(n);e.push(r)}if(this.detectInputModeDevices(),this.hasMouseDevice||this.hasKeyboardDevice){let t=n();e.push(t)}return e}setupDeviceEventListeners(e,t){this.requestor=new r(`device-manager-adaptor`,100).setProcessGamepadConnect(t=>{e({accessoryId:t.toString()})}).setProcessGamepadDisconnect(e=>{t({accessoryId:e.toString()})}).setProcessKeyboardInput((e,t)=>{this.hasKeyboardDevice=!0}).setProcessInputModeChange((e,t,n,r)=>{(r===`mouse`||t===`passive-mouse`)&&(this.hasMouseDevice=!0)}).build(),this.requestor.register(),this.requestor.enableGamepadTracking(),this.requestor.enableKeyboardTracking()}detectInputModeDevices(){let t=e.getActiveInputMode(),n=e.getDetailedInputMode();!this.hasMouseDevice&&(t===`mouse`||n===`passive-mouse`)&&(this.hasMouseDevice=!0),!this.hasKeyboardDevice&&(t===`keyboard`||t===`tab`)&&(this.hasKeyboardDevice=!0)}};export{i as WebDeviceManagerAdaptor};