@laboratoria/sdk-js 5.3.1 → 6.0.0-beta.0
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/laboratoria-sdk-es.js +9017 -0
- package/dist/laboratoria-sdk-umd.js +1486 -2
- package/package.json +23 -22
- package/.babelrc +0 -5
- package/dist/laboratoria-sdk-esm.js +0 -2
- package/dist/laboratoria-sdk-esm.js.LICENSE.txt +0 -101
- package/dist/laboratoria-sdk-umd.js.LICENSE.txt +0 -101
- package/examples/esm.html +0 -4
- package/examples/umd.html +0 -4
- package/index.js +0 -64
- package/lib/client.js +0 -25
- package/lib/core.js +0 -373
- package/lib/curriculum.js +0 -59
- package/lib/model.js +0 -343
- package/lib/roles.js +0 -10
- package/lib/util.js +0 -68
- package/schemas/core.json +0 -1945
- package/webpack.config.mjs +0 -28
@@ -1,2 +1,1486 @@
|
|
1
|
-
|
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,n){var r;!function(i){"use strict";function s(e,t){var n=(65535&e)+(65535&t);return(e>>16)+(t>>16)+(n>>16)<<16|65535&n}function o(e,t,n,r,i,o){return s((a=s(s(t,e),s(r,o)))<<(c=i)|a>>>32-c,n);var a,c}function a(e,t,n,r,i,s,a){return o(t&n|~t&r,e,t,i,s,a)}function c(e,t,n,r,i,s,a){return o(t&r|n&~r,e,t,i,s,a)}function l(e,t,n,r,i,s,a){return o(t^n^r,e,t,i,s,a)}function u(e,t,n,r,i,s,a){return o(n^(t|~r),e,t,i,s,a)}function d(e,t){var n,r,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(n=0;n<e.length;n+=16)r=h,i=p,o=f,d=m,h=a(h,p,f,m,e[n],7,-680876936),m=a(m,h,p,f,e[n+1],12,-389564586),f=a(f,m,h,p,e[n+2],17,606105819),p=a(p,f,m,h,e[n+3],22,-1044525330),h=a(h,p,f,m,e[n+4],7,-176418897),m=a(m,h,p,f,e[n+5],12,1200080426),f=a(f,m,h,p,e[n+6],17,-1473231341),p=a(p,f,m,h,e[n+7],22,-45705983),h=a(h,p,f,m,e[n+8],7,1770035416),m=a(m,h,p,f,e[n+9],12,-1958414417),f=a(f,m,h,p,e[n+10],17,-42063),p=a(p,f,m,h,e[n+11],22,-1990404162),h=a(h,p,f,m,e[n+12],7,1804603682),m=a(m,h,p,f,e[n+13],12,-40341101),f=a(f,m,h,p,e[n+14],17,-1502002290),h=c(h,p=a(p,f,m,h,e[n+15],22,1236535329),f,m,e[n+1],5,-165796510),m=c(m,h,p,f,e[n+6],9,-1069501632),f=c(f,m,h,p,e[n+11],14,643717713),p=c(p,f,m,h,e[n],20,-373897302),h=c(h,p,f,m,e[n+5],5,-701558691),m=c(m,h,p,f,e[n+10],9,38016083),f=c(f,m,h,p,e[n+15],14,-660478335),p=c(p,f,m,h,e[n+4],20,-405537848),h=c(h,p,f,m,e[n+9],5,568446438),m=c(m,h,p,f,e[n+14],9,-1019803690),f=c(f,m,h,p,e[n+3],14,-187363961),p=c(p,f,m,h,e[n+8],20,1163531501),h=c(h,p,f,m,e[n+13],5,-1444681467),m=c(m,h,p,f,e[n+2],9,-51403784),f=c(f,m,h,p,e[n+7],14,1735328473),h=l(h,p=c(p,f,m,h,e[n+12],20,-1926607734),f,m,e[n+5],4,-378558),m=l(m,h,p,f,e[n+8],11,-2022574463),f=l(f,m,h,p,e[n+11],16,1839030562),p=l(p,f,m,h,e[n+14],23,-35309556),h=l(h,p,f,m,e[n+1],4,-1530992060),m=l(m,h,p,f,e[n+4],11,1272893353),f=l(f,m,h,p,e[n+7],16,-155497632),p=l(p,f,m,h,e[n+10],23,-1094730640),h=l(h,p,f,m,e[n+13],4,681279174),m=l(m,h,p,f,e[n],11,-358537222),f=l(f,m,h,p,e[n+3],16,-722521979),p=l(p,f,m,h,e[n+6],23,76029189),h=l(h,p,f,m,e[n+9],4,-640364487),m=l(m,h,p,f,e[n+12],11,-421815835),f=l(f,m,h,p,e[n+15],16,530742520),h=u(h,p=l(p,f,m,h,e[n+2],23,-995338651),f,m,e[n],6,-198630844),m=u(m,h,p,f,e[n+7],10,1126891415),f=u(f,m,h,p,e[n+14],15,-1416354905),p=u(p,f,m,h,e[n+5],21,-57434055),h=u(h,p,f,m,e[n+12],6,1700485571),m=u(m,h,p,f,e[n+3],10,-1894986606),f=u(f,m,h,p,e[n+10],15,-1051523),p=u(p,f,m,h,e[n+1],21,-2054922799),h=u(h,p,f,m,e[n+8],6,1873313359),m=u(m,h,p,f,e[n+15],10,-30611744),f=u(f,m,h,p,e[n+6],15,-1560198380),p=u(p,f,m,h,e[n+13],21,1309151649),h=u(h,p,f,m,e[n+4],6,-145523070),m=u(m,h,p,f,e[n+11],10,-1120210379),f=u(f,m,h,p,e[n+2],15,718787259),p=u(p,f,m,h,e[n+9],21,-343485551),h=s(h,r),p=s(p,i),f=s(f,o),m=s(m,d);return[h,p,f,m]}function h(e){var t,n="",r=32*e.length;for(t=0;t<r;t+=8)n+=String.fromCharCode(e[t>>5]>>>t%32&255);return n}function p(e){var t,n=[];for(n[(e.length>>2)-1]=void 0,t=0;t<n.length;t+=1)n[t]=0;var r=8*e.length;for(t=0;t<r;t+=8)n[t>>5]|=(255&e.charCodeAt(t/8))<<t%32;return n}function f(e){var t,n,r="0123456789abcdef",i="";for(n=0;n<e.length;n+=1)t=e.charCodeAt(n),i+=r.charAt(t>>>4&15)+r.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 n,r,i=p(e),s=[],o=[];for(s[15]=o[15]=void 0,i.length>16&&(i=d(i,8*e.length)),n=0;n<16;n+=1)s[n]=909522486^i[n],o[n]=1549556828^i[n];return r=d(s.concat(p(t)),512+8*t.length),h(d(o.concat(r),640))}(m(e),m(t))}function v(e,t,n){return t?n?y(t,e):f(y(t,e)):n?g(e):f(g(e))}void 0===(r=function(){return v}.call(t,n,t,e))||(e.exports=r)}()}},t={};function n(r){var i=t[r];if(void 0!==i)return i.exports;var s=t[r]={exports:{}};return e[r].call(s.exports,s,s.exports,n),s.exports}n.n=e=>{var t=e&&e.__esModule?()=>e.default:()=>e;return n.d(t,{a:t}),t},n.d=(e,t)=>{for(var r in t)n.o(t,r)&&!n.o(e,r)&&Object.defineProperty(e,r,{enumerable:!0,get:t[r]})},n.g=function(){if("object"==typeof globalThis)return globalThis;try{return this||new Function("return this")()}catch(e){if("object"==typeof window)return window}}(),n.o=(e,t)=>Object.prototype.hasOwnProperty.call(e,t),n.r=e=>{"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})};var r={};return(()=>{"use strict";n.r(r),n.d(r,{createApp:()=>Dr,formatCurrency:()=>Or,formatDate:()=>Er,formatDateTime:()=>Sr,formatMonth:()=>Cr,formatTime:()=>kr,getAgeAt:()=>Rr,loadFromLocalStorage:()=>Nr,parseCurrency:()=>Pr});const e=function(e){const t=[];let n=0;for(let r=0;r<e.length;r++){let i=e.charCodeAt(r);i<128?t[n++]=i:i<2048?(t[n++]=i>>6|192,t[n++]=63&i|128):55296==(64512&i)&&r+1<e.length&&56320==(64512&e.charCodeAt(r+1))?(i=65536+((1023&i)<<10)+(1023&e.charCodeAt(++r)),t[n++]=i>>18|240,t[n++]=i>>12&63|128,t[n++]=i>>6&63|128,t[n++]=63&i|128):(t[n++]=i>>12|224,t[n++]=i>>6&63|128,t[n++]=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 n=t?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];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)),r.push(n[l],n[u],n[d],n[h])}return r.join("")},encodeString(t,n){return this.HAS_NATIVE_SUPPORT&&!n?btoa(t):this.encodeByteArray(e(t),n)},decodeString(e,t){return this.HAS_NATIVE_SUPPORT&&!t?atob(e):function(e){const t=[];let n=0,r=0;for(;n<e.length;){const i=e[n++];if(i<128)t[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=e[n++];t[r++]=String.fromCharCode((31&i)<<6|63&s)}else if(i>239&&i<365){const s=((7&i)<<18|(63&e[n++])<<12|(63&e[n++])<<6|63&e[n++])-65536;t[r++]=String.fromCharCode(55296+(s>>10)),t[r++]=String.fromCharCode(56320+(1023&s))}else{const s=e[n++],o=e[n++];t[r++]=String.fromCharCode((15&i)<<12|(63&s)<<6|63&o)}}return t.join("")}(this.decodeStringToByteArray(e,t))},decodeStringToByteArray(e,t){this.init_();const n=t?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let t=0;t<e.length;){const s=n[e.charAt(t++)],o=t<e.length?n[e.charAt(t)]:0;++t;const a=t<e.length?n[e.charAt(t)]:64;++t;const c=t<e.length?n[e.charAt(t)]:64;if(++t,null==s||null==o||null==a||null==c)throw new i;const l=s<<2|o>>4;if(r.push(l),64!==a){const e=o<<4&240|a>>2;if(r.push(e),64!==c){const e=a<<6&192|c;r.push(e)}}}return r},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)}}};class i extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const s=function(n){return function(n){const r=e(n);return t.encodeByteArray(r,!0)}(n).replace(/\./g,"")},o=function(e){try{return t.decodeString(e,!0)}catch(e){console.error("base64Decode failed: ",e)}return null},a=()=>{try{return function(){if("undefined"!=typeof self)return self;if("undefined"!=typeof window)return window;if(void 0!==n.g)return n.g;throw new Error("Unable to locate global object.")}().__FIREBASE_DEFAULTS__||(()=>{if("undefined"==typeof process||void 0===process.env)return;const e=process.env.__FIREBASE_DEFAULTS__;return e?JSON.parse(e):void 0})()||(()=>{if("undefined"==typeof document)return;let e;try{e=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch(e){return}const t=e&&o(e[1]);return t&&JSON.parse(t)})()}catch(e){return void console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`)}},c=()=>{var e;return null===(e=a())||void 0===e?void 0:e.config},l=e=>{var t;return null===(t=a())||void 0===t?void 0:t[`_${e}`]};class u{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise(((e,t)=>{this.resolve=e,this.reject=t}))}wrapCallback(e){return(t,n)=>{t?this.reject(t):this.resolve(n),"function"==typeof e&&(this.promise.catch((()=>{})),1===e.length?e(t):e(t,n))}}}function d(){return"undefined"!=typeof navigator&&"string"==typeof navigator.userAgent?navigator.userAgent:""}class h extends Error{constructor(e,t,n){super(t),this.code=e,this.customData=n,this.name="FirebaseError",Object.setPrototypeOf(this,h.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,p.prototype.create)}}class p{constructor(e,t,n){this.service=e,this.serviceName=t,this.errors=n}create(e,...t){const n=t[0]||{},r=`${this.service}/${e}`,i=this.errors[e],s=i?function(e,t){return e.replace(f,((e,n)=>{const r=t[n];return null!=r?String(r):`<${n}?>`}))}(i,n):"Error",o=`${this.serviceName}: ${s} (${r}).`;return new h(r,o,n)}}const f=/\{\$([^}]+)}/g;function m(e,t){if(e===t)return!0;const n=Object.keys(e),r=Object.keys(t);for(const i of n){if(!r.includes(i))return!1;const n=e[i],s=t[i];if(g(n)&&g(s)){if(!m(n,s))return!1}else if(n!==s)return!1}for(const e of r)if(!n.includes(e))return!1;return!0}function g(e){return null!==e&&"object"==typeof e}function y(e){const t=[];for(const[n,r]of Object.entries(e))Array.isArray(r)?r.forEach((e=>{t.push(encodeURIComponent(n)+"="+encodeURIComponent(e))})):t.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return t.length?"&"+t.join("&"):""}function v(e){const t={};return e.replace(/^\?/,"").split("&").forEach((e=>{if(e){const[n,r]=e.split("=");t[decodeURIComponent(n)]=decodeURIComponent(r)}})),t}function b(e){const t=e.indexOf("?");if(!t)return"";const n=e.indexOf("#",t);return e.substring(t,n>0?n:void 0)}class _{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,n){let r;if(void 0===e&&void 0===t&&void 0===n)throw new Error("Missing Observer.");r=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:n},void 0===r.next&&(r.next=I),void 0===r.error&&(r.error=I),void 0===r.complete&&(r.complete=I);const i=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then((()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch(e){}})),this.observers.push(r),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 I(){}function w(e){return e&&e._delegate?e._delegate:e}class T{constructor(e,t,n){this.name=e,this.instanceFactory=t,this.type=n,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 E="[DEFAULT]";class k{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 u;if(this.instancesDeferred.set(t,e),this.isInitialized(t)||this.shouldAutoInitialize())try{const n=this.getOrInitializeService({instanceIdentifier:t});n&&e.resolve(n)}catch(e){}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const n=this.normalizeInstanceIdentifier(null==e?void 0:e.identifier),r=null!==(t=null==e?void 0:e.optional)&&void 0!==t&&t;if(!this.isInitialized(n)&&!this.shouldAutoInitialize()){if(r)return null;throw Error(`Service ${this.name} is not available`)}try{return this.getOrInitializeService({instanceIdentifier:n})}catch(e){if(r)return null;throw e}}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:E})}catch(e){}for(const[e,t]of this.instancesDeferred.entries()){const n=this.normalizeInstanceIdentifier(e);try{const e=this.getOrInitializeService({instanceIdentifier:n});t.resolve(e)}catch(e){}}}}clearInstance(e=E){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=E){return this.instances.has(e)}getOptions(e=E){return this.instancesOptions.get(e)||{}}initialize(e={}){const{options:t={}}=e,n=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(n))throw Error(`${this.name}(${n}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);const r=this.getOrInitializeService({instanceIdentifier:n,options:t});for(const[e,t]of this.instancesDeferred.entries())n===this.normalizeInstanceIdentifier(e)&&t.resolve(r);return r}onInit(e,t){var n;const r=this.normalizeInstanceIdentifier(t),i=null!==(n=this.onInitCallbacks.get(r))&&void 0!==n?n:new Set;i.add(e),this.onInitCallbacks.set(r,i);const s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,t){const n=this.onInitCallbacks.get(t);if(n)for(const r of n)try{r(e,t)}catch(e){}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let n=this.instances.get(e);if(!n&&this.component&&(n=this.component.instanceFactory(this.container,{instanceIdentifier:(r=e,r===E?void 0:r),options:t}),this.instances.set(e,n),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(n,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,n)}catch(e){}var r;return n||null}normalizeInstanceIdentifier(e=E){return this.component?this.component.multipleInstances?e:E:e}shouldAutoInitialize(){return!!this.component&&"EXPLICIT"!==this.component.instantiationMode}}class S{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 k(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}const A=[];var C;!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"}(C||(C={}));const R={debug:C.DEBUG,verbose:C.VERBOSE,info:C.INFO,warn:C.WARN,error:C.ERROR,silent:C.SILENT},O=C.INFO,P={[C.DEBUG]:"log",[C.VERBOSE]:"log",[C.INFO]:"info",[C.WARN]:"warn",[C.ERROR]:"error"},N=(e,t,...n)=>{if(t<e.logLevel)return;const r=(new Date).toISOString(),i=P[t];if(!i)throw new Error(`Attempted to log a message with an invalid logType (value: ${t})`);console[i](`[${r}] ${e.name}:`,...n)};class D{constructor(e){this.name=e,this._logLevel=O,this._logHandler=N,this._userLogHandler=null,A.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in C))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel="string"==typeof e?R[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if("function"!=typeof e)throw new TypeError("Value assigned to `logHandler` must be a function");this._logHandler=e}get userLogHandler(){return this._userLogHandler}set userLogHandler(e){this._userLogHandler=e}debug(...e){this._userLogHandler&&this._userLogHandler(this,C.DEBUG,...e),this._logHandler(this,C.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,C.VERBOSE,...e),this._logHandler(this,C.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,C.INFO,...e),this._logHandler(this,C.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,C.WARN,...e),this._logHandler(this,C.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,C.ERROR,...e),this._logHandler(this,C.ERROR,...e)}}const L=(e,t)=>t.some((t=>e instanceof t));let $,M;const j=new WeakMap,U=new WeakMap,F=new WeakMap,x=new WeakMap,B=new WeakMap;let V={get(e,t,n){if(e instanceof IDBTransaction){if("done"===t)return U.get(e);if("objectStoreNames"===t)return e.objectStoreNames||F.get(e);if("store"===t)return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return W(e[t])},set:(e,t,n)=>(e[t]=n,!0),has:(e,t)=>e instanceof IDBTransaction&&("done"===t||"store"===t)||t in e};function H(e){return"function"==typeof e?(t=e)!==IDBDatabase.prototype.transaction||"objectStoreNames"in IDBTransaction.prototype?(M||(M=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])).includes(t)?function(...e){return t.apply(z(this),e),W(j.get(this))}:function(...e){return W(t.apply(z(this),e))}:function(e,...n){const r=t.call(z(this),e,...n);return F.set(r,e.sort?e.sort():[e]),W(r)}:(e instanceof IDBTransaction&&function(e){if(U.has(e))return;const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("complete",i),e.removeEventListener("error",s),e.removeEventListener("abort",s)},i=()=>{t(),r()},s=()=>{n(e.error||new DOMException("AbortError","AbortError")),r()};e.addEventListener("complete",i),e.addEventListener("error",s),e.addEventListener("abort",s)}));U.set(e,t)}(e),L(e,$||($=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction]))?new Proxy(e,V):e);var t}function W(e){if(e instanceof IDBRequest)return function(e){const t=new Promise(((t,n)=>{const r=()=>{e.removeEventListener("success",i),e.removeEventListener("error",s)},i=()=>{t(W(e.result)),r()},s=()=>{n(e.error),r()};e.addEventListener("success",i),e.addEventListener("error",s)}));return t.then((t=>{t instanceof IDBCursor&&j.set(t,e)})).catch((()=>{})),B.set(t,e),t}(e);if(x.has(e))return x.get(e);const t=H(e);return t!==e&&(x.set(e,t),B.set(t,e)),t}const z=e=>B.get(e),q=["get","getKey","getAll","getAllKeys","count"],K=["put","add","delete","clear"],G=new Map;function J(e,t){if(!(e instanceof IDBDatabase)||t in e||"string"!=typeof t)return;if(G.get(t))return G.get(t);const n=t.replace(/FromIndex$/,""),r=t!==n,i=K.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!i&&!q.includes(n))return;const s=async function(e,...t){const s=this.transaction(e,i?"readwrite":"readonly");let o=s.store;return r&&(o=o.index(t.shift())),(await Promise.all([o[n](...t),i&&s.done]))[0]};return G.set(t,s),s}var Y;Y=V,V={...Y,get:(e,t,n)=>J(e,t)||Y.get(e,t,n),has:(e,t)=>!!J(e,t)||Y.has(e,t)};class X{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 Z="@firebase/app",Q="0.9.15",ee=new D("@firebase/app"),te="[DEFAULT]",ne={[Z]:"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"},re=new Map,ie=new Map;function se(e,t){try{e.container.addComponent(t)}catch(n){ee.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`,n)}}function oe(e){const t=e.name;if(ie.has(t))return ee.debug(`There were multiple attempts to register component ${t}.`),!1;ie.set(t,e);for(const t of re.values())se(t,e);return!0}function ae(e,t){const n=e.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),e.container.getProvider(t)}const ce=new p("app","Firebase",{"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."});class le{constructor(e,t,n){this._isDeleted=!1,this._options=Object.assign({},e),this._config=Object.assign({},t),this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=n,this.container.addComponent(new T("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 ce.create("app-deleted",{appName:this._name})}}const ue="10.1.0";function de(e,t={}){let n=e;"object"!=typeof t&&(t={name:t});const r=Object.assign({name:te,automaticDataCollectionEnabled:!1},t),i=r.name;if("string"!=typeof i||!i)throw ce.create("bad-app-name",{appName:String(i)});if(n||(n=c()),!n)throw ce.create("no-options");const s=re.get(i);if(s){if(m(n,s.options)&&m(r,s.config))return s;throw ce.create("duplicate-app",{appName:i})}const o=new S(i);for(const e of ie.values())o.addComponent(e);const a=new le(n,r,o);return re.set(i,a),a}function he(e,t,n){var r;let i=null!==(r=ne[e])&&void 0!==r?r:e;n&&(i+=`-${n}`);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 ee.warn(e.join(" "))}oe(new T(`${i}-version`,(()=>({library:i,version:t})),"VERSION"))}const pe="firebase-heartbeat-database",fe=1,me="firebase-heartbeat-store";let ge=null;function ye(){return ge||(ge=function(e,t,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(e,t),a=W(o);return r&&o.addEventListener("upgradeneeded",(e=>{r(W(o.result),e.oldVersion,e.newVersion,W(o.transaction),e)})),n&&o.addEventListener("blocked",(e=>n(e.oldVersion,e.newVersion,e))),a.then((e=>{s&&e.addEventListener("close",(()=>s())),i&&e.addEventListener("versionchange",(e=>i(e.oldVersion,e.newVersion,e)))})).catch((()=>{})),a}(pe,fe,{upgrade:(e,t)=>{0===t&&e.createObjectStore(me)}}).catch((e=>{throw ce.create("idb-open",{originalErrorMessage:e.message})}))),ge}async function ve(e,t){try{const n=(await ye()).transaction(me,"readwrite"),r=n.objectStore(me);await r.put(t,be(e)),await n.done}catch(e){if(e instanceof h)ee.warn(e.message);else{const t=ce.create("idb-set",{originalErrorMessage:null==e?void 0:e.message});ee.warn(t.message)}}}function be(e){return`${e.name}!${e.options.appId}`}class _e{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new we(t),this._heartbeatsCachePromise=this._storage.read().then((e=>(this._heartbeatsCache=e,e)))}async triggerHeartbeat(){const e=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),t=Ie();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=Ie(),{heartbeatsToSend:t,unsentEntries:n}=function(e,t=1024){const n=[];let r=e.slice();for(const i of e){const e=n.find((e=>e.agent===i.agent));if(e){if(e.dates.push(i.date),Te(n)>t){e.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Te(n)>t){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}(this._heartbeatsCache.heartbeats),r=s(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,n.length>0?(this._heartbeatsCache.heartbeats=n,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}}function Ie(){return(new Date).toISOString().substring(0,10)}class we{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return!!function(){try{return"object"==typeof indexedDB}catch(e){return!1}}()&&new Promise(((e,t)=>{try{let n=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),e(!0)},i.onupgradeneeded=()=>{n=!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){try{const t=await ye();return await t.transaction(me).objectStore(me).get(be(e))}catch(e){if(e instanceof h)ee.warn(e.message);else{const t=ce.create("idb-get",{originalErrorMessage:null==e?void 0:e.message});ee.warn(t.message)}}}(this.app)||{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ve(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:e.heartbeats})}}async add(e){var t;if(await this._canUseIndexedDBPromise){const n=await this.read();return ve(this.app,{lastSentHeartbeatDate:null!==(t=e.lastSentHeartbeatDate)&&void 0!==t?t:n.lastSentHeartbeatDate,heartbeats:[...n.heartbeats,...e.heartbeats]})}}}function Te(e){return s(JSON.stringify({version:2,heartbeats:e})).length}function Ee(e,t){var n={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(n[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var i=0;for(r=Object.getOwnPropertySymbols(e);i<r.length;i++)t.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(e,r[i])&&(n[r[i]]=e[r[i]])}return n}oe(new T("platform-logger",(e=>new X(e)),"PRIVATE")),oe(new T("heartbeat",(e=>new _e(e)),"PRIVATE")),he(Z,Q,""),he(Z,Q,"esm2017"),he("fire-js",""),he("firebase","10.1.0","app"),Object.create,Object.create;const ke=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."}},Se=new p("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."}),Ae=new D("@firebase/auth");function Ce(e,...t){Ae.logLevel<=C.ERROR&&Ae.error(`Auth (${ue}): ${e}`,...t)}function Re(e,...t){throw Pe(e,...t)}function Oe(e,...t){return Pe(e,...t)}function Pe(e,...t){if("string"!=typeof e){const n=t[0],r=[...t.slice(1)];return r[0]&&(r[0].appName=e.name),e._errorFactory.create(n,...r)}return Se.create(e,...t)}function Ne(e,t,...n){if(!e)throw Pe(t,...n)}function De(e){const t="INTERNAL ASSERTION FAILED: "+e;throw Ce(t),new Error(t)}function Le(e,t){e||De(t)}function $e(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.href)||""}function Me(){var e;return"undefined"!=typeof self&&(null===(e=self.location)||void 0===e?void 0:e.protocol)||null}function je(){return!("undefined"!=typeof navigator&&navigator&&"onLine"in navigator&&"boolean"==typeof navigator.onLine&&("http:"===Me()||"https:"===Me()||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 Ue{constructor(e,t){this.shortDelay=e,this.longDelay=t,Le(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(d())||"object"==typeof navigator&&"ReactNative"===navigator.product}get(){return je()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}function Fe(e,t){Le(e.emulator,"Emulator should always be set here");const{url:n}=e.emulator;return t?`${n}${t.startsWith("/")?t.slice(1):t}`:n}class xe{static initialize(e,t,n){this.fetchImpl=e,t&&(this.headersImpl=t),n&&(this.responseImpl=n)}static fetch(){return this.fetchImpl?this.fetchImpl:"undefined"!=typeof self&&"fetch"in self?self.fetch:void De("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 De("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 De("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}const Be={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:"missing-password",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"},Ve=new Ue(3e4,6e4);function He(e,t){return e.tenantId&&!t.tenantId?Object.assign(Object.assign({},t),{tenantId:e.tenantId}):t}async function We(e,t,n,r,i={}){return ze(e,i,(async()=>{let i={},s={};r&&("GET"===t?s=r:i={body:JSON.stringify(r)});const o=y(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),xe.fetch()(Ke(e,e.config.apiHost,n,o),Object.assign({method:t,headers:a,referrerPolicy:"no-referrer"},i))}))}async function ze(e,t,n){e._canInitEmulator=!1;const r=Object.assign(Object.assign({},Be),t);try{const t=new Ge(e),i=await Promise.race([n(),t.promise]);t.clearNetworkTimeout();const s=await i.json();if("needConfirmation"in s)throw Je(e,"account-exists-with-different-credential",s);if(i.ok&&!("errorMessage"in s))return s;{const t=i.ok?s.errorMessage:s.error.message,[n,o]=t.split(" : ");if("FEDERATED_USER_ID_ALREADY_LINKED"===n)throw Je(e,"credential-already-in-use",s);if("EMAIL_EXISTS"===n)throw Je(e,"email-already-in-use",s);if("USER_DISABLED"===n)throw Je(e,"user-disabled",s);const a=r[n]||n.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw function(e,t,n){const r=Object.assign(Object.assign({},ke()),{[t]:n});return new p("auth","Firebase",r).create(t,{appName:e.name})}(e,a,o);Re(e,a)}}catch(t){if(t instanceof h)throw t;Re(e,"network-request-failed",{message:String(t)})}}async function qe(e,t,n,r,i={}){const s=await We(e,t,n,r,i);return"mfaPendingCredential"in s&&Re(e,"multi-factor-auth-required",{_serverResponse:s}),s}function Ke(e,t,n,r){const i=`${t}${n}?${r}`;return e.config.emulator?Fe(e.config,i):`${e.config.apiScheme}://${i}`}class Ge{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise(((e,t)=>{this.timer=setTimeout((()=>t(Oe(this.auth,"network-request-failed"))),Ve.get())}))}clearNetworkTimeout(){clearTimeout(this.timer)}}function Je(e,t,n){const r={appName:e.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);const i=Oe(e,t,r);return i.customData._tokenResponse=n,i}function Ye(e){if(e)try{const t=new Date(Number(e));if(!isNaN(t.getTime()))return t.toUTCString()}catch(e){}}function Xe(e){return 1e3*Number(e)}function Ze(e){const[t,n,r]=e.split(".");if(void 0===t||void 0===n||void 0===r)return Ce("JWT malformed, contained fewer than 3 sections"),null;try{const e=o(n);return e?JSON.parse(e):(Ce("Failed to decode base64 JWT payload"),null)}catch(e){return Ce("Caught error parsing JWT payload as JSON",null==e?void 0:e.toString()),null}}async function Qe(e,t,n=!1){if(n)return t;try{return await t}catch(t){throw t instanceof h&&function({code:e}){return"auth/user-disabled"===e||"auth/user-token-expired"===e}(t)&&e.auth.currentUser===e&&await e.auth.signOut(),t}}class et{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(){try{await this.user.getIdToken(!0)}catch(e){return void("auth/network-request-failed"===(null==e?void 0:e.code)&&this.schedule(!0))}this.schedule()}}class tt{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=Ye(this.lastLoginAt),this.creationTime=Ye(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}async function nt(e){var t;const n=e.auth,r=await e.getIdToken(),i=await Qe(e,async function(e,t){return We(e,"POST","/v1/accounts:lookup",t)}(n,{idToken:r}));Ne(null==i?void 0:i.users.length,n,"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,n=Ee(e,["providerId"]);return{providerId:t,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.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 tt(s.createdAt,s.lastLoginAt),isAnonymous:h};Object.assign(e,p)}class rt{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){Ne(e.idToken,"internal-error"),Ne(void 0!==e.idToken,"internal-error"),Ne(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 Ne(t,"internal-error"),Ne(void 0!==t.exp,"internal-error"),Ne(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 Ne(!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:n,refreshToken:r,expiresIn:i}=await async function(e,t){const n=await ze(e,{},(async()=>{const n=y({grant_type:"refresh_token",refresh_token:t}).slice(1),{tokenApiHost:r,apiKey:i}=e.config,s=Ke(e,r,"/v1/token",`key=${i}`),o=await e._getAdditionalHeaders();return o["Content-Type"]="application/x-www-form-urlencoded",xe.fetch()(s,{method:"POST",headers:o,body:n})}));return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}(e,t);this.updateTokensAndExpiration(n,r,Number(i))}updateTokensAndExpiration(e,t,n){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+1e3*n}static fromJSON(e,t){const{refreshToken:n,accessToken:r,expirationTime:i}=t,s=new rt;return n&&(Ne("string"==typeof n,"internal-error",{appName:e}),s.refreshToken=n),r&&(Ne("string"==typeof r,"internal-error",{appName:e}),s.accessToken=r),i&&(Ne("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 rt,this.toJSON())}_performRefresh(){return De("not implemented")}}function it(e,t){Ne("string"==typeof e||void 0===e,"internal-error",{appName:t})}class st{constructor(e){var{uid:t,auth:n,stsTokenManager:r}=e,i=Ee(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new et(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=n,this.stsTokenManager=r,this.accessToken=r.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 tt(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){const t=await Qe(this,this.stsTokenManager.getToken(this.auth,e));return Ne(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 n=w(e),r=await n.getIdToken(t),i=Ze(r);Ne(i&&i.exp&&i.auth_time&&i.iat,n.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:r,authTime:Ye(Xe(i.auth_time)),issuedAtTime:Ye(Xe(i.iat)),expirationTime:Ye(Xe(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=w(e);await nt(t),await t.auth._persistUserIfCurrent(t),t.auth._notifyListenersIfCurrent(t)}(this)}_assign(e){this!==e&&(Ne(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){const t=new st(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){Ne(!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 n=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),n=!0),t&&await nt(this),await this.auth._persistUserIfCurrent(this),n&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await Qe(this,async function(e,t){return We(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 n,r,i,s,o,a,c,l;const u=null!==(n=t.displayName)&&void 0!==n?n:void 0,d=null!==(r=t.email)&&void 0!==r?r: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;Ne(v&&w,e,"internal-error");const T=rt.fromJSON(this.name,w);Ne("string"==typeof v,e,"internal-error"),it(u,e.name),it(d,e.name),Ne("boolean"==typeof b,e,"internal-error"),Ne("boolean"==typeof _,e,"internal-error"),it(h,e.name),it(p,e.name),it(f,e.name),it(m,e.name),it(g,e.name),it(y,e.name);const E=new st({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)&&(E.providerData=I.map((e=>Object.assign({},e)))),m&&(E._redirectEventId=m),E}static async _fromIdTokenResponse(e,t,n=!1){const r=new rt;r.updateFromServerResponse(t);const i=new st({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:n});return await nt(i),i}}const ot=new Map;function at(e){Le(e instanceof Function,"Expected a class definition");let t=ot.get(e);return t?(Le(t instanceof e,"Instance stored in cache mismatched with class"),t):(t=new e,ot.set(e,t),t)}class ct{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){}}ct.type="NONE";const lt=ct;function ut(e,t,n){return`firebase:${e}:${t}:${n}`}class dt{constructor(e,t,n){this.persistence=e,this.auth=t,this.userKey=n;const{config:r,name:i}=this.auth;this.fullUserKey=ut(this.userKey,r.apiKey,i),this.fullPersistenceKey=ut("persistence",r.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?st._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,n="authUser"){if(!t.length)return new dt(at(lt),e,n);const r=(await Promise.all(t.map((async e=>{if(await e._isAvailable())return e})))).filter((e=>e));let i=r[0]||at(lt);const s=ut(n,e.config.apiKey,e.name);let o=null;for(const n of t)try{const t=await n._get(s);if(t){const r=st._fromJSON(e,t);n!==i&&(o=r),i=n;break}}catch(e){}const a=r.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 dt(i,e,n)):new dt(i,e,n)}}function ht(e){const t=e.toLowerCase();if(t.includes("opera/")||t.includes("opr/")||t.includes("opios/"))return"Opera";if(gt(t))return"IEMobile";if(t.includes("msie")||t.includes("trident/"))return"IE";if(t.includes("edge/"))return"Edge";if(pt(t))return"Firefox";if(t.includes("silk/"))return"Silk";if(vt(t))return"Blackberry";if(bt(t))return"Webos";if(ft(t))return"Safari";if((t.includes("chrome/")||mt(t))&&!t.includes("edge/"))return"Chrome";if(yt(t))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,n=e.match(t);if(2===(null==n?void 0:n.length))return n[1]}return"Other"}function pt(e=d()){return/firefox\//i.test(e)}function ft(e=d()){const t=e.toLowerCase();return t.includes("safari/")&&!t.includes("chrome/")&&!t.includes("crios/")&&!t.includes("android")}function mt(e=d()){return/crios\//i.test(e)}function gt(e=d()){return/iemobile/i.test(e)}function yt(e=d()){return/android/i.test(e)}function vt(e=d()){return/blackberry/i.test(e)}function bt(e=d()){return/webos/i.test(e)}function _t(e=d()){return/iphone|ipad|ipod/i.test(e)||/macintosh/i.test(e)&&/mobile/i.test(e)}function It(e=d()){return _t(e)||yt(e)||bt(e)||vt(e)||/windows phone/i.test(e)||gt(e)}function wt(e,t=[]){let n;switch(e){case"Browser":n=ht(d());break;case"Worker":n=`${ht(d())}-${e}`;break;default:n=e}const r=t.length?t.join(","):"FirebaseCore-web";return`${n}/JsCore/${ue}/${r}`}async function Tt(e,t){return We(e,"GET","/v2/recaptchaConfig",He(e,t))}function Et(e){return void 0!==e&&void 0!==e.enterprise}class kt{constructor(e){if(this.siteKey="",this.emailPasswordEnabled=!1,void 0===e.recaptchaKey)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.emailPasswordEnabled=e.recaptchaEnforcementState.some((e=>"EMAIL_PASSWORD_PROVIDER"===e.provider&&"OFF"!==e.enforcementState))}}function St(e){return new Promise(((t,n)=>{const r=document.createElement("script");var i,s;r.setAttribute("src",e),r.onload=t,r.onerror=e=>{const t=Oe("internal-error");t.customData=e,n(t)},r.type="text/javascript",r.charset="UTF-8",(null!==(s=null===(i=document.getElementsByTagName("head"))||void 0===i?void 0:i[0])&&void 0!==s?s:document).appendChild(r)}))}function At(e){return`__${e}${Math.floor(1e6*Math.random())}`}class Ct{constructor(e){this.type="recaptcha-enterprise",this.auth=Nt(e)}async verify(e="verify",t=!1){function n(t,n,r){const i=window.grecaptcha;Et(i)?i.enterprise.ready((()=>{i.enterprise.execute(t,{action:e}).then((e=>{n(e)})).catch((()=>{n("NO_RECAPTCHA")}))})):r(Error("No reCAPTCHA enterprise script loaded."))}return new Promise(((e,r)=>{(async function(e){if(!t){if(null==e.tenantId&&null!=e._agentRecaptchaConfig)return e._agentRecaptchaConfig.siteKey;if(null!=e.tenantId&&void 0!==e._tenantRecaptchaConfigs[e.tenantId])return e._tenantRecaptchaConfigs[e.tenantId].siteKey}return new Promise((async(t,n)=>{Tt(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then((r=>{if(void 0!==r.recaptchaKey){const n=new kt(r);return null==e.tenantId?e._agentRecaptchaConfig=n:e._tenantRecaptchaConfigs[e.tenantId]=n,t(n.siteKey)}n(new Error("recaptcha Enterprise site key undefined"))})).catch((e=>{n(e)}))}))})(this.auth).then((i=>{if(!t&&Et(window.grecaptcha))n(i,e,r);else{if("undefined"==typeof window)return void r(new Error("RecaptchaVerifier is only supported in browser"));St("https://www.google.com/recaptcha/enterprise.js?render="+i).then((()=>{n(i,e,r)})).catch((e=>{r(e)}))}})).catch((e=>{r(e)}))}))}}async function Rt(e,t,n,r=!1){const i=new Ct(e);let s;try{s=await i.verify(n)}catch(e){s=await i.verify(n,!0)}const o=Object.assign({},t);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}class Ot{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const n=t=>new Promise(((n,r)=>{try{n(e(t))}catch(e){r(e)}}));n.onAbort=t,this.queue.push(n);const r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const n of this.queue)await n(e),n.onAbort&&t.push(n.onAbort)}catch(e){t.reverse();for(const e of t)try{e()}catch(e){}throw this.auth._errorFactory.create("login-blocked",{originalMessage:null==e?void 0:e.message})}}}class Pt{constructor(e,t,n,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=n,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Dt(this),this.idTokenSubscription=new Dt(this),this.beforeStateQueue=new Ot(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Se,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},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=at(t)),this._initializationPromise=this.queue((async()=>{var n,r;if(!this._deleted&&(this.persistenceManager=await dt.create(this,e),!this._deleted)){if(null===(n=this._popupRedirectResolver)||void 0===n?void 0:n._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch(e){}await this.initializeCurrentUser(t),this.lastNotifiedUid=(null===(r=this.currentUser)||void 0===r?void 0:r.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 n=await this.assertedPersistence.getCurrentUser();let r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const n=null===(t=this.redirectUser)||void 0===t?void 0:t._redirectEventId,s=null==r?void 0:r._redirectEventId,o=await this.tryRedirectSignIn(e);n&&n!==s||!(null==o?void 0:o.user)||(r=o.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(e){r=n,this._popupRedirectResolver._overrideRedirectResult(this,(()=>Promise.reject(e)))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return Ne(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===r._redirectEventId?this.directlySetCurrentUser(r):this.reloadAndSetCurrentUserOrClear(r)}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){try{await nt(e)}catch(e){if("auth/network-request-failed"!==(null==e?void 0:e.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?w(e):null;return t&&Ne(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&&Ne(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(at(e))}))}async initializeRecaptchaConfig(){const e=await Tt(this,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),t=new kt(e);null==this.tenantId?this._agentRecaptchaConfig=t:this._tenantRecaptchaConfigs[this.tenantId]=t,t.emailPasswordEnabled&&new Ct(this).verify()}_getRecaptchaConfig(){return null==this.tenantId?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new p("auth","Firebase",e())}onAuthStateChanged(e,t,n){return this.registerStateListener(this.authStateSubscription,e,t,n)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,n){return this.registerStateListener(this.idTokenSubscription,e,t,n)}authStateReady(){return new Promise(((e,t)=>{if(this.currentUser)e();else{const n=this.onAuthStateChanged((()=>{n(),e()}),t)}}))}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 n=await this.getOrInitRedirectPersistenceManager(t);return null===e?n.removeCurrentUser():n.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&at(e)||this._popupRedirectResolver;Ne(t,this,"argument-error"),this.redirectPersistenceManager=await dt.create(this,[at(t._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){var t,n;return this._isInitialized&&await this.queue((async()=>{})),(null===(t=this._currentUser)||void 0===t?void 0:t._redirectEventId)===e?this._currentUser:(null===(n=this.redirectUser)||void 0===n?void 0:n._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 n=null!==(t=null===(e=this.currentUser)||void 0===e?void 0:e.uid)&&void 0!==t?t:null;this.lastNotifiedUid!==n&&(this.lastNotifiedUid=n,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,n,r){if(this._deleted)return()=>{};const i="function"==typeof t?t:t.next.bind(t),s=this._isInitialized?Promise.resolve():this._initializationPromise;return Ne(s,this,"internal-error"),s.then((()=>i(this.currentUser))),"function"==typeof t?e.addObserver(t,n,r):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 Ne(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){e&&!this.frameworks.includes(e)&&(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=wt(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 n=await(null===(e=this.heartbeatServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getHeartbeatsHeader());n&&(t["X-Firebase-Client"]=n);const r=await this._getAppCheckToken();return r&&(t["X-Firebase-AppCheck"]=r),t}async _getAppCheckToken(){var e;const t=await(null===(e=this.appCheckServiceProvider.getImmediate({optional:!0}))||void 0===e?void 0:e.getToken());return(null==t?void 0:t.error)&&function(e,...t){Ae.logLevel<=C.WARN&&Ae.warn(`Auth (${ue}): ${e}`,...t)}(`Error while retrieving App Check token: ${t.error}`),null==t?void 0:t.token}}function Nt(e){return w(e)}class Dt{constructor(e){this.auth=e,this.observer=null,this.addObserver=function(e,t){const n=new _(e,void 0);return n.subscribe.bind(n)}((e=>this.observer=e))}get next(){return Ne(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}function Lt(e){const t=e.indexOf(":");return t<0?"":e.substr(0,t+1)}function $t(e){if(!e)return null;const t=Number(e);return isNaN(t)?null:t}class Mt{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return De("not implemented")}_getIdTokenResponse(e){return De("not implemented")}_linkToIdToken(e,t){return De("not implemented")}_getReauthenticationResolver(e){return De("not implemented")}}async function jt(e,t){return qe(e,"POST","/v1/accounts:signInWithPassword",He(e,t))}async function Ut(e,t){return async function(e,t){return We(e,"POST","/v1/accounts:sendOobCode",He(e,t))}(e,t)}class Ft extends Mt{constructor(e,t,n,r=null){super("password",n),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new Ft(e,t,"password")}static _fromEmailAndCode(e,t,n=null){return new Ft(e,t,"emailLink",n)}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){var t;switch(this.signInMethod){case"password":const n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(null===(t=e._getRecaptchaConfig())||void 0===t?void 0:t.emailPasswordEnabled){const t=await Rt(e,n,"signInWithPassword");return jt(e,t)}return jt(e,n).catch((async t=>{if("auth/missing-recaptcha-token"===t.code){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const t=await Rt(e,n,"signInWithPassword");return jt(e,t)}return Promise.reject(t)}));case"emailLink":return async function(e,t){return qe(e,"POST","/v1/accounts:signInWithEmailLink",He(e,t))}(e,{email:this._email,oobCode:this._password});default:Re(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return async function(e,t){return We(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 qe(e,"POST","/v1/accounts:signInWithEmailLink",He(e,t))}(e,{idToken:t,email:this._email,oobCode:this._password});default:Re(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}async function xt(e,t){return qe(e,"POST","/v1/accounts:signInWithIdp",He(e,t))}class Bt extends Mt{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new Bt(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):Re("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:n,signInMethod:r}=t,i=Ee(t,["providerId","signInMethod"]);if(!n||!r)return null;const s=new Bt(n,r);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 xt(e,this.buildRequest())}_linkToIdToken(e,t){const n=this.buildRequest();return n.idToken=t,xt(e,n)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,xt(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=y(t)}return e}}const Vt={USER_NOT_FOUND:"user-not-found"};class Ht extends Mt{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new Ht({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new Ht({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return async function(e,t){return qe(e,"POST","/v1/accounts:signInWithPhoneNumber",He(e,t))}(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return async function(e,t){const n=await qe(e,"POST","/v1/accounts:signInWithPhoneNumber",He(e,t));if(n.temporaryProof)throw Je(e,"account-exists-with-different-credential",n);return n}(e,Object.assign({idToken:t},this._makeVerificationRequest()))}_getReauthenticationResolver(e){return async function(e,t){return qe(e,"POST","/v1/accounts:signInWithPhoneNumber",He(e,Object.assign(Object.assign({},t),{operation:"REAUTH"})),Vt)}(e,this._makeVerificationRequest())}_makeVerificationRequest(){const{temporaryProof:e,phoneNumber:t,verificationId:n,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:n,code:r}}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:n,phoneNumber:r,temporaryProof:i}=e;return n||t||r||i?new Ht({verificationId:t,verificationCode:n,phoneNumber:r,temporaryProof:i}):null}}class Wt{constructor(e){var t,n,r,i,s,o;const a=v(b(e)),c=null!==(t=a.apiKey)&&void 0!==t?t:null,l=null!==(n=a.oobCode)&&void 0!==n?n: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!==(r=a.mode)&&void 0!==r?r:null);Ne(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=v(b(e)).link,n=t?v(b(t)).deep_link_id:null,r=v(b(e)).deep_link_id;return(r?v(b(r)).link:null)||r||n||t||e}(e);try{return new Wt(t)}catch(e){return null}}}class zt{constructor(){this.providerId=zt.PROVIDER_ID}static credential(e,t){return Ft._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const n=Wt.parseLink(t);return Ne(n,"argument-error"),Ft._fromEmailAndCode(e,n.code,n.tenantId)}}zt.PROVIDER_ID="password",zt.EMAIL_PASSWORD_SIGN_IN_METHOD="password",zt.EMAIL_LINK_SIGN_IN_METHOD="emailLink";class qt{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 Kt extends qt{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}class Gt extends Kt{constructor(){super("facebook.com")}static credential(e){return Bt._fromParams({providerId:Gt.PROVIDER_ID,signInMethod:Gt.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Gt.credentialFromTaggedObject(e)}static credentialFromError(e){return Gt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Gt.credential(e.oauthAccessToken)}catch(e){return null}}}Gt.FACEBOOK_SIGN_IN_METHOD="facebook.com",Gt.PROVIDER_ID="facebook.com";class Jt extends Kt{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return Bt._fromParams({providerId:Jt.PROVIDER_ID,signInMethod:Jt.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return Jt.credentialFromTaggedObject(e)}static credentialFromError(e){return Jt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:n}=e;if(!t&&!n)return null;try{return Jt.credential(t,n)}catch(e){return null}}}Jt.GOOGLE_SIGN_IN_METHOD="google.com",Jt.PROVIDER_ID="google.com";class Yt extends Kt{constructor(){super("github.com")}static credential(e){return Bt._fromParams({providerId:Yt.PROVIDER_ID,signInMethod:Yt.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return Yt.credentialFromTaggedObject(e)}static credentialFromError(e){return Yt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e))return null;if(!e.oauthAccessToken)return null;try{return Yt.credential(e.oauthAccessToken)}catch(e){return null}}}Yt.GITHUB_SIGN_IN_METHOD="github.com",Yt.PROVIDER_ID="github.com";class Xt extends Kt{constructor(){super("twitter.com")}static credential(e,t){return Bt._fromParams({providerId:Xt.PROVIDER_ID,signInMethod:Xt.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return Xt.credentialFromTaggedObject(e)}static credentialFromError(e){return Xt.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:n}=e;if(!t||!n)return null;try{return Xt.credential(t,n)}catch(e){return null}}}Xt.TWITTER_SIGN_IN_METHOD="twitter.com",Xt.PROVIDER_ID="twitter.com";class Zt{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,n,r=!1){const i=await st._fromIdTokenResponse(e,n,r),s=Qt(n);return new Zt({user:i,providerId:s,_tokenResponse:n,operationType:t})}static async _forOperation(e,t,n){await e._updateTokensIfNecessary(n,!0);const r=Qt(n);return new Zt({user:e,providerId:r,_tokenResponse:n,operationType:t})}}function Qt(e){return e.providerId?e.providerId:"phoneNumber"in e?"phone":null}class en extends h{constructor(e,t,n,r){var i;super(t.code,t.message),this.operationType=n,this.user=r,Object.setPrototypeOf(this,en.prototype),this.customData={appName:e.name,tenantId:null!==(i=e.tenantId)&&void 0!==i?i:void 0,_serverResponse:t.customData._serverResponse,operationType:n}}static _fromErrorAndOperation(e,t,n,r){return new en(e,t,n,r)}}function tn(e,t,n,r){return("reauthenticate"===t?n._getReauthenticationResolver(e):n._getIdTokenResponse(e)).catch((n=>{if("auth/multi-factor-auth-required"===n.code)throw en._fromErrorAndOperation(e,n,t,r);throw n}))}async function nn(e,t,n=!1){const r="signIn",i=await tn(e,r,t),s=await Zt._fromIdTokenResponse(e,r,i);return n||await e._updateCurrentUser(s.user),s}new WeakMap;const rn="__sak";class sn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(rn,"1"),this.storage.removeItem(rn),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 on extends sn{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=d();return ft(e)||_t(e)}()&&function(){try{return!(!window||window===window.top)}catch(e){return!1}}(),this.fallbackToPolling=It(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const n=this.storage.getItem(t),r=this.localCache[t];n!==r&&e(t,r,n)}}onStorageEvent(e,t=!1){if(!e.key)return void this.forAllChangedKeys(((e,t,n)=>{this.notifyListeners(e,n)}));const n=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const r=this.storage.getItem(n);if(e.newValue!==r)null!==e.newValue?this.storage.setItem(n,e.newValue):this.storage.removeItem(n);else if(this.localCache[n]===e.newValue&&!t)return}const r=()=>{const e=this.storage.getItem(n);(t||this.localCache[n]!==e)&&this.notifyListeners(n,e)},i=this.storage.getItem(n);!function(){const e=d();return e.indexOf("MSIE ")>=0||e.indexOf("Trident/")>=0}()||10!==document.documentMode||i===e.newValue||e.newValue===e.oldValue?r():setTimeout(r,10)}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))e(t?JSON.parse(t):t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval((()=>{this.forAllChangedKeys(((e,t,n)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:n}),!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]}}on.type="LOCAL";const an=on;class cn extends sn{constructor(){super((()=>window.sessionStorage),"SESSION")}_addListener(e,t){}_removeListener(e,t){}}cn.type="SESSION";const ln=cn;class un{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 n=new un(e);return this.receivers.push(n),n}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:n,eventType:r,data:i}=t.data,s=this.handlersMap[r];if(!(null==s?void 0:s.size))return;t.ports[0].postMessage({status:"ack",eventId:n,eventType:r});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:n,eventType:r,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 dn(e="",t=10){let n="";for(let e=0;e<t;e++)n+=Math.floor(10*Math.random());return e+n}un.receivers=[];class hn{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,n=50){const r="undefined"!=typeof MessageChannel?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let i,s;return new Promise(((o,a)=>{const c=dn("",20);r.port1.start();const l=setTimeout((()=>{a(new Error("unsupported_event"))}),n);s={messageChannel:r,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),r.port1.addEventListener("message",s.onMessage),this.target.postMessage({eventType:e,eventId:c,data:t},[r.port2])})).finally((()=>{s&&this.removeMessageHandler(s)}))}}function pn(){return window}function fn(){return void 0!==pn().WorkerGlobalScope&&"function"==typeof pn().importScripts}const mn="firebaseLocalStorageDb",gn="firebaseLocalStorage",yn="fbase_key";class vn{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 bn(e,t){return e.transaction([gn],t?"readwrite":"readonly").objectStore(gn)}function _n(){const e=indexedDB.open(mn,1);return new Promise(((t,n)=>{e.addEventListener("error",(()=>{n(e.error)})),e.addEventListener("upgradeneeded",(()=>{const t=e.result;try{t.createObjectStore(gn,{keyPath:yn})}catch(e){n(e)}})),e.addEventListener("success",(async()=>{const n=e.result;n.objectStoreNames.contains(gn)?t(n):(n.close(),await function(){const e=indexedDB.deleteDatabase(mn);return new vn(e).toPromise()}(),t(await _n()))}))}))}async function In(e,t,n){const r=bn(e,!0).put({[yn]:t,value:n});return new vn(r).toPromise()}function wn(e,t){const n=bn(e,!0).delete(t);return new vn(n).toPromise()}class Tn{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 _n()),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 fn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=un._getInstance(fn()?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 hn(this.activeServiceWorker);const n=await this.sender._send("ping",{},800);n&&(null===(e=n[0])||void 0===e?void 0:e.fulfilled)&&(null===(t=n[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 _n();return await In(e,rn,"1"),await wn(e,rn),!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((n=>In(n,e,t))),this.localCache[e]=t,this.notifyServiceWorker(e))))}async _get(e){const t=await this._withRetries((t=>async function(e,t){const n=bn(e,!1).get(t),r=await new vn(n).toPromise();return void 0===r?null:r.value}(t,e)));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite((async()=>(await this._withRetries((t=>wn(t,e))),delete this.localCache[e],this.notifyServiceWorker(e))))}async _poll(){const e=await this._withRetries((e=>{const t=bn(e,!1).getAll();return new vn(t).toPromise()}));if(!e)return[];if(0!==this.pendingWrites)return[];const t=[],n=new Set;for(const{fbase_key:r,value:i}of e)n.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(i)&&(this.notifyListeners(r,i),t.push(r));for(const e of Object.keys(this.localCache))this.localCache[e]&&!n.has(e)&&(this.notifyListeners(e,null),t.push(e));return t}notifyListeners(e,t){this.localCache[e]=t;const n=this.listeners[e];if(n)for(const e of Array.from(n))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()}}Tn.type="LOCAL";const En=Tn;At("rcb"),new Ue(3e4,6e4);class kn{constructor(e){this.providerId=kn.PROVIDER_ID,this.auth=Nt(e)}verifyPhoneNumber(e,t){return async function(e,t,n){var r;const i=await n.verify();try{let s;if(Ne("string"==typeof i,e,"argument-error"),Ne("recaptcha"===n.type,e,"argument-error"),s="string"==typeof t?{phoneNumber:t}:t,"session"in s){const t=s.session;if("phoneNumber"in s){Ne("enroll"===t.type,e,"internal-error");const n=await function(e,t){return We(e,"POST","/v2/accounts/mfaEnrollment:start",He(e,t))}(e,{idToken:t.credential,phoneEnrollmentInfo:{phoneNumber:s.phoneNumber,recaptchaToken:i}});return n.phoneSessionInfo.sessionInfo}{Ne("signin"===t.type,e,"internal-error");const n=(null===(r=s.multiFactorHint)||void 0===r?void 0:r.uid)||s.multiFactorUid;Ne(n,e,"missing-multi-factor-info");const o=await function(e,t){return We(e,"POST","/v2/accounts/mfaSignIn:start",He(e,t))}(e,{mfaPendingCredential:t.credential,mfaEnrollmentId:n,phoneSignInInfo:{recaptchaToken:i}});return o.phoneResponseInfo.sessionInfo}}{const{sessionInfo:t}=await async function(e,t){return We(e,"POST","/v1/accounts:sendVerificationCode",He(e,t))}(e,{phoneNumber:s.phoneNumber,recaptchaToken:i});return t}}finally{n._reset()}}(this.auth,e,w(t))}static credential(e,t){return Ht._fromVerification(e,t)}static credentialFromResult(e){const t=e;return kn.credentialFromTaggedObject(t)}static credentialFromError(e){return kn.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{phoneNumber:t,temporaryProof:n}=e;return t&&n?Ht._fromTokenResponse(t,n):null}}kn.PROVIDER_ID="phone",kn.PHONE_SIGN_IN_METHOD="phone";class Sn extends Mt{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return xt(e,this._buildIdpRequest())}_linkToIdToken(e,t){return xt(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return xt(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 An(e){return nn(e.auth,new Sn(e),e.bypassAuthState)}function Cn(e){const{auth:t,user:n}=e;return Ne(n,t,"internal-error"),async function(e,t,n=!1){const{auth:r}=e,i="reauthenticate";try{const s=await Qe(e,tn(r,i,t,e),n);Ne(s.idToken,r,"internal-error");const o=Ze(s.idToken);Ne(o,r,"internal-error");const{sub:a}=o;return Ne(e.uid===a,r,"user-mismatch"),Zt._forOperation(e,i,s)}catch(e){throw"auth/user-not-found"===(null==e?void 0:e.code)&&Re(r,"user-mismatch"),e}}(n,new Sn(e),e.bypassAuthState)}async function Rn(e){const{auth:t,user:n}=e;return Ne(n,t,"internal-error"),async function(e,t,n=!1){const r=await Qe(e,t._linkToIdToken(e.auth,await e.getIdToken()),n);return Zt._forOperation(e,"link",r)}(n,new Sn(e),e.bypassAuthState)}class On{constructor(e,t,n,r,i=!1){this.auth=e,this.resolver=n,this.user=r,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:n,postBody:r,tenantId:i,error:s,type:o}=e;if(s)return void this.reject(s);const a={auth:this.auth,requestUri:t,sessionId:n,tenantId:i||void 0,postBody:r||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 An;case"linkViaPopup":case"linkViaRedirect":return Rn;case"reauthViaPopup":case"reauthViaRedirect":return Cn;default:Re(this.auth,"internal-error")}}resolve(e){Le(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){Le(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 Pn=new Ue(2e3,1e4);class Nn extends On{constructor(e,t,n,r,i){super(e,t,r,i),this.provider=n,this.authWindow=null,this.pollId=null,Nn.currentPopupAction&&Nn.currentPopupAction.cancel(),Nn.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return Ne(e,this.auth,"internal-error"),e}async onExecution(){Le(1===this.filter.length,"Popup operations only handle one event");const e=dn();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(Oe(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(Oe(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,Nn.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,n;(null===(n=null===(t=this.authWindow)||void 0===t?void 0:t.window)||void 0===n?void 0:n.closed)?this.pollId=window.setTimeout((()=>{this.pollId=null,this.reject(Oe(this.auth,"popup-closed-by-user"))}),8e3):this.pollId=window.setTimeout(e,Pn.get())};e()}}Nn.currentPopupAction=null;const Dn="pendingRedirect",Ln=new Map;class $n extends On{constructor(e,t,n=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,n),this.eventId=null}async execute(){let e=Ln.get(this.auth._key());if(!e){try{const t=await async function(e,t){const n=function(e){return ut(Dn,e.config.apiKey,e.name)}(t),r=function(e){return at(e._redirectPersistence)}(e);if(!await r._isAvailable())return!1;const i="true"===await r._get(n);return await r._remove(n),i}(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(t)}catch(t){e=()=>Promise.reject(t)}Ln.set(this.auth._key(),e)}return this.bypassAuthState||Ln.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 Mn(e,t){Ln.set(e._key(),t)}async function jn(e,t,n=!1){const r=Nt(e),i=function(e,t){return t?at(t):(Ne(e._popupRedirectResolver,e,"argument-error"),e._popupRedirectResolver)}(r,t),s=new $n(r,i,n),o=await s.execute();return o&&!n&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,t)),o}class Un{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((n=>{this.isEventForConsumer(e,n)&&(t=!0,this.sendToConsumer(e,n),this.saveEventToCache(e))})),this.hasHandledPotentialRedirect||!function(e){switch(e.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return xn(e);default:return!1}}(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var n;if(e.error&&!xn(e)){const r=(null===(n=e.error.code)||void 0===n?void 0:n.split("auth/")[1])||"internal-error";t.onError(Oe(this.auth,r))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const n=null===t.eventId||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&n}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=6e5&&this.cachedEventUids.clear(),this.cachedEventUids.has(Fn(e))}saveEventToCache(e){this.cachedEventUids.add(Fn(e)),this.lastProcessedEventTime=Date.now()}}function Fn(e){return[e.type,e.eventId,e.sessionId,e.tenantId].filter((e=>e)).join("-")}function xn({type:e,error:t}){return"unknown"===e&&"auth/no-auth-event"===(null==t?void 0:t.code)}const Bn=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Vn=/^https?/;function Hn(e){const t=$e(),{protocol:n,hostname:r}=new URL(t);if(e.startsWith("chrome-extension://")){const i=new URL(e);return""===i.hostname&&""===r?"chrome-extension:"===n&&e.replace("chrome-extension://","")===t.replace("chrome-extension://",""):"chrome-extension:"===n&&i.hostname===r}if(!Vn.test(n))return!1;if(Bn.test(e))return r===e;const i=e.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}const Wn=new Ue(3e4,6e4);function zn(){const e=pn().___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 qn=null;function Kn(e){return qn=qn||function(e){return new Promise(((t,n)=>{var r,i,s;function o(){zn(),gapi.load("gapi.iframes",{callback:()=>{t(gapi.iframes.getContext())},ontimeout:()=>{zn(),n(Oe(e,"network-request-failed"))},timeout:Wn.get()})}if(null===(i=null===(r=pn().gapi)||void 0===r?void 0:r.iframes)||void 0===i?void 0:i.Iframe)t(gapi.iframes.getContext());else{if(!(null===(s=pn().gapi)||void 0===s?void 0:s.load)){const t=At("iframefcb");return pn()[t]=()=>{gapi.load?o():n(Oe(e,"network-request-failed"))},St(`https://apis.google.com/js/api.js?onload=${t}`).catch((e=>n(e)))}o()}})).catch((e=>{throw qn=null,e}))}(e),qn}const Gn=new Ue(5e3,15e3),Jn={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Yn=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function Xn(e){const t=e.config;Ne(t.authDomain,e,"auth-domain-config-required");const n=t.emulator?Fe(t,"emulator/auth/iframe"):`https://${e.config.authDomain}/__/auth/iframe`,r={apiKey:t.apiKey,appName:e.name,v:ue},i=Yn.get(e.config.apiHost);i&&(r.eid=i);const s=e._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${y(r).slice(1)}`}const Zn={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"};class Qn{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch(e){}}}const er=encodeURIComponent("fac");async function tr(e,t,n,r,i,s){Ne(e.config.authDomain,e,"auth-domain-config-required"),Ne(e.config.apiKey,e,"invalid-api-key");const o={apiKey:e.config.apiKey,appName:e.name,authType:n,redirectUrl:r,v:ue,eventId:i};if(t instanceof qt){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 Kt){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];const c=await e._getAppCheckToken(),l=c?`#${er}=${encodeURIComponent(c)}`:"";return`${function({config:e}){return e.emulator?Fe(e,"emulator/auth/handler"):`https://${e.authDomain}/__/auth/handler`}(e)}?${y(a).slice(1)}${l}`}const nr="webStorageSupport",rr=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=ln,this._completeRedirectFn=jn,this._overrideRedirectResult=Mn}async _openPopup(e,t,n,r){var i;return Le(null===(i=this.eventManagers[e._key()])||void 0===i?void 0:i.manager,"_initialize() not called before _openPopup()"),function(e,t,n,r=500,i=600){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let a="";const c=Object.assign(Object.assign({},Zn),{width:r.toString(),height:i.toString(),top:s,left:o}),l=d().toLowerCase();n&&(a=mt(l)?"_blank":n),pt(l)&&(t=t||"http://localhost",c.scrollbars="yes");const u=Object.entries(c).reduce(((e,[t,n])=>`${e}${t}=${n},`),"");if(function(e=d()){var t;return _t(e)&&!!(null===(t=window.navigator)||void 0===t?void 0:t.standalone)}(l)&&"_self"!==a)return function(e,t){const n=document.createElement("a");n.href=e,n.target=t;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}(t||"",a),new Qn(null);const h=window.open(t||"",a,u);Ne(h,e,"popup-blocked");try{h.focus()}catch(e){}return new Qn(h)}(e,await tr(e,t,n,$e(),r),dn())}async _openRedirect(e,t,n,r){return await this._originValidation(e),i=await tr(e,t,n,$e(),r),pn().location.href=i,new Promise((()=>{}));var i}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:e,promise:n}=this.eventManagers[t];return e?Promise.resolve(e):(Le(n,"If manager is not set, promise should be"),n)}const n=this.initAndGetManager(e);return this.eventManagers[t]={promise:n},n.catch((()=>{delete this.eventManagers[t]})),n}async initAndGetManager(e){const t=await async function(e){const t=await Kn(e),n=pn().gapi;return Ne(n,e,"internal-error"),t.open({where:document.body,url:Xn(e),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Jn,dontclear:!0},(t=>new Promise((async(n,r)=>{await t.restyle({setHideOnLeave:!1});const i=Oe(e,"network-request-failed"),s=pn().setTimeout((()=>{r(i)}),Gn.get());function o(){pn().clearTimeout(s),n(t)}t.ping(o).then(o,(()=>{r(i)}))}))))}(e),n=new Un(e);return t.register("authEvent",(t=>(Ne(null==t?void 0:t.authEvent,e,"invalid-auth-event"),{status:n.onEvent(t.authEvent)?"ACK":"ERROR"})),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:n},this.iframes[e._key()]=t,n}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(nr,{type:nr},(n=>{var r;const i=null===(r=null==n?void 0:n[0])||void 0===r?void 0:r[nr];void 0!==i&&t(!!i),Re(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 We(e,"GET","/v1/projects",t)}(e);for(const e of t)try{if(Hn(e))return}catch(e){}Re(e,"unauthorized-domain")}(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return It()||ft()||_t()}};var ir="@firebase/auth",sr="1.1.0";class or{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=>{e((null==t?void 0:t.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(){Ne(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}const ar=l("authIdTokenMaxAge")||300;let cr=null;function lr(e=function(e=te){const t=re.get(e);if(!t&&e===te&&c())return de();if(!t)throw ce.create("no-app",{appName:e});return t}()){const t=ae(e,"auth");if(t.isInitialized())return t.getImmediate();const n=function(e,t){const n=ae(e,"auth");if(n.isInitialized()){const e=n.getImmediate();if(m(n.getOptions(),null!=t?t:{}))return e;Re(e,"already-initialized")}return n.initialize({options:t})}(e,{popupRedirectResolver:rr,persistence:[En,an,ln]}),r=l("authTokenSyncURL");if(r){const e=(i=r,async e=>{const t=e&&await e.getIdTokenResult(),n=t&&((new Date).getTime()-Date.parse(t.issuedAtTime))/1e3;if(n&&n>ar)return;const r=null==t?void 0:t.token;cr!==r&&(cr=r,await fetch(i,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))});!function(e,t,n){w(e).beforeAuthStateChanged(t,n)}(n,e,(()=>e(n.currentUser))),function(t,n,r,i){w(t).onIdTokenChanged((t=>e(t)),void 0,void 0)}(n)}var i;const s=(o="auth",null===(d=null===(u=a())||void 0===u?void 0:u.emulatorHosts)||void 0===d?void 0:d[o]);var o,u,d;return s&&function(e,t,n){const r=Nt(e);Ne(r._canInitEmulator,r,"emulator-config-failed"),Ne(/^https?:\/\//.test(t),r,"invalid-emulator-scheme");const i=!!(null==n?void 0:n.disableWarnings),s=Lt(t),{host:o,port:a}=function(e){const t=Lt(e),n=/(\/\/)?([^?#/]+)/.exec(e.substr(t.length));if(!n)return{host:"",port:null};const r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const e=i[1];return{host:e,port:$t(r.substr(e.length+1))}}{const[e,t]=r.split(":");return{host:e,port:$t(t)}}}(t),c=null===a?"":`:${a}`;r.config.emulator={url:`${s}//${o}${c}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:a,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||function(){function e(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}"undefined"!=typeof console&&"function"==typeof console.info&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),"undefined"!=typeof window&&"undefined"!=typeof document&&("loading"===document.readyState?window.addEventListener("DOMContentLoaded",e):e())}()}(n,`http://${s}`),n}var ur;ur="Browser",oe(new T("auth",((e,{options:t})=>{const n=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),i=e.getProvider("app-check-internal"),{apiKey:s,authDomain:o}=n.options;Ne(s&&!s.includes(":"),"invalid-api-key",{appName:n.name});const a={apiKey:s,authDomain:o,clientPlatform:ur,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:wt(ur)},c=new Pt(n,r,i,a);return function(e,t){const n=(null==t?void 0:t.persistence)||[],r=(Array.isArray(n)?n:[n]).map(at);(null==t?void 0:t.errorMap)&&e._updateErrorMap(t.errorMap),e._initializeWithPersistence(r,null==t?void 0:t.popupRedirectResolver)}(c,t),c}),"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback(((e,t,n)=>{e.getProvider("auth-internal").initialize()}))),oe(new T("auth-internal",(e=>{return t=Nt(e.getProvider("auth").getImmediate()),new or(t);var t}),"PRIVATE").setInstantiationMode("EXPLICIT")),he(ir,sr,function(e){switch(e){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}(ur)),he(ir,sr,"esm2017");var dr=n(560),hr=n.n(dr);const pr=(e,t)=>async(n,r={})=>{const i=t?await t.getIdToken():null,s=await fetch(`${e}${n}`,{mode:"cors",...r,headers:{...i&&{authorization:`Bearer ${i}`},...r.body&&{"content-type":"application/json"},...r.headers},...r.body&&{body:JSON.stringify(r.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},fr=(e,t)=>{const n=Array.isArray(t.inputProps);return Object.keys(e).reduce(((r,i)=>{if(n&&!t.inputProps.includes(i))return r;const{isRef:s,isScalar:o,isRequired:a}=t.properties[i]||{};return s&&o&&!a&&null===e[i]?r:{...r,[i]:e[i]}}),{})},mr=(e,t,n,r={},i={})=>{const s=(({primaryKey:e,properties:t,...n})=>({primaryKey:e||"id",properties:Object.keys(t||{}).reduce(((e,n)=>{const r=t[n]||{},{type:i,isScalar:s,isRequired:o,isRef:a=!1}="string"==typeof r.type?"array"===r.type?r.enum?{type:"string",isScalar:!1,isRequired:!1}:r.items?.$ref?{type:r.items.$ref.split("/").pop(),isScalar:!1,isRequired:!1,isRef:!0}:{type:r.items?.type,isScalar:!1,isRequired:!1}:{type:"date-time"===r.format?"date":r.type,isScalar:!0,isRequired:!0}:Array.isArray(r.type)?2===r.type.length?{type:"date-time"===r.format?"date":r.type[0],isScalar:!0,isRequired:!1}:{type:"json",isScalar:!0,isRequired:r.type.includes("null")}:r.$ref?{type:r.$ref.split("/").pop(),isScalar:!0,isRequired:!0,isRef:!0}:{type:r.anyOf[0].$ref.split("/").pop(),isScalar:!0,isRequired:!1,isRef:!0},c=r.inputType||("integer"===i?"number":i);return{...e,[n]:{...t[n],type:i,isScalar:s,isRequired:"boolean"==typeof r.isRequired?r.isRequired:o,isRef:a,inputType:c}}}),{}),...n}))(r),{primaryKey:o,properties:a}=s,c=(e=>{const t=e.properties||{},n=e.inputProps||Object.keys(t),r=(e,n)=>{const r=t[e]||{};if([null,void 0].includes(n)){if(!r.isRequired)return;return{id:"value-missing-validation-error"}}if(r.enum){if(r.enum.includes(n))return;return{id:"enum-validation-error",values:{enum:r.enum,value:n}}}switch(r.type){case"integer":if(r.isScalar&&("number"!=typeof n||Number.isNaN(n)))return{id:"invalid-number-validation-error"};break;case"date":case"boolean":break;default:if(r.isRequired&&!n)return{id:"value-missing-validation-error"}}};return{validate:e=>n.reduce(((t,n)=>{const i=r(n,e[n]);return i?{...t,[n]:i}:t}),{}),validateAttr:r}})(s),l=(e=>{const t=(n=e,[...n].reduce(((e,t)=>t===t.toUpperCase()?`${e}-${t.toLowerCase()}`:`${e}${t}`),""));var n;return(e,n)=>`/${t}${e?`/${encodeURIComponent(e)}`:""}${((e={})=>Object.keys(e).length?`?q=${JSON.stringify(e)}`:"")(n)}`})(n),u=(...n)=>pr(e,t.authUser)(...n),d=({data:e,...t})=>u(l(null,t),{method:"POST",body:fr(e,s)}),h=({data:e,...t})=>{const{where:n,...r}=t;return u(l(n[o],r),{method:"PUT",body:fr(e,s)})},p=e=>{if(!e)return e;const t=Object.keys(e).reduce(((t,n)=>{const r=a[n]||{},{type:s,isScalar:o,isRef:c,format:l,items:u}=r;if(c){const r=`${(d=s)[0].toLowerCase()}${d.slice(1)}`;return o?{...t,[n]:i[r].parse(e[n])}:{...t,[n]:"function"==typeof i[r]?.parse?e[n].map((e=>i[r].parse(e))):e[n]}}var d;return{...t,[n]:"date"===s&&e[n]?new Date(e[n]):e[n]}}),{});return"function"==typeof s.parse?s.parse(t):t},f=Object.keys(a||{}).reduce(((e,t)=>a[t].isRef&&a[t].isScalar&&a[t].isRequired?Object.assign(e,{all:e.all.concat(t),oneToOne:e.oneToOne.concat(t),requiredOneToOne:e.requiredOneToOne.concat(t)}):a[t].isRef&&a[t].isScalar?Object.assign(e,{all:e.all.concat(t),oneToOne:e.oneToOne.concat(t),optionalOneToOne:e.optionalOneToOne.concat(t)}):a[t].isRef?Object.assign(e,{all:e.all.concat(t),oneToMany:e.oneToMany.concat(t)}):e),{all:[],oneToOne:[],requiredOneToOne:[],optionalOneToOne:[],oneToMany:[]});return{get schema(){return s},get relations(){return f},parse:p,validateAttr:c.validateAttr,validate:c.validate,findMany:e=>u(l(null,e)).then((e=>e.map(p))),findById:(e,t)=>u(l(e,t)).then(p),create:d,update:h,upsert:e=>e.where[o]?h({where:e.where,data:e.update}):d({data:e.create}),delete:e=>u(l(e),{method:"DELETE"}),stats:()=>u(l("_stats"))}},gr=(e,t,n)=>Object.keys(n.properties).reduce(((r,i)=>{const s=n.properties[i].$ref.split("/").pop();return Object.assign(r,{[i]:mr(e,t,n.definitions[s].plural||`${i}s`,n.definitions[s],r)})}),{}),yr=(e,t)=>Object.keys(e.definitions).reduce(((n,r)=>({...n,[r]:t[r]?{...e.definitions[r],...t[r],properties:Object.keys(e.definitions[r].properties).reduce(((n,i)=>({...n,[i]:{...e.definitions[r].properties[i],...(t[r].properties||{})[i]}})),t[r].properties||{})}:e.definitions[r]})),{}),vr=JSON.parse('{"$schema":"http://json-schema.org/draft-07/schema#","definitions":{"Country":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"incomeFilter":{"type":["integer","null"]},"canApply":{"type":"boolean","default":false},"capital":{"type":"array","items":{"type":"string"}},"timeZone":{"type":["string","null"]},"flag":{"type":["string","null"]},"currency":{"anyOf":[{"$ref":"#/definitions/Currency"},{"type":"null"}]},"contracts":{"type":"array","items":{"$ref":"#/definitions/Contract"}},"users":{"type":"array","items":{"$ref":"#/definitions/User"}},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}},"applicationNationalities":{"type":"array","items":{"$ref":"#/definitions/Application"}},"educationLevels":{"type":"array","items":{"$ref":"#/definitions/EducationLevel"}},"universities":{"type":"array","items":{"$ref":"#/definitions/University"}},"companies":{"type":"array","items":{"$ref":"#/definitions/Company"}},"jobs":{"type":"array","items":{"$ref":"#/definitions/Job"}}}},"Currency":{"type":"object","properties":{"code":{"type":"string"},"name":{"type":"string"},"symbol":{"type":"string"},"countries":{"type":"array","items":{"$ref":"#/definitions/Country"}}}},"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"]},"role":{"type":["string","null"],"enum":["staff","manager","finance","admin"]},"disabled":{"type":"boolean","default":false},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"referralSource":{"type":["string","null"],"enum":["word_of_mouth","codigo_m","social","google","print","tv","radio","other"]},"identifiesAsFemale":{"type":["boolean","null"]},"dateOfBirth":{"type":["string","null"],"format":"date-time"},"identificationNumber":{"type":["string","null"]},"mobileNumber":{"type":["string","null"]},"github":{"type":["string","null"]},"linkedin":{"type":["string","null"]},"bio":{"type":["string","null"]},"country":{"anyOf":[{"$ref":"#/definitions/Country"},{"type":"null"}]},"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"}},"activityLog":{"type":"array","items":{"$ref":"#/definitions/ActivityLogEntry"}},"authoredActivityLog":{"type":"array","items":{"$ref":"#/definitions/ActivityLogEntry"}},"jobValidityReviews":{"type":"array","items":{"$ref":"#/definitions/JobValidityReview"}},"jobApplications":{"type":"array","items":{"$ref":"#/definitions/JobApplication"}}}},"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"]},"langs":{"type":"array","enum":["en","es","pt"]},"hidden":{"type":"boolean","default":false},"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"},"lang":{"type":["string","null"],"enum":["en","es","pt"]},"start":{"type":"string","format":"date-time"},"end":{"type":"string","format":"date-time"},"timeZone":{"type":["string","null"]},"startTime":{"type":["string","null"]},"endTime":{"type":["string","null"]},"legacySlug":{"type":"string"},"vacancies":{"type":["integer","null"]},"admissionStart":{"type":["string","null"],"format":"date-time"},"admissionEnd":{"type":["string","null"],"format":"date-time"},"admissionCountries":{"type":"array","items":{"type":"string"}},"placementStart":{"type":["string","null"],"format":"date-time"},"placementDuration":{"type":["integer","null"]},"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"}},"activityLog":{"type":"array","items":{"$ref":"#/definitions/ActivityLogEntry"}},"jobApplications":{"type":"array","items":{"$ref":"#/definitions/JobApplication"}}}},"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"}}},"IscedLevel":{"type":"object","properties":{"id":{"type":"integer"},"label":{"type":"string"},"educationLevels":{"type":"array","items":{"$ref":"#/definitions/EducationLevel"}}}},"EducationLevel":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lang":{"type":"string","enum":["en","es","pt"]},"label":{"type":"string"},"country":{"$ref":"#/definitions/Country"},"iscedLevel":{"$ref":"#/definitions/IscedLevel"},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}}}},"University":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"lang":{"type":"string","enum":["en","es","pt"]},"name":{"type":"string"},"filter":{"type":"boolean"},"country":{"$ref":"#/definitions/Country"},"applications":{"type":"array","items":{"$ref":"#/definitions/Application"}}}},"Application":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"dateOfBirth":{"type":"string","format":"date-time"},"isAllowedToWork":{"type":"boolean"},"hasValidIdDocument":{"type":"boolean"},"locality":{"type":["number","string","boolean","object","array","null"]},"householdSize":{"type":"integer"},"children":{"type":"integer"},"householdIncome":{"type":"integer"},"racialIdentity":{"type":["string","null"]},"schoolType":{"type":["string","null"],"enum":["private","public","other","subsidized","mixed"]},"educationSubject":{"type":["string","null"],"enum":["design_and_media","software_engineering","engineering","management_and_business","languages","science","health","social_sciences","arts","comms_and_advertising","education","cooking","tourism","economics_and_accounting","law","other"]},"isStudying":{"type":"boolean"},"englishLevel":{"type":["string","null"],"enum":["NO","A1","A2","B1","B2","C1","C2"]},"workStatus":{"type":"string","enum":["never","not_now","yes"]},"isLookingForWork":{"type":["boolean","null"]},"monthsLookingForWork":{"type":["integer","null"]},"monthsUnemployed":{"type":["integer","null"]},"workRole":{"type":["string","null"],"enum":["waitress","promoter","manager","cashier","intern","operative","call_center","receptionist","sales_agent","assistant","professional","technical","consultant","other"]},"freelance":{"type":["boolean","null"]},"workFormal":{"type":["boolean","null"]},"workIncome":{"type":["integer","null"]},"failedFilters":{"type":"array","items":{"type":"string"}},"bypassFilters":{"type":"boolean","default":false},"isReady":{"type":"boolean","default":false},"isReturningApplicant":{"type":["boolean","null"]},"legacyAdmissionCohortSlug":{"type":["string","null"]},"cohort":{"$ref":"#/definitions/Cohort"},"user":{"$ref":"#/definitions/User"},"country":{"$ref":"#/definitions/Country"},"nationality":{"$ref":"#/definitions/Country"},"educationLevel":{"$ref":"#/definitions/EducationLevel"},"university":{"anyOf":[{"$ref":"#/definitions/University"},{"type":"null"}]},"challengeAssignments":{"type":"array","items":{"$ref":"#/definitions/ApplicationChallengeAssignment"}}}},"ApplicationChallenge":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"slug":{"type":"string"},"version":{"type":"string"},"trackId":{"type":"integer"},"langs":{"type":"array","enum":["en","es","pt"]},"json":{"type":"string"},"archived":{"type":"boolean","default":false},"assignments":{"type":"array","items":{"$ref":"#/definitions/ApplicationChallengeAssignment"}}}},"ApplicationChallengeAssignment":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"application":{"$ref":"#/definitions/Application"},"challenge":{"$ref":"#/definitions/ApplicationChallenge"}}},"ActivityLogEntry":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"type":{"type":"string","enum":["challenge","application_filter","application_filter_bypass","application_cohort_change"]},"data":{"type":["number","string","boolean","object","array","null"]},"path":{"type":"string"},"author":{"$ref":"#/definitions/User"},"user":{"$ref":"#/definitions/User"},"cohort":{"$ref":"#/definitions/Cohort"}}},"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","slack"]},"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"}}},"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"}}}},"Company":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"source":{"type":"string"},"sourceId":{"type":"string"},"name":{"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","enum":["Tech_Consultancy","Digital_Transformation","Agency","Startups","High_tech","Traditional_Consulting"]}}},"Job":{"type":"object","properties":{"id":{"type":"integer"},"createdAt":{"type":"string","format":"date-time"},"updatedAt":{"type":"string","format":"date-time"},"createdBy":{"type":["string","null"]},"source":{"type":"string"},"sourceId":{"type":"string"},"title":{"type":"string"},"publishedAt":{"type":"string","format":"date-time"},"modality":{"type":"string"},"publicUrl":{"type":["string","null"]},"location":{"type":["string","null"]},"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"]},"remoteOption":{"type":["string","null"],"enum":["remote_for_now","locally_remote","fully_remote","no_remote","mixed"]},"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"},"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"]},"author":{"$ref":"#/definitions/User"},"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"]},"status":{"type":"string","default":"pending","enum":["pending","applied","interview","challenge","followup","hired","not_hired"]},"hireDate":{"type":["string","null"],"format":"date-time"},"jobStartDate":{"type":["string","null"],"format":"date-time"},"netSalary":{"type":["integer","null"]},"grossSalary":{"type":["integer","null"]},"currency":{"type":["string","null"]},"job":{"$ref":"#/definitions/Job"},"user":{"$ref":"#/definitions/User"},"cohort":{"anyOf":[{"$ref":"#/definitions/Cohort"},{"type":"null"}]}}}},"type":"object","properties":{"country":{"$ref":"#/definitions/Country"},"currency":{"$ref":"#/definitions/Currency"},"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"},"iscedLevel":{"$ref":"#/definitions/IscedLevel"},"educationLevel":{"$ref":"#/definitions/EducationLevel"},"university":{"$ref":"#/definitions/University"},"application":{"$ref":"#/definitions/Application"},"applicationChallenge":{"$ref":"#/definitions/ApplicationChallenge"},"applicationChallengeAssignment":{"$ref":"#/definitions/ApplicationChallengeAssignment"},"activityLogEntry":{"$ref":"#/definitions/ActivityLogEntry"},"contract":{"$ref":"#/definitions/Contract"},"gig":{"$ref":"#/definitions/Gig"},"message":{"$ref":"#/definitions/Message"},"messageLog":{"$ref":"#/definitions/MessageLog"},"industry":{"$ref":"#/definitions/Industry"},"company":{"$ref":"#/definitions/Company"},"job":{"$ref":"#/definitions/Job"},"jobValidityReview":{"$ref":"#/definitions/JobValidityReview"},"jobApplication":{"$ref":"#/definitions/JobApplication"}}}'),br={Country:{primaryKey:"code",plural:"countries",searchProps:["code","name","timeZone"],getOptionLabel:({code:e,name:t})=>`${e} / ${t}`},ActivityLogEntry:{plural:"activityLog"},User:{primaryKey:"uid",inputProps:["firstName","lastName","email","password","lang","identifiesAsFemale","dateOfBirth","country","identificationNumber","mobileNumber","github","linkedin","bio","role","signupCohort","disabled","referralSource"],searchProps:["firstName","lastName","email"],getOptionLabel:({firstName:e,lastName:t,email:n})=>`${e} ${t} (${n})`,properties:{email:{inputType:"email"},mobileNumber:{inputType:"phone"},bio:{inputType:"textarea"}},parse:e=>{const t=e.github?`https://github.com/${e.github}.png?size=`:`https://www.gravatar.com/avatar/${hr()(e.email)}?s=`;return{...e,fullName:`${e.firstName||""}${e.lastName?` ${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","lang","name","start","end","timeZone","startTime","endTime","vacancies","admissionStart","admissionEnd","placementStart","admissionCountries"],searchProps:["name"],getOptionLabel:({id:e,name:t,stage:n})=>`${t}${n?` - ${n.name}`:""} (id: ${e})`,properties:{},parse:e=>{const t=Date.now();let n;if(e.placementStart){const r=e.placementDuration||270;new Date(+e.placementStart+24*r*60*60*1e3)<t?n="placement_ended":e.placementStart<t&&(n="placement_started")}!n&&e.end<t&&(n="ended"),!n&&e.start<t&&(n="started");const r=!!e.admissionEnd&&+e.admissionEnd+864e5;!n&&r&&r<t&&(n="admission_ended"),!n&&e.admissionStart&&e.admissionStart<t&&(n="admission_started"),!n&&e.admissionStart&&e.admissionEnd&&(n="planned"),n||(n="draft");const i=e.start>t&&e.vacancies?e.vacancies:e._count?.students||e.students?.length||0;return{...e,status:n,size:i}}},Student:{inputProps:["cohort","user"],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:["user","cohort","dateOfBirth","country","locality","nationality","isAllowedToWork","hasValidIdDocument","householdSize","children","householdIncome","racialIdentity","educationLevel","schoolType","educationSubject","university","isStudying","englishLevel","workStatus","isLookingForWork","monthsLookingForWork","monthsUnemployed","workRole","freelance","workFormal","workIncome","isReady","bypassFilters"],properties:{locality:{isRequired:!0},englishLevel:{isRequired:!0},isReady:{isRequired:!1},bypassFilters:{isRequired:!1}},parse:e=>{const t="boolean"==typeof e.hasFailedFilters?e.hasFailedFilters:"number"==typeof e.failedFilters?.length?e.failedFilters.length>0:void 0;if(!e.cohort?.admissionEnd||void 0===t)return e;const n=Date.now();let r;return r=e.isReady?"ready":t&&!e.bypassFilters?"rejected":e.createdAt<n-7776e6?"expired":"admission_started"!==e.cohort?.status?"admission_ended":"active",{...e,status:r}}},IscedLevel:{parse:e=>{const t=Math.floor(e.id/10);return{...e,level:t,completed:10*t<e.id}}},EducationLevel:{searchProps:["label"]},University:{plural:"universities",searchProps:["name"]},Job:{},Company:{plural:"companies"}},_r="https://raw.githubusercontent.com/Laboratoria/bootcamp",Ir=()=>fetch("https://api.github.com/repos/Laboratoria/bootcamp/releases/latest").then((e=>e.json())).then((({tag_name:e})=>e)),wr=e=>t=>t.filter((t=>!(e.locale&&e.locale!==t.locale||e.track&&e.track!==t.track))),Tr=e=>e>9?`${e}`:`0${e}`,Er=e=>`${Tr(e.getUTCDate())}/${Tr(e.getUTCMonth()+1)}/${e.getUTCFullYear()}`,kr=e=>`${Tr(e.getUTCHours())}:${Tr(e.getUTCMinutes())}:${e.getUTCSeconds()} UTC`,Sr=e=>`${Er(e)} ${kr(e)}`,Ar={es:"es-ES",pt:"pt-BR"},Cr=(e,t="es",n=!1)=>new Intl.DateTimeFormat(Ar[t],{...n&&{year:"numeric"},month:"long",day:"numeric",timeZone:"UTC"}).format(new Date(e)),Rr=(e,t)=>{let n=t.getFullYear()-e.getFullYear();const r=t.getMonth()-e.getMonth();return(r<0||0===r&&t.getDate()<e.getDate())&&n--,n},Or=(e,t,n,r)=>((e,t,n)=>new Intl.NumberFormat(`${e}-${t}`,{currency:n}))(t,n,r).format(e),Pr=e=>parseInt(e.replace(/[,\.]/g,""),10),Nr=e=>{try{return JSON.parse(window.localStorage.getItem(e))}catch(e){return null}},Dr=({firebaseApiKey:e="AIzaSyAXbaEbpq8NOfn0r8mIrcoHvoGRkJThwdc",firebaseProject:t="laboratoria-la",coreApiUrl:n="https://us-central1-outpost-272720.cloudfunctions.net/core-api"}={})=>{const r=de({apiKey:e,authDomain:`${t}.firebaseapp.com`,databaseURL:`https://${t}.firebaseio.com`,projectId:t}),i=lr(r),s={authUser:void 0,user:void 0},o=((e,t)=>({...gr(e,t,{...vr,definitions:yr(vr,br)}),gcpLog:{getEntries:async n=>{const r=pr(e,t.authUser);return await r(`/gcp-logs?q=${JSON.stringify(n)}`)}}}))(n,s),a={onChange:e=>{return t=t=>{if(!t)return Object.assign(s,{authUser:null,user:null}),e(s);Object.assign(s,{authUser:t}),o.user.findById(t.uid).then((t=>{Object.assign(s,{user:t}),e(s)})).catch((t=>{console.error(t),Object.assign(s,{authUser:null,user:null}),e(s)}))},w(i).onAuthStateChanged(t,undefined,undefined);var t},signIn:(e,t)=>function(e,t,n){return async function(e,t){return nn(Nt(e),t)}(w(e),zt.credential(t,n))}(i,e,t),signOut:()=>w(i).signOut(),sendPasswordResetEmail:e=>async function(e,t,n){var r;const i=Nt(e),s={requestType:"PASSWORD_RESET",email:t,clientType:"CLIENT_TYPE_WEB"};if(null===(r=i._getRecaptchaConfig())||void 0===r?void 0:r.emailPasswordEnabled){const e=await Rt(i,s,"getOobCode",!0);await Ut(i,e)}else await Ut(i,s).catch((async e=>{if("auth/missing-recaptcha-token"!==e.code)return Promise.reject(e);{console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const e=await Rt(i,s,"getOobCode",!0);await Ut(i,e)}}))}(i,e)};return{project:{findMany:(e={})=>(async e=>fetch(`${_r}/${e||await Ir()}/dist/projects.json`).then((e=>e.json())))(e.tag).then(wr(e)),findById:(e,t={})=>(async(e,t)=>fetch(`${_r}/${t||await Ir()}/dist/projects/${e}.json`).then((e=>e.json())))(e,t.tag)},topic:{findMany:(e={})=>(async e=>fetch(`${_r}/${e||await Ir()}/dist/topics.json`).then((e=>e.json())))(e.tag).then(wr(e)),findById:(e,t={})=>(async(e,t)=>fetch(`${_r}/${t||await Ir()}/dist/topics/${e}.json`).then((e=>e.json())))(e,t.tag)},learningObjective:{findMany:(e={})=>(async e=>fetch(`${_r}/${e||await Ir()}/dist/learning-objectives.json`).then((e=>e.json())))(e.tag)},...o,auth:a,firebaseApp:r}}})(),r})()));
|
1
|
+
(function(k,ie){typeof exports=="object"&&typeof module<"u"?ie(exports):typeof define=="function"&&define.amd?define(["exports"],ie):(k=typeof globalThis<"u"?globalThis:k||self,ie(k.laboratoria={}))})(this,function(k){"use strict";/**
|
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
|
+
* @license
|
18
|
+
* Copyright 2017 Google LLC
|
19
|
+
*
|
20
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
21
|
+
* you may not use this file except in compliance with the License.
|
22
|
+
* You may obtain a copy of the License at
|
23
|
+
*
|
24
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
25
|
+
*
|
26
|
+
* Unless required by applicable law or agreed to in writing, software
|
27
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
28
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
29
|
+
* See the License for the specific language governing permissions and
|
30
|
+
* limitations under the License.
|
31
|
+
*/const ie=function(n){const e=[];let t=0;for(let r=0;r<n.length;r++){let i=n.charCodeAt(r);i<128?e[t++]=i:i<2048?(e[t++]=i>>6|192,e[t++]=i&63|128):(i&64512)===55296&&r+1<n.length&&(n.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(n.charCodeAt(++r)&1023),e[t++]=i>>18|240,e[t++]=i>>12&63|128,e[t++]=i>>6&63|128,e[t++]=i&63|128):(e[t++]=i>>12|224,e[t++]=i>>6&63|128,e[t++]=i&63|128)}return e},Hn=function(n){const e=[];let t=0,r=0;for(;t<n.length;){const i=n[t++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){const s=n[t++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){const s=n[t++],o=n[t++],c=n[t++],a=((i&7)<<18|(s&63)<<12|(o&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(a>>10)),e[r++]=String.fromCharCode(56320+(a&1023))}else{const s=n[t++],o=n[t++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|o&63)}}return e.join("")},bt={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:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();const t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<n.length;i+=3){const s=n[i],o=i+1<n.length,c=o?n[i+1]:0,a=i+2<n.length,u=a?n[i+2]:0,_=s>>2,b=(s&3)<<4|c>>4;let A=(c&15)<<2|u>>6,O=u&63;a||(O=64,o||(A=64)),r.push(t[_],t[b],t[A],t[O])}return r.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(ie(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Hn(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();const t=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<n.length;){const s=t[n.charAt(i++)],c=i<n.length?t[n.charAt(i)]:0;++i;const u=i<n.length?t[n.charAt(i)]:64;++i;const b=i<n.length?t[n.charAt(i)]:64;if(++i,s==null||c==null||u==null||b==null)throw new Wn;const A=s<<2|c>>4;if(r.push(A),u!==64){const O=c<<4&240|u>>2;if(r.push(O),b!==64){const N=u<<6&192|b;r.push(N)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}};class Wn extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}}const xn=function(n){const e=ie(n);return bt.encodeByteArray(e,!0)},It=function(n){return xn(n).replace(/\./g,"")},wt=function(n){try{return bt.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};/**
|
32
|
+
* @license
|
33
|
+
* Copyright 2022 Google LLC
|
34
|
+
*
|
35
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
36
|
+
* you may not use this file except in compliance with the License.
|
37
|
+
* You may obtain a copy of the License at
|
38
|
+
*
|
39
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
40
|
+
*
|
41
|
+
* Unless required by applicable law or agreed to in writing, software
|
42
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
43
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
44
|
+
* See the License for the specific language governing permissions and
|
45
|
+
* limitations under the License.
|
46
|
+
*/function zn(){if(typeof self<"u")return self;if(typeof window<"u")return window;if(typeof global<"u")return global;throw new Error("Unable to locate global object.")}/**
|
47
|
+
* @license
|
48
|
+
* Copyright 2022 Google LLC
|
49
|
+
*
|
50
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
51
|
+
* you may not use this file except in compliance with the License.
|
52
|
+
* You may obtain a copy of the License at
|
53
|
+
*
|
54
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
55
|
+
*
|
56
|
+
* Unless required by applicable law or agreed to in writing, software
|
57
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
58
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
59
|
+
* See the License for the specific language governing permissions and
|
60
|
+
* limitations under the License.
|
61
|
+
*/const qn=()=>zn().__FIREBASE_DEFAULTS__,Gn=()=>{if(typeof process>"u"||typeof process.env>"u")return;const n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Kn=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}const e=n&&wt(n[1]);return e&&JSON.parse(e)},qe=()=>{try{return qn()||Gn()||Kn()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Jn=n=>{var e,t;return(t=(e=qe())===null||e===void 0?void 0:e.emulatorHosts)===null||t===void 0?void 0:t[n]},Et=()=>{var n;return(n=qe())===null||n===void 0?void 0:n.config},Tt=n=>{var e;return(e=qe())===null||e===void 0?void 0:e[`_${n}`]};/**
|
62
|
+
* @license
|
63
|
+
* Copyright 2017 Google LLC
|
64
|
+
*
|
65
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
66
|
+
* you may not use this file except in compliance with the License.
|
67
|
+
* You may obtain a copy of the License at
|
68
|
+
*
|
69
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
70
|
+
*
|
71
|
+
* Unless required by applicable law or agreed to in writing, software
|
72
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
73
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
74
|
+
* See the License for the specific language governing permissions and
|
75
|
+
* limitations under the License.
|
76
|
+
*/class Yn{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),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,r))}}}/**
|
77
|
+
* @license
|
78
|
+
* Copyright 2017 Google LLC
|
79
|
+
*
|
80
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
81
|
+
* you may not use this file except in compliance with the License.
|
82
|
+
* You may obtain a copy of the License at
|
83
|
+
*
|
84
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
85
|
+
*
|
86
|
+
* Unless required by applicable law or agreed to in writing, software
|
87
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
88
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
89
|
+
* See the License for the specific language governing permissions and
|
90
|
+
* limitations under the License.
|
91
|
+
*/function R(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Xn(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(R())}function Qn(){const n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Zn(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function er(){const n=R();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function tr(){try{return typeof indexedDB=="object"}catch{return!1}}function nr(){return new Promise((n,e)=>{try{let t=!0;const r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),t||self.indexedDB.deleteDatabase(r),n(!0)},i.onupgradeneeded=()=>{t=!1},i.onerror=()=>{var s;e(((s=i.error)===null||s===void 0?void 0:s.message)||"")}}catch(t){e(t)}})}/**
|
92
|
+
* @license
|
93
|
+
* Copyright 2017 Google LLC
|
94
|
+
*
|
95
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
96
|
+
* you may not use this file except in compliance with the License.
|
97
|
+
* You may obtain a copy of the License at
|
98
|
+
*
|
99
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
100
|
+
*
|
101
|
+
* Unless required by applicable law or agreed to in writing, software
|
102
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
103
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
104
|
+
* See the License for the specific language governing permissions and
|
105
|
+
* limitations under the License.
|
106
|
+
*/const rr="FirebaseError";class V extends Error{constructor(e,t,r){super(t),this.code=e,this.customData=r,this.name=rr,Object.setPrototypeOf(this,V.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,he.prototype.create)}}class he{constructor(e,t,r){this.service=e,this.serviceName=t,this.errors=r}create(e,...t){const r=t[0]||{},i=`${this.service}/${e}`,s=this.errors[e],o=s?ir(s,r):"Error",c=`${this.serviceName}: ${o} (${i}).`;return new V(i,c,r)}}function ir(n,e){return n.replace(sr,(t,r)=>{const i=e[r];return i!=null?String(i):`<${r}?>`})}const sr=/\{\$([^}]+)}/g;function or(n){for(const e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Re(n,e){if(n===e)return!0;const t=Object.keys(n),r=Object.keys(e);for(const i of t){if(!r.includes(i))return!1;const s=n[i],o=e[i];if(At(s)&&At(o)){if(!Re(s,o))return!1}else if(s!==o)return!1}for(const i of r)if(!t.includes(i))return!1;return!0}function At(n){return n!==null&&typeof n=="object"}/**
|
107
|
+
* @license
|
108
|
+
* Copyright 2017 Google LLC
|
109
|
+
*
|
110
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
111
|
+
* you may not use this file except in compliance with the License.
|
112
|
+
* You may obtain a copy of the License at
|
113
|
+
*
|
114
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
115
|
+
*
|
116
|
+
* Unless required by applicable law or agreed to in writing, software
|
117
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
118
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
119
|
+
* See the License for the specific language governing permissions and
|
120
|
+
* limitations under the License.
|
121
|
+
*/function fe(n){const e=[];for(const[t,r]of Object.entries(n))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function pe(n){const e={};return n.replace(/^\?/,"").split("&").forEach(r=>{if(r){const[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function ge(n){const e=n.indexOf("?");if(!e)return"";const t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function ar(n,e){const t=new cr(n,e);return t.subscribe.bind(t)}class cr{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(r=>{this.error(r)})}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 i;if(e===void 0&&t===void 0&&r===void 0)throw new Error("Missing Observer.");lr(e,["next","error","complete"])?i=e:i={next:e,error:t,complete:r},i.next===void 0&&(i.next=Ge),i.error===void 0&&(i.error=Ge),i.complete===void 0&&(i.complete=Ge);const s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?i.error(this.finalError):i.complete()}catch{}}),this.observers.push(i),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&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(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(r){typeof console<"u"&&console.error&&console.error(r)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}}function lr(n,e){if(typeof n!="object"||n===null)return!1;for(const t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Ge(){}/**
|
122
|
+
* @license
|
123
|
+
* Copyright 2021 Google LLC
|
124
|
+
*
|
125
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
126
|
+
* you may not use this file except in compliance with the License.
|
127
|
+
* You may obtain a copy of the License at
|
128
|
+
*
|
129
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
130
|
+
*
|
131
|
+
* Unless required by applicable law or agreed to in writing, software
|
132
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
133
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
134
|
+
* See the License for the specific language governing permissions and
|
135
|
+
* limitations under the License.
|
136
|
+
*/function U(n){return n&&n._delegate?n._delegate:n}class se{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}}/**
|
137
|
+
* @license
|
138
|
+
* Copyright 2019 Google LLC
|
139
|
+
*
|
140
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
141
|
+
* you may not use this file except in compliance with the License.
|
142
|
+
* You may obtain a copy of the License at
|
143
|
+
*
|
144
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
145
|
+
*
|
146
|
+
* Unless required by applicable law or agreed to in writing, software
|
147
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
148
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
149
|
+
* See the License for the specific language governing permissions and
|
150
|
+
* limitations under the License.
|
151
|
+
*/const X="[DEFAULT]";/**
|
152
|
+
* @license
|
153
|
+
* Copyright 2019 Google LLC
|
154
|
+
*
|
155
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
156
|
+
* you may not use this file except in compliance with the License.
|
157
|
+
* You may obtain a copy of the License at
|
158
|
+
*
|
159
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
160
|
+
*
|
161
|
+
* Unless required by applicable law or agreed to in writing, software
|
162
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
163
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
164
|
+
* See the License for the specific language governing permissions and
|
165
|
+
* limitations under the License.
|
166
|
+
*/class dr{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 r=new Yn;if(this.instancesDeferred.set(t,r),this.isInitialized(t)||this.shouldAutoInitialize())try{const i=this.getOrInitializeService({instanceIdentifier:t});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){var t;const r=this.normalizeInstanceIdentifier(e==null?void 0:e.identifier),i=(t=e==null?void 0:e.optional)!==null&&t!==void 0?t:!1;if(this.isInitialized(r)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:r})}catch(s){if(i)return null;throw s}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}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(hr(e))try{this.getOrInitializeService({instanceIdentifier:X})}catch{}for(const[t,r]of this.instancesDeferred.entries()){const i=this.normalizeInstanceIdentifier(t);try{const s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=X){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(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=X){return this.instances.has(e)}getOptions(e=X){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 i=this.getOrInitializeService({instanceIdentifier:r,options:t});for(const[s,o]of this.instancesDeferred.entries()){const c=this.normalizeInstanceIdentifier(s);r===c&&o.resolve(i)}return i}onInit(e,t){var r;const i=this.normalizeInstanceIdentifier(t),s=(r=this.onInitCallbacks.get(i))!==null&&r!==void 0?r:new Set;s.add(e),this.onInitCallbacks.set(i,s);const o=this.instances.get(i);return o&&e(o,i),()=>{s.delete(e)}}invokeOnInitCallbacks(e,t){const r=this.onInitCallbacks.get(t);if(r)for(const i of r)try{i(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:ur(e),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{}return r||null}normalizeInstanceIdentifier(e=X){return this.component?this.component.multipleInstances?e:X:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}}function ur(n){return n===X?void 0:n}function hr(n){return n.instantiationMode==="EAGER"}/**
|
167
|
+
* @license
|
168
|
+
* Copyright 2019 Google LLC
|
169
|
+
*
|
170
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
171
|
+
* you may not use this file except in compliance with the License.
|
172
|
+
* You may obtain a copy of the License at
|
173
|
+
*
|
174
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
175
|
+
*
|
176
|
+
* Unless required by applicable law or agreed to in writing, software
|
177
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
178
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
179
|
+
* See the License for the specific language governing permissions and
|
180
|
+
* limitations under the License.
|
181
|
+
*/class fr{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 dr(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}/**
|
182
|
+
* @license
|
183
|
+
* Copyright 2017 Google LLC
|
184
|
+
*
|
185
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
186
|
+
* you may not use this file except in compliance with the License.
|
187
|
+
* You may obtain a copy of the License at
|
188
|
+
*
|
189
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
190
|
+
*
|
191
|
+
* Unless required by applicable law or agreed to in writing, software
|
192
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
193
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
194
|
+
* See the License for the specific language governing permissions and
|
195
|
+
* limitations under the License.
|
196
|
+
*/var T;(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(T||(T={}));const pr={debug:T.DEBUG,verbose:T.VERBOSE,info:T.INFO,warn:T.WARN,error:T.ERROR,silent:T.SILENT},gr=T.INFO,mr={[T.DEBUG]:"log",[T.VERBOSE]:"log",[T.INFO]:"info",[T.WARN]:"warn",[T.ERROR]:"error"},yr=(n,e,...t)=>{if(e<n.logLevel)return;const r=new Date().toISOString(),i=mr[e];if(i)console[i](`[${r}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)};class St{constructor(e){this.name=e,this._logLevel=gr,this._logHandler=yr,this._userLogHandler=null}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=typeof e=="string"?pr[e]:e}get logHandler(){return this._logHandler}set logHandler(e){if(typeof e!="function")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)}}const _r=(n,e)=>e.some(t=>n instanceof t);let Ct,Rt;function vr(){return Ct||(Ct=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function br(){return Rt||(Rt=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}const Ot=new WeakMap,Ke=new WeakMap,Pt=new WeakMap,Je=new WeakMap,Ye=new WeakMap;function Ir(n){const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(H(n.result)),i()},o=()=>{r(n.error),i()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ot.set(t,n)}).catch(()=>{}),Ye.set(e,n),e}function wr(n){if(Ke.has(n))return;const e=new Promise((t,r)=>{const i=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),i()},o=()=>{r(n.error||new DOMException("AbortError","AbortError")),i()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});Ke.set(n,e)}let Xe={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return Ke.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Pt.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return H(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};function Er(n){Xe=n(Xe)}function Tr(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){const r=n.call(Qe(this),e,...t);return Pt.set(r,e.sort?e.sort():[e]),H(r)}:br().includes(n)?function(...e){return n.apply(Qe(this),e),H(Ot.get(this))}:function(...e){return H(n.apply(Qe(this),e))}}function Ar(n){return typeof n=="function"?Tr(n):(n instanceof IDBTransaction&&wr(n),_r(n,vr())?new Proxy(n,Xe):n)}function H(n){if(n instanceof IDBRequest)return Ir(n);if(Je.has(n))return Je.get(n);const e=Ar(n);return e!==n&&(Je.set(n,e),Ye.set(e,n)),e}const Qe=n=>Ye.get(n);function Sr(n,e,{blocked:t,upgrade:r,blocking:i,terminated:s}={}){const o=indexedDB.open(n,e),c=H(o);return r&&o.addEventListener("upgradeneeded",a=>{r(H(o.result),a.oldVersion,a.newVersion,H(o.transaction),a)}),t&&o.addEventListener("blocked",a=>t(a.oldVersion,a.newVersion,a)),c.then(a=>{s&&a.addEventListener("close",()=>s()),i&&a.addEventListener("versionchange",u=>i(u.oldVersion,u.newVersion,u))}).catch(()=>{}),c}const Cr=["get","getKey","getAll","getAllKeys","count"],Rr=["put","add","delete","clear"],Ze=new Map;function kt(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(Ze.get(e))return Ze.get(e);const t=e.replace(/FromIndex$/,""),r=e!==t,i=Rr.includes(t);if(!(t in(r?IDBIndex:IDBObjectStore).prototype)||!(i||Cr.includes(t)))return;const s=async function(o,...c){const a=this.transaction(o,i?"readwrite":"readonly");let u=a.store;return r&&(u=u.index(c.shift())),(await Promise.all([u[t](...c),i&&a.done]))[0]};return Ze.set(e,s),s}Er(n=>({...n,get:(e,t,r)=>kt(e,t)||n.get(e,t,r),has:(e,t)=>!!kt(e,t)||n.has(e,t)}));/**
|
197
|
+
* @license
|
198
|
+
* Copyright 2019 Google LLC
|
199
|
+
*
|
200
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
201
|
+
* you may not use this file except in compliance with the License.
|
202
|
+
* You may obtain a copy of the License at
|
203
|
+
*
|
204
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
205
|
+
*
|
206
|
+
* Unless required by applicable law or agreed to in writing, software
|
207
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
208
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
209
|
+
* See the License for the specific language governing permissions and
|
210
|
+
* limitations under the License.
|
211
|
+
*/class Or{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Pr(t)){const r=t.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(t=>t).join(" ")}}function Pr(n){const e=n.getComponent();return(e==null?void 0:e.type)==="VERSION"}const et="@firebase/app",Dt="0.9.16";/**
|
212
|
+
* @license
|
213
|
+
* Copyright 2019 Google LLC
|
214
|
+
*
|
215
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
216
|
+
* you may not use this file except in compliance with the License.
|
217
|
+
* You may obtain a copy of the License at
|
218
|
+
*
|
219
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
220
|
+
*
|
221
|
+
* Unless required by applicable law or agreed to in writing, software
|
222
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
223
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
224
|
+
* See the License for the specific language governing permissions and
|
225
|
+
* limitations under the License.
|
226
|
+
*/const Q=new St("@firebase/app"),kr="@firebase/app-compat",Dr="@firebase/analytics-compat",Nr="@firebase/analytics",Lr="@firebase/app-check-compat",Mr="@firebase/app-check",$r="@firebase/auth",Ur="@firebase/auth-compat",jr="@firebase/database",Fr="@firebase/database-compat",Br="@firebase/functions",Vr="@firebase/functions-compat",Hr="@firebase/installations",Wr="@firebase/installations-compat",xr="@firebase/messaging",zr="@firebase/messaging-compat",qr="@firebase/performance",Gr="@firebase/performance-compat",Kr="@firebase/remote-config",Jr="@firebase/remote-config-compat",Yr="@firebase/storage",Xr="@firebase/storage-compat",Qr="@firebase/firestore",Zr="@firebase/firestore-compat",ei="firebase",ti="10.2.0";/**
|
227
|
+
* @license
|
228
|
+
* Copyright 2019 Google LLC
|
229
|
+
*
|
230
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
231
|
+
* you may not use this file except in compliance with the License.
|
232
|
+
* You may obtain a copy of the License at
|
233
|
+
*
|
234
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
235
|
+
*
|
236
|
+
* Unless required by applicable law or agreed to in writing, software
|
237
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
238
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
239
|
+
* See the License for the specific language governing permissions and
|
240
|
+
* limitations under the License.
|
241
|
+
*/const tt="[DEFAULT]",ni={[et]:"fire-core",[kr]:"fire-core-compat",[Nr]:"fire-analytics",[Dr]:"fire-analytics-compat",[Mr]:"fire-app-check",[Lr]:"fire-app-check-compat",[$r]:"fire-auth",[Ur]:"fire-auth-compat",[jr]:"fire-rtdb",[Fr]:"fire-rtdb-compat",[Br]:"fire-fn",[Vr]:"fire-fn-compat",[Hr]:"fire-iid",[Wr]:"fire-iid-compat",[xr]:"fire-fcm",[zr]:"fire-fcm-compat",[qr]:"fire-perf",[Gr]:"fire-perf-compat",[Kr]:"fire-rc",[Jr]:"fire-rc-compat",[Yr]:"fire-gcs",[Xr]:"fire-gcs-compat",[Qr]:"fire-fst",[Zr]:"fire-fst-compat","fire-js":"fire-js",[ei]:"fire-js-all"};/**
|
242
|
+
* @license
|
243
|
+
* Copyright 2019 Google LLC
|
244
|
+
*
|
245
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
246
|
+
* you may not use this file except in compliance with the License.
|
247
|
+
* You may obtain a copy of the License at
|
248
|
+
*
|
249
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
250
|
+
*
|
251
|
+
* Unless required by applicable law or agreed to in writing, software
|
252
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
253
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
254
|
+
* See the License for the specific language governing permissions and
|
255
|
+
* limitations under the License.
|
256
|
+
*/const Oe=new Map,nt=new Map;function ri(n,e){try{n.container.addComponent(e)}catch(t){Q.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function me(n){const e=n.name;if(nt.has(e))return Q.debug(`There were multiple attempts to register component ${e}.`),!1;nt.set(e,n);for(const t of Oe.values())ri(t,n);return!0}function Nt(n,e){const t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}/**
|
257
|
+
* @license
|
258
|
+
* Copyright 2019 Google LLC
|
259
|
+
*
|
260
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
261
|
+
* you may not use this file except in compliance with the License.
|
262
|
+
* You may obtain a copy of the License at
|
263
|
+
*
|
264
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
265
|
+
*
|
266
|
+
* Unless required by applicable law or agreed to in writing, software
|
267
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
268
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
269
|
+
* See the License for the specific language governing permissions and
|
270
|
+
* limitations under the License.
|
271
|
+
*/const ii={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."},W=new he("app","Firebase",ii);/**
|
272
|
+
* @license
|
273
|
+
* Copyright 2019 Google LLC
|
274
|
+
*
|
275
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
276
|
+
* you may not use this file except in compliance with the License.
|
277
|
+
* You may obtain a copy of the License at
|
278
|
+
*
|
279
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
280
|
+
*
|
281
|
+
* Unless required by applicable law or agreed to in writing, software
|
282
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
283
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
284
|
+
* See the License for the specific language governing permissions and
|
285
|
+
* limitations under the License.
|
286
|
+
*/class si{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 se("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 W.create("app-deleted",{appName:this._name})}}/**
|
287
|
+
* @license
|
288
|
+
* Copyright 2019 Google LLC
|
289
|
+
*
|
290
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
291
|
+
* you may not use this file except in compliance with the License.
|
292
|
+
* You may obtain a copy of the License at
|
293
|
+
*
|
294
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
295
|
+
*
|
296
|
+
* Unless required by applicable law or agreed to in writing, software
|
297
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
298
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
299
|
+
* See the License for the specific language governing permissions and
|
300
|
+
* limitations under the License.
|
301
|
+
*/const ye=ti;function Lt(n,e={}){let t=n;typeof e!="object"&&(e={name:e});const r=Object.assign({name:tt,automaticDataCollectionEnabled:!1},e),i=r.name;if(typeof i!="string"||!i)throw W.create("bad-app-name",{appName:String(i)});if(t||(t=Et()),!t)throw W.create("no-options");const s=Oe.get(i);if(s){if(Re(t,s.options)&&Re(r,s.config))return s;throw W.create("duplicate-app",{appName:i})}const o=new fr(i);for(const a of nt.values())o.addComponent(a);const c=new si(t,r,o);return Oe.set(i,c),c}function oi(n=tt){const e=Oe.get(n);if(!e&&n===tt&&Et())return Lt();if(!e)throw W.create("no-app",{appName:n});return e}function oe(n,e,t){var r;let i=(r=ni[n])!==null&&r!==void 0?r:n;t&&(i+=`-${t}`);const s=i.match(/\s|\//),o=e.match(/\s|\//);if(s||o){const c=[`Unable to register library "${i}" with version "${e}":`];s&&c.push(`library name "${i}" contains illegal characters (whitespace or "/")`),s&&o&&c.push("and"),o&&c.push(`version name "${e}" contains illegal characters (whitespace or "/")`),Q.warn(c.join(" "));return}me(new se(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}/**
|
302
|
+
* @license
|
303
|
+
* Copyright 2021 Google LLC
|
304
|
+
*
|
305
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
306
|
+
* you may not use this file except in compliance with the License.
|
307
|
+
* You may obtain a copy of the License at
|
308
|
+
*
|
309
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
310
|
+
*
|
311
|
+
* Unless required by applicable law or agreed to in writing, software
|
312
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
313
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
314
|
+
* See the License for the specific language governing permissions and
|
315
|
+
* limitations under the License.
|
316
|
+
*/const ai="firebase-heartbeat-database",ci=1,_e="firebase-heartbeat-store";let rt=null;function Mt(){return rt||(rt=Sr(ai,ci,{upgrade:(n,e)=>{switch(e){case 0:n.createObjectStore(_e)}}}).catch(n=>{throw W.create("idb-open",{originalErrorMessage:n.message})})),rt}async function li(n){try{return await(await Mt()).transaction(_e).objectStore(_e).get(Ut(n))}catch(e){if(e instanceof V)Q.warn(e.message);else{const t=W.create("idb-get",{originalErrorMessage:e==null?void 0:e.message});Q.warn(t.message)}}}async function $t(n,e){try{const r=(await Mt()).transaction(_e,"readwrite");await r.objectStore(_e).put(e,Ut(n)),await r.done}catch(t){if(t instanceof V)Q.warn(t.message);else{const r=W.create("idb-set",{originalErrorMessage:t==null?void 0:t.message});Q.warn(r.message)}}}function Ut(n){return`${n.name}!${n.options.appId}`}/**
|
317
|
+
* @license
|
318
|
+
* Copyright 2021 Google LLC
|
319
|
+
*
|
320
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
321
|
+
* you may not use this file except in compliance with the License.
|
322
|
+
* You may obtain a copy of the License at
|
323
|
+
*
|
324
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
325
|
+
*
|
326
|
+
* Unless required by applicable law or agreed to in writing, software
|
327
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
328
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
329
|
+
* See the License for the specific language governing permissions and
|
330
|
+
* limitations under the License.
|
331
|
+
*/const di=1024,ui=30*24*60*60*1e3;class hi{constructor(e){this.container=e,this._heartbeatsCache=null;const t=this.container.getProvider("app").getImmediate();this._storage=new pi(t),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){const t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=jt();if(this._heartbeatsCache===null&&(this._heartbeatsCache=await this._heartbeatsCachePromise),!(this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r)))return this._heartbeatsCache.heartbeats.push({date:r,agent:t}),this._heartbeatsCache.heartbeats=this._heartbeatsCache.heartbeats.filter(i=>{const s=new Date(i.date).valueOf();return Date.now()-s<=ui}),this._storage.overwrite(this._heartbeatsCache)}async getHeartbeatsHeader(){if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache===null||this._heartbeatsCache.heartbeats.length===0)return"";const e=jt(),{heartbeatsToSend:t,unsentEntries:r}=fi(this._heartbeatsCache.heartbeats),i=It(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)),i}}function jt(){return new Date().toISOString().substring(0,10)}function fi(n,e=di){const t=[];let r=n.slice();for(const i of n){const s=t.find(o=>o.agent===i.agent);if(s){if(s.dates.push(i.date),Ft(t)>e){s.dates.pop();break}}else if(t.push({agent:i.agent,dates:[i.date]}),Ft(t)>e){t.pop();break}r=r.slice(1)}return{heartbeatsToSend:t,unsentEntries:r}}class pi{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return tr()?nr().then(()=>!0).catch(()=>!1):!1}async read(){return await this._canUseIndexedDBPromise?await li(this.app)||{heartbeats:[]}:{heartbeats:[]}}async overwrite(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return $t(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){var t;if(await this._canUseIndexedDBPromise){const i=await this.read();return $t(this.app,{lastSentHeartbeatDate:(t=e.lastSentHeartbeatDate)!==null&&t!==void 0?t:i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}}function Ft(n){return It(JSON.stringify({version:2,heartbeats:n})).length}/**
|
332
|
+
* @license
|
333
|
+
* Copyright 2019 Google LLC
|
334
|
+
*
|
335
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
336
|
+
* you may not use this file except in compliance with the License.
|
337
|
+
* You may obtain a copy of the License at
|
338
|
+
*
|
339
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
340
|
+
*
|
341
|
+
* Unless required by applicable law or agreed to in writing, software
|
342
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
343
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
344
|
+
* See the License for the specific language governing permissions and
|
345
|
+
* limitations under the License.
|
346
|
+
*/function gi(n){me(new se("platform-logger",e=>new Or(e),"PRIVATE")),me(new se("heartbeat",e=>new hi(e),"PRIVATE")),oe(et,Dt,n),oe(et,Dt,"esm2017"),oe("fire-js","")}gi("");var mi="firebase",yi="10.2.0";/**
|
347
|
+
* @license
|
348
|
+
* Copyright 2020 Google LLC
|
349
|
+
*
|
350
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
351
|
+
* you may not use this file except in compliance with the License.
|
352
|
+
* You may obtain a copy of the License at
|
353
|
+
*
|
354
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
355
|
+
*
|
356
|
+
* Unless required by applicable law or agreed to in writing, software
|
357
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
358
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
359
|
+
* See the License for the specific language governing permissions and
|
360
|
+
* limitations under the License.
|
361
|
+
*/oe(mi,yi,"app");function it(n,e){var t={};for(var r in n)Object.prototype.hasOwnProperty.call(n,r)&&e.indexOf(r)<0&&(t[r]=n[r]);if(n!=null&&typeof Object.getOwnPropertySymbols=="function")for(var i=0,r=Object.getOwnPropertySymbols(n);i<r.length;i++)e.indexOf(r[i])<0&&Object.prototype.propertyIsEnumerable.call(n,r[i])&&(t[r[i]]=n[r[i]]);return t}typeof SuppressedError=="function"&&SuppressedError;function Bt(n){return n!==void 0&&n.enterprise!==void 0}class _i{constructor(e){if(this.siteKey="",this.emailPasswordEnabled=!1,e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.emailPasswordEnabled=e.recaptchaEnforcementState.some(t=>t.provider==="EMAIL_PASSWORD_PROVIDER"&&t.enforcementState!=="OFF")}}function Vt(){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."}}const vi=Vt,Ht=new he("auth","Firebase",Vt());/**
|
362
|
+
* @license
|
363
|
+
* Copyright 2020 Google LLC
|
364
|
+
*
|
365
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
366
|
+
* you may not use this file except in compliance with the License.
|
367
|
+
* You may obtain a copy of the License at
|
368
|
+
*
|
369
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
370
|
+
*
|
371
|
+
* Unless required by applicable law or agreed to in writing, software
|
372
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
373
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
374
|
+
* See the License for the specific language governing permissions and
|
375
|
+
* limitations under the License.
|
376
|
+
*/const Pe=new St("@firebase/auth");function bi(n,...e){Pe.logLevel<=T.WARN&&Pe.warn(`Auth (${ye}): ${n}`,...e)}function ke(n,...e){Pe.logLevel<=T.ERROR&&Pe.error(`Auth (${ye}): ${n}`,...e)}/**
|
377
|
+
* @license
|
378
|
+
* Copyright 2020 Google LLC
|
379
|
+
*
|
380
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
381
|
+
* you may not use this file except in compliance with the License.
|
382
|
+
* You may obtain a copy of the License at
|
383
|
+
*
|
384
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
385
|
+
*
|
386
|
+
* Unless required by applicable law or agreed to in writing, software
|
387
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
388
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
389
|
+
* See the License for the specific language governing permissions and
|
390
|
+
* limitations under the License.
|
391
|
+
*/function D(n,...e){throw st(n,...e)}function L(n,...e){return st(n,...e)}function Ii(n,e,t){const r=Object.assign(Object.assign({},vi()),{[e]:t});return new he("auth","Firebase",r).create(e,{appName:n.name})}function st(n,...e){if(typeof n!="string"){const t=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=n.name),n._errorFactory.create(t,...r)}return Ht.create(n,...e)}function y(n,e,...t){if(!n)throw st(e,...t)}function j(n){const e="INTERNAL ASSERTION FAILED: "+n;throw ke(e),new Error(e)}function F(n,e){n||j(e)}/**
|
392
|
+
* @license
|
393
|
+
* Copyright 2020 Google LLC
|
394
|
+
*
|
395
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
396
|
+
* you may not use this file except in compliance with the License.
|
397
|
+
* You may obtain a copy of the License at
|
398
|
+
*
|
399
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
400
|
+
*
|
401
|
+
* Unless required by applicable law or agreed to in writing, software
|
402
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
403
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
404
|
+
* See the License for the specific language governing permissions and
|
405
|
+
* limitations under the License.
|
406
|
+
*/function ot(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.href)||""}function wi(){return Wt()==="http:"||Wt()==="https:"}function Wt(){var n;return typeof self<"u"&&((n=self.location)===null||n===void 0?void 0:n.protocol)||null}/**
|
407
|
+
* @license
|
408
|
+
* Copyright 2020 Google LLC
|
409
|
+
*
|
410
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
411
|
+
* you may not use this file except in compliance with the License.
|
412
|
+
* You may obtain a copy of the License at
|
413
|
+
*
|
414
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
415
|
+
*
|
416
|
+
* Unless required by applicable law or agreed to in writing, software
|
417
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
418
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
419
|
+
* See the License for the specific language governing permissions and
|
420
|
+
* limitations under the License.
|
421
|
+
*/function Ei(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(wi()||Qn()||"connection"in navigator)?navigator.onLine:!0}function Ti(){if(typeof navigator>"u")return null;const n=navigator;return n.languages&&n.languages[0]||n.language||null}/**
|
422
|
+
* @license
|
423
|
+
* Copyright 2020 Google LLC
|
424
|
+
*
|
425
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
426
|
+
* you may not use this file except in compliance with the License.
|
427
|
+
* You may obtain a copy of the License at
|
428
|
+
*
|
429
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
430
|
+
*
|
431
|
+
* Unless required by applicable law or agreed to in writing, software
|
432
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
433
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
434
|
+
* See the License for the specific language governing permissions and
|
435
|
+
* limitations under the License.
|
436
|
+
*/class ve{constructor(e,t){this.shortDelay=e,this.longDelay=t,F(t>e,"Short delay should be less than long delay!"),this.isMobile=Xn()||Zn()}get(){return Ei()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}}/**
|
437
|
+
* @license
|
438
|
+
* Copyright 2020 Google LLC
|
439
|
+
*
|
440
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
441
|
+
* you may not use this file except in compliance with the License.
|
442
|
+
* You may obtain a copy of the License at
|
443
|
+
*
|
444
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
445
|
+
*
|
446
|
+
* Unless required by applicable law or agreed to in writing, software
|
447
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
448
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
449
|
+
* See the License for the specific language governing permissions and
|
450
|
+
* limitations under the License.
|
451
|
+
*/function at(n,e){F(n.emulator,"Emulator should always be set here");const{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}/**
|
452
|
+
* @license
|
453
|
+
* Copyright 2020 Google LLC
|
454
|
+
*
|
455
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
456
|
+
* you may not use this file except in compliance with the License.
|
457
|
+
* You may obtain a copy of the License at
|
458
|
+
*
|
459
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
460
|
+
*
|
461
|
+
* Unless required by applicable law or agreed to in writing, software
|
462
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
463
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
464
|
+
* See the License for the specific language governing permissions and
|
465
|
+
* limitations under the License.
|
466
|
+
*/class xt{static initialize(e,t,r){this.fetchImpl=e,t&&(this.headersImpl=t),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;j("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static headers(){if(this.headersImpl)return this.headersImpl;if(typeof self<"u"&&"Headers"in self)return self.Headers;j("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}static response(){if(this.responseImpl)return this.responseImpl;if(typeof self<"u"&&"Response"in self)return self.Response;j("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}}/**
|
467
|
+
* @license
|
468
|
+
* Copyright 2020 Google LLC
|
469
|
+
*
|
470
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
471
|
+
* you may not use this file except in compliance with the License.
|
472
|
+
* You may obtain a copy of the License at
|
473
|
+
*
|
474
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
475
|
+
*
|
476
|
+
* Unless required by applicable law or agreed to in writing, software
|
477
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
478
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
479
|
+
* See the License for the specific language governing permissions and
|
480
|
+
* limitations under the License.
|
481
|
+
*/const Ai={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:"missing-password",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",PASSWORD_DOES_NOT_MEET_REQUIREMENTS:"password-does-not-meet-requirements",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",RECAPTCHA_NOT_ENABLED:"recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"invalid-recaptcha-action",MISSING_CLIENT_TYPE:"missing-client-type",MISSING_RECAPTCHA_VERSION:"missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"invalid-recaptcha-version",INVALID_REQ_TYPE:"invalid-req-type"};/**
|
482
|
+
* @license
|
483
|
+
* Copyright 2020 Google LLC
|
484
|
+
*
|
485
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
486
|
+
* you may not use this file except in compliance with the License.
|
487
|
+
* You may obtain a copy of the License at
|
488
|
+
*
|
489
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
490
|
+
*
|
491
|
+
* Unless required by applicable law or agreed to in writing, software
|
492
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
493
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
494
|
+
* See the License for the specific language governing permissions and
|
495
|
+
* limitations under the License.
|
496
|
+
*/const Si=new ve(3e4,6e4);function Z(n,e){return n.tenantId&&!e.tenantId?Object.assign(Object.assign({},e),{tenantId:n.tenantId}):e}async function x(n,e,t,r,i={}){return zt(n,i,async()=>{let s={},o={};r&&(e==="GET"?o=r:s={body:JSON.stringify(r)});const c=fe(Object.assign({key:n.config.apiKey},o)).slice(1),a=await n._getAdditionalHeaders();return a["Content-Type"]="application/json",n.languageCode&&(a["X-Firebase-Locale"]=n.languageCode),xt.fetch()(qt(n,n.config.apiHost,t,c),Object.assign({method:e,headers:a,referrerPolicy:"no-referrer"},s))})}async function zt(n,e,t){n._canInitEmulator=!1;const r=Object.assign(Object.assign({},Ai),e);try{const i=new Ci(n),s=await Promise.race([t(),i.promise]);i.clearNetworkTimeout();const o=await s.json();if("needConfirmation"in o)throw Ne(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{const c=s.ok?o.errorMessage:o.error.message,[a,u]=c.split(" : ");if(a==="FEDERATED_USER_ID_ALREADY_LINKED")throw Ne(n,"credential-already-in-use",o);if(a==="EMAIL_EXISTS")throw Ne(n,"email-already-in-use",o);if(a==="USER_DISABLED")throw Ne(n,"user-disabled",o);const _=r[a]||a.toLowerCase().replace(/[_\s]+/g,"-");if(u)throw Ii(n,_,u);D(n,_)}}catch(i){if(i instanceof V)throw i;D(n,"network-request-failed",{message:String(i)})}}async function De(n,e,t,r,i={}){const s=await x(n,e,t,r,i);return"mfaPendingCredential"in s&&D(n,"multi-factor-auth-required",{_serverResponse:s}),s}function qt(n,e,t,r){const i=`${e}${t}?${r}`;return n.config.emulator?at(n.config,i):`${n.config.apiScheme}://${i}`}class Ci{constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,r)=>{this.timer=setTimeout(()=>r(L(this.auth,"network-request-failed")),Si.get())})}clearNetworkTimeout(){clearTimeout(this.timer)}}function Ne(n,e,t){const r={appName:n.name};t.email&&(r.email=t.email),t.phoneNumber&&(r.phoneNumber=t.phoneNumber);const i=L(n,e,r);return i.customData._tokenResponse=t,i}async function Ri(n,e){return x(n,"GET","/v2/recaptchaConfig",Z(n,e))}/**
|
497
|
+
* @license
|
498
|
+
* Copyright 2020 Google LLC
|
499
|
+
*
|
500
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
501
|
+
* you may not use this file except in compliance with the License.
|
502
|
+
* You may obtain a copy of the License at
|
503
|
+
*
|
504
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
505
|
+
*
|
506
|
+
* Unless required by applicable law or agreed to in writing, software
|
507
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
508
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
509
|
+
* See the License for the specific language governing permissions and
|
510
|
+
* limitations under the License.
|
511
|
+
*/async function Oi(n,e){return x(n,"POST","/v1/accounts:delete",e)}async function Pi(n,e){return x(n,"POST","/v1/accounts:lookup",e)}/**
|
512
|
+
* @license
|
513
|
+
* Copyright 2020 Google LLC
|
514
|
+
*
|
515
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
516
|
+
* you may not use this file except in compliance with the License.
|
517
|
+
* You may obtain a copy of the License at
|
518
|
+
*
|
519
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
520
|
+
*
|
521
|
+
* Unless required by applicable law or agreed to in writing, software
|
522
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
523
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
524
|
+
* See the License for the specific language governing permissions and
|
525
|
+
* limitations under the License.
|
526
|
+
*/function be(n){if(n)try{const e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}async function ki(n,e=!1){const t=U(n),r=await t.getIdToken(e),i=lt(r);y(i&&i.exp&&i.auth_time&&i.iat,t.auth,"internal-error");const s=typeof i.firebase=="object"?i.firebase:void 0,o=s==null?void 0:s.sign_in_provider;return{claims:i,token:r,authTime:be(ct(i.auth_time)),issuedAtTime:be(ct(i.iat)),expirationTime:be(ct(i.exp)),signInProvider:o||null,signInSecondFactor:(s==null?void 0:s.sign_in_second_factor)||null}}function ct(n){return Number(n)*1e3}function lt(n){const[e,t,r]=n.split(".");if(e===void 0||t===void 0||r===void 0)return ke("JWT malformed, contained fewer than 3 sections"),null;try{const i=wt(t);return i?JSON.parse(i):(ke("Failed to decode base64 JWT payload"),null)}catch(i){return ke("Caught error parsing JWT payload as JSON",i==null?void 0:i.toString()),null}}function Di(n){const e=lt(n);return y(e,"internal-error"),y(typeof e.exp<"u","internal-error"),y(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}/**
|
527
|
+
* @license
|
528
|
+
* Copyright 2020 Google LLC
|
529
|
+
*
|
530
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
531
|
+
* you may not use this file except in compliance with the License.
|
532
|
+
* You may obtain a copy of the License at
|
533
|
+
*
|
534
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
535
|
+
*
|
536
|
+
* Unless required by applicable law or agreed to in writing, software
|
537
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
538
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
539
|
+
* See the License for the specific language governing permissions and
|
540
|
+
* limitations under the License.
|
541
|
+
*/async function Ie(n,e,t=!1){if(t)return e;try{return await e}catch(r){throw r instanceof V&&Ni(r)&&n.auth.currentUser===n&&await n.auth.signOut(),r}}function Ni({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}/**
|
542
|
+
* @license
|
543
|
+
* Copyright 2020 Google LLC
|
544
|
+
*
|
545
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
546
|
+
* you may not use this file except in compliance with the License.
|
547
|
+
* You may obtain a copy of the License at
|
548
|
+
*
|
549
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
550
|
+
*
|
551
|
+
* Unless required by applicable law or agreed to in writing, software
|
552
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
553
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
554
|
+
* See the License for the specific language governing permissions and
|
555
|
+
* limitations under the License.
|
556
|
+
*/class Li{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,this.timerId!==null&&clearTimeout(this.timerId))}getInterval(e){var t;if(e){const r=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),r}else{this.errorBackoff=3e4;const i=((t=this.user.stsTokenManager.expirationTime)!==null&&t!==void 0?t:0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;const t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){(e==null?void 0:e.code)==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}}/**
|
557
|
+
* @license
|
558
|
+
* Copyright 2020 Google LLC
|
559
|
+
*
|
560
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
561
|
+
* you may not use this file except in compliance with the License.
|
562
|
+
* You may obtain a copy of the License at
|
563
|
+
*
|
564
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
565
|
+
*
|
566
|
+
* Unless required by applicable law or agreed to in writing, software
|
567
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
568
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
569
|
+
* See the License for the specific language governing permissions and
|
570
|
+
* limitations under the License.
|
571
|
+
*/class Gt{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=be(this.lastLoginAt),this.creationTime=be(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}}/**
|
572
|
+
* @license
|
573
|
+
* Copyright 2019 Google LLC
|
574
|
+
*
|
575
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
576
|
+
* you may not use this file except in compliance with the License.
|
577
|
+
* You may obtain a copy of the License at
|
578
|
+
*
|
579
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
580
|
+
*
|
581
|
+
* Unless required by applicable law or agreed to in writing, software
|
582
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
583
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
584
|
+
* See the License for the specific language governing permissions and
|
585
|
+
* limitations under the License.
|
586
|
+
*/async function Le(n){var e;const t=n.auth,r=await n.getIdToken(),i=await Ie(n,Pi(t,{idToken:r}));y(i==null?void 0:i.users.length,t,"internal-error");const s=i.users[0];n._notifyReloadListener(s);const o=!((e=s.providerUserInfo)===null||e===void 0)&&e.length?Ui(s.providerUserInfo):[],c=$i(n.providerData,o),a=n.isAnonymous,u=!(n.email&&s.passwordHash)&&!(c!=null&&c.length),_=a?u:!1,b={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:c,metadata:new Gt(s.createdAt,s.lastLoginAt),isAnonymous:_};Object.assign(n,b)}async function Mi(n){const e=U(n);await Le(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function $i(n,e){return[...n.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function Ui(n){return n.map(e=>{var{providerId:t}=e,r=it(e,["providerId"]);return{providerId:t,uid:r.rawId||"",displayName:r.displayName||null,email:r.email||null,phoneNumber:r.phoneNumber||null,photoURL:r.photoUrl||null}})}/**
|
587
|
+
* @license
|
588
|
+
* Copyright 2020 Google LLC
|
589
|
+
*
|
590
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
591
|
+
* you may not use this file except in compliance with the License.
|
592
|
+
* You may obtain a copy of the License at
|
593
|
+
*
|
594
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
595
|
+
*
|
596
|
+
* Unless required by applicable law or agreed to in writing, software
|
597
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
598
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
599
|
+
* See the License for the specific language governing permissions and
|
600
|
+
* limitations under the License.
|
601
|
+
*/async function ji(n,e){const t=await zt(n,{},async()=>{const r=fe({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=n.config,o=qt(n,i,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();return c["Content-Type"]="application/x-www-form-urlencoded",xt.fetch()(o,{method:"POST",headers:c,body:r})});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}/**
|
602
|
+
* @license
|
603
|
+
* Copyright 2020 Google LLC
|
604
|
+
*
|
605
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
606
|
+
* you may not use this file except in compliance with the License.
|
607
|
+
* You may obtain a copy of the License at
|
608
|
+
*
|
609
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
610
|
+
*
|
611
|
+
* Unless required by applicable law or agreed to in writing, software
|
612
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
613
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
614
|
+
* See the License for the specific language governing permissions and
|
615
|
+
* limitations under the License.
|
616
|
+
*/class we{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){y(e.idToken,"internal-error"),y(typeof e.idToken<"u","internal-error"),y(typeof e.refreshToken<"u","internal-error");const t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):Di(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}async getToken(e,t=!1){return y(!this.accessToken||this.refreshToken,e,"user-token-expired"),!t&&this.accessToken&&!this.isExpired?this.accessToken:this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null}clearRefreshToken(){this.refreshToken=null}async refresh(e,t){const{accessToken:r,refreshToken:i,expiresIn:s}=await ji(e,t);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,t,r){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,t){const{refreshToken:r,accessToken:i,expirationTime:s}=t,o=new we;return r&&(y(typeof r=="string","internal-error",{appName:e}),o.refreshToken=r),i&&(y(typeof i=="string","internal-error",{appName:e}),o.accessToken=i),s&&(y(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}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 we,this.toJSON())}_performRefresh(){return j("not implemented")}}/**
|
617
|
+
* @license
|
618
|
+
* Copyright 2020 Google LLC
|
619
|
+
*
|
620
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
621
|
+
* you may not use this file except in compliance with the License.
|
622
|
+
* You may obtain a copy of the License at
|
623
|
+
*
|
624
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
625
|
+
*
|
626
|
+
* Unless required by applicable law or agreed to in writing, software
|
627
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
628
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
629
|
+
* See the License for the specific language governing permissions and
|
630
|
+
* limitations under the License.
|
631
|
+
*/function z(n,e){y(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}class ee{constructor(e){var{uid:t,auth:r,stsTokenManager:i}=e,s=it(e,["uid","auth","stsTokenManager"]);this.providerId="firebase",this.proactiveRefresh=new Li(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=t,this.auth=r,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=s.displayName||null,this.email=s.email||null,this.emailVerified=s.emailVerified||!1,this.phoneNumber=s.phoneNumber||null,this.photoURL=s.photoURL||null,this.isAnonymous=s.isAnonymous||!1,this.tenantId=s.tenantId||null,this.providerData=s.providerData?[...s.providerData]:[],this.metadata=new Gt(s.createdAt||void 0,s.lastLoginAt||void 0)}async getIdToken(e){const t=await Ie(this,this.stsTokenManager.getToken(this.auth,e));return y(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return ki(this,e)}reload(){return Mi(this)}_assign(e){this!==e&&(y(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(t=>Object.assign({},t)),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){const t=new ee(Object.assign(Object.assign({},this),{auth:e,stsTokenManager:this.stsTokenManager._clone()}));return t.metadata._copy(this.metadata),t}_onReload(e){y(!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 Le(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){const e=await this.getIdToken();return await Ie(this,Oi(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,i,s,o,c,a,u,_;const b=(r=t.displayName)!==null&&r!==void 0?r:void 0,A=(i=t.email)!==null&&i!==void 0?i:void 0,O=(s=t.phoneNumber)!==null&&s!==void 0?s:void 0,N=(o=t.photoURL)!==null&&o!==void 0?o:void 0,v=(c=t.tenantId)!==null&&c!==void 0?c:void 0,I=(a=t._redirectEventId)!==null&&a!==void 0?a:void 0,$=(u=t.createdAt)!==null&&u!==void 0?u:void 0,C=(_=t.lastLoginAt)!==null&&_!==void 0?_:void 0,{uid:re,emailVerified:Y,isAnonymous:l,providerData:m,stsTokenManager:d}=t;y(re&&d,e,"internal-error");const w=we.fromJSON(this.name,d);y(typeof re=="string",e,"internal-error"),z(b,e.name),z(A,e.name),y(typeof Y=="boolean",e,"internal-error"),y(typeof l=="boolean",e,"internal-error"),z(O,e.name),z(N,e.name),z(v,e.name),z(I,e.name),z($,e.name),z(C,e.name);const E=new ee({uid:re,auth:e,email:A,emailVerified:Y,displayName:b,isAnonymous:l,photoURL:N,phoneNumber:O,tenantId:v,stsTokenManager:w,createdAt:$,lastLoginAt:C});return m&&Array.isArray(m)&&(E.providerData=m.map(S=>Object.assign({},S))),I&&(E._redirectEventId=I),E}static async _fromIdTokenResponse(e,t,r=!1){const i=new we;i.updateFromServerResponse(t);const s=new ee({uid:t.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await Le(s),s}}/**
|
632
|
+
* @license
|
633
|
+
* Copyright 2020 Google LLC
|
634
|
+
*
|
635
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
636
|
+
* you may not use this file except in compliance with the License.
|
637
|
+
* You may obtain a copy of the License at
|
638
|
+
*
|
639
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
640
|
+
*
|
641
|
+
* Unless required by applicable law or agreed to in writing, software
|
642
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
643
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
644
|
+
* See the License for the specific language governing permissions and
|
645
|
+
* limitations under the License.
|
646
|
+
*/const Kt=new Map;function B(n){F(n instanceof Function,"Expected a class definition");let e=Kt.get(n);return e?(F(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,Kt.set(n,e),e)}/**
|
647
|
+
* @license
|
648
|
+
* Copyright 2019 Google LLC
|
649
|
+
*
|
650
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
651
|
+
* you may not use this file except in compliance with the License.
|
652
|
+
* You may obtain a copy of the License at
|
653
|
+
*
|
654
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
655
|
+
*
|
656
|
+
* Unless required by applicable law or agreed to in writing, software
|
657
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
658
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
659
|
+
* See the License for the specific language governing permissions and
|
660
|
+
* limitations under the License.
|
661
|
+
*/class Jt{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 t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}}Jt.type="NONE";const Yt=Jt;/**
|
662
|
+
* @license
|
663
|
+
* Copyright 2019 Google LLC
|
664
|
+
*
|
665
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
666
|
+
* you may not use this file except in compliance with the License.
|
667
|
+
* You may obtain a copy of the License at
|
668
|
+
*
|
669
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
670
|
+
*
|
671
|
+
* Unless required by applicable law or agreed to in writing, software
|
672
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
673
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
674
|
+
* See the License for the specific language governing permissions and
|
675
|
+
* limitations under the License.
|
676
|
+
*/function Me(n,e,t){return`firebase:${n}:${e}:${t}`}class ae{constructor(e,t,r){this.persistence=e,this.auth=t,this.userKey=r;const{config:i,name:s}=this.auth;this.fullUserKey=Me(this.userKey,i.apiKey,s),this.fullPersistenceKey=Me("persistence",i.apiKey,s),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?ee._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();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,r="authUser"){if(!t.length)return new ae(B(Yt),e,r);const i=(await Promise.all(t.map(async u=>{if(await u._isAvailable())return u}))).filter(u=>u);let s=i[0]||B(Yt);const o=Me(r,e.config.apiKey,e.name);let c=null;for(const u of t)try{const _=await u._get(o);if(_){const b=ee._fromJSON(e,_);u!==s&&(c=b),s=u;break}}catch{}const a=i.filter(u=>u._shouldAllowMigration);return!s._shouldAllowMigration||!a.length?new ae(s,e,r):(s=a[0],c&&await s._set(o,c.toJSON()),await Promise.all(t.map(async u=>{if(u!==s)try{await u._remove(o)}catch{}})),new ae(s,e,r))}}/**
|
677
|
+
* @license
|
678
|
+
* Copyright 2020 Google LLC
|
679
|
+
*
|
680
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
681
|
+
* you may not use this file except in compliance with the License.
|
682
|
+
* You may obtain a copy of the License at
|
683
|
+
*
|
684
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
685
|
+
*
|
686
|
+
* Unless required by applicable law or agreed to in writing, software
|
687
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
688
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
689
|
+
* See the License for the specific language governing permissions and
|
690
|
+
* limitations under the License.
|
691
|
+
*/function Xt(n){const e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(en(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Qt(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(nn(e))return"Blackberry";if(rn(e))return"Webos";if(dt(e))return"Safari";if((e.includes("chrome/")||Zt(e))&&!e.includes("edge/"))return"Chrome";if(tn(e))return"Android";{const t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=n.match(t);if((r==null?void 0:r.length)===2)return r[1]}return"Other"}function Qt(n=R()){return/firefox\//i.test(n)}function dt(n=R()){const e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Zt(n=R()){return/crios\//i.test(n)}function en(n=R()){return/iemobile/i.test(n)}function tn(n=R()){return/android/i.test(n)}function nn(n=R()){return/blackberry/i.test(n)}function rn(n=R()){return/webos/i.test(n)}function $e(n=R()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Fi(n=R()){var e;return $e(n)&&!!(!((e=window.navigator)===null||e===void 0)&&e.standalone)}function Bi(){return er()&&document.documentMode===10}function sn(n=R()){return $e(n)||tn(n)||rn(n)||nn(n)||/windows phone/i.test(n)||en(n)}function Vi(){try{return!!(window&&window!==window.top)}catch{return!1}}/**
|
692
|
+
* @license
|
693
|
+
* Copyright 2020 Google LLC
|
694
|
+
*
|
695
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
696
|
+
* you may not use this file except in compliance with the License.
|
697
|
+
* You may obtain a copy of the License at
|
698
|
+
*
|
699
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
700
|
+
*
|
701
|
+
* Unless required by applicable law or agreed to in writing, software
|
702
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
703
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
704
|
+
* See the License for the specific language governing permissions and
|
705
|
+
* limitations under the License.
|
706
|
+
*/function on(n,e=[]){let t;switch(n){case"Browser":t=Xt(R());break;case"Worker":t=`${Xt(R())}-${n}`;break;default:t=n}const r=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${ye}/${r}`}/**
|
707
|
+
* @license
|
708
|
+
* Copyright 2022 Google LLC
|
709
|
+
*
|
710
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
711
|
+
* you may not use this file except in compliance with the License.
|
712
|
+
* You may obtain a copy of the License at
|
713
|
+
*
|
714
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
715
|
+
*
|
716
|
+
* Unless required by applicable law or agreed to in writing, software
|
717
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
718
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
719
|
+
* See the License for the specific language governing permissions and
|
720
|
+
* limitations under the License.
|
721
|
+
*/class Hi{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){const r=s=>new Promise((o,c)=>{try{const a=e(s);o(a)}catch(a){c(a)}});r.onAbort=t,this.queue.push(r);const i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;const t=[];try{for(const r of this.queue)await r(e),r.onAbort&&t.push(r.onAbort)}catch(r){t.reverse();for(const i of t)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r==null?void 0:r.message})}}}/**
|
722
|
+
* @license
|
723
|
+
* Copyright 2023 Google LLC
|
724
|
+
*
|
725
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
726
|
+
* you may not use this file except in compliance with the License.
|
727
|
+
* You may obtain a copy of the License at
|
728
|
+
*
|
729
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
730
|
+
*
|
731
|
+
* Unless required by applicable law or agreed to in writing, software
|
732
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
733
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
734
|
+
* See the License for the specific language governing permissions and
|
735
|
+
* limitations under the License.
|
736
|
+
*/async function Wi(n,e={}){return x(n,"GET","/v2/passwordPolicy",Z(n,e))}/**
|
737
|
+
* @license
|
738
|
+
* Copyright 2023 Google LLC
|
739
|
+
*
|
740
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
741
|
+
* you may not use this file except in compliance with the License.
|
742
|
+
* You may obtain a copy of the License at
|
743
|
+
*
|
744
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
745
|
+
*
|
746
|
+
* Unless required by applicable law or agreed to in writing, software
|
747
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
748
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
749
|
+
* See the License for the specific language governing permissions and
|
750
|
+
* limitations under the License.
|
751
|
+
*/const xi=6;class zi{constructor(e){var t,r,i,s;const o=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=(t=o.minPasswordLength)!==null&&t!==void 0?t:xi,o.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=o.maxPasswordLength),o.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=o.containsLowercaseCharacter),o.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=o.containsUppercaseCharacter),o.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=o.containsNumericCharacter),o.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=o.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=(i=(r=e.allowedNonAlphanumericCharacters)===null||r===void 0?void 0:r.join(""))!==null&&i!==void 0?i:"",this.forceUpgradeOnSignin=(s=e.forceUpgradeOnSignin)!==null&&s!==void 0?s:!1,this.schemaVersion=e.schemaVersion}validatePassword(e){var t,r,i,s,o,c;const a={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,a),this.validatePasswordCharacterOptions(e,a),a.isValid&&(a.isValid=(t=a.meetsMinPasswordLength)!==null&&t!==void 0?t:!0),a.isValid&&(a.isValid=(r=a.meetsMaxPasswordLength)!==null&&r!==void 0?r:!0),a.isValid&&(a.isValid=(i=a.containsLowercaseLetter)!==null&&i!==void 0?i:!0),a.isValid&&(a.isValid=(s=a.containsUppercaseLetter)!==null&&s!==void 0?s:!0),a.isValid&&(a.isValid=(o=a.containsNumericCharacter)!==null&&o!==void 0?o:!0),a.isValid&&(a.isValid=(c=a.containsNonAlphanumericCharacter)!==null&&c!==void 0?c:!0),a}validatePasswordLengthOptions(e,t){const r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(t.meetsMinPasswordLength=e.length>=r),i&&(t.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(t,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,t,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}}/**
|
752
|
+
* @license
|
753
|
+
* Copyright 2020 Google LLC
|
754
|
+
*
|
755
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
756
|
+
* you may not use this file except in compliance with the License.
|
757
|
+
* You may obtain a copy of the License at
|
758
|
+
*
|
759
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
760
|
+
*
|
761
|
+
* Unless required by applicable law or agreed to in writing, software
|
762
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
763
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
764
|
+
* See the License for the specific language governing permissions and
|
765
|
+
* limitations under the License.
|
766
|
+
*/class qi{constructor(e,t,r,i){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new an(this),this.idTokenSubscription=new an(this),this.beforeStateQueue=new Hi(this),this.redirectUser=null,this.isProactiveRefreshEnabled=!1,this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION=1,this._canInitEmulator=!0,this._isInitialized=!1,this._deleted=!1,this._initializationPromise=null,this._popupRedirectResolver=null,this._errorFactory=Ht,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=B(t)),this._initializationPromise=this.queue(async()=>{var r,i;if(!this._deleted&&(this.persistenceManager=await ae.create(this,e),!this._deleted)){if(!((r=this._popupRedirectResolver)===null||r===void 0)&&r._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),this.lastNotifiedUid=((i=this.currentUser)===null||i===void 0?void 0:i.uid)||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;const e=await this.assertedPersistence.getCurrentUser();if(!(!this.currentUser&&!e)){if(this.currentUser&&e&&this.currentUser.uid===e.uid){this._currentUser._assign(e),await this.currentUser.getIdToken();return}await this._updateCurrentUser(e,!0)}}async initializeCurrentUser(e){var t;const r=await this.assertedPersistence.getCurrentUser();let i=r,s=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();const o=(t=this.redirectUser)===null||t===void 0?void 0:t._redirectEventId,c=i==null?void 0:i._redirectEventId,a=await this.tryRedirectSignIn(e);(!o||o===c)&&(a!=null&&a.user)&&(i=a.user,s=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(s)try{await this.beforeStateQueue.runMiddleware(i)}catch(o){i=r,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(o))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return y(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await Le(e)}catch(t){if((t==null?void 0:t.code)!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Ti()}async _delete(){this._deleted=!0}async updateCurrentUser(e){const t=e?U(e):null;return t&&y(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&&y(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(B(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();const t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){const e=await Wi(this),t=new zi(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistence(){return this.assertedPersistence.persistence.type}_updateErrorMap(e){this._errorFactory=new he("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)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{const r=this.onAuthStateChanged(()=>{r(),e()},t)}})}toJSON(){var e;return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:(e=this._currentUser)===null||e===void 0?void 0:e.toJSON()}}async _setRedirectUser(e,t){const r=await this.getOrInitRedirectPersistenceManager(t);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){const t=e&&B(e)||this._popupRedirectResolver;y(t,this,"argument-error"),this.redirectPersistenceManager=await ae.create(this,[B(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()=>{}),((t=this._currentUser)===null||t===void 0?void 0:t._redirectEventId)===e?this._currentUser:((r=this.redirectUser)===null||r===void 0?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=(t=(e=this.currentUser)===null||e===void 0?void 0:e.uid)!==null&&t!==void 0?t:null;this.lastNotifiedUid!==r&&(this.lastNotifiedUid=r,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,t,r,i){if(this._deleted)return()=>{};const s=typeof t=="function"?t:t.next.bind(t);let o=!1;const c=this._isInitialized?Promise.resolve():this._initializationPromise;if(y(c,this,"internal-error"),c.then(()=>{o||s(this.currentUser)}),typeof t=="function"){const a=e.addObserver(t,r,i);return()=>{o=!0,a()}}else{const a=e.addObserver(t);return()=>{o=!0,a()}}}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 y(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=on(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((e=this.heartbeatServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getHeartbeatsHeader());r&&(t["X-Firebase-Client"]=r);const i=await this._getAppCheckToken();return i&&(t["X-Firebase-AppCheck"]=i),t}async _getAppCheckToken(){var e;const t=await((e=this.appCheckServiceProvider.getImmediate({optional:!0}))===null||e===void 0?void 0:e.getToken());return t!=null&&t.error&&bi(`Error while retrieving App Check token: ${t.error}`),t==null?void 0:t.token}}function te(n){return U(n)}class an{constructor(e){this.auth=e,this.observer=null,this.addObserver=ar(t=>this.observer=t)}get next(){return y(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}}/**
|
767
|
+
* @license
|
768
|
+
* Copyright 2020 Google LLC
|
769
|
+
*
|
770
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
771
|
+
* you may not use this file except in compliance with the License.
|
772
|
+
* You may obtain a copy of the License at
|
773
|
+
*
|
774
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
775
|
+
*
|
776
|
+
* Unless required by applicable law or agreed to in writing, software
|
777
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
778
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
779
|
+
* See the License for the specific language governing permissions and
|
780
|
+
* limitations under the License.
|
781
|
+
*/function Gi(){var n,e;return(e=(n=document.getElementsByTagName("head"))===null||n===void 0?void 0:n[0])!==null&&e!==void 0?e:document}function cn(n){return new Promise((e,t)=>{const r=document.createElement("script");r.setAttribute("src",n),r.onload=e,r.onerror=i=>{const s=L("internal-error");s.customData=i,t(s)},r.type="text/javascript",r.charset="UTF-8",Gi().appendChild(r)})}function Ki(n){return`__${n}${Math.floor(Math.random()*1e6)}`}const Ji="https://www.google.com/recaptcha/enterprise.js?render=",Yi="recaptcha-enterprise",Xi="NO_RECAPTCHA";class Qi{constructor(e){this.type=Yi,this.auth=te(e)}async verify(e="verify",t=!1){async function r(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,c)=>{Ri(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(a=>{if(a.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{const u=new _i(a);return s.tenantId==null?s._agentRecaptchaConfig=u:s._tenantRecaptchaConfigs[s.tenantId]=u,o(u.siteKey)}}).catch(a=>{c(a)})})}function i(s,o,c){const a=window.grecaptcha;Bt(a)?a.enterprise.ready(()=>{a.enterprise.execute(s,{action:e}).then(u=>{o(u)}).catch(()=>{o(Xi)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return new Promise((s,o)=>{r(this.auth).then(c=>{if(!t&&Bt(window.grecaptcha))i(c,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}cn(Ji+c).then(()=>{i(c,s,o)}).catch(a=>{o(a)})}}).catch(c=>{o(c)})})}}async function Ue(n,e,t,r=!1){const i=new Qi(n);let s;try{s=await i.verify(t)}catch{s=await i.verify(t,!0)}const o=Object.assign({},e);return r?Object.assign(o,{captchaResp:s}):Object.assign(o,{captchaResponse:s}),Object.assign(o,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(o,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),o}/**
|
782
|
+
* @license
|
783
|
+
* Copyright 2020 Google LLC
|
784
|
+
*
|
785
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
786
|
+
* you may not use this file except in compliance with the License.
|
787
|
+
* You may obtain a copy of the License at
|
788
|
+
*
|
789
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
790
|
+
*
|
791
|
+
* Unless required by applicable law or agreed to in writing, software
|
792
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
793
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
794
|
+
* See the License for the specific language governing permissions and
|
795
|
+
* limitations under the License.
|
796
|
+
*/function Zi(n,e){const t=Nt(n,"auth");if(t.isInitialized()){const i=t.getImmediate(),s=t.getOptions();if(Re(s,e??{}))return i;D(i,"already-initialized")}return t.initialize({options:e})}function es(n,e){const t=(e==null?void 0:e.persistence)||[],r=(Array.isArray(t)?t:[t]).map(B);e!=null&&e.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(r,e==null?void 0:e.popupRedirectResolver)}function ts(n,e,t){const r=te(n);y(r._canInitEmulator,r,"emulator-config-failed"),y(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");const i=!!(t!=null&&t.disableWarnings),s=ln(e),{host:o,port:c}=ns(e),a=c===null?"":`:${c}`;r.config.emulator={url:`${s}//${o}${a}/`},r.settings.appVerificationDisabledForTesting=!0,r.emulatorConfig=Object.freeze({host:o,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})}),i||rs()}function ln(n){const e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function ns(n){const e=ln(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};const r=t[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){const s=i[1];return{host:s,port:dn(r.substr(s.length+1))}}else{const[s,o]=r.split(":");return{host:s,port:dn(o)}}}function dn(n){if(!n)return null;const e=Number(n);return isNaN(e)?null:e}function rs(){function n(){const e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}/**
|
797
|
+
* @license
|
798
|
+
* Copyright 2020 Google LLC
|
799
|
+
*
|
800
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
801
|
+
* you may not use this file except in compliance with the License.
|
802
|
+
* You may obtain a copy of the License at
|
803
|
+
*
|
804
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
805
|
+
*
|
806
|
+
* Unless required by applicable law or agreed to in writing, software
|
807
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
808
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
809
|
+
* See the License for the specific language governing permissions and
|
810
|
+
* limitations under the License.
|
811
|
+
*/class ut{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return j("not implemented")}_getIdTokenResponse(e){return j("not implemented")}_linkToIdToken(e,t){return j("not implemented")}_getReauthenticationResolver(e){return j("not implemented")}}async function is(n,e){return x(n,"POST","/v1/accounts:update",e)}/**
|
812
|
+
* @license
|
813
|
+
* Copyright 2020 Google LLC
|
814
|
+
*
|
815
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
816
|
+
* you may not use this file except in compliance with the License.
|
817
|
+
* You may obtain a copy of the License at
|
818
|
+
*
|
819
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
820
|
+
*
|
821
|
+
* Unless required by applicable law or agreed to in writing, software
|
822
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
823
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
824
|
+
* See the License for the specific language governing permissions and
|
825
|
+
* limitations under the License.
|
826
|
+
*/async function ht(n,e){return De(n,"POST","/v1/accounts:signInWithPassword",Z(n,e))}async function ss(n,e){return x(n,"POST","/v1/accounts:sendOobCode",Z(n,e))}async function ft(n,e){return ss(n,e)}/**
|
827
|
+
* @license
|
828
|
+
* Copyright 2020 Google LLC
|
829
|
+
*
|
830
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
831
|
+
* you may not use this file except in compliance with the License.
|
832
|
+
* You may obtain a copy of the License at
|
833
|
+
*
|
834
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
835
|
+
*
|
836
|
+
* Unless required by applicable law or agreed to in writing, software
|
837
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
838
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
839
|
+
* See the License for the specific language governing permissions and
|
840
|
+
* limitations under the License.
|
841
|
+
*/async function os(n,e){return De(n,"POST","/v1/accounts:signInWithEmailLink",Z(n,e))}async function as(n,e){return De(n,"POST","/v1/accounts:signInWithEmailLink",Z(n,e))}/**
|
842
|
+
* @license
|
843
|
+
* Copyright 2020 Google LLC
|
844
|
+
*
|
845
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
846
|
+
* you may not use this file except in compliance with the License.
|
847
|
+
* You may obtain a copy of the License at
|
848
|
+
*
|
849
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
850
|
+
*
|
851
|
+
* Unless required by applicable law or agreed to in writing, software
|
852
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
853
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
854
|
+
* See the License for the specific language governing permissions and
|
855
|
+
* limitations under the License.
|
856
|
+
*/class Ee extends ut{constructor(e,t,r,i=null){super("password",r),this._email=e,this._password=t,this._tenantId=i}static _fromEmailAndPassword(e,t){return new Ee(e,t,"password")}static _fromEmailAndCode(e,t,r=null){return new Ee(e,t,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){const t=typeof e=="string"?JSON.parse(e):e;if(t!=null&&t.email&&(t!=null&&t.password)){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){var t;switch(this.signInMethod){case"password":const r={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};if(!((t=e._getRecaptchaConfig())===null||t===void 0)&&t.emailPasswordEnabled){const i=await Ue(e,r,"signInWithPassword");return ht(e,i)}else return ht(e,r).catch(async i=>{if(i.code==="auth/missing-recaptcha-token"){console.log("Sign-in with email address and password is protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the sign-in flow.");const s=await Ue(e,r,"signInWithPassword");return ht(e,s)}else return Promise.reject(i)});case"emailLink":return os(e,{email:this._email,oobCode:this._password});default:D(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":return is(e,{idToken:t,returnSecureToken:!0,email:this._email,password:this._password});case"emailLink":return as(e,{idToken:t,email:this._email,oobCode:this._password});default:D(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}}/**
|
857
|
+
* @license
|
858
|
+
* Copyright 2020 Google LLC
|
859
|
+
*
|
860
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
861
|
+
* you may not use this file except in compliance with the License.
|
862
|
+
* You may obtain a copy of the License at
|
863
|
+
*
|
864
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
865
|
+
*
|
866
|
+
* Unless required by applicable law or agreed to in writing, software
|
867
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
868
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
869
|
+
* See the License for the specific language governing permissions and
|
870
|
+
* limitations under the License.
|
871
|
+
*/async function ce(n,e){return De(n,"POST","/v1/accounts:signInWithIdp",Z(n,e))}/**
|
872
|
+
* @license
|
873
|
+
* Copyright 2020 Google LLC
|
874
|
+
*
|
875
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
876
|
+
* you may not use this file except in compliance with the License.
|
877
|
+
* You may obtain a copy of the License at
|
878
|
+
*
|
879
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
880
|
+
*
|
881
|
+
* Unless required by applicable law or agreed to in writing, software
|
882
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
883
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
884
|
+
* See the License for the specific language governing permissions and
|
885
|
+
* limitations under the License.
|
886
|
+
*/const cs="http://localhost";class ne extends ut{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){const t=new ne(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):D("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=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i}=t,s=it(t,["providerId","signInMethod"]);if(!r||!i)return null;const o=new ne(r,i);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){const t=this.buildRequest();return ce(e,t)}_linkToIdToken(e,t){const r=this.buildRequest();return r.idToken=t,ce(e,r)}_getReauthenticationResolver(e){const t=this.buildRequest();return t.autoCreate=!1,ce(e,t)}buildRequest(){const e={requestUri:cs,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=fe(t)}return e}}/**
|
887
|
+
* @license
|
888
|
+
* Copyright 2020 Google LLC
|
889
|
+
*
|
890
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
891
|
+
* you may not use this file except in compliance with the License.
|
892
|
+
* You may obtain a copy of the License at
|
893
|
+
*
|
894
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
895
|
+
*
|
896
|
+
* Unless required by applicable law or agreed to in writing, software
|
897
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
898
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
899
|
+
* See the License for the specific language governing permissions and
|
900
|
+
* limitations under the License.
|
901
|
+
*/function ls(n){switch(n){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}}function ds(n){const e=pe(ge(n)).link,t=e?pe(ge(e)).deep_link_id:null,r=pe(ge(n)).deep_link_id;return(r?pe(ge(r)).link:null)||r||t||e||n}class pt{constructor(e){var t,r,i,s,o,c;const a=pe(ge(e)),u=(t=a.apiKey)!==null&&t!==void 0?t:null,_=(r=a.oobCode)!==null&&r!==void 0?r:null,b=ls((i=a.mode)!==null&&i!==void 0?i:null);y(u&&_&&b,"argument-error"),this.apiKey=u,this.operation=b,this.code=_,this.continueUrl=(s=a.continueUrl)!==null&&s!==void 0?s:null,this.languageCode=(o=a.languageCode)!==null&&o!==void 0?o:null,this.tenantId=(c=a.tenantId)!==null&&c!==void 0?c:null}static parseLink(e){const t=ds(e);try{return new pt(t)}catch{return null}}}/**
|
902
|
+
* @license
|
903
|
+
* Copyright 2020 Google LLC
|
904
|
+
*
|
905
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
906
|
+
* you may not use this file except in compliance with the License.
|
907
|
+
* You may obtain a copy of the License at
|
908
|
+
*
|
909
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
910
|
+
*
|
911
|
+
* Unless required by applicable law or agreed to in writing, software
|
912
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
913
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
914
|
+
* See the License for the specific language governing permissions and
|
915
|
+
* limitations under the License.
|
916
|
+
*/class le{constructor(){this.providerId=le.PROVIDER_ID}static credential(e,t){return Ee._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){const r=pt.parseLink(t);return y(r,"argument-error"),Ee._fromEmailAndCode(e,r.code,r.tenantId)}}le.PROVIDER_ID="password",le.EMAIL_PASSWORD_SIGN_IN_METHOD="password",le.EMAIL_LINK_SIGN_IN_METHOD="emailLink";/**
|
917
|
+
* @license
|
918
|
+
* Copyright 2020 Google LLC
|
919
|
+
*
|
920
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
921
|
+
* you may not use this file except in compliance with the License.
|
922
|
+
* You may obtain a copy of the License at
|
923
|
+
*
|
924
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
925
|
+
*
|
926
|
+
* Unless required by applicable law or agreed to in writing, software
|
927
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
928
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
929
|
+
* See the License for the specific language governing permissions and
|
930
|
+
* limitations under the License.
|
931
|
+
*/class un{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}}/**
|
932
|
+
* @license
|
933
|
+
* Copyright 2019 Google LLC
|
934
|
+
*
|
935
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
936
|
+
* you may not use this file except in compliance with the License.
|
937
|
+
* You may obtain a copy of the License at
|
938
|
+
*
|
939
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
940
|
+
*
|
941
|
+
* Unless required by applicable law or agreed to in writing, software
|
942
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
943
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
944
|
+
* See the License for the specific language governing permissions and
|
945
|
+
* limitations under the License.
|
946
|
+
*/class Te extends un{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}}/**
|
947
|
+
* @license
|
948
|
+
* Copyright 2020 Google LLC
|
949
|
+
*
|
950
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
951
|
+
* you may not use this file except in compliance with the License.
|
952
|
+
* You may obtain a copy of the License at
|
953
|
+
*
|
954
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
955
|
+
*
|
956
|
+
* Unless required by applicable law or agreed to in writing, software
|
957
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
958
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
959
|
+
* See the License for the specific language governing permissions and
|
960
|
+
* limitations under the License.
|
961
|
+
*/class q extends Te{constructor(){super("facebook.com")}static credential(e){return ne._fromParams({providerId:q.PROVIDER_ID,signInMethod:q.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return q.credentialFromTaggedObject(e)}static credentialFromError(e){return q.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return q.credential(e.oauthAccessToken)}catch{return null}}}q.FACEBOOK_SIGN_IN_METHOD="facebook.com",q.PROVIDER_ID="facebook.com";/**
|
962
|
+
* @license
|
963
|
+
* Copyright 2020 Google LLC
|
964
|
+
*
|
965
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
966
|
+
* you may not use this file except in compliance with the License.
|
967
|
+
* You may obtain a copy of the License at
|
968
|
+
*
|
969
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
970
|
+
*
|
971
|
+
* Unless required by applicable law or agreed to in writing, software
|
972
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
973
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
974
|
+
* See the License for the specific language governing permissions and
|
975
|
+
* limitations under the License.
|
976
|
+
*/class G extends Te{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return ne._fromParams({providerId:G.PROVIDER_ID,signInMethod:G.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return G.credentialFromTaggedObject(e)}static credentialFromError(e){return G.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthIdToken:t,oauthAccessToken:r}=e;if(!t&&!r)return null;try{return G.credential(t,r)}catch{return null}}}G.GOOGLE_SIGN_IN_METHOD="google.com",G.PROVIDER_ID="google.com";/**
|
977
|
+
* @license
|
978
|
+
* Copyright 2020 Google LLC
|
979
|
+
*
|
980
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
981
|
+
* you may not use this file except in compliance with the License.
|
982
|
+
* You may obtain a copy of the License at
|
983
|
+
*
|
984
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
985
|
+
*
|
986
|
+
* Unless required by applicable law or agreed to in writing, software
|
987
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
988
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
989
|
+
* See the License for the specific language governing permissions and
|
990
|
+
* limitations under the License.
|
991
|
+
*/class K extends Te{constructor(){super("github.com")}static credential(e){return ne._fromParams({providerId:K.PROVIDER_ID,signInMethod:K.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return K.credentialFromTaggedObject(e)}static credentialFromError(e){return K.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return K.credential(e.oauthAccessToken)}catch{return null}}}K.GITHUB_SIGN_IN_METHOD="github.com",K.PROVIDER_ID="github.com";/**
|
992
|
+
* @license
|
993
|
+
* Copyright 2020 Google LLC
|
994
|
+
*
|
995
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
996
|
+
* you may not use this file except in compliance with the License.
|
997
|
+
* You may obtain a copy of the License at
|
998
|
+
*
|
999
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1000
|
+
*
|
1001
|
+
* Unless required by applicable law or agreed to in writing, software
|
1002
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1003
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1004
|
+
* See the License for the specific language governing permissions and
|
1005
|
+
* limitations under the License.
|
1006
|
+
*/class J extends Te{constructor(){super("twitter.com")}static credential(e,t){return ne._fromParams({providerId:J.PROVIDER_ID,signInMethod:J.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return J.credentialFromTaggedObject(e)}static credentialFromError(e){return J.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;const{oauthAccessToken:t,oauthTokenSecret:r}=e;if(!t||!r)return null;try{return J.credential(t,r)}catch{return null}}}J.TWITTER_SIGN_IN_METHOD="twitter.com",J.PROVIDER_ID="twitter.com";/**
|
1007
|
+
* @license
|
1008
|
+
* Copyright 2020 Google LLC
|
1009
|
+
*
|
1010
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1011
|
+
* you may not use this file except in compliance with the License.
|
1012
|
+
* You may obtain a copy of the License at
|
1013
|
+
*
|
1014
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1015
|
+
*
|
1016
|
+
* Unless required by applicable law or agreed to in writing, software
|
1017
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1018
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1019
|
+
* See the License for the specific language governing permissions and
|
1020
|
+
* limitations under the License.
|
1021
|
+
*/class de{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,r,i=!1){const s=await ee._fromIdTokenResponse(e,r,i),o=hn(r);return new de({user:s,providerId:o,_tokenResponse:r,operationType:t})}static async _forOperation(e,t,r){await e._updateTokensIfNecessary(r,!0);const i=hn(r);return new de({user:e,providerId:i,_tokenResponse:r,operationType:t})}}function hn(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}/**
|
1022
|
+
* @license
|
1023
|
+
* Copyright 2020 Google LLC
|
1024
|
+
*
|
1025
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1026
|
+
* you may not use this file except in compliance with the License.
|
1027
|
+
* You may obtain a copy of the License at
|
1028
|
+
*
|
1029
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1030
|
+
*
|
1031
|
+
* Unless required by applicable law or agreed to in writing, software
|
1032
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1033
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1034
|
+
* See the License for the specific language governing permissions and
|
1035
|
+
* limitations under the License.
|
1036
|
+
*/class je extends V{constructor(e,t,r,i){var s;super(t.code,t.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,je.prototype),this.customData={appName:e.name,tenantId:(s=e.tenantId)!==null&&s!==void 0?s:void 0,_serverResponse:t.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,t,r,i){return new je(e,t,r,i)}}function fn(n,e,t,r){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?je._fromErrorAndOperation(n,s,e,r):s})}async function us(n,e,t=!1){const r=await Ie(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return de._forOperation(n,"link",r)}/**
|
1037
|
+
* @license
|
1038
|
+
* Copyright 2019 Google LLC
|
1039
|
+
*
|
1040
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1041
|
+
* you may not use this file except in compliance with the License.
|
1042
|
+
* You may obtain a copy of the License at
|
1043
|
+
*
|
1044
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1045
|
+
*
|
1046
|
+
* Unless required by applicable law or agreed to in writing, software
|
1047
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1048
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1049
|
+
* See the License for the specific language governing permissions and
|
1050
|
+
* limitations under the License.
|
1051
|
+
*/async function hs(n,e,t=!1){const{auth:r}=n,i="reauthenticate";try{const s=await Ie(n,fn(r,i,e,n),t);y(s.idToken,r,"internal-error");const o=lt(s.idToken);y(o,r,"internal-error");const{sub:c}=o;return y(n.uid===c,r,"user-mismatch"),de._forOperation(n,i,s)}catch(s){throw(s==null?void 0:s.code)==="auth/user-not-found"&&D(r,"user-mismatch"),s}}/**
|
1052
|
+
* @license
|
1053
|
+
* Copyright 2020 Google LLC
|
1054
|
+
*
|
1055
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1056
|
+
* you may not use this file except in compliance with the License.
|
1057
|
+
* You may obtain a copy of the License at
|
1058
|
+
*
|
1059
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1060
|
+
*
|
1061
|
+
* Unless required by applicable law or agreed to in writing, software
|
1062
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1063
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1064
|
+
* See the License for the specific language governing permissions and
|
1065
|
+
* limitations under the License.
|
1066
|
+
*/async function pn(n,e,t=!1){const r="signIn",i=await fn(n,r,e),s=await de._fromIdTokenResponse(n,r,i);return t||await n._updateCurrentUser(s.user),s}async function fs(n,e){return pn(te(n),e)}/**
|
1067
|
+
* @license
|
1068
|
+
* Copyright 2020 Google LLC
|
1069
|
+
*
|
1070
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1071
|
+
* you may not use this file except in compliance with the License.
|
1072
|
+
* You may obtain a copy of the License at
|
1073
|
+
*
|
1074
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1075
|
+
*
|
1076
|
+
* Unless required by applicable law or agreed to in writing, software
|
1077
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1078
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1079
|
+
* See the License for the specific language governing permissions and
|
1080
|
+
* limitations under the License.
|
1081
|
+
*/function gt(n,e,t){var r;y(((r=t.url)===null||r===void 0?void 0:r.length)>0,n,"invalid-continue-uri"),y(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(y(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(y(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}/**
|
1082
|
+
* @license
|
1083
|
+
* Copyright 2020 Google LLC
|
1084
|
+
*
|
1085
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1086
|
+
* you may not use this file except in compliance with the License.
|
1087
|
+
* You may obtain a copy of the License at
|
1088
|
+
*
|
1089
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1090
|
+
*
|
1091
|
+
* Unless required by applicable law or agreed to in writing, software
|
1092
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1093
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1094
|
+
* See the License for the specific language governing permissions and
|
1095
|
+
* limitations under the License.
|
1096
|
+
*/async function ps(n){const e=te(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function gs(n,e,t){var r;const i=te(n),s={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};if(!((r=i._getRecaptchaConfig())===null||r===void 0)&&r.emailPasswordEnabled){const o=await Ue(i,s,"getOobCode",!0);t&>(i,o,t),await ft(i,o)}else t&>(i,s,t),await ft(i,s).catch(async o=>{if(o.code==="auth/missing-recaptcha-token"){console.log("Password resets are protected by reCAPTCHA for this project. Automatically triggering the reCAPTCHA flow and restarting the password reset flow.");const c=await Ue(i,s,"getOobCode",!0);t&>(i,c,t),await ft(i,c)}else return Promise.reject(o)})}function ms(n,e,t){return fs(U(n),le.credential(e,t)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&ps(n),r})}function ys(n,e,t,r){return U(n).onIdTokenChanged(e,t,r)}function _s(n,e,t){return U(n).beforeAuthStateChanged(e,t)}function vs(n,e,t,r){return U(n).onAuthStateChanged(e,t,r)}function bs(n){return U(n).signOut()}const Fe="__sak";/**
|
1097
|
+
* @license
|
1098
|
+
* Copyright 2019 Google LLC
|
1099
|
+
*
|
1100
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1101
|
+
* you may not use this file except in compliance with the License.
|
1102
|
+
* You may obtain a copy of the License at
|
1103
|
+
*
|
1104
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1105
|
+
*
|
1106
|
+
* Unless required by applicable law or agreed to in writing, software
|
1107
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1108
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1109
|
+
* See the License for the specific language governing permissions and
|
1110
|
+
* limitations under the License.
|
1111
|
+
*/class gn{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(Fe,"1"),this.storage.removeItem(Fe),Promise.resolve(!0)):Promise.resolve(!1)}catch{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()}}/**
|
1112
|
+
* @license
|
1113
|
+
* Copyright 2020 Google LLC
|
1114
|
+
*
|
1115
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1116
|
+
* you may not use this file except in compliance with the License.
|
1117
|
+
* You may obtain a copy of the License at
|
1118
|
+
*
|
1119
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1120
|
+
*
|
1121
|
+
* Unless required by applicable law or agreed to in writing, software
|
1122
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1123
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1124
|
+
* See the License for the specific language governing permissions and
|
1125
|
+
* limitations under the License.
|
1126
|
+
*/function Is(){const n=R();return dt(n)||$e(n)}const ws=1e3,Es=10;class mn extends gn{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.safariLocalStorageNotSynced=Is()&&Vi(),this.fallbackToPolling=sn(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(const t of Object.keys(this.listeners)){const r=this.storage.getItem(t),i=this.localCache[t];r!==i&&e(t,i,r)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,a)=>{this.notifyListeners(o,a)});return}const r=e.key;if(t?this.detachListener():this.stopPolling(),this.safariLocalStorageNotSynced){const o=this.storage.getItem(r);if(e.newValue!==o)e.newValue!==null?this.storage.setItem(r,e.newValue):this.storage.removeItem(r);else if(this.localCache[r]===e.newValue&&!t)return}const i=()=>{const o=this.storage.getItem(r);!t&&this.localCache[r]===o||this.notifyListeners(r,o)},s=this.storage.getItem(r);Bi()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Es):i()}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:r}),!0)})},ws)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(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]}}mn.type="LOCAL";const Ts=mn;/**
|
1127
|
+
* @license
|
1128
|
+
* Copyright 2020 Google LLC
|
1129
|
+
*
|
1130
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1131
|
+
* you may not use this file except in compliance with the License.
|
1132
|
+
* You may obtain a copy of the License at
|
1133
|
+
*
|
1134
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1135
|
+
*
|
1136
|
+
* Unless required by applicable law or agreed to in writing, software
|
1137
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1138
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1139
|
+
* See the License for the specific language governing permissions and
|
1140
|
+
* limitations under the License.
|
1141
|
+
*/class yn extends gn{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}}yn.type="SESSION";const _n=yn;/**
|
1142
|
+
* @license
|
1143
|
+
* Copyright 2019 Google LLC
|
1144
|
+
*
|
1145
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1146
|
+
* you may not use this file except in compliance with the License.
|
1147
|
+
* You may obtain a copy of the License at
|
1148
|
+
*
|
1149
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1150
|
+
*
|
1151
|
+
* Unless required by applicable law or agreed to in writing, software
|
1152
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1153
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1154
|
+
* See the License for the specific language governing permissions and
|
1155
|
+
* limitations under the License.
|
1156
|
+
*/function As(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}/**
|
1157
|
+
* @license
|
1158
|
+
* Copyright 2019 Google LLC
|
1159
|
+
*
|
1160
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1161
|
+
* you may not use this file except in compliance with the License.
|
1162
|
+
* You may obtain a copy of the License at
|
1163
|
+
*
|
1164
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1165
|
+
*
|
1166
|
+
* Unless required by applicable law or agreed to in writing, software
|
1167
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1168
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1169
|
+
* See the License for the specific language governing permissions and
|
1170
|
+
* limitations under the License.
|
1171
|
+
*/class Be{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){const t=this.receivers.find(i=>i.isListeningto(e));if(t)return t;const r=new Be(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){const t=e,{eventId:r,eventType:i,data:s}=t.data,o=this.handlersMap[i];if(!(o!=null&&o.size))return;t.ports[0].postMessage({status:"ack",eventId:r,eventType:i});const c=Array.from(o).map(async u=>u(t.origin,s)),a=await As(c);t.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:a})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&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||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}}Be.receivers=[];/**
|
1172
|
+
* @license
|
1173
|
+
* Copyright 2020 Google LLC
|
1174
|
+
*
|
1175
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1176
|
+
* you may not use this file except in compliance with the License.
|
1177
|
+
* You may obtain a copy of the License at
|
1178
|
+
*
|
1179
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1180
|
+
*
|
1181
|
+
* Unless required by applicable law or agreed to in writing, software
|
1182
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1183
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1184
|
+
* See the License for the specific language governing permissions and
|
1185
|
+
* limitations under the License.
|
1186
|
+
*/function mt(n="",e=10){let t="";for(let r=0;r<e;r++)t+=Math.floor(Math.random()*10);return n+t}/**
|
1187
|
+
* @license
|
1188
|
+
* Copyright 2019 Google LLC
|
1189
|
+
*
|
1190
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1191
|
+
* you may not use this file except in compliance with the License.
|
1192
|
+
* You may obtain a copy of the License at
|
1193
|
+
*
|
1194
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1195
|
+
*
|
1196
|
+
* Unless required by applicable law or agreed to in writing, software
|
1197
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1198
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1199
|
+
* See the License for the specific language governing permissions and
|
1200
|
+
* limitations under the License.
|
1201
|
+
*/class Ss{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 i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,o;return new Promise((c,a)=>{const u=mt("",20);i.port1.start();const _=setTimeout(()=>{a(new Error("unsupported_event"))},r);o={messageChannel:i,onMessage(b){const A=b;if(A.data.eventId===u)switch(A.data.status){case"ack":clearTimeout(_),s=setTimeout(()=>{a(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(A.data.response);break;default:clearTimeout(_),clearTimeout(s),a(new Error("invalid_response"));break}}},this.handlers.add(o),i.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:u,data:t},[i.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}}/**
|
1202
|
+
* @license
|
1203
|
+
* Copyright 2020 Google LLC
|
1204
|
+
*
|
1205
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1206
|
+
* you may not use this file except in compliance with the License.
|
1207
|
+
* You may obtain a copy of the License at
|
1208
|
+
*
|
1209
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1210
|
+
*
|
1211
|
+
* Unless required by applicable law or agreed to in writing, software
|
1212
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1213
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1214
|
+
* See the License for the specific language governing permissions and
|
1215
|
+
* limitations under the License.
|
1216
|
+
*/function M(){return window}function Cs(n){M().location.href=n}/**
|
1217
|
+
* @license
|
1218
|
+
* Copyright 2020 Google LLC.
|
1219
|
+
*
|
1220
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1221
|
+
* you may not use this file except in compliance with the License.
|
1222
|
+
* You may obtain a copy of the License at
|
1223
|
+
*
|
1224
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1225
|
+
*
|
1226
|
+
* Unless required by applicable law or agreed to in writing, software
|
1227
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1228
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1229
|
+
* See the License for the specific language governing permissions and
|
1230
|
+
* limitations under the License.
|
1231
|
+
*/function vn(){return typeof M().WorkerGlobalScope<"u"&&typeof M().importScripts=="function"}async function Rs(){if(!(navigator!=null&&navigator.serviceWorker))return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Os(){var n;return((n=navigator==null?void 0:navigator.serviceWorker)===null||n===void 0?void 0:n.controller)||null}function Ps(){return vn()?self:null}/**
|
1232
|
+
* @license
|
1233
|
+
* Copyright 2019 Google LLC
|
1234
|
+
*
|
1235
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1236
|
+
* you may not use this file except in compliance with the License.
|
1237
|
+
* You may obtain a copy of the License at
|
1238
|
+
*
|
1239
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1240
|
+
*
|
1241
|
+
* Unless required by applicable law or agreed to in writing, software
|
1242
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1243
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1244
|
+
* See the License for the specific language governing permissions and
|
1245
|
+
* limitations under the License.
|
1246
|
+
*/const bn="firebaseLocalStorageDb",ks=1,Ve="firebaseLocalStorage",In="fbase_key";class Ae{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 He(n,e){return n.transaction([Ve],e?"readwrite":"readonly").objectStore(Ve)}function Ds(){const n=indexedDB.deleteDatabase(bn);return new Ae(n).toPromise()}function yt(){const n=indexedDB.open(bn,ks);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{const r=n.result;try{r.createObjectStore(Ve,{keyPath:In})}catch(i){t(i)}}),n.addEventListener("success",async()=>{const r=n.result;r.objectStoreNames.contains(Ve)?e(r):(r.close(),await Ds(),e(await yt()))})})}async function wn(n,e,t){const r=He(n,!0).put({[In]:e,value:t});return new Ae(r).toPromise()}async function Ns(n,e){const t=He(n,!1).get(e),r=await new Ae(t).toPromise();return r===void 0?null:r.value}function En(n,e){const t=He(n,!0).delete(e);return new Ae(t).toPromise()}const Ls=800,Ms=3;class Tn{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:(this.db=await yt(),this.db)}async _withRetries(e){let t=0;for(;;)try{const r=await this._openDb();return await e(r)}catch(r){if(t++>Ms)throw r;this.db&&(this.db.close(),this.db=void 0)}}async initializeServiceWorkerMessaging(){return vn()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Be._getInstance(Ps()),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 Rs(),!this.activeServiceWorker)return;this.sender=new Ss(this.activeServiceWorker);const r=await this.sender._send("ping",{},800);r&&!((e=r[0])===null||e===void 0)&&e.fulfilled&&!((t=r[0])===null||t===void 0)&&t.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Os()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{if(!indexedDB)return!1;const e=await yt();return await wn(e,Fe,"1"),await En(e,Fe),!0}catch{}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=>wn(r,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){const t=await this._withRetries(r=>Ns(r,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>En(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){const e=await this._withRetries(i=>{const s=He(i,!1).getAll();return new Ae(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];const t=[],r=new Set;for(const{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),t.push(i));for(const i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),t.push(i));return t}notifyListeners(e,t){this.localCache[e]=t;const r=this.listeners[e];if(r)for(const i of Array.from(r))i(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Ls)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&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),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}}Tn.type="LOCAL";const $s=Tn;new ve(3e4,6e4);/**
|
1247
|
+
* @license
|
1248
|
+
* Copyright 2021 Google LLC
|
1249
|
+
*
|
1250
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1251
|
+
* you may not use this file except in compliance with the License.
|
1252
|
+
* You may obtain a copy of the License at
|
1253
|
+
*
|
1254
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1255
|
+
*
|
1256
|
+
* Unless required by applicable law or agreed to in writing, software
|
1257
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1258
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1259
|
+
* See the License for the specific language governing permissions and
|
1260
|
+
* limitations under the License.
|
1261
|
+
*/function Us(n,e){return e?B(e):(y(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}/**
|
1262
|
+
* @license
|
1263
|
+
* Copyright 2019 Google LLC
|
1264
|
+
*
|
1265
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1266
|
+
* you may not use this file except in compliance with the License.
|
1267
|
+
* You may obtain a copy of the License at
|
1268
|
+
*
|
1269
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1270
|
+
*
|
1271
|
+
* Unless required by applicable law or agreed to in writing, software
|
1272
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1273
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1274
|
+
* See the License for the specific language governing permissions and
|
1275
|
+
* limitations under the License.
|
1276
|
+
*/class _t extends ut{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ce(e,this._buildIdpRequest())}_linkToIdToken(e,t){return ce(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return ce(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 js(n){return pn(n.auth,new _t(n),n.bypassAuthState)}function Fs(n){const{auth:e,user:t}=n;return y(t,e,"internal-error"),hs(t,new _t(n),n.bypassAuthState)}async function Bs(n){const{auth:e,user:t}=n;return y(t,e,"internal-error"),us(t,new _t(n),n.bypassAuthState)}/**
|
1277
|
+
* @license
|
1278
|
+
* Copyright 2020 Google LLC
|
1279
|
+
*
|
1280
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1281
|
+
* you may not use this file except in compliance with the License.
|
1282
|
+
* You may obtain a copy of the License at
|
1283
|
+
*
|
1284
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1285
|
+
*
|
1286
|
+
* Unless required by applicable law or agreed to in writing, software
|
1287
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1288
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1289
|
+
* See the License for the specific language governing permissions and
|
1290
|
+
* limitations under the License.
|
1291
|
+
*/class An{constructor(e,t,r,i,s=!1){this.auth=e,this.resolver=r,this.user=i,this.bypassAuthState=s,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(r){this.reject(r)}})}async onAuthEvent(e){const{urlResponse:t,sessionId:r,postBody:i,tenantId:s,error:o,type:c}=e;if(o){this.reject(o);return}const a={auth:this.auth,requestUri:t,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(a))}catch(u){this.reject(u)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return js;case"linkViaPopup":case"linkViaRedirect":return Bs;case"reauthViaPopup":case"reauthViaRedirect":return Fs;default:D(this.auth,"internal-error")}}resolve(e){F(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){F(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()}}/**
|
1292
|
+
* @license
|
1293
|
+
* Copyright 2020 Google LLC
|
1294
|
+
*
|
1295
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1296
|
+
* you may not use this file except in compliance with the License.
|
1297
|
+
* You may obtain a copy of the License at
|
1298
|
+
*
|
1299
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1300
|
+
*
|
1301
|
+
* Unless required by applicable law or agreed to in writing, software
|
1302
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1303
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1304
|
+
* See the License for the specific language governing permissions and
|
1305
|
+
* limitations under the License.
|
1306
|
+
*/const Vs=new ve(2e3,1e4);class ue extends An{constructor(e,t,r,i,s){super(e,t,i,s),this.provider=r,this.authWindow=null,this.pollId=null,ue.currentPopupAction&&ue.currentPopupAction.cancel(),ue.currentPopupAction=this}async executeNotNull(){const e=await this.execute();return y(e,this.auth,"internal-error"),e}async onExecution(){F(this.filter.length===1,"Popup operations only handle one event");const e=mt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(L(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){var e;return((e=this.authWindow)===null||e===void 0?void 0:e.associatedEvent)||null}cancel(){this.reject(L(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,ue.currentPopupAction=null}pollUserCancellation(){const e=()=>{var t,r;if(!((r=(t=this.authWindow)===null||t===void 0?void 0:t.window)===null||r===void 0)&&r.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(L(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Vs.get())};e()}}ue.currentPopupAction=null;/**
|
1307
|
+
* @license
|
1308
|
+
* Copyright 2020 Google LLC
|
1309
|
+
*
|
1310
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1311
|
+
* you may not use this file except in compliance with the License.
|
1312
|
+
* You may obtain a copy of the License at
|
1313
|
+
*
|
1314
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1315
|
+
*
|
1316
|
+
* Unless required by applicable law or agreed to in writing, software
|
1317
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1318
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1319
|
+
* See the License for the specific language governing permissions and
|
1320
|
+
* limitations under the License.
|
1321
|
+
*/const Hs="pendingRedirect",We=new Map;class Ws extends An{constructor(e,t,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,r),this.eventId=null}async execute(){let e=We.get(this.auth._key());if(!e){try{const r=await xs(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(t){e=()=>Promise.reject(t)}We.set(this.auth._key(),e)}return this.bypassAuthState||We.set(this.auth._key(),()=>Promise.resolve(null)),e()}async onAuthEvent(e){if(e.type==="signInViaRedirect")return super.onAuthEvent(e);if(e.type==="unknown"){this.resolve(null);return}if(e.eventId){const t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}}async function xs(n,e){const t=Gs(e),r=qs(n);if(!await r._isAvailable())return!1;const i=await r._get(t)==="true";return await r._remove(t),i}function zs(n,e){We.set(n._key(),e)}function qs(n){return B(n._redirectPersistence)}function Gs(n){return Me(Hs,n.config.apiKey,n.name)}async function Ks(n,e,t=!1){const r=te(n),i=Us(r,e),o=await new Ws(r,i,t).execute();return o&&!t&&(delete o.user._redirectEventId,await r._persistUserIfCurrent(o.user),await r._setRedirectUser(null,e)),o}/**
|
1322
|
+
* @license
|
1323
|
+
* Copyright 2020 Google LLC
|
1324
|
+
*
|
1325
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1326
|
+
* you may not use this file except in compliance with the License.
|
1327
|
+
* You may obtain a copy of the License at
|
1328
|
+
*
|
1329
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1330
|
+
*
|
1331
|
+
* Unless required by applicable law or agreed to in writing, software
|
1332
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1333
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1334
|
+
* See the License for the specific language governing permissions and
|
1335
|
+
* limitations under the License.
|
1336
|
+
*/const Js=10*60*1e3;class Ys{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||!Xs(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){var r;if(e.error&&!Cn(e)){const i=((r=e.error.code)===null||r===void 0?void 0:r.split("auth/")[1])||"internal-error";t.onError(L(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){const r=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Js&&this.cachedEventUids.clear(),this.cachedEventUids.has(Sn(e))}saveEventToCache(e){this.cachedEventUids.add(Sn(e)),this.lastProcessedEventTime=Date.now()}}function Sn(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function Cn({type:n,error:e}){return n==="unknown"&&(e==null?void 0:e.code)==="auth/no-auth-event"}function Xs(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Cn(n);default:return!1}}/**
|
1337
|
+
* @license
|
1338
|
+
* Copyright 2020 Google LLC
|
1339
|
+
*
|
1340
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1341
|
+
* you may not use this file except in compliance with the License.
|
1342
|
+
* You may obtain a copy of the License at
|
1343
|
+
*
|
1344
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1345
|
+
*
|
1346
|
+
* Unless required by applicable law or agreed to in writing, software
|
1347
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1348
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1349
|
+
* See the License for the specific language governing permissions and
|
1350
|
+
* limitations under the License.
|
1351
|
+
*/async function Qs(n,e={}){return x(n,"GET","/v1/projects",e)}/**
|
1352
|
+
* @license
|
1353
|
+
* Copyright 2020 Google LLC
|
1354
|
+
*
|
1355
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1356
|
+
* you may not use this file except in compliance with the License.
|
1357
|
+
* You may obtain a copy of the License at
|
1358
|
+
*
|
1359
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1360
|
+
*
|
1361
|
+
* Unless required by applicable law or agreed to in writing, software
|
1362
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1363
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1364
|
+
* See the License for the specific language governing permissions and
|
1365
|
+
* limitations under the License.
|
1366
|
+
*/const Zs=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,eo=/^https?/;async function to(n){if(n.config.emulator)return;const{authorizedDomains:e}=await Qs(n);for(const t of e)try{if(no(t))return}catch{}D(n,"unauthorized-domain")}function no(n){const e=ot(),{protocol:t,hostname:r}=new URL(e);if(n.startsWith("chrome-extension://")){const o=new URL(n);return o.hostname===""&&r===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===r}if(!eo.test(t))return!1;if(Zs.test(n))return r===n;const i=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}/**
|
1367
|
+
* @license
|
1368
|
+
* Copyright 2020 Google LLC.
|
1369
|
+
*
|
1370
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1371
|
+
* you may not use this file except in compliance with the License.
|
1372
|
+
* You may obtain a copy of the License at
|
1373
|
+
*
|
1374
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1375
|
+
*
|
1376
|
+
* Unless required by applicable law or agreed to in writing, software
|
1377
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1378
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1379
|
+
* See the License for the specific language governing permissions and
|
1380
|
+
* limitations under the License.
|
1381
|
+
*/const ro=new ve(3e4,6e4);function Rn(){const n=M().___jsl;if(n!=null&&n.H){for(const e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function io(n){return new Promise((e,t)=>{var r,i,s;function o(){Rn(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{Rn(),t(L(n,"network-request-failed"))},timeout:ro.get()})}if(!((i=(r=M().gapi)===null||r===void 0?void 0:r.iframes)===null||i===void 0)&&i.Iframe)e(gapi.iframes.getContext());else if(!((s=M().gapi)===null||s===void 0)&&s.load)o();else{const c=Ki("iframefcb");return M()[c]=()=>{gapi.load?o():t(L(n,"network-request-failed"))},cn(`https://apis.google.com/js/api.js?onload=${c}`).catch(a=>t(a))}}).catch(e=>{throw xe=null,e})}let xe=null;function so(n){return xe=xe||io(n),xe}/**
|
1382
|
+
* @license
|
1383
|
+
* Copyright 2020 Google LLC.
|
1384
|
+
*
|
1385
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1386
|
+
* you may not use this file except in compliance with the License.
|
1387
|
+
* You may obtain a copy of the License at
|
1388
|
+
*
|
1389
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1390
|
+
*
|
1391
|
+
* Unless required by applicable law or agreed to in writing, software
|
1392
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1393
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1394
|
+
* See the License for the specific language governing permissions and
|
1395
|
+
* limitations under the License.
|
1396
|
+
*/const oo=new ve(5e3,15e3),ao="__/auth/iframe",co="emulator/auth/iframe",lo={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},uo=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);function ho(n){const e=n.config;y(e.authDomain,n,"auth-domain-config-required");const t=e.emulator?at(e,co):`https://${n.config.authDomain}/${ao}`,r={apiKey:e.apiKey,appName:n.name,v:ye},i=uo.get(n.config.apiHost);i&&(r.eid=i);const s=n._getFrameworks();return s.length&&(r.fw=s.join(",")),`${t}?${fe(r).slice(1)}`}async function fo(n){const e=await so(n),t=M().gapi;return y(t,n,"internal-error"),e.open({where:document.body,url:ho(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:lo,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});const o=L(n,"network-request-failed"),c=M().setTimeout(()=>{s(o)},oo.get());function a(){M().clearTimeout(c),i(r)}r.ping(a).then(a,()=>{s(o)})}))}/**
|
1397
|
+
* @license
|
1398
|
+
* Copyright 2020 Google LLC.
|
1399
|
+
*
|
1400
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1401
|
+
* you may not use this file except in compliance with the License.
|
1402
|
+
* You may obtain a copy of the License at
|
1403
|
+
*
|
1404
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1405
|
+
*
|
1406
|
+
* Unless required by applicable law or agreed to in writing, software
|
1407
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1408
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1409
|
+
* See the License for the specific language governing permissions and
|
1410
|
+
* limitations under the License.
|
1411
|
+
*/const po={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},go=500,mo=600,yo="_blank",_o="http://localhost";class On{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}}function vo(n,e,t,r=go,i=mo){const s=Math.max((window.screen.availHeight-i)/2,0).toString(),o=Math.max((window.screen.availWidth-r)/2,0).toString();let c="";const a=Object.assign(Object.assign({},po),{width:r.toString(),height:i.toString(),top:s,left:o}),u=R().toLowerCase();t&&(c=Zt(u)?yo:t),Qt(u)&&(e=e||_o,a.scrollbars="yes");const _=Object.entries(a).reduce((A,[O,N])=>`${A}${O}=${N},`,"");if(Fi(u)&&c!=="_self")return bo(e||"",c),new On(null);const b=window.open(e||"",c,_);y(b,n,"popup-blocked");try{b.focus()}catch{}return new On(b)}function bo(n,e){const t=document.createElement("a");t.href=n,t.target=e;const r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(r)}/**
|
1412
|
+
* @license
|
1413
|
+
* Copyright 2021 Google LLC
|
1414
|
+
*
|
1415
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1416
|
+
* you may not use this file except in compliance with the License.
|
1417
|
+
* You may obtain a copy of the License at
|
1418
|
+
*
|
1419
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1420
|
+
*
|
1421
|
+
* Unless required by applicable law or agreed to in writing, software
|
1422
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1423
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1424
|
+
* See the License for the specific language governing permissions and
|
1425
|
+
* limitations under the License.
|
1426
|
+
*/const Io="__/auth/handler",wo="emulator/auth/handler",Eo=encodeURIComponent("fac");async function Pn(n,e,t,r,i,s){y(n.config.authDomain,n,"auth-domain-config-required"),y(n.config.apiKey,n,"invalid-api-key");const o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:r,v:ye,eventId:i};if(e instanceof un){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",or(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(const[_,b]of Object.entries(s||{}))o[_]=b}if(e instanceof Te){const _=e.getScopes().filter(b=>b!=="");_.length>0&&(o.scopes=_.join(","))}n.tenantId&&(o.tid=n.tenantId);const c=o;for(const _ of Object.keys(c))c[_]===void 0&&delete c[_];const a=await n._getAppCheckToken(),u=a?`#${Eo}=${encodeURIComponent(a)}`:"";return`${To(n)}?${fe(c).slice(1)}${u}`}function To({config:n}){return n.emulator?at(n,wo):`https://${n.authDomain}/${Io}`}/**
|
1427
|
+
* @license
|
1428
|
+
* Copyright 2020 Google LLC
|
1429
|
+
*
|
1430
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1431
|
+
* you may not use this file except in compliance with the License.
|
1432
|
+
* You may obtain a copy of the License at
|
1433
|
+
*
|
1434
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1435
|
+
*
|
1436
|
+
* Unless required by applicable law or agreed to in writing, software
|
1437
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1438
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1439
|
+
* See the License for the specific language governing permissions and
|
1440
|
+
* limitations under the License.
|
1441
|
+
*/const vt="webStorageSupport";class Ao{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=_n,this._completeRedirectFn=Ks,this._overrideRedirectResult=zs}async _openPopup(e,t,r,i){var s;F((s=this.eventManagers[e._key()])===null||s===void 0?void 0:s.manager,"_initialize() not called before _openPopup()");const o=await Pn(e,t,r,ot(),i);return vo(e,o,mt())}async _openRedirect(e,t,r,i){await this._originValidation(e);const s=await Pn(e,t,r,ot(),i);return Cs(s),new Promise(()=>{})}_initialize(e){const t=e._key();if(this.eventManagers[t]){const{manager:i,promise:s}=this.eventManagers[t];return i?Promise.resolve(i):(F(s,"If manager is not set, promise should be"),s)}const r=this.initAndGetManager(e);return this.eventManagers[t]={promise:r},r.catch(()=>{delete this.eventManagers[t]}),r}async initAndGetManager(e){const t=await fo(e),r=new Ys(e);return t.register("authEvent",i=>(y(i==null?void 0:i.authEvent,e,"invalid-auth-event"),{status:r.onEvent(i.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(vt,{type:vt},i=>{var s;const o=(s=i==null?void 0:i[0])===null||s===void 0?void 0:s[vt];o!==void 0&&t(!!o),D(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){const t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=to(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return sn()||dt()||$e()}}const So=Ao;var kn="@firebase/auth",Dn="1.2.0";/**
|
1442
|
+
* @license
|
1443
|
+
* Copyright 2020 Google LLC
|
1444
|
+
*
|
1445
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1446
|
+
* you may not use this file except in compliance with the License.
|
1447
|
+
* You may obtain a copy of the License at
|
1448
|
+
*
|
1449
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1450
|
+
*
|
1451
|
+
* Unless required by applicable law or agreed to in writing, software
|
1452
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1453
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1454
|
+
* See the License for the specific language governing permissions and
|
1455
|
+
* limitations under the License.
|
1456
|
+
*/class Co{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){var e;return this.assertAuthConfigured(),((e=this.auth.currentUser)===null||e===void 0?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(r=>{e((r==null?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(){y(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}}/**
|
1457
|
+
* @license
|
1458
|
+
* Copyright 2020 Google LLC
|
1459
|
+
*
|
1460
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1461
|
+
* you may not use this file except in compliance with the License.
|
1462
|
+
* You may obtain a copy of the License at
|
1463
|
+
*
|
1464
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1465
|
+
*
|
1466
|
+
* Unless required by applicable law or agreed to in writing, software
|
1467
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1468
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1469
|
+
* See the License for the specific language governing permissions and
|
1470
|
+
* limitations under the License.
|
1471
|
+
*/function Ro(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";default:return}}function Oo(n){me(new se("auth",(e,{options:t})=>{const r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=r.options;y(o&&!o.includes(":"),"invalid-api-key",{appName:r.name});const a={apiKey:o,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:on(n)},u=new qi(r,i,s,a);return es(u,t),u},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,r)=>{e.getProvider("auth-internal").initialize()})),me(new se("auth-internal",e=>{const t=te(e.getProvider("auth").getImmediate());return(r=>new Co(r))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),oe(kn,Dn,Ro(n)),oe(kn,Dn,"esm2017")}/**
|
1472
|
+
* @license
|
1473
|
+
* Copyright 2021 Google LLC
|
1474
|
+
*
|
1475
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
1476
|
+
* you may not use this file except in compliance with the License.
|
1477
|
+
* You may obtain a copy of the License at
|
1478
|
+
*
|
1479
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
1480
|
+
*
|
1481
|
+
* Unless required by applicable law or agreed to in writing, software
|
1482
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
1483
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
1484
|
+
* See the License for the specific language governing permissions and
|
1485
|
+
* limitations under the License.
|
1486
|
+
*/const Po=5*60,ko=Tt("authIdTokenMaxAge")||Po;let Nn=null;const Do=n=>async e=>{const t=e&&await e.getIdTokenResult(),r=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(r&&r>ko)return;const i=t==null?void 0:t.token;Nn!==i&&(Nn=i,await fetch(n,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};function No(n=oi()){const e=Nt(n,"auth");if(e.isInitialized())return e.getImmediate();const t=Zi(n,{popupRedirectResolver:So,persistence:[$s,Ts,_n]}),r=Tt("authTokenSyncURL");if(r){const s=Do(r);_s(t,s,()=>s(t.currentUser)),ys(t,o=>s(o))}const i=Jn("auth");return i&&ts(t,`http://${i}`),t}Oo("Browser");var Lo=typeof globalThis<"u"?globalThis:typeof window<"u"?window:typeof global<"u"?global:typeof self<"u"?self:{};function Mo(n){return n&&n.__esModule&&Object.prototype.hasOwnProperty.call(n,"default")?n.default:n}var Ln={exports:{}};(function(n){(function(e){function t(l,m){var d=(l&65535)+(m&65535),w=(l>>16)+(m>>16)+(d>>16);return w<<16|d&65535}function r(l,m){return l<<m|l>>>32-m}function i(l,m,d,w,E,S){return t(r(t(t(m,l),t(w,S)),E),d)}function s(l,m,d,w,E,S,P){return i(m&d|~m&w,l,m,E,S,P)}function o(l,m,d,w,E,S,P){return i(m&w|d&~w,l,m,E,S,P)}function c(l,m,d,w,E,S,P){return i(m^d^w,l,m,E,S,P)}function a(l,m,d,w,E,S,P){return i(d^(m|~w),l,m,E,S,P)}function u(l,m){l[m>>5]|=128<<m%32,l[(m+64>>>9<<4)+14]=m;var d,w,E,S,P,h=1732584193,f=-271733879,p=-1732584194,g=271733878;for(d=0;d<l.length;d+=16)w=h,E=f,S=p,P=g,h=s(h,f,p,g,l[d],7,-680876936),g=s(g,h,f,p,l[d+1],12,-389564586),p=s(p,g,h,f,l[d+2],17,606105819),f=s(f,p,g,h,l[d+3],22,-1044525330),h=s(h,f,p,g,l[d+4],7,-176418897),g=s(g,h,f,p,l[d+5],12,1200080426),p=s(p,g,h,f,l[d+6],17,-1473231341),f=s(f,p,g,h,l[d+7],22,-45705983),h=s(h,f,p,g,l[d+8],7,1770035416),g=s(g,h,f,p,l[d+9],12,-1958414417),p=s(p,g,h,f,l[d+10],17,-42063),f=s(f,p,g,h,l[d+11],22,-1990404162),h=s(h,f,p,g,l[d+12],7,1804603682),g=s(g,h,f,p,l[d+13],12,-40341101),p=s(p,g,h,f,l[d+14],17,-1502002290),f=s(f,p,g,h,l[d+15],22,1236535329),h=o(h,f,p,g,l[d+1],5,-165796510),g=o(g,h,f,p,l[d+6],9,-1069501632),p=o(p,g,h,f,l[d+11],14,643717713),f=o(f,p,g,h,l[d],20,-373897302),h=o(h,f,p,g,l[d+5],5,-701558691),g=o(g,h,f,p,l[d+10],9,38016083),p=o(p,g,h,f,l[d+15],14,-660478335),f=o(f,p,g,h,l[d+4],20,-405537848),h=o(h,f,p,g,l[d+9],5,568446438),g=o(g,h,f,p,l[d+14],9,-1019803690),p=o(p,g,h,f,l[d+3],14,-187363961),f=o(f,p,g,h,l[d+8],20,1163531501),h=o(h,f,p,g,l[d+13],5,-1444681467),g=o(g,h,f,p,l[d+2],9,-51403784),p=o(p,g,h,f,l[d+7],14,1735328473),f=o(f,p,g,h,l[d+12],20,-1926607734),h=c(h,f,p,g,l[d+5],4,-378558),g=c(g,h,f,p,l[d+8],11,-2022574463),p=c(p,g,h,f,l[d+11],16,1839030562),f=c(f,p,g,h,l[d+14],23,-35309556),h=c(h,f,p,g,l[d+1],4,-1530992060),g=c(g,h,f,p,l[d+4],11,1272893353),p=c(p,g,h,f,l[d+7],16,-155497632),f=c(f,p,g,h,l[d+10],23,-1094730640),h=c(h,f,p,g,l[d+13],4,681279174),g=c(g,h,f,p,l[d],11,-358537222),p=c(p,g,h,f,l[d+3],16,-722521979),f=c(f,p,g,h,l[d+6],23,76029189),h=c(h,f,p,g,l[d+9],4,-640364487),g=c(g,h,f,p,l[d+12],11,-421815835),p=c(p,g,h,f,l[d+15],16,530742520),f=c(f,p,g,h,l[d+2],23,-995338651),h=a(h,f,p,g,l[d],6,-198630844),g=a(g,h,f,p,l[d+7],10,1126891415),p=a(p,g,h,f,l[d+14],15,-1416354905),f=a(f,p,g,h,l[d+5],21,-57434055),h=a(h,f,p,g,l[d+12],6,1700485571),g=a(g,h,f,p,l[d+3],10,-1894986606),p=a(p,g,h,f,l[d+10],15,-1051523),f=a(f,p,g,h,l[d+1],21,-2054922799),h=a(h,f,p,g,l[d+8],6,1873313359),g=a(g,h,f,p,l[d+15],10,-30611744),p=a(p,g,h,f,l[d+6],15,-1560198380),f=a(f,p,g,h,l[d+13],21,1309151649),h=a(h,f,p,g,l[d+4],6,-145523070),g=a(g,h,f,p,l[d+11],10,-1120210379),p=a(p,g,h,f,l[d+2],15,718787259),f=a(f,p,g,h,l[d+9],21,-343485551),h=t(h,w),f=t(f,E),p=t(p,S),g=t(g,P);return[h,f,p,g]}function _(l){var m,d="",w=l.length*32;for(m=0;m<w;m+=8)d+=String.fromCharCode(l[m>>5]>>>m%32&255);return d}function b(l){var m,d=[];for(d[(l.length>>2)-1]=void 0,m=0;m<d.length;m+=1)d[m]=0;var w=l.length*8;for(m=0;m<w;m+=8)d[m>>5]|=(l.charCodeAt(m/8)&255)<<m%32;return d}function A(l){return _(u(b(l),l.length*8))}function O(l,m){var d,w=b(l),E=[],S=[],P;for(E[15]=S[15]=void 0,w.length>16&&(w=u(w,l.length*8)),d=0;d<16;d+=1)E[d]=w[d]^909522486,S[d]=w[d]^1549556828;return P=u(E.concat(b(m)),512+m.length*8),_(u(S.concat(P),512+128))}function N(l){var m="0123456789abcdef",d="",w,E;for(E=0;E<l.length;E+=1)w=l.charCodeAt(E),d+=m.charAt(w>>>4&15)+m.charAt(w&15);return d}function v(l){return unescape(encodeURIComponent(l))}function I(l){return A(v(l))}function $(l){return N(I(l))}function C(l,m){return O(v(l),v(m))}function re(l,m){return N(C(l,m))}function Y(l,m,d){return m?d?C(m,l):re(m,l):d?I(l):$(l)}n.exports?n.exports=Y:e.md5=Y})(Lo)})(Ln);var $o=Ln.exports;const Uo=Mo($o),Mn=(n,e)=>async(t,r={})=>{const i=e?await e.getIdToken():null,s=await fetch(`${n}${t}`,{mode:"cors",...r,headers:{...i&&{authorization:`Bearer ${i}`},...r.body&&{"content-type":"application/json"},...r.headers},...r.body&&{body:JSON.stringify(r.body)}}),o=await s.json();if(s.status>202)throw Object.assign(new Error((o==null?void 0:o.message)||`HTTP Error ${s.status}`),{status:s.status,code:o==null?void 0:o.code,body:o});return o},jo=n=>{const e=n.properties||{},t=n.inputProps||Object.keys(e),r=(i,s)=>{const o=e[i]||{};if([null,void 0].includes(s))return o.isRequired?{id:"value-missing-validation-error"}:void 0;if(o.enum)return o.enum.includes(s)?void 0:{id:"enum-validation-error",values:{enum:o.enum,value:s}};switch(o.type){case"integer":if(o.isScalar&&(typeof s!="number"||Number.isNaN(s)))return{id:"invalid-number-validation-error"};break;case"date":break;case"boolean":break;case"json":case"string":default:if(o.isRequired&&!s)return{id:"value-missing-validation-error"};break}};return{validate:i=>t.reduce((s,o)=>{const c=r(o,i[o]);return c?{...s,[o]:c}:s},{}),validateAttr:r}},Fo=(n={})=>Object.keys(n).length?`?q=${JSON.stringify(n)}`:"",Bo=n=>[...n].reduce((e,t)=>t===t.toUpperCase()?`${e}-${t.toLowerCase()}`:`${e}${t}`,""),Vo=n=>`${n[0].toLowerCase()}${n.slice(1)}`,Ho=n=>{const e=Bo(n);return(t,r)=>`/${e}${t?`/${encodeURIComponent(t)}`:""}${Fo(r)}`},$n=(n,e)=>{const t=Array.isArray(e.inputProps);return Object.keys(n).reduce((r,i)=>{if(t&&!e.inputProps.includes(i))return r;const{isRef:s,isScalar:o,isRequired:c}=e.properties[i]||{};return s&&o&&!c&&n[i]===null?r:{...r,[i]:n[i]}},{})},Wo=({primaryKey:n,properties:e,...t})=>({primaryKey:n||"id",properties:Object.keys(e||{}).reduce((r,i)=>{var b,A;const s=e[i]||{},{type:o,isScalar:c,isRequired:a,isRef:u=!1}=typeof s.type=="string"?s.type==="array"?s.enum?{type:"string",isScalar:!1,isRequired:!1}:(b=s.items)!=null&&b.$ref?{type:s.items.$ref.split("/").pop(),isScalar:!1,isRequired:!1,isRef:!0}:{type:(A=s.items)==null?void 0:A.type,isScalar:!1,isRequired:!1}:{type:s.format==="date-time"?"date":s.type,isScalar:!0,isRequired:!0}:Array.isArray(s.type)?s.type.length===2?{type:s.format==="date-time"?"date":s.type[0],isScalar:!0,isRequired:!1}:{type:"json",isScalar:!0,isRequired:s.type.includes("null")}:s.$ref?{type:s.$ref.split("/").pop(),isScalar:!0,isRequired:!0,isRef:!0}:{type:s.anyOf[0].$ref.split("/").pop(),isScalar:!0,isRequired:!1,isRef:!0},_=s.inputType||(o==="integer"?"number":o);return{...r,[i]:{...e[i],type:o,isScalar:c,isRequired:typeof s.isRequired=="boolean"?s.isRequired:a,isRef:u,inputType:_}}},{}),...t}),xo=(n,e,t,r={},i={})=>{const s=Wo(r),{primaryKey:o,properties:c}=s,a=jo(s),u=Ho(t),_=(...v)=>Mn(n,e.authUser)(...v),b=({data:v,...I})=>_(u(null,I),{method:"POST",body:$n(v,s)}),A=({data:v,...I})=>{const{where:$,...C}=I;return _(u($[o],C),{method:"PUT",body:$n(v,s)})},O=v=>{if(!v)return v;const I=Object.keys(v).reduce(($,C)=>{var E;const re=c[C]||{},{type:Y,isScalar:l,isRef:m,format:d,items:w}=re;if(m){const S=Vo(Y);return l?{...$,[C]:i[S].parse(v[C])}:{...$,[C]:typeof((E=i[S])==null?void 0:E.parse)=="function"?v[C].map(P=>i[S].parse(P)):v[C]}}return{...$,[C]:Y==="date"&&v[C]?new Date(v[C]):v[C]}},{});return typeof s.parse=="function"?s.parse(I):I},N=Object.keys(c||{}).reduce((v,I)=>c[I].isRef&&c[I].isScalar&&c[I].isRequired?Object.assign(v,{all:v.all.concat(I),oneToOne:v.oneToOne.concat(I),requiredOneToOne:v.requiredOneToOne.concat(I)}):c[I].isRef&&c[I].isScalar?Object.assign(v,{all:v.all.concat(I),oneToOne:v.oneToOne.concat(I),optionalOneToOne:v.optionalOneToOne.concat(I)}):c[I].isRef?Object.assign(v,{all:v.all.concat(I),oneToMany:v.oneToMany.concat(I)}):v,{all:[],oneToOne:[],requiredOneToOne:[],optionalOneToOne:[],oneToMany:[]});return{get schema(){return s},get relations(){return N},parse:O,validateAttr:a.validateAttr,validate:a.validate,findMany:v=>_(u(null,v)).then(I=>I.map(O)),findById:(v,I)=>_(u(v,I)).then(O),create:b,update:A,upsert:v=>v.where[o]?A({where:v.where,data:v.update}):b({data:v.create}),delete:v=>_(u(v),{method:"DELETE"}),stats:()=>_(u("_stats"))}},zo=(n,e,t)=>Object.keys(t.properties).reduce((r,i)=>{const s=t.properties[i].$ref.split("/").pop();return Object.assign(r,{[i]:xo(n,e,t.definitions[s].plural||`${i}s`,t.definitions[s],r)})},{}),qo=(n,e)=>Object.keys(n.definitions).reduce((t,r)=>({...t,[r]:e[r]?{...n.definitions[r],...e[r],properties:Object.keys(n.definitions[r].properties).reduce((i,s)=>({...i,[s]:{...n.definitions[r].properties[s],...(e[r].properties||{})[s]}}),e[r].properties||{})}:n.definitions[r]}),{}),Un={$schema:"http://json-schema.org/draft-07/schema#",definitions:{Country:{type:"object",properties:{code:{type:"string"},name:{type:"string"},incomeFilter:{type:["integer","null"]},canApply:{type:"boolean",default:!1},capital:{type:"array",items:{type:"string"}},timeZone:{type:["string","null"]},flag:{type:["string","null"]},currency:{anyOf:[{$ref:"#/definitions/Currency"},{type:"null"}]},contracts:{type:"array",items:{$ref:"#/definitions/Contract"}},users:{type:"array",items:{$ref:"#/definitions/User"}},applications:{type:"array",items:{$ref:"#/definitions/Application"}},applicationNationalities:{type:"array",items:{$ref:"#/definitions/Application"}},educationLevels:{type:"array",items:{$ref:"#/definitions/EducationLevel"}},universities:{type:"array",items:{$ref:"#/definitions/University"}},companies:{type:"array",items:{$ref:"#/definitions/Company"}},jobs:{type:"array",items:{$ref:"#/definitions/Job"}}}},Currency:{type:"object",properties:{code:{type:"string"},name:{type:"string"},symbol:{type:"string"},countries:{type:"array",items:{$ref:"#/definitions/Country"}}}},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"]},role:{type:["string","null"],enum:["staff","manager","finance","admin"]},disabled:{type:"boolean",default:!1},lang:{type:["string","null"],enum:["en","es","pt"]},referralSource:{type:["string","null"],enum:["word_of_mouth","codigo_m","social","google","print","tv","radio","other"]},identifiesAsFemale:{type:["boolean","null"]},dateOfBirth:{type:["string","null"],format:"date-time"},identificationNumber:{type:["string","null"]},mobileNumber:{type:["string","null"]},github:{type:["string","null"]},linkedin:{type:["string","null"]},bio:{type:["string","null"]},country:{anyOf:[{$ref:"#/definitions/Country"},{type:"null"}]},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"}},activityLog:{type:"array",items:{$ref:"#/definitions/ActivityLogEntry"}},authoredActivityLog:{type:"array",items:{$ref:"#/definitions/ActivityLogEntry"}},jobValidityReviews:{type:"array",items:{$ref:"#/definitions/JobValidityReview"}},jobApplications:{type:"array",items:{$ref:"#/definitions/JobApplication"}}}},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"]},langs:{type:"array",enum:["en","es","pt"]},hidden:{type:"boolean",default:!1},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"},lang:{type:["string","null"],enum:["en","es","pt"]},start:{type:"string",format:"date-time"},end:{type:"string",format:"date-time"},timeZone:{type:["string","null"]},startTime:{type:["string","null"]},endTime:{type:["string","null"]},legacySlug:{type:"string"},vacancies:{type:["integer","null"]},admissionStart:{type:["string","null"],format:"date-time"},admissionEnd:{type:["string","null"],format:"date-time"},admissionCountries:{type:"array",items:{type:"string"}},placementStart:{type:["string","null"],format:"date-time"},placementDuration:{type:["integer","null"]},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"}},activityLog:{type:"array",items:{$ref:"#/definitions/ActivityLogEntry"}},jobApplications:{type:"array",items:{$ref:"#/definitions/JobApplication"}}}},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"}}},IscedLevel:{type:"object",properties:{id:{type:"integer"},label:{type:"string"},educationLevels:{type:"array",items:{$ref:"#/definitions/EducationLevel"}}}},EducationLevel:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},lang:{type:"string",enum:["en","es","pt"]},label:{type:"string"},country:{$ref:"#/definitions/Country"},iscedLevel:{$ref:"#/definitions/IscedLevel"},applications:{type:"array",items:{$ref:"#/definitions/Application"}}}},University:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},lang:{type:"string",enum:["en","es","pt"]},name:{type:"string"},filter:{type:"boolean"},country:{$ref:"#/definitions/Country"},applications:{type:"array",items:{$ref:"#/definitions/Application"}}}},Application:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},createdBy:{type:["string","null"]},dateOfBirth:{type:"string",format:"date-time"},isAllowedToWork:{type:"boolean"},hasValidIdDocument:{type:"boolean"},locality:{type:["number","string","boolean","object","array","null"]},householdSize:{type:"integer"},children:{type:"integer"},householdIncome:{type:"integer"},racialIdentity:{type:["string","null"]},schoolType:{type:["string","null"],enum:["private","public","other","subsidized","mixed"]},educationSubject:{type:["string","null"],enum:["design_and_media","software_engineering","engineering","management_and_business","languages","science","health","social_sciences","arts","comms_and_advertising","education","cooking","tourism","economics_and_accounting","law","other"]},isStudying:{type:"boolean"},englishLevel:{type:["string","null"],enum:["NO","A1","A2","B1","B2","C1","C2"]},workStatus:{type:"string",enum:["never","not_now","yes"]},isLookingForWork:{type:["boolean","null"]},monthsLookingForWork:{type:["integer","null"]},monthsUnemployed:{type:["integer","null"]},workRole:{type:["string","null"],enum:["waitress","promoter","manager","cashier","intern","operative","call_center","receptionist","sales_agent","assistant","professional","technical","consultant","other"]},freelance:{type:["boolean","null"]},workFormal:{type:["boolean","null"]},workIncome:{type:["integer","null"]},failedFilters:{type:"array",items:{type:"string"}},bypassFilters:{type:"boolean",default:!1},isReady:{type:"boolean",default:!1},isReturningApplicant:{type:["boolean","null"]},legacyAdmissionCohortSlug:{type:["string","null"]},cohort:{$ref:"#/definitions/Cohort"},user:{$ref:"#/definitions/User"},country:{$ref:"#/definitions/Country"},nationality:{$ref:"#/definitions/Country"},educationLevel:{$ref:"#/definitions/EducationLevel"},university:{anyOf:[{$ref:"#/definitions/University"},{type:"null"}]},challengeAssignments:{type:"array",items:{$ref:"#/definitions/ApplicationChallengeAssignment"}}}},ApplicationChallenge:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},createdBy:{type:["string","null"]},slug:{type:"string"},version:{type:"string"},trackId:{type:"integer"},langs:{type:"array",enum:["en","es","pt"]},json:{type:"string"},archived:{type:"boolean",default:!1},assignments:{type:"array",items:{$ref:"#/definitions/ApplicationChallengeAssignment"}}}},ApplicationChallengeAssignment:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},application:{$ref:"#/definitions/Application"},challenge:{$ref:"#/definitions/ApplicationChallenge"}}},ActivityLogEntry:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},type:{type:"string",enum:["challenge","application_filter","application_filter_bypass","application_cohort_change"]},data:{type:["number","string","boolean","object","array","null"]},path:{type:"string"},author:{$ref:"#/definitions/User"},user:{$ref:"#/definitions/User"},cohort:{$ref:"#/definitions/Cohort"}}},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:!1},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","slack"]},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"}}},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"}}}},Company:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},createdBy:{type:["string","null"]},source:{type:"string"},sourceId:{type:"string"},name:{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",enum:["Tech_Consultancy","Digital_Transformation","Agency","Startups","High_tech","Traditional_Consulting"]}}},Job:{type:"object",properties:{id:{type:"integer"},createdAt:{type:"string",format:"date-time"},updatedAt:{type:"string",format:"date-time"},createdBy:{type:["string","null"]},source:{type:"string"},sourceId:{type:"string"},title:{type:"string"},publishedAt:{type:"string",format:"date-time"},modality:{type:"string"},publicUrl:{type:["string","null"]},location:{type:["string","null"]},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"]},remoteOption:{type:["string","null"],enum:["remote_for_now","locally_remote","fully_remote","no_remote","mixed"]},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"},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"]},author:{$ref:"#/definitions/User"},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"]},status:{type:"string",default:"pending",enum:["pending","applied","interview","challenge","followup","hired","not_hired"]},hireDate:{type:["string","null"],format:"date-time"},jobStartDate:{type:["string","null"],format:"date-time"},netSalary:{type:["integer","null"]},grossSalary:{type:["integer","null"]},currency:{type:["string","null"]},job:{$ref:"#/definitions/Job"},user:{$ref:"#/definitions/User"},cohort:{anyOf:[{$ref:"#/definitions/Cohort"},{type:"null"}]}}}},type:"object",properties:{country:{$ref:"#/definitions/Country"},currency:{$ref:"#/definitions/Currency"},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"},iscedLevel:{$ref:"#/definitions/IscedLevel"},educationLevel:{$ref:"#/definitions/EducationLevel"},university:{$ref:"#/definitions/University"},application:{$ref:"#/definitions/Application"},applicationChallenge:{$ref:"#/definitions/ApplicationChallenge"},applicationChallengeAssignment:{$ref:"#/definitions/ApplicationChallengeAssignment"},activityLogEntry:{$ref:"#/definitions/ActivityLogEntry"},contract:{$ref:"#/definitions/Contract"},gig:{$ref:"#/definitions/Gig"},message:{$ref:"#/definitions/Message"},messageLog:{$ref:"#/definitions/MessageLog"},industry:{$ref:"#/definitions/Industry"},company:{$ref:"#/definitions/Company"},job:{$ref:"#/definitions/Job"},jobValidityReview:{$ref:"#/definitions/JobValidityReview"},jobApplication:{$ref:"#/definitions/JobApplication"}}},jn=24*(60*60*1e3),Go={Country:{primaryKey:"code",plural:"countries",searchProps:["code","name","timeZone"],getOptionLabel:({code:n,name:e})=>`${n} / ${e}`},ActivityLogEntry:{plural:"activityLog"},User:{primaryKey:"uid",inputProps:["firstName","lastName","email","password","lang","identifiesAsFemale","dateOfBirth","country","identificationNumber","mobileNumber","github","linkedin","bio","role","signupCohort","disabled","referralSource"],searchProps:["firstName","lastName","email"],getOptionLabel:({firstName:n,lastName:e,email:t})=>`${n} ${e} (${t})`,properties:{email:{inputType:"email"},mobileNumber:{inputType:"phone"},bio:{inputType:"textarea"}},parse:n=>{const e=n.github?`https://github.com/${n.github}.png?size=`:`https://www.gravatar.com/avatar/${Uo(n.email)}?s=`;return{...n,fullName:`${n.firstName||""}${n.lastName?` ${n.lastName}`:""}`,avatar:t=>`${e}${t}`,isStaff:["staff","manager","finance","admin"].includes(n.role),isManager:["manager","finance","admin"].includes(n.role),isFinance:["finance","admin"].includes(n.role),isAdmin:n.role==="admin"}}},Track:{searchProps:["name"]},Program:{searchProps:["name"]},Stage:{searchProps:["name"]},Cohort:{inputProps:["program","stage","lang","name","start","end","timeZone","startTime","endTime","vacancies","admissionStart","admissionEnd","placementStart","admissionCountries"],searchProps:["name"],getOptionLabel:({id:n,name:e,stage:t})=>`${e}${t?` - ${t.name}`:""} (id: ${n})`,properties:{},parse:n=>{var s,o;const e=Date.now();let t;if(n.placementStart){const c=n.placementDuration||270;new Date(+n.placementStart+c*24*60*60*1e3)<e?t="placement_ended":n.placementStart<e&&(t="placement_started")}!t&&n.end<e&&(t="ended"),!t&&n.start<e&&(t="started");const r=n.admissionEnd?+n.admissionEnd+jn:!1;!t&&r&&r<e&&(t="admission_ended"),!t&&n.admissionStart&&n.admissionStart<e&&(t="admission_started"),!t&&n.admissionStart&&n.admissionEnd&&(t="planned"),t||(t="draft");const i=n.start>e&&n.vacancies?n.vacancies:((s=n._count)==null?void 0:s.students)||((o=n.students)==null?void 0:o.length)||0;return{...n,status:t,size:i}}},Student:{inputProps:["cohort","user"],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:n,user:e})=>`${e==null?void 0:e.firstName} (id: ${n})`},Gig:{inputProps:["cohort","user","contract","role","hoursPerWeek","start","end"]},Application:{inputProps:["user","cohort","dateOfBirth","country","locality","nationality","isAllowedToWork","hasValidIdDocument","householdSize","children","householdIncome","racialIdentity","educationLevel","schoolType","educationSubject","university","isStudying","englishLevel","workStatus","isLookingForWork","monthsLookingForWork","monthsUnemployed","workRole","freelance","workFormal","workIncome","isReady","bypassFilters"],properties:{locality:{isRequired:!0},englishLevel:{isRequired:!0},isReady:{isRequired:!1},bypassFilters:{isRequired:!1}},parse:n=>{var i,s,o;const e=typeof n.hasFailedFilters=="boolean"?n.hasFailedFilters:typeof((i=n.failedFilters)==null?void 0:i.length)=="number"?n.failedFilters.length>0:void 0;if(!((s=n.cohort)!=null&&s.admissionEnd)||typeof e>"u")return n;const t=Date.now();let r;return n.isReady?r="ready":e&&!n.bypassFilters?r="rejected":n.createdAt<t-90*jn?r="expired":((o=n.cohort)==null?void 0:o.status)!=="admission_started"?r="admission_ended":r="active",{...n,status:r}}},IscedLevel:{parse:n=>{const e=Math.floor(n.id/10);return{...n,level:e,completed:e*10<n.id}}},EducationLevel:{searchProps:["label"]},University:{plural:"universities",searchProps:["name"]},Job:{},Company:{plural:"companies"}},Ko=(n,e)=>({...zo(n,e,{...Un,definitions:qo(Un,Go)}),gcpLog:{getEntries:async t=>await Mn(n,e.authUser)(`/gcp-logs?q=${JSON.stringify(t)}`)}}),Jo="https://api.github.com/repos/Laboratoria/bootcamp/releases",Se="https://raw.githubusercontent.com/Laboratoria/bootcamp",Ce=()=>fetch(`${Jo}/latest`).then(n=>n.json()).then(({tag_name:n})=>n),Yo=async n=>fetch(`${Se}/${n||await Ce()}/dist/projects.json`).then(e=>e.json()),Xo=async(n,e)=>fetch(`${Se}/${e||await Ce()}/dist/projects/${n}.json`).then(t=>t.json()),Qo=async n=>fetch(`${Se}/${n||await Ce()}/dist/topics.json`).then(e=>e.json()),Zo=async(n,e)=>fetch(`${Se}/${e||await Ce()}/dist/topics/${n}.json`).then(t=>t.json()),ea=async n=>fetch(`${Se}/${n||await Ce()}/dist/learning-objectives.json`).then(e=>e.json()),Fn=n=>e=>e.filter(t=>!(n.locale&&n.locale!==t.locale||n.track&&n.track!==t.track)),ta=()=>({project:{findMany:(n={})=>Yo(n.tag).then(Fn(n)),findById:(n,e={})=>Xo(n,e.tag)},topic:{findMany:(n={})=>Qo(n.tag).then(Fn(n)),findById:(n,e={})=>Zo(n,e.tag)},learningObjective:{findMany:(n={})=>ea(n.tag)}}),ze=n=>n>9?`${n}`:`0${n}`,Bn=n=>`${ze(n.getUTCDate())}/${ze(n.getUTCMonth()+1)}/${n.getUTCFullYear()}`,Vn=n=>`${ze(n.getUTCHours())}:${ze(n.getUTCMinutes())}:${n.getUTCSeconds()} UTC`,na=n=>`${Bn(n)} ${Vn(n)}`,ra={es:"es-ES",pt:"pt-BR"},ia=(n,e="es",t=!1)=>new Intl.DateTimeFormat(ra[e],{...t&&{year:"numeric"},month:"long",day:"numeric",timeZone:"UTC"}).format(new Date(n)),sa=(n,e)=>{let t=e.getFullYear()-n.getFullYear();const r=e.getMonth()-n.getMonth();return(r<0||r===0&&e.getDate()<n.getDate())&&t--,t},oa=(n,e,t)=>new Intl.NumberFormat(`${n}-${e}`,{currency:t}),aa=(n,e,t,r)=>oa(e,t,r).format(n),ca=n=>parseInt(n.replace(/[,\.]/g,""),10),la=n=>{try{return JSON.parse(window.localStorage.getItem(n))}catch{return null}},da=({firebaseApiKey:n="AIzaSyAXbaEbpq8NOfn0r8mIrcoHvoGRkJThwdc",firebaseProject:e="laboratoria-la",coreApiUrl:t="https://us-central1-outpost-272720.cloudfunctions.net/core-api"}={})=>{const r=Lt({apiKey:n,authDomain:`${e}.firebaseapp.com`,databaseURL:`https://${e}.firebaseio.com`,projectId:e}),i=No(r),s={authUser:void 0,user:void 0},o=Ko(t,s);return{...ta(),...o,auth:{onChange:u=>vs(i,_=>{if(!_)return Object.assign(s,{authUser:null,user:null}),u(s);Object.assign(s,{authUser:_}),o.user.findById(_.uid).then(b=>{Object.assign(s,{user:b}),u(s)}).catch(b=>{console.error(b),Object.assign(s,{authUser:null,user:null}),u(s)})}),signIn:(u,_)=>ms(i,u,_),signOut:()=>bs(i),sendPasswordResetEmail:u=>gs(i,u)},firebaseApp:r}};k.createApp=da,k.formatCurrency=aa,k.formatDate=Bn,k.formatDateTime=na,k.formatMonth=ia,k.formatTime=Vn,k.getAgeAt=sa,k.loadFromLocalStorage=la,k.parseCurrency=ca,Object.defineProperty(k,Symbol.toStringTag,{value:"Module"})});
|