android-wrapper/@capacitor/core/dist/capacitor.js

4 lines
9.7 KiB
JavaScript
Raw Normal View History

2025-06-18 18:50:46 +02:00
/*! Capacitor: https://capacitorjs.com/ - MIT License */
var capacitorExports=function(e){"use strict";const t=(e=>e.CapacitorPlatforms=(e=>{const t=new Map;t.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:t};return n.addPlatform=(e,t)=>{n.platforms.set(e,t)},n.setPlatform=e=>{n.platforms.has(e)&&(n.currentPlatform=n.platforms.get(e))},n})(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),n=t.addPlatform,r=t.setPlatform;var i;e.ExceptionCode=void 0,(i=e.ExceptionCode||(e.ExceptionCode={})).Unimplemented="UNIMPLEMENTED",i.Unavailable="UNAVAILABLE";class o extends Error{constructor(e,t,n){super(e),this.message=e,this.code=t,this.data=n}}const s=t=>{var n,r,i,s,a;const l=t.CapacitorCustomPlatform||null,d=t.Capacitor||{},c=d.Plugins=d.Plugins||{},u=t.CapacitorPlatforms,m=(null===(n=null==u?void 0:u.currentPlatform)||void 0===n?void 0:n.getPlatform)||(()=>null!==l?l.name:(e=>{var t,n;return(null==e?void 0:e.androidBridge)?"android":(null===(n=null===(t=null==e?void 0:e.webkit)||void 0===t?void 0:t.messageHandlers)||void 0===n?void 0:n.bridge)?"ios":"web"})(t)),p=(null===(r=null==u?void 0:u.currentPlatform)||void 0===r?void 0:r.isNativePlatform)||(()=>"web"!==m()),f=(null===(i=null==u?void 0:u.currentPlatform)||void 0===i?void 0:i.isPluginAvailable)||(e=>{const t=h.get(e);return!!(null==t?void 0:t.platforms.has(m()))||!!g(e)}),g=(null===(s=null==u?void 0:u.currentPlatform)||void 0===s?void 0:s.getPluginHeader)||(e=>{var t;return null===(t=d.PluginHeaders)||void 0===t?void 0:t.find((t=>t.name===e))}),h=new Map,w=(null===(a=null==u?void 0:u.currentPlatform)||void 0===a?void 0:a.registerPlugin)||((t,n={})=>{const r=h.get(t);if(r)return console.warn(`Capacitor plugin "${t}" already registered. Cannot register plugins twice.`),r.proxy;const i=m(),s=g(t);let a;const u=r=>{let c;const u=(...u)=>{const m=(async()=>(!a&&i in n?a=a="function"==typeof n[i]?await n[i]():n[i]:null!==l&&!a&&"web"in n&&(a=a="function"==typeof n.web?await n.web():n.web),a))().then((n=>{const a=((n,r)=>{var a,l;if(!s){if(n)return null===(l=n[r])||void 0===l?void 0:l.bind(n);throw new o(`"${t}" plugin is not implemented on ${i}`,e.ExceptionCode.Unimplemented)}{const e=null==s?void 0:s.methods.find((e=>r===e.name));if(e)return"promise"===e.rtype?e=>d.nativePromise(t,r.toString(),e):(e,n)=>d.nativeCallback(t,r.toString(),e,n);if(n)return null===(a=n[r])||void 0===a?void 0:a.bind(n)}})(n,r);if(a){const e=a(...u);return c=null==e?void 0:e.remove,e}throw new o(`"${t}.${r}()" is not implemented on ${i}`,e.ExceptionCode.Unimplemented)}));return"addListener"===r&&(m.remove=async()=>c()),m};return u.toString=()=>`${r.toString()}() { [capacitor code] }`,Object.defineProperty(u,"name",{value:r,writable:!1,configurable:!1}),u},p=u("addListener"),f=u("removeListener"),w=(e,t)=>{const n=p({eventName:e},t),r=async()=>{const r=await n;f({eventName:e,callbackId:r},t)},i=new Promise((e=>n.then((()=>e({remove:r})))));return i.remove=async()=>{console.warn("Using addListener() without 'await' is deprecated."),await r()},i},v=new Proxy({},{get(e,t){switch(t){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return s?w:p;case"removeListener":return f;default:return u(t)}}});return c[t]=v,h.set(t,{name:t,proxy:v,platforms:new Set([...Object.keys(n),...s?[i]:[]])}),v});return d.convertFileSrc||(d.convertFileSrc=e=>e),d.getPlatform=m,d.handleError=e=>t.console.error(e),d.isNativePlatform=p,d.isPluginAvailable=f,d.pluginMethodNoop=(e,t,n)=>Promise.reject(`${n} does not have an implementation of "${t}".`),d.registerPlugin=w,d.Exception=o,d.DEBUG=!!d.DEBUG,d.isLoggingEnabled=!!d.isLoggingEnabled,d.platform=d.getPlatform(),d.isNative=d.isNativePlatform(),d},a=(e=>e.Capacitor=s(e))("undefined"!=typeof globalThis?globalThis:"undefined"!=typeof self?self:"undefined"!=typeof window?window:"undefined"!=typeof global?global:{}),l=a.registerPlugin,d=a.Plugins;class c{constructor(e){this.listeners={},this.retainedEventArguments={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin
//# sourceMappingURL=capacitor.js.map