firebase
Version:
Firebase JavaScript library for web and Node.js
21 lines • 802 kB
JavaScript
((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(){let n=()=>{},i={NODE_CLIENT:!1,NODE_ADMIN:!1,SDK_VERSION:"${JSCORE_VERSION}"},g=function(e,t){if(!e)throw B(t)},B=function(e){return new Error("Firebase Database ("+i.SDK_VERSION+") INTERNAL ASSERT FAILED: "+e)},s=function(t){var r=[];let n=0;for(let i=0;i<t.length;i++){let e=t.charCodeAt(i);e<128?r[n++]=e:(e<2048?r[n++]=e>>6|192:(55296==(64512&e)&&i+1<t.length&&56320==(64512&t.charCodeAt(i+1))?(e=65536+((1023&e)<<10)+(1023&t.charCodeAt(++i)),r[n++]=e>>18|240,r[n++]=e>>12&63|128):r[n++]=e>>12|224,r[n++]=e>>6&63|128),r[n++]=63&e|128)}return r},a={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(r,e){if(!Array.isArray(r))throw Error("encodeByteArray takes an array as a parameter");this.init_();var n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let u=0;u<r.length;u+=3){var s=r[u],a=u+1<r.length,o=a?r[u+1]:0,l=u+2<r.length,h=l?r[u+2]:0;let e=(15&o)<<2|h>>6,t=63&h;l||(t=64,a)||(e=64),i.push(n[s>>2],n[(3&s)<<4|o>>4],n[e],n[t])}return i.join("")},encodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?btoa(e):this.encodeByteArray(s(e),t)},decodeString(r,n){if(this.HAS_NATIVE_SUPPORT&&!n)return atob(r);{var i=this.decodeStringToByteArray(r,n);var s=[];let e=0,t=0;for(;e<i.length;){var a,o,l,h=i[e++];h<128?s[t++]=String.fromCharCode(h):191<h&&h<224?(a=i[e++],s[t++]=String.fromCharCode((31&h)<<6|63&a)):239<h&&h<365?(a=((7&h)<<18|(63&i[e++])<<12|(63&i[e++])<<6|63&i[e++])-65536,s[t++]=String.fromCharCode(55296+(a>>10)),s[t++]=String.fromCharCode(56320+(1023&a))):(o=i[e++],l=i[e++],s[t++]=String.fromCharCode((15&h)<<12|(63&o)<<6|63&l))}return s.join("");return}},decodeStringToByteArray(e,t){this.init_();var r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let l=0;l<e.length;){var i=r[e.charAt(l++)],s=l<e.length?r[e.charAt(l)]:0,a=++l<e.length?r[e.charAt(l)]:64,o=++l<e.length?r[e.charAt(l)]:64;if(++l,null==i||null==s||null==a||null==o)throw new j;n.push(i<<2|s>>4),64!==a&&(n.push(s<<4&240|a>>2),64!==o)&&n.push(a<<6&192|o)}return n},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let 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)}}};class j extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}function o(e){var t=s(e);return a.encodeByteArray(t,!0)}let z=function(e){return o(e).replace(/\./g,"")},K=function(e){try{return a.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};function W(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]=W(e[r],t[r]));return e}function H(){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.")}let G=()=>H().__FIREBASE_DEFAULTS__,$=()=>{var e;return"undefined"!=typeof process&&void 0!==process.env&&(e=process.env.__FIREBASE_DEFAULTS__)?JSON.parse(e):void 0},Q=()=>{if("undefined"!=typeof document){let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}var t=e&&K(e[1]);return t&&JSON.parse(t)}},Y=()=>{try{return n()||G()||$()||Q()}catch(e){console.info("Unable to get __FIREBASE_DEFAULTS__ due to: "+e)}},J=()=>{var e;return null==(e=Y())?void 0:e.config};var c,X;class Z{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(r){return(e,t)=>{e?this.reject(e):this.resolve(t),"function"==typeof r&&(this.promise.catch(()=>{}),1===r.length?r(e):r(e,t))}}}function ee(e){return e.endsWith(".cloudworkstations.dev")}async function te(e){return(await fetch(e,{credentials:"include"})).ok}function re(e,t){if(e.uid)throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');var r=t||"demo-project",n=e.iat||0,i=e.sub||e.user_id;if(i)return r=Object.assign({iss:"https://securetoken.google.com/"+r,aud:r,iat:n,exp:n+3600,auth_time:n,sub:i,user_id:i,firebase:{sign_in_provider:"custom",identities:{}}},e),[z(JSON.stringify({alg:"none",type:"JWT"})),z(JSON.stringify(r)),""].join(".");throw new Error("mockUserToken must contain 'sub' or 'user_id' field!")}let ne={};let ie=!1;function se(e,t){if("undefined"!=typeof window&&"undefined"!=typeof document&&ee(window.location.host)&&ne[e]!==t&&!ne[e]&&!ie){ne[e]=t;let h="__firebase__banner";let u=0<(()=>{var e,t={prod:[],emulator:[]};for(e of Object.keys(ne))(ne[e]?t.emulator:t.prod).push(e);return t})().prod.length;function c(e){return"__firebase__banner__"+e}function d(){var e=document.createElement("span");return e.style.cursor="pointer",e.style.marginLeft="16px",e.style.fontSize="24px",e.innerHTML=" ×",e.onclick=()=>{var e;ie=!0,(e=document.getElementById(h))&&e.remove()},e}function r(){var e,t,r=(e=>{let t=document.getElementById(e),r=!1;return t||((t=document.createElement("div")).setAttribute("id",e),r=!0),{created:r,element:t}})(h),n=c("text"),i=document.getElementById(n)||document.createElement("span"),s=c("learnmore"),a=document.getElementById(s)||document.createElement("a"),o=c("preprendIcon"),l=document.getElementById(o)||document.createElementNS("http://www.w3.org/2000/svg","svg");r.created&&(r=r.element,(t=r).style.display="flex",t.style.background="#7faaf0",t.style.position="fixed",t.style.bottom="5px",t.style.left="5px",t.style.padding=".5em",t.style.borderRadius="5px",t.style.alignItems="center",(t=a).setAttribute("id",s),t.innerText="Learn more",t.href="https://firebase.google.com/docs/studio/preview-apps#preview-backend",t.setAttribute("target","__blank"),t.style.paddingLeft="5px",t.style.textDecoration="underline",s=d(),t=o,(e=l).setAttribute("width","24"),e.setAttribute("id",t),e.setAttribute("height","24"),e.setAttribute("viewBox","0 0 24 24"),e.setAttribute("fill","none"),e.style.marginLeft="-6px",r.append(l,i,a,s),document.body.appendChild(r)),u?(i.innerText="Preview backend disconnected.",l.innerHTML=`<g clip-path="url(#clip0_6013_33858)">
<path d="M4.8 17.6L12 5.6L19.2 17.6H4.8ZM6.91667 16.4H17.0833L12 7.93333L6.91667 16.4ZM12 15.6C12.1667 15.6 12.3056 15.5444 12.4167 15.4333C12.5389 15.3111 12.6 15.1667 12.6 15C12.6 14.8333 12.5389 14.6944 12.4167 14.5833C12.3056 14.4611 12.1667 14.4 12 14.4C11.8333 14.4 11.6889 14.4611 11.5667 14.5833C11.4556 14.6944 11.4 14.8333 11.4 15C11.4 15.1667 11.4556 15.3111 11.5667 15.4333C11.6889 15.5444 11.8333 15.6 12 15.6ZM11.4 13.6H12.6V10.4H11.4V13.6Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_6013_33858">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>`):(l.innerHTML=`<g clip-path="url(#clip0_6083_34804)">
<path d="M11.4 15.2H12.6V11.2H11.4V15.2ZM12 10C12.1667 10 12.3056 9.94444 12.4167 9.83333C12.5389 9.71111 12.6 9.56667 12.6 9.4C12.6 9.23333 12.5389 9.09444 12.4167 8.98333C12.3056 8.86111 12.1667 8.8 12 8.8C11.8333 8.8 11.6889 8.86111 11.5667 8.98333C11.4556 9.09444 11.4 9.23333 11.4 9.4C11.4 9.56667 11.4556 9.71111 11.5667 9.83333C11.6889 9.94444 11.8333 10 12 10ZM12 18.4C11.1222 18.4 10.2944 18.2333 9.51667 17.9C8.73889 17.5667 8.05556 17.1111 7.46667 16.5333C6.88889 15.9444 6.43333 15.2611 6.1 14.4833C5.76667 13.7056 5.6 12.8778 5.6 12C5.6 11.1111 5.76667 10.2833 6.1 9.51667C6.43333 8.73889 6.88889 8.06111 7.46667 7.48333C8.05556 6.89444 8.73889 6.43333 9.51667 6.1C10.2944 5.76667 11.1222 5.6 12 5.6C12.8889 5.6 13.7167 5.76667 14.4833 6.1C15.2611 6.43333 15.9389 6.89444 16.5167 7.48333C17.1056 8.06111 17.5667 8.73889 17.9 9.51667C18.2333 10.2833 18.4 11.1111 18.4 12C18.4 12.8778 18.2333 13.7056 17.9 14.4833C17.5667 15.2611 17.1056 15.9444 16.5167 16.5333C15.9389 17.1111 15.2611 17.5667 14.4833 17.9C13.7167 18.2333 12.8889 18.4 12 18.4ZM12 17.2C13.4444 17.2 14.6722 16.6944 15.6833 15.6833C16.6944 14.6722 17.2 13.4444 17.2 12C17.2 10.5556 16.6944 9.32778 15.6833 8.31667C14.6722 7.30555 13.4444 6.8 12 6.8C10.5556 6.8 9.32778 7.30555 8.31667 8.31667C7.30556 9.32778 6.8 10.5556 6.8 12C6.8 13.4444 7.30556 14.6722 8.31667 15.6833C9.32778 16.6944 10.5556 17.2 12 17.2Z" fill="#212121"/>
</g>
<defs>
<clipPath id="clip0_6083_34804">
<rect width="24" height="24" fill="white"/>
</clipPath>
</defs>`,i.innerText="Preview backend running in this workspace."),i.setAttribute("id",n)}"loading"===document.readyState?window.addEventListener("DOMContentLoaded",r):r()}}function ae(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}function oe(){return"undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(ae())}function le(){var e=null==(e=Y())?void 0:e.forceEnvironment;if("node"===e)return!0;if("browser"===e)return!1;try{return"[object process]"===Object.prototype.toString.call(global.process)}catch(e){return!1}}function he(){return"undefined"!=typeof WorkerGlobalScope&&"undefined"!=typeof self&&self instanceof WorkerGlobalScope}function ue(){var e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}function ce(){return"object"==typeof navigator&&"ReactNative"===navigator.product}function de(){var e=ae();return 0<=e.indexOf("MSIE ")||0<=e.indexOf("Trident/")}function pe(){return!0===i.NODE_ADMIN}function fe(){return!le()&&navigator.userAgent&&navigator.userAgent.includes("Safari")&&!navigator.userAgent.includes("Chrome")}function ge(){return!le()&&navigator.userAgent&&(navigator.userAgent.includes("Safari")||navigator.userAgent.includes("WebKit"))&&!navigator.userAgent.includes("Chrome")}function me(){try{return"object"==typeof indexedDB}catch(e){return!1}}function ve(){return new Promise((n,i)=>{try{let e=!0,t="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(t);r.onsuccess=()=>{r.result.close(),e||self.indexedDB.deleteDatabase(t),n(!0)},r.onupgradeneeded=()=>{e=!1},r.onerror=()=>{var e;i((null==(e=r.error)?void 0:e.message)||"")}}catch(e){i(e)}})}function _e(){return!("undefined"==typeof navigator||!navigator.cookieEnabled)}class ye extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,ye.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,we.prototype.create)}}class we{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){var n,r=t[0]||{},i=this.service+"/"+e,s=this.errors[e],s=s?(n=r,s.replace(be,(e,t)=>{var r=n[t];return null!=r?String(r):`<${t}?>`})):"Error",s=this.serviceName+`: ${s} (${i}).`;return new ye(i,s,r)}}let be=/\{\$([^}]+)}/g;function Ie(e){return JSON.parse(e)}function Te(e){return JSON.stringify(e)}function Ee(e){let t={},r={},n={},i="";try{var s=e.split(".");t=Ie(K(s[0])||""),r=Ie(K(s[1])||""),i=s[2],n=r.d||{},delete r.d}catch(e){}return{header:t,claims:r,data:n,signature:i}}function Ce(e,t){return Object.prototype.hasOwnProperty.call(e,t)}function ke(e,t){if(Object.prototype.hasOwnProperty.call(e,t))return e[t]}function Se(e){for(var t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}function Ae(e,t,r){var n,i={};for(n in e)Object.prototype.hasOwnProperty.call(e,n)&&(i[n]=t.call(r,e[n],n,e));return i}function Ne(e,t){if(e!==t){var r,n,i=Object.keys(e),s=Object.keys(t);for(r of i){if(!s.includes(r))return!1;var a=e[r],o=t[r];if(Re(a)&&Re(o)){if(!Ne(a,o))return!1}else if(a!==o)return!1}for(n of s)if(!i.includes(n))return!1}return!0}function Re(e){return null!==e&&"object"==typeof e}function Pe(e){let t=[];for(let[r,n]of Object.entries(e))Array.isArray(n)?n.forEach(e=>{t.push(encodeURIComponent(r)+"="+encodeURIComponent(e))}):t.push(encodeURIComponent(r)+"="+encodeURIComponent(n));return t.length?"&"+t.join("&"):""}function xe(e){let n={};return e.replace(/^\?/,"").split("&").forEach(e=>{var t,r;e&&([t,r]=e.split("="),n[decodeURIComponent(t)]=decodeURIComponent(r))}),n}function De(e){var t,r=e.indexOf("?");return r?(t=e.indexOf("#",r),e.substring(r,0<t?t:void 0)):""}class Oe{constructor(){this.chain_=[],this.buf_=[],this.W_=[],this.pad_=[],this.inbuf_=0,this.total_=0,this.blockSize=64,this.pad_[0]=128;for(let e=1;e<this.blockSize;++e)this.pad_[e]=0;this.reset()}reset(){this.chain_[0]=1732584193,this.chain_[1]=4023233417,this.chain_[2]=2562383102,this.chain_[3]=271733878,this.chain_[4]=3285377520,this.inbuf_=0,this.total_=0}compress_(r,n){n=n||0;var i=this.W_;if("string"==typeof r)for(let e=0;e<16;e++)i[e]=r.charCodeAt(n)<<24|r.charCodeAt(n+1)<<16|r.charCodeAt(n+2)<<8|r.charCodeAt(n+3),n+=4;else for(let t=0;t<16;t++)i[t]=r[n]<<24|r[n+1]<<16|r[n+2]<<8|r[n+3],n+=4;for(let d=16;d<80;d++){var e=i[d-3]^i[d-8]^i[d-14]^i[d-16];i[d]=4294967295&(e<<1|e>>>31)}let t=this.chain_[0],s=this.chain_[1],a=this.chain_[2],o=this.chain_[3],l=this.chain_[4],h,u;for(let p=0;p<80;p++){u=p<40?p<20?(h=o^s&(a^o),1518500249):(h=s^a^o,1859775393):p<60?(h=s&a|o&(s|a),2400959708):(h=s^a^o,3395469782);var c=(t<<5|t>>>27)+h+l+u+i[p]&4294967295;l=o,o=a,a=4294967295&(s<<30|s>>>2),s=t,t=c}this.chain_[0]=this.chain_[0]+t&4294967295,this.chain_[1]=this.chain_[1]+s&4294967295,this.chain_[2]=this.chain_[2]+a&4294967295,this.chain_[3]=this.chain_[3]+o&4294967295,this.chain_[4]=this.chain_[4]+l&4294967295}update(r,n){if(null!=r){var i=(n=void 0===n?r.length:n)-this.blockSize;let e=0;var s=this.buf_;let t=this.inbuf_;for(;e<n;){if(0===t)for(;e<=i;)this.compress_(r,e),e+=this.blockSize;if("string"==typeof r){for(;e<n;)if(s[t]=r.charCodeAt(e),++t,++e,t===this.blockSize){this.compress_(s),t=0;break}}else for(;e<n;)if(s[t]=r[e],++t,++e,t===this.blockSize){this.compress_(s),t=0;break}}this.inbuf_=t,this.total_+=n}}digest(){var t=[];let e=8*this.total_;this.inbuf_<56?this.update(this.pad_,56-this.inbuf_):this.update(this.pad_,this.blockSize-(this.inbuf_-56));for(let n=this.blockSize-1;56<=n;n--)this.buf_[n]=255&e,e/=256;this.compress_(this.buf_);let r=0;for(let i=0;i<5;i++)for(let e=24;0<=e;e-=8)t[r]=this.chain_[i]>>e&255,++r;return t}}function Me(e,t){var r=new Le(e,t);return r.subscribe.bind(r)}class Le{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(e=>{this.error(e)})}next(t){this.forEachObserver(e=>{e.next(t)})}error(t){this.forEachObserver(e=>{e.error(t)}),this.close(t)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,r){let n;if(void 0===e&&void 0===t&&void 0===r)throw new Error("Missing Observer.");void 0===(n=((e,t)=>{if("object"==typeof e&&null!==e)for(var r of t)if(r in e&&"function"==typeof e[r])return 1})(e,["next","error","complete"])?e:{next:e,error:t,complete:r}).next&&(n.next=Fe),void 0===n.error&&(n.error=Fe),void 0===n.complete&&(n.complete=Fe);var i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?n.error(this.finalError):n.complete()}catch(e){}}),this.observers.push(n),i}unsubscribeOne(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)}forEachObserver(t){if(!this.finalized)for(let e=0;e<this.observers.length;e++)this.sendOne(e,t)}sendOne(e,t){this.task.then(()=>{if(void 0!==this.observers&&void 0!==this.observers[e])try{t(this.observers[e])}catch(e){"undefined"!=typeof console&&console.error&&console.error(e)}})}close(e){this.finalized||(this.finalized=!0,void 0!==e&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function Fe(){}function l(e,t,r,n){let i;var s;if(n<t?i="at least "+t:r<n&&(i=0===r?"none":"no more than "+r),i)throw s=e+" failed: Was called with "+n+(1===n?" argument.":" arguments.")+" Expects "+i+".",new Error(s)}function Ue(e,t){return e+` failed: ${t} argument `}function Ve(e,t,r,n){if((!n||r)&&"function"!=typeof r)throw new Error(Ue(e,t)+"must be a valid function.")}function qe(e,t,r,n){if((!n||r)&&("object"!=typeof r||null===r))throw new Error(Ue(e,t)+"must be a valid context object.")}let Be=function(e){let t=0;for(let n=0;n<e.length;n++){var r=e.charCodeAt(n);r<128?t++:r<2048?t+=2:55296<=r&&r<=56319?(t+=4,n++):t+=3}return t},je=1e3,ze=2,Ke=144e5,We=.5;function He(e,t=je,r=ze){var n=t*Math.pow(r,e),i=Math.round(We*n*(Math.random()-.5)*2);return Math.min(Ke,n+i)}function w(e){return e&&e._delegate?e._delegate:e}class u{constructor(e,t,r){this.name=e,this.instanceFactory=t,this.type=r,this.multipleInstances=!1,this.serviceProps={},this.instantiationMode="LAZY",this.onInstanceCreated=null}setInstantiationMode(e){return this.instantiationMode=e,this}setMultipleInstances(e){return this.multipleInstances=e,this}setServiceProps(e){return this.serviceProps=e,this}setInstanceCreatedCallback(e){return this.onInstanceCreated=e,this}}let Ge="[DEFAULT]";class $e{constructor(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}get(e){var t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){var r=new Z;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}getImmediate(e){var t=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!=(r=null==e?void 0:e.optional)&&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}}getComponent(){return this.component}setComponent(e){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:Ge})}catch(e){}for(var[t,r]of this.instancesDeferred.entries()){t=this.normalizeInstanceIdentifier(t);try{var n=this.getOrInitializeService({instanceIdentifier:t});r.resolve(n)}catch(e){}}}}clearInstance(e=Ge){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){var e=Array.from(this.instances.values());await Promise.all([...e.filter(e=>"INTERNAL"in e).map(e=>e.INTERNAL.delete()),...e.filter(e=>"_delete"in e).map(e=>e._delete())])}isComponentSet(){return null!=this.component}isInitialized(e=Ge){return this.instances.has(e)}getOptions(e=Ge){return this.instancesOptions.get(e)||{}}initialize(e={}){var{options:t={}}=e,r=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(r))throw Error(this.name+`(${r}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);var n,i,s=this.getOrInitializeService({instanceIdentifier:r,options:t});for([n,i]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(n)&&i.resolve(s);return s}onInit(e,t){var r=this.normalizeInstanceIdentifier(t);let n=null!=(i=this.onInitCallbacks.get(r))?i:new Set;n.add(e),this.onInitCallbacks.set(r,n);var i=this.instances.get(r);return i&&e(i,r),()=>{n.delete(e)}}invokeOnInitCallbacks(e,t){var r=this.onInitCallbacks.get(t);if(r)for(var n of r)try{n(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:(n=e)===Ge?void 0:n,options:t}),this.instances.set(e,r),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch(e){}var n;return r||null}normalizeInstanceIdentifier(e=Ge){return!this.component||this.component.multipleInstances?e:Ge}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class Qe{constructor(e){this.name=e,this.providers=new Map}addComponent(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)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){var t;return this.providers.has(e)?this.providers.get(e):(t=new $e(e,this),this.providers.set(e,t),t)}getProviders(){return Array.from(this.providers.values())}}let Ye=[],Je=((t=c=c||{})[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",{debug:c.DEBUG,verbose:c.VERBOSE,info:c.INFO,warn:c.WARN,error:c.ERROR,silent:c.SILENT}),Xe=c.INFO,Ze={[c.DEBUG]:"log",[c.VERBOSE]:"log",[c.INFO]:"info",[c.WARN]:"warn",[c.ERROR]:"error"},et=(e,t,...r)=>{if(!(t<e.logLevel)){var n=(new Date).toISOString(),i=Ze[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)}};class tt{constructor(e){this.name=e,this._logLevel=Xe,this._logHandler=et,this._userLogHandler=null,Ye.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in c))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?Je[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,c.DEBUG,...e),this._logHandler(this,c.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,c.VERBOSE,...e),this._logHandler(this,c.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,c.INFO,...e),this._logHandler(this,c.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,c.WARN,...e),this._logHandler(this,c.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,c.ERROR,...e),this._logHandler(this,c.ERROR,...e)}}let rt=(t,e)=>e.some(e=>t instanceof e),nt,it;let st=new WeakMap,at=new WeakMap,ot=new WeakMap,lt=new WeakMap,ht=new WeakMap;let ut={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return at.get(e);if("objectStoreNames"===t)return e.objectStoreNames||ot.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return pt(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 ct(n){return n!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(it=it||[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey]).includes(n)?function(...e){return n.apply(ft(this),e),pt(st.get(this))}:function(...e){return pt(n.apply(ft(this),e))}:function(e,...t){var r=n.call(ft(this),e,...t);return ot.set(r,e.sort?e.sort():[e]),pt(r)}}function dt(e){var s,t;return"function"==typeof e?ct(e):(e instanceof IDBTransaction&&(s=e,at.has(s)||(t=new Promise((e,t)=>{let r=()=>{s.removeEventListener("complete",n),s.removeEventListener("error",i),s.removeEventListener("abort",i)},n=()=>{e(),r()},i=()=>{t(s.error||new DOMException("AbortError","AbortError")),r()};s.addEventListener("complete",n),s.addEventListener("error",i),s.addEventListener("abort",i)}),at.set(s,t))),rt(e,nt=nt||[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])?new Proxy(e,ut):e)}function pt(e){var s,t;return e instanceof IDBRequest?(s=e,(t=new Promise((e,t)=>{let r=()=>{s.removeEventListener("success",n),s.removeEventListener("error",i)},n=()=>{e(pt(s.result)),r()},i=()=>{t(s.error),r()};s.addEventListener("success",n),s.addEventListener("error",i)})).then(e=>{e instanceof IDBCursor&&st.set(e,s)}).catch(()=>{}),ht.set(t,s),t):lt.has(e)?lt.get(e):((t=dt(e))!==e&&(lt.set(e,t),ht.set(t,e)),t)}let ft=e=>ht.get(e);function gt(e,t,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){let a=indexedDB.open(e,t);var o=pt(a);return n&&a.addEventListener("upgradeneeded",e=>{n(pt(a.result),e.oldVersion,e.newVersion,pt(a.transaction),e)}),r&&a.addEventListener("blocked",e=>r(e.oldVersion,e.newVersion,e)),o.then(e=>{s&&e.addEventListener("close",()=>s()),i&&e.addEventListener("versionchange",e=>i(e.oldVersion,e.newVersion,e))}).catch(()=>{}),o}function mt(e,{blocked:t}={}){var r=indexedDB.deleteDatabase(e);return t&&r.addEventListener("blocked",e=>t(e.oldVersion,e)),pt(r).then(()=>{})}let vt=["get","getKey","getAll","getAllKeys","count"],_t=["put","add","delete","clear"],yt=new Map;function wt(e,t){if(e instanceof IDBDatabase&&!(t in e)&&"string"==typeof t){if(yt.get(t))return yt.get(t);let i=t.replace(/FromIndex$/,""),s=t!==i,a=_t.includes(i);var r;return i in(s?IDBIndex:IDBObjectStore).prototype&&(a||vt.includes(i))?(r=async function(e,...t){var r=this.transaction(e,a?"readwrite":"readonly");let n=r.store;return s&&(n=n.index(t.shift())),(await Promise.all([n[i](...t),a&&r.done]))[0]},yt.set(t,r),r):void 0}}ut={...X=ut,get:(e,t,r)=>wt(e,t)||X.get(e,t,r),has:(e,t)=>!!wt(e,t)||X.has(e,t)};class bt{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(e=>{var t;return"VERSION"===(null==(t=e.getComponent())?void 0:t.type)?(t=e.getImmediate()).library+"/"+t.version:null}).filter(e=>e).join(" ")}}let It="@firebase/app",Tt="0.13.1",Et=new tt("@firebase/app");let Ct="[DEFAULT]",kt={"@firebase/app":"fire-core","@firebase/app-compat":"fire-core-compat","@firebase/analytics":"fire-analytics","@firebase/analytics-compat":"fire-analytics-compat","@firebase/app-check":"fire-app-check","@firebase/app-check-compat":"fire-app-check-compat","@firebase/auth":"fire-auth","@firebase/auth-compat":"fire-auth-compat","@firebase/database":"fire-rtdb","@firebase/data-connect":"fire-data-connect","@firebase/database-compat":"fire-rtdb-compat","@firebase/functions":"fire-fn","@firebase/functions-compat":"fire-fn-compat","@firebase/installations":"fire-iid","@firebase/installations-compat":"fire-iid-compat","@firebase/messaging":"fire-fcm","@firebase/messaging-compat":"fire-fcm-compat","@firebase/performance":"fire-perf","@firebase/performance-compat":"fire-perf-compat","@firebase/remote-config":"fire-rc","@firebase/remote-config-compat":"fire-rc-compat","@firebase/storage":"fire-gcs","@firebase/storage-compat":"fire-gcs-compat","@firebase/firestore":"fire-fst","@firebase/firestore-compat":"fire-fst-compat","@firebase/ai":"fire-vertex","fire-js":"fire-js",firebase:"fire-js-all"},St=new Map,At=new Map,Nt=new Map;function Rt(t,r){try{t.container.addComponent(r)}catch(e){Et.debug(`Component ${r.name} failed to register with FirebaseApp `+t.name,e)}}function Pt(e,t){e.container.addOrOverwriteComponent(t)}function xt(e){var t,r,n=e.name;if(Nt.has(n))return Et.debug(`There were multiple attempts to register component ${n}.`),!1;Nt.set(n,e);for(t of St.values())Rt(t,e);for(r of At.values())Rt(r,e);return!0}function Dt(e,t){var r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}function Ot(e){return void 0!==e.options}function h(e){return null!=e&&void 0!==e.settings}let Mt=new we("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."});class Lt{constructor(e,t,r){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new u("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw Mt.create("app-deleted",{appName:this._name})}}function Ft(e,t){var r=K(e.split(".")[1]);null===r?console.error(`FirebaseServerApp ${t} is invalid: second part could not be parsed.`):void 0===JSON.parse(r).exp?console.error(`FirebaseServerApp ${t} is invalid: expiration claim could not be parsed`):1e3*JSON.parse(r).exp-(new Date).getTime()<=0&&console.error(`FirebaseServerApp ${t} is invalid: the token has expired.`)}class Ut extends Lt{constructor(e,t,r,n){var i=void 0===t.automaticDataCollectionEnabled||t.automaticDataCollectionEnabled,s={name:r,automaticDataCollectionEnabled:i};void 0!==e.apiKey?super(e,s,n):super(e.options,s,n),this._serverConfig=Object.assign({automaticDataCollectionEnabled:i},t),this._serverConfig.authIdToken&&Ft(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&Ft(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,"undefined"!=typeof FinalizationRegistry&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,t.releaseOnDeref=void 0,d(It,Tt,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,void 0!==e&&null!==this._finalizationRegistry&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){jt(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw Mt.create("server-app-deleted")}}let Vt="11.9.1";function qt(e,t={}){let r=e;if("object"!=typeof t){let e=t;t={name:e}}var n=Object.assign({name:Ct,automaticDataCollectionEnabled:!0},t);let i=n.name;if("string"!=typeof i||!i)throw Mt.create("bad-app-name",{appName:String(i)});if(!(r=r||J()))throw Mt.create("no-options");var s=St.get(i);if(s){if(Ne(r,s.options)&&Ne(n,s.config))return s;throw Mt.create("duplicate-app",{appName:i})}var a,o=new Qe(i);for(a of Nt.values())o.addComponent(a);s=new Lt(r,n,o);return St.set(i,s),s}function Bt(e=Ct){var t=St.get(e);if(!t&&e===Ct&&J())return qt();if(t)return t;throw Mt.create("no-app",{appName:e})}async function jt(e){let t=!1;var r=e.name;St.has(r)?(t=!0,St.delete(r)):At.has(r)&&e.decRefCount()<=0&&(At.delete(r),t=!0),t&&(await Promise.all(e.container.getProviders().map(e=>e.delete())),e.isDeleted=!0)}function d(e,t,r){let n,i=null!=(n=kt[e])?n:e;r&&(i+="-"+r);var s,a=i.match(/\s|\//),o=t.match(/\s|\//);a||o?(s=[`Unable to register library "${i}" with version "${t}":`],a&&s.push(`library name "${i}" contains illegal characters (whitespace or "/")`),a&&o&&s.push("and"),o&&s.push(`version name "${t}" contains illegal characters (whitespace or "/")`),Et.warn(s.join(" "))):xt(new u(i+"-version",()=>({library:i,version:t}),"VERSION"))}function zt(e,t){if(null!==e&&"function"!=typeof e)throw Mt.create("invalid-log-argument");var r,s=e,n=t;for(r of Ye){let i=null;n&&n.level&&(i=Je[n.level]),r.userLogHandler=null===s?null:(e,t,...r)=>{var n=r.map(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(e=>e).join(" ");t>=(null!=i?i:e.logLevel)&&s({level:c[t].toLowerCase(),message:n,args:r,type:e.name})}}}function Kt(e){var t;t=e,Ye.forEach(e=>{e.setLogLevel(t)})}let Wt="firebase-heartbeat-database",Ht=1,Gt="firebase-heartbeat-store",$t=null;function Qt(){return $t=$t||gt(Wt,Ht,{upgrade:(e,t)=>{if(0===t)try{e.createObjectStore(Gt)}catch(e){console.warn(e)}}}).catch(e=>{throw Mt.create("idb-open",{originalErrorMessage:e.message})})}async function Yt(e,t){try{var r=(await Qt()).transaction(Gt,"readwrite");await r.objectStore(Gt).put(t,Jt(e)),await r.done}catch(e){e instanceof ye?Et.warn(e.message):(r=Mt.create("idb-set",{originalErrorMessage:null==e?void 0:e.message}),Et.warn(r.message))}}function Jt(e){return e.name+"!"+e.options.appId}class Xt{constructor(e){this.container=e,this._heartbeatsCache=null;var t=this.container.getProvider("app").getImmediate();this._storage=new er(t),this._heartbeatsCachePromise=this._storage.read().then(e=>this._heartbeatsCache=e)}async triggerHeartbeat(){var e,r;try{var n,i=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString();let t=Zt();if(null!=(null==(e=this._heartbeatsCache)?void 0:e.heartbeats)||(this._heartbeatsCache=await this._heartbeatsCachePromise,null!=(null==(r=this._heartbeatsCache)?void 0:r.heartbeats)))if(this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some(e=>e.date===t))return this._heartbeatsCache.heartbeats.push({date:t,agent:i}),30<this._heartbeatsCache.heartbeats.length&&(n=(e=>{if(0===e.length)return-1;let t=0,r=e[0].date;for(let n=1;n<e.length;n++)e[n].date<r&&(r=e[n].date,t=n);return t})(this._heartbeatsCache.heartbeats),this._heartbeatsCache.heartbeats.splice(n,1)),this._storage.overwrite(this._heartbeatsCache)}catch(e){Et.warn(e)}}async getHeartbeatsHeader(){var e,t,r,n,i;try{return(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null==(null==(e=this._heartbeatsCache)?void 0:e.heartbeats)||0===this._heartbeatsCache.heartbeats.length)?"":(t=Zt(),{heartbeatsToSend:r,unsentEntries:n}=((e,t=1024)=>{let r=[],n=e.slice();for(let s of e){var i=r.find(e=>e.agent===s.agent);if(i){if(i.dates.push(s.date),tr(r)>t){i.dates.pop();break}}else if(r.push({agent:s.agent,dates:[s.date]}),tr(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}})(this._heartbeatsCache.heartbeats),i=z(JSON.stringify({version:2,heartbeats:r})),this._heartbeatsCache.lastSentHeartbeatDate=t,0<n.length?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),i)}catch(e){return Et.warn(e),""}}}function Zt(){return(new Date).toISOString().substring(0,10)}class er{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!me()&&ve().then(()=>!0).catch(()=>!1)}async read(){var e;return await this._canUseIndexedDBPromise&&null!=(e=await(async e=>{try{var t=(await Qt()).transaction(Gt),r=await t.objectStore(Gt).get(Jt(e));return await t.done,r}catch(e){e instanceof ye?Et.warn(e.message):(t=Mt.create("idb-get",{originalErrorMessage:null==e?void 0:e.message}),Et.warn(t.message))}})(this.app))&&e.heartbeats?e:{heartbeats:[]}}async overwrite(e){var t,r;if(await this._canUseIndexedDBPromise)return r=await this.read(),Yt(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}async add(e){var t,r;if(await this._canUseIndexedDBPromise)return r=await this.read(),Yt(this.app,{lastSentHeartbeatDate:null!=(t=e.lastSentHeartbeatDate)?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}function tr(e){return z(JSON.stringify({version:2,heartbeats:e})).length}t="",xt(new u("platform-logger",e=>new bt(e),"PRIVATE")),xt(new u("heartbeat",e=>new Xt(e),"PRIVATE")),d(It,Tt,t),d(It,Tt,"esm2017"),d("fire-js","");var rr=Object.freeze({__proto__:null,SDK_VERSION:Vt,_DEFAULT_ENTRY_NAME:Ct,_addComponent:Rt,_addOrOverwriteComponent:Pt,_apps:St,_clearComponents:function(){Nt.clear()},_components:Nt,_getProvider:Dt,_isFirebaseApp:Ot,_isFirebaseServerApp:h,_registerComponent:xt,_removeServiceInstance:function(e,t,r=Ct){Dt(e,t).clearInstance(r)},_serverApps:At,deleteApp:jt,getApp:Bt,getApps:function(){return Array.from(St.values())},initializeApp:qt,initializeServerApp:function(e,t){if(("undefined"!=typeof window||he())&&!he())throw Mt.create("invalid-server-app-environment");void 0===t.automaticDataCollectionEnabled&&(t.automaticDataCollectionEnabled=!0);let r;r=Ot(e)?e.options:e;var n=Object.assign(Object.assign({},t),r);if(void 0!==n.releaseOnDeref&&delete n.releaseOnDeref,void 0!==t.releaseOnDeref&&"undefined"==typeof FinalizationRegistry)throw Mt.create("finalization-registry-not-supported",{});var n=""+[...JSON.stringify(n)].reduce((e,t)=>Math.imul(31,e)+t.charCodeAt(0)|0,0),i=At.get(n);if(i)i.incRefCount(t.releaseOnDeref);else{var s,a=new Qe(n);for(s of Nt.values())a.addComponent(s);i=new Ut(r,t,n,a),At.set(n,i)}return i},onLog:zt,registerVersion:d,setLogLevel:Kt,FirebaseError:ye});class nr{constructor(e,t){this._delegate=e,this.firebase=t,Rt(e,new u("app-compat",()=>this,"PUBLIC")),this.container=e.container}get automaticDataCollectionEnabled(){return this._delegate.automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this._delegate.automaticDataCollectionEnabled=e}get name(){return this._delegate.name}get options(){return this._delegate.options}delete(){return new Promise(e=>{this._delegate.checkDestroyed(),e()}).then(()=>(this.firebase.INTERNAL.removeApp(this.name),jt(this._delegate)))}_getService(e,t=Ct){this._delegate.checkDestroyed();var r,n=this._delegate.container.getProvider(e);return n.isInitialized()||"EXPLICIT"!==(null==(r=n.getComponent())?void 0:r.instantiationMode)||n.initialize(),n.getImmediate({identifier:t})}_removeServiceInstance(e,t=Ct){this._delegate.container.getProvider(e).clearInstance(t)}_addComponent(e){Rt(this._delegate,e)}_addOrOverwriteComponent(e){Pt(this._delegate,e)}toJSON(){return{name:this.name,automaticDataCollectionEnabled:this.automaticDataCollectionEnabled,options:this.options}}}let ir=new we("app-compat","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance."});function sr(i){let s={},a={__esModule:!0,initializeApp:function(e,t={}){var r=qt(e,t);if(Ce(s,r.name))return s[r.name];var n=new i(r,a);return s[r.name]=n},app:o,registerVersion:d,setLogLevel:Kt,onLog:zt,apps:null,SDK_VERSION:Vt,INTERNAL:{registerComponent:function(t){let r=t.name,n=r.replace("-compat","");{var e;xt(t)&&"PUBLIC"===t.type&&(e=(e=o())=>{if("function"!=typeof e[n])throw ir.create("invalid-app-argument",{appName:r});return e[n]()},void 0!==t.serviceProps&&W(e,t.serviceProps),a[n]=e,i.prototype[n]=function(...e){return this._getService.bind(this,r).apply(this,t.multipleInstances?e:[])})}return"PUBLIC"===t.type?a[n]:null},removeApp:function(e){delete s[e]},useAsService:function(e,t){if("serverAuth"===t)return null;var r=t;return r},modularAPIs:rr}};function o(e){if(e=e||Ct,Ce(s,e))return s[e];throw ir.create("no-app",{appName:e})}return a.default=a,Object.defineProperty(a,"apps",{get:function(){return Object.keys(s).map(e=>s[e])}}),o.App=i,a}var ar=function e(){let t=sr(nr);return t.INTERNAL=Object.assign(Object.assign({},t.INTERNAL),{createFirebaseNamespace:e,extendNamespace:function(e){W(t,e)},createSubscribe:Me,ErrorFactory:we,deepExtend:W}),t}(),e=new tt("@firebase/app-compat");try{var or=H();void 0!==or.firebase&&(e.warn(`
Warning: Firebase is already defined in the global scope. Please make sure
Firebase library is only loaded once.
`),hr=or.firebase.SDK_VERSION)&&0<=hr.indexOf("LITE")&&e.warn(`
Warning: You are trying to load Firebase while using Firebase Performance standalone script.
You should load Firebase Performance with this instance of Firebase to avoid loading duplicate code.
`)}catch(e){}let lr=ar;d("@firebase/app-compat","0.4.1",void 0);lr.registerVersion("firebase","11.9.1","app-compat");var or="@firebase/installations",hr="0.6.17";let ur=1e4,cr="w:"+hr,dr="FIS_v2",pr="https://firebaseinstallations.googleapis.com/v1",fr=36e5;let gr=new we("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 mr(e){return e instanceof ye&&e.code.includes("request-failed")}function vr({projectId:e}){return pr+`/projects/${e}/installations`}function _r(e){return{token:e.token,requestStatus:2,expiresIn:Number(e.expiresIn.replace("s","000")),creationTime:Date.now()}}async function yr(e,t){var r=(await t.json()).error;return gr.create("request-failed",{requestName:e,serverCode:r.code,serverMessage:r.message,serverStatus:r.status})}function wr({apiKey:e}){return new Headers({"Content-Type":"application/json",Accept:"application/json","x-goog-api-key":e})}function br(e,{refreshToken:t}){var r=wr(e);return r.append("Authorization",(e=t,dr+" "+e)),r}async function Ir(e){var t=await e();return 500<=t.status&&t.status<600?e():t}function Tr(t){return new Promise(e=>{setTimeout(e,t)})}let Er=/^[cdef][\w-]{21}$/,Cr="";function kr(){try{var e=new Uint8Array(17),t=((self.crypto||self.msCrypto).getRandomValues(e),e[0]=112+e[0]%16,(e=>btoa(String.fromCharCode(...e)).replace(/\+/g,"-").replace(/\//g,"_"))(e).substr(0,22));return Er.test(t)?t:Cr}catch(e){return Cr}}function Sr(e){return e.appName+"!"+e.appId}let Ar=new Map;function Nr(e,t){var r=Sr(e),e=(Rr(r,t),r),r=(()=>(!Pr&&"BroadcastChannel"in self&&((Pr=new BroadcastChannel("[Firebase] FID Change")).onmessage=e=>{Rr(e.data.key,e.data.fid)}),Pr))();r&&r.postMessage({key:e,fid:t}),0===Ar.size&&Pr&&(Pr.close(),Pr=null)}function Rr(e,t){var r=Ar.get(e);if(r)for(var n of r)n(t)}let Pr=null;let xr="firebase-installations-database",Dr=1,Or="firebase-installations-store",Mr=null;function Lr(){return Mr=Mr||gt(xr,Dr,{upgrade:(e,t)=>{0===t&&e.createObjectStore(Or)}})}async function Fr(e,t){var r=Sr(e),n=(await Lr()).transaction(Or,"readwrite"),i=n.objectStore(Or),s=await i.get(r);return await i.put(t,r),await n.done,s&&s.fid===t.fid||Nr(e,t.fid),t}async function Ur(e){var t=Sr(e),r=(await Lr()).transaction(Or,"readwrite");await r.objectStore(Or).delete(t),await r.done}async function Vr(e,t){var r=Sr(e),n=(await Lr()).transaction(Or,"readwrite"),i=n.objectStore(Or),s=await i.get(r),a=t(s);return void 0===a?await i.delete(r):await i.put(a,r),await n.done,!a||s&&s.fid===a.fid||Nr(e,a.fid),a}async function qr(r){let n;var e=await Vr(r.appConfig,e=>{var t=jr(e||{fid:kr(),registrationStatus:0}),t=((e,t)=>{var r,n;return 0===t.registrationStatus?navigator.onLine?(r={fid:t.fid,registrationStatus:1,registrationTime:Date.now()},n=(async(t,r)=>{try{var e=await(async({appConfig:e,heartbeatServiceProvider:t},{fid:r})=>{let n=vr(e);var i=wr(e),s=((s=t.getImmediate({optional:!0}))&&(s=await s.getHeartbeatsHeader())&&i.append("x-firebase-client",s),{fid:r,authVersion:dr,appId:e.appId,sdkVersion:cr});let a={method:"POST",headers:i,body:JSON.stringify(s)};if((i=await Ir(()=>fetch(n,a))).ok)return{fid:(s=await i.json()).fid||r,registrationStatus:2,refreshToken:s.refreshToken,authToken:_r(s.authToken)};throw await yr("Create Installation",i)})(t,r);return Fr(t.appConfig,e)}catch(e){throw mr(e)&&409===e.customData.serverCode?await Ur(t.appConfig):await Fr(t.appConfig,{fid:r.fid,registrationStatus:0}),e}})(e,r),{installationEntry:r,registrationPromise:n}):(r=Promise.reject(gr.create("app-offline")),{installationEntry:t,registrationPromise:r}):1===t.registrationStatus?{installationEntry:t,registrationPromise:(async e=>{let t=await Br(e.appConfig);for(;1===t.registrationStatus;)await Tr(100),t=await Br(e.appConfig);var r,n;return 0!==t.registrationStatus?t:({installationEntry:r,registrationPromise:n}=await qr(e),n||r)})(e)}:{installationEntry:t}})(r,t);return n=t.registrationPromise,t.installationEntry});return e.fid===Cr?{installationEntry:await n}:{installationEntry:e,registrationPromise:n}}function Br(e){return Vr(e,e=>{if(e)return jr(e);throw gr.create("installation-not-found")})}function jr(e){var t;return 1===(t=e).registrationStatus&&t.registrationTime+ur<Date.now()?{fid:e.fid,registrationStatus:0}:e}async function zr({appConfig:e,heartbeatServiceProvider:t},r){[i,s]=[e,r.fid];let n=vr(i)+`/${s}/authTokens:generate`;var i,s,a=br(e,r),o=t.getImmediate({optional:!0}),o=(o&&(o=await o.getHeartbeatsHeader())&&a.append("x-firebase-client",o),{installation:{sdkVersion:cr,appId:e.appId}});let l={method:"POST",headers:a,body:JSON.stringify(o)};a=await Ir(()=>fetch(n,l));if(a.ok)return _r(await a.json());throw await yr("Generate Auth Token",a)}async function Kr(n,i=!1){let s;var e=await Vr(n.appConfig,e=>{if(!Hr(e))throw gr.create("not-registered");var t,r=e.authToken;if(i||2!==(t=r).requestStatus||(e=>{var t=Date.now();return t<e.creationTime||e.creationTime+e.expiresIn<t+fr})(t)){if(1===r.requestStatus)return s=(async(e,t)=>{let r=await Wr(e.appConfig);for(;1===r.authToken.requestStatus;)await Tr(100),r=await Wr(e.appConfig);var n=r.authToken;return 0===n.requestStatus?Kr(e,t):n})(n,i),e;if(navigator.onLine)return t=e,r={requestStatus:1,requestTime:Date.now()},r=Object.assign(Object.assign({},t),{authToken:r}),s=(async(t,r)=>{try{var e=await zr(t,r),n=Object.assign(Object.assign({},r),{authToken:e});return await Fr(t.appConfig,n),e}catch(e){var i;throw!mr(e)||401!==e.customData.serverCode&&404!==e.customData.serverCode?(i=Object.assign(Object.assign({},r),{authToken:{requestStatus:0}}),await Fr(t.appConfig,i)):await Ur(t.appConfig),e}})(n,r),r;throw gr.create("app-offline")}return e});return s?await s:e.authToken}function Wr(e){return Vr(e,e=>{var t,r;if(Hr(e))return t=e.authToken,1===(r=t).requestStatus&&r.requestTime+ur<Date.now()?Object.assign(Object.assign({},e),{authToken:{requestStatus:0}}):e;throw gr.create("not-registered")})}function Hr(e){return void 0!==e&&2===e.registrationStatus}async function Gr(e,t=!1){var r=e,n=(await(!(n=(await qr(r)).registrationPromise)||!await n),await Kr(r,t));return n.token}function $r(e){return gr.create("missing-app-config-values",{valueName:e})}let Qr="installations",Yr=e=>{var t=e.getProvider("app").getImmediate();return{app:t,appConfig:(e=>{if(!e||!e.options)throw $r("App Configuration");if(!e.name)throw $r("App Name");var t;for(t of["projectId","apiKey","appId"])if(!e.options[t])throw $r(t);return{appName:e.name,projectId:e.options.projectId,apiKey:e.options.apiKey,appId:e.options.appId}})(t),heartbeatServiceProvider:Dt(t,"heartbeat"),_delete:()=>Promise.resolve()}},Jr=e=>{let t=Dt(e.getProvider("app").getImmediate(),Qr).getImmediate();return{getId:()=>(async e=>{var t=e,{installationEntry:r,registrationPromise:n}=await qr(t);return(n||Kr(t)).catch(console.error),r.fid})(t),getToken:e=>Gr(t,e)}};xt(new u(Qr,Yr,"PUBLIC")),xt(new u("installations-internal",Jr,"PRIVATE")),d(or,hr),d(or,hr,"esm2017");let Xr="analytics",Zr="firebase_id",en="origin",tn=6e4,rn="https://firebase.googleapis.com/v1alpha/projects/-/apps/{app-id}/webConfig",nn="https://www.googletagmanager.com/gtag/js",sn=new tt("@firebase/analytics"),an=new we("analytics","Analytics",{"already-exists":"A Firebase Analytics instance with the appId {$id} already exists. Only one Firebase Analytics instance can be created for each appId.","already-initialized":"initializeAnalytics() cannot be called again with different options than those it was initially called with. It can be called again with the same options to return the existing instance, or getAnalytics() can be used to get a reference to the already-initialized