UNPKG

firebase

Version:

Firebase JavaScript library for web and Node.js

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