ozmoz 0.1.41 → 0.1.44
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +52 -51
- package/dist/index.js +1 -1
- package/dist/ozmoz.iife.js +1 -1
- package/index.d.ts +6 -0
- package/package.json +1 -1
- package/scripts/setup-lib.cjs +1 -1
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var Qo=Object.defineProperty;var F=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var ei=(t,e)=>{for(var n in e)Qo(t,n,{get:e[n],enumerable:!0})};var ti,ni=F(()=>{ti=()=>{}});function na(){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.")}function S(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function ai(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(S())}function ci(){return typeof window<"u"||Tn()}function Tn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function li(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function ui(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function di(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function hi(){let t=S();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function fi(){try{return typeof indexedDB=="object"}catch{return!1}}function pi(){return new Promise((t,e)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}function aa(t,e){return t.replace(ca,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}function mi(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function ie(t,e){if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);for(let i of n){if(!r.includes(i))return!1;let s=t[i],a=e[i];if(ri(s)&&ri(a)){if(!ie(s,a))return!1}else if(s!==a)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function ri(t){return t!==null&&typeof t=="object"}function de(t){let e=[];for(let[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Ae(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Se(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function gi(t,e){let n=new yn(t,e);return n.subscribe.bind(n)}function la(t,e){if(typeof t!="object"||t===null)return!1;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function _n(){}function p(t){return t&&t._delegate?t._delegate:t}function pt(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function _i(t){return(await fetch(t,{credentials:"include"})).ok}var ii,ea,si,In,ta,En,He,ra,ia,sa,bn,oi,ft,wn,ve,oa,M,q,ca,yn,zu,ke=F(()=>{ni();ii=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},ea=function(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=t[n++],a=t[n++],c=t[n++],l=((i&7)<<18|(s&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{let s=t[n++],a=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},si={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){let s=t[i],a=i+1<t.length,c=a?t[i+1]:0,l=i+2<t.length,o=l?t[i+2]:0,d=s>>2,f=(s&3)<<4|c>>4,h=(c&15)<<2|o>>6,g=o&63;l||(g=64,a||(h=64)),r.push(n[d],n[f],n[h],n[g])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(ii(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):ea(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){let s=n[t.charAt(i++)],c=i<t.length?n[t.charAt(i)]:0;++i;let o=i<t.length?n[t.charAt(i)]:64;++i;let f=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||c==null||o==null||f==null)throw new In;let h=s<<2|c>>4;if(r.push(h),o!==64){let g=c<<4&240|o>>2;if(r.push(g),f!==64){let v=o<<6&192|f;r.push(v)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},In=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},ta=function(t){let e=ii(t);return si.encodeByteArray(e,!0)},En=function(t){return ta(t).replace(/\./g,"")},He=function(t){try{return si.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};ra=()=>na().__FIREBASE_DEFAULTS__,ia=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},sa=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&He(t[1]);return e&&JSON.parse(e)},bn=()=>{try{return ti()||ra()||ia()||sa()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},oi=t=>bn()?.emulatorHosts?.[t],ft=()=>bn()?.config,wn=t=>bn()?.[`_${t}`];ve=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}};oa="FirebaseError",M=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=oa,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,q.prototype.create)}},q=class{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){let r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],a=s?aa(s,r):"Error",c=`${this.serviceName}: ${a} (${i}).`;return new M(i,c,r)}};ca=/\{\$([^}]+)}/g;yn=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");la(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=_n),i.error===void 0&&(i.error=_n),i.complete===void 0&&(i.complete=_n);let 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 n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(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}))}};zu=14400*1e3;});function ua(t){return t===he?void 0:t}function da(t){return t.instantiationMode==="EAGER"}var H,he,vn,Be,mt=F(()=>{ke();H=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,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}};he="[DEFAULT]";vn=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let r=new ve;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){let n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)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(da(e))try{this.getOrInitializeService({instanceIdentifier:he})}catch{}for(let[n,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=he){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=he){return this.instances.has(e)}getOptions(e=he){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=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`);let i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(let[s,a]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);r===c&&a.resolve(i)}return i}onInit(e,n){let r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){let r=this.onInitCallbacks.get(n);if(r)for(let i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:ua(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=he){return this.component?this.component.multipleInstances?e:he:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};Be=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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);let n=new vn(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}});function yi(t){An.forEach(e=>{e.setLogLevel(t)})}function Ei(t,e){for(let n of An){let r=null;e&&e.level&&(r=Ii[e.level]),t===null?n.userLogHandler=null:n.userLogHandler=(i,s,...a)=>{let c=a.map(l=>{if(l==null)return null;if(typeof l=="string")return l;if(typeof l=="number"||typeof l=="boolean")return l.toString();if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return null}}).filter(l=>l).join(" ");s>=(r??i.logLevel)&&t({level:m[s].toLowerCase(),message:c,args:a,type:i.name})}}}var An,m,Ii,ha,fa,pa,Pe,gt=F(()=>{An=[];(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(m||(m={}));Ii={debug:m.DEBUG,verbose:m.VERBOSE,info:m.INFO,warn:m.WARN,error:m.ERROR,silent:m.SILENT},ha=m.INFO,fa={[m.DEBUG]:"log",[m.VERBOSE]:"log",[m.INFO]:"info",[m.WARN]:"warn",[m.ERROR]:"error"},pa=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=fa[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Pe=class{constructor(e){this.name=e,this._logLevel=ha,this._logHandler=pa,this._userLogHandler=null,An.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in m))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Ii[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,m.DEBUG,...e),this._logHandler(this,m.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,m.VERBOSE,...e),this._logHandler(this,m.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,m.INFO,...e),this._logHandler(this,m.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,m.WARN,...e),this._logHandler(this,m.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,m.ERROR,...e),this._logHandler(this,m.ERROR,...e)}}});function ga(){return bi||(bi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function _a(){return wi||(wi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function Ia(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(B(t.result)),i()},a=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",a)});return e.then(n=>{n instanceof IDBCursor&&Ti.set(n,t)}).catch(()=>{}),Rn.set(e,t),e}function ya(t){if(kn.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",a),t.removeEventListener("abort",a)},s=()=>{n(),i()},a=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",a),t.addEventListener("abort",a)});kn.set(t,e)}function Ai(t){Pn=t(Pn)}function Ea(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(_t(this),e,...n);return vi.set(r,e.sort?e.sort():[e]),B(r)}:_a().includes(t)?function(...e){return t.apply(_t(this),e),B(Ti.get(this))}:function(...e){return B(t.apply(_t(this),e))}}function ba(t){return typeof t=="function"?Ea(t):(t instanceof IDBTransaction&&ya(t),ma(t,ga())?new Proxy(t,Pn):t)}function B(t){if(t instanceof IDBRequest)return Ia(t);if(Sn.has(t))return Sn.get(t);let e=ba(t);return e!==t&&(Sn.set(t,e),Rn.set(e,t)),e}var ma,bi,wi,Ti,kn,vi,Sn,Rn,Pn,_t,Cn=F(()=>{ma=(t,e)=>e.some(n=>t instanceof n);Ti=new WeakMap,kn=new WeakMap,vi=new WeakMap,Sn=new WeakMap,Rn=new WeakMap;Pn={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return kn.get(t);if(e==="objectStoreNames")return t.objectStoreNames||vi.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return B(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};_t=t=>Rn.get(t)});function ki(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let a=indexedDB.open(t,e),c=B(a);return r&&a.addEventListener("upgradeneeded",l=>{r(B(a.result),l.oldVersion,l.newVersion,B(a.transaction),l)}),n&&a.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",o=>i(o.oldVersion,o.newVersion,o))}).catch(()=>{}),c}function Si(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(On.get(e))return On.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=Ta.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||wa.includes(n)))return;let s=async function(a,...c){let l=this.transaction(a,i?"readwrite":"readonly"),o=l.store;return r&&(o=o.index(c.shift())),(await Promise.all([o[n](...c),i&&l.done]))[0]};return On.set(e,s),s}var wa,Ta,On,Pi=F(()=>{Cn();Cn();wa=["get","getKey","getAll","getAllKeys","count"],Ta=["put","add","delete","clear"],On=new Map;Ai(t=>({...t,get:(e,n,r)=>Si(e,n)||t.get(e,n,r),has:(e,n)=>!!Si(e,n)||t.has(e,n)}))});function va(t){return t.getComponent()?.type==="VERSION"}function Mn(t,e){try{t.container.addComponent(e)}catch(n){K.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function Qa(t,e){t.container.addOrOverwriteComponent(e)}function fe(t){let e=t.name;if(Ce.has(e))return K.debug(`There were multiple attempts to register component ${e}.`),!1;Ce.set(e,t);for(let n of se.values())Mn(n,t);for(let n of Re.values())Mn(n,t);return!0}function je(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function ec(t,e,n=ze){je(t,e).clearInstance(n)}function Vn(t){return t.options!==void 0}function Di(t){return Vn(t)?!1:"authIdToken"in t||"appCheckToken"in t||"releaseOnDeref"in t||"automaticDataCollectionEnabled"in t}function y(t){return t==null?!1:t.settings!==void 0}function tc(){Ce.clear()}function Ri(t,e){let n=He(t.split(".")[1]);if(n===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(n).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let i=JSON.parse(n).exp*1e3,s=new Date().getTime();i-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function Li(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:ze,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw C.create("bad-app-name",{appName:String(i)});if(n||(n=ft()),!n)throw C.create("no-options");let s=se.get(i);if(s){if(ie(n,s.options)&&ie(r,s.config))return s;throw C.create("duplicate-app",{appName:i})}let a=new Be(i);for(let l of Ce.values())a.addComponent(l);let c=new yt(n,r,a);return se.set(i,c),c}function rc(t,e={}){if(ci()&&!Tn())throw C.create("invalid-server-app-environment");let n,r=e||{};if(t&&(Vn(t)?n=t.options:Di(t)?r=t:n=t),r.automaticDataCollectionEnabled===void 0&&(r.automaticDataCollectionEnabled=!0),n||(n=ft()),!n)throw C.create("no-options");let i={...r,...n};i.releaseOnDeref!==void 0&&delete i.releaseOnDeref;let s=d=>[...d].reduce((f,h)=>Math.imul(31,f)+h.charCodeAt(0)|0,0);if(r.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw C.create("finalization-registry-not-supported",{});let a=""+s(JSON.stringify(i)),c=Re.get(a);if(c)return c.incRefCount(r.releaseOnDeref),c;let l=new Be(a);for(let d of Ce.values())l.addComponent(d);let o=new Un(n,r,a,l);return Re.set(a,o),o}function Wn(t=ze){let e=se.get(t);if(!e&&t===ze&&ft())return Li();if(!e)throw C.create("no-app",{appName:t});return e}function ic(){return Array.from(se.values())}async function Mi(t){let e=!1,n=t.name;se.has(n)?(e=!0,se.delete(n)):Re.has(n)&&t.decRefCount()<=0&&(Re.delete(n),e=!0),e&&(await Promise.all(t.container.getProviders().map(r=>r.delete())),t.isDeleted=!0)}function z(t,e,n){let r=Za[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),K.warn(a.join(" "));return}fe(new H(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}function sc(t,e){if(t!==null&&typeof t!="function")throw C.create("invalid-log-argument");Ei(t,e)}function oc(t){yi(t)}function Ui(){return Nn||(Nn=ki(ac,cc,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore($e)}catch(n){console.warn(n)}}}}).catch(t=>{throw C.create("idb-open",{originalErrorMessage:t.message})})),Nn}async function lc(t){try{let n=(await Ui()).transaction($e),r=await n.objectStore($e).get(Fi(t));return await n.done,r}catch(e){if(e instanceof M)K.warn(e.message);else{let n=C.create("idb-get",{originalErrorMessage:e?.message});K.warn(n.message)}}}async function Ci(t,e){try{let r=(await Ui()).transaction($e,"readwrite");await r.objectStore($e).put(e,Fi(t)),await r.done}catch(n){if(n instanceof M)K.warn(n.message);else{let r=C.create("idb-set",{originalErrorMessage:n?.message});K.warn(r.message)}}}function Fi(t){return`${t.name}!${t.options.appId}`}function Oi(){return new Date().toISOString().substring(0,10)}function hc(t,e=uc){let n=[],r=t.slice();for(let i of t){let s=n.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),Ni(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Ni(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}function Ni(t){return En(JSON.stringify({version:2,heartbeats:t})).length}function fc(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function pc(t){fe(new H("platform-logger",e=>new Dn(e),"PRIVATE")),fe(new H("heartbeat",e=>new Fn(e),"PRIVATE")),z(It,Ln,t),z(It,Ln,"esm2020"),z("fire-js","")}var Dn,It,Ln,K,Aa,Sa,ka,Pa,Ra,Ca,Oa,Na,Da,La,Ma,Ua,Fa,xa,Va,Wa,Ha,Ba,za,$a,ja,Ga,qa,Ka,Ja,Ya,Xa,ze,Za,se,Re,Ce,nc,C,yt,Un,pe,ac,cc,$e,Nn,uc,dc,Fn,xn,Ge=F(()=>{mt();gt();ke();ke();Pi();Dn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(va(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};It="@firebase/app",Ln="0.15.1";K=new Pe("@firebase/app"),Aa="@firebase/app-compat",Sa="@firebase/analytics-compat",ka="@firebase/analytics",Pa="@firebase/app-check-compat",Ra="@firebase/app-check",Ca="@firebase/auth",Oa="@firebase/auth-compat",Na="@firebase/database",Da="@firebase/data-connect",La="@firebase/database-compat",Ma="@firebase/functions",Ua="@firebase/functions-compat",Fa="@firebase/installations",xa="@firebase/installations-compat",Va="@firebase/messaging",Wa="@firebase/messaging-compat",Ha="@firebase/performance",Ba="@firebase/performance-compat",za="@firebase/remote-config",$a="@firebase/remote-config-compat",ja="@firebase/storage",Ga="@firebase/storage-compat",qa="@firebase/firestore",Ka="@firebase/ai",Ja="@firebase/firestore-compat",Ya="firebase",Xa="12.16.0";ze="[DEFAULT]",Za={[It]:"fire-core",[Aa]:"fire-core-compat",[ka]:"fire-analytics",[Sa]:"fire-analytics-compat",[Ra]:"fire-app-check",[Pa]:"fire-app-check-compat",[Ca]:"fire-auth",[Oa]:"fire-auth-compat",[Na]:"fire-rtdb",[Da]:"fire-data-connect",[La]:"fire-rtdb-compat",[Ma]:"fire-fn",[Ua]:"fire-fn-compat",[Fa]:"fire-iid",[xa]:"fire-iid-compat",[Va]:"fire-fcm",[Wa]:"fire-fcm-compat",[Ha]:"fire-perf",[Ba]:"fire-perf-compat",[za]:"fire-rc",[$a]:"fire-rc-compat",[ja]:"fire-gcs",[Ga]:"fire-gcs-compat",[qa]:"fire-fst",[Ja]:"fire-fst-compat",[Ka]:"fire-vertex","fire-js":"fire-js",[Ya]:"fire-js-all"};se=new Map,Re=new Map,Ce=new Map;nc={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},C=new q("app","Firebase",nc);yt=class{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new H("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 C.create("app-deleted",{appName:this._name})}};Un=class extends yt{constructor(e,n,r,i){let s=n.automaticDataCollectionEnabled!==void 0?n.automaticDataCollectionEnabled:!0,a={name:r,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,a,i);else{let c=e;super(c.options,a,i)}this._serverConfig={automaticDataCollectionEnabled:s,...n},this._serverConfig.authIdToken&&Ri(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&Ri(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,n.releaseOnDeref=void 0,z(It,Ln,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){Mi(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw C.create("server-app-deleted")}};pe=Xa;ac="firebase-heartbeat-database",cc=1,$e="firebase-heartbeat-store",Nn=null;uc=1024,dc=30,Fn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new xn(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Oi();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>dc){let i=fc(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){K.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Oi(),{heartbeatsToSend:n,unsentEntries:r}=hc(this._heartbeatsCache.heartbeats),i=En(JSON.stringify({version:2,heartbeats:n}));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}catch(e){return K.warn(e),""}}};xn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return fi()?pi().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await lc(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Ci(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Ci(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};pc("")});var xi={};ei(xi,{FirebaseError:()=>M,SDK_VERSION:()=>pe,_DEFAULT_ENTRY_NAME:()=>ze,_addComponent:()=>Mn,_addOrOverwriteComponent:()=>Qa,_apps:()=>se,_clearComponents:()=>tc,_components:()=>Ce,_getProvider:()=>je,_isFirebaseApp:()=>Vn,_isFirebaseServerApp:()=>y,_isFirebaseServerAppSettings:()=>Di,_registerComponent:()=>fe,_removeServiceInstance:()=>ec,_serverApps:()=>Re,deleteApp:()=>Mi,getApp:()=>Wn,getApps:()=>ic,initializeApp:()=>Li,initializeServerApp:()=>rc,onLog:()=>sc,registerVersion:()=>z,setLogLevel:()=>oc});var mc,gc,Vi=F(()=>{Ge();Ge();mc="firebase",gc="12.16.0";z(mc,gc,"app")});function _c(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}function ds(){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."}}function Ic(t,...e){St.logLevel<=m.WARN&&St.warn(`Auth (${pe}): ${t}`,...e)}function wt(t,...e){St.logLevel<=m.ERROR&&St.error(`Auth (${pe}): ${t}`,...e)}function R(t,...e){throw wr(t,...e)}function k(t,...e){return wr(t,...e)}function br(t,e,n){let r={...Er(),[e]:n};return new q("auth","Firebase",r).create(e,{appName:t.name})}function A(t){return br(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function xe(t,e,n){let r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&R(t,"argument-error"),br(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function wr(t,...e){if(typeof t!="string"){let n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return fs.create(t,...e)}function u(t,e,...n){if(!t)throw wr(e,...n)}function $(t){let e="INTERNAL ASSERTION FAILED: "+t;throw wt(e),new Error(e)}function X(t,e){t||$(e)}function Qe(){return typeof self<"u"&&self.location?.href||""}function Tr(){return Wi()==="http:"||Wi()==="https:"}function Wi(){return typeof self<"u"&&self.location?.protocol||null}function yc(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Tr()||ui()||"connection"in navigator)?navigator.onLine:!0}function Ec(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}function vr(t,e){X(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}function _(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function I(t,e,n,r,i={}){return ms(t,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});let c=de({...a,key:t.config.apiKey}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);let o={method:e,headers:l,...s};return li()||(o.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&pt(t.emulatorConfig.host)&&(o.credentials="include"),kt.fetch()(await gs(t,t.config.apiHost,n,c),o)})}async function ms(t,e,n){t._canInitEmulator=!1;let r={...bc,...e};try{let i=new Kn(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let a=await s.json();if("needConfirmation"in a)throw Ke(t,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{let c=s.ok?a.errorMessage:a.error.message,[l,o]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Ke(t,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw Ke(t,"email-already-in-use",a);if(l==="USER_DISABLED")throw Ke(t,"user-disabled",a);let d=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw br(t,d,o);R(t,d)}}catch(i){if(i instanceof M)throw i;R(t,"network-request-failed",{message:String(i)})}}async function te(t,e,n,r,i={}){let s=await I(t,e,n,r,i);return"mfaPendingCredential"in s&&R(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function gs(t,e,n,r){let i=`${e}${n}?${r}`,s=t,a=s.config.emulator?vr(t.config,i):`${t.config.apiScheme}://${i}`;return wc.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(a).toString():a}function vc(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function Ke(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=k(t,e,r);return i.customData._tokenResponse=n,i}function Hi(t){return t!==void 0&&t.getResponse!==void 0}function Bi(t){return t!==void 0&&t.enterprise!==void 0}async function Ac(t){return(await I(t,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function _s(t,e){return I(t,"GET","/v2/recaptchaConfig",_(t,e))}async function Sc(t,e){return I(t,"POST","/v1/accounts:delete",e)}async function kc(t,e){return I(t,"POST","/v1/accounts:update",e)}async function Rt(t,e){return I(t,"POST","/v1/accounts:lookup",e)}function Je(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function Is(t,e=!1){return p(t).getIdToken(e)}async function Ar(t,e=!1){let n=p(t),r=await n.getIdToken(e),i=Zt(r);u(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:r,authTime:Je(Hn(i.auth_time)),issuedAtTime:Je(Hn(i.iat)),expirationTime:Je(Hn(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Hn(t){return Number(t)*1e3}function Zt(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return wt("JWT malformed, contained fewer than 3 sections"),null;try{let i=He(n);return i?JSON.parse(i):(wt("Failed to decode base64 JWT payload"),null)}catch(i){return wt("Caught error parsing JWT payload as JSON",i?.toString()),null}}function zi(t){let e=Zt(t);return u(e,"internal-error"),u(typeof e.exp<"u","internal-error"),u(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function Z(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof M&&Pc(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function Pc({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}async function tt(t){let e=t.auth,n=await t.getIdToken(),r=await Z(t,Rt(e,{idToken:n}));u(r?.users.length,e,"internal-error");let i=r.users[0];t._notifyReloadListener(i);let s=i.providerUserInfo?.length?ys(i.providerUserInfo):[],a=Rc(t.providerData,s),c=t.isAnonymous,l=!(t.email&&i.passwordHash)&&!a?.length,o=c?l:!1,d={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new et(i.createdAt,i.lastLoginAt),isAnonymous:o};Object.assign(t,d)}async function Sr(t){let e=p(t);await tt(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Rc(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function ys(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}async function Cc(t,e){let n=await ms(t,{},async()=>{let r=de({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,a=await gs(t,i,"/v1/token",`key=${s}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:r};return t.emulatorConfig&&pt(t.emulatorConfig.host)&&(l.credentials="include"),kt.fetch()(a,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function Oc(t,e){return I(t,"POST","/v2/accounts:revokeToken",_(t,e))}function oe(t,e){u(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}function J(t){X(t instanceof Function,"Expected a class definition");let e=$i.get(t);return e?(X(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,$i.set(t,e),e)}function Tt(t,e,n){return`firebase:${t}:${e}:${n}`}function ji(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Ts(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Es(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(As(e))return"Blackberry";if(Ss(e))return"Webos";if(bs(e))return"Safari";if((e.includes("chrome/")||ws(e))&&!e.includes("edge/"))return"Chrome";if(vs(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function Es(t=S()){return/firefox\//i.test(t)}function bs(t=S()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function ws(t=S()){return/crios\//i.test(t)}function Ts(t=S()){return/iemobile/i.test(t)}function vs(t=S()){return/android/i.test(t)}function As(t=S()){return/blackberry/i.test(t)}function Ss(t=S()){return/webos/i.test(t)}function kr(t=S()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function Nc(t=S()){return kr(t)&&!!window.navigator?.standalone}function Dc(){return hi()&&document.documentMode===10}function ks(t=S()){return kr(t)||vs(t)||Ss(t)||As(t)||/windows phone/i.test(t)||Ts(t)}function Ps(t,e=[]){let n;switch(t){case"Browser":n=ji(S());break;case"Worker":n=`${ji(S())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${pe}/${r}`}async function Lc(t,e={}){return I(t,"GET","/v2/passwordPolicy",_(t,e))}function E(t){return p(t)}function Uc(t){ct=t}function Pr(t){return ct.loadJS(t)}function Fc(){return ct.recaptchaV2Script}function xc(){return ct.recaptchaEnterpriseScript}function Vc(){return ct.gapiScript}function Rs(t){return`__${t}${Math.floor(Math.random()*1e6)}`}function Bc(t){let e=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<t;r++)e.push(n.charAt(Math.floor(Math.random()*n.length)));return e.join("")}async function qe(t,e,n,r=!1,i=!1){let s=new nt(t),a;if(i)a=Xe;else try{a=await s.verify(n)}catch{a=await s.verify(n,!0)}let c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,o=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:o,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ce(t,e,n,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await qe(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let a=await qe(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await qe(t,e,n);return r(t,s).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);let c=await qe(t,e,n,!1,!0);return r(t,c)}return Promise.reject(a)})}else{let s=await qe(t,e,n,!1,!0);return r(t,s)}else return Promise.reject(i+" provider is not supported.")}async function Cs(t){let e=E(t),n=await _s(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new Pt(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new nt(e).verify()}function Rr(t,e){let n=je(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(ie(s,e??{}))return i;R(i,"already-initialized")}return n.initialize({options:e})}function $c(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(J);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function Cr(t,e,n){let r=E(t);u(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Os(e),{host:a,port:c}=jc(e),l=c===null?"":`:${c}`,o={url:`${s}//${a}${l}/`},d=Object.freeze({host:a,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){u(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),u(ie(o,r.config.emulator)&&ie(d,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=o,r.emulatorConfig=d,r.settings.appVerificationDisabledForTesting=!0,pt(a)?_i(`${s}//${a}${l}`):i||Gc()}function Os(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function jc(t){let e=Os(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};let r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let s=i[1];return{host:s,port:qi(r.substr(s.length+1))}}else{let[s,a]=r.split(":");return{host:s,port:qi(a)}}}function qi(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function Gc(){function t(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.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",t):t())}async function Ns(t,e){return I(t,"POST","/v1/accounts:resetPassword",_(t,e))}async function qc(t,e){return I(t,"POST","/v1/accounts:update",e)}async function Kc(t,e){return I(t,"POST","/v1/accounts:signUp",e)}async function Jc(t,e){return I(t,"POST","/v1/accounts:update",_(t,e))}async function Yc(t,e){return te(t,"POST","/v1/accounts:signInWithPassword",_(t,e))}async function Qt(t,e){return I(t,"POST","/v1/accounts:sendOobCode",_(t,e))}async function Xc(t,e){return Qt(t,e)}async function Zc(t,e){return Qt(t,e)}async function Qc(t,e){return Qt(t,e)}async function el(t,e){return Qt(t,e)}async function tl(t,e){return te(t,"POST","/v1/accounts:signInWithEmailLink",_(t,e))}async function nl(t,e){return te(t,"POST","/v1/accounts:signInWithEmailLink",_(t,e))}async function Y(t,e){return te(t,"POST","/v1/accounts:signInWithIdp",_(t,e))}async function Ki(t,e){return I(t,"POST","/v1/accounts:sendVerificationCode",_(t,e))}async function il(t,e){return te(t,"POST","/v1/accounts:signInWithPhoneNumber",_(t,e))}async function sl(t,e){let n=await te(t,"POST","/v1/accounts:signInWithPhoneNumber",_(t,e));if(n.temporaryProof)throw Ke(t,"account-exists-with-different-credential",n);return n}async function al(t,e){let n={...e,operation:"REAUTH"};return te(t,"POST","/v1/accounts:signInWithPhoneNumber",_(t,n),ol)}function cl(t){switch(t){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 ll(t){let e=Ae(Se(t)).link,n=e?Ae(Se(e)).deep_link_id:null,r=Ae(Se(t)).deep_link_id;return(r?Ae(Se(r)).link:null)||r||n||e||t}function Ds(t){return _e.parseLink(t)}async function Ls(t,e){return te(t,"POST","/v1/accounts:signUp",_(t,e))}function Ji(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}async function Ms(t){if(y(t.app))return Promise.reject(A(t));let e=E(t);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new V({user:e.currentUser,providerId:null,operationType:"signIn"});let n=await Ls(e,{returnSecureToken:!0}),r=await V._fromIdTokenResponse(e,"signIn",n,!0);return await e._updateCurrentUser(r.user),r}function Us(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?rr._fromErrorAndOperation(t,s,e,r):s})}function Fs(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}async function xs(t,e){let n=p(t);await en(!0,n,e);let{providerUserInfo:r}=await kc(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),i=Fs(r||[]);return n.providerData=n.providerData.filter(s=>i.has(s.providerId)),i.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function Or(t,e,n=!1){let r=await Z(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return V._forOperation(t,"link",r)}async function en(t,e,n){await tt(e);let r=Fs(e.providerData),i=t===!1?"provider-already-linked":"no-such-provider";u(r.has(n)===t,e.auth,i)}async function Vs(t,e,n=!1){let{auth:r}=t;if(y(r.app))return Promise.reject(A(r));let i="reauthenticate";try{let s=await Z(t,Us(r,i,e,t),n);u(s.idToken,r,"internal-error");let a=Zt(s.idToken);u(a,r,"internal-error");let{sub:c}=a;return u(t.uid===c,r,"user-mismatch"),V._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&R(r,"user-mismatch"),s}}async function Ws(t,e,n=!1){if(y(t.app))return Promise.reject(A(t));let r="signIn",i=await Us(t,r,e),s=await V._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function lt(t,e){return Ws(E(t),e)}async function Nr(t,e){let n=p(t);return await en(!1,n,e.providerId),Or(n,e)}async function Dr(t,e){return Vs(p(t),e)}async function hl(t,e){return te(t,"POST","/v1/accounts:signInWithCustomToken",_(t,e))}async function Hs(t,e){if(y(t.app))return Promise.reject(A(t));let n=E(t),r=await hl(n,{token:e,returnSecureToken:!0}),i=await V._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(i.user),i}function tn(t,e,n){u(n.url?.length>0,t,"invalid-continue-uri"),u(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),u(typeof n.linkDomain>"u"||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(u(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(u(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Lr(t){let e=E(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function Bs(t,e,n){let r=E(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&tn(r,i,n),await ce(r,i,"getOobCode",Zc,"EMAIL_PASSWORD_PROVIDER")}async function zs(t,e,n){await Ns(p(t),{oobCode:e,newPassword:n}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Lr(t),r})}async function $s(t,e){await Jc(p(t),{oobCode:e})}async function Mr(t,e){let n=p(t),r=await Ns(n,{oobCode:e}),i=r.requestType;switch(u(i,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":u(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":u(r.mfaInfo,n,"internal-error");default:u(r.email,n,"internal-error")}let s=null;return r.mfaInfo&&(s=Ie._fromServerResponse(E(n),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:s},operation:i}}async function js(t,e){let{data:n}=await Mr(p(t),e);return n.email}async function Gs(t,e,n){if(y(t.app))return Promise.reject(A(t));let r=E(t),a=await ce(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Ls,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&Lr(t),l}),c=await V._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(c.user),c}function qs(t,e,n){return y(t.app)?Promise.reject(A(t)):lt(p(t),ee.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Lr(t),r})}async function Ks(t,e,n){let r=E(t),i={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(a,c){u(c.handleCodeInApp,r,"argument-error"),c&&tn(r,a,c)}s(i,n),await ce(r,i,"getOobCode",Qc,"EMAIL_PASSWORD_PROVIDER")}function Js(t,e){return _e.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function Ys(t,e,n){if(y(t.app))return Promise.reject(A(t));let r=p(t),i=ee.credentialWithLink(e,n||Qe());return u(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),lt(r,i)}async function fl(t,e){return I(t,"POST","/v1/accounts:createAuthUri",_(t,e))}async function Xs(t,e){let n=Tr()?Qe():"http://localhost",r={identifier:e,continueUri:n},{signinMethods:i}=await fl(p(t),r);return i||[]}async function Zs(t,e){let n=p(t),i={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&tn(n.auth,i,e);let{email:s}=await Xc(n.auth,i);s!==t.email&&await t.reload()}async function Qs(t,e,n){let r=p(t),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&tn(r.auth,s,n);let{email:a}=await el(r.auth,s);a!==t.email&&await t.reload()}async function pl(t,e){return I(t,"POST","/v1/accounts:update",e)}async function eo(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;let r=p(t),s={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},a=await Z(r,pl(r.auth,s));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;let c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function to(t,e){let n=p(t);return y(n.auth.app)?Promise.reject(A(n.auth)):ro(n,e,null)}function no(t,e){return ro(p(t),null,e)}async function ro(t,e,n){let{auth:r}=t,s={idToken:await t.getIdToken(),returnSecureToken:!0};e&&(s.email=e),n&&(s.password=n);let a=await Z(t,qc(r,s));await t._updateTokensIfNecessary(a,!0)}function ml(t){if(!t)return null;let{providerId:e}=t,n=t.rawUserInfo?JSON.parse(t.rawUserInfo):{},r=t.isNewUser||t.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&t?.idToken){let i=Zt(t.idToken)?.firebase?.sign_in_provider;if(i){let s=i!=="anonymous"&&i!=="custom"?i:null;return new le(r,s)}}if(!e)return null;switch(e){case"facebook.com":return new or(r,n);case"github.com":return new ar(r,n);case"google.com":return new cr(r,n);case"twitter.com":return new lr(r,n,t.screenName||null);case"custom":case"anonymous":return new le(r,null);default:return new le(r,e,n)}}function io(t){let{user:e,_tokenResponse:n}=t;return e.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:ml(n)}function so(t,e){return p(t).setPersistence(e)}function oo(t){return Cs(t)}async function ao(t,e){return E(t).validatePassword(e)}function Ur(t,e,n,r){return p(t).onIdTokenChanged(e,n,r)}function Fr(t,e,n){return p(t).beforeAuthStateChanged(e,n)}function co(t,e,n,r){return p(t).onAuthStateChanged(e,n,r)}function lo(t){p(t).useDeviceLanguage()}function uo(t,e){return p(t).updateCurrentUser(e)}function ho(t){return p(t).signOut()}function fo(t,e){return E(t).revokeAccessToken(e)}async function po(t){return p(t).delete()}function mo(t,e){let n=p(t),r=e;return u(e.customData.operationType,n,"argument-error"),u(r.customData._serverResponse?.mfaPendingCredential,n,"argument-error"),ur._fromError(n,r)}function Yi(t,e){return I(t,"POST","/v2/accounts/mfaEnrollment:start",_(t,e))}function gl(t,e){return I(t,"POST","/v2/accounts/mfaEnrollment:finalize",_(t,e))}function _l(t,e){return I(t,"POST","/v2/accounts/mfaEnrollment:start",_(t,e))}function Il(t,e){return I(t,"POST","/v2/accounts/mfaEnrollment:finalize",_(t,e))}function yl(t,e){return I(t,"POST","/v2/accounts/mfaEnrollment:withdraw",_(t,e))}function go(t){let e=p(t);return Bn.has(e)||Bn.set(e,dr._fromUser(e)),Bn.get(e)}function zn(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${e}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function $n(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}function Tl(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}function rn(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}function b(){return window}function vl(t){b().location.href=t}function Vr(){return typeof b().WorkerGlobalScope<"u"&&typeof b().importScripts=="function"}async function Al(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Sl(){return navigator?.serviceWorker?.controller||null}function kl(){return Vr()?self:null}function sn(t,e){return t.transaction([jt],e?"readwrite":"readonly").objectStore(jt)}function Rl(){let t=indexedDB.deleteDatabase(Io);return new ye(t).toPromise()}function Eo(){let t=indexedDB.open(Io,Pl);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(jt,{keyPath:yo})}catch(i){n(i)}}),t.addEventListener("success",async()=>{let r=t.result;r.objectStoreNames.contains(jt)?e(r):(r.close(),await Rl(),e(await Eo()))})})}async function Xi(t,e,n){let r=sn(t,!0).put({[yo]:e,value:n});return new ye(r).toPromise()}async function Cl(t,e){let n=sn(t,!1).get(e),r=await new ye(n).toPromise();return r===void 0?null:r.value}function Zi(t,e){let n=sn(t,!0).delete(e);return new ye(n).toPromise()}function Qi(t,e){return I(t,"POST","/v2/accounts/mfaSignIn:start",_(t,e))}function Dl(t,e){return I(t,"POST","/v2/accounts/mfaSignIn:finalize",_(t,e))}function Ll(t,e){return I(t,"POST","/v2/accounts/mfaSignIn:finalize",_(t,e))}function Ul(t){return t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t)}function xl(){let t=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}t=()=>e(),window.addEventListener("load",t)}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}async function bo(t,e,n){if(y(t.app))return Promise.reject(A(t));let r=E(t),i=await on(r,e,p(n));return new rt(i,s=>lt(r,s))}async function wo(t,e,n){let r=p(t);await en(!1,r,"phone");let i=await on(r.auth,e,p(n));return new rt(i,s=>Nr(r,s))}async function To(t,e,n){let r=p(t);if(y(r.auth.app))return Promise.reject(A(r.auth));let i=await on(r.auth,e,p(n));return new rt(i,s=>Dr(r,s))}async function on(t,e,n){if(!t._getRecaptchaConfig())try{await Cs(t)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){let i=r.session;if("phoneNumber"in r){u(i.type==="enroll",t,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ce(t,s,"mfaSmsEnrollment",async(o,d)=>{if(d.phoneEnrollmentInfo.captchaResponse===Xe){u(n?.type===Ze,o,"argument-error");let f=await Gn(o,d,n);return Yi(o,f)}return Yi(o,d)},"PHONE_PROVIDER").catch(o=>Promise.reject(o))).phoneSessionInfo.sessionInfo}else{u(i.type==="signin",t,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;u(s,t,"missing-multi-factor-info");let a={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ce(t,a,"mfaSmsSignIn",async(d,f)=>{if(f.phoneSignInInfo.captchaResponse===Xe){u(n?.type===Ze,d,"argument-error");let h=await Gn(d,f,n);return Qi(d,h)}return Qi(d,f)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ce(t,i,"sendVerificationCode",async(l,o)=>{if(o.captchaResponse===Xe){u(n?.type===Ze,l,"argument-error");let d=await Gn(l,o,n);return Ki(l,d)}return Ki(l,o)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{n?._reset()}}async function vo(t,e){let n=p(t);if(y(n.auth.app))return Promise.reject(A(n.auth));await Or(n,e)}async function Gn(t,e,n){u(n.type===Ze,t,"argument-error");let r=await n.verify();u(typeof r=="string",t,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,a=i.phoneEnrollmentInfo.captchaResponse,c=i.phoneEnrollmentInfo.clientType,l=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:a,clientType:c,recaptchaVersion:l}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,a=i.phoneSignInInfo.clientType,c=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:a,recaptchaVersion:c}}),i}else return Object.assign(i,{recaptchaToken:r}),i}function Ee(t,e){return e?J(e):(u(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}function Vl(t){return Ws(t.auth,new it(t),t.bypassAuthState)}function Wl(t){let{auth:e,user:n}=t;return u(n,e,"internal-error"),Vs(n,new it(t),t.bypassAuthState)}async function Hl(t){let{auth:e,user:n}=t;return u(n,e,"internal-error"),Or(n,new it(t),t.bypassAuthState)}async function Ao(t,e,n){if(y(t.app))return Promise.reject(k(t,"operation-not-supported-in-this-environment"));let r=E(t);xe(t,e,x);let i=Ee(r,n);return new Fe(r,"signInViaPopup",e,i).executeNotNull()}async function So(t,e,n){let r=p(t);if(y(r.auth.app))return Promise.reject(k(r.auth,"operation-not-supported-in-this-environment"));xe(r.auth,e,x);let i=Ee(r.auth,n);return new Fe(r.auth,"reauthViaPopup",e,i,r).executeNotNull()}async function ko(t,e,n){let r=p(t);xe(r.auth,e,x);let i=Ee(r.auth,n);return new Fe(r.auth,"linkViaPopup",e,i,r).executeNotNull()}async function $l(t,e){let n=Ro(e),r=Po(t);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}async function Hr(t,e){return Po(t)._set(Ro(e),"true")}function jl(t,e){vt.set(t._key(),e)}function Po(t){return J(t._redirectPersistence)}function Ro(t){return Tt(zl,t.config.apiKey,t.name)}function Co(t,e,n){return Gl(t,e,n)}async function Gl(t,e,n){if(y(t.app))return Promise.reject(A(t));let r=E(t);xe(t,e,x),await r._initializationPromise;let i=Ee(r,n);return await Hr(i,r),i._openRedirect(r,e,"signInViaRedirect")}function Oo(t,e,n){return ql(t,e,n)}async function ql(t,e,n){let r=p(t);if(xe(r.auth,e,x),y(r.auth.app))return Promise.reject(A(r.auth));await r.auth._initializationPromise;let i=Ee(r.auth,n);await Hr(i,r.auth);let s=await Mo(r);return i._openRedirect(r.auth,e,"reauthViaRedirect",s)}function No(t,e,n){return Kl(t,e,n)}async function Kl(t,e,n){let r=p(t);xe(r.auth,e,x),await r.auth._initializationPromise;let i=Ee(r.auth,n);await en(!1,r,e.providerId),await Hr(i,r.auth);let s=await Mo(r);return i._openRedirect(r.auth,e,"linkViaRedirect",s)}async function Do(t,e){return await E(t)._initializationPromise,Lo(t,e,!1)}async function Lo(t,e,n=!1){if(y(t.app))return Promise.reject(A(t));let r=E(t),i=Ee(r,e),a=await new mr(r,i,n).execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}async function Mo(t){let e=rn(`${t.uid}:::`);return t._redirectEventId=e,await t.auth._setRedirectUser(t),await t.auth._persistUserIfCurrent(t),e}function es(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function Uo({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function Yl(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return Uo(t);default:return!1}}async function Xl(t,e={}){return I(t,"GET","/v1/projects",e)}async function eu(t){if(t.config.emulator)return;let{authorizedDomains:e}=await Xl(t);for(let n of e)try{if(tu(n))return}catch{}R(t,"unauthorized-domain")}function tu(t){let e=Qe(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){let a=new URL(t);return a.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&a.hostname===r}if(!Ql.test(n))return!1;if(Zl.test(t))return r===t;let i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}function ts(){let t=b().___jsl;if(t?.H){for(let e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function ru(t){return new Promise((e,n)=>{function r(){ts(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{ts(),n(k(t,"network-request-failed"))},timeout:nu.get()})}if(b().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(b().gapi?.load)r();else{let i=Rs("iframefcb");return b()[i]=()=>{gapi.load?r():n(k(t,"network-request-failed"))},Pr(`${Vc()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw At=null,e})}function iu(t){return At=At||ru(t),At}function uu(t){let e=t.config;u(e.authDomain,t,"auth-domain-config-required");let n=e.emulator?vr(e,au):`https://${t.config.authDomain}/${ou}`,r={apiKey:e.apiKey,appName:t.name,v:pe},i=lu.get(t.config.apiHost);i&&(r.eid=i);let s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${de(r).slice(1)}`}async function du(t){let e=await iu(t),n=b().gapi;return u(n,t,"internal-error"),e.open({where:document.body,url:uu(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:cu,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let a=k(t,"network-request-failed"),c=b().setTimeout(()=>{s(a)},su.get());function l(){b().clearTimeout(c),i(r)}r.ping(l).then(l,()=>{s(a)})}))}function _u(t,e,n,r=fu,i=pu){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),c="",l={...hu,width:r.toString(),height:i.toString(),top:s,left:a},o=S().toLowerCase();n&&(c=ws(o)?mu:n),Es(o)&&(e=e||gu,l.scrollbars="yes");let d=Object.entries(l).reduce((h,[g,v])=>`${h}${g}=${v},`,"");if(Nc(o)&&c!=="_self")return Iu(e||"",c),new Jt(null);let f=window.open(e||"",c,d);u(f,t,"popup-blocked");try{f.focus()}catch{}return new Jt(f)}function Iu(t,e){let n=document.createElement("a");n.href=t,n.target=e;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}async function ns(t,e,n,r,i,s){u(t.config.authDomain,t,"auth-domain-config-required"),u(t.config.apiKey,t,"invalid-api-key");let a={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:pe,eventId:i};if(e instanceof x){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",mi(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,f]of Object.entries(s||{}))a[d]=f}if(e instanceof ue){let d=e.getScopes().filter(f=>f!=="");d.length>0&&(a.scopes=d.join(","))}t.tenantId&&(a.tid=t.tenantId);let c=a;for(let d of Object.keys(c))c[d]===void 0&&delete c[d];let l=await t._getAppCheckToken(),o=l?`#${bu}=${encodeURIComponent(l)}`:"";return`${wu(t)}?${de(c).slice(1)}${o}`}function wu({config:t}){return t.emulator?vr(t,Eu):`https://${t.authDomain}/${yu}`}function bt(t){return typeof t>"u"||t?.length===0}function Tu(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function vu(t){fe(new H("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;u(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});let l={apiKey:a,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:Ps(t)},o=new Zn(r,i,s,l);return $c(o,n),o},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),fe(new H("auth-internal",e=>{let n=E(e.getProvider("auth").getImmediate());return(r=>new yr(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),z(rs,is,Tu(t)),z(rs,is,"esm2020")}function Fo(t=Wn()){let e=je(t,"auth");if(e.isInitialized())return e.getImmediate();let n=Rr(t,{popupRedirectResolver:Br,persistence:[Wr,xr,nn]}),r=wn("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let a=ku(s.toString());Fr(n,a,()=>a(n.currentUser)),Ur(n,c=>a(c))}}let i=oi("auth");return i&&Cr(n,`http://${i}`),n}function Pu(){return document.getElementsByTagName("head")?.[0]??document}var os,as,cs,ls,us,hs,Er,fs,ps,St,me,kt,bc,wc,Tc,Kn,Pt,Jn,et,Ye,ae,$i,Ct,Ot,Nt,Yn,Mc,Xn,Zn,Dt,ct,Wc,Hc,Et,Qn,er,tr,nr,zc,Xe,Gi,nt,Q,Oe,rl,j,ol,ge,_e,ee,x,ue,Lt,Ne,De,Le,ul,Mt,dl,Ut,Me,V,rr,Ie,ir,sr,le,Ft,or,ar,cr,lr,xt,ur,dr,Bn,Vt,Wt,El,bl,Ht,xr,wl,Bt,_o,zt,nn,$t,hr,Io,Pl,jt,yo,ye,Ol,Nl,Gt,Wr,jn,Ml,fr,pr,Ze,Fl,qt,rt,Ue,it,Kt,Bl,Fe,zl,vt,mr,Jl,gr,Zl,Ql,nu,At,su,ou,au,cu,lu,hu,fu,pu,mu,gu,Jt,yu,Eu,bu,qn,_r,Br,Yt,Ir,st,ot,Xt,at,rs,is,yr,Au,Su,ss,ku,xo=F(()=>{Ge();ke();gt();mt();os={PHONE:"phone",TOTP:"totp"},as={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},cs={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},ls={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},us={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};hs=_c,Er=ds,fs=new q("auth","Firebase",ds()),ps={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};St=new Pe("@firebase/auth");me=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,X(n>e,"Short delay should be less than long delay!"),this.isMobile=ai()||di()}get(){return yc()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};kt=class{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;$("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;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;$("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;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;$("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};bc={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",INVALID_LOGIN_CREDENTIALS:"invalid-credential",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"};wc=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Tc=new me(3e4,6e4);Kn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(k(this.auth,"network-request-failed")),Tc.get())})}};Pt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return vc(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};Jn=class{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){if(e){let n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;let r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};et=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=Je(this.lastLoginAt),this.creationTime=Je(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};Ye=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){u(e.idToken,"internal-error"),u(typeof e.idToken<"u","internal-error"),u(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):zi(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){u(e.length!==0,"internal-error");let n=zi(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(u(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:r,refreshToken:i,expiresIn:s}=await Cc(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){let{refreshToken:r,accessToken:i,expirationTime:s}=n,a=new t;return r&&(u(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(u(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),s&&(u(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),a}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 t,this.toJSON())}_performRefresh(){return $("not implemented")}};ae=class t{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new Jn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,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 et(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let n=await Z(this,this.stsTokenManager.getToken(this.auth,e));return u(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Ar(this,e)}reload(){return Sr(this)}_assign(e){this!==e&&(u(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(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new t({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){u(!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,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await tt(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(y(this.auth.app))return Promise.reject(A(this.auth));let e=await this.getIdToken();return await Z(this,Sc(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{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=>({...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,n){let r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,a=n.photoURL??void 0,c=n.tenantId??void 0,l=n._redirectEventId??void 0,o=n.createdAt??void 0,d=n.lastLoginAt??void 0,{uid:f,emailVerified:h,isAnonymous:g,providerData:v,stsTokenManager:N}=n;u(f&&N,e,"internal-error");let D=Ye.fromJSON(this.name,N);u(typeof f=="string",e,"internal-error"),oe(r,e.name),oe(i,e.name),u(typeof h=="boolean",e,"internal-error"),u(typeof g=="boolean",e,"internal-error"),oe(s,e.name),oe(a,e.name),oe(c,e.name),oe(l,e.name),oe(o,e.name),oe(d,e.name);let W=new t({uid:f,auth:e,email:i,emailVerified:h,displayName:r,isAnonymous:g,photoURL:a,phoneNumber:s,tenantId:c,stsTokenManager:D,createdAt:o,lastLoginAt:d});return v&&Array.isArray(v)&&(W.providerData=v.map(P=>({...P}))),l&&(W._redirectEventId=l),W}static async _fromIdTokenResponse(e,n,r=!1){let i=new Ye;i.updateFromServerResponse(n);let s=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await tt(s),s}static async _fromGetAccountInfoResponse(e,n,r){let i=n.users[0];u(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?ys(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!s?.length,c=new Ye;c.updateFromIdToken(r);let l=new t({uid:i.localId,auth:e,stsTokenManager:c,isAnonymous:a}),o={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new et(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(l,o),l}};$i=new Map;Ct=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};Ct.type="NONE";Ot=Ct;Nt=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=Tt(this.userKey,i.apiKey,s),this.fullPersistenceKey=Tt("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let n=await Rt(this.auth,{idToken:e}).catch(()=>{});return n?ae._fromGetAccountInfoResponse(this.auth,n,e):null}return ae._fromJSON(this.auth,e)}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;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new t(J(Ot),e,r);let i=(await Promise.all(n.map(async o=>{if(await o._isAvailable())return o}))).filter(o=>o),s=i[0]||J(Ot),a=Tt(r,e.config.apiKey,e.name),c=null;for(let o of n)try{let d=await o._get(a);if(d){let f;if(typeof d=="string"){let h=await Rt(e,{idToken:d}).catch(()=>{});if(!h)break;f=await ae._fromGetAccountInfoResponse(e,h,d)}else f=ae._fromJSON(e,d);o!==s&&(c=f),s=o;break}}catch{}let l=i.filter(o=>o._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new t(s,e,r):(s=l[0],c&&await s._set(a,c.toJSON()),await Promise.all(n.map(async o=>{if(o!==s)try{await o._remove(a)}catch{}})),new t(s,e,r))}};Yn=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=s=>new Promise((a,c)=>{try{let l=e(s);a(l)}catch(l){c(l)}});r.onAbort=n,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}};Mc=6,Xn=class{constructor(e){let n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??Mc,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};Zn=class{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Dt(this),this.idTokenSubscription=new Dt(this),this.beforeStateQueue=new Yn(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=fs,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=J(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await Nt.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let 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 initializeCurrentUserFromIdToken(e){try{let n=await Rt(this,{idToken:e}),r=await ae._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(y(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):this.directlySetCurrentUser(null)}let n=await this.assertedPersistence.getCurrentUser(),r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(r=c.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return u(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 n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await tt(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Ec()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(y(this.app))return Promise.reject(A(this));let n=e?p(e):null;return n&&u(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&u(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return y(this.app)?Promise.reject(A(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return y(this.app)?Promise.reject(A(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(J(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await Lc(this),n=new Xn(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new q("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await Oc(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){let r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&J(e)||this._popupRedirectResolver;u(n,this,"argument-error"),this.redirectPersistenceManager=await Nt.create(this,[J(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),a=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(u(c,this,"internal-error"),c.then(()=>{a||s(this.currentUser)}),typeof n=="function"){let l=e.addObserver(n,r,i);return()=>{a=!0,l()}}else{let l=e.addObserver(n);return()=>{a=!0,l()}}}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 u(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=Ps(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(y(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&Ic(`Error while retrieving App Check token: ${e.error}`),e?.token}};Dt=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=gi(n=>this.observer=n)}get next(){return u(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};ct={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};Wc=500,Hc=6e4,Et=1e12,Qn=class{constructor(e){this.auth=e,this.counter=Et,this._widgets=new Map}render(e,n){let r=this.counter;return this._widgets.set(r,new nr(e,this.auth.name,n||{})),this.counter++,r}reset(e){let n=e||Et;this._widgets.get(n)?.delete(),this._widgets.delete(n)}getResponse(e){let n=e||Et;return this._widgets.get(n)?.getResponse()||""}async execute(e){let n=e||Et;return this._widgets.get(n)?.execute(),""}},er=class{constructor(){this.enterprise=new tr}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},tr=class{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},nr=class{constructor(e,n,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let i=typeof e=="string"?document.getElementById(e):e;u(i,"argument-error",{appName:n}),this.container=i,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=Bc(50);let{callback:e,"expired-callback":n}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,n)try{n()}catch{}this.isVisible&&this.execute()},Hc)},Wc))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};zc="recaptcha-enterprise",Xe="NO_RECAPTCHA",Gi="onFirebaseAuthREInstanceReady",nt=class t{constructor(e){this.type=zc,this.auth=E(e)}async verify(e="verify",n=!1){async function r(s){if(!n){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(a,c)=>{_s(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{let o=new Pt(l);return s.tenantId==null?s._agentRecaptchaConfig=o:s._tenantRecaptchaConfigs[s.tenantId]=o,a(o.siteKey)}}).catch(l=>{c(l)})})}function i(s,a,c){let l=window.grecaptcha;Bi(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(o=>{a(o)}).catch(()=>{a(Xe)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new er().execute("siteKey",{action:"verify"}):new Promise((s,a)=>{r(this.auth).then(async c=>{if(!n&&Bi(window.grecaptcha)&&t.scriptInjectionDeferred)await t.scriptInjectionDeferred.promise,i(c,s,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=xc();l.length!==0&&(l+=c+`&onload=${Gi}`),t.scriptInjectionDeferred=new ve,window[Gi]=()=>{t.scriptInjectionDeferred?.resolve()},Pr(l).then(()=>t.scriptInjectionDeferred?.promise).then(()=>{i(c,s,a)}).catch(o=>{a(o)})}}).catch(c=>{a(c)})})}};nt.scriptInjectionDeferred=null;Q=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return $("not implemented")}_getIdTokenResponse(e){return $("not implemented")}_linkToIdToken(e,n){return $("not implemented")}_getReauthenticationResolver(e){return $("not implemented")}};Oe=class t extends Q{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new t(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new t(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ce(e,n,"signInWithPassword",Yc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return tl(e,{email:this._email,oobCode:this._password});default:R(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ce(e,r,"signUpPassword",Kc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return nl(e,{idToken:n,email:this._email,oobCode:this._password});default:R(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};rl="http://localhost",j=class t extends Q{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):R("argument-error"),n}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){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;let a=new t(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){let n=this.buildRequest();return Y(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,Y(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,Y(e,n)}buildRequest(){let e={requestUri:rl,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=de(n)}return e}};ol={USER_NOT_FOUND:"user-not-found"};ge=class t extends Q{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new t({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new t({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return il(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return sl(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return al(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:r,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:r,code:i}}toJSON(){let 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){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s}=e;return!r&&!n&&!i&&!s?null:new t({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s})}};_e=class t{constructor(e){let n=Ae(Se(e)),r=n.apiKey??null,i=n.oobCode??null,s=cl(n.mode??null);u(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){let n=ll(e);try{return new t(n)}catch{return null}}};ee=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,n){return Oe._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let r=_e.parseLink(n);return u(r,"argument-error"),Oe._fromEmailAndCode(e,r.code,r.tenantId)}};ee.PROVIDER_ID="password";ee.EMAIL_PASSWORD_SIGN_IN_METHOD="password";ee.EMAIL_LINK_SIGN_IN_METHOD="emailLink";x=class{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}};ue=class extends x{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},Lt=class t extends ue{static credentialFromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;return u("providerId"in n&&"signInMethod"in n,"argument-error"),j._fromParams(n)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return u(e.idToken||e.accessToken,"argument-error"),j._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return t.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return t.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:a,providerId:c}=e;if(!r&&!i&&!n&&!s||!c)return null;try{return new t(c)._credential({idToken:n,accessToken:r,nonce:a,pendingToken:s})}catch{return null}}};Ne=class t extends ue{constructor(){super("facebook.com")}static credential(e){return j._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Ne.FACEBOOK_SIGN_IN_METHOD="facebook.com";Ne.PROVIDER_ID="facebook.com";De=class t extends ue{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return j._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return t.credential(n,r)}catch{return null}}};De.GOOGLE_SIGN_IN_METHOD="google.com";De.PROVIDER_ID="google.com";Le=class t extends ue{constructor(){super("github.com")}static credential(e){return j._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Le.GITHUB_SIGN_IN_METHOD="github.com";Le.PROVIDER_ID="github.com";ul="http://localhost",Mt=class t extends Q{constructor(e,n){super(e,e),this.pendingToken=n}_getIdTokenResponse(e){let n=this.buildRequest();return Y(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,Y(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,Y(e,n)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,pendingToken:s}=n;return!r||!i||!s||r!==i?null:new t(r,s)}static _create(e,n){return new t(e,n)}buildRequest(){return{requestUri:ul,returnSecureToken:!0,pendingToken:this.pendingToken}}};dl="saml.",Ut=class t extends x{constructor(e){u(e.startsWith(dl),"argument-error"),super(e)}static credentialFromResult(e){return t.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return t.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let n=Mt.fromJSON(e);return u(n,"argument-error"),n}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:n,providerId:r}=e;if(!n||!r)return null;try{return Mt._create(r,n)}catch{return null}}};Me=class t extends ue{constructor(){super("twitter.com")}static credential(e,n){return j._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return t.credential(n,r)}catch{return null}}};Me.TWITTER_SIGN_IN_METHOD="twitter.com";Me.PROVIDER_ID="twitter.com";V=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){let s=await ae._fromIdTokenResponse(e,r,i),a=Ji(r);return new t({user:s,providerId:a,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);let i=Ji(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})}};rr=class t extends M{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,t.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new t(e,n,r,i)}};Ie=class{constructor(e,n){this.factorId=e,this.uid=n.mfaEnrollmentId,this.enrollmentTime=new Date(n.enrolledAt).toUTCString(),this.displayName=n.displayName}static _fromServerResponse(e,n){return"phoneInfo"in n?ir._fromServerResponse(e,n):"totpInfo"in n?sr._fromServerResponse(e,n):R(e,"internal-error")}},ir=class t extends Ie{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,n){return new t(n)}},sr=class t extends Ie{constructor(e){super("totp",e)}static _fromServerResponse(e,n){return new t(n)}};le=class{constructor(e,n,r={}){this.isNewUser=e,this.providerId=n,this.profile=r}},Ft=class extends le{constructor(e,n,r,i){super(e,n,r),this.username=i}},or=class extends le{constructor(e,n){super(e,"facebook.com",n)}},ar=class extends Ft{constructor(e,n){super(e,"github.com",n,typeof n?.login=="string"?n?.login:null)}},cr=class extends le{constructor(e,n){super(e,"google.com",n)}},lr=class extends Ft{constructor(e,n,r){super(e,"twitter.com",n,r)}};xt=class t{constructor(e,n,r){this.type=e,this.credential=n,this.user=r}static _fromIdtoken(e,n){return new t("enroll",e,n)}static _fromMfaPendingCredential(e){return new t("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return t._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return t._fromIdtoken(e.multiFactorSession.idToken)}return null}};ur=class t{constructor(e,n,r){this.session=e,this.hints=n,this.signInResolver=r}static _fromError(e,n){let r=E(e),i=n.customData._serverResponse,s=(i.mfaInfo||[]).map(c=>Ie._fromServerResponse(r,c));u(i.mfaPendingCredential,r,"internal-error");let a=xt._fromMfaPendingCredential(i.mfaPendingCredential);return new t(a,s,async c=>{let l=await c._process(r,a);delete i.mfaInfo,delete i.mfaPendingCredential;let o={...i,idToken:l.idToken,refreshToken:l.refreshToken};switch(n.operationType){case"signIn":let d=await V._fromIdTokenResponse(r,n.operationType,o);return await r._updateCurrentUser(d.user),d;case"reauthenticate":return u(n.user,r,"internal-error"),V._forOperation(n.user,n.operationType,o);default:R(r,"internal-error")}})}async resolveSignIn(e){let n=e;return this.signInResolver(n)}};dr=class t{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(n=>{n.mfaInfo&&(this.enrolledFactors=n.mfaInfo.map(r=>Ie._fromServerResponse(e.auth,r)))})}static _fromUser(e){return new t(e)}async getSession(){return xt._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,n){let r=e,i=await this.getSession(),s=await Z(this.user,r._process(this.user.auth,i,n));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let n=typeof e=="string"?e:e.uid,r=await this.user.getIdToken();try{let i=await Z(this.user,yl(this.user.auth,{idToken:r,mfaEnrollmentId:n}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==n),await this.user._updateTokensIfNecessary(i),await this.user.reload()}catch(i){throw i}}},Bn=new WeakMap;Vt="__sak";Wt=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Vt,"1"),this.storage.removeItem(Vt),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};El=1e3,bl=10,Ht=class extends Wt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=ks(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}let r=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let a=this.storage.getItem(r);!n&&this.localCache[r]===a||this.notifyListeners(r,a)},s=this.storage.getItem(r);Dc()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,bl):i()}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},El)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){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(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};Ht.type="LOCAL";xr=Ht;wl=1e3;Bt=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let n=new URL(`${window.location.origin}/__cookies__`);return n.searchParams.set("finalTarget",e),n}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,n){}async _get(e){if(!this._isAvailable())return null;let n=$n(e);return window.cookieStore?(await window.cookieStore.get(n))?.value:zn(n)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=$n(e);document.cookie=`${r}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,n){if(!this._isAvailable())return;let r=$n(e);if(window.cookieStore){let c=(o=>{let d=o.changed.find(h=>h.name===r);d&&n(d.value),o.deleted.find(h=>h.name===r)&&n(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(n,l),window.cookieStore.addEventListener("change",c)}let i=zn(r),s=setInterval(()=>{let c=zn(r);c!==i&&(n(c),i=c)},wl),a=()=>clearInterval(s);this.listenerUnsubscribes.set(n,a)}_removeListener(e,n){let r=this.listenerUnsubscribes.get(n);r&&(r(),this.listenerUnsubscribes.delete(n))}};Bt.type="COOKIE";_o=Bt;zt=class extends Wt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};zt.type="SESSION";nn=zt;$t=class t{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let r=new t(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:r,eventType:i,data:s}=n.data,a=this.handlersMap[i];if(!a?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let c=Array.from(a).map(async o=>o(n.origin,s)),l=await Tl(c);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};$t.receivers=[];hr=class{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,n,r=50){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,a;return new Promise((c,l)=>{let o=rn("",20);i.port1.start();let d=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(f){let h=f;if(h.data.eventId===o)switch(h.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(h.data.response);break;default:clearTimeout(d),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:o,data:n},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};Io="firebaseLocalStorageDb",Pl=1,jt="firebaseLocalStorage",yo="fbase_key",ye=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};Ol=800,Nl=3,Gt=class{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise?this.dbPromise:(this.dbPromise=Eo(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(n++>Nl)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Vr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=$t._getInstance(kl()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await Al(),!this.activeServiceWorker)return;this.sender=new hr(this.activeServiceWorker);let e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Sl()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await Xi(e,Vt,"1"),await Zi(e,Vt)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>Xi(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(r=>Cl(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>Zi(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=sn(i,!1).getAll();return new ye(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],r=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Ol)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};Gt.type="LOCAL";Wr=Gt;jn=Rs("rcb"),Ml=new me(3e4,6e4),fr=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!b().grecaptcha?.render}load(e,n=""){return u(Ul(n),e,"argument-error"),this.shouldResolveImmediately(n)&&Hi(b().grecaptcha)?Promise.resolve(b().grecaptcha):new Promise((r,i)=>{let s=b().setTimeout(()=>{i(k(e,"network-request-failed"))},Ml.get());b()[jn]=()=>{b().clearTimeout(s),delete b()[jn];let c=b().grecaptcha;if(!c||!Hi(c)){i(k(e,"internal-error"));return}let l=c.render;c.render=(o,d)=>{let f=l(o,d);return this.counter++,f},this.hostLanguage=n,r(c)};let a=`${Fc()}?${de({onload:jn,render:"explicit",hl:n})}`;Pr(a).catch(()=>{clearTimeout(s),i(k(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!b().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};pr=class{async load(e){return new Qn(e)}clearedOneInstance(){}};Ze="recaptcha",Fl={theme:"light",type:"image"},qt=class{constructor(e,n,r={...Fl}){this.parameters=r,this.type=Ze,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=E(e),this.isInvisible=this.parameters.size==="invisible",u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let i=typeof n=="string"?document.getElementById(n):n;u(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new pr:new fr,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),n=this.getAssertedRecaptcha(),r=n.getResponse(e);return r||new Promise(i=>{let s=a=>{a&&(this.tokenChangeListeners.delete(s),i(a))};this.tokenChangeListeners.add(s),this.isInvisible&&n.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){u(!this.parameters.sitekey,this.auth,"argument-error"),u(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return n=>{if(this.tokenChangeListeners.forEach(r=>r(n)),typeof e=="function")e(n);else if(typeof e=="string"){let r=b()[e];typeof r=="function"&&r(n)}}}assertNotDestroyed(){u(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let n=document.createElement("div");e.appendChild(n),e=n}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){u(Tr()&&!Vr(),this.auth,"internal-error"),await xl(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await Ac(this.auth);u(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return u(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};rt=class{constructor(e,n){this.verificationId=e,this.onConfirmation=n}confirm(e){let n=ge._fromVerification(this.verificationId,e);return this.onConfirmation(n)}};Ue=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=E(e)}verifyPhoneNumber(e,n){return on(this.auth,e,p(n))}static credential(e,n){return ge._fromVerification(e,n)}static credentialFromResult(e){let n=e;return t.credentialFromTaggedObject(n)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:r}=e;return n&&r?ge._fromTokenResponse(n,r):null}};Ue.PROVIDER_ID="phone";Ue.PHONE_SIGN_IN_METHOD="phone";it=class extends Q{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return Y(e,this._buildIdpRequest())}_linkToIdToken(e,n){return Y(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return Y(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={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&&(n.idToken=e),n}};Kt=class{constructor(e,n,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(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:a,type:c}=e;if(a){this.reject(a);return}let l={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(o){this.reject(o)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return Vl;case"linkViaPopup":case"linkViaRedirect":return Hl;case"reauthViaPopup":case"reauthViaRedirect":return Wl;default:R(this.auth,"internal-error")}}resolve(e){X(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){X(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()}};Bl=new me(2e3,1e4);Fe=class t extends Kt{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,t.currentPopupAction&&t.currentPopupAction.cancel(),t.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return u(e,this.auth,"internal-error"),e}async onExecution(){X(this.filter.length===1,"Popup operations only handle one event");let e=rn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(k(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(k(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,t.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(k(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,Bl.get())};e()}};Fe.currentPopupAction=null;zl="pendingRedirect",vt=new Map,mr=class extends Kt{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=vt.get(this.auth._key());if(!e){try{let r=await $l(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}vt.set(this.auth._key(),e)}return this.bypassAuthState||vt.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){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};Jl=600*1e3,gr=class{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 n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Yl(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!Uo(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(k(this.auth,r))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=Jl&&this.cachedEventUids.clear(),this.cachedEventUids.has(es(e))}saveEventToCache(e){this.cachedEventUids.add(es(e)),this.lastProcessedEventTime=Date.now()}};Zl=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Ql=/^https?/;nu=new me(3e4,6e4);At=null;su=new me(5e3,15e3),ou="__/auth/iframe",au="emulator/auth/iframe",cu={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},lu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);hu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},fu=500,pu=600,mu="_blank",gu="http://localhost",Jt=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};yu="__/auth/handler",Eu="emulator/auth/handler",bu=encodeURIComponent("fac");qn="webStorageSupport",_r=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=nn,this._completeRedirectFn=Lo,this._overrideRedirectResult=jl}async _openPopup(e,n,r,i){X(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await ns(e,n,r,Qe(),i);return _u(e,s,rn())}async _openRedirect(e,n,r,i){await this._originValidation(e);let s=await ns(e,n,r,Qe(),i);return vl(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(X(s,"If manager is not set, promise should be"),s)}let r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){let n=await du(e),r=new gr(e);return n.register("authEvent",i=>(u(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()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(qn,{type:qn},i=>{let s=i?.[0]?.[qn];s!==void 0&&n(!!s),R(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=eu(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return ks()||bs()||kr()}},Br=_r,Yt=class{constructor(e){this.factorId=e}_process(e,n,r){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,r);case"signin":return this._finalizeSignIn(e,n.credential);default:return $("unexpected MultiFactorSessionType")}}},Ir=class t extends Yt{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,n,r){return gl(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return Dl(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},st=class{constructor(){}static assertion(e){return Ir._fromCredential(e)}};st.FACTOR_ID="phone";ot=class{static assertionForEnrollment(e,n){return Xt._fromSecret(e,n)}static assertionForSignIn(e,n){return Xt._fromEnrollmentId(e,n)}static async generateSecret(e){let n=e;u(typeof n.user?.auth<"u","internal-error");let r=await _l(n.user.auth,{idToken:n.credential,totpEnrollmentInfo:{}});return at._fromStartTotpMfaEnrollmentResponse(r,n.user.auth)}};ot.FACTOR_ID="totp";Xt=class t extends Yt{constructor(e,n,r){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=r}static _fromSecret(e,n){return new t(n,void 0,e)}static _fromEnrollmentId(e,n){return new t(n,e)}async _finalizeEnroll(e,n,r){return u(typeof this.secret<"u",e,"argument-error"),Il(e,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){u(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return Ll(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},at=class t{constructor(e,n,r,i,s,a,c){this.sessionInfo=a,this.auth=c,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=r,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new t(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){let r=!1;return(bt(e)||bt(n))&&(r=!0),r&&(bt(e)&&(e=this.auth.currentUser?.email||"unknownuser"),bt(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};rs="@firebase/auth",is="1.13.3";yr=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.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;let n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){u(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};Au=300,Su=wn("authIdTokenMaxAge")||Au,ss=null,ku=t=>async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Su)return;let i=n?.token;ss!==i&&(ss=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};Uc({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let s=k("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",Pu().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});vu("Browser")});var Vo=F(()=>{xo();Ge();ke();gt();mt()});var an={};ei(an,{ActionCodeOperation:()=>us,ActionCodeURL:()=>_e,AuthCredential:()=>Q,AuthErrorCodes:()=>ps,EmailAuthCredential:()=>Oe,EmailAuthProvider:()=>ee,FacebookAuthProvider:()=>Ne,FactorId:()=>os,GithubAuthProvider:()=>Le,GoogleAuthProvider:()=>De,OAuthCredential:()=>j,OAuthProvider:()=>Lt,OperationType:()=>ls,PhoneAuthCredential:()=>ge,PhoneAuthProvider:()=>Ue,PhoneMultiFactorGenerator:()=>st,ProviderId:()=>as,RecaptchaVerifier:()=>qt,SAMLAuthProvider:()=>Ut,SignInMethod:()=>cs,TotpMultiFactorGenerator:()=>ot,TotpSecret:()=>at,TwitterAuthProvider:()=>Me,applyActionCode:()=>$s,beforeAuthStateChanged:()=>Fr,browserCookiePersistence:()=>_o,browserLocalPersistence:()=>xr,browserPopupRedirectResolver:()=>Br,browserSessionPersistence:()=>nn,checkActionCode:()=>Mr,confirmPasswordReset:()=>zs,connectAuthEmulator:()=>Cr,createUserWithEmailAndPassword:()=>Gs,debugErrorMap:()=>hs,deleteUser:()=>po,fetchSignInMethodsForEmail:()=>Xs,getAdditionalUserInfo:()=>io,getAuth:()=>Fo,getIdToken:()=>Is,getIdTokenResult:()=>Ar,getMultiFactorResolver:()=>mo,getRedirectResult:()=>Do,inMemoryPersistence:()=>Ot,indexedDBLocalPersistence:()=>Wr,initializeAuth:()=>Rr,initializeRecaptchaConfig:()=>oo,isSignInWithEmailLink:()=>Js,linkWithCredential:()=>Nr,linkWithPhoneNumber:()=>wo,linkWithPopup:()=>ko,linkWithRedirect:()=>No,multiFactor:()=>go,onAuthStateChanged:()=>co,onIdTokenChanged:()=>Ur,parseActionCodeURL:()=>Ds,prodErrorMap:()=>Er,reauthenticateWithCredential:()=>Dr,reauthenticateWithPhoneNumber:()=>To,reauthenticateWithPopup:()=>So,reauthenticateWithRedirect:()=>Oo,reload:()=>Sr,revokeAccessToken:()=>fo,sendEmailVerification:()=>Zs,sendPasswordResetEmail:()=>Bs,sendSignInLinkToEmail:()=>Ks,setPersistence:()=>so,signInAnonymously:()=>Ms,signInWithCredential:()=>lt,signInWithCustomToken:()=>Hs,signInWithEmailAndPassword:()=>qs,signInWithEmailLink:()=>Ys,signInWithPhoneNumber:()=>bo,signInWithPopup:()=>Ao,signInWithRedirect:()=>Co,signOut:()=>ho,unlink:()=>xs,updateCurrentUser:()=>uo,updateEmail:()=>to,updatePassword:()=>no,updatePhoneNumber:()=>vo,updateProfile:()=>eo,useDeviceLanguage:()=>lo,validatePassword:()=>ao,verifyBeforeUpdateEmail:()=>Qs,verifyPasswordResetCode:()=>js});var cn=F(()=>{Vo()});var Ru={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},zr=null,ln=null;async function be(){return typeof window>"u"?null:(zr||(zr=(async()=>{let{initializeApp:t,getApps:e}=await Promise.resolve().then(()=>(Vi(),xi)),{getAuth:n,signInAnonymously:r,onAuthStateChanged:i}=await Promise.resolve().then(()=>(cn(),an)),s=e().length?e()[0]:t(Ru);if(ln=n(s),!await new Promise(c=>{let l=i(ln,o=>{l(),c(o)})}))try{await r(ln)}catch{console.warn("[oZ Auth] Anonymous session unavailable (offline or delayed).")}return ln})()),zr)}async function Wo(){try{let t=await be();return!t||!t.currentUser?null:await t.currentUser.getIdToken()}catch{return console.error("[OZmoz Auth] Session check failed."),null}}async function un(t){let e=await be(),{signInWithCustomToken:n}=await Promise.resolve().then(()=>(cn(),an)),r;try{r=await n(e,t)}catch{throw new Error("Sign-in failed. Please try again.")}return{uid:r.user.uid,email:r.user.email,isAnonymous:r.user.isAnonymous}}async function Ho(){let t=await be(),{signOut:e,signInAnonymously:n}=await Promise.resolve().then(()=>(cn(),an));return await e(t),await n(t),!0}async function Bo(){let t=await be();return!t||!t.currentUser?null:{uid:t.currentUser.uid,email:t.currentUser.email,isAnonymous:t.currentUser.isAnonymous}}async function zo(t=!1){try{let e=await be();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(t)).claims.elog===!0}catch(e){return console.error("[OZmoz Auth Debug]",e),!1}}var Cu="oz_proto",$r="proto_user",hn=new Map,$o=(t,e)=>`${Cu}:${t||"app"}:${e}`,O=t=>t===void 0?t:JSON.parse(JSON.stringify(t)),jo=()=>`proto_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}`,qr=t=>{let e=t?._id??t?.id??t?.documentId;return e==null?null:String(e)},jr=new Set;function ne(t,e){let n=$o(t,e);if(jr.has(n))return O(hn.get(n));try{if(typeof localStorage<"u"){let r=localStorage.getItem(n);if(r!==null){let i=JSON.parse(r);if(Array.isArray(i))return i}}}catch{}return hn.has(n)?O(hn.get(n)):null}function ut(t,e,n){let r=$o(t,e);hn.set(r,O(n));try{if(typeof localStorage<"u"){localStorage.setItem(r,JSON.stringify(n)),jr.delete(r);return}}catch{}jr.add(r)}var Gr=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return{}}return t&&typeof t=="object"?t:{}};function Ou(t,e,n){let r=String(e).split("."),i=t;r.forEach((s,a)=>{a===r.length-1?i[s]=n:((typeof i[s]!="object"||i[s]===null)&&(i[s]={}),i=i[s])})}function Nu(t){let e={...O(Gr(t))};return e._id=qr(e)||jo(),e}var dn=(t,e)=>t.findIndex(n=>qr(n)===String(e));function Go(t,e,n){let r=ne(t,e);if(r!==null)return{success:!0,seeded:!1,isPrototype:!0,count:r.length};let i=(Array.isArray(n)?n:[]).map(Nu);return ut(t,e,i),{success:!0,seeded:!0,isPrototype:!0,count:i.length}}function qo(t,e,n){let r=e||{},i=r.fleetboTable;switch(t){case"getdocsg":case"getdocsu":return{success:!0,data:O(ne(n,i)||[])};case"getdoc":{let s=ne(n,i)||[],a=s[dn(s,r.id)];return a?{success:!0,data:O(a)}:{success:!1,notFound:!0,message:"Document not found."}}case"add":case"addwithmedia":{let s=ne(n,i)||[],a=Gr(r.jsonData),c={...O(a),_id:qr(a)||jo(),userId:$r,createdAt:new Date().toISOString()};if(t==="addwithmedia"){let l=typeof r.fileBase64=="string"&&r.fileBase64||a.mediaUrl||a.image||"";c.mediaUrl=c.image=c.imageUrl=c.coverImage=l}return s.push(c),ut(n,i,s),t==="addwithmedia"?{success:!0,id:c._id,mediaUrl:c.mediaUrl,isPrototype:!0}:{success:!0,documentId:c._id,isPrototype:!0}}case"addwithuserid":case"addwithid":{let s=ne(n,i)||[],a=t==="addwithuserid"?$r:String(r.id),c=O(Gr(r.jsonData)),l=dn(s,a),o={...l>=0?s[l]:{createdAt:new Date().toISOString()},...c,_id:a,userId:$r,updatedAt:new Date().toISOString()};return l>=0?s[l]=o:s.push(o),ut(n,i,s),t==="addwithuserid"?{success:!0,documentId:a,isPrototype:!0}:{success:!0,id:a,isPrototype:!0}}case"update":{let s=ne(n,i)||[],a=dn(s,r.id);if(a<0)return{success:!1,documentId:r.id,error:"Document not found."};let{fleetboTable:c,id:l,...o}=r,d=O(s[a]);for(let[f,h]of Object.entries(o))Ou(d,f,O(h));return d.updatedAt=new Date().toISOString(),s[a]=d,ut(n,i,s),{success:!0,documentId:String(r.id),isPrototype:!0}}case"delete":{let s=ne(n,i)||[],a=dn(s,r.id);return a>=0&&(s.splice(a,1),ut(n,i,s)),{success:!0,documentId:String(r.id),isPrototype:!0}}case"join":{let s=r.joinOptions?.innerJoin;if(!s||!s.collection||!Array.isArray(s.on)||s.on.length!==3)return{success:!1,error:"La clause 'on' doit contenir 3 \xE9l\xE9ments."};let[a,,c]=s.on,l=s.as||"joinedData",o=ne(n,s.collection)||[],d=h=>{if(!Array.isArray(s.select)||s.select.length===0)return O(h);let g={_id:h._id};return s.select.forEach(v=>{v in h&&(g[v]=O(h[v]))}),g};return{success:!0,data:(ne(n,i)||[]).map(h=>{let g=h[a],v=o.filter(N=>{if(g==null)return!1;let D=c==="id"?N._id??N.id:N[c];return String(D)===String(g)});return{...O(h),[l]:v.map(d)}})}}default:return null}}var Du="https://api.ozmoz.io/",dt=()=>typeof globalThis<"u"&&globalThis.OZ_CONFIG?globalThis.OZ_CONFIG:typeof window<"u"&&window.OZ_CONFIG?window.OZ_CONFIG:{},Kr=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_PROTOTYPE==="true"||typeof process<"u"&&process.env&&process.env.OZ_PROTOTYPE==="true"||dt().prototype===!0||dt().prototype==="true"),Jr=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_DB_KEY:typeof process<"u"?process.env.OZ_DB_KEY:void 0)||dt().dbKey||"",Lu=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_ENTERPRISE_ID:typeof process<"u"?process.env.OZ_ENTERPRISE_ID:void 0)||dt().enterpriseId||"",Mu=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_DEBUG==="true"||typeof process<"u"&&process.env&&process.env.OZ_DEBUG==="true"||dt().debug===!0),ht=async(t,e=null)=>{try{let n=Jr(),r=Lu(),i=Kr(),s=String(t).replace(/^[a-z]+:\/\//,"").split("-")[0]||"add",a=e?.operation||s,c=s==="crud"?"crud":a;if(i){let L=qo(a.toLowerCase(),e,n);if(L!=null)return L}let l={"Content-Type":"application/json"};i&&(l["x-oz-prototype"]="true");let o=Mu()?Date.now():0,d=await Wo(),f=o?Date.now():0;d&&(l.Authorization=`Bearer ${d}`);let h=null;if(e?.jsonData!==void 0)h=e.jsonData;else if(a==="update"){let{fleetboTable:L,id:pn,operation:mn,...gn}=e||{};h=gn}let g={targetFunction:c,operation:a,enterpriseID:r,fleetboDB:n,fleetboTable:e?.fleetboTable||null,jsonData:h,_prototype:i,data:{fleetboDB:n,enterpriseID:r,operation:a,...e}},v=L=>{if(!L||typeof L!="object")return L;let{fleetboDB:pn,fleetboTable:mn,...gn}=L;return{...gn,...pn!==void 0?{ozDB:pn}:{},...mn!==void 0?{ozTable:mn}:{}}},N={...v(g),data:v(g.data)},D=await fetch(Du,{method:"POST",headers:l,body:JSON.stringify(N)}),W=await D.json(),P=W.result||W;if(o){let L=Date.now();console.debug(`[OZmoz] ${c}(${e?.fleetboTable||""}) ${L-o} ms : auth ${f-o} ms, cloud ${L-f} ms, HTTP ${D.status}`)}let Te=P?.error||(D.ok?null:P?.message||`HTTP ${D.status}`),Qr=Te&&typeof Te=="object"?Te.message||JSON.stringify(Te):Te?String(Te):void 0;return{success:!!(D.ok&&!Qr),...P||{},error:Qr}}catch(n){return{success:!1,error:n?.message||String(n)}}},Ko=ht,Jo=ht,Yo=ht;var w=ht||Ko||Jo||Yo,Zo=Kr||(()=>!1),Fu=Jr||(()=>"");if(typeof window<"u"&&typeof customElements<"u"){class t extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),d=this.getAttribute("fallback")||"\u2014",f=o!=null&&o.trim()!==""&&o!=="null"&&o!=="undefined";this.textContent=f?o:d}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):this.setAttribute("value",String(o))}get currency(){return this.getAttribute("currency")}set currency(o){o==null?this.removeAttribute("currency"):this.setAttribute("currency",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"0";if(o==null||o===""||o==="null"||o==="undefined"){this.textContent=d;return}let f=Number(o);if(Number.isNaN(f)){this.textContent=d;return}let h=this.getAttribute("currency");if(h)try{this.textContent=new Intl.NumberFormat("en-US",{style:"currency",currency:h}).format(f)}catch{this.textContent=`${f} ${h}`}else this.textContent=String(f)}}class n extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(o){o==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(o))}get"label-true"(){return this.labelTrue}set"label-true"(o){this.labelTrue=o}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(o){o==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(o))}get"label-false"(){return this.labelFalse}set"label-false"(o){this.labelFalse=o}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),d=this.getAttribute("label-true")||"Yes",f=this.getAttribute("label-false")||"No",h=this.getAttribute("invalid-fallback")||"Unknown";o==="true"||o==="1"?this.textContent=d:o==="false"||o==="0"?this.textContent=f:this.textContent=h}}class r extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):o&&typeof o=="object"&&typeof o.toISOString=="function"?this.setAttribute("value",o.toISOString()):this.setAttribute("value",String(o))}get locale(){return this.getAttribute("locale")}set locale(o){o==null?this.removeAttribute("locale"):this.setAttribute("locale",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"Invalid date",f=this.getAttribute("locale")||"en-US";if(!o||o==="null"||o==="undefined"||o===""){this.textContent=d;return}let h=new Date(o);if(Number.isNaN(h.getTime())){this.textContent=d;return}try{this.textContent=h.toLocaleDateString(f)}catch{this.textContent=h.toLocaleDateString("en-US")}}}class i extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get allowed(){return this.getAttribute("allowed")}set allowed(o){o==null?this.removeAttribute("allowed"):Array.isArray(o)?this.setAttribute("allowed",o.join(",")):this.setAttribute("allowed",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),d=(this.getAttribute("allowed")||"").split(",").map(h=>h.trim()).filter(Boolean),f=this.getAttribute("invalid-fallback")||"Not allowed";if(!o||o==="null"||o==="undefined"||!d.includes(o)){this.textContent=f;return}this.textContent=String(o)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get alt(){return this.getAttribute("alt")}set alt(o){o==null?this.removeAttribute("alt"):this.setAttribute("alt",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),d=this.getAttribute("fallback")||"",f=this.getAttribute("alt")||"Media";this.innerHTML="";let h=document.createElement("img"),g=o&&o!=="null"&&o!=="undefined"&&o.trim()!=="";h.src=g?o:d,h.alt=f,this.appendChild(h)}}class a extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(o){o==null?this.removeAttribute("table"):this.setAttribute("table",String(o))}get id(){return this.getAttribute("id")}set id(o){o==null?this.removeAttribute("id"):this.setAttribute("id",String(o))}get field(){return this.getAttribute("field")}set field(o){o==null?this.removeAttribute("field"):this.setAttribute("field",String(o))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(o){o==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(o))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(o){this.orphanFallback=o}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(o){o==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(o))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(o){this.loadingFallback=o}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(o){o==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(o))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(o){this.malformedFallback=o}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let o=this.getAttribute("table"),d=this.getAttribute("id"),f=this.getAttribute("field")||"name",h=this.getAttribute("orphan-fallback")||"Deleted",g=this.getAttribute("loading-fallback")||"Loading...",v=this.getAttribute("malformed-fallback")||"Invalid ID";if(!d||typeof d!="string"||d.trim()===""||d==="null"||d==="undefined"){this.textContent=v;return}if(!o){this.textContent=v;return}this.textContent=g;try{let N=typeof window<"u"?window:null,D=typeof globalThis<"u"?globalThis:null,W=N&&N.oz||D&&D.oz;if(!W||typeof W.getDoc!="function"){this.textContent=h;return}let P=await W.getDoc(o,d);P&&P[f]!==void 0?this.textContent=String(P[f]):P?this.textContent=P.name||P.title||P.label||JSON.stringify(P):this.textContent=h}catch{this.textContent=h}}}let c=(l,o)=>{customElements.get(l)||customElements.define(l,o)};c("oz-text",t),c("oz-number",e),c("oz-toggle",n),c("oz-date",r),c("oz-enum",i),c("oz-media",s),c("oz-reference",a)}var Xr={Text:"oz-text",Number:"oz-number",Toggle:"oz-toggle",Date:"oz-date",Enum:"oz-enum",Media:"oz-media",Reference:"oz-reference"};function Ve(t){typeof window>"u"&&typeof process<"u"&&process.env}var xu=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.DEV===!0||typeof process<"u"&&process.env&&!1),Xo=null;async function U(t){if(t&&t._schemaVersion&&t._schemaData){let e=t._schemaVersion,n=t._schemaData;typeof window<"u"?xu()&&String(e)!==Xo&&(Xo=String(e),fetch("/__ozmoz_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:n,version:e})}).catch(()=>{})):typeof process<"u"&&process.env}return t}var T=t=>`oz://${t.toLowerCase()}`,fn=(t,e,n)=>{if(!n||n.success!==!1||n.notFound)return;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";console.error(`[OZmoz] ${t}('${e}') failed: ${i}`)};var We=(t,e,n)=>{if(!n||n.success!==!1)return n;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";return console.error(`[OZmoz] ${t}('${e}') failed: ${i}`),n},we=null;function Yr(){if(typeof window>"u")return Promise.resolve(null);let t=window;return t.FB&&t.__ozmoz_fb_ready?Promise.resolve(t.FB):we||(we=new Promise((e,n)=>{let r=setTimeout(()=>{we=null,n(new Error("The Facebook service is not responding. Check your tracker blockers."))},8e3),i=typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_FACEBOOK_APP_ID||typeof process<"u"&&process.env&&process.env.OZ_FACEBOOK_APP_ID||"1392432699758138",s=()=>{try{return t.__ozmoz_fb_ready?!0:!t.FB||typeof t.FB.init!="function"?!1:(t.FB.init({appId:String(i).trim(),cookie:!0,xfbml:!1,version:"v22.0"}),t.__ozmoz_fb_ready=!0,clearTimeout(r),e(t.FB),!0)}catch(l){return clearTimeout(r),we=null,n(l),!1}};if(t.FB&&typeof t.FB.init=="function"&&s())return;let a=t.fbAsyncInit;if(t.fbAsyncInit=function(){if(typeof a=="function")try{a()}catch{}s()},document.getElementById("facebook-jssdk"))return;let c=document.createElement("script");c.id="facebook-jssdk",c.src="https://connect.facebook.net/fr_FR/sdk.js",c.async=!0,c.defer=!0,c.crossOrigin="anonymous",c.onerror=()=>{clearTimeout(r),we=null,n(new Error("Could not load the Facebook script."))},document.head.appendChild(c)}),we)}typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{Yr()}):Yr());var Vu=()=>new Proxy({},{get(t,e){let n=String(e);return async(r={})=>{let i=await w(T("call"),{functionName:n,payload:r});return U(i)}}}),G=t=>t&&(Array.isArray(t)?t.map(e=>e&&e._id&&!e.id?{...e,id:String(e._id)}:e):typeof t=="object"&&t._id&&!t.id?{...t,id:String(t._id)}:t),re=(t,e,n)=>{(!n||typeof n!="object"||!n.desc&&!n.guard&&!n.role)&&console.warn(`[OZmoz] ${t}('${e}') : no {desc, guard, role} metadata provided \u2014 'npx ozmoz sync' will require it.`)},Zr={...Xr,call:Vu(),getUser:Bo,add:async(t,e,n={})=>{Ve(t),re("add",t,n);let r=await w(T("crud"),{operation:"add",fleetboTable:t,jsonData:e});return We("add",t,await U(r))},addWithId:async(t,e,n,r={})=>{Ve(t),re("addWithId",t,r);let i=await w(T("crud"),{operation:"addWithId",fleetboTable:t,id:n,jsonData:e});return We("addWithId",t,await U(i))},addWithUserId:async(t,e,n={})=>{Ve(t),re("addWithUserId",t,n);let r=await w(T("crud"),{operation:"addWithUserId",fleetboTable:t,jsonData:e});return We("addWithUserId",t,await U(r))},addWithMedia:async(t,e,n,r,i={})=>{Ve(t),re("addWithMedia",t,i);let s=await w(T("crud"),{operation:"addWithMedia",fleetboTable:t,jsonData:e,fileBase64:n,fileName:r});return We("addWithMedia",t,await U(s))},update:async(t,e,n,r={})=>{re("update",t,r);let i=await w(T("crud"),{operation:"update",fleetboTable:t,id:e,...n});return We("update",t,await U(i))},delete:async(t,e,n={})=>{re("delete",t,n);let r=await w(T("crud"),{operation:"delete",fleetboTable:t,id:e});return We("delete",t,await U(r))},getDocsG:async(t,e={})=>{re("getDocsG",t,e);let n=await w(T("crud"),{operation:"getDocsG",fleetboTable:t}),r=await U(n);return fn("getDocsG",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDocsU:async(t,e={})=>{re("getDocsU",t,e);let n=await w(T("crud"),{operation:"getDocsU",fleetboTable:t}),r=await U(n);return fn("getDocsU",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDoc:async(t,e,n={})=>{re("getDoc",t,n);let r=await w(T("crud"),{operation:"getDoc",fleetboTable:t,id:e}),i=await U(r);return fn("getDoc",t,i),i?i.data!==void 0?G(i.data):i.success===!1?null:G(i):null},getAuthUser:async()=>{let t=await w(T("crud"),{operation:"getAuthUser"}),e=await U(t);return e?e.data!==void 0?G(e.data):e.success===!1?null:G(e):null},join:async(t,e)=>{Ve(t),e?.innerJoin?.collection&&Ve(e.innerJoin.collection);let n=await w(T("crud"),{operation:"join",fleetboTable:t,joinOptions:e}),r=await U(n);return fn("join",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},seed:async(t,e)=>Zo()?Go(Fu(),t,e):{success:!0,seeded:!1,isPrototype:!1},sendotpsvro:async t=>{let e=typeof t=="string"?{email:t}:t||{};return await w(T("sendOtpSvro"),e)},verifyotpsvro:async(t,e)=>{let n=await w(T("verifyOtpSvro"),{email:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await un(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},sendOtpByPhone:async t=>{let e=typeof t=="string"?{phoneNumber:t}:t||{};return await w(T("sendOtpByPhone"),e)},verifyOtpPhoneSvro:async(t,e)=>{let n=await w(T("verifyOtpPhoneSvro"),{phoneNumber:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await un(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},verifyFacebookAuth:(t={})=>new Promise(e=>{let n=typeof t=="string"?t:t?.accessToken,r=async c=>{try{let l=await w(T("verifyFacebookAuth"),{accessToken:c}),o=l.customToken||l.token;if(l.success&&o){let d=await un(o);e({success:!0,user:d,profile:l.profile||null,projects:l.projects||[]})}else e(l)}catch(l){e({success:!1,error:l.message})}};if(n){r(n);return}if(typeof window>"u")return e({success:!1,error:"Not a browser environment."});let i=window;if(!i.FB||!i.__ozmoz_fb_ready||typeof i.FB.login!="function")return Yr(),e({success:!1,error:"The Meta service is starting up. Click the button again."});let s=setTimeout(()=>{e({success:!1,cancelled:!0,error:"Login timed out. The window was closed or blocked."})},12e4),a=t?.scope||"public_profile,email";try{i.FB.login(c=>{if(clearTimeout(s),!c||c.error)return e({success:!1,error:c?.error||"Window closed."});if(c.status==="unknown"||!c.authResponse?.accessToken)return e({success:!1,cancelled:!0,error:"Facebook sign-in cancelled."});r(c.authResponse.accessToken)},{scope:a,return_scopes:!0})}catch(c){clearTimeout(s),e({success:!1,error:c.message})}}),isAuthenticated:async(t=!1)=>await zo(t),logout:async()=>{try{return await Ho(),{success:!0}}catch(t){return{success:!1,error:t.message}}},acl:{grant:async(t,e,n,r="*")=>await w(T("grantAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),revoke:async(t,e,n,r="*")=>await w(T("revokeAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),can:async(t,e,n="*")=>{let r=await w(T("checkAcl"),{action:t,resourceTable:e,resourceId:n});return!!(r&&(r.allowed===!0||r.can===!0))}}},vd=Zr;typeof window<"u"&&(window.oz=Zr,window.OzUI=Xr);typeof globalThis<"u"&&(globalThis.oz=Zr,globalThis.OzUI=Xr);if(typeof window<"u"&&typeof document<"u"){let t=()=>setTimeout(()=>{Zo()||be().catch(()=>{})},400);document.readyState==="complete"?t():window.addEventListener("load",t,{once:!0})}export{Xr as OzUI,vd as default,Zr as oz};
|
|
1
|
+
var va=Object.defineProperty;var B=(t,e,n)=>()=>{if(n)throw n[0];try{return t&&(e=t(t=0)),e}catch(r){throw n=[r],r}};var yi=(t,e)=>{for(var n in e)va(t,n,{get:e[n],enumerable:!0})};var bi,Ei=B(()=>{bi=()=>{}});function ka(){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.")}function O(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Si(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(O())}function ki(){return typeof window<"u"||Fn()}function Fn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Pi(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ri(){let t=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof t=="object"&&t.id!==void 0}function Ci(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function Oi(){let t=O();return t.indexOf("MSIE ")>=0||t.indexOf("Trident/")>=0}function Ni(){try{return typeof indexedDB=="object"}catch{return!1}}function Di(){return new Promise((t,e)=>{try{let n=!0,r="validate-browser-context-for-indexeddb-analytics-module",i=self.indexedDB.open(r);i.onsuccess=()=>{i.result.close(),n||self.indexedDB.deleteDatabase(r),t(!0)},i.onupgradeneeded=()=>{n=!1},i.onerror=()=>{e(i.error?.message||"")}}catch(n){e(n)}})}function Na(t,e){return t.replace(Da,(n,r)=>{let i=e[r];return i!=null?String(i):`<${r}?>`})}function Li(t){for(let e in t)if(Object.prototype.hasOwnProperty.call(t,e))return!1;return!0}function he(t,e){if(t===e)return!0;let n=Object.keys(t),r=Object.keys(e);for(let i of n){if(!r.includes(i))return!1;let s=t[i],a=e[i];if(wi(s)&&wi(a)){if(!he(s,a))return!1}else if(s!==a)return!1}for(let i of r)if(!n.includes(i))return!1;return!0}function wi(t){return t!==null&&typeof t=="object"}function be(t){let e=[];for(let[n,r]of Object.entries(t))Array.isArray(r)?r.forEach(i=>{e.push(encodeURIComponent(n)+"="+encodeURIComponent(i))}):e.push(encodeURIComponent(n)+"="+encodeURIComponent(r));return e.length?"&"+e.join("&"):""}function Le(t){let e={};return t.replace(/^\?/,"").split("&").forEach(r=>{if(r){let[i,s]=r.split("=");e[decodeURIComponent(i)]=decodeURIComponent(s)}}),e}function Me(t){let e=t.indexOf("?");if(!e)return"";let n=t.indexOf("#",e);return t.substring(e,n>0?n:void 0)}function Mi(t,e){let n=new Dn(t,e);return n.subscribe.bind(n)}function La(t,e){if(typeof t!="object"||t===null)return!1;for(let n of e)if(n in t&&typeof t[n]=="function")return!0;return!1}function On(){}function p(t){return t&&t._delegate?t._delegate:t}function St(t){try{return(t.startsWith("http://")||t.startsWith("https://")?new URL(t).hostname:t).endsWith(".cloudworkstations.dev")}catch{return!1}}async function Ui(t){return(await fetch(t,{credentials:"include"})).ok}var Ti,Aa,vi,Nn,Sa,Ln,Xe,Pa,Ra,Ca,Mn,Ai,At,Un,De,Oa,H,Q,Da,Dn,gd,Ue=B(()=>{Ei();Ti=function(t){let e=[],n=0;for(let r=0;r<t.length;r++){let i=t.charCodeAt(r);i<128?e[n++]=i:i<2048?(e[n++]=i>>6|192,e[n++]=i&63|128):(i&64512)===55296&&r+1<t.length&&(t.charCodeAt(r+1)&64512)===56320?(i=65536+((i&1023)<<10)+(t.charCodeAt(++r)&1023),e[n++]=i>>18|240,e[n++]=i>>12&63|128,e[n++]=i>>6&63|128,e[n++]=i&63|128):(e[n++]=i>>12|224,e[n++]=i>>6&63|128,e[n++]=i&63|128)}return e},Aa=function(t){let e=[],n=0,r=0;for(;n<t.length;){let i=t[n++];if(i<128)e[r++]=String.fromCharCode(i);else if(i>191&&i<224){let s=t[n++];e[r++]=String.fromCharCode((i&31)<<6|s&63)}else if(i>239&&i<365){let s=t[n++],a=t[n++],c=t[n++],l=((i&7)<<18|(s&63)<<12|(a&63)<<6|c&63)-65536;e[r++]=String.fromCharCode(55296+(l>>10)),e[r++]=String.fromCharCode(56320+(l&1023))}else{let s=t[n++],a=t[n++];e[r++]=String.fromCharCode((i&15)<<12|(s&63)<<6|a&63)}}return e.join("")},vi={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(t,e){if(!Array.isArray(t))throw Error("encodeByteArray takes an array as a parameter");this.init_();let n=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,r=[];for(let i=0;i<t.length;i+=3){let s=t[i],a=i+1<t.length,c=a?t[i+1]:0,l=i+2<t.length,o=l?t[i+2]:0,u=s>>2,f=(s&3)<<4|c>>4,h=(c&15)<<2|o>>6,m=o&63;l||(m=64,a||(h=64)),r.push(n[u],n[f],n[h],n[m])}return r.join("")},encodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(t):this.encodeByteArray(Ti(t),e)},decodeString(t,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(t):Aa(this.decodeStringToByteArray(t,e))},decodeStringToByteArray(t,e){this.init_();let n=e?this.charToByteMapWebSafe_:this.charToByteMap_,r=[];for(let i=0;i<t.length;){let s=n[t.charAt(i++)],c=i<t.length?n[t.charAt(i)]:0;++i;let o=i<t.length?n[t.charAt(i)]:64;++i;let f=i<t.length?n[t.charAt(i)]:64;if(++i,s==null||c==null||o==null||f==null)throw new Nn;let h=s<<2|c>>4;if(r.push(h),o!==64){let m=c<<4&240|o>>2;if(r.push(m),f!==64){let w=o<<6&192|f;r.push(w)}}}return r},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let t=0;t<this.ENCODED_VALS.length;t++)this.byteToCharMap_[t]=this.ENCODED_VALS.charAt(t),this.charToByteMap_[this.byteToCharMap_[t]]=t,this.byteToCharMapWebSafe_[t]=this.ENCODED_VALS_WEBSAFE.charAt(t),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]]=t,t>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)]=t,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)]=t)}}},Nn=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},Sa=function(t){let e=Ti(t);return vi.encodeByteArray(e,!0)},Ln=function(t){return Sa(t).replace(/\./g,"")},Xe=function(t){try{return vi.decodeString(t,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};Pa=()=>ka().__FIREBASE_DEFAULTS__,Ra=()=>{if(typeof process>"u"||typeof process.env>"u")return;let t=process.env.__FIREBASE_DEFAULTS__;if(t)return JSON.parse(t)},Ca=()=>{if(typeof document>"u")return;let t;try{t=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=t&&Xe(t[1]);return e&&JSON.parse(e)},Mn=()=>{try{return bi()||Pa()||Ra()||Ca()}catch(t){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);return}},Ai=t=>Mn()?.emulatorHosts?.[t],At=()=>Mn()?.config,Un=t=>Mn()?.[`_${t}`];De=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,n)=>{this.resolve=e,this.reject=n})}wrapCallback(e){return(n,r)=>{n?this.reject(n):this.resolve(r),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(n):e(n,r))}}};Oa="FirebaseError",H=class t extends Error{constructor(e,n,r){super(n),this.code=e,this.customData=r,this.name=Oa,Object.setPrototypeOf(this,t.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,Q.prototype.create)}},Q=class{constructor(e,n,r){this.service=e,this.serviceName=n,this.errors=r}create(e,...n){let r=n[0]||{},i=`${this.service}/${e}`,s=this.errors[e],a=s?Na(s,r):"Error",c=`${this.serviceName}: ${a} (${i}).`;return new H(i,c,r)}};Da=/\{\$([^}]+)}/g;Dn=class{constructor(e,n){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=n,this.task.then(()=>{e(this)}).catch(r=>{this.error(r)})}next(e){this.forEachObserver(n=>{n.next(e)})}error(e){this.forEachObserver(n=>{n.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,n,r){let i;if(e===void 0&&n===void 0&&r===void 0)throw new Error("Missing Observer.");La(e,["next","error","complete"])?i=e:i={next:e,error:n,complete:r},i.next===void 0&&(i.next=On),i.error===void 0&&(i.error=On),i.complete===void 0&&(i.complete=On);let 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 n=0;n<this.observers.length;n++)this.sendOne(n,e)}sendOne(e,n){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{n(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}))}};gd=14400*1e3;});function Ma(t){return t===Ee?void 0:t}function Ua(t){return t.instantiationMode==="EAGER"}var q,Ee,xn,Qe,kt=B(()=>{Ue();q=class{constructor(e,n,r){this.name=e,this.instanceFactory=n,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}};Ee="[DEFAULT]";xn=class{constructor(e,n){this.name=e,this.container=n,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let n=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(n)){let r=new De;if(this.instancesDeferred.set(n,r),this.isInitialized(n)||this.shouldAutoInitialize())try{let i=this.getOrInitializeService({instanceIdentifier:n});i&&r.resolve(i)}catch{}}return this.instancesDeferred.get(n).promise}getImmediate(e){let n=this.normalizeInstanceIdentifier(e?.identifier),r=e?.optional??!1;if(this.isInitialized(n)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:n})}catch(i){if(r)return null;throw i}else{if(r)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(Ua(e))try{this.getOrInitializeService({instanceIdentifier:Ee})}catch{}for(let[n,r]of this.instancesDeferred.entries()){let i=this.normalizeInstanceIdentifier(n);try{let s=this.getOrInitializeService({instanceIdentifier:i});r.resolve(s)}catch{}}}}clearInstance(e=Ee){this.instancesDeferred.delete(e),this.instancesOptions.delete(e),this.instances.delete(e)}async delete(){let e=Array.from(this.instances.values());await Promise.all([...e.filter(n=>"INTERNAL"in n).map(n=>n.INTERNAL.delete()),...e.filter(n=>"_delete"in n).map(n=>n._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=Ee){return this.instances.has(e)}getOptions(e=Ee){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:n={}}=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`);let i=this.getOrInitializeService({instanceIdentifier:r,options:n});for(let[s,a]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);r===c&&a.resolve(i)}return i}onInit(e,n){let r=this.normalizeInstanceIdentifier(n),i=this.onInitCallbacks.get(r)??new Set;i.add(e),this.onInitCallbacks.set(r,i);let s=this.instances.get(r);return s&&e(s,r),()=>{i.delete(e)}}invokeOnInitCallbacks(e,n){let r=this.onInitCallbacks.get(n);if(r)for(let i of r)try{i(e,n)}catch{}}getOrInitializeService({instanceIdentifier:e,options:n={}}){let r=this.instances.get(e);if(!r&&this.component&&(r=this.component.instanceFactory(this.container,{instanceIdentifier:Ma(e),options:n}),this.instances.set(e,r),this.instancesOptions.set(e,n),this.invokeOnInitCallbacks(r,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,r)}catch{}return r||null}normalizeInstanceIdentifier(e=Ee){return this.component?this.component.multipleInstances?e:Ee:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};Qe=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let n=this.getProvider(e.name);if(n.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);n.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);let n=new xn(e,this);return this.providers.set(e,n),n}getProviders(){return Array.from(this.providers.values())}}});function xi(t){Vn.forEach(e=>{e.setLogLevel(t)})}function Vi(t,e){for(let n of Vn){let r=null;e&&e.level&&(r=Fi[e.level]),t===null?n.userLogHandler=null:n.userLogHandler=(i,s,...a)=>{let c=a.map(l=>{if(l==null)return null;if(typeof l=="string")return l;if(typeof l=="number"||typeof l=="boolean")return l.toString();if(l instanceof Error)return l.message;try{return JSON.stringify(l)}catch{return null}}).filter(l=>l).join(" ");s>=(r??i.logLevel)&&t({level:g[s].toLowerCase(),message:c,args:a,type:i.name})}}}var Vn,g,Fi,Fa,xa,Va,Fe,Pt=B(()=>{Vn=[];(function(t){t[t.DEBUG=0]="DEBUG",t[t.VERBOSE=1]="VERBOSE",t[t.INFO=2]="INFO",t[t.WARN=3]="WARN",t[t.ERROR=4]="ERROR",t[t.SILENT=5]="SILENT"})(g||(g={}));Fi={debug:g.DEBUG,verbose:g.VERBOSE,info:g.INFO,warn:g.WARN,error:g.ERROR,silent:g.SILENT},Fa=g.INFO,xa={[g.DEBUG]:"log",[g.VERBOSE]:"log",[g.INFO]:"info",[g.WARN]:"warn",[g.ERROR]:"error"},Va=(t,e,...n)=>{if(e<t.logLevel)return;let r=new Date().toISOString(),i=xa[e];if(i)console[i](`[${r}] ${t.name}:`,...n);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Fe=class{constructor(e){this.name=e,this._logLevel=Fa,this._logHandler=Va,this._userLogHandler=null,Vn.push(this)}get logLevel(){return this._logLevel}set logLevel(e){if(!(e in g))throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);this._logLevel=e}setLogLevel(e){this._logLevel=typeof e=="string"?Fi[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,g.DEBUG,...e),this._logHandler(this,g.DEBUG,...e)}log(...e){this._userLogHandler&&this._userLogHandler(this,g.VERBOSE,...e),this._logHandler(this,g.VERBOSE,...e)}info(...e){this._userLogHandler&&this._userLogHandler(this,g.INFO,...e),this._logHandler(this,g.INFO,...e)}warn(...e){this._userLogHandler&&this._userLogHandler(this,g.WARN,...e),this._logHandler(this,g.WARN,...e)}error(...e){this._userLogHandler&&this._userLogHandler(this,g.ERROR,...e),this._logHandler(this,g.ERROR,...e)}}});function Ha(){return Wi||(Wi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function za(){return Hi||(Hi=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function Ba(t){let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("success",s),t.removeEventListener("error",a)},s=()=>{n(K(t.result)),i()},a=()=>{r(t.error),i()};t.addEventListener("success",s),t.addEventListener("error",a)});return e.then(n=>{n instanceof IDBCursor&&zi.set(n,t)}).catch(()=>{}),Bn.set(e,t),e}function $a(t){if(Hn.has(t))return;let e=new Promise((n,r)=>{let i=()=>{t.removeEventListener("complete",s),t.removeEventListener("error",a),t.removeEventListener("abort",a)},s=()=>{n(),i()},a=()=>{r(t.error||new DOMException("AbortError","AbortError")),i()};t.addEventListener("complete",s),t.addEventListener("error",a),t.addEventListener("abort",a)});Hn.set(t,e)}function $i(t){zn=t(zn)}function ja(t){return t===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...n){let r=t.call(Rt(this),e,...n);return Bi.set(r,e.sort?e.sort():[e]),K(r)}:za().includes(t)?function(...e){return t.apply(Rt(this),e),K(zi.get(this))}:function(...e){return K(t.apply(Rt(this),e))}}function Ga(t){return typeof t=="function"?ja(t):(t instanceof IDBTransaction&&$a(t),Wa(t,Ha())?new Proxy(t,zn):t)}function K(t){if(t instanceof IDBRequest)return Ba(t);if(Wn.has(t))return Wn.get(t);let e=Ga(t);return e!==t&&(Wn.set(t,e),Bn.set(e,t)),e}var Wa,Wi,Hi,zi,Hn,Bi,Wn,Bn,zn,Rt,$n=B(()=>{Wa=(t,e)=>e.some(n=>t instanceof n);zi=new WeakMap,Hn=new WeakMap,Bi=new WeakMap,Wn=new WeakMap,Bn=new WeakMap;zn={get(t,e,n){if(t instanceof IDBTransaction){if(e==="done")return Hn.get(t);if(e==="objectStoreNames")return t.objectStoreNames||Bi.get(t);if(e==="store")return n.objectStoreNames[1]?void 0:n.objectStore(n.objectStoreNames[0])}return K(t[e])},set(t,e,n){return t[e]=n,!0},has(t,e){return t instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in t}};Rt=t=>Bn.get(t)});function Gi(t,e,{blocked:n,upgrade:r,blocking:i,terminated:s}={}){let a=indexedDB.open(t,e),c=K(a);return r&&a.addEventListener("upgradeneeded",l=>{r(K(a.result),l.oldVersion,l.newVersion,K(a.transaction),l)}),n&&a.addEventListener("blocked",l=>n(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),i&&l.addEventListener("versionchange",o=>i(o.oldVersion,o.newVersion,o))}).catch(()=>{}),c}function ji(t,e){if(!(t instanceof IDBDatabase&&!(e in t)&&typeof e=="string"))return;if(jn.get(e))return jn.get(e);let n=e.replace(/FromIndex$/,""),r=e!==n,i=Ka.includes(n);if(!(n in(r?IDBIndex:IDBObjectStore).prototype)||!(i||qa.includes(n)))return;let s=async function(a,...c){let l=this.transaction(a,i?"readwrite":"readonly"),o=l.store;return r&&(o=o.index(c.shift())),(await Promise.all([o[n](...c),i&&l.done]))[0]};return jn.set(e,s),s}var qa,Ka,jn,qi=B(()=>{$n();$n();qa=["get","getKey","getAll","getAllKeys","count"],Ka=["put","add","delete","clear"],jn=new Map;$i(t=>({...t,get:(e,n,r)=>ji(e,n)||t.get(e,n,r),has:(e,n)=>!!ji(e,n)||t.has(e,n)}))});function Ja(t){return t.getComponent()?.type==="VERSION"}function Jn(t,e){try{t.container.addComponent(e)}catch(n){ee.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`,n)}}function vc(t,e){t.container.addOrOverwriteComponent(e)}function we(t){let e=t.name;if(Ve.has(e))return ee.debug(`There were multiple attempts to register component ${e}.`),!1;Ve.set(e,t);for(let n of fe.values())Jn(n,t);for(let n of xe.values())Jn(n,t);return!0}function nt(t,e){let n=t.container.getProvider("heartbeat").getImmediate({optional:!0});return n&&n.triggerHeartbeat(),t.container.getProvider(e)}function Ac(t,e,n=et){nt(t,e).clearInstance(n)}function Qn(t){return t.options!==void 0}function Xi(t){return Qn(t)?!1:"authIdToken"in t||"appCheckToken"in t||"releaseOnDeref"in t||"automaticDataCollectionEnabled"in t}function E(t){return t==null?!1:t.settings!==void 0}function Sc(){Ve.clear()}function Ki(t,e){let n=Xe(t.split(".")[1]);if(n===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(n).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let i=JSON.parse(n).exp*1e3,s=new Date().getTime();i-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function Qi(t,e={}){let n=t;typeof e!="object"&&(e={name:e});let r={name:et,automaticDataCollectionEnabled:!0,...e},i=r.name;if(typeof i!="string"||!i)throw V.create("bad-app-name",{appName:String(i)});if(n||(n=At()),!n)throw V.create("no-options");let s=fe.get(i);if(s){if(he(n,s.options)&&he(r,s.config))return s;throw V.create("duplicate-app",{appName:i})}let a=new Qe(i);for(let l of Ve.values())a.addComponent(l);let c=new Ot(n,r,a);return fe.set(i,c),c}function Pc(t,e={}){if(ki()&&!Fn())throw V.create("invalid-server-app-environment");let n,r=e||{};if(t&&(Qn(t)?n=t.options:Xi(t)?r=t:n=t),r.automaticDataCollectionEnabled===void 0&&(r.automaticDataCollectionEnabled=!0),n||(n=At()),!n)throw V.create("no-options");let i={...r,...n};i.releaseOnDeref!==void 0&&delete i.releaseOnDeref;let s=u=>[...u].reduce((f,h)=>Math.imul(31,f)+h.charCodeAt(0)|0,0);if(r.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw V.create("finalization-registry-not-supported",{});let a=""+s(JSON.stringify(i)),c=xe.get(a);if(c)return c.incRefCount(r.releaseOnDeref),c;let l=new Qe(a);for(let u of Ve.values())l.addComponent(u);let o=new Yn(n,r,a,l);return xe.set(a,o),o}function er(t=et){let e=fe.get(t);if(!e&&t===et&&At())return Qi();if(!e)throw V.create("no-app",{appName:t});return e}function Rc(){return Array.from(fe.values())}async function es(t){let e=!1,n=t.name;fe.has(n)?(e=!0,fe.delete(n)):xe.has(n)&&t.decRefCount()<=0&&(xe.delete(n),e=!0),e&&(await Promise.all(t.container.getProviders().map(r=>r.delete())),t.isDeleted=!0)}function J(t,e,n){let r=Tc[t]??t;n&&(r+=`-${n}`);let i=r.match(/\s|\//),s=e.match(/\s|\//);if(i||s){let a=[`Unable to register library "${r}" with version "${e}":`];i&&a.push(`library name "${r}" contains illegal characters (whitespace or "/")`),i&&s&&a.push("and"),s&&a.push(`version name "${e}" contains illegal characters (whitespace or "/")`),ee.warn(a.join(" "));return}we(new q(`${r}-version`,()=>({library:r,version:e}),"VERSION"))}function Cc(t,e){if(t!==null&&typeof t!="function")throw V.create("invalid-log-argument");Vi(t,e)}function Oc(t){xi(t)}function ts(){return Gn||(Gn=Gi(Nc,Dc,{upgrade:(t,e)=>{switch(e){case 0:try{t.createObjectStore(tt)}catch(n){console.warn(n)}}}}).catch(t=>{throw V.create("idb-open",{originalErrorMessage:t.message})})),Gn}async function Lc(t){try{let n=(await ts()).transaction(tt),r=await n.objectStore(tt).get(ns(t));return await n.done,r}catch(e){if(e instanceof H)ee.warn(e.message);else{let n=V.create("idb-get",{originalErrorMessage:e?.message});ee.warn(n.message)}}}async function Ji(t,e){try{let r=(await ts()).transaction(tt,"readwrite");await r.objectStore(tt).put(e,ns(t)),await r.done}catch(n){if(n instanceof H)ee.warn(n.message);else{let r=V.create("idb-set",{originalErrorMessage:n?.message});ee.warn(r.message)}}}function ns(t){return`${t.name}!${t.options.appId}`}function Yi(){return new Date().toISOString().substring(0,10)}function Fc(t,e=Mc){let n=[],r=t.slice();for(let i of t){let s=n.find(a=>a.agent===i.agent);if(s){if(s.dates.push(i.date),Zi(n)>e){s.dates.pop();break}}else if(n.push({agent:i.agent,dates:[i.date]}),Zi(n)>e){n.pop();break}r=r.slice(1)}return{heartbeatsToSend:n,unsentEntries:r}}function Zi(t){return Ln(JSON.stringify({version:2,heartbeats:t})).length}function xc(t){if(t.length===0)return-1;let e=0,n=t[0].date;for(let r=1;r<t.length;r++)t[r].date<n&&(n=t[r].date,e=r);return e}function Vc(t){we(new q("platform-logger",e=>new qn(e),"PRIVATE")),we(new q("heartbeat",e=>new Zn(e),"PRIVATE")),J(Ct,Kn,t),J(Ct,Kn,"esm2020"),J("fire-js","")}var qn,Ct,Kn,ee,Ya,Za,Xa,Qa,ec,tc,nc,rc,ic,sc,oc,ac,cc,lc,uc,dc,hc,fc,pc,mc,gc,_c,Ic,yc,bc,Ec,wc,et,Tc,fe,xe,Ve,kc,V,Ot,Yn,Te,Nc,Dc,tt,Gn,Mc,Uc,Zn,Xn,rt=B(()=>{kt();Pt();Ue();Ue();qi();qn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(n=>{if(Ja(n)){let r=n.getImmediate();return`${r.library}/${r.version}`}else return null}).filter(n=>n).join(" ")}};Ct="@firebase/app",Kn="0.15.1";ee=new Fe("@firebase/app"),Ya="@firebase/app-compat",Za="@firebase/analytics-compat",Xa="@firebase/analytics",Qa="@firebase/app-check-compat",ec="@firebase/app-check",tc="@firebase/auth",nc="@firebase/auth-compat",rc="@firebase/database",ic="@firebase/data-connect",sc="@firebase/database-compat",oc="@firebase/functions",ac="@firebase/functions-compat",cc="@firebase/installations",lc="@firebase/installations-compat",uc="@firebase/messaging",dc="@firebase/messaging-compat",hc="@firebase/performance",fc="@firebase/performance-compat",pc="@firebase/remote-config",mc="@firebase/remote-config-compat",gc="@firebase/storage",_c="@firebase/storage-compat",Ic="@firebase/firestore",yc="@firebase/ai",bc="@firebase/firestore-compat",Ec="firebase",wc="12.16.0";et="[DEFAULT]",Tc={[Ct]:"fire-core",[Ya]:"fire-core-compat",[Xa]:"fire-analytics",[Za]:"fire-analytics-compat",[ec]:"fire-app-check",[Qa]:"fire-app-check-compat",[tc]:"fire-auth",[nc]:"fire-auth-compat",[rc]:"fire-rtdb",[ic]:"fire-data-connect",[sc]:"fire-rtdb-compat",[oc]:"fire-fn",[ac]:"fire-fn-compat",[cc]:"fire-iid",[lc]:"fire-iid-compat",[uc]:"fire-fcm",[dc]:"fire-fcm-compat",[hc]:"fire-perf",[fc]:"fire-perf-compat",[pc]:"fire-rc",[mc]:"fire-rc-compat",[gc]:"fire-gcs",[_c]:"fire-gcs-compat",[Ic]:"fire-fst",[bc]:"fire-fst-compat",[yc]:"fire-vertex","fire-js":"fire-js",[Ec]:"fire-js-all"};fe=new Map,xe=new Map,Ve=new Map;kc={"no-app":"No Firebase App '{$appName}' has been created - call initializeApp() first","bad-app-name":"Illegal App name: '{$appName}'","duplicate-app":"Firebase App named '{$appName}' already exists with different options or config","app-deleted":"Firebase App named '{$appName}' already deleted","server-app-deleted":"Firebase Server App has been deleted","no-options":"Need to provide options, when not being deployed to hosting via source.","invalid-app-argument":"firebase.{$appName}() takes either no argument or a Firebase App instance.","invalid-log-argument":"First argument to `onLog` must be null or a function.","idb-open":"Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.","idb-get":"Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.","idb-set":"Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.","idb-delete":"Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.","finalization-registry-not-supported":"FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.","invalid-server-app-environment":"FirebaseServerApp is not for use in browser environments."},V=new Q("app","Firebase",kc);Ot=class{constructor(e,n,r){this._isDeleted=!1,this._options={...e},this._config={...n},this._name=n.name,this._automaticDataCollectionEnabled=n.automaticDataCollectionEnabled,this._container=r,this.container.addComponent(new q("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 V.create("app-deleted",{appName:this._name})}};Yn=class extends Ot{constructor(e,n,r,i){let s=n.automaticDataCollectionEnabled!==void 0?n.automaticDataCollectionEnabled:!0,a={name:r,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,a,i);else{let c=e;super(c.options,a,i)}this._serverConfig={automaticDataCollectionEnabled:s,...n},this._serverConfig.authIdToken&&Ki(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&Ki(this._serverConfig.appCheckToken,"appCheckToken"),this._finalizationRegistry=null,typeof FinalizationRegistry<"u"&&(this._finalizationRegistry=new FinalizationRegistry(()=>{this.automaticCleanup()})),this._refCount=0,this.incRefCount(this._serverConfig.releaseOnDeref),this._serverConfig.releaseOnDeref=void 0,n.releaseOnDeref=void 0,J(Ct,Kn,"serverapp")}toJSON(){}get refCount(){return this._refCount}incRefCount(e){this.isDeleted||(this._refCount++,e!==void 0&&this._finalizationRegistry!==null&&this._finalizationRegistry.register(e,this))}decRefCount(){return this.isDeleted?0:--this._refCount}automaticCleanup(){es(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw V.create("server-app-deleted")}};Te=wc;Nc="firebase-heartbeat-database",Dc=1,tt="firebase-heartbeat-store",Gn=null;Mc=1024,Uc=30,Zn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let n=this.container.getProvider("app").getImmediate();this._storage=new Xn(n),this._heartbeatsCachePromise=this._storage.read().then(r=>(this._heartbeatsCache=r,r))}async triggerHeartbeat(){try{let n=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),r=Yi();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===r||this._heartbeatsCache.heartbeats.some(i=>i.date===r))return;if(this._heartbeatsCache.heartbeats.push({date:r,agent:n}),this._heartbeatsCache.heartbeats.length>Uc){let i=xc(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(i,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){ee.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=Yi(),{heartbeatsToSend:n,unsentEntries:r}=Fc(this._heartbeatsCache.heartbeats),i=Ln(JSON.stringify({version:2,heartbeats:n}));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}catch(e){return ee.warn(e),""}}};Xn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Ni()?Di().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let n=await Lc(this.app);return n?.heartbeats?n:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Ji(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let r=await this.read();return Ji(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??r.lastSentHeartbeatDate,heartbeats:[...r.heartbeats,...e.heartbeats]})}else return}};Vc("")});var rs={};yi(rs,{FirebaseError:()=>H,SDK_VERSION:()=>Te,_DEFAULT_ENTRY_NAME:()=>et,_addComponent:()=>Jn,_addOrOverwriteComponent:()=>vc,_apps:()=>fe,_clearComponents:()=>Sc,_components:()=>Ve,_getProvider:()=>nt,_isFirebaseApp:()=>Qn,_isFirebaseServerApp:()=>E,_isFirebaseServerAppSettings:()=>Xi,_registerComponent:()=>we,_removeServiceInstance:()=>Ac,_serverApps:()=>xe,deleteApp:()=>es,getApp:()=>er,getApps:()=>Rc,initializeApp:()=>Qi,initializeServerApp:()=>Pc,onLog:()=>Cc,registerVersion:()=>J,setLogLevel:()=>Oc});var Wc,Hc,is=B(()=>{rt();rt();Wc="firebase",Hc="12.16.0";J(Wc,Hc,"app")});function zc(){return{"admin-restricted-operation":"This operation is restricted to administrators only.","argument-error":"","app-not-authorized":"This app, identified by the domain where it's hosted, is not authorized to use Firebase Authentication with the provided API key. Review your key configuration in the Google API console.","app-not-installed":"The requested mobile application corresponding to the identifier (Android package name or iOS bundle ID) provided is not installed on this device.","captcha-check-failed":"The reCAPTCHA response token provided is either invalid, expired, already used or the domain associated with it does not match the list of whitelisted domains.","code-expired":"The SMS code has expired. Please re-send the verification code to try again.","cordova-not-ready":"Cordova framework is not ready.","cors-unsupported":"This browser is not supported.","credential-already-in-use":"This credential is already associated with a different user account.","custom-token-mismatch":"The custom token corresponds to a different audience.","requires-recent-login":"This operation is sensitive and requires recent authentication. Log in again before retrying this request.","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.","dynamic-link-not-activated":"Please activate Dynamic Links in the Firebase Console and agree to the terms and conditions.","email-change-needs-verification":"Multi-factor users must always have a verified email.","email-already-in-use":"The email address is already in use by another account.","emulator-config-failed":'Auth instance has already been used to make a network call. Auth can no longer be configured to use the emulator. Try calling "connectAuthEmulator()" sooner.',"expired-action-code":"The action code has expired.","cancelled-popup-request":"This operation has been cancelled due to another conflicting popup being opened.","internal-error":"An internal AuthError has occurred.","invalid-app-credential":"The phone verification request contains an invalid application verifier. The reCAPTCHA token response is either invalid or expired.","invalid-app-id":"The mobile app identifier is not registered for the current project.","invalid-user-token":"This user's credential isn't valid for this project. This can happen if the user's token has been tampered with, or if the user isn't for the project associated with this API key.","invalid-auth-event":"An internal AuthError has occurred.","invalid-verification-code":"The SMS verification code used to create the phone auth credential is invalid. Please resend the verification code sms and be sure to use the verification code provided by the user.","invalid-continue-uri":"The continue URL provided in the request is invalid.","invalid-cordova-configuration":"The following Cordova plugins must be installed to enable OAuth sign-in: cordova-plugin-buildinfo, cordova-universal-links-plugin, cordova-plugin-browsertab, cordova-plugin-inappbrowser and cordova-plugin-customurlscheme.","invalid-custom-token":"The custom token format is incorrect. Please check the documentation.","invalid-dynamic-link-domain":"The provided dynamic link domain is not configured or authorized for the current project.","invalid-email":"The email address is badly formatted.","invalid-emulator-scheme":"Emulator URL must start with a valid scheme (http:// or https://).","invalid-api-key":"Your API key is invalid, please check you have copied it correctly.","invalid-cert-hash":"The SHA-1 certificate hash provided is invalid.","invalid-credential":"The supplied auth credential is incorrect, malformed or has expired.","invalid-message-payload":"The email template corresponding to this action contains invalid characters in its message. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-multi-factor-session":"The request does not contain a valid proof of first factor successful sign-in.","invalid-oauth-provider":"EmailAuthProvider is not supported for this operation. This operation only supports OAuth providers.","invalid-oauth-client-id":"The OAuth client ID provided is either invalid or does not match the specified API key.","unauthorized-domain":"This domain is not authorized for OAuth operations for your Firebase project. Edit the list of authorized domains from the Firebase console.","invalid-action-code":"The action code is invalid. This can happen if the code is malformed, expired, or has already been used.","wrong-password":"The password is invalid or the user does not have a password.","invalid-persistence-type":"The specified persistence type is invalid. It can only be local, session or none.","invalid-phone-number":"The format of the phone number provided is incorrect. Please enter the phone number in a format that can be parsed into E.164 format. E.164 phone numbers are written in the format [+][country code][subscriber number including area code].","invalid-provider-id":"The specified provider ID is invalid.","invalid-recipient-email":"The email corresponding to this action failed to send as the provided recipient email address is invalid.","invalid-sender":"The email template corresponding to this action contains an invalid sender email or name. Please fix by going to the Auth email templates section in the Firebase Console.","invalid-verification-id":"The verification ID used to create the phone auth credential is invalid.","invalid-tenant-id":"The Auth instance's tenant ID is invalid.","login-blocked":"Login blocked by user-provided method: {$originalMessage}","missing-android-pkg-name":"An Android Package Name must be provided if the Android App is required to be installed.","auth-domain-config-required":"Be sure to include authDomain when calling firebase.initializeApp(), by following the instructions in the Firebase console.","missing-app-credential":"The phone verification request is missing an application verifier assertion. A reCAPTCHA response token needs to be provided.","missing-verification-code":"The phone auth credential was created with an empty SMS verification code.","missing-continue-uri":"A continue URL must be provided in the request.","missing-iframe-start":"An internal AuthError has occurred.","missing-ios-bundle-id":"An iOS Bundle ID must be provided if an App Store ID is provided.","missing-or-invalid-nonce":"The request does not contain a valid nonce. This can occur if the SHA-256 hash of the provided raw nonce does not match the hashed nonce in the ID token payload.","missing-password":"A non-empty password must be provided","missing-multi-factor-info":"No second factor identifier is provided.","missing-multi-factor-session":"The request is missing proof of first factor successful sign-in.","missing-phone-number":"To send verification codes, provide a phone number for the recipient.","missing-verification-id":"The phone auth credential was created with an empty verification ID.","app-deleted":"This instance of FirebaseApp has been deleted.","multi-factor-info-not-found":"The user does not have a second factor matching the identifier provided.","multi-factor-auth-required":"Proof of ownership of a second factor is required to complete sign-in.","account-exists-with-different-credential":"An account already exists with the same email address but different sign-in credentials. Sign in using a provider associated with this email address.","network-request-failed":"A network AuthError (such as timeout, interrupted connection or unreachable host) has occurred.","no-auth-event":"An internal AuthError has occurred.","no-such-provider":"User was not linked to an account with the given provider.","null-user":"A null user object was provided as the argument for an operation which requires a non-null user object.","operation-not-allowed":"The given sign-in provider is disabled for this Firebase project. Enable it in the Firebase console, under the sign-in method tab of the Auth section.","operation-not-supported-in-this-environment":'This operation is not supported in the environment this application is running on. "location.protocol" must be http, https or chrome-extension and web storage must be enabled.',"popup-blocked":"Unable to establish a connection with the popup. It may have been blocked by the browser.","popup-closed-by-user":"The popup has been closed by the user before finalizing the operation.","provider-already-linked":"User can only be linked to one identity for the given provider.","quota-exceeded":"The project's quota for this operation has been exceeded.","redirect-cancelled-by-user":"The redirect operation has been cancelled by the user before finalizing.","redirect-operation-pending":"A redirect sign-in operation is already pending.","rejected-credential":"The request contains malformed or mismatching credentials.","second-factor-already-in-use":"The second factor is already enrolled on this account.","maximum-second-factor-count-exceeded":"The maximum allowed number of second factors on a user has been exceeded.","tenant-id-mismatch":"The provided tenant ID does not match the Auth instance's tenant ID",timeout:"The operation has timed out.","user-token-expired":"The user's credential is no longer valid. The user must sign in again.","too-many-requests":"We have blocked all requests from this device due to unusual activity. Try again later.","unauthorized-continue-uri":"The domain of the continue URL is not whitelisted. Please whitelist the domain in the Firebase console.","unsupported-first-factor":"Enrolling a second factor or signing in with a multi-factor account requires sign-in with a supported first factor.","unsupported-persistence-type":"The current environment does not support the specified persistence type.","unsupported-tenant-operation":"This operation is not supported in a multi-tenant context.","unverified-email":"The operation requires a verified email.","user-cancelled":"The user did not grant your application the permissions it requested.","user-not-found":"There is no user record corresponding to this identifier. The user may have been deleted.","user-disabled":"The user account has been disabled by an administrator.","user-mismatch":"The supplied credentials do not correspond to the previously signed in user.","user-signed-out":"","weak-password":"The password must be 6 characters long or more.","web-storage-unsupported":"This browser is not supported or 3rd party cookies and data may be disabled.","already-initialized":"initializeAuth() has already been called with different options. To avoid this error, call initializeAuth() with the same options as when it was originally called, or call getAuth() to return the already initialized instance.","missing-recaptcha-token":"The reCAPTCHA token is missing when sending request to the backend.","invalid-recaptcha-token":"The reCAPTCHA token is invalid when sending request to the backend.","invalid-recaptcha-action":"The reCAPTCHA action is invalid when sending request to the backend.","recaptcha-not-enabled":"reCAPTCHA Enterprise integration is not enabled for this project.","missing-client-type":"The reCAPTCHA client type is missing when sending request to the backend.","missing-recaptcha-version":"The reCAPTCHA version is missing when sending request to the backend.","invalid-req-type":"Invalid request parameters.","invalid-recaptcha-version":"The reCAPTCHA version is invalid when sending request to the backend.","unsupported-password-policy-schema-version":"The password policy received from the backend uses a schema version that is not supported by this version of the Firebase SDK.","password-does-not-meet-requirements":"The password does not meet the requirements.","invalid-hosting-link-domain":"The provided Hosting link domain is not configured in Firebase Hosting or is not owned by the current project. This cannot be a default Hosting domain (`web.app` or `firebaseapp.com`)."}}function Cs(){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."}}function Bc(t,...e){xt.logLevel<=g.WARN&&xt.warn(`Auth (${Te}): ${t}`,...e)}function Lt(t,...e){xt.logLevel<=g.ERROR&&xt.error(`Auth (${Te}): ${t}`,...e)}function U(t,...e){throw Ur(t,...e)}function D(t,...e){return Ur(t,...e)}function Mr(t,e,n){let r={...Lr(),[e]:n};return new Q("auth","Firebase",r).create(e,{appName:t.name})}function P(t){return Mr(t,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function qe(t,e,n){let r=n;if(!(e instanceof r))throw r.name!==e.constructor.name&&U(t,"argument-error"),Mr(t,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function Ur(t,...e){if(typeof t!="string"){let n=e[0],r=[...e.slice(1)];return r[0]&&(r[0].appName=t.name),t._errorFactory.create(n,...r)}return Ns.create(t,...e)}function d(t,e,...n){if(!t)throw Ur(e,...n)}function Y(t){let e="INTERNAL ASSERTION FAILED: "+t;throw Lt(e),new Error(e)}function re(t,e){t||Y(e)}function ut(){return typeof self<"u"&&self.location?.href||""}function Fr(){return ss()==="http:"||ss()==="https:"}function ss(){return typeof self<"u"&&self.location?.protocol||null}function $c(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(Fr()||Ri()||"connection"in navigator)?navigator.onLine:!0}function jc(){if(typeof navigator>"u")return null;let t=navigator;return t.languages&&t.languages[0]||t.language||null}function xr(t,e){re(t.emulator,"Emulator should always be set here");let{url:n}=t.emulator;return e?`${n}${e.startsWith("/")?e.slice(1):e}`:n}function y(t,e){return t.tenantId&&!e.tenantId?{...e,tenantId:t.tenantId}:e}async function b(t,e,n,r,i={}){return Ls(t,i,async()=>{let s={},a={};r&&(e==="GET"?a=r:s={body:JSON.stringify(r)});let c=be({...a,key:t.config.apiKey}).slice(1),l=await t._getAdditionalHeaders();l["Content-Type"]="application/json",t.languageCode&&(l["X-Firebase-Locale"]=t.languageCode);let o={method:e,headers:l,...s};return Pi()||(o.referrerPolicy="strict-origin-when-cross-origin"),t.emulatorConfig&&St(t.emulatorConfig.host)&&(o.credentials="include"),Vt.fetch()(await Ms(t,t.config.apiHost,n,c),o)})}async function Ls(t,e,n){t._canInitEmulator=!1;let r={...Gc,...e};try{let i=new cr(t),s=await Promise.race([n(),i.promise]);i.clearNetworkTimeout();let a=await s.json();if("needConfirmation"in a)throw st(t,"account-exists-with-different-credential",a);if(s.ok&&!("errorMessage"in a))return a;{let c=s.ok?a.errorMessage:a.error.message,[l,o]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw st(t,"credential-already-in-use",a);if(l==="EMAIL_EXISTS")throw st(t,"email-already-in-use",a);if(l==="USER_DISABLED")throw st(t,"user-disabled",a);let u=r[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(o)throw Mr(t,u,o);U(t,u)}}catch(i){if(i instanceof H)throw i;U(t,"network-request-failed",{message:String(i)})}}async function ae(t,e,n,r,i={}){let s=await b(t,e,n,r,i);return"mfaPendingCredential"in s&&U(t,"multi-factor-auth-required",{_serverResponse:s}),s}async function Ms(t,e,n,r){let i=`${e}${n}?${r}`,s=t,a=s.config.emulator?xr(t.config,i):`${t.config.apiScheme}://${i}`;return qc.includes(n)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(a).toString():a}function Jc(t){switch(t){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function st(t,e,n){let r={appName:t.name};n.email&&(r.email=n.email),n.phoneNumber&&(r.phoneNumber=n.phoneNumber);let i=D(t,e,r);return i.customData._tokenResponse=n,i}function os(t){return t!==void 0&&t.getResponse!==void 0}function as(t){return t!==void 0&&t.enterprise!==void 0}async function Yc(t){return(await b(t,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function Us(t,e){return b(t,"GET","/v2/recaptchaConfig",y(t,e))}async function Zc(t,e){return b(t,"POST","/v1/accounts:delete",e)}async function Xc(t,e){return b(t,"POST","/v1/accounts:update",e)}async function Ht(t,e){return b(t,"POST","/v1/accounts:lookup",e)}function ot(t){if(t)try{let e=new Date(Number(t));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function Fs(t,e=!1){return p(t).getIdToken(e)}async function Vr(t,e=!1){let n=p(t),r=await n.getIdToken(e),i=dn(r);d(i&&i.exp&&i.auth_time&&i.iat,n.auth,"internal-error");let s=typeof i.firebase=="object"?i.firebase:void 0,a=s?.sign_in_provider;return{claims:i,token:r,authTime:ot(tr(i.auth_time)),issuedAtTime:ot(tr(i.iat)),expirationTime:ot(tr(i.exp)),signInProvider:a||null,signInSecondFactor:s?.sign_in_second_factor||null}}function tr(t){return Number(t)*1e3}function dn(t){let[e,n,r]=t.split(".");if(e===void 0||n===void 0||r===void 0)return Lt("JWT malformed, contained fewer than 3 sections"),null;try{let i=Xe(n);return i?JSON.parse(i):(Lt("Failed to decode base64 JWT payload"),null)}catch(i){return Lt("Caught error parsing JWT payload as JSON",i?.toString()),null}}function cs(t){let e=dn(t);return d(e,"internal-error"),d(typeof e.exp<"u","internal-error"),d(typeof e.iat<"u","internal-error"),Number(e.exp)-Number(e.iat)}async function ie(t,e,n=!1){if(n)return e;try{return await e}catch(r){throw r instanceof H&&Qc(r)&&t.auth.currentUser===t&&await t.auth.signOut(),r}}function Qc({code:t}){return t==="auth/user-disabled"||t==="auth/user-token-expired"}async function ht(t){let e=t.auth,n=await t.getIdToken(),r=await ie(t,Ht(e,{idToken:n}));d(r?.users.length,e,"internal-error");let i=r.users[0];t._notifyReloadListener(i);let s=i.providerUserInfo?.length?xs(i.providerUserInfo):[],a=el(t.providerData,s),c=t.isAnonymous,l=!(t.email&&i.passwordHash)&&!a?.length,o=c?l:!1,u={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:a,metadata:new dt(i.createdAt,i.lastLoginAt),isAnonymous:o};Object.assign(t,u)}async function Wr(t){let e=p(t);await ht(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function el(t,e){return[...t.filter(r=>!e.some(i=>i.providerId===r.providerId)),...e]}function xs(t){return t.map(({providerId:e,...n})=>({providerId:e,uid:n.rawId||"",displayName:n.displayName||null,email:n.email||null,phoneNumber:n.phoneNumber||null,photoURL:n.photoUrl||null}))}async function tl(t,e){let n=await Ls(t,{},async()=>{let r=be({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:i,apiKey:s}=t.config,a=await Ms(t,i,"/v1/token",`key=${s}`),c=await t._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:r};return t.emulatorConfig&&St(t.emulatorConfig.host)&&(l.credentials="include"),Vt.fetch()(a,l)});return{accessToken:n.access_token,expiresIn:n.expires_in,refreshToken:n.refresh_token}}async function nl(t,e){return b(t,"POST","/v2/accounts:revokeToken",y(t,e))}function pe(t,e){d(typeof t=="string"||typeof t>"u","internal-error",{appName:e})}function te(t){re(t instanceof Function,"Expected a class definition");let e=ls.get(t);return e?(re(e instanceof t,"Instance stored in cache mismatched with class"),e):(e=new t,ls.set(t,e),e)}function Mt(t,e,n){return`firebase:${t}:${e}:${n}`}function us(t){let e=t.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(zs(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(Vs(e))return"Firefox";if(e.includes("silk/"))return"Silk";if($s(e))return"Blackberry";if(js(e))return"Webos";if(Ws(e))return"Safari";if((e.includes("chrome/")||Hs(e))&&!e.includes("edge/"))return"Chrome";if(Bs(e))return"Android";{let n=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,r=t.match(n);if(r?.length===2)return r[1]}return"Other"}function Vs(t=O()){return/firefox\//i.test(t)}function Ws(t=O()){let e=t.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Hs(t=O()){return/crios\//i.test(t)}function zs(t=O()){return/iemobile/i.test(t)}function Bs(t=O()){return/android/i.test(t)}function $s(t=O()){return/blackberry/i.test(t)}function js(t=O()){return/webos/i.test(t)}function Hr(t=O()){return/iphone|ipad|ipod/i.test(t)||/macintosh/i.test(t)&&/mobile/i.test(t)}function rl(t=O()){return Hr(t)&&!!window.navigator?.standalone}function il(){return Oi()&&document.documentMode===10}function Gs(t=O()){return Hr(t)||Bs(t)||js(t)||$s(t)||/windows phone/i.test(t)||zs(t)}function qs(t,e=[]){let n;switch(t){case"Browser":n=us(O());break;case"Worker":n=`${us(O())}-${t}`;break;default:n=t}let r=e.length?e.join(","):"FirebaseCore-web";return`${n}/JsCore/${Te}/${r}`}async function sl(t,e={}){return b(t,"GET","/v2/passwordPolicy",y(t,e))}function S(t){return p(t)}function al(t){yt=t}function zr(t){return yt.loadJS(t)}function cl(){return yt.recaptchaV2Script}function ll(){return yt.recaptchaEnterpriseScript}function ul(){return yt.gapiScript}function Ks(t){return`__${t}${Math.floor(Math.random()*1e6)}`}function fl(t){let e=[],n="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let r=0;r<t;r++)e.push(n.charAt(Math.floor(Math.random()*n.length)));return e.join("")}async function it(t,e,n,r=!1,i=!1){let s=new ft(t),a;if(i)a=ct;else try{a=await s.verify(n)}catch{a=await s.verify(n,!0)}let c={...e};if(n==="mfaSmsEnrollment"||n==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,o=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:o,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:a,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return r?Object.assign(c,{captchaResp:a}):Object.assign(c,{captchaResponse:a}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ge(t,e,n,r,i){if(i==="EMAIL_PASSWORD_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await it(t,e,n,n==="getOobCode");return r(t,s)}else return r(t,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${n} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let a=await it(t,e,n,n==="getOobCode");return r(t,a)}else return Promise.reject(s)});else if(i==="PHONE_PROVIDER")if(t._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await it(t,e,n);return r(t,s).catch(async a=>{if(t._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(a.code==="auth/missing-recaptcha-token"||a.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${n} flow.`);let c=await it(t,e,n,!1,!0);return r(t,c)}return Promise.reject(a)})}else{let s=await it(t,e,n,!1,!0);return r(t,s)}else return Promise.reject(i+" provider is not supported.")}async function Js(t){let e=S(t),n=await Us(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),r=new Wt(n);e.tenantId==null?e._agentRecaptchaConfig=r:e._tenantRecaptchaConfigs[e.tenantId]=r,r.isAnyProviderEnabled()&&new ft(e).verify()}function Br(t,e){let n=nt(t,"auth");if(n.isInitialized()){let i=n.getImmediate(),s=n.getOptions();if(he(s,e??{}))return i;U(i,"already-initialized")}return n.initialize({options:e})}function ml(t,e){let n=e?.persistence||[],r=(Array.isArray(n)?n:[n]).map(te);e?.errorMap&&t._updateErrorMap(e.errorMap),t._initializeWithPersistence(r,e?.popupRedirectResolver)}function $r(t,e,n){let r=S(t);d(/^https?:\/\//.test(e),r,"invalid-emulator-scheme");let i=!!n?.disableWarnings,s=Ys(e),{host:a,port:c}=gl(e),l=c===null?"":`:${c}`,o={url:`${s}//${a}${l}/`},u=Object.freeze({host:a,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:i})});if(!r._canInitEmulator){d(r.config.emulator&&r.emulatorConfig,r,"emulator-config-failed"),d(he(o,r.config.emulator)&&he(u,r.emulatorConfig),r,"emulator-config-failed");return}r.config.emulator=o,r.emulatorConfig=u,r.settings.appVerificationDisabledForTesting=!0,St(a)?Ui(`${s}//${a}${l}`):i||_l()}function Ys(t){let e=t.indexOf(":");return e<0?"":t.substr(0,e+1)}function gl(t){let e=Ys(t),n=/(\/\/)?([^?#/]+)/.exec(t.substr(e.length));if(!n)return{host:"",port:null};let r=n[2].split("@").pop()||"",i=/^(\[[^\]]+\])(:|$)/.exec(r);if(i){let s=i[1];return{host:s,port:hs(r.substr(s.length+1))}}else{let[s,a]=r.split(":");return{host:s,port:hs(a)}}}function hs(t){if(!t)return null;let e=Number(t);return isNaN(e)?null:e}function _l(){function t(){let e=document.createElement("p"),n=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",n.position="fixed",n.width="100%",n.backgroundColor="#ffffff",n.border=".1em solid #000000",n.color="#b50000",n.bottom="0px",n.left="0px",n.margin="0px",n.zIndex="10000",n.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",t):t())}async function Zs(t,e){return b(t,"POST","/v1/accounts:resetPassword",y(t,e))}async function Il(t,e){return b(t,"POST","/v1/accounts:update",e)}async function yl(t,e){return b(t,"POST","/v1/accounts:signUp",e)}async function bl(t,e){return b(t,"POST","/v1/accounts:update",y(t,e))}async function El(t,e){return ae(t,"POST","/v1/accounts:signInWithPassword",y(t,e))}async function hn(t,e){return b(t,"POST","/v1/accounts:sendOobCode",y(t,e))}async function wl(t,e){return hn(t,e)}async function Tl(t,e){return hn(t,e)}async function vl(t,e){return hn(t,e)}async function Al(t,e){return hn(t,e)}async function Sl(t,e){return ae(t,"POST","/v1/accounts:signInWithEmailLink",y(t,e))}async function kl(t,e){return ae(t,"POST","/v1/accounts:signInWithEmailLink",y(t,e))}async function ne(t,e){return ae(t,"POST","/v1/accounts:signInWithIdp",y(t,e))}async function fs(t,e){return b(t,"POST","/v1/accounts:sendVerificationCode",y(t,e))}async function Rl(t,e){return ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,e))}async function Cl(t,e){let n=await ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,e));if(n.temporaryProof)throw st(t,"account-exists-with-different-credential",n);return n}async function Nl(t,e){let n={...e,operation:"REAUTH"};return ae(t,"POST","/v1/accounts:signInWithPhoneNumber",y(t,n),Ol)}function Dl(t){switch(t){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 Ll(t){let e=Le(Me(t)).link,n=e?Le(Me(e)).deep_link_id:null,r=Le(Me(t)).deep_link_id;return(r?Le(Me(r)).link:null)||r||n||e||t}function Xs(t){return Se.parseLink(t)}async function Qs(t,e){return ae(t,"POST","/v1/accounts:signUp",y(t,e))}function ps(t){return t.providerId?t.providerId:"phoneNumber"in t?"phone":null}async function eo(t){if(E(t.app))return Promise.reject(P(t));let e=S(t);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new j({user:e.currentUser,providerId:null,operationType:"signIn"});let n=await Qs(e,{returnSecureToken:!0}),r=await j._fromIdTokenResponse(e,"signIn",n,!0);return await e._updateCurrentUser(r.user),r}function to(t,e,n,r){return(e==="reauthenticate"?n._getReauthenticationResolver(t):n._getIdTokenResponse(t)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?_r._fromErrorAndOperation(t,s,e,r):s})}function no(t){return new Set(t.map(({providerId:e})=>e).filter(e=>!!e))}async function ro(t,e){let n=p(t);await fn(!0,n,e);let{providerUserInfo:r}=await Xc(n.auth,{idToken:await n.getIdToken(),deleteProvider:[e]}),i=no(r||[]);return n.providerData=n.providerData.filter(s=>i.has(s.providerId)),i.has("phone")||(n.phoneNumber=null),await n.auth._persistUserIfCurrent(n),n}async function jr(t,e,n=!1){let r=await ie(t,e._linkToIdToken(t.auth,await t.getIdToken()),n);return j._forOperation(t,"link",r)}async function fn(t,e,n){await ht(e);let r=no(e.providerData),i=t===!1?"provider-already-linked":"no-such-provider";d(r.has(n)===t,e.auth,i)}async function io(t,e,n=!1){let{auth:r}=t;if(E(r.app))return Promise.reject(P(r));let i="reauthenticate";try{let s=await ie(t,to(r,i,e,t),n);d(s.idToken,r,"internal-error");let a=dn(s.idToken);d(a,r,"internal-error");let{sub:c}=a;return d(t.uid===c,r,"user-mismatch"),j._forOperation(t,i,s)}catch(s){throw s?.code==="auth/user-not-found"&&U(r,"user-mismatch"),s}}async function so(t,e,n=!1){if(E(t.app))return Promise.reject(P(t));let r="signIn",i=await to(t,r,e),s=await j._fromIdTokenResponse(t,r,i);return n||await t._updateCurrentUser(s.user),s}async function bt(t,e){return so(S(t),e)}async function Gr(t,e){let n=p(t);return await fn(!1,n,e.providerId),jr(n,e)}async function qr(t,e){return io(p(t),e)}async function Fl(t,e){return ae(t,"POST","/v1/accounts:signInWithCustomToken",y(t,e))}async function oo(t,e){if(E(t.app))return Promise.reject(P(t));let n=S(t),r=await Fl(n,{token:e,returnSecureToken:!0}),i=await j._fromIdTokenResponse(n,"signIn",r);return await n._updateCurrentUser(i.user),i}function pn(t,e,n){d(n.url?.length>0,t,"invalid-continue-uri"),d(typeof n.dynamicLinkDomain>"u"||n.dynamicLinkDomain.length>0,t,"invalid-dynamic-link-domain"),d(typeof n.linkDomain>"u"||n.linkDomain.length>0,t,"invalid-hosting-link-domain"),e.continueUrl=n.url,e.dynamicLinkDomain=n.dynamicLinkDomain,e.linkDomain=n.linkDomain,e.canHandleCodeInApp=n.handleCodeInApp,n.iOS&&(d(n.iOS.bundleId.length>0,t,"missing-ios-bundle-id"),e.iOSBundleId=n.iOS.bundleId),n.android&&(d(n.android.packageName.length>0,t,"missing-android-pkg-name"),e.androidInstallApp=n.android.installApp,e.androidMinimumVersionCode=n.android.minimumVersion,e.androidPackageName=n.android.packageName)}async function Kr(t){let e=S(t);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ao(t,e,n){let r=S(t),i={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};n&&pn(r,i,n),await ge(r,i,"getOobCode",Tl,"EMAIL_PASSWORD_PROVIDER")}async function co(t,e,n){await Zs(p(t),{oobCode:e,newPassword:n}).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Kr(t),r})}async function lo(t,e){await bl(p(t),{oobCode:e})}async function Jr(t,e){let n=p(t),r=await Zs(n,{oobCode:e}),i=r.requestType;switch(d(i,n,"internal-error"),i){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":d(r.newEmail,n,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":d(r.mfaInfo,n,"internal-error");default:d(r.email,n,"internal-error")}let s=null;return r.mfaInfo&&(s=ke._fromServerResponse(S(n),r.mfaInfo)),{data:{email:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.newEmail:r.email)||null,previousEmail:(r.requestType==="VERIFY_AND_CHANGE_EMAIL"?r.email:r.newEmail)||null,multiFactorInfo:s},operation:i}}async function uo(t,e){let{data:n}=await Jr(p(t),e);return n.email}async function ho(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t),a=await ge(r,{returnSecureToken:!0,email:e,password:n,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",Qs,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&Kr(t),l}),c=await j._fromIdTokenResponse(r,"signIn",a);return await r._updateCurrentUser(c.user),c}function fo(t,e,n){return E(t.app)?Promise.reject(P(t)):bt(p(t),oe.credential(e,n)).catch(async r=>{throw r.code==="auth/password-does-not-meet-requirements"&&Kr(t),r})}async function po(t,e,n){let r=S(t),i={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(a,c){d(c.handleCodeInApp,r,"argument-error"),c&&pn(r,a,c)}s(i,n),await ge(r,i,"getOobCode",vl,"EMAIL_PASSWORD_PROVIDER")}function mo(t,e){return Se.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function go(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=p(t),i=oe.credentialWithLink(e,n||ut());return d(i._tenantId===(r.tenantId||null),r,"tenant-id-mismatch"),bt(r,i)}async function xl(t,e){return b(t,"POST","/v1/accounts:createAuthUri",y(t,e))}async function _o(t,e){let n=Fr()?ut():"http://localhost",r={identifier:e,continueUri:n},{signinMethods:i}=await xl(p(t),r);return i||[]}async function Io(t,e){let n=p(t),i={requestType:"VERIFY_EMAIL",idToken:await t.getIdToken()};e&&pn(n.auth,i,e);let{email:s}=await wl(n.auth,i);s!==t.email&&await t.reload()}async function yo(t,e,n){let r=p(t),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await t.getIdToken(),newEmail:e};n&&pn(r.auth,s,n);let{email:a}=await Al(r.auth,s);a!==t.email&&await t.reload()}async function Vl(t,e){return b(t,"POST","/v1/accounts:update",e)}async function bo(t,{displayName:e,photoURL:n}){if(e===void 0&&n===void 0)return;let r=p(t),s={idToken:await r.getIdToken(),displayName:e,photoUrl:n,returnSecureToken:!0},a=await ie(r,Vl(r.auth,s));r.displayName=a.displayName||null,r.photoURL=a.photoUrl||null;let c=r.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=r.displayName,c.photoURL=r.photoURL),await r._updateTokensIfNecessary(a)}function Eo(t,e){let n=p(t);return E(n.auth.app)?Promise.reject(P(n.auth)):To(n,e,null)}function wo(t,e){return To(p(t),null,e)}async function To(t,e,n){let{auth:r}=t,s={idToken:await t.getIdToken(),returnSecureToken:!0};e&&(s.email=e),n&&(s.password=n);let a=await ie(t,Il(r,s));await t._updateTokensIfNecessary(a,!0)}function Wl(t){if(!t)return null;let{providerId:e}=t,n=t.rawUserInfo?JSON.parse(t.rawUserInfo):{},r=t.isNewUser||t.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&t?.idToken){let i=dn(t.idToken)?.firebase?.sign_in_provider;if(i){let s=i!=="anonymous"&&i!=="custom"?i:null;return new _e(r,s)}}if(!e)return null;switch(e){case"facebook.com":return new br(r,n);case"github.com":return new Er(r,n);case"google.com":return new wr(r,n);case"twitter.com":return new Tr(r,n,t.screenName||null);case"custom":case"anonymous":return new _e(r,null);default:return new _e(r,e,n)}}function vo(t){let{user:e,_tokenResponse:n}=t;return e.isAnonymous&&!n?{providerId:null,isNewUser:!1,profile:null}:Wl(n)}function Ao(t,e){return p(t).setPersistence(e)}function So(t){return Js(t)}async function ko(t,e){return S(t).validatePassword(e)}function Yr(t,e,n,r){return p(t).onIdTokenChanged(e,n,r)}function Zr(t,e,n){return p(t).beforeAuthStateChanged(e,n)}function Po(t,e,n,r){return p(t).onAuthStateChanged(e,n,r)}function Ro(t){p(t).useDeviceLanguage()}function Co(t,e){return p(t).updateCurrentUser(e)}function Oo(t){return p(t).signOut()}function No(t,e){return S(t).revokeAccessToken(e)}async function Do(t){return p(t).delete()}function Lo(t,e){let n=p(t),r=e;return d(e.customData.operationType,n,"argument-error"),d(r.customData._serverResponse?.mfaPendingCredential,n,"argument-error"),vr._fromError(n,r)}function ms(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:start",y(t,e))}function Hl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:finalize",y(t,e))}function zl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:start",y(t,e))}function Bl(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:finalize",y(t,e))}function $l(t,e){return b(t,"POST","/v2/accounts/mfaEnrollment:withdraw",y(t,e))}function Mo(t){let e=p(t);return nr.has(e)||nr.set(e,Ar._fromUser(e)),nr.get(e)}function rr(t){let e=t.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),n=RegExp(`${e}=([^;]+)`);return document.cookie.match(n)?.[1]??null}function ir(t){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${t.split(":")[3]}`}function Kl(t){return Promise.all(t.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(n){return{fulfilled:!1,reason:n}}}))}function gn(t="",e=10){let n="";for(let r=0;r<e;r++)n+=Math.floor(Math.random()*10);return t+n}function k(){return window}function Jl(t){k().location.href=t}function Qr(){return typeof k().WorkerGlobalScope<"u"&&typeof k().importScripts=="function"}async function Yl(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function Zl(){return navigator?.serviceWorker?.controller||null}function Xl(){return Qr()?self:null}function _n(t,e){return t.transaction([rn],e?"readwrite":"readonly").objectStore(rn)}function eu(){let t=indexedDB.deleteDatabase(Fo);return new Pe(t).toPromise()}function Vo(){let t=indexedDB.open(Fo,Ql);return new Promise((e,n)=>{t.addEventListener("error",()=>{n(t.error)}),t.addEventListener("upgradeneeded",()=>{let r=t.result;try{r.createObjectStore(rn,{keyPath:xo})}catch(i){n(i)}}),t.addEventListener("success",async()=>{let r=t.result;r.objectStoreNames.contains(rn)?e(r):(r.close(),await eu(),e(await Vo()))})})}async function gs(t,e,n){let r=_n(t,!0).put({[xo]:e,value:n});return new Pe(r).toPromise()}async function tu(t,e){let n=_n(t,!1).get(e),r=await new Pe(n).toPromise();return r===void 0?null:r.value}function _s(t,e){let n=_n(t,!0).delete(e);return new Pe(n).toPromise()}function Is(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:start",y(t,e))}function iu(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:finalize",y(t,e))}function su(t,e){return b(t,"POST","/v2/accounts/mfaSignIn:finalize",y(t,e))}function au(t){return t.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(t)}function lu(){let t=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}t=()=>e(),window.addEventListener("load",t)}).catch(e=>{throw t&&window.removeEventListener("load",t),e})}async function Wo(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t),i=await In(r,e,p(n));return new pt(i,s=>bt(r,s))}async function Ho(t,e,n){let r=p(t);await fn(!1,r,"phone");let i=await In(r.auth,e,p(n));return new pt(i,s=>Gr(r,s))}async function zo(t,e,n){let r=p(t);if(E(r.auth.app))return Promise.reject(P(r.auth));let i=await In(r.auth,e,p(n));return new pt(i,s=>qr(r,s))}async function In(t,e,n){if(!t._getRecaptchaConfig())try{await Js(t)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let r;if(typeof e=="string"?r={phoneNumber:e}:r=e,"session"in r){let i=r.session;if("phoneNumber"in r){d(i.type==="enroll",t,"internal-error");let s={idToken:i.credential,phoneEnrollmentInfo:{phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ge(t,s,"mfaSmsEnrollment",async(o,u)=>{if(u.phoneEnrollmentInfo.captchaResponse===ct){d(n?.type===lt,o,"argument-error");let f=await or(o,u,n);return ms(o,f)}return ms(o,u)},"PHONE_PROVIDER").catch(o=>Promise.reject(o))).phoneSessionInfo.sessionInfo}else{d(i.type==="signin",t,"internal-error");let s=r.multiFactorHint?.uid||r.multiFactorUid;d(s,t,"missing-multi-factor-info");let a={mfaPendingCredential:i.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ge(t,a,"mfaSmsSignIn",async(u,f)=>{if(f.phoneSignInInfo.captchaResponse===ct){d(n?.type===lt,u,"argument-error");let h=await or(u,f,n);return Is(u,h)}return Is(u,f)},"PHONE_PROVIDER").catch(u=>Promise.reject(u))).phoneResponseInfo.sessionInfo}}else{let i={phoneNumber:r.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ge(t,i,"sendVerificationCode",async(l,o)=>{if(o.captchaResponse===ct){d(n?.type===lt,l,"argument-error");let u=await or(l,o,n);return fs(l,u)}return fs(l,o)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{n?._reset()}}async function Bo(t,e){let n=p(t);if(E(n.auth.app))return Promise.reject(P(n.auth));await jr(n,e)}async function or(t,e,n){d(n.type===lt,t,"argument-error");let r=await n.verify();d(typeof r=="string",t,"argument-error");let i={...e};if("phoneEnrollmentInfo"in i){let s=i.phoneEnrollmentInfo.phoneNumber,a=i.phoneEnrollmentInfo.captchaResponse,c=i.phoneEnrollmentInfo.clientType,l=i.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(i,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:r,captchaResponse:a,clientType:c,recaptchaVersion:l}}),i}else if("phoneSignInInfo"in i){let s=i.phoneSignInInfo.captchaResponse,a=i.phoneSignInInfo.clientType,c=i.phoneSignInInfo.recaptchaVersion;return Object.assign(i,{phoneSignInInfo:{recaptchaToken:r,captchaResponse:s,clientType:a,recaptchaVersion:c}}),i}else return Object.assign(i,{recaptchaToken:r}),i}function Re(t,e){return e?te(e):(d(t._popupRedirectResolver,t,"argument-error"),t._popupRedirectResolver)}function uu(t){return so(t.auth,new mt(t),t.bypassAuthState)}function du(t){let{auth:e,user:n}=t;return d(n,e,"internal-error"),io(n,new mt(t),t.bypassAuthState)}async function hu(t){let{auth:e,user:n}=t;return d(n,e,"internal-error"),jr(n,new mt(t),t.bypassAuthState)}async function $o(t,e,n){if(E(t.app))return Promise.reject(D(t,"operation-not-supported-in-this-environment"));let r=S(t);qe(t,e,$);let i=Re(r,n);return new Ge(r,"signInViaPopup",e,i).executeNotNull()}async function jo(t,e,n){let r=p(t);if(E(r.auth.app))return Promise.reject(D(r.auth,"operation-not-supported-in-this-environment"));qe(r.auth,e,$);let i=Re(r.auth,n);return new Ge(r.auth,"reauthViaPopup",e,i,r).executeNotNull()}async function Go(t,e,n){let r=p(t);qe(r.auth,e,$);let i=Re(r.auth,n);return new Ge(r.auth,"linkViaPopup",e,i,r).executeNotNull()}async function mu(t,e){let n=Ko(e),r=qo(t);if(!await r._isAvailable())return!1;let i=await r._get(n)==="true";return await r._remove(n),i}async function ti(t,e){return qo(t)._set(Ko(e),"true")}function gu(t,e){Ut.set(t._key(),e)}function qo(t){return te(t._redirectPersistence)}function Ko(t){return Mt(pu,t.config.apiKey,t.name)}function Jo(t,e,n){return _u(t,e,n)}async function _u(t,e,n){if(E(t.app))return Promise.reject(P(t));let r=S(t);qe(t,e,$),await r._initializationPromise;let i=Re(r,n);return await ti(i,r),i._openRedirect(r,e,"signInViaRedirect")}function Yo(t,e,n){return Iu(t,e,n)}async function Iu(t,e,n){let r=p(t);if(qe(r.auth,e,$),E(r.auth.app))return Promise.reject(P(r.auth));await r.auth._initializationPromise;let i=Re(r.auth,n);await ti(i,r.auth);let s=await ea(r);return i._openRedirect(r.auth,e,"reauthViaRedirect",s)}function Zo(t,e,n){return yu(t,e,n)}async function yu(t,e,n){let r=p(t);qe(r.auth,e,$),await r.auth._initializationPromise;let i=Re(r.auth,n);await fn(!1,r,e.providerId),await ti(i,r.auth);let s=await ea(r);return i._openRedirect(r.auth,e,"linkViaRedirect",s)}async function Xo(t,e){return await S(t)._initializationPromise,Qo(t,e,!1)}async function Qo(t,e,n=!1){if(E(t.app))return Promise.reject(P(t));let r=S(t),i=Re(r,e),a=await new Rr(r,i,n).execute();return a&&!n&&(delete a.user._redirectEventId,await r._persistUserIfCurrent(a.user),await r._setRedirectUser(null,e)),a}async function ea(t){let e=gn(`${t.uid}:::`);return t._redirectEventId=e,await t.auth._setRedirectUser(t),await t.auth._persistUserIfCurrent(t),e}function ys(t){return[t.type,t.eventId,t.sessionId,t.tenantId].filter(e=>e).join("-")}function ta({type:t,error:e}){return t==="unknown"&&e?.code==="auth/no-auth-event"}function Eu(t){switch(t.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return ta(t);default:return!1}}async function wu(t,e={}){return b(t,"GET","/v1/projects",e)}async function Au(t){if(t.config.emulator)return;let{authorizedDomains:e}=await wu(t);for(let n of e)try{if(Su(n))return}catch{}U(t,"unauthorized-domain")}function Su(t){let e=ut(),{protocol:n,hostname:r}=new URL(e);if(t.startsWith("chrome-extension://")){let a=new URL(t);return a.hostname===""&&r===""?n==="chrome-extension:"&&t.replace("chrome-extension://","")===e.replace("chrome-extension://",""):n==="chrome-extension:"&&a.hostname===r}if(!vu.test(n))return!1;if(Tu.test(t))return r===t;let i=t.replace(/\./g,"\\.");return new RegExp("^(.+\\."+i+"|"+i+")$","i").test(r)}function bs(){let t=k().___jsl;if(t?.H){for(let e of Object.keys(t.H))if(t.H[e].r=t.H[e].r||[],t.H[e].L=t.H[e].L||[],t.H[e].r=[...t.H[e].L],t.CP)for(let n=0;n<t.CP.length;n++)t.CP[n]=null}}function Pu(t){return new Promise((e,n)=>{function r(){bs(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{bs(),n(D(t,"network-request-failed"))},timeout:ku.get()})}if(k().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(k().gapi?.load)r();else{let i=Ks("iframefcb");return k()[i]=()=>{gapi.load?r():n(D(t,"network-request-failed"))},zr(`${ul()}?onload=${i}`).catch(s=>n(s))}}).catch(e=>{throw Ft=null,e})}function Ru(t){return Ft=Ft||Pu(t),Ft}function Mu(t){let e=t.config;d(e.authDomain,t,"auth-domain-config-required");let n=e.emulator?xr(e,Nu):`https://${t.config.authDomain}/${Ou}`,r={apiKey:e.apiKey,appName:t.name,v:Te},i=Lu.get(t.config.apiHost);i&&(r.eid=i);let s=t._getFrameworks();return s.length&&(r.fw=s.join(",")),`${n}?${be(r).slice(1)}`}async function Uu(t){let e=await Ru(t),n=k().gapi;return d(n,t,"internal-error"),e.open({where:document.body,url:Mu(t),messageHandlersFilter:n.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:Du,dontclear:!0},r=>new Promise(async(i,s)=>{await r.restyle({setHideOnLeave:!1});let a=D(t,"network-request-failed"),c=k().setTimeout(()=>{s(a)},Cu.get());function l(){k().clearTimeout(c),i(r)}r.ping(l).then(l,()=>{s(a)})}))}function zu(t,e,n,r=xu,i=Vu){let s=Math.max((window.screen.availHeight-i)/2,0).toString(),a=Math.max((window.screen.availWidth-r)/2,0).toString(),c="",l={...Fu,width:r.toString(),height:i.toString(),top:s,left:a},o=O().toLowerCase();n&&(c=Hs(o)?Wu:n),Vs(o)&&(e=e||Hu,l.scrollbars="yes");let u=Object.entries(l).reduce((h,[m,w])=>`${h}${m}=${w},`,"");if(rl(o)&&c!=="_self")return Bu(e||"",c),new cn(null);let f=window.open(e||"",c,u);d(f,t,"popup-blocked");try{f.focus()}catch{}return new cn(f)}function Bu(t,e){let n=document.createElement("a");n.href=t,n.target=e;let r=document.createEvent("MouseEvent");r.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),n.dispatchEvent(r)}async function Es(t,e,n,r,i,s){d(t.config.authDomain,t,"auth-domain-config-required"),d(t.config.apiKey,t,"invalid-api-key");let a={apiKey:t.config.apiKey,appName:t.name,authType:n,redirectUrl:r,v:Te,eventId:i};if(e instanceof $){e.setDefaultLanguage(t.languageCode),a.providerId=e.providerId||"",Li(e.getCustomParameters())||(a.customParameters=JSON.stringify(e.getCustomParameters()));for(let[u,f]of Object.entries(s||{}))a[u]=f}if(e instanceof Ie){let u=e.getScopes().filter(f=>f!=="");u.length>0&&(a.scopes=u.join(","))}t.tenantId&&(a.tid=t.tenantId);let c=a;for(let u of Object.keys(c))c[u]===void 0&&delete c[u];let l=await t._getAppCheckToken(),o=l?`#${Gu}=${encodeURIComponent(l)}`:"";return`${qu(t)}?${be(c).slice(1)}${o}`}function qu({config:t}){return t.emulator?xr(t,ju):`https://${t.authDomain}/${$u}`}function Dt(t){return typeof t>"u"||t?.length===0}function Ku(t){switch(t){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function Ju(t){we(new q("auth",(e,{options:n})=>{let r=e.getProvider("app").getImmediate(),i=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:a,authDomain:c}=r.options;d(a&&!a.includes(":"),"invalid-api-key",{appName:r.name});let l={apiKey:a,authDomain:c,clientPlatform:t,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:qs(t)},o=new hr(r,i,s,l);return ml(o,n),o},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,n,r)=>{e.getProvider("auth-internal").initialize()})),we(new q("auth-internal",e=>{let n=S(e.getProvider("auth").getImmediate());return(r=>new Dr(r))(n)},"PRIVATE").setInstantiationMode("EXPLICIT")),J(ws,Ts,Ku(t)),J(ws,Ts,"esm2020")}function na(t=er()){let e=nt(t,"auth");if(e.isInitialized())return e.getImmediate();let n=Br(t,{popupRedirectResolver:ni,persistence:[ei,Xr,mn]}),r=Un("authTokenSyncURL");if(r&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(r,location.origin);if(location.origin===s.origin){let a=Xu(s.toString());Zr(n,a,()=>a(n.currentUser)),Yr(n,c=>a(c))}}let i=Ai("auth");return i&&$r(n,`http://${i}`),n}function Qu(){return document.getElementsByTagName("head")?.[0]??document}var As,Ss,ks,Ps,Rs,Os,Lr,Ns,Ds,xt,ve,Vt,Gc,qc,Kc,cr,Wt,lr,dt,at,me,ls,zt,Bt,$t,ur,ol,dr,hr,jt,yt,dl,hl,Nt,fr,pr,mr,gr,pl,ct,ds,ft,se,We,Pl,Z,Ol,Ae,Se,oe,$,Ie,Gt,He,ze,Be,Ml,qt,Ul,Kt,$e,j,_r,ke,Ir,yr,_e,Jt,br,Er,wr,Tr,Yt,vr,Ar,nr,Zt,Xt,jl,Gl,Qt,Xr,ql,en,Uo,tn,mn,nn,Sr,Fo,Ql,rn,xo,Pe,nu,ru,sn,ei,sr,ou,kr,Pr,lt,cu,on,pt,je,mt,an,fu,Ge,pu,Ut,Rr,bu,Cr,Tu,vu,ku,Ft,Cu,Ou,Nu,Du,Lu,Fu,xu,Vu,Wu,Hu,cn,$u,ju,Gu,ar,Or,ni,ln,Nr,gt,_t,un,It,ws,Ts,Dr,Yu,Zu,vs,Xu,ra=B(()=>{rt();Ue();Pt();kt();As={PHONE:"phone",TOTP:"totp"},Ss={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},ks={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Ps={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Rs={EMAIL_SIGNIN:"EMAIL_SIGNIN",PASSWORD_RESET:"PASSWORD_RESET",RECOVER_EMAIL:"RECOVER_EMAIL",REVERT_SECOND_FACTOR_ADDITION:"REVERT_SECOND_FACTOR_ADDITION",VERIFY_AND_CHANGE_EMAIL:"VERIFY_AND_CHANGE_EMAIL",VERIFY_EMAIL:"VERIFY_EMAIL"};Os=zc,Lr=Cs,Ns=new Q("auth","Firebase",Cs()),Ds={ADMIN_ONLY_OPERATION:"auth/admin-restricted-operation",ARGUMENT_ERROR:"auth/argument-error",APP_NOT_AUTHORIZED:"auth/app-not-authorized",APP_NOT_INSTALLED:"auth/app-not-installed",CAPTCHA_CHECK_FAILED:"auth/captcha-check-failed",CODE_EXPIRED:"auth/code-expired",CORDOVA_NOT_READY:"auth/cordova-not-ready",CORS_UNSUPPORTED:"auth/cors-unsupported",CREDENTIAL_ALREADY_IN_USE:"auth/credential-already-in-use",CREDENTIAL_MISMATCH:"auth/custom-token-mismatch",CREDENTIAL_TOO_OLD_LOGIN_AGAIN:"auth/requires-recent-login",DEPENDENT_SDK_INIT_BEFORE_AUTH:"auth/dependent-sdk-initialized-before-auth",DYNAMIC_LINK_NOT_ACTIVATED:"auth/dynamic-link-not-activated",EMAIL_CHANGE_NEEDS_VERIFICATION:"auth/email-change-needs-verification",EMAIL_EXISTS:"auth/email-already-in-use",EMULATOR_CONFIG_FAILED:"auth/emulator-config-failed",EXPIRED_OOB_CODE:"auth/expired-action-code",EXPIRED_POPUP_REQUEST:"auth/cancelled-popup-request",INTERNAL_ERROR:"auth/internal-error",INVALID_API_KEY:"auth/invalid-api-key",INVALID_APP_CREDENTIAL:"auth/invalid-app-credential",INVALID_APP_ID:"auth/invalid-app-id",INVALID_AUTH:"auth/invalid-user-token",INVALID_AUTH_EVENT:"auth/invalid-auth-event",INVALID_CERT_HASH:"auth/invalid-cert-hash",INVALID_CODE:"auth/invalid-verification-code",INVALID_CONTINUE_URI:"auth/invalid-continue-uri",INVALID_CORDOVA_CONFIGURATION:"auth/invalid-cordova-configuration",INVALID_CUSTOM_TOKEN:"auth/invalid-custom-token",INVALID_DYNAMIC_LINK_DOMAIN:"auth/invalid-dynamic-link-domain",INVALID_EMAIL:"auth/invalid-email",INVALID_EMULATOR_SCHEME:"auth/invalid-emulator-scheme",INVALID_IDP_RESPONSE:"auth/invalid-credential",INVALID_LOGIN_CREDENTIALS:"auth/invalid-credential",INVALID_MESSAGE_PAYLOAD:"auth/invalid-message-payload",INVALID_MFA_SESSION:"auth/invalid-multi-factor-session",INVALID_OAUTH_CLIENT_ID:"auth/invalid-oauth-client-id",INVALID_OAUTH_PROVIDER:"auth/invalid-oauth-provider",INVALID_OOB_CODE:"auth/invalid-action-code",INVALID_ORIGIN:"auth/unauthorized-domain",INVALID_PASSWORD:"auth/wrong-password",INVALID_PERSISTENCE:"auth/invalid-persistence-type",INVALID_PHONE_NUMBER:"auth/invalid-phone-number",INVALID_PROVIDER_ID:"auth/invalid-provider-id",INVALID_RECIPIENT_EMAIL:"auth/invalid-recipient-email",INVALID_SENDER:"auth/invalid-sender",INVALID_SESSION_INFO:"auth/invalid-verification-id",INVALID_TENANT_ID:"auth/invalid-tenant-id",MFA_INFO_NOT_FOUND:"auth/multi-factor-info-not-found",MFA_REQUIRED:"auth/multi-factor-auth-required",MISSING_ANDROID_PACKAGE_NAME:"auth/missing-android-pkg-name",MISSING_APP_CREDENTIAL:"auth/missing-app-credential",MISSING_AUTH_DOMAIN:"auth/auth-domain-config-required",MISSING_CODE:"auth/missing-verification-code",MISSING_CONTINUE_URI:"auth/missing-continue-uri",MISSING_IFRAME_START:"auth/missing-iframe-start",MISSING_IOS_BUNDLE_ID:"auth/missing-ios-bundle-id",MISSING_OR_INVALID_NONCE:"auth/missing-or-invalid-nonce",MISSING_MFA_INFO:"auth/missing-multi-factor-info",MISSING_MFA_SESSION:"auth/missing-multi-factor-session",MISSING_PHONE_NUMBER:"auth/missing-phone-number",MISSING_PASSWORD:"auth/missing-password",MISSING_SESSION_INFO:"auth/missing-verification-id",MODULE_DESTROYED:"auth/app-deleted",NEED_CONFIRMATION:"auth/account-exists-with-different-credential",NETWORK_REQUEST_FAILED:"auth/network-request-failed",NULL_USER:"auth/null-user",NO_AUTH_EVENT:"auth/no-auth-event",NO_SUCH_PROVIDER:"auth/no-such-provider",OPERATION_NOT_ALLOWED:"auth/operation-not-allowed",OPERATION_NOT_SUPPORTED:"auth/operation-not-supported-in-this-environment",POPUP_BLOCKED:"auth/popup-blocked",POPUP_CLOSED_BY_USER:"auth/popup-closed-by-user",PROVIDER_ALREADY_LINKED:"auth/provider-already-linked",QUOTA_EXCEEDED:"auth/quota-exceeded",REDIRECT_CANCELLED_BY_USER:"auth/redirect-cancelled-by-user",REDIRECT_OPERATION_PENDING:"auth/redirect-operation-pending",REJECTED_CREDENTIAL:"auth/rejected-credential",SECOND_FACTOR_ALREADY_ENROLLED:"auth/second-factor-already-in-use",SECOND_FACTOR_LIMIT_EXCEEDED:"auth/maximum-second-factor-count-exceeded",TENANT_ID_MISMATCH:"auth/tenant-id-mismatch",TIMEOUT:"auth/timeout",TOKEN_EXPIRED:"auth/user-token-expired",TOO_MANY_ATTEMPTS_TRY_LATER:"auth/too-many-requests",UNAUTHORIZED_DOMAIN:"auth/unauthorized-continue-uri",UNSUPPORTED_FIRST_FACTOR:"auth/unsupported-first-factor",UNSUPPORTED_PERSISTENCE:"auth/unsupported-persistence-type",UNSUPPORTED_TENANT_OPERATION:"auth/unsupported-tenant-operation",UNVERIFIED_EMAIL:"auth/unverified-email",USER_CANCELLED:"auth/user-cancelled",USER_DELETED:"auth/user-not-found",USER_DISABLED:"auth/user-disabled",USER_MISMATCH:"auth/user-mismatch",USER_SIGNED_OUT:"auth/user-signed-out",WEAK_PASSWORD:"auth/weak-password",WEB_STORAGE_UNSUPPORTED:"auth/web-storage-unsupported",ALREADY_INITIALIZED:"auth/already-initialized",RECAPTCHA_NOT_ENABLED:"auth/recaptcha-not-enabled",MISSING_RECAPTCHA_TOKEN:"auth/missing-recaptcha-token",INVALID_RECAPTCHA_TOKEN:"auth/invalid-recaptcha-token",INVALID_RECAPTCHA_ACTION:"auth/invalid-recaptcha-action",MISSING_CLIENT_TYPE:"auth/missing-client-type",MISSING_RECAPTCHA_VERSION:"auth/missing-recaptcha-version",INVALID_RECAPTCHA_VERSION:"auth/invalid-recaptcha-version",INVALID_REQ_TYPE:"auth/invalid-req-type",INVALID_HOSTING_LINK_DOMAIN:"auth/invalid-hosting-link-domain"};xt=new Fe("@firebase/auth");ve=class{constructor(e,n){this.shortDelay=e,this.longDelay=n,re(n>e,"Short delay should be less than long delay!"),this.isMobile=Si()||Ci()}get(){return $c()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};Vt=class{static initialize(e,n,r){this.fetchImpl=e,n&&(this.headersImpl=n),r&&(this.responseImpl=r)}static fetch(){if(this.fetchImpl)return this.fetchImpl;if(typeof self<"u"&&"fetch"in self)return self.fetch;if(typeof globalThis<"u"&&globalThis.fetch)return globalThis.fetch;if(typeof fetch<"u")return fetch;Y("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;if(typeof globalThis<"u"&&globalThis.Headers)return globalThis.Headers;if(typeof Headers<"u")return Headers;Y("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;if(typeof globalThis<"u"&&globalThis.Response)return globalThis.Response;if(typeof Response<"u")return Response;Y("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};Gc={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",INVALID_LOGIN_CREDENTIALS:"invalid-credential",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"};qc=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Kc=new ve(3e4,6e4);cr=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((n,r)=>{this.timer=setTimeout(()=>r(D(this.auth,"network-request-failed")),Kc.get())})}};Wt=class{constructor(e){if(this.siteKey="",this.recaptchaEnforcementState=[],e.recaptchaKey===void 0)throw new Error("recaptchaKey undefined");this.siteKey=e.recaptchaKey.split("/")[3],this.recaptchaEnforcementState=e.recaptchaEnforcementState}getProviderEnforcementState(e){if(!this.recaptchaEnforcementState||this.recaptchaEnforcementState.length===0)return null;for(let n of this.recaptchaEnforcementState)if(n.provider&&n.provider===e)return Jc(n.enforcementState);return null}isProviderEnabled(e){return this.getProviderEnforcementState(e)==="ENFORCE"||this.getProviderEnforcementState(e)==="AUDIT"}isAnyProviderEnabled(){return this.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")||this.isProviderEnabled("PHONE_PROVIDER")}};lr=class{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){if(e){let n=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),n}else{this.errorBackoff=3e4;let r=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,r)}}schedule(e=!1){if(!this.isRunning)return;let n=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},n)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};dt=class{constructor(e,n){this.createdAt=e,this.lastLoginAt=n,this._initializeTime()}_initializeTime(){this.lastSignInTime=ot(this.lastLoginAt),this.creationTime=ot(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};at=class t{constructor(){this.refreshToken=null,this.accessToken=null,this.expirationTime=null}get isExpired(){return!this.expirationTime||Date.now()>this.expirationTime-3e4}updateFromServerResponse(e){d(e.idToken,"internal-error"),d(typeof e.idToken<"u","internal-error"),d(typeof e.refreshToken<"u","internal-error");let n="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):cs(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,n)}updateFromIdToken(e){d(e.length!==0,"internal-error");let n=cs(e);this.updateTokensAndExpiration(e,null,n)}async getToken(e,n=!1){return!n&&this.accessToken&&!this.isExpired?this.accessToken:(d(this.refreshToken,e,"user-token-expired"),this.refreshToken?(await this.refresh(e,this.refreshToken),this.accessToken):null)}clearRefreshToken(){this.refreshToken=null}async refresh(e,n){let{accessToken:r,refreshToken:i,expiresIn:s}=await tl(e,n);this.updateTokensAndExpiration(r,i,Number(s))}updateTokensAndExpiration(e,n,r){this.refreshToken=n||null,this.accessToken=e||null,this.expirationTime=Date.now()+r*1e3}static fromJSON(e,n){let{refreshToken:r,accessToken:i,expirationTime:s}=n,a=new t;return r&&(d(typeof r=="string","internal-error",{appName:e}),a.refreshToken=r),i&&(d(typeof i=="string","internal-error",{appName:e}),a.accessToken=i),s&&(d(typeof s=="number","internal-error",{appName:e}),a.expirationTime=s),a}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 t,this.toJSON())}_performRefresh(){return Y("not implemented")}};me=class t{constructor({uid:e,auth:n,stsTokenManager:r,...i}){this.providerId="firebase",this.proactiveRefresh=new lr(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,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 dt(i.createdAt||void 0,i.lastLoginAt||void 0)}async getIdToken(e){let n=await ie(this,this.stsTokenManager.getToken(this.auth,e));return d(n,this.auth,"internal-error"),this.accessToken!==n&&(this.accessToken=n,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),n}getIdTokenResult(e){return Vr(this,e)}reload(){return Wr(this)}_assign(e){this!==e&&(d(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(n=>({...n})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let n=new t({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return n.metadata._copy(this.metadata),n}_onReload(e){d(!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,n=!1){let r=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),r=!0),n&&await ht(this),await this.auth._persistUserIfCurrent(this),r&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(E(this.auth.app))return Promise.reject(P(this.auth));let e=await this.getIdToken();return await ie(this,Zc(this.auth,{idToken:e})),this.stsTokenManager.clearRefreshToken(),this.auth.signOut()}toJSON(){return{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=>({...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,n){let r=n.displayName??void 0,i=n.email??void 0,s=n.phoneNumber??void 0,a=n.photoURL??void 0,c=n.tenantId??void 0,l=n._redirectEventId??void 0,o=n.createdAt??void 0,u=n.lastLoginAt??void 0,{uid:f,emailVerified:h,isAnonymous:m,providerData:w,stsTokenManager:T}=n;d(f&&T,e,"internal-error");let N=at.fromJSON(this.name,T);d(typeof f=="string",e,"internal-error"),pe(r,e.name),pe(i,e.name),d(typeof h=="boolean",e,"internal-error"),d(typeof m=="boolean",e,"internal-error"),pe(s,e.name),pe(a,e.name),pe(c,e.name),pe(l,e.name),pe(o,e.name),pe(u,e.name);let L=new t({uid:f,auth:e,email:i,emailVerified:h,displayName:r,isAnonymous:m,photoURL:a,phoneNumber:s,tenantId:c,stsTokenManager:N,createdAt:o,lastLoginAt:u});return w&&Array.isArray(w)&&(L.providerData=w.map(R=>({...R}))),l&&(L._redirectEventId=l),L}static async _fromIdTokenResponse(e,n,r=!1){let i=new at;i.updateFromServerResponse(n);let s=new t({uid:n.localId,auth:e,stsTokenManager:i,isAnonymous:r});return await ht(s),s}static async _fromGetAccountInfoResponse(e,n,r){let i=n.users[0];d(i.localId!==void 0,"internal-error");let s=i.providerUserInfo!==void 0?xs(i.providerUserInfo):[],a=!(i.email&&i.passwordHash)&&!s?.length,c=new at;c.updateFromIdToken(r);let l=new t({uid:i.localId,auth:e,stsTokenManager:c,isAnonymous:a}),o={uid:i.localId,displayName:i.displayName||null,photoURL:i.photoUrl||null,email:i.email||null,emailVerified:i.emailVerified||!1,phoneNumber:i.phoneNumber||null,tenantId:i.tenantId||null,providerData:s,metadata:new dt(i.createdAt,i.lastLoginAt),isAnonymous:!(i.email&&i.passwordHash)&&!s?.length};return Object.assign(l,o),l}};ls=new Map;zt=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,n){this.storage[e]=n}async _get(e){let n=this.storage[e];return n===void 0?null:n}async _remove(e){delete this.storage[e]}_addListener(e,n){}_removeListener(e,n){}};zt.type="NONE";Bt=zt;$t=class t{constructor(e,n,r){this.persistence=e,this.auth=n,this.userKey=r;let{config:i,name:s}=this.auth;this.fullUserKey=Mt(this.userKey,i.apiKey,s),this.fullPersistenceKey=Mt("persistence",i.apiKey,s),this.boundEventHandler=n._onStorageEvent.bind(n),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let n=await Ht(this.auth,{idToken:e}).catch(()=>{});return n?me._fromGetAccountInfoResponse(this.auth,n,e):null}return me._fromJSON(this.auth,e)}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;let n=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,n)return this.setCurrentUser(n)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,n,r="authUser"){if(!n.length)return new t(te(Bt),e,r);let i=(await Promise.all(n.map(async o=>{if(await o._isAvailable())return o}))).filter(o=>o),s=i[0]||te(Bt),a=Mt(r,e.config.apiKey,e.name),c=null;for(let o of n)try{let u=await o._get(a);if(u){let f;if(typeof u=="string"){let h=await Ht(e,{idToken:u}).catch(()=>{});if(!h)break;f=await me._fromGetAccountInfoResponse(e,h,u)}else f=me._fromJSON(e,u);o!==s&&(c=f),s=o;break}}catch{}let l=i.filter(o=>o._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new t(s,e,r):(s=l[0],c&&await s._set(a,c.toJSON()),await Promise.all(n.map(async o=>{if(o!==s)try{await o._remove(a)}catch{}})),new t(s,e,r))}};ur=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,n){let r=s=>new Promise((a,c)=>{try{let l=e(s);a(l)}catch(l){c(l)}});r.onAbort=n,this.queue.push(r);let i=this.queue.length-1;return()=>{this.queue[i]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let n=[];try{for(let r of this.queue)await r(e),r.onAbort&&n.push(r.onAbort)}catch(r){n.reverse();for(let i of n)try{i()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:r?.message})}}};ol=6,dr=class{constructor(e){let n=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=n.minPasswordLength??ol,n.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=n.maxPasswordLength),n.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=n.containsLowercaseCharacter),n.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=n.containsUppercaseCharacter),n.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=n.containsNumericCharacter),n.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=n.containsNonAlphanumericCharacter),this.enforcementState=e.enforcementState,this.enforcementState==="ENFORCEMENT_STATE_UNSPECIFIED"&&(this.enforcementState="OFF"),this.allowedNonAlphanumericCharacters=e.allowedNonAlphanumericCharacters?.join("")??"",this.forceUpgradeOnSignin=e.forceUpgradeOnSignin??!1,this.schemaVersion=e.schemaVersion}validatePassword(e){let n={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,n),this.validatePasswordCharacterOptions(e,n),n.isValid&&(n.isValid=n.meetsMinPasswordLength??!0),n.isValid&&(n.isValid=n.meetsMaxPasswordLength??!0),n.isValid&&(n.isValid=n.containsLowercaseLetter??!0),n.isValid&&(n.isValid=n.containsUppercaseLetter??!0),n.isValid&&(n.isValid=n.containsNumericCharacter??!0),n.isValid&&(n.isValid=n.containsNonAlphanumericCharacter??!0),n}validatePasswordLengthOptions(e,n){let r=this.customStrengthOptions.minPasswordLength,i=this.customStrengthOptions.maxPasswordLength;r&&(n.meetsMinPasswordLength=e.length>=r),i&&(n.meetsMaxPasswordLength=e.length<=i)}validatePasswordCharacterOptions(e,n){this.updatePasswordCharacterOptionsStatuses(n,!1,!1,!1,!1);let r;for(let i=0;i<e.length;i++)r=e.charAt(i),this.updatePasswordCharacterOptionsStatuses(n,r>="a"&&r<="z",r>="A"&&r<="Z",r>="0"&&r<="9",this.allowedNonAlphanumericCharacters.includes(r))}updatePasswordCharacterOptionsStatuses(e,n,r,i,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=n)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=r)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=i)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};hr=class{constructor(e,n,r,i){this.app=e,this.heartbeatServiceProvider=n,this.appCheckServiceProvider=r,this.config=i,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new jt(this),this.idTokenSubscription=new jt(this),this.beforeStateQueue=new ur(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=Ns,this._agentRecaptchaConfig=null,this._tenantRecaptchaConfigs={},this._projectPasswordPolicy=null,this._tenantPasswordPolicies={},this._resolvePersistenceManagerAvailable=void 0,this.lastNotifiedUid=void 0,this.languageCode=null,this.tenantId=null,this.settings={appVerificationDisabledForTesting:!1},this.frameworks=[],this.name=e.name,this.clientVersion=i.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,n){return n&&(this._popupRedirectResolver=te(n)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await $t.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(n),this.lastNotifiedUid=this.currentUser?.uid||null,!this._deleted&&(this._isInitialized=!0)}}),this._initializationPromise}async _onStorageEvent(){if(this._deleted)return;let 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 initializeCurrentUserFromIdToken(e){try{let n=await Ht(this,{idToken:e}),r=await me._fromGetAccountInfoResponse(this,n,e);await this.directlySetCurrentUser(r)}catch(n){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",n),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(E(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(a=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(a,a))}):this.directlySetCurrentUser(null)}let n=await this.assertedPersistence.getCurrentUser(),r=n,i=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,a=r?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===a)&&c?.user&&(r=c.user,i=!0)}if(!r)return this.directlySetCurrentUser(null);if(!r._redirectEventId){if(i)try{await this.beforeStateQueue.runMiddleware(r)}catch(s){r=n,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return r?this.reloadAndSetCurrentUserOrClear(r):this.directlySetCurrentUser(null)}return d(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 n=null;try{n=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return n}async reloadAndSetCurrentUserOrClear(e){try{await ht(e)}catch(n){if(n?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=jc()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(E(this.app))return Promise.reject(P(this));let n=e?p(e):null;return n&&d(n.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(n&&n._clone(this))}async _updateCurrentUser(e,n=!1){if(!this._deleted)return e&&d(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),n||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return E(this.app)?Promise.reject(P(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return E(this.app)?Promise.reject(P(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence(te(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let n=this._getPasswordPolicyInternal();return n.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):n.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await sl(this),n=new dr(e);this.tenantId===null?this._projectPasswordPolicy=n:this._tenantPasswordPolicies[this.tenantId]=n}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new Q("auth","Firebase",e())}onAuthStateChanged(e,n,r){return this.registerStateListener(this.authStateSubscription,e,n,r)}beforeAuthStateChanged(e,n){return this.beforeStateQueue.pushCallback(e,n)}onIdTokenChanged(e,n,r){return this.registerStateListener(this.idTokenSubscription,e,n,r)}authStateReady(){return new Promise((e,n)=>{if(this.currentUser)e();else{let r=this.onAuthStateChanged(()=>{r(),e()},n)}})}async revokeAccessToken(e){if(this.currentUser){let n=await this.currentUser.getIdToken(),r={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:n};this.tenantId!=null&&(r.tenantId=this.tenantId),await nl(this,r)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,n){let r=await this.getOrInitRedirectPersistenceManager(n);return e===null?r.removeCurrentUser():r.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let n=e&&te(e)||this._popupRedirectResolver;d(n,this,"argument-error"),this.redirectPersistenceManager=await $t.create(this,[te(n._redirectPersistence)],"redirectUser"),this.redirectUser=await this.redirectPersistenceManager.getCurrentUser()}return this.redirectPersistenceManager}async _redirectUserForId(e){return this._isInitialized&&await this.queue(async()=>{}),this._currentUser?._redirectEventId===e?this._currentUser:this.redirectUser?._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(){if(!this._isInitialized)return;this.idTokenSubscription.next(this.currentUser);let e=this.currentUser?.uid??null;this.lastNotifiedUid!==e&&(this.lastNotifiedUid=e,this.authStateSubscription.next(this.currentUser))}registerStateListener(e,n,r,i){if(this._deleted)return()=>{};let s=typeof n=="function"?n:n.next.bind(n),a=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(d(c,this,"internal-error"),c.then(()=>{a||s(this.currentUser)}),typeof n=="function"){let l=e.addObserver(n,r,i);return()=>{a=!0,l()}}else{let l=e.addObserver(n);return()=>{a=!0,l()}}}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 d(this.persistenceManager,this,"internal-error"),this.persistenceManager}_logFramework(e){!e||this.frameworks.includes(e)||(this.frameworks.push(e),this.frameworks.sort(),this.clientVersion=qs(this.config.clientPlatform,this._getFrameworks()))}_getFrameworks(){return this.frameworks}async _getAdditionalHeaders(){let e={"X-Client-Version":this.clientVersion};this.app.options.appId&&(e["X-Firebase-gmpid"]=this.app.options.appId);let n=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();n&&(e["X-Firebase-Client"]=n);let r=await this._getAppCheckToken();return r&&(e["X-Firebase-AppCheck"]=r),e}async _getAppCheckToken(){if(E(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&Bc(`Error while retrieving App Check token: ${e.error}`),e?.token}};jt=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Mi(n=>this.observer=n)}get next(){return d(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};yt={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};dl=500,hl=6e4,Nt=1e12,fr=class{constructor(e){this.auth=e,this.counter=Nt,this._widgets=new Map}render(e,n){let r=this.counter;return this._widgets.set(r,new gr(e,this.auth.name,n||{})),this.counter++,r}reset(e){let n=e||Nt;this._widgets.get(n)?.delete(),this._widgets.delete(n)}getResponse(e){let n=e||Nt;return this._widgets.get(n)?.getResponse()||""}async execute(e){let n=e||Nt;return this._widgets.get(n)?.execute(),""}},pr=class{constructor(){this.enterprise=new mr}ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},mr=class{ready(e){e()}execute(e,n){return Promise.resolve("token")}render(e,n){return""}},gr=class{constructor(e,n,r){this.params=r,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let i=typeof e=="string"?document.getElementById(e):e;d(i,"argument-error",{appName:n}),this.container=i,this.isVisible=this.params.size!=="invisible",this.isVisible?this.execute():this.container.addEventListener("click",this.clickHandler)}getResponse(){return this.checkIfDeleted(),this.responseToken}delete(){this.checkIfDeleted(),this.deleted=!0,this.timerId&&(clearTimeout(this.timerId),this.timerId=null),this.container.removeEventListener("click",this.clickHandler)}execute(){this.checkIfDeleted(),!this.timerId&&(this.timerId=window.setTimeout(()=>{this.responseToken=fl(50);let{callback:e,"expired-callback":n}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,n)try{n()}catch{}this.isVisible&&this.execute()},hl)},dl))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};pl="recaptcha-enterprise",ct="NO_RECAPTCHA",ds="onFirebaseAuthREInstanceReady",ft=class t{constructor(e){this.type=pl,this.auth=S(e)}async verify(e="verify",n=!1){async function r(s){if(!n){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(a,c)=>{Us(s,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}).then(l=>{if(l.recaptchaKey===void 0)c(new Error("recaptcha Enterprise site key undefined"));else{let o=new Wt(l);return s.tenantId==null?s._agentRecaptchaConfig=o:s._tenantRecaptchaConfigs[s.tenantId]=o,a(o.siteKey)}}).catch(l=>{c(l)})})}function i(s,a,c){let l=window.grecaptcha;as(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(o=>{a(o)}).catch(()=>{a(ct)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new pr().execute("siteKey",{action:"verify"}):new Promise((s,a)=>{r(this.auth).then(async c=>{if(!n&&as(window.grecaptcha)&&t.scriptInjectionDeferred)await t.scriptInjectionDeferred.promise,i(c,s,a);else{if(typeof window>"u"){a(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ll();l.length!==0&&(l+=c+`&onload=${ds}`),t.scriptInjectionDeferred=new De,window[ds]=()=>{t.scriptInjectionDeferred?.resolve()},zr(l).then(()=>t.scriptInjectionDeferred?.promise).then(()=>{i(c,s,a)}).catch(o=>{a(o)})}}).catch(c=>{a(c)})})}};ft.scriptInjectionDeferred=null;se=class{constructor(e,n){this.providerId=e,this.signInMethod=n}toJSON(){return Y("not implemented")}_getIdTokenResponse(e){return Y("not implemented")}_linkToIdToken(e,n){return Y("not implemented")}_getReauthenticationResolver(e){return Y("not implemented")}};We=class t extends se{constructor(e,n,r,i=null){super("password",r),this._email=e,this._password=n,this._tenantId=i}static _fromEmailAndPassword(e,n){return new t(e,n,"password")}static _fromEmailAndCode(e,n,r=null){return new t(e,n,"emailLink",r)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;if(n?.email&&n?.password){if(n.signInMethod==="password")return this._fromEmailAndPassword(n.email,n.password);if(n.signInMethod==="emailLink")return this._fromEmailAndCode(n.email,n.password,n.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let n={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ge(e,n,"signInWithPassword",El,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Sl(e,{email:this._email,oobCode:this._password});default:U(e,"internal-error")}}async _linkToIdToken(e,n){switch(this.signInMethod){case"password":let r={idToken:n,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ge(e,r,"signUpPassword",yl,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return kl(e,{idToken:n,email:this._email,oobCode:this._password});default:U(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};Pl="http://localhost",Z=class t extends se{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let n=new t(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(n.idToken=e.idToken),e.accessToken&&(n.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(n.nonce=e.nonce),e.pendingToken&&(n.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(n.accessToken=e.oauthToken,n.secret=e.oauthTokenSecret):U("argument-error"),n}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){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,...s}=n;if(!r||!i)return null;let a=new t(r,i);return a.idToken=s.idToken||void 0,a.accessToken=s.accessToken||void 0,a.secret=s.secret,a.nonce=s.nonce,a.pendingToken=s.pendingToken||null,a}_getIdTokenResponse(e){let n=this.buildRequest();return ne(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,ne(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,ne(e,n)}buildRequest(){let e={requestUri:Pl,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let n={};this.idToken&&(n.id_token=this.idToken),this.accessToken&&(n.access_token=this.accessToken),this.secret&&(n.oauth_token_secret=this.secret),n.providerId=this.providerId,this.nonce&&!this.pendingToken&&(n.nonce=this.nonce),e.postBody=be(n)}return e}};Ol={USER_NOT_FOUND:"user-not-found"};Ae=class t extends se{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,n){return new t({verificationId:e,verificationCode:n})}static _fromTokenResponse(e,n){return new t({phoneNumber:e,temporaryProof:n})}_getIdTokenResponse(e){return Rl(e,this._makeVerificationRequest())}_linkToIdToken(e,n){return Cl(e,{idToken:n,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Nl(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:n,verificationId:r,verificationCode:i}=this.params;return e&&n?{temporaryProof:e,phoneNumber:n}:{sessionInfo:r,code:i}}toJSON(){let 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){typeof e=="string"&&(e=JSON.parse(e));let{verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s}=e;return!r&&!n&&!i&&!s?null:new t({verificationId:n,verificationCode:r,phoneNumber:i,temporaryProof:s})}};Se=class t{constructor(e){let n=Le(Me(e)),r=n.apiKey??null,i=n.oobCode??null,s=Dl(n.mode??null);d(r&&i&&s,"argument-error"),this.apiKey=r,this.operation=s,this.code=i,this.continueUrl=n.continueUrl??null,this.languageCode=n.lang??null,this.tenantId=n.tenantId??null}static parseLink(e){let n=Ll(e);try{return new t(n)}catch{return null}}};oe=class t{constructor(){this.providerId=t.PROVIDER_ID}static credential(e,n){return We._fromEmailAndPassword(e,n)}static credentialWithLink(e,n){let r=Se.parseLink(n);return d(r,"argument-error"),We._fromEmailAndCode(e,r.code,r.tenantId)}};oe.PROVIDER_ID="password";oe.EMAIL_PASSWORD_SIGN_IN_METHOD="password";oe.EMAIL_LINK_SIGN_IN_METHOD="emailLink";$=class{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}};Ie=class extends ${constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},Gt=class t extends Ie{static credentialFromJSON(e){let n=typeof e=="string"?JSON.parse(e):e;return d("providerId"in n&&"signInMethod"in n,"argument-error"),Z._fromParams(n)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return d(e.idToken||e.accessToken,"argument-error"),Z._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return t.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return t.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r,oauthTokenSecret:i,pendingToken:s,nonce:a,providerId:c}=e;if(!r&&!i&&!n&&!s||!c)return null;try{return new t(c)._credential({idToken:n,accessToken:r,nonce:a,pendingToken:s})}catch{return null}}};He=class t extends Ie{constructor(){super("facebook.com")}static credential(e){return Z._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};He.FACEBOOK_SIGN_IN_METHOD="facebook.com";He.PROVIDER_ID="facebook.com";ze=class t extends Ie{constructor(){super("google.com"),this.addScope("profile")}static credential(e,n){return Z._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:n,oauthAccessToken:r}=e;if(!n&&!r)return null;try{return t.credential(n,r)}catch{return null}}};ze.GOOGLE_SIGN_IN_METHOD="google.com";ze.PROVIDER_ID="google.com";Be=class t extends Ie{constructor(){super("github.com")}static credential(e){return Z._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return t.credential(e.oauthAccessToken)}catch{return null}}};Be.GITHUB_SIGN_IN_METHOD="github.com";Be.PROVIDER_ID="github.com";Ml="http://localhost",qt=class t extends se{constructor(e,n){super(e,e),this.pendingToken=n}_getIdTokenResponse(e){let n=this.buildRequest();return ne(e,n)}_linkToIdToken(e,n){let r=this.buildRequest();return r.idToken=n,ne(e,r)}_getReauthenticationResolver(e){let n=this.buildRequest();return n.autoCreate=!1,ne(e,n)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let n=typeof e=="string"?JSON.parse(e):e,{providerId:r,signInMethod:i,pendingToken:s}=n;return!r||!i||!s||r!==i?null:new t(r,s)}static _create(e,n){return new t(e,n)}buildRequest(){return{requestUri:Ml,returnSecureToken:!0,pendingToken:this.pendingToken}}};Ul="saml.",Kt=class t extends ${constructor(e){d(e.startsWith(Ul),"argument-error"),super(e)}static credentialFromResult(e){return t.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return t.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let n=qt.fromJSON(e);return d(n,"argument-error"),n}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:n,providerId:r}=e;if(!n||!r)return null;try{return qt._create(r,n)}catch{return null}}};$e=class t extends Ie{constructor(){super("twitter.com")}static credential(e,n){return Z._fromParams({providerId:t.PROVIDER_ID,signInMethod:t.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:n})}static credentialFromResult(e){return t.credentialFromTaggedObject(e)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:n,oauthTokenSecret:r}=e;if(!n||!r)return null;try{return t.credential(n,r)}catch{return null}}};$e.TWITTER_SIGN_IN_METHOD="twitter.com";$e.PROVIDER_ID="twitter.com";j=class t{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,n,r,i=!1){let s=await me._fromIdTokenResponse(e,r,i),a=ps(r);return new t({user:s,providerId:a,_tokenResponse:r,operationType:n})}static async _forOperation(e,n,r){await e._updateTokensIfNecessary(r,!0);let i=ps(r);return new t({user:e,providerId:i,_tokenResponse:r,operationType:n})}};_r=class t extends H{constructor(e,n,r,i){super(n.code,n.message),this.operationType=r,this.user=i,Object.setPrototypeOf(this,t.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:n.customData._serverResponse,operationType:r}}static _fromErrorAndOperation(e,n,r,i){return new t(e,n,r,i)}};ke=class{constructor(e,n){this.factorId=e,this.uid=n.mfaEnrollmentId,this.enrollmentTime=new Date(n.enrolledAt).toUTCString(),this.displayName=n.displayName}static _fromServerResponse(e,n){return"phoneInfo"in n?Ir._fromServerResponse(e,n):"totpInfo"in n?yr._fromServerResponse(e,n):U(e,"internal-error")}},Ir=class t extends ke{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,n){return new t(n)}},yr=class t extends ke{constructor(e){super("totp",e)}static _fromServerResponse(e,n){return new t(n)}};_e=class{constructor(e,n,r={}){this.isNewUser=e,this.providerId=n,this.profile=r}},Jt=class extends _e{constructor(e,n,r,i){super(e,n,r),this.username=i}},br=class extends _e{constructor(e,n){super(e,"facebook.com",n)}},Er=class extends Jt{constructor(e,n){super(e,"github.com",n,typeof n?.login=="string"?n?.login:null)}},wr=class extends _e{constructor(e,n){super(e,"google.com",n)}},Tr=class extends Jt{constructor(e,n,r){super(e,"twitter.com",n,r)}};Yt=class t{constructor(e,n,r){this.type=e,this.credential=n,this.user=r}static _fromIdtoken(e,n){return new t("enroll",e,n)}static _fromMfaPendingCredential(e){return new t("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return t._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return t._fromIdtoken(e.multiFactorSession.idToken)}return null}};vr=class t{constructor(e,n,r){this.session=e,this.hints=n,this.signInResolver=r}static _fromError(e,n){let r=S(e),i=n.customData._serverResponse,s=(i.mfaInfo||[]).map(c=>ke._fromServerResponse(r,c));d(i.mfaPendingCredential,r,"internal-error");let a=Yt._fromMfaPendingCredential(i.mfaPendingCredential);return new t(a,s,async c=>{let l=await c._process(r,a);delete i.mfaInfo,delete i.mfaPendingCredential;let o={...i,idToken:l.idToken,refreshToken:l.refreshToken};switch(n.operationType){case"signIn":let u=await j._fromIdTokenResponse(r,n.operationType,o);return await r._updateCurrentUser(u.user),u;case"reauthenticate":return d(n.user,r,"internal-error"),j._forOperation(n.user,n.operationType,o);default:U(r,"internal-error")}})}async resolveSignIn(e){let n=e;return this.signInResolver(n)}};Ar=class t{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(n=>{n.mfaInfo&&(this.enrolledFactors=n.mfaInfo.map(r=>ke._fromServerResponse(e.auth,r)))})}static _fromUser(e){return new t(e)}async getSession(){return Yt._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,n){let r=e,i=await this.getSession(),s=await ie(this.user,r._process(this.user.auth,i,n));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let n=typeof e=="string"?e:e.uid,r=await this.user.getIdToken();try{let i=await ie(this.user,$l(this.user.auth,{idToken:r,mfaEnrollmentId:n}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==n),await this.user._updateTokensIfNecessary(i),await this.user.reload()}catch(i){throw i}}},nr=new WeakMap;Zt="__sak";Xt=class{constructor(e,n){this.storageRetriever=e,this.type=n}_isAvailable(){try{return this.storage?(this.storage.setItem(Zt,"1"),this.storage.removeItem(Zt),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,n){return this.storage.setItem(e,JSON.stringify(n)),Promise.resolve()}_get(e){let n=this.storage.getItem(e);return Promise.resolve(n?JSON.parse(n):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};jl=1e3,Gl=10,Qt=class extends Xt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,n)=>this.onStorageEvent(e,n),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Gs(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let n of Object.keys(this.listeners)){let r=this.storage.getItem(n),i=this.localCache[n];r!==i&&e(n,i,r)}}onStorageEvent(e,n=!1){if(!e.key){this.forAllChangedKeys((a,c,l)=>{this.notifyListeners(a,l)});return}let r=e.key;n?this.detachListener():this.stopPolling();let i=()=>{let a=this.storage.getItem(r);!n&&this.localCache[r]===a||this.notifyListeners(r,a)},s=this.storage.getItem(r);il()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(i,Gl):i()}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n&&JSON.parse(n))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,n,r)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:n,newValue:r}),!0)})},jl)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,n){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(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,n){await super._set(e,n),this.localCache[e]=JSON.stringify(n)}async _get(e){let n=await super._get(e);return this.localCache[e]=JSON.stringify(n),n}async _remove(e){await super._remove(e),delete this.localCache[e]}};Qt.type="LOCAL";Xr=Qt;ql=1e3;en=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let n=new URL(`${window.location.origin}/__cookies__`);return n.searchParams.set("finalTarget",e),n}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,n){}async _get(e){if(!this._isAvailable())return null;let n=ir(e);return window.cookieStore?(await window.cookieStore.get(n))?.value:rr(n)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let r=ir(e);document.cookie=`${r}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,n){if(!this._isAvailable())return;let r=ir(e);if(window.cookieStore){let c=(o=>{let u=o.changed.find(h=>h.name===r);u&&n(u.value),o.deleted.find(h=>h.name===r)&&n(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(n,l),window.cookieStore.addEventListener("change",c)}let i=rr(r),s=setInterval(()=>{let c=rr(r);c!==i&&(n(c),i=c)},ql),a=()=>clearInterval(s);this.listenerUnsubscribes.set(n,a)}_removeListener(e,n){let r=this.listenerUnsubscribes.get(n);r&&(r(),this.listenerUnsubscribes.delete(n))}};en.type="COOKIE";Uo=en;tn=class extends Xt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,n){}_removeListener(e,n){}};tn.type="SESSION";mn=tn;nn=class t{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let n=this.receivers.find(i=>i.isListeningto(e));if(n)return n;let r=new t(e);return this.receivers.push(r),r}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let n=e,{eventId:r,eventType:i,data:s}=n.data,a=this.handlersMap[i];if(!a?.size)return;n.ports[0].postMessage({status:"ack",eventId:r,eventType:i});let c=Array.from(a).map(async o=>o(n.origin,s)),l=await Kl(c);n.ports[0].postMessage({status:"done",eventId:r,eventType:i,response:l})}_subscribe(e,n){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(n)}_unsubscribe(e,n){this.handlersMap[e]&&n&&this.handlersMap[e].delete(n),(!n||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};nn.receivers=[];Sr=class{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,n,r=50){let i=typeof MessageChannel<"u"?new MessageChannel:null;if(!i)throw new Error("connection_unavailable");let s,a;return new Promise((c,l)=>{let o=gn("",20);i.port1.start();let u=setTimeout(()=>{l(new Error("unsupported_event"))},r);a={messageChannel:i,onMessage(f){let h=f;if(h.data.eventId===o)switch(h.data.status){case"ack":clearTimeout(u),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(h.data.response);break;default:clearTimeout(u),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(a),i.port1.addEventListener("message",a.onMessage),this.target.postMessage({eventType:e,eventId:o,data:n},[i.port2])}).finally(()=>{a&&this.removeMessageHandler(a)})}};Fo="firebaseLocalStorageDb",Ql=1,rn="firebaseLocalStorage",xo="fbase_key",Pe=class{constructor(e){this.request=e}toPromise(){return new Promise((e,n)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{n(this.request.error)})})}};nu=800,ru=3,sn=class{constructor(){this.type="LOCAL",this.dbPromise=null,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.dbPromise?this.dbPromise:(this.dbPromise=Vo(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let n=0;for(;;)try{let r=await this._openDb();return await e(r)}catch(r){if(n++>ru)throw r;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Qr()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=nn._getInstance(Xl()),this.receiver._subscribe("keyChanged",async(e,n)=>({keyProcessed:(await this._poll()).includes(n.key)})),this.receiver._subscribe("ping",async(e,n)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await Yl(),!this.activeServiceWorker)return;this.sender=new Sr(this.activeServiceWorker);let e=await this.sender._send("ping",{},800);e&&e[0]?.fulfilled&&e[0]?.value.includes("keyChanged")&&(this.serviceWorkerReceiverAvailable=!0)}async notifyServiceWorker(e){if(!(!this.sender||!this.activeServiceWorker||Zl()!==this.activeServiceWorker))try{await this.sender._send("keyChanged",{key:e},this.serviceWorkerReceiverAvailable?800:50)}catch{}}async _isAvailable(){try{return indexedDB?(await this._withRetries(async e=>{await gs(e,Zt,"1"),await _s(e,Zt)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,n){return this._withPendingWrite(async()=>(await this._withRetries(r=>gs(r,e,n)),this.localCache[e]=n,this.notifyServiceWorker(e)))}async _get(e){let n=await this._withRetries(r=>tu(r,e));return this.localCache[e]=n,n}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(n=>_s(n,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(i=>{let s=_n(i,!1).getAll();return new Pe(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let n=[],r=new Set;if(e.length!==0)for(let{fbase_key:i,value:s}of e)r.add(i),JSON.stringify(this.localCache[i])!==JSON.stringify(s)&&(this.notifyListeners(i,s),n.push(i));for(let i of Object.keys(this.localCache))this.localCache[i]&&!r.has(i)&&(this.notifyListeners(i,null),n.push(i));return n}notifyListeners(e,n){this.localCache[e]=n;let r=this.listeners[e];if(r)for(let i of Array.from(r))i(n)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),nu)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,n){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(n)}_removeListener(e,n){this.listeners[e]&&(this.listeners[e].delete(n),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};sn.type="LOCAL";ei=sn;sr=Ks("rcb"),ou=new ve(3e4,6e4),kr=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!k().grecaptcha?.render}load(e,n=""){return d(au(n),e,"argument-error"),this.shouldResolveImmediately(n)&&os(k().grecaptcha)?Promise.resolve(k().grecaptcha):new Promise((r,i)=>{let s=k().setTimeout(()=>{i(D(e,"network-request-failed"))},ou.get());k()[sr]=()=>{k().clearTimeout(s),delete k()[sr];let c=k().grecaptcha;if(!c||!os(c)){i(D(e,"internal-error"));return}let l=c.render;c.render=(o,u)=>{let f=l(o,u);return this.counter++,f},this.hostLanguage=n,r(c)};let a=`${cl()}?${be({onload:sr,render:"explicit",hl:n})}`;zr(a).catch(()=>{clearTimeout(s),i(D(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!k().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Pr=class{async load(e){return new fr(e)}clearedOneInstance(){}};lt="recaptcha",cu={theme:"light",type:"image"},on=class{constructor(e,n,r={...cu}){this.parameters=r,this.type=lt,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=S(e),this.isInvisible=this.parameters.size==="invisible",d(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let i=typeof n=="string"?document.getElementById(n):n;d(i,this.auth,"argument-error"),this.container=i,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Pr:new kr,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),n=this.getAssertedRecaptcha(),r=n.getResponse(e);return r||new Promise(i=>{let s=a=>{a&&(this.tokenChangeListeners.delete(s),i(a))};this.tokenChangeListeners.add(s),this.isInvisible&&n.execute(e)})}render(){try{this.assertNotDestroyed()}catch(e){return Promise.reject(e)}return this.renderPromise?this.renderPromise:(this.renderPromise=this.makeRenderPromise().catch(e=>{throw this.renderPromise=null,e}),this.renderPromise)}_reset(){this.assertNotDestroyed(),this.widgetId!==null&&this.getAssertedRecaptcha().reset(this.widgetId)}clear(){this.assertNotDestroyed(),this.destroyed=!0,this._recaptchaLoader.clearedOneInstance(),this.isInvisible||this.container.childNodes.forEach(e=>{this.container.removeChild(e)})}validateStartingState(){d(!this.parameters.sitekey,this.auth,"argument-error"),d(this.isInvisible||!this.container.hasChildNodes(),this.auth,"argument-error"),d(typeof document<"u",this.auth,"operation-not-supported-in-this-environment")}makeTokenCallback(e){return n=>{if(this.tokenChangeListeners.forEach(r=>r(n)),typeof e=="function")e(n);else if(typeof e=="string"){let r=k()[e];typeof r=="function"&&r(n)}}}assertNotDestroyed(){d(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let n=document.createElement("div");e.appendChild(n),e=n}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){d(Fr()&&!Qr(),this.auth,"internal-error"),await lu(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await Yc(this.auth);d(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return d(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};pt=class{constructor(e,n){this.verificationId=e,this.onConfirmation=n}confirm(e){let n=Ae._fromVerification(this.verificationId,e);return this.onConfirmation(n)}};je=class t{constructor(e){this.providerId=t.PROVIDER_ID,this.auth=S(e)}verifyPhoneNumber(e,n){return In(this.auth,e,p(n))}static credential(e,n){return Ae._fromVerification(e,n)}static credentialFromResult(e){let n=e;return t.credentialFromTaggedObject(n)}static credentialFromError(e){return t.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:n,temporaryProof:r}=e;return n&&r?Ae._fromTokenResponse(n,r):null}};je.PROVIDER_ID="phone";je.PHONE_SIGN_IN_METHOD="phone";mt=class extends se{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return ne(e,this._buildIdpRequest())}_linkToIdToken(e,n){return ne(e,this._buildIdpRequest(n))}_getReauthenticationResolver(e){return ne(e,this._buildIdpRequest())}_buildIdpRequest(e){let n={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&&(n.idToken=e),n}};an=class{constructor(e,n,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(n)?n:[n]}execute(){return new Promise(async(e,n)=>{this.pendingPromise={resolve:e,reject:n};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(r){this.reject(r)}})}async onAuthEvent(e){let{urlResponse:n,sessionId:r,postBody:i,tenantId:s,error:a,type:c}=e;if(a){this.reject(a);return}let l={auth:this.auth,requestUri:n,sessionId:r,tenantId:s||void 0,postBody:i||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(o){this.reject(o)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return uu;case"linkViaPopup":case"linkViaRedirect":return hu;case"reauthViaPopup":case"reauthViaRedirect":return du;default:U(this.auth,"internal-error")}}resolve(e){re(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){re(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()}};fu=new ve(2e3,1e4);Ge=class t extends an{constructor(e,n,r,i,s){super(e,n,i,s),this.provider=r,this.authWindow=null,this.pollId=null,t.currentPopupAction&&t.currentPopupAction.cancel(),t.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return d(e,this.auth,"internal-error"),e}async onExecution(){re(this.filter.length===1,"Popup operations only handle one event");let e=gn();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(n=>{this.reject(n)}),this.resolver._isIframeWebStorageSupported(this.auth,n=>{n||this.reject(D(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(D(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,t.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(D(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,fu.get())};e()}};Ge.currentPopupAction=null;pu="pendingRedirect",Ut=new Map,Rr=class extends an{constructor(e,n,r=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],n,void 0,r),this.eventId=null}async execute(){let e=Ut.get(this.auth._key());if(!e){try{let r=await mu(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(r)}catch(n){e=()=>Promise.reject(n)}Ut.set(this.auth._key(),e)}return this.bypassAuthState||Ut.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){let n=await this.auth._redirectUserForId(e.eventId);if(n)return this.user=n,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};bu=600*1e3,Cr=class{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 n=!1;return this.consumers.forEach(r=>{this.isEventForConsumer(e,r)&&(n=!0,this.sendToConsumer(e,r),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!Eu(e)||(this.hasHandledPotentialRedirect=!0,n||(this.queuedRedirectEvent=e,n=!0)),n}sendToConsumer(e,n){if(e.error&&!ta(e)){let r=e.error.code?.split("auth/")[1]||"internal-error";n.onError(D(this.auth,r))}else n.onAuthEvent(e)}isEventForConsumer(e,n){let r=n.eventId===null||!!e.eventId&&e.eventId===n.eventId;return n.filter.includes(e.type)&&r}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=bu&&this.cachedEventUids.clear(),this.cachedEventUids.has(ys(e))}saveEventToCache(e){this.cachedEventUids.add(ys(e)),this.lastProcessedEventTime=Date.now()}};Tu=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,vu=/^https?/;ku=new ve(3e4,6e4);Ft=null;Cu=new ve(5e3,15e3),Ou="__/auth/iframe",Nu="emulator/auth/iframe",Du={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Lu=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);Fu={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},xu=500,Vu=600,Wu="_blank",Hu="http://localhost",cn=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};$u="__/auth/handler",ju="emulator/auth/handler",Gu=encodeURIComponent("fac");ar="webStorageSupport",Or=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=mn,this._completeRedirectFn=Qo,this._overrideRedirectResult=gu}async _openPopup(e,n,r,i){re(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await Es(e,n,r,ut(),i);return zu(e,s,gn())}async _openRedirect(e,n,r,i){await this._originValidation(e);let s=await Es(e,n,r,ut(),i);return Jl(s),new Promise(()=>{})}_initialize(e){let n=e._key();if(this.eventManagers[n]){let{manager:i,promise:s}=this.eventManagers[n];return i?Promise.resolve(i):(re(s,"If manager is not set, promise should be"),s)}let r=this.initAndGetManager(e);return this.eventManagers[n]={promise:r},r.catch(()=>{delete this.eventManagers[n]}),r}async initAndGetManager(e){let n=await Uu(e),r=new Cr(e);return n.register("authEvent",i=>(d(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()]=n,r}_isIframeWebStorageSupported(e,n){this.iframes[e._key()].send(ar,{type:ar},i=>{let s=i?.[0]?.[ar];s!==void 0&&n(!!s),U(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let n=e._key();return this.originValidationPromises[n]||(this.originValidationPromises[n]=Au(e)),this.originValidationPromises[n]}get _shouldInitProactively(){return Gs()||Ws()||Hr()}},ni=Or,ln=class{constructor(e){this.factorId=e}_process(e,n,r){switch(n.type){case"enroll":return this._finalizeEnroll(e,n.credential,r);case"signin":return this._finalizeSignIn(e,n.credential);default:return Y("unexpected MultiFactorSessionType")}}},Nr=class t extends ln{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new t(e)}_finalizeEnroll(e,n,r){return Hl(e,{idToken:n,displayName:r,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,n){return iu(e,{mfaPendingCredential:n,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},gt=class{constructor(){}static assertion(e){return Nr._fromCredential(e)}};gt.FACTOR_ID="phone";_t=class{static assertionForEnrollment(e,n){return un._fromSecret(e,n)}static assertionForSignIn(e,n){return un._fromEnrollmentId(e,n)}static async generateSecret(e){let n=e;d(typeof n.user?.auth<"u","internal-error");let r=await zl(n.user.auth,{idToken:n.credential,totpEnrollmentInfo:{}});return It._fromStartTotpMfaEnrollmentResponse(r,n.user.auth)}};_t.FACTOR_ID="totp";un=class t extends ln{constructor(e,n,r){super("totp"),this.otp=e,this.enrollmentId=n,this.secret=r}static _fromSecret(e,n){return new t(n,void 0,e)}static _fromEnrollmentId(e,n){return new t(n,e)}async _finalizeEnroll(e,n,r){return d(typeof this.secret<"u",e,"argument-error"),Bl(e,{idToken:n,displayName:r,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,n){d(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let r={verificationCode:this.otp};return su(e,{mfaPendingCredential:n,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:r})}},It=class t{constructor(e,n,r,i,s,a,c){this.sessionInfo=a,this.auth=c,this.secretKey=e,this.hashingAlgorithm=n,this.codeLength=r,this.codeIntervalSeconds=i,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,n){return new t(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,n)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,n){let r=!1;return(Dt(e)||Dt(n))&&(r=!0),r&&(Dt(e)&&(e=this.auth.currentUser?.email||"unknownuser"),Dt(n)&&(n=this.auth.name)),`otpauth://totp/${n}:${e}?secret=${this.secretKey}&issuer=${n}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};ws="@firebase/auth",Ts="1.13.3";Dr=class{constructor(e){this.auth=e,this.internalListeners=new Map}getUid(){return this.assertAuthConfigured(),this.auth.currentUser?.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;let n=this.auth.onIdTokenChanged(r=>{e(r?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,n),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let n=this.internalListeners.get(e);n&&(this.internalListeners.delete(e),n(),this.updateProactiveRefresh())}assertAuthConfigured(){d(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};Yu=300,Zu=Un("authIdTokenMaxAge")||Yu,vs=null,Xu=t=>async e=>{let n=e&&await e.getIdTokenResult(),r=n&&(new Date().getTime()-Date.parse(n.issuedAtTime))/1e3;if(r&&r>Zu)return;let i=n?.token;vs!==i&&(vs=i,await fetch(t,{method:i?"POST":"DELETE",headers:i?{Authorization:`Bearer ${i}`}:{}}))};al({loadJS(t){return new Promise((e,n)=>{let r=document.createElement("script");r.setAttribute("src",t),r.onload=e,r.onerror=i=>{let s=D("internal-error");s.customData=i,n(s)},r.type="text/javascript",r.charset="UTF-8",Qu().appendChild(r)})},gapiScript:"https://apis.google.com/js/api.js",recaptchaV2Script:"https://www.google.com/recaptcha/api.js",recaptchaEnterpriseScript:"https://www.google.com/recaptcha/enterprise.js?render="});Ju("Browser")});var ia=B(()=>{ra();rt();Ue();Pt();kt()});var yn={};yi(yn,{ActionCodeOperation:()=>Rs,ActionCodeURL:()=>Se,AuthCredential:()=>se,AuthErrorCodes:()=>Ds,EmailAuthCredential:()=>We,EmailAuthProvider:()=>oe,FacebookAuthProvider:()=>He,FactorId:()=>As,GithubAuthProvider:()=>Be,GoogleAuthProvider:()=>ze,OAuthCredential:()=>Z,OAuthProvider:()=>Gt,OperationType:()=>Ps,PhoneAuthCredential:()=>Ae,PhoneAuthProvider:()=>je,PhoneMultiFactorGenerator:()=>gt,ProviderId:()=>Ss,RecaptchaVerifier:()=>on,SAMLAuthProvider:()=>Kt,SignInMethod:()=>ks,TotpMultiFactorGenerator:()=>_t,TotpSecret:()=>It,TwitterAuthProvider:()=>$e,applyActionCode:()=>lo,beforeAuthStateChanged:()=>Zr,browserCookiePersistence:()=>Uo,browserLocalPersistence:()=>Xr,browserPopupRedirectResolver:()=>ni,browserSessionPersistence:()=>mn,checkActionCode:()=>Jr,confirmPasswordReset:()=>co,connectAuthEmulator:()=>$r,createUserWithEmailAndPassword:()=>ho,debugErrorMap:()=>Os,deleteUser:()=>Do,fetchSignInMethodsForEmail:()=>_o,getAdditionalUserInfo:()=>vo,getAuth:()=>na,getIdToken:()=>Fs,getIdTokenResult:()=>Vr,getMultiFactorResolver:()=>Lo,getRedirectResult:()=>Xo,inMemoryPersistence:()=>Bt,indexedDBLocalPersistence:()=>ei,initializeAuth:()=>Br,initializeRecaptchaConfig:()=>So,isSignInWithEmailLink:()=>mo,linkWithCredential:()=>Gr,linkWithPhoneNumber:()=>Ho,linkWithPopup:()=>Go,linkWithRedirect:()=>Zo,multiFactor:()=>Mo,onAuthStateChanged:()=>Po,onIdTokenChanged:()=>Yr,parseActionCodeURL:()=>Xs,prodErrorMap:()=>Lr,reauthenticateWithCredential:()=>qr,reauthenticateWithPhoneNumber:()=>zo,reauthenticateWithPopup:()=>jo,reauthenticateWithRedirect:()=>Yo,reload:()=>Wr,revokeAccessToken:()=>No,sendEmailVerification:()=>Io,sendPasswordResetEmail:()=>ao,sendSignInLinkToEmail:()=>po,setPersistence:()=>Ao,signInAnonymously:()=>eo,signInWithCredential:()=>bt,signInWithCustomToken:()=>oo,signInWithEmailAndPassword:()=>fo,signInWithEmailLink:()=>go,signInWithPhoneNumber:()=>Wo,signInWithPopup:()=>$o,signInWithRedirect:()=>Jo,signOut:()=>Oo,unlink:()=>ro,updateCurrentUser:()=>Co,updateEmail:()=>Eo,updatePassword:()=>wo,updatePhoneNumber:()=>Bo,updateProfile:()=>bo,useDeviceLanguage:()=>Ro,validatePassword:()=>ko,verifyBeforeUpdateEmail:()=>yo,verifyPasswordResetCode:()=>uo});var bn=B(()=>{ia()});var ed={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},ri=null,En=null;async function Ce(){return typeof window>"u"?null:(ri||(ri=(async()=>{let{initializeApp:t,getApps:e}=await Promise.resolve().then(()=>(is(),rs)),{getAuth:n,signInAnonymously:r,onAuthStateChanged:i}=await Promise.resolve().then(()=>(bn(),yn)),s=e().length?e()[0]:t(ed);if(En=n(s),!await new Promise(c=>{let l=i(En,o=>{l(),c(o)})}))try{await r(En)}catch{console.warn("[oZ Auth] Anonymous session unavailable (offline or delayed).")}return En})()),ri)}async function sa(){try{let t=await Ce();return!t||!t.currentUser?null:await t.currentUser.getIdToken()}catch{return console.error("[OZmoz Auth] Session check failed."),null}}async function wn(t){let e=await Ce(),{signInWithCustomToken:n}=await Promise.resolve().then(()=>(bn(),yn)),r;try{r=await n(e,t)}catch{throw new Error("Sign-in failed. Please try again.")}return{uid:r.user.uid,email:r.user.email,isAnonymous:r.user.isAnonymous}}async function oa(){let t=await Ce(),{signOut:e,signInAnonymously:n}=await Promise.resolve().then(()=>(bn(),yn));return await e(t),await n(t),!0}async function aa(){let t=await Ce();return!t||!t.currentUser?null:{uid:t.currentUser.uid,email:t.currentUser.email,isAnonymous:t.currentUser.isAnonymous}}async function ca(t=!1){try{let e=await Ce();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(t)).claims.elog===!0}catch(e){return console.error("[OZmoz Auth Debug]",e),!1}}var td="oz_proto",ii="proto_user",vn=new Map,ha=(t,e)=>`${td}:${t||"app"}:${e}`,W=t=>t===void 0?t:JSON.parse(JSON.stringify(t)),fa=()=>`proto_${typeof crypto<"u"&&typeof crypto.randomUUID=="function"?crypto.randomUUID():`${Math.random().toString(36).slice(2)}${Date.now().toString(36)}`}`,ai=t=>{let e=t?._id??t?.id??t?.documentId;return e==null?null:String(e)},si=new Set;function ce(t,e){let n=ha(t,e);if(si.has(n))return W(vn.get(n));try{if(typeof localStorage<"u"){let r=localStorage.getItem(n);if(r!==null){let i=JSON.parse(r);if(Array.isArray(i))return i}}}catch{}return vn.has(n)?W(vn.get(n)):null}function Et(t,e,n){let r=ha(t,e);vn.set(r,W(n));try{if(typeof localStorage<"u"){localStorage.setItem(r,JSON.stringify(n)),si.delete(r);return}}catch{}si.add(r)}var oi=t=>{if(typeof t=="string")try{return JSON.parse(t)}catch{return{}}return t&&typeof t=="object"?t:{}};function nd(t,e,n){let r=String(e).split("."),i=t;r.forEach((s,a)=>{a===r.length-1?i[s]=n:((typeof i[s]!="object"||i[s]===null)&&(i[s]={}),i=i[s])})}function rd(t){let e={...W(oi(t))};return e._id=ai(e)||fa(),e}var Tn=(t,e)=>t.findIndex(n=>ai(n)===String(e)),la=/^[A-Za-z][A-Za-z0-9_]{0,39}$/;function id(t){let e={where:[],sort:null,limit:0};if(t==null)return{ok:e};if(typeof t!="object"||Array.isArray(t))return{error:"Invalid query options."};let{where:n,limit:r,sort:i}=t;if(n!=null){if(typeof n!="object"||Array.isArray(n))return{error:"This filter isn't supported."};let s=Object.keys(n);if(s.length>3)return{error:"Too many filter conditions."};for(let a of s){let c=n[a],l=typeof c=="string"||typeof c=="boolean"||typeof c=="number"&&Number.isFinite(c);if(!la.test(a)||!l)return{error:"This filter isn't supported."};e.where.push([a,c])}}if(r!=null){if(!Number.isInteger(r)||r<1||r>200)return{error:"The limit must be a whole number from 1 to 200."};e.limit=r}if(i!=null){let s=typeof i=="object"&&!Array.isArray(i)?Object.keys(i):[];if(s.length!==1||!la.test(s[0])||i[s[0]]!==1&&i[s[0]]!==-1)return{error:"This sort isn't supported."};e.sort={field:s[0],dir:i[s[0]]}}return{ok:e}}var ua=t=>t==null?0:typeof t=="number"?1:typeof t=="string"?2:typeof t=="boolean"?3:4,da=(t,e)=>{let n=ua(t),r=ua(e);return n!==r?n-r:n===0||n===4?0:t<e?-1:t>e?1:0};function sd(t,e){let n=t;if(e.where.length&&(n=n.filter(r=>e.where.every(([i,s])=>r[i]===s))),e.sort){let{field:r,dir:i}=e.sort;n=n.slice().sort((s,a)=>i*(da(s[r],a[r])||da(String(s._id),String(a._id))))}return e.limit&&(n=n.slice(0,e.limit)),n}function pa(t,e,n){let r=ce(t,e);if(r!==null)return{success:!0,seeded:!1,isPrototype:!0,count:r.length};let i=(Array.isArray(n)?n:[]).map(rd);return Et(t,e,i),{success:!0,seeded:!0,isPrototype:!0,count:i.length}}function ma(t,e,n){let r=e||{},i=r.fleetboTable;switch(t){case"getdocsg":case"getdocsu":{let s=id(r.queryOptions);return s.error?{success:!1,error:s.error}:{success:!0,data:sd(W(ce(n,i)||[]),s.ok)}}case"getdoc":{let s=ce(n,i)||[],a=s[Tn(s,r.id)];return a?{success:!0,data:W(a)}:{success:!1,notFound:!0,message:"Document not found."}}case"add":case"addwithmedia":{let s=ce(n,i)||[],a=oi(r.jsonData),c={...W(a),_id:ai(a)||fa(),userId:ii,createdAt:new Date().toISOString()};if(t==="addwithmedia"){let l=typeof r.fileBase64=="string"&&r.fileBase64||a.mediaUrl||a.image||"";c.mediaUrl=c.image=c.imageUrl=c.coverImage=l}return s.push(c),Et(n,i,s),t==="addwithmedia"?{success:!0,id:c._id,mediaUrl:c.mediaUrl,isPrototype:!0}:{success:!0,documentId:c._id,isPrototype:!0}}case"addwithuserid":case"addwithid":{let s=ce(n,i)||[],a=t==="addwithuserid"?ii:String(r.id),c=W(oi(r.jsonData)),l=Tn(s,a),o={...l>=0?s[l]:{createdAt:new Date().toISOString()},...c,_id:a,userId:ii,updatedAt:new Date().toISOString()};return l>=0?s[l]=o:s.push(o),Et(n,i,s),t==="addwithuserid"?{success:!0,documentId:a,isPrototype:!0}:{success:!0,id:a,isPrototype:!0}}case"update":{let s=ce(n,i)||[],a=Tn(s,r.id);if(a<0)return{success:!1,documentId:r.id,error:"Document not found."};let{fleetboTable:c,id:l,...o}=r,u=W(s[a]);for(let[f,h]of Object.entries(o))nd(u,f,W(h));return u.updatedAt=new Date().toISOString(),s[a]=u,Et(n,i,s),{success:!0,documentId:String(r.id),isPrototype:!0}}case"delete":{let s=ce(n,i)||[],a=Tn(s,r.id);return a>=0&&(s.splice(a,1),Et(n,i,s)),{success:!0,documentId:String(r.id),isPrototype:!0}}case"join":{let s=r.joinOptions?.innerJoin;if(!s||!s.collection||!Array.isArray(s.on)||s.on.length!==3)return{success:!1,error:"The 'on' clause must contain 3 elements."};let[a,,c]=s.on,l=s.as||"joinedData",o=ce(n,s.collection)||[],u=h=>{if(!Array.isArray(s.select)||s.select.length===0)return W(h);let m={_id:h._id};return s.select.forEach(w=>{w in h&&(m[w]=W(h[w]))}),m};return{success:!0,data:(ce(n,i)||[]).map(h=>{let m=h[a],w=o.filter(T=>{if(m==null)return!1;let N=c==="id"?T._id??T.id:T[c];return String(N)===String(m)});return{...W(h),[l]:w.map(u)}})}}default:return null}}var od="https://api.ozmoz.io/",wt=()=>typeof globalThis<"u"&&globalThis.OZ_CONFIG?globalThis.OZ_CONFIG:typeof window<"u"&&window.OZ_CONFIG?window.OZ_CONFIG:{},ci=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_PROTOTYPE==="true"||typeof process<"u"&&process.env&&process.env.OZ_PROTOTYPE==="true"||wt().prototype===!0||wt().prototype==="true"),li=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_DB_KEY:typeof process<"u"?process.env.OZ_DB_KEY:void 0)||wt().dbKey||"",ad=()=>(typeof import.meta<"u"&&import.meta.env?import.meta.env.OZ_ENTERPRISE_ID:typeof process<"u"?process.env.OZ_ENTERPRISE_ID:void 0)||wt().enterpriseId||"",cd=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_DEBUG==="true"||typeof process<"u"&&process.env&&process.env.OZ_DEBUG==="true"||wt().debug===!0),Tt=async(t,e=null)=>{try{let n=li(),r=ad(),i=ci(),s=String(t).replace(/^[a-z]+:\/\//,"").split("-")[0]||"add",a=e?.operation||s,c=s==="crud"?"crud":a;if(i){let C=ma(a.toLowerCase(),e,n);if(C!=null)return C}let l={"Content-Type":"application/json"};i&&(l["x-oz-prototype"]="true");let o=cd()?Date.now():0,u=await sa(),f=o?Date.now():0;u&&(l.Authorization=`Bearer ${u}`);let h=null;if(e?.jsonData!==void 0)h=e.jsonData;else if(a==="update"){let{fleetboTable:C,id:Ne,operation:le,...ue}=e||{};h=ue}let m={targetFunction:c,operation:a,enterpriseID:r,fleetboDB:n,fleetboTable:e?.fleetboTable||null,jsonData:h,_prototype:i,data:{fleetboDB:n,enterpriseID:r,operation:a,...e}},w=C=>{if(!C||typeof C!="object")return C;let{fleetboDB:Ne,fleetboTable:le,...ue}=C;return{...ue,...Ne!==void 0?{ozDB:Ne}:{},...le!==void 0?{ozTable:le}:{}}},T={...w(m),data:w(m.data)},N=await fetch(od,{method:"POST",headers:l,body:JSON.stringify(T)}),L=await N.json(),R=L.result||L;if(o){let C=Date.now();console.debug(`[OZmoz] ${c}(${e?.fleetboTable||""}) ${C-o} ms : auth ${f-o} ms, cloud ${C-f} ms, HTTP ${N.status}`)}let z=R?.error||(N.ok?null:R?.message||`HTTP ${N.status}`),Ye=z&&typeof z=="object"?z.message||JSON.stringify(z):z?String(z):void 0;return{success:!!(N.ok&&!Ye),...R||{},error:Ye}}catch(n){return{success:!1,error:n?.message||String(n)}}},ga=Tt,_a=Tt,Ia=Tt;var v=Tt||ga||_a||Ia,Sn=ci||(()=>!1),ya=li||(()=>"");if(typeof window<"u"&&typeof customElements<"u"){class t extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("fallback")||"\u2014",f=o!=null&&o.trim()!==""&&o!=="null"&&o!=="undefined";this.textContent=f?o:u}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):this.setAttribute("value",String(o))}get currency(){return this.getAttribute("currency")}set currency(o){o==null?this.removeAttribute("currency"):this.setAttribute("currency",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("invalid-fallback")||"0";if(o==null||o===""||o==="null"||o==="undefined"){this.textContent=u;return}let f=Number(o);if(Number.isNaN(f)){this.textContent=u;return}let h=this.getAttribute("currency");if(h)try{this.textContent=new Intl.NumberFormat("en-US",{style:"currency",currency:h}).format(f)}catch{this.textContent=`${f} ${h}`}else this.textContent=String(f)}}class n extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(o){o==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(o))}get"label-true"(){return this.labelTrue}set"label-true"(o){this.labelTrue=o}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(o){o==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(o))}get"label-false"(){return this.labelFalse}set"label-false"(o){this.labelFalse=o}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("label-true")||"Yes",f=this.getAttribute("label-false")||"No",h=this.getAttribute("invalid-fallback")||"Unknown";o==="true"||o==="1"?this.textContent=u:o==="false"||o==="0"?this.textContent=f:this.textContent=h}}class r extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null||o===""?this.removeAttribute("value"):o&&typeof o=="object"&&typeof o.toISOString=="function"?this.setAttribute("value",o.toISOString()):this.setAttribute("value",String(o))}get locale(){return this.getAttribute("locale")}set locale(o){o==null?this.removeAttribute("locale"):this.setAttribute("locale",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("invalid-fallback")||"Invalid date",f=this.getAttribute("locale")||"en-US";if(!o||o==="null"||o==="undefined"||o===""){this.textContent=u;return}let h=new Date(o);if(Number.isNaN(h.getTime())){this.textContent=u;return}try{this.textContent=h.toLocaleDateString(f)}catch{this.textContent=h.toLocaleDateString("en-US")}}}class i extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get allowed(){return this.getAttribute("allowed")}set allowed(o){o==null?this.removeAttribute("allowed"):Array.isArray(o)?this.setAttribute("allowed",o.join(",")):this.setAttribute("allowed",String(o))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(o){o==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(o))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(o){this.invalidFallback=o}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=(this.getAttribute("allowed")||"").split(",").map(h=>h.trim()).filter(Boolean),f=this.getAttribute("invalid-fallback")||"Not allowed";if(!o||o==="null"||o==="undefined"||!u.includes(o)){this.textContent=f;return}this.textContent=String(o)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(o){o==null?this.removeAttribute("value"):this.setAttribute("value",String(o))}get alt(){return this.getAttribute("alt")}set alt(o){o==null?this.removeAttribute("alt"):this.setAttribute("alt",String(o))}get fallback(){return this.getAttribute("fallback")}set fallback(o){o==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(o))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let o=this.getAttribute("value"),u=this.getAttribute("fallback")||"",f=this.getAttribute("alt")||"Media";this.innerHTML="";let h=document.createElement("img"),m=o&&o!=="null"&&o!=="undefined"&&o.trim()!=="";h.src=m?o:u,h.alt=f,this.appendChild(h)}}class a extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(o){o==null?this.removeAttribute("table"):this.setAttribute("table",String(o))}get id(){return this.getAttribute("id")}set id(o){o==null?this.removeAttribute("id"):this.setAttribute("id",String(o))}get field(){return this.getAttribute("field")}set field(o){o==null?this.removeAttribute("field"):this.setAttribute("field",String(o))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(o){o==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(o))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(o){this.orphanFallback=o}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(o){o==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(o))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(o){this.loadingFallback=o}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(o){o==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(o))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(o){this.malformedFallback=o}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let o=this.getAttribute("table"),u=this.getAttribute("id"),f=this.getAttribute("field")||"name",h=this.getAttribute("orphan-fallback")||"Deleted",m=this.getAttribute("loading-fallback")||"Loading...",w=this.getAttribute("malformed-fallback")||"Invalid ID";if(!u||typeof u!="string"||u.trim()===""||u==="null"||u==="undefined"){this.textContent=w;return}if(!o){this.textContent=w;return}this.textContent=m;try{let T=typeof window<"u"?window:null,N=typeof globalThis<"u"?globalThis:null,L=T&&T.oz||N&&N.oz;if(!L||typeof L.getDoc!="function"){this.textContent=h;return}let R=await L.getDoc(o,u);R&&R[f]!==void 0?this.textContent=String(R[f]):R?this.textContent=R.name||R.title||R.label||JSON.stringify(R):this.textContent=h}catch{this.textContent=h}}}let c=(l,o)=>{customElements.get(l)||customElements.define(l,o)};c("oz-text",t),c("oz-number",e),c("oz-toggle",n),c("oz-date",r),c("oz-enum",i),c("oz-media",s),c("oz-reference",a)}var di={Text:"oz-text",Number:"oz-number",Toggle:"oz-toggle",Date:"oz-date",Enum:"oz-enum",Media:"oz-media",Reference:"oz-reference"};function Ke(t){typeof window>"u"&&typeof process<"u"&&process.env}var ud=()=>!!(typeof import.meta<"u"&&import.meta.env&&import.meta.env.DEV===!0||typeof process<"u"&&process.env&&!1),ba=null;async function F(t){if(t&&t._schemaVersion&&t._schemaData){let e=t._schemaVersion,n=t._schemaData;typeof window<"u"?ud()&&String(e)!==ba&&(ba=String(e),fetch("/__ozmoz_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:n,version:e})}).catch(()=>{})):typeof process<"u"&&process.env}return t}var A=t=>`oz://${t.toLowerCase()}`,An=(t,e,n)=>{if(!n||n.success!==!1||n.notFound)return;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";console.error(`[OZmoz] ${t}('${e}') failed: ${i}`)};var Je=(t,e,n)=>{if(n&&n.success!==!1&&Sn()&&hd(e),!n||n.success!==!1)return n;let r=n.error,i=(r&&typeof r=="object"?r.message||r.status:r)||n.message||"unknown error";return console.error(`[OZmoz] ${t}('${e}') failed: ${i}`),n},Oe=null;function ui(){if(typeof window>"u")return Promise.resolve(null);let t=window;return t.FB&&t.__ozmoz_fb_ready?Promise.resolve(t.FB):Oe||(Oe=new Promise((e,n)=>{let r=setTimeout(()=>{Oe=null,n(new Error("The Facebook service is not responding. Check your tracker blockers."))},8e3),i=typeof import.meta<"u"&&import.meta.env&&import.meta.env.OZ_FACEBOOK_APP_ID||typeof process<"u"&&process.env&&process.env.OZ_FACEBOOK_APP_ID||"1392432699758138",s=()=>{try{return t.__ozmoz_fb_ready?!0:!t.FB||typeof t.FB.init!="function"?!1:(t.FB.init({appId:String(i).trim(),cookie:!0,xfbml:!1,version:"v22.0"}),t.__ozmoz_fb_ready=!0,clearTimeout(r),e(t.FB),!0)}catch(l){return clearTimeout(r),Oe=null,n(l),!1}};if(t.FB&&typeof t.FB.init=="function"&&s())return;let a=t.fbAsyncInit;if(t.fbAsyncInit=function(){if(typeof a=="function")try{a()}catch{}s()},document.getElementById("facebook-jssdk"))return;let c=document.createElement("script");c.id="facebook-jssdk",c.src="https://connect.facebook.net/fr_FR/sdk.js",c.async=!0,c.defer=!0,c.crossOrigin="anonymous",c.onerror=()=>{clearTimeout(r),Oe=null,n(new Error("Could not load the Facebook script."))},document.head.appendChild(c)}),Oe)}typeof window<"u"&&(document.readyState==="loading"?document.addEventListener("DOMContentLoaded",()=>{ui()}):ui());var dd=()=>new Proxy({},{get(t,e){let n=String(e);return async(r={})=>{let i=await v(A("call"),{functionName:n,payload:r});return F(i)}}}),G=t=>t&&(Array.isArray(t)?t.map(e=>e&&e._id&&!e.id?{...e,id:String(e._id)}:e):typeof t=="object"&&t._id&&!t.id?{...t,id:String(t._id)}:t),X=(t,e,n)=>{(!n||typeof n!="object"||!n.desc&&!n.guard&&!n.role)&&console.warn(`[OZmoz] ${t}('${e}') : no {desc, guard, role} metadata provided \u2014 'npx ozmoz sync' will require it.`)},kn=new Map,hd=t=>{[kn.get(t),kn.get("*")].forEach(e=>{e&&e.forEach(n=>{try{n()}catch{}})})},hi={...di,call:dd(),getUser:aa,add:async(t,e,n={})=>{Ke(t),X("add",t,n);let r=await v(A("crud"),{operation:"add",fleetboTable:t,jsonData:e});return Je("add",t,await F(r))},addWithId:async(t,e,n,r={})=>{Ke(t),X("addWithId",t,r);let i=await v(A("crud"),{operation:"addWithId",fleetboTable:t,id:n,jsonData:e});return Je("addWithId",t,await F(i))},addWithUserId:async(t,e,n={})=>{Ke(t),X("addWithUserId",t,n);let r=await v(A("crud"),{operation:"addWithUserId",fleetboTable:t,jsonData:e});return Je("addWithUserId",t,await F(r))},addWithMedia:async(t,e,n,r,i={})=>{Ke(t),X("addWithMedia",t,i);let s=await v(A("crud"),{operation:"addWithMedia",fleetboTable:t,jsonData:e,fileBase64:n,fileName:r});return Je("addWithMedia",t,await F(s))},update:async(t,e,n,r={})=>{X("update",t,r);let i=await v(A("crud"),{operation:"update",fleetboTable:t,id:e,...n});return Je("update",t,await F(i))},delete:async(t,e,n={})=>{X("delete",t,n);let r=await v(A("crud"),{operation:"delete",fleetboTable:t,id:e});return Je("delete",t,await F(r))},getDocsG:async(t,e={})=>{X("getDocsG",t,e);let n=await v(A("crud"),{operation:"getDocsG",fleetboTable:t,...readQueryPart(e)}),r=await F(n);return An("getDocsG",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDocsU:async(t,e={})=>{X("getDocsU",t,e);let n=await v(A("crud"),{operation:"getDocsU",fleetboTable:t,...readQueryPart(e)}),r=await F(n);return An("getDocsU",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},getDoc:async(t,e,n={})=>{X("getDoc",t,n);let r=await v(A("crud"),{operation:"getDoc",fleetboTable:t,id:e}),i=await F(r);return An("getDoc",t,i),i?i.data!==void 0?G(i.data):i.success===!1?null:G(i):null},getAuthUser:async()=>{let t=await v(A("crud"),{operation:"getAuthUser"}),e=await F(t);return e?e.data!==void 0?G(e.data):e.success===!1?null:G(e):null},join:async(t,e)=>{Ke(t),e?.innerJoin?.collection&&Ke(e.innerJoin.collection);let n=await v(A("crud"),{operation:"join",fleetboTable:t,joinOptions:e}),r=await F(n);return An("join",t,r),Array.isArray(r)?G(r):r&&Array.isArray(r.data)?G(r.data):[]},watch:(t,e={},n,r)=>{let i=t&&typeof t=="object"?String(t.call||"").replace(/^\$/,""):"",s=i?"":String(t||""),a=i||s;if(!a)return console.error("[OZmoz] watch() needs a table name or { call: 'name' } as 1st argument."),()=>{};if(typeof n!="function")return console.error(`[OZmoz] watch('${a}') needs a callback as 3rd argument.`),()=>{};i||X("watch",s,e);let c=!i&&e&&e.scope==="user"?"user":"all",l=i?t.payload||{}:null,o=i?750:250,u=i?2e4:1e4,f=Sn(),h=!f&&typeof window<"u"&&typeof WebSocket<"u",m=!1,w=0,T=[],N=[],L="",R="",z=!1,Ye=!1,C=0,Ne=!1,le=null,ue=null,Pn=null,Ze=null,fi=_=>(_&&_.error&&typeof _.error=="object"?_.error.message:_&&_.error)||_&&_.message||"read failed",de=async()=>{let _=++w;try{if(i){let I=await F(await v(A("call"),{functionName:i,payload:l,watch:!0}));if(m||_!==w)return;if(!I||I.success===!1)throw new Error(fi(I));let{_live:M,...x}=I;N=M&&Array.isArray(M.u)?M.u:[],L=M&&M.k?String(M.k):"",n(x),h&&Ta()}else{let I=await F(await v(A("crud"),{operation:c==="user"?"getDocsU":"getDocsG",fleetboTable:s,...readQueryPart(e)}));if(m||_!==w)return;if(I&&I.success===!1)throw new Error(fi(I));let M=Array.isArray(I)?I:I&&Array.isArray(I.data)?I.data:[];n(G(M))}}catch(I){!m&&typeof r=="function"&&r(I)}},vt=()=>{clearTimeout(le),le=setTimeout(de,o)},Ea=()=>{Ze||(Ze=setInterval(de,u))},pi=()=>{clearInterval(Ze),Ze=null};if(f){let _=i?"*":s,I=kn.get(_);I||(I=new Set,kn.set(_,I)),I.add(vt);let M=`oz_proto:${ya()||"app"}:`,x=ye=>{ye.key&&(i?ye.key.indexOf(M)===0:ye.key===M+s)&&vt()};return typeof window<"u"&&window.addEventListener("storage",x),de(),()=>{m=!0,clearTimeout(le),I.delete(vt),typeof window<"u"&&window.removeEventListener("storage",x)}}if(!h)return de(),()=>{m=!0};let wa=()=>{clearInterval(Pn),Pn=setInterval(()=>T.forEach(_=>{try{_.send("ping")}catch{}}),3e4)},Rn=()=>{let _=T;T=[],clearInterval(Pn),_.forEach(I=>{I.onclose=null;try{I.close()}catch{}})},mi=()=>{m||Ze||(Ne||(Ne=!0,console.warn(`[OZmoz] watch('${a}'): live updates unavailable, refreshing every ${u/1e3} s.`)),Ea())},gi=()=>{Rn(),mi(),Ye&&de(),!i&&!m&&C<6&&(clearTimeout(ue),ue=setTimeout(Cn,Math.min(6e4,2e3*2**C++)))},_i=_=>{if(m||T.length||!_.length)return!1;let I=0;return _.forEach(M=>{let x;try{x=new WebSocket(M)}catch{return}T.push(x),x.onopen=()=>{++I===1&&(Ye=!0,C=0,pi(),wa(),i||de())},x.onmessage=ye=>{ye.data!=="pong"&&vt()},x.onclose=()=>{T.indexOf(x)!==-1&&gi()},x.onerror=()=>{try{x.close()}catch{}}}),T.length>0},Ta=()=>{m||T.length&&L===R||(Rn(),R=L,_i(N)||mi())},Cn=async()=>{if(!(m||z||T.length)){z=!0;try{let _=await v(A("getRealtimeTicket"),{fleetboTable:s});if(m)return;if(!_||_.success===!1||!_.url)throw new Error("ticket");if(!_i([_.url]))throw new Error("open")}catch{gi()}finally{z=!1}}},Ii=()=>{document.hidden||m||T.length||z||(clearTimeout(ue),C=0,i?de():Cn())};return typeof document<"u"&&document.addEventListener("visibilitychange",Ii),de(),i||Cn(),()=>{m=!0,clearTimeout(le),clearTimeout(ue),pi(),Rn(),typeof document<"u"&&document.removeEventListener("visibilitychange",Ii)}},seed:async(t,e)=>Sn()?pa(ya(),t,e):{success:!0,seeded:!1,isPrototype:!1},sendotpsvro:async t=>{let e=typeof t=="string"?{email:t}:t||{};return await v(A("sendOtpSvro"),e)},verifyotpsvro:async(t,e)=>{let n=await v(A("verifyOtpSvro"),{email:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await wn(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},sendOtpByPhone:async t=>{let e=typeof t=="string"?{phoneNumber:t}:t||{};return await v(A("sendOtpByPhone"),e)},verifyOtpPhoneSvro:async(t,e)=>{let n=await v(A("verifyOtpPhoneSvro"),{phoneNumber:t,code:e});if(n.success&&n.customToken)try{return{success:!0,user:await wn(n.customToken)}}catch(r){return{success:!1,error:r.message}}return n},verifyFacebookAuth:(t={})=>new Promise(e=>{let n=typeof t=="string"?t:t?.accessToken,r=async c=>{try{let l=await v(A("verifyFacebookAuth"),{accessToken:c}),o=l.customToken||l.token;if(l.success&&o){let u=await wn(o);e({success:!0,user:u,profile:l.profile||null,projects:l.projects||[]})}else e(l)}catch(l){e({success:!1,error:l.message})}};if(n){r(n);return}if(typeof window>"u")return e({success:!1,error:"Not a browser environment."});let i=window;if(!i.FB||!i.__ozmoz_fb_ready||typeof i.FB.login!="function")return ui(),e({success:!1,error:"The Meta service is starting up. Click the button again."});let s=setTimeout(()=>{e({success:!1,cancelled:!0,error:"Login timed out. The window was closed or blocked."})},12e4),a=t?.scope||"public_profile,email";try{i.FB.login(c=>{if(clearTimeout(s),!c||c.error)return e({success:!1,error:c?.error||"Window closed."});if(c.status==="unknown"||!c.authResponse?.accessToken)return e({success:!1,cancelled:!0,error:"Facebook sign-in cancelled."});r(c.authResponse.accessToken)},{scope:a,return_scopes:!0})}catch(c){clearTimeout(s),e({success:!1,error:c.message})}}),isAuthenticated:async(t=!1)=>await ca(t),logout:async()=>{try{return await oa(),{success:!0}}catch(t){return{success:!1,error:t.message}}},acl:{grant:async(t,e,n,r="*")=>await v(A("grantAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),revoke:async(t,e,n,r="*")=>await v(A("revokeAcl"),{targetUserId:t,action:e,resourceTable:n,resourceId:r}),can:async(t,e,n="*")=>{let r=await v(A("checkAcl"),{action:t,resourceTable:e,resourceId:n});return!!(r&&(r.allowed===!0||r.can===!0))}}},Zd=hi;typeof window<"u"&&(window.oz=hi,window.OzUI=di);typeof globalThis<"u"&&(globalThis.oz=hi,globalThis.OzUI=di);if(typeof window<"u"&&typeof document<"u"){let t=()=>setTimeout(()=>{Sn()||Ce().catch(()=>{})},400);document.readyState==="complete"?t():window.addEventListener("load",t,{once:!0})}export{di as OzUI,Zd as default,hi as oz};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@firebase/util/dist/index.esm.js:
|