UNPKG

@stanfordspezi/spezi-web-design-system

Version:

Stanford Biodesign Digital Health Spezi Web Design System

1,446 lines 123 kB
import { jsxs as X, jsx as E, Fragment as pt } from "react/jsx-runtime"; import { useTranslations as Qe } from "next-intl"; import { useState as gt } from "react"; import { B as et } from "./Button-C6E7PEI7.mjs"; import { S as _t, a as yt } from "./SeparatorText-e8lkq8Eq.mjs"; import "./index-D1kF7Ir3.mjs"; import { c as Ee } from "./index-2NvaPZWc.mjs"; import { u as vt, b as tt, a as Se } from "./FormError-DkEgM52p.mjs"; import { I as Ce } from "./Input-DDoaYMbN.mjs"; const bt = () => { }; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const rt = function(r) { const e = []; let t = 0; for (let s = 0; s < r.length; s++) { let n = r.charCodeAt(s); n < 128 ? e[t++] = n : n < 2048 ? (e[t++] = n >> 6 | 192, e[t++] = n & 63 | 128) : (n & 64512) === 55296 && s + 1 < r.length && (r.charCodeAt(s + 1) & 64512) === 56320 ? (n = 65536 + ((n & 1023) << 10) + (r.charCodeAt(++s) & 1023), e[t++] = n >> 18 | 240, e[t++] = n >> 12 & 63 | 128, e[t++] = n >> 6 & 63 | 128, e[t++] = n & 63 | 128) : (e[t++] = n >> 12 | 224, e[t++] = n >> 6 & 63 | 128, e[t++] = n & 63 | 128); } return e; }, xt = function(r) { const e = []; let t = 0, s = 0; for (; t < r.length; ) { const n = r[t++]; if (n < 128) e[s++] = String.fromCharCode(n); else if (n > 191 && n < 224) { const a = r[t++]; e[s++] = String.fromCharCode((n & 31) << 6 | a & 63); } else if (n > 239 && n < 365) { const a = r[t++], i = r[t++], o = r[t++], d = ((n & 7) << 18 | (a & 63) << 12 | (i & 63) << 6 | o & 63) - 65536; e[s++] = String.fromCharCode(55296 + (d >> 10)), e[s++] = String.fromCharCode(56320 + (d & 1023)); } else { const a = r[t++], i = r[t++]; e[s++] = String.fromCharCode((n & 15) << 12 | (a & 63) << 6 | i & 63); } } return e.join(""); }, st = { /** * Maps bytes to characters. */ byteToCharMap_: null, /** * Maps characters to bytes. */ charToByteMap_: null, /** * Maps bytes to websafe characters. * @private */ byteToCharMapWebSafe_: null, /** * Maps websafe characters to bytes. * @private */ charToByteMapWebSafe_: null, /** * Our default alphabet, shared between * ENCODED_VALS and ENCODED_VALS_WEBSAFE */ ENCODED_VALS_BASE: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789", /** * Our default alphabet. Value 64 (=) is special; it means "nothing." */ get ENCODED_VALS() { return this.ENCODED_VALS_BASE + "+/="; }, /** * Our websafe alphabet. */ get ENCODED_VALS_WEBSAFE() { return this.ENCODED_VALS_BASE + "-_."; }, /** * Whether this browser supports the atob and btoa functions. This extension * started at Mozilla but is now implemented by many browsers. We use the * ASSUME_* variables to avoid pulling in the full useragent detection library * but still allowing the standard per-browser compilations. * */ HAS_NATIVE_SUPPORT: typeof atob == "function", /** * Base64-encode an array of bytes. * * @param input An array of bytes (numbers with * value in [0, 255]) to encode. * @param webSafe Boolean indicating we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeByteArray(r, e) { if (!Array.isArray(r)) throw Error("encodeByteArray takes an array as a parameter"); this.init_(); const t = e ? this.byteToCharMapWebSafe_ : this.byteToCharMap_, s = []; for (let n = 0; n < r.length; n += 3) { const a = r[n], i = n + 1 < r.length, o = i ? r[n + 1] : 0, d = n + 2 < r.length, u = d ? r[n + 2] : 0, g = a >> 2, w = (a & 3) << 4 | o >> 4; let M = (o & 15) << 2 | u >> 6, Y = u & 63; d || (Y = 64, i || (M = 64)), s.push(t[g], t[w], t[M], t[Y]); } return s.join(""); }, /** * Base64-encode a string. * * @param input A string to encode. * @param webSafe If true, we should use the * alternative alphabet. * @return The base64 encoded string. */ encodeString(r, e) { return this.HAS_NATIVE_SUPPORT && !e ? btoa(r) : this.encodeByteArray(rt(r), e); }, /** * Base64-decode a string. * * @param input to decode. * @param webSafe True if we should use the * alternative alphabet. * @return string representing the decoded value. */ decodeString(r, e) { return this.HAS_NATIVE_SUPPORT && !e ? atob(r) : xt(this.decodeStringToByteArray(r, e)); }, /** * Base64-decode a string. * * In base-64 decoding, groups of four characters are converted into three * bytes. If the encoder did not apply padding, the input length may not * be a multiple of 4. * * In this case, the last group will have fewer than 4 characters, and * padding will be inferred. If the group has one or two characters, it decodes * to one byte. If the group has three characters, it decodes to two bytes. * * @param input Input to decode. * @param webSafe True if we should use the web-safe alphabet. * @return bytes representing the decoded value. */ decodeStringToByteArray(r, e) { this.init_(); const t = e ? this.charToByteMapWebSafe_ : this.charToByteMap_, s = []; for (let n = 0; n < r.length; ) { const a = t[r.charAt(n++)], o = n < r.length ? t[r.charAt(n)] : 0; ++n; const u = n < r.length ? t[r.charAt(n)] : 64; ++n; const w = n < r.length ? t[r.charAt(n)] : 64; if (++n, a == null || o == null || u == null || w == null) throw new wt(); const M = a << 2 | o >> 4; if (s.push(M), u !== 64) { const Y = o << 4 & 240 | u >> 2; if (s.push(Y), w !== 64) { const mt = u << 6 & 192 | w; s.push(mt); } } } return s; }, /** * Lazy static initialization function. Called before * accessing any of the static map variables. * @private */ init_() { if (!this.byteToCharMap_) { this.byteToCharMap_ = {}, this.charToByteMap_ = {}, this.byteToCharMapWebSafe_ = {}, this.charToByteMapWebSafe_ = {}; for (let r = 0; r < this.ENCODED_VALS.length; r++) this.byteToCharMap_[r] = this.ENCODED_VALS.charAt(r), this.charToByteMap_[this.byteToCharMap_[r]] = r, this.byteToCharMapWebSafe_[r] = this.ENCODED_VALS_WEBSAFE.charAt(r), this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[r]] = r, r >= this.ENCODED_VALS_BASE.length && (this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(r)] = r, this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(r)] = r); } } }; class wt extends Error { constructor() { super(...arguments), this.name = "DecodeBase64StringError"; } } const kt = function(r) { const e = rt(r); return st.encodeByteArray(e, !0); }, nt = function(r) { return kt(r).replace(/\./g, ""); }, Et = function(r) { try { return st.decodeString(r, !0); } catch (e) { console.error("base64Decode failed: ", e); } return null; }; /** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function St() { 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."); } /** * @license * Copyright 2022 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const Ct = () => St().__FIREBASE_DEFAULTS__, At = () => { if (typeof process > "u" || typeof process.env > "u") return; const r = process.env.__FIREBASE_DEFAULTS__; if (r) return JSON.parse(r); }, It = () => { if (typeof document > "u") return; let r; try { r = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/); } catch { return; } const e = r && Et(r[1]); return e && JSON.parse(e); }, Tt = () => { try { return bt() || Ct() || At() || It(); } catch (r) { console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${r}`); return; } }, As = (r) => { var e; return (e = Tt()) === null || e === void 0 ? void 0 : e[`_${r}`]; }; /** * @license * Copyright 2025 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function Is(r) { return r.endsWith(".cloudworkstations.dev"); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function Ot() { return typeof navigator < "u" && typeof navigator.userAgent == "string" ? navigator.userAgent : ""; } function Ts() { return typeof window < "u" && // @ts-ignore Setting up an broadly applicable index signature for Window // just to deal with this case would probably be a bad idea. !!(window.cordova || window.phonegap || window.PhoneGap) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Ot()); } function Os() { return typeof navigator < "u" && navigator.userAgent === "Cloudflare-Workers"; } function Ns() { const r = typeof chrome == "object" ? chrome.runtime : typeof browser == "object" ? browser.runtime : void 0; return typeof r == "object" && r.id !== void 0; } function Rs() { return typeof navigator == "object" && navigator.product === "ReactNative"; } function Nt() { try { return typeof indexedDB == "object"; } catch { return !1; } } function Rt() { return new Promise((r, e) => { try { let t = !0; const s = "validate-browser-context-for-indexeddb-analytics-module", n = self.indexedDB.open(s); n.onsuccess = () => { n.result.close(), t || self.indexedDB.deleteDatabase(s), r(!0); }, n.onupgradeneeded = () => { t = !1; }, n.onerror = () => { var a; e(((a = n.error) === null || a === void 0 ? void 0 : a.message) || ""); }; } catch (t) { e(t); } }); } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const Dt = "FirebaseError"; class D extends Error { constructor(e, t, s) { super(t), this.code = e, this.customData = s, this.name = Dt, Object.setPrototypeOf(this, D.prototype), Error.captureStackTrace && Error.captureStackTrace(this, at.prototype.create); } } class at { constructor(e, t, s) { this.service = e, this.serviceName = t, this.errors = s; } create(e, ...t) { const s = t[0] || {}, n = `${this.service}/${e}`, a = this.errors[e], i = a ? Bt(a, s) : "Error", o = `${this.serviceName}: ${i} (${n}).`; return new D(n, o, s); } } function Bt(r, e) { return r.replace($t, (t, s) => { const n = e[s]; return n != null ? String(n) : `<${s}?>`; }); } const $t = /\{\$([^}]+)}/g; /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function Ds(r) { const e = []; for (const [t, s] of Object.entries(r)) Array.isArray(s) ? s.forEach((n) => { e.push(encodeURIComponent(t) + "=" + encodeURIComponent(n)); }) : e.push(encodeURIComponent(t) + "=" + encodeURIComponent(s)); return e.length ? "&" + e.join("&") : ""; } function Bs(r, e) { const t = new jt(r, e); return t.subscribe.bind(t); } class jt { /** * @param executor Function which can make calls to a single Observer * as a proxy. * @param onNoObservers Callback when count of Observers goes to zero. */ 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((s) => { this.error(s); }); } 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 function that can be used to add an Observer to the fan-out list. * * - We require that no event is sent to a subscriber synchronously to their * call to subscribe(). */ subscribe(e, t, s) { let n; if (e === void 0 && t === void 0 && s === void 0) throw new Error("Missing Observer."); Mt(e, [ "next", "error", "complete" ]) ? n = e : n = { next: e, error: t, complete: s }, n.next === void 0 && (n.next = ne), n.error === void 0 && (n.error = ne), n.complete === void 0 && (n.complete = ne); const a = this.unsubscribeOne.bind(this, this.observers.length); return this.finalized && this.task.then(() => { try { this.finalError ? n.error(this.finalError) : n.complete(); } catch { } }), this.observers.push(n), a; } // Unsubscribe is synchronous - we guarantee that no events are sent to // any unsubscribed Observer. 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); } // Call the Observer via one of it's callback function. We are careful to // confirm that the observe has not been unsubscribed since this asynchronous // function had been queued. sendOne(e, t) { this.task.then(() => { if (this.observers !== void 0 && this.observers[e] !== void 0) try { t(this.observers[e]); } catch (s) { typeof console < "u" && console.error && console.error(s); } }); } close(e) { this.finalized || (this.finalized = !0, e !== void 0 && (this.finalError = e), this.task.then(() => { this.observers = void 0, this.onNoObservers = void 0; })); } } function Mt(r, e) { if (typeof r != "object" || r === null) return !1; for (const t of e) if (t in r && typeof r[t] == "function") return !0; return !1; } function ne() { } /** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function $s(r) { return r && r._delegate ? r._delegate : r; } class le { /** * * @param name The public service name, e.g. app, auth, firestore, database * @param instanceFactory Service factory responsible for creating the public interface * @param type whether the service provided by the component is public or private */ constructor(e, t, s) { this.name = e, this.instanceFactory = t, this.type = s, 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; } } /** * @license * Copyright 2017 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var b; (function(r) { r[r.DEBUG = 0] = "DEBUG", r[r.VERBOSE = 1] = "VERBOSE", r[r.INFO = 2] = "INFO", r[r.WARN = 3] = "WARN", r[r.ERROR = 4] = "ERROR", r[r.SILENT = 5] = "SILENT"; })(b || (b = {})); const Zt = { debug: b.DEBUG, verbose: b.VERBOSE, info: b.INFO, warn: b.WARN, error: b.ERROR, silent: b.SILENT }, Pt = b.INFO, Lt = { [b.DEBUG]: "log", [b.VERBOSE]: "log", [b.INFO]: "info", [b.WARN]: "warn", [b.ERROR]: "error" }, Vt = (r, e, ...t) => { if (e < r.logLevel) return; const s = (/* @__PURE__ */ new Date()).toISOString(), n = Lt[e]; if (n) console[n](`[${s}] ${r.name}:`, ...t); else throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`); }; class Ft { /** * Gives you an instance of a Logger to capture messages according to * Firebase's logging scheme. * * @param name The name that the logs will be associated with */ constructor(e) { this.name = e, this._logLevel = Pt, this._logHandler = Vt, this._userLogHandler = null; } get logLevel() { return this._logLevel; } set logLevel(e) { if (!(e in b)) throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``); this._logLevel = e; } // Workaround for setter/getter having to be the same type. setLogLevel(e) { this._logLevel = typeof e == "string" ? Zt[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; } /** * The functions below are all based on the `console` interface */ debug(...e) { this._userLogHandler && this._userLogHandler(this, b.DEBUG, ...e), this._logHandler(this, b.DEBUG, ...e); } log(...e) { this._userLogHandler && this._userLogHandler(this, b.VERBOSE, ...e), this._logHandler(this, b.VERBOSE, ...e); } info(...e) { this._userLogHandler && this._userLogHandler(this, b.INFO, ...e), this._logHandler(this, b.INFO, ...e); } warn(...e) { this._userLogHandler && this._userLogHandler(this, b.WARN, ...e), this._logHandler(this, b.WARN, ...e); } error(...e) { this._userLogHandler && this._userLogHandler(this, b.ERROR, ...e), this._logHandler(this, b.ERROR, ...e); } } const Ut = (r, e) => e.some((t) => r instanceof t); let Ae, Ie; function Ht() { return Ae || (Ae = [ IDBDatabase, IDBObjectStore, IDBIndex, IDBCursor, IDBTransaction ]); } function zt() { return Ie || (Ie = [ IDBCursor.prototype.advance, IDBCursor.prototype.continue, IDBCursor.prototype.continuePrimaryKey ]); } const it = /* @__PURE__ */ new WeakMap(), he = /* @__PURE__ */ new WeakMap(), ot = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), xe = /* @__PURE__ */ new WeakMap(); function Wt(r) { const e = new Promise((t, s) => { const n = () => { r.removeEventListener("success", a), r.removeEventListener("error", i); }, a = () => { t(N(r.result)), n(); }, i = () => { s(r.error), n(); }; r.addEventListener("success", a), r.addEventListener("error", i); }); return e.then((t) => { t instanceof IDBCursor && it.set(t, r); }).catch(() => { }), xe.set(e, r), e; } function Gt(r) { if (he.has(r)) return; const e = new Promise((t, s) => { const n = () => { r.removeEventListener("complete", a), r.removeEventListener("error", i), r.removeEventListener("abort", i); }, a = () => { t(), n(); }, i = () => { s(r.error || new DOMException("AbortError", "AbortError")), n(); }; r.addEventListener("complete", a), r.addEventListener("error", i), r.addEventListener("abort", i); }); he.set(r, e); } let fe = { get(r, e, t) { if (r instanceof IDBTransaction) { if (e === "done") return he.get(r); if (e === "objectStoreNames") return r.objectStoreNames || ot.get(r); if (e === "store") return t.objectStoreNames[1] ? void 0 : t.objectStore(t.objectStoreNames[0]); } return N(r[e]); }, set(r, e, t) { return r[e] = t, !0; }, has(r, e) { return r instanceof IDBTransaction && (e === "done" || e === "store") ? !0 : e in r; } }; function qt(r) { fe = r(fe); } function Jt(r) { return r === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype) ? function(e, ...t) { const s = r.call(ie(this), e, ...t); return ot.set(s, e.sort ? e.sort() : [e]), N(s); } : zt().includes(r) ? function(...e) { return r.apply(ie(this), e), N(it.get(this)); } : function(...e) { return N(r.apply(ie(this), e)); }; } function Yt(r) { return typeof r == "function" ? Jt(r) : (r instanceof IDBTransaction && Gt(r), Ut(r, Ht()) ? new Proxy(r, fe) : r); } function N(r) { if (r instanceof IDBRequest) return Wt(r); if (ae.has(r)) return ae.get(r); const e = Yt(r); return e !== r && (ae.set(r, e), xe.set(e, r)), e; } const ie = (r) => xe.get(r); function Xt(r, e, { blocked: t, upgrade: s, blocking: n, terminated: a } = {}) { const i = indexedDB.open(r, e), o = N(i); return s && i.addEventListener("upgradeneeded", (d) => { s(N(i.result), d.oldVersion, d.newVersion, N(i.transaction), d); }), t && i.addEventListener("blocked", (d) => t( // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405 d.oldVersion, d.newVersion, d )), o.then((d) => { a && d.addEventListener("close", () => a()), n && d.addEventListener("versionchange", (u) => n(u.oldVersion, u.newVersion, u)); }).catch(() => { }), o; } const Kt = ["get", "getKey", "getAll", "getAllKeys", "count"], Qt = ["put", "add", "delete", "clear"], oe = /* @__PURE__ */ new Map(); function Te(r, e) { if (!(r instanceof IDBDatabase && !(e in r) && typeof e == "string")) return; if (oe.get(e)) return oe.get(e); const t = e.replace(/FromIndex$/, ""), s = e !== t, n = Qt.includes(t); if ( // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge. !(t in (s ? IDBIndex : IDBObjectStore).prototype) || !(n || Kt.includes(t)) ) return; const a = async function(i, ...o) { const d = this.transaction(i, n ? "readwrite" : "readonly"); let u = d.store; return s && (u = u.index(o.shift())), (await Promise.all([ u[t](...o), n && d.done ]))[0]; }; return oe.set(e, a), a; } qt((r) => ({ ...r, get: (e, t, s) => Te(e, t) || r.get(e, t, s), has: (e, t) => !!Te(e, t) || r.has(e, t) })); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ class er { constructor(e) { this.container = e; } // In initial implementation, this will be called by installations on // auth token refresh, and installations will send this string. getPlatformInfoString() { return this.container.getProviders().map((t) => { if (tr(t)) { const s = t.getImmediate(); return `${s.library}/${s.version}`; } else return null; }).filter((t) => t).join(" "); } } function tr(r) { const e = r.getComponent(); return (e == null ? void 0 : e.type) === "VERSION"; } const me = "@firebase/app", Oe = "0.13.0"; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const A = new Ft("@firebase/app"), rr = "@firebase/app-compat", sr = "@firebase/analytics-compat", nr = "@firebase/analytics", ar = "@firebase/app-check-compat", ir = "@firebase/app-check", or = "@firebase/auth", cr = "@firebase/auth-compat", dr = "@firebase/database", ur = "@firebase/data-connect", lr = "@firebase/database-compat", hr = "@firebase/functions", fr = "@firebase/functions-compat", mr = "@firebase/installations", pr = "@firebase/installations-compat", gr = "@firebase/messaging", _r = "@firebase/messaging-compat", yr = "@firebase/performance", vr = "@firebase/performance-compat", br = "@firebase/remote-config", xr = "@firebase/remote-config-compat", wr = "@firebase/storage", kr = "@firebase/storage-compat", Er = "@firebase/firestore", Sr = "@firebase/ai", Cr = "@firebase/firestore-compat", Ar = "firebase", Ir = "11.8.0", Tr = { [me]: "fire-core", [rr]: "fire-core-compat", [nr]: "fire-analytics", [sr]: "fire-analytics-compat", [ir]: "fire-app-check", [ar]: "fire-app-check-compat", [or]: "fire-auth", [cr]: "fire-auth-compat", [dr]: "fire-rtdb", [ur]: "fire-data-connect", [lr]: "fire-rtdb-compat", [hr]: "fire-fn", [fr]: "fire-fn-compat", [mr]: "fire-iid", [pr]: "fire-iid-compat", [gr]: "fire-fcm", [_r]: "fire-fcm-compat", [yr]: "fire-perf", [vr]: "fire-perf-compat", [br]: "fire-rc", [xr]: "fire-rc-compat", [wr]: "fire-gcs", [kr]: "fire-gcs-compat", [Er]: "fire-fst", [Cr]: "fire-fst-compat", [Sr]: "fire-vertex", "fire-js": "fire-js", // Platform identifier for JS SDK. [Ar]: "fire-js-all" }; /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const Or = /* @__PURE__ */ new Map(), Nr = /* @__PURE__ */ new Map(), Ne = /* @__PURE__ */ new Map(); function Re(r, e) { try { r.container.addComponent(e); } catch (t) { A.debug(`Component ${e.name} failed to register with FirebaseApp ${r.name}`, t); } } function pe(r) { const e = r.name; if (Ne.has(e)) return A.debug(`There were multiple attempts to register component ${e}.`), !1; Ne.set(e, r); for (const t of Or.values()) Re(t, r); for (const t of Nr.values()) Re(t, r); return !0; } function js(r) { return r == null ? !1 : r.settings !== void 0; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const Rr = { "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." }, we = new at("app", "Firebase", Rr); /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const Ms = Ir; function ce(r, e, t) { var s; let n = (s = Tr[r]) !== null && s !== void 0 ? s : r; t && (n += `-${t}`); const a = n.match(/\s|\//), i = e.match(/\s|\//); if (a || i) { const o = [ `Unable to register library "${n}" with version "${e}":` ]; a && o.push(`library name "${n}" contains illegal characters (whitespace or "/")`), a && i && o.push("and"), i && o.push(`version name "${e}" contains illegal characters (whitespace or "/")`), A.warn(o.join(" ")); return; } pe(new le( `${n}-version`, () => ({ library: n, version: e }), "VERSION" /* ComponentType.VERSION */ )); } /** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const Dr = "firebase-heartbeat-database", Br = 1, W = "firebase-heartbeat-store"; let de = null; function ct() { return de || (de = Xt(Dr, Br, { upgrade: (r, e) => { switch (e) { case 0: try { r.createObjectStore(W); } catch (t) { console.warn(t); } } } }).catch((r) => { throw we.create("idb-open", { originalErrorMessage: r.message }); })), de; } async function $r(r) { try { const t = (await ct()).transaction(W), s = await t.objectStore(W).get(dt(r)); return await t.done, s; } catch (e) { if (e instanceof D) A.warn(e.message); else { const t = we.create("idb-get", { originalErrorMessage: e == null ? void 0 : e.message }); A.warn(t.message); } } } async function De(r, e) { try { const s = (await ct()).transaction(W, "readwrite"); await s.objectStore(W).put(e, dt(r)), await s.done; } catch (t) { if (t instanceof D) A.warn(t.message); else { const s = we.create("idb-set", { originalErrorMessage: t == null ? void 0 : t.message }); A.warn(s.message); } } } function dt(r) { return `${r.name}!${r.options.appId}`; } /** * @license * Copyright 2021 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ const jr = 1024, Mr = 30; class Zr { constructor(e) { this.container = e, this._heartbeatsCache = null; const t = this.container.getProvider("app").getImmediate(); this._storage = new Lr(t), this._heartbeatsCachePromise = this._storage.read().then((s) => (this._heartbeatsCache = s, s)); } /** * Called to report a heartbeat. The function will generate * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it * to IndexedDB. * Note that we only store one heartbeat per day. So if a heartbeat for today is * already logged, subsequent calls to this function in the same day will be ignored. */ async triggerHeartbeat() { var e, t; try { const n = this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(), a = Be(); if (((e = this._heartbeatsCache) === null || e === void 0 ? void 0 : e.heartbeats) == null && (this._heartbeatsCache = await this._heartbeatsCachePromise, ((t = this._heartbeatsCache) === null || t === void 0 ? void 0 : t.heartbeats) == null) || this._heartbeatsCache.lastSentHeartbeatDate === a || this._heartbeatsCache.heartbeats.some((i) => i.date === a)) return; if (this._heartbeatsCache.heartbeats.push({ date: a, agent: n }), this._heartbeatsCache.heartbeats.length > Mr) { const i = Vr(this._heartbeatsCache.heartbeats); this._heartbeatsCache.heartbeats.splice(i, 1); } return this._storage.overwrite(this._heartbeatsCache); } catch (s) { A.warn(s); } } /** * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly. * It also clears all heartbeats from memory as well as in IndexedDB. * * NOTE: Consuming product SDKs should not send the header if this method * returns an empty string. */ async getHeartbeatsHeader() { var e; try { if (this._heartbeatsCache === null && await this._heartbeatsCachePromise, ((e = this._heartbeatsCache) === null || e === void 0 ? void 0 : e.heartbeats) == null || this._heartbeatsCache.heartbeats.length === 0) return ""; const t = Be(), { heartbeatsToSend: s, unsentEntries: n } = Pr(this._heartbeatsCache.heartbeats), a = nt(JSON.stringify({ version: 2, heartbeats: s })); return this._heartbeatsCache.lastSentHeartbeatDate = t, n.length > 0 ? (this._heartbeatsCache.heartbeats = n, await this._storage.overwrite(this._heartbeatsCache)) : (this._heartbeatsCache.heartbeats = [], this._storage.overwrite(this._heartbeatsCache)), a; } catch (t) { return A.warn(t), ""; } } } function Be() { return (/* @__PURE__ */ new Date()).toISOString().substring(0, 10); } function Pr(r, e = jr) { const t = []; let s = r.slice(); for (const n of r) { const a = t.find((i) => i.agent === n.agent); if (a) { if (a.dates.push(n.date), $e(t) > e) { a.dates.pop(); break; } } else if (t.push({ agent: n.agent, dates: [n.date] }), $e(t) > e) { t.pop(); break; } s = s.slice(1); } return { heartbeatsToSend: t, unsentEntries: s }; } class Lr { constructor(e) { this.app = e, this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck(); } async runIndexedDBEnvironmentCheck() { return Nt() ? Rt().then(() => !0).catch(() => !1) : !1; } /** * Read all heartbeats. */ async read() { if (await this._canUseIndexedDBPromise) { const t = await $r(this.app); return t != null && t.heartbeats ? t : { heartbeats: [] }; } else return { heartbeats: [] }; } // overwrite the storage with the provided heartbeats async overwrite(e) { var t; if (await this._canUseIndexedDBPromise) { const n = await this.read(); return De(this.app, { lastSentHeartbeatDate: (t = e.lastSentHeartbeatDate) !== null && t !== void 0 ? t : n.lastSentHeartbeatDate, heartbeats: e.heartbeats }); } else return; } // add heartbeats async add(e) { var t; if (await this._canUseIndexedDBPromise) { const n = await this.read(); return De(this.app, { lastSentHeartbeatDate: (t = e.lastSentHeartbeatDate) !== null && t !== void 0 ? t : n.lastSentHeartbeatDate, heartbeats: [ ...n.heartbeats, ...e.heartbeats ] }); } else return; } } function $e(r) { return nt( // heartbeatsCache wrapper properties JSON.stringify({ version: 2, heartbeats: r }) ).length; } function Vr(r) { if (r.length === 0) return -1; let e = 0, t = r[0].date; for (let s = 1; s < r.length; s++) r[s].date < t && (t = r[s].date, e = s); return e; } /** * @license * Copyright 2019 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ function Fr(r) { pe(new le( "platform-logger", (e) => new er(e), "PRIVATE" /* ComponentType.PRIVATE */ )), pe(new le( "heartbeat", (e) => new Zr(e), "PRIVATE" /* ComponentType.PRIVATE */ )), ce(me, Oe, r), ce(me, Oe, "esm2017"), ce("fire-js", ""); } Fr(""); var v; (function(r) { r.assertEqual = (n) => { }; function e(n) { } r.assertIs = e; function t(n) { throw new Error(); } r.assertNever = t, r.arrayToEnum = (n) => { const a = {}; for (const i of n) a[i] = i; return a; }, r.getValidEnumValues = (n) => { const a = r.objectKeys(n).filter((o) => typeof n[n[o]] != "number"), i = {}; for (const o of a) i[o] = n[o]; return r.objectValues(i); }, r.objectValues = (n) => r.objectKeys(n).map(function(a) { return n[a]; }), r.objectKeys = typeof Object.keys == "function" ? (n) => Object.keys(n) : (n) => { const a = []; for (const i in n) Object.prototype.hasOwnProperty.call(n, i) && a.push(i); return a; }, r.find = (n, a) => { for (const i of n) if (a(i)) return i; }, r.isInteger = typeof Number.isInteger == "function" ? (n) => Number.isInteger(n) : (n) => typeof n == "number" && Number.isFinite(n) && Math.floor(n) === n; function s(n, a = " | ") { return n.map((i) => typeof i == "string" ? `'${i}'` : i).join(a); } r.joinValues = s, r.jsonStringifyReplacer = (n, a) => typeof a == "bigint" ? a.toString() : a; })(v || (v = {})); var je; (function(r) { r.mergeShapes = (e, t) => ({ ...e, ...t // second overwrites first }); })(je || (je = {})); const h = v.arrayToEnum([ "string", "nan", "number", "integer", "float", "boolean", "date", "bigint", "symbol", "function", "undefined", "null", "array", "object", "unknown", "promise", "void", "never", "map", "set" ]), T = (r) => { switch (typeof r) { case "undefined": return h.undefined; case "string": return h.string; case "number": return Number.isNaN(r) ? h.nan : h.number; case "boolean": return h.boolean; case "function": return h.function; case "bigint": return h.bigint; case "symbol": return h.symbol; case "object": return Array.isArray(r) ? h.array : r === null ? h.null : r.then && typeof r.then == "function" && r.catch && typeof r.catch == "function" ? h.promise : typeof Map < "u" && r instanceof Map ? h.map : typeof Set < "u" && r instanceof Set ? h.set : typeof Date < "u" && r instanceof Date ? h.date : h.object; default: return h.unknown; } }, c = v.arrayToEnum([ "invalid_type", "invalid_literal", "custom", "invalid_union", "invalid_union_discriminator", "invalid_enum_value", "unrecognized_keys", "invalid_arguments", "invalid_return_type", "invalid_date", "invalid_string", "too_small", "too_big", "invalid_intersection_types", "not_multiple_of", "not_finite" ]); class I extends Error { get errors() { return this.issues; } constructor(e) { super(), this.issues = [], this.addIssue = (s) => { this.issues = [...this.issues, s]; }, this.addIssues = (s = []) => { this.issues = [...this.issues, ...s]; }; const t = new.target.prototype; Object.setPrototypeOf ? Object.setPrototypeOf(this, t) : this.__proto__ = t, this.name = "ZodError", this.issues = e; } format(e) { const t = e || function(a) { return a.message; }, s = { _errors: [] }, n = (a) => { for (const i of a.issues) if (i.code === "invalid_union") i.unionErrors.map(n); else if (i.code === "invalid_return_type") n(i.returnTypeError); else if (i.code === "invalid_arguments") n(i.argumentsError); else if (i.path.length === 0) s._errors.push(t(i)); else { let o = s, d = 0; for (; d < i.path.length; ) { const u = i.path[d]; d === i.path.length - 1 ? (o[u] = o[u] || { _errors: [] }, o[u]._errors.push(t(i))) : o[u] = o[u] || { _errors: [] }, o = o[u], d++; } } }; return n(this), s; } static assert(e) { if (!(e instanceof I)) throw new Error(`Not a ZodError: ${e}`); } toString() { return this.message; } get message() { return JSON.stringify(this.issues, v.jsonStringifyReplacer, 2); } get isEmpty() { return this.issues.length === 0; } flatten(e = (t) => t.message) { const t = {}, s = []; for (const n of this.issues) n.path.length > 0 ? (t[n.path[0]] = t[n.path[0]] || [], t[n.path[0]].push(e(n))) : s.push(e(n)); return { formErrors: s, fieldErrors: t }; } get formErrors() { return this.flatten(); } } I.create = (r) => new I(r); const ge = (r, e) => { let t; switch (r.code) { case c.invalid_type: r.received === h.undefined ? t = "Required" : t = `Expected ${r.expected}, received ${r.received}`; break; case c.invalid_literal: t = `Invalid literal value, expected ${JSON.stringify(r.expected, v.jsonStringifyReplacer)}`; break; case c.unrecognized_keys: t = `Unrecognized key(s) in object: ${v.joinValues(r.keys, ", ")}`; break; case c.invalid_union: t = "Invalid input"; break; case c.invalid_union_discriminator: t = `Invalid discriminator value. Expected ${v.joinValues(r.options)}`; break; case c.invalid_enum_value: t = `Invalid enum value. Expected ${v.joinValues(r.options)}, received '${r.received}'`; break; case c.invalid_arguments: t = "Invalid function arguments"; break; case c.invalid_return_type: t = "Invalid function return type"; break; case c.invalid_date: t = "Invalid date"; break; case c.invalid_string: typeof r.validation == "object" ? "includes" in r.validation ? (t = `Invalid input: must include "${r.validation.includes}"`, typeof r.validation.position == "number" && (t = `${t} at one or more positions greater than or equal to ${r.validation.position}`)) : "startsWith" in r.validation ? t = `Invalid input: must start with "${r.validation.startsWith}"` : "endsWith" in r.validation ? t = `Invalid input: must end with "${r.validation.endsWith}"` : v.assertNever(r.validation) : r.validation !== "regex" ? t = `Invalid ${r.validation}` : t = "Invalid"; break; case c.too_small: r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "more than"} ${r.minimum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at least" : "over"} ${r.minimum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${r.minimum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly equal to " : r.inclusive ? "greater than or equal to " : "greater than "}${new Date(Number(r.minimum))}` : t = "Invalid input"; break; case c.too_big: r.type === "array" ? t = `Array must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "less than"} ${r.maximum} element(s)` : r.type === "string" ? t = `String must contain ${r.exact ? "exactly" : r.inclusive ? "at most" : "under"} ${r.maximum} character(s)` : r.type === "number" ? t = `Number must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "bigint" ? t = `BigInt must be ${r.exact ? "exactly" : r.inclusive ? "less than or equal to" : "less than"} ${r.maximum}` : r.type === "date" ? t = `Date must be ${r.exact ? "exactly" : r.inclusive ? "smaller than or equal to" : "smaller than"} ${new Date(Number(r.maximum))}` : t = "Invalid input"; break; case c.custom: t = "Invalid input"; break; case c.invalid_intersection_types: t = "Intersection results could not be merged"; break; case c.not_multiple_of: t = `Number must be a multiple of ${r.multipleOf}`; break; case c.not_finite: t = "Number must be finite"; break; defau