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]=`0c60315c-8dc6-4b89-934c-13e1b7b1645b`,e._sentryDebugIdIdentifier=`sentry-dbid-0c60315c-8dc6-4b89-934c-13e1b7b1645b`)}catch{}import"./rolldown-runtime-eb2nym32.js";import{as as e,kh as t,os as n}from"./entry.client-dr7r6s9a.js";import{Pt as r}from"./workspace-leaf-files-mc5sghv7.js";import{i}from"./utils-lgzuat62.js";var a=class{abortController;isListening=!1;start(){this.isListening||typeof document>`u`||!document.body||(this.abortController=new AbortController,document.body.addEventListener(`backbutton`,this.onBackButton,{signal:this.abortController.signal}),this.isListening=!0)}destroy(){this.isListening&&=(this.abortController?.abort(),this.abortController=void 0,!1)}onBackButton=e=>{let n={bubbles:!0,cancelable:!0,key:`XF86Back`,code:`XF86Back`},r=t.processKeyboardInput(new KeyboardEvent(`keydown`,n),`press`),i=t.processKeyboardInput(new KeyboardEvent(`keyup`,n),`release`);(r||i)&&e.cancelable&&e.preventDefault?.()}},o={...e,a:{kind:`button`,index:2},b:{kind:`button`,index:0},x:{kind:`button`,index:3},y:{kind:`button`,index:1}};function s(){n(t=>i(t)?.model===r.DualSense?o:e)}var c=class{backButtonHandler=new a;env;constructor(e){this.env=e}async onAppStart(){this.backButtonHandler.start(),await this.env.queryClient.fetchQuery(this.env.systems.deviceInformation.queries.isFireOSGamepadCorrectionRequired.getOptions())&&s()}hasQuitSupport(){return typeof navigator<`u`&&`app`in navigator&&typeof navigator.app==`object`&&navigator.app!=null&&`exitApp`in navigator.app&&typeof navigator.app.exitApp==`function`}quitApp(){typeof navigator<`u`&&`app`in navigator&&typeof navigator.app==`object`&&navigator.app!=null&&`exitApp`in navigator.app&&typeof navigator.app.exitApp==`function`&&(this.backButtonHandler.destroy(),navigator.app.exitApp())}};export{c as FireOSApplicationLifecycleAdaptor};