dexie-cloud-addon 4.0.0-beta.21 → 4.0.0-beta.23

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.
@@ -8,7 +8,7 @@
8
8
  *
9
9
  * ==========================================================================
10
10
  *
11
- * Version 4.0.0-beta.21, Tue Jun 07 2022
11
+ * Version 4.0.0-beta.23, Mon Oct 17 2022
12
12
  *
13
13
  * https://dexie.org
14
14
  *
@@ -19,7 +19,7 @@
19
19
  import Dexie, { cmp, liveQuery } from 'dexie';
20
20
  import { Observable as Observable$1, BehaviorSubject, Subject, fromEvent, of, merge, Subscription as Subscription$1, from as from$1, throwError, combineLatest, map as map$1, share, timer as timer$1, switchMap as switchMap$1 } from 'rxjs';
21
21
 
22
- /*! *****************************************************************************
22
+ /******************************************************************************
23
23
  Copyright (c) Microsoft Corporation.
24
24
 
25
25
  Permission to use, copy, modify, and/or distribute this software for any
@@ -33,8 +33,24 @@ LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
33
33
  OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
34
34
  PERFORMANCE OF THIS SOFTWARE.
35
35
  ***************************************************************************** */
36
+ /* global Reflect, Promise */
37
+
38
+ var extendStatics = function(d, b) {
39
+ extendStatics = Object.setPrototypeOf ||
40
+ ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
41
+ function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
42
+ return extendStatics(d, b);
43
+ };
44
+
45
+ function __extends(d, b) {
46
+ if (typeof b !== "function" && b !== null)
47
+ throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
48
+ extendStatics(d, b);
49
+ function __() { this.constructor = d; }
50
+ d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
51
+ }
36
52
 
37
- function __awaiter$1(thisArg, _arguments, P, generator) {
53
+ function __awaiter(thisArg, _arguments, P, generator) {
38
54
  function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
39
55
  return new (P || (P = Promise))(function (resolve, reject) {
40
56
  function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
@@ -42,6 +58,97 @@ function __awaiter$1(thisArg, _arguments, P, generator) {
42
58
  function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
43
59
  step((generator = generator.apply(thisArg, _arguments || [])).next());
44
60
  });
61
+ }
62
+
63
+ function __generator(thisArg, body) {
64
+ var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
65
+ return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
66
+ function verb(n) { return function (v) { return step([n, v]); }; }
67
+ function step(op) {
68
+ if (f) throw new TypeError("Generator is already executing.");
69
+ while (_) try {
70
+ if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
71
+ if (y = 0, t) op = [op[0] & 2, t.value];
72
+ switch (op[0]) {
73
+ case 0: case 1: t = op; break;
74
+ case 4: _.label++; return { value: op[1], done: false };
75
+ case 5: _.label++; y = op[1]; op = [0]; continue;
76
+ case 7: op = _.ops.pop(); _.trys.pop(); continue;
77
+ default:
78
+ if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
79
+ if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
80
+ if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
81
+ if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
82
+ if (t[2]) _.ops.pop();
83
+ _.trys.pop(); continue;
84
+ }
85
+ op = body.call(thisArg, _);
86
+ } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
87
+ if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
88
+ }
89
+ }
90
+
91
+ function __values(o) {
92
+ var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
93
+ if (m) return m.call(o);
94
+ if (o && typeof o.length === "number") return {
95
+ next: function () {
96
+ if (o && i >= o.length) o = void 0;
97
+ return { value: o && o[i++], done: !o };
98
+ }
99
+ };
100
+ throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
101
+ }
102
+
103
+ function __read(o, n) {
104
+ var m = typeof Symbol === "function" && o[Symbol.iterator];
105
+ if (!m) return o;
106
+ var i = m.call(o), r, ar = [], e;
107
+ try {
108
+ while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
109
+ }
110
+ catch (error) { e = { error: error }; }
111
+ finally {
112
+ try {
113
+ if (r && !r.done && (m = i["return"])) m.call(i);
114
+ }
115
+ finally { if (e) throw e.error; }
116
+ }
117
+ return ar;
118
+ }
119
+
120
+ function __spreadArray(to, from, pack) {
121
+ if (pack || arguments.length === 2) for (var i = 0, l = from.length, ar; i < l; i++) {
122
+ if (ar || !(i in from)) {
123
+ if (!ar) ar = Array.prototype.slice.call(from, 0, i);
124
+ ar[i] = from[i];
125
+ }
126
+ }
127
+ return to.concat(ar || Array.prototype.slice.call(from));
128
+ }
129
+
130
+ function __await(v) {
131
+ return this instanceof __await ? (this.v = v, this) : new __await(v);
132
+ }
133
+
134
+ function __asyncGenerator(thisArg, _arguments, generator) {
135
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
136
+ var g = generator.apply(thisArg, _arguments || []), i, q = [];
137
+ return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
138
+ function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
139
+ function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
140
+ function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
141
+ function fulfill(value) { resume("next", value); }
142
+ function reject(value) { resume("throw", value); }
143
+ function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
144
+ }
145
+
146
+ function __asyncValues(o) {
147
+ if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
148
+ var m = o[Symbol.asyncIterator], i;
149
+ 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);
150
+ 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); }); }; }
151
+ function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
45
152
  }
46
153
 
47
154
  //@ts-check
@@ -51,6 +158,10 @@ function assert(b) {
51
158
  if (!b)
52
159
  throw new Error('Assertion Failed');
53
160
  }
161
+ const _hasOwn = {}.hasOwnProperty;
162
+ function hasOwn(obj, prop) {
163
+ return _hasOwn.call(obj, prop);
164
+ }
54
165
  function setByKeyPath(obj, keyPath, value) {
55
166
  if (!obj || keyPath === undefined)
56
167
  return;
@@ -83,8 +194,8 @@ function setByKeyPath(obj, keyPath, value) {
83
194
  //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.
84
195
  var innerObj = obj[currentKeyPath];
85
196
  //@ts-ignore: even if currentKeyPath would be numeric string and obj would be array - it works.
86
- if (!innerObj)
87
- innerObj = obj[currentKeyPath] = {};
197
+ if (!innerObj || !hasOwn(obj, currentKeyPath))
198
+ innerObj = (obj[currentKeyPath] = {});
88
199
  setByKeyPath(innerObj, remainingKeyPath, value);
89
200
  }
90
201
  }
@@ -103,7 +214,7 @@ function setByKeyPath(obj, keyPath, value) {
103
214
  }
104
215
  }
105
216
  }
106
- const randomString$1 = typeof self === 'undefined' ? (bytes) => {
217
+ const randomString$1 = typeof Buffer !== 'undefined' ? (bytes) => {
107
218
  // Node
108
219
  const buf = Buffer.alloc(bytes);
109
220
  randomFillSync(buf);
@@ -364,134 +475,6 @@ function operate(init) {
364
475
  };
365
476
  }
366
477
 
367
- /*! *****************************************************************************
368
- Copyright (c) Microsoft Corporation.
369
-
370
- Permission to use, copy, modify, and/or distribute this software for any
371
- purpose with or without fee is hereby granted.
372
-
373
- THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH
374
- REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY
375
- AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT,
376
- INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
377
- LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
378
- OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
379
- PERFORMANCE OF THIS SOFTWARE.
380
- ***************************************************************************** */
381
- /* global Reflect, Promise */
382
-
383
- var extendStatics = function(d, b) {
384
- extendStatics = Object.setPrototypeOf ||
385
- ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
386
- function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
387
- return extendStatics(d, b);
388
- };
389
-
390
- function __extends(d, b) {
391
- if (typeof b !== "function" && b !== null)
392
- throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
393
- extendStatics(d, b);
394
- function __() { this.constructor = d; }
395
- d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
396
- }
397
-
398
- function __awaiter(thisArg, _arguments, P, generator) {
399
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
400
- return new (P || (P = Promise))(function (resolve, reject) {
401
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
402
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
403
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
404
- step((generator = generator.apply(thisArg, _arguments || [])).next());
405
- });
406
- }
407
-
408
- function __generator(thisArg, body) {
409
- var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
410
- return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
411
- function verb(n) { return function (v) { return step([n, v]); }; }
412
- function step(op) {
413
- if (f) throw new TypeError("Generator is already executing.");
414
- while (_) try {
415
- if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
416
- if (y = 0, t) op = [op[0] & 2, t.value];
417
- switch (op[0]) {
418
- case 0: case 1: t = op; break;
419
- case 4: _.label++; return { value: op[1], done: false };
420
- case 5: _.label++; y = op[1]; op = [0]; continue;
421
- case 7: op = _.ops.pop(); _.trys.pop(); continue;
422
- default:
423
- if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
424
- if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
425
- if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
426
- if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
427
- if (t[2]) _.ops.pop();
428
- _.trys.pop(); continue;
429
- }
430
- op = body.call(thisArg, _);
431
- } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
432
- if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
433
- }
434
- }
435
-
436
- function __values(o) {
437
- var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
438
- if (m) return m.call(o);
439
- if (o && typeof o.length === "number") return {
440
- next: function () {
441
- if (o && i >= o.length) o = void 0;
442
- return { value: o && o[i++], done: !o };
443
- }
444
- };
445
- throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
446
- }
447
-
448
- function __read(o, n) {
449
- var m = typeof Symbol === "function" && o[Symbol.iterator];
450
- if (!m) return o;
451
- var i = m.call(o), r, ar = [], e;
452
- try {
453
- while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
454
- }
455
- catch (error) { e = { error: error }; }
456
- finally {
457
- try {
458
- if (r && !r.done && (m = i["return"])) m.call(i);
459
- }
460
- finally { if (e) throw e.error; }
461
- }
462
- return ar;
463
- }
464
-
465
- function __spreadArray(to, from) {
466
- for (var i = 0, il = from.length, j = to.length; i < il; i++, j++)
467
- to[j] = from[i];
468
- return to;
469
- }
470
-
471
- function __await(v) {
472
- return this instanceof __await ? (this.v = v, this) : new __await(v);
473
- }
474
-
475
- function __asyncGenerator(thisArg, _arguments, generator) {
476
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
477
- var g = generator.apply(thisArg, _arguments || []), i, q = [];
478
- return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
479
- function verb(n) { if (g[n]) i[n] = function (v) { return new Promise(function (a, b) { q.push([n, v, a, b]) > 1 || resume(n, v); }); }; }
480
- function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
481
- function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
482
- function fulfill(value) { resume("next", value); }
483
- function reject(value) { resume("throw", value); }
484
- function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
485
- }
486
-
487
- function __asyncValues(o) {
488
- if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
489
- var m = o[Symbol.asyncIterator], i;
490
- 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);
491
- 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); }); }; }
492
- function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
493
- }
494
-
495
478
  var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
496
479
 
