3 lines
46 KiB
JavaScript
3 lines
46 KiB
JavaScript
!function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e=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 n in t)t.hasOwnProperty(n)&&(e[n]=t[n])})(e,t)};var u=function(){return(u=Object.assign||function(e){for(var t,n=1,r=arguments.length;n<r;n++)for(var i in t=arguments[n])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function h(e,a,s,c){return new(s=s||Promise)(function(n,t){function r(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?n(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(r,i)}o((c=c.apply(e,a||[])).next())})}function d(n,r){var i,o,a,e,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]};return e={next:t(0),throw:t(1),return:t(2)},"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,a&&(t=[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=r.call(n,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 g(e){var t="function"==typeof Symbol&&Symbol.iterator,n=t&&e[t],r=0;if(n)return n.call(e);if(e&&"number"==typeof e.length)return{next:function(){return e&&r>=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 f(e,t){var n="function"==typeof Symbol&&e[Symbol.iterator];if(!n)return e;var r,i,o=n.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(r=o.next()).done;)a.push(r.value)}catch(e){i={error:e}}finally{try{r&&!r.done&&(n=o.return)&&n.call(o)}finally{if(i)throw i.error}}return a}function o(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}function v(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 n in t)t.hasOwnProperty(n)&&(e[n]=v(e[n],t[n]));return e}var i=(e.prototype.wrapCallback=function(n){var r=this;return function(e,t){e?r.reject(e):r.resolve(t),"function"==typeof n&&(r.promise.catch(function(){}),1===n.length?n(e):n(e,t))}},e);function e(){var n=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){n.resolve=e,n.reject=t})}var r,t,a,m=(r=Error,n(t=c,a=r),t.prototype=null===a?Object.create(a):(s.prototype=a.prototype,new s),c);function s(){this.constructor=t}function c(e,t){var n=r.call(this,t)||this;return n.code=e,n.name="FirebaseError",Object.setPrototypeOf(n,c.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,l.prototype.create),n}var l=(p.prototype.create=function(e){for(var t=[],n=1;n<arguments.length;n++)t[n-1]=arguments[n];for(var r,i=t[0]||{},o=this.service+"/"+e,a=this.errors[e],s=a?(r=i,a.replace(y,function(e,t){var n=r[t];return null!=n?n.toString():"<"+t+"?>"})):"Error",c=this.serviceName+": "+s+" ("+o+").",u=new m(o,c),f=0,l=Object.keys(i);f<l.length;f++){var p=l[f];"_"!==p.slice(-1)&&(p in u&&console.warn('Overwriting FirebaseError base field "'+p+'" can cause unexpected behavior.'),u[p]=i[p])}return u},p);function p(e,t,n){this.service=e,this.serviceName=t,this.errors=n}var y=/\{\$([^}]+)}/g;function b(e,t){return Object.prototype.hasOwnProperty.call(e,t)}var _=(w.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},w.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},w.prototype.setServiceProps=function(e){return this.serviceProps=e,this},w);function w(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY"}var I="[DEFAULT]",E=(S.prototype.get=function(e){void 0===e&&(e=I);var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var n=new i;this.instancesDeferred.set(t,n);try{var r=this.getOrInitializeService(t);r&&n.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise},S.prototype.getImmediate=function(e){var t=u({identifier:I,optional:!1},e),n=t.identifier,r=t.optional,i=this.normalizeInstanceIdentifier(n);try{var o=this.getOrInitializeService(i);if(o)return o;if(r)return null;throw Error("Service "+this.name+" is not available")}catch(e){if(r)return null;throw e}},S.prototype.getComponent=function(){return this.component},S.prototype.setComponent=function(e){var t,n;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("EAGER"===(this.component=e).instantiationMode)try{this.getOrInitializeService(I)}catch(e){}try{for(var r=g(this.instancesDeferred.entries()),i=r.next();!i.done;i=r.next()){var o=f(i.value,2),a=o[0],s=o[1],c=this.normalizeInstanceIdentifier(a);try{var u=this.getOrInitializeService(c);s.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}},S.prototype.clearInstance=function(e){void 0===e&&(e=I),this.instancesDeferred.delete(e),this.instances.delete(e)},S.prototype.delete=function(){return h(this,void 0,void 0,function(){var t;return d(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()}))];case 1:return e.sent(),[2]}})})},S.prototype.isComponentSet=function(){return null!=this.component},S.prototype.getOrInitializeService=function(e){var t,n=this.instances.get(e);return!n&&this.component&&(n=this.component.instanceFactory(this.container,(t=e)===I?void 0:t),this.instances.set(e,n)),n||null},S.prototype.normalizeInstanceIdentifier=function(e){return!this.component||this.component.multipleInstances?e:I},S);function S(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map}var T,A=(N.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)},N.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},N.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new E(e,this);return this.providers.set(e,t),t},N.prototype.getProviders=function(){return Array.from(this.providers.values())},N);function N(e){this.name=e,this.providers=new Map}function O(){for(var e=0,t=0,n=arguments.length;t<n;t++)e+=arguments[t].length;var r=Array(e),i=0;for(t=0;t<n;t++)for(var o=arguments[t],a=0,s=o.length;a<s;a++,i++)r[i]=o[a];return r}var k,P,C=[];(P=k=k||{})[P.DEBUG=0]="DEBUG",P[P.VERBOSE=1]="VERBOSE",P[P.INFO=2]="INFO",P[P.WARN=3]="WARN",P[P.ERROR=4]="ERROR",P[P.SILENT=5]="SILENT";function R(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];if(!(t<e.logLevel)){var i=(new Date).toISOString(),o=M[t];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[o].apply(console,O(["["+i+"] "+e.name+":"],n))}}var j,D={debug:k.DEBUG,verbose:k.VERBOSE,info:k.INFO,warn:k.WARN,error:k.ERROR,silent:k.SILENT},L=k.INFO,M=((T={})[k.DEBUG]="log",T[k.VERBOSE]="log",T[k.INFO]="info",T[k.WARN]="warn",T[k.ERROR]="error",T),B=(Object.defineProperty(x.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in k))throw new TypeError("Invalid value assigned to `logLevel`");this._logLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(x.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:!0,configurable:!0}),Object.defineProperty(x.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!0,configurable:!0}),x.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,O([this,k.DEBUG],e)),this._logHandler.apply(this,O([this,k.DEBUG],e))},x.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,O([this,k.VERBOSE],e)),this._logHandler.apply(this,O([this,k.VERBOSE],e))},x.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,O([this,k.INFO],e)),this._logHandler.apply(this,O([this,k.INFO],e))},x.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,O([this,k.WARN],e)),this._logHandler.apply(this,O([this,k.WARN],e))},x.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,O([this,k.ERROR],e)),this._logHandler.apply(this,O([this,k.ERROR],e))},x);function x(e){this.name=e,this._logLevel=L,this._logHandler=R,this._userLogHandler=null,C.push(this)}function U(e){var t="string"==typeof e?D[e]:e;C.forEach(function(e){e.logLevel=t})}var F,q=((j={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",j["bad-app-name"]="Illegal App name: '{$appName}",j["duplicate-app"]="Firebase App named '{$appName}' already exists",j["app-deleted"]="Firebase App named '{$appName}' already deleted",j["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",j["invalid-log-argument"]="First argument to `onLog` must be null or a function.",j),V=new l("app","Firebase",q),H="@firebase/app",K="[DEFAULT]",z=((F={})[H]="fire-core",F["@firebase/analytics"]="fire-analytics",F["@firebase/auth"]="fire-auth",F["@firebase/database"]="fire-rtdb",F["@firebase/functions"]="fire-fn",F["@firebase/installations"]="fire-iid",F["@firebase/messaging"]="fire-fcm",F["@firebase/performance"]="fire-perf",F["@firebase/remote-config"]="fire-rc",F["@firebase/storage"]="fire-gcs",F["@firebase/firestore"]="fire-fst",F["fire-js"]="fire-js",F["firebase-wrapper"]="fire-js-all",F),$=(Object.defineProperty(W.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed_(),this.automaticDataCollectionEnabled_},set:function(e){this.checkDestroyed_(),this.automaticDataCollectionEnabled_=e},enumerable:!0,configurable:!0}),Object.defineProperty(W.prototype,"name",{get:function(){return this.checkDestroyed_(),this.name_},enumerable:!0,configurable:!0}),Object.defineProperty(W.prototype,"options",{get:function(){return this.checkDestroyed_(),this.options_},enumerable:!0,configurable:!0}),W.prototype.delete=function(){var t=this;return new Promise(function(e){t.checkDestroyed_(),e()}).then(function(){return t.firebase_.INTERNAL.removeApp(t.name_),Promise.all(t.container.getProviders().map(function(e){return e.delete()}))}).then(function(){t.isDeleted_=!0})},W.prototype._getService=function(e,t){return void 0===t&&(t=K),this.checkDestroyed_(),this.container.getProvider(e).getImmediate({identifier:t})},W.prototype.checkDestroyed_=function(){if(this.isDeleted_)throw V.create("app-deleted",{appName:this.name_})},W);function W(e,t,n){var r,i,o=this;this.firebase_=n,this.isDeleted_=!1,this.INTERNAL={},this.name_=t.name,this.automaticDataCollectionEnabled_=t.automaticDataCollectionEnabled||!1,this.options_=v(void 0,e),this.container=new A(t.name),this.container.addComponent(new _("app",function(){return o},"PUBLIC"));try{for(var a=g(this.firebase_.INTERNAL.components.values()),s=a.next();!s.done;s=a.next()){var c=s.value;this.container.addComponent(c)}}catch(e){r={error:e}}finally{try{s&&!s.done&&(i=a.return)&&i.call(a)}finally{if(r)throw r.error}}}var G="7.14.6",J=new B("@firebase/app");function Y(c){var u={},f=new Map,l={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});if("object"!=typeof t||null===t){t={name:t}}var n=t;void 0===n.name&&(n.name=K);var r=n.name;if("string"!=typeof r||!r)throw V.create("bad-app-name",{appName:String(r)});if(b(u,r))throw V.create("duplicate-app",{appName:r});var i=new c(e,n,l);return u[r]=i},app:p,registerVersion:function(e,t,n){var r,i=null!==(r=z[e])&&void 0!==r?r:e;n&&(i+="-"+n);var o=i.match(/\s|\//),a=t.match(/\s|\//);if(o||a){var s=['Unable to register library "'+i+'" with version "'+t+'":'];return o&&s.push('library name "'+i+'" contains illegal characters (whitespace or "/")'),o&&a&&s.push("and"),a&&s.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void J.warn(s.join(" "))}h(new _(i+"-version",function(){return{library:i,version:t}},"VERSION"))},setLogLevel:U,onLog:function(e,t){if(null!==e&&"function"!=typeof e)throw V.create("invalid-log-argument",{appName:name});!function(a,t){for(var e=function(e){var o=null;t&&t.level&&(o=D[t.level]),e.userLogHandler=null===a?null:function(e,t){for(var n=[],r=2;r<arguments.length;r++)n[r-2]=arguments[r];var i=n.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:k[t].toLowerCase(),message:i,args:n,type:e.name})}},n=0,r=C;n<r.length;n++){e(r[n])}}(e,t)},apps:null,SDK_VERSION:G,INTERNAL:{registerComponent:h,removeApp:function(e){delete u[e]},components:f,useAsService:function(e,t){return"serverAuth"!==t?t:null}}};function p(e){if(!b(u,e=e||K))throw V.create("no-app",{appName:e});return u[e]}function h(n){var t,e,r=n.name;if(f.has(r))return J.debug("There were multiple attempts to register component "+r+"."),"PUBLIC"===n.type?l[r]:null;if(f.set(r,n),"PUBLIC"===n.type){var i=function(e){if(void 0===e&&(e=p()),"function"!=typeof e[r])throw V.create("invalid-app-argument",{appName:r});return e[r]()};void 0!==n.serviceProps&&v(i,n.serviceProps),l[r]=i,c.prototype[r]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,r).apply(this,n.multipleInstances?e:[])}}try{for(var o=g(Object.keys(u)),a=o.next();!a.done;a=o.next()){var s=a.value;u[s]._addComponent(n)}}catch(e){t={error:e}}finally{try{a&&!a.done&&(e=o.return)&&e.call(o)}finally{if(t)throw t.error}}return"PUBLIC"===n.type?l[r]:null}return l.default=l,Object.defineProperty(l,"apps",{get:function(){return Object.keys(u).map(function(e){return u[e]})}}),p.App=c,l}var Z=(Q.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(e){if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,n=e.getImmediate();return n.library+"/"+n.version}).filter(function(e){return e}).join(" ")},Q);function Q(e){this.container=e}var X,ee,te=function(){var e=Y($);e.SDK_VERSION=e.SDK_VERSION+"_LITE";var t=e.INTERNAL.registerComponent;return e.INTERNAL.registerComponent=function(e){if("PUBLIC"!==e.type||"performance"===e.name||"installations"===e.name)return t(e);throw Error(name+" cannot register with the standalone perf instance")},e}();function ne(n){return new Promise(function(e,t){n.onsuccess=function(){e(n.result)},n.onerror=function(){t(n.error)}})}function re(n,r,i){var o,e=new Promise(function(e,t){ne(o=n[r].apply(n,i)).then(e,t)});return e.request=o,e}function ie(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 oe(t,n,r,e){e.forEach(function(e){e in r.prototype&&(t.prototype[e]=function(){return re(this[n],e,arguments)})})}function ae(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 se(e,r,t,n){n.forEach(function(n){n in t.prototype&&(e.prototype[n]=function(){return e=this[r],(t=re(e,n,arguments)).then(function(e){if(e)return new ue(e,t.request)});var e,t})})}function ce(e){this._index=e}function ue(e,t){this._cursor=e,this._request=t}function fe(e){this._store=e}function le(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 pe(e,t,n){this._db=e,this.oldVersion=t,this.transaction=new le(n)}function he(e){this._db=e}ee="lite",(X=te).INTERNAL.registerComponent(new _("platform-logger",function(e){return new Z(e)},"PRIVATE")),X.registerVersion(H,"0.6.4",ee),X.registerVersion("fire-js",""),ie(ce,"_index",["name","keyPath","multiEntry","unique"]),oe(ce,"_index",IDBIndex,["get","getKey","getAll","getAllKeys","count"]),se(ce,"_index",IDBIndex,["openCursor","openKeyCursor"]),ie(ue,"_cursor",["direction","key","primaryKey","value"]),oe(ue,"_cursor",IDBCursor,["update","delete"]),["advance","continue","continuePrimaryKey"].forEach(function(n){n in IDBCursor.prototype&&(ue.prototype[n]=function(){var t=this,e=arguments;return Promise.resolve().then(function(){return t._cursor[n].apply(t._cursor,e),ne(t._request).then(function(e){if(e)return new ue(e,t._request)})})})}),fe.prototype.createIndex=function(){return new ce(this._store.createIndex.apply(this._store,arguments))},fe.prototype.index=function(){return new ce(this._store.index.apply(this._store,arguments))},ie(fe,"_store",["name","keyPath","indexNames","autoIncrement"]),oe(fe,"_store",IDBObjectStore,["put","add","delete","clear","get","getAll","getKey","getAllKeys","count"]),se(fe,"_store",IDBObjectStore,["openCursor","openKeyCursor"]),ae(fe,"_store",IDBObjectStore,["deleteIndex"]),le.prototype.objectStore=function(){return new fe(this._tx.objectStore.apply(this._tx,arguments))},ie(le,"_tx",["objectStoreNames","mode"]),ae(le,"_tx",IDBTransaction,["abort"]),pe.prototype.createObjectStore=function(){return new fe(this._db.createObjectStore.apply(this._db,arguments))},ie(pe,"_db",["name","version","objectStoreNames"]),ae(pe,"_db",IDBDatabase,["deleteObjectStore","close"]),he.prototype.transaction=function(){return new le(this._db.transaction.apply(this._db,arguments))},ie(he,"_db",["name","version","objectStoreNames"]),ae(he,"_db",IDBDatabase,["close"]),["openCursor","openKeyCursor"].forEach(function(o){[fe,ce].forEach(function(e){o in e.prototype&&(e.prototype[o.replace("open","iterate")]=function(){var e,t=(e=arguments,Array.prototype.slice.call(e)),n=t[t.length-1],r=this._store||this._index,i=r[o].apply(r,t.slice(0,-1));i.onsuccess=function(){n(i.result)}})})}),[ce,fe].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 de,ge=1e4,ve="w:0.4.10",me="FIS_v2",ye="https://firebaseinstallations.googleapis.com/v1",be=36e5,_e=((de={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',de["not-registered"]="Firebase Installation is not registered.",de["installation-not-found"]="Firebase Installation not found.",de["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',de["app-offline"]="Could not process request. Application offline.",de["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",de),we=new l("installations","Installations",_e);function Ie(e){return e instanceof m&&e.code.includes("request-failed")}function Ee(e){var t=e.projectId;return ye+"/projects/"+t+"/installations"}function Se(e){return{token:e.token,requestStatus:2,expiresIn:(t=e.expiresIn,Number(t.replace("s","000"))),creationTime:Date.now()};var t}function Te(r,i){return h(this,void 0,void 0,function(){var t,n;return d(this,function(e){switch(e.label){case 0:return[4,i.json()];case 1:return t=e.sent(),n=t.error,[2,we.create("request-failed",{requestName:r,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})]}})})}function Ae(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function Ne(e,t){var n=t.refreshToken,r=Ae(e);return r.append("Authorization",me+" "+n),r}function Oe(n){return h(this,void 0,void 0,function(){var t;return d(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 ke(t){return new Promise(function(e){setTimeout(e,t)})}function Pe(e){return btoa(String.fromCharCode.apply(String,function(){for(var e=[],t=0;t<arguments.length;t++)e=e.concat(f(arguments[t]));return e}(e))).replace(/\+/g,"-").replace(/\//g,"_")}var Ce=/^[cdef][\w-]{21}$/,Re="";function je(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=Pe(e).substr(0,22);return Ce.test(t)?t:Re}catch(e){return Re}}function De(e){return e.appName+"!"+e.appId}var Le=new Map;function Me(e,t){var n=De(e);Be(n,t),function(e,t){var n=Ue();n&&n.postMessage({key:e,fid:t});Fe()}(n,t)}function Be(e,t){var n,r,i=Le.get(e);if(i)try{for(var o=g(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 xe=null;function Ue(){return!xe&&"BroadcastChannel"in self&&((xe=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){Be(e.data.key,e.data.fid)}),xe}function Fe(){0===Le.size&&xe&&(xe.close(),xe=null)}var qe,Ve="firebase-installations-database",He=1,Ke="firebase-installations-store",ze=null;function $e(){var t,e,n;return ze||(t=function(e){switch(e.oldVersion){case 0:e.createObjectStore(Ke)}},e=re(indexedDB,"open",[Ve,He]),(n=e.request)&&(n.onupgradeneeded=function(e){t&&t(new pe(n.result,e.oldVersion,n.transaction))}),ze=e.then(function(e){return new he(e)})),ze}function We(a,s){return h(this,void 0,void 0,function(){var t,n,r,i,o;return d(this,function(e){switch(e.label){case 0:return t=De(a),[4,$e()];case 1:return n=e.sent(),r=n.transaction(Ke,"readwrite"),[4,(i=r.objectStore(Ke)).get(t)];case 2:return o=e.sent(),[4,i.put(s,t)];case 3:return e.sent(),[4,r.complete];case 4:return e.sent(),o&&o.fid===s.fid||Me(a,s.fid),[2,s]}})})}function Ge(i){return h(this,void 0,void 0,function(){var t,n,r;return d(this,function(e){switch(e.label){case 0:return t=De(i),[4,$e()];case 1:return n=e.sent(),[4,(r=n.transaction(Ke,"readwrite")).objectStore(Ke).delete(t)];case 2:return e.sent(),[4,r.complete];case 3:return e.sent(),[2]}})})}function Je(s,c){return h(this,void 0,void 0,function(){var t,n,r,i,o,a;return d(this,function(e){switch(e.label){case 0:return t=De(s),[4,$e()];case 1:return n=e.sent(),r=n.transaction(Ke,"readwrite"),[4,(i=r.objectStore(Ke)).get(t)];case 2:return o=e.sent(),void 0!==(a=c(o))?[3,4]:[4,i.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,i.put(a,t)];case 5:e.sent(),e.label=6;case 6:return[4,r.complete];case 7:return e.sent(),!a||o&&o.fid===a.fid||Me(s,a.fid),[2,a]}})})}function Ye(i){return h(this,void 0,void 0,function(){var r,t,n;return d(this,function(e){switch(e.label){case 0:return[4,Je(i,function(e){var t=Qe(e||{fid:je(),registrationStatus:0}),n=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(o){return h(this,void 0,void 0,function(){var t,n,r,i;return d(this,function(e){switch(e.label){case 0:return[4,Ze(o)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,ke(100)];case 3:return e.sent(),[4,Ze(o)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,Ye(o)];case 6:return n=e.sent(),r=n.installationEntry,(i=n.registrationPromise)?[2,i]:[2,r];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var n=Promise.reject(we.create("app-offline"));return{installationEntry:t,registrationPromise:n}}var r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},i=function(r,i){return h(this,void 0,void 0,function(){var t,n;return d(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(s,e){var c=e.fid;return h(this,void 0,void 0,function(){var t,n,r,i,o,a;return d(this,function(e){switch(e.label){case 0:return t=Ee(s),n=Ae(s),r={fid:c,authVersion:me,appId:s.appId,sdkVersion:ve},i={method:"POST",headers:n,body:JSON.stringify(r)},[4,Oe(function(){return fetch(t,i)})];case 1:return(o=e.sent()).ok?[4,o.json()]:[3,3];case 2:return a=e.sent(),[2,{fid:a.fid||c,registrationStatus:2,refreshToken:a.refreshToken,authToken:Se(a.authToken)}];case 3:return[4,Te("Create Installation",o)];case 4:throw e.sent()}})})}(r,i)];case 1:return t=e.sent(),[2,We(r,t)];case 2:return Ie(n=e.sent())&&409===n.serverCode?[4,Ge(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,r);return{installationEntry:r,registrationPromise:i}}}(i,t);return r=n.registrationPromise,n.installationEntry})];case 1:return(t=e.sent()).fid!==Re?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function Ze(e){return Je(e,function(e){if(!e)throw we.create("installation-not-found");return Qe(e)})}function Qe(e){return 1===(t=e).registrationStatus&&t.registrationTime+ge<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}function Xe(e,f){var l=e.appConfig,p=e.platformLoggerProvider;return h(this,void 0,void 0,function(){var r,i,o,a,s,c,u;return d(this,function(e){switch(e.label){case 0:return t=l,n=f.fid,r=Ee(t)+"/"+n+"/authTokens:generate",i=Ne(l,f),(o=p.getImmediate({optional:!0}))&&i.append("x-firebase-client",o.getPlatformInfoString()),a={installation:{sdkVersion:ve}},s={method:"POST",headers:i,body:JSON.stringify(a)},[4,Oe(function(){return fetch(r,s)})];case 1:return(c=e.sent()).ok?[4,c.json()]:[3,3];case 2:return u=e.sent(),[2,Se(u)];case 3:return[4,Te("Generate Auth Token",c)];case 4:throw e.sent()}var t,n})})}function et(s,c){return void 0===c&&(c=!1),h(this,void 0,void 0,function(){var a,t,n;return d(this,function(e){switch(e.label){case 0:return[4,Je(s.appConfig,function(e){if(!nt(e))throw we.create("not-registered");var t,n,r,i=e.authToken;if(c||2!==(r=i).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+be}(r)){if(1===i.requestStatus)return a=function(r,i){return h(this,void 0,void 0,function(){var t,n;return d(this,function(e){switch(e.label){case 0:return[4,tt(r.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,ke(100)];case 3:return e.sent(),[4,tt(r.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0===(n=t.authToken).requestStatus?[2,et(r,i)]:[2,n]}})})}(s,c),e;if(!navigator.onLine)throw we.create("app-offline");var o=(t=e,n={requestStatus:1,requestTime:Date.now()},u(u({},t),{authToken:n}));return a=function(i,o){return h(this,void 0,void 0,function(){var t,n,r;return d(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,Xe(i,o)];case 1:return t=e.sent(),r=u(u({},o),{authToken:t}),[4,We(i.appConfig,r)];case 2:return e.sent(),[2,t];case 3:return!Ie(n=e.sent())||401!==n.serverCode&&404!==n.serverCode?[3,5]:[4,Ge(i.appConfig)];case 4:return e.sent(),[3,7];case 5:return r=u(u({},o),{authToken:{requestStatus:0}}),[4,We(i.appConfig,r)];case 6:e.sent(),e.label=7;case 7:throw n;case 8:return[2]}})})}(s,o),o}return e})];case 1:return t=e.sent(),a?[4,a]:[3,3];case 2:return n=e.sent(),[3,4];case 3:n=t.authToken,e.label=4;case 4:return[2,n]}})})}function tt(e){return Je(e,function(e){if(!nt(e))throw we.create("not-registered");var t,n=e.authToken;return 1===(t=n).requestStatus&&t.requestTime+ge<Date.now()?u(u({},e),{authToken:{requestStatus:0}}):e})}function nt(e){return void 0!==e&&2===e.registrationStatus}function rt(t,n){return void 0===n&&(n=!1),h(this,void 0,void 0,function(){return d(this,function(e){switch(e.label){case 0:return[4,function(n){return h(this,void 0,void 0,function(){var t;return d(this,function(e){switch(e.label){case 0:return[4,Ye(n)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t.appConfig)];case 1:return e.sent(),[4,et(t,n)];case 2:return[2,e.sent().token]}})})}function it(s,c){return h(this,void 0,void 0,function(){var r,i,o,a;return d(this,function(e){switch(e.label){case 0:return t=s,n=c.fid,r=Ee(t)+"/"+n,i=Ne(s,c),o={method:"DELETE",headers:i},[4,Oe(function(){return fetch(r,o)})];case 1:return(a=e.sent()).ok?[3,3]:[4,Te("Delete Installation",a)];case 2:throw e.sent();case 3:return[2]}var t,n})})}function ot(e,r){var i=e.appConfig;return function(e,t){Ue();var n=De(e),r=Le.get(n);r||(r=new Set,Le.set(n,r)),r.add(t)}(i,r),function(){var e,t,n;e=r,t=De(i),(n=Le.get(t))&&(n.delete(e),0===n.size&&Le.delete(t),Fe())}}function at(e){return we.create("missing-app-config-values",{valueName:e})}(qe=te).INTERNAL.registerComponent(new _("installations",function(e){var t=e.getProvider("app").getImmediate(),n={appConfig:function(e){var t,n;if(!e||!e.options)throw at("App Configuration");if(!e.name)throw at("App Name");try{for(var r=g(["projectId","apiKey","appId"]),i=r.next();!i.done;i=r.next()){var o=i.value;if(!e.options[o])throw at(o)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(n=r.return)&&n.call(r)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),platformLoggerProvider:e.getProvider("platform-logger")};return{app:t,getId:function(){return function(i){return h(this,void 0,void 0,function(){var t,n,r;return d(this,function(e){switch(e.label){case 0:return[4,Ye(i.appConfig)];case 1:return t=e.sent(),n=t.installationEntry,(r=t.registrationPromise)?r.catch(console.error):et(i).catch(console.error),[2,n.fid]}})})}(n)},getToken:function(e){return rt(n,e)},delete:function(){return function(r){return h(this,void 0,void 0,function(){var t,n;return d(this,function(e){switch(e.label){case 0:return[4,Je(t=r.appConfig,function(e){if(!e||0!==e.registrationStatus)return e})];case 1:if(!(n=e.sent()))return[3,6];if(1!==n.registrationStatus)return[3,2];throw we.create("delete-pending-registration");case 2:if(2!==n.registrationStatus)return[3,6];if(navigator.onLine)return[3,3];throw we.create("app-offline");case 3:return[4,it(t,n)];case 4:return e.sent(),[4,Ge(t)];case 5:e.sent(),e.label=6;case 6:return[2]}})})}(n)},onIdChange:function(e){return ot(n,e)}}},"PUBLIC")),qe.registerVersion("@firebase/installations","0.4.10");var st,ct,ut,ft,lt="0.3.5",pt="FB-PERF-TRACE-MEASURE",ht="@firebase/performance/config",dt="@firebase/performance/configexpire",gt="Performance",vt=((st={})["trace started"]="Trace {$traceName} was started before.",st["trace stopped"]="Trace {$traceName} is not running.",st["no window"]="Window is not available.",st["no app id"]="App id is not available.",st["no project id"]="Project id is not available.",st["no api key"]="Api key is not available.",st["invalid cc log"]="Attempted to queue invalid cc event",st["FB not default"]="Performance can only start when Firebase app instance is the default one.",st["RC response not ok"]="RC response is not ok",st["invalid attribute name"]="Attribute name {$attributeName} is invalid.",st["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",st["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",st["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",st),mt=new l("performance",gt,vt),yt=(bt.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},bt.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},bt.prototype.measure=function(e,t,n){this.performance&&this.performance.measure&&this.performance.measure(e,t,n)},bt.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},bt.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},bt.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},bt.prototype.requiredApisAvailable=function(){return!!(fetch&&Promise&&this.navigator&&this.navigator.cookieEnabled)},bt.prototype.setupObserver=function(e,i){this.PerformanceObserver&&new this.PerformanceObserver(function(e){for(var t=0,n=e.getEntries();t<n.length;t++){var r=n[t];i(r)}}).observe({entryTypes:[e]})},bt.getInstance=function(){return void 0===ct&&(ct=new bt(ut)),ct},bt);function bt(e){if(!(this.window=e))throw mt.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 _t(e,t){var n=e.length-t.length;if(n<0||1<n)throw mt.create("invalid String merger input");for(var r=[],i=0;i<e.length;i++)r.push(e.charAt(i)),t.length>i&&r.push(t.charAt(i));return r.join("")}var wt,It,Et,St=(Tt.prototype.getAppId=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.appId;if(!e)throw mt.create("no app id");return e},Tt.prototype.getProjectId=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.projectId;if(!e)throw mt.create("no project id");return e},Tt.prototype.getApiKey=function(){var e=this.firebaseAppInstance&&this.firebaseAppInstance.options&&this.firebaseAppInstance.options.apiKey;if(!e)throw mt.create("no api key");return e},Tt.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},Tt.getInstance=function(){return void 0===ft&&(ft=new Tt),ft},Tt);function Tt(){this.instrumentationEnabled=!0,this.dataCollectionEnabled=!0,this.loggingEnabled=!1,this.tracesSamplingRate=1,this.networkRequestsSamplingRate=1,this.logEndPointUrl="https://firebaselogging.googleapis.com/v0cc/log?format=json_proto",this.flTransportEndpointUrl=_t("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=_t("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}function At(){return wt}(Et=It=It||{})[Et.UNKNOWN=0]="UNKNOWN",Et[Et.VISIBLE=1]="VISIBLE",Et[Et.HIDDEN=2]="HIDDEN";var Nt=["firebase_","google_","ga_"],Ot=new RegExp("^[a-zA-Z]\\w*$");function kt(){switch(yt.getInstance().document.visibilityState){case"visible":return It.VISIBLE;case"hidden":return It.HIDDEN;default:return It.UNKNOWN}}var Pt=new B(gt);Pt.logLevel=k.INFO;var Ct="0.0.1",Rt={loggingEnabled:!0},jt="FIREBASE_INSTALLATIONS_AUTH";function Dt(e){var r,t=function(){var e=yt.getInstance().localStorage;if(!e)return;var t=e.getItem(dt);if(!t||!function(e){return Number(e)>Date.now()}(t))return;var n=e.getItem(ht);if(!n)return;try{return JSON.parse(n)}catch(e){return}}();return t?(Mt(t),Promise.resolve()):(r=e,function(){var e=St.getInstance().installationsService.getToken();return e.then(function(e){}),e}().then(function(e){var t="https://firebaseremoteconfig.googleapis.com/v1/projects/"+St.getInstance().getProjectId()+"/namespaces/fireperf:fetch?key="+St.getInstance().getApiKey(),n=new Request(t,{method:"POST",headers:{Authorization:jt+" "+e},body:JSON.stringify({app_instance_id:r,app_instance_id_token:e,app_id:St.getInstance().getAppId(),app_version:lt,sdk_version:Ct})});return fetch(n).then(function(e){if(e.ok)return e.json();throw mt.create("RC response not ok")})}).catch(function(){Pt.info(Lt)}).then(Mt).then(function(e){return function(e){var t=yt.getInstance().localStorage;if(!e||!t)return;t.setItem(ht,JSON.stringify(e)),t.setItem(dt,String(Date.now()+60*St.getInstance().configTimeToLive*60*1e3))}(e)},function(){}))}var Lt="Could not fetch config, will use default configs";function Mt(e){if(!e)return e;var t=St.getInstance(),n=e.entries||{};return t.loggingEnabled=void 0!==n.fpr_enabled?"true"===String(n.fpr_enabled):Rt.loggingEnabled,n.fpr_log_source&&(t.logSource=Number(n.fpr_log_source)),n.fpr_log_endpoint_url&&(t.logEndPointUrl=n.fpr_log_endpoint_url),n.fpr_log_transport_key&&(t.transportKey=n.fpr_log_transport_key),void 0!==n.fpr_vc_network_request_sampling_rate&&(t.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate)),void 0!==n.fpr_vc_trace_sampling_rate&&(t.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate)),t.logTraceAfterSampling=Bt(t.tracesSamplingRate),t.logNetworkAfterSampling=Bt(t.networkRequestsSamplingRate),e}function Bt(e){return Math.random()<=e}var xt,Ut=1;function Ft(){return Ut=2,xt=xt||function(){var n=yt.getInstance().document;return new Promise(function(e){if(n&&"complete"!==n.readyState){var t=function(){"complete"===n.readyState&&(n.removeEventListener("readystatechange",t),e())};n.addEventListener("readystatechange",t)}else e()})}().then(function(){return(e=St.getInstance().installationsService.getId()).then(function(e){wt=e}),e;var e}).then(function(e){return Dt(e)}).then(function(){return qt()},function(){return qt()})}function qt(){Ut=3}var Vt,Ht=1e4,Kt=5500,zt=3,$t=zt,Wt=[],Gt=!1;function Jt(e){setTimeout(function(){if(0!==$t)return Wt.length?void function(){var e=o(Wt);Wt=[];var t=e.map(function(e){return{source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)}});(function(e,i){return function(e){var t=St.getInstance().getFlTransportFullUrl();return fetch(t,{method:"POST",body:JSON.stringify(e)})}(e).then(function(e){return e.ok||Pt.info("Call to Firebase backend failed."),e.json()}).then(function(e){var t=Number(e.nextRequestWaitMillis),n=Ht;isNaN(t)||(n=Math.max(t,n));var r=e.logResponseDetails;Array.isArray(r)&&0<r.length&&"RETRY_REQUEST_LATER"===r[0].responseAction&&(Wt=o(i,Wt),Pt.info("Retry transport request later.")),$t=zt,Jt(n)})})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:St.getInstance().logSource,log_event:t},e).catch(function(){Wt=o(e,Wt),$t--,Pt.info("Tries left: "+$t+"."),Jt(Ht)})}():Jt(Ht)},e)}function Yt(n){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!function(e){if(!e.eventTime||!e.message)throw mt.create("invalid cc log");Wt=o(Wt,[e])}({message:n.apply(void 0,e),eventTime:Date.now()})}}function Zt(e,t){(Vt=Vt||Yt(en))(e,t)}function Qt(e){var t=St.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&yt.getInstance().requiredApisAvailable()&&(e.isAuto&&kt()!==It.VISIBLE||t.loggingEnabled&&t.logTraceAfterSampling&&(3===Ut?Xt(e):Ft().then(function(){return Xt(e)},function(){return Xt(e)})))}function Xt(e){At()&&setTimeout(function(){return Zt(e,1)},0)}function en(e,t){return 0===t?(r={url:(n=e).url,http_method:n.httpMethod||0,http_response_code:200,response_payload_bytes:n.responsePayloadBytes,client_start_time_us:n.startTimeUs,time_to_response_initiated_us:n.timeToResponseInitiatedUs,time_to_response_completed_us:n.timeToResponseCompletedUs},i={application_info:tn(),network_request_metric:r},JSON.stringify(i)):function(e){var t={name:e.name,is_auto:e.isAuto,client_start_time_us:e.startTimeUs,duration_us:e.durationUs};0!==Object.keys(e.counters).length&&(t.counters=e.counters);var n=e.getAttributes();0!==Object.keys(n).length&&(t.custom_attributes=n);var r={application_info:tn(),trace_metric:t};return JSON.stringify(r)}(e);var n,r,i}function tn(){return{google_app_id:St.getInstance().getAppId(),app_instance_id:At(),web_app_info:{sdk_version:lt,page_url:yt.getInstance().getUrl(),service_worker_status:"serviceWorker"in(e=yt.getInstance().navigator)?e.serviceWorker.controller?2:3:1,visibility_state:kt(),effective_connection_type:function(){var e=yt.getInstance().navigator.connection;switch(e&&e.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}()},application_process_state:0};var e}var nn=["_fp","_fcp","_fid"];var rn=(on.prototype.start=function(){if(1!==this.state)throw mt.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},on.prototype.stop=function(){if(2!==this.state)throw mt.create("trace stopped",{traceName:this.name});this.state=3,this.api.mark(this.traceStopMark),this.api.measure(this.traceMeasure,this.traceStartMark,this.traceStopMark),this.calculateTraceMetrics(),Qt(this)},on.prototype.record=function(e,t,n){if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),n&&n.attributes&&(this.customAttributes=u({},n.attributes)),n&&n.metrics)for(var r=0,i=Object.keys(n.metrics);r<i.length;r++){var o=i[r];isNaN(Number(n.metrics[o]))||(this.counters[o]=Number(Math.floor(n.metrics[o])))}Qt(this)},on.prototype.incrementMetric=function(e,t){void 0===t&&(t=1),void 0===this.counters[e]&&this.putMetric(e,0),this.counters[e]+=t},on.prototype.putMetric=function(e,t){if(n=e,r=this.name,0===n.length||100<n.length||!(r&&r.startsWith("_wt_")&&-1<nn.indexOf(n))&&n.startsWith("_"))throw mt.create("invalid custom metric name",{customMetricName:e});var n,r;this.counters[e]=t},on.prototype.getMetric=function(e){return this.counters[e]||0},on.prototype.putAttribute=function(e,t){var n,r,i=!(0===(n=e).length||40<n.length||Nt.some(function(e){return n.startsWith(e)})||!n.match(Ot)),o=0!==(r=t).length&&r.length<=100;if(i&&o)this.customAttributes[e]=t;else{if(!i)throw mt.create("invalid attribute name",{attributeName:e});if(!o)throw mt.create("invalid attribute value",{attributeValue:t})}},on.prototype.getAttribute=function(e){return this.customAttributes[e]},on.prototype.removeAttribute=function(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]},on.prototype.getAttributes=function(){return u({},this.customAttributes)},on.prototype.setStartTime=function(e){this.startTimeUs=e},on.prototype.setDuration=function(e){this.durationUs=e},on.prototype.calculateTraceMetrics=function(){var e=this.api.getEntriesByName(this.traceMeasure),t=e&&e[0];t&&(this.durationUs=Math.floor(1e3*t.duration),this.startTimeUs=Math.floor(1e3*(t.startTime+this.api.getTimeOrigin())))},on.createOobTrace=function(e,t,n){var r=yt.getInstance().getUrl();if(r){var i=new on("_wt_"+r,!0),o=Math.floor(1e3*yt.getInstance().getTimeOrigin());if(i.setStartTime(o),e&&e[0]&&(i.setDuration(Math.floor(1e3*e[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd))),t){var a=t.find(function(e){return"first-paint"===e.name});a&&a.startTime&&i.putMetric("_fp",Math.floor(1e3*a.startTime));var s=t.find(function(e){return"first-contentful-paint"===e.name});s&&s.startTime&&i.putMetric("_fcp",Math.floor(1e3*s.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))}Qt(i)}},on.createUserTimingTrace=function(e){Qt(new on(e,!1,e))},on);function on(e,t,n){void 0===t&&(t=!1),this.name=e,this.isAuto=t,this.state=1,this.customAttributes={},this.counters={},this.api=yt.getInstance(),this.randomId=Math.floor(1e6*Math.random()),this.isAuto||(this.traceStartMark="FB-PERF-TRACE-START-"+this.randomId+"-"+this.name,this.traceStopMark="FB-PERF-TRACE-STOP-"+this.randomId+"-"+this.name,this.traceMeasure=n||pt+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function an(e){var t=e;if(t&&void 0!==t.responseStart){var n=yt.getInstance().getTimeOrigin(),r=Math.floor(1e3*(t.startTime+n)),i=t.responseStart?Math.floor(1e3*(t.responseStart-t.startTime)):void 0,o=Math.floor(1e3*(t.responseEnd-t.startTime));!function(e){var t=St.getInstance();if(t.instrumentationEnabled){var n=e.url,r=t.logEndPointUrl.split("?")[0],i=t.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&t.loggingEnabled&&t.logNetworkAfterSampling&&setTimeout(function(){return Zt(e,0)},0)}}({url:t.name&&t.name.split("?")[0],responsePayloadBytes:t.transferSize,startTimeUs:r,timeToResponseInitiatedUs:i,timeToResponseCompletedUs:o})}}var sn=5e3;function cn(){At()&&(setTimeout(function(){return function(){var e=yt.getInstance(),t=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint");if(e.onFirstInputDelay){var r=setTimeout(function(){rn.createOobTrace(t,n),r=void 0},sn);e.onFirstInputDelay(function(e){r&&(clearTimeout(r),rn.createOobTrace(t,n,e))})}else rn.createOobTrace(t,n)}()},0),setTimeout(function(){return function(){for(var e=yt.getInstance(),t=e.getEntriesByType("resource"),n=0,r=t;n<r.length;n++){an(r[n])}e.setupObserver("resource",an)}()},0),setTimeout(function(){return function(){for(var e=yt.getInstance(),t=e.getEntriesByType("measure"),n=0,r=t;n<r.length;n++){un(r[n])}e.setupObserver("measure",un)}()},0))}function un(e){var t=e.name;t.substring(0,pt.length)!==pt&&rn.createUserTimingTrace(t)}var fn=(ln.prototype.trace=function(e){return new rn(e)},Object.defineProperty(ln.prototype,"instrumentationEnabled",{get:function(){return St.getInstance().instrumentationEnabled},set:function(e){St.getInstance().instrumentationEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(ln.prototype,"dataCollectionEnabled",{get:function(){return St.getInstance().dataCollectionEnabled},set:function(e){St.getInstance().dataCollectionEnabled=e},enumerable:!0,configurable:!0}),ln);function ln(e){this.app=e,yt.getInstance().requiredApisAvailable()?(Gt||(Jt(Kt),Gt=!0),Ft().then(cn,cn)):Pt.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled.")}var pn;function hn(e,t){if("[DEFAULT]"!==e.name)throw mt.create("FB not default");if("undefined"==typeof window)throw mt.create("no window");return ut=window,St.getInstance().firebaseAppInstance=e,St.getInstance().installationsService=t,new fn(e)}(pn=te).INTERNAL.registerComponent(new _("performance",function(e){var t=e.getProvider("app").getImmediate(),n=e.getProvider("installations").getImmediate();return hn(t,n)},"PUBLIC")),pn.registerVersion("@firebase/performance","0.3.5");return te.registerVersion("firebase","7.14.6","lite"),te});
|
|
//# sourceMappingURL=firebase-performance-standalone.js.map
|