bt-core-app 2.2.38 → 2.2.40
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/bt-core/core/node_modules/@firebase/app/dist/esm/index.esm.mjs +577 -0
- package/dist/bt-core/core/node_modules/@firebase/component/dist/esm/index.esm.mjs +275 -0
- package/dist/bt-core/core/node_modules/@firebase/installations/dist/esm/index.esm.mjs +763 -0
- package/dist/bt-core/core/node_modules/@firebase/logger/dist/esm/index.esm.mjs +101 -0
- package/dist/bt-core/core/node_modules/@firebase/messaging/dist/esm/index.esm.mjs +1278 -0
- package/dist/bt-core/core/node_modules/@firebase/util/dist/index.esm.mjs +444 -0
- package/dist/bt-core/core/node_modules/@firebase/util/dist/postinstall.mjs +5 -0
- package/dist/bt-core/core/node_modules/@mdi/js/mdi.mjs +60 -59
- package/dist/bt-core/core/node_modules/firebase/app/dist/esm/index.esm.mjs +32 -0
- package/dist/bt-core/core/node_modules/idb/build/index.mjs +58 -0
- package/dist/bt-core/core/node_modules/idb/build/wrap-idb-value.mjs +101 -0
- package/dist/components/BT-Blade-Steps.vue.mjs +2 -2
- package/dist/components/BT-Blade-Steps.vue2.mjs +4 -4
- package/dist/components/BT-Firebase-Notification.vue.d.ts +2 -0
- package/dist/components/BT-Firebase-Notification.vue.mjs +106 -0
- package/dist/components/BT-Firebase-Notification.vue2.mjs +4 -0
- package/dist/components.mjs +18 -16
- package/dist/composables/devices.d.ts +1 -0
- package/dist/composables/devices.mjs +12 -7
- package/dist/composables/firebase.d.ts +29 -0
- package/dist/composables/firebase.mjs +80 -0
- package/dist/composables/icons.mjs +58 -57
- package/dist/composables.mjs +200 -195
- package/dist/core.d.ts +2 -0
- package/dist/core2.mjs +89 -88
- package/dist/index-components.d.ts +2 -1
- package/dist/index-composables.d.ts +3 -1
- package/dist/style.css +1 -1
- package/package.json +2 -1
|
@@ -0,0 +1,763 @@
|
|
|
1
|
+
import { registerVersion as N, _registerComponent as y, _getProvider as P } from "../../../app/dist/esm/index.esm.mjs";
|
|
2
|
+
import { Component as C } from "../../../component/dist/esm/index.esm.mjs";
|
|
3
|
+
import { ErrorFactory as X, FirebaseError as Y } from "../../../util/dist/index.esm.mjs";
|
|
4
|
+
import { openDB as Q } from "../../../../idb/build/index.mjs";
|
|
5
|
+
const q = "@firebase/installations", S = "0.6.24";
|
|
6
|
+
/**
|
|
7
|
+
* @license
|
|
8
|
+
* Copyright 2019 Google LLC
|
|
9
|
+
*
|
|
10
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
11
|
+
* you may not use this file except in compliance with the License.
|
|
12
|
+
* You may obtain a copy of the License at
|
|
13
|
+
*
|
|
14
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
15
|
+
*
|
|
16
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
17
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
18
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
19
|
+
* See the License for the specific language governing permissions and
|
|
20
|
+
* limitations under the License.
|
|
21
|
+
*/
|
|
22
|
+
const v = 1e4, _ = `w:${S}`, O = "FIS_v2", Z = "https://firebaseinstallations.googleapis.com/v1", tt = 60 * 60 * 1e3, et = "installations", nt = "Installations";
|
|
23
|
+
/**
|
|
24
|
+
* @license
|
|
25
|
+
* Copyright 2019 Google LLC
|
|
26
|
+
*
|
|
27
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
28
|
+
* you may not use this file except in compliance with the License.
|
|
29
|
+
* You may obtain a copy of the License at
|
|
30
|
+
*
|
|
31
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
32
|
+
*
|
|
33
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
34
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
35
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
36
|
+
* See the License for the specific language governing permissions and
|
|
37
|
+
* limitations under the License.
|
|
38
|
+
*/
|
|
39
|
+
const rt = {
|
|
40
|
+
"missing-app-config-values": 'Missing App configuration value: "{$valueName}"',
|
|
41
|
+
"not-registered": "Firebase Installation is not registered.",
|
|
42
|
+
"installation-not-found": "Firebase Installation not found.",
|
|
43
|
+
"request-failed": '{$requestName} request failed with error "{$serverCode} {$serverStatus}: {$serverMessage}"',
|
|
44
|
+
"app-offline": "Could not process request. Application offline.",
|
|
45
|
+
"delete-pending-registration": "Can't delete installation while there is a pending registration request."
|
|
46
|
+
}, d = new X(et, nt, rt);
|
|
47
|
+
function F(t) {
|
|
48
|
+
return t instanceof Y && t.code.includes(
|
|
49
|
+
"request-failed"
|
|
50
|
+
/* ErrorCode.REQUEST_FAILED */
|
|
51
|
+
);
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* @license
|
|
55
|
+
* Copyright 2019 Google LLC
|
|
56
|
+
*
|
|
57
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
58
|
+
* you may not use this file except in compliance with the License.
|
|
59
|
+
* You may obtain a copy of the License at
|
|
60
|
+
*
|
|
61
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
62
|
+
*
|
|
63
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
64
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
65
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
66
|
+
* See the License for the specific language governing permissions and
|
|
67
|
+
* limitations under the License.
|
|
68
|
+
*/
|
|
69
|
+
function D({ projectId: t }) {
|
|
70
|
+
return `${Z}/projects/${t}/installations`;
|
|
71
|
+
}
|
|
72
|
+
function V(t) {
|
|
73
|
+
return {
|
|
74
|
+
token: t.token,
|
|
75
|
+
requestStatus: 2,
|
|
76
|
+
expiresIn: at(t.expiresIn),
|
|
77
|
+
creationTime: Date.now()
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
async function j(t, e) {
|
|
81
|
+
const r = (await e.json()).error;
|
|
82
|
+
return d.create("request-failed", {
|
|
83
|
+
requestName: t,
|
|
84
|
+
serverCode: r.code,
|
|
85
|
+
serverMessage: r.message,
|
|
86
|
+
serverStatus: r.status
|
|
87
|
+
});
|
|
88
|
+
}
|
|
89
|
+
function x({ apiKey: t }) {
|
|
90
|
+
return new Headers({
|
|
91
|
+
"Content-Type": "application/json",
|
|
92
|
+
Accept: "application/json",
|
|
93
|
+
"x-goog-api-key": t
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
function ot(t, { refreshToken: e }) {
|
|
97
|
+
const n = x(t);
|
|
98
|
+
return n.append("Authorization", st(e)), n;
|
|
99
|
+
}
|
|
100
|
+
async function $(t) {
|
|
101
|
+
const e = await t();
|
|
102
|
+
return e.status >= 500 && e.status < 600 ? t() : e;
|
|
103
|
+
}
|
|
104
|
+
function at(t) {
|
|
105
|
+
return Number(t.replace("s", "000"));
|
|
106
|
+
}
|
|
107
|
+
function st(t) {
|
|
108
|
+
return `${O} ${t}`;
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* @license
|
|
112
|
+
* Copyright 2019 Google LLC
|
|
113
|
+
*
|
|
114
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
115
|
+
* you may not use this file except in compliance with the License.
|
|
116
|
+
* You may obtain a copy of the License at
|
|
117
|
+
*
|
|
118
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
119
|
+
*
|
|
120
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
121
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
122
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
123
|
+
* See the License for the specific language governing permissions and
|
|
124
|
+
* limitations under the License.
|
|
125
|
+
*/
|
|
126
|
+
async function it({ appConfig: t, heartbeatServiceProvider: e }, { fid: n }) {
|
|
127
|
+
const r = D(t), a = x(t), o = e.getImmediate({
|
|
128
|
+
optional: !0
|
|
129
|
+
});
|
|
130
|
+
if (o) {
|
|
131
|
+
const c = await o.getHeartbeatsHeader();
|
|
132
|
+
c && a.append("x-firebase-client", c);
|
|
133
|
+
}
|
|
134
|
+
const s = {
|
|
135
|
+
fid: n,
|
|
136
|
+
authVersion: O,
|
|
137
|
+
appId: t.appId,
|
|
138
|
+
sdkVersion: _
|
|
139
|
+
}, i = {
|
|
140
|
+
method: "POST",
|
|
141
|
+
headers: a,
|
|
142
|
+
body: JSON.stringify(s)
|
|
143
|
+
}, u = await $(() => fetch(r, i));
|
|
144
|
+
if (u.ok) {
|
|
145
|
+
const c = await u.json();
|
|
146
|
+
return {
|
|
147
|
+
fid: c.fid || n,
|
|
148
|
+
registrationStatus: 2,
|
|
149
|
+
refreshToken: c.refreshToken,
|
|
150
|
+
authToken: V(c.authToken)
|
|
151
|
+
};
|
|
152
|
+
} else
|
|
153
|
+
throw await j("Create Installation", u);
|
|
154
|
+
}
|
|
155
|
+
/**
|
|
156
|
+
* @license
|
|
157
|
+
* Copyright 2019 Google LLC
|
|
158
|
+
*
|
|
159
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
160
|
+
* you may not use this file except in compliance with the License.
|
|
161
|
+
* You may obtain a copy of the License at
|
|
162
|
+
*
|
|
163
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
164
|
+
*
|
|
165
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
166
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
167
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
168
|
+
* See the License for the specific language governing permissions and
|
|
169
|
+
* limitations under the License.
|
|
170
|
+
*/
|
|
171
|
+
function L(t) {
|
|
172
|
+
return new Promise((e) => {
|
|
173
|
+
setTimeout(e, t);
|
|
174
|
+
});
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* @license
|
|
178
|
+
* Copyright 2019 Google LLC
|
|
179
|
+
*
|
|
180
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
181
|
+
* you may not use this file except in compliance with the License.
|
|
182
|
+
* You may obtain a copy of the License at
|
|
183
|
+
*
|
|
184
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
185
|
+
*
|
|
186
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
187
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
188
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
189
|
+
* See the License for the specific language governing permissions and
|
|
190
|
+
* limitations under the License.
|
|
191
|
+
*/
|
|
192
|
+
function ct(t) {
|
|
193
|
+
return btoa(String.fromCharCode(...t)).replace(/\+/g, "-").replace(/\//g, "_");
|
|
194
|
+
}
|
|
195
|
+
/**
|
|
196
|
+
* @license
|
|
197
|
+
* Copyright 2019 Google LLC
|
|
198
|
+
*
|
|
199
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
200
|
+
* you may not use this file except in compliance with the License.
|
|
201
|
+
* You may obtain a copy of the License at
|
|
202
|
+
*
|
|
203
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
204
|
+
*
|
|
205
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
206
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
207
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
208
|
+
* See the License for the specific language governing permissions and
|
|
209
|
+
* limitations under the License.
|
|
210
|
+
*/
|
|
211
|
+
const ut = /^[cdef][\w-]{21}$/, T = "";
|
|
212
|
+
function ft() {
|
|
213
|
+
try {
|
|
214
|
+
const t = new Uint8Array(17);
|
|
215
|
+
(self.crypto || self.msCrypto).getRandomValues(t), t[0] = 112 + t[0] % 16;
|
|
216
|
+
const n = dt(t);
|
|
217
|
+
return ut.test(n) ? n : T;
|
|
218
|
+
} catch {
|
|
219
|
+
return T;
|
|
220
|
+
}
|
|
221
|
+
}
|
|
222
|
+
function dt(t) {
|
|
223
|
+
return ct(t).substr(0, 22);
|
|
224
|
+
}
|
|
225
|
+
/**
|
|
226
|
+
* @license
|
|
227
|
+
* Copyright 2019 Google LLC
|
|
228
|
+
*
|
|
229
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
230
|
+
* you may not use this file except in compliance with the License.
|
|
231
|
+
* You may obtain a copy of the License at
|
|
232
|
+
*
|
|
233
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
234
|
+
*
|
|
235
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
236
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
237
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
238
|
+
* See the License for the specific language governing permissions and
|
|
239
|
+
* limitations under the License.
|
|
240
|
+
*/
|
|
241
|
+
function g(t) {
|
|
242
|
+
return `${t.appName}!${t.appId}`;
|
|
243
|
+
}
|
|
244
|
+
/**
|
|
245
|
+
* @license
|
|
246
|
+
* Copyright 2019 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
|
+
const p = /* @__PURE__ */ new Map();
|
|
261
|
+
function M(t, e) {
|
|
262
|
+
const n = g(t);
|
|
263
|
+
B(n, e), gt(n, e);
|
|
264
|
+
}
|
|
265
|
+
function lt(t, e) {
|
|
266
|
+
H();
|
|
267
|
+
const n = g(t);
|
|
268
|
+
let r = p.get(n);
|
|
269
|
+
r || (r = /* @__PURE__ */ new Set(), p.set(n, r)), r.add(e);
|
|
270
|
+
}
|
|
271
|
+
function pt(t, e) {
|
|
272
|
+
const n = g(t), r = p.get(n);
|
|
273
|
+
r && (r.delete(e), r.size === 0 && p.delete(n), U());
|
|
274
|
+
}
|
|
275
|
+
function B(t, e) {
|
|
276
|
+
const n = p.get(t);
|
|
277
|
+
if (n)
|
|
278
|
+
for (const r of n)
|
|
279
|
+
r(e);
|
|
280
|
+
}
|
|
281
|
+
function gt(t, e) {
|
|
282
|
+
const n = H();
|
|
283
|
+
n && n.postMessage({ key: t, fid: e }), U();
|
|
284
|
+
}
|
|
285
|
+
let f = null;
|
|
286
|
+
function H() {
|
|
287
|
+
return !f && "BroadcastChannel" in self && (f = new BroadcastChannel("[Firebase] FID Change"), f.onmessage = (t) => {
|
|
288
|
+
B(t.data.key, t.data.fid);
|
|
289
|
+
}), f;
|
|
290
|
+
}
|
|
291
|
+
function U() {
|
|
292
|
+
p.size === 0 && f && (f.close(), f = null);
|
|
293
|
+
}
|
|
294
|
+
/**
|
|
295
|
+
* @license
|
|
296
|
+
* Copyright 2019 Google LLC
|
|
297
|
+
*
|
|
298
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
299
|
+
* you may not use this file except in compliance with the License.
|
|
300
|
+
* You may obtain a copy of the License at
|
|
301
|
+
*
|
|
302
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
303
|
+
*
|
|
304
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
305
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
306
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
307
|
+
* See the License for the specific language governing permissions and
|
|
308
|
+
* limitations under the License.
|
|
309
|
+
*/
|
|
310
|
+
const ht = "firebase-installations-database", mt = 1, l = "firebase-installations-store";
|
|
311
|
+
let w = null;
|
|
312
|
+
function k() {
|
|
313
|
+
return w || (w = Q(ht, mt, {
|
|
314
|
+
upgrade: (t, e) => {
|
|
315
|
+
switch (e) {
|
|
316
|
+
case 0:
|
|
317
|
+
t.createObjectStore(l);
|
|
318
|
+
}
|
|
319
|
+
}
|
|
320
|
+
})), w;
|
|
321
|
+
}
|
|
322
|
+
async function h(t, e) {
|
|
323
|
+
const n = g(t), a = (await k()).transaction(l, "readwrite"), o = a.objectStore(l), s = await o.get(n);
|
|
324
|
+
return await o.put(e, n), await a.done, (!s || s.fid !== e.fid) && M(t, e.fid), e;
|
|
325
|
+
}
|
|
326
|
+
async function K(t) {
|
|
327
|
+
const e = g(t), r = (await k()).transaction(l, "readwrite");
|
|
328
|
+
await r.objectStore(l).delete(e), await r.done;
|
|
329
|
+
}
|
|
330
|
+
async function m(t, e) {
|
|
331
|
+
const n = g(t), a = (await k()).transaction(l, "readwrite"), o = a.objectStore(l), s = await o.get(n), i = e(s);
|
|
332
|
+
return i === void 0 ? await o.delete(n) : await o.put(i, n), await a.done, i && (!s || s.fid !== i.fid) && M(t, i.fid), i;
|
|
333
|
+
}
|
|
334
|
+
/**
|
|
335
|
+
* @license
|
|
336
|
+
* Copyright 2019 Google LLC
|
|
337
|
+
*
|
|
338
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
339
|
+
* you may not use this file except in compliance with the License.
|
|
340
|
+
* You may obtain a copy of the License at
|
|
341
|
+
*
|
|
342
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
343
|
+
*
|
|
344
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
345
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
346
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
347
|
+
* See the License for the specific language governing permissions and
|
|
348
|
+
* limitations under the License.
|
|
349
|
+
*/
|
|
350
|
+
async function A(t) {
|
|
351
|
+
let e;
|
|
352
|
+
const n = await m(t.appConfig, (r) => {
|
|
353
|
+
const a = wt(r), o = It(t, a);
|
|
354
|
+
return e = o.registrationPromise, o.installationEntry;
|
|
355
|
+
});
|
|
356
|
+
return n.fid === T ? { installationEntry: await e } : {
|
|
357
|
+
installationEntry: n,
|
|
358
|
+
registrationPromise: e
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
function wt(t) {
|
|
362
|
+
const e = t || {
|
|
363
|
+
fid: ft(),
|
|
364
|
+
registrationStatus: 0
|
|
365
|
+
/* RequestStatus.NOT_STARTED */
|
|
366
|
+
};
|
|
367
|
+
return J(e);
|
|
368
|
+
}
|
|
369
|
+
function It(t, e) {
|
|
370
|
+
if (e.registrationStatus === 0) {
|
|
371
|
+
if (!navigator.onLine) {
|
|
372
|
+
const a = Promise.reject(d.create(
|
|
373
|
+
"app-offline"
|
|
374
|
+
/* ErrorCode.APP_OFFLINE */
|
|
375
|
+
));
|
|
376
|
+
return {
|
|
377
|
+
installationEntry: e,
|
|
378
|
+
registrationPromise: a
|
|
379
|
+
};
|
|
380
|
+
}
|
|
381
|
+
const n = {
|
|
382
|
+
fid: e.fid,
|
|
383
|
+
registrationStatus: 1,
|
|
384
|
+
registrationTime: Date.now()
|
|
385
|
+
}, r = Tt(t, n);
|
|
386
|
+
return { installationEntry: n, registrationPromise: r };
|
|
387
|
+
} else
|
|
388
|
+
return e.registrationStatus === 1 ? {
|
|
389
|
+
installationEntry: e,
|
|
390
|
+
registrationPromise: St(t)
|
|
391
|
+
} : { installationEntry: e };
|
|
392
|
+
}
|
|
393
|
+
async function Tt(t, e) {
|
|
394
|
+
try {
|
|
395
|
+
const n = await it(t, e);
|
|
396
|
+
return h(t.appConfig, n);
|
|
397
|
+
} catch (n) {
|
|
398
|
+
throw F(n) && n.customData.serverCode === 409 ? await K(t.appConfig) : await h(t.appConfig, {
|
|
399
|
+
fid: e.fid,
|
|
400
|
+
registrationStatus: 0
|
|
401
|
+
/* RequestStatus.NOT_STARTED */
|
|
402
|
+
}), n;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
405
|
+
async function St(t) {
|
|
406
|
+
let e = await E(t.appConfig);
|
|
407
|
+
for (; e.registrationStatus === 1; )
|
|
408
|
+
await L(100), e = await E(t.appConfig);
|
|
409
|
+
if (e.registrationStatus === 0) {
|
|
410
|
+
const { installationEntry: n, registrationPromise: r } = await A(t);
|
|
411
|
+
return r || n;
|
|
412
|
+
}
|
|
413
|
+
return e;
|
|
414
|
+
}
|
|
415
|
+
function E(t) {
|
|
416
|
+
return m(t, (e) => {
|
|
417
|
+
if (!e)
|
|
418
|
+
throw d.create(
|
|
419
|
+
"installation-not-found"
|
|
420
|
+
/* ErrorCode.INSTALLATION_NOT_FOUND */
|
|
421
|
+
);
|
|
422
|
+
return J(e);
|
|
423
|
+
});
|
|
424
|
+
}
|
|
425
|
+
function J(t) {
|
|
426
|
+
return kt(t) ? {
|
|
427
|
+
fid: t.fid,
|
|
428
|
+
registrationStatus: 0
|
|
429
|
+
/* RequestStatus.NOT_STARTED */
|
|
430
|
+
} : t;
|
|
431
|
+
}
|
|
432
|
+
function kt(t) {
|
|
433
|
+
return t.registrationStatus === 1 && t.registrationTime + v < Date.now();
|
|
434
|
+
}
|
|
435
|
+
/**
|
|
436
|
+
* @license
|
|
437
|
+
* Copyright 2019 Google LLC
|
|
438
|
+
*
|
|
439
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
440
|
+
* you may not use this file except in compliance with the License.
|
|
441
|
+
* You may obtain a copy of the License at
|
|
442
|
+
*
|
|
443
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
444
|
+
*
|
|
445
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
446
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
447
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
448
|
+
* See the License for the specific language governing permissions and
|
|
449
|
+
* limitations under the License.
|
|
450
|
+
*/
|
|
451
|
+
async function At({ appConfig: t, heartbeatServiceProvider: e }, n) {
|
|
452
|
+
const r = bt(t, n), a = ot(t, n), o = e.getImmediate({
|
|
453
|
+
optional: !0
|
|
454
|
+
});
|
|
455
|
+
if (o) {
|
|
456
|
+
const c = await o.getHeartbeatsHeader();
|
|
457
|
+
c && a.append("x-firebase-client", c);
|
|
458
|
+
}
|
|
459
|
+
const s = {
|
|
460
|
+
installation: {
|
|
461
|
+
sdkVersion: _,
|
|
462
|
+
appId: t.appId
|
|
463
|
+
}
|
|
464
|
+
}, i = {
|
|
465
|
+
method: "POST",
|
|
466
|
+
headers: a,
|
|
467
|
+
body: JSON.stringify(s)
|
|
468
|
+
}, u = await $(() => fetch(r, i));
|
|
469
|
+
if (u.ok) {
|
|
470
|
+
const c = await u.json();
|
|
471
|
+
return V(c);
|
|
472
|
+
} else
|
|
473
|
+
throw await j("Generate Auth Token", u);
|
|
474
|
+
}
|
|
475
|
+
function bt(t, { fid: e }) {
|
|
476
|
+
return `${D(t)}/${e}/authTokens:generate`;
|
|
477
|
+
}
|
|
478
|
+
/**
|
|
479
|
+
* @license
|
|
480
|
+
* Copyright 2019 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 b(t, e = !1) {
|
|
495
|
+
let n;
|
|
496
|
+
const r = await m(t.appConfig, (o) => {
|
|
497
|
+
if (!z(o))
|
|
498
|
+
throw d.create(
|
|
499
|
+
"not-registered"
|
|
500
|
+
/* ErrorCode.NOT_REGISTERED */
|
|
501
|
+
);
|
|
502
|
+
const s = o.authToken;
|
|
503
|
+
if (!e && Et(s))
|
|
504
|
+
return o;
|
|
505
|
+
if (s.requestStatus === 1)
|
|
506
|
+
return n = yt(t, e), o;
|
|
507
|
+
{
|
|
508
|
+
if (!navigator.onLine)
|
|
509
|
+
throw d.create(
|
|
510
|
+
"app-offline"
|
|
511
|
+
/* ErrorCode.APP_OFFLINE */
|
|
512
|
+
);
|
|
513
|
+
const i = Nt(o);
|
|
514
|
+
return n = Ct(t, i), i;
|
|
515
|
+
}
|
|
516
|
+
});
|
|
517
|
+
return n ? await n : r.authToken;
|
|
518
|
+
}
|
|
519
|
+
async function yt(t, e) {
|
|
520
|
+
let n = await R(t.appConfig);
|
|
521
|
+
for (; n.authToken.requestStatus === 1; )
|
|
522
|
+
await L(100), n = await R(t.appConfig);
|
|
523
|
+
const r = n.authToken;
|
|
524
|
+
return r.requestStatus === 0 ? b(t, e) : r;
|
|
525
|
+
}
|
|
526
|
+
function R(t) {
|
|
527
|
+
return m(t, (e) => {
|
|
528
|
+
if (!z(e))
|
|
529
|
+
throw d.create(
|
|
530
|
+
"not-registered"
|
|
531
|
+
/* ErrorCode.NOT_REGISTERED */
|
|
532
|
+
);
|
|
533
|
+
const n = e.authToken;
|
|
534
|
+
return Pt(n) ? {
|
|
535
|
+
...e,
|
|
536
|
+
authToken: {
|
|
537
|
+
requestStatus: 0
|
|
538
|
+
/* RequestStatus.NOT_STARTED */
|
|
539
|
+
}
|
|
540
|
+
} : e;
|
|
541
|
+
});
|
|
542
|
+
}
|
|
543
|
+
async function Ct(t, e) {
|
|
544
|
+
try {
|
|
545
|
+
const n = await At(t, e), r = {
|
|
546
|
+
...e,
|
|
547
|
+
authToken: n
|
|
548
|
+
};
|
|
549
|
+
return await h(t.appConfig, r), n;
|
|
550
|
+
} catch (n) {
|
|
551
|
+
if (F(n) && (n.customData.serverCode === 401 || n.customData.serverCode === 404))
|
|
552
|
+
await K(t.appConfig);
|
|
553
|
+
else {
|
|
554
|
+
const r = {
|
|
555
|
+
...e,
|
|
556
|
+
authToken: {
|
|
557
|
+
requestStatus: 0
|
|
558
|
+
/* RequestStatus.NOT_STARTED */
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
await h(t.appConfig, r);
|
|
562
|
+
}
|
|
563
|
+
throw n;
|
|
564
|
+
}
|
|
565
|
+
}
|
|
566
|
+
function z(t) {
|
|
567
|
+
return t !== void 0 && t.registrationStatus === 2;
|
|
568
|
+
}
|
|
569
|
+
function Et(t) {
|
|
570
|
+
return t.requestStatus === 2 && !Rt(t);
|
|
571
|
+
}
|
|
572
|
+
function Rt(t) {
|
|
573
|
+
const e = Date.now();
|
|
574
|
+
return e < t.creationTime || t.creationTime + t.expiresIn < e + tt;
|
|
575
|
+
}
|
|
576
|
+
function Nt(t) {
|
|
577
|
+
const e = {
|
|
578
|
+
requestStatus: 1,
|
|
579
|
+
requestTime: Date.now()
|
|
580
|
+
};
|
|
581
|
+
return {
|
|
582
|
+
...t,
|
|
583
|
+
authToken: e
|
|
584
|
+
};
|
|
585
|
+
}
|
|
586
|
+
function Pt(t) {
|
|
587
|
+
return t.requestStatus === 1 && t.requestTime + v < Date.now();
|
|
588
|
+
}
|
|
589
|
+
/**
|
|
590
|
+
* @license
|
|
591
|
+
* Copyright 2019 Google LLC
|
|
592
|
+
*
|
|
593
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
594
|
+
* you may not use this file except in compliance with the License.
|
|
595
|
+
* You may obtain a copy of the License at
|
|
596
|
+
*
|
|
597
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
598
|
+
*
|
|
599
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
600
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
601
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
602
|
+
* See the License for the specific language governing permissions and
|
|
603
|
+
* limitations under the License.
|
|
604
|
+
*/
|
|
605
|
+
async function qt(t) {
|
|
606
|
+
const e = t, { installationEntry: n, registrationPromise: r } = await A(e);
|
|
607
|
+
return r ? r.catch(console.error) : b(e).catch(console.error), n.fid;
|
|
608
|
+
}
|
|
609
|
+
/**
|
|
610
|
+
* @license
|
|
611
|
+
* Copyright 2019 Google LLC
|
|
612
|
+
*
|
|
613
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
614
|
+
* you may not use this file except in compliance with the License.
|
|
615
|
+
* You may obtain a copy of the License at
|
|
616
|
+
*
|
|
617
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
618
|
+
*
|
|
619
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
620
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
621
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
622
|
+
* See the License for the specific language governing permissions and
|
|
623
|
+
* limitations under the License.
|
|
624
|
+
*/
|
|
625
|
+
async function vt(t, e = !1) {
|
|
626
|
+
const n = t;
|
|
627
|
+
return await _t(n), (await b(n, e)).token;
|
|
628
|
+
}
|
|
629
|
+
async function _t(t) {
|
|
630
|
+
const { registrationPromise: e } = await A(t);
|
|
631
|
+
e && await e;
|
|
632
|
+
}
|
|
633
|
+
/**
|
|
634
|
+
* @license
|
|
635
|
+
* Copyright 2019 Google LLC
|
|
636
|
+
*
|
|
637
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
638
|
+
* you may not use this file except in compliance with the License.
|
|
639
|
+
* You may obtain a copy of the License at
|
|
640
|
+
*
|
|
641
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
642
|
+
*
|
|
643
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
644
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
645
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
646
|
+
* See the License for the specific language governing permissions and
|
|
647
|
+
* limitations under the License.
|
|
648
|
+
*/
|
|
649
|
+
function Bt(t, e) {
|
|
650
|
+
const { appConfig: n } = t;
|
|
651
|
+
return lt(n, e), () => {
|
|
652
|
+
pt(n, e);
|
|
653
|
+
};
|
|
654
|
+
}
|
|
655
|
+
/**
|
|
656
|
+
* @license
|
|
657
|
+
* Copyright 2019 Google LLC
|
|
658
|
+
*
|
|
659
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
660
|
+
* you may not use this file except in compliance with the License.
|
|
661
|
+
* You may obtain a copy of the License at
|
|
662
|
+
*
|
|
663
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
664
|
+
*
|
|
665
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
666
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
667
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
668
|
+
* See the License for the specific language governing permissions and
|
|
669
|
+
* limitations under the License.
|
|
670
|
+
*/
|
|
671
|
+
function Ot(t) {
|
|
672
|
+
if (!t || !t.options)
|
|
673
|
+
throw I("App Configuration");
|
|
674
|
+
if (!t.name)
|
|
675
|
+
throw I("App Name");
|
|
676
|
+
const e = [
|
|
677
|
+
"projectId",
|
|
678
|
+
"apiKey",
|
|
679
|
+
"appId"
|
|
680
|
+
];
|
|
681
|
+
for (const n of e)
|
|
682
|
+
if (!t.options[n])
|
|
683
|
+
throw I(n);
|
|
684
|
+
return {
|
|
685
|
+
appName: t.name,
|
|
686
|
+
projectId: t.options.projectId,
|
|
687
|
+
apiKey: t.options.apiKey,
|
|
688
|
+
appId: t.options.appId
|
|
689
|
+
};
|
|
690
|
+
}
|
|
691
|
+
function I(t) {
|
|
692
|
+
return d.create("missing-app-config-values", {
|
|
693
|
+
valueName: t
|
|
694
|
+
});
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* @license
|
|
698
|
+
* Copyright 2020 Google LLC
|
|
699
|
+
*
|
|
700
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
701
|
+
* you may not use this file except in compliance with the License.
|
|
702
|
+
* You may obtain a copy of the License at
|
|
703
|
+
*
|
|
704
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
705
|
+
*
|
|
706
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
707
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
708
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
709
|
+
* See the License for the specific language governing permissions and
|
|
710
|
+
* limitations under the License.
|
|
711
|
+
*/
|
|
712
|
+
const G = "installations", Ft = "installations-internal", Dt = (t) => {
|
|
713
|
+
const e = t.getProvider("app").getImmediate(), n = Ot(e), r = P(e, "heartbeat");
|
|
714
|
+
return {
|
|
715
|
+
app: e,
|
|
716
|
+
appConfig: n,
|
|
717
|
+
heartbeatServiceProvider: r,
|
|
718
|
+
_delete: () => Promise.resolve()
|
|
719
|
+
};
|
|
720
|
+
}, Vt = (t) => {
|
|
721
|
+
const e = t.getProvider("app").getImmediate(), n = P(e, G).getImmediate();
|
|
722
|
+
return {
|
|
723
|
+
getId: () => qt(n),
|
|
724
|
+
getToken: (a) => vt(n, a)
|
|
725
|
+
};
|
|
726
|
+
};
|
|
727
|
+
function jt() {
|
|
728
|
+
y(new C(
|
|
729
|
+
G,
|
|
730
|
+
Dt,
|
|
731
|
+
"PUBLIC"
|
|
732
|
+
/* ComponentType.PUBLIC */
|
|
733
|
+
)), y(new C(
|
|
734
|
+
Ft,
|
|
735
|
+
Vt,
|
|
736
|
+
"PRIVATE"
|
|
737
|
+
/* ComponentType.PRIVATE */
|
|
738
|
+
));
|
|
739
|
+
}
|
|
740
|
+
/**
|
|
741
|
+
* @license
|
|
742
|
+
* Copyright 2019 Google LLC
|
|
743
|
+
*
|
|
744
|
+
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
745
|
+
* you may not use this file except in compliance with the License.
|
|
746
|
+
* You may obtain a copy of the License at
|
|
747
|
+
*
|
|
748
|
+
* http://www.apache.org/licenses/LICENSE-2.0
|
|
749
|
+
*
|
|
750
|
+
* Unless required by applicable law or agreed to in writing, software
|
|
751
|
+
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
752
|
+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
753
|
+
* See the License for the specific language governing permissions and
|
|
754
|
+
* limitations under the License.
|
|
755
|
+
*/
|
|
756
|
+
jt();
|
|
757
|
+
N(q, S);
|
|
758
|
+
N(q, S, "esm2020");
|
|
759
|
+
export {
|
|
760
|
+
qt as getId,
|
|
761
|
+
vt as getToken,
|
|
762
|
+
Bt as onIdChange
|
|
763
|
+
};
|