dexie-cloud-addon 4.2.4 → 4.3.0
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/TODO-SOCIALAUTH.md +545 -0
- package/dexie-cloud-import.json +2 -1
- package/dist/modern/DexieCloudAPI.d.ts +4 -0
- package/dist/modern/DexieCloudOptions.d.ts +20 -0
- package/dist/modern/authentication/exchangeOAuthCode.d.ts +23 -0
- package/dist/modern/authentication/fetchAuthProviders.d.ts +14 -0
- package/dist/modern/authentication/handleOAuthCallback.d.ts +57 -0
- package/dist/modern/authentication/interactWithUser.d.ts +19 -0
- package/dist/modern/authentication/oauthLogin.d.ts +37 -0
- package/dist/modern/default-ui/AuthProviderButton.d.ts +21 -0
- package/dist/modern/default-ui/LoginDialog.d.ts +5 -2
- package/dist/modern/default-ui/ProviderSelectionDialog.d.ts +7 -0
- package/dist/modern/dexie-cloud-addon.js +719 -169
- package/dist/modern/dexie-cloud-addon.js.map +1 -1
- package/dist/modern/dexie-cloud-addon.min.js +1 -1
- package/dist/modern/dexie-cloud-addon.min.js.gz +0 -0
- package/dist/modern/dexie-cloud-addon.min.js.map +1 -1
- package/dist/modern/errors/OAuthError.d.ts +10 -0
- package/dist/modern/service-worker.js +720 -170
- package/dist/modern/service-worker.js.map +1 -1
- package/dist/modern/service-worker.min.js +1 -1
- package/dist/modern/service-worker.min.js.map +1 -1
- package/dist/modern/types/DXCUserInteraction.d.ts +24 -1
- package/dist/umd/dexie-cloud-addon.js +2181 -2444
- package/dist/umd/dexie-cloud-addon.js.gz +0 -0
- package/dist/umd/dexie-cloud-addon.js.map +1 -1
- package/dist/umd/dexie-cloud-addon.min.js +1 -1
- package/dist/umd/dexie-cloud-addon.min.js.gz +0 -0
- package/dist/umd/dexie-cloud-addon.min.js.map +1 -1
- package/dist/umd/service-worker.js +2029 -2292
- package/dist/umd/service-worker.js.map +1 -1
- package/dist/umd/service-worker.min.js +1 -1
- package/dist/umd/service-worker.min.js.map +1 -1
- package/oauth_flow.md +299 -0
- package/package.json +10 -7
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
*
|
|
9
9
|
* ==========================================================================
|
|
10
10
|
*
|
|
11
|
-
* Version 4.
|
|
11
|
+
* Version 4.3.0, Tue Jan 20 2026
|
|
12
12
|
*
|
|
13
13
|
* https://dexie.org
|
|
14
14
|
*
|
|
@@ -39,7 +39,7 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
|
|
|
39
39
|
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
|
|
40
40
|
PERFORMANCE OF THIS SOFTWARE.
|
|
41
41
|
***************************************************************************** */
|
|
42
|
-
/* global Reflect, Promise */
|
|
42
|
+
/* global Reflect, Promise, SuppressedError, Symbol, Iterator */
|
|
43
43
|
|
|
44
44
|
|
|
45
45
|
function __rest(s, e) {
|
|
@@ -83,8 +83,9 @@ function __await(v) {
|
|
|
83
83
|
function __asyncGenerator(thisArg, _arguments, generator) {
|
|
84
84
|
if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
|
|
85
85
|
var g = generator.apply(thisArg, _arguments || []), i, q = [];
|
|
86
|
-
return i =
|
|
87
|
-
function
|
|
86
|
+
return i = Object.create((typeof AsyncIterator === "function" ? AsyncIterator : Object).prototype), verb("next"), verb("throw"), verb("return", awaitReturn), i[Symbol.asyncIterator] = function () { return this; }, i;
|
|
87
|
+
function awaitReturn(f) { return function (v) { return Promise.resolve(v).then(f, reject); }; }
|
|
88
|
+
function verb(n, f) { if (g[n]) { i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; if (f) i[n] = f(i[n]); } }
|
|
88
89
|
function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
|
|
89
90
|
function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
|
|
90
91
|
function fulfill(value) { resume("next", value); }
|
|
@@ -98,6 +99,20 @@ function __asyncValues(o) {
|
|
|
98
99
|
return m ? m.call(o) : (o = typeof __values === "function" ? __values(o) : o[Symbol.iterator](), i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i);
|
|
99
100
|
function verb(n) { i[n] = o[n] && function (v) { return new Promise(function (resolve, reject) { v = o[n](v), settle(resolve, reject, v.done, v.value); }); }; }
|
|
100
101
|
function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
typeof SuppressedError === "function" ? SuppressedError : function (error, suppressed, message) {
|
|
105
|
+
var e = new Error(message);
|
|
106
|
+
return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
|
|
107
|
+
};
|
|
108
|
+
|
|
109
|
+
/** Type guard to check if a message is an OAuthResultMessage */
|
|
110
|
+
function isOAuthResultMessage(msg) {
|
|
111
|
+
return (typeof msg === 'object' &&
|
|
112
|
+
msg !== null &&
|
|
113
|
+
msg.type === 'dexie:oauthResult' &&
|
|
114
|
+
typeof msg.provider === 'string' &&
|
|
115
|
+
typeof msg.state === 'string');
|
|
101
116
|
}
|
|
102
117
|
|
|
103
118
|
function assert(b) {
|
|
@@ -279,13 +294,12 @@ function applyOperations(target, ops) {
|
|
|
279
294
|
function subtractChanges(target, // Server change set
|
|
280
295
|
changesToSubtract // additional mutations on client during syncWithServer()
|
|
281
296
|
) {
|
|
282
|
-
var _a, _b, _c;
|
|
283
297
|
for (const [table, mutationSet] of Object.entries(changesToSubtract)) {
|
|
284
298
|
for (const [key, mut] of Object.entries(mutationSet)) {
|
|
285
299
|
switch (mut.type) {
|
|
286
300
|
case 'ups':
|
|
287
301
|
{
|
|
288
|
-
const targetMut =
|
|
302
|
+
const targetMut = target[table]?.[key];
|
|
289
303
|
if (targetMut) {
|
|
290
304
|
switch (targetMut.type) {
|
|
291
305
|
case 'ups':
|
|
@@ -303,10 +317,10 @@ changesToSubtract // additional mutations on client during syncWithServer()
|
|
|
303
317
|
}
|
|
304
318
|
break;
|
|
305
319
|
case 'del':
|
|
306
|
-
|
|
320
|
+
delete target[table]?.[key];
|
|
307
321
|
break;
|
|
308
322
|
case 'upd': {
|
|
309
|
-
const targetMut =
|
|
323
|
+
const targetMut = target[table]?.[key];
|
|
310
324
|
if (targetMut) {
|
|
311
325
|
switch (targetMut.type) {
|
|
312
326
|
case 'ups':
|
|
@@ -339,17 +353,14 @@ changesToSubtract // additional mutations on client during syncWithServer()
|
|
|
339
353
|
* @param inSet
|
|
340
354
|
* @returns DBOperationsSet representing inSet
|
|
341
355
|
*/
|
|
342
|
-
function toDBOperationSet(inSet, txid
|
|
343
|
-
// Fictive transaction:
|
|
344
|
-
if (!txid)
|
|
345
|
-
txid = randomString$1(16);
|
|
356
|
+
function toDBOperationSet(inSet, txid) {
|
|
346
357
|
// Convert data into a temporary map to collect mutations of same table and type
|
|
347
358
|
const map = {};
|
|
348
359
|
for (const [table, ops] of Object.entries(inSet)) {
|
|
349
360
|
for (const [key, op] of Object.entries(ops)) {
|
|
350
361
|
const mapEntry = map[table] || (map[table] = {});
|
|
351
362
|
const ops = mapEntry[op.type] || (mapEntry[op.type] = []);
|
|
352
|
-
ops.push(
|
|
363
|
+
ops.push({ key, ...op }); // DBKeyMutation doesn't contain key, so we need to bring it in.
|
|
353
364
|
}
|
|
354
365
|
}
|
|
355
366
|
// Start computing the resulting format:
|
|
@@ -527,142 +538,111 @@ function decodeYMessage(a) {
|
|
|
527
538
|
}
|
|
528
539
|
|
|
529
540
|
async function asyncIterablePipeline(source, ...stages) {
|
|
530
|
-
var _a, e_1, _b, _c;
|
|
531
541
|
// Chain generators by sending outdata from one to another
|
|
532
542
|
let result = source(); // Start with the source generator
|
|
533
543
|
for (let i = 0; i < stages.length; i++) {
|
|
534
544
|
result = stages[i](result); // Pass on the result to next generator
|
|
535
545
|
}
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
let state = 0;
|
|
558
|
-
let sizeBuf = new Uint8Array(4);
|
|
559
|
-
let sizeBufPos = 0;
|
|
560
|
-
let bufs = [];
|
|
561
|
-
let len = 0;
|
|
562
|
-
try {
|
|
563
|
-
for (var _d = true, source_1 = __asyncValues(source), source_1_1; source_1_1 = yield __await(source_1.next()), _a = source_1_1.done, !_a; _d = true) {
|
|
564
|
-
_c = source_1_1.value;
|
|
565
|
-
_d = false;
|
|
566
|
-
const chunk = _c;
|
|
567
|
-
const dw = new DataView(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
568
|
-
let pos = 0;
|
|
569
|
-
while (pos < chunk.byteLength) {
|
|
570
|
-
switch (state) {
|
|
571
|
-
case 0:
|
|
572
|
-
// Beginning of a size header
|
|
573
|
-
if (pos + 4 > chunk.byteLength) {
|
|
574
|
-
for (const b of chunk.slice(pos)) {
|
|
575
|
-
if (sizeBufPos === 4)
|
|
576
|
-
break;
|
|
577
|
-
sizeBuf[sizeBufPos++] = b;
|
|
578
|
-
++pos;
|
|
579
|
-
}
|
|
580
|
-
if (sizeBufPos < 4) {
|
|
581
|
-
// Need more bytes in order to read length.
|
|
582
|
-
// Will go out from while loop as well because pos is defenitely = chunk.byteLength here.
|
|
583
|
-
break;
|
|
584
|
-
}
|
|
585
|
-
}
|
|
586
|
-
else if (sizeBufPos > 0 && sizeBufPos < 4) {
|
|
587
|
-
for (const b of chunk.slice(pos, pos + 4 - sizeBufPos)) {
|
|
588
|
-
sizeBuf[sizeBufPos++] = b;
|
|
589
|
-
++pos;
|
|
590
|
-
}
|
|
591
|
-
}
|
|
592
|
-
// Intentional fall-through...
|
|
593
|
-
case 1:
|
|
594
|
-
len =
|
|
595
|
-
sizeBufPos === 4
|
|
596
|
-
? new DataView(sizeBuf.buffer, 0, 4).getUint32(0, false)
|
|
597
|
-
: dw.getUint32(pos, false);
|
|
598
|
-
if (sizeBufPos)
|
|
599
|
-
sizeBufPos = 0; // in this case pos is already forwarded
|
|
600
|
-
else
|
|
601
|
-
pos += 4; // else pos is not yet forwarded - that's why we do it now
|
|
602
|
-
// Intentional fall-through...
|
|
603
|
-
case 2:
|
|
604
|
-
// Eat the chunk
|
|
605
|
-
if (pos >= chunk.byteLength) {
|
|
606
|
-
state = 2;
|
|
546
|
+
// Start running the machine. If the last stage is a sink, it will consume the data and never emit anything
|
|
547
|
+
// to us here...
|
|
548
|
+
for await (const chunk of result) { }
|
|
549
|
+
}
|
|
550
|
+
|
|
551
|
+
async function* consumeChunkedBinaryStream(source) {
|
|
552
|
+
let state = 0;
|
|
553
|
+
let sizeBuf = new Uint8Array(4);
|
|
554
|
+
let sizeBufPos = 0;
|
|
555
|
+
let bufs = [];
|
|
556
|
+
let len = 0;
|
|
557
|
+
for await (const chunk of source) {
|
|
558
|
+
const dw = new DataView(chunk.buffer, chunk.byteOffset, chunk.byteLength);
|
|
559
|
+
let pos = 0;
|
|
560
|
+
while (pos < chunk.byteLength) {
|
|
561
|
+
switch (state) {
|
|
562
|
+
case 0:
|
|
563
|
+
// Beginning of a size header
|
|
564
|
+
if (pos + 4 > chunk.byteLength) {
|
|
565
|
+
for (const b of chunk.slice(pos)) {
|
|
566
|
+
if (sizeBufPos === 4)
|
|
607
567
|
break;
|
|
608
|
-
|
|
609
|
-
|
|
610
|
-
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
}
|
|
615
|
-
else {
|
|
616
|
-
if (bufs.length > 0) {
|
|
617
|
-
const concats = new Uint8Array(bufs.reduce((p, c) => p + c.byteLength, len));
|
|
618
|
-
let p = 0;
|
|
619
|
-
for (const buf of bufs) {
|
|
620
|
-
concats.set(buf, p);
|
|
621
|
-
p += buf.byteLength;
|
|
622
|
-
}
|
|
623
|
-
concats.set(chunk.slice(pos, pos + len), p);
|
|
624
|
-
bufs = [];
|
|
625
|
-
yield yield __await(concats);
|
|
626
|
-
}
|
|
627
|
-
else {
|
|
628
|
-
yield yield __await(chunk.slice(pos, pos + len));
|
|
629
|
-
}
|
|
630
|
-
pos += len;
|
|
631
|
-
state = 0;
|
|
632
|
-
}
|
|
568
|
+
sizeBuf[sizeBufPos++] = b;
|
|
569
|
+
++pos;
|
|
570
|
+
}
|
|
571
|
+
if (sizeBufPos < 4) {
|
|
572
|
+
// Need more bytes in order to read length.
|
|
573
|
+
// Will go out from while loop as well because pos is defenitely = chunk.byteLength here.
|
|
633
574
|
break;
|
|
575
|
+
}
|
|
634
576
|
}
|
|
635
|
-
|
|
636
|
-
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
577
|
+
else if (sizeBufPos > 0 && sizeBufPos < 4) {
|
|
578
|
+
for (const b of chunk.slice(pos, pos + 4 - sizeBufPos)) {
|
|
579
|
+
sizeBuf[sizeBufPos++] = b;
|
|
580
|
+
++pos;
|
|
581
|
+
}
|
|
582
|
+
}
|
|
583
|
+
// Intentional fall-through...
|
|
584
|
+
case 1:
|
|
585
|
+
len =
|
|
586
|
+
sizeBufPos === 4
|
|
587
|
+
? new DataView(sizeBuf.buffer, 0, 4).getUint32(0, false)
|
|
588
|
+
: dw.getUint32(pos, false);
|
|
589
|
+
if (sizeBufPos)
|
|
590
|
+
sizeBufPos = 0; // in this case pos is already forwarded
|
|
591
|
+
else
|
|
592
|
+
pos += 4; // else pos is not yet forwarded - that's why we do it now
|
|
593
|
+
// Intentional fall-through...
|
|
594
|
+
case 2:
|
|
595
|
+
// Eat the chunk
|
|
596
|
+
if (pos >= chunk.byteLength) {
|
|
597
|
+
state = 2;
|
|
598
|
+
break;
|
|
599
|
+
}
|
|
600
|
+
if (pos + len > chunk.byteLength) {
|
|
601
|
+
bufs.push(chunk.slice(pos));
|
|
602
|
+
len -= (chunk.byteLength - pos);
|
|
603
|
+
state = 2;
|
|
604
|
+
pos = chunk.byteLength; // will break while loop.
|
|
605
|
+
}
|
|
606
|
+
else {
|
|
607
|
+
if (bufs.length > 0) {
|
|
608
|
+
const concats = new Uint8Array(bufs.reduce((p, c) => p + c.byteLength, len));
|
|
609
|
+
let p = 0;
|
|
610
|
+
for (const buf of bufs) {
|
|
611
|
+
concats.set(buf, p);
|
|
612
|
+
p += buf.byteLength;
|
|
613
|
+
}
|
|
614
|
+
concats.set(chunk.slice(pos, pos + len), p);
|
|
615
|
+
bufs = [];
|
|
616
|
+
yield concats;
|
|
617
|
+
}
|
|
618
|
+
else {
|
|
619
|
+
yield chunk.slice(pos, pos + len);
|
|
620
|
+
}
|
|
621
|
+
pos += len;
|
|
622
|
+
state = 0;
|
|
623
|
+
}
|
|
624
|
+
break;
|
|
642
625
|
}
|
|
643
|
-
finally { if (e_1) throw e_1.error; }
|
|
644
626
|
}
|
|
645
|
-
}
|
|
627
|
+
}
|
|
646
628
|
}
|
|
647
629
|
|
|
648
630
|
function getFetchResponseBodyGenerator(res) {
|
|
649
|
-
return function () {
|
|
650
|
-
|
|
651
|
-
|
|
652
|
-
|
|
653
|
-
|
|
654
|
-
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
yield yield __await(value);
|
|
660
|
-
}
|
|
661
|
-
}
|
|
662
|
-
finally {
|
|
663
|
-
reader.releaseLock();
|
|
631
|
+
return async function* () {
|
|
632
|
+
if (!res.body)
|
|
633
|
+
throw new Error("Response body is not readable");
|
|
634
|
+
const reader = res.body.getReader();
|
|
635
|
+
try {
|
|
636
|
+
while (true) {
|
|
637
|
+
const { done, value } = await reader.read();
|
|
638
|
+
if (done)
|
|
639
|
+
return;
|
|
640
|
+
yield value;
|
|
664
641
|
}
|
|
665
|
-
}
|
|
642
|
+
}
|
|
643
|
+
finally {
|
|
644
|
+
reader.releaseLock();
|
|
645
|
+
}
|
|
666
646
|
};
|
|
667
647
|
}
|
|
668
648
|
|
|
@@ -924,6 +904,43 @@ function confirmLogout(userInteraction, currentUserId, numUnsyncedChanges) {
|
|
|
924
904
|
.catch(() => false);
|
|
925
905
|
});
|
|
926
906
|
}
|
|
907
|
+
/**
|
|
908
|
+
* Prompts the user to select an authentication method (OAuth provider or OTP).
|
|
909
|
+
*
|
|
910
|
+
* @param userInteraction - The user interaction BehaviorSubject
|
|
911
|
+
* @param providers - Available OAuth providers
|
|
912
|
+
* @param otpEnabled - Whether OTP is available
|
|
913
|
+
* @param title - Dialog title
|
|
914
|
+
* @param alerts - Optional alerts to display
|
|
915
|
+
* @returns Promise resolving to the user's selection
|
|
916
|
+
*/
|
|
917
|
+
function promptForProvider(userInteraction, providers, otpEnabled, title = 'Choose login method', alerts = []) {
|
|
918
|
+
return new Promise((resolve, reject) => {
|
|
919
|
+
const interactionProps = {
|
|
920
|
+
type: 'provider-selection',
|
|
921
|
+
title,
|
|
922
|
+
alerts,
|
|
923
|
+
providers,
|
|
924
|
+
otpEnabled,
|
|
925
|
+
fields: {},
|
|
926
|
+
submitLabel: undefined,
|
|
927
|
+
cancelLabel: 'Cancel',
|
|
928
|
+
onSelectProvider: (providerName) => {
|
|
929
|
+
userInteraction.next(undefined);
|
|
930
|
+
resolve({ type: 'provider', provider: providerName });
|
|
931
|
+
},
|
|
932
|
+
onSelectOtp: () => {
|
|
933
|
+
userInteraction.next(undefined);
|
|
934
|
+
resolve({ type: 'otp' });
|
|
935
|
+
},
|
|
936
|
+
onCancel: () => {
|
|
937
|
+
userInteraction.next(undefined);
|
|
938
|
+
reject(new Dexie.AbortError('User cancelled'));
|
|
939
|
+
},
|
|
940
|
+
};
|
|
941
|
+
userInteraction.next(interactionProps);
|
|
942
|
+
});
|
|
943
|
+
}
|
|
927
944
|
|
|
928
945
|
function loadAccessToken(db) {
|
|
929
946
|
return __awaiter(this, void 0, void 0, function* () {
|
|
@@ -1247,15 +1264,313 @@ class HttpError extends Error {
|
|
|
1247
1264
|
}
|
|
1248
1265
|
}
|
|
1249
1266
|
|
|
1267
|
+
/** User-friendly messages for OAuth error codes */
|
|
1268
|
+
const ERROR_MESSAGES = {
|
|
1269
|
+
popup_blocked: 'The login popup was blocked by your browser. Please allow popups for this site and try again.',
|
|
1270
|
+
popup_closed: 'The login popup was closed before completing authentication.',
|
|
1271
|
+
access_denied: 'Access was denied by the authentication provider.',
|
|
1272
|
+
invalid_state: 'The authentication response could not be verified. Please try again.',
|
|
1273
|
+
email_not_verified: 'Your email address must be verified before you can log in.',
|
|
1274
|
+
expired_code: 'The authentication code has expired. Please try again.',
|
|
1275
|
+
provider_error: 'An error occurred with the authentication provider.',
|
|
1276
|
+
network_error: 'A network error occurred during authentication. Please check your connection and try again.',
|
|
1277
|
+
};
|
|
1278
|
+
/** Error class for OAuth-specific errors */
|
|
1279
|
+
class OAuthError extends Error {
|
|
1280
|
+
constructor(code, provider, customMessage) {
|
|
1281
|
+
super(customMessage || ERROR_MESSAGES[code]);
|
|
1282
|
+
this.name = 'OAuthError';
|
|
1283
|
+
this.code = code;
|
|
1284
|
+
this.provider = provider;
|
|
1285
|
+
}
|
|
1286
|
+
/** Get user-friendly message for this error */
|
|
1287
|
+
get userMessage() {
|
|
1288
|
+
return ERROR_MESSAGES[this.code] || this.message;
|
|
1289
|
+
}
|
|
1290
|
+
}
|
|
1291
|
+
|
|
1292
|
+
/**
|
|
1293
|
+
* Exchanges a Dexie Cloud authorization code for access and refresh tokens.
|
|
1294
|
+
*
|
|
1295
|
+
* This is called after the OAuth callback delivers the authorization code
|
|
1296
|
+
* via postMessage (popup flow) or redirect.
|
|
1297
|
+
*
|
|
1298
|
+
* @param options - Exchange options
|
|
1299
|
+
* @returns Promise resolving to TokenFinalResponse
|
|
1300
|
+
* @throws OAuthError or TokenErrorResponseError on failure
|
|
1301
|
+
*/
|
|
1302
|
+
function exchangeOAuthCode(options) {
|
|
1303
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1304
|
+
const { databaseUrl, code, publicKey, scopes = ['ACCESS_DB'] } = options;
|
|
1305
|
+
const tokenRequest = {
|
|
1306
|
+
grant_type: 'authorization_code',
|
|
1307
|
+
code,
|
|
1308
|
+
public_key: publicKey,
|
|
1309
|
+
scopes,
|
|
1310
|
+
};
|
|
1311
|
+
try {
|
|
1312
|
+
const res = yield fetch(`${databaseUrl}/token`, {
|
|
1313
|
+
method: 'POST',
|
|
1314
|
+
headers: { 'Content-Type': 'application/json' },
|
|
1315
|
+
body: JSON.stringify(tokenRequest),
|
|
1316
|
+
mode: 'cors',
|
|
1317
|
+
});
|
|
1318
|
+
if (!res.ok) {
|
|
1319
|
+
if (res.status === 400 || res.status === 401) {
|
|
1320
|
+
// Try to parse error response
|
|
1321
|
+
try {
|
|
1322
|
+
const errorResponse = yield res.json();
|
|
1323
|
+
if (errorResponse.type === 'error') {
|
|
1324
|
+
// Check for specific error codes
|
|
1325
|
+
if (errorResponse.messageCode === 'INVALID_OTP') {
|
|
1326
|
+
// In the context of OAuth, this likely means expired code
|
|
1327
|
+
throw new OAuthError('expired_code', undefined, errorResponse.message);
|
|
1328
|
+
}
|
|
1329
|
+
throw new TokenErrorResponseError(errorResponse);
|
|
1330
|
+
}
|
|
1331
|
+
}
|
|
1332
|
+
catch (e) {
|
|
1333
|
+
if (e instanceof OAuthError || e instanceof TokenErrorResponseError) {
|
|
1334
|
+
throw e;
|
|
1335
|
+
}
|
|
1336
|
+
// Fall through to generic error
|
|
1337
|
+
}
|
|
1338
|
+
}
|
|
1339
|
+
const errorText = yield res.text().catch(() => res.statusText);
|
|
1340
|
+
throw new OAuthError('provider_error', undefined, `Token exchange failed: ${res.status} ${errorText}`);
|
|
1341
|
+
}
|
|
1342
|
+
const response = yield res.json();
|
|
1343
|
+
if (response.type === 'error') {
|
|
1344
|
+
throw new TokenErrorResponseError(response);
|
|
1345
|
+
}
|
|
1346
|
+
if (response.type !== 'tokens') {
|
|
1347
|
+
throw new OAuthError('provider_error', undefined, `Unexpected response type: ${response.type}`);
|
|
1348
|
+
}
|
|
1349
|
+
return response;
|
|
1350
|
+
}
|
|
1351
|
+
catch (error) {
|
|
1352
|
+
if (error instanceof OAuthError || error instanceof TokenErrorResponseError) {
|
|
1353
|
+
throw error;
|
|
1354
|
+
}
|
|
1355
|
+
if (error instanceof TypeError) {
|
|
1356
|
+
// Network error
|
|
1357
|
+
throw new OAuthError('network_error');
|
|
1358
|
+
}
|
|
1359
|
+
throw error;
|
|
1360
|
+
}
|
|
1361
|
+
});
|
|
1362
|
+
}
|
|
1363
|
+
|
|
1364
|
+
/** Default response when OAuth is disabled or unavailable */
|
|
1365
|
+
const OTP_ONLY_RESPONSE = {
|
|
1366
|
+
providers: [],
|
|
1367
|
+
otpEnabled: true,
|
|
1368
|
+
};
|
|
1369
|
+
/**
|
|
1370
|
+
* Fetches available authentication providers from the Dexie Cloud server.
|
|
1371
|
+
*
|
|
1372
|
+
* @param databaseUrl - The Dexie Cloud database URL
|
|
1373
|
+
* @param socialAuthEnabled - Whether social auth is enabled in client config (default: true)
|
|
1374
|
+
* @returns Promise resolving to AuthProvidersResponse
|
|
1375
|
+
*
|
|
1376
|
+
* Handles failures gracefully:
|
|
1377
|
+
* - 404 → Returns OTP-only (old server version)
|
|
1378
|
+
* - Network error → Returns OTP-only
|
|
1379
|
+
* - socialAuthEnabled: false → Returns OTP-only without fetching
|
|
1380
|
+
*/
|
|
1381
|
+
function fetchAuthProviders(databaseUrl_1) {
|
|
1382
|
+
return __awaiter(this, arguments, void 0, function* (databaseUrl, socialAuthEnabled = true) {
|
|
1383
|
+
// If social auth is disabled, return OTP-only without fetching
|
|
1384
|
+
if (!socialAuthEnabled) {
|
|
1385
|
+
return OTP_ONLY_RESPONSE;
|
|
1386
|
+
}
|
|
1387
|
+
try {
|
|
1388
|
+
const res = yield fetch(`${databaseUrl}/auth-providers`, {
|
|
1389
|
+
method: 'GET',
|
|
1390
|
+
headers: { 'Accept': 'application/json' },
|
|
1391
|
+
mode: 'cors',
|
|
1392
|
+
});
|
|
1393
|
+
if (res.status === 404) {
|
|
1394
|
+
// Old server version without OAuth support
|
|
1395
|
+
console.debug('[dexie-cloud] Server does not support /auth-providers endpoint. Using OTP-only authentication.');
|
|
1396
|
+
return OTP_ONLY_RESPONSE;
|
|
1397
|
+
}
|
|
1398
|
+
if (!res.ok) {
|
|
1399
|
+
console.warn(`[dexie-cloud] Failed to fetch auth providers: ${res.status} ${res.statusText}`);
|
|
1400
|
+
return OTP_ONLY_RESPONSE;
|
|
1401
|
+
}
|
|
1402
|
+
return yield res.json();
|
|
1403
|
+
}
|
|
1404
|
+
catch (error) {
|
|
1405
|
+
// Network error or other failure - fall back to OTP
|
|
1406
|
+
console.debug('[dexie-cloud] Could not fetch auth providers, falling back to OTP:', error);
|
|
1407
|
+
return OTP_ONLY_RESPONSE;
|
|
1408
|
+
}
|
|
1409
|
+
});
|
|
1410
|
+
}
|
|
1411
|
+
|
|
1412
|
+
/** Generate a random state string for CSRF protection */
|
|
1413
|
+
function generateState() {
|
|
1414
|
+
const array = new Uint8Array(32);
|
|
1415
|
+
crypto.getRandomValues(array);
|
|
1416
|
+
return Array.from(array, byte => byte.toString(16).padStart(2, '0')).join('');
|
|
1417
|
+
}
|
|
1418
|
+
/** Build the OAuth login URL */
|
|
1419
|
+
function buildOAuthLoginUrl(options, state) {
|
|
1420
|
+
const url = new URL(`${options.databaseUrl}/oauth/login/${options.provider}`);
|
|
1421
|
+
url.searchParams.set('state', state);
|
|
1422
|
+
// Set the redirect URI for postMessage or custom scheme
|
|
1423
|
+
const redirectUri = options.redirectUri ||
|
|
1424
|
+
(typeof window !== 'undefined' ? window.location.origin : '');
|
|
1425
|
+
if (redirectUri) {
|
|
1426
|
+
url.searchParams.set('redirect_uri', redirectUri);
|
|
1427
|
+
}
|
|
1428
|
+
return url.toString();
|
|
1429
|
+
}
|
|
1430
|
+
/** Calculate centered popup position */
|
|
1431
|
+
function getPopupPosition(width, height) {
|
|
1432
|
+
var _a, _b, _c, _d, _e, _f;
|
|
1433
|
+
const screenLeft = (_a = window.screenLeft) !== null && _a !== void 0 ? _a : window.screenX;
|
|
1434
|
+
const screenTop = (_b = window.screenTop) !== null && _b !== void 0 ? _b : window.screenY;
|
|
1435
|
+
const screenWidth = (_d = (_c = window.innerWidth) !== null && _c !== void 0 ? _c : document.documentElement.clientWidth) !== null && _d !== void 0 ? _d : screen.width;
|
|
1436
|
+
const screenHeight = (_f = (_e = window.innerHeight) !== null && _e !== void 0 ? _e : document.documentElement.clientHeight) !== null && _f !== void 0 ? _f : screen.height;
|
|
1437
|
+
const left = screenLeft + (screenWidth - width) / 2;
|
|
1438
|
+
const top = screenTop + (screenHeight - height) / 2;
|
|
1439
|
+
return { left: Math.max(0, left), top: Math.max(0, top) };
|
|
1440
|
+
}
|
|
1441
|
+
/**
|
|
1442
|
+
* Initiates OAuth login flow using a popup window.
|
|
1443
|
+
*
|
|
1444
|
+
* Opens a popup to the OAuth provider, listens for postMessage with the result,
|
|
1445
|
+
* and returns the Dexie Cloud authorization code.
|
|
1446
|
+
*
|
|
1447
|
+
* @param options - OAuth login options
|
|
1448
|
+
* @returns Promise resolving to OAuthLoginResult
|
|
1449
|
+
* @throws OAuthError on failure
|
|
1450
|
+
*/
|
|
1451
|
+
function oauthLogin(options) {
|
|
1452
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1453
|
+
const { databaseUrl, provider, usePopup = true } = options;
|
|
1454
|
+
if (!usePopup) {
|
|
1455
|
+
// For redirect flows, we can't return a promise - the page will navigate away
|
|
1456
|
+
throw new Error('Non-popup OAuth flow requires handleOAuthCallback after redirect');
|
|
1457
|
+
}
|
|
1458
|
+
const state = generateState();
|
|
1459
|
+
const loginUrl = buildOAuthLoginUrl(options, state);
|
|
1460
|
+
// Calculate popup dimensions and position
|
|
1461
|
+
const width = 500;
|
|
1462
|
+
const height = 600;
|
|
1463
|
+
const { left, top } = getPopupPosition(width, height);
|
|
1464
|
+
// Open popup window
|
|
1465
|
+
const popup = window.open(loginUrl, 'dexie-cloud-oauth', `width=${width},height=${height},left=${left},top=${top},menubar=no,toolbar=no,location=yes,status=no`);
|
|
1466
|
+
if (!popup) {
|
|
1467
|
+
throw new OAuthError('popup_blocked', provider);
|
|
1468
|
+
}
|
|
1469
|
+
return new Promise((resolve, reject) => {
|
|
1470
|
+
let resolved = false;
|
|
1471
|
+
// Listen for postMessage from the popup
|
|
1472
|
+
const handleMessage = (event) => {
|
|
1473
|
+
// Validate origin - must be from the Dexie Cloud server
|
|
1474
|
+
const expectedOrigin = new URL(databaseUrl).origin;
|
|
1475
|
+
if (event.origin !== expectedOrigin) {
|
|
1476
|
+
return; // Ignore messages from other origins
|
|
1477
|
+
}
|
|
1478
|
+
// Check if this is our OAuth result message
|
|
1479
|
+
if (!isOAuthResultMessage(event.data)) {
|
|
1480
|
+
return;
|
|
1481
|
+
}
|
|
1482
|
+
const message = event.data;
|
|
1483
|
+
// Validate state to prevent CSRF
|
|
1484
|
+
if (message.state !== state) {
|
|
1485
|
+
console.warn('[dexie-cloud] OAuth state mismatch, ignoring message');
|
|
1486
|
+
return;
|
|
1487
|
+
}
|
|
1488
|
+
// Clean up
|
|
1489
|
+
cleanup();
|
|
1490
|
+
resolved = true;
|
|
1491
|
+
// Handle error from OAuth flow
|
|
1492
|
+
if (message.error) {
|
|
1493
|
+
const errorCode = mapOAuthError(message.error);
|
|
1494
|
+
reject(new OAuthError(errorCode, provider, message.error));
|
|
1495
|
+
return;
|
|
1496
|
+
}
|
|
1497
|
+
// Success - return the authorization code
|
|
1498
|
+
if (message.code) {
|
|
1499
|
+
resolve({
|
|
1500
|
+
code: message.code,
|
|
1501
|
+
provider: message.provider,
|
|
1502
|
+
state: message.state,
|
|
1503
|
+
});
|
|
1504
|
+
}
|
|
1505
|
+
else {
|
|
1506
|
+
reject(new OAuthError('provider_error', provider, 'No authorization code received'));
|
|
1507
|
+
}
|
|
1508
|
+
};
|
|
1509
|
+
// Check if popup was closed without completing
|
|
1510
|
+
const checkPopupClosed = setInterval(() => {
|
|
1511
|
+
if (popup.closed && !resolved) {
|
|
1512
|
+
cleanup();
|
|
1513
|
+
reject(new OAuthError('popup_closed', provider));
|
|
1514
|
+
}
|
|
1515
|
+
}, 500);
|
|
1516
|
+
// Cleanup function
|
|
1517
|
+
const cleanup = () => {
|
|
1518
|
+
window.removeEventListener('message', handleMessage);
|
|
1519
|
+
clearInterval(checkPopupClosed);
|
|
1520
|
+
try {
|
|
1521
|
+
if (!popup.closed) {
|
|
1522
|
+
popup.close();
|
|
1523
|
+
}
|
|
1524
|
+
}
|
|
1525
|
+
catch (_a) {
|
|
1526
|
+
// Ignore errors when closing popup
|
|
1527
|
+
}
|
|
1528
|
+
};
|
|
1529
|
+
// Start listening for messages
|
|
1530
|
+
window.addEventListener('message', handleMessage);
|
|
1531
|
+
});
|
|
1532
|
+
});
|
|
1533
|
+
}
|
|
1534
|
+
/** Map OAuth error strings to error codes */
|
|
1535
|
+
function mapOAuthError(error) {
|
|
1536
|
+
const lowerError = error.toLowerCase();
|
|
1537
|
+
if (lowerError.includes('access_denied') || lowerError.includes('access denied')) {
|
|
1538
|
+
return 'access_denied';
|
|
1539
|
+
}
|
|
1540
|
+
if (lowerError.includes('email') && lowerError.includes('verif')) {
|
|
1541
|
+
return 'email_not_verified';
|
|
1542
|
+
}
|
|
1543
|
+
if (lowerError.includes('expired')) {
|
|
1544
|
+
return 'expired_code';
|
|
1545
|
+
}
|
|
1546
|
+
if (lowerError.includes('state')) {
|
|
1547
|
+
return 'invalid_state';
|
|
1548
|
+
}
|
|
1549
|
+
return 'provider_error';
|
|
1550
|
+
}
|
|
1551
|
+
|
|
1250
1552
|
function otpFetchTokenCallback(db) {
|
|
1251
1553
|
const { userInteraction } = db.cloud;
|
|
1252
1554
|
return function otpAuthenticate(_a) {
|
|
1253
1555
|
return __awaiter(this, arguments, void 0, function* ({ public_key, hints }) {
|
|
1254
|
-
var _b;
|
|
1556
|
+
var _b, _c;
|
|
1255
1557
|
let tokenRequest;
|
|
1256
1558
|
const url = (_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.databaseUrl;
|
|
1257
1559
|
if (!url)
|
|
1258
1560
|
throw new Error(`No database URL given.`);
|
|
1561
|
+
// Handle OAuth code exchange (from redirect/deep link flows)
|
|
1562
|
+
if ((hints === null || hints === void 0 ? void 0 : hints.oauthCode) && hints.provider) {
|
|
1563
|
+
return yield exchangeOAuthCode({
|
|
1564
|
+
databaseUrl: url,
|
|
1565
|
+
code: hints.oauthCode,
|
|
1566
|
+
publicKey: public_key,
|
|
1567
|
+
scopes: ['ACCESS_DB'],
|
|
1568
|
+
});
|
|
1569
|
+
}
|
|
1570
|
+
// Handle OAuth provider login (popup flow)
|
|
1571
|
+
if (hints === null || hints === void 0 ? void 0 : hints.provider) {
|
|
1572
|
+
return yield handleOAuthFlow(db, public_key, hints.provider);
|
|
1573
|
+
}
|
|
1259
1574
|
if ((hints === null || hints === void 0 ? void 0 : hints.grant_type) === 'demo') {
|
|
1260
1575
|
const demo_user = yield promptForEmail(userInteraction, 'Enter a demo user email', (hints === null || hints === void 0 ? void 0 : hints.email) || (hints === null || hints === void 0 ? void 0 : hints.userId));
|
|
1261
1576
|
tokenRequest = {
|
|
@@ -1279,6 +1594,18 @@ function otpFetchTokenCallback(db) {
|
|
|
1279
1594
|
};
|
|
1280
1595
|
}
|
|
1281
1596
|
else {
|
|
1597
|
+
// Check for available auth providers (OAuth + OTP)
|
|
1598
|
+
const socialAuthEnabled = ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.socialAuth) !== false;
|
|
1599
|
+
const authProviders = yield fetchAuthProviders(url, socialAuthEnabled);
|
|
1600
|
+
// If we have OAuth providers available, prompt for selection
|
|
1601
|
+
if (authProviders.providers.length > 0) {
|
|
1602
|
+
const selection = yield promptForProvider(userInteraction, authProviders.providers, authProviders.otpEnabled, 'Sign in');
|
|
1603
|
+
if (selection.type === 'provider') {
|
|
1604
|
+
// User selected an OAuth provider
|
|
1605
|
+
return yield handleOAuthFlow(db, public_key, selection.provider);
|
|
1606
|
+
}
|
|
1607
|
+
// User chose OTP - continue with email prompt below
|
|
1608
|
+
}
|
|
1282
1609
|
const email = yield promptForEmail(userInteraction, 'Enter email address', hints === null || hints === void 0 ? void 0 : hints.email);
|
|
1283
1610
|
if (/@demo.local$/.test(email)) {
|
|
1284
1611
|
tokenRequest = {
|
|
@@ -1356,6 +1683,49 @@ function otpFetchTokenCallback(db) {
|
|
|
1356
1683
|
});
|
|
1357
1684
|
};
|
|
1358
1685
|
}
|
|
1686
|
+
/**
|
|
1687
|
+
* Handles the OAuth popup flow and token exchange.
|
|
1688
|
+
*/
|
|
1689
|
+
function handleOAuthFlow(db, publicKey, provider) {
|
|
1690
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
1691
|
+
var _a, _b, _c;
|
|
1692
|
+
const url = (_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl;
|
|
1693
|
+
if (!url)
|
|
1694
|
+
throw new Error(`No database URL given.`);
|
|
1695
|
+
const { userInteraction } = db.cloud;
|
|
1696
|
+
const usePopup = ((_b = db.cloud.options) === null || _b === void 0 ? void 0 : _b.oauthPopup) !== false;
|
|
1697
|
+
const redirectUri = ((_c = db.cloud.options) === null || _c === void 0 ? void 0 : _c.oauthRedirectUri) ||
|
|
1698
|
+
(typeof window !== 'undefined' ? window.location.origin : undefined);
|
|
1699
|
+
try {
|
|
1700
|
+
// Start OAuth popup flow
|
|
1701
|
+
const result = yield oauthLogin({
|
|
1702
|
+
databaseUrl: url,
|
|
1703
|
+
provider,
|
|
1704
|
+
redirectUri,
|
|
1705
|
+
usePopup,
|
|
1706
|
+
});
|
|
1707
|
+
// Exchange the auth code for tokens
|
|
1708
|
+
return yield exchangeOAuthCode({
|
|
1709
|
+
databaseUrl: url,
|
|
1710
|
+
code: result.code,
|
|
1711
|
+
publicKey,
|
|
1712
|
+
scopes: ['ACCESS_DB'],
|
|
1713
|
+
});
|
|
1714
|
+
}
|
|
1715
|
+
catch (error) {
|
|
1716
|
+
if (error instanceof OAuthError) {
|
|
1717
|
+
// Show user-friendly error message
|
|
1718
|
+
yield alertUser(userInteraction, 'Authentication Failed', {
|
|
1719
|
+
type: 'error',
|
|
1720
|
+
messageCode: 'GENERIC_ERROR',
|
|
1721
|
+
message: error.userMessage,
|
|
1722
|
+
messageParams: {},
|
|
1723
|
+
}).catch(() => { });
|
|
1724
|
+
}
|
|
1725
|
+
throw error;
|
|
1726
|
+
}
|
|
1727
|
+
});
|
|
1728
|
+
}
|
|
1359
1729
|
|
|
1360
1730
|
/** A way to log to console in production without terser stripping out
|
|
1361
1731
|
* it from the release bundle.
|
|
@@ -1716,10 +2086,17 @@ function removeRedundantUpdateOps(muts) {
|
|
|
1716
2086
|
return true;
|
|
1717
2087
|
if (mut.keys.length !== 1 || mut.changeSpecs.length !== 1)
|
|
1718
2088
|
return true;
|
|
2089
|
+
// Check if this has PropModifications - if so, skip optimization
|
|
2090
|
+
const changeSpecs = mut.changeSpecs[0];
|
|
2091
|
+
if (Object.values(changeSpecs).some(v => typeof v === "object" && v && "@@propmod" in v)) {
|
|
2092
|
+
return true; // Cannot optimize if any PropModification is present
|
|
2093
|
+
}
|
|
1719
2094
|
// Keep track of properties that aren't overlapped by later transactions
|
|
1720
2095
|
const unoverlappedProps = new Set(Object.keys(mut.changeSpecs[0]));
|
|
1721
2096
|
const strKey = '' + mut.keys[0];
|
|
1722
2097
|
const keyCoverage = updateCoverage.get(strKey);
|
|
2098
|
+
if (!keyCoverage)
|
|
2099
|
+
return true; // No coverage info - cannot optimize
|
|
1723
2100
|
for (let i = keyCoverage.length - 1; i >= 0; --i) {
|
|
1724
2101
|
const { txid, updateSpec } = keyCoverage[i];
|
|
1725
2102
|
if (txid === mut.txid)
|
|
@@ -2385,7 +2762,8 @@ const defs = Object.assign(Object.assign(Object.assign(Object.assign({}, undefin
|
|
|
2385
2762
|
return Object.assign({ $t: 'PropModification' }, propModification['@@propmod']);
|
|
2386
2763
|
},
|
|
2387
2764
|
revive: (_a) => {
|
|
2388
|
-
var
|
|
2765
|
+
var { $t } = _a, // strip '$t'
|
|
2766
|
+
propModSpec = __rest(_a, ["$t"]) // keep the rest
|
|
2389
2767
|
;
|
|
2390
2768
|
return new PropModification(propModSpec);
|
|
2391
2769
|
},
|
|
@@ -4494,7 +4872,8 @@ function overrideParseStoresSpec(origFunc, dexie) {
|
|
|
4494
4872
|
const cloudSchema = dexie.cloud.schema || (dexie.cloud.schema = {});
|
|
4495
4873
|
const allPrefixes = new Set();
|
|
4496
4874
|
Object.keys(storesClone).forEach(tableName => {
|
|
4497
|
-
|
|
4875
|
+
var _a;
|
|
4876
|
+
const schemaSrc = (_a = storesClone[tableName]) === null || _a === void 0 ? void 0 : _a.trim();
|
|
4498
4877
|
const cloudTableSchema = cloudSchema[tableName] || (cloudSchema[tableName] = {});
|
|
4499
4878
|
if (schemaSrc != null) {
|
|
4500
4879
|
if (/^\@/.test(schemaSrc)) {
|
|
@@ -4535,7 +4914,8 @@ function performGuardedJob(db, jobName, job) {
|
|
|
4535
4914
|
// No support for guarding jobs. IE11, node.js, etc.
|
|
4536
4915
|
return job();
|
|
4537
4916
|
}
|
|
4538
|
-
|
|
4917
|
+
// @ts-expect-error - LockManager callback type inference issue with generics
|
|
4918
|
+
return navigator.locks.request(db.name + '|' + jobName, job);
|
|
4539
4919
|
}
|
|
4540
4920
|
|
|
4541
4921
|
function performInitialSync(db, cloudOptions, cloudSchema) {
|
|
@@ -5290,12 +5670,9 @@ function verifySchema(db) {
|
|
|
5290
5670
|
}
|
|
5291
5671
|
}
|
|
5292
5672
|
|
|
5293
|
-
var n,l$1,u$1,t$1,o$1,f$1={},e$1=[],c$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function s$1(n,l){for(var u in l)n[u]=l[u];return n}function a$1(n){var l=n.parentNode;l&&l.removeChild(n);}function h(l,u,i){var t,o,r,f={};for(r in u)"key"==r?t=u[r]:"ref"==r?o=u[r]:f[r]=u[r];if(arguments.length>2&&(f.children=arguments.length>3?n.call(arguments,2):i),"function"==typeof l&&null!=l.defaultProps)for(r in l.defaultProps)void 0===f[r]&&(f[r]=l.defaultProps[r]);return v$1(l,f,t,o,null)}function v$1(n,i,t,o,r){var f={type:n,props:i,key:t,ref:o,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==r?++u$1:r};return null==r&&null!=l$1.vnode&&l$1.vnode(f),f}function p$1(n){return n.children}function d$1(n,l){this.props=n,this.context=l;}function _$1(n,l){if(null==l)return n.__?_$1(n.__,n.__.__k.indexOf(n)+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?_$1(n):null}function k$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return k$1(n)}}function b$1(n){(!n.__d&&(n.__d=!0)&&t$1.push(n)&&!g$1.__r++||o$1!==l$1.debounceRendering)&&((o$1=l$1.debounceRendering)||setTimeout)(g$1);}function g$1(){for(var n;g$1.__r=t$1.length;)n=t$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),t$1=[],n.some(function(n){var l,u,i,t,o,r;n.__d&&(o=(t=(l=n).__v).__e,(r=l.__P)&&(u=[],(i=s$1({},t)).__v=t.__v+1,j$1(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?_$1(t):o,t.__h),z$1(u,t),t.__e!=o&&k$1(t)));});}function w$1(n,l,u,i,t,o,r,c,s,a){var h,y,d,k,b,g,w,x=i&&i.__k||e$1,C=x.length;for(u.__k=[],h=0;h<l.length;h++)if(null!=(k=u.__k[h]=null==(k=l[h])||"boolean"==typeof k?null:"string"==typeof k||"number"==typeof k||"bigint"==typeof k?v$1(null,k,null,null,k):Array.isArray(k)?v$1(p$1,{children:k},null,null,null):k.__b>0?v$1(k.type,k.props,k.key,null,k.__v):k)){if(k.__=u,k.__b=u.__b+1,null===(d=x[h])||d&&k.key==d.key&&k.type===d.type)x[h]=void 0;else for(y=0;y<C;y++){if((d=x[y])&&k.key==d.key&&k.type===d.type){x[y]=void 0;break}d=null;}j$1(n,k,d=d||f$1,t,o,r,c,s,a),b=k.__e,(y=k.ref)&&d.ref!=y&&(w||(w=[]),d.ref&&w.push(d.ref,null,k),w.push(y,k.__c||b,k)),null!=b?(null==g&&(g=b),"function"==typeof k.type&&k.__k===d.__k?k.__d=s=m$1(k,s,n):s=A(n,k,d,x,b,s),"function"==typeof u.type&&(u.__d=s)):s&&d.__e==s&&s.parentNode!=n&&(s=_$1(d));}for(u.__e=g,h=C;h--;)null!=x[h]&&("function"==typeof u.type&&null!=x[h].__e&&x[h].__e==u.__d&&(u.__d=_$1(i,h+1)),N(x[h],x[h]));if(w)for(h=0;h<w.length;h++)M(w[h],w[++h],w[++h]);}function m$1(n,l,u){for(var i,t=n.__k,o=0;t&&o<t.length;o++)(i=t[o])&&(i.__=n,l="function"==typeof i.type?m$1(i,l,u):A(u,i,i,t,i.__e,l));return l}function A(n,l,u,i,t,o){var r,f,e;if(void 0!==l.__d)r=l.__d,l.__d=void 0;else if(null==u||t!=o||null==t.parentNode)n:if(null==o||o.parentNode!==n)n.appendChild(t),r=null;else {for(f=o,e=0;(f=f.nextSibling)&&e<i.length;e+=2)if(f==t)break n;n.insertBefore(t,o),r=o;}return void 0!==r?r:t.nextSibling}function C(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||H(n,o,null,u[o],i);for(o in l)t&&"function"!=typeof l[o]||"children"===o||"key"===o||"value"===o||"checked"===o||u[o]===l[o]||H(n,o,l[o],u[o],i);}function $(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||c$1.test(l)?u:u+"px";}function H(n,l,u,i,t){var o;n:if("style"===l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof i&&(n.style.cssText=i=""),i)for(l in i)u&&l in u||$(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||$(n.style,l,u[l]);}else if("o"===l[0]&&"n"===l[1])o=l!==(l=l.replace(/Capture$/,"")),l=l.toLowerCase()in n?l.toLowerCase().slice(2):l.slice(2),n.l||(n.l={}),n.l[l+o]=u,u?i||n.addEventListener(l,o?T:I,o):n.removeEventListener(l,o?T:I,o);else if("dangerouslySetInnerHTML"!==l){if(t)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("href"!==l&&"list"!==l&&"form"!==l&&"tabIndex"!==l&&"download"!==l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null!=u&&(!1!==u||"a"===l[0]&&"r"===l[1])?n.setAttribute(l,u):n.removeAttribute(l));}}function I(n){this.l[n.type+!1](l$1.event?l$1.event(n):n);}function T(n){this.l[n.type+!0](l$1.event?l$1.event(n):n);}function j$1(n,u,i,t,o,r,f,e,c){var a,h,v,y,_,k,b,g,m,x,A,C,$,H=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(c=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=l$1.__b)&&a(u);try{n:if("function"==typeof H){if(g=u.props,m=(a=H.contextType)&&t[a.__c],x=a?m?m.props.value:a.__:t,i.__c?b=(h=u.__c=i.__c).__=h.__E:("prototype"in H&&H.prototype.render?u.__c=h=new H(g,x):(u.__c=h=new d$1(g,x),h.constructor=H,h.render=O),m&&m.sub(h),h.props=g,h.state||(h.state={}),h.context=x,h.__n=t,v=h.__d=!0,h.__h=[]),null==h.__s&&(h.__s=h.state),null!=H.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=s$1({},h.__s)),s$1(h.__s,H.getDerivedStateFromProps(g,h.__s))),y=h.props,_=h.state,v)null==H.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(null==H.getDerivedStateFromProps&&g!==y&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(g,x),!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(g,h.__s,x)||u.__v===i.__v){h.props=g,h.state=h.__s,u.__v!==i.__v&&(h.__d=!1),h.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),h.__h.length&&f.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(g,h.__s,x),null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(y,_,k);});}if(h.context=x,h.props=g,h.__v=u,h.__P=n,A=l$1.__r,C=0,"prototype"in H&&H.prototype.render)h.state=h.__s,h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context);else do{h.__d=!1,A&&A(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++C<25);h.state=h.__s,null!=h.getChildContext&&(t=s$1(s$1({},t),h.getChildContext())),v||null==h.getSnapshotBeforeUpdate||(k=h.getSnapshotBeforeUpdate(y,_)),$=null!=a&&a.type===p$1&&null==a.key?a.props.children:a,w$1(n,Array.isArray($)?$:[$],u,i,t,o,r,f,e,c),h.base=u.__e,u.__h=null,h.__h.length&&f.push(h),b&&(h.__E=h.__=null),h.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=L(i.__e,u,i,t,o,r,f,c);(a=l$1.diffed)&&a(u);}catch(n){u.__v=null,(c||null!=r)&&(u.__e=e,u.__h=!!c,r[r.indexOf(e)]=null),l$1.__e(n,u,i);}}function z$1(n,u){l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function L(l,u,i,t,o,r,e,c){var s,h,v,y=i.props,p=u.props,d=u.type,k=0;if("svg"===d&&(o=!0),null!=r)for(;k<r.length;k++)if((s=r[k])&&"setAttribute"in s==!!d&&(d?s.localName===d:3===s.nodeType)){l=s,r[k]=null;break}if(null==l){if(null===d)return document.createTextNode(p);l=o?document.createElementNS("http://www.w3.org/2000/svg",d):document.createElement(d,p.is&&p),r=null,c=!1;}if(null===d)y===p||c&&l.data===p||(l.data=p);else {if(r=r&&n.call(l.childNodes),h=(y=i.props||f$1).dangerouslySetInnerHTML,v=p.dangerouslySetInnerHTML,!c){if(null!=r)for(y={},k=0;k<l.attributes.length;k++)y[l.attributes[k].name]=l.attributes[k].value;(v||h)&&(v&&(h&&v.__html==h.__html||v.__html===l.innerHTML)||(l.innerHTML=v&&v.__html||""));}if(C(l,p,y,o,c),v)u.__k=[];else if(k=u.props.children,w$1(l,Array.isArray(k)?k:[k],u,i,t,o&&"foreignObject"!==d,r,e,r?r[0]:i.__k&&_$1(i,0),c),null!=r)for(k=r.length;k--;)null!=r[k]&&a$1(r[k]);c||("value"in p&&void 0!==(k=p.value)&&(k!==l.value||"progress"===d&&!k||"option"===d&&k!==y.value)&&H(l,"value",k,y.value,!1),"checked"in p&&void 0!==(k=p.checked)&&k!==l.checked&&H(l,"checked",k,y.checked,!1));}return l}function M(n,u,i){try{"function"==typeof n?n(u):n.current=u;}catch(n){l$1.__e(n,i);}}function N(n,u,i){var t,o;if(l$1.unmount&&l$1.unmount(n),(t=n.ref)&&(t.current&&t.current!==n.__e||M(t,null,u)),null!=(t=n.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(n){l$1.__e(n,u);}t.base=t.__P=null;}if(t=n.__k)for(o=0;o<t.length;o++)t[o]&&N(t[o],u,"function"!=typeof n.type);i||null==n.__e||a$1(n.__e),n.__e=n.__d=void 0;}function O(n,l,u){return this.constructor(n,u)}function P(u,i,t){var o,r,e;l$1.__&&l$1.__(u,i),r=(o="function"==typeof t)?null:t&&t.__k||i.__k,e=[],j$1(i,u=(!o&&t||i).__k=h(p$1,null,[u]),r||f$1,f$1,void 0!==i.ownerSVGElement,!o&&t?[t]:r?null:i.firstChild?n.call(i.childNodes):null,e,!o&&t?t:r?r.__e:i.firstChild,o),z$1(e,u);}n=e$1.slice,l$1={__e:function(n,l,u,i){for(var t,o,r;l=l.__;)if((t=l.__c)&&!t.__)try{if((o=t.constructor)&&null!=o.getDerivedStateFromError&&(t.setState(o.getDerivedStateFromError(n)),r=t.__d),null!=t.componentDidCatch&&(t.componentDidCatch(n,i||{}),r=t.__d),r)return t.__E=t}catch(l){n=l;}throw n}},u$1=0,d$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=s$1({},this.state),"function"==typeof n&&(n=n(s$1({},u),this.props)),n&&s$1(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),b$1(this));},d$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),b$1(this));},d$1.prototype.render=p$1,t$1=[],g$1.__r=0;
|
|
5673
|
+
var n,l$1,u$1,i$1,r$1,o$1,e$1,f$1,c$1,s$1,a$1,p$1={},v$1=[],y=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,w$1=Array.isArray;function d$1(n,l){for(var u in l)n[u]=l[u];return n}function g(n){n&&n.parentNode&&n.parentNode.removeChild(n);}function _$1(l,u,t){var i,r,o,e={};for(o in u)"key"==o?i=u[o]:"ref"==o?r=u[o]:e[o]=u[o];if(arguments.length>2&&(e.children=arguments.length>3?n.call(arguments,2):t),"function"==typeof l&&null!=l.defaultProps)for(o in l.defaultProps) void 0===e[o]&&(e[o]=l.defaultProps[o]);return m$1(l,e,i,r,null)}function m$1(n,t,i,r,o){var e={type:n,props:t,key:i,ref:r,__k:null,__:null,__b:0,__e:null,__c:null,constructor:void 0,__v:null==o?++u$1:o,__i:-1,__u:0};return null==o&&null!=l$1.vnode&&l$1.vnode(e),e}function k$1(n){return n.children}function x(n,l){this.props=n,this.context=l;}function S(n,l){if(null==l)return n.__?S(n.__,n.__i+1):null;for(var u;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e)return u.__e;return "function"==typeof n.type?S(n):null}function C$1(n){var l,u;if(null!=(n=n.__)&&null!=n.__c){for(n.__e=n.__c.base=null,l=0;l<n.__k.length;l++)if(null!=(u=n.__k[l])&&null!=u.__e){n.__e=n.__c.base=u.__e;break}return C$1(n)}}function M(n){(!n.__d&&(n.__d=true)&&i$1.push(n)&&!$.__r++||r$1!=l$1.debounceRendering)&&((r$1=l$1.debounceRendering)||o$1)($);}function $(){for(var n,u,t,r,o,f,c,s=1;i$1.length;)i$1.length>s&&i$1.sort(e$1),n=i$1.shift(),s=i$1.length,n.__d&&(t=void 0,r=void 0,o=(r=(u=n).__v).__e,f=[],c=[],u.__P&&((t=d$1({},r)).__v=r.__v+1,l$1.vnode&&l$1.vnode(t),O(u.__P,t,r,u.__n,u.__P.namespaceURI,32&r.__u?[o]:null,f,null==o?S(r):o,!!(32&r.__u),c),t.__v=r.__v,t.__.__k[t.__i]=t,N(f,t,c),r.__e=r.__=null,t.__e!=o&&C$1(t)));$.__r=0;}function I(n,l,u,t,i,r,o,e,f,c,s){var a,h,y,w,d,g,_,m=t&&t.__k||v$1,b=l.length;for(f=P(u,l,m,f,b),a=0;a<b;a++)null!=(y=u.__k[a])&&(h=-1==y.__i?p$1:m[y.__i]||p$1,y.__i=a,g=O(n,y,h,i,r,o,e,f,c,s),w=y.__e,y.ref&&h.ref!=y.ref&&(h.ref&&B$1(h.ref,null,y),s.push(y.ref,y.__c||w,y)),null==d&&null!=w&&(d=w),(_=!!(4&y.__u))||h.__k===y.__k?f=A$1(y,f,n,_):"function"==typeof y.type&&void 0!==g?f=g:w&&(f=w.nextSibling),y.__u&=-7);return u.__e=d,f}function P(n,l,u,t,i){var r,o,e,f,c,s=u.length,a=s,h=0;for(n.__k=new Array(i),r=0;r<i;r++)null!=(o=l[r])&&"boolean"!=typeof o&&"function"!=typeof o?("string"==typeof o||"number"==typeof o||"bigint"==typeof o||o.constructor==String?o=n.__k[r]=m$1(null,o,null,null,null):w$1(o)?o=n.__k[r]=m$1(k$1,{children:o},null,null,null):null==o.constructor&&o.__b>0?o=n.__k[r]=m$1(o.type,o.props,o.key,o.ref?o.ref:null,o.__v):n.__k[r]=o,f=r+h,o.__=n,o.__b=n.__b+1,-1!=(c=o.__i=L(o,u,f,a))&&(a--,(e=u[c])&&(e.__u|=2)),null==e||null==e.__v?(-1==c&&(i>s?h--:i<s&&h++),"function"!=typeof o.type&&(o.__u|=4)):c!=f&&(c==f-1?h--:c==f+1?h++:(c>f?h--:h++,o.__u|=4))):n.__k[r]=null;if(a)for(r=0;r<s;r++)null!=(e=u[r])&&0==(2&e.__u)&&(e.__e==t&&(t=S(e)),D$1(e,e));return t}function A$1(n,l,u,t){var i,r;if("function"==typeof n.type){for(i=n.__k,r=0;i&&r<i.length;r++)i[r]&&(i[r].__=n,l=A$1(i[r],l,u,t));return l}n.__e!=l&&(t&&(l&&n.type&&!l.parentNode&&(l=S(n)),u.insertBefore(n.__e,l||null)),l=n.__e);do{l=l&&l.nextSibling;}while(null!=l&&8==l.nodeType);return l}function L(n,l,u,t){var i,r,o,e=n.key,f=n.type,c=l[u],s=null!=c&&0==(2&c.__u);if(null===c&&null==e||s&&e==c.key&&f==c.type)return u;if(t>(s?1:0))for(i=u-1,r=u+1;i>=0||r<l.length;)if(null!=(c=l[o=i>=0?i--:r++])&&0==(2&c.__u)&&e==c.key&&f==c.type)return o;return -1}function T$1(n,l,u){"-"==l[0]?n.setProperty(l,null==u?"":u):n[l]=null==u?"":"number"!=typeof u||y.test(l)?u:u+"px";}function j$1(n,l,u,t,i){var r,o;n:if("style"==l)if("string"==typeof u)n.style.cssText=u;else {if("string"==typeof t&&(n.style.cssText=t=""),t)for(l in t)u&&l in u||T$1(n.style,l,"");if(u)for(l in u)t&&u[l]==t[l]||T$1(n.style,l,u[l]);}else if("o"==l[0]&&"n"==l[1])r=l!=(l=l.replace(f$1,"$1")),o=l.toLowerCase(),l=o in n||"onFocusOut"==l||"onFocusIn"==l?o.slice(2):l.slice(2),n.l||(n.l={}),n.l[l+r]=u,u?t?u.u=t.u:(u.u=c$1,n.addEventListener(l,r?a$1:s$1,r)):n.removeEventListener(l,r?a$1:s$1,r);else {if("http://www.w3.org/2000/svg"==i)l=l.replace(/xlink(H|:h)/,"h").replace(/sName$/,"s");else if("width"!=l&&"height"!=l&&"href"!=l&&"list"!=l&&"form"!=l&&"tabIndex"!=l&&"download"!=l&&"rowSpan"!=l&&"colSpan"!=l&&"role"!=l&&"popover"!=l&&l in n)try{n[l]=null==u?"":u;break n}catch(n){}"function"==typeof u||(null==u||false===u&&"-"!=l[4]?n.removeAttribute(l):n.setAttribute(l,"popover"==l&&1==u?"":u));}}function F(n){return function(u){if(this.l){var t=this.l[u.type+n];if(null==u.t)u.t=c$1++;else if(u.t<t.u)return;return t(l$1.event?l$1.event(u):u)}}}function O(n,u,t,i,r,o,e,f,c,s){var a,h,p,v,y,_,m,b,S,C,M,$,P,A,H,L,T,j=u.type;if(null!=u.constructor)return null;128&t.__u&&(c=!!(32&t.__u),o=[f=u.__e=t.__e]),(a=l$1.__b)&&a(u);n:if("function"==typeof j)try{if(b=u.props,S="prototype"in j&&j.prototype.render,C=(a=j.contextType)&&i[a.__c],M=a?C?C.props.value:a.__:i,t.__c?m=(h=u.__c=t.__c).__=h.__E:(S?u.__c=h=new j(b,M):(u.__c=h=new x(b,M),h.constructor=j,h.render=E),C&&C.sub(h),h.state||(h.state={}),h.__n=i,p=h.__d=!0,h.__h=[],h._sb=[]),S&&null==h.__s&&(h.__s=h.state),S&&null!=j.getDerivedStateFromProps&&(h.__s==h.state&&(h.__s=d$1({},h.__s)),d$1(h.__s,j.getDerivedStateFromProps(b,h.__s))),v=h.props,y=h.state,h.__v=u,p)S&&null==j.getDerivedStateFromProps&&null!=h.componentWillMount&&h.componentWillMount(),S&&null!=h.componentDidMount&&h.__h.push(h.componentDidMount);else {if(S&&null==j.getDerivedStateFromProps&&b!==v&&null!=h.componentWillReceiveProps&&h.componentWillReceiveProps(b,M),u.__v==t.__v||!h.__e&&null!=h.shouldComponentUpdate&&!1===h.shouldComponentUpdate(b,h.__s,M)){for(u.__v!=t.__v&&(h.props=b,h.state=h.__s,h.__d=!1),u.__e=t.__e,u.__k=t.__k,u.__k.some(function(n){n&&(n.__=u);}),$=0;$<h._sb.length;$++)h.__h.push(h._sb[$]);h._sb=[],h.__h.length&&e.push(h);break n}null!=h.componentWillUpdate&&h.componentWillUpdate(b,h.__s,M),S&&null!=h.componentDidUpdate&&h.__h.push(function(){h.componentDidUpdate(v,y,_);});}if(h.context=M,h.props=b,h.__P=n,h.__e=!1,P=l$1.__r,A=0,S){for(h.state=h.__s,h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),H=0;H<h._sb.length;H++)h.__h.push(h._sb[H]);h._sb=[];}else do{h.__d=!1,P&&P(u),a=h.render(h.props,h.state,h.context),h.state=h.__s;}while(h.__d&&++A<25);h.state=h.__s,null!=h.getChildContext&&(i=d$1(d$1({},i),h.getChildContext())),S&&!p&&null!=h.getSnapshotBeforeUpdate&&(_=h.getSnapshotBeforeUpdate(v,y)),L=a,null!=a&&a.type===k$1&&null==a.key&&(L=V(a.props.children)),f=I(n,w$1(L)?L:[L],u,t,i,r,o,e,f,c,s),h.base=u.__e,u.__u&=-161,h.__h.length&&e.push(h),m&&(h.__E=h.__=null);}catch(n){if(u.__v=null,c||null!=o)if(n.then){for(u.__u|=c?160:128;f&&8==f.nodeType&&f.nextSibling;)f=f.nextSibling;o[o.indexOf(f)]=null,u.__e=f;}else {for(T=o.length;T--;)g(o[T]);z$1(u);}else u.__e=t.__e,u.__k=t.__k,n.then||z$1(u);l$1.__e(n,u,t);}else null==o&&u.__v==t.__v?(u.__k=t.__k,u.__e=t.__e):f=u.__e=q(t.__e,u,t,i,r,o,e,c,s);return (a=l$1.diffed)&&a(u),128&u.__u?void 0:f}function z$1(n){n&&n.__c&&(n.__c.__e=true),n&&n.__k&&n.__k.forEach(z$1);}function N(n,u,t){for(var i=0;i<t.length;i++)B$1(t[i],t[++i],t[++i]);l$1.__c&&l$1.__c(u,n),n.some(function(u){try{n=u.__h,u.__h=[],n.some(function(n){n.call(u);});}catch(n){l$1.__e(n,u.__v);}});}function V(n){return "object"!=typeof n||null==n||n.__b&&n.__b>0?n:w$1(n)?n.map(V):d$1({},n)}function q(u,t,i,r,o,e,f,c,s){var a,h,v,y,d,_,m,b=i.props||p$1,k=t.props,x=t.type;if("svg"==x?o="http://www.w3.org/2000/svg":"math"==x?o="http://www.w3.org/1998/Math/MathML":o||(o="http://www.w3.org/1999/xhtml"),null!=e)for(a=0;a<e.length;a++)if((d=e[a])&&"setAttribute"in d==!!x&&(x?d.localName==x:3==d.nodeType)){u=d,e[a]=null;break}if(null==u){if(null==x)return document.createTextNode(k);u=document.createElementNS(o,x,k.is&&k),c&&(l$1.__m&&l$1.__m(t,e),c=false),e=null;}if(null==x)b===k||c&&u.data==k||(u.data=k);else {if(e=e&&n.call(u.childNodes),!c&&null!=e)for(b={},a=0;a<u.attributes.length;a++)b[(d=u.attributes[a]).name]=d.value;for(a in b)if(d=b[a],"children"==a);else if("dangerouslySetInnerHTML"==a)v=d;else if(!(a in k)){if("value"==a&&"defaultValue"in k||"checked"==a&&"defaultChecked"in k)continue;j$1(u,a,null,d,o);}for(a in k)d=k[a],"children"==a?y=d:"dangerouslySetInnerHTML"==a?h=d:"value"==a?_=d:"checked"==a?m=d:c&&"function"!=typeof d||b[a]===d||j$1(u,a,d,b[a],o);if(h)c||v&&(h.__html==v.__html||h.__html==u.innerHTML)||(u.innerHTML=h.__html),t.__k=[];else if(v&&(u.innerHTML=""),I("template"==t.type?u.content:u,w$1(y)?y:[y],t,i,r,"foreignObject"==x?"http://www.w3.org/1999/xhtml":o,e,f,e?e[0]:i.__k&&S(i,0),c,s),null!=e)for(a=e.length;a--;)g(e[a]);c||(a="value","progress"==x&&null==_?u.removeAttribute("value"):null!=_&&(_!==u[a]||"progress"==x&&!_||"option"==x&&_!=b[a])&&j$1(u,a,_,b[a],o),a="checked",null!=m&&m!=u[a]&&j$1(u,a,m,b[a],o));}return u}function B$1(n,u,t){try{if("function"==typeof n){var i="function"==typeof n.__u;i&&n.__u(),i&&null==u||(n.__u=n(u));}else n.current=u;}catch(n){l$1.__e(n,t);}}function D$1(n,u,t){var i,r;if(l$1.unmount&&l$1.unmount(n),(i=n.ref)&&(i.current&&i.current!=n.__e||B$1(i,null,u)),null!=(i=n.__c)){if(i.componentWillUnmount)try{i.componentWillUnmount();}catch(n){l$1.__e(n,u);}i.base=i.__P=null;}if(i=n.__k)for(r=0;r<i.length;r++)i[r]&&D$1(i[r],u,t||"function"!=typeof n.type);t||g(n.__e),n.__c=n.__=n.__e=void 0;}function E(n,l,u){return this.constructor(n,u)}function G(u,t,i){var r,o,e,f;t==document&&(t=document.documentElement),l$1.__&&l$1.__(u,t),o=(r="function"=="undefined")?null:t.__k,e=[],f=[],O(t,u=(t).__k=_$1(k$1,null,[u]),o||p$1,p$1,t.namespaceURI,o?null:t.firstChild?n.call(t.childNodes):null,e,o?o.__e:t.firstChild,r,f),N(e,u,f);}n=v$1.slice,l$1={__e:function(n,l,u,t){for(var i,r,o;l=l.__;)if((i=l.__c)&&!i.__)try{if((r=i.constructor)&&null!=r.getDerivedStateFromError&&(i.setState(r.getDerivedStateFromError(n)),o=i.__d),null!=i.componentDidCatch&&(i.componentDidCatch(n,t||{}),o=i.__d),o)return i.__E=i}catch(l){n=l;}throw n}},u$1=0,x.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!=this.state?this.__s:this.__s=d$1({},this.state),"function"==typeof n&&(n=n(d$1({},u),this.props)),n&&d$1(u,n),null!=n&&this.__v&&(l&&this._sb.push(l),M(this));},x.prototype.forceUpdate=function(n){this.__v&&(this.__e=true,n&&this.__h.push(n),M(this));},x.prototype.render=k$1,i$1=[],o$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,e$1=function(n,l){return n.__v.__b-l.__v.__b},$.__r=0,f$1=/(PointerCapture)$|Capture$/i,c$1=0,s$1=F(false),a$1=F(true);
|
|
5294
5674
|
|
|
5295
5675
|
const Styles = {
|
|
5296
|
-
Error: {
|
|
5297
|
-
color: "red",
|
|
5298
|
-
},
|
|
5299
5676
|
Alert: {
|
|
5300
5677
|
error: {
|
|
5301
5678
|
color: "red",
|
|
@@ -5410,17 +5787,110 @@ const Styles = {
|
|
|
5410
5787
|
color: "#333",
|
|
5411
5788
|
borderBottom: "1px solid #eee",
|
|
5412
5789
|
paddingBottom: "10px"
|
|
5790
|
+
},
|
|
5791
|
+
// OAuth Provider Button Styles
|
|
5792
|
+
ProviderButton: {
|
|
5793
|
+
display: "flex",
|
|
5794
|
+
alignItems: "center",
|
|
5795
|
+
justifyContent: "center",
|
|
5796
|
+
width: "100%",
|
|
5797
|
+
padding: "12px 16px",
|
|
5798
|
+
marginBottom: "10px",
|
|
5799
|
+
border: "1px solid #d1d5db",
|
|
5800
|
+
borderRadius: "6px",
|
|
5801
|
+
backgroundColor: "#ffffff",
|
|
5802
|
+
cursor: "pointer",
|
|
5803
|
+
fontSize: "14px",
|
|
5804
|
+
fontWeight: "500",
|
|
5805
|
+
color: "#374151",
|
|
5806
|
+
transition: "all 0.2s ease",
|
|
5807
|
+
gap: "12px"
|
|
5808
|
+
},
|
|
5809
|
+
ProviderButtonIcon: {
|
|
5810
|
+
width: "20px",
|
|
5811
|
+
height: "20px",
|
|
5812
|
+
flexShrink: 0
|
|
5813
|
+
},
|
|
5814
|
+
ProviderButtonText: {
|
|
5815
|
+
flex: 1,
|
|
5816
|
+
textAlign: "left"
|
|
5817
|
+
},
|
|
5818
|
+
// Provider-specific colors
|
|
5819
|
+
ProviderGoogle: {
|
|
5820
|
+
backgroundColor: "#ffffff",
|
|
5821
|
+
border: "1px solid #dadce0",
|
|
5822
|
+
color: "#3c4043"
|
|
5823
|
+
},
|
|
5824
|
+
ProviderGitHub: {
|
|
5825
|
+
backgroundColor: "#24292e",
|
|
5826
|
+
border: "1px solid #24292e",
|
|
5827
|
+
color: "#ffffff"
|
|
5828
|
+
},
|
|
5829
|
+
ProviderMicrosoft: {
|
|
5830
|
+
backgroundColor: "#ffffff",
|
|
5831
|
+
border: "1px solid #8c8c8c",
|
|
5832
|
+
color: "#5e5e5e"
|
|
5833
|
+
},
|
|
5834
|
+
ProviderApple: {
|
|
5835
|
+
backgroundColor: "#000000",
|
|
5836
|
+
border: "1px solid #000000",
|
|
5837
|
+
color: "#ffffff"
|
|
5838
|
+
},
|
|
5839
|
+
ProviderCustom: {
|
|
5840
|
+
backgroundColor: "#4f46e5",
|
|
5841
|
+
border: "1px solid #4f46e5",
|
|
5842
|
+
color: "#ffffff"
|
|
5843
|
+
},
|
|
5844
|
+
// Divider styles
|
|
5845
|
+
Divider: {
|
|
5846
|
+
display: "flex",
|
|
5847
|
+
alignItems: "center",
|
|
5848
|
+
margin: "20px 0",
|
|
5849
|
+
color: "#6b7280",
|
|
5850
|
+
fontSize: "13px"
|
|
5851
|
+
},
|
|
5852
|
+
DividerLine: {
|
|
5853
|
+
flex: 1,
|
|
5854
|
+
height: "1px",
|
|
5855
|
+
backgroundColor: "#e5e7eb"
|
|
5856
|
+
},
|
|
5857
|
+
DividerText: {
|
|
5858
|
+
padding: "0 12px",
|
|
5859
|
+
color: "#9ca3af"
|
|
5860
|
+
},
|
|
5861
|
+
// OTP Button (Continue with email)
|
|
5862
|
+
OtpButton: {
|
|
5863
|
+
display: "flex",
|
|
5864
|
+
alignItems: "center",
|
|
5865
|
+
justifyContent: "center",
|
|
5866
|
+
width: "100%",
|
|
5867
|
+
padding: "12px 16px",
|
|
5868
|
+
border: "1px solid #d1d5db",
|
|
5869
|
+
borderRadius: "6px",
|
|
5870
|
+
backgroundColor: "#f9fafb",
|
|
5871
|
+
cursor: "pointer",
|
|
5872
|
+
fontSize: "14px",
|
|
5873
|
+
fontWeight: "500",
|
|
5874
|
+
color: "#374151",
|
|
5875
|
+
transition: "all 0.2s ease",
|
|
5876
|
+
gap: "12px"
|
|
5877
|
+
},
|
|
5878
|
+
// Cancel button for provider selection
|
|
5879
|
+
CancelButtonRow: {
|
|
5880
|
+
display: "flex",
|
|
5881
|
+
justifyContent: "center",
|
|
5882
|
+
marginTop: "16px"
|
|
5413
5883
|
}
|
|
5414
5884
|
};
|
|
5415
5885
|
|
|
5416
5886
|
function Dialog({ children, className }) {
|
|
5417
|
-
return (
|
|
5418
|
-
|
|
5419
|
-
|
|
5420
|
-
|
|
5887
|
+
return (_$1("div", { className: `dexie-dialog ${className || ''}` },
|
|
5888
|
+
_$1("div", { style: Styles.Darken }),
|
|
5889
|
+
_$1("div", { style: Styles.DialogOuter },
|
|
5890
|
+
_$1("div", { style: Styles.DialogInner }, children))));
|
|
5421
5891
|
}
|
|
5422
5892
|
|
|
5423
|
-
var t,r,u,i,o=0,
|
|
5893
|
+
var t,r,u,i,o=0,f=[],c=l$1,e=c.__b,a=c.__r,v=c.diffed,l=c.__c,m=c.unmount,s=c.__;function p(n,t){c.__h&&c.__h(r,n,o||t),o=0;var u=r.__H||(r.__H={__:[],__h:[]});return n>=u.__.length&&u.__.push({}),u.__[n]}function d(n){return o=1,h(D,n)}function h(n,u,i){var o=p(t++,2);if(o.t=n,!o.__c&&(o.__=[D(void 0,u),function(n){var t=o.__N?o.__N[0]:o.__[0],r=o.t(t,n);t!==r&&(o.__N=[r,o.__[1]],o.__c.setState({}));}],o.__c=r,!r.__f)){var f=function(n,t,r){if(!o.__c.__H)return true;var u=o.__c.__H.__.filter(function(n){return !!n.__c});if(u.every(function(n){return !n.__N}))return !c||c.call(this,n,t,r);var i=o.__c.props!==n;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=true);}}),c&&c.call(this,n,t,r)||i};r.__f=true;var c=r.shouldComponentUpdate,e=r.componentWillUpdate;r.componentWillUpdate=function(n,t,r){if(this.__e){var u=c;c=void 0,f(n,t,r),c=u;}e&&e.call(this,n,t,r);},r.shouldComponentUpdate=f;}return o.__N||o.__}function _(n,u){var i=p(t++,4);!c.__s&&C(i.__H,u)&&(i.__=n,i.u=u,r.__h.push(i));}function A(n){return o=5,T(function(){return {current:n}},[])}function T(n,r){var u=p(t++,7);return C(u.__H,r)&&(u.__=n(),u.__H=r,u.__h=n),u.__}function j(){for(var n;n=f.shift();)if(n.__P&&n.__H)try{n.__H.__h.forEach(z),n.__H.__h.forEach(B),n.__H.__h=[];}catch(t){n.__H.__h=[],c.__e(t,n.__v);}}c.__b=function(n){r=null,e&&e(n);},c.__=function(n,t){n&&t.__k&&t.__k.__m&&(n.__m=t.__k.__m),s&&s(n,t);},c.__r=function(n){a&&a(n),t=0;var i=(r=n.__c).__H;i&&(u===r?(i.__h=[],r.__h=[],i.__.forEach(function(n){n.__N&&(n.__=n.__N),n.u=n.__N=void 0;})):(i.__h.forEach(z),i.__h.forEach(B),i.__h=[],t=0)),u=r;},c.diffed=function(n){v&&v(n);var t=n.__c;t&&t.__H&&(t.__H.__h.length&&(1!==f.push(t)&&i===c.requestAnimationFrame||((i=c.requestAnimationFrame)||w)(j)),t.__H.__.forEach(function(n){n.u&&(n.__H=n.u),n.u=void 0;})),u=r=null;},c.__c=function(n,t){t.some(function(n){try{n.__h.forEach(z),n.__h=n.__h.filter(function(n){return !n.__||B(n)});}catch(r){t.some(function(n){n.__h&&(n.__h=[]);}),t=[],c.__e(r,n.__v);}}),l&&l(n,t);},c.unmount=function(n){m&&m(n);var t,r=n.__c;r&&r.__H&&(r.__H.__.forEach(function(n){try{z(n);}catch(n){t=n;}}),r.__H=void 0,t&&c.__e(t,r.__v));};var k="function"==typeof requestAnimationFrame;function w(n){var t,r=function(){clearTimeout(u),k&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,35);k&&(t=requestAnimationFrame(r));}function z(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function B(n){var t=r;n.__c=n.__(),r=t;}function C(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function D(n,t){return "function"==typeof t?t(n):t}
|
|
5424
5894
|
|
|
5425
5895
|
/** Resolve a message template with parameters.
|
|
5426
5896
|
*
|
|
@@ -5442,19 +5912,19 @@ function resolveText({ message, messageCode, messageParams }) {
|
|
|
5442
5912
|
|
|
5443
5913
|
const OTP_LENGTH = 8;
|
|
5444
5914
|
function LoginDialog({ title, type, alerts, fields, submitLabel, cancelLabel, onCancel, onSubmit, }) {
|
|
5445
|
-
const [params, setParams] =
|
|
5446
|
-
const firstFieldRef =
|
|
5447
|
-
|
|
5448
|
-
return (
|
|
5449
|
-
|
|
5450
|
-
|
|
5451
|
-
alerts.map((alert) => (
|
|
5452
|
-
|
|
5915
|
+
const [params, setParams] = d({});
|
|
5916
|
+
const firstFieldRef = A(null);
|
|
5917
|
+
_(() => { var _a; return (_a = firstFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
|
|
5918
|
+
return (_$1(Dialog, { className: "dxc-login-dlg" },
|
|
5919
|
+
_$1(k$1, null,
|
|
5920
|
+
_$1("h3", { style: Styles.WindowHeader }, title),
|
|
5921
|
+
alerts.map((alert) => (_$1("p", { style: Styles.Alert[alert.type] }, resolveText(alert)))),
|
|
5922
|
+
_$1("form", { onSubmit: (ev) => {
|
|
5453
5923
|
ev.preventDefault();
|
|
5454
5924
|
onSubmit(params);
|
|
5455
|
-
} }, Object.entries(fields).map(([fieldName, { type, label, placeholder }], idx) => (
|
|
5925
|
+
} }, Object.entries(fields).map(([fieldName, { type, label, placeholder }], idx) => (_$1("label", { style: Styles.Label, key: idx },
|
|
5456
5926
|
label ? `${label}: ` : '',
|
|
5457
|
-
|
|
5927
|
+
_$1("input", { ref: idx === 0 ? firstFieldRef : undefined, type: type, name: fieldName, autoComplete: "on", style: Styles.Input, autoFocus: true, placeholder: placeholder, value: params[fieldName] || '', onInput: (ev) => {
|
|
5458
5928
|
var _a;
|
|
5459
5929
|
const value = valueTransformer(type, (_a = ev.target) === null || _a === void 0 ? void 0 : _a['value']);
|
|
5460
5930
|
let updatedParams = Object.assign(Object.assign({}, params), { [fieldName]: value });
|
|
@@ -5464,10 +5934,10 @@ function LoginDialog({ title, type, alerts, fields, submitLabel, cancelLabel, on
|
|
|
5464
5934
|
onSubmit(updatedParams);
|
|
5465
5935
|
}
|
|
5466
5936
|
} })))))),
|
|
5467
|
-
|
|
5468
|
-
|
|
5469
|
-
|
|
5470
|
-
cancelLabel && (
|
|
5937
|
+
_$1("div", { style: Styles.ButtonsDiv },
|
|
5938
|
+
_$1(k$1, null,
|
|
5939
|
+
_$1("button", { type: "submit", style: Styles.PrimaryButton, onClick: () => onSubmit(params) }, submitLabel),
|
|
5940
|
+
cancelLabel && (_$1("button", { style: Styles.Button, onClick: onCancel }, cancelLabel))))));
|
|
5471
5941
|
}
|
|
5472
5942
|
function valueTransformer(type, value) {
|
|
5473
5943
|
switch (type) {
|
|
@@ -5480,7 +5950,83 @@ function valueTransformer(type, value) {
|
|
|
5480
5950
|
}
|
|
5481
5951
|
}
|
|
5482
5952
|
|
|
5483
|
-
|
|
5953
|
+
/** Default SVG icons for built-in providers */
|
|
5954
|
+
const ProviderIcons = {
|
|
5955
|
+
google: `<svg viewBox="0 0 24 24" width="20" height="20"><path fill="#4285F4" d="M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z"/><path fill="#34A853" d="M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z"/><path fill="#FBBC05" d="M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z"/><path fill="#EA4335" d="M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z"/></svg>`,
|
|
5956
|
+
github: `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M12 0C5.37 0 0 5.37 0 12c0 5.31 3.435 9.795 8.205 11.385.6.105.825-.255.825-.57 0-.285-.015-1.23-.015-2.235-3.015.555-3.795-.735-4.035-1.41-.135-.345-.72-1.41-1.23-1.695-.42-.225-1.02-.78-.015-.795.945-.015 1.62.87 1.845 1.23 1.08 1.815 2.805 1.305 3.495.99.105-.78.42-1.305.765-1.605-2.67-.3-5.46-1.335-5.46-5.925 0-1.305.465-2.385 1.23-3.225-.12-.3-.54-1.53.12-3.18 0 0 1.005-.315 3.3 1.23.96-.27 1.98-.405 3-.405s2.04.135 3 .405c2.295-1.56 3.3-1.23 3.3-1.23.66 1.65.24 2.88.12 3.18.765.84 1.23 1.905 1.23 3.225 0 4.605-2.805 5.625-5.475 5.925.435.375.81 1.095.81 2.22 0 1.605-.015 2.895-.015 3.3 0 .315.225.69.825.57A12.02 12.02 0 0024 12c0-6.63-5.37-12-12-12z"/></svg>`,
|
|
5957
|
+
microsoft: `<svg viewBox="0 0 24 24" width="20" height="20"><rect fill="#F25022" x="1" y="1" width="10" height="10"/><rect fill="#00A4EF" x="1" y="13" width="10" height="10"/><rect fill="#7FBA00" x="13" y="1" width="10" height="10"/><rect fill="#FFB900" x="13" y="13" width="10" height="10"/></svg>`,
|
|
5958
|
+
apple: `<svg viewBox="0 0 24 24" width="20" height="20" fill="currentColor"><path d="M18.71 19.5c-.83 1.24-1.71 2.45-3.05 2.47-1.34.03-1.77-.79-3.29-.79-1.53 0-2 .77-3.27.82-1.31.05-2.3-1.32-3.14-2.53C4.25 17 2.94 12.45 4.7 9.39c.87-1.52 2.43-2.48 4.12-2.51 1.28-.02 2.5.87 3.29.87.78 0 2.26-1.07 3.81-.91.65.03 2.47.26 3.64 1.98-.09.06-2.17 1.28-2.15 3.81.03 3.02 2.65 4.03 2.68 4.04-.03.07-.42 1.44-1.38 2.83M13 3.5c.73-.83 1.94-1.46 2.94-1.5.13 1.17-.34 2.35-1.04 3.19-.69.85-1.83 1.51-2.95 1.42-.15-1.15.41-2.35 1.05-3.11z"/></svg>`,
|
|
5959
|
+
};
|
|
5960
|
+
/** Get provider-specific button styles */
|
|
5961
|
+
function getProviderStyle(providerType) {
|
|
5962
|
+
const baseStyle = Object.assign({}, Styles.ProviderButton);
|
|
5963
|
+
switch (providerType) {
|
|
5964
|
+
case 'google':
|
|
5965
|
+
return Object.assign(Object.assign({}, baseStyle), Styles.ProviderGoogle);
|
|
5966
|
+
case 'github':
|
|
5967
|
+
return Object.assign(Object.assign({}, baseStyle), Styles.ProviderGitHub);
|
|
5968
|
+
case 'microsoft':
|
|
5969
|
+
return Object.assign(Object.assign({}, baseStyle), Styles.ProviderMicrosoft);
|
|
5970
|
+
case 'apple':
|
|
5971
|
+
return Object.assign(Object.assign({}, baseStyle), Styles.ProviderApple);
|
|
5972
|
+
default:
|
|
5973
|
+
return Object.assign(Object.assign({}, baseStyle), Styles.ProviderCustom);
|
|
5974
|
+
}
|
|
5975
|
+
}
|
|
5976
|
+
/**
|
|
5977
|
+
* Button component for OAuth provider login.
|
|
5978
|
+
* Displays the provider's icon and name following provider branding guidelines.
|
|
5979
|
+
*/
|
|
5980
|
+
function AuthProviderButton({ provider, onClick }) {
|
|
5981
|
+
const { type, name, displayName, iconUrl } = provider;
|
|
5982
|
+
const style = getProviderStyle(type);
|
|
5983
|
+
// Determine button text
|
|
5984
|
+
const buttonText = `Continue with ${displayName}`;
|
|
5985
|
+
// Get icon - use custom iconUrl if provided, otherwise use built-in SVG
|
|
5986
|
+
const iconSvg = ProviderIcons[type] || '';
|
|
5987
|
+
return (_$1("button", { type: "button", style: style, onClick: onClick, class: `dxc-provider-btn dxc-provider-${type}`, "aria-label": buttonText },
|
|
5988
|
+
iconUrl ? (_$1("img", { src: iconUrl, alt: "", style: Styles.ProviderButtonIcon, "aria-hidden": "true" })) : iconSvg ? (_$1("span", { style: Styles.ProviderButtonIcon, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: iconSvg } })) : null,
|
|
5989
|
+
_$1("span", { style: Styles.ProviderButtonText }, buttonText)));
|
|
5990
|
+
}
|
|
5991
|
+
/** Email/envelope icon for OTP button */
|
|
5992
|
+
const EmailIcon = `<svg viewBox="0 0 24 24" width="20" height="20" fill="none" stroke="currentColor" stroke-width="2"><rect x="2" y="4" width="20" height="16" rx="2"/><path d="M22 6L12 13 2 6"/></svg>`;
|
|
5993
|
+
/**
|
|
5994
|
+
* Button for email/OTP authentication option.
|
|
5995
|
+
*/
|
|
5996
|
+
function OtpButton({ onClick }) {
|
|
5997
|
+
return (_$1("button", { type: "button", style: Styles.OtpButton, onClick: onClick, class: "dxc-otp-btn", "aria-label": "Continue with email" },
|
|
5998
|
+
_$1("span", { style: Styles.ProviderButtonIcon, "aria-hidden": "true", dangerouslySetInnerHTML: { __html: EmailIcon } }),
|
|
5999
|
+
_$1("span", { style: Styles.ProviderButtonText }, "Continue with email")));
|
|
6000
|
+
}
|
|
6001
|
+
/**
|
|
6002
|
+
* Visual divider with "or" text.
|
|
6003
|
+
*/
|
|
6004
|
+
function Divider() {
|
|
6005
|
+
return (_$1("div", { style: Styles.Divider },
|
|
6006
|
+
_$1("div", { style: Styles.DividerLine }),
|
|
6007
|
+
_$1("span", { style: Styles.DividerText }, "or"),
|
|
6008
|
+
_$1("div", { style: Styles.DividerLine })));
|
|
6009
|
+
}
|
|
6010
|
+
|
|
6011
|
+
/**
|
|
6012
|
+
* Dialog component for OAuth provider selection.
|
|
6013
|
+
* Displays available OAuth providers as buttons and optionally an email/OTP option.
|
|
6014
|
+
*/
|
|
6015
|
+
function ProviderSelectionDialog({ title, alerts, providers, otpEnabled, cancelLabel, onSelectProvider, onSelectOtp, onCancel, }) {
|
|
6016
|
+
return (_$1(Dialog, { className: "dxc-provider-selection-dlg" },
|
|
6017
|
+
_$1(k$1, null,
|
|
6018
|
+
_$1("h3", { style: Styles.WindowHeader }, title),
|
|
6019
|
+
alerts.map((alert, idx) => (_$1("p", { key: idx, style: Styles.Alert[alert.type] }, resolveText(alert)))),
|
|
6020
|
+
_$1("div", { class: "dxc-providers" }, providers.map((provider) => (_$1(AuthProviderButton, { key: provider.name, provider: provider, onClick: () => onSelectProvider(provider.name) })))),
|
|
6021
|
+
otpEnabled && providers.length > 0 && (_$1(k$1, null,
|
|
6022
|
+
_$1(Divider, null),
|
|
6023
|
+
_$1(OtpButton, { onClick: onSelectOtp }))),
|
|
6024
|
+
otpEnabled && providers.length === 0 && (_$1(OtpButton, { onClick: onSelectOtp })),
|
|
6025
|
+
cancelLabel && (_$1("div", { style: Styles.CancelButtonRow },
|
|
6026
|
+
_$1("button", { type: "button", style: Styles.Button, onClick: onCancel }, cancelLabel))))));
|
|
6027
|
+
}
|
|
6028
|
+
|
|
6029
|
+
class LoginGui extends x {
|
|
5484
6030
|
constructor(props) {
|
|
5485
6031
|
super(props);
|
|
5486
6032
|
this.observer = (userInteraction) => this.setState({ userInteraction });
|
|
@@ -5498,8 +6044,12 @@ class LoginGui extends d$1 {
|
|
|
5498
6044
|
render(props, { userInteraction }) {
|
|
5499
6045
|
if (!userInteraction)
|
|
5500
6046
|
return null;
|
|
5501
|
-
//
|
|
5502
|
-
|
|
6047
|
+
// Render appropriate dialog based on interaction type
|
|
6048
|
+
if (userInteraction.type === 'provider-selection') {
|
|
6049
|
+
return _$1(ProviderSelectionDialog, Object.assign({}, userInteraction));
|
|
6050
|
+
}
|
|
6051
|
+
// Default to LoginDialog for other interaction types
|
|
6052
|
+
return _$1(LoginDialog, Object.assign({}, userInteraction));
|
|
5503
6053
|
}
|
|
5504
6054
|
}
|
|
5505
6055
|
function setupDefaultGUI(db) {
|
|
@@ -5507,13 +6057,13 @@ function setupDefaultGUI(db) {
|
|
|
5507
6057
|
const el = document.createElement('div');
|
|
5508
6058
|
if (document.body) {
|
|
5509
6059
|
document.body.appendChild(el);
|
|
5510
|
-
|
|
6060
|
+
G(_$1(LoginGui, { db: db.vip }), el);
|
|
5511
6061
|
}
|
|
5512
6062
|
else {
|
|
5513
6063
|
addEventListener('DOMContentLoaded', () => {
|
|
5514
6064
|
if (!closed) {
|
|
5515
6065
|
document.body.appendChild(el);
|
|
5516
|
-
|
|
6066
|
+
G(_$1(LoginGui, { db: db.vip }), el);
|
|
5517
6067
|
}
|
|
5518
6068
|
});
|
|
5519
6069
|
}
|
|
@@ -6268,7 +6818,7 @@ function dexieCloud(dexie) {
|
|
|
6268
6818
|
const syncComplete = new Subject();
|
|
6269
6819
|
dexie.cloud = {
|
|
6270
6820
|
// @ts-ignore
|
|
6271
|
-
version: "4.
|
|
6821
|
+
version: "4.3.0",
|
|
6272
6822
|
options: Object.assign({}, DEFAULT_OPTIONS),
|
|
6273
6823
|
schema: null,
|
|
6274
6824
|
get currentUserId() {
|
|
@@ -6585,7 +7135,7 @@ function dexieCloud(dexie) {
|
|
|
6585
7135
|
}
|
|
6586
7136
|
}
|
|
6587
7137
|
// @ts-ignore
|
|
6588
|
-
dexieCloud.version = "4.
|
|
7138
|
+
dexieCloud.version = "4.3.0";
|
|
6589
7139
|
Dexie.Cloud = dexieCloud;
|
|
6590
7140
|
|
|
6591
7141
|
export { dexieCloud as default, defineYDocTrigger, dexieCloud, getTiedObjectId, getTiedRealmId, resolveText };
|