@feedmepos/mf-settings 0.0.48-beta.0-ex → 0.0.48-beta.1

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.
Files changed (29) hide show
  1. package/dist/App-15361c1a.js +4352 -0
  2. package/dist/Business-1564c1b4.js +3893 -0
  3. package/dist/{CreateBusiness-e05859f6.js → CreateBusiness-138ac258.js} +12 -15
  4. package/dist/FoodCourt-561cd7e3.js +47798 -0
  5. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-977372d5.js +395 -0
  6. package/dist/Tagging-9126557f.js +6680 -0
  7. package/dist/actionButton-cc6bcf01.js +66 -0
  8. package/dist/app-ce0bb813.js +782 -0
  9. package/dist/app.js +6 -11
  10. package/dist/apps/mf-settings/src/app.d.ts +1 -2
  11. package/dist/apps/mf-settings/src/components/business/RestaurantForm.vue.d.ts +1 -1
  12. package/dist/apps/mf-settings/src/components/tagging/TaggingForm.vue.d.ts +3 -3
  13. package/dist/apps/mf-settings/src/init.d.ts +1 -0
  14. package/dist/apps/mf-settings/src/store/attributeSettings.d.ts +15 -15
  15. package/dist/apps/mf-settings/tsconfig.app.tsbuildinfo +1 -1
  16. package/dist/business-9a4e5bd7.js +31 -0
  17. package/dist/createForm-681e977a.js +64 -0
  18. package/dist/index-1eb3cc0a.js +17754 -0
  19. package/dist/index-f1e5e565.js +10903 -0
  20. package/dist/index.esm2017-c60b1ce5.js +3147 -0
  21. package/dist/loading-84215dce.js +2385 -0
  22. package/dist/packages/shared/src/components/form/ImageDropField.vue.d.ts +1 -1
  23. package/dist/packages/shared/src/components/loading/PageLoading.vue.d.ts +2 -0
  24. package/dist/packages/shared/src/components/loading/index.d.ts +1 -0
  25. package/package.json +3 -3
  26. package/dist/Business-c2cc9ee7.js +0 -4182
  27. package/dist/FoodCourt-b9e42611.js +0 -12454
  28. package/dist/ResponsiveFabButton.vue_vue_type_script_setup_true_lang-65f62fbb.js +0 -101
  29. package/dist/app-29117ada.js +0 -17441
