superapp-miniapp-invoke-native 1.11.0 → 1.11.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/main.js +315 -322
- package/lib/main.umd.cjs +3 -1
- package/package.json +1 -1
package/lib/main.umd.cjs
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
var yt=Object.defineProperty,St=Object.defineProperties;var Nt=Object.getOwnPropertyDescriptors;var Wr=Object.getOwnPropertySymbols;var ft=Object.prototype.hasOwnProperty,Mt=Object.prototype.propertyIsEnumerable;var ze=(N,g,S)=>g in N?yt(N,g,{enumerable:!0,configurable:!0,writable:!0,value:S}):N[g]=S,q=(N,g)=>{for(var S in g||(g={}))ft.call(g,S)&&ze(N,S,g[S]);if(Wr)for(var S of Wr(g))Mt.call(g,S)&&ze(N,S,g[S]);return N},z=(N,g)=>St(N,Nt(g));var f=(N,g,S)=>(ze(N,typeof g!="symbol"?g+"":g,S),S);var a=(N,g,S)=>new Promise((B,K)=>{var Le=v=>{try{l(S.next(v))}catch(P){K(P)}},Ae=v=>{try{l(S.throw(v))}catch(P){K(P)}},l=v=>v.done?B(v.value):Promise.resolve(v.value).then(Le,Ae);l((S=S.apply(N,g)).next())});(function(N,g){typeof exports=="object"&&typeof module!="undefined"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):g((N=typeof globalThis!="undefined"?globalThis:N||self).main={})})(this,function(N){var yr,Sr,Nr,fr,Mr,Ir,Cr,vr,Or,Lr,Ar,Er,Rr,kr,br,Tr,Br;"use strict";/*! Capacitor: https://capacitorjs.com/ - MIT License */const g=t=>t.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return n.addPlatform=(o,i)=>{n.platforms.set(o,i)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(t),S=g(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var B;S.addPlatform,S.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(B||(B={}));class K extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const Le=t=>{var e,r,n,o,i;const c=t.CapacitorCustomPlatform||null,s=t.Capacitor||{},d=s.Plugins=s.Plugins||{},u=t.CapacitorPlatforms,_=((e=u==null?void 0:u.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>c!==null?c.name:(p=>{var m,I;return p!=null&&p.androidBridge?"android":!((I=(m=p==null?void 0:p.webkit)===null||m===void 0?void 0:m.messageHandlers)===null||I===void 0)&&I.bridge?"ios":"web"})(t)),h=((r=u==null?void 0:u.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>_()!=="web"),O=((n=u==null?void 0:u.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(p=>{const m=L.get(p);return!!(m!=null&&m.platforms.has(_()))||!!b(p)}),b=((o=u==null?void 0:u.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(p=>{var m;return(m=s.PluginHeaders)===null||m===void 0?void 0:m.find(I=>I.name===p)}),L=new Map,A=((i=u==null?void 0:u.currentPlatform)===null||i===void 0?void 0:i.registerPlugin)||((p,m={})=>{const I=L.get(p);if(I)return console.warn(`Capacitor plugin "${p}" already registered. Cannot register plugins twice.`),I.proxy;const E=_(),Z=b(p);let $;const De=T=>{let V;const J=(...Oe)=>{const Y=(()=>a(this,null,function*(){return!$&&E in m?$=$=typeof m[E]=="function"?yield m[E]():m[E]:c!==null&&!$&&"web"in m&&($=$=typeof m.web=="function"?yield m.web():m.web),$}))().then(ee=>{const Ur=((R,re)=>{var $e,qe;if(!Z){if(R)return(qe=R[re])===null||qe===void 0?void 0:qe.bind(R);throw new K(`"${p}" plugin is not implemented on ${E}`,B.Unimplemented)}{const Fr=Z==null?void 0:Z.methods.find(te=>re===te.name);if(Fr)return Fr.rtype==="promise"?te=>s.nativePromise(p,re.toString(),te):(te,Pt)=>s.nativeCallback(p,re.toString(),te,Pt);if(R)return($e=R[re])===null||$e===void 0?void 0:$e.bind(R)}})(ee,T);if(Ur){const R=Ur(...Oe);return V=R==null?void 0:R.remove,R}throw new K(`"${p}.${T}()" is not implemented on ${E}`,B.Unimplemented)});return T==="addListener"&&(Y.remove=()=>a(this,null,function*(){return V()})),Y};return J.toString=()=>`${T.toString()}() { [capacitor code] }`,Object.defineProperty(J,"name",{value:T,writable:!1,configurable:!1}),J},Vr=De("addListener"),Hr=De("removeListener"),gt=(T,V)=>{const J=Vr({eventName:T},V),Oe=()=>a(this,null,function*(){const ee=yield J;Hr({eventName:T,callbackId:ee},V)}),Y=new Promise(ee=>J.then(()=>ee({remove:Oe})));return Y.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Oe()}),Y},je=new Proxy({},{get(T,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return Z?gt:Vr;case"removeListener":return Hr;default:return De(V)}}});return d[p]=je,L.set(p,{name:p,proxy:je,platforms:new Set([...Object.keys(m),...Z?[E]:[]])}),je});return s.convertFileSrc||(s.convertFileSrc=p=>p),s.getPlatform=_,s.handleError=p=>t.console.error(p),s.isNativePlatform=h,s.isPluginAvailable=O,s.pluginMethodNoop=(p,m,I)=>Promise.reject(`${I} does not have an implementation of "${m}".`),s.registerPlugin=A,s.Exception=K,s.DEBUG=!!s.DEBUG,s.isLoggingEnabled=!!s.isLoggingEnabled,s.platform=s.getPlatform(),s.isNative=s.isNativePlatform(),s},Ae=t=>t.Capacitor=Le(t),l=Ae(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),v=l.registerPlugin;l.Plugins;class P{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const o=()=>a(this,null,function*(){return this.removeListener(e,r)}),i=Promise.resolve({remove:o});return Object.defineProperty(i,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),i}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const n=this.listeners[e];n&&n.forEach(o=>o(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new l.Exception(e,B.Unimplemented)}unavailable(e="not available"){return new l.Exception(e,B.Unavailable)}removeListener(e,r){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(r);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const Ke=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Je=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class xr extends P{getCookies(){return a(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,i]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=Je(o).trim(),i=Je(i).trim(),r[o]=i}),r})}setCookie(e){return a(this,null,function*(){try{const r=Ke(e.key),n=Ke(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),c=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${o}; path=${i}; ${c};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return a(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}v("CapacitorCookies",{web:()=>new xr});const Dr=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((o={})=>{const i=Object.keys(o);return Object.keys(o).map(c=>c.toLocaleLowerCase()).reduce((c,s,d)=>(c[s]=o[i[d]],c),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[i,c]of Object.entries(t.data||{}))o.set(i,c);r.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(t.data instanceof FormData)t.data.forEach((c,s)=>{o.append(s,c)});else for(const c of Object.keys(t.data))o.append(c,t.data[c]);r.body=o;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class jr extends P{request(e){return a(this,null,function*(){const r=Dr(e,e.webFetchExtra),n=((h,O=!0)=>h?Object.entries(h).reduce((b,L)=>{const[A,p]=L;let m,I;return Array.isArray(p)?(I="",p.forEach(E=>{m=O?encodeURIComponent(E):E,I+=`${A}=${m}&`}),I.slice(0,-1)):(m=O?encodeURIComponent(p):p,I=`${A}=${m}`),`${b}&${I}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,i=yield fetch(o,r),c=i.headers.get("content-type")||"";let s,d,{responseType:u="text"}=i.ok?e:{};switch(c.includes("application/json")&&(u="json"),u){case"arraybuffer":case"blob":d=yield i.blob(),s=yield(h=>a(this,null,function*(){return new Promise((O,b)=>{const L=new FileReader;L.onload=()=>{const A=L.result;O(A.indexOf(",")>=0?A.split(",")[1]:A)},L.onerror=A=>b(A),L.readAsDataURL(h)})}))(d);break;case"json":s=yield i.json();break;default:s=yield i.text()}const _={};return i.headers.forEach((h,O)=>{_[O]=h}),{data:s,headers:_,status:i.status,url:i.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Ee(){return l.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}v("CapacitorHttp",{web:()=>new jr}),v("Portals",{web:()=>Promise.resolve().then(function(){return $r}).then(t=>new t.PortalsWeb)});const $r=Object.freeze({__proto__:null,PortalsWeb:class extends P{publishNative(t){return a(this,null,function*(){})}}}),ne=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Ee&&((e=Ee())!=null&&e.value)){const o=(n=(r=Ee())==null?void 0:r.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class qr{isNative(){try{return(()=>{try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.isNative();{let e=!1;return ne(r=>{e=!!(r!=null&&r.isNative)}),e}}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{if(window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.redirectPage(window.__MICRO_APP_NAME__);if(console.log("redirectParams",r),r)return e.callBack(r)}else(({callBack:r})=>{ne(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const i=(o=n==null?void 0:n.params)!=null?o:null;if(!i)return;if(!r)return void console.error("initial context call back is undefine");r(i)}catch(i){throw console.error("redirectPageHandle error",i),i}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){var r;try{return this.isNative()?window.__MICRO_APP_ENVIRONMENT__?(r=window.rawWindow.__mini_app_hook__.getNativeInfo(e))!=null?r:{}:(()=>{try{let n=null;return ne(o=>{n=o!=null?o:null}),n}catch(n){throw console.error("getNativeInfoHandle error",n),n}})():(n=>{var o;return(o=n==null?void 0:n.mockData)!=null?o:null})(e)}catch(n){throw console.error("getNativeInfo error",n),n}}getStatus(){return new Promise(e=>{e({isNative:!0,redirectPage:!0,getNativeInfo:!0})})}}const C=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},k="CommunicatePlugin",y=l.registerPlugin(k,{web:()=>Promise.resolve().then(()=>mt).then(t=>new t.PluginsWeb)}),oe=C();oe.removeAddListenerFab=()=>null;const zr=(t,e)=>{var r,n;try{oe.removeAddListenerFab&&oe.removeAddListenerFab();const o=[];if((r=y.showFABMenu)==null||r.call(y,{fabMenu:o,position:null}),!t||!((n=Object.keys(t))!=null&&n.length))return;Object.keys(t).forEach(i=>{var c,s,d,u,_,h,O,b;o.push({disable:(s=(c=t==null?void 0:t[i])==null?void 0:c.disable)!=null?s:!1,icon:(u=(d=t==null?void 0:t[i])==null?void 0:d.icon)!=null?u:"",id:(h=(_=t==null?void 0:t[i])==null?void 0:_.id)!=null?h:"",name:(b=(O=t==null?void 0:t[i])==null?void 0:O.title)!=null?b:""})}),queueMicrotask(()=>{var i;(i=y.showFABMenu)==null||i.call(y,{fabMenu:o,position:e!=null?e:null})}),setTimeout(()=>{(i=>a(this,null,function*(){i&&(oe.removeAddListenerFab=yield(c=>a(this,null,function*(){try{if(l.addListener){const s=yield l.addListener(k,"nativeSendFab",d=>c&&c(d));return s!=null&&s.remove?s.remove:()=>null}}catch(s){throw console.error("addListenerFabHandle error",s),s}}))(i))}))(i=>{let c;i!=null&&i.disable||i!=null&&i.id&&(Object.keys(t).forEach(s=>{var d,u,_;(d=t==null?void 0:t[s])!=null&&d.id&&i.id===t[s].id&&(c=(_=(u=t[s])==null?void 0:u.fn)!=null?_:()=>null)}),typeof c=="function"&&c())})})}catch(o){throw console.error("fabBtnHandle error",o),o}},H=C();H.addListenerBackRemoveHandle=()=>null;const Ge=(t=()=>null)=>a(this,null,function*(){try{H!=null&&H.addListenerBackRemoveHandle&&typeof H.addListenerBackRemoveHandle=="function"&&H.addListenerBackRemoveHandle(),H.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendBack",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(t)}catch(e){throw console.error("initBackBtnFn error",e),e}}),ae=C();ae.addListenerHomeHandle=()=>null;const Kr=t=>{try{ae.addListenerHomeHandle&&ae.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(ae.addListenerHomeHandle=yield(r=>a(this,null,function*(){try{if(l.addListener){const n=yield l.addListener(k,"nativeSendHome",o=>r&&r(o));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(t)})}catch(e){throw console.error("homeFn error",e),e}},U=C();U.addListenerTouchRemoveHandle=()=>null;const Qe=(t=()=>null)=>a(this,null,function*(){try{U!=null&&U.addListenerTouchRemoveHandle&&typeof U.addListenerTouchRemoveHandle=="function"&&U.addListenerTouchRemoveHandle(),U.addListenerTouchRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeTouchListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerTouchHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),F=C();F.addListenerSendDeepLinkRemoveHandle=()=>null;const Xe=(t=()=>null)=>a(this,null,function*(){try{F!=null&&F.addListenerSendDeepLinkRemoveHandle&&typeof F.addListenerSendDeepLinkRemoveHandle=="function"&&F.addListenerSendDeepLinkRemoveHandle(),F.addListenerSendDeepLinkRemoveHandle=yield(e=>a(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return e&&window.rawWindow.__mini_app_hook__.getDeeplinkParams(e),{remove:()=>null};if(l.addListener){const r=yield l.addListener(k,"nativeSendDeeplinkCallbackListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSendDeepLinkHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),W=C();W.addListenerSwitchLanguageRemoveHandle=()=>null;const Ze=(t=()=>null)=>a(this,null,function*(){try{W!=null&&W.addListenerSwitchLanguageRemoveHandle&&typeof W.addListenerSwitchLanguageRemoveHandle=="function"&&W.addListenerSwitchLanguageRemoveHandle(),W.addListenerSwitchLanguageRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendSwitchLanguage",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.switchLanguage=e,{remove:()=>{window.rawWindow.__mini_app_hook__.switchLanguage=null}}}catch(r){throw console.error("addListenerSwitchLanguageHandle error",r),r}}))(t)}catch(e){throw console.error("initSwitchLanguageFn error",e),e}}),x=C();x.addListenerSetupMiniAppRemoveHandle=()=>null;const Ye=(t=()=>null)=>a(this,null,function*(){try{x!=null&&x.addListenerSetupMiniAppRemoveHandle&&typeof x.addListenerSetupMiniAppRemoveHandle=="function"&&x.addListenerSetupMiniAppRemoveHandle(),x.addListenerSetupMiniAppRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSetupMiniApp",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSetupMiniAppHandle error",r),r}}))(t)}catch(e){throw console.error("initSetupMiniAppFn error",e),e}}),D=C();D.addListenerSwitchStoreRemoveHandle=()=>null;const er=(t=()=>null)=>a(this,null,function*(){try{D!=null&&D.addListenerSwitchStoreRemoveHandle&&typeof D.addListenerSwitchStoreRemoveHandle=="function"&&D.addListenerSwitchStoreRemoveHandle(),D.addListenerSwitchStoreRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendSwitchStore",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.switchStore=e,{remove:()=>{window.rawWindow.__mini_app_hook__.switchStore=null}}}catch(r){throw console.error("addListenerSwitchStoreHandle error",r),r}}))(t)}catch(e){throw console.error("initSwitchStoreFn error",e),e}});class Jr{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var r;try{return yield(r=y.homeIsClick)==null?void 0:r.call(y,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Ge(i)}),o(()=>{Ge()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setHomeBtn=e:Kr(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e,r){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setFabBtn(e,r):zr(e,r)}catch(n){throw console.error("setFabBtn error",n),n}}touchListener(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Qe(i)}),o(()=>{Qe()})}catch(n){throw console.error("touchListenerHandle error",n),n}})(e)}catch(r){throw console.error("listenerTouch error",r),r}}disableFAB(e){return a(this,null,function*(){try{return yield y.disableFAB(e)}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(e){return a(this,null,function*(){try{return yield y.disableBack(e)}catch(r){throw console.error("disableBack error",r),r}})}openMiniApp(e){return a(this,null,function*(){try{return yield y.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return a(this,null,function*(){try{return yield y.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return a(this,null,function*(){try{return yield y.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield y.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return a(this,null,function*(){try{return yield y.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield y.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield y.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}getDeeplinkParams(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Xe(i)}),o(()=>{Xe()})}catch(n){throw console.error("sendDeepLinkListenerHandle error",n),n}})(e)}catch(r){throw console.error("getDeeplinkParams error",r),r}}switchLanguage(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Ze(i)}),o(()=>{Ze()})}catch(n){throw console.error("sendSwitchLanguageHandle error",n),n}})(e)}catch(r){throw console.error("switchLanguage error",r),r}}setupMiniApp(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Ye(i)}),o(()=>{Ye()})}catch(n){throw console.error("setupMiniAppHandle error",n),n}})(e)}catch(r){throw console.error("setupMiniApp error",r),r}}switchStore(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{er(i)}),o(()=>{er()})}catch(n){throw console.error("sendSwitchStoreHandle error",n),n}})(e)}catch(r){throw console.error("switchStore error",r),r}}closeMiniApp(){return a(this,null,function*(){try{return yield y.closeMiniApp()}catch(e){throw console.error("closeMiniApp error",e),e}})}getStatus(){return a(this,null,function*(){try{return yield y.getStatus()}catch(e){throw console.error("communicatePlugins getStatus error",e),e}})}dispatchToShell(e){return a(this,null,function*(){try{return yield y.dispatchToShell(e)}catch(r){throw console.error("communicate dispatchToShell error",r),r}})}getMiniAppInfo(e){return a(this,null,function*(){try{return yield y.getMiniAppInfo(e)}catch(r){throw console.error("getMiniAppInfo error",r),r}})}}let ie=null;window.__MICRO_APP_ENVIRONMENT__&&(ie=(yr=window.rawWindow.__mini_app_status_hook__)!=null?yr:{});const Re=l.registerPlugin("CameraScanPlugin",{web:new class extends P{pickCameraScan(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}setCameraScanState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ie==null?void 0:ie.cameraScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScan getStatus error",t),t}}}});window.removeAddListenerCameraScan=()=>null;class Gr{pickCameraScan(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScan(e):yield Re.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}setCameraScanState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanState(e):yield Re.setCameraScanState(e)}catch(r){throw console.error("setCameraScanState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Re.getStatus()}catch(e){throw console.error("cameraScanPlugin getStatus error",e),e}})}}let se=null;window.__MICRO_APP_ENVIRONMENT__&&(se=(Sr=window.rawWindow.__mini_app_status_hook__)!=null?Sr:{});const ke=l.registerPlugin("CameraScanMultiplePlugin",{web:new class extends P{pickCameraScanMultiple(){return a(this,null,function*(){})}setCameraScanMultipleState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=se==null?void 0:se.cameraScanMultiple)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultiple getStatus error",t),t}}}});class Qr{pickCameraScanMultiple(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultiple(e):yield ke.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}setCameraScanMultipleState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleState(e):yield ke.setCameraScanMultipleState(e)}catch(r){throw console.error("setCameraScanMultipleState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield ke.getStatus()}catch(e){throw console.error("cameraScanMultiplePlugin getStatus error",e),e}})}}let ce=null;window.__MICRO_APP_ENVIRONMENT__&&(ce=(Nr=window.rawWindow.__mini_app_status_hook__)!=null?Nr:{});const be=l.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends P{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}setCameraScanMultipleNoCountState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ce==null?void 0:ce.cameraScanMultipleNoCount)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultipleNoCount getStatus error",t),t}}}});class Xr{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultipleNoCount(e):yield be.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}setCameraScanMultipleNoCountState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleNoCountState(e):yield be.setCameraScanMultipleNoCountState(e)}catch(r){throw console.error("setCameraScanMultipleNoCountState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield be.getStatus()}catch(e){throw console.error("cameraScanMultipleNoCountPlugin getStatus error",e),e}})}}let le=null;window.__MICRO_APP_ENVIRONMENT__&&(le=(fr=window.rawWindow.__mini_app_status_hook__)!=null?fr:{});const Te=l.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends P{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}setCameraScanSingleOrDualState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=le==null?void 0:le.cameraScanSingleOrDual)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanSingleOrDual getStatus error",t),t}}}});class Zr{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanSingleOrDual(e):yield Te.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}setCameraScanSingleOrDualState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCameraScanSingleOrDualState(e):yield Te.setCameraScanSingleOrDualState(e)}catch(r){throw console.error("setCameraScanSingleOrDualState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Te.getStatus()}catch(e){throw console.error("cameraScanSingleOrDualPlugin getStatus error",e),e}})}}const rr="LaserScanPlugin";let de=null;window.__MICRO_APP_ENVIRONMENT__&&(de=(Mr=window.rawWindow.__mini_app_status_hook__)!=null?Mr:{});const we=l.registerPlugin(rr,{web:new class extends P{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=de==null?void 0:de.laserScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("laserScan getStatus error",t),t}}}}),ue=C();ue.removeAddListenerLaserScan=()=>null;const tr=(t=()=>null)=>{try{ue.removeAddListenerLaserScan&&ue.removeAddListenerLaserScan();const e=r=>a(this,null,function*(){r&&(ue.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(l.addListener){const o=yield l.addListener(rr,"nativeSendLaser",i=>n&&n(i));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Yr{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield we.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield we.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{we.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{tr(i)}),o(()=>{tr()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}getStatus(){return a(this,null,function*(){try{return yield we.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}const nr="CountAssistPlugin";let _e=null;window.__MICRO_APP_ENVIRONMENT__&&(_e=(Ir=window.rawWindow.__mini_app_status_hook__)!=null?Ir:{});const pe=l.registerPlugin(nr,{web:new class extends P{setCountAssistState(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}toggleCountAssist(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("hideCountAssist error",e),e}})}getCountAssistToggleState(){return a(this,null,function*(){try{return new Promise(t=>{t(void 0)})}catch(t){throw console.error("getCountAssistToggleState error",t),t}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=_e==null?void 0:_e.countAssist)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("countAssist getStatus error",t),t}}}}),j=C();j.addListenerCountAssistRemoveHandle=()=>null;const or=(t=()=>null)=>a(this,null,function*(){try{j!=null&&j.addListenerCountAssistRemoveHandle&&typeof j.addListenerCountAssistRemoveHandle=="function"&&j.addListenerCountAssistRemoveHandle(),j.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(nr,"nativeSendCountAssist",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(t)}catch(e){throw console.error("initCountAssistFn error",e),e}});class et{setCountAssistState(e){return a(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCountAssistState(e):yield pe.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return ne(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{or(i)}),o(()=>{or()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}toggleCountAssist(e){return a(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.toggleCountAssist(e):yield pe.toggleCountAssist(e)})}getCountAssistToggleState(){return a(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.getCountAssistToggleState():yield pe.getCountAssistToggleState()})}getStatus(){return a(this,null,function*(){try{return yield pe.getStatus()}catch(e){throw console.error("countAssistPlugin getStatus error",e),e}})}}let he=null;window.__MICRO_APP_ENVIRONMENT__&&(he=(Cr=window.rawWindow.__mini_app_status_hook__)!=null?Cr:{});const Be=l.registerPlugin("ClickStreamPlugin",{web:new class extends P{init(){return a(this,null,function*(){return new Promise(t=>{t(null)})})}trace(t){return a(this,null,function*(){var e,r;try{return window.__MICRO_APP_ENVIRONMENT__&&((r=(e=window.rawWindow.__mini_app_hook__).clickStream)==null||r.call(e,t.data)),new Promise(n=>{n(t)})}catch(n){throw console.error("clickStreamTraceParams error",n),n}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=he==null?void 0:he.clickStream)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("clickStream getStatus error",t),t}}}});class rt{constructor(){this.init()}init(){return a(this,null,function*(){try{return yield Be.init()}catch(e){throw console.error("clickStreamPlugin, init error",e),e}})}trace(e){return a(this,null,function*(){try{return yield Be.trace(e)}catch(r){throw console.error("clickStreamPlugin, trace error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Be.getStatus()}catch(e){throw console.error("clickStreamPlugin getStatus error",e),e}})}}const ar="MiniAppLifecyclePlugin";let me=null;window.__MICRO_APP_ENVIRONMENT__&&(me=(vr=window.rawWindow.__mini_app_status_hook__)!=null?vr:{});var G=(t=>(t.MINI_APP_BEFORE_UNMOUNT_PERMISSION="mini_app_before_unmount_permission",t.MINI_APP_BEFORE_UNMOUNT_COMPLETION="mini_app_before_unmount_completion",t))(G||{});const Ve=l.registerPlugin(ar,{web:new class extends P{setNativeUsagePermission(){return a(this,null,function*(){})}authorizeWebCallback(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=me==null?void 0:me.lifecycle)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("lifecycle getStatus error",t),t}}}}),ge=C();ge.removeAddListenerLifecycleMiniAppBeforeUnmount=()=>null;const ir=(t=()=>null)=>{try{ge.removeAddListenerLifecycleMiniAppBeforeUnmount&&ge.removeAddListenerLifecycleMiniAppBeforeUnmount();const e=r=>a(this,null,function*(){r&&(ge.removeAddListenerLifecycleMiniAppBeforeUnmount=yield(n=>a(this,null,function*(){try{if(l.addListener){const o=yield l.addListener(ar,"miniAppBeforeUnmount",i=>n&&n(i));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("miniAppBeforeUnmountHandle error",o),o}}))(r))});setTimeout(()=>a(this,null,function*(){yield e(t)}))}catch(e){throw console.error("laserScanFn error",e),e}};class tt{constructor(){}setNativeUsagePermission(e){return a(this,null,function*(){try{return yield Ve.setNativeUsagePermission(e)}catch(r){throw console.error("lifecyclePlugin.setNativeUsagePermission error",r),r}})}authorizeWebCallback(e){return a(this,null,function*(){try{return yield Ve.authorizeWebCallback(e)}catch(r){throw console.error("lifecyclePlugin.authorizeWebCallback error",r),r}})}miniAppBeforeUnmount(e){this.setNativeUsagePermission({action:G.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!0}),((r,n)=>{try{const{mounted:o,beforeUnmount:i,callBack:c}=r;o(()=>{ir(s=>a(this,null,function*(){var d;if(c&&c instanceof Function)try{(d=c(s))==null||d.then(()=>a(this,null,function*(){yield n.setNativeUsagePermission({action:G.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1}),yield n.authorizeWebCallback({action:G.MINI_APP_BEFORE_UNMOUNT_COMPLETION})}))}catch(u){console.error("miniAppBeforeUnmount error callBack is not a function or promise")}else console.error("miniAppBeforeUnmount error callBack is not a function or promise")}))}),i(()=>a(this,null,function*(){ir(),n.setNativeUsagePermission({action:G.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1})}))}catch(o){throw console.error("miniAppBeforeUnmount error",o),o}})(e,this)}getStatus(){return a(this,null,function*(){try{return yield Ve.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Pe=null;window.__MICRO_APP_ENVIRONMENT__&&(Pe=(Or=window.rawWindow.__mini_app_status_hook__)!=null?Or:{});const He=l.registerPlugin("DeviceInteractionPlugin",{web:new class extends P{callVibrate(){return a(this,null,function*(){})}callErrorBeep(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Pe==null?void 0:Pe.deviceInteraction)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("deviceInteraction getStatus error",t),t}}}});class nt{callVibrate(){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callVibrate():yield He.callVibrate()}catch(e){throw console.error("callVibrate error",e),e}})}callErrorBeep(){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callErrorBeep():yield He.callErrorBeep()}catch(e){throw console.error("callErrorBeep error",e),e}})}getStatus(){return a(this,null,function*(){try{return yield He.getStatus()}catch(e){throw console.error("deviceInteractionPlugin getStatus error",e),e}})}}const sr="PollingPlugin";let ye=null;window.__MICRO_APP_ENVIRONMENT__&&(ye=(Lr=window.rawWindow.__mini_app_status_hook__)!=null?Lr:{});const Ue=l.registerPlugin(sr,{web:new class extends P{create(){return a(this,null,function*(){})}destroy(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ye==null?void 0:ye.polling)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("polling getStatus error",t),t}}}}),Se=C();Se.removeAddListenerPolling=()=>null;const ot=(t,e)=>{try{Se.removeAddListenerPolling&&Se.removeAddListenerPolling();const r=e.pollingId;(n=>a(this,null,function*(){return n&&(Se.removeAddListenerPolling=yield(o=>a(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(sr,"nativeSendPolling",c=>o&&o(c));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPollingHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.pollingId)===r&&(n!=null&&n.pollingId)&&t.pollingList.forEach(o=>{o!=null&&o.pollingId&&(n==null?void 0:n.pollingId)===(o==null?void 0:o.pollingId)&&typeof(o==null?void 0:o.callBack)=="function"&&o.callBack(n)})})}catch(r){throw console.error("pollingFn error",r),r}};class at{constructor(){f(this,"pollingList");this.pollingList=[]}create(e){var r,n,o;if(window.__MICRO_APP_ENVIRONMENT__){const{mounted:i,pollingParams:c,callBack:s}=e;return i(()=>{var d,u;(u=(d=window.rawWindow.__mini_app_hook__)==null?void 0:d.addPolling)==null||u.call(d,c,s)}),()=>{this.destroy({pollingId:c.pollingId})}}try{(r=e==null?void 0:e.pollingParams)!=null&&r.pollingId&&this.pollingList.push({pollingId:(n=e==null?void 0:e.pollingParams)==null?void 0:n.pollingId,callBack:e==null?void 0:e.callBack}),this.pollingList=this.pollingList.filter((c,s,d)=>s===d.findIndex(u=>u.pollingId===c.pollingId));const i=((o=e==null?void 0:e.pollingParams)==null?void 0:o.delay)/1e3;return Ue.create(z(q({},e==null?void 0:e.pollingParams),{delay:i})),((c,s)=>{try{const{mounted:d,pollingParams:u}=c;d(()=>ot(s,u))}catch(d){throw console.error("createPolling error",d),d}})(e,this),()=>{var c,s;return(c=e==null?void 0:e.pollingParams)!=null&&c.pollingId?this.destroy({pollingId:(s=e==null?void 0:e.pollingParams)==null?void 0:s.pollingId}):null}}catch(i){throw console.error("pollingPlugin create error",i),i}}destroy(e){var r,n,o;if(window.__MICRO_APP_ENVIRONMENT__){const{pollingId:i}=e;(n=(r=window.rawWindow.__mini_app_hook__)==null?void 0:r.deletePolling)==null||n.call(r,i)}else try{const i=this.pollingList.map(c=>c.pollingId).indexOf(e.pollingId);return(o=this.pollingList)!=null&&o.length&&(Number(i)||Number(i)>=0)&&this.pollingList.splice(Number(i),1),Ue.destroy(e)}catch(i){throw console.error("pollingPlugin destroy error",i),i}}getStatus(){return a(this,null,function*(){try{return yield Ue.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Ne=null;window.__MICRO_APP_ENVIRONMENT__&&(Ne=(Ar=window.rawWindow.__mini_app_status_hook__)!=null?Ar:{});const cr=l.registerPlugin("PaymentPlugin",{web:new class extends P{process(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("process error",e),e}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Ne==null?void 0:Ne.payment)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("payment getStatus error",t),t}}}});class it{process(e){return a(this,null,function*(){try{return yield cr.process(e)}catch(r){throw console.error("paymentPlugins.process error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield cr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let fe=null;window.__MICRO_APP_ENVIRONMENT__&&(fe=(Er=window.rawWindow.__mini_app_status_hook__)!=null?Er:{});const Fe=l.registerPlugin("CameraForTakePhotoPlugin",{web:new class extends P{pickCameraForTakePhoto(){return a(this,null,function*(){})}setCameraForTakePhotoState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=fe==null?void 0:fe.cameraForTakePhoto)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraForTakePhoto getStatus error",t),t}}}});class st{pickCameraForTakePhoto(){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraForTakePhoto():yield Fe.pickCameraForTakePhoto()}catch(e){throw console.error("pickCameraForTakePhoto error",e),e}})}setCameraForTakePhotoState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraForTakePhotoState(e):yield Fe.setCameraForTakePhotoState(e)}catch(r){throw console.error("setCameraForTakePhotoState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Fe.getStatus()}catch(e){throw console.error("cameraForTakePhotoPlugin getStatus error",e),e}})}}let Me=null;window.__MICRO_APP_ENVIRONMENT__&&(Me=(Rr=window.rawWindow.__mini_app_status_hook__)!=null?Rr:{});const lr=l.registerPlugin("HttpPlugin",{web:new class extends P{request(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Me==null?void 0:Me.http)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("http getStatus error",t),t}}}});class ct{request(e){return a(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.requestHttp(e);{let r={};return e.url&&(r.url=e.url),e.method&&(r.method=e.method),e.headers&&(r.headers=e.headers),e.params&&(r.urlParams=e.params),e.data&&(typeof e.data=="string"?r.bodyData=e.data:r.bodyParams=e.data),e.upload&&(r.upload=e.upload),yield lr.request(r)}}catch(r){throw console.error("HttpPlugin, trace error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield lr.getStatus()}catch(e){throw console.error("HttpPlugin getStatus error",e),e}})}}const M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));const lt=new Uint8Array(16);function dt(t,e,r){return e||t||!crypto.randomUUID?function(n,o,i){var s,d,u;n=n||{};const c=(u=(d=n.random)!=null?d:(s=n.rng)==null?void 0:s.call(n))!=null?u:crypto.getRandomValues(lt);if(c.length<16)throw new Error("Random bytes length must be >= 16");if(c[6]=15&c[6]|64,c[8]=63&c[8]|128,o){if((i=i||0)<0||i+16>o.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let _=0;_<16;++_)o[i+_]=c[_];return o}return function(_,h=0){return(M[_[h+0]]+M[_[h+1]]+M[_[h+2]]+M[_[h+3]]+"-"+M[_[h+4]]+M[_[h+5]]+"-"+M[_[h+6]]+M[_[h+7]]+"-"+M[_[h+8]]+M[_[h+9]]+"-"+M[_[h+10]]+M[_[h+11]]+M[_[h+12]]+M[_[h+13]]+M[_[h+14]]+M[_[h+15]]).toLowerCase()}(c)}(t,e,r):crypto.randomUUID()}const dr="PrintPlugin";let Ie=null;window.__MICRO_APP_ENVIRONMENT__&&(Ie=(kr=window.rawWindow.__mini_app_status_hook__)!=null?kr:{});const wr=l.registerPlugin(dr,{web:new class extends P{print(){}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Ie==null?void 0:Ie.print)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("print getStatus error",t),t}}}}),Q=C();Q.removeAddListenerPrintList={};const wt=(t,e)=>{try{const r=e.printId;Q.removeAddListenerPrintList=z(q({},Q.removeAddListenerPrintList),{printId:()=>{}}),(n=>a(this,null,function*(){return n&&(Q.removeAddListenerPrintList[r]=yield(o=>a(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(dr,"nativeSendPrint",c=>o&&o(c));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPrintHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.printId)===r&&(n!=null&&n.printId)&&t.printList.forEach(o=>{var i,c,s;o!=null&&o.printId&&(n==null?void 0:n.printId)===(o==null?void 0:o.printId)&&(typeof(o==null?void 0:o.callBack)=="function"&&o.callBack(n),(s=o.state==5||o.state==6)!=null||(c=(i=Q.removeAddListenerPrintList)==null?void 0:i[o==null?void 0:o.printId])==null||c.call(i))})})}catch(r){throw console.error("printFn error",r),r}};class ut{constructor(){f(this,"printList");this.printList=[]}print(e){var n,o,i,c;const r=((o=(n=e==null?void 0:e.printParams)==null?void 0:n.functionId)!=null?o:"")+dt().replace(/-/g,"");if(this.printList.push({printId:r,callBack:e==null?void 0:e.callBack}),this.printList=this.printList.filter((s,d,u)=>d===u.findIndex(_=>_.printId===s.printId)),window.__MICRO_APP_ENVIRONMENT__){const{printParams:s,callBack:d}=e;return(c=(i=window.rawWindow.__mini_app_hook__)==null?void 0:i.print)==null||c.call(i,z(q({},s),{printId:r}),d),{id:r}}try{return wr.print(z(q({},e==null?void 0:e.printParams),{printId:r})),((s,d)=>{try{const{printParams:u}=s;wt(d,u)}catch(u){throw console.error("createPrint error",u),u}})(z(q({},e),{printParams:z(q({},e.printParams),{printId:r})}),this),{id:r}}catch(s){throw console.error("printPlugin create error",s),s}}getStatus(){return a(this,null,function*(){try{return yield wr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Ce=null;window.__MICRO_APP_ENVIRONMENT__&&(Ce=(br=window.rawWindow.__mini_app_status_hook__)!=null?br:{});const X=(t,e,r="",n="")=>({success:t,message:e,type:r,fileName:n}),We=t=>{var e;return(e=t==null?void 0:t.trim().replace(/^\.+/,"").toLowerCase())!=null?e:""},ur=(t,e)=>{const r=(n=>{var c,s,d;const o=We(n);return o?o.includes("/")?(d=(s=((c=o.split("/").pop())!=null?c:"").split("+").pop())==null?void 0:s.split(".").pop())!=null?d:"":o:""})(e);return!r||t.toLowerCase().endsWith(`.${r}`)?t:`${t}.${r}`},_r=t=>{var i;const e=(i=t==null?void 0:t.trim())!=null?i:"",r=e.lastIndexOf(".");if(r<=0||r===e.length-1)return{name:e,type:"",fileName:e};const n=e.slice(0,r),o=We(e.slice(r+1));return{name:n,type:o,fileName:o?ur(n,o):e}},pr=t=>{const e=_r(t==null?void 0:t.fileName),r=_r((i=>{if(!i)return"";try{const c=new URL(i,window.location.href).pathname.split("/").filter(Boolean).pop();return c?decodeURIComponent(c):""}catch(c){return""}})(t==null?void 0:t.url)),n=We(t==null?void 0:t.type)||e.type||r.type,o=e.name||r.name||`path_${Date.now()}`;return{type:n,fileName:n?ur(o,n):o}},hr=l.registerPlugin("DownloadFilePlugin",{web:new class extends P{downloadFile(t){return a(this,null,function*(){var e;try{const{type:r,fileName:n}=pr(t),o=(e=t==null?void 0:t.url)==null?void 0:e.trim();if(!r)return X(!1,"Missing required parameter: type",r,n);if(!o)return X(!1,"Missing required parameter: url",r,n);const i=yield fetch(o,t==null?void 0:t.fetchOptions);if(!i.ok)return X(!1,`HTTP error! status: ${i.status}`,r,n);const c=yield i.blob(),s=window.URL.createObjectURL(c),d=document.createElement("a");return d.href=s,d.download=n,document.body.appendChild(d),d.click(),d.remove(),window.setTimeout(()=>window.URL.revokeObjectURL(s),0),X(!0,"download success",r,n)}catch(r){console.error("downloadFile error",r);const{type:n,fileName:o}=pr(t);return X(!1,r instanceof Error?r.message:"download failed",n,o)}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Ce==null?void 0:Ce.downloadFile)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("downloadFile getStatus error",t),t}}}}),xe=t=>{var e;return(e=t==null?void 0:t.trim().replace(/^\.+/,"").toLowerCase())!=null?e:""},_t=(t,e)=>{const r=(n=>{var c,s,d;const o=xe(n);return o?o.includes("/")?(d=(s=((c=o.split("/").pop())!=null?c:"").split("+").pop())==null?void 0:s.split(".").pop())!=null?d:"":o:""})(e);return!r||t.toLowerCase().endsWith(`.${r}`)?t:`${t}.${r}`},mr=t=>{var n;const e=(n=t==null?void 0:t.trim())!=null?n:"",r=e.lastIndexOf(".");return r<=0||r===e.length-1?{name:e,type:""}:{name:e.slice(0,r),type:xe(e.slice(r+1))}},gr=(t,e)=>{const r=mr(t==null?void 0:t.fileName),n=mr((c=>{if(!c)return"";try{const s=new URL(c,window.location.href).pathname.split("/").filter(Boolean).pop();return s?decodeURIComponent(s):""}catch(s){return""}})(t==null?void 0:t.url)),o=xe(t==null?void 0:t.type)||r.type||n.type,i=r.name||n.name||`path_${Date.now()}`;return{success:!1,message:e,type:o,fileName:o?_t(i,o):i}};class pt{downloadFile(e){return a(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.downloadFile;return r?yield r(e):gr(e,"DownloadFilePlugin is not available")}return yield hr.downloadFile(e)}catch(r){return console.error("downloadFile error",r),gr(e,r instanceof Error?r.message:"download failed")}})}getStatus(){return a(this,null,function*(){try{return yield hr.getStatus()}catch(e){throw console.error("downloadFile getStatus error",e),e}})}}class Pr{constructor(){f(this,"initialContextPlugins",new qr);f(this,"communicatePlugins",new Jr);f(this,"cameraScanPlugins",new Gr);f(this,"cameraScanMultiplePlugins",new Qr);f(this,"cameraScanMultipleNoCountPlugins",new Xr);f(this,"cameraScanSingleOrDualPlugins",new Zr);f(this,"laserScanPlugins",new Yr);f(this,"countAssistPlugins",new et);f(this,"clickStreamPlugins",new rt);f(this,"lifecyclePlugins",new tt);f(this,"deviceInteractionPlugins",new nt);f(this,"pollingPlugins",new at);f(this,"paymentPlugins",new it);f(this,"cameraForTakePhotoPlugin",new st);f(this,"httpPlugin",new ct);f(this,"printPlugins",new ut);f(this,"downloadFilePlugin",new pt)}}const ht=new Pr;let w=null,ve=null;window.__MICRO_APP_ENVIRONMENT__&&(w=(Tr=window.rawWindow.__mini_app_hook__)!=null?Tr:{},ve=(Br=window.rawWindow.__mini_app_status_hook__)!=null?Br:{});const mt=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends P{homeIsClick(t){return a(this,null,function*(){var e;window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch homeIsClick",t),(e=w.disabledMenu)==null||e.call(w,t))})}openMiniApp(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=w.openMiniApp)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch showTitle",t),(e=w.showTitle)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showTitle error",r),r}})}showFABMenu(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=w.showFABMenu)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showFABMenu error",r),r}})}disableFAB(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=w.disableFAB)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=w.disableBack)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableBack error",r),r}})}showSubMask(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=w.showSubMask)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=w.setMiniAppVersion)==null||e.call(w,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showDialog(){return a(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=w.showDialog)==null||t.call(w))})}cancelDialog(){return a(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=w.cancelDialog)==null||t.call(w))})}getMiniAppKong(t){return a(this,null,function*(){var e,r;try{if(window.__MICRO_APP_ENVIRONMENT__){const n=(r=(e=w.getMiniAppKong)==null?void 0:e.call(w,t))!=null?r:{};return new Promise(o=>{o(n)})}return new Promise(n=>{n(t)})}catch(n){throw console.error("getMiniAppKong error",n),n}})}closeMiniApp(){return a(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=w.closeMiniApp)==null||t.call(w))})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ve==null?void 0:ve.communicate)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("communicate getStatus error",t),t}}dispatchToShell(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>a(this,null,function*(){var r;e((yield(r=w==null?void 0:w.dispatchToShell)==null?void 0:r.call(w,t))||{})})):new Promise(e=>{e(t)})}catch(e){throw console.error("communicate dispatchToShell error",e),e}}getMiniAppInfo(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>a(this,null,function*(){var r;e((yield(r=w==null?void 0:w.getMiniAppInfo)==null?void 0:r.call(w,t))||{})})):new Promise(e=>{e({})})}catch(e){throw console.error("communicate getMiniAppInfo error",e),e}}}},Symbol.toStringTag,{value:"Module"}));N.NativeApi=Pr,N.default=ht,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
|
1
|
+
/* eslint-disable no-restricted-globals */
|
|
2
|
+
/* global globalThis */
|
|
3
|
+
var mt=Object.defineProperty,gt=Object.defineProperties;var Pt=Object.getOwnPropertyDescriptors;var Fr=Object.getOwnPropertySymbols;var yt=Object.prototype.hasOwnProperty,St=Object.prototype.propertyIsEnumerable;var qe=(N,g,S)=>g in N?mt(N,g,{enumerable:!0,configurable:!0,writable:!0,value:S}):N[g]=S,q=(N,g)=>{for(var S in g||(g={}))yt.call(g,S)&&qe(N,S,g[S]);if(Fr)for(var S of Fr(g))St.call(g,S)&&qe(N,S,g[S]);return N},z=(N,g)=>gt(N,Pt(g));var f=(N,g,S)=>(qe(N,typeof g!="symbol"?g+"":g,S),S);var a=(N,g,S)=>new Promise((B,K)=>{var Ae=v=>{try{l(S.next(v))}catch(P){K(P)}},Le=v=>{try{l(S.throw(v))}catch(P){K(P)}},l=v=>v.done?B(v.value):Promise.resolve(v.value).then(Ae,Le);l((S=S.apply(N,g)).next())});(function(N,g){typeof exports=="object"&&typeof module!="undefined"?g(exports):typeof define=="function"&&define.amd?define(["exports"],g):g((N=typeof globalThis!="undefined"?globalThis:N||self).main={})})(this,function(N){var gr,Pr,yr,Sr,Nr,fr,Mr,Ir,Cr,vr,Or,Ar,Lr,Er,Rr,kr,br;"use strict";/*! Capacitor: https://capacitorjs.com/ - MIT License */const g=t=>t.CapacitorPlatforms=(e=>{const r=new Map;r.set("web",{name:"web"});const n=e.CapacitorPlatforms||{currentPlatform:{name:"web"},platforms:r};return n.addPlatform=(o,i)=>{n.platforms.set(o,i)},n.setPlatform=o=>{n.platforms.has(o)&&(n.currentPlatform=n.platforms.get(o))},n})(t),S=g(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{});var B;S.addPlatform,S.setPlatform,function(t){t.Unimplemented="UNIMPLEMENTED",t.Unavailable="UNAVAILABLE"}(B||(B={}));class K extends Error{constructor(e,r,n){super(e),this.message=e,this.code=r,this.data=n}}const Ae=t=>{var e,r,n,o,i;const s=t.CapacitorCustomPlatform||null,c=t.Capacitor||{},u=c.Plugins=c.Plugins||{},w=t.CapacitorPlatforms,_=((e=w==null?void 0:w.currentPlatform)===null||e===void 0?void 0:e.getPlatform)||(()=>s!==null?s.name:(p=>{var m,I;return p!=null&&p.androidBridge?"android":!((I=(m=p==null?void 0:p.webkit)===null||m===void 0?void 0:m.messageHandlers)===null||I===void 0)&&I.bridge?"ios":"web"})(t)),h=((r=w==null?void 0:w.currentPlatform)===null||r===void 0?void 0:r.isNativePlatform)||(()=>_()!=="web"),O=((n=w==null?void 0:w.currentPlatform)===null||n===void 0?void 0:n.isPluginAvailable)||(p=>{const m=A.get(p);return!!(m!=null&&m.platforms.has(_()))||!!b(p)}),b=((o=w==null?void 0:w.currentPlatform)===null||o===void 0?void 0:o.getPluginHeader)||(p=>{var m;return(m=c.PluginHeaders)===null||m===void 0?void 0:m.find(I=>I.name===p)}),A=new Map,L=((i=w==null?void 0:w.currentPlatform)===null||i===void 0?void 0:i.registerPlugin)||((p,m={})=>{const I=A.get(p);if(I)return console.warn(`Capacitor plugin "${p}" already registered. Cannot register plugins twice.`),I.proxy;const E=_(),Z=b(p);let $;const xe=T=>{let V;const J=(...Oe)=>{const Y=(()=>a(this,null,function*(){return!$&&E in m?$=$=typeof m[E]=="function"?yield m[E]():m[E]:s!==null&&!$&&"web"in m&&($=$=typeof m.web=="function"?yield m.web():m.web),$}))().then(ee=>{const Vr=((R,re)=>{var je,$e;if(!Z){if(R)return($e=R[re])===null||$e===void 0?void 0:$e.bind(R);throw new K(`"${p}" plugin is not implemented on ${E}`,B.Unimplemented)}{const Hr=Z==null?void 0:Z.methods.find(te=>re===te.name);if(Hr)return Hr.rtype==="promise"?te=>c.nativePromise(p,re.toString(),te):(te,ht)=>c.nativeCallback(p,re.toString(),te,ht);if(R)return(je=R[re])===null||je===void 0?void 0:je.bind(R)}})(ee,T);if(Vr){const R=Vr(...Oe);return V=R==null?void 0:R.remove,R}throw new K(`"${p}.${T}()" is not implemented on ${E}`,B.Unimplemented)});return T==="addListener"&&(Y.remove=()=>a(this,null,function*(){return V()})),Y};return J.toString=()=>`${T.toString()}() { [capacitor code] }`,Object.defineProperty(J,"name",{value:T,writable:!1,configurable:!1}),J},Tr=xe("addListener"),Br=xe("removeListener"),pt=(T,V)=>{const J=Tr({eventName:T},V),Oe=()=>a(this,null,function*(){const ee=yield J;Br({eventName:T,callbackId:ee},V)}),Y=new Promise(ee=>J.then(()=>ee({remove:Oe})));return Y.remove=()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield Oe()}),Y},De=new Proxy({},{get(T,V){switch(V){case"$$typeof":return;case"toJSON":return()=>({});case"addListener":return Z?pt:Tr;case"removeListener":return Br;default:return xe(V)}}});return u[p]=De,A.set(p,{name:p,proxy:De,platforms:new Set([...Object.keys(m),...Z?[E]:[]])}),De});return c.convertFileSrc||(c.convertFileSrc=p=>p),c.getPlatform=_,c.handleError=p=>t.console.error(p),c.isNativePlatform=h,c.isPluginAvailable=O,c.pluginMethodNoop=(p,m,I)=>Promise.reject(`${I} does not have an implementation of "${m}".`),c.registerPlugin=L,c.Exception=K,c.DEBUG=!!c.DEBUG,c.isLoggingEnabled=!!c.isLoggingEnabled,c.platform=c.getPlatform(),c.isNative=c.isNativePlatform(),c},Le=t=>t.Capacitor=Ae(t),l=Le(typeof globalThis!="undefined"?globalThis:typeof self!="undefined"?self:typeof window!="undefined"?window:typeof global!="undefined"?global:{}),v=l.registerPlugin;l.Plugins;class P{constructor(e){this.listeners={},this.windowListeners={},e&&(console.warn(`Capacitor WebPlugin "${e.name}" config object was deprecated in v3 and will be removed in v4.`),this.config=e)}addListener(e,r){this.listeners[e]||(this.listeners[e]=[]),this.listeners[e].push(r);const n=this.windowListeners[e];n&&!n.registered&&this.addWindowListener(n);const o=()=>a(this,null,function*(){return this.removeListener(e,r)}),i=Promise.resolve({remove:o});return Object.defineProperty(i,"remove",{value:()=>a(this,null,function*(){console.warn("Using addListener() without 'await' is deprecated."),yield o()})}),i}removeAllListeners(){return a(this,null,function*(){this.listeners={};for(const e in this.windowListeners)this.removeWindowListener(this.windowListeners[e]);this.windowListeners={}})}notifyListeners(e,r){const n=this.listeners[e];n&&n.forEach(o=>o(r))}hasListeners(e){return!!this.listeners[e].length}registerWindowListener(e,r){this.windowListeners[r]={registered:!1,windowEventName:e,pluginEventName:r,handler:n=>{this.notifyListeners(r,n)}}}unimplemented(e="not implemented"){return new l.Exception(e,B.Unimplemented)}unavailable(e="not available"){return new l.Exception(e,B.Unavailable)}removeListener(e,r){return a(this,null,function*(){const n=this.listeners[e];if(!n)return;const o=n.indexOf(r);this.listeners[e].splice(o,1),this.listeners[e].length||this.removeWindowListener(this.windowListeners[e])})}addWindowListener(e){window.addEventListener(e.windowEventName,e.handler),e.registered=!0}removeWindowListener(e){e&&(window.removeEventListener(e.windowEventName,e.handler),e.registered=!1)}}const ze=t=>encodeURIComponent(t).replace(/%(2[346B]|5E|60|7C)/g,decodeURIComponent).replace(/[()]/g,escape),Ke=t=>t.replace(/(%[\dA-F]{2})+/gi,decodeURIComponent);class Ur extends P{getCookies(){return a(this,null,function*(){const e=document.cookie,r={};return e.split(";").forEach(n=>{if(n.length<=0)return;let[o,i]=n.replace(/=/,"CAP_COOKIE").split("CAP_COOKIE");o=Ke(o).trim(),i=Ke(i).trim(),r[o]=i}),r})}setCookie(e){return a(this,null,function*(){try{const r=ze(e.key),n=ze(e.value),o=`; expires=${(e.expires||"").replace("expires=","")}`,i=(e.path||"/").replace("path=",""),s=e.url!=null&&e.url.length>0?`domain=${e.url}`:"";document.cookie=`${r}=${n||""}${o}; path=${i}; ${s};`}catch(r){return Promise.reject(r)}})}deleteCookie(e){return a(this,null,function*(){try{document.cookie=`${e.key}=; Max-Age=0`}catch(r){return Promise.reject(r)}})}clearCookies(){return a(this,null,function*(){try{const e=document.cookie.split(";")||[];for(const r of e)document.cookie=r.replace(/^ +/,"").replace(/=.*/,`=;expires=${new Date().toUTCString()};path=/`)}catch(e){return Promise.reject(e)}})}clearAllCookies(){return a(this,null,function*(){try{yield this.clearCookies()}catch(e){return Promise.reject(e)}})}}v("CapacitorCookies",{web:()=>new Ur});const Wr=(t,e={})=>{const r=Object.assign({method:t.method||"GET",headers:t.headers},e),n=((o={})=>{const i=Object.keys(o);return Object.keys(o).map(s=>s.toLocaleLowerCase()).reduce((s,c,u)=>(s[c]=o[i[u]],s),{})})(t.headers)["content-type"]||"";if(typeof t.data=="string")r.body=t.data;else if(n.includes("application/x-www-form-urlencoded")){const o=new URLSearchParams;for(const[i,s]of Object.entries(t.data||{}))o.set(i,s);r.body=o.toString()}else if(n.includes("multipart/form-data")){const o=new FormData;if(t.data instanceof FormData)t.data.forEach((s,c)=>{o.append(c,s)});else for(const s of Object.keys(t.data))o.append(s,t.data[s]);r.body=o;const i=new Headers(r.headers);i.delete("content-type"),r.headers=i}else(n.includes("application/json")||typeof t.data=="object")&&(r.body=JSON.stringify(t.data));return r};class xr extends P{request(e){return a(this,null,function*(){const r=Wr(e,e.webFetchExtra),n=((h,O=!0)=>h?Object.entries(h).reduce((b,A)=>{const[L,p]=A;let m,I;return Array.isArray(p)?(I="",p.forEach(E=>{m=O?encodeURIComponent(E):E,I+=`${L}=${m}&`}),I.slice(0,-1)):(m=O?encodeURIComponent(p):p,I=`${L}=${m}`),`${b}&${I}`},"").substr(1):null)(e.params,e.shouldEncodeUrlParams),o=n?`${e.url}?${n}`:e.url,i=yield fetch(o,r),s=i.headers.get("content-type")||"";let c,u,{responseType:w="text"}=i.ok?e:{};switch(s.includes("application/json")&&(w="json"),w){case"arraybuffer":case"blob":u=yield i.blob(),c=yield(h=>a(this,null,function*(){return new Promise((O,b)=>{const A=new FileReader;A.onload=()=>{const L=A.result;O(L.indexOf(",")>=0?L.split(",")[1]:L)},A.onerror=L=>b(L),A.readAsDataURL(h)})}))(u);break;case"json":c=yield i.json();break;default:c=yield i.text()}const _={};return i.headers.forEach((h,O)=>{_[O]=h}),{data:c,headers:_,status:i.status,url:i.url}})}get(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"GET"}))})}post(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"POST"}))})}put(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PUT"}))})}patch(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"PATCH"}))})}delete(e){return a(this,null,function*(){return this.request(Object.assign(Object.assign({},e),{method:"DELETE"}))})}}function Ee(){return l.getPlatform()==="android"?JSON.parse(AndroidInitialContext.initialContext()):window.portalInitialContext}v("CapacitorHttp",{web:()=>new xr}),v("Portals",{web:()=>Promise.resolve().then(function(){return Dr}).then(t=>new t.PortalsWeb)});const Dr=Object.freeze({__proto__:null,PortalsWeb:class extends P{publishNative(t){return a(this,null,function*(){})}}}),ne=t=>{var e,r,n;try{if(typeof window=="undefined")return;if(Ee&&((e=Ee())!=null&&e.value)){const o=(n=(r=Ee())==null?void 0:r.value)!=null?n:null;if(!o)return void console.error("native initialContext is undefine");if(!t)return void console.error("initialContext call back is undefine");t(o)}}catch(o){throw console.error("getInitialContextHandle error",o),o}};class jr{isNative(){try{return(()=>{try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.isNative();{let e=!1;return ne(r=>{e=!!(r!=null&&r.isNative)}),e}}catch(e){throw console.error("isNative error",e),e}})()}catch(e){throw console.error("isNative error",e),e}}redirectPage(e){try{if(window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.redirectPage(window.__MICRO_APP_NAME__);if(console.log("redirectParams",r),r)return e.callBack(r)}else(({callBack:r})=>{ne(n=>{var o;try{if(!(n!=null&&n.params))return void console.info("initial context native params is undefine");const i=(o=n==null?void 0:n.params)!=null?o:null;if(!i)return;if(!r)return void console.error("initial context call back is undefine");r(i)}catch(i){throw console.error("redirectPageHandle error",i),i}})})(e)}catch(r){throw console.error("redirectPage error",r),r}}getNativeInfo(e){var r;try{return this.isNative()?window.__MICRO_APP_ENVIRONMENT__?(r=window.rawWindow.__mini_app_hook__.getNativeInfo(e))!=null?r:{}:(()=>{try{let n=null;return ne(o=>{n=o!=null?o:null}),n}catch(n){throw console.error("getNativeInfoHandle error",n),n}})():(n=>{var o;return(o=n==null?void 0:n.mockData)!=null?o:null})(e)}catch(n){throw console.error("getNativeInfo error",n),n}}getStatus(){return new Promise(e=>{e({isNative:!0,redirectPage:!0,getNativeInfo:!0})})}}const C=()=>{try{let t={};return typeof window!="undefined"&&(t=window),t}catch(t){throw console.error("isWinHandle error",t),t}},k="CommunicatePlugin",y=l.registerPlugin(k,{web:()=>Promise.resolve().then(()=>_t).then(t=>new t.PluginsWeb)}),oe=C();oe.removeAddListenerFab=()=>null;const $r=(t,e)=>{var r,n;try{oe.removeAddListenerFab&&oe.removeAddListenerFab();const o=[];if((r=y.showFABMenu)==null||r.call(y,{fabMenu:o,position:null}),!t||!((n=Object.keys(t))!=null&&n.length))return;Object.keys(t).forEach(i=>{var s,c,u,w,_,h,O,b;o.push({disable:(c=(s=t==null?void 0:t[i])==null?void 0:s.disable)!=null?c:!1,icon:(w=(u=t==null?void 0:t[i])==null?void 0:u.icon)!=null?w:"",id:(h=(_=t==null?void 0:t[i])==null?void 0:_.id)!=null?h:"",name:(b=(O=t==null?void 0:t[i])==null?void 0:O.title)!=null?b:""})}),queueMicrotask(()=>{var i;(i=y.showFABMenu)==null||i.call(y,{fabMenu:o,position:e!=null?e:null})}),setTimeout(()=>{(i=>a(this,null,function*(){i&&(oe.removeAddListenerFab=yield(s=>a(this,null,function*(){try{if(l.addListener){const c=yield l.addListener(k,"nativeSendFab",u=>s&&s(u));return c!=null&&c.remove?c.remove:()=>null}}catch(c){throw console.error("addListenerFabHandle error",c),c}}))(i))}))(i=>{let s;i!=null&&i.disable||i!=null&&i.id&&(Object.keys(t).forEach(c=>{var u,w,_;(u=t==null?void 0:t[c])!=null&&u.id&&i.id===t[c].id&&(s=(_=(w=t[c])==null?void 0:w.fn)!=null?_:()=>null)}),typeof s=="function"&&s())})})}catch(o){throw console.error("fabBtnHandle error",o),o}},H=C();H.addListenerBackRemoveHandle=()=>null;const Je=(t=()=>null)=>a(this,null,function*(){try{H!=null&&H.addListenerBackRemoveHandle&&typeof H.addListenerBackRemoveHandle=="function"&&H.addListenerBackRemoveHandle(),H.addListenerBackRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendBack",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerBackHandle error",r),r}}))(t)}catch(e){throw console.error("initBackBtnFn error",e),e}}),ae=C();ae.addListenerHomeHandle=()=>null;const qr=t=>{try{ae.addListenerHomeHandle&&ae.addListenerHomeHandle(),setTimeout(()=>{(e=>a(this,null,function*(){e&&(ae.addListenerHomeHandle=yield(r=>a(this,null,function*(){try{if(l.addListener){const n=yield l.addListener(k,"nativeSendHome",o=>r&&r(o));return n!=null&&n.remove?n.remove:()=>null}}catch(n){throw console.error("addListenerHomeHandle error",n),n}}))(e))}))(t)})}catch(e){throw console.error("homeFn error",e),e}},F=C();F.addListenerTouchRemoveHandle=()=>null;const Ge=(t=()=>null)=>a(this,null,function*(){try{F!=null&&F.addListenerTouchRemoveHandle&&typeof F.addListenerTouchRemoveHandle=="function"&&F.addListenerTouchRemoveHandle(),F.addListenerTouchRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeTouchListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerTouchHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),U=C();U.addListenerSendDeepLinkRemoveHandle=()=>null;const Qe=(t=()=>null)=>a(this,null,function*(){try{U!=null&&U.addListenerSendDeepLinkRemoveHandle&&typeof U.addListenerSendDeepLinkRemoveHandle=="function"&&U.addListenerSendDeepLinkRemoveHandle(),U.addListenerSendDeepLinkRemoveHandle=yield(e=>a(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return e&&window.rawWindow.__mini_app_hook__.getDeeplinkParams(e),{remove:()=>null};if(l.addListener){const r=yield l.addListener(k,"nativeSendDeeplinkCallbackListener",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSendDeepLinkHandle error",r),r}}))(t)}catch(e){throw console.error("initTouchFn error",e),e}}),W=C();W.addListenerSwitchLanguageRemoveHandle=()=>null;const Xe=(t=()=>null)=>a(this,null,function*(){try{W!=null&&W.addListenerSwitchLanguageRemoveHandle&&typeof W.addListenerSwitchLanguageRemoveHandle=="function"&&W.addListenerSwitchLanguageRemoveHandle(),W.addListenerSwitchLanguageRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendSwitchLanguage",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.switchLanguage=e,{remove:()=>{window.rawWindow.__mini_app_hook__.switchLanguage=null}}}catch(r){throw console.error("addListenerSwitchLanguageHandle error",r),r}}))(t)}catch(e){throw console.error("initSwitchLanguageFn error",e),e}}),x=C();x.addListenerSetupMiniAppRemoveHandle=()=>null;const Ze=(t=()=>null)=>a(this,null,function*(){try{x!=null&&x.addListenerSetupMiniAppRemoveHandle&&typeof x.addListenerSetupMiniAppRemoveHandle=="function"&&x.addListenerSetupMiniAppRemoveHandle(),x.addListenerSetupMiniAppRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSetupMiniApp",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerSetupMiniAppHandle error",r),r}}))(t)}catch(e){throw console.error("initSetupMiniAppFn error",e),e}}),D=C();D.addListenerSwitchStoreRemoveHandle=()=>null;const Ye=(t=()=>null)=>a(this,null,function*(){try{D!=null&&D.addListenerSwitchStoreRemoveHandle&&typeof D.addListenerSwitchStoreRemoveHandle=="function"&&D.addListenerSwitchStoreRemoveHandle(),D.addListenerSwitchStoreRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(k,"nativeSendSwitchStore",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.switchStore=e,{remove:()=>{window.rawWindow.__mini_app_hook__.switchStore=null}}}catch(r){throw console.error("addListenerSwitchStoreHandle error",r),r}}))(t)}catch(e){throw console.error("initSwitchStoreFn error",e),e}});class zr{constructor(){this.homeBtnSwitch({isClick:!0})}homeBtnSwitch(e){return a(this,null,function*(){var r;try{return yield(r=y.homeIsClick)==null?void 0:r.call(y,e)}catch(n){throw console.error("homeBtnSwitch error",n),n}})}setBackBtn(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Je(i)}),o(()=>{Je()})}catch(n){throw console.error("backBtnHandle error",n),n}})(e)}catch(r){throw console.error("setBackBtn error",r),r}}setHomeBtn(e){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setHomeBtn=e:qr(e)}catch(r){throw console.error("setHomeBtn error",r),r}}setFabBtn(e,r){try{window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setFabBtn(e,r):$r(e,r)}catch(n){throw console.error("setFabBtn error",n),n}}touchListener(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Ge(i)}),o(()=>{Ge()})}catch(n){throw console.error("touchListenerHandle error",n),n}})(e)}catch(r){throw console.error("listenerTouch error",r),r}}disableFAB(e){return a(this,null,function*(){try{return yield y.disableFAB(e)}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(e){return a(this,null,function*(){try{return yield y.disableBack(e)}catch(r){throw console.error("disableBack error",r),r}})}openMiniApp(e){return a(this,null,function*(){try{return yield y.openMiniApp(e)}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(e){return a(this,null,function*(){try{return yield y.showTitle(e)}catch(r){throw console.error("showTitle error",r),r}})}showSubMask(e){return a(this,null,function*(){try{return yield y.showSubMask(e)}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(e){return a(this,null,function*(){try{return yield y.setMiniAppVersion(e)}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showNativeLoading(){return a(this,null,function*(){try{return yield y.showDialog()}catch(e){throw console.error("showNativeLoading error",e),e}})}cancelNativeLoading(){return a(this,null,function*(){try{return yield y.cancelDialog()}catch(e){throw console.error("cancelNativeLoading error",e),e}})}getMiniAppKong(e){return a(this,null,function*(){try{return yield y.getMiniAppKong(e)}catch(r){throw console.error("getMiniAppKong error",r),r}})}getDeeplinkParams(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Qe(i)}),o(()=>{Qe()})}catch(n){throw console.error("sendDeepLinkListenerHandle error",n),n}})(e)}catch(r){throw console.error("getDeeplinkParams error",r),r}}switchLanguage(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Xe(i)}),o(()=>{Xe()})}catch(n){throw console.error("sendSwitchLanguageHandle error",n),n}})(e)}catch(r){throw console.error("switchLanguage error",r),r}}setupMiniApp(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Ze(i)}),o(()=>{Ze()})}catch(n){throw console.error("setupMiniAppHandle error",n),n}})(e)}catch(r){throw console.error("setupMiniApp error",r),r}}switchStore(e){try{(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{Ye(i)}),o(()=>{Ye()})}catch(n){throw console.error("sendSwitchStoreHandle error",n),n}})(e)}catch(r){throw console.error("switchStore error",r),r}}closeMiniApp(){return a(this,null,function*(){try{return yield y.closeMiniApp()}catch(e){throw console.error("closeMiniApp error",e),e}})}getStatus(){return a(this,null,function*(){try{return yield y.getStatus()}catch(e){throw console.error("communicatePlugins getStatus error",e),e}})}dispatchToShell(e){return a(this,null,function*(){try{return yield y.dispatchToShell(e)}catch(r){throw console.error("communicate dispatchToShell error",r),r}})}getMiniAppInfo(e){return a(this,null,function*(){try{return yield y.getMiniAppInfo(e)}catch(r){throw console.error("getMiniAppInfo error",r),r}})}}let ie=null;window.__MICRO_APP_ENVIRONMENT__&&(ie=(gr=window.rawWindow.__mini_app_status_hook__)!=null?gr:{});const Re=l.registerPlugin("CameraScanPlugin",{web:new class extends P{pickCameraScan(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}setCameraScanState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ie==null?void 0:ie.cameraScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScan getStatus error",t),t}}}});window.removeAddListenerCameraScan=()=>null;class Kr{pickCameraScan(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScan(e):yield Re.pickCameraScan(e)}catch(r){throw console.error("pickCameraScan error",r),r}})}setCameraScanState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanState(e):yield Re.setCameraScanState(e)}catch(r){throw console.error("setCameraScanState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Re.getStatus()}catch(e){throw console.error("cameraScanPlugin getStatus error",e),e}})}}let se=null;window.__MICRO_APP_ENVIRONMENT__&&(se=(Pr=window.rawWindow.__mini_app_status_hook__)!=null?Pr:{});const ke=l.registerPlugin("CameraScanMultiplePlugin",{web:new class extends P{pickCameraScanMultiple(){return a(this,null,function*(){})}setCameraScanMultipleState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=se==null?void 0:se.cameraScanMultiple)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultiple getStatus error",t),t}}}});class Jr{pickCameraScanMultiple(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultiple(e):yield ke.pickCameraScanMultiple(e)}catch(r){throw console.error("pickCameraScanMultiple error",r),r}})}setCameraScanMultipleState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleState(e):yield ke.setCameraScanMultipleState(e)}catch(r){throw console.error("setCameraScanMultipleState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield ke.getStatus()}catch(e){throw console.error("cameraScanMultiplePlugin getStatus error",e),e}})}}let ce=null;window.__MICRO_APP_ENVIRONMENT__&&(ce=(yr=window.rawWindow.__mini_app_status_hook__)!=null?yr:{});const be=l.registerPlugin("CameraScanMultipleNoCountPlugin",{web:new class extends P{pickCameraScanMultipleNoCount(){return a(this,null,function*(){})}setCameraScanMultipleNoCountState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ce==null?void 0:ce.cameraScanMultipleNoCount)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanMultipleNoCount getStatus error",t),t}}}});class Gr{pickCameraScanMultipleNoCount(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanMultipleNoCount(e):yield be.pickCameraScanMultipleNoCount(e)}catch(r){throw console.error("pickCameraScanMultipleNoCount error",r),r}})}setCameraScanMultipleNoCountState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraScanMultipleNoCountState(e):yield be.setCameraScanMultipleNoCountState(e)}catch(r){throw console.error("setCameraScanMultipleNoCountState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield be.getStatus()}catch(e){throw console.error("cameraScanMultipleNoCountPlugin getStatus error",e),e}})}}let le=null;window.__MICRO_APP_ENVIRONMENT__&&(le=(Sr=window.rawWindow.__mini_app_status_hook__)!=null?Sr:{});const Te=l.registerPlugin("CameraScanSingleOrDualPlugin",{web:new class extends P{pickCameraScanSingleOrDual(){return a(this,null,function*(){})}setCameraScanSingleOrDualState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=le==null?void 0:le.cameraScanSingleOrDual)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraScanSingleOrDual getStatus error",t),t}}}});class Qr{pickCameraScanSingleOrDual(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraScanSingleOrDual(e):yield Te.pickCameraScanSingleOrDual(e)}catch(r){throw console.error("pickCameraScanSingleOrDual error",r),r}})}setCameraScanSingleOrDualState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCameraScanSingleOrDualState(e):yield Te.setCameraScanSingleOrDualState(e)}catch(r){throw console.error("setCameraScanSingleOrDualState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Te.getStatus()}catch(e){throw console.error("cameraScanSingleOrDualPlugin getStatus error",e),e}})}}const er="LaserScanPlugin";let de=null;window.__MICRO_APP_ENVIRONMENT__&&(de=(Nr=window.rawWindow.__mini_app_status_hook__)!=null?Nr:{});const we=l.registerPlugin(er,{web:new class extends P{pickLaserScan(){return a(this,null,function*(){})}unPickLaserScan(){return a(this,null,function*(){})}setLaserState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=de==null?void 0:de.laserScan)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("laserScan getStatus error",t),t}}}}),ue=C();ue.removeAddListenerLaserScan=()=>null;const rr=(t=()=>null)=>{try{ue.removeAddListenerLaserScan&&ue.removeAddListenerLaserScan();const e=r=>a(this,null,function*(){r&&(ue.removeAddListenerLaserScan=yield(n=>a(this,null,function*(){try{if(l.addListener){const o=yield l.addListener(er,"nativeSendLaser",i=>n&&n(i));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("addListenerLaserHandle error",o),o}}))(r))});setTimeout(()=>{e(t)})}catch(e){throw console.error("laserScanFn error",e),e}};class Xr{constructor(){this.pickLaserScan()}pickLaserScan(){return a(this,null,function*(){try{return yield we.pickLaserScan({isContinue:!1})}catch(e){throw console.error("pickLaserScan error",e),e}})}unPickLaserScan(){return a(this,null,function*(){try{return yield we.unPickLaserScan()}catch(e){throw console.error("unPickLaserScan error",e),e}})}setLaserState(e){try{we.setLaserState(e)}catch(r){throw console.error("setLaserState error",r),r}}setLaserScan(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{rr(i)}),o(()=>{rr()})}catch(n){throw console.error("laserScanApiParams error",n),n}})(e)}getStatus(){return a(this,null,function*(){try{return yield we.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}const tr="CountAssistPlugin";let _e=null;window.__MICRO_APP_ENVIRONMENT__&&(_e=(fr=window.rawWindow.__mini_app_status_hook__)!=null?fr:{});const pe=l.registerPlugin(tr,{web:new class extends P{setCountAssistState(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("setCountAssistState error",e),e}})}toggleCountAssist(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("hideCountAssist error",e),e}})}getCountAssistToggleState(){return a(this,null,function*(){try{return new Promise(t=>{t(void 0)})}catch(t){throw console.error("getCountAssistToggleState error",t),t}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=_e==null?void 0:_e.countAssist)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("countAssist getStatus error",t),t}}}}),j=C();j.addListenerCountAssistRemoveHandle=()=>null;const nr=(t=()=>null)=>a(this,null,function*(){try{j!=null&&j.addListenerCountAssistRemoveHandle&&typeof j.addListenerCountAssistRemoveHandle=="function"&&j.addListenerCountAssistRemoveHandle(),j.addListenerCountAssistRemoveHandle=yield(e=>a(this,null,function*(){try{if(l.addListener){const r=yield l.addListener(tr,"nativeSendCountAssist",n=>e&&e(n));return r!=null&&r.remove?r.remove:()=>null}}catch(r){throw console.error("addListenerCountAssistHandle error",r),r}}))(t)}catch(e){throw console.error("initCountAssistFn error",e),e}});class Zr{setCountAssistState(e){return a(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.setCountAssistState(e):yield pe.setCountAssistState(e)})}getCountAssistState(e){return(r=>{try{let n=r!=null?r:!1;return ne(o=>{n=!!(o!=null&&o.countAssistState)}),n}catch(n){throw console.error("getCountAssistStateHandle error",n),n}})(e)}setCountAssistBtn(e){(r=>{try{const{mounted:n,beforeUnmount:o,callBack:i}=r;n(()=>{nr(i)}),o(()=>{nr()})}catch(n){throw console.error("setCountAssistBtnHandle error",n),n}})(e)}toggleCountAssist(e){return a(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.toggleCountAssist(e):yield pe.toggleCountAssist(e)})}getCountAssistToggleState(){return a(this,null,function*(){return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.getCountAssistToggleState():yield pe.getCountAssistToggleState()})}getStatus(){return a(this,null,function*(){try{return yield pe.getStatus()}catch(e){throw console.error("countAssistPlugin getStatus error",e),e}})}}let he=null;window.__MICRO_APP_ENVIRONMENT__&&(he=(Mr=window.rawWindow.__mini_app_status_hook__)!=null?Mr:{});const Be=l.registerPlugin("ClickStreamPlugin",{web:new class extends P{init(){return a(this,null,function*(){return new Promise(t=>{t(null)})})}trace(t){return a(this,null,function*(){var e,r;try{return window.__MICRO_APP_ENVIRONMENT__&&((r=(e=window.rawWindow.__mini_app_hook__).clickStream)==null||r.call(e,t.data)),new Promise(n=>{n(t)})}catch(n){throw console.error("clickStreamTraceParams error",n),n}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=he==null?void 0:he.clickStream)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("clickStream getStatus error",t),t}}}});class Yr{constructor(){this.init()}init(){return a(this,null,function*(){try{return yield Be.init()}catch(e){throw console.error("clickStreamPlugin, init error",e),e}})}trace(e){return a(this,null,function*(){try{return yield Be.trace(e)}catch(r){throw console.error("clickStreamPlugin, trace error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Be.getStatus()}catch(e){throw console.error("clickStreamPlugin getStatus error",e),e}})}}const or="MiniAppLifecyclePlugin";let me=null;window.__MICRO_APP_ENVIRONMENT__&&(me=(Ir=window.rawWindow.__mini_app_status_hook__)!=null?Ir:{});var G=(t=>(t.MINI_APP_BEFORE_UNMOUNT_PERMISSION="mini_app_before_unmount_permission",t.MINI_APP_BEFORE_UNMOUNT_COMPLETION="mini_app_before_unmount_completion",t))(G||{});const Ve=l.registerPlugin(or,{web:new class extends P{setNativeUsagePermission(){return a(this,null,function*(){})}authorizeWebCallback(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=me==null?void 0:me.lifecycle)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("lifecycle getStatus error",t),t}}}}),ge=C();ge.removeAddListenerLifecycleMiniAppBeforeUnmount=()=>null;const ar=(t=()=>null)=>{try{ge.removeAddListenerLifecycleMiniAppBeforeUnmount&&ge.removeAddListenerLifecycleMiniAppBeforeUnmount();const e=r=>a(this,null,function*(){r&&(ge.removeAddListenerLifecycleMiniAppBeforeUnmount=yield(n=>a(this,null,function*(){try{if(l.addListener){const o=yield l.addListener(or,"miniAppBeforeUnmount",i=>n&&n(i));return o!=null&&o.remove?o.remove:()=>null}}catch(o){throw console.error("miniAppBeforeUnmountHandle error",o),o}}))(r))});setTimeout(()=>a(this,null,function*(){yield e(t)}))}catch(e){throw console.error("laserScanFn error",e),e}};class et{constructor(){}setNativeUsagePermission(e){return a(this,null,function*(){try{return yield Ve.setNativeUsagePermission(e)}catch(r){throw console.error("lifecyclePlugin.setNativeUsagePermission error",r),r}})}authorizeWebCallback(e){return a(this,null,function*(){try{return yield Ve.authorizeWebCallback(e)}catch(r){throw console.error("lifecyclePlugin.authorizeWebCallback error",r),r}})}miniAppBeforeUnmount(e){this.setNativeUsagePermission({action:G.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!0}),((r,n)=>{try{const{mounted:o,beforeUnmount:i,callBack:s}=r;o(()=>{ar(c=>a(this,null,function*(){var u;if(s&&s instanceof Function)try{(u=s(c))==null||u.then(()=>a(this,null,function*(){yield n.setNativeUsagePermission({action:G.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1}),yield n.authorizeWebCallback({action:G.MINI_APP_BEFORE_UNMOUNT_COMPLETION})}))}catch(w){console.error("miniAppBeforeUnmount error callBack is not a function or promise")}else console.error("miniAppBeforeUnmount error callBack is not a function or promise")}))}),i(()=>a(this,null,function*(){ar(),n.setNativeUsagePermission({action:G.MINI_APP_BEFORE_UNMOUNT_PERMISSION,value:!1})}))}catch(o){throw console.error("miniAppBeforeUnmount error",o),o}})(e,this)}getStatus(){return a(this,null,function*(){try{return yield Ve.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Pe=null;window.__MICRO_APP_ENVIRONMENT__&&(Pe=(Cr=window.rawWindow.__mini_app_status_hook__)!=null?Cr:{});const He=l.registerPlugin("DeviceInteractionPlugin",{web:new class extends P{callVibrate(){return a(this,null,function*(){})}callErrorBeep(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Pe==null?void 0:Pe.deviceInteraction)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("deviceInteraction getStatus error",t),t}}}});class rt{callVibrate(){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callVibrate():yield He.callVibrate()}catch(e){throw console.error("callVibrate error",e),e}})}callErrorBeep(){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?yield window.rawWindow.__mini_app_hook__.callErrorBeep():yield He.callErrorBeep()}catch(e){throw console.error("callErrorBeep error",e),e}})}getStatus(){return a(this,null,function*(){try{return yield He.getStatus()}catch(e){throw console.error("deviceInteractionPlugin getStatus error",e),e}})}}const ir="PollingPlugin";let ye=null;window.__MICRO_APP_ENVIRONMENT__&&(ye=(vr=window.rawWindow.__mini_app_status_hook__)!=null?vr:{});const Fe=l.registerPlugin(ir,{web:new class extends P{create(){return a(this,null,function*(){})}destroy(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ye==null?void 0:ye.polling)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("polling getStatus error",t),t}}}}),Se=C();Se.removeAddListenerPolling=()=>null;const tt=(t,e)=>{try{Se.removeAddListenerPolling&&Se.removeAddListenerPolling();const r=e.pollingId;(n=>a(this,null,function*(){return n&&(Se.removeAddListenerPolling=yield(o=>a(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(ir,"nativeSendPolling",s=>o&&o(s));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPollingHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.pollingId)===r&&(n!=null&&n.pollingId)&&t.pollingList.forEach(o=>{o!=null&&o.pollingId&&(n==null?void 0:n.pollingId)===(o==null?void 0:o.pollingId)&&typeof(o==null?void 0:o.callBack)=="function"&&o.callBack(n)})})}catch(r){throw console.error("pollingFn error",r),r}};class nt{constructor(){f(this,"pollingList");this.pollingList=[]}create(e){var r,n,o;if(window.__MICRO_APP_ENVIRONMENT__){const{mounted:i,pollingParams:s,callBack:c}=e;return i(()=>{var u,w;(w=(u=window.rawWindow.__mini_app_hook__)==null?void 0:u.addPolling)==null||w.call(u,s,c)}),()=>{this.destroy({pollingId:s.pollingId})}}try{(r=e==null?void 0:e.pollingParams)!=null&&r.pollingId&&this.pollingList.push({pollingId:(n=e==null?void 0:e.pollingParams)==null?void 0:n.pollingId,callBack:e==null?void 0:e.callBack}),this.pollingList=this.pollingList.filter((s,c,u)=>c===u.findIndex(w=>w.pollingId===s.pollingId));const i=((o=e==null?void 0:e.pollingParams)==null?void 0:o.delay)/1e3;return Fe.create(z(q({},e==null?void 0:e.pollingParams),{delay:i})),((s,c)=>{try{const{mounted:u,pollingParams:w}=s;u(()=>tt(c,w))}catch(u){throw console.error("createPolling error",u),u}})(e,this),()=>{var s,c;return(s=e==null?void 0:e.pollingParams)!=null&&s.pollingId?this.destroy({pollingId:(c=e==null?void 0:e.pollingParams)==null?void 0:c.pollingId}):null}}catch(i){throw console.error("pollingPlugin create error",i),i}}destroy(e){var r,n,o;if(window.__MICRO_APP_ENVIRONMENT__){const{pollingId:i}=e;(n=(r=window.rawWindow.__mini_app_hook__)==null?void 0:r.deletePolling)==null||n.call(r,i)}else try{const i=this.pollingList.map(s=>s.pollingId).indexOf(e.pollingId);return(o=this.pollingList)!=null&&o.length&&(Number(i)||Number(i)>=0)&&this.pollingList.splice(Number(i),1),Fe.destroy(e)}catch(i){throw console.error("pollingPlugin destroy error",i),i}}getStatus(){return a(this,null,function*(){try{return yield Fe.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Ne=null;window.__MICRO_APP_ENVIRONMENT__&&(Ne=(Or=window.rawWindow.__mini_app_status_hook__)!=null?Or:{});const sr=l.registerPlugin("PaymentPlugin",{web:new class extends P{process(t){return a(this,null,function*(){try{return new Promise(e=>{e(t)})}catch(e){throw console.error("process error",e),e}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Ne==null?void 0:Ne.payment)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("payment getStatus error",t),t}}}});class ot{process(e){return a(this,null,function*(){try{return yield sr.process(e)}catch(r){throw console.error("paymentPlugins.process error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield sr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let fe=null;window.__MICRO_APP_ENVIRONMENT__&&(fe=(Ar=window.rawWindow.__mini_app_status_hook__)!=null?Ar:{});const Ue=l.registerPlugin("CameraForTakePhotoPlugin",{web:new class extends P{pickCameraForTakePhoto(){return a(this,null,function*(){})}setCameraForTakePhotoState(){return a(this,null,function*(){})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=fe==null?void 0:fe.cameraForTakePhoto)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("cameraForTakePhoto getStatus error",t),t}}}});class at{pickCameraForTakePhoto(){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.pickCameraForTakePhoto():yield Ue.pickCameraForTakePhoto()}catch(e){throw console.error("pickCameraForTakePhoto error",e),e}})}setCameraForTakePhotoState(e){return a(this,null,function*(){try{return window.__MICRO_APP_ENVIRONMENT__?window.rawWindow.__mini_app_hook__.setCameraForTakePhotoState(e):yield Ue.setCameraForTakePhotoState(e)}catch(r){throw console.error("setCameraForTakePhotoState error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield Ue.getStatus()}catch(e){throw console.error("cameraForTakePhotoPlugin getStatus error",e),e}})}}let Me=null;window.__MICRO_APP_ENVIRONMENT__&&(Me=(Lr=window.rawWindow.__mini_app_status_hook__)!=null?Lr:{});const cr=l.registerPlugin("HttpPlugin",{web:new class extends P{request(t){return a(this,null,function*(){return new Promise(e=>{e(t)})})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Me==null?void 0:Me.http)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("http getStatus error",t),t}}}});class it{request(e){return a(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__)return window.rawWindow.__mini_app_hook__.requestHttp(e);{let r={};return e.url&&(r.url=e.url),e.method&&(r.method=e.method),e.headers&&(r.headers=e.headers),e.params&&(r.urlParams=e.params),e.data&&(typeof e.data=="string"?r.bodyData=e.data:r.bodyParams=e.data),e.upload&&(r.upload=e.upload),yield cr.request(r)}}catch(r){throw console.error("HttpPlugin, trace error",r),r}})}getStatus(){return a(this,null,function*(){try{return yield cr.getStatus()}catch(e){throw console.error("HttpPlugin getStatus error",e),e}})}}const M=[];for(let t=0;t<256;++t)M.push((t+256).toString(16).slice(1));const st=new Uint8Array(16);function ct(t,e,r){return e||t||!crypto.randomUUID?function(n,o,i){var c,u,w;n=n||{};const s=(w=(u=n.random)!=null?u:(c=n.rng)==null?void 0:c.call(n))!=null?w:crypto.getRandomValues(st);if(s.length<16)throw new Error("Random bytes length must be >= 16");if(s[6]=15&s[6]|64,s[8]=63&s[8]|128,o){if((i=i||0)<0||i+16>o.length)throw new RangeError(`UUID byte range ${i}:${i+15} is out of buffer bounds`);for(let _=0;_<16;++_)o[i+_]=s[_];return o}return function(_,h=0){return(M[_[h+0]]+M[_[h+1]]+M[_[h+2]]+M[_[h+3]]+"-"+M[_[h+4]]+M[_[h+5]]+"-"+M[_[h+6]]+M[_[h+7]]+"-"+M[_[h+8]]+M[_[h+9]]+"-"+M[_[h+10]]+M[_[h+11]]+M[_[h+12]]+M[_[h+13]]+M[_[h+14]]+M[_[h+15]]).toLowerCase()}(s)}(t,e,r):crypto.randomUUID()}const lr="PrintPlugin";let Ie=null;window.__MICRO_APP_ENVIRONMENT__&&(Ie=(Er=window.rawWindow.__mini_app_status_hook__)!=null?Er:{});const dr=l.registerPlugin(lr,{web:new class extends P{print(){}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Ie==null?void 0:Ie.print)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("print getStatus error",t),t}}}}),Q=C();Q.removeAddListenerPrintList={};const lt=(t,e)=>{try{const r=e.printId;Q.removeAddListenerPrintList=z(q({},Q.removeAddListenerPrintList),{printId:()=>{}}),(n=>a(this,null,function*(){return n&&(Q.removeAddListenerPrintList[r]=yield(o=>a(this,null,function*(){try{if(l.addListener){const i=yield l.addListener(lr,"nativeSendPrint",s=>o&&o(s));return i!=null&&i.remove?i.remove:()=>null}}catch(i){throw console.error("addListenerPrintHandle error",i),i}}))(n))}))(n=>{(n==null?void 0:n.printId)===r&&(n!=null&&n.printId)&&t.printList.forEach(o=>{var i,s,c;o!=null&&o.printId&&(n==null?void 0:n.printId)===(o==null?void 0:o.printId)&&(typeof(o==null?void 0:o.callBack)=="function"&&o.callBack(n),(c=o.state==5||o.state==6)!=null||(s=(i=Q.removeAddListenerPrintList)==null?void 0:i[o==null?void 0:o.printId])==null||s.call(i))})})}catch(r){throw console.error("printFn error",r),r}};class dt{constructor(){f(this,"printList");this.printList=[]}print(e){var n,o,i,s;const r=((o=(n=e==null?void 0:e.printParams)==null?void 0:n.functionId)!=null?o:"")+ct().replace(/-/g,"");if(this.printList.push({printId:r,callBack:e==null?void 0:e.callBack}),this.printList=this.printList.filter((c,u,w)=>u===w.findIndex(_=>_.printId===c.printId)),window.__MICRO_APP_ENVIRONMENT__){const{printParams:c,callBack:u}=e;return(s=(i=window.rawWindow.__mini_app_hook__)==null?void 0:i.print)==null||s.call(i,z(q({},c),{printId:r}),u),{id:r}}try{return dr.print(z(q({},e==null?void 0:e.printParams),{printId:r})),((c,u)=>{try{const{printParams:w}=c;lt(u,w)}catch(w){throw console.error("createPrint error",w),w}})(z(q({},e),{printParams:z(q({},e.printParams),{printId:r})}),this),{id:r}}catch(c){throw console.error("printPlugin create error",c),c}}getStatus(){return a(this,null,function*(){try{return yield dr.getStatus()}catch(e){throw console.error("getStatus error",e),e}})}}let Ce=null;window.__MICRO_APP_ENVIRONMENT__&&(Ce=(Rr=window.rawWindow.__mini_app_status_hook__)!=null?Rr:{});const X=(t,e,r="",n="")=>({success:t,message:e,type:r,fileName:n}),We=t=>{var e;return(e=t==null?void 0:t.trim().replace(/^\.+/,"").toLowerCase())!=null?e:""},wr=(t,e)=>{const r=We(e);return!r||t.toLowerCase().endsWith(`.${r}`)?t:`${t}.${r}`},ur=t=>{var o;const e=(i=>{var _;const s=(_=i==null?void 0:i.trim())!=null?_:"",c=s.lastIndexOf(".");if(c<=0||c===s.length-1)return{name:s,type:"",fileName:s};const u=s.slice(0,c),w=We(s.slice(c+1));return{name:u,type:w,fileName:w?wr(u,w):s}})((i=>{if(!i)return"";try{const s=new URL(i,window.location.href).pathname.split("/").filter(Boolean).pop();return s?decodeURIComponent(s):""}catch(s){return""}})(t==null?void 0:t.url)),r=e.type||We(t==null?void 0:t.type),n=((o=t==null?void 0:t.fileName)==null?void 0:o.trim())||e.name||`path_${Date.now()}`;return{type:r,fileName:n,downloadFileName:r?wr(n,r):n}},_r=l.registerPlugin("DownloadFilePlugin",{web:new class extends P{downloadFile(t){return a(this,null,function*(){var e;try{const{type:r,fileName:n,downloadFileName:o}=ur(t),i=(e=t==null?void 0:t.url)==null?void 0:e.trim();if(!r)return X(!1,"Missing required parameter: type",r,n);if(!i)return X(!1,"Missing required parameter: url",r,n);const s=yield fetch(i,t==null?void 0:t.fetchOptions);if(!s.ok)return X(!1,`HTTP error! status: ${s.status}`,r,n);const c=yield s.blob(),u=window.URL.createObjectURL(c),w=document.createElement("a");return w.href=u,w.download=o,document.body.appendChild(w),w.click(),w.remove(),window.setTimeout(()=>window.URL.revokeObjectURL(u),0),X(!0,"download success",r,n)}catch(r){console.error("downloadFile error",r);const{type:n,fileName:o}=ur(t);return X(!1,r instanceof Error?r.message:"download failed",n,o)}})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=Ce==null?void 0:Ce.downloadFile)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("downloadFile getStatus error",t),t}}}}),pr=t=>{var e;return(e=t==null?void 0:t.trim().replace(/^\.+/,"").toLowerCase())!=null?e:""},hr=(t,e)=>{var n;const r=(o=>{var c;const i=(c=o==null?void 0:o.trim())!=null?c:"",s=i.lastIndexOf(".");return s<=0||s===i.length-1?{name:i,type:""}:{name:i.slice(0,s),type:pr(i.slice(s+1))}})((o=>{if(!o)return"";try{const i=new URL(o,window.location.href).pathname.split("/").filter(Boolean).pop();return i?decodeURIComponent(i):""}catch(i){return""}})(t==null?void 0:t.url));return{success:!1,message:e,type:r.type||pr(t==null?void 0:t.type),fileName:((n=t==null?void 0:t.fileName)==null?void 0:n.trim())||r.name||`path_${Date.now()}`}};class wt{downloadFile(e){return a(this,null,function*(){try{if(window.__MICRO_APP_ENVIRONMENT__){const r=window.rawWindow.__mini_app_hook__.downloadFile;return r?yield r(e):hr(e,"DownloadFilePlugin is not available")}return yield _r.downloadFile(e)}catch(r){return console.error("downloadFile error",r),hr(e,r instanceof Error?r.message:"download failed")}})}getStatus(){return a(this,null,function*(){try{return yield _r.getStatus()}catch(e){throw console.error("downloadFile getStatus error",e),e}})}}class mr{constructor(){f(this,"initialContextPlugins",new jr);f(this,"communicatePlugins",new zr);f(this,"cameraScanPlugins",new Kr);f(this,"cameraScanMultiplePlugins",new Jr);f(this,"cameraScanMultipleNoCountPlugins",new Gr);f(this,"cameraScanSingleOrDualPlugins",new Qr);f(this,"laserScanPlugins",new Xr);f(this,"countAssistPlugins",new Zr);f(this,"clickStreamPlugins",new Yr);f(this,"lifecyclePlugins",new et);f(this,"deviceInteractionPlugins",new rt);f(this,"pollingPlugins",new nt);f(this,"paymentPlugins",new ot);f(this,"cameraForTakePhotoPlugin",new at);f(this,"httpPlugin",new it);f(this,"printPlugins",new dt);f(this,"downloadFilePlugin",new wt)}}const ut=new mr;let d=null,ve=null;window.__MICRO_APP_ENVIRONMENT__&&(d=(kr=window.rawWindow.__mini_app_hook__)!=null?kr:{},ve=(br=window.rawWindow.__mini_app_status_hook__)!=null?br:{});const _t=Object.freeze(Object.defineProperty({__proto__:null,PluginsWeb:class extends P{homeIsClick(t){return a(this,null,function*(){var e;window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch homeIsClick",t),(e=d.disabledMenu)==null||e.call(d,t))})}openMiniApp(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.openMiniApp)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("openMiniApp error",r),r}})}showTitle(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&(console.log("window.microApp.forceDispatch showTitle",t),(e=d.showTitle)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showTitle error",r),r}})}showFABMenu(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.showFABMenu)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showFABMenu error",r),r}})}disableFAB(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.disableFAB)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableFAB error",r),r}})}disableBack(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.disableBack)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("disableBack error",r),r}})}showSubMask(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.showSubMask)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("showSubMask error",r),r}})}setMiniAppVersion(t){return a(this,null,function*(){var e;try{return window.__MICRO_APP_ENVIRONMENT__&&((e=d.setMiniAppVersion)==null||e.call(d,t)),new Promise(r=>{r(t)})}catch(r){throw console.error("setMiniAppVersion error",r),r}})}showDialog(){return a(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.showDialog)==null||t.call(d))})}cancelDialog(){return a(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.cancelDialog)==null||t.call(d))})}getMiniAppKong(t){return a(this,null,function*(){var e,r;try{if(window.__MICRO_APP_ENVIRONMENT__){const n=(r=(e=d.getMiniAppKong)==null?void 0:e.call(d,t))!=null?r:{};return new Promise(o=>{o(n)})}return new Promise(n=>{n(t)})}catch(n){throw console.error("getMiniAppKong error",n),n}})}closeMiniApp(){return a(this,null,function*(){var t;window.__MICRO_APP_ENVIRONMENT__&&((t=d.closeMiniApp)==null||t.call(d))})}getStatus(){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(t=>a(this,null,function*(){var e,r;t((yield(r=(e=ve==null?void 0:ve.communicate)==null?void 0:e.getStatus)==null?void 0:r.call(e))||{})})):new Promise(t=>{t(null)})}catch(t){throw console.error("communicate getStatus error",t),t}}dispatchToShell(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>a(this,null,function*(){var r;e((yield(r=d==null?void 0:d.dispatchToShell)==null?void 0:r.call(d,t))||{})})):new Promise(e=>{e(t)})}catch(e){throw console.error("communicate dispatchToShell error",e),e}}getMiniAppInfo(t){try{return window.__MICRO_APP_ENVIRONMENT__?new Promise(e=>a(this,null,function*(){var r;e((yield(r=d==null?void 0:d.getMiniAppInfo)==null?void 0:r.call(d,t))||{})})):new Promise(e=>{e({})})}catch(e){throw console.error("communicate getMiniAppInfo error",e),e}}}},Symbol.toStringTag,{value:"Module"}));N.NativeApi=mr,N.default=ut,Object.defineProperties(N,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})});
|
package/package.json
CHANGED