@feedmepos/mf-settings 0.0.63-prod → 0.0.64-prod
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{index-f3cc5dbf.js → App-dadb8bf9.js} +8046 -3711
- package/dist/{Business-b4a5fe0c.js → Business-eafcd130.js} +89 -89
- package/dist/FoodCourt-859c83b2.js +72518 -0
- package/dist/{Tagging-2a5212f1.js → Tagging-e96d855e.js} +1 -1
- package/dist/_commonjs-dynamic-modules-bed80856.js +6 -0
- package/dist/{app-06c20144.js → app-9c6363b3.js} +4 -4
- package/dist/app.js +1 -1
- package/dist/apps/mf-settings/tsconfig.app.tsbuildinfo +1 -1
- package/package.json +2 -2
- package/dist/App-2615cfbb.js +0 -4343
- package/dist/FoodCourt-2e122628.js +0 -47797
package/dist/App-2615cfbb.js
DELETED
|
@@ -1,4343 +0,0 @@
|
|
|
1
|
-
import { defineComponent as Xe, computed as Pe, ref as xt, watchEffect as Vt, resolveComponent as Wt, openBlock as Ye, createBlock as Qe, onMounted as Ht, unref as Kt } from "vue";
|
|
2
|
-
import { useRouter as $t, RouterView as Bt } from "vue-router";
|
|
3
|
-
import { useI18n as zt, useCoreStore as Ze, FeedMeAuth as jt } from "@feedmepos/mf-common";
|
|
4
|
-
import { c as qt } from "./index-f3cc5dbf.js";
|
|
5
|
-
import { e as Gt } from "./index-79b36905.js";
|
|
6
|
-
import { r as Jt } from "./app-06c20144.js";
|
|
7
|
-
import { r as de, g as et, i as Xt, a as Yt, _ as Ne, C as Oe, b as Qt, S as F, c as O, E as pe, d as Zt, e as tt, f as en, h as tn, L as nt, j as ge, k as f, l as nn, m as rn, F as me, q as x, n as sn, o as on, p as an, s as cn, t as ln, u as un, v as dn, w as hn } from "./map-54b71412.js";
|
|
8
|
-
import "@feedmepos/mf-mdm";
|
|
9
|
-
import "@feedmepos/ui-library";
|
|
10
|
-
import "@feedmepos/mf-e-invoice";
|
|
11
|
-
const fn = /* @__PURE__ */ Xe({
|
|
12
|
-
__name: "NavigationTab",
|
|
13
|
-
emits: ["close-navigation"],
|
|
14
|
-
setup(n, { emit: e }) {
|
|
15
|
-
const t = e, { t: i } = zt(), r = $t(), s = Ze(), o = Pe(() => s.restaurants.value.some(({ posVersion: l }) => qt.Pos.canUse({ feature: Gt.F_FEATURE.Enum.templateBuilder, posVersion: l ?? "" }))), c = Pe(() => Jt.filter((d) => {
|
|
16
|
-
var h;
|
|
17
|
-
return d.redirect || (h = d.meta) != null && h.hideNavigation ? !1 : !(d.name === "$settings-template-builder" && !o.value);
|
|
18
|
-
}).map((d) => {
|
|
19
|
-
var h;
|
|
20
|
-
return {
|
|
21
|
-
label: i((h = d.meta) == null ? void 0 : h.i18nKey),
|
|
22
|
-
value: d.name,
|
|
23
|
-
action: () => {
|
|
24
|
-
d.name === "$settings-e-invoice" ? r.push({ name: "SUBMISSION" }) : d.name === "$settings-device" ? r.push({ name: "$devices" }) : r.push({ name: d.name }), t("close-navigation");
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
})), a = xt();
|
|
28
|
-
return Vt(() => {
|
|
29
|
-
var d;
|
|
30
|
-
const l = (d = r.currentRoute.value) == null ? void 0 : d.name;
|
|
31
|
-
l === "SUBMISSION" ? a.value = "$settings-e-invoice" : l === "$devices" ? a.value = "$settings-device" : a.value = l;
|
|
32
|
-
}), (l, d) => {
|
|
33
|
-
const h = Wt("fm-collapsible-tabs");
|
|
34
|
-
return Ye(), Qe(h, {
|
|
35
|
-
modelValue: a.value,
|
|
36
|
-
"onUpdate:modelValue": d[0] || (d[0] = (p) => a.value = p),
|
|
37
|
-
items: c.value,
|
|
38
|
-
class: "py-16 px-8"
|
|
39
|
-
}, null, 8, ["modelValue", "items"]);
|
|
40
|
-
};
|
|
41
|
-
}
|
|
42
|
-
});
|
|
43
|
-
var pn = "firebase", gn = "9.23.0";
|
|
44
|
-
/**
|
|
45
|
-
* @license
|
|
46
|
-
* Copyright 2020 Google LLC
|
|
47
|
-
*
|
|
48
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
49
|
-
* you may not use this file except in compliance with the License.
|
|
50
|
-
* You may obtain a copy of the License at
|
|
51
|
-
*
|
|
52
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
53
|
-
*
|
|
54
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
55
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
56
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
57
|
-
* See the License for the specific language governing permissions and
|
|
58
|
-
* limitations under the License.
|
|
59
|
-
*/
|
|
60
|
-
de(pn, gn, "app");
|
|
61
|
-
function it() {
|
|
62
|
-
return {
|
|
63
|
-
"dependent-sdk-initialized-before-auth": "Another Firebase SDK was initialized and is trying to use Auth before Auth is initialized. Please be sure to call `initializeAuth` or `getAuth` before starting any other Firebase SDK."
|
|
64
|
-
};
|
|
65
|
-
}
|
|
66
|
-
const mn = it, rt = new pe("auth", "Firebase", it());
|
|
67
|
-
/**
|
|
68
|
-
* @license
|
|
69
|
-
* Copyright 2020 Google LLC
|
|
70
|
-
*
|
|
71
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
72
|
-
* you may not use this file except in compliance with the License.
|
|
73
|
-
* You may obtain a copy of the License at
|
|
74
|
-
*
|
|
75
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
76
|
-
*
|
|
77
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
78
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
79
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
80
|
-
* See the License for the specific language governing permissions and
|
|
81
|
-
* limitations under the License.
|
|
82
|
-
*/
|
|
83
|
-
const Y = new rn("@firebase/auth");
|
|
84
|
-
function _n(n, ...e) {
|
|
85
|
-
Y.logLevel <= nt.WARN && Y.warn(`Auth (${F}): ${n}`, ...e);
|
|
86
|
-
}
|
|
87
|
-
function q(n, ...e) {
|
|
88
|
-
Y.logLevel <= nt.ERROR && Y.error(`Auth (${F}): ${n}`, ...e);
|
|
89
|
-
}
|
|
90
|
-
/**
|
|
91
|
-
* @license
|
|
92
|
-
* Copyright 2020 Google LLC
|
|
93
|
-
*
|
|
94
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
95
|
-
* you may not use this file except in compliance with the License.
|
|
96
|
-
* You may obtain a copy of the License at
|
|
97
|
-
*
|
|
98
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
99
|
-
*
|
|
100
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
101
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
102
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
103
|
-
* See the License for the specific language governing permissions and
|
|
104
|
-
* limitations under the License.
|
|
105
|
-
*/
|
|
106
|
-
function I(n, ...e) {
|
|
107
|
-
throw _e(n, ...e);
|
|
108
|
-
}
|
|
109
|
-
function g(n, ...e) {
|
|
110
|
-
return _e(n, ...e);
|
|
111
|
-
}
|
|
112
|
-
function vn(n, e, t) {
|
|
113
|
-
const i = Object.assign(Object.assign({}, mn()), { [e]: t });
|
|
114
|
-
return new pe("auth", "Firebase", i).create(e, {
|
|
115
|
-
appName: n.name
|
|
116
|
-
});
|
|
117
|
-
}
|
|
118
|
-
function _e(n, ...e) {
|
|
119
|
-
if (typeof n != "string") {
|
|
120
|
-
const t = e[0], i = [...e.slice(1)];
|
|
121
|
-
return i[0] && (i[0].appName = n.name), n._errorFactory.create(t, ...i);
|
|
122
|
-
}
|
|
123
|
-
return rt.create(n, ...e);
|
|
124
|
-
}
|
|
125
|
-
function u(n, e, ...t) {
|
|
126
|
-
if (!n)
|
|
127
|
-
throw _e(e, ...t);
|
|
128
|
-
}
|
|
129
|
-
function _(n) {
|
|
130
|
-
const e = "INTERNAL ASSERTION FAILED: " + n;
|
|
131
|
-
throw q(e), new Error(e);
|
|
132
|
-
}
|
|
133
|
-
function y(n, e) {
|
|
134
|
-
n || _(e);
|
|
135
|
-
}
|
|
136
|
-
/**
|
|
137
|
-
* @license
|
|
138
|
-
* Copyright 2020 Google LLC
|
|
139
|
-
*
|
|
140
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
141
|
-
* you may not use this file except in compliance with the License.
|
|
142
|
-
* You may obtain a copy of the License at
|
|
143
|
-
*
|
|
144
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
145
|
-
*
|
|
146
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
147
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
148
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
149
|
-
* See the License for the specific language governing permissions and
|
|
150
|
-
* limitations under the License.
|
|
151
|
-
*/
|
|
152
|
-
function he() {
|
|
153
|
-
var n;
|
|
154
|
-
return typeof self < "u" && ((n = self.location) === null || n === void 0 ? void 0 : n.href) || "";
|
|
155
|
-
}
|
|
156
|
-
function In() {
|
|
157
|
-
return Le() === "http:" || Le() === "https:";
|
|
158
|
-
}
|
|
159
|
-
function Le() {
|
|
160
|
-
var n;
|
|
161
|
-
return typeof self < "u" && ((n = self.location) === null || n === void 0 ? void 0 : n.protocol) || null;
|
|
162
|
-
}
|
|
163
|
-
/**
|
|
164
|
-
* @license
|
|
165
|
-
* Copyright 2020 Google LLC
|
|
166
|
-
*
|
|
167
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
168
|
-
* you may not use this file except in compliance with the License.
|
|
169
|
-
* You may obtain a copy of the License at
|
|
170
|
-
*
|
|
171
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
172
|
-
*
|
|
173
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
174
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
175
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
176
|
-
* See the License for the specific language governing permissions and
|
|
177
|
-
* limitations under the License.
|
|
178
|
-
*/
|
|
179
|
-
function yn() {
|
|
180
|
-
return typeof navigator < "u" && navigator && "onLine" in navigator && typeof navigator.onLine == "boolean" && // Apply only for traditional web apps and Chrome extensions.
|
|
181
|
-
// This is especially true for Cordova apps which have unreliable
|
|
182
|
-
// navigator.onLine behavior unless cordova-plugin-network-information is
|
|
183
|
-
// installed which overwrites the native navigator.onLine value and
|
|
184
|
-
// defines navigator.connection.
|
|
185
|
-
(In() || Qt() || "connection" in navigator) ? navigator.onLine : !0;
|
|
186
|
-
}
|
|
187
|
-
function Tn() {
|
|
188
|
-
if (typeof navigator > "u")
|
|
189
|
-
return null;
|
|
190
|
-
const n = navigator;
|
|
191
|
-
return (
|
|
192
|
-
// Most reliable, but only supported in Chrome/Firefox.
|
|
193
|
-
n.languages && n.languages[0] || // Supported in most browsers, but returns the language of the browser
|
|
194
|
-
// UI, not the language set in browser settings.
|
|
195
|
-
n.language || // Couldn't determine language.
|
|
196
|
-
null
|
|
197
|
-
);
|
|
198
|
-
}
|
|
199
|
-
/**
|
|
200
|
-
* @license
|
|
201
|
-
* Copyright 2020 Google LLC
|
|
202
|
-
*
|
|
203
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
204
|
-
* you may not use this file except in compliance with the License.
|
|
205
|
-
* You may obtain a copy of the License at
|
|
206
|
-
*
|
|
207
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
208
|
-
*
|
|
209
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
210
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
211
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
212
|
-
* See the License for the specific language governing permissions and
|
|
213
|
-
* limitations under the License.
|
|
214
|
-
*/
|
|
215
|
-
class V {
|
|
216
|
-
constructor(e, t) {
|
|
217
|
-
this.shortDelay = e, this.longDelay = t, y(t > e, "Short delay should be less than long delay!"), this.isMobile = Xt() || Yt();
|
|
218
|
-
}
|
|
219
|
-
get() {
|
|
220
|
-
return yn() ? this.isMobile ? this.longDelay : this.shortDelay : Math.min(5e3, this.shortDelay);
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
/**
|
|
224
|
-
* @license
|
|
225
|
-
* Copyright 2020 Google LLC
|
|
226
|
-
*
|
|
227
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
228
|
-
* you may not use this file except in compliance with the License.
|
|
229
|
-
* You may obtain a copy of the License at
|
|
230
|
-
*
|
|
231
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
232
|
-
*
|
|
233
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
234
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
235
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
236
|
-
* See the License for the specific language governing permissions and
|
|
237
|
-
* limitations under the License.
|
|
238
|
-
*/
|
|
239
|
-
function ve(n, e) {
|
|
240
|
-
y(n.emulator, "Emulator should always be set here");
|
|
241
|
-
const { url: t } = n.emulator;
|
|
242
|
-
return e ? `${t}${e.startsWith("/") ? e.slice(1) : e}` : t;
|
|
243
|
-
}
|
|
244
|
-
/**
|
|
245
|
-
* @license
|
|
246
|
-
* Copyright 2020 Google LLC
|
|
247
|
-
*
|
|
248
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
249
|
-
* you may not use this file except in compliance with the License.
|
|
250
|
-
* You may obtain a copy of the License at
|
|
251
|
-
*
|
|
252
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
253
|
-
*
|
|
254
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
255
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
256
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
257
|
-
* See the License for the specific language governing permissions and
|
|
258
|
-
* limitations under the License.
|
|
259
|
-
*/
|
|
260
|
-
class st {
|
|
261
|
-
static initialize(e, t, i) {
|
|
262
|
-
this.fetchImpl = e, t && (this.headersImpl = t), i && (this.responseImpl = i);
|
|
263
|
-
}
|
|
264
|
-
static fetch() {
|
|
265
|
-
if (this.fetchImpl)
|
|
266
|
-
return this.fetchImpl;
|
|
267
|
-
if (typeof self < "u" && "fetch" in self)
|
|
268
|
-
return self.fetch;
|
|
269
|
-
_("Could not find fetch implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill");
|
|
270
|
-
}
|
|
271
|
-
static headers() {
|
|
272
|
-
if (this.headersImpl)
|
|
273
|
-
return this.headersImpl;
|
|
274
|
-
if (typeof self < "u" && "Headers" in self)
|
|
275
|
-
return self.Headers;
|
|
276
|
-
_("Could not find Headers implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill");
|
|
277
|
-
}
|
|
278
|
-
static response() {
|
|
279
|
-
if (this.responseImpl)
|
|
280
|
-
return this.responseImpl;
|
|
281
|
-
if (typeof self < "u" && "Response" in self)
|
|
282
|
-
return self.Response;
|
|
283
|
-
_("Could not find Response implementation, make sure you call FetchProvider.initialize() with an appropriate polyfill");
|
|
284
|
-
}
|
|
285
|
-
}
|
|
286
|
-
/**
|
|
287
|
-
* @license
|
|
288
|
-
* Copyright 2020 Google LLC
|
|
289
|
-
*
|
|
290
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
291
|
-
* you may not use this file except in compliance with the License.
|
|
292
|
-
* You may obtain a copy of the License at
|
|
293
|
-
*
|
|
294
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
295
|
-
*
|
|
296
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
297
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
298
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
299
|
-
* See the License for the specific language governing permissions and
|
|
300
|
-
* limitations under the License.
|
|
301
|
-
*/
|
|
302
|
-
const wn = {
|
|
303
|
-
// Custom token errors.
|
|
304
|
-
CREDENTIAL_MISMATCH: "custom-token-mismatch",
|
|
305
|
-
// This can only happen if the SDK sends a bad request.
|
|
306
|
-
MISSING_CUSTOM_TOKEN: "internal-error",
|
|
307
|
-
// Create Auth URI errors.
|
|
308
|
-
INVALID_IDENTIFIER: "invalid-email",
|
|
309
|
-
// This can only happen if the SDK sends a bad request.
|
|
310
|
-
MISSING_CONTINUE_URI: "internal-error",
|
|
311
|
-
// Sign in with email and password errors (some apply to sign up too).
|
|
312
|
-
INVALID_PASSWORD: "wrong-password",
|
|
313
|
-
// This can only happen if the SDK sends a bad request.
|
|
314
|
-
MISSING_PASSWORD: "missing-password",
|
|
315
|
-
// Sign up with email and password errors.
|
|
316
|
-
EMAIL_EXISTS: "email-already-in-use",
|
|
317
|
-
PASSWORD_LOGIN_DISABLED: "operation-not-allowed",
|
|
318
|
-
// Verify assertion for sign in with credential errors:
|
|
319
|
-
INVALID_IDP_RESPONSE: "invalid-credential",
|
|
320
|
-
INVALID_PENDING_TOKEN: "invalid-credential",
|
|
321
|
-
FEDERATED_USER_ID_ALREADY_LINKED: "credential-already-in-use",
|
|
322
|
-
// This can only happen if the SDK sends a bad request.
|
|
323
|
-
MISSING_REQ_TYPE: "internal-error",
|
|
324
|
-
// Send Password reset email errors:
|
|
325
|
-
EMAIL_NOT_FOUND: "user-not-found",
|
|
326
|
-
RESET_PASSWORD_EXCEED_LIMIT: "too-many-requests",
|
|
327
|
-
EXPIRED_OOB_CODE: "expired-action-code",
|
|
328
|
-
INVALID_OOB_CODE: "invalid-action-code",
|
|
329
|
-
// This can only happen if the SDK sends a bad request.
|
|
330
|
-
MISSING_OOB_CODE: "internal-error",
|
|
331
|
-
// Operations that require ID token in request:
|
|
332
|
-
CREDENTIAL_TOO_OLD_LOGIN_AGAIN: "requires-recent-login",
|
|
333
|
-
INVALID_ID_TOKEN: "invalid-user-token",
|
|
334
|
-
TOKEN_EXPIRED: "user-token-expired",
|
|
335
|
-
USER_NOT_FOUND: "user-token-expired",
|
|
336
|
-
// Other errors.
|
|
337
|
-
TOO_MANY_ATTEMPTS_TRY_LATER: "too-many-requests",
|
|
338
|
-
// Phone Auth related errors.
|
|
339
|
-
INVALID_CODE: "invalid-verification-code",
|
|
340
|
-
INVALID_SESSION_INFO: "invalid-verification-id",
|
|
341
|
-
INVALID_TEMPORARY_PROOF: "invalid-credential",
|
|
342
|
-
MISSING_SESSION_INFO: "missing-verification-id",
|
|
343
|
-
SESSION_EXPIRED: "code-expired",
|
|
344
|
-
// Other action code errors when additional settings passed.
|
|
345
|
-
// MISSING_CONTINUE_URI is getting mapped to INTERNAL_ERROR above.
|
|
346
|
-
// This is OK as this error will be caught by client side validation.
|
|
347
|
-
MISSING_ANDROID_PACKAGE_NAME: "missing-android-pkg-name",
|
|
348
|
-
UNAUTHORIZED_DOMAIN: "unauthorized-continue-uri",
|
|
349
|
-
// getProjectConfig errors when clientId is passed.
|
|
350
|
-
INVALID_OAUTH_CLIENT_ID: "invalid-oauth-client-id",
|
|
351
|
-
// User actions (sign-up or deletion) disabled errors.
|
|
352
|
-
ADMIN_ONLY_OPERATION: "admin-restricted-operation",
|
|
353
|
-
// Multi factor related errors.
|
|
354
|
-
INVALID_MFA_PENDING_CREDENTIAL: "invalid-multi-factor-session",
|
|
355
|
-
MFA_ENROLLMENT_NOT_FOUND: "multi-factor-info-not-found",
|
|
356
|
-
MISSING_MFA_ENROLLMENT_ID: "missing-multi-factor-info",
|
|
357
|
-
MISSING_MFA_PENDING_CREDENTIAL: "missing-multi-factor-session",
|
|
358
|
-
SECOND_FACTOR_EXISTS: "second-factor-already-in-use",
|
|
359
|
-
SECOND_FACTOR_LIMIT_EXCEEDED: "maximum-second-factor-count-exceeded",
|
|
360
|
-
// Blocking functions related errors.
|
|
361
|
-
BLOCKING_FUNCTION_ERROR_RESPONSE: "internal-error",
|
|
362
|
-
// Recaptcha related errors.
|
|
363
|
-
RECAPTCHA_NOT_ENABLED: "recaptcha-not-enabled",
|
|
364
|
-
MISSING_RECAPTCHA_TOKEN: "missing-recaptcha-token",
|
|
365
|
-
INVALID_RECAPTCHA_TOKEN: "invalid-recaptcha-token",
|
|
366
|
-
INVALID_RECAPTCHA_ACTION: "invalid-recaptcha-action",
|
|
367
|
-
MISSING_CLIENT_TYPE: "missing-client-type",
|
|
368
|
-
MISSING_RECAPTCHA_VERSION: "missing-recaptcha-version",
|
|
369
|
-
INVALID_RECAPTCHA_VERSION: "invalid-recaptcha-version",
|
|
370
|
-
INVALID_REQ_TYPE: "invalid-req-type"
|
|
371
|
-
/* AuthErrorCode.INVALID_REQ_TYPE */
|
|
372
|
-
};
|
|
373
|
-
/**
|
|
374
|
-
* @license
|
|
375
|
-
* Copyright 2020 Google LLC
|
|
376
|
-
*
|
|
377
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
378
|
-
* you may not use this file except in compliance with the License.
|
|
379
|
-
* You may obtain a copy of the License at
|
|
380
|
-
*
|
|
381
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
382
|
-
*
|
|
383
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
384
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
385
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
386
|
-
* See the License for the specific language governing permissions and
|
|
387
|
-
* limitations under the License.
|
|
388
|
-
*/
|
|
389
|
-
const En = new V(3e4, 6e4);
|
|
390
|
-
function Ie(n, e) {
|
|
391
|
-
return n.tenantId && !e.tenantId ? Object.assign(Object.assign({}, e), { tenantId: n.tenantId }) : e;
|
|
392
|
-
}
|
|
393
|
-
async function W(n, e, t, i, r = {}) {
|
|
394
|
-
return ot(n, r, async () => {
|
|
395
|
-
let s = {}, o = {};
|
|
396
|
-
i && (e === "GET" ? o = i : s = {
|
|
397
|
-
body: JSON.stringify(i)
|
|
398
|
-
});
|
|
399
|
-
const c = x(Object.assign({ key: n.config.apiKey }, o)).slice(1), a = await n._getAdditionalHeaders();
|
|
400
|
-
return a[
|
|
401
|
-
"Content-Type"
|
|
402
|
-
/* HttpHeader.CONTENT_TYPE */
|
|
403
|
-
] = "application/json", n.languageCode && (a[
|
|
404
|
-
"X-Firebase-Locale"
|
|
405
|
-
/* HttpHeader.X_FIREBASE_LOCALE */
|
|
406
|
-
] = n.languageCode), st.fetch()(ct(n, n.config.apiHost, t, c), Object.assign({
|
|
407
|
-
method: e,
|
|
408
|
-
headers: a,
|
|
409
|
-
referrerPolicy: "no-referrer"
|
|
410
|
-
}, s));
|
|
411
|
-
});
|
|
412
|
-
}
|
|
413
|
-
async function ot(n, e, t) {
|
|
414
|
-
n._canInitEmulator = !1;
|
|
415
|
-
const i = Object.assign(Object.assign({}, wn), e);
|
|
416
|
-
try {
|
|
417
|
-
const r = new kn(n), s = await Promise.race([
|
|
418
|
-
t(),
|
|
419
|
-
r.promise
|
|
420
|
-
]);
|
|
421
|
-
r.clearNetworkTimeout();
|
|
422
|
-
const o = await s.json();
|
|
423
|
-
if ("needConfirmation" in o)
|
|
424
|
-
throw j(n, "account-exists-with-different-credential", o);
|
|
425
|
-
if (s.ok && !("errorMessage" in o))
|
|
426
|
-
return o;
|
|
427
|
-
{
|
|
428
|
-
const c = s.ok ? o.errorMessage : o.error.message, [a, l] = c.split(" : ");
|
|
429
|
-
if (a === "FEDERATED_USER_ID_ALREADY_LINKED")
|
|
430
|
-
throw j(n, "credential-already-in-use", o);
|
|
431
|
-
if (a === "EMAIL_EXISTS")
|
|
432
|
-
throw j(n, "email-already-in-use", o);
|
|
433
|
-
if (a === "USER_DISABLED")
|
|
434
|
-
throw j(n, "user-disabled", o);
|
|
435
|
-
const d = i[a] || a.toLowerCase().replace(/[_\s]+/g, "-");
|
|
436
|
-
if (l)
|
|
437
|
-
throw vn(n, d, l);
|
|
438
|
-
I(n, d);
|
|
439
|
-
}
|
|
440
|
-
} catch (r) {
|
|
441
|
-
if (r instanceof me)
|
|
442
|
-
throw r;
|
|
443
|
-
I(n, "network-request-failed", { message: String(r) });
|
|
444
|
-
}
|
|
445
|
-
}
|
|
446
|
-
async function at(n, e, t, i, r = {}) {
|
|
447
|
-
const s = await W(n, e, t, i, r);
|
|
448
|
-
return "mfaPendingCredential" in s && I(n, "multi-factor-auth-required", {
|
|
449
|
-
_serverResponse: s
|
|
450
|
-
}), s;
|
|
451
|
-
}
|
|
452
|
-
function ct(n, e, t, i) {
|
|
453
|
-
const r = `${e}${t}?${i}`;
|
|
454
|
-
return n.config.emulator ? ve(n.config, r) : `${n.config.apiScheme}://${r}`;
|
|
455
|
-
}
|
|
456
|
-
class kn {
|
|
457
|
-
constructor(e) {
|
|
458
|
-
this.auth = e, this.timer = null, this.promise = new Promise((t, i) => {
|
|
459
|
-
this.timer = setTimeout(() => i(g(
|
|
460
|
-
this.auth,
|
|
461
|
-
"network-request-failed"
|
|
462
|
-
/* AuthErrorCode.NETWORK_REQUEST_FAILED */
|
|
463
|
-
)), En.get());
|
|
464
|
-
});
|
|
465
|
-
}
|
|
466
|
-
clearNetworkTimeout() {
|
|
467
|
-
clearTimeout(this.timer);
|
|
468
|
-
}
|
|
469
|
-
}
|
|
470
|
-
function j(n, e, t) {
|
|
471
|
-
const i = {
|
|
472
|
-
appName: n.name
|
|
473
|
-
};
|
|
474
|
-
t.email && (i.email = t.email), t.phoneNumber && (i.phoneNumber = t.phoneNumber);
|
|
475
|
-
const r = g(n, e, i);
|
|
476
|
-
return r.customData._tokenResponse = t, r;
|
|
477
|
-
}
|
|
478
|
-
/**
|
|
479
|
-
* @license
|
|
480
|
-
* Copyright 2020 Google LLC
|
|
481
|
-
*
|
|
482
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
483
|
-
* you may not use this file except in compliance with the License.
|
|
484
|
-
* You may obtain a copy of the License at
|
|
485
|
-
*
|
|
486
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
487
|
-
*
|
|
488
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
489
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
490
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
491
|
-
* See the License for the specific language governing permissions and
|
|
492
|
-
* limitations under the License.
|
|
493
|
-
*/
|
|
494
|
-
async function Rn(n, e) {
|
|
495
|
-
return W(n, "POST", "/v1/accounts:delete", e);
|
|
496
|
-
}
|
|
497
|
-
async function bn(n, e) {
|
|
498
|
-
return W(n, "POST", "/v1/accounts:lookup", e);
|
|
499
|
-
}
|
|
500
|
-
/**
|
|
501
|
-
* @license
|
|
502
|
-
* Copyright 2020 Google LLC
|
|
503
|
-
*
|
|
504
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
505
|
-
* you may not use this file except in compliance with the License.
|
|
506
|
-
* You may obtain a copy of the License at
|
|
507
|
-
*
|
|
508
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
509
|
-
*
|
|
510
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
511
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
512
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
513
|
-
* See the License for the specific language governing permissions and
|
|
514
|
-
* limitations under the License.
|
|
515
|
-
*/
|
|
516
|
-
function L(n) {
|
|
517
|
-
if (n)
|
|
518
|
-
try {
|
|
519
|
-
const e = new Date(Number(n));
|
|
520
|
-
if (!isNaN(e.getTime()))
|
|
521
|
-
return e.toUTCString();
|
|
522
|
-
} catch {
|
|
523
|
-
}
|
|
524
|
-
}
|
|
525
|
-
async function Sn(n, e = !1) {
|
|
526
|
-
const t = O(n), i = await t.getIdToken(e), r = ye(i);
|
|
527
|
-
u(
|
|
528
|
-
r && r.exp && r.auth_time && r.iat,
|
|
529
|
-
t.auth,
|
|
530
|
-
"internal-error"
|
|
531
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
532
|
-
);
|
|
533
|
-
const s = typeof r.firebase == "object" ? r.firebase : void 0, o = s == null ? void 0 : s.sign_in_provider;
|
|
534
|
-
return {
|
|
535
|
-
claims: r,
|
|
536
|
-
token: i,
|
|
537
|
-
authTime: L(le(r.auth_time)),
|
|
538
|
-
issuedAtTime: L(le(r.iat)),
|
|
539
|
-
expirationTime: L(le(r.exp)),
|
|
540
|
-
signInProvider: o || null,
|
|
541
|
-
signInSecondFactor: (s == null ? void 0 : s.sign_in_second_factor) || null
|
|
542
|
-
};
|
|
543
|
-
}
|
|
544
|
-
function le(n) {
|
|
545
|
-
return Number(n) * 1e3;
|
|
546
|
-
}
|
|
547
|
-
function ye(n) {
|
|
548
|
-
const [e, t, i] = n.split(".");
|
|
549
|
-
if (e === void 0 || t === void 0 || i === void 0)
|
|
550
|
-
return q("JWT malformed, contained fewer than 3 sections"), null;
|
|
551
|
-
try {
|
|
552
|
-
const r = sn(t);
|
|
553
|
-
return r ? JSON.parse(r) : (q("Failed to decode base64 JWT payload"), null);
|
|
554
|
-
} catch (r) {
|
|
555
|
-
return q("Caught error parsing JWT payload as JSON", r == null ? void 0 : r.toString()), null;
|
|
556
|
-
}
|
|
557
|
-
}
|
|
558
|
-
function An(n) {
|
|
559
|
-
const e = ye(n);
|
|
560
|
-
return u(
|
|
561
|
-
e,
|
|
562
|
-
"internal-error"
|
|
563
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
564
|
-
), u(
|
|
565
|
-
typeof e.exp < "u",
|
|
566
|
-
"internal-error"
|
|
567
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
568
|
-
), u(
|
|
569
|
-
typeof e.iat < "u",
|
|
570
|
-
"internal-error"
|
|
571
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
572
|
-
), Number(e.exp) - Number(e.iat);
|
|
573
|
-
}
|
|
574
|
-
/**
|
|
575
|
-
* @license
|
|
576
|
-
* Copyright 2020 Google LLC
|
|
577
|
-
*
|
|
578
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
579
|
-
* you may not use this file except in compliance with the License.
|
|
580
|
-
* You may obtain a copy of the License at
|
|
581
|
-
*
|
|
582
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
583
|
-
*
|
|
584
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
585
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
586
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
587
|
-
* See the License for the specific language governing permissions and
|
|
588
|
-
* limitations under the License.
|
|
589
|
-
*/
|
|
590
|
-
async function M(n, e, t = !1) {
|
|
591
|
-
if (t)
|
|
592
|
-
return e;
|
|
593
|
-
try {
|
|
594
|
-
return await e;
|
|
595
|
-
} catch (i) {
|
|
596
|
-
throw i instanceof me && Cn(i) && n.auth.currentUser === n && await n.auth.signOut(), i;
|
|
597
|
-
}
|
|
598
|
-
}
|
|
599
|
-
function Cn({ code: n }) {
|
|
600
|
-
return n === "auth/user-disabled" || n === "auth/user-token-expired";
|
|
601
|
-
}
|
|
602
|
-
/**
|
|
603
|
-
* @license
|
|
604
|
-
* Copyright 2020 Google LLC
|
|
605
|
-
*
|
|
606
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
607
|
-
* you may not use this file except in compliance with the License.
|
|
608
|
-
* You may obtain a copy of the License at
|
|
609
|
-
*
|
|
610
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
611
|
-
*
|
|
612
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
613
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
614
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
615
|
-
* See the License for the specific language governing permissions and
|
|
616
|
-
* limitations under the License.
|
|
617
|
-
*/
|
|
618
|
-
class Pn {
|
|
619
|
-
constructor(e) {
|
|
620
|
-
this.user = e, this.isRunning = !1, this.timerId = null, this.errorBackoff = 3e4;
|
|
621
|
-
}
|
|
622
|
-
_start() {
|
|
623
|
-
this.isRunning || (this.isRunning = !0, this.schedule());
|
|
624
|
-
}
|
|
625
|
-
_stop() {
|
|
626
|
-
this.isRunning && (this.isRunning = !1, this.timerId !== null && clearTimeout(this.timerId));
|
|
627
|
-
}
|
|
628
|
-
getInterval(e) {
|
|
629
|
-
var t;
|
|
630
|
-
if (e) {
|
|
631
|
-
const i = this.errorBackoff;
|
|
632
|
-
return this.errorBackoff = Math.min(
|
|
633
|
-
this.errorBackoff * 2,
|
|
634
|
-
96e4
|
|
635
|
-
/* Duration.RETRY_BACKOFF_MAX */
|
|
636
|
-
), i;
|
|
637
|
-
} else {
|
|
638
|
-
this.errorBackoff = 3e4;
|
|
639
|
-
const r = ((t = this.user.stsTokenManager.expirationTime) !== null && t !== void 0 ? t : 0) - Date.now() - 3e5;
|
|
640
|
-
return Math.max(0, r);
|
|
641
|
-
}
|
|
642
|
-
}
|
|
643
|
-
schedule(e = !1) {
|
|
644
|
-
if (!this.isRunning)
|
|
645
|
-
return;
|
|
646
|
-
const t = this.getInterval(e);
|
|
647
|
-
this.timerId = setTimeout(async () => {
|
|
648
|
-
await this.iteration();
|
|
649
|
-
}, t);
|
|
650
|
-
}
|
|
651
|
-
async iteration() {
|
|
652
|
-
try {
|
|
653
|
-
await this.user.getIdToken(!0);
|
|
654
|
-
} catch (e) {
|
|
655
|
-
(e == null ? void 0 : e.code) === "auth/network-request-failed" && this.schedule(
|
|
656
|
-
/* wasError */
|
|
657
|
-
!0
|
|
658
|
-
);
|
|
659
|
-
return;
|
|
660
|
-
}
|
|
661
|
-
this.schedule();
|
|
662
|
-
}
|
|
663
|
-
}
|
|
664
|
-
/**
|
|
665
|
-
* @license
|
|
666
|
-
* Copyright 2020 Google LLC
|
|
667
|
-
*
|
|
668
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
669
|
-
* you may not use this file except in compliance with the License.
|
|
670
|
-
* You may obtain a copy of the License at
|
|
671
|
-
*
|
|
672
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
673
|
-
*
|
|
674
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
675
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
676
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
677
|
-
* See the License for the specific language governing permissions and
|
|
678
|
-
* limitations under the License.
|
|
679
|
-
*/
|
|
680
|
-
class lt {
|
|
681
|
-
constructor(e, t) {
|
|
682
|
-
this.createdAt = e, this.lastLoginAt = t, this._initializeTime();
|
|
683
|
-
}
|
|
684
|
-
_initializeTime() {
|
|
685
|
-
this.lastSignInTime = L(this.lastLoginAt), this.creationTime = L(this.createdAt);
|
|
686
|
-
}
|
|
687
|
-
_copy(e) {
|
|
688
|
-
this.createdAt = e.createdAt, this.lastLoginAt = e.lastLoginAt, this._initializeTime();
|
|
689
|
-
}
|
|
690
|
-
toJSON() {
|
|
691
|
-
return {
|
|
692
|
-
createdAt: this.createdAt,
|
|
693
|
-
lastLoginAt: this.lastLoginAt
|
|
694
|
-
};
|
|
695
|
-
}
|
|
696
|
-
}
|
|
697
|
-
/**
|
|
698
|
-
* @license
|
|
699
|
-
* Copyright 2019 Google LLC
|
|
700
|
-
*
|
|
701
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
702
|
-
* you may not use this file except in compliance with the License.
|
|
703
|
-
* You may obtain a copy of the License at
|
|
704
|
-
*
|
|
705
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
706
|
-
*
|
|
707
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
708
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
709
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
710
|
-
* See the License for the specific language governing permissions and
|
|
711
|
-
* limitations under the License.
|
|
712
|
-
*/
|
|
713
|
-
async function Q(n) {
|
|
714
|
-
var e;
|
|
715
|
-
const t = n.auth, i = await n.getIdToken(), r = await M(n, bn(t, { idToken: i }));
|
|
716
|
-
u(
|
|
717
|
-
r == null ? void 0 : r.users.length,
|
|
718
|
-
t,
|
|
719
|
-
"internal-error"
|
|
720
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
721
|
-
);
|
|
722
|
-
const s = r.users[0];
|
|
723
|
-
n._notifyReloadListener(s);
|
|
724
|
-
const o = !((e = s.providerUserInfo) === null || e === void 0) && e.length ? Ln(s.providerUserInfo) : [], c = On(n.providerData, o), a = n.isAnonymous, l = !(n.email && s.passwordHash) && !(c != null && c.length), d = a ? l : !1, h = {
|
|
725
|
-
uid: s.localId,
|
|
726
|
-
displayName: s.displayName || null,
|
|
727
|
-
photoURL: s.photoUrl || null,
|
|
728
|
-
email: s.email || null,
|
|
729
|
-
emailVerified: s.emailVerified || !1,
|
|
730
|
-
phoneNumber: s.phoneNumber || null,
|
|
731
|
-
tenantId: s.tenantId || null,
|
|
732
|
-
providerData: c,
|
|
733
|
-
metadata: new lt(s.createdAt, s.lastLoginAt),
|
|
734
|
-
isAnonymous: d
|
|
735
|
-
};
|
|
736
|
-
Object.assign(n, h);
|
|
737
|
-
}
|
|
738
|
-
async function Nn(n) {
|
|
739
|
-
const e = O(n);
|
|
740
|
-
await Q(e), await e.auth._persistUserIfCurrent(e), e.auth._notifyListenersIfCurrent(e);
|
|
741
|
-
}
|
|
742
|
-
function On(n, e) {
|
|
743
|
-
return [...n.filter((i) => !e.some((r) => r.providerId === i.providerId)), ...e];
|
|
744
|
-
}
|
|
745
|
-
function Ln(n) {
|
|
746
|
-
return n.map((e) => {
|
|
747
|
-
var { providerId: t } = e, i = ge(e, ["providerId"]);
|
|
748
|
-
return {
|
|
749
|
-
providerId: t,
|
|
750
|
-
uid: i.rawId || "",
|
|
751
|
-
displayName: i.displayName || null,
|
|
752
|
-
email: i.email || null,
|
|
753
|
-
phoneNumber: i.phoneNumber || null,
|
|
754
|
-
photoURL: i.photoUrl || null
|
|
755
|
-
};
|
|
756
|
-
});
|
|
757
|
-
}
|
|
758
|
-
/**
|
|
759
|
-
* @license
|
|
760
|
-
* Copyright 2020 Google LLC
|
|
761
|
-
*
|
|
762
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
763
|
-
* you may not use this file except in compliance with the License.
|
|
764
|
-
* You may obtain a copy of the License at
|
|
765
|
-
*
|
|
766
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
767
|
-
*
|
|
768
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
769
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
770
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
771
|
-
* See the License for the specific language governing permissions and
|
|
772
|
-
* limitations under the License.
|
|
773
|
-
*/
|
|
774
|
-
async function Mn(n, e) {
|
|
775
|
-
const t = await ot(n, {}, async () => {
|
|
776
|
-
const i = x({
|
|
777
|
-
grant_type: "refresh_token",
|
|
778
|
-
refresh_token: e
|
|
779
|
-
}).slice(1), { tokenApiHost: r, apiKey: s } = n.config, o = ct(n, r, "/v1/token", `key=${s}`), c = await n._getAdditionalHeaders();
|
|
780
|
-
return c[
|
|
781
|
-
"Content-Type"
|
|
782
|
-
/* HttpHeader.CONTENT_TYPE */
|
|
783
|
-
] = "application/x-www-form-urlencoded", st.fetch()(o, {
|
|
784
|
-
method: "POST",
|
|
785
|
-
headers: c,
|
|
786
|
-
body: i
|
|
787
|
-
});
|
|
788
|
-
});
|
|
789
|
-
return {
|
|
790
|
-
accessToken: t.access_token,
|
|
791
|
-
expiresIn: t.expires_in,
|
|
792
|
-
refreshToken: t.refresh_token
|
|
793
|
-
};
|
|
794
|
-
}
|
|
795
|
-
/**
|
|
796
|
-
* @license
|
|
797
|
-
* Copyright 2020 Google LLC
|
|
798
|
-
*
|
|
799
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
800
|
-
* you may not use this file except in compliance with the License.
|
|
801
|
-
* You may obtain a copy of the License at
|
|
802
|
-
*
|
|
803
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
804
|
-
*
|
|
805
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
806
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
807
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
808
|
-
* See the License for the specific language governing permissions and
|
|
809
|
-
* limitations under the License.
|
|
810
|
-
*/
|
|
811
|
-
class U {
|
|
812
|
-
constructor() {
|
|
813
|
-
this.refreshToken = null, this.accessToken = null, this.expirationTime = null;
|
|
814
|
-
}
|
|
815
|
-
get isExpired() {
|
|
816
|
-
return !this.expirationTime || Date.now() > this.expirationTime - 3e4;
|
|
817
|
-
}
|
|
818
|
-
updateFromServerResponse(e) {
|
|
819
|
-
u(
|
|
820
|
-
e.idToken,
|
|
821
|
-
"internal-error"
|
|
822
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
823
|
-
), u(
|
|
824
|
-
typeof e.idToken < "u",
|
|
825
|
-
"internal-error"
|
|
826
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
827
|
-
), u(
|
|
828
|
-
typeof e.refreshToken < "u",
|
|
829
|
-
"internal-error"
|
|
830
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
831
|
-
);
|
|
832
|
-
const t = "expiresIn" in e && typeof e.expiresIn < "u" ? Number(e.expiresIn) : An(e.idToken);
|
|
833
|
-
this.updateTokensAndExpiration(e.idToken, e.refreshToken, t);
|
|
834
|
-
}
|
|
835
|
-
async getToken(e, t = !1) {
|
|
836
|
-
return u(
|
|
837
|
-
!this.accessToken || this.refreshToken,
|
|
838
|
-
e,
|
|
839
|
-
"user-token-expired"
|
|
840
|
-
/* AuthErrorCode.TOKEN_EXPIRED */
|
|
841
|
-
), !t && this.accessToken && !this.isExpired ? this.accessToken : this.refreshToken ? (await this.refresh(e, this.refreshToken), this.accessToken) : null;
|
|
842
|
-
}
|
|
843
|
-
clearRefreshToken() {
|
|
844
|
-
this.refreshToken = null;
|
|
845
|
-
}
|
|
846
|
-
async refresh(e, t) {
|
|
847
|
-
const { accessToken: i, refreshToken: r, expiresIn: s } = await Mn(e, t);
|
|
848
|
-
this.updateTokensAndExpiration(i, r, Number(s));
|
|
849
|
-
}
|
|
850
|
-
updateTokensAndExpiration(e, t, i) {
|
|
851
|
-
this.refreshToken = t || null, this.accessToken = e || null, this.expirationTime = Date.now() + i * 1e3;
|
|
852
|
-
}
|
|
853
|
-
static fromJSON(e, t) {
|
|
854
|
-
const { refreshToken: i, accessToken: r, expirationTime: s } = t, o = new U();
|
|
855
|
-
return i && (u(typeof i == "string", "internal-error", {
|
|
856
|
-
appName: e
|
|
857
|
-
}), o.refreshToken = i), r && (u(typeof r == "string", "internal-error", {
|
|
858
|
-
appName: e
|
|
859
|
-
}), o.accessToken = r), s && (u(typeof s == "number", "internal-error", {
|
|
860
|
-
appName: e
|
|
861
|
-
}), o.expirationTime = s), o;
|
|
862
|
-
}
|
|
863
|
-
toJSON() {
|
|
864
|
-
return {
|
|
865
|
-
refreshToken: this.refreshToken,
|
|
866
|
-
accessToken: this.accessToken,
|
|
867
|
-
expirationTime: this.expirationTime
|
|
868
|
-
};
|
|
869
|
-
}
|
|
870
|
-
_assign(e) {
|
|
871
|
-
this.accessToken = e.accessToken, this.refreshToken = e.refreshToken, this.expirationTime = e.expirationTime;
|
|
872
|
-
}
|
|
873
|
-
_clone() {
|
|
874
|
-
return Object.assign(new U(), this.toJSON());
|
|
875
|
-
}
|
|
876
|
-
_performRefresh() {
|
|
877
|
-
return _("not implemented");
|
|
878
|
-
}
|
|
879
|
-
}
|
|
880
|
-
/**
|
|
881
|
-
* @license
|
|
882
|
-
* Copyright 2020 Google LLC
|
|
883
|
-
*
|
|
884
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
885
|
-
* you may not use this file except in compliance with the License.
|
|
886
|
-
* You may obtain a copy of the License at
|
|
887
|
-
*
|
|
888
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
889
|
-
*
|
|
890
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
891
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
892
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
893
|
-
* See the License for the specific language governing permissions and
|
|
894
|
-
* limitations under the License.
|
|
895
|
-
*/
|
|
896
|
-
function T(n, e) {
|
|
897
|
-
u(typeof n == "string" || typeof n > "u", "internal-error", { appName: e });
|
|
898
|
-
}
|
|
899
|
-
class b {
|
|
900
|
-
constructor(e) {
|
|
901
|
-
var { uid: t, auth: i, stsTokenManager: r } = e, s = ge(e, ["uid", "auth", "stsTokenManager"]);
|
|
902
|
-
this.providerId = "firebase", this.proactiveRefresh = new Pn(this), this.reloadUserInfo = null, this.reloadListener = null, this.uid = t, this.auth = i, this.stsTokenManager = r, this.accessToken = r.accessToken, this.displayName = s.displayName || null, this.email = s.email || null, this.emailVerified = s.emailVerified || !1, this.phoneNumber = s.phoneNumber || null, this.photoURL = s.photoURL || null, this.isAnonymous = s.isAnonymous || !1, this.tenantId = s.tenantId || null, this.providerData = s.providerData ? [...s.providerData] : [], this.metadata = new lt(s.createdAt || void 0, s.lastLoginAt || void 0);
|
|
903
|
-
}
|
|
904
|
-
async getIdToken(e) {
|
|
905
|
-
const t = await M(this, this.stsTokenManager.getToken(this.auth, e));
|
|
906
|
-
return u(
|
|
907
|
-
t,
|
|
908
|
-
this.auth,
|
|
909
|
-
"internal-error"
|
|
910
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
911
|
-
), this.accessToken !== t && (this.accessToken = t, await this.auth._persistUserIfCurrent(this), this.auth._notifyListenersIfCurrent(this)), t;
|
|
912
|
-
}
|
|
913
|
-
getIdTokenResult(e) {
|
|
914
|
-
return Sn(this, e);
|
|
915
|
-
}
|
|
916
|
-
reload() {
|
|
917
|
-
return Nn(this);
|
|
918
|
-
}
|
|
919
|
-
_assign(e) {
|
|
920
|
-
this !== e && (u(
|
|
921
|
-
this.uid === e.uid,
|
|
922
|
-
this.auth,
|
|
923
|
-
"internal-error"
|
|
924
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
925
|
-
), this.displayName = e.displayName, this.photoURL = e.photoURL, this.email = e.email, this.emailVerified = e.emailVerified, this.phoneNumber = e.phoneNumber, this.isAnonymous = e.isAnonymous, this.tenantId = e.tenantId, this.providerData = e.providerData.map((t) => Object.assign({}, t)), this.metadata._copy(e.metadata), this.stsTokenManager._assign(e.stsTokenManager));
|
|
926
|
-
}
|
|
927
|
-
_clone(e) {
|
|
928
|
-
const t = new b(Object.assign(Object.assign({}, this), { auth: e, stsTokenManager: this.stsTokenManager._clone() }));
|
|
929
|
-
return t.metadata._copy(this.metadata), t;
|
|
930
|
-
}
|
|
931
|
-
_onReload(e) {
|
|
932
|
-
u(
|
|
933
|
-
!this.reloadListener,
|
|
934
|
-
this.auth,
|
|
935
|
-
"internal-error"
|
|
936
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
937
|
-
), this.reloadListener = e, this.reloadUserInfo && (this._notifyReloadListener(this.reloadUserInfo), this.reloadUserInfo = null);
|
|
938
|
-
}
|
|
939
|
-
_notifyReloadListener(e) {
|
|
940
|
-
this.reloadListener ? this.reloadListener(e) : this.reloadUserInfo = e;
|
|
941
|
-
}
|
|
942
|
-
_startProactiveRefresh() {
|
|
943
|
-
this.proactiveRefresh._start();
|
|
944
|
-
}
|
|
945
|
-
_stopProactiveRefresh() {
|
|
946
|
-
this.proactiveRefresh._stop();
|
|
947
|
-
}
|
|
948
|
-
async _updateTokensIfNecessary(e, t = !1) {
|
|
949
|
-
let i = !1;
|
|
950
|
-
e.idToken && e.idToken !== this.stsTokenManager.accessToken && (this.stsTokenManager.updateFromServerResponse(e), i = !0), t && await Q(this), await this.auth._persistUserIfCurrent(this), i && this.auth._notifyListenersIfCurrent(this);
|
|
951
|
-
}
|
|
952
|
-
async delete() {
|
|
953
|
-
const e = await this.getIdToken();
|
|
954
|
-
return await M(this, Rn(this.auth, { idToken: e })), this.stsTokenManager.clearRefreshToken(), this.auth.signOut();
|
|
955
|
-
}
|
|
956
|
-
toJSON() {
|
|
957
|
-
return Object.assign(Object.assign({
|
|
958
|
-
uid: this.uid,
|
|
959
|
-
email: this.email || void 0,
|
|
960
|
-
emailVerified: this.emailVerified,
|
|
961
|
-
displayName: this.displayName || void 0,
|
|
962
|
-
isAnonymous: this.isAnonymous,
|
|
963
|
-
photoURL: this.photoURL || void 0,
|
|
964
|
-
phoneNumber: this.phoneNumber || void 0,
|
|
965
|
-
tenantId: this.tenantId || void 0,
|
|
966
|
-
providerData: this.providerData.map((e) => Object.assign({}, e)),
|
|
967
|
-
stsTokenManager: this.stsTokenManager.toJSON(),
|
|
968
|
-
// Redirect event ID must be maintained in case there is a pending
|
|
969
|
-
// redirect event.
|
|
970
|
-
_redirectEventId: this._redirectEventId
|
|
971
|
-
}, this.metadata.toJSON()), {
|
|
972
|
-
// Required for compatibility with the legacy SDK (go/firebase-auth-sdk-persistence-parsing):
|
|
973
|
-
apiKey: this.auth.config.apiKey,
|
|
974
|
-
appName: this.auth.name
|
|
975
|
-
});
|
|
976
|
-
}
|
|
977
|
-
get refreshToken() {
|
|
978
|
-
return this.stsTokenManager.refreshToken || "";
|
|
979
|
-
}
|
|
980
|
-
static _fromJSON(e, t) {
|
|
981
|
-
var i, r, s, o, c, a, l, d;
|
|
982
|
-
const h = (i = t.displayName) !== null && i !== void 0 ? i : void 0, p = (r = t.email) !== null && r !== void 0 ? r : void 0, B = (s = t.phoneNumber) !== null && s !== void 0 ? s : void 0, z = (o = t.photoURL) !== null && o !== void 0 ? o : void 0, ke = (c = t.tenantId) !== null && c !== void 0 ? c : void 0, se = (a = t._redirectEventId) !== null && a !== void 0 ? a : void 0, Re = (l = t.createdAt) !== null && l !== void 0 ? l : void 0, be = (d = t.lastLoginAt) !== null && d !== void 0 ? d : void 0, { uid: oe, emailVerified: Se, isAnonymous: Ae, providerData: ae, stsTokenManager: Ce } = t;
|
|
983
|
-
u(
|
|
984
|
-
oe && Ce,
|
|
985
|
-
e,
|
|
986
|
-
"internal-error"
|
|
987
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
988
|
-
);
|
|
989
|
-
const Dt = U.fromJSON(this.name, Ce);
|
|
990
|
-
u(
|
|
991
|
-
typeof oe == "string",
|
|
992
|
-
e,
|
|
993
|
-
"internal-error"
|
|
994
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
995
|
-
), T(h, e.name), T(p, e.name), u(
|
|
996
|
-
typeof Se == "boolean",
|
|
997
|
-
e,
|
|
998
|
-
"internal-error"
|
|
999
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
1000
|
-
), u(
|
|
1001
|
-
typeof Ae == "boolean",
|
|
1002
|
-
e,
|
|
1003
|
-
"internal-error"
|
|
1004
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
1005
|
-
), T(B, e.name), T(z, e.name), T(ke, e.name), T(se, e.name), T(Re, e.name), T(be, e.name);
|
|
1006
|
-
const ce = new b({
|
|
1007
|
-
uid: oe,
|
|
1008
|
-
auth: e,
|
|
1009
|
-
email: p,
|
|
1010
|
-
emailVerified: Se,
|
|
1011
|
-
displayName: h,
|
|
1012
|
-
isAnonymous: Ae,
|
|
1013
|
-
photoURL: z,
|
|
1014
|
-
phoneNumber: B,
|
|
1015
|
-
tenantId: ke,
|
|
1016
|
-
stsTokenManager: Dt,
|
|
1017
|
-
createdAt: Re,
|
|
1018
|
-
lastLoginAt: be
|
|
1019
|
-
});
|
|
1020
|
-
return ae && Array.isArray(ae) && (ce.providerData = ae.map((Ft) => Object.assign({}, Ft))), se && (ce._redirectEventId = se), ce;
|
|
1021
|
-
}
|
|
1022
|
-
/**
|
|
1023
|
-
* Initialize a User from an idToken server response
|
|
1024
|
-
* @param auth
|
|
1025
|
-
* @param idTokenResponse
|
|
1026
|
-
*/
|
|
1027
|
-
static async _fromIdTokenResponse(e, t, i = !1) {
|
|
1028
|
-
const r = new U();
|
|
1029
|
-
r.updateFromServerResponse(t);
|
|
1030
|
-
const s = new b({
|
|
1031
|
-
uid: t.localId,
|
|
1032
|
-
auth: e,
|
|
1033
|
-
stsTokenManager: r,
|
|
1034
|
-
isAnonymous: i
|
|
1035
|
-
});
|
|
1036
|
-
return await Q(s), s;
|
|
1037
|
-
}
|
|
1038
|
-
}
|
|
1039
|
-
/**
|
|
1040
|
-
* @license
|
|
1041
|
-
* Copyright 2020 Google LLC
|
|
1042
|
-
*
|
|
1043
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1044
|
-
* you may not use this file except in compliance with the License.
|
|
1045
|
-
* You may obtain a copy of the License at
|
|
1046
|
-
*
|
|
1047
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1048
|
-
*
|
|
1049
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1050
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1051
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1052
|
-
* See the License for the specific language governing permissions and
|
|
1053
|
-
* limitations under the License.
|
|
1054
|
-
*/
|
|
1055
|
-
const Me = /* @__PURE__ */ new Map();
|
|
1056
|
-
function v(n) {
|
|
1057
|
-
y(n instanceof Function, "Expected a class definition");
|
|
1058
|
-
let e = Me.get(n);
|
|
1059
|
-
return e ? (y(e instanceof n, "Instance stored in cache mismatched with class"), e) : (e = new n(), Me.set(n, e), e);
|
|
1060
|
-
}
|
|
1061
|
-
/**
|
|
1062
|
-
* @license
|
|
1063
|
-
* Copyright 2019 Google LLC
|
|
1064
|
-
*
|
|
1065
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1066
|
-
* you may not use this file except in compliance with the License.
|
|
1067
|
-
* You may obtain a copy of the License at
|
|
1068
|
-
*
|
|
1069
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1070
|
-
*
|
|
1071
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1072
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1073
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1074
|
-
* See the License for the specific language governing permissions and
|
|
1075
|
-
* limitations under the License.
|
|
1076
|
-
*/
|
|
1077
|
-
class ut {
|
|
1078
|
-
constructor() {
|
|
1079
|
-
this.type = "NONE", this.storage = {};
|
|
1080
|
-
}
|
|
1081
|
-
async _isAvailable() {
|
|
1082
|
-
return !0;
|
|
1083
|
-
}
|
|
1084
|
-
async _set(e, t) {
|
|
1085
|
-
this.storage[e] = t;
|
|
1086
|
-
}
|
|
1087
|
-
async _get(e) {
|
|
1088
|
-
const t = this.storage[e];
|
|
1089
|
-
return t === void 0 ? null : t;
|
|
1090
|
-
}
|
|
1091
|
-
async _remove(e) {
|
|
1092
|
-
delete this.storage[e];
|
|
1093
|
-
}
|
|
1094
|
-
_addListener(e, t) {
|
|
1095
|
-
}
|
|
1096
|
-
_removeListener(e, t) {
|
|
1097
|
-
}
|
|
1098
|
-
}
|
|
1099
|
-
ut.type = "NONE";
|
|
1100
|
-
const Ue = ut;
|
|
1101
|
-
/**
|
|
1102
|
-
* @license
|
|
1103
|
-
* Copyright 2019 Google LLC
|
|
1104
|
-
*
|
|
1105
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1106
|
-
* you may not use this file except in compliance with the License.
|
|
1107
|
-
* You may obtain a copy of the License at
|
|
1108
|
-
*
|
|
1109
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1110
|
-
*
|
|
1111
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1112
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1113
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1114
|
-
* See the License for the specific language governing permissions and
|
|
1115
|
-
* limitations under the License.
|
|
1116
|
-
*/
|
|
1117
|
-
function G(n, e, t) {
|
|
1118
|
-
return `firebase:${n}:${e}:${t}`;
|
|
1119
|
-
}
|
|
1120
|
-
class P {
|
|
1121
|
-
constructor(e, t, i) {
|
|
1122
|
-
this.persistence = e, this.auth = t, this.userKey = i;
|
|
1123
|
-
const { config: r, name: s } = this.auth;
|
|
1124
|
-
this.fullUserKey = G(this.userKey, r.apiKey, s), this.fullPersistenceKey = G("persistence", r.apiKey, s), this.boundEventHandler = t._onStorageEvent.bind(t), this.persistence._addListener(this.fullUserKey, this.boundEventHandler);
|
|
1125
|
-
}
|
|
1126
|
-
setCurrentUser(e) {
|
|
1127
|
-
return this.persistence._set(this.fullUserKey, e.toJSON());
|
|
1128
|
-
}
|
|
1129
|
-
async getCurrentUser() {
|
|
1130
|
-
const e = await this.persistence._get(this.fullUserKey);
|
|
1131
|
-
return e ? b._fromJSON(this.auth, e) : null;
|
|
1132
|
-
}
|
|
1133
|
-
removeCurrentUser() {
|
|
1134
|
-
return this.persistence._remove(this.fullUserKey);
|
|
1135
|
-
}
|
|
1136
|
-
savePersistenceForRedirect() {
|
|
1137
|
-
return this.persistence._set(this.fullPersistenceKey, this.persistence.type);
|
|
1138
|
-
}
|
|
1139
|
-
async setPersistence(e) {
|
|
1140
|
-
if (this.persistence === e)
|
|
1141
|
-
return;
|
|
1142
|
-
const t = await this.getCurrentUser();
|
|
1143
|
-
if (await this.removeCurrentUser(), this.persistence = e, t)
|
|
1144
|
-
return this.setCurrentUser(t);
|
|
1145
|
-
}
|
|
1146
|
-
delete() {
|
|
1147
|
-
this.persistence._removeListener(this.fullUserKey, this.boundEventHandler);
|
|
1148
|
-
}
|
|
1149
|
-
static async create(e, t, i = "authUser") {
|
|
1150
|
-
if (!t.length)
|
|
1151
|
-
return new P(v(Ue), e, i);
|
|
1152
|
-
const r = (await Promise.all(t.map(async (l) => {
|
|
1153
|
-
if (await l._isAvailable())
|
|
1154
|
-
return l;
|
|
1155
|
-
}))).filter((l) => l);
|
|
1156
|
-
let s = r[0] || v(Ue);
|
|
1157
|
-
const o = G(i, e.config.apiKey, e.name);
|
|
1158
|
-
let c = null;
|
|
1159
|
-
for (const l of t)
|
|
1160
|
-
try {
|
|
1161
|
-
const d = await l._get(o);
|
|
1162
|
-
if (d) {
|
|
1163
|
-
const h = b._fromJSON(e, d);
|
|
1164
|
-
l !== s && (c = h), s = l;
|
|
1165
|
-
break;
|
|
1166
|
-
}
|
|
1167
|
-
} catch {
|
|
1168
|
-
}
|
|
1169
|
-
const a = r.filter((l) => l._shouldAllowMigration);
|
|
1170
|
-
return !s._shouldAllowMigration || !a.length ? new P(s, e, i) : (s = a[0], c && await s._set(o, c.toJSON()), await Promise.all(t.map(async (l) => {
|
|
1171
|
-
if (l !== s)
|
|
1172
|
-
try {
|
|
1173
|
-
await l._remove(o);
|
|
1174
|
-
} catch {
|
|
1175
|
-
}
|
|
1176
|
-
})), new P(s, e, i));
|
|
1177
|
-
}
|
|
1178
|
-
}
|
|
1179
|
-
/**
|
|
1180
|
-
* @license
|
|
1181
|
-
* Copyright 2020 Google LLC
|
|
1182
|
-
*
|
|
1183
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1184
|
-
* you may not use this file except in compliance with the License.
|
|
1185
|
-
* You may obtain a copy of the License at
|
|
1186
|
-
*
|
|
1187
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1188
|
-
*
|
|
1189
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1190
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1191
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1192
|
-
* See the License for the specific language governing permissions and
|
|
1193
|
-
* limitations under the License.
|
|
1194
|
-
*/
|
|
1195
|
-
function De(n) {
|
|
1196
|
-
const e = n.toLowerCase();
|
|
1197
|
-
if (e.includes("opera/") || e.includes("opr/") || e.includes("opios/"))
|
|
1198
|
-
return "Opera";
|
|
1199
|
-
if (ft(e))
|
|
1200
|
-
return "IEMobile";
|
|
1201
|
-
if (e.includes("msie") || e.includes("trident/"))
|
|
1202
|
-
return "IE";
|
|
1203
|
-
if (e.includes("edge/"))
|
|
1204
|
-
return "Edge";
|
|
1205
|
-
if (dt(e))
|
|
1206
|
-
return "Firefox";
|
|
1207
|
-
if (e.includes("silk/"))
|
|
1208
|
-
return "Silk";
|
|
1209
|
-
if (gt(e))
|
|
1210
|
-
return "Blackberry";
|
|
1211
|
-
if (mt(e))
|
|
1212
|
-
return "Webos";
|
|
1213
|
-
if (Te(e))
|
|
1214
|
-
return "Safari";
|
|
1215
|
-
if ((e.includes("chrome/") || ht(e)) && !e.includes("edge/"))
|
|
1216
|
-
return "Chrome";
|
|
1217
|
-
if (pt(e))
|
|
1218
|
-
return "Android";
|
|
1219
|
-
{
|
|
1220
|
-
const t = /([a-zA-Z\d\.]+)\/[a-zA-Z\d\.]*$/, i = n.match(t);
|
|
1221
|
-
if ((i == null ? void 0 : i.length) === 2)
|
|
1222
|
-
return i[1];
|
|
1223
|
-
}
|
|
1224
|
-
return "Other";
|
|
1225
|
-
}
|
|
1226
|
-
function dt(n = f()) {
|
|
1227
|
-
return /firefox\//i.test(n);
|
|
1228
|
-
}
|
|
1229
|
-
function Te(n = f()) {
|
|
1230
|
-
const e = n.toLowerCase();
|
|
1231
|
-
return e.includes("safari/") && !e.includes("chrome/") && !e.includes("crios/") && !e.includes("android");
|
|
1232
|
-
}
|
|
1233
|
-
function ht(n = f()) {
|
|
1234
|
-
return /crios\//i.test(n);
|
|
1235
|
-
}
|
|
1236
|
-
function ft(n = f()) {
|
|
1237
|
-
return /iemobile/i.test(n);
|
|
1238
|
-
}
|
|
1239
|
-
function pt(n = f()) {
|
|
1240
|
-
return /android/i.test(n);
|
|
1241
|
-
}
|
|
1242
|
-
function gt(n = f()) {
|
|
1243
|
-
return /blackberry/i.test(n);
|
|
1244
|
-
}
|
|
1245
|
-
function mt(n = f()) {
|
|
1246
|
-
return /webos/i.test(n);
|
|
1247
|
-
}
|
|
1248
|
-
function ne(n = f()) {
|
|
1249
|
-
return /iphone|ipad|ipod/i.test(n) || /macintosh/i.test(n) && /mobile/i.test(n);
|
|
1250
|
-
}
|
|
1251
|
-
function Un(n = f()) {
|
|
1252
|
-
var e;
|
|
1253
|
-
return ne(n) && !!(!((e = window.navigator) === null || e === void 0) && e.standalone);
|
|
1254
|
-
}
|
|
1255
|
-
function Dn() {
|
|
1256
|
-
return on() && document.documentMode === 10;
|
|
1257
|
-
}
|
|
1258
|
-
function _t(n = f()) {
|
|
1259
|
-
return ne(n) || pt(n) || mt(n) || gt(n) || /windows phone/i.test(n) || ft(n);
|
|
1260
|
-
}
|
|
1261
|
-
function Fn() {
|
|
1262
|
-
try {
|
|
1263
|
-
return !!(window && window !== window.top);
|
|
1264
|
-
} catch {
|
|
1265
|
-
return !1;
|
|
1266
|
-
}
|
|
1267
|
-
}
|
|
1268
|
-
/**
|
|
1269
|
-
* @license
|
|
1270
|
-
* Copyright 2020 Google LLC
|
|
1271
|
-
*
|
|
1272
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1273
|
-
* you may not use this file except in compliance with the License.
|
|
1274
|
-
* You may obtain a copy of the License at
|
|
1275
|
-
*
|
|
1276
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1277
|
-
*
|
|
1278
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1279
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1280
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1281
|
-
* See the License for the specific language governing permissions and
|
|
1282
|
-
* limitations under the License.
|
|
1283
|
-
*/
|
|
1284
|
-
function vt(n, e = []) {
|
|
1285
|
-
let t;
|
|
1286
|
-
switch (n) {
|
|
1287
|
-
case "Browser":
|
|
1288
|
-
t = De(f());
|
|
1289
|
-
break;
|
|
1290
|
-
case "Worker":
|
|
1291
|
-
t = `${De(f())}-${n}`;
|
|
1292
|
-
break;
|
|
1293
|
-
default:
|
|
1294
|
-
t = n;
|
|
1295
|
-
}
|
|
1296
|
-
const i = e.length ? e.join(",") : "FirebaseCore-web";
|
|
1297
|
-
return `${t}/JsCore/${F}/${i}`;
|
|
1298
|
-
}
|
|
1299
|
-
async function It(n, e) {
|
|
1300
|
-
return W(n, "GET", "/v2/recaptchaConfig", Ie(n, e));
|
|
1301
|
-
}
|
|
1302
|
-
function Fe(n) {
|
|
1303
|
-
return n !== void 0 && n.enterprise !== void 0;
|
|
1304
|
-
}
|
|
1305
|
-
class yt {
|
|
1306
|
-
constructor(e) {
|
|
1307
|
-
if (this.siteKey = "", this.emailPasswordEnabled = !1, e.recaptchaKey === void 0)
|
|
1308
|
-
throw new Error("recaptchaKey undefined");
|
|
1309
|
-
this.siteKey = e.recaptchaKey.split("/")[3], this.emailPasswordEnabled = e.recaptchaEnforcementState.some((t) => t.provider === "EMAIL_PASSWORD_PROVIDER" && t.enforcementState !== "OFF");
|
|
1310
|
-
}
|
|
1311
|
-
}
|
|
1312
|
-
/**
|
|
1313
|
-
* @license
|
|
1314
|
-
* Copyright 2020 Google LLC
|
|
1315
|
-
*
|
|
1316
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1317
|
-
* you may not use this file except in compliance with the License.
|
|
1318
|
-
* You may obtain a copy of the License at
|
|
1319
|
-
*
|
|
1320
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1321
|
-
*
|
|
1322
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1323
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1324
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1325
|
-
* See the License for the specific language governing permissions and
|
|
1326
|
-
* limitations under the License.
|
|
1327
|
-
*/
|
|
1328
|
-
function xn() {
|
|
1329
|
-
var n, e;
|
|
1330
|
-
return (e = (n = document.getElementsByTagName("head")) === null || n === void 0 ? void 0 : n[0]) !== null && e !== void 0 ? e : document;
|
|
1331
|
-
}
|
|
1332
|
-
function Tt(n) {
|
|
1333
|
-
return new Promise((e, t) => {
|
|
1334
|
-
const i = document.createElement("script");
|
|
1335
|
-
i.setAttribute("src", n), i.onload = e, i.onerror = (r) => {
|
|
1336
|
-
const s = g(
|
|
1337
|
-
"internal-error"
|
|
1338
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
1339
|
-
);
|
|
1340
|
-
s.customData = r, t(s);
|
|
1341
|
-
}, i.type = "text/javascript", i.charset = "UTF-8", xn().appendChild(i);
|
|
1342
|
-
});
|
|
1343
|
-
}
|
|
1344
|
-
function Vn(n) {
|
|
1345
|
-
return `__${n}${Math.floor(Math.random() * 1e6)}`;
|
|
1346
|
-
}
|
|
1347
|
-
const Wn = "https://www.google.com/recaptcha/enterprise.js?render=", Hn = "recaptcha-enterprise", Kn = "NO_RECAPTCHA";
|
|
1348
|
-
class $n {
|
|
1349
|
-
/**
|
|
1350
|
-
*
|
|
1351
|
-
* @param authExtern - The corresponding Firebase {@link Auth} instance.
|
|
1352
|
-
*
|
|
1353
|
-
*/
|
|
1354
|
-
constructor(e) {
|
|
1355
|
-
this.type = Hn, this.auth = H(e);
|
|
1356
|
-
}
|
|
1357
|
-
/**
|
|
1358
|
-
* Executes the verification process.
|
|
1359
|
-
*
|
|
1360
|
-
* @returns A Promise for a token that can be used to assert the validity of a request.
|
|
1361
|
-
*/
|
|
1362
|
-
async verify(e = "verify", t = !1) {
|
|
1363
|
-
async function i(s) {
|
|
1364
|
-
if (!t) {
|
|
1365
|
-
if (s.tenantId == null && s._agentRecaptchaConfig != null)
|
|
1366
|
-
return s._agentRecaptchaConfig.siteKey;
|
|
1367
|
-
if (s.tenantId != null && s._tenantRecaptchaConfigs[s.tenantId] !== void 0)
|
|
1368
|
-
return s._tenantRecaptchaConfigs[s.tenantId].siteKey;
|
|
1369
|
-
}
|
|
1370
|
-
return new Promise(async (o, c) => {
|
|
1371
|
-
It(s, {
|
|
1372
|
-
clientType: "CLIENT_TYPE_WEB",
|
|
1373
|
-
version: "RECAPTCHA_ENTERPRISE"
|
|
1374
|
-
/* RecaptchaVersion.ENTERPRISE */
|
|
1375
|
-
}).then((a) => {
|
|
1376
|
-
if (a.recaptchaKey === void 0)
|
|
1377
|
-
c(new Error("recaptcha Enterprise site key undefined"));
|
|
1378
|
-
else {
|
|
1379
|
-
const l = new yt(a);
|
|
1380
|
-
return s.tenantId == null ? s._agentRecaptchaConfig = l : s._tenantRecaptchaConfigs[s.tenantId] = l, o(l.siteKey);
|
|
1381
|
-
}
|
|
1382
|
-
}).catch((a) => {
|
|
1383
|
-
c(a);
|
|
1384
|
-
});
|
|
1385
|
-
});
|
|
1386
|
-
}
|
|
1387
|
-
function r(s, o, c) {
|
|
1388
|
-
const a = window.grecaptcha;
|
|
1389
|
-
Fe(a) ? a.enterprise.ready(() => {
|
|
1390
|
-
a.enterprise.execute(s, { action: e }).then((l) => {
|
|
1391
|
-
o(l);
|
|
1392
|
-
}).catch(() => {
|
|
1393
|
-
o(Kn);
|
|
1394
|
-
});
|
|
1395
|
-
}) : c(Error("No reCAPTCHA enterprise script loaded."));
|
|
1396
|
-
}
|
|
1397
|
-
return new Promise((s, o) => {
|
|
1398
|
-
i(this.auth).then((c) => {
|
|
1399
|
-
if (!t && Fe(window.grecaptcha))
|
|
1400
|
-
r(c, s, o);
|
|
1401
|
-
else {
|
|
1402
|
-
if (typeof window > "u") {
|
|
1403
|
-
o(new Error("RecaptchaVerifier is only supported in browser"));
|
|
1404
|
-
return;
|
|
1405
|
-
}
|
|
1406
|
-
Tt(Wn + c).then(() => {
|
|
1407
|
-
r(c, s, o);
|
|
1408
|
-
}).catch((a) => {
|
|
1409
|
-
o(a);
|
|
1410
|
-
});
|
|
1411
|
-
}
|
|
1412
|
-
}).catch((c) => {
|
|
1413
|
-
o(c);
|
|
1414
|
-
});
|
|
1415
|
-
});
|
|
1416
|
-
}
|
|
1417
|
-
}
|
|
1418
|
-
/**
|
|
1419
|
-
* @license
|
|
1420
|
-
* Copyright 2022 Google LLC
|
|
1421
|
-
*
|
|
1422
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1423
|
-
* you may not use this file except in compliance with the License.
|
|
1424
|
-
* You may obtain a copy of the License at
|
|
1425
|
-
*
|
|
1426
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1427
|
-
*
|
|
1428
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1429
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1430
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1431
|
-
* See the License for the specific language governing permissions and
|
|
1432
|
-
* limitations under the License.
|
|
1433
|
-
*/
|
|
1434
|
-
class Bn {
|
|
1435
|
-
constructor(e) {
|
|
1436
|
-
this.auth = e, this.queue = [];
|
|
1437
|
-
}
|
|
1438
|
-
pushCallback(e, t) {
|
|
1439
|
-
const i = (s) => new Promise((o, c) => {
|
|
1440
|
-
try {
|
|
1441
|
-
const a = e(s);
|
|
1442
|
-
o(a);
|
|
1443
|
-
} catch (a) {
|
|
1444
|
-
c(a);
|
|
1445
|
-
}
|
|
1446
|
-
});
|
|
1447
|
-
i.onAbort = t, this.queue.push(i);
|
|
1448
|
-
const r = this.queue.length - 1;
|
|
1449
|
-
return () => {
|
|
1450
|
-
this.queue[r] = () => Promise.resolve();
|
|
1451
|
-
};
|
|
1452
|
-
}
|
|
1453
|
-
async runMiddleware(e) {
|
|
1454
|
-
if (this.auth.currentUser === e)
|
|
1455
|
-
return;
|
|
1456
|
-
const t = [];
|
|
1457
|
-
try {
|
|
1458
|
-
for (const i of this.queue)
|
|
1459
|
-
await i(e), i.onAbort && t.push(i.onAbort);
|
|
1460
|
-
} catch (i) {
|
|
1461
|
-
t.reverse();
|
|
1462
|
-
for (const r of t)
|
|
1463
|
-
try {
|
|
1464
|
-
r();
|
|
1465
|
-
} catch {
|
|
1466
|
-
}
|
|
1467
|
-
throw this.auth._errorFactory.create("login-blocked", {
|
|
1468
|
-
originalMessage: i == null ? void 0 : i.message
|
|
1469
|
-
});
|
|
1470
|
-
}
|
|
1471
|
-
}
|
|
1472
|
-
}
|
|
1473
|
-
/**
|
|
1474
|
-
* @license
|
|
1475
|
-
* Copyright 2020 Google LLC
|
|
1476
|
-
*
|
|
1477
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1478
|
-
* you may not use this file except in compliance with the License.
|
|
1479
|
-
* You may obtain a copy of the License at
|
|
1480
|
-
*
|
|
1481
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1482
|
-
*
|
|
1483
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1484
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1485
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1486
|
-
* See the License for the specific language governing permissions and
|
|
1487
|
-
* limitations under the License.
|
|
1488
|
-
*/
|
|
1489
|
-
class zn {
|
|
1490
|
-
constructor(e, t, i, r) {
|
|
1491
|
-
this.app = e, this.heartbeatServiceProvider = t, this.appCheckServiceProvider = i, this.config = r, this.currentUser = null, this.emulatorConfig = null, this.operations = Promise.resolve(), this.authStateSubscription = new xe(this), this.idTokenSubscription = new xe(this), this.beforeStateQueue = new Bn(this), this.redirectUser = null, this.isProactiveRefreshEnabled = !1, this._canInitEmulator = !0, this._isInitialized = !1, this._deleted = !1, this._initializationPromise = null, this._popupRedirectResolver = null, this._errorFactory = rt, this._agentRecaptchaConfig = null, this._tenantRecaptchaConfigs = {}, this.lastNotifiedUid = void 0, this.languageCode = null, this.tenantId = null, this.settings = { appVerificationDisabledForTesting: !1 }, this.frameworks = [], this.name = e.name, this.clientVersion = r.sdkClientVersion;
|
|
1492
|
-
}
|
|
1493
|
-
_initializeWithPersistence(e, t) {
|
|
1494
|
-
return t && (this._popupRedirectResolver = v(t)), this._initializationPromise = this.queue(async () => {
|
|
1495
|
-
var i, r;
|
|
1496
|
-
if (!this._deleted && (this.persistenceManager = await P.create(this, e), !this._deleted)) {
|
|
1497
|
-
if (!((i = this._popupRedirectResolver) === null || i === void 0) && i._shouldInitProactively)
|
|
1498
|
-
try {
|
|
1499
|
-
await this._popupRedirectResolver._initialize(this);
|
|
1500
|
-
} catch {
|
|
1501
|
-
}
|
|
1502
|
-
await this.initializeCurrentUser(t), this.lastNotifiedUid = ((r = this.currentUser) === null || r === void 0 ? void 0 : r.uid) || null, !this._deleted && (this._isInitialized = !0);
|
|
1503
|
-
}
|
|
1504
|
-
}), this._initializationPromise;
|
|
1505
|
-
}
|
|
1506
|
-
/**
|
|
1507
|
-
* If the persistence is changed in another window, the user manager will let us know
|
|
1508
|
-
*/
|
|
1509
|
-
async _onStorageEvent() {
|
|
1510
|
-
if (this._deleted)
|
|
1511
|
-
return;
|
|
1512
|
-
const e = await this.assertedPersistence.getCurrentUser();
|
|
1513
|
-
if (!(!this.currentUser && !e)) {
|
|
1514
|
-
if (this.currentUser && e && this.currentUser.uid === e.uid) {
|
|
1515
|
-
this._currentUser._assign(e), await this.currentUser.getIdToken();
|
|
1516
|
-
return;
|
|
1517
|
-
}
|
|
1518
|
-
await this._updateCurrentUser(
|
|
1519
|
-
e,
|
|
1520
|
-
/* skipBeforeStateCallbacks */
|
|
1521
|
-
!0
|
|
1522
|
-
);
|
|
1523
|
-
}
|
|
1524
|
-
}
|
|
1525
|
-
async initializeCurrentUser(e) {
|
|
1526
|
-
var t;
|
|
1527
|
-
const i = await this.assertedPersistence.getCurrentUser();
|
|
1528
|
-
let r = i, s = !1;
|
|
1529
|
-
if (e && this.config.authDomain) {
|
|
1530
|
-
await this.getOrInitRedirectPersistenceManager();
|
|
1531
|
-
const o = (t = this.redirectUser) === null || t === void 0 ? void 0 : t._redirectEventId, c = r == null ? void 0 : r._redirectEventId, a = await this.tryRedirectSignIn(e);
|
|
1532
|
-
(!o || o === c) && (a != null && a.user) && (r = a.user, s = !0);
|
|
1533
|
-
}
|
|
1534
|
-
if (!r)
|
|
1535
|
-
return this.directlySetCurrentUser(null);
|
|
1536
|
-
if (!r._redirectEventId) {
|
|
1537
|
-
if (s)
|
|
1538
|
-
try {
|
|
1539
|
-
await this.beforeStateQueue.runMiddleware(r);
|
|
1540
|
-
} catch (o) {
|
|
1541
|
-
r = i, this._popupRedirectResolver._overrideRedirectResult(this, () => Promise.reject(o));
|
|
1542
|
-
}
|
|
1543
|
-
return r ? this.reloadAndSetCurrentUserOrClear(r) : this.directlySetCurrentUser(null);
|
|
1544
|
-
}
|
|
1545
|
-
return u(
|
|
1546
|
-
this._popupRedirectResolver,
|
|
1547
|
-
this,
|
|
1548
|
-
"argument-error"
|
|
1549
|
-
/* AuthErrorCode.ARGUMENT_ERROR */
|
|
1550
|
-
), await this.getOrInitRedirectPersistenceManager(), this.redirectUser && this.redirectUser._redirectEventId === r._redirectEventId ? this.directlySetCurrentUser(r) : this.reloadAndSetCurrentUserOrClear(r);
|
|
1551
|
-
}
|
|
1552
|
-
async tryRedirectSignIn(e) {
|
|
1553
|
-
let t = null;
|
|
1554
|
-
try {
|
|
1555
|
-
t = await this._popupRedirectResolver._completeRedirectFn(this, e, !0);
|
|
1556
|
-
} catch {
|
|
1557
|
-
await this._setRedirectUser(null);
|
|
1558
|
-
}
|
|
1559
|
-
return t;
|
|
1560
|
-
}
|
|
1561
|
-
async reloadAndSetCurrentUserOrClear(e) {
|
|
1562
|
-
try {
|
|
1563
|
-
await Q(e);
|
|
1564
|
-
} catch (t) {
|
|
1565
|
-
if ((t == null ? void 0 : t.code) !== "auth/network-request-failed")
|
|
1566
|
-
return this.directlySetCurrentUser(null);
|
|
1567
|
-
}
|
|
1568
|
-
return this.directlySetCurrentUser(e);
|
|
1569
|
-
}
|
|
1570
|
-
useDeviceLanguage() {
|
|
1571
|
-
this.languageCode = Tn();
|
|
1572
|
-
}
|
|
1573
|
-
async _delete() {
|
|
1574
|
-
this._deleted = !0;
|
|
1575
|
-
}
|
|
1576
|
-
async updateCurrentUser(e) {
|
|
1577
|
-
const t = e ? O(e) : null;
|
|
1578
|
-
return t && u(
|
|
1579
|
-
t.auth.config.apiKey === this.config.apiKey,
|
|
1580
|
-
this,
|
|
1581
|
-
"invalid-user-token"
|
|
1582
|
-
/* AuthErrorCode.INVALID_AUTH */
|
|
1583
|
-
), this._updateCurrentUser(t && t._clone(this));
|
|
1584
|
-
}
|
|
1585
|
-
async _updateCurrentUser(e, t = !1) {
|
|
1586
|
-
if (!this._deleted)
|
|
1587
|
-
return e && u(
|
|
1588
|
-
this.tenantId === e.tenantId,
|
|
1589
|
-
this,
|
|
1590
|
-
"tenant-id-mismatch"
|
|
1591
|
-
/* AuthErrorCode.TENANT_ID_MISMATCH */
|
|
1592
|
-
), t || await this.beforeStateQueue.runMiddleware(e), this.queue(async () => {
|
|
1593
|
-
await this.directlySetCurrentUser(e), this.notifyAuthListeners();
|
|
1594
|
-
});
|
|
1595
|
-
}
|
|
1596
|
-
async signOut() {
|
|
1597
|
-
return await this.beforeStateQueue.runMiddleware(null), (this.redirectPersistenceManager || this._popupRedirectResolver) && await this._setRedirectUser(null), this._updateCurrentUser(
|
|
1598
|
-
null,
|
|
1599
|
-
/* skipBeforeStateCallbacks */
|
|
1600
|
-
!0
|
|
1601
|
-
);
|
|
1602
|
-
}
|
|
1603
|
-
setPersistence(e) {
|
|
1604
|
-
return this.queue(async () => {
|
|
1605
|
-
await this.assertedPersistence.setPersistence(v(e));
|
|
1606
|
-
});
|
|
1607
|
-
}
|
|
1608
|
-
async initializeRecaptchaConfig() {
|
|
1609
|
-
const e = await It(this, {
|
|
1610
|
-
clientType: "CLIENT_TYPE_WEB",
|
|
1611
|
-
version: "RECAPTCHA_ENTERPRISE"
|
|
1612
|
-
/* RecaptchaVersion.ENTERPRISE */
|
|
1613
|
-
}), t = new yt(e);
|
|
1614
|
-
this.tenantId == null ? this._agentRecaptchaConfig = t : this._tenantRecaptchaConfigs[this.tenantId] = t, t.emailPasswordEnabled && new $n(this).verify();
|
|
1615
|
-
}
|
|
1616
|
-
_getRecaptchaConfig() {
|
|
1617
|
-
return this.tenantId == null ? this._agentRecaptchaConfig : this._tenantRecaptchaConfigs[this.tenantId];
|
|
1618
|
-
}
|
|
1619
|
-
_getPersistence() {
|
|
1620
|
-
return this.assertedPersistence.persistence.type;
|
|
1621
|
-
}
|
|
1622
|
-
_updateErrorMap(e) {
|
|
1623
|
-
this._errorFactory = new pe("auth", "Firebase", e());
|
|
1624
|
-
}
|
|
1625
|
-
onAuthStateChanged(e, t, i) {
|
|
1626
|
-
return this.registerStateListener(this.authStateSubscription, e, t, i);
|
|
1627
|
-
}
|
|
1628
|
-
beforeAuthStateChanged(e, t) {
|
|
1629
|
-
return this.beforeStateQueue.pushCallback(e, t);
|
|
1630
|
-
}
|
|
1631
|
-
onIdTokenChanged(e, t, i) {
|
|
1632
|
-
return this.registerStateListener(this.idTokenSubscription, e, t, i);
|
|
1633
|
-
}
|
|
1634
|
-
toJSON() {
|
|
1635
|
-
var e;
|
|
1636
|
-
return {
|
|
1637
|
-
apiKey: this.config.apiKey,
|
|
1638
|
-
authDomain: this.config.authDomain,
|
|
1639
|
-
appName: this.name,
|
|
1640
|
-
currentUser: (e = this._currentUser) === null || e === void 0 ? void 0 : e.toJSON()
|
|
1641
|
-
};
|
|
1642
|
-
}
|
|
1643
|
-
async _setRedirectUser(e, t) {
|
|
1644
|
-
const i = await this.getOrInitRedirectPersistenceManager(t);
|
|
1645
|
-
return e === null ? i.removeCurrentUser() : i.setCurrentUser(e);
|
|
1646
|
-
}
|
|
1647
|
-
async getOrInitRedirectPersistenceManager(e) {
|
|
1648
|
-
if (!this.redirectPersistenceManager) {
|
|
1649
|
-
const t = e && v(e) || this._popupRedirectResolver;
|
|
1650
|
-
u(
|
|
1651
|
-
t,
|
|
1652
|
-
this,
|
|
1653
|
-
"argument-error"
|
|
1654
|
-
/* AuthErrorCode.ARGUMENT_ERROR */
|
|
1655
|
-
), this.redirectPersistenceManager = await P.create(
|
|
1656
|
-
this,
|
|
1657
|
-
[v(t._redirectPersistence)],
|
|
1658
|
-
"redirectUser"
|
|
1659
|
-
/* KeyName.REDIRECT_USER */
|
|
1660
|
-
), this.redirectUser = await this.redirectPersistenceManager.getCurrentUser();
|
|
1661
|
-
}
|
|
1662
|
-
return this.redirectPersistenceManager;
|
|
1663
|
-
}
|
|
1664
|
-
async _redirectUserForId(e) {
|
|
1665
|
-
var t, i;
|
|
1666
|
-
return this._isInitialized && await this.queue(async () => {
|
|
1667
|
-
}), ((t = this._currentUser) === null || t === void 0 ? void 0 : t._redirectEventId) === e ? this._currentUser : ((i = this.redirectUser) === null || i === void 0 ? void 0 : i._redirectEventId) === e ? this.redirectUser : null;
|
|
1668
|
-
}
|
|
1669
|
-
async _persistUserIfCurrent(e) {
|
|
1670
|
-
if (e === this.currentUser)
|
|
1671
|
-
return this.queue(async () => this.directlySetCurrentUser(e));
|
|
1672
|
-
}
|
|
1673
|
-
/** Notifies listeners only if the user is current */
|
|
1674
|
-
_notifyListenersIfCurrent(e) {
|
|
1675
|
-
e === this.currentUser && this.notifyAuthListeners();
|
|
1676
|
-
}
|
|
1677
|
-
_key() {
|
|
1678
|
-
return `${this.config.authDomain}:${this.config.apiKey}:${this.name}`;
|
|
1679
|
-
}
|
|
1680
|
-
_startProactiveRefresh() {
|
|
1681
|
-
this.isProactiveRefreshEnabled = !0, this.currentUser && this._currentUser._startProactiveRefresh();
|
|
1682
|
-
}
|
|
1683
|
-
_stopProactiveRefresh() {
|
|
1684
|
-
this.isProactiveRefreshEnabled = !1, this.currentUser && this._currentUser._stopProactiveRefresh();
|
|
1685
|
-
}
|
|
1686
|
-
/** Returns the current user cast as the internal type */
|
|
1687
|
-
get _currentUser() {
|
|
1688
|
-
return this.currentUser;
|
|
1689
|
-
}
|
|
1690
|
-
notifyAuthListeners() {
|
|
1691
|
-
var e, t;
|
|
1692
|
-
if (!this._isInitialized)
|
|
1693
|
-
return;
|
|
1694
|
-
this.idTokenSubscription.next(this.currentUser);
|
|
1695
|
-
const i = (t = (e = this.currentUser) === null || e === void 0 ? void 0 : e.uid) !== null && t !== void 0 ? t : null;
|
|
1696
|
-
this.lastNotifiedUid !== i && (this.lastNotifiedUid = i, this.authStateSubscription.next(this.currentUser));
|
|
1697
|
-
}
|
|
1698
|
-
registerStateListener(e, t, i, r) {
|
|
1699
|
-
if (this._deleted)
|
|
1700
|
-
return () => {
|
|
1701
|
-
};
|
|
1702
|
-
const s = typeof t == "function" ? t : t.next.bind(t), o = this._isInitialized ? Promise.resolve() : this._initializationPromise;
|
|
1703
|
-
return u(
|
|
1704
|
-
o,
|
|
1705
|
-
this,
|
|
1706
|
-
"internal-error"
|
|
1707
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
1708
|
-
), o.then(() => s(this.currentUser)), typeof t == "function" ? e.addObserver(t, i, r) : e.addObserver(t);
|
|
1709
|
-
}
|
|
1710
|
-
/**
|
|
1711
|
-
* Unprotected (from race conditions) method to set the current user. This
|
|
1712
|
-
* should only be called from within a queued callback. This is necessary
|
|
1713
|
-
* because the queue shouldn't rely on another queued callback.
|
|
1714
|
-
*/
|
|
1715
|
-
async directlySetCurrentUser(e) {
|
|
1716
|
-
this.currentUser && this.currentUser !== e && this._currentUser._stopProactiveRefresh(), e && this.isProactiveRefreshEnabled && e._startProactiveRefresh(), this.currentUser = e, e ? await this.assertedPersistence.setCurrentUser(e) : await this.assertedPersistence.removeCurrentUser();
|
|
1717
|
-
}
|
|
1718
|
-
queue(e) {
|
|
1719
|
-
return this.operations = this.operations.then(e, e), this.operations;
|
|
1720
|
-
}
|
|
1721
|
-
get assertedPersistence() {
|
|
1722
|
-
return u(
|
|
1723
|
-
this.persistenceManager,
|
|
1724
|
-
this,
|
|
1725
|
-
"internal-error"
|
|
1726
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
1727
|
-
), this.persistenceManager;
|
|
1728
|
-
}
|
|
1729
|
-
_logFramework(e) {
|
|
1730
|
-
!e || this.frameworks.includes(e) || (this.frameworks.push(e), this.frameworks.sort(), this.clientVersion = vt(this.config.clientPlatform, this._getFrameworks()));
|
|
1731
|
-
}
|
|
1732
|
-
_getFrameworks() {
|
|
1733
|
-
return this.frameworks;
|
|
1734
|
-
}
|
|
1735
|
-
async _getAdditionalHeaders() {
|
|
1736
|
-
var e;
|
|
1737
|
-
const t = {
|
|
1738
|
-
"X-Client-Version": this.clientVersion
|
|
1739
|
-
};
|
|
1740
|
-
this.app.options.appId && (t[
|
|
1741
|
-
"X-Firebase-gmpid"
|
|
1742
|
-
/* HttpHeader.X_FIREBASE_GMPID */
|
|
1743
|
-
] = this.app.options.appId);
|
|
1744
|
-
const i = await ((e = this.heartbeatServiceProvider.getImmediate({
|
|
1745
|
-
optional: !0
|
|
1746
|
-
})) === null || e === void 0 ? void 0 : e.getHeartbeatsHeader());
|
|
1747
|
-
i && (t[
|
|
1748
|
-
"X-Firebase-Client"
|
|
1749
|
-
/* HttpHeader.X_FIREBASE_CLIENT */
|
|
1750
|
-
] = i);
|
|
1751
|
-
const r = await this._getAppCheckToken();
|
|
1752
|
-
return r && (t[
|
|
1753
|
-
"X-Firebase-AppCheck"
|
|
1754
|
-
/* HttpHeader.X_FIREBASE_APP_CHECK */
|
|
1755
|
-
] = r), t;
|
|
1756
|
-
}
|
|
1757
|
-
async _getAppCheckToken() {
|
|
1758
|
-
var e;
|
|
1759
|
-
const t = await ((e = this.appCheckServiceProvider.getImmediate({ optional: !0 })) === null || e === void 0 ? void 0 : e.getToken());
|
|
1760
|
-
return t != null && t.error && _n(`Error while retrieving App Check token: ${t.error}`), t == null ? void 0 : t.token;
|
|
1761
|
-
}
|
|
1762
|
-
}
|
|
1763
|
-
function H(n) {
|
|
1764
|
-
return O(n);
|
|
1765
|
-
}
|
|
1766
|
-
class xe {
|
|
1767
|
-
constructor(e) {
|
|
1768
|
-
this.auth = e, this.observer = null, this.addObserver = Zt((t) => this.observer = t);
|
|
1769
|
-
}
|
|
1770
|
-
get next() {
|
|
1771
|
-
return u(
|
|
1772
|
-
this.observer,
|
|
1773
|
-
this.auth,
|
|
1774
|
-
"internal-error"
|
|
1775
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
1776
|
-
), this.observer.next.bind(this.observer);
|
|
1777
|
-
}
|
|
1778
|
-
}
|
|
1779
|
-
/**
|
|
1780
|
-
* @license
|
|
1781
|
-
* Copyright 2020 Google LLC
|
|
1782
|
-
*
|
|
1783
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1784
|
-
* you may not use this file except in compliance with the License.
|
|
1785
|
-
* You may obtain a copy of the License at
|
|
1786
|
-
*
|
|
1787
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1788
|
-
*
|
|
1789
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1790
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1791
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1792
|
-
* See the License for the specific language governing permissions and
|
|
1793
|
-
* limitations under the License.
|
|
1794
|
-
*/
|
|
1795
|
-
function jn(n, e) {
|
|
1796
|
-
const t = tt(n, "auth");
|
|
1797
|
-
if (t.isInitialized()) {
|
|
1798
|
-
const r = t.getImmediate(), s = t.getOptions();
|
|
1799
|
-
if (nn(s, e ?? {}))
|
|
1800
|
-
return r;
|
|
1801
|
-
I(
|
|
1802
|
-
r,
|
|
1803
|
-
"already-initialized"
|
|
1804
|
-
/* AuthErrorCode.ALREADY_INITIALIZED */
|
|
1805
|
-
);
|
|
1806
|
-
}
|
|
1807
|
-
return t.initialize({ options: e });
|
|
1808
|
-
}
|
|
1809
|
-
function qn(n, e) {
|
|
1810
|
-
const t = (e == null ? void 0 : e.persistence) || [], i = (Array.isArray(t) ? t : [t]).map(v);
|
|
1811
|
-
e != null && e.errorMap && n._updateErrorMap(e.errorMap), n._initializeWithPersistence(i, e == null ? void 0 : e.popupRedirectResolver);
|
|
1812
|
-
}
|
|
1813
|
-
function Gn(n, e, t) {
|
|
1814
|
-
const i = H(n);
|
|
1815
|
-
u(
|
|
1816
|
-
i._canInitEmulator,
|
|
1817
|
-
i,
|
|
1818
|
-
"emulator-config-failed"
|
|
1819
|
-
/* AuthErrorCode.EMULATOR_CONFIG_FAILED */
|
|
1820
|
-
), u(
|
|
1821
|
-
/^https?:\/\//.test(e),
|
|
1822
|
-
i,
|
|
1823
|
-
"invalid-emulator-scheme"
|
|
1824
|
-
/* AuthErrorCode.INVALID_EMULATOR_SCHEME */
|
|
1825
|
-
);
|
|
1826
|
-
const r = !!(t != null && t.disableWarnings), s = wt(e), { host: o, port: c } = Jn(e), a = c === null ? "" : `:${c}`;
|
|
1827
|
-
i.config.emulator = { url: `${s}//${o}${a}/` }, i.settings.appVerificationDisabledForTesting = !0, i.emulatorConfig = Object.freeze({
|
|
1828
|
-
host: o,
|
|
1829
|
-
port: c,
|
|
1830
|
-
protocol: s.replace(":", ""),
|
|
1831
|
-
options: Object.freeze({ disableWarnings: r })
|
|
1832
|
-
}), r || Xn();
|
|
1833
|
-
}
|
|
1834
|
-
function wt(n) {
|
|
1835
|
-
const e = n.indexOf(":");
|
|
1836
|
-
return e < 0 ? "" : n.substr(0, e + 1);
|
|
1837
|
-
}
|
|
1838
|
-
function Jn(n) {
|
|
1839
|
-
const e = wt(n), t = /(\/\/)?([^?#/]+)/.exec(n.substr(e.length));
|
|
1840
|
-
if (!t)
|
|
1841
|
-
return { host: "", port: null };
|
|
1842
|
-
const i = t[2].split("@").pop() || "", r = /^(\[[^\]]+\])(:|$)/.exec(i);
|
|
1843
|
-
if (r) {
|
|
1844
|
-
const s = r[1];
|
|
1845
|
-
return { host: s, port: Ve(i.substr(s.length + 1)) };
|
|
1846
|
-
} else {
|
|
1847
|
-
const [s, o] = i.split(":");
|
|
1848
|
-
return { host: s, port: Ve(o) };
|
|
1849
|
-
}
|
|
1850
|
-
}
|
|
1851
|
-
function Ve(n) {
|
|
1852
|
-
if (!n)
|
|
1853
|
-
return null;
|
|
1854
|
-
const e = Number(n);
|
|
1855
|
-
return isNaN(e) ? null : e;
|
|
1856
|
-
}
|
|
1857
|
-
function Xn() {
|
|
1858
|
-
function n() {
|
|
1859
|
-
const e = document.createElement("p"), t = e.style;
|
|
1860
|
-
e.innerText = "Running in emulator mode. Do not use with production credentials.", t.position = "fixed", t.width = "100%", t.backgroundColor = "#ffffff", t.border = ".1em solid #000000", t.color = "#b50000", t.bottom = "0px", t.left = "0px", t.margin = "0px", t.zIndex = "10000", t.textAlign = "center", e.classList.add("firebase-emulator-warning"), document.body.appendChild(e);
|
|
1861
|
-
}
|
|
1862
|
-
typeof console < "u" && typeof console.info == "function" && console.info("WARNING: You are using the Auth Emulator, which is intended for local testing only. Do not use with production credentials."), typeof window < "u" && typeof document < "u" && (document.readyState === "loading" ? window.addEventListener("DOMContentLoaded", n) : n());
|
|
1863
|
-
}
|
|
1864
|
-
/**
|
|
1865
|
-
* @license
|
|
1866
|
-
* Copyright 2020 Google LLC
|
|
1867
|
-
*
|
|
1868
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1869
|
-
* you may not use this file except in compliance with the License.
|
|
1870
|
-
* You may obtain a copy of the License at
|
|
1871
|
-
*
|
|
1872
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1873
|
-
*
|
|
1874
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1875
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1876
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1877
|
-
* See the License for the specific language governing permissions and
|
|
1878
|
-
* limitations under the License.
|
|
1879
|
-
*/
|
|
1880
|
-
class Et {
|
|
1881
|
-
/** @internal */
|
|
1882
|
-
constructor(e, t) {
|
|
1883
|
-
this.providerId = e, this.signInMethod = t;
|
|
1884
|
-
}
|
|
1885
|
-
/**
|
|
1886
|
-
* Returns a JSON-serializable representation of this object.
|
|
1887
|
-
*
|
|
1888
|
-
* @returns a JSON-serializable representation of this object.
|
|
1889
|
-
*/
|
|
1890
|
-
toJSON() {
|
|
1891
|
-
return _("not implemented");
|
|
1892
|
-
}
|
|
1893
|
-
/** @internal */
|
|
1894
|
-
_getIdTokenResponse(e) {
|
|
1895
|
-
return _("not implemented");
|
|
1896
|
-
}
|
|
1897
|
-
/** @internal */
|
|
1898
|
-
_linkToIdToken(e, t) {
|
|
1899
|
-
return _("not implemented");
|
|
1900
|
-
}
|
|
1901
|
-
/** @internal */
|
|
1902
|
-
_getReauthenticationResolver(e) {
|
|
1903
|
-
return _("not implemented");
|
|
1904
|
-
}
|
|
1905
|
-
}
|
|
1906
|
-
/**
|
|
1907
|
-
* @license
|
|
1908
|
-
* Copyright 2020 Google LLC
|
|
1909
|
-
*
|
|
1910
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1911
|
-
* you may not use this file except in compliance with the License.
|
|
1912
|
-
* You may obtain a copy of the License at
|
|
1913
|
-
*
|
|
1914
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1915
|
-
*
|
|
1916
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1917
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1918
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1919
|
-
* See the License for the specific language governing permissions and
|
|
1920
|
-
* limitations under the License.
|
|
1921
|
-
*/
|
|
1922
|
-
async function N(n, e) {
|
|
1923
|
-
return at(n, "POST", "/v1/accounts:signInWithIdp", Ie(n, e));
|
|
1924
|
-
}
|
|
1925
|
-
/**
|
|
1926
|
-
* @license
|
|
1927
|
-
* Copyright 2020 Google LLC
|
|
1928
|
-
*
|
|
1929
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
1930
|
-
* you may not use this file except in compliance with the License.
|
|
1931
|
-
* You may obtain a copy of the License at
|
|
1932
|
-
*
|
|
1933
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
1934
|
-
*
|
|
1935
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
1936
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
1937
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
1938
|
-
* See the License for the specific language governing permissions and
|
|
1939
|
-
* limitations under the License.
|
|
1940
|
-
*/
|
|
1941
|
-
const Yn = "http://localhost";
|
|
1942
|
-
class S extends Et {
|
|
1943
|
-
constructor() {
|
|
1944
|
-
super(...arguments), this.pendingToken = null;
|
|
1945
|
-
}
|
|
1946
|
-
/** @internal */
|
|
1947
|
-
static _fromParams(e) {
|
|
1948
|
-
const t = new S(e.providerId, e.signInMethod);
|
|
1949
|
-
return e.idToken || e.accessToken ? (e.idToken && (t.idToken = e.idToken), e.accessToken && (t.accessToken = e.accessToken), e.nonce && !e.pendingToken && (t.nonce = e.nonce), e.pendingToken && (t.pendingToken = e.pendingToken)) : e.oauthToken && e.oauthTokenSecret ? (t.accessToken = e.oauthToken, t.secret = e.oauthTokenSecret) : I(
|
|
1950
|
-
"argument-error"
|
|
1951
|
-
/* AuthErrorCode.ARGUMENT_ERROR */
|
|
1952
|
-
), t;
|
|
1953
|
-
}
|
|
1954
|
-
/** {@inheritdoc AuthCredential.toJSON} */
|
|
1955
|
-
toJSON() {
|
|
1956
|
-
return {
|
|
1957
|
-
idToken: this.idToken,
|
|
1958
|
-
accessToken: this.accessToken,
|
|
1959
|
-
secret: this.secret,
|
|
1960
|
-
nonce: this.nonce,
|
|
1961
|
-
pendingToken: this.pendingToken,
|
|
1962
|
-
providerId: this.providerId,
|
|
1963
|
-
signInMethod: this.signInMethod
|
|
1964
|
-
};
|
|
1965
|
-
}
|
|
1966
|
-
/**
|
|
1967
|
-
* Static method to deserialize a JSON representation of an object into an
|
|
1968
|
-
* {@link AuthCredential}.
|
|
1969
|
-
*
|
|
1970
|
-
* @param json - Input can be either Object or the stringified representation of the object.
|
|
1971
|
-
* When string is provided, JSON.parse would be called first.
|
|
1972
|
-
*
|
|
1973
|
-
* @returns If the JSON input does not represent an {@link AuthCredential}, null is returned.
|
|
1974
|
-
*/
|
|
1975
|
-
static fromJSON(e) {
|
|
1976
|
-
const t = typeof e == "string" ? JSON.parse(e) : e, { providerId: i, signInMethod: r } = t, s = ge(t, ["providerId", "signInMethod"]);
|
|
1977
|
-
if (!i || !r)
|
|
1978
|
-
return null;
|
|
1979
|
-
const o = new S(i, r);
|
|
1980
|
-
return o.idToken = s.idToken || void 0, o.accessToken = s.accessToken || void 0, o.secret = s.secret, o.nonce = s.nonce, o.pendingToken = s.pendingToken || null, o;
|
|
1981
|
-
}
|
|
1982
|
-
/** @internal */
|
|
1983
|
-
_getIdTokenResponse(e) {
|
|
1984
|
-
const t = this.buildRequest();
|
|
1985
|
-
return N(e, t);
|
|
1986
|
-
}
|
|
1987
|
-
/** @internal */
|
|
1988
|
-
_linkToIdToken(e, t) {
|
|
1989
|
-
const i = this.buildRequest();
|
|
1990
|
-
return i.idToken = t, N(e, i);
|
|
1991
|
-
}
|
|
1992
|
-
/** @internal */
|
|
1993
|
-
_getReauthenticationResolver(e) {
|
|
1994
|
-
const t = this.buildRequest();
|
|
1995
|
-
return t.autoCreate = !1, N(e, t);
|
|
1996
|
-
}
|
|
1997
|
-
buildRequest() {
|
|
1998
|
-
const e = {
|
|
1999
|
-
requestUri: Yn,
|
|
2000
|
-
returnSecureToken: !0
|
|
2001
|
-
};
|
|
2002
|
-
if (this.pendingToken)
|
|
2003
|
-
e.pendingToken = this.pendingToken;
|
|
2004
|
-
else {
|
|
2005
|
-
const t = {};
|
|
2006
|
-
this.idToken && (t.id_token = this.idToken), this.accessToken && (t.access_token = this.accessToken), this.secret && (t.oauth_token_secret = this.secret), t.providerId = this.providerId, this.nonce && !this.pendingToken && (t.nonce = this.nonce), e.postBody = x(t);
|
|
2007
|
-
}
|
|
2008
|
-
return e;
|
|
2009
|
-
}
|
|
2010
|
-
}
|
|
2011
|
-
/**
|
|
2012
|
-
* @license
|
|
2013
|
-
* Copyright 2020 Google LLC
|
|
2014
|
-
*
|
|
2015
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2016
|
-
* you may not use this file except in compliance with the License.
|
|
2017
|
-
* You may obtain a copy of the License at
|
|
2018
|
-
*
|
|
2019
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2020
|
-
*
|
|
2021
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2022
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2023
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2024
|
-
* See the License for the specific language governing permissions and
|
|
2025
|
-
* limitations under the License.
|
|
2026
|
-
*/
|
|
2027
|
-
class kt {
|
|
2028
|
-
/**
|
|
2029
|
-
* Constructor for generic OAuth providers.
|
|
2030
|
-
*
|
|
2031
|
-
* @param providerId - Provider for which credentials should be generated.
|
|
2032
|
-
*/
|
|
2033
|
-
constructor(e) {
|
|
2034
|
-
this.providerId = e, this.defaultLanguageCode = null, this.customParameters = {};
|
|
2035
|
-
}
|
|
2036
|
-
/**
|
|
2037
|
-
* Set the language gode.
|
|
2038
|
-
*
|
|
2039
|
-
* @param languageCode - language code
|
|
2040
|
-
*/
|
|
2041
|
-
setDefaultLanguage(e) {
|
|
2042
|
-
this.defaultLanguageCode = e;
|
|
2043
|
-
}
|
|
2044
|
-
/**
|
|
2045
|
-
* Sets the OAuth custom parameters to pass in an OAuth request for popup and redirect sign-in
|
|
2046
|
-
* operations.
|
|
2047
|
-
*
|
|
2048
|
-
* @remarks
|
|
2049
|
-
* For a detailed list, check the reserved required OAuth 2.0 parameters such as `client_id`,
|
|
2050
|
-
* `redirect_uri`, `scope`, `response_type`, and `state` are not allowed and will be ignored.
|
|
2051
|
-
*
|
|
2052
|
-
* @param customOAuthParameters - The custom OAuth parameters to pass in the OAuth request.
|
|
2053
|
-
*/
|
|
2054
|
-
setCustomParameters(e) {
|
|
2055
|
-
return this.customParameters = e, this;
|
|
2056
|
-
}
|
|
2057
|
-
/**
|
|
2058
|
-
* Retrieve the current list of {@link CustomParameters}.
|
|
2059
|
-
*/
|
|
2060
|
-
getCustomParameters() {
|
|
2061
|
-
return this.customParameters;
|
|
2062
|
-
}
|
|
2063
|
-
}
|
|
2064
|
-
/**
|
|
2065
|
-
* @license
|
|
2066
|
-
* Copyright 2019 Google LLC
|
|
2067
|
-
*
|
|
2068
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2069
|
-
* you may not use this file except in compliance with the License.
|
|
2070
|
-
* You may obtain a copy of the License at
|
|
2071
|
-
*
|
|
2072
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2073
|
-
*
|
|
2074
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2075
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2076
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2077
|
-
* See the License for the specific language governing permissions and
|
|
2078
|
-
* limitations under the License.
|
|
2079
|
-
*/
|
|
2080
|
-
class K extends kt {
|
|
2081
|
-
constructor() {
|
|
2082
|
-
super(...arguments), this.scopes = [];
|
|
2083
|
-
}
|
|
2084
|
-
/**
|
|
2085
|
-
* Add an OAuth scope to the credential.
|
|
2086
|
-
*
|
|
2087
|
-
* @param scope - Provider OAuth scope to add.
|
|
2088
|
-
*/
|
|
2089
|
-
addScope(e) {
|
|
2090
|
-
return this.scopes.includes(e) || this.scopes.push(e), this;
|
|
2091
|
-
}
|
|
2092
|
-
/**
|
|
2093
|
-
* Retrieve the current list of OAuth scopes.
|
|
2094
|
-
*/
|
|
2095
|
-
getScopes() {
|
|
2096
|
-
return [...this.scopes];
|
|
2097
|
-
}
|
|
2098
|
-
}
|
|
2099
|
-
/**
|
|
2100
|
-
* @license
|
|
2101
|
-
* Copyright 2020 Google LLC
|
|
2102
|
-
*
|
|
2103
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2104
|
-
* you may not use this file except in compliance with the License.
|
|
2105
|
-
* You may obtain a copy of the License at
|
|
2106
|
-
*
|
|
2107
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2108
|
-
*
|
|
2109
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2110
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2111
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2112
|
-
* See the License for the specific language governing permissions and
|
|
2113
|
-
* limitations under the License.
|
|
2114
|
-
*/
|
|
2115
|
-
class w extends K {
|
|
2116
|
-
constructor() {
|
|
2117
|
-
super(
|
|
2118
|
-
"facebook.com"
|
|
2119
|
-
/* ProviderId.FACEBOOK */
|
|
2120
|
-
);
|
|
2121
|
-
}
|
|
2122
|
-
/**
|
|
2123
|
-
* Creates a credential for Facebook.
|
|
2124
|
-
*
|
|
2125
|
-
* @example
|
|
2126
|
-
* ```javascript
|
|
2127
|
-
* // `event` from the Facebook auth.authResponseChange callback.
|
|
2128
|
-
* const credential = FacebookAuthProvider.credential(event.authResponse.accessToken);
|
|
2129
|
-
* const result = await signInWithCredential(credential);
|
|
2130
|
-
* ```
|
|
2131
|
-
*
|
|
2132
|
-
* @param accessToken - Facebook access token.
|
|
2133
|
-
*/
|
|
2134
|
-
static credential(e) {
|
|
2135
|
-
return S._fromParams({
|
|
2136
|
-
providerId: w.PROVIDER_ID,
|
|
2137
|
-
signInMethod: w.FACEBOOK_SIGN_IN_METHOD,
|
|
2138
|
-
accessToken: e
|
|
2139
|
-
});
|
|
2140
|
-
}
|
|
2141
|
-
/**
|
|
2142
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
|
|
2143
|
-
*
|
|
2144
|
-
* @param userCredential - The user credential.
|
|
2145
|
-
*/
|
|
2146
|
-
static credentialFromResult(e) {
|
|
2147
|
-
return w.credentialFromTaggedObject(e);
|
|
2148
|
-
}
|
|
2149
|
-
/**
|
|
2150
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
|
|
2151
|
-
* thrown during a sign-in, link, or reauthenticate operation.
|
|
2152
|
-
*
|
|
2153
|
-
* @param userCredential - The user credential.
|
|
2154
|
-
*/
|
|
2155
|
-
static credentialFromError(e) {
|
|
2156
|
-
return w.credentialFromTaggedObject(e.customData || {});
|
|
2157
|
-
}
|
|
2158
|
-
static credentialFromTaggedObject({ _tokenResponse: e }) {
|
|
2159
|
-
if (!e || !("oauthAccessToken" in e) || !e.oauthAccessToken)
|
|
2160
|
-
return null;
|
|
2161
|
-
try {
|
|
2162
|
-
return w.credential(e.oauthAccessToken);
|
|
2163
|
-
} catch {
|
|
2164
|
-
return null;
|
|
2165
|
-
}
|
|
2166
|
-
}
|
|
2167
|
-
}
|
|
2168
|
-
w.FACEBOOK_SIGN_IN_METHOD = "facebook.com";
|
|
2169
|
-
w.PROVIDER_ID = "facebook.com";
|
|
2170
|
-
/**
|
|
2171
|
-
* @license
|
|
2172
|
-
* Copyright 2020 Google LLC
|
|
2173
|
-
*
|
|
2174
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2175
|
-
* you may not use this file except in compliance with the License.
|
|
2176
|
-
* You may obtain a copy of the License at
|
|
2177
|
-
*
|
|
2178
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2179
|
-
*
|
|
2180
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2181
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2182
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2183
|
-
* See the License for the specific language governing permissions and
|
|
2184
|
-
* limitations under the License.
|
|
2185
|
-
*/
|
|
2186
|
-
class E extends K {
|
|
2187
|
-
constructor() {
|
|
2188
|
-
super(
|
|
2189
|
-
"google.com"
|
|
2190
|
-
/* ProviderId.GOOGLE */
|
|
2191
|
-
), this.addScope("profile");
|
|
2192
|
-
}
|
|
2193
|
-
/**
|
|
2194
|
-
* Creates a credential for Google. At least one of ID token and access token is required.
|
|
2195
|
-
*
|
|
2196
|
-
* @example
|
|
2197
|
-
* ```javascript
|
|
2198
|
-
* // \`googleUser\` from the onsuccess Google Sign In callback.
|
|
2199
|
-
* const credential = GoogleAuthProvider.credential(googleUser.getAuthResponse().id_token);
|
|
2200
|
-
* const result = await signInWithCredential(credential);
|
|
2201
|
-
* ```
|
|
2202
|
-
*
|
|
2203
|
-
* @param idToken - Google ID token.
|
|
2204
|
-
* @param accessToken - Google access token.
|
|
2205
|
-
*/
|
|
2206
|
-
static credential(e, t) {
|
|
2207
|
-
return S._fromParams({
|
|
2208
|
-
providerId: E.PROVIDER_ID,
|
|
2209
|
-
signInMethod: E.GOOGLE_SIGN_IN_METHOD,
|
|
2210
|
-
idToken: e,
|
|
2211
|
-
accessToken: t
|
|
2212
|
-
});
|
|
2213
|
-
}
|
|
2214
|
-
/**
|
|
2215
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
|
|
2216
|
-
*
|
|
2217
|
-
* @param userCredential - The user credential.
|
|
2218
|
-
*/
|
|
2219
|
-
static credentialFromResult(e) {
|
|
2220
|
-
return E.credentialFromTaggedObject(e);
|
|
2221
|
-
}
|
|
2222
|
-
/**
|
|
2223
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
|
|
2224
|
-
* thrown during a sign-in, link, or reauthenticate operation.
|
|
2225
|
-
*
|
|
2226
|
-
* @param userCredential - The user credential.
|
|
2227
|
-
*/
|
|
2228
|
-
static credentialFromError(e) {
|
|
2229
|
-
return E.credentialFromTaggedObject(e.customData || {});
|
|
2230
|
-
}
|
|
2231
|
-
static credentialFromTaggedObject({ _tokenResponse: e }) {
|
|
2232
|
-
if (!e)
|
|
2233
|
-
return null;
|
|
2234
|
-
const { oauthIdToken: t, oauthAccessToken: i } = e;
|
|
2235
|
-
if (!t && !i)
|
|
2236
|
-
return null;
|
|
2237
|
-
try {
|
|
2238
|
-
return E.credential(t, i);
|
|
2239
|
-
} catch {
|
|
2240
|
-
return null;
|
|
2241
|
-
}
|
|
2242
|
-
}
|
|
2243
|
-
}
|
|
2244
|
-
E.GOOGLE_SIGN_IN_METHOD = "google.com";
|
|
2245
|
-
E.PROVIDER_ID = "google.com";
|
|
2246
|
-
/**
|
|
2247
|
-
* @license
|
|
2248
|
-
* Copyright 2020 Google LLC
|
|
2249
|
-
*
|
|
2250
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2251
|
-
* you may not use this file except in compliance with the License.
|
|
2252
|
-
* You may obtain a copy of the License at
|
|
2253
|
-
*
|
|
2254
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2255
|
-
*
|
|
2256
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2257
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2258
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2259
|
-
* See the License for the specific language governing permissions and
|
|
2260
|
-
* limitations under the License.
|
|
2261
|
-
*/
|
|
2262
|
-
class k extends K {
|
|
2263
|
-
constructor() {
|
|
2264
|
-
super(
|
|
2265
|
-
"github.com"
|
|
2266
|
-
/* ProviderId.GITHUB */
|
|
2267
|
-
);
|
|
2268
|
-
}
|
|
2269
|
-
/**
|
|
2270
|
-
* Creates a credential for Github.
|
|
2271
|
-
*
|
|
2272
|
-
* @param accessToken - Github access token.
|
|
2273
|
-
*/
|
|
2274
|
-
static credential(e) {
|
|
2275
|
-
return S._fromParams({
|
|
2276
|
-
providerId: k.PROVIDER_ID,
|
|
2277
|
-
signInMethod: k.GITHUB_SIGN_IN_METHOD,
|
|
2278
|
-
accessToken: e
|
|
2279
|
-
});
|
|
2280
|
-
}
|
|
2281
|
-
/**
|
|
2282
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
|
|
2283
|
-
*
|
|
2284
|
-
* @param userCredential - The user credential.
|
|
2285
|
-
*/
|
|
2286
|
-
static credentialFromResult(e) {
|
|
2287
|
-
return k.credentialFromTaggedObject(e);
|
|
2288
|
-
}
|
|
2289
|
-
/**
|
|
2290
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
|
|
2291
|
-
* thrown during a sign-in, link, or reauthenticate operation.
|
|
2292
|
-
*
|
|
2293
|
-
* @param userCredential - The user credential.
|
|
2294
|
-
*/
|
|
2295
|
-
static credentialFromError(e) {
|
|
2296
|
-
return k.credentialFromTaggedObject(e.customData || {});
|
|
2297
|
-
}
|
|
2298
|
-
static credentialFromTaggedObject({ _tokenResponse: e }) {
|
|
2299
|
-
if (!e || !("oauthAccessToken" in e) || !e.oauthAccessToken)
|
|
2300
|
-
return null;
|
|
2301
|
-
try {
|
|
2302
|
-
return k.credential(e.oauthAccessToken);
|
|
2303
|
-
} catch {
|
|
2304
|
-
return null;
|
|
2305
|
-
}
|
|
2306
|
-
}
|
|
2307
|
-
}
|
|
2308
|
-
k.GITHUB_SIGN_IN_METHOD = "github.com";
|
|
2309
|
-
k.PROVIDER_ID = "github.com";
|
|
2310
|
-
/**
|
|
2311
|
-
* @license
|
|
2312
|
-
* Copyright 2020 Google LLC
|
|
2313
|
-
*
|
|
2314
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2315
|
-
* you may not use this file except in compliance with the License.
|
|
2316
|
-
* You may obtain a copy of the License at
|
|
2317
|
-
*
|
|
2318
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2319
|
-
*
|
|
2320
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2321
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2322
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2323
|
-
* See the License for the specific language governing permissions and
|
|
2324
|
-
* limitations under the License.
|
|
2325
|
-
*/
|
|
2326
|
-
class R extends K {
|
|
2327
|
-
constructor() {
|
|
2328
|
-
super(
|
|
2329
|
-
"twitter.com"
|
|
2330
|
-
/* ProviderId.TWITTER */
|
|
2331
|
-
);
|
|
2332
|
-
}
|
|
2333
|
-
/**
|
|
2334
|
-
* Creates a credential for Twitter.
|
|
2335
|
-
*
|
|
2336
|
-
* @param token - Twitter access token.
|
|
2337
|
-
* @param secret - Twitter secret.
|
|
2338
|
-
*/
|
|
2339
|
-
static credential(e, t) {
|
|
2340
|
-
return S._fromParams({
|
|
2341
|
-
providerId: R.PROVIDER_ID,
|
|
2342
|
-
signInMethod: R.TWITTER_SIGN_IN_METHOD,
|
|
2343
|
-
oauthToken: e,
|
|
2344
|
-
oauthTokenSecret: t
|
|
2345
|
-
});
|
|
2346
|
-
}
|
|
2347
|
-
/**
|
|
2348
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link UserCredential}.
|
|
2349
|
-
*
|
|
2350
|
-
* @param userCredential - The user credential.
|
|
2351
|
-
*/
|
|
2352
|
-
static credentialFromResult(e) {
|
|
2353
|
-
return R.credentialFromTaggedObject(e);
|
|
2354
|
-
}
|
|
2355
|
-
/**
|
|
2356
|
-
* Used to extract the underlying {@link OAuthCredential} from a {@link AuthError} which was
|
|
2357
|
-
* thrown during a sign-in, link, or reauthenticate operation.
|
|
2358
|
-
*
|
|
2359
|
-
* @param userCredential - The user credential.
|
|
2360
|
-
*/
|
|
2361
|
-
static credentialFromError(e) {
|
|
2362
|
-
return R.credentialFromTaggedObject(e.customData || {});
|
|
2363
|
-
}
|
|
2364
|
-
static credentialFromTaggedObject({ _tokenResponse: e }) {
|
|
2365
|
-
if (!e)
|
|
2366
|
-
return null;
|
|
2367
|
-
const { oauthAccessToken: t, oauthTokenSecret: i } = e;
|
|
2368
|
-
if (!t || !i)
|
|
2369
|
-
return null;
|
|
2370
|
-
try {
|
|
2371
|
-
return R.credential(t, i);
|
|
2372
|
-
} catch {
|
|
2373
|
-
return null;
|
|
2374
|
-
}
|
|
2375
|
-
}
|
|
2376
|
-
}
|
|
2377
|
-
R.TWITTER_SIGN_IN_METHOD = "twitter.com";
|
|
2378
|
-
R.PROVIDER_ID = "twitter.com";
|
|
2379
|
-
/**
|
|
2380
|
-
* @license
|
|
2381
|
-
* Copyright 2020 Google LLC
|
|
2382
|
-
*
|
|
2383
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2384
|
-
* you may not use this file except in compliance with the License.
|
|
2385
|
-
* You may obtain a copy of the License at
|
|
2386
|
-
*
|
|
2387
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2388
|
-
*
|
|
2389
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2390
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2391
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2392
|
-
* See the License for the specific language governing permissions and
|
|
2393
|
-
* limitations under the License.
|
|
2394
|
-
*/
|
|
2395
|
-
class A {
|
|
2396
|
-
constructor(e) {
|
|
2397
|
-
this.user = e.user, this.providerId = e.providerId, this._tokenResponse = e._tokenResponse, this.operationType = e.operationType;
|
|
2398
|
-
}
|
|
2399
|
-
static async _fromIdTokenResponse(e, t, i, r = !1) {
|
|
2400
|
-
const s = await b._fromIdTokenResponse(e, i, r), o = We(i);
|
|
2401
|
-
return new A({
|
|
2402
|
-
user: s,
|
|
2403
|
-
providerId: o,
|
|
2404
|
-
_tokenResponse: i,
|
|
2405
|
-
operationType: t
|
|
2406
|
-
});
|
|
2407
|
-
}
|
|
2408
|
-
static async _forOperation(e, t, i) {
|
|
2409
|
-
await e._updateTokensIfNecessary(
|
|
2410
|
-
i,
|
|
2411
|
-
/* reload */
|
|
2412
|
-
!0
|
|
2413
|
-
);
|
|
2414
|
-
const r = We(i);
|
|
2415
|
-
return new A({
|
|
2416
|
-
user: e,
|
|
2417
|
-
providerId: r,
|
|
2418
|
-
_tokenResponse: i,
|
|
2419
|
-
operationType: t
|
|
2420
|
-
});
|
|
2421
|
-
}
|
|
2422
|
-
}
|
|
2423
|
-
function We(n) {
|
|
2424
|
-
return n.providerId ? n.providerId : "phoneNumber" in n ? "phone" : null;
|
|
2425
|
-
}
|
|
2426
|
-
/**
|
|
2427
|
-
* @license
|
|
2428
|
-
* Copyright 2020 Google LLC
|
|
2429
|
-
*
|
|
2430
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2431
|
-
* you may not use this file except in compliance with the License.
|
|
2432
|
-
* You may obtain a copy of the License at
|
|
2433
|
-
*
|
|
2434
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2435
|
-
*
|
|
2436
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2437
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2438
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2439
|
-
* See the License for the specific language governing permissions and
|
|
2440
|
-
* limitations under the License.
|
|
2441
|
-
*/
|
|
2442
|
-
class Z extends me {
|
|
2443
|
-
constructor(e, t, i, r) {
|
|
2444
|
-
var s;
|
|
2445
|
-
super(t.code, t.message), this.operationType = i, this.user = r, Object.setPrototypeOf(this, Z.prototype), this.customData = {
|
|
2446
|
-
appName: e.name,
|
|
2447
|
-
tenantId: (s = e.tenantId) !== null && s !== void 0 ? s : void 0,
|
|
2448
|
-
_serverResponse: t.customData._serverResponse,
|
|
2449
|
-
operationType: i
|
|
2450
|
-
};
|
|
2451
|
-
}
|
|
2452
|
-
static _fromErrorAndOperation(e, t, i, r) {
|
|
2453
|
-
return new Z(e, t, i, r);
|
|
2454
|
-
}
|
|
2455
|
-
}
|
|
2456
|
-
function Rt(n, e, t, i) {
|
|
2457
|
-
return (e === "reauthenticate" ? t._getReauthenticationResolver(n) : t._getIdTokenResponse(n)).catch((s) => {
|
|
2458
|
-
throw s.code === "auth/multi-factor-auth-required" ? Z._fromErrorAndOperation(n, s, e, i) : s;
|
|
2459
|
-
});
|
|
2460
|
-
}
|
|
2461
|
-
async function Qn(n, e, t = !1) {
|
|
2462
|
-
const i = await M(n, e._linkToIdToken(n.auth, await n.getIdToken()), t);
|
|
2463
|
-
return A._forOperation(n, "link", i);
|
|
2464
|
-
}
|
|
2465
|
-
/**
|
|
2466
|
-
* @license
|
|
2467
|
-
* Copyright 2019 Google LLC
|
|
2468
|
-
*
|
|
2469
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2470
|
-
* you may not use this file except in compliance with the License.
|
|
2471
|
-
* You may obtain a copy of the License at
|
|
2472
|
-
*
|
|
2473
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2474
|
-
*
|
|
2475
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2476
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2477
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2478
|
-
* See the License for the specific language governing permissions and
|
|
2479
|
-
* limitations under the License.
|
|
2480
|
-
*/
|
|
2481
|
-
async function Zn(n, e, t = !1) {
|
|
2482
|
-
const { auth: i } = n, r = "reauthenticate";
|
|
2483
|
-
try {
|
|
2484
|
-
const s = await M(n, Rt(i, r, e, n), t);
|
|
2485
|
-
u(
|
|
2486
|
-
s.idToken,
|
|
2487
|
-
i,
|
|
2488
|
-
"internal-error"
|
|
2489
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
2490
|
-
);
|
|
2491
|
-
const o = ye(s.idToken);
|
|
2492
|
-
u(
|
|
2493
|
-
o,
|
|
2494
|
-
i,
|
|
2495
|
-
"internal-error"
|
|
2496
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
2497
|
-
);
|
|
2498
|
-
const { sub: c } = o;
|
|
2499
|
-
return u(
|
|
2500
|
-
n.uid === c,
|
|
2501
|
-
i,
|
|
2502
|
-
"user-mismatch"
|
|
2503
|
-
/* AuthErrorCode.USER_MISMATCH */
|
|
2504
|
-
), A._forOperation(n, r, s);
|
|
2505
|
-
} catch (s) {
|
|
2506
|
-
throw (s == null ? void 0 : s.code) === "auth/user-not-found" && I(
|
|
2507
|
-
i,
|
|
2508
|
-
"user-mismatch"
|
|
2509
|
-
/* AuthErrorCode.USER_MISMATCH */
|
|
2510
|
-
), s;
|
|
2511
|
-
}
|
|
2512
|
-
}
|
|
2513
|
-
/**
|
|
2514
|
-
* @license
|
|
2515
|
-
* Copyright 2020 Google LLC
|
|
2516
|
-
*
|
|
2517
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2518
|
-
* you may not use this file except in compliance with the License.
|
|
2519
|
-
* You may obtain a copy of the License at
|
|
2520
|
-
*
|
|
2521
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2522
|
-
*
|
|
2523
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2524
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2525
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2526
|
-
* See the License for the specific language governing permissions and
|
|
2527
|
-
* limitations under the License.
|
|
2528
|
-
*/
|
|
2529
|
-
async function ei(n, e, t = !1) {
|
|
2530
|
-
const i = "signIn", r = await Rt(n, i, e), s = await A._fromIdTokenResponse(n, i, r);
|
|
2531
|
-
return t || await n._updateCurrentUser(s.user), s;
|
|
2532
|
-
}
|
|
2533
|
-
/**
|
|
2534
|
-
* @license
|
|
2535
|
-
* Copyright 2020 Google LLC
|
|
2536
|
-
*
|
|
2537
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2538
|
-
* you may not use this file except in compliance with the License.
|
|
2539
|
-
* You may obtain a copy of the License at
|
|
2540
|
-
*
|
|
2541
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2542
|
-
*
|
|
2543
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2544
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2545
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2546
|
-
* See the License for the specific language governing permissions and
|
|
2547
|
-
* limitations under the License.
|
|
2548
|
-
*/
|
|
2549
|
-
async function ti(n, e) {
|
|
2550
|
-
return at(n, "POST", "/v1/accounts:signInWithCustomToken", Ie(n, e));
|
|
2551
|
-
}
|
|
2552
|
-
/**
|
|
2553
|
-
* @license
|
|
2554
|
-
* Copyright 2020 Google LLC
|
|
2555
|
-
*
|
|
2556
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2557
|
-
* you may not use this file except in compliance with the License.
|
|
2558
|
-
* You may obtain a copy of the License at
|
|
2559
|
-
*
|
|
2560
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2561
|
-
*
|
|
2562
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2563
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2564
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2565
|
-
* See the License for the specific language governing permissions and
|
|
2566
|
-
* limitations under the License.
|
|
2567
|
-
*/
|
|
2568
|
-
async function ni(n, e) {
|
|
2569
|
-
const t = H(n), i = await ti(t, {
|
|
2570
|
-
token: e,
|
|
2571
|
-
returnSecureToken: !0
|
|
2572
|
-
}), r = await A._fromIdTokenResponse(t, "signIn", i);
|
|
2573
|
-
return await t._updateCurrentUser(r.user), r;
|
|
2574
|
-
}
|
|
2575
|
-
function ii(n, e, t, i) {
|
|
2576
|
-
return O(n).onIdTokenChanged(e, t, i);
|
|
2577
|
-
}
|
|
2578
|
-
function ri(n, e, t) {
|
|
2579
|
-
return O(n).beforeAuthStateChanged(e, t);
|
|
2580
|
-
}
|
|
2581
|
-
const ee = "__sak";
|
|
2582
|
-
/**
|
|
2583
|
-
* @license
|
|
2584
|
-
* Copyright 2019 Google LLC
|
|
2585
|
-
*
|
|
2586
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2587
|
-
* you may not use this file except in compliance with the License.
|
|
2588
|
-
* You may obtain a copy of the License at
|
|
2589
|
-
*
|
|
2590
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2591
|
-
*
|
|
2592
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2593
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2594
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2595
|
-
* See the License for the specific language governing permissions and
|
|
2596
|
-
* limitations under the License.
|
|
2597
|
-
*/
|
|
2598
|
-
class bt {
|
|
2599
|
-
constructor(e, t) {
|
|
2600
|
-
this.storageRetriever = e, this.type = t;
|
|
2601
|
-
}
|
|
2602
|
-
_isAvailable() {
|
|
2603
|
-
try {
|
|
2604
|
-
return this.storage ? (this.storage.setItem(ee, "1"), this.storage.removeItem(ee), Promise.resolve(!0)) : Promise.resolve(!1);
|
|
2605
|
-
} catch {
|
|
2606
|
-
return Promise.resolve(!1);
|
|
2607
|
-
}
|
|
2608
|
-
}
|
|
2609
|
-
_set(e, t) {
|
|
2610
|
-
return this.storage.setItem(e, JSON.stringify(t)), Promise.resolve();
|
|
2611
|
-
}
|
|
2612
|
-
_get(e) {
|
|
2613
|
-
const t = this.storage.getItem(e);
|
|
2614
|
-
return Promise.resolve(t ? JSON.parse(t) : null);
|
|
2615
|
-
}
|
|
2616
|
-
_remove(e) {
|
|
2617
|
-
return this.storage.removeItem(e), Promise.resolve();
|
|
2618
|
-
}
|
|
2619
|
-
get storage() {
|
|
2620
|
-
return this.storageRetriever();
|
|
2621
|
-
}
|
|
2622
|
-
}
|
|
2623
|
-
/**
|
|
2624
|
-
* @license
|
|
2625
|
-
* Copyright 2020 Google LLC
|
|
2626
|
-
*
|
|
2627
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2628
|
-
* you may not use this file except in compliance with the License.
|
|
2629
|
-
* You may obtain a copy of the License at
|
|
2630
|
-
*
|
|
2631
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2632
|
-
*
|
|
2633
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2634
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2635
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2636
|
-
* See the License for the specific language governing permissions and
|
|
2637
|
-
* limitations under the License.
|
|
2638
|
-
*/
|
|
2639
|
-
function si() {
|
|
2640
|
-
const n = f();
|
|
2641
|
-
return Te(n) || ne(n);
|
|
2642
|
-
}
|
|
2643
|
-
const oi = 1e3, ai = 10;
|
|
2644
|
-
class St extends bt {
|
|
2645
|
-
constructor() {
|
|
2646
|
-
super(
|
|
2647
|
-
() => window.localStorage,
|
|
2648
|
-
"LOCAL"
|
|
2649
|
-
/* PersistenceType.LOCAL */
|
|
2650
|
-
), this.boundEventHandler = (e, t) => this.onStorageEvent(e, t), this.listeners = {}, this.localCache = {}, this.pollTimer = null, this.safariLocalStorageNotSynced = si() && Fn(), this.fallbackToPolling = _t(), this._shouldAllowMigration = !0;
|
|
2651
|
-
}
|
|
2652
|
-
forAllChangedKeys(e) {
|
|
2653
|
-
for (const t of Object.keys(this.listeners)) {
|
|
2654
|
-
const i = this.storage.getItem(t), r = this.localCache[t];
|
|
2655
|
-
i !== r && e(t, r, i);
|
|
2656
|
-
}
|
|
2657
|
-
}
|
|
2658
|
-
onStorageEvent(e, t = !1) {
|
|
2659
|
-
if (!e.key) {
|
|
2660
|
-
this.forAllChangedKeys((o, c, a) => {
|
|
2661
|
-
this.notifyListeners(o, a);
|
|
2662
|
-
});
|
|
2663
|
-
return;
|
|
2664
|
-
}
|
|
2665
|
-
const i = e.key;
|
|
2666
|
-
if (t ? this.detachListener() : this.stopPolling(), this.safariLocalStorageNotSynced) {
|
|
2667
|
-
const o = this.storage.getItem(i);
|
|
2668
|
-
if (e.newValue !== o)
|
|
2669
|
-
e.newValue !== null ? this.storage.setItem(i, e.newValue) : this.storage.removeItem(i);
|
|
2670
|
-
else if (this.localCache[i] === e.newValue && !t)
|
|
2671
|
-
return;
|
|
2672
|
-
}
|
|
2673
|
-
const r = () => {
|
|
2674
|
-
const o = this.storage.getItem(i);
|
|
2675
|
-
!t && this.localCache[i] === o || this.notifyListeners(i, o);
|
|
2676
|
-
}, s = this.storage.getItem(i);
|
|
2677
|
-
Dn() && s !== e.newValue && e.newValue !== e.oldValue ? setTimeout(r, ai) : r();
|
|
2678
|
-
}
|
|
2679
|
-
notifyListeners(e, t) {
|
|
2680
|
-
this.localCache[e] = t;
|
|
2681
|
-
const i = this.listeners[e];
|
|
2682
|
-
if (i)
|
|
2683
|
-
for (const r of Array.from(i))
|
|
2684
|
-
r(t && JSON.parse(t));
|
|
2685
|
-
}
|
|
2686
|
-
startPolling() {
|
|
2687
|
-
this.stopPolling(), this.pollTimer = setInterval(() => {
|
|
2688
|
-
this.forAllChangedKeys((e, t, i) => {
|
|
2689
|
-
this.onStorageEvent(
|
|
2690
|
-
new StorageEvent("storage", {
|
|
2691
|
-
key: e,
|
|
2692
|
-
oldValue: t,
|
|
2693
|
-
newValue: i
|
|
2694
|
-
}),
|
|
2695
|
-
/* poll */
|
|
2696
|
-
!0
|
|
2697
|
-
);
|
|
2698
|
-
});
|
|
2699
|
-
}, oi);
|
|
2700
|
-
}
|
|
2701
|
-
stopPolling() {
|
|
2702
|
-
this.pollTimer && (clearInterval(this.pollTimer), this.pollTimer = null);
|
|
2703
|
-
}
|
|
2704
|
-
attachListener() {
|
|
2705
|
-
window.addEventListener("storage", this.boundEventHandler);
|
|
2706
|
-
}
|
|
2707
|
-
detachListener() {
|
|
2708
|
-
window.removeEventListener("storage", this.boundEventHandler);
|
|
2709
|
-
}
|
|
2710
|
-
_addListener(e, t) {
|
|
2711
|
-
Object.keys(this.listeners).length === 0 && (this.fallbackToPolling ? this.startPolling() : this.attachListener()), this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set(), this.localCache[e] = this.storage.getItem(e)), this.listeners[e].add(t);
|
|
2712
|
-
}
|
|
2713
|
-
_removeListener(e, t) {
|
|
2714
|
-
this.listeners[e] && (this.listeners[e].delete(t), this.listeners[e].size === 0 && delete this.listeners[e]), Object.keys(this.listeners).length === 0 && (this.detachListener(), this.stopPolling());
|
|
2715
|
-
}
|
|
2716
|
-
// Update local cache on base operations:
|
|
2717
|
-
async _set(e, t) {
|
|
2718
|
-
await super._set(e, t), this.localCache[e] = JSON.stringify(t);
|
|
2719
|
-
}
|
|
2720
|
-
async _get(e) {
|
|
2721
|
-
const t = await super._get(e);
|
|
2722
|
-
return this.localCache[e] = JSON.stringify(t), t;
|
|
2723
|
-
}
|
|
2724
|
-
async _remove(e) {
|
|
2725
|
-
await super._remove(e), delete this.localCache[e];
|
|
2726
|
-
}
|
|
2727
|
-
}
|
|
2728
|
-
St.type = "LOCAL";
|
|
2729
|
-
const ci = St;
|
|
2730
|
-
/**
|
|
2731
|
-
* @license
|
|
2732
|
-
* Copyright 2020 Google LLC
|
|
2733
|
-
*
|
|
2734
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2735
|
-
* you may not use this file except in compliance with the License.
|
|
2736
|
-
* You may obtain a copy of the License at
|
|
2737
|
-
*
|
|
2738
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2739
|
-
*
|
|
2740
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2741
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2742
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2743
|
-
* See the License for the specific language governing permissions and
|
|
2744
|
-
* limitations under the License.
|
|
2745
|
-
*/
|
|
2746
|
-
class At extends bt {
|
|
2747
|
-
constructor() {
|
|
2748
|
-
super(
|
|
2749
|
-
() => window.sessionStorage,
|
|
2750
|
-
"SESSION"
|
|
2751
|
-
/* PersistenceType.SESSION */
|
|
2752
|
-
);
|
|
2753
|
-
}
|
|
2754
|
-
_addListener(e, t) {
|
|
2755
|
-
}
|
|
2756
|
-
_removeListener(e, t) {
|
|
2757
|
-
}
|
|
2758
|
-
}
|
|
2759
|
-
At.type = "SESSION";
|
|
2760
|
-
const Ct = At;
|
|
2761
|
-
/**
|
|
2762
|
-
* @license
|
|
2763
|
-
* Copyright 2019 Google LLC
|
|
2764
|
-
*
|
|
2765
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2766
|
-
* you may not use this file except in compliance with the License.
|
|
2767
|
-
* You may obtain a copy of the License at
|
|
2768
|
-
*
|
|
2769
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2770
|
-
*
|
|
2771
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2772
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2773
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2774
|
-
* See the License for the specific language governing permissions and
|
|
2775
|
-
* limitations under the License.
|
|
2776
|
-
*/
|
|
2777
|
-
function li(n) {
|
|
2778
|
-
return Promise.all(n.map(async (e) => {
|
|
2779
|
-
try {
|
|
2780
|
-
return {
|
|
2781
|
-
fulfilled: !0,
|
|
2782
|
-
value: await e
|
|
2783
|
-
};
|
|
2784
|
-
} catch (t) {
|
|
2785
|
-
return {
|
|
2786
|
-
fulfilled: !1,
|
|
2787
|
-
reason: t
|
|
2788
|
-
};
|
|
2789
|
-
}
|
|
2790
|
-
}));
|
|
2791
|
-
}
|
|
2792
|
-
/**
|
|
2793
|
-
* @license
|
|
2794
|
-
* Copyright 2019 Google LLC
|
|
2795
|
-
*
|
|
2796
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2797
|
-
* you may not use this file except in compliance with the License.
|
|
2798
|
-
* You may obtain a copy of the License at
|
|
2799
|
-
*
|
|
2800
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2801
|
-
*
|
|
2802
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2803
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2804
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2805
|
-
* See the License for the specific language governing permissions and
|
|
2806
|
-
* limitations under the License.
|
|
2807
|
-
*/
|
|
2808
|
-
class ie {
|
|
2809
|
-
constructor(e) {
|
|
2810
|
-
this.eventTarget = e, this.handlersMap = {}, this.boundEventHandler = this.handleEvent.bind(this);
|
|
2811
|
-
}
|
|
2812
|
-
/**
|
|
2813
|
-
* Obtain an instance of a Receiver for a given event target, if none exists it will be created.
|
|
2814
|
-
*
|
|
2815
|
-
* @param eventTarget - An event target (such as window or self) through which the underlying
|
|
2816
|
-
* messages will be received.
|
|
2817
|
-
*/
|
|
2818
|
-
static _getInstance(e) {
|
|
2819
|
-
const t = this.receivers.find((r) => r.isListeningto(e));
|
|
2820
|
-
if (t)
|
|
2821
|
-
return t;
|
|
2822
|
-
const i = new ie(e);
|
|
2823
|
-
return this.receivers.push(i), i;
|
|
2824
|
-
}
|
|
2825
|
-
isListeningto(e) {
|
|
2826
|
-
return this.eventTarget === e;
|
|
2827
|
-
}
|
|
2828
|
-
/**
|
|
2829
|
-
* Fans out a MessageEvent to the appropriate listeners.
|
|
2830
|
-
*
|
|
2831
|
-
* @remarks
|
|
2832
|
-
* Sends an {@link Status.ACK} upon receipt and a {@link Status.DONE} once all handlers have
|
|
2833
|
-
* finished processing.
|
|
2834
|
-
*
|
|
2835
|
-
* @param event - The MessageEvent.
|
|
2836
|
-
*
|
|
2837
|
-
*/
|
|
2838
|
-
async handleEvent(e) {
|
|
2839
|
-
const t = e, { eventId: i, eventType: r, data: s } = t.data, o = this.handlersMap[r];
|
|
2840
|
-
if (!(o != null && o.size))
|
|
2841
|
-
return;
|
|
2842
|
-
t.ports[0].postMessage({
|
|
2843
|
-
status: "ack",
|
|
2844
|
-
eventId: i,
|
|
2845
|
-
eventType: r
|
|
2846
|
-
});
|
|
2847
|
-
const c = Array.from(o).map(async (l) => l(t.origin, s)), a = await li(c);
|
|
2848
|
-
t.ports[0].postMessage({
|
|
2849
|
-
status: "done",
|
|
2850
|
-
eventId: i,
|
|
2851
|
-
eventType: r,
|
|
2852
|
-
response: a
|
|
2853
|
-
});
|
|
2854
|
-
}
|
|
2855
|
-
/**
|
|
2856
|
-
* Subscribe an event handler for a particular event.
|
|
2857
|
-
*
|
|
2858
|
-
* @param eventType - Event name to subscribe to.
|
|
2859
|
-
* @param eventHandler - The event handler which should receive the events.
|
|
2860
|
-
*
|
|
2861
|
-
*/
|
|
2862
|
-
_subscribe(e, t) {
|
|
2863
|
-
Object.keys(this.handlersMap).length === 0 && this.eventTarget.addEventListener("message", this.boundEventHandler), this.handlersMap[e] || (this.handlersMap[e] = /* @__PURE__ */ new Set()), this.handlersMap[e].add(t);
|
|
2864
|
-
}
|
|
2865
|
-
/**
|
|
2866
|
-
* Unsubscribe an event handler from a particular event.
|
|
2867
|
-
*
|
|
2868
|
-
* @param eventType - Event name to unsubscribe from.
|
|
2869
|
-
* @param eventHandler - Optinoal event handler, if none provided, unsubscribe all handlers on this event.
|
|
2870
|
-
*
|
|
2871
|
-
*/
|
|
2872
|
-
_unsubscribe(e, t) {
|
|
2873
|
-
this.handlersMap[e] && t && this.handlersMap[e].delete(t), (!t || this.handlersMap[e].size === 0) && delete this.handlersMap[e], Object.keys(this.handlersMap).length === 0 && this.eventTarget.removeEventListener("message", this.boundEventHandler);
|
|
2874
|
-
}
|
|
2875
|
-
}
|
|
2876
|
-
ie.receivers = [];
|
|
2877
|
-
/**
|
|
2878
|
-
* @license
|
|
2879
|
-
* Copyright 2020 Google LLC
|
|
2880
|
-
*
|
|
2881
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2882
|
-
* you may not use this file except in compliance with the License.
|
|
2883
|
-
* You may obtain a copy of the License at
|
|
2884
|
-
*
|
|
2885
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2886
|
-
*
|
|
2887
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2888
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2889
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2890
|
-
* See the License for the specific language governing permissions and
|
|
2891
|
-
* limitations under the License.
|
|
2892
|
-
*/
|
|
2893
|
-
function we(n = "", e = 10) {
|
|
2894
|
-
let t = "";
|
|
2895
|
-
for (let i = 0; i < e; i++)
|
|
2896
|
-
t += Math.floor(Math.random() * 10);
|
|
2897
|
-
return n + t;
|
|
2898
|
-
}
|
|
2899
|
-
/**
|
|
2900
|
-
* @license
|
|
2901
|
-
* Copyright 2019 Google LLC
|
|
2902
|
-
*
|
|
2903
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
2904
|
-
* you may not use this file except in compliance with the License.
|
|
2905
|
-
* You may obtain a copy of the License at
|
|
2906
|
-
*
|
|
2907
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
2908
|
-
*
|
|
2909
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
2910
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
2911
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
2912
|
-
* See the License for the specific language governing permissions and
|
|
2913
|
-
* limitations under the License.
|
|
2914
|
-
*/
|
|
2915
|
-
class ui {
|
|
2916
|
-
constructor(e) {
|
|
2917
|
-
this.target = e, this.handlers = /* @__PURE__ */ new Set();
|
|
2918
|
-
}
|
|
2919
|
-
/**
|
|
2920
|
-
* Unsubscribe the handler and remove it from our tracking Set.
|
|
2921
|
-
*
|
|
2922
|
-
* @param handler - The handler to unsubscribe.
|
|
2923
|
-
*/
|
|
2924
|
-
removeMessageHandler(e) {
|
|
2925
|
-
e.messageChannel && (e.messageChannel.port1.removeEventListener("message", e.onMessage), e.messageChannel.port1.close()), this.handlers.delete(e);
|
|
2926
|
-
}
|
|
2927
|
-
/**
|
|
2928
|
-
* Send a message to the Receiver located at {@link target}.
|
|
2929
|
-
*
|
|
2930
|
-
* @remarks
|
|
2931
|
-
* We'll first wait a bit for an ACK , if we get one we will wait significantly longer until the
|
|
2932
|
-
* receiver has had a chance to fully process the event.
|
|
2933
|
-
*
|
|
2934
|
-
* @param eventType - Type of event to send.
|
|
2935
|
-
* @param data - The payload of the event.
|
|
2936
|
-
* @param timeout - Timeout for waiting on an ACK from the receiver.
|
|
2937
|
-
*
|
|
2938
|
-
* @returns An array of settled promises from all the handlers that were listening on the receiver.
|
|
2939
|
-
*/
|
|
2940
|
-
async _send(e, t, i = 50) {
|
|
2941
|
-
const r = typeof MessageChannel < "u" ? new MessageChannel() : null;
|
|
2942
|
-
if (!r)
|
|
2943
|
-
throw new Error(
|
|
2944
|
-
"connection_unavailable"
|
|
2945
|
-
/* _MessageError.CONNECTION_UNAVAILABLE */
|
|
2946
|
-
);
|
|
2947
|
-
let s, o;
|
|
2948
|
-
return new Promise((c, a) => {
|
|
2949
|
-
const l = we("", 20);
|
|
2950
|
-
r.port1.start();
|
|
2951
|
-
const d = setTimeout(() => {
|
|
2952
|
-
a(new Error(
|
|
2953
|
-
"unsupported_event"
|
|
2954
|
-
/* _MessageError.UNSUPPORTED_EVENT */
|
|
2955
|
-
));
|
|
2956
|
-
}, i);
|
|
2957
|
-
o = {
|
|
2958
|
-
messageChannel: r,
|
|
2959
|
-
onMessage(h) {
|
|
2960
|
-
const p = h;
|
|
2961
|
-
if (p.data.eventId === l)
|
|
2962
|
-
switch (p.data.status) {
|
|
2963
|
-
case "ack":
|
|
2964
|
-
clearTimeout(d), s = setTimeout(
|
|
2965
|
-
() => {
|
|
2966
|
-
a(new Error(
|
|
2967
|
-
"timeout"
|
|
2968
|
-
/* _MessageError.TIMEOUT */
|
|
2969
|
-
));
|
|
2970
|
-
},
|
|
2971
|
-
3e3
|
|
2972
|
-
/* _TimeoutDuration.COMPLETION */
|
|
2973
|
-
);
|
|
2974
|
-
break;
|
|
2975
|
-
case "done":
|
|
2976
|
-
clearTimeout(s), c(p.data.response);
|
|
2977
|
-
break;
|
|
2978
|
-
default:
|
|
2979
|
-
clearTimeout(d), clearTimeout(s), a(new Error(
|
|
2980
|
-
"invalid_response"
|
|
2981
|
-
/* _MessageError.INVALID_RESPONSE */
|
|
2982
|
-
));
|
|
2983
|
-
break;
|
|
2984
|
-
}
|
|
2985
|
-
}
|
|
2986
|
-
}, this.handlers.add(o), r.port1.addEventListener("message", o.onMessage), this.target.postMessage({
|
|
2987
|
-
eventType: e,
|
|
2988
|
-
eventId: l,
|
|
2989
|
-
data: t
|
|
2990
|
-
}, [r.port2]);
|
|
2991
|
-
}).finally(() => {
|
|
2992
|
-
o && this.removeMessageHandler(o);
|
|
2993
|
-
});
|
|
2994
|
-
}
|
|
2995
|
-
}
|
|
2996
|
-
/**
|
|
2997
|
-
* @license
|
|
2998
|
-
* Copyright 2020 Google LLC
|
|
2999
|
-
*
|
|
3000
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3001
|
-
* you may not use this file except in compliance with the License.
|
|
3002
|
-
* You may obtain a copy of the License at
|
|
3003
|
-
*
|
|
3004
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3005
|
-
*
|
|
3006
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3007
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3008
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3009
|
-
* See the License for the specific language governing permissions and
|
|
3010
|
-
* limitations under the License.
|
|
3011
|
-
*/
|
|
3012
|
-
function m() {
|
|
3013
|
-
return window;
|
|
3014
|
-
}
|
|
3015
|
-
function di(n) {
|
|
3016
|
-
m().location.href = n;
|
|
3017
|
-
}
|
|
3018
|
-
/**
|
|
3019
|
-
* @license
|
|
3020
|
-
* Copyright 2020 Google LLC.
|
|
3021
|
-
*
|
|
3022
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3023
|
-
* you may not use this file except in compliance with the License.
|
|
3024
|
-
* You may obtain a copy of the License at
|
|
3025
|
-
*
|
|
3026
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3027
|
-
*
|
|
3028
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3029
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3030
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3031
|
-
* See the License for the specific language governing permissions and
|
|
3032
|
-
* limitations under the License.
|
|
3033
|
-
*/
|
|
3034
|
-
function Pt() {
|
|
3035
|
-
return typeof m().WorkerGlobalScope < "u" && typeof m().importScripts == "function";
|
|
3036
|
-
}
|
|
3037
|
-
async function hi() {
|
|
3038
|
-
if (!(navigator != null && navigator.serviceWorker))
|
|
3039
|
-
return null;
|
|
3040
|
-
try {
|
|
3041
|
-
return (await navigator.serviceWorker.ready).active;
|
|
3042
|
-
} catch {
|
|
3043
|
-
return null;
|
|
3044
|
-
}
|
|
3045
|
-
}
|
|
3046
|
-
function fi() {
|
|
3047
|
-
var n;
|
|
3048
|
-
return ((n = navigator == null ? void 0 : navigator.serviceWorker) === null || n === void 0 ? void 0 : n.controller) || null;
|
|
3049
|
-
}
|
|
3050
|
-
function pi() {
|
|
3051
|
-
return Pt() ? self : null;
|
|
3052
|
-
}
|
|
3053
|
-
/**
|
|
3054
|
-
* @license
|
|
3055
|
-
* Copyright 2019 Google LLC
|
|
3056
|
-
*
|
|
3057
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3058
|
-
* you may not use this file except in compliance with the License.
|
|
3059
|
-
* You may obtain a copy of the License at
|
|
3060
|
-
*
|
|
3061
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3062
|
-
*
|
|
3063
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3064
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3065
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3066
|
-
* See the License for the specific language governing permissions and
|
|
3067
|
-
* limitations under the License.
|
|
3068
|
-
*/
|
|
3069
|
-
const Nt = "firebaseLocalStorageDb", gi = 1, te = "firebaseLocalStorage", Ot = "fbase_key";
|
|
3070
|
-
class $ {
|
|
3071
|
-
constructor(e) {
|
|
3072
|
-
this.request = e;
|
|
3073
|
-
}
|
|
3074
|
-
toPromise() {
|
|
3075
|
-
return new Promise((e, t) => {
|
|
3076
|
-
this.request.addEventListener("success", () => {
|
|
3077
|
-
e(this.request.result);
|
|
3078
|
-
}), this.request.addEventListener("error", () => {
|
|
3079
|
-
t(this.request.error);
|
|
3080
|
-
});
|
|
3081
|
-
});
|
|
3082
|
-
}
|
|
3083
|
-
}
|
|
3084
|
-
function re(n, e) {
|
|
3085
|
-
return n.transaction([te], e ? "readwrite" : "readonly").objectStore(te);
|
|
3086
|
-
}
|
|
3087
|
-
function mi() {
|
|
3088
|
-
const n = indexedDB.deleteDatabase(Nt);
|
|
3089
|
-
return new $(n).toPromise();
|
|
3090
|
-
}
|
|
3091
|
-
function fe() {
|
|
3092
|
-
const n = indexedDB.open(Nt, gi);
|
|
3093
|
-
return new Promise((e, t) => {
|
|
3094
|
-
n.addEventListener("error", () => {
|
|
3095
|
-
t(n.error);
|
|
3096
|
-
}), n.addEventListener("upgradeneeded", () => {
|
|
3097
|
-
const i = n.result;
|
|
3098
|
-
try {
|
|
3099
|
-
i.createObjectStore(te, { keyPath: Ot });
|
|
3100
|
-
} catch (r) {
|
|
3101
|
-
t(r);
|
|
3102
|
-
}
|
|
3103
|
-
}), n.addEventListener("success", async () => {
|
|
3104
|
-
const i = n.result;
|
|
3105
|
-
i.objectStoreNames.contains(te) ? e(i) : (i.close(), await mi(), e(await fe()));
|
|
3106
|
-
});
|
|
3107
|
-
});
|
|
3108
|
-
}
|
|
3109
|
-
async function He(n, e, t) {
|
|
3110
|
-
const i = re(n, !0).put({
|
|
3111
|
-
[Ot]: e,
|
|
3112
|
-
value: t
|
|
3113
|
-
});
|
|
3114
|
-
return new $(i).toPromise();
|
|
3115
|
-
}
|
|
3116
|
-
async function _i(n, e) {
|
|
3117
|
-
const t = re(n, !1).get(e), i = await new $(t).toPromise();
|
|
3118
|
-
return i === void 0 ? null : i.value;
|
|
3119
|
-
}
|
|
3120
|
-
function Ke(n, e) {
|
|
3121
|
-
const t = re(n, !0).delete(e);
|
|
3122
|
-
return new $(t).toPromise();
|
|
3123
|
-
}
|
|
3124
|
-
const vi = 800, Ii = 3;
|
|
3125
|
-
class Lt {
|
|
3126
|
-
constructor() {
|
|
3127
|
-
this.type = "LOCAL", this._shouldAllowMigration = !0, this.listeners = {}, this.localCache = {}, this.pollTimer = null, this.pendingWrites = 0, this.receiver = null, this.sender = null, this.serviceWorkerReceiverAvailable = !1, this.activeServiceWorker = null, this._workerInitializationPromise = this.initializeServiceWorkerMessaging().then(() => {
|
|
3128
|
-
}, () => {
|
|
3129
|
-
});
|
|
3130
|
-
}
|
|
3131
|
-
async _openDb() {
|
|
3132
|
-
return this.db ? this.db : (this.db = await fe(), this.db);
|
|
3133
|
-
}
|
|
3134
|
-
async _withRetries(e) {
|
|
3135
|
-
let t = 0;
|
|
3136
|
-
for (; ; )
|
|
3137
|
-
try {
|
|
3138
|
-
const i = await this._openDb();
|
|
3139
|
-
return await e(i);
|
|
3140
|
-
} catch (i) {
|
|
3141
|
-
if (t++ > Ii)
|
|
3142
|
-
throw i;
|
|
3143
|
-
this.db && (this.db.close(), this.db = void 0);
|
|
3144
|
-
}
|
|
3145
|
-
}
|
|
3146
|
-
/**
|
|
3147
|
-
* IndexedDB events do not propagate from the main window to the worker context. We rely on a
|
|
3148
|
-
* postMessage interface to send these events to the worker ourselves.
|
|
3149
|
-
*/
|
|
3150
|
-
async initializeServiceWorkerMessaging() {
|
|
3151
|
-
return Pt() ? this.initializeReceiver() : this.initializeSender();
|
|
3152
|
-
}
|
|
3153
|
-
/**
|
|
3154
|
-
* As the worker we should listen to events from the main window.
|
|
3155
|
-
*/
|
|
3156
|
-
async initializeReceiver() {
|
|
3157
|
-
this.receiver = ie._getInstance(pi()), this.receiver._subscribe("keyChanged", async (e, t) => ({
|
|
3158
|
-
keyProcessed: (await this._poll()).includes(t.key)
|
|
3159
|
-
})), this.receiver._subscribe("ping", async (e, t) => [
|
|
3160
|
-
"keyChanged"
|
|
3161
|
-
/* _EventType.KEY_CHANGED */
|
|
3162
|
-
]);
|
|
3163
|
-
}
|
|
3164
|
-
/**
|
|
3165
|
-
* As the main window, we should let the worker know when keys change (set and remove).
|
|
3166
|
-
*
|
|
3167
|
-
* @remarks
|
|
3168
|
-
* {@link https://developer.mozilla.org/en-US/docs/Web/API/ServiceWorkerContainer/ready | ServiceWorkerContainer.ready}
|
|
3169
|
-
* may not resolve.
|
|
3170
|
-
*/
|
|
3171
|
-
async initializeSender() {
|
|
3172
|
-
var e, t;
|
|
3173
|
-
if (this.activeServiceWorker = await hi(), !this.activeServiceWorker)
|
|
3174
|
-
return;
|
|
3175
|
-
this.sender = new ui(this.activeServiceWorker);
|
|
3176
|
-
const i = await this.sender._send(
|
|
3177
|
-
"ping",
|
|
3178
|
-
{},
|
|
3179
|
-
800
|
|
3180
|
-
/* _TimeoutDuration.LONG_ACK */
|
|
3181
|
-
);
|
|
3182
|
-
i && !((e = i[0]) === null || e === void 0) && e.fulfilled && !((t = i[0]) === null || t === void 0) && t.value.includes(
|
|
3183
|
-
"keyChanged"
|
|
3184
|
-
/* _EventType.KEY_CHANGED */
|
|
3185
|
-
) && (this.serviceWorkerReceiverAvailable = !0);
|
|
3186
|
-
}
|
|
3187
|
-
/**
|
|
3188
|
-
* Let the worker know about a changed key, the exact key doesn't technically matter since the
|
|
3189
|
-
* worker will just trigger a full sync anyway.
|
|
3190
|
-
*
|
|
3191
|
-
* @remarks
|
|
3192
|
-
* For now, we only support one service worker per page.
|
|
3193
|
-
*
|
|
3194
|
-
* @param key - Storage key which changed.
|
|
3195
|
-
*/
|
|
3196
|
-
async notifyServiceWorker(e) {
|
|
3197
|
-
if (!(!this.sender || !this.activeServiceWorker || fi() !== this.activeServiceWorker))
|
|
3198
|
-
try {
|
|
3199
|
-
await this.sender._send(
|
|
3200
|
-
"keyChanged",
|
|
3201
|
-
{ key: e },
|
|
3202
|
-
// Use long timeout if receiver has previously responded to a ping from us.
|
|
3203
|
-
this.serviceWorkerReceiverAvailable ? 800 : 50
|
|
3204
|
-
/* _TimeoutDuration.ACK */
|
|
3205
|
-
);
|
|
3206
|
-
} catch {
|
|
3207
|
-
}
|
|
3208
|
-
}
|
|
3209
|
-
async _isAvailable() {
|
|
3210
|
-
try {
|
|
3211
|
-
if (!indexedDB)
|
|
3212
|
-
return !1;
|
|
3213
|
-
const e = await fe();
|
|
3214
|
-
return await He(e, ee, "1"), await Ke(e, ee), !0;
|
|
3215
|
-
} catch {
|
|
3216
|
-
}
|
|
3217
|
-
return !1;
|
|
3218
|
-
}
|
|
3219
|
-
async _withPendingWrite(e) {
|
|
3220
|
-
this.pendingWrites++;
|
|
3221
|
-
try {
|
|
3222
|
-
await e();
|
|
3223
|
-
} finally {
|
|
3224
|
-
this.pendingWrites--;
|
|
3225
|
-
}
|
|
3226
|
-
}
|
|
3227
|
-
async _set(e, t) {
|
|
3228
|
-
return this._withPendingWrite(async () => (await this._withRetries((i) => He(i, e, t)), this.localCache[e] = t, this.notifyServiceWorker(e)));
|
|
3229
|
-
}
|
|
3230
|
-
async _get(e) {
|
|
3231
|
-
const t = await this._withRetries((i) => _i(i, e));
|
|
3232
|
-
return this.localCache[e] = t, t;
|
|
3233
|
-
}
|
|
3234
|
-
async _remove(e) {
|
|
3235
|
-
return this._withPendingWrite(async () => (await this._withRetries((t) => Ke(t, e)), delete this.localCache[e], this.notifyServiceWorker(e)));
|
|
3236
|
-
}
|
|
3237
|
-
async _poll() {
|
|
3238
|
-
const e = await this._withRetries((r) => {
|
|
3239
|
-
const s = re(r, !1).getAll();
|
|
3240
|
-
return new $(s).toPromise();
|
|
3241
|
-
});
|
|
3242
|
-
if (!e)
|
|
3243
|
-
return [];
|
|
3244
|
-
if (this.pendingWrites !== 0)
|
|
3245
|
-
return [];
|
|
3246
|
-
const t = [], i = /* @__PURE__ */ new Set();
|
|
3247
|
-
for (const { fbase_key: r, value: s } of e)
|
|
3248
|
-
i.add(r), JSON.stringify(this.localCache[r]) !== JSON.stringify(s) && (this.notifyListeners(r, s), t.push(r));
|
|
3249
|
-
for (const r of Object.keys(this.localCache))
|
|
3250
|
-
this.localCache[r] && !i.has(r) && (this.notifyListeners(r, null), t.push(r));
|
|
3251
|
-
return t;
|
|
3252
|
-
}
|
|
3253
|
-
notifyListeners(e, t) {
|
|
3254
|
-
this.localCache[e] = t;
|
|
3255
|
-
const i = this.listeners[e];
|
|
3256
|
-
if (i)
|
|
3257
|
-
for (const r of Array.from(i))
|
|
3258
|
-
r(t);
|
|
3259
|
-
}
|
|
3260
|
-
startPolling() {
|
|
3261
|
-
this.stopPolling(), this.pollTimer = setInterval(async () => this._poll(), vi);
|
|
3262
|
-
}
|
|
3263
|
-
stopPolling() {
|
|
3264
|
-
this.pollTimer && (clearInterval(this.pollTimer), this.pollTimer = null);
|
|
3265
|
-
}
|
|
3266
|
-
_addListener(e, t) {
|
|
3267
|
-
Object.keys(this.listeners).length === 0 && this.startPolling(), this.listeners[e] || (this.listeners[e] = /* @__PURE__ */ new Set(), this._get(e)), this.listeners[e].add(t);
|
|
3268
|
-
}
|
|
3269
|
-
_removeListener(e, t) {
|
|
3270
|
-
this.listeners[e] && (this.listeners[e].delete(t), this.listeners[e].size === 0 && delete this.listeners[e]), Object.keys(this.listeners).length === 0 && this.stopPolling();
|
|
3271
|
-
}
|
|
3272
|
-
}
|
|
3273
|
-
Lt.type = "LOCAL";
|
|
3274
|
-
const yi = Lt;
|
|
3275
|
-
new V(3e4, 6e4);
|
|
3276
|
-
/**
|
|
3277
|
-
* @license
|
|
3278
|
-
* Copyright 2021 Google LLC
|
|
3279
|
-
*
|
|
3280
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3281
|
-
* you may not use this file except in compliance with the License.
|
|
3282
|
-
* You may obtain a copy of the License at
|
|
3283
|
-
*
|
|
3284
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3285
|
-
*
|
|
3286
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3287
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3288
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3289
|
-
* See the License for the specific language governing permissions and
|
|
3290
|
-
* limitations under the License.
|
|
3291
|
-
*/
|
|
3292
|
-
function Ti(n, e) {
|
|
3293
|
-
return e ? v(e) : (u(
|
|
3294
|
-
n._popupRedirectResolver,
|
|
3295
|
-
n,
|
|
3296
|
-
"argument-error"
|
|
3297
|
-
/* AuthErrorCode.ARGUMENT_ERROR */
|
|
3298
|
-
), n._popupRedirectResolver);
|
|
3299
|
-
}
|
|
3300
|
-
/**
|
|
3301
|
-
* @license
|
|
3302
|
-
* Copyright 2019 Google LLC
|
|
3303
|
-
*
|
|
3304
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3305
|
-
* you may not use this file except in compliance with the License.
|
|
3306
|
-
* You may obtain a copy of the License at
|
|
3307
|
-
*
|
|
3308
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3309
|
-
*
|
|
3310
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3311
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3312
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3313
|
-
* See the License for the specific language governing permissions and
|
|
3314
|
-
* limitations under the License.
|
|
3315
|
-
*/
|
|
3316
|
-
class Ee extends Et {
|
|
3317
|
-
constructor(e) {
|
|
3318
|
-
super(
|
|
3319
|
-
"custom",
|
|
3320
|
-
"custom"
|
|
3321
|
-
/* ProviderId.CUSTOM */
|
|
3322
|
-
), this.params = e;
|
|
3323
|
-
}
|
|
3324
|
-
_getIdTokenResponse(e) {
|
|
3325
|
-
return N(e, this._buildIdpRequest());
|
|
3326
|
-
}
|
|
3327
|
-
_linkToIdToken(e, t) {
|
|
3328
|
-
return N(e, this._buildIdpRequest(t));
|
|
3329
|
-
}
|
|
3330
|
-
_getReauthenticationResolver(e) {
|
|
3331
|
-
return N(e, this._buildIdpRequest());
|
|
3332
|
-
}
|
|
3333
|
-
_buildIdpRequest(e) {
|
|
3334
|
-
const t = {
|
|
3335
|
-
requestUri: this.params.requestUri,
|
|
3336
|
-
sessionId: this.params.sessionId,
|
|
3337
|
-
postBody: this.params.postBody,
|
|
3338
|
-
tenantId: this.params.tenantId,
|
|
3339
|
-
pendingToken: this.params.pendingToken,
|
|
3340
|
-
returnSecureToken: !0,
|
|
3341
|
-
returnIdpCredential: !0
|
|
3342
|
-
};
|
|
3343
|
-
return e && (t.idToken = e), t;
|
|
3344
|
-
}
|
|
3345
|
-
}
|
|
3346
|
-
function wi(n) {
|
|
3347
|
-
return ei(n.auth, new Ee(n), n.bypassAuthState);
|
|
3348
|
-
}
|
|
3349
|
-
function Ei(n) {
|
|
3350
|
-
const { auth: e, user: t } = n;
|
|
3351
|
-
return u(
|
|
3352
|
-
t,
|
|
3353
|
-
e,
|
|
3354
|
-
"internal-error"
|
|
3355
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
3356
|
-
), Zn(t, new Ee(n), n.bypassAuthState);
|
|
3357
|
-
}
|
|
3358
|
-
async function ki(n) {
|
|
3359
|
-
const { auth: e, user: t } = n;
|
|
3360
|
-
return u(
|
|
3361
|
-
t,
|
|
3362
|
-
e,
|
|
3363
|
-
"internal-error"
|
|
3364
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
3365
|
-
), Qn(t, new Ee(n), n.bypassAuthState);
|
|
3366
|
-
}
|
|
3367
|
-
/**
|
|
3368
|
-
* @license
|
|
3369
|
-
* Copyright 2020 Google LLC
|
|
3370
|
-
*
|
|
3371
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3372
|
-
* you may not use this file except in compliance with the License.
|
|
3373
|
-
* You may obtain a copy of the License at
|
|
3374
|
-
*
|
|
3375
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3376
|
-
*
|
|
3377
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3378
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3379
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3380
|
-
* See the License for the specific language governing permissions and
|
|
3381
|
-
* limitations under the License.
|
|
3382
|
-
*/
|
|
3383
|
-
class Mt {
|
|
3384
|
-
constructor(e, t, i, r, s = !1) {
|
|
3385
|
-
this.auth = e, this.resolver = i, this.user = r, this.bypassAuthState = s, this.pendingPromise = null, this.eventManager = null, this.filter = Array.isArray(t) ? t : [t];
|
|
3386
|
-
}
|
|
3387
|
-
execute() {
|
|
3388
|
-
return new Promise(async (e, t) => {
|
|
3389
|
-
this.pendingPromise = { resolve: e, reject: t };
|
|
3390
|
-
try {
|
|
3391
|
-
this.eventManager = await this.resolver._initialize(this.auth), await this.onExecution(), this.eventManager.registerConsumer(this);
|
|
3392
|
-
} catch (i) {
|
|
3393
|
-
this.reject(i);
|
|
3394
|
-
}
|
|
3395
|
-
});
|
|
3396
|
-
}
|
|
3397
|
-
async onAuthEvent(e) {
|
|
3398
|
-
const { urlResponse: t, sessionId: i, postBody: r, tenantId: s, error: o, type: c } = e;
|
|
3399
|
-
if (o) {
|
|
3400
|
-
this.reject(o);
|
|
3401
|
-
return;
|
|
3402
|
-
}
|
|
3403
|
-
const a = {
|
|
3404
|
-
auth: this.auth,
|
|
3405
|
-
requestUri: t,
|
|
3406
|
-
sessionId: i,
|
|
3407
|
-
tenantId: s || void 0,
|
|
3408
|
-
postBody: r || void 0,
|
|
3409
|
-
user: this.user,
|
|
3410
|
-
bypassAuthState: this.bypassAuthState
|
|
3411
|
-
};
|
|
3412
|
-
try {
|
|
3413
|
-
this.resolve(await this.getIdpTask(c)(a));
|
|
3414
|
-
} catch (l) {
|
|
3415
|
-
this.reject(l);
|
|
3416
|
-
}
|
|
3417
|
-
}
|
|
3418
|
-
onError(e) {
|
|
3419
|
-
this.reject(e);
|
|
3420
|
-
}
|
|
3421
|
-
getIdpTask(e) {
|
|
3422
|
-
switch (e) {
|
|
3423
|
-
case "signInViaPopup":
|
|
3424
|
-
case "signInViaRedirect":
|
|
3425
|
-
return wi;
|
|
3426
|
-
case "linkViaPopup":
|
|
3427
|
-
case "linkViaRedirect":
|
|
3428
|
-
return ki;
|
|
3429
|
-
case "reauthViaPopup":
|
|
3430
|
-
case "reauthViaRedirect":
|
|
3431
|
-
return Ei;
|
|
3432
|
-
default:
|
|
3433
|
-
I(
|
|
3434
|
-
this.auth,
|
|
3435
|
-
"internal-error"
|
|
3436
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
3437
|
-
);
|
|
3438
|
-
}
|
|
3439
|
-
}
|
|
3440
|
-
resolve(e) {
|
|
3441
|
-
y(this.pendingPromise, "Pending promise was never set"), this.pendingPromise.resolve(e), this.unregisterAndCleanUp();
|
|
3442
|
-
}
|
|
3443
|
-
reject(e) {
|
|
3444
|
-
y(this.pendingPromise, "Pending promise was never set"), this.pendingPromise.reject(e), this.unregisterAndCleanUp();
|
|
3445
|
-
}
|
|
3446
|
-
unregisterAndCleanUp() {
|
|
3447
|
-
this.eventManager && this.eventManager.unregisterConsumer(this), this.pendingPromise = null, this.cleanUp();
|
|
3448
|
-
}
|
|
3449
|
-
}
|
|
3450
|
-
/**
|
|
3451
|
-
* @license
|
|
3452
|
-
* Copyright 2020 Google LLC
|
|
3453
|
-
*
|
|
3454
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3455
|
-
* you may not use this file except in compliance with the License.
|
|
3456
|
-
* You may obtain a copy of the License at
|
|
3457
|
-
*
|
|
3458
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3459
|
-
*
|
|
3460
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3461
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3462
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3463
|
-
* See the License for the specific language governing permissions and
|
|
3464
|
-
* limitations under the License.
|
|
3465
|
-
*/
|
|
3466
|
-
const Ri = new V(2e3, 1e4);
|
|
3467
|
-
class C extends Mt {
|
|
3468
|
-
constructor(e, t, i, r, s) {
|
|
3469
|
-
super(e, t, r, s), this.provider = i, this.authWindow = null, this.pollId = null, C.currentPopupAction && C.currentPopupAction.cancel(), C.currentPopupAction = this;
|
|
3470
|
-
}
|
|
3471
|
-
async executeNotNull() {
|
|
3472
|
-
const e = await this.execute();
|
|
3473
|
-
return u(
|
|
3474
|
-
e,
|
|
3475
|
-
this.auth,
|
|
3476
|
-
"internal-error"
|
|
3477
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
3478
|
-
), e;
|
|
3479
|
-
}
|
|
3480
|
-
async onExecution() {
|
|
3481
|
-
y(this.filter.length === 1, "Popup operations only handle one event");
|
|
3482
|
-
const e = we();
|
|
3483
|
-
this.authWindow = await this.resolver._openPopup(
|
|
3484
|
-
this.auth,
|
|
3485
|
-
this.provider,
|
|
3486
|
-
this.filter[0],
|
|
3487
|
-
// There's always one, see constructor
|
|
3488
|
-
e
|
|
3489
|
-
), this.authWindow.associatedEvent = e, this.resolver._originValidation(this.auth).catch((t) => {
|
|
3490
|
-
this.reject(t);
|
|
3491
|
-
}), this.resolver._isIframeWebStorageSupported(this.auth, (t) => {
|
|
3492
|
-
t || this.reject(g(
|
|
3493
|
-
this.auth,
|
|
3494
|
-
"web-storage-unsupported"
|
|
3495
|
-
/* AuthErrorCode.WEB_STORAGE_UNSUPPORTED */
|
|
3496
|
-
));
|
|
3497
|
-
}), this.pollUserCancellation();
|
|
3498
|
-
}
|
|
3499
|
-
get eventId() {
|
|
3500
|
-
var e;
|
|
3501
|
-
return ((e = this.authWindow) === null || e === void 0 ? void 0 : e.associatedEvent) || null;
|
|
3502
|
-
}
|
|
3503
|
-
cancel() {
|
|
3504
|
-
this.reject(g(
|
|
3505
|
-
this.auth,
|
|
3506
|
-
"cancelled-popup-request"
|
|
3507
|
-
/* AuthErrorCode.EXPIRED_POPUP_REQUEST */
|
|
3508
|
-
));
|
|
3509
|
-
}
|
|
3510
|
-
cleanUp() {
|
|
3511
|
-
this.authWindow && this.authWindow.close(), this.pollId && window.clearTimeout(this.pollId), this.authWindow = null, this.pollId = null, C.currentPopupAction = null;
|
|
3512
|
-
}
|
|
3513
|
-
pollUserCancellation() {
|
|
3514
|
-
const e = () => {
|
|
3515
|
-
var t, i;
|
|
3516
|
-
if (!((i = (t = this.authWindow) === null || t === void 0 ? void 0 : t.window) === null || i === void 0) && i.closed) {
|
|
3517
|
-
this.pollId = window.setTimeout(
|
|
3518
|
-
() => {
|
|
3519
|
-
this.pollId = null, this.reject(g(
|
|
3520
|
-
this.auth,
|
|
3521
|
-
"popup-closed-by-user"
|
|
3522
|
-
/* AuthErrorCode.POPUP_CLOSED_BY_USER */
|
|
3523
|
-
));
|
|
3524
|
-
},
|
|
3525
|
-
8e3
|
|
3526
|
-
/* _Timeout.AUTH_EVENT */
|
|
3527
|
-
);
|
|
3528
|
-
return;
|
|
3529
|
-
}
|
|
3530
|
-
this.pollId = window.setTimeout(e, Ri.get());
|
|
3531
|
-
};
|
|
3532
|
-
e();
|
|
3533
|
-
}
|
|
3534
|
-
}
|
|
3535
|
-
C.currentPopupAction = null;
|
|
3536
|
-
/**
|
|
3537
|
-
* @license
|
|
3538
|
-
* Copyright 2020 Google LLC
|
|
3539
|
-
*
|
|
3540
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3541
|
-
* you may not use this file except in compliance with the License.
|
|
3542
|
-
* You may obtain a copy of the License at
|
|
3543
|
-
*
|
|
3544
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3545
|
-
*
|
|
3546
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3547
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3548
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3549
|
-
* See the License for the specific language governing permissions and
|
|
3550
|
-
* limitations under the License.
|
|
3551
|
-
*/
|
|
3552
|
-
const bi = "pendingRedirect", J = /* @__PURE__ */ new Map();
|
|
3553
|
-
class Si extends Mt {
|
|
3554
|
-
constructor(e, t, i = !1) {
|
|
3555
|
-
super(e, [
|
|
3556
|
-
"signInViaRedirect",
|
|
3557
|
-
"linkViaRedirect",
|
|
3558
|
-
"reauthViaRedirect",
|
|
3559
|
-
"unknown"
|
|
3560
|
-
/* AuthEventType.UNKNOWN */
|
|
3561
|
-
], t, void 0, i), this.eventId = null;
|
|
3562
|
-
}
|
|
3563
|
-
/**
|
|
3564
|
-
* Override the execute function; if we already have a redirect result, then
|
|
3565
|
-
* just return it.
|
|
3566
|
-
*/
|
|
3567
|
-
async execute() {
|
|
3568
|
-
let e = J.get(this.auth._key());
|
|
3569
|
-
if (!e) {
|
|
3570
|
-
try {
|
|
3571
|
-
const i = await Ai(this.resolver, this.auth) ? await super.execute() : null;
|
|
3572
|
-
e = () => Promise.resolve(i);
|
|
3573
|
-
} catch (t) {
|
|
3574
|
-
e = () => Promise.reject(t);
|
|
3575
|
-
}
|
|
3576
|
-
J.set(this.auth._key(), e);
|
|
3577
|
-
}
|
|
3578
|
-
return this.bypassAuthState || J.set(this.auth._key(), () => Promise.resolve(null)), e();
|
|
3579
|
-
}
|
|
3580
|
-
async onAuthEvent(e) {
|
|
3581
|
-
if (e.type === "signInViaRedirect")
|
|
3582
|
-
return super.onAuthEvent(e);
|
|
3583
|
-
if (e.type === "unknown") {
|
|
3584
|
-
this.resolve(null);
|
|
3585
|
-
return;
|
|
3586
|
-
}
|
|
3587
|
-
if (e.eventId) {
|
|
3588
|
-
const t = await this.auth._redirectUserForId(e.eventId);
|
|
3589
|
-
if (t)
|
|
3590
|
-
return this.user = t, super.onAuthEvent(e);
|
|
3591
|
-
this.resolve(null);
|
|
3592
|
-
}
|
|
3593
|
-
}
|
|
3594
|
-
async onExecution() {
|
|
3595
|
-
}
|
|
3596
|
-
cleanUp() {
|
|
3597
|
-
}
|
|
3598
|
-
}
|
|
3599
|
-
async function Ai(n, e) {
|
|
3600
|
-
const t = Ni(e), i = Pi(n);
|
|
3601
|
-
if (!await i._isAvailable())
|
|
3602
|
-
return !1;
|
|
3603
|
-
const r = await i._get(t) === "true";
|
|
3604
|
-
return await i._remove(t), r;
|
|
3605
|
-
}
|
|
3606
|
-
function Ci(n, e) {
|
|
3607
|
-
J.set(n._key(), e);
|
|
3608
|
-
}
|
|
3609
|
-
function Pi(n) {
|
|
3610
|
-
return v(n._redirectPersistence);
|
|
3611
|
-
}
|
|
3612
|
-
function Ni(n) {
|
|
3613
|
-
return G(bi, n.config.apiKey, n.name);
|
|
3614
|
-
}
|
|
3615
|
-
async function Oi(n, e, t = !1) {
|
|
3616
|
-
const i = H(n), r = Ti(i, e), o = await new Si(i, r, t).execute();
|
|
3617
|
-
return o && !t && (delete o.user._redirectEventId, await i._persistUserIfCurrent(o.user), await i._setRedirectUser(null, e)), o;
|
|
3618
|
-
}
|
|
3619
|
-
/**
|
|
3620
|
-
* @license
|
|
3621
|
-
* Copyright 2020 Google LLC
|
|
3622
|
-
*
|
|
3623
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3624
|
-
* you may not use this file except in compliance with the License.
|
|
3625
|
-
* You may obtain a copy of the License at
|
|
3626
|
-
*
|
|
3627
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3628
|
-
*
|
|
3629
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3630
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3631
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3632
|
-
* See the License for the specific language governing permissions and
|
|
3633
|
-
* limitations under the License.
|
|
3634
|
-
*/
|
|
3635
|
-
const Li = 10 * 60 * 1e3;
|
|
3636
|
-
class Mi {
|
|
3637
|
-
constructor(e) {
|
|
3638
|
-
this.auth = e, this.cachedEventUids = /* @__PURE__ */ new Set(), this.consumers = /* @__PURE__ */ new Set(), this.queuedRedirectEvent = null, this.hasHandledPotentialRedirect = !1, this.lastProcessedEventTime = Date.now();
|
|
3639
|
-
}
|
|
3640
|
-
registerConsumer(e) {
|
|
3641
|
-
this.consumers.add(e), this.queuedRedirectEvent && this.isEventForConsumer(this.queuedRedirectEvent, e) && (this.sendToConsumer(this.queuedRedirectEvent, e), this.saveEventToCache(this.queuedRedirectEvent), this.queuedRedirectEvent = null);
|
|
3642
|
-
}
|
|
3643
|
-
unregisterConsumer(e) {
|
|
3644
|
-
this.consumers.delete(e);
|
|
3645
|
-
}
|
|
3646
|
-
onEvent(e) {
|
|
3647
|
-
if (this.hasEventBeenHandled(e))
|
|
3648
|
-
return !1;
|
|
3649
|
-
let t = !1;
|
|
3650
|
-
return this.consumers.forEach((i) => {
|
|
3651
|
-
this.isEventForConsumer(e, i) && (t = !0, this.sendToConsumer(e, i), this.saveEventToCache(e));
|
|
3652
|
-
}), this.hasHandledPotentialRedirect || !Ui(e) || (this.hasHandledPotentialRedirect = !0, t || (this.queuedRedirectEvent = e, t = !0)), t;
|
|
3653
|
-
}
|
|
3654
|
-
sendToConsumer(e, t) {
|
|
3655
|
-
var i;
|
|
3656
|
-
if (e.error && !Ut(e)) {
|
|
3657
|
-
const r = ((i = e.error.code) === null || i === void 0 ? void 0 : i.split("auth/")[1]) || "internal-error";
|
|
3658
|
-
t.onError(g(this.auth, r));
|
|
3659
|
-
} else
|
|
3660
|
-
t.onAuthEvent(e);
|
|
3661
|
-
}
|
|
3662
|
-
isEventForConsumer(e, t) {
|
|
3663
|
-
const i = t.eventId === null || !!e.eventId && e.eventId === t.eventId;
|
|
3664
|
-
return t.filter.includes(e.type) && i;
|
|
3665
|
-
}
|
|
3666
|
-
hasEventBeenHandled(e) {
|
|
3667
|
-
return Date.now() - this.lastProcessedEventTime >= Li && this.cachedEventUids.clear(), this.cachedEventUids.has($e(e));
|
|
3668
|
-
}
|
|
3669
|
-
saveEventToCache(e) {
|
|
3670
|
-
this.cachedEventUids.add($e(e)), this.lastProcessedEventTime = Date.now();
|
|
3671
|
-
}
|
|
3672
|
-
}
|
|
3673
|
-
function $e(n) {
|
|
3674
|
-
return [n.type, n.eventId, n.sessionId, n.tenantId].filter((e) => e).join("-");
|
|
3675
|
-
}
|
|
3676
|
-
function Ut({ type: n, error: e }) {
|
|
3677
|
-
return n === "unknown" && (e == null ? void 0 : e.code) === "auth/no-auth-event";
|
|
3678
|
-
}
|
|
3679
|
-
function Ui(n) {
|
|
3680
|
-
switch (n.type) {
|
|
3681
|
-
case "signInViaRedirect":
|
|
3682
|
-
case "linkViaRedirect":
|
|
3683
|
-
case "reauthViaRedirect":
|
|
3684
|
-
return !0;
|
|
3685
|
-
case "unknown":
|
|
3686
|
-
return Ut(n);
|
|
3687
|
-
default:
|
|
3688
|
-
return !1;
|
|
3689
|
-
}
|
|
3690
|
-
}
|
|
3691
|
-
/**
|
|
3692
|
-
* @license
|
|
3693
|
-
* Copyright 2020 Google LLC
|
|
3694
|
-
*
|
|
3695
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3696
|
-
* you may not use this file except in compliance with the License.
|
|
3697
|
-
* You may obtain a copy of the License at
|
|
3698
|
-
*
|
|
3699
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3700
|
-
*
|
|
3701
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3702
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3703
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3704
|
-
* See the License for the specific language governing permissions and
|
|
3705
|
-
* limitations under the License.
|
|
3706
|
-
*/
|
|
3707
|
-
async function Di(n, e = {}) {
|
|
3708
|
-
return W(n, "GET", "/v1/projects", e);
|
|
3709
|
-
}
|
|
3710
|
-
/**
|
|
3711
|
-
* @license
|
|
3712
|
-
* Copyright 2020 Google LLC
|
|
3713
|
-
*
|
|
3714
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3715
|
-
* you may not use this file except in compliance with the License.
|
|
3716
|
-
* You may obtain a copy of the License at
|
|
3717
|
-
*
|
|
3718
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3719
|
-
*
|
|
3720
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3721
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3722
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3723
|
-
* See the License for the specific language governing permissions and
|
|
3724
|
-
* limitations under the License.
|
|
3725
|
-
*/
|
|
3726
|
-
const Fi = /^\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3}$/, xi = /^https?/;
|
|
3727
|
-
async function Vi(n) {
|
|
3728
|
-
if (n.config.emulator)
|
|
3729
|
-
return;
|
|
3730
|
-
const { authorizedDomains: e } = await Di(n);
|
|
3731
|
-
for (const t of e)
|
|
3732
|
-
try {
|
|
3733
|
-
if (Wi(t))
|
|
3734
|
-
return;
|
|
3735
|
-
} catch {
|
|
3736
|
-
}
|
|
3737
|
-
I(
|
|
3738
|
-
n,
|
|
3739
|
-
"unauthorized-domain"
|
|
3740
|
-
/* AuthErrorCode.INVALID_ORIGIN */
|
|
3741
|
-
);
|
|
3742
|
-
}
|
|
3743
|
-
function Wi(n) {
|
|
3744
|
-
const e = he(), { protocol: t, hostname: i } = new URL(e);
|
|
3745
|
-
if (n.startsWith("chrome-extension://")) {
|
|
3746
|
-
const o = new URL(n);
|
|
3747
|
-
return o.hostname === "" && i === "" ? t === "chrome-extension:" && n.replace("chrome-extension://", "") === e.replace("chrome-extension://", "") : t === "chrome-extension:" && o.hostname === i;
|
|
3748
|
-
}
|
|
3749
|
-
if (!xi.test(t))
|
|
3750
|
-
return !1;
|
|
3751
|
-
if (Fi.test(n))
|
|
3752
|
-
return i === n;
|
|
3753
|
-
const r = n.replace(/\./g, "\\.");
|
|
3754
|
-
return new RegExp("^(.+\\." + r + "|" + r + ")$", "i").test(i);
|
|
3755
|
-
}
|
|
3756
|
-
/**
|
|
3757
|
-
* @license
|
|
3758
|
-
* Copyright 2020 Google LLC.
|
|
3759
|
-
*
|
|
3760
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3761
|
-
* you may not use this file except in compliance with the License.
|
|
3762
|
-
* You may obtain a copy of the License at
|
|
3763
|
-
*
|
|
3764
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3765
|
-
*
|
|
3766
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3767
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3768
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3769
|
-
* See the License for the specific language governing permissions and
|
|
3770
|
-
* limitations under the License.
|
|
3771
|
-
*/
|
|
3772
|
-
const Hi = new V(3e4, 6e4);
|
|
3773
|
-
function Be() {
|
|
3774
|
-
const n = m().___jsl;
|
|
3775
|
-
if (n != null && n.H) {
|
|
3776
|
-
for (const e of Object.keys(n.H))
|
|
3777
|
-
if (n.H[e].r = n.H[e].r || [], n.H[e].L = n.H[e].L || [], n.H[e].r = [...n.H[e].L], n.CP)
|
|
3778
|
-
for (let t = 0; t < n.CP.length; t++)
|
|
3779
|
-
n.CP[t] = null;
|
|
3780
|
-
}
|
|
3781
|
-
}
|
|
3782
|
-
function Ki(n) {
|
|
3783
|
-
return new Promise((e, t) => {
|
|
3784
|
-
var i, r, s;
|
|
3785
|
-
function o() {
|
|
3786
|
-
Be(), gapi.load("gapi.iframes", {
|
|
3787
|
-
callback: () => {
|
|
3788
|
-
e(gapi.iframes.getContext());
|
|
3789
|
-
},
|
|
3790
|
-
ontimeout: () => {
|
|
3791
|
-
Be(), t(g(
|
|
3792
|
-
n,
|
|
3793
|
-
"network-request-failed"
|
|
3794
|
-
/* AuthErrorCode.NETWORK_REQUEST_FAILED */
|
|
3795
|
-
));
|
|
3796
|
-
},
|
|
3797
|
-
timeout: Hi.get()
|
|
3798
|
-
});
|
|
3799
|
-
}
|
|
3800
|
-
if (!((r = (i = m().gapi) === null || i === void 0 ? void 0 : i.iframes) === null || r === void 0) && r.Iframe)
|
|
3801
|
-
e(gapi.iframes.getContext());
|
|
3802
|
-
else if (!((s = m().gapi) === null || s === void 0) && s.load)
|
|
3803
|
-
o();
|
|
3804
|
-
else {
|
|
3805
|
-
const c = Vn("iframefcb");
|
|
3806
|
-
return m()[c] = () => {
|
|
3807
|
-
gapi.load ? o() : t(g(
|
|
3808
|
-
n,
|
|
3809
|
-
"network-request-failed"
|
|
3810
|
-
/* AuthErrorCode.NETWORK_REQUEST_FAILED */
|
|
3811
|
-
));
|
|
3812
|
-
}, Tt(`https://apis.google.com/js/api.js?onload=${c}`).catch((a) => t(a));
|
|
3813
|
-
}
|
|
3814
|
-
}).catch((e) => {
|
|
3815
|
-
throw X = null, e;
|
|
3816
|
-
});
|
|
3817
|
-
}
|
|
3818
|
-
let X = null;
|
|
3819
|
-
function $i(n) {
|
|
3820
|
-
return X = X || Ki(n), X;
|
|
3821
|
-
}
|
|
3822
|
-
/**
|
|
3823
|
-
* @license
|
|
3824
|
-
* Copyright 2020 Google LLC.
|
|
3825
|
-
*
|
|
3826
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3827
|
-
* you may not use this file except in compliance with the License.
|
|
3828
|
-
* You may obtain a copy of the License at
|
|
3829
|
-
*
|
|
3830
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3831
|
-
*
|
|
3832
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3833
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3834
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3835
|
-
* See the License for the specific language governing permissions and
|
|
3836
|
-
* limitations under the License.
|
|
3837
|
-
*/
|
|
3838
|
-
const Bi = new V(5e3, 15e3), zi = "__/auth/iframe", ji = "emulator/auth/iframe", qi = {
|
|
3839
|
-
style: {
|
|
3840
|
-
position: "absolute",
|
|
3841
|
-
top: "-100px",
|
|
3842
|
-
width: "1px",
|
|
3843
|
-
height: "1px"
|
|
3844
|
-
},
|
|
3845
|
-
"aria-hidden": "true",
|
|
3846
|
-
tabindex: "-1"
|
|
3847
|
-
}, Gi = /* @__PURE__ */ new Map([
|
|
3848
|
-
["identitytoolkit.googleapis.com", "p"],
|
|
3849
|
-
["staging-identitytoolkit.sandbox.googleapis.com", "s"],
|
|
3850
|
-
["test-identitytoolkit.sandbox.googleapis.com", "t"]
|
|
3851
|
-
// test
|
|
3852
|
-
]);
|
|
3853
|
-
function Ji(n) {
|
|
3854
|
-
const e = n.config;
|
|
3855
|
-
u(
|
|
3856
|
-
e.authDomain,
|
|
3857
|
-
n,
|
|
3858
|
-
"auth-domain-config-required"
|
|
3859
|
-
/* AuthErrorCode.MISSING_AUTH_DOMAIN */
|
|
3860
|
-
);
|
|
3861
|
-
const t = e.emulator ? ve(e, ji) : `https://${n.config.authDomain}/${zi}`, i = {
|
|
3862
|
-
apiKey: e.apiKey,
|
|
3863
|
-
appName: n.name,
|
|
3864
|
-
v: F
|
|
3865
|
-
}, r = Gi.get(n.config.apiHost);
|
|
3866
|
-
r && (i.eid = r);
|
|
3867
|
-
const s = n._getFrameworks();
|
|
3868
|
-
return s.length && (i.fw = s.join(",")), `${t}?${x(i).slice(1)}`;
|
|
3869
|
-
}
|
|
3870
|
-
async function Xi(n) {
|
|
3871
|
-
const e = await $i(n), t = m().gapi;
|
|
3872
|
-
return u(
|
|
3873
|
-
t,
|
|
3874
|
-
n,
|
|
3875
|
-
"internal-error"
|
|
3876
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
3877
|
-
), e.open({
|
|
3878
|
-
where: document.body,
|
|
3879
|
-
url: Ji(n),
|
|
3880
|
-
messageHandlersFilter: t.iframes.CROSS_ORIGIN_IFRAMES_FILTER,
|
|
3881
|
-
attributes: qi,
|
|
3882
|
-
dontclear: !0
|
|
3883
|
-
}, (i) => new Promise(async (r, s) => {
|
|
3884
|
-
await i.restyle({
|
|
3885
|
-
// Prevent iframe from closing on mouse out.
|
|
3886
|
-
setHideOnLeave: !1
|
|
3887
|
-
});
|
|
3888
|
-
const o = g(
|
|
3889
|
-
n,
|
|
3890
|
-
"network-request-failed"
|
|
3891
|
-
/* AuthErrorCode.NETWORK_REQUEST_FAILED */
|
|
3892
|
-
), c = m().setTimeout(() => {
|
|
3893
|
-
s(o);
|
|
3894
|
-
}, Bi.get());
|
|
3895
|
-
function a() {
|
|
3896
|
-
m().clearTimeout(c), r(i);
|
|
3897
|
-
}
|
|
3898
|
-
i.ping(a).then(a, () => {
|
|
3899
|
-
s(o);
|
|
3900
|
-
});
|
|
3901
|
-
}));
|
|
3902
|
-
}
|
|
3903
|
-
/**
|
|
3904
|
-
* @license
|
|
3905
|
-
* Copyright 2020 Google LLC.
|
|
3906
|
-
*
|
|
3907
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3908
|
-
* you may not use this file except in compliance with the License.
|
|
3909
|
-
* You may obtain a copy of the License at
|
|
3910
|
-
*
|
|
3911
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3912
|
-
*
|
|
3913
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3914
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3915
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3916
|
-
* See the License for the specific language governing permissions and
|
|
3917
|
-
* limitations under the License.
|
|
3918
|
-
*/
|
|
3919
|
-
const Yi = {
|
|
3920
|
-
location: "yes",
|
|
3921
|
-
resizable: "yes",
|
|
3922
|
-
statusbar: "yes",
|
|
3923
|
-
toolbar: "no"
|
|
3924
|
-
}, Qi = 500, Zi = 600, er = "_blank", tr = "http://localhost";
|
|
3925
|
-
class ze {
|
|
3926
|
-
constructor(e) {
|
|
3927
|
-
this.window = e, this.associatedEvent = null;
|
|
3928
|
-
}
|
|
3929
|
-
close() {
|
|
3930
|
-
if (this.window)
|
|
3931
|
-
try {
|
|
3932
|
-
this.window.close();
|
|
3933
|
-
} catch {
|
|
3934
|
-
}
|
|
3935
|
-
}
|
|
3936
|
-
}
|
|
3937
|
-
function nr(n, e, t, i = Qi, r = Zi) {
|
|
3938
|
-
const s = Math.max((window.screen.availHeight - r) / 2, 0).toString(), o = Math.max((window.screen.availWidth - i) / 2, 0).toString();
|
|
3939
|
-
let c = "";
|
|
3940
|
-
const a = Object.assign(Object.assign({}, Yi), {
|
|
3941
|
-
width: i.toString(),
|
|
3942
|
-
height: r.toString(),
|
|
3943
|
-
top: s,
|
|
3944
|
-
left: o
|
|
3945
|
-
}), l = f().toLowerCase();
|
|
3946
|
-
t && (c = ht(l) ? er : t), dt(l) && (e = e || tr, a.scrollbars = "yes");
|
|
3947
|
-
const d = Object.entries(a).reduce((p, [B, z]) => `${p}${B}=${z},`, "");
|
|
3948
|
-
if (Un(l) && c !== "_self")
|
|
3949
|
-
return ir(e || "", c), new ze(null);
|
|
3950
|
-
const h = window.open(e || "", c, d);
|
|
3951
|
-
u(
|
|
3952
|
-
h,
|
|
3953
|
-
n,
|
|
3954
|
-
"popup-blocked"
|
|
3955
|
-
/* AuthErrorCode.POPUP_BLOCKED */
|
|
3956
|
-
);
|
|
3957
|
-
try {
|
|
3958
|
-
h.focus();
|
|
3959
|
-
} catch {
|
|
3960
|
-
}
|
|
3961
|
-
return new ze(h);
|
|
3962
|
-
}
|
|
3963
|
-
function ir(n, e) {
|
|
3964
|
-
const t = document.createElement("a");
|
|
3965
|
-
t.href = n, t.target = e;
|
|
3966
|
-
const i = document.createEvent("MouseEvent");
|
|
3967
|
-
i.initMouseEvent("click", !0, !0, window, 1, 0, 0, 0, 0, !1, !1, !1, !1, 1, null), t.dispatchEvent(i);
|
|
3968
|
-
}
|
|
3969
|
-
/**
|
|
3970
|
-
* @license
|
|
3971
|
-
* Copyright 2021 Google LLC
|
|
3972
|
-
*
|
|
3973
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
3974
|
-
* you may not use this file except in compliance with the License.
|
|
3975
|
-
* You may obtain a copy of the License at
|
|
3976
|
-
*
|
|
3977
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
3978
|
-
*
|
|
3979
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
3980
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
3981
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
3982
|
-
* See the License for the specific language governing permissions and
|
|
3983
|
-
* limitations under the License.
|
|
3984
|
-
*/
|
|
3985
|
-
const rr = "__/auth/handler", sr = "emulator/auth/handler", or = encodeURIComponent("fac");
|
|
3986
|
-
async function je(n, e, t, i, r, s) {
|
|
3987
|
-
u(
|
|
3988
|
-
n.config.authDomain,
|
|
3989
|
-
n,
|
|
3990
|
-
"auth-domain-config-required"
|
|
3991
|
-
/* AuthErrorCode.MISSING_AUTH_DOMAIN */
|
|
3992
|
-
), u(
|
|
3993
|
-
n.config.apiKey,
|
|
3994
|
-
n,
|
|
3995
|
-
"invalid-api-key"
|
|
3996
|
-
/* AuthErrorCode.INVALID_API_KEY */
|
|
3997
|
-
);
|
|
3998
|
-
const o = {
|
|
3999
|
-
apiKey: n.config.apiKey,
|
|
4000
|
-
appName: n.name,
|
|
4001
|
-
authType: t,
|
|
4002
|
-
redirectUrl: i,
|
|
4003
|
-
v: F,
|
|
4004
|
-
eventId: r
|
|
4005
|
-
};
|
|
4006
|
-
if (e instanceof kt) {
|
|
4007
|
-
e.setDefaultLanguage(n.languageCode), o.providerId = e.providerId || "", an(e.getCustomParameters()) || (o.customParameters = JSON.stringify(e.getCustomParameters()));
|
|
4008
|
-
for (const [d, h] of Object.entries(s || {}))
|
|
4009
|
-
o[d] = h;
|
|
4010
|
-
}
|
|
4011
|
-
if (e instanceof K) {
|
|
4012
|
-
const d = e.getScopes().filter((h) => h !== "");
|
|
4013
|
-
d.length > 0 && (o.scopes = d.join(","));
|
|
4014
|
-
}
|
|
4015
|
-
n.tenantId && (o.tid = n.tenantId);
|
|
4016
|
-
const c = o;
|
|
4017
|
-
for (const d of Object.keys(c))
|
|
4018
|
-
c[d] === void 0 && delete c[d];
|
|
4019
|
-
const a = await n._getAppCheckToken(), l = a ? `#${or}=${encodeURIComponent(a)}` : "";
|
|
4020
|
-
return `${ar(n)}?${x(c).slice(1)}${l}`;
|
|
4021
|
-
}
|
|
4022
|
-
function ar({ config: n }) {
|
|
4023
|
-
return n.emulator ? ve(n, sr) : `https://${n.authDomain}/${rr}`;
|
|
4024
|
-
}
|
|
4025
|
-
/**
|
|
4026
|
-
* @license
|
|
4027
|
-
* Copyright 2020 Google LLC
|
|
4028
|
-
*
|
|
4029
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4030
|
-
* you may not use this file except in compliance with the License.
|
|
4031
|
-
* You may obtain a copy of the License at
|
|
4032
|
-
*
|
|
4033
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4034
|
-
*
|
|
4035
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4036
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4037
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4038
|
-
* See the License for the specific language governing permissions and
|
|
4039
|
-
* limitations under the License.
|
|
4040
|
-
*/
|
|
4041
|
-
const ue = "webStorageSupport";
|
|
4042
|
-
class cr {
|
|
4043
|
-
constructor() {
|
|
4044
|
-
this.eventManagers = {}, this.iframes = {}, this.originValidationPromises = {}, this._redirectPersistence = Ct, this._completeRedirectFn = Oi, this._overrideRedirectResult = Ci;
|
|
4045
|
-
}
|
|
4046
|
-
// Wrapping in async even though we don't await anywhere in order
|
|
4047
|
-
// to make sure errors are raised as promise rejections
|
|
4048
|
-
async _openPopup(e, t, i, r) {
|
|
4049
|
-
var s;
|
|
4050
|
-
y((s = this.eventManagers[e._key()]) === null || s === void 0 ? void 0 : s.manager, "_initialize() not called before _openPopup()");
|
|
4051
|
-
const o = await je(e, t, i, he(), r);
|
|
4052
|
-
return nr(e, o, we());
|
|
4053
|
-
}
|
|
4054
|
-
async _openRedirect(e, t, i, r) {
|
|
4055
|
-
await this._originValidation(e);
|
|
4056
|
-
const s = await je(e, t, i, he(), r);
|
|
4057
|
-
return di(s), new Promise(() => {
|
|
4058
|
-
});
|
|
4059
|
-
}
|
|
4060
|
-
_initialize(e) {
|
|
4061
|
-
const t = e._key();
|
|
4062
|
-
if (this.eventManagers[t]) {
|
|
4063
|
-
const { manager: r, promise: s } = this.eventManagers[t];
|
|
4064
|
-
return r ? Promise.resolve(r) : (y(s, "If manager is not set, promise should be"), s);
|
|
4065
|
-
}
|
|
4066
|
-
const i = this.initAndGetManager(e);
|
|
4067
|
-
return this.eventManagers[t] = { promise: i }, i.catch(() => {
|
|
4068
|
-
delete this.eventManagers[t];
|
|
4069
|
-
}), i;
|
|
4070
|
-
}
|
|
4071
|
-
async initAndGetManager(e) {
|
|
4072
|
-
const t = await Xi(e), i = new Mi(e);
|
|
4073
|
-
return t.register("authEvent", (r) => (u(
|
|
4074
|
-
r == null ? void 0 : r.authEvent,
|
|
4075
|
-
e,
|
|
4076
|
-
"invalid-auth-event"
|
|
4077
|
-
/* AuthErrorCode.INVALID_AUTH_EVENT */
|
|
4078
|
-
), {
|
|
4079
|
-
status: i.onEvent(r.authEvent) ? "ACK" : "ERROR"
|
|
4080
|
-
/* GapiOutcome.ERROR */
|
|
4081
|
-
}), gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER), this.eventManagers[e._key()] = { manager: i }, this.iframes[e._key()] = t, i;
|
|
4082
|
-
}
|
|
4083
|
-
_isIframeWebStorageSupported(e, t) {
|
|
4084
|
-
this.iframes[e._key()].send(ue, { type: ue }, (r) => {
|
|
4085
|
-
var s;
|
|
4086
|
-
const o = (s = r == null ? void 0 : r[0]) === null || s === void 0 ? void 0 : s[ue];
|
|
4087
|
-
o !== void 0 && t(!!o), I(
|
|
4088
|
-
e,
|
|
4089
|
-
"internal-error"
|
|
4090
|
-
/* AuthErrorCode.INTERNAL_ERROR */
|
|
4091
|
-
);
|
|
4092
|
-
}, gapi.iframes.CROSS_ORIGIN_IFRAMES_FILTER);
|
|
4093
|
-
}
|
|
4094
|
-
_originValidation(e) {
|
|
4095
|
-
const t = e._key();
|
|
4096
|
-
return this.originValidationPromises[t] || (this.originValidationPromises[t] = Vi(e)), this.originValidationPromises[t];
|
|
4097
|
-
}
|
|
4098
|
-
get _shouldInitProactively() {
|
|
4099
|
-
return _t() || Te() || ne();
|
|
4100
|
-
}
|
|
4101
|
-
}
|
|
4102
|
-
const lr = cr;
|
|
4103
|
-
var qe = "@firebase/auth", Ge = "0.23.2";
|
|
4104
|
-
/**
|
|
4105
|
-
* @license
|
|
4106
|
-
* Copyright 2020 Google LLC
|
|
4107
|
-
*
|
|
4108
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4109
|
-
* you may not use this file except in compliance with the License.
|
|
4110
|
-
* You may obtain a copy of the License at
|
|
4111
|
-
*
|
|
4112
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4113
|
-
*
|
|
4114
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4115
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4116
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4117
|
-
* See the License for the specific language governing permissions and
|
|
4118
|
-
* limitations under the License.
|
|
4119
|
-
*/
|
|
4120
|
-
class ur {
|
|
4121
|
-
constructor(e) {
|
|
4122
|
-
this.auth = e, this.internalListeners = /* @__PURE__ */ new Map();
|
|
4123
|
-
}
|
|
4124
|
-
getUid() {
|
|
4125
|
-
var e;
|
|
4126
|
-
return this.assertAuthConfigured(), ((e = this.auth.currentUser) === null || e === void 0 ? void 0 : e.uid) || null;
|
|
4127
|
-
}
|
|
4128
|
-
async getToken(e) {
|
|
4129
|
-
return this.assertAuthConfigured(), await this.auth._initializationPromise, this.auth.currentUser ? { accessToken: await this.auth.currentUser.getIdToken(e) } : null;
|
|
4130
|
-
}
|
|
4131
|
-
addAuthTokenListener(e) {
|
|
4132
|
-
if (this.assertAuthConfigured(), this.internalListeners.has(e))
|
|
4133
|
-
return;
|
|
4134
|
-
const t = this.auth.onIdTokenChanged((i) => {
|
|
4135
|
-
e((i == null ? void 0 : i.stsTokenManager.accessToken) || null);
|
|
4136
|
-
});
|
|
4137
|
-
this.internalListeners.set(e, t), this.updateProactiveRefresh();
|
|
4138
|
-
}
|
|
4139
|
-
removeAuthTokenListener(e) {
|
|
4140
|
-
this.assertAuthConfigured();
|
|
4141
|
-
const t = this.internalListeners.get(e);
|
|
4142
|
-
t && (this.internalListeners.delete(e), t(), this.updateProactiveRefresh());
|
|
4143
|
-
}
|
|
4144
|
-
assertAuthConfigured() {
|
|
4145
|
-
u(
|
|
4146
|
-
this.auth._initializationPromise,
|
|
4147
|
-
"dependent-sdk-initialized-before-auth"
|
|
4148
|
-
/* AuthErrorCode.DEPENDENT_SDK_INIT_BEFORE_AUTH */
|
|
4149
|
-
);
|
|
4150
|
-
}
|
|
4151
|
-
updateProactiveRefresh() {
|
|
4152
|
-
this.internalListeners.size > 0 ? this.auth._startProactiveRefresh() : this.auth._stopProactiveRefresh();
|
|
4153
|
-
}
|
|
4154
|
-
}
|
|
4155
|
-
/**
|
|
4156
|
-
* @license
|
|
4157
|
-
* Copyright 2020 Google LLC
|
|
4158
|
-
*
|
|
4159
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4160
|
-
* you may not use this file except in compliance with the License.
|
|
4161
|
-
* You may obtain a copy of the License at
|
|
4162
|
-
*
|
|
4163
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4164
|
-
*
|
|
4165
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4166
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4167
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4168
|
-
* See the License for the specific language governing permissions and
|
|
4169
|
-
* limitations under the License.
|
|
4170
|
-
*/
|
|
4171
|
-
function dr(n) {
|
|
4172
|
-
switch (n) {
|
|
4173
|
-
case "Node":
|
|
4174
|
-
return "node";
|
|
4175
|
-
case "ReactNative":
|
|
4176
|
-
return "rn";
|
|
4177
|
-
case "Worker":
|
|
4178
|
-
return "webworker";
|
|
4179
|
-
case "Cordova":
|
|
4180
|
-
return "cordova";
|
|
4181
|
-
default:
|
|
4182
|
-
return;
|
|
4183
|
-
}
|
|
4184
|
-
}
|
|
4185
|
-
function hr(n) {
|
|
4186
|
-
Ne(new Oe(
|
|
4187
|
-
"auth",
|
|
4188
|
-
(e, { options: t }) => {
|
|
4189
|
-
const i = e.getProvider("app").getImmediate(), r = e.getProvider("heartbeat"), s = e.getProvider("app-check-internal"), { apiKey: o, authDomain: c } = i.options;
|
|
4190
|
-
u(o && !o.includes(":"), "invalid-api-key", { appName: i.name });
|
|
4191
|
-
const a = {
|
|
4192
|
-
apiKey: o,
|
|
4193
|
-
authDomain: c,
|
|
4194
|
-
clientPlatform: n,
|
|
4195
|
-
apiHost: "identitytoolkit.googleapis.com",
|
|
4196
|
-
tokenApiHost: "securetoken.googleapis.com",
|
|
4197
|
-
apiScheme: "https",
|
|
4198
|
-
sdkClientVersion: vt(n)
|
|
4199
|
-
}, l = new zn(i, r, s, a);
|
|
4200
|
-
return qn(l, t), l;
|
|
4201
|
-
},
|
|
4202
|
-
"PUBLIC"
|
|
4203
|
-
/* ComponentType.PUBLIC */
|
|
4204
|
-
).setInstantiationMode(
|
|
4205
|
-
"EXPLICIT"
|
|
4206
|
-
/* InstantiationMode.EXPLICIT */
|
|
4207
|
-
).setInstanceCreatedCallback((e, t, i) => {
|
|
4208
|
-
e.getProvider(
|
|
4209
|
-
"auth-internal"
|
|
4210
|
-
/* _ComponentName.AUTH_INTERNAL */
|
|
4211
|
-
).initialize();
|
|
4212
|
-
})), Ne(new Oe(
|
|
4213
|
-
"auth-internal",
|
|
4214
|
-
(e) => {
|
|
4215
|
-
const t = H(e.getProvider(
|
|
4216
|
-
"auth"
|
|
4217
|
-
/* _ComponentName.AUTH */
|
|
4218
|
-
).getImmediate());
|
|
4219
|
-
return ((i) => new ur(i))(t);
|
|
4220
|
-
},
|
|
4221
|
-
"PRIVATE"
|
|
4222
|
-
/* ComponentType.PRIVATE */
|
|
4223
|
-
).setInstantiationMode(
|
|
4224
|
-
"EXPLICIT"
|
|
4225
|
-
/* InstantiationMode.EXPLICIT */
|
|
4226
|
-
)), de(qe, Ge, dr(n)), de(qe, Ge, "esm2017");
|
|
4227
|
-
}
|
|
4228
|
-
/**
|
|
4229
|
-
* @license
|
|
4230
|
-
* Copyright 2021 Google LLC
|
|
4231
|
-
*
|
|
4232
|
-
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
4233
|
-
* you may not use this file except in compliance with the License.
|
|
4234
|
-
* You may obtain a copy of the License at
|
|
4235
|
-
*
|
|
4236
|
-
* http://www.apache.org/licenses/LICENSE-2.0
|
|
4237
|
-
*
|
|
4238
|
-
* Unless required by applicable law or agreed to in writing, software
|
|
4239
|
-
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
4240
|
-
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
4241
|
-
* See the License for the specific language governing permissions and
|
|
4242
|
-
* limitations under the License.
|
|
4243
|
-
*/
|
|
4244
|
-
const fr = 5 * 60, pr = et("authIdTokenMaxAge") || fr;
|
|
4245
|
-
let Je = null;
|
|
4246
|
-
const gr = (n) => async (e) => {
|
|
4247
|
-
const t = e && await e.getIdTokenResult(), i = t && ((/* @__PURE__ */ new Date()).getTime() - Date.parse(t.issuedAtTime)) / 1e3;
|
|
4248
|
-
if (i && i > pr)
|
|
4249
|
-
return;
|
|
4250
|
-
const r = t == null ? void 0 : t.token;
|
|
4251
|
-
Je !== r && (Je = r, await fetch(n, {
|
|
4252
|
-
method: r ? "POST" : "DELETE",
|
|
4253
|
-
headers: r ? {
|
|
4254
|
-
Authorization: `Bearer ${r}`
|
|
4255
|
-
} : {}
|
|
4256
|
-
}));
|
|
4257
|
-
};
|
|
4258
|
-
function mr(n = tn()) {
|
|
4259
|
-
const e = tt(n, "auth");
|
|
4260
|
-
if (e.isInitialized())
|
|
4261
|
-
return e.getImmediate();
|
|
4262
|
-
const t = jn(n, {
|
|
4263
|
-
popupRedirectResolver: lr,
|
|
4264
|
-
persistence: [
|
|
4265
|
-
yi,
|
|
4266
|
-
ci,
|
|
4267
|
-
Ct
|
|
4268
|
-
]
|
|
4269
|
-
}), i = et("authTokenSyncURL");
|
|
4270
|
-
if (i) {
|
|
4271
|
-
const s = gr(i);
|
|
4272
|
-
ri(t, s, () => s(t.currentUser)), ii(t, (o) => s(o));
|
|
4273
|
-
}
|
|
4274
|
-
const r = en("auth");
|
|
4275
|
-
return r && Gn(t, `http://${r}`), t;
|
|
4276
|
-
}
|
|
4277
|
-
hr(
|
|
4278
|
-
"Browser"
|
|
4279
|
-
/* ClientPlatform.BROWSER */
|
|
4280
|
-
);
|
|
4281
|
-
class D {
|
|
4282
|
-
constructor(e = null, t = {}) {
|
|
4283
|
-
if (this.apiKey = e, this.options = t, typeof window > "u")
|
|
4284
|
-
throw new Error("google-maps is supported only in browser environment");
|
|
4285
|
-
}
|
|
4286
|
-
load() {
|
|
4287
|
-
return typeof this.api < "u" ? Promise.resolve(this.api) : typeof this.loader < "u" ? this.loader : (window[D.CALLBACK_NAME] = () => {
|
|
4288
|
-
if (this.api = window.google, typeof this.resolve > "u")
|
|
4289
|
-
throw new Error("Should not happen");
|
|
4290
|
-
this.resolve(this.api);
|
|
4291
|
-
}, window.gm_authFailure = () => {
|
|
4292
|
-
if (typeof this.reject > "u")
|
|
4293
|
-
throw new Error("Should not happen");
|
|
4294
|
-
this.reject(new Error("google-maps: authentication error"));
|
|
4295
|
-
}, this.loader = new Promise((e, t) => {
|
|
4296
|
-
this.resolve = e, this.reject = t;
|
|
4297
|
-
const i = document.createElement("script");
|
|
4298
|
-
i.src = this.createUrl(), i.async = !0, i.onerror = (r) => t(r), document.head.appendChild(i);
|
|
4299
|
-
}));
|
|
4300
|
-
}
|
|
4301
|
-
createUrl() {
|
|
4302
|
-
const e = [
|
|
4303
|
-
`callback=${D.CALLBACK_NAME}`
|
|
4304
|
-
];
|
|
4305
|
-
this.apiKey && e.push(`key=${this.apiKey}`);
|
|
4306
|
-
for (let t in this.options)
|
|
4307
|
-
if (this.options.hasOwnProperty(t)) {
|
|
4308
|
-
let i = this.options[t];
|
|
4309
|
-
t === "version" && (t = "v"), t === "libraries" && (i = i.join(",")), e.push(`${t}=${i}`);
|
|
4310
|
-
}
|
|
4311
|
-
return `https://maps.googleapis.com/maps/api/js?${e.join("&")}`;
|
|
4312
|
-
}
|
|
4313
|
-
}
|
|
4314
|
-
D.CALLBACK_NAME = "_dk_google_maps_loader_cb";
|
|
4315
|
-
async function _r() {
|
|
4316
|
-
if (cn().length)
|
|
4317
|
-
return;
|
|
4318
|
-
const n = ln({ apiKey: "AIzaSyA_isPR1-9bX7UmRiJIhsIRNNwdn6DdmW4", authDomain: "feedme-253402.firebaseapp.com", databaseURL: "https://feedme-253402.firebaseio.com", projectId: "feedme-253402", storageBucket: "image.feedme.cc", messagingSenderId: "128512026847", appId: "1:128512026847:web:7c5c8ab7e8b90502dc616a", measurementId: "G-LTKS7N2HQS" }), e = await jt.getCustomToken(), t = mr();
|
|
4319
|
-
await ni(t, e), un(n);
|
|
4320
|
-
}
|
|
4321
|
-
async function vr() {
|
|
4322
|
-
if (dn())
|
|
4323
|
-
return;
|
|
4324
|
-
const e = await new D("AIzaSyA_isPR1-9bX7UmRiJIhsIRNNwdn6DdmW4", {
|
|
4325
|
-
libraries: ["places"]
|
|
4326
|
-
}).load();
|
|
4327
|
-
hn(e);
|
|
4328
|
-
}
|
|
4329
|
-
async function Ir() {
|
|
4330
|
-
await _r(), await vr();
|
|
4331
|
-
}
|
|
4332
|
-
const Pr = /* @__PURE__ */ Xe({
|
|
4333
|
-
__name: "App",
|
|
4334
|
-
setup(n) {
|
|
4335
|
-
const e = Ze();
|
|
4336
|
-
return Ht(() => {
|
|
4337
|
-
e.registerSidebarComponent(fn), Ir();
|
|
4338
|
-
}), (t, i) => (Ye(), Qe(Kt(Bt)));
|
|
4339
|
-
}
|
|
4340
|
-
});
|
|
4341
|
-
export {
|
|
4342
|
-
Pr as default
|
|
4343
|
-
};
|