@@ -0,0 +1,3147 @@
1
+ import { ref as ot } from "vue";
2
+ const oe = ot(null), Zr = () => oe.value;
3
+ function Qr(t) {
4
+ oe.value || (oe.value = t);
5
+ }
6
+ const es = Object.freeze({
7
+ jb: {
8
+ lat: 1.492659,
9
+ lng: 103.7413591
10
+ }
11
+ });
12
+ function ts(t) {
13
+ return [t.lng, t.lat];
14
+ }
15
+ function ns(t) {
16
+ if (t.length !== 2)
17
+ throw Error("Invalid coordinate array");
18
+ return {
19
+ lat: t[1],
20
+ lng: t[0]
21
+ };
22
+ }
23
+ /**
24
+ * @license
25
+ * Copyright 2017 Google LLC
26
+ *
27
+ * Licensed under the Apache License, Version 2.0 (the "License");
28
+ * you may not use this file except in compliance with the License.
29
+ * You may obtain a copy of the License at
30
+ *
31
+ * http://www.apache.org/licenses/LICENSE-2.0
32
+ *
33
+ * Unless required by applicable law or agreed to in writing, software
34
+ * distributed under the License is distributed on an "AS IS" BASIS,
35
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
36
+ * See the License for the specific language governing permissions and
37
+ * limitations under the License.
38
+ */
39
+ /**
40
+ * @license
41
+ * Copyright 2017 Google LLC
42
+ *
43
+ * Licensed under the Apache License, Version 2.0 (the "License");
44
+ * you may not use this file except in compliance with the License.
45
+ * You may obtain a copy of the License at
46
+ *
47
+ * http://www.apache.org/licenses/LICENSE-2.0
48
+ *
49
+ * Unless required by applicable law or agreed to in writing, software
50
+ * distributed under the License is distributed on an "AS IS" BASIS,
51
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
52
+ * See the License for the specific language governing permissions and
53
+ * limitations under the License.
54
+ */
55
+ const Be = function(t) {
56
+ const e = [];
57
+ let n = 0;
58
+ for (let r = 0; r < t.length; r++) {
59
+ let s = t.charCodeAt(r);
60
+ s < 128 ? e[n++] = s : s < 2048 ? (e[n++] = s >> 6 | 192, e[n++] = s & 63 | 128) : (s & 64512) === 55296 && r + 1 < t.length && (t.charCodeAt(r + 1) & 64512) === 56320 ? (s = 65536 + ((s & 1023) << 10) + (t.charCodeAt(++r) & 1023), e[n++] = s >> 18 | 240, e[n++] = s >> 12 & 63 | 128, e[n++] = s >> 6 & 63 | 128, e[n++] = s & 63 | 128) : (e[n++] = s >> 12 | 224, e[n++] = s >> 6 & 63 | 128, e[n++] = s & 63 | 128);
61
+ }
62
+ return e;
63
+ }, it = function(t) {
64
+ const e = [];
65
+ let n = 0, r = 0;
66
+ for (; n < t.length; ) {
67
+ const s = t[n++];
68
+ if (s < 128)
69
+ e[r++] = String.fromCharCode(s);
70
+ else if (s > 191 && s < 224) {
71
+ const o = t[n++];
72
+ e[r++] = String.fromCharCode((s & 31) << 6 | o & 63);
73
+ } else if (s > 239 && s < 365) {
74
+ const o = t[n++], i = t[n++], a = t[n++], c = ((s & 7) << 18 | (o & 63) << 12 | (i & 63) << 6 | a & 63) - 65536;
75
+ e[r++] = String.fromCharCode(55296 + (c >> 10)), e[r++] = String.fromCharCode(56320 + (c & 1023));
76
+ } else {
77
+ const o = t[n++], i = t[n++];
78
+ e[r++] = String.fromCharCode((s & 15) << 12 | (o & 63) << 6 | i & 63);
79
+ }
80
+ }
81
+ return e.join("");
82
+ }, xe = {
83
+ /**
84
+ * Maps bytes to characters.
85
+ */
86
+ byteToCharMap_: null,
87
+ /**
88
+ * Maps characters to bytes.
89
+ */
90
+ charToByteMap_: null,
91
+ /**
92
+ * Maps bytes to websafe characters.
93
+ * @private
94
+ */
95
+ byteToCharMapWebSafe_: null,
96
+ /**
97
+ * Maps websafe characters to bytes.
98
+ * @private
99
+ */
100
+ charToByteMapWebSafe_: null,
101
+ /**
102
+ * Our default alphabet, shared between
103
+ * ENCODED_VALS and ENCODED_VALS_WEBSAFE
104
+ */
105
+ ENCODED_VALS_BASE: "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789",
106
+ /**
107
+ * Our default alphabet. Value 64 (=) is special; it means "nothing."
108
+ */
109
+ get ENCODED_VALS() {
110
+ return this.ENCODED_VALS_BASE + "+/=";
111
+ },
112
+ /**
113
+ * Our websafe alphabet.
114
+ */
115
+ get ENCODED_VALS_WEBSAFE() {
116
+ return this.ENCODED_VALS_BASE + "-_.";
117
+ },
118
+ /**
119
+ * Whether this browser supports the atob and btoa functions. This extension
120
+ * started at Mozilla but is now implemented by many browsers. We use the
121
+ * ASSUME_* variables to avoid pulling in the full useragent detection library
122
+ * but still allowing the standard per-browser compilations.
123
+ *
124
+ */
125
+ HAS_NATIVE_SUPPORT: typeof atob == "function",
126
+ /**
127
+ * Base64-encode an array of bytes.
128
+ *
129
+ * @param input An array of bytes (numbers with
130
+ * value in [0, 255]) to encode.
131
+ * @param webSafe Boolean indicating we should use the
132
+ * alternative alphabet.
133
+ * @return The base64 encoded string.
134
+ */
135
+ encodeByteArray(t, e) {
136
+ if (!Array.isArray(t))
137
+ throw Error("encodeByteArray takes an array as a parameter");
138
+ this.init_();
139
+ const n = e ? this.byteToCharMapWebSafe_ : this.byteToCharMap_, r = [];
140
+ for (let s = 0; s < t.length; s += 3) {
141
+ const o = t[s], i = s + 1 < t.length, a = i ? t[s + 1] : 0, c = s + 2 < t.length, l = c ? t[s + 2] : 0, g = o >> 2, f = (o & 3) << 4 | a >> 4;
142
+ let p = (a & 15) << 2 | l >> 6, m = l & 63;
143
+ c || (m = 64, i || (p = 64)), r.push(n[g], n[f], n[p], n[m]);
144
+ }
145
+ return r.join("");
146
+ },
147
+ /**
148
+ * Base64-encode a string.
149
+ *
150
+ * @param input A string to encode.
151
+ * @param webSafe If true, we should use the
152
+ * alternative alphabet.
153
+ * @return The base64 encoded string.
154
+ */
155
+ encodeString(t, e) {
156
+ return this.HAS_NATIVE_SUPPORT && !e ? btoa(t) : this.encodeByteArray(Be(t), e);
157
+ },
158
+ /**
159
+ * Base64-decode a string.
160
+ *
161
+ * @param input to decode.
162
+ * @param webSafe True if we should use the
163
+ * alternative alphabet.
164
+ * @return string representing the decoded value.
165
+ */
166
+ decodeString(t, e) {
167
+ return this.HAS_NATIVE_SUPPORT && !e ? atob(t) : it(this.decodeStringToByteArray(t, e));
168
+ },
169
+ /**
170
+ * Base64-decode a string.
171
+ *
172
+ * In base-64 decoding, groups of four characters are converted into three
173
+ * bytes. If the encoder did not apply padding, the input length may not
174
+ * be a multiple of 4.
175
+ *
176
+ * In this case, the last group will have fewer than 4 characters, and
177
+ * padding will be inferred. If the group has one or two characters, it decodes
178
+ * to one byte. If the group has three characters, it decodes to two bytes.
179
+ *
180
+ * @param input Input to decode.
181
+ * @param webSafe True if we should use the web-safe alphabet.
182
+ * @return bytes representing the decoded value.
183
+ */
184
+ decodeStringToByteArray(t, e) {
185
+ this.init_();
186
+ const n = e ? this.charToByteMapWebSafe_ : this.charToByteMap_, r = [];
187
+ for (let s = 0; s < t.length; ) {
188
+ const o = n[t.charAt(s++)], a = s < t.length ? n[t.charAt(s)] : 0;
189
+ ++s;
190
+ const l = s < t.length ? n[t.charAt(s)] : 64;
191
+ ++s;
192
+ const f = s < t.length ? n[t.charAt(s)] : 64;
193
+ if (++s, o == null || a == null || l == null || f == null)
194
+ throw new at();
195
+ const p = o << 2 | a >> 4;
196
+ if (r.push(p), l !== 64) {
197
+ const m = a << 4 & 240 | l >> 2;
198
+ if (r.push(m), f !== 64) {
199
+ const w = l << 6 & 192 | f;
200
+ r.push(w);
201
+ }
202
+ }
203
+ }
204
+ return r;
205
+ },
206
+ /**
207
+ * Lazy static initialization function. Called before
208
+ * accessing any of the static map variables.
209
+ * @private
210
+ */
211
+ init_() {
212
+ if (!this.byteToCharMap_) {
213
+ this.byteToCharMap_ = {}, this.charToByteMap_ = {}, this.byteToCharMapWebSafe_ = {}, this.charToByteMapWebSafe_ = {};
214
+ for (let t = 0; t < this.ENCODED_VALS.length; t++)
215
+ 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);
216
+ }
217
+ }
218
+ };
219
+ class at extends Error {
220
+ constructor() {
221
+ super(...arguments), this.name = "DecodeBase64StringError";
222
+ }
223
+ }
224
+ const ct = function(t) {
225
+ const e = Be(t);
226
+ return xe.encodeByteArray(e, !0);
227
+ }, q = function(t) {
228
+ return ct(t).replace(/\./g, "");
229
+ }, lt = function(t) {
230
+ try {
231
+ return xe.decodeString(t, !0);
232
+ } catch (e) {
233
+ console.error("base64Decode failed: ", e);
234
+ }
235
+ return null;
236
+ };
237
+ /**
238
+ * @license
239
+ * Copyright 2022 Google LLC
240
+ *
241
+ * Licensed under the Apache License, Version 2.0 (the "License");
242
+ * you may not use this file except in compliance with the License.
243
+ * You may obtain a copy of the License at
244
+ *
245
+ * http://www.apache.org/licenses/LICENSE-2.0
246
+ *
247
+ * Unless required by applicable law or agreed to in writing, software
248
+ * distributed under the License is distributed on an "AS IS" BASIS,
249
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
250
+ * See the License for the specific language governing permissions and
251
+ * limitations under the License.
252
+ */
253
+ function ut() {
254
+ if (typeof self < "u")
255
+ return self;
256
+ if (typeof window < "u")
257
+ return window;
258
+ if (typeof global < "u")
259
+ return global;
260
+ throw new Error("Unable to locate global object.");
261
+ }
262
+ /**
263
+ * @license
264
+ * Copyright 2022 Google LLC
265
+ *
266
+ * Licensed under the Apache License, Version 2.0 (the "License");
267
+ * you may not use this file except in compliance with the License.
268
+ * You may obtain a copy of the License at
269
+ *
270
+ * http://www.apache.org/licenses/LICENSE-2.0
271
+ *
272
+ * Unless required by applicable law or agreed to in writing, software
273
+ * distributed under the License is distributed on an "AS IS" BASIS,
274
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
275
+ * See the License for the specific language governing permissions and
276
+ * limitations under the License.
277
+ */
278
+ const ht = () => ut().__FIREBASE_DEFAULTS__, dt = () => {
279
+ if (typeof process > "u" || typeof process.env > "u")
280
+ return;
281
+ const t = process.env.__FIREBASE_DEFAULTS__;
282
+ if (t)
283
+ return JSON.parse(t);
284
+ }, ft = () => {
285
+ if (typeof document > "u")
286
+ return;
287
+ let t;
288
+ try {
289
+ t = document.cookie.match(/__FIREBASE_DEFAULTS__=([^;]+)/);
290
+ } catch {
291
+ return;
292
+ }
293
+ const e = t && lt(t[1]);
294
+ return e && JSON.parse(e);
295
+ }, K = () => {
296
+ try {
297
+ return ht() || dt() || ft();
298
+ } catch (t) {
299
+ console.info(`Unable to get __FIREBASE_DEFAULTS__ due to: ${t}`);
300
+ return;
301
+ }
302
+ }, pt = (t) => {
303
+ var e, n;
304
+ return (n = (e = K()) === null || e === void 0 ? void 0 : e.emulatorHosts) === null || n === void 0 ? void 0 : n[t];
305
+ }, gt = (t) => {
306
+ const e = pt(t);
307
+ if (!e)
308
+ return;
309
+ const n = e.lastIndexOf(":");
310
+ if (n <= 0 || n + 1 === e.length)
311
+ throw new Error(`Invalid host ${e} with no separate hostname and port!`);
312
+ const r = parseInt(e.substring(n + 1), 10);
313
+ return e[0] === "[" ? [e.substring(1, n - 1), r] : [e.substring(0, n), r];
314
+ }, Ue = () => {
315
+ var t;
316
+ return (t = K()) === null || t === void 0 ? void 0 : t.config;
317
+ }, rs = (t) => {
318
+ var e;
319
+ return (e = K()) === null || e === void 0 ? void 0 : e[`_${t}`];
320
+ };
321
+ /**
322
+ * @license
323
+ * Copyright 2017 Google LLC
324
+ *
325
+ * Licensed under the Apache License, Version 2.0 (the "License");
326
+ * you may not use this file except in compliance with the License.
327
+ * You may obtain a copy of the License at
328
+ *
329
+ * http://www.apache.org/licenses/LICENSE-2.0
330
+ *
331
+ * Unless required by applicable law or agreed to in writing, software
332
+ * distributed under the License is distributed on an "AS IS" BASIS,
333
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
334
+ * See the License for the specific language governing permissions and
335
+ * limitations under the License.
336
+ */
337
+ class mt {
338
+ constructor() {
339
+ this.reject = () => {
340
+ }, this.resolve = () => {
341
+ }, this.promise = new Promise((e, n) => {
342
+ this.resolve = e, this.reject = n;
343
+ });
344
+ }
345
+ /**
346
+ * Our API internals are not promiseified and cannot because our callback APIs have subtle expectations around
347
+ * invoking promises inline, which Promises are forbidden to do. This method accepts an optional node-style callback
348
+ * and returns a node-style callback which will resolve or reject the Deferred's promise.
349
+ */
350
+ wrapCallback(e) {
351
+ return (n, r) => {
352
+ n ? this.reject(n) : this.resolve(r), typeof e == "function" && (this.promise.catch(() => {
353
+ }), e.length === 1 ? e(n) : e(n, r));
354
+ };
355
+ }
356
+ }
357
+ /**
358
+ * @license
359
+ * Copyright 2021 Google LLC
360
+ *
361
+ * Licensed under the Apache License, Version 2.0 (the "License");
362
+ * you may not use this file except in compliance with the License.
363
+ * You may obtain a copy of the License at
364
+ *
365
+ * http://www.apache.org/licenses/LICENSE-2.0
366
+ *
367
+ * Unless required by applicable law or agreed to in writing, software
368
+ * distributed under the License is distributed on an "AS IS" BASIS,
369
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
370
+ * See the License for the specific language governing permissions and
371
+ * limitations under the License.
372
+ */
373
+ function _t(t, e) {
374
+ if (t.uid)
375
+ throw new Error('The "uid" field is no longer supported by mockUserToken. Please use "sub" instead for Firebase Auth User ID.');
376
+ const n = {
377
+ alg: "none",
378
+ type: "JWT"
379
+ }, r = e || "demo-project", s = t.iat || 0, o = t.sub || t.user_id;
380
+ if (!o)
381
+ throw new Error("mockUserToken must contain 'sub' or 'user_id' field!");
382
+ const i = Object.assign({
383
+ // Set all required fields to decent defaults
384
+ iss: `https://securetoken.google.com/${r}`,
385
+ aud: r,
386
+ iat: s,
387
+ exp: s + 3600,
388
+ auth_time: s,
389
+ sub: o,
390
+ user_id: o,
391
+ firebase: {
392
+ sign_in_provider: "custom",
393
+ identities: {}
394
+ }
395
+ }, t), a = "";
396
+ return [
397
+ q(JSON.stringify(n)),
398
+ q(JSON.stringify(i)),
399
+ a
400
+ ].join(".");
401
+ }
402
+ /**
403
+ * @license
404
+ * Copyright 2017 Google LLC
405
+ *
406
+ * Licensed under the Apache License, Version 2.0 (the "License");
407
+ * you may not use this file except in compliance with the License.
408
+ * You may obtain a copy of the License at
409
+ *
410
+ * http://www.apache.org/licenses/LICENSE-2.0
411
+ *
412
+ * Unless required by applicable law or agreed to in writing, software
413
+ * distributed under the License is distributed on an "AS IS" BASIS,
414
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
415
+ * See the License for the specific language governing permissions and
416
+ * limitations under the License.
417
+ */
418
+ function Pe() {
419
+ return typeof navigator < "u" && typeof navigator.userAgent == "string" ? navigator.userAgent : "";
420
+ }
421
+ function ss() {
422
+ return typeof window < "u" && // @ts-ignore Setting up an broadly applicable index signature for Window
423
+ // just to deal with this case would probably be a bad idea.
424
+ !!(window.cordova || window.phonegap || window.PhoneGap) && /ios|iphone|ipod|ipad|android|blackberry|iemobile/i.test(Pe());
425
+ }
426
+ function bt() {
427
+ var t;
428
+ const e = (t = K()) === null || t === void 0 ? void 0 : t.forceEnvironment;
429
+ if (e === "node")
430
+ return !0;
431
+ if (e === "browser")
432
+ return !1;
433
+ try {
434
+ return Object.prototype.toString.call(global.process) === "[object process]";
435
+ } catch {
436
+ return !1;
437
+ }
438
+ }
439
+ function os() {
440
+ const t = typeof chrome == "object" ? chrome.runtime : typeof browser == "object" ? browser.runtime : void 0;
441
+ return typeof t == "object" && t.id !== void 0;
442
+ }
443
+ function is() {
444
+ return typeof navigator == "object" && navigator.product === "ReactNative";
445
+ }
446
+ function as() {
447
+ const t = Pe();
448
+ return t.indexOf("MSIE ") >= 0 || t.indexOf("Trident/") >= 0;
449
+ }
450
+ function yt() {
451
+ try {
452
+ return typeof indexedDB == "object";
453
+ } catch {
454
+ return !1;
455
+ }
456
+ }
457
+ function Et() {
458
+ return new Promise((t, e) => {
459
+ try {
460
+ let n = !0;
461
+ const r = "validate-browser-context-for-indexeddb-analytics-module", s = self.indexedDB.open(r);
462
+ s.onsuccess = () => {
463
+ s.result.close(), n || self.indexedDB.deleteDatabase(r), t(!0);
464
+ }, s.onupgradeneeded = () => {
465
+ n = !1;
466
+ }, s.onerror = () => {
467
+ var o;
468
+ e(((o = s.error) === null || o === void 0 ? void 0 : o.message) || "");
469
+ };
470
+ } catch (n) {
471
+ e(n);
472
+ }
473
+ });
474
+ }
475
+ /**
476
+ * @license
477
+ * Copyright 2017 Google LLC
478
+ *
479
+ * Licensed under the Apache License, Version 2.0 (the "License");
480
+ * you may not use this file except in compliance with the License.
481
+ * You may obtain a copy of the License at
482
+ *
483
+ * http://www.apache.org/licenses/LICENSE-2.0
484
+ *
485
+ * Unless required by applicable law or agreed to in writing, software
486
+ * distributed under the License is distributed on an "AS IS" BASIS,
487
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
488
+ * See the License for the specific language governing permissions and
489
+ * limitations under the License.
490
+ */
491
+ const wt = "FirebaseError";
492
+ class x extends Error {
493
+ constructor(e, n, r) {
494
+ super(n), this.code = e, this.customData = r, this.name = wt, Object.setPrototypeOf(this, x.prototype), Error.captureStackTrace && Error.captureStackTrace(this, Le.prototype.create);
495
+ }
496
+ }
497
+ class Le {
498
+ constructor(e, n, r) {
499
+ this.service = e, this.serviceName = n, this.errors = r;
500
+ }
501
+ create(e, ...n) {
502
+ const r = n[0] || {}, s = `${this.service}/${e}`, o = this.errors[e], i = o ? It(o, r) : "Error", a = `${this.serviceName}: ${i} (${s}).`;
503
+ return new x(s, a, r);
504
+ }
505
+ }
506
+ function It(t, e) {
507
+ return t.replace(Rt, (n, r) => {
508
+ const s = e[r];
509
+ return s != null ? String(s) : `<${r}?>`;
510
+ });
511
+ }
512
+ const Rt = /\{\$([^}]+)}/g;
513
+ function cs(t) {
514
+ for (const e in t)
515
+ if (Object.prototype.hasOwnProperty.call(t, e))
516
+ return !1;
517
+ return !0;
518
+ }
519
+ function ie(t, e) {
520
+ if (t === e)
521
+ return !0;
522
+ const n = Object.keys(t), r = Object.keys(e);
523
+ for (const s of n) {
524
+ if (!r.includes(s))
525
+ return !1;
526
+ const o = t[s], i = e[s];
527
+ if (Ee(o) && Ee(i)) {
528
+ if (!ie(o, i))
529
+ return !1;
530
+ } else if (o !== i)
531
+ return !1;
532
+ }
533
+ for (const s of r)
534
+ if (!n.includes(s))
535
+ return !1;
536
+ return !0;
537
+ }
538
+ function Ee(t) {
539
+ return t !== null && typeof t == "object";
540
+ }
541
+ /**
542
+ * @license
543
+ * Copyright 2017 Google LLC
544
+ *
545
+ * Licensed under the Apache License, Version 2.0 (the "License");
546
+ * you may not use this file except in compliance with the License.
547
+ * You may obtain a copy of the License at
548
+ *
549
+ * http://www.apache.org/licenses/LICENSE-2.0
550
+ *
551
+ * Unless required by applicable law or agreed to in writing, software
552
+ * distributed under the License is distributed on an "AS IS" BASIS,
553
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554
+ * See the License for the specific language governing permissions and
555
+ * limitations under the License.
556
+ */
557
+ function ls(t) {
558
+ const e = [];
559
+ for (const [n, r] of Object.entries(t))
560
+ Array.isArray(r) ? r.forEach((s) => {
561
+ e.push(encodeURIComponent(n) + "=" + encodeURIComponent(s));
562
+ }) : e.push(encodeURIComponent(n) + "=" + encodeURIComponent(r));
563
+ return e.length ? "&" + e.join("&") : "";
564
+ }
565
+ function us(t, e) {
566
+ const n = new Tt(t, e);
567
+ return n.subscribe.bind(n);
568
+ }
569
+ class Tt {
570
+ /**
571
+ * @param executor Function which can make calls to a single Observer
572
+ * as a proxy.
573
+ * @param onNoObservers Callback when count of Observers goes to zero.
574
+ */
575
+ constructor(e, n) {
576
+ this.observers = [], this.unsubscribes = [], this.observerCount = 0, this.task = Promise.resolve(), this.finalized = !1, this.onNoObservers = n, this.task.then(() => {
577
+ e(this);
578
+ }).catch((r) => {
579
+ this.error(r);
580
+ });
581
+ }
582
+ next(e) {
583
+ this.forEachObserver((n) => {
584
+ n.next(e);
585
+ });
586
+ }
587
+ error(e) {
588
+ this.forEachObserver((n) => {
589
+ n.error(e);
590
+ }), this.close(e);
591
+ }
592
+ complete() {
593
+ this.forEachObserver((e) => {
594
+ e.complete();
595
+ }), this.close();
596
+ }
597
+ /**
598
+ * Subscribe function that can be used to add an Observer to the fan-out list.
599
+ *
600
+ * - We require that no event is sent to a subscriber sychronously to their
601
+ * call to subscribe().
602
+ */
603
+ subscribe(e, n, r) {
604
+ let s;
605
+ if (e === void 0 && n === void 0 && r === void 0)
606
+ throw new Error("Missing Observer.");
607
+ At(e, [
608
+ "next",
609
+ "error",
610
+ "complete"
611
+ ]) ? s = e : s = {
612
+ next: e,
613
+ error: n,
614
+ complete: r
615
+ }, s.next === void 0 && (s.next = Z), s.error === void 0 && (s.error = Z), s.complete === void 0 && (s.complete = Z);
616
+ const o = this.unsubscribeOne.bind(this, this.observers.length);
617
+ return this.finalized && this.task.then(() => {
618
+ try {
619
+ this.finalError ? s.error(this.finalError) : s.complete();
620
+ } catch {
621
+ }
622
+ }), this.observers.push(s), o;
623
+ }
624
+ // Unsubscribe is synchronous - we guarantee that no events are sent to
625
+ // any unsubscribed Observer.
626
+ unsubscribeOne(e) {
627
+ this.observers === void 0 || this.observers[e] === void 0 || (delete this.observers[e], this.observerCount -= 1, this.observerCount === 0 && this.onNoObservers !== void 0 && this.onNoObservers(this));
628
+ }
629
+ forEachObserver(e) {
630
+ if (!this.finalized)
631
+ for (let n = 0; n < this.observers.length; n++)
632
+ this.sendOne(n, e);
633
+ }
634
+ // Call the Observer via one of it's callback function. We are careful to
635
+ // confirm that the observe has not been unsubscribed since this asynchronous
636
+ // function had been queued.
637
+ sendOne(e, n) {
638
+ this.task.then(() => {
639
+ if (this.observers !== void 0 && this.observers[e] !== void 0)
640
+ try {
641
+ n(this.observers[e]);
642
+ } catch (r) {
643
+ typeof console < "u" && console.error && console.error(r);
644
+ }
645
+ });
646
+ }
647
+ close(e) {
648
+ this.finalized || (this.finalized = !0, e !== void 0 && (this.finalError = e), this.task.then(() => {
649
+ this.observers = void 0, this.onNoObservers = void 0;
650
+ }));
651
+ }
652
+ }
653
+ function At(t, e) {
654
+ if (typeof t != "object" || t === null)
655
+ return !1;
656
+ for (const n of e)
657
+ if (n in t && typeof t[n] == "function")
658
+ return !0;
659
+ return !1;
660
+ }
661
+ function Z() {
662
+ }
663
+ /**
664
+ * @license
665
+ * Copyright 2021 Google LLC
666
+ *
667
+ * Licensed under the Apache License, Version 2.0 (the "License");
668
+ * you may not use this file except in compliance with the License.
669
+ * You may obtain a copy of the License at
670
+ *
671
+ * http://www.apache.org/licenses/LICENSE-2.0
672
+ *
673
+ * Unless required by applicable law or agreed to in writing, software
674
+ * distributed under the License is distributed on an "AS IS" BASIS,
675
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
676
+ * See the License for the specific language governing permissions and
677
+ * limitations under the License.
678
+ */
679
+ function U(t) {
680
+ return t && t._delegate ? t._delegate : t;
681
+ }
682
+ class $ {
683
+ /**
684
+ *
685
+ * @param name The public service name, e.g. app, auth, firestore, database
686
+ * @param instanceFactory Service factory responsible for creating the public interface
687
+ * @param type whether the service provided by the component is public or private
688
+ */
689
+ constructor(e, n, r) {
690
+ this.name = e, this.instanceFactory = n, this.type = r, this.multipleInstances = !1, this.serviceProps = {}, this.instantiationMode = "LAZY", this.onInstanceCreated = null;
691
+ }
692
+ setInstantiationMode(e) {
693
+ return this.instantiationMode = e, this;
694
+ }
695
+ setMultipleInstances(e) {
696
+ return this.multipleInstances = e, this;
697
+ }
698
+ setServiceProps(e) {
699
+ return this.serviceProps = e, this;
700
+ }
701
+ setInstanceCreatedCallback(e) {
702
+ return this.onInstanceCreated = e, this;
703
+ }
704
+ }
705
+ /**
706
+ * @license
707
+ * Copyright 2019 Google LLC
708
+ *
709
+ * Licensed under the Apache License, Version 2.0 (the "License");
710
+ * you may not use this file except in compliance with the License.
711
+ * You may obtain a copy of the License at
712
+ *
713
+ * http://www.apache.org/licenses/LICENSE-2.0
714
+ *
715
+ * Unless required by applicable law or agreed to in writing, software
716
+ * distributed under the License is distributed on an "AS IS" BASIS,
717
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
718
+ * See the License for the specific language governing permissions and
719
+ * limitations under the License.
720
+ */
721
+ const C = "[DEFAULT]";
722
+ /**
723
+ * @license
724
+ * Copyright 2019 Google LLC
725
+ *
726
+ * Licensed under the Apache License, Version 2.0 (the "License");
727
+ * you may not use this file except in compliance with the License.
728
+ * You may obtain a copy of the License at
729
+ *
730
+ * http://www.apache.org/licenses/LICENSE-2.0
731
+ *
732
+ * Unless required by applicable law or agreed to in writing, software
733
+ * distributed under the License is distributed on an "AS IS" BASIS,
734
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
735
+ * See the License for the specific language governing permissions and
736
+ * limitations under the License.
737
+ */
738
+ class vt {
739
+ constructor(e, n) {
740
+ this.name = e, this.container = n, this.component = null, this.instances = /* @__PURE__ */ new Map(), this.instancesDeferred = /* @__PURE__ */ new Map(), this.instancesOptions = /* @__PURE__ */ new Map(), this.onInitCallbacks = /* @__PURE__ */ new Map();
741
+ }
742
+ /**
743
+ * @param identifier A provider can provide mulitple instances of a service
744
+ * if this.component.multipleInstances is true.
745
+ */
746
+ get(e) {
747
+ const n = this.normalizeInstanceIdentifier(e);
748
+ if (!this.instancesDeferred.has(n)) {
749
+ const r = new mt();
750
+ if (this.instancesDeferred.set(n, r), this.isInitialized(n) || this.shouldAutoInitialize())
751
+ try {
752
+ const s = this.getOrInitializeService({
753
+ instanceIdentifier: n
754
+ });
755
+ s && r.resolve(s);
756
+ } catch {
757
+ }
758
+ }
759
+ return this.instancesDeferred.get(n).promise;
760
+ }
761
+ getImmediate(e) {
762
+ var n;
763
+ const r = this.normalizeInstanceIdentifier(e == null ? void 0 : e.identifier), s = (n = e == null ? void 0 : e.optional) !== null && n !== void 0 ? n : !1;
764
+ if (this.isInitialized(r) || this.shouldAutoInitialize())
765
+ try {
766
+ return this.getOrInitializeService({
767
+ instanceIdentifier: r
768
+ });
769
+ } catch (o) {
770
+ if (s)
771
+ return null;
772
+ throw o;
773
+ }
774
+ else {
775
+ if (s)
776
+ return null;
777
+ throw Error(`Service ${this.name} is not available`);
778
+ }
779
+ }
780
+ getComponent() {
781
+ return this.component;
782
+ }
783
+ setComponent(e) {
784
+ if (e.name !== this.name)
785
+ throw Error(`Mismatching Component ${e.name} for Provider ${this.name}.`);
786
+ if (this.component)
787
+ throw Error(`Component for ${this.name} has already been provided`);
788
+ if (this.component = e, !!this.shouldAutoInitialize()) {
789
+ if (Ct(e))
790
+ try {
791
+ this.getOrInitializeService({ instanceIdentifier: C });
792
+ } catch {
793
+ }
794
+ for (const [n, r] of this.instancesDeferred.entries()) {
795
+ const s = this.normalizeInstanceIdentifier(n);
796
+ try {
797
+ const o = this.getOrInitializeService({
798
+ instanceIdentifier: s
799
+ });
800
+ r.resolve(o);
801
+ } catch {
802
+ }
803
+ }
804
+ }
805
+ }
806
+ clearInstance(e = C) {
807
+ this.instancesDeferred.delete(e), this.instancesOptions.delete(e), this.instances.delete(e);
808
+ }
809
+ // app.delete() will call this method on every provider to delete the services
810
+ // TODO: should we mark the provider as deleted?
811
+ async delete() {
812
+ const e = Array.from(this.instances.values());
813
+ await Promise.all([
814
+ ...e.filter((n) => "INTERNAL" in n).map((n) => n.INTERNAL.delete()),
815
+ ...e.filter((n) => "_delete" in n).map((n) => n._delete())
816
+ ]);
817
+ }
818
+ isComponentSet() {
819
+ return this.component != null;
820
+ }
821
+ isInitialized(e = C) {
822
+ return this.instances.has(e);
823
+ }
824
+ getOptions(e = C) {
825
+ return this.instancesOptions.get(e) || {};
826
+ }
827
+ initialize(e = {}) {
828
+ const { options: n = {} } = e, r = this.normalizeInstanceIdentifier(e.instanceIdentifier);
829
+ if (this.isInitialized(r))
830
+ throw Error(`${this.name}(${r}) has already been initialized`);
831
+ if (!this.isComponentSet())
832
+ throw Error(`Component ${this.name} has not been registered yet`);
833
+ const s = this.getOrInitializeService({
834
+ instanceIdentifier: r,
835
+ options: n
836
+ });
837
+ for (const [o, i] of this.instancesDeferred.entries()) {
838
+ const a = this.normalizeInstanceIdentifier(o);
839
+ r === a && i.resolve(s);
840
+ }
841
+ return s;
842
+ }
843
+ /**
844
+ *
845
+ * @param callback - a function that will be invoked after the provider has been initialized by calling provider.initialize().
846
+ * The function is invoked SYNCHRONOUSLY, so it should not execute any longrunning tasks in order to not block the program.
847
+ *
848
+ * @param identifier An optional instance identifier
849
+ * @returns a function to unregister the callback
850
+ */
851
+ onInit(e, n) {
852
+ var r;
853
+ const s = this.normalizeInstanceIdentifier(n), o = (r = this.onInitCallbacks.get(s)) !== null && r !== void 0 ? r : /* @__PURE__ */ new Set();
854
+ o.add(e), this.onInitCallbacks.set(s, o);
855
+ const i = this.instances.get(s);
856
+ return i && e(i, s), () => {
857
+ o.delete(e);
858
+ };
859
+ }
860
+ /**
861
+ * Invoke onInit callbacks synchronously
862
+ * @param instance the service instance`
863
+ */
864
+ invokeOnInitCallbacks(e, n) {
865
+ const r = this.onInitCallbacks.get(n);
866
+ if (r)
867
+ for (const s of r)
868
+ try {
869
+ s(e, n);
870
+ } catch {
871
+ }
872
+ }
873
+ getOrInitializeService({ instanceIdentifier: e, options: n = {} }) {
874
+ let r = this.instances.get(e);
875
+ if (!r && this.component && (r = this.component.instanceFactory(this.container, {
876
+ instanceIdentifier: Dt(e),
877
+ options: n
878
+ }), this.instances.set(e, r), this.instancesOptions.set(e, n), this.invokeOnInitCallbacks(r, e), this.component.onInstanceCreated))
879
+ try {
880
+ this.component.onInstanceCreated(this.container, e, r);
881
+ } catch {
882
+ }
883
+ return r || null;
884
+ }
885
+ normalizeInstanceIdentifier(e = C) {
886
+ return this.component ? this.component.multipleInstances ? e : C : e;
887
+ }
888
+ shouldAutoInitialize() {
889
+ return !!this.component && this.component.instantiationMode !== "EXPLICIT";
890
+ }
891
+ }
892
+ function Dt(t) {
893
+ return t === C ? void 0 : t;
894
+ }
895
+ function Ct(t) {
896
+ return t.instantiationMode === "EAGER";
897
+ }
898
+ /**
899
+ * @license
900
+ * Copyright 2019 Google LLC
901
+ *
902
+ * Licensed under the Apache License, Version 2.0 (the "License");
903
+ * you may not use this file except in compliance with the License.
904
+ * You may obtain a copy of the License at
905
+ *
906
+ * http://www.apache.org/licenses/LICENSE-2.0
907
+ *
908
+ * Unless required by applicable law or agreed to in writing, software
909
+ * distributed under the License is distributed on an "AS IS" BASIS,
910
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
911
+ * See the License for the specific language governing permissions and
912
+ * limitations under the License.
913
+ */
914
+ class Ot {
915
+ constructor(e) {
916
+ this.name = e, this.providers = /* @__PURE__ */ new Map();
917
+ }
918
+ /**
919
+ *
920
+ * @param component Component being added
921
+ * @param overwrite When a component with the same name has already been registered,
922
+ * if overwrite is true: overwrite the existing component with the new component and create a new
923
+ * provider with the new component. It can be useful in tests where you want to use different mocks
924
+ * for different tests.
925
+ * if overwrite is false: throw an exception
926
+ */
927
+ addComponent(e) {
928
+ const n = this.getProvider(e.name);
929
+ if (n.isComponentSet())
930
+ throw new Error(`Component ${e.name} has already been registered with ${this.name}`);
931
+ n.setComponent(e);
932
+ }
933
+ addOrOverwriteComponent(e) {
934
+ this.getProvider(e.name).isComponentSet() && this.providers.delete(e.name), this.addComponent(e);
935
+ }
936
+ /**
937
+ * getProvider provides a type safe interface where it can only be called with a field name
938
+ * present in NameServiceMapping interface.
939
+ *
940
+ * Firebase SDKs providing services should extend NameServiceMapping interface to register
941
+ * themselves.
942
+ */
943
+ getProvider(e) {
944
+ if (this.providers.has(e))
945
+ return this.providers.get(e);
946
+ const n = new vt(e, this);
947
+ return this.providers.set(e, n), n;
948
+ }
949
+ getProviders() {
950
+ return Array.from(this.providers.values());
951
+ }
952
+ }
953
+ /**
954
+ * @license
955
+ * Copyright 2017 Google LLC
956
+ *
957
+ * Licensed under the Apache License, Version 2.0 (the "License");
958
+ * you may not use this file except in compliance with the License.
959
+ * You may obtain a copy of the License at
960
+ *
961
+ * http://www.apache.org/licenses/LICENSE-2.0
962
+ *
963
+ * Unless required by applicable law or agreed to in writing, software
964
+ * distributed under the License is distributed on an "AS IS" BASIS,
965
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
966
+ * See the License for the specific language governing permissions and
967
+ * limitations under the License.
968
+ */
969
+ var u;
970
+ (function(t) {
971
+ 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";
972
+ })(u || (u = {}));
973
+ const St = {
974
+ debug: u.DEBUG,
975
+ verbose: u.VERBOSE,
976
+ info: u.INFO,
977
+ warn: u.WARN,
978
+ error: u.ERROR,
979
+ silent: u.SILENT
980
+ }, Nt = u.INFO, kt = {
981
+ [u.DEBUG]: "log",
982
+ [u.VERBOSE]: "log",
983
+ [u.INFO]: "info",
984
+ [u.WARN]: "warn",
985
+ [u.ERROR]: "error"
986
+ }, Bt = (t, e, ...n) => {
987
+ if (e < t.logLevel)
988
+ return;
989
+ const r = (/* @__PURE__ */ new Date()).toISOString(), s = kt[e];
990
+ if (s)
991
+ console[s](`[${r}] ${t.name}:`, ...n);
992
+ else
993
+ throw new Error(`Attempted to log a message with an invalid logType (value: ${e})`);
994
+ };
995
+ class xt {
996
+ /**
997
+ * Gives you an instance of a Logger to capture messages according to
998
+ * Firebase's logging scheme.
999
+ *
1000
+ * @param name The name that the logs will be associated with
1001
+ */
1002
+ constructor(e) {
1003
+ this.name = e, this._logLevel = Nt, this._logHandler = Bt, this._userLogHandler = null;
1004
+ }
1005
+ get logLevel() {
1006
+ return this._logLevel;
1007
+ }
1008
+ set logLevel(e) {
1009
+ if (!(e in u))
1010
+ throw new TypeError(`Invalid value "${e}" assigned to \`logLevel\``);
1011
+ this._logLevel = e;
1012
+ }
1013
+ // Workaround for setter/getter having to be the same type.
1014
+ setLogLevel(e) {
1015
+ this._logLevel = typeof e == "string" ? St[e] : e;
1016
+ }
1017
+ get logHandler() {
1018
+ return this._logHandler;
1019
+ }
1020
+ set logHandler(e) {
1021
+ if (typeof e != "function")
1022
+ throw new TypeError("Value assigned to `logHandler` must be a function");
1023
+ this._logHandler = e;
1024
+ }
1025
+ get userLogHandler() {
1026
+ return this._userLogHandler;
1027
+ }
1028
+ set userLogHandler(e) {
1029
+ this._userLogHandler = e;
1030
+ }
1031
+ /**
1032
+ * The functions below are all based on the `console` interface
1033
+ */
1034
+ debug(...e) {
1035
+ this._userLogHandler && this._userLogHandler(this, u.DEBUG, ...e), this._logHandler(this, u.DEBUG, ...e);
1036
+ }
1037
+ log(...e) {
1038
+ this._userLogHandler && this._userLogHandler(this, u.VERBOSE, ...e), this._logHandler(this, u.VERBOSE, ...e);
1039
+ }
1040
+ info(...e) {
1041
+ this._userLogHandler && this._userLogHandler(this, u.INFO, ...e), this._logHandler(this, u.INFO, ...e);
1042
+ }
1043
+ warn(...e) {
1044
+ this._userLogHandler && this._userLogHandler(this, u.WARN, ...e), this._logHandler(this, u.WARN, ...e);
1045
+ }
1046
+ error(...e) {
1047
+ this._userLogHandler && this._userLogHandler(this, u.ERROR, ...e), this._logHandler(this, u.ERROR, ...e);
1048
+ }
1049
+ }
1050
+ const Ut = (t, e) => e.some((n) => t instanceof n);
1051
+ let we, Ie;
1052
+ function Pt() {
1053
+ return we || (we = [
1054
+ IDBDatabase,
1055
+ IDBObjectStore,
1056
+ IDBIndex,
1057
+ IDBCursor,
1058
+ IDBTransaction
1059
+ ]);
1060
+ }
1061
+ function Lt() {
1062
+ return Ie || (Ie = [
1063
+ IDBCursor.prototype.advance,
1064
+ IDBCursor.prototype.continue,
1065
+ IDBCursor.prototype.continuePrimaryKey
1066
+ ]);
1067
+ }
1068
+ const Me = /* @__PURE__ */ new WeakMap(), ae = /* @__PURE__ */ new WeakMap(), $e = /* @__PURE__ */ new WeakMap(), Q = /* @__PURE__ */ new WeakMap(), fe = /* @__PURE__ */ new WeakMap();
1069
+ function Mt(t) {
1070
+ const e = new Promise((n, r) => {
1071
+ const s = () => {
1072
+ t.removeEventListener("success", o), t.removeEventListener("error", i);
1073
+ }, o = () => {
1074
+ n(A(t.result)), s();
1075
+ }, i = () => {
1076
+ r(t.error), s();
1077
+ };
1078
+ t.addEventListener("success", o), t.addEventListener("error", i);
1079
+ });
1080
+ return e.then((n) => {
1081
+ n instanceof IDBCursor && Me.set(n, t);
1082
+ }).catch(() => {
1083
+ }), fe.set(e, t), e;
1084
+ }
1085
+ function $t(t) {
1086
+ if (ae.has(t))
1087
+ return;
1088
+ const e = new Promise((n, r) => {
1089
+ const s = () => {
1090
+ t.removeEventListener("complete", o), t.removeEventListener("error", i), t.removeEventListener("abort", i);
1091
+ }, o = () => {
1092
+ n(), s();
1093
+ }, i = () => {
1094
+ r(t.error || new DOMException("AbortError", "AbortError")), s();
1095
+ };
1096
+ t.addEventListener("complete", o), t.addEventListener("error", i), t.addEventListener("abort", i);
1097
+ });
1098
+ ae.set(t, e);
1099
+ }
1100
+ let ce = {
1101
+ get(t, e, n) {
1102
+ if (t instanceof IDBTransaction) {
1103
+ if (e === "done")
1104
+ return ae.get(t);
1105
+ if (e === "objectStoreNames")
1106
+ return t.objectStoreNames || $e.get(t);
1107
+ if (e === "store")
1108
+ return n.objectStoreNames[1] ? void 0 : n.objectStore(n.objectStoreNames[0]);
1109
+ }
1110
+ return A(t[e]);
1111
+ },
1112
+ set(t, e, n) {
1113
+ return t[e] = n, !0;
1114
+ },
1115
+ has(t, e) {
1116
+ return t instanceof IDBTransaction && (e === "done" || e === "store") ? !0 : e in t;
1117
+ }
1118
+ };
1119
+ function Ft(t) {
1120
+ ce = t(ce);
1121
+ }
1122
+ function Ht(t) {
1123
+ return t === IDBDatabase.prototype.transaction && !("objectStoreNames" in IDBTransaction.prototype) ? function(e, ...n) {
1124
+ const r = t.call(ee(this), e, ...n);
1125
+ return $e.set(r, e.sort ? e.sort() : [e]), A(r);
1126
+ } : Lt().includes(t) ? function(...e) {
1127
+ return t.apply(ee(this), e), A(Me.get(this));
1128
+ } : function(...e) {
1129
+ return A(t.apply(ee(this), e));
1130
+ };
1131
+ }
1132
+ function jt(t) {
1133
+ return typeof t == "function" ? Ht(t) : (t instanceof IDBTransaction && $t(t), Ut(t, Pt()) ? new Proxy(t, ce) : t);
1134
+ }
1135
+ function A(t) {
1136
+ if (t instanceof IDBRequest)
1137
+ return Mt(t);
1138
+ if (Q.has(t))
1139
+ return Q.get(t);
1140
+ const e = jt(t);
1141
+ return e !== t && (Q.set(t, e), fe.set(e, t)), e;
1142
+ }
1143
+ const ee = (t) => fe.get(t);
1144
+ function Vt(t, e, { blocked: n, upgrade: r, blocking: s, terminated: o } = {}) {
1145
+ const i = indexedDB.open(t, e), a = A(i);
1146
+ return r && i.addEventListener("upgradeneeded", (c) => {
1147
+ r(A(i.result), c.oldVersion, c.newVersion, A(i.transaction), c);
1148
+ }), n && i.addEventListener("blocked", (c) => n(
1149
+ // Casting due to https://github.com/microsoft/TypeScript-DOM-lib-generator/pull/1405
1150
+ c.oldVersion,
1151
+ c.newVersion,
1152
+ c
1153
+ )), a.then((c) => {
1154
+ o && c.addEventListener("close", () => o()), s && c.addEventListener("versionchange", (l) => s(l.oldVersion, l.newVersion, l));
1155
+ }).catch(() => {
1156
+ }), a;
1157
+ }
1158
+ const zt = ["get", "getKey", "getAll", "getAllKeys", "count"], Wt = ["put", "add", "delete", "clear"], te = /* @__PURE__ */ new Map();
1159
+ function Re(t, e) {
1160
+ if (!(t instanceof IDBDatabase && !(e in t) && typeof e == "string"))
1161
+ return;
1162
+ if (te.get(e))
1163
+ return te.get(e);
1164
+ const n = e.replace(/FromIndex$/, ""), r = e !== n, s = Wt.includes(n);
1165
+ if (
1166
+ // Bail if the target doesn't exist on the target. Eg, getAll isn't in Edge.
1167
+ !(n in (r ? IDBIndex : IDBObjectStore).prototype) || !(s || zt.includes(n))
1168
+ )
1169
+ return;
1170
+ const o = async function(i, ...a) {
1171
+ const c = this.transaction(i, s ? "readwrite" : "readonly");
1172
+ let l = c.store;
1173
+ return r && (l = l.index(a.shift())), (await Promise.all([
1174
+ l[n](...a),
1175
+ s && c.done
1176
+ ]))[0];
1177
+ };
1178
+ return te.set(e, o), o;
1179
+ }
1180
+ Ft((t) => ({
1181
+ ...t,
1182
+ get: (e, n, r) => Re(e, n) || t.get(e, n, r),
1183
+ has: (e, n) => !!Re(e, n) || t.has(e, n)
1184
+ }));
1185
+ /**
1186
+ * @license
1187
+ * Copyright 2019 Google LLC
1188
+ *
1189
+ * Licensed under the Apache License, Version 2.0 (the "License");
1190
+ * you may not use this file except in compliance with the License.
1191
+ * You may obtain a copy of the License at
1192
+ *
1193
+ * http://www.apache.org/licenses/LICENSE-2.0
1194
+ *
1195
+ * Unless required by applicable law or agreed to in writing, software
1196
+ * distributed under the License is distributed on an "AS IS" BASIS,
1197
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1198
+ * See the License for the specific language governing permissions and
1199
+ * limitations under the License.
1200
+ */
1201
+ class qt {
1202
+ constructor(e) {
1203
+ this.container = e;
1204
+ }
1205
+ // In initial implementation, this will be called by installations on
1206
+ // auth token refresh, and installations will send this string.
1207
+ getPlatformInfoString() {
1208
+ return this.container.getProviders().map((n) => {
1209
+ if (Gt(n)) {
1210
+ const r = n.getImmediate();
1211
+ return `${r.library}/${r.version}`;
1212
+ } else
1213
+ return null;
1214
+ }).filter((n) => n).join(" ");
1215
+ }
1216
+ }
1217
+ function Gt(t) {
1218
+ const e = t.getComponent();
1219
+ return (e == null ? void 0 : e.type) === "VERSION";
1220
+ }
1221
+ const le = "@firebase/app", Te = "0.9.13";
1222
+ /**
1223
+ * @license
1224
+ * Copyright 2019 Google LLC
1225
+ *
1226
+ * Licensed under the Apache License, Version 2.0 (the "License");
1227
+ * you may not use this file except in compliance with the License.
1228
+ * You may obtain a copy of the License at
1229
+ *
1230
+ * http://www.apache.org/licenses/LICENSE-2.0
1231
+ *
1232
+ * Unless required by applicable law or agreed to in writing, software
1233
+ * distributed under the License is distributed on an "AS IS" BASIS,
1234
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1235
+ * See the License for the specific language governing permissions and
1236
+ * limitations under the License.
1237
+ */
1238
+ const S = new xt("@firebase/app"), Kt = "@firebase/app-compat", Xt = "@firebase/analytics-compat", Jt = "@firebase/analytics", Yt = "@firebase/app-check-compat", Zt = "@firebase/app-check", Qt = "@firebase/auth", en = "@firebase/auth-compat", tn = "@firebase/database", nn = "@firebase/database-compat", rn = "@firebase/functions", sn = "@firebase/functions-compat", on = "@firebase/installations", an = "@firebase/installations-compat", cn = "@firebase/messaging", ln = "@firebase/messaging-compat", un = "@firebase/performance", hn = "@firebase/performance-compat", dn = "@firebase/remote-config", fn = "@firebase/remote-config-compat", pn = "@firebase/storage", gn = "@firebase/storage-compat", mn = "@firebase/firestore", _n = "@firebase/firestore-compat", bn = "firebase", yn = "9.23.0";
1239
+ /**
1240
+ * @license
1241
+ * Copyright 2019 Google LLC
1242
+ *
1243
+ * Licensed under the Apache License, Version 2.0 (the "License");
1244
+ * you may not use this file except in compliance with the License.
1245
+ * You may obtain a copy of the License at
1246
+ *
1247
+ * http://www.apache.org/licenses/LICENSE-2.0
1248
+ *
1249
+ * Unless required by applicable law or agreed to in writing, software
1250
+ * distributed under the License is distributed on an "AS IS" BASIS,
1251
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1252
+ * See the License for the specific language governing permissions and
1253
+ * limitations under the License.
1254
+ */
1255
+ const ue = "[DEFAULT]", En = {
1256
+ [le]: "fire-core",
1257
+ [Kt]: "fire-core-compat",
1258
+ [Jt]: "fire-analytics",
1259
+ [Xt]: "fire-analytics-compat",
1260
+ [Zt]: "fire-app-check",
1261
+ [Yt]: "fire-app-check-compat",
1262
+ [Qt]: "fire-auth",
1263
+ [en]: "fire-auth-compat",
1264
+ [tn]: "fire-rtdb",
1265
+ [nn]: "fire-rtdb-compat",
1266
+ [rn]: "fire-fn",
1267
+ [sn]: "fire-fn-compat",
1268
+ [on]: "fire-iid",
1269
+ [an]: "fire-iid-compat",
1270
+ [cn]: "fire-fcm",
1271
+ [ln]: "fire-fcm-compat",
1272
+ [un]: "fire-perf",
1273
+ [hn]: "fire-perf-compat",
1274
+ [dn]: "fire-rc",
1275
+ [fn]: "fire-rc-compat",
1276
+ [pn]: "fire-gcs",
1277
+ [gn]: "fire-gcs-compat",
1278
+ [mn]: "fire-fst",
1279
+ [_n]: "fire-fst-compat",
1280
+ "fire-js": "fire-js",
1281
+ [bn]: "fire-js-all"
1282
+ };
1283
+ /**
1284
+ * @license
1285
+ * Copyright 2019 Google LLC
1286
+ *
1287
+ * Licensed under the Apache License, Version 2.0 (the "License");
1288
+ * you may not use this file except in compliance with the License.
1289
+ * You may obtain a copy of the License at
1290
+ *
1291
+ * http://www.apache.org/licenses/LICENSE-2.0
1292
+ *
1293
+ * Unless required by applicable law or agreed to in writing, software
1294
+ * distributed under the License is distributed on an "AS IS" BASIS,
1295
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1296
+ * See the License for the specific language governing permissions and
1297
+ * limitations under the License.
1298
+ */
1299
+ const F = /* @__PURE__ */ new Map(), he = /* @__PURE__ */ new Map();
1300
+ function wn(t, e) {
1301
+ try {
1302
+ t.container.addComponent(e);
1303
+ } catch (n) {
1304
+ S.debug(`Component ${e.name} failed to register with FirebaseApp ${t.name}`, n);
1305
+ }
1306
+ }
1307
+ function G(t) {
1308
+ const e = t.name;
1309
+ if (he.has(e))
1310
+ return S.debug(`There were multiple attempts to register component ${e}.`), !1;
1311
+ he.set(e, t);
1312
+ for (const n of F.values())
1313
+ wn(n, t);
1314
+ return !0;
1315
+ }
1316
+ function In(t, e) {
1317
+ const n = t.container.getProvider("heartbeat").getImmediate({ optional: !0 });
1318
+ return n && n.triggerHeartbeat(), t.container.getProvider(e);
1319
+ }
1320
+ /**
1321
+ * @license
1322
+ * Copyright 2019 Google LLC
1323
+ *
1324
+ * Licensed under the Apache License, Version 2.0 (the "License");
1325
+ * you may not use this file except in compliance with the License.
1326
+ * You may obtain a copy of the License at
1327
+ *
1328
+ * http://www.apache.org/licenses/LICENSE-2.0
1329
+ *
1330
+ * Unless required by applicable law or agreed to in writing, software
1331
+ * distributed under the License is distributed on an "AS IS" BASIS,
1332
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1333
+ * See the License for the specific language governing permissions and
1334
+ * limitations under the License.
1335
+ */
1336
+ const Rn = {
1337
+ "no-app": "No Firebase App '{$appName}' has been created - call initializeApp() first",
1338
+ "bad-app-name": "Illegal App name: '{$appName}",
1339
+ "duplicate-app": "Firebase App named '{$appName}' already exists with different options or config",
1340
+ "app-deleted": "Firebase App named '{$appName}' already deleted",
1341
+ "no-options": "Need to provide options, when not being deployed to hosting via source.",
1342
+ "invalid-app-argument": "firebase.{$appName}() takes either no argument or a Firebase App instance.",
1343
+ "invalid-log-argument": "First argument to `onLog` must be null or a function.",
1344
+ "idb-open": "Error thrown when opening IndexedDB. Original error: {$originalErrorMessage}.",
1345
+ "idb-get": "Error thrown when reading from IndexedDB. Original error: {$originalErrorMessage}.",
1346
+ "idb-set": "Error thrown when writing to IndexedDB. Original error: {$originalErrorMessage}.",
1347
+ "idb-delete": "Error thrown when deleting from IndexedDB. Original error: {$originalErrorMessage}."
1348
+ }, v = new Le("app", "Firebase", Rn);
1349
+ /**
1350
+ * @license
1351
+ * Copyright 2019 Google LLC
1352
+ *
1353
+ * Licensed under the Apache License, Version 2.0 (the "License");
1354
+ * you may not use this file except in compliance with the License.
1355
+ * You may obtain a copy of the License at
1356
+ *
1357
+ * http://www.apache.org/licenses/LICENSE-2.0
1358
+ *
1359
+ * Unless required by applicable law or agreed to in writing, software
1360
+ * distributed under the License is distributed on an "AS IS" BASIS,
1361
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1362
+ * See the License for the specific language governing permissions and
1363
+ * limitations under the License.
1364
+ */
1365
+ class Tn {
1366
+ constructor(e, n, r) {
1367
+ this._isDeleted = !1, this._options = Object.assign({}, e), this._config = Object.assign({}, n), this._name = n.name, this._automaticDataCollectionEnabled = n.automaticDataCollectionEnabled, this._container = r, this.container.addComponent(new $(
1368
+ "app",
1369
+ () => this,
1370
+ "PUBLIC"
1371
+ /* ComponentType.PUBLIC */
1372
+ ));
1373
+ }
1374
+ get automaticDataCollectionEnabled() {
1375
+ return this.checkDestroyed(), this._automaticDataCollectionEnabled;
1376
+ }
1377
+ set automaticDataCollectionEnabled(e) {
1378
+ this.checkDestroyed(), this._automaticDataCollectionEnabled = e;
1379
+ }
1380
+ get name() {
1381
+ return this.checkDestroyed(), this._name;
1382
+ }
1383
+ get options() {
1384
+ return this.checkDestroyed(), this._options;
1385
+ }
1386
+ get config() {
1387
+ return this.checkDestroyed(), this._config;
1388
+ }
1389
+ get container() {
1390
+ return this._container;
1391
+ }
1392
+ get isDeleted() {
1393
+ return this._isDeleted;
1394
+ }
1395
+ set isDeleted(e) {
1396
+ this._isDeleted = e;
1397
+ }
1398
+ /**
1399
+ * This function will throw an Error if the App has already been deleted -
1400
+ * use before performing API actions on the App.
1401
+ */
1402
+ checkDestroyed() {
1403
+ if (this.isDeleted)
1404
+ throw v.create("app-deleted", { appName: this._name });
1405
+ }
1406
+ }
1407
+ /**
1408
+ * @license
1409
+ * Copyright 2019 Google LLC
1410
+ *
1411
+ * Licensed under the Apache License, Version 2.0 (the "License");
1412
+ * you may not use this file except in compliance with the License.
1413
+ * You may obtain a copy of the License at
1414
+ *
1415
+ * http://www.apache.org/licenses/LICENSE-2.0
1416
+ *
1417
+ * Unless required by applicable law or agreed to in writing, software
1418
+ * distributed under the License is distributed on an "AS IS" BASIS,
1419
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1420
+ * See the License for the specific language governing permissions and
1421
+ * limitations under the License.
1422
+ */
1423
+ const An = yn;
1424
+ function vn(t, e = {}) {
1425
+ let n = t;
1426
+ typeof e != "object" && (e = { name: e });
1427
+ const r = Object.assign({ name: ue, automaticDataCollectionEnabled: !1 }, e), s = r.name;
1428
+ if (typeof s != "string" || !s)
1429
+ throw v.create("bad-app-name", {
1430
+ appName: String(s)
1431
+ });
1432
+ if (n || (n = Ue()), !n)
1433
+ throw v.create(
1434
+ "no-options"
1435
+ /* AppError.NO_OPTIONS */
1436
+ );
1437
+ const o = F.get(s);
1438
+ if (o) {
1439
+ if (ie(n, o.options) && ie(r, o.config))
1440
+ return o;
1441
+ throw v.create("duplicate-app", { appName: s });
1442
+ }
1443
+ const i = new Ot(s);
1444
+ for (const c of he.values())
1445
+ i.addComponent(c);
1446
+ const a = new Tn(n, r, i);
1447
+ return F.set(s, a), a;
1448
+ }
1449
+ function Dn(t = ue) {
1450
+ const e = F.get(t);
1451
+ if (!e && t === ue && Ue())
1452
+ return vn();
1453
+ if (!e)
1454
+ throw v.create("no-app", { appName: t });
1455
+ return e;
1456
+ }
1457
+ function hs() {
1458
+ return Array.from(F.values());
1459
+ }
1460
+ function L(t, e, n) {
1461
+ var r;
1462
+ let s = (r = En[t]) !== null && r !== void 0 ? r : t;
1463
+ n && (s += `-${n}`);
1464
+ const o = s.match(/\s|\//), i = e.match(/\s|\//);
1465
+ if (o || i) {
1466
+ const a = [
1467
+ `Unable to register library "${s}" with version "${e}":`
1468
+ ];
1469
+ o && a.push(`library name "${s}" contains illegal characters (whitespace or "/")`), o && i && a.push("and"), i && a.push(`version name "${e}" contains illegal characters (whitespace or "/")`), S.warn(a.join(" "));
1470
+ return;
1471
+ }
1472
+ G(new $(
1473
+ `${s}-version`,
1474
+ () => ({ library: s, version: e }),
1475
+ "VERSION"
1476
+ /* ComponentType.VERSION */
1477
+ ));
1478
+ }
1479
+ /**
1480
+ * @license
1481
+ * Copyright 2021 Google LLC
1482
+ *
1483
+ * Licensed under the Apache License, Version 2.0 (the "License");
1484
+ * you may not use this file except in compliance with the License.
1485
+ * You may obtain a copy of the License at
1486
+ *
1487
+ * http://www.apache.org/licenses/LICENSE-2.0
1488
+ *
1489
+ * Unless required by applicable law or agreed to in writing, software
1490
+ * distributed under the License is distributed on an "AS IS" BASIS,
1491
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1492
+ * See the License for the specific language governing permissions and
1493
+ * limitations under the License.
1494
+ */
1495
+ const Cn = "firebase-heartbeat-database", On = 1, H = "firebase-heartbeat-store";
1496
+ let ne = null;
1497
+ function Fe() {
1498
+ return ne || (ne = Vt(Cn, On, {
1499
+ upgrade: (t, e) => {
1500
+ switch (e) {
1501
+ case 0:
1502
+ t.createObjectStore(H);
1503
+ }
1504
+ }
1505
+ }).catch((t) => {
1506
+ throw v.create("idb-open", {
1507
+ originalErrorMessage: t.message
1508
+ });
1509
+ })), ne;
1510
+ }
1511
+ async function Sn(t) {
1512
+ try {
1513
+ return await (await Fe()).transaction(H).objectStore(H).get(He(t));
1514
+ } catch (e) {
1515
+ if (e instanceof x)
1516
+ S.warn(e.message);
1517
+ else {
1518
+ const n = v.create("idb-get", {
1519
+ originalErrorMessage: e == null ? void 0 : e.message
1520
+ });
1521
+ S.warn(n.message);
1522
+ }
1523
+ }
1524
+ }
1525
+ async function Ae(t, e) {
1526
+ try {
1527
+ const r = (await Fe()).transaction(H, "readwrite");
1528
+ await r.objectStore(H).put(e, He(t)), await r.done;
1529
+ } catch (n) {
1530
+ if (n instanceof x)
1531
+ S.warn(n.message);
1532
+ else {
1533
+ const r = v.create("idb-set", {
1534
+ originalErrorMessage: n == null ? void 0 : n.message
1535
+ });
1536
+ S.warn(r.message);
1537
+ }
1538
+ }
1539
+ }
1540
+ function He(t) {
1541
+ return `${t.name}!${t.options.appId}`;
1542
+ }
1543
+ /**
1544
+ * @license
1545
+ * Copyright 2021 Google LLC
1546
+ *
1547
+ * Licensed under the Apache License, Version 2.0 (the "License");
1548
+ * you may not use this file except in compliance with the License.
1549
+ * You may obtain a copy of the License at
1550
+ *
1551
+ * http://www.apache.org/licenses/LICENSE-2.0
1552
+ *
1553
+ * Unless required by applicable law or agreed to in writing, software
1554
+ * distributed under the License is distributed on an "AS IS" BASIS,
1555
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1556
+ * See the License for the specific language governing permissions and
1557
+ * limitations under the License.
1558
+ */
1559
+ const Nn = 1024, kn = 30 * 24 * 60 * 60 * 1e3;
1560
+ class Bn {
1561
+ constructor(e) {
1562
+ this.container = e, this._heartbeatsCache = null;
1563
+ const n = this.container.getProvider("app").getImmediate();
1564
+ this._storage = new Un(n), this._heartbeatsCachePromise = this._storage.read().then((r) => (this._heartbeatsCache = r, r));
1565
+ }
1566
+ /**
1567
+ * Called to report a heartbeat. The function will generate
1568
+ * a HeartbeatsByUserAgent object, update heartbeatsCache, and persist it
1569
+ * to IndexedDB.
1570
+ * Note that we only store one heartbeat per day. So if a heartbeat for today is
1571
+ * already logged, subsequent calls to this function in the same day will be ignored.
1572
+ */
1573
+ async triggerHeartbeat() {
1574
+ const n = this.container.getProvider("platform-logger").getImmediate().getPlatformInfoString(), r = ve();
1575
+ if (this._heartbeatsCache === null && (this._heartbeatsCache = await this._heartbeatsCachePromise), !(this._heartbeatsCache.lastSentHeartbeatDate === r || this._heartbeatsCache.heartbeats.some((s) => s.date === r)))
1576
+ return this._heartbeatsCache.heartbeats.push({ date: r, agent: n }), this._heartbeatsCache.heartbeats = this._heartbeatsCache.heartbeats.filter((s) => {
1577
+ const o = new Date(s.date).valueOf();
1578
+ return Date.now() - o <= kn;
1579
+ }), this._storage.overwrite(this._heartbeatsCache);
1580
+ }
1581
+ /**
1582
+ * Returns a base64 encoded string which can be attached to the heartbeat-specific header directly.
1583
+ * It also clears all heartbeats from memory as well as in IndexedDB.
1584
+ *
1585
+ * NOTE: Consuming product SDKs should not send the header if this method
1586
+ * returns an empty string.
1587
+ */
1588
+ async getHeartbeatsHeader() {
1589
+ if (this._heartbeatsCache === null && await this._heartbeatsCachePromise, this._heartbeatsCache === null || this._heartbeatsCache.heartbeats.length === 0)
1590
+ return "";
1591
+ const e = ve(), { heartbeatsToSend: n, unsentEntries: r } = xn(this._heartbeatsCache.heartbeats), s = q(JSON.stringify({ version: 2, heartbeats: n }));
1592
+ return this._heartbeatsCache.lastSentHeartbeatDate = e, r.length > 0 ? (this._heartbeatsCache.heartbeats = r, await this._storage.overwrite(this._heartbeatsCache)) : (this._heartbeatsCache.heartbeats = [], this._storage.overwrite(this._heartbeatsCache)), s;
1593
+ }
1594
+ }
1595
+ function ve() {
1596
+ return (/* @__PURE__ */ new Date()).toISOString().substring(0, 10);
1597
+ }
1598
+ function xn(t, e = Nn) {
1599
+ const n = [];
1600
+ let r = t.slice();
1601
+ for (const s of t) {
1602
+ const o = n.find((i) => i.agent === s.agent);
1603
+ if (o) {
1604
+ if (o.dates.push(s.date), De(n) > e) {
1605
+ o.dates.pop();
1606
+ break;
1607
+ }
1608
+ } else if (n.push({
1609
+ agent: s.agent,
1610
+ dates: [s.date]
1611
+ }), De(n) > e) {
1612
+ n.pop();
1613
+ break;
1614
+ }
1615
+ r = r.slice(1);
1616
+ }
1617
+ return {
1618
+ heartbeatsToSend: n,
1619
+ unsentEntries: r
1620
+ };
1621
+ }
1622
+ class Un {
1623
+ constructor(e) {
1624
+ this.app = e, this._canUseIndexedDBPromise = this.runIndexedDBEnvironmentCheck();
1625
+ }
1626
+ async runIndexedDBEnvironmentCheck() {
1627
+ return yt() ? Et().then(() => !0).catch(() => !1) : !1;
1628
+ }
1629
+ /**
1630
+ * Read all heartbeats.
1631
+ */
1632
+ async read() {
1633
+ return await this._canUseIndexedDBPromise ? await Sn(this.app) || { heartbeats: [] } : { heartbeats: [] };
1634
+ }
1635
+ // overwrite the storage with the provided heartbeats
1636
+ async overwrite(e) {
1637
+ var n;
1638
+ if (await this._canUseIndexedDBPromise) {
1639
+ const s = await this.read();
1640
+ return Ae(this.app, {
1641
+ lastSentHeartbeatDate: (n = e.lastSentHeartbeatDate) !== null && n !== void 0 ? n : s.lastSentHeartbeatDate,
1642
+ heartbeats: e.heartbeats
1643
+ });
1644
+ } else
1645
+ return;
1646
+ }
1647
+ // add heartbeats
1648
+ async add(e) {
1649
+ var n;
1650
+ if (await this._canUseIndexedDBPromise) {
1651
+ const s = await this.read();
1652
+ return Ae(this.app, {
1653
+ lastSentHeartbeatDate: (n = e.lastSentHeartbeatDate) !== null && n !== void 0 ? n : s.lastSentHeartbeatDate,
1654
+ heartbeats: [
1655
+ ...s.heartbeats,
1656
+ ...e.heartbeats
1657
+ ]
1658
+ });
1659
+ } else
1660
+ return;
1661
+ }
1662
+ }
1663
+ function De(t) {
1664
+ return q(
1665
+ // heartbeatsCache wrapper properties
1666
+ JSON.stringify({ version: 2, heartbeats: t })
1667
+ ).length;
1668
+ }
1669
+ /**
1670
+ * @license
1671
+ * Copyright 2019 Google LLC
1672
+ *
1673
+ * Licensed under the Apache License, Version 2.0 (the "License");
1674
+ * you may not use this file except in compliance with the License.
1675
+ * You may obtain a copy of the License at
1676
+ *
1677
+ * http://www.apache.org/licenses/LICENSE-2.0
1678
+ *
1679
+ * Unless required by applicable law or agreed to in writing, software
1680
+ * distributed under the License is distributed on an "AS IS" BASIS,
1681
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1682
+ * See the License for the specific language governing permissions and
1683
+ * limitations under the License.
1684
+ */
1685
+ function Pn(t) {
1686
+ G(new $(
1687
+ "platform-logger",
1688
+ (e) => new qt(e),
1689
+ "PRIVATE"
1690
+ /* ComponentType.PRIVATE */
1691
+ )), G(new $(
1692
+ "heartbeat",
1693
+ (e) => new Bn(e),
1694
+ "PRIVATE"
1695
+ /* ComponentType.PRIVATE */
1696
+ )), L(le, Te, t), L(le, Te, "esm2017"), L("fire-js", "");
1697
+ }
1698
+ Pn("");
1699
+ /**
1700
+ * @license
1701
+ * Copyright 2017 Google LLC
1702
+ *
1703
+ * Licensed under the Apache License, Version 2.0 (the "License");
1704
+ * you may not use this file except in compliance with the License.
1705
+ * You may obtain a copy of the License at
1706
+ *
1707
+ * http://www.apache.org/licenses/LICENSE-2.0
1708
+ *
1709
+ * Unless required by applicable law or agreed to in writing, software
1710
+ * distributed under the License is distributed on an "AS IS" BASIS,
1711
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1712
+ * See the License for the specific language governing permissions and
1713
+ * limitations under the License.
1714
+ */
1715
+ const je = "firebasestorage.googleapis.com", Ve = "storageBucket", Ln = 2 * 60 * 1e3, Mn = 10 * 60 * 1e3;
1716
+ /**
1717
+ * @license
1718
+ * Copyright 2017 Google LLC
1719
+ *
1720
+ * Licensed under the Apache License, Version 2.0 (the "License");
1721
+ * you may not use this file except in compliance with the License.
1722
+ * You may obtain a copy of the License at
1723
+ *
1724
+ * http://www.apache.org/licenses/LICENSE-2.0
1725
+ *
1726
+ * Unless required by applicable law or agreed to in writing, software
1727
+ * distributed under the License is distributed on an "AS IS" BASIS,
1728
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1729
+ * See the License for the specific language governing permissions and
1730
+ * limitations under the License.
1731
+ */
1732
+ class d extends x {
1733
+ /**
1734
+ * @param code - A `StorageErrorCode` string to be prefixed with 'storage/' and
1735
+ * added to the end of the message.
1736
+ * @param message - Error message.
1737
+ * @param status_ - Corresponding HTTP Status Code
1738
+ */
1739
+ constructor(e, n, r = 0) {
1740
+ super(re(e), `Firebase Storage: ${n} (${re(e)})`), this.status_ = r, this.customData = { serverResponse: null }, this._baseMessage = this.message, Object.setPrototypeOf(this, d.prototype);
1741
+ }
1742
+ get status() {
1743
+ return this.status_;
1744
+ }
1745
+ set status(e) {
1746
+ this.status_ = e;
1747
+ }
1748
+ /**
1749
+ * Compares a `StorageErrorCode` against this error's code, filtering out the prefix.
1750
+ */
1751
+ _codeEquals(e) {
1752
+ return re(e) === this.code;
1753
+ }
1754
+ /**
1755
+ * Optional response message that was added by the server.
1756
+ */
1757
+ get serverResponse() {
1758
+ return this.customData.serverResponse;
1759
+ }
1760
+ set serverResponse(e) {
1761
+ this.customData.serverResponse = e, this.customData.serverResponse ? this.message = `${this._baseMessage}
1762
+ ${this.customData.serverResponse}` : this.message = this._baseMessage;
1763
+ }
1764
+ }
1765
+ var h;
1766
+ (function(t) {
1767
+ t.UNKNOWN = "unknown", t.OBJECT_NOT_FOUND = "object-not-found", t.BUCKET_NOT_FOUND = "bucket-not-found", t.PROJECT_NOT_FOUND = "project-not-found", t.QUOTA_EXCEEDED = "quota-exceeded", t.UNAUTHENTICATED = "unauthenticated", t.UNAUTHORIZED = "unauthorized", t.UNAUTHORIZED_APP = "unauthorized-app", t.RETRY_LIMIT_EXCEEDED = "retry-limit-exceeded", t.INVALID_CHECKSUM = "invalid-checksum", t.CANCELED = "canceled", t.INVALID_EVENT_NAME = "invalid-event-name", t.INVALID_URL = "invalid-url", t.INVALID_DEFAULT_BUCKET = "invalid-default-bucket", t.NO_DEFAULT_BUCKET = "no-default-bucket", t.CANNOT_SLICE_BLOB = "cannot-slice-blob", t.SERVER_FILE_WRONG_SIZE = "server-file-wrong-size", t.NO_DOWNLOAD_URL = "no-download-url", t.INVALID_ARGUMENT = "invalid-argument", t.INVALID_ARGUMENT_COUNT = "invalid-argument-count", t.APP_DELETED = "app-deleted", t.INVALID_ROOT_OPERATION = "invalid-root-operation", t.INVALID_FORMAT = "invalid-format", t.INTERNAL_ERROR = "internal-error", t.UNSUPPORTED_ENVIRONMENT = "unsupported-environment";
1768
+ })(h || (h = {}));
1769
+ function re(t) {
1770
+ return "storage/" + t;
1771
+ }
1772
+ function pe() {
1773
+ const t = "An unknown error occurred, please check the error payload for server response.";
1774
+ return new d(h.UNKNOWN, t);
1775
+ }
1776
+ function $n(t) {
1777
+ return new d(h.OBJECT_NOT_FOUND, "Object '" + t + "' does not exist.");
1778
+ }
1779
+ function Fn(t) {
1780
+ return new d(h.QUOTA_EXCEEDED, "Quota for bucket '" + t + "' exceeded, please view quota on https://firebase.google.com/pricing/.");
1781
+ }
1782
+ function Hn() {
1783
+ const t = "User is not authenticated, please authenticate using Firebase Authentication and try again.";
1784
+ return new d(h.UNAUTHENTICATED, t);
1785
+ }
1786
+ function jn() {
1787
+ return new d(h.UNAUTHORIZED_APP, "This app does not have permission to access Firebase Storage on this project.");
1788
+ }
1789
+ function Vn(t) {
1790
+ return new d(h.UNAUTHORIZED, "User does not have permission to access '" + t + "'.");
1791
+ }
1792
+ function zn() {
1793
+ return new d(h.RETRY_LIMIT_EXCEEDED, "Max retry time for operation exceeded, please try again.");
1794
+ }
1795
+ function Wn() {
1796
+ return new d(h.CANCELED, "User canceled the upload/download.");
1797
+ }
1798
+ function qn(t) {
1799
+ return new d(h.INVALID_URL, "Invalid URL '" + t + "'.");
1800
+ }
1801
+ function Gn(t) {
1802
+ return new d(h.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + t + "'.");
1803
+ }
1804
+ function Kn() {
1805
+ return new d(h.NO_DEFAULT_BUCKET, "No default bucket found. Did you set the '" + Ve + "' property when initializing the app?");
1806
+ }
1807
+ function Xn() {
1808
+ return new d(h.CANNOT_SLICE_BLOB, "Cannot slice blob for upload. Please retry the upload.");
1809
+ }
1810
+ function Jn() {
1811
+ return new d(h.NO_DOWNLOAD_URL, "The given file does not have any download URLs.");
1812
+ }
1813
+ function Yn(t) {
1814
+ return new d(h.UNSUPPORTED_ENVIRONMENT, `${t} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);
1815
+ }
1816
+ function de(t) {
1817
+ return new d(h.INVALID_ARGUMENT, t);
1818
+ }
1819
+ function ze() {
1820
+ return new d(h.APP_DELETED, "The Firebase app was deleted.");
1821
+ }
1822
+ function Zn(t) {
1823
+ return new d(h.INVALID_ROOT_OPERATION, "The operation '" + t + "' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");
1824
+ }
1825
+ function M(t, e) {
1826
+ return new d(h.INVALID_FORMAT, "String does not match format '" + t + "': " + e);
1827
+ }
1828
+ function P(t) {
1829
+ throw new d(h.INTERNAL_ERROR, "Internal error: " + t);
1830
+ }
1831
+ /**
1832
+ * @license
1833
+ * Copyright 2017 Google LLC
1834
+ *
1835
+ * Licensed under the Apache License, Version 2.0 (the "License");
1836
+ * you may not use this file except in compliance with the License.
1837
+ * You may obtain a copy of the License at
1838
+ *
1839
+ * http://www.apache.org/licenses/LICENSE-2.0
1840
+ *
1841
+ * Unless required by applicable law or agreed to in writing, software
1842
+ * distributed under the License is distributed on an "AS IS" BASIS,
1843
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1844
+ * See the License for the specific language governing permissions and
1845
+ * limitations under the License.
1846
+ */
1847
+ class E {
1848
+ constructor(e, n) {
1849
+ this.bucket = e, this.path_ = n;
1850
+ }
1851
+ get path() {
1852
+ return this.path_;
1853
+ }
1854
+ get isRoot() {
1855
+ return this.path.length === 0;
1856
+ }
1857
+ fullServerUrl() {
1858
+ const e = encodeURIComponent;
1859
+ return "/b/" + e(this.bucket) + "/o/" + e(this.path);
1860
+ }
1861
+ bucketOnlyServerUrl() {
1862
+ return "/b/" + encodeURIComponent(this.bucket) + "/o";
1863
+ }
1864
+ static makeFromBucketSpec(e, n) {
1865
+ let r;
1866
+ try {
1867
+ r = E.makeFromUrl(e, n);
1868
+ } catch {
1869
+ return new E(e, "");
1870
+ }
1871
+ if (r.path === "")
1872
+ return r;
1873
+ throw Gn(e);
1874
+ }
1875
+ static makeFromUrl(e, n) {
1876
+ let r = null;
1877
+ const s = "([A-Za-z0-9.\\-_]+)";
1878
+ function o(y) {
1879
+ y.path.charAt(y.path.length - 1) === "/" && (y.path_ = y.path_.slice(0, -1));
1880
+ }
1881
+ const i = "(/(.*))?$", a = new RegExp("^gs://" + s + i, "i"), c = { bucket: 1, path: 3 };
1882
+ function l(y) {
1883
+ y.path_ = decodeURIComponent(y.path);
1884
+ }
1885
+ const g = "v[A-Za-z0-9_]+", f = n.replace(/[.]/g, "\\."), p = "(/([^?#]*).*)?$", m = new RegExp(`^https?://${f}/${g}/b/${s}/o${p}`, "i"), w = { bucket: 1, path: 3 }, k = n === je ? "(?:storage.googleapis.com|storage.cloud.google.com)" : n, b = "([^?#]*)", B = new RegExp(`^https?://${k}/${s}/${b}`, "i"), I = [
1886
+ { regex: a, indices: c, postModify: o },
1887
+ {
1888
+ regex: m,
1889
+ indices: w,
1890
+ postModify: l
1891
+ },
1892
+ {
1893
+ regex: B,
1894
+ indices: { bucket: 1, path: 2 },
1895
+ postModify: l
1896
+ }
1897
+ ];
1898
+ for (let y = 0; y < I.length; y++) {
1899
+ const V = I[y], J = V.regex.exec(e);
1900
+ if (J) {
1901
+ const st = J[V.indices.bucket];
1902
+ let Y = J[V.indices.path];
1903
+ Y || (Y = ""), r = new E(st, Y), V.postModify(r);
1904
+ break;
1905
+ }
1906
+ }
1907
+ if (r == null)
1908
+ throw qn(e);
1909
+ return r;
1910
+ }
1911
+ }
1912
+ class Qn {
1913
+ constructor(e) {
1914
+ this.promise_ = Promise.reject(e);
1915
+ }
1916
+ /** @inheritDoc */
1917
+ getPromise() {
1918
+ return this.promise_;
1919
+ }
1920
+ /** @inheritDoc */
1921
+ cancel(e = !1) {
1922
+ }
1923
+ }
1924
+ /**
1925
+ * @license
1926
+ * Copyright 2017 Google LLC
1927
+ *
1928
+ * Licensed under the Apache License, Version 2.0 (the "License");
1929
+ * you may not use this file except in compliance with the License.
1930
+ * You may obtain a copy of the License at
1931
+ *
1932
+ * http://www.apache.org/licenses/LICENSE-2.0
1933
+ *
1934
+ * Unless required by applicable law or agreed to in writing, software
1935
+ * distributed under the License is distributed on an "AS IS" BASIS,
1936
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1937
+ * See the License for the specific language governing permissions and
1938
+ * limitations under the License.
1939
+ */
1940
+ function er(t, e, n) {
1941
+ let r = 1, s = null, o = null, i = !1, a = 0;
1942
+ function c() {
1943
+ return a === 2;
1944
+ }
1945
+ let l = !1;
1946
+ function g(...b) {
1947
+ l || (l = !0, e.apply(null, b));
1948
+ }
1949
+ function f(b) {
1950
+ s = setTimeout(() => {
1951
+ s = null, t(m, c());
1952
+ }, b);
1953
+ }
1954
+ function p() {
1955
+ o && clearTimeout(o);
1956
+ }
1957
+ function m(b, ...B) {
1958
+ if (l) {
1959
+ p();
1960
+ return;
1961
+ }
1962
+ if (b) {
1963
+ p(), g.call(null, b, ...B);
1964
+ return;
1965
+ }
1966
+ if (c() || i) {
1967
+ p(), g.call(null, b, ...B);
1968
+ return;
1969
+ }
1970
+ r < 64 && (r *= 2);
1971
+ let I;
1972
+ a === 1 ? (a = 2, I = 0) : I = (r + Math.random()) * 1e3, f(I);
1973
+ }
1974
+ let w = !1;
1975
+ function k(b) {
1976
+ w || (w = !0, p(), !l && (s !== null ? (b || (a = 2), clearTimeout(s), f(0)) : b || (a = 1)));
1977
+ }
1978
+ return f(0), o = setTimeout(() => {
1979
+ i = !0, k(!0);
1980
+ }, n), k;
1981
+ }
1982
+ function tr(t) {
1983
+ t(!1);
1984
+ }
1985
+ /**
1986
+ * @license
1987
+ * Copyright 2017 Google LLC
1988
+ *
1989
+ * Licensed under the Apache License, Version 2.0 (the "License");
1990
+ * you may not use this file except in compliance with the License.
1991
+ * You may obtain a copy of the License at
1992
+ *
1993
+ * http://www.apache.org/licenses/LICENSE-2.0
1994
+ *
1995
+ * Unless required by applicable law or agreed to in writing, software
1996
+ * distributed under the License is distributed on an "AS IS" BASIS,
1997
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1998
+ * See the License for the specific language governing permissions and
1999
+ * limitations under the License.
2000
+ */
2001
+ function nr(t) {
2002
+ return t !== void 0;
2003
+ }
2004
+ function rr(t) {
2005
+ return typeof t == "object" && !Array.isArray(t);
2006
+ }
2007
+ function ge(t) {
2008
+ return typeof t == "string" || t instanceof String;
2009
+ }
2010
+ function Ce(t) {
2011
+ return me() && t instanceof Blob;
2012
+ }
2013
+ function me() {
2014
+ return typeof Blob < "u" && !bt();
2015
+ }
2016
+ function Oe(t, e, n, r) {
2017
+ if (r < e)
2018
+ throw de(`Invalid value for '${t}'. Expected ${e} or greater.`);
2019
+ if (r > n)
2020
+ throw de(`Invalid value for '${t}'. Expected ${n} or less.`);
2021
+ }
2022
+ /**
2023
+ * @license
2024
+ * Copyright 2017 Google LLC
2025
+ *
2026
+ * Licensed under the Apache License, Version 2.0 (the "License");
2027
+ * you may not use this file except in compliance with the License.
2028
+ * You may obtain a copy of the License at
2029
+ *
2030
+ * http://www.apache.org/licenses/LICENSE-2.0
2031
+ *
2032
+ * Unless required by applicable law or agreed to in writing, software
2033
+ * distributed under the License is distributed on an "AS IS" BASIS,
2034
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2035
+ * See the License for the specific language governing permissions and
2036
+ * limitations under the License.
2037
+ */
2038
+ function j(t, e, n) {
2039
+ let r = e;
2040
+ return n == null && (r = `https://${e}`), `${n}://${r}/v0${t}`;
2041
+ }
2042
+ function We(t) {
2043
+ const e = encodeURIComponent;
2044
+ let n = "?";
2045
+ for (const r in t)
2046
+ if (t.hasOwnProperty(r)) {
2047
+ const s = e(r) + "=" + e(t[r]);
2048
+ n = n + s + "&";
2049
+ }
2050
+ return n = n.slice(0, -1), n;
2051
+ }
2052
+ /**
2053
+ * @license
2054
+ * Copyright 2017 Google LLC
2055
+ *
2056
+ * Licensed under the Apache License, Version 2.0 (the "License");
2057
+ * you may not use this file except in compliance with the License.
2058
+ * You may obtain a copy of the License at
2059
+ *
2060
+ * http://www.apache.org/licenses/LICENSE-2.0
2061
+ *
2062
+ * Unless required by applicable law or agreed to in writing, software
2063
+ * distributed under the License is distributed on an "AS IS" BASIS,
2064
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2065
+ * See the License for the specific language governing permissions and
2066
+ * limitations under the License.
2067
+ */
2068
+ var O;
2069
+ (function(t) {
2070
+ t[t.NO_ERROR = 0] = "NO_ERROR", t[t.NETWORK_ERROR = 1] = "NETWORK_ERROR", t[t.ABORT = 2] = "ABORT";
2071
+ })(O || (O = {}));
2072
+ /**
2073
+ * @license
2074
+ * Copyright 2022 Google LLC
2075
+ *
2076
+ * Licensed under the Apache License, Version 2.0 (the "License");
2077
+ * you may not use this file except in compliance with the License.
2078
+ * You may obtain a copy of the License at
2079
+ *
2080
+ * http://www.apache.org/licenses/LICENSE-2.0
2081
+ *
2082
+ * Unless required by applicable law or agreed to in writing, software
2083
+ * distributed under the License is distributed on an "AS IS" BASIS,
2084
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2085
+ * See the License for the specific language governing permissions and
2086
+ * limitations under the License.
2087
+ */
2088
+ function sr(t, e) {
2089
+ const n = t >= 500 && t < 600, s = [
2090
+ // Request Timeout: web server didn't receive full request in time.
2091
+ 408,
2092
+ // Too Many Requests: you're getting rate-limited, basically.
2093
+ 429
2094
+ ].indexOf(t) !== -1, o = e.indexOf(t) !== -1;
2095
+ return n || s || o;
2096
+ }
2097
+ /**
2098
+ * @license
2099
+ * Copyright 2017 Google LLC
2100
+ *
2101
+ * Licensed under the Apache License, Version 2.0 (the "License");
2102
+ * you may not use this file except in compliance with the License.
2103
+ * You may obtain a copy of the License at
2104
+ *
2105
+ * http://www.apache.org/licenses/LICENSE-2.0
2106
+ *
2107
+ * Unless required by applicable law or agreed to in writing, software
2108
+ * distributed under the License is distributed on an "AS IS" BASIS,
2109
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2110
+ * See the License for the specific language governing permissions and
2111
+ * limitations under the License.
2112
+ */
2113
+ class or {
2114
+ constructor(e, n, r, s, o, i, a, c, l, g, f, p = !0) {
2115
+ this.url_ = e, this.method_ = n, this.headers_ = r, this.body_ = s, this.successCodes_ = o, this.additionalRetryCodes_ = i, this.callback_ = a, this.errorCallback_ = c, this.timeout_ = l, this.progressCallback_ = g, this.connectionFactory_ = f, this.retry = p, this.pendingConnection_ = null, this.backoffId_ = null, this.canceled_ = !1, this.appDelete_ = !1, this.promise_ = new Promise((m, w) => {
2116
+ this.resolve_ = m, this.reject_ = w, this.start_();
2117
+ });
2118
+ }
2119
+ /**
2120
+ * Actually starts the retry loop.
2121
+ */
2122
+ start_() {
2123
+ const e = (r, s) => {
2124
+ if (s) {
2125
+ r(!1, new z(!1, null, !0));
2126
+ return;
2127
+ }
2128
+ const o = this.connectionFactory_();
2129
+ this.pendingConnection_ = o;
2130
+ const i = (a) => {
2131
+ const c = a.loaded, l = a.lengthComputable ? a.total : -1;
2132
+ this.progressCallback_ !== null && this.progressCallback_(c, l);
2133
+ };
2134
+ this.progressCallback_ !== null && o.addUploadProgressListener(i), o.send(this.url_, this.method_, this.body_, this.headers_).then(() => {
2135
+ this.progressCallback_ !== null && o.removeUploadProgressListener(i), this.pendingConnection_ = null;
2136
+ const a = o.getErrorCode() === O.NO_ERROR, c = o.getStatus();
2137
+ if (!a || sr(c, this.additionalRetryCodes_) && this.retry) {
2138
+ const g = o.getErrorCode() === O.ABORT;
2139
+ r(!1, new z(!1, null, g));
2140
+ return;
2141
+ }
2142
+ const l = this.successCodes_.indexOf(c) !== -1;
2143
+ r(!0, new z(l, o));
2144
+ });
2145
+ }, n = (r, s) => {
2146
+ const o = this.resolve_, i = this.reject_, a = s.connection;
2147
+ if (s.wasSuccessCode)
2148
+ try {
2149
+ const c = this.callback_(a, a.getResponse());
2150
+ nr(c) ? o(c) : o();
2151
+ } catch (c) {
2152
+ i(c);
2153
+ }
2154
+ else if (a !== null) {
2155
+ const c = pe();
2156
+ c.serverResponse = a.getErrorText(), this.errorCallback_ ? i(this.errorCallback_(a, c)) : i(c);
2157
+ } else if (s.canceled) {
2158
+ const c = this.appDelete_ ? ze() : Wn();
2159
+ i(c);
2160
+ } else {
2161
+ const c = zn();
2162
+ i(c);
2163
+ }
2164
+ };
2165
+ this.canceled_ ? n(!1, new z(!1, null, !0)) : this.backoffId_ = er(e, n, this.timeout_);
2166
+ }
2167
+ /** @inheritDoc */
2168
+ getPromise() {
2169
+ return this.promise_;
2170
+ }
2171
+ /** @inheritDoc */
2172
+ cancel(e) {
2173
+ this.canceled_ = !0, this.appDelete_ = e || !1, this.backoffId_ !== null && tr(this.backoffId_), this.pendingConnection_ !== null && this.pendingConnection_.abort();
2174
+ }
2175
+ }
2176
+ class z {
2177
+ constructor(e, n, r) {
2178
+ this.wasSuccessCode = e, this.connection = n, this.canceled = !!r;
2179
+ }
2180
+ }
2181
+ function ir(t, e) {
2182
+ e !== null && e.length > 0 && (t.Authorization = "Firebase " + e);
2183
+ }
2184
+ function ar(t, e) {
2185
+ t["X-Firebase-Storage-Version"] = "webjs/" + (e ?? "AppManager");
2186
+ }
2187
+ function cr(t, e) {
2188
+ e && (t["X-Firebase-GMPID"] = e);
2189
+ }
2190
+ function lr(t, e) {
2191
+ e !== null && (t["X-Firebase-AppCheck"] = e);
2192
+ }
2193
+ function ur(t, e, n, r, s, o, i = !0) {
2194
+ const a = We(t.urlParams), c = t.url + a, l = Object.assign({}, t.headers);
2195
+ return cr(l, e), ir(l, n), ar(l, o), lr(l, r), new or(c, t.method, l, t.body, t.successCodes, t.additionalRetryCodes, t.handler, t.errorHandler, t.timeout, t.progressCallback, s, i);
2196
+ }
2197
+ /**
2198
+ * @license
2199
+ * Copyright 2017 Google LLC
2200
+ *
2201
+ * Licensed under the Apache License, Version 2.0 (the "License");
2202
+ * you may not use this file except in compliance with the License.
2203
+ * You may obtain a copy of the License at
2204
+ *
2205
+ * http://www.apache.org/licenses/LICENSE-2.0
2206
+ *
2207
+ * Unless required by applicable law or agreed to in writing, software
2208
+ * distributed under the License is distributed on an "AS IS" BASIS,
2209
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2210
+ * See the License for the specific language governing permissions and
2211
+ * limitations under the License.
2212
+ */
2213
+ function hr() {
2214
+ return typeof BlobBuilder < "u" ? BlobBuilder : typeof WebKitBlobBuilder < "u" ? WebKitBlobBuilder : void 0;
2215
+ }
2216
+ function dr(...t) {
2217
+ const e = hr();
2218
+ if (e !== void 0) {
2219
+ const n = new e();
2220
+ for (let r = 0; r < t.length; r++)
2221
+ n.append(t[r]);
2222
+ return n.getBlob();
2223
+ } else {
2224
+ if (me())
2225
+ return new Blob(t);
2226
+ throw new d(h.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
2227
+ }
2228
+ }
2229
+ function fr(t, e, n) {
2230
+ return t.webkitSlice ? t.webkitSlice(e, n) : t.mozSlice ? t.mozSlice(e, n) : t.slice ? t.slice(e, n) : null;
2231
+ }
2232
+ /**
2233
+ * @license
2234
+ * Copyright 2021 Google LLC
2235
+ *
2236
+ * Licensed under the Apache License, Version 2.0 (the "License");
2237
+ * you may not use this file except in compliance with the License.
2238
+ * You may obtain a copy of the License at
2239
+ *
2240
+ * http://www.apache.org/licenses/LICENSE-2.0
2241
+ *
2242
+ * Unless required by applicable law or agreed to in writing, software
2243
+ * distributed under the License is distributed on an "AS IS" BASIS,
2244
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2245
+ * See the License for the specific language governing permissions and
2246
+ * limitations under the License.
2247
+ */
2248
+ function pr(t) {
2249
+ if (typeof atob > "u")
2250
+ throw Yn("base-64");
2251
+ return atob(t);
2252
+ }
2253
+ /**
2254
+ * @license
2255
+ * Copyright 2017 Google LLC
2256
+ *
2257
+ * Licensed under the Apache License, Version 2.0 (the "License");
2258
+ * you may not use this file except in compliance with the License.
2259
+ * You may obtain a copy of the License at
2260
+ *
2261
+ * http://www.apache.org/licenses/LICENSE-2.0
2262
+ *
2263
+ * Unless required by applicable law or agreed to in writing, software
2264
+ * distributed under the License is distributed on an "AS IS" BASIS,
2265
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2266
+ * See the License for the specific language governing permissions and
2267
+ * limitations under the License.
2268
+ */
2269
+ const R = {
2270
+ /**
2271
+ * Indicates the string should be interpreted "raw", that is, as normal text.
2272
+ * The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
2273
+ * sequence.
2274
+ * Example: The string 'Hello! \\ud83d\\ude0a' becomes the byte sequence
2275
+ * 48 65 6c 6c 6f 21 20 f0 9f 98 8a
2276
+ */
2277
+ RAW: "raw",
2278
+ /**
2279
+ * Indicates the string should be interpreted as base64-encoded data.
2280
+ * Padding characters (trailing '='s) are optional.
2281
+ * Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
2282
+ * ad 69 8e fb e1 3a b7 bf eb 97
2283
+ */
2284
+ BASE64: "base64",
2285
+ /**
2286
+ * Indicates the string should be interpreted as base64url-encoded data.
2287
+ * Padding characters (trailing '='s) are optional.
2288
+ * Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
2289
+ * ad 69 8e fb e1 3a b7 bf eb 97
2290
+ */
2291
+ BASE64URL: "base64url",
2292
+ /**
2293
+ * Indicates the string is a data URL, such as one obtained from
2294
+ * canvas.toDataURL().
2295
+ * Example: the string 'data:application/octet-stream;base64,aaaa'
2296
+ * becomes the byte sequence
2297
+ * 69 a6 9a
2298
+ * (the content-type "application/octet-stream" is also applied, but can
2299
+ * be overridden in the metadata object).
2300
+ */
2301
+ DATA_URL: "data_url"
2302
+ };
2303
+ class se {
2304
+ constructor(e, n) {
2305
+ this.data = e, this.contentType = n || null;
2306
+ }
2307
+ }
2308
+ function gr(t, e) {
2309
+ switch (t) {
2310
+ case R.RAW:
2311
+ return new se(qe(e));
2312
+ case R.BASE64:
2313
+ case R.BASE64URL:
2314
+ return new se(Ge(t, e));
2315
+ case R.DATA_URL:
2316
+ return new se(_r(e), br(e));
2317
+ }
2318
+ throw pe();
2319
+ }
2320
+ function qe(t) {
2321
+ const e = [];
2322
+ for (let n = 0; n < t.length; n++) {
2323
+ let r = t.charCodeAt(n);
2324
+ if (r <= 127)
2325
+ e.push(r);
2326
+ else if (r <= 2047)
2327
+ e.push(192 | r >> 6, 128 | r & 63);
2328
+ else if ((r & 64512) === 55296)
2329
+ if (!(n < t.length - 1 && (t.charCodeAt(n + 1) & 64512) === 56320))
2330
+ e.push(239, 191, 189);
2331
+ else {
2332
+ const o = r, i = t.charCodeAt(++n);
2333
+ r = 65536 | (o & 1023) << 10 | i & 1023, e.push(240 | r >> 18, 128 | r >> 12 & 63, 128 | r >> 6 & 63, 128 | r & 63);
2334
+ }
2335
+ else
2336
+ (r & 64512) === 56320 ? e.push(239, 191, 189) : e.push(224 | r >> 12, 128 | r >> 6 & 63, 128 | r & 63);
2337
+ }
2338
+ return new Uint8Array(e);
2339
+ }
2340
+ function mr(t) {
2341
+ let e;
2342
+ try {
2343
+ e = decodeURIComponent(t);
2344
+ } catch {
2345
+ throw M(R.DATA_URL, "Malformed data URL.");
2346
+ }
2347
+ return qe(e);
2348
+ }
2349
+ function Ge(t, e) {
2350
+ switch (t) {
2351
+ case R.BASE64: {
2352
+ const s = e.indexOf("-") !== -1, o = e.indexOf("_") !== -1;
2353
+ if (s || o)
2354
+ throw M(t, "Invalid character '" + (s ? "-" : "_") + "' found: is it base64url encoded?");
2355
+ break;
2356
+ }
2357
+ case R.BASE64URL: {
2358
+ const s = e.indexOf("+") !== -1, o = e.indexOf("/") !== -1;
2359
+ if (s || o)
2360
+ throw M(t, "Invalid character '" + (s ? "+" : "/") + "' found: is it base64 encoded?");
2361
+ e = e.replace(/-/g, "+").replace(/_/g, "/");
2362
+ break;
2363
+ }
2364
+ }
2365
+ let n;
2366
+ try {
2367
+ n = pr(e);
2368
+ } catch (s) {
2369
+ throw s.message.includes("polyfill") ? s : M(t, "Invalid character found");
2370
+ }
2371
+ const r = new Uint8Array(n.length);
2372
+ for (let s = 0; s < n.length; s++)
2373
+ r[s] = n.charCodeAt(s);
2374
+ return r;
2375
+ }
2376
+ class Ke {
2377
+ constructor(e) {
2378
+ this.base64 = !1, this.contentType = null;
2379
+ const n = e.match(/^data:([^,]+)?,/);
2380
+ if (n === null)
2381
+ throw M(R.DATA_URL, "Must be formatted 'data:[<mediatype>][;base64],<data>");
2382
+ const r = n[1] || null;
2383
+ r != null && (this.base64 = yr(r, ";base64"), this.contentType = this.base64 ? r.substring(0, r.length - 7) : r), this.rest = e.substring(e.indexOf(",") + 1);
2384
+ }
2385
+ }
2386
+ function _r(t) {
2387
+ const e = new Ke(t);
2388
+ return e.base64 ? Ge(R.BASE64, e.rest) : mr(e.rest);
2389
+ }
2390
+ function br(t) {
2391
+ return new Ke(t).contentType;
2392
+ }
2393
+ function yr(t, e) {
2394
+ return t.length >= e.length ? t.substring(t.length - e.length) === e : !1;
2395
+ }
2396
+ /**
2397
+ * @license
2398
+ * Copyright 2017 Google LLC
2399
+ *
2400
+ * Licensed under the Apache License, Version 2.0 (the "License");
2401
+ * you may not use this file except in compliance with the License.
2402
+ * You may obtain a copy of the License at
2403
+ *
2404
+ * http://www.apache.org/licenses/LICENSE-2.0
2405
+ *
2406
+ * Unless required by applicable law or agreed to in writing, software
2407
+ * distributed under the License is distributed on an "AS IS" BASIS,
2408
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2409
+ * See the License for the specific language governing permissions and
2410
+ * limitations under the License.
2411
+ */
2412
+ class T {
2413
+ constructor(e, n) {
2414
+ let r = 0, s = "";
2415
+ Ce(e) ? (this.data_ = e, r = e.size, s = e.type) : e instanceof ArrayBuffer ? (n ? this.data_ = new Uint8Array(e) : (this.data_ = new Uint8Array(e.byteLength), this.data_.set(new Uint8Array(e))), r = this.data_.length) : e instanceof Uint8Array && (n ? this.data_ = e : (this.data_ = new Uint8Array(e.length), this.data_.set(e)), r = e.length), this.size_ = r, this.type_ = s;
2416
+ }
2417
+ size() {
2418
+ return this.size_;
2419
+ }
2420
+ type() {
2421
+ return this.type_;
2422
+ }
2423
+ slice(e, n) {
2424
+ if (Ce(this.data_)) {
2425
+ const r = this.data_, s = fr(r, e, n);
2426
+ return s === null ? null : new T(s);
2427
+ } else {
2428
+ const r = new Uint8Array(this.data_.buffer, e, n - e);
2429
+ return new T(r, !0);
2430
+ }
2431
+ }
2432
+ static getBlob(...e) {
2433
+ if (me()) {
2434
+ const n = e.map((r) => r instanceof T ? r.data_ : r);
2435
+ return new T(dr.apply(null, n));
2436
+ } else {
2437
+ const n = e.map((i) => ge(i) ? gr(R.RAW, i).data : i.data_);
2438
+ let r = 0;
2439
+ n.forEach((i) => {
2440
+ r += i.byteLength;
2441
+ });
2442
+ const s = new Uint8Array(r);
2443
+ let o = 0;
2444
+ return n.forEach((i) => {
2445
+ for (let a = 0; a < i.length; a++)
2446
+ s[o++] = i[a];
2447
+ }), new T(s, !0);
2448
+ }
2449
+ }
2450
+ uploadData() {
2451
+ return this.data_;
2452
+ }
2453
+ }
2454
+ /**
2455
+ * @license
2456
+ * Copyright 2017 Google LLC
2457
+ *
2458
+ * Licensed under the Apache License, Version 2.0 (the "License");
2459
+ * you may not use this file except in compliance with the License.
2460
+ * You may obtain a copy of the License at
2461
+ *
2462
+ * http://www.apache.org/licenses/LICENSE-2.0
2463
+ *
2464
+ * Unless required by applicable law or agreed to in writing, software
2465
+ * distributed under the License is distributed on an "AS IS" BASIS,
2466
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2467
+ * See the License for the specific language governing permissions and
2468
+ * limitations under the License.
2469
+ */
2470
+ function Xe(t) {
2471
+ let e;
2472
+ try {
2473
+ e = JSON.parse(t);
2474
+ } catch {
2475
+ return null;
2476
+ }
2477
+ return rr(e) ? e : null;
2478
+ }
2479
+ /**
2480
+ * @license
2481
+ * Copyright 2017 Google LLC
2482
+ *
2483
+ * Licensed under the Apache License, Version 2.0 (the "License");
2484
+ * you may not use this file except in compliance with the License.
2485
+ * You may obtain a copy of the License at
2486
+ *
2487
+ * http://www.apache.org/licenses/LICENSE-2.0
2488
+ *
2489
+ * Unless required by applicable law or agreed to in writing, software
2490
+ * distributed under the License is distributed on an "AS IS" BASIS,
2491
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2492
+ * See the License for the specific language governing permissions and
2493
+ * limitations under the License.
2494
+ */
2495
+ function Er(t) {
2496
+ if (t.length === 0)
2497
+ return null;
2498
+ const e = t.lastIndexOf("/");
2499
+ return e === -1 ? "" : t.slice(0, e);
2500
+ }
2501
+ function wr(t, e) {
2502
+ const n = e.split("/").filter((r) => r.length > 0).join("/");
2503
+ return t.length === 0 ? n : t + "/" + n;
2504
+ }
2505
+ function Je(t) {
2506
+ const e = t.lastIndexOf("/", t.length - 2);
2507
+ return e === -1 ? t : t.slice(e + 1);
2508
+ }
2509
+ /**
2510
+ * @license
2511
+ * Copyright 2017 Google LLC
2512
+ *
2513
+ * Licensed under the Apache License, Version 2.0 (the "License");
2514
+ * you may not use this file except in compliance with the License.
2515
+ * You may obtain a copy of the License at
2516
+ *
2517
+ * http://www.apache.org/licenses/LICENSE-2.0
2518
+ *
2519
+ * Unless required by applicable law or agreed to in writing, software
2520
+ * distributed under the License is distributed on an "AS IS" BASIS,
2521
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2522
+ * See the License for the specific language governing permissions and
2523
+ * limitations under the License.
2524
+ */
2525
+ function Ir(t, e) {
2526
+ return e;
2527
+ }
2528
+ class _ {
2529
+ constructor(e, n, r, s) {
2530
+ this.server = e, this.local = n || e, this.writable = !!r, this.xform = s || Ir;
2531
+ }
2532
+ }
2533
+ let W = null;
2534
+ function Rr(t) {
2535
+ return !ge(t) || t.length < 2 ? t : Je(t);
2536
+ }
2537
+ function Ye() {
2538
+ if (W)
2539
+ return W;
2540
+ const t = [];
2541
+ t.push(new _("bucket")), t.push(new _("generation")), t.push(new _("metageneration")), t.push(new _("name", "fullPath", !0));
2542
+ function e(o, i) {
2543
+ return Rr(i);
2544
+ }
2545
+ const n = new _("name");
2546
+ n.xform = e, t.push(n);
2547
+ function r(o, i) {
2548
+ return i !== void 0 ? Number(i) : i;
2549
+ }
2550
+ const s = new _("size");
2551
+ return s.xform = r, t.push(s), t.push(new _("timeCreated")), t.push(new _("updated")), t.push(new _("md5Hash", null, !0)), t.push(new _("cacheControl", null, !0)), t.push(new _("contentDisposition", null, !0)), t.push(new _("contentEncoding", null, !0)), t.push(new _("contentLanguage", null, !0)), t.push(new _("contentType", null, !0)), t.push(new _("metadata", "customMetadata", !0)), W = t, W;
2552
+ }
2553
+ function Tr(t, e) {
2554
+ function n() {
2555
+ const r = t.bucket, s = t.fullPath, o = new E(r, s);
2556
+ return e._makeStorageReference(o);
2557
+ }
2558
+ Object.defineProperty(t, "ref", { get: n });
2559
+ }
2560
+ function Ar(t, e, n) {
2561
+ const r = {};
2562
+ r.type = "file";
2563
+ const s = n.length;
2564
+ for (let o = 0; o < s; o++) {
2565
+ const i = n[o];
2566
+ r[i.local] = i.xform(r, e[i.server]);
2567
+ }
2568
+ return Tr(r, t), r;
2569
+ }
2570
+ function Ze(t, e, n) {
2571
+ const r = Xe(e);
2572
+ return r === null ? null : Ar(t, r, n);
2573
+ }
2574
+ function vr(t, e, n, r) {
2575
+ const s = Xe(e);
2576
+ if (s === null || !ge(s.downloadTokens))
2577
+ return null;
2578
+ const o = s.downloadTokens;
2579
+ if (o.length === 0)
2580
+ return null;
2581
+ const i = encodeURIComponent;
2582
+ return o.split(",").map((l) => {
2583
+ const g = t.bucket, f = t.fullPath, p = "/b/" + i(g) + "/o/" + i(f), m = j(p, n, r), w = We({
2584
+ alt: "media",
2585
+ token: l
2586
+ });
2587
+ return m + w;
2588
+ })[0];
2589
+ }
2590
+ function Dr(t, e) {
2591
+ const n = {}, r = e.length;
2592
+ for (let s = 0; s < r; s++) {
2593
+ const o = e[s];
2594
+ o.writable && (n[o.server] = t[o.local]);
2595
+ }
2596
+ return JSON.stringify(n);
2597
+ }
2598
+ class X {
2599
+ constructor(e, n, r, s) {
2600
+ this.url = e, this.method = n, this.handler = r, this.timeout = s, this.urlParams = {}, this.headers = {}, this.body = null, this.errorHandler = null, this.progressCallback = null, this.successCodes = [200], this.additionalRetryCodes = [];
2601
+ }
2602
+ }
2603
+ /**
2604
+ * @license
2605
+ * Copyright 2017 Google LLC
2606
+ *
2607
+ * Licensed under the Apache License, Version 2.0 (the "License");
2608
+ * you may not use this file except in compliance with the License.
2609
+ * You may obtain a copy of the License at
2610
+ *
2611
+ * http://www.apache.org/licenses/LICENSE-2.0
2612
+ *
2613
+ * Unless required by applicable law or agreed to in writing, software
2614
+ * distributed under the License is distributed on an "AS IS" BASIS,
2615
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2616
+ * See the License for the specific language governing permissions and
2617
+ * limitations under the License.
2618
+ */
2619
+ function Qe(t) {
2620
+ if (!t)
2621
+ throw pe();
2622
+ }
2623
+ function Cr(t, e) {
2624
+ function n(r, s) {
2625
+ const o = Ze(t, s, e);
2626
+ return Qe(o !== null), o;
2627
+ }
2628
+ return n;
2629
+ }
2630
+ function Or(t, e) {
2631
+ function n(r, s) {
2632
+ const o = Ze(t, s, e);
2633
+ return Qe(o !== null), vr(o, s, t.host, t._protocol);
2634
+ }
2635
+ return n;
2636
+ }
2637
+ function et(t) {
2638
+ function e(n, r) {
2639
+ let s;
2640
+ return n.getStatus() === 401 ? /* This exact message string is the only consistent part of the */ /* server's error response that identifies it as an App Check error. */ n.getErrorText().includes("Firebase App Check token is invalid") ? s = jn() : s = Hn() : n.getStatus() === 402 ? s = Fn(t.bucket) : n.getStatus() === 403 ? s = Vn(t.path) : s = r, s.status = n.getStatus(), s.serverResponse = r.serverResponse, s;
2641
+ }
2642
+ return e;
2643
+ }
2644
+ function _e(t) {
2645
+ const e = et(t);
2646
+ function n(r, s) {
2647
+ let o = e(r, s);
2648
+ return r.getStatus() === 404 && (o = $n(t.path)), o.serverResponse = s.serverResponse, o;
2649
+ }
2650
+ return n;
2651
+ }
2652
+ function Sr(t, e, n) {
2653
+ const r = e.fullServerUrl(), s = j(r, t.host, t._protocol) + "?alt=media", o = "GET", i = t.maxOperationRetryTime, a = new X(s, o, (c, l) => l, i);
2654
+ return a.errorHandler = _e(e), n !== void 0 && (a.headers.Range = `bytes=0-${n}`, a.successCodes = [
2655
+ 200,
2656
+ 206
2657
+ /* Partial Content */
2658
+ ]), a;
2659
+ }
2660
+ function Nr(t, e, n) {
2661
+ const r = e.fullServerUrl(), s = j(r, t.host, t._protocol), o = "GET", i = t.maxOperationRetryTime, a = new X(s, o, Or(t, n), i);
2662
+ return a.errorHandler = _e(e), a;
2663
+ }
2664
+ function kr(t, e) {
2665
+ const n = e.fullServerUrl(), r = j(n, t.host, t._protocol), s = "DELETE", o = t.maxOperationRetryTime;
2666
+ function i(c, l) {
2667
+ }
2668
+ const a = new X(r, s, i, o);
2669
+ return a.successCodes = [200, 204], a.errorHandler = _e(e), a;
2670
+ }
2671
+ function Br(t, e) {
2672
+ return t && t.contentType || e && e.type() || "application/octet-stream";
2673
+ }
2674
+ function xr(t, e, n) {
2675
+ const r = Object.assign({}, n);
2676
+ return r.fullPath = t.path, r.size = e.size(), r.contentType || (r.contentType = Br(null, e)), r;
2677
+ }
2678
+ function Ur(t, e, n, r, s) {
2679
+ const o = e.bucketOnlyServerUrl(), i = {
2680
+ "X-Goog-Upload-Protocol": "multipart"
2681
+ };
2682
+ function a() {
2683
+ let I = "";
2684
+ for (let y = 0; y < 2; y++)
2685
+ I = I + Math.random().toString().slice(2);
2686
+ return I;
2687
+ }
2688
+ const c = a();
2689
+ i["Content-Type"] = "multipart/related; boundary=" + c;
2690
+ const l = xr(e, r, s), g = Dr(l, n), f = "--" + c + `\r
2691
+ Content-Type: application/json; charset=utf-8\r
2692
+ \r
2693
+ ` + g + `\r
2694
+ --` + c + `\r
2695
+ Content-Type: ` + l.contentType + `\r
2696
+ \r
2697
+ `, p = `\r
2698
+ --` + c + "--", m = T.getBlob(f, r, p);
2699
+ if (m === null)
2700
+ throw Xn();
2701
+ const w = { name: l.fullPath }, k = j(o, t.host, t._protocol), b = "POST", B = t.maxUploadRetryTime, D = new X(k, b, Cr(t, n), B);
2702
+ return D.urlParams = w, D.headers = i, D.body = m.uploadData(), D.errorHandler = et(e), D;
2703
+ }
2704
+ class tt {
2705
+ constructor() {
2706
+ this.sent_ = !1, this.xhr_ = new XMLHttpRequest(), this.initXhr(), this.errorCode_ = O.NO_ERROR, this.sendPromise_ = new Promise((e) => {
2707
+ this.xhr_.addEventListener("abort", () => {
2708
+ this.errorCode_ = O.ABORT, e();
2709
+ }), this.xhr_.addEventListener("error", () => {
2710
+ this.errorCode_ = O.NETWORK_ERROR, e();
2711
+ }), this.xhr_.addEventListener("load", () => {
2712
+ e();
2713
+ });
2714
+ });
2715
+ }
2716
+ send(e, n, r, s) {
2717
+ if (this.sent_)
2718
+ throw P("cannot .send() more than once");
2719
+ if (this.sent_ = !0, this.xhr_.open(n, e, !0), s !== void 0)
2720
+ for (const o in s)
2721
+ s.hasOwnProperty(o) && this.xhr_.setRequestHeader(o, s[o].toString());
2722
+ return r !== void 0 ? this.xhr_.send(r) : this.xhr_.send(), this.sendPromise_;
2723
+ }
2724
+ getErrorCode() {
2725
+ if (!this.sent_)
2726
+ throw P("cannot .getErrorCode() before sending");
2727
+ return this.errorCode_;
2728
+ }
2729
+ getStatus() {
2730
+ if (!this.sent_)
2731
+ throw P("cannot .getStatus() before sending");
2732
+ try {
2733
+ return this.xhr_.status;
2734
+ } catch {
2735
+ return -1;
2736
+ }
2737
+ }
2738
+ getResponse() {
2739
+ if (!this.sent_)
2740
+ throw P("cannot .getResponse() before sending");
2741
+ return this.xhr_.response;
2742
+ }
2743
+ getErrorText() {
2744
+ if (!this.sent_)
2745
+ throw P("cannot .getErrorText() before sending");
2746
+ return this.xhr_.statusText;
2747
+ }
2748
+ /** Aborts the request. */
2749
+ abort() {
2750
+ this.xhr_.abort();
2751
+ }
2752
+ getResponseHeader(e) {
2753
+ return this.xhr_.getResponseHeader(e);
2754
+ }
2755
+ addUploadProgressListener(e) {
2756
+ this.xhr_.upload != null && this.xhr_.upload.addEventListener("progress", e);
2757
+ }
2758
+ removeUploadProgressListener(e) {
2759
+ this.xhr_.upload != null && this.xhr_.upload.removeEventListener("progress", e);
2760
+ }
2761
+ }
2762
+ class Pr extends tt {
2763
+ initXhr() {
2764
+ this.xhr_.responseType = "text";
2765
+ }
2766
+ }
2767
+ function be() {
2768
+ return new Pr();
2769
+ }
2770
+ class Lr extends tt {
2771
+ initXhr() {
2772
+ this.xhr_.responseType = "blob";
2773
+ }
2774
+ }
2775
+ function Mr() {
2776
+ return new Lr();
2777
+ }
2778
+ /**
2779
+ * @license
2780
+ * Copyright 2019 Google LLC
2781
+ *
2782
+ * Licensed under the Apache License, Version 2.0 (the "License");
2783
+ * you may not use this file except in compliance with the License.
2784
+ * You may obtain a copy of the License at
2785
+ *
2786
+ * http://www.apache.org/licenses/LICENSE-2.0
2787
+ *
2788
+ * Unless required by applicable law or agreed to in writing, software
2789
+ * distributed under the License is distributed on an "AS IS" BASIS,
2790
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2791
+ * See the License for the specific language governing permissions and
2792
+ * limitations under the License.
2793
+ */
2794
+ class N {
2795
+ constructor(e, n) {
2796
+ this._service = e, n instanceof E ? this._location = n : this._location = E.makeFromUrl(n, e.host);
2797
+ }
2798
+ /**
2799
+ * Returns the URL for the bucket and path this object references,
2800
+ * in the form gs://<bucket>/<object-path>
2801
+ * @override
2802
+ */
2803
+ toString() {
2804
+ return "gs://" + this._location.bucket + "/" + this._location.path;
2805
+ }
2806
+ _newRef(e, n) {
2807
+ return new N(e, n);
2808
+ }
2809
+ /**
2810
+ * A reference to the root of this object's bucket.
2811
+ */
2812
+ get root() {
2813
+ const e = new E(this._location.bucket, "");
2814
+ return this._newRef(this._service, e);
2815
+ }
2816
+ /**
2817
+ * The name of the bucket containing this reference's object.
2818
+ */
2819
+ get bucket() {
2820
+ return this._location.bucket;
2821
+ }
2822
+ /**
2823
+ * The full path of this object.
2824
+ */
2825
+ get fullPath() {
2826
+ return this._location.path;
2827
+ }
2828
+ /**
2829
+ * The short name of this object, which is the last component of the full path.
2830
+ * For example, if fullPath is 'full/path/image.png', name is 'image.png'.
2831
+ */
2832
+ get name() {
2833
+ return Je(this._location.path);
2834
+ }
2835
+ /**
2836
+ * The `StorageService` instance this `StorageReference` is associated with.
2837
+ */
2838
+ get storage() {
2839
+ return this._service;
2840
+ }
2841
+ /**
2842
+ * A `StorageReference` pointing to the parent location of this `StorageReference`, or null if
2843
+ * this reference is the root.
2844
+ */
2845
+ get parent() {
2846
+ const e = Er(this._location.path);
2847
+ if (e === null)
2848
+ return null;
2849
+ const n = new E(this._location.bucket, e);
2850
+ return new N(this._service, n);
2851
+ }
2852
+ /**
2853
+ * Utility function to throw an error in methods that do not accept a root reference.
2854
+ */
2855
+ _throwIfRoot(e) {
2856
+ if (this._location.path === "")
2857
+ throw Zn(e);
2858
+ }
2859
+ }
2860
+ function $r(t, e) {
2861
+ t._throwIfRoot("getBlob");
2862
+ const n = Sr(t.storage, t._location, e);
2863
+ return t.storage.makeRequestWithTokens(n, Mr).then((r) => e !== void 0 ? (
2864
+ // GCS may not honor the Range header for small files
2865
+ r.slice(0, e)
2866
+ ) : r);
2867
+ }
2868
+ function Fr(t, e, n) {
2869
+ t._throwIfRoot("uploadBytes");
2870
+ const r = Ur(t.storage, t._location, Ye(), new T(e, !0), n);
2871
+ return t.storage.makeRequestWithTokens(r, be).then((s) => ({
2872
+ metadata: s,
2873
+ ref: t
2874
+ }));
2875
+ }
2876
+ function Hr(t) {
2877
+ t._throwIfRoot("getDownloadURL");
2878
+ const e = Nr(t.storage, t._location, Ye());
2879
+ return t.storage.makeRequestWithTokens(e, be).then((n) => {
2880
+ if (n === null)
2881
+ throw Jn();
2882
+ return n;
2883
+ });
2884
+ }
2885
+ function jr(t) {
2886
+ t._throwIfRoot("deleteObject");
2887
+ const e = kr(t.storage, t._location);
2888
+ return t.storage.makeRequestWithTokens(e, be);
2889
+ }
2890
+ function Vr(t, e) {
2891
+ const n = wr(t._location.path, e), r = new E(t._location.bucket, n);
2892
+ return new N(t.storage, r);
2893
+ }
2894
+ /**
2895
+ * @license
2896
+ * Copyright 2017 Google LLC
2897
+ *
2898
+ * Licensed under the Apache License, Version 2.0 (the "License");
2899
+ * you may not use this file except in compliance with the License.
2900
+ * You may obtain a copy of the License at
2901
+ *
2902
+ * http://www.apache.org/licenses/LICENSE-2.0
2903
+ *
2904
+ * Unless required by applicable law or agreed to in writing, software
2905
+ * distributed under the License is distributed on an "AS IS" BASIS,
2906
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
2907
+ * See the License for the specific language governing permissions and
2908
+ * limitations under the License.
2909
+ */
2910
+ function zr(t) {
2911
+ return /^[A-Za-z]+:\/\//.test(t);
2912
+ }
2913
+ function Wr(t, e) {
2914
+ return new N(t, e);
2915
+ }
2916
+ function nt(t, e) {
2917
+ if (t instanceof ye) {
2918
+ const n = t;
2919
+ if (n._bucket == null)
2920
+ throw Kn();
2921
+ const r = new N(n, n._bucket);
2922
+ return e != null ? nt(r, e) : r;
2923
+ } else
2924
+ return e !== void 0 ? Vr(t, e) : t;
2925
+ }
2926
+ function qr(t, e) {
2927
+ if (e && zr(e)) {
2928
+ if (t instanceof ye)
2929
+ return Wr(t, e);
2930
+ throw de("To use ref(service, url), the first argument must be a Storage instance.");
2931
+ } else
2932
+ return nt(t, e);
2933
+ }
2934
+ function Se(t, e) {
2935
+ const n = e == null ? void 0 : e[Ve];
2936
+ return n == null ? null : E.makeFromBucketSpec(n, t);
2937
+ }
2938
+ function Gr(t, e, n, r = {}) {
2939
+ t.host = `${e}:${n}`, t._protocol = "http";
2940
+ const { mockUserToken: s } = r;
2941
+ s && (t._overrideAuthToken = typeof s == "string" ? s : _t(s, t.app.options.projectId));
2942
+ }
2943
+ class ye {
2944
+ constructor(e, n, r, s, o) {
2945
+ this.app = e, this._authProvider = n, this._appCheckProvider = r, this._url = s, this._firebaseVersion = o, this._bucket = null, this._host = je, this._protocol = "https", this._appId = null, this._deleted = !1, this._maxOperationRetryTime = Ln, this._maxUploadRetryTime = Mn, this._requests = /* @__PURE__ */ new Set(), s != null ? this._bucket = E.makeFromBucketSpec(s, this._host) : this._bucket = Se(this._host, this.app.options);
2946
+ }
2947
+ /**
2948
+ * The host string for this service, in the form of `host` or
2949
+ * `host:port`.
2950
+ */
2951
+ get host() {
2952
+ return this._host;
2953
+ }
2954
+ set host(e) {
2955
+ this._host = e, this._url != null ? this._bucket = E.makeFromBucketSpec(this._url, e) : this._bucket = Se(e, this.app.options);
2956
+ }
2957
+ /**
2958
+ * The maximum time to retry uploads in milliseconds.
2959
+ */
2960
+ get maxUploadRetryTime() {
2961
+ return this._maxUploadRetryTime;
2962
+ }
2963
+ set maxUploadRetryTime(e) {
2964
+ Oe(
2965
+ "time",
2966
+ /* minValue=*/
2967
+ 0,
2968
+ /* maxValue= */
2969
+ Number.POSITIVE_INFINITY,
2970
+ e
2971
+ ), this._maxUploadRetryTime = e;
2972
+ }
2973
+ /**
2974
+ * The maximum time to retry operations other than uploads or downloads in
2975
+ * milliseconds.
2976
+ */
2977
+ get maxOperationRetryTime() {
2978
+ return this._maxOperationRetryTime;
2979
+ }
2980
+ set maxOperationRetryTime(e) {
2981
+ Oe(
2982
+ "time",
2983
+ /* minValue=*/
2984
+ 0,
2985
+ /* maxValue= */
2986
+ Number.POSITIVE_INFINITY,
2987
+ e
2988
+ ), this._maxOperationRetryTime = e;
2989
+ }
2990
+ async _getAuthToken() {
2991
+ if (this._overrideAuthToken)
2992
+ return this._overrideAuthToken;
2993
+ const e = this._authProvider.getImmediate({ optional: !0 });
2994
+ if (e) {
2995
+ const n = await e.getToken();
2996
+ if (n !== null)
2997
+ return n.accessToken;
2998
+ }
2999
+ return null;
3000
+ }
3001
+ async _getAppCheckToken() {
3002
+ const e = this._appCheckProvider.getImmediate({ optional: !0 });
3003
+ return e ? (await e.getToken()).token : null;
3004
+ }
3005
+ /**
3006
+ * Stop running requests and prevent more from being created.
3007
+ */
3008
+ _delete() {
3009
+ return this._deleted || (this._deleted = !0, this._requests.forEach((e) => e.cancel()), this._requests.clear()), Promise.resolve();
3010
+ }
3011
+ /**
3012
+ * Returns a new firebaseStorage.Reference object referencing this StorageService
3013
+ * at the given Location.
3014
+ */
3015
+ _makeStorageReference(e) {
3016
+ return new N(this, e);
3017
+ }
3018
+ /**
3019
+ * @param requestInfo - HTTP RequestInfo object
3020
+ * @param authToken - Firebase auth token
3021
+ */
3022
+ _makeRequest(e, n, r, s, o = !0) {
3023
+ if (this._deleted)
3024
+ return new Qn(ze());
3025
+ {
3026
+ const i = ur(e, this._appId, r, s, n, this._firebaseVersion, o);
3027
+ return this._requests.add(i), i.getPromise().then(() => this._requests.delete(i), () => this._requests.delete(i)), i;
3028
+ }
3029
+ }
3030
+ async makeRequestWithTokens(e, n) {
3031
+ const [r, s] = await Promise.all([
3032
+ this._getAuthToken(),
3033
+ this._getAppCheckToken()
3034
+ ]);
3035
+ return this._makeRequest(e, n, r, s).getPromise();
3036
+ }
3037
+ }
3038
+ const Ne = "@firebase/storage", ke = "0.11.2";
3039
+ /**
3040
+ * @license
3041
+ * Copyright 2020 Google LLC
3042
+ *
3043
+ * Licensed under the Apache License, Version 2.0 (the "License");
3044
+ * you may not use this file except in compliance with the License.
3045
+ * You may obtain a copy of the License at
3046
+ *
3047
+ * http://www.apache.org/licenses/LICENSE-2.0
3048
+ *
3049
+ * Unless required by applicable law or agreed to in writing, software
3050
+ * distributed under the License is distributed on an "AS IS" BASIS,
3051
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3052
+ * See the License for the specific language governing permissions and
3053
+ * limitations under the License.
3054
+ */
3055
+ const rt = "storage";
3056
+ function ds(t, e, n) {
3057
+ return t = U(t), Fr(t, e, n);
3058
+ }
3059
+ function fs(t) {
3060
+ return t = U(t), Hr(t);
3061
+ }
3062
+ function ps(t) {
3063
+ return t = U(t), jr(t);
3064
+ }
3065
+ function gs(t, e) {
3066
+ return t = U(t), qr(t, e);
3067
+ }
3068
+ function ms(t = Dn(), e) {
3069
+ t = U(t);
3070
+ const r = In(t, rt).getImmediate({
3071
+ identifier: e
3072
+ }), s = gt("storage");
3073
+ return s && Kr(r, ...s), r;
3074
+ }
3075
+ function Kr(t, e, n, r = {}) {
3076
+ Gr(t, e, n, r);
3077
+ }
3078
+ /**
3079
+ * @license
3080
+ * Copyright 2021 Google LLC
3081
+ *
3082
+ * Licensed under the Apache License, Version 2.0 (the "License");
3083
+ * you may not use this file except in compliance with the License.
3084
+ * You may obtain a copy of the License at
3085
+ *
3086
+ * http://www.apache.org/licenses/LICENSE-2.0
3087
+ *
3088
+ * Unless required by applicable law or agreed to in writing, software
3089
+ * distributed under the License is distributed on an "AS IS" BASIS,
3090
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
3091
+ * See the License for the specific language governing permissions and
3092
+ * limitations under the License.
3093
+ */
3094
+ function _s(t, e) {
3095
+ return t = U(t), $r(t, e);
3096
+ }
3097
+ function Xr(t, { instanceIdentifier: e }) {
3098
+ const n = t.getProvider("app").getImmediate(), r = t.getProvider("auth-internal"), s = t.getProvider("app-check-internal");
3099
+ return new ye(n, r, s, e, An);
3100
+ }
3101
+ function Jr() {
3102
+ G(new $(
3103
+ rt,
3104
+ Xr,
3105
+ "PUBLIC"
3106
+ /* ComponentType.PUBLIC */
3107
+ ).setMultipleInstances(!0)), L(Ne, ke, ""), L(Ne, ke, "esm2017");
3108
+ }
3109
+ Jr();
3110
+ export {
3111
+ _s as A,
3112
+ ds as B,
3113
+ $ as C,
3114
+ fs as D,
3115
+ Le as E,
3116
+ x as F,
3117
+ ps as G,
3118
+ u as L,
3119
+ An as S,
3120
+ G as _,
3121
+ is as a,
3122
+ os as b,
3123
+ U as c,
3124
+ us as d,
3125
+ In as e,
3126
+ pt as f,
3127
+ rs as g,
3128
+ Dn as h,
3129
+ ss as i,
3130
+ Pe as j,
3131
+ ie as k,
3132
+ xt as l,
3133
+ lt as m,
3134
+ as as n,
3135
+ cs as o,
3136
+ hs as p,
3137
+ ls as q,
3138
+ L as r,
3139
+ vn as s,
3140
+ ms as t,
3141
+ Zr as u,
3142
+ Qr as v,
3143
+ es as w,
3144
+ ns as x,
3145
+ ts as y,
3146
+ gs as z
3147
+ };