{"version":3,"sources":["jsdelivr-header.js","/npm/@capacitor/camera@8.0.1/dist/esm/definitions.js","/npm/@capacitor/camera@8.0.1/dist/esm/web.js","/npm/@capacitor/camera@8.0.1/dist/esm/index.js"],"names":[],"mappings":"AAAA;AACA;AACA;AACA;AACA;AACA;AACA,iDCNW,4BACX,SAAW,GAIP,EAAqB,OAAI,SAIzB,EAAqB,OAAI,SAIzB,EAAqB,OAAI,QAC5B,CAbD,CAaG,uBAAiB,qBAAe,KACxB,+BACX,SAAW,GACP,EAAsB,KAAI,OAC1B,EAAuB,MAAI,OAC9B,CAHD,CAGG,0BAAoB,wBAAkB,KAC9B,gCACX,SAAW,GACP,EAAsB,IAAI,MAC1B,EAAyB,OAAI,SAC7B,EAA0B,QAAI,SACjC,CAJD,CAIG,2BAAqB,yBAAmB,KCvBpC,MAAM,kBAAkB,eAC3B,cAAM,CAAS,GAEX,OAAO,IAAI,SAAQ,MAAO,EAAS,KAC/B,GAAI,EAAQ,aAAe,EAAQ,SAAW,qBAAa,OACvD,KAAK,oBAAoB,EAAS,EAAS,QAE1C,GAAI,EAAQ,SAAW,qBAAa,OAAQ,CAC7C,IAAI,EAAc,SAAS,cAAc,oBACpC,IACD,EAAc,SAAS,cAAc,oBACrC,SAAS,KAAK,YAAY,IAE9B,EAAY,OAAS,EAAQ,mBAAqB,QAClD,EAAY,YAAa,EACzB,EAAY,QAAU,CAClB,CAAE,MAAO,EAAQ,kBAAoB,eACrC,CAAE,MAAO,EAAQ,oBAAsB,iBAE3C,EAAY,iBAAiB,eAAe,MAAO,IAE7B,IADA,EAAE,OAEhB,KAAK,oBAAoB,EAAS,EAAS,GAG3C,KAAK,iBAAiB,EAAS,EAAS,EAC5C,GAER,MAEI,KAAK,iBAAiB,EAAS,EAAS,EAC5C,GAER,CACA,gBAAM,CAAW,GAEb,OAAO,IAAI,SAAQ,MAAO,EAAS,KAC/B,KAAK,4BAA4B,EAAS,EAAO,GAEzD,CACA,sBAAM,CAAiB,EAAS,EAAS,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AAO,KAIX,EAAO,cAAc,GACrB,EAAO,UAAY,KACf,MAAM,EAAI,EAAO,OACU,YAAvB,EAAQ,WACR,EAAQ,CACJ,QAAS,EACT,OAAQ,EACR,OAAO,IAIX,EAAQ,CACJ,aAAc,EAAE,MAAM,KAAK,GAC3B,OAAQ,EACR,OAAO,GAEf,EAEJ,EAAO,QAAW,IACd,EAAO,EAAE,EAEjB,GAER,CACA,sBAAM,GACF,GAAyB,oBAAd,YAA8B,UAAU,YAC/C,MAAM,KAAK,YAAY,iDAE3B,IAOI,MAAO,CACH,cAJqB,OAAO,UAAU,YAAY,MAAM,CACxD,KAAM,YAGa,MACnB,OAAQ,UAEhB,CACA,MAAO,GACH,MAAM,KAAK,YAAY,uDAC3B,CACJ,CACA,wBAAM,GACF,MAAM,KAAK,cAAc,0BAC7B,CACA,8BAAM,GACF,MAAM,KAAK,YAAY,0BAC3B,CACA,6BAAM,GACF,MAAM,KAAK,YAAY,0BAC3B,EAEW,IAAI,UCtPd,MAAC,OAAS,oBAAe,SAAU,CACpC,IAAK,IAAM,IAAI,Y","file":"/npm/@capacitor/camera@8.0.1/dist/plugin.cjs.js","sourceRoot":"","sourcesContent":["/**\n * Minified by jsDelivr using Terser v5.39.0.\n * Original file: /npm/@capacitor/camera@8.0.1/dist/plugin.cjs.js\n *\n * Do NOT use SRI with dynamically generated files! More information: https://www.jsdelivr.com/using-sri-with-dynamic-files\n */\n","export var CameraSource;\n(function (CameraSource) {\n    /**\n     * Prompts the user to select either the photo album or take a photo.\n     */\n    CameraSource[\"Prompt\"] = \"PROMPT\";\n    /**\n     * Take a new photo using the camera.\n     */\n    CameraSource[\"Camera\"] = \"CAMERA\";\n    /**\n     * Pick an existing photo from the gallery or photo album.\n     */\n    CameraSource[\"Photos\"] = \"PHOTOS\";\n})(CameraSource || (CameraSource = {}));\nexport var CameraDirection;\n(function (CameraDirection) {\n    CameraDirection[\"Rear\"] = \"REAR\";\n    CameraDirection[\"Front\"] = \"FRONT\";\n})(CameraDirection || (CameraDirection = {}));\nexport var CameraResultType;\n(function (CameraResultType) {\n    CameraResultType[\"Uri\"] = \"uri\";\n    CameraResultType[\"Base64\"] = \"base64\";\n    CameraResultType[\"DataUrl\"] = \"dataUrl\";\n})(CameraResultType || (CameraResultType = {}));\n//# sourceMappingURL=definitions.js.map","import { WebPlugin, CapacitorException } from '@capacitor/core';\nimport { CameraSource, CameraDirection } from './definitions';\nexport class CameraWeb extends WebPlugin {\n    async getPhoto(options) {\n        // eslint-disable-next-line no-async-promise-executor\n        return new Promise(async (resolve, reject) => {\n            if (options.webUseInput || options.source === CameraSource.Photos) {\n                this.fileInputExperience(options, resolve, reject);\n            }\n            else if (options.source === CameraSource.Prompt) {\n                let actionSheet = document.querySelector('pwa-action-sheet');\n                if (!actionSheet) {\n                    actionSheet = document.createElement('pwa-action-sheet');\n                    document.body.appendChild(actionSheet);\n                }\n                actionSheet.header = options.promptLabelHeader || 'Photo';\n                actionSheet.cancelable = false;\n                actionSheet.options = [\n                    { title: options.promptLabelPhoto || 'From Photos' },\n                    { title: options.promptLabelPicture || 'Take Picture' },\n                ];\n                actionSheet.addEventListener('onSelection', async (e) => {\n                    const selection = e.detail;\n                    if (selection === 0) {\n                        this.fileInputExperience(options, resolve, reject);\n                    }\n                    else {\n                        this.cameraExperience(options, resolve, reject);\n                    }\n                });\n            }\n            else {\n                this.cameraExperience(options, resolve, reject);\n            }\n        });\n    }\n    async pickImages(_options) {\n        // eslint-disable-next-line no-async-promise-executor\n        return new Promise(async (resolve, reject) => {\n            this.multipleFileInputExperience(resolve, reject);\n        });\n    }\n    async cameraExperience(options, resolve, reject) {\n        if (customElements.get('pwa-camera-modal')) {\n            const cameraModal = document.createElement('pwa-camera-modal');\n            cameraModal.facingMode = options.direction === CameraDirection.Front ? 'user' : 'environment';\n            document.body.appendChild(cameraModal);\n            try {\n                await cameraModal.componentOnReady();\n                cameraModal.addEventListener('onPhoto', async (e) => {\n                    const photo = e.detail;\n                    if (photo === null) {\n                        reject(new CapacitorException('User cancelled photos app'));\n                    }\n                    else if (photo instanceof Error) {\n                        reject(photo);\n                    }\n                    else {\n                        resolve(await this._getCameraPhoto(photo, options));\n                    }\n                    cameraModal.dismiss();\n                    document.body.removeChild(cameraModal);\n                });\n                cameraModal.present();\n            }\n            catch (e) {\n                this.fileInputExperience(options, resolve, reject);\n            }\n        }\n        else {\n            console.error(`Unable to load PWA Element 'pwa-camera-modal'. See the docs: https://capacitorjs.com/docs/web/pwa-elements.`);\n            this.fileInputExperience(options, resolve, reject);\n        }\n    }\n    fileInputExperience(options, resolve, reject) {\n        let input = document.querySelector('#_capacitor-camera-input');\n        const cleanup = () => {\n            var _a;\n            (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n        };\n        if (!input) {\n            input = document.createElement('input');\n            input.id = '_capacitor-camera-input';\n            input.type = 'file';\n            input.hidden = true;\n            document.body.appendChild(input);\n            input.addEventListener('change', (_e) => {\n                const file = input.files[0];\n                let format = 'jpeg';\n                if (file.type === 'image/png') {\n                    format = 'png';\n                }\n                else if (file.type === 'image/gif') {\n                    format = 'gif';\n                }\n                if (options.resultType === 'dataUrl' || options.resultType === 'base64') {\n                    const reader = new FileReader();\n                    reader.addEventListener('load', () => {\n                        if (options.resultType === 'dataUrl') {\n                            resolve({\n                                dataUrl: reader.result,\n                                format,\n                            });\n                        }\n                        else if (options.resultType === 'base64') {\n                            const b64 = reader.result.split(',')[1];\n                            resolve({\n                                base64String: b64,\n                                format,\n                            });\n                        }\n                        cleanup();\n                    });\n                    reader.readAsDataURL(file);\n                }\n                else {\n                    resolve({\n                        webPath: URL.createObjectURL(file),\n                        format: format,\n                    });\n                    cleanup();\n                }\n            });\n            input.addEventListener('cancel', (_e) => {\n                reject(new CapacitorException('User cancelled photos app'));\n                cleanup();\n            });\n        }\n        input.accept = 'image/*';\n        input.capture = true;\n        if (options.source === CameraSource.Photos || options.source === CameraSource.Prompt) {\n            input.removeAttribute('capture');\n        }\n        else if (options.direction === CameraDirection.Front) {\n            input.capture = 'user';\n        }\n        else if (options.direction === CameraDirection.Rear) {\n            input.capture = 'environment';\n        }\n        input.click();\n    }\n    multipleFileInputExperience(resolve, reject) {\n        let input = document.querySelector('#_capacitor-camera-input-multiple');\n        const cleanup = () => {\n            var _a;\n            (_a = input.parentNode) === null || _a === void 0 ? void 0 : _a.removeChild(input);\n        };\n        if (!input) {\n            input = document.createElement('input');\n            input.id = '_capacitor-camera-input-multiple';\n            input.type = 'file';\n            input.hidden = true;\n            input.multiple = true;\n            document.body.appendChild(input);\n            input.addEventListener('change', (_e) => {\n                const photos = [];\n                // eslint-disable-next-line @typescript-eslint/prefer-for-of\n                for (let i = 0; i < input.files.length; i++) {\n                    const file = input.files[i];\n                    let format = 'jpeg';\n                    if (file.type === 'image/png') {\n                        format = 'png';\n                    }\n                    else if (file.type === 'image/gif') {\n                        format = 'gif';\n                    }\n                    photos.push({\n                        webPath: URL.createObjectURL(file),\n                        format: format,\n                    });\n                }\n                resolve({ photos });\n                cleanup();\n            });\n            input.addEventListener('cancel', (_e) => {\n                reject(new CapacitorException('User cancelled photos app'));\n                cleanup();\n            });\n        }\n        input.accept = 'image/*';\n        input.click();\n    }\n    _getCameraPhoto(photo, options) {\n        return new Promise((resolve, reject) => {\n            const reader = new FileReader();\n            const format = photo.type.split('/')[1];\n            if (options.resultType === 'uri') {\n                resolve({\n                    webPath: URL.createObjectURL(photo),\n                    format: format,\n                    saved: false,\n                });\n            }\n            else {\n                reader.readAsDataURL(photo);\n                reader.onloadend = () => {\n                    const r = reader.result;\n                    if (options.resultType === 'dataUrl') {\n                        resolve({\n                            dataUrl: r,\n                            format: format,\n                            saved: false,\n                        });\n                    }\n                    else {\n                        resolve({\n                            base64String: r.split(',')[1],\n                            format: format,\n                            saved: false,\n                        });\n                    }\n                };\n                reader.onerror = (e) => {\n                    reject(e);\n                };\n            }\n        });\n    }\n    async checkPermissions() {\n        if (typeof navigator === 'undefined' || !navigator.permissions) {\n            throw this.unavailable('Permissions API not available in this browser');\n        }\n        try {\n            // https://developer.mozilla.org/en-US/docs/Web/API/Permissions/query\n            // the specific permissions that are supported varies among browsers that implement the\n            // permissions API, so we need a try/catch in case 'camera' is invalid\n            const permission = await window.navigator.permissions.query({\n                name: 'camera',\n            });\n            return {\n                camera: permission.state,\n                photos: 'granted',\n            };\n        }\n        catch (_a) {\n            throw this.unavailable('Camera permissions are not available in this browser');\n        }\n    }\n    async requestPermissions() {\n        throw this.unimplemented('Not implemented on web.');\n    }\n    async pickLimitedLibraryPhotos() {\n        throw this.unavailable('Not implemented on web.');\n    }\n    async getLimitedLibraryPhotos() {\n        throw this.unavailable('Not implemented on web.');\n    }\n}\nconst Camera = new CameraWeb();\nexport { Camera };\n//# sourceMappingURL=web.js.map","import { registerPlugin } from '@capacitor/core';\nimport { CameraWeb } from './web';\nconst Camera = registerPlugin('Camera', {\n    web: () => new CameraWeb(),\n});\nexport * from './definitions';\nexport { Camera };\n//# sourceMappingURL=index.js.map"]}