firebase 9.17.2 → 9.18.0
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/CHANGELOG.md +20 -0
- package/app/dist/esm/index.esm.js +1 -1
- package/app/dist/index.cjs.js +1 -1
- package/app/dist/index.mjs +1 -1
- package/compat/app/dist/esm/index.esm.js +1 -1
- package/compat/app/dist/index.cjs.js +1 -1
- package/compat/app/dist/index.mjs +1 -1
- package/compat/dist/esm/index.esm.js +2 -2
- package/compat/dist/index.node.cjs +2 -2
- package/compat/dist/index.rn.cjs.js +2 -2
- package/firebase-analytics.js +1 -1
- package/firebase-app-check.js +1 -1
- package/firebase-app-compat.js +2 -2
- package/firebase-app.js +5 -5
- package/firebase-auth-compat.js +1 -1
- package/firebase-auth-compat.js.map +1 -1
- package/firebase-auth-cordova.js +1 -1
- package/firebase-auth-cordova.js.map +1 -1
- package/firebase-auth-react-native.js +1 -1
- package/firebase-auth-react-native.js.map +1 -1
- package/firebase-auth.js +1 -1
- package/firebase-auth.js.map +1 -1
- package/firebase-compat.js +4 -4
- package/firebase-compat.js.map +1 -1
- package/firebase-database.js +1 -1
- package/firebase-firestore-compat.js +1 -1
- package/firebase-firestore-compat.js.map +1 -1
- package/firebase-firestore-lite.js +1 -1
- package/firebase-firestore-lite.js.map +1 -1
- package/firebase-firestore.js +1 -1
- package/firebase-firestore.js.map +1 -1
- package/firebase-functions.js +1 -1
- package/firebase-installations.js +1 -1
- package/firebase-messaging-sw.js +1 -1
- package/firebase-messaging.js +1 -1
- package/firebase-performance-standalone-compat.es2017.js +5 -5
- package/firebase-performance-standalone-compat.js +1 -1
- package/firebase-performance.js +1 -1
- package/firebase-remote-config.js +1 -1
- package/firebase-storage.js +1 -1
- package/package.json +7 -7
package/firebase-functions.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{_registerComponent as t,registerVersion as e,_getProvider as n,getApp as r}from"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";const o={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const o=t[e],i=e+1<t.length,s=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=o>>2,h=(3&o)<<4|s>>4;let l=(15&s)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let o=t.charCodeAt(r);o<128?e[n++]=o:o<2048?(e[n++]=o>>6|192,e[n++]=63&o|128):55296==(64512&o)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++r)),e[n++]=o>>18|240,e[n++]=o>>12&63|128,e[n++]=o>>6&63|128,e[n++]=63&o|128):(e[n++]=o>>12|224,e[n++]=o>>6&63|128,e[n++]=63&o|128)}return e}(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n++];if(o<128)e[r++]=String.fromCharCode(o);else if(o>191&&o<224){const i=t[n++];e[r++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],s=t[n++];e[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const o=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==o||null==s||null==a||null==c)throw new i;const u=o<<2|s>>4;if(r.push(u),64!==a){const t=s<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const s=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,a=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return o.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},c=()=>{try{return s()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||a()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},u=t=>{const e=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]};class h extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,l.prototype.create)}}class l{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,o=this.errors[t],i=o?function(t,e){return t.replace(d,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(o,n):"Error",s=`${this.serviceName}: ${i} (${r}).`;return new h(r,s,n)}}const d=/\{\$([^}]+)}/g;function f(t){return t&&t._delegate?t._delegate:t}class p{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}function g(t,e){const n={};for(const r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function E(t){if(null==t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map((t=>E(t)));if("function"==typeof t||"object"==typeof t)return g(t,(t=>E(t)));throw new Error("Data cannot be encoded in JSON: "+t)}function m(t){if(null==t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":{const e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map((t=>m(t))):"function"==typeof t||"object"==typeof t?g(t,(t=>m(t))):t}const _={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class y extends h{constructor(t,e,n){super(`functions/${t}`,e||""),this.details=n}}class A{constructor(t,e,n){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=t.getImmediate({optional:!0}),this.messaging=e.getImmediate({optional:!0}),this.auth||t.get().then((t=>this.auth=t),(()=>{})),this.messaging||e.get().then((t=>this.messaging=t),(()=>{})),this.appCheck||n.get().then((t=>this.appCheck=t),(()=>{}))}async getAuthToken(){if(this.auth)try{const t=await this.auth.getToken();return null==t?void 0:t.accessToken}catch(t){return}}async getMessagingToken(){if(this.messaging&&"Notification"in self&&"granted"===Notification.permission)try{return await this.messaging.getToken()}catch(t){return}}async getAppCheckToken(){if(this.appCheck){const t=await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(){return{authToken:await this.getAuthToken(),messagingToken:await this.getMessagingToken(),appCheckToken:await this.getAppCheckToken()}}}class S{constructor(t,e,n,r,o="us-central1",i){this.app=t,this.fetchImpl=i,this.emulatorOrigin=null,this.contextProvider=new A(e,n,r),this.cancelAllRequests=new Promise((t=>{this.deleteService=()=>Promise.resolve(t())}));try{const t=new URL(o);this.customDomain=t.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=o}}_delete(){return this.deleteService()}_url(t){const e=this.app.options.projectId;if(null!==this.emulatorOrigin){return`${this.emulatorOrigin}/${e}/${this.region}/${t}`}return null!==this.customDomain?`${this.customDomain}/${t}`:`https://${this.region}-${e}.cloudfunctions.net/${t}`}}function T(t,e,n){return r=>function(t,e,n,r){const o=t._url(e);return C(t,o,n,r)}(t,e,r,n||{})}async function b(t,e,n,r){let o;n["Content-Type"]="application/json";try{o=await r(t,{method:"POST",body:JSON.stringify(e),headers:n})}catch(t){return{status:0,json:null}}let i=null;try{i=await o.json()}catch(t){}return{status:o.status,json:i}}async function C(t,e,n,r){const o={data:n=E(n)},i={},s=await t.contextProvider.getContext();s.authToken&&(i.Authorization="Bearer "+s.authToken),s.messagingToken&&(i["Firebase-Instance-ID-Token"]=s.messagingToken),null!==s.appCheckToken&&(i["X-Firebase-AppCheck"]=s.appCheckToken);const a=function(t){let e=null;return{promise:new Promise(((n,r)=>{e=setTimeout((()=>{r(new y("deadline-exceeded","deadline-exceeded"))}),t)})),cancel:()=>{e&&clearTimeout(e)}}}(r.timeout||7e4),c=await Promise.race([b(e,o,i,t.fetchImpl),a.promise,t.cancelAllRequests]);if(a.cancel(),!c)throw new y("cancelled","Firebase Functions instance was deleted.");const u=function(t,e){let n,r=function(t){if(t>=200&&t<300)return"ok";switch(t){case 0:case 500:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),o=r;try{const t=e&&e.error;if(t){const e=t.status;if("string"==typeof e){if(!_[e])return new y("internal","internal");r=_[e],o=e}const i=t.message;"string"==typeof i&&(o=i),n=t.details,void 0!==n&&(n=m(n))}}catch(t){}return"ok"===r?null:new y(r,o,n)}(c.status,c.json);if(u)throw u;if(!c.json)throw new y("internal","Response is not valid JSON object.");let h=c.json.data;if(void 0===h&&(h=c.json.result),void 0===h)throw new y("internal","Response is missing data field.");return{data:m(h)}}const D="@firebase/functions";function w(t=r(),e="us-central1"){const o=n(f(t),"functions").getImmediate({identifier:e}),i=u("functions");return i&&N(o,...i),o}function N(t,e,n){!function(t,e,n){t.emulatorOrigin=`http://${e}:${n}`}(f(t),e,n)}function I(t,e,n){return T(f(t),e,n)}function O(t,e,n){return function(t,e,n){return r=>C(t,e,r,n||{})}(f(t),e,n)}var k,v;k=fetch.bind(self),t(new p("functions",((t,{instanceIdentifier:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),o=t.getProvider("messaging-internal"),i=t.getProvider("app-check-internal");return new S(n,r,o,i,e,k)}),"PUBLIC").setMultipleInstances(!0)),e(D,"0.9.4",v),e(D,"0.9.4","esm2017");export{N as connectFunctionsEmulator,w as getFunctions,I as httpsCallable,O as httpsCallableFromURL};
|
|
1
|
+
import{_registerComponent as t,registerVersion as e,_getProvider as n,getApp as r}from"https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";const o={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();const n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let e=0;e<t.length;e+=3){const o=t[e],i=e+1<t.length,s=i?t[e+1]:0,a=e+2<t.length,c=a?t[e+2]:0,u=o>>2,h=(3&o)<<4|s>>4;let l=(15&s)<<2|c>>6,d=63&c;a||(d=64,i||(l=64)),r.push(n[u],n[h],n[l],n[d])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(function(t){const e=[];let n=0;for(let r=0;r<t.length;r++){let o=t.charCodeAt(r);o<128?e[n++]=o:o<2048?(e[n++]=o>>6|192,e[n++]=63&o|128):55296==(64512&o)&&r+1<t.length&&56320==(64512&t.charCodeAt(r+1))?(o=65536+((1023&o)<<10)+(1023&t.charCodeAt(++r)),e[n++]=o>>18|240,e[n++]=o>>12&63|128,e[n++]=o>>6&63|128,e[n++]=63&o|128):(e[n++]=o>>12|224,e[n++]=o>>6&63|128,e[n++]=63&o|128)}return e}(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):function(t){const e=[];let n=0,r=0;for(;n<t.length;){const o=t[n++];if(o<128)e[r++]=String.fromCharCode(o);else if(o>191&&o<224){const i=t[n++];e[r++]=String.fromCharCode((31&o)<<6|63&i)}else if(o>239&&o<365){const i=((7&o)<<18|(63&t[n++])<<12|(63&t[n++])<<6|63&t[n++])-65536;e[r++]=String.fromCharCode(55296+(i>>10)),e[r++]=String.fromCharCode(56320+(1023&i))}else{const i=t[n++],s=t[n++];e[r++]=String.fromCharCode((15&o)<<12|(63&i)<<6|63&s)}}return e.join("")}(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();const n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let e=0;e<t.length;){const o=n[t.charAt(e++)],s=e<t.length?n[t.charAt(e)]:0;++e;const a=e<t.length?n[t.charAt(e)]:64;++e;const c=e<t.length?n[t.charAt(e)]:64;if(++e,null==o||null==s||null==a||null==c)throw new i;const u=o<<2|s>>4;if(r.push(u),64!==a){const t=s<<4&240|a>>2;if(r.push(t),64!==c){const t=a<<6&192|c;r.push(t)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const s=()=>function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__,a=()=>{if("undefined"==typeof document)return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(t){return}const e=t&&function(t){try{return o.decodeString(t,!0)}catch(t){console.error("base64Decode failed: ",t)}return null}(t[1]);return e&&JSON.parse(e)},c=()=>{try{return s()||(()=>{if("undefined"==typeof process||void 0===process.env)return;const t=process.env.__FIREBASE_DEFAULTS__;return t?JSON.parse(t):void 0})()||a()}catch(t){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`)}},u=t=>{const e=(t=>{var e,n;return null===(n=null===(e=c())||void 0===e?void 0:e.emulatorHosts)||void 0===n?void 0:n[t]})(t);if(!e)return;const n=e.lastIndexOf(":");if(n<=0||n+1===e.length)throw new Error(`Invalid host ${e} with no separate hostname and port!`);const r=parseInt(e.substring(n+1),10);return"["===e[0]?[e.substring(1,n-1),r]:[e.substring(0,n),r]};class h extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,l.prototype.create)}}class l{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,o=this.errors[t],i=o?function(t,e){return t.replace(d,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(o,n):"Error",s=`${this.serviceName}: ${i} (${r}).`;return new h(r,s,n)}}const d=/\{\$([^}]+)}/g;function f(t){return t&&t._delegate?t._delegate:t}class p{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}function g(t,e){const n={};for(const r in t)t.hasOwnProperty(r)&&(n[r]=e(t[r]));return n}function E(t){if(null==t)return null;if(t instanceof Number&&(t=t.valueOf()),"number"==typeof t&&isFinite(t))return t;if(!0===t||!1===t)return t;if("[object String]"===Object.prototype.toString.call(t))return t;if(t instanceof Date)return t.toISOString();if(Array.isArray(t))return t.map((t=>E(t)));if("function"==typeof t||"object"==typeof t)return g(t,(t=>E(t)));throw new Error("Data cannot be encoded in JSON: "+t)}function m(t){if(null==t)return t;if(t["@type"])switch(t["@type"]){case"type.googleapis.com/google.protobuf.Int64Value":case"type.googleapis.com/google.protobuf.UInt64Value":{const e=Number(t.value);if(isNaN(e))throw new Error("Data cannot be decoded from JSON: "+t);return e}default:throw new Error("Data cannot be decoded from JSON: "+t)}return Array.isArray(t)?t.map((t=>m(t))):"function"==typeof t||"object"==typeof t?g(t,(t=>m(t))):t}const _={OK:"ok",CANCELLED:"cancelled",UNKNOWN:"unknown",INVALID_ARGUMENT:"invalid-argument",DEADLINE_EXCEEDED:"deadline-exceeded",NOT_FOUND:"not-found",ALREADY_EXISTS:"already-exists",PERMISSION_DENIED:"permission-denied",UNAUTHENTICATED:"unauthenticated",RESOURCE_EXHAUSTED:"resource-exhausted",FAILED_PRECONDITION:"failed-precondition",ABORTED:"aborted",OUT_OF_RANGE:"out-of-range",UNIMPLEMENTED:"unimplemented",INTERNAL:"internal",UNAVAILABLE:"unavailable",DATA_LOSS:"data-loss"};class y extends h{constructor(t,e,n){super(`functions/${t}`,e||""),this.details=n}}class A{constructor(t,e,n){this.auth=null,this.messaging=null,this.appCheck=null,this.auth=t.getImmediate({optional:!0}),this.messaging=e.getImmediate({optional:!0}),this.auth||t.get().then((t=>this.auth=t),(()=>{})),this.messaging||e.get().then((t=>this.messaging=t),(()=>{})),this.appCheck||n.get().then((t=>this.appCheck=t),(()=>{}))}async getAuthToken(){if(this.auth)try{const t=await this.auth.getToken();return null==t?void 0:t.accessToken}catch(t){return}}async getMessagingToken(){if(this.messaging&&"Notification"in self&&"granted"===Notification.permission)try{return await this.messaging.getToken()}catch(t){return}}async getAppCheckToken(){if(this.appCheck){const t=await this.appCheck.getToken();return t.error?null:t.token}return null}async getContext(){return{authToken:await this.getAuthToken(),messagingToken:await this.getMessagingToken(),appCheckToken:await this.getAppCheckToken()}}}class S{constructor(t,e,n,r,o="us-central1",i){this.app=t,this.fetchImpl=i,this.emulatorOrigin=null,this.contextProvider=new A(e,n,r),this.cancelAllRequests=new Promise((t=>{this.deleteService=()=>Promise.resolve(t())}));try{const t=new URL(o);this.customDomain=t.origin,this.region="us-central1"}catch(t){this.customDomain=null,this.region=o}}_delete(){return this.deleteService()}_url(t){const e=this.app.options.projectId;if(null!==this.emulatorOrigin){return`${this.emulatorOrigin}/${e}/${this.region}/${t}`}return null!==this.customDomain?`${this.customDomain}/${t}`:`https://${this.region}-${e}.cloudfunctions.net/${t}`}}function T(t,e,n){return r=>function(t,e,n,r){const o=t._url(e);return C(t,o,n,r)}(t,e,r,n||{})}async function b(t,e,n,r){let o;n["Content-Type"]="application/json";try{o=await r(t,{method:"POST",body:JSON.stringify(e),headers:n})}catch(t){return{status:0,json:null}}let i=null;try{i=await o.json()}catch(t){}return{status:o.status,json:i}}async function C(t,e,n,r){const o={data:n=E(n)},i={},s=await t.contextProvider.getContext();s.authToken&&(i.Authorization="Bearer "+s.authToken),s.messagingToken&&(i["Firebase-Instance-ID-Token"]=s.messagingToken),null!==s.appCheckToken&&(i["X-Firebase-AppCheck"]=s.appCheckToken);const a=function(t){let e=null;return{promise:new Promise(((n,r)=>{e=setTimeout((()=>{r(new y("deadline-exceeded","deadline-exceeded"))}),t)})),cancel:()=>{e&&clearTimeout(e)}}}(r.timeout||7e4),c=await Promise.race([b(e,o,i,t.fetchImpl),a.promise,t.cancelAllRequests]);if(a.cancel(),!c)throw new y("cancelled","Firebase Functions instance was deleted.");const u=function(t,e){let n,r=function(t){if(t>=200&&t<300)return"ok";switch(t){case 0:case 500:return"internal";case 400:return"invalid-argument";case 401:return"unauthenticated";case 403:return"permission-denied";case 404:return"not-found";case 409:return"aborted";case 429:return"resource-exhausted";case 499:return"cancelled";case 501:return"unimplemented";case 503:return"unavailable";case 504:return"deadline-exceeded"}return"unknown"}(t),o=r;try{const t=e&&e.error;if(t){const e=t.status;if("string"==typeof e){if(!_[e])return new y("internal","internal");r=_[e],o=e}const i=t.message;"string"==typeof i&&(o=i),n=t.details,void 0!==n&&(n=m(n))}}catch(t){}return"ok"===r?null:new y(r,o,n)}(c.status,c.json);if(u)throw u;if(!c.json)throw new y("internal","Response is not valid JSON object.");let h=c.json.data;if(void 0===h&&(h=c.json.result),void 0===h)throw new y("internal","Response is missing data field.");return{data:m(h)}}const D="@firebase/functions";function w(t=r(),e="us-central1"){const o=n(f(t),"functions").getImmediate({identifier:e}),i=u("functions");return i&&N(o,...i),o}function N(t,e,n){!function(t,e,n){t.emulatorOrigin=`http://${e}:${n}`}(f(t),e,n)}function I(t,e,n){return T(f(t),e,n)}function O(t,e,n){return function(t,e,n){return r=>C(t,e,r,n||{})}(f(t),e,n)}var k,v;k=fetch.bind(self),t(new p("functions",((t,{instanceIdentifier:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("auth-internal"),o=t.getProvider("messaging-internal"),i=t.getProvider("app-check-internal");return new S(n,r,o,i,e,k)}),"PUBLIC").setMultipleInstances(!0)),e(D,"0.9.4",v),e(D,"0.9.4","esm2017");export{N as connectFunctionsEmulator,w as getFunctions,I as httpsCallable,O as httpsCallableFromURL};
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=firebase-functions.js.map
|
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{registerVersion as t,_getProvider as e,getApp as n,_registerComponent as r}from"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";class a extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,i.prototype.create)}}class i{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(o,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",c=`${this.serviceName}: ${s} (${r}).`;return new a(r,c,n)}}const o=/\{\$([^}]+)}/g;class s{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}let c,u;const f=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,g=new WeakMap;let w={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return p.get(t);if("objectStoreNames"===e)return t.objectStoreNames||d.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function h(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(u||(u=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(v(this),e),y(f.get(this))}:function(...e){return y(t.apply(v(this),e))}:function(e,...n){const r=t.call(v(this),e,...n);return d.set(r,e.sort?e.sort():[e]),y(r)}}function m(t){return"function"==typeof t?h(t):(t instanceof IDBTransaction&&function(t){if(p.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",a),t.removeEventListener("error",i),t.removeEventListener("abort",i)},a=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",a),t.addEventListener("error",i),t.addEventListener("abort",i)}));p.set(t,e)}(t),e=t,(c||(c=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,w):t);var e}function y(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",a),t.removeEventListener("error",i)},a=()=>{e(y(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",a),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&f.set(e,t)})).catch((()=>{})),g.set(e,t),e}(t);if(l.has(t))return l.get(t);const e=m(t);return e!==t&&(l.set(t,e),g.set(e,t)),e}const v=t=>g.get(t);const I=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],S=new Map;function C(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(S.get(e))return S.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,a=b.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!a&&!I.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,a?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),a&&i.done]))[0]};return S.set(e,i),i}w=(t=>({...t,get:(e,n,r)=>C(e,n)||t.get(e,n,r),has:(e,n)=>!!C(e,n)||t.has(e,n)}))(w);const k="@firebase/installations",T=new i("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function D(t){return t instanceof a&&t.code.includes("request-failed")}function E({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function j(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function P(t,e){const n=(await e.json()).error;return T.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function B({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function $(t,{refreshToken:e}){const n=B(t);return n.append("Authorization",function(t){return`FIS_v2 ${t}`}(e)),n}async function q(t){const e=await t();return e.status>=500&&e.status<600?t():e}function L(t){return new Promise((e=>{setTimeout(e,t)}))}const O=/^[cdef][\w-]{21}$/;function N(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){return(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return O.test(e)?e:""}catch(t){return""}}function M(t){return`${t.appName}!${t.appId}`}const x=new Map;function A(t,e){const n=M(t);F(n,e),function(t,e){const n=V();n&&n.postMessage({key:t,fid:e});H()}(n,e)}function F(t,e){const n=x.get(t);if(n)for(const t of n)t(e)}let K=null;function V(){return!K&&"BroadcastChannel"in self&&(K=new BroadcastChannel("[Firebase] FID Change"),K.onmessage=t=>{F(t.data.key,t.data.fid)}),K}function H(){0===x.size&&K&&(K.close(),K=null)}const W="firebase-installations-store";let _=null;function z(){return _||(_=function(t,e,{blocked:n,upgrade:r,blocking:a,terminated:i}={}){const o=indexedDB.open(t,e),s=y(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(y(o.result),t.oldVersion,t.newVersion,y(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),s.then((t=>{i&&t.addEventListener("close",(()=>i())),a&&t.addEventListener("versionchange",(()=>a()))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(W)}})),_}async function R(t,e){const n=M(t),r=(await z()).transaction(W,"readwrite"),a=r.objectStore(W),i=await a.get(n);return await a.put(e,n),await r.done,i&&i.fid===e.fid||A(t,e.fid),e}async function J(t){const e=M(t),n=(await z()).transaction(W,"readwrite");await n.objectStore(W).delete(e),await n.done}async function U(t,e){const n=M(t),r=(await z()).transaction(W,"readwrite"),a=r.objectStore(W),i=await a.get(n),o=e(i);return void 0===o?await a.delete(n):await a.put(o,n),await r.done,!o||i&&i.fid===o.fid||A(t,o.fid),o}async function G(t){let e;const n=await U(t.appConfig,(n=>{const r=function(t){return Q(t||{fid:N(),registrationStatus:0})}(n),a=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(T.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=E(t),a=B(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&a.append("x-firebase-client",t)}const o={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await q((()=>fetch(r,s)));if(c.ok){const t=await c.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:j(t.authToken)}}throw await P("Create Installation",c)}(t,e);return R(t.appConfig,n)}catch(n){throw D(n)&&409===n.customData.serverCode?await J(t.appConfig):await R(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:r}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:Y(t)}:{installationEntry:e}}(t,r);return e=a.registrationPromise,a.installationEntry}));return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function Y(t){let e=await Z(t.appConfig);for(;1===e.registrationStatus;)await L(100),e=await Z(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await G(t);return n||e}return e}function Z(t){return U(t,(t=>{if(!t)throw T.create("installation-not-found");return Q(t)}))}function Q(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function X({appConfig:t,heartbeatServiceProvider:e},n){const r=function(t,{fid:e}){return`${E(t)}/${e}/authTokens:generate`}(t,n),a=$(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&a.append("x-firebase-client",t)}const o={installation:{sdkVersion:"w:0.6.4",appId:t.appId}},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await q((()=>fetch(r,s)));if(c.ok){return j(await c.json())}throw await P("Generate Auth Token",c)}async function tt(t,e=!1){let n;const r=await U(t.appConfig,(r=>{if(!nt(r))throw T.create("not-registered");const a=r.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+36e5}(t)}(a))return r;if(1===a.requestStatus)return n=async function(t,e){let n=await et(t.appConfig);for(;1===n.authToken.requestStatus;)await L(100),n=await et(t.appConfig);const r=n.authToken;return 0===r.requestStatus?tt(t,e):r}(t,e),r;{if(!navigator.onLine)throw T.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}(r);return n=async function(t,e){try{const n=await X(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await R(t.appConfig,r),n}catch(n){if(!D(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await R(t.appConfig,n)}else await J(t.appConfig);throw n}}(t,e),e}}));return n?await n:r.authToken}function et(t){return U(t,(t=>{if(!nt(t))throw T.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t;var n}))}function nt(t){return void 0!==t&&2===t.registrationStatus}async function rt(t){const e=t,{installationEntry:n,registrationPromise:r}=await G(e);return r?r.catch(console.error):tt(e).catch(console.error),n.fid}async function at(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await G(t);e&&await e}(n);return(await tt(n,e)).token}async function it(t,e){const n=function(t,{fid:e}){return`${E(t)}/${e}`}(t,e),r={method:"DELETE",headers:$(t,e)},a=await q((()=>fetch(n,r)));if(!a.ok)throw await P("Delete Installation",a)}async function ot(t){const{appConfig:e}=t,n=await U(e,(t=>{if(!t||0!==t.registrationStatus)return t}));if(n){if(1===n.registrationStatus)throw T.create("delete-pending-registration");if(2===n.registrationStatus){if(!navigator.onLine)throw T.create("app-offline");await it(e,n),await J(e)}}}function st(t,e){const{appConfig:n}=t;return function(t,e){V();const n=M(t);let r=x.get(n);r||(r=new Set,x.set(n,r)),r.add(e)}(n,e),()=>{!function(t,e){const n=M(t),r=x.get(n);r&&(r.delete(e),0===r.size&&x.delete(n),H())}(n,e)}}function ct(t=n()){return e(t,"installations").getImmediate()}function ut(t){return T.create("missing-app-config-values",{valueName:t})}const ft=t=>{const n=t.getProvider("app").getImmediate(),r=e(n,"installations").getImmediate();return{getId:()=>rt(r),getToken:t=>at(r,t)}};r(new s("installations",(t=>{const n=t.getProvider("app").getImmediate(),r=function(t){if(!t||!t.options)throw ut("App Configuration");if(!t.name)throw ut("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw ut(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(n);return{app:n,appConfig:r,heartbeatServiceProvider:e(n,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),r(new s("installations-internal",ft,"PRIVATE")),t(k,"0.6.4"),t(k,"0.6.4","esm2017");export{ot as deleteInstallations,rt as getId,ct as getInstallations,at as getToken,st as onIdChange};
|
|
1
|
+
import{registerVersion as t,_getProvider as e,getApp as n,_registerComponent as r}from"https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";class a extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,i.prototype.create)}}class i{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,i=this.errors[t],s=i?function(t,e){return t.replace(o,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",c=`${this.serviceName}: ${s} (${r}).`;return new a(r,c,n)}}const o=/\{\$([^}]+)}/g;class s{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}let c,u;const f=new WeakMap,p=new WeakMap,d=new WeakMap,l=new WeakMap,g=new WeakMap;let w={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return p.get(t);if("objectStoreNames"===e)return t.objectStoreNames||d.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function h(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(u||(u=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(v(this),e),y(f.get(this))}:function(...e){return y(t.apply(v(this),e))}:function(e,...n){const r=t.call(v(this),e,...n);return d.set(r,e.sort?e.sort():[e]),y(r)}}function m(t){return"function"==typeof t?h(t):(t instanceof IDBTransaction&&function(t){if(p.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",a),t.removeEventListener("error",i),t.removeEventListener("abort",i)},a=()=>{e(),r()},i=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",a),t.addEventListener("error",i),t.addEventListener("abort",i)}));p.set(t,e)}(t),e=t,(c||(c=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,w):t);var e}function y(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",a),t.removeEventListener("error",i)},a=()=>{e(y(t.result)),r()},i=()=>{n(t.error),r()};t.addEventListener("success",a),t.addEventListener("error",i)}));return e.then((e=>{e instanceof IDBCursor&&f.set(e,t)})).catch((()=>{})),g.set(e,t),e}(t);if(l.has(t))return l.get(t);const e=m(t);return e!==t&&(l.set(t,e),g.set(e,t)),e}const v=t=>g.get(t);const I=["get","getKey","getAll","getAllKeys","count"],b=["put","add","delete","clear"],S=new Map;function C(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(S.get(e))return S.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,a=b.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!a&&!I.includes(n))return;const i=async function(t,...e){const i=this.transaction(t,a?"readwrite":"readonly");let o=i.store;return r&&(o=o.index(e.shift())),(await Promise.all([o[n](...e),a&&i.done]))[0]};return S.set(e,i),i}w=(t=>({...t,get:(e,n,r)=>C(e,n)||t.get(e,n,r),has:(e,n)=>!!C(e,n)||t.has(e,n)}))(w);const k="@firebase/installations",T=new i("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function D(t){return t instanceof a&&t.code.includes("request-failed")}function E({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function j(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function P(t,e){const n=(await e.json()).error;return T.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function B({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function $(t,{refreshToken:e}){const n=B(t);return n.append("Authorization",function(t){return`FIS_v2 ${t}`}(e)),n}async function q(t){const e=await t();return e.status>=500&&e.status<600?t():e}function L(t){return new Promise((e=>{setTimeout(e,t)}))}const O=/^[cdef][\w-]{21}$/;function N(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){return(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return O.test(e)?e:""}catch(t){return""}}function M(t){return`${t.appName}!${t.appId}`}const x=new Map;function A(t,e){const n=M(t);F(n,e),function(t,e){const n=V();n&&n.postMessage({key:t,fid:e});H()}(n,e)}function F(t,e){const n=x.get(t);if(n)for(const t of n)t(e)}let K=null;function V(){return!K&&"BroadcastChannel"in self&&(K=new BroadcastChannel("[Firebase] FID Change"),K.onmessage=t=>{F(t.data.key,t.data.fid)}),K}function H(){0===x.size&&K&&(K.close(),K=null)}const W="firebase-installations-store";let _=null;function z(){return _||(_=function(t,e,{blocked:n,upgrade:r,blocking:a,terminated:i}={}){const o=indexedDB.open(t,e),s=y(o);return r&&o.addEventListener("upgradeneeded",(t=>{r(y(o.result),t.oldVersion,t.newVersion,y(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),s.then((t=>{i&&t.addEventListener("close",(()=>i())),a&&t.addEventListener("versionchange",(()=>a()))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(W)}})),_}async function R(t,e){const n=M(t),r=(await z()).transaction(W,"readwrite"),a=r.objectStore(W),i=await a.get(n);return await a.put(e,n),await r.done,i&&i.fid===e.fid||A(t,e.fid),e}async function J(t){const e=M(t),n=(await z()).transaction(W,"readwrite");await n.objectStore(W).delete(e),await n.done}async function U(t,e){const n=M(t),r=(await z()).transaction(W,"readwrite"),a=r.objectStore(W),i=await a.get(n),o=e(i);return void 0===o?await a.delete(n):await a.put(o,n),await r.done,!o||i&&i.fid===o.fid||A(t,o.fid),o}async function G(t){let e;const n=await U(t.appConfig,(n=>{const r=function(t){return Q(t||{fid:N(),registrationStatus:0})}(n),a=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(T.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=E(t),a=B(t),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&a.append("x-firebase-client",t)}const o={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await q((()=>fetch(r,s)));if(c.ok){const t=await c.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:j(t.authToken)}}throw await P("Create Installation",c)}(t,e);return R(t.appConfig,n)}catch(n){throw D(n)&&409===n.customData.serverCode?await J(t.appConfig):await R(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:r}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:Y(t)}:{installationEntry:e}}(t,r);return e=a.registrationPromise,a.installationEntry}));return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function Y(t){let e=await Z(t.appConfig);for(;1===e.registrationStatus;)await L(100),e=await Z(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await G(t);return n||e}return e}function Z(t){return U(t,(t=>{if(!t)throw T.create("installation-not-found");return Q(t)}))}function Q(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function X({appConfig:t,heartbeatServiceProvider:e},n){const r=function(t,{fid:e}){return`${E(t)}/${e}/authTokens:generate`}(t,n),a=$(t,n),i=e.getImmediate({optional:!0});if(i){const t=await i.getHeartbeatsHeader();t&&a.append("x-firebase-client",t)}const o={installation:{sdkVersion:"w:0.6.4",appId:t.appId}},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await q((()=>fetch(r,s)));if(c.ok){return j(await c.json())}throw await P("Generate Auth Token",c)}async function tt(t,e=!1){let n;const r=await U(t.appConfig,(r=>{if(!nt(r))throw T.create("not-registered");const a=r.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+36e5}(t)}(a))return r;if(1===a.requestStatus)return n=async function(t,e){let n=await et(t.appConfig);for(;1===n.authToken.requestStatus;)await L(100),n=await et(t.appConfig);const r=n.authToken;return 0===r.requestStatus?tt(t,e):r}(t,e),r;{if(!navigator.onLine)throw T.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}(r);return n=async function(t,e){try{const n=await X(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await R(t.appConfig,r),n}catch(n){if(!D(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await R(t.appConfig,n)}else await J(t.appConfig);throw n}}(t,e),e}}));return n?await n:r.authToken}function et(t){return U(t,(t=>{if(!nt(t))throw T.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t;var n}))}function nt(t){return void 0!==t&&2===t.registrationStatus}async function rt(t){const e=t,{installationEntry:n,registrationPromise:r}=await G(e);return r?r.catch(console.error):tt(e).catch(console.error),n.fid}async function at(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await G(t);e&&await e}(n);return(await tt(n,e)).token}async function it(t,e){const n=function(t,{fid:e}){return`${E(t)}/${e}`}(t,e),r={method:"DELETE",headers:$(t,e)},a=await q((()=>fetch(n,r)));if(!a.ok)throw await P("Delete Installation",a)}async function ot(t){const{appConfig:e}=t,n=await U(e,(t=>{if(!t||0!==t.registrationStatus)return t}));if(n){if(1===n.registrationStatus)throw T.create("delete-pending-registration");if(2===n.registrationStatus){if(!navigator.onLine)throw T.create("app-offline");await it(e,n),await J(e)}}}function st(t,e){const{appConfig:n}=t;return function(t,e){V();const n=M(t);let r=x.get(n);r||(r=new Set,x.set(n,r)),r.add(e)}(n,e),()=>{!function(t,e){const n=M(t),r=x.get(n);r&&(r.delete(e),0===r.size&&x.delete(n),H())}(n,e)}}function ct(t=n()){return e(t,"installations").getImmediate()}function ut(t){return T.create("missing-app-config-values",{valueName:t})}const ft=t=>{const n=t.getProvider("app").getImmediate(),r=e(n,"installations").getImmediate();return{getId:()=>rt(r),getToken:t=>at(r,t)}};r(new s("installations",(t=>{const n=t.getProvider("app").getImmediate(),r=function(t){if(!t||!t.options)throw ut("App Configuration");if(!t.name)throw ut("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw ut(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(n);return{app:n,appConfig:r,heartbeatServiceProvider:e(n,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),r(new s("installations-internal",ft,"PRIVATE")),t(k,"0.6.4"),t(k,"0.6.4","esm2017");export{ot as deleteInstallations,rt as getId,ct as getInstallations,at as getToken,st as onIdChange};
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=firebase-installations.js.map
|
package/firebase-messaging-sw.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as i}from"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";class o extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,o.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,a.prototype.create)}}class a{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},i=`${this.service}/${e}`,a=this.errors[e],s=a?function(e,t){return e.replace(r,((e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`}))}(a,n):"Error",c=`${this.serviceName}: ${s} (${i}).`;return new o(i,c,n)}}const r=/\{\$([^}]+)}/g;function s(e){return e&&e._delegate?e._delegate:e}class c{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let u,d;const l=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,h=new WeakMap;let w={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return p.get(e);if("objectStoreNames"===t)return e.objectStoreNames||f.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function m(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(d||(d=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(v(this),t),y(l.get(this))}:function(...t){return y(e.apply(v(this),t))}:function(t,...n){const i=e.call(v(this),t,...n);return f.set(i,t.sort?t.sort():[t]),y(i)}}function b(e){return"function"==typeof e?m(e):(e instanceof IDBTransaction&&function(e){if(p.has(e))return;const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",a),e.removeEventListener("abort",a)},o=()=>{t(),i()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",o),e.addEventListener("error",a),e.addEventListener("abort",a)}));p.set(e,t)}(e),t=e,(u||(u=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,w):e);var t}function y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",o),e.removeEventListener("error",a)},o=()=>{t(y(e.result)),i()},a=()=>{n(e.error),i()};e.addEventListener("success",o),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&l.set(t,e)})).catch((()=>{})),h.set(t,e),t}(e);if(g.has(e))return g.get(e);const t=b(e);return t!==e&&(g.set(e,t),h.set(t,e)),t}const v=e=>h.get(e);function k(e,t,{blocked:n,upgrade:i,blocking:o,terminated:a}={}){const r=indexedDB.open(e,t),s=y(r);return i&&r.addEventListener("upgradeneeded",(e=>{i(y(r.result),e.oldVersion,e.newVersion,y(r.transaction))})),n&&r.addEventListener("blocked",(()=>n())),s.then((e=>{a&&e.addEventListener("close",(()=>a())),o&&e.addEventListener("versionchange",(()=>o()))})).catch((()=>{})),s}function I(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),y(n).then((()=>{}))}const S=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],D=new Map;function C(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(D.get(t))return D.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,o=T.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!o&&!S.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,o?"readwrite":"readonly");let r=a.store;return i&&(r=r.index(t.shift())),(await Promise.all([r[n](...t),o&&a.done]))[0]};return D.set(t,a),a}w=(e=>({...e,get:(t,n,i)=>C(t,n)||e.get(t,n,i),has:(t,n)=>!!C(t,n)||e.has(t,n)}))(w);const j="@firebase/installations",_=new a("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function E(e){return e instanceof o&&e.code.includes("request-failed")}function M({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function O(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function P(e,t){const n=(await t.json()).error;return _.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function A({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function x(e,{refreshToken:t}){const n=A(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function B(e){const t=await e();return t.status>=500&&t.status<600?e():t}function N(e){return new Promise((t=>{setTimeout(t,e)}))}const K=/^[cdef][\w-]{21}$/;function L(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return K.test(t)?t:""}catch(e){return""}}function $(e){return`${e.appName}!${e.appId}`}const F=new Map;function q(e,t){const n=$(e);H(n,t),function(e,t){const n=function(){!R&&"BroadcastChannel"in self&&(R=new BroadcastChannel("[Firebase] FID Change"),R.onmessage=e=>{H(e.data.key,e.data.fid)});return R}();n&&n.postMessage({key:e,fid:t});0===F.size&&R&&(R.close(),R=null)}(n,t)}function H(e,t){const n=F.get(e);if(n)for(const e of n)e(t)}let R=null;const U="firebase-installations-store";let W=null;function V(){return W||(W=k("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(U)}})),W}async function G(e,t){const n=$(e),i=(await V()).transaction(U,"readwrite"),o=i.objectStore(U),a=await o.get(n);return await o.put(t,n),await i.done,a&&a.fid===t.fid||q(e,t.fid),t}async function J(e){const t=$(e),n=(await V()).transaction(U,"readwrite");await n.objectStore(U).delete(t),await n.done}async function z(e,t){const n=$(e),i=(await V()).transaction(U,"readwrite"),o=i.objectStore(U),a=await o.get(n),r=t(a);return void 0===r?await o.delete(n):await o.put(r,n),await i.done,!r||a&&a.fid===r.fid||q(e,r.fid),r}async function Y(e){let t;const n=await z(e.appConfig,(n=>{const i=function(e){return X(e||{fid:L(),registrationStatus:0})}(n),o=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(_.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const i=M(e),o=A(e),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const r={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:o,body:JSON.stringify(r)},c=await B((()=>fetch(i,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:O(e.authToken)}}throw await P("Create Installation",c)}(e,t);return G(e.appConfig,n)}catch(n){throw E(n)&&409===n.customData.serverCode?await J(e.appConfig):await G(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:Q(e)}:{installationEntry:t}}(e,i);return t=o.registrationPromise,o.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function Q(e){let t=await Z(e.appConfig);for(;1===t.registrationStatus;)await N(100),t=await Z(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await Y(e);return n||t}return t}function Z(e){return z(e,(e=>{if(!e)throw _.create("installation-not-found");return X(e)}))}function X(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function ee({appConfig:e,heartbeatServiceProvider:t},n){const i=function(e,{fid:t}){return`${M(e)}/${t}/authTokens:generate`}(e,n),o=x(e,n),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const r={installation:{sdkVersion:"w:0.6.4",appId:e.appId}},s={method:"POST",headers:o,body:JSON.stringify(r)},c=await B((()=>fetch(i,s)));if(c.ok){return O(await c.json())}throw await P("Generate Auth Token",c)}async function te(e,t=!1){let n;const i=await z(e.appConfig,(i=>{if(!ie(i))throw _.create("not-registered");const o=i.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(o))return i;if(1===o.requestStatus)return n=async function(e,t){let n=await ne(e.appConfig);for(;1===n.authToken.requestStatus;)await N(100),n=await ne(e.appConfig);const i=n.authToken;return 0===i.requestStatus?te(e,t):i}(e,t),i;{if(!navigator.onLine)throw _.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(i);return n=async function(e,t){try{const n=await ee(e,t),i=Object.assign(Object.assign({},t),{authToken:n});return await G(e.appConfig,i),n}catch(n){if(!E(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await G(e.appConfig,n)}else await J(e.appConfig);throw n}}(e,t),t}}));return n?await n:i.authToken}function ne(e){return z(e,(e=>{if(!ie(e))throw _.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function ie(e){return void 0!==e&&2===e.registrationStatus}async function oe(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await Y(e);t&&await t}(n);return(await te(n,t)).token}function ae(e){return _.create("missing-app-config-values",{valueName:e})}const re=e=>{const t=e.getProvider("app").getImmediate(),i=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:i}=await Y(t);return i?i.catch(console.error):te(t).catch(console.error),n.fid}(i),getToken:e=>oe(i,e)}};t(new c("installations",(e=>{const t=e.getProvider("app").getImmediate(),i=function(e){if(!e||!e.options)throw ae("App Configuration");if(!e.name)throw ae("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ae(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:i,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new c("installations-internal",re,"PRIVATE")),e(j,"0.6.4"),e(j,"0.6.4","esm2017");const se="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";var ce,ue;function de(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function le(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),i=new Uint8Array(n.length);for(let e=0;e<n.length;++e)i[e]=n.charCodeAt(e);return i}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(ce||(ce={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(ue||(ue={}));const pe="firebase-messaging-store";let fe=null;function ge(){return fe||(fe=k("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(pe)}})),fe}async function he(e){const t=me(e),n=await ge(),i=await n.transaction(pe).objectStore(pe).get(t);if(i)return i;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes("fcm_token_details_db"))return null}let t=null;return(await k("fcm_token_details_db",5,{upgrade:async(n,i,o,a)=>{var r;if(i<2)return;if(!n.objectStoreNames.contains("fcm_token_object_Store"))return;const s=a.objectStore("fcm_token_object_Store"),c=await s.index("fcmSenderId").get(e);if(await s.clear(),c)if(2===i){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(r=e.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:de(e.vapidKey)}}}else if(3===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}else if(4===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}}})).close(),await I("fcm_token_details_db"),await I("fcm_vapid_details_db"),await I("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await we(e,t),t}}async function we(e,t){const n=me(e),i=(await ge()).transaction(pe,"readwrite");return await i.objectStore(pe).put(t,n),await i.done,t}function me({appConfig:e}){return e.appId}const be=new a("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function ye(e,t){const n={method:"DELETE",headers:await ke(e)};try{const i=await fetch(`${ve(e.appConfig)}/${t}`,n),o=await i.json();if(o.error){const e=o.error.message;throw be.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw be.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function ve({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function ke({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Ie({p256dh:e,auth:t,endpoint:n,vapidKey:i}){const o={web:{endpoint:n,auth:t,p256dh:e}};return i!==se&&(o.web.applicationPubKey=i),o}async function Se(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:le(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:de(t.getKey("auth")),p256dh:de(t.getKey("p256dh"))},i=await he(e.firebaseDependencies);if(i){if(function(e,t){const n=t.vapidKey===e.vapidKey,i=t.endpoint===e.endpoint,o=t.auth===e.auth,a=t.p256dh===e.p256dh;return n&&i&&o&&a}(i.subscriptionOptions,n))return Date.now()>=i.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await ke(e),i=Ie(t.subscriptionOptions),o={method:"PATCH",headers:n,body:JSON.stringify(i)};let a;try{const n=await fetch(`${ve(e.appConfig)}/${t.token}`,o);a=await n.json()}catch(e){throw be.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw be.create("token-update-failed",{errorInfo:e})}if(!a.token)throw be.create("token-update-no-token");return a.token}(e.firebaseDependencies,t),i=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await we(e.firebaseDependencies,i),n}catch(t){throw await Te(e),t}}(e,{token:i.token,createTime:Date.now(),subscriptionOptions:n}):i.token;try{await ye(e.firebaseDependencies,i.token)}catch(e){console.warn(e)}return De(e.firebaseDependencies,n)}return De(e.firebaseDependencies,n)}async function Te(e){const t=await he(e.firebaseDependencies);t&&(await ye(e.firebaseDependencies,t.token),await async function(e){const t=me(e),n=(await ge()).transaction(pe,"readwrite");await n.objectStore(pe).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function De(e,t){const n=await async function(e,t){const n=await ke(e),i=Ie(t),o={method:"POST",headers:n,body:JSON.stringify(i)};let a;try{const t=await fetch(ve(e.appConfig),o);a=await t.json()}catch(e){throw be.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw be.create("token-subscribe-failed",{errorInfo:e})}if(!a.token)throw be.create("token-subscribe-no-token");return a.token}(e,t),i={token:n,createTime:Date.now(),subscriptionOptions:t};return await we(e,i),i.token}async function Ce(e,t){const n=function(e,t){var n,i;const o={};e.from&&(o.project_number=e.from);e.fcmMessageId&&(o.message_id=e.fcmMessageId);o.instance_id=t,e.notification?o.message_type=ce.DISPLAY_NOTIFICATION.toString():o.message_type=ce.DATA_MESSAGE.toString();o.sdk_platform=3..toString(),o.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(o.collapse_key=e.collapse_key);o.event=1..toString(),!(null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(o.analytics_label=null===(i=e.fcmOptions)||void 0===i?void 0:i.analytics_label);return o}(t,await e.firebaseDependencies.installations.getId());!function(e,t){const n={};n.event_time_ms=Math.floor(Date.now()).toString(),n.source_extension_json_proto3=JSON.stringify(t),e.logEvents.push(n)}(e,n)}function je(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e.charAt(i)),i<t.length&&n.push(t.charAt(i));return n.join("")}async function _e(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await Ce(t,n);const i=await Me();if(function(e){return e.some((e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")))}(i))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=ue.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(i,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:i}=Notification;n&&i&&n.length>i&&console.warn(`This browser only supports ${i} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={FCM_MSG:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const i=t.notification.body;i&&(e.notification.body=i);const o=t.notification.image;o&&(e.notification.image=o);const a=t.notification.icon;a&&(e.notification.icon=a)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,i,o,a,r;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const s=null!==(o=null===(i=t.fcmOptions)||void 0===i?void 0:i.link)&&void 0!==o?o:null===(a=t.notification)||void 0===a?void 0:a.click_action;s&&(e.fcmOptions.link=s);const c=null===(r=t.fcmOptions)||void 0===r?void 0:r.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function Ee(e){var t,n;const i=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n.FCM_MSG;if(!i)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const o=function(e){var t,n,i;const o=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(i=e.notification)||void 0===i?void 0:i.click_action;if(o)return o;return a=e.data,"object"==typeof a&&a&&"google.c.a.c_id"in a?self.location.origin:null;var a}(i);if(!o)return;const a=new URL(o,self.location.href),r=new URL(self.location.origin);if(a.host!==r.host)return;let s=await async function(e){const t=await Me();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(a);var c;return s?s=await s.focus():(s=await self.clients.openWindow(o),await(c=3e3,new Promise((e=>{setTimeout(e,c)})))),s?(i.messageType=ue.NOTIFICATION_CLICKED,i.isFirebaseMessaging=!0,s.postMessage(i)):void 0}function Me(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function Oe(e){return be.create("missing-app-config-values",{valueName:e})}je("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),je("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class Pe{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=function(e){if(!e||!e.options)throw Oe("App Configuration Object");if(!e.name)throw Oe("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw Oe(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function Ae(){return function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&await new Promise(((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(i);o.onsuccess=()=>{o.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},o.onupgradeneeded=()=>{n=!1},o.onerror=()=>{var e;t((null===(e=o.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function xe(e=i()){return Ae().then((e=>{if(!e)throw be.create("unsupported-browser")}),(e=>{throw be.create("indexed-db-unsupported")})),n(s(e),"messaging-sw").getImmediate()}function Be(e,t){return function(e,t){if(void 0!==self.document)throw be.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=s(e),t)}function Ne(e,t){return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}(e=s(e),t)}t(new c("messaging-sw",(e=>{const t=new Pe(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",(e=>{e.waitUntil(_e(e,t))})),self.addEventListener("pushsubscriptionchange",(e=>{e.waitUntil(async function(e,t){var n,i;const{newSubscription:o}=e;if(!o)return void await Te(t);const a=await he(t.firebaseDependencies);await Te(t),t.vapidKey=null!==(i=null===(n=null==a?void 0:a.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==i?i:se,await Se(t)}(e,t))})),self.addEventListener("notificationclick",(e=>{e.waitUntil(Ee(e))})),t}),"PUBLIC"));export{Ne as experimentalSetDeliveryMetricsExportedToBigQueryEnabled,xe as getMessaging,Ae as isSupported,Be as onBackgroundMessage};
|
|
1
|
+
import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as i}from"https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";class o extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,o.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,a.prototype.create)}}class a{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},i=`${this.service}/${e}`,a=this.errors[e],s=a?function(e,t){return e.replace(r,((e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`}))}(a,n):"Error",c=`${this.serviceName}: ${s} (${i}).`;return new o(i,c,n)}}const r=/\{\$([^}]+)}/g;function s(e){return e&&e._delegate?e._delegate:e}class c{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let u,d;const l=new WeakMap,p=new WeakMap,f=new WeakMap,g=new WeakMap,h=new WeakMap;let w={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return p.get(e);if("objectStoreNames"===t)return e.objectStoreNames||f.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function m(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(d||(d=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(v(this),t),y(l.get(this))}:function(...t){return y(e.apply(v(this),t))}:function(t,...n){const i=e.call(v(this),t,...n);return f.set(i,t.sort?t.sort():[t]),y(i)}}function b(e){return"function"==typeof e?m(e):(e instanceof IDBTransaction&&function(e){if(p.has(e))return;const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("complete",o),e.removeEventListener("error",a),e.removeEventListener("abort",a)},o=()=>{t(),i()},a=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",o),e.addEventListener("error",a),e.addEventListener("abort",a)}));p.set(e,t)}(e),t=e,(u||(u=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,w):e);var t}function y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",o),e.removeEventListener("error",a)},o=()=>{t(y(e.result)),i()},a=()=>{n(e.error),i()};e.addEventListener("success",o),e.addEventListener("error",a)}));return t.then((t=>{t instanceof IDBCursor&&l.set(t,e)})).catch((()=>{})),h.set(t,e),t}(e);if(g.has(e))return g.get(e);const t=b(e);return t!==e&&(g.set(e,t),h.set(t,e)),t}const v=e=>h.get(e);function k(e,t,{blocked:n,upgrade:i,blocking:o,terminated:a}={}){const r=indexedDB.open(e,t),s=y(r);return i&&r.addEventListener("upgradeneeded",(e=>{i(y(r.result),e.oldVersion,e.newVersion,y(r.transaction))})),n&&r.addEventListener("blocked",(()=>n())),s.then((e=>{a&&e.addEventListener("close",(()=>a())),o&&e.addEventListener("versionchange",(()=>o()))})).catch((()=>{})),s}function I(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),y(n).then((()=>{}))}const S=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],D=new Map;function C(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(D.get(t))return D.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,o=T.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!o&&!S.includes(n))return;const a=async function(e,...t){const a=this.transaction(e,o?"readwrite":"readonly");let r=a.store;return i&&(r=r.index(t.shift())),(await Promise.all([r[n](...t),o&&a.done]))[0]};return D.set(t,a),a}w=(e=>({...e,get:(t,n,i)=>C(t,n)||e.get(t,n,i),has:(t,n)=>!!C(t,n)||e.has(t,n)}))(w);const j="@firebase/installations",_=new a("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function E(e){return e instanceof o&&e.code.includes("request-failed")}function M({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function O(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function P(e,t){const n=(await t.json()).error;return _.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function A({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function x(e,{refreshToken:t}){const n=A(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function B(e){const t=await e();return t.status>=500&&t.status<600?e():t}function N(e){return new Promise((t=>{setTimeout(t,e)}))}const K=/^[cdef][\w-]{21}$/;function L(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return K.test(t)?t:""}catch(e){return""}}function $(e){return`${e.appName}!${e.appId}`}const F=new Map;function q(e,t){const n=$(e);H(n,t),function(e,t){const n=function(){!R&&"BroadcastChannel"in self&&(R=new BroadcastChannel("[Firebase] FID Change"),R.onmessage=e=>{H(e.data.key,e.data.fid)});return R}();n&&n.postMessage({key:e,fid:t});0===F.size&&R&&(R.close(),R=null)}(n,t)}function H(e,t){const n=F.get(e);if(n)for(const e of n)e(t)}let R=null;const U="firebase-installations-store";let W=null;function V(){return W||(W=k("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(U)}})),W}async function G(e,t){const n=$(e),i=(await V()).transaction(U,"readwrite"),o=i.objectStore(U),a=await o.get(n);return await o.put(t,n),await i.done,a&&a.fid===t.fid||q(e,t.fid),t}async function J(e){const t=$(e),n=(await V()).transaction(U,"readwrite");await n.objectStore(U).delete(t),await n.done}async function z(e,t){const n=$(e),i=(await V()).transaction(U,"readwrite"),o=i.objectStore(U),a=await o.get(n),r=t(a);return void 0===r?await o.delete(n):await o.put(r,n),await i.done,!r||a&&a.fid===r.fid||q(e,r.fid),r}async function Y(e){let t;const n=await z(e.appConfig,(n=>{const i=function(e){return X(e||{fid:L(),registrationStatus:0})}(n),o=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(_.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const i=M(e),o=A(e),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const r={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:o,body:JSON.stringify(r)},c=await B((()=>fetch(i,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:O(e.authToken)}}throw await P("Create Installation",c)}(e,t);return G(e.appConfig,n)}catch(n){throw E(n)&&409===n.customData.serverCode?await J(e.appConfig):await G(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:Q(e)}:{installationEntry:t}}(e,i);return t=o.registrationPromise,o.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function Q(e){let t=await Z(e.appConfig);for(;1===t.registrationStatus;)await N(100),t=await Z(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await Y(e);return n||t}return t}function Z(e){return z(e,(e=>{if(!e)throw _.create("installation-not-found");return X(e)}))}function X(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function ee({appConfig:e,heartbeatServiceProvider:t},n){const i=function(e,{fid:t}){return`${M(e)}/${t}/authTokens:generate`}(e,n),o=x(e,n),a=t.getImmediate({optional:!0});if(a){const e=await a.getHeartbeatsHeader();e&&o.append("x-firebase-client",e)}const r={installation:{sdkVersion:"w:0.6.4",appId:e.appId}},s={method:"POST",headers:o,body:JSON.stringify(r)},c=await B((()=>fetch(i,s)));if(c.ok){return O(await c.json())}throw await P("Generate Auth Token",c)}async function te(e,t=!1){let n;const i=await z(e.appConfig,(i=>{if(!ie(i))throw _.create("not-registered");const o=i.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(o))return i;if(1===o.requestStatus)return n=async function(e,t){let n=await ne(e.appConfig);for(;1===n.authToken.requestStatus;)await N(100),n=await ne(e.appConfig);const i=n.authToken;return 0===i.requestStatus?te(e,t):i}(e,t),i;{if(!navigator.onLine)throw _.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(i);return n=async function(e,t){try{const n=await ee(e,t),i=Object.assign(Object.assign({},t),{authToken:n});return await G(e.appConfig,i),n}catch(n){if(!E(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await G(e.appConfig,n)}else await J(e.appConfig);throw n}}(e,t),t}}));return n?await n:i.authToken}function ne(e){return z(e,(e=>{if(!ie(e))throw _.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function ie(e){return void 0!==e&&2===e.registrationStatus}async function oe(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await Y(e);t&&await t}(n);return(await te(n,t)).token}function ae(e){return _.create("missing-app-config-values",{valueName:e})}const re=e=>{const t=e.getProvider("app").getImmediate(),i=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:i}=await Y(t);return i?i.catch(console.error):te(t).catch(console.error),n.fid}(i),getToken:e=>oe(i,e)}};t(new c("installations",(e=>{const t=e.getProvider("app").getImmediate(),i=function(e){if(!e||!e.options)throw ae("App Configuration");if(!e.name)throw ae("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw ae(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:i,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new c("installations-internal",re,"PRIVATE")),e(j,"0.6.4"),e(j,"0.6.4","esm2017");const se="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";var ce,ue;function de(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function le(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),i=new Uint8Array(n.length);for(let e=0;e<n.length;++e)i[e]=n.charCodeAt(e);return i}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(ce||(ce={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(ue||(ue={}));const pe="firebase-messaging-store";let fe=null;function ge(){return fe||(fe=k("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(pe)}})),fe}async function he(e){const t=me(e),n=await ge(),i=await n.transaction(pe).objectStore(pe).get(t);if(i)return i;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes("fcm_token_details_db"))return null}let t=null;return(await k("fcm_token_details_db",5,{upgrade:async(n,i,o,a)=>{var r;if(i<2)return;if(!n.objectStoreNames.contains("fcm_token_object_Store"))return;const s=a.objectStore("fcm_token_object_Store"),c=await s.index("fcmSenderId").get(e);if(await s.clear(),c)if(2===i){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(r=e.createTime)&&void 0!==r?r:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:de(e.vapidKey)}}}else if(3===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}else if(4===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}}})).close(),await I("fcm_token_details_db"),await I("fcm_vapid_details_db"),await I("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await we(e,t),t}}async function we(e,t){const n=me(e),i=(await ge()).transaction(pe,"readwrite");return await i.objectStore(pe).put(t,n),await i.done,t}function me({appConfig:e}){return e.appId}const be=new a("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function ye(e,t){const n={method:"DELETE",headers:await ke(e)};try{const i=await fetch(`${ve(e.appConfig)}/${t}`,n),o=await i.json();if(o.error){const e=o.error.message;throw be.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw be.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function ve({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function ke({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Ie({p256dh:e,auth:t,endpoint:n,vapidKey:i}){const o={web:{endpoint:n,auth:t,p256dh:e}};return i!==se&&(o.web.applicationPubKey=i),o}async function Se(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:le(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:de(t.getKey("auth")),p256dh:de(t.getKey("p256dh"))},i=await he(e.firebaseDependencies);if(i){if(function(e,t){const n=t.vapidKey===e.vapidKey,i=t.endpoint===e.endpoint,o=t.auth===e.auth,a=t.p256dh===e.p256dh;return n&&i&&o&&a}(i.subscriptionOptions,n))return Date.now()>=i.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await ke(e),i=Ie(t.subscriptionOptions),o={method:"PATCH",headers:n,body:JSON.stringify(i)};let a;try{const n=await fetch(`${ve(e.appConfig)}/${t.token}`,o);a=await n.json()}catch(e){throw be.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw be.create("token-update-failed",{errorInfo:e})}if(!a.token)throw be.create("token-update-no-token");return a.token}(e.firebaseDependencies,t),i=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await we(e.firebaseDependencies,i),n}catch(t){throw await Te(e),t}}(e,{token:i.token,createTime:Date.now(),subscriptionOptions:n}):i.token;try{await ye(e.firebaseDependencies,i.token)}catch(e){console.warn(e)}return De(e.firebaseDependencies,n)}return De(e.firebaseDependencies,n)}async function Te(e){const t=await he(e.firebaseDependencies);t&&(await ye(e.firebaseDependencies,t.token),await async function(e){const t=me(e),n=(await ge()).transaction(pe,"readwrite");await n.objectStore(pe).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function De(e,t){const n=await async function(e,t){const n=await ke(e),i=Ie(t),o={method:"POST",headers:n,body:JSON.stringify(i)};let a;try{const t=await fetch(ve(e.appConfig),o);a=await t.json()}catch(e){throw be.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(a.error){const e=a.error.message;throw be.create("token-subscribe-failed",{errorInfo:e})}if(!a.token)throw be.create("token-subscribe-no-token");return a.token}(e,t),i={token:n,createTime:Date.now(),subscriptionOptions:t};return await we(e,i),i.token}async function Ce(e,t){const n=function(e,t){var n,i;const o={};e.from&&(o.project_number=e.from);e.fcmMessageId&&(o.message_id=e.fcmMessageId);o.instance_id=t,e.notification?o.message_type=ce.DISPLAY_NOTIFICATION.toString():o.message_type=ce.DATA_MESSAGE.toString();o.sdk_platform=3..toString(),o.package_name=self.origin.replace(/(^\w+:|^)\/\//,""),!e.collapse_key||(o.collapse_key=e.collapse_key);o.event=1..toString(),!(null===(n=e.fcmOptions)||void 0===n?void 0:n.analytics_label)||(o.analytics_label=null===(i=e.fcmOptions)||void 0===i?void 0:i.analytics_label);return o}(t,await e.firebaseDependencies.installations.getId());!function(e,t){const n={};n.event_time_ms=Math.floor(Date.now()).toString(),n.source_extension_json_proto3=JSON.stringify(t),e.logEvents.push(n)}(e,n)}function je(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e.charAt(i)),i<t.length&&n.push(t.charAt(i));return n.join("")}async function _e(e,t){const n=function({data:e}){if(!e)return null;try{return e.json()}catch(e){return null}}(e);if(!n)return;t.deliveryMetricsExportedToBigQueryEnabled&&await Ce(t,n);const i=await Me();if(function(e){return e.some((e=>"visible"===e.visibilityState&&!e.url.startsWith("chrome-extension://")))}(i))return function(e,t){t.isFirebaseMessaging=!0,t.messageType=ue.PUSH_RECEIVED;for(const n of e)n.postMessage(t)}(i,n);if(n.notification&&await function(e){var t;const{actions:n}=e,{maxActions:i}=Notification;n&&i&&n.length>i&&console.warn(`This browser only supports ${i} actions. The remaining actions will not be displayed.`);return self.registration.showNotification(null!==(t=e.title)&&void 0!==t?t:"",e)}(function(e){const t=Object.assign({},e.notification);return t.data={FCM_MSG:e},t}(n)),t&&t.onBackgroundMessageHandler){const e=function(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const i=t.notification.body;i&&(e.notification.body=i);const o=t.notification.image;o&&(e.notification.image=o);const a=t.notification.icon;a&&(e.notification.icon=a)}(t,e),function(e,t){t.data&&(e.data=t.data)}(t,e),function(e,t){var n,i,o,a,r;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const s=null!==(o=null===(i=t.fcmOptions)||void 0===i?void 0:i.link)&&void 0!==o?o:null===(a=t.notification)||void 0===a?void 0:a.click_action;s&&(e.fcmOptions.link=s);const c=null===(r=t.fcmOptions)||void 0===r?void 0:r.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}(n);"function"==typeof t.onBackgroundMessageHandler?await t.onBackgroundMessageHandler(e):t.onBackgroundMessageHandler.next(e)}}async function Ee(e){var t,n;const i=null===(n=null===(t=e.notification)||void 0===t?void 0:t.data)||void 0===n?void 0:n.FCM_MSG;if(!i)return;if(e.action)return;e.stopImmediatePropagation(),e.notification.close();const o=function(e){var t,n,i;const o=null!==(n=null===(t=e.fcmOptions)||void 0===t?void 0:t.link)&&void 0!==n?n:null===(i=e.notification)||void 0===i?void 0:i.click_action;if(o)return o;return a=e.data,"object"==typeof a&&a&&"google.c.a.c_id"in a?self.location.origin:null;var a}(i);if(!o)return;const a=new URL(o,self.location.href),r=new URL(self.location.origin);if(a.host!==r.host)return;let s=await async function(e){const t=await Me();for(const n of t){const t=new URL(n.url,self.location.href);if(e.host===t.host)return n}return null}(a);var c;return s?s=await s.focus():(s=await self.clients.openWindow(o),await(c=3e3,new Promise((e=>{setTimeout(e,c)})))),s?(i.messageType=ue.NOTIFICATION_CLICKED,i.isFirebaseMessaging=!0,s.postMessage(i)):void 0}function Me(){return self.clients.matchAll({type:"window",includeUncontrolled:!0})}function Oe(e){return be.create("missing-app-config-values",{valueName:e})}je("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),je("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class Pe{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=function(e){if(!e||!e.options)throw Oe("App Configuration Object");if(!e.name)throw Oe("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw Oe(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function Ae(){return function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&await new Promise(((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",o=self.indexedDB.open(i);o.onsuccess=()=>{o.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},o.onupgradeneeded=()=>{n=!1},o.onerror=()=>{var e;t((null===(e=o.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))&&"PushManager"in self&&"Notification"in self&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function xe(e=i()){return Ae().then((e=>{if(!e)throw be.create("unsupported-browser")}),(e=>{throw be.create("indexed-db-unsupported")})),n(s(e),"messaging-sw").getImmediate()}function Be(e,t){return function(e,t){if(void 0!==self.document)throw be.create("only-available-in-sw");return e.onBackgroundMessageHandler=t,()=>{e.onBackgroundMessageHandler=null}}(e=s(e),t)}function Ne(e,t){return function(e,t){e.deliveryMetricsExportedToBigQueryEnabled=t}(e=s(e),t)}t(new c("messaging-sw",(e=>{const t=new Pe(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return self.addEventListener("push",(e=>{e.waitUntil(_e(e,t))})),self.addEventListener("pushsubscriptionchange",(e=>{e.waitUntil(async function(e,t){var n,i;const{newSubscription:o}=e;if(!o)return void await Te(t);const a=await he(t.firebaseDependencies);await Te(t),t.vapidKey=null!==(i=null===(n=null==a?void 0:a.subscriptionOptions)||void 0===n?void 0:n.vapidKey)&&void 0!==i?i:se,await Se(t)}(e,t))})),self.addEventListener("notificationclick",(e=>{e.waitUntil(Ee(e))})),t}),"PUBLIC"));export{Ne as experimentalSetDeliveryMetricsExportedToBigQueryEnabled,xe as getMessaging,Ae as isSupported,Be as onBackgroundMessage};
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=firebase-messaging-sw.js.map
|
package/firebase-messaging.js
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as i}from"https://www.gstatic.com/firebasejs/9.17.2/firebase-app.js";class a extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,r.prototype.create)}}class r{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},i=`${this.service}/${e}`,r=this.errors[e],s=r?function(e,t){return e.replace(o,((e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`}))}(r,n):"Error",c=`${this.serviceName}: ${s} (${i}).`;return new a(i,c,n)}}const o=/\{\$([^}]+)}/g;function s(e){return e&&e._delegate?e._delegate:e}class c{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let u,d;const p=new WeakMap,f=new WeakMap,l=new WeakMap,g=new WeakMap,w=new WeakMap;let h={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return f.get(e);if("objectStoreNames"===t)return e.objectStoreNames||l.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function m(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(d||(d=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(v(this),t),y(p.get(this))}:function(...t){return y(e.apply(v(this),t))}:function(t,...n){const i=e.call(v(this),t,...n);return l.set(i,t.sort?t.sort():[t]),y(i)}}function b(e){return"function"==typeof e?m(e):(e instanceof IDBTransaction&&function(e){if(f.has(e))return;const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",r),e.removeEventListener("abort",r)},a=()=>{t(),i()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",a),e.addEventListener("error",r),e.addEventListener("abort",r)}));f.set(e,t)}(e),t=e,(u||(u=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,h):e);var t}function y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",a),e.removeEventListener("error",r)},a=()=>{t(y(e.result)),i()},r=()=>{n(e.error),i()};e.addEventListener("success",a),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&p.set(t,e)})).catch((()=>{})),w.set(t,e),t}(e);if(g.has(e))return g.get(e);const t=b(e);return t!==e&&(g.set(e,t),w.set(t,e)),t}const v=e=>w.get(e);function k(e,t,{blocked:n,upgrade:i,blocking:a,terminated:r}={}){const o=indexedDB.open(e,t),s=y(o);return i&&o.addEventListener("upgradeneeded",(e=>{i(y(o.result),e.oldVersion,e.newVersion,y(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),s.then((e=>{r&&e.addEventListener("close",(()=>r())),a&&e.addEventListener("versionchange",(()=>a()))})).catch((()=>{})),s}function I(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),y(n).then((()=>{}))}const S=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],D=new Map;function C(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(D.get(t))return D.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,a=T.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!a&&!S.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,a?"readwrite":"readonly");let o=r.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),a&&r.done]))[0]};return D.set(t,r),r}h=(e=>({...e,get:(t,n,i)=>C(t,n)||e.get(t,n,i),has:(t,n)=>!!C(t,n)||e.has(t,n)}))(h);const j="@firebase/installations",E=new r("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function P(e){return e instanceof a&&e.code.includes("request-failed")}function O({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function _(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function M(e,t){const n=(await t.json()).error;return E.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function A({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function K(e,{refreshToken:t}){const n=A(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function N(e){const t=await e();return t.status>=500&&t.status<600?e():t}function x(e){return new Promise((t=>{setTimeout(t,e)}))}const B=/^[cdef][\w-]{21}$/;function $(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return B.test(t)?t:""}catch(e){return""}}function L(e){return`${e.appName}!${e.appId}`}const q=new Map;function F(e,t){const n=L(e);R(n,t),function(e,t){const n=function(){!H&&"BroadcastChannel"in self&&(H=new BroadcastChannel("[Firebase] FID Change"),H.onmessage=e=>{R(e.data.key,e.data.fid)});return H}();n&&n.postMessage({key:e,fid:t});0===q.size&&H&&(H.close(),H=null)}(n,t)}function R(e,t){const n=q.get(e);if(n)for(const e of n)e(t)}let H=null;const W="firebase-installations-store";let V=null;function U(){return V||(V=k("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(W)}})),V}async function G(e,t){const n=L(e),i=(await U()).transaction(W,"readwrite"),a=i.objectStore(W),r=await a.get(n);return await a.put(t,n),await i.done,r&&r.fid===t.fid||F(e,t.fid),t}async function z(e){const t=L(e),n=(await U()).transaction(W,"readwrite");await n.objectStore(W).delete(t),await n.done}async function J(e,t){const n=L(e),i=(await U()).transaction(W,"readwrite"),a=i.objectStore(W),r=await a.get(n),o=t(r);return void 0===o?await a.delete(n):await a.put(o,n),await i.done,!o||r&&r.fid===o.fid||F(e,o.fid),o}async function Y(e){let t;const n=await J(e.appConfig,(n=>{const i=function(e){return X(e||{fid:$(),registrationStatus:0})}(n),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(E.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const i=O(e),a=A(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await N((()=>fetch(i,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:_(e.authToken)}}throw await M("Create Installation",c)}(e,t);return G(e.appConfig,n)}catch(n){throw P(n)&&409===n.customData.serverCode?await z(e.appConfig):await G(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:Q(e)}:{installationEntry:t}}(e,i);return t=a.registrationPromise,a.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function Q(e){let t=await Z(e.appConfig);for(;1===t.registrationStatus;)await x(100),t=await Z(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await Y(e);return n||t}return t}function Z(e){return J(e,(e=>{if(!e)throw E.create("installation-not-found");return X(e)}))}function X(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function ee({appConfig:e,heartbeatServiceProvider:t},n){const i=function(e,{fid:t}){return`${O(e)}/${t}/authTokens:generate`}(e,n),a=K(e,n),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={installation:{sdkVersion:"w:0.6.4",appId:e.appId}},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await N((()=>fetch(i,s)));if(c.ok){return _(await c.json())}throw await M("Generate Auth Token",c)}async function te(e,t=!1){let n;const i=await J(e.appConfig,(i=>{if(!ie(i))throw E.create("not-registered");const a=i.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(a))return i;if(1===a.requestStatus)return n=async function(e,t){let n=await ne(e.appConfig);for(;1===n.authToken.requestStatus;)await x(100),n=await ne(e.appConfig);const i=n.authToken;return 0===i.requestStatus?te(e,t):i}(e,t),i;{if(!navigator.onLine)throw E.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(i);return n=async function(e,t){try{const n=await ee(e,t),i=Object.assign(Object.assign({},t),{authToken:n});return await G(e.appConfig,i),n}catch(n){if(!P(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await G(e.appConfig,n)}else await z(e.appConfig);throw n}}(e,t),t}}));return n?await n:i.authToken}function ne(e){return J(e,(e=>{if(!ie(e))throw E.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function ie(e){return void 0!==e&&2===e.registrationStatus}async function ae(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await Y(e);t&&await t}(n);return(await te(n,t)).token}function re(e){return E.create("missing-app-config-values",{valueName:e})}const oe=e=>{const t=e.getProvider("app").getImmediate(),i=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:i}=await Y(t);return i?i.catch(console.error):te(t).catch(console.error),n.fid}(i),getToken:e=>ae(i,e)}};t(new c("installations",(e=>{const t=e.getProvider("app").getImmediate(),i=function(e){if(!e||!e.options)throw re("App Configuration");if(!e.name)throw re("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw re(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:i,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new c("installations-internal",oe,"PRIVATE")),e(j,"0.6.4"),e(j,"0.6.4","esm2017");const se="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";var ce,ue;function de(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function pe(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),i=new Uint8Array(n.length);for(let e=0;e<n.length;++e)i[e]=n.charCodeAt(e);return i}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(ce||(ce={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(ue||(ue={}));const fe="firebase-messaging-store";let le=null;function ge(){return le||(le=k("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(fe)}})),le}async function we(e){const t=me(e),n=await ge(),i=await n.transaction(fe).objectStore(fe).get(t);if(i)return i;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes("fcm_token_details_db"))return null}let t=null;return(await k("fcm_token_details_db",5,{upgrade:async(n,i,a,r)=>{var o;if(i<2)return;if(!n.objectStoreNames.contains("fcm_token_object_Store"))return;const s=r.objectStore("fcm_token_object_Store"),c=await s.index("fcmSenderId").get(e);if(await s.clear(),c)if(2===i){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:de(e.vapidKey)}}}else if(3===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}else if(4===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}}})).close(),await I("fcm_token_details_db"),await I("fcm_vapid_details_db"),await I("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await he(e,t),t}}async function he(e,t){const n=me(e),i=(await ge()).transaction(fe,"readwrite");return await i.objectStore(fe).put(t,n),await i.done,t}function me({appConfig:e}){return e.appId}const be=new r("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function ye(e,t){const n={method:"DELETE",headers:await ke(e)};try{const i=await fetch(`${ve(e.appConfig)}/${t}`,n),a=await i.json();if(a.error){const e=a.error.message;throw be.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw be.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function ve({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function ke({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Ie({p256dh:e,auth:t,endpoint:n,vapidKey:i}){const a={web:{endpoint:n,auth:t,p256dh:e}};return i!==se&&(a.web.applicationPubKey=i),a}async function Se(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:pe(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:de(t.getKey("auth")),p256dh:de(t.getKey("p256dh"))},i=await we(e.firebaseDependencies);if(i){if(function(e,t){const n=t.vapidKey===e.vapidKey,i=t.endpoint===e.endpoint,a=t.auth===e.auth,r=t.p256dh===e.p256dh;return n&&i&&a&&r}(i.subscriptionOptions,n))return Date.now()>=i.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await ke(e),i=Ie(t.subscriptionOptions),a={method:"PATCH",headers:n,body:JSON.stringify(i)};let r;try{const n=await fetch(`${ve(e.appConfig)}/${t.token}`,a);r=await n.json()}catch(e){throw be.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw be.create("token-update-failed",{errorInfo:e})}if(!r.token)throw be.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),i=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await he(e.firebaseDependencies,i),n}catch(t){throw await Te(e),t}}(e,{token:i.token,createTime:Date.now(),subscriptionOptions:n}):i.token;try{await ye(e.firebaseDependencies,i.token)}catch(e){console.warn(e)}return De(e.firebaseDependencies,n)}return De(e.firebaseDependencies,n)}async function Te(e){const t=await we(e.firebaseDependencies);t&&(await ye(e.firebaseDependencies,t.token),await async function(e){const t=me(e),n=(await ge()).transaction(fe,"readwrite");await n.objectStore(fe).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function De(e,t){const n=await async function(e,t){const n=await ke(e),i=Ie(t),a={method:"POST",headers:n,body:JSON.stringify(i)};let r;try{const t=await fetch(ve(e.appConfig),a);r=await t.json()}catch(e){throw be.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw be.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw be.create("token-subscribe-no-token");return r.token}(e,t),i={token:n,createTime:Date.now(),subscriptionOptions:t};return await he(e,i),i.token}function Ce(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const i=t.notification.body;i&&(e.notification.body=i);const a=t.notification.image;a&&(e.notification.image=a);const r=t.notification.icon;r&&(e.notification.icon=r)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,i,a,r,o;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const s=null!==(a=null===(i=t.fcmOptions)||void 0===i?void 0:i.link)&&void 0!==a?a:null===(r=t.notification)||void 0===r?void 0:r.click_action;s&&(e.fcmOptions.link=s);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}function je(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e.charAt(i)),i<t.length&&n.push(t.charAt(i));return n.join("")}function Ee(e){return be.create("missing-app-config-values",{valueName:e})}je("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),je("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class Pe{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=function(e){if(!e||!e.options)throw Ee("App Configuration Object");if(!e.name)throw Ee("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw Ee(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function Oe(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch((()=>{}))}catch(e){throw be.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}async function _e(e,t){if(!navigator)throw be.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw be.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=se)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await Oe(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw be.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),Se(e)}async function Me(e,t,n){const i=function(e){switch(e){case ue.NOTIFICATION_CLICKED:return"notification_open";case ue.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(i,{message_id:n["google.c.a.c_id"],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}const Ae="@firebase/messaging",Ke=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>_e(t,e)}};async function Ne(){try{await new Promise(((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(i);a.onsuccess=()=>{a.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},a.onupgradeneeded=()=>{n=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}catch(e){return!1}return"undefined"!=typeof window&&function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&!("undefined"==typeof navigator||!navigator.cookieEnabled)&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function xe(e=i()){return Ne().then((e=>{if(!e)throw be.create("unsupported-browser")}),(e=>{throw be.create("indexed-db-unsupported")})),n(s(e),"messaging").getImmediate()}async function Be(e,t){return _e(e=s(e),t)}function $e(e){return async function(e){if(!navigator)throw be.create("only-available-in-window");return e.swRegistration||await Oe(e),Te(e)}(e=s(e))}function Le(e,t){return function(e,t){if(!navigator)throw be.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=s(e),t)}t(new c("messaging",(e=>{const t=new Pe(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",(e=>async function(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===ue.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(Ce(n)):e.onMessageHandler.next(Ce(n)));const i=n.data;var a;"object"==typeof(a=i)&&a&&"google.c.a.c_id"in a&&"1"===i["google.c.a.e"]&&await Me(e,n.messageType,i)}(t,e))),t}),"PUBLIC")),t(new c("messaging-internal",Ke,"PRIVATE")),e(Ae,"0.12.4"),e(Ae,"0.12.4","esm2017");export{$e as deleteToken,xe as getMessaging,Be as getToken,Ne as isSupported,Le as onMessage};
|
|
1
|
+
import{registerVersion as e,_registerComponent as t,_getProvider as n,getApp as i}from"https://www.gstatic.com/firebasejs/9.18.0/firebase-app.js";class a extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,r.prototype.create)}}class r{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},i=`${this.service}/${e}`,r=this.errors[e],s=r?function(e,t){return e.replace(o,((e,n)=>{const i=t[n];return null!=i?String(i):`<${n}?>`}))}(r,n):"Error",c=`${this.serviceName}: ${s} (${i}).`;return new a(i,c,n)}}const o=/\{\$([^}]+)}/g;function s(e){return e&&e._delegate?e._delegate:e}class c{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let u,d;const p=new WeakMap,f=new WeakMap,l=new WeakMap,g=new WeakMap,w=new WeakMap;let h={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return f.get(e);if("objectStoreNames"===t)return e.objectStoreNames||l.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return y(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function m(e){return e!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(d||(d=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(e)?function(...t){return e.apply(v(this),t),y(p.get(this))}:function(...t){return y(e.apply(v(this),t))}:function(t,...n){const i=e.call(v(this),t,...n);return l.set(i,t.sort?t.sort():[t]),y(i)}}function b(e){return"function"==typeof e?m(e):(e instanceof IDBTransaction&&function(e){if(f.has(e))return;const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("complete",a),e.removeEventListener("error",r),e.removeEventListener("abort",r)},a=()=>{t(),i()},r=()=>{n(e.error||new DOMException("AbortError","AbortError")),i()};e.addEventListener("complete",a),e.addEventListener("error",r),e.addEventListener("abort",r)}));f.set(e,t)}(e),t=e,(u||(u=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>t instanceof e))?new Proxy(e,h):e);var t}function y(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const i=()=>{e.removeEventListener("success",a),e.removeEventListener("error",r)},a=()=>{t(y(e.result)),i()},r=()=>{n(e.error),i()};e.addEventListener("success",a),e.addEventListener("error",r)}));return t.then((t=>{t instanceof IDBCursor&&p.set(t,e)})).catch((()=>{})),w.set(t,e),t}(e);if(g.has(e))return g.get(e);const t=b(e);return t!==e&&(g.set(e,t),w.set(t,e)),t}const v=e=>w.get(e);function k(e,t,{blocked:n,upgrade:i,blocking:a,terminated:r}={}){const o=indexedDB.open(e,t),s=y(o);return i&&o.addEventListener("upgradeneeded",(e=>{i(y(o.result),e.oldVersion,e.newVersion,y(o.transaction))})),n&&o.addEventListener("blocked",(()=>n())),s.then((e=>{r&&e.addEventListener("close",(()=>r())),a&&e.addEventListener("versionchange",(()=>a()))})).catch((()=>{})),s}function I(e,{blocked:t}={}){const n=indexedDB.deleteDatabase(e);return t&&n.addEventListener("blocked",(()=>t())),y(n).then((()=>{}))}const S=["get","getKey","getAll","getAllKeys","count"],T=["put","add","delete","clear"],D=new Map;function C(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(D.get(t))return D.get(t);const n=t.replace(/FromIndex$/,""),i=t!==n,a=T.includes(n);if(!(n in(i?IDBIndex:IDBObjectStore).prototype)||!a&&!S.includes(n))return;const r=async function(e,...t){const r=this.transaction(e,a?"readwrite":"readonly");let o=r.store;return i&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),a&&r.done]))[0]};return D.set(t,r),r}h=(e=>({...e,get:(t,n,i)=>C(t,n)||e.get(t,n,i),has:(t,n)=>!!C(t,n)||e.has(t,n)}))(h);const j="@firebase/installations",E=new r("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function P(e){return e instanceof a&&e.code.includes("request-failed")}function O({projectId:e}){return`https://firebaseinstallations.googleapis.com/v1/projects/${e}/installations`}function _(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}async function M(e,t){const n=(await t.json()).error;return E.create("request-failed",{requestName:e,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function A({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function K(e,{refreshToken:t}){const n=A(e);return n.append("Authorization",function(e){return`FIS_v2 ${e}`}(t)),n}async function N(e){const t=await e();return t.status>=500&&t.status<600?e():t}function x(e){return new Promise((t=>{setTimeout(t,e)}))}const B=/^[cdef][\w-]{21}$/;function $(){try{const e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;const t=function(e){return(t=e,btoa(String.fromCharCode(...t)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var t}(e);return B.test(t)?t:""}catch(e){return""}}function L(e){return`${e.appName}!${e.appId}`}const q=new Map;function F(e,t){const n=L(e);R(n,t),function(e,t){const n=function(){!H&&"BroadcastChannel"in self&&(H=new BroadcastChannel("[Firebase] FID Change"),H.onmessage=e=>{R(e.data.key,e.data.fid)});return H}();n&&n.postMessage({key:e,fid:t});0===q.size&&H&&(H.close(),H=null)}(n,t)}function R(e,t){const n=q.get(e);if(n)for(const e of n)e(t)}let H=null;const W="firebase-installations-store";let V=null;function U(){return V||(V=k("firebase-installations-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(W)}})),V}async function G(e,t){const n=L(e),i=(await U()).transaction(W,"readwrite"),a=i.objectStore(W),r=await a.get(n);return await a.put(t,n),await i.done,r&&r.fid===t.fid||F(e,t.fid),t}async function z(e){const t=L(e),n=(await U()).transaction(W,"readwrite");await n.objectStore(W).delete(t),await n.done}async function J(e,t){const n=L(e),i=(await U()).transaction(W,"readwrite"),a=i.objectStore(W),r=await a.get(n),o=t(r);return void 0===o?await a.delete(n):await a.put(o,n),await i.done,!o||r&&r.fid===o.fid||F(e,o.fid),o}async function Y(e){let t;const n=await J(e.appConfig,(n=>{const i=function(e){return X(e||{fid:$(),registrationStatus:0})}(n),a=function(e,t){if(0===t.registrationStatus){if(!navigator.onLine){return{installationEntry:t,registrationPromise:Promise.reject(E.create("app-offline"))}}const n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=async function(e,t){try{const n=await async function({appConfig:e,heartbeatServiceProvider:t},{fid:n}){const i=O(e),a=A(e),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={fid:n,authVersion:"FIS_v2",appId:e.appId,sdkVersion:"w:0.6.4"},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await N((()=>fetch(i,s)));if(c.ok){const e=await c.json();return{fid:e.fid||n,registrationStatus:2,refreshToken:e.refreshToken,authToken:_(e.authToken)}}throw await M("Create Installation",c)}(e,t);return G(e.appConfig,n)}catch(n){throw P(n)&&409===n.customData.serverCode?await z(e.appConfig):await G(e.appConfig,{fid:t.fid,registrationStatus:0}),n}}(e,n);return{installationEntry:n,registrationPromise:i}}return 1===t.registrationStatus?{installationEntry:t,registrationPromise:Q(e)}:{installationEntry:t}}(e,i);return t=a.registrationPromise,a.installationEntry}));return""===n.fid?{installationEntry:await t}:{installationEntry:n,registrationPromise:t}}async function Q(e){let t=await Z(e.appConfig);for(;1===t.registrationStatus;)await x(100),t=await Z(e.appConfig);if(0===t.registrationStatus){const{installationEntry:t,registrationPromise:n}=await Y(e);return n||t}return t}function Z(e){return J(e,(e=>{if(!e)throw E.create("installation-not-found");return X(e)}))}function X(e){return 1===(t=e).registrationStatus&&t.registrationTime+1e4<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}async function ee({appConfig:e,heartbeatServiceProvider:t},n){const i=function(e,{fid:t}){return`${O(e)}/${t}/authTokens:generate`}(e,n),a=K(e,n),r=t.getImmediate({optional:!0});if(r){const e=await r.getHeartbeatsHeader();e&&a.append("x-firebase-client",e)}const o={installation:{sdkVersion:"w:0.6.4",appId:e.appId}},s={method:"POST",headers:a,body:JSON.stringify(o)},c=await N((()=>fetch(i,s)));if(c.ok){return _(await c.json())}throw await M("Generate Auth Token",c)}async function te(e,t=!1){let n;const i=await J(e.appConfig,(i=>{if(!ie(i))throw E.create("not-registered");const a=i.authToken;if(!t&&function(e){return 2===e.requestStatus&&!function(e){const t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+36e5}(e)}(a))return i;if(1===a.requestStatus)return n=async function(e,t){let n=await ne(e.appConfig);for(;1===n.authToken.requestStatus;)await x(100),n=await ne(e.appConfig);const i=n.authToken;return 0===i.requestStatus?te(e,t):i}(e,t),i;{if(!navigator.onLine)throw E.create("app-offline");const t=function(e){const t={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},e),{authToken:t})}(i);return n=async function(e,t){try{const n=await ee(e,t),i=Object.assign(Object.assign({},t),{authToken:n});return await G(e.appConfig,i),n}catch(n){if(!P(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},t),{authToken:{requestStatus:0}});await G(e.appConfig,n)}else await z(e.appConfig);throw n}}(e,t),t}}));return n?await n:i.authToken}function ne(e){return J(e,(e=>{if(!ie(e))throw E.create("not-registered");const t=e.authToken;return 1===(n=t).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;var n}))}function ie(e){return void 0!==e&&2===e.registrationStatus}async function ae(e,t=!1){const n=e;await async function(e){const{registrationPromise:t}=await Y(e);t&&await t}(n);return(await te(n,t)).token}function re(e){return E.create("missing-app-config-values",{valueName:e})}const oe=e=>{const t=e.getProvider("app").getImmediate(),i=n(t,"installations").getImmediate();return{getId:()=>async function(e){const t=e,{installationEntry:n,registrationPromise:i}=await Y(t);return i?i.catch(console.error):te(t).catch(console.error),n.fid}(i),getToken:e=>ae(i,e)}};t(new c("installations",(e=>{const t=e.getProvider("app").getImmediate(),i=function(e){if(!e||!e.options)throw re("App Configuration");if(!e.name)throw re("App Name");const t=["projectId","apiKey","appId"];for(const n of t)if(!e.options[n])throw re(n);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t);return{app:t,appConfig:i,heartbeatServiceProvider:n(t,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),t(new c("installations-internal",oe,"PRIVATE")),e(j,"0.6.4"),e(j,"0.6.4","esm2017");const se="BDOU99-h67HcA6JeFXHbSNMu7e2yNNu3RzoMj8TM4W88jITfq7ZmPvIM1Iv-4_l2LxQcYwhqby2xGpWwzjfAnG4";var ce,ue;function de(e){const t=new Uint8Array(e);return btoa(String.fromCharCode(...t)).replace(/=/g,"").replace(/\+/g,"-").replace(/\//g,"_")}function pe(e){const t=(e+"=".repeat((4-e.length%4)%4)).replace(/\-/g,"+").replace(/_/g,"/"),n=atob(t),i=new Uint8Array(n.length);for(let e=0;e<n.length;++e)i[e]=n.charCodeAt(e);return i}!function(e){e[e.DATA_MESSAGE=1]="DATA_MESSAGE",e[e.DISPLAY_NOTIFICATION=3]="DISPLAY_NOTIFICATION"}(ce||(ce={})),function(e){e.PUSH_RECEIVED="push-received",e.NOTIFICATION_CLICKED="notification-clicked"}(ue||(ue={}));const fe="firebase-messaging-store";let le=null;function ge(){return le||(le=k("firebase-messaging-database",1,{upgrade:(e,t)=>{if(0===t)e.createObjectStore(fe)}})),le}async function we(e){const t=me(e),n=await ge(),i=await n.transaction(fe).objectStore(fe).get(t);if(i)return i;{const t=await async function(e){if("databases"in indexedDB){const e=(await indexedDB.databases()).map((e=>e.name));if(!e.includes("fcm_token_details_db"))return null}let t=null;return(await k("fcm_token_details_db",5,{upgrade:async(n,i,a,r)=>{var o;if(i<2)return;if(!n.objectStoreNames.contains("fcm_token_object_Store"))return;const s=r.objectStore("fcm_token_object_Store"),c=await s.index("fcmSenderId").get(e);if(await s.clear(),c)if(2===i){const e=c;if(!e.auth||!e.p256dh||!e.endpoint)return;t={token:e.fcmToken,createTime:null!==(o=e.createTime)&&void 0!==o?o:Date.now(),subscriptionOptions:{auth:e.auth,p256dh:e.p256dh,endpoint:e.endpoint,swScope:e.swScope,vapidKey:"string"==typeof e.vapidKey?e.vapidKey:de(e.vapidKey)}}}else if(3===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}else if(4===i){const e=c;t={token:e.fcmToken,createTime:e.createTime,subscriptionOptions:{auth:de(e.auth),p256dh:de(e.p256dh),endpoint:e.endpoint,swScope:e.swScope,vapidKey:de(e.vapidKey)}}}}})).close(),await I("fcm_token_details_db"),await I("fcm_vapid_details_db"),await I("undefined"),function(e){if(!e||!e.subscriptionOptions)return!1;const{subscriptionOptions:t}=e;return"number"==typeof e.createTime&&e.createTime>0&&"string"==typeof e.token&&e.token.length>0&&"string"==typeof t.auth&&t.auth.length>0&&"string"==typeof t.p256dh&&t.p256dh.length>0&&"string"==typeof t.endpoint&&t.endpoint.length>0&&"string"==typeof t.swScope&&t.swScope.length>0&&"string"==typeof t.vapidKey&&t.vapidKey.length>0}(t)?t:null}(e.appConfig.senderId);if(t)return await he(e,t),t}}async function he(e,t){const n=me(e),i=(await ge()).transaction(fe,"readwrite");return await i.objectStore(fe).put(t,n),await i.done,t}function me({appConfig:e}){return e.appId}const be=new r("messaging","Messaging",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"only-available-in-window":"This method is available in a Window context.","only-available-in-sw":"This method is available in a service worker context.","permission-default":"The notification permission was not granted and dismissed instead.","permission-blocked":"The notification permission was not granted and blocked instead.","unsupported-browser":"This browser doesn't support the API's required to use the Firebase SDK.","indexed-db-unsupported":"This browser doesn't support indexedDb.open() (ex. Safari iFrame, Firefox Private Browsing, etc)","failed-service-worker-registration":"We are unable to register the default service worker. {$browserErrorMessage}","token-subscribe-failed":"A problem occurred while subscribing the user to FCM: {$errorInfo}","token-subscribe-no-token":"FCM returned no token when subscribing the user to push.","token-unsubscribe-failed":"A problem occurred while unsubscribing the user from FCM: {$errorInfo}","token-update-failed":"A problem occurred while updating the user from FCM: {$errorInfo}","token-update-no-token":"FCM returned no token when updating the user to push.","use-sw-after-get-token":"The useServiceWorker() method may only be called once and must be called before calling getToken() to ensure your service worker is used.","invalid-sw-registration":"The input to useServiceWorker() must be a ServiceWorkerRegistration.","invalid-bg-handler":"The input to setBackgroundMessageHandler() must be a function.","invalid-vapid-key":"The public VAPID key must be a string.","use-vapid-key-after-get-token":"The usePublicVapidKey() method may only be called once and must be called before calling getToken() to ensure your VAPID key is used."});async function ye(e,t){const n={method:"DELETE",headers:await ke(e)};try{const i=await fetch(`${ve(e.appConfig)}/${t}`,n),a=await i.json();if(a.error){const e=a.error.message;throw be.create("token-unsubscribe-failed",{errorInfo:e})}}catch(e){throw be.create("token-unsubscribe-failed",{errorInfo:null==e?void 0:e.toString()})}}function ve({projectId:e}){return`https://fcmregistrations.googleapis.com/v1/projects/${e}/registrations`}async function ke({appConfig:e,installations:t}){const n=await t.getToken();return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e.apiKey,"x-goog-firebase-installations-auth":`FIS ${n}`})}function Ie({p256dh:e,auth:t,endpoint:n,vapidKey:i}){const a={web:{endpoint:n,auth:t,p256dh:e}};return i!==se&&(a.web.applicationPubKey=i),a}async function Se(e){const t=await async function(e,t){const n=await e.pushManager.getSubscription();if(n)return n;return e.pushManager.subscribe({userVisibleOnly:!0,applicationServerKey:pe(t)})}(e.swRegistration,e.vapidKey),n={vapidKey:e.vapidKey,swScope:e.swRegistration.scope,endpoint:t.endpoint,auth:de(t.getKey("auth")),p256dh:de(t.getKey("p256dh"))},i=await we(e.firebaseDependencies);if(i){if(function(e,t){const n=t.vapidKey===e.vapidKey,i=t.endpoint===e.endpoint,a=t.auth===e.auth,r=t.p256dh===e.p256dh;return n&&i&&a&&r}(i.subscriptionOptions,n))return Date.now()>=i.createTime+6048e5?async function(e,t){try{const n=await async function(e,t){const n=await ke(e),i=Ie(t.subscriptionOptions),a={method:"PATCH",headers:n,body:JSON.stringify(i)};let r;try{const n=await fetch(`${ve(e.appConfig)}/${t.token}`,a);r=await n.json()}catch(e){throw be.create("token-update-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw be.create("token-update-failed",{errorInfo:e})}if(!r.token)throw be.create("token-update-no-token");return r.token}(e.firebaseDependencies,t),i=Object.assign(Object.assign({},t),{token:n,createTime:Date.now()});return await he(e.firebaseDependencies,i),n}catch(t){throw await Te(e),t}}(e,{token:i.token,createTime:Date.now(),subscriptionOptions:n}):i.token;try{await ye(e.firebaseDependencies,i.token)}catch(e){console.warn(e)}return De(e.firebaseDependencies,n)}return De(e.firebaseDependencies,n)}async function Te(e){const t=await we(e.firebaseDependencies);t&&(await ye(e.firebaseDependencies,t.token),await async function(e){const t=me(e),n=(await ge()).transaction(fe,"readwrite");await n.objectStore(fe).delete(t),await n.done}(e.firebaseDependencies));const n=await e.swRegistration.pushManager.getSubscription();return!n||n.unsubscribe()}async function De(e,t){const n=await async function(e,t){const n=await ke(e),i=Ie(t),a={method:"POST",headers:n,body:JSON.stringify(i)};let r;try{const t=await fetch(ve(e.appConfig),a);r=await t.json()}catch(e){throw be.create("token-subscribe-failed",{errorInfo:null==e?void 0:e.toString()})}if(r.error){const e=r.error.message;throw be.create("token-subscribe-failed",{errorInfo:e})}if(!r.token)throw be.create("token-subscribe-no-token");return r.token}(e,t),i={token:n,createTime:Date.now(),subscriptionOptions:t};return await he(e,i),i.token}function Ce(e){const t={from:e.from,collapseKey:e.collapse_key,messageId:e.fcmMessageId};return function(e,t){if(!t.notification)return;e.notification={};const n=t.notification.title;n&&(e.notification.title=n);const i=t.notification.body;i&&(e.notification.body=i);const a=t.notification.image;a&&(e.notification.image=a);const r=t.notification.icon;r&&(e.notification.icon=r)}(t,e),function(e,t){if(!t.data)return;e.data=t.data}(t,e),function(e,t){var n,i,a,r,o;if(!t.fcmOptions&&!(null===(n=t.notification)||void 0===n?void 0:n.click_action))return;e.fcmOptions={};const s=null!==(a=null===(i=t.fcmOptions)||void 0===i?void 0:i.link)&&void 0!==a?a:null===(r=t.notification)||void 0===r?void 0:r.click_action;s&&(e.fcmOptions.link=s);const c=null===(o=t.fcmOptions)||void 0===o?void 0:o.analytics_label;c&&(e.fcmOptions.analyticsLabel=c)}(t,e),t}function je(e,t){const n=[];for(let i=0;i<e.length;i++)n.push(e.charAt(i)),i<t.length&&n.push(t.charAt(i));return n.join("")}function Ee(e){return be.create("missing-app-config-values",{valueName:e})}je("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),je("AzSCbw63g1R0nCw85jG8","Iaya3yLKwmgvh7cF0q4");class Pe{constructor(e,t,n){this.deliveryMetricsExportedToBigQueryEnabled=!1,this.onBackgroundMessageHandler=null,this.onMessageHandler=null,this.logEvents=[],this.isLogServiceStarted=!1;const i=function(e){if(!e||!e.options)throw Ee("App Configuration Object");if(!e.name)throw Ee("App Name");const t=["projectId","apiKey","appId","messagingSenderId"],{options:n}=e;for(const e of t)if(!n[e])throw Ee(e);return{appName:e.name,projectId:n.projectId,apiKey:n.apiKey,appId:n.appId,senderId:n.messagingSenderId}}(e);this.firebaseDependencies={app:e,appConfig:i,installations:t,analyticsProvider:n}}_delete(){return Promise.resolve()}}async function Oe(e){try{e.swRegistration=await navigator.serviceWorker.register("/firebase-messaging-sw.js",{scope:"/firebase-cloud-messaging-push-scope"}),e.swRegistration.update().catch((()=>{}))}catch(e){throw be.create("failed-service-worker-registration",{browserErrorMessage:null==e?void 0:e.message})}}async function _e(e,t){if(!navigator)throw be.create("only-available-in-window");if("default"===Notification.permission&&await Notification.requestPermission(),"granted"!==Notification.permission)throw be.create("permission-blocked");return await async function(e,t){t?e.vapidKey=t:e.vapidKey||(e.vapidKey=se)}(e,null==t?void 0:t.vapidKey),await async function(e,t){if(t||e.swRegistration||await Oe(e),t||!e.swRegistration){if(!(t instanceof ServiceWorkerRegistration))throw be.create("invalid-sw-registration");e.swRegistration=t}}(e,null==t?void 0:t.serviceWorkerRegistration),Se(e)}async function Me(e,t,n){const i=function(e){switch(e){case ue.NOTIFICATION_CLICKED:return"notification_open";case ue.PUSH_RECEIVED:return"notification_foreground";default:throw new Error}}(t);(await e.firebaseDependencies.analyticsProvider.get()).logEvent(i,{message_id:n["google.c.a.c_id"],message_name:n["google.c.a.c_l"],message_time:n["google.c.a.ts"],message_device_time:Math.floor(Date.now()/1e3)})}const Ae="@firebase/messaging",Ke=e=>{const t=e.getProvider("messaging").getImmediate();return{getToken:e=>_e(t,e)}};async function Ne(){try{await new Promise(((e,t)=>{try{let n=!0;const i="validate-browser-context-for-indexeddb-analytics-module",a=self.indexedDB.open(i);a.onsuccess=()=>{a.result.close(),n||self.indexedDB.deleteDatabase(i),e(!0)},a.onupgradeneeded=()=>{n=!1},a.onerror=()=>{var e;t((null===(e=a.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}}))}catch(e){return!1}return"undefined"!=typeof window&&function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&!("undefined"==typeof navigator||!navigator.cookieEnabled)&&"serviceWorker"in navigator&&"PushManager"in window&&"Notification"in window&&"fetch"in window&&ServiceWorkerRegistration.prototype.hasOwnProperty("showNotification")&&PushSubscription.prototype.hasOwnProperty("getKey")}function xe(e=i()){return Ne().then((e=>{if(!e)throw be.create("unsupported-browser")}),(e=>{throw be.create("indexed-db-unsupported")})),n(s(e),"messaging").getImmediate()}async function Be(e,t){return _e(e=s(e),t)}function $e(e){return async function(e){if(!navigator)throw be.create("only-available-in-window");return e.swRegistration||await Oe(e),Te(e)}(e=s(e))}function Le(e,t){return function(e,t){if(!navigator)throw be.create("only-available-in-window");return e.onMessageHandler=t,()=>{e.onMessageHandler=null}}(e=s(e),t)}t(new c("messaging",(e=>{const t=new Pe(e.getProvider("app").getImmediate(),e.getProvider("installations-internal").getImmediate(),e.getProvider("analytics-internal"));return navigator.serviceWorker.addEventListener("message",(e=>async function(e,t){const n=t.data;if(!n.isFirebaseMessaging)return;e.onMessageHandler&&n.messageType===ue.PUSH_RECEIVED&&("function"==typeof e.onMessageHandler?e.onMessageHandler(Ce(n)):e.onMessageHandler.next(Ce(n)));const i=n.data;var a;"object"==typeof(a=i)&&a&&"google.c.a.c_id"in a&&"1"===i["google.c.a.e"]&&await Me(e,n.messageType,i)}(t,e))),t}),"PUBLIC")),t(new c("messaging-internal",Ke,"PRIVATE")),e(Ae,"0.12.4"),e(Ae,"0.12.4","esm2017");export{$e as deleteToken,xe as getMessaging,Be as getToken,Ne as isSupported,Le as onMessage};
|
|
2
2
|
|
|
3
3
|
//# sourceMappingURL=firebase-messaging.js.map
|
|
@@ -194,7 +194,7 @@ class c{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Pr
|
|
|
194
194
|
* See the License for the specific language governing permissions and
|
|
195
195
|
* limitations under the License.
|
|
196
196
|
*/
|
|
197
|
-
class q{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const W="@firebase/app",K="0.9.
|
|
197
|
+
class q{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const W="@firebase/app",K="0.9.5",J=new A("@firebase/app"),G="[DEFAULT]",Y={[W]:"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","fire-js":"fire-js",firebase:"fire-js-all"},X=new Map,Z=new Map;function Q(e,t){try{e.container.addComponent(t)}catch(n){J.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function ee(e){const t=e.name;if(Z.has(t))return J.debug(`There were multiple attempts to register component ${t}.`),!1;Z.set(t,e);for(const t of X.values())Q(t,e);return!0}function te(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}
|
|
198
198
|
/**
|
|
199
199
|
* @license
|
|
200
200
|
* Copyright 2019 Google LLC
|
|
@@ -244,7 +244,7 @@ class re{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e)
|
|
|
244
244
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
245
245
|
* See the License for the specific language governing permissions and
|
|
246
246
|
* limitations under the License.
|
|
247
|
-
*/const ie="9.
|
|
247
|
+
*/const ie="9.18.0";function ae(e,t={}){let n=e;if("object"!=typeof t){t={name:t}}const r=Object.assign({name:G,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw ne.create("bad-app-name",{appName:String(i)});var a;if(n||(n=null===(a=s())||void 0===a?void 0:a.config),!n)throw ne.create("no-options");const o=X.get(i);if(o){if(g(n,o.options)&&g(r,o.config))return o;throw ne.create("duplicate-app",{appName:i})}const c=new w(i);for(const e of Z.values())c.addComponent(e);const l=new re(n,r,c);return X.set(i,l),l}async function oe(e){const t=e.name;X.has(t)&&(X.delete(t),await Promise.all(e.container.getProviders().map((e=>e.delete()))),e.isDeleted=!0)}function se(e,t,n){var r;let i=null!==(r=Y[e])&&void 0!==r?r:e;n&&(i+=`-${n}`);const a=i.match(/\s|\//),o=t.match(/\s|\//);if(a||o){const e=[`Unable to register library "${i}" with version "${t}":`];return a&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),a&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void J.warn(e.join(" "))}ee(new b(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}function ce(e,t){if(null!==e&&"function"!=typeof e)throw ne.create("invalid-log-argument");!function(e,t){for(const n of E){let r=null;t&&t.level&&(r=I[t.level]),n.userLogHandler=null===e?null:(t,n,...i)=>{const a=i.map((e=>{if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}})).filter((e=>e)).join(" ");n>=(null!=r?r:t.logLevel)&&e({level:y[n].toLowerCase(),message:a,args:i,type:t.name})}}}(e,t)}function le(e){var t;t=e,E.forEach((e=>{e.setLogLevel(t)}))}
|
|
248
248
|
/**
|
|
249
249
|
* @license
|
|
250
250
|
* Copyright 2021 Google LLC
|
|
@@ -391,7 +391,7 @@ const Se=function(){const e=Ie(Ee);e.SDK_VERSION=`${e.SDK_VERSION}_LITE`;const t
|
|
|
391
391
|
* See the License for the specific language governing permissions and
|
|
392
392
|
* limitations under the License.
|
|
393
393
|
*/
|
|
394
|
-
function(e){se("@firebase/app-compat","0.2.
|
|
394
|
+
function(e){se("@firebase/app-compat","0.2.5",e)}("lite");
|
|
395
395
|
/**
|
|
396
396
|
* @license
|
|
397
397
|
* Copyright 2020 Google LLC
|
|
@@ -408,7 +408,7 @@ function(e){se("@firebase/app-compat","0.2.4",e)}("lite");
|
|
|
408
408
|
* See the License for the specific language governing permissions and
|
|
409
409
|
* limitations under the License.
|
|
410
410
|
*/
|
|
411
|
-
Se.registerVersion("firebase","9.
|
|
411
|
+
Se.registerVersion("firebase","9.18.0","app-compat");const Te="@firebase/installations",Ce="0.6.4",Ae=1e4,De="w:0.6.4",Ne="FIS_v2",Oe=36e5,ke=new h("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function Le(e){return e instanceof p&&e.code.includes("request-failed")}
|
|
412
412
|
/**
|
|
413
413
|
* @license
|
|
414
414
|
* Copyright 2019 Google LLC
|
|
@@ -948,5 +948,5 @@ var mn;(mn=Se).INTERNAL.registerComponent(new b("performance-compat",gn,"PUBLIC"
|
|
|
948
948
|
* See the License for the specific language governing permissions and
|
|
949
949
|
* limitations under the License.
|
|
950
950
|
*/
|
|
951
|
-
return Se.registerVersion("firebase","9.
|
|
951
|
+
return Se.registerVersion("firebase","9.18.0","compat-lite"),Se}));
|
|
952
952
|
//# sourceMappingURL=firebase-performance-standalone-compat.es2017.js.map
|