!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?t(require("@firebase/app")):"function"==typeof define&&define.amd?define(["@firebase/app"],t):t((e="undefined"!=typeof globalThis?globalThis:e||self).firebase)}(this,function(bt){"use strict";try{(function(){function e(e){return e&&"object"==typeof e&&"default"in e?e:{default:e}}var t=e(bt),n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};var c=function(){return(c=Object.assign||function(e){for(var t,n=1,r=arguments.length;na[0]&&t[1]=e.length&&(e=void 0),{value:e&&e[r++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function r(){for(var e=[],t=0;t"})):"Error",e=this.serviceName+": "+e+" ("+o+").";return new g(o,e,i)},w);function w(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var I=/\{\$([^}]+)}/g,_=1e3,E=2,T=144e5,S=.5;function C(e,t,n){void 0===t&&(t=_),void 0===n&&(n=E);n=t*Math.pow(n,e),e=Math.round(S*n*(Math.random()-.5)*2);return Math.min(T,n+e)}var O=(N.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},N.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},N.prototype.setServiceProps=function(e){return this.serviceProps=e,this},N);function N(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}function D(n){return new Promise(function(e,t){n.onsuccess=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function P(n,r,i){var o,e=new Promise(function(e,t){D(o=n[r].apply(n,i)).then(e,t)});return e.request=o,e}function A(e,n,t){t.forEach(function(t){Object.defineProperty(e.prototype,t,{get:function(){return this[n][t]},set:function(e){this[n][t]=e}})})}function x(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return P(this[n],e,arguments)})})}function k(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return this[n][e].apply(this[n],arguments)})})}function j(e,r,t,n){n.forEach(function(n){n in t.prototype&&(e.prototype[n]=function(){return e=this[r],(t=P(e,n,arguments)).then(function(e){if(e)return new R(e,t.request)});var e,t})})}function L(e){this._index=e}function R(e,t){this._cursor=e,this._request=t}function F(e){this._store=e}function M(n){this._tx=n,this.complete=new Promise(function(e,t){n.oncomplete=function(){e()},n.onerror=function(){t(n.error)},n.onabort=function(){t(n.error)}})}function B(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new M(n)}function H(e){this._db=e}A(L,"_index",["name","keyPath","multiEntry","unique"]),x(L,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),j(L,"_index",IDBIndex,["openCursor","openKeyCursor"]),A(R,"_cursor",["direction","key","primaryKey","value"]),x(R,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(R.prototype[n]=function(){var t=this,e=arguments;return Promise.resolve().then(function(){return t._cursor[n].apply(t._cursor,e),D(t._request).then(function(e){if(e)return new R(e,t._request)})})})}),F.prototype.createIndex=function(){return new L(this._store.createIndex.apply(this._store,arguments))},F.prototype.index=function(){return new L(this._store.index.apply(this._store,arguments))},A(F,"_store",["name","keyPath","indexNames","autoIncrement"]),x(F,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),j(F,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),k(F,"_store",IDBObjectStore,["deleteIndex"]),M.prototype.objectStore=function(){return new F(this._tx.objectStore.apply(this._tx,arguments))},A(M,"_tx",["objectStoreNames","mode"]),k(M,"_tx",IDBTransaction,["abort"]),B.prototype.createObjectStore=function(){return new F(this._db.createObjectStore.apply(this._db,arguments))},A(B,"_db",["name","version","objectStoreNames"]),k(B,"_db",IDBDatabase,["deleteObjectStore","close"]),H.prototype.transaction=function(){return new M(this._db.transaction.apply(this._db,arguments))},A(H,"_db",["name","version","objectStoreNames"]),k(H,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(i){[F,L].forEach(function(e){i in e.prototype&&(e.prototype[i.replace("open","iterate")]=function(){var e=(n=arguments,Array.prototype.slice.call(n)),t=e[e.length-1],n=this._store||this._index,r=n[i].apply(n,e.slice(0,-1));r.onsuccess=function(){t(r.result)}})})}),[L,F].forEach(function(e){e.prototype.getAll||(e.prototype.getAll=function(e,n){var r=this,i=[];return new Promise(function(t){r.iterateCursor(e,function(e){e?(i.push(e.value),void 0===n||i.length!=n?e.continue():t(i)):t(i)})})})});var q="0.4.19",V=1e4,G="w:"+q,K="FIS_v2",U="https://firebaseinstallations.googleapis.com/v1",W=36e5,$=((Be={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',Be["not-registered"]="Firebase Installation is not registered.",Be["installation-not-found"]="Firebase Installation not found.",Be["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',Be["app-offline"]="Could not process request. Application offline.",Be["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",Be),z=new b("installations","Installations",$);function J(e){return e instanceof g&&e.code.includes("request-failed")}function Y(e){e=e.projectId;return U+"/projects/"+e+"/installations"}function X(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}function Z(n,r){return h(this,void 0,void 0,function(){var t;return v(this,function(e){switch(e.label){case 0:return[4,r.json()];case 1:return t=e.sent(),t=t.error,[2,z.create("request-failed",{requestName:n,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function Q(e){e=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function ee(e,t){t=t.refreshToken,e=Q(e);return e.append("Authorization",K+" "+t),e}function te(n){return h(this,void 0,void 0,function(){var t;return v(this,function(e){switch(e.label){case 0:return[4,n()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,n()]:[2,t]}})})}function ne(t){return new Promise(function(e){setTimeout(e,t)})}var re=/^[cdef][\w-]{21}$/,ie="";function oe(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;e=function(e){return btoa(String.fromCharCode.apply(String,r(e))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22);return re.test(e)?e:ie}catch(e){return ie}}function ae(e){return e.appName+"!"+e.appId}var se=new Map;function ue(e,t){e=ae(e);ce(e,t),function(e,t){var n=fe();n&&n.postMessage({key:e,fid:t});de()}(e,t)}function ce(e,t){var n,r,i=se.get(e);if(i)try{for(var o=s(i),a=o.next();!a.done;a=o.next()){(0,a.value)(t)}}catch(e){n={error:e}}finally{try{a&&!a.done&&(r=o.return)&&r.call(o)}finally{if(n)throw n.error}}}var le=null;function fe(){return!le&&"BroadcastChannel"in self&&((le=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){ce(e.data.key,e.data.fid)}),le}function de(){0===se.size&&le&&(le.close(),le=null)}var pe,he,ve="firebase-installations-database",ge=1,me="firebase-installations-store",ye=null;function be(){var e,t,n;return ye||(e=ge,t=function(e){0===e.oldVersion&&e.createObjectStore(me)},(n=(e=P(indexedDB,"open",[ve,e])).request)&&(n.onupgradeneeded=function(e){t&&t(new B(n.result,e.oldVersion,n.transaction))}),ye=e.then(function(e){return new H(e)})),ye}function we(o,a){return h(this,void 0,void 0,function(){var t,n,r,i;return v(this,function(e){switch(e.label){case 0:return t=ae(o),[4,be()];case 1:return r=e.sent(),n=r.transaction(me,"readwrite"),[4,(r=n.objectStore(me)).get(t)];case 2:return i=e.sent(),[4,r.put(a,t)];case 3:return e.sent(),[4,n.complete];case 4:return e.sent(),i&&i.fid===a.fid||ue(o,a.fid),[2,a]}})})}function Ie(r){return h(this,void 0,void 0,function(){var t,n;return v(this,function(e){switch(e.label){case 0:return t=ae(r),[4,be()];case 1:return n=e.sent(),[4,(n=n.transaction(me,"readwrite")).objectStore(me).delete(t)];case 2:return e.sent(),[4,n.complete];case 3:return e.sent(),[2]}})})}function _e(a,s){return h(this,void 0,void 0,function(){var t,n,r,i,o;return v(this,function(e){switch(e.label){case 0:return t=ae(a),[4,be()];case 1:return r=e.sent(),n=r.transaction(me,"readwrite"),[4,(r=n.objectStore(me)).get(t)];case 2:return i=e.sent(),void 0!==(o=s(i))?[3,4]:[4,r.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,r.put(o,t)];case 5:e.sent(),e.label=6;case 6:return[4,n.complete];case 7:return e.sent(),!o||i&&i.fid===o.fid||ue(a,o.fid),[2,o]}})})}function Ee(i){return h(this,void 0,void 0,function(){var t,n,r;return v(this,function(e){switch(e.label){case 0:return[4,_e(i,function(e){e=Se(e||{fid:oe(),registrationStatus:0}),e=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return h(this,void 0,void 0,function(){var t,n,r;return v(this,function(e){switch(e.label){case 0:return[4,Te(i)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,ne(100)];case 3:return e.sent(),[4,Te(i)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,Ee(i)];case 6:return r=e.sent(),n=r.installationEntry,(r=r.registrationPromise)?[2,r]:[2,n];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(z.create("app-offline"));return{installationEntry:t,registrationPromise:n}}t={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},e=function(r,i){return h(this,void 0,void 0,function(){var t,n;return v(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(a,e){var s=e.fid;return h(this,void 0,void 0,function(){var t,n,r,i,o;return v(this,function(e){switch(e.label){case 0:return t=Y(a),n=Q(a),o={fid:s,authVersion:K,appId:a.appId,sdkVersion:G},r={method:"POST",headers:n,body:JSON.stringify(o)},[4,te(function(){return fetch(t,r)})];case 1:return(i=e.sent()).ok?[4,i.json()]:[3,3];case 2:return o=e.sent(),[2,{fid:o.fid||s,registrationStatus:2,refreshToken:o.refreshToken,authToken:X(o.authToken)}];case 3:return[4,Z("Create Installation",i)];case 4:throw e.sent()}})})}(r,i)];case 1:return t=e.sent(),[2,we(r,t)];case 2:return J(n=e.sent())&&409===n.customData.serverCode?[4,Ie(r)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,we(r,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw n;case 7:return[2]}})})}(e,t);return{installationEntry:t,registrationPromise:e}}}(i,e);return t=e.registrationPromise,e.installationEntry})];case 1:return(n=e.sent()).fid!==ie?[3,3]:(r={},[4,t]);case 2:return[2,(r.installationEntry=e.sent(),r)];case 3:return[2,{installationEntry:n,registrationPromise:t}]}})})}function Te(e){return _e(e,function(e){if(!e)throw z.create("installation-not-found");return Se(e)})}function Se(e){return 1===(t=e).registrationStatus&&t.registrationTime+V