firebase 9.12.1 → 9.13.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (53) hide show
  1. package/CHANGELOG.md +36 -0
  2. package/app/dist/index.cjs.js +1 -1
  3. package/app/dist/index.esm.js +1 -1
  4. package/app/dist/index.mjs +1 -1
  5. package/compat/app/dist/index.cjs.js +1 -1
  6. package/compat/app/dist/index.esm.js +1 -1
  7. package/compat/app/dist/index.mjs +1 -1
  8. package/compat/dist/index.esm.js +2 -2
  9. package/compat/dist/index.node.cjs +2 -2
  10. package/compat/dist/index.rn.cjs.js +2 -2
  11. package/firebase-analytics-compat.js +1 -1
  12. package/firebase-analytics.js +1 -1
  13. package/firebase-app-check-compat.js +1 -1
  14. package/firebase-app-check.js +1 -1
  15. package/firebase-app-compat.js +2 -2
  16. package/firebase-app.js +5 -5
  17. package/firebase-auth-compat.js +1 -1
  18. package/firebase-auth-cordova.js +1 -1
  19. package/firebase-auth-react-native.js +1 -1
  20. package/firebase-auth.js +1 -1
  21. package/firebase-compat.js +3 -3
  22. package/firebase-compat.js.map +1 -1
  23. package/firebase-database-compat.js +1 -1
  24. package/firebase-database-compat.js.map +1 -1
  25. package/firebase-database.js +1 -1
  26. package/firebase-database.js.map +1 -1
  27. package/firebase-firestore-compat.js +1 -1
  28. package/firebase-firestore-compat.js.map +1 -1
  29. package/firebase-firestore-lite.js +1 -1
  30. package/firebase-firestore-lite.js.map +1 -1
  31. package/firebase-firestore.js +1 -1
  32. package/firebase-firestore.js.map +1 -1
  33. package/firebase-functions-compat.js +1 -1
  34. package/firebase-functions.js +1 -1
  35. package/firebase-installations-compat.js +1 -1
  36. package/firebase-installations.js +1 -1
  37. package/firebase-messaging-compat.js +1 -1
  38. package/firebase-messaging-compat.js.map +1 -1
  39. package/firebase-messaging-sw.js +1 -1
  40. package/firebase-messaging-sw.js.map +1 -1
  41. package/firebase-messaging.js +1 -1
  42. package/firebase-messaging.js.map +1 -1
  43. package/firebase-performance-compat.js +1 -1
  44. package/firebase-performance-standalone-compat.es2017.js +7 -7
  45. package/firebase-performance-standalone-compat.js +1 -1
  46. package/firebase-performance.js +1 -1
  47. package/firebase-remote-config-compat.js +1 -1
  48. package/firebase-remote-config.js +1 -1
  49. package/firebase-storage-compat.js +1 -1
  50. package/firebase-storage-compat.js.map +1 -1
  51. package/firebase-storage.js +1 -1
  52. package/firebase-storage.js.map +1 -1
  53. package/package.json +28 -28
