@laboratoria/sdk-js 2.1.1 → 2.2.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.
@@ -0,0 +1,2 @@
1
+ /*! For license information please see laboratoria-sdk-esm.js.LICENSE.txt */
2
+ var e={560:function(e,t,r){var n;!function(i){function s(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function o(e,t,r,n,i,o){return s((a=s(s(t,e),s(n,o)))<<(c=i)|a>>>32-c,r);var a,c}function a(e,t,r,n,i,s,a){return o(t&r|~t&n,e,t,i,s,a)}function c(e,t,r,n,i,s,a){return o(t&n|r&~n,e,t,i,s,a)}function l(e,t,r,n,i,s,a){return o(t^r^n,e,t,i,s,a)}function u(e,t,r,n,i,s,a){return o(r^(t|~n),e,t,i,s,a)}function d(e,t){var r,n,i,o,d;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,f=-1732584194,m=271733878;for(r=0;r<e.length;r+=16)n=h,i=p,o=f,d=m,h=a(h,p,f,m,e[r],7,-680876936),m=a(m,h,p,f,e[r+1],12,-389564586),f=a(f,m,h,p,e[r+2],17,606105819),p=a(p,f,m,h,e[r+3],22,-1044525330),h=a(h,p,f,m,e[r+4],7,-176418897),m=a(m,h,p,f,e[r+5],12,1200080426),f=a(f,m,h,p,e[r+6],17,-1473231341),p=a(p,f,m,h,e[r+7],22,-45705983),h=a(h,p,f,m,e[r+8],7,1770035416),m=a(m,h,p,f,e[r+9],12,-1958414417),f=a(f,m,h,p,e[r+10],17,-42063),p=a(p,f,m,h,e[r+11],22,-1990404162),h=a(h,p,f,m,e[r+12],7,1804603682),m=a(m,h,p,f,e[r+13],12,-40341101),f=a(f,m,h,p,e[r+14],17,-1502002290),h=c(h,p=a(p,f,m,h,e[r+15],22,1236535329),f,m,e[r+1],5,-165796510),m=c(m,h,p,f,e[r+6],9,-1069501632),f=c(f,m,h,p,e[r+11],14,643717713),p=c(p,f,m,h,e[r],20,-373897302),h=c(h,p,f,m,e[r+5],5,-701558691),m=c(m,h,p,f,e[r+10],9,38016083),f=c(f,m,h,p,e[r+15],14,-660478335),p=c(p,f,m,h,e[r+4],20,-405537848),h=c(h,p,f,m,e[r+9],5,568446438),m=c(m,h,p,f,e[r+14],9,-1019803690),f=c(f,m,h,p,e[r+3],14,-187363961),p=c(p,f,m,h,e[r+8],20,1163531501),h=c(h,p,f,m,e[r+13],5,-1444681467),m=c(m,h,p,f,e[r+2],9,-51403784),f=c(f,m,h,p,e[r+7],14,1735328473),h=l(h,p=c(p,f,m,h,e[r+12],20,-1926607734),f,m,e[r+5],4,-378558),m=l(m,h,p,f,e[r+8],11,-2022574463),f=l(f,m,h,p,e[r+11],16,1839030562),p=l(p,f,m,h,e[r+14],23,-35309556),h=l(h,p,f,m,e[r+1],4,-1530992060),m=l(m,h,p,f,e[r+4],11,1272893353),f=l(f,m,h,p,e[r+7],16,-155497632),p=l(p,f,m,h,e[r+10],23,-1094730640),h=l(h,p,f,m,e[r+13],4,681279174),m=l(m,h,p,f,e[r],11,-358537222),f=l(f,m,h,p,e[r+3],16,-722521979),p=l(p,f,m,h,e[r+6],23,76029189),h=l(h,p,f,m,e[r+9],4,-640364487),m=l(m,h,p,f,e[r+12],11,-421815835),f=l(f,m,h,p,e[r+15],16,530742520),h=u(h,p=l(p,f,m,h,e[r+2],23,-995338651),f,m,e[r],6,-198630844),m=u(m,h,p,f,e[r+7],10,1126891415),f=u(f,m,h,p,e[r+14],15,-1416354905),p=u(p,f,m,h,e[r+5],21,-57434055),h=u(h,p,f,m,e[r+12],6,1700485571),m=u(m,h,p,f,e[r+3],10,-1894986606),f=u(f,m,h,p,e[r+10],15,-1051523),p=u(p,f,m,h,e[r+1],21,-2054922799),h=u(h,p,f,m,e[r+8],6,1873313359),m=u(m,h,p,f,e[r+15],10,-30611744),f=u(f,m,h,p,e[r+6],15,-1560198380),p=u(p,f,m,h,e[r+13],21,1309151649),h=u(h,p,f,m,e[r+4],6,-145523070),m=u(m,h,p,f,e[r+11],10,-1120210379),f=u(f,m,h,p,e[r+2],15,718787259),p=u(p,f,m,h,e[r+9],21,-343485551),h=s(h,n),p=s(p,i),f=s(f,o),m=s(m,d);return[h,p,f,m]}function h(e){var t,r="",n=32*e.length;for(t=0;t<n;t+=8)r+=String.fromCharCode(e[t>>5]>>>t%32&255);return r}function p(e){var t,r=[];for(r[(e.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var n=8*e.length;for(t=0;t<n;t+=8)r[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return r}function f(e){var t,r,n="0123456789abcdef",i="";for(r=0;r<e.length;r+=1)t=e.charCodeAt(r),i+=n.charAt(t>>>4&15)+n.charAt(15&t);return i}function m(e){return unescape(encodeURIComponent(e))}function g(e){return function(e){return h(d(p(e),8*e.length))}(m(e))}function y(e,t){return function(e,t){var r,n,i=p(e),s=[],o=[];for(s[15]=o[15]=void 0,i.length>16&&(i=d(i,8*e.length)),r=0;r<16;r+=1)s[r]=909522486^i[r],o[r]=1549556828^i[r];return n=d(s.concat(p(t)),512+8*t.length),h(d(o.concat(n),640))}(m(e),m(t))}function v(e,t,r){return t?r?y(t,e):f(y(t,e)):r?g(e):f(g(e))}void 0===(n=function(){return v}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t);var n={};(()=>{r.d(n,{r:()=>rn});const e=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):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>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t},t={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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const i=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let d=(15&o)<<2|c>>6,h=63&c;a||(h=64,s||(d=64)),n.push(r[l],r[u],r[d],r[h])}return n.join("")},encodeString(t,r){return this.HAS_NATIVE_SUPPORT&&!r?btoa(t):this.encodeByteArray(e(t),r)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{const s=e[r++],o=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0;++t;const o=t<e.length?r[e.charAt(t)]:64;++t;const a=t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(n.push(c),64!==o){const e=s<<4&240|o>>2;if(n.push(e),64!==a){const e=o<<6&192|a;n.push(e)}}}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,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},i=function(r){return function(r){const n=e(r);return t.encodeByteArray(n,!0)}(r).replace(/\./g,"")};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class a extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(l,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(i,r):"Error",o=`${this.serviceName}: ${s} (${n}).`;return new a(n,o,r)}}const l=/\{\$([^}]+)}/g;function u(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const i of r){if(!n.includes(i))return!1;const r=e[i],s=t[i];if(d(r)&&d(s)){if(!u(r,s))return!1}else if(r!==s)return!1}for(const e of n)if(!r.includes(e))return!1;return!0}function d(e){return null!==e&&"object"==typeof e}function h(e){const t=[];for(const[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 p(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}})),t}function f(e){const t=e.indexOf("?");if(!t)return"";const r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}class m{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(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}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.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const t of["next","error","complete"])if(t in e&&"function"==typeof e[t])return!0;return!1}(e)?e:{next:e,error:t,complete:r},void 0===n.next&&(n.next=g),void 0===n.error&&(n.error=g),void 0===n.complete&&(n.complete=g);const 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-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}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 g(){}function y(e){return e&&e._delegate?e._delegate:e}class v{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}}const b="[DEFAULT]";class _{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){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new s;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(r)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(n)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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:b})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e="[DEFAULT]"){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const 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="[DEFAULT]"){return this.instances.has(e)}getOptions(e="[DEFAULT]"){return this.instancesOptions.get(e)||{}}initialize(e={}){const{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`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[e,t]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(e)&&t.resolve(n);return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),i=null!==(r=this.onInitCallbacks.get(n))&&void 0!==r?r:new Set;i.add(e),this.onInitCallbacks.set(n,i);const s=this.instances.get(n);return s&&e(s,n),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const 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,n===b?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="[DEFAULT]"){return this.component?this.component.multipleInstances?e:b:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class I{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const 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){if(this.providers.has(e))return this.providers.get(e);const t=new _(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const w=[];var T;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(T||(T={}));const k={debug:T.DEBUG,verbose:T.VERBOSE,info:T.INFO,warn:T.WARN,error:T.ERROR,silent:T.SILENT},E=T.INFO,S={[T.DEBUG]:"log",[T.VERBOSE]:"log",[T.INFO]:"info",[T.WARN]:"warn",[T.ERROR]:"error"},O=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),i=S[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)};class C{constructor(e){this.name=e,this._logLevel=E,this._logHandler=O,this._userLogHandler=null,w.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in T))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?k[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,T.DEBUG,...e),this._logHandler(this,T.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,T.VERBOSE,...e),this._logHandler(this,T.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,T.INFO,...e),this._logHandler(this,T.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,T.WARN,...e),this._logHandler(this,T.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,T.ERROR,...e),this._logHandler(this,T.ERROR,...e)}}let A,R;const P=new WeakMap,N=new WeakMap,D=new WeakMap,L=new WeakMap,M=new WeakMap;let U={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return N.get(e);if("objectStoreNames"===t)return e.objectStoreNames||D.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return $(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function j(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(R||(R=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(x(this),e),$(P.get(this))}:function(...e){return $(t.apply(x(this),e))}:function(e,...r){const n=t.call(x(this),e,...r);return D.set(n,e.sort?e.sort():[e]),$(n)}:(e instanceof IDBTransaction&&function(e){if(N.has(e))return;const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),n()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)}));N.set(e,t)}(e),r=e,(A||(A=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>r instanceof e))?new Proxy(e,U):e);var t,r}function $(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t($(e.result)),n()},s=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&P.set(t,e)})).catch((()=>{})),M.set(t,e),t}(e);if(L.has(e))return L.get(e);const t=j(e);return t!==e&&(L.set(e,t),M.set(t,e)),t}const x=e=>M.get(e),F=["get","getKey","getAll","getAllKeys","count"],B=["put","add","delete","clear"],V=new Map;function H(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(V.get(t))return V.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=B.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!F.includes(r))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;return n&&(o=o.index(t.shift())),(await Promise.all([o[r](...t),i&&s.done]))[0]};return V.set(t,s),s}var z;z=U,U={...z,get:(e,t,r)=>H(e,t)||z.get(e,t,r),has:(e,t)=>!!H(e,t)||z.has(e,t)};class W{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const q="@firebase/app",G="0.7.30",J=new C("@firebase/app"),K={[q]:"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/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","fire-js":"fire-js",firebase:"fire-js-all"},X=new Map,Y=new Map;function Q(e,t){try{e.container.addComponent(t)}catch(r){J.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function Z(e){const t=e.name;if(Y.has(t))return J.debug(`There were multiple attempts to register component ${t}.`),!1;Y.set(t,e);for(const t of X.values())Q(t,e);return!0}function ee(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}const te=new c("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","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","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}."});class re{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 v("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 te.create("app-deleted",{appName:this._name})}}const ne="9.9.2";function ie(e,t,r){var n;let i=null!==(n=K[e])&&void 0!==n?n:e;r&&(i+=`-${r}`);const s=i.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const e=[`Unable to register library "${i}" with version "${t}":`];return s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void J.warn(e.join(" "))}Z(new v(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}const se="firebase-heartbeat-store";let oe=null;function ae(){return oe||(oe=function(e,t,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=$(o);return n&&o.addEventListener("upgradeneeded",(e=>{n($(o.result),e.oldVersion,e.newVersion,$(o.transaction))})),r&&o.addEventListener("blocked",(()=>r())),a.then((e=>{s&&e.addEventListener("close",(()=>s())),i&&e.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(se)}}).catch((e=>{throw te.create("idb-open",{originalErrorMessage:e.message})}))),oe}async function ce(e,t){var r;try{const r=(await ae()).transaction(se,"readwrite"),n=r.objectStore(se);return await n.put(t,le(e)),r.done}catch(e){if(e instanceof a)J.warn(e.message);else{const t=te.create("idb-set",{originalErrorMessage:null===(r=e)||void 0===r?void 0:r.message});J.warn(t.message)}}}function le(e){return`${e.name}!${e.options.appId}`}class ue{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new he(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=de();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=de(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){const r=[];let n=e.slice();for(const i of e){const e=r.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),pe(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),pe(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),n=i(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}}function de(){return(new Date).toISOString().substring(0,10)}class he{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return"object"==typeof indexedDB&&new Promise(((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){return await this._canUseIndexedDBPromise&&await async function(e){var t;try{return(await ae()).transaction(se).objectStore(se).get(le(e))}catch(e){if(e instanceof a)J.warn(e.message);else{const r=te.create("idb-get",{originalErrorMessage:null===(t=e)||void 0===t?void 0:t.message});J.warn(r.message)}}}(this.app)||{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return ce(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return ce(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function pe(e){return i(JSON.stringify({version:2,heartbeats:e})).length}function fe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}Z(new v("platform-logger",(e=>new W(e)),"PRIVATE")),Z(new v("heartbeat",(e=>new ue(e)),"PRIVATE")),ie(q,G,""),ie(q,G,"esm2017"),ie("fire-js",""),ie("firebase","9.9.2","app"),Object.create,Object.create;const me=function(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}},ge=new c("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),ye=new C("@firebase/auth");function ve(e,...t){ye.logLevel<=T.ERROR&&ye.error(`Auth (9.9.2): ${e}`,...t)}function be(e,...t){throw Ie(e,...t)}function _e(e,...t){return Ie(e,...t)}function Ie(e,...t){if("string"!=typeof e){const r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return ge.create(e,...t)}function we(e,t,...r){if(!e)throw Ie(t,...r)}function Te(e){const t="INTERNAL ASSERTION FAILED: "+e;throw ve(t),new Error(t)}function ke(e,t){e||Te(t)}const Ee=new Map;function Se(e){ke(e instanceof Function,"Expected a class definition");let t=Ee.get(e);return t?(ke(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Ee.set(e,t),t)}function Oe(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Ce(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function Ae(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===Ce()||"https:"===Ce()||function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()||"connection"in navigator))||navigator.onLine}class Re{constructor(e,t){this.shortDelay=e,this.longDelay=t,ke(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(o())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Ae()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Pe(e,t){ke(e.emulator,"Emulator should always be set here");const{url:r}=e.emulator;return t?`${r}${t.startsWith("/")?t.slice(1):t}`:r}class Ne{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void Te("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void Te("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void Te("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const De={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},Le=new Re(3e4,6e4);function Me(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function Ue(e,t,r,n,i={}){return je(e,i,(async()=>{let i={},s={};n&&("GET"===t?s=n:i={body:JSON.stringify(n)});const o=h(Object.assign({key:e.config.apiKey},s)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),Ne.fetch()(xe(e,e.config.apiHost,r,o),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))}))}async function je(e,t,r){e._canInitEmulator=!1;const n=Object.assign(Object.assign({},De),t);try{const t=new Fe(e),i=await Promise.race([r(),t.promise]);t.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Be(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const t=i.ok?s.errorMessage:s.error.message,[r,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===r)throw Be(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===r)throw Be(e,"email-already-in-use",s);if("USER_DISABLED"===r)throw Be(e,"user-disabled",s);const a=n[r]||r.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(e,t,r){const n=Object.assign(Object.assign({},me()),{[t]:r});return new c("auth","Firebase",n).create(t,{appName:e.name})}(e,a,o);be(e,a)}}catch(t){if(t instanceof a)throw t;be(e,"network-request-failed")}}async function $e(e,t,r,n,i={}){const s=await Ue(e,t,r,n,i);return"mfaPendingCredential"in s&&be(e,"multi-factor-auth-required",{_serverResponse:s}),s}function xe(e,t,r,n){const i=`${t}${r}?${n}`;return e.config.emulator?Pe(e.config,i):`${e.config.apiScheme}://${i}`}class Fe{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(_e(this.auth,"network-request-failed"))),Le.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Be(e,t,r){const n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);const i=_e(e,t,n);return i.customData._tokenResponse=r,i}function Ve(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function He(e){return 1e3*Number(e)}function ze(e){var r;const[n,i,s]=e.split(".");if(void 0===n||void 0===i||void 0===s)return ve("JWT malformed, contained fewer than 3 sections"),null;try{const e=function(e){try{return t.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(i);return e?JSON.parse(e):(ve("Failed to decode base64 JWT payload"),null)}catch(e){return ve("Caught error parsing JWT payload as JSON",null===(r=e)||void 0===r?void 0:r.toString()),null}}async function We(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof a&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class qe{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){var e;try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null===(e=t)||void 0===e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class Ge{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ve(this.lastLoginAt),this.creationTime=Ve(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Je(e){var t;const r=e.auth,n=await e.getIdToken(),i=await We(e,async function(e,t){return Ue(e,"POST","/v1/accounts:lookup",t)}(r,{idToken:n}));we(null==i?void 0:i.users.length,r,"internal-error");const s=i.users[0];e._notifyReloadListener(s);const o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?s.providerUserInfo.map((e=>{var{providerId:t}=e,r=fe(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})):[],a=(c=e.providerData,l=o,[...c.filter((e=>!l.some((t=>t.providerId===e.providerId)))),...l]);var c,l;const u=e.isAnonymous,d=!(e.email&&s.passwordHash||(null==a?void 0:a.length)),h=!!u&&d,p={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new Ge(s.createdAt,s.lastLoginAt),isAnonymous:h};Object.assign(e,p)}class Ke{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){we(e.idToken,"internal-error"),we(void 0!==e.idToken,"internal-error"),we(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){const t=ze(e);return we(t,"internal-error"),we(void 0!==t.exp,"internal-error"),we(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return we(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:n,expiresIn:i}=await async function(e,t){const r=await je(e,{},(async()=>{const r=h({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:n,apiKey:i}=e.config,s=xe(e,n,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(s,{method:"POST",headers:o,body:r})}));return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}(e,t);this.updateTokensAndExpiration(r,n,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){const{refreshToken:r,accessToken:n,expirationTime:i}=t,s=new Ke;return r&&(we("string"==typeof r,"internal-error",{appName:e}),s.refreshToken=r),n&&(we("string"==typeof n,"internal-error",{appName:e}),s.accessToken=n),i&&(we("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ke,this.toJSON())}_performRefresh(){return Te("not implemented")}}function Xe(e,t){we("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Ye{constructor(e){var{uid:t,auth:r,stsTokenManager:n}=e,i=fe(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new qe(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Ge(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await We(this,this.stsTokenManager.getToken(this.auth,e));return we(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const r=y(e),n=await r.getIdToken(t),i=ze(n);we(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:n,authTime:Ve(He(i.auth_time)),issuedAtTime:Ve(He(i.iat)),expirationTime:Ve(He(i.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=y(e);await Je(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(we(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new Ye(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){we(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Je(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await We(this,async function(e,t){return Ue(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r,n,i,s,o,a,c,l;const u=null!==(r=t.displayName)&&void 0!==r?r:void 0,d=null!==(n=t.email)&&void 0!==n?n:void 0,h=null!==(i=t.phoneNumber)&&void 0!==i?i:void 0,p=null!==(s=t.photoURL)&&void 0!==s?s:void 0,f=null!==(o=t.tenantId)&&void 0!==o?o:void 0,m=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,g=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(l=t.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:b,isAnonymous:_,providerData:I,stsTokenManager:w}=t;we(v&&w,e,"internal-error");const T=Ke.fromJSON(this.name,w);we("string"==typeof v,e,"internal-error"),Xe(u,e.name),Xe(d,e.name),we("boolean"==typeof b,e,"internal-error"),we("boolean"==typeof _,e,"internal-error"),Xe(h,e.name),Xe(p,e.name),Xe(f,e.name),Xe(m,e.name),Xe(g,e.name),Xe(y,e.name);const k=new Ye({uid:v,auth:e,email:d,emailVerified:b,displayName:u,isAnonymous:_,photoURL:p,phoneNumber:h,tenantId:f,stsTokenManager:T,createdAt:g,lastLoginAt:y});return I&&Array.isArray(I)&&(k.providerData=I.map((e=>Object.assign({},e)))),m&&(k._redirectEventId=m),k}static async _fromIdTokenResponse(e,t,r=!1){const n=new Ke;n.updateFromServerResponse(t);const i=new Ye({uid:t.localId,auth:e,stsTokenManager:n,isAnonymous:r});return await Je(i),i}}class Qe{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Qe.type="NONE";const Ze=Qe;function et(e,t,r){return`firebase:${e}:${t}:${r}`}class tt{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:n,name:i}=this.auth;this.fullUserKey=et(this.userKey,n.apiKey,i),this.fullPersistenceKey=et("persistence",n.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?Ye._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new tt(Se(Ze),e,r);const n=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let i=n[0]||Se(Ze);const s=et(r,e.config.apiKey,e.name);let o=null;for(const r of t)try{const t=await r._get(s);if(t){const n=Ye._fromJSON(e,t);r!==i&&(o=n),i=r;break}}catch(e){}const a=n.filter((e=>e._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(t.map((async e=>{if(e!==i)try{await e._remove(s)}catch(e){}}))),new tt(i,e,r)):new tt(i,e,r)}}function rt(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ot(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(nt(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ct(t))return"Blackberry";if(lt(t))return"Webos";if(it(t))return"Safari";if((t.includes("chrome/")||st(t))&&!t.includes("edge/"))return"Chrome";if(at(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(t);if(2===(null==r?void 0:r.length))return r[1]}return"Other"}function nt(e=o()){return/firefox\//i.test(e)}function it(e=o()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function st(e=o()){return/crios\//i.test(e)}function ot(e=o()){return/iemobile/i.test(e)}function at(e=o()){return/android/i.test(e)}function ct(e=o()){return/blackberry/i.test(e)}function lt(e=o()){return/webos/i.test(e)}function ut(e=o()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function dt(e=o()){return ut(e)||at(e)||lt(e)||ct(e)||/windows phone/i.test(e)||ot(e)}function ht(e,t=[]){let r;switch(e){case"Browser":r=rt(o());break;case"Worker":r=`${rt(o())}-${e}`;break;default:r=e}return`${r}/JsCore/9.9.2/${t.length?t.join(","):"FirebaseCore-web"}`}class pt{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=t=>new Promise(((r,n)=>{try{r(e(t))}catch(e){n(e)}}));r.onAbort=t,this.queue.push(r);const n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){var t;if(this.auth.currentUser===e)return;const r=[];try{for(const t of this.queue)await t(e),t.onAbort&&r.push(t.onAbort)}catch(e){r.reverse();for(const e of r)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===(t=e)||void 0===t?void 0:t.message})}}}class ft{constructor(e,t,r){this.app=e,this.heartbeatServiceProvider=t,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new gt(this),this.idTokenSubscription=new gt(this),this.beforeStateQueue=new pt(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ge,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Se(t)),this._initializationPromise=this.queue((async()=>{var r,n;if(!this._deleted&&(this.persistenceManager=await tt.create(this,e),!this._deleted)){if(null===(r=this._popupRedirectResolver)||void 0===r?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(n=this.currentUser)||void 0===n?void 0:n.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const r=await this.assertedPersistence.getCurrentUser();let n=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const r=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==n?void 0:n._redirectEventId,o=await this.tryRedirectSignIn(e);r&&r!==s||!(null==o?void 0:o.user)||(n=o.user,i=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=r,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(e)))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return we(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){var t;try{await Je(e)}catch(e){if("auth/network-request-failed"!==(null===(t=e)||void 0===t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?y(e):null;return t&&we(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&we(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Se(e))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new c("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Se(e)||this._popupRedirectResolver;we(t,this,"argument-error"),this.redirectPersistenceManager=await tt.create(this,[Se(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(r=this.redirectUser)||void 0===r?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,n){if(this._deleted)return()=>{};const i="function"==typeof t?t:t.next.bind(t),s=this._isInitialized?Promise.resolve():this._initializationPromise;return we(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof t?e.addObserver(t,r,n):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&(this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh()),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return we(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ht(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());return r&&(t["X-Firebase-Client"]=r),t}}function mt(e){return y(e)}class gt{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const r=new m(e,void 0);return r.subscribe.bind(r)}((e=>this.observer=e))}get next(){return we(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}class yt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Te("not implemented")}_getIdTokenResponse(e){return Te("not implemented")}_linkToIdToken(e,t){return Te("not implemented")}_getReauthenticationResolver(e){return Te("not implemented")}}class vt extends yt{constructor(e,t,r,n=null){super("password",r),this._email=e,this._password=t,this._tenantId=n}static _fromEmailAndPassword(e,t){return new vt(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new vt(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithPassword",Me(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithEmailLink",Me(e,t))}(e,{email:this._email,oobCode:this._password});default:be(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return async function(e,t){return Ue(e,"POST","/v1/accounts:update",t)}(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithEmailLink",Me(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:be(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function bt(e,t){return $e(e,"POST","/v1/accounts:signInWithIdp",Me(e,t))}class _t extends yt{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new _t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):be("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:r,signInMethod:n}=t,i=fe(t,["providerId","signInMethod"]);if(!r||!n)return null;const s=new _t(r,n);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(e){return bt(e,this.buildRequest())}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,bt(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,bt(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=h(t)}return e}}const It={USER_NOT_FOUND:"user-not-found"};class wt extends yt{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new wt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new wt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithPhoneNumber",Me(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const r=await $e(e,"POST","/v1/accounts:signInWithPhoneNumber",Me(e,t));if(r.temporaryProof)throw Be(e,"account-exists-with-different-credential",r);return r}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithPhoneNumber",Me(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),It)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:n}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:n}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}=e;return r||t||n||i?new wt({verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}):null}}class Tt{constructor(e){var t,r,n,i,s,o;const a=p(f(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,l=null!==(r=a.oobCode)&&void 0!==r?r:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(n=a.mode)&&void 0!==n?n:null);we(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=p(f(e)).link,r=t?p(f(t)).deep_link_id:null,n=p(f(e)).deep_link_id;return(n?p(f(n)).link:null)||n||r||t||e}(e);try{return new Tt(t)}catch(e){return null}}}class kt{constructor(){this.providerId=kt.PROVIDER_ID}static credential(e,t){return vt._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Tt.parseLink(t);return we(r,"argument-error"),vt._fromEmailAndCode(e,r.code,r.tenantId)}}kt.PROVIDER_ID="password",kt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",kt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Et{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class St extends Et{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Ot extends St{constructor(){super("facebook.com")}static credential(e){return _t._fromParams({providerId:Ot.PROVIDER_ID,signInMethod:Ot.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ot.credentialFromTaggedObject(e)}static credentialFromError(e){return Ot.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Ot.credential(e.oauthAccessToken)}catch(e){return null}}}Ot.FACEBOOK_SIGN_IN_METHOD="facebook.com",Ot.PROVIDER_ID="facebook.com";class Ct extends St{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return _t._fromParams({providerId:Ct.PROVIDER_ID,signInMethod:Ct.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Ct.credentialFromTaggedObject(e)}static credentialFromError(e){return Ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return Ct.credential(t,r)}catch(e){return null}}}Ct.GOOGLE_SIGN_IN_METHOD="google.com",Ct.PROVIDER_ID="google.com";class At extends St{constructor(){super("github.com")}static credential(e){return _t._fromParams({providerId:At.PROVIDER_ID,signInMethod:At.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return At.credentialFromTaggedObject(e)}static credentialFromError(e){return At.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return At.credential(e.oauthAccessToken)}catch(e){return null}}}At.GITHUB_SIGN_IN_METHOD="github.com",At.PROVIDER_ID="github.com";class Rt extends St{constructor(){super("twitter.com")}static credential(e,t){return _t._fromParams({providerId:Rt.PROVIDER_ID,signInMethod:Rt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Rt.credentialFromTaggedObject(e)}static credentialFromError(e){return Rt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return Rt.credential(t,r)}catch(e){return null}}}Rt.TWITTER_SIGN_IN_METHOD="twitter.com",Rt.PROVIDER_ID="twitter.com";class Pt{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,n=!1){const i=await Ye._fromIdTokenResponse(e,r,n),s=Nt(r);return new Pt({user:i,providerId:s,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const n=Nt(r);return new Pt({user:e,providerId:n,_tokenResponse:r,operationType:t})}}function Nt(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class Dt extends a{constructor(e,t,r,n){var i;super(t.code,t.message),this.operationType=r,this.user=n,Object.setPrototypeOf(this,Dt.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,n){return new Dt(e,t,r,n)}}function Lt(e,t,r,n){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch((r=>{if("auth/multi-factor-auth-required"===r.code)throw Dt._fromErrorAndOperation(e,r,t,n);throw r}))}async function Mt(e,t,r=!1){const n="signIn",i=await Lt(e,n,t),s=await Pt._fromIdTokenResponse(e,n,i);return r||await e._updateCurrentUser(s.user),s}async function Ut(e,t,r){const n=y(e),i={requestType:"PASSWORD_RESET",email:t};r&&function(e,t,r){var n;we((null===(n=r.url)||void 0===n?void 0:n.length)>0,e,"invalid-continue-uri"),we(void 0===r.dynamicLinkDomain||r.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=r.url,t.dynamicLinkDomain=r.dynamicLinkDomain,t.canHandleCodeInApp=r.handleCodeInApp,r.iOS&&(we(r.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=r.iOS.bundleId),r.android&&(we(r.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=r.android.installApp,t.androidMinimumVersionCode=r.android.minimumVersion,t.androidPackageName=r.android.packageName)}(n,i,r),await async function(e,t){return async function(e,t){return Ue(e,"POST","/v1/accounts:sendOobCode",Me(e,t))}(e,t)}(n,i)}new WeakMap;const jt="__sak";class $t{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(jt,"1"),this.storage.removeItem(jt),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class xt extends $t{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=o();return it(e)||ut(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=dt(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),n=this.localCache[t];r!==n&&e(t,n,r)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys(((e,t,r)=>{this.notifyListeners(e,r)}));const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const n=this.storage.getItem(r);if(e.newValue!==n)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}const n=()=>{const e=this.storage.getItem(r);(t||this.localCache[r]!==e)&&this.notifyListeners(r,e)},i=this.storage.getItem(r);!function(){const e=o();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()||10!==document.documentMode||i===e.newValue||e.newValue===e.oldValue?n():setTimeout(n,10)}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}xt.type="LOCAL";const Ft=xt;class Bt extends $t{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Bt.type="SESSION";const Vt=Bt;class Ht{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const r=new Ht(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:n,data:i}=t.data,s=this.handlersMap[n];if(!(null==s?void 0:s.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:n});const o=Array.from(s).map((async e=>e(t.origin,i))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})))}(o);t.ports[0].postMessage({status:"done",eventId:r,eventType:n,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function zt(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}Ht.receivers=[];class Wt{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const n="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!n)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=zt("",20);n.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),r);s={messageChannel:n,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(l),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),o(t.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),n.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[n.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}function qt(){return window}function Gt(){return void 0!==qt().WorkerGlobalScope&&"function"==typeof qt().importScripts}const Jt="firebaseLocalStorageDb",Kt="firebaseLocalStorage",Xt="fbase_key";class Yt{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Qt(e,t){return e.transaction([Kt],t?"readwrite":"readonly").objectStore(Kt)}function Zt(){const e=indexedDB.open(Jt,1);return new Promise(((t,r)=>{e.addEventListener("error",(()=>{r(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(Kt,{keyPath:Xt})}catch(e){r(e)}})),e.addEventListener("success",(async()=>{const r=e.result;r.objectStoreNames.contains(Kt)?t(r):(r.close(),await function(){const e=indexedDB.deleteDatabase(Jt);return new Yt(e).toPromise()}(),t(await Zt()))}))}))}async function er(e,t,r){const n=Qt(e,!0).put({[Xt]:t,value:r});return new Yt(n).toPromise()}function tr(e,t){const r=Qt(e,!0).delete(t);return new Yt(r).toPromise()}class rr{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Zt()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Gt()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ht._getInstance(Gt()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&(null===(e=r[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=r[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Zt();return await er(e,jt,"1"),await tr(e,jt),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((r=>er(r,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const r=Qt(e,!1).get(t),n=await new Yt(r).toPromise();return void 0===n?null:n.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>tr(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Qt(e,!1).getAll();return new Yt(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],r=new Set;for(const{fbase_key:n,value:i}of e)r.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(i)&&(this.notifyListeners(n,i),t.push(n));for(const e of Object.keys(this.localCache))this.localCache[e]&&!r.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const e of Array.from(r))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}rr.type="LOCAL";const nr=rr;function ir(e){return`__${e}${Math.floor(1e6*Math.random())}`}ir("rcb"),new Re(3e4,6e4);class sr{constructor(e){this.providerId=sr.PROVIDER_ID,this.auth=mt(e)}verifyPhoneNumber(e,t){return async function(e,t,r){var n;const i=await r.verify();try{let s;if(we("string"==typeof i,e,"argument-error"),we("recaptcha"===r.type,e,"argument-error"),s="string"==typeof t?{phoneNumber:t}:t,"session"in s){const t=s.session;if("phoneNumber"in s){we("enroll"===t.type,e,"internal-error");const r=await function(e,t){return Ue(e,"POST","/v2/accounts/mfaEnrollment:start",Me(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}});return r.phoneSessionInfo.sessionInfo}{we("signin"===t.type,e,"internal-error");const r=(null===(n=s.multiFactorHint)||void 0===n?void 0:n.uid)||s.multiFactorUid;we(r,e,"missing-multi-factor-info");const o=await function(e,t){return Ue(e,"POST","/v2/accounts/mfaSignIn:start",Me(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:r,phoneSignInInfo:{recaptchaToken:i}});return o.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return Ue(e,"POST","/v1/accounts:sendVerificationCode",Me(e,t))}(e,{phoneNumber:s.phoneNumber,recaptchaToken:i});return t}}finally{r._reset()}}(this.auth,e,y(t))}static credential(e,t){return wt._fromVerification(e,t)}static credentialFromResult(e){const t=e;return sr.credentialFromTaggedObject(t)}static credentialFromError(e){return sr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:r}=e;return t&&r?wt._fromTokenResponse(t,r):null}}sr.PROVIDER_ID="phone",sr.PHONE_SIGN_IN_METHOD="phone";class or extends yt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return bt(e,this._buildIdpRequest())}_linkToIdToken(e,t){return bt(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return bt(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function ar(e){return Mt(e.auth,new or(e),e.bypassAuthState)}function cr(e){const{auth:t,user:r}=e;return we(r,t,"internal-error"),async function(e,t,r=!1){var n;const{auth:i}=e,s="reauthenticate";try{const n=await We(e,Lt(i,s,t,e),r);we(n.idToken,i,"internal-error");const o=ze(n.idToken);we(o,i,"internal-error");const{sub:a}=o;return we(e.uid===a,i,"user-mismatch"),Pt._forOperation(e,s,n)}catch(e){throw"auth/user-not-found"===(null===(n=e)||void 0===n?void 0:n.code)&&be(i,"user-mismatch"),e}}(r,new or(e),e.bypassAuthState)}async function lr(e){const{auth:t,user:r}=e;return we(r,t,"internal-error"),async function(e,t,r=!1){const n=await We(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return Pt._forOperation(e,"link",n)}(r,new or(e),e.bypassAuthState)}class ur{constructor(e,t,r,n,i=!1){this.auth=e,this.resolver=r,this.user=n,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:n,tenantId:i,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ar;case"linkViaPopup":case"linkViaRedirect":return lr;case"reauthViaPopup":case"reauthViaRedirect":return cr;default:be(this.auth,"internal-error")}}resolve(e){ke(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ke(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const dr=new Re(2e3,1e4);class hr extends ur{constructor(e,t,r,n,i){super(e,t,n,i),this.provider=r,this.authWindow=null,this.pollId=null,hr.currentPopupAction&&hr.currentPopupAction.cancel(),hr.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return we(e,this.auth,"internal-error"),e}async onExecution(){ke(1===this.filter.length,"Popup operations only handle one event");const e=zt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(_e(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(_e(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,hr.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;(null===(r=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===r?void 0:r.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(_e(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(e,dr.get())};e()}}hr.currentPopupAction=null;const pr=new Map;class fr extends ur{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=pr.get(this.auth._key());if(!e){try{const t=await async function(e,t){const r=function(e){return et("pendingRedirect",e.config.apiKey,e.name)}(t),n=function(e){return Se(e._redirectPersistence)}(e);if(!await n._isAvailable())return!1;const i="true"===await n._get(r);return await n._remove(r),i}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}pr.set(this.auth._key(),e)}return this.bypassAuthState||pr.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function mr(e,t){pr.set(e._key(),t)}async function gr(e,t,r=!1){const n=mt(e),i=function(e,t){return t?Se(t):(we(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(n,t),s=new fr(n,i,r),o=await s.execute();return o&&!r&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,t)),o}class yr{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return br(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!br(e)){const n=(null===(r=e.error.code)||void 0===r?void 0:r.split("auth/")[1])||"internal-error";t.onError(_e(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(vr(e))}saveEventToCache(e){this.cachedEventUids.add(vr(e)),this.lastProcessedEventTime=Date.now()}}function vr(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function br({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}const _r=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ir=/^https?/;function wr(e){const t=Oe(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return""===i.hostname&&""===n?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&i.hostname===n}if(!Ir.test(r))return!1;if(_r.test(e))return n===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(n)}const Tr=new Re(3e4,6e4);function kr(){const e=qt().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}let Er=null;function Sr(e){return Er=Er||function(e){return new Promise(((t,r)=>{var n,i,s,o;function a(){kr(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{kr(),r(_e(e,"network-request-failed"))},timeout:Tr.get()})}if(null===(i=null===(n=qt().gapi)||void 0===n?void 0:n.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(s=qt().gapi)||void 0===s?void 0:s.load)){const t=ir("iframefcb");return qt()[t]=()=>{gapi.load?a():r(_e(e,"network-request-failed"))},(o=`https://apis.google.com/js/api.js?onload=${t}`,new Promise(((e,t)=>{const r=document.createElement("script");var n,i;r.setAttribute("src",o),r.onload=e,r.onerror=e=>{const r=_e("internal-error");r.customData=e,t(r)},r.type="text/javascript",r.charset="UTF-8",(null!==(i=null===(n=document.getElementsByTagName("head"))||void 0===n?void 0:n[0])&&void 0!==i?i:document).appendChild(r)}))).catch((e=>r(e)))}a()}})).catch((e=>{throw Er=null,e}))}(e),Er}const Or=new Re(5e3,15e3),Cr={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ar=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Rr(e){const t=e.config;we(t.authDomain,e,"auth-domain-config-required");const r=t.emulator?Pe(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,n={apiKey:t.apiKey,appName:e.name,v:ne},i=Ar.get(e.config.apiHost);i&&(n.eid=i);const s=e._getFrameworks();return s.length&&(n.fw=s.join(",")),`${r}?${h(n).slice(1)}`}const Pr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Nr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Dr(e,t,r,n,i,s){we(e.config.authDomain,e,"auth-domain-config-required"),we(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:ne,eventId:i};if(t instanceof Et){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(s||{}))o[e]=t}if(t instanceof St){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];return`${function({config:e}){return e.emulator?Pe(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${h(a).slice(1)}`}const Lr="webStorageSupport",Mr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Vt,this._completeRedirectFn=gr,this._overrideRedirectResult=mr}async _openPopup(e,t,r,n){var i;return ke(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()"),function(e,t,r,n=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-n)/2,0).toString();let c="";const l=Object.assign(Object.assign({},Pr),{width:n.toString(),height:i.toString(),top:s,left:a}),u=o().toLowerCase();r&&(c=st(u)?"_blank":r),nt(u)&&(t=t||"http://localhost",l.scrollbars="yes");const d=Object.entries(l).reduce(((e,[t,r])=>`${e}${t}=${r},`),"");if(function(e=o()){var t;return ut(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(u)&&"_self"!==c)return function(e,t){const r=document.createElement("a");r.href=e,r.target=t;const n=document.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),r.dispatchEvent(n)}(t||"",c),new Nr(null);const h=window.open(t||"",c,d);we(h,e,"popup-blocked");try{h.focus()}catch(e){}return new Nr(h)}(e,Dr(e,t,r,Oe(),n),zt())}async _openRedirect(e,t,r,n){var i;return await this._originValidation(e),i=Dr(e,t,r,Oe(),n),qt().location.href=i,new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:r}=this.eventManagers[t];return e?Promise.resolve(e):(ke(r,"If manager is not set, promise should be"),r)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch((()=>{delete this.eventManagers[t]})),r}async initAndGetManager(e){const t=await async function(e){const t=await Sr(e),r=qt().gapi;return we(r,e,"internal-error"),t.open({where:document.body,url:Rr(e),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Cr,dontclear:!0},(t=>new Promise((async(r,n)=>{await t.restyle({setHideOnLeave:!1});const i=_e(e,"network-request-failed"),s=qt().setTimeout((()=>{n(i)}),Or.get());function o(){qt().clearTimeout(s),r(t)}t.ping(o).then(o,(()=>{n(i)}))}))))}(e),r=new yr(e);return t.register("authEvent",(t=>(we(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:r.onEvent(t.authEvent)?"ACK":"ERROR"})),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Lr,{type:Lr},(r=>{var n;const i=null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.webStorageSupport;void 0!==i&&t(!!i),be(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=async function(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return Ue(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(wr(e))return}catch(e){}be(e,"unauthorized-domain")}(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return dt()||it()||ut()}};var Ur,jr="@firebase/auth",$r="0.20.5";class xr{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{var r;e((null===(r=t)||void 0===r?void 0:r.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){we(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}Ur="Browser",Z(new v("auth",((e,{options:t})=>{const r=e.getProvider("app").getImmediate(),n=e.getProvider("heartbeat"),{apiKey:i,authDomain:s}=r.options;return((e,r)=>{we(i&&!i.includes(":"),"invalid-api-key",{appName:e.name}),we(!(null==s?void 0:s.includes(":")),"argument-error",{appName:e.name});const n={apiKey:i,authDomain:s,clientPlatform:Ur,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ht(Ur)},o=new ft(e,r,n);return function(e,t){const r=(null==t?void 0:t.persistence)||[],n=(Array.isArray(r)?r:[r]).map(Se);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(n,null==t?void 0:t.popupRedirectResolver)}(o,t),o})(r,n)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,r)=>{e.getProvider("auth-internal").initialize()}))),Z(new v("auth-internal",(e=>{return t=mt(e.getProvider("auth").getImmediate()),new xr(t);var t}),"PRIVATE").setInstantiationMode("EXPLICIT")),ie(jr,$r,void 0),ie(jr,$r,"esm2017");var Fr=r(560),Br=r.n(Fr);const Vr=(e,t)=>!!e.properties&&!!e.properties[t]&&!!e.properties[t].$ref,Hr=(e,t)=>!!e.properties&&!!e.properties[t]&&Array.isArray(e.properties[t].anyOf)&&!!e.properties[t].anyOf[0]?.$ref&&"null"===e.properties[t].anyOf[1]?.type,zr=(e,t)=>e.properties&&e.properties[t]&&"array"===e.properties[t].type&&!!e.properties[t].items.$ref,Wr=(e,t)=>{const r=Array.isArray(t.inputProps);return Object.keys(e).reduce(((n,i)=>r&&!t.inputProps.includes(i)||Hr(t,i)&&null===e[i]?n:{...n,[i]:e[i]}),{})},qr=(e,t,r,n={},i={})=>{const s=n.primaryKey||"id",o=(e=>{const t=e.properties||{},r=e.inputProps||Object.keys(t),n=(e,r)=>{const n=t[e]||{},i=Array.isArray(n.type)?n.type[0]:n.type,s=!Array.isArray(n.type)||!n.type.includes("null");if(n.enum){if(!s&&!r)return;if(!n.enum.includes(r))return`${r} is not one of: ${n.enum.join(",")}`}switch(i){case"string":if(s&&!r)return"Field is required";break;case"integer":const e=parseInt(r,10);if(s&&Number.isNaN(e))return"Invalid number format"}};return{validate:e=>r.reduce(((t,r)=>{const i=n(r,e[r]);return i?{...t,[r]:i}:t}),{}),validateAttr:n}})(n),a=(e=>{const t=(r=e,[...r].reduce(((e,t)=>t===t.toUpperCase()?`${e}-${t.toLowerCase()}`:`${e}${t}`),""));var r;return(e,r)=>`/${t}${e?`/${encodeURIComponent(e)}`:""}${((e={})=>Object.keys(e).length?`?q=${JSON.stringify(e)}`:"")(r)}`})(r),c=(...r)=>((e,t)=>async(r,n={})=>{const i=t?await t.getIdToken():null,s=await fetch(`${e}${r}`,{mode:"cors",...n,headers:{...i&&{authorization:`Bearer ${i}`},...n.body&&{"content-type":"application/json"},...n.headers},...n.body&&{body:JSON.stringify(n.body)}}),o=await s.json();if(s.status>202)throw Object.assign(new Error(o?.message||`HTTP Error ${s.status}`),{status:s.status,code:o?.code,body:o});return o})(e,t.authUser)(...r),l=({data:e,...t})=>c(a(null,t),{method:"POST",body:Wr(e,n)}),u=({data:e,...t})=>{const{where:r,...i}=t;return c(a(r[s],i),{method:"PUT",body:Wr(e,n)})},d=e=>{if(!e)return e;const t=Object.keys(e).reduce(((t,r)=>{const s=n.properties[r]||{},{type:o,format:a,items:c}=s;if(c&&zr(n,r)){const n=c.$ref.split("/").pop().toLowerCase();return{...t,[r]:"function"==typeof i[n]?.parse?e[r].map((e=>i[n].parse(e))):e[r]}}const l=Vr(n,r)?s.$ref:Hr(n,r)?s.anyOf[0]?.$ref:null;if(l){const n=l.split("/").pop().toLowerCase();return{...t,[r]:i[n].parse(e[r])}}return{...t,[r]:"date-time"===a&&e[r]?new Date(e[r]):e[r]}}),{});return"function"==typeof n.parse?n.parse(t):t},h=Object.keys(n.properties||{}).reduce(((e,t)=>Vr(n,t)?Object.assign(e,{all:e.all.concat(t),oneToOne:e.oneToOne.concat(t),requiredOneToOne:e.requiredOneToOne.concat(t)}):Hr(n,t)?Object.assign(e,{all:e.all.concat(t),oneToOne:e.oneToOne.concat(t),optionalOneToOne:e.optionalOneToOne.concat(t)}):zr(n,t)?Object.assign(e,{all:e.all.concat(t),oneToMany:e.oneToMany.concat(t)}):e),{all:[],oneToOne:[],requiredOneToOne:[],optionalOneToOne:[],oneToMany:[]});return{get schema(){return{...n,primaryKey:s}},get relations(){return h},parse:d,validateAttr:o.validateAttr,validate:o.validate,findMany:e=>c(a(null,e)).then((e=>e.map(d))),findById:(e,t)=>c(a(e,t)).then(d),create:l,update:u,upsert:e=>e.where[s]?u({where:e.where,data:e.update}):l({data:e.create}),delete:e=>c(a(e),{method:"DELETE"}),stats:()=>c(a("_stats"))}},Gr=(e,t,r)=>Object.keys(r.properties).reduce(((n,i)=>{const s=r.properties[i].$ref.split("/").pop();return Object.assign(n,{[i]:qr(e,t,r.definitions[s].plural||`${i}s`,r.definitions[s],n)})}),{}),Jr=(e,t)=>Object.keys(e.definitions).reduce(((r,n)=>({...r,[n]:t[n]?{...e.definitions[n],...t[n],properties:Object.keys(e.definitions[n].properties).reduce(((r,i)=>({...r,[i]:{...e.definitions[n].properties[i],...(t[n].properties||{})[i]}})),t[n].properties||{})}:e.definitions[n]})),{}),Kr=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Country":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"contracts":{"type":"array","items":{"$ref":"#/definitions/Contract"}}}},"User":{"type":"object","properties":{"uid":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":["string","null"]},"github":{"type":["string","null"]},"linkedin":{"type":["string","null"]},"bio":{"type":["string","null"]},"role":{"type":["string","null"],"enum":["staff","manager","finance","admin"]},"disabled":{"type":"boolean","default":false},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"signupCohort":{"anyOf":[{"$ref":"#/definitions/Cohort"},{"type":"null"}]},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}},"contractsAsCheckPilot":{"type":"array","items":{"$ref":"#/definitions/Contract"}},"contracts":{"type":"array","items":{"$ref":"#/definitions/Contract"}},"dropouts":{"type":"array","items":{"$ref":"#/definitions/Dropout"}},"gigs":{"type":"array","items":{"$ref":"#/definitions/Gig"}},"messages":{"type":"array","items":{"$ref":"#/definitions/Message"}},"students":{"type":"array","items":{"$ref":"#/definitions/Student"}}}},"Track":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"programs":{"type":"array","items":{"$ref":"#/definitions/Program"}}}},"Program":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":["string","null"]},"track":{"$ref":"#/definitions/Track"},"cohorts":{"type":"array","items":{"$ref":"#/definitions/Cohort"}},"stages":{"type":"array","items":{"$ref":"#/definitions/Stage"}}}},"Stage":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"order":{"type":"integer"},"program":{"$ref":"#/definitions/Program"},"cohorts":{"type":"array","items":{"$ref":"#/definitions/Cohort"}}}},"Cohort":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"name":{"type":"string"},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"legacySlug":{"type":"string"},"vacancies":{"type":["integer","null"]},"placementDuration":{"type":["integer","null"]},"placementStart":{"type":["string","null"],"format":"date-time"},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"program":{"$ref":"#/definitions/Program"},"stage":{"$ref":"#/definitions/Stage"},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}},"links":{"type":"array","items":{"$ref":"#/definitions/CohortLink"}},"dropouts":{"type":"array","items":{"$ref":"#/definitions/Dropout"}},"gigs":{"type":"array","items":{"$ref":"#/definitions/Gig"}},"students":{"type":"array","items":{"$ref":"#/definitions/Student"}},"signupUsers":{"type":"array","items":{"$ref":"#/definitions/User"}}}},"Student":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"legacyStudentCode":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"}}},"CohortLink":{"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string"},"visibility":{"type":"string","enum":["public","members","staff","team","admin"]},"cohort":{"$ref":"#/definitions/Cohort"}}},"Dropout":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"date":{"type":"string","format":"date-time"},"reasonDetail":{"type":["string","null"]},"notes":{"type":["string","null"]},"staffSad":{"type":"boolean"},"covidRelated":{"type":["boolean","null"]},"reason":{"type":"string","enum":["dropout","noShow","invitedToLeave","changeCohort"]},"completedProjects":{"type":"integer"},"lastProject":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"}}},"Application":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"}}},"Contract":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"isEmployment":{"type":"boolean"},"feeAmount":{"type":"integer"},"hoursPerWeek":{"type":"integer"},"start":{"type":"string","format":"date-time"},"end":{"type":["string","null"],"format":"date-time"},"isTrial":{"type":"boolean","default":false},"source":{"type":["string","null"],"enum":["graduate","referral","jazzhr","web","linkedin","other"]},"checkPilot":{"anyOf":[{"$ref":"#/definitions/User"},{"type":"null"}]},"country":{"$ref":"#/definitions/Country"},"user":{"$ref":"#/definitions/User"},"gigs":{"type":"array","items":{"$ref":"#/definitions/Gig"}}}},"Gig":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"role":{"type":"string","enum":["bm","pdc","js","ux"]},"hoursPerWeek":{"type":"integer"},"start":{"type":"string","format":"date-time"},"end":{"type":["string","null"],"format":"date-time"},"cohort":{"$ref":"#/definitions/Cohort"},"contract":{"$ref":"#/definitions/Contract"},"user":{"$ref":"#/definitions/User"}}},"Message":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"key":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"transport":{"type":"string","enum":["mandrill"]},"status":{"type":"string","default":"PENDING","enum":["PENDING","QUEUED","ERROR","SENT"]},"data":{"type":["number","string","boolean","object","array","null"]},"taskInfo":{"type":["number","string","boolean","object","array","null"]},"user":{"anyOf":[{"$ref":"#/definitions/User"},{"type":"null"}]},"logs":{"type":"array","items":{"$ref":"#/definitions/MessageLog"}}}},"MessageLog":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"statusText":{"type":["string","null"]},"message":{"$ref":"#/definitions/Message"}}}},"type":"object","properties":{"country":{"$ref":"#/definitions/Country"},"user":{"$ref":"#/definitions/User"},"track":{"$ref":"#/definitions/Track"},"program":{"$ref":"#/definitions/Program"},"stage":{"$ref":"#/definitions/Stage"},"cohort":{"$ref":"#/definitions/Cohort"},"student":{"$ref":"#/definitions/Student"},"cohortLink":{"$ref":"#/definitions/CohortLink"},"dropout":{"$ref":"#/definitions/Dropout"},"application":{"$ref":"#/definitions/Application"},"contract":{"$ref":"#/definitions/Contract"},"gig":{"$ref":"#/definitions/Gig"},"message":{"$ref":"#/definitions/Message"},"messageLog":{"$ref":"#/definitions/MessageLog"}}}'),Xr={Country:{primaryKey:"code",plural:"countries",searchProps:["code","name"]},User:{primaryKey:"uid",inputProps:["firstName","lastName","email","password","lang","github","linkedin","bio","role","signupCohort","disabled"],searchProps:["firstName","lastName","email"],getOptionLabel:({firstName:e,lastName:t,email:r})=>`${e} ${t} (${r})`,properties:{email:{inputType:"email"},bio:{inputType:"textarea"}},parse:e=>{const t=e.github?`https://github.com/${e.github}.png?size=`:`https://www.gravatar.com/avatar/${Br()(e.email)}?s=`;return{...e,fullName:`${e.firstName} ${e.lastName}`,avatar:e=>`${t}${e}`,isStaff:["staff","manager","finance","admin"].includes(e.role),isManager:["manager","finance","admin"].includes(e.role),isFinance:["finance","admin"].includes(e.role),isAdmin:"admin"===e.role}}},Track:{searchProps:["name"]},Program:{searchProps:["name"]},Stage:{searchProps:["name"]},Cohort:{inputProps:["program","stage","name","start","end","vacancies","placementStart","placementDuration"],searchProps:["name"],getOptionLabel:({id:e,name:t,stage:r})=>`${t}${r?` - ${r.name}`:""} (id: ${e})`,properties:{},parse:e=>{const t=Date.now(),r=e.start>t?"upcoming":e.end<t?"past":"active",n="upcoming"===r&&e.vacancies?e.vacancies:e._count?.students||e.students?.length||0;return{...e,status:r,size:n}}},Student:{inputProps:[],searchProps:[]},Dropout:{inputProps:["cohort","user","date","reason","reasonDetail","lastProject","completedProjects","notes","staffSad","covidRelated"],searchProps:["user.uid","user.firstName","user.lastName","user.email","cohort.name"]},Contract:{inputProps:["user","country","isEmployment","feeAmount","hoursPerWeek","start","end","isTrial","checkPilot","source"],searchProps:["user.firstName","user.lastName","user.email"],getOptionLabel:({id:e,user:t})=>`${t?.firstName} (id: ${e})`},Gig:{inputProps:["cohort","user","contract","role","hoursPerWeek","start","end"]},Application:{inputProps:["cohort","user"]}},Yr="https://raw.githubusercontent.com/Laboratoria/bootcamp",Qr=()=>fetch("https://api.github.com/repos/Laboratoria/bootcamp/releases/latest").then((e=>e.json())).then((({tag_name:e})=>e)),Zr=e=>t=>t.filter((t=>!(e.locale&&e.locale!==t.locale||e.track&&e.track!==t.track))),en=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Country":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"jobs":{"type":"array","items":{"$ref":"#/definitions/Job"}},"companies":{"type":"array","items":{"$ref":"#/definitions/Company"}}}},"Industry":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"name":{"type":"string"},"companies":{"type":"array","items":{"$ref":"#/definitions/Company"}}}},"CompanyCategoryRel":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"category":{"type":"string","enum":["Tech_Consultancy","Digital_Transformation","Agency","Startups","High_tech","Traditional_Consulting"]},"company":{"$ref":"#/definitions/Company"}}},"Company":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"name":{"type":"string"},"source":{"type":"string"},"sourceId":{"type":"string"},"size":{"type":["string","null"],"enum":["A_2_10","B_11_50","C_51_200","D_201_500","E_501_1000","F_1001_5000","G_5001_10000","H_10001_plus"]},"data":{"type":["number","string","boolean","object","array","null"]},"web":{"type":["string","null"]},"twitter":{"type":["string","null"]},"github":{"type":["string","null"]},"facebook":{"type":["string","null"]},"country":{"anyOf":[{"$ref":"#/definitions/Country"},{"type":"null"}]},"industry":{"anyOf":[{"$ref":"#/definitions/Industry"},{"type":"null"}]},"jobs":{"type":"array","items":{"$ref":"#/definitions/Job"}},"categories":{"type":"array","items":{"$ref":"#/definitions/CompanyCategoryRel"}}}},"Job":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"title":{"type":"string"},"publishedAt":{"type":"string","format":"date-time"},"publicUrl":{"type":["string","null"]},"modality":{"type":"string"},"location":{"type":["string","null"]},"source":{"type":"string"},"sourceId":{"type":"string"},"data":{"type":["number","string","boolean","object","array","null"]},"description":{"type":["string","null"]},"descriptionHTML":{"type":["string","null"]},"functions":{"type":["string","null"]},"functionsHTML":{"type":["string","null"]},"seniority":{"type":["string","null"]},"remote":{"type":["boolean","null"]},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"maxSalary":{"type":["integer","null"]},"minSalary":{"type":["integer","null"]},"tags":{"type":"array","items":{"type":"string"}},"company":{"$ref":"#/definitions/Company"},"country":{"anyOf":[{"$ref":"#/definitions/Country"},{"type":"null"}]},"validityReviews":{"type":"array","items":{"$ref":"#/definitions/JobValidityReview"}},"applications":{"type":"array","items":{"$ref":"#/definitions/JobApplication"}}}},"JobValidityReview":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"isValid":{"type":"boolean"},"profileType":{"type":["string","null"],"enum":["design","front_end","angular","react","vue","back_end","full_stack","ux","other"]},"invalidReason":{"type":["string","null"],"enum":["unrelated","experience","qualifications","other"]},"comment":{"type":["string","null"]},"job":{"$ref":"#/definitions/Job"}}},"JobApplication":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"uid":{"type":"string"},"status":{"type":"string","default":"pending","enum":["pending","applied","interview","challenge","followup","hired","not_hired"]},"recommendedBy":{"type":["string","null"]},"job":{"$ref":"#/definitions/Job"}}}},"type":"object","properties":{"country":{"$ref":"#/definitions/Country"},"industry":{"$ref":"#/definitions/Industry"},"companyCategoryRel":{"$ref":"#/definitions/CompanyCategoryRel"},"company":{"$ref":"#/definitions/Company"},"job":{"$ref":"#/definitions/Job"},"jobValidityReview":{"$ref":"#/definitions/JobValidityReview"},"jobApplication":{"$ref":"#/definitions/JobApplication"}}}'),tn={Country:{plural:"countries"},Job:{},Company:{plural:"companies"}},rn=({firebaseApiKey:e="AIzaSyAXbaEbpq8NOfn0r8mIrcoHvoGRkJThwdc",firebaseProject:t="laboratoria-la",coreApiUrl:r="https://us-central1-outpost-272720.cloudfunctions.net/core-api",jobsApiUrl:n="https://us-central1-outpost-272720.cloudfunctions.net/jobs-api"}={})=>{const i=function(e,t={}){"object"!=typeof t&&(t={name:t});const r=Object.assign({name:"[DEFAULT]",automaticDataCollectionEnabled:!1},t),n=r.name;if("string"!=typeof n||!n)throw te.create("bad-app-name",{appName:String(n)});const i=X.get(n);if(i){if(u(e,i.options)&&u(r,i.config))return i;throw te.create("duplicate-app",{appName:n})}const s=new I(n);for(const e of Y.values())s.addComponent(e);const o=new re(e,r,s);return X.set(n,o),o}({apiKey:e,authDomain:`${t}.firebaseapp.com`,databaseURL:`https://${t}.firebaseio.com`,projectId:t}),s=function(e=function(e="[DEFAULT]"){const t=X.get(e);if(!t)throw te.create("no-app",{appName:e});return t}()){const t=ee(e,"auth");return t.isInitialized()?t.getImmediate():function(e,t){const r=ee(e,"auth");if(r.isInitialized()){const e=r.getImmediate();if(u(r.getOptions(),null!=t?t:{}))return e;be(e,"already-initialized")}return r.initialize({options:t})}(e,{popupRedirectResolver:Mr,persistence:[nr,Ft,Vt]})}(i),o={authUser:void 0,user:void 0},a=((e,t)=>Gr(e,t,{...Kr,definitions:Jr(Kr,Xr)}))(r,o),c=((e,t)=>Gr(e,t,{...en,definitions:Jr(en,tn)}))(n,o),l={onChange:e=>{return t=t=>{if(!t)return Object.assign(o,{authUser:null,user:null}),e(o);Object.assign(o,{authUser:t}),a.user.findById(t.uid).then((t=>{Object.assign(o,{user:t}),e(o)})).catch((t=>{console.error(t),Object.assign(o,{authUser:null,user:null}),e(o)}))},y(s).onAuthStateChanged(t,undefined,undefined);var t},signIn:(e,t)=>function(e,t,r){return async function(e,t){return Mt(mt(e),t)}(y(e),kt.credential(t,r))}(s,e,t),signOut:()=>y(s).signOut(),sendPasswordResetEmail:e=>Ut(s,e)};return{...c,projects:{findMany:(e={})=>(async e=>fetch(`${Yr}/${e||await Qr()}/dist/projects.json`).then((e=>e.json())))(e.tag).then(Zr(e)),findById:(e,t={})=>(async(e,t)=>fetch(`${Yr}/${t||await Qr()}/dist/projects/${e}.json`).then((e=>e.json())))(e,t.tag)},topics:{findMany:(e={})=>(async e=>fetch(`${Yr}/${e||await Qr()}/dist/topics.json`).then((e=>e.json())))(e.tag).then(Zr(e)),findById:(e,t={})=>(async(e,t)=>fetch(`${Yr}/${t||await Qr()}/dist/topics/${e}.json`).then((e=>e.json())))(e,t.tag)},learningObjectives:{findMany:(e={})=>(async e=>fetch(`${Yr}/${e||await Qr()}/dist/learning-objectives.json`).then((e=>e.json())))(e.tag)},...a,auth:l,firebaseApp:i}}})();var i=n.r;export{i as createApp};
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * @license
20
+ * Copyright 2019 Google LLC
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
34
+
35
+ /**
36
+ * @license
37
+ * Copyright 2020 Google LLC
38
+ *
39
+ * Licensed under the Apache License, Version 2.0 (the "License");
40
+ * you may not use this file except in compliance with the License.
41
+ * You may obtain a copy of the License at
42
+ *
43
+ * http://www.apache.org/licenses/LICENSE-2.0
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software
46
+ * distributed under the License is distributed on an "AS IS" BASIS,
47
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ * See the License for the specific language governing permissions and
49
+ * limitations under the License.
50
+ */
51
+
52
+ /**
53
+ * @license
54
+ * Copyright 2020 Google LLC.
55
+ *
56
+ * Licensed under the Apache License, Version 2.0 (the "License");
57
+ * you may not use this file except in compliance with the License.
58
+ * You may obtain a copy of the License at
59
+ *
60
+ * http://www.apache.org/licenses/LICENSE-2.0
61
+ *
62
+ * Unless required by applicable law or agreed to in writing, software
63
+ * distributed under the License is distributed on an "AS IS" BASIS,
64
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
+ * See the License for the specific language governing permissions and
66
+ * limitations under the License.
67
+ */
68
+
69
+ /**
70
+ * @license
71
+ * Copyright 2021 Google LLC
72
+ *
73
+ * Licensed under the Apache License, Version 2.0 (the "License");
74
+ * you may not use this file except in compliance with the License.
75
+ * You may obtain a copy of the License at
76
+ *
77
+ * http://www.apache.org/licenses/LICENSE-2.0
78
+ *
79
+ * Unless required by applicable law or agreed to in writing, software
80
+ * distributed under the License is distributed on an "AS IS" BASIS,
81
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82
+ * See the License for the specific language governing permissions and
83
+ * limitations under the License.
84
+ */
85
+
86
+ /**
87
+ * @license
88
+ * Copyright 2022 Google LLC
89
+ *
90
+ * Licensed under the Apache License, Version 2.0 (the "License");
91
+ * you may not use this file except in compliance with the License.
92
+ * You may obtain a copy of the License at
93
+ *
94
+ * http://www.apache.org/licenses/LICENSE-2.0
95
+ *
96
+ * Unless required by applicable law or agreed to in writing, software
97
+ * distributed under the License is distributed on an "AS IS" BASIS,
98
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
+ * See the License for the specific language governing permissions and
100
+ * limitations under the License.
101
+ */
@@ -0,0 +1,2 @@
1
+ /*! For license information please see laboratoria-sdk-umd.js.LICENSE.txt */
2
+ !function(e,t){"object"==typeof exports&&"object"==typeof module?module.exports=t():"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?exports.laboratoria=t():e.laboratoria=t()}(self,(()=>(()=>{var e={560:function(e,t,r){var n;!function(i){"use strict";function s(e,t){var r=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(r>>16)<<16|65535&r}function o(e,t,r,n,i,o){return s((a=s(s(t,e),s(n,o)))<<(c=i)|a>>>32-c,r);var a,c}function a(e,t,r,n,i,s,a){return o(t&r|~t&n,e,t,i,s,a)}function c(e,t,r,n,i,s,a){return o(t&n|r&~n,e,t,i,s,a)}function l(e,t,r,n,i,s,a){return o(t^r^n,e,t,i,s,a)}function u(e,t,r,n,i,s,a){return o(r^(t|~n),e,t,i,s,a)}function d(e,t){var r,n,i,o,d;e[t>>5]|=128<<t%32,e[14+(t+64>>>9<<4)]=t;var h=1732584193,p=-271733879,f=-1732584194,m=271733878;for(r=0;r<e.length;r+=16)n=h,i=p,o=f,d=m,h=a(h,p,f,m,e[r],7,-680876936),m=a(m,h,p,f,e[r+1],12,-389564586),f=a(f,m,h,p,e[r+2],17,606105819),p=a(p,f,m,h,e[r+3],22,-1044525330),h=a(h,p,f,m,e[r+4],7,-176418897),m=a(m,h,p,f,e[r+5],12,1200080426),f=a(f,m,h,p,e[r+6],17,-1473231341),p=a(p,f,m,h,e[r+7],22,-45705983),h=a(h,p,f,m,e[r+8],7,1770035416),m=a(m,h,p,f,e[r+9],12,-1958414417),f=a(f,m,h,p,e[r+10],17,-42063),p=a(p,f,m,h,e[r+11],22,-1990404162),h=a(h,p,f,m,e[r+12],7,1804603682),m=a(m,h,p,f,e[r+13],12,-40341101),f=a(f,m,h,p,e[r+14],17,-1502002290),h=c(h,p=a(p,f,m,h,e[r+15],22,1236535329),f,m,e[r+1],5,-165796510),m=c(m,h,p,f,e[r+6],9,-1069501632),f=c(f,m,h,p,e[r+11],14,643717713),p=c(p,f,m,h,e[r],20,-373897302),h=c(h,p,f,m,e[r+5],5,-701558691),m=c(m,h,p,f,e[r+10],9,38016083),f=c(f,m,h,p,e[r+15],14,-660478335),p=c(p,f,m,h,e[r+4],20,-405537848),h=c(h,p,f,m,e[r+9],5,568446438),m=c(m,h,p,f,e[r+14],9,-1019803690),f=c(f,m,h,p,e[r+3],14,-187363961),p=c(p,f,m,h,e[r+8],20,1163531501),h=c(h,p,f,m,e[r+13],5,-1444681467),m=c(m,h,p,f,e[r+2],9,-51403784),f=c(f,m,h,p,e[r+7],14,1735328473),h=l(h,p=c(p,f,m,h,e[r+12],20,-1926607734),f,m,e[r+5],4,-378558),m=l(m,h,p,f,e[r+8],11,-2022574463),f=l(f,m,h,p,e[r+11],16,1839030562),p=l(p,f,m,h,e[r+14],23,-35309556),h=l(h,p,f,m,e[r+1],4,-1530992060),m=l(m,h,p,f,e[r+4],11,1272893353),f=l(f,m,h,p,e[r+7],16,-155497632),p=l(p,f,m,h,e[r+10],23,-1094730640),h=l(h,p,f,m,e[r+13],4,681279174),m=l(m,h,p,f,e[r],11,-358537222),f=l(f,m,h,p,e[r+3],16,-722521979),p=l(p,f,m,h,e[r+6],23,76029189),h=l(h,p,f,m,e[r+9],4,-640364487),m=l(m,h,p,f,e[r+12],11,-421815835),f=l(f,m,h,p,e[r+15],16,530742520),h=u(h,p=l(p,f,m,h,e[r+2],23,-995338651),f,m,e[r],6,-198630844),m=u(m,h,p,f,e[r+7],10,1126891415),f=u(f,m,h,p,e[r+14],15,-1416354905),p=u(p,f,m,h,e[r+5],21,-57434055),h=u(h,p,f,m,e[r+12],6,1700485571),m=u(m,h,p,f,e[r+3],10,-1894986606),f=u(f,m,h,p,e[r+10],15,-1051523),p=u(p,f,m,h,e[r+1],21,-2054922799),h=u(h,p,f,m,e[r+8],6,1873313359),m=u(m,h,p,f,e[r+15],10,-30611744),f=u(f,m,h,p,e[r+6],15,-1560198380),p=u(p,f,m,h,e[r+13],21,1309151649),h=u(h,p,f,m,e[r+4],6,-145523070),m=u(m,h,p,f,e[r+11],10,-1120210379),f=u(f,m,h,p,e[r+2],15,718787259),p=u(p,f,m,h,e[r+9],21,-343485551),h=s(h,n),p=s(p,i),f=s(f,o),m=s(m,d);return[h,p,f,m]}function h(e){var t,r="",n=32*e.length;for(t=0;t<n;t+=8)r+=String.fromCharCode(e[t>>5]>>>t%32&255);return r}function p(e){var t,r=[];for(r[(e.length>>2)-1]=void 0,t=0;t<r.length;t+=1)r[t]=0;var n=8*e.length;for(t=0;t<n;t+=8)r[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return r}function f(e){var t,r,n="0123456789abcdef",i="";for(r=0;r<e.length;r+=1)t=e.charCodeAt(r),i+=n.charAt(t>>>4&15)+n.charAt(15&t);return i}function m(e){return unescape(encodeURIComponent(e))}function g(e){return function(e){return h(d(p(e),8*e.length))}(m(e))}function y(e,t){return function(e,t){var r,n,i=p(e),s=[],o=[];for(s[15]=o[15]=void 0,i.length>16&&(i=d(i,8*e.length)),r=0;r<16;r+=1)s[r]=909522486^i[r],o[r]=1549556828^i[r];return n=d(s.concat(p(t)),512+8*t.length),h(d(o.concat(n),640))}(m(e),m(t))}function v(e,t,r){return t?r?y(t,e):f(y(t,e)):r?g(e):f(g(e))}void 0===(n=function(){return v}.call(t,r,t,e))||(e.exports=n)}()}},t={};function r(n){var i=t[n];if(void 0!==i)return i.exports;var s=t[n]={exports:{}};return e[n].call(s.exports,s,s.exports,r),s.exports}r.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return r.d(t,{a:t}),t},r.d=(e,t)=>{for(var n in t)r.o(t,n)&&!r.o(e,n)&&Object.defineProperty(e,n,{enumerable:!0,get:t[n]})},r.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),r.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),r.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var n={};return(()=>{"use strict";r.r(n),r.d(n,{createApp:()=>rn});const e=function(e){const t=[];let r=0;for(let n=0;n<e.length;n++){let i=e.charCodeAt(n);i<128?t[r++]=i:i<2048?(t[r++]=i>>6|192,t[r++]=63&i|128):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>>6&63|128,t[r++]=63&i|128):(t[r++]=i>>12|224,t[r++]=i>>6&63|128,t[r++]=63&i|128)}return t},t={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(e,t){if(!Array.isArray(e))throw Error("encodeByteArray takes an array as a parameter");this.init_();const r=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,n=[];for(let t=0;t<e.length;t+=3){const i=e[t],s=t+1<e.length,o=s?e[t+1]:0,a=t+2<e.length,c=a?e[t+2]:0,l=i>>2,u=(3&i)<<4|o>>4;let d=(15&o)<<2|c>>6,h=63&c;a||(h=64,s||(d=64)),n.push(r[l],r[u],r[d],r[h])}return n.join("")},encodeString(t,r){return this.HAS_NATIVE_SUPPORT&&!r?btoa(t):this.encodeByteArray(e(t),r)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let r=0,n=0;for(;r<e.length;){const i=e[r++];if(i<128)t[n++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[r++];t[n++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[r++])<<12|(63&e[r++])<<6|63&e[r++])-65536;t[n++]=String.fromCharCode(55296+(s>>10)),t[n++]=String.fromCharCode(56320+(1023&s))}else{const s=e[r++],o=e[r++];t[n++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const r=t?this.charToByteMapWebSafe_:this.charToByteMap_,n=[];for(let t=0;t<e.length;){const i=r[e.charAt(t++)],s=t<e.length?r[e.charAt(t)]:0;++t;const o=t<e.length?r[e.charAt(t)]:64;++t;const a=t<e.length?r[e.charAt(t)]:64;if(++t,null==i||null==s||null==o||null==a)throw Error();const c=i<<2|s>>4;if(n.push(c),64!==o){const e=s<<4&240|o>>2;if(n.push(e),64!==a){const e=o<<6&192|a;n.push(e)}}}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,e>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)]=e,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)]=e)}}},i=function(r){return function(r){const n=e(r);return t.encodeByteArray(n,!0)}(r).replace(/\./g,"")};class s{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,r)=>{t?this.reject(t):this.resolve(r),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,r))}}}function o(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class a extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name="FirebaseError",Object.setPrototypeOf(this,a.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,c.prototype.create)}}class c{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},n=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(l,((e,r)=>{const n=t[r];return null!=n?String(n):`<${r}?>`}))}(i,r):"Error",o=`${this.serviceName}: ${s} (${n}).`;return new a(n,o,r)}}const l=/\{\$([^}]+)}/g;function u(e,t){if(e===t)return!0;const r=Object.keys(e),n=Object.keys(t);for(const i of r){if(!n.includes(i))return!1;const r=e[i],s=t[i];if(d(r)&&d(s)){if(!u(r,s))return!1}else if(r!==s)return!1}for(const e of n)if(!r.includes(e))return!1;return!0}function d(e){return null!==e&&"object"==typeof e}function h(e){const t=[];for(const[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 p(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[r,n]=e.split("=");t[decodeURIComponent(r)]=decodeURIComponent(n)}})),t}function f(e){const t=e.indexOf("?");if(!t)return"";const r=e.indexOf("#",t);return e.substring(t,r>0?r:void 0)}class m{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(e){this.forEachObserver((t=>{t.next(e)}))}error(e){this.forEachObserver((t=>{t.error(e)})),this.close(e)}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.");n=function(e,t){if("object"!=typeof e||null===e)return!1;for(const t of["next","error","complete"])if(t in e&&"function"==typeof e[t])return!0;return!1}(e)?e:{next:e,error:t,complete:r},void 0===n.next&&(n.next=g),void 0===n.error&&(n.error=g),void 0===n.complete&&(n.complete=g);const 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-=1,0===this.observerCount&&void 0!==this.onNoObservers&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}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 g(){}function y(e){return e&&e._delegate?e._delegate:e}class v{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}}const b="[DEFAULT]";class _{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){const t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){const e=new s;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const r=this.getOrInitializeService({instanceIdentifier:t});r&&e.resolve(r)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),n=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(r)&&!this.shouldAutoInitialize()){if(n)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:r})}catch(e){if(n)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(function(e){return"EAGER"===e.instantiationMode}(e))try{this.getOrInitializeService({instanceIdentifier:b})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const r=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:r});t.resolve(e)}catch(e){}}}}clearInstance(e="[DEFAULT]"){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){const 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="[DEFAULT]"){return this.instances.has(e)}getOptions(e="[DEFAULT]"){return this.instancesOptions.get(e)||{}}initialize(e={}){const{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`);const n=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[e,t]of this.instancesDeferred.entries())r===this.normalizeInstanceIdentifier(e)&&t.resolve(n);return n}onInit(e,t){var r;const n=this.normalizeInstanceIdentifier(t),i=null!==(r=this.onInitCallbacks.get(n))&&void 0!==r?r:new Set;i.add(e),this.onInitCallbacks.set(n,i);const s=this.instances.get(n);return s&&e(s,n),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const 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,n===b?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="[DEFAULT]"){return this.component?this.component.multipleInstances?e:b:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class I{constructor(e){this.name=e,this.providers=new Map}addComponent(e){const 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){if(this.providers.has(e))return this.providers.get(e);const t=new _(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const w=[];var T;!function(e){e[e.DEBUG=0]="DEBUG",e[e.VERBOSE=1]="VERBOSE",e[e.INFO=2]="INFO",e[e.WARN=3]="WARN",e[e.ERROR=4]="ERROR",e[e.SILENT=5]="SILENT"}(T||(T={}));const k={debug:T.DEBUG,verbose:T.VERBOSE,info:T.INFO,warn:T.WARN,error:T.ERROR,silent:T.SILENT},E=T.INFO,S={[T.DEBUG]:"log",[T.VERBOSE]:"log",[T.INFO]:"info",[T.WARN]:"warn",[T.ERROR]:"error"},O=(e,t,...r)=>{if(t<e.logLevel)return;const n=(new Date).toISOString(),i=S[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${n}] ${e.name}:`,...r)};class C{constructor(e){this.name=e,this._logLevel=E,this._logHandler=O,this._userLogHandler=null,w.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in T))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?k[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,T.DEBUG,...e),this._logHandler(this,T.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,T.VERBOSE,...e),this._logHandler(this,T.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,T.INFO,...e),this._logHandler(this,T.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,T.WARN,...e),this._logHandler(this,T.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,T.ERROR,...e),this._logHandler(this,T.ERROR,...e)}}let A,R;const P=new WeakMap,N=new WeakMap,D=new WeakMap,L=new WeakMap,M=new WeakMap;let j={get(e,t,r){if(e instanceof IDBTransaction){if("done"===t)return N.get(e);if("objectStoreNames"===t)return e.objectStoreNames||D.get(e);if("store"===t)return r.objectStoreNames[1]?void 0:r.objectStore(r.objectStoreNames[0])}return $(e[t])},set:(e,t,r)=>(e[t]=r,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function U(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(R||(R=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(x(this),e),$(P.get(this))}:function(...e){return $(t.apply(x(this),e))}:function(e,...r){const n=t.call(x(this),e,...r);return D.set(n,e.sort?e.sort():[e]),$(n)}:(e instanceof IDBTransaction&&function(e){if(N.has(e))return;const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),n()},s=()=>{r(e.error||new DOMException("AbortError","AbortError")),n()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)}));N.set(e,t)}(e),r=e,(A||(A=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])).some((e=>r instanceof e))?new Proxy(e,j):e);var t,r}function $(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,r)=>{const n=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t($(e.result)),n()},s=()=>{r(e.error),n()};e.addEventListener("success",i),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&P.set(t,e)})).catch((()=>{})),M.set(t,e),t}(e);if(L.has(e))return L.get(e);const t=U(e);return t!==e&&(L.set(e,t),M.set(t,e)),t}const x=e=>M.get(e),F=["get","getKey","getAll","getAllKeys","count"],B=["put","add","delete","clear"],V=new Map;function H(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(V.get(t))return V.get(t);const r=t.replace(/FromIndex$/,""),n=t!==r,i=B.includes(r);if(!(r in(n?IDBIndex:IDBObjectStore).prototype)||!i&&!F.includes(r))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;return n&&(o=o.index(t.shift())),(await Promise.all([o[r](...t),i&&s.done]))[0]};return V.set(t,s),s}var z;z=j,j={...z,get:(e,t,r)=>H(e,t)||z.get(e,t,r),has:(e,t)=>!!H(e,t)||z.has(e,t)};class W{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map((e=>{if(function(e){const t=e.getComponent();return"VERSION"===(null==t?void 0:t.type)}(e)){const t=e.getImmediate();return`${t.library}/${t.version}`}return null})).filter((e=>e)).join(" ")}}const q="@firebase/app",G="0.7.30",J=new C("@firebase/app"),K={[q]:"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/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","fire-js":"fire-js",firebase:"fire-js-all"},X=new Map,Y=new Map;function Q(e,t){try{e.container.addComponent(t)}catch(r){J.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,r)}}function Z(e){const t=e.name;if(Y.has(t))return J.debug(`There were multiple attempts to register component ${t}.`),!1;Y.set(t,e);for(const t of X.values())Q(t,e);return!0}function ee(e,t){const r=e.container.getProvider("heartbeat").getImmediate({optional:!0});return r&&r.triggerHeartbeat(),e.container.getProvider(t)}const te=new c("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call Firebase App.initializeApp()","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","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}."});class re{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 v("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 te.create("app-deleted",{appName:this._name})}}const ne="9.9.2";function ie(e,t,r){var n;let i=null!==(n=K[e])&&void 0!==n?n:e;r&&(i+=`-${r}`);const s=i.match(/\s|\//),o=t.match(/\s|\//);if(s||o){const e=[`Unable to register library "${i}" with version "${t}":`];return s&&e.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&e.push("and"),o&&e.push(`version name "${t}" contains illegal characters (whitespace or "/")`),void J.warn(e.join(" "))}Z(new v(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}const se="firebase-heartbeat-store";let oe=null;function ae(){return oe||(oe=function(e,t,{blocked:r,upgrade:n,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=$(o);return n&&o.addEventListener("upgradeneeded",(e=>{n($(o.result),e.oldVersion,e.newVersion,$(o.transaction))})),r&&o.addEventListener("blocked",(()=>r())),a.then((e=>{s&&e.addEventListener("close",(()=>s())),i&&e.addEventListener("versionchange",(()=>i()))})).catch((()=>{})),a}("firebase-heartbeat-database",1,{upgrade:(e,t)=>{0===t&&e.createObjectStore(se)}}).catch((e=>{throw te.create("idb-open",{originalErrorMessage:e.message})}))),oe}async function ce(e,t){var r;try{const r=(await ae()).transaction(se,"readwrite"),n=r.objectStore(se);return await n.put(t,le(e)),r.done}catch(e){if(e instanceof a)J.warn(e.message);else{const t=te.create("idb-set",{originalErrorMessage:null===(r=e)||void 0===r?void 0:r.message});J.warn(t.message)}}}function le(e){return`${e.name}!${e.options.appId}`}class ue{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new he(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=de();if(null===this._heartbeatsCache&&(this._heartbeatsCache=await this._heartbeatsCachePromise),this._heartbeatsCache.lastSentHeartbeatDate!==t&&!this._heartbeatsCache.heartbeats.some((e=>e.date===t)))return this._heartbeatsCache.heartbeats.push({date:t,agent:e}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter((e=>{const t=new Date(e.date).valueOf();return Date.now()-t<=2592e6})),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(null===this._heartbeatsCache&&await this._heartbeatsCachePromise,null===this._heartbeatsCache||0===this._heartbeatsCache.heartbeats.length)return"";const e=de(),{heartbeatsToSend:t,unsentEntries:r}=function(e,t=1024){const r=[];let n=e.slice();for(const i of e){const e=r.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),pe(r)>t){e.dates.pop();break}}else if(r.push({agent:i.agent,dates:[i.date]}),pe(r)>t){r.pop();break}n=n.slice(1)}return{heartbeatsToSend:r,unsentEntries:n}}(this._heartbeatsCache.heartbeats),n=i(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,r.length>0?(this._heartbeatsCache.heartbeats=r,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),n}}function de(){return(new Date).toISOString().substring(0,10)}class he{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return"object"==typeof indexedDB&&new Promise(((e,t)=>{try{let r=!0;const n="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(n);i.onsuccess=()=>{i.result.close(),r||self.indexedDB.deleteDatabase(n),e(!0)},i.onupgradeneeded=()=>{r=!1},i.onerror=()=>{var e;t((null===(e=i.error)||void 0===e?void 0:e.message)||"")}}catch(e){t(e)}})).then((()=>!0)).catch((()=>!1))}async read(){return await this._canUseIndexedDBPromise&&await async function(e){var t;try{return(await ae()).transaction(se).objectStore(se).get(le(e))}catch(e){if(e instanceof a)J.warn(e.message);else{const r=te.create("idb-get",{originalErrorMessage:null===(t=e)||void 0===t?void 0:t.message});J.warn(r.message)}}}(this.app)||{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return ce(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const r=await this.read();return ce(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}}}function pe(e){return i(JSON.stringify({version:2,heartbeats:e})).length}function fe(e,t){var r={};for(var n in e)Object.prototype.hasOwnProperty.call(e,n)&&t.indexOf(n)<0&&(r[n]=e[n]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(n=Object.getOwnPropertySymbols(e);i<n.length;i++)t.indexOf(n[i])<0&&Object.prototype.propertyIsEnumerable.call(e,n[i])&&(r[n[i]]=e[n[i]])}return r}Z(new v("platform-logger",(e=>new W(e)),"PRIVATE")),Z(new v("heartbeat",(e=>new ue(e)),"PRIVATE")),ie(q,G,""),ie(q,G,"esm2017"),ie("fire-js",""),ie("firebase","9.9.2","app"),Object.create,Object.create;const me=function(){return{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}},ge=new c("auth","Firebase",{"dependent-sdk-initialized-before-auth":"Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."}),ye=new C("@firebase/auth");function ve(e,...t){ye.logLevel<=T.ERROR&&ye.error(`Auth (9.9.2): ${e}`,...t)}function be(e,...t){throw Ie(e,...t)}function _e(e,...t){return Ie(e,...t)}function Ie(e,...t){if("string"!=typeof e){const r=t[0],n=[...t.slice(1)];return n[0]&&(n[0].appName=e.name),e._errorFactory.create(r,...n)}return ge.create(e,...t)}function we(e,t,...r){if(!e)throw Ie(t,...r)}function Te(e){const t="INTERNAL ASSERTION FAILED: "+e;throw ve(t),new Error(t)}function ke(e,t){e||Te(t)}const Ee=new Map;function Se(e){ke(e instanceof Function,"Expected a class definition");let t=Ee.get(e);return t?(ke(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,Ee.set(e,t),t)}function Oe(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Ce(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function Ae(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===Ce()||"https:"===Ce()||function(){const e="object"==typeof chrome?chrome.runtime:"object"==typeof browser?browser.runtime:void 0;return"object"==typeof e&&void 0!==e.id}()||"connection"in navigator))||navigator.onLine}class Re{constructor(e,t){this.shortDelay=e,this.longDelay=t,ke(t>e,"Short delay should be less than long delay!"),this.isMobile="undefined"!=typeof window&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(o())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return Ae()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Pe(e,t){ke(e.emulator,"Emulator should always be set here");const{url:r}=e.emulator;return t?`${r}${t.startsWith("/")?t.slice(1):t}`:r}class Ne{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void Te("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){return this.headersImpl?this.headersImpl:"undefined"!=typeof self&&"Headers"in self?self.Headers:void Te("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){return this.responseImpl?this.responseImpl:"undefined"!=typeof self&&"Response"in self?self.Response:void Te("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const De={CREDENTIAL_MISMATCH:"custom-token-mismatch",MISSING_CUSTOM_TOKEN:"internal-error",INVALID_IDENTIFIER:"invalid-email",MISSING_CONTINUE_URI:"internal-error",INVALID_PASSWORD:"wrong-password",MISSING_PASSWORD:"internal-error",EMAIL_EXISTS:"email-already-in-use",PASSWORD_LOGIN_DISABLED:"operation-not-allowed",INVALID_IDP_RESPONSE:"invalid-credential",INVALID_PENDING_TOKEN:"invalid-credential",FEDERATED_USER_ID_ALREADY_LINKED:"credential-already-in-use",MISSING_REQ_TYPE:"internal-error",EMAIL_NOT_FOUND:"user-not-found",RESET_PASSWORD_EXCEED_LIMIT:"too-many-requests",EXPIRED_OOB_CODE:"expired-action-code",INVALID_OOB_CODE:"invalid-action-code",MISSING_OOB_CODE:"internal-error",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"requires-recent-login",INVALID_ID_TOKEN:"invalid-user-token",TOKEN_EXPIRED:"user-token-expired",USER_NOT_FOUND:"user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"too-many-requests",INVALID_CODE:"invalid-verification-code",INVALID_SESSION_INFO:"invalid-verification-id",INVALID_TEMPORARY_PROOF:"invalid-credential",MISSING_SESSION_INFO:"missing-verification-id",SESSION_EXPIRED:"code-expired",MISSING_ANDROID_PACKAGE_NAME:"missing-android-pkg-name",UNAUTHORIZED_DOMAIN:"unauthorized-continue-uri",INVALID_OAUTH_CLIENT_ID:"invalid-oauth-client-id",ADMIN_ONLY_OPERATION:"admin-restricted-operation",INVALID_MFA_PENDING_CREDENTIAL:"invalid-multi-factor-session",MFA_ENROLLMENT_NOT_FOUND:"multi-factor-info-not-found",MISSING_MFA_ENROLLMENT_ID:"missing-multi-factor-info",MISSING_MFA_PENDING_CREDENTIAL:"missing-multi-factor-session",SECOND_FACTOR_EXISTS:"second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"maximum-second-factor-count-exceeded",BLOCKING_FUNCTION_ERROR_RESPONSE:"internal-error"},Le=new Re(3e4,6e4);function Me(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function je(e,t,r,n,i={}){return Ue(e,i,(async()=>{let i={},s={};n&&("GET"===t?s=n:i={body:JSON.stringify(n)});const o=h(Object.assign({key:e.config.apiKey},s)).slice(1),a=await e._getAdditionalHeaders();return a["Content-Type"]="application/json",e.languageCode&&(a["X-Firebase-Locale"]=e.languageCode),Ne.fetch()(xe(e,e.config.apiHost,r,o),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))}))}async function Ue(e,t,r){e._canInitEmulator=!1;const n=Object.assign(Object.assign({},De),t);try{const t=new Fe(e),i=await Promise.race([r(),t.promise]);t.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Be(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const t=i.ok?s.errorMessage:s.error.message,[r,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===r)throw Be(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===r)throw Be(e,"email-already-in-use",s);if("USER_DISABLED"===r)throw Be(e,"user-disabled",s);const a=n[r]||r.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(e,t,r){const n=Object.assign(Object.assign({},me()),{[t]:r});return new c("auth","Firebase",n).create(t,{appName:e.name})}(e,a,o);be(e,a)}}catch(t){if(t instanceof a)throw t;be(e,"network-request-failed")}}async function $e(e,t,r,n,i={}){const s=await je(e,t,r,n,i);return"mfaPendingCredential"in s&&be(e,"multi-factor-auth-required",{_serverResponse:s}),s}function xe(e,t,r,n){const i=`${t}${r}?${n}`;return e.config.emulator?Pe(e.config,i):`${e.config.apiScheme}://${i}`}class Fe{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(_e(this.auth,"network-request-failed"))),Le.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Be(e,t,r){const n={appName:e.name};r.email&&(n.email=r.email),r.phoneNumber&&(n.phoneNumber=r.phoneNumber);const i=_e(e,t,n);return i.customData._tokenResponse=r,i}function Ve(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function He(e){return 1e3*Number(e)}function ze(e){var r;const[n,i,s]=e.split(".");if(void 0===n||void 0===i||void 0===s)return ve("JWT malformed, contained fewer than 3 sections"),null;try{const e=function(e){try{return t.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null}(i);return e?JSON.parse(e):(ve("Failed to decode base64 JWT payload"),null)}catch(e){return ve("Caught error parsing JWT payload as JSON",null===(r=e)||void 0===r?void 0:r.toString()),null}}async function We(e,t,r=!1){if(r)return t;try{return await t}catch(t){throw t instanceof a&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class qe{constructor(e){this.user=e,this.isRunning=!1,this.timerId=null,this.errorBackoff=3e4}_start(){this.isRunning||(this.isRunning=!0,this.schedule())}_stop(){this.isRunning&&(this.isRunning=!1,null!==this.timerId&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const e=this.errorBackoff;return this.errorBackoff=Math.min(2*this.errorBackoff,96e4),e}{this.errorBackoff=3e4;const e=(null!==(t=this.user.stsTokenManager.expirationTime)&&void 0!==t?t:0)-Date.now()-3e5;return Math.max(0,e)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout((async()=>{await this.iteration()}),t)}async iteration(){var e;try{await this.user.getIdToken(!0)}catch(t){return void("auth/network-request-failed"===(null===(e=t)||void 0===e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class Ge{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ve(this.lastLoginAt),this.creationTime=Ve(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function Je(e){var t;const r=e.auth,n=await e.getIdToken(),i=await We(e,async function(e,t){return je(e,"POST","/v1/accounts:lookup",t)}(r,{idToken:n}));we(null==i?void 0:i.users.length,r,"internal-error");const s=i.users[0];e._notifyReloadListener(s);const o=(null===(t=s.providerUserInfo)||void 0===t?void 0:t.length)?s.providerUserInfo.map((e=>{var{providerId:t}=e,r=fe(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})):[],a=(c=e.providerData,l=o,[...c.filter((e=>!l.some((t=>t.providerId===e.providerId)))),...l]);var c,l;const u=e.isAnonymous,d=!(e.email&&s.passwordHash||(null==a?void 0:a.length)),h=!!u&&d,p={uid:s.localId,displayName:s.displayName||null,photoURL:s.photoUrl||null,email:s.email||null,emailVerified:s.emailVerified||!1,phoneNumber:s.phoneNumber||null,tenantId:s.tenantId||null,providerData:a,metadata:new Ge(s.createdAt,s.lastLoginAt),isAnonymous:h};Object.assign(e,p)}class Ke{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){we(e.idToken,"internal-error"),we(void 0!==e.idToken,"internal-error"),we(void 0!==e.refreshToken,"internal-error");const t="expiresIn"in e&&void 0!==e.expiresIn?Number(e.expiresIn):function(e){const t=ze(e);return we(t,"internal-error"),we(void 0!==t.exp,"internal-error"),we(void 0!==t.iat,"internal-error"),Number(t.exp)-Number(t.iat)}(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return we(!this.accessToken||this.refreshToken,e,"user-token-expired"),t||!this.accessToken||this.isExpired?this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null:this.accessToken}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:n,expiresIn:i}=await async function(e,t){const r=await Ue(e,{},(async()=>{const r=h({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:n,apiKey:i}=e.config,s=xe(e,n,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",Ne.fetch()(s,{method:"POST",headers:o,body:r})}));return{accessToken:r.access_token,expiresIn:r.expires_in,refreshToken:r.refresh_token}}(e,t);this.updateTokensAndExpiration(r,n,Number(i))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*r}static fromJSON(e,t){const{refreshToken:r,accessToken:n,expirationTime:i}=t,s=new Ke;return r&&(we("string"==typeof r,"internal-error",{appName:e}),s.refreshToken=r),n&&(we("string"==typeof n,"internal-error",{appName:e}),s.accessToken=n),i&&(we("number"==typeof i,"internal-error",{appName:e}),s.expirationTime=i),s}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new Ke,this.toJSON())}_performRefresh(){return Te("not implemented")}}function Xe(e,t){we("string"==typeof e||void 0===e,"internal-error",{appName:t})}class Ye{constructor(e){var{uid:t,auth:r,stsTokenManager:n}=e,i=fe(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new qe(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=n,this.accessToken=n.accessToken,this.displayName=i.displayName||null,this.email=i.email||null,this.emailVerified=i.emailVerified||!1,this.phoneNumber=i.phoneNumber||null,this.photoURL=i.photoURL||null,this.isAnonymous=i.isAnonymous||!1,this.tenantId=i.tenantId||null,this.providerData=i.providerData?[...i.providerData]:[],this.metadata=new Ge(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await We(this,this.stsTokenManager.getToken(this.auth,e));return we(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return async function(e,t=!1){const r=y(e),n=await r.getIdToken(t),i=ze(n);we(i&&i.exp&&i.auth_time&&i.iat,r.auth,"internal-error");const s="object"==typeof i.firebase?i.firebase:void 0,o=null==s?void 0:s.sign_in_provider;return{claims:i,token:n,authTime:Ve(He(i.auth_time)),issuedAtTime:Ve(He(i.iat)),expirationTime:Ve(He(i.exp)),signInProvider:o||null,signInSecondFactor:(null==s?void 0:s.sign_in_second_factor)||null}}(this,e)}reload(){return async function(e){const t=y(e);await Je(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(we(this.uid===e.uid,this.auth,"internal-error"),this.displayName=e.displayName,this.photoURL=e.photoURL,this.email=e.email,this.emailVerified=e.emailVerified,this.phoneNumber=e.phoneNumber,this.isAnonymous=e.isAnonymous,this.tenantId=e.tenantId,this.providerData=e.providerData.map((e=>Object.assign({},e))),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){return new Ye(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}))}_onReload(e){we(!this.reloadListener,this.auth,"internal-error"),this.reloadListener=e,this.reloadUserInfo&&(this._notifyReloadListener(this.reloadUserInfo),this.reloadUserInfo=null)}_notifyReloadListener(e){this.reloadListener?this.reloadListener(e):this.reloadUserInfo=e}_startProactiveRefresh(){this.proactiveRefresh._start()}_stopProactiveRefresh(){this.proactiveRefresh._stop()}async _updateTokensIfNecessary(e,t=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),t&&await Je(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await We(this,async function(e,t){return je(e,"POST","/v1/accounts:delete",t)}(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return Object.assign(Object.assign({uid:this.uid,email:this.email||void 0,emailVerified:this.emailVerified,displayName:this.displayName||void 0,isAnonymous:this.isAnonymous,photoURL:this.photoURL||void 0,phoneNumber:this.phoneNumber||void 0,tenantId:this.tenantId||void 0,providerData:this.providerData.map((e=>Object.assign({},e))),stsTokenManager:this.stsTokenManager.toJSON(),_redirectEventId:this._redirectEventId},this.metadata.toJSON()),{apiKey:this.auth.config.apiKey,appName:this.auth.name})}get refreshToken(){return this.stsTokenManager.refreshToken||""}static _fromJSON(e,t){var r,n,i,s,o,a,c,l;const u=null!==(r=t.displayName)&&void 0!==r?r:void 0,d=null!==(n=t.email)&&void 0!==n?n:void 0,h=null!==(i=t.phoneNumber)&&void 0!==i?i:void 0,p=null!==(s=t.photoURL)&&void 0!==s?s:void 0,f=null!==(o=t.tenantId)&&void 0!==o?o:void 0,m=null!==(a=t._redirectEventId)&&void 0!==a?a:void 0,g=null!==(c=t.createdAt)&&void 0!==c?c:void 0,y=null!==(l=t.lastLoginAt)&&void 0!==l?l:void 0,{uid:v,emailVerified:b,isAnonymous:_,providerData:I,stsTokenManager:w}=t;we(v&&w,e,"internal-error");const T=Ke.fromJSON(this.name,w);we("string"==typeof v,e,"internal-error"),Xe(u,e.name),Xe(d,e.name),we("boolean"==typeof b,e,"internal-error"),we("boolean"==typeof _,e,"internal-error"),Xe(h,e.name),Xe(p,e.name),Xe(f,e.name),Xe(m,e.name),Xe(g,e.name),Xe(y,e.name);const k=new Ye({uid:v,auth:e,email:d,emailVerified:b,displayName:u,isAnonymous:_,photoURL:p,phoneNumber:h,tenantId:f,stsTokenManager:T,createdAt:g,lastLoginAt:y});return I&&Array.isArray(I)&&(k.providerData=I.map((e=>Object.assign({},e)))),m&&(k._redirectEventId=m),k}static async _fromIdTokenResponse(e,t,r=!1){const n=new Ke;n.updateFromServerResponse(t);const i=new Ye({uid:t.localId,auth:e,stsTokenManager:n,isAnonymous:r});return await Je(i),i}}class Qe{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){const t=this.storage[e];return void 0===t?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Qe.type="NONE";const Ze=Qe;function et(e,t,r){return`firebase:${e}:${t}:${r}`}class tt{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:n,name:i}=this.auth;this.fullUserKey=et(this.userKey,n.apiKey,i),this.fullPersistenceKey=et("persistence",n.apiKey,i),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){const e=await this.persistence._get(this.fullUserKey);return e?Ye._fromJSON(this.auth,e):null}removeCurrentUser(){return this.persistence._remove(this.fullUserKey)}savePersistenceForRedirect(){return this.persistence._set(this.fullPersistenceKey,this.persistence.type)}async setPersistence(e){if(this.persistence===e)return;const t=await this.getCurrentUser();return await this.removeCurrentUser(),this.persistence=e,t?this.setCurrentUser(t):void 0}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new tt(Se(Ze),e,r);const n=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let i=n[0]||Se(Ze);const s=et(r,e.config.apiKey,e.name);let o=null;for(const r of t)try{const t=await r._get(s);if(t){const n=Ye._fromJSON(e,t);r!==i&&(o=n),i=r;break}}catch(e){}const a=n.filter((e=>e._shouldAllowMigration));return i._shouldAllowMigration&&a.length?(i=a[0],o&&await i._set(s,o.toJSON()),await Promise.all(t.map((async e=>{if(e!==i)try{await e._remove(s)}catch(e){}}))),new tt(i,e,r)):new tt(i,e,r)}}function rt(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(ot(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(nt(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(ct(t))return"Blackberry";if(lt(t))return"Webos";if(it(t))return"Safari";if((t.includes("chrome/")||st(t))&&!t.includes("edge/"))return"Chrome";if(at(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=e.match(t);if(2===(null==r?void 0:r.length))return r[1]}return"Other"}function nt(e=o()){return/firefox\//i.test(e)}function it(e=o()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function st(e=o()){return/crios\//i.test(e)}function ot(e=o()){return/iemobile/i.test(e)}function at(e=o()){return/android/i.test(e)}function ct(e=o()){return/blackberry/i.test(e)}function lt(e=o()){return/webos/i.test(e)}function ut(e=o()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function dt(e=o()){return ut(e)||at(e)||lt(e)||ct(e)||/windows phone/i.test(e)||ot(e)}function ht(e,t=[]){let r;switch(e){case"Browser":r=rt(o());break;case"Worker":r=`${rt(o())}-${e}`;break;default:r=e}return`${r}/JsCore/9.9.2/${t.length?t.join(","):"FirebaseCore-web"}`}class pt{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=t=>new Promise(((r,n)=>{try{r(e(t))}catch(e){n(e)}}));r.onAbort=t,this.queue.push(r);const n=this.queue.length-1;return()=>{this.queue[n]=()=>Promise.resolve()}}async runMiddleware(e){var t;if(this.auth.currentUser===e)return;const r=[];try{for(const t of this.queue)await t(e),t.onAbort&&r.push(t.onAbort)}catch(e){r.reverse();for(const e of r)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null===(t=e)||void 0===t?void 0:t.message})}}}class ft{constructor(e,t,r){this.app=e,this.heartbeatServiceProvider=t,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new gt(this),this.idTokenSubscription=new gt(this),this.beforeStateQueue=new pt(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=ge,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=r.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=Se(t)),this._initializationPromise=this.queue((async()=>{var r,n;if(!this._deleted&&(this.persistenceManager=await tt.create(this,e),!this._deleted)){if(null===(r=this._popupRedirectResolver)||void 0===r?void 0:r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(n=this.currentUser)||void 0===n?void 0:n.uid)||null,this._deleted||(this._isInitialized=!0)}})),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();return this.currentUser||e?this.currentUser&&e&&this.currentUser.uid===e.uid?(this._currentUser._assign(e),void await this.currentUser.getIdToken()):void await this._updateCurrentUser(e,!0):void 0}async initializeCurrentUser(e){var t;const r=await this.assertedPersistence.getCurrentUser();let n=r,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const r=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==n?void 0:n._redirectEventId,o=await this.tryRedirectSignIn(e);r&&r!==s||!(null==o?void 0:o.user)||(n=o.user,i=!0)}if(!n)return this.directlySetCurrentUser(null);if(!n._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(n)}catch(e){n=r,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(e)))}return n?this.reloadAndSetCurrentUserOrClear(n):this.directlySetCurrentUser(null)}return we(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===n._redirectEventId?this.directlySetCurrentUser(n):this.reloadAndSetCurrentUserOrClear(n)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch(e){await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){var t;try{await Je(e)}catch(e){if("auth/network-request-failed"!==(null===(t=e)||void 0===t?void 0:t.code))return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=function(){if("undefined"==typeof navigator)return null;const e=navigator;return e.languages&&e.languages[0]||e.language||null}()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?y(e):null;return t&&we(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&we(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue((async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()}))}async signOut(){return await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0)}setPersistence(e){return this.queue((async()=>{await this.assertedPersistence.setPersistence(Se(e))}))}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new c("auth","Firebase",e())}onAuthStateChanged(e,t,r){return this.registerStateListener(this.authStateSubscription,e,t,r)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,r){return this.registerStateListener(this.idTokenSubscription,e,t,r)}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:null===(e=this._currentUser)||void 0===e?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return null===e?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&Se(e)||this._popupRedirectResolver;we(t,this,"argument-error"),this.redirectPersistenceManager=await tt.create(this,[Se(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,r;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(r=this.redirectUser)||void 0===r?void 0:r._redirectEventId)===e?this.redirectUser:null}async _persistUserIfCurrent(e){if(e===this.currentUser)return this.queue((async()=>this.directlySetCurrentUser(e)))}_notifyListenersIfCurrent(e){e===this.currentUser&&this.notifyAuthListeners()}_key(){return`${this.config.authDomain}:${this.config.apiKey}:${this.name}`}_startProactiveRefresh(){this.isProactiveRefreshEnabled=!0,this.currentUser&&this._currentUser._startProactiveRefresh()}_stopProactiveRefresh(){this.isProactiveRefreshEnabled=!1,this.currentUser&&this._currentUser._stopProactiveRefresh()}get _currentUser(){return this.currentUser}notifyAuthListeners(){var e,t;if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);const r=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,n){if(this._deleted)return()=>{};const i="function"==typeof t?t:t.next.bind(t),s=this._isInitialized?Promise.resolve():this._initializationPromise;return we(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof t?e.addObserver(t,r,n):e.addObserver(t)}async directlySetCurrentUser(e){this.currentUser&&this.currentUser!==e&&(this._currentUser._stopProactiveRefresh(),e&&this.isProactiveRefreshEnabled&&e._startProactiveRefresh()),this.currentUser=e,e?await this.assertedPersistence.setCurrentUser(e):await this.assertedPersistence.removeCurrentUser()}queue(e){return this.operations=this.operations.then(e,e),this.operations}get assertedPersistence(){return we(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=ht(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){var e;const t={"X-Client-Version":this.clientVersion};this.app.options.appId&&(t["X-Firebase-gmpid"]=this.app.options.appId);const r=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());return r&&(t["X-Firebase-Client"]=r),t}}function mt(e){return y(e)}class gt{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const r=new m(e,void 0);return r.subscribe.bind(r)}((e=>this.observer=e))}get next(){return we(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}class yt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return Te("not implemented")}_getIdTokenResponse(e){return Te("not implemented")}_linkToIdToken(e,t){return Te("not implemented")}_getReauthenticationResolver(e){return Te("not implemented")}}class vt extends yt{constructor(e,t,r,n=null){super("password",r),this._email=e,this._password=t,this._tenantId=n}static _fromEmailAndPassword(e,t){return new vt(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new vt(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e;if((null==t?void 0:t.email)&&(null==t?void 0:t.password)){if("password"===t.signInMethod)return this._fromEmailAndPassword(t.email,t.password);if("emailLink"===t.signInMethod)return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithPassword",Me(e,t))}(e,{returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithEmailLink",Me(e,t))}(e,{email:this._email,oobCode:this._password});default:be(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return async function(e,t){return je(e,"POST","/v1/accounts:update",t)}(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithEmailLink",Me(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:be(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function bt(e,t){return $e(e,"POST","/v1/accounts:signInWithIdp",Me(e,t))}class _t extends yt{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new _t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):be("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){const t="string"==typeof e?JSON.parse(e):e,{providerId:r,signInMethod:n}=t,i=fe(t,["providerId","signInMethod"]);if(!r||!n)return null;const s=new _t(r,n);return s.idToken=i.idToken||void 0,s.accessToken=i.accessToken||void 0,s.secret=i.secret,s.nonce=i.nonce,s.pendingToken=i.pendingToken||null,s}_getIdTokenResponse(e){return bt(e,this.buildRequest())}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,bt(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,bt(e,t)}buildRequest(){const e={requestUri:"http://localhost",returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{const t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=h(t)}return e}}const It={USER_NOT_FOUND:"user-not-found"};class wt extends yt{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new wt({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new wt({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithPhoneNumber",Me(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const r=await $e(e,"POST","/v1/accounts:signInWithPhoneNumber",Me(e,t));if(r.temporaryProof)throw Be(e,"account-exists-with-different-credential",r);return r}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return $e(e,"POST","/v1/accounts:signInWithPhoneNumber",Me(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),It)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:r,verificationCode:n}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:r,code:n}}toJSON(){const e={providerId:this.providerId};return this.params.phoneNumber&&(e.phoneNumber=this.params.phoneNumber),this.params.temporaryProof&&(e.temporaryProof=this.params.temporaryProof),this.params.verificationCode&&(e.verificationCode=this.params.verificationCode),this.params.verificationId&&(e.verificationId=this.params.verificationId),e}static fromJSON(e){"string"==typeof e&&(e=JSON.parse(e));const{verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}=e;return r||t||n||i?new wt({verificationId:t,verificationCode:r,phoneNumber:n,temporaryProof:i}):null}}class Tt{constructor(e){var t,r,n,i,s,o;const a=p(f(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,l=null!==(r=a.oobCode)&&void 0!==r?r:null,u=function(e){switch(e){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}(null!==(n=a.mode)&&void 0!==n?n:null);we(c&&l&&u,"argument-error"),this.apiKey=c,this.operation=u,this.code=l,this.continueUrl=null!==(i=a.continueUrl)&&void 0!==i?i:null,this.languageCode=null!==(s=a.languageCode)&&void 0!==s?s:null,this.tenantId=null!==(o=a.tenantId)&&void 0!==o?o:null}static parseLink(e){const t=function(e){const t=p(f(e)).link,r=t?p(f(t)).deep_link_id:null,n=p(f(e)).deep_link_id;return(n?p(f(n)).link:null)||n||r||t||e}(e);try{return new Tt(t)}catch(e){return null}}}class kt{constructor(){this.providerId=kt.PROVIDER_ID}static credential(e,t){return vt._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=Tt.parseLink(t);return we(r,"argument-error"),vt._fromEmailAndCode(e,r.code,r.tenantId)}}kt.PROVIDER_ID="password",kt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",kt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class Et{constructor(e){this.providerId=e,this.defaultLanguageCode=null,this.customParameters={}}setDefaultLanguage(e){this.defaultLanguageCode=e}setCustomParameters(e){return this.customParameters=e,this}getCustomParameters(){return this.customParameters}}class St extends Et{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Ot extends St{constructor(){super("facebook.com")}static credential(e){return _t._fromParams({providerId:Ot.PROVIDER_ID,signInMethod:Ot.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Ot.credentialFromTaggedObject(e)}static credentialFromError(e){return Ot.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Ot.credential(e.oauthAccessToken)}catch(e){return null}}}Ot.FACEBOOK_SIGN_IN_METHOD="facebook.com",Ot.PROVIDER_ID="facebook.com";class Ct extends St{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return _t._fromParams({providerId:Ct.PROVIDER_ID,signInMethod:Ct.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Ct.credentialFromTaggedObject(e)}static credentialFromError(e){return Ct.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return Ct.credential(t,r)}catch(e){return null}}}Ct.GOOGLE_SIGN_IN_METHOD="google.com",Ct.PROVIDER_ID="google.com";class At extends St{constructor(){super("github.com")}static credential(e){return _t._fromParams({providerId:At.PROVIDER_ID,signInMethod:At.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return At.credentialFromTaggedObject(e)}static credentialFromError(e){return At.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return At.credential(e.oauthAccessToken)}catch(e){return null}}}At.GITHUB_SIGN_IN_METHOD="github.com",At.PROVIDER_ID="github.com";class Rt extends St{constructor(){super("twitter.com")}static credential(e,t){return _t._fromParams({providerId:Rt.PROVIDER_ID,signInMethod:Rt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Rt.credentialFromTaggedObject(e)}static credentialFromError(e){return Rt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return Rt.credential(t,r)}catch(e){return null}}}Rt.TWITTER_SIGN_IN_METHOD="twitter.com",Rt.PROVIDER_ID="twitter.com";class Pt{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,n=!1){const i=await Ye._fromIdTokenResponse(e,r,n),s=Nt(r);return new Pt({user:i,providerId:s,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const n=Nt(r);return new Pt({user:e,providerId:n,_tokenResponse:r,operationType:t})}}function Nt(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class Dt extends a{constructor(e,t,r,n){var i;super(t.code,t.message),this.operationType=r,this.user=n,Object.setPrototypeOf(this,Dt.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,n){return new Dt(e,t,r,n)}}function Lt(e,t,r,n){return("reauthenticate"===t?r._getReauthenticationResolver(e):r._getIdTokenResponse(e)).catch((r=>{if("auth/multi-factor-auth-required"===r.code)throw Dt._fromErrorAndOperation(e,r,t,n);throw r}))}async function Mt(e,t,r=!1){const n="signIn",i=await Lt(e,n,t),s=await Pt._fromIdTokenResponse(e,n,i);return r||await e._updateCurrentUser(s.user),s}async function jt(e,t,r){const n=y(e),i={requestType:"PASSWORD_RESET",email:t};r&&function(e,t,r){var n;we((null===(n=r.url)||void 0===n?void 0:n.length)>0,e,"invalid-continue-uri"),we(void 0===r.dynamicLinkDomain||r.dynamicLinkDomain.length>0,e,"invalid-dynamic-link-domain"),t.continueUrl=r.url,t.dynamicLinkDomain=r.dynamicLinkDomain,t.canHandleCodeInApp=r.handleCodeInApp,r.iOS&&(we(r.iOS.bundleId.length>0,e,"missing-ios-bundle-id"),t.iOSBundleId=r.iOS.bundleId),r.android&&(we(r.android.packageName.length>0,e,"missing-android-pkg-name"),t.androidInstallApp=r.android.installApp,t.androidMinimumVersionCode=r.android.minimumVersion,t.androidPackageName=r.android.packageName)}(n,i,r),await async function(e,t){return async function(e,t){return je(e,"POST","/v1/accounts:sendOobCode",Me(e,t))}(e,t)}(n,i)}new WeakMap;const Ut="__sak";class $t{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Ut,"1"),this.storage.removeItem(Ut),Promise.resolve(!0)):Promise.resolve(!1)}catch(e){return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){const t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}}class xt extends $t{constructor(){super((()=>window.localStorage),"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=function(){const e=o();return it(e)||ut(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=dt(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),n=this.localCache[t];r!==n&&e(t,n,r)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys(((e,t,r)=>{this.notifyListeners(e,r)}));const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const n=this.storage.getItem(r);if(e.newValue!==n)null!==e.newValue?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}const n=()=>{const e=this.storage.getItem(r);(t||this.localCache[r]!==e)&&this.notifyListeners(r,e)},i=this.storage.getItem(r);!function(){const e=o();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()||10!==document.documentMode||i===e.newValue||e.newValue===e.oldValue?n():setTimeout(n,10)}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const e of Array.from(r))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)}))}),1e3)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){0===Object.keys(this.listeners).length&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){const t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}}xt.type="LOCAL";const Ft=xt;class Bt extends $t{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}Bt.type="SESSION";const Vt=Bt;class Ht{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find((t=>t.isListeningto(e)));if(t)return t;const r=new Ht(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:n,data:i}=t.data,s=this.handlersMap[n];if(!(null==s?void 0:s.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:n});const o=Array.from(s).map((async e=>e(t.origin,i))),a=await function(e){return Promise.all(e.map((async e=>{try{return{fulfilled:!0,value:await e}}catch(e){return{fulfilled:!1,reason:e}}})))}(o);t.ports[0].postMessage({status:"done",eventId:r,eventType:n,response:a})}_subscribe(e,t){0===Object.keys(this.handlersMap).length&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),t&&0!==this.handlersMap[e].size||delete this.handlersMap[e],0===Object.keys(this.handlersMap).length&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}function zt(e="",t=10){let r="";for(let e=0;e<t;e++)r+=Math.floor(10*Math.random());return e+r}Ht.receivers=[];class Wt{constructor(e){this.target=e,this.handlers=new Set}removeMessageHandler(e){e.messageChannel&&(e.messageChannel.port1.removeEventListener("message",e.onMessage),e.messageChannel.port1.close()),this.handlers.delete(e)}async _send(e,t,r=50){const n="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!n)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=zt("",20);n.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),r);s={messageChannel:n,onMessage(e){const t=e;if(t.data.eventId===c)switch(t.data.status){case"ack":clearTimeout(l),i=setTimeout((()=>{a(new Error("timeout"))}),3e3);break;case"done":clearTimeout(i),o(t.data.response);break;default:clearTimeout(l),clearTimeout(i),a(new Error("invalid_response"))}}},this.handlers.add(s),n.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[n.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}function qt(){return window}function Gt(){return void 0!==qt().WorkerGlobalScope&&"function"==typeof qt().importScripts}const Jt="firebaseLocalStorageDb",Kt="firebaseLocalStorage",Xt="fbase_key";class Yt{constructor(e){this.request=e}toPromise(){return new Promise(((e,t)=>{this.request.addEventListener("success",(()=>{e(this.request.result)})),this.request.addEventListener("error",(()=>{t(this.request.error)}))}))}}function Qt(e,t){return e.transaction([Kt],t?"readwrite":"readonly").objectStore(Kt)}function Zt(){const e=indexedDB.open(Jt,1);return new Promise(((t,r)=>{e.addEventListener("error",(()=>{r(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(Kt,{keyPath:Xt})}catch(e){r(e)}})),e.addEventListener("success",(async()=>{const r=e.result;r.objectStoreNames.contains(Kt)?t(r):(r.close(),await function(){const e=indexedDB.deleteDatabase(Jt);return new Yt(e).toPromise()}(),t(await Zt()))}))}))}async function er(e,t,r){const n=Qt(e,!0).put({[Xt]:t,value:r});return new Yt(n).toPromise()}function tr(e,t){const r=Qt(e,!0).delete(t);return new Yt(r).toPromise()}class rr{constructor(){this.type="LOCAL",this._shouldAllowMigration=!0,this.listeners={},this.localCache={},this.pollTimer=null,this.pendingWrites=0,this.receiver=null,this.sender=null,this.serviceWorkerReceiverAvailable=!1,this.activeServiceWorker=null,this._workerInitializationPromise=this.initializeServiceWorkerMessaging().then((()=>{}),(()=>{}))}async _openDb(){return this.db||(this.db=await Zt()),this.db}async _withRetries(e){let t=0;for(;;)try{const t=await this._openDb();return await e(t)}catch(e){if(t++>3)throw e;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return Gt()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ht._getInstance(Gt()?self:null),this.receiver._subscribe("keyChanged",(async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)}))),this.receiver._subscribe("ping",(async(e,t)=>["keyChanged"]))}async initializeSender(){var e,t;if(this.activeServiceWorker=await async function(){if(!(null===navigator||void 0===navigator?void 0:navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch(e){return null}}(),!this.activeServiceWorker)return;this.sender=new Wt(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&(null===(e=r[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=r[0])||void 0===t?void 0:t.value.includes("keyChanged"))&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){var t;if(this.sender&&this.activeServiceWorker&&((null===(t=null===navigator||void 0===navigator?void 0:navigator.serviceWorker)||void 0===t?void 0:t.controller)||null)===this.activeServiceWorker)try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch(t){}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await Zt();return await er(e,Ut,"1"),await tr(e,Ut),!0}catch(e){}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite((async()=>(await this._withRetries((r=>er(r,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const r=Qt(e,!1).get(t),n=await new Yt(r).toPromise();return void 0===n?null:n.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>tr(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=Qt(e,!1).getAll();return new Yt(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],r=new Set;for(const{fbase_key:n,value:i}of e)r.add(n),JSON.stringify(this.localCache[n])!==JSON.stringify(i)&&(this.notifyListeners(n,i),t.push(n));for(const e of Object.keys(this.localCache))this.localCache[e]&&!r.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const e of Array.from(r))e(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((async()=>this._poll()),800)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){0===Object.keys(this.listeners).length&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),0===this.listeners[e].size&&delete this.listeners[e]),0===Object.keys(this.listeners).length&&this.stopPolling()}}rr.type="LOCAL";const nr=rr;function ir(e){return`__${e}${Math.floor(1e6*Math.random())}`}ir("rcb"),new Re(3e4,6e4);class sr{constructor(e){this.providerId=sr.PROVIDER_ID,this.auth=mt(e)}verifyPhoneNumber(e,t){return async function(e,t,r){var n;const i=await r.verify();try{let s;if(we("string"==typeof i,e,"argument-error"),we("recaptcha"===r.type,e,"argument-error"),s="string"==typeof t?{phoneNumber:t}:t,"session"in s){const t=s.session;if("phoneNumber"in s){we("enroll"===t.type,e,"internal-error");const r=await function(e,t){return je(e,"POST","/v2/accounts/mfaEnrollment:start",Me(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}});return r.phoneSessionInfo.sessionInfo}{we("signin"===t.type,e,"internal-error");const r=(null===(n=s.multiFactorHint)||void 0===n?void 0:n.uid)||s.multiFactorUid;we(r,e,"missing-multi-factor-info");const o=await function(e,t){return je(e,"POST","/v2/accounts/mfaSignIn:start",Me(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:r,phoneSignInInfo:{recaptchaToken:i}});return o.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return je(e,"POST","/v1/accounts:sendVerificationCode",Me(e,t))}(e,{phoneNumber:s.phoneNumber,recaptchaToken:i});return t}}finally{r._reset()}}(this.auth,e,y(t))}static credential(e,t){return wt._fromVerification(e,t)}static credentialFromResult(e){const t=e;return sr.credentialFromTaggedObject(t)}static credentialFromError(e){return sr.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:r}=e;return t&&r?wt._fromTokenResponse(t,r):null}}sr.PROVIDER_ID="phone",sr.PHONE_SIGN_IN_METHOD="phone";class or extends yt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return bt(e,this._buildIdpRequest())}_linkToIdToken(e,t){return bt(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return bt(e,this._buildIdpRequest())}_buildIdpRequest(e){const t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}}function ar(e){return Mt(e.auth,new or(e),e.bypassAuthState)}function cr(e){const{auth:t,user:r}=e;return we(r,t,"internal-error"),async function(e,t,r=!1){var n;const{auth:i}=e,s="reauthenticate";try{const n=await We(e,Lt(i,s,t,e),r);we(n.idToken,i,"internal-error");const o=ze(n.idToken);we(o,i,"internal-error");const{sub:a}=o;return we(e.uid===a,i,"user-mismatch"),Pt._forOperation(e,s,n)}catch(e){throw"auth/user-not-found"===(null===(n=e)||void 0===n?void 0:n.code)&&be(i,"user-mismatch"),e}}(r,new or(e),e.bypassAuthState)}async function lr(e){const{auth:t,user:r}=e;return we(r,t,"internal-error"),async function(e,t,r=!1){const n=await We(e,t._linkToIdToken(e.auth,await e.getIdToken()),r);return Pt._forOperation(e,"link",n)}(r,new or(e),e.bypassAuthState)}class ur{constructor(e,t,r,n,i=!1){this.auth=e,this.resolver=r,this.user=n,this.bypassAuthState=i,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise((async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(e){this.reject(e)}}))}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:n,tenantId:i,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:r,tenantId:i||void 0,postBody:n||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(o)(a))}catch(e){this.reject(e)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return ar;case"linkViaPopup":case"linkViaRedirect":return lr;case"reauthViaPopup":case"reauthViaRedirect":return cr;default:be(this.auth,"internal-error")}}resolve(e){ke(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){ke(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.reject(e),this.unregisterAndCleanUp()}unregisterAndCleanUp(){this.eventManager&&this.eventManager.unregisterConsumer(this),this.pendingPromise=null,this.cleanUp()}}const dr=new Re(2e3,1e4);class hr extends ur{constructor(e,t,r,n,i){super(e,t,n,i),this.provider=r,this.authWindow=null,this.pollId=null,hr.currentPopupAction&&hr.currentPopupAction.cancel(),hr.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return we(e,this.auth,"internal-error"),e}async onExecution(){ke(1===this.filter.length,"Popup operations only handle one event");const e=zt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch((e=>{this.reject(e)})),this.resolver._isIframeWebStorageSupported(this.auth,(e=>{e||this.reject(_e(this.auth,"web-storage-unsupported"))})),this.pollUserCancellation()}get eventId(){var e;return(null===(e=this.authWindow)||void 0===e?void 0:e.associatedEvent)||null}cancel(){this.reject(_e(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,hr.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;(null===(r=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===r?void 0:r.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(_e(this.auth,"popup-closed-by-user"))}),2e3):this.pollId=window.setTimeout(e,dr.get())};e()}}hr.currentPopupAction=null;const pr=new Map;class fr extends ur{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=pr.get(this.auth._key());if(!e){try{const t=await async function(e,t){const r=function(e){return et("pendingRedirect",e.config.apiKey,e.name)}(t),n=function(e){return Se(e._redirectPersistence)}(e);if(!await n._isAvailable())return!1;const i="true"===await n._get(r);return await n._remove(r),i}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}pr.set(this.auth._key(),e)}return this.bypassAuthState||pr.set(this.auth._key(),(()=>Promise.resolve(null))),e()}async onAuthEvent(e){if("signInViaRedirect"===e.type)return super.onAuthEvent(e);if("unknown"!==e.type){if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}else this.resolve(null)}async onExecution(){}cleanUp(){}}function mr(e,t){pr.set(e._key(),t)}async function gr(e,t,r=!1){const n=mt(e),i=function(e,t){return t?Se(t):(we(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(n,t),s=new fr(n,i,r),o=await s.execute();return o&&!r&&(delete o.user._redirectEventId,await n._persistUserIfCurrent(o.user),await n._setRedirectUser(null,t)),o}class yr{constructor(e){this.auth=e,this.cachedEventUids=new Set,this.consumers=new Set,this.queuedRedirectEvent=null,this.hasHandledPotentialRedirect=!1,this.lastProcessedEventTime=Date.now()}registerConsumer(e){this.consumers.add(e),this.queuedRedirectEvent&&this.isEventForConsumer(this.queuedRedirectEvent,e)&&(this.sendToConsumer(this.queuedRedirectEvent,e),this.saveEventToCache(this.queuedRedirectEvent),this.queuedRedirectEvent=null)}unregisterConsumer(e){this.consumers.delete(e)}onEvent(e){if(this.hasEventBeenHandled(e))return!1;let t=!1;return this.consumers.forEach((r=>{this.isEventForConsumer(e,r)&&(t=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return br(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!br(e)){const n=(null===(r=e.error.code)||void 0===r?void 0:r.split("auth/")[1])||"internal-error";t.onError(_e(this.auth,n))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(vr(e))}saveEventToCache(e){this.cachedEventUids.add(vr(e)),this.lastProcessedEventTime=Date.now()}}function vr(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function br({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}const _r=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ir=/^https?/;function wr(e){const t=Oe(),{protocol:r,hostname:n}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return""===i.hostname&&""===n?"chrome-extension:"===r&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===r&&i.hostname===n}if(!Ir.test(r))return!1;if(_r.test(e))return n===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(n)}const Tr=new Re(3e4,6e4);function kr(){const e=qt().___jsl;if(null==e?void 0:e.H)for(const t of Object.keys(e.H))if(e.H[t].r=e.H[t].r||[],e.H[t].L=e.H[t].L||[],e.H[t].r=[...e.H[t].L],e.CP)for(let t=0;t<e.CP.length;t++)e.CP[t]=null}let Er=null;function Sr(e){return Er=Er||function(e){return new Promise(((t,r)=>{var n,i,s,o;function a(){kr(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{kr(),r(_e(e,"network-request-failed"))},timeout:Tr.get()})}if(null===(i=null===(n=qt().gapi)||void 0===n?void 0:n.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(s=qt().gapi)||void 0===s?void 0:s.load)){const t=ir("iframefcb");return qt()[t]=()=>{gapi.load?a():r(_e(e,"network-request-failed"))},(o=`https://apis.google.com/js/api.js?onload=${t}`,new Promise(((e,t)=>{const r=document.createElement("script");var n,i;r.setAttribute("src",o),r.onload=e,r.onerror=e=>{const r=_e("internal-error");r.customData=e,t(r)},r.type="text/javascript",r.charset="UTF-8",(null!==(i=null===(n=document.getElementsByTagName("head"))||void 0===n?void 0:n[0])&&void 0!==i?i:document).appendChild(r)}))).catch((e=>r(e)))}a()}})).catch((e=>{throw Er=null,e}))}(e),Er}const Or=new Re(5e3,15e3),Cr={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Ar=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Rr(e){const t=e.config;we(t.authDomain,e,"auth-domain-config-required");const r=t.emulator?Pe(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,n={apiKey:t.apiKey,appName:e.name,v:ne},i=Ar.get(e.config.apiHost);i&&(n.eid=i);const s=e._getFrameworks();return s.length&&(n.fw=s.join(",")),`${r}?${h(n).slice(1)}`}const Pr={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Nr{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}function Dr(e,t,r,n,i,s){we(e.config.authDomain,e,"auth-domain-config-required"),we(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:r,redirectUrl:n,v:ne,eventId:i};if(t instanceof Et){t.setDefaultLanguage(e.languageCode),o.providerId=t.providerId||"",function(e){for(const t in e)if(Object.prototype.hasOwnProperty.call(e,t))return!1;return!0}(t.getCustomParameters())||(o.customParameters=JSON.stringify(t.getCustomParameters()));for(const[e,t]of Object.entries(s||{}))o[e]=t}if(t instanceof St){const e=t.getScopes().filter((e=>""!==e));e.length>0&&(o.scopes=e.join(","))}e.tenantId&&(o.tid=e.tenantId);const a=o;for(const e of Object.keys(a))void 0===a[e]&&delete a[e];return`${function({config:e}){return e.emulator?Pe(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${h(a).slice(1)}`}const Lr="webStorageSupport",Mr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=Vt,this._completeRedirectFn=gr,this._overrideRedirectResult=mr}async _openPopup(e,t,r,n){var i;return ke(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()"),function(e,t,r,n=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-n)/2,0).toString();let c="";const l=Object.assign(Object.assign({},Pr),{width:n.toString(),height:i.toString(),top:s,left:a}),u=o().toLowerCase();r&&(c=st(u)?"_blank":r),nt(u)&&(t=t||"http://localhost",l.scrollbars="yes");const d=Object.entries(l).reduce(((e,[t,r])=>`${e}${t}=${r},`),"");if(function(e=o()){var t;return ut(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(u)&&"_self"!==c)return function(e,t){const r=document.createElement("a");r.href=e,r.target=t;const n=document.createEvent("MouseEvent");n.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),r.dispatchEvent(n)}(t||"",c),new Nr(null);const h=window.open(t||"",c,d);we(h,e,"popup-blocked");try{h.focus()}catch(e){}return new Nr(h)}(e,Dr(e,t,r,Oe(),n),zt())}async _openRedirect(e,t,r,n){var i;return await this._originValidation(e),i=Dr(e,t,r,Oe(),n),qt().location.href=i,new Promise((()=>{}))}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:r}=this.eventManagers[t];return e?Promise.resolve(e):(ke(r,"If manager is not set, promise should be"),r)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch((()=>{delete this.eventManagers[t]})),r}async initAndGetManager(e){const t=await async function(e){const t=await Sr(e),r=qt().gapi;return we(r,e,"internal-error"),t.open({where:document.body,url:Rr(e),messageHandlersFilter:r.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Cr,dontclear:!0},(t=>new Promise((async(r,n)=>{await t.restyle({setHideOnLeave:!1});const i=_e(e,"network-request-failed"),s=qt().setTimeout((()=>{n(i)}),Or.get());function o(){qt().clearTimeout(s),r(t)}t.ping(o).then(o,(()=>{n(i)}))}))))}(e),r=new yr(e);return t.register("authEvent",(t=>(we(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:r.onEvent(t.authEvent)?"ACK":"ERROR"})),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:r},this.iframes[e._key()]=t,r}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Lr,{type:Lr},(r=>{var n;const i=null===(n=null==r?void 0:r[0])||void 0===n?void 0:n.webStorageSupport;void 0!==i&&t(!!i),be(e,"internal-error")}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=async function(e){if(e.config.emulator)return;const{authorizedDomains:t}=await async function(e,t={}){return je(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(wr(e))return}catch(e){}be(e,"unauthorized-domain")}(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return dt()||it()||ut()}};var jr,Ur="@firebase/auth",$r="0.20.5";class xr{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),(null===(e=this.auth.currentUser)||void 0===e?void 0:e.uid)||null}async getToken(e){return this.assertAuthConfigured(),await this.auth._initializationPromise,this.auth.currentUser?{accessToken:await this.auth.currentUser.getIdToken(e)}:null}addAuthTokenListener(e){if(this.assertAuthConfigured(),this.internalListeners.has(e))return;const t=this.auth.onIdTokenChanged((t=>{var r;e((null===(r=t)||void 0===r?void 0:r.stsTokenManager.accessToken)||null)}));this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();const t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){we(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}jr="Browser",Z(new v("auth",((e,{options:t})=>{const r=e.getProvider("app").getImmediate(),n=e.getProvider("heartbeat"),{apiKey:i,authDomain:s}=r.options;return((e,r)=>{we(i&&!i.includes(":"),"invalid-api-key",{appName:e.name}),we(!(null==s?void 0:s.includes(":")),"argument-error",{appName:e.name});const n={apiKey:i,authDomain:s,clientPlatform:jr,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:ht(jr)},o=new ft(e,r,n);return function(e,t){const r=(null==t?void 0:t.persistence)||[],n=(Array.isArray(r)?r:[r]).map(Se);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(n,null==t?void 0:t.popupRedirectResolver)}(o,t),o})(r,n)}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,r)=>{e.getProvider("auth-internal").initialize()}))),Z(new v("auth-internal",(e=>{return t=mt(e.getProvider("auth").getImmediate()),new xr(t);var t}),"PRIVATE").setInstantiationMode("EXPLICIT")),ie(Ur,$r,void 0),ie(Ur,$r,"esm2017");var Fr=r(560),Br=r.n(Fr);const Vr=(e,t)=>!!e.properties&&!!e.properties[t]&&!!e.properties[t].$ref,Hr=(e,t)=>!!e.properties&&!!e.properties[t]&&Array.isArray(e.properties[t].anyOf)&&!!e.properties[t].anyOf[0]?.$ref&&"null"===e.properties[t].anyOf[1]?.type,zr=(e,t)=>e.properties&&e.properties[t]&&"array"===e.properties[t].type&&!!e.properties[t].items.$ref,Wr=(e,t)=>{const r=Array.isArray(t.inputProps);return Object.keys(e).reduce(((n,i)=>r&&!t.inputProps.includes(i)||Hr(t,i)&&null===e[i]?n:{...n,[i]:e[i]}),{})},qr=(e,t,r,n={},i={})=>{const s=n.primaryKey||"id",o=(e=>{const t=e.properties||{},r=e.inputProps||Object.keys(t),n=(e,r)=>{const n=t[e]||{},i=Array.isArray(n.type)?n.type[0]:n.type,s=!Array.isArray(n.type)||!n.type.includes("null");if(n.enum){if(!s&&!r)return;if(!n.enum.includes(r))return`${r} is not one of: ${n.enum.join(",")}`}switch(i){case"string":if(s&&!r)return"Field is required";break;case"integer":const e=parseInt(r,10);if(s&&Number.isNaN(e))return"Invalid number format"}};return{validate:e=>r.reduce(((t,r)=>{const i=n(r,e[r]);return i?{...t,[r]:i}:t}),{}),validateAttr:n}})(n),a=(e=>{const t=(r=e,[...r].reduce(((e,t)=>t===t.toUpperCase()?`${e}-${t.toLowerCase()}`:`${e}${t}`),""));var r;return(e,r)=>`/${t}${e?`/${encodeURIComponent(e)}`:""}${((e={})=>Object.keys(e).length?`?q=${JSON.stringify(e)}`:"")(r)}`})(r),c=(...r)=>((e,t)=>async(r,n={})=>{const i=t?await t.getIdToken():null,s=await fetch(`${e}${r}`,{mode:"cors",...n,headers:{...i&&{authorization:`Bearer ${i}`},...n.body&&{"content-type":"application/json"},...n.headers},...n.body&&{body:JSON.stringify(n.body)}}),o=await s.json();if(s.status>202)throw Object.assign(new Error(o?.message||`HTTP Error ${s.status}`),{status:s.status,code:o?.code,body:o});return o})(e,t.authUser)(...r),l=({data:e,...t})=>c(a(null,t),{method:"POST",body:Wr(e,n)}),u=({data:e,...t})=>{const{where:r,...i}=t;return c(a(r[s],i),{method:"PUT",body:Wr(e,n)})},d=e=>{if(!e)return e;const t=Object.keys(e).reduce(((t,r)=>{const s=n.properties[r]||{},{type:o,format:a,items:c}=s;if(c&&zr(n,r)){const n=c.$ref.split("/").pop().toLowerCase();return{...t,[r]:"function"==typeof i[n]?.parse?e[r].map((e=>i[n].parse(e))):e[r]}}const l=Vr(n,r)?s.$ref:Hr(n,r)?s.anyOf[0]?.$ref:null;if(l){const n=l.split("/").pop().toLowerCase();return{...t,[r]:i[n].parse(e[r])}}return{...t,[r]:"date-time"===a&&e[r]?new Date(e[r]):e[r]}}),{});return"function"==typeof n.parse?n.parse(t):t},h=Object.keys(n.properties||{}).reduce(((e,t)=>Vr(n,t)?Object.assign(e,{all:e.all.concat(t),oneToOne:e.oneToOne.concat(t),requiredOneToOne:e.requiredOneToOne.concat(t)}):Hr(n,t)?Object.assign(e,{all:e.all.concat(t),oneToOne:e.oneToOne.concat(t),optionalOneToOne:e.optionalOneToOne.concat(t)}):zr(n,t)?Object.assign(e,{all:e.all.concat(t),oneToMany:e.oneToMany.concat(t)}):e),{all:[],oneToOne:[],requiredOneToOne:[],optionalOneToOne:[],oneToMany:[]});return{get schema(){return{...n,primaryKey:s}},get relations(){return h},parse:d,validateAttr:o.validateAttr,validate:o.validate,findMany:e=>c(a(null,e)).then((e=>e.map(d))),findById:(e,t)=>c(a(e,t)).then(d),create:l,update:u,upsert:e=>e.where[s]?u({where:e.where,data:e.update}):l({data:e.create}),delete:e=>c(a(e),{method:"DELETE"}),stats:()=>c(a("_stats"))}},Gr=(e,t,r)=>Object.keys(r.properties).reduce(((n,i)=>{const s=r.properties[i].$ref.split("/").pop();return Object.assign(n,{[i]:qr(e,t,r.definitions[s].plural||`${i}s`,r.definitions[s],n)})}),{}),Jr=(e,t)=>Object.keys(e.definitions).reduce(((r,n)=>({...r,[n]:t[n]?{...e.definitions[n],...t[n],properties:Object.keys(e.definitions[n].properties).reduce(((r,i)=>({...r,[i]:{...e.definitions[n].properties[i],...(t[n].properties||{})[i]}})),t[n].properties||{})}:e.definitions[n]})),{}),Kr=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Country":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"contracts":{"type":"array","items":{"$ref":"#/definitions/Contract"}}}},"User":{"type":"object","properties":{"uid":{"type":"string"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"email":{"type":"string"},"firstName":{"type":"string"},"lastName":{"type":["string","null"]},"github":{"type":["string","null"]},"linkedin":{"type":["string","null"]},"bio":{"type":["string","null"]},"role":{"type":["string","null"],"enum":["staff","manager","finance","admin"]},"disabled":{"type":"boolean","default":false},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"signupCohort":{"anyOf":[{"$ref":"#/definitions/Cohort"},{"type":"null"}]},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}},"contractsAsCheckPilot":{"type":"array","items":{"$ref":"#/definitions/Contract"}},"contracts":{"type":"array","items":{"$ref":"#/definitions/Contract"}},"dropouts":{"type":"array","items":{"$ref":"#/definitions/Dropout"}},"gigs":{"type":"array","items":{"$ref":"#/definitions/Gig"}},"messages":{"type":"array","items":{"$ref":"#/definitions/Message"}},"students":{"type":"array","items":{"$ref":"#/definitions/Student"}}}},"Track":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"programs":{"type":"array","items":{"$ref":"#/definitions/Program"}}}},"Program":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"description":{"type":["string","null"]},"track":{"$ref":"#/definitions/Track"},"cohorts":{"type":"array","items":{"$ref":"#/definitions/Cohort"}},"stages":{"type":"array","items":{"$ref":"#/definitions/Stage"}}}},"Stage":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"name":{"type":"string"},"order":{"type":"integer"},"program":{"$ref":"#/definitions/Program"},"cohorts":{"type":"array","items":{"$ref":"#/definitions/Cohort"}}}},"Cohort":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"name":{"type":"string"},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"legacySlug":{"type":"string"},"vacancies":{"type":["integer","null"]},"placementDuration":{"type":["integer","null"]},"placementStart":{"type":["string","null"],"format":"date-time"},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"program":{"$ref":"#/definitions/Program"},"stage":{"$ref":"#/definitions/Stage"},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}},"links":{"type":"array","items":{"$ref":"#/definitions/CohortLink"}},"dropouts":{"type":"array","items":{"$ref":"#/definitions/Dropout"}},"gigs":{"type":"array","items":{"$ref":"#/definitions/Gig"}},"students":{"type":"array","items":{"$ref":"#/definitions/Student"}},"signupUsers":{"type":"array","items":{"$ref":"#/definitions/User"}}}},"Student":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"legacyStudentCode":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"}}},"CohortLink":{"type":"object","properties":{"id":{"type":"integer"},"url":{"type":"string"},"visibility":{"type":"string","enum":["public","members","staff","team","admin"]},"cohort":{"$ref":"#/definitions/Cohort"}}},"Dropout":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"date":{"type":"string","format":"date-time"},"reasonDetail":{"type":["string","null"]},"notes":{"type":["string","null"]},"staffSad":{"type":"boolean"},"covidRelated":{"type":["boolean","null"]},"reason":{"type":"string","enum":["dropout","noShow","invitedToLeave","changeCohort"]},"completedProjects":{"type":"integer"},"lastProject":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"}}},"Application":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"}}},"Contract":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"isEmployment":{"type":"boolean"},"feeAmount":{"type":"integer"},"hoursPerWeek":{"type":"integer"},"start":{"type":"string","format":"date-time"},"end":{"type":["string","null"],"format":"date-time"},"isTrial":{"type":"boolean","default":false},"source":{"type":["string","null"],"enum":["graduate","referral","jazzhr","web","linkedin","other"]},"checkPilot":{"anyOf":[{"$ref":"#/definitions/User"},{"type":"null"}]},"country":{"$ref":"#/definitions/Country"},"user":{"$ref":"#/definitions/User"},"gigs":{"type":"array","items":{"$ref":"#/definitions/Gig"}}}},"Gig":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"role":{"type":"string","enum":["bm","pdc","js","ux"]},"hoursPerWeek":{"type":"integer"},"start":{"type":"string","format":"date-time"},"end":{"type":["string","null"],"format":"date-time"},"cohort":{"$ref":"#/definitions/Cohort"},"contract":{"$ref":"#/definitions/Contract"},"user":{"$ref":"#/definitions/User"}}},"Message":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"key":{"type":"string"},"from":{"type":"string"},"to":{"type":"string"},"transport":{"type":"string","enum":["mandrill"]},"status":{"type":"string","default":"PENDING","enum":["PENDING","QUEUED","ERROR","SENT"]},"data":{"type":["number","string","boolean","object","array","null"]},"taskInfo":{"type":["number","string","boolean","object","array","null"]},"user":{"anyOf":[{"$ref":"#/definitions/User"},{"type":"null"}]},"logs":{"type":"array","items":{"$ref":"#/definitions/MessageLog"}}}},"MessageLog":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"statusText":{"type":["string","null"]},"message":{"$ref":"#/definitions/Message"}}}},"type":"object","properties":{"country":{"$ref":"#/definitions/Country"},"user":{"$ref":"#/definitions/User"},"track":{"$ref":"#/definitions/Track"},"program":{"$ref":"#/definitions/Program"},"stage":{"$ref":"#/definitions/Stage"},"cohort":{"$ref":"#/definitions/Cohort"},"student":{"$ref":"#/definitions/Student"},"cohortLink":{"$ref":"#/definitions/CohortLink"},"dropout":{"$ref":"#/definitions/Dropout"},"application":{"$ref":"#/definitions/Application"},"contract":{"$ref":"#/definitions/Contract"},"gig":{"$ref":"#/definitions/Gig"},"message":{"$ref":"#/definitions/Message"},"messageLog":{"$ref":"#/definitions/MessageLog"}}}'),Xr={Country:{primaryKey:"code",plural:"countries",searchProps:["code","name"]},User:{primaryKey:"uid",inputProps:["firstName","lastName","email","password","lang","github","linkedin","bio","role","signupCohort","disabled"],searchProps:["firstName","lastName","email"],getOptionLabel:({firstName:e,lastName:t,email:r})=>`${e} ${t} (${r})`,properties:{email:{inputType:"email"},bio:{inputType:"textarea"}},parse:e=>{const t=e.github?`https://github.com/${e.github}.png?size=`:`https://www.gravatar.com/avatar/${Br()(e.email)}?s=`;return{...e,fullName:`${e.firstName} ${e.lastName}`,avatar:e=>`${t}${e}`,isStaff:["staff","manager","finance","admin"].includes(e.role),isManager:["manager","finance","admin"].includes(e.role),isFinance:["finance","admin"].includes(e.role),isAdmin:"admin"===e.role}}},Track:{searchProps:["name"]},Program:{searchProps:["name"]},Stage:{searchProps:["name"]},Cohort:{inputProps:["program","stage","name","start","end","vacancies","placementStart","placementDuration"],searchProps:["name"],getOptionLabel:({id:e,name:t,stage:r})=>`${t}${r?` - ${r.name}`:""} (id: ${e})`,properties:{},parse:e=>{const t=Date.now(),r=e.start>t?"upcoming":e.end<t?"past":"active",n="upcoming"===r&&e.vacancies?e.vacancies:e._count?.students||e.students?.length||0;return{...e,status:r,size:n}}},Student:{inputProps:[],searchProps:[]},Dropout:{inputProps:["cohort","user","date","reason","reasonDetail","lastProject","completedProjects","notes","staffSad","covidRelated"],searchProps:["user.uid","user.firstName","user.lastName","user.email","cohort.name"]},Contract:{inputProps:["user","country","isEmployment","feeAmount","hoursPerWeek","start","end","isTrial","checkPilot","source"],searchProps:["user.firstName","user.lastName","user.email"],getOptionLabel:({id:e,user:t})=>`${t?.firstName} (id: ${e})`},Gig:{inputProps:["cohort","user","contract","role","hoursPerWeek","start","end"]},Application:{inputProps:["cohort","user"]}},Yr="https://raw.githubusercontent.com/Laboratoria/bootcamp",Qr=()=>fetch("https://api.github.com/repos/Laboratoria/bootcamp/releases/latest").then((e=>e.json())).then((({tag_name:e})=>e)),Zr=e=>t=>t.filter((t=>!(e.locale&&e.locale!==t.locale||e.track&&e.track!==t.track))),en=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Country":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"jobs":{"type":"array","items":{"$ref":"#/definitions/Job"}},"companies":{"type":"array","items":{"$ref":"#/definitions/Company"}}}},"Industry":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"name":{"type":"string"},"companies":{"type":"array","items":{"$ref":"#/definitions/Company"}}}},"CompanyCategoryRel":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"category":{"type":"string","enum":["Tech_Consultancy","Digital_Transformation","Agency","Startups","High_tech","Traditional_Consulting"]},"company":{"$ref":"#/definitions/Company"}}},"Company":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"name":{"type":"string"},"source":{"type":"string"},"sourceId":{"type":"string"},"size":{"type":["string","null"],"enum":["A_2_10","B_11_50","C_51_200","D_201_500","E_501_1000","F_1001_5000","G_5001_10000","H_10001_plus"]},"data":{"type":["number","string","boolean","object","array","null"]},"web":{"type":["string","null"]},"twitter":{"type":["string","null"]},"github":{"type":["string","null"]},"facebook":{"type":["string","null"]},"country":{"anyOf":[{"$ref":"#/definitions/Country"},{"type":"null"}]},"industry":{"anyOf":[{"$ref":"#/definitions/Industry"},{"type":"null"}]},"jobs":{"type":"array","items":{"$ref":"#/definitions/Job"}},"categories":{"type":"array","items":{"$ref":"#/definitions/CompanyCategoryRel"}}}},"Job":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"title":{"type":"string"},"publishedAt":{"type":"string","format":"date-time"},"publicUrl":{"type":["string","null"]},"modality":{"type":"string"},"location":{"type":["string","null"]},"source":{"type":"string"},"sourceId":{"type":"string"},"data":{"type":["number","string","boolean","object","array","null"]},"description":{"type":["string","null"]},"descriptionHTML":{"type":["string","null"]},"functions":{"type":["string","null"]},"functionsHTML":{"type":["string","null"]},"seniority":{"type":["string","null"]},"remote":{"type":["boolean","null"]},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"maxSalary":{"type":["integer","null"]},"minSalary":{"type":["integer","null"]},"tags":{"type":"array","items":{"type":"string"}},"company":{"$ref":"#/definitions/Company"},"country":{"anyOf":[{"$ref":"#/definitions/Country"},{"type":"null"}]},"validityReviews":{"type":"array","items":{"$ref":"#/definitions/JobValidityReview"}},"applications":{"type":"array","items":{"$ref":"#/definitions/JobApplication"}}}},"JobValidityReview":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":"string"},"isValid":{"type":"boolean"},"profileType":{"type":["string","null"],"enum":["design","front_end","angular","react","vue","back_end","full_stack","ux","other"]},"invalidReason":{"type":["string","null"],"enum":["unrelated","experience","qualifications","other"]},"comment":{"type":["string","null"]},"job":{"$ref":"#/definitions/Job"}}},"JobApplication":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"uid":{"type":"string"},"status":{"type":"string","default":"pending","enum":["pending","applied","interview","challenge","followup","hired","not_hired"]},"recommendedBy":{"type":["string","null"]},"job":{"$ref":"#/definitions/Job"}}}},"type":"object","properties":{"country":{"$ref":"#/definitions/Country"},"industry":{"$ref":"#/definitions/Industry"},"companyCategoryRel":{"$ref":"#/definitions/CompanyCategoryRel"},"company":{"$ref":"#/definitions/Company"},"job":{"$ref":"#/definitions/Job"},"jobValidityReview":{"$ref":"#/definitions/JobValidityReview"},"jobApplication":{"$ref":"#/definitions/JobApplication"}}}'),tn={Country:{plural:"countries"},Job:{},Company:{plural:"companies"}},rn=({firebaseApiKey:e="AIzaSyAXbaEbpq8NOfn0r8mIrcoHvoGRkJThwdc",firebaseProject:t="laboratoria-la",coreApiUrl:r="https://us-central1-outpost-272720.cloudfunctions.net/core-api",jobsApiUrl:n="https://us-central1-outpost-272720.cloudfunctions.net/jobs-api"}={})=>{const i=function(e,t={}){"object"!=typeof t&&(t={name:t});const r=Object.assign({name:"[DEFAULT]",automaticDataCollectionEnabled:!1},t),n=r.name;if("string"!=typeof n||!n)throw te.create("bad-app-name",{appName:String(n)});const i=X.get(n);if(i){if(u(e,i.options)&&u(r,i.config))return i;throw te.create("duplicate-app",{appName:n})}const s=new I(n);for(const e of Y.values())s.addComponent(e);const o=new re(e,r,s);return X.set(n,o),o}({apiKey:e,authDomain:`${t}.firebaseapp.com`,databaseURL:`https://${t}.firebaseio.com`,projectId:t}),s=function(e=function(e="[DEFAULT]"){const t=X.get(e);if(!t)throw te.create("no-app",{appName:e});return t}()){const t=ee(e,"auth");return t.isInitialized()?t.getImmediate():function(e,t){const r=ee(e,"auth");if(r.isInitialized()){const e=r.getImmediate();if(u(r.getOptions(),null!=t?t:{}))return e;be(e,"already-initialized")}return r.initialize({options:t})}(e,{popupRedirectResolver:Mr,persistence:[nr,Ft,Vt]})}(i),o={authUser:void 0,user:void 0},a=((e,t)=>Gr(e,t,{...Kr,definitions:Jr(Kr,Xr)}))(r,o),c=((e,t)=>Gr(e,t,{...en,definitions:Jr(en,tn)}))(n,o),l={onChange:e=>{return t=t=>{if(!t)return Object.assign(o,{authUser:null,user:null}),e(o);Object.assign(o,{authUser:t}),a.user.findById(t.uid).then((t=>{Object.assign(o,{user:t}),e(o)})).catch((t=>{console.error(t),Object.assign(o,{authUser:null,user:null}),e(o)}))},y(s).onAuthStateChanged(t,undefined,undefined);var t},signIn:(e,t)=>function(e,t,r){return async function(e,t){return Mt(mt(e),t)}(y(e),kt.credential(t,r))}(s,e,t),signOut:()=>y(s).signOut(),sendPasswordResetEmail:e=>jt(s,e)};return{...c,projects:{findMany:(e={})=>(async e=>fetch(`${Yr}/${e||await Qr()}/dist/projects.json`).then((e=>e.json())))(e.tag).then(Zr(e)),findById:(e,t={})=>(async(e,t)=>fetch(`${Yr}/${t||await Qr()}/dist/projects/${e}.json`).then((e=>e.json())))(e,t.tag)},topics:{findMany:(e={})=>(async e=>fetch(`${Yr}/${e||await Qr()}/dist/topics.json`).then((e=>e.json())))(e.tag).then(Zr(e)),findById:(e,t={})=>(async(e,t)=>fetch(`${Yr}/${t||await Qr()}/dist/topics/${e}.json`).then((e=>e.json())))(e,t.tag)},learningObjectives:{findMany:(e={})=>(async e=>fetch(`${Yr}/${e||await Qr()}/dist/learning-objectives.json`).then((e=>e.json())))(e.tag)},...a,auth:l,firebaseApp:i}}})(),n})()));
@@ -0,0 +1,101 @@
1
+ /**
2
+ * @license
3
+ * Copyright 2017 Google LLC
4
+ *
5
+ * Licensed under the Apache License, Version 2.0 (the "License");
6
+ * you may not use this file except in compliance with the License.
7
+ * You may obtain a copy of the License at
8
+ *
9
+ * http://www.apache.org/licenses/LICENSE-2.0
10
+ *
11
+ * Unless required by applicable law or agreed to in writing, software
12
+ * distributed under the License is distributed on an "AS IS" BASIS,
13
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14
+ * See the License for the specific language governing permissions and
15
+ * limitations under the License.
16
+ */
17
+
18
+ /**
19
+ * @license
20
+ * Copyright 2019 Google LLC
21
+ *
22
+ * Licensed under the Apache License, Version 2.0 (the "License");
23
+ * you may not use this file except in compliance with the License.
24
+ * You may obtain a copy of the License at
25
+ *
26
+ * http://www.apache.org/licenses/LICENSE-2.0
27
+ *
28
+ * Unless required by applicable law or agreed to in writing, software
29
+ * distributed under the License is distributed on an "AS IS" BASIS,
30
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
31
+ * See the License for the specific language governing permissions and
32
+ * limitations under the License.
33
+ */
34
+
35
+ /**
36
+ * @license
37
+ * Copyright 2020 Google LLC
38
+ *
39
+ * Licensed under the Apache License, Version 2.0 (the "License");
40
+ * you may not use this file except in compliance with the License.
41
+ * You may obtain a copy of the License at
42
+ *
43
+ * http://www.apache.org/licenses/LICENSE-2.0
44
+ *
45
+ * Unless required by applicable law or agreed to in writing, software
46
+ * distributed under the License is distributed on an "AS IS" BASIS,
47
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
48
+ * See the License for the specific language governing permissions and
49
+ * limitations under the License.
50
+ */
51
+
52
+ /**
53
+ * @license
54
+ * Copyright 2020 Google LLC.
55
+ *
56
+ * Licensed under the Apache License, Version 2.0 (the "License");
57
+ * you may not use this file except in compliance with the License.
58
+ * You may obtain a copy of the License at
59
+ *
60
+ * http://www.apache.org/licenses/LICENSE-2.0
61
+ *
62
+ * Unless required by applicable law or agreed to in writing, software
63
+ * distributed under the License is distributed on an "AS IS" BASIS,
64
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
65
+ * See the License for the specific language governing permissions and
66
+ * limitations under the License.
67
+ */
68
+
69
+ /**
70
+ * @license
71
+ * Copyright 2021 Google LLC
72
+ *
73
+ * Licensed under the Apache License, Version 2.0 (the "License");
74
+ * you may not use this file except in compliance with the License.
75
+ * You may obtain a copy of the License at
76
+ *
77
+ * http://www.apache.org/licenses/LICENSE-2.0
78
+ *
79
+ * Unless required by applicable law or agreed to in writing, software
80
+ * distributed under the License is distributed on an "AS IS" BASIS,
81
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
82
+ * See the License for the specific language governing permissions and
83
+ * limitations under the License.
84
+ */
85
+
86
+ /**
87
+ * @license
88
+ * Copyright 2022 Google LLC
89
+ *
90
+ * Licensed under the Apache License, Version 2.0 (the "License");
91
+ * you may not use this file except in compliance with the License.
92
+ * You may obtain a copy of the License at
93
+ *
94
+ * http://www.apache.org/licenses/LICENSE-2.0
95
+ *
96
+ * Unless required by applicable law or agreed to in writing, software
97
+ * distributed under the License is distributed on an "AS IS" BASIS,
98
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
99
+ * See the License for the specific language governing permissions and
100
+ * limitations under the License.
101
+ */
@@ -0,0 +1,4 @@
1
+ <script type="module">
2
+ import { createApp } from '../dist/laboratoria-sdk-esm.js';
3
+ console.log(createApp());
4
+ </script>
@@ -0,0 +1,4 @@
1
+ <script src="../dist/laboratoria-sdk-umd.js"></script>
2
+ <script>
3
+ console.log(laboratoria.createApp());
4
+ </script>
package/package.json CHANGED
@@ -1,23 +1,25 @@
1
1
  {
2
2
  "name": "@laboratoria/sdk-js",
3
- "version": "2.1.1",
3
+ "version": "2.2.0",
4
4
  "description": "Laboratoria JavaScript (browser) SDK",
5
+ "license": "MIT",
5
6
  "scripts": {
6
7
  "test": "jest --verbose --coverage",
8
+ "build": "rm -rf dist && webpack --mode production",
9
+ "watch": "webpack --mode development --watch",
7
10
  "changelog": "git log $(git describe --tags --abbrev=0)..HEAD --oneline --format=\"* %h %s (%an)\""
8
11
  },
9
- "license": "MIT",
10
12
  "dependencies": {
11
13
  "blueimp-md5": "^2.19.0",
12
- "firebase": "^9.8.4"
14
+ "firebase": "^9.9.2"
13
15
  },
14
16
  "devDependencies": {
15
- "@babel/core": "^7.18.6",
17
+ "@babel/core": "^7.18.10",
16
18
  "@babel/plugin-transform-modules-commonjs": "^7.18.6",
17
- "babel-jest": "^28.1.2",
18
- "jest": "^28.1.2",
19
- "jest-environment-jsdom": "^28.1.2",
20
- "webpack": "^5.73.0",
19
+ "babel-jest": "^28.1.3",
20
+ "jest": "^28.1.3",
21
+ "jest-environment-jsdom": "^28.1.3",
22
+ "webpack": "^5.74.0",
21
23
  "webpack-cli": "^4.10.0"
22
24
  },
23
25
  "jest": {
@@ -0,0 +1,28 @@
1
+ import path from 'path';
2
+
3
+ export default [
4
+ {
5
+ entry: './index.js',
6
+ output: {
7
+ path: path.resolve('./dist'),
8
+ filename: 'laboratoria-sdk-umd.js',
9
+ library: {
10
+ name: 'laboratoria',
11
+ type: 'umd',
12
+ },
13
+ },
14
+ },
15
+ {
16
+ entry: './index.js',
17
+ experiments: {
18
+ outputModule: true,
19
+ },
20
+ output: {
21
+ path: path.resolve('./dist'),
22
+ filename: 'laboratoria-sdk-esm.js',
23
+ library: {
24
+ type: 'module',
25
+ },
26
+ },
27
+ }
28
+ ];