{"version":3,"file":"plugin.js","sources":["esm/index.js","esm/web.js"],"sourcesContent":["import { registerPlugin } from '@capacitor/core';\nconst KeepAwake = registerPlugin('KeepAwake', {\n web: () => import('./web').then((m) => new m.KeepAwakeWeb()),\n});\nexport * from './definitions';\nexport { KeepAwake };\n//# sourceMappingURL=index.js.map","import { WebPlugin } from '@capacitor/core';\nexport class KeepAwakeWeb extends WebPlugin {\n constructor() {\n super(...arguments);\n this.wakeLock = null;\n this._isSupported = typeof navigator !== 'undefined' && 'wakeLock' in navigator;\n this.handleVisibilityChange = () => {\n if (document.visibilityState === 'visible')\n this.keepAwake();\n };\n }\n async keepAwake() {\n if (!this._isSupported) {\n this.throwUnsupportedError();\n }\n if (this.wakeLock) {\n await this.allowSleep();\n }\n this.wakeLock = await navigator.wakeLock.request('screen');\n document.addEventListener('visibilitychange', this.handleVisibilityChange);\n document.addEventListener('fullscreenchange', this.handleVisibilityChange);\n }\n async allowSleep() {\n var _a;\n if (!this._isSupported) {\n this.throwUnsupportedError();\n }\n (_a = this.wakeLock) === null || _a === void 0 ? void 0 : _a.release();\n this.wakeLock = null;\n document.removeEventListener('visibilitychange', this.handleVisibilityChange);\n document.removeEventListener('fullscreenchange', this.handleVisibilityChange);\n }\n async isSupported() {\n const result = {\n isSupported: this._isSupported,\n };\n return result;\n }\n async isKeptAwake() {\n if (!this._isSupported) {\n this.throwUnsupportedError();\n }\n const result = {\n isKeptAwake: !!this.wakeLock,\n };\n return result;\n }\n throwUnsupportedError() {\n throw this.unavailable('Screen Wake Lock API not available in this browser.');\n }\n}\n//# sourceMappingURL=web.js.map"],"names":["registerPlugin","WebPlugin"],"mappings":";;;AACK,UAAC,SAAS,GAAGA,mBAAc,CAAC,WAAW,EAAE;IAC9C,IAAI,GAAG,EAAE,MAAM,mDAAe,CAAC,IAAI,CAAC,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,YAAY,EAAE,CAAC;IAChE,CAAC;;ICFM,MAAM,YAAY,SAASC,cAAS,CAAC;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