@feedmepos/mf-payment 0.0.0-beta.43 → 0.0.0-beta.44

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,1805 @@
1
+ import { _ as Qe, C as et, r as Oe, S as tt, g as re, a as nt, b as rt, c as _e, d as st, F as it, e as ot } from "./app-CkViCBtc.js";
2
+ import { d as at, f as ut, _ as Y, m as ct } from "./index-9ujJCGqe.js";
3
+ /**
4
+ * @license
5
+ * Copyright 2017 Google LLC
6
+ *
7
+ * Licensed under the Apache License, Version 2.0 (the "License");
8
+ * you may not use this file except in compliance with the License.
9
+ * You may obtain a copy of the License at
10
+ *
11
+ * http://www.apache.org/licenses/LICENSE-2.0
12
+ *
13
+ * Unless required by applicable law or agreed to in writing, software
14
+ * distributed under the License is distributed on an "AS IS" BASIS,
15
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16
+ * See the License for the specific language governing permissions and
17
+ * limitations under the License.
18
+ */
19
+ const Pe = "firebasestorage.googleapis.com", xe = "storageBucket", lt = 2 * 60 * 1e3, ht = 10 * 60 * 1e3;
20
+ /**
21
+ * @license
22
+ * Copyright 2017 Google LLC
23
+ *
24
+ * Licensed under the Apache License, Version 2.0 (the "License");
25
+ * you may not use this file except in compliance with the License.
26
+ * You may obtain a copy of the License at
27
+ *
28
+ * http://www.apache.org/licenses/LICENSE-2.0
29
+ *
30
+ * Unless required by applicable law or agreed to in writing, software
31
+ * distributed under the License is distributed on an "AS IS" BASIS,
32
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
33
+ * See the License for the specific language governing permissions and
34
+ * limitations under the License.
35
+ */
36
+ class y extends it {
37
+ /**
38
+ * @param code - A `StorageErrorCode` string to be prefixed with 'storage/' and
39
+ * added to the end of the message.
40
+ * @param message - Error message.
41
+ * @param status_ - Corresponding HTTP Status Code
42
+ */
43
+ constructor(t, n, r = 0) {
44
+ super(de(t), `Firebase Storage: ${n} (${de(t)})`), this.status_ = r, this.customData = { serverResponse: null }, this._baseMessage = this.message, Object.setPrototypeOf(this, y.prototype);
45
+ }
46
+ get status() {
47
+ return this.status_;
48
+ }
49
+ set status(t) {
50
+ this.status_ = t;
51
+ }
52
+ /**
53
+ * Compares a `StorageErrorCode` against this error's code, filtering out the prefix.
54
+ */
55
+ _codeEquals(t) {
56
+ return de(t) === this.code;
57
+ }
58
+ /**
59
+ * Optional response message that was added by the server.
60
+ */
61
+ get serverResponse() {
62
+ return this.customData.serverResponse;
63
+ }
64
+ set serverResponse(t) {
65
+ this.customData.serverResponse = t, this.customData.serverResponse ? this.message = `${this._baseMessage}
66
+ ${this.customData.serverResponse}` : this.message = this._baseMessage;
67
+ }
68
+ }
69
+ var R;
70
+ (function(e) {
71
+ e.UNKNOWN = "unknown", e.OBJECT_NOT_FOUND = "object-not-found", e.BUCKET_NOT_FOUND = "bucket-not-found", e.PROJECT_NOT_FOUND = "project-not-found", e.QUOTA_EXCEEDED = "quota-exceeded", e.UNAUTHENTICATED = "unauthenticated", e.UNAUTHORIZED = "unauthorized", e.UNAUTHORIZED_APP = "unauthorized-app", e.RETRY_LIMIT_EXCEEDED = "retry-limit-exceeded", e.INVALID_CHECKSUM = "invalid-checksum", e.CANCELED = "canceled", e.INVALID_EVENT_NAME = "invalid-event-name", e.INVALID_URL = "invalid-url", e.INVALID_DEFAULT_BUCKET = "invalid-default-bucket", e.NO_DEFAULT_BUCKET = "no-default-bucket", e.CANNOT_SLICE_BLOB = "cannot-slice-blob", e.SERVER_FILE_WRONG_SIZE = "server-file-wrong-size", e.NO_DOWNLOAD_URL = "no-download-url", e.INVALID_ARGUMENT = "invalid-argument", e.INVALID_ARGUMENT_COUNT = "invalid-argument-count", e.APP_DELETED = "app-deleted", e.INVALID_ROOT_OPERATION = "invalid-root-operation", e.INVALID_FORMAT = "invalid-format", e.INTERNAL_ERROR = "internal-error", e.UNSUPPORTED_ENVIRONMENT = "unsupported-environment";
72
+ })(R || (R = {}));
73
+ function de(e) {
74
+ return "storage/" + e;
75
+ }
76
+ function ge() {
77
+ const e = "An unknown error occurred, please check the error payload for server response.";
78
+ return new y(R.UNKNOWN, e);
79
+ }
80
+ function dt(e) {
81
+ return new y(R.OBJECT_NOT_FOUND, "Object '" + e + "' does not exist.");
82
+ }
83
+ function ft(e) {
84
+ return new y(R.QUOTA_EXCEEDED, "Quota for bucket '" + e + "' exceeded, please view quota on https://firebase.google.com/pricing/.");
85
+ }
86
+ function pt() {
87
+ const e = "User is not authenticated, please authenticate using Firebase Authentication and try again.";
88
+ return new y(R.UNAUTHENTICATED, e);
89
+ }
90
+ function _t() {
91
+ return new y(R.UNAUTHORIZED_APP, "This app does not have permission to access Firebase Storage on this project.");
92
+ }
93
+ function mt(e) {
94
+ return new y(R.UNAUTHORIZED, "User does not have permission to access '" + e + "'.");
95
+ }
96
+ function gt() {
97
+ return new y(R.RETRY_LIMIT_EXCEEDED, "Max retry time for operation exceeded, please try again.");
98
+ }
99
+ function bt() {
100
+ return new y(R.CANCELED, "User canceled the upload/download.");
101
+ }
102
+ function wt(e) {
103
+ return new y(R.INVALID_URL, "Invalid URL '" + e + "'.");
104
+ }
105
+ function Tt(e) {
106
+ return new y(R.INVALID_DEFAULT_BUCKET, "Invalid default bucket '" + e + "'.");
107
+ }
108
+ function Rt() {
109
+ return new y(R.NO_DEFAULT_BUCKET, "No default bucket found. Did you set the '" + xe + "' property when initializing the app?");
110
+ }
111
+ function yt() {
112
+ return new y(R.CANNOT_SLICE_BLOB, "Cannot slice blob for upload. Please retry the upload.");
113
+ }
114
+ function kt() {
115
+ return new y(R.NO_DOWNLOAD_URL, "The given file does not have any download URLs.");
116
+ }
117
+ function Ot(e) {
118
+ return new y(R.UNSUPPORTED_ENVIRONMENT, `${e} is missing. Make sure to install the required polyfills. See https://firebase.google.com/docs/web/environments-js-sdk#polyfills for more information.`);
119
+ }
120
+ function me(e) {
121
+ return new y(R.INVALID_ARGUMENT, e);
122
+ }
123
+ function Ce() {
124
+ return new y(R.APP_DELETED, "The Firebase app was deleted.");
125
+ }
126
+ function Et(e) {
127
+ return new y(R.INVALID_ROOT_OPERATION, "The operation '" + e + "' cannot be performed on a root reference, create a non-root reference using child, such as .child('file.png').");
128
+ }
129
+ function te(e, t) {
130
+ return new y(R.INVALID_FORMAT, "String does not match format '" + e + "': " + t);
131
+ }
132
+ function ee(e) {
133
+ throw new y(R.INTERNAL_ERROR, "Internal error: " + e);
134
+ }
135
+ /**
136
+ * @license
137
+ * Copyright 2017 Google LLC
138
+ *
139
+ * Licensed under the Apache License, Version 2.0 (the "License");
140
+ * you may not use this file except in compliance with the License.
141
+ * You may obtain a copy of the License at
142
+ *
143
+ * http://www.apache.org/licenses/LICENSE-2.0
144
+ *
145
+ * Unless required by applicable law or agreed to in writing, software
146
+ * distributed under the License is distributed on an "AS IS" BASIS,
147
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
148
+ * See the License for the specific language governing permissions and
149
+ * limitations under the License.
150
+ */
151
+ class x {
152
+ constructor(t, n) {
153
+ this.bucket = t, this.path_ = n;
154
+ }
155
+ get path() {
156
+ return this.path_;
157
+ }
158
+ get isRoot() {
159
+ return this.path.length === 0;
160
+ }
161
+ fullServerUrl() {
162
+ const t = encodeURIComponent;
163
+ return "/b/" + t(this.bucket) + "/o/" + t(this.path);
164
+ }
165
+ bucketOnlyServerUrl() {
166
+ return "/b/" + encodeURIComponent(this.bucket) + "/o";
167
+ }
168
+ static makeFromBucketSpec(t, n) {
169
+ let r;
170
+ try {
171
+ r = x.makeFromUrl(t, n);
172
+ } catch {
173
+ return new x(t, "");
174
+ }
175
+ if (r.path === "")
176
+ return r;
177
+ throw Tt(t);
178
+ }
179
+ static makeFromUrl(t, n) {
180
+ let r = null;
181
+ const s = "([A-Za-z0-9.\\-_]+)";
182
+ function i($) {
183
+ $.path.charAt($.path.length - 1) === "/" && ($.path_ = $.path_.slice(0, -1));
184
+ }
185
+ const a = "(/(.*))?$", h = new RegExp("^gs://" + s + a, "i"), f = { bucket: 1, path: 3 };
186
+ function m($) {
187
+ $.path_ = decodeURIComponent($.path);
188
+ }
189
+ const T = "v[A-Za-z0-9_]+", b = n.replace(/[.]/g, "\\."), O = "(/([^?#]*).*)?$", E = new RegExp(`^https?://${b}/${T}/b/${s}/o${O}`, "i"), v = { bucket: 1, path: 3 }, F = n === Pe ? "(?:storage.googleapis.com|storage.cloud.google.com)" : n, U = "([^?#]*)", H = new RegExp(`^https?://${F}/${s}/${U}`, "i"), D = [
190
+ { regex: h, indices: f, postModify: i },
191
+ {
192
+ regex: E,
193
+ indices: v,
194
+ postModify: m
195
+ },
196
+ {
197
+ regex: H,
198
+ indices: { bucket: 1, path: 2 },
199
+ postModify: m
200
+ }
201
+ ];
202
+ for (let $ = 0; $ < D.length; $++) {
203
+ const L = D[$], M = L.regex.exec(t);
204
+ if (M) {
205
+ const se = M[L.indices.bucket];
206
+ let q = M[L.indices.path];
207
+ q || (q = ""), r = new x(se, q), L.postModify(r);
208
+ break;
209
+ }
210
+ }
211
+ if (r == null)
212
+ throw wt(t);
213
+ return r;
214
+ }
215
+ }
216
+ class St {
217
+ constructor(t) {
218
+ this.promise_ = Promise.reject(t);
219
+ }
220
+ /** @inheritDoc */
221
+ getPromise() {
222
+ return this.promise_;
223
+ }
224
+ /** @inheritDoc */
225
+ cancel(t = !1) {
226
+ }
227
+ }
228
+ /**
229
+ * @license
230
+ * Copyright 2017 Google LLC
231
+ *
232
+ * Licensed under the Apache License, Version 2.0 (the "License");
233
+ * you may not use this file except in compliance with the License.
234
+ * You may obtain a copy of the License at
235
+ *
236
+ * http://www.apache.org/licenses/LICENSE-2.0
237
+ *
238
+ * Unless required by applicable law or agreed to in writing, software
239
+ * distributed under the License is distributed on an "AS IS" BASIS,
240
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
241
+ * See the License for the specific language governing permissions and
242
+ * limitations under the License.
243
+ */
244
+ function At(e, t, n) {
245
+ let r = 1, s = null, i = null, a = !1, h = 0;
246
+ function f() {
247
+ return h === 2;
248
+ }
249
+ let m = !1;
250
+ function T(...U) {
251
+ m || (m = !0, t.apply(null, U));
252
+ }
253
+ function b(U) {
254
+ s = setTimeout(() => {
255
+ s = null, e(E, f());
256
+ }, U);
257
+ }
258
+ function O() {
259
+ i && clearTimeout(i);
260
+ }
261
+ function E(U, ...H) {
262
+ if (m) {
263
+ O();
264
+ return;
265
+ }
266
+ if (U) {
267
+ O(), T.call(null, U, ...H);
268
+ return;
269
+ }
270
+ if (f() || a) {
271
+ O(), T.call(null, U, ...H);
272
+ return;
273
+ }
274
+ r < 64 && (r *= 2);
275
+ let D;
276
+ h === 1 ? (h = 2, D = 0) : D = (r + Math.random()) * 1e3, b(D);
277
+ }
278
+ let v = !1;
279
+ function F(U) {
280
+ v || (v = !0, O(), !m && (s !== null ? (U || (h = 2), clearTimeout(s), b(0)) : U || (h = 1)));
281
+ }
282
+ return b(0), i = setTimeout(() => {
283
+ a = !0, F(!0);
284
+ }, n), F;
285
+ }
286
+ function vt(e) {
287
+ e(!1);
288
+ }
289
+ /**
290
+ * @license
291
+ * Copyright 2017 Google LLC
292
+ *
293
+ * Licensed under the Apache License, Version 2.0 (the "License");
294
+ * you may not use this file except in compliance with the License.
295
+ * You may obtain a copy of the License at
296
+ *
297
+ * http://www.apache.org/licenses/LICENSE-2.0
298
+ *
299
+ * Unless required by applicable law or agreed to in writing, software
300
+ * distributed under the License is distributed on an "AS IS" BASIS,
301
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
302
+ * See the License for the specific language governing permissions and
303
+ * limitations under the License.
304
+ */
305
+ function Ut(e) {
306
+ return e !== void 0;
307
+ }
308
+ function $t(e) {
309
+ return typeof e == "object" && !Array.isArray(e);
310
+ }
311
+ function be(e) {
312
+ return typeof e == "string" || e instanceof String;
313
+ }
314
+ function Ee(e) {
315
+ return we() && e instanceof Blob;
316
+ }
317
+ function we() {
318
+ return typeof Blob < "u";
319
+ }
320
+ function Se(e, t, n, r) {
321
+ if (r < t)
322
+ throw me(`Invalid value for '${e}'. Expected ${t} or greater.`);
323
+ if (r > n)
324
+ throw me(`Invalid value for '${e}'. Expected ${n} or less.`);
325
+ }
326
+ /**
327
+ * @license
328
+ * Copyright 2017 Google LLC
329
+ *
330
+ * Licensed under the Apache License, Version 2.0 (the "License");
331
+ * you may not use this file except in compliance with the License.
332
+ * You may obtain a copy of the License at
333
+ *
334
+ * http://www.apache.org/licenses/LICENSE-2.0
335
+ *
336
+ * Unless required by applicable law or agreed to in writing, software
337
+ * distributed under the License is distributed on an "AS IS" BASIS,
338
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
339
+ * See the License for the specific language governing permissions and
340
+ * limitations under the License.
341
+ */
342
+ function le(e, t, n) {
343
+ let r = t;
344
+ return n == null && (r = `https://${t}`), `${n}://${r}/v0${e}`;
345
+ }
346
+ function Me(e) {
347
+ const t = encodeURIComponent;
348
+ let n = "?";
349
+ for (const r in e)
350
+ if (e.hasOwnProperty(r)) {
351
+ const s = t(r) + "=" + t(e[r]);
352
+ n = n + s + "&";
353
+ }
354
+ return n = n.slice(0, -1), n;
355
+ }
356
+ var G;
357
+ (function(e) {
358
+ e[e.NO_ERROR = 0] = "NO_ERROR", e[e.NETWORK_ERROR = 1] = "NETWORK_ERROR", e[e.ABORT = 2] = "ABORT";
359
+ })(G || (G = {}));
360
+ /**
361
+ * @license
362
+ * Copyright 2022 Google LLC
363
+ *
364
+ * Licensed under the Apache License, Version 2.0 (the "License");
365
+ * you may not use this file except in compliance with the License.
366
+ * You may obtain a copy of the License at
367
+ *
368
+ * http://www.apache.org/licenses/LICENSE-2.0
369
+ *
370
+ * Unless required by applicable law or agreed to in writing, software
371
+ * distributed under the License is distributed on an "AS IS" BASIS,
372
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
373
+ * See the License for the specific language governing permissions and
374
+ * limitations under the License.
375
+ */
376
+ function Nt(e, t) {
377
+ const n = e >= 500 && e < 600, s = [
378
+ // Request Timeout: web server didn't receive full request in time.
379
+ 408,
380
+ // Too Many Requests: you're getting rate-limited, basically.
381
+ 429
382
+ ].indexOf(e) !== -1, i = t.indexOf(e) !== -1;
383
+ return n || s || i;
384
+ }
385
+ /**
386
+ * @license
387
+ * Copyright 2017 Google LLC
388
+ *
389
+ * Licensed under the Apache License, Version 2.0 (the "License");
390
+ * you may not use this file except in compliance with the License.
391
+ * You may obtain a copy of the License at
392
+ *
393
+ * http://www.apache.org/licenses/LICENSE-2.0
394
+ *
395
+ * Unless required by applicable law or agreed to in writing, software
396
+ * distributed under the License is distributed on an "AS IS" BASIS,
397
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
398
+ * See the License for the specific language governing permissions and
399
+ * limitations under the License.
400
+ */
401
+ class It {
402
+ constructor(t, n, r, s, i, a, h, f, m, T, b, O = !0) {
403
+ this.url_ = t, this.method_ = n, this.headers_ = r, this.body_ = s, this.successCodes_ = i, this.additionalRetryCodes_ = a, this.callback_ = h, this.errorCallback_ = f, this.timeout_ = m, this.progressCallback_ = T, this.connectionFactory_ = b, this.retry = O, this.pendingConnection_ = null, this.backoffId_ = null, this.canceled_ = !1, this.appDelete_ = !1, this.promise_ = new Promise((E, v) => {
404
+ this.resolve_ = E, this.reject_ = v, this.start_();
405
+ });
406
+ }
407
+ /**
408
+ * Actually starts the retry loop.
409
+ */
410
+ start_() {
411
+ const t = (r, s) => {
412
+ if (s) {
413
+ r(!1, new ue(!1, null, !0));
414
+ return;
415
+ }
416
+ const i = this.connectionFactory_();
417
+ this.pendingConnection_ = i;
418
+ const a = (h) => {
419
+ const f = h.loaded, m = h.lengthComputable ? h.total : -1;
420
+ this.progressCallback_ !== null && this.progressCallback_(f, m);
421
+ };
422
+ this.progressCallback_ !== null && i.addUploadProgressListener(a), i.send(this.url_, this.method_, this.body_, this.headers_).then(() => {
423
+ this.progressCallback_ !== null && i.removeUploadProgressListener(a), this.pendingConnection_ = null;
424
+ const h = i.getErrorCode() === G.NO_ERROR, f = i.getStatus();
425
+ if (!h || Nt(f, this.additionalRetryCodes_) && this.retry) {
426
+ const T = i.getErrorCode() === G.ABORT;
427
+ r(!1, new ue(!1, null, T));
428
+ return;
429
+ }
430
+ const m = this.successCodes_.indexOf(f) !== -1;
431
+ r(!0, new ue(m, i));
432
+ });
433
+ }, n = (r, s) => {
434
+ const i = this.resolve_, a = this.reject_, h = s.connection;
435
+ if (s.wasSuccessCode)
436
+ try {
437
+ const f = this.callback_(h, h.getResponse());
438
+ Ut(f) ? i(f) : i();
439
+ } catch (f) {
440
+ a(f);
441
+ }
442
+ else if (h !== null) {
443
+ const f = ge();
444
+ f.serverResponse = h.getErrorText(), this.errorCallback_ ? a(this.errorCallback_(h, f)) : a(f);
445
+ } else if (s.canceled) {
446
+ const f = this.appDelete_ ? Ce() : bt();
447
+ a(f);
448
+ } else {
449
+ const f = gt();
450
+ a(f);
451
+ }
452
+ };
453
+ this.canceled_ ? n(!1, new ue(!1, null, !0)) : this.backoffId_ = At(t, n, this.timeout_);
454
+ }
455
+ /** @inheritDoc */
456
+ getPromise() {
457
+ return this.promise_;
458
+ }
459
+ /** @inheritDoc */
460
+ cancel(t) {
461
+ this.canceled_ = !0, this.appDelete_ = t || !1, this.backoffId_ !== null && vt(this.backoffId_), this.pendingConnection_ !== null && this.pendingConnection_.abort();
462
+ }
463
+ }
464
+ class ue {
465
+ constructor(t, n, r) {
466
+ this.wasSuccessCode = t, this.connection = n, this.canceled = !!r;
467
+ }
468
+ }
469
+ function Dt(e, t) {
470
+ t !== null && t.length > 0 && (e.Authorization = "Firebase " + t);
471
+ }
472
+ function Pt(e, t) {
473
+ e["X-Firebase-Storage-Version"] = "webjs/" + (t ?? "AppManager");
474
+ }
475
+ function xt(e, t) {
476
+ t && (e["X-Firebase-GMPID"] = t);
477
+ }
478
+ function Ct(e, t) {
479
+ t !== null && (e["X-Firebase-AppCheck"] = t);
480
+ }
481
+ function Mt(e, t, n, r, s, i, a = !0) {
482
+ const h = Me(e.urlParams), f = e.url + h, m = Object.assign({}, e.headers);
483
+ return xt(m, t), Dt(m, n), Pt(m, i), Ct(m, r), new It(f, e.method, m, e.body, e.successCodes, e.additionalRetryCodes, e.handler, e.errorHandler, e.timeout, e.progressCallback, s, a);
484
+ }
485
+ /**
486
+ * @license
487
+ * Copyright 2017 Google LLC
488
+ *
489
+ * Licensed under the Apache License, Version 2.0 (the "License");
490
+ * you may not use this file except in compliance with the License.
491
+ * You may obtain a copy of the License at
492
+ *
493
+ * http://www.apache.org/licenses/LICENSE-2.0
494
+ *
495
+ * Unless required by applicable law or agreed to in writing, software
496
+ * distributed under the License is distributed on an "AS IS" BASIS,
497
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
498
+ * See the License for the specific language governing permissions and
499
+ * limitations under the License.
500
+ */
501
+ function Lt() {
502
+ return typeof BlobBuilder < "u" ? BlobBuilder : typeof WebKitBlobBuilder < "u" ? WebKitBlobBuilder : void 0;
503
+ }
504
+ function Bt(...e) {
505
+ const t = Lt();
506
+ if (t !== void 0) {
507
+ const n = new t();
508
+ for (let r = 0; r < e.length; r++)
509
+ n.append(e[r]);
510
+ return n.getBlob();
511
+ } else {
512
+ if (we())
513
+ return new Blob(e);
514
+ throw new y(R.UNSUPPORTED_ENVIRONMENT, "This browser doesn't seem to support creating Blobs");
515
+ }
516
+ }
517
+ function Ft(e, t, n) {
518
+ return e.webkitSlice ? e.webkitSlice(t, n) : e.mozSlice ? e.mozSlice(t, n) : e.slice ? e.slice(t, n) : null;
519
+ }
520
+ /**
521
+ * @license
522
+ * Copyright 2021 Google LLC
523
+ *
524
+ * Licensed under the Apache License, Version 2.0 (the "License");
525
+ * you may not use this file except in compliance with the License.
526
+ * You may obtain a copy of the License at
527
+ *
528
+ * http://www.apache.org/licenses/LICENSE-2.0
529
+ *
530
+ * Unless required by applicable law or agreed to in writing, software
531
+ * distributed under the License is distributed on an "AS IS" BASIS,
532
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
533
+ * See the License for the specific language governing permissions and
534
+ * limitations under the License.
535
+ */
536
+ function jt(e) {
537
+ if (typeof atob > "u")
538
+ throw Ot("base-64");
539
+ return atob(e);
540
+ }
541
+ /**
542
+ * @license
543
+ * Copyright 2017 Google LLC
544
+ *
545
+ * Licensed under the Apache License, Version 2.0 (the "License");
546
+ * you may not use this file except in compliance with the License.
547
+ * You may obtain a copy of the License at
548
+ *
549
+ * http://www.apache.org/licenses/LICENSE-2.0
550
+ *
551
+ * Unless required by applicable law or agreed to in writing, software
552
+ * distributed under the License is distributed on an "AS IS" BASIS,
553
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
554
+ * See the License for the specific language governing permissions and
555
+ * limitations under the License.
556
+ */
557
+ const B = {
558
+ /**
559
+ * Indicates the string should be interpreted "raw", that is, as normal text.
560
+ * The string will be interpreted as UTF-16, then uploaded as a UTF-8 byte
561
+ * sequence.
562
+ * Example: The string 'Hello! \\ud83d\\ude0a' becomes the byte sequence
563
+ * 48 65 6c 6c 6f 21 20 f0 9f 98 8a
564
+ */
565
+ RAW: "raw",
566
+ /**
567
+ * Indicates the string should be interpreted as base64-encoded data.
568
+ * Padding characters (trailing '='s) are optional.
569
+ * Example: The string 'rWmO++E6t7/rlw==' becomes the byte sequence
570
+ * ad 69 8e fb e1 3a b7 bf eb 97
571
+ */
572
+ BASE64: "base64",
573
+ /**
574
+ * Indicates the string should be interpreted as base64url-encoded data.
575
+ * Padding characters (trailing '='s) are optional.
576
+ * Example: The string 'rWmO--E6t7_rlw==' becomes the byte sequence
577
+ * ad 69 8e fb e1 3a b7 bf eb 97
578
+ */
579
+ BASE64URL: "base64url",
580
+ /**
581
+ * Indicates the string is a data URL, such as one obtained from
582
+ * canvas.toDataURL().
583
+ * Example: the string 'data:application/octet-stream;base64,aaaa'
584
+ * becomes the byte sequence
585
+ * 69 a6 9a
586
+ * (the content-type "application/octet-stream" is also applied, but can
587
+ * be overridden in the metadata object).
588
+ */
589
+ DATA_URL: "data_url"
590
+ };
591
+ class fe {
592
+ constructor(t, n) {
593
+ this.data = t, this.contentType = n || null;
594
+ }
595
+ }
596
+ function Ht(e, t) {
597
+ switch (e) {
598
+ case B.RAW:
599
+ return new fe(Le(t));
600
+ case B.BASE64:
601
+ case B.BASE64URL:
602
+ return new fe(Be(e, t));
603
+ case B.DATA_URL:
604
+ return new fe(Vt(t), Yt(t));
605
+ }
606
+ throw ge();
607
+ }
608
+ function Le(e) {
609
+ const t = [];
610
+ for (let n = 0; n < e.length; n++) {
611
+ let r = e.charCodeAt(n);
612
+ if (r <= 127)
613
+ t.push(r);
614
+ else if (r <= 2047)
615
+ t.push(192 | r >> 6, 128 | r & 63);
616
+ else if ((r & 64512) === 55296)
617
+ if (!(n < e.length - 1 && (e.charCodeAt(n + 1) & 64512) === 56320))
618
+ t.push(239, 191, 189);
619
+ else {
620
+ const i = r, a = e.charCodeAt(++n);
621
+ r = 65536 | (i & 1023) << 10 | a & 1023, t.push(240 | r >> 18, 128 | r >> 12 & 63, 128 | r >> 6 & 63, 128 | r & 63);
622
+ }
623
+ else
624
+ (r & 64512) === 56320 ? t.push(239, 191, 189) : t.push(224 | r >> 12, 128 | r >> 6 & 63, 128 | r & 63);
625
+ }
626
+ return new Uint8Array(t);
627
+ }
628
+ function Wt(e) {
629
+ let t;
630
+ try {
631
+ t = decodeURIComponent(e);
632
+ } catch {
633
+ throw te(B.DATA_URL, "Malformed data URL.");
634
+ }
635
+ return Le(t);
636
+ }
637
+ function Be(e, t) {
638
+ switch (e) {
639
+ case B.BASE64: {
640
+ const s = t.indexOf("-") !== -1, i = t.indexOf("_") !== -1;
641
+ if (s || i)
642
+ throw te(e, "Invalid character '" + (s ? "-" : "_") + "' found: is it base64url encoded?");
643
+ break;
644
+ }
645
+ case B.BASE64URL: {
646
+ const s = t.indexOf("+") !== -1, i = t.indexOf("/") !== -1;
647
+ if (s || i)
648
+ throw te(e, "Invalid character '" + (s ? "+" : "/") + "' found: is it base64 encoded?");
649
+ t = t.replace(/-/g, "+").replace(/_/g, "/");
650
+ break;
651
+ }
652
+ }
653
+ let n;
654
+ try {
655
+ n = jt(t);
656
+ } catch (s) {
657
+ throw s.message.includes("polyfill") ? s : te(e, "Invalid character found");
658
+ }
659
+ const r = new Uint8Array(n.length);
660
+ for (let s = 0; s < n.length; s++)
661
+ r[s] = n.charCodeAt(s);
662
+ return r;
663
+ }
664
+ class Fe {
665
+ constructor(t) {
666
+ this.base64 = !1, this.contentType = null;
667
+ const n = t.match(/^data:([^,]+)?,/);
668
+ if (n === null)
669
+ throw te(B.DATA_URL, "Must be formatted 'data:[<mediatype>][;base64],<data>");
670
+ const r = n[1] || null;
671
+ r != null && (this.base64 = qt(r, ";base64"), this.contentType = this.base64 ? r.substring(0, r.length - 7) : r), this.rest = t.substring(t.indexOf(",") + 1);
672
+ }
673
+ }
674
+ function Vt(e) {
675
+ const t = new Fe(e);
676
+ return t.base64 ? Be(B.BASE64, t.rest) : Wt(t.rest);
677
+ }
678
+ function Yt(e) {
679
+ return new Fe(e).contentType;
680
+ }
681
+ function qt(e, t) {
682
+ return e.length >= t.length ? e.substring(e.length - t.length) === t : !1;
683
+ }
684
+ /**
685
+ * @license
686
+ * Copyright 2017 Google LLC
687
+ *
688
+ * Licensed under the Apache License, Version 2.0 (the "License");
689
+ * you may not use this file except in compliance with the License.
690
+ * You may obtain a copy of the License at
691
+ *
692
+ * http://www.apache.org/licenses/LICENSE-2.0
693
+ *
694
+ * Unless required by applicable law or agreed to in writing, software
695
+ * distributed under the License is distributed on an "AS IS" BASIS,
696
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
697
+ * See the License for the specific language governing permissions and
698
+ * limitations under the License.
699
+ */
700
+ class V {
701
+ constructor(t, n) {
702
+ let r = 0, s = "";
703
+ Ee(t) ? (this.data_ = t, r = t.size, s = t.type) : t instanceof ArrayBuffer ? (n ? this.data_ = new Uint8Array(t) : (this.data_ = new Uint8Array(t.byteLength), this.data_.set(new Uint8Array(t))), r = this.data_.length) : t instanceof Uint8Array && (n ? this.data_ = t : (this.data_ = new Uint8Array(t.length), this.data_.set(t)), r = t.length), this.size_ = r, this.type_ = s;
704
+ }
705
+ size() {
706
+ return this.size_;
707
+ }
708
+ type() {
709
+ return this.type_;
710
+ }
711
+ slice(t, n) {
712
+ if (Ee(this.data_)) {
713
+ const r = this.data_, s = Ft(r, t, n);
714
+ return s === null ? null : new V(s);
715
+ } else {
716
+ const r = new Uint8Array(this.data_.buffer, t, n - t);
717
+ return new V(r, !0);
718
+ }
719
+ }
720
+ static getBlob(...t) {
721
+ if (we()) {
722
+ const n = t.map((r) => r instanceof V ? r.data_ : r);
723
+ return new V(Bt.apply(null, n));
724
+ } else {
725
+ const n = t.map((a) => be(a) ? Ht(B.RAW, a).data : a.data_);
726
+ let r = 0;
727
+ n.forEach((a) => {
728
+ r += a.byteLength;
729
+ });
730
+ const s = new Uint8Array(r);
731
+ let i = 0;
732
+ return n.forEach((a) => {
733
+ for (let h = 0; h < a.length; h++)
734
+ s[i++] = a[h];
735
+ }), new V(s, !0);
736
+ }
737
+ }
738
+ uploadData() {
739
+ return this.data_;
740
+ }
741
+ }
742
+ /**
743
+ * @license
744
+ * Copyright 2017 Google LLC
745
+ *
746
+ * Licensed under the Apache License, Version 2.0 (the "License");
747
+ * you may not use this file except in compliance with the License.
748
+ * You may obtain a copy of the License at
749
+ *
750
+ * http://www.apache.org/licenses/LICENSE-2.0
751
+ *
752
+ * Unless required by applicable law or agreed to in writing, software
753
+ * distributed under the License is distributed on an "AS IS" BASIS,
754
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
755
+ * See the License for the specific language governing permissions and
756
+ * limitations under the License.
757
+ */
758
+ function je(e) {
759
+ let t;
760
+ try {
761
+ t = JSON.parse(e);
762
+ } catch {
763
+ return null;
764
+ }
765
+ return $t(t) ? t : null;
766
+ }
767
+ /**
768
+ * @license
769
+ * Copyright 2017 Google LLC
770
+ *
771
+ * Licensed under the Apache License, Version 2.0 (the "License");
772
+ * you may not use this file except in compliance with the License.
773
+ * You may obtain a copy of the License at
774
+ *
775
+ * http://www.apache.org/licenses/LICENSE-2.0
776
+ *
777
+ * Unless required by applicable law or agreed to in writing, software
778
+ * distributed under the License is distributed on an "AS IS" BASIS,
779
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
780
+ * See the License for the specific language governing permissions and
781
+ * limitations under the License.
782
+ */
783
+ function zt(e) {
784
+ if (e.length === 0)
785
+ return null;
786
+ const t = e.lastIndexOf("/");
787
+ return t === -1 ? "" : e.slice(0, t);
788
+ }
789
+ function Xt(e, t) {
790
+ const n = t.split("/").filter((r) => r.length > 0).join("/");
791
+ return e.length === 0 ? n : e + "/" + n;
792
+ }
793
+ function He(e) {
794
+ const t = e.lastIndexOf("/", e.length - 2);
795
+ return t === -1 ? e : e.slice(t + 1);
796
+ }
797
+ /**
798
+ * @license
799
+ * Copyright 2017 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
+ function Gt(e, t) {
814
+ return t;
815
+ }
816
+ class I {
817
+ constructor(t, n, r, s) {
818
+ this.server = t, this.local = n || t, this.writable = !!r, this.xform = s || Gt;
819
+ }
820
+ }
821
+ let ce = null;
822
+ function Kt(e) {
823
+ return !be(e) || e.length < 2 ? e : He(e);
824
+ }
825
+ function We() {
826
+ if (ce)
827
+ return ce;
828
+ const e = [];
829
+ e.push(new I("bucket")), e.push(new I("generation")), e.push(new I("metageneration")), e.push(new I("name", "fullPath", !0));
830
+ function t(i, a) {
831
+ return Kt(a);
832
+ }
833
+ const n = new I("name");
834
+ n.xform = t, e.push(n);
835
+ function r(i, a) {
836
+ return a !== void 0 ? Number(a) : a;
837
+ }
838
+ const s = new I("size");
839
+ return s.xform = r, e.push(s), e.push(new I("timeCreated")), e.push(new I("updated")), e.push(new I("md5Hash", null, !0)), e.push(new I("cacheControl", null, !0)), e.push(new I("contentDisposition", null, !0)), e.push(new I("contentEncoding", null, !0)), e.push(new I("contentLanguage", null, !0)), e.push(new I("contentType", null, !0)), e.push(new I("metadata", "customMetadata", !0)), ce = e, ce;
840
+ }
841
+ function Zt(e, t) {
842
+ function n() {
843
+ const r = e.bucket, s = e.fullPath, i = new x(r, s);
844
+ return t._makeStorageReference(i);
845
+ }
846
+ Object.defineProperty(e, "ref", { get: n });
847
+ }
848
+ function Jt(e, t, n) {
849
+ const r = {};
850
+ r.type = "file";
851
+ const s = n.length;
852
+ for (let i = 0; i < s; i++) {
853
+ const a = n[i];
854
+ r[a.local] = a.xform(r, t[a.server]);
855
+ }
856
+ return Zt(r, e), r;
857
+ }
858
+ function Ve(e, t, n) {
859
+ const r = je(t);
860
+ return r === null ? null : Jt(e, r, n);
861
+ }
862
+ function Qt(e, t, n, r) {
863
+ const s = je(t);
864
+ if (s === null || !be(s.downloadTokens))
865
+ return null;
866
+ const i = s.downloadTokens;
867
+ if (i.length === 0)
868
+ return null;
869
+ const a = encodeURIComponent;
870
+ return i.split(",").map((m) => {
871
+ const T = e.bucket, b = e.fullPath, O = "/b/" + a(T) + "/o/" + a(b), E = le(O, n, r), v = Me({
872
+ alt: "media",
873
+ token: m
874
+ });
875
+ return E + v;
876
+ })[0];
877
+ }
878
+ function en(e, t) {
879
+ const n = {}, r = t.length;
880
+ for (let s = 0; s < r; s++) {
881
+ const i = t[s];
882
+ i.writable && (n[i.server] = e[i.local]);
883
+ }
884
+ return JSON.stringify(n);
885
+ }
886
+ class Te {
887
+ constructor(t, n, r, s) {
888
+ this.url = t, 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 = [];
889
+ }
890
+ }
891
+ /**
892
+ * @license
893
+ * Copyright 2017 Google LLC
894
+ *
895
+ * Licensed under the Apache License, Version 2.0 (the "License");
896
+ * you may not use this file except in compliance with the License.
897
+ * You may obtain a copy of the License at
898
+ *
899
+ * http://www.apache.org/licenses/LICENSE-2.0
900
+ *
901
+ * Unless required by applicable law or agreed to in writing, software
902
+ * distributed under the License is distributed on an "AS IS" BASIS,
903
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
904
+ * See the License for the specific language governing permissions and
905
+ * limitations under the License.
906
+ */
907
+ function Ye(e) {
908
+ if (!e)
909
+ throw ge();
910
+ }
911
+ function tn(e, t) {
912
+ function n(r, s) {
913
+ const i = Ve(e, s, t);
914
+ return Ye(i !== null), i;
915
+ }
916
+ return n;
917
+ }
918
+ function nn(e, t) {
919
+ function n(r, s) {
920
+ const i = Ve(e, s, t);
921
+ return Ye(i !== null), Qt(i, s, e.host, e._protocol);
922
+ }
923
+ return n;
924
+ }
925
+ function qe(e) {
926
+ function t(n, r) {
927
+ let s;
928
+ 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 = _t() : s = pt() : n.getStatus() === 402 ? s = ft(e.bucket) : n.getStatus() === 403 ? s = mt(e.path) : s = r, s.status = n.getStatus(), s.serverResponse = r.serverResponse, s;
929
+ }
930
+ return t;
931
+ }
932
+ function ze(e) {
933
+ const t = qe(e);
934
+ function n(r, s) {
935
+ let i = t(r, s);
936
+ return r.getStatus() === 404 && (i = dt(e.path)), i.serverResponse = s.serverResponse, i;
937
+ }
938
+ return n;
939
+ }
940
+ function rn(e, t, n) {
941
+ const r = t.fullServerUrl(), s = le(r, e.host, e._protocol), i = "GET", a = e.maxOperationRetryTime, h = new Te(s, i, nn(e, n), a);
942
+ return h.errorHandler = ze(t), h;
943
+ }
944
+ function sn(e, t) {
945
+ const n = t.fullServerUrl(), r = le(n, e.host, e._protocol), s = "DELETE", i = e.maxOperationRetryTime;
946
+ function a(f, m) {
947
+ }
948
+ const h = new Te(r, s, a, i);
949
+ return h.successCodes = [200, 204], h.errorHandler = ze(t), h;
950
+ }
951
+ function on(e, t) {
952
+ return e && e.contentType || t && t.type() || "application/octet-stream";
953
+ }
954
+ function an(e, t, n) {
955
+ const r = Object.assign({}, n);
956
+ return r.fullPath = e.path, r.size = t.size(), r.contentType || (r.contentType = on(null, t)), r;
957
+ }
958
+ function un(e, t, n, r, s) {
959
+ const i = t.bucketOnlyServerUrl(), a = {
960
+ "X-Goog-Upload-Protocol": "multipart"
961
+ };
962
+ function h() {
963
+ let D = "";
964
+ for (let $ = 0; $ < 2; $++)
965
+ D = D + Math.random().toString().slice(2);
966
+ return D;
967
+ }
968
+ const f = h();
969
+ a["Content-Type"] = "multipart/related; boundary=" + f;
970
+ const m = an(t, r, s), T = en(m, n), b = "--" + f + `\r
971
+ Content-Type: application/json; charset=utf-8\r
972
+ \r
973
+ ` + T + `\r
974
+ --` + f + `\r
975
+ Content-Type: ` + m.contentType + `\r
976
+ \r
977
+ `, O = `\r
978
+ --` + f + "--", E = V.getBlob(b, r, O);
979
+ if (E === null)
980
+ throw yt();
981
+ const v = { name: m.fullPath }, F = le(i, e.host, e._protocol), U = "POST", H = e.maxUploadRetryTime, j = new Te(F, U, tn(e, n), H);
982
+ return j.urlParams = v, j.headers = a, j.body = E.uploadData(), j.errorHandler = qe(t), j;
983
+ }
984
+ class cn {
985
+ constructor() {
986
+ this.sent_ = !1, this.xhr_ = new XMLHttpRequest(), this.initXhr(), this.errorCode_ = G.NO_ERROR, this.sendPromise_ = new Promise((t) => {
987
+ this.xhr_.addEventListener("abort", () => {
988
+ this.errorCode_ = G.ABORT, t();
989
+ }), this.xhr_.addEventListener("error", () => {
990
+ this.errorCode_ = G.NETWORK_ERROR, t();
991
+ }), this.xhr_.addEventListener("load", () => {
992
+ t();
993
+ });
994
+ });
995
+ }
996
+ send(t, n, r, s) {
997
+ if (this.sent_)
998
+ throw ee("cannot .send() more than once");
999
+ if (this.sent_ = !0, this.xhr_.open(n, t, !0), s !== void 0)
1000
+ for (const i in s)
1001
+ s.hasOwnProperty(i) && this.xhr_.setRequestHeader(i, s[i].toString());
1002
+ return r !== void 0 ? this.xhr_.send(r) : this.xhr_.send(), this.sendPromise_;
1003
+ }
1004
+ getErrorCode() {
1005
+ if (!this.sent_)
1006
+ throw ee("cannot .getErrorCode() before sending");
1007
+ return this.errorCode_;
1008
+ }
1009
+ getStatus() {
1010
+ if (!this.sent_)
1011
+ throw ee("cannot .getStatus() before sending");
1012
+ try {
1013
+ return this.xhr_.status;
1014
+ } catch {
1015
+ return -1;
1016
+ }
1017
+ }
1018
+ getResponse() {
1019
+ if (!this.sent_)
1020
+ throw ee("cannot .getResponse() before sending");
1021
+ return this.xhr_.response;
1022
+ }
1023
+ getErrorText() {
1024
+ if (!this.sent_)
1025
+ throw ee("cannot .getErrorText() before sending");
1026
+ return this.xhr_.statusText;
1027
+ }
1028
+ /** Aborts the request. */
1029
+ abort() {
1030
+ this.xhr_.abort();
1031
+ }
1032
+ getResponseHeader(t) {
1033
+ return this.xhr_.getResponseHeader(t);
1034
+ }
1035
+ addUploadProgressListener(t) {
1036
+ this.xhr_.upload != null && this.xhr_.upload.addEventListener("progress", t);
1037
+ }
1038
+ removeUploadProgressListener(t) {
1039
+ this.xhr_.upload != null && this.xhr_.upload.removeEventListener("progress", t);
1040
+ }
1041
+ }
1042
+ class ln extends cn {
1043
+ initXhr() {
1044
+ this.xhr_.responseType = "text";
1045
+ }
1046
+ }
1047
+ function Re() {
1048
+ return new ln();
1049
+ }
1050
+ /**
1051
+ * @license
1052
+ * Copyright 2019 Google LLC
1053
+ *
1054
+ * Licensed under the Apache License, Version 2.0 (the "License");
1055
+ * you may not use this file except in compliance with the License.
1056
+ * You may obtain a copy of the License at
1057
+ *
1058
+ * http://www.apache.org/licenses/LICENSE-2.0
1059
+ *
1060
+ * Unless required by applicable law or agreed to in writing, software
1061
+ * distributed under the License is distributed on an "AS IS" BASIS,
1062
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1063
+ * See the License for the specific language governing permissions and
1064
+ * limitations under the License.
1065
+ */
1066
+ class K {
1067
+ constructor(t, n) {
1068
+ this._service = t, n instanceof x ? this._location = n : this._location = x.makeFromUrl(n, t.host);
1069
+ }
1070
+ /**
1071
+ * Returns the URL for the bucket and path this object references,
1072
+ * in the form gs://<bucket>/<object-path>
1073
+ * @override
1074
+ */
1075
+ toString() {
1076
+ return "gs://" + this._location.bucket + "/" + this._location.path;
1077
+ }
1078
+ _newRef(t, n) {
1079
+ return new K(t, n);
1080
+ }
1081
+ /**
1082
+ * A reference to the root of this object's bucket.
1083
+ */
1084
+ get root() {
1085
+ const t = new x(this._location.bucket, "");
1086
+ return this._newRef(this._service, t);
1087
+ }
1088
+ /**
1089
+ * The name of the bucket containing this reference's object.
1090
+ */
1091
+ get bucket() {
1092
+ return this._location.bucket;
1093
+ }
1094
+ /**
1095
+ * The full path of this object.
1096
+ */
1097
+ get fullPath() {
1098
+ return this._location.path;
1099
+ }
1100
+ /**
1101
+ * The short name of this object, which is the last component of the full path.
1102
+ * For example, if fullPath is 'full/path/image.png', name is 'image.png'.
1103
+ */
1104
+ get name() {
1105
+ return He(this._location.path);
1106
+ }
1107
+ /**
1108
+ * The `StorageService` instance this `StorageReference` is associated with.
1109
+ */
1110
+ get storage() {
1111
+ return this._service;
1112
+ }
1113
+ /**
1114
+ * A `StorageReference` pointing to the parent location of this `StorageReference`, or null if
1115
+ * this reference is the root.
1116
+ */
1117
+ get parent() {
1118
+ const t = zt(this._location.path);
1119
+ if (t === null)
1120
+ return null;
1121
+ const n = new x(this._location.bucket, t);
1122
+ return new K(this._service, n);
1123
+ }
1124
+ /**
1125
+ * Utility function to throw an error in methods that do not accept a root reference.
1126
+ */
1127
+ _throwIfRoot(t) {
1128
+ if (this._location.path === "")
1129
+ throw Et(t);
1130
+ }
1131
+ }
1132
+ function hn(e, t, n) {
1133
+ e._throwIfRoot("uploadBytes");
1134
+ const r = un(e.storage, e._location, We(), new V(t, !0), n);
1135
+ return e.storage.makeRequestWithTokens(r, Re).then((s) => ({
1136
+ metadata: s,
1137
+ ref: e
1138
+ }));
1139
+ }
1140
+ function dn(e) {
1141
+ e._throwIfRoot("getDownloadURL");
1142
+ const t = rn(e.storage, e._location, We());
1143
+ return e.storage.makeRequestWithTokens(t, Re).then((n) => {
1144
+ if (n === null)
1145
+ throw kt();
1146
+ return n;
1147
+ });
1148
+ }
1149
+ function fn(e) {
1150
+ e._throwIfRoot("deleteObject");
1151
+ const t = sn(e.storage, e._location);
1152
+ return e.storage.makeRequestWithTokens(t, Re);
1153
+ }
1154
+ function pn(e, t) {
1155
+ const n = Xt(e._location.path, t), r = new x(e._location.bucket, n);
1156
+ return new K(e.storage, r);
1157
+ }
1158
+ /**
1159
+ * @license
1160
+ * Copyright 2017 Google LLC
1161
+ *
1162
+ * Licensed under the Apache License, Version 2.0 (the "License");
1163
+ * you may not use this file except in compliance with the License.
1164
+ * You may obtain a copy of the License at
1165
+ *
1166
+ * http://www.apache.org/licenses/LICENSE-2.0
1167
+ *
1168
+ * Unless required by applicable law or agreed to in writing, software
1169
+ * distributed under the License is distributed on an "AS IS" BASIS,
1170
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1171
+ * See the License for the specific language governing permissions and
1172
+ * limitations under the License.
1173
+ */
1174
+ function _n(e) {
1175
+ return /^[A-Za-z]+:\/\//.test(e);
1176
+ }
1177
+ function mn(e, t) {
1178
+ return new K(e, t);
1179
+ }
1180
+ function Xe(e, t) {
1181
+ if (e instanceof ye) {
1182
+ const n = e;
1183
+ if (n._bucket == null)
1184
+ throw Rt();
1185
+ const r = new K(n, n._bucket);
1186
+ return t != null ? Xe(r, t) : r;
1187
+ } else
1188
+ return t !== void 0 ? pn(e, t) : e;
1189
+ }
1190
+ function gn(e, t) {
1191
+ if (t && _n(t)) {
1192
+ if (e instanceof ye)
1193
+ return mn(e, t);
1194
+ throw me("To use ref(service, url), the first argument must be a Storage instance.");
1195
+ } else
1196
+ return Xe(e, t);
1197
+ }
1198
+ function Ae(e, t) {
1199
+ const n = t == null ? void 0 : t[xe];
1200
+ return n == null ? null : x.makeFromBucketSpec(n, e);
1201
+ }
1202
+ function bn(e, t, n, r = {}) {
1203
+ e.host = `${t}:${n}`, e._protocol = "http";
1204
+ const { mockUserToken: s } = r;
1205
+ s && (e._overrideAuthToken = typeof s == "string" ? s : st(s, e.app.options.projectId));
1206
+ }
1207
+ class ye {
1208
+ constructor(t, n, r, s, i) {
1209
+ this.app = t, this._authProvider = n, this._appCheckProvider = r, this._url = s, this._firebaseVersion = i, this._bucket = null, this._host = Pe, this._protocol = "https", this._appId = null, this._deleted = !1, this._maxOperationRetryTime = lt, this._maxUploadRetryTime = ht, this._requests = /* @__PURE__ */ new Set(), s != null ? this._bucket = x.makeFromBucketSpec(s, this._host) : this._bucket = Ae(this._host, this.app.options);
1210
+ }
1211
+ /**
1212
+ * The host string for this service, in the form of `host` or
1213
+ * `host:port`.
1214
+ */
1215
+ get host() {
1216
+ return this._host;
1217
+ }
1218
+ set host(t) {
1219
+ this._host = t, this._url != null ? this._bucket = x.makeFromBucketSpec(this._url, t) : this._bucket = Ae(t, this.app.options);
1220
+ }
1221
+ /**
1222
+ * The maximum time to retry uploads in milliseconds.
1223
+ */
1224
+ get maxUploadRetryTime() {
1225
+ return this._maxUploadRetryTime;
1226
+ }
1227
+ set maxUploadRetryTime(t) {
1228
+ Se(
1229
+ "time",
1230
+ /* minValue=*/
1231
+ 0,
1232
+ /* maxValue= */
1233
+ Number.POSITIVE_INFINITY,
1234
+ t
1235
+ ), this._maxUploadRetryTime = t;
1236
+ }
1237
+ /**
1238
+ * The maximum time to retry operations other than uploads or downloads in
1239
+ * milliseconds.
1240
+ */
1241
+ get maxOperationRetryTime() {
1242
+ return this._maxOperationRetryTime;
1243
+ }
1244
+ set maxOperationRetryTime(t) {
1245
+ Se(
1246
+ "time",
1247
+ /* minValue=*/
1248
+ 0,
1249
+ /* maxValue= */
1250
+ Number.POSITIVE_INFINITY,
1251
+ t
1252
+ ), this._maxOperationRetryTime = t;
1253
+ }
1254
+ async _getAuthToken() {
1255
+ if (this._overrideAuthToken)
1256
+ return this._overrideAuthToken;
1257
+ const t = this._authProvider.getImmediate({ optional: !0 });
1258
+ if (t) {
1259
+ const n = await t.getToken();
1260
+ if (n !== null)
1261
+ return n.accessToken;
1262
+ }
1263
+ return null;
1264
+ }
1265
+ async _getAppCheckToken() {
1266
+ const t = this._appCheckProvider.getImmediate({ optional: !0 });
1267
+ return t ? (await t.getToken()).token : null;
1268
+ }
1269
+ /**
1270
+ * Stop running requests and prevent more from being created.
1271
+ */
1272
+ _delete() {
1273
+ return this._deleted || (this._deleted = !0, this._requests.forEach((t) => t.cancel()), this._requests.clear()), Promise.resolve();
1274
+ }
1275
+ /**
1276
+ * Returns a new firebaseStorage.Reference object referencing this StorageService
1277
+ * at the given Location.
1278
+ */
1279
+ _makeStorageReference(t) {
1280
+ return new K(this, t);
1281
+ }
1282
+ /**
1283
+ * @param requestInfo - HTTP RequestInfo object
1284
+ * @param authToken - Firebase auth token
1285
+ */
1286
+ _makeRequest(t, n, r, s, i = !0) {
1287
+ if (this._deleted)
1288
+ return new St(Ce());
1289
+ {
1290
+ const a = Mt(t, this._appId, r, s, n, this._firebaseVersion, i);
1291
+ return this._requests.add(a), a.getPromise().then(() => this._requests.delete(a), () => this._requests.delete(a)), a;
1292
+ }
1293
+ }
1294
+ async makeRequestWithTokens(t, n) {
1295
+ const [r, s] = await Promise.all([
1296
+ this._getAuthToken(),
1297
+ this._getAppCheckToken()
1298
+ ]);
1299
+ return this._makeRequest(t, n, r, s).getPromise();
1300
+ }
1301
+ }
1302
+ const ve = "@firebase/storage", Ue = "0.13.2";
1303
+ /**
1304
+ * @license
1305
+ * Copyright 2020 Google LLC
1306
+ *
1307
+ * Licensed under the Apache License, Version 2.0 (the "License");
1308
+ * you may not use this file except in compliance with the License.
1309
+ * You may obtain a copy of the License at
1310
+ *
1311
+ * http://www.apache.org/licenses/LICENSE-2.0
1312
+ *
1313
+ * Unless required by applicable law or agreed to in writing, software
1314
+ * distributed under the License is distributed on an "AS IS" BASIS,
1315
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1316
+ * See the License for the specific language governing permissions and
1317
+ * limitations under the License.
1318
+ */
1319
+ const Ge = "storage";
1320
+ function wn(e, t, n) {
1321
+ return e = re(e), hn(e, t, n);
1322
+ }
1323
+ function Tn(e) {
1324
+ return e = re(e), dn(e);
1325
+ }
1326
+ function Rn(e) {
1327
+ return e = re(e), fn(e);
1328
+ }
1329
+ function $e(e, t) {
1330
+ return e = re(e), gn(e, t);
1331
+ }
1332
+ function Ne(e = _e(), t) {
1333
+ e = re(e);
1334
+ const r = nt(e, Ge).getImmediate({
1335
+ identifier: t
1336
+ }), s = rt("storage");
1337
+ return s && yn(r, ...s), r;
1338
+ }
1339
+ function yn(e, t, n, r = {}) {
1340
+ bn(e, t, n, r);
1341
+ }
1342
+ function kn(e, { instanceIdentifier: t }) {
1343
+ const n = e.getProvider("app").getImmediate(), r = e.getProvider("auth-internal"), s = e.getProvider("app-check-internal");
1344
+ return new ye(n, r, s, t, tt);
1345
+ }
1346
+ function On() {
1347
+ Qe(new et(
1348
+ Ge,
1349
+ kn,
1350
+ "PUBLIC"
1351
+ /* ComponentType.PUBLIC */
1352
+ ).setMultipleInstances(!0)), Oe(ve, Ue, ""), Oe(ve, Ue, "esm2017");
1353
+ }
1354
+ On();
1355
+ const ne = {
1356
+ async update(e, t, n) {
1357
+ const r = Ne(_e(), n), s = $e(r, e);
1358
+ return await wn(s, t), Tn(s);
1359
+ },
1360
+ async delete(e, t) {
1361
+ const n = Ne(_e(), t), r = $e(n, e);
1362
+ await Rn(r);
1363
+ }
1364
+ };
1365
+ var Ke = { exports: {} };
1366
+ (function(e, t) {
1367
+ (function(n, r) {
1368
+ e.exports = r();
1369
+ })(at, function() {
1370
+ var n = 1e3, r = 6e4, s = 36e5, i = "millisecond", a = "second", h = "minute", f = "hour", m = "day", T = "week", b = "month", O = "quarter", E = "year", v = "date", F = "Invalid Date", U = /^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/, H = /\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g, j = { name: "en", weekdays: "Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday".split("_"), months: "January_February_March_April_May_June_July_August_September_October_November_December".split("_"), ordinal: function(d) {
1371
+ var c = ["th", "st", "nd", "rd"], o = d % 100;
1372
+ return "[" + d + (c[(o - 20) % 10] || c[o] || c[0]) + "]";
1373
+ } }, D = function(d, c, o) {
1374
+ var l = String(d);
1375
+ return !l || l.length >= c ? d : "" + Array(c + 1 - l.length).join(o) + d;
1376
+ }, $ = { s: D, z: function(d) {
1377
+ var c = -d.utcOffset(), o = Math.abs(c), l = Math.floor(o / 60), u = o % 60;
1378
+ return (c <= 0 ? "+" : "-") + D(l, 2, "0") + ":" + D(u, 2, "0");
1379
+ }, m: function d(c, o) {
1380
+ if (c.date() < o.date()) return -d(o, c);
1381
+ var l = 12 * (o.year() - c.year()) + (o.month() - c.month()), u = c.clone().add(l, b), p = o - u < 0, _ = c.clone().add(l + (p ? -1 : 1), b);
1382
+ return +(-(l + (o - u) / (p ? u - _ : _ - u)) || 0);
1383
+ }, a: function(d) {
1384
+ return d < 0 ? Math.ceil(d) || 0 : Math.floor(d);
1385
+ }, p: function(d) {
1386
+ return { M: b, y: E, w: T, d: m, D: v, h: f, m: h, s: a, ms: i, Q: O }[d] || String(d || "").toLowerCase().replace(/s$/, "");
1387
+ }, u: function(d) {
1388
+ return d === void 0;
1389
+ } }, L = "en", M = {};
1390
+ M[L] = j;
1391
+ var se = "$isDayjsObject", q = function(d) {
1392
+ return d instanceof oe || !(!d || !d[se]);
1393
+ }, ie = function d(c, o, l) {
1394
+ var u;
1395
+ if (!c) return L;
1396
+ if (typeof c == "string") {
1397
+ var p = c.toLowerCase();
1398
+ M[p] && (u = p), o && (M[p] = o, u = p);
1399
+ var _ = c.split("-");
1400
+ if (!u && _.length > 1) return d(_[0]);
1401
+ } else {
1402
+ var w = c.name;
1403
+ M[w] = c, u = w;
1404
+ }
1405
+ return !l && u && (L = u), u || !l && L;
1406
+ }, S = function(d, c) {
1407
+ if (q(d)) return d.clone();
1408
+ var o = typeof c == "object" ? c : {};
1409
+ return o.date = d, o.args = arguments, new oe(o);
1410
+ }, g = $;
1411
+ g.l = ie, g.i = q, g.w = function(d, c) {
1412
+ return S(d, { locale: c.$L, utc: c.$u, x: c.$x, $offset: c.$offset });
1413
+ };
1414
+ var oe = function() {
1415
+ function d(o) {
1416
+ this.$L = ie(o.locale, null, !0), this.parse(o), this.$x = this.$x || o.x || {}, this[se] = !0;
1417
+ }
1418
+ var c = d.prototype;
1419
+ return c.parse = function(o) {
1420
+ this.$d = function(l) {
1421
+ var u = l.date, p = l.utc;
1422
+ if (u === null) return /* @__PURE__ */ new Date(NaN);
1423
+ if (g.u(u)) return /* @__PURE__ */ new Date();
1424
+ if (u instanceof Date) return new Date(u);
1425
+ if (typeof u == "string" && !/Z$/i.test(u)) {
1426
+ var _ = u.match(U);
1427
+ if (_) {
1428
+ var w = _[2] - 1 || 0, k = (_[7] || "0").substring(0, 3);
1429
+ return p ? new Date(Date.UTC(_[1], w, _[3] || 1, _[4] || 0, _[5] || 0, _[6] || 0, k)) : new Date(_[1], w, _[3] || 1, _[4] || 0, _[5] || 0, _[6] || 0, k);
1430
+ }
1431
+ }
1432
+ return new Date(u);
1433
+ }(o), this.init();
1434
+ }, c.init = function() {
1435
+ var o = this.$d;
1436
+ this.$y = o.getFullYear(), this.$M = o.getMonth(), this.$D = o.getDate(), this.$W = o.getDay(), this.$H = o.getHours(), this.$m = o.getMinutes(), this.$s = o.getSeconds(), this.$ms = o.getMilliseconds();
1437
+ }, c.$utils = function() {
1438
+ return g;
1439
+ }, c.isValid = function() {
1440
+ return this.$d.toString() !== F;
1441
+ }, c.isSame = function(o, l) {
1442
+ var u = S(o);
1443
+ return this.startOf(l) <= u && u <= this.endOf(l);
1444
+ }, c.isAfter = function(o, l) {
1445
+ return S(o) < this.startOf(l);
1446
+ }, c.isBefore = function(o, l) {
1447
+ return this.endOf(l) < S(o);
1448
+ }, c.$g = function(o, l, u) {
1449
+ return g.u(o) ? this[l] : this.set(u, o);
1450
+ }, c.unix = function() {
1451
+ return Math.floor(this.valueOf() / 1e3);
1452
+ }, c.valueOf = function() {
1453
+ return this.$d.getTime();
1454
+ }, c.startOf = function(o, l) {
1455
+ var u = this, p = !!g.u(l) || l, _ = g.p(o), w = function(X, P) {
1456
+ var W = g.w(u.$u ? Date.UTC(u.$y, P, X) : new Date(u.$y, P, X), u);
1457
+ return p ? W : W.endOf(m);
1458
+ }, k = function(X, P) {
1459
+ return g.w(u.toDate()[X].apply(u.toDate("s"), (p ? [0, 0, 0, 0] : [23, 59, 59, 999]).slice(P)), u);
1460
+ }, A = this.$W, N = this.$M, C = this.$D, Z = "set" + (this.$u ? "UTC" : "");
1461
+ switch (_) {
1462
+ case E:
1463
+ return p ? w(1, 0) : w(31, 11);
1464
+ case b:
1465
+ return p ? w(1, N) : w(0, N + 1);
1466
+ case T:
1467
+ var z = this.$locale().weekStart || 0, J = (A < z ? A + 7 : A) - z;
1468
+ return w(p ? C - J : C + (6 - J), N);
1469
+ case m:
1470
+ case v:
1471
+ return k(Z + "Hours", 0);
1472
+ case f:
1473
+ return k(Z + "Minutes", 1);
1474
+ case h:
1475
+ return k(Z + "Seconds", 2);
1476
+ case a:
1477
+ return k(Z + "Milliseconds", 3);
1478
+ default:
1479
+ return this.clone();
1480
+ }
1481
+ }, c.endOf = function(o) {
1482
+ return this.startOf(o, !1);
1483
+ }, c.$set = function(o, l) {
1484
+ var u, p = g.p(o), _ = "set" + (this.$u ? "UTC" : ""), w = (u = {}, u[m] = _ + "Date", u[v] = _ + "Date", u[b] = _ + "Month", u[E] = _ + "FullYear", u[f] = _ + "Hours", u[h] = _ + "Minutes", u[a] = _ + "Seconds", u[i] = _ + "Milliseconds", u)[p], k = p === m ? this.$D + (l - this.$W) : l;
1485
+ if (p === b || p === E) {
1486
+ var A = this.clone().set(v, 1);
1487
+ A.$d[w](k), A.init(), this.$d = A.set(v, Math.min(this.$D, A.daysInMonth())).$d;
1488
+ } else w && this.$d[w](k);
1489
+ return this.init(), this;
1490
+ }, c.set = function(o, l) {
1491
+ return this.clone().$set(o, l);
1492
+ }, c.get = function(o) {
1493
+ return this[g.p(o)]();
1494
+ }, c.add = function(o, l) {
1495
+ var u, p = this;
1496
+ o = Number(o);
1497
+ var _ = g.p(l), w = function(N) {
1498
+ var C = S(p);
1499
+ return g.w(C.date(C.date() + Math.round(N * o)), p);
1500
+ };
1501
+ if (_ === b) return this.set(b, this.$M + o);
1502
+ if (_ === E) return this.set(E, this.$y + o);
1503
+ if (_ === m) return w(1);
1504
+ if (_ === T) return w(7);
1505
+ var k = (u = {}, u[h] = r, u[f] = s, u[a] = n, u)[_] || 1, A = this.$d.getTime() + o * k;
1506
+ return g.w(A, this);
1507
+ }, c.subtract = function(o, l) {
1508
+ return this.add(-1 * o, l);
1509
+ }, c.format = function(o) {
1510
+ var l = this, u = this.$locale();
1511
+ if (!this.isValid()) return u.invalidDate || F;
1512
+ var p = o || "YYYY-MM-DDTHH:mm:ssZ", _ = g.z(this), w = this.$H, k = this.$m, A = this.$M, N = u.weekdays, C = u.months, Z = u.meridiem, z = function(P, W, Q, ae) {
1513
+ return P && (P[W] || P(l, p)) || Q[W].slice(0, ae);
1514
+ }, J = function(P) {
1515
+ return g.s(w % 12 || 12, P, "0");
1516
+ }, X = Z || function(P, W, Q) {
1517
+ var ae = P < 12 ? "AM" : "PM";
1518
+ return Q ? ae.toLowerCase() : ae;
1519
+ };
1520
+ return p.replace(H, function(P, W) {
1521
+ return W || function(Q) {
1522
+ switch (Q) {
1523
+ case "YY":
1524
+ return String(l.$y).slice(-2);
1525
+ case "YYYY":
1526
+ return g.s(l.$y, 4, "0");
1527
+ case "M":
1528
+ return A + 1;
1529
+ case "MM":
1530
+ return g.s(A + 1, 2, "0");
1531
+ case "MMM":
1532
+ return z(u.monthsShort, A, C, 3);
1533
+ case "MMMM":
1534
+ return z(C, A);
1535
+ case "D":
1536
+ return l.$D;
1537
+ case "DD":
1538
+ return g.s(l.$D, 2, "0");
1539
+ case "d":
1540
+ return String(l.$W);
1541
+ case "dd":
1542
+ return z(u.weekdaysMin, l.$W, N, 2);
1543
+ case "ddd":
1544
+ return z(u.weekdaysShort, l.$W, N, 3);
1545
+ case "dddd":
1546
+ return N[l.$W];
1547
+ case "H":
1548
+ return String(w);
1549
+ case "HH":
1550
+ return g.s(w, 2, "0");
1551
+ case "h":
1552
+ return J(1);
1553
+ case "hh":
1554
+ return J(2);
1555
+ case "a":
1556
+ return X(w, k, !0);
1557
+ case "A":
1558
+ return X(w, k, !1);
1559
+ case "m":
1560
+ return String(k);
1561
+ case "mm":
1562
+ return g.s(k, 2, "0");
1563
+ case "s":
1564
+ return String(l.$s);
1565
+ case "ss":
1566
+ return g.s(l.$s, 2, "0");
1567
+ case "SSS":
1568
+ return g.s(l.$ms, 3, "0");
1569
+ case "Z":
1570
+ return _;
1571
+ }
1572
+ return null;
1573
+ }(P) || _.replace(":", "");
1574
+ });
1575
+ }, c.utcOffset = function() {
1576
+ return 15 * -Math.round(this.$d.getTimezoneOffset() / 15);
1577
+ }, c.diff = function(o, l, u) {
1578
+ var p, _ = this, w = g.p(l), k = S(o), A = (k.utcOffset() - this.utcOffset()) * r, N = this - k, C = function() {
1579
+ return g.m(_, k);
1580
+ };
1581
+ switch (w) {
1582
+ case E:
1583
+ p = C() / 12;
1584
+ break;
1585
+ case b:
1586
+ p = C();
1587
+ break;
1588
+ case O:
1589
+ p = C() / 3;
1590
+ break;
1591
+ case T:
1592
+ p = (N - A) / 6048e5;
1593
+ break;
1594
+ case m:
1595
+ p = (N - A) / 864e5;
1596
+ break;
1597
+ case f:
1598
+ p = N / s;
1599
+ break;
1600
+ case h:
1601
+ p = N / r;
1602
+ break;
1603
+ case a:
1604
+ p = N / n;
1605
+ break;
1606
+ default:
1607
+ p = N;
1608
+ }
1609
+ return u ? p : g.a(p);
1610
+ }, c.daysInMonth = function() {
1611
+ return this.endOf(b).$D;
1612
+ }, c.$locale = function() {
1613
+ return M[this.$L];
1614
+ }, c.locale = function(o, l) {
1615
+ if (!o) return this.$L;
1616
+ var u = this.clone(), p = ie(o, l, !0);
1617
+ return p && (u.$L = p), u;
1618
+ }, c.clone = function() {
1619
+ return g.w(this.$d, this);
1620
+ }, c.toDate = function() {
1621
+ return new Date(this.valueOf());
1622
+ }, c.toJSON = function() {
1623
+ return this.isValid() ? this.toISOString() : null;
1624
+ }, c.toISOString = function() {
1625
+ return this.$d.toISOString();
1626
+ }, c.toString = function() {
1627
+ return this.$d.toUTCString();
1628
+ }, d;
1629
+ }(), ke = oe.prototype;
1630
+ return S.prototype = ke, [["$ms", i], ["$s", a], ["$m", h], ["$H", f], ["$W", m], ["$M", b], ["$y", E], ["$D", v]].forEach(function(d) {
1631
+ ke[d[1]] = function(c) {
1632
+ return this.$g(c, d[0], d[1]);
1633
+ };
1634
+ }), S.extend = function(d, c) {
1635
+ return d.$i || (d(c, oe, S), d.$i = !0), S;
1636
+ }, S.locale = ie, S.isDayjs = q, S.unix = function(d) {
1637
+ return S(1e3 * d);
1638
+ }, S.en = M[L], S.Ls = M, S.p = {}, S;
1639
+ });
1640
+ })(Ke);
1641
+ var En = Ke.exports;
1642
+ const Sn = /* @__PURE__ */ ut(En);
1643
+ function An(e) {
1644
+ return e.toLowerCase();
1645
+ }
1646
+ var vn = [/([a-z0-9])([A-Z])/g, /([A-Z])([A-Z][a-z])/g], Un = /[^A-Z0-9]+/gi;
1647
+ function $n(e, t) {
1648
+ t === void 0 && (t = {});
1649
+ for (var n = t.splitRegexp, r = n === void 0 ? vn : n, s = t.stripRegexp, i = s === void 0 ? Un : s, a = t.transform, h = a === void 0 ? An : a, f = t.delimiter, m = f === void 0 ? " " : f, T = Ie(Ie(e, r, "$1\0$2"), i, "\0"), b = 0, O = T.length; T.charAt(b) === "\0"; )
1650
+ b++;
1651
+ for (; T.charAt(O - 1) === "\0"; )
1652
+ O--;
1653
+ return T.slice(b, O).split("\0").map(h).join(m);
1654
+ }
1655
+ function Ie(e, t, n) {
1656
+ return t instanceof RegExp ? e.replace(t, n) : t.reduce(function(r, s) {
1657
+ return r.replace(s, n);
1658
+ }, e);
1659
+ }
1660
+ function Nn(e) {
1661
+ return e.charAt(0).toUpperCase() + e.substr(1);
1662
+ }
1663
+ function In(e, t) {
1664
+ var n = e.toLowerCase();
1665
+ return t === 0 ? Nn(n) : n;
1666
+ }
1667
+ function he(e, t) {
1668
+ return t === void 0 && (t = {}), $n(e, ot({ delimiter: " ", transform: In }, t));
1669
+ }
1670
+ function Dn(e, t = []) {
1671
+ const n = JSON.parse(JSON.stringify(e));
1672
+ return t.length > 0 && t.forEach((r) => {
1673
+ n[r] !== void 0 && delete n[r];
1674
+ }), n;
1675
+ }
1676
+ function Pn(e, t) {
1677
+ var r, s, i, a;
1678
+ const n = t ? Dn(t) : void 0;
1679
+ return {
1680
+ _id: (n == null ? void 0 : n._id) ?? "",
1681
+ notifyUrl: (n == null ? void 0 : n.notifyUrl) ?? "",
1682
+ store: {
1683
+ id: (n == null ? void 0 : n.store.id) ?? "",
1684
+ event: (n == null ? void 0 : n.store.event) ?? Y.F_PAYOUT_FOR.Enum.ORDERING,
1685
+ bank: {
1686
+ name: ((r = n == null ? void 0 : n.store.bank) == null ? void 0 : r.name) ?? Ze[0].value,
1687
+ type: ((s = n == null ? void 0 : n.store.bank) == null ? void 0 : s.type) ?? Je[0].value,
1688
+ holderName: ((i = n == null ? void 0 : n.store.bank) == null ? void 0 : i.holderName) ?? "",
1689
+ accountNumber: ((a = n == null ? void 0 : n.store.bank) == null ? void 0 : a.accountNumber) ?? ""
1690
+ },
1691
+ keyPerson: (n == null ? void 0 : n.store.keyPerson) ?? {
1692
+ name: "",
1693
+ phone: "",
1694
+ email: ""
1695
+ },
1696
+ ssm: (n == null ? void 0 : n.store.ssm) ?? "",
1697
+ bankStatement: (n == null ? void 0 : n.store.bankStatement) ?? "",
1698
+ exteriorPhoto: (n == null ? void 0 : n.store.exteriorPhoto) ?? ""
1699
+ },
1700
+ enable: (n == null ? void 0 : n.enable) ?? !1,
1701
+ methods: (n == null ? void 0 : n.methods) ?? [],
1702
+ status: (n == null ? void 0 : n.status) ?? Y.F_PAYOUT_ACCOUNT_STATUS.Enum.NEW,
1703
+ businessId: e
1704
+ };
1705
+ }
1706
+ function xn(e) {
1707
+ return e.reduce(
1708
+ (t, n) => ([Y.F_PAYOUT_ACCOUNT_STATUS.Enum.NEW].some((r) => r == n.status) ? t.NEW.push({
1709
+ ...n
1710
+ }) : t.EXISTED.push({
1711
+ ...n
1712
+ }), t),
1713
+ {
1714
+ NEW: [],
1715
+ EXISTED: []
1716
+ }
1717
+ );
1718
+ }
1719
+ async function pe(e) {
1720
+ await ne.delete(e);
1721
+ }
1722
+ async function De(e, t, n) {
1723
+ const r = Sn().toISOString();
1724
+ if (e.restaurantId)
1725
+ return await ne.update(
1726
+ `restaurant/${e.restaurantId}/documents/${t}/${r}.pdf`,
1727
+ n
1728
+ );
1729
+ if (e.businessId)
1730
+ return await ne.update(
1731
+ `business/${e.businessId}/documents/${t}/${r}.pdf`,
1732
+ n
1733
+ );
1734
+ throw "Not implemented";
1735
+ }
1736
+ async function Cn(e, t) {
1737
+ if (e.restaurantId)
1738
+ return await ne.update(
1739
+ `restaurant/${e.restaurantId}/exterior/photo`,
1740
+ t
1741
+ );
1742
+ if (e.businessId)
1743
+ return await ne.update(
1744
+ `business/${e.businessId}/exterior/photo`,
1745
+ t
1746
+ );
1747
+ throw "Not implemented";
1748
+ }
1749
+ async function Mn(e, t, n) {
1750
+ t.store.ssm && n.newSSM && await pe(t.store.ssm), t.store.bankStatement && n.newBankStatement && await pe(t.store.bankStatement), t.store.exteriorPhoto && n.newExteriorPhoto && await pe(t.store.exteriorPhoto);
1751
+ let r = t.store.ssm || "";
1752
+ n.newSSM && (r = await De(e, "ssm", n.newSSM));
1753
+ let s = t.store.bankStatement || "";
1754
+ n.newBankStatement && (s = await De(
1755
+ e,
1756
+ "bankStatement",
1757
+ n.newBankStatement
1758
+ ));
1759
+ let i = t.store.exteriorPhoto || "";
1760
+ return n.newExteriorPhoto && (i = await Cn(
1761
+ e,
1762
+ n.newExteriorPhoto
1763
+ )), {
1764
+ ...t,
1765
+ store: {
1766
+ ...t.store,
1767
+ id: n.payoutSetting.store.id,
1768
+ keyPerson: n.payoutSetting.store.keyPerson,
1769
+ bank: n.payoutSetting.store.bank,
1770
+ ssm: r,
1771
+ bankStatement: s,
1772
+ exteriorPhoto: i,
1773
+ event: n.payoutSetting.store.event
1774
+ },
1775
+ status: Y.F_PAYOUT_ACCOUNT_STATUS.Enum.PENDING,
1776
+ notifyUrl: n.payoutSetting.store.event === Y.F_PAYOUT_FOR.Enum.MARKETING ? "http://marketing-api-service:3000/customer/callback/store" : "http://order-backend:3000/backend/payment"
1777
+ };
1778
+ }
1779
+ const Ze = Object.values(ct.F_BANK_NAME).map((e) => ({
1780
+ label: he(e),
1781
+ value: e
1782
+ })), Je = Object.values(Y.F_BANK_TYPE.Values).map((e) => ({
1783
+ label: he(e),
1784
+ value: e
1785
+ })), Ln = Object.values(Y.F_PAYOUT_FOR.Values).map((e) => ({
1786
+ label: he(e),
1787
+ value: e
1788
+ })), Bn = Object.values(Y.F_PAYOUT_ACCOUNT_STATUS.Values).map(
1789
+ (e) => ({
1790
+ label: he(e),
1791
+ value: e
1792
+ })
1793
+ ), Hn = {
1794
+ mergeData: Mn,
1795
+ initPayoutAccount: Pn,
1796
+ groupByStatus: xn,
1797
+ bankTypeOptions: Je,
1798
+ bankNameOptions: Ze,
1799
+ storeEventOptions: Ln,
1800
+ statusOptions: Bn
1801
+ };
1802
+ export {
1803
+ Hn as P,
1804
+ Dn as c
1805
+ };