firebase
Version:
Firebase JavaScript library for web and Node.js
1 lines • 64 kB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};var f=function(){return(f=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function p(e,a,s,c){return new(s=s||Promise)(function(r,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function i(e){try{o(c.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,i)}o((c=c.apply(e,a||[])).next())})}function h(r,n){var i,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function g(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function a(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},i={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:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[],i=0;i<e.length;i+=3){var o=e[i],a=i+1<e.length,s=a?e[i+1]:0,c=i+2<e.length,u=c?e[i+2]:0,l=(15&s)<<2|u>>6,u=63&u;c||(u=64,a||(l=64)),n.push(r[o>>2],r[(3&o)<<4|s>>4],r[l],r[u])}return n.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],r=0,n=0;r<e.length;){var i,o,a,s=e[r++];s<128?t[n++]=String.fromCharCode(s):191<s&&s<224?(o=e[r++],t[n++]=String.fromCharCode((31&s)<<6|63&o)):239<s&&s<365?(i=((7&s)<<18|(63&(o=e[r++]))<<12|(63&(a=e[r++]))<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))):(o=e[r++],a=e[r++],t[n++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[],i=0;i<e.length;){var o=r[e.charAt(i++)],a=i<e.length?r[e.charAt(i)]:0,s=++i<e.length?r[e.charAt(i)]:64,c=++i<e.length?r[e.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==c)throw Error();n.push(o<<2|a>>4),64!==s&&(n.push(a<<4&240|s>>2),64!==c&&n.push(s<<6&192|c))}return n},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},o=function(e){return t=r(e),i.encodeByteArray(t,!0).replace(/\./g,"");var t};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var r in t)t.hasOwnProperty(r)&&"__proto__"!==r&&(e[r]=c(e[r],t[r]));return e}var s=(e.prototype.wrapCallback=function(r){var n=this;return function(e,t){e?n.reject(e):n.resolve(t),"function"==typeof r&&(n.promise.catch(function(){}),1===r.length?r(e):r(e,t))}},e);function e(){var r=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){r.resolve=e,r.reject=t})}function t(){return"object"==typeof indexedDB}function u(){return new Promise(function(e,t){try{var r=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=function(){i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=function(){r=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}var l,v=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(m,l=Error),m);function m(e,t,r){var n=l.call(this,t)||this;return n.code=e,n.customData=r,n.name="FirebaseError",Object.setPrototypeOf(n,m.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,b.prototype.create),n}var b=(y.prototype.create=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n,i=t[0]||{},o=this.service+"/"+e,a=this.errors[e],a=a?(n=i,a.replace(_,function(e,t){var r=n[t];return null!=r?String(r):"<"+t+"?>"})):"Error",a=this.serviceName+": "+a+" ("+o+").";return new v(o,a,i)},y);function y(e,t,r){this.service=e,this.serviceName=t,this.errors=r}var _=/\{\$([^}]+)}/g;function w(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function E(e,t){if(e===t)return 1;for(var r=Object.keys(e),n=Object.keys(t),i=0,o=r;i<o.length;i++){var a=o[i];if(!n.includes(a))return;var s=e[a],c=t[a];if(I(s)&&I(c)){if(!E(s,c))return}else if(s!==c)return}for(var u=0,l=n;u<l.length;u++){a=l[u];if(!r.includes(a))return}return 1}function I(e){return null!==e&&"object"==typeof e}function S(e,t){var r=new C(e,t);return r.subscribe.bind(r)}var C=(T.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},T.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},T.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},T.prototype.subscribe=function(e,t,r){var n,i=this;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");void 0===(n=function(e,t){if("object"!=typeof e||null===e)return!1;for(var r=0,n=t;r<n.length;r++){var i=n[r];if(i in e&&"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&&(n.next=O),void 0===n.error&&(n.error=O),void 0===n.complete&&(n.complete=O);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?n.error(i.finalError):n.complete()}catch(e){}}),this.observers.push(n),o},T.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},T.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},T.prototype.sendOne=function(e,t){var r=this;this.task.then(function(){if(void 0!==r.observers&&void 0!==r.observers[e])try{t(r.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},T.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},T);function T(e,t){var r=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(r)}).catch(function(e){r.error(e)})}function O(){}function A(e,n){return new Promise(function(t,r){e.onsuccess=function(e){t(e.target.result)},e.onerror=function(e){var t;r(n+": "+(null===(t=e.target.error)||void 0===t?void 0:t.message))}})}var N=(P.prototype.transaction=function(e,t){return new D(this._db.transaction.call(this._db,e,t=void 0===t?"readonly":t))},P.prototype.createObjectStore=function(e,t){return new M(this._db.createObjectStore(e,t))},P.prototype.close=function(){this._db.close()},P);function P(e){this._db=e,this.objectStoreNames=this._db.objectStoreNames}var D=(k.prototype.objectStore=function(e){return new M(this._transaction.objectStore(e))},k);function k(e){var r=this;this._transaction=e,this.complete=new Promise(function(e,t){r._transaction.oncomplete=function(){e()},r._transaction.onerror=function(){t(r._transaction.error)},r._transaction.onabort=function(){t(r._transaction.error)}})}var M=(L.prototype.index=function(e){return new j(this._store.index(e))},L.prototype.createIndex=function(e,t,r){return new j(this._store.createIndex(e,t,r))},L.prototype.get=function(e){return A(this._store.get(e),"Error reading from IndexedDB")},L.prototype.put=function(e,t){return A(this._store.put(e,t),"Error writing to IndexedDB")},L.prototype.delete=function(e){return A(this._store.delete(e),"Error deleting from IndexedDB")},L.prototype.clear=function(){return A(this._store.clear(),"Error clearing IndexedDB object store")},L);function L(e){this._store=e}var j=(B.prototype.get=function(e){return A(this._index.get(e),"Error reading from IndexedDB")},B);function B(e){this._index=e}function R(e,i,o){return new Promise(function(t,r){try{var n=indexedDB.open(e,i);n.onsuccess=function(e){t(new N(e.target.result))},n.onerror=function(e){var t;r("Error opening indexedDB: "+(null===(t=e.target.error)||void 0===t?void 0:t.message))},n.onupgradeneeded=function(e){o(new N(n.result),e.oldVersion,e.newVersion,new D(n.transaction))}}catch(e){r("Error opening indexedDB: "+e.message)}})}var x=(F.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},F.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},F.prototype.setServiceProps=function(e){return this.serviceProps=e,this},F.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},F);function F(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}var U="[DEFAULT]",H=(z.prototype.get=function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var r=new s;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{var n=this.getOrInitializeService({instanceIdentifier:t});n&&r.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise},z.prototype.getImmediate=function(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(r=null==e?void 0:e.optional)&&void 0!==r&&r;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service "+this.name+" is not available")}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}},z.prototype.getComponent=function(){return this.component},z.prototype.setComponent=function(e){var t,r;if(e.name!==this.name)throw Error("Mismatching Component "+e.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:U})}catch(e){}try{for(var n=d(this.instancesDeferred.entries()),i=n.next();!i.done;i=n.next()){var o=g(i.value,2),a=o[0],s=o[1],c=this.normalizeInstanceIdentifier(a);try{var u=this.getOrInitializeService({instanceIdentifier:c});s.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}},z.prototype.clearInstance=function(e){this.instancesDeferred.delete(e=void 0===e?U:e),this.instancesOptions.delete(e),this.instances.delete(e)},z.prototype.delete=function(){return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(a(a([],g(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()}))),g(t.filter(function(e){return"_delete"in e}).map(function(e){return e._delete()}))))];case 1:return e.sent(),[2]}})})},z.prototype.isComponentSet=function(){return null!=this.component},z.prototype.isInitialized=function(e){return this.instances.has(e=void 0===e?U:e)},z.prototype.getOptions=function(e){return this.instancesOptions.get(e=void 0===e?U:e)||{}},z.prototype.initialize=function(e){var t,r,n=(e=void 0===e?{}:e).options,n=void 0===n?{}:n,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(this.name+"("+i+") has already been initialized");if(!this.isComponentSet())throw Error("Component "+this.name+" has not been registered yet");var o=this.getOrInitializeService({instanceIdentifier:i,options:n});try{for(var a=d(this.instancesDeferred.entries()),s=a.next();!s.done;s=a.next()){var c=g(s.value,2),u=c[0],l=c[1];i===this.normalizeInstanceIdentifier(u)&&l.resolve(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},z.prototype.onInit=function(e,t){var r=this.normalizeInstanceIdentifier(t),n=null!==(i=this.onInitCallbacks.get(r))&&void 0!==i?i:new Set;n.add(e),this.onInitCallbacks.set(r,n);var i=this.instances.get(r);return i&&e(i,r),function(){n.delete(e)}},z.prototype.invokeOnInitCallbacks=function(e,t){var r,n,i=this.onInitCallbacks.get(t);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next()){var s=a.value;try{s(e,t)}catch(e){}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},z.prototype.getOrInitializeService=function(e){var t=e.instanceIdentifier,r=e.options,n=void 0===r?{}:r,r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(e=t)===U?void 0:e,options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch(e){}return r||null},z.prototype.normalizeInstanceIdentifier=function(e){return void 0===e&&(e=U),!this.component||this.component.multipleInstances?e:U},z.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},z);function z(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}var V=(q.prototype.addComponent=function(e){var t=this.getProvider(e.name);if(t.isComponentSet())throw new Error("Component "+e.name+" has already been registered with "+this.name);t.setComponent(e)},q.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},q.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new H(e,this);return this.providers.set(e,t),t},q.prototype.getProviders=function(){return Array.from(this.providers.values())},q);function q(e){this.name=e,this.providers=new Map}var W,$=[];(Wt=W=W||{})[Wt.DEBUG=0]="DEBUG",Wt[Wt.VERBOSE=1]="VERBOSE",Wt[Wt.INFO=2]="INFO",Wt[Wt.WARN=3]="WARN",Wt[Wt.ERROR=4]="ERROR",Wt[Wt.SILENT=5]="SILENT";function K(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!(t<e.logLevel)){var i=(new Date).toISOString(),o=Y[t];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[o].apply(console,a(["["+i+"] "+e.name+":"],r))}}var J={debug:W.DEBUG,verbose:W.VERBOSE,info:W.INFO,warn:W.WARN,error:W.ERROR,silent:W.SILENT},G=W.INFO,Y=((He={})[W.DEBUG]="log",He[W.VERBOSE]="log",He[W.INFO]="info",He[W.WARN]="warn",He[W.ERROR]="error",He),X=(Object.defineProperty(Z.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in W))throw new TypeError('Invalid value "'+e+'" assigned to `logLevel`');this._logLevel=e},enumerable:!1,configurable:!0}),Z.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?J[e]:e},Object.defineProperty(Z.prototype,"logHandler",{get:function(){return this._logHandler},set:function(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e},enumerable:!1,configurable:!0}),Object.defineProperty(Z.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),Z.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,W.DEBUG],e)),this._logHandler.apply(this,a([this,W.DEBUG],e))},Z.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,W.VERBOSE],e)),this._logHandler.apply(this,a([this,W.VERBOSE],e))},Z.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,W.INFO],e)),this._logHandler.apply(this,a([this,W.INFO],e))},Z.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,W.WARN],e)),this._logHandler.apply(this,a([this,W.WARN],e))},Z.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,W.ERROR],e)),this._logHandler.apply(this,a([this,W.ERROR],e))},Z);function Z(e){this.name=e,this._logLevel=G,this._logHandler=K,this._userLogHandler=null,$.push(this)}function Q(a,t){for(var e=0,r=$;e<r.length;e++)!function(e){var o=null;t&&t.level&&(o=J[t.level]),e.userLogHandler=null===a?null:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=r.map(function(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(function(e){return e}).join(" ");t>=(null!=o?o:e.logLevel)&&a({level:W[t].toLowerCase(),message:i,args:r,type:e.name})}}(r[e])}var ee=(te.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(e){if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return t.library+"/"+t.version}).filter(function(e){return e}).join(" ")},te);function te(e){this.container=e}var re="@firebase/app",ne=new X("@firebase/app"),ie="[DEFAULT]",oe=((pe={})[re]="fire-core",pe["@firebase/app-compat"]="fire-core-compat",pe["@firebase/analytics"]="fire-analytics",pe["@firebase/analytics-compat"]="fire-analytics-compat",pe["@firebase/app-check"]="fire-app-check",pe["@firebase/app-check-compat"]="fire-app-check-compat",pe["@firebase/auth"]="fire-auth",pe["@firebase/auth-compat"]="fire-auth-compat",pe["@firebase/database"]="fire-rtdb",pe["@firebase/database-compat"]="fire-rtdb-compat",pe["@firebase/functions"]="fire-fn",pe["@firebase/functions-compat"]="fire-fn-compat",pe["@firebase/installations"]="fire-iid",pe["@firebase/installations-compat"]="fire-iid-compat",pe["@firebase/messaging"]="fire-fcm",pe["@firebase/messaging-compat"]="fire-fcm-compat",pe["@firebase/performance"]="fire-perf",pe["@firebase/performance-compat"]="fire-perf-compat",pe["@firebase/remote-config"]="fire-rc",pe["@firebase/remote-config-compat"]="fire-rc-compat",pe["@firebase/storage"]="fire-gcs",pe["@firebase/storage-compat"]="fire-gcs-compat",pe["@firebase/firestore"]="fire-fst",pe["@firebase/firestore-compat"]="fire-fst-compat",pe["fire-js"]="fire-js",pe.firebase="fire-js-all",pe),ae=new Map,se=new Map;function ce(t,r){try{t.container.addComponent(r)}catch(e){ne.debug("Component "+r.name+" failed to register with FirebaseApp "+t.name,e)}}function ue(e,t){e.container.addOrOverwriteComponent(t)}function le(e){var t,r,n=e.name;if(se.has(n))return ne.debug("There were multiple attempts to register component "+n+"."),!1;se.set(n,e);try{for(var i=d(ae.values()),o=i.next();!o.done;o=i.next())ce(o.value,e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!0}function fe(e,t){var r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}var pe=((He={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",He["bad-app-name"]="Illegal App name: '{$appName}",He["duplicate-app"]="Firebase App named '{$appName}' already exists with different options or config",He["app-deleted"]="Firebase App named '{$appName}' already deleted",He["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",He["invalid-log-argument"]="First argument to `onLog` must be null or a function.",He["storage-open"]="Error thrown when opening storage. Original error: {$originalErrorMessage}.",He["storage-get"]="Error thrown when reading from storage. Original error: {$originalErrorMessage}.",He["storage-set"]="Error thrown when writing to storage. Original error: {$originalErrorMessage}.",He["storage-delete"]="Error thrown when deleting from storage. Original error: {$originalErrorMessage}.",He),he=new b("app","Firebase",pe),de=(Object.defineProperty(ge.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"name",{get:function(){return this.checkDestroyed(),this._name},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"options",{get:function(){return this.checkDestroyed(),this._options},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"config",{get:function(){return this.checkDestroyed(),this._config},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(ge.prototype,"isDeleted",{get:function(){return this._isDeleted},set:function(e){this._isDeleted=e},enumerable:!1,configurable:!0}),ge.prototype.checkDestroyed=function(){if(this.isDeleted)throw he.create("app-deleted",{appName:this._name})},ge);function ge(e,t,r){var n=this;this._isDeleted=!1,this._options=f({},e),this._config=f({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new x("app",function(){return n},"PUBLIC"))}var ve="9.7.0";function me(e,t){var r,n,i=f({name:ie,automaticDataCollectionEnabled:!1},t="object"!=typeof(t=void 0===t?{}:t)?{name:t}:t),o=i.name;if("string"!=typeof o||!o)throw he.create("bad-app-name",{appName:String(o)});var a=ae.get(o);if(a){if(E(e,a.options)&&E(i,a.config))return a;throw he.create("duplicate-app",{appName:o})}var s=new V(o);try{for(var c=d(se.values()),u=c.next();!u.done;u=c.next()){var l=u.value;s.addComponent(l)}}catch(e){r={error:e}}finally{try{u&&!u.done&&(n=c.return)&&n.call(c)}finally{if(r)throw r.error}}i=new de(e,i,s);return ae.set(o,i),i}function be(r){return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return(t=r.name,ae.has(t))?(ae.delete(t),[4,Promise.all(r.container.getProviders().map(function(e){return e.delete()}))]):[3,2];case 1:e.sent(),r.isDeleted=!0,e.label=2;case 2:return[2]}})})}function ye(e,t,r){var n=null!==(a=oe[e])&&void 0!==a?a:e;r&&(n+="-"+r);var i=n.match(/\s|\//),o=t.match(/\s|\//);if(i||o){var a=['Unable to register library "'+n+'" with version "'+t+'":'];return i&&a.push('library name "'+n+'" contains illegal characters (whitespace or "/")'),i&&o&&a.push("and"),o&&a.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void ne.warn(a.join(" "))}le(new x(n+"-version",function(){return{library:n,version:t}},"VERSION"))}function _e(e,t){if(null!==e&&"function"!=typeof e)throw he.create("invalid-log-argument");Q(e,t)}function we(e){var t;t=e,$.forEach(function(e){e.setLogLevel(t)})}var Ee="firebase-heartbeat-database",Ie=1,Se="firebase-heartbeat-store",Ce=null;function Te(){return Ce=Ce||R(Ee,Ie,function(e,t){0===t&&e.createObjectStore(Se)}).catch(function(e){throw he.create("storage-open",{originalErrorMessage:e.message})})}function Oe(n,i){return p(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,Te()];case 1:return r=e.sent(),t=r.transaction(Se,"readwrite"),[4,t.objectStore(Se).put(i,Ae(n))];case 2:return e.sent(),[2,t.complete];case 3:throw r=e.sent(),he.create("storage-set",{originalErrorMessage:r.message});case 4:return[2]}})})}function Ae(e){return e.name+"!"+e.options.appId}var Ne=(Pe.prototype.triggerHeartbeat=function(){return p(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return(t=this.container.getProvider("platform-logger").getImmediate(),t=t.getPlatformInfoString(),r=De(),null!==this._heartbeatsCache)?[3,2]:[4,(n=this)._heartbeatsCachePromise];case 1:n._heartbeatsCache=e.sent(),e.label=2;case 2:return this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(function(e){return e.date===r})?[2]:(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),[2,this._storage.overwrite(this._heartbeatsCache)])}})})},Pe.prototype.getHeartbeatsHeader=function(){return p(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return null!==this._heartbeatsCache?[3,2]:[4,this._heartbeatsCachePromise];case 1:e.sent(),e.label=2;case 2:return null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length?[2,""]:(t=De(),r=function(e,r){var t,n;void 0===r&&(r=1024);var i=[],o=e.slice();try{for(var a=d(e),s=a.next();!s.done;s=a.next())if("break"===function(t){var e=i.find(function(e){return e.agent===t.agent});if(e){if(e.dates.push(t.date),je(i)>r)return e.dates.pop(),"break"}else if(i.push({agent:t.agent,dates:[t.date]}),je(i)>r)return i.pop(),"break";o=o.slice(1)}(s.value))break}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return{heartbeatsToSend:i,unsentEntries:o}}(this._heartbeatsCache.heartbeats),n=r.heartbeatsToSend,r=r.unsentEntries,n=o(JSON.stringify({version:2,heartbeats:n})),this._heartbeatsCache.lastSentHeartbeatDate=t,0<r.length?(this._heartbeatsCache.heartbeats=r,[4,this._storage.overwrite(this._heartbeatsCache)]):[3,4]);case 3:return e.sent(),[3,5];case 4:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache),e.label=5;case 5:return[2,n]}})})},Pe);function Pe(e){var t=this;this.container=e,this._heartbeatsCache=null;var r=this.container.getProvider("app").getImmediate();this._storage=new Me(r),this._heartbeatsCachePromise=this._storage.read().then(function(e){return t._heartbeatsCache=e})}function De(){return(new Date).toISOString().substring(0,10)}var ke,Me=(Le.prototype.runIndexedDBEnvironmentCheck=function(){return p(this,void 0,void 0,function(){return h(this,function(e){return t()?[2,u().then(function(){return!0}).catch(function(){return!1})]:[2,!1]})})},Le.prototype.read=function(){return p(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2,{heartbeats:[]}];case 2:return[4,function(r){return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,Te()];case 1:return[2,e.sent().transaction(Se).objectStore(Se).get(Ae(r))];case 2:throw t=e.sent(),he.create("storage-get",{originalErrorMessage:t.message});case 3:return[2]}})})}(this.app)];case 3:return[2,e.sent()||{heartbeats:[]}]}})})},Le.prototype.overwrite=function(r){var n;return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,Oe(this.app,{lastSentHeartbeatDate:null!==(n=r.lastSentHeartbeatDate)&&void 0!==n?n:t.lastSentHeartbeatDate,heartbeats:r.heartbeats})]}})})},Le.prototype.add=function(r){var n;return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,Oe(this.app,{lastSentHeartbeatDate:null!==(n=r.lastSentHeartbeatDate)&&void 0!==n?n:t.lastSentHeartbeatDate,heartbeats:a(a([],g(t.heartbeats)),g(r.heartbeats))})]}})})},Le);function Le(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}function je(e){return o(JSON.stringify({version:2,heartbeats:e})).length}ke="",le(new x("platform-logger",function(e){return new ee(e)},"PRIVATE")),le(new x("heartbeat",function(e){return new Ne(e)},"PRIVATE")),ye(re,"0.7.22",ke),ye(re,"0.7.22","esm5"),ye("fire-js","");var Be=Object.freeze({__proto__:null,SDK_VERSION:ve,_DEFAULT_ENTRY_NAME:ie,_addComponent:ce,_addOrOverwriteComponent:ue,_apps:ae,_clearComponents:function(){se.clear()},_components:se,_getProvider:fe,_registerComponent:le,_removeServiceInstance:function(e,t,r){void 0===r&&(r=ie),fe(e,t).clearInstance(r)},deleteApp:be,getApp:function(e){var t=ae.get(e=void 0===e?ie:e);if(!t)throw he.create("no-app",{appName:e});return t},getApps:function(){return Array.from(ae.values())},initializeApp:me,onLog:_e,registerVersion:ye,setLogLevel:we,FirebaseError:v}),Re=(Object.defineProperty(xe.prototype,"automaticDataCollectionEnabled",{get:function(){return this._delegate.automaticDataCollectionEnabled},set:function(e){this._delegate.automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(xe.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(xe.prototype,"options",{get:function(){return this._delegate.options},enumerable:!1,configurable:!0}),xe.prototype.delete=function(){var t=this;return new Promise(function(e){t._delegate.checkDestroyed(),e()}).then(function(){return t.firebase.INTERNAL.removeApp(t.name),be(t._delegate)})},xe.prototype._getService=function(e,t){var r;void 0===t&&(t=ie),this._delegate.checkDestroyed();var n=this._delegate.container.getProvider(e);return n.isInitialized()||"EXPLICIT"!==(null===(r=n.getComponent())||void 0===r?void 0:r.instantiationMode)||n.initialize(),n.getImmediate({identifier:t})},xe.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=ie),this._delegate.container.getProvider(e).clearInstance(t)},xe.prototype._addComponent=function(e){ce(this._delegate,e)},xe.prototype._addOrOverwriteComponent=function(e){ue(this._delegate,e)},xe.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},xe);function xe(e,t){var r=this;this._delegate=e,this.firebase=t,ce(e,new x("app-compat",function(){return r},"PUBLIC")),this.container=e.container}var pe=((He={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",He["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",He),Fe=new b("app-compat","Firebase",pe);function Ue(i){var o={},a={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});var r=me(e,t);if(w(o,r.name))return o[r.name];var n=new i(r,a);return o[r.name]=n},app:s,registerVersion:ye,setLogLevel:we,onLog:_e,apps:null,SDK_VERSION:ve,INTERNAL:{registerComponent:function(r){var n=r.name,t=n.replace("-compat","");{var e;le(r)&&"PUBLIC"===r.type&&(e=function(e){if("function"!=typeof(e=void 0===e?s():e)[t])throw Fe.create("invalid-app-argument",{appName:n});return e[t]()},void 0!==r.serviceProps&&c(e,r.serviceProps),a[t]=e,i.prototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,n).apply(this,r.multipleInstances?e:[])})}return"PUBLIC"===r.type?a[t]:null},removeApp:function(e){delete o[e]},useAsService:function(e,t){return"serverAuth"!==t?t:null},modularAPIs:Be}};function s(e){if(!w(o,e=e||ie))throw Fe.create("no-app",{appName:e});return o[e]}return a.default=a,Object.defineProperty(a,"apps",{get:function(){return Object.keys(o).map(function(e){return o[e]})}}),s.App=i,a}var He=function e(){var t=Ue(Re);return t.INTERNAL=f(f({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:S,ErrorFactory:b,deepExtend:c}),t}(),pe=new X("@firebase/app-compat");"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(pe.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(Ve=self.firebase.SDK_VERSION)&&0<=Ve.indexOf("LITE")&&pe.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n "));var ze=He;ye("@firebase/app-compat","0.1.23",void 0);ze.registerVersion("firebase","9.7.0","app-compat");var Ve="@firebase/installations",pe="0.5.8",qe=1e4,We="w:"+pe,$e="FIS_v2",Ke="https://firebaseinstallations.googleapis.com/v1",Je=36e5,He=((He={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',He["not-registered"]="Firebase Installation is not registered.",He["installation-not-found"]="Firebase Installation not found.",He["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',He["app-offline"]="Could not process request. Application offline.",He["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",He),Ge=new b("installations","Installations",He);function Ye(e){return e instanceof v&&e.code.includes("request-failed")}function Xe(e){var t=e.projectId;return Ke+"/projects/"+t+"/installations"}function Ze(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}function Qe(r,n){return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,n.json()];case 1:return t=e.sent(),t=t.error,[2,Ge.create("request-failed",{requestName:r,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function et(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function tt(e,t){var r=t.refreshToken,n=et(e);return n.append("Authorization",$e+" "+r),n}function rt(r){return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,r()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,r()]:[2,t]}})})}function nt(t){return new Promise(function(e){setTimeout(e,t)})}var it=/^[cdef][\w-]{21}$/,ot="";function at(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return btoa(String.fromCharCode.apply(String,a([],g(e)))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22);return it.test(t)?t:ot}catch(e){return ot}}function st(e){return e.appName+"!"+e.appId}var ct=new Map;function ut(e,t){var r=st(e);lt(r,t),function(e,t){var r=function(){!ft&&"BroadcastChannel"in self&&((ft=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){lt(e.data.key,e.data.fid)});return ft}();r&&r.postMessage({key:e,fid:t});0===ct.size&&ft&&(ft.close(),ft=null)}(r,t)}function lt(e,t){var r,n,i=ct.get(e);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next())(0,a.value)(t)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}var ft=null;var pt="firebase-installations-store",ht=null;function dt(){return ht=ht||R("firebase-installations-database",1,function(e,t){0===t&&e.createObjectStore(pt)})}function gt(o,a){return p(this,void 0,void 0,function(){var t,r,n,i;return h(this,function(e){switch(e.label){case 0:return t=st(o),[4,dt()];case 1:return n=e.sent(),r=n.transaction(pt,"readwrite"),[4,(n=r.objectStore(pt)).get(t)];case 2:return i=e.sent(),[4,n.put(a,t)];case 3:return e.sent(),[4,r.complete];case 4:return e.sent(),i&&i.fid===a.fid||ut(o,a.fid),[2,a]}})})}function vt(n){return p(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return t=st(n),[4,dt()];case 1:return r=e.sent(),[4,(r=r.transaction(pt,"readwrite")).objectStore(pt).delete(t)];case 2:return e.sent(),[4,r.complete];case 3:return e.sent(),[2]}})})}function mt(a,s){return p(this,void 0,void 0,function(){var t,r,n,i,o;return h(this,function(e){switch(e.label){case 0:return t=st(a),[4,dt()];case 1:return n=e.sent(),r=n.transaction(pt,"readwrite"),[4,(n=r.objectStore(pt)).get(t)];case 2:return i=e.sent(),void 0!==(o=s(i))?[3,4]:[4,n.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,n.put(o,t)];case 5:e.sent(),e.label=6;case 6:return[4,r.complete];case 7:return e.sent(),!o||i&&i.fid===o.fid||ut(a,o.fid),[2,o]}})})}function bt(i){return p(this,void 0,void 0,function(){var r,t,n;return h(this,function(e){switch(e.label){case 0:return[4,mt(i.appConfig,function(e){var t=_t(e||{fid:at(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return p(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return[4,yt(i.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,nt(100)];case 3:return e.sent(),[4,yt(i.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,bt(i)];case 6:return n=e.sent(),r=n.installationEntry,(n=n.registrationPromise)?[2,n]:[2,r];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var r=Promise.reject(Ge.create("app-offline"));return{installationEntry:t,registrationPromise:r}}var n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=function(n,i){return p(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(e,t){var s=e.appConfig,c=e.heartbeatServiceProvider,u=t.fid;return p(this,void 0,void 0,function(){var t,r,n,i,o,a;return h(this,function(e){switch(e.label){case 0:return t=Xe(s),r=et(s),(n=c.getImmediate({optional:!0}))?[4,n.getHeartbeatsHeader()]:[3,2];case 1:(n=e.sent())&&r.append("x-firebase-client",n),e.label=2;case 2:return a={fid:u,authVersion:$e,appId:s.appId,sdkVersion:We},i={method:"POST",headers:r,body:JSON.stringify(a)},[4,rt(function(){return fetch(t,i)})];case 3:return(o=e.sent()).ok?[4,o.json()]:[3,5];case 4:return a=e.sent(),[2,{fid:a.fid||u,registrationStatus:2,refreshToken:a.refreshToken,authToken:Ze(a.authToken)}];case 5:return[4,Qe("Create Installation",o)];case 6:throw e.sent()}})})}(n,i)];case 1:return t=e.sent(),[2,gt(n.appConfig,t)];case 2:return Ye(r=e.sent())&&409===r.customData.serverCode?[4,vt(n.appConfig)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,gt(n.appConfig,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw r;case 7:return[2]}})})}(e,n);return{installationEntry:n,registrationPromise:r}}}(i,t);return r=t.registrationPromise,t.installationEntry})];case 1:return(t=e.sent()).fid!==ot?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function yt(e){return mt(e,function(e){if(!e)throw Ge.create("installation-not-found");return _t(e)})}function _t(e){return 1===(t=e).registrationStatus&&t.registrationTime+qe<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}function wt(e,c){var u=e.appConfig,l=e.heartbeatServiceProvider;return p(this,void 0,void 0,function(){var r,n,i,o,a,s;return h(this,function(e){switch(e.label){case 0:return t=c.fid,r=Xe(u)+"/"+t+"/authTokens:generate",n=tt(u,c),(i=l.getImmediate({optional:!0}))?[4,i.getHeartbeatsHeader()]:[3,2];case 1:(i=e.sent())&&n.append("x-firebase-client",i),e.label=2;case 2:return s={installation:{sdkVersion:We,appId:u.appId}},o={method:"POST",headers:n,body:JSON.stringify(s)},[4,rt(function(){return fetch(r,o)})];case 3:return(a=e.sent()).ok?[4,a.json()]:[3,5];case 4:return s=e.sent(),[2,Ze(s)];case 5:return[4,Qe("Generate Auth Token",a)];case 6:throw e.sent()}var t})})}function Et(i,o){return void 0===o&&(o=!1),p(this,void 0,void 0,function(){var n,t,r;return h(this,function(e){switch(e.label){case 0:return[4,mt(i.appConfig,function(e){if(!St(e))throw Ge.create("not-registered");var t,r=e.authToken;if(o||2!==(t=r).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+Je}(t)){if(1===r.requestStatus)return n=function(n,i){return p(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return[4,It(n.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,nt(100)];case 3:return e.sent(),[4,It(n.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0===(r=t.authToken).requestStatus?[2,Et(n,i)]:[2,r]}})})}(i,o),e;if(!navigator.onLine)throw Ge.create("app-offline");r=(t=e,r={requestStatus:1,requestTime:Date.now()},f(f({},t),{authToken:r}));return n=function(i,o){return p(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,wt(i,o)];case 1:return t=e.sent(),n=f(f({},o),{authToken:t}),[4,gt(i.appConfig,n)];case 2:return e.sent(),[2,t];case 3:return!Ye(r=e.sent())||401!==r.customData.serverCode&&404!==r.customData.serverCode?[3,5]:[4,vt(i.appConfig)];case 4:return e.sent(),[3,7];case 5:return n=f(f({},o),{authToken:{requestStatus:0}}),[4,gt(i.appConfig,n)];case 6:e.sent(),e.label=7;case 7:throw r;case 8:return[2]}})})}(i,r),r}return e})];case 1:return t=e.sent(),n?[4,n]:[3,3];case 2:return r=e.sent(),[3,4];case 3:r=t.authToken,e.label=4;case 4:return[2,r]}})})}function It(e){return mt(e,function(e){if(!St(e))throw Ge.create("not-registered");var t,r=e.authToken;return 1===(t=r).requestStatus&&t.requestTime+qe<Date.now()?f(f({},e),{authToken:{requestStatus:0}}):e})}function St(e){return void 0!==e&&2===e.registrationStatus}function Ct(r,n){return void 0===n&&(n=!1),p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,function(r){return p(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,bt(r)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t=r)];case 1:return e.sent(),[4,Et(t,n)];case 2:return[2,e.sent().token]}})})}function Tt(e){return Ge.create("missing-app-config-values",{valueName:e})}function Ot(e){var t=fe(e.getProvider("app").getImmediate(),At).getImmediate();return{getId:function(){return function(i){return p(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return[4,bt(t=i)];case 1:return r=e.sent(),n=r.installationEntry,(r.registrationPromise||Et(t)).catch(console.error),[2,n.fid]}})})}(t)},getToken:function(e){return Ct(t,e)}}}var At="installations";le(new x(At,function(e){var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){var t,r;if(!e||!e.options)throw Tt("App Configuration");if(!e.name)throw Tt("App Name");try{for(var n=d(["projectId","apiKey","appId"]),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e.options[o])throw Tt(o)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:fe(t,"heartbeat"),_delete:function(){return Promise.resolve()}}},"PUBLIC")),le(new x("installations-internal",Ot,"PRIVATE")),ye(Ve,pe),ye(Ve,pe,"esm5");var Nt,Pt,Dt="@firebase/performance",kt="0.5.8",Mt=kt,Lt="FB-PERF-TRACE-MEASURE",jt="@firebase/performance/config",Bt="@firebase/performance/configexpire",Ve="Performance",pe=((pe={})["trace started"]="Trace {$traceName} was started before.",pe["trace stopped"]="Trace {$traceName} is not running.",pe["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",pe["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",pe["no window"]="Window is not available.",pe["no app id"]="App id is not available.",pe["no project id"]="Project id is not available.",pe["no api key"]="Api key is not available.",pe["invalid cc log"]="Attempted to queue invalid cc event",pe["FB not default"]="Performance can only start when Firebase app instance is the default one.",pe["RC response not ok"]="RC response is not ok",pe["invalid attribute name"]="Attribute name {$attributeName} is invalid.",pe["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",pe["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",pe["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",pe["already initialized"]="initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance.",pe),Rt=new b("performance",Ve,pe),xt=new X(Ve);xt.logLevel=W.INFO;var Ft,Ut,Ht=(zt.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},zt.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},zt.prototype.measure=function(e,t,r){this.performance&&this.performance.measure&&this.performance.measure(e,t,r)},zt.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},zt.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},zt.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},zt.prototype.requiredApisAvailable=function(){return fetch&&Promise&&"undefined"!=typeof navigator&&navigator.cookieEnabled?!!t()||(xt.info("IndexedDB is not supported by current browswer"),!1):(xt.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},zt.prototype.setupObserver=function(e,i){this.PerformanceObserver&&new this.PerformanceObserver(function(e){for(var t=0,r=e.getEntries();t<r.length;t++){var n=r[t];i(n)}}).observe({entryTypes:[e]})},zt.getInstance=function(){return Nt=void 0===Nt?new zt(Pt):Nt},zt);function zt(e){if(!(this.window=e))throw Rt.create("no window");this.performance=e.performance,this.PerformanceObserver=e.PerformanceObserver,this.windowLocation=e.location,this.navigator=e.navigator,this.document=e.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=e.localStorage),e.perfMetrics&&e.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=e.perfMetrics.onFirstInputDelay)}function Vt(e,t){var r=e.length-t.length;if(r<0||1<r)throw Rt.create("invalid String merger input");for(var n=[],i=0;i<e.length;i++)n.push(e.charAt(i)),t.length>i&&n.push(t.charAt(i));return n.join("")}var qt,Wt,$t=(Kt.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},Kt.getInstance=function(){return Ut=void 0===Ut?new Kt:Ut},Kt);function Kt(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.