@@ -1,2 +1,2 @@
1
- !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function f(e,a,s,c){return new(s=s||Promise)(function(r,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function i(e){try{o(c.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,i)}o((c=c.apply(e,a||[])).next())})}function h(r,n){var i,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function a(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[],i=0;i<e.length;i+=3){var o=e[i],a=i+1<e.length,s=a?e[i+1]:0,c=i+2<e.length,u=c?e[i+2]:0,l=(15&s)<<2|u>>6,u=63&u;c||(u=64,a||(l=64)),n.push(r[o>>2],r[(3&o)<<4|s>>4],r[l],r[u])}return n.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],r=0,n=0;r<e.length;){var i,o,a,s=e[r++];s<128?t[n++]=String.fromCharCode(s):191<s&&s<224?(o=e[r++],t[n++]=String.fromCharCode((31&s)<<6|63&o)):239<s&&s<365?(i=((7&s)<<18|(63&(o=e[r++]))<<12|(63&(a=e[r++]))<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))):(o=e[r++],a=e[r++],t[n++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[],i=0;i<e.length;){var o=r[e.charAt(i++)],a=i<e.length?r[e.charAt(i)]:0,s=++i<e.length?r[e.charAt(i)]:64,c=++i<e.length?r[e.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==c)throw Error();n.push(o<<2|a>>4),64!==s&&(n.push(a<<4&240|s>>2),64!==c&&n.push(s<<6&192|c))}return n},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},o=function(e){return t=r(e),i.encodeByteArray(t,!0).replace(/\./g,"");var t};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var r in t)t.hasOwnProperty(r)&&"__proto__"!==r&&(e[r]=c(e[r],t[r]));return e}function t(){return"object"==typeof indexedDB}function s(){return new Promise(function(e,t){try{var r=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=function(){i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=function(){r=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}function e(){return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__}function u(){if("undefined"!=typeof document){try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var e=e&&function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return e&&JSON.parse(e)}}function l(){try{return e()||function(){if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||u()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}}var g=function(){var e;return null===(e=l())||void 0===e?void 0:e.config},m=(b.prototype.wrapCallback=function(r){var n=this;return function(e,t){e?n.reject(e):n.resolve(t),"function"==typeof r&&(n.promise.catch(function(){}),1===r.length?r(e):r(e,t))}},b);function b(){var r=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){r.resolve=e,r.reject=t})}var y,_=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(w,y=Error),w);function w(e,t,r){var n=y.call(this,t)||this;return n.code=e,n.customData=r,n.name="FirebaseError",Object.setPrototypeOf(n,w.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,E.prototype.create),n}var E=(I.prototype.create=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n,i=t[0]||{},o=this.service+"/"+e,a=this.errors[e],a=a?(n=i,a.replace(S,function(e,t){var r=n[t];return null!=r?String(r):"<"+t+"?>"})):"Error",a=this.serviceName+": "+a+" ("+o+").";return new _(o,a,i)},I);function I(e,t,r){this.service=e,this.serviceName=t,this.errors=r}var S=/\{\$([^}]+)}/g;function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){if(e===t)return 1;for(var r=Object.keys(e),n=Object.keys(t),i=0,o=r;i<o.length;i++){var a=o[i];if(!n.includes(a))return;var s=e[a],c=t[a];if(A(s)&&A(c)){if(!C(s,c))return}else if(s!==c)return}for(var u=0,l=n;u<l.length;u++){a=l[u];if(!r.includes(a))return}return 1}function A(e){return null!==e&&"object"==typeof e}function O(e,t){var r=new D(e,t);return r.subscribe.bind(r)}var D=(N.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},N.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},N.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},N.prototype.subscribe=function(e,t,r){var n,i=this;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");void 0===(n=function(e,t){if("object"!=typeof e||null===e)return!1;for(var r=0,n=t;r<n.length;r++){var i=n[r];if(i in e&&"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&&(n.next=P),void 0===n.error&&(n.error=P),void 0===n.complete&&(n.complete=P);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?n.error(i.finalError):n.complete()}catch(e){}}),this.observers.push(n),o},N.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},N.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},N.prototype.sendOne=function(e,t){var r=this;this.task.then(function(){if(void 0!==r.observers&&void 0!==r.observers[e])try{t(r.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},N.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},N);function N(e,t){var r=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(r)}).catch(function(e){r.error(e)})}function P(){}var k=(M.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},M.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},M.prototype.setServiceProps=function(e){return this.serviceProps=e,this},M.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},M);function M(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}var L="[DEFAULT]",B=(R.prototype.get=function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var r=new m;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{var n=this.getOrInitializeService({instanceIdentifier:t});n&&r.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise},R.prototype.getImmediate=function(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(r=null==e?void 0:e.optional)&&void 0!==r&&r;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service "+this.name+" is not available")}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}},R.prototype.getComponent=function(){return this.component},R.prototype.setComponent=function(e){var t,r;if(e.name!==this.name)throw Error("Mismatching Component "+e.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:L})}catch(e){}try{for(var n=d(this.instancesDeferred.entries()),i=n.next();!i.done;i=n.next()){var o=v(i.value,2),a=o[0],s=o[1],c=this.normalizeInstanceIdentifier(a);try{var u=this.getOrInitializeService({instanceIdentifier:c});s.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}},R.prototype.clearInstance=function(e){this.instancesDeferred.delete(e=void 0===e?L:e),this.instancesOptions.delete(e),this.instances.delete(e)},R.prototype.delete=function(){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(a(a([],v(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()}))),v(t.filter(function(e){return"_delete"in e}).map(function(e){return e._delete()}))))];case 1:return e.sent(),[2]}})})},R.prototype.isComponentSet=function(){return null!=this.component},R.prototype.isInitialized=function(e){return this.instances.has(e=void 0===e?L:e)},R.prototype.getOptions=function(e){return this.instancesOptions.get(e=void 0===e?L:e)||{}},R.prototype.initialize=function(e){var t,r,n=(e=void 0===e?{}:e).options,n=void 0===n?{}:n,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(this.name+"("+i+") has already been initialized");if(!this.isComponentSet())throw Error("Component "+this.name+" has not been registered yet");var o=this.getOrInitializeService({instanceIdentifier:i,options:n});try{for(var a=d(this.instancesDeferred.entries()),s=a.next();!s.done;s=a.next()){var c=v(s.value,2),u=c[0],l=c[1];i===this.normalizeInstanceIdentifier(u)&&l.resolve(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},R.prototype.onInit=function(e,t){var r=this.normalizeInstanceIdentifier(t),n=null!==(i=this.onInitCallbacks.get(r))&&void 0!==i?i:new Set;n.add(e),this.onInitCallbacks.set(r,n);var i=this.instances.get(r);return i&&e(i,r),function(){n.delete(e)}},R.prototype.invokeOnInitCallbacks=function(e,t){var r,n,i=this.onInitCallbacks.get(t);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next()){var s=a.value;try{s(e,t)}catch(e){}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},R.prototype.getOrInitializeService=function(e){var t=e.instanceIdentifier,r=e.options,n=void 0===r?{}:r,r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(e=t)===L?void 0:e,options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch(e){}return r||null},R.prototype.normalizeInstanceIdentifier=function(e){return void 0===e&&(e=L),!this.component||this.component.multipleInstances?e:L},R.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},R);function R(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}var j=(F.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)},F.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},F.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new B(e,this);return this.providers.set(e,t),t},F.prototype.getProviders=function(){return Array.from(this.providers.values())},F);function F(e){this.name=e,this.providers=new Map}var x,U=[];(ir=x=x||{})[ir.DEBUG=0]="DEBUG",ir[ir.VERBOSE=1]="VERBOSE",ir[ir.INFO=2]="INFO",ir[ir.WARN=3]="WARN",ir[ir.ERROR=4]="ERROR",ir[ir.SILENT=5]="SILENT";function H(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!(t<e.logLevel)){var i=(new Date).toISOString(),o=W[t];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[o].apply(console,a(["["+i+"] "+e.name+":"],r))}}var z,V={debug:x.DEBUG,verbose:x.VERBOSE,info:x.INFO,warn:x.WARN,error:x.ERROR,silent:x.SILENT},q=x.INFO,W=((et={})[x.DEBUG]="log",et[x.VERBOSE]="log",et[x.INFO]="info",et[x.WARN]="warn",et[x.ERROR]="error",et),$=(Object.defineProperty(K.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in x))throw new TypeError('Invalid value "'+e+'" assigned to `logLevel`');this._logLevel=e},enumerable:!1,configurable:!0}),K.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?V[e]:e},Object.defineProperty(K.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(K.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),K.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.DEBUG],e)),this._logHandler.apply(this,a([this,x.DEBUG],e))},K.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.VERBOSE],e)),this._logHandler.apply(this,a([this,x.VERBOSE],e))},K.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.INFO],e)),this._logHandler.apply(this,a([this,x.INFO],e))},K.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.WARN],e)),this._logHandler.apply(this,a([this,x.WARN],e))},K.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.ERROR],e)),this._logHandler.apply(this,a([this,x.ERROR],e))},K);function K(e){this.name=e,this._logLevel=q,this._logHandler=H,this._userLogHandler=null,U.push(this)}function J(a,t){for(var e=0,r=U;e<r.length;e++)!function(e){var o=null;t&&t.level&&(o=V[t.level]),e.userLogHandler=null===a?null:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=r.map(function(e){if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(function(e){return e}).join(" ");t>=(null!=o?o:e.logLevel)&&a({level:x[t].toLowerCase(),message:i,args:r,type:e.name})}}(r[e])}const G=(t,e)=>e.some(e=>t instanceof e);let Y,X;const Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap;let ne={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return Q.get(e);if("objectStoreNames"===t)return e.objectStoreNames||ee.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return ae(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function ie(n){return n!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(X=X||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(n)?function(...e){return n.apply(se(this),e),ae(Z.get(this))}:function(...e){return ae(n.apply(se(this),e))}:function(e,...t){var r=n.call(se(this),e,...t);return ee.set(r,e.sort?e.sort():[e]),ae(r)}}function oe(e){return"function"==typeof e?ie(e):(e instanceof IDBTransaction&&(o=e,Q.has(o)||(t=new Promise((e,t)=>{const r=()=>{o.removeEventListener("complete",n),o.removeEventListener("error",i),o.removeEventListener("abort",i)},n=()=>{e(),r()},i=()=>{t(o.error||new DOMException("AbortError","AbortError")),r()};o.addEventListener("complete",n),o.addEventListener("error",i),o.addEventListener("abort",i)}),Q.set(o,t))),G(e,Y=Y||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,ne):e);var o,t}function ae(e){if(e instanceof IDBRequest)return function(o){const e=new Promise((e,t)=>{const r=()=>{o.removeEventListener("success",n),o.removeEventListener("error",i)},n=()=>{e(ae(o.result)),r()},i=()=>{t(o.error),r()};o.addEventListener("success",n),o.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&Z.set(e,o)}).catch(()=>{}),re.set(e,o),e}(e);if(te.has(e))return te.get(e);var t=oe(e);return t!==e&&(te.set(e,t),re.set(t,e)),t}const se=e=>re.get(e);function ce(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){const a=indexedDB.open(e,t),s=ae(a);return n&&a.addEventListener("upgradeneeded",e=>{n(ae(a.result),e.oldVersion,e.newVersion,ae(a.transaction))}),r&&a.addEventListener("blocked",()=>r()),s.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),s}const ue=["get","getKey","getAll","getAllKeys","count"],le=["put","add","delete","clear"],fe=new Map;function pe(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(fe.get(t))return fe.get(t);const i=t.replace(/FromIndex$/,""),o=t!==i,a=le.includes(i);if(i in(o?IDBIndex:IDBObjectStore).prototype&&(a||ue.includes(i))){var r=async function(e,...t){var r=this.transaction(e,a?"readwrite":"readonly");let n=r.store;return o&&(n=n.index(t.shift())),(await Promise.all([n[i](...t),a&&r.done]))[0]};return fe.set(t,r),r}}}ne={...z=ne,get:(e,t,r)=>pe(e,t)||z.get(e,t,r),has:(e,t)=>!!pe(e,t)||z.has(e,t)};var he=(de.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(e){if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return t.library+"/"+t.version}).filter(function(e){return e}).join(" ")},de);function de(e){this.container=e}var ve="@firebase/app",ge=new $("@firebase/app"),me="[DEFAULT]",be=((Te={})[ve]="fire-core",Te["@firebase/app-compat"]="fire-core-compat",Te["@firebase/analytics"]="fire-analytics",Te["@firebase/analytics-compat"]="fire-analytics-compat",Te["@firebase/app-check"]="fire-app-check",Te["@firebase/app-check-compat"]="fire-app-check-compat",Te["@firebase/auth"]="fire-auth",Te["@firebase/auth-compat"]="fire-auth-compat",Te["@firebase/database"]="fire-rtdb",Te["@firebase/database-compat"]="fire-rtdb-compat",Te["@firebase/functions"]="fire-fn",Te["@firebase/functions-compat"]="fire-fn-compat",Te["@firebase/installations"]="fire-iid",Te["@firebase/installations-compat"]="fire-iid-compat",Te["@firebase/messaging"]="fire-fcm",Te["@firebase/messaging-compat"]="fire-fcm-compat",Te["@firebase/performance"]="fire-perf",Te["@firebase/performance-compat"]="fire-perf-compat",Te["@firebase/remote-config"]="fire-rc",Te["@firebase/remote-config-compat"]="fire-rc-compat",Te["@firebase/storage"]="fire-gcs",Te["@firebase/storage-compat"]="fire-gcs-compat",Te["@firebase/firestore"]="fire-fst",Te["@firebase/firestore-compat"]="fire-fst-compat",Te["fire-js"]="fire-js",Te.firebase="fire-js-all",Te),ye=new Map,_e=new Map;function we(t,r){try{t.container.addComponent(r)}catch(e){ge.debug("Component "+r.name+" failed to register with FirebaseApp "+t.name,e)}}function Ee(e,t){e.container.addOrOverwriteComponent(t)}function Ie(e){var t,r,n=e.name;if(_e.has(n))return ge.debug("There were multiple attempts to register component "+n+"."),!1;_e.set(n,e);try{for(var i=d(ye.values()),o=i.next();!o.done;o=i.next())we(o.value,e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!0}function Se(e,t){var r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}var Te=((et={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",et["bad-app-name"]="Illegal App name: '{$appName}",et["duplicate-app"]="Firebase App named '{$appName}' already exists with different options or config",et["app-deleted"]="Firebase App named '{$appName}' already deleted",et["no-options"]="Need to provide options, when not being deployed to hosting via source.",et["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",et["invalid-log-argument"]="First argument to `onLog` must be null or a function.",et["idb-open"]="Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",et["idb-get"]="Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",et["idb-set"]="Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",et["idb-delete"]="Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",et),Ce=new E("app","Firebase",Te),Ae=(Object.defineProperty(Oe.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"name",{get:function(){return this.checkDestroyed(),this._name},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"options",{get:function(){return this.checkDestroyed(),this._options},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"config",{get:function(){return this.checkDestroyed(),this._config},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"isDeleted",{get:function(){return this._isDeleted},set:function(e){this._isDeleted=e},enumerable:!1,configurable:!0}),Oe.prototype.checkDestroyed=function(){if(this.isDeleted)throw Ce.create("app-deleted",{appName:this._name})},Oe);function Oe(e,t,r){var n=this;this._isDeleted=!1,this._options=p({},e),this._config=p({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new k("app",function(){return n},"PUBLIC"))}var De="9.12.1";function Ne(e,t){var r,n,i=e,o=p({name:me,automaticDataCollectionEnabled:!1},t="object"!=typeof(t=void 0===t?{}:t)?{name:t}:t),a=o.name;if("string"!=typeof a||!a)throw Ce.create("bad-app-name",{appName:String(a)});if(!(i=i||g()))throw Ce.create("no-options");var s=ye.get(a);if(s){if(C(i,s.options)&&C(o,s.config))return s;throw Ce.create("duplicate-app",{appName:a})}var c=new j(a);try{for(var u=d(_e.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&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}o=new Ae(i,o,c);return ye.set(a,o),o}function Pe(r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return(t=r.name,ye.has(t))?(ye.delete(t),[4,Promise.all(r.container.getProviders().map(function(e){return e.delete()}))]):[3,2];case 1:e.sent(),r.isDeleted=!0,e.label=2;case 2:return[2]}})})}function ke(e,t,r){var n=null!==(a=be[e])&&void 0!==a?a:e;r&&(n+="-"+r);var i=n.match(/\s|\//),o=t.match(/\s|\//);if(i||o){var a=['Unable to register library "'+n+'" with version "'+t+'":'];return i&&a.push('library name "'+n+'" contains illegal characters (whitespace or "/")'),i&&o&&a.push("and"),o&&a.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void ge.warn(a.join(" "))}Ie(new k(n+"-version",function(){return{library:n,version:t}},"VERSION"))}function Me(e,t){if(null!==e&&"function"!=typeof e)throw Ce.create("invalid-log-argument");J(e,t)}function Le(e){var t;t=e,U.forEach(function(e){e.setLogLevel(t)})}var Be="firebase-heartbeat-database",Re=1,je="firebase-heartbeat-store",Fe=null;function xe(){return Fe=Fe||ce(Be,Re,{upgrade:function(e,t){0===t&&e.createObjectStore(je)}}).catch(function(e){throw Ce.create("idb-open",{originalErrorMessage:e.message})})}function Ue(n,i){var o;return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,xe()];case 1:return r=e.sent(),t=r.transaction(je,"readwrite"),[4,t.objectStore(je).put(i,He(n))];case 2:return e.sent(),[2,t.done];case 3:return(r=e.sent())instanceof _?ge.warn(r.message):(r=Ce.create("idb-set",{originalErrorMessage:null===(o=r)||void 0===o?void 0:o.message}),ge.warn(r.message)),[3,4];case 4:return[2]}})})}function He(e){return e.name+"!"+e.options.appId}var ze=(Ve.prototype.triggerHeartbeat=function(){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return(t=this.container.getProvider("platform-logger").getImmediate(),t=t.getPlatformInfoString(),r=qe(),null!==this._heartbeatsCache)?[3,2]:[4,(n=this)._heartbeatsCachePromise];case 1:n._heartbeatsCache=e.sent(),e.label=2;case 2:return this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(function(e){return e.date===r})?[2]:(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),[2,this._storage.overwrite(this._heartbeatsCache)])}})})},Ve.prototype.getHeartbeatsHeader=function(){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return null!==this._heartbeatsCache?[3,2]:[4,this._heartbeatsCachePromise];case 1:e.sent(),e.label=2;case 2:return null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length?[2,""]:(t=qe(),r=function(e,r){var t,n;void 0===r&&(r=1024);var i=[],o=e.slice();try{for(var a=d(e),s=a.next();!s.done;s=a.next())if("break"===function(t){var e=i.find(function(e){return e.agent===t.agent});if(e){if(e.dates.push(t.date),Je(i)>r)return e.dates.pop(),"break"}else if(i.push({agent:t.agent,dates:[t.date]}),Je(i)>r)return i.pop(),"break";o=o.slice(1)}(s.value))break}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return{heartbeatsToSend:i,unsentEntries:o}}(this._heartbeatsCache.heartbeats),n=r.heartbeatsToSend,r=r.unsentEntries,n=o(JSON.stringify({version:2,heartbeats:n})),this._heartbeatsCache.lastSentHeartbeatDate=t,0<r.length?(this._heartbeatsCache.heartbeats=r,[4,this._storage.overwrite(this._heartbeatsCache)]):[3,4]);case 3:return e.sent(),[3,5];case 4:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache),e.label=5;case 5:return[2,n]}})})},Ve);function Ve(e){var t=this;this.container=e,this._heartbeatsCache=null;var r=this.container.getProvider("app").getImmediate();this._storage=new $e(r),this._heartbeatsCachePromise=this._storage.read().then(function(e){return t._heartbeatsCache=e})}function qe(){return(new Date).toISOString().substring(0,10)}var We,$e=(Ke.prototype.runIndexedDBEnvironmentCheck=function(){return f(this,void 0,void 0,function(){return h(this,function(e){return t()?[2,s().then(function(){return!0}).catch(function(){return!1})]:[2,!1]})})},Ke.prototype.read=function(){return f(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2,{heartbeats:[]}];case 2:return[4,function(r){var n;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,xe()];case 1:return[2,e.sent().transaction(je).objectStore(je).get(He(r))];case 2:return(t=e.sent())instanceof _?ge.warn(t.message):(t=Ce.create("idb-get",{originalErrorMessage:null===(n=t)||void 0===n?void 0:n.message}),ge.warn(t.message)),[3,3];case 3:return[2]}})})}(this.app)];case 3:return[2,e.sent()||{heartbeats:[]}]}})})},Ke.prototype.overwrite=function(r){var n;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,Ue(this.app,{lastSentHeartbeatDate:null!==(n=r.lastSentHeartbeatDate)&&void 0!==n?n:t.lastSentHeartbeatDate,heartbeats:r.heartbeats})]}})})},Ke.prototype.add=function(r){var n;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,Ue(this.app,{lastSentHeartbeatDate:null!==(n=r.lastSentHeartbeatDate)&&void 0!==n?n:t.lastSentHeartbeatDate,heartbeats:a(a([],v(t.heartbeats)),v(r.heartbeats))})]}})})},Ke);function Ke(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}function Je(e){return o(JSON.stringify({version:2,heartbeats:e})).length}We="",Ie(new k("platform-logger",function(e){return new he(e)},"PRIVATE")),Ie(new k("heartbeat",function(e){return new ze(e)},"PRIVATE")),ke(ve,"0.8.2",We),ke(ve,"0.8.2","esm5"),ke("fire-js","");var Ge=Object.freeze({__proto__:null,SDK_VERSION:De,_DEFAULT_ENTRY_NAME:me,_addComponent:we,_addOrOverwriteComponent:Ee,_apps:ye,_clearComponents:function(){_e.clear()},_components:_e,_getProvider:Se,_registerComponent:Ie,_removeServiceInstance:function(e,t,r){void 0===r&&(r=me),Se(e,t).clearInstance(r)},deleteApp:Pe,getApp:function(e){var t=ye.get(e=void 0===e?me:e);if(!t&&e===me)return Ne();if(!t)throw Ce.create("no-app",{appName:e});return t},getApps:function(){return Array.from(ye.values())},initializeApp:Ne,onLog:Me,registerVersion:ke,setLogLevel:Le,FirebaseError:_}),Ye=(Object.defineProperty(Xe.prototype,"automaticDataCollectionEnabled",{get:function(){return this._delegate.automaticDataCollectionEnabled},set:function(e){this._delegate.automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Xe.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(Xe.prototype,"options",{get:function(){return this._delegate.options},enumerable:!1,configurable:!0}),Xe.prototype.delete=function(){var t=this;return new Promise(function(e){t._delegate.checkDestroyed(),e()}).then(function(){return t.firebase.INTERNAL.removeApp(t.name),Pe(t._delegate)})},Xe.prototype._getService=function(e,t){var r;void 0===t&&(t=me),this._delegate.checkDestroyed();var n=this._delegate.container.getProvider(e);return n.isInitialized()||"EXPLICIT"!==(null===(r=n.getComponent())||void 0===r?void 0:r.instantiationMode)||n.initialize(),n.getImmediate({identifier:t})},Xe.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=me),this._delegate.container.getProvider(e).clearInstance(t)},Xe.prototype._addComponent=function(e){we(this._delegate,e)},Xe.prototype._addOrOverwriteComponent=function(e){Ee(this._delegate,e)},Xe.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},Xe);function Xe(e,t){var r=this;this._delegate=e,this.firebase=t,we(e,new k("app-compat",function(){return r},"PUBLIC")),this.container=e.container}var Te=((et={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",et["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",et),Ze=new E("app-compat","Firebase",Te);function Qe(i){var o={},a={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});var r=Ne(e,t);if(T(o,r.name))return o[r.name];var n=new i(r,a);return o[r.name]=n},app:s,registerVersion:ke,setLogLevel:Le,onLog:Me,apps:null,SDK_VERSION:De,INTERNAL:{registerComponent:function(r){var n=r.name,t=n.replace("-compat","");{var e;Ie(r)&&"PUBLIC"===r.type&&(e=function(e){if("function"!=typeof(e=void 0===e?s():e)[t])throw Ze.create("invalid-app-argument",{appName:n});return e[t]()},void 0!==r.serviceProps&&c(e,r.serviceProps),a[t]=e,i.prototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,n).apply(this,r.multipleInstances?e:[])})}return"PUBLIC"===r.type?a[t]:null},removeApp:function(e){delete o[e]},useAsService:function(e,t){return"serverAuth"!==t?t:null},modularAPIs:Ge}};function s(e){if(!T(o,e=e||me))throw Ze.create("no-app",{appName:e});return o[e]}return a.default=a,Object.defineProperty(a,"apps",{get:function(){return Object.keys(o).map(function(e){return o[e]})}}),s.App=i,a}var et=function e(){var t=Qe(Ye);return t.INTERNAL=p(p({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:O,ErrorFactory:E,deepExtend:c}),t}(),Te=new $("@firebase/app-compat");"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(Te.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(rt=self.firebase.SDK_VERSION)&&0<=rt.indexOf("LITE")&&Te.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n "));var tt=et;ke("@firebase/app-compat","0.1.37",void 0);tt.registerVersion("firebase","9.12.1","app-compat");var rt="@firebase/installations",Te="0.5.15",nt=1e4,it="w:"+Te,ot="FIS_v2",at="https://firebaseinstallations.googleapis.com/v1",st=36e5,et=((et={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',et["not-registered"]="Firebase Installation is not registered.",et["installation-not-found"]="Firebase Installation not found.",et["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',et["app-offline"]="Could not process request. Application offline.",et["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",et),ct=new E("installations","Installations",et);function ut(e){return e instanceof _&&e.code.includes("request-failed")}function lt(e){var t=e.projectId;return at+"/projects/"+t+"/installations"}function ft(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}function pt(r,n){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,n.json()];case 1:return t=e.sent(),t=t.error,[2,ct.create("request-failed",{requestName:r,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function ht(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function dt(e,t){var r=t.refreshToken,n=ht(e);return n.append("Authorization",ot+" "+r),n}function vt(r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,r()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,r()]:[2,t]}})})}function gt(t){return new Promise(function(e){setTimeout(e,t)})}var mt=/^[cdef][\w-]{21}$/,bt="";function yt(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return btoa(String.fromCharCode.apply(String,a([],v(e)))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22);return mt.test(t)?t:bt}catch(e){return bt}}function _t(e){return e.appName+"!"+e.appId}var wt=new Map;function Et(e,t){var r=_t(e);It(r,t),function(e,t){var r=function(){!St&&"BroadcastChannel"in self&&((St=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){It(e.data.key,e.data.fid)});return St}();r&&r.postMessage({key:e,fid:t});0===wt.size&&St&&(St.close(),St=null)}(r,t)}function It(e,t){var r,n,i=wt.get(e);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next())(0,a.value)(t)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}var St=null;var Tt="firebase-installations-store",Ct=null;function At(){return Ct=Ct||ce("firebase-installations-database",1,{upgrade:function(e,t){0===t&&e.createObjectStore(Tt)}})}function Ot(o,a){return f(this,void 0,void 0,function(){var t,r,n,i;return h(this,function(e){switch(e.label){case 0:return t=_t(o),[4,At()];case 1:return n=e.sent(),r=n.transaction(Tt,"readwrite"),[4,(n=r.objectStore(Tt)).get(t)];case 2:return i=e.sent(),[4,n.put(a,t)];case 3:return e.sent(),[4,r.done];case 4:return e.sent(),i&&i.fid===a.fid||Et(o,a.fid),[2,a]}})})}function Dt(n){return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return t=_t(n),[4,At()];case 1:return r=e.sent(),[4,(r=r.transaction(Tt,"readwrite")).objectStore(Tt).delete(t)];case 2:return e.sent(),[4,r.done];case 3:return e.sent(),[2]}})})}function Nt(a,s){return f(this,void 0,void 0,function(){var t,r,n,i,o;return h(this,function(e){switch(e.label){case 0:return t=_t(a),[4,At()];case 1:return n=e.sent(),r=n.transaction(Tt,"readwrite"),[4,(n=r.objectStore(Tt)).get(t)];case 2:return i=e.sent(),void 0!==(o=s(i))?[3,4]:[4,n.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,n.put(o,t)];case 5:e.sent(),e.label=6;case 6:return[4,r.done];case 7:return e.sent(),!o||i&&i.fid===o.fid||Et(a,o.fid),[2,o]}})})}function Pt(i){return f(this,void 0,void 0,function(){var r,t,n;return h(this,function(e){switch(e.label){case 0:return[4,Nt(i.appConfig,function(e){var t=Mt(e||{fid:yt(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return[4,kt(i.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,gt(100)];case 3:return e.sent(),[4,kt(i.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,Pt(i)];case 6:return n=e.sent(),r=n.installationEntry,(n=n.registrationPromise)?[2,n]:[2,r];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var r=Promise.reject(ct.create("app-offline"));return{installationEntry:t,registrationPromise:r}}var n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=function(n,i){return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(e,t){var s=e.appConfig,c=e.heartbeatServiceProvider,u=t.fid;return f(this,void 0,void 0,function(){var t,r,n,i,o,a;return h(this,function(e){switch(e.label){case 0:return t=lt(s),r=ht(s),(n=c.getImmediate({optional:!0}))?[4,n.getHeartbeatsHeader()]:[3,2];case 1:(n=e.sent())&&r.append("x-firebase-client",n),e.label=2;case 2:return a={fid:u,authVersion:ot,appId:s.appId,sdkVersion:it},i={method:"POST",headers:r,body:JSON.stringify(a)},[4,vt(function(){return fetch(t,i)})];case 3:return(o=e.sent()).ok?[4,o.json()]:[3,5];case 4:return a=e.sent(),[2,{fid:a.fid||u,registrationStatus:2,refreshToken:a.refreshToken,authToken:ft(a.authToken)}];case 5:return[4,pt("Create Installation",o)];case 6:throw e.sent()}})})}(n,i)];case 1:return t=e.sent(),[2,Ot(n.appConfig,t)];case 2:return ut(r=e.sent())&&409===r.customData.serverCode?[4,Dt(n.appConfig)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,Ot(n.appConfig,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw r;case 7:return[2]}})})}(e,n);return{installationEntry:n,registrationPromise:r}}}(i,t);return r=t.registrationPromise,t.installationEntry})];case 1:return(t=e.sent()).fid!==bt?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function kt(e){return Nt(e,function(e){if(!e)throw ct.create("installation-not-found");return Mt(e)})}function Mt(e){return 1===(t=e).registrationStatus&&t.registrationTime+nt<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}function Lt(e,c){var u=e.appConfig,l=e.heartbeatServiceProvider;return f(this,void 0,void 0,function(){var r,n,i,o,a,s;return h(this,function(e){switch(e.label){case 0:return t=c.fid,r=lt(u)+"/"+t+"/authTokens:generate",n=dt(u,c),(i=l.getImmediate({optional:!0}))?[4,i.getHeartbeatsHeader()]:[3,2];case 1:(i=e.sent())&&n.append("x-firebase-client",i),e.label=2;case 2:return s={installation:{sdkVersion:it,appId:u.appId}},o={method:"POST",headers:n,body:JSON.stringify(s)},[4,vt(function(){return fetch(r,o)})];case 3:return(a=e.sent()).ok?[4,a.json()]:[3,5];case 4:return s=e.sent(),[2,ft(s)];case 5:return[4,pt("Generate Auth Token",a)];case 6:throw e.sent()}var t})})}function Bt(i,o){return void 0===o&&(o=!1),f(this,void 0,void 0,function(){var n,t,r;return h(this,function(e){switch(e.label){case 0:return[4,Nt(i.appConfig,function(e){if(!jt(e))throw ct.create("not-registered");var t,r=e.authToken;if(o||2!==(t=r).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+st}(t)){if(1===r.requestStatus)return n=function(n,i){return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return[4,Rt(n.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,gt(100)];case 3:return e.sent(),[4,Rt(n.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0===(r=t.authToken).requestStatus?[2,Bt(n,i)]:[2,r]}})})}(i,o),e;if(!navigator.onLine)throw ct.create("app-offline");r=(t=e,r={requestStatus:1,requestTime:Date.now()},p(p({},t),{authToken:r}));return n=function(i,o){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,Lt(i,o)];case 1:return t=e.sent(),n=p(p({},o),{authToken:t}),[4,Ot(i.appConfig,n)];case 2:return e.sent(),[2,t];case 3:return!ut(r=e.sent())||401!==r.customData.serverCode&&404!==r.customData.serverCode?[3,5]:[4,Dt(i.appConfig)];case 4:return e.sent(),[3,7];case 5:return n=p(p({},o),{authToken:{requestStatus:0}}),[4,Ot(i.appConfig,n)];case 6:e.sent(),e.label=7;case 7:throw r;case 8:return[2]}})})}(i,r),r}return e})];case 1:return t=e.sent(),n?[4,n]:[3,3];case 2:return r=e.sent(),[3,4];case 3:r=t.authToken,e.label=4;case 4:return[2,r]}})})}function Rt(e){return Nt(e,function(e){if(!jt(e))throw ct.create("not-registered");var t,r=e.authToken;return 1===(t=r).requestStatus&&t.requestTime+nt<Date.now()?p(p({},e),{authToken:{requestStatus:0}}):e})}function jt(e){return void 0!==e&&2===e.registrationStatus}function Ft(r,n){return void 0===n&&(n=!1),f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,function(r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,Pt(r)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t=r)];case 1:return e.sent(),[4,Bt(t,n)];case 2:return[2,e.sent().token]}})})}function xt(e){return ct.create("missing-app-config-values",{valueName:e})}function Ut(e){var t=Se(e.getProvider("app").getImmediate(),Ht).getImmediate();return{getId:function(){return function(i){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return[4,Pt(t=i)];case 1:return r=e.sent(),n=r.installationEntry,(r.registrationPromise||Bt(t)).catch(console.error),[2,n.fid]}})})}(t)},getToken:function(e){return Ft(t,e)}}}var Ht="installations";Ie(new k(Ht,function(e){var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){var t,r;if(!e||!e.options)throw xt("App Configuration");if(!e.name)throw xt("App Name");try{for(var n=d(["projectId","apiKey","appId"]),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e.options[o])throw xt(o)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:Se(t,"heartbeat"),_delete:function(){return Promise.resolve()}}},"PUBLIC")),Ie(new k("installations-internal",Ut,"PRIVATE")),ke(rt,Te),ke(rt,Te,"esm5");var zt,Vt,qt="@firebase/performance",Wt="0.5.15",$t=Wt,Kt="FB-PERF-TRACE-MEASURE",Jt="@firebase/performance/config",Gt="@firebase/performance/configexpire",rt="Performance",Te=((Te={})["trace started"]="Trace {$traceName} was started before.",Te["trace stopped"]="Trace {$traceName} is not running.",Te["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",Te["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",Te["no window"]="Window is not available.",Te["no app id"]="App id is not available.",Te["no project id"]="Project id is not available.",Te["no api key"]="Api key is not available.",Te["invalid cc log"]="Attempted to queue invalid cc event",Te["FB not default"]="Performance can only start when Firebase app instance is the default one.",Te["RC response not ok"]="RC response is not ok",Te["invalid attribute name"]="Attribute name {$attributeName} is invalid.",Te["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",Te["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",Te["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",Te["already initialized"]="initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance.",Te),Yt=new E("performance",rt,Te),Xt=new $(rt);Xt.logLevel=x.INFO;var Zt,Qt,er=(tr.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},tr.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},tr.prototype.measure=function(e,t,r){this.performance&&this.performance.measure&&this.performance.measure(e,t,r)},tr.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},tr.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},tr.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},tr.prototype.requiredApisAvailable=function(){return fetch&&Promise&&"undefined"!=typeof navigator&&navigator.cookieEnabled?!!t()||(Xt.info("IndexedDB is not supported by current browswer"),!1):(Xt.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},tr.prototype.setupObserver=function(e,i){this.PerformanceObserver&&new this.PerformanceObserver(function(e){for(var t=0,r=e.getEntries();t<r.length;t++){var n=r[t];i(n)}}).observe({entryTypes:[e]})},tr.getInstance=function(){return zt=void 0===zt?new tr(Vt):zt},tr);function tr(e){if(!(this.window=e))throw Yt.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 rr(e,t){var r=e.length-t.length;if(r<0||1<r)throw Yt.create("invalid String merger input");for(var n=[],i=0;i<e.length;i++)n.push(e.charAt(i)),t.length>i&&n.push(t.charAt(i));return n.join("")}var nr,ir,or=(ar.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},ar.getInstance=function(){return Qt=void 0===Qt?new ar:Qt},ar);function ar(){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=rr("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=rr("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(ir=nr=nr||{})[ir.UNKNOWN=0]="UNKNOWN",ir[ir.VISIBLE=1]="VISIBLE",ir[ir.HIDDEN=2]="HIDDEN";var sr=["firebase_","google_","ga_"],cr=new RegExp("^[a-zA-Z]\\w*$");function ur(){switch(er.getInstance().document.visibilityState){case"visible":return nr.VISIBLE;case"hidden":return nr.HIDDEN;default:return nr.UNKNOWN}}function lr(e){var t=null===(t=e.options)||void 0===t?void 0:t.appId;if(!t)throw Yt.create("no app id");return t}var fr="0.0.1",pr={loggingEnabled:!0},hr="FIREBASE_INSTALLATIONS_AUTH";function dr(e,t){var n,i,r=function(){var e=er.getInstance().localStorage;if(e){var t=e.getItem(Gt);if(t&&function(e){return Number(e)>Date.now()}(t)){e=e.getItem(Jt);if(e)try{return JSON.parse(e)}catch(e){return}}}}();return r?(gr(r),Promise.resolve()):(i=t,function(e){var t=e.getToken();return t.then(function(e){}),t}((n=e).installations).then(function(e){var t=function(e){var t=null===(t=e.options)||void 0===t?void 0:t.projectId;if(!t)throw Yt.create("no project id");return t}(n.app),r=function(e){var t=null===(t=e.options)||void 0===t?void 0:t.apiKey;if(!t)throw Yt.create("no api key");return t}(n.app),r=new Request("https://firebaseremoteconfig.googleapis.com/v1/projects/"+t+"/namespaces/fireperf:fetch?key="+r,{method:"POST",headers:{Authorization:hr+" "+e},body:JSON.stringify({app_instance_id:i,app_instance_id_token:e,app_id:lr(n.app),app_version:$t,sdk_version:fr})});return fetch(r).then(function(e){if(e.ok)return e.json();throw Yt.create("RC response not ok")})}).catch(function(){Xt.info(vr)}).then(gr).then(function(e){var t;e=e,t=er.getInstance().localStorage,e&&t&&(t.setItem(Jt,JSON.stringify(e)),t.setItem(Gt,String(Date.now()+60*or.getInstance().configTimeToLive*60*1e3)))},function(){}))}var vr="Could not fetch config, will use default configs";function gr(e){if(!e)return e;var t=or.getInstance(),r=e.entries||{};return void 0!==r.fpr_enabled?t.loggingEnabled="true"===String(r.fpr_enabled):t.loggingEnabled=pr.loggingEnabled,r.fpr_log_source?t.logSource=Number(r.fpr_log_source):pr.logSource&&(t.logSource=pr.logSource),r.fpr_log_endpoint_url?t.logEndPointUrl=r.fpr_log_endpoint_url:pr.logEndPointUrl&&(t.logEndPointUrl=pr.logEndPointUrl),r.fpr_log_transport_key?t.transportKey=r.fpr_log_transport_key:pr.transportKey&&(t.transportKey=pr.transportKey),void 0!==r.fpr_vc_network_request_sampling_rate?t.networkRequestsSamplingRate=Number(r.fpr_vc_network_request_sampling_rate):void 0!==pr.networkRequestsSamplingRate&&(t.networkRequestsSamplingRate=pr.networkRequestsSamplingRate),void 0!==r.fpr_vc_trace_sampling_rate?t.tracesSamplingRate=Number(r.fpr_vc_trace_sampling_rate):void 0!==pr.tracesSamplingRate&&(t.tracesSamplingRate=pr.tracesSamplingRate),t.logTraceAfterSampling=mr(t.tracesSamplingRate),t.logNetworkAfterSampling=mr(t.networkRequestsSamplingRate),e}function mr(e){return Math.random()<=e}var br,yr=1;function _r(e){var r;return yr=2,br=br||(r=e,function(){var r=er.getInstance().document;return new Promise(function(e){var t;r&&"complete"!==r.readyState?(t=function(){"complete"===r.readyState&&(r.removeEventListener("readystatechange",t),e())},r.addEventListener("readystatechange",t)):e()})}().then(function(){return e=r.installations,(t=e.getId()).then(function(e){Zt=e}),t;var e,t}).then(function(e){return dr(r,e)}).then(wr,wr))}function wr(){yr=3}var Er,Ir=1e4,Sr=3,Tr=1e3,Cr=Sr,Ar=[],Or=!1;function Dr(e){setTimeout(function(){var e,t;if(0!==Cr)return Ar.length?(e=Ar.splice(0,Tr),t=e.map(function(e){return{source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)}}),void function(e,n){return function(e){var t=or.getInstance().getFlTransportFullUrl();return fetch(t,{method:"POST",body:JSON.stringify(e)})}(e).then(function(e){return e.ok||Xt.info("Call to Firebase backend failed."),e.json()}).then(function(e){var t=Number(e.nextRequestWaitMillis),r=Ir;isNaN(t)||(r=Math.max(t,r));t=e.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(Ar=a(a([],n),Ar),Xt.info("Retry transport request later.")),Cr=Sr,Dr(r)})}({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:or.getInstance().logSource,log_event:t},e).catch(function(){Ar=a(a([],e),Ar),Cr--,Xt.info("Tries left: "+Cr+"."),Dr(Ir)})):Dr(Ir)},e)}function Nr(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!function(e){if(!e.eventTime||!e.message)throw Yt.create("invalid cc log");Ar=a(a([],Ar),[e])}({message:r.apply(void 0,e),eventTime:Date.now()})}}function Pr(e,t){(Er=Er||Nr(Lr))(e,t)}function kr(e){var t=or.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&er.getInstance().requiredApisAvailable()&&(e.isAuto&&ur()!==nr.VISIBLE||(3===yr?Mr(e):_r(e.performanceController).then(function(){return Mr(e)},function(){return Mr(e)})))}function Mr(e){var t;!Zt||(t=or.getInstance()).loggingEnabled&&t.logTraceAfterSampling&&setTimeout(function(){return Pr(e,1)},0)}function Lr(e,t){return 0===t?(r={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},r={application_info:Br(e.performanceController.app),network_request_metric:r},JSON.stringify(r)):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 r=e.getAttributes();0!==Object.keys(r).length&&(t.custom_attributes=r);t={application_info:Br(e.performanceController.app),trace_metric:t};return JSON.stringify(t)}(e);var r}function Br(e){return{google_app_id:lr(e),app_instance_id:Zt,web_app_info:{sdk_version:$t,page_url:er.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=er.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:ur(),effective_connection_type:function(){var e=er.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 t}var Rr=["_fp","_fcp","_fid"];var jr=(Fr.prototype.start=function(){if(1!==this.state)throw Yt.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},Fr.prototype.stop=function(){if(2!==this.state)throw Yt.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(),kr(this)},Fr.prototype.record=function(e,t,r){if(e<=0)throw Yt.create("nonpositive trace startTime",{traceName:this.name});if(t<=0)throw Yt.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),r&&r.attributes&&(this.customAttributes=p({},r.attributes)),r&&r.metrics)for(var n=0,i=Object.keys(r.metrics);n<i.length;n++){var o=i[n];isNaN(Number(r.metrics[o]))||(this.counters[o]=Math.floor(Number(r.metrics[o])))}kr(this)},Fr.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)},Fr.prototype.putMetric=function(e,t){if(n=e,i=this.name,0===n.length||100<n.length||!(i&&i.startsWith("_wt_")&&-1<Rr.indexOf(n))&&n.startsWith("_"))throw Yt.create("invalid custom metric name",{customMetricName:e});var r,n,i;this.counters[e]=(t=null!=t?t:0,(r=Math.floor(t))<t&&Xt.info("Metric value should be an Integer, setting the value as : "+r+"."),r)},Fr.prototype.getMetric=function(e){return this.counters[e]||0},Fr.prototype.putAttribute=function(e,t){var r,n,i=!(0===(r=e).length||40<r.length)&&(!sr.some(function(e){return r.startsWith(e)})&&!!r.match(cr)),o=0!==(n=t).length&&n.length<=100;if(i&&o)this.customAttributes[e]=t;else{if(!i)throw Yt.create("invalid attribute name",{attributeName:e});if(!o)throw Yt.create("invalid attribute value",{attributeValue:t})}},Fr.prototype.getAttribute=function(e){return this.customAttributes[e]},Fr.prototype.removeAttribute=function(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]},Fr.prototype.getAttributes=function(){return p({},this.customAttributes)},Fr.prototype.setStartTime=function(e){this.startTimeUs=e},Fr.prototype.setDuration=function(e){this.durationUs=e},Fr.prototype.calculateTraceMetrics=function(){var e=this.api.getEntriesByName(this.traceMeasure),e=e&&e[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},Fr.createOobTrace=function(e,t,r,n){var i,o=er.getInstance().getUrl();o&&(i=new Fr(e,"_wt_"+o,!0),o=Math.floor(1e3*er.getInstance().getTimeOrigin()),i.setStartTime(o),t&&t[0]&&(i.setDuration(Math.floor(1e3*t[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),r&&((o=r.find(function(e){return"first-paint"===e.name}))&&o.startTime&&i.putMetric("_fp",Math.floor(1e3*o.startTime)),(o=r.find(function(e){return"first-contentful-paint"===e.name}))&&o.startTime&&i.putMetric("_fcp",Math.floor(1e3*o.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))),kr(i))},Fr.createUserTimingTrace=function(e,t){kr(new Fr(e,t,!1,t))},Fr);function Fr(e,t,r,n){void 0===r&&(r=!1),this.performanceController=e,this.name=t,this.isAuto=r,this.state=1,this.customAttributes={},this.counters={},this.api=er.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||Kt+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function xr(e,t){var r,n,i,o,a=t;a&&void 0!==a.responseStart&&(i=er.getInstance().getTimeOrigin(),o=Math.floor(1e3*(a.startTime+i)),n=a.responseStart?Math.floor(1e3*(a.responseStart-a.startTime)):void 0,i=Math.floor(1e3*(a.responseEnd-a.startTime)),a={performanceController:e,url:a.name&&a.name.split("?")[0],responsePayloadBytes:a.transferSize,startTimeUs:o,timeToResponseInitiatedUs:n,timeToResponseCompletedUs:i},r=a,(o=or.getInstance()).instrumentationEnabled&&(n=r.url,i=o.logEndPointUrl.split("?")[0],a=o.flTransportEndpointUrl.split("?")[0],n!==i&&n!==a&&o.loggingEnabled&&o.logNetworkAfterSampling&&setTimeout(function(){return Pr(r,0)},0)))}var Ur=5e3;function Hr(e){Zt&&(setTimeout(function(){return function(t){var e=er.getInstance(),r=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint");{var i;e.onFirstInputDelay?(i=setTimeout(function(){jr.createOobTrace(t,r,n),i=void 0},Ur),e.onFirstInputDelay(function(e){i&&(clearTimeout(i),jr.createOobTrace(t,r,n,e))})):jr.createOobTrace(t,r,n)}}(e)},0),setTimeout(function(){return function(t){for(var e=er.getInstance(),r=e.getEntriesByType("resource"),n=0,i=r;n<i.length;n++){var o=i[n];xr(t,o)}e.setupObserver("resource",function(e){return xr(t,e)})}(e)},0),setTimeout(function(){return function(t){for(var e=er.getInstance(),r=e.getEntriesByType("measure"),n=0,i=r;n<i.length;n++){var o=i[n];zr(t,o)}e.setupObserver("measure",function(e){return zr(t,e)})}(e)},0))}function zr(e,t){var r=t.name;r.substring(0,Kt.length)!==Kt&&jr.createUserTimingTrace(e,r)}var Vr=(qr.prototype._init=function(e){var t=this;this.initialized||(void 0!==(null==e?void 0:e.dataCollectionEnabled)&&(this.dataCollectionEnabled=e.dataCollectionEnabled),void 0!==(null==e?void 0:e.instrumentationEnabled)&&(this.instrumentationEnabled=e.instrumentationEnabled),er.getInstance().requiredApisAvailable()?s().then(function(e){e&&(Or||(Dr(5500),Or=!0),_r(t).then(function(){return Hr(t)},function(){return Hr(t)}),t.initialized=!0)}).catch(function(e){Xt.info("Environment doesn't support IndexedDB: "+e)}):Xt.info('Firebase Performance cannot start if the browser does not support "Fetch" and "Promise", or cookies are disabled.'))},Object.defineProperty(qr.prototype,"instrumentationEnabled",{get:function(){return or.getInstance().instrumentationEnabled},set:function(e){or.getInstance().instrumentationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(qr.prototype,"dataCollectionEnabled",{get:function(){return or.getInstance().dataCollectionEnabled},set:function(e){or.getInstance().dataCollectionEnabled=e},enumerable:!1,configurable:!0}),qr);function qr(e,t){this.app=e,this.installations=t,this.initialized=!1}var Wr="[DEFAULT]";Ie(new k("performance",function(e,t){var r=t.options,n=e.getProvider("app").getImmediate(),i=e.getProvider("installations-internal").getImmediate();if(n.name!==Wr)throw Yt.create("FB not default");if("undefined"==typeof window)throw Yt.create("no window");Vt=window;i=new Vr(n,i);return i._init(r),i},"PUBLIC")),ke(qt,Wt),ke(qt,Wt,"esm5");var $r=(Object.defineProperty(Kr.prototype,"instrumentationEnabled",{get:function(){return this._delegate.instrumentationEnabled},set:function(e){this._delegate.instrumentationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Kr.prototype,"dataCollectionEnabled",{get:function(){return this._delegate.dataCollectionEnabled},set:function(e){this._delegate.dataCollectionEnabled=e},enumerable:!1,configurable:!0}),Kr.prototype.trace=function(e){return t=this._delegate,t=(r=t)&&r._delegate?r._delegate:r,new jr(t,e);var t,r},Kr);function Kr(e,t){this.app=e,this._delegate=t}var Jr;function Gr(e){var t=e.getProvider("app-compat").getImmediate(),r=e.getProvider("performance").getImmediate();return new $r(t,r)}(Jr=tt).INTERNAL.registerComponent(new k("performance-compat",Gr,"PUBLIC")),Jr.registerVersion("@firebase/performance-compat","0.1.15");return tt.registerVersion("firebase","9.12.1","compat-lite"),tt});
1
+ !function(e,t){"object"==typeof exports&&"undefined"!=typeof module?module.exports=t():"function"==typeof define&&define.amd?define(t):(e="undefined"!=typeof globalThis?globalThis:e||self).firebase=t()}(this,function(){"use strict";var n=function(e,t){return(n=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])})(e,t)};var p=function(){return(p=Object.assign||function(e){for(var t,r=1,n=arguments.length;r<n;r++)for(var i in t=arguments[r])Object.prototype.hasOwnProperty.call(t,i)&&(e[i]=t[i]);return e}).apply(this,arguments)};function f(e,a,s,c){return new(s=s||Promise)(function(r,t){function n(e){try{o(c.next(e))}catch(e){t(e)}}function i(e){try{o(c.throw(e))}catch(e){t(e)}}function o(e){var t;e.done?r(e.value):((t=e.value)instanceof s?t:new s(function(e){e(t)})).then(n,i)}o((c=c.apply(e,a||[])).next())})}function h(r,n){var i,o,a,s={label:0,sent:function(){if(1&a[0])throw a[1];return a[1]},trys:[],ops:[]},e={next:t(0),throw:t(1),return:t(2)};return"function"==typeof Symbol&&(e[Symbol.iterator]=function(){return this}),e;function t(t){return function(e){return function(t){if(i)throw new TypeError("Generator is already executing.");for(;s;)try{if(i=1,o&&(a=2&t[0]?o.return:t[0]?o.throw||((a=o.return)&&a.call(o),0):o.next)&&!(a=a.call(o,t[1])).done)return a;switch(o=0,(t=a?[2&t[0],a.value]:t)[0]){case 0:case 1:a=t;break;case 4:return s.label++,{value:t[1],done:!1};case 5:s.label++,o=t[1],t=[0];continue;case 7:t=s.ops.pop(),s.trys.pop();continue;default:if(!(a=0<(a=s.trys).length&&a[a.length-1])&&(6===t[0]||2===t[0])){s=0;continue}if(3===t[0]&&(!a||t[1]>a[0]&&t[1]<a[3])){s.label=t[1];break}if(6===t[0]&&s.label<a[1]){s.label=a[1],a=t;break}if(a&&s.label<a[2]){s.label=a[2],s.ops.push(t);break}a[2]&&s.ops.pop(),s.trys.pop();continue}t=n.call(r,s)}catch(e){t=[6,e],o=0}finally{i=a=0}if(5&t[0])throw t[1];return{value:t[0]?t[1]:void 0,done:!0}}([t,e])}}}function d(e){var t="function"==typeof Symbol&&Symbol.iterator,r=t&&e[t],n=0;if(r)return r.call(e);if(e&&"number"==typeof e.length)return{next:function(){return{value:(e=e&&n>=e.length?void 0:e)&&e[n++],done:!e}}};throw new TypeError(t?"Object is not iterable.":"Symbol.iterator is not defined.")}function v(e,t){var r="function"==typeof Symbol&&e[Symbol.iterator];if(!r)return e;var n,i,o=r.call(e),a=[];try{for(;(void 0===t||0<t--)&&!(n=o.next()).done;)a.push(n.value)}catch(e){i={error:e}}finally{try{n&&!n.done&&(r=o.return)&&r.call(o)}finally{if(i)throw i.error}}return a}function a(e,t,r){if(r||2===arguments.length)for(var n,i=0,o=t.length;i<o;i++)!n&&i in t||((n=n||Array.prototype.slice.call(t,0,i))[i]=t[i]);return e.concat(n||Array.prototype.slice.call(t))}var r=function(e){for(var t=[],r=0,n=0;n<e.length;n++){var i=e.charCodeAt(n);i<128?t[r++]=i:(i<2048?t[r++]=i>>6|192:(55296==(64512&i)&&n+1<e.length&&56320==(64512&e.charCodeAt(n+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++n)),t[r++]=i>>18|240,t[r++]=i>>12&63|128):t[r++]=i>>12|224,t[r++]=i>>6&63|128),t[r++]=63&i|128)}return t},i={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:"function"==typeof atob,encodeByteArray:function(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();for(var r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[],i=0;i<e.length;i+=3){var o=e[i],a=i+1<e.length,s=a?e[i+1]:0,c=i+2<e.length,u=c?e[i+2]:0,l=(15&s)<<2|u>>6,u=63&u;c||(u=64,a||(l=64)),n.push(r[o>>2],r[(3&o)<<4|s>>4],r[l],r[u])}return n.join("")},encodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(r(e),t)},decodeString:function(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){for(var t=[],r=0,n=0;r<e.length;){var i,o,a,s=e[r++];s<128?t[n++]=String.fromCharCode(s):191<s&&s<224?(o=e[r++],t[n++]=String.fromCharCode((31&s)<<6|63&o)):239<s&&s<365?(i=((7&s)<<18|(63&(o=e[r++]))<<12|(63&(a=e[r++]))<<6|63&e[r++])-65536,t[n++]=String.fromCharCode(55296+(i>>10)),t[n++]=String.fromCharCode(56320+(1023&i))):(o=e[r++],a=e[r++],t[n++]=String.fromCharCode((15&s)<<12|(63&o)<<6|63&a))}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray:function(e,t){this.init_();for(var r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[],i=0;i<e.length;){var o=r[e.charAt(i++)],a=i<e.length?r[e.charAt(i)]:0,s=++i<e.length?r[e.charAt(i)]:64,c=++i<e.length?r[e.charAt(i)]:64;if(++i,null==o||null==a||null==s||null==c)throw Error();n.push(o<<2|a>>4),64!==s&&(n.push(a<<4&240|s>>2),64!==c&&n.push(s<<6&192|c))}return n},init_:function(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(var e=0;e<this.ENCODED_VALS.length;e++)this.byteToCharMap_[e]=this.ENCODED_VALS.charAt(e),this.charToByteMap_[this.byteToCharMap_[e]]=e,this.byteToCharMapWebSafe_[e]=this.ENCODED_VALS_WEBSAFE.charAt(e),(this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]]=e)>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},o=function(e){return t=r(e),i.encodeByteArray(t,!0).replace(/\./g,"");var t};function c(e,t){if(!(t instanceof Object))return t;switch(t.constructor){case Date:return new Date(t.getTime());case Object:void 0===e&&(e={});break;case Array:e=[];break;default:return t}for(var r in t)t.hasOwnProperty(r)&&"__proto__"!==r&&(e[r]=c(e[r],t[r]));return e}function t(){return"object"==typeof indexedDB}function s(){return new Promise(function(e,t){try{var r=!0,n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=function(){i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=function(){r=!1},i.onerror=function(){var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})}function e(){return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if("undefined"!=typeof global)return global;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__}function u(){if("undefined"!=typeof document){try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var e=e&&function(e){try{return i.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(e[1]);return e&&JSON.parse(e)}}function l(){try{return e()||function(){if("undefined"!=typeof process&&void 0!==process.env){var e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0}}()||u()}catch(e){return void console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}}var g=function(){var e;return null===(e=l())||void 0===e?void 0:e.config},m=(b.prototype.wrapCallback=function(r){var n=this;return function(e,t){e?n.reject(e):n.resolve(t),"function"==typeof r&&(n.promise.catch(function(){}),1===r.length?r(e):r(e,t))}},b);function b(){var r=this;this.reject=function(){},this.resolve=function(){},this.promise=new Promise(function(e,t){r.resolve=e,r.reject=t})}var y,_=(function(e,t){if("function"!=typeof t&&null!==t)throw new TypeError("Class extends value "+String(t)+" is not a constructor or null");function r(){this.constructor=e}n(e,t),e.prototype=null===t?Object.create(t):(r.prototype=t.prototype,new r)}(w,y=Error),w);function w(e,t,r){var n=y.call(this,t)||this;return n.code=e,n.customData=r,n.name="FirebaseError",Object.setPrototypeOf(n,w.prototype),Error.captureStackTrace&&Error.captureStackTrace(n,E.prototype.create),n}var E=(I.prototype.create=function(e){for(var t=[],r=1;r<arguments.length;r++)t[r-1]=arguments[r];var n,i=t[0]||{},o=this.service+"/"+e,a=this.errors[e],a=a?(n=i,a.replace(S,function(e,t){var r=n[t];return null!=r?String(r):"<"+t+"?>"})):"Error",a=this.serviceName+": "+a+" ("+o+").";return new _(o,a,i)},I);function I(e,t,r){this.service=e,this.serviceName=t,this.errors=r}var S=/\{\$([^}]+)}/g;function T(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function C(e,t){if(e===t)return 1;for(var r=Object.keys(e),n=Object.keys(t),i=0,o=r;i<o.length;i++){var a=o[i];if(!n.includes(a))return;var s=e[a],c=t[a];if(A(s)&&A(c)){if(!C(s,c))return}else if(s!==c)return}for(var u=0,l=n;u<l.length;u++){a=l[u];if(!r.includes(a))return}return 1}function A(e){return null!==e&&"object"==typeof e}function O(e,t){var r=new D(e,t);return r.subscribe.bind(r)}var D=(N.prototype.next=function(t){this.forEachObserver(function(e){e.next(t)})},N.prototype.error=function(t){this.forEachObserver(function(e){e.error(t)}),this.close(t)},N.prototype.complete=function(){this.forEachObserver(function(e){e.complete()}),this.close()},N.prototype.subscribe=function(e,t,r){var n,i=this;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");void 0===(n=function(e,t){if("object"!=typeof e||null===e)return!1;for(var r=0,n=t;r<n.length;r++){var i=n[r];if(i in e&&"function"==typeof e[i])return!0}return!1}(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&&(n.next=P),void 0===n.error&&(n.error=P),void 0===n.complete&&(n.complete=P);var o=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(function(){try{i.finalError?n.error(i.finalError):n.complete()}catch(e){}}),this.observers.push(n),o},N.prototype.unsubscribeOne=function(e){void 0!==this.observers&&void 0!==this.observers[e]&&(delete this.observers[e],--this.observerCount,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))},N.prototype.forEachObserver=function(e){if(!this.finalized)for(var t=0;t<this.observers.length;t++)this.sendOne(t,e)},N.prototype.sendOne=function(e,t){var r=this;this.task.then(function(){if(void 0!==r.observers&&void 0!==r.observers[e])try{t(r.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})},N.prototype.close=function(e){var t=this;this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(function(){t.observers=void 0,t.onNoObservers=void 0}))},N);function N(e,t){var r=this;this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(function(){e(r)}).catch(function(e){r.error(e)})}function P(){}var k=(M.prototype.setInstantiationMode=function(e){return this.instantiationMode=e,this},M.prototype.setMultipleInstances=function(e){return this.multipleInstances=e,this},M.prototype.setServiceProps=function(e){return this.serviceProps=e,this},M.prototype.setInstanceCreatedCallback=function(e){return this.onInstanceCreated=e,this},M);function M(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}var L="[DEFAULT]",B=(R.prototype.get=function(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var r=new m;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{var n=this.getOrInitializeService({instanceIdentifier:t});n&&r.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise},R.prototype.getImmediate=function(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(r=null==e?void 0:e.optional)&&void 0!==r&&r;if(!this.isInitialized(t)&&!this.shouldAutoInitialize()){if(r)return null;throw Error("Service "+this.name+" is not available")}try{return this.getOrInitializeService({instanceIdentifier:t})}catch(e){if(r)return null;throw e}},R.prototype.getComponent=function(){return this.component},R.prototype.setComponent=function(e){var t,r;if(e.name!==this.name)throw Error("Mismatching Component "+e.name+" for Provider "+this.name+".");if(this.component)throw Error("Component for "+this.name+" has already been provided");if(this.component=e,this.shouldAutoInitialize()){if("EAGER"===e.instantiationMode)try{this.getOrInitializeService({instanceIdentifier:L})}catch(e){}try{for(var n=d(this.instancesDeferred.entries()),i=n.next();!i.done;i=n.next()){var o=v(i.value,2),a=o[0],s=o[1],c=this.normalizeInstanceIdentifier(a);try{var u=this.getOrInitializeService({instanceIdentifier:c});s.resolve(u)}catch(e){}}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}}},R.prototype.clearInstance=function(e){this.instancesDeferred.delete(e=void 0===e?L:e),this.instancesOptions.delete(e),this.instances.delete(e)},R.prototype.delete=function(){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return t=Array.from(this.instances.values()),[4,Promise.all(a(a([],v(t.filter(function(e){return"INTERNAL"in e}).map(function(e){return e.INTERNAL.delete()}))),v(t.filter(function(e){return"_delete"in e}).map(function(e){return e._delete()}))))];case 1:return e.sent(),[2]}})})},R.prototype.isComponentSet=function(){return null!=this.component},R.prototype.isInitialized=function(e){return this.instances.has(e=void 0===e?L:e)},R.prototype.getOptions=function(e){return this.instancesOptions.get(e=void 0===e?L:e)||{}},R.prototype.initialize=function(e){var t,r,n=(e=void 0===e?{}:e).options,n=void 0===n?{}:n,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(this.name+"("+i+") has already been initialized");if(!this.isComponentSet())throw Error("Component "+this.name+" has not been registered yet");var o=this.getOrInitializeService({instanceIdentifier:i,options:n});try{for(var a=d(this.instancesDeferred.entries()),s=a.next();!s.done;s=a.next()){var c=v(s.value,2),u=c[0],l=c[1];i===this.normalizeInstanceIdentifier(u)&&l.resolve(o)}}catch(e){t={error:e}}finally{try{s&&!s.done&&(r=a.return)&&r.call(a)}finally{if(t)throw t.error}}return o},R.prototype.onInit=function(e,t){var r=this.normalizeInstanceIdentifier(t),n=null!==(i=this.onInitCallbacks.get(r))&&void 0!==i?i:new Set;n.add(e),this.onInitCallbacks.set(r,n);var i=this.instances.get(r);return i&&e(i,r),function(){n.delete(e)}},R.prototype.invokeOnInitCallbacks=function(e,t){var r,n,i=this.onInitCallbacks.get(t);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next()){var s=a.value;try{s(e,t)}catch(e){}}}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}},R.prototype.getOrInitializeService=function(e){var t=e.instanceIdentifier,r=e.options,n=void 0===r?{}:r,r=this.instances.get(t);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(e=t)===L?void 0:e,options:n}),this.instances.set(t,r),this.instancesOptions.set(t,n),this.invokeOnInitCallbacks(r,t),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,t,r)}catch(e){}return r||null},R.prototype.normalizeInstanceIdentifier=function(e){return void 0===e&&(e=L),!this.component||this.component.multipleInstances?e:L},R.prototype.shouldAutoInitialize=function(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode},R);function R(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}var j=(F.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)},F.prototype.addOrOverwriteComponent=function(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)},F.prototype.getProvider=function(e){if(this.providers.has(e))return this.providers.get(e);var t=new B(e,this);return this.providers.set(e,t),t},F.prototype.getProviders=function(){return Array.from(this.providers.values())},F);function F(e){this.name=e,this.providers=new Map}var x,U=[];(ir=x=x||{})[ir.DEBUG=0]="DEBUG",ir[ir.VERBOSE=1]="VERBOSE",ir[ir.INFO=2]="INFO",ir[ir.WARN=3]="WARN",ir[ir.ERROR=4]="ERROR",ir[ir.SILENT=5]="SILENT";function H(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];if(!(t<e.logLevel)){var i=(new Date).toISOString(),o=W[t];if(!o)throw new Error("Attempted to log a message with an invalid logType (value: "+t+")");console[o].apply(console,a(["["+i+"] "+e.name+":"],r))}}var z,V={debug:x.DEBUG,verbose:x.VERBOSE,info:x.INFO,warn:x.WARN,error:x.ERROR,silent:x.SILENT},q=x.INFO,W=((et={})[x.DEBUG]="log",et[x.VERBOSE]="log",et[x.INFO]="info",et[x.WARN]="warn",et[x.ERROR]="error",et),$=(Object.defineProperty(K.prototype,"logLevel",{get:function(){return this._logLevel},set:function(e){if(!(e in x))throw new TypeError('Invalid value "'+e+'" assigned to `logLevel`');this._logLevel=e},enumerable:!1,configurable:!0}),K.prototype.setLogLevel=function(e){this._logLevel="string"==typeof e?V[e]:e},Object.defineProperty(K.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(K.prototype,"userLogHandler",{get:function(){return this._userLogHandler},set:function(e){this._userLogHandler=e},enumerable:!1,configurable:!0}),K.prototype.debug=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.DEBUG],e)),this._logHandler.apply(this,a([this,x.DEBUG],e))},K.prototype.log=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.VERBOSE],e)),this._logHandler.apply(this,a([this,x.VERBOSE],e))},K.prototype.info=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.INFO],e)),this._logHandler.apply(this,a([this,x.INFO],e))},K.prototype.warn=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.WARN],e)),this._logHandler.apply(this,a([this,x.WARN],e))},K.prototype.error=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];this._userLogHandler&&this._userLogHandler.apply(this,a([this,x.ERROR],e)),this._logHandler.apply(this,a([this,x.ERROR],e))},K);function K(e){this.name=e,this._logLevel=q,this._logHandler=H,this._userLogHandler=null,U.push(this)}function J(a,t){for(var e=0,r=U;e<r.length;e++)!function(e){var o=null;t&&t.level&&(o=V[t.level]),e.userLogHandler=null===a?null:function(e,t){for(var r=[],n=2;n<arguments.length;n++)r[n-2]=arguments[n];var i=r.map(function(e){if(null==e)return null;if("string"==typeof e)return e;if("number"==typeof e||"boolean"==typeof e)return e.toString();if(e instanceof Error)return e.message;try{return JSON.stringify(e)}catch(e){return null}}).filter(function(e){return e}).join(" ");t>=(null!=o?o:e.logLevel)&&a({level:x[t].toLowerCase(),message:i,args:r,type:e.name})}}(r[e])}const G=(t,e)=>e.some(e=>t instanceof e);let Y,X;const Z=new WeakMap,Q=new WeakMap,ee=new WeakMap,te=new WeakMap,re=new WeakMap;let ne={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return Q.get(e);if("objectStoreNames"===t)return e.objectStoreNames||ee.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return ae(e[t])},set(e,t,r){return e[t]=r,!0},has(e,t){return e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e}};function ie(n){return n!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(X=X||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(n)?function(...e){return n.apply(se(this),e),ae(Z.get(this))}:function(...e){return ae(n.apply(se(this),e))}:function(e,...t){var r=n.call(se(this),e,...t);return ee.set(r,e.sort?e.sort():[e]),ae(r)}}function oe(e){return"function"==typeof e?ie(e):(e instanceof IDBTransaction&&(o=e,Q.has(o)||(t=new Promise((e,t)=>{const r=()=>{o.removeEventListener("complete",n),o.removeEventListener("error",i),o.removeEventListener("abort",i)},n=()=>{e(),r()},i=()=>{t(o.error||new DOMException("AbortError","AbortError")),r()};o.addEventListener("complete",n),o.addEventListener("error",i),o.addEventListener("abort",i)}),Q.set(o,t))),G(e,Y=Y||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,ne):e);var o,t}function ae(e){if(e instanceof IDBRequest)return function(o){const e=new Promise((e,t)=>{const r=()=>{o.removeEventListener("success",n),o.removeEventListener("error",i)},n=()=>{e(ae(o.result)),r()},i=()=>{t(o.error),r()};o.addEventListener("success",n),o.addEventListener("error",i)});return e.then(e=>{e instanceof IDBCursor&&Z.set(e,o)}).catch(()=>{}),re.set(e,o),e}(e);if(te.has(e))return te.get(e);var t=oe(e);return t!==e&&(te.set(e,t),re.set(t,e)),t}const se=e=>re.get(e);function ce(e,t,{blocked:r,upgrade:n,blocking:i,terminated:o}={}){const a=indexedDB.open(e,t),s=ae(a);return n&&a.addEventListener("upgradeneeded",e=>{n(ae(a.result),e.oldVersion,e.newVersion,ae(a.transaction))}),r&&a.addEventListener("blocked",()=>r()),s.then(e=>{o&&e.addEventListener("close",()=>o()),i&&e.addEventListener("versionchange",()=>i())}).catch(()=>{}),s}const ue=["get","getKey","getAll","getAllKeys","count"],le=["put","add","delete","clear"],fe=new Map;function pe(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(fe.get(t))return fe.get(t);const i=t.replace(/FromIndex$/,""),o=t!==i,a=le.includes(i);if(i in(o?IDBIndex:IDBObjectStore).prototype&&(a||ue.includes(i))){var r=async function(e,...t){var r=this.transaction(e,a?"readwrite":"readonly");let n=r.store;return o&&(n=n.index(t.shift())),(await Promise.all([n[i](...t),a&&r.done]))[0]};return fe.set(t,r),r}}}ne={...z=ne,get:(e,t,r)=>pe(e,t)||z.get(e,t,r),has:(e,t)=>!!pe(e,t)||z.has(e,t)};var he=(de.prototype.getPlatformInfoString=function(){return this.container.getProviders().map(function(e){if("VERSION"!==(null==(t=e.getComponent())?void 0:t.type))return null;var t,t=e.getImmediate();return t.library+"/"+t.version}).filter(function(e){return e}).join(" ")},de);function de(e){this.container=e}var ve="@firebase/app",ge=new $("@firebase/app"),me="[DEFAULT]",be=((Te={})[ve]="fire-core",Te["@firebase/app-compat"]="fire-core-compat",Te["@firebase/analytics"]="fire-analytics",Te["@firebase/analytics-compat"]="fire-analytics-compat",Te["@firebase/app-check"]="fire-app-check",Te["@firebase/app-check-compat"]="fire-app-check-compat",Te["@firebase/auth"]="fire-auth",Te["@firebase/auth-compat"]="fire-auth-compat",Te["@firebase/database"]="fire-rtdb",Te["@firebase/database-compat"]="fire-rtdb-compat",Te["@firebase/functions"]="fire-fn",Te["@firebase/functions-compat"]="fire-fn-compat",Te["@firebase/installations"]="fire-iid",Te["@firebase/installations-compat"]="fire-iid-compat",Te["@firebase/messaging"]="fire-fcm",Te["@firebase/messaging-compat"]="fire-fcm-compat",Te["@firebase/performance"]="fire-perf",Te["@firebase/performance-compat"]="fire-perf-compat",Te["@firebase/remote-config"]="fire-rc",Te["@firebase/remote-config-compat"]="fire-rc-compat",Te["@firebase/storage"]="fire-gcs",Te["@firebase/storage-compat"]="fire-gcs-compat",Te["@firebase/firestore"]="fire-fst",Te["@firebase/firestore-compat"]="fire-fst-compat",Te["fire-js"]="fire-js",Te.firebase="fire-js-all",Te),ye=new Map,_e=new Map;function we(t,r){try{t.container.addComponent(r)}catch(e){ge.debug("Component "+r.name+" failed to register with FirebaseApp "+t.name,e)}}function Ee(e,t){e.container.addOrOverwriteComponent(t)}function Ie(e){var t,r,n=e.name;if(_e.has(n))return ge.debug("There were multiple attempts to register component "+n+"."),!1;_e.set(n,e);try{for(var i=d(ye.values()),o=i.next();!o.done;o=i.next())we(o.value,e)}catch(e){t={error:e}}finally{try{o&&!o.done&&(r=i.return)&&r.call(i)}finally{if(t)throw t.error}}return!0}function Se(e,t){var r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}var Te=((et={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",et["bad-app-name"]="Illegal App name: '{$appName}",et["duplicate-app"]="Firebase App named '{$appName}' already exists with different options or config",et["app-deleted"]="Firebase App named '{$appName}' already deleted",et["no-options"]="Need to provide options, when not being deployed to hosting via source.",et["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",et["invalid-log-argument"]="First argument to `onLog` must be null or a function.",et["idb-open"]="Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",et["idb-get"]="Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",et["idb-set"]="Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",et["idb-delete"]="Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",et),Ce=new E("app","Firebase",Te),Ae=(Object.defineProperty(Oe.prototype,"automaticDataCollectionEnabled",{get:function(){return this.checkDestroyed(),this._automaticDataCollectionEnabled},set:function(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"name",{get:function(){return this.checkDestroyed(),this._name},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"options",{get:function(){return this.checkDestroyed(),this._options},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"config",{get:function(){return this.checkDestroyed(),this._config},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"container",{get:function(){return this._container},enumerable:!1,configurable:!0}),Object.defineProperty(Oe.prototype,"isDeleted",{get:function(){return this._isDeleted},set:function(e){this._isDeleted=e},enumerable:!1,configurable:!0}),Oe.prototype.checkDestroyed=function(){if(this.isDeleted)throw Ce.create("app-deleted",{appName:this._name})},Oe);function Oe(e,t,r){var n=this;this._isDeleted=!1,this._options=p({},e),this._config=p({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new k("app",function(){return n},"PUBLIC"))}var De="9.13.0";function Ne(e,t){var r,n,i=e,o=p({name:me,automaticDataCollectionEnabled:!1},t="object"!=typeof(t=void 0===t?{}:t)?{name:t}:t),a=o.name;if("string"!=typeof a||!a)throw Ce.create("bad-app-name",{appName:String(a)});if(!(i=i||g()))throw Ce.create("no-options");var s=ye.get(a);if(s){if(C(i,s.options)&&C(o,s.config))return s;throw Ce.create("duplicate-app",{appName:a})}var c=new j(a);try{for(var u=d(_e.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&&(n=u.return)&&n.call(u)}finally{if(r)throw r.error}}o=new Ae(i,o,c);return ye.set(a,o),o}function Pe(r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return(t=r.name,ye.has(t))?(ye.delete(t),[4,Promise.all(r.container.getProviders().map(function(e){return e.delete()}))]):[3,2];case 1:e.sent(),r.isDeleted=!0,e.label=2;case 2:return[2]}})})}function ke(e,t,r){var n=null!==(a=be[e])&&void 0!==a?a:e;r&&(n+="-"+r);var i=n.match(/\s|\//),o=t.match(/\s|\//);if(i||o){var a=['Unable to register library "'+n+'" with version "'+t+'":'];return i&&a.push('library name "'+n+'" contains illegal characters (whitespace or "/")'),i&&o&&a.push("and"),o&&a.push('version name "'+t+'" contains illegal characters (whitespace or "/")'),void ge.warn(a.join(" "))}Ie(new k(n+"-version",function(){return{library:n,version:t}},"VERSION"))}function Me(e,t){if(null!==e&&"function"!=typeof e)throw Ce.create("invalid-log-argument");J(e,t)}function Le(e){var t;t=e,U.forEach(function(e){e.setLogLevel(t)})}var Be="firebase-heartbeat-database",Re=1,je="firebase-heartbeat-store",Fe=null;function xe(){return Fe=Fe||ce(Be,Re,{upgrade:function(e,t){0===t&&e.createObjectStore(je)}}).catch(function(e){throw Ce.create("idb-open",{originalErrorMessage:e.message})})}function Ue(n,i){var o;return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,4]),[4,xe()];case 1:return r=e.sent(),t=r.transaction(je,"readwrite"),[4,t.objectStore(je).put(i,He(n))];case 2:return e.sent(),[2,t.done];case 3:return(r=e.sent())instanceof _?ge.warn(r.message):(r=Ce.create("idb-set",{originalErrorMessage:null===(o=r)||void 0===o?void 0:o.message}),ge.warn(r.message)),[3,4];case 4:return[2]}})})}function He(e){return e.name+"!"+e.options.appId}var ze=(Ve.prototype.triggerHeartbeat=function(){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return(t=this.container.getProvider("platform-logger").getImmediate(),t=t.getPlatformInfoString(),r=qe(),null!==this._heartbeatsCache)?[3,2]:[4,(n=this)._heartbeatsCachePromise];case 1:n._heartbeatsCache=e.sent(),e.label=2;case 2:return this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(function(e){return e.date===r})?[2]:(this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(function(e){var t=new Date(e.date).valueOf();return Date.now()-t<=2592e6}),[2,this._storage.overwrite(this._heartbeatsCache)])}})})},Ve.prototype.getHeartbeatsHeader=function(){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return null!==this._heartbeatsCache?[3,2]:[4,this._heartbeatsCachePromise];case 1:e.sent(),e.label=2;case 2:return null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length?[2,""]:(t=qe(),r=function(e,r){var t,n;void 0===r&&(r=1024);var i=[],o=e.slice();try{for(var a=d(e),s=a.next();!s.done;s=a.next())if("break"===function(t){var e=i.find(function(e){return e.agent===t.agent});if(e){if(e.dates.push(t.date),Je(i)>r)return e.dates.pop(),"break"}else if(i.push({agent:t.agent,dates:[t.date]}),Je(i)>r)return i.pop(),"break";o=o.slice(1)}(s.value))break}catch(e){t={error:e}}finally{try{s&&!s.done&&(n=a.return)&&n.call(a)}finally{if(t)throw t.error}}return{heartbeatsToSend:i,unsentEntries:o}}(this._heartbeatsCache.heartbeats),n=r.heartbeatsToSend,r=r.unsentEntries,n=o(JSON.stringify({version:2,heartbeats:n})),this._heartbeatsCache.lastSentHeartbeatDate=t,0<r.length?(this._heartbeatsCache.heartbeats=r,[4,this._storage.overwrite(this._heartbeatsCache)]):[3,4]);case 3:return e.sent(),[3,5];case 4:this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache),e.label=5;case 5:return[2,n]}})})},Ve);function Ve(e){var t=this;this.container=e,this._heartbeatsCache=null;var r=this.container.getProvider("app").getImmediate();this._storage=new $e(r),this._heartbeatsCachePromise=this._storage.read().then(function(e){return t._heartbeatsCache=e})}function qe(){return(new Date).toISOString().substring(0,10)}var We,$e=(Ke.prototype.runIndexedDBEnvironmentCheck=function(){return f(this,void 0,void 0,function(){return h(this,function(e){return t()?[2,s().then(function(){return!0}).catch(function(){return!1})]:[2,!1]})})},Ke.prototype.read=function(){return f(this,void 0,void 0,function(){return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2,{heartbeats:[]}];case 2:return[4,function(r){var n;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,3]),[4,xe()];case 1:return[2,e.sent().transaction(je).objectStore(je).get(He(r))];case 2:return(t=e.sent())instanceof _?ge.warn(t.message):(t=Ce.create("idb-get",{originalErrorMessage:null===(n=t)||void 0===n?void 0:n.message}),ge.warn(t.message)),[3,3];case 3:return[2]}})})}(this.app)];case 3:return[2,e.sent()||{heartbeats:[]}]}})})},Ke.prototype.overwrite=function(r){var n;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,Ue(this.app,{lastSentHeartbeatDate:null!==(n=r.lastSentHeartbeatDate)&&void 0!==n?n:t.lastSentHeartbeatDate,heartbeats:r.heartbeats})]}})})},Ke.prototype.add=function(r){var n;return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,this._canUseIndexedDBPromise];case 1:return e.sent()?[3,2]:[2];case 2:return[4,this.read()];case 3:return t=e.sent(),[2,Ue(this.app,{lastSentHeartbeatDate:null!==(n=r.lastSentHeartbeatDate)&&void 0!==n?n:t.lastSentHeartbeatDate,heartbeats:a(a([],v(t.heartbeats)),v(r.heartbeats))})]}})})},Ke);function Ke(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}function Je(e){return o(JSON.stringify({version:2,heartbeats:e})).length}We="",Ie(new k("platform-logger",function(e){return new he(e)},"PRIVATE")),Ie(new k("heartbeat",function(e){return new ze(e)},"PRIVATE")),ke(ve,"0.8.3",We),ke(ve,"0.8.3","esm5"),ke("fire-js","");var Ge=Object.freeze({__proto__:null,SDK_VERSION:De,_DEFAULT_ENTRY_NAME:me,_addComponent:we,_addOrOverwriteComponent:Ee,_apps:ye,_clearComponents:function(){_e.clear()},_components:_e,_getProvider:Se,_registerComponent:Ie,_removeServiceInstance:function(e,t,r){void 0===r&&(r=me),Se(e,t).clearInstance(r)},deleteApp:Pe,getApp:function(e){var t=ye.get(e=void 0===e?me:e);if(!t&&e===me)return Ne();if(!t)throw Ce.create("no-app",{appName:e});return t},getApps:function(){return Array.from(ye.values())},initializeApp:Ne,onLog:Me,registerVersion:ke,setLogLevel:Le,FirebaseError:_}),Ye=(Object.defineProperty(Xe.prototype,"automaticDataCollectionEnabled",{get:function(){return this._delegate.automaticDataCollectionEnabled},set:function(e){this._delegate.automaticDataCollectionEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Xe.prototype,"name",{get:function(){return this._delegate.name},enumerable:!1,configurable:!0}),Object.defineProperty(Xe.prototype,"options",{get:function(){return this._delegate.options},enumerable:!1,configurable:!0}),Xe.prototype.delete=function(){var t=this;return new Promise(function(e){t._delegate.checkDestroyed(),e()}).then(function(){return t.firebase.INTERNAL.removeApp(t.name),Pe(t._delegate)})},Xe.prototype._getService=function(e,t){var r;void 0===t&&(t=me),this._delegate.checkDestroyed();var n=this._delegate.container.getProvider(e);return n.isInitialized()||"EXPLICIT"!==(null===(r=n.getComponent())||void 0===r?void 0:r.instantiationMode)||n.initialize(),n.getImmediate({identifier:t})},Xe.prototype._removeServiceInstance=function(e,t){void 0===t&&(t=me),this._delegate.container.getProvider(e).clearInstance(t)},Xe.prototype._addComponent=function(e){we(this._delegate,e)},Xe.prototype._addOrOverwriteComponent=function(e){Ee(this._delegate,e)},Xe.prototype.toJSON=function(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}},Xe);function Xe(e,t){var r=this;this._delegate=e,this.firebase=t,we(e,new k("app-compat",function(){return r},"PUBLIC")),this.container=e.container}var Te=((et={})["no-app"]="No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()",et["invalid-app-argument"]="firebase.{$appName}() takes either no argument or a Firebase App instance.",et),Ze=new E("app-compat","Firebase",Te);function Qe(i){var o={},a={__esModule:!0,initializeApp:function(e,t){void 0===t&&(t={});var r=Ne(e,t);if(T(o,r.name))return o[r.name];var n=new i(r,a);return o[r.name]=n},app:s,registerVersion:ke,setLogLevel:Le,onLog:Me,apps:null,SDK_VERSION:De,INTERNAL:{registerComponent:function(r){var n=r.name,t=n.replace("-compat","");{var e;Ie(r)&&"PUBLIC"===r.type&&(e=function(e){if("function"!=typeof(e=void 0===e?s():e)[t])throw Ze.create("invalid-app-argument",{appName:n});return e[t]()},void 0!==r.serviceProps&&c(e,r.serviceProps),a[t]=e,i.prototype[t]=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];return this._getService.bind(this,n).apply(this,r.multipleInstances?e:[])})}return"PUBLIC"===r.type?a[t]:null},removeApp:function(e){delete o[e]},useAsService:function(e,t){return"serverAuth"!==t?t:null},modularAPIs:Ge}};function s(e){if(!T(o,e=e||me))throw Ze.create("no-app",{appName:e});return o[e]}return a.default=a,Object.defineProperty(a,"apps",{get:function(){return Object.keys(o).map(function(e){return o[e]})}}),s.App=i,a}var et=function e(){var t=Qe(Ye);return t.INTERNAL=p(p({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){c(t,e)},createSubscribe:O,ErrorFactory:E,deepExtend:c}),t}(),Te=new $("@firebase/app-compat");"object"==typeof self&&self.self===self&&void 0!==self.firebase&&(Te.warn("\n Warning: Firebase is already defined in the global scope. Please make sure\n Firebase library is only loaded once.\n "),(rt=self.firebase.SDK_VERSION)&&0<=rt.indexOf("LITE")&&Te.warn("\n Warning: You are trying to load Firebase while using Firebase Performance standalone script.\n You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.\n "));var tt=et;ke("@firebase/app-compat","0.1.38",void 0);tt.registerVersion("firebase","9.13.0","app-compat");var rt="@firebase/installations",Te="0.5.16",nt=1e4,it="w:"+Te,ot="FIS_v2",at="https://firebaseinstallations.googleapis.com/v1",st=36e5,et=((et={})["missing-app-config-values"]='Missing App configuration value: "{$valueName}"',et["not-registered"]="Firebase Installation is not registered.",et["installation-not-found"]="Firebase Installation not found.",et["request-failed"]='{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',et["app-offline"]="Could not process request. Application offline.",et["delete-pending-registration"]="Can't delete installation while there is a pending registration request.",et),ct=new E("installations","Installations",et);function ut(e){return e instanceof _&&e.code.includes("request-failed")}function lt(e){var t=e.projectId;return at+"/projects/"+t+"/installations"}function ft(e){return{token:e.token,requestStatus:2,expiresIn:(e=e.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()}}function pt(r,n){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,n.json()];case 1:return t=e.sent(),t=t.error,[2,ct.create("request-failed",{requestName:r,serverCode:t.code,serverMessage:t.message,serverStatus:t.status})]}})})}function ht(e){var t=e.apiKey;return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function dt(e,t){var r=t.refreshToken,n=ht(e);return n.append("Authorization",ot+" "+r),n}function vt(r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,r()];case 1:return 500<=(t=e.sent()).status&&t.status<600?[2,r()]:[2,t]}})})}function gt(t){return new Promise(function(e){setTimeout(e,t)})}var mt=/^[cdef][\w-]{21}$/,bt="";function yt(){try{var e=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16;var t=function(e){return btoa(String.fromCharCode.apply(String,a([],v(e)))).replace(/\+/g,"-").replace(/\//g,"_")}(e).substr(0,22);return mt.test(t)?t:bt}catch(e){return bt}}function _t(e){return e.appName+"!"+e.appId}var wt=new Map;function Et(e,t){var r=_t(e);It(r,t),function(e,t){var r=function(){!St&&"BroadcastChannel"in self&&((St=new BroadcastChannel("[Firebase] FID Change")).onmessage=function(e){It(e.data.key,e.data.fid)});return St}();r&&r.postMessage({key:e,fid:t});0===wt.size&&St&&(St.close(),St=null)}(r,t)}function It(e,t){var r,n,i=wt.get(e);if(i)try{for(var o=d(i),a=o.next();!a.done;a=o.next())(0,a.value)(t)}catch(e){r={error:e}}finally{try{a&&!a.done&&(n=o.return)&&n.call(o)}finally{if(r)throw r.error}}}var St=null;var Tt="firebase-installations-store",Ct=null;function At(){return Ct=Ct||ce("firebase-installations-database",1,{upgrade:function(e,t){0===t&&e.createObjectStore(Tt)}})}function Ot(o,a){return f(this,void 0,void 0,function(){var t,r,n,i;return h(this,function(e){switch(e.label){case 0:return t=_t(o),[4,At()];case 1:return n=e.sent(),r=n.transaction(Tt,"readwrite"),[4,(n=r.objectStore(Tt)).get(t)];case 2:return i=e.sent(),[4,n.put(a,t)];case 3:return e.sent(),[4,r.done];case 4:return e.sent(),i&&i.fid===a.fid||Et(o,a.fid),[2,a]}})})}function Dt(n){return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return t=_t(n),[4,At()];case 1:return r=e.sent(),[4,(r=r.transaction(Tt,"readwrite")).objectStore(Tt).delete(t)];case 2:return e.sent(),[4,r.done];case 3:return e.sent(),[2]}})})}function Nt(a,s){return f(this,void 0,void 0,function(){var t,r,n,i,o;return h(this,function(e){switch(e.label){case 0:return t=_t(a),[4,At()];case 1:return n=e.sent(),r=n.transaction(Tt,"readwrite"),[4,(n=r.objectStore(Tt)).get(t)];case 2:return i=e.sent(),void 0!==(o=s(i))?[3,4]:[4,n.delete(t)];case 3:return e.sent(),[3,6];case 4:return[4,n.put(o,t)];case 5:e.sent(),e.label=6;case 6:return[4,r.done];case 7:return e.sent(),!o||i&&i.fid===o.fid||Et(a,o.fid),[2,o]}})})}function Pt(i){return f(this,void 0,void 0,function(){var r,t,n;return h(this,function(e){switch(e.label){case 0:return[4,Nt(i.appConfig,function(e){var t=Mt(e||{fid:yt(),registrationStatus:0}),t=function(e,t){{if(0!==t.registrationStatus)return 1===t.registrationStatus?{installationEntry:t,registrationPromise:function(i){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return[4,kt(i.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.registrationStatus?[3,5]:[4,gt(100)];case 3:return e.sent(),[4,kt(i.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0!==t.registrationStatus?[3,7]:[4,Pt(i)];case 6:return n=e.sent(),r=n.installationEntry,(n=n.registrationPromise)?[2,n]:[2,r];case 7:return[2,t]}})})}(e)}:{installationEntry:t};if(!navigator.onLine){var r=Promise.reject(ct.create("app-offline"));return{installationEntry:t,registrationPromise:r}}var n={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},r=function(n,i){return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,2,,7]),[4,function(e,t){var s=e.appConfig,c=e.heartbeatServiceProvider,u=t.fid;return f(this,void 0,void 0,function(){var t,r,n,i,o,a;return h(this,function(e){switch(e.label){case 0:return t=lt(s),r=ht(s),(n=c.getImmediate({optional:!0}))?[4,n.getHeartbeatsHeader()]:[3,2];case 1:(n=e.sent())&&r.append("x-firebase-client",n),e.label=2;case 2:return a={fid:u,authVersion:ot,appId:s.appId,sdkVersion:it},i={method:"POST",headers:r,body:JSON.stringify(a)},[4,vt(function(){return fetch(t,i)})];case 3:return(o=e.sent()).ok?[4,o.json()]:[3,5];case 4:return a=e.sent(),[2,{fid:a.fid||u,registrationStatus:2,refreshToken:a.refreshToken,authToken:ft(a.authToken)}];case 5:return[4,pt("Create Installation",o)];case 6:throw e.sent()}})})}(n,i)];case 1:return t=e.sent(),[2,Ot(n.appConfig,t)];case 2:return ut(r=e.sent())&&409===r.customData.serverCode?[4,Dt(n.appConfig)]:[3,4];case 3:return e.sent(),[3,6];case 4:return[4,Ot(n.appConfig,{fid:i.fid,registrationStatus:0})];case 5:e.sent(),e.label=6;case 6:throw r;case 7:return[2]}})})}(e,n);return{installationEntry:n,registrationPromise:r}}}(i,t);return r=t.registrationPromise,t.installationEntry})];case 1:return(t=e.sent()).fid!==bt?[3,3]:(n={},[4,r]);case 2:return[2,(n.installationEntry=e.sent(),n)];case 3:return[2,{installationEntry:t,registrationPromise:r}]}})})}function kt(e){return Nt(e,function(e){if(!e)throw ct.create("installation-not-found");return Mt(e)})}function Mt(e){return 1===(t=e).registrationStatus&&t.registrationTime+nt<Date.now()?{fid:e.fid,registrationStatus:0}:e;var t}function Lt(e,c){var u=e.appConfig,l=e.heartbeatServiceProvider;return f(this,void 0,void 0,function(){var r,n,i,o,a,s;return h(this,function(e){switch(e.label){case 0:return t=c.fid,r=lt(u)+"/"+t+"/authTokens:generate",n=dt(u,c),(i=l.getImmediate({optional:!0}))?[4,i.getHeartbeatsHeader()]:[3,2];case 1:(i=e.sent())&&n.append("x-firebase-client",i),e.label=2;case 2:return s={installation:{sdkVersion:it,appId:u.appId}},o={method:"POST",headers:n,body:JSON.stringify(s)},[4,vt(function(){return fetch(r,o)})];case 3:return(a=e.sent()).ok?[4,a.json()]:[3,5];case 4:return s=e.sent(),[2,ft(s)];case 5:return[4,pt("Generate Auth Token",a)];case 6:throw e.sent()}var t})})}function Bt(i,o){return void 0===o&&(o=!1),f(this,void 0,void 0,function(){var n,t,r;return h(this,function(e){switch(e.label){case 0:return[4,Nt(i.appConfig,function(e){if(!jt(e))throw ct.create("not-registered");var t,r=e.authToken;if(o||2!==(t=r).requestStatus||function(e){var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+st}(t)){if(1===r.requestStatus)return n=function(n,i){return f(this,void 0,void 0,function(){var t,r;return h(this,function(e){switch(e.label){case 0:return[4,Rt(n.appConfig)];case 1:t=e.sent(),e.label=2;case 2:return 1!==t.authToken.requestStatus?[3,5]:[4,gt(100)];case 3:return e.sent(),[4,Rt(n.appConfig)];case 4:return t=e.sent(),[3,2];case 5:return 0===(r=t.authToken).requestStatus?[2,Bt(n,i)]:[2,r]}})})}(i,o),e;if(!navigator.onLine)throw ct.create("app-offline");r=(t=e,r={requestStatus:1,requestTime:Date.now()},p(p({},t),{authToken:r}));return n=function(i,o){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return e.trys.push([0,3,,8]),[4,Lt(i,o)];case 1:return t=e.sent(),n=p(p({},o),{authToken:t}),[4,Ot(i.appConfig,n)];case 2:return e.sent(),[2,t];case 3:return!ut(r=e.sent())||401!==r.customData.serverCode&&404!==r.customData.serverCode?[3,5]:[4,Dt(i.appConfig)];case 4:return e.sent(),[3,7];case 5:return n=p(p({},o),{authToken:{requestStatus:0}}),[4,Ot(i.appConfig,n)];case 6:e.sent(),e.label=7;case 7:throw r;case 8:return[2]}})})}(i,r),r}return e})];case 1:return t=e.sent(),n?[4,n]:[3,3];case 2:return r=e.sent(),[3,4];case 3:r=t.authToken,e.label=4;case 4:return[2,r]}})})}function Rt(e){return Nt(e,function(e){if(!jt(e))throw ct.create("not-registered");var t,r=e.authToken;return 1===(t=r).requestStatus&&t.requestTime+nt<Date.now()?p(p({},e),{authToken:{requestStatus:0}}):e})}function jt(e){return void 0!==e&&2===e.registrationStatus}function Ft(r,n){return void 0===n&&(n=!1),f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,function(r){return f(this,void 0,void 0,function(){var t;return h(this,function(e){switch(e.label){case 0:return[4,Pt(r)];case 1:return(t=e.sent().registrationPromise)?[4,t]:[3,3];case 2:e.sent(),e.label=3;case 3:return[2]}})})}(t=r)];case 1:return e.sent(),[4,Bt(t,n)];case 2:return[2,e.sent().token]}})})}function xt(e){return ct.create("missing-app-config-values",{valueName:e})}function Ut(e){var t=Se(e.getProvider("app").getImmediate(),Ht).getImmediate();return{getId:function(){return function(i){return f(this,void 0,void 0,function(){var t,r,n;return h(this,function(e){switch(e.label){case 0:return[4,Pt(t=i)];case 1:return r=e.sent(),n=r.installationEntry,(r.registrationPromise||Bt(t)).catch(console.error),[2,n.fid]}})})}(t)},getToken:function(e){return Ft(t,e)}}}var Ht="installations";Ie(new k(Ht,function(e){var t=e.getProvider("app").getImmediate();return{app:t,appConfig:function(e){var t,r;if(!e||!e.options)throw xt("App Configuration");if(!e.name)throw xt("App Name");try{for(var n=d(["projectId","apiKey","appId"]),i=n.next();!i.done;i=n.next()){var o=i.value;if(!e.options[o])throw xt(o)}}catch(e){t={error:e}}finally{try{i&&!i.done&&(r=n.return)&&r.call(n)}finally{if(t)throw t.error}}return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}}(t),heartbeatServiceProvider:Se(t,"heartbeat"),_delete:function(){return Promise.resolve()}}},"PUBLIC")),Ie(new k("installations-internal",Ut,"PRIVATE")),ke(rt,Te),ke(rt,Te,"esm5");var zt,Vt,qt="@firebase/performance",Wt="0.5.16",$t=Wt,Kt="FB-PERF-TRACE-MEASURE",Jt="@firebase/performance/config",Gt="@firebase/performance/configexpire",rt="Performance",Te=((Te={})["trace started"]="Trace {$traceName} was started before.",Te["trace stopped"]="Trace {$traceName} is not running.",Te["nonpositive trace startTime"]="Trace {$traceName} startTime should be positive.",Te["nonpositive trace duration"]="Trace {$traceName} duration should be positive.",Te["no window"]="Window is not available.",Te["no app id"]="App id is not available.",Te["no project id"]="Project id is not available.",Te["no api key"]="Api key is not available.",Te["invalid cc log"]="Attempted to queue invalid cc event",Te["FB not default"]="Performance can only start when Firebase app instance is the default one.",Te["RC response not ok"]="RC response is not ok",Te["invalid attribute name"]="Attribute name {$attributeName} is invalid.",Te["invalid attribute value"]="Attribute value {$attributeValue} is invalid.",Te["invalid custom metric name"]="Custom metric name {$customMetricName} is invalid",Te["invalid String merger input"]="Input for String merger is invalid, contact support team to resolve.",Te["already initialized"]="initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance.",Te),Yt=new E("performance",rt,Te),Xt=new $(rt);Xt.logLevel=x.INFO;var Zt,Qt,er=(tr.prototype.getUrl=function(){return this.windowLocation.href.split("?")[0]},tr.prototype.mark=function(e){this.performance&&this.performance.mark&&this.performance.mark(e)},tr.prototype.measure=function(e,t,r){this.performance&&this.performance.measure&&this.performance.measure(e,t,r)},tr.prototype.getEntriesByType=function(e){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(e):[]},tr.prototype.getEntriesByName=function(e){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(e):[]},tr.prototype.getTimeOrigin=function(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)},tr.prototype.requiredApisAvailable=function(){return fetch&&Promise&&"undefined"!=typeof navigator&&navigator.cookieEnabled?!!t()||(Xt.info("IndexedDB is not supported by current browswer"),!1):(Xt.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)},tr.prototype.setupObserver=function(e,i){this.PerformanceObserver&&new this.PerformanceObserver(function(e){for(var t=0,r=e.getEntries();t<r.length;t++){var n=r[t];i(n)}}).observe({entryTypes:[e]})},tr.getInstance=function(){return zt=void 0===zt?new tr(Vt):zt},tr);function tr(e){if(!(this.window=e))throw Yt.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 rr(e,t){var r=e.length-t.length;if(r<0||1<r)throw Yt.create("invalid String merger input");for(var n=[],i=0;i<e.length;i++)n.push(e.charAt(i)),t.length>i&&n.push(t.charAt(i));return n.join("")}var nr,ir,or=(ar.prototype.getFlTransportFullUrl=function(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)},ar.getInstance=function(){return Qt=void 0===Qt?new ar:Qt},ar);function ar(){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=rr("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=rr("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}(ir=nr=nr||{})[ir.UNKNOWN=0]="UNKNOWN",ir[ir.VISIBLE=1]="VISIBLE",ir[ir.HIDDEN=2]="HIDDEN";var sr=["firebase_","google_","ga_"],cr=new RegExp("^[a-zA-Z]\\w*$");function ur(){switch(er.getInstance().document.visibilityState){case"visible":return nr.VISIBLE;case"hidden":return nr.HIDDEN;default:return nr.UNKNOWN}}function lr(e){var t=null===(t=e.options)||void 0===t?void 0:t.appId;if(!t)throw Yt.create("no app id");return t}var fr="0.0.1",pr={loggingEnabled:!0},hr="FIREBASE_INSTALLATIONS_AUTH";function dr(e,t){var n,i,r=function(){var e=er.getInstance().localStorage;if(e){var t=e.getItem(Gt);if(t&&function(e){return Number(e)>Date.now()}(t)){e=e.getItem(Jt);if(e)try{return JSON.parse(e)}catch(e){return}}}}();return r?(gr(r),Promise.resolve()):(i=t,function(e){var t=e.getToken();return t.then(function(e){}),t}((n=e).installations).then(function(e){var t=function(e){var t=null===(t=e.options)||void 0===t?void 0:t.projectId;if(!t)throw Yt.create("no project id");return t}(n.app),r=function(e){var t=null===(t=e.options)||void 0===t?void 0:t.apiKey;if(!t)throw Yt.create("no api key");return t}(n.app),r=new Request("https://firebaseremoteconfig.googleapis.com/v1/projects/"+t+"/namespaces/fireperf:fetch?key="+r,{method:"POST",headers:{Authorization:hr+" "+e},body:JSON.stringify({app_instance_id:i,app_instance_id_token:e,app_id:lr(n.app),app_version:$t,sdk_version:fr})});return fetch(r).then(function(e){if(e.ok)return e.json();throw Yt.create("RC response not ok")})}).catch(function(){Xt.info(vr)}).then(gr).then(function(e){var t;e=e,t=er.getInstance().localStorage,e&&t&&(t.setItem(Jt,JSON.stringify(e)),t.setItem(Gt,String(Date.now()+60*or.getInstance().configTimeToLive*60*1e3)))},function(){}))}var vr="Could not fetch config, will use default configs";function gr(e){if(!e)return e;var t=or.getInstance(),r=e.entries||{};return void 0!==r.fpr_enabled?t.loggingEnabled="true"===String(r.fpr_enabled):t.loggingEnabled=pr.loggingEnabled,r.fpr_log_source?t.logSource=Number(r.fpr_log_source):pr.logSource&&(t.logSource=pr.logSource),r.fpr_log_endpoint_url?t.logEndPointUrl=r.fpr_log_endpoint_url:pr.logEndPointUrl&&(t.logEndPointUrl=pr.logEndPointUrl),r.fpr_log_transport_key?t.transportKey=r.fpr_log_transport_key:pr.transportKey&&(t.transportKey=pr.transportKey),void 0!==r.fpr_vc_network_request_sampling_rate?t.networkRequestsSamplingRate=Number(r.fpr_vc_network_request_sampling_rate):void 0!==pr.networkRequestsSamplingRate&&(t.networkRequestsSamplingRate=pr.networkRequestsSamplingRate),void 0!==r.fpr_vc_trace_sampling_rate?t.tracesSamplingRate=Number(r.fpr_vc_trace_sampling_rate):void 0!==pr.tracesSamplingRate&&(t.tracesSamplingRate=pr.tracesSamplingRate),t.logTraceAfterSampling=mr(t.tracesSamplingRate),t.logNetworkAfterSampling=mr(t.networkRequestsSamplingRate),e}function mr(e){return Math.random()<=e}var br,yr=1;function _r(e){var r;return yr=2,br=br||(r=e,function(){var r=er.getInstance().document;return new Promise(function(e){var t;r&&"complete"!==r.readyState?(t=function(){"complete"===r.readyState&&(r.removeEventListener("readystatechange",t),e())},r.addEventListener("readystatechange",t)):e()})}().then(function(){return e=r.installations,(t=e.getId()).then(function(e){Zt=e}),t;var e,t}).then(function(e){return dr(r,e)}).then(wr,wr))}function wr(){yr=3}var Er,Ir=1e4,Sr=3,Tr=1e3,Cr=Sr,Ar=[],Or=!1;function Dr(e){setTimeout(function(){var e,t;if(0!==Cr)return Ar.length?(e=Ar.splice(0,Tr),t=e.map(function(e){return{source_extension_json_proto3:e.message,event_time_ms:String(e.eventTime)}}),void function(e,n){return function(e){var t=or.getInstance().getFlTransportFullUrl();return fetch(t,{method:"POST",body:JSON.stringify(e)})}(e).then(function(e){return e.ok||Xt.info("Call to Firebase backend failed."),e.json()}).then(function(e){var t=Number(e.nextRequestWaitMillis),r=Ir;isNaN(t)||(r=Math.max(t,r));t=e.logResponseDetails;Array.isArray(t)&&0<t.length&&"RETRY_REQUEST_LATER"===t[0].responseAction&&(Ar=a(a([],n),Ar),Xt.info("Retry transport request later.")),Cr=Sr,Dr(r)})}({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:or.getInstance().logSource,log_event:t},e).catch(function(){Ar=a(a([],e),Ar),Cr--,Xt.info("Tries left: "+Cr+"."),Dr(Ir)})):Dr(Ir)},e)}function Nr(r){return function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];!function(e){if(!e.eventTime||!e.message)throw Yt.create("invalid cc log");Ar=a(a([],Ar),[e])}({message:r.apply(void 0,e),eventTime:Date.now()})}}function Pr(e,t){(Er=Er||Nr(Lr))(e,t)}function kr(e){var t=or.getInstance();!t.instrumentationEnabled&&e.isAuto||(t.dataCollectionEnabled||e.isAuto)&&er.getInstance().requiredApisAvailable()&&(e.isAuto&&ur()!==nr.VISIBLE||(3===yr?Mr(e):_r(e.performanceController).then(function(){return Mr(e)},function(){return Mr(e)})))}function Mr(e){var t;!Zt||(t=or.getInstance()).loggingEnabled&&t.logTraceAfterSampling&&setTimeout(function(){return Pr(e,1)},0)}function Lr(e,t){return 0===t?(r={url:e.url,http_method:e.httpMethod||0,http_response_code:200,response_payload_bytes:e.responsePayloadBytes,client_start_time_us:e.startTimeUs,time_to_response_initiated_us:e.timeToResponseInitiatedUs,time_to_response_completed_us:e.timeToResponseCompletedUs},r={application_info:Br(e.performanceController.app),network_request_metric:r},JSON.stringify(r)):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 r=e.getAttributes();0!==Object.keys(r).length&&(t.custom_attributes=r);t={application_info:Br(e.performanceController.app),trace_metric:t};return JSON.stringify(t)}(e);var r}function Br(e){return{google_app_id:lr(e),app_instance_id:Zt,web_app_info:{sdk_version:$t,page_url:er.getInstance().getUrl(),service_worker_status:"serviceWorker"in(t=er.getInstance().navigator)?t.serviceWorker.controller?2:3:1,visibility_state:ur(),effective_connection_type:function(){var e=er.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 t}var Rr=["_fp","_fcp","_fid"];var jr=(Fr.prototype.start=function(){if(1!==this.state)throw Yt.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2},Fr.prototype.stop=function(){if(2!==this.state)throw Yt.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(),kr(this)},Fr.prototype.record=function(e,t,r){if(e<=0)throw Yt.create("nonpositive trace startTime",{traceName:this.name});if(t<=0)throw Yt.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*t),this.startTimeUs=Math.floor(1e3*e),r&&r.attributes&&(this.customAttributes=p({},r.attributes)),r&&r.metrics)for(var n=0,i=Object.keys(r.metrics);n<i.length;n++){var o=i[n];isNaN(Number(r.metrics[o]))||(this.counters[o]=Math.floor(Number(r.metrics[o])))}kr(this)},Fr.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)},Fr.prototype.putMetric=function(e,t){if(n=e,i=this.name,0===n.length||100<n.length||!(i&&i.startsWith("_wt_")&&-1<Rr.indexOf(n))&&n.startsWith("_"))throw Yt.create("invalid custom metric name",{customMetricName:e});var r,n,i;this.counters[e]=(t=null!=t?t:0,(r=Math.floor(t))<t&&Xt.info("Metric value should be an Integer, setting the value as : "+r+"."),r)},Fr.prototype.getMetric=function(e){return this.counters[e]||0},Fr.prototype.putAttribute=function(e,t){var r,n,i=!(0===(r=e).length||40<r.length)&&(!sr.some(function(e){return r.startsWith(e)})&&!!r.match(cr)),o=0!==(n=t).length&&n.length<=100;if(i&&o)this.customAttributes[e]=t;else{if(!i)throw Yt.create("invalid attribute name",{attributeName:e});if(!o)throw Yt.create("invalid attribute value",{attributeValue:t})}},Fr.prototype.getAttribute=function(e){return this.customAttributes[e]},Fr.prototype.removeAttribute=function(e){void 0!==this.customAttributes[e]&&delete this.customAttributes[e]},Fr.prototype.getAttributes=function(){return p({},this.customAttributes)},Fr.prototype.setStartTime=function(e){this.startTimeUs=e},Fr.prototype.setDuration=function(e){this.durationUs=e},Fr.prototype.calculateTraceMetrics=function(){var e=this.api.getEntriesByName(this.traceMeasure),e=e&&e[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))},Fr.createOobTrace=function(e,t,r,n){var i,o=er.getInstance().getUrl();o&&(i=new Fr(e,"_wt_"+o,!0),o=Math.floor(1e3*er.getInstance().getTimeOrigin()),i.setStartTime(o),t&&t[0]&&(i.setDuration(Math.floor(1e3*t[0].duration)),i.putMetric("domInteractive",Math.floor(1e3*t[0].domInteractive)),i.putMetric("domContentLoadedEventEnd",Math.floor(1e3*t[0].domContentLoadedEventEnd)),i.putMetric("loadEventEnd",Math.floor(1e3*t[0].loadEventEnd))),r&&((o=r.find(function(e){return"first-paint"===e.name}))&&o.startTime&&i.putMetric("_fp",Math.floor(1e3*o.startTime)),(o=r.find(function(e){return"first-contentful-paint"===e.name}))&&o.startTime&&i.putMetric("_fcp",Math.floor(1e3*o.startTime)),n&&i.putMetric("_fid",Math.floor(1e3*n))),kr(i))},Fr.createUserTimingTrace=function(e,t){kr(new Fr(e,t,!1,t))},Fr);function Fr(e,t,r,n){void 0===r&&(r=!1),this.performanceController=e,this.name=t,this.isAuto=r,this.state=1,this.customAttributes={},this.counters={},this.api=er.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||Kt+"-"+this.randomId+"-"+this.name,n&&this.calculateTraceMetrics())}function xr(e,t){var r,n,i,o,a=t;a&&void 0!==a.responseStart&&(i=er.getInstance().getTimeOrigin(),o=Math.floor(1e3*(a.startTime+i)),n=a.responseStart?Math.floor(1e3*(a.responseStart-a.startTime)):void 0,i=Math.floor(1e3*(a.responseEnd-a.startTime)),a={performanceController:e,url:a.name&&a.name.split("?")[0],responsePayloadBytes:a.transferSize,startTimeUs:o,timeToResponseInitiatedUs:n,timeToResponseCompletedUs:i},r=a,(o=or.getInstance()).instrumentationEnabled&&(n=r.url,i=o.logEndPointUrl.split("?")[0],a=o.flTransportEndpointUrl.split("?")[0],n!==i&&n!==a&&o.loggingEnabled&&o.logNetworkAfterSampling&&setTimeout(function(){return Pr(r,0)},0)))}var Ur=5e3;function Hr(e){Zt&&(setTimeout(function(){return function(t){var e=er.getInstance(),r=e.getEntriesByType("navigation"),n=e.getEntriesByType("paint");{var i;e.onFirstInputDelay?(i=setTimeout(function(){jr.createOobTrace(t,r,n),i=void 0},Ur),e.onFirstInputDelay(function(e){i&&(clearTimeout(i),jr.createOobTrace(t,r,n,e))})):jr.createOobTrace(t,r,n)}}(e)},0),setTimeout(function(){return function(t){for(var e=er.getInstance(),r=e.getEntriesByType("resource"),n=0,i=r;n<i.length;n++){var o=i[n];xr(t,o)}e.setupObserver("resource",function(e){return xr(t,e)})}(e)},0),setTimeout(function(){return function(t){for(var e=er.getInstance(),r=e.getEntriesByType("measure"),n=0,i=r;n<i.length;n++){var o=i[n];zr(t,o)}e.setupObserver("measure",function(e){return zr(t,e)})}(e)},0))}function zr(e,t){var r=t.name;r.substring(0,Kt.length)!==Kt&&jr.createUserTimingTrace(e,r)}var Vr=(qr.prototype._init=function(e){var t=this;this.initialized||(void 0!==(null==e?void 0:e.dataCollectionEnabled)&&(this.dataCollectionEnabled=e.dataCollectionEnabled),void 0!==(null==e?void 0:e.instrumentationEnabled)&&(this.instrumentationEnabled=e.instrumentationEnabled),er.getInstance().requiredApisAvailable()?s().then(function(e){e&&(Or||(Dr(5500),Or=!0),_r(t).then(function(){return Hr(t)},function(){return Hr(t)}),t.initialized=!0)}).catch(function(e){Xt.info("Environment doesn't support IndexedDB: "+e)}):Xt.info('Firebase Performance cannot start if the browser does not support "Fetch" and "Promise", or cookies are disabled.'))},Object.defineProperty(qr.prototype,"instrumentationEnabled",{get:function(){return or.getInstance().instrumentationEnabled},set:function(e){or.getInstance().instrumentationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(qr.prototype,"dataCollectionEnabled",{get:function(){return or.getInstance().dataCollectionEnabled},set:function(e){or.getInstance().dataCollectionEnabled=e},enumerable:!1,configurable:!0}),qr);function qr(e,t){this.app=e,this.installations=t,this.initialized=!1}var Wr="[DEFAULT]";Ie(new k("performance",function(e,t){var r=t.options,n=e.getProvider("app").getImmediate(),i=e.getProvider("installations-internal").getImmediate();if(n.name!==Wr)throw Yt.create("FB not default");if("undefined"==typeof window)throw Yt.create("no window");Vt=window;i=new Vr(n,i);return i._init(r),i},"PUBLIC")),ke(qt,Wt),ke(qt,Wt,"esm5");var $r=(Object.defineProperty(Kr.prototype,"instrumentationEnabled",{get:function(){return this._delegate.instrumentationEnabled},set:function(e){this._delegate.instrumentationEnabled=e},enumerable:!1,configurable:!0}),Object.defineProperty(Kr.prototype,"dataCollectionEnabled",{get:function(){return this._delegate.dataCollectionEnabled},set:function(e){this._delegate.dataCollectionEnabled=e},enumerable:!1,configurable:!0}),Kr.prototype.trace=function(e){return t=this._delegate,t=(r=t)&&r._delegate?r._delegate:r,new jr(t,e);var t,r},Kr);function Kr(e,t){this.app=e,this._delegate=t}var Jr;function Gr(e){var t=e.getProvider("app-compat").getImmediate(),r=e.getProvider("performance").getImmediate();return new $r(t,r)}(Jr=tt).INTERNAL.registerComponent(new k("performance-compat",Gr,"PUBLIC")),Jr.registerVersion("@firebase/performance-compat","0.1.16");return tt.registerVersion("firebase","9.13.0","compat-lite"),tt});
2
2
  //# sourceMappingURL=firebase-performance-standalone-compat.js.map
@@ -1,3 +1,3 @@
1
- import{registerVersion as t,_registerComponent as e,_getProvider as n,getApp as r}from"https://www.gstatic.com/firebasejs/9.12.1/firebase-app.js";class i extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,i.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,o.prototype.create)}}class o{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,o=this.errors[t],s=o?function(t,e){return t.replace(a,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(o,n):"Error",c=`${this.serviceName}: ${s} (${r}).`;return new i(r,c,n)}}const a=/\{\$([^}]+)}/g;function s(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const n=t[i],o=e[i];if(c(n)&&c(o)){if(!s(n,o))return!1}else if(n!==o)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function c(t){return null!==t&&"object"==typeof t}function u(t){return t&&t._delegate?t._delegate:t}var l;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(l||(l={}));const f={debug:l.DEBUG,verbose:l.VERBOSE,info:l.INFO,warn:l.WARN,error:l.ERROR,silent:l.SILENT},p=l.INFO,d={[l.DEBUG]:"log",[l.VERBOSE]:"log",[l.INFO]:"info",[l.WARN]:"warn",[l.ERROR]:"error"},g=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=d[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class h{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}let m,v;const w=new WeakMap,b=new WeakMap,y=new WeakMap,E=new WeakMap,_=new WeakMap;let I={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return b.get(t);if("objectStoreNames"===e)return t.objectStoreNames||y.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return k(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function T(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(v||(v=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(N(this),e),k(w.get(this))}:function(...e){return k(t.apply(N(this),e))}:function(e,...n){const r=t.call(N(this),e,...n);return y.set(r,e.sort?e.sort():[e]),k(r)}}function S(t){return"function"==typeof t?T(t):(t instanceof IDBTransaction&&function(t){if(b.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{e(),r()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)}));b.set(t,e)}(t),e=t,(m||(m=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,I):t);var e}function k(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{e(k(t.result)),r()},o=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",o)}));return e.then((e=>{e instanceof IDBCursor&&w.set(e,t)})).catch((()=>{})),_.set(e,t),e}(t);if(E.has(t))return E.get(t);const e=S(t);return e!==t&&(E.set(t,e),_.set(e,t)),e}const N=t=>_.get(t);const R=["get","getKey","getAll","getAllKeys","count"],A=["put","add","delete","clear"],O=new Map;function M(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(O.get(e))return O.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=A.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!R.includes(n))return;const o=async function(t,...e){const o=this.transaction(t,i?"readwrite":"readonly");let a=o.store;return r&&(a=a.index(e.shift())),(await Promise.all([a[n](...e),i&&o.done]))[0]};return O.set(e,o),o}I=(t=>({...t,get:(e,n,r)=>M(e,n)||t.get(e,n,r),has:(e,n)=>!!M(e,n)||t.has(e,n)}))(I);const C="@firebase/installations",P=new o("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function D(t){return t instanceof i&&t.code.includes("request-failed")}function B({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function L(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function j(t,e){const n=(await e.json()).error;return P.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function U({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function F(t,{refreshToken:e}){const n=U(t);return n.append("Authorization",function(t){return`FIS_v2 ${t}`}(e)),n}async function $(t){const e=await t();return e.status>=500&&e.status<600?t():e}function q(t){return new Promise((e=>{setTimeout(e,t)}))}const H=/^[cdef][\w-]{21}$/;function x(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){return(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return H.test(e)?e:""}catch(t){return""}}function V(t){return`${t.appName}!${t.appId}`}const W=new Map;function K(t,e){const n=V(t);z(n,e),function(t,e){const n=function(){!G&&"BroadcastChannel"in self&&(G=new BroadcastChannel("[Firebase] FID Change"),G.onmessage=t=>{z(t.data.key,t.data.fid)});return G}();n&&n.postMessage({key:t,fid:e});0===W.size&&G&&(G.close(),G=null)}(n,e)}function z(t,e){const n=W.get(t);if(n)for(const t of n)t(e)}let G=null;const J="firebase-installations-store";let Y=null;function Z(){return Y||(Y=function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const a=indexedDB.open(t,e),s=k(a);return r&&a.addEventListener("upgradeneeded",(t=>{r(k(a.result),t.oldVersion,t.newVersion,k(a.transaction))})),n&&a.addEventListener("blocked",(()=>n())),s.then((t=>{o&&t.addEventListener("close",(()=>o())),i&&t.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(J)}})),Y}async function Q(t,e){const n=V(t),r=(await Z()).transaction(J,"readwrite"),i=r.objectStore(J),o=await i.get(n);return await i.put(e,n),await r.done,o&&o.fid===e.fid||K(t,e.fid),e}async function X(t){const e=V(t),n=(await Z()).transaction(J,"readwrite");await n.objectStore(J).delete(e),await n.done}async function tt(t,e){const n=V(t),r=(await Z()).transaction(J,"readwrite"),i=r.objectStore(J),o=await i.get(n),a=e(o);return void 0===a?await i.delete(n):await i.put(a,n),await r.done,!a||o&&o.fid===a.fid||K(t,a.fid),a}async function et(t){let e;const n=await tt(t.appConfig,(n=>{const r=function(t){return it(t||{fid:x(),registrationStatus:0})}(n),i=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(P.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=B(t),i=U(t),o=e.getImmediate({optional:!0});if(o){const t=await o.getHeartbeatsHeader();t&&i.append("x-firebase-client",t)}const a={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:"w:0.5.15"},s={method:"POST",headers:i,body:JSON.stringify(a)},c=await $((()=>fetch(r,s)));if(c.ok){const t=await c.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:L(t.authToken)}}throw await j("Create Installation",c)}(t,e);return Q(t.appConfig,n)}catch(n){throw D(n)&&409===n.customData.serverCode?await X(t.appConfig):await Q(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:r}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:nt(t)}:{installationEntry:e}}(t,r);return e=i.registrationPromise,i.installationEntry}));return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function nt(t){let e=await rt(t.appConfig);for(;1===e.registrationStatus;)await q(100),e=await rt(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await et(t);return n||e}return e}function rt(t){return tt(t,(t=>{if(!t)throw P.create("installation-not-found");return it(t)}))}function it(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function ot({appConfig:t,heartbeatServiceProvider:e},n){const r=function(t,{fid:e}){return`${B(t)}/${e}/authTokens:generate`}(t,n),i=F(t,n),o=e.getImmediate({optional:!0});if(o){const t=await o.getHeartbeatsHeader();t&&i.append("x-firebase-client",t)}const a={installation:{sdkVersion:"w:0.5.15",appId:t.appId}},s={method:"POST",headers:i,body:JSON.stringify(a)},c=await $((()=>fetch(r,s)));if(c.ok){return L(await c.json())}throw await j("Generate Auth Token",c)}async function at(t,e=!1){let n;const r=await tt(t.appConfig,(r=>{if(!ct(r))throw P.create("not-registered");const i=r.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+36e5}(t)}(i))return r;if(1===i.requestStatus)return n=async function(t,e){let n=await st(t.appConfig);for(;1===n.authToken.requestStatus;)await q(100),n=await st(t.appConfig);const r=n.authToken;return 0===r.requestStatus?at(t,e):r}(t,e),r;{if(!navigator.onLine)throw P.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}(r);return n=async function(t,e){try{const n=await ot(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await Q(t.appConfig,r),n}catch(n){if(!D(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await Q(t.appConfig,n)}else await X(t.appConfig);throw n}}(t,e),e}}));return n?await n:r.authToken}function st(t){return tt(t,(t=>{if(!ct(t))throw P.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t;var n}))}function ct(t){return void 0!==t&&2===t.registrationStatus}async function ut(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await et(t);e&&await e}(n);return(await at(n,e)).token}function lt(t){return P.create("missing-app-config-values",{valueName:t})}const ft=t=>{const e=t.getProvider("app").getImmediate(),r=n(e,"installations").getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:r}=await et(e);return r?r.catch(console.error):at(e).catch(console.error),n.fid}(r),getToken:t=>ut(r,t)}};e(new h("installations",(t=>{const e=t.getProvider("app").getImmediate(),r=function(t){if(!t||!t.options)throw lt("App Configuration");if(!t.name)throw lt("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw lt(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:r,heartbeatServiceProvider:n(e,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),e(new h("installations-internal",ft,"PRIVATE")),t(C,"0.5.15"),t(C,"0.5.15","esm2017");const pt="@firebase/performance",dt=new o("performance","Performance",{"trace started":"Trace {$traceName} was started before.","trace stopped":"Trace {$traceName} is not running.","nonpositive trace startTime":"Trace {$traceName} startTime should be positive.","nonpositive trace duration":"Trace {$traceName} duration should be positive.","no window":"Window is not available.","no app id":"App id is not available.","no project id":"Project id is not available.","no api key":"Api key is not available.","invalid cc log":"Attempted to queue invalid cc event","FB not default":"Performance can only start when Firebase app instance is the default one.","RC response not ok":"RC response is not ok","invalid attribute name":"Attribute name {$attributeName} is invalid.","invalid attribute value":"Attribute value {$attributeValue} is invalid.","invalid custom metric name":"Custom metric name {$customMetricName} is invalid","invalid String merger input":"Input for String merger is invalid, contact support team to resolve.","already initialized":"initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance."}),gt=new class{constructor(t){this.name=t,this._logLevel=p,this._logHandler=g,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in l))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?f[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,l.DEBUG,...t),this._logHandler(this,l.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,l.VERBOSE,...t),this._logHandler(this,l.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,l.INFO,...t),this._logHandler(this,l.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,l.WARN,...t),this._logHandler(this,l.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,l.ERROR,...t),this._logHandler(this,l.ERROR,...t)}}("Performance");let ht,mt,vt,wt;gt.logLevel=l.INFO;class bt{constructor(t){if(this.window=t,!t)throw dt.create("no window");this.performance=t.performance,this.PerformanceObserver=t.PerformanceObserver,this.windowLocation=t.location,this.navigator=t.navigator,this.document=t.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=t.localStorage),t.perfMetrics&&t.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=t.perfMetrics.onFirstInputDelay)}getUrl(){return this.windowLocation.href.split("?")[0]}mark(t){this.performance&&this.performance.mark&&this.performance.mark(t)}measure(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)}getEntriesByType(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]}getEntriesByName(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]}getTimeOrigin(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)}requiredApisAvailable(){return fetch&&Promise&&"undefined"!=typeof navigator&&navigator.cookieEnabled?"object"==typeof indexedDB||(gt.info("IndexedDB is not supported by current browswer"),!1):(gt.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)}setupObserver(t,e){if(!this.PerformanceObserver)return;new this.PerformanceObserver((t=>{for(const n of t.getEntries())e(n)})).observe({entryTypes:[t]})}static getInstance(){return void 0===ht&&(ht=new bt(mt)),ht}}function yt(){return vt}function Et(t,e){const n=t.length-e.length;if(n<0||n>1)throw dt.create("invalid String merger input");const r=[];for(let n=0;n<t.length;n++)r.push(t.charAt(n)),e.length>n&&r.push(e.charAt(n));return r.join("")}class _t{constructor(){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=Et("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=Et("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}getFlTransportFullUrl(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)}static getInstance(){return void 0===wt&&(wt=new _t),wt}}var It;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VISIBLE=1]="VISIBLE",t[t.HIDDEN=2]="HIDDEN"}(It||(It={}));const Tt=["firebase_","google_","ga_"],St=new RegExp("^[a-zA-Z]\\w*$");function kt(){const t=bt.getInstance().navigator;return"serviceWorker"in t?t.serviceWorker.controller?2:3:1}function Nt(){switch(bt.getInstance().document.visibilityState){case"visible":return It.VISIBLE;case"hidden":return It.HIDDEN;default:return It.UNKNOWN}}function Rt(){const t=bt.getInstance().navigator.connection;switch(t&&t.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}function At(t){var e;const n=null===(e=t.options)||void 0===e?void 0:e.appId;if(!n)throw dt.create("no app id");return n}const Ot={loggingEnabled:!0};function Mt(t,e){const n=function(){const t=bt.getInstance().localStorage;if(!t)return;const e=t.getItem("@firebase/performance/configexpire");if(!(e&&(n=e,Number(n)>Date.now())))return;var n;const r=t.getItem("@firebase/performance/config");if(!r)return;try{return JSON.parse(r)}catch(t){return}}();return n?(Ct(n),Promise.resolve()):function(t,e){return function(t){const e=t.getToken();return e.then((t=>{})),e}(t.installations).then((n=>{const r=function(t){var e;const n=null===(e=t.options)||void 0===e?void 0:e.projectId;if(!n)throw dt.create("no project id");return n}(t.app),i=function(t){var e;const n=null===(e=t.options)||void 0===e?void 0:e.apiKey;if(!n)throw dt.create("no api key");return n}(t.app),o=new Request(`https://firebaseremoteconfig.googleapis.com/v1/projects/${r}/namespaces/fireperf:fetch?key=${i}`,{method:"POST",headers:{Authorization:`FIREBASE_INSTALLATIONS_AUTH ${n}`},body:JSON.stringify({app_instance_id:e,app_instance_id_token:n,app_id:At(t.app),app_version:"0.5.15",sdk_version:"0.0.1"})});return fetch(o).then((t=>{if(t.ok)return t.json();throw dt.create("RC response not ok")}))})).catch((()=>{gt.info("Could not fetch config, will use default configs")}))}(t,e).then(Ct).then((t=>function(t){const e=bt.getInstance().localStorage;if(!t||!e)return;e.setItem("@firebase/performance/config",JSON.stringify(t)),e.setItem("@firebase/performance/configexpire",String(Date.now()+60*_t.getInstance().configTimeToLive*60*1e3))}(t)),(()=>{}))}function Ct(t){if(!t)return t;const e=_t.getInstance(),n=t.entries||{};return void 0!==n.fpr_enabled?e.loggingEnabled="true"===String(n.fpr_enabled):e.loggingEnabled=Ot.loggingEnabled,n.fpr_log_source?e.logSource=Number(n.fpr_log_source):Ot.logSource&&(e.logSource=Ot.logSource),n.fpr_log_endpoint_url?e.logEndPointUrl=n.fpr_log_endpoint_url:Ot.logEndPointUrl&&(e.logEndPointUrl=Ot.logEndPointUrl),n.fpr_log_transport_key?e.transportKey=n.fpr_log_transport_key:Ot.transportKey&&(e.transportKey=Ot.transportKey),void 0!==n.fpr_vc_network_request_sampling_rate?e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate):void 0!==Ot.networkRequestsSamplingRate&&(e.networkRequestsSamplingRate=Ot.networkRequestsSamplingRate),void 0!==n.fpr_vc_trace_sampling_rate?e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate):void 0!==Ot.tracesSamplingRate&&(e.tracesSamplingRate=Ot.tracesSamplingRate),e.logTraceAfterSampling=Pt(e.tracesSamplingRate),e.logNetworkAfterSampling=Pt(e.networkRequestsSamplingRate),t}function Pt(t){return Math.random()<=t}let Dt,Bt=1;function Lt(t){return Bt=2,Dt=Dt||function(t){return function(){const t=bt.getInstance().document;return new Promise((e=>{if(t&&"complete"!==t.readyState){const n=()=>{"complete"===t.readyState&&(t.removeEventListener("readystatechange",n),e())};t.addEventListener("readystatechange",n)}else e()}))}().then((()=>function(t){const e=t.getId();return e.then((t=>{vt=t})),e}(t.installations))).then((e=>Mt(t,e))).then((()=>jt()),(()=>jt()))}(t),Dt}function jt(){Bt=3}let Ut,Ft=3,$t=[],qt=!1;function Ht(t){setTimeout((()=>{if(0!==Ft)return $t.length?void function(){const t=$t.splice(0,1e3),e=t.map((t=>({source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)})));(function(t,e){return function(t){const e=_t.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then((t=>(t.ok||gt.info("Call to Firebase backend failed."),t.json()))).then((t=>{const n=Number(t.nextRequestWaitMillis);let r=1e4;isNaN(n)||(r=Math.max(n,r));const i=t.logResponseDetails;Array.isArray(i)&&i.length>0&&"RETRY_REQUEST_LATER"===i[0].responseAction&&($t=[...e,...$t],gt.info("Retry transport request later.")),Ft=3,Ht(r)}))})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:_t.getInstance().logSource,log_event:e},t).catch((()=>{$t=[...t,...$t],Ft--,gt.info(`Tries left: ${Ft}.`),Ht(1e4)}))}():Ht(1e4)}),t)}function xt(t){return(...e)=>{!function(t){if(!t.eventTime||!t.message)throw dt.create("invalid cc log");$t=[...$t,t]}({message:t(...e),eventTime:Date.now()})}}function Vt(t,e){Ut||(Ut=xt(zt)),Ut(t,e)}function Wt(t){const e=_t.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&bt.getInstance().requiredApisAvailable()&&(t.isAuto&&Nt()!==It.VISIBLE||(3===Bt?Kt(t):Lt(t.performanceController).then((()=>Kt(t)),(()=>Kt(t)))))}function Kt(t){if(!yt())return;const e=_t.getInstance();e.loggingEnabled&&e.logTraceAfterSampling&&setTimeout((()=>Vt(t,1)),0)}function zt(t,e){return 0===e?function(t){const e={url:t.url,http_method:t.httpMethod||0,http_response_code:200,response_payload_bytes:t.responsePayloadBytes,client_start_time_us:t.startTimeUs,time_to_response_initiated_us:t.timeToResponseInitiatedUs,time_to_response_completed_us:t.timeToResponseCompletedUs},n={application_info:Gt(t.performanceController.app),network_request_metric:e};return JSON.stringify(n)}(t):function(t){const e={name:t.name,is_auto:t.isAuto,client_start_time_us:t.startTimeUs,duration_us:t.durationUs};0!==Object.keys(t.counters).length&&(e.counters=t.counters);const n=t.getAttributes();0!==Object.keys(n).length&&(e.custom_attributes=n);const r={application_info:Gt(t.performanceController.app),trace_metric:e};return JSON.stringify(r)}(t)}function Gt(t){return{google_app_id:At(t),app_instance_id:yt(),web_app_info:{sdk_version:"0.5.15",page_url:bt.getInstance().getUrl(),service_worker_status:kt(),visibility_state:Nt(),effective_connection_type:Rt()},application_process_state:0}}const Jt=["_fp","_fcp","_fid"];class Yt{constructor(t,e,n=!1,r){this.performanceController=t,this.name=e,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())}start(){if(1!==this.state)throw dt.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2}stop(){if(2!==this.state)throw dt.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(),Wt(this)}record(t,e,n){if(t<=0)throw dt.create("nonpositive trace startTime",{traceName:this.name});if(e<=0)throw dt.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=Object.assign({},n.attributes)),n&&n.metrics)for(const t of Object.keys(n.metrics))isNaN(Number(n.metrics[t]))||(this.counters[t]=Math.floor(Number(n.metrics[t])));Wt(this)}incrementMetric(t,e=1){void 0===this.counters[t]?this.putMetric(t,e):this.putMetric(t,this.counters[t]+e)}putMetric(t,e){if(!function(t,e){return!(0===t.length||t.length>100)&&(e&&e.startsWith("_wt_")&&Jt.indexOf(t)>-1||!t.startsWith("_"))}(t,this.name))throw dt.create("invalid custom metric name",{customMetricName:t});this.counters[t]=function(t){const e=Math.floor(t);return e<t&&gt.info(`Metric value should be an Integer, setting the value as : ${e}.`),e}(null!=e?e:0)}getMetric(t){return this.counters[t]||0}putAttribute(t,e){const n=function(t){return!(0===t.length||t.length>40)&&(!Tt.some((e=>t.startsWith(e)))&&!!t.match(St))}(t),r=function(t){return 0!==t.length&&t.length<=100}(e);if(n&&r)this.customAttributes[t]=e;else{if(!n)throw dt.create("invalid attribute name",{attributeName:t});if(!r)throw dt.create("invalid attribute value",{attributeValue:e})}}getAttribute(t){return this.customAttributes[t]}removeAttribute(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]}getAttributes(){return Object.assign({},this.customAttributes)}setStartTime(t){this.startTimeUs=t}setDuration(t){this.durationUs=t}calculateTraceMetrics(){const t=this.api.getEntriesByName(this.traceMeasure),e=t&&t[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))}static createOobTrace(t,e,n,r){const i=bt.getInstance().getUrl();if(!i)return;const o=new Yt(t,"_wt_"+i,!0),a=Math.floor(1e3*bt.getInstance().getTimeOrigin());o.setStartTime(a),e&&e[0]&&(o.setDuration(Math.floor(1e3*e[0].duration)),o.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),o.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),o.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd)));if(n){const t=n.find((t=>"first-paint"===t.name));t&&t.startTime&&o.putMetric("_fp",Math.floor(1e3*t.startTime));const e=n.find((t=>"first-contentful-paint"===t.name));e&&e.startTime&&o.putMetric("_fcp",Math.floor(1e3*e.startTime)),r&&o.putMetric("_fid",Math.floor(1e3*r))}Wt(o)}static createUserTimingTrace(t,e){Wt(new Yt(t,e,!1,e))}}function Zt(t,e){const n=e;if(!n||void 0===n.responseStart)return;const 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(t){const e=_t.getInstance();if(!e.instrumentationEnabled)return;const n=t.url,r=e.logEndPointUrl.split("?")[0],i=e.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout((()=>Vt(t,0)),0)}({performanceController:t,url:n.name&&n.name.split("?")[0],responsePayloadBytes:n.transferSize,startTimeUs:i,timeToResponseInitiatedUs:o,timeToResponseCompletedUs:a})}function Qt(t){yt()&&(setTimeout((()=>function(t){const e=bt.getInstance(),n=e.getEntriesByType("navigation"),r=e.getEntriesByType("paint");if(e.onFirstInputDelay){let i=setTimeout((()=>{Yt.createOobTrace(t,n,r),i=void 0}),5e3);e.onFirstInputDelay((e=>{i&&(clearTimeout(i),Yt.createOobTrace(t,n,r,e))}))}else Yt.createOobTrace(t,n,r)}(t)),0),setTimeout((()=>function(t){const e=bt.getInstance(),n=e.getEntriesByType("resource");for(const e of n)Zt(t,e);e.setupObserver("resource",(e=>Zt(t,e)))}(t)),0),setTimeout((()=>function(t){const e=bt.getInstance(),n=e.getEntriesByType("measure");for(const e of n)Xt(t,e);e.setupObserver("measure",(e=>Xt(t,e)))}(t)),0))}function Xt(t,e){const n=e.name;"FB-PERF-TRACE-MEASURE"!==n.substring(0,"FB-PERF-TRACE-MEASURE".length)&&Yt.createUserTimingTrace(t,n)}class te{constructor(t,e){this.app=t,this.installations=e,this.initialized=!1}_init(t){this.initialized||(void 0!==(null==t?void 0:t.dataCollectionEnabled)&&(this.dataCollectionEnabled=t.dataCollectionEnabled),void 0!==(null==t?void 0:t.instrumentationEnabled)&&(this.instrumentationEnabled=t.instrumentationEnabled),bt.getInstance().requiredApisAvailable()?new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((t=>{t&&(qt||(Ht(5500),qt=!0),Lt(this).then((()=>Qt(this)),(()=>Qt(this))),this.initialized=!0)})).catch((t=>{gt.info(`Environment doesn't support IndexedDB: ${t}`)})):gt.info('Firebase Performance cannot start if the browser does not support "Fetch" and "Promise", or cookies are disabled.'))}set instrumentationEnabled(t){_t.getInstance().instrumentationEnabled=t}get instrumentationEnabled(){return _t.getInstance().instrumentationEnabled}set dataCollectionEnabled(t){_t.getInstance().dataCollectionEnabled=t}get dataCollectionEnabled(){return _t.getInstance().dataCollectionEnabled}}function ee(t=r()){t=u(t);return n(t,"performance").getImmediate()}function ne(t,e){t=u(t);const r=n(t,"performance");if(r.isInitialized()){const t=r.getImmediate();if(s(r.getOptions(),null!=e?e:{}))return t;throw dt.create("already initialized")}return r.initialize({options:e})}function re(t,e){return t=u(t),new Yt(t,e)}e(new h("performance",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("installations-internal").getImmediate();if("[DEFAULT]"!==n.name)throw dt.create("FB not default");if("undefined"==typeof window)throw dt.create("no window");!function(t){mt=t}(window);const i=new te(n,r);return i._init(e),i}),"PUBLIC")),t(pt,"0.5.15"),t(pt,"0.5.15","esm2017");export{ee as getPerformance,ne as initializePerformance,re as trace};
1
+ import{registerVersion as t,_registerComponent as e,_getProvider as n,getApp as r}from"https://www.gstatic.com/firebasejs/9.13.0/firebase-app.js";class i extends Error{constructor(t,e,n){super(e),this.code=t,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,i.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,o.prototype.create)}}class o{constructor(t,e,n){this.service=t,this.serviceName=e,this.errors=n}create(t,...e){const n=e[0]||{},r=`${this.service}/${t}`,o=this.errors[t],s=o?function(t,e){return t.replace(a,((t,n)=>{const r=e[n];return null!=r?String(r):`<${n}?>`}))}(o,n):"Error",c=`${this.serviceName}: ${s} (${r}).`;return new i(r,c,n)}}const a=/\{\$([^}]+)}/g;function s(t,e){if(t===e)return!0;const n=Object.keys(t),r=Object.keys(e);for(const i of n){if(!r.includes(i))return!1;const n=t[i],o=e[i];if(c(n)&&c(o)){if(!s(n,o))return!1}else if(n!==o)return!1}for(const t of r)if(!n.includes(t))return!1;return!0}function c(t){return null!==t&&"object"==typeof t}function u(t){return t&&t._delegate?t._delegate:t}var l;!function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"}(l||(l={}));const f={debug:l.DEBUG,verbose:l.VERBOSE,info:l.INFO,warn:l.WARN,error:l.ERROR,silent:l.SILENT},p=l.INFO,d={[l.DEBUG]:"log",[l.VERBOSE]:"log",[l.INFO]:"info",[l.WARN]:"warn",[l.ERROR]:"error"},g=(t,e,...n)=>{if(e<t.logLevel)return;const r=(new Date).toISOString(),i=d[e];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);console[i](`[${r}] ${t.name}:`,...n)};class h{constructor(t,e,n){this.name=t,this.instanceFactory=e,this.type=n,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(t){return this.instantiationMode=t,this}setMultipleInstances(t){return this.multipleInstances=t,this}setServiceProps(t){return this.serviceProps=t,this}setInstanceCreatedCallback(t){return this.onInstanceCreated=t,this}}let m,v;const w=new WeakMap,b=new WeakMap,y=new WeakMap,E=new WeakMap,_=new WeakMap;let I={get(t,e,n){if(t instanceof IDBTransaction){if("done"===e)return b.get(t);if("objectStoreNames"===e)return t.objectStoreNames||y.get(t);if("store"===e)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return k(t[e])},set:(t,e,n)=>(t[e]=n,!0),has:(t,e)=>t instanceof IDBTransaction&&("done"===e||"store"===e)||e in t};function T(t){return t!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(v||(v=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(N(this),e),k(w.get(this))}:function(...e){return k(t.apply(N(this),e))}:function(e,...n){const r=t.call(N(this),e,...n);return y.set(r,e.sort?e.sort():[e]),k(r)}}function S(t){return"function"==typeof t?T(t):(t instanceof IDBTransaction&&function(t){if(b.has(t))return;const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("complete",i),t.removeEventListener("error",o),t.removeEventListener("abort",o)},i=()=>{e(),r()},o=()=>{n(t.error||new DOMException("AbortError","AbortError")),r()};t.addEventListener("complete",i),t.addEventListener("error",o),t.addEventListener("abort",o)}));b.set(t,e)}(t),e=t,(m||(m=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((t=>e instanceof t))?new Proxy(t,I):t);var e}function k(t){if(t instanceof IDBRequest)return function(t){const e=new Promise(((e,n)=>{const r=()=>{t.removeEventListener("success",i),t.removeEventListener("error",o)},i=()=>{e(k(t.result)),r()},o=()=>{n(t.error),r()};t.addEventListener("success",i),t.addEventListener("error",o)}));return e.then((e=>{e instanceof IDBCursor&&w.set(e,t)})).catch((()=>{})),_.set(e,t),e}(t);if(E.has(t))return E.get(t);const e=S(t);return e!==t&&(E.set(t,e),_.set(e,t)),e}const N=t=>_.get(t);const R=["get","getKey","getAll","getAllKeys","count"],A=["put","add","delete","clear"],O=new Map;function M(t,e){if(!(t instanceof IDBDatabase)||e in t||"string"!=typeof e)return;if(O.get(e))return O.get(e);const n=e.replace(/FromIndex$/,""),r=e!==n,i=A.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!R.includes(n))return;const o=async function(t,...e){const o=this.transaction(t,i?"readwrite":"readonly");let a=o.store;return r&&(a=a.index(e.shift())),(await Promise.all([a[n](...e),i&&o.done]))[0]};return O.set(e,o),o}I=(t=>({...t,get:(e,n,r)=>M(e,n)||t.get(e,n,r),has:(e,n)=>!!M(e,n)||t.has(e,n)}))(I);const C="@firebase/installations",P=new o("installations","Installations",{"missing-app-config-values":'Missing App configuration value: "{$valueName}"',"not-registered":"Firebase Installation is not registered.","installation-not-found":"Firebase Installation not found.","request-failed":'{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',"app-offline":"Could not process request. Application offline.","delete-pending-registration":"Can't delete installation while there is a pending registration request."});function D(t){return t instanceof i&&t.code.includes("request-failed")}function B({projectId:t}){return`https://firebaseinstallations.googleapis.com/v1/projects/${t}/installations`}function L(t){return{token:t.token,requestStatus:2,expiresIn:(e=t.expiresIn,Number(e.replace("s","000"))),creationTime:Date.now()};var e}async function j(t,e){const n=(await e.json()).error;return P.create("request-failed",{requestName:t,serverCode:n.code,serverMessage:n.message,serverStatus:n.status})}function U({apiKey:t}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":t})}function F(t,{refreshToken:e}){const n=U(t);return n.append("Authorization",function(t){return`FIS_v2 ${t}`}(e)),n}async function $(t){const e=await t();return e.status>=500&&e.status<600?t():e}function q(t){return new Promise((e=>{setTimeout(e,t)}))}const H=/^[cdef][\w-]{21}$/;function x(){try{const t=new Uint8Array(17);(self.crypto||self.msCrypto).getRandomValues(t),t[0]=112+t[0]%16;const e=function(t){return(e=t,btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_")).substr(0,22);var e}(t);return H.test(e)?e:""}catch(t){return""}}function V(t){return`${t.appName}!${t.appId}`}const W=new Map;function K(t,e){const n=V(t);z(n,e),function(t,e){const n=function(){!G&&"BroadcastChannel"in self&&(G=new BroadcastChannel("[Firebase] FID Change"),G.onmessage=t=>{z(t.data.key,t.data.fid)});return G}();n&&n.postMessage({key:t,fid:e});0===W.size&&G&&(G.close(),G=null)}(n,e)}function z(t,e){const n=W.get(t);if(n)for(const t of n)t(e)}let G=null;const J="firebase-installations-store";let Y=null;function Z(){return Y||(Y=function(t,e,{blocked:n,upgrade:r,blocking:i,terminated:o}={}){const a=indexedDB.open(t,e),s=k(a);return r&&a.addEventListener("upgradeneeded",(t=>{r(k(a.result),t.oldVersion,t.newVersion,k(a.transaction))})),n&&a.addEventListener("blocked",(()=>n())),s.then((t=>{o&&t.addEventListener("close",(()=>o())),i&&t.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),s}("firebase-installations-database",1,{upgrade:(t,e)=>{if(0===e)t.createObjectStore(J)}})),Y}async function Q(t,e){const n=V(t),r=(await Z()).transaction(J,"readwrite"),i=r.objectStore(J),o=await i.get(n);return await i.put(e,n),await r.done,o&&o.fid===e.fid||K(t,e.fid),e}async function X(t){const e=V(t),n=(await Z()).transaction(J,"readwrite");await n.objectStore(J).delete(e),await n.done}async function tt(t,e){const n=V(t),r=(await Z()).transaction(J,"readwrite"),i=r.objectStore(J),o=await i.get(n),a=e(o);return void 0===a?await i.delete(n):await i.put(a,n),await r.done,!a||o&&o.fid===a.fid||K(t,a.fid),a}async function et(t){let e;const n=await tt(t.appConfig,(n=>{const r=function(t){return it(t||{fid:x(),registrationStatus:0})}(n),i=function(t,e){if(0===e.registrationStatus){if(!navigator.onLine){return{installationEntry:e,registrationPromise:Promise.reject(P.create("app-offline"))}}const n={fid:e.fid,registrationStatus:1,registrationTime:Date.now()},r=async function(t,e){try{const n=await async function({appConfig:t,heartbeatServiceProvider:e},{fid:n}){const r=B(t),i=U(t),o=e.getImmediate({optional:!0});if(o){const t=await o.getHeartbeatsHeader();t&&i.append("x-firebase-client",t)}const a={fid:n,authVersion:"FIS_v2",appId:t.appId,sdkVersion:"w:0.5.16"},s={method:"POST",headers:i,body:JSON.stringify(a)},c=await $((()=>fetch(r,s)));if(c.ok){const t=await c.json();return{fid:t.fid||n,registrationStatus:2,refreshToken:t.refreshToken,authToken:L(t.authToken)}}throw await j("Create Installation",c)}(t,e);return Q(t.appConfig,n)}catch(n){throw D(n)&&409===n.customData.serverCode?await X(t.appConfig):await Q(t.appConfig,{fid:e.fid,registrationStatus:0}),n}}(t,n);return{installationEntry:n,registrationPromise:r}}return 1===e.registrationStatus?{installationEntry:e,registrationPromise:nt(t)}:{installationEntry:e}}(t,r);return e=i.registrationPromise,i.installationEntry}));return""===n.fid?{installationEntry:await e}:{installationEntry:n,registrationPromise:e}}async function nt(t){let e=await rt(t.appConfig);for(;1===e.registrationStatus;)await q(100),e=await rt(t.appConfig);if(0===e.registrationStatus){const{installationEntry:e,registrationPromise:n}=await et(t);return n||e}return e}function rt(t){return tt(t,(t=>{if(!t)throw P.create("installation-not-found");return it(t)}))}function it(t){return 1===(e=t).registrationStatus&&e.registrationTime+1e4<Date.now()?{fid:t.fid,registrationStatus:0}:t;var e}async function ot({appConfig:t,heartbeatServiceProvider:e},n){const r=function(t,{fid:e}){return`${B(t)}/${e}/authTokens:generate`}(t,n),i=F(t,n),o=e.getImmediate({optional:!0});if(o){const t=await o.getHeartbeatsHeader();t&&i.append("x-firebase-client",t)}const a={installation:{sdkVersion:"w:0.5.16",appId:t.appId}},s={method:"POST",headers:i,body:JSON.stringify(a)},c=await $((()=>fetch(r,s)));if(c.ok){return L(await c.json())}throw await j("Generate Auth Token",c)}async function at(t,e=!1){let n;const r=await tt(t.appConfig,(r=>{if(!ct(r))throw P.create("not-registered");const i=r.authToken;if(!e&&function(t){return 2===t.requestStatus&&!function(t){const e=Date.now();return e<t.creationTime||t.creationTime+t.expiresIn<e+36e5}(t)}(i))return r;if(1===i.requestStatus)return n=async function(t,e){let n=await st(t.appConfig);for(;1===n.authToken.requestStatus;)await q(100),n=await st(t.appConfig);const r=n.authToken;return 0===r.requestStatus?at(t,e):r}(t,e),r;{if(!navigator.onLine)throw P.create("app-offline");const e=function(t){const e={requestStatus:1,requestTime:Date.now()};return Object.assign(Object.assign({},t),{authToken:e})}(r);return n=async function(t,e){try{const n=await ot(t,e),r=Object.assign(Object.assign({},e),{authToken:n});return await Q(t.appConfig,r),n}catch(n){if(!D(n)||401!==n.customData.serverCode&&404!==n.customData.serverCode){const n=Object.assign(Object.assign({},e),{authToken:{requestStatus:0}});await Q(t.appConfig,n)}else await X(t.appConfig);throw n}}(t,e),e}}));return n?await n:r.authToken}function st(t){return tt(t,(t=>{if(!ct(t))throw P.create("not-registered");const e=t.authToken;return 1===(n=e).requestStatus&&n.requestTime+1e4<Date.now()?Object.assign(Object.assign({},t),{authToken:{requestStatus:0}}):t;var n}))}function ct(t){return void 0!==t&&2===t.registrationStatus}async function ut(t,e=!1){const n=t;await async function(t){const{registrationPromise:e}=await et(t);e&&await e}(n);return(await at(n,e)).token}function lt(t){return P.create("missing-app-config-values",{valueName:t})}const ft=t=>{const e=t.getProvider("app").getImmediate(),r=n(e,"installations").getImmediate();return{getId:()=>async function(t){const e=t,{installationEntry:n,registrationPromise:r}=await et(e);return r?r.catch(console.error):at(e).catch(console.error),n.fid}(r),getToken:t=>ut(r,t)}};e(new h("installations",(t=>{const e=t.getProvider("app").getImmediate(),r=function(t){if(!t||!t.options)throw lt("App Configuration");if(!t.name)throw lt("App Name");const e=["projectId","apiKey","appId"];for(const n of e)if(!t.options[n])throw lt(n);return{appName:t.name,projectId:t.options.projectId,apiKey:t.options.apiKey,appId:t.options.appId}}(e);return{app:e,appConfig:r,heartbeatServiceProvider:n(e,"heartbeat"),_delete:()=>Promise.resolve()}}),"PUBLIC")),e(new h("installations-internal",ft,"PRIVATE")),t(C,"0.5.16"),t(C,"0.5.16","esm2017");const pt="@firebase/performance",dt=new o("performance","Performance",{"trace started":"Trace {$traceName} was started before.","trace stopped":"Trace {$traceName} is not running.","nonpositive trace startTime":"Trace {$traceName} startTime should be positive.","nonpositive trace duration":"Trace {$traceName} duration should be positive.","no window":"Window is not available.","no app id":"App id is not available.","no project id":"Project id is not available.","no api key":"Api key is not available.","invalid cc log":"Attempted to queue invalid cc event","FB not default":"Performance can only start when Firebase app instance is the default one.","RC response not ok":"RC response is not ok","invalid attribute name":"Attribute name {$attributeName} is invalid.","invalid attribute value":"Attribute value {$attributeValue} is invalid.","invalid custom metric name":"Custom metric name {$customMetricName} is invalid","invalid String merger input":"Input for String merger is invalid, contact support team to resolve.","already initialized":"initializePerformance() has already been called with different options. To avoid this error, call initializePerformance() with the same options as when it was originally called, or call getPerformance() to return the already initialized instance."}),gt=new class{constructor(t){this.name=t,this._logLevel=p,this._logHandler=g,this._userLogHandler=null}get logLevel(){return this._logLevel}set logLevel(t){if(!(t in l))throw new TypeError(`Invalid value "${t}" assigned to \`logLevel\``);this._logLevel=t}setLogLevel(t){this._logLevel="string"==typeof t?f[t]:t}get logHandler(){return this._logHandler}set logHandler(t){if("function"!=typeof t)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=t}get userLogHandler(){return this._userLogHandler}set userLogHandler(t){this._userLogHandler=t}debug(...t){this._userLogHandler&&this._userLogHandler(this,l.DEBUG,...t),this._logHandler(this,l.DEBUG,...t)}log(...t){this._userLogHandler&&this._userLogHandler(this,l.VERBOSE,...t),this._logHandler(this,l.VERBOSE,...t)}info(...t){this._userLogHandler&&this._userLogHandler(this,l.INFO,...t),this._logHandler(this,l.INFO,...t)}warn(...t){this._userLogHandler&&this._userLogHandler(this,l.WARN,...t),this._logHandler(this,l.WARN,...t)}error(...t){this._userLogHandler&&this._userLogHandler(this,l.ERROR,...t),this._logHandler(this,l.ERROR,...t)}}("Performance");let ht,mt,vt,wt;gt.logLevel=l.INFO;class bt{constructor(t){if(this.window=t,!t)throw dt.create("no window");this.performance=t.performance,this.PerformanceObserver=t.PerformanceObserver,this.windowLocation=t.location,this.navigator=t.navigator,this.document=t.document,this.navigator&&this.navigator.cookieEnabled&&(this.localStorage=t.localStorage),t.perfMetrics&&t.perfMetrics.onFirstInputDelay&&(this.onFirstInputDelay=t.perfMetrics.onFirstInputDelay)}getUrl(){return this.windowLocation.href.split("?")[0]}mark(t){this.performance&&this.performance.mark&&this.performance.mark(t)}measure(t,e,n){this.performance&&this.performance.measure&&this.performance.measure(t,e,n)}getEntriesByType(t){return this.performance&&this.performance.getEntriesByType?this.performance.getEntriesByType(t):[]}getEntriesByName(t){return this.performance&&this.performance.getEntriesByName?this.performance.getEntriesByName(t):[]}getTimeOrigin(){return this.performance&&(this.performance.timeOrigin||this.performance.timing.navigationStart)}requiredApisAvailable(){return fetch&&Promise&&"undefined"!=typeof navigator&&navigator.cookieEnabled?"object"==typeof indexedDB||(gt.info("IndexedDB is not supported by current browswer"),!1):(gt.info("Firebase Performance cannot start if browser does not support fetch and Promise or cookie is disabled."),!1)}setupObserver(t,e){if(!this.PerformanceObserver)return;new this.PerformanceObserver((t=>{for(const n of t.getEntries())e(n)})).observe({entryTypes:[t]})}static getInstance(){return void 0===ht&&(ht=new bt(mt)),ht}}function yt(){return vt}function Et(t,e){const n=t.length-e.length;if(n<0||n>1)throw dt.create("invalid String merger input");const r=[];for(let n=0;n<t.length;n++)r.push(t.charAt(n)),e.length>n&&r.push(e.charAt(n));return r.join("")}class _t{constructor(){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=Et("hts/frbslgigp.ogepscmv/ieo/eaylg","tp:/ieaeogn-agolai.o/1frlglgc/o"),this.transportKey=Et("AzSC8r6ReiGqFMyfvgow","Iayx0u-XT3vksVM-pIV"),this.logSource=462,this.logTraceAfterSampling=!1,this.logNetworkAfterSampling=!1,this.configTimeToLive=12}getFlTransportFullUrl(){return this.flTransportEndpointUrl.concat("?key=",this.transportKey)}static getInstance(){return void 0===wt&&(wt=new _t),wt}}var It;!function(t){t[t.UNKNOWN=0]="UNKNOWN",t[t.VISIBLE=1]="VISIBLE",t[t.HIDDEN=2]="HIDDEN"}(It||(It={}));const Tt=["firebase_","google_","ga_"],St=new RegExp("^[a-zA-Z]\\w*$");function kt(){const t=bt.getInstance().navigator;return"serviceWorker"in t?t.serviceWorker.controller?2:3:1}function Nt(){switch(bt.getInstance().document.visibilityState){case"visible":return It.VISIBLE;case"hidden":return It.HIDDEN;default:return It.UNKNOWN}}function Rt(){const t=bt.getInstance().navigator.connection;switch(t&&t.effectiveType){case"slow-2g":return 1;case"2g":return 2;case"3g":return 3;case"4g":return 4;default:return 0}}function At(t){var e;const n=null===(e=t.options)||void 0===e?void 0:e.appId;if(!n)throw dt.create("no app id");return n}const Ot={loggingEnabled:!0};function Mt(t,e){const n=function(){const t=bt.getInstance().localStorage;if(!t)return;const e=t.getItem("@firebase/performance/configexpire");if(!(e&&(n=e,Number(n)>Date.now())))return;var n;const r=t.getItem("@firebase/performance/config");if(!r)return;try{return JSON.parse(r)}catch(t){return}}();return n?(Ct(n),Promise.resolve()):function(t,e){return function(t){const e=t.getToken();return e.then((t=>{})),e}(t.installations).then((n=>{const r=function(t){var e;const n=null===(e=t.options)||void 0===e?void 0:e.projectId;if(!n)throw dt.create("no project id");return n}(t.app),i=function(t){var e;const n=null===(e=t.options)||void 0===e?void 0:e.apiKey;if(!n)throw dt.create("no api key");return n}(t.app),o=new Request(`https://firebaseremoteconfig.googleapis.com/v1/projects/${r}/namespaces/fireperf:fetch?key=${i}`,{method:"POST",headers:{Authorization:`FIREBASE_INSTALLATIONS_AUTH ${n}`},body:JSON.stringify({app_instance_id:e,app_instance_id_token:n,app_id:At(t.app),app_version:"0.5.16",sdk_version:"0.0.1"})});return fetch(o).then((t=>{if(t.ok)return t.json();throw dt.create("RC response not ok")}))})).catch((()=>{gt.info("Could not fetch config, will use default configs")}))}(t,e).then(Ct).then((t=>function(t){const e=bt.getInstance().localStorage;if(!t||!e)return;e.setItem("@firebase/performance/config",JSON.stringify(t)),e.setItem("@firebase/performance/configexpire",String(Date.now()+60*_t.getInstance().configTimeToLive*60*1e3))}(t)),(()=>{}))}function Ct(t){if(!t)return t;const e=_t.getInstance(),n=t.entries||{};return void 0!==n.fpr_enabled?e.loggingEnabled="true"===String(n.fpr_enabled):e.loggingEnabled=Ot.loggingEnabled,n.fpr_log_source?e.logSource=Number(n.fpr_log_source):Ot.logSource&&(e.logSource=Ot.logSource),n.fpr_log_endpoint_url?e.logEndPointUrl=n.fpr_log_endpoint_url:Ot.logEndPointUrl&&(e.logEndPointUrl=Ot.logEndPointUrl),n.fpr_log_transport_key?e.transportKey=n.fpr_log_transport_key:Ot.transportKey&&(e.transportKey=Ot.transportKey),void 0!==n.fpr_vc_network_request_sampling_rate?e.networkRequestsSamplingRate=Number(n.fpr_vc_network_request_sampling_rate):void 0!==Ot.networkRequestsSamplingRate&&(e.networkRequestsSamplingRate=Ot.networkRequestsSamplingRate),void 0!==n.fpr_vc_trace_sampling_rate?e.tracesSamplingRate=Number(n.fpr_vc_trace_sampling_rate):void 0!==Ot.tracesSamplingRate&&(e.tracesSamplingRate=Ot.tracesSamplingRate),e.logTraceAfterSampling=Pt(e.tracesSamplingRate),e.logNetworkAfterSampling=Pt(e.networkRequestsSamplingRate),t}function Pt(t){return Math.random()<=t}let Dt,Bt=1;function Lt(t){return Bt=2,Dt=Dt||function(t){return function(){const t=bt.getInstance().document;return new Promise((e=>{if(t&&"complete"!==t.readyState){const n=()=>{"complete"===t.readyState&&(t.removeEventListener("readystatechange",n),e())};t.addEventListener("readystatechange",n)}else e()}))}().then((()=>function(t){const e=t.getId();return e.then((t=>{vt=t})),e}(t.installations))).then((e=>Mt(t,e))).then((()=>jt()),(()=>jt()))}(t),Dt}function jt(){Bt=3}let Ut,Ft=3,$t=[],qt=!1;function Ht(t){setTimeout((()=>{if(0!==Ft)return $t.length?void function(){const t=$t.splice(0,1e3),e=t.map((t=>({source_extension_json_proto3:t.message,event_time_ms:String(t.eventTime)})));(function(t,e){return function(t){const e=_t.getInstance().getFlTransportFullUrl();return fetch(e,{method:"POST",body:JSON.stringify(t)})}(t).then((t=>(t.ok||gt.info("Call to Firebase backend failed."),t.json()))).then((t=>{const n=Number(t.nextRequestWaitMillis);let r=1e4;isNaN(n)||(r=Math.max(n,r));const i=t.logResponseDetails;Array.isArray(i)&&i.length>0&&"RETRY_REQUEST_LATER"===i[0].responseAction&&($t=[...e,...$t],gt.info("Retry transport request later.")),Ft=3,Ht(r)}))})({request_time_ms:String(Date.now()),client_info:{client_type:1,js_client_info:{}},log_source:_t.getInstance().logSource,log_event:e},t).catch((()=>{$t=[...t,...$t],Ft--,gt.info(`Tries left: ${Ft}.`),Ht(1e4)}))}():Ht(1e4)}),t)}function xt(t){return(...e)=>{!function(t){if(!t.eventTime||!t.message)throw dt.create("invalid cc log");$t=[...$t,t]}({message:t(...e),eventTime:Date.now()})}}function Vt(t,e){Ut||(Ut=xt(zt)),Ut(t,e)}function Wt(t){const e=_t.getInstance();!e.instrumentationEnabled&&t.isAuto||(e.dataCollectionEnabled||t.isAuto)&&bt.getInstance().requiredApisAvailable()&&(t.isAuto&&Nt()!==It.VISIBLE||(3===Bt?Kt(t):Lt(t.performanceController).then((()=>Kt(t)),(()=>Kt(t)))))}function Kt(t){if(!yt())return;const e=_t.getInstance();e.loggingEnabled&&e.logTraceAfterSampling&&setTimeout((()=>Vt(t,1)),0)}function zt(t,e){return 0===e?function(t){const e={url:t.url,http_method:t.httpMethod||0,http_response_code:200,response_payload_bytes:t.responsePayloadBytes,client_start_time_us:t.startTimeUs,time_to_response_initiated_us:t.timeToResponseInitiatedUs,time_to_response_completed_us:t.timeToResponseCompletedUs},n={application_info:Gt(t.performanceController.app),network_request_metric:e};return JSON.stringify(n)}(t):function(t){const e={name:t.name,is_auto:t.isAuto,client_start_time_us:t.startTimeUs,duration_us:t.durationUs};0!==Object.keys(t.counters).length&&(e.counters=t.counters);const n=t.getAttributes();0!==Object.keys(n).length&&(e.custom_attributes=n);const r={application_info:Gt(t.performanceController.app),trace_metric:e};return JSON.stringify(r)}(t)}function Gt(t){return{google_app_id:At(t),app_instance_id:yt(),web_app_info:{sdk_version:"0.5.16",page_url:bt.getInstance().getUrl(),service_worker_status:kt(),visibility_state:Nt(),effective_connection_type:Rt()},application_process_state:0}}const Jt=["_fp","_fcp","_fid"];class Yt{constructor(t,e,n=!1,r){this.performanceController=t,this.name=e,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())}start(){if(1!==this.state)throw dt.create("trace started",{traceName:this.name});this.api.mark(this.traceStartMark),this.state=2}stop(){if(2!==this.state)throw dt.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(),Wt(this)}record(t,e,n){if(t<=0)throw dt.create("nonpositive trace startTime",{traceName:this.name});if(e<=0)throw dt.create("nonpositive trace duration",{traceName:this.name});if(this.durationUs=Math.floor(1e3*e),this.startTimeUs=Math.floor(1e3*t),n&&n.attributes&&(this.customAttributes=Object.assign({},n.attributes)),n&&n.metrics)for(const t of Object.keys(n.metrics))isNaN(Number(n.metrics[t]))||(this.counters[t]=Math.floor(Number(n.metrics[t])));Wt(this)}incrementMetric(t,e=1){void 0===this.counters[t]?this.putMetric(t,e):this.putMetric(t,this.counters[t]+e)}putMetric(t,e){if(!function(t,e){return!(0===t.length||t.length>100)&&(e&&e.startsWith("_wt_")&&Jt.indexOf(t)>-1||!t.startsWith("_"))}(t,this.name))throw dt.create("invalid custom metric name",{customMetricName:t});this.counters[t]=function(t){const e=Math.floor(t);return e<t&&gt.info(`Metric value should be an Integer, setting the value as : ${e}.`),e}(null!=e?e:0)}getMetric(t){return this.counters[t]||0}putAttribute(t,e){const n=function(t){return!(0===t.length||t.length>40)&&(!Tt.some((e=>t.startsWith(e)))&&!!t.match(St))}(t),r=function(t){return 0!==t.length&&t.length<=100}(e);if(n&&r)this.customAttributes[t]=e;else{if(!n)throw dt.create("invalid attribute name",{attributeName:t});if(!r)throw dt.create("invalid attribute value",{attributeValue:e})}}getAttribute(t){return this.customAttributes[t]}removeAttribute(t){void 0!==this.customAttributes[t]&&delete this.customAttributes[t]}getAttributes(){return Object.assign({},this.customAttributes)}setStartTime(t){this.startTimeUs=t}setDuration(t){this.durationUs=t}calculateTraceMetrics(){const t=this.api.getEntriesByName(this.traceMeasure),e=t&&t[0];e&&(this.durationUs=Math.floor(1e3*e.duration),this.startTimeUs=Math.floor(1e3*(e.startTime+this.api.getTimeOrigin())))}static createOobTrace(t,e,n,r){const i=bt.getInstance().getUrl();if(!i)return;const o=new Yt(t,"_wt_"+i,!0),a=Math.floor(1e3*bt.getInstance().getTimeOrigin());o.setStartTime(a),e&&e[0]&&(o.setDuration(Math.floor(1e3*e[0].duration)),o.putMetric("domInteractive",Math.floor(1e3*e[0].domInteractive)),o.putMetric("domContentLoadedEventEnd",Math.floor(1e3*e[0].domContentLoadedEventEnd)),o.putMetric("loadEventEnd",Math.floor(1e3*e[0].loadEventEnd)));if(n){const t=n.find((t=>"first-paint"===t.name));t&&t.startTime&&o.putMetric("_fp",Math.floor(1e3*t.startTime));const e=n.find((t=>"first-contentful-paint"===t.name));e&&e.startTime&&o.putMetric("_fcp",Math.floor(1e3*e.startTime)),r&&o.putMetric("_fid",Math.floor(1e3*r))}Wt(o)}static createUserTimingTrace(t,e){Wt(new Yt(t,e,!1,e))}}function Zt(t,e){const n=e;if(!n||void 0===n.responseStart)return;const 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(t){const e=_t.getInstance();if(!e.instrumentationEnabled)return;const n=t.url,r=e.logEndPointUrl.split("?")[0],i=e.flTransportEndpointUrl.split("?")[0];n!==r&&n!==i&&e.loggingEnabled&&e.logNetworkAfterSampling&&setTimeout((()=>Vt(t,0)),0)}({performanceController:t,url:n.name&&n.name.split("?")[0],responsePayloadBytes:n.transferSize,startTimeUs:i,timeToResponseInitiatedUs:o,timeToResponseCompletedUs:a})}function Qt(t){yt()&&(setTimeout((()=>function(t){const e=bt.getInstance(),n=e.getEntriesByType("navigation"),r=e.getEntriesByType("paint");if(e.onFirstInputDelay){let i=setTimeout((()=>{Yt.createOobTrace(t,n,r),i=void 0}),5e3);e.onFirstInputDelay((e=>{i&&(clearTimeout(i),Yt.createOobTrace(t,n,r,e))}))}else Yt.createOobTrace(t,n,r)}(t)),0),setTimeout((()=>function(t){const e=bt.getInstance(),n=e.getEntriesByType("resource");for(const e of n)Zt(t,e);e.setupObserver("resource",(e=>Zt(t,e)))}(t)),0),setTimeout((()=>function(t){const e=bt.getInstance(),n=e.getEntriesByType("measure");for(const e of n)Xt(t,e);e.setupObserver("measure",(e=>Xt(t,e)))}(t)),0))}function Xt(t,e){const n=e.name;"FB-PERF-TRACE-MEASURE"!==n.substring(0,"FB-PERF-TRACE-MEASURE".length)&&Yt.createUserTimingTrace(t,n)}class te{constructor(t,e){this.app=t,this.installations=e,this.initialized=!1}_init(t){this.initialized||(void 0!==(null==t?void 0:t.dataCollectionEnabled)&&(this.dataCollectionEnabled=t.dataCollectionEnabled),void 0!==(null==t?void 0:t.instrumentationEnabled)&&(this.instrumentationEnabled=t.instrumentationEnabled),bt.getInstance().requiredApisAvailable()?new Promise(((t,e)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{var t;e((null===(t=i.error)||void 0===t?void 0:t.message)||"")}}catch(t){e(t)}})).then((t=>{t&&(qt||(Ht(5500),qt=!0),Lt(this).then((()=>Qt(this)),(()=>Qt(this))),this.initialized=!0)})).catch((t=>{gt.info(`Environment doesn't support IndexedDB: ${t}`)})):gt.info('Firebase Performance cannot start if the browser does not support "Fetch" and "Promise", or cookies are disabled.'))}set instrumentationEnabled(t){_t.getInstance().instrumentationEnabled=t}get instrumentationEnabled(){return _t.getInstance().instrumentationEnabled}set dataCollectionEnabled(t){_t.getInstance().dataCollectionEnabled=t}get dataCollectionEnabled(){return _t.getInstance().dataCollectionEnabled}}function ee(t=r()){t=u(t);return n(t,"performance").getImmediate()}function ne(t,e){t=u(t);const r=n(t,"performance");if(r.isInitialized()){const t=r.getImmediate();if(s(r.getOptions(),null!=e?e:{}))return t;throw dt.create("already initialized")}return r.initialize({options:e})}function re(t,e){return t=u(t),new Yt(t,e)}e(new h("performance",((t,{options:e})=>{const n=t.getProvider("app").getImmediate(),r=t.getProvider("installations-internal").getImmediate();if("[DEFAULT]"!==n.name)throw dt.create("FB not default");if("undefined"==typeof window)throw dt.create("no window");!function(t){mt=t}(window);const i=new te(n,r);return i._init(e),i}),"PUBLIC")),t(pt,"0.5.16"),t(pt,"0.5.16","esm2017");export{ee as getPerformance,ne as initializePerformance,re as trace};
2
2
 
3
3
  //# sourceMappingURL=firebase-performance.js.map