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