fleetbo-svro 1.0.33 → 1.0.34
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 +32 -38
- package/dist/index.js +1 -1
- package/package.json +1 -1
package/dist/cli.cjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
var V=(t,n)=>()=>{try{return n||t((n={exports:{}}).exports,n),n.exports}catch(o){throw n=0,o}};var
|
|
2
|
+
var V=(t,n)=>()=>{try{return n||t((n={exports:{}}).exports,n),n.exports}catch(o){throw n=0,o}};var A=V((he,$)=>{var i=require("fs"),p=require("path"),q=require("https"),{execSync:W}=require("child_process"),H="\x1B[38;2;231;233;237m",K="\x1B[31m",j="\x1B[0m";function f(t){console.log(` ${H}${t}${j}`)}function d(t){console.error(` ${K}${t}${j}`)}function Y(t){let n={};return t.forEach(o=>{if(o.startsWith("--")){let[s,r]=o.slice(2).split("=");s&&r&&(n[s]=r)}}),n}function O(t,n){try{let o=JSON.parse(i.readFileSync(t,"utf8"));return!!(o.dependencies&&o.dependencies[n]||o.devDependencies&&o.devDependencies[n])}catch{return!1}}function X(t,n){try{return i.existsSync(p.join(t,"node_modules",n,"package.json"))}catch{return!1}}function z(t,n){if(i.existsSync(p.join(t,"pnpm-lock.yaml")))return"pnpm";if(i.existsSync(p.join(t,"yarn.lock")))return"yarn";if(i.existsSync(p.join(t,"bun.lockb")))return"bun";try{let o=JSON.parse(i.readFileSync(n,"utf8"));if(typeof o.packageManager=="string"){if(o.packageManager.startsWith("pnpm"))return"pnpm";if(o.packageManager.startsWith("yarn"))return"yarn";if(o.packageManager.startsWith("bun"))return"bun"}}catch{}return"npm"}function G(t,n){if(!O(n,"fleetbo-svro")||!X(t,"fleetbo-svro")){let o=z(t,n),s={pnpm:"pnpm add fleetbo-svro",yarn:"yarn add fleetbo-svro",bun:"bun add fleetbo-svro",npm:"npm install fleetbo-svro"}[o];f(`\u2192 Installing fleetbo-svro into the project (detected: ${o})...`);try{W(s,{cwd:t,stdio:"inherit"}),f("fleetbo-svro installed successfully!")}catch(r){d(`\u26A0\uFE0F Automatic installation failed: ${r.message}`),d(`\u{1F449} Please run '${s}' manually.`)}}}function Q(t){let n=p.join(t,"svro.schema.json");if(i.existsSync(n))return;let o=new Date().toISOString(),s={createdAt:o,patchedAt:o,schemaVersion:1,collections:{}};i.writeFileSync(n,JSON.stringify(s,null,2)+`
|
|
3
3
|
`),f("\u2192 Created svro.schema.json at project root.")}function Z(t){let n=p.join(t,".env"),o=`
|
|
4
4
|
# Fleetbo UI Sandbox Mode
|
|
5
5
|
# true = Sandbox mode: simulates writes locally for fluid UI testing; no DB access and IDE alert.
|
|
@@ -23,6 +23,11 @@ type FleetboPhoneOtpOptions = {
|
|
|
23
23
|
appName?: string;
|
|
24
24
|
};
|
|
25
25
|
|
|
26
|
+
type FleetboFacebookAuthOptions = {
|
|
27
|
+
accessToken?: string;
|
|
28
|
+
scope?: string;
|
|
29
|
+
};
|
|
30
|
+
|
|
26
31
|
type FleetboProp = {
|
|
27
32
|
value?: any;
|
|
28
33
|
fallback?: string;
|
|
@@ -49,34 +54,11 @@ declare global {
|
|
|
49
54
|
type FleetboTables = string;
|
|
50
55
|
const Fleetbo: typeof import('fleetbo-svro')['Fleetbo'];
|
|
51
56
|
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
'fleetbo-number': FleetboProp;
|
|
56
|
-
'fleetbo-toggle': FleetboProp;
|
|
57
|
-
'fleetbo-date': FleetboProp;
|
|
58
|
-
'fleetbo-enum': FleetboProp;
|
|
59
|
-
'fleetbo-media': FleetboProp;
|
|
60
|
-
'fleetbo-reference': FleetboProp;
|
|
61
|
-
}
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
namespace React {
|
|
65
|
-
namespace JSX {
|
|
66
|
-
interface IntrinsicElements {
|
|
67
|
-
'fleetbo-text': FleetboProp;
|
|
68
|
-
'fleetbo-number': FleetboProp;
|
|
69
|
-
'fleetbo-toggle': FleetboProp;
|
|
70
|
-
'fleetbo-date': FleetboProp;
|
|
71
|
-
'fleetbo-enum': FleetboProp;
|
|
72
|
-
'fleetbo-media': FleetboProp;
|
|
73
|
-
'fleetbo-reference': FleetboProp;
|
|
74
|
-
}
|
|
75
|
-
}
|
|
57
|
+
interface Window {
|
|
58
|
+
Fleetbo: typeof Fleetbo;
|
|
59
|
+
FB?: any;
|
|
76
60
|
}
|
|
77
|
-
}
|
|
78
61
|
|
|
79
|
-
declare module 'react' {
|
|
80
62
|
namespace JSX {
|
|
81
63
|
interface IntrinsicElements {
|
|
82
64
|
'fleetbo-text': FleetboProp;
|
|
@@ -88,7 +70,6 @@ declare module 'react' {
|
|
|
88
70
|
'fleetbo-reference': FleetboProp;
|
|
89
71
|
}
|
|
90
72
|
}
|
|
91
|
-
}
|
|
92
73
|
`;try{i.writeFileSync(o,s),f("\u2192 Created src/fleetbo.d.ts stub for instant IDE auto-completion.")}catch(r){d(`\u26A0\uFE0F Unable to create src/fleetbo.d.ts: ${r.message}`)}}function te(t){let n=p.join(t,"index.d.ts");i.existsSync(n)||f("\u2192 Verified index.d.ts presence.")}function oe(t){let n=["tsconfig.json","jsconfig.json"];for(let o of n){let s=p.join(t,o);if(i.existsSync(s)){let r=new Date;i.utimesSync(s,r,r);break}}}function ne(t){return new Promise((n,o)=>{let s=JSON.stringify({token:t}),r={hostname:"bootstrapproject-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},b=q.request(r,e=>{let a="";e.on("data",l=>{a+=l}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{n(JSON.parse(a))}catch{o(new Error("Invalid response received from Fleetbo server."))}else try{let l=JSON.parse(a);o(new Error(l.error||`Server error ${e.statusCode}`))}catch{o(new Error(`Server error ${e.statusCode}`))}})});b.on("error",e=>o(e)),b.write(s),b.end()})}async function se(t,n=[]){let o=p.join(t,".env");if(i.existsSync(o)&&i.readFileSync(o,"utf8").includes("VITE_FLEETBO_DB_KEY")){f("\u2192 Fleetbo environment variables already present in .env \u2014 skipping step.");return}let s=Y(n),r=s.keyApp,b=s.token||s.bootstrapToken,e=s.email||"";(!r||!b)&&(d("\u26A0\uFE0F Missing required parameters."),d("\u{1F449} Usage: npx fleetbo-svro init --keyApp=YOUR_KEY --token=YOUR_TOKEN"),process.exit(1)),f("\u2192 Exchanging bootstrap token for project keys...");let a;try{a=await ne(b)}catch(c){d(`\u26A0\uFE0F Token exchange failed: ${c.message}`),d("\u{1F449} The token may have expired (15 min limit) or was already used. Please regenerate one from the Fleetbo dashboard."),process.exit(1)}(!a.enterpriseId||!a.fleetboDBKey)&&(d("\u26A0\uFE0F Incomplete response from Fleetbo server."),process.exit(1));let l=`
|
|
93
74
|
VITE_FLEETBO_DB_KEY=${a.fleetboDBKey}
|
|
94
75
|
VITE_FLEETBO_ENTERPRISE_ID=${a.enterpriseId}
|
|
@@ -154,27 +135,27 @@ ${e?`VITE_FLEETBO_TESTER_EMAIL=${e}
|
|
|
154
135
|
imports: [{ '${b}': ['Fleetbo', 'FleetboUI'] }],
|
|
155
136
|
dts: 'src/auto-imports.d.ts'
|
|
156
137
|
}),`;if(e=e.slice(0,c)+P+e.slice(c),!e.includes("import AutoImport")){let T=[...e.matchAll(/^import .+;?$/gm)].pop(),S=`import AutoImport from 'unplugin-auto-import/vite';
|
|
157
|
-
`;if(T){let
|
|
158
|
-
`+S+e.slice(
|
|
138
|
+
`;if(T){let v=T.index+T[0].length;e=e.slice(0,v)+`
|
|
139
|
+
`+S+e.slice(v)}else e=S+e}}}if(!e.includes("fleetbo-auto-runtime")){let l=e.match(/plugins\s*:\s*\[/);if(l){let c=l.index+l[0].length;e=e.slice(0,c)+`
|
|
159
140
|
`+a+e.slice(c)}}e!==r&&i.writeFileSync(s,e)}function re(t){let n=p.join(t,".vscode"),o=p.join(n,"settings.json");try{i.existsSync(n)||i.mkdirSync(n,{recursive:!0});let s={};if(i.existsSync(o))try{s=JSON.parse(i.readFileSync(o,"utf8"))}catch{s={}}s["workbench.colorCustomizations"]=s["workbench.colorCustomizations"]||{},s["workbench.colorCustomizations"]["editorInfo.foreground"]="#00feae",s["workbench.colorCustomizations"]["editorHint.foreground"]="#00feae",i.writeFileSync(o,JSON.stringify(s,null,2)+`
|
|
160
|
-
`),f("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function le(t,n,o={}){let{skipSelfInstall:s=!1}=o,r=p.join(__dirname,"..");s||G(t,n),Q(t),Z(t),te(r),ee(t),re(t),_(t),C(t,n),L(t,n),R(t)}$.exports={touchTsConfig:oe,log:f,logError:d,handleAuthAndEnv:se,detectDependency:O,cleanupLegacyRootDts:_,patchJsOrTsConfig:C,attemptViteAutoImportPatch:L,injectUniversalRuntime:R,runFullSetup:le}});var m=require("fs"),y=require("path"),
|
|
161
|
-
`).forEach(r=>{let[b,...e]=r.split("=");b&&e.length>0&&(s[b.trim()]=e.join("=").trim())}),s}function ge(t){return new Promise((n,o)=>{let s=JSON.stringify({projectId:t,moduleName:"svro.schema.json"}),r={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},b=
|
|
141
|
+
`),f("\u2192 Configured Fleetbo Cyan visual hints in .vscode/settings.json.")}catch{}}function le(t,n,o={}){let{skipSelfInstall:s=!1}=o,r=p.join(__dirname,"..");s||G(t,n),Q(t),Z(t),te(r),ee(t),re(t),_(t),C(t,n),L(t,n),R(t)}$.exports={touchTsConfig:oe,log:f,logError:d,handleAuthAndEnv:se,detectDependency:O,cleanupLegacyRootDts:_,patchJsOrTsConfig:C,attemptViteAutoImportPatch:L,injectUniversalRuntime:R,runFullSetup:le}});var m=require("fs"),y=require("path"),N=require("https"),{runFullSetup:ie,handleAuthAndEnv:ae,touchTsConfig:ce,attemptViteAutoImportPatch:be,injectUniversalRuntime:pe}=A(),fe="\x1B[34m",de="\x1B[31m",D="\x1B[0m";function u(t){console.log(`${fe}${t}${D}`)}function h(t){console.error(`${de}${t}${D}`)}function ue(t,n){return new Promise((o,s)=>{let r=JSON.stringify({enterpriseID:t,schema:n}),b={hostname:"fleetbo-gatekeeper.fleetbo.workers.dev",path:"/sync-schema",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(r)}},e=N.request(b,a=>{let l="";a.on("data",c=>{l+=c}),a.on("end",()=>{a.statusCode>=200&&a.statusCode<300?o(JSON.parse(l)):s(new Error(`Edge sync failed with HTTP ${a.statusCode}`))})});e.on("error",a=>s(a)),e.write(r),e.end()})}function me(t){let n=y.join(t,".env");if(!m.existsSync(n))return{};let o=m.readFileSync(n,"utf8"),s={};return o.split(`
|
|
142
|
+
`).forEach(r=>{let[b,...e]=r.split("=");b&&e.length>0&&(s[b.trim()]=e.join("=").trim())}),s}function ge(t){return new Promise((n,o)=>{let s=JSON.stringify({projectId:t,moduleName:"svro.schema.json"}),r={hostname:"getmodulecache-jqycakhlxa-uc.a.run.app",path:"/",method:"POST",headers:{"Content-Type":"application/json","Content-Length":Buffer.byteLength(s)}},b=N.request(r,e=>{let a="";e.on("data",l=>{a+=l}),e.on("end",()=>{if(e.statusCode>=200&&e.statusCode<300)try{let l=JSON.parse(a);if(l.success&&l.found&&l.module){let c=l.module.code||l.module.mockCode;n(typeof c=="string"?JSON.parse(c):c)}else o(new Error("Schema not found in Fleetbo Cloud."))}catch{o(new Error("Invalid JSON response received from Fleetbo server."))}else o(new Error(`Server error ${e.statusCode}`))})});b.on("error",e=>o(e)),b.write(s),b.end()})}var k=process.argv.slice(2),I=k[0];async function Fe(){let t=process.cwd(),n=y.join(t,"package.json");if(I==="init"||I==="doctor")u(`
|
|
162
143
|
[Fleetbo] Initializing and configuring Fleetbo...`),await ae(t,k),ie(t,n),u(`
|
|
163
144
|
[Fleetbo] Configuration completed successfully!
|
|
164
145
|
`),u(`
|
|
165
146
|
Next step:`),u(` npx fleetbo-svro sync (Sync cloud schema & generate IDE types)
|
|
166
147
|
`);else if(I==="sync"){let o=k.includes("--dry-run");u(`[Fleetbo] Syncing schema...${o?" (dry-run)":""}`);let s=y.join(t,"svro.schema.json"),r=y.join(__dirname,".."),b=y.join(r,"index.d.ts"),e=y.join(t,"src","fleetbo.d.ts"),l=me(t).VITE_FLEETBO_ENTERPRISE_ID;if(l)try{u("\u2192 Fetching latest svro.schema.json from Fleetbo OS...");let c=await ge(l);m.writeFileSync(s,JSON.stringify(c,null,2)+`
|
|
167
|
-
`),u("\u2192 Local svro.schema.json updated from FLeetbo OS.")}catch(c){h(`\u26A0\uFE0F Cloud fetch bypassed: ${c.message}. Using local file fallback.`)}else h("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");m.existsSync(s)||(h("Error: svro.schema.json not found."),process.exit(1));try{let c=JSON.parse(m.readFileSync(s,"utf8")),P=Object.keys(c.collections||{});if(l)try{await ue(l,c),u("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(g){h(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${g.message}`)}let T=c.collections||{},S=Object.entries(T).map(([g,w])=>{let
|
|
148
|
+
`),u("\u2192 Local svro.schema.json updated from FLeetbo OS.")}catch(c){h(`\u26A0\uFE0F Cloud fetch bypassed: ${c.message}. Using local file fallback.`)}else h("\u26A0\uFE0F VITE_FLEETBO_ENTERPRISE_ID missing in .env. Skipping cloud fetch.");m.existsSync(s)||(h("Error: svro.schema.json not found."),process.exit(1));try{let c=JSON.parse(m.readFileSync(s,"utf8")),P=Object.keys(c.collections||{});if(l)try{await ue(l,c),u("\u2192 Schema successfully sealed at Fleetbo Global Edge (O(1)).")}catch(g){h(`\u26A0\uFE0F Fleetbo Edge Shield sync warning: ${g.message}`)}let T=c.collections||{},S=Object.entries(T).map(([g,w])=>{let B=w.fields||w.schema||{},U=Object.entries(B).map(([M,x])=>{let E="any",F=String(typeof x=="string"?x:x.type||"").toLowerCase();return F==="string"||F==="text"||F==="media"?E="string":F==="number"?E="number":F==="boolean"||F==="toggle"?E="boolean":F==="array"&&(E="any[]"),` ${M}?: ${E};`}).join(`
|
|
168
149
|
`);return` ${g}: {
|
|
169
|
-
${
|
|
150
|
+
${U}
|
|
170
151
|
};`}).join(`
|
|
171
|
-
`),
|
|
152
|
+
`),v=P.length>0?P.map(g=>`'${g}'`).join(" | "):"string",J=`// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
172
153
|
|
|
173
154
|
export interface FleetboSchemaMap {
|
|
174
155
|
${S}
|
|
175
156
|
}
|
|
176
157
|
|
|
177
|
-
export type KnownFleetboTables = ${
|
|
158
|
+
export type KnownFleetboTables = ${v};
|
|
178
159
|
|
|
179
160
|
export type FleetboTables =
|
|
180
161
|
| KnownFleetboTables
|
|
@@ -278,6 +259,7 @@ export declare const Fleetbo: {
|
|
|
278
259
|
|
|
279
260
|
sendOtpByPhone(options: string | FleetboPhoneOtpOptions): Promise<FleetboWriteResult>;
|
|
280
261
|
verifyOtpPhoneSvro(phoneNumber: string, code: string): Promise<FleetboAuthResult>;
|
|
262
|
+
verifyFacebookAuth(options?: string | { accessToken?: string; scope?: string }): Promise<FleetboAuthResult & { cancelled?: boolean; projects?: string[] }>;
|
|
281
263
|
|
|
282
264
|
isAuthenticated(forceRefresh?: boolean): Promise<boolean>;
|
|
283
265
|
logout(): Promise<{ success: boolean; error?: string }>;
|
|
@@ -317,6 +299,7 @@ declare global {
|
|
|
317
299
|
|
|
318
300
|
interface Window {
|
|
319
301
|
Fleetbo: typeof Fleetbo;
|
|
302
|
+
FB?: any;
|
|
320
303
|
}
|
|
321
304
|
|
|
322
305
|
interface HTMLElementTagNameMap {
|
|
@@ -407,7 +390,7 @@ declare module 'svelte/elements' {
|
|
|
407
390
|
'fleetbo-reference': FleetboProp;
|
|
408
391
|
}
|
|
409
392
|
}
|
|
410
|
-
`;if(m.writeFileSync(b,
|
|
393
|
+
`;if(m.writeFileSync(b,J),m.existsSync(y.dirname(e))){let g=`/* eslint-disable */
|
|
411
394
|
/* prettier-ignore */
|
|
412
395
|
// @ts-nocheck
|
|
413
396
|
// Generated by fleetbo-svro \u2014 Updated via fleetbo sync
|
|
@@ -440,7 +423,7 @@ ${S}
|
|
|
440
423
|
}
|
|
441
424
|
|
|
442
425
|
declare global {
|
|
443
|
-
type KnownFleetboTables = ${
|
|
426
|
+
type KnownFleetboTables = ${v};
|
|
444
427
|
type FleetboTables = KnownFleetboTables | (string & { _fleetboPending?: never });
|
|
445
428
|
type FleetboData<T extends string> = T extends KnownFleetboTables
|
|
446
429
|
? Partial<FleetboSchemaMap[T]>
|
|
@@ -450,6 +433,17 @@ declare global {
|
|
|
450
433
|
phoneNumber: string;
|
|
451
434
|
appName?: string;
|
|
452
435
|
};
|
|
436
|
+
|
|
437
|
+
type FleetboFacebookAuthOptions = {
|
|
438
|
+
accessToken?: string;
|
|
439
|
+
scope?: string;
|
|
440
|
+
};
|
|
441
|
+
|
|
442
|
+
interface Window {
|
|
443
|
+
Fleetbo: typeof Fleetbo;
|
|
444
|
+
FB?: any;
|
|
445
|
+
}
|
|
446
|
+
|
|
453
447
|
const Fleetbo: typeof import('fleetbo-svro')['Fleetbo'];
|
|
454
448
|
|
|
455
449
|
namespace JSX {
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var _a=Object.defineProperty;var O=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(i){throw t=[i],i}};var Si=(n,e)=>{for(var t in e)_a(n,t,{get:e[t],enumerable:!0})};var ki,Ri=O(()=>{ki=()=>{}});function Ea(){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 v(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Di(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())}function Li(){return typeof window<"u"||rn()}function rn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Mi(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ui(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Fi(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function xi(){let n=v();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Vi(){try{return typeof indexedDB=="object"}catch{return!1}}function Hi(){return new Promise((n,e)=>{try{let t=!0,i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),t||self.indexedDB.deleteDatabase(i),n(!0)},r.onupgradeneeded=()=>{t=!1},r.onerror=()=>{e(r.error?.message||"")}}catch(t){e(t)}})}function Aa(n,e){return n.replace(Sa,(t,i)=>{let r=e[i];return r!=null?String(r):`<${i}?>`})}function Wi(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Y(n,e){if(n===e)return!0;let t=Object.keys(n),i=Object.keys(e);for(let r of t){if(!i.includes(r))return!1;let s=n[r],o=e[r];if(Ci(s)&&Ci(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let r of i)if(!t.includes(r))return!1;return!0}function Ci(n){return n!==null&&typeof n=="object"}function re(n){let e=[];for(let[t,i]of Object.entries(n))Array.isArray(i)?i.forEach(r=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function me(n){let e={};return n.replace(/^\?/,"").split("&").forEach(i=>{if(i){let[r,s]=i.split("=");e[decodeURIComponent(r)]=decodeURIComponent(s)}}),e}function ge(n){let e=n.indexOf("?");if(!e)return"";let t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function Bi(n,e){let t=new Zt(n,e);return t.subscribe.bind(t)}function ka(n,e){if(typeof n!="object"||n===null)return!1;for(let t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Xt(){}function p(n){return n&&n._delegate?n._delegate:n}function tt(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function $i(n){return(await fetch(n,{credentials:"include"})).ok}var Pi,Ia,Oi,Qt,ba,en,Pe,ya,Ta,wa,tn,Ni,et,nn,pe,va,C,W,Sa,Zt,tu,_e=O(()=>{Ri();Pi=function(n){let e=[],t=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):(r&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(r=65536+((r&1023)<<10)+(n.charCodeAt(++i)&1023),e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},Ia=function(n){let e=[],t=0,i=0;for(;t<n.length;){let r=n[t++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){let s=n[t++];e[i++]=String.fromCharCode((r&31)<<6|s&63)}else if(r>239&&r<365){let s=n[t++],o=n[t++],c=n[t++],l=((r&7)<<18|(s&63)<<12|(o&63)<<6|c&63)-65536;e[i++]=String.fromCharCode(55296+(l>>10)),e[i++]=String.fromCharCode(56320+(l&1023))}else{let s=n[t++],o=n[t++];e[i++]=String.fromCharCode((r&15)<<12|(s&63)<<6|o&63)}}return e.join("")},Oi={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<n.length;r+=3){let s=n[r],o=r+1<n.length,c=o?n[r+1]:0,l=r+2<n.length,a=l?n[r+2]:0,d=s>>2,h=(s&3)<<4|c>>4,f=(c&15)<<2|a>>6,A=a&63;l||(A=64,o||(f=64)),i.push(t[d],t[h],t[f],t[A])}return i.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Pi(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Ia(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<n.length;){let s=t[n.charAt(r++)],c=r<n.length?t[n.charAt(r)]:0;++r;let a=r<n.length?t[n.charAt(r)]:64;++r;let h=r<n.length?t[n.charAt(r)]:64;if(++r,s==null||c==null||a==null||h==null)throw new Qt;let f=s<<2|c>>4;if(i.push(f),a!==64){let A=c<<4&240|a>>2;if(i.push(A),h!==64){let L=a<<6&192|h;i.push(L)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},Qt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},ba=function(n){let e=Pi(n);return Oi.encodeByteArray(e,!0)},en=function(n){return ba(n).replace(/\./g,"")},Pe=function(n){try{return Oi.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};ya=()=>Ea().__FIREBASE_DEFAULTS__,Ta=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},wa=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Pe(n[1]);return e&&JSON.parse(e)},tn=()=>{try{return ki()||ya()||Ta()||wa()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Ni=n=>tn()?.emulatorHosts?.[n],et=()=>tn()?.config,nn=n=>tn()?.[`_${n}`];pe=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,i)=>{t?this.reject(t):this.resolve(i),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,i))}}};va="FirebaseError",C=class n extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name=va,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,W.prototype.create)}},W=class{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){let i=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],o=s?Aa(s,i):"Error",c=`${this.serviceName}: ${o} (${r}).`;return new C(r,c,i)}};Sa=/\{\$([^}]+)}/g;Zt=class{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(i=>{this.error(i)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,i){let r;if(e===void 0&&t===void 0&&i===void 0)throw new Error("Missing Observer.");ka(e,["next","error","complete"])?r=e:r={next:e,error:t,complete:i},r.next===void 0&&(r.next=Xt),r.error===void 0&&(r.error=Xt),r.complete===void 0&&(r.complete=Xt);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(i){typeof console<"u"&&console.error&&console.error(i)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};tu=14400*1e3;});function Ra(n){return n===se?void 0:n}function Ca(n){return n.instantiationMode==="EAGER"}var U,se,sn,Oe,nt=O(()=>{_e();U=class{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,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}};se="[DEFAULT]";sn=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let i=new pe;if(this.instancesDeferred.set(t,i),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&i.resolve(r)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),i=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(r){if(i)return null;throw r}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Ca(e))try{this.getOrInitializeService({instanceIdentifier:se})}catch{}for(let[t,i]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:r});i.resolve(s)}catch{}}}}clearInstance(e=se){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(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=se){return this.instances.has(e)}getOptions(e=se){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:i,options:t});for(let[s,o]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);i===c&&o.resolve(r)}return r}onInit(e,t){let i=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(i)??new Set;r.add(e),this.onInitCallbacks.set(i,r);let s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let i=this.onInitCallbacks.get(t);if(i)for(let r of i)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:Ra(e),options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch{}return i||null}normalizeInstanceIdentifier(e=se){return this.component?this.component.multipleInstances?e:se:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};Oe=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new sn(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}});function zi(n){an.forEach(e=>{e.setLogLevel(n)})}function qi(n,e){for(let t of an){let i=null;e&&e.level&&(i=ji[e.level]),n===null?t.userLogHandler=null:t.userLogHandler=(r,s,...o)=>{let c=o.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>=(i??r.logLevel)&&n({level:m[s].toLowerCase(),message:c,args:o,type:r.name})}}}var an,m,ji,Pa,Oa,Na,Ie,it=O(()=>{an=[];(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(m||(m={}));ji={debug:m.DEBUG,verbose:m.VERBOSE,info:m.INFO,warn:m.WARN,error:m.ERROR,silent:m.SILENT},Pa=m.INFO,Oa={[m.DEBUG]:"log",[m.VERBOSE]:"log",[m.INFO]:"info",[m.WARN]:"warn",[m.ERROR]:"error"},Na=(n,e,...t)=>{if(e<n.logLevel)return;let i=new Date().toISOString(),r=Oa[e];if(r)console[r](`[${i}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Ie=class{constructor(e){this.name=e,this._logLevel=Pa,this._logHandler=Na,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"?ji[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 La(){return Gi||(Gi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ma(){return Ki||(Ki=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function Ua(n){let e=new Promise((t,i)=>{let r=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(F(n.result)),r()},o=()=>{i(n.error),r()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ji.set(t,n)}).catch(()=>{}),un.set(e,n),e}function Fa(n){if(cn.has(n))return;let e=new Promise((t,i)=>{let r=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),r()},o=()=>{i(n.error||new DOMException("AbortError","AbortError")),r()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});cn.set(n,e)}function Xi(n){ln=n(ln)}function xa(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let i=n.call(rt(this),e,...t);return Yi.set(i,e.sort?e.sort():[e]),F(i)}:Ma().includes(n)?function(...e){return n.apply(rt(this),e),F(Ji.get(this))}:function(...e){return F(n.apply(rt(this),e))}}function Va(n){return typeof n=="function"?xa(n):(n instanceof IDBTransaction&&Fa(n),Da(n,La())?new Proxy(n,ln):n)}function F(n){if(n instanceof IDBRequest)return Ua(n);if(on.has(n))return on.get(n);let e=Va(n);return e!==n&&(on.set(n,e),un.set(e,n)),e}var Da,Gi,Ki,Ji,cn,Yi,on,un,ln,rt,dn=O(()=>{Da=(n,e)=>e.some(t=>n instanceof t);Ji=new WeakMap,cn=new WeakMap,Yi=new WeakMap,on=new WeakMap,un=new WeakMap;ln={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return cn.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Yi.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return F(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};rt=n=>un.get(n)});function Zi(n,e,{blocked:t,upgrade:i,blocking:r,terminated:s}={}){let o=indexedDB.open(n,e),c=F(o);return i&&o.addEventListener("upgradeneeded",l=>{i(F(o.result),l.oldVersion,l.newVersion,F(o.transaction),l)}),t&&o.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),r&&l.addEventListener("versionchange",a=>r(a.oldVersion,a.newVersion,a))}).catch(()=>{}),c}function Qi(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(hn.get(e))return hn.get(e);let t=e.replace(/FromIndex$/,""),i=e!==t,r=Wa.includes(t);if(!(t in(i?IDBIndex:IDBObjectStore).prototype)||!(r||Ha.includes(t)))return;let s=async function(o,...c){let l=this.transaction(o,r?"readwrite":"readonly"),a=l.store;return i&&(a=a.index(c.shift())),(await Promise.all([a[t](...c),r&&l.done]))[0]};return hn.set(e,s),s}var Ha,Wa,hn,er=O(()=>{dn();dn();Ha=["get","getKey","getAll","getAllKeys","count"],Wa=["put","add","delete","clear"],hn=new Map;Xi(n=>({...n,get:(e,t,i)=>Qi(e,t)||n.get(e,t,i),has:(e,t)=>!!Qi(e,t)||n.has(e,t)}))});function Ba(n){return n.getComponent()?.type==="VERSION"}function gn(n,e){try{n.container.addComponent(e)}catch(t){B.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Io(n,e){n.container.addOrOverwriteComponent(e)}function ae(n){let e=n.name;if(Ee.has(e))return B.debug(`There were multiple attempts to register component ${e}.`),!1;Ee.set(e,n);for(let t of X.values())gn(t,n);for(let t of be.values())gn(t,n);return!0}function Le(n,e){let t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function bo(n,e,t=Ne){Le(n,e).clearInstance(t)}function En(n){return n.options!==void 0}function sr(n){return En(n)?!1:"authIdToken"in n||"appCheckToken"in n||"releaseOnDeref"in n||"automaticDataCollectionEnabled"in n}function I(n){return n==null?!1:n.settings!==void 0}function Eo(){Ee.clear()}function tr(n,e){let t=Pe(n.split(".")[1]);if(t===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(t).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let r=JSON.parse(t).exp*1e3,s=new Date().getTime();r-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function ar(n,e={}){let t=n;typeof e!="object"&&(e={name:e});let i={name:Ne,automaticDataCollectionEnabled:!0,...e},r=i.name;if(typeof r!="string"||!r)throw R.create("bad-app-name",{appName:String(r)});if(t||(t=et()),!t)throw R.create("no-options");let s=X.get(r);if(s){if(Y(t,s.options)&&Y(i,s.config))return s;throw R.create("duplicate-app",{appName:r})}let o=new Oe(r);for(let l of Ee.values())o.addComponent(l);let c=new at(t,i,o);return X.set(r,c),c}function To(n,e={}){if(Li()&&!rn())throw R.create("invalid-server-app-environment");let t,i=e||{};if(n&&(En(n)?t=n.options:sr(n)?i=n:t=n),i.automaticDataCollectionEnabled===void 0&&(i.automaticDataCollectionEnabled=!0),t||(t=et()),!t)throw R.create("no-options");let r={...i,...t};r.releaseOnDeref!==void 0&&delete r.releaseOnDeref;let s=d=>[...d].reduce((h,f)=>Math.imul(31,h)+f.charCodeAt(0)|0,0);if(i.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw R.create("finalization-registry-not-supported",{});let o=""+s(JSON.stringify(r)),c=be.get(o);if(c)return c.incRefCount(i.releaseOnDeref),c;let l=new Oe(o);for(let d of Ee.values())l.addComponent(d);let a=new _n(t,i,o,l);return be.set(o,a),a}function yn(n=Ne){let e=X.get(n);if(!e&&n===Ne&&et())return ar();if(!e)throw R.create("no-app",{appName:n});return e}function wo(){return Array.from(X.values())}async function or(n){let e=!1,t=n.name;X.has(t)?(e=!0,X.delete(t)):be.has(t)&&n.decRefCount()<=0&&(be.delete(t),e=!0),e&&(await Promise.all(n.container.getProviders().map(i=>i.delete())),n.isDeleted=!0)}function x(n,e,t){let i=_o[n]??n;t&&(i+=`-${t}`);let r=i.match(/\s|\//),s=e.match(/\s|\//);if(r||s){let o=[`Unable to register library "${i}" with version "${e}":`];r&&o.push(`library name "${i}" contains illegal characters (whitespace or "/")`),r&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),B.warn(o.join(" "));return}ae(new U(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function vo(n,e){if(n!==null&&typeof n!="function")throw R.create("invalid-log-argument");qi(n,e)}function Ao(n){zi(n)}function cr(){return fn||(fn=Zi(So,ko,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(De)}catch(t){console.warn(t)}}}}).catch(n=>{throw R.create("idb-open",{originalErrorMessage:n.message})})),fn}async function Ro(n){try{let t=(await cr()).transaction(De),i=await t.objectStore(De).get(lr(n));return await t.done,i}catch(e){if(e instanceof C)B.warn(e.message);else{let t=R.create("idb-get",{originalErrorMessage:e?.message});B.warn(t.message)}}}async function nr(n,e){try{let i=(await cr()).transaction(De,"readwrite");await i.objectStore(De).put(e,lr(n)),await i.done}catch(t){if(t instanceof C)B.warn(t.message);else{let i=R.create("idb-set",{originalErrorMessage:t?.message});B.warn(i.message)}}}function lr(n){return`${n.name}!${n.options.appId}`}function ir(){return new Date().toISOString().substring(0,10)}function Oo(n,e=Co){let t=[],i=n.slice();for(let r of n){let s=t.find(o=>o.agent===r.agent);if(s){if(s.dates.push(r.date),rr(t)>e){s.dates.pop();break}}else if(t.push({agent:r.agent,dates:[r.date]}),rr(t)>e){t.pop();break}i=i.slice(1)}return{heartbeatsToSend:t,unsentEntries:i}}function rr(n){return en(JSON.stringify({version:2,heartbeats:n})).length}function No(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let i=1;i<n.length;i++)n[i].date<t&&(t=n[i].date,e=i);return e}function Do(n){ae(new U("platform-logger",e=>new pn(e),"PRIVATE")),ae(new U("heartbeat",e=>new In(e),"PRIVATE")),x(st,mn,n),x(st,mn,"esm2020"),x("fire-js","")}var pn,st,mn,B,$a,ja,za,qa,Ga,Ka,Ja,Ya,Xa,Qa,Za,eo,to,no,io,ro,so,ao,oo,co,lo,uo,ho,fo,po,mo,go,Ne,_o,X,be,Ee,yo,R,at,_n,oe,So,ko,De,fn,Co,Po,In,bn,Me=O(()=>{nt();it();_e();_e();er();pn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ba(t)){let i=t.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(t=>t).join(" ")}};st="@firebase/app",mn="0.15.1";B=new Ie("@firebase/app"),$a="@firebase/app-compat",ja="@firebase/analytics-compat",za="@firebase/analytics",qa="@firebase/app-check-compat",Ga="@firebase/app-check",Ka="@firebase/auth",Ja="@firebase/auth-compat",Ya="@firebase/database",Xa="@firebase/data-connect",Qa="@firebase/database-compat",Za="@firebase/functions",eo="@firebase/functions-compat",to="@firebase/installations",no="@firebase/installations-compat",io="@firebase/messaging",ro="@firebase/messaging-compat",so="@firebase/performance",ao="@firebase/performance-compat",oo="@firebase/remote-config",co="@firebase/remote-config-compat",lo="@firebase/storage",uo="@firebase/storage-compat",ho="@firebase/firestore",fo="@firebase/ai",po="@firebase/firestore-compat",mo="firebase",go="12.16.0";Ne="[DEFAULT]",_o={[st]:"fire-core",[$a]:"fire-core-compat",[za]:"fire-analytics",[ja]:"fire-analytics-compat",[Ga]:"fire-app-check",[qa]:"fire-app-check-compat",[Ka]:"fire-auth",[Ja]:"fire-auth-compat",[Ya]:"fire-rtdb",[Xa]:"fire-data-connect",[Qa]:"fire-rtdb-compat",[Za]:"fire-fn",[eo]:"fire-fn-compat",[to]:"fire-iid",[no]:"fire-iid-compat",[io]:"fire-fcm",[ro]:"fire-fcm-compat",[so]:"fire-perf",[ao]:"fire-perf-compat",[oo]:"fire-rc",[co]:"fire-rc-compat",[lo]:"fire-gcs",[uo]:"fire-gcs-compat",[ho]:"fire-fst",[po]:"fire-fst-compat",[fo]:"fire-vertex","fire-js":"fire-js",[mo]:"fire-js-all"};X=new Map,be=new Map,Ee=new Map;yo={"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."},R=new W("app","Firebase",yo);at=class{constructor(e,t,i){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new U("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw R.create("app-deleted",{appName:this._name})}};_n=class extends at{constructor(e,t,i,r){let s=t.automaticDataCollectionEnabled!==void 0?t.automaticDataCollectionEnabled:!0,o={name:i,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,o,r);else{let c=e;super(c.options,o,r)}this._serverConfig={automaticDataCollectionEnabled:s,...t},this._serverConfig.authIdToken&&tr(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&tr(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,t.releaseOnDeref=void 0,x(st,mn,"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(){or(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw R.create("server-app-deleted")}};oe=go;So="firebase-heartbeat-database",ko=1,De="firebase-heartbeat-store",fn=null;Co=1024,Po=30,In=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new bn(t),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){try{let t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=ir();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(r=>r.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:t}),this._heartbeatsCache.heartbeats.length>Po){let r=No(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(r,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){B.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=ir(),{heartbeatsToSend:t,unsentEntries:i}=Oo(this._heartbeatsCache.heartbeats),r=en(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return B.warn(e),""}}};bn=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Vi()?Hi().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await Ro(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let i=await this.read();return nr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let i=await this.read();return nr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};Do("")});var ur={};Si(ur,{FirebaseError:()=>C,SDK_VERSION:()=>oe,_DEFAULT_ENTRY_NAME:()=>Ne,_addComponent:()=>gn,_addOrOverwriteComponent:()=>Io,_apps:()=>X,_clearComponents:()=>Eo,_components:()=>Ee,_getProvider:()=>Le,_isFirebaseApp:()=>En,_isFirebaseServerApp:()=>I,_isFirebaseServerAppSettings:()=>sr,_registerComponent:()=>ae,_removeServiceInstance:()=>bo,_serverApps:()=>be,deleteApp:()=>or,getApp:()=>yn,getApps:()=>wo,initializeApp:()=>ar,initializeServerApp:()=>To,onLog:()=>vo,registerVersion:()=>x,setLogLevel:()=>Ao});var Lo,Mo,dr=O(()=>{Me();Me();Lo="firebase",Mo="12.16.0";x(Lo,Mo,"app")});function Uo(){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 Fr(){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 Fo(n,...e){ft.logLevel<=m.WARN&&ft.warn(`Auth (${oe}): ${n}`,...e)}function lt(n,...e){ft.logLevel<=m.ERROR&&ft.error(`Auth (${oe}): ${n}`,...e)}function k(n,...e){throw ii(n,...e)}function S(n,...e){return ii(n,...e)}function ni(n,e,t){let i={...ti(),[e]:t};return new W("auth","Firebase",i).create(e,{appName:n.name})}function w(n){return ni(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Re(n,e,t){let i=t;if(!(e instanceof i))throw i.name!==e.constructor.name&&k(n,"argument-error"),ni(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function ii(n,...e){if(typeof n!="string"){let t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return Vr.create(n,...e)}function u(n,e,...t){if(!n)throw ii(e,...t)}function V(n){let e="INTERNAL ASSERTION FAILED: "+n;throw lt(e),new Error(e)}function z(n,e){n||V(e)}function Be(){return typeof self<"u"&&self.location?.href||""}function ri(){return hr()==="http:"||hr()==="https:"}function hr(){return typeof self<"u"&&self.location?.protocol||null}function xo(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(ri()||Ui()||"connection"in navigator)?navigator.onLine:!0}function Vo(){if(typeof navigator>"u")return null;let n=navigator;return n.languages&&n.languages[0]||n.language||null}function si(n,e){z(n.emulator,"Emulator should always be set here");let{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}function g(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function _(n,e,t,i,r={}){return Wr(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});let c=re({...o,key:n.config.apiKey}).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);let a={method:e,headers:l,...s};return Mi()||(a.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&tt(n.emulatorConfig.host)&&(a.credentials="include"),pt.fetch()(await Br(n,n.config.apiHost,t,c),a)})}async function Wr(n,e,t){n._canInitEmulator=!1;let i={...Ho,...e};try{let r=new Cn(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw Fe(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let c=s.ok?o.errorMessage:o.error.message,[l,a]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Fe(n,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw Fe(n,"email-already-in-use",o);if(l==="USER_DISABLED")throw Fe(n,"user-disabled",o);let d=i[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw ni(n,d,a);k(n,d)}}catch(r){if(r instanceof C)throw r;k(n,"network-request-failed",{message:String(r)})}}async function J(n,e,t,i,r={}){let s=await _(n,e,t,i,r);return"mfaPendingCredential"in s&&k(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function Br(n,e,t,i){let r=`${e}${t}?${i}`,s=n,o=s.config.emulator?si(n.config,r):`${n.config.apiScheme}://${r}`;return Wo.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function $o(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function Fe(n,e,t){let i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);let r=S(n,e,i);return r.customData._tokenResponse=t,r}function fr(n){return n!==void 0&&n.getResponse!==void 0}function pr(n){return n!==void 0&&n.enterprise!==void 0}async function jo(n){return(await _(n,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function $r(n,e){return _(n,"GET","/v2/recaptchaConfig",g(n,e))}async function zo(n,e){return _(n,"POST","/v1/accounts:delete",e)}async function qo(n,e){return _(n,"POST","/v1/accounts:update",e)}async function gt(n,e){return _(n,"POST","/v1/accounts:lookup",e)}function xe(n){if(n)try{let e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function jr(n,e=!1){return p(n).getIdToken(e)}async function ai(n,e=!1){let t=p(n),i=await t.getIdToken(e),r=Vt(i);u(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");let s=typeof r.firebase=="object"?r.firebase:void 0,o=s?.sign_in_provider;return{claims:r,token:i,authTime:xe(Tn(r.auth_time)),issuedAtTime:xe(Tn(r.iat)),expirationTime:xe(Tn(r.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Tn(n){return Number(n)*1e3}function Vt(n){let[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return lt("JWT malformed, contained fewer than 3 sections"),null;try{let r=Pe(t);return r?JSON.parse(r):(lt("Failed to decode base64 JWT payload"),null)}catch(r){return lt("Caught error parsing JWT payload as JSON",r?.toString()),null}}function mr(n){let e=Vt(n);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 q(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof C&&Go(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function Go({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}async function je(n){let e=n.auth,t=await n.getIdToken(),i=await q(n,gt(e,{idToken:t}));u(i?.users.length,e,"internal-error");let r=i.users[0];n._notifyReloadListener(r);let s=r.providerUserInfo?.length?zr(r.providerUserInfo):[],o=Ko(n.providerData,s),c=n.isAnonymous,l=!(n.email&&r.passwordHash)&&!o?.length,a=c?l:!1,d={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new $e(r.createdAt,r.lastLoginAt),isAnonymous:a};Object.assign(n,d)}async function oi(n){let e=p(n);await je(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Ko(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function zr(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function Jo(n,e){let t=await Wr(n,{},async()=>{let i=re({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=await Br(n,r,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:i};return n.emulatorConfig&&tt(n.emulatorConfig.host)&&(l.credentials="include"),pt.fetch()(o,l)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Yo(n,e){return _(n,"POST","/v2/accounts:revokeToken",g(n,e))}function Q(n,e){u(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}function $(n){z(n instanceof Function,"Expected a class definition");let e=gr.get(n);return e?(z(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,gr.set(n,e),e)}function ut(n,e,t){return`firebase:${n}:${e}:${t}`}function _r(n){let e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Jr(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(qr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Xr(e))return"Blackberry";if(Qr(e))return"Webos";if(Gr(e))return"Safari";if((e.includes("chrome/")||Kr(e))&&!e.includes("edge/"))return"Chrome";if(Yr(e))return"Android";{let t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if(i?.length===2)return i[1]}return"Other"}function qr(n=v()){return/firefox\//i.test(n)}function Gr(n=v()){let e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Kr(n=v()){return/crios\//i.test(n)}function Jr(n=v()){return/iemobile/i.test(n)}function Yr(n=v()){return/android/i.test(n)}function Xr(n=v()){return/blackberry/i.test(n)}function Qr(n=v()){return/webos/i.test(n)}function ci(n=v()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Xo(n=v()){return ci(n)&&!!window.navigator?.standalone}function Qo(){return xi()&&document.documentMode===10}function Zr(n=v()){return ci(n)||Yr(n)||Qr(n)||Xr(n)||/windows phone/i.test(n)||Jr(n)}function es(n,e=[]){let t;switch(n){case"Browser":t=_r(v());break;case"Worker":t=`${_r(v())}-${n}`;break;default:t=n}let i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${oe}/${i}`}async function Zo(n,e={}){return _(n,"GET","/v2/passwordPolicy",g(n,e))}function b(n){return p(n)}function tc(n){Xe=n}function li(n){return Xe.loadJS(n)}function nc(){return Xe.recaptchaV2Script}function ic(){return Xe.recaptchaEnterpriseScript}function rc(){return Xe.gapiScript}function ts(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function oc(n){let e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let i=0;i<n;i++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}async function Ue(n,e,t,i=!1,r=!1){let s=new ze(n),o;if(r)o=He;else try{o=await s.verify(t)}catch{o=await s.verify(t,!0)}let c={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,a=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:a,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return i?Object.assign(c,{captchaResp:o}):Object.assign(c,{captchaResponse:o}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ee(n,e,t,i,r){if(r==="EMAIL_PASSWORD_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Ue(n,e,t,t==="getOobCode");return i(n,s)}else return i(n,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Ue(n,e,t,t==="getOobCode");return i(n,o)}else return Promise.reject(s)});else if(r==="PHONE_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await Ue(n,e,t);return i(n,s).catch(async o=>{if(n._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(o.code==="auth/missing-recaptcha-token"||o.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${t} flow.`);let c=await Ue(n,e,t,!1,!0);return i(n,c)}return Promise.reject(o)})}else{let s=await Ue(n,e,t,!1,!0);return i(n,s)}else return Promise.reject(r+" provider is not supported.")}async function ns(n){let e=b(n),t=await $r(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),i=new mt(t);e.tenantId==null?e._agentRecaptchaConfig=i:e._tenantRecaptchaConfigs[e.tenantId]=i,i.isAnyProviderEnabled()&&new ze(e).verify()}function ui(n,e){let t=Le(n,"auth");if(t.isInitialized()){let r=t.getImmediate(),s=t.getOptions();if(Y(s,e??{}))return r;k(r,"already-initialized")}return t.initialize({options:e})}function lc(n,e){let t=e?.persistence||[],i=(Array.isArray(t)?t:[t]).map($);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e?.popupRedirectResolver)}function di(n,e,t){let i=b(n);u(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");let r=!!t?.disableWarnings,s=is(e),{host:o,port:c}=uc(e),l=c===null?"":`:${c}`,a={url:`${s}//${o}${l}/`},d=Object.freeze({host:o,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})});if(!i._canInitEmulator){u(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),u(Y(a,i.config.emulator)&&Y(d,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=a,i.emulatorConfig=d,i.settings.appVerificationDisabledForTesting=!0,tt(o)?$i(`${s}//${o}${l}`):r||dc()}function is(n){let e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function uc(n){let e=is(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};let i=t[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){let s=r[1];return{host:s,port:br(i.substr(s.length+1))}}else{let[s,o]=i.split(":");return{host:s,port:br(o)}}}function br(n){if(!n)return null;let e=Number(n);return isNaN(e)?null:e}function dc(){function n(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}async function rs(n,e){return _(n,"POST","/v1/accounts:resetPassword",g(n,e))}async function hc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function fc(n,e){return _(n,"POST","/v1/accounts:signUp",e)}async function pc(n,e){return _(n,"POST","/v1/accounts:update",g(n,e))}async function mc(n,e){return J(n,"POST","/v1/accounts:signInWithPassword",g(n,e))}async function Ht(n,e){return _(n,"POST","/v1/accounts:sendOobCode",g(n,e))}async function gc(n,e){return Ht(n,e)}async function _c(n,e){return Ht(n,e)}async function Ic(n,e){return Ht(n,e)}async function bc(n,e){return Ht(n,e)}async function Ec(n,e){return J(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function yc(n,e){return J(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function j(n,e){return J(n,"POST","/v1/accounts:signInWithIdp",g(n,e))}async function Er(n,e){return _(n,"POST","/v1/accounts:sendVerificationCode",g(n,e))}async function wc(n,e){return J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e))}async function vc(n,e){let t=await J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e));if(t.temporaryProof)throw Fe(n,"account-exists-with-different-credential",t);return t}async function Sc(n,e){let t={...e,operation:"REAUTH"};return J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,t),Ac)}function kc(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Rc(n){let e=me(ge(n)).link,t=e?me(ge(e)).deep_link_id:null,i=me(ge(n)).deep_link_id;return(i?me(ge(i)).link:null)||i||t||e||n}function ss(n){return ue.parseLink(n)}async function as(n,e){return J(n,"POST","/v1/accounts:signUp",g(n,e))}function yr(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}async function os(n){if(I(n.app))return Promise.reject(w(n));let e=b(n);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new D({user:e.currentUser,providerId:null,operationType:"signIn"});let t=await as(e,{returnSecureToken:!0}),i=await D._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(i.user),i}function cs(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?xn._fromErrorAndOperation(n,s,e,i):s})}function ls(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}async function us(n,e){let t=p(n);await Wt(!0,t,e);let{providerUserInfo:i}=await qo(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),r=ls(i||[]);return t.providerData=t.providerData.filter(s=>r.has(s.providerId)),r.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function hi(n,e,t=!1){let i=await q(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return D._forOperation(n,"link",i)}async function Wt(n,e,t){await je(e);let i=ls(e.providerData),r=n===!1?"provider-already-linked":"no-such-provider";u(i.has(t)===n,e.auth,r)}async function ds(n,e,t=!1){let{auth:i}=n;if(I(i.app))return Promise.reject(w(i));let r="reauthenticate";try{let s=await q(n,cs(i,r,e,n),t);u(s.idToken,i,"internal-error");let o=Vt(s.idToken);u(o,i,"internal-error");let{sub:c}=o;return u(n.uid===c,i,"user-mismatch"),D._forOperation(n,r,s)}catch(s){throw s?.code==="auth/user-not-found"&&k(i,"user-mismatch"),s}}async function hs(n,e,t=!1){if(I(n.app))return Promise.reject(w(n));let i="signIn",r=await cs(n,i,e),s=await D._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function Qe(n,e){return hs(b(n),e)}async function fi(n,e){let t=p(n);return await Wt(!1,t,e.providerId),hi(t,e)}async function pi(n,e){return ds(p(n),e)}async function Oc(n,e){return J(n,"POST","/v1/accounts:signInWithCustomToken",g(n,e))}async function fs(n,e){if(I(n.app))return Promise.reject(w(n));let t=b(n),i=await Oc(t,{token:e,returnSecureToken:!0}),r=await D._fromIdTokenResponse(t,"signIn",i);return await t._updateCurrentUser(r.user),r}function Bt(n,e,t){u(t.url?.length>0,n,"invalid-continue-uri"),u(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),u(typeof t.linkDomain>"u"||t.linkDomain.length>0,n,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(u(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(u(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}async function mi(n){let e=b(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ps(n,e,t){let i=b(n),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&Bt(i,r,t),await ee(i,r,"getOobCode",_c,"EMAIL_PASSWORD_PROVIDER")}async function ms(n,e,t){await rs(p(n),{oobCode:e,newPassword:t}).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&mi(n),i})}async function gs(n,e){await pc(p(n),{oobCode:e})}async function gi(n,e){let t=p(n),i=await rs(t,{oobCode:e}),r=i.requestType;switch(u(r,t,"internal-error"),r){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":u(i.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":u(i.mfaInfo,t,"internal-error");default:u(i.email,t,"internal-error")}let s=null;return i.mfaInfo&&(s=de._fromServerResponse(b(t),i.mfaInfo)),{data:{email:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.newEmail:i.email)||null,previousEmail:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.email:i.newEmail)||null,multiFactorInfo:s},operation:r}}async function _s(n,e){let{data:t}=await gi(p(n),e);return t.email}async function Is(n,e,t){if(I(n.app))return Promise.reject(w(n));let i=b(n),o=await ee(i,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",as,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&mi(n),l}),c=await D._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(c.user),c}function bs(n,e,t){return I(n.app)?Promise.reject(w(n)):Qe(p(n),K.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&mi(n),i})}async function Es(n,e,t){let i=b(n),r={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(o,c){u(c.handleCodeInApp,i,"argument-error"),c&&Bt(i,o,c)}s(r,t),await ee(i,r,"getOobCode",Ic,"EMAIL_PASSWORD_PROVIDER")}function ys(n,e){return ue.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function Ts(n,e,t){if(I(n.app))return Promise.reject(w(n));let i=p(n),r=K.credentialWithLink(e,t||Be());return u(r._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),Qe(i,r)}async function Nc(n,e){return _(n,"POST","/v1/accounts:createAuthUri",g(n,e))}async function ws(n,e){let t=ri()?Be():"http://localhost",i={identifier:e,continueUri:t},{signinMethods:r}=await Nc(p(n),i);return r||[]}async function vs(n,e){let t=p(n),r={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&Bt(t.auth,r,e);let{email:s}=await gc(t.auth,r);s!==n.email&&await n.reload()}async function As(n,e,t){let i=p(n),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await n.getIdToken(),newEmail:e};t&&Bt(i.auth,s,t);let{email:o}=await bc(i.auth,s);o!==n.email&&await n.reload()}async function Dc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function Ss(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;let i=p(n),s={idToken:await i.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},o=await q(i,Dc(i.auth,s));i.displayName=o.displayName||null,i.photoURL=o.photoUrl||null;let c=i.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=i.displayName,c.photoURL=i.photoURL),await i._updateTokensIfNecessary(o)}function ks(n,e){let t=p(n);return I(t.auth.app)?Promise.reject(w(t.auth)):Cs(t,e,null)}function Rs(n,e){return Cs(p(n),null,e)}async function Cs(n,e,t){let{auth:i}=n,s={idToken:await n.getIdToken(),returnSecureToken:!0};e&&(s.email=e),t&&(s.password=t);let o=await q(n,hc(i,s));await n._updateTokensIfNecessary(o,!0)}function Lc(n){if(!n)return null;let{providerId:e}=n,t=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},i=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&n?.idToken){let r=Vt(n.idToken)?.firebase?.sign_in_provider;if(r){let s=r!=="anonymous"&&r!=="custom"?r:null;return new te(i,s)}}if(!e)return null;switch(e){case"facebook.com":return new Wn(i,t);case"github.com":return new Bn(i,t);case"google.com":return new $n(i,t);case"twitter.com":return new jn(i,t,n.screenName||null);case"custom":case"anonymous":return new te(i,null);default:return new te(i,e,t)}}function Ps(n){let{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:Lc(t)}function Os(n,e){return p(n).setPersistence(e)}function Ns(n){return ns(n)}async function Ds(n,e){return b(n).validatePassword(e)}function _i(n,e,t,i){return p(n).onIdTokenChanged(e,t,i)}function Ii(n,e,t){return p(n).beforeAuthStateChanged(e,t)}function Ls(n,e,t,i){return p(n).onAuthStateChanged(e,t,i)}function Ms(n){p(n).useDeviceLanguage()}function Us(n,e){return p(n).updateCurrentUser(e)}function Fs(n){return p(n).signOut()}function xs(n,e){return b(n).revokeAccessToken(e)}async function Vs(n){return p(n).delete()}function Hs(n,e){let t=p(n),i=e;return u(e.customData.operationType,t,"argument-error"),u(i.customData._serverResponse?.mfaPendingCredential,t,"argument-error"),zn._fromError(t,i)}function Tr(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Mc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function Uc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Fc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function xc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:withdraw",g(n,e))}function Ws(n){let e=p(n);return wn.has(e)||wn.set(e,qn._fromUser(e)),wn.get(e)}function vn(n){let e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),t=RegExp(`${e}=([^;]+)`);return document.cookie.match(t)?.[1]??null}function An(n){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${n.split(":")[3]}`}function Bc(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}function jt(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}function E(){return window}function $c(n){E().location.href=n}function Ei(){return typeof E().WorkerGlobalScope<"u"&&typeof E().importScripts=="function"}async function jc(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function zc(){return navigator?.serviceWorker?.controller||null}function qc(){return Ei()?self:null}function zt(n,e){return n.transaction([Nt],e?"readwrite":"readonly").objectStore(Nt)}function Kc(){let n=indexedDB.deleteDatabase($s);return new he(n).toPromise()}function zs(){let n=indexedDB.open($s,Gc);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{let i=n.result;try{i.createObjectStore(Nt,{keyPath:js})}catch(r){t(r)}}),n.addEventListener("success",async()=>{let i=n.result;i.objectStoreNames.contains(Nt)?e(i):(i.close(),await Kc(),e(await zs()))})})}async function wr(n,e,t){let i=zt(n,!0).put({[js]:e,value:t});return new he(i).toPromise()}async function Jc(n,e){let t=zt(n,!1).get(e),i=await new he(t).toPromise();return i===void 0?null:i.value}function vr(n,e){let t=zt(n,!0).delete(e);return new he(t).toPromise()}function Ar(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:start",g(n,e))}function Qc(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function Zc(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function tl(n){return n.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(n)}function il(){let n=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}n=()=>e(),window.addEventListener("load",n)}).catch(e=>{throw n&&window.removeEventListener("load",n),e})}async function qs(n,e,t){if(I(n.app))return Promise.reject(w(n));let i=b(n),r=await qt(i,e,p(t));return new qe(r,s=>Qe(i,s))}async function Gs(n,e,t){let i=p(n);await Wt(!1,i,"phone");let r=await qt(i.auth,e,p(t));return new qe(r,s=>fi(i,s))}async function Ks(n,e,t){let i=p(n);if(I(i.auth.app))return Promise.reject(w(i.auth));let r=await qt(i.auth,e,p(t));return new qe(r,s=>pi(i,s))}async function qt(n,e,t){if(!n._getRecaptchaConfig())try{await ns(n)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let i;if(typeof e=="string"?i={phoneNumber:e}:i=e,"session"in i){let r=i.session;if("phoneNumber"in i){u(r.type==="enroll",n,"internal-error");let s={idToken:r.credential,phoneEnrollmentInfo:{phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ee(n,s,"mfaSmsEnrollment",async(a,d)=>{if(d.phoneEnrollmentInfo.captchaResponse===He){u(t?.type===We,a,"argument-error");let h=await kn(a,d,t);return Tr(a,h)}return Tr(a,d)},"PHONE_PROVIDER").catch(a=>Promise.reject(a))).phoneSessionInfo.sessionInfo}else{u(r.type==="signin",n,"internal-error");let s=i.multiFactorHint?.uid||i.multiFactorUid;u(s,n,"missing-multi-factor-info");let o={mfaPendingCredential:r.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ee(n,o,"mfaSmsSignIn",async(d,h)=>{if(h.phoneSignInInfo.captchaResponse===He){u(t?.type===We,d,"argument-error");let f=await kn(d,h,t);return Ar(d,f)}return Ar(d,h)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneResponseInfo.sessionInfo}}else{let r={phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ee(n,r,"sendVerificationCode",async(l,a)=>{if(a.captchaResponse===He){u(t?.type===We,l,"argument-error");let d=await kn(l,a,t);return Er(l,d)}return Er(l,a)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{t?._reset()}}async function Js(n,e){let t=p(n);if(I(t.auth.app))return Promise.reject(w(t.auth));await hi(t,e)}async function kn(n,e,t){u(t.type===We,n,"argument-error");let i=await t.verify();u(typeof i=="string",n,"argument-error");let r={...e};if("phoneEnrollmentInfo"in r){let s=r.phoneEnrollmentInfo.phoneNumber,o=r.phoneEnrollmentInfo.captchaResponse,c=r.phoneEnrollmentInfo.clientType,l=r.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(r,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:i,captchaResponse:o,clientType:c,recaptchaVersion:l}}),r}else if("phoneSignInInfo"in r){let s=r.phoneSignInInfo.captchaResponse,o=r.phoneSignInInfo.clientType,c=r.phoneSignInInfo.recaptchaVersion;return Object.assign(r,{phoneSignInInfo:{recaptchaToken:i,captchaResponse:s,clientType:o,recaptchaVersion:c}}),r}else return Object.assign(r,{recaptchaToken:i}),r}function fe(n,e){return e?$(e):(u(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}function rl(n){return hs(n.auth,new Ge(n),n.bypassAuthState)}function sl(n){let{auth:e,user:t}=n;return u(t,e,"internal-error"),ds(t,new Ge(n),n.bypassAuthState)}async function al(n){let{auth:e,user:t}=n;return u(t,e,"internal-error"),hi(t,new Ge(n),n.bypassAuthState)}async function Ys(n,e,t){if(I(n.app))return Promise.reject(S(n,"operation-not-supported-in-this-environment"));let i=b(n);Re(n,e,N);let r=fe(i,t);return new ke(i,"signInViaPopup",e,r).executeNotNull()}async function Xs(n,e,t){let i=p(n);if(I(i.auth.app))return Promise.reject(S(i.auth,"operation-not-supported-in-this-environment"));Re(i.auth,e,N);let r=fe(i.auth,t);return new ke(i.auth,"reauthViaPopup",e,r,i).executeNotNull()}async function Qs(n,e,t){let i=p(n);Re(i.auth,e,N);let r=fe(i.auth,t);return new ke(i.auth,"linkViaPopup",e,r,i).executeNotNull()}async function ll(n,e){let t=ea(e),i=Zs(n);if(!await i._isAvailable())return!1;let r=await i._get(t)==="true";return await i._remove(t),r}async function Ti(n,e){return Zs(n)._set(ea(e),"true")}function ul(n,e){dt.set(n._key(),e)}function Zs(n){return $(n._redirectPersistence)}function ea(n){return ut(cl,n.config.apiKey,n.name)}function ta(n,e,t){return dl(n,e,t)}async function dl(n,e,t){if(I(n.app))return Promise.reject(w(n));let i=b(n);Re(n,e,N),await i._initializationPromise;let r=fe(i,t);return await Ti(r,i),r._openRedirect(i,e,"signInViaRedirect")}function na(n,e,t){return hl(n,e,t)}async function hl(n,e,t){let i=p(n);if(Re(i.auth,e,N),I(i.auth.app))return Promise.reject(w(i.auth));await i.auth._initializationPromise;let r=fe(i.auth,t);await Ti(r,i.auth);let s=await aa(i);return r._openRedirect(i.auth,e,"reauthViaRedirect",s)}function ia(n,e,t){return fl(n,e,t)}async function fl(n,e,t){let i=p(n);Re(i.auth,e,N),await i.auth._initializationPromise;let r=fe(i.auth,t);await Wt(!1,i,e.providerId),await Ti(r,i.auth);let s=await aa(i);return r._openRedirect(i.auth,e,"linkViaRedirect",s)}async function ra(n,e){return await b(n)._initializationPromise,sa(n,e,!1)}async function sa(n,e,t=!1){if(I(n.app))return Promise.reject(w(n));let i=b(n),r=fe(i,e),o=await new Yn(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}async function aa(n){let e=jt(`${n.uid}:::`);return n._redirectEventId=e,await n.auth._setRedirectUser(n),await n.auth._persistUserIfCurrent(n),e}function Sr(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function oa({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function ml(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return oa(n);default:return!1}}async function gl(n,e={}){return _(n,"GET","/v1/projects",e)}async function bl(n){if(n.config.emulator)return;let{authorizedDomains:e}=await gl(n);for(let t of e)try{if(El(t))return}catch{}k(n,"unauthorized-domain")}function El(n){let e=Be(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){let o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!Il.test(t))return!1;if(_l.test(n))return i===n;let r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}function kr(){let n=E().___jsl;if(n?.H){for(let e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function Tl(n){return new Promise((e,t)=>{function i(){kr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{kr(),t(S(n,"network-request-failed"))},timeout:yl.get()})}if(E().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(E().gapi?.load)i();else{let r=ts("iframefcb");return E()[r]=()=>{gapi.load?i():t(S(n,"network-request-failed"))},li(`${rc()}?onload=${r}`).catch(s=>t(s))}}).catch(e=>{throw ht=null,e})}function wl(n){return ht=ht||Tl(n),ht}function Cl(n){let e=n.config;u(e.authDomain,n,"auth-domain-config-required");let t=e.emulator?si(e,Sl):`https://${n.config.authDomain}/${Al}`,i={apiKey:e.apiKey,appName:n.name,v:oe},r=Rl.get(n.config.apiHost);r&&(i.eid=r);let s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${re(i).slice(1)}`}async function Pl(n){let e=await wl(n),t=E().gapi;return u(t,n,"internal-error"),e.open({where:document.body,url:Cl(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:kl,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});let o=S(n,"network-request-failed"),c=E().setTimeout(()=>{s(o)},vl.get());function l(){E().clearTimeout(c),r(i)}i.ping(l).then(l,()=>{s(o)})}))}function Ul(n,e,t,i=Nl,r=Dl){let s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString(),c="",l={...Ol,width:i.toString(),height:r.toString(),top:s,left:o},a=v().toLowerCase();t&&(c=Kr(a)?Ll:t),qr(a)&&(e=e||Ml,l.scrollbars="yes");let d=Object.entries(l).reduce((f,[A,L])=>`${f}${A}=${L},`,"");if(Xo(a)&&c!=="_self")return Fl(e||"",c),new Ut(null);let h=window.open(e||"",c,d);u(h,n,"popup-blocked");try{h.focus()}catch{}return new Ut(h)}function Fl(n,e){let t=document.createElement("a");t.href=n,t.target=e;let i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}async function Rr(n,e,t,i,r,s){u(n.config.authDomain,n,"auth-domain-config-required"),u(n.config.apiKey,n,"invalid-api-key");let o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:oe,eventId:r};if(e instanceof N){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Wi(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof ne){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);let c=o;for(let d of Object.keys(c))c[d]===void 0&&delete c[d];let l=await n._getAppCheckToken(),a=l?`#${Hl}=${encodeURIComponent(l)}`:"";return`${Wl(n)}?${re(c).slice(1)}${a}`}function Wl({config:n}){return n.emulator?si(n,Vl):`https://${n.authDomain}/${xl}`}function ct(n){return typeof n>"u"||n?.length===0}function Bl(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function $l(n){ae(new U("auth",(e,{options:t})=>{let i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=i.options;u(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});let l={apiKey:o,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:es(n)},a=new Dn(i,r,s,l);return lc(a,t),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),ae(new U("auth-internal",e=>{let t=b(e.getProvider("auth").getImmediate());return(i=>new ei(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),x(Cr,Pr,Bl(n)),x(Cr,Pr,"esm2020")}function ca(n=yn()){let e=Le(n,"auth");if(e.isInitialized())return e.getImmediate();let t=ui(n,{popupRedirectResolver:wi,persistence:[yi,bi,$t]}),i=nn("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(i,location.origin);if(location.origin===s.origin){let o=ql(s.toString());Ii(t,o,()=>o(t.currentUser)),_i(t,c=>o(c))}}let r=Ni("auth");return r&&di(t,`http://${r}`),t}function Gl(){return document.getElementsByTagName("head")?.[0]??document}var Nr,Dr,Lr,Mr,Ur,xr,ti,Vr,Hr,ft,ce,pt,Ho,Wo,Bo,Cn,mt,Pn,$e,Ve,Z,gr,_t,It,bt,On,ec,Nn,Dn,Et,Xe,sc,ac,ot,Ln,Mn,Un,Fn,cc,He,Ir,ze,G,ye,Tc,H,Ac,le,ue,K,N,ne,yt,Te,we,ve,Cc,Tt,Pc,wt,Ae,D,xn,de,Vn,Hn,te,vt,Wn,Bn,$n,jn,At,zn,qn,wn,St,kt,Vc,Hc,Rt,bi,Wc,Ct,Bs,Pt,$t,Ot,Gn,$s,Gc,Nt,js,he,Yc,Xc,Dt,yi,Sn,el,Kn,Jn,We,nl,Lt,qe,Se,Ge,Mt,ol,ke,cl,dt,Yn,pl,Xn,_l,Il,yl,ht,vl,Al,Sl,kl,Rl,Ol,Nl,Dl,Ll,Ml,Ut,xl,Vl,Hl,Rn,Qn,wi,Ft,Zn,Ke,Je,xt,Ye,Cr,Pr,ei,jl,zl,Or,ql,la=O(()=>{Me();_e();it();nt();Nr={PHONE:"phone",TOTP:"totp"},Dr={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Lr={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Mr={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Ur={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"};xr=Uo,ti=Fr,Vr=new W("auth","Firebase",Fr()),Hr={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"};ft=new Ie("@firebase/auth");ce=class{constructor(e,t){this.shortDelay=e,this.longDelay=t,z(t>e,"Short delay should be less than long delay!"),this.isMobile=Di()||Fi()}get(){return xo()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};pt=class{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}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;V("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;V("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;V("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};Ho={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"};Wo=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Bo=new ce(3e4,6e4);Cn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(S(this.auth,"network-request-failed")),Bo.get())})}};mt=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 t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return $o(t.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")}};Pn=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 t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};$e=class{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=xe(this.lastLoginAt),this.creationTime=xe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};Ve=class n{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 t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):mr(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){u(e.length!==0,"internal-error");let t=mr(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&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,t){let{accessToken:i,refreshToken:r,expiresIn:s}=await Jo(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){let{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new n;return i&&(u(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(u(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(u(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new n,this.toJSON())}_performRefresh(){return V("not implemented")}};Z=class n{constructor({uid:e,auth:t,stsTokenManager:i,...r}){this.providerId="firebase",this.proactiveRefresh=new Pn(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new $e(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){let t=await q(this,this.stsTokenManager.getToken(this.auth,e));return u(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return ai(this,e)}reload(){return oi(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(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new n({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_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,t=!1){let i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await je(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(I(this.auth.app))return Promise.reject(w(this.auth));let e=await this.getIdToken();return await q(this,zo(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,t){let i=t.displayName??void 0,r=t.email??void 0,s=t.phoneNumber??void 0,o=t.photoURL??void 0,c=t.tenantId??void 0,l=t._redirectEventId??void 0,a=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:h,emailVerified:f,isAnonymous:A,providerData:L,stsTokenManager:ie}=t;u(h&&ie,e,"internal-error");let M=Ve.fromJSON(this.name,ie);u(typeof h=="string",e,"internal-error"),Q(i,e.name),Q(r,e.name),u(typeof f=="boolean",e,"internal-error"),u(typeof A=="boolean",e,"internal-error"),Q(s,e.name),Q(o,e.name),Q(c,e.name),Q(l,e.name),Q(a,e.name),Q(d,e.name);let Yt=new n({uid:h,auth:e,email:r,emailVerified:f,displayName:i,isAnonymous:A,photoURL:o,phoneNumber:s,tenantId:c,stsTokenManager:M,createdAt:a,lastLoginAt:d});return L&&Array.isArray(L)&&(Yt.providerData=L.map(ga=>({...ga}))),l&&(Yt._redirectEventId=l),Yt}static async _fromIdTokenResponse(e,t,i=!1){let r=new Ve;r.updateFromServerResponse(t);let s=new n({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await je(s),s}static async _fromGetAccountInfoResponse(e,t,i){let r=t.users[0];u(r.localId!==void 0,"internal-error");let s=r.providerUserInfo!==void 0?zr(r.providerUserInfo):[],o=!(r.email&&r.passwordHash)&&!s?.length,c=new Ve;c.updateFromIdToken(i);let l=new n({uid:r.localId,auth:e,stsTokenManager:c,isAnonymous:o}),a={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new $e(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!s?.length};return Object.assign(l,a),l}};gr=new Map;_t=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};_t.type="NONE";It=_t;bt=class n{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;let{config:r,name:s}=this.auth;this.fullUserKey=ut(this.userKey,r.apiKey,s),this.fullPersistenceKey=ut("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let t=await gt(this.auth,{idToken:e}).catch(()=>{});return t?Z._fromGetAccountInfoResponse(this.auth,t,e):null}return Z._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 t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,i="authUser"){if(!t.length)return new n($(It),e,i);let r=(await Promise.all(t.map(async a=>{if(await a._isAvailable())return a}))).filter(a=>a),s=r[0]||$(It),o=ut(i,e.config.apiKey,e.name),c=null;for(let a of t)try{let d=await a._get(o);if(d){let h;if(typeof d=="string"){let f=await gt(e,{idToken:d}).catch(()=>{});if(!f)break;h=await Z._fromGetAccountInfoResponse(e,f,d)}else h=Z._fromJSON(e,d);a!==s&&(c=h),s=a;break}}catch{}let l=r.filter(a=>a._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new n(s,e,i):(s=l[0],c&&await s._set(o,c.toJSON()),await Promise.all(t.map(async a=>{if(a!==s)try{await a._remove(o)}catch{}})),new n(s,e,i))}};On=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let i=s=>new Promise((o,c)=>{try{let l=e(s);o(l)}catch(l){c(l)}});i.onAbort=t,this.queue.push(i);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(let r of t)try{r()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i?.message})}}};ec=6,Nn=class{constructor(e){let t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ec,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.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 t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let i=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let r=0;r<e.length;r++)i=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};Dn=class{constructor(e,t,i,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Et(this),this.idTokenSubscription=new Et(this),this.beforeStateQueue=new On(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=Vr,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=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=$(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await bt.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),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 t=await gt(this,{idToken:e}),i=await Z._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(I(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,o=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===o)&&c?.user&&(i=c.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(s){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return u(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await je(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Vo()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(I(this.app))return Promise.reject(w(this));let t=e?p(e):null;return t&&u(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&u(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return I(this.app)?Promise.reject(w(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return I(this.app)?Promise.reject(w(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence($(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await Zo(this),t=new Nn(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new W("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await Yo(this,i)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&$(e)||this._popupRedirectResolver;u(t,this,"argument-error"),this.redirectPersistenceManager=await bt.create(this,[$(t._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,t,i,r){if(this._deleted)return()=>{};let s=typeof t=="function"?t:t.next.bind(t),o=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(u(c,this,"internal-error"),c.then(()=>{o||s(this.currentUser)}),typeof t=="function"){let l=e.addObserver(t,i,r);return()=>{o=!0,l()}}else{let l=e.addObserver(t);return()=>{o=!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=es(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 t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){if(I(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&Fo(`Error while retrieving App Check token: ${e.error}`),e?.token}};Et=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Bi(t=>this.observer=t)}get next(){return u(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};Xe={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};sc=500,ac=6e4,ot=1e12,Ln=class{constructor(e){this.auth=e,this.counter=ot,this._widgets=new Map}render(e,t){let i=this.counter;return this._widgets.set(i,new Fn(e,this.auth.name,t||{})),this.counter++,i}reset(e){let t=e||ot;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){let t=e||ot;return this._widgets.get(t)?.getResponse()||""}async execute(e){let t=e||ot;return this._widgets.get(t)?.execute(),""}},Mn=class{constructor(){this.enterprise=new Un}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Un=class{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Fn=class{constructor(e,t,i){this.params=i,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let r=typeof e=="string"?document.getElementById(e):e;u(r,"argument-error",{appName:t}),this.container=r,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=oc(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},ac)},sc))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};cc="recaptcha-enterprise",He="NO_RECAPTCHA",Ir="onFirebaseAuthREInstanceReady",ze=class n{constructor(e){this.type=cc,this.auth=b(e)}async verify(e="verify",t=!1){async function i(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,c)=>{$r(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 a=new mt(l);return s.tenantId==null?s._agentRecaptchaConfig=a:s._tenantRecaptchaConfigs[s.tenantId]=a,o(a.siteKey)}}).catch(l=>{c(l)})})}function r(s,o,c){let l=window.grecaptcha;pr(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(a=>{o(a)}).catch(()=>{o(He)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new Mn().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{i(this.auth).then(async c=>{if(!t&&pr(window.grecaptcha)&&n.scriptInjectionDeferred)await n.scriptInjectionDeferred.promise,r(c,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ic();l.length!==0&&(l+=c+`&onload=${Ir}`),n.scriptInjectionDeferred=new pe,window[Ir]=()=>{n.scriptInjectionDeferred?.resolve()},li(l).then(()=>n.scriptInjectionDeferred?.promise).then(()=>{r(c,s,o)}).catch(a=>{o(a)})}}).catch(c=>{o(c)})})}};ze.scriptInjectionDeferred=null;G=class{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return V("not implemented")}_getIdTokenResponse(e){return V("not implemented")}_linkToIdToken(e,t){return V("not implemented")}_getReauthenticationResolver(e){return V("not implemented")}};ye=class n extends G{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new n(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new n(e,t,"emailLink",i)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ee(e,t,"signInWithPassword",mc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Ec(e,{email:this._email,oobCode:this._password});default:k(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":let i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ee(e,i,"signUpPassword",fc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return yc(e,{idToken:t,email:this._email,oobCode:this._password});default:k(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};Tc="http://localhost",H=class n extends G{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new n(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):k("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,...s}=t;if(!i||!r)return null;let o=new n(i,r);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){let i=this.buildRequest();return i.idToken=t,j(e,i)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,j(e,t)}buildRequest(){let e={requestUri:Tc,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=re(t)}return e}};Ac={USER_NOT_FOUND:"user-not-found"};le=class n extends G{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new n({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new n({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return wc(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return vc(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Sc(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:i,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:i,code:r}}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:t,verificationCode:i,phoneNumber:r,temporaryProof:s}=e;return!i&&!t&&!r&&!s?null:new n({verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s})}};ue=class n{constructor(e){let t=me(ge(e)),i=t.apiKey??null,r=t.oobCode??null,s=kc(t.mode??null);u(i&&r&&s,"argument-error"),this.apiKey=i,this.operation=s,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t=Rc(e);try{return new n(t)}catch{return null}}};K=class n{constructor(){this.providerId=n.PROVIDER_ID}static credential(e,t){return ye._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let i=ue.parseLink(t);return u(i,"argument-error"),ye._fromEmailAndCode(e,i.code,i.tenantId)}};K.PROVIDER_ID="password";K.EMAIL_PASSWORD_SIGN_IN_METHOD="password";K.EMAIL_LINK_SIGN_IN_METHOD="emailLink";N=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}};ne=class extends N{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},yt=class n extends ne{static credentialFromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;return u("providerId"in t&&"signInMethod"in t,"argument-error"),H._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return u(e.idToken||e.accessToken,"argument-error"),H._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return n.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return n.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:s,nonce:o,providerId:c}=e;if(!i&&!r&&!t&&!s||!c)return null;try{return new n(c)._credential({idToken:t,accessToken:i,nonce:o,pendingToken:s})}catch{return null}}};Te=class n extends ne{constructor(){super("facebook.com")}static credential(e){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};Te.FACEBOOK_SIGN_IN_METHOD="facebook.com";Te.PROVIDER_ID="facebook.com";we=class n extends ne{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return n.credential(t,i)}catch{return null}}};we.GOOGLE_SIGN_IN_METHOD="google.com";we.PROVIDER_ID="google.com";ve=class n extends ne{constructor(){super("github.com")}static credential(e){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};ve.GITHUB_SIGN_IN_METHOD="github.com";ve.PROVIDER_ID="github.com";Cc="http://localhost",Tt=class n extends G{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){let t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){let i=this.buildRequest();return i.idToken=t,j(e,i)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,j(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,pendingToken:s}=t;return!i||!r||!s||i!==r?null:new n(i,s)}static _create(e,t){return new n(e,t)}buildRequest(){return{requestUri:Cc,returnSecureToken:!0,pendingToken:this.pendingToken}}};Pc="saml.",wt=class n extends N{constructor(e){u(e.startsWith(Pc),"argument-error"),super(e)}static credentialFromResult(e){return n.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return n.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let t=Tt.fromJSON(e);return u(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:t,providerId:i}=e;if(!t||!i)return null;try{return Tt._create(i,t)}catch{return null}}};Ae=class n extends ne{constructor(){super("twitter.com")}static credential(e,t){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return n.credential(t,i)}catch{return null}}};Ae.TWITTER_SIGN_IN_METHOD="twitter.com";Ae.PROVIDER_ID="twitter.com";D=class n{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){let s=await Z._fromIdTokenResponse(e,i,r),o=yr(i);return new n({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);let r=yr(i);return new n({user:e,providerId:r,_tokenResponse:i,operationType:t})}};xn=class n extends C{constructor(e,t,i,r){super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,n.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new n(e,t,i,r)}};de=class{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?Vn._fromServerResponse(e,t):"totpInfo"in t?Hn._fromServerResponse(e,t):k(e,"internal-error")}},Vn=class n extends de{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new n(t)}},Hn=class n extends de{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new n(t)}};te=class{constructor(e,t,i={}){this.isNewUser=e,this.providerId=t,this.profile=i}},vt=class extends te{constructor(e,t,i,r){super(e,t,i),this.username=r}},Wn=class extends te{constructor(e,t){super(e,"facebook.com",t)}},Bn=class extends vt{constructor(e,t){super(e,"github.com",t,typeof t?.login=="string"?t?.login:null)}},$n=class extends te{constructor(e,t){super(e,"google.com",t)}},jn=class extends vt{constructor(e,t,i){super(e,"twitter.com",t,i)}};At=class n{constructor(e,t,i){this.type=e,this.credential=t,this.user=i}static _fromIdtoken(e,t){return new n("enroll",e,t)}static _fromMfaPendingCredential(e){return new n("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return n._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return n._fromIdtoken(e.multiFactorSession.idToken)}return null}};zn=class n{constructor(e,t,i){this.session=e,this.hints=t,this.signInResolver=i}static _fromError(e,t){let i=b(e),r=t.customData._serverResponse,s=(r.mfaInfo||[]).map(c=>de._fromServerResponse(i,c));u(r.mfaPendingCredential,i,"internal-error");let o=At._fromMfaPendingCredential(r.mfaPendingCredential);return new n(o,s,async c=>{let l=await c._process(i,o);delete r.mfaInfo,delete r.mfaPendingCredential;let a={...r,idToken:l.idToken,refreshToken:l.refreshToken};switch(t.operationType){case"signIn":let d=await D._fromIdTokenResponse(i,t.operationType,a);return await i._updateCurrentUser(d.user),d;case"reauthenticate":return u(t.user,i,"internal-error"),D._forOperation(t.user,t.operationType,a);default:k(i,"internal-error")}})}async resolveSignIn(e){let t=e;return this.signInResolver(t)}};qn=class n{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(i=>de._fromServerResponse(e.auth,i)))})}static _fromUser(e){return new n(e)}async getSession(){return At._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){let i=e,r=await this.getSession(),s=await q(this.user,i._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let t=typeof e=="string"?e:e.uid,i=await this.user.getIdToken();try{let r=await q(this.user,xc(this.user.auth,{idToken:i,mfaEnrollmentId:t}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==t),await this.user._updateTokensIfNecessary(r),await this.user.reload()}catch(r){throw r}}},wn=new WeakMap;St="__sak";kt=class{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(St,"1"),this.storage.removeItem(St),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};Vc=1e3,Hc=10,Rt=class extends kt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Zr(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,l)=>{this.notifyListeners(o,l)});return}let i=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);Qo()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,Hc):r()}notifyListeners(e,t){this.localCache[e]=t;let i=this.listeners[e];if(i)for(let r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Vc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}};Rt.type="LOCAL";bi=Rt;Wc=1e3;Ct=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=An(e);return window.cookieStore?(await window.cookieStore.get(t))?.value:vn(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let i=An(e);document.cookie=`${i}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,t){if(!this._isAvailable())return;let i=An(e);if(window.cookieStore){let c=(a=>{let d=a.changed.find(f=>f.name===i);d&&t(d.value),a.deleted.find(f=>f.name===i)&&t(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(t,l),window.cookieStore.addEventListener("change",c)}let r=vn(i),s=setInterval(()=>{let c=vn(i);c!==r&&(t(c),r=c)},Wc),o=()=>clearInterval(s);this.listenerUnsubscribes.set(t,o)}_removeListener(e,t){let i=this.listenerUnsubscribes.get(t);i&&(i(),this.listenerUnsubscribes.delete(t))}};Ct.type="COOKIE";Bs=Ct;Pt=class extends kt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}};Pt.type="SESSION";$t=Pt;Ot=class n{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;let i=new n(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});let c=Array.from(o).map(async a=>a(t.origin,s)),l=await Bc(c);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Ot.receivers=[];Gn=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,t,i=50){let r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((c,l)=>{let a=jt("",20);r.port1.start();let d=setTimeout(()=>{l(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(h){let f=h;if(f.data.eventId===a)switch(f.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(f.data.response);break;default:clearTimeout(d),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:a,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};$s="firebaseLocalStorageDb",Gc=1,Nt="firebaseLocalStorage",js="fbase_key",he=class{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}};Yc=800,Xc=3,Dt=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=zs(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{let i=await this._openDb();return await e(i)}catch(i){if(t++>Xc)throw i;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return Ei()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ot._getInstance(qc()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await jc(),!this.activeServiceWorker)return;this.sender=new Gn(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||zc()!==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 wr(e,St,"1"),await vr(e,St)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(i=>wr(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(i=>Jc(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>vr(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(r=>{let s=zt(r,!1).getAll();return new he(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let t=[],i=new Set;if(e.length!==0)for(let{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(let r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;let i=this.listeners[e];if(i)for(let r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Yc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};Dt.type="LOCAL";yi=Dt;Sn=ts("rcb"),el=new ce(3e4,6e4),Kn=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!E().grecaptcha?.render}load(e,t=""){return u(tl(t),e,"argument-error"),this.shouldResolveImmediately(t)&&fr(E().grecaptcha)?Promise.resolve(E().grecaptcha):new Promise((i,r)=>{let s=E().setTimeout(()=>{r(S(e,"network-request-failed"))},el.get());E()[Sn]=()=>{E().clearTimeout(s),delete E()[Sn];let c=E().grecaptcha;if(!c||!fr(c)){r(S(e,"internal-error"));return}let l=c.render;c.render=(a,d)=>{let h=l(a,d);return this.counter++,h},this.hostLanguage=t,i(c)};let o=`${nc()}?${re({onload:Sn,render:"explicit",hl:t})}`;li(o).catch(()=>{clearTimeout(s),r(S(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!E().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Jn=class{async load(e){return new Ln(e)}clearedOneInstance(){}};We="recaptcha",nl={theme:"light",type:"image"},Lt=class{constructor(e,t,i={...nl}){this.parameters=i,this.type=We,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=b(e),this.isInvisible=this.parameters.size==="invisible",u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let r=typeof t=="string"?document.getElementById(t):t;u(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Jn:new Kn,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha(),i=t.getResponse(e);return i||new Promise(r=>{let s=o=>{o&&(this.tokenChangeListeners.delete(s),r(o))};this.tokenChangeListeners.add(s),this.isInvisible&&t.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 t=>{if(this.tokenChangeListeners.forEach(i=>i(t)),typeof e=="function")e(t);else if(typeof e=="string"){let i=E()[e];typeof i=="function"&&i(t)}}}assertNotDestroyed(){u(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){u(ri()&&!Ei(),this.auth,"internal-error"),await il(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await jo(this.auth);u(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return u(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};qe=class{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=le._fromVerification(this.verificationId,e);return this.onConfirmation(t)}};Se=class n{constructor(e){this.providerId=n.PROVIDER_ID,this.auth=b(e)}verifyPhoneNumber(e,t){return qt(this.auth,e,p(t))}static credential(e,t){return le._fromVerification(e,t)}static credentialFromResult(e){let t=e;return n.credentialFromTaggedObject(t)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:i}=e;return t&&i?le._fromTokenResponse(t,i):null}};Se.PROVIDER_ID="phone";Se.PHONE_SIGN_IN_METHOD="phone";Ge=class extends G{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return j(e,this._buildIdpRequest())}_linkToIdToken(e,t){return j(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return j(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}};Mt=class{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:c}=e;if(o){this.reject(o);return}let l={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(a){this.reject(a)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return rl;case"linkViaPopup":case"linkViaRedirect":return al;case"reauthViaPopup":case"reauthViaRedirect":return sl;default:k(this.auth,"internal-error")}}resolve(e){z(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){z(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()}};ol=new ce(2e3,1e4);ke=class n extends Mt{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,n.currentPopupAction&&n.currentPopupAction.cancel(),n.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return u(e,this.auth,"internal-error"),e}async onExecution(){z(this.filter.length===1,"Popup operations only handle one event");let e=jt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(S(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(S(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,n.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(S(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ol.get())};e()}};ke.currentPopupAction=null;cl="pendingRedirect",dt=new Map,Yn=class extends Mt{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=dt.get(this.auth._key());if(!e){try{let i=await ll(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}dt.set(this.auth._key(),e)}return this.bypassAuthState||dt.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 t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};pl=600*1e3,Xn=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 t=!1;return this.consumers.forEach(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ml(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!oa(e)){let i=e.error.code?.split("auth/")[1]||"internal-error";t.onError(S(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=pl&&this.cachedEventUids.clear(),this.cachedEventUids.has(Sr(e))}saveEventToCache(e){this.cachedEventUids.add(Sr(e)),this.lastProcessedEventTime=Date.now()}};_l=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Il=/^https?/;yl=new ce(3e4,6e4);ht=null;vl=new ce(5e3,15e3),Al="__/auth/iframe",Sl="emulator/auth/iframe",kl={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Rl=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);Ol={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Nl=500,Dl=600,Ll="_blank",Ml="http://localhost",Ut=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};xl="__/auth/handler",Vl="emulator/auth/handler",Hl=encodeURIComponent("fac");Rn="webStorageSupport",Qn=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=$t,this._completeRedirectFn=sa,this._overrideRedirectResult=ul}async _openPopup(e,t,i,r){z(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await Rr(e,t,i,Be(),r);return Ul(e,s,jt())}async _openRedirect(e,t,i,r){await this._originValidation(e);let s=await Rr(e,t,i,Be(),r);return $c(s),new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(z(s,"If manager is not set, promise should be"),s)}let i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){let t=await Pl(e),i=new Xn(e);return t.register("authEvent",r=>(u(r?.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Rn,{type:Rn},r=>{let s=r?.[0]?.[Rn];s!==void 0&&t(!!s),k(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=bl(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Zr()||Gr()||ci()}},wi=Qn,Ft=class{constructor(e){this.factorId=e}_process(e,t,i){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,i);case"signin":return this._finalizeSignIn(e,t.credential);default:return V("unexpected MultiFactorSessionType")}}},Zn=class n extends Ft{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new n(e)}_finalizeEnroll(e,t,i){return Mc(e,{idToken:t,displayName:i,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return Qc(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ke=class{constructor(){}static assertion(e){return Zn._fromCredential(e)}};Ke.FACTOR_ID="phone";Je=class{static assertionForEnrollment(e,t){return xt._fromSecret(e,t)}static assertionForSignIn(e,t){return xt._fromEnrollmentId(e,t)}static async generateSecret(e){let t=e;u(typeof t.user?.auth<"u","internal-error");let i=await Uc(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ye._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Je.FACTOR_ID="totp";xt=class n extends Ft{constructor(e,t,i){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=i}static _fromSecret(e,t){return new n(t,void 0,e)}static _fromEnrollmentId(e,t){return new n(t,e)}async _finalizeEnroll(e,t,i){return u(typeof this.secret<"u",e,"argument-error"),Fc(e,{idToken:t,displayName:i,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){u(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let i={verificationCode:this.otp};return Zc(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:i})}},Ye=class n{constructor(e,t,i,r,s,o,c){this.sessionInfo=o,this.auth=c,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=i,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new n(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let i=!1;return(ct(e)||ct(t))&&(i=!0),i&&(ct(e)&&(e=this.auth.currentUser?.email||"unknownuser"),ct(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};Cr="@firebase/auth",Pr="1.13.3";ei=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 t=this.auth.onIdTokenChanged(i=>{e(i?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){u(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};jl=300,zl=nn("authIdTokenMaxAge")||jl,Or=null,ql=n=>async e=>{let t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>zl)return;let r=t?.token;Or!==r&&(Or=r,await fetch(n,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))};tc({loadJS(n){return new Promise((e,t)=>{let i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{let s=S("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",Gl().appendChild(i)})},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="});$l("Browser")});var ua=O(()=>{la();Me();_e();it();nt()});var Gt={};Si(Gt,{ActionCodeOperation:()=>Ur,ActionCodeURL:()=>ue,AuthCredential:()=>G,AuthErrorCodes:()=>Hr,EmailAuthCredential:()=>ye,EmailAuthProvider:()=>K,FacebookAuthProvider:()=>Te,FactorId:()=>Nr,GithubAuthProvider:()=>ve,GoogleAuthProvider:()=>we,OAuthCredential:()=>H,OAuthProvider:()=>yt,OperationType:()=>Mr,PhoneAuthCredential:()=>le,PhoneAuthProvider:()=>Se,PhoneMultiFactorGenerator:()=>Ke,ProviderId:()=>Dr,RecaptchaVerifier:()=>Lt,SAMLAuthProvider:()=>wt,SignInMethod:()=>Lr,TotpMultiFactorGenerator:()=>Je,TotpSecret:()=>Ye,TwitterAuthProvider:()=>Ae,applyActionCode:()=>gs,beforeAuthStateChanged:()=>Ii,browserCookiePersistence:()=>Bs,browserLocalPersistence:()=>bi,browserPopupRedirectResolver:()=>wi,browserSessionPersistence:()=>$t,checkActionCode:()=>gi,confirmPasswordReset:()=>ms,connectAuthEmulator:()=>di,createUserWithEmailAndPassword:()=>Is,debugErrorMap:()=>xr,deleteUser:()=>Vs,fetchSignInMethodsForEmail:()=>ws,getAdditionalUserInfo:()=>Ps,getAuth:()=>ca,getIdToken:()=>jr,getIdTokenResult:()=>ai,getMultiFactorResolver:()=>Hs,getRedirectResult:()=>ra,inMemoryPersistence:()=>It,indexedDBLocalPersistence:()=>yi,initializeAuth:()=>ui,initializeRecaptchaConfig:()=>Ns,isSignInWithEmailLink:()=>ys,linkWithCredential:()=>fi,linkWithPhoneNumber:()=>Gs,linkWithPopup:()=>Qs,linkWithRedirect:()=>ia,multiFactor:()=>Ws,onAuthStateChanged:()=>Ls,onIdTokenChanged:()=>_i,parseActionCodeURL:()=>ss,prodErrorMap:()=>ti,reauthenticateWithCredential:()=>pi,reauthenticateWithPhoneNumber:()=>Ks,reauthenticateWithPopup:()=>Xs,reauthenticateWithRedirect:()=>na,reload:()=>oi,revokeAccessToken:()=>xs,sendEmailVerification:()=>vs,sendPasswordResetEmail:()=>ps,sendSignInLinkToEmail:()=>Es,setPersistence:()=>Os,signInAnonymously:()=>os,signInWithCredential:()=>Qe,signInWithCustomToken:()=>fs,signInWithEmailAndPassword:()=>bs,signInWithEmailLink:()=>Ts,signInWithPhoneNumber:()=>qs,signInWithPopup:()=>Ys,signInWithRedirect:()=>ta,signOut:()=>Fs,unlink:()=>us,updateCurrentUser:()=>Us,updateEmail:()=>ks,updatePassword:()=>Rs,updatePhoneNumber:()=>Js,updateProfile:()=>Ss,useDeviceLanguage:()=>Ms,validatePassword:()=>Ds,verifyBeforeUpdateEmail:()=>As,verifyPasswordResetCode:()=>_s});var Kt=O(()=>{ua()});var Kl={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},vi=null,Jt=null;async function Ze(){return typeof window>"u"?null:(vi||(vi=(async()=>{let{initializeApp:n,getApps:e}=await Promise.resolve().then(()=>(dr(),ur)),{getAuth:t,signInAnonymously:i,onAuthStateChanged:r}=await Promise.resolve().then(()=>(Kt(),Gt)),s=e().length?e()[0]:n(Kl);if(Jt=t(s),!await new Promise(c=>{let l=r(Jt,a=>{l(),c(a)})}))try{await i(Jt)}catch(c){console.warn("[Fleetbo Auth] Anonymous session created in offline mode or delayed:",c.message)}return Jt})()),vi)}async function da(){try{let n=await Ze();return!n||!n.currentUser?null:await n.currentUser.getIdToken()}catch(n){return console.error("[Fleetbo Auth Debug]",n),null}}async function Ai(n){let e=await Ze(),{signInWithCustomToken:t}=await Promise.resolve().then(()=>(Kt(),Gt)),i=await t(e,n);return{uid:i.user.uid,email:i.user.email,isAnonymous:i.user.isAnonymous}}async function ha(){let n=await Ze(),{signOut:e,signInAnonymously:t}=await Promise.resolve().then(()=>(Kt(),Gt));return await e(n),await t(n),!0}async function fa(){let n=await Ze();return!n||!n.currentUser?null:{uid:n.currentUser.uid,email:n.currentUser.email,isAnonymous:n.currentUser.isAnonymous}}async function pa(n=!1){try{let e=await Ze();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(n)).claims.elog===!0}catch(e){return console.error("[Fleetbo Auth Debug]",e),!1}}var Jl="https://fleetbo-gatekeeper.fleetbo.workers.dev/",y=async(n,e=null)=>{try{let t=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_DB_KEY:typeof process<"u"?process.env?.VITE_FLEETBO_DB_KEY:void 0,i=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_ENTERPRISE_ID:typeof process<"u"?process.env?.VITE_FLEETBO_ENTERPRISE_ID:void 0,r=typeof process<"u"&&(process.env?.FLEETBO_PROTOTYPE==="true"||process.env?.VITE_FLEETBO_PROTOTYPE==="true")||typeof import.meta<"u"&&(import.meta.env?.VITE_FLEETBO_PROTOTYPE==="true"||import.meta.env?.FLEETBO_PROTOTYPE==="true"),s=n.replace("https://","").split("-")[0]||"add",o={"Content-Type":"application/json"};r&&(o["x-fleetbo-prototype"]="true");let c=await da();c&&(o.Authorization=`Bearer ${c}`);let l={targetFunction:s,enterpriseID:i,fleetboDB:t,fleetboTable:e?.fleetboTable||null,jsonData:e?.jsonData||e,_prototype:r,data:{fleetboDB:t,enterpriseID:i,...e}},a=await fetch(Jl,{method:"POST",headers:o,body:JSON.stringify(l)}),d=await a.json(),h=d.result||d;return{success:a.ok,...h}}catch(t){return{success:!1,error:t.message}}};if(typeof window<"u"&&typeof customElements<"u"){class n extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get fallback(){return this.getAttribute("fallback")}set fallback(a){a==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(a))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("fallback")||"\u2014",h=a!=null&&a.trim()!==""&&a!=="null"&&a!=="undefined";this.textContent=h?a:d}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(a){a==null||a===""?this.removeAttribute("value"):this.setAttribute("value",String(a))}get currency(){return this.getAttribute("currency")}set currency(a){a==null?this.removeAttribute("currency"):this.setAttribute("currency",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"0";if(a==null||a===""||a==="null"||a==="undefined"){this.textContent=d;return}let h=Number(a);if(Number.isNaN(h)){this.textContent=d;return}let f=this.getAttribute("currency");if(f)try{this.textContent=new Intl.NumberFormat("fr-FR",{style:"currency",currency:f}).format(h)}catch{this.textContent=`${h} ${f}`}else this.textContent=String(h)}}class t extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(a){a==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(a))}get"label-true"(){return this.labelTrue}set"label-true"(a){this.labelTrue=a}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(a){a==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(a))}get"label-false"(){return this.labelFalse}set"label-false"(a){this.labelFalse=a}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("label-true")||"Oui",h=this.getAttribute("label-false")||"Non",f=this.getAttribute("invalid-fallback")||"Inconnu";a==="true"||a==="1"?this.textContent=d:a==="false"||a==="0"?this.textContent=h:this.textContent=f}}class i extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null||a===""?this.removeAttribute("value"):a&&typeof a.toISOString=="function"?this.setAttribute("value",a.toISOString()):this.setAttribute("value",String(a))}get locale(){return this.getAttribute("locale")}set locale(a){a==null?this.removeAttribute("locale"):this.setAttribute("locale",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"Date invalide",h=this.getAttribute("locale")||"fr-FR";if(!a||a==="null"||a==="undefined"||a===""){this.textContent=d;return}let f=new Date(a);if(Number.isNaN(f.getTime())){this.textContent=d;return}try{this.textContent=f.toLocaleDateString(h)}catch{this.textContent=f.toLocaleDateString("fr-FR")}}}class r extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get allowed(){return this.getAttribute("allowed")}set allowed(a){a==null?this.removeAttribute("allowed"):Array.isArray(a)?this.setAttribute("allowed",a.join(",")):this.setAttribute("allowed",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=(this.getAttribute("allowed")||"").split(",").map(f=>f.trim()).filter(Boolean),h=this.getAttribute("invalid-fallback")||"Statut non autoris\xE9";if(!a||a==="null"||a==="undefined"||!d.includes(a)){this.textContent=h;return}this.textContent=String(a)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get alt(){return this.getAttribute("alt")}set alt(a){a==null?this.removeAttribute("alt"):this.setAttribute("alt",String(a))}get fallback(){return this.getAttribute("fallback")}set fallback(a){a==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(a))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("fallback")||"",h=this.getAttribute("alt")||"Media";this.innerHTML="";let f=document.createElement("img"),A=a&&a!=="null"&&a!=="undefined"&&a.trim()!=="";f.src=A?a:d,f.alt=h,this.appendChild(f)}}class o extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(a){a==null?this.removeAttribute("table"):this.setAttribute("table",String(a))}get id(){return this.getAttribute("id")}set id(a){a==null?this.removeAttribute("id"):this.setAttribute("id",String(a))}get field(){return this.getAttribute("field")}set field(a){a==null?this.removeAttribute("field"):this.setAttribute("field",String(a))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(a){a==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(a))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(a){this.orphanFallback=a}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(a){a==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(a))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(a){this.loadingFallback=a}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(a){a==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(a))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(a){this.malformedFallback=a}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let a=this.getAttribute("table"),d=this.getAttribute("id"),h=this.getAttribute("field")||"name",f=this.getAttribute("orphan-fallback")||"Supprim\xE9",A=this.getAttribute("loading-fallback")||"Chargement...",L=this.getAttribute("malformed-fallback")||"ID invalide";if(!d||typeof d!="string"||d.trim()===""||d==="null"||d==="undefined"){this.textContent=L;return}if(!a){this.textContent=L;return}this.textContent=A;try{let ie=window.Fleetbo||globalThis.Fleetbo;if(!ie||typeof ie.getDoc!="function"){this.textContent=f;return}let M=await ie.getDoc(a,d);M&&M[h]!==void 0?this.textContent=String(M[h]):M?this.textContent=M.name||M.title||M.label||JSON.stringify(M):this.textContent=f}catch{this.textContent=f}}}let c=(l,a)=>{customElements.get(l)||customElements.define(l,a)};c("fleetbo-text",n),c("fleetbo-number",e),c("fleetbo-toggle",t),c("fleetbo-date",i),c("fleetbo-enum",r),c("fleetbo-media",s),c("fleetbo-reference",o)}var Yl={Text:"fleetbo-text",Number:"fleetbo-number",Toggle:"fleetbo-toggle",Date:"fleetbo-date",Enum:"fleetbo-enum",Media:"fleetbo-media",Reference:"fleetbo-reference"};function Ce(n){typeof window>"u"&&typeof process<"u"&&process.env}async function P(n){if(n&&n._schemaVersion&&n._schemaData){let e=n._schemaVersion,t=n._schemaData;if(typeof window<"u")try{await fetch("/__fleetbo_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:t,version:e})})}catch{}else typeof process<"u"&&process.env}return n}var T=n=>`https://${n.toLowerCase()}-jqycakhlxa-uc.a.run.app`,Xl=()=>new Proxy({},{get(n,e){let t=String(e);return async(i={})=>{let r=await y(T("call"),{functionName:t,payload:i});return P(r)}}}),ma={...Yl,call:Xl(),add:async(n,e)=>{Ce(n);let t=await y(T("add"),{fleetboTable:n,jsonData:e});return P(t)},addWithId:async(n,e,t)=>{Ce(n);let i=await y(T("addWithId"),{fleetboTable:n,id:t,jsonData:e});return P(i)},addWithUserId:async(n,e)=>{Ce(n);let t=await y(T("addWithUserId"),{fleetboTable:n,jsonData:e});return P(t)},addWithMedia:async(n,e,t,i=null)=>{Ce(n);let r=await y(T("addWithMedia"),{fleetboTable:n,jsonData:e,fileBase64:t,fileName:i});return P(r)},delete:async(n,e)=>{let t=await y(T("delete"),{fleetboTable:n,id:e});return P(t)},getDocsG:async n=>{let e=await y(T("getDocsG"),{fleetboTable:n}),t=await P(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDocsU:async n=>{let e=await y(T("getDocsU"),{fleetboTable:n}),t=await P(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDoc:async(n,e)=>{let t=await y(T("getDoc"),{fleetboTable:n,id:e}),i=await P(t);return i?i.data!==void 0?i.data:i.success===!1?null:i:null},getUser:async()=>await fa(),getAuthUser:async()=>{let n=await y(T("getAuthUser")),e=await P(n);return e?e.data!==void 0?e.data:e.success===!1?null:e:null},update:async(n,e,t)=>{let i=await y(T("update"),{fleetboTable:n,id:e,...t});return P(i)},join:async(n,e)=>{Ce(n),e?.innerJoin?.collection&&Ce(e.innerJoin.collection);let t=await y(T("join"),{fleetboTable:n,joinOptions:e}),i=await P(t);return Array.isArray(i)?i:i&&Array.isArray(i.data)?i.data:[]},sendotpsvro:async n=>{let e=typeof n=="string"?{email:n}:n||{};return await y(T("sendOtpSvro"),e)},verifyotpsvro:async(n,e)=>{let t=await y(T("verifyOtpSvro"),{email:n,code:e});if(t.success&&t.customToken)try{return{success:!0,user:await Ai(t.customToken)}}catch(i){return{success:!1,error:i.message}}return t},sendOtpByPhone:async n=>{let e=typeof n=="string"?{phoneNumber:n}:n||{};return await y(T("sendOtpByPhone"),e)},verifyOtpPhoneSvro:async(n,e)=>{let t=await y(T("verifyOtpPhoneSvro"),{phoneNumber:n,code:e});if(t.success&&t.customToken)try{return{success:!0,user:await Ai(t.customToken)}}catch(i){return{success:!1,error:i.message}}return t},isAuthenticated:async(n=!1)=>await pa(n),logout:async()=>{try{return await ha(),{success:!0}}catch(n){return{success:!1,error:n.message}}},acl:{grant:async(n,e,t,i="*")=>await y(T("grantAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:i}),revoke:async(n,e,t,i="*")=>await y(T("revokeAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:i}),can:async(n,e,t="*")=>{let i=await y(T("checkAcl"),{action:n,resourceTable:e,resourceId:t});return!!(i&&(i.allowed===!0||i.can===!0))}}};typeof globalThis<"u"&&Reflect.set(globalThis,"Fleetbo",ma);typeof window<"u"&&Reflect.set(window,"Fleetbo",ma);export{ma as Fleetbo,Yl as FleetboUI};
|
|
1
|
+
var _a=Object.defineProperty;var O=(n,e,t)=>()=>{if(t)throw t[0];try{return n&&(e=n(n=0)),e}catch(i){throw t=[i],i}};var Si=(n,e)=>{for(var t in e)_a(n,t,{get:e[t],enumerable:!0})};var ki,Ri=O(()=>{ki=()=>{}});function Ea(){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 v(){return typeof navigator<"u"&&typeof navigator.userAgent=="string"?navigator.userAgent:""}function Di(){return typeof window<"u"&&!!(window.cordova||window.phonegap||window.PhoneGap)&&/ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(v())}function Li(){return typeof window<"u"||sn()}function sn(){return typeof WorkerGlobalScope<"u"&&typeof self<"u"&&self instanceof WorkerGlobalScope}function Mi(){return typeof navigator<"u"&&navigator.userAgent==="Cloudflare-Workers"}function Ui(){let n=typeof chrome=="object"?chrome.runtime:typeof browser=="object"?browser.runtime:void 0;return typeof n=="object"&&n.id!==void 0}function Fi(){return typeof navigator=="object"&&navigator.product==="ReactNative"}function xi(){let n=v();return n.indexOf("MSIE ")>=0||n.indexOf("Trident/")>=0}function Vi(){try{return typeof indexedDB=="object"}catch{return!1}}function Hi(){return new Promise((n,e)=>{try{let t=!0,i="validate-browser-context-for-indexeddb-analytics-module",r=self.indexedDB.open(i);r.onsuccess=()=>{r.result.close(),t||self.indexedDB.deleteDatabase(i),n(!0)},r.onupgradeneeded=()=>{t=!1},r.onerror=()=>{e(r.error?.message||"")}}catch(t){e(t)}})}function Aa(n,e){return n.replace(Sa,(t,i)=>{let r=e[i];return r!=null?String(r):`<${i}?>`})}function Wi(n){for(let e in n)if(Object.prototype.hasOwnProperty.call(n,e))return!1;return!0}function Y(n,e){if(n===e)return!0;let t=Object.keys(n),i=Object.keys(e);for(let r of t){if(!i.includes(r))return!1;let s=n[r],o=e[r];if(Ci(s)&&Ci(o)){if(!Y(s,o))return!1}else if(s!==o)return!1}for(let r of i)if(!t.includes(r))return!1;return!0}function Ci(n){return n!==null&&typeof n=="object"}function re(n){let e=[];for(let[t,i]of Object.entries(n))Array.isArray(i)?i.forEach(r=>{e.push(encodeURIComponent(t)+"="+encodeURIComponent(r))}):e.push(encodeURIComponent(t)+"="+encodeURIComponent(i));return e.length?"&"+e.join("&"):""}function me(n){let e={};return n.replace(/^\?/,"").split("&").forEach(i=>{if(i){let[r,s]=i.split("=");e[decodeURIComponent(r)]=decodeURIComponent(s)}}),e}function ge(n){let e=n.indexOf("?");if(!e)return"";let t=n.indexOf("#",e);return n.substring(e,t>0?t:void 0)}function Bi(n,e){let t=new en(n,e);return t.subscribe.bind(t)}function ka(n,e){if(typeof n!="object"||n===null)return!1;for(let t of e)if(t in n&&typeof n[t]=="function")return!0;return!1}function Qt(){}function p(n){return n&&n._delegate?n._delegate:n}function tt(n){try{return(n.startsWith("http://")||n.startsWith("https://")?new URL(n).hostname:n).endsWith(".cloudworkstations.dev")}catch{return!1}}async function $i(n){return(await fetch(n,{credentials:"include"})).ok}var Pi,Ia,Oi,Zt,ba,tn,Pe,ya,wa,Ta,nn,Ni,et,rn,pe,va,C,W,Sa,en,tu,_e=O(()=>{Ri();Pi=function(n){let e=[],t=0;for(let i=0;i<n.length;i++){let r=n.charCodeAt(i);r<128?e[t++]=r:r<2048?(e[t++]=r>>6|192,e[t++]=r&63|128):(r&64512)===55296&&i+1<n.length&&(n.charCodeAt(i+1)&64512)===56320?(r=65536+((r&1023)<<10)+(n.charCodeAt(++i)&1023),e[t++]=r>>18|240,e[t++]=r>>12&63|128,e[t++]=r>>6&63|128,e[t++]=r&63|128):(e[t++]=r>>12|224,e[t++]=r>>6&63|128,e[t++]=r&63|128)}return e},Ia=function(n){let e=[],t=0,i=0;for(;t<n.length;){let r=n[t++];if(r<128)e[i++]=String.fromCharCode(r);else if(r>191&&r<224){let s=n[t++];e[i++]=String.fromCharCode((r&31)<<6|s&63)}else if(r>239&&r<365){let s=n[t++],o=n[t++],c=n[t++],l=((r&7)<<18|(s&63)<<12|(o&63)<<6|c&63)-65536;e[i++]=String.fromCharCode(55296+(l>>10)),e[i++]=String.fromCharCode(56320+(l&1023))}else{let s=n[t++],o=n[t++];e[i++]=String.fromCharCode((r&15)<<12|(s&63)<<6|o&63)}}return e.join("")},Oi={byteToCharMap_:null,charToByteMap_:null,byteToCharMapWebSafe_:null,charToByteMapWebSafe_:null,ENCODED_VALS_BASE:"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",get ENCODED_VALS(){return this.ENCODED_VALS_BASE+"+/="},get ENCODED_VALS_WEBSAFE(){return this.ENCODED_VALS_BASE+"-_."},HAS_NATIVE_SUPPORT:typeof atob=="function",encodeByteArray(n,e){if(!Array.isArray(n))throw Error("encodeByteArray takes an array as a parameter");this.init_();let t=e?this.byteToCharMapWebSafe_:this.byteToCharMap_,i=[];for(let r=0;r<n.length;r+=3){let s=n[r],o=r+1<n.length,c=o?n[r+1]:0,l=r+2<n.length,a=l?n[r+2]:0,d=s>>2,h=(s&3)<<4|c>>4,f=(c&15)<<2|a>>6,A=a&63;l||(A=64,o||(f=64)),i.push(t[d],t[h],t[f],t[A])}return i.join("")},encodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?btoa(n):this.encodeByteArray(Pi(n),e)},decodeString(n,e){return this.HAS_NATIVE_SUPPORT&&!e?atob(n):Ia(this.decodeStringToByteArray(n,e))},decodeStringToByteArray(n,e){this.init_();let t=e?this.charToByteMapWebSafe_:this.charToByteMap_,i=[];for(let r=0;r<n.length;){let s=t[n.charAt(r++)],c=r<n.length?t[n.charAt(r)]:0;++r;let a=r<n.length?t[n.charAt(r)]:64;++r;let h=r<n.length?t[n.charAt(r)]:64;if(++r,s==null||c==null||a==null||h==null)throw new Zt;let f=s<<2|c>>4;if(i.push(f),a!==64){let A=c<<4&240|a>>2;if(i.push(A),h!==64){let L=a<<6&192|h;i.push(L)}}}return i},init_(){if(!this.byteToCharMap_){this.byteToCharMap_={},this.charToByteMap_={},this.byteToCharMapWebSafe_={},this.charToByteMapWebSafe_={};for(let n=0;n<this.ENCODED_VALS.length;n++)this.byteToCharMap_[n]=this.ENCODED_VALS.charAt(n),this.charToByteMap_[this.byteToCharMap_[n]]=n,this.byteToCharMapWebSafe_[n]=this.ENCODED_VALS_WEBSAFE.charAt(n),this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[n]]=n,n>=this.ENCODED_VALS_BASE.length&&(this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(n)]=n,this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(n)]=n)}}},Zt=class extends Error{constructor(){super(...arguments),this.name="DecodeBase64StringError"}},ba=function(n){let e=Pi(n);return Oi.encodeByteArray(e,!0)},tn=function(n){return ba(n).replace(/\./g,"")},Pe=function(n){try{return Oi.decodeString(n,!0)}catch(e){console.error("base64Decode failed: ",e)}return null};ya=()=>Ea().__FIREBASE_DEFAULTS__,wa=()=>{if(typeof process>"u"||typeof process.env>"u")return;let n=process.env.__FIREBASE_DEFAULTS__;if(n)return JSON.parse(n)},Ta=()=>{if(typeof document>"u")return;let n;try{n=document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/)}catch{return}let e=n&&Pe(n[1]);return e&&JSON.parse(e)},nn=()=>{try{return ki()||ya()||wa()||Ta()}catch(n){console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${n}`);return}},Ni=n=>nn()?.emulatorHosts?.[n],et=()=>nn()?.config,rn=n=>nn()?.[`_${n}`];pe=class{constructor(){this.reject=()=>{},this.resolve=()=>{},this.promise=new Promise((e,t)=>{this.resolve=e,this.reject=t})}wrapCallback(e){return(t,i)=>{t?this.reject(t):this.resolve(i),typeof e=="function"&&(this.promise.catch(()=>{}),e.length===1?e(t):e(t,i))}}};va="FirebaseError",C=class n extends Error{constructor(e,t,i){super(t),this.code=e,this.customData=i,this.name=va,Object.setPrototypeOf(this,n.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,W.prototype.create)}},W=class{constructor(e,t,i){this.service=e,this.serviceName=t,this.errors=i}create(e,...t){let i=t[0]||{},r=`${this.service}/${e}`,s=this.errors[e],o=s?Aa(s,i):"Error",c=`${this.serviceName}: ${o} (${r}).`;return new C(r,c,i)}};Sa=/\{\$([^}]+)}/g;en=class{constructor(e,t){this.observers=[],this.unsubscribes=[],this.observerCount=0,this.task=Promise.resolve(),this.finalized=!1,this.onNoObservers=t,this.task.then(()=>{e(this)}).catch(i=>{this.error(i)})}next(e){this.forEachObserver(t=>{t.next(e)})}error(e){this.forEachObserver(t=>{t.error(e)}),this.close(e)}complete(){this.forEachObserver(e=>{e.complete()}),this.close()}subscribe(e,t,i){let r;if(e===void 0&&t===void 0&&i===void 0)throw new Error("Missing Observer.");ka(e,["next","error","complete"])?r=e:r={next:e,error:t,complete:i},r.next===void 0&&(r.next=Qt),r.error===void 0&&(r.error=Qt),r.complete===void 0&&(r.complete=Qt);let s=this.unsubscribeOne.bind(this,this.observers.length);return this.finalized&&this.task.then(()=>{try{this.finalError?r.error(this.finalError):r.complete()}catch{}}),this.observers.push(r),s}unsubscribeOne(e){this.observers===void 0||this.observers[e]===void 0||(delete this.observers[e],this.observerCount-=1,this.observerCount===0&&this.onNoObservers!==void 0&&this.onNoObservers(this))}forEachObserver(e){if(!this.finalized)for(let t=0;t<this.observers.length;t++)this.sendOne(t,e)}sendOne(e,t){this.task.then(()=>{if(this.observers!==void 0&&this.observers[e]!==void 0)try{t(this.observers[e])}catch(i){typeof console<"u"&&console.error&&console.error(i)}})}close(e){this.finalized||(this.finalized=!0,e!==void 0&&(this.finalError=e),this.task.then(()=>{this.observers=void 0,this.onNoObservers=void 0}))}};tu=14400*1e3;});function Ra(n){return n===se?void 0:n}function Ca(n){return n.instantiationMode==="EAGER"}var U,se,an,Oe,nt=O(()=>{_e();U=class{constructor(e,t,i){this.name=e,this.instanceFactory=t,this.type=i,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}};se="[DEFAULT]";an=class{constructor(e,t){this.name=e,this.container=t,this.component=null,this.instances=new Map,this.instancesDeferred=new Map,this.instancesOptions=new Map,this.onInitCallbacks=new Map}get(e){let t=this.normalizeInstanceIdentifier(e);if(!this.instancesDeferred.has(t)){let i=new pe;if(this.instancesDeferred.set(t,i),this.isInitialized(t)||this.shouldAutoInitialize())try{let r=this.getOrInitializeService({instanceIdentifier:t});r&&i.resolve(r)}catch{}}return this.instancesDeferred.get(t).promise}getImmediate(e){let t=this.normalizeInstanceIdentifier(e?.identifier),i=e?.optional??!1;if(this.isInitialized(t)||this.shouldAutoInitialize())try{return this.getOrInitializeService({instanceIdentifier:t})}catch(r){if(i)return null;throw r}else{if(i)return null;throw Error(`Service ${this.name} is not available`)}}getComponent(){return this.component}setComponent(e){if(e.name!==this.name)throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);if(this.component)throw Error(`Component for ${this.name} has already been provided`);if(this.component=e,!!this.shouldAutoInitialize()){if(Ca(e))try{this.getOrInitializeService({instanceIdentifier:se})}catch{}for(let[t,i]of this.instancesDeferred.entries()){let r=this.normalizeInstanceIdentifier(t);try{let s=this.getOrInitializeService({instanceIdentifier:r});i.resolve(s)}catch{}}}}clearInstance(e=se){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(t=>"INTERNAL"in t).map(t=>t.INTERNAL.delete()),...e.filter(t=>"_delete"in t).map(t=>t._delete())])}isComponentSet(){return this.component!=null}isInitialized(e=se){return this.instances.has(e)}getOptions(e=se){return this.instancesOptions.get(e)||{}}initialize(e={}){let{options:t={}}=e,i=this.normalizeInstanceIdentifier(e.instanceIdentifier);if(this.isInitialized(i))throw Error(`${this.name}(${i}) has already been initialized`);if(!this.isComponentSet())throw Error(`Component ${this.name} has not been registered yet`);let r=this.getOrInitializeService({instanceIdentifier:i,options:t});for(let[s,o]of this.instancesDeferred.entries()){let c=this.normalizeInstanceIdentifier(s);i===c&&o.resolve(r)}return r}onInit(e,t){let i=this.normalizeInstanceIdentifier(t),r=this.onInitCallbacks.get(i)??new Set;r.add(e),this.onInitCallbacks.set(i,r);let s=this.instances.get(i);return s&&e(s,i),()=>{r.delete(e)}}invokeOnInitCallbacks(e,t){let i=this.onInitCallbacks.get(t);if(i)for(let r of i)try{r(e,t)}catch{}}getOrInitializeService({instanceIdentifier:e,options:t={}}){let i=this.instances.get(e);if(!i&&this.component&&(i=this.component.instanceFactory(this.container,{instanceIdentifier:Ra(e),options:t}),this.instances.set(e,i),this.instancesOptions.set(e,t),this.invokeOnInitCallbacks(i,e),this.component.onInstanceCreated))try{this.component.onInstanceCreated(this.container,e,i)}catch{}return i||null}normalizeInstanceIdentifier(e=se){return this.component?this.component.multipleInstances?e:se:e}shouldAutoInitialize(){return!!this.component&&this.component.instantiationMode!=="EXPLICIT"}};Oe=class{constructor(e){this.name=e,this.providers=new Map}addComponent(e){let t=this.getProvider(e.name);if(t.isComponentSet())throw new Error(`Component ${e.name} has already been registered with ${this.name}`);t.setComponent(e)}addOrOverwriteComponent(e){this.getProvider(e.name).isComponentSet()&&this.providers.delete(e.name),this.addComponent(e)}getProvider(e){if(this.providers.has(e))return this.providers.get(e);let t=new an(e,this);return this.providers.set(e,t),t}getProviders(){return Array.from(this.providers.values())}}});function zi(n){on.forEach(e=>{e.setLogLevel(n)})}function qi(n,e){for(let t of on){let i=null;e&&e.level&&(i=ji[e.level]),n===null?t.userLogHandler=null:t.userLogHandler=(r,s,...o)=>{let c=o.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>=(i??r.logLevel)&&n({level:m[s].toLowerCase(),message:c,args:o,type:r.name})}}}var on,m,ji,Pa,Oa,Na,Ie,it=O(()=>{on=[];(function(n){n[n.DEBUG=0]="DEBUG",n[n.VERBOSE=1]="VERBOSE",n[n.INFO=2]="INFO",n[n.WARN=3]="WARN",n[n.ERROR=4]="ERROR",n[n.SILENT=5]="SILENT"})(m||(m={}));ji={debug:m.DEBUG,verbose:m.VERBOSE,info:m.INFO,warn:m.WARN,error:m.ERROR,silent:m.SILENT},Pa=m.INFO,Oa={[m.DEBUG]:"log",[m.VERBOSE]:"log",[m.INFO]:"info",[m.WARN]:"warn",[m.ERROR]:"error"},Na=(n,e,...t)=>{if(e<n.logLevel)return;let i=new Date().toISOString(),r=Oa[e];if(r)console[r](`[${i}] ${n.name}:`,...t);else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`)},Ie=class{constructor(e){this.name=e,this._logLevel=Pa,this._logHandler=Na,this._userLogHandler=null,on.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"?ji[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 La(){return Gi||(Gi=[IDBDatabase,IDBObjectStore,IDBIndex,IDBCursor,IDBTransaction])}function Ma(){return Ki||(Ki=[IDBCursor.prototype.advance,IDBCursor.prototype.continue,IDBCursor.prototype.continuePrimaryKey])}function Ua(n){let e=new Promise((t,i)=>{let r=()=>{n.removeEventListener("success",s),n.removeEventListener("error",o)},s=()=>{t(F(n.result)),r()},o=()=>{i(n.error),r()};n.addEventListener("success",s),n.addEventListener("error",o)});return e.then(t=>{t instanceof IDBCursor&&Ji.set(t,n)}).catch(()=>{}),dn.set(e,n),e}function Fa(n){if(ln.has(n))return;let e=new Promise((t,i)=>{let r=()=>{n.removeEventListener("complete",s),n.removeEventListener("error",o),n.removeEventListener("abort",o)},s=()=>{t(),r()},o=()=>{i(n.error||new DOMException("AbortError","AbortError")),r()};n.addEventListener("complete",s),n.addEventListener("error",o),n.addEventListener("abort",o)});ln.set(n,e)}function Xi(n){un=n(un)}function xa(n){return n===IDBDatabase.prototype.transaction&&!("objectStoreNames"in IDBTransaction.prototype)?function(e,...t){let i=n.call(rt(this),e,...t);return Yi.set(i,e.sort?e.sort():[e]),F(i)}:Ma().includes(n)?function(...e){return n.apply(rt(this),e),F(Ji.get(this))}:function(...e){return F(n.apply(rt(this),e))}}function Va(n){return typeof n=="function"?xa(n):(n instanceof IDBTransaction&&Fa(n),Da(n,La())?new Proxy(n,un):n)}function F(n){if(n instanceof IDBRequest)return Ua(n);if(cn.has(n))return cn.get(n);let e=Va(n);return e!==n&&(cn.set(n,e),dn.set(e,n)),e}var Da,Gi,Ki,Ji,ln,Yi,cn,dn,un,rt,hn=O(()=>{Da=(n,e)=>e.some(t=>n instanceof t);Ji=new WeakMap,ln=new WeakMap,Yi=new WeakMap,cn=new WeakMap,dn=new WeakMap;un={get(n,e,t){if(n instanceof IDBTransaction){if(e==="done")return ln.get(n);if(e==="objectStoreNames")return n.objectStoreNames||Yi.get(n);if(e==="store")return t.objectStoreNames[1]?void 0:t.objectStore(t.objectStoreNames[0])}return F(n[e])},set(n,e,t){return n[e]=t,!0},has(n,e){return n instanceof IDBTransaction&&(e==="done"||e==="store")?!0:e in n}};rt=n=>dn.get(n)});function Zi(n,e,{blocked:t,upgrade:i,blocking:r,terminated:s}={}){let o=indexedDB.open(n,e),c=F(o);return i&&o.addEventListener("upgradeneeded",l=>{i(F(o.result),l.oldVersion,l.newVersion,F(o.transaction),l)}),t&&o.addEventListener("blocked",l=>t(l.oldVersion,l.newVersion,l)),c.then(l=>{s&&l.addEventListener("close",()=>s()),r&&l.addEventListener("versionchange",a=>r(a.oldVersion,a.newVersion,a))}).catch(()=>{}),c}function Qi(n,e){if(!(n instanceof IDBDatabase&&!(e in n)&&typeof e=="string"))return;if(fn.get(e))return fn.get(e);let t=e.replace(/FromIndex$/,""),i=e!==t,r=Wa.includes(t);if(!(t in(i?IDBIndex:IDBObjectStore).prototype)||!(r||Ha.includes(t)))return;let s=async function(o,...c){let l=this.transaction(o,r?"readwrite":"readonly"),a=l.store;return i&&(a=a.index(c.shift())),(await Promise.all([a[t](...c),r&&l.done]))[0]};return fn.set(e,s),s}var Ha,Wa,fn,er=O(()=>{hn();hn();Ha=["get","getKey","getAll","getAllKeys","count"],Wa=["put","add","delete","clear"],fn=new Map;Xi(n=>({...n,get:(e,t,i)=>Qi(e,t)||n.get(e,t,i),has:(e,t)=>!!Qi(e,t)||n.has(e,t)}))});function Ba(n){return n.getComponent()?.type==="VERSION"}function _n(n,e){try{n.container.addComponent(e)}catch(t){B.debug(`Component ${e.name} failed to register with FirebaseApp ${n.name}`,t)}}function Io(n,e){n.container.addOrOverwriteComponent(e)}function ae(n){let e=n.name;if(Ee.has(e))return B.debug(`There were multiple attempts to register component ${e}.`),!1;Ee.set(e,n);for(let t of X.values())_n(t,n);for(let t of be.values())_n(t,n);return!0}function Le(n,e){let t=n.container.getProvider("heartbeat").getImmediate({optional:!0});return t&&t.triggerHeartbeat(),n.container.getProvider(e)}function bo(n,e,t=Ne){Le(n,e).clearInstance(t)}function yn(n){return n.options!==void 0}function sr(n){return yn(n)?!1:"authIdToken"in n||"appCheckToken"in n||"releaseOnDeref"in n||"automaticDataCollectionEnabled"in n}function I(n){return n==null?!1:n.settings!==void 0}function Eo(){Ee.clear()}function tr(n,e){let t=Pe(n.split(".")[1]);if(t===null){console.error(`FirebaseServerApp ${e} is invalid: second part could not be parsed.`);return}if(JSON.parse(t).exp===void 0){console.error(`FirebaseServerApp ${e} is invalid: expiration claim could not be parsed`);return}let r=JSON.parse(t).exp*1e3,s=new Date().getTime();r-s<=0&&console.error(`FirebaseServerApp ${e} is invalid: the token has expired.`)}function ar(n,e={}){let t=n;typeof e!="object"&&(e={name:e});let i={name:Ne,automaticDataCollectionEnabled:!0,...e},r=i.name;if(typeof r!="string"||!r)throw R.create("bad-app-name",{appName:String(r)});if(t||(t=et()),!t)throw R.create("no-options");let s=X.get(r);if(s){if(Y(t,s.options)&&Y(i,s.config))return s;throw R.create("duplicate-app",{appName:r})}let o=new Oe(r);for(let l of Ee.values())o.addComponent(l);let c=new at(t,i,o);return X.set(r,c),c}function wo(n,e={}){if(Li()&&!sn())throw R.create("invalid-server-app-environment");let t,i=e||{};if(n&&(yn(n)?t=n.options:sr(n)?i=n:t=n),i.automaticDataCollectionEnabled===void 0&&(i.automaticDataCollectionEnabled=!0),t||(t=et()),!t)throw R.create("no-options");let r={...i,...t};r.releaseOnDeref!==void 0&&delete r.releaseOnDeref;let s=d=>[...d].reduce((h,f)=>Math.imul(31,h)+f.charCodeAt(0)|0,0);if(i.releaseOnDeref!==void 0&&typeof FinalizationRegistry>"u")throw R.create("finalization-registry-not-supported",{});let o=""+s(JSON.stringify(r)),c=be.get(o);if(c)return c.incRefCount(i.releaseOnDeref),c;let l=new Oe(o);for(let d of Ee.values())l.addComponent(d);let a=new In(t,i,o,l);return be.set(o,a),a}function wn(n=Ne){let e=X.get(n);if(!e&&n===Ne&&et())return ar();if(!e)throw R.create("no-app",{appName:n});return e}function To(){return Array.from(X.values())}async function or(n){let e=!1,t=n.name;X.has(t)?(e=!0,X.delete(t)):be.has(t)&&n.decRefCount()<=0&&(be.delete(t),e=!0),e&&(await Promise.all(n.container.getProviders().map(i=>i.delete())),n.isDeleted=!0)}function x(n,e,t){let i=_o[n]??n;t&&(i+=`-${t}`);let r=i.match(/\s|\//),s=e.match(/\s|\//);if(r||s){let o=[`Unable to register library "${i}" with version "${e}":`];r&&o.push(`library name "${i}" contains illegal characters (whitespace or "/")`),r&&s&&o.push("and"),s&&o.push(`version name "${e}" contains illegal characters (whitespace or "/")`),B.warn(o.join(" "));return}ae(new U(`${i}-version`,()=>({library:i,version:e}),"VERSION"))}function vo(n,e){if(n!==null&&typeof n!="function")throw R.create("invalid-log-argument");qi(n,e)}function Ao(n){zi(n)}function cr(){return pn||(pn=Zi(So,ko,{upgrade:(n,e)=>{switch(e){case 0:try{n.createObjectStore(De)}catch(t){console.warn(t)}}}}).catch(n=>{throw R.create("idb-open",{originalErrorMessage:n.message})})),pn}async function Ro(n){try{let t=(await cr()).transaction(De),i=await t.objectStore(De).get(lr(n));return await t.done,i}catch(e){if(e instanceof C)B.warn(e.message);else{let t=R.create("idb-get",{originalErrorMessage:e?.message});B.warn(t.message)}}}async function nr(n,e){try{let i=(await cr()).transaction(De,"readwrite");await i.objectStore(De).put(e,lr(n)),await i.done}catch(t){if(t instanceof C)B.warn(t.message);else{let i=R.create("idb-set",{originalErrorMessage:t?.message});B.warn(i.message)}}}function lr(n){return`${n.name}!${n.options.appId}`}function ir(){return new Date().toISOString().substring(0,10)}function Oo(n,e=Co){let t=[],i=n.slice();for(let r of n){let s=t.find(o=>o.agent===r.agent);if(s){if(s.dates.push(r.date),rr(t)>e){s.dates.pop();break}}else if(t.push({agent:r.agent,dates:[r.date]}),rr(t)>e){t.pop();break}i=i.slice(1)}return{heartbeatsToSend:t,unsentEntries:i}}function rr(n){return tn(JSON.stringify({version:2,heartbeats:n})).length}function No(n){if(n.length===0)return-1;let e=0,t=n[0].date;for(let i=1;i<n.length;i++)n[i].date<t&&(t=n[i].date,e=i);return e}function Do(n){ae(new U("platform-logger",e=>new mn(e),"PRIVATE")),ae(new U("heartbeat",e=>new bn(e),"PRIVATE")),x(st,gn,n),x(st,gn,"esm2020"),x("fire-js","")}var mn,st,gn,B,$a,ja,za,qa,Ga,Ka,Ja,Ya,Xa,Qa,Za,eo,to,no,io,ro,so,ao,oo,co,lo,uo,ho,fo,po,mo,go,Ne,_o,X,be,Ee,yo,R,at,In,oe,So,ko,De,pn,Co,Po,bn,En,Me=O(()=>{nt();it();_e();_e();er();mn=class{constructor(e){this.container=e}getPlatformInfoString(){return this.container.getProviders().map(t=>{if(Ba(t)){let i=t.getImmediate();return`${i.library}/${i.version}`}else return null}).filter(t=>t).join(" ")}};st="@firebase/app",gn="0.15.1";B=new Ie("@firebase/app"),$a="@firebase/app-compat",ja="@firebase/analytics-compat",za="@firebase/analytics",qa="@firebase/app-check-compat",Ga="@firebase/app-check",Ka="@firebase/auth",Ja="@firebase/auth-compat",Ya="@firebase/database",Xa="@firebase/data-connect",Qa="@firebase/database-compat",Za="@firebase/functions",eo="@firebase/functions-compat",to="@firebase/installations",no="@firebase/installations-compat",io="@firebase/messaging",ro="@firebase/messaging-compat",so="@firebase/performance",ao="@firebase/performance-compat",oo="@firebase/remote-config",co="@firebase/remote-config-compat",lo="@firebase/storage",uo="@firebase/storage-compat",ho="@firebase/firestore",fo="@firebase/ai",po="@firebase/firestore-compat",mo="firebase",go="12.16.0";Ne="[DEFAULT]",_o={[st]:"fire-core",[$a]:"fire-core-compat",[za]:"fire-analytics",[ja]:"fire-analytics-compat",[Ga]:"fire-app-check",[qa]:"fire-app-check-compat",[Ka]:"fire-auth",[Ja]:"fire-auth-compat",[Ya]:"fire-rtdb",[Xa]:"fire-data-connect",[Qa]:"fire-rtdb-compat",[Za]:"fire-fn",[eo]:"fire-fn-compat",[to]:"fire-iid",[no]:"fire-iid-compat",[io]:"fire-fcm",[ro]:"fire-fcm-compat",[so]:"fire-perf",[ao]:"fire-perf-compat",[oo]:"fire-rc",[co]:"fire-rc-compat",[lo]:"fire-gcs",[uo]:"fire-gcs-compat",[ho]:"fire-fst",[po]:"fire-fst-compat",[fo]:"fire-vertex","fire-js":"fire-js",[mo]:"fire-js-all"};X=new Map,be=new Map,Ee=new Map;yo={"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."},R=new W("app","Firebase",yo);at=class{constructor(e,t,i){this._isDeleted=!1,this._options={...e},this._config={...t},this._name=t.name,this._automaticDataCollectionEnabled=t.automaticDataCollectionEnabled,this._container=i,this.container.addComponent(new U("app",()=>this,"PUBLIC"))}get automaticDataCollectionEnabled(){return this.checkDestroyed(),this._automaticDataCollectionEnabled}set automaticDataCollectionEnabled(e){this.checkDestroyed(),this._automaticDataCollectionEnabled=e}get name(){return this.checkDestroyed(),this._name}get options(){return this.checkDestroyed(),this._options}get config(){return this.checkDestroyed(),this._config}get container(){return this._container}get isDeleted(){return this._isDeleted}set isDeleted(e){this._isDeleted=e}checkDestroyed(){if(this.isDeleted)throw R.create("app-deleted",{appName:this._name})}};In=class extends at{constructor(e,t,i,r){let s=t.automaticDataCollectionEnabled!==void 0?t.automaticDataCollectionEnabled:!0,o={name:i,automaticDataCollectionEnabled:s};if(e.apiKey!==void 0)super(e,o,r);else{let c=e;super(c.options,o,r)}this._serverConfig={automaticDataCollectionEnabled:s,...t},this._serverConfig.authIdToken&&tr(this._serverConfig.authIdToken,"authIdToken"),this._serverConfig.appCheckToken&&tr(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,t.releaseOnDeref=void 0,x(st,gn,"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(){or(this)}get settings(){return this.checkDestroyed(),this._serverConfig}checkDestroyed(){if(this.isDeleted)throw R.create("server-app-deleted")}};oe=go;So="firebase-heartbeat-database",ko=1,De="firebase-heartbeat-store",pn=null;Co=1024,Po=30,bn=class{constructor(e){this.container=e,this._heartbeatsCache=null;let t=this.container.getProvider("app").getImmediate();this._storage=new En(t),this._heartbeatsCachePromise=this._storage.read().then(i=>(this._heartbeatsCache=i,i))}async triggerHeartbeat(){try{let t=this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(),i=ir();if(this._heartbeatsCache?.heartbeats==null&&(this._heartbeatsCache=await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null)||this._heartbeatsCache.lastSentHeartbeatDate===i||this._heartbeatsCache.heartbeats.some(r=>r.date===i))return;if(this._heartbeatsCache.heartbeats.push({date:i,agent:t}),this._heartbeatsCache.heartbeats.length>Po){let r=No(this._heartbeatsCache.heartbeats);this._heartbeatsCache.heartbeats.splice(r,1)}return this._storage.overwrite(this._heartbeatsCache)}catch(e){B.warn(e)}}async getHeartbeatsHeader(){try{if(this._heartbeatsCache===null&&await this._heartbeatsCachePromise,this._heartbeatsCache?.heartbeats==null||this._heartbeatsCache.heartbeats.length===0)return"";let e=ir(),{heartbeatsToSend:t,unsentEntries:i}=Oo(this._heartbeatsCache.heartbeats),r=tn(JSON.stringify({version:2,heartbeats:t}));return this._heartbeatsCache.lastSentHeartbeatDate=e,i.length>0?(this._heartbeatsCache.heartbeats=i,await this._storage.overwrite(this._heartbeatsCache)):(this._heartbeatsCache.heartbeats=[],this._storage.overwrite(this._heartbeatsCache)),r}catch(e){return B.warn(e),""}}};En=class{constructor(e){this.app=e,this._canUseIndexedDBPromise=this.runIndexedDBEnvironmentCheck()}async runIndexedDBEnvironmentCheck(){return Vi()?Hi().then(()=>!0).catch(()=>!1):!1}async read(){if(await this._canUseIndexedDBPromise){let t=await Ro(this.app);return t?.heartbeats?t:{heartbeats:[]}}else return{heartbeats:[]}}async overwrite(e){if(await this._canUseIndexedDBPromise){let i=await this.read();return nr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??i.lastSentHeartbeatDate,heartbeats:e.heartbeats})}else return}async add(e){if(await this._canUseIndexedDBPromise){let i=await this.read();return nr(this.app,{lastSentHeartbeatDate:e.lastSentHeartbeatDate??i.lastSentHeartbeatDate,heartbeats:[...i.heartbeats,...e.heartbeats]})}else return}};Do("")});var ur={};Si(ur,{FirebaseError:()=>C,SDK_VERSION:()=>oe,_DEFAULT_ENTRY_NAME:()=>Ne,_addComponent:()=>_n,_addOrOverwriteComponent:()=>Io,_apps:()=>X,_clearComponents:()=>Eo,_components:()=>Ee,_getProvider:()=>Le,_isFirebaseApp:()=>yn,_isFirebaseServerApp:()=>I,_isFirebaseServerAppSettings:()=>sr,_registerComponent:()=>ae,_removeServiceInstance:()=>bo,_serverApps:()=>be,deleteApp:()=>or,getApp:()=>wn,getApps:()=>To,initializeApp:()=>ar,initializeServerApp:()=>wo,onLog:()=>vo,registerVersion:()=>x,setLogLevel:()=>Ao});var Lo,Mo,dr=O(()=>{Me();Me();Lo="firebase",Mo="12.16.0";x(Lo,Mo,"app")});function Uo(){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 Fr(){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 Fo(n,...e){ft.logLevel<=m.WARN&&ft.warn(`Auth (${oe}): ${n}`,...e)}function lt(n,...e){ft.logLevel<=m.ERROR&&ft.error(`Auth (${oe}): ${n}`,...e)}function k(n,...e){throw ri(n,...e)}function S(n,...e){return ri(n,...e)}function ii(n,e,t){let i={...ni(),[e]:t};return new W("auth","Firebase",i).create(e,{appName:n.name})}function T(n){return ii(n,"operation-not-supported-in-this-environment","Operations that alter the current user are not supported in conjunction with FirebaseServerApp")}function Re(n,e,t){let i=t;if(!(e instanceof i))throw i.name!==e.constructor.name&&k(n,"argument-error"),ii(n,"argument-error",`Type of ${e.constructor.name} does not match expected instance.Did you pass a reference from a different Auth SDK?`)}function ri(n,...e){if(typeof n!="string"){let t=e[0],i=[...e.slice(1)];return i[0]&&(i[0].appName=n.name),n._errorFactory.create(t,...i)}return Vr.create(n,...e)}function u(n,e,...t){if(!n)throw ri(e,...t)}function V(n){let e="INTERNAL ASSERTION FAILED: "+n;throw lt(e),new Error(e)}function z(n,e){n||V(e)}function Be(){return typeof self<"u"&&self.location?.href||""}function si(){return hr()==="http:"||hr()==="https:"}function hr(){return typeof self<"u"&&self.location?.protocol||null}function xo(){return typeof navigator<"u"&&navigator&&"onLine"in navigator&&typeof navigator.onLine=="boolean"&&(si()||Ui()||"connection"in navigator)?navigator.onLine:!0}function Vo(){if(typeof navigator>"u")return null;let n=navigator;return n.languages&&n.languages[0]||n.language||null}function ai(n,e){z(n.emulator,"Emulator should always be set here");let{url:t}=n.emulator;return e?`${t}${e.startsWith("/")?e.slice(1):e}`:t}function g(n,e){return n.tenantId&&!e.tenantId?{...e,tenantId:n.tenantId}:e}async function _(n,e,t,i,r={}){return Wr(n,r,async()=>{let s={},o={};i&&(e==="GET"?o=i:s={body:JSON.stringify(i)});let c=re({...o,key:n.config.apiKey}).slice(1),l=await n._getAdditionalHeaders();l["Content-Type"]="application/json",n.languageCode&&(l["X-Firebase-Locale"]=n.languageCode);let a={method:e,headers:l,...s};return Mi()||(a.referrerPolicy="strict-origin-when-cross-origin"),n.emulatorConfig&&tt(n.emulatorConfig.host)&&(a.credentials="include"),pt.fetch()(await Br(n,n.config.apiHost,t,c),a)})}async function Wr(n,e,t){n._canInitEmulator=!1;let i={...Ho,...e};try{let r=new Pn(n),s=await Promise.race([t(),r.promise]);r.clearNetworkTimeout();let o=await s.json();if("needConfirmation"in o)throw Fe(n,"account-exists-with-different-credential",o);if(s.ok&&!("errorMessage"in o))return o;{let c=s.ok?o.errorMessage:o.error.message,[l,a]=c.split(" : ");if(l==="FEDERATED_USER_ID_ALREADY_LINKED")throw Fe(n,"credential-already-in-use",o);if(l==="EMAIL_EXISTS")throw Fe(n,"email-already-in-use",o);if(l==="USER_DISABLED")throw Fe(n,"user-disabled",o);let d=i[l]||l.toLowerCase().replace(/[_\s]+/g,"-");if(a)throw ii(n,d,a);k(n,d)}}catch(r){if(r instanceof C)throw r;k(n,"network-request-failed",{message:String(r)})}}async function J(n,e,t,i,r={}){let s=await _(n,e,t,i,r);return"mfaPendingCredential"in s&&k(n,"multi-factor-auth-required",{_serverResponse:s}),s}async function Br(n,e,t,i){let r=`${e}${t}?${i}`,s=n,o=s.config.emulator?ai(n.config,r):`${n.config.apiScheme}://${r}`;return Wo.includes(t)&&(await s._persistenceManagerAvailable,s._getPersistenceType()==="COOKIE")?s._getPersistence()._getFinalTarget(o).toString():o}function $o(n){switch(n){case"ENFORCE":return"ENFORCE";case"AUDIT":return"AUDIT";case"OFF":return"OFF";default:return"ENFORCEMENT_STATE_UNSPECIFIED"}}function Fe(n,e,t){let i={appName:n.name};t.email&&(i.email=t.email),t.phoneNumber&&(i.phoneNumber=t.phoneNumber);let r=S(n,e,i);return r.customData._tokenResponse=t,r}function fr(n){return n!==void 0&&n.getResponse!==void 0}function pr(n){return n!==void 0&&n.enterprise!==void 0}async function jo(n){return(await _(n,"GET","/v1/recaptchaParams")).recaptchaSiteKey||""}async function $r(n,e){return _(n,"GET","/v2/recaptchaConfig",g(n,e))}async function zo(n,e){return _(n,"POST","/v1/accounts:delete",e)}async function qo(n,e){return _(n,"POST","/v1/accounts:update",e)}async function gt(n,e){return _(n,"POST","/v1/accounts:lookup",e)}function xe(n){if(n)try{let e=new Date(Number(n));if(!isNaN(e.getTime()))return e.toUTCString()}catch{}}function jr(n,e=!1){return p(n).getIdToken(e)}async function oi(n,e=!1){let t=p(n),i=await t.getIdToken(e),r=Vt(i);u(r&&r.exp&&r.auth_time&&r.iat,t.auth,"internal-error");let s=typeof r.firebase=="object"?r.firebase:void 0,o=s?.sign_in_provider;return{claims:r,token:i,authTime:xe(Tn(r.auth_time)),issuedAtTime:xe(Tn(r.iat)),expirationTime:xe(Tn(r.exp)),signInProvider:o||null,signInSecondFactor:s?.sign_in_second_factor||null}}function Tn(n){return Number(n)*1e3}function Vt(n){let[e,t,i]=n.split(".");if(e===void 0||t===void 0||i===void 0)return lt("JWT malformed, contained fewer than 3 sections"),null;try{let r=Pe(t);return r?JSON.parse(r):(lt("Failed to decode base64 JWT payload"),null)}catch(r){return lt("Caught error parsing JWT payload as JSON",r?.toString()),null}}function mr(n){let e=Vt(n);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 q(n,e,t=!1){if(t)return e;try{return await e}catch(i){throw i instanceof C&&Go(i)&&n.auth.currentUser===n&&await n.auth.signOut(),i}}function Go({code:n}){return n==="auth/user-disabled"||n==="auth/user-token-expired"}async function je(n){let e=n.auth,t=await n.getIdToken(),i=await q(n,gt(e,{idToken:t}));u(i?.users.length,e,"internal-error");let r=i.users[0];n._notifyReloadListener(r);let s=r.providerUserInfo?.length?zr(r.providerUserInfo):[],o=Ko(n.providerData,s),c=n.isAnonymous,l=!(n.email&&r.passwordHash)&&!o?.length,a=c?l:!1,d={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:o,metadata:new $e(r.createdAt,r.lastLoginAt),isAnonymous:a};Object.assign(n,d)}async function ci(n){let e=p(n);await je(e),await e.auth._persistUserIfCurrent(e),e.auth._notifyListenersIfCurrent(e)}function Ko(n,e){return[...n.filter(i=>!e.some(r=>r.providerId===i.providerId)),...e]}function zr(n){return n.map(({providerId:e,...t})=>({providerId:e,uid:t.rawId||"",displayName:t.displayName||null,email:t.email||null,phoneNumber:t.phoneNumber||null,photoURL:t.photoUrl||null}))}async function Jo(n,e){let t=await Wr(n,{},async()=>{let i=re({grant_type:"refresh_token",refresh_token:e}).slice(1),{tokenApiHost:r,apiKey:s}=n.config,o=await Br(n,r,"/v1/token",`key=${s}`),c=await n._getAdditionalHeaders();c["Content-Type"]="application/x-www-form-urlencoded";let l={method:"POST",headers:c,body:i};return n.emulatorConfig&&tt(n.emulatorConfig.host)&&(l.credentials="include"),pt.fetch()(o,l)});return{accessToken:t.access_token,expiresIn:t.expires_in,refreshToken:t.refresh_token}}async function Yo(n,e){return _(n,"POST","/v2/accounts:revokeToken",g(n,e))}function Q(n,e){u(typeof n=="string"||typeof n>"u","internal-error",{appName:e})}function $(n){z(n instanceof Function,"Expected a class definition");let e=gr.get(n);return e?(z(e instanceof n,"Instance stored in cache mismatched with class"),e):(e=new n,gr.set(n,e),e)}function ut(n,e,t){return`firebase:${n}:${e}:${t}`}function _r(n){let e=n.toLowerCase();if(e.includes("opera/")||e.includes("opr/")||e.includes("opios/"))return"Opera";if(Jr(e))return"IEMobile";if(e.includes("msie")||e.includes("trident/"))return"IE";if(e.includes("edge/"))return"Edge";if(qr(e))return"Firefox";if(e.includes("silk/"))return"Silk";if(Xr(e))return"Blackberry";if(Qr(e))return"Webos";if(Gr(e))return"Safari";if((e.includes("chrome/")||Kr(e))&&!e.includes("edge/"))return"Chrome";if(Yr(e))return"Android";{let t=/([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/,i=n.match(t);if(i?.length===2)return i[1]}return"Other"}function qr(n=v()){return/firefox\//i.test(n)}function Gr(n=v()){let e=n.toLowerCase();return e.includes("safari/")&&!e.includes("chrome/")&&!e.includes("crios/")&&!e.includes("android")}function Kr(n=v()){return/crios\//i.test(n)}function Jr(n=v()){return/iemobile/i.test(n)}function Yr(n=v()){return/android/i.test(n)}function Xr(n=v()){return/blackberry/i.test(n)}function Qr(n=v()){return/webos/i.test(n)}function li(n=v()){return/iphone|ipad|ipod/i.test(n)||/macintosh/i.test(n)&&/mobile/i.test(n)}function Xo(n=v()){return li(n)&&!!window.navigator?.standalone}function Qo(){return xi()&&document.documentMode===10}function Zr(n=v()){return li(n)||Yr(n)||Qr(n)||Xr(n)||/windows phone/i.test(n)||Jr(n)}function es(n,e=[]){let t;switch(n){case"Browser":t=_r(v());break;case"Worker":t=`${_r(v())}-${n}`;break;default:t=n}let i=e.length?e.join(","):"FirebaseCore-web";return`${t}/JsCore/${oe}/${i}`}async function Zo(n,e={}){return _(n,"GET","/v2/passwordPolicy",g(n,e))}function b(n){return p(n)}function tc(n){Xe=n}function ui(n){return Xe.loadJS(n)}function nc(){return Xe.recaptchaV2Script}function ic(){return Xe.recaptchaEnterpriseScript}function rc(){return Xe.gapiScript}function ts(n){return`__${n}${Math.floor(Math.random()*1e6)}`}function oc(n){let e=[],t="1234567890abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";for(let i=0;i<n;i++)e.push(t.charAt(Math.floor(Math.random()*t.length)));return e.join("")}async function Ue(n,e,t,i=!1,r=!1){let s=new ze(n),o;if(r)o=He;else try{o=await s.verify(t)}catch{o=await s.verify(t,!0)}let c={...e};if(t==="mfaSmsEnrollment"||t==="mfaSmsSignIn"){if("phoneEnrollmentInfo"in c){let l=c.phoneEnrollmentInfo.phoneNumber,a=c.phoneEnrollmentInfo.recaptchaToken;Object.assign(c,{phoneEnrollmentInfo:{phoneNumber:l,recaptchaToken:a,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}else if("phoneSignInInfo"in c){let l=c.phoneSignInInfo.recaptchaToken;Object.assign(c,{phoneSignInInfo:{recaptchaToken:l,captchaResponse:o,clientType:"CLIENT_TYPE_WEB",recaptchaVersion:"RECAPTCHA_ENTERPRISE"}})}return c}return i?Object.assign(c,{captchaResp:o}):Object.assign(c,{captchaResponse:o}),Object.assign(c,{clientType:"CLIENT_TYPE_WEB"}),Object.assign(c,{recaptchaVersion:"RECAPTCHA_ENTERPRISE"}),c}async function ee(n,e,t,i,r){if(r==="EMAIL_PASSWORD_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("EMAIL_PASSWORD_PROVIDER")){let s=await Ue(n,e,t,t==="getOobCode");return i(n,s)}else return i(n,e).catch(async s=>{if(s.code==="auth/missing-recaptcha-token"){console.log(`${t} is protected by reCAPTCHA Enterprise for this project. Automatically triggering the reCAPTCHA flow and restarting the flow.`);let o=await Ue(n,e,t,t==="getOobCode");return i(n,o)}else return Promise.reject(s)});else if(r==="PHONE_PROVIDER")if(n._getRecaptchaConfig()?.isProviderEnabled("PHONE_PROVIDER")){let s=await Ue(n,e,t);return i(n,s).catch(async o=>{if(n._getRecaptchaConfig()?.getProviderEnforcementState("PHONE_PROVIDER")==="AUDIT"&&(o.code==="auth/missing-recaptcha-token"||o.code==="auth/invalid-app-credential")){console.log(`Failed to verify with reCAPTCHA Enterprise. Automatically triggering the reCAPTCHA v2 flow to complete the ${t} flow.`);let c=await Ue(n,e,t,!1,!0);return i(n,c)}return Promise.reject(o)})}else{let s=await Ue(n,e,t,!1,!0);return i(n,s)}else return Promise.reject(r+" provider is not supported.")}async function ns(n){let e=b(n),t=await $r(e,{clientType:"CLIENT_TYPE_WEB",version:"RECAPTCHA_ENTERPRISE"}),i=new mt(t);e.tenantId==null?e._agentRecaptchaConfig=i:e._tenantRecaptchaConfigs[e.tenantId]=i,i.isAnyProviderEnabled()&&new ze(e).verify()}function di(n,e){let t=Le(n,"auth");if(t.isInitialized()){let r=t.getImmediate(),s=t.getOptions();if(Y(s,e??{}))return r;k(r,"already-initialized")}return t.initialize({options:e})}function lc(n,e){let t=e?.persistence||[],i=(Array.isArray(t)?t:[t]).map($);e?.errorMap&&n._updateErrorMap(e.errorMap),n._initializeWithPersistence(i,e?.popupRedirectResolver)}function hi(n,e,t){let i=b(n);u(/^https?:\/\//.test(e),i,"invalid-emulator-scheme");let r=!!t?.disableWarnings,s=is(e),{host:o,port:c}=uc(e),l=c===null?"":`:${c}`,a={url:`${s}//${o}${l}/`},d=Object.freeze({host:o,port:c,protocol:s.replace(":",""),options:Object.freeze({disableWarnings:r})});if(!i._canInitEmulator){u(i.config.emulator&&i.emulatorConfig,i,"emulator-config-failed"),u(Y(a,i.config.emulator)&&Y(d,i.emulatorConfig),i,"emulator-config-failed");return}i.config.emulator=a,i.emulatorConfig=d,i.settings.appVerificationDisabledForTesting=!0,tt(o)?$i(`${s}//${o}${l}`):r||dc()}function is(n){let e=n.indexOf(":");return e<0?"":n.substr(0,e+1)}function uc(n){let e=is(n),t=/(\/\/)?([^?#/]+)/.exec(n.substr(e.length));if(!t)return{host:"",port:null};let i=t[2].split("@").pop()||"",r=/^(\[[^\]]+\])(:|$)/.exec(i);if(r){let s=r[1];return{host:s,port:br(i.substr(s.length+1))}}else{let[s,o]=i.split(":");return{host:s,port:br(o)}}}function br(n){if(!n)return null;let e=Number(n);return isNaN(e)?null:e}function dc(){function n(){let e=document.createElement("p"),t=e.style;e.innerText="Running in emulator mode. Do not use with production credentials.",t.position="fixed",t.width="100%",t.backgroundColor="#ffffff",t.border=".1em solid #000000",t.color="#b50000",t.bottom="0px",t.left="0px",t.margin="0px",t.zIndex="10000",t.textAlign="center",e.classList.add("firebase-emulator-warning"),document.body.appendChild(e)}typeof console<"u"&&typeof console.info=="function"&&console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."),typeof window<"u"&&typeof document<"u"&&(document.readyState==="loading"?window.addEventListener("DOMContentLoaded",n):n())}async function rs(n,e){return _(n,"POST","/v1/accounts:resetPassword",g(n,e))}async function hc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function fc(n,e){return _(n,"POST","/v1/accounts:signUp",e)}async function pc(n,e){return _(n,"POST","/v1/accounts:update",g(n,e))}async function mc(n,e){return J(n,"POST","/v1/accounts:signInWithPassword",g(n,e))}async function Ht(n,e){return _(n,"POST","/v1/accounts:sendOobCode",g(n,e))}async function gc(n,e){return Ht(n,e)}async function _c(n,e){return Ht(n,e)}async function Ic(n,e){return Ht(n,e)}async function bc(n,e){return Ht(n,e)}async function Ec(n,e){return J(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function yc(n,e){return J(n,"POST","/v1/accounts:signInWithEmailLink",g(n,e))}async function j(n,e){return J(n,"POST","/v1/accounts:signInWithIdp",g(n,e))}async function Er(n,e){return _(n,"POST","/v1/accounts:sendVerificationCode",g(n,e))}async function Tc(n,e){return J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e))}async function vc(n,e){let t=await J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,e));if(t.temporaryProof)throw Fe(n,"account-exists-with-different-credential",t);return t}async function Sc(n,e){let t={...e,operation:"REAUTH"};return J(n,"POST","/v1/accounts:signInWithPhoneNumber",g(n,t),Ac)}function kc(n){switch(n){case"recoverEmail":return"RECOVER_EMAIL";case"resetPassword":return"PASSWORD_RESET";case"signIn":return"EMAIL_SIGNIN";case"verifyEmail":return"VERIFY_EMAIL";case"verifyAndChangeEmail":return"VERIFY_AND_CHANGE_EMAIL";case"revertSecondFactorAddition":return"REVERT_SECOND_FACTOR_ADDITION";default:return null}}function Rc(n){let e=me(ge(n)).link,t=e?me(ge(e)).deep_link_id:null,i=me(ge(n)).deep_link_id;return(i?me(ge(i)).link:null)||i||t||e||n}function ss(n){return ue.parseLink(n)}async function as(n,e){return J(n,"POST","/v1/accounts:signUp",g(n,e))}function yr(n){return n.providerId?n.providerId:"phoneNumber"in n?"phone":null}async function os(n){if(I(n.app))return Promise.reject(T(n));let e=b(n);if(await e._initializationPromise,e.currentUser?.isAnonymous)return new D({user:e.currentUser,providerId:null,operationType:"signIn"});let t=await as(e,{returnSecureToken:!0}),i=await D._fromIdTokenResponse(e,"signIn",t,!0);return await e._updateCurrentUser(i.user),i}function cs(n,e,t,i){return(e==="reauthenticate"?t._getReauthenticationResolver(n):t._getIdTokenResponse(n)).catch(s=>{throw s.code==="auth/multi-factor-auth-required"?Vn._fromErrorAndOperation(n,s,e,i):s})}function ls(n){return new Set(n.map(({providerId:e})=>e).filter(e=>!!e))}async function us(n,e){let t=p(n);await Wt(!0,t,e);let{providerUserInfo:i}=await qo(t.auth,{idToken:await t.getIdToken(),deleteProvider:[e]}),r=ls(i||[]);return t.providerData=t.providerData.filter(s=>r.has(s.providerId)),r.has("phone")||(t.phoneNumber=null),await t.auth._persistUserIfCurrent(t),t}async function fi(n,e,t=!1){let i=await q(n,e._linkToIdToken(n.auth,await n.getIdToken()),t);return D._forOperation(n,"link",i)}async function Wt(n,e,t){await je(e);let i=ls(e.providerData),r=n===!1?"provider-already-linked":"no-such-provider";u(i.has(t)===n,e.auth,r)}async function ds(n,e,t=!1){let{auth:i}=n;if(I(i.app))return Promise.reject(T(i));let r="reauthenticate";try{let s=await q(n,cs(i,r,e,n),t);u(s.idToken,i,"internal-error");let o=Vt(s.idToken);u(o,i,"internal-error");let{sub:c}=o;return u(n.uid===c,i,"user-mismatch"),D._forOperation(n,r,s)}catch(s){throw s?.code==="auth/user-not-found"&&k(i,"user-mismatch"),s}}async function hs(n,e,t=!1){if(I(n.app))return Promise.reject(T(n));let i="signIn",r=await cs(n,i,e),s=await D._fromIdTokenResponse(n,i,r);return t||await n._updateCurrentUser(s.user),s}async function Qe(n,e){return hs(b(n),e)}async function pi(n,e){let t=p(n);return await Wt(!1,t,e.providerId),fi(t,e)}async function mi(n,e){return ds(p(n),e)}async function Oc(n,e){return J(n,"POST","/v1/accounts:signInWithCustomToken",g(n,e))}async function fs(n,e){if(I(n.app))return Promise.reject(T(n));let t=b(n),i=await Oc(t,{token:e,returnSecureToken:!0}),r=await D._fromIdTokenResponse(t,"signIn",i);return await t._updateCurrentUser(r.user),r}function Bt(n,e,t){u(t.url?.length>0,n,"invalid-continue-uri"),u(typeof t.dynamicLinkDomain>"u"||t.dynamicLinkDomain.length>0,n,"invalid-dynamic-link-domain"),u(typeof t.linkDomain>"u"||t.linkDomain.length>0,n,"invalid-hosting-link-domain"),e.continueUrl=t.url,e.dynamicLinkDomain=t.dynamicLinkDomain,e.linkDomain=t.linkDomain,e.canHandleCodeInApp=t.handleCodeInApp,t.iOS&&(u(t.iOS.bundleId.length>0,n,"missing-ios-bundle-id"),e.iOSBundleId=t.iOS.bundleId),t.android&&(u(t.android.packageName.length>0,n,"missing-android-pkg-name"),e.androidInstallApp=t.android.installApp,e.androidMinimumVersionCode=t.android.minimumVersion,e.androidPackageName=t.android.packageName)}async function gi(n){let e=b(n);e._getPasswordPolicyInternal()&&await e._updatePasswordPolicy()}async function ps(n,e,t){let i=b(n),r={requestType:"PASSWORD_RESET",email:e,clientType:"CLIENT_TYPE_WEB"};t&&Bt(i,r,t),await ee(i,r,"getOobCode",_c,"EMAIL_PASSWORD_PROVIDER")}async function ms(n,e,t){await rs(p(n),{oobCode:e,newPassword:t}).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&gi(n),i})}async function gs(n,e){await pc(p(n),{oobCode:e})}async function _i(n,e){let t=p(n),i=await rs(t,{oobCode:e}),r=i.requestType;switch(u(r,t,"internal-error"),r){case"EMAIL_SIGNIN":break;case"VERIFY_AND_CHANGE_EMAIL":u(i.newEmail,t,"internal-error");break;case"REVERT_SECOND_FACTOR_ADDITION":u(i.mfaInfo,t,"internal-error");default:u(i.email,t,"internal-error")}let s=null;return i.mfaInfo&&(s=de._fromServerResponse(b(t),i.mfaInfo)),{data:{email:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.newEmail:i.email)||null,previousEmail:(i.requestType==="VERIFY_AND_CHANGE_EMAIL"?i.email:i.newEmail)||null,multiFactorInfo:s},operation:r}}async function _s(n,e){let{data:t}=await _i(p(n),e);return t.email}async function Is(n,e,t){if(I(n.app))return Promise.reject(T(n));let i=b(n),o=await ee(i,{returnSecureToken:!0,email:e,password:t,clientType:"CLIENT_TYPE_WEB"},"signUpPassword",as,"EMAIL_PASSWORD_PROVIDER").catch(l=>{throw l.code==="auth/password-does-not-meet-requirements"&&gi(n),l}),c=await D._fromIdTokenResponse(i,"signIn",o);return await i._updateCurrentUser(c.user),c}function bs(n,e,t){return I(n.app)?Promise.reject(T(n)):Qe(p(n),K.credential(e,t)).catch(async i=>{throw i.code==="auth/password-does-not-meet-requirements"&&gi(n),i})}async function Es(n,e,t){let i=b(n),r={requestType:"EMAIL_SIGNIN",email:e,clientType:"CLIENT_TYPE_WEB"};function s(o,c){u(c.handleCodeInApp,i,"argument-error"),c&&Bt(i,o,c)}s(r,t),await ee(i,r,"getOobCode",Ic,"EMAIL_PASSWORD_PROVIDER")}function ys(n,e){return ue.parseLink(e)?.operation==="EMAIL_SIGNIN"}async function ws(n,e,t){if(I(n.app))return Promise.reject(T(n));let i=p(n),r=K.credentialWithLink(e,t||Be());return u(r._tenantId===(i.tenantId||null),i,"tenant-id-mismatch"),Qe(i,r)}async function Nc(n,e){return _(n,"POST","/v1/accounts:createAuthUri",g(n,e))}async function Ts(n,e){let t=si()?Be():"http://localhost",i={identifier:e,continueUri:t},{signinMethods:r}=await Nc(p(n),i);return r||[]}async function vs(n,e){let t=p(n),r={requestType:"VERIFY_EMAIL",idToken:await n.getIdToken()};e&&Bt(t.auth,r,e);let{email:s}=await gc(t.auth,r);s!==n.email&&await n.reload()}async function As(n,e,t){let i=p(n),s={requestType:"VERIFY_AND_CHANGE_EMAIL",idToken:await n.getIdToken(),newEmail:e};t&&Bt(i.auth,s,t);let{email:o}=await bc(i.auth,s);o!==n.email&&await n.reload()}async function Dc(n,e){return _(n,"POST","/v1/accounts:update",e)}async function Ss(n,{displayName:e,photoURL:t}){if(e===void 0&&t===void 0)return;let i=p(n),s={idToken:await i.getIdToken(),displayName:e,photoUrl:t,returnSecureToken:!0},o=await q(i,Dc(i.auth,s));i.displayName=o.displayName||null,i.photoURL=o.photoUrl||null;let c=i.providerData.find(({providerId:l})=>l==="password");c&&(c.displayName=i.displayName,c.photoURL=i.photoURL),await i._updateTokensIfNecessary(o)}function ks(n,e){let t=p(n);return I(t.auth.app)?Promise.reject(T(t.auth)):Cs(t,e,null)}function Rs(n,e){return Cs(p(n),null,e)}async function Cs(n,e,t){let{auth:i}=n,s={idToken:await n.getIdToken(),returnSecureToken:!0};e&&(s.email=e),t&&(s.password=t);let o=await q(n,hc(i,s));await n._updateTokensIfNecessary(o,!0)}function Lc(n){if(!n)return null;let{providerId:e}=n,t=n.rawUserInfo?JSON.parse(n.rawUserInfo):{},i=n.isNewUser||n.kind==="identitytoolkit#SignupNewUserResponse";if(!e&&n?.idToken){let r=Vt(n.idToken)?.firebase?.sign_in_provider;if(r){let s=r!=="anonymous"&&r!=="custom"?r:null;return new te(i,s)}}if(!e)return null;switch(e){case"facebook.com":return new Bn(i,t);case"github.com":return new $n(i,t);case"google.com":return new jn(i,t);case"twitter.com":return new zn(i,t,n.screenName||null);case"custom":case"anonymous":return new te(i,null);default:return new te(i,e,t)}}function Ps(n){let{user:e,_tokenResponse:t}=n;return e.isAnonymous&&!t?{providerId:null,isNewUser:!1,profile:null}:Lc(t)}function Os(n,e){return p(n).setPersistence(e)}function Ns(n){return ns(n)}async function Ds(n,e){return b(n).validatePassword(e)}function Ii(n,e,t,i){return p(n).onIdTokenChanged(e,t,i)}function bi(n,e,t){return p(n).beforeAuthStateChanged(e,t)}function Ls(n,e,t,i){return p(n).onAuthStateChanged(e,t,i)}function Ms(n){p(n).useDeviceLanguage()}function Us(n,e){return p(n).updateCurrentUser(e)}function Fs(n){return p(n).signOut()}function xs(n,e){return b(n).revokeAccessToken(e)}async function Vs(n){return p(n).delete()}function Hs(n,e){let t=p(n),i=e;return u(e.customData.operationType,t,"argument-error"),u(i.customData._serverResponse?.mfaPendingCredential,t,"argument-error"),qn._fromError(t,i)}function wr(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Mc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function Uc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:start",g(n,e))}function Fc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:finalize",g(n,e))}function xc(n,e){return _(n,"POST","/v2/accounts/mfaEnrollment:withdraw",g(n,e))}function Ws(n){let e=p(n);return vn.has(e)||vn.set(e,Gn._fromUser(e)),vn.get(e)}function An(n){let e=n.replace(/[\\^$.*+?()[\]{}|]/g,"\\$&"),t=RegExp(`${e}=([^;]+)`);return document.cookie.match(t)?.[1]??null}function Sn(n){return`${window.location.protocol==="http:"?"__dev_":"__HOST-"}FIREBASE_${n.split(":")[3]}`}function Bc(n){return Promise.all(n.map(async e=>{try{return{fulfilled:!0,value:await e}}catch(t){return{fulfilled:!1,reason:t}}}))}function jt(n="",e=10){let t="";for(let i=0;i<e;i++)t+=Math.floor(Math.random()*10);return n+t}function y(){return window}function $c(n){y().location.href=n}function yi(){return typeof y().WorkerGlobalScope<"u"&&typeof y().importScripts=="function"}async function jc(){if(!navigator?.serviceWorker)return null;try{return(await navigator.serviceWorker.ready).active}catch{return null}}function zc(){return navigator?.serviceWorker?.controller||null}function qc(){return yi()?self:null}function zt(n,e){return n.transaction([Nt],e?"readwrite":"readonly").objectStore(Nt)}function Kc(){let n=indexedDB.deleteDatabase($s);return new he(n).toPromise()}function zs(){let n=indexedDB.open($s,Gc);return new Promise((e,t)=>{n.addEventListener("error",()=>{t(n.error)}),n.addEventListener("upgradeneeded",()=>{let i=n.result;try{i.createObjectStore(Nt,{keyPath:js})}catch(r){t(r)}}),n.addEventListener("success",async()=>{let i=n.result;i.objectStoreNames.contains(Nt)?e(i):(i.close(),await Kc(),e(await zs()))})})}async function Tr(n,e,t){let i=zt(n,!0).put({[js]:e,value:t});return new he(i).toPromise()}async function Jc(n,e){let t=zt(n,!1).get(e),i=await new he(t).toPromise();return i===void 0?null:i.value}function vr(n,e){let t=zt(n,!0).delete(e);return new he(t).toPromise()}function Ar(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:start",g(n,e))}function Qc(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function Zc(n,e){return _(n,"POST","/v2/accounts/mfaSignIn:finalize",g(n,e))}function tl(n){return n.length<=6&&/^\s*[a-zA-Z0-9\-]*\s*$/.test(n)}function il(){let n=null;return new Promise(e=>{if(document.readyState==="complete"){e();return}n=()=>e(),window.addEventListener("load",n)}).catch(e=>{throw n&&window.removeEventListener("load",n),e})}async function qs(n,e,t){if(I(n.app))return Promise.reject(T(n));let i=b(n),r=await qt(i,e,p(t));return new qe(r,s=>Qe(i,s))}async function Gs(n,e,t){let i=p(n);await Wt(!1,i,"phone");let r=await qt(i.auth,e,p(t));return new qe(r,s=>pi(i,s))}async function Ks(n,e,t){let i=p(n);if(I(i.auth.app))return Promise.reject(T(i.auth));let r=await qt(i.auth,e,p(t));return new qe(r,s=>mi(i,s))}async function qt(n,e,t){if(!n._getRecaptchaConfig())try{await ns(n)}catch{console.log("Failed to initialize reCAPTCHA Enterprise config. Triggering the reCAPTCHA v2 verification.")}try{let i;if(typeof e=="string"?i={phoneNumber:e}:i=e,"session"in i){let r=i.session;if("phoneNumber"in i){u(r.type==="enroll",n,"internal-error");let s={idToken:r.credential,phoneEnrollmentInfo:{phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"}};return(await ee(n,s,"mfaSmsEnrollment",async(a,d)=>{if(d.phoneEnrollmentInfo.captchaResponse===He){u(t?.type===We,a,"argument-error");let h=await Rn(a,d,t);return wr(a,h)}return wr(a,d)},"PHONE_PROVIDER").catch(a=>Promise.reject(a))).phoneSessionInfo.sessionInfo}else{u(r.type==="signin",n,"internal-error");let s=i.multiFactorHint?.uid||i.multiFactorUid;u(s,n,"missing-multi-factor-info");let o={mfaPendingCredential:r.credential,mfaEnrollmentId:s,phoneSignInInfo:{clientType:"CLIENT_TYPE_WEB"}};return(await ee(n,o,"mfaSmsSignIn",async(d,h)=>{if(h.phoneSignInInfo.captchaResponse===He){u(t?.type===We,d,"argument-error");let f=await Rn(d,h,t);return Ar(d,f)}return Ar(d,h)},"PHONE_PROVIDER").catch(d=>Promise.reject(d))).phoneResponseInfo.sessionInfo}}else{let r={phoneNumber:i.phoneNumber,clientType:"CLIENT_TYPE_WEB"};return(await ee(n,r,"sendVerificationCode",async(l,a)=>{if(a.captchaResponse===He){u(t?.type===We,l,"argument-error");let d=await Rn(l,a,t);return Er(l,d)}return Er(l,a)},"PHONE_PROVIDER").catch(l=>Promise.reject(l))).sessionInfo}}finally{t?._reset()}}async function Js(n,e){let t=p(n);if(I(t.auth.app))return Promise.reject(T(t.auth));await fi(t,e)}async function Rn(n,e,t){u(t.type===We,n,"argument-error");let i=await t.verify();u(typeof i=="string",n,"argument-error");let r={...e};if("phoneEnrollmentInfo"in r){let s=r.phoneEnrollmentInfo.phoneNumber,o=r.phoneEnrollmentInfo.captchaResponse,c=r.phoneEnrollmentInfo.clientType,l=r.phoneEnrollmentInfo.recaptchaVersion;return Object.assign(r,{phoneEnrollmentInfo:{phoneNumber:s,recaptchaToken:i,captchaResponse:o,clientType:c,recaptchaVersion:l}}),r}else if("phoneSignInInfo"in r){let s=r.phoneSignInInfo.captchaResponse,o=r.phoneSignInInfo.clientType,c=r.phoneSignInInfo.recaptchaVersion;return Object.assign(r,{phoneSignInInfo:{recaptchaToken:i,captchaResponse:s,clientType:o,recaptchaVersion:c}}),r}else return Object.assign(r,{recaptchaToken:i}),r}function fe(n,e){return e?$(e):(u(n._popupRedirectResolver,n,"argument-error"),n._popupRedirectResolver)}function rl(n){return hs(n.auth,new Ge(n),n.bypassAuthState)}function sl(n){let{auth:e,user:t}=n;return u(t,e,"internal-error"),ds(t,new Ge(n),n.bypassAuthState)}async function al(n){let{auth:e,user:t}=n;return u(t,e,"internal-error"),fi(t,new Ge(n),n.bypassAuthState)}async function Ys(n,e,t){if(I(n.app))return Promise.reject(S(n,"operation-not-supported-in-this-environment"));let i=b(n);Re(n,e,N);let r=fe(i,t);return new ke(i,"signInViaPopup",e,r).executeNotNull()}async function Xs(n,e,t){let i=p(n);if(I(i.auth.app))return Promise.reject(S(i.auth,"operation-not-supported-in-this-environment"));Re(i.auth,e,N);let r=fe(i.auth,t);return new ke(i.auth,"reauthViaPopup",e,r,i).executeNotNull()}async function Qs(n,e,t){let i=p(n);Re(i.auth,e,N);let r=fe(i.auth,t);return new ke(i.auth,"linkViaPopup",e,r,i).executeNotNull()}async function ll(n,e){let t=ea(e),i=Zs(n);if(!await i._isAvailable())return!1;let r=await i._get(t)==="true";return await i._remove(t),r}async function Ti(n,e){return Zs(n)._set(ea(e),"true")}function ul(n,e){dt.set(n._key(),e)}function Zs(n){return $(n._redirectPersistence)}function ea(n){return ut(cl,n.config.apiKey,n.name)}function ta(n,e,t){return dl(n,e,t)}async function dl(n,e,t){if(I(n.app))return Promise.reject(T(n));let i=b(n);Re(n,e,N),await i._initializationPromise;let r=fe(i,t);return await Ti(r,i),r._openRedirect(i,e,"signInViaRedirect")}function na(n,e,t){return hl(n,e,t)}async function hl(n,e,t){let i=p(n);if(Re(i.auth,e,N),I(i.auth.app))return Promise.reject(T(i.auth));await i.auth._initializationPromise;let r=fe(i.auth,t);await Ti(r,i.auth);let s=await aa(i);return r._openRedirect(i.auth,e,"reauthViaRedirect",s)}function ia(n,e,t){return fl(n,e,t)}async function fl(n,e,t){let i=p(n);Re(i.auth,e,N),await i.auth._initializationPromise;let r=fe(i.auth,t);await Wt(!1,i,e.providerId),await Ti(r,i.auth);let s=await aa(i);return r._openRedirect(i.auth,e,"linkViaRedirect",s)}async function ra(n,e){return await b(n)._initializationPromise,sa(n,e,!1)}async function sa(n,e,t=!1){if(I(n.app))return Promise.reject(T(n));let i=b(n),r=fe(i,e),o=await new Xn(i,r,t).execute();return o&&!t&&(delete o.user._redirectEventId,await i._persistUserIfCurrent(o.user),await i._setRedirectUser(null,e)),o}async function aa(n){let e=jt(`${n.uid}:::`);return n._redirectEventId=e,await n.auth._setRedirectUser(n),await n.auth._persistUserIfCurrent(n),e}function Sr(n){return[n.type,n.eventId,n.sessionId,n.tenantId].filter(e=>e).join("-")}function oa({type:n,error:e}){return n==="unknown"&&e?.code==="auth/no-auth-event"}function ml(n){switch(n.type){case"signInViaRedirect":case"linkViaRedirect":case"reauthViaRedirect":return!0;case"unknown":return oa(n);default:return!1}}async function gl(n,e={}){return _(n,"GET","/v1/projects",e)}async function bl(n){if(n.config.emulator)return;let{authorizedDomains:e}=await gl(n);for(let t of e)try{if(El(t))return}catch{}k(n,"unauthorized-domain")}function El(n){let e=Be(),{protocol:t,hostname:i}=new URL(e);if(n.startsWith("chrome-extension://")){let o=new URL(n);return o.hostname===""&&i===""?t==="chrome-extension:"&&n.replace("chrome-extension://","")===e.replace("chrome-extension://",""):t==="chrome-extension:"&&o.hostname===i}if(!Il.test(t))return!1;if(_l.test(n))return i===n;let r=n.replace(/\./g,"\\.");return new RegExp("^(.+\\."+r+"|"+r+")$","i").test(i)}function kr(){let n=y().___jsl;if(n?.H){for(let e of Object.keys(n.H))if(n.H[e].r=n.H[e].r||[],n.H[e].L=n.H[e].L||[],n.H[e].r=[...n.H[e].L],n.CP)for(let t=0;t<n.CP.length;t++)n.CP[t]=null}}function wl(n){return new Promise((e,t)=>{function i(){kr(),gapi.load("gapi.iframes",{callback:()=>{e(gapi.iframes.getContext())},ontimeout:()=>{kr(),t(S(n,"network-request-failed"))},timeout:yl.get()})}if(y().gapi?.iframes?.Iframe)e(gapi.iframes.getContext());else if(y().gapi?.load)i();else{let r=ts("iframefcb");return y()[r]=()=>{gapi.load?i():t(S(n,"network-request-failed"))},ui(`${rc()}?onload=${r}`).catch(s=>t(s))}}).catch(e=>{throw ht=null,e})}function Tl(n){return ht=ht||wl(n),ht}function Cl(n){let e=n.config;u(e.authDomain,n,"auth-domain-config-required");let t=e.emulator?ai(e,Sl):`https://${n.config.authDomain}/${Al}`,i={apiKey:e.apiKey,appName:n.name,v:oe},r=Rl.get(n.config.apiHost);r&&(i.eid=r);let s=n._getFrameworks();return s.length&&(i.fw=s.join(",")),`${t}?${re(i).slice(1)}`}async function Pl(n){let e=await Tl(n),t=y().gapi;return u(t,n,"internal-error"),e.open({where:document.body,url:Cl(n),messageHandlersFilter:t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,attributes:kl,dontclear:!0},i=>new Promise(async(r,s)=>{await i.restyle({setHideOnLeave:!1});let o=S(n,"network-request-failed"),c=y().setTimeout(()=>{s(o)},vl.get());function l(){y().clearTimeout(c),r(i)}i.ping(l).then(l,()=>{s(o)})}))}function Ul(n,e,t,i=Nl,r=Dl){let s=Math.max((window.screen.availHeight-r)/2,0).toString(),o=Math.max((window.screen.availWidth-i)/2,0).toString(),c="",l={...Ol,width:i.toString(),height:r.toString(),top:s,left:o},a=v().toLowerCase();t&&(c=Kr(a)?Ll:t),qr(a)&&(e=e||Ml,l.scrollbars="yes");let d=Object.entries(l).reduce((f,[A,L])=>`${f}${A}=${L},`,"");if(Xo(a)&&c!=="_self")return Fl(e||"",c),new Ut(null);let h=window.open(e||"",c,d);u(h,n,"popup-blocked");try{h.focus()}catch{}return new Ut(h)}function Fl(n,e){let t=document.createElement("a");t.href=n,t.target=e;let i=document.createEvent("MouseEvent");i.initMouseEvent("click",!0,!0,window,1,0,0,0,0,!1,!1,!1,!1,1,null),t.dispatchEvent(i)}async function Rr(n,e,t,i,r,s){u(n.config.authDomain,n,"auth-domain-config-required"),u(n.config.apiKey,n,"invalid-api-key");let o={apiKey:n.config.apiKey,appName:n.name,authType:t,redirectUrl:i,v:oe,eventId:r};if(e instanceof N){e.setDefaultLanguage(n.languageCode),o.providerId=e.providerId||"",Wi(e.getCustomParameters())||(o.customParameters=JSON.stringify(e.getCustomParameters()));for(let[d,h]of Object.entries(s||{}))o[d]=h}if(e instanceof ne){let d=e.getScopes().filter(h=>h!=="");d.length>0&&(o.scopes=d.join(","))}n.tenantId&&(o.tid=n.tenantId);let c=o;for(let d of Object.keys(c))c[d]===void 0&&delete c[d];let l=await n._getAppCheckToken(),a=l?`#${Hl}=${encodeURIComponent(l)}`:"";return`${Wl(n)}?${re(c).slice(1)}${a}`}function Wl({config:n}){return n.emulator?ai(n,Vl):`https://${n.authDomain}/${xl}`}function ct(n){return typeof n>"u"||n?.length===0}function Bl(n){switch(n){case"Node":return"node";case"ReactNative":return"rn";case"Worker":return"webworker";case"Cordova":return"cordova";case"WebExtension":return"web-extension";default:return}}function $l(n){ae(new U("auth",(e,{options:t})=>{let i=e.getProvider("app").getImmediate(),r=e.getProvider("heartbeat"),s=e.getProvider("app-check-internal"),{apiKey:o,authDomain:c}=i.options;u(o&&!o.includes(":"),"invalid-api-key",{appName:i.name});let l={apiKey:o,authDomain:c,clientPlatform:n,apiHost:"identitytoolkit.googleapis.com",tokenApiHost:"securetoken.googleapis.com",apiScheme:"https",sdkClientVersion:es(n)},a=new Ln(i,r,s,l);return lc(a,t),a},"PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e,t,i)=>{e.getProvider("auth-internal").initialize()})),ae(new U("auth-internal",e=>{let t=b(e.getProvider("auth").getImmediate());return(i=>new ti(i))(t)},"PRIVATE").setInstantiationMode("EXPLICIT")),x(Cr,Pr,Bl(n)),x(Cr,Pr,"esm2020")}function ca(n=wn()){let e=Le(n,"auth");if(e.isInitialized())return e.getImmediate();let t=di(n,{popupRedirectResolver:vi,persistence:[wi,Ei,$t]}),i=rn("authTokenSyncURL");if(i&&typeof isSecureContext=="boolean"&&isSecureContext){let s=new URL(i,location.origin);if(location.origin===s.origin){let o=ql(s.toString());bi(t,o,()=>o(t.currentUser)),Ii(t,c=>o(c))}}let r=Ni("auth");return r&&hi(t,`http://${r}`),t}function Gl(){return document.getElementsByTagName("head")?.[0]??document}var Nr,Dr,Lr,Mr,Ur,xr,ni,Vr,Hr,ft,ce,pt,Ho,Wo,Bo,Pn,mt,On,$e,Ve,Z,gr,_t,It,bt,Nn,ec,Dn,Ln,Et,Xe,sc,ac,ot,Mn,Un,Fn,xn,cc,He,Ir,ze,G,ye,wc,H,Ac,le,ue,K,N,ne,yt,we,Te,ve,Cc,wt,Pc,Tt,Ae,D,Vn,de,Hn,Wn,te,vt,Bn,$n,jn,zn,At,qn,Gn,vn,St,kt,Vc,Hc,Rt,Ei,Wc,Ct,Bs,Pt,$t,Ot,Kn,$s,Gc,Nt,js,he,Yc,Xc,Dt,wi,kn,el,Jn,Yn,We,nl,Lt,qe,Se,Ge,Mt,ol,ke,cl,dt,Xn,pl,Qn,_l,Il,yl,ht,vl,Al,Sl,kl,Rl,Ol,Nl,Dl,Ll,Ml,Ut,xl,Vl,Hl,Cn,Zn,vi,Ft,ei,Ke,Je,xt,Ye,Cr,Pr,ti,jl,zl,Or,ql,la=O(()=>{Me();_e();it();nt();Nr={PHONE:"phone",TOTP:"totp"},Dr={FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PASSWORD:"password",PHONE:"phone",TWITTER:"twitter.com"},Lr={EMAIL_LINK:"emailLink",EMAIL_PASSWORD:"password",FACEBOOK:"facebook.com",GITHUB:"github.com",GOOGLE:"google.com",PHONE:"phone",TWITTER:"twitter.com"},Mr={LINK:"link",REAUTHENTICATE:"reauthenticate",SIGN_IN:"signIn"},Ur={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"};xr=Uo,ni=Fr,Vr=new W("auth","Firebase",Fr()),Hr={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"};ft=new Ie("@firebase/auth");ce=class{constructor(e,t){this.shortDelay=e,this.longDelay=t,z(t>e,"Short delay should be less than long delay!"),this.isMobile=Di()||Fi()}get(){return xo()?this.isMobile?this.longDelay:this.shortDelay:Math.min(5e3,this.shortDelay)}};pt=class{static initialize(e,t,i){this.fetchImpl=e,t&&(this.headersImpl=t),i&&(this.responseImpl=i)}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;V("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;V("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;V("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill")}};Ho={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"};Wo=["/v1/accounts:signInWithCustomToken","/v1/accounts:signInWithEmailLink","/v1/accounts:signInWithIdp","/v1/accounts:signInWithPassword","/v1/accounts:signInWithPhoneNumber","/v1/token"],Bo=new ce(3e4,6e4);Pn=class{clearNetworkTimeout(){clearTimeout(this.timer)}constructor(e){this.auth=e,this.timer=null,this.promise=new Promise((t,i)=>{this.timer=setTimeout(()=>i(S(this.auth,"network-request-failed")),Bo.get())})}};mt=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 t of this.recaptchaEnforcementState)if(t.provider&&t.provider===e)return $o(t.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")}};On=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 t=this.errorBackoff;return this.errorBackoff=Math.min(this.errorBackoff*2,96e4),t}else{this.errorBackoff=3e4;let i=(this.user.stsTokenManager.expirationTime??0)-Date.now()-3e5;return Math.max(0,i)}}schedule(e=!1){if(!this.isRunning)return;let t=this.getInterval(e);this.timerId=setTimeout(async()=>{await this.iteration()},t)}async iteration(){try{await this.user.getIdToken(!0)}catch(e){e?.code==="auth/network-request-failed"&&this.schedule(!0);return}this.schedule()}};$e=class{constructor(e,t){this.createdAt=e,this.lastLoginAt=t,this._initializeTime()}_initializeTime(){this.lastSignInTime=xe(this.lastLoginAt),this.creationTime=xe(this.createdAt)}_copy(e){this.createdAt=e.createdAt,this.lastLoginAt=e.lastLoginAt,this._initializeTime()}toJSON(){return{createdAt:this.createdAt,lastLoginAt:this.lastLoginAt}}};Ve=class n{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 t="expiresIn"in e&&typeof e.expiresIn<"u"?Number(e.expiresIn):mr(e.idToken);this.updateTokensAndExpiration(e.idToken,e.refreshToken,t)}updateFromIdToken(e){u(e.length!==0,"internal-error");let t=mr(e);this.updateTokensAndExpiration(e,null,t)}async getToken(e,t=!1){return!t&&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,t){let{accessToken:i,refreshToken:r,expiresIn:s}=await Jo(e,t);this.updateTokensAndExpiration(i,r,Number(s))}updateTokensAndExpiration(e,t,i){this.refreshToken=t||null,this.accessToken=e||null,this.expirationTime=Date.now()+i*1e3}static fromJSON(e,t){let{refreshToken:i,accessToken:r,expirationTime:s}=t,o=new n;return i&&(u(typeof i=="string","internal-error",{appName:e}),o.refreshToken=i),r&&(u(typeof r=="string","internal-error",{appName:e}),o.accessToken=r),s&&(u(typeof s=="number","internal-error",{appName:e}),o.expirationTime=s),o}toJSON(){return{refreshToken:this.refreshToken,accessToken:this.accessToken,expirationTime:this.expirationTime}}_assign(e){this.accessToken=e.accessToken,this.refreshToken=e.refreshToken,this.expirationTime=e.expirationTime}_clone(){return Object.assign(new n,this.toJSON())}_performRefresh(){return V("not implemented")}};Z=class n{constructor({uid:e,auth:t,stsTokenManager:i,...r}){this.providerId="firebase",this.proactiveRefresh=new On(this),this.reloadUserInfo=null,this.reloadListener=null,this.uid=e,this.auth=t,this.stsTokenManager=i,this.accessToken=i.accessToken,this.displayName=r.displayName||null,this.email=r.email||null,this.emailVerified=r.emailVerified||!1,this.phoneNumber=r.phoneNumber||null,this.photoURL=r.photoURL||null,this.isAnonymous=r.isAnonymous||!1,this.tenantId=r.tenantId||null,this.providerData=r.providerData?[...r.providerData]:[],this.metadata=new $e(r.createdAt||void 0,r.lastLoginAt||void 0)}async getIdToken(e){let t=await q(this,this.stsTokenManager.getToken(this.auth,e));return u(t,this.auth,"internal-error"),this.accessToken!==t&&(this.accessToken=t,await this.auth._persistUserIfCurrent(this),this.auth._notifyListenersIfCurrent(this)),t}getIdTokenResult(e){return oi(this,e)}reload(){return ci(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(t=>({...t})),this.metadata._copy(e.metadata),this.stsTokenManager._assign(e.stsTokenManager))}_clone(e){let t=new n({...this,auth:e,stsTokenManager:this.stsTokenManager._clone()});return t.metadata._copy(this.metadata),t}_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,t=!1){let i=!1;e.idToken&&e.idToken!==this.stsTokenManager.accessToken&&(this.stsTokenManager.updateFromServerResponse(e),i=!0),t&&await je(this),await this.auth._persistUserIfCurrent(this),i&&this.auth._notifyListenersIfCurrent(this)}async delete(){if(I(this.auth.app))return Promise.reject(T(this.auth));let e=await this.getIdToken();return await q(this,zo(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,t){let i=t.displayName??void 0,r=t.email??void 0,s=t.phoneNumber??void 0,o=t.photoURL??void 0,c=t.tenantId??void 0,l=t._redirectEventId??void 0,a=t.createdAt??void 0,d=t.lastLoginAt??void 0,{uid:h,emailVerified:f,isAnonymous:A,providerData:L,stsTokenManager:ie}=t;u(h&&ie,e,"internal-error");let M=Ve.fromJSON(this.name,ie);u(typeof h=="string",e,"internal-error"),Q(i,e.name),Q(r,e.name),u(typeof f=="boolean",e,"internal-error"),u(typeof A=="boolean",e,"internal-error"),Q(s,e.name),Q(o,e.name),Q(c,e.name),Q(l,e.name),Q(a,e.name),Q(d,e.name);let Xt=new n({uid:h,auth:e,email:r,emailVerified:f,displayName:i,isAnonymous:A,photoURL:o,phoneNumber:s,tenantId:c,stsTokenManager:M,createdAt:a,lastLoginAt:d});return L&&Array.isArray(L)&&(Xt.providerData=L.map(ga=>({...ga}))),l&&(Xt._redirectEventId=l),Xt}static async _fromIdTokenResponse(e,t,i=!1){let r=new Ve;r.updateFromServerResponse(t);let s=new n({uid:t.localId,auth:e,stsTokenManager:r,isAnonymous:i});return await je(s),s}static async _fromGetAccountInfoResponse(e,t,i){let r=t.users[0];u(r.localId!==void 0,"internal-error");let s=r.providerUserInfo!==void 0?zr(r.providerUserInfo):[],o=!(r.email&&r.passwordHash)&&!s?.length,c=new Ve;c.updateFromIdToken(i);let l=new n({uid:r.localId,auth:e,stsTokenManager:c,isAnonymous:o}),a={uid:r.localId,displayName:r.displayName||null,photoURL:r.photoUrl||null,email:r.email||null,emailVerified:r.emailVerified||!1,phoneNumber:r.phoneNumber||null,tenantId:r.tenantId||null,providerData:s,metadata:new $e(r.createdAt,r.lastLoginAt),isAnonymous:!(r.email&&r.passwordHash)&&!s?.length};return Object.assign(l,a),l}};gr=new Map;_t=class{constructor(){this.type="NONE",this.storage={}}async _isAvailable(){return!0}async _set(e,t){this.storage[e]=t}async _get(e){let t=this.storage[e];return t===void 0?null:t}async _remove(e){delete this.storage[e]}_addListener(e,t){}_removeListener(e,t){}};_t.type="NONE";It=_t;bt=class n{constructor(e,t,i){this.persistence=e,this.auth=t,this.userKey=i;let{config:r,name:s}=this.auth;this.fullUserKey=ut(this.userKey,r.apiKey,s),this.fullPersistenceKey=ut("persistence",r.apiKey,s),this.boundEventHandler=t._onStorageEvent.bind(t),this.persistence._addListener(this.fullUserKey,this.boundEventHandler)}setCurrentUser(e){return this.persistence._set(this.fullUserKey,e.toJSON())}async getCurrentUser(){let e=await this.persistence._get(this.fullUserKey);if(!e)return null;if(typeof e=="string"){let t=await gt(this.auth,{idToken:e}).catch(()=>{});return t?Z._fromGetAccountInfoResponse(this.auth,t,e):null}return Z._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 t=await this.getCurrentUser();if(await this.removeCurrentUser(),this.persistence=e,t)return this.setCurrentUser(t)}delete(){this.persistence._removeListener(this.fullUserKey,this.boundEventHandler)}static async create(e,t,i="authUser"){if(!t.length)return new n($(It),e,i);let r=(await Promise.all(t.map(async a=>{if(await a._isAvailable())return a}))).filter(a=>a),s=r[0]||$(It),o=ut(i,e.config.apiKey,e.name),c=null;for(let a of t)try{let d=await a._get(o);if(d){let h;if(typeof d=="string"){let f=await gt(e,{idToken:d}).catch(()=>{});if(!f)break;h=await Z._fromGetAccountInfoResponse(e,f,d)}else h=Z._fromJSON(e,d);a!==s&&(c=h),s=a;break}}catch{}let l=r.filter(a=>a._shouldAllowMigration);return!s._shouldAllowMigration||!l.length?new n(s,e,i):(s=l[0],c&&await s._set(o,c.toJSON()),await Promise.all(t.map(async a=>{if(a!==s)try{await a._remove(o)}catch{}})),new n(s,e,i))}};Nn=class{constructor(e){this.auth=e,this.queue=[]}pushCallback(e,t){let i=s=>new Promise((o,c)=>{try{let l=e(s);o(l)}catch(l){c(l)}});i.onAbort=t,this.queue.push(i);let r=this.queue.length-1;return()=>{this.queue[r]=()=>Promise.resolve()}}async runMiddleware(e){if(this.auth.currentUser===e)return;let t=[];try{for(let i of this.queue)await i(e),i.onAbort&&t.push(i.onAbort)}catch(i){t.reverse();for(let r of t)try{r()}catch{}throw this.auth._errorFactory.create("login-blocked",{originalMessage:i?.message})}}};ec=6,Dn=class{constructor(e){let t=e.customStrengthOptions;this.customStrengthOptions={},this.customStrengthOptions.minPasswordLength=t.minPasswordLength??ec,t.maxPasswordLength&&(this.customStrengthOptions.maxPasswordLength=t.maxPasswordLength),t.containsLowercaseCharacter!==void 0&&(this.customStrengthOptions.containsLowercaseLetter=t.containsLowercaseCharacter),t.containsUppercaseCharacter!==void 0&&(this.customStrengthOptions.containsUppercaseLetter=t.containsUppercaseCharacter),t.containsNumericCharacter!==void 0&&(this.customStrengthOptions.containsNumericCharacter=t.containsNumericCharacter),t.containsNonAlphanumericCharacter!==void 0&&(this.customStrengthOptions.containsNonAlphanumericCharacter=t.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 t={isValid:!0,passwordPolicy:this};return this.validatePasswordLengthOptions(e,t),this.validatePasswordCharacterOptions(e,t),t.isValid&&(t.isValid=t.meetsMinPasswordLength??!0),t.isValid&&(t.isValid=t.meetsMaxPasswordLength??!0),t.isValid&&(t.isValid=t.containsLowercaseLetter??!0),t.isValid&&(t.isValid=t.containsUppercaseLetter??!0),t.isValid&&(t.isValid=t.containsNumericCharacter??!0),t.isValid&&(t.isValid=t.containsNonAlphanumericCharacter??!0),t}validatePasswordLengthOptions(e,t){let i=this.customStrengthOptions.minPasswordLength,r=this.customStrengthOptions.maxPasswordLength;i&&(t.meetsMinPasswordLength=e.length>=i),r&&(t.meetsMaxPasswordLength=e.length<=r)}validatePasswordCharacterOptions(e,t){this.updatePasswordCharacterOptionsStatuses(t,!1,!1,!1,!1);let i;for(let r=0;r<e.length;r++)i=e.charAt(r),this.updatePasswordCharacterOptionsStatuses(t,i>="a"&&i<="z",i>="A"&&i<="Z",i>="0"&&i<="9",this.allowedNonAlphanumericCharacters.includes(i))}updatePasswordCharacterOptionsStatuses(e,t,i,r,s){this.customStrengthOptions.containsLowercaseLetter&&(e.containsLowercaseLetter||(e.containsLowercaseLetter=t)),this.customStrengthOptions.containsUppercaseLetter&&(e.containsUppercaseLetter||(e.containsUppercaseLetter=i)),this.customStrengthOptions.containsNumericCharacter&&(e.containsNumericCharacter||(e.containsNumericCharacter=r)),this.customStrengthOptions.containsNonAlphanumericCharacter&&(e.containsNonAlphanumericCharacter||(e.containsNonAlphanumericCharacter=s))}};Ln=class{constructor(e,t,i,r){this.app=e,this.heartbeatServiceProvider=t,this.appCheckServiceProvider=i,this.config=r,this.currentUser=null,this.emulatorConfig=null,this.operations=Promise.resolve(),this.authStateSubscription=new Et(this),this.idTokenSubscription=new Et(this),this.beforeStateQueue=new Nn(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=Vr,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=r.sdkClientVersion,this._persistenceManagerAvailable=new Promise(s=>this._resolvePersistenceManagerAvailable=s)}_initializeWithPersistence(e,t){return t&&(this._popupRedirectResolver=$(t)),this._initializationPromise=this.queue(async()=>{if(!this._deleted&&(this.persistenceManager=await bt.create(this,e),this._resolvePersistenceManagerAvailable?.(),!this._deleted)){if(this._popupRedirectResolver?._shouldInitProactively)try{await this._popupRedirectResolver._initialize(this)}catch{}await this.initializeCurrentUser(t),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 t=await gt(this,{idToken:e}),i=await Z._fromGetAccountInfoResponse(this,t,e);await this.directlySetCurrentUser(i)}catch(t){console.warn("FirebaseServerApp could not login user with provided authIdToken: ",t),await this.directlySetCurrentUser(null)}}async initializeCurrentUser(e){if(I(this.app)){let s=this.app.settings.authIdToken;return s?new Promise(o=>{setTimeout(()=>this.initializeCurrentUserFromIdToken(s).then(o,o))}):this.directlySetCurrentUser(null)}let t=await this.assertedPersistence.getCurrentUser(),i=t,r=!1;if(e&&this.config.authDomain){await this.getOrInitRedirectPersistenceManager();let s=this.redirectUser?._redirectEventId,o=i?._redirectEventId,c=await this.tryRedirectSignIn(e);(!s||s===o)&&c?.user&&(i=c.user,r=!0)}if(!i)return this.directlySetCurrentUser(null);if(!i._redirectEventId){if(r)try{await this.beforeStateQueue.runMiddleware(i)}catch(s){i=t,this._popupRedirectResolver._overrideRedirectResult(this,()=>Promise.reject(s))}return i?this.reloadAndSetCurrentUserOrClear(i):this.directlySetCurrentUser(null)}return u(this._popupRedirectResolver,this,"argument-error"),await this.getOrInitRedirectPersistenceManager(),this.redirectUser&&this.redirectUser._redirectEventId===i._redirectEventId?this.directlySetCurrentUser(i):this.reloadAndSetCurrentUserOrClear(i)}async tryRedirectSignIn(e){let t=null;try{t=await this._popupRedirectResolver._completeRedirectFn(this,e,!0)}catch{await this._setRedirectUser(null)}return t}async reloadAndSetCurrentUserOrClear(e){try{await je(e)}catch(t){if(t?.code!=="auth/network-request-failed")return this.directlySetCurrentUser(null)}return this.directlySetCurrentUser(e)}useDeviceLanguage(){this.languageCode=Vo()}async _delete(){this._deleted=!0}async updateCurrentUser(e){if(I(this.app))return Promise.reject(T(this));let t=e?p(e):null;return t&&u(t.auth.config.apiKey===this.config.apiKey,this,"invalid-user-token"),this._updateCurrentUser(t&&t._clone(this))}async _updateCurrentUser(e,t=!1){if(!this._deleted)return e&&u(this.tenantId===e.tenantId,this,"tenant-id-mismatch"),t||await this.beforeStateQueue.runMiddleware(e),this.queue(async()=>{await this.directlySetCurrentUser(e),this.notifyAuthListeners()})}async signOut(){return I(this.app)?Promise.reject(T(this)):(await this.beforeStateQueue.runMiddleware(null),(this.redirectPersistenceManager||this._popupRedirectResolver)&&await this._setRedirectUser(null),this._updateCurrentUser(null,!0))}setPersistence(e){return I(this.app)?Promise.reject(T(this)):this.queue(async()=>{await this.assertedPersistence.setPersistence($(e))})}_getRecaptchaConfig(){return this.tenantId==null?this._agentRecaptchaConfig:this._tenantRecaptchaConfigs[this.tenantId]}async validatePassword(e){this._getPasswordPolicyInternal()||await this._updatePasswordPolicy();let t=this._getPasswordPolicyInternal();return t.schemaVersion!==this.EXPECTED_PASSWORD_POLICY_SCHEMA_VERSION?Promise.reject(this._errorFactory.create("unsupported-password-policy-schema-version",{})):t.validatePassword(e)}_getPasswordPolicyInternal(){return this.tenantId===null?this._projectPasswordPolicy:this._tenantPasswordPolicies[this.tenantId]}async _updatePasswordPolicy(){let e=await Zo(this),t=new Dn(e);this.tenantId===null?this._projectPasswordPolicy=t:this._tenantPasswordPolicies[this.tenantId]=t}_getPersistenceType(){return this.assertedPersistence.persistence.type}_getPersistence(){return this.assertedPersistence.persistence}_updateErrorMap(e){this._errorFactory=new W("auth","Firebase",e())}onAuthStateChanged(e,t,i){return this.registerStateListener(this.authStateSubscription,e,t,i)}beforeAuthStateChanged(e,t){return this.beforeStateQueue.pushCallback(e,t)}onIdTokenChanged(e,t,i){return this.registerStateListener(this.idTokenSubscription,e,t,i)}authStateReady(){return new Promise((e,t)=>{if(this.currentUser)e();else{let i=this.onAuthStateChanged(()=>{i(),e()},t)}})}async revokeAccessToken(e){if(this.currentUser){let t=await this.currentUser.getIdToken(),i={providerId:"apple.com",tokenType:"ACCESS_TOKEN",token:e,idToken:t};this.tenantId!=null&&(i.tenantId=this.tenantId),await Yo(this,i)}}toJSON(){return{apiKey:this.config.apiKey,authDomain:this.config.authDomain,appName:this.name,currentUser:this._currentUser?.toJSON()}}async _setRedirectUser(e,t){let i=await this.getOrInitRedirectPersistenceManager(t);return e===null?i.removeCurrentUser():i.setCurrentUser(e)}async getOrInitRedirectPersistenceManager(e){if(!this.redirectPersistenceManager){let t=e&&$(e)||this._popupRedirectResolver;u(t,this,"argument-error"),this.redirectPersistenceManager=await bt.create(this,[$(t._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,t,i,r){if(this._deleted)return()=>{};let s=typeof t=="function"?t:t.next.bind(t),o=!1,c=this._isInitialized?Promise.resolve():this._initializationPromise;if(u(c,this,"internal-error"),c.then(()=>{o||s(this.currentUser)}),typeof t=="function"){let l=e.addObserver(t,i,r);return()=>{o=!0,l()}}else{let l=e.addObserver(t);return()=>{o=!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=es(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 t=await this.heartbeatServiceProvider.getImmediate({optional:!0})?.getHeartbeatsHeader();t&&(e["X-Firebase-Client"]=t);let i=await this._getAppCheckToken();return i&&(e["X-Firebase-AppCheck"]=i),e}async _getAppCheckToken(){if(I(this.app)&&this.app.settings.appCheckToken)return this.app.settings.appCheckToken;let e=await this.appCheckServiceProvider.getImmediate({optional:!0})?.getToken();return e?.error&&Fo(`Error while retrieving App Check token: ${e.error}`),e?.token}};Et=class{constructor(e){this.auth=e,this.observer=null,this.addObserver=Bi(t=>this.observer=t)}get next(){return u(this.observer,this.auth,"internal-error"),this.observer.next.bind(this.observer)}};Xe={async loadJS(){throw new Error("Unable to load external scripts")},recaptchaV2Script:"",recaptchaEnterpriseScript:"",gapiScript:""};sc=500,ac=6e4,ot=1e12,Mn=class{constructor(e){this.auth=e,this.counter=ot,this._widgets=new Map}render(e,t){let i=this.counter;return this._widgets.set(i,new xn(e,this.auth.name,t||{})),this.counter++,i}reset(e){let t=e||ot;this._widgets.get(t)?.delete(),this._widgets.delete(t)}getResponse(e){let t=e||ot;return this._widgets.get(t)?.getResponse()||""}async execute(e){let t=e||ot;return this._widgets.get(t)?.execute(),""}},Un=class{constructor(){this.enterprise=new Fn}ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},Fn=class{ready(e){e()}execute(e,t){return Promise.resolve("token")}render(e,t){return""}},xn=class{constructor(e,t,i){this.params=i,this.timerId=null,this.deleted=!1,this.responseToken=null,this.clickHandler=()=>{this.execute()};let r=typeof e=="string"?document.getElementById(e):e;u(r,"argument-error",{appName:t}),this.container=r,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=oc(50);let{callback:e,"expired-callback":t}=this.params;if(e)try{e(this.responseToken)}catch{}this.timerId=window.setTimeout(()=>{if(this.timerId=null,this.responseToken=null,t)try{t()}catch{}this.isVisible&&this.execute()},ac)},sc))}checkIfDeleted(){if(this.deleted)throw new Error("reCAPTCHA mock was already deleted!")}};cc="recaptcha-enterprise",He="NO_RECAPTCHA",Ir="onFirebaseAuthREInstanceReady",ze=class n{constructor(e){this.type=cc,this.auth=b(e)}async verify(e="verify",t=!1){async function i(s){if(!t){if(s.tenantId==null&&s._agentRecaptchaConfig!=null)return s._agentRecaptchaConfig.siteKey;if(s.tenantId!=null&&s._tenantRecaptchaConfigs[s.tenantId]!==void 0)return s._tenantRecaptchaConfigs[s.tenantId].siteKey}return new Promise(async(o,c)=>{$r(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 a=new mt(l);return s.tenantId==null?s._agentRecaptchaConfig=a:s._tenantRecaptchaConfigs[s.tenantId]=a,o(a.siteKey)}}).catch(l=>{c(l)})})}function r(s,o,c){let l=window.grecaptcha;pr(l)?l.enterprise.ready(()=>{l.enterprise.execute(s,{action:e}).then(a=>{o(a)}).catch(()=>{o(He)})}):c(Error("No reCAPTCHA enterprise script loaded."))}return this.auth.settings.appVerificationDisabledForTesting?new Un().execute("siteKey",{action:"verify"}):new Promise((s,o)=>{i(this.auth).then(async c=>{if(!t&&pr(window.grecaptcha)&&n.scriptInjectionDeferred)await n.scriptInjectionDeferred.promise,r(c,s,o);else{if(typeof window>"u"){o(new Error("RecaptchaVerifier is only supported in browser"));return}let l=ic();l.length!==0&&(l+=c+`&onload=${Ir}`),n.scriptInjectionDeferred=new pe,window[Ir]=()=>{n.scriptInjectionDeferred?.resolve()},ui(l).then(()=>n.scriptInjectionDeferred?.promise).then(()=>{r(c,s,o)}).catch(a=>{o(a)})}}).catch(c=>{o(c)})})}};ze.scriptInjectionDeferred=null;G=class{constructor(e,t){this.providerId=e,this.signInMethod=t}toJSON(){return V("not implemented")}_getIdTokenResponse(e){return V("not implemented")}_linkToIdToken(e,t){return V("not implemented")}_getReauthenticationResolver(e){return V("not implemented")}};ye=class n extends G{constructor(e,t,i,r=null){super("password",i),this._email=e,this._password=t,this._tenantId=r}static _fromEmailAndPassword(e,t){return new n(e,t,"password")}static _fromEmailAndCode(e,t,i=null){return new n(e,t,"emailLink",i)}toJSON(){return{email:this._email,password:this._password,signInMethod:this.signInMethod,tenantId:this._tenantId}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;if(t?.email&&t?.password){if(t.signInMethod==="password")return this._fromEmailAndPassword(t.email,t.password);if(t.signInMethod==="emailLink")return this._fromEmailAndCode(t.email,t.password,t.tenantId)}return null}async _getIdTokenResponse(e){switch(this.signInMethod){case"password":let t={returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ee(e,t,"signInWithPassword",mc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return Ec(e,{email:this._email,oobCode:this._password});default:k(e,"internal-error")}}async _linkToIdToken(e,t){switch(this.signInMethod){case"password":let i={idToken:t,returnSecureToken:!0,email:this._email,password:this._password,clientType:"CLIENT_TYPE_WEB"};return ee(e,i,"signUpPassword",fc,"EMAIL_PASSWORD_PROVIDER");case"emailLink":return yc(e,{idToken:t,email:this._email,oobCode:this._password});default:k(e,"internal-error")}}_getReauthenticationResolver(e){return this._getIdTokenResponse(e)}};wc="http://localhost",H=class n extends G{constructor(){super(...arguments),this.pendingToken=null}static _fromParams(e){let t=new n(e.providerId,e.signInMethod);return e.idToken||e.accessToken?(e.idToken&&(t.idToken=e.idToken),e.accessToken&&(t.accessToken=e.accessToken),e.nonce&&!e.pendingToken&&(t.nonce=e.nonce),e.pendingToken&&(t.pendingToken=e.pendingToken)):e.oauthToken&&e.oauthTokenSecret?(t.accessToken=e.oauthToken,t.secret=e.oauthTokenSecret):k("argument-error"),t}toJSON(){return{idToken:this.idToken,accessToken:this.accessToken,secret:this.secret,nonce:this.nonce,pendingToken:this.pendingToken,providerId:this.providerId,signInMethod:this.signInMethod}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,...s}=t;if(!i||!r)return null;let o=new n(i,r);return o.idToken=s.idToken||void 0,o.accessToken=s.accessToken||void 0,o.secret=s.secret,o.nonce=s.nonce,o.pendingToken=s.pendingToken||null,o}_getIdTokenResponse(e){let t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){let i=this.buildRequest();return i.idToken=t,j(e,i)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,j(e,t)}buildRequest(){let e={requestUri:wc,returnSecureToken:!0};if(this.pendingToken)e.pendingToken=this.pendingToken;else{let t={};this.idToken&&(t.id_token=this.idToken),this.accessToken&&(t.access_token=this.accessToken),this.secret&&(t.oauth_token_secret=this.secret),t.providerId=this.providerId,this.nonce&&!this.pendingToken&&(t.nonce=this.nonce),e.postBody=re(t)}return e}};Ac={USER_NOT_FOUND:"user-not-found"};le=class n extends G{constructor(e){super("phone","phone"),this.params=e}static _fromVerification(e,t){return new n({verificationId:e,verificationCode:t})}static _fromTokenResponse(e,t){return new n({phoneNumber:e,temporaryProof:t})}_getIdTokenResponse(e){return Tc(e,this._makeVerificationRequest())}_linkToIdToken(e,t){return vc(e,{idToken:t,...this._makeVerificationRequest()})}_getReauthenticationResolver(e){return Sc(e,this._makeVerificationRequest())}_makeVerificationRequest(){let{temporaryProof:e,phoneNumber:t,verificationId:i,verificationCode:r}=this.params;return e&&t?{temporaryProof:e,phoneNumber:t}:{sessionInfo:i,code:r}}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:t,verificationCode:i,phoneNumber:r,temporaryProof:s}=e;return!i&&!t&&!r&&!s?null:new n({verificationId:t,verificationCode:i,phoneNumber:r,temporaryProof:s})}};ue=class n{constructor(e){let t=me(ge(e)),i=t.apiKey??null,r=t.oobCode??null,s=kc(t.mode??null);u(i&&r&&s,"argument-error"),this.apiKey=i,this.operation=s,this.code=r,this.continueUrl=t.continueUrl??null,this.languageCode=t.lang??null,this.tenantId=t.tenantId??null}static parseLink(e){let t=Rc(e);try{return new n(t)}catch{return null}}};K=class n{constructor(){this.providerId=n.PROVIDER_ID}static credential(e,t){return ye._fromEmailAndPassword(e,t)}static credentialWithLink(e,t){let i=ue.parseLink(t);return u(i,"argument-error"),ye._fromEmailAndCode(e,i.code,i.tenantId)}};K.PROVIDER_ID="password";K.EMAIL_PASSWORD_SIGN_IN_METHOD="password";K.EMAIL_LINK_SIGN_IN_METHOD="emailLink";N=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}};ne=class extends N{constructor(){super(...arguments),this.scopes=[]}addScope(e){return this.scopes.includes(e)||this.scopes.push(e),this}getScopes(){return[...this.scopes]}},yt=class n extends ne{static credentialFromJSON(e){let t=typeof e=="string"?JSON.parse(e):e;return u("providerId"in t&&"signInMethod"in t,"argument-error"),H._fromParams(t)}credential(e){return this._credential({...e,nonce:e.rawNonce})}_credential(e){return u(e.idToken||e.accessToken,"argument-error"),H._fromParams({...e,providerId:this.providerId,signInMethod:this.providerId})}static credentialFromResult(e){return n.oauthCredentialFromTaggedObject(e)}static credentialFromError(e){return n.oauthCredentialFromTaggedObject(e.customData||{})}static oauthCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:i,oauthTokenSecret:r,pendingToken:s,nonce:o,providerId:c}=e;if(!i&&!r&&!t&&!s||!c)return null;try{return new n(c)._credential({idToken:t,accessToken:i,nonce:o,pendingToken:s})}catch{return null}}};we=class n extends ne{constructor(){super("facebook.com")}static credential(e){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.FACEBOOK_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};we.FACEBOOK_SIGN_IN_METHOD="facebook.com";we.PROVIDER_ID="facebook.com";Te=class n extends ne{constructor(){super("google.com"),this.addScope("profile")}static credential(e,t){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GOOGLE_SIGN_IN_METHOD,idToken:e,accessToken:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthIdToken:t,oauthAccessToken:i}=e;if(!t&&!i)return null;try{return n.credential(t,i)}catch{return null}}};Te.GOOGLE_SIGN_IN_METHOD="google.com";Te.PROVIDER_ID="google.com";ve=class n extends ne{constructor(){super("github.com")}static credential(e){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.GITHUB_SIGN_IN_METHOD,accessToken:e})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e||!("oauthAccessToken"in e)||!e.oauthAccessToken)return null;try{return n.credential(e.oauthAccessToken)}catch{return null}}};ve.GITHUB_SIGN_IN_METHOD="github.com";ve.PROVIDER_ID="github.com";Cc="http://localhost",wt=class n extends G{constructor(e,t){super(e,e),this.pendingToken=t}_getIdTokenResponse(e){let t=this.buildRequest();return j(e,t)}_linkToIdToken(e,t){let i=this.buildRequest();return i.idToken=t,j(e,i)}_getReauthenticationResolver(e){let t=this.buildRequest();return t.autoCreate=!1,j(e,t)}toJSON(){return{signInMethod:this.signInMethod,providerId:this.providerId,pendingToken:this.pendingToken}}static fromJSON(e){let t=typeof e=="string"?JSON.parse(e):e,{providerId:i,signInMethod:r,pendingToken:s}=t;return!i||!r||!s||i!==r?null:new n(i,s)}static _create(e,t){return new n(e,t)}buildRequest(){return{requestUri:Cc,returnSecureToken:!0,pendingToken:this.pendingToken}}};Pc="saml.",Tt=class n extends N{constructor(e){u(e.startsWith(Pc),"argument-error"),super(e)}static credentialFromResult(e){return n.samlCredentialFromTaggedObject(e)}static credentialFromError(e){return n.samlCredentialFromTaggedObject(e.customData||{})}static credentialFromJSON(e){let t=wt.fromJSON(e);return u(t,"argument-error"),t}static samlCredentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{pendingToken:t,providerId:i}=e;if(!t||!i)return null;try{return wt._create(i,t)}catch{return null}}};Ae=class n extends ne{constructor(){super("twitter.com")}static credential(e,t){return H._fromParams({providerId:n.PROVIDER_ID,signInMethod:n.TWITTER_SIGN_IN_METHOD,oauthToken:e,oauthTokenSecret:t})}static credentialFromResult(e){return n.credentialFromTaggedObject(e)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{oauthAccessToken:t,oauthTokenSecret:i}=e;if(!t||!i)return null;try{return n.credential(t,i)}catch{return null}}};Ae.TWITTER_SIGN_IN_METHOD="twitter.com";Ae.PROVIDER_ID="twitter.com";D=class n{constructor(e){this.user=e.user,this.providerId=e.providerId,this._tokenResponse=e._tokenResponse,this.operationType=e.operationType}static async _fromIdTokenResponse(e,t,i,r=!1){let s=await Z._fromIdTokenResponse(e,i,r),o=yr(i);return new n({user:s,providerId:o,_tokenResponse:i,operationType:t})}static async _forOperation(e,t,i){await e._updateTokensIfNecessary(i,!0);let r=yr(i);return new n({user:e,providerId:r,_tokenResponse:i,operationType:t})}};Vn=class n extends C{constructor(e,t,i,r){super(t.code,t.message),this.operationType=i,this.user=r,Object.setPrototypeOf(this,n.prototype),this.customData={appName:e.name,tenantId:e.tenantId??void 0,_serverResponse:t.customData._serverResponse,operationType:i}}static _fromErrorAndOperation(e,t,i,r){return new n(e,t,i,r)}};de=class{constructor(e,t){this.factorId=e,this.uid=t.mfaEnrollmentId,this.enrollmentTime=new Date(t.enrolledAt).toUTCString(),this.displayName=t.displayName}static _fromServerResponse(e,t){return"phoneInfo"in t?Hn._fromServerResponse(e,t):"totpInfo"in t?Wn._fromServerResponse(e,t):k(e,"internal-error")}},Hn=class n extends de{constructor(e){super("phone",e),this.phoneNumber=e.phoneInfo}static _fromServerResponse(e,t){return new n(t)}},Wn=class n extends de{constructor(e){super("totp",e)}static _fromServerResponse(e,t){return new n(t)}};te=class{constructor(e,t,i={}){this.isNewUser=e,this.providerId=t,this.profile=i}},vt=class extends te{constructor(e,t,i,r){super(e,t,i),this.username=r}},Bn=class extends te{constructor(e,t){super(e,"facebook.com",t)}},$n=class extends vt{constructor(e,t){super(e,"github.com",t,typeof t?.login=="string"?t?.login:null)}},jn=class extends te{constructor(e,t){super(e,"google.com",t)}},zn=class extends vt{constructor(e,t,i){super(e,"twitter.com",t,i)}};At=class n{constructor(e,t,i){this.type=e,this.credential=t,this.user=i}static _fromIdtoken(e,t){return new n("enroll",e,t)}static _fromMfaPendingCredential(e){return new n("signin",e)}toJSON(){return{multiFactorSession:{[this.type==="enroll"?"idToken":"pendingCredential"]:this.credential}}}static fromJSON(e){if(e?.multiFactorSession){if(e.multiFactorSession?.pendingCredential)return n._fromMfaPendingCredential(e.multiFactorSession.pendingCredential);if(e.multiFactorSession?.idToken)return n._fromIdtoken(e.multiFactorSession.idToken)}return null}};qn=class n{constructor(e,t,i){this.session=e,this.hints=t,this.signInResolver=i}static _fromError(e,t){let i=b(e),r=t.customData._serverResponse,s=(r.mfaInfo||[]).map(c=>de._fromServerResponse(i,c));u(r.mfaPendingCredential,i,"internal-error");let o=At._fromMfaPendingCredential(r.mfaPendingCredential);return new n(o,s,async c=>{let l=await c._process(i,o);delete r.mfaInfo,delete r.mfaPendingCredential;let a={...r,idToken:l.idToken,refreshToken:l.refreshToken};switch(t.operationType){case"signIn":let d=await D._fromIdTokenResponse(i,t.operationType,a);return await i._updateCurrentUser(d.user),d;case"reauthenticate":return u(t.user,i,"internal-error"),D._forOperation(t.user,t.operationType,a);default:k(i,"internal-error")}})}async resolveSignIn(e){let t=e;return this.signInResolver(t)}};Gn=class n{constructor(e){this.user=e,this.enrolledFactors=[],e._onReload(t=>{t.mfaInfo&&(this.enrolledFactors=t.mfaInfo.map(i=>de._fromServerResponse(e.auth,i)))})}static _fromUser(e){return new n(e)}async getSession(){return At._fromIdtoken(await this.user.getIdToken(),this.user)}async enroll(e,t){let i=e,r=await this.getSession(),s=await q(this.user,i._process(this.user.auth,r,t));return await this.user._updateTokensIfNecessary(s),this.user.reload()}async unenroll(e){let t=typeof e=="string"?e:e.uid,i=await this.user.getIdToken();try{let r=await q(this.user,xc(this.user.auth,{idToken:i,mfaEnrollmentId:t}));this.enrolledFactors=this.enrolledFactors.filter(({uid:s})=>s!==t),await this.user._updateTokensIfNecessary(r),await this.user.reload()}catch(r){throw r}}},vn=new WeakMap;St="__sak";kt=class{constructor(e,t){this.storageRetriever=e,this.type=t}_isAvailable(){try{return this.storage?(this.storage.setItem(St,"1"),this.storage.removeItem(St),Promise.resolve(!0)):Promise.resolve(!1)}catch{return Promise.resolve(!1)}}_set(e,t){return this.storage.setItem(e,JSON.stringify(t)),Promise.resolve()}_get(e){let t=this.storage.getItem(e);return Promise.resolve(t?JSON.parse(t):null)}_remove(e){return this.storage.removeItem(e),Promise.resolve()}get storage(){return this.storageRetriever()}};Vc=1e3,Hc=10,Rt=class extends kt{constructor(){super(()=>window.localStorage,"LOCAL"),this.boundEventHandler=(e,t)=>this.onStorageEvent(e,t),this.listeners={},this.localCache={},this.pollTimer=null,this.fallbackToPolling=Zr(),this._shouldAllowMigration=!0}forAllChangedKeys(e){for(let t of Object.keys(this.listeners)){let i=this.storage.getItem(t),r=this.localCache[t];i!==r&&e(t,r,i)}}onStorageEvent(e,t=!1){if(!e.key){this.forAllChangedKeys((o,c,l)=>{this.notifyListeners(o,l)});return}let i=e.key;t?this.detachListener():this.stopPolling();let r=()=>{let o=this.storage.getItem(i);!t&&this.localCache[i]===o||this.notifyListeners(i,o)},s=this.storage.getItem(i);Qo()&&s!==e.newValue&&e.newValue!==e.oldValue?setTimeout(r,Hc):r()}notifyListeners(e,t){this.localCache[e]=t;let i=this.listeners[e];if(i)for(let r of Array.from(i))r(t&&JSON.parse(t))}startPolling(){this.stopPolling(),this.pollTimer=setInterval(()=>{this.forAllChangedKeys((e,t,i)=>{this.onStorageEvent(new StorageEvent("storage",{key:e,oldValue:t,newValue:i}),!0)})},Vc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}attachListener(){window.addEventListener("storage",this.boundEventHandler)}detachListener(){window.removeEventListener("storage",this.boundEventHandler)}_addListener(e,t){Object.keys(this.listeners).length===0&&(this.fallbackToPolling?this.startPolling():this.attachListener()),this.listeners[e]||(this.listeners[e]=new Set,this.localCache[e]=this.storage.getItem(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&(this.detachListener(),this.stopPolling())}async _set(e,t){await super._set(e,t),this.localCache[e]=JSON.stringify(t)}async _get(e){let t=await super._get(e);return this.localCache[e]=JSON.stringify(t),t}async _remove(e){await super._remove(e),delete this.localCache[e]}};Rt.type="LOCAL";Ei=Rt;Wc=1e3;Ct=class{constructor(){this.type="COOKIE",this.listenerUnsubscribes=new Map}_getFinalTarget(e){if(typeof window===void 0)return e;let t=new URL(`${window.location.origin}/__cookies__`);return t.searchParams.set("finalTarget",e),t}async _isAvailable(){return typeof isSecureContext=="boolean"&&!isSecureContext||typeof navigator>"u"||typeof document>"u"?!1:navigator.cookieEnabled??!0}async _set(e,t){}async _get(e){if(!this._isAvailable())return null;let t=Sn(e);return window.cookieStore?(await window.cookieStore.get(t))?.value:An(t)}async _remove(e){if(!this._isAvailable()||!await this._get(e))return;let i=Sn(e);document.cookie=`${i}=;Max-Age=34560000;Partitioned;Secure;SameSite=Strict;Path=/;Priority=High`,await fetch("/__cookies__",{method:"DELETE"}).catch(()=>{})}_addListener(e,t){if(!this._isAvailable())return;let i=Sn(e);if(window.cookieStore){let c=(a=>{let d=a.changed.find(f=>f.name===i);d&&t(d.value),a.deleted.find(f=>f.name===i)&&t(null)}),l=()=>window.cookieStore.removeEventListener("change",c);return this.listenerUnsubscribes.set(t,l),window.cookieStore.addEventListener("change",c)}let r=An(i),s=setInterval(()=>{let c=An(i);c!==r&&(t(c),r=c)},Wc),o=()=>clearInterval(s);this.listenerUnsubscribes.set(t,o)}_removeListener(e,t){let i=this.listenerUnsubscribes.get(t);i&&(i(),this.listenerUnsubscribes.delete(t))}};Ct.type="COOKIE";Bs=Ct;Pt=class extends kt{constructor(){super(()=>window.sessionStorage,"SESSION")}_addListener(e,t){}_removeListener(e,t){}};Pt.type="SESSION";$t=Pt;Ot=class n{constructor(e){this.eventTarget=e,this.handlersMap={},this.boundEventHandler=this.handleEvent.bind(this)}static _getInstance(e){let t=this.receivers.find(r=>r.isListeningto(e));if(t)return t;let i=new n(e);return this.receivers.push(i),i}isListeningto(e){return this.eventTarget===e}async handleEvent(e){let t=e,{eventId:i,eventType:r,data:s}=t.data,o=this.handlersMap[r];if(!o?.size)return;t.ports[0].postMessage({status:"ack",eventId:i,eventType:r});let c=Array.from(o).map(async a=>a(t.origin,s)),l=await Bc(c);t.ports[0].postMessage({status:"done",eventId:i,eventType:r,response:l})}_subscribe(e,t){Object.keys(this.handlersMap).length===0&&this.eventTarget.addEventListener("message",this.boundEventHandler),this.handlersMap[e]||(this.handlersMap[e]=new Set),this.handlersMap[e].add(t)}_unsubscribe(e,t){this.handlersMap[e]&&t&&this.handlersMap[e].delete(t),(!t||this.handlersMap[e].size===0)&&delete this.handlersMap[e],Object.keys(this.handlersMap).length===0&&this.eventTarget.removeEventListener("message",this.boundEventHandler)}};Ot.receivers=[];Kn=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,t,i=50){let r=typeof MessageChannel<"u"?new MessageChannel:null;if(!r)throw new Error("connection_unavailable");let s,o;return new Promise((c,l)=>{let a=jt("",20);r.port1.start();let d=setTimeout(()=>{l(new Error("unsupported_event"))},i);o={messageChannel:r,onMessage(h){let f=h;if(f.data.eventId===a)switch(f.data.status){case"ack":clearTimeout(d),s=setTimeout(()=>{l(new Error("timeout"))},3e3);break;case"done":clearTimeout(s),c(f.data.response);break;default:clearTimeout(d),clearTimeout(s),l(new Error("invalid_response"));break}}},this.handlers.add(o),r.port1.addEventListener("message",o.onMessage),this.target.postMessage({eventType:e,eventId:a,data:t},[r.port2])}).finally(()=>{o&&this.removeMessageHandler(o)})}};$s="firebaseLocalStorageDb",Gc=1,Nt="firebaseLocalStorage",js="fbase_key",he=class{constructor(e){this.request=e}toPromise(){return new Promise((e,t)=>{this.request.addEventListener("success",()=>{e(this.request.result)}),this.request.addEventListener("error",()=>{t(this.request.error)})})}};Yc=800,Xc=3,Dt=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=zs(),this.dbPromise.catch(()=>{this.dbPromise=null}),this.dbPromise)}async _withRetries(e){let t=0;for(;;)try{let i=await this._openDb();return await e(i)}catch(i){if(t++>Xc)throw i;this.dbPromise&&((await this.dbPromise).close(),this.dbPromise=null)}}async initializeServiceWorkerMessaging(){return yi()?this.initializeReceiver():this.initializeSender()}async initializeReceiver(){this.receiver=Ot._getInstance(qc()),this.receiver._subscribe("keyChanged",async(e,t)=>({keyProcessed:(await this._poll()).includes(t.key)})),this.receiver._subscribe("ping",async(e,t)=>["keyChanged"])}async initializeSender(){if(this.activeServiceWorker=await jc(),!this.activeServiceWorker)return;this.sender=new Kn(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||zc()!==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 Tr(e,St,"1"),await vr(e,St)}),!0):!1}catch{}return!1}async _withPendingWrite(e){this.pendingWrites++;try{await e()}finally{this.pendingWrites--}}async _set(e,t){return this._withPendingWrite(async()=>(await this._withRetries(i=>Tr(i,e,t)),this.localCache[e]=t,this.notifyServiceWorker(e)))}async _get(e){let t=await this._withRetries(i=>Jc(i,e));return this.localCache[e]=t,t}async _remove(e){return this._withPendingWrite(async()=>(await this._withRetries(t=>vr(t,e)),delete this.localCache[e],this.notifyServiceWorker(e)))}async _poll(){let e=await this._withRetries(r=>{let s=zt(r,!1).getAll();return new he(s).toPromise()});if(!e)return[];if(this.pendingWrites!==0)return[];let t=[],i=new Set;if(e.length!==0)for(let{fbase_key:r,value:s}of e)i.add(r),JSON.stringify(this.localCache[r])!==JSON.stringify(s)&&(this.notifyListeners(r,s),t.push(r));for(let r of Object.keys(this.localCache))this.localCache[r]&&!i.has(r)&&(this.notifyListeners(r,null),t.push(r));return t}notifyListeners(e,t){this.localCache[e]=t;let i=this.listeners[e];if(i)for(let r of Array.from(i))r(t)}startPolling(){this.stopPolling(),this.pollTimer=setInterval(async()=>this._poll(),Yc)}stopPolling(){this.pollTimer&&(clearInterval(this.pollTimer),this.pollTimer=null)}_addListener(e,t){Object.keys(this.listeners).length===0&&this.startPolling(),this.listeners[e]||(this.listeners[e]=new Set,this._get(e)),this.listeners[e].add(t)}_removeListener(e,t){this.listeners[e]&&(this.listeners[e].delete(t),this.listeners[e].size===0&&delete this.listeners[e]),Object.keys(this.listeners).length===0&&this.stopPolling()}};Dt.type="LOCAL";wi=Dt;kn=ts("rcb"),el=new ce(3e4,6e4),Jn=class{constructor(){this.hostLanguage="",this.counter=0,this.librarySeparatelyLoaded=!!y().grecaptcha?.render}load(e,t=""){return u(tl(t),e,"argument-error"),this.shouldResolveImmediately(t)&&fr(y().grecaptcha)?Promise.resolve(y().grecaptcha):new Promise((i,r)=>{let s=y().setTimeout(()=>{r(S(e,"network-request-failed"))},el.get());y()[kn]=()=>{y().clearTimeout(s),delete y()[kn];let c=y().grecaptcha;if(!c||!fr(c)){r(S(e,"internal-error"));return}let l=c.render;c.render=(a,d)=>{let h=l(a,d);return this.counter++,h},this.hostLanguage=t,i(c)};let o=`${nc()}?${re({onload:kn,render:"explicit",hl:t})}`;ui(o).catch(()=>{clearTimeout(s),r(S(e,"internal-error"))})})}clearedOneInstance(){this.counter--}shouldResolveImmediately(e){return!!y().grecaptcha?.render&&(e===this.hostLanguage||this.counter>0||this.librarySeparatelyLoaded)}};Yn=class{async load(e){return new Mn(e)}clearedOneInstance(){}};We="recaptcha",nl={theme:"light",type:"image"},Lt=class{constructor(e,t,i={...nl}){this.parameters=i,this.type=We,this.destroyed=!1,this.widgetId=null,this.tokenChangeListeners=new Set,this.renderPromise=null,this.recaptcha=null,this.auth=b(e),this.isInvisible=this.parameters.size==="invisible",u(typeof document<"u",this.auth,"operation-not-supported-in-this-environment");let r=typeof t=="string"?document.getElementById(t):t;u(r,this.auth,"argument-error"),this.container=r,this.parameters.callback=this.makeTokenCallback(this.parameters.callback),this._recaptchaLoader=this.auth.settings.appVerificationDisabledForTesting?new Yn:new Jn,this.validateStartingState()}async verify(){this.assertNotDestroyed();let e=await this.render(),t=this.getAssertedRecaptcha(),i=t.getResponse(e);return i||new Promise(r=>{let s=o=>{o&&(this.tokenChangeListeners.delete(s),r(o))};this.tokenChangeListeners.add(s),this.isInvisible&&t.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 t=>{if(this.tokenChangeListeners.forEach(i=>i(t)),typeof e=="function")e(t);else if(typeof e=="string"){let i=y()[e];typeof i=="function"&&i(t)}}}assertNotDestroyed(){u(!this.destroyed,this.auth,"internal-error")}async makeRenderPromise(){if(await this.init(),!this.widgetId){let e=this.container;if(!this.isInvisible){let t=document.createElement("div");e.appendChild(t),e=t}this.widgetId=this.getAssertedRecaptcha().render(e,this.parameters)}return this.widgetId}async init(){u(si()&&!yi(),this.auth,"internal-error"),await il(),this.recaptcha=await this._recaptchaLoader.load(this.auth,this.auth.languageCode||void 0);let e=await jo(this.auth);u(e,this.auth,"internal-error"),this.parameters.sitekey=e}getAssertedRecaptcha(){return u(this.recaptcha,this.auth,"internal-error"),this.recaptcha}};qe=class{constructor(e,t){this.verificationId=e,this.onConfirmation=t}confirm(e){let t=le._fromVerification(this.verificationId,e);return this.onConfirmation(t)}};Se=class n{constructor(e){this.providerId=n.PROVIDER_ID,this.auth=b(e)}verifyPhoneNumber(e,t){return qt(this.auth,e,p(t))}static credential(e,t){return le._fromVerification(e,t)}static credentialFromResult(e){let t=e;return n.credentialFromTaggedObject(t)}static credentialFromError(e){return n.credentialFromTaggedObject(e.customData||{})}static credentialFromTaggedObject({_tokenResponse:e}){if(!e)return null;let{phoneNumber:t,temporaryProof:i}=e;return t&&i?le._fromTokenResponse(t,i):null}};Se.PROVIDER_ID="phone";Se.PHONE_SIGN_IN_METHOD="phone";Ge=class extends G{constructor(e){super("custom","custom"),this.params=e}_getIdTokenResponse(e){return j(e,this._buildIdpRequest())}_linkToIdToken(e,t){return j(e,this._buildIdpRequest(t))}_getReauthenticationResolver(e){return j(e,this._buildIdpRequest())}_buildIdpRequest(e){let t={requestUri:this.params.requestUri,sessionId:this.params.sessionId,postBody:this.params.postBody,tenantId:this.params.tenantId,pendingToken:this.params.pendingToken,returnSecureToken:!0,returnIdpCredential:!0};return e&&(t.idToken=e),t}};Mt=class{constructor(e,t,i,r,s=!1){this.auth=e,this.resolver=i,this.user=r,this.bypassAuthState=s,this.pendingPromise=null,this.eventManager=null,this.filter=Array.isArray(t)?t:[t]}execute(){return new Promise(async(e,t)=>{this.pendingPromise={resolve:e,reject:t};try{this.eventManager=await this.resolver._initialize(this.auth),await this.onExecution(),this.eventManager.registerConsumer(this)}catch(i){this.reject(i)}})}async onAuthEvent(e){let{urlResponse:t,sessionId:i,postBody:r,tenantId:s,error:o,type:c}=e;if(o){this.reject(o);return}let l={auth:this.auth,requestUri:t,sessionId:i,tenantId:s||void 0,postBody:r||void 0,user:this.user,bypassAuthState:this.bypassAuthState};try{this.resolve(await this.getIdpTask(c)(l))}catch(a){this.reject(a)}}onError(e){this.reject(e)}getIdpTask(e){switch(e){case"signInViaPopup":case"signInViaRedirect":return rl;case"linkViaPopup":case"linkViaRedirect":return al;case"reauthViaPopup":case"reauthViaRedirect":return sl;default:k(this.auth,"internal-error")}}resolve(e){z(this.pendingPromise,"Pending promise was never set"),this.pendingPromise.resolve(e),this.unregisterAndCleanUp()}reject(e){z(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()}};ol=new ce(2e3,1e4);ke=class n extends Mt{constructor(e,t,i,r,s){super(e,t,r,s),this.provider=i,this.authWindow=null,this.pollId=null,n.currentPopupAction&&n.currentPopupAction.cancel(),n.currentPopupAction=this}async executeNotNull(){let e=await this.execute();return u(e,this.auth,"internal-error"),e}async onExecution(){z(this.filter.length===1,"Popup operations only handle one event");let e=jt();this.authWindow=await this.resolver._openPopup(this.auth,this.provider,this.filter[0],e),this.authWindow.associatedEvent=e,this.resolver._originValidation(this.auth).catch(t=>{this.reject(t)}),this.resolver._isIframeWebStorageSupported(this.auth,t=>{t||this.reject(S(this.auth,"web-storage-unsupported"))}),this.pollUserCancellation()}get eventId(){return this.authWindow?.associatedEvent||null}cancel(){this.reject(S(this.auth,"cancelled-popup-request"))}cleanUp(){this.authWindow&&this.authWindow.close(),this.pollId&&window.clearTimeout(this.pollId),this.authWindow=null,this.pollId=null,n.currentPopupAction=null}pollUserCancellation(){let e=()=>{if(this.authWindow?.window?.closed){this.pollId=window.setTimeout(()=>{this.pollId=null,this.reject(S(this.auth,"popup-closed-by-user"))},8e3);return}this.pollId=window.setTimeout(e,ol.get())};e()}};ke.currentPopupAction=null;cl="pendingRedirect",dt=new Map,Xn=class extends Mt{constructor(e,t,i=!1){super(e,["signInViaRedirect","linkViaRedirect","reauthViaRedirect","unknown"],t,void 0,i),this.eventId=null}async execute(){let e=dt.get(this.auth._key());if(!e){try{let i=await ll(this.resolver,this.auth)?await super.execute():null;e=()=>Promise.resolve(i)}catch(t){e=()=>Promise.reject(t)}dt.set(this.auth._key(),e)}return this.bypassAuthState||dt.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 t=await this.auth._redirectUserForId(e.eventId);if(t)return this.user=t,super.onAuthEvent(e);this.resolve(null)}}async onExecution(){}cleanUp(){}};pl=600*1e3,Qn=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 t=!1;return this.consumers.forEach(i=>{this.isEventForConsumer(e,i)&&(t=!0,this.sendToConsumer(e,i),this.saveEventToCache(e))}),this.hasHandledPotentialRedirect||!ml(e)||(this.hasHandledPotentialRedirect=!0,t||(this.queuedRedirectEvent=e,t=!0)),t}sendToConsumer(e,t){if(e.error&&!oa(e)){let i=e.error.code?.split("auth/")[1]||"internal-error";t.onError(S(this.auth,i))}else t.onAuthEvent(e)}isEventForConsumer(e,t){let i=t.eventId===null||!!e.eventId&&e.eventId===t.eventId;return t.filter.includes(e.type)&&i}hasEventBeenHandled(e){return Date.now()-this.lastProcessedEventTime>=pl&&this.cachedEventUids.clear(),this.cachedEventUids.has(Sr(e))}saveEventToCache(e){this.cachedEventUids.add(Sr(e)),this.lastProcessedEventTime=Date.now()}};_l=/^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/,Il=/^https?/;yl=new ce(3e4,6e4);ht=null;vl=new ce(5e3,15e3),Al="__/auth/iframe",Sl="emulator/auth/iframe",kl={style:{position:"absolute",top:"-100px",width:"1px",height:"1px"},"aria-hidden":"true",tabindex:"-1"},Rl=new Map([["identitytoolkit.googleapis.com","p"],["staging-identitytoolkit.sandbox.googleapis.com","s"],["test-identitytoolkit.sandbox.googleapis.com","t"]]);Ol={location:"yes",resizable:"yes",statusbar:"yes",toolbar:"no"},Nl=500,Dl=600,Ll="_blank",Ml="http://localhost",Ut=class{constructor(e){this.window=e,this.associatedEvent=null}close(){if(this.window)try{this.window.close()}catch{}}};xl="__/auth/handler",Vl="emulator/auth/handler",Hl=encodeURIComponent("fac");Cn="webStorageSupport",Zn=class{constructor(){this.eventManagers={},this.iframes={},this.originValidationPromises={},this._redirectPersistence=$t,this._completeRedirectFn=sa,this._overrideRedirectResult=ul}async _openPopup(e,t,i,r){z(this.eventManagers[e._key()]?.manager,"_initialize() not called before _openPopup()");let s=await Rr(e,t,i,Be(),r);return Ul(e,s,jt())}async _openRedirect(e,t,i,r){await this._originValidation(e);let s=await Rr(e,t,i,Be(),r);return $c(s),new Promise(()=>{})}_initialize(e){let t=e._key();if(this.eventManagers[t]){let{manager:r,promise:s}=this.eventManagers[t];return r?Promise.resolve(r):(z(s,"If manager is not set, promise should be"),s)}let i=this.initAndGetManager(e);return this.eventManagers[t]={promise:i},i.catch(()=>{delete this.eventManagers[t]}),i}async initAndGetManager(e){let t=await Pl(e),i=new Qn(e);return t.register("authEvent",r=>(u(r?.authEvent,e,"invalid-auth-event"),{status:i.onEvent(r.authEvent)?"ACK":"ERROR"}),gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER),this.eventManagers[e._key()]={manager:i},this.iframes[e._key()]=t,i}_isIframeWebStorageSupported(e,t){this.iframes[e._key()].send(Cn,{type:Cn},r=>{let s=r?.[0]?.[Cn];s!==void 0&&t(!!s),k(e,"internal-error")},gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER)}_originValidation(e){let t=e._key();return this.originValidationPromises[t]||(this.originValidationPromises[t]=bl(e)),this.originValidationPromises[t]}get _shouldInitProactively(){return Zr()||Gr()||li()}},vi=Zn,Ft=class{constructor(e){this.factorId=e}_process(e,t,i){switch(t.type){case"enroll":return this._finalizeEnroll(e,t.credential,i);case"signin":return this._finalizeSignIn(e,t.credential);default:return V("unexpected MultiFactorSessionType")}}},ei=class n extends Ft{constructor(e){super("phone"),this.credential=e}static _fromCredential(e){return new n(e)}_finalizeEnroll(e,t,i){return Mc(e,{idToken:t,displayName:i,phoneVerificationInfo:this.credential._makeVerificationRequest()})}_finalizeSignIn(e,t){return Qc(e,{mfaPendingCredential:t,phoneVerificationInfo:this.credential._makeVerificationRequest()})}},Ke=class{constructor(){}static assertion(e){return ei._fromCredential(e)}};Ke.FACTOR_ID="phone";Je=class{static assertionForEnrollment(e,t){return xt._fromSecret(e,t)}static assertionForSignIn(e,t){return xt._fromEnrollmentId(e,t)}static async generateSecret(e){let t=e;u(typeof t.user?.auth<"u","internal-error");let i=await Uc(t.user.auth,{idToken:t.credential,totpEnrollmentInfo:{}});return Ye._fromStartTotpMfaEnrollmentResponse(i,t.user.auth)}};Je.FACTOR_ID="totp";xt=class n extends Ft{constructor(e,t,i){super("totp"),this.otp=e,this.enrollmentId=t,this.secret=i}static _fromSecret(e,t){return new n(t,void 0,e)}static _fromEnrollmentId(e,t){return new n(t,e)}async _finalizeEnroll(e,t,i){return u(typeof this.secret<"u",e,"argument-error"),Fc(e,{idToken:t,displayName:i,totpVerificationInfo:this.secret._makeTotpVerificationInfo(this.otp)})}async _finalizeSignIn(e,t){u(this.enrollmentId!==void 0&&this.otp!==void 0,e,"argument-error");let i={verificationCode:this.otp};return Zc(e,{mfaPendingCredential:t,mfaEnrollmentId:this.enrollmentId,totpVerificationInfo:i})}},Ye=class n{constructor(e,t,i,r,s,o,c){this.sessionInfo=o,this.auth=c,this.secretKey=e,this.hashingAlgorithm=t,this.codeLength=i,this.codeIntervalSeconds=r,this.enrollmentCompletionDeadline=s}static _fromStartTotpMfaEnrollmentResponse(e,t){return new n(e.totpSessionInfo.sharedSecretKey,e.totpSessionInfo.hashingAlgorithm,e.totpSessionInfo.verificationCodeLength,e.totpSessionInfo.periodSec,new Date(e.totpSessionInfo.finalizeEnrollmentTime).toUTCString(),e.totpSessionInfo.sessionInfo,t)}_makeTotpVerificationInfo(e){return{sessionInfo:this.sessionInfo,verificationCode:e}}generateQrCodeUrl(e,t){let i=!1;return(ct(e)||ct(t))&&(i=!0),i&&(ct(e)&&(e=this.auth.currentUser?.email||"unknownuser"),ct(t)&&(t=this.auth.name)),`otpauth://totp/${t}:${e}?secret=${this.secretKey}&issuer=${t}&algorithm=${this.hashingAlgorithm}&digits=${this.codeLength}`}};Cr="@firebase/auth",Pr="1.13.3";ti=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 t=this.auth.onIdTokenChanged(i=>{e(i?.stsTokenManager.accessToken||null)});this.internalListeners.set(e,t),this.updateProactiveRefresh()}removeAuthTokenListener(e){this.assertAuthConfigured();let t=this.internalListeners.get(e);t&&(this.internalListeners.delete(e),t(),this.updateProactiveRefresh())}assertAuthConfigured(){u(this.auth._initializationPromise,"dependent-sdk-initialized-before-auth")}updateProactiveRefresh(){this.internalListeners.size>0?this.auth._startProactiveRefresh():this.auth._stopProactiveRefresh()}};jl=300,zl=rn("authIdTokenMaxAge")||jl,Or=null,ql=n=>async e=>{let t=e&&await e.getIdTokenResult(),i=t&&(new Date().getTime()-Date.parse(t.issuedAtTime))/1e3;if(i&&i>zl)return;let r=t?.token;Or!==r&&(Or=r,await fetch(n,{method:r?"POST":"DELETE",headers:r?{Authorization:`Bearer ${r}`}:{}}))};tc({loadJS(n){return new Promise((e,t)=>{let i=document.createElement("script");i.setAttribute("src",n),i.onload=e,i.onerror=r=>{let s=S("internal-error");s.customData=r,t(s)},i.type="text/javascript",i.charset="UTF-8",Gl().appendChild(i)})},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="});$l("Browser")});var ua=O(()=>{la();Me();_e();it();nt()});var Gt={};Si(Gt,{ActionCodeOperation:()=>Ur,ActionCodeURL:()=>ue,AuthCredential:()=>G,AuthErrorCodes:()=>Hr,EmailAuthCredential:()=>ye,EmailAuthProvider:()=>K,FacebookAuthProvider:()=>we,FactorId:()=>Nr,GithubAuthProvider:()=>ve,GoogleAuthProvider:()=>Te,OAuthCredential:()=>H,OAuthProvider:()=>yt,OperationType:()=>Mr,PhoneAuthCredential:()=>le,PhoneAuthProvider:()=>Se,PhoneMultiFactorGenerator:()=>Ke,ProviderId:()=>Dr,RecaptchaVerifier:()=>Lt,SAMLAuthProvider:()=>Tt,SignInMethod:()=>Lr,TotpMultiFactorGenerator:()=>Je,TotpSecret:()=>Ye,TwitterAuthProvider:()=>Ae,applyActionCode:()=>gs,beforeAuthStateChanged:()=>bi,browserCookiePersistence:()=>Bs,browserLocalPersistence:()=>Ei,browserPopupRedirectResolver:()=>vi,browserSessionPersistence:()=>$t,checkActionCode:()=>_i,confirmPasswordReset:()=>ms,connectAuthEmulator:()=>hi,createUserWithEmailAndPassword:()=>Is,debugErrorMap:()=>xr,deleteUser:()=>Vs,fetchSignInMethodsForEmail:()=>Ts,getAdditionalUserInfo:()=>Ps,getAuth:()=>ca,getIdToken:()=>jr,getIdTokenResult:()=>oi,getMultiFactorResolver:()=>Hs,getRedirectResult:()=>ra,inMemoryPersistence:()=>It,indexedDBLocalPersistence:()=>wi,initializeAuth:()=>di,initializeRecaptchaConfig:()=>Ns,isSignInWithEmailLink:()=>ys,linkWithCredential:()=>pi,linkWithPhoneNumber:()=>Gs,linkWithPopup:()=>Qs,linkWithRedirect:()=>ia,multiFactor:()=>Ws,onAuthStateChanged:()=>Ls,onIdTokenChanged:()=>Ii,parseActionCodeURL:()=>ss,prodErrorMap:()=>ni,reauthenticateWithCredential:()=>mi,reauthenticateWithPhoneNumber:()=>Ks,reauthenticateWithPopup:()=>Xs,reauthenticateWithRedirect:()=>na,reload:()=>ci,revokeAccessToken:()=>xs,sendEmailVerification:()=>vs,sendPasswordResetEmail:()=>ps,sendSignInLinkToEmail:()=>Es,setPersistence:()=>Os,signInAnonymously:()=>os,signInWithCredential:()=>Qe,signInWithCustomToken:()=>fs,signInWithEmailAndPassword:()=>bs,signInWithEmailLink:()=>ws,signInWithPhoneNumber:()=>qs,signInWithPopup:()=>Ys,signInWithRedirect:()=>ta,signOut:()=>Fs,unlink:()=>us,updateCurrentUser:()=>Us,updateEmail:()=>ks,updatePassword:()=>Rs,updatePhoneNumber:()=>Js,updateProfile:()=>Ss,useDeviceLanguage:()=>Ms,validatePassword:()=>Ds,verifyBeforeUpdateEmail:()=>As,verifyPasswordResetCode:()=>_s});var Kt=O(()=>{ua()});var Kl={apiKey:"AIzaSyAC5ROxI3bnIO1DyNflMhFRrtnR-45p4RE",authDomain:"myapp-259bf.firebaseapp.com",projectId:"myapp-259bf"},Ai=null,Jt=null;async function Ze(){return typeof window>"u"?null:(Ai||(Ai=(async()=>{let{initializeApp:n,getApps:e}=await Promise.resolve().then(()=>(dr(),ur)),{getAuth:t,signInAnonymously:i,onAuthStateChanged:r}=await Promise.resolve().then(()=>(Kt(),Gt)),s=e().length?e()[0]:n(Kl);if(Jt=t(s),!await new Promise(c=>{let l=r(Jt,a=>{l(),c(a)})}))try{await i(Jt)}catch(c){console.warn("[Fleetbo Auth] Anonymous session created in offline mode or delayed:",c.message)}return Jt})()),Ai)}async function da(){try{let n=await Ze();return!n||!n.currentUser?null:await n.currentUser.getIdToken()}catch(n){return console.error("[Fleetbo Auth Debug]",n),null}}async function Yt(n){let e=await Ze(),{signInWithCustomToken:t}=await Promise.resolve().then(()=>(Kt(),Gt)),i=await t(e,n);return{uid:i.user.uid,email:i.user.email,isAnonymous:i.user.isAnonymous}}async function ha(){let n=await Ze(),{signOut:e,signInAnonymously:t}=await Promise.resolve().then(()=>(Kt(),Gt));return await e(n),await t(n),!0}async function fa(){let n=await Ze();return!n||!n.currentUser?null:{uid:n.currentUser.uid,email:n.currentUser.email,isAnonymous:n.currentUser.isAnonymous}}async function pa(n=!1){try{let e=await Ze();return!e||!e.currentUser?!1:(await e.currentUser.getIdTokenResult(n)).claims.elog===!0}catch(e){return console.error("[Fleetbo Auth Debug]",e),!1}}var Jl="https://fleetbo-gatekeeper.fleetbo.workers.dev/",E=async(n,e=null)=>{try{let t=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_DB_KEY:typeof process<"u"?process.env?.VITE_FLEETBO_DB_KEY:void 0,i=typeof import.meta<"u"&&import.meta.env?import.meta.env.VITE_FLEETBO_ENTERPRISE_ID:typeof process<"u"?process.env?.VITE_FLEETBO_ENTERPRISE_ID:void 0,r=typeof process<"u"&&(process.env?.FLEETBO_PROTOTYPE==="true"||process.env?.VITE_FLEETBO_PROTOTYPE==="true")||typeof import.meta<"u"&&(import.meta.env?.VITE_FLEETBO_PROTOTYPE==="true"||import.meta.env?.FLEETBO_PROTOTYPE==="true"),s=n.replace("https://","").split("-")[0]||"add",o={"Content-Type":"application/json"};r&&(o["x-fleetbo-prototype"]="true");let c=await da();c&&(o.Authorization=`Bearer ${c}`);let l={targetFunction:s,enterpriseID:i,fleetboDB:t,fleetboTable:e?.fleetboTable||null,jsonData:e?.jsonData||e,_prototype:r,data:{fleetboDB:t,enterpriseID:i,...e}},a=await fetch(Jl,{method:"POST",headers:o,body:JSON.stringify(l)}),d=await a.json(),h=d.result||d;return{success:a.ok,...h}}catch(t){return{success:!1,error:t.message}}};if(typeof window<"u"&&typeof customElements<"u"){class n extends HTMLElement{static get observedAttributes(){return["value","fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get fallback(){return this.getAttribute("fallback")}set fallback(a){a==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(a))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("fallback")||"\u2014",h=a!=null&&a.trim()!==""&&a!=="null"&&a!=="undefined";this.textContent=h?a:d}}class e extends HTMLElement{static get observedAttributes(){return["value","invalid-fallback","currency"]}get value(){return this.getAttribute("value")}set value(a){a==null||a===""?this.removeAttribute("value"):this.setAttribute("value",String(a))}get currency(){return this.getAttribute("currency")}set currency(a){a==null?this.removeAttribute("currency"):this.setAttribute("currency",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"0";if(a==null||a===""||a==="null"||a==="undefined"){this.textContent=d;return}let h=Number(a);if(Number.isNaN(h)){this.textContent=d;return}let f=this.getAttribute("currency");if(f)try{this.textContent=new Intl.NumberFormat("fr-FR",{style:"currency",currency:f}).format(h)}catch{this.textContent=`${h} ${f}`}else this.textContent=String(h)}}class t extends HTMLElement{static get observedAttributes(){return["value","label-true","label-false","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get labelTrue(){return this.getAttribute("label-true")}set labelTrue(a){a==null?this.removeAttribute("label-true"):this.setAttribute("label-true",String(a))}get"label-true"(){return this.labelTrue}set"label-true"(a){this.labelTrue=a}get labelFalse(){return this.getAttribute("label-false")}set labelFalse(a){a==null?this.removeAttribute("label-false"):this.setAttribute("label-false",String(a))}get"label-false"(){return this.labelFalse}set"label-false"(a){this.labelFalse=a}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("label-true")||"Oui",h=this.getAttribute("label-false")||"Non",f=this.getAttribute("invalid-fallback")||"Inconnu";a==="true"||a==="1"?this.textContent=d:a==="false"||a==="0"?this.textContent=h:this.textContent=f}}class i extends HTMLElement{static get observedAttributes(){return["value","locale","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null||a===""?this.removeAttribute("value"):a&&typeof a.toISOString=="function"?this.setAttribute("value",a.toISOString()):this.setAttribute("value",String(a))}get locale(){return this.getAttribute("locale")}set locale(a){a==null?this.removeAttribute("locale"):this.setAttribute("locale",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("invalid-fallback")||"Date invalide",h=this.getAttribute("locale")||"fr-FR";if(!a||a==="null"||a==="undefined"||a===""){this.textContent=d;return}let f=new Date(a);if(Number.isNaN(f.getTime())){this.textContent=d;return}try{this.textContent=f.toLocaleDateString(h)}catch{this.textContent=f.toLocaleDateString("fr-FR")}}}class r extends HTMLElement{static get observedAttributes(){return["value","allowed","invalid-fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get allowed(){return this.getAttribute("allowed")}set allowed(a){a==null?this.removeAttribute("allowed"):Array.isArray(a)?this.setAttribute("allowed",a.join(",")):this.setAttribute("allowed",String(a))}get invalidFallback(){return this.getAttribute("invalid-fallback")}set invalidFallback(a){a==null?this.removeAttribute("invalid-fallback"):this.setAttribute("invalid-fallback",String(a))}get"invalid-fallback"(){return this.invalidFallback}set"invalid-fallback"(a){this.invalidFallback=a}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=(this.getAttribute("allowed")||"").split(",").map(f=>f.trim()).filter(Boolean),h=this.getAttribute("invalid-fallback")||"Statut non autoris\xE9";if(!a||a==="null"||a==="undefined"||!d.includes(a)){this.textContent=h;return}this.textContent=String(a)}}class s extends HTMLElement{static get observedAttributes(){return["value","alt","fallback"]}get value(){return this.getAttribute("value")}set value(a){a==null?this.removeAttribute("value"):this.setAttribute("value",String(a))}get alt(){return this.getAttribute("alt")}set alt(a){a==null?this.removeAttribute("alt"):this.setAttribute("alt",String(a))}get fallback(){return this.getAttribute("fallback")}set fallback(a){a==null?this.removeAttribute("fallback"):this.setAttribute("fallback",String(a))}attributeChangedCallback(){this.render()}connectedCallback(){this.render()}render(){let a=this.getAttribute("value"),d=this.getAttribute("fallback")||"",h=this.getAttribute("alt")||"Media";this.innerHTML="";let f=document.createElement("img"),A=a&&a!=="null"&&a!=="undefined"&&a.trim()!=="";f.src=A?a:d,f.alt=h,this.appendChild(f)}}class o extends HTMLElement{static get observedAttributes(){return["table","id","field","orphan-fallback","loading-fallback","malformed-fallback"]}get table(){return this.getAttribute("table")}set table(a){a==null?this.removeAttribute("table"):this.setAttribute("table",String(a))}get id(){return this.getAttribute("id")}set id(a){a==null?this.removeAttribute("id"):this.setAttribute("id",String(a))}get field(){return this.getAttribute("field")}set field(a){a==null?this.removeAttribute("field"):this.setAttribute("field",String(a))}get orphanFallback(){return this.getAttribute("orphan-fallback")}set orphanFallback(a){a==null?this.removeAttribute("orphan-fallback"):this.setAttribute("orphan-fallback",String(a))}get"orphan-fallback"(){return this.orphanFallback}set"orphan-fallback"(a){this.orphanFallback=a}get loadingFallback(){return this.getAttribute("loading-fallback")}set loadingFallback(a){a==null?this.removeAttribute("loading-fallback"):this.setAttribute("loading-fallback",String(a))}get"loading-fallback"(){return this.loadingFallback}set"loading-fallback"(a){this.loadingFallback=a}get malformedFallback(){return this.getAttribute("malformed-fallback")}set malformedFallback(a){a==null?this.removeAttribute("malformed-fallback"):this.setAttribute("malformed-fallback",String(a))}get"malformed-fallback"(){return this.malformedFallback}set"malformed-fallback"(a){this.malformedFallback=a}attributeChangedCallback(){this.fetchAndRender()}connectedCallback(){this.fetchAndRender()}async fetchAndRender(){let a=this.getAttribute("table"),d=this.getAttribute("id"),h=this.getAttribute("field")||"name",f=this.getAttribute("orphan-fallback")||"Supprim\xE9",A=this.getAttribute("loading-fallback")||"Chargement...",L=this.getAttribute("malformed-fallback")||"ID invalide";if(!d||typeof d!="string"||d.trim()===""||d==="null"||d==="undefined"){this.textContent=L;return}if(!a){this.textContent=L;return}this.textContent=A;try{let ie=window.Fleetbo||globalThis.Fleetbo;if(!ie||typeof ie.getDoc!="function"){this.textContent=f;return}let M=await ie.getDoc(a,d);M&&M[h]!==void 0?this.textContent=String(M[h]):M?this.textContent=M.name||M.title||M.label||JSON.stringify(M):this.textContent=f}catch{this.textContent=f}}}let c=(l,a)=>{customElements.get(l)||customElements.define(l,a)};c("fleetbo-text",n),c("fleetbo-number",e),c("fleetbo-toggle",t),c("fleetbo-date",i),c("fleetbo-enum",r),c("fleetbo-media",s),c("fleetbo-reference",o)}var Yl={Text:"fleetbo-text",Number:"fleetbo-number",Toggle:"fleetbo-toggle",Date:"fleetbo-date",Enum:"fleetbo-enum",Media:"fleetbo-media",Reference:"fleetbo-reference"};function Ce(n){typeof window>"u"&&typeof process<"u"&&process.env}async function P(n){if(n&&n._schemaVersion&&n._schemaData){let e=n._schemaVersion,t=n._schemaData;if(typeof window<"u")try{await fetch("/__fleetbo_sync_schema",{method:"POST",headers:{"Content-Type":"application/json"},body:JSON.stringify({schema:t,version:e})})}catch{}else typeof process<"u"&&process.env}return n}var w=n=>`https://${n.toLowerCase()}-jqycakhlxa-uc.a.run.app`,Xl=()=>new Proxy({},{get(n,e){let t=String(e);return async(i={})=>{let r=await E(w("call"),{functionName:t,payload:i});return P(r)}}}),ma={...Yl,call:Xl(),add:async(n,e)=>{Ce(n);let t=await E(w("add"),{fleetboTable:n,jsonData:e});return P(t)},addWithId:async(n,e,t)=>{Ce(n);let i=await E(w("addWithId"),{fleetboTable:n,id:t,jsonData:e});return P(i)},addWithUserId:async(n,e)=>{Ce(n);let t=await E(w("addWithUserId"),{fleetboTable:n,jsonData:e});return P(t)},addWithMedia:async(n,e,t,i=null)=>{Ce(n);let r=await E(w("addWithMedia"),{fleetboTable:n,jsonData:e,fileBase64:t,fileName:i});return P(r)},delete:async(n,e)=>{let t=await E(w("delete"),{fleetboTable:n,id:e});return P(t)},getDocsG:async n=>{let e=await E(w("getDocsG"),{fleetboTable:n}),t=await P(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDocsU:async n=>{let e=await E(w("getDocsU"),{fleetboTable:n}),t=await P(e);return Array.isArray(t)?t:t&&Array.isArray(t.data)?t.data:[]},getDoc:async(n,e)=>{let t=await E(w("getDoc"),{fleetboTable:n,id:e}),i=await P(t);return i?i.data!==void 0?i.data:i.success===!1?null:i:null},getUser:async()=>await fa(),getAuthUser:async()=>{let n=await E(w("getAuthUser")),e=await P(n);return e?e.data!==void 0?e.data:e.success===!1?null:e:null},update:async(n,e,t)=>{let i=await E(w("update"),{fleetboTable:n,id:e,...t});return P(i)},join:async(n,e)=>{Ce(n),e?.innerJoin?.collection&&Ce(e.innerJoin.collection);let t=await E(w("join"),{fleetboTable:n,joinOptions:e}),i=await P(t);return Array.isArray(i)?i:i&&Array.isArray(i.data)?i.data:[]},sendotpsvro:async n=>{let e=typeof n=="string"?{email:n}:n||{};return await E(w("sendOtpSvro"),e)},verifyotpsvro:async(n,e)=>{let t=await E(w("verifyOtpSvro"),{email:n,code:e});if(t.success&&t.customToken)try{return{success:!0,user:await Yt(t.customToken)}}catch(i){return{success:!1,error:i.message}}return t},sendOtpByPhone:async n=>{let e=typeof n=="string"?{phoneNumber:n}:n||{};return await E(w("sendOtpByPhone"),e)},verifyOtpPhoneSvro:async(n,e)=>{let t=await E(w("verifyOtpPhoneSvro"),{phoneNumber:n,code:e});if(t.success&&t.customToken)try{return{success:!0,user:await Yt(t.customToken)}}catch(i){return{success:!1,error:i.message}}return t},verifyFacebookAuth:async(n={})=>{let e=typeof n=="string"?n:n?.accessToken,t=typeof window<"u"?window.FB:null;if(!e){if(!t)return{success:!1,error:"Facebook SDK (window.FB) introuvable ou non initialis\xE9."};let s=n?.scope||"public_profile,email",o=await new Promise(c=>{t.login(l=>c(l),{scope:s})});if(!o?.authResponse?.accessToken)return{success:!1,cancelled:!0,error:"Connexion Facebook annul\xE9e par l'utilisateur."};e=o.authResponse.accessToken}let i=await E(w("verifyFacebookAuth"),{accessToken:e}),r=i.customToken||i.token;if(i.success&&r)try{return{success:!0,user:await Yt(r),projects:i.projects||[]}}catch(s){return{success:!1,error:s.message}}return i},isAuthenticated:async(n=!1)=>await pa(n),logout:async()=>{try{return await ha(),{success:!0}}catch(n){return{success:!1,error:n.message}}},acl:{grant:async(n,e,t,i="*")=>await E(w("grantAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:i}),revoke:async(n,e,t,i="*")=>await E(w("revokeAcl"),{targetUserId:n,action:e,resourceTable:t,resourceId:i}),can:async(n,e,t="*")=>{let i=await E(w("checkAcl"),{action:n,resourceTable:e,resourceId:t});return!!(i&&(i.allowed===!0||i.can===!0))}}};typeof globalThis<"u"&&Reflect.set(globalThis,"Fleetbo",ma);typeof window<"u"&&Reflect.set(window,"Fleetbo",ma);export{ma as Fleetbo,Yl as FleetboUI};
|
|
2
2
|
/*! Bundled license information:
|
|
3
3
|
|
|
4
4
|
@firebase/util/dist/index.esm.js:
|