prompt-api-polyfill 1.14.1 → 1.14.2
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/backends/firebase.js +1384 -1877
- package/dist/backends/gemini.js +55 -73
- package/dist/backends/openai.js +163 -216
- package/dist/backends/transformers.js +133 -179
- package/dist/chunks/defaults-B5W7MP9T.js +35 -0
- package/dist/prompt-api-polyfill.js +675 -1006
- package/package.json +9 -9
- package/dist/chunks/defaults-CzvdT-At.js +0 -72
|
@@ -1,1886 +1,1393 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
1
|
+
import { n as e, t } from "../chunks/defaults-B5W7MP9T.js";
|
|
2
|
+
import { initializeApp as n } from "firebase/app";
|
|
3
|
+
import { GoogleAIBackend as r, InferenceMode as i, Schema as a, VertexAIBackend as o, getAI as s, getGenerativeModel as c } from "firebase/ai";
|
|
4
|
+
//#region node_modules/@firebase/util/dist/postinstall.mjs
|
|
5
|
+
var l = () => void 0, u = function(e) {
|
|
6
|
+
let t = [], n = 0;
|
|
7
|
+
for (let r = 0; r < e.length; r++) {
|
|
8
|
+
let i = e.charCodeAt(r);
|
|
9
|
+
i < 128 ? t[n++] = i : i < 2048 ? (t[n++] = i >> 6 | 192, t[n++] = i & 63 | 128) : (i & 64512) == 55296 && r + 1 < e.length && (e.charCodeAt(r + 1) & 64512) == 56320 ? (i = 65536 + ((i & 1023) << 10) + (e.charCodeAt(++r) & 1023), t[n++] = i >> 18 | 240, t[n++] = i >> 12 & 63 | 128, t[n++] = i >> 6 & 63 | 128, t[n++] = i & 63 | 128) : (t[n++] = i >> 12 | 224, t[n++] = i >> 6 & 63 | 128, t[n++] = i & 63 | 128);
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
}, d = function(e) {
|
|
13
|
+
let t = [], n = 0, r = 0;
|
|
14
|
+
for (; n < e.length;) {
|
|
15
|
+
let i = e[n++];
|
|
16
|
+
if (i < 128) t[r++] = String.fromCharCode(i);
|
|
17
|
+
else if (i > 191 && i < 224) {
|
|
18
|
+
let a = e[n++];
|
|
19
|
+
t[r++] = String.fromCharCode((i & 31) << 6 | a & 63);
|
|
20
|
+
} else if (i > 239 && i < 365) {
|
|
21
|
+
let a = e[n++], o = e[n++], s = e[n++], c = ((i & 7) << 18 | (a & 63) << 12 | (o & 63) << 6 | s & 63) - 65536;
|
|
22
|
+
t[r++] = String.fromCharCode(55296 + (c >> 10)), t[r++] = String.fromCharCode(56320 + (c & 1023));
|
|
23
|
+
} else {
|
|
24
|
+
let a = e[n++], o = e[n++];
|
|
25
|
+
t[r++] = String.fromCharCode((i & 15) << 12 | (a & 63) << 6 | o & 63);
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
return t.join("");
|
|
29
|
+
}, f = {
|
|
30
|
+
byteToCharMap_: null,
|
|
31
|
+
charToByteMap_: null,
|
|
32
|
+
byteToCharMapWebSafe_: null,
|
|
33
|
+
charToByteMapWebSafe_: null,
|
|
34
|
+
ENCODED_VALS_BASE: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
35
|
+
get ENCODED_VALS() {
|
|
36
|
+
return this.ENCODED_VALS_BASE + "+/=";
|
|
37
|
+
},
|
|
38
|
+
get ENCODED_VALS_WEBSAFE() {
|
|
39
|
+
return this.ENCODED_VALS_BASE + "-_.";
|
|
40
|
+
},
|
|
41
|
+
HAS_NATIVE_SUPPORT: typeof atob == "function",
|
|
42
|
+
encodeByteArray(e, t) {
|
|
43
|
+
if (!Array.isArray(e)) throw Error("encodeByteArray takes an array as a parameter");
|
|
44
|
+
this.init_();
|
|
45
|
+
let n = t ? this.byteToCharMapWebSafe_ : this.byteToCharMap_, r = [];
|
|
46
|
+
for (let t = 0; t < e.length; t += 3) {
|
|
47
|
+
let i = e[t], a = t + 1 < e.length, o = a ? e[t + 1] : 0, s = t + 2 < e.length, c = s ? e[t + 2] : 0, l = i >> 2, u = (i & 3) << 4 | o >> 4, d = (o & 15) << 2 | c >> 6, f = c & 63;
|
|
48
|
+
s || (f = 64, a || (d = 64)), r.push(n[l], n[u], n[d], n[f]);
|
|
49
|
+
}
|
|
50
|
+
return r.join("");
|
|
51
|
+
},
|
|
52
|
+
encodeString(e, t) {
|
|
53
|
+
return this.HAS_NATIVE_SUPPORT && !t ? btoa(e) : this.encodeByteArray(u(e), t);
|
|
54
|
+
},
|
|
55
|
+
decodeString(e, t) {
|
|
56
|
+
return this.HAS_NATIVE_SUPPORT && !t ? atob(e) : d(this.decodeStringToByteArray(e, t));
|
|
57
|
+
},
|
|
58
|
+
decodeStringToByteArray(e, t) {
|
|
59
|
+
this.init_();
|
|
60
|
+
let n = t ? this.charToByteMapWebSafe_ : this.charToByteMap_, r = [];
|
|
61
|
+
for (let t = 0; t < e.length;) {
|
|
62
|
+
let i = n[e.charAt(t++)], a = t < e.length ? n[e.charAt(t)] : 0;
|
|
63
|
+
++t;
|
|
64
|
+
let o = t < e.length ? n[e.charAt(t)] : 64;
|
|
65
|
+
++t;
|
|
66
|
+
let s = t < e.length ? n[e.charAt(t)] : 64;
|
|
67
|
+
if (++t, i == null || a == null || o == null || s == null) throw new ee();
|
|
68
|
+
let c = i << 2 | a >> 4;
|
|
69
|
+
if (r.push(c), o !== 64) {
|
|
70
|
+
let e = a << 4 & 240 | o >> 2;
|
|
71
|
+
if (r.push(e), s !== 64) {
|
|
72
|
+
let e = o << 6 & 192 | s;
|
|
73
|
+
r.push(e);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return r;
|
|
78
|
+
},
|
|
79
|
+
init_() {
|
|
80
|
+
if (!this.byteToCharMap_) {
|
|
81
|
+
this.byteToCharMap_ = {}, this.charToByteMap_ = {}, this.byteToCharMapWebSafe_ = {}, this.charToByteMapWebSafe_ = {};
|
|
82
|
+
for (let e = 0; e < this.ENCODED_VALS.length; e++) this.byteToCharMap_[e] = this.ENCODED_VALS.charAt(e), this.charToByteMap_[this.byteToCharMap_[e]] = e, this.byteToCharMapWebSafe_[e] = this.ENCODED_VALS_WEBSAFE.charAt(e), this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[e]] = e, e >= this.ENCODED_VALS_BASE.length && (this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(e)] = e, this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(e)] = e);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}, ee = class extends Error {
|
|
86
|
+
constructor() {
|
|
87
|
+
super(...arguments), this.name = "DecodeBase64StringError";
|
|
88
|
+
}
|
|
89
|
+
}, te = function(e) {
|
|
90
|
+
let t = u(e);
|
|
91
|
+
return f.encodeByteArray(t, !0);
|
|
92
|
+
}, ne = function(e) {
|
|
93
|
+
return te(e).replace(/\./g, "");
|
|
94
|
+
}, re = function(e) {
|
|
95
|
+
try {
|
|
96
|
+
return f.decodeString(e, !0);
|
|
97
|
+
} catch (e) {
|
|
98
|
+
console.error("base64Decode failed: ", e);
|
|
99
|
+
}
|
|
100
|
+
return null;
|
|
5
101
|
};
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
},
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
* @private
|
|
45
|
-
*/
|
|
46
|
-
byteToCharMapWebSafe_: null,
|
|
47
|
-
/**
|
|
48
|
-
* Maps websafe characters to bytes.
|
|
49
|
-
* @private
|
|
50
|
-
*/
|
|
51
|
-
charToByteMapWebSafe_: null,
|
|
52
|
-
/**
|
|
53
|
-
* Our default alphabet, shared between
|
|
54
|
-
* ENCODED_VALS and ENCODED_VALS_WEBSAFE
|
|
55
|
-
*/
|
|
56
|
-
ENCODED_VALS_BASE: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
|
|
57
|
-
/**
|
|
58
|
-
* Our default alphabet. Value 64 (=) is special; it means "nothing."
|
|
59
|
-
*/
|
|
60
|
-
get ENCODED_VALS() {
|
|
61
|
-
return this.ENCODED_VALS_BASE + "+/=";
|
|
62
|
-
},
|
|
63
|
-
/**
|
|
64
|
-
* Our websafe alphabet.
|
|
65
|
-
*/
|
|
66
|
-
get ENCODED_VALS_WEBSAFE() {
|
|
67
|
-
return this.ENCODED_VALS_BASE + "-_.";
|
|
68
|
-
},
|
|
69
|
-
/**
|
|
70
|
-
* Whether this browser supports the atob and btoa functions. This extension
|
|
71
|
-
* started at Mozilla but is now implemented by many browsers. We use the
|
|
72
|
-
* ASSUME_* variables to avoid pulling in the full useragent detection library
|
|
73
|
-
* but still allowing the standard per-browser compilations.
|
|
74
|
-
*
|
|
75
|
-
*/
|
|
76
|
-
HAS_NATIVE_SUPPORT: typeof atob == "function",
|
|
77
|
-
/**
|
|
78
|
-
* Base64-encode an array of bytes.
|
|
79
|
-
*
|
|
80
|
-
* @param input An array of bytes (numbers with
|
|
81
|
-
* value in [0, 255]) to encode.
|
|
82
|
-
* @param webSafe Boolean indicating we should use the
|
|
83
|
-
* alternative alphabet.
|
|
84
|
-
* @return The base64 encoded string.
|
|
85
|
-
*/
|
|
86
|
-
encodeByteArray(t, e) {
|
|
87
|
-
if (!Array.isArray(t))
|
|
88
|
-
throw Error("encodeByteArray takes an array as a parameter");
|
|
89
|
-
this.init_();
|
|
90
|
-
const r = e ? this.byteToCharMapWebSafe_ : this.byteToCharMap_, n = [];
|
|
91
|
-
for (let s = 0; s < t.length; s += 3) {
|
|
92
|
-
const o = t[s], i = s + 1 < t.length, c = i ? t[s + 1] : 0, a = s + 2 < t.length, l = a ? t[s + 2] : 0, p = o >> 2, f = (o & 3) << 4 | c >> 4;
|
|
93
|
-
let S = (c & 15) << 2 | l >> 6, v = l & 63;
|
|
94
|
-
a || (v = 64, i || (S = 64)), n.push(r[p], r[f], r[S], r[v]);
|
|
95
|
-
}
|
|
96
|
-
return n.join("");
|
|
97
|
-
},
|
|
98
|
-
/**
|
|
99
|
-
* Base64-encode a string.
|
|
100
|
-
*
|
|
101
|
-
* @param input A string to encode.
|
|
102
|
-
* @param webSafe If true, we should use the
|
|
103
|
-
* alternative alphabet.
|
|
104
|
-
* @return The base64 encoded string.
|
|
105
|
-
*/
|
|
106
|
-
encodeString(t, e) {
|
|
107
|
-
return this.HAS_NATIVE_SUPPORT && !e ? btoa(t) : this.encodeByteArray(_e(t), e);
|
|
108
|
-
},
|
|
109
|
-
/**
|
|
110
|
-
* Base64-decode a string.
|
|
111
|
-
*
|
|
112
|
-
* @param input to decode.
|
|
113
|
-
* @param webSafe True if we should use the
|
|
114
|
-
* alternative alphabet.
|
|
115
|
-
* @return string representing the decoded value.
|
|
116
|
-
*/
|
|
117
|
-
decodeString(t, e) {
|
|
118
|
-
return this.HAS_NATIVE_SUPPORT && !e ? atob(t) : Je(this.decodeStringToByteArray(t, e));
|
|
119
|
-
},
|
|
120
|
-
/**
|
|
121
|
-
* Base64-decode a string.
|
|
122
|
-
*
|
|
123
|
-
* In base-64 decoding, groups of four characters are converted into three
|
|
124
|
-
* bytes. If the encoder did not apply padding, the input length may not
|
|
125
|
-
* be a multiple of 4.
|
|
126
|
-
*
|
|
127
|
-
* In this case, the last group will have fewer than 4 characters, and
|
|
128
|
-
* padding will be inferred. If the group has one or two characters, it decodes
|
|
129
|
-
* to one byte. If the group has three characters, it decodes to two bytes.
|
|
130
|
-
*
|
|
131
|
-
* @param input Input to decode.
|
|
132
|
-
* @param webSafe True if we should use the web-safe alphabet.
|
|
133
|
-
* @return bytes representing the decoded value.
|
|
134
|
-
*/
|
|
135
|
-
decodeStringToByteArray(t, e) {
|
|
136
|
-
this.init_();
|
|
137
|
-
const r = e ? this.charToByteMapWebSafe_ : this.charToByteMap_, n = [];
|
|
138
|
-
for (let s = 0; s < t.length; ) {
|
|
139
|
-
const o = r[t.charAt(s++)], c = s < t.length ? r[t.charAt(s)] : 0;
|
|
140
|
-
++s;
|
|
141
|
-
const l = s < t.length ? r[t.charAt(s)] : 64;
|
|
142
|
-
++s;
|
|
143
|
-
const f = s < t.length ? r[t.charAt(s)] : 64;
|
|
144
|
-
if (++s, o == null || c == null || l == null || f == null)
|
|
145
|
-
throw new Ze();
|
|
146
|
-
const S = o << 2 | c >> 4;
|
|
147
|
-
if (n.push(S), l !== 64) {
|
|
148
|
-
const v = c << 4 & 240 | l >> 2;
|
|
149
|
-
if (n.push(v), f !== 64) {
|
|
150
|
-
const ze = l << 6 & 192 | f;
|
|
151
|
-
n.push(ze);
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
}
|
|
155
|
-
return n;
|
|
156
|
-
},
|
|
157
|
-
/**
|
|
158
|
-
* Lazy static initialization function. Called before
|
|
159
|
-
* accessing any of the static map variables.
|
|
160
|
-
* @private
|
|
161
|
-
*/
|
|
162
|
-
init_() {
|
|
163
|
-
if (!this.byteToCharMap_) {
|
|
164
|
-
this.byteToCharMap_ = {}, this.charToByteMap_ = {}, this.byteToCharMapWebSafe_ = {}, this.charToByteMapWebSafe_ = {};
|
|
165
|
-
for (let t = 0; t < this.ENCODED_VALS.length; t++)
|
|
166
|
-
this.byteToCharMap_[t] = this.ENCODED_VALS.charAt(t), this.charToByteMap_[this.byteToCharMap_[t]] = t, this.byteToCharMapWebSafe_[t] = this.ENCODED_VALS_WEBSAFE.charAt(t), this.charToByteMapWebSafe_[this.byteToCharMapWebSafe_[t]] = t, t >= this.ENCODED_VALS_BASE.length && (this.charToByteMap_[this.ENCODED_VALS_WEBSAFE.charAt(t)] = t, this.charToByteMapWebSafe_[this.ENCODED_VALS.charAt(t)] = t);
|
|
167
|
-
}
|
|
168
|
-
}
|
|
102
|
+
function ie() {
|
|
103
|
+
if (typeof self < "u") return self;
|
|
104
|
+
if (typeof window < "u") return window;
|
|
105
|
+
if (typeof global < "u") return global;
|
|
106
|
+
throw Error("Unable to locate global object.");
|
|
107
|
+
}
|
|
108
|
+
var ae = () => ie().__FIREBASE_DEFAULTS__, oe = () => {
|
|
109
|
+
if (typeof process > "u" || process.env === void 0) return;
|
|
110
|
+
let e = process.env.__FIREBASE_DEFAULTS__;
|
|
111
|
+
if (e) return JSON.parse(e);
|
|
112
|
+
}, se = () => {
|
|
113
|
+
if (typeof document > "u") return;
|
|
114
|
+
let e;
|
|
115
|
+
try {
|
|
116
|
+
e = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);
|
|
117
|
+
} catch {
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
let t = e && re(e[1]);
|
|
121
|
+
return t && JSON.parse(t);
|
|
122
|
+
}, ce = () => {
|
|
123
|
+
try {
|
|
124
|
+
return l() || ae() || oe() || se();
|
|
125
|
+
} catch (e) {
|
|
126
|
+
console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${e}`);
|
|
127
|
+
return;
|
|
128
|
+
}
|
|
129
|
+
}, le = () => ce()?.config, p = class {
|
|
130
|
+
constructor() {
|
|
131
|
+
this.reject = () => {}, this.resolve = () => {}, this.promise = new Promise((e, t) => {
|
|
132
|
+
this.resolve = e, this.reject = t;
|
|
133
|
+
});
|
|
134
|
+
}
|
|
135
|
+
wrapCallback(e) {
|
|
136
|
+
return (t, n) => {
|
|
137
|
+
t ? this.reject(t) : this.resolve(n), typeof e == "function" && (this.promise.catch(() => {}), e.length === 1 ? e(t) : e(t, n));
|
|
138
|
+
};
|
|
139
|
+
}
|
|
169
140
|
};
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
141
|
+
function m() {
|
|
142
|
+
try {
|
|
143
|
+
return typeof indexedDB == "object";
|
|
144
|
+
} catch {
|
|
145
|
+
return !1;
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
function ue() {
|
|
149
|
+
return new Promise((e, t) => {
|
|
150
|
+
try {
|
|
151
|
+
let n = !0, r = "validate-browser-context-for-indexeddb-analytics-module", i = self.indexedDB.open(r);
|
|
152
|
+
i.onsuccess = () => {
|
|
153
|
+
i.result.close(), n || self.indexedDB.deleteDatabase(r), e(!0);
|
|
154
|
+
}, i.onupgradeneeded = () => {
|
|
155
|
+
n = !1;
|
|
156
|
+
}, i.onerror = () => {
|
|
157
|
+
t(i.error?.message || "");
|
|
158
|
+
};
|
|
159
|
+
} catch (e) {
|
|
160
|
+
t(e);
|
|
161
|
+
}
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
var de = "FirebaseError", h = class e extends Error {
|
|
165
|
+
constructor(t, n, r) {
|
|
166
|
+
super(n), this.code = t, this.customData = r, this.name = de, Object.setPrototypeOf(this, e.prototype), Error.captureStackTrace && Error.captureStackTrace(this, g.prototype.create);
|
|
167
|
+
}
|
|
168
|
+
}, g = class {
|
|
169
|
+
constructor(e, t, n) {
|
|
170
|
+
this.service = e, this.serviceName = t, this.errors = n;
|
|
171
|
+
}
|
|
172
|
+
create(e, ...t) {
|
|
173
|
+
let n = t[0] || {}, r = `${this.service}/${e}`, i = this.errors[e], a = i ? fe(i, n) : "Error";
|
|
174
|
+
return new h(r, `${this.serviceName}: ${a} (${r}).`, n);
|
|
175
|
+
}
|
|
187
176
|
};
|
|
188
|
-
function
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
}
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
}
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
}
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
}
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
}
|
|
340
|
-
setServiceProps(e) {
|
|
341
|
-
return this.serviceProps = e, this;
|
|
342
|
-
}
|
|
343
|
-
setInstanceCreatedCallback(e) {
|
|
344
|
-
return this.onInstanceCreated = e, this;
|
|
345
|
-
}
|
|
346
|
-
}
|
|
347
|
-
const w = "[DEFAULT]";
|
|
348
|
-
class gt {
|
|
349
|
-
constructor(e, r) {
|
|
350
|
-
this.name = e, this.container = r, this.component = null, this.instances = /* @__PURE__ */ new Map(), this.instancesDeferred = /* @__PURE__ */ new Map(), this.instancesOptions = /* @__PURE__ */ new Map(), this.onInitCallbacks = /* @__PURE__ */ new Map();
|
|
351
|
-
}
|
|
352
|
-
/**
|
|
353
|
-
* @param identifier A provider can provide multiple instances of a service
|
|
354
|
-
* if this.component.multipleInstances is true.
|
|
355
|
-
*/
|
|
356
|
-
get(e) {
|
|
357
|
-
const r = this.normalizeInstanceIdentifier(e);
|
|
358
|
-
if (!this.instancesDeferred.has(r)) {
|
|
359
|
-
const n = new I();
|
|
360
|
-
if (this.instancesDeferred.set(r, n), this.isInitialized(r) || this.shouldAutoInitialize())
|
|
361
|
-
try {
|
|
362
|
-
const s = this.getOrInitializeService({
|
|
363
|
-
instanceIdentifier: r
|
|
364
|
-
});
|
|
365
|
-
s && n.resolve(s);
|
|
366
|
-
} catch {
|
|
367
|
-
}
|
|
368
|
-
}
|
|
369
|
-
return this.instancesDeferred.get(r).promise;
|
|
370
|
-
}
|
|
371
|
-
getImmediate(e) {
|
|
372
|
-
const r = this.normalizeInstanceIdentifier(e?.identifier), n = e?.optional ?? !1;
|
|
373
|
-
if (this.isInitialized(r) || this.shouldAutoInitialize())
|
|
374
|
-
try {
|
|
375
|
-
return this.getOrInitializeService({
|
|
376
|
-
instanceIdentifier: r
|
|
377
|
-
});
|
|
378
|
-
} catch (s) {
|
|
379
|
-
if (n)
|
|
380
|
-
return null;
|
|
381
|
-
throw s;
|
|
382
|
-
}
|
|
383
|
-
else {
|
|
384
|
-
if (n)
|
|
385
|
-
return null;
|
|
386
|
-
throw Error(`Service ${this.name} is not available`);
|
|
387
|
-
}
|
|
388
|
-
}
|
|
389
|
-
getComponent() {
|
|
390
|
-
return this.component;
|
|
391
|
-
}
|
|
392
|
-
setComponent(e) {
|
|
393
|
-
if (e.name !== this.name)
|
|
394
|
-
throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);
|
|
395
|
-
if (this.component)
|
|
396
|
-
throw Error(`Component for ${this.name} has already been provided`);
|
|
397
|
-
if (this.component = e, !!this.shouldAutoInitialize()) {
|
|
398
|
-
if (bt(e))
|
|
399
|
-
try {
|
|
400
|
-
this.getOrInitializeService({ instanceIdentifier: w });
|
|
401
|
-
} catch {
|
|
402
|
-
}
|
|
403
|
-
for (const [r, n] of this.instancesDeferred.entries()) {
|
|
404
|
-
const s = this.normalizeInstanceIdentifier(r);
|
|
405
|
-
try {
|
|
406
|
-
const o = this.getOrInitializeService({
|
|
407
|
-
instanceIdentifier: s
|
|
408
|
-
});
|
|
409
|
-
n.resolve(o);
|
|
410
|
-
} catch {
|
|
411
|
-
}
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
|
-
clearInstance(e = w) {
|
|
416
|
-
this.instancesDeferred.delete(e), this.instancesOptions.delete(e), this.instances.delete(e);
|
|
417
|
-
}
|
|
418
|
-
// app.delete() will call this method on every provider to delete the services
|
|
419
|
-
// TODO: should we mark the provider as deleted?
|
|
420
|
-
async delete() {
|
|
421
|
-
const e = Array.from(this.instances.values());
|
|
422
|
-
await Promise.all([
|
|
423
|
-
...e.filter((r) => "INTERNAL" in r).map((r) => r.INTERNAL.delete()),
|
|
424
|
-
...e.filter((r) => "_delete" in r).map((r) => r._delete())
|
|
425
|
-
]);
|
|
426
|
-
}
|
|
427
|
-
isComponentSet() {
|
|
428
|
-
return this.component != null;
|
|
429
|
-
}
|
|
430
|
-
isInitialized(e = w) {
|
|
431
|
-
return this.instances.has(e);
|
|
432
|
-
}
|
|
433
|
-
getOptions(e = w) {
|
|
434
|
-
return this.instancesOptions.get(e) || {};
|
|
435
|
-
}
|
|
436
|
-
initialize(e = {}) {
|
|
437
|
-
const { options: r = {} } = e, n = this.normalizeInstanceIdentifier(e.instanceIdentifier);
|
|
438
|
-
if (this.isInitialized(n))
|
|
439
|
-
throw Error(`${this.name}(${n}) has already been initialized`);
|
|
440
|
-
if (!this.isComponentSet())
|
|
441
|
-
throw Error(`Component ${this.name} has not been registered yet`);
|
|
442
|
-
const s = this.getOrInitializeService({
|
|
443
|
-
instanceIdentifier: n,
|
|
444
|
-
options: r
|
|
445
|
-
});
|
|
446
|
-
for (const [o, i] of this.instancesDeferred.entries()) {
|
|
447
|
-
const c = this.normalizeInstanceIdentifier(o);
|
|
448
|
-
n === c && i.resolve(s);
|
|
449
|
-
}
|
|
450
|
-
return s;
|
|
451
|
-
}
|
|
452
|
-
/**
|
|
453
|
-
*
|
|
454
|
-
* @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
|
|
455
|
-
* The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
|
|
456
|
-
*
|
|
457
|
-
* @param identifier An optional instance identifier
|
|
458
|
-
* @returns a function to unregister the callback
|
|
459
|
-
*/
|
|
460
|
-
onInit(e, r) {
|
|
461
|
-
const n = this.normalizeInstanceIdentifier(r), s = this.onInitCallbacks.get(n) ?? /* @__PURE__ */ new Set();
|
|
462
|
-
s.add(e), this.onInitCallbacks.set(n, s);
|
|
463
|
-
const o = this.instances.get(n);
|
|
464
|
-
return o && e(o, n), () => {
|
|
465
|
-
s.delete(e);
|
|
466
|
-
};
|
|
467
|
-
}
|
|
468
|
-
/**
|
|
469
|
-
* Invoke onInit callbacks synchronously
|
|
470
|
-
* @param instance the service instance`
|
|
471
|
-
*/
|
|
472
|
-
invokeOnInitCallbacks(e, r) {
|
|
473
|
-
const n = this.onInitCallbacks.get(r);
|
|
474
|
-
if (n)
|
|
475
|
-
for (const s of n)
|
|
476
|
-
try {
|
|
477
|
-
s(e, r);
|
|
478
|
-
} catch {
|
|
479
|
-
}
|
|
480
|
-
}
|
|
481
|
-
getOrInitializeService({ instanceIdentifier: e, options: r = {} }) {
|
|
482
|
-
let n = this.instances.get(e);
|
|
483
|
-
if (!n && this.component && (n = this.component.instanceFactory(this.container, {
|
|
484
|
-
instanceIdentifier: mt(e),
|
|
485
|
-
options: r
|
|
486
|
-
}), this.instances.set(e, n), this.instancesOptions.set(e, r), this.invokeOnInitCallbacks(n, e), this.component.onInstanceCreated))
|
|
487
|
-
try {
|
|
488
|
-
this.component.onInstanceCreated(this.container, e, n);
|
|
489
|
-
} catch {
|
|
490
|
-
}
|
|
491
|
-
return n || null;
|
|
492
|
-
}
|
|
493
|
-
normalizeInstanceIdentifier(e = w) {
|
|
494
|
-
return this.component ? this.component.multipleInstances ? e : w : e;
|
|
495
|
-
}
|
|
496
|
-
shouldAutoInitialize() {
|
|
497
|
-
return !!this.component && this.component.instantiationMode !== "EXPLICIT";
|
|
498
|
-
}
|
|
499
|
-
}
|
|
500
|
-
function mt(t) {
|
|
501
|
-
return t === w ? void 0 : t;
|
|
502
|
-
}
|
|
503
|
-
function bt(t) {
|
|
504
|
-
return t.instantiationMode === "EAGER";
|
|
505
|
-
}
|
|
506
|
-
class Et {
|
|
507
|
-
constructor(e) {
|
|
508
|
-
this.name = e, this.providers = /* @__PURE__ */ new Map();
|
|
509
|
-
}
|
|
510
|
-
/**
|
|
511
|
-
*
|
|
512
|
-
* @param component Component being added
|
|
513
|
-
* @param overwrite When a component with the same name has already been registered,
|
|
514
|
-
* if overwrite is true: overwrite the existing component with the new component and create a new
|
|
515
|
-
* provider with the new component. It can be useful in tests where you want to use different mocks
|
|
516
|
-
* for different tests.
|
|
517
|
-
* if overwrite is false: throw an exception
|
|
518
|
-
*/
|
|
519
|
-
addComponent(e) {
|
|
520
|
-
const r = this.getProvider(e.name);
|
|
521
|
-
if (r.isComponentSet())
|
|
522
|
-
throw new Error(`Component ${e.name} has already been registered with ${this.name}`);
|
|
523
|
-
r.setComponent(e);
|
|
524
|
-
}
|
|
525
|
-
addOrOverwriteComponent(e) {
|
|
526
|
-
this.getProvider(e.name).isComponentSet() && this.providers.delete(e.name), this.addComponent(e);
|
|
527
|
-
}
|
|
528
|
-
/**
|
|
529
|
-
* getProvider provides a type safe interface where it can only be called with a field name
|
|
530
|
-
* present in NameServiceMapping interface.
|
|
531
|
-
*
|
|
532
|
-
* Firebase SDKs providing services should extend NameServiceMapping interface to register
|
|
533
|
-
* themselves.
|
|
534
|
-
*/
|
|
535
|
-
getProvider(e) {
|
|
536
|
-
if (this.providers.has(e))
|
|
537
|
-
return this.providers.get(e);
|
|
538
|
-
const r = new gt(e, this);
|
|
539
|
-
return this.providers.set(e, r), r;
|
|
540
|
-
}
|
|
541
|
-
getProviders() {
|
|
542
|
-
return Array.from(this.providers.values());
|
|
543
|
-
}
|
|
544
|
-
}
|
|
545
|
-
var h;
|
|
546
|
-
(function(t) {
|
|
547
|
-
t[t.DEBUG = 0] = "DEBUG", t[t.VERBOSE = 1] = "VERBOSE", t[t.INFO = 2] = "INFO", t[t.WARN = 3] = "WARN", t[t.ERROR = 4] = "ERROR", t[t.SILENT = 5] = "SILENT";
|
|
548
|
-
})(h || (h = {}));
|
|
549
|
-
const _t = {
|
|
550
|
-
debug: h.DEBUG,
|
|
551
|
-
verbose: h.VERBOSE,
|
|
552
|
-
info: h.INFO,
|
|
553
|
-
warn: h.WARN,
|
|
554
|
-
error: h.ERROR,
|
|
555
|
-
silent: h.SILENT
|
|
556
|
-
}, wt = h.INFO, yt = {
|
|
557
|
-
[h.DEBUG]: "log",
|
|
558
|
-
[h.VERBOSE]: "log",
|
|
559
|
-
[h.INFO]: "info",
|
|
560
|
-
[h.WARN]: "warn",
|
|
561
|
-
[h.ERROR]: "error"
|
|
562
|
-
}, At = (t, e, ...r) => {
|
|
563
|
-
if (e < t.logLevel)
|
|
564
|
-
return;
|
|
565
|
-
const n = (/* @__PURE__ */ new Date()).toISOString(), s = yt[e];
|
|
566
|
-
if (s)
|
|
567
|
-
console[s](`[${n}] ${t.name}:`, ...r);
|
|
568
|
-
else
|
|
569
|
-
throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);
|
|
177
|
+
function fe(e, t) {
|
|
178
|
+
return e.replace(pe, (e, n) => {
|
|
179
|
+
let r = t[n];
|
|
180
|
+
return r == null ? `<${n}?>` : String(r);
|
|
181
|
+
});
|
|
182
|
+
}
|
|
183
|
+
var pe = /\{\$([^}]+)}/g;
|
|
184
|
+
function _(e, t) {
|
|
185
|
+
if (e === t) return !0;
|
|
186
|
+
let n = Object.keys(e), r = Object.keys(t);
|
|
187
|
+
for (let i of n) {
|
|
188
|
+
if (!r.includes(i)) return !1;
|
|
189
|
+
let n = e[i], a = t[i];
|
|
190
|
+
if (me(n) && me(a)) {
|
|
191
|
+
if (!_(n, a)) return !1;
|
|
192
|
+
} else if (n !== a) return !1;
|
|
193
|
+
}
|
|
194
|
+
for (let e of r) if (!n.includes(e)) return !1;
|
|
195
|
+
return !0;
|
|
196
|
+
}
|
|
197
|
+
function me(e) {
|
|
198
|
+
return typeof e == "object" && !!e;
|
|
199
|
+
}
|
|
200
|
+
var he = 1e3, ge = 2, _e = 14400 * 1e3, ve = .5;
|
|
201
|
+
function ye(e, t = he, n = ge) {
|
|
202
|
+
let r = t * n ** +e, i = Math.round(ve * r * (Math.random() - .5) * 2);
|
|
203
|
+
return Math.min(_e, r + i);
|
|
204
|
+
}
|
|
205
|
+
function be(e) {
|
|
206
|
+
return e && e._delegate ? e._delegate : e;
|
|
207
|
+
}
|
|
208
|
+
//#endregion
|
|
209
|
+
//#region node_modules/@firebase/component/dist/esm/index.esm.js
|
|
210
|
+
var v = class {
|
|
211
|
+
constructor(e, t, n) {
|
|
212
|
+
this.name = e, this.instanceFactory = t, this.type = n, this.multipleInstances = !1, this.serviceProps = {}, this.instantiationMode = "LAZY", this.onInstanceCreated = null;
|
|
213
|
+
}
|
|
214
|
+
setInstantiationMode(e) {
|
|
215
|
+
return this.instantiationMode = e, this;
|
|
216
|
+
}
|
|
217
|
+
setMultipleInstances(e) {
|
|
218
|
+
return this.multipleInstances = e, this;
|
|
219
|
+
}
|
|
220
|
+
setServiceProps(e) {
|
|
221
|
+
return this.serviceProps = e, this;
|
|
222
|
+
}
|
|
223
|
+
setInstanceCreatedCallback(e) {
|
|
224
|
+
return this.onInstanceCreated = e, this;
|
|
225
|
+
}
|
|
226
|
+
}, y = "[DEFAULT]", xe = class {
|
|
227
|
+
constructor(e, t) {
|
|
228
|
+
this.name = e, this.container = t, this.component = null, this.instances = /* @__PURE__ */ new Map(), this.instancesDeferred = /* @__PURE__ */ new Map(), this.instancesOptions = /* @__PURE__ */ new Map(), this.onInitCallbacks = /* @__PURE__ */ new Map();
|
|
229
|
+
}
|
|
230
|
+
get(e) {
|
|
231
|
+
let t = this.normalizeInstanceIdentifier(e);
|
|
232
|
+
if (!this.instancesDeferred.has(t)) {
|
|
233
|
+
let e = new p();
|
|
234
|
+
if (this.instancesDeferred.set(t, e), this.isInitialized(t) || this.shouldAutoInitialize()) try {
|
|
235
|
+
let n = this.getOrInitializeService({ instanceIdentifier: t });
|
|
236
|
+
n && e.resolve(n);
|
|
237
|
+
} catch {}
|
|
238
|
+
}
|
|
239
|
+
return this.instancesDeferred.get(t).promise;
|
|
240
|
+
}
|
|
241
|
+
getImmediate(e) {
|
|
242
|
+
let t = this.normalizeInstanceIdentifier(e?.identifier), n = e?.optional ?? !1;
|
|
243
|
+
if (this.isInitialized(t) || this.shouldAutoInitialize()) try {
|
|
244
|
+
return this.getOrInitializeService({ instanceIdentifier: t });
|
|
245
|
+
} catch (e) {
|
|
246
|
+
if (n) return null;
|
|
247
|
+
throw e;
|
|
248
|
+
}
|
|
249
|
+
else if (n) return null;
|
|
250
|
+
else throw Error(`Service ${this.name} is not available`);
|
|
251
|
+
}
|
|
252
|
+
getComponent() {
|
|
253
|
+
return this.component;
|
|
254
|
+
}
|
|
255
|
+
setComponent(e) {
|
|
256
|
+
if (e.name !== this.name) throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);
|
|
257
|
+
if (this.component) throw Error(`Component for ${this.name} has already been provided`);
|
|
258
|
+
if (this.component = e, this.shouldAutoInitialize()) {
|
|
259
|
+
if (Ce(e)) try {
|
|
260
|
+
this.getOrInitializeService({ instanceIdentifier: y });
|
|
261
|
+
} catch {}
|
|
262
|
+
for (let [e, t] of this.instancesDeferred.entries()) {
|
|
263
|
+
let n = this.normalizeInstanceIdentifier(e);
|
|
264
|
+
try {
|
|
265
|
+
let e = this.getOrInitializeService({ instanceIdentifier: n });
|
|
266
|
+
t.resolve(e);
|
|
267
|
+
} catch {}
|
|
268
|
+
}
|
|
269
|
+
}
|
|
270
|
+
}
|
|
271
|
+
clearInstance(e = y) {
|
|
272
|
+
this.instancesDeferred.delete(e), this.instancesOptions.delete(e), this.instances.delete(e);
|
|
273
|
+
}
|
|
274
|
+
async delete() {
|
|
275
|
+
let e = Array.from(this.instances.values());
|
|
276
|
+
await Promise.all([...e.filter((e) => "INTERNAL" in e).map((e) => e.INTERNAL.delete()), ...e.filter((e) => "_delete" in e).map((e) => e._delete())]);
|
|
277
|
+
}
|
|
278
|
+
isComponentSet() {
|
|
279
|
+
return this.component != null;
|
|
280
|
+
}
|
|
281
|
+
isInitialized(e = y) {
|
|
282
|
+
return this.instances.has(e);
|
|
283
|
+
}
|
|
284
|
+
getOptions(e = y) {
|
|
285
|
+
return this.instancesOptions.get(e) || {};
|
|
286
|
+
}
|
|
287
|
+
initialize(e = {}) {
|
|
288
|
+
let { options: t = {} } = e, n = this.normalizeInstanceIdentifier(e.instanceIdentifier);
|
|
289
|
+
if (this.isInitialized(n)) throw Error(`${this.name}(${n}) has already been initialized`);
|
|
290
|
+
if (!this.isComponentSet()) throw Error(`Component ${this.name} has not been registered yet`);
|
|
291
|
+
let r = this.getOrInitializeService({
|
|
292
|
+
instanceIdentifier: n,
|
|
293
|
+
options: t
|
|
294
|
+
});
|
|
295
|
+
for (let [e, t] of this.instancesDeferred.entries()) n === this.normalizeInstanceIdentifier(e) && t.resolve(r);
|
|
296
|
+
return r;
|
|
297
|
+
}
|
|
298
|
+
onInit(e, t) {
|
|
299
|
+
let n = this.normalizeInstanceIdentifier(t), r = this.onInitCallbacks.get(n) ?? /* @__PURE__ */ new Set();
|
|
300
|
+
r.add(e), this.onInitCallbacks.set(n, r);
|
|
301
|
+
let i = this.instances.get(n);
|
|
302
|
+
return i && e(i, n), () => {
|
|
303
|
+
r.delete(e);
|
|
304
|
+
};
|
|
305
|
+
}
|
|
306
|
+
invokeOnInitCallbacks(e, t) {
|
|
307
|
+
let n = this.onInitCallbacks.get(t);
|
|
308
|
+
if (n) for (let r of n) try {
|
|
309
|
+
r(e, t);
|
|
310
|
+
} catch {}
|
|
311
|
+
}
|
|
312
|
+
getOrInitializeService({ instanceIdentifier: e, options: t = {} }) {
|
|
313
|
+
let n = this.instances.get(e);
|
|
314
|
+
if (!n && this.component && (n = this.component.instanceFactory(this.container, {
|
|
315
|
+
instanceIdentifier: Se(e),
|
|
316
|
+
options: t
|
|
317
|
+
}), this.instances.set(e, n), this.instancesOptions.set(e, t), this.invokeOnInitCallbacks(n, e), this.component.onInstanceCreated)) try {
|
|
318
|
+
this.component.onInstanceCreated(this.container, e, n);
|
|
319
|
+
} catch {}
|
|
320
|
+
return n || null;
|
|
321
|
+
}
|
|
322
|
+
normalizeInstanceIdentifier(e = y) {
|
|
323
|
+
return this.component ? this.component.multipleInstances ? e : y : e;
|
|
324
|
+
}
|
|
325
|
+
shouldAutoInitialize() {
|
|
326
|
+
return !!this.component && this.component.instantiationMode !== "EXPLICIT";
|
|
327
|
+
}
|
|
570
328
|
};
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
|
|
584
|
-
|
|
585
|
-
|
|
586
|
-
|
|
587
|
-
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
596
|
-
|
|
597
|
-
|
|
598
|
-
|
|
599
|
-
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
621
|
-
|
|
622
|
-
|
|
623
|
-
|
|
624
|
-
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
|
|
628
|
-
|
|
629
|
-
|
|
630
|
-
|
|
631
|
-
|
|
632
|
-
|
|
633
|
-
|
|
634
|
-
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
function
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
}
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
329
|
+
function Se(e) {
|
|
330
|
+
return e === y ? void 0 : e;
|
|
331
|
+
}
|
|
332
|
+
function Ce(e) {
|
|
333
|
+
return e.instantiationMode === "EAGER";
|
|
334
|
+
}
|
|
335
|
+
var we = class {
|
|
336
|
+
constructor(e) {
|
|
337
|
+
this.name = e, this.providers = /* @__PURE__ */ new Map();
|
|
338
|
+
}
|
|
339
|
+
addComponent(e) {
|
|
340
|
+
let t = this.getProvider(e.name);
|
|
341
|
+
if (t.isComponentSet()) throw Error(`Component ${e.name} has already been registered with ${this.name}`);
|
|
342
|
+
t.setComponent(e);
|
|
343
|
+
}
|
|
344
|
+
addOrOverwriteComponent(e) {
|
|
345
|
+
this.getProvider(e.name).isComponentSet() && this.providers.delete(e.name), this.addComponent(e);
|
|
346
|
+
}
|
|
347
|
+
getProvider(e) {
|
|
348
|
+
if (this.providers.has(e)) return this.providers.get(e);
|
|
349
|
+
let t = new xe(e, this);
|
|
350
|
+
return this.providers.set(e, t), t;
|
|
351
|
+
}
|
|
352
|
+
getProviders() {
|
|
353
|
+
return Array.from(this.providers.values());
|
|
354
|
+
}
|
|
355
|
+
}, Te = [], b;
|
|
356
|
+
(function(e) {
|
|
357
|
+
e[e.DEBUG = 0] = "DEBUG", e[e.VERBOSE = 1] = "VERBOSE", e[e.INFO = 2] = "INFO", e[e.WARN = 3] = "WARN", e[e.ERROR = 4] = "ERROR", e[e.SILENT = 5] = "SILENT";
|
|
358
|
+
})(b ||= {});
|
|
359
|
+
var Ee = {
|
|
360
|
+
debug: b.DEBUG,
|
|
361
|
+
verbose: b.VERBOSE,
|
|
362
|
+
info: b.INFO,
|
|
363
|
+
warn: b.WARN,
|
|
364
|
+
error: b.ERROR,
|
|
365
|
+
silent: b.SILENT
|
|
366
|
+
}, De = b.INFO, Oe = {
|
|
367
|
+
[b.DEBUG]: "log",
|
|
368
|
+
[b.VERBOSE]: "log",
|
|
369
|
+
[b.INFO]: "info",
|
|
370
|
+
[b.WARN]: "warn",
|
|
371
|
+
[b.ERROR]: "error"
|
|
372
|
+
}, ke = (e, t, ...n) => {
|
|
373
|
+
if (t < e.logLevel) return;
|
|
374
|
+
let r = (/* @__PURE__ */ new Date()).toISOString(), i = Oe[t];
|
|
375
|
+
if (i) console[i](`[${r}] ${e.name}:`, ...n);
|
|
376
|
+
else throw Error(`Attempted to log a message with an invalid logType (value: ${t})`);
|
|
377
|
+
}, Ae = class {
|
|
378
|
+
constructor(e) {
|
|
379
|
+
this.name = e, this._logLevel = De, this._logHandler = ke, this._userLogHandler = null, Te.push(this);
|
|
380
|
+
}
|
|
381
|
+
get logLevel() {
|
|
382
|
+
return this._logLevel;
|
|
383
|
+
}
|
|
384
|
+
set logLevel(e) {
|
|
385
|
+
if (!(e in b)) throw TypeError(`Invalid value "${e}" assigned to \`logLevel\``);
|
|
386
|
+
this._logLevel = e;
|
|
387
|
+
}
|
|
388
|
+
setLogLevel(e) {
|
|
389
|
+
this._logLevel = typeof e == "string" ? Ee[e] : e;
|
|
390
|
+
}
|
|
391
|
+
get logHandler() {
|
|
392
|
+
return this._logHandler;
|
|
393
|
+
}
|
|
394
|
+
set logHandler(e) {
|
|
395
|
+
if (typeof e != "function") throw TypeError("Value assigned to `logHandler` must be a function");
|
|
396
|
+
this._logHandler = e;
|
|
397
|
+
}
|
|
398
|
+
get userLogHandler() {
|
|
399
|
+
return this._userLogHandler;
|
|
400
|
+
}
|
|
401
|
+
set userLogHandler(e) {
|
|
402
|
+
this._userLogHandler = e;
|
|
403
|
+
}
|
|
404
|
+
debug(...e) {
|
|
405
|
+
this._userLogHandler && this._userLogHandler(this, b.DEBUG, ...e), this._logHandler(this, b.DEBUG, ...e);
|
|
406
|
+
}
|
|
407
|
+
log(...e) {
|
|
408
|
+
this._userLogHandler && this._userLogHandler(this, b.VERBOSE, ...e), this._logHandler(this, b.VERBOSE, ...e);
|
|
409
|
+
}
|
|
410
|
+
info(...e) {
|
|
411
|
+
this._userLogHandler && this._userLogHandler(this, b.INFO, ...e), this._logHandler(this, b.INFO, ...e);
|
|
412
|
+
}
|
|
413
|
+
warn(...e) {
|
|
414
|
+
this._userLogHandler && this._userLogHandler(this, b.WARN, ...e), this._logHandler(this, b.WARN, ...e);
|
|
415
|
+
}
|
|
416
|
+
error(...e) {
|
|
417
|
+
this._userLogHandler && this._userLogHandler(this, b.ERROR, ...e), this._logHandler(this, b.ERROR, ...e);
|
|
418
|
+
}
|
|
419
|
+
}, je = (e, t) => t.some((t) => e instanceof t), Me, Ne;
|
|
420
|
+
function Pe() {
|
|
421
|
+
return Me ||= [
|
|
422
|
+
IDBDatabase,
|
|
423
|
+
IDBObjectStore,
|
|
424
|
+
IDBIndex,
|
|
425
|
+
IDBCursor,
|
|
426
|
+
IDBTransaction
|
|
427
|
+
];
|
|
428
|
+
}
|
|
429
|
+
function Fe() {
|
|
430
|
+
return Ne ||= [
|
|
431
|
+
IDBCursor.prototype.advance,
|
|
432
|
+
IDBCursor.prototype.continue,
|
|
433
|
+
IDBCursor.prototype.continuePrimaryKey
|
|
434
|
+
];
|
|
435
|
+
}
|
|
436
|
+
var Ie = /* @__PURE__ */ new WeakMap(), x = /* @__PURE__ */ new WeakMap(), Le = /* @__PURE__ */ new WeakMap(), S = /* @__PURE__ */ new WeakMap(), C = /* @__PURE__ */ new WeakMap();
|
|
437
|
+
function Re(e) {
|
|
438
|
+
let t = new Promise((t, n) => {
|
|
439
|
+
let r = () => {
|
|
440
|
+
e.removeEventListener("success", i), e.removeEventListener("error", a);
|
|
441
|
+
}, i = () => {
|
|
442
|
+
t(T(e.result)), r();
|
|
443
|
+
}, a = () => {
|
|
444
|
+
n(e.error), r();
|
|
445
|
+
};
|
|
446
|
+
e.addEventListener("success", i), e.addEventListener("error", a);
|
|
447
|
+
});
|
|
448
|
+
return t.then((t) => {
|
|
449
|
+
t instanceof IDBCursor && Ie.set(t, e);
|
|
450
|
+
}).catch(() => {}), C.set(t, e), t;
|
|
451
|
+
}
|
|
452
|
+
function ze(e) {
|
|
453
|
+
if (x.has(e)) return;
|
|
454
|
+
let t = new Promise((t, n) => {
|
|
455
|
+
let r = () => {
|
|
456
|
+
e.removeEventListener("complete", i), e.removeEventListener("error", a), e.removeEventListener("abort", a);
|
|
457
|
+
}, i = () => {
|
|
458
|
+
t(), r();
|
|
459
|
+
}, a = () => {
|
|
460
|
+
n(e.error || new DOMException("AbortError", "AbortError")), r();
|
|
461
|
+
};
|
|
462
|
+
e.addEventListener("complete", i), e.addEventListener("error", a), e.addEventListener("abort", a);
|
|
463
|
+
});
|
|
464
|
+
x.set(e, t);
|
|
465
|
+
}
|
|
466
|
+
var w = {
|
|
467
|
+
get(e, t, n) {
|
|
468
|
+
if (e instanceof IDBTransaction) {
|
|
469
|
+
if (t === "done") return x.get(e);
|
|
470
|
+
if (t === "objectStoreNames") return e.objectStoreNames || Le.get(e);
|
|
471
|
+
if (t === "store") return n.objectStoreNames[1] ? void 0 : n.objectStore(n.objectStoreNames[0]);
|
|
472
|
+
}
|
|
473
|
+
return T(e[t]);
|
|
474
|
+
},
|
|
475
|
+
set(e, t, n) {
|
|
476
|
+
return e[t] = n, !0;
|
|
477
|
+
},
|
|
478
|
+
has(e, t) {
|
|
479
|
+
return e instanceof IDBTransaction && (t === "done" || t === "store") ? !0 : t in e;
|
|
480
|
+
}
|
|
694
481
|
};
|
|
695
|
-
function
|
|
696
|
-
|
|
697
|
-
}
|
|
698
|
-
function
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
}
|
|
708
|
-
function
|
|
709
|
-
|
|
710
|
-
}
|
|
711
|
-
function
|
|
712
|
-
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
function
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
|
|
735
|
-
|
|
736
|
-
|
|
737
|
-
|
|
738
|
-
|
|
739
|
-
|
|
740
|
-
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
}
|
|
756
|
-
St((t) => ({
|
|
757
|
-
...t,
|
|
758
|
-
get: (e, r, n) => ce(e, r) || t.get(e, r, n),
|
|
759
|
-
has: (e, r) => !!ce(e, r) || t.has(e, r)
|
|
482
|
+
function Be(e) {
|
|
483
|
+
w = e(w);
|
|
484
|
+
}
|
|
485
|
+
function Ve(e) {
|
|
486
|
+
return e === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype) ? function(t, ...n) {
|
|
487
|
+
let r = e.call(E(this), t, ...n);
|
|
488
|
+
return Le.set(r, t.sort ? t.sort() : [t]), T(r);
|
|
489
|
+
} : Fe().includes(e) ? function(...t) {
|
|
490
|
+
return e.apply(E(this), t), T(Ie.get(this));
|
|
491
|
+
} : function(...t) {
|
|
492
|
+
return T(e.apply(E(this), t));
|
|
493
|
+
};
|
|
494
|
+
}
|
|
495
|
+
function He(e) {
|
|
496
|
+
return typeof e == "function" ? Ve(e) : (e instanceof IDBTransaction && ze(e), je(e, Pe()) ? new Proxy(e, w) : e);
|
|
497
|
+
}
|
|
498
|
+
function T(e) {
|
|
499
|
+
if (e instanceof IDBRequest) return Re(e);
|
|
500
|
+
if (S.has(e)) return S.get(e);
|
|
501
|
+
let t = He(e);
|
|
502
|
+
return t !== e && (S.set(e, t), C.set(t, e)), t;
|
|
503
|
+
}
|
|
504
|
+
var E = (e) => C.get(e);
|
|
505
|
+
//#endregion
|
|
506
|
+
//#region node_modules/idb/build/index.js
|
|
507
|
+
function Ue(e, t, { blocked: n, upgrade: r, blocking: i, terminated: a } = {}) {
|
|
508
|
+
let o = indexedDB.open(e, t), s = T(o);
|
|
509
|
+
return r && o.addEventListener("upgradeneeded", (e) => {
|
|
510
|
+
r(T(o.result), e.oldVersion, e.newVersion, T(o.transaction), e);
|
|
511
|
+
}), n && o.addEventListener("blocked", (e) => n(e.oldVersion, e.newVersion, e)), s.then((e) => {
|
|
512
|
+
a && e.addEventListener("close", () => a()), i && e.addEventListener("versionchange", (e) => i(e.oldVersion, e.newVersion, e));
|
|
513
|
+
}).catch(() => {}), s;
|
|
514
|
+
}
|
|
515
|
+
var We = [
|
|
516
|
+
"get",
|
|
517
|
+
"getKey",
|
|
518
|
+
"getAll",
|
|
519
|
+
"getAllKeys",
|
|
520
|
+
"count"
|
|
521
|
+
], Ge = [
|
|
522
|
+
"put",
|
|
523
|
+
"add",
|
|
524
|
+
"delete",
|
|
525
|
+
"clear"
|
|
526
|
+
], D = /* @__PURE__ */ new Map();
|
|
527
|
+
function Ke(e, t) {
|
|
528
|
+
if (!(e instanceof IDBDatabase && !(t in e) && typeof t == "string")) return;
|
|
529
|
+
if (D.get(t)) return D.get(t);
|
|
530
|
+
let n = t.replace(/FromIndex$/, ""), r = t !== n, i = Ge.includes(n);
|
|
531
|
+
if (!(n in (r ? IDBIndex : IDBObjectStore).prototype) || !(i || We.includes(n))) return;
|
|
532
|
+
let a = async function(e, ...t) {
|
|
533
|
+
let a = this.transaction(e, i ? "readwrite" : "readonly"), o = a.store;
|
|
534
|
+
return r && (o = o.index(t.shift())), (await Promise.all([o[n](...t), i && a.done]))[0];
|
|
535
|
+
};
|
|
536
|
+
return D.set(t, a), a;
|
|
537
|
+
}
|
|
538
|
+
Be((e) => ({
|
|
539
|
+
...e,
|
|
540
|
+
get: (t, n, r) => Ke(t, n) || e.get(t, n, r),
|
|
541
|
+
has: (t, n) => !!Ke(t, n) || e.has(t, n)
|
|
760
542
|
}));
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
}
|
|
776
|
-
}
|
|
777
|
-
function Nt(t) {
|
|
778
|
-
return t.getComponent()?.type === "VERSION";
|
|
779
|
-
}
|
|
780
|
-
const W = "@firebase/app", le = "0.14.9";
|
|
781
|
-
const g = new Ie("@firebase/app"), $t = "@firebase/app-compat", xt = "@firebase/analytics-compat", Lt = "@firebase/analytics", Ht = "@firebase/app-check-compat", Ft = "@firebase/app-check", zt = "@firebase/auth", Ut = "@firebase/auth-compat", Vt = "@firebase/database", Wt = "@firebase/data-connect", Kt = "@firebase/database-compat", jt = "@firebase/functions", Gt = "@firebase/functions-compat", qt = "@firebase/installations", Xt = "@firebase/installations-compat", Yt = "@firebase/messaging", Jt = "@firebase/messaging-compat", Zt = "@firebase/performance", Qt = "@firebase/performance-compat", er = "@firebase/remote-config", tr = "@firebase/remote-config-compat", rr = "@firebase/storage", nr = "@firebase/storage-compat", sr = "@firebase/firestore", or = "@firebase/ai", ir = "@firebase/firestore-compat", ar = "firebase";
|
|
782
|
-
const K = "[DEFAULT]", cr = {
|
|
783
|
-
[W]: "fire-core",
|
|
784
|
-
[$t]: "fire-core-compat",
|
|
785
|
-
[Lt]: "fire-analytics",
|
|
786
|
-
[xt]: "fire-analytics-compat",
|
|
787
|
-
[Ft]: "fire-app-check",
|
|
788
|
-
[Ht]: "fire-app-check-compat",
|
|
789
|
-
[zt]: "fire-auth",
|
|
790
|
-
[Ut]: "fire-auth-compat",
|
|
791
|
-
[Vt]: "fire-rtdb",
|
|
792
|
-
[Wt]: "fire-data-connect",
|
|
793
|
-
[Kt]: "fire-rtdb-compat",
|
|
794
|
-
[jt]: "fire-fn",
|
|
795
|
-
[Gt]: "fire-fn-compat",
|
|
796
|
-
[qt]: "fire-iid",
|
|
797
|
-
[Xt]: "fire-iid-compat",
|
|
798
|
-
[Yt]: "fire-fcm",
|
|
799
|
-
[Jt]: "fire-fcm-compat",
|
|
800
|
-
[Zt]: "fire-perf",
|
|
801
|
-
[Qt]: "fire-perf-compat",
|
|
802
|
-
[er]: "fire-rc",
|
|
803
|
-
[tr]: "fire-rc-compat",
|
|
804
|
-
[rr]: "fire-gcs",
|
|
805
|
-
[nr]: "fire-gcs-compat",
|
|
806
|
-
[sr]: "fire-fst",
|
|
807
|
-
[ir]: "fire-fst-compat",
|
|
808
|
-
[or]: "fire-vertex",
|
|
809
|
-
"fire-js": "fire-js",
|
|
810
|
-
// Platform identifier for JS SDK.
|
|
811
|
-
[ar]: "fire-js-all"
|
|
543
|
+
//#endregion
|
|
544
|
+
//#region node_modules/@firebase/app/dist/esm/index.esm.js
|
|
545
|
+
var qe = class {
|
|
546
|
+
constructor(e) {
|
|
547
|
+
this.container = e;
|
|
548
|
+
}
|
|
549
|
+
getPlatformInfoString() {
|
|
550
|
+
return this.container.getProviders().map((e) => {
|
|
551
|
+
if (Je(e)) {
|
|
552
|
+
let t = e.getImmediate();
|
|
553
|
+
return `${t.library}/${t.version}`;
|
|
554
|
+
} else return null;
|
|
555
|
+
}).filter((e) => e).join(" ");
|
|
556
|
+
}
|
|
812
557
|
};
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
|
|
816
|
-
|
|
817
|
-
|
|
818
|
-
|
|
819
|
-
|
|
820
|
-
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
824
|
-
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
831
|
-
|
|
832
|
-
|
|
833
|
-
|
|
834
|
-
|
|
835
|
-
|
|
836
|
-
|
|
837
|
-
|
|
838
|
-
|
|
839
|
-
|
|
840
|
-
|
|
841
|
-
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
845
|
-
|
|
846
|
-
|
|
847
|
-
|
|
848
|
-
|
|
849
|
-
|
|
850
|
-
|
|
851
|
-
}
|
|
852
|
-
|
|
853
|
-
|
|
854
|
-
|
|
855
|
-
|
|
856
|
-
|
|
857
|
-
|
|
858
|
-
|
|
859
|
-
|
|
860
|
-
|
|
861
|
-
|
|
862
|
-
|
|
863
|
-
|
|
864
|
-
|
|
865
|
-
|
|
866
|
-
|
|
867
|
-
|
|
868
|
-
|
|
869
|
-
|
|
870
|
-
|
|
871
|
-
|
|
872
|
-
|
|
873
|
-
|
|
874
|
-
|
|
875
|
-
|
|
876
|
-
|
|
877
|
-
|
|
878
|
-
|
|
879
|
-
|
|
880
|
-
|
|
881
|
-
|
|
882
|
-
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
|
|
886
|
-
|
|
887
|
-
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
|
|
901
|
-
|
|
902
|
-
|
|
903
|
-
|
|
904
|
-
|
|
905
|
-
|
|
906
|
-
|
|
907
|
-
|
|
908
|
-
|
|
909
|
-
|
|
910
|
-
|
|
911
|
-
|
|
912
|
-
|
|
913
|
-
|
|
914
|
-
|
|
915
|
-
|
|
916
|
-
|
|
917
|
-
|
|
918
|
-
|
|
919
|
-
|
|
920
|
-
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
|
|
928
|
-
|
|
929
|
-
|
|
930
|
-
|
|
931
|
-
|
|
932
|
-
|
|
933
|
-
|
|
934
|
-
|
|
935
|
-
|
|
936
|
-
|
|
937
|
-
|
|
938
|
-
|
|
939
|
-
|
|
940
|
-
|
|
941
|
-
|
|
942
|
-
|
|
943
|
-
|
|
944
|
-
|
|
945
|
-
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
949
|
-
|
|
950
|
-
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
954
|
-
|
|
955
|
-
|
|
956
|
-
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
975
|
-
|
|
976
|
-
|
|
977
|
-
|
|
978
|
-
|
|
979
|
-
|
|
980
|
-
|
|
981
|
-
|
|
982
|
-
|
|
983
|
-
|
|
984
|
-
|
|
985
|
-
|
|
986
|
-
|
|
987
|
-
|
|
988
|
-
|
|
989
|
-
|
|
990
|
-
|
|
991
|
-
|
|
992
|
-
|
|
993
|
-
|
|
994
|
-
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
|
|
1006
|
-
|
|
1007
|
-
|
|
1008
|
-
|
|
1009
|
-
|
|
1010
|
-
|
|
1011
|
-
|
|
1012
|
-
|
|
1013
|
-
|
|
1014
|
-
|
|
1015
|
-
|
|
1016
|
-
|
|
1017
|
-
|
|
1018
|
-
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
|
|
1022
|
-
|
|
1023
|
-
|
|
1024
|
-
|
|
1025
|
-
|
|
1026
|
-
|
|
1027
|
-
|
|
1028
|
-
|
|
1029
|
-
|
|
1030
|
-
|
|
1031
|
-
|
|
1032
|
-
|
|
1033
|
-
|
|
1034
|
-
|
|
1035
|
-
|
|
1036
|
-
|
|
1037
|
-
|
|
1038
|
-
|
|
1039
|
-
|
|
1040
|
-
|
|
1041
|
-
|
|
1042
|
-
|
|
1043
|
-
|
|
1044
|
-
|
|
1045
|
-
|
|
1046
|
-
|
|
1047
|
-
|
|
1048
|
-
|
|
1049
|
-
|
|
1050
|
-
}
|
|
1051
|
-
|
|
1052
|
-
|
|
1053
|
-
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
|
|
1089
|
-
|
|
1090
|
-
|
|
1091
|
-
|
|
1092
|
-
|
|
1093
|
-
|
|
1094
|
-
|
|
1095
|
-
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
|
|
1101
|
-
|
|
1102
|
-
|
|
1103
|
-
|
|
1104
|
-
|
|
1105
|
-
|
|
1106
|
-
|
|
1107
|
-
|
|
1108
|
-
|
|
1109
|
-
|
|
1110
|
-
|
|
1111
|
-
|
|
1112
|
-
|
|
1113
|
-
|
|
1114
|
-
|
|
1115
|
-
|
|
1116
|
-
|
|
1117
|
-
}
|
|
1118
|
-
|
|
1119
|
-
|
|
1120
|
-
|
|
1121
|
-
|
|
1122
|
-
|
|
1123
|
-
|
|
1124
|
-
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
1129
|
-
|
|
1130
|
-
|
|
1131
|
-
}
|
|
1132
|
-
|
|
1133
|
-
|
|
1134
|
-
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
|
|
1138
|
-
|
|
1139
|
-
|
|
1140
|
-
|
|
1141
|
-
|
|
1142
|
-
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
|
|
1146
|
-
|
|
1147
|
-
|
|
1148
|
-
|
|
1149
|
-
}
|
|
1150
|
-
|
|
1151
|
-
|
|
558
|
+
function Je(e) {
|
|
559
|
+
return e.getComponent()?.type === "VERSION";
|
|
560
|
+
}
|
|
561
|
+
var O = "@firebase/app", Ye = "0.14.10", k = new Ae("@firebase/app"), Xe = "@firebase/app-compat", Ze = "@firebase/analytics-compat", Qe = "@firebase/analytics", $e = "@firebase/app-check-compat", et = "@firebase/app-check", tt = "@firebase/auth", nt = "@firebase/auth-compat", rt = "@firebase/database", it = "@firebase/data-connect", at = "@firebase/database-compat", ot = "@firebase/functions", st = "@firebase/functions-compat", ct = "@firebase/installations", lt = "@firebase/installations-compat", ut = "@firebase/messaging", dt = "@firebase/messaging-compat", ft = "@firebase/performance", pt = "@firebase/performance-compat", mt = "@firebase/remote-config", ht = "@firebase/remote-config-compat", gt = "@firebase/storage", _t = "@firebase/storage-compat", vt = "@firebase/firestore", yt = "@firebase/ai", bt = "@firebase/firestore-compat", xt = "firebase", St = "[DEFAULT]", Ct = {
|
|
562
|
+
[O]: "fire-core",
|
|
563
|
+
[Xe]: "fire-core-compat",
|
|
564
|
+
[Qe]: "fire-analytics",
|
|
565
|
+
[Ze]: "fire-analytics-compat",
|
|
566
|
+
[et]: "fire-app-check",
|
|
567
|
+
[$e]: "fire-app-check-compat",
|
|
568
|
+
[tt]: "fire-auth",
|
|
569
|
+
[nt]: "fire-auth-compat",
|
|
570
|
+
[rt]: "fire-rtdb",
|
|
571
|
+
[it]: "fire-data-connect",
|
|
572
|
+
[at]: "fire-rtdb-compat",
|
|
573
|
+
[ot]: "fire-fn",
|
|
574
|
+
[st]: "fire-fn-compat",
|
|
575
|
+
[ct]: "fire-iid",
|
|
576
|
+
[lt]: "fire-iid-compat",
|
|
577
|
+
[ut]: "fire-fcm",
|
|
578
|
+
[dt]: "fire-fcm-compat",
|
|
579
|
+
[ft]: "fire-perf",
|
|
580
|
+
[pt]: "fire-perf-compat",
|
|
581
|
+
[mt]: "fire-rc",
|
|
582
|
+
[ht]: "fire-rc-compat",
|
|
583
|
+
[gt]: "fire-gcs",
|
|
584
|
+
[_t]: "fire-gcs-compat",
|
|
585
|
+
[vt]: "fire-fst",
|
|
586
|
+
[bt]: "fire-fst-compat",
|
|
587
|
+
[yt]: "fire-vertex",
|
|
588
|
+
"fire-js": "fire-js",
|
|
589
|
+
[xt]: "fire-js-all"
|
|
590
|
+
}, A = /* @__PURE__ */ new Map(), wt = /* @__PURE__ */ new Map(), j = /* @__PURE__ */ new Map();
|
|
591
|
+
function Tt(e, t) {
|
|
592
|
+
try {
|
|
593
|
+
e.container.addComponent(t);
|
|
594
|
+
} catch (n) {
|
|
595
|
+
k.debug(`Component ${t.name} failed to register with FirebaseApp ${e.name}`, n);
|
|
596
|
+
}
|
|
597
|
+
}
|
|
598
|
+
function M(e) {
|
|
599
|
+
let t = e.name;
|
|
600
|
+
if (j.has(t)) return k.debug(`There were multiple attempts to register component ${t}.`), !1;
|
|
601
|
+
j.set(t, e);
|
|
602
|
+
for (let t of A.values()) Tt(t, e);
|
|
603
|
+
for (let t of wt.values()) Tt(t, e);
|
|
604
|
+
return !0;
|
|
605
|
+
}
|
|
606
|
+
function Et(e, t) {
|
|
607
|
+
let n = e.container.getProvider("heartbeat").getImmediate({ optional: !0 });
|
|
608
|
+
return n && n.triggerHeartbeat(), e.container.getProvider(t);
|
|
609
|
+
}
|
|
610
|
+
var N = new g("app", "Firebase", {
|
|
611
|
+
"no-app": "No Firebase App '{$appName}' has been created - call initializeApp() first",
|
|
612
|
+
"bad-app-name": "Illegal App name: '{$appName}'",
|
|
613
|
+
"duplicate-app": "Firebase App named '{$appName}' already exists with different options or config",
|
|
614
|
+
"app-deleted": "Firebase App named '{$appName}' already deleted",
|
|
615
|
+
"server-app-deleted": "Firebase Server App has been deleted",
|
|
616
|
+
"no-options": "Need to provide options, when not being deployed to hosting via source.",
|
|
617
|
+
"invalid-app-argument": "firebase.{$appName}() takes either no argument or a Firebase App instance.",
|
|
618
|
+
"invalid-log-argument": "First argument to `onLog` must be null or a function.",
|
|
619
|
+
"idb-open": "Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",
|
|
620
|
+
"idb-get": "Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
|
|
621
|
+
"idb-set": "Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",
|
|
622
|
+
"idb-delete": "Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}.",
|
|
623
|
+
"finalization-registry-not-supported": "FirebaseServerApp deleteOnDeref field defined but the JS runtime does not support FinalizationRegistry.",
|
|
624
|
+
"invalid-server-app-environment": "FirebaseServerApp is not for use in browser environments."
|
|
625
|
+
}), Dt = class {
|
|
626
|
+
constructor(e, t, n) {
|
|
627
|
+
this._isDeleted = !1, this._options = { ...e }, this._config = { ...t }, this._name = t.name, this._automaticDataCollectionEnabled = t.automaticDataCollectionEnabled, this._container = n, this.container.addComponent(new v("app", () => this, "PUBLIC"));
|
|
628
|
+
}
|
|
629
|
+
get automaticDataCollectionEnabled() {
|
|
630
|
+
return this.checkDestroyed(), this._automaticDataCollectionEnabled;
|
|
631
|
+
}
|
|
632
|
+
set automaticDataCollectionEnabled(e) {
|
|
633
|
+
this.checkDestroyed(), this._automaticDataCollectionEnabled = e;
|
|
634
|
+
}
|
|
635
|
+
get name() {
|
|
636
|
+
return this.checkDestroyed(), this._name;
|
|
637
|
+
}
|
|
638
|
+
get options() {
|
|
639
|
+
return this.checkDestroyed(), this._options;
|
|
640
|
+
}
|
|
641
|
+
get config() {
|
|
642
|
+
return this.checkDestroyed(), this._config;
|
|
643
|
+
}
|
|
644
|
+
get container() {
|
|
645
|
+
return this._container;
|
|
646
|
+
}
|
|
647
|
+
get isDeleted() {
|
|
648
|
+
return this._isDeleted;
|
|
649
|
+
}
|
|
650
|
+
set isDeleted(e) {
|
|
651
|
+
this._isDeleted = e;
|
|
652
|
+
}
|
|
653
|
+
checkDestroyed() {
|
|
654
|
+
if (this.isDeleted) throw N.create("app-deleted", { appName: this._name });
|
|
655
|
+
}
|
|
656
|
+
};
|
|
657
|
+
function Ot(e, t = {}) {
|
|
658
|
+
let n = e;
|
|
659
|
+
typeof t != "object" && (t = { name: t });
|
|
660
|
+
let r = {
|
|
661
|
+
name: St,
|
|
662
|
+
automaticDataCollectionEnabled: !0,
|
|
663
|
+
...t
|
|
664
|
+
}, i = r.name;
|
|
665
|
+
if (typeof i != "string" || !i) throw N.create("bad-app-name", { appName: String(i) });
|
|
666
|
+
if (n ||= le(), !n) throw N.create("no-options");
|
|
667
|
+
let a = A.get(i);
|
|
668
|
+
if (a) {
|
|
669
|
+
if (_(n, a.options) && _(r, a.config)) return a;
|
|
670
|
+
throw N.create("duplicate-app", { appName: i });
|
|
671
|
+
}
|
|
672
|
+
let o = new we(i);
|
|
673
|
+
for (let e of j.values()) o.addComponent(e);
|
|
674
|
+
let s = new Dt(n, r, o);
|
|
675
|
+
return A.set(i, s), s;
|
|
676
|
+
}
|
|
677
|
+
function kt(e = St) {
|
|
678
|
+
let t = A.get(e);
|
|
679
|
+
if (!t && e === "[DEFAULT]" && le()) return Ot();
|
|
680
|
+
if (!t) throw N.create("no-app", { appName: e });
|
|
681
|
+
return t;
|
|
682
|
+
}
|
|
683
|
+
function P(e, t, n) {
|
|
684
|
+
let r = Ct[e] ?? e;
|
|
685
|
+
n && (r += `-${n}`);
|
|
686
|
+
let i = r.match(/\s|\//), a = t.match(/\s|\//);
|
|
687
|
+
if (i || a) {
|
|
688
|
+
let e = [`Unable to register library "${r}" with version "${t}":`];
|
|
689
|
+
i && e.push(`library name "${r}" contains illegal characters (whitespace or "/")`), i && a && e.push("and"), a && e.push(`version name "${t}" contains illegal characters (whitespace or "/")`), k.warn(e.join(" "));
|
|
690
|
+
return;
|
|
691
|
+
}
|
|
692
|
+
M(new v(`${r}-version`, () => ({
|
|
693
|
+
library: r,
|
|
694
|
+
version: t
|
|
695
|
+
}), "VERSION"));
|
|
696
|
+
}
|
|
697
|
+
var At = "firebase-heartbeat-database", jt = 1, F = "firebase-heartbeat-store", Mt = null;
|
|
698
|
+
function Nt() {
|
|
699
|
+
return Mt ||= Ue(At, jt, { upgrade: (e, t) => {
|
|
700
|
+
switch (t) {
|
|
701
|
+
case 0: try {
|
|
702
|
+
e.createObjectStore(F);
|
|
703
|
+
} catch (e) {
|
|
704
|
+
console.warn(e);
|
|
705
|
+
}
|
|
706
|
+
}
|
|
707
|
+
} }).catch((e) => {
|
|
708
|
+
throw N.create("idb-open", { originalErrorMessage: e.message });
|
|
709
|
+
}), Mt;
|
|
710
|
+
}
|
|
711
|
+
async function Pt(e) {
|
|
712
|
+
try {
|
|
713
|
+
let t = (await Nt()).transaction(F), n = await t.objectStore(F).get(It(e));
|
|
714
|
+
return await t.done, n;
|
|
715
|
+
} catch (e) {
|
|
716
|
+
if (e instanceof h) k.warn(e.message);
|
|
717
|
+
else {
|
|
718
|
+
let t = N.create("idb-get", { originalErrorMessage: e?.message });
|
|
719
|
+
k.warn(t.message);
|
|
720
|
+
}
|
|
721
|
+
}
|
|
722
|
+
}
|
|
723
|
+
async function Ft(e, t) {
|
|
724
|
+
try {
|
|
725
|
+
let n = (await Nt()).transaction(F, "readwrite");
|
|
726
|
+
await n.objectStore(F).put(t, It(e)), await n.done;
|
|
727
|
+
} catch (e) {
|
|
728
|
+
if (e instanceof h) k.warn(e.message);
|
|
729
|
+
else {
|
|
730
|
+
let t = N.create("idb-set", { originalErrorMessage: e?.message });
|
|
731
|
+
k.warn(t.message);
|
|
732
|
+
}
|
|
733
|
+
}
|
|
734
|
+
}
|
|
735
|
+
function It(e) {
|
|
736
|
+
return `${e.name}!${e.options.appId}`;
|
|
737
|
+
}
|
|
738
|
+
var Lt = 1024, Rt = 30, zt = class {
|
|
739
|
+
constructor(e) {
|
|
740
|
+
this.container = e, this._heartbeatsCache = null, this._storage = new Ht(this.container.getProvider("app").getImmediate()), this._heartbeatsCachePromise = this._storage.read().then((e) => (this._heartbeatsCache = e, e));
|
|
741
|
+
}
|
|
742
|
+
async triggerHeartbeat() {
|
|
743
|
+
try {
|
|
744
|
+
let e = this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(), t = Bt();
|
|
745
|
+
if (this._heartbeatsCache?.heartbeats == null && (this._heartbeatsCache = await this._heartbeatsCachePromise, this._heartbeatsCache?.heartbeats == null) || this._heartbeatsCache.lastSentHeartbeatDate === t || this._heartbeatsCache.heartbeats.some((e) => e.date === t)) return;
|
|
746
|
+
if (this._heartbeatsCache.heartbeats.push({
|
|
747
|
+
date: t,
|
|
748
|
+
agent: e
|
|
749
|
+
}), this._heartbeatsCache.heartbeats.length > Rt) {
|
|
750
|
+
let e = Wt(this._heartbeatsCache.heartbeats);
|
|
751
|
+
this._heartbeatsCache.heartbeats.splice(e, 1);
|
|
752
|
+
}
|
|
753
|
+
return this._storage.overwrite(this._heartbeatsCache);
|
|
754
|
+
} catch (e) {
|
|
755
|
+
k.warn(e);
|
|
756
|
+
}
|
|
757
|
+
}
|
|
758
|
+
async getHeartbeatsHeader() {
|
|
759
|
+
try {
|
|
760
|
+
if (this._heartbeatsCache === null && await this._heartbeatsCachePromise, this._heartbeatsCache?.heartbeats == null || this._heartbeatsCache.heartbeats.length === 0) return "";
|
|
761
|
+
let e = Bt(), { heartbeatsToSend: t, unsentEntries: n } = Vt(this._heartbeatsCache.heartbeats), r = ne(JSON.stringify({
|
|
762
|
+
version: 2,
|
|
763
|
+
heartbeats: t
|
|
764
|
+
}));
|
|
765
|
+
return this._heartbeatsCache.lastSentHeartbeatDate = e, n.length > 0 ? (this._heartbeatsCache.heartbeats = n, await this._storage.overwrite(this._heartbeatsCache)) : (this._heartbeatsCache.heartbeats = [], this._storage.overwrite(this._heartbeatsCache)), r;
|
|
766
|
+
} catch (e) {
|
|
767
|
+
return k.warn(e), "";
|
|
768
|
+
}
|
|
769
|
+
}
|
|
770
|
+
};
|
|
771
|
+
function Bt() {
|
|
772
|
+
return (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
|
|
773
|
+
}
|
|
774
|
+
function Vt(e, t = Lt) {
|
|
775
|
+
let n = [], r = e.slice();
|
|
776
|
+
for (let i of e) {
|
|
777
|
+
let e = n.find((e) => e.agent === i.agent);
|
|
778
|
+
if (!e) {
|
|
779
|
+
if (n.push({
|
|
780
|
+
agent: i.agent,
|
|
781
|
+
dates: [i.date]
|
|
782
|
+
}), Ut(n) > t) {
|
|
783
|
+
n.pop();
|
|
784
|
+
break;
|
|
785
|
+
}
|
|
786
|
+
} else if (e.dates.push(i.date), Ut(n) > t) {
|
|
787
|
+
e.dates.pop();
|
|
788
|
+
break;
|
|
789
|
+
}
|
|
790
|
+
r = r.slice(1);
|
|
791
|
+
}
|
|
792
|
+
return {
|
|
793
|
+
heartbeatsToSend: n,
|
|
794
|
+
unsentEntries: r
|
|
795
|
+
};
|
|
796
|
+
}
|
|
797
|
+
var Ht = class {
|
|
798
|
+
constructor(e) {
|
|
799
|
+
this.app = e, this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
|
|
800
|
+
}
|
|
801
|
+
async runIndexedDBEnvironmentCheck() {
|
|
802
|
+
return m() ? ue().then(() => !0).catch(() => !1) : !1;
|
|
803
|
+
}
|
|
804
|
+
async read() {
|
|
805
|
+
if (await this._canUseIndexedDBPromise) {
|
|
806
|
+
let e = await Pt(this.app);
|
|
807
|
+
return e?.heartbeats ? e : { heartbeats: [] };
|
|
808
|
+
} else return { heartbeats: [] };
|
|
809
|
+
}
|
|
810
|
+
async overwrite(e) {
|
|
811
|
+
if (await this._canUseIndexedDBPromise) {
|
|
812
|
+
let t = await this.read();
|
|
813
|
+
return Ft(this.app, {
|
|
814
|
+
lastSentHeartbeatDate: e.lastSentHeartbeatDate ?? t.lastSentHeartbeatDate,
|
|
815
|
+
heartbeats: e.heartbeats
|
|
816
|
+
});
|
|
817
|
+
} else return;
|
|
818
|
+
}
|
|
819
|
+
async add(e) {
|
|
820
|
+
if (await this._canUseIndexedDBPromise) {
|
|
821
|
+
let t = await this.read();
|
|
822
|
+
return Ft(this.app, {
|
|
823
|
+
lastSentHeartbeatDate: e.lastSentHeartbeatDate ?? t.lastSentHeartbeatDate,
|
|
824
|
+
heartbeats: [...t.heartbeats, ...e.heartbeats]
|
|
825
|
+
});
|
|
826
|
+
} else return;
|
|
827
|
+
}
|
|
828
|
+
};
|
|
829
|
+
function Ut(e) {
|
|
830
|
+
return ne(JSON.stringify({
|
|
831
|
+
version: 2,
|
|
832
|
+
heartbeats: e
|
|
833
|
+
})).length;
|
|
834
|
+
}
|
|
835
|
+
function Wt(e) {
|
|
836
|
+
if (e.length === 0) return -1;
|
|
837
|
+
let t = 0, n = e[0].date;
|
|
838
|
+
for (let r = 1; r < e.length; r++) e[r].date < n && (n = e[r].date, t = r);
|
|
839
|
+
return t;
|
|
840
|
+
}
|
|
841
|
+
function Gt(e) {
|
|
842
|
+
M(new v("platform-logger", (e) => new qe(e), "PRIVATE")), M(new v("heartbeat", (e) => new zt(e), "PRIVATE")), P(O, Ye, e), P(O, Ye, "esm2020"), P("fire-js", "");
|
|
843
|
+
}
|
|
844
|
+
Gt("");
|
|
845
|
+
//#endregion
|
|
846
|
+
//#region node_modules/@firebase/app-check/dist/esm/index.esm.js
|
|
847
|
+
var I = /* @__PURE__ */ new Map(), Kt = {
|
|
848
|
+
activated: !1,
|
|
849
|
+
tokenObservers: []
|
|
850
|
+
}, qt = {
|
|
851
|
+
initialized: !1,
|
|
852
|
+
enabled: !1
|
|
853
|
+
};
|
|
854
|
+
function L(e) {
|
|
855
|
+
return I.get(e) || { ...Kt };
|
|
856
|
+
}
|
|
857
|
+
function Jt(e, t) {
|
|
858
|
+
return I.set(e, t), I.get(e);
|
|
859
|
+
}
|
|
860
|
+
function R() {
|
|
861
|
+
return qt;
|
|
862
|
+
}
|
|
863
|
+
var Yt = "https://content-firebaseappcheck.googleapis.com/v1", Xt = "exchangeRecaptchaEnterpriseToken", Zt = "exchangeDebugToken", Qt = {
|
|
864
|
+
OFFSET_DURATION: 300 * 1e3,
|
|
865
|
+
RETRIAL_MIN_WAIT: 30 * 1e3,
|
|
866
|
+
RETRIAL_MAX_WAIT: 960 * 1e3
|
|
867
|
+
}, $t = 1440 * 60 * 1e3, en = class {
|
|
868
|
+
constructor(e, t, n, r, i) {
|
|
869
|
+
if (this.operation = e, this.retryPolicy = t, this.getWaitDuration = n, this.lowerBound = r, this.upperBound = i, this.pending = null, this.nextErrorWaitInterval = r, r > i) throw Error("Proactive refresh lower bound greater than upper bound!");
|
|
870
|
+
}
|
|
871
|
+
start() {
|
|
872
|
+
this.nextErrorWaitInterval = this.lowerBound, this.process(!0).catch(() => {});
|
|
873
|
+
}
|
|
874
|
+
stop() {
|
|
875
|
+
this.pending &&= (this.pending.reject("cancelled"), null);
|
|
876
|
+
}
|
|
877
|
+
isRunning() {
|
|
878
|
+
return !!this.pending;
|
|
879
|
+
}
|
|
880
|
+
async process(e) {
|
|
881
|
+
this.stop();
|
|
882
|
+
try {
|
|
883
|
+
this.pending = new p(), this.pending.promise.catch((e) => {}), await tn(this.getNextRun(e)), this.pending.resolve(), await this.pending.promise, this.pending = new p(), this.pending.promise.catch((e) => {}), await this.operation(), this.pending.resolve(), await this.pending.promise, this.process(!0).catch(() => {});
|
|
884
|
+
} catch (e) {
|
|
885
|
+
this.retryPolicy(e) ? this.process(!1).catch(() => {}) : this.stop();
|
|
886
|
+
}
|
|
887
|
+
}
|
|
888
|
+
getNextRun(e) {
|
|
889
|
+
if (e) return this.nextErrorWaitInterval = this.lowerBound, this.getWaitDuration();
|
|
890
|
+
{
|
|
891
|
+
let e = this.nextErrorWaitInterval;
|
|
892
|
+
return this.nextErrorWaitInterval *= 2, this.nextErrorWaitInterval > this.upperBound && (this.nextErrorWaitInterval = this.upperBound), e;
|
|
893
|
+
}
|
|
894
|
+
}
|
|
895
|
+
};
|
|
896
|
+
function tn(e) {
|
|
897
|
+
return new Promise((t) => {
|
|
898
|
+
setTimeout(t, e);
|
|
899
|
+
});
|
|
900
|
+
}
|
|
901
|
+
var z = new g("appCheck", "AppCheck", {
|
|
902
|
+
"already-initialized": "You have already called initializeAppCheck() for FirebaseApp {$appName} with different options. To avoid this error, call initializeAppCheck() with the same options as when it was originally called. This will return the already initialized instance.",
|
|
903
|
+
"use-before-activation": "App Check is being used before initializeAppCheck() is called for FirebaseApp {$appName}. Call initializeAppCheck() before instantiating other Firebase services.",
|
|
904
|
+
"fetch-network-error": "Fetch failed to connect to a network. Check Internet connection. Original error: {$originalErrorMessage}.",
|
|
905
|
+
"fetch-parse-error": "Fetch client could not parse response. Original error: {$originalErrorMessage}.",
|
|
906
|
+
"fetch-status-error": "Fetch server returned an HTTP error status. HTTP status: {$httpStatus}.",
|
|
907
|
+
"storage-open": "Error thrown when opening storage. Original error: {$originalErrorMessage}.",
|
|
908
|
+
"storage-get": "Error thrown when reading from storage. Original error: {$originalErrorMessage}.",
|
|
909
|
+
"storage-set": "Error thrown when writing to storage. Original error: {$originalErrorMessage}.",
|
|
910
|
+
"recaptcha-error": "ReCAPTCHA error.",
|
|
911
|
+
"initial-throttle": "{$httpStatus} error. Attempts allowed again after {$time}",
|
|
912
|
+
throttled: "Requests throttled due to previous {$httpStatus} error. Attempts allowed again after {$time}"
|
|
913
|
+
});
|
|
914
|
+
function nn(e = !1) {
|
|
915
|
+
return e ? self.grecaptcha?.enterprise : self.grecaptcha;
|
|
916
|
+
}
|
|
917
|
+
function B(e) {
|
|
918
|
+
if (!L(e).activated) throw z.create("use-before-activation", { appName: e.name });
|
|
919
|
+
}
|
|
920
|
+
function rn(e) {
|
|
921
|
+
let t = Math.round(e / 1e3), n = Math.floor(t / (3600 * 24)), r = Math.floor((t - n * 3600 * 24) / 3600), i = Math.floor((t - n * 3600 * 24 - r * 3600) / 60), a = t - n * 3600 * 24 - r * 3600 - i * 60, o = "";
|
|
922
|
+
return n && (o += V(n) + "d:"), r && (o += V(r) + "h:"), o += V(i) + "m:" + V(a) + "s", o;
|
|
923
|
+
}
|
|
924
|
+
function V(e) {
|
|
925
|
+
return e === 0 ? "00" : e >= 10 ? e.toString() : "0" + e;
|
|
926
|
+
}
|
|
927
|
+
async function H({ url: e, body: t }, n) {
|
|
928
|
+
let r = { "Content-Type": "application/json" }, i = n.getImmediate({ optional: !0 });
|
|
929
|
+
if (i) {
|
|
930
|
+
let e = await i.getHeartbeatsHeader();
|
|
931
|
+
e && (r["X-Firebase-Client"] = e);
|
|
932
|
+
}
|
|
933
|
+
let a = {
|
|
934
|
+
method: "POST",
|
|
935
|
+
body: JSON.stringify(t),
|
|
936
|
+
headers: r
|
|
937
|
+
}, o;
|
|
938
|
+
try {
|
|
939
|
+
o = await fetch(e, a);
|
|
940
|
+
} catch (e) {
|
|
941
|
+
throw z.create("fetch-network-error", { originalErrorMessage: e?.message });
|
|
942
|
+
}
|
|
943
|
+
if (o.status !== 200) throw z.create("fetch-status-error", { httpStatus: o.status });
|
|
944
|
+
let s;
|
|
945
|
+
try {
|
|
946
|
+
s = await o.json();
|
|
947
|
+
} catch (e) {
|
|
948
|
+
throw z.create("fetch-parse-error", { originalErrorMessage: e?.message });
|
|
949
|
+
}
|
|
950
|
+
let c = s.ttl.match(/^([\d.]+)(s)$/);
|
|
951
|
+
if (!c || !c[2] || isNaN(Number(c[1]))) throw z.create("fetch-parse-error", { originalErrorMessage: `ttl field (timeToLive) is not in standard Protobuf Duration format: ${s.ttl}` });
|
|
952
|
+
let l = Number(c[1]) * 1e3, u = Date.now();
|
|
953
|
+
return {
|
|
954
|
+
token: s.token,
|
|
955
|
+
expireTimeMillis: u + l,
|
|
956
|
+
issuedAtTimeMillis: u
|
|
957
|
+
};
|
|
958
|
+
}
|
|
959
|
+
function an(e, t) {
|
|
960
|
+
let { projectId: n, appId: r, apiKey: i } = e.options;
|
|
961
|
+
return {
|
|
962
|
+
url: `${Yt}/projects/${n}/apps/${r}:${Xt}?key=${i}`,
|
|
963
|
+
body: { recaptcha_enterprise_token: t }
|
|
964
|
+
};
|
|
965
|
+
}
|
|
966
|
+
function on(e, t) {
|
|
967
|
+
let { projectId: n, appId: r, apiKey: i } = e.options;
|
|
968
|
+
return {
|
|
969
|
+
url: `${Yt}/projects/${n}/apps/${r}:${Zt}?key=${i}`,
|
|
970
|
+
body: { debug_token: t }
|
|
971
|
+
};
|
|
972
|
+
}
|
|
973
|
+
var sn = "firebase-app-check-database", cn = 1, U = "firebase-app-check-store", ln = "debug-token", W = null;
|
|
974
|
+
function un() {
|
|
975
|
+
return W || (W = new Promise((e, t) => {
|
|
976
|
+
try {
|
|
977
|
+
let n = indexedDB.open(sn, cn);
|
|
978
|
+
n.onsuccess = (t) => {
|
|
979
|
+
e(t.target.result);
|
|
980
|
+
}, n.onerror = (e) => {
|
|
981
|
+
t(z.create("storage-open", { originalErrorMessage: e.target.error?.message }));
|
|
982
|
+
}, n.onupgradeneeded = (e) => {
|
|
983
|
+
let t = e.target.result;
|
|
984
|
+
switch (e.oldVersion) {
|
|
985
|
+
case 0: t.createObjectStore(U, { keyPath: "compositeKey" });
|
|
986
|
+
}
|
|
987
|
+
};
|
|
988
|
+
} catch (e) {
|
|
989
|
+
t(z.create("storage-open", { originalErrorMessage: e?.message }));
|
|
990
|
+
}
|
|
991
|
+
}), W);
|
|
992
|
+
}
|
|
993
|
+
function dn(e) {
|
|
994
|
+
return gn(_n(e));
|
|
995
|
+
}
|
|
996
|
+
function fn(e, t) {
|
|
997
|
+
return hn(_n(e), t);
|
|
998
|
+
}
|
|
999
|
+
function pn(e) {
|
|
1000
|
+
return hn(ln, e);
|
|
1001
|
+
}
|
|
1002
|
+
function mn() {
|
|
1003
|
+
return gn(ln);
|
|
1004
|
+
}
|
|
1005
|
+
async function hn(e, t) {
|
|
1006
|
+
let n = (await un()).transaction(U, "readwrite"), r = n.objectStore(U).put({
|
|
1007
|
+
compositeKey: e,
|
|
1008
|
+
value: t
|
|
1009
|
+
});
|
|
1010
|
+
return new Promise((e, t) => {
|
|
1011
|
+
r.onsuccess = (t) => {
|
|
1012
|
+
e();
|
|
1013
|
+
}, n.onerror = (e) => {
|
|
1014
|
+
t(z.create("storage-set", { originalErrorMessage: e.target.error?.message }));
|
|
1015
|
+
};
|
|
1016
|
+
});
|
|
1017
|
+
}
|
|
1018
|
+
async function gn(e) {
|
|
1019
|
+
let t = (await un()).transaction(U, "readonly"), n = t.objectStore(U).get(e);
|
|
1020
|
+
return new Promise((e, r) => {
|
|
1021
|
+
n.onsuccess = (t) => {
|
|
1022
|
+
let n = t.target.result;
|
|
1023
|
+
e(n ? n.value : void 0);
|
|
1024
|
+
}, t.onerror = (e) => {
|
|
1025
|
+
r(z.create("storage-get", { originalErrorMessage: e.target.error?.message }));
|
|
1026
|
+
};
|
|
1027
|
+
});
|
|
1028
|
+
}
|
|
1029
|
+
function _n(e) {
|
|
1030
|
+
return `${e.options.appId}-${e.name}`;
|
|
1031
|
+
}
|
|
1032
|
+
var G = new Ae("@firebase/app-check");
|
|
1033
|
+
async function vn(e) {
|
|
1034
|
+
if (m()) {
|
|
1035
|
+
let t;
|
|
1036
|
+
try {
|
|
1037
|
+
t = await dn(e);
|
|
1038
|
+
} catch (e) {
|
|
1039
|
+
G.warn(`Failed to read token from IndexedDB. Error: ${e}`);
|
|
1040
|
+
}
|
|
1041
|
+
return t;
|
|
1042
|
+
}
|
|
1043
|
+
}
|
|
1044
|
+
function K(e, t) {
|
|
1045
|
+
return m() ? fn(e, t).catch((e) => {
|
|
1046
|
+
G.warn(`Failed to write token to IndexedDB. Error: ${e}`);
|
|
1047
|
+
}) : Promise.resolve();
|
|
1048
|
+
}
|
|
1049
|
+
async function yn() {
|
|
1050
|
+
let e;
|
|
1051
|
+
try {
|
|
1052
|
+
e = await mn();
|
|
1053
|
+
} catch {}
|
|
1054
|
+
if (e) return e;
|
|
1055
|
+
{
|
|
1056
|
+
let e = crypto.randomUUID();
|
|
1057
|
+
return pn(e).catch((e) => G.warn(`Failed to persist debug token to IndexedDB. Error: ${e}`)), e;
|
|
1058
|
+
}
|
|
1059
|
+
}
|
|
1060
|
+
function q() {
|
|
1061
|
+
return R().enabled;
|
|
1062
|
+
}
|
|
1063
|
+
async function J() {
|
|
1064
|
+
let e = R();
|
|
1065
|
+
if (e.enabled && e.token) return e.token.promise;
|
|
1066
|
+
throw Error("\n Can't get debug token in production mode.\n ");
|
|
1067
|
+
}
|
|
1068
|
+
function bn() {
|
|
1069
|
+
let e = ie(), t = R();
|
|
1070
|
+
if (t.initialized = !0, typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN != "string" && e.FIREBASE_APPCHECK_DEBUG_TOKEN !== !0) return;
|
|
1071
|
+
t.enabled = !0;
|
|
1072
|
+
let n = new p();
|
|
1073
|
+
t.token = n, typeof e.FIREBASE_APPCHECK_DEBUG_TOKEN == "string" ? n.resolve(e.FIREBASE_APPCHECK_DEBUG_TOKEN) : n.resolve(yn());
|
|
1074
|
+
}
|
|
1075
|
+
var xn = { error: "UNKNOWN_ERROR" };
|
|
1076
|
+
function Sn(e) {
|
|
1077
|
+
return f.encodeString(JSON.stringify(e), !1);
|
|
1078
|
+
}
|
|
1079
|
+
async function Y(e, t = !1, n = !1) {
|
|
1080
|
+
let r = e.app;
|
|
1081
|
+
B(r);
|
|
1082
|
+
let i = L(r), a = i.token, o;
|
|
1083
|
+
if (a && !X(a) && (i.token = void 0, a = void 0), !a) {
|
|
1084
|
+
let e = await i.cachedTokenPromise;
|
|
1085
|
+
e && (X(e) ? a = e : await K(r, void 0));
|
|
1086
|
+
}
|
|
1087
|
+
if (!t && a && X(a)) return { token: a.token };
|
|
1088
|
+
let s = !1;
|
|
1089
|
+
if (q()) try {
|
|
1090
|
+
let t = await J();
|
|
1091
|
+
i.exchangeTokenPromise || (i.exchangeTokenPromise = H(on(r, t), e.heartbeatServiceProvider).finally(() => {
|
|
1092
|
+
i.exchangeTokenPromise = void 0;
|
|
1093
|
+
}), s = !0);
|
|
1094
|
+
let n = await i.exchangeTokenPromise;
|
|
1095
|
+
return await K(r, n), i.token = n, { token: n.token };
|
|
1096
|
+
} catch (e) {
|
|
1097
|
+
return e.code === "appCheck/throttled" || e.code === "appCheck/initial-throttle" ? G.warn(e.message) : n && G.error(e), Z(e);
|
|
1098
|
+
}
|
|
1099
|
+
try {
|
|
1100
|
+
i.exchangeTokenPromise || (i.exchangeTokenPromise = i.provider.getToken().finally(() => {
|
|
1101
|
+
i.exchangeTokenPromise = void 0;
|
|
1102
|
+
}), s = !0), a = await L(r).exchangeTokenPromise;
|
|
1103
|
+
} catch (e) {
|
|
1104
|
+
e.code === "appCheck/throttled" || e.code === "appCheck/initial-throttle" ? G.warn(e.message) : n && G.error(e), o = e;
|
|
1105
|
+
}
|
|
1106
|
+
let c;
|
|
1107
|
+
return a ? o ? c = X(a) ? {
|
|
1108
|
+
token: a.token,
|
|
1109
|
+
internalError: o
|
|
1110
|
+
} : Z(o) : (c = { token: a.token }, i.token = a, await K(r, a)) : c = Z(o), s && On(r, c), c;
|
|
1111
|
+
}
|
|
1112
|
+
async function Cn(e) {
|
|
1113
|
+
let t = e.app;
|
|
1114
|
+
B(t);
|
|
1115
|
+
let { provider: n } = L(t);
|
|
1116
|
+
if (q()) {
|
|
1117
|
+
let { token: n } = await H(on(t, await J()), e.heartbeatServiceProvider);
|
|
1118
|
+
return { token: n };
|
|
1119
|
+
} else {
|
|
1120
|
+
let { token: e } = await n.getToken();
|
|
1121
|
+
return { token: e };
|
|
1122
|
+
}
|
|
1123
|
+
}
|
|
1124
|
+
function wn(e, t, n, r) {
|
|
1125
|
+
let { app: i } = e, a = L(i), o = {
|
|
1126
|
+
next: n,
|
|
1127
|
+
error: r,
|
|
1128
|
+
type: t
|
|
1129
|
+
};
|
|
1130
|
+
if (a.tokenObservers = [...a.tokenObservers, o], a.token && X(a.token)) {
|
|
1131
|
+
let t = a.token;
|
|
1132
|
+
Promise.resolve().then(() => {
|
|
1133
|
+
n({ token: t.token }), En(e);
|
|
1134
|
+
}).catch(() => {});
|
|
1135
|
+
}
|
|
1136
|
+
a.cachedTokenPromise.then(() => En(e));
|
|
1137
|
+
}
|
|
1138
|
+
function Tn(e, t) {
|
|
1139
|
+
let n = L(e), r = n.tokenObservers.filter((e) => e.next !== t);
|
|
1140
|
+
r.length === 0 && n.tokenRefresher && n.tokenRefresher.isRunning() && n.tokenRefresher.stop(), n.tokenObservers = r;
|
|
1141
|
+
}
|
|
1142
|
+
function En(e) {
|
|
1143
|
+
let { app: t } = e, n = L(t), r = n.tokenRefresher;
|
|
1144
|
+
r || (r = Dn(e), n.tokenRefresher = r), !r.isRunning() && n.isTokenAutoRefreshEnabled && r.start();
|
|
1145
|
+
}
|
|
1146
|
+
function Dn(e) {
|
|
1147
|
+
let { app: t } = e;
|
|
1148
|
+
return new en(async () => {
|
|
1149
|
+
let n = L(t), r;
|
|
1150
|
+
if (r = n.token ? await Y(e, !0) : await Y(e), r.error) throw r.error;
|
|
1151
|
+
if (r.internalError) throw r.internalError;
|
|
1152
|
+
}, () => !0, () => {
|
|
1153
|
+
let e = L(t);
|
|
1154
|
+
if (e.token) {
|
|
1155
|
+
let t = e.token.issuedAtTimeMillis + (e.token.expireTimeMillis - e.token.issuedAtTimeMillis) * .5 + 300 * 1e3, n = e.token.expireTimeMillis - 300 * 1e3;
|
|
1156
|
+
return t = Math.min(t, n), Math.max(0, t - Date.now());
|
|
1157
|
+
} else return 0;
|
|
1158
|
+
}, Qt.RETRIAL_MIN_WAIT, Qt.RETRIAL_MAX_WAIT);
|
|
1159
|
+
}
|
|
1160
|
+
function On(e, t) {
|
|
1161
|
+
let n = L(e).tokenObservers;
|
|
1162
|
+
for (let e of n) try {
|
|
1163
|
+
e.type === "EXTERNAL" && t.error != null ? e.error(t.error) : e.next(t);
|
|
1164
|
+
} catch {}
|
|
1165
|
+
}
|
|
1166
|
+
function X(e) {
|
|
1167
|
+
return e.expireTimeMillis - Date.now() > 0;
|
|
1168
|
+
}
|
|
1169
|
+
function Z(e) {
|
|
1170
|
+
return {
|
|
1171
|
+
token: Sn(xn),
|
|
1172
|
+
error: e
|
|
1173
|
+
};
|
|
1174
|
+
}
|
|
1175
|
+
var kn = class {
|
|
1176
|
+
constructor(e, t) {
|
|
1177
|
+
this.app = e, this.heartbeatServiceProvider = t;
|
|
1178
|
+
}
|
|
1179
|
+
_delete() {
|
|
1180
|
+
let { tokenObservers: e } = L(this.app);
|
|
1181
|
+
for (let t of e) Tn(this.app, t.next);
|
|
1182
|
+
return Promise.resolve();
|
|
1183
|
+
}
|
|
1184
|
+
};
|
|
1185
|
+
function An(e, t) {
|
|
1186
|
+
return new kn(e, t);
|
|
1187
|
+
}
|
|
1188
|
+
function jn(e) {
|
|
1189
|
+
return {
|
|
1190
|
+
getToken: (t) => Y(e, t),
|
|
1191
|
+
getLimitedUseToken: () => Cn(e),
|
|
1192
|
+
addTokenListener: (t) => wn(e, "INTERNAL", t),
|
|
1193
|
+
removeTokenListener: (t) => Tn(e.app, t)
|
|
1194
|
+
};
|
|
1195
|
+
}
|
|
1196
|
+
var Mn = "@firebase/app-check", Nn = "0.11.2", Pn = "https://www.google.com/recaptcha/enterprise.js";
|
|
1197
|
+
function Fn(e, t) {
|
|
1198
|
+
let n = new p(), r = L(e);
|
|
1199
|
+
r.reCAPTCHAState = { initialized: n };
|
|
1200
|
+
let i = In(e), a = nn(!0);
|
|
1201
|
+
return a ? Q(e, t, a, i, n) : zn(() => {
|
|
1202
|
+
let r = nn(!0);
|
|
1203
|
+
if (!r) throw Error("no recaptcha");
|
|
1204
|
+
Q(e, t, r, i, n);
|
|
1205
|
+
}), n.promise;
|
|
1206
|
+
}
|
|
1207
|
+
function Q(e, t, n, r, i) {
|
|
1208
|
+
n.ready(() => {
|
|
1209
|
+
Rn(e, t, n, r), i.resolve(n);
|
|
1210
|
+
});
|
|
1211
|
+
}
|
|
1212
|
+
function In(e) {
|
|
1213
|
+
let t = `fire_app_check_${e.name}`, n = document.createElement("div");
|
|
1214
|
+
return n.id = t, n.style.display = "none", document.body.appendChild(n), t;
|
|
1215
|
+
}
|
|
1216
|
+
async function Ln(e) {
|
|
1217
|
+
B(e);
|
|
1218
|
+
let t = await L(e).reCAPTCHAState.initialized.promise;
|
|
1219
|
+
return new Promise((n, r) => {
|
|
1220
|
+
let i = L(e).reCAPTCHAState;
|
|
1221
|
+
t.ready(() => {
|
|
1222
|
+
n(t.execute(i.widgetId, { action: "fire_app_check" }));
|
|
1223
|
+
});
|
|
1224
|
+
});
|
|
1225
|
+
}
|
|
1226
|
+
function Rn(e, t, n, r) {
|
|
1227
|
+
let i = n.render(r, {
|
|
1228
|
+
sitekey: t,
|
|
1229
|
+
size: "invisible",
|
|
1230
|
+
callback: () => {
|
|
1231
|
+
L(e).reCAPTCHAState.succeeded = !0;
|
|
1232
|
+
},
|
|
1233
|
+
"error-callback": () => {
|
|
1234
|
+
L(e).reCAPTCHAState.succeeded = !1;
|
|
1235
|
+
}
|
|
1236
|
+
}), a = L(e);
|
|
1237
|
+
a.reCAPTCHAState = {
|
|
1238
|
+
...a.reCAPTCHAState,
|
|
1239
|
+
widgetId: i
|
|
1240
|
+
};
|
|
1241
|
+
}
|
|
1242
|
+
function zn(e) {
|
|
1243
|
+
let t = document.createElement("script");
|
|
1244
|
+
t.src = Pn, t.onload = e, document.head.appendChild(t);
|
|
1245
|
+
}
|
|
1246
|
+
var Bn = class e {
|
|
1247
|
+
constructor(e) {
|
|
1248
|
+
this._siteKey = e, this._throttleData = null;
|
|
1249
|
+
}
|
|
1250
|
+
async getToken() {
|
|
1251
|
+
Hn(this._throttleData);
|
|
1252
|
+
let e = await Ln(this._app).catch((e) => {
|
|
1253
|
+
throw z.create("recaptcha-error");
|
|
1254
|
+
});
|
|
1255
|
+
if (!L(this._app).reCAPTCHAState?.succeeded) throw z.create("recaptcha-error");
|
|
1256
|
+
let t;
|
|
1257
|
+
try {
|
|
1258
|
+
t = await H(an(this._app, e), this._heartbeatServiceProvider);
|
|
1259
|
+
} catch (e) {
|
|
1260
|
+
throw e.code?.includes("fetch-status-error") ? (this._throttleData = Vn(Number(e.customData?.httpStatus), this._throttleData), z.create("initial-throttle", {
|
|
1261
|
+
time: rn(this._throttleData.allowRequestsAfter - Date.now()),
|
|
1262
|
+
httpStatus: this._throttleData.httpStatus
|
|
1263
|
+
})) : e;
|
|
1264
|
+
}
|
|
1265
|
+
return this._throttleData = null, t;
|
|
1266
|
+
}
|
|
1267
|
+
initialize(e) {
|
|
1268
|
+
this._app = e, this._heartbeatServiceProvider = Et(e, "heartbeat"), Fn(e, this._siteKey).catch(() => {});
|
|
1269
|
+
}
|
|
1270
|
+
isEqual(t) {
|
|
1271
|
+
return t instanceof e ? this._siteKey === t._siteKey : !1;
|
|
1272
|
+
}
|
|
1152
1273
|
};
|
|
1153
|
-
function
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
}
|
|
1159
|
-
|
|
1160
|
-
|
|
1161
|
-
|
|
1162
|
-
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1168
|
-
|
|
1169
|
-
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
}
|
|
1173
|
-
|
|
1174
|
-
|
|
1175
|
-
|
|
1176
|
-
|
|
1177
|
-
|
|
1178
|
-
|
|
1179
|
-
|
|
1180
|
-
|
|
1181
|
-
|
|
1182
|
-
|
|
1183
|
-
|
|
1184
|
-
|
|
1185
|
-
|
|
1186
|
-
|
|
1187
|
-
|
|
1188
|
-
|
|
1189
|
-
|
|
1190
|
-
|
|
1191
|
-
|
|
1192
|
-
|
|
1193
|
-
|
|
1194
|
-
|
|
1195
|
-
|
|
1196
|
-
|
|
1197
|
-
|
|
1198
|
-
|
|
1199
|
-
|
|
1200
|
-
|
|
1201
|
-
|
|
1202
|
-
|
|
1203
|
-
|
|
1204
|
-
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
|
|
1208
|
-
|
|
1209
|
-
|
|
1210
|
-
|
|
1211
|
-
|
|
1212
|
-
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1219
|
-
|
|
1220
|
-
|
|
1221
|
-
|
|
1222
|
-
|
|
1223
|
-
|
|
1224
|
-
|
|
1225
|
-
|
|
1226
|
-
|
|
1227
|
-
|
|
1228
|
-
|
|
1229
|
-
}
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1233
|
-
|
|
1234
|
-
|
|
1235
|
-
|
|
1236
|
-
|
|
1237
|
-
|
|
1238
|
-
|
|
1239
|
-
|
|
1240
|
-
|
|
1241
|
-
|
|
1242
|
-
|
|
1243
|
-
|
|
1244
|
-
|
|
1245
|
-
|
|
1246
|
-
|
|
1247
|
-
|
|
1248
|
-
|
|
1249
|
-
|
|
1250
|
-
|
|
1251
|
-
|
|
1252
|
-
|
|
1253
|
-
|
|
1254
|
-
|
|
1255
|
-
|
|
1256
|
-
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
|
|
1260
|
-
|
|
1261
|
-
|
|
1262
|
-
|
|
1263
|
-
|
|
1264
|
-
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
});
|
|
1271
|
-
let c;
|
|
1272
|
-
try {
|
|
1273
|
-
c = await i.json();
|
|
1274
|
-
} catch (f) {
|
|
1275
|
-
throw u.create("fetch-parse-error", {
|
|
1276
|
-
originalErrorMessage: f?.message
|
|
1277
|
-
});
|
|
1278
|
-
}
|
|
1279
|
-
const a = c.ttl.match(/^([\d.]+)(s)$/);
|
|
1280
|
-
if (!a || !a[2] || isNaN(Number(a[1])))
|
|
1281
|
-
throw u.create("fetch-parse-error", {
|
|
1282
|
-
originalErrorMessage: `ttl field (timeToLive) is not in standard Protobuf Duration format: ${c.ttl}`
|
|
1283
|
-
});
|
|
1284
|
-
const l = Number(a[1]) * 1e3, p = Date.now();
|
|
1285
|
-
return {
|
|
1286
|
-
token: c.token,
|
|
1287
|
-
expireTimeMillis: p + l,
|
|
1288
|
-
issuedAtTimeMillis: p
|
|
1289
|
-
};
|
|
1290
|
-
}
|
|
1291
|
-
function Pr(t, e) {
|
|
1292
|
-
const { projectId: r, appId: n, apiKey: s } = t.options;
|
|
1293
|
-
return {
|
|
1294
|
-
url: `${Re}/projects/${r}/apps/${n}:${Dr}?key=${s}`,
|
|
1295
|
-
body: {
|
|
1296
|
-
recaptcha_enterprise_token: e
|
|
1297
|
-
}
|
|
1298
|
-
};
|
|
1299
|
-
}
|
|
1300
|
-
function Pe(t, e) {
|
|
1301
|
-
const { projectId: r, appId: n, apiKey: s } = t.options;
|
|
1302
|
-
return {
|
|
1303
|
-
url: `${Re}/projects/${r}/apps/${n}:${kr}?key=${s}`,
|
|
1304
|
-
body: {
|
|
1305
|
-
// eslint-disable-next-line
|
|
1306
|
-
debug_token: e
|
|
1307
|
-
}
|
|
1308
|
-
};
|
|
1309
|
-
}
|
|
1310
|
-
const Mr = "firebase-app-check-database", Or = 1, D = "firebase-app-check-store", Me = "debug-token";
|
|
1311
|
-
let B = null;
|
|
1312
|
-
function Oe() {
|
|
1313
|
-
return B || (B = new Promise((t, e) => {
|
|
1314
|
-
try {
|
|
1315
|
-
const r = indexedDB.open(Mr, Or);
|
|
1316
|
-
r.onsuccess = (n) => {
|
|
1317
|
-
t(n.target.result);
|
|
1318
|
-
}, r.onerror = (n) => {
|
|
1319
|
-
e(u.create("storage-open", {
|
|
1320
|
-
originalErrorMessage: n.target.error?.message
|
|
1321
|
-
}));
|
|
1322
|
-
}, r.onupgradeneeded = (n) => {
|
|
1323
|
-
const s = n.target.result;
|
|
1324
|
-
n.oldVersion === 0 && s.createObjectStore(D, {
|
|
1325
|
-
keyPath: "compositeKey"
|
|
1326
|
-
});
|
|
1327
|
-
};
|
|
1328
|
-
} catch (r) {
|
|
1329
|
-
e(u.create("storage-open", {
|
|
1330
|
-
originalErrorMessage: r?.message
|
|
1331
|
-
}));
|
|
1332
|
-
}
|
|
1333
|
-
}), B);
|
|
1334
|
-
}
|
|
1335
|
-
function Nr(t) {
|
|
1336
|
-
return $e(xe(t));
|
|
1337
|
-
}
|
|
1338
|
-
function $r(t, e) {
|
|
1339
|
-
return Ne(xe(t), e);
|
|
1340
|
-
}
|
|
1341
|
-
function xr(t) {
|
|
1342
|
-
return Ne(Me, t);
|
|
1343
|
-
}
|
|
1344
|
-
function Lr() {
|
|
1345
|
-
return $e(Me);
|
|
1346
|
-
}
|
|
1347
|
-
async function Ne(t, e) {
|
|
1348
|
-
const n = (await Oe()).transaction(D, "readwrite"), o = n.objectStore(D).put({
|
|
1349
|
-
compositeKey: t,
|
|
1350
|
-
value: e
|
|
1351
|
-
});
|
|
1352
|
-
return new Promise((i, c) => {
|
|
1353
|
-
o.onsuccess = (a) => {
|
|
1354
|
-
i();
|
|
1355
|
-
}, n.onerror = (a) => {
|
|
1356
|
-
c(u.create("storage-set", {
|
|
1357
|
-
originalErrorMessage: a.target.error?.message
|
|
1358
|
-
}));
|
|
1359
|
-
};
|
|
1360
|
-
});
|
|
1361
|
-
}
|
|
1362
|
-
async function $e(t) {
|
|
1363
|
-
const r = (await Oe()).transaction(D, "readonly"), s = r.objectStore(D).get(t);
|
|
1364
|
-
return new Promise((o, i) => {
|
|
1365
|
-
s.onsuccess = (c) => {
|
|
1366
|
-
const a = c.target.result;
|
|
1367
|
-
o(a ? a.value : void 0);
|
|
1368
|
-
}, r.onerror = (c) => {
|
|
1369
|
-
i(u.create("storage-get", {
|
|
1370
|
-
originalErrorMessage: c.target.error?.message
|
|
1371
|
-
}));
|
|
1372
|
-
};
|
|
1373
|
-
});
|
|
1374
|
-
}
|
|
1375
|
-
function xe(t) {
|
|
1376
|
-
return `${t.options.appId}-${t.name}`;
|
|
1377
|
-
}
|
|
1378
|
-
const b = new Ie("@firebase/app-check");
|
|
1379
|
-
async function Hr(t) {
|
|
1380
|
-
if (J()) {
|
|
1381
|
-
let e;
|
|
1382
|
-
try {
|
|
1383
|
-
e = await Nr(t);
|
|
1384
|
-
} catch (r) {
|
|
1385
|
-
b.warn(`Failed to read token from IndexedDB. Error: ${r}`);
|
|
1386
|
-
}
|
|
1387
|
-
return e;
|
|
1388
|
-
}
|
|
1389
|
-
}
|
|
1390
|
-
function H(t, e) {
|
|
1391
|
-
return J() ? $r(t, e).catch((r) => {
|
|
1392
|
-
b.warn(`Failed to write token to IndexedDB. Error: ${r}`);
|
|
1393
|
-
}) : Promise.resolve();
|
|
1394
|
-
}
|
|
1395
|
-
async function Fr() {
|
|
1396
|
-
let t;
|
|
1397
|
-
try {
|
|
1398
|
-
t = await Lr();
|
|
1399
|
-
} catch {
|
|
1400
|
-
}
|
|
1401
|
-
if (t)
|
|
1402
|
-
return t;
|
|
1403
|
-
{
|
|
1404
|
-
const e = crypto.randomUUID();
|
|
1405
|
-
return xr(e).catch((r) => b.warn(`Failed to persist debug token to IndexedDB. Error: ${r}`)), e;
|
|
1406
|
-
}
|
|
1407
|
-
}
|
|
1408
|
-
function re() {
|
|
1409
|
-
return O().enabled;
|
|
1410
|
-
}
|
|
1411
|
-
async function ne() {
|
|
1412
|
-
const t = O();
|
|
1413
|
-
if (t.enabled && t.token)
|
|
1414
|
-
return t.token.promise;
|
|
1415
|
-
throw Error(`
|
|
1416
|
-
Can't get debug token in production mode.
|
|
1417
|
-
`);
|
|
1418
|
-
}
|
|
1419
|
-
function zr() {
|
|
1420
|
-
const t = ye(), e = O();
|
|
1421
|
-
if (e.initialized = !0, typeof t.FIREBASE_APPCHECK_DEBUG_TOKEN != "string" && t.FIREBASE_APPCHECK_DEBUG_TOKEN !== !0)
|
|
1422
|
-
return;
|
|
1423
|
-
e.enabled = !0;
|
|
1424
|
-
const r = new I();
|
|
1425
|
-
e.token = r, typeof t.FIREBASE_APPCHECK_DEBUG_TOKEN == "string" ? r.resolve(t.FIREBASE_APPCHECK_DEBUG_TOKEN) : r.resolve(Fr());
|
|
1426
|
-
}
|
|
1427
|
-
const Ur = { error: "UNKNOWN_ERROR" };
|
|
1428
|
-
function Vr(t) {
|
|
1429
|
-
return Y.encodeString(
|
|
1430
|
-
JSON.stringify(t),
|
|
1431
|
-
/* webSafe= */
|
|
1432
|
-
!1
|
|
1433
|
-
);
|
|
1434
|
-
}
|
|
1435
|
-
async function q(t, e = !1, r = !1) {
|
|
1436
|
-
const n = t.app;
|
|
1437
|
-
ee(n);
|
|
1438
|
-
const s = d(n);
|
|
1439
|
-
let o = s.token, i;
|
|
1440
|
-
if (o && !y(o) && (s.token = void 0, o = void 0), !o) {
|
|
1441
|
-
const l = await s.cachedTokenPromise;
|
|
1442
|
-
l && (y(l) ? o = l : await H(n, void 0));
|
|
1443
|
-
}
|
|
1444
|
-
if (!e && o && y(o))
|
|
1445
|
-
return {
|
|
1446
|
-
token: o.token
|
|
1447
|
-
};
|
|
1448
|
-
let c = !1;
|
|
1449
|
-
if (re())
|
|
1450
|
-
try {
|
|
1451
|
-
const l = await ne();
|
|
1452
|
-
s.exchangeTokenPromise || (s.exchangeTokenPromise = te(Pe(n, l), t.heartbeatServiceProvider).finally(() => {
|
|
1453
|
-
s.exchangeTokenPromise = void 0;
|
|
1454
|
-
}), c = !0);
|
|
1455
|
-
const p = await s.exchangeTokenPromise;
|
|
1456
|
-
return await H(n, p), s.token = p, { token: p.token };
|
|
1457
|
-
} catch (l) {
|
|
1458
|
-
return l.code === "appCheck/throttled" || l.code === "appCheck/initial-throttle" ? b.warn(l.message) : r && b.error(l), F(l);
|
|
1459
|
-
}
|
|
1460
|
-
try {
|
|
1461
|
-
s.exchangeTokenPromise || (s.exchangeTokenPromise = s.provider.getToken().finally(() => {
|
|
1462
|
-
s.exchangeTokenPromise = void 0;
|
|
1463
|
-
}), c = !0), o = await d(n).exchangeTokenPromise;
|
|
1464
|
-
} catch (l) {
|
|
1465
|
-
l.code === "appCheck/throttled" || l.code === "appCheck/initial-throttle" ? b.warn(l.message) : r && b.error(l), i = l;
|
|
1466
|
-
}
|
|
1467
|
-
let a;
|
|
1468
|
-
return o ? i ? y(o) ? a = {
|
|
1469
|
-
token: o.token,
|
|
1470
|
-
internalError: i
|
|
1471
|
-
} : a = F(i) : (a = {
|
|
1472
|
-
token: o.token
|
|
1473
|
-
}, s.token = o, await H(n, o)) : a = F(i), c && Fe(n, a), a;
|
|
1474
|
-
}
|
|
1475
|
-
async function Wr(t) {
|
|
1476
|
-
const e = t.app;
|
|
1477
|
-
ee(e);
|
|
1478
|
-
const { provider: r } = d(e);
|
|
1479
|
-
if (re()) {
|
|
1480
|
-
const n = await ne(), { token: s } = await te(Pe(e, n), t.heartbeatServiceProvider);
|
|
1481
|
-
return { token: s };
|
|
1482
|
-
} else {
|
|
1483
|
-
const { token: n } = await r.getToken();
|
|
1484
|
-
return { token: n };
|
|
1485
|
-
}
|
|
1486
|
-
}
|
|
1487
|
-
function Le(t, e, r, n) {
|
|
1488
|
-
const { app: s } = t, o = d(s), i = {
|
|
1489
|
-
next: r,
|
|
1490
|
-
error: n,
|
|
1491
|
-
type: e
|
|
1492
|
-
};
|
|
1493
|
-
if (o.tokenObservers = [...o.tokenObservers, i], o.token && y(o.token)) {
|
|
1494
|
-
const c = o.token;
|
|
1495
|
-
Promise.resolve().then(() => {
|
|
1496
|
-
r({ token: c.token }), me(t);
|
|
1497
|
-
}).catch(() => {
|
|
1498
|
-
});
|
|
1499
|
-
}
|
|
1500
|
-
o.cachedTokenPromise.then(() => me(t));
|
|
1501
|
-
}
|
|
1502
|
-
function He(t, e) {
|
|
1503
|
-
const r = d(t), n = r.tokenObservers.filter((s) => s.next !== e);
|
|
1504
|
-
n.length === 0 && r.tokenRefresher && r.tokenRefresher.isRunning() && r.tokenRefresher.stop(), r.tokenObservers = n;
|
|
1505
|
-
}
|
|
1506
|
-
function me(t) {
|
|
1507
|
-
const { app: e } = t, r = d(e);
|
|
1508
|
-
let n = r.tokenRefresher;
|
|
1509
|
-
n || (n = Kr(t), r.tokenRefresher = n), !n.isRunning() && r.isTokenAutoRefreshEnabled && n.start();
|
|
1510
|
-
}
|
|
1511
|
-
function Kr(t) {
|
|
1512
|
-
const { app: e } = t;
|
|
1513
|
-
return new vr(
|
|
1514
|
-
// Keep in mind when this fails for any reason other than the ones
|
|
1515
|
-
// for which we should retry, it will effectively stop the proactive refresh.
|
|
1516
|
-
async () => {
|
|
1517
|
-
const r = d(e);
|
|
1518
|
-
let n;
|
|
1519
|
-
if (r.token ? n = await q(t, !0) : n = await q(t), n.error)
|
|
1520
|
-
throw n.error;
|
|
1521
|
-
if (n.internalError)
|
|
1522
|
-
throw n.internalError;
|
|
1523
|
-
},
|
|
1524
|
-
() => !0,
|
|
1525
|
-
() => {
|
|
1526
|
-
const r = d(e);
|
|
1527
|
-
if (r.token) {
|
|
1528
|
-
let n = r.token.issuedAtTimeMillis + (r.token.expireTimeMillis - r.token.issuedAtTimeMillis) * 0.5 + 3e5;
|
|
1529
|
-
const s = r.token.expireTimeMillis - 300 * 1e3;
|
|
1530
|
-
return n = Math.min(n, s), Math.max(0, n - Date.now());
|
|
1531
|
-
} else
|
|
1532
|
-
return 0;
|
|
1533
|
-
},
|
|
1534
|
-
pe.RETRIAL_MIN_WAIT,
|
|
1535
|
-
pe.RETRIAL_MAX_WAIT
|
|
1536
|
-
);
|
|
1537
|
-
}
|
|
1538
|
-
function Fe(t, e) {
|
|
1539
|
-
const r = d(t).tokenObservers;
|
|
1540
|
-
for (const n of r)
|
|
1541
|
-
try {
|
|
1542
|
-
n.type === "EXTERNAL" && e.error != null ? n.error(e.error) : n.next(e);
|
|
1543
|
-
} catch {
|
|
1544
|
-
}
|
|
1545
|
-
}
|
|
1546
|
-
function y(t) {
|
|
1547
|
-
return t.expireTimeMillis - Date.now() > 0;
|
|
1548
|
-
}
|
|
1549
|
-
function F(t) {
|
|
1550
|
-
return {
|
|
1551
|
-
token: Vr(Ur),
|
|
1552
|
-
error: t
|
|
1553
|
-
};
|
|
1554
|
-
}
|
|
1555
|
-
class jr {
|
|
1556
|
-
constructor(e, r) {
|
|
1557
|
-
this.app = e, this.heartbeatServiceProvider = r;
|
|
1558
|
-
}
|
|
1559
|
-
_delete() {
|
|
1560
|
-
const { tokenObservers: e } = d(this.app);
|
|
1561
|
-
for (const r of e)
|
|
1562
|
-
He(this.app, r.next);
|
|
1563
|
-
return Promise.resolve();
|
|
1564
|
-
}
|
|
1565
|
-
}
|
|
1566
|
-
function Gr(t, e) {
|
|
1567
|
-
return new jr(t, e);
|
|
1568
|
-
}
|
|
1569
|
-
function qr(t) {
|
|
1570
|
-
return {
|
|
1571
|
-
getToken: (e) => q(t, e),
|
|
1572
|
-
getLimitedUseToken: () => Wr(t),
|
|
1573
|
-
addTokenListener: (e) => Le(t, "INTERNAL", e),
|
|
1574
|
-
removeTokenListener: (e) => He(t.app, e)
|
|
1575
|
-
};
|
|
1576
|
-
}
|
|
1577
|
-
const Xr = "@firebase/app-check", Yr = "0.11.1", Jr = "https://www.google.com/recaptcha/enterprise.js";
|
|
1578
|
-
function Zr(t, e) {
|
|
1579
|
-
const r = new I(), n = d(t);
|
|
1580
|
-
n.reCAPTCHAState = { initialized: r };
|
|
1581
|
-
const s = Qr(t), o = ge(!0);
|
|
1582
|
-
return o ? be(t, e, o, s, r) : rn(() => {
|
|
1583
|
-
const i = ge(!0);
|
|
1584
|
-
if (!i)
|
|
1585
|
-
throw new Error("no recaptcha");
|
|
1586
|
-
be(t, e, i, s, r);
|
|
1587
|
-
}), r.promise;
|
|
1588
|
-
}
|
|
1589
|
-
function be(t, e, r, n, s) {
|
|
1590
|
-
r.ready(() => {
|
|
1591
|
-
tn(t, e, r, n), s.resolve(r);
|
|
1592
|
-
});
|
|
1593
|
-
}
|
|
1594
|
-
function Qr(t) {
|
|
1595
|
-
const e = `fire_app_check_${t.name}`, r = document.createElement("div");
|
|
1596
|
-
return r.id = e, r.style.display = "none", document.body.appendChild(r), e;
|
|
1597
|
-
}
|
|
1598
|
-
async function en(t) {
|
|
1599
|
-
ee(t);
|
|
1600
|
-
const r = await d(t).reCAPTCHAState.initialized.promise;
|
|
1601
|
-
return new Promise((n, s) => {
|
|
1602
|
-
const o = d(t).reCAPTCHAState;
|
|
1603
|
-
r.ready(() => {
|
|
1604
|
-
n(
|
|
1605
|
-
// widgetId is guaranteed to be available if reCAPTCHAState.initialized.promise resolved.
|
|
1606
|
-
r.execute(o.widgetId, {
|
|
1607
|
-
action: "fire_app_check"
|
|
1608
|
-
})
|
|
1609
|
-
);
|
|
1610
|
-
});
|
|
1611
|
-
});
|
|
1612
|
-
}
|
|
1613
|
-
function tn(t, e, r, n) {
|
|
1614
|
-
const s = r.render(n, {
|
|
1615
|
-
sitekey: e,
|
|
1616
|
-
size: "invisible",
|
|
1617
|
-
// Success callback - set state
|
|
1618
|
-
callback: () => {
|
|
1619
|
-
d(t).reCAPTCHAState.succeeded = !0;
|
|
1620
|
-
},
|
|
1621
|
-
// Failure callback - set state
|
|
1622
|
-
"error-callback": () => {
|
|
1623
|
-
d(t).reCAPTCHAState.succeeded = !1;
|
|
1624
|
-
}
|
|
1625
|
-
}), o = d(t);
|
|
1626
|
-
o.reCAPTCHAState = {
|
|
1627
|
-
...o.reCAPTCHAState,
|
|
1628
|
-
// state.reCAPTCHAState is set in the initialize()
|
|
1629
|
-
widgetId: s
|
|
1630
|
-
};
|
|
1631
|
-
}
|
|
1632
|
-
function rn(t) {
|
|
1633
|
-
const e = document.createElement("script");
|
|
1634
|
-
e.src = Jr, e.onload = t, document.head.appendChild(e);
|
|
1635
|
-
}
|
|
1636
|
-
class se {
|
|
1637
|
-
/**
|
|
1638
|
-
* Create a ReCaptchaEnterpriseProvider instance.
|
|
1639
|
-
* @param siteKey - reCAPTCHA Enterprise score-based site key.
|
|
1640
|
-
*/
|
|
1641
|
-
constructor(e) {
|
|
1642
|
-
this._siteKey = e, this._throttleData = null;
|
|
1643
|
-
}
|
|
1644
|
-
/**
|
|
1645
|
-
* Returns an App Check token.
|
|
1646
|
-
* @internal
|
|
1647
|
-
*/
|
|
1648
|
-
async getToken() {
|
|
1649
|
-
sn(this._throttleData);
|
|
1650
|
-
const e = await en(this._app).catch((n) => {
|
|
1651
|
-
throw u.create(
|
|
1652
|
-
"recaptcha-error"
|
|
1653
|
-
/* AppCheckError.RECAPTCHA_ERROR */
|
|
1654
|
-
);
|
|
1655
|
-
});
|
|
1656
|
-
if (!d(this._app).reCAPTCHAState?.succeeded)
|
|
1657
|
-
throw u.create(
|
|
1658
|
-
"recaptcha-error"
|
|
1659
|
-
/* AppCheckError.RECAPTCHA_ERROR */
|
|
1660
|
-
);
|
|
1661
|
-
let r;
|
|
1662
|
-
try {
|
|
1663
|
-
r = await te(Pr(this._app, e), this._heartbeatServiceProvider);
|
|
1664
|
-
} catch (n) {
|
|
1665
|
-
throw n.code?.includes(
|
|
1666
|
-
"fetch-status-error"
|
|
1667
|
-
/* AppCheckError.FETCH_STATUS_ERROR */
|
|
1668
|
-
) ? (this._throttleData = nn(Number(n.customData?.httpStatus), this._throttleData), u.create("initial-throttle", {
|
|
1669
|
-
time: Be(this._throttleData.allowRequestsAfter - Date.now()),
|
|
1670
|
-
httpStatus: this._throttleData.httpStatus
|
|
1671
|
-
})) : n;
|
|
1672
|
-
}
|
|
1673
|
-
return this._throttleData = null, r;
|
|
1674
|
-
}
|
|
1675
|
-
/**
|
|
1676
|
-
* @internal
|
|
1677
|
-
*/
|
|
1678
|
-
initialize(e) {
|
|
1679
|
-
this._app = e, this._heartbeatServiceProvider = De(e, "heartbeat"), Zr(e, this._siteKey).catch(() => {
|
|
1680
|
-
});
|
|
1681
|
-
}
|
|
1682
|
-
/**
|
|
1683
|
-
* @internal
|
|
1684
|
-
*/
|
|
1685
|
-
isEqual(e) {
|
|
1686
|
-
return e instanceof se ? this._siteKey === e._siteKey : !1;
|
|
1687
|
-
}
|
|
1688
|
-
}
|
|
1689
|
-
function nn(t, e) {
|
|
1690
|
-
if (t === 404 || t === 403)
|
|
1691
|
-
return {
|
|
1692
|
-
backoffCount: 1,
|
|
1693
|
-
allowRequestsAfter: Date.now() + Sr,
|
|
1694
|
-
httpStatus: t
|
|
1695
|
-
};
|
|
1696
|
-
{
|
|
1697
|
-
const r = e ? e.backoffCount : 0, n = ft(r, 1e3, 2);
|
|
1698
|
-
return {
|
|
1699
|
-
backoffCount: r + 1,
|
|
1700
|
-
allowRequestsAfter: Date.now() + n,
|
|
1701
|
-
httpStatus: t
|
|
1702
|
-
};
|
|
1703
|
-
}
|
|
1704
|
-
}
|
|
1705
|
-
function sn(t) {
|
|
1706
|
-
if (t && Date.now() - t.allowRequestsAfter <= 0)
|
|
1707
|
-
throw u.create("throttled", {
|
|
1708
|
-
time: Be(t.allowRequestsAfter - Date.now()),
|
|
1709
|
-
httpStatus: t.httpStatus
|
|
1710
|
-
});
|
|
1711
|
-
}
|
|
1712
|
-
function on(t = fr(), e) {
|
|
1713
|
-
t = pt(t);
|
|
1714
|
-
const r = De(t, "app-check");
|
|
1715
|
-
if (O().initialized || zr(), re() && ne().then((s) => (
|
|
1716
|
-
// Not using logger because I don't think we ever want this accidentally hidden.
|
|
1717
|
-
console.log(`App Check debug token: ${s}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)
|
|
1718
|
-
)), r.isInitialized()) {
|
|
1719
|
-
const s = r.getImmediate(), o = r.getOptions();
|
|
1720
|
-
if (o.isTokenAutoRefreshEnabled === e.isTokenAutoRefreshEnabled && o.provider.isEqual(e.provider))
|
|
1721
|
-
return s;
|
|
1722
|
-
throw u.create("already-initialized", {
|
|
1723
|
-
appName: t.name
|
|
1724
|
-
});
|
|
1725
|
-
}
|
|
1726
|
-
const n = r.initialize({ options: e });
|
|
1727
|
-
return an(t, e.provider, e.isTokenAutoRefreshEnabled), d(t).isTokenAutoRefreshEnabled && Le(n, "INTERNAL", () => {
|
|
1728
|
-
}), n;
|
|
1729
|
-
}
|
|
1730
|
-
function an(t, e, r = !1) {
|
|
1731
|
-
const n = Cr(t, { ...ve });
|
|
1732
|
-
n.activated = !0, n.provider = e, n.cachedTokenPromise = Hr(t).then((s) => (s && y(s) && (n.token = s, Fe(t, { token: s.token })), s)), n.isTokenAutoRefreshEnabled = r && t.automaticDataCollectionEnabled, !t.automaticDataCollectionEnabled && r && b.warn("`isTokenAutoRefreshEnabled` is true but `automaticDataCollectionEnabled` was set to false during `initializeApp()`. This blocks automatic token refresh."), n.provider.initialize(t);
|
|
1733
|
-
}
|
|
1734
|
-
const cn = "app-check", Ee = "app-check-internal";
|
|
1735
|
-
function ln() {
|
|
1736
|
-
T(new A(
|
|
1737
|
-
cn,
|
|
1738
|
-
(t) => {
|
|
1739
|
-
const e = t.getProvider("app").getImmediate(), r = t.getProvider("heartbeat");
|
|
1740
|
-
return Gr(e, r);
|
|
1741
|
-
},
|
|
1742
|
-
"PUBLIC"
|
|
1743
|
-
/* ComponentType.PUBLIC */
|
|
1744
|
-
).setInstantiationMode(
|
|
1745
|
-
"EXPLICIT"
|
|
1746
|
-
/* InstantiationMode.EXPLICIT */
|
|
1747
|
-
).setInstanceCreatedCallback((t, e, r) => {
|
|
1748
|
-
t.getProvider(Ee).initialize();
|
|
1749
|
-
})), T(new A(
|
|
1750
|
-
Ee,
|
|
1751
|
-
(t) => {
|
|
1752
|
-
const e = t.getProvider("app-check").getImmediate();
|
|
1753
|
-
return qr(e);
|
|
1754
|
-
},
|
|
1755
|
-
"PUBLIC"
|
|
1756
|
-
/* ComponentType.PUBLIC */
|
|
1757
|
-
).setInstantiationMode(
|
|
1758
|
-
"EXPLICIT"
|
|
1759
|
-
/* InstantiationMode.EXPLICIT */
|
|
1760
|
-
)), P(Xr, Yr);
|
|
1761
|
-
}
|
|
1762
|
-
ln();
|
|
1763
|
-
function X(t) {
|
|
1764
|
-
if (!t)
|
|
1765
|
-
return;
|
|
1766
|
-
const e = {
|
|
1767
|
-
description: t.description,
|
|
1768
|
-
nullable: t.nullable || !1,
|
|
1769
|
-
format: t.format
|
|
1770
|
-
};
|
|
1771
|
-
switch (Array.isArray(t.type) && t.type.includes("null") && (e.nullable = !0, t.type = t.type.find((r) => r !== "null")), t.type) {
|
|
1772
|
-
case "string":
|
|
1773
|
-
return t.enum && Array.isArray(t.enum) ? m.enumString({
|
|
1774
|
-
...e,
|
|
1775
|
-
enum: t.enum
|
|
1776
|
-
}) : m.string(e);
|
|
1777
|
-
case "number":
|
|
1778
|
-
return m.number(e);
|
|
1779
|
-
case "integer":
|
|
1780
|
-
return m.integer(e);
|
|
1781
|
-
case "boolean":
|
|
1782
|
-
return m.boolean(e);
|
|
1783
|
-
case "array":
|
|
1784
|
-
return m.array({
|
|
1785
|
-
...e,
|
|
1786
|
-
// Recursively convert the 'items' schema
|
|
1787
|
-
items: X(t.items)
|
|
1788
|
-
});
|
|
1789
|
-
case "object": {
|
|
1790
|
-
const r = {}, n = t.properties ? Object.keys(t.properties) : [];
|
|
1791
|
-
n.forEach((i) => {
|
|
1792
|
-
r[i] = X(
|
|
1793
|
-
t.properties[i]
|
|
1794
|
-
);
|
|
1795
|
-
});
|
|
1796
|
-
const s = t.required || [], o = n.filter(
|
|
1797
|
-
(i) => !s.includes(i)
|
|
1798
|
-
);
|
|
1799
|
-
return m.object({
|
|
1800
|
-
...e,
|
|
1801
|
-
properties: r,
|
|
1802
|
-
optionalProperties: o
|
|
1803
|
-
});
|
|
1804
|
-
}
|
|
1805
|
-
default:
|
|
1806
|
-
return console.warn(
|
|
1807
|
-
`Unsupported type: ${t.type}, defaulting to string.`
|
|
1808
|
-
), m.string(e);
|
|
1809
|
-
}
|
|
1810
|
-
}
|
|
1811
|
-
class fn extends qe {
|
|
1812
|
-
#e;
|
|
1813
|
-
#t;
|
|
1814
|
-
constructor(e) {
|
|
1815
|
-
const {
|
|
1816
|
-
geminiApiProvider: r,
|
|
1817
|
-
modelName: n,
|
|
1818
|
-
useAppCheck: s,
|
|
1819
|
-
reCaptchaSiteKey: o,
|
|
1820
|
-
useLimitedUseAppCheckTokens: i,
|
|
1821
|
-
...c
|
|
1822
|
-
} = e;
|
|
1823
|
-
super(n || Xe.firebase.modelName);
|
|
1824
|
-
const a = Ue(c);
|
|
1825
|
-
s && o && on(a, {
|
|
1826
|
-
provider: new se(o),
|
|
1827
|
-
isTokenAutoRefreshEnabled: !0
|
|
1828
|
-
});
|
|
1829
|
-
const l = r === "vertex" ? new Ve() : new We();
|
|
1830
|
-
this.#t = Ke(a, {
|
|
1831
|
-
backend: l,
|
|
1832
|
-
useLimitedUseAppCheckTokens: i || !0
|
|
1833
|
-
});
|
|
1834
|
-
}
|
|
1835
|
-
/**
|
|
1836
|
-
* Translates a standard JSON Schema into a backend-specific format.
|
|
1837
|
-
* @param {Object} schema - The standard JSON Schema.
|
|
1838
|
-
* @returns {any} The backend-specific schema.
|
|
1839
|
-
*/
|
|
1840
|
-
convertSchema(e) {
|
|
1841
|
-
return X(e);
|
|
1842
|
-
}
|
|
1843
|
-
/**
|
|
1844
|
-
* Creates a model session and stores it.
|
|
1845
|
-
* @param {Object} _options - LanguageModel options.
|
|
1846
|
-
* @param {Object} sessionParams - Parameters for the cloud or local model.
|
|
1847
|
-
* @returns {any} The created session object.
|
|
1848
|
-
*/
|
|
1849
|
-
createSession(e, r) {
|
|
1850
|
-
return this.#e = je(this.#t, {
|
|
1851
|
-
mode: Ge.ONLY_IN_CLOUD,
|
|
1852
|
-
inCloudParams: r
|
|
1853
|
-
}), this.#e;
|
|
1854
|
-
}
|
|
1855
|
-
/**
|
|
1856
|
-
* Generates content (non-streaming).
|
|
1857
|
-
* @param {Array} contents - The history + new message content.
|
|
1858
|
-
* @returns {Promise<{text: string, usage: number}>}
|
|
1859
|
-
*/
|
|
1860
|
-
async generateContent(e) {
|
|
1861
|
-
const r = await this.#e.generateContent({ contents: e }), n = r.response.usageMetadata?.promptTokenCount || 0;
|
|
1862
|
-
return { text: r.response.text(), usage: n };
|
|
1863
|
-
}
|
|
1864
|
-
/**
|
|
1865
|
-
* Generates content stream.
|
|
1866
|
-
* @param {Array} contents - The history + new content.
|
|
1867
|
-
* @returns {Promise<AsyncIterable>} Stream of chunks.
|
|
1868
|
-
*/
|
|
1869
|
-
async generateContentStream(e) {
|
|
1870
|
-
return (await this.#e.generateContentStream({ contents: e })).stream;
|
|
1871
|
-
}
|
|
1872
|
-
/**
|
|
1873
|
-
* Counts tokens.
|
|
1874
|
-
* @param {Array} contents - The content to count.
|
|
1875
|
-
* @returns {Promise<number>} Total tokens.
|
|
1876
|
-
*/
|
|
1877
|
-
async countTokens(e) {
|
|
1878
|
-
const { totalTokens: r } = await this.#e.countTokens({
|
|
1879
|
-
contents: e
|
|
1880
|
-
});
|
|
1881
|
-
return r;
|
|
1882
|
-
}
|
|
1883
|
-
}
|
|
1884
|
-
export {
|
|
1885
|
-
fn as default
|
|
1274
|
+
function Vn(e, t) {
|
|
1275
|
+
if (e === 404 || e === 403) return {
|
|
1276
|
+
backoffCount: 1,
|
|
1277
|
+
allowRequestsAfter: Date.now() + $t,
|
|
1278
|
+
httpStatus: e
|
|
1279
|
+
};
|
|
1280
|
+
{
|
|
1281
|
+
let n = t ? t.backoffCount : 0, r = ye(n, 1e3, 2);
|
|
1282
|
+
return {
|
|
1283
|
+
backoffCount: n + 1,
|
|
1284
|
+
allowRequestsAfter: Date.now() + r,
|
|
1285
|
+
httpStatus: e
|
|
1286
|
+
};
|
|
1287
|
+
}
|
|
1288
|
+
}
|
|
1289
|
+
function Hn(e) {
|
|
1290
|
+
if (e && Date.now() - e.allowRequestsAfter <= 0) throw z.create("throttled", {
|
|
1291
|
+
time: rn(e.allowRequestsAfter - Date.now()),
|
|
1292
|
+
httpStatus: e.httpStatus
|
|
1293
|
+
});
|
|
1294
|
+
}
|
|
1295
|
+
function Un(e = kt(), t) {
|
|
1296
|
+
e = be(e);
|
|
1297
|
+
let n = Et(e, "app-check");
|
|
1298
|
+
if (R().initialized || bn(), q() && J().then((e) => console.log(`App Check debug token: ${e}. You will need to add it to your app's App Check settings in the Firebase console for it to work.`)), n.isInitialized()) {
|
|
1299
|
+
let r = n.getImmediate(), i = n.getOptions();
|
|
1300
|
+
if (i.isTokenAutoRefreshEnabled === t.isTokenAutoRefreshEnabled && i.provider.isEqual(t.provider)) return r;
|
|
1301
|
+
throw z.create("already-initialized", { appName: e.name });
|
|
1302
|
+
}
|
|
1303
|
+
let r = n.initialize({ options: t });
|
|
1304
|
+
return Wn(e, t.provider, t.isTokenAutoRefreshEnabled), L(e).isTokenAutoRefreshEnabled && wn(r, "INTERNAL", () => {}), r;
|
|
1305
|
+
}
|
|
1306
|
+
function Wn(e, t, n = !1) {
|
|
1307
|
+
let r = Jt(e, { ...Kt });
|
|
1308
|
+
r.activated = !0, r.provider = t, r.cachedTokenPromise = vn(e).then((t) => (t && X(t) && (r.token = t, On(e, { token: t.token })), t)), r.isTokenAutoRefreshEnabled = n && e.automaticDataCollectionEnabled, !e.automaticDataCollectionEnabled && n && G.warn("`isTokenAutoRefreshEnabled` is true but `automaticDataCollectionEnabled` was set to false during `initializeApp()`. This blocks automatic token refresh."), r.provider.initialize(e);
|
|
1309
|
+
}
|
|
1310
|
+
var Gn = "app-check", Kn = "app-check-internal";
|
|
1311
|
+
function qn() {
|
|
1312
|
+
M(new v(Gn, (e) => An(e.getProvider("app").getImmediate(), e.getProvider("heartbeat")), "PUBLIC").setInstantiationMode("EXPLICIT").setInstanceCreatedCallback((e, t, n) => {
|
|
1313
|
+
e.getProvider(Kn).initialize();
|
|
1314
|
+
})), M(new v(Kn, (e) => jn(e.getProvider("app-check").getImmediate()), "PUBLIC").setInstantiationMode("EXPLICIT")), P(Mn, Nn);
|
|
1315
|
+
}
|
|
1316
|
+
qn();
|
|
1317
|
+
//#endregion
|
|
1318
|
+
//#region backends/firebase.js
|
|
1319
|
+
function $(e) {
|
|
1320
|
+
if (!e) return;
|
|
1321
|
+
let t = {
|
|
1322
|
+
description: e.description,
|
|
1323
|
+
nullable: e.nullable || !1,
|
|
1324
|
+
format: e.format
|
|
1325
|
+
};
|
|
1326
|
+
switch (Array.isArray(e.type) && e.type.includes("null") && (t.nullable = !0, e.type = e.type.find((e) => e !== "null")), e.type) {
|
|
1327
|
+
case "string": return e.enum && Array.isArray(e.enum) ? a.enumString({
|
|
1328
|
+
...t,
|
|
1329
|
+
enum: e.enum
|
|
1330
|
+
}) : a.string(t);
|
|
1331
|
+
case "number": return a.number(t);
|
|
1332
|
+
case "integer": return a.integer(t);
|
|
1333
|
+
case "boolean": return a.boolean(t);
|
|
1334
|
+
case "array": return a.array({
|
|
1335
|
+
...t,
|
|
1336
|
+
items: $(e.items)
|
|
1337
|
+
});
|
|
1338
|
+
case "object": {
|
|
1339
|
+
let n = {}, r = e.properties ? Object.keys(e.properties) : [];
|
|
1340
|
+
r.forEach((t) => {
|
|
1341
|
+
n[t] = $(e.properties[t]);
|
|
1342
|
+
});
|
|
1343
|
+
let i = e.required || [], o = r.filter((e) => !i.includes(e));
|
|
1344
|
+
return a.object({
|
|
1345
|
+
...t,
|
|
1346
|
+
properties: n,
|
|
1347
|
+
optionalProperties: o
|
|
1348
|
+
});
|
|
1349
|
+
}
|
|
1350
|
+
default: return console.warn(`Unsupported type: ${e.type}, defaulting to string.`), a.string(t);
|
|
1351
|
+
}
|
|
1352
|
+
}
|
|
1353
|
+
var Jn = class extends e {
|
|
1354
|
+
#e;
|
|
1355
|
+
#t;
|
|
1356
|
+
constructor(e) {
|
|
1357
|
+
let { geminiApiProvider: i, modelName: a, useAppCheck: c, reCaptchaSiteKey: l, useLimitedUseAppCheckTokens: u, ...d } = e;
|
|
1358
|
+
super(a || t.firebase.modelName);
|
|
1359
|
+
let f = n(d);
|
|
1360
|
+
c && l && Un(f, {
|
|
1361
|
+
provider: new Bn(l),
|
|
1362
|
+
isTokenAutoRefreshEnabled: !0
|
|
1363
|
+
}), this.#t = s(f, {
|
|
1364
|
+
backend: i === "vertex" ? new o() : new r(),
|
|
1365
|
+
useLimitedUseAppCheckTokens: u || !0
|
|
1366
|
+
});
|
|
1367
|
+
}
|
|
1368
|
+
convertSchema(e) {
|
|
1369
|
+
return $(e);
|
|
1370
|
+
}
|
|
1371
|
+
createSession(e, t) {
|
|
1372
|
+
return this.#e = c(this.#t, {
|
|
1373
|
+
mode: i.ONLY_IN_CLOUD,
|
|
1374
|
+
inCloudParams: t
|
|
1375
|
+
}), this.#e;
|
|
1376
|
+
}
|
|
1377
|
+
async generateContent(e) {
|
|
1378
|
+
let t = await this.#e.generateContent({ contents: e }), n = t.response.usageMetadata?.promptTokenCount || 0;
|
|
1379
|
+
return {
|
|
1380
|
+
text: t.response.text(),
|
|
1381
|
+
usage: n
|
|
1382
|
+
};
|
|
1383
|
+
}
|
|
1384
|
+
async generateContentStream(e) {
|
|
1385
|
+
return (await this.#e.generateContentStream({ contents: e })).stream;
|
|
1386
|
+
}
|
|
1387
|
+
async countTokens(e) {
|
|
1388
|
+
let { totalTokens: t } = await this.#e.countTokens({ contents: e });
|
|
1389
|
+
return t;
|
|
1390
|
+
}
|
|
1886
1391
|
};
|
|
1392
|
+
//#endregion
|
|
1393
|
+
export { Jn as default };
|