497
480
  function isPromise(value) {
@@ -532,7 +515,7 @@ var Subscription = (function () {
532
515
  this.initialTeardown = initialTeardown;
533
516
  this.closed = false;
534
517
  this._parentage = null;
535
- this._teardowns = null;
518
+ this._finalizers = null;
536
519
  }
537
520
  Subscription.prototype.unsubscribe = function () {
538
521
  var e_1, _a, e_2, _b;
@@ -561,23 +544,23 @@ var Subscription = (function () {
561
544
  _parentage.remove(this);
562
545
  }
563
546
  }
564
- var initialTeardown = this.initialTeardown;
565
- if (isFunction(initialTeardown)) {
547
+ var initialFinalizer = this.initialTeardown;
548
+ if (isFunction(initialFinalizer)) {
566
549
  try {
567
- initialTeardown();
550
+ initialFinalizer();
568
551
  }
569
552
  catch (e) {
570
553
  errors = e instanceof UnsubscriptionError ? e.errors : [e];
571
554
  }
572
555
  }
573
- var _teardowns = this._teardowns;
574
- if (_teardowns) {
575
- this._teardowns = null;
556
+ var _finalizers = this._finalizers;
557
+ if (_finalizers) {
558
+ this._finalizers = null;
576
559
  try {
577
- for (var _teardowns_1 = __values(_teardowns), _teardowns_1_1 = _teardowns_1.next(); !_teardowns_1_1.done; _teardowns_1_1 = _teardowns_1.next()) {
578
- var teardown_1 = _teardowns_1_1.value;
560
+ for (var _finalizers_1 = __values(_finalizers), _finalizers_1_1 = _finalizers_1.next(); !_finalizers_1_1.done; _finalizers_1_1 = _finalizers_1.next()) {
561
+ var finalizer = _finalizers_1_1.value;
579
562
  try {
580
- execTeardown(teardown_1);
563
+ execFinalizer(finalizer);
581
564
  }
582
565
  catch (err) {
583
566
  errors = errors !== null && errors !== void 0 ? errors : [];
@@ -593,7 +576,7 @@ var Subscription = (function () {
593
576
  catch (e_2_1) { e_2 = { error: e_2_1 }; }
594
577
  finally {
595
578
  try {
596
- if (_teardowns_1_1 && !_teardowns_1_1.done && (_b = _teardowns_1.return)) _b.call(_teardowns_1);
579
+ if (_finalizers_1_1 && !_finalizers_1_1.done && (_b = _finalizers_1.return)) _b.call(_finalizers_1);
597
580
  }
598
581
  finally { if (e_2) throw e_2.error; }
599
582
  }
@@ -607,7 +590,7 @@ var Subscription = (function () {
607
590
  var _a;
608
591
  if (teardown && teardown !== this) {
609
592
  if (this.closed) {
610
- execTeardown(teardown);
593
+ execFinalizer(teardown);
611
594
  }
612
595
  else {
613
596
  if (teardown instanceof Subscription) {
@@ -616,7 +599,7 @@ var Subscription = (function () {
616
599
  }
617
600
  teardown._addParent(this);
618
601
  }
619
- (this._teardowns = (_a = this._teardowns) !== null && _a !== void 0 ? _a : []).push(teardown);
602
+ (this._finalizers = (_a = this._finalizers) !== null && _a !== void 0 ? _a : []).push(teardown);
620
603
  }
621
604
  }
622
605
  };
@@ -638,8 +621,8 @@ var Subscription = (function () {
638
621
  }
639
622
  };
640
623
  Subscription.prototype.remove = function (teardown) {
641
- var _teardowns = this._teardowns;
642
- _teardowns && arrRemove(_teardowns, teardown);
624
+ var _finalizers = this._finalizers;
625
+ _finalizers && arrRemove(_finalizers, teardown);
643
626
  if (teardown instanceof Subscription) {
644
627
  teardown._removeParent(this);
645
628
  }
@@ -651,16 +634,17 @@ var Subscription = (function () {
651
634
  })();
652
635
  return Subscription;
653
636
  }());
637
+ Subscription.EMPTY;
654
638
  function isSubscription(value) {
655
639
  return (value instanceof Subscription ||
656
640
  (value && 'closed' in value && isFunction(value.remove) && isFunction(value.add) && isFunction(value.unsubscribe)));
657
641
  }
658
- function execTeardown(teardown) {
659
- if (isFunction(teardown)) {
660
- teardown();
642
+ function execFinalizer(finalizer) {
643
+ if (isFunction(finalizer)) {
644
+ finalizer();
661
645
  }
662
646
  else {
663
- teardown.unsubscribe();
647
+ finalizer.unsubscribe();
664
648
  }
665
649
  }
666
650
 
@@ -673,13 +657,16 @@ var config = {
673
657
  };
674
658
 
675
659
  var timeoutProvider = {
676
- setTimeout: function () {
660
+ setTimeout: function (handler, timeout) {
677
661
  var args = [];
678
- for (var _i = 0; _i < arguments.length; _i++) {
679
- args[_i] = arguments[_i];
662
+ for (var _i = 2; _i < arguments.length; _i++) {
663
+ args[_i - 2] = arguments[_i];
680
664
  }
681
665
  var delegate = timeoutProvider.delegate;
682
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) || setTimeout).apply(void 0, __spreadArray([], __read(args)));
666
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setTimeout) {
667
+ return delegate.setTimeout.apply(delegate, __spreadArray([handler, timeout], __read(args)));
668
+ }
669
+ return setTimeout.apply(void 0, __spreadArray([handler, timeout], __read(args)));
683
670
  },
684
671
  clearTimeout: function (handle) {
685
672
  var delegate = timeoutProvider.delegate;
@@ -690,7 +677,11 @@ var timeoutProvider = {
690
677
 
691
678
  function reportUnhandledError(err) {
692
679
  timeoutProvider.setTimeout(function () {
693
- {
680
+ var onUnhandledError = config.onUnhandledError;
681
+ if (onUnhandledError) {
682
+ onUnhandledError(err);
683
+ }
684
+ else {
694
685
  throw err;
695
686
  }
696
687
  });
@@ -715,14 +706,22 @@ function createNotification(kind, value, error) {
715
706
 
716
707
  var context = null;
717
708
  function errorContext(cb) {
718
- {
709
+ if (config.useDeprecatedSynchronousErrorHandling) {
710
+ var isRoot = !context;
711
+ if (isRoot) {
712
+ context = { errorThrown: false, error: null };
713
+ }
719
714
  cb();
715
+ if (isRoot) {
716
+ var _a = context, errorThrown = _a.errorThrown, error = _a.error;
717
+ context = null;
718
+ if (errorThrown) {
719
+ throw error;
720
+ }
721
+ }
720
722
  }
721
- }
722
- function captureError(err) {
723
- if (config.useDeprecatedSynchronousErrorHandling && context) {
724
- context.errorThrown = true;
725
- context.error = err;
723
+ else {
724
+ cb();
726
725
  }
727
726
  }
728
727
 
@@ -799,55 +798,88 @@ var Subscriber = (function (_super) {
799
798
  };
800
799
  return Subscriber;
801
800
  }(Subscription));
801
+ var _bind = Function.prototype.bind;
802
+ function bind(fn, thisArg) {
803
+ return _bind.call(fn, thisArg);
804
+ }
805
+ var ConsumerObserver = (function () {
806
+ function ConsumerObserver(partialObserver) {
807
+ this.partialObserver = partialObserver;
808
+ }
809
+ ConsumerObserver.prototype.next = function (value) {
810
+ var partialObserver = this.partialObserver;
811
+ if (partialObserver.next) {
812
+ try {
813
+ partialObserver.next(value);
814
+ }
815
+ catch (error) {
816
+ handleUnhandledError(error);
817
+ }
818
+ }
819
+ };
820
+ ConsumerObserver.prototype.error = function (err) {
821
+ var partialObserver = this.partialObserver;
822
+ if (partialObserver.error) {
823
+ try {
824
+ partialObserver.error(err);
825
+ }
826
+ catch (error) {
827
+ handleUnhandledError(error);
828
+ }
829
+ }
830
+ else {
831
+ handleUnhandledError(err);
832
+ }
833
+ };
834
+ ConsumerObserver.prototype.complete = function () {
835
+ var partialObserver = this.partialObserver;
836
+ if (partialObserver.complete) {
837
+ try {
838
+ partialObserver.complete();
839
+ }
840
+ catch (error) {
841
+ handleUnhandledError(error);
842
+ }
843
+ }
844
+ };
845
+ return ConsumerObserver;
846
+ }());
802
847
  var SafeSubscriber = (function (_super) {
803
848
  __extends(SafeSubscriber, _super);
804
849
  function SafeSubscriber(observerOrNext, error, complete) {
805
850
  var _this = _super.call(this) || this;
806
- var next;
807
- if (isFunction(observerOrNext)) {
808
- next = observerOrNext;
851
+ var partialObserver;
852
+ if (isFunction(observerOrNext) || !observerOrNext) {
853
+ partialObserver = {
854
+ next: (observerOrNext !== null && observerOrNext !== void 0 ? observerOrNext : undefined),
855
+ error: error !== null && error !== void 0 ? error : undefined,
856
+ complete: complete !== null && complete !== void 0 ? complete : undefined,
857
+ };
809
858
  }
810
- else if (observerOrNext) {
811
- (next = observerOrNext.next, error = observerOrNext.error, complete = observerOrNext.complete);
859
+ else {
812
860
  var context_1;
813
861
  if (_this && config.useDeprecatedNextContext) {
814
862
  context_1 = Object.create(observerOrNext);
815
863
  context_1.unsubscribe = function () { return _this.unsubscribe(); };
864
+ partialObserver = {
865
+ next: observerOrNext.next && bind(observerOrNext.next, context_1),
866
+ error: observerOrNext.error && bind(observerOrNext.error, context_1),
867
+ complete: observerOrNext.complete && bind(observerOrNext.complete, context_1),
868
+ };
816
869
  }
817
870
  else {
818
- context_1 = observerOrNext;
871
+ partialObserver = observerOrNext;
819
872
  }
820
- next = next === null || next === void 0 ? void 0 : next.bind(context_1);
821
- error = error === null || error === void 0 ? void 0 : error.bind(context_1);
822
- complete = complete === null || complete === void 0 ? void 0 : complete.bind(context_1);
823
873
  }
824
- _this.destination = {
825
- next: next ? wrapForErrorHandling(next) : noop,
826
- error: wrapForErrorHandling(error !== null && error !== void 0 ? error : defaultErrorHandler),
827
- complete: complete ? wrapForErrorHandling(complete) : noop,
828
- };
874
+ _this.destination = new ConsumerObserver(partialObserver);
829
875
  return _this;
830
876
  }
831
877
  return SafeSubscriber;
832
878
  }(Subscriber));
833
- function wrapForErrorHandling(handler, instance) {
834
- return function () {
835
- var args = [];
836
- for (var _i = 0; _i < arguments.length; _i++) {
837
- args[_i] = arguments[_i];
838
- }
839
- try {
840
- handler.apply(void 0, __spreadArray([], __read(args)));
841
- }
842
- catch (err) {
843
- if (config.useDeprecatedSynchronousErrorHandling) {
844
- captureError(err);
845
- }
846
- else {
847
- reportUnhandledError(err);
848
- }
849
- }
850
- };
879
+ function handleUnhandledError(error) {
880
+ {
881
+ reportUnhandledError(error);
882
+ }
851
883
  }
852
884
  function defaultErrorHandler(err) {
853
885
  throw err;
@@ -921,16 +953,20 @@ var Observable = (function () {
921
953
  var _this = this;
922
954
  promiseCtor = getPromiseCtor(promiseCtor);
923
955
  return new promiseCtor(function (resolve, reject) {
924
- var subscription;
925
- subscription = _this.subscribe(function (value) {
926
- try {
927
- next(value);
928
- }
929
- catch (err) {
930
- reject(err);
931
- subscription === null || subscription === void 0 ? void 0 : subscription.unsubscribe();
932
- }
933
- }, reject, resolve);
956
+ var subscriber = new SafeSubscriber({
957
+ next: function (value) {
958
+ try {
959
+ next(value);
960
+ }
961
+ catch (err) {
962
+ reject(err);
963
+ subscriber.unsubscribe();
964
+ }
965
+ },
966
+ error: reject,
967
+ complete: resolve,
968
+ });
969
+ _this.subscribe(subscriber);
934
970
  });
935
971
  };
936
972
  Observable.prototype._subscribe = function (subscriber) {
@@ -1162,11 +1198,15 @@ function process(asyncIterable, subscriber) {
1162
1198
  });
1163
1199
  }
1164
1200
 
1201
+ function createOperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
1202
+ return new OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize);
1203
+ }
1165
1204
  var OperatorSubscriber = (function (_super) {
1166
1205
  __extends(OperatorSubscriber, _super);
1167
- function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize) {
1206
+ function OperatorSubscriber(destination, onNext, onComplete, onError, onFinalize, shouldUnsubscribe) {
1168
1207
  var _this = _super.call(this, destination) || this;
1169
1208
  _this.onFinalize = onFinalize;
1209
+ _this.shouldUnsubscribe = shouldUnsubscribe;
1170
1210
  _this._next = onNext
1171
1211
  ? function (value) {
1172
1212
  try {
@@ -1207,9 +1247,11 @@ var OperatorSubscriber = (function (_super) {
1207
1247
  }
1208
1248
  OperatorSubscriber.prototype.unsubscribe = function () {
1209
1249
  var _a;
1210
- var closed = this.closed;
1211
- _super.prototype.unsubscribe.call(this);
1212
- !closed && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
1250
+ if (!this.shouldUnsubscribe || this.shouldUnsubscribe()) {
1251
+ var closed_1 = this.closed;
1252
+ _super.prototype.unsubscribe.call(this);
1253
+ !closed_1 && ((_a = this.onFinalize) === null || _a === void 0 ? void 0 : _a.call(this));
1254
+ }
1213
1255
  };
1214
1256
  return OperatorSubscriber;
1215
1257
  }(Subscriber));
@@ -1226,13 +1268,16 @@ var Action = (function (_super) {
1226
1268
  }(Subscription));
1227
1269
 
1228
1270
  var intervalProvider = {
1229
- setInterval: function () {
1271
+ setInterval: function (handler, timeout) {
1230
1272
  var args = [];
1231
- for (var _i = 0; _i < arguments.length; _i++) {
1232
- args[_i] = arguments[_i];
1273
+ for (var _i = 2; _i < arguments.length; _i++) {
1274
+ args[_i - 2] = arguments[_i];
1233
1275
  }
1234
1276
  var delegate = intervalProvider.delegate;
1235
- return ((delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) || setInterval).apply(void 0, __spreadArray([], __read(args)));
1277
+ if (delegate === null || delegate === void 0 ? void 0 : delegate.setInterval) {
1278
+ return delegate.setInterval.apply(delegate, __spreadArray([handler, timeout], __read(args)));
1279
+ }
1280
+ return setInterval.apply(void 0, __spreadArray([handler, timeout], __read(args)));
1236
1281
  },
1237
1282
  clearInterval: function (handle) {
1238
1283
  var delegate = intervalProvider.delegate;
@@ -1451,7 +1496,7 @@ function catchError(selector) {
1451
1496
  var innerSub = null;
1452
1497
  var syncUnsub = false;
1453
1498
  var handledResult;
1454
- innerSub = source.subscribe(new OperatorSubscriber(subscriber, undefined, undefined, function (err) {
1499
+ innerSub = source.subscribe(createOperatorSubscriber(subscriber, undefined, undefined, function (err) {
1455
1500
  handledResult = innerFrom(selector(err, catchError(selector)(source)));
1456
1501
  if (innerSub) {
1457
1502
  innerSub.unsubscribe();
@@ -1473,7 +1518,7 @@ function catchError(selector) {
1473
1518
  function observeOn(scheduler, delay) {
1474
1519
  if (delay === void 0) { delay = 0; }
1475
1520
  return operate(function (source, subscriber) {
1476
- source.subscribe(new OperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
1521
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) { return executeSchedule(subscriber, scheduler, function () { return subscriber.next(value); }, delay); }, function () { return executeSchedule(subscriber, scheduler, function () { return subscriber.complete(); }, delay); }, function (err) { return executeSchedule(subscriber, scheduler, function () { return subscriber.error(err); }, delay); }));
1477
1522
  });
1478
1523
  }
1479
1524
 
@@ -1593,13 +1638,13 @@ function from(input, scheduler) {
1593
1638
  function map(project, thisArg) {
1594
1639
  return operate(function (source, subscriber) {
1595
1640
  var index = 0;
1596
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1641
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1597
1642
  subscriber.next(project.call(thisArg, value, index++));
1598
1643
  }));
1599
1644
  });
1600
1645
  }
1601
1646
 
1602
- function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalTeardown) {
1647
+ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, expand, innerSubScheduler, additionalFinalizer) {
1603
1648
  var buffer = [];
1604
1649
  var active = 0;
1605
1650
  var index = 0;
@@ -1614,7 +1659,7 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
1614
1659
  expand && subscriber.next(value);
1615
1660
  active++;
1616
1661
  var innerComplete = false;
1617
- innerFrom(project(value, index++)).subscribe(new OperatorSubscriber(subscriber, function (innerValue) {
1662
+ innerFrom(project(value, index++)).subscribe(createOperatorSubscriber(subscriber, function (innerValue) {
1618
1663
  onBeforeNext === null || onBeforeNext === void 0 ? void 0 : onBeforeNext(innerValue);
1619
1664
  if (expand) {
1620
1665
  outerNext(innerValue);
@@ -1648,12 +1693,12 @@ function mergeInternals(source, subscriber, project, concurrent, onBeforeNext, e
1648
1693
  }
1649
1694
  }));
1650
1695
  };
1651
- source.subscribe(new OperatorSubscriber(subscriber, outerNext, function () {
1696
+ source.subscribe(createOperatorSubscriber(subscriber, outerNext, function () {
1652
1697
  isComplete = true;
1653
1698
  checkComplete();
1654
1699
  }));
1655
1700
  return function () {
1656
- additionalTeardown === null || additionalTeardown === void 0 ? void 0 : additionalTeardown();
1701
+ additionalFinalizer === null || additionalFinalizer === void 0 ? void 0 : additionalFinalizer();
1657
1702
  };
1658
1703
  }
1659
1704
 
@@ -1702,7 +1747,7 @@ function debounceTime(dueTime, scheduler) {
1702
1747
  }
1703
1748
  emit();
1704
1749
  }
1705
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1750
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1706
1751
  lastValue = value;
1707
1752
  lastTime = scheduler.now();
1708
1753
  if (!activeTask) {
@@ -1734,7 +1779,7 @@ function take(count) {
1734
1779
  function () { return EMPTY; }
1735
1780
  : operate(function (source, subscriber) {
1736
1781
  var seen = 0;
1737
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1782
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1738
1783
  if (++seen <= count) {
1739
1784
  subscriber.next(value);
1740
1785
  if (count <= seen) {
@@ -1747,7 +1792,7 @@ function take(count) {
1747
1792
 
1748
1793
  function ignoreElements() {
1749
1794
  return operate(function (source, subscriber) {
1750
- source.subscribe(new OperatorSubscriber(subscriber, noop));
1795
+ source.subscribe(createOperatorSubscriber(subscriber, noop));
1751
1796
  });
1752
1797
  }
1753
1798
 
@@ -1776,7 +1821,7 @@ function distinctUntilChanged(comparator, keySelector) {
1776
1821
  return operate(function (source, subscriber) {
1777
1822
  var previousKey;
1778
1823
  var first = true;
1779
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1824
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1780
1825
  var currentKey = keySelector(value);
1781
1826
  if (first || !comparator(previousKey, currentKey)) {
1782
1827
  first = false;
@@ -1793,7 +1838,7 @@ function defaultCompare(a, b) {
1793
1838
  function filter(predicate, thisArg) {
1794
1839
  return operate(function (source, subscriber) {
1795
1840
  var index = 0;
1796
- source.subscribe(new OperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
1841
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) { return predicate.call(thisArg, value, index++) && subscriber.next(value); }));
1797
1842
  });
1798
1843
  }
1799
1844
 
@@ -1818,11 +1863,11 @@ function switchMap(project, resultSelector) {
1818
1863
  var index = 0;
1819
1864
  var isComplete = false;
1820
1865
  var checkComplete = function () { return isComplete && !innerSubscriber && subscriber.complete(); };
1821
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1866
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1822
1867
  innerSubscriber === null || innerSubscriber === void 0 ? void 0 : innerSubscriber.unsubscribe();
1823
1868
  var innerIndex = 0;
1824
1869
  var outerIndex = index++;
1825
- innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = new OperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
1870
+ innerFrom(project(value, outerIndex)).subscribe((innerSubscriber = createOperatorSubscriber(subscriber, function (innerValue) { return subscriber.next(resultSelector ? resultSelector(value, innerValue, outerIndex, innerIndex++) : innerValue); }, function () {
1826
1871
  innerSubscriber = null;
1827
1872
  checkComplete();
1828
1873
  })));
@@ -1843,7 +1888,7 @@ function tap(observerOrNext, error, complete) {
1843
1888
  var _a;
1844
1889
  (_a = tapObserver.subscribe) === null || _a === void 0 ? void 0 : _a.call(tapObserver);
1845
1890
  var isUnsub = true;
1846
- source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1891
+ source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1847
1892
  var _a;
1848
1893
  (_a = tapObserver.next) === null || _a === void 0 ? void 0 : _a.call(tapObserver, value);
1849
1894
  subscriber.next(value);
@@ -1879,11 +1924,7 @@ var TimeoutError = createErrorClass(function (_super) {
1879
1924
  };
1880
1925
  });
1881
1926
  function timeout(config, schedulerArg) {
1882
- var _a = (isValidDate(config)
1883
- ? { first: config }
1884
- : typeof config === 'number'
1885
- ? { each: config }
1886
- : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
1927
+ var _a = (isValidDate(config) ? { first: config } : typeof config === 'number' ? { each: config } : config), first = _a.first, each = _a.each, _b = _a.with, _with = _b === void 0 ? timeoutErrorFactory : _b, _c = _a.scheduler, scheduler = _c === void 0 ? schedulerArg !== null && schedulerArg !== void 0 ? schedulerArg : asyncScheduler : _c, _d = _a.meta, meta = _d === void 0 ? null : _d;
1887
1928
  if (first == null && each == null) {
1888
1929
  throw new TypeError('No timeout provided.');
1889
1930
  }
@@ -1907,7 +1948,7 @@ function timeout(config, schedulerArg) {
1907
1948
  }
1908
1949
  }, delay);
1909
1950
  };
1910
- originalSourceSubscription = source.subscribe(new OperatorSubscriber(subscriber, function (value) {
1951
+ originalSourceSubscription = source.subscribe(createOperatorSubscriber(subscriber, function (value) {
1911
1952
  timerSubscription === null || timerSubscription === void 0 ? void 0 : timerSubscription.unsubscribe();
1912
1953
  seen++;
1913
1954
  subscriber.next((lastValue = value));
@@ -1918,7 +1959,7 @@ function timeout(config, schedulerArg) {
1918
1959
  }
1919
1960
  lastValue = null;
1920
1961
  }));
1921
- startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
1962
+ !seen && startTimer(first != null ? (typeof first === 'number' ? first : +first - scheduler.now()) : each);
1922
1963
  });
1923
1964
  }
1924
1965
  function timeoutErrorFactory(info) {
@@ -1928,7 +1969,7 @@ function timeoutErrorFactory(info) {
1928
1969
  //const hasSW = 'serviceWorker' in navigator;
1929
1970
  let hasComplainedAboutSyncEvent = false;
1930
1971
  function registerSyncEvent(db, purpose) {
1931
- return __awaiter$1(this, void 0, void 0, function* () {
1972
+ return __awaiter(this, void 0, void 0, function* () {
1932
1973
  try {
1933
1974
  // Send sync event to SW:
1934
1975
  const sw = yield navigator.serviceWorker.ready;
@@ -1959,7 +2000,7 @@ function registerSyncEvent(db, purpose) {
1959
2000
  }
1960
2001
  function registerPeriodicSyncEvent(db) {
1961
2002
  var _a;
1962
- return __awaiter$1(this, void 0, void 0, function* () {
2003
+ return __awaiter(this, void 0, void 0, function* () {
1963
2004
  try {
1964
2005
  // Register periodicSync event to SW:
1965
2006
  // @ts-ignore
@@ -2004,21 +2045,25 @@ const b64decode = typeof Buffer !== "undefined"
2004
2045
  return bytes;
2005
2046
  };
2006
2047
  const b64encode = typeof Buffer !== "undefined"
2007
- ? (b) => ArrayBuffer.isView(b)
2008
- ? Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("base64")
2009
- : Buffer.from(b).toString("base64")
2010
- : (b) => btoa(String.fromCharCode.apply(null, b));
2048
+ ? (b) => {
2049
+ if (ArrayBuffer.isView(b)) {
2050
+ return Buffer.from(b.buffer, b.byteOffset, b.byteLength).toString("base64");
2051
+ }
2052
+ else {
2053
+ return Buffer.from(b).toString("base64");
2054
+ }
2055
+ }
2056
+ : (b) => {
2057
+ return btoa(String.fromCharCode.apply(null, ArrayBuffer.isView(b) ? b : new Uint8Array(b)));
2058
+ };
2011
2059
 
2012
2060
  function interactWithUser(userInteraction, req) {
2013
- let done = false;
2014
2061
  return new Promise((resolve, reject) => {
2015
2062
  const interactionProps = Object.assign(Object.assign({}, req), { onSubmit: (res) => {
2016
2063
  userInteraction.next(undefined);
2017
- done = true;
2018
2064
  resolve(res);
2019
2065
  }, onCancel: () => {
2020
2066
  userInteraction.next(undefined);
2021
- done = true;
2022
2067
  reject(new Dexie.AbortError("User cancelled"));
2023
2068
  } });
2024
2069
  userInteraction.next(interactionProps);
@@ -2042,7 +2087,7 @@ function alertUser(userInteraction, title, ...alerts) {
2042
2087
  });
2043
2088
  }
2044
2089
  function promptForEmail(userInteraction, title, emailHint) {
2045
- return __awaiter$1(this, void 0, void 0, function* () {
2090
+ return __awaiter(this, void 0, void 0, function* () {
2046
2091
  let email = emailHint || '';
2047
2092
  while (!email || !/^[\w-\.]+@([\w-]+\.)+[\w-]{2,10}$/.test(email)) {
2048
2093
  email = (yield interactWithUser(userInteraction, {
@@ -2070,7 +2115,7 @@ function promptForEmail(userInteraction, title, emailHint) {
2070
2115
  });
2071
2116
  }
2072
2117
  function promptForOTP(userInteraction, email, alert) {
2073
- return __awaiter$1(this, void 0, void 0, function* () {
2118
+ return __awaiter(this, void 0, void 0, function* () {
2074
2119
  const alerts = [
2075
2120
  {
2076
2121
  type: 'info',
@@ -2100,7 +2145,7 @@ function promptForOTP(userInteraction, email, alert) {
2100
2145
 
2101
2146
  function loadAccessToken(db) {
2102
2147
  var _a, _b;
2103
- return __awaiter$1(this, void 0, void 0, function* () {
2148
+ return __awaiter(this, void 0, void 0, function* () {
2104
2149
  const currentUser = yield db.getCurrentUser();
2105
2150
  const { accessToken, accessTokenExpiration, refreshToken, refreshTokenExpiration, claims, } = currentUser;
2106
2151
  if (!accessToken)
@@ -2125,7 +2170,7 @@ function loadAccessToken(db) {
2125
2170
  });
2126
2171
  }
2127
2172
  function authenticate(url, context, fetchToken, userInteraction, hints) {
2128
- return __awaiter$1(this, void 0, void 0, function* () {
2173
+ return __awaiter(this, void 0, void 0, function* () {
2129
2174
  if (context.accessToken &&
2130
2175
  context.accessTokenExpiration.getTime() > Date.now()) {
2131
2176
  return context;
@@ -2141,7 +2186,7 @@ function authenticate(url, context, fetchToken, userInteraction, hints) {
2141
2186
  });
2142
2187
  }
2143
2188
  function refreshAccessToken(url, login) {
2144
- return __awaiter$1(this, void 0, void 0, function* () {
2189
+ return __awaiter(this, void 0, void 0, function* () {
2145
2190
  if (!login.refreshToken)
2146
2191
  throw new Error(`Cannot refresh token - refresh token is missing.`);
2147
2192
  if (!login.nonExportablePrivateKey)
@@ -2177,7 +2222,7 @@ function refreshAccessToken(url, login) {
2177
2222
  });
2178
2223
  }
2179
2224
  function userAuthenticate(context, fetchToken, userInteraction, hints) {
2180
- return __awaiter$1(this, void 0, void 0, function* () {
2225
+ return __awaiter(this, void 0, void 0, function* () {
2181
2226
  const { privateKey, publicKey } = yield crypto.subtle.generateKey({
2182
2227
  name: 'RSASSA-PKCS1-v1_5',
2183
2228
  modulusLength: 2048,
@@ -2264,7 +2309,7 @@ class AuthPersistedContext {
2264
2309
  }));
2265
2310
  }
2266
2311
  save() {
2267
- return __awaiter$1(this, void 0, void 0, function* () {
2312
+ return __awaiter(this, void 0, void 0, function* () {
2268
2313
  const db = wm$1.get(this);
2269
2314
  db.table("$logins").put(this);
2270
2315
  });
@@ -2285,7 +2330,7 @@ function otpFetchTokenCallback(db) {
2285
2330
  const { userInteraction } = db.cloud;
2286
2331
  return function otpAuthenticate({ public_key, hints }) {
2287
2332
  var _a;
2288
- return __awaiter$1(this, void 0, void 0, function* () {
2333
+ return __awaiter(this, void 0, void 0, function* () {
2289
2334
  let tokenRequest;
2290
2335
  const url = (_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl;
2291
2336
  if (!url)
@@ -2387,11 +2432,11 @@ function otpFetchTokenCallback(db) {
2387
2432
  * @param newUser
2388
2433
  */
2389
2434
  function setCurrentUser(db, user) {
2390
- return __awaiter$1(this, void 0, void 0, function* () {
2435
+ return __awaiter(this, void 0, void 0, function* () {
2391
2436
  if (user.userId === db.cloud.currentUserId)
2392
2437
  return; // Already this user.
2393
2438
  const $logins = db.table('$logins');
2394
- yield db.transaction('rw', $logins, (tx) => __awaiter$1(this, void 0, void 0, function* () {
2439
+ yield db.transaction('rw', $logins, (tx) => __awaiter(this, void 0, void 0, function* () {
2395
2440
  const existingLogins = yield $logins.toArray();
2396
2441
  yield Promise.all(existingLogins
2397
2442
  .filter((login) => login.userId !== user.userId && login.isLoggedIn)
@@ -2442,7 +2487,7 @@ function setCurrentUser(db, user) {
2442
2487
  }
2443
2488
 
2444
2489
  function login(db, hints) {
2445
- return __awaiter$1(this, void 0, void 0, function* () {
2490
+ return __awaiter(this, void 0, void 0, function* () {
2446
2491
  const currentUser = yield db.getCurrentUser();
2447
2492
  if (currentUser.isLoggedIn) {
2448
2493
  if (hints) {
@@ -2575,7 +2620,7 @@ class BroadcastedAndLocalEvent extends Observable$1 {
2575
2620
  }
2576
2621
 
2577
2622
  function computeRealmSetHash({ realms, inviteRealms, }) {
2578
- return __awaiter$1(this, void 0, void 0, function* () {
2623
+ return __awaiter(this, void 0, void 0, function* () {
2579
2624
  const data = JSON.stringify([
2580
2625
  ...realms.map((realmId) => ({ realmId, accepted: true })),
2581
2626
  ...inviteRealms.map((realmId) => ({ realmId, accepted: false })),
@@ -2612,8 +2657,8 @@ function flatten(a) {
2612
2657
  }
2613
2658
 
2614
2659
  function listClientChanges(mutationTables, db, { since = {}, limit = Infinity } = {}) {
2615
- return __awaiter$1(this, void 0, void 0, function* () {
2616
- const allMutsOnTables = yield Promise.all(mutationTables.map((mutationTable) => __awaiter$1(this, void 0, void 0, function* () {
2660
+ return __awaiter(this, void 0, void 0, function* () {
2661
+ const allMutsOnTables = yield Promise.all(mutationTables.map((mutationTable) => __awaiter(this, void 0, void 0, function* () {
2617
2662
  const tableName = getTableFromMutationTable(mutationTable.name);
2618
2663
  const lastRevision = since[tableName];
2619
2664
  let query = lastRevision
@@ -2665,28 +2710,28 @@ function randomString(bytes) {
2665
2710
  }
2666
2711
 
2667
2712
  function listSyncifiedChanges(tablesToSyncify, currentUser, schema, alreadySyncedRealms) {
2668
- return __awaiter$1(this, void 0, void 0, function* () {
2713
+ return __awaiter(this, void 0, void 0, function* () {
2669
2714
  const txid = `upload-${randomString(8)}`;
2670
2715
  if (currentUser.isLoggedIn) {
2671
2716
  if (tablesToSyncify.length > 0) {
2672
2717
  const ignoredRealms = new Set(alreadySyncedRealms || []);
2673
- const upserts = yield Promise.all(tablesToSyncify.map((table) => __awaiter$1(this, void 0, void 0, function* () {
2718
+ const upserts = yield Promise.all(tablesToSyncify.map((table) => __awaiter(this, void 0, void 0, function* () {
2674
2719
  const { extractKey } = table.core.schema.primaryKey;
2675
2720
  if (!extractKey)
2676
2721
  return { table: table.name, muts: [] }; // Outbound tables are not synced.
2677
2722
  const dexieCloudTableSchema = schema[table.name];
2678
2723
  const query = (dexieCloudTableSchema === null || dexieCloudTableSchema === void 0 ? void 0 : dexieCloudTableSchema.generatedGlobalId)
2679
2724
  ? table.filter((item) => {
2680
- const id = extractKey(item);
2725
+ extractKey(item);
2681
2726
  return (!ignoredRealms.has(item.realmId || '') &&
2682
2727
  //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed
2683
- isValidSyncableID(id));
2728
+ isValidAtID(extractKey(item), dexieCloudTableSchema === null || dexieCloudTableSchema === void 0 ? void 0 : dexieCloudTableSchema.idPrefix));
2684
2729
  })
2685
2730
  : table.filter((item) => {
2686
- extractKey(item);
2731
+ const id = extractKey(item);
2687
2732
  return (!ignoredRealms.has(item.realmId || '') &&
2688
2733
  //(id[0] !== '#' || !!item.$ts) && // Private obj need no sync if not changed
2689
- isValidAtID(extractKey(item), dexieCloudTableSchema === null || dexieCloudTableSchema === void 0 ? void 0 : dexieCloudTableSchema.idPrefix));
2734
+ isValidSyncableID(id));
2690
2735
  });
2691
2736
  const unsyncedObjects = yield query.toArray();
2692
2737
  if (unsyncedObjects.length > 0) {
@@ -3305,7 +3350,7 @@ function cloneChange(change, rewriteValues) {
3305
3350
 
3306
3351
  //import {BisonWebStreamReader} from "dreambase-library/dist/typeson-simplified/BisonWebStreamReader";
3307
3352
  function syncWithServer(changes, syncState, baseRevs, db, databaseUrl, schema, clientIdentity, currentUser) {
3308
- return __awaiter$1(this, void 0, void 0, function* () {
3353
+ return __awaiter(this, void 0, void 0, function* () {
3309
3354
  //
3310
3355
  // Push changes to server using fetch
3311
3356
  //
@@ -3361,7 +3406,7 @@ function syncWithServer(changes, syncState, baseRevs, db, databaseUrl, schema, c
3361
3406
  }
3362
3407
 
3363
3408
  function modifyLocalObjectsWithNewUserId(syncifiedTables, currentUser, alreadySyncedRealms) {
3364
- return __awaiter$1(this, void 0, void 0, function* () {
3409
+ return __awaiter(this, void 0, void 0, function* () {
3365
3410
  const ignoredRealms = new Set(alreadySyncedRealms || []);
3366
3411
  for (const table of syncifiedTables) {
3367
3412
  if (table.name === "members") {
@@ -3411,7 +3456,7 @@ self.addEventListener('online', () => isOnline = true);
3411
3456
  self.addEventListener('offline', () => isOnline = false);
3412
3457
 
3413
3458
  function updateBaseRevs(db, schema, latestRevisions, serverRev) {
3414
- return __awaiter$1(this, void 0, void 0, function* () {
3459
+ return __awaiter(this, void 0, void 0, function* () {
3415
3460
  yield db.$baseRevs.bulkPut(Object.keys(schema)
3416
3461
  .filter((table) => schema[table].markedForSync)
3417
3462
  .map((tableName) => {
@@ -3434,7 +3479,7 @@ function getLatestRevisionsPerTable(clientChangeSet, lastRevisions = {}) {
3434
3479
  }
3435
3480
 
3436
3481
  function bulkUpdate(table, keys, changeSpecs) {
3437
- return __awaiter$1(this, void 0, void 0, function* () {
3482
+ return __awaiter(this, void 0, void 0, function* () {
3438
3483
  const objs = yield table.bulkGet(keys);
3439
3484
  const resultKeys = [];
3440
3485
  const resultObjs = [];
@@ -3462,7 +3507,7 @@ function bulkUpdate(table, keys, changeSpecs) {
3462
3507
  }
3463
3508
 
3464
3509
  function applyServerChanges(changes, db) {
3465
- return __awaiter$1(this, void 0, void 0, function* () {
3510
+ return __awaiter(this, void 0, void 0, function* () {
3466
3511
  console.debug('Applying server changes', changes, Dexie.currentTransaction);
3467
3512
  for (const { table: tableName, muts } of changes) {
3468
3513
  const table = db.table(tableName);
@@ -3548,7 +3593,7 @@ function sync(db, options, schema, syncOptions) {
3548
3593
  });
3549
3594
  }
3550
3595
  })
3551
- .catch((error) => __awaiter$1(this, void 0, void 0, function* () {
3596
+ .catch((error) => __awaiter(this, void 0, void 0, function* () {
3552
3597
  if (syncOptions === null || syncOptions === void 0 ? void 0 : syncOptions.justCheckIfNeeded)
3553
3598
  return Promise.reject(error); // Just rethrow.
3554
3599
  console.debug('Error from _sync', {
@@ -3585,7 +3630,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3585
3630
  isInitialSync: false,
3586
3631
  }) {
3587
3632
  var _a;
3588
- return __awaiter$1(this, void 0, void 0, function* () {
3633
+ return __awaiter(this, void 0, void 0, function* () {
3589
3634
  if (!justCheckIfNeeded) {
3590
3635
  console.debug('SYNC STARTED', { isInitialSync, purpose });
3591
3636
  }
@@ -3602,7 +3647,8 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3602
3647
  // Prepare for syncification by modifying locally unauthorized objects:
3603
3648
  //
3604
3649
  const persistedSyncState = yield db.getPersistedSyncState();
3605
- const tablesToSyncify = !isInitialSync && currentUser.isLoggedIn
3650
+ const readyForSyncification = !isInitialSync && currentUser.isLoggedIn;
3651
+ const tablesToSyncify = readyForSyncification
3606
3652
  ? getTablesToSyncify(db, persistedSyncState)
3607
3653
  : [];
3608
3654
  throwIfCancelled(cancelToken);
@@ -3611,7 +3657,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3611
3657
  if (justCheckIfNeeded)
3612
3658
  return true;
3613
3659
  //console.debug('sync doSyncify is true');
3614
- yield db.transaction('rw', tablesToSyncify, (tx) => __awaiter$1(this, void 0, void 0, function* () {
3660
+ yield db.transaction('rw', tablesToSyncify, (tx) => __awaiter(this, void 0, void 0, function* () {
3615
3661
  // @ts-ignore
3616
3662
  tx.idbtrans.disableChangeTracking = true;
3617
3663
  // @ts-ignore
@@ -3623,7 +3669,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3623
3669
  //
3624
3670
  // List changes to sync
3625
3671
  //
3626
- const [clientChangeSet, syncState, baseRevs] = yield db.transaction('r', db.tables, () => __awaiter$1(this, void 0, void 0, function* () {
3672
+ const [clientChangeSet, syncState, baseRevs] = yield db.transaction('r', db.tables, () => __awaiter(this, void 0, void 0, function* () {
3627
3673
  const syncState = yield db.getPersistedSyncState();
3628
3674
  const baseRevs = yield db.$baseRevs.toArray();
3629
3675
  let clientChanges = yield listClientChanges(mutationTables);
@@ -3660,7 +3706,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3660
3706
  //
3661
3707
  // Apply changes locally and clear old change entries:
3662
3708
  //
3663
- const done = yield db.transaction('rw', db.tables, (tx) => __awaiter$1(this, void 0, void 0, function* () {
3709
+ const done = yield db.transaction('rw', db.tables, (tx) => __awaiter(this, void 0, void 0, function* () {
3664
3710
  // @ts-ignore
3665
3711
  tx.idbtrans.disableChangeTracking = true;
3666
3712
  // @ts-ignore
@@ -3734,9 +3780,11 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3734
3780
  inviteRealms: [],
3735
3781
  clientIdentity,
3736
3782
  };
3737
- newSyncState.syncedTables = tablesToSync
3738
- .map((tbl) => tbl.name)
3739
- .concat(tablesToSyncify.map((tbl) => tbl.name));
3783
+ if (readyForSyncification) {
3784
+ newSyncState.syncedTables = tablesToSync
3785
+ .map((tbl) => tbl.name)
3786
+ .concat(tablesToSyncify.map((tbl) => tbl.name));
3787
+ }
3740
3788
  newSyncState.latestRevisions = latestRevisions;
3741
3789
  newSyncState.remoteDbId = res.dbId;
3742
3790
  newSyncState.initiallySynced = true;
@@ -3765,7 +3813,7 @@ function _sync(db, options, schema, { isInitialSync, cancelToken, justCheckIfNee
3765
3813
  });
3766
3814
  }
3767
3815
  function deleteObjectsFromRemovedRealms(db, res, prevState) {
3768
- return __awaiter$1(this, void 0, void 0, function* () {
3816
+ return __awaiter(this, void 0, void 0, function* () {
3769
3817
  const deletedRealms = new Set();
3770
3818
  const rejectedRealms = new Set();
3771
3819
  const previousRealmSet = prevState ? prevState.realms : [];
@@ -3829,7 +3877,7 @@ function MessagesFromServerConsumer(db) {
3829
3877
  let isWorking = false;
3830
3878
  let loopWarning = 0;
3831
3879
  let loopDetection = [0, 0, 0, 0, 0, 0, 0, 0, 0, Date.now()];
3832
- event.subscribe(() => __awaiter$1(this, void 0, void 0, function* () {
3880
+ event.subscribe(() => __awaiter(this, void 0, void 0, function* () {
3833
3881
  if (isWorking)
3834
3882
  return;
3835
3883
  if (queue.length > 0) {
@@ -3868,7 +3916,7 @@ function MessagesFromServerConsumer(db) {
3868
3916
  }
3869
3917
  function consumeQueue() {
3870
3918
  var _a, _b, _c;
3871
- return __awaiter$1(this, void 0, void 0, function* () {
3919
+ return __awaiter(this, void 0, void 0, function* () {
3872
3920
  while (queue.length > 0) {
3873
3921
  const msg = queue.shift();
3874
3922
  try {
@@ -3925,7 +3973,7 @@ function MessagesFromServerConsumer(db) {
3925
3973
  triggerSync(db, 'pull');
3926
3974
  break;
3927
3975
  }
3928
- yield db.transaction('rw', db.dx.tables, (tx) => __awaiter$1(this, void 0, void 0, function* () {
3976
+ yield db.transaction('rw', db.dx.tables, (tx) => __awaiter(this, void 0, void 0, function* () {
3929
3977
  // @ts-ignore
3930
3978
  tx.idbtrans.disableChangeTracking = true;
3931
3979
  // @ts-ignore
@@ -4686,7 +4734,7 @@ function overrideParseStoresSpec(origFunc, dexie) {
4686
4734
  }
4687
4735
 
4688
4736
  function performInitialSync(db, cloudOptions, cloudSchema) {
4689
- return __awaiter$1(this, void 0, void 0, function* () {
4737
+ return __awaiter(this, void 0, void 0, function* () {
4690
4738
  console.debug('Performing initial sync');
4691
4739
  yield sync(db, cloudOptions, cloudSchema, { isInitialSync: true });
4692
4740
  console.debug('Done initial sync');
@@ -4829,7 +4877,7 @@ class WSConnection extends Subscription$1 {
4829
4877
  .then(() => (this.reconnecting = false)); // finally()
4830
4878
  }
4831
4879
  connect() {
4832
- return __awaiter$1(this, void 0, void 0, function* () {
4880
+ return __awaiter(this, void 0, void 0, function* () {
4833
4881
  this.lastServerActivity = new Date();
4834
4882
  if (this.pauseUntil && this.pauseUntil > new Date()) {
4835
4883
  console.debug('WS not reconnecting just yet', {
@@ -4852,7 +4900,7 @@ class WSConnection extends Subscription$1 {
4852
4900
  return;
4853
4901
  }
4854
4902
  this.webSocketStatus.next('connecting');
4855
- this.pinger = setInterval(() => __awaiter$1(this, void 0, void 0, function* () {
4903
+ this.pinger = setInterval(() => __awaiter(this, void 0, void 0, function* () {
4856
4904
  if (this.closed) {
4857
4905
  console.debug('pinger check', this.id, 'CLOSED.');
4858
4906
  this.teardown();
@@ -4978,7 +5026,7 @@ function sleep(ms) {
4978
5026
  return new Promise((resolve) => setTimeout(resolve, ms));
4979
5027
  }
4980
5028
  function waitAndReconnectWhenUserDoesSomething(error) {
4981
- return __awaiter$1(this, void 0, void 0, function* () {
5029
+ return __awaiter(this, void 0, void 0, function* () {
4982
5030
  console.error(`WebSocket observable: error but revive when user does some active thing...`, error);
4983
5031
  // Sleep some seconds...
4984
5032
  yield sleep(3000);
@@ -5004,7 +5052,7 @@ function connectWebSocket(db) {
5004
5052
  function createObservable() {
5005
5053
  return db.cloud.persistedSyncState.pipe(filter((syncState) => syncState === null || syncState === void 0 ? void 0 : syncState.serverRevision), // Don't connect before there's no initial sync performed.
5006
5054
  take(1), // Don't continue waking up whenever syncState change
5007
- switchMap((syncState) => db.cloud.currentUser.pipe(map((userLogin) => [userLogin, syncState]))), switchMap(([userLogin, syncState]) => userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]))), switchMap(([userLogin, syncState]) => __awaiter$1(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), switchMap(([userLogin, realmSetHash]) =>
5055
+ switchMap((syncState) => db.cloud.currentUser.pipe(map((userLogin) => [userLogin, syncState]))), switchMap(([userLogin, syncState]) => userIsReallyActive.pipe(map((isActive) => [isActive ? userLogin : null, syncState]))), switchMap(([userLogin, syncState]) => __awaiter(this, void 0, void 0, function* () { return [userLogin, yield computeRealmSetHash(syncState)]; })), switchMap(([userLogin, realmSetHash]) =>
5008
5056
  // Let server end query changes from last entry of same client-ID and forward.
5009
5057
  // If no new entries, server won't bother the client. If new entries, server sends only those
5010
5058
  // and the baseRev of the last from same client-ID.
@@ -5013,7 +5061,7 @@ function connectWebSocket(db) {
5013
5061
  : from$1([])), catchError((error) => {
5014
5062
  if ((error === null || error === void 0 ? void 0 : error.name) === 'TokenExpiredError') {
5015
5063
  console.debug('WebSocket observable: Token expired. Refreshing token...');
5016
- return of(true).pipe(switchMap(() => __awaiter$1(this, void 0, void 0, function* () {
5064
+ return of(true).pipe(switchMap(() => __awaiter(this, void 0, void 0, function* () {
5017
5065
  // Refresh access token
5018
5066
  const user = yield db.getCurrentUser();
5019
5067
  const refreshedLogin = yield refreshAccessToken(db.cloud.options.databaseUrl, user);
@@ -5046,7 +5094,7 @@ function connectWebSocket(db) {
5046
5094
 
5047
5095
  function isSyncNeeded(db) {
5048
5096
  var _a;
5049
- return __awaiter$1(this, void 0, void 0, function* () {
5097
+ return __awaiter(this, void 0, void 0, function* () {
5050
5098
  return ((_a = db.cloud.options) === null || _a === void 0 ? void 0 : _a.databaseUrl) && db.cloud.schema
5051
5099
  ? yield sync(db, db.cloud.options, db.cloud.schema, { justCheckIfNeeded: true })
5052
5100
  : false;
@@ -5061,15 +5109,15 @@ const myId = randomString(16);
5061
5109
  const GUARDED_JOB_HEARTBEAT = 1 * SECONDS;
5062
5110
  const GUARDED_JOB_TIMEOUT = 1 * MINUTES;
5063
5111
  function performGuardedJob(db, jobName, jobsTableName, job, { awaitRemoteJob } = {}) {
5064
- return __awaiter$1(this, void 0, void 0, function* () {
5112
+ return __awaiter(this, void 0, void 0, function* () {
5065
5113
  // Start working.
5066
5114
  //
5067
5115
  // Check if someone else is working on this already.
5068
5116
  //
5069
5117
  const jobsTable = db.table(jobsTableName);
5070
5118
  function aquireLock() {
5071
- return __awaiter$1(this, void 0, void 0, function* () {
5072
- const gotTheLock = yield db.transaction('rw!', jobsTableName, () => __awaiter$1(this, void 0, void 0, function* () {
5119
+ return __awaiter(this, void 0, void 0, function* () {
5120
+ const gotTheLock = yield db.transaction('rw!', jobsTableName, () => __awaiter(this, void 0, void 0, function* () {
5073
5121
  const currentWork = yield jobsTable.get(jobName);
5074
5122
  if (!currentWork) {
5075
5123
  // No one else is working. Let's record that we are.
@@ -5135,7 +5183,7 @@ function performGuardedJob(db, jobName, jobsTableName, job, { awaitRemoteJob } =
5135
5183
  // Stop heartbeat
5136
5184
  clearInterval(heartbeat);
5137
5185
  // Remove the persisted job state:
5138
- yield db.transaction('rw!', jobsTableName, () => __awaiter$1(this, void 0, void 0, function* () {
5186
+ yield db.transaction('rw!', jobsTableName, () => __awaiter(this, void 0, void 0, function* () {
5139
5187
  const currentWork = yield jobsTable.get(jobName);
5140
5188
  if (currentWork && currentWork.nodeId === myId) {
5141
5189
  yield jobsTable.delete(jobName);
@@ -5195,7 +5243,7 @@ function syncIfPossible(db, cloudOptions, cloudSchema, options) {
5195
5243
  ongoingSyncs.set(db, { promise, pull: (options === null || options === void 0 ? void 0 : options.purpose) !== 'push' });
5196
5244
  return promise;
5197
5245
  function _syncIfPossible() {
5198
- return __awaiter$1(this, void 0, void 0, function* () {
5246
+ return __awaiter(this, void 0, void 0, function* () {
5199
5247
  try {
5200
5248
  if (db.cloud.isServiceWorkerDB) {
5201
5249
  // We are the dedicated sync SW:
@@ -5307,7 +5355,7 @@ function verifySchema(db) {
5307
5355
  }
5308
5356
  }
5309
5357
 
5310
- var n,u$1,i$1,t$1,r$1={},f$1=[],e$1=/acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i;function c$1(n,l){for(var u in l)n[u]=l[u];return n}function s$1(n){var l=n.parentNode;l&&l.removeChild(n);}function a$1(n,l,u){var i,t,o,r=arguments,f={};for(o in l)"key"==o?i=l[o]:"ref"==o?t=l[o]:f[o]=l[o];if(arguments.length>3)for(u=[u],o=3;o<arguments.length;o++)u.push(r[o]);if(null!=u&&(f.children=u),"function"==typeof n&&null!=n.defaultProps)for(o in n.defaultProps)void 0===f[o]&&(f[o]=n.defaultProps[o]);return v$1(n,f,i,t,null)}function v$1(l,u,i,t,o){var r={type:l,props:u,key:i,ref:t,__k:null,__:null,__b:0,__e:null,__d:void 0,__c:null,__h:null,constructor:void 0,__v:null==o?++n.__v:o};return null!=n.vnode&&n.vnode(r),r}function y(n){return n.children}function p$1(n,l){this.props=n,this.context=l;}function d$1(n,l){if(null==l)return n.__?d$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?d$1(n):null}function _(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 _(n)}}function k$1(l){(!l.__d&&(l.__d=!0)&&u$1.push(l)&&!b$1.__r++||t$1!==n.debounceRendering)&&((t$1=n.debounceRendering)||i$1)(b$1);}function b$1(){for(var n;b$1.__r=u$1.length;)n=u$1.sort(function(n,l){return n.__v.__b-l.__v.__b}),u$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=c$1({},t)).__v=t.__v+1,I(r,t,i,l.__n,void 0!==r.ownerSVGElement,null!=t.__h?[o]:null,u,null==o?d$1(t):o,t.__h),T(u,t),t.__e!=o&&_(t)));});}function m$1(n,l,u,i,t,o,e,c,s,a){var h,p,_,k,b,m,w,A=i&&i.__k||f$1,P=A.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(y,{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===(_=A[h])||_&&k.key==_.key&&k.type===_.type)A[h]=void 0;else for(p=0;p<P;p++){if((_=A[p])&&k.key==_.key&&k.type===_.type){A[p]=void 0;break}_=null;}I(n,k,_=_||r$1,t,o,e,c,s,a),b=k.__e,(p=k.ref)&&_.ref!=p&&(w||(w=[]),_.ref&&w.push(_.ref,null,k),w.push(p,k.__c||b,k)),null!=b?(null==m&&(m=b),"function"==typeof k.type&&null!=k.__k&&k.__k===_.__k?k.__d=s=g$1(k,s,n):s=x$1(n,k,_,A,b,s),a||"option"!==u.type?"function"==typeof u.type&&(u.__d=s):n.value=""):s&&_.__e==s&&s.parentNode!=n&&(s=d$1(_));}for(u.__e=m,h=P;h--;)null!=A[h]&&("function"==typeof u.type&&null!=A[h].__e&&A[h].__e==u.__d&&(u.__d=d$1(i,h+1)),L(A[h],A[h]));if(w)for(h=0;h<w.length;h++)z(w[h],w[++h],w[++h]);}function g$1(n,l,u){var i,t;for(i=0;i<n.__k.length;i++)(t=n.__k[i])&&(t.__=n,l="function"==typeof t.type?g$1(t,l,u):x$1(u,t,t,n.__k,t.__e,l));return l}function x$1(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 A(n,l,u,i,t){var o;for(o in u)"children"===o||"key"===o||o in l||C(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]||C(n,o,l[o],u[o],i);}function P(n,l,u){"-"===l[0]?n.setProperty(l,u):n[l]=null==u?"":"number"!=typeof u||e$1.test(l)?u:u+"px";}function C(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||P(n.style,l,"");if(u)for(l in u)i&&u[l]===i[l]||P(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?H:$,o):n.removeEventListener(l,o?H:$,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 $(l){this.l[l.type+!1](n.event?n.event(l):l);}function H(l){this.l[l.type+!0](n.event?n.event(l):l);}function I(l,u,i,t,o,r,f,e,s){var a,v,h,d,_,k,b,g,w,x,A,P=u.type;if(void 0!==u.constructor)return null;null!=i.__h&&(s=i.__h,e=u.__e=i.__e,u.__h=null,r=[e]),(a=n.__b)&&a(u);try{n:if("function"==typeof P){if(g=u.props,w=(a=P.contextType)&&t[a.__c],x=a?w?w.props.value:a.__:t,i.__c?b=(v=u.__c=i.__c).__=v.__E:("prototype"in P&&P.prototype.render?u.__c=v=new P(g,x):(u.__c=v=new p$1(g,x),v.constructor=P,v.render=M),w&&w.sub(v),v.props=g,v.state||(v.state={}),v.context=x,v.__n=t,h=v.__d=!0,v.__h=[]),null==v.__s&&(v.__s=v.state),null!=P.getDerivedStateFromProps&&(v.__s==v.state&&(v.__s=c$1({},v.__s)),c$1(v.__s,P.getDerivedStateFromProps(g,v.__s))),d=v.props,_=v.state,h)null==P.getDerivedStateFromProps&&null!=v.componentWillMount&&v.componentWillMount(),null!=v.componentDidMount&&v.__h.push(v.componentDidMount);else {if(null==P.getDerivedStateFromProps&&g!==d&&null!=v.componentWillReceiveProps&&v.componentWillReceiveProps(g,x),!v.__e&&null!=v.shouldComponentUpdate&&!1===v.shouldComponentUpdate(g,v.__s,x)||u.__v===i.__v){v.props=g,v.state=v.__s,u.__v!==i.__v&&(v.__d=!1),v.__v=u,u.__e=i.__e,u.__k=i.__k,u.__k.forEach(function(n){n&&(n.__=u);}),v.__h.length&&f.push(v);break n}null!=v.componentWillUpdate&&v.componentWillUpdate(g,v.__s,x),null!=v.componentDidUpdate&&v.__h.push(function(){v.componentDidUpdate(d,_,k);});}v.context=x,v.props=g,v.state=v.__s,(a=n.__r)&&a(u),v.__d=!1,v.__v=u,v.__P=l,a=v.render(v.props,v.state,v.context),v.state=v.__s,null!=v.getChildContext&&(t=c$1(c$1({},t),v.getChildContext())),h||null==v.getSnapshotBeforeUpdate||(k=v.getSnapshotBeforeUpdate(d,_)),A=null!=a&&a.type===y&&null==a.key?a.props.children:a,m$1(l,Array.isArray(A)?A:[A],u,i,t,o,r,f,e,s),v.base=u.__e,u.__h=null,v.__h.length&&f.push(v),b&&(v.__E=v.__=null),v.__e=!1;}else null==r&&u.__v===i.__v?(u.__k=i.__k,u.__e=i.__e):u.__e=j$1(i.__e,u,i,t,o,r,f,s);(a=n.diffed)&&a(u);}catch(l){u.__v=null,(s||null!=r)&&(u.__e=e,u.__h=!!s,r[r.indexOf(e)]=null),n.__e(l,u,i);}}function T(l,u){n.__c&&n.__c(u,l),l.some(function(u){try{l=u.__h,u.__h=[],l.some(function(n){n.call(u);});}catch(l){n.__e(l,u.__v);}});}function j$1(n,l,u,i,t,o,e,c){var a,v,h,y,p=u.props,d=l.props,_=l.type,k=0;if("svg"===_&&(t=!0),null!=o)for(;k<o.length;k++)if((a=o[k])&&(a===n||(_?a.localName==_:3==a.nodeType))){n=a,o[k]=null;break}if(null==n){if(null===_)return document.createTextNode(d);n=t?document.createElementNS("http://www.w3.org/2000/svg",_):document.createElement(_,d.is&&d),o=null,c=!1;}if(null===_)p===d||c&&n.data===d||(n.data=d);else {if(o=o&&f$1.slice.call(n.childNodes),v=(p=u.props||r$1).dangerouslySetInnerHTML,h=d.dangerouslySetInnerHTML,!c){if(null!=o)for(p={},y=0;y<n.attributes.length;y++)p[n.attributes[y].name]=n.attributes[y].value;(h||v)&&(h&&(v&&h.__html==v.__html||h.__html===n.innerHTML)||(n.innerHTML=h&&h.__html||""));}if(A(n,d,p,t,c),h)l.__k=[];else if(k=l.props.children,m$1(n,Array.isArray(k)?k:[k],l,u,i,t&&"foreignObject"!==_,o,e,n.firstChild,c),null!=o)for(k=o.length;k--;)null!=o[k]&&s$1(o[k]);c||("value"in d&&void 0!==(k=d.value)&&(k!==n.value||"progress"===_&&!k)&&C(n,"value",k,p.value,!1),"checked"in d&&void 0!==(k=d.checked)&&k!==n.checked&&C(n,"checked",k,p.checked,!1));}return n}function z(l,u,i){try{"function"==typeof l?l(u):l.current=u;}catch(l){n.__e(l,i);}}function L(l,u,i){var t,o,r;if(n.unmount&&n.unmount(l),(t=l.ref)&&(t.current&&t.current!==l.__e||z(t,null,u)),i||"function"==typeof l.type||(i=null!=(o=l.__e)),l.__e=l.__d=void 0,null!=(t=l.__c)){if(t.componentWillUnmount)try{t.componentWillUnmount();}catch(l){n.__e(l,u);}t.base=t.__P=null;}if(t=l.__k)for(r=0;r<t.length;r++)t[r]&&L(t[r],u,i);null!=o&&s$1(o);}function M(n,l,u){return this.constructor(n,u)}function N(l,u,i){var t,o,e;n.__&&n.__(l,u),o=(t="function"==typeof i)?null:i&&i.__k||u.__k,e=[],I(u,l=(!t&&i||u).__k=a$1(y,null,[l]),o||r$1,r$1,void 0!==u.ownerSVGElement,!t&&i?[i]:o?null:u.firstChild?f$1.slice.call(u.childNodes):null,e,!t&&i?i:o?o.__e:u.firstChild,t),T(e,l);}n={__e:function(n,l){for(var u,i,t;l=l.__;)if((u=l.__c)&&!u.__)try{if((i=u.constructor)&&null!=i.getDerivedStateFromError&&(u.setState(i.getDerivedStateFromError(n)),t=u.__d),null!=u.componentDidCatch&&(u.componentDidCatch(n),t=u.__d),t)return u.__E=u}catch(l){n=l;}throw n},__v:0},p$1.prototype.setState=function(n,l){var u;u=null!=this.__s&&this.__s!==this.state?this.__s:this.__s=c$1({},this.state),"function"==typeof n&&(n=n(c$1({},u),this.props)),n&&c$1(u,n),null!=n&&this.__v&&(l&&this.__h.push(l),k$1(this));},p$1.prototype.forceUpdate=function(n){this.__v&&(this.__e=!0,n&&this.__h.push(n),k$1(this));},p$1.prototype.render=y,u$1=[],i$1="function"==typeof Promise?Promise.prototype.then.bind(Promise.resolve()):setTimeout,b$1.__r=0;
5358
+ 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;
5311
5359
 
5312
5360
  const Styles = {
5313
5361
  Error: {
@@ -5372,35 +5420,35 @@ const Styles = {
5372
5420
  };
5373
5421
 
5374
5422
  function Dialog({ children, className }) {
5375
- return (a$1("div", { className: className },
5376
- a$1("div", { style: Styles.Darken }),
5377
- a$1("div", { style: Styles.DialogOuter },
5378
- a$1("div", { style: Styles.DialogInner }, children))));
5423
+ return (h("div", { className: className },
5424
+ h("div", { style: Styles.Darken }),
5425
+ h("div", { style: Styles.DialogOuter },
5426
+ h("div", { style: Styles.DialogInner }, children))));
5379
5427
  }
5380
5428
 
5381
- var t,u,r,o=0,i=[],c=n.__b,f=n.__r,e=n.diffed,a=n.__c,v=n.unmount;function m(t,r){n.__h&&n.__h(u,t,o||r),o=0;var i=u.__H||(u.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({}),i.__[t]}function l(n){return o=1,p(w,n)}function p(n,r,o){var i=m(t++,2);return i.t=n,i.__c||(i.__=[o?o(r):w(void 0,r),function(n){var t=i.t(i.__[0],n);i.__[0]!==t&&(i.__=[t,i.__[1]],i.__c.setState({}));}],i.__c=u),i.__}function h(r,o){var i=m(t++,4);!n.__s&&k(i.__H,o)&&(i.__=r,i.__H=o,u.__h.push(i));}function s(n){return o=5,d(function(){return {current:n}},[])}function d(n,u){var r=m(t++,7);return k(r.__H,u)&&(r.__=n(),r.__H=u,r.__h=n),r.__}function x(){i.forEach(function(t){if(t.__P)try{t.__H.__h.forEach(g),t.__H.__h.forEach(j),t.__H.__h=[];}catch(u){t.__H.__h=[],n.__e(u,t.__v);}}),i=[];}n.__b=function(n){u=null,c&&c(n);},n.__r=function(n){f&&f(n),t=0;var r=(u=n.__c).__H;r&&(r.__h.forEach(g),r.__h.forEach(j),r.__h=[]);},n.diffed=function(t){e&&e(t);var o=t.__c;o&&o.__H&&o.__H.__h.length&&(1!==i.push(o)&&r===n.requestAnimationFrame||((r=n.requestAnimationFrame)||function(n){var t,u=function(){clearTimeout(r),b&&cancelAnimationFrame(t),setTimeout(n);},r=setTimeout(u,100);b&&(t=requestAnimationFrame(u));})(x)),u=void 0;},n.__c=function(t,u){u.some(function(t){try{t.__h.forEach(g),t.__h=t.__h.filter(function(n){return !n.__||j(n)});}catch(r){u.some(function(n){n.__h&&(n.__h=[]);}),u=[],n.__e(r,t.__v);}}),a&&a(t,u);},n.unmount=function(t){v&&v(t);var u=t.__c;if(u&&u.__H)try{u.__H.__.forEach(g);}catch(t){n.__e(t,u.__v);}};var b="function"==typeof requestAnimationFrame;function g(n){var t=u;"function"==typeof n.__c&&n.__c(),u=t;}function j(n){var t=u;n.__c=n.__(),u=t;}function k(n,t){return !n||n.length!==t.length||t.some(function(t,u){return t!==n[u]})}function w(n,t){return "function"==typeof t?t(n):t}
5429
+ var t,r,u,i,o=0,c=[],f=[],e=l$1.__b,a=l$1.__r,v=l$1.diffed,l=l$1.__c,m=l$1.unmount;function d(t,u){l$1.__h&&l$1.__h(r,t,o||u),o=0;var i=r.__H||(r.__H={__:[],__h:[]});return t>=i.__.length&&i.__.push({__V:f}),i.__[t]}function p(n){return o=1,y(z,n)}function y(n,u,i){var o=d(t++,2);if(o.t=n,!o.__c&&(o.__=[i?i(u):z(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.u)){r.u=!0;var c=r.shouldComponentUpdate;r.shouldComponentUpdate=function(n,t,r){if(!o.__c.__H)return !0;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=!1;return u.forEach(function(n){if(n.__N){var t=n.__[0];n.__=n.__N,n.__N=void 0,t!==n.__[0]&&(i=!0);}}),!!i&&(!c||c.call(this,n,t,r))};}return o.__N||o.__}function s(u,i){var o=d(t++,4);!l$1.__s&&w(o.__H,i)&&(o.__=u,o.i=i,r.__h.push(o));}function _(n){return o=5,F(function(){return {current:n}},[])}function F(n,r){var u=d(t++,7);return w(u.__H,r)?(u.__V=n(),u.i=r,u.__h=n,u.__V):u.__}function b(){for(var t;t=c.shift();)if(t.__P&&t.__H)try{t.__H.__h.forEach(j),t.__H.__h.forEach(k),t.__H.__h=[];}catch(r){t.__H.__h=[],l$1.__e(r,t.__v);}}l$1.__b=function(n){r=null,e&&e(n);},l$1.__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.__V=f,n.__N=n.i=void 0;})):(i.__h.forEach(j),i.__h.forEach(k),i.__h=[])),u=r;},l$1.diffed=function(t){v&&v(t);var o=t.__c;o&&o.__H&&(o.__H.__h.length&&(1!==c.push(o)&&i===l$1.requestAnimationFrame||((i=l$1.requestAnimationFrame)||function(n){var t,r=function(){clearTimeout(u),g&&cancelAnimationFrame(t),setTimeout(n);},u=setTimeout(r,100);g&&(t=requestAnimationFrame(r));})(b)),o.__H.__.forEach(function(n){n.i&&(n.__H=n.i),n.__V!==f&&(n.__=n.__V),n.i=void 0,n.__V=f;})),u=r=null;},l$1.__c=function(t,r){r.some(function(t){try{t.__h.forEach(j),t.__h=t.__h.filter(function(n){return !n.__||k(n)});}catch(u){r.some(function(n){n.__h&&(n.__h=[]);}),r=[],l$1.__e(u,t.__v);}}),l&&l(t,r);},l$1.unmount=function(t){m&&m(t);var r,u=t.__c;u&&u.__H&&(u.__H.__.forEach(function(n){try{j(n);}catch(n){r=n;}}),r&&l$1.__e(r,u.__v));};var g="function"==typeof requestAnimationFrame;function j(n){var t=r,u=n.__c;"function"==typeof u&&(n.__c=void 0,u()),r=t;}function k(n){var t=r;n.__c=n.__(),r=t;}function w(n,t){return !n||n.length!==t.length||t.some(function(t,r){return t!==n[r]})}function z(n,t){return "function"==typeof t?t(n):t}
5382
5430
 
5383
5431
  function resolveText({ message, messageCode, messageParams }) {
5384
5432
  return message.replace(/\{\w+\}/ig, n => messageParams[n.substr(1, n.length - 2)]);
5385
5433
  }
5386
5434
 
5387
5435
  function LoginDialog({ title, alerts, fields, onCancel, onSubmit, }) {
5388
- const [params, setParams] = l({});
5389
- const firstFieldRef = s();
5390
- h(() => { var _a; return (_a = firstFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
5391
- return (a$1(Dialog, { className: "dxc-login-dlg" },
5392
- a$1(y, null,
5393
- a$1("h3", { style: Styles.WindowHeader }, title),
5394
- alerts.map((alert) => (a$1("p", { style: Styles.Alert[alert.type] }, resolveText(alert)))),
5395
- a$1("form", { onSubmit: ev => {
5436
+ const [params, setParams] = p({});
5437
+ const firstFieldRef = _(null);
5438
+ s(() => { var _a; return (_a = firstFieldRef.current) === null || _a === void 0 ? void 0 : _a.focus(); }, []);
5439
+ return (h(Dialog, { className: "dxc-login-dlg" },
5440
+ h(p$1, null,
5441
+ h("h3", { style: Styles.WindowHeader }, title),
5442
+ alerts.map((alert) => (h("p", { style: Styles.Alert[alert.type] }, resolveText(alert)))),
5443
+ h("form", { onSubmit: ev => {
5396
5444
  ev.preventDefault();
5397
5445
  onSubmit(params);
5398
- } }, Object.entries(fields).map(([fieldName, { type, label, placeholder }], idx) => (a$1("label", { style: Styles.Label },
5446
+ } }, Object.entries(fields).map(([fieldName, { type, label, placeholder }], idx) => (h("label", { style: Styles.Label },
5399
5447
  label ? `${label}: ` : '',
5400
- a$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) => { var _a; return setParams(Object.assign(Object.assign({}, params), { [fieldName]: valueTransformer(type, (_a = ev.target) === null || _a === void 0 ? void 0 : _a['value']) })); } })))))),
5401
- a$1("div", { style: Styles.ButtonsDiv },
5402
- a$1("button", { type: "submit", style: Styles.Button, onClick: () => onSubmit(params) }, "Submit"),
5403
- a$1("button", { style: Styles.Button, onClick: onCancel }, "Cancel"))));
5448
+ h("input", { ref: idx === 0 ? firstFieldRef : undefined, type: type, name: fieldName, autoComplete: "on", style: Styles.Input, autoFocus: true, placeholder: placeholder, value: params[fieldName] || '', onInput: (ev) => { var _a; return setParams(Object.assign(Object.assign({}, params), { [fieldName]: valueTransformer(type, (_a = ev.target) === null || _a === void 0 ? void 0 : _a['value']) })); } })))))),
5449
+ h("div", { style: Styles.ButtonsDiv },
5450
+ h("button", { type: "submit", style: Styles.Button, onClick: () => onSubmit(params) }, "Submit"),
5451
+ h("button", { style: Styles.Button, onClick: onCancel }, "Cancel"))));
5404
5452
  }
5405
5453
  function valueTransformer(type, value) {
5406
5454
  switch (type) {
@@ -5410,7 +5458,7 @@ function valueTransformer(type, value) {
5410
5458
  }
5411
5459
  }
5412
5460
 
5413
- class LoginGui extends p$1 {
5461
+ class LoginGui extends d$1 {
5414
5462
  constructor(props) {
5415
5463
  super(props);
5416
5464
  this.observer = (userInteraction) => this.setState({ userInteraction });
@@ -5429,13 +5477,13 @@ class LoginGui extends p$1 {
5429
5477
  if (!userInteraction)
5430
5478
  return null;
5431
5479
  //if (props.db.cloud.userInteraction.observers.length > 1) return null; // Someone else subscribes.
5432
- return a$1(LoginDialog, Object.assign({}, userInteraction));
5480
+ return h(LoginDialog, Object.assign({}, userInteraction));
5433
5481
  }
5434
5482
  }
5435
5483
  function setupDefaultGUI(db) {
5436
5484
  const el = document.createElement('div');
5437
5485
  document.body.appendChild(el);
5438
- N(a$1(LoginGui, { db: db.vip }), el);
5486
+ P(h(LoginGui, { db: db.vip }), el);
5439
5487
  let closed = false;
5440
5488
  return {
5441
5489
  unsubscribe() {
@@ -5805,12 +5853,12 @@ const getInvitesObservable = associate((db) => {
5805
5853
  return Object.values(membersById)
5806
5854
  .filter((invite) => !invite.accepted && !invite.rejected)
5807
5855
  .map((invite) => (Object.assign(Object.assign({}, invite), { accept() {
5808
- return __awaiter$1(this, void 0, void 0, function* () {
5856
+ return __awaiter(this, void 0, void 0, function* () {
5809
5857
  yield db.members.update(invite.id, { accepted: new Date() });
5810
5858
  });
5811
5859
  },
5812
5860
  reject() {
5813
- return __awaiter$1(this, void 0, void 0, function* () {
5861
+ return __awaiter(this, void 0, void 0, function* () {
5814
5862
  yield db.members.update(invite.id, { rejected: new Date() });
5815
5863
  });
5816
5864
  } })));
@@ -5837,7 +5885,7 @@ function dexieCloud(dexie) {
5837
5885
  let configuredProgramatically = false;
5838
5886
  // local sync worker - used when there's no service worker.
5839
5887
  let localSyncWorker = null;
5840
- dexie.on('ready', (dexie) => __awaiter$1(this, void 0, void 0, function* () {
5888
+ dexie.on('ready', (dexie) => __awaiter(this, void 0, void 0, function* () {
5841
5889
  try {
5842
5890
  yield onDbReady(dexie);
5843
5891
  }
@@ -5861,7 +5909,7 @@ function dexieCloud(dexie) {
5861
5909
  currentUserEmitter.next(UNAUTHORIZED_USER);
5862
5910
  });
5863
5911
  dexie.cloud = {
5864
- version: '4.0.0-beta.21',
5912
+ version: '4.0.0-beta.23',
5865
5913
  options: Object.assign({}, DEFAULT_OPTIONS),
5866
5914
  schema: null,
5867
5915
  get currentUserId() {
@@ -5876,7 +5924,7 @@ function dexieCloud(dexie) {
5876
5924
  userInteraction: new BehaviorSubject(undefined),
5877
5925
  webSocketStatus: new BehaviorSubject('not-started'),
5878
5926
  login(hint) {
5879
- return __awaiter$1(this, void 0, void 0, function* () {
5927
+ return __awaiter(this, void 0, void 0, function* () {
5880
5928
  const db = DexieCloudDB(dexie);
5881
5929
  yield db.cloud.sync();
5882
5930
  yield login(db, hint);
@@ -5895,7 +5943,7 @@ function dexieCloud(dexie) {
5895
5943
  updateSchemaFromOptions(dexie.cloud.schema, dexie.cloud.options);
5896
5944
  },
5897
5945
  sync({ wait, purpose } = { wait: true, purpose: 'push' }) {
5898
- return __awaiter$1(this, void 0, void 0, function* () {
5946
+ return __awaiter(this, void 0, void 0, function* () {
5899
5947
  if (wait === undefined)
5900
5948
  wait = true;
5901
5949
  const db = DexieCloudDB(dexie);
@@ -5917,7 +5965,7 @@ function dexieCloud(dexie) {
5917
5965
  triggerSync(db, purpose);
5918
5966
  if (wait) {
5919
5967
  console.debug('db.cloud.login() is waiting for sync completion...');
5920
- yield from$1(liveQuery(() => __awaiter$1(this, void 0, void 0, function* () {
5968
+ yield from$1(liveQuery(() => __awaiter(this, void 0, void 0, function* () {
5921
5969
  const syncNeeded = yield isSyncNeeded(db);
5922
5970
  const newSyncState = yield db.getPersistedSyncState();
5923
5971
  if ((newSyncState === null || newSyncState === void 0 ? void 0 : newSyncState.timestamp) !== (syncState === null || syncState === void 0 ? void 0 : syncState.timestamp) &&
@@ -5953,7 +6001,7 @@ function dexieCloud(dexie) {
5953
6001
  dexie.use(createIdGenerationMiddleware(DexieCloudDB(dexie)));
5954
6002
  function onDbReady(dexie) {
5955
6003
  var _a, _b, _c, _d, _e, _f, _g;
5956
- return __awaiter$1(this, void 0, void 0, function* () {
6004
+ return __awaiter(this, void 0, void 0, function* () {
5957
6005
  closed = false; // As Dexie calls us, we are not closed anymore. Maybe reopened? Remember db.ready event is registered with sticky flag!
5958
6006
  const db = DexieCloudDB(dexie);
5959
6007
  // Setup default GUI:
@@ -5973,7 +6021,7 @@ function dexieCloud(dexie) {
5973
6021
  const swRegistrations = 'serviceWorker' in navigator
5974
6022
  ? yield navigator.serviceWorker.getRegistrations()
5975
6023
  : [];
5976
- const initiallySynced = yield db.transaction('rw', db.$syncState, () => __awaiter$1(this, void 0, void 0, function* () {
6024
+ const initiallySynced = yield db.transaction('rw', db.$syncState, () => __awaiter(this, void 0, void 0, function* () {
5977
6025
  var _h, _j;
5978
6026
  const { options, schema } = db.cloud;
5979
6027
  const [persistedOptions, persistedSchema, persistedSyncState] = yield Promise.all([
@@ -6114,7 +6162,7 @@ function dexieCloud(dexie) {
6114
6162
  });
6115
6163
  }
6116
6164
  }
6117
- dexieCloud.version = '4.0.0-beta.21';
6165
+ dexieCloud.version = '4.0.0-beta.23';
6118
6166
  Dexie.Cloud = dexieCloud;
6119
6167
 
6120
6168
  export { dexieCloud as default, dexieCloud, getTiedObjectId, getTiedRealmId };