buzzcasting-storage 3.0.19 → 3.0.20
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/buzzcasting-storage.esm.js +722 -726
- package/package.json +1 -1
|
@@ -2,7 +2,7 @@ var xa = Object.defineProperty;
|
|
|
2
2
|
var Aa = (d, r, o) => r in d ? xa(d, r, { enumerable: !0, configurable: !0, writable: !0, value: o }) : d[r] = o;
|
|
3
3
|
var k = (d, r, o) => Aa(d, typeof r != "symbol" ? r + "" : r, o);
|
|
4
4
|
var N = /* @__PURE__ */ ((d) => (d.MESSAGES = "messages", d.CLOUD = "cloud", d.SERIES = "series", d.TOPICS = "topics", d.WIDGET = "widget", d.WIDGETS = "widgets", d.SLIDE = "slide", d))(N || {}), g = /* @__PURE__ */ ((d) => (d.API = "color:white;background-color:grey;padding:0 4px 0 4px;border-radius:5px;", d.APP = "color:white;background-color:navy;padding:0 4px 0 4px;border-radius:5px;", d.BROADCAST = "color:white;background-color:orange;padding:0 4px 0 4px;border-radius:5px;", d.DATA = "color:grey;background-color:lightskyblue;padding:0 4px 0 4px;border-radius:5px;", d.CLOUD = "color:grey;background-color:mistyrose;padding:0 4px 0 4px;border-radius:5px;", d.GET_DATA = "color:black;background-color:lime;padding:0 4px 0 4px;border-radius:5px;", d.HIDE = "color:white;background-color:red;padding:0 4px 0 4px;border-radius:5px;", d.MESSAGES = "color:white;background-color:darkslateblue;padding:0 4px 0 4px;border-radius:5px;", d.NO_UPDATES = "color:grey;border:1px solid grey;padding:0 4px 0 4px;border-radius:5px;", d.NONE = "color:transparent;background-color:transparent;", d.PRESENTATION = "color:white;background-color:darkred;padding:0 4px 0 4px;border-radius:5px;", d.SERIES = "color:grey;background-color:thistle;padding:0 4px 0 4px;border-radius:5px;", d.SLIDE = "color:black;background-color:yellow;padding:0 4px 0 4px;border-radius:5px;", d.STORAGE = "color:black;background-color:cyan;padding:0 4px 0 4px;border-radius:5px;", d.SUBSCRIBE = "color:white;background-color:dodgerblue;padding:0 4px 0 4px;border-radius:5px;", d.WIDGET = "color:gret;background-color:lemonchiffon;padding:0 4px 0 4px;border-radius:5px;", d.WS = "color:white;background-color:green;padding:0 4px 0 4px;border-radius:5px;", d))(g || {}), re = /* @__PURE__ */ ((d) => (d.ADD_SLIDE = "addSlide", d.APP_READY = "appReady", d.API_UPDATE = "apiUpdate", d.APPROVE_MESSAGE = "approveMessage", d.CHANNEL = "channel", d.CLEAN_MESSAGES = "cleanMessages", d.CLOSE_MODAL = "closeModal", d.CLOSE_BUILDER_MODAL = "closeBuilderModal", d.ERROR = "error", d.HIDE_MESSAGE = "hideMessage", d.HIDE_LABELS = "hideLabels", d.MAUPPUT_UPDATE = "layoutUpdate", d.PAUSE_PRESENTATION = "pausePresentation", d.PRESENTATION_READY = "presentationReady", d.PREV_SLIDE = "prevSlide", d.RELOAD_PRESENTATION = "reloadPresentation", d.SHOW_MODAL = "showModal", d.STAR_MESSAGE = "starMessage", d.GOTO_SLIDE = "gotoSlide", d.NEXT_SLIDE = "nextSlide", d.SHOW_BUILDER_MODAL = "showBuilderModal", d.SLIDE_DID_LOAD = "slideDidLoad", d.SLIDE_GOTO = "slideGoto", d.SLIDE_READY = "slideReady", d.SLIDE_LOAD = "loadSlide", d.SLIDE_STORE = "storeSlide", d.SLIDE_TRANSITIONER = "slideTransitioner", d.START_TRANSITIONER = "startTransitioner", d.STORAGE_INIT = "storageInit", d.SUBSCRIBE = "subscribe", d.SUSPEND_ACCOUNT = "suspendAccount", d.REMOVE_CLOUD = "removeCloud", d.UPDATE = "update", d.VERSION = "version", d.WIDGET_UPDATE = "widgetUpdate", d))(re || {}), Zt = /* @__PURE__ */ ((d) => (d.APPROVED = "approved", d.BEFORE = "before", d.DELAYED = "delayed", d.NONE = "none", d.REALTIME = "realtime", d))(Zt || {}), ye = /* @__PURE__ */ ((d) => (d.KEYVAL = "keyval", d.LOCAL = "local", d.SESSION = "session", d.DEXIE = "dexie", d.WINDOW = "window", d))(ye || {});
|
|
5
|
-
const ka = "3.0.
|
|
5
|
+
const ka = "3.0.19";
|
|
6
6
|
class Da {
|
|
7
7
|
constructor(r) {
|
|
8
8
|
k(this, "options");
|
|
@@ -32,29 +32,27 @@ class Da {
|
|
|
32
32
|
this.options = r, this.url = `https://${r.app}.buzzcasting.net`;
|
|
33
33
|
}
|
|
34
34
|
async get(r) {
|
|
35
|
-
var K, L;
|
|
36
35
|
const { version: o } = this.options, l = this.headers(), x = Object.assign({}, r);
|
|
37
36
|
delete x.slide, delete x.type, delete x.hash, delete x.order, delete x.period;
|
|
38
37
|
const D = Object.keys(x).length > 0 ? `?${new URLSearchParams(x).toString()}` : "";
|
|
39
|
-
return
|
|
38
|
+
return console.info(
|
|
40
39
|
"%capi%c %cfetch",
|
|
41
40
|
g.API,
|
|
42
41
|
g.NONE,
|
|
43
42
|
g.GET_DATA,
|
|
44
43
|
r.widget
|
|
45
|
-
),
|
|
44
|
+
), console.debug("%capi%c %cfetch", g.API, g.NONE, g.GET_DATA, x), await fetch(
|
|
46
45
|
[this.url, "api", o, r.type].join("/") + D,
|
|
47
46
|
{ ...l, method: "get" }
|
|
48
|
-
).then(async (
|
|
49
|
-
if (!
|
|
50
|
-
throw new Error(`${
|
|
51
|
-
return
|
|
52
|
-
}).then((
|
|
47
|
+
).then(async (K) => {
|
|
48
|
+
if (!K.ok)
|
|
49
|
+
throw new Error(`${K.status}`);
|
|
50
|
+
return K;
|
|
51
|
+
}).then((K) => K.json()).then((K) => (K.query = r, K)).catch((K) => ({ success: !1, message: `${K}`, data: null }));
|
|
53
52
|
}
|
|
54
53
|
async hideMessage(r) {
|
|
55
|
-
var D, K;
|
|
56
54
|
const { version: o } = this.options, l = this.headers(), x = "?action=visible";
|
|
57
|
-
return
|
|
55
|
+
return console.info(
|
|
58
56
|
"%capi%c %cput",
|
|
59
57
|
g.API,
|
|
60
58
|
g.NONE,
|
|
@@ -62,7 +60,7 @@ class Da {
|
|
|
62
60
|
re.HIDE_MESSAGE,
|
|
63
61
|
r.widget,
|
|
64
62
|
r.id
|
|
65
|
-
),
|
|
63
|
+
), console.debug(
|
|
66
64
|
"%capi%c %cput",
|
|
67
65
|
g.API,
|
|
68
66
|
g.NONE,
|
|
@@ -72,18 +70,17 @@ class Da {
|
|
|
72
70
|
), await fetch(
|
|
73
71
|
[this.url, "api", o, "messages", r.id].join("/") + x,
|
|
74
72
|
{ ...l, method: "put" }
|
|
75
|
-
).then((
|
|
76
|
-
if (!
|
|
77
|
-
throw new Error(
|
|
78
|
-
return
|
|
79
|
-
}).then((
|
|
73
|
+
).then((D) => {
|
|
74
|
+
if (!D.ok)
|
|
75
|
+
throw new Error(D.statusText);
|
|
76
|
+
return D;
|
|
77
|
+
}).then((D) => D.json()).catch((D) => ({ succes: !1, message: D, data: [] }));
|
|
80
78
|
}
|
|
81
79
|
async hideLabels(r) {
|
|
82
|
-
var K;
|
|
83
80
|
const { version: o } = this.options, l = this.formHeaders(), x = new URLSearchParams(), D = r.labels || [];
|
|
84
|
-
for (const [
|
|
85
|
-
x.append(`custom_filters[${
|
|
86
|
-
return
|
|
81
|
+
for (const [K, U] of D.entries())
|
|
82
|
+
x.append(`custom_filters[${K}]`, U);
|
|
83
|
+
return console.info(
|
|
87
84
|
"%capi%c %cput",
|
|
88
85
|
g.API,
|
|
89
86
|
g.NONE,
|
|
@@ -94,16 +91,15 @@ class Da {
|
|
|
94
91
|
), await fetch(
|
|
95
92
|
[this.url, "api", o, r.type, r.widget].join("/"),
|
|
96
93
|
{ ...l, body: x, method: "put" }
|
|
97
|
-
).then((
|
|
98
|
-
if (!
|
|
99
|
-
throw new Error(
|
|
100
|
-
return
|
|
101
|
-
}).then((
|
|
94
|
+
).then((K) => {
|
|
95
|
+
if (!K.ok)
|
|
96
|
+
throw new Error(K.statusText);
|
|
97
|
+
return K;
|
|
98
|
+
}).then((K) => K.json()).catch((K) => ({ succes: !1, message: K, data: [] }));
|
|
102
99
|
}
|
|
103
100
|
async loadSlide(r) {
|
|
104
|
-
var D;
|
|
105
101
|
const { version: o } = this.options, l = this.headers(), x = Object.assign({}, r);
|
|
106
|
-
return delete x.slide, delete x.type, delete x.hash,
|
|
102
|
+
return delete x.slide, delete x.type, delete x.hash, console.debug(
|
|
107
103
|
"%capi%c %cloadSlide",
|
|
108
104
|
g.API,
|
|
109
105
|
g.NONE,
|
|
@@ -113,11 +109,11 @@ class Da {
|
|
|
113
109
|
), await fetch(
|
|
114
110
|
[this.url, "api", o, "slides", r.id].join("/"),
|
|
115
111
|
{ ...l, method: "get" }
|
|
116
|
-
).then(async (
|
|
117
|
-
if (!
|
|
118
|
-
throw new Error(`${
|
|
119
|
-
return
|
|
120
|
-
}).then((
|
|
112
|
+
).then(async (D) => {
|
|
113
|
+
if (!D.ok)
|
|
114
|
+
throw new Error(`${D.status}`);
|
|
115
|
+
return D;
|
|
116
|
+
}).then((D) => D.json()).then((D) => (D.query = r, D)).catch((D) => ({ success: !1, message: `${D}`, data: null }));
|
|
121
117
|
}
|
|
122
118
|
/**
|
|
123
119
|
* Store slide definition
|
|
@@ -180,8 +176,8 @@ function Ra() {
|
|
|
180
176
|
for (var a, i = 0, s = t.length; i < s; i++) !a && i in t || ((a = a || Array.prototype.slice.call(t, 0, i))[i] = t[i]);
|
|
181
177
|
return e.concat(a || Array.prototype.slice.call(t));
|
|
182
178
|
}
|
|
183
|
-
var D = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Pa, K = Object.keys,
|
|
184
|
-
function
|
|
179
|
+
var D = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Pa, K = Object.keys, U = Array.isArray;
|
|
180
|
+
function M(e, t) {
|
|
185
181
|
return typeof t != "object" || K(t).forEach(function(n) {
|
|
186
182
|
e[n] = t[n];
|
|
187
183
|
}), e;
|
|
@@ -198,7 +194,7 @@ function Ra() {
|
|
|
198
194
|
}
|
|
199
195
|
var He = Object.defineProperty;
|
|
200
196
|
function xe(e, t, n, a) {
|
|
201
|
-
He(e, t,
|
|
197
|
+
He(e, t, M(n && ee(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, a));
|
|
202
198
|
}
|
|
203
199
|
function Ye(e) {
|
|
204
200
|
return { from: function(t) {
|
|
@@ -206,7 +202,7 @@ function Ra() {
|
|
|
206
202
|
} };
|
|
207
203
|
}
|
|
208
204
|
var Ur = Object.getOwnPropertyDescriptor, Fr = [].slice;
|
|
209
|
-
function
|
|
205
|
+
function _t(e, t, n) {
|
|
210
206
|
return Fr.call(e, t, n);
|
|
211
207
|
}
|
|
212
208
|
function Hn(e, t) {
|
|
@@ -240,7 +236,7 @@ function Ra() {
|
|
|
240
236
|
for (var a = 0, i = t.length; a < i; ++a) fe(e, t[a], n[a]);
|
|
241
237
|
} else {
|
|
242
238
|
var s, u, c = t.indexOf(".");
|
|
243
|
-
c !== -1 ? (s = t.substr(0, c), (u = t.substr(c + 1)) === "" ? n === void 0 ?
|
|
239
|
+
c !== -1 ? (s = t.substr(0, c), (u = t.substr(c + 1)) === "" ? n === void 0 ? U(e) && !isNaN(parseInt(s)) ? e.splice(s, 1) : delete e[s] : e[s] = n : fe(c = !(c = e[s]) || !ee(e, s) ? e[s] = {} : c, u, n)) : n === void 0 ? U(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
244
240
|
}
|
|
245
241
|
}
|
|
246
242
|
function Qn(e) {
|
|
@@ -258,7 +254,7 @@ function Ra() {
|
|
|
258
254
|
});
|
|
259
255
|
}))).filter(function(e) {
|
|
260
256
|
return D[e];
|
|
261
|
-
}),
|
|
257
|
+
}), Jn = new Set(Ne.map(function(e) {
|
|
262
258
|
return D[e];
|
|
263
259
|
})), it = null;
|
|
264
260
|
function Te(e) {
|
|
@@ -266,10 +262,10 @@ function Ra() {
|
|
|
266
262
|
if (!n || typeof n != "object") return n;
|
|
267
263
|
var a = it.get(n);
|
|
268
264
|
if (a) return a;
|
|
269
|
-
if (
|
|
265
|
+
if (U(n)) {
|
|
270
266
|
a = [], it.set(n, a);
|
|
271
267
|
for (var i = 0, s = n.length; i < s; ++i) a.push(t(n[i]));
|
|
272
|
-
} else if (
|
|
268
|
+
} else if (Jn.has(n.constructor)) a = n;
|
|
273
269
|
else {
|
|
274
270
|
var u, c = X(n);
|
|
275
271
|
for (u in a = c === Object.prototype ? {} : Object.create(c), it.set(n, a), n) ee(n, u) && (a[u] = t(n[u]));
|
|
@@ -291,10 +287,10 @@ function Ra() {
|
|
|
291
287
|
return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
|
|
292
288
|
}
|
|
293
289
|
var Qe = {};
|
|
294
|
-
function
|
|
290
|
+
function Se(e) {
|
|
295
291
|
var t, n, a, i;
|
|
296
292
|
if (arguments.length === 1) {
|
|
297
|
-
if (
|
|
293
|
+
if (U(e)) return e.slice();
|
|
298
294
|
if (this === Qe && typeof e == "string") return [e];
|
|
299
295
|
if (i = Hr(e)) {
|
|
300
296
|
for (n = []; !(a = i.next()).done; ) n.push(a.value);
|
|
@@ -316,7 +312,7 @@ function Ra() {
|
|
|
316
312
|
function Xe(e, t) {
|
|
317
313
|
this.name = e, this.message = t;
|
|
318
314
|
}
|
|
319
|
-
function
|
|
315
|
+
function Vn(e, t) {
|
|
320
316
|
return e + ". Errors: " + Object.keys(t).map(function(n) {
|
|
321
317
|
return t[n].toString();
|
|
322
318
|
}).filter(function(n, a, i) {
|
|
@@ -325,19 +321,19 @@ function Ra() {
|
|
|
325
321
|
`);
|
|
326
322
|
}
|
|
327
323
|
function Et(e, t, n, a) {
|
|
328
|
-
this.failures = t, this.failedKeys = a, this.successCount = n, this.message =
|
|
324
|
+
this.failures = t, this.failedKeys = a, this.successCount = n, this.message = Vn(e, t);
|
|
329
325
|
}
|
|
330
|
-
function
|
|
326
|
+
function Je(e, t) {
|
|
331
327
|
this.name = "BulkError", this.failures = Object.keys(t).map(function(n) {
|
|
332
328
|
return t[n];
|
|
333
|
-
}), this.failuresByPos = t, this.message =
|
|
329
|
+
}), this.failuresByPos = t, this.message = Vn(e, this.failures);
|
|
334
330
|
}
|
|
335
331
|
Ye(Xe).from(Error).extend({ toString: function() {
|
|
336
332
|
return this.name + ": " + this.message;
|
|
337
|
-
} }), Ye(Et).from(Xe), Ye(
|
|
333
|
+
} }), Ye(Et).from(Xe), Ye(Je).from(Xe);
|
|
338
334
|
var an = ge.reduce(function(e, t) {
|
|
339
335
|
return e[t] = t + "Error", e;
|
|
340
|
-
}, {}), Qr = Xe,
|
|
336
|
+
}, {}), Qr = Xe, $ = ge.reduce(function(e, t) {
|
|
341
337
|
var n = t + "Error";
|
|
342
338
|
function a(i, s) {
|
|
343
339
|
this.name = n, i ? typeof i == "string" ? (this.message = "".concat(i).concat(s ? `
|
|
@@ -345,13 +341,13 @@ function Ra() {
|
|
|
345
341
|
}
|
|
346
342
|
return Ye(a).from(Qr), e[t] = a, e;
|
|
347
343
|
}, {});
|
|
348
|
-
|
|
344
|
+
$.Syntax = SyntaxError, $.Type = TypeError, $.Range = RangeError;
|
|
349
345
|
var Zn = ut.reduce(function(e, t) {
|
|
350
|
-
return e[t + "Error"] =
|
|
346
|
+
return e[t + "Error"] = $[t], e;
|
|
351
347
|
}, {}), Ot = ge.reduce(function(e, t) {
|
|
352
|
-
return ["Syntax", "Type", "Range"].indexOf(t) === -1 && (e[t + "Error"] =
|
|
348
|
+
return ["Syntax", "Type", "Range"].indexOf(t) === -1 && (e[t + "Error"] = $[t]), e;
|
|
353
349
|
}, {});
|
|
354
|
-
function
|
|
350
|
+
function J() {
|
|
355
351
|
}
|
|
356
352
|
function st(e) {
|
|
357
353
|
return e;
|
|
@@ -366,8 +362,8 @@ function Ra() {
|
|
|
366
362
|
e.apply(this, arguments), t.apply(this, arguments);
|
|
367
363
|
};
|
|
368
364
|
}
|
|
369
|
-
function
|
|
370
|
-
return e ===
|
|
365
|
+
function Jr(e, t) {
|
|
366
|
+
return e === J ? t : function() {
|
|
371
367
|
var n = e.apply(this, arguments);
|
|
372
368
|
n !== void 0 && (arguments[0] = n);
|
|
373
369
|
var a = this.onsuccess, i = this.onerror;
|
|
@@ -376,28 +372,28 @@ function Ra() {
|
|
|
376
372
|
return a && (this.onsuccess = this.onsuccess ? je(a, this.onsuccess) : a), i && (this.onerror = this.onerror ? je(i, this.onerror) : i), s !== void 0 ? s : n;
|
|
377
373
|
};
|
|
378
374
|
}
|
|
379
|
-
function
|
|
380
|
-
return e ===
|
|
375
|
+
function Vr(e, t) {
|
|
376
|
+
return e === J ? t : function() {
|
|
381
377
|
e.apply(this, arguments);
|
|
382
378
|
var n = this.onsuccess, a = this.onerror;
|
|
383
379
|
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? je(n, this.onsuccess) : n), a && (this.onerror = this.onerror ? je(a, this.onerror) : a);
|
|
384
380
|
};
|
|
385
381
|
}
|
|
386
382
|
function Zr(e, t) {
|
|
387
|
-
return e ===
|
|
383
|
+
return e === J ? t : function(n) {
|
|
388
384
|
var a = e.apply(this, arguments);
|
|
389
|
-
|
|
385
|
+
M(n, a);
|
|
390
386
|
var i = this.onsuccess, s = this.onerror;
|
|
391
|
-
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ? je(i, this.onsuccess) : i), s && (this.onerror = this.onerror ? je(s, this.onerror) : s), a === void 0 ? n === void 0 ? void 0 : n :
|
|
387
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ? je(i, this.onsuccess) : i), s && (this.onerror = this.onerror ? je(s, this.onerror) : s), a === void 0 ? n === void 0 ? void 0 : n : M(a, n);
|
|
392
388
|
};
|
|
393
389
|
}
|
|
394
390
|
function qr(e, t) {
|
|
395
|
-
return e ===
|
|
391
|
+
return e === J ? t : function() {
|
|
396
392
|
return t.apply(this, arguments) !== !1 && e.apply(this, arguments);
|
|
397
393
|
};
|
|
398
394
|
}
|
|
399
395
|
function sn(e, t) {
|
|
400
|
-
return e ===
|
|
396
|
+
return e === J ? t : function() {
|
|
401
397
|
var n = e.apply(this, arguments);
|
|
402
398
|
if (n && typeof n.then == "function") {
|
|
403
399
|
for (var a = this, i = arguments.length, s = new Array(i); i--; ) s[i] = arguments[i];
|
|
@@ -408,7 +404,7 @@ function Ra() {
|
|
|
408
404
|
return t.apply(this, arguments);
|
|
409
405
|
};
|
|
410
406
|
}
|
|
411
|
-
Ot.ModifyError = Et, Ot.DexieError = Xe, Ot.BulkError =
|
|
407
|
+
Ot.ModifyError = Et, Ot.DexieError = Xe, Ot.BulkError = Je;
|
|
412
408
|
var me = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
413
409
|
function qn(e) {
|
|
414
410
|
me = e;
|
|
@@ -420,11 +416,11 @@ function Ra() {
|
|
|
420
416
|
return [t, X(t), e];
|
|
421
417
|
}(), ut = Ne[0], ge = Ne[1], Ne = Ne[2], ge = ge && ge.then, Ke = ut && ut.constructor, on = !!Ne, ct = function(e, t) {
|
|
422
418
|
lt.push([e, t]), xt && (queueMicrotask(ta), xt = !1);
|
|
423
|
-
}, un = !0, xt = !0, Be = [], At = [], cn = st, Ae = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled:
|
|
419
|
+
}, un = !0, xt = !0, Be = [], At = [], cn = st, Ae = { id: "global", global: !0, ref: 0, unhandleds: [], onunhandled: J, pgp: !1, env: {}, finalize: J }, G = Ae, lt = [], Le = 0, kt = [];
|
|
424
420
|
function B(e) {
|
|
425
421
|
if (typeof this != "object") throw new TypeError("Promises must be constructed via new");
|
|
426
422
|
this._listeners = [], this._lib = !1;
|
|
427
|
-
var t = this._PSD =
|
|
423
|
+
var t = this._PSD = G;
|
|
428
424
|
if (typeof e != "function") {
|
|
429
425
|
if (e !== ot) throw new TypeError("Not a function");
|
|
430
426
|
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && dn(this, this._value));
|
|
@@ -434,7 +430,7 @@ function Ra() {
|
|
|
434
430
|
i(function(s) {
|
|
435
431
|
if (a._state === null) {
|
|
436
432
|
if (s === a) throw new TypeError("A promise cannot be resolved with itself.");
|
|
437
|
-
var u = a._lib &&
|
|
433
|
+
var u = a._lib && Ve();
|
|
438
434
|
s && typeof s.then == "function" ? n(a, function(c, h) {
|
|
439
435
|
s instanceof B ? s._then(c, h) : s.then(c, h);
|
|
440
436
|
}) : (a._state = !0, a._value = s, nr(a)), u && Ze();
|
|
@@ -446,9 +442,9 @@ function Ra() {
|
|
|
446
442
|
}(this, e);
|
|
447
443
|
}
|
|
448
444
|
var ln = { get: function() {
|
|
449
|
-
var e =
|
|
445
|
+
var e = G, t = Ct;
|
|
450
446
|
function n(a, i) {
|
|
451
|
-
var s = this, u = !e.global && (e !==
|
|
447
|
+
var s = this, u = !e.global && (e !== G || t !== Ct), c = u && !De(), h = new B(function(y, v) {
|
|
452
448
|
fn(s, new tr(ar(a, e, u, c), ar(i, e, u, c), y, v, e));
|
|
453
449
|
});
|
|
454
450
|
return this._consoleTask && (h._consoleTask = this._consoleTask), h;
|
|
@@ -464,7 +460,7 @@ function Ra() {
|
|
|
464
460
|
}
|
|
465
461
|
function dn(e, t) {
|
|
466
462
|
var n, a;
|
|
467
|
-
At.push(t), e._state === null && (n = e._lib &&
|
|
463
|
+
At.push(t), e._state === null && (n = e._lib && Ve(), t = cn(t), e._state = !1, e._value = t, a = e, Be.some(function(i) {
|
|
468
464
|
return i._value === a._value;
|
|
469
465
|
}) || Be.push(a), nr(e), n && Ze());
|
|
470
466
|
}
|
|
@@ -500,10 +496,10 @@ function Ra() {
|
|
|
500
496
|
}
|
|
501
497
|
function ta() {
|
|
502
498
|
Ge(Ae, function() {
|
|
503
|
-
|
|
499
|
+
Ve() && Ze();
|
|
504
500
|
});
|
|
505
501
|
}
|
|
506
|
-
function
|
|
502
|
+
function Ve() {
|
|
507
503
|
var e = un;
|
|
508
504
|
return xt = un = !1, e;
|
|
509
505
|
}
|
|
@@ -528,9 +524,9 @@ function Ra() {
|
|
|
528
524
|
return new B(ot, !1, e);
|
|
529
525
|
}
|
|
530
526
|
function q(e, t) {
|
|
531
|
-
var n =
|
|
527
|
+
var n = G;
|
|
532
528
|
return function() {
|
|
533
|
-
var a =
|
|
529
|
+
var a = Ve(), i = G;
|
|
534
530
|
try {
|
|
535
531
|
return Pe(n, !0), e.apply(this, arguments);
|
|
536
532
|
} catch (s) {
|
|
@@ -541,7 +537,7 @@ function Ra() {
|
|
|
541
537
|
};
|
|
542
538
|
}
|
|
543
539
|
le(B.prototype, { then: ln, _then: function(e, t) {
|
|
544
|
-
fn(this, new tr(null, null, e, t,
|
|
540
|
+
fn(this, new tr(null, null, e, t, G));
|
|
545
541
|
}, catch: function(e) {
|
|
546
542
|
if (arguments.length === 1) return this.then(null, e);
|
|
547
543
|
var t = e, n = arguments[1];
|
|
@@ -564,12 +560,12 @@ function Ra() {
|
|
|
564
560
|
var n = this;
|
|
565
561
|
return e < 1 / 0 ? new B(function(a, i) {
|
|
566
562
|
var s = setTimeout(function() {
|
|
567
|
-
return i(new
|
|
563
|
+
return i(new $.Timeout(t));
|
|
568
564
|
}, e);
|
|
569
565
|
n.then(a, i).finally(clearTimeout.bind(null, s));
|
|
570
566
|
}) : this;
|
|
571
567
|
} }), typeof Symbol < "u" && Symbol.toStringTag && xe(B.prototype, Symbol.toStringTag, "Dexie.Promise"), Ae.env = rr(), le(B, { all: function() {
|
|
572
|
-
var e =
|
|
568
|
+
var e = Se.apply(null, arguments).map(Rt);
|
|
573
569
|
return new B(function(t, n) {
|
|
574
570
|
e.length === 0 && t([]);
|
|
575
571
|
var a = e.length;
|
|
@@ -584,16 +580,16 @@ function Ra() {
|
|
|
584
580
|
e.then(t, n);
|
|
585
581
|
}) : new B(ot, !0, e);
|
|
586
582
|
}, reject: Dt, race: function() {
|
|
587
|
-
var e =
|
|
583
|
+
var e = Se.apply(null, arguments).map(Rt);
|
|
588
584
|
return new B(function(t, n) {
|
|
589
585
|
e.map(function(a) {
|
|
590
586
|
return B.resolve(a).then(t, n);
|
|
591
587
|
});
|
|
592
588
|
});
|
|
593
589
|
}, PSD: { get: function() {
|
|
594
|
-
return
|
|
590
|
+
return G;
|
|
595
591
|
}, set: function(e) {
|
|
596
|
-
return
|
|
592
|
+
return G = e;
|
|
597
593
|
} }, totalEchoes: { get: function() {
|
|
598
594
|
return Ct;
|
|
599
595
|
} }, newPSD: ke, usePSD: Ge, scheduler: { get: function() {
|
|
@@ -607,7 +603,7 @@ function Ra() {
|
|
|
607
603
|
} }, follow: function(e, t) {
|
|
608
604
|
return new B(function(n, a) {
|
|
609
605
|
return ke(function(i, s) {
|
|
610
|
-
var u =
|
|
606
|
+
var u = G;
|
|
611
607
|
u.unhandleds = [], u.onunhandled = s, u.finalize = je(function() {
|
|
612
608
|
var c, h = this;
|
|
613
609
|
c = function() {
|
|
@@ -621,7 +617,7 @@ function Ra() {
|
|
|
621
617
|
}, t, n, a);
|
|
622
618
|
});
|
|
623
619
|
} }), Ke && (Ke.allSettled && xe(B, "allSettled", function() {
|
|
624
|
-
var e =
|
|
620
|
+
var e = Se.apply(null, arguments).map(Rt);
|
|
625
621
|
return new B(function(t) {
|
|
626
622
|
e.length === 0 && t([]);
|
|
627
623
|
var n = e.length, a = new Array(n);
|
|
@@ -636,7 +632,7 @@ function Ra() {
|
|
|
636
632
|
});
|
|
637
633
|
});
|
|
638
634
|
}), Ke.any && typeof AggregateError < "u" && xe(B, "any", function() {
|
|
639
|
-
var e =
|
|
635
|
+
var e = Se.apply(null, arguments).map(Rt);
|
|
640
636
|
return new B(function(t, n) {
|
|
641
637
|
e.length === 0 && n(new AggregateError([]));
|
|
642
638
|
var a = e.length, i = new Array(a);
|
|
@@ -651,8 +647,8 @@ function Ra() {
|
|
|
651
647
|
}), Ke.withResolvers && (B.withResolvers = Ke.withResolvers));
|
|
652
648
|
var ae = { awaits: 0, echoes: 0, id: 0 }, na = 0, Pt = [], It = 0, Ct = 0, ra = 0;
|
|
653
649
|
function ke(e, t, n, a) {
|
|
654
|
-
var i =
|
|
655
|
-
return s.parent = i, s.ref = 0, s.global = !1, s.id = ++ra, Ae.env, s.env = on ? { Promise: B, PromiseProp: { value: B, configurable: !0, writable: !0 }, all: B.all, race: B.race, allSettled: B.allSettled, any: B.any, resolve: B.resolve, reject: B.reject } : {}, t &&
|
|
650
|
+
var i = G, s = Object.create(i);
|
|
651
|
+
return s.parent = i, s.ref = 0, s.global = !1, s.id = ++ra, Ae.env, s.env = on ? { Promise: B, PromiseProp: { value: B, configurable: !0, writable: !0 }, all: B.all, race: B.race, allSettled: B.allSettled, any: B.any, resolve: B.resolve, reject: B.reject } : {}, t && M(s, t), ++i.ref, s.finalize = function() {
|
|
656
652
|
--this.parent.ref || this.parent.finalize();
|
|
657
653
|
}, a = Ge(s, e, n, a), s.ref === 0 && s.finalize(), a;
|
|
658
654
|
}
|
|
@@ -674,17 +670,17 @@ function Ra() {
|
|
|
674
670
|
Pt.pop(), Pe(e, !1);
|
|
675
671
|
}
|
|
676
672
|
function Pe(e, t) {
|
|
677
|
-
var n, a =
|
|
678
|
-
(t ? !ae.echoes || It++ && e ===
|
|
679
|
-
++Ct, ae.echoes && --ae.echoes != 0 || (ae.echoes = ae.awaits = ae.id = 0), Pt.push(
|
|
680
|
-
}).bind(null, e) : aa), e !==
|
|
673
|
+
var n, a = G;
|
|
674
|
+
(t ? !ae.echoes || It++ && e === G : !It || --It && e === G) || queueMicrotask(t ? (function(i) {
|
|
675
|
+
++Ct, ae.echoes && --ae.echoes != 0 || (ae.echoes = ae.awaits = ae.id = 0), Pt.push(G), Pe(i, !0);
|
|
676
|
+
}).bind(null, e) : aa), e !== G && (G = e, a === Ae && (Ae.env = rr()), on && (n = Ae.env.Promise, t = e.env, (a.global || e.global) && (Object.defineProperty(D, "Promise", t.PromiseProp), n.all = t.all, n.race = t.race, n.resolve = t.resolve, n.reject = t.reject, t.allSettled && (n.allSettled = t.allSettled), t.any && (n.any = t.any))));
|
|
681
677
|
}
|
|
682
678
|
function rr() {
|
|
683
679
|
var e = D.Promise;
|
|
684
680
|
return on ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(D, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
|
|
685
681
|
}
|
|
686
682
|
function Ge(e, t, n, a, i) {
|
|
687
|
-
var s =
|
|
683
|
+
var s = G;
|
|
688
684
|
try {
|
|
689
685
|
return Pe(e, !0), t(n, a, i);
|
|
690
686
|
} finally {
|
|
@@ -693,7 +689,7 @@ function Ra() {
|
|
|
693
689
|
}
|
|
694
690
|
function ar(e, t, n, a) {
|
|
695
691
|
return typeof e != "function" ? e : function() {
|
|
696
|
-
var i =
|
|
692
|
+
var i = G;
|
|
697
693
|
n && qe(), Pe(t, !0);
|
|
698
694
|
try {
|
|
699
695
|
return e.apply(this, arguments);
|
|
@@ -705,8 +701,8 @@ function Ra() {
|
|
|
705
701
|
function pn(e) {
|
|
706
702
|
Promise === Ke && ae.echoes === 0 ? It === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
707
703
|
}
|
|
708
|
-
("" + ge).indexOf("[native code]") === -1 && (qe = De =
|
|
709
|
-
var te = B.reject, $e = "",
|
|
704
|
+
("" + ge).indexOf("[native code]") === -1 && (qe = De = J);
|
|
705
|
+
var te = B.reject, $e = "", _e = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", ir = "String expected.", et = [], Tt = "__dbnames", gn = "readonly", yn = "readwrite";
|
|
710
706
|
function Ue(e, t) {
|
|
711
707
|
return e ? t ? function() {
|
|
712
708
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -721,7 +717,7 @@ function Ra() {
|
|
|
721
717
|
};
|
|
722
718
|
}
|
|
723
719
|
function or() {
|
|
724
|
-
throw
|
|
720
|
+
throw $.Type();
|
|
725
721
|
}
|
|
726
722
|
function Y(e, t) {
|
|
727
723
|
try {
|
|
@@ -758,28 +754,28 @@ function Ra() {
|
|
|
758
754
|
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
|
|
759
755
|
}
|
|
760
756
|
var lr = (Z.prototype._trans = function(e, t, n) {
|
|
761
|
-
var a = this._tx ||
|
|
757
|
+
var a = this._tx || G.trans, i = this.name, s = me && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
762
758
|
function u(y, v, f) {
|
|
763
|
-
if (!f.schema[i]) throw new
|
|
759
|
+
if (!f.schema[i]) throw new $.NotFound("Table " + i + " not part of transaction");
|
|
764
760
|
return t(f.idbtrans, f);
|
|
765
761
|
}
|
|
766
|
-
var c =
|
|
762
|
+
var c = Ve();
|
|
767
763
|
try {
|
|
768
|
-
var h = a && a.db._novip === this.db._novip ? a ===
|
|
764
|
+
var h = a && a.db._novip === this.db._novip ? a === G.trans ? a._promise(e, u, n) : ke(function() {
|
|
769
765
|
return a._promise(e, u, n);
|
|
770
|
-
}, { trans: a, transless:
|
|
771
|
-
if (v.idbdb && (v._state.openComplete ||
|
|
772
|
-
var b = v._createTransaction(f,
|
|
766
|
+
}, { trans: a, transless: G.transless || G }) : function y(v, f, S, p) {
|
|
767
|
+
if (v.idbdb && (v._state.openComplete || G.letThrough || v._vip)) {
|
|
768
|
+
var b = v._createTransaction(f, S, v._dbSchema);
|
|
773
769
|
try {
|
|
774
770
|
b.create(), v._state.PR1398_maxLoop = 3;
|
|
775
771
|
} catch (w) {
|
|
776
772
|
return w.name === an.InvalidState && v.isOpen() && 0 < --v._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), v.close({ disableAutoOpen: !1 }), v.open().then(function() {
|
|
777
|
-
return y(v, f,
|
|
773
|
+
return y(v, f, S, p);
|
|
778
774
|
})) : te(w);
|
|
779
775
|
}
|
|
780
776
|
return b._promise(f, function(w, m) {
|
|
781
777
|
return ke(function() {
|
|
782
|
-
return
|
|
778
|
+
return G.trans = b, p(w, m, b);
|
|
783
779
|
});
|
|
784
780
|
}).then(function(w) {
|
|
785
781
|
if (f === "readwrite") try {
|
|
@@ -791,13 +787,13 @@ function Ra() {
|
|
|
791
787
|
});
|
|
792
788
|
});
|
|
793
789
|
}
|
|
794
|
-
if (v._state.openComplete) return te(new
|
|
790
|
+
if (v._state.openComplete) return te(new $.DatabaseClosed(v._state.dbOpenError));
|
|
795
791
|
if (!v._state.isBeingOpened) {
|
|
796
|
-
if (!v._state.autoOpen) return te(new
|
|
797
|
-
v.open().catch(
|
|
792
|
+
if (!v._state.autoOpen) return te(new $.DatabaseClosed());
|
|
793
|
+
v.open().catch(J);
|
|
798
794
|
}
|
|
799
795
|
return v._state.dbReadyPromise.then(function() {
|
|
800
|
-
return y(v, f,
|
|
796
|
+
return y(v, f, S, p);
|
|
801
797
|
});
|
|
802
798
|
}(this.db, e, [this.name], u);
|
|
803
799
|
return s && (h._consoleTask = s, h = h.catch(function(y) {
|
|
@@ -808,14 +804,14 @@ function Ra() {
|
|
|
808
804
|
}
|
|
809
805
|
}, Z.prototype.get = function(e, t) {
|
|
810
806
|
var n = this;
|
|
811
|
-
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? te(new
|
|
807
|
+
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? te(new $.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(a) {
|
|
812
808
|
return n.core.get({ trans: a, key: e }).then(function(i) {
|
|
813
809
|
return n.hook.reading.fire(i);
|
|
814
810
|
});
|
|
815
811
|
}).then(t);
|
|
816
812
|
}, Z.prototype.where = function(e) {
|
|
817
813
|
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
818
|
-
if (
|
|
814
|
+
if (U(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
|
|
819
815
|
var t = K(e);
|
|
820
816
|
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
821
817
|
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(c) {
|
|
@@ -841,13 +837,13 @@ function Ra() {
|
|
|
841
837
|
return Y(c, h) === 0;
|
|
842
838
|
}
|
|
843
839
|
var u = t.reduce(function(f, h) {
|
|
844
|
-
var y = f[0], v = f[1], f = a[h],
|
|
840
|
+
var y = f[0], v = f[1], f = a[h], S = e[h];
|
|
845
841
|
return [y || f, y || !f ? Ue(v, f && f.multi ? function(p) {
|
|
846
|
-
return p = we(p, h),
|
|
847
|
-
return i(
|
|
842
|
+
return p = we(p, h), U(p) && p.some(function(b) {
|
|
843
|
+
return i(S, b);
|
|
848
844
|
});
|
|
849
845
|
} : function(p) {
|
|
850
|
-
return i(
|
|
846
|
+
return i(S, we(p, h));
|
|
851
847
|
}) : v];
|
|
852
848
|
}, [null, null]), s = u[0], u = u[1];
|
|
853
849
|
return s ? this.where(s.name).equals(e[s.keyPath]).filter(u) : n ? this.filter(u) : this.where(t).equals("");
|
|
@@ -866,7 +862,7 @@ function Ra() {
|
|
|
866
862
|
}, Z.prototype.toCollection = function() {
|
|
867
863
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
868
864
|
}, Z.prototype.orderBy = function(e) {
|
|
869
|
-
return new this.db.Collection(new this.db.WhereClause(this,
|
|
865
|
+
return new this.db.Collection(new this.db.WhereClause(this, U(e) ? "[".concat(e.join("+"), "]") : e));
|
|
870
866
|
}, Z.prototype.reverse = function() {
|
|
871
867
|
return this.toCollection().reverse();
|
|
872
868
|
}, Z.prototype.mapToClass = function(e) {
|
|
@@ -900,7 +896,7 @@ function Ra() {
|
|
|
900
896
|
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = c, this.hook("reading", c), e;
|
|
901
897
|
}, Z.prototype.defineClass = function() {
|
|
902
898
|
return this.mapToClass(function(e) {
|
|
903
|
-
|
|
899
|
+
M(this, e);
|
|
904
900
|
});
|
|
905
901
|
}, Z.prototype.add = function(e, t) {
|
|
906
902
|
var n = this, a = this.schema.primKey, i = a.auto, s = a.keyPath, u = e;
|
|
@@ -916,7 +912,7 @@ function Ra() {
|
|
|
916
912
|
return c;
|
|
917
913
|
});
|
|
918
914
|
}, Z.prototype.update = function(e, t) {
|
|
919
|
-
return typeof e != "object" ||
|
|
915
|
+
return typeof e != "object" || U(e) ? this.where(":id").equals(e).modify(t) : (e = we(e, this.schema.primKey.keyPath), e === void 0 ? te(new $.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
920
916
|
}, Z.prototype.put = function(e, t) {
|
|
921
917
|
var n = this, a = this.schema.primKey, i = a.auto, s = a.keyPath, u = e;
|
|
922
918
|
return s && i && (u = Mt(s)(e)), this._trans("readwrite", function(c) {
|
|
@@ -957,26 +953,26 @@ function Ra() {
|
|
|
957
953
|
var a = this, i = Array.isArray(t) ? t : void 0, s = (n = n || (i ? void 0 : t)) ? n.allKeys : void 0;
|
|
958
954
|
return this._trans("readwrite", function(u) {
|
|
959
955
|
var y = a.schema.primKey, c = y.auto, y = y.keyPath;
|
|
960
|
-
if (y && i) throw new
|
|
961
|
-
if (i && i.length !== e.length) throw new
|
|
956
|
+
if (y && i) throw new $.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
957
|
+
if (i && i.length !== e.length) throw new $.InvalidArgument("Arguments objects and keys must have the same length");
|
|
962
958
|
var h = e.length, y = y && c ? e.map(Mt(y)) : e;
|
|
963
959
|
return a.core.mutate({ trans: u, type: "add", keys: i, values: y, wantResults: s }).then(function(b) {
|
|
964
|
-
var f = b.numFailures,
|
|
965
|
-
if (f === 0) return s ?
|
|
966
|
-
throw new
|
|
960
|
+
var f = b.numFailures, S = b.results, p = b.lastResult, b = b.failures;
|
|
961
|
+
if (f === 0) return s ? S : p;
|
|
962
|
+
throw new Je("".concat(a.name, ".bulkAdd(): ").concat(f, " of ").concat(h, " operations failed"), b);
|
|
967
963
|
});
|
|
968
964
|
});
|
|
969
965
|
}, Z.prototype.bulkPut = function(e, t, n) {
|
|
970
966
|
var a = this, i = Array.isArray(t) ? t : void 0, s = (n = n || (i ? void 0 : t)) ? n.allKeys : void 0;
|
|
971
967
|
return this._trans("readwrite", function(u) {
|
|
972
968
|
var y = a.schema.primKey, c = y.auto, y = y.keyPath;
|
|
973
|
-
if (y && i) throw new
|
|
974
|
-
if (i && i.length !== e.length) throw new
|
|
969
|
+
if (y && i) throw new $.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
970
|
+
if (i && i.length !== e.length) throw new $.InvalidArgument("Arguments objects and keys must have the same length");
|
|
975
971
|
var h = e.length, y = y && c ? e.map(Mt(y)) : e;
|
|
976
972
|
return a.core.mutate({ trans: u, type: "put", keys: i, values: y, wantResults: s }).then(function(b) {
|
|
977
|
-
var f = b.numFailures,
|
|
978
|
-
if (f === 0) return s ?
|
|
979
|
-
throw new
|
|
973
|
+
var f = b.numFailures, S = b.results, p = b.lastResult, b = b.failures;
|
|
974
|
+
if (f === 0) return s ? S : p;
|
|
975
|
+
throw new Je("".concat(a.name, ".bulkPut(): ").concat(f, " of ").concat(h, " operations failed"), b);
|
|
980
976
|
});
|
|
981
977
|
});
|
|
982
978
|
}, Z.prototype.bulkUpdate = function(e) {
|
|
@@ -988,27 +984,27 @@ function Ra() {
|
|
|
988
984
|
return this._trans("readwrite", function(u) {
|
|
989
985
|
return n.getMany({ trans: u, keys: a, cache: "clone" }).then(function(c) {
|
|
990
986
|
var h = [], y = [];
|
|
991
|
-
e.forEach(function(f,
|
|
992
|
-
var p = f.key, b = f.changes, w = c[
|
|
987
|
+
e.forEach(function(f, S) {
|
|
988
|
+
var p = f.key, b = f.changes, w = c[S];
|
|
993
989
|
if (w) {
|
|
994
|
-
for (var m = 0,
|
|
995
|
-
var E =
|
|
990
|
+
for (var m = 0, _ = Object.keys(b); m < _.length; m++) {
|
|
991
|
+
var E = _[m], O = b[E];
|
|
996
992
|
if (E === t.schema.primKey.keyPath) {
|
|
997
|
-
if (Y(O, p) !== 0) throw new
|
|
993
|
+
if (Y(O, p) !== 0) throw new $.Constraint("Cannot update primary key in bulkUpdate()");
|
|
998
994
|
} else fe(w, E, O);
|
|
999
995
|
}
|
|
1000
|
-
s.push(
|
|
996
|
+
s.push(S), h.push(p), y.push(w);
|
|
1001
997
|
}
|
|
1002
998
|
});
|
|
1003
999
|
var v = h.length;
|
|
1004
1000
|
return n.mutate({ trans: u, type: "put", keys: h, values: y, updates: { keys: a, changeSpecs: i } }).then(function(f) {
|
|
1005
|
-
var
|
|
1006
|
-
if (
|
|
1001
|
+
var S = f.numFailures, p = f.failures;
|
|
1002
|
+
if (S === 0) return v;
|
|
1007
1003
|
for (var b = 0, w = Object.keys(p); b < w.length; b++) {
|
|
1008
|
-
var m,
|
|
1009
|
-
E != null && (m = p[
|
|
1004
|
+
var m, _ = w[b], E = s[Number(_)];
|
|
1005
|
+
E != null && (m = p[_], delete p[_], p[E] = m);
|
|
1010
1006
|
}
|
|
1011
|
-
throw new
|
|
1007
|
+
throw new Je("".concat(t.name, ".bulkUpdate(): ").concat(S, " of ").concat(v, " operations failed"), p);
|
|
1012
1008
|
});
|
|
1013
1009
|
});
|
|
1014
1010
|
});
|
|
@@ -1019,7 +1015,7 @@ function Ra() {
|
|
|
1019
1015
|
}).then(function(u) {
|
|
1020
1016
|
var i = u.numFailures, s = u.lastResult, u = u.failures;
|
|
1021
1017
|
if (i === 0) return s;
|
|
1022
|
-
throw new
|
|
1018
|
+
throw new Je("".concat(t.name, ".bulkDelete(): ").concat(i, " of ").concat(n, " operations failed"), u);
|
|
1023
1019
|
});
|
|
1024
1020
|
}, Z);
|
|
1025
1021
|
function Z() {
|
|
@@ -1040,20 +1036,20 @@ function Ra() {
|
|
|
1040
1036
|
if (typeof u != "object") {
|
|
1041
1037
|
var y;
|
|
1042
1038
|
c = c || qr;
|
|
1043
|
-
var v = { subscribers: [], fire: h = h ||
|
|
1039
|
+
var v = { subscribers: [], fire: h = h || J, subscribe: function(f) {
|
|
1044
1040
|
v.subscribers.indexOf(f) === -1 && (v.subscribers.push(f), v.fire = c(v.fire, f));
|
|
1045
1041
|
}, unsubscribe: function(f) {
|
|
1046
|
-
v.subscribers = v.subscribers.filter(function(
|
|
1047
|
-
return
|
|
1042
|
+
v.subscribers = v.subscribers.filter(function(S) {
|
|
1043
|
+
return S !== f;
|
|
1048
1044
|
}), v.fire = v.subscribers.reduce(c, h);
|
|
1049
1045
|
} };
|
|
1050
1046
|
return n[u] = t[u] = v;
|
|
1051
1047
|
}
|
|
1052
1048
|
K(y = u).forEach(function(f) {
|
|
1053
|
-
var
|
|
1054
|
-
if (
|
|
1049
|
+
var S = y[f];
|
|
1050
|
+
if (U(S)) s(f, y[f][0], y[f][1]);
|
|
1055
1051
|
else {
|
|
1056
|
-
if (
|
|
1052
|
+
if (S !== "asap") throw new $.InvalidArgument("Invalid event config");
|
|
1057
1053
|
var p = s(f, st, function() {
|
|
1058
1054
|
for (var b = arguments.length, w = new Array(b); b--; ) w[b] = arguments[b];
|
|
1059
1055
|
p.subscribers.forEach(function(m) {
|
|
@@ -1084,7 +1080,7 @@ function Ra() {
|
|
|
1084
1080
|
function jt(e, t) {
|
|
1085
1081
|
if (e.isPrimKey) return t.primaryKey;
|
|
1086
1082
|
var n = t.getIndexByKeyPath(e.index);
|
|
1087
|
-
if (!n) throw new
|
|
1083
|
+
if (!n) throw new $.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
|
|
1088
1084
|
return n;
|
|
1089
1085
|
}
|
|
1090
1086
|
function dr(e, t, n) {
|
|
@@ -1096,10 +1092,10 @@ function Ra() {
|
|
|
1096
1092
|
if (e.or) {
|
|
1097
1093
|
var s = {}, u = function(c, h, y) {
|
|
1098
1094
|
var v, f;
|
|
1099
|
-
i && !i(h, y, function(
|
|
1100
|
-
return h.stop(
|
|
1101
|
-
}, function(
|
|
1102
|
-
return h.fail(
|
|
1095
|
+
i && !i(h, y, function(S) {
|
|
1096
|
+
return h.stop(S);
|
|
1097
|
+
}, function(S) {
|
|
1098
|
+
return h.fail(S);
|
|
1103
1099
|
}) || ((f = "" + (v = h.primaryKey)) == "[object ArrayBuffer]" && (f = "" + new Uint8Array(v)), ee(s, f) || (s[f] = !0, t(c, h, y)));
|
|
1104
1100
|
};
|
|
1105
1101
|
return Promise.all([e.or._iterate(u, n), fr(dr(e, a, n), e.algorithm, u, !e.keysOnly && e.valueMapper)]);
|
|
@@ -1118,9 +1114,9 @@ function Ra() {
|
|
|
1118
1114
|
t && !t(s, function(c) {
|
|
1119
1115
|
return u = c;
|
|
1120
1116
|
}, function(c) {
|
|
1121
|
-
s.stop(c), u =
|
|
1117
|
+
s.stop(c), u = J;
|
|
1122
1118
|
}, function(c) {
|
|
1123
|
-
s.fail(c), u =
|
|
1119
|
+
s.fail(c), u = J;
|
|
1124
1120
|
}) || i(s.value, s, function(c) {
|
|
1125
1121
|
return u = c;
|
|
1126
1122
|
}), u();
|
|
@@ -1131,7 +1127,7 @@ function Ra() {
|
|
|
1131
1127
|
var t = this["@@propmod"];
|
|
1132
1128
|
if (t.add !== void 0) {
|
|
1133
1129
|
var n = t.add;
|
|
1134
|
-
if (
|
|
1130
|
+
if (U(n)) return x(x([], U(e) ? e : [], !0), n).sort();
|
|
1135
1131
|
if (typeof n == "number") return (Number(e) || 0) + n;
|
|
1136
1132
|
if (typeof n == "bigint") try {
|
|
1137
1133
|
return BigInt(e) + n;
|
|
@@ -1142,7 +1138,7 @@ function Ra() {
|
|
|
1142
1138
|
}
|
|
1143
1139
|
if (t.remove !== void 0) {
|
|
1144
1140
|
var a = t.remove;
|
|
1145
|
-
if (
|
|
1141
|
+
if (U(a)) return U(e) ? e.filter(function(i) {
|
|
1146
1142
|
return !a.includes(i);
|
|
1147
1143
|
}).sort() : [];
|
|
1148
1144
|
if (typeof a == "number") return Number(e) - a;
|
|
@@ -1171,7 +1167,7 @@ function Ra() {
|
|
|
1171
1167
|
return Nt(this._ctx, e, t, this._ctx.table.core);
|
|
1172
1168
|
}, Q.prototype.clone = function(e) {
|
|
1173
1169
|
var t = Object.create(this.constructor.prototype), n = Object.create(this._ctx);
|
|
1174
|
-
return e &&
|
|
1170
|
+
return e && M(n, e), t._ctx = n, t;
|
|
1175
1171
|
}, Q.prototype.raw = function() {
|
|
1176
1172
|
return this._ctx.valueMapper = null, this;
|
|
1177
1173
|
}, Q.prototype.each = function(e) {
|
|
@@ -1324,49 +1320,49 @@ function Ra() {
|
|
|
1324
1320
|
return this._write(function(a) {
|
|
1325
1321
|
var i, s, u;
|
|
1326
1322
|
u = typeof e == "function" ? e : (i = K(e), s = i.length, function(m) {
|
|
1327
|
-
for (var
|
|
1328
|
-
var O = i[E], A = e[O],
|
|
1329
|
-
A instanceof ht ? (fe(m, O, A.execute(
|
|
1323
|
+
for (var _ = !1, E = 0; E < s; ++E) {
|
|
1324
|
+
var O = i[E], A = e[O], P = we(m, O);
|
|
1325
|
+
A instanceof ht ? (fe(m, O, A.execute(P)), _ = !0) : P !== A && (fe(m, O, A), _ = !0);
|
|
1330
1326
|
}
|
|
1331
|
-
return
|
|
1327
|
+
return _;
|
|
1332
1328
|
});
|
|
1333
1329
|
var c = n.table.core, f = c.schema.primaryKey, h = f.outbound, y = f.extractKey, v = 200, f = t.db._options.modifyChunkSize;
|
|
1334
1330
|
f && (v = typeof f == "object" ? f[c.name] || f["*"] || 200 : f);
|
|
1335
|
-
function
|
|
1331
|
+
function S(m, O) {
|
|
1336
1332
|
var E = O.failures, O = O.numFailures;
|
|
1337
1333
|
b += m - O;
|
|
1338
|
-
for (var A = 0,
|
|
1339
|
-
var
|
|
1340
|
-
p.push(E[
|
|
1334
|
+
for (var A = 0, P = K(E); A < P.length; A++) {
|
|
1335
|
+
var T = P[A];
|
|
1336
|
+
p.push(E[T]);
|
|
1341
1337
|
}
|
|
1342
1338
|
}
|
|
1343
1339
|
var p = [], b = 0, w = [];
|
|
1344
1340
|
return t.clone().primaryKeys().then(function(m) {
|
|
1345
|
-
function
|
|
1341
|
+
function _(O) {
|
|
1346
1342
|
var A = Math.min(v, m.length - O);
|
|
1347
|
-
return c.getMany({ trans: a, keys: m.slice(O, O + A), cache: "immutable" }).then(function(
|
|
1348
|
-
for (var
|
|
1349
|
-
var
|
|
1350
|
-
u.call(W, W.value, W) !== !1 && (W.value == null ? j.push(m[O +
|
|
1343
|
+
return c.getMany({ trans: a, keys: m.slice(O, O + A), cache: "immutable" }).then(function(P) {
|
|
1344
|
+
for (var T = [], I = [], C = h ? [] : null, j = [], R = 0; R < A; ++R) {
|
|
1345
|
+
var L = P[R], W = { value: Te(L), primKey: m[O + R] };
|
|
1346
|
+
u.call(W, W.value, W) !== !1 && (W.value == null ? j.push(m[O + R]) : h || Y(y(L), y(W.value)) === 0 ? (I.push(W.value), h && C.push(m[O + R])) : (j.push(m[O + R]), T.push(W.value)));
|
|
1351
1347
|
}
|
|
1352
|
-
return Promise.resolve(0 <
|
|
1348
|
+
return Promise.resolve(0 < T.length && c.mutate({ trans: a, type: "add", values: T }).then(function(z) {
|
|
1353
1349
|
for (var H in z.failures) j.splice(parseInt(H), 1);
|
|
1354
|
-
|
|
1350
|
+
S(T.length, z);
|
|
1355
1351
|
})).then(function() {
|
|
1356
|
-
return (0 <
|
|
1357
|
-
return
|
|
1352
|
+
return (0 < I.length || E && typeof e == "object") && c.mutate({ trans: a, type: "put", keys: C, values: I, criteria: E, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < O }).then(function(z) {
|
|
1353
|
+
return S(I.length, z);
|
|
1358
1354
|
});
|
|
1359
1355
|
}).then(function() {
|
|
1360
1356
|
return (0 < j.length || E && e === vn) && c.mutate({ trans: a, type: "delete", keys: j, criteria: E, isAdditionalChunk: 0 < O }).then(function(z) {
|
|
1361
|
-
return
|
|
1357
|
+
return S(j.length, z);
|
|
1362
1358
|
});
|
|
1363
1359
|
}).then(function() {
|
|
1364
|
-
return m.length > O + A &&
|
|
1360
|
+
return m.length > O + A && _(O + v);
|
|
1365
1361
|
});
|
|
1366
1362
|
});
|
|
1367
1363
|
}
|
|
1368
1364
|
var E = tt(n) && n.limit === 1 / 0 && (typeof e != "function" || e === vn) && { index: n.index, range: n.range };
|
|
1369
|
-
return
|
|
1365
|
+
return _(0).then(function() {
|
|
1370
1366
|
if (0 < p.length) throw new Et("Error modifying one or more objects", p, b, w);
|
|
1371
1367
|
return m.length;
|
|
1372
1368
|
});
|
|
@@ -1411,7 +1407,7 @@ function Ra() {
|
|
|
1411
1407
|
if (!n.every(function(b) {
|
|
1412
1408
|
return typeof b == "string";
|
|
1413
1409
|
})) return he(e, ir);
|
|
1414
|
-
function
|
|
1410
|
+
function S(b) {
|
|
1415
1411
|
i = b === "next" ? function(m) {
|
|
1416
1412
|
return m.toUpperCase();
|
|
1417
1413
|
} : function(m) {
|
|
@@ -1423,8 +1419,8 @@ function Ra() {
|
|
|
1423
1419
|
}, u = b === "next" ? sa : oa;
|
|
1424
1420
|
var w = n.map(function(m) {
|
|
1425
1421
|
return { lower: s(m), upper: i(m) };
|
|
1426
|
-
}).sort(function(m,
|
|
1427
|
-
return u(m.lower,
|
|
1422
|
+
}).sort(function(m, _) {
|
|
1423
|
+
return u(m.lower, _.lower);
|
|
1428
1424
|
});
|
|
1429
1425
|
c = w.map(function(m) {
|
|
1430
1426
|
return m.upper;
|
|
@@ -1432,27 +1428,27 @@ function Ra() {
|
|
|
1432
1428
|
return m.lower;
|
|
1433
1429
|
}), v = (y = b) === "next" ? "" : a;
|
|
1434
1430
|
}
|
|
1435
|
-
|
|
1431
|
+
S("next"), e = new e.Collection(e, function() {
|
|
1436
1432
|
return Ie(c[0], h[f - 1] + a);
|
|
1437
1433
|
}), e._ondirectionchange = function(b) {
|
|
1438
|
-
|
|
1434
|
+
S(b);
|
|
1439
1435
|
};
|
|
1440
1436
|
var p = 0;
|
|
1441
1437
|
return e._addAlgorithm(function(b, w, m) {
|
|
1442
|
-
var
|
|
1443
|
-
if (typeof
|
|
1444
|
-
var E = s(
|
|
1438
|
+
var _ = b.key;
|
|
1439
|
+
if (typeof _ != "string") return !1;
|
|
1440
|
+
var E = s(_);
|
|
1445
1441
|
if (t(E, h, p)) return !0;
|
|
1446
1442
|
for (var O = null, A = p; A < f; ++A) {
|
|
1447
|
-
var
|
|
1448
|
-
for (var W = Math.min(
|
|
1449
|
-
var pe =
|
|
1450
|
-
if (pe !== j[H]) return T
|
|
1451
|
-
T
|
|
1443
|
+
var P = function(T, I, C, j, R, L) {
|
|
1444
|
+
for (var W = Math.min(T.length, j.length), z = -1, H = 0; H < W; ++H) {
|
|
1445
|
+
var pe = I[H];
|
|
1446
|
+
if (pe !== j[H]) return R(T[H], C[H]) < 0 ? T.substr(0, H) + C[H] + C.substr(H + 1) : R(T[H], j[H]) < 0 ? T.substr(0, H) + j[H] + C.substr(H + 1) : 0 <= z ? T.substr(0, z) + I[z] + C.substr(z + 1) : null;
|
|
1447
|
+
R(T[H], pe) < 0 && (z = H);
|
|
1452
1448
|
}
|
|
1453
|
-
return W < j.length &&
|
|
1454
|
-
}(
|
|
1455
|
-
|
|
1449
|
+
return W < j.length && L === "next" ? T + C.substr(T.length) : W < T.length && L === "prev" ? T.substr(0, C.length) : z < 0 ? null : T.substr(0, z) + j[z] + C.substr(z + 1);
|
|
1450
|
+
}(_, E, c[A], h[A], u, y);
|
|
1451
|
+
P === null && O === null ? p = A + 1 : (O === null || 0 < u(O, P)) && (O = P);
|
|
1456
1452
|
}
|
|
1457
1453
|
return w(O !== null ? function() {
|
|
1458
1454
|
b.continue(O + v);
|
|
@@ -1474,26 +1470,26 @@ function Ra() {
|
|
|
1474
1470
|
return Ie(e, t, !n, !a);
|
|
1475
1471
|
});
|
|
1476
1472
|
} catch {
|
|
1477
|
-
return he(this,
|
|
1473
|
+
return he(this, _e);
|
|
1478
1474
|
}
|
|
1479
1475
|
}, ie.prototype.equals = function(e) {
|
|
1480
|
-
return e == null ? he(this,
|
|
1476
|
+
return e == null ? he(this, _e) : new this.Collection(this, function() {
|
|
1481
1477
|
return pr(e);
|
|
1482
1478
|
});
|
|
1483
1479
|
}, ie.prototype.above = function(e) {
|
|
1484
|
-
return e == null ? he(this,
|
|
1480
|
+
return e == null ? he(this, _e) : new this.Collection(this, function() {
|
|
1485
1481
|
return Ie(e, void 0, !0);
|
|
1486
1482
|
});
|
|
1487
1483
|
}, ie.prototype.aboveOrEqual = function(e) {
|
|
1488
|
-
return e == null ? he(this,
|
|
1484
|
+
return e == null ? he(this, _e) : new this.Collection(this, function() {
|
|
1489
1485
|
return Ie(e, void 0, !1);
|
|
1490
1486
|
});
|
|
1491
1487
|
}, ie.prototype.below = function(e) {
|
|
1492
|
-
return e == null ? he(this,
|
|
1488
|
+
return e == null ? he(this, _e) : new this.Collection(this, function() {
|
|
1493
1489
|
return Ie(void 0, e, !1, !0);
|
|
1494
1490
|
});
|
|
1495
1491
|
}, ie.prototype.belowOrEqual = function(e) {
|
|
1496
|
-
return e == null ? he(this,
|
|
1492
|
+
return e == null ? he(this, _e) : new this.Collection(this, function() {
|
|
1497
1493
|
return Ie(void 0, e);
|
|
1498
1494
|
});
|
|
1499
1495
|
}, ie.prototype.startsWith = function(e) {
|
|
@@ -1507,23 +1503,23 @@ function Ra() {
|
|
|
1507
1503
|
return t === n[0];
|
|
1508
1504
|
}, [e], "");
|
|
1509
1505
|
}, ie.prototype.anyOfIgnoreCase = function() {
|
|
1510
|
-
var e =
|
|
1506
|
+
var e = Se.apply(Qe, arguments);
|
|
1511
1507
|
return e.length === 0 ? nt(this) : Kt(this, function(t, n) {
|
|
1512
1508
|
return n.indexOf(t) !== -1;
|
|
1513
1509
|
}, e, "");
|
|
1514
1510
|
}, ie.prototype.startsWithAnyOfIgnoreCase = function() {
|
|
1515
|
-
var e =
|
|
1511
|
+
var e = Se.apply(Qe, arguments);
|
|
1516
1512
|
return e.length === 0 ? nt(this) : Kt(this, function(t, n) {
|
|
1517
1513
|
return n.some(function(a) {
|
|
1518
1514
|
return t.indexOf(a) === 0;
|
|
1519
1515
|
});
|
|
1520
1516
|
}, e, $e);
|
|
1521
1517
|
}, ie.prototype.anyOf = function() {
|
|
1522
|
-
var e = this, t =
|
|
1518
|
+
var e = this, t = Se.apply(Qe, arguments), n = this._cmp;
|
|
1523
1519
|
try {
|
|
1524
1520
|
t.sort(n);
|
|
1525
1521
|
} catch {
|
|
1526
|
-
return he(this,
|
|
1522
|
+
return he(this, _e);
|
|
1527
1523
|
}
|
|
1528
1524
|
if (t.length === 0) return nt(this);
|
|
1529
1525
|
var a = new this.Collection(this, function() {
|
|
@@ -1542,40 +1538,40 @@ function Ra() {
|
|
|
1542
1538
|
}, ie.prototype.notEqual = function(e) {
|
|
1543
1539
|
return this.inAnyRange([[-1 / 0, e], [e, this.db._maxKey]], { includeLowers: !1, includeUppers: !1 });
|
|
1544
1540
|
}, ie.prototype.noneOf = function() {
|
|
1545
|
-
var e =
|
|
1541
|
+
var e = Se.apply(Qe, arguments);
|
|
1546
1542
|
if (e.length === 0) return new this.Collection(this);
|
|
1547
1543
|
try {
|
|
1548
1544
|
e.sort(this._ascending);
|
|
1549
1545
|
} catch {
|
|
1550
|
-
return he(this,
|
|
1546
|
+
return he(this, _e);
|
|
1551
1547
|
}
|
|
1552
1548
|
var t = e.reduce(function(n, a) {
|
|
1553
1549
|
return n ? n.concat([[n[n.length - 1][1], a]]) : [[-1 / 0, a]];
|
|
1554
1550
|
}, null);
|
|
1555
1551
|
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
|
|
1556
|
-
}, ie.prototype.inAnyRange = function(
|
|
1552
|
+
}, ie.prototype.inAnyRange = function(_, t) {
|
|
1557
1553
|
var n = this, a = this._cmp, i = this._ascending, s = this._descending, u = this._min, c = this._max;
|
|
1558
|
-
if (
|
|
1559
|
-
if (!
|
|
1554
|
+
if (_.length === 0) return nt(this);
|
|
1555
|
+
if (!_.every(function(E) {
|
|
1560
1556
|
return E[0] !== void 0 && E[1] !== void 0 && i(E[0], E[1]) <= 0;
|
|
1561
|
-
})) return he(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",
|
|
1557
|
+
})) return he(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", $.InvalidArgument);
|
|
1562
1558
|
var h = !t || t.includeLowers !== !1, y = t && t.includeUppers === !0, v, f = i;
|
|
1563
|
-
function
|
|
1559
|
+
function S(E, O) {
|
|
1564
1560
|
return f(E[0], O[0]);
|
|
1565
1561
|
}
|
|
1566
1562
|
try {
|
|
1567
|
-
(v =
|
|
1568
|
-
for (var A = 0,
|
|
1569
|
-
var
|
|
1570
|
-
if (a(O[0],
|
|
1571
|
-
|
|
1563
|
+
(v = _.reduce(function(E, O) {
|
|
1564
|
+
for (var A = 0, P = E.length; A < P; ++A) {
|
|
1565
|
+
var T = E[A];
|
|
1566
|
+
if (a(O[0], T[1]) < 0 && 0 < a(O[1], T[0])) {
|
|
1567
|
+
T[0] = u(T[0], O[0]), T[1] = c(T[1], O[1]);
|
|
1572
1568
|
break;
|
|
1573
1569
|
}
|
|
1574
1570
|
}
|
|
1575
|
-
return A ===
|
|
1576
|
-
}, [])).sort(
|
|
1571
|
+
return A === P && E.push(O), E;
|
|
1572
|
+
}, [])).sort(S);
|
|
1577
1573
|
} catch {
|
|
1578
|
-
return he(this,
|
|
1574
|
+
return he(this, _e);
|
|
1579
1575
|
}
|
|
1580
1576
|
var p = 0, b = y ? function(E) {
|
|
1581
1577
|
return 0 < i(E, v[p][1]);
|
|
@@ -1585,19 +1581,19 @@ function Ra() {
|
|
|
1585
1581
|
return 0 < s(E, v[p][0]);
|
|
1586
1582
|
} : function(E) {
|
|
1587
1583
|
return 0 <= s(E, v[p][0]);
|
|
1588
|
-
}, m = b,
|
|
1584
|
+
}, m = b, _ = new this.Collection(this, function() {
|
|
1589
1585
|
return Ie(v[0][0], v[v.length - 1][1], !h, !y);
|
|
1590
1586
|
});
|
|
1591
|
-
return
|
|
1592
|
-
f = E === "next" ? (m = b, i) : (m = w, s), v.sort(
|
|
1593
|
-
},
|
|
1594
|
-
for (var
|
|
1595
|
-
return !b(
|
|
1587
|
+
return _._ondirectionchange = function(E) {
|
|
1588
|
+
f = E === "next" ? (m = b, i) : (m = w, s), v.sort(S);
|
|
1589
|
+
}, _._addAlgorithm(function(E, O, A) {
|
|
1590
|
+
for (var P, T = E.key; m(T); ) if (++p === v.length) return O(A), !1;
|
|
1591
|
+
return !b(P = T) && !w(P) || (n._cmp(T, v[p][1]) === 0 || n._cmp(T, v[p][0]) === 0 || O(function() {
|
|
1596
1592
|
f === i ? E.continue(v[p][0]) : E.continue(v[p][1]);
|
|
1597
1593
|
}), !1);
|
|
1598
|
-
}),
|
|
1594
|
+
}), _;
|
|
1599
1595
|
}, ie.prototype.startsWithAnyOf = function() {
|
|
1600
|
-
var e =
|
|
1596
|
+
var e = Se.apply(Qe, arguments);
|
|
1601
1597
|
return e.every(function(t) {
|
|
1602
1598
|
return typeof t == "string";
|
|
1603
1599
|
}) ? e.length === 0 ? nt(this) : this.inAnyRange(e.map(function(t) {
|
|
@@ -1615,9 +1611,9 @@ function Ra() {
|
|
|
1615
1611
|
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
1616
1612
|
}
|
|
1617
1613
|
var gt = "storagemutated", wn = "x-storagemutated-1", Ce = dt(null, gt), ua = (ve.prototype._lock = function() {
|
|
1618
|
-
return at(
|
|
1614
|
+
return at(!G.global), ++this._reculock, this._reculock !== 1 || G.global || (G.lockOwnerFor = this), this;
|
|
1619
1615
|
}, ve.prototype._unlock = function() {
|
|
1620
|
-
if (at(
|
|
1616
|
+
if (at(!G.global), --this._reculock == 0) for (G.global || (G.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked(); ) {
|
|
1621
1617
|
var e = this._blockedFuncs.shift();
|
|
1622
1618
|
try {
|
|
1623
1619
|
Ge(e[1], e[0]);
|
|
@@ -1626,35 +1622,35 @@ function Ra() {
|
|
|
1626
1622
|
}
|
|
1627
1623
|
return this;
|
|
1628
1624
|
}, ve.prototype._locked = function() {
|
|
1629
|
-
return this._reculock &&
|
|
1625
|
+
return this._reculock && G.lockOwnerFor !== this;
|
|
1630
1626
|
}, ve.prototype.create = function(e) {
|
|
1631
1627
|
var t = this;
|
|
1632
1628
|
if (!this.mode) return this;
|
|
1633
1629
|
var n = this.db.idbdb, a = this.db._state.dbOpenError;
|
|
1634
1630
|
if (at(!this.idbtrans), !e && !n) switch (a && a.name) {
|
|
1635
1631
|
case "DatabaseClosedError":
|
|
1636
|
-
throw new
|
|
1632
|
+
throw new $.DatabaseClosed(a);
|
|
1637
1633
|
case "MissingAPIError":
|
|
1638
|
-
throw new
|
|
1634
|
+
throw new $.MissingAPI(a.message, a);
|
|
1639
1635
|
default:
|
|
1640
|
-
throw new
|
|
1636
|
+
throw new $.OpenFailed(a);
|
|
1641
1637
|
}
|
|
1642
|
-
if (!this.active) throw new
|
|
1638
|
+
if (!this.active) throw new $.TransactionInactive();
|
|
1643
1639
|
return at(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = q(function(i) {
|
|
1644
1640
|
pt(i), t._reject(e.error);
|
|
1645
1641
|
}), e.onabort = q(function(i) {
|
|
1646
|
-
pt(i), t.active && t._reject(new
|
|
1642
|
+
pt(i), t.active && t._reject(new $.Abort(e.error)), t.active = !1, t.on("abort").fire(i);
|
|
1647
1643
|
}), e.oncomplete = q(function() {
|
|
1648
1644
|
t.active = !1, t._resolve(), "mutatedParts" in e && Ce.storagemutated.fire(e.mutatedParts);
|
|
1649
1645
|
}), this;
|
|
1650
1646
|
}, ve.prototype._promise = function(e, t, n) {
|
|
1651
1647
|
var a = this;
|
|
1652
|
-
if (e === "readwrite" && this.mode !== "readwrite") return te(new
|
|
1653
|
-
if (!this.active) return te(new
|
|
1648
|
+
if (e === "readwrite" && this.mode !== "readwrite") return te(new $.ReadOnly("Transaction is readonly"));
|
|
1649
|
+
if (!this.active) return te(new $.TransactionInactive());
|
|
1654
1650
|
if (this._locked()) return new B(function(s, u) {
|
|
1655
1651
|
a._blockedFuncs.push([function() {
|
|
1656
1652
|
a._promise(e, t, n).then(s, u);
|
|
1657
|
-
},
|
|
1653
|
+
}, G]);
|
|
1658
1654
|
});
|
|
1659
1655
|
if (n) return ke(function() {
|
|
1660
1656
|
var s = new B(function(u, c) {
|
|
@@ -1692,23 +1688,23 @@ function Ra() {
|
|
|
1692
1688
|
});
|
|
1693
1689
|
});
|
|
1694
1690
|
}, ve.prototype.abort = function() {
|
|
1695
|
-
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new
|
|
1691
|
+
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new $.Abort()));
|
|
1696
1692
|
}, ve.prototype.table = function(e) {
|
|
1697
1693
|
var t = this._memoizedTables || (this._memoizedTables = {});
|
|
1698
1694
|
if (ee(t, e)) return t[e];
|
|
1699
1695
|
var n = this.schema[e];
|
|
1700
|
-
if (!n) throw new
|
|
1696
|
+
if (!n) throw new $.NotFound("Table " + e + " not part of transaction");
|
|
1701
1697
|
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
1702
1698
|
}, ve);
|
|
1703
1699
|
function ve() {
|
|
1704
1700
|
}
|
|
1705
|
-
function
|
|
1701
|
+
function Sn(e, t, n, a, i, s, u) {
|
|
1706
1702
|
return { name: e, keyPath: t, unique: n, multi: a, auto: i, compound: s, src: (n && !u ? "&" : "") + (a ? "*" : "") + (i ? "++" : "") + yr(t) };
|
|
1707
1703
|
}
|
|
1708
1704
|
function yr(e) {
|
|
1709
1705
|
return typeof e == "string" ? e : e ? "[" + [].join.call(e, "+") + "]" : "";
|
|
1710
1706
|
}
|
|
1711
|
-
function
|
|
1707
|
+
function _n(e, t, n) {
|
|
1712
1708
|
return { name: e, primKey: t, indexes: n, mappedClass: null, idxByName: (a = function(i) {
|
|
1713
1709
|
return [i.name, i];
|
|
1714
1710
|
}, n.reduce(function(i, s, u) {
|
|
@@ -1752,82 +1748,82 @@ function Ra() {
|
|
|
1752
1748
|
var p = m.lower, b = m.upper, w = m.lowerOpen, m = m.upperOpen;
|
|
1753
1749
|
return p === void 0 ? b === void 0 ? null : t.upperBound(b, !!m) : b === void 0 ? t.lowerBound(p, !!w) : t.bound(p, b, !!w, !!m);
|
|
1754
1750
|
}
|
|
1755
|
-
function i(
|
|
1756
|
-
var p, b =
|
|
1757
|
-
return { name: b, schema:
|
|
1758
|
-
var m = w.trans,
|
|
1759
|
-
return new Promise(function(
|
|
1760
|
-
|
|
1761
|
-
var
|
|
1762
|
-
if (!j &&
|
|
1763
|
-
var
|
|
1751
|
+
function i(S) {
|
|
1752
|
+
var p, b = S.name;
|
|
1753
|
+
return { name: b, schema: S, mutate: function(w) {
|
|
1754
|
+
var m = w.trans, _ = w.type, E = w.keys, O = w.values, A = w.range;
|
|
1755
|
+
return new Promise(function(P, T) {
|
|
1756
|
+
P = q(P);
|
|
1757
|
+
var I = m.objectStore(b), C = I.keyPath == null, j = _ === "put" || _ === "add";
|
|
1758
|
+
if (!j && _ !== "delete" && _ !== "deleteRange") throw new Error("Invalid operation type: " + _);
|
|
1759
|
+
var R, L = (E || O || { length: 1 }).length;
|
|
1764
1760
|
if (E && O && E.length !== O.length) throw new Error("Given keys array must have same length as given values array.");
|
|
1765
|
-
if (
|
|
1761
|
+
if (L === 0) return P({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
1766
1762
|
function W(de) {
|
|
1767
1763
|
++pe, pt(de);
|
|
1768
1764
|
}
|
|
1769
1765
|
var z = [], H = [], pe = 0;
|
|
1770
|
-
if (
|
|
1771
|
-
if (A.type === 4) return
|
|
1772
|
-
A.type === 3 ? z.push(
|
|
1766
|
+
if (_ === "deleteRange") {
|
|
1767
|
+
if (A.type === 4) return P({ numFailures: pe, failures: H, results: [], lastResult: void 0 });
|
|
1768
|
+
A.type === 3 ? z.push(R = I.clear()) : z.push(R = I.delete(a(A)));
|
|
1773
1769
|
} else {
|
|
1774
|
-
var
|
|
1775
|
-
if (j) for (var ce = 0; ce <
|
|
1776
|
-
else for (ce = 0; ce <
|
|
1770
|
+
var C = j ? C ? [O, E] : [O, null] : [E, null], F = C[0], ue = C[1];
|
|
1771
|
+
if (j) for (var ce = 0; ce < L; ++ce) z.push(R = ue && ue[ce] !== void 0 ? I[_](F[ce], ue[ce]) : I[_](F[ce])), R.onerror = W;
|
|
1772
|
+
else for (ce = 0; ce < L; ++ce) z.push(R = I[_](F[ce])), R.onerror = W;
|
|
1777
1773
|
}
|
|
1778
|
-
function
|
|
1774
|
+
function Jt(de) {
|
|
1779
1775
|
de = de.target.result, z.forEach(function(ze, $n) {
|
|
1780
1776
|
return ze.error != null && (H[$n] = ze.error);
|
|
1781
|
-
}),
|
|
1777
|
+
}), P({ numFailures: pe, failures: H, results: _ === "delete" ? E : z.map(function(ze) {
|
|
1782
1778
|
return ze.result;
|
|
1783
1779
|
}), lastResult: de });
|
|
1784
1780
|
}
|
|
1785
|
-
|
|
1786
|
-
W(de),
|
|
1787
|
-
},
|
|
1781
|
+
R.onerror = function(de) {
|
|
1782
|
+
W(de), Jt(de);
|
|
1783
|
+
}, R.onsuccess = Jt;
|
|
1788
1784
|
});
|
|
1789
1785
|
}, getMany: function(w) {
|
|
1790
|
-
var m = w.trans,
|
|
1786
|
+
var m = w.trans, _ = w.keys;
|
|
1791
1787
|
return new Promise(function(E, O) {
|
|
1792
1788
|
E = q(E);
|
|
1793
|
-
for (var A,
|
|
1794
|
-
z = z.target,
|
|
1795
|
-
},
|
|
1796
|
-
|
|
1789
|
+
for (var A, P = m.objectStore(b), T = _.length, I = new Array(T), C = 0, j = 0, R = function(z) {
|
|
1790
|
+
z = z.target, I[z._pos] = z.result, ++j === C && E(I);
|
|
1791
|
+
}, L = be(O), W = 0; W < T; ++W) _[W] != null && ((A = P.get(_[W]))._pos = W, A.onsuccess = R, A.onerror = L, ++C);
|
|
1792
|
+
C === 0 && E(I);
|
|
1797
1793
|
});
|
|
1798
1794
|
}, get: function(w) {
|
|
1799
|
-
var m = w.trans,
|
|
1795
|
+
var m = w.trans, _ = w.key;
|
|
1800
1796
|
return new Promise(function(E, O) {
|
|
1801
1797
|
E = q(E);
|
|
1802
|
-
var A = m.objectStore(b).get(
|
|
1803
|
-
A.onsuccess = function(
|
|
1804
|
-
return E(
|
|
1798
|
+
var A = m.objectStore(b).get(_);
|
|
1799
|
+
A.onsuccess = function(P) {
|
|
1800
|
+
return E(P.target.result);
|
|
1805
1801
|
}, A.onerror = be(O);
|
|
1806
1802
|
});
|
|
1807
1803
|
}, query: (p = y, function(w) {
|
|
1808
|
-
return new Promise(function(m,
|
|
1804
|
+
return new Promise(function(m, _) {
|
|
1809
1805
|
m = q(m);
|
|
1810
|
-
var E, O, A,
|
|
1811
|
-
if (
|
|
1812
|
-
p ? ((
|
|
1813
|
-
return m({ result:
|
|
1814
|
-
},
|
|
1806
|
+
var E, O, A, C = w.trans, P = w.values, T = w.limit, R = w.query, I = T === 1 / 0 ? void 0 : T, j = R.index, R = R.range, C = C.objectStore(b), j = j.isPrimaryKey ? C : C.index(j.name), R = a(R);
|
|
1807
|
+
if (T === 0) return m({ result: [] });
|
|
1808
|
+
p ? ((I = P ? j.getAll(R, I) : j.getAllKeys(R, I)).onsuccess = function(L) {
|
|
1809
|
+
return m({ result: L.target.result });
|
|
1810
|
+
}, I.onerror = be(_)) : (E = 0, O = !P && "openKeyCursor" in j ? j.openKeyCursor(R) : j.openCursor(R), A = [], O.onsuccess = function(L) {
|
|
1815
1811
|
var W = O.result;
|
|
1816
|
-
return W ? (A.push(
|
|
1817
|
-
}, O.onerror = be(
|
|
1812
|
+
return W ? (A.push(P ? W.value : W.primaryKey), ++E === T ? m({ result: A }) : void W.continue()) : m({ result: A });
|
|
1813
|
+
}, O.onerror = be(_));
|
|
1818
1814
|
});
|
|
1819
1815
|
}), openCursor: function(w) {
|
|
1820
|
-
var m = w.trans,
|
|
1821
|
-
return new Promise(function(
|
|
1822
|
-
|
|
1823
|
-
var j = E.index,
|
|
1824
|
-
|
|
1825
|
-
var W, z, H, pe, F =
|
|
1816
|
+
var m = w.trans, _ = w.values, E = w.query, O = w.reverse, A = w.unique;
|
|
1817
|
+
return new Promise(function(P, T) {
|
|
1818
|
+
P = q(P);
|
|
1819
|
+
var j = E.index, I = E.range, C = m.objectStore(b), C = j.isPrimaryKey ? C : C.index(j.name), j = O ? A ? "prevunique" : "prev" : A ? "nextunique" : "next", R = !_ && "openKeyCursor" in C ? C.openKeyCursor(a(I), j) : C.openCursor(a(I), j);
|
|
1820
|
+
R.onerror = be(T), R.onsuccess = q(function(L) {
|
|
1821
|
+
var W, z, H, pe, F = R.result;
|
|
1826
1822
|
F ? (F.___id = ++ca, F.done = !1, W = F.continue.bind(F), z = (z = F.continuePrimaryKey) && z.bind(F), H = F.advance.bind(F), pe = function() {
|
|
1827
1823
|
throw new Error("Cursor not stopped");
|
|
1828
1824
|
}, F.trans = m, F.stop = F.continue = F.continuePrimaryKey = F.advance = function() {
|
|
1829
1825
|
throw new Error("Cursor not started");
|
|
1830
|
-
}, F.fail = q(
|
|
1826
|
+
}, F.fail = q(T), F.next = function() {
|
|
1831
1827
|
var ue = this, ce = 1;
|
|
1832
1828
|
return this.start(function() {
|
|
1833
1829
|
return ce-- ? ue.continue() : ue.stop();
|
|
@@ -1836,7 +1832,7 @@ function Ra() {
|
|
|
1836
1832
|
});
|
|
1837
1833
|
}, F.start = function(ue) {
|
|
1838
1834
|
function ce() {
|
|
1839
|
-
if (
|
|
1835
|
+
if (R.result) try {
|
|
1840
1836
|
ue();
|
|
1841
1837
|
} catch (de) {
|
|
1842
1838
|
F.fail(de);
|
|
@@ -1845,45 +1841,45 @@ function Ra() {
|
|
|
1845
1841
|
throw new Error("Cursor behind last entry");
|
|
1846
1842
|
}, F.stop();
|
|
1847
1843
|
}
|
|
1848
|
-
var
|
|
1849
|
-
de = q(de),
|
|
1844
|
+
var Jt = new Promise(function(de, ze) {
|
|
1845
|
+
de = q(de), R.onerror = be(ze), F.fail = ze, F.stop = function($n) {
|
|
1850
1846
|
F.stop = F.continue = F.continuePrimaryKey = F.advance = pe, de($n);
|
|
1851
1847
|
};
|
|
1852
1848
|
});
|
|
1853
|
-
return
|
|
1854
|
-
|
|
1855
|
-
}), F.continue = W, F.continuePrimaryKey = z, F.advance = H, ce(),
|
|
1856
|
-
},
|
|
1857
|
-
},
|
|
1849
|
+
return R.onsuccess = q(function(de) {
|
|
1850
|
+
R.onsuccess = ce, ce();
|
|
1851
|
+
}), F.continue = W, F.continuePrimaryKey = z, F.advance = H, ce(), Jt;
|
|
1852
|
+
}, P(F)) : P(null);
|
|
1853
|
+
}, T);
|
|
1858
1854
|
});
|
|
1859
1855
|
}, count: function(w) {
|
|
1860
|
-
var m = w.query,
|
|
1861
|
-
return new Promise(function(A,
|
|
1862
|
-
var
|
|
1863
|
-
|
|
1864
|
-
return A(
|
|
1865
|
-
}),
|
|
1856
|
+
var m = w.query, _ = w.trans, E = m.index, O = m.range;
|
|
1857
|
+
return new Promise(function(A, P) {
|
|
1858
|
+
var T = _.objectStore(b), I = E.isPrimaryKey ? T : T.index(E.name), T = a(O), I = T ? I.count(T) : I.count();
|
|
1859
|
+
I.onsuccess = q(function(C) {
|
|
1860
|
+
return A(C.target.result);
|
|
1861
|
+
}), I.onerror = be(P);
|
|
1866
1862
|
});
|
|
1867
1863
|
} };
|
|
1868
1864
|
}
|
|
1869
|
-
var s, u, c, v = (u = h, c = mr((s = e).objectStoreNames), { schema: { name: s.name, tables: c.map(function(
|
|
1870
|
-
return u.objectStore(
|
|
1871
|
-
}).map(function(
|
|
1872
|
-
var p =
|
|
1873
|
-
return
|
|
1865
|
+
var s, u, c, v = (u = h, c = mr((s = e).objectStoreNames), { schema: { name: s.name, tables: c.map(function(S) {
|
|
1866
|
+
return u.objectStore(S);
|
|
1867
|
+
}).map(function(S) {
|
|
1868
|
+
var p = S.keyPath, m = S.autoIncrement, b = U(p), w = {}, m = { name: S.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: p == null, compound: b, keyPath: p, autoIncrement: m, unique: !0, extractKey: En(p) }, indexes: mr(S.indexNames).map(function(_) {
|
|
1869
|
+
return S.index(_);
|
|
1874
1870
|
}).map(function(A) {
|
|
1875
|
-
var E = A.name, O = A.unique,
|
|
1876
|
-
return w[mt(A)] =
|
|
1877
|
-
}), getIndexByKeyPath: function(
|
|
1878
|
-
return w[mt(
|
|
1871
|
+
var E = A.name, O = A.unique, P = A.multiEntry, A = A.keyPath, P = { name: E, compound: U(A), keyPath: A, unique: O, multiEntry: P, extractKey: En(A) };
|
|
1872
|
+
return w[mt(A)] = P;
|
|
1873
|
+
}), getIndexByKeyPath: function(_) {
|
|
1874
|
+
return w[mt(_)];
|
|
1879
1875
|
} };
|
|
1880
1876
|
return w[":id"] = m.primaryKey, p != null && (w[mt(p)] = m.primaryKey), m;
|
|
1881
1877
|
}) }, hasGetAll: 0 < c.length && "getAll" in u.objectStore(c[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), h = v.schema, y = v.hasGetAll, v = h.tables.map(i), f = {};
|
|
1882
|
-
return v.forEach(function(
|
|
1883
|
-
return f[
|
|
1884
|
-
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(
|
|
1885
|
-
if (!f[
|
|
1886
|
-
return f[
|
|
1878
|
+
return v.forEach(function(S) {
|
|
1879
|
+
return f[S.name] = S;
|
|
1880
|
+
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(S) {
|
|
1881
|
+
if (!f[S]) throw new Error("Table '".concat(S, "' not found"));
|
|
1882
|
+
return f[S];
|
|
1887
1883
|
}, MIN_KEY: -1 / 0, MAX_KEY: yt(t), schema: h };
|
|
1888
1884
|
}
|
|
1889
1885
|
function da(e, t, n, a) {
|
|
@@ -1926,65 +1922,65 @@ function Ra() {
|
|
|
1926
1922
|
}
|
|
1927
1923
|
function ha(e, t, n, a) {
|
|
1928
1924
|
var i = e._dbSchema;
|
|
1929
|
-
n.objectStoreNames.contains("$meta") && !i.$meta && (i.$meta =
|
|
1925
|
+
n.objectStoreNames.contains("$meta") && !i.$meta && (i.$meta = _n("$meta", vr("")[0], []), e._storeNames.push("$meta"));
|
|
1930
1926
|
var s = e._createTransaction("readwrite", e._storeNames, i);
|
|
1931
1927
|
s.create(n), s._completion.catch(a);
|
|
1932
|
-
var u = s._reject.bind(s), c =
|
|
1928
|
+
var u = s._reject.bind(s), c = G.transless || G;
|
|
1933
1929
|
ke(function() {
|
|
1934
|
-
return
|
|
1930
|
+
return G.trans = s, G.transless = c, t !== 0 ? (Bt(e, n), y = t, ((h = s).storeNames.includes("$meta") ? h.table("$meta").get("version").then(function(v) {
|
|
1935
1931
|
return v ?? y;
|
|
1936
1932
|
}) : B.resolve(y)).then(function(v) {
|
|
1937
|
-
return
|
|
1938
|
-
return
|
|
1939
|
-
})).length !== 0 ? (v.forEach(function(
|
|
1933
|
+
return S = v, p = s, b = n, w = [], v = (f = e)._versions, m = f._dbSchema = $t(0, f.idbdb, b), (v = v.filter(function(_) {
|
|
1934
|
+
return _._cfg.version >= S;
|
|
1935
|
+
})).length !== 0 ? (v.forEach(function(_) {
|
|
1940
1936
|
w.push(function() {
|
|
1941
|
-
var E = m, O =
|
|
1937
|
+
var E = m, O = _._cfg.dbschema;
|
|
1942
1938
|
Ut(f, E, b), Ut(f, O, b), m = f._dbSchema = O;
|
|
1943
1939
|
var A = xn(E, O);
|
|
1944
1940
|
A.add.forEach(function(j) {
|
|
1945
1941
|
An(b, j[0], j[1].primKey, j[1].indexes);
|
|
1946
1942
|
}), A.change.forEach(function(j) {
|
|
1947
|
-
if (j.recreate) throw new
|
|
1948
|
-
var
|
|
1949
|
-
j.add.forEach(function(
|
|
1950
|
-
return Gt(
|
|
1951
|
-
}), j.change.forEach(function(
|
|
1952
|
-
|
|
1953
|
-
}), j.del.forEach(function(
|
|
1954
|
-
return
|
|
1943
|
+
if (j.recreate) throw new $.Upgrade("Not yet support for changing primary key");
|
|
1944
|
+
var R = b.objectStore(j.name);
|
|
1945
|
+
j.add.forEach(function(L) {
|
|
1946
|
+
return Gt(R, L);
|
|
1947
|
+
}), j.change.forEach(function(L) {
|
|
1948
|
+
R.deleteIndex(L.name), Gt(R, L);
|
|
1949
|
+
}), j.del.forEach(function(L) {
|
|
1950
|
+
return R.deleteIndex(L);
|
|
1955
1951
|
});
|
|
1956
1952
|
});
|
|
1957
|
-
var
|
|
1958
|
-
if (
|
|
1953
|
+
var P = _._cfg.contentUpgrade;
|
|
1954
|
+
if (P && _._cfg.version > S) {
|
|
1959
1955
|
Bt(f, b), p._memoizedTables = {};
|
|
1960
|
-
var
|
|
1956
|
+
var T = Qn(O);
|
|
1961
1957
|
A.del.forEach(function(j) {
|
|
1962
|
-
|
|
1963
|
-
}), On(f, [f.Transaction.prototype]), Lt(f, [f.Transaction.prototype], K(
|
|
1964
|
-
var
|
|
1965
|
-
return
|
|
1958
|
+
T[j] = E[j];
|
|
1959
|
+
}), On(f, [f.Transaction.prototype]), Lt(f, [f.Transaction.prototype], K(T), T), p.schema = T;
|
|
1960
|
+
var I, C = rn(P);
|
|
1961
|
+
return C && qe(), A = B.follow(function() {
|
|
1966
1962
|
var j;
|
|
1967
|
-
(
|
|
1968
|
-
}),
|
|
1969
|
-
return
|
|
1963
|
+
(I = P(p)) && C && (j = De.bind(null, null), I.then(j, j));
|
|
1964
|
+
}), I && typeof I.then == "function" ? B.resolve(I) : A.then(function() {
|
|
1965
|
+
return I;
|
|
1970
1966
|
});
|
|
1971
1967
|
}
|
|
1972
1968
|
}), w.push(function(E) {
|
|
1973
|
-
var O, A,
|
|
1974
|
-
O =
|
|
1975
|
-
return O[
|
|
1969
|
+
var O, A, P = _._cfg.dbschema;
|
|
1970
|
+
O = P, A = E, [].slice.call(A.db.objectStoreNames).forEach(function(T) {
|
|
1971
|
+
return O[T] == null && A.db.deleteObjectStore(T);
|
|
1976
1972
|
}), On(f, [f.Transaction.prototype]), Lt(f, [f.Transaction.prototype], f._storeNames, f._dbSchema), p.schema = f._dbSchema;
|
|
1977
1973
|
}), w.push(function(E) {
|
|
1978
|
-
f.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(f.idbdb.version / 10) ===
|
|
1974
|
+
f.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(f.idbdb.version / 10) === _._cfg.version ? (f.idbdb.deleteObjectStore("$meta"), delete f._dbSchema.$meta, f._storeNames = f._storeNames.filter(function(O) {
|
|
1979
1975
|
return O !== "$meta";
|
|
1980
|
-
})) : E.objectStore("$meta").put(
|
|
1976
|
+
})) : E.objectStore("$meta").put(_._cfg.version, "version"));
|
|
1981
1977
|
});
|
|
1982
|
-
}), function
|
|
1983
|
-
return w.length ? B.resolve(w.shift()(p.idbtrans)).then(
|
|
1978
|
+
}), function _() {
|
|
1979
|
+
return w.length ? B.resolve(w.shift()(p.idbtrans)).then(_) : B.resolve();
|
|
1984
1980
|
}().then(function() {
|
|
1985
1981
|
br(m, b);
|
|
1986
1982
|
})) : B.resolve();
|
|
1987
|
-
var f,
|
|
1983
|
+
var f, S, p, b, w, m;
|
|
1988
1984
|
}).catch(u)) : (K(i).forEach(function(v) {
|
|
1989
1985
|
An(n, v, i[v].primKey, i[v].indexes);
|
|
1990
1986
|
}), Bt(e, n), void B.follow(function() {
|
|
@@ -2045,12 +2041,12 @@ function Ra() {
|
|
|
2045
2041
|
}
|
|
2046
2042
|
function $t(e, t, n) {
|
|
2047
2043
|
var a = {};
|
|
2048
|
-
return
|
|
2049
|
-
for (var s = n.objectStore(i), u =
|
|
2050
|
-
var v = s.index(s.indexNames[h]), y = v.keyPath, v =
|
|
2044
|
+
return _t(t.objectStoreNames, 0).forEach(function(i) {
|
|
2045
|
+
for (var s = n.objectStore(i), u = Sn(yr(y = s.keyPath), y || "", !0, !1, !!s.autoIncrement, y && typeof y != "string", !0), c = [], h = 0; h < s.indexNames.length; ++h) {
|
|
2046
|
+
var v = s.index(s.indexNames[h]), y = v.keyPath, v = Sn(v.name, y, !!v.unique, !!v.multiEntry, !1, y && typeof y != "string", !1);
|
|
2051
2047
|
c.push(v);
|
|
2052
2048
|
}
|
|
2053
|
-
a[i] =
|
|
2049
|
+
a[i] = _n(i, u, c);
|
|
2054
2050
|
}), a;
|
|
2055
2051
|
}
|
|
2056
2052
|
function Ut(e, t, n) {
|
|
@@ -2058,7 +2054,7 @@ function Ra() {
|
|
|
2058
2054
|
var s = a[i], u = n.objectStore(s);
|
|
2059
2055
|
e._hasGetAll = "getAll" in u;
|
|
2060
2056
|
for (var c = 0; c < u.indexNames.length; ++c) {
|
|
2061
|
-
var h = u.indexNames[c], y = u.index(h).keyPath, v = typeof y == "string" ? y : "[" +
|
|
2057
|
+
var h = u.indexNames[c], y = u.index(h).keyPath, v = typeof y == "string" ? y : "[" + _t(y).join("+") + "]";
|
|
2062
2058
|
!t[s] || (y = t[s].idxByName[v]) && (y.name = h, delete t[s].idxByName[v], t[s].idxByName[h] = y);
|
|
2063
2059
|
}
|
|
2064
2060
|
}
|
|
@@ -2067,29 +2063,29 @@ function Ra() {
|
|
|
2067
2063
|
function vr(e) {
|
|
2068
2064
|
return e.split(",").map(function(t, n) {
|
|
2069
2065
|
var a = (t = t.trim()).replace(/([&*]|\+\+)/g, ""), i = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
2070
|
-
return
|
|
2066
|
+
return Sn(a, i || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), U(i), n === 0);
|
|
2071
2067
|
});
|
|
2072
2068
|
}
|
|
2073
2069
|
var ga = (Ft.prototype._parseStoresSpec = function(e, t) {
|
|
2074
2070
|
K(e).forEach(function(n) {
|
|
2075
2071
|
if (e[n] !== null) {
|
|
2076
2072
|
var a = vr(e[n]), i = a.shift();
|
|
2077
|
-
if (i.unique = !0, i.multi) throw new
|
|
2073
|
+
if (i.unique = !0, i.multi) throw new $.Schema("Primary key cannot be multi-valued");
|
|
2078
2074
|
a.forEach(function(s) {
|
|
2079
|
-
if (s.auto) throw new
|
|
2080
|
-
if (!s.keyPath) throw new
|
|
2081
|
-
}), t[n] =
|
|
2075
|
+
if (s.auto) throw new $.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
2076
|
+
if (!s.keyPath) throw new $.Schema("Index must have a name and cannot be an empty string");
|
|
2077
|
+
}), t[n] = _n(n, i, a);
|
|
2082
2078
|
}
|
|
2083
2079
|
});
|
|
2084
2080
|
}, Ft.prototype.stores = function(n) {
|
|
2085
2081
|
var t = this.db;
|
|
2086
|
-
this._cfg.storesSource = this._cfg.storesSource ?
|
|
2082
|
+
this._cfg.storesSource = this._cfg.storesSource ? M(this._cfg.storesSource, n) : n;
|
|
2087
2083
|
var n = t._versions, a = {}, i = {};
|
|
2088
2084
|
return n.forEach(function(s) {
|
|
2089
|
-
|
|
2085
|
+
M(a, s._cfg.storesSource), i = s._cfg.dbschema = {}, s._parseStoresSpec(a, i);
|
|
2090
2086
|
}), t._dbSchema = i, On(t, [t._allTables, t, t.Transaction.prototype]), Lt(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], K(i), i), t._storeNames = K(i), this;
|
|
2091
2087
|
}, Ft.prototype.upgrade = function(e) {
|
|
2092
|
-
return this._cfg.contentUpgrade = sn(this._cfg.contentUpgrade ||
|
|
2088
|
+
return this._cfg.contentUpgrade = sn(this._cfg.contentUpgrade || J, e), this;
|
|
2093
2089
|
}, Ft);
|
|
2094
2090
|
function Ft() {
|
|
2095
2091
|
}
|
|
@@ -2102,7 +2098,7 @@ function Ra() {
|
|
|
2102
2098
|
}
|
|
2103
2099
|
function Pn(e) {
|
|
2104
2100
|
return ke(function() {
|
|
2105
|
-
return
|
|
2101
|
+
return G.letThrough = !0, e();
|
|
2106
2102
|
});
|
|
2107
2103
|
}
|
|
2108
2104
|
function In(e) {
|
|
@@ -2111,18 +2107,18 @@ function Ra() {
|
|
|
2111
2107
|
var oe = function(e, t) {
|
|
2112
2108
|
if (!this) {
|
|
2113
2109
|
var n = new oe();
|
|
2114
|
-
return e && "d" in e &&
|
|
2110
|
+
return e && "d" in e && M(n, e), n;
|
|
2115
2111
|
}
|
|
2116
|
-
|
|
2112
|
+
M(this, arguments.length ? { d: 1, from: e, to: 1 < arguments.length ? t : e } : { d: 0 });
|
|
2117
2113
|
};
|
|
2118
2114
|
function bt(e, t, n) {
|
|
2119
2115
|
var a = Y(t, n);
|
|
2120
2116
|
if (!isNaN(a)) {
|
|
2121
2117
|
if (0 < a) throw RangeError();
|
|
2122
|
-
if (In(e)) return
|
|
2118
|
+
if (In(e)) return M(e, { from: t, to: n, d: 1 });
|
|
2123
2119
|
var i = e.l, a = e.r;
|
|
2124
|
-
if (Y(n, e.from) < 0) return i ? bt(i, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null },
|
|
2125
|
-
if (0 < Y(t, e.to)) return a ? bt(a, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null },
|
|
2120
|
+
if (Y(n, e.from) < 0) return i ? bt(i, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, Sr(e);
|
|
2121
|
+
if (0 < Y(t, e.to)) return a ? bt(a, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, Sr(e);
|
|
2126
2122
|
Y(t, e.from) < 0 && (e.from = t, e.l = null, e.d = a ? a.d + 1 : 1), 0 < Y(n, e.to) && (e.to = n, e.r = null, e.d = e.l ? e.l.d + 1 : 1), n = !e.r, i && !e.l && vt(e, i), a && n && vt(e, a);
|
|
2127
2123
|
}
|
|
2128
2124
|
}
|
|
@@ -2161,11 +2157,11 @@ function Ra() {
|
|
|
2161
2157
|
return { done: !0 };
|
|
2162
2158
|
} };
|
|
2163
2159
|
}
|
|
2164
|
-
function
|
|
2160
|
+
function Sr(e) {
|
|
2165
2161
|
var t, n, a = (((t = e.r) === null || t === void 0 ? void 0 : t.d) || 0) - (((n = e.l) === null || n === void 0 ? void 0 : n.d) || 0), i = 1 < a ? "r" : a < -1 ? "l" : "";
|
|
2166
|
-
i && (t = i == "r" ? "l" : "r", n = l({}, e), a = e[i], e.from = a.from, e.to = a.to, e[i] = a[i], n[i] = a[t], (e[t] = n).d =
|
|
2162
|
+
i && (t = i == "r" ? "l" : "r", n = l({}, e), a = e[i], e.from = a.from, e.to = a.to, e[i] = a[i], n[i] = a[t], (e[t] = n).d = _r(n)), e.d = _r(e);
|
|
2167
2163
|
}
|
|
2168
|
-
function
|
|
2164
|
+
function _r(n) {
|
|
2169
2165
|
var t = n.r, n = n.l;
|
|
2170
2166
|
return (t ? n ? Math.max(t.d, n.d) : t.d : n ? n.d : 0) + 1;
|
|
2171
2167
|
}
|
|
@@ -2173,7 +2169,7 @@ function Ra() {
|
|
|
2173
2169
|
return K(t).forEach(function(n) {
|
|
2174
2170
|
e[n] ? vt(e[n], t[n]) : e[n] = function a(i) {
|
|
2175
2171
|
var s, u, c = {};
|
|
2176
|
-
for (s in i) ee(i, s) && (u = i[s], c[s] = !u || typeof u != "object" ||
|
|
2172
|
+
for (s in i) ee(i, s) && (u = i[s], c[s] = !u || typeof u != "object" || Jn.has(u.constructor) ? u : a(u));
|
|
2177
2173
|
return c;
|
|
2178
2174
|
}(t[n]);
|
|
2179
2175
|
}), e;
|
|
@@ -2219,10 +2215,10 @@ function Ra() {
|
|
|
2219
2215
|
function Er(e, t, n, a) {
|
|
2220
2216
|
for (var i = [], s = 0, u = Object.entries(e.queries.query); s < u.length; s++) {
|
|
2221
2217
|
for (var c = u[s], h = c[0], y = [], v = 0, f = c[1]; v < f.length; v++) {
|
|
2222
|
-
var
|
|
2223
|
-
Cn(t,
|
|
2218
|
+
var S = f[v];
|
|
2219
|
+
Cn(t, S.obsSet) ? S.subscribers.forEach(function(m) {
|
|
2224
2220
|
return n.add(m);
|
|
2225
|
-
}) : a && y.push(
|
|
2221
|
+
}) : a && y.push(S);
|
|
2226
2222
|
}
|
|
2227
2223
|
a && i.push([h, y]);
|
|
2228
2224
|
}
|
|
@@ -2239,51 +2235,51 @@ function Ra() {
|
|
|
2239
2235
|
t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
|
|
2240
2236
|
var a = t.openCanceller, i = Math.round(10 * e.verno), s = !1;
|
|
2241
2237
|
function u() {
|
|
2242
|
-
if (t.openCanceller !== a) throw new
|
|
2238
|
+
if (t.openCanceller !== a) throw new $.DatabaseClosed("db.open() was cancelled");
|
|
2243
2239
|
}
|
|
2244
2240
|
function c() {
|
|
2245
|
-
return new B(function(
|
|
2246
|
-
if (u(), !n) throw new
|
|
2241
|
+
return new B(function(S, p) {
|
|
2242
|
+
if (u(), !n) throw new $.MissingAPI();
|
|
2247
2243
|
var b = e.name, w = t.autoSchema || !i ? n.open(b) : n.open(b, i);
|
|
2248
|
-
if (!w) throw new
|
|
2244
|
+
if (!w) throw new $.MissingAPI();
|
|
2249
2245
|
w.onerror = be(p), w.onblocked = q(e._fireOnBlocked), w.onupgradeneeded = q(function(m) {
|
|
2250
|
-
var
|
|
2251
|
-
v = w.transaction, t.autoSchema && !e._options.allowEmptyDB ? (w.onerror = pt, v.abort(), w.result.close(), (
|
|
2252
|
-
p(new
|
|
2246
|
+
var _;
|
|
2247
|
+
v = w.transaction, t.autoSchema && !e._options.allowEmptyDB ? (w.onerror = pt, v.abort(), w.result.close(), (_ = n.deleteDatabase(b)).onsuccess = _.onerror = q(function() {
|
|
2248
|
+
p(new $.NoSuchDatabase("Database ".concat(b, " doesnt exist")));
|
|
2253
2249
|
})) : (v.onerror = be(p), m = m.oldVersion > Math.pow(2, 62) ? 0 : m.oldVersion, f = m < 1, e.idbdb = w.result, s && pa(e, v), ha(e, m / 10, v, p));
|
|
2254
2250
|
}, p), w.onsuccess = q(function() {
|
|
2255
2251
|
v = null;
|
|
2256
|
-
var m,
|
|
2257
|
-
if (0 <
|
|
2258
|
-
var
|
|
2259
|
-
if (t.autoSchema)
|
|
2260
|
-
else if (Ut(e, e._dbSchema,
|
|
2261
|
-
return
|
|
2262
|
-
})) && !s) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."),
|
|
2263
|
-
Bt(e,
|
|
2252
|
+
var m, _, E, O, A, P = e.idbdb = w.result, T = _t(P.objectStoreNames);
|
|
2253
|
+
if (0 < T.length) try {
|
|
2254
|
+
var I = P.transaction((O = T).length === 1 ? O[0] : O, "readonly");
|
|
2255
|
+
if (t.autoSchema) _ = P, E = I, (m = e).verno = _.version / 10, E = m._dbSchema = $t(0, _, E), m._storeNames = _t(_.objectStoreNames, 0), Lt(m, [m._allTables], K(E), E);
|
|
2256
|
+
else if (Ut(e, e._dbSchema, I), ((A = xn($t(0, (A = e).idbdb, I), A._dbSchema)).add.length || A.change.some(function(C) {
|
|
2257
|
+
return C.add.length || C.change.length;
|
|
2258
|
+
})) && !s) return console.warn("Dexie SchemaDiff: Schema was extended without increasing the number passed to db.version(). Dexie will add missing parts and increment native version number to workaround this."), P.close(), i = P.version + 1, s = !0, S(c());
|
|
2259
|
+
Bt(e, I);
|
|
2264
2260
|
} catch {
|
|
2265
2261
|
}
|
|
2266
|
-
et.push(e),
|
|
2267
|
-
t.vcFired = !0, e.on("versionchange").fire(
|
|
2268
|
-
}),
|
|
2269
|
-
e.on("close").fire(
|
|
2270
|
-
}), f && (A = e._deps,
|
|
2262
|
+
et.push(e), P.onversionchange = q(function(C) {
|
|
2263
|
+
t.vcFired = !0, e.on("versionchange").fire(C);
|
|
2264
|
+
}), P.onclose = q(function(C) {
|
|
2265
|
+
e.on("close").fire(C);
|
|
2266
|
+
}), f && (A = e._deps, I = b, P = A.indexedDB, A = A.IDBKeyRange, Dn(P) || I === Tt || kn(P, A).put({ name: I }).catch(J)), S();
|
|
2271
2267
|
}, p);
|
|
2272
|
-
}).catch(function(
|
|
2273
|
-
switch (
|
|
2268
|
+
}).catch(function(S) {
|
|
2269
|
+
switch (S == null ? void 0 : S.name) {
|
|
2274
2270
|
case "UnknownError":
|
|
2275
2271
|
if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), c();
|
|
2276
2272
|
break;
|
|
2277
2273
|
case "VersionError":
|
|
2278
2274
|
if (0 < i) return i = 0, c();
|
|
2279
2275
|
}
|
|
2280
|
-
return B.reject(
|
|
2276
|
+
return B.reject(S);
|
|
2281
2277
|
});
|
|
2282
2278
|
}
|
|
2283
2279
|
var h, y = t.dbReadyResolve, v = null, f = !1;
|
|
2284
|
-
return B.race([a, (typeof navigator > "u" ? B.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(
|
|
2280
|
+
return B.race([a, (typeof navigator > "u" ? B.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(S) {
|
|
2285
2281
|
function p() {
|
|
2286
|
-
return indexedDB.databases().finally(
|
|
2282
|
+
return indexedDB.databases().finally(S);
|
|
2287
2283
|
}
|
|
2288
2284
|
h = setInterval(p, 100), p();
|
|
2289
2285
|
}).finally(function() {
|
|
@@ -2291,32 +2287,32 @@ function Ra() {
|
|
|
2291
2287
|
}) : Promise.resolve()).then(c)]).then(function() {
|
|
2292
2288
|
return u(), t.onReadyBeingFired = [], B.resolve(Pn(function() {
|
|
2293
2289
|
return e.on.ready.fire(e.vip);
|
|
2294
|
-
})).then(function
|
|
2290
|
+
})).then(function S() {
|
|
2295
2291
|
if (0 < t.onReadyBeingFired.length) {
|
|
2296
|
-
var p = t.onReadyBeingFired.reduce(sn,
|
|
2292
|
+
var p = t.onReadyBeingFired.reduce(sn, J);
|
|
2297
2293
|
return t.onReadyBeingFired = [], B.resolve(Pn(function() {
|
|
2298
2294
|
return p(e.vip);
|
|
2299
|
-
})).then(
|
|
2295
|
+
})).then(S);
|
|
2300
2296
|
}
|
|
2301
2297
|
});
|
|
2302
2298
|
}).finally(function() {
|
|
2303
2299
|
t.openCanceller === a && (t.onReadyBeingFired = null, t.isBeingOpened = !1);
|
|
2304
|
-
}).catch(function(
|
|
2305
|
-
t.dbOpenError =
|
|
2300
|
+
}).catch(function(S) {
|
|
2301
|
+
t.dbOpenError = S;
|
|
2306
2302
|
try {
|
|
2307
2303
|
v && v.abort();
|
|
2308
2304
|
} catch {
|
|
2309
2305
|
}
|
|
2310
|
-
return a === t.openCanceller && e._close(), te(
|
|
2306
|
+
return a === t.openCanceller && e._close(), te(S);
|
|
2311
2307
|
}).finally(function() {
|
|
2312
2308
|
t.openComplete = !0, y();
|
|
2313
2309
|
}).then(function() {
|
|
2314
|
-
var
|
|
2315
|
-
return f && (
|
|
2310
|
+
var S;
|
|
2311
|
+
return f && (S = {}, e.tables.forEach(function(p) {
|
|
2316
2312
|
p.schema.indexes.forEach(function(b) {
|
|
2317
|
-
b.name && (
|
|
2318
|
-
}),
|
|
2319
|
-
}), Ce(gt).fire(
|
|
2313
|
+
b.name && (S["idb://".concat(e.name, "/").concat(p.name, "/").concat(b.name)] = new oe(-1 / 0, [[[]]]));
|
|
2314
|
+
}), S["idb://".concat(e.name, "/").concat(p.name, "/")] = S["idb://".concat(e.name, "/").concat(p.name, "/:dels")] = new oe(-1 / 0, [[[]]]);
|
|
2315
|
+
}), Ce(gt).fire(S), Mn(S, !0)), e;
|
|
2320
2316
|
});
|
|
2321
2317
|
}
|
|
2322
2318
|
function jn(e) {
|
|
@@ -2329,23 +2325,23 @@ function Ra() {
|
|
|
2329
2325
|
function i(s) {
|
|
2330
2326
|
return function(h) {
|
|
2331
2327
|
var c = s(h), h = c.value;
|
|
2332
|
-
return c.done ? h : h && typeof h.then == "function" ? h.then(n, a) :
|
|
2328
|
+
return c.done ? h : h && typeof h.then == "function" ? h.then(n, a) : U(h) ? Promise.all(h).then(n, a) : n(h);
|
|
2333
2329
|
};
|
|
2334
2330
|
}
|
|
2335
2331
|
return i(t)();
|
|
2336
2332
|
}
|
|
2337
2333
|
function Yt(e, t, n) {
|
|
2338
|
-
for (var a =
|
|
2334
|
+
for (var a = U(e) ? e.slice() : [e], i = 0; i < n; ++i) a.push(t);
|
|
2339
2335
|
return a;
|
|
2340
2336
|
}
|
|
2341
2337
|
var ma = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
2342
2338
|
return l(l({}, e), { table: function(t) {
|
|
2343
2339
|
var n = e.table(t), a = n.schema, i = {}, s = [];
|
|
2344
|
-
function u(f,
|
|
2345
|
-
var b = mt(f), w = i[b] = i[b] || [], m = f == null ? 0 : typeof f == "string" ? 1 : f.length,
|
|
2346
|
-
return w.push(
|
|
2340
|
+
function u(f, S, p) {
|
|
2341
|
+
var b = mt(f), w = i[b] = i[b] || [], m = f == null ? 0 : typeof f == "string" ? 1 : f.length, _ = 0 < S, _ = l(l({}, p), { name: _ ? "".concat(b, "(virtual-from:").concat(p.name, ")") : p.name, lowLevelIndex: p, isVirtual: _, keyTail: S, keyLength: m, extractKey: En(f), unique: !_ && p.unique });
|
|
2342
|
+
return w.push(_), _.isPrimaryKey || s.push(_), 1 < m && u(m === 2 ? f[0] : f.slice(0, m - 1), S + 1, p), w.sort(function(E, O) {
|
|
2347
2343
|
return E.keyTail - O.keyTail;
|
|
2348
|
-
}),
|
|
2344
|
+
}), _;
|
|
2349
2345
|
}
|
|
2350
2346
|
t = u(a.primaryKey.keyPath, 0, a.primaryKey), i[":id"] = [t];
|
|
2351
2347
|
for (var c = 0, h = a.indexes; c < h.length; c++) {
|
|
@@ -2353,8 +2349,8 @@ function Ra() {
|
|
|
2353
2349
|
u(y.keyPath, 0, y);
|
|
2354
2350
|
}
|
|
2355
2351
|
function v(f) {
|
|
2356
|
-
var
|
|
2357
|
-
return p.isVirtual ? l(l({}, f), { query: { index: p.lowLevelIndex, range: (
|
|
2352
|
+
var S, p = f.query.index;
|
|
2353
|
+
return p.isVirtual ? l(l({}, f), { query: { index: p.lowLevelIndex, range: (S = f.query.range, p = p.keyTail, { type: S.type === 1 ? 2 : S.type, lower: Yt(S.lower, S.lowerOpen ? e.MAX_KEY : e.MIN_KEY, p), lowerOpen: !0, upper: Yt(S.upper, S.upperOpen ? e.MIN_KEY : e.MAX_KEY, p), upperOpen: !0 }) } }) : f;
|
|
2358
2354
|
}
|
|
2359
2355
|
return l(l({}, n), { schema: l(l({}, a), { primaryKey: t, indexes: s, getIndexByKeyPath: function(f) {
|
|
2360
2356
|
return (f = i[mt(f)]) && f[0];
|
|
@@ -2363,22 +2359,22 @@ function Ra() {
|
|
|
2363
2359
|
}, query: function(f) {
|
|
2364
2360
|
return n.query(v(f));
|
|
2365
2361
|
}, openCursor: function(f) {
|
|
2366
|
-
var
|
|
2367
|
-
return b ? n.openCursor(v(f)).then(function(
|
|
2368
|
-
return
|
|
2362
|
+
var S = f.query.index, p = S.keyTail, b = S.isVirtual, w = S.keyLength;
|
|
2363
|
+
return b ? n.openCursor(v(f)).then(function(_) {
|
|
2364
|
+
return _ && m(_);
|
|
2369
2365
|
}) : n.openCursor(f);
|
|
2370
|
-
function m(
|
|
2371
|
-
return Object.create(
|
|
2372
|
-
E != null ?
|
|
2366
|
+
function m(_) {
|
|
2367
|
+
return Object.create(_, { continue: { value: function(E) {
|
|
2368
|
+
E != null ? _.continue(Yt(E, f.reverse ? e.MAX_KEY : e.MIN_KEY, p)) : f.unique ? _.continue(_.key.slice(0, w).concat(f.reverse ? e.MIN_KEY : e.MAX_KEY, p)) : _.continue();
|
|
2373
2369
|
} }, continuePrimaryKey: { value: function(E, O) {
|
|
2374
|
-
|
|
2370
|
+
_.continuePrimaryKey(Yt(E, e.MAX_KEY, p), O);
|
|
2375
2371
|
} }, primaryKey: { get: function() {
|
|
2376
|
-
return
|
|
2372
|
+
return _.primaryKey;
|
|
2377
2373
|
} }, key: { get: function() {
|
|
2378
|
-
var E =
|
|
2374
|
+
var E = _.key;
|
|
2379
2375
|
return w === 1 ? E[0] : E.slice(0, w);
|
|
2380
2376
|
} }, value: { get: function() {
|
|
2381
|
-
return
|
|
2377
|
+
return _.value;
|
|
2382
2378
|
} } });
|
|
2383
2379
|
}
|
|
2384
2380
|
} });
|
|
@@ -2399,31 +2395,31 @@ function Ra() {
|
|
|
2399
2395
|
return l(l({}, e), { table: function(t) {
|
|
2400
2396
|
var n = e.table(t), a = n.schema.primaryKey;
|
|
2401
2397
|
return l(l({}, n), { mutate: function(i) {
|
|
2402
|
-
var s =
|
|
2398
|
+
var s = G.trans, u = s.table(t).hook, c = u.deleting, h = u.creating, y = u.updating;
|
|
2403
2399
|
switch (i.type) {
|
|
2404
2400
|
case "add":
|
|
2405
|
-
if (h.fire ===
|
|
2401
|
+
if (h.fire === J) break;
|
|
2406
2402
|
return s._promise("readwrite", function() {
|
|
2407
2403
|
return v(i);
|
|
2408
2404
|
}, !0);
|
|
2409
2405
|
case "put":
|
|
2410
|
-
if (h.fire ===
|
|
2406
|
+
if (h.fire === J && y.fire === J) break;
|
|
2411
2407
|
return s._promise("readwrite", function() {
|
|
2412
2408
|
return v(i);
|
|
2413
2409
|
}, !0);
|
|
2414
2410
|
case "delete":
|
|
2415
|
-
if (c.fire ===
|
|
2411
|
+
if (c.fire === J) break;
|
|
2416
2412
|
return s._promise("readwrite", function() {
|
|
2417
2413
|
return v(i);
|
|
2418
2414
|
}, !0);
|
|
2419
2415
|
case "deleteRange":
|
|
2420
|
-
if (c.fire ===
|
|
2416
|
+
if (c.fire === J) break;
|
|
2421
2417
|
return s._promise("readwrite", function() {
|
|
2422
|
-
return function f(
|
|
2423
|
-
return n.query({ trans:
|
|
2418
|
+
return function f(S, p, b) {
|
|
2419
|
+
return n.query({ trans: S, values: !1, query: { index: a, range: p }, limit: b }).then(function(w) {
|
|
2424
2420
|
var m = w.result;
|
|
2425
|
-
return v({ type: "delete", keys: m, trans:
|
|
2426
|
-
return 0 <
|
|
2421
|
+
return v({ type: "delete", keys: m, trans: S }).then(function(_) {
|
|
2422
|
+
return 0 < _.numFailures ? Promise.reject(_.failures[0]) : m.length < b ? { failures: [], numFailures: 0, lastResult: void 0 } : f(S, l(l({}, p), { lower: m[m.length - 1], lowerOpen: !0 }), b);
|
|
2427
2423
|
});
|
|
2428
2424
|
});
|
|
2429
2425
|
}(i.trans, i.range, 1e4);
|
|
@@ -2431,21 +2427,21 @@ function Ra() {
|
|
|
2431
2427
|
}
|
|
2432
2428
|
return n.mutate(i);
|
|
2433
2429
|
function v(f) {
|
|
2434
|
-
var
|
|
2430
|
+
var S, p, b, w = G.trans, m = f.keys || Kn(a, f);
|
|
2435
2431
|
if (!m) throw new Error("Keys missing");
|
|
2436
|
-
return (f = f.type === "add" || f.type === "put" ? l(l({}, f), { keys: m }) : l({}, f)).type !== "delete" && (f.values = x([], f.values)), f.keys && (f.keys = x([], f.keys)),
|
|
2432
|
+
return (f = f.type === "add" || f.type === "put" ? l(l({}, f), { keys: m }) : l({}, f)).type !== "delete" && (f.values = x([], f.values)), f.keys && (f.keys = x([], f.keys)), S = n, b = m, ((p = f).type === "add" ? Promise.resolve([]) : S.getMany({ trans: p.trans, keys: b, cache: "immutable" })).then(function(_) {
|
|
2437
2433
|
var E = m.map(function(O, A) {
|
|
2438
|
-
var
|
|
2439
|
-
return f.type === "delete" ? c.fire.call(j, O,
|
|
2440
|
-
ee(
|
|
2434
|
+
var P, T, I, C = _[A], j = { onerror: null, onsuccess: null };
|
|
2435
|
+
return f.type === "delete" ? c.fire.call(j, O, C, w) : f.type === "add" || C === void 0 ? (P = h.fire.call(j, O, f.values[A], w), O == null && P != null && (f.keys[A] = O = P, a.outbound || fe(f.values[A], a.keyPath, O))) : (P = Nn(C, f.values[A]), (T = y.fire.call(j, P, O, C, w)) && (I = f.values[A], Object.keys(T).forEach(function(R) {
|
|
2436
|
+
ee(I, R) ? I[R] = T[R] : fe(I, R, T[R]);
|
|
2441
2437
|
}))), j;
|
|
2442
2438
|
});
|
|
2443
2439
|
return n.mutate(f).then(function(O) {
|
|
2444
|
-
for (var A = O.failures,
|
|
2445
|
-
var
|
|
2446
|
-
|
|
2440
|
+
for (var A = O.failures, P = O.results, T = O.numFailures, O = O.lastResult, I = 0; I < m.length; ++I) {
|
|
2441
|
+
var C = (P || m)[I], j = E[I];
|
|
2442
|
+
C == null ? j.onerror && j.onerror(A[I]) : j.onsuccess && j.onsuccess(f.type === "put" && _[I] ? f.values[I] : C);
|
|
2447
2443
|
}
|
|
2448
|
-
return { failures: A, results:
|
|
2444
|
+
return { failures: A, results: P, numFailures: T, lastResult: O };
|
|
2449
2445
|
}).catch(function(O) {
|
|
2450
2446
|
return E.forEach(function(A) {
|
|
2451
2447
|
return A.onerror && A.onerror(O);
|
|
@@ -2496,81 +2492,81 @@ function Ra() {
|
|
|
2496
2492
|
var wa = { stack: "dbcore", level: 0, name: "Observability", create: function(e) {
|
|
2497
2493
|
var t = e.schema.name, n = new oe(e.MIN_KEY, e.MAX_KEY);
|
|
2498
2494
|
return l(l({}, e), { transaction: function(a, i, s) {
|
|
2499
|
-
if (
|
|
2495
|
+
if (G.subscr && i !== "readonly") throw new $.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(G.querier));
|
|
2500
2496
|
return e.transaction(a, i, s);
|
|
2501
2497
|
}, table: function(a) {
|
|
2502
2498
|
var i = e.table(a), s = i.schema, u = s.primaryKey, f = s.indexes, c = u.extractKey, h = u.outbound, y = u.autoIncrement && f.filter(function(p) {
|
|
2503
2499
|
return p.compound && p.keyPath.includes(u.keyPath);
|
|
2504
2500
|
}), v = l(l({}, i), { mutate: function(p) {
|
|
2505
|
-
function b(
|
|
2506
|
-
return
|
|
2501
|
+
function b(R) {
|
|
2502
|
+
return R = "idb://".concat(t, "/").concat(a, "/").concat(R), O[R] || (O[R] = new oe());
|
|
2507
2503
|
}
|
|
2508
|
-
var w, m,
|
|
2509
|
-
return
|
|
2510
|
-
}), p.values] : [],
|
|
2511
|
-
return
|
|
2512
|
-
var
|
|
2504
|
+
var w, m, _, E = p.trans, O = p.mutatedParts || (p.mutatedParts = {}), A = b(""), P = b(":dels"), T = p.type, j = p.type === "deleteRange" ? [p.range] : p.type === "delete" ? [p.keys] : p.values.length < 50 ? [Kn(u, p).filter(function(R) {
|
|
2505
|
+
return R;
|
|
2506
|
+
}), p.values] : [], I = j[0], C = j[1], j = p.trans._cache;
|
|
2507
|
+
return U(I) ? (A.addKeys(I), (j = T === "delete" || I.length === C.length ? Or(I, j) : null) || P.addKeys(I), (j || C) && (w = b, m = j, _ = C, s.indexes.forEach(function(R) {
|
|
2508
|
+
var L = w(R.name || "");
|
|
2513
2509
|
function W(H) {
|
|
2514
|
-
return H != null ?
|
|
2510
|
+
return H != null ? R.extractKey(H) : null;
|
|
2515
2511
|
}
|
|
2516
2512
|
function z(H) {
|
|
2517
|
-
return
|
|
2518
|
-
return
|
|
2519
|
-
}) :
|
|
2513
|
+
return R.multiEntry && U(H) ? H.forEach(function(pe) {
|
|
2514
|
+
return L.addKey(pe);
|
|
2515
|
+
}) : L.addKey(H);
|
|
2520
2516
|
}
|
|
2521
|
-
(m ||
|
|
2522
|
-
var F = m && W(m[ue]), ue =
|
|
2517
|
+
(m || _).forEach(function(H, ue) {
|
|
2518
|
+
var F = m && W(m[ue]), ue = _ && W(_[ue]);
|
|
2523
2519
|
Y(F, ue) !== 0 && (F != null && z(F), ue != null && z(ue));
|
|
2524
2520
|
});
|
|
2525
|
-
}))) :
|
|
2526
|
-
return b(
|
|
2527
|
-
})), i.mutate(p).then(function(
|
|
2528
|
-
return !
|
|
2521
|
+
}))) : I ? (C = { from: (C = I.lower) !== null && C !== void 0 ? C : e.MIN_KEY, to: (C = I.upper) !== null && C !== void 0 ? C : e.MAX_KEY }, P.add(C), A.add(C)) : (A.add(n), P.add(n), s.indexes.forEach(function(R) {
|
|
2522
|
+
return b(R.name).add(n);
|
|
2523
|
+
})), i.mutate(p).then(function(R) {
|
|
2524
|
+
return !I || p.type !== "add" && p.type !== "put" || (A.addKeys(R.results), y && y.forEach(function(L) {
|
|
2529
2525
|
for (var W = p.values.map(function(F) {
|
|
2530
|
-
return
|
|
2531
|
-
}), z =
|
|
2526
|
+
return L.extractKey(F);
|
|
2527
|
+
}), z = L.keyPath.findIndex(function(F) {
|
|
2532
2528
|
return F === u.keyPath;
|
|
2533
|
-
}), H = 0, pe =
|
|
2534
|
-
b(
|
|
2535
|
-
})), E.mutatedParts = zt(E.mutatedParts || {}, O),
|
|
2529
|
+
}), H = 0, pe = R.results.length; H < pe; ++H) W[H][z] = R.results[H];
|
|
2530
|
+
b(L.name).addKeys(W);
|
|
2531
|
+
})), E.mutatedParts = zt(E.mutatedParts || {}, O), R;
|
|
2536
2532
|
});
|
|
2537
2533
|
} }), f = function(b) {
|
|
2538
2534
|
var w = b.query, b = w.index, w = w.range;
|
|
2539
2535
|
return [b, new oe((b = w.lower) !== null && b !== void 0 ? b : e.MIN_KEY, (w = w.upper) !== null && w !== void 0 ? w : e.MAX_KEY)];
|
|
2540
|
-
},
|
|
2536
|
+
}, S = { get: function(p) {
|
|
2541
2537
|
return [u, new oe(p.key)];
|
|
2542
2538
|
}, getMany: function(p) {
|
|
2543
2539
|
return [u, new oe().addKeys(p.keys)];
|
|
2544
2540
|
}, count: f, query: f, openCursor: f };
|
|
2545
|
-
return K(
|
|
2541
|
+
return K(S).forEach(function(p) {
|
|
2546
2542
|
v[p] = function(b) {
|
|
2547
|
-
var w =
|
|
2543
|
+
var w = G.subscr, m = !!w, _ = xr(G, i) && Ar(p, b) ? b.obsSet = {} : w;
|
|
2548
2544
|
if (m) {
|
|
2549
|
-
var E = function(
|
|
2550
|
-
return
|
|
2551
|
-
}, O = E(""), A = E(":dels"), w =
|
|
2545
|
+
var E = function(C) {
|
|
2546
|
+
return C = "idb://".concat(t, "/").concat(a, "/").concat(C), _[C] || (_[C] = new oe());
|
|
2547
|
+
}, O = E(""), A = E(":dels"), w = S[p](b), m = w[0], w = w[1];
|
|
2552
2548
|
if ((p === "query" && m.isPrimaryKey && !b.values ? A : E(m.name || "")).add(w), !m.isPrimaryKey) {
|
|
2553
2549
|
if (p !== "count") {
|
|
2554
|
-
var
|
|
2555
|
-
return i[p].apply(this, arguments).then(function(
|
|
2550
|
+
var P = p === "query" && h && b.values && i.query(l(l({}, b), { values: !1 }));
|
|
2551
|
+
return i[p].apply(this, arguments).then(function(C) {
|
|
2556
2552
|
if (p === "query") {
|
|
2557
|
-
if (h && b.values) return
|
|
2558
|
-
return W = W.result, O.addKeys(W),
|
|
2553
|
+
if (h && b.values) return P.then(function(W) {
|
|
2554
|
+
return W = W.result, O.addKeys(W), C;
|
|
2559
2555
|
});
|
|
2560
|
-
var j = b.values ?
|
|
2556
|
+
var j = b.values ? C.result.map(c) : C.result;
|
|
2561
2557
|
(b.values ? O : A).addKeys(j);
|
|
2562
2558
|
} else if (p === "openCursor") {
|
|
2563
|
-
var
|
|
2564
|
-
return
|
|
2565
|
-
return A.addKey(
|
|
2559
|
+
var R = C, L = b.values;
|
|
2560
|
+
return R && Object.create(R, { key: { get: function() {
|
|
2561
|
+
return A.addKey(R.primaryKey), R.key;
|
|
2566
2562
|
} }, primaryKey: { get: function() {
|
|
2567
|
-
var W =
|
|
2563
|
+
var W = R.primaryKey;
|
|
2568
2564
|
return A.addKey(W), W;
|
|
2569
2565
|
} }, value: { get: function() {
|
|
2570
|
-
return
|
|
2566
|
+
return L && O.addKey(R.primaryKey), R.value;
|
|
2571
2567
|
} } });
|
|
2572
2568
|
}
|
|
2573
|
-
return
|
|
2569
|
+
return C;
|
|
2574
2570
|
});
|
|
2575
2571
|
}
|
|
2576
2572
|
A.add(n);
|
|
@@ -2585,9 +2581,9 @@ function Ra() {
|
|
|
2585
2581
|
if (n.numFailures === 0) return t;
|
|
2586
2582
|
if (t.type === "deleteRange") return null;
|
|
2587
2583
|
var a = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
|
|
2588
|
-
return n.numFailures === a ? null : (t = l({}, t),
|
|
2584
|
+
return n.numFailures === a ? null : (t = l({}, t), U(t.keys) && (t.keys = t.keys.filter(function(i, s) {
|
|
2589
2585
|
return !(s in n.failures);
|
|
2590
|
-
})), "values" in t &&
|
|
2586
|
+
})), "values" in t && U(t.values) && (t.values = t.values.filter(function(i, s) {
|
|
2591
2587
|
return !(s in n.failures);
|
|
2592
2588
|
})), t);
|
|
2593
2589
|
}
|
|
@@ -2595,60 +2591,60 @@ function Ra() {
|
|
|
2595
2591
|
return n = e, ((a = t).lower === void 0 || (a.lowerOpen ? 0 < Y(n, a.lower) : 0 <= Y(n, a.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? Y(e, t.upper) < 0 : Y(e, t.upper) <= 0));
|
|
2596
2592
|
var n, a;
|
|
2597
2593
|
}
|
|
2598
|
-
function Dr(e, t,
|
|
2599
|
-
if (!
|
|
2600
|
-
var u = t.query.index, c = u.multiEntry, h = t.query.range, y = a.schema.primaryKey.extractKey, v = u.extractKey, f = (u.lowLevelIndex || u).extractKey,
|
|
2594
|
+
function Dr(e, t, S, a, i, s) {
|
|
2595
|
+
if (!S || S.length === 0) return e;
|
|
2596
|
+
var u = t.query.index, c = u.multiEntry, h = t.query.range, y = a.schema.primaryKey.extractKey, v = u.extractKey, f = (u.lowLevelIndex || u).extractKey, S = S.reduce(function(p, b) {
|
|
2601
2597
|
var w = p, m = [];
|
|
2602
|
-
if (b.type === "add" || b.type === "put") for (var
|
|
2603
|
-
var O, A = b.values[E],
|
|
2604
|
-
|
|
2605
|
-
return Bn(
|
|
2606
|
-
}) : Bn(O, h)) && (
|
|
2598
|
+
if (b.type === "add" || b.type === "put") for (var _ = new oe(), E = b.values.length - 1; 0 <= E; --E) {
|
|
2599
|
+
var O, A = b.values[E], P = y(A);
|
|
2600
|
+
_.hasKey(P) || (O = v(A), (c && U(O) ? O.some(function(R) {
|
|
2601
|
+
return Bn(R, h);
|
|
2602
|
+
}) : Bn(O, h)) && (_.addKey(P), m.push(A)));
|
|
2607
2603
|
}
|
|
2608
2604
|
switch (b.type) {
|
|
2609
2605
|
case "add":
|
|
2610
|
-
var
|
|
2611
|
-
return y(
|
|
2612
|
-
}) : p), w = p.concat(t.values ? m.filter(function(
|
|
2613
|
-
return
|
|
2614
|
-
}) : m.map(function(
|
|
2615
|
-
return y(
|
|
2616
|
-
}).filter(function(
|
|
2617
|
-
return !
|
|
2606
|
+
var T = new oe().addKeys(t.values ? p.map(function(L) {
|
|
2607
|
+
return y(L);
|
|
2608
|
+
}) : p), w = p.concat(t.values ? m.filter(function(L) {
|
|
2609
|
+
return L = y(L), !T.hasKey(L) && (T.addKey(L), !0);
|
|
2610
|
+
}) : m.map(function(L) {
|
|
2611
|
+
return y(L);
|
|
2612
|
+
}).filter(function(L) {
|
|
2613
|
+
return !T.hasKey(L) && (T.addKey(L), !0);
|
|
2618
2614
|
}));
|
|
2619
2615
|
break;
|
|
2620
2616
|
case "put":
|
|
2621
|
-
var
|
|
2622
|
-
return y(
|
|
2617
|
+
var I = new oe().addKeys(b.values.map(function(L) {
|
|
2618
|
+
return y(L);
|
|
2623
2619
|
}));
|
|
2624
|
-
w = p.filter(function(
|
|
2625
|
-
return !
|
|
2626
|
-
}).concat(t.values ? m : m.map(function(
|
|
2627
|
-
return y(
|
|
2620
|
+
w = p.filter(function(L) {
|
|
2621
|
+
return !I.hasKey(t.values ? y(L) : L);
|
|
2622
|
+
}).concat(t.values ? m : m.map(function(L) {
|
|
2623
|
+
return y(L);
|
|
2628
2624
|
}));
|
|
2629
2625
|
break;
|
|
2630
2626
|
case "delete":
|
|
2631
|
-
var
|
|
2632
|
-
w = p.filter(function(
|
|
2633
|
-
return !
|
|
2627
|
+
var C = new oe().addKeys(b.keys);
|
|
2628
|
+
w = p.filter(function(L) {
|
|
2629
|
+
return !C.hasKey(t.values ? y(L) : L);
|
|
2634
2630
|
});
|
|
2635
2631
|
break;
|
|
2636
2632
|
case "deleteRange":
|
|
2637
2633
|
var j = b.range;
|
|
2638
|
-
w = p.filter(function(
|
|
2639
|
-
return !Bn(y(
|
|
2634
|
+
w = p.filter(function(L) {
|
|
2635
|
+
return !Bn(y(L), j);
|
|
2640
2636
|
});
|
|
2641
2637
|
}
|
|
2642
2638
|
return w;
|
|
2643
2639
|
}, e);
|
|
2644
|
-
return
|
|
2640
|
+
return S === e ? e : (S.sort(function(p, b) {
|
|
2645
2641
|
return Y(f(p), f(b)) || Y(y(p), y(b));
|
|
2646
|
-
}), t.limit && t.limit < 1 / 0 && (
|
|
2642
|
+
}), t.limit && t.limit < 1 / 0 && (S.length > t.limit ? S.length = t.limit : e.length === t.limit && S.length < t.limit && (i.dirty = !0)), s ? Object.freeze(S) : S);
|
|
2647
2643
|
}
|
|
2648
2644
|
function Pr(e, t) {
|
|
2649
2645
|
return Y(e.lower, t.lower) === 0 && Y(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
|
|
2650
2646
|
}
|
|
2651
|
-
function
|
|
2647
|
+
function Sa(e, t) {
|
|
2652
2648
|
return function(n, a, i, s) {
|
|
2653
2649
|
if (n === void 0) return a !== void 0 ? -1 : 0;
|
|
2654
2650
|
if (a === void 0) return 1;
|
|
@@ -2669,7 +2665,7 @@ function Ra() {
|
|
|
2669
2665
|
return a;
|
|
2670
2666
|
}(e.upper, t.upper, e.upperOpen, t.upperOpen);
|
|
2671
2667
|
}
|
|
2672
|
-
function
|
|
2668
|
+
function _a(e, t, n, a) {
|
|
2673
2669
|
e.subscribers.add(n), a.addEventListener("abort", function() {
|
|
2674
2670
|
var i, s;
|
|
2675
2671
|
e.subscribers.delete(n), e.subscribers.size === 0 && (i = e, s = t, setTimeout(function() {
|
|
@@ -2685,28 +2681,28 @@ function Ra() {
|
|
|
2685
2681
|
return function() {
|
|
2686
2682
|
if (s.abort(), a === "readwrite") {
|
|
2687
2683
|
for (var y = /* @__PURE__ */ new Set(), v = 0, f = n; v < f.length; v++) {
|
|
2688
|
-
var
|
|
2684
|
+
var S = f[v], p = Fe["idb://".concat(t, "/").concat(S)];
|
|
2689
2685
|
if (p) {
|
|
2690
|
-
var b = e.table(
|
|
2691
|
-
return
|
|
2686
|
+
var b = e.table(S), w = p.optimisticOps.filter(function(L) {
|
|
2687
|
+
return L.trans === c;
|
|
2692
2688
|
});
|
|
2693
|
-
if (c._explicit && h && c.mutatedParts) for (var m = 0,
|
|
2694
|
-
return y.add(
|
|
2689
|
+
if (c._explicit && h && c.mutatedParts) for (var m = 0, _ = Object.values(p.queries.query); m < _.length; m++) for (var E = 0, O = (T = _[m]).slice(); E < O.length; E++) Cn((I = O[E]).obsSet, c.mutatedParts) && (Me(T, I), I.subscribers.forEach(function(L) {
|
|
2690
|
+
return y.add(L);
|
|
2695
2691
|
}));
|
|
2696
2692
|
else if (0 < w.length) {
|
|
2697
|
-
p.optimisticOps = p.optimisticOps.filter(function(
|
|
2698
|
-
return
|
|
2693
|
+
p.optimisticOps = p.optimisticOps.filter(function(L) {
|
|
2694
|
+
return L.trans !== c;
|
|
2699
2695
|
});
|
|
2700
|
-
for (var A = 0,
|
|
2701
|
-
return y.add(
|
|
2702
|
-
})) :
|
|
2703
|
-
return y.add(
|
|
2696
|
+
for (var A = 0, P = Object.values(p.queries.query); A < P.length; A++) for (var T, I, C, j = 0, R = (T = P[A]).slice(); j < R.length; j++) (I = R[j]).res != null && c.mutatedParts && (h && !I.dirty ? (C = Object.isFrozen(I.res), C = Dr(I.res, I.req, w, b, I, C), I.dirty ? (Me(T, I), I.subscribers.forEach(function(L) {
|
|
2697
|
+
return y.add(L);
|
|
2698
|
+
})) : C !== I.res && (I.res = C, I.promise = B.resolve({ result: C }))) : (I.dirty && Me(T, I), I.subscribers.forEach(function(L) {
|
|
2699
|
+
return y.add(L);
|
|
2704
2700
|
})));
|
|
2705
2701
|
}
|
|
2706
2702
|
}
|
|
2707
2703
|
}
|
|
2708
|
-
y.forEach(function(
|
|
2709
|
-
return
|
|
2704
|
+
y.forEach(function(L) {
|
|
2705
|
+
return L();
|
|
2710
2706
|
});
|
|
2711
2707
|
}
|
|
2712
2708
|
};
|
|
@@ -2714,7 +2710,7 @@ function Ra() {
|
|
|
2714
2710
|
}, table: function(n) {
|
|
2715
2711
|
var a = e.table(n), i = a.schema.primaryKey;
|
|
2716
2712
|
return l(l({}, a), { mutate: function(s) {
|
|
2717
|
-
var u =
|
|
2713
|
+
var u = G.trans;
|
|
2718
2714
|
if (i.outbound || u.db._options.cache === "disabled" || u.explicit || u.idbtrans.mode !== "readwrite") return a.mutate(s);
|
|
2719
2715
|
var c = Fe["idb://".concat(t, "/").concat(n)];
|
|
2720
2716
|
return c ? (u = a.mutate(s), s.type !== "add" && s.type !== "put" || !(50 <= s.values.length || Kn(i, s).some(function(h) {
|
|
@@ -2725,46 +2721,46 @@ function Ra() {
|
|
|
2725
2721
|
Me(c.optimisticOps, s), s.mutatedParts && Ht(s.mutatedParts);
|
|
2726
2722
|
})) : u.then(function(h) {
|
|
2727
2723
|
var y = kr(0, l(l({}, s), { values: s.values.map(function(v, f) {
|
|
2728
|
-
var
|
|
2729
|
-
return h.failures[f] ? v : (v = (
|
|
2724
|
+
var S;
|
|
2725
|
+
return h.failures[f] ? v : (v = (S = i.keyPath) !== null && S !== void 0 && S.includes(".") ? Te(v) : l({}, v), fe(v, i.keyPath, h.results[f]), v);
|
|
2730
2726
|
}) }), h);
|
|
2731
2727
|
c.optimisticOps.push(y), queueMicrotask(function() {
|
|
2732
2728
|
return s.mutatedParts && Ht(s.mutatedParts);
|
|
2733
2729
|
});
|
|
2734
2730
|
}), u) : a.mutate(s);
|
|
2735
2731
|
}, query: function(s) {
|
|
2736
|
-
if (!xr(
|
|
2737
|
-
var u = ((y =
|
|
2732
|
+
if (!xr(G, a) || !Ar("query", s)) return a.query(s);
|
|
2733
|
+
var u = ((y = G.trans) === null || y === void 0 ? void 0 : y.db._options.cache) === "immutable", f = G, c = f.requery, h = f.signal, y = function(b, w, m, _) {
|
|
2738
2734
|
var E = Fe["idb://".concat(b, "/").concat(w)];
|
|
2739
2735
|
if (!E) return [];
|
|
2740
2736
|
if (!(w = E.queries[m])) return [null, !1, E, null];
|
|
2741
|
-
var O = w[(
|
|
2737
|
+
var O = w[(_.query ? _.query.index.name : null) || ""];
|
|
2742
2738
|
if (!O) return [null, !1, E, null];
|
|
2743
2739
|
switch (m) {
|
|
2744
2740
|
case "query":
|
|
2745
|
-
var A = O.find(function(
|
|
2746
|
-
return
|
|
2741
|
+
var A = O.find(function(P) {
|
|
2742
|
+
return P.req.limit === _.limit && P.req.values === _.values && Pr(P.req.query.range, _.query.range);
|
|
2747
2743
|
});
|
|
2748
|
-
return A ? [A, !0, E, O] : [O.find(function(
|
|
2749
|
-
return ("limit" in
|
|
2744
|
+
return A ? [A, !0, E, O] : [O.find(function(P) {
|
|
2745
|
+
return ("limit" in P.req ? P.req.limit : 1 / 0) >= _.limit && (!_.values || P.req.values) && Sa(P.req.query.range, _.query.range);
|
|
2750
2746
|
}), !1, E, O];
|
|
2751
2747
|
case "count":
|
|
2752
|
-
return A = O.find(function(
|
|
2753
|
-
return Pr(
|
|
2748
|
+
return A = O.find(function(P) {
|
|
2749
|
+
return Pr(P.req.query.range, _.query.range);
|
|
2754
2750
|
}), [A, !!A, E, O];
|
|
2755
2751
|
}
|
|
2756
|
-
}(t, n, "query", s), v = y[0], f = y[1],
|
|
2752
|
+
}(t, n, "query", s), v = y[0], f = y[1], S = y[2], p = y[3];
|
|
2757
2753
|
return v && f ? v.obsSet = s.obsSet : (f = a.query(s).then(function(b) {
|
|
2758
2754
|
var w = b.result;
|
|
2759
2755
|
if (v && (v.res = w), u) {
|
|
2760
|
-
for (var m = 0,
|
|
2756
|
+
for (var m = 0, _ = w.length; m < _; ++m) Object.freeze(w[m]);
|
|
2761
2757
|
Object.freeze(w);
|
|
2762
2758
|
} else b.result = Te(w);
|
|
2763
2759
|
return b;
|
|
2764
2760
|
}).catch(function(b) {
|
|
2765
2761
|
return p && v && Me(p, v), Promise.reject(b);
|
|
2766
|
-
}), v = { obsSet: s.obsSet, promise: f, subscribers: /* @__PURE__ */ new Set(), type: "query", req: s, dirty: !1 }, p ? p.push(v) : (p = [v], (
|
|
2767
|
-
return { result: Dr(b.result, s,
|
|
2762
|
+
}), v = { obsSet: s.obsSet, promise: f, subscribers: /* @__PURE__ */ new Set(), type: "query", req: s, dirty: !1 }, p ? p.push(v) : (p = [v], (S = S || (Fe["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[s.query.index.name || ""] = p)), _a(v, p, c, h), v.promise.then(function(b) {
|
|
2763
|
+
return { result: Dr(b.result, s, S == null ? void 0 : S.optimisticOps, a, v, u) };
|
|
2768
2764
|
});
|
|
2769
2765
|
} });
|
|
2770
2766
|
} });
|
|
@@ -2775,8 +2771,8 @@ function Ra() {
|
|
|
2775
2771
|
} });
|
|
2776
2772
|
}
|
|
2777
2773
|
var Ee = (ne.prototype.version = function(e) {
|
|
2778
|
-
if (isNaN(e) || e < 0.1) throw new
|
|
2779
|
-
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new
|
|
2774
|
+
if (isNaN(e) || e < 0.1) throw new $.Type("Given version is not a positive number");
|
|
2775
|
+
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new $.Schema("Cannot add version when database is open");
|
|
2780
2776
|
this.verno = Math.max(this.verno, e);
|
|
2781
2777
|
var t = this._versions, n = t.filter(function(a) {
|
|
2782
2778
|
return a._cfg.version === e;
|
|
@@ -2784,11 +2780,11 @@ function Ra() {
|
|
|
2784
2780
|
return n || (n = new this.Version(e), t.push(n), t.sort(fa), n.stores({}), this._state.autoSchema = !1, n);
|
|
2785
2781
|
}, ne.prototype._whenReady = function(e) {
|
|
2786
2782
|
var t = this;
|
|
2787
|
-
return this.idbdb && (this._state.openComplete ||
|
|
2788
|
-
if (t._state.openComplete) return a(new
|
|
2783
|
+
return this.idbdb && (this._state.openComplete || G.letThrough || this._vip) ? e() : new B(function(n, a) {
|
|
2784
|
+
if (t._state.openComplete) return a(new $.DatabaseClosed(t._state.dbOpenError));
|
|
2789
2785
|
if (!t._state.isBeingOpened) {
|
|
2790
|
-
if (!t._state.autoOpen) return void a(new
|
|
2791
|
-
t.open().catch(
|
|
2786
|
+
if (!t._state.autoOpen) return void a(new $.DatabaseClosed());
|
|
2787
|
+
t.open().catch(J);
|
|
2792
2788
|
}
|
|
2793
2789
|
t._state.dbReadyPromise.then(n, a);
|
|
2794
2790
|
}).then(e);
|
|
@@ -2823,7 +2819,7 @@ function Ra() {
|
|
|
2823
2819
|
}));
|
|
2824
2820
|
}, ne.prototype.close = function(n) {
|
|
2825
2821
|
var t = (n === void 0 ? { disableAutoOpen: !0 } : n).disableAutoOpen, n = this._state;
|
|
2826
|
-
t ? (n.isBeingOpened && n.cancelOpen(new
|
|
2822
|
+
t ? (n.isBeingOpened && n.cancelOpen(new $.DatabaseClosed()), this._close(), n.autoOpen = !1, n.dbOpenError = new $.DatabaseClosed()) : (this._close(), n.autoOpen = this._options.autoOpen || n.isBeingOpened, n.openComplete = !1, n.dbOpenError = null);
|
|
2827
2823
|
}, ne.prototype.delete = function(e) {
|
|
2828
2824
|
var t = this;
|
|
2829
2825
|
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
@@ -2834,10 +2830,10 @@ function Ra() {
|
|
|
2834
2830
|
var c = t._deps.indexedDB.deleteDatabase(t.name);
|
|
2835
2831
|
c.onsuccess = q(function() {
|
|
2836
2832
|
var h, y, v;
|
|
2837
|
-
h = t._deps, y = t.name, v = h.indexedDB, h = h.IDBKeyRange, Dn(v) || y === Tt || kn(v, h).delete(y).catch(
|
|
2833
|
+
h = t._deps, y = t.name, v = h.indexedDB, h = h.IDBKeyRange, Dn(v) || y === Tt || kn(v, h).delete(y).catch(J), i();
|
|
2838
2834
|
}), c.onerror = be(s), c.onblocked = t._fireOnBlocked;
|
|
2839
2835
|
}
|
|
2840
|
-
if (n) throw new
|
|
2836
|
+
if (n) throw new $.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
2841
2837
|
a.isBeingOpened ? a.dbReadyPromise.then(u) : u();
|
|
2842
2838
|
});
|
|
2843
2839
|
}, ne.prototype.backendDB = function() {
|
|
@@ -2859,13 +2855,13 @@ function Ra() {
|
|
|
2859
2855
|
}, enumerable: !1, configurable: !0 }), ne.prototype.transaction = function() {
|
|
2860
2856
|
var e = (function(t, n, a) {
|
|
2861
2857
|
var i = arguments.length;
|
|
2862
|
-
if (i < 2) throw new
|
|
2858
|
+
if (i < 2) throw new $.InvalidArgument("Too few arguments");
|
|
2863
2859
|
for (var s = new Array(i - 1); --i; ) s[i - 1] = arguments[i];
|
|
2864
2860
|
return a = s.pop(), [t, Xn(s), a];
|
|
2865
2861
|
}).apply(this, arguments);
|
|
2866
2862
|
return this._transaction.apply(this, e);
|
|
2867
2863
|
}, ne.prototype._transaction = function(e, t, n) {
|
|
2868
|
-
var a = this, i =
|
|
2864
|
+
var a = this, i = G.trans;
|
|
2869
2865
|
i && i.db === this && e.indexOf("!") === -1 || (i = null);
|
|
2870
2866
|
var s, u, c = e.indexOf("?") !== -1;
|
|
2871
2867
|
e = e.replace("!", "").replace("?", "");
|
|
@@ -2875,17 +2871,17 @@ function Ra() {
|
|
|
2875
2871
|
return y;
|
|
2876
2872
|
}), e == "r" || e === gn) s = gn;
|
|
2877
2873
|
else {
|
|
2878
|
-
if (e != "rw" && e != yn) throw new
|
|
2874
|
+
if (e != "rw" && e != yn) throw new $.InvalidArgument("Invalid transaction mode: " + e);
|
|
2879
2875
|
s = yn;
|
|
2880
2876
|
}
|
|
2881
2877
|
if (i) {
|
|
2882
2878
|
if (i.mode === gn && s === yn) {
|
|
2883
|
-
if (!c) throw new
|
|
2879
|
+
if (!c) throw new $.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
2884
2880
|
i = null;
|
|
2885
2881
|
}
|
|
2886
2882
|
i && u.forEach(function(y) {
|
|
2887
2883
|
if (i && i.storeNames.indexOf(y) === -1) {
|
|
2888
|
-
if (!c) throw new
|
|
2884
|
+
if (!c) throw new $.SubTransaction("Table " + y + " not included in parent transaction.");
|
|
2889
2885
|
i = null;
|
|
2890
2886
|
}
|
|
2891
2887
|
}), c && i && !i.active && (i = null);
|
|
@@ -2895,25 +2891,25 @@ function Ra() {
|
|
|
2895
2891
|
f(y);
|
|
2896
2892
|
}) : te(y);
|
|
2897
2893
|
}
|
|
2898
|
-
var h = (function y(v, f,
|
|
2894
|
+
var h = (function y(v, f, S, p, b) {
|
|
2899
2895
|
return B.resolve().then(function() {
|
|
2900
|
-
var w =
|
|
2896
|
+
var w = G.transless || G, m = v._createTransaction(f, S, v._dbSchema, p);
|
|
2901
2897
|
if (m.explicit = !0, w = { trans: m, transless: w }, p) m.idbtrans = p.idbtrans;
|
|
2902
2898
|
else try {
|
|
2903
2899
|
m.create(), m.idbtrans._explicit = !0, v._state.PR1398_maxLoop = 3;
|
|
2904
2900
|
} catch (O) {
|
|
2905
2901
|
return O.name === an.InvalidState && v.isOpen() && 0 < --v._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), v.close({ disableAutoOpen: !1 }), v.open().then(function() {
|
|
2906
|
-
return y(v, f,
|
|
2902
|
+
return y(v, f, S, null, b);
|
|
2907
2903
|
})) : te(O);
|
|
2908
2904
|
}
|
|
2909
|
-
var
|
|
2905
|
+
var _, E = rn(b);
|
|
2910
2906
|
return E && qe(), w = B.follow(function() {
|
|
2911
2907
|
var O;
|
|
2912
|
-
(
|
|
2913
|
-
}, w), (
|
|
2914
|
-
return m.active ? O : te(new
|
|
2908
|
+
(_ = b.call(m, m)) && (E ? (O = De.bind(null, null), _.then(O, O)) : typeof _.next == "function" && typeof _.throw == "function" && (_ = jn(_)));
|
|
2909
|
+
}, w), (_ && typeof _.then == "function" ? B.resolve(_).then(function(O) {
|
|
2910
|
+
return m.active ? O : te(new $.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
2915
2911
|
}) : w.then(function() {
|
|
2916
|
-
return
|
|
2912
|
+
return _;
|
|
2917
2913
|
})).then(function(O) {
|
|
2918
2914
|
return p && m._resolve(), m._completion.then(function() {
|
|
2919
2915
|
return O;
|
|
@@ -2923,11 +2919,11 @@ function Ra() {
|
|
|
2923
2919
|
});
|
|
2924
2920
|
});
|
|
2925
2921
|
}).bind(null, this, s, u, i, n);
|
|
2926
|
-
return i ? i._promise(s, h, "lock") :
|
|
2922
|
+
return i ? i._promise(s, h, "lock") : G.trans ? Ge(G.transless, function() {
|
|
2927
2923
|
return a._whenReady(h);
|
|
2928
2924
|
}) : this._whenReady(h);
|
|
2929
2925
|
}, ne.prototype.table = function(e) {
|
|
2930
|
-
if (!ee(this._allTables, e)) throw new
|
|
2926
|
+
if (!ee(this._allTables, e)) throw new $.InvalidTable("Table ".concat(e, " does not exist"));
|
|
2931
2927
|
return this._allTables[e];
|
|
2932
2928
|
}, ne);
|
|
2933
2929
|
function ne(e, t) {
|
|
@@ -2935,21 +2931,21 @@ function Ra() {
|
|
|
2935
2931
|
this._middlewares = {}, this.verno = 0;
|
|
2936
2932
|
var a = ne.dependencies;
|
|
2937
2933
|
this._options = t = l({ addons: ne.addons, autoOpen: !0, indexedDB: a.indexedDB, IDBKeyRange: a.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, a = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
2938
|
-
var i, s, u, c, h, y = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve:
|
|
2934
|
+
var i, s, u, c, h, y = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: J, dbReadyPromise: null, cancelOpen: J, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
2939
2935
|
y.dbReadyPromise = new B(function(f) {
|
|
2940
2936
|
y.dbReadyResolve = f;
|
|
2941
|
-
}), y.openCanceller = new B(function(f,
|
|
2942
|
-
y.cancelOpen =
|
|
2943
|
-
}), this._state = y, this.name = e, this.on = dt(this, "populate", "blocked", "versionchange", "close", { ready: [sn,
|
|
2944
|
-
return function(
|
|
2937
|
+
}), y.openCanceller = new B(function(f, S) {
|
|
2938
|
+
y.cancelOpen = S;
|
|
2939
|
+
}), this._state = y, this.name = e, this.on = dt(this, "populate", "blocked", "versionchange", "close", { ready: [sn, J] }), this.on.ready.subscribe = Hn(this.on.ready.subscribe, function(f) {
|
|
2940
|
+
return function(S, p) {
|
|
2945
2941
|
ne.vip(function() {
|
|
2946
2942
|
var b, w = n._state;
|
|
2947
|
-
w.openComplete ? (w.dbOpenError || B.resolve().then(
|
|
2948
|
-
b.on.ready.unsubscribe(
|
|
2943
|
+
w.openComplete ? (w.dbOpenError || B.resolve().then(S), p && f(S)) : w.onReadyBeingFired ? (w.onReadyBeingFired.push(S), p && f(S)) : (f(S), b = n, p || f(function m() {
|
|
2944
|
+
b.on.ready.unsubscribe(S), b.on.ready.unsubscribe(m);
|
|
2949
2945
|
}));
|
|
2950
2946
|
});
|
|
2951
2947
|
};
|
|
2952
|
-
}), this.Collection = (i = this, ft(ia.prototype, function(
|
|
2948
|
+
}), this.Collection = (i = this, ft(ia.prototype, function(_, m) {
|
|
2953
2949
|
this.db = i;
|
|
2954
2950
|
var p = sr, b = null;
|
|
2955
2951
|
if (m) try {
|
|
@@ -2957,52 +2953,52 @@ function Ra() {
|
|
|
2957
2953
|
} catch (E) {
|
|
2958
2954
|
b = E;
|
|
2959
2955
|
}
|
|
2960
|
-
var w =
|
|
2961
|
-
this._ctx = { table: m, index: w.index, isPrimKey: !w.index || m.schema.primKey.keyPath && w.index === m.schema.primKey.name, range: p, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: b, or: w.or, valueMapper:
|
|
2962
|
-
})), this.Table = (s = this, ft(lr.prototype, function(f,
|
|
2963
|
-
this.db = s, this._tx = p, this.name = f, this.schema =
|
|
2964
|
-
})), this.Transaction = (u = this, ft(ua.prototype, function(f,
|
|
2956
|
+
var w = _._ctx, m = w.table, _ = m.hook.reading.fire;
|
|
2957
|
+
this._ctx = { table: m, index: w.index, isPrimKey: !w.index || m.schema.primKey.keyPath && w.index === m.schema.primKey.name, range: p, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: b, or: w.or, valueMapper: _ !== st ? _ : null };
|
|
2958
|
+
})), this.Table = (s = this, ft(lr.prototype, function(f, S, p) {
|
|
2959
|
+
this.db = s, this._tx = p, this.name = f, this.schema = S, this.hook = s._allTables[f] ? s._allTables[f].hook : dt(null, { creating: [Jr, J], reading: [Xr, st], updating: [Zr, J], deleting: [Vr, J] });
|
|
2960
|
+
})), this.Transaction = (u = this, ft(ua.prototype, function(f, S, p, b, w) {
|
|
2965
2961
|
var m = this;
|
|
2966
|
-
this.db = u, this.mode = f, this.storeNames =
|
|
2967
|
-
m._resolve =
|
|
2962
|
+
this.db = u, this.mode = f, this.storeNames = S, this.schema = p, this.chromeTransactionDurability = b, this.idbtrans = null, this.on = dt(this, "complete", "error", "abort"), this.parent = w || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new B(function(_, E) {
|
|
2963
|
+
m._resolve = _, m._reject = E;
|
|
2968
2964
|
}), this._completion.then(function() {
|
|
2969
2965
|
m.active = !1, m.on.complete.fire();
|
|
2970
|
-
}, function(
|
|
2966
|
+
}, function(_) {
|
|
2971
2967
|
var E = m.active;
|
|
2972
|
-
return m.active = !1, m.on.error.fire(
|
|
2968
|
+
return m.active = !1, m.on.error.fire(_), m.parent ? m.parent._reject(_) : E && m.idbtrans && m.idbtrans.abort(), te(_);
|
|
2973
2969
|
});
|
|
2974
2970
|
})), this.Version = (c = this, ft(ga.prototype, function(f) {
|
|
2975
2971
|
this.db = c, this._cfg = { version: f, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
2976
|
-
})), this.WhereClause = (h = this, ft(gr.prototype, function(f,
|
|
2977
|
-
if (this.db = h, this._ctx = { table: f, index:
|
|
2972
|
+
})), this.WhereClause = (h = this, ft(gr.prototype, function(f, S, p) {
|
|
2973
|
+
if (this.db = h, this._ctx = { table: f, index: S === ":id" ? null : S, or: p }, this._cmp = this._ascending = Y, this._descending = function(b, w) {
|
|
2978
2974
|
return Y(w, b);
|
|
2979
2975
|
}, this._max = function(b, w) {
|
|
2980
2976
|
return 0 < Y(b, w) ? b : w;
|
|
2981
2977
|
}, this._min = function(b, w) {
|
|
2982
2978
|
return Y(b, w) < 0 ? b : w;
|
|
2983
|
-
}, this._IDBKeyRange = h._deps.IDBKeyRange, !this._IDBKeyRange) throw new
|
|
2979
|
+
}, this._IDBKeyRange = h._deps.IDBKeyRange, !this._IDBKeyRange) throw new $.MissingAPI();
|
|
2984
2980
|
})), this.on("versionchange", function(f) {
|
|
2985
2981
|
0 < f.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
|
|
2986
2982
|
}), this.on("blocked", function(f) {
|
|
2987
2983
|
!f.newVersion || f.newVersion < f.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(f.oldVersion / 10));
|
|
2988
|
-
}), this._maxKey = yt(t.IDBKeyRange), this._createTransaction = function(f,
|
|
2989
|
-
return new n.Transaction(f,
|
|
2984
|
+
}), this._maxKey = yt(t.IDBKeyRange), this._createTransaction = function(f, S, p, b) {
|
|
2985
|
+
return new n.Transaction(f, S, p, n._options.chromeTransactionDurability, b);
|
|
2990
2986
|
}, this._fireOnBlocked = function(f) {
|
|
2991
|
-
n.on("blocked").fire(f), et.filter(function(
|
|
2992
|
-
return
|
|
2993
|
-
}).map(function(
|
|
2994
|
-
return
|
|
2987
|
+
n.on("blocked").fire(f), et.filter(function(S) {
|
|
2988
|
+
return S.name === n.name && S !== n && !S._state.vcFired;
|
|
2989
|
+
}).map(function(S) {
|
|
2990
|
+
return S.on("versionchange").fire(f);
|
|
2995
2991
|
});
|
|
2996
2992
|
}, this.use(va), this.use(Ea), this.use(wa), this.use(ma), this.use(ba);
|
|
2997
|
-
var v = new Proxy(this, { get: function(f,
|
|
2998
|
-
if (
|
|
2999
|
-
if (
|
|
2993
|
+
var v = new Proxy(this, { get: function(f, S, p) {
|
|
2994
|
+
if (S === "_vip") return !0;
|
|
2995
|
+
if (S === "table") return function(w) {
|
|
3000
2996
|
return Qt(n.table(w), v);
|
|
3001
2997
|
};
|
|
3002
|
-
var b = Reflect.get(f,
|
|
3003
|
-
return b instanceof lr ? Qt(b, v) :
|
|
2998
|
+
var b = Reflect.get(f, S, p);
|
|
2999
|
+
return b instanceof lr ? Qt(b, v) : S === "tables" ? b.map(function(w) {
|
|
3004
3000
|
return Qt(w, v);
|
|
3005
|
-
}) :
|
|
3001
|
+
}) : S === "_createTransaction" ? function() {
|
|
3006
3002
|
return Qt(b.apply(this, arguments), v);
|
|
3007
3003
|
} : b;
|
|
3008
3004
|
} });
|
|
@@ -3031,14 +3027,14 @@ function Ra() {
|
|
|
3031
3027
|
c || (c = !0, u && u.abort(), f && Ce.storagemutated.unsubscribe(p));
|
|
3032
3028
|
} };
|
|
3033
3029
|
i.start && i.start(v);
|
|
3034
|
-
var f = !1,
|
|
3030
|
+
var f = !1, S = function() {
|
|
3035
3031
|
return pn(b);
|
|
3036
3032
|
}, p = function(w) {
|
|
3037
|
-
zt(h, w), Cn(y, h) &&
|
|
3033
|
+
zt(h, w), Cn(y, h) && S();
|
|
3038
3034
|
}, b = function() {
|
|
3039
|
-
var w, m,
|
|
3040
|
-
!c && Xt.indexedDB && (h = {}, w = {}, u && u.abort(), u = new AbortController(),
|
|
3041
|
-
var O =
|
|
3035
|
+
var w, m, _;
|
|
3036
|
+
!c && Xt.indexedDB && (h = {}, w = {}, u && u.abort(), u = new AbortController(), _ = function(E) {
|
|
3037
|
+
var O = Ve();
|
|
3042
3038
|
try {
|
|
3043
3039
|
s && qe();
|
|
3044
3040
|
var A = ke(e, E);
|
|
@@ -3046,7 +3042,7 @@ function Ra() {
|
|
|
3046
3042
|
} finally {
|
|
3047
3043
|
O && Ze();
|
|
3048
3044
|
}
|
|
3049
|
-
}(m = { subscr: w, signal: u.signal, requery:
|
|
3045
|
+
}(m = { subscr: w, signal: u.signal, requery: S, querier: e, trans: null }), Promise.resolve(_).then(function(E) {
|
|
3050
3046
|
n = !0, t = E, c || m.signal.aborted || (h = {}, function(O) {
|
|
3051
3047
|
for (var A in O) if (ee(O, A)) return;
|
|
3052
3048
|
return 1;
|
|
@@ -3059,7 +3055,7 @@ function Ra() {
|
|
|
3059
3055
|
});
|
|
3060
3056
|
}));
|
|
3061
3057
|
};
|
|
3062
|
-
return setTimeout(
|
|
3058
|
+
return setTimeout(S, 0), v;
|
|
3063
3059
|
});
|
|
3064
3060
|
return a.hasValue = function() {
|
|
3065
3061
|
return n;
|
|
@@ -3094,15 +3090,15 @@ function Ra() {
|
|
|
3094
3090
|
});
|
|
3095
3091
|
}) : kn(n, t).toCollection().primaryKeys()).then(e);
|
|
3096
3092
|
} catch {
|
|
3097
|
-
return te(new
|
|
3093
|
+
return te(new $.MissingAPI());
|
|
3098
3094
|
}
|
|
3099
3095
|
var t, n;
|
|
3100
3096
|
}, defineClass: function() {
|
|
3101
3097
|
return function(e) {
|
|
3102
|
-
|
|
3098
|
+
M(this, e);
|
|
3103
3099
|
};
|
|
3104
3100
|
}, ignoreTransaction: function(e) {
|
|
3105
|
-
return
|
|
3101
|
+
return G.trans ? Ge(G.transless, e) : e();
|
|
3106
3102
|
}, vip: Pn, async: function(e) {
|
|
3107
3103
|
return function() {
|
|
3108
3104
|
try {
|
|
@@ -3120,14 +3116,14 @@ function Ra() {
|
|
|
3120
3116
|
return te(i);
|
|
3121
3117
|
}
|
|
3122
3118
|
}, currentTransaction: { get: function() {
|
|
3123
|
-
return
|
|
3119
|
+
return G.trans || null;
|
|
3124
3120
|
} }, waitFor: function(e, t) {
|
|
3125
|
-
return t = B.resolve(typeof e == "function" ? We.ignoreTransaction(e) : e).timeout(t || 6e4),
|
|
3121
|
+
return t = B.resolve(typeof e == "function" ? We.ignoreTransaction(e) : e).timeout(t || 6e4), G.trans ? G.trans.waitFor(t) : t;
|
|
3126
3122
|
}, Promise: B, debug: { get: function() {
|
|
3127
3123
|
return me;
|
|
3128
3124
|
}, set: function(e) {
|
|
3129
3125
|
qn(e);
|
|
3130
|
-
} }, derive: Ye, extend:
|
|
3126
|
+
} }, derive: Ye, extend: M, props: le, override: Hn, Events: dt, on: Ce, liveQuery: Ir, extendObservabilitySet: zt, getByKeyPath: we, setByKeyPath: fe, delByKeyPath: function(e, t) {
|
|
3131
3127
|
typeof t == "string" ? fe(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
3132
3128
|
fe(e, n, void 0);
|
|
3133
3129
|
});
|
|
@@ -3173,7 +3169,7 @@ var Ta = Ra();
|
|
|
3173
3169
|
const Wn = /* @__PURE__ */ Ia(Ta), Tr = Symbol.for("Dexie"), en = globalThis[Tr] || (globalThis[Tr] = Wn);
|
|
3174
3170
|
if (Wn.semVer !== en.semVer)
|
|
3175
3171
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${Wn.semVer} and ${en.semVer}`);
|
|
3176
|
-
function
|
|
3172
|
+
function V(d) {
|
|
3177
3173
|
let r = `${d.type}.${d.topics}`;
|
|
3178
3174
|
return d.order && (r += `.${d.order}`), d.period && (r += `.${d.period}`), r;
|
|
3179
3175
|
}
|
|
@@ -3185,12 +3181,12 @@ function Mr(d) {
|
|
|
3185
3181
|
}
|
|
3186
3182
|
return d.topics === void 0 && (d.topics = `${d.dashboard}-${d.widget}`), d;
|
|
3187
3183
|
}
|
|
3188
|
-
function
|
|
3189
|
-
var
|
|
3184
|
+
function St(d, r) {
|
|
3185
|
+
var U;
|
|
3190
3186
|
let o, l, x, D, K;
|
|
3191
3187
|
switch (d.moderation) {
|
|
3192
3188
|
case Zt.BEFORE:
|
|
3193
|
-
o = /* @__PURE__ */ new Date(), l = (
|
|
3189
|
+
o = /* @__PURE__ */ new Date(), l = (U = d.beforeTime) == null ? void 0 : U.split(":"), x = Number.parseInt(l ? l[0] : "00"), D = Number.parseInt(l ? l[1] : "00"), K = Number.parseInt(l ? l[2] : "00"), r.before = o.setHours(x, D, K, 0) / 1e3, r.period || (r.period = o.getDay() === 1 ? 72 : 24);
|
|
3194
3190
|
break;
|
|
3195
3191
|
case Zt.DELAYED:
|
|
3196
3192
|
d.delay && d.delay > 0 && (r.delay = `${d.delay}`);
|
|
@@ -3254,11 +3250,11 @@ class jr {
|
|
|
3254
3250
|
o !== "utc" && (r.since = Math.floor(Date.now() / 1e3) - 60 * 60 * 24 * 7), this.options.delay != 0 ? r.before = Math.floor(Date.now() / 1e3) - (this.options.delay || 0) : r.before = Math.floor(Date.now() / 1e3);
|
|
3255
3251
|
const l = (K) => K.utc > ((r == null ? void 0 : r.since) || 0), x = (K) => K.utc < ((r == null ? void 0 : r.before) || Date.now() / 1e3), D = (K) => (K == null ? void 0 : K.visible) !== 0;
|
|
3256
3252
|
try {
|
|
3257
|
-
const
|
|
3258
|
-
if (
|
|
3253
|
+
const U = await this.db.table(N.TOPICS).where("widget_id").equals(r.widget).filter(D).filter(l).filter(x).reverse().limit((r == null ? void 0 : r.limit) ?? 25).sortBy(o);
|
|
3254
|
+
if (U.length === 0)
|
|
3259
3255
|
return { data: null, message: "No Messages error", success: !1 };
|
|
3260
|
-
let
|
|
3261
|
-
return en.Promise.all(
|
|
3256
|
+
let M = U.map((X) => this.db.table(N.MESSAGES).get({ id: X.message_id }));
|
|
3257
|
+
return en.Promise.all(M).then(async (X) => {
|
|
3262
3258
|
const se = X.map((le) => le.data), ee = {
|
|
3263
3259
|
data: {
|
|
3264
3260
|
presentation: (r == null ? void 0 : r.presentation) || "not set",
|
|
@@ -3326,7 +3322,7 @@ class jr {
|
|
|
3326
3322
|
const l = o.data.title;
|
|
3327
3323
|
let x = 0;
|
|
3328
3324
|
return o.data.messages.forEach(async (D) => {
|
|
3329
|
-
var K,
|
|
3325
|
+
var K, U, M, X, se, ee, le;
|
|
3330
3326
|
D.id !== null && (await this.db.table(N.MESSAGES).put({
|
|
3331
3327
|
id: D.id,
|
|
3332
3328
|
utc: D.utc,
|
|
@@ -3346,8 +3342,8 @@ class jr {
|
|
|
3346
3342
|
widget_id: r.widget,
|
|
3347
3343
|
message_id: D.id,
|
|
3348
3344
|
dashboard_id: r.dashboard,
|
|
3349
|
-
engagement: ((K = D.topics[0]) == null ? void 0 : K.engagement) || ((
|
|
3350
|
-
impressions: ((
|
|
3345
|
+
engagement: ((K = D.topics[0]) == null ? void 0 : K.engagement) || ((U = D.dynamics) == null ? void 0 : U.engagement) || 0,
|
|
3346
|
+
impressions: ((M = D.topics[0]) == null ? void 0 : M.impressions) || ((X = D.dynamics) == null ? void 0 : X.semrush_visits) || 0,
|
|
3351
3347
|
reach: ((se = D.topics[0]) == null ? void 0 : se.reach) || ((ee = D.dynamics) == null ? void 0 : ee.potential_reach) || 0,
|
|
3352
3348
|
sentiment: ((le = D.topics[0]) == null ? void 0 : le.sentiment) || 0,
|
|
3353
3349
|
utc: D.utc,
|
|
@@ -3363,13 +3359,13 @@ class jr {
|
|
|
3363
3359
|
);
|
|
3364
3360
|
}));
|
|
3365
3361
|
}), o.data.topics.forEach(async (D) => {
|
|
3366
|
-
const K = D.message_id,
|
|
3367
|
-
await this.db.table(N.TOPICS).where("message_id").equals(K).modify({ visible:
|
|
3362
|
+
const K = D.message_id, U = D.visible ? 1 : 0, M = D.title;
|
|
3363
|
+
await this.db.table(N.TOPICS).where("message_id").equals(K).modify({ visible: U }).catch((X) => {
|
|
3368
3364
|
x++, console.error(
|
|
3369
3365
|
"%cstorage",
|
|
3370
3366
|
g.STORAGE,
|
|
3371
3367
|
"update message visibility",
|
|
3372
|
-
`title: ${
|
|
3368
|
+
`title: ${M}`,
|
|
3373
3369
|
`widget: ${D.widget_id}`,
|
|
3374
3370
|
X.message
|
|
3375
3371
|
);
|
|
@@ -3427,7 +3423,7 @@ class jr {
|
|
|
3427
3423
|
*/
|
|
3428
3424
|
k(this, "subscribe", (r) => (r = Mr(r), this.subscribers.filter(
|
|
3429
3425
|
(l) => l.widget === r.widget
|
|
3430
|
-
).length > 0 || (r.type === N.MESSAGES && (r =
|
|
3426
|
+
).length > 0 || (r.type === N.MESSAGES && (r = St(this.options, r)), console.info(
|
|
3431
3427
|
"%cstorage%c %csubscribe",
|
|
3432
3428
|
g.STORAGE,
|
|
3433
3429
|
g.NONE,
|
|
@@ -3511,7 +3507,7 @@ let Un;
|
|
|
3511
3507
|
function Nr() {
|
|
3512
3508
|
return Un || (Un = Ma("keyval-store", "keyval")), Un;
|
|
3513
3509
|
}
|
|
3514
|
-
function
|
|
3510
|
+
function Vt(d, r = Nr()) {
|
|
3515
3511
|
return r("readonly", (o) => zn(o.get(d)));
|
|
3516
3512
|
}
|
|
3517
3513
|
function wt(d, r, o = Nr()) {
|
|
@@ -3522,16 +3518,16 @@ class Kr {
|
|
|
3522
3518
|
k(this, "subscribers", []);
|
|
3523
3519
|
k(this, "options");
|
|
3524
3520
|
k(this, "getCloud", async (r) => {
|
|
3525
|
-
const o =
|
|
3526
|
-
return await
|
|
3521
|
+
const o = V(r);
|
|
3522
|
+
return await Vt(o).then((l) => l).catch(() => (console.warn("%capi", g.API, N.CLOUD, r.slide, r.widget), { data: null, message: "Cloud Data error", success: !1 }));
|
|
3527
3523
|
});
|
|
3528
3524
|
k(this, "getSeries", async (r) => {
|
|
3529
|
-
const o =
|
|
3530
|
-
return await
|
|
3525
|
+
const o = V(r);
|
|
3526
|
+
return await Vt(o).then((l) => l).catch(() => (console.warn("%capi", g.API, N.SERIES, r.slide, r.widget), { data: null, message: "Series Data error", success: !1 }));
|
|
3531
3527
|
});
|
|
3532
3528
|
k(this, "getMessages", async (r) => {
|
|
3533
|
-
const o =
|
|
3534
|
-
return await
|
|
3529
|
+
const o = V(r);
|
|
3530
|
+
return await Vt(o).then((l) => l).catch(() => (console.warn("%capi", g.API, N.MESSAGES, r.slide, r.widget), { data: null, message: "Messages Data error", success: !1 }));
|
|
3535
3531
|
});
|
|
3536
3532
|
/**
|
|
3537
3533
|
* Update Cloud
|
|
@@ -3542,7 +3538,7 @@ class Kr {
|
|
|
3542
3538
|
k(this, "setCloud", async (r, o) => {
|
|
3543
3539
|
if (!o.success)
|
|
3544
3540
|
return 400;
|
|
3545
|
-
const l =
|
|
3541
|
+
const l = V(r);
|
|
3546
3542
|
return delete o.success, delete o.message, await wt(l, o).then(() => 201).catch((x) => (console.error("%cstorage", g.STORAGE, N.CLOUD, r, x.message), 400));
|
|
3547
3543
|
});
|
|
3548
3544
|
/**
|
|
@@ -3554,7 +3550,7 @@ class Kr {
|
|
|
3554
3550
|
k(this, "setSeries", async (r, o) => {
|
|
3555
3551
|
if (!o.success)
|
|
3556
3552
|
return 400;
|
|
3557
|
-
const l =
|
|
3553
|
+
const l = V(r);
|
|
3558
3554
|
return delete o.success, delete o.message, await wt(l, o).then(() => 201).catch((x) => (console.error("%cstorage", g.STORAGE, N.SERIES, r, x.message), 400));
|
|
3559
3555
|
});
|
|
3560
3556
|
/**
|
|
@@ -3566,7 +3562,7 @@ class Kr {
|
|
|
3566
3562
|
k(this, "setMessages", async (r, o) => {
|
|
3567
3563
|
if (!o.success)
|
|
3568
3564
|
return 400;
|
|
3569
|
-
const l =
|
|
3565
|
+
const l = V(r);
|
|
3570
3566
|
return delete o.success, delete o.message, await wt(l, o).then(() => 201).catch((x) => (console.error("%cstorage", g.STORAGE, N.MESSAGES, r, x.message), 400));
|
|
3571
3567
|
});
|
|
3572
3568
|
k(this, "cleanMessages", async (r) => (console.log("cleanMessages not implemented for ", this.options.storage), await new Promise((o) => o(0))));
|
|
@@ -3581,7 +3577,7 @@ class Kr {
|
|
|
3581
3577
|
* @returns number
|
|
3582
3578
|
*/
|
|
3583
3579
|
k(this, "setWidget", async (r) => {
|
|
3584
|
-
const o =
|
|
3580
|
+
const o = V(r), l = {
|
|
3585
3581
|
id: r.widget,
|
|
3586
3582
|
dashboard_id: r.dashboard,
|
|
3587
3583
|
type: r.type
|
|
@@ -3593,7 +3589,7 @@ class Kr {
|
|
|
3593
3589
|
* @param query IQuery
|
|
3594
3590
|
* @returns null
|
|
3595
3591
|
*/
|
|
3596
|
-
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r =
|
|
3592
|
+
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r = St(this.options, r)), this.subscribers.filter(
|
|
3597
3593
|
(l) => l.widget === r.widget
|
|
3598
3594
|
).length > 0 || (console.debug(
|
|
3599
3595
|
"%cstorage%c %csubscribe",
|
|
@@ -3609,8 +3605,8 @@ class Kr {
|
|
|
3609
3605
|
*/
|
|
3610
3606
|
k(this, "getSubscribers", async () => await new Promise((r) => r(this.subscribers)));
|
|
3611
3607
|
k(this, "loadSlide", async (r) => {
|
|
3612
|
-
const o =
|
|
3613
|
-
return await
|
|
3608
|
+
const o = V(r);
|
|
3609
|
+
return await Vt(o).then((l) => l).catch(() => (console.warn("%capi", g.API, N.SLIDE, r.slide), { data: null, message: "Slide Load error", success: !1 }));
|
|
3614
3610
|
});
|
|
3615
3611
|
/**
|
|
3616
3612
|
* Update Slide
|
|
@@ -3618,7 +3614,7 @@ class Kr {
|
|
|
3618
3614
|
* @returns number
|
|
3619
3615
|
*/
|
|
3620
3616
|
k(this, "storeSlide", async (r) => {
|
|
3621
|
-
const o =
|
|
3617
|
+
const o = V(r), l = {
|
|
3622
3618
|
id: r.id,
|
|
3623
3619
|
title: r.data.title || "Not set",
|
|
3624
3620
|
json: r.data.json || {},
|
|
@@ -3635,7 +3631,7 @@ class Br {
|
|
|
3635
3631
|
k(this, "subscribers", []);
|
|
3636
3632
|
k(this, "options");
|
|
3637
3633
|
k(this, "getCloud", async (r) => {
|
|
3638
|
-
const o =
|
|
3634
|
+
const o = V(r);
|
|
3639
3635
|
try {
|
|
3640
3636
|
return localStorage.getObject(o);
|
|
3641
3637
|
} catch (l) {
|
|
@@ -3643,7 +3639,7 @@ class Br {
|
|
|
3643
3639
|
}
|
|
3644
3640
|
});
|
|
3645
3641
|
k(this, "getSeries", async (r) => {
|
|
3646
|
-
const o =
|
|
3642
|
+
const o = V(r);
|
|
3647
3643
|
try {
|
|
3648
3644
|
return localStorage.getObject(o);
|
|
3649
3645
|
} catch (l) {
|
|
@@ -3651,7 +3647,7 @@ class Br {
|
|
|
3651
3647
|
}
|
|
3652
3648
|
});
|
|
3653
3649
|
k(this, "getMessages", async (r) => {
|
|
3654
|
-
const o =
|
|
3650
|
+
const o = V(r);
|
|
3655
3651
|
try {
|
|
3656
3652
|
return localStorage.getObject(o);
|
|
3657
3653
|
} catch (l) {
|
|
@@ -3665,7 +3661,7 @@ class Br {
|
|
|
3665
3661
|
* @returns number
|
|
3666
3662
|
*/
|
|
3667
3663
|
k(this, "setCloud", async (r, o) => {
|
|
3668
|
-
const l =
|
|
3664
|
+
const l = V(r);
|
|
3669
3665
|
try {
|
|
3670
3666
|
return localStorage.setObject(l, o), 201;
|
|
3671
3667
|
} catch (x) {
|
|
@@ -3679,7 +3675,7 @@ class Br {
|
|
|
3679
3675
|
* @returns number
|
|
3680
3676
|
*/
|
|
3681
3677
|
k(this, "setSeries", async (r, o) => {
|
|
3682
|
-
const l =
|
|
3678
|
+
const l = V(r);
|
|
3683
3679
|
try {
|
|
3684
3680
|
return localStorage.setObject(l, o), 201;
|
|
3685
3681
|
} catch (x) {
|
|
@@ -3693,7 +3689,7 @@ class Br {
|
|
|
3693
3689
|
* @returns number
|
|
3694
3690
|
*/
|
|
3695
3691
|
k(this, "setMessages", async (r, o) => {
|
|
3696
|
-
const l =
|
|
3692
|
+
const l = V(r);
|
|
3697
3693
|
try {
|
|
3698
3694
|
return localStorage.setObject(l, o), 200;
|
|
3699
3695
|
} catch (x) {
|
|
@@ -3717,7 +3713,7 @@ class Br {
|
|
|
3717
3713
|
* @param query IQuery
|
|
3718
3714
|
* @returns null
|
|
3719
3715
|
*/
|
|
3720
|
-
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r =
|
|
3716
|
+
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r = St(this.options, r)), this.subscribers.filter(
|
|
3721
3717
|
(l) => l.widget === r.widget
|
|
3722
3718
|
).length || (console.debug(
|
|
3723
3719
|
"%cstorage%c %csubscribe",
|
|
@@ -3765,7 +3761,7 @@ class Lr {
|
|
|
3765
3761
|
k(this, "subscribers", []);
|
|
3766
3762
|
k(this, "options");
|
|
3767
3763
|
k(this, "getCloud", async (r) => {
|
|
3768
|
-
const o =
|
|
3764
|
+
const o = V(r);
|
|
3769
3765
|
try {
|
|
3770
3766
|
return sessionStorage.getObject(o);
|
|
3771
3767
|
} catch (l) {
|
|
@@ -3773,7 +3769,7 @@ class Lr {
|
|
|
3773
3769
|
}
|
|
3774
3770
|
});
|
|
3775
3771
|
k(this, "getSeries", async (r) => {
|
|
3776
|
-
const o =
|
|
3772
|
+
const o = V(r);
|
|
3777
3773
|
try {
|
|
3778
3774
|
return sessionStorage.getObject(o);
|
|
3779
3775
|
} catch (l) {
|
|
@@ -3781,7 +3777,7 @@ class Lr {
|
|
|
3781
3777
|
}
|
|
3782
3778
|
});
|
|
3783
3779
|
k(this, "getMessages", async (r) => {
|
|
3784
|
-
const o =
|
|
3780
|
+
const o = V(r);
|
|
3785
3781
|
try {
|
|
3786
3782
|
return sessionStorage.getObject(o);
|
|
3787
3783
|
} catch (l) {
|
|
@@ -3795,7 +3791,7 @@ class Lr {
|
|
|
3795
3791
|
* @returns number
|
|
3796
3792
|
*/
|
|
3797
3793
|
k(this, "setCloud", async (r, o) => {
|
|
3798
|
-
const l =
|
|
3794
|
+
const l = V(r);
|
|
3799
3795
|
try {
|
|
3800
3796
|
return sessionStorage.setObject(l, o), 201;
|
|
3801
3797
|
} catch (x) {
|
|
@@ -3809,7 +3805,7 @@ class Lr {
|
|
|
3809
3805
|
* @returns number
|
|
3810
3806
|
*/
|
|
3811
3807
|
k(this, "setSeries", async (r, o) => {
|
|
3812
|
-
const l =
|
|
3808
|
+
const l = V(r);
|
|
3813
3809
|
try {
|
|
3814
3810
|
return sessionStorage.setObject(l, o), 201;
|
|
3815
3811
|
} catch (x) {
|
|
@@ -3823,7 +3819,7 @@ class Lr {
|
|
|
3823
3819
|
* @returns number
|
|
3824
3820
|
*/
|
|
3825
3821
|
k(this, "setMessages", async (r, o) => {
|
|
3826
|
-
const l =
|
|
3822
|
+
const l = V(r);
|
|
3827
3823
|
try {
|
|
3828
3824
|
return sessionStorage.setObject(l, o), 200;
|
|
3829
3825
|
} catch (x) {
|
|
@@ -3847,7 +3843,7 @@ class Lr {
|
|
|
3847
3843
|
* @param query IQuery
|
|
3848
3844
|
* @returns null
|
|
3849
3845
|
*/
|
|
3850
|
-
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r =
|
|
3846
|
+
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r = St(this.options, r)), this.subscribers.filter(
|
|
3851
3847
|
(l) => l.widget === r.widget
|
|
3852
3848
|
).length || (console.debug(
|
|
3853
3849
|
"%cstorage%c %csubscribe",
|
|
@@ -3900,7 +3896,7 @@ class Gr {
|
|
|
3900
3896
|
k(this, "subscribers", []);
|
|
3901
3897
|
k(this, "options");
|
|
3902
3898
|
k(this, "getCloud", async (r) => {
|
|
3903
|
-
const o =
|
|
3899
|
+
const o = V(r);
|
|
3904
3900
|
try {
|
|
3905
3901
|
return window.BuzzCasting.WidgetData[o];
|
|
3906
3902
|
} catch (l) {
|
|
@@ -3908,7 +3904,7 @@ class Gr {
|
|
|
3908
3904
|
}
|
|
3909
3905
|
});
|
|
3910
3906
|
k(this, "getSeries", async (r) => {
|
|
3911
|
-
const o =
|
|
3907
|
+
const o = V(r);
|
|
3912
3908
|
try {
|
|
3913
3909
|
return window.BuzzCasting.WidgetData[o];
|
|
3914
3910
|
} catch (l) {
|
|
@@ -3916,7 +3912,7 @@ class Gr {
|
|
|
3916
3912
|
}
|
|
3917
3913
|
});
|
|
3918
3914
|
k(this, "getMessages", async (r) => {
|
|
3919
|
-
const o =
|
|
3915
|
+
const o = V(r);
|
|
3920
3916
|
try {
|
|
3921
3917
|
return window.BuzzCasting.WidgetData[o];
|
|
3922
3918
|
} catch (l) {
|
|
@@ -3930,7 +3926,7 @@ class Gr {
|
|
|
3930
3926
|
* @returns number
|
|
3931
3927
|
*/
|
|
3932
3928
|
k(this, "setCloud", async (r, o) => {
|
|
3933
|
-
const l =
|
|
3929
|
+
const l = V(r);
|
|
3934
3930
|
try {
|
|
3935
3931
|
return window.BuzzCasting.WidgetData[l] = o, 201;
|
|
3936
3932
|
} catch (x) {
|
|
@@ -3944,7 +3940,7 @@ class Gr {
|
|
|
3944
3940
|
* @returns number
|
|
3945
3941
|
*/
|
|
3946
3942
|
k(this, "setSeries", async (r, o) => {
|
|
3947
|
-
const l =
|
|
3943
|
+
const l = V(r);
|
|
3948
3944
|
try {
|
|
3949
3945
|
return window.BuzzCasting.WidgetData[l] = o, 201;
|
|
3950
3946
|
} catch (x) {
|
|
@@ -3958,7 +3954,7 @@ class Gr {
|
|
|
3958
3954
|
* @returns number
|
|
3959
3955
|
*/
|
|
3960
3956
|
k(this, "setMessages", async (r, o) => {
|
|
3961
|
-
const l =
|
|
3957
|
+
const l = V(r);
|
|
3962
3958
|
try {
|
|
3963
3959
|
return window.BuzzCasting.WidgetData[l] = o, 201;
|
|
3964
3960
|
} catch (x) {
|
|
@@ -3982,7 +3978,7 @@ class Gr {
|
|
|
3982
3978
|
* @param query IQuery
|
|
3983
3979
|
* @returns null
|
|
3984
3980
|
*/
|
|
3985
|
-
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r =
|
|
3981
|
+
k(this, "subscribe", (r) => (r.type === N.MESSAGES && (r = St(this.options, r)), this.subscribers.filter(
|
|
3986
3982
|
(l) => l.widget === r.widget
|
|
3987
3983
|
).length || (console.debug(
|
|
3988
3984
|
"%cstorage%c %csubscribe",
|
|
@@ -4121,7 +4117,7 @@ function Ka(d) {
|
|
|
4121
4117
|
{}
|
|
4122
4118
|
);
|
|
4123
4119
|
}
|
|
4124
|
-
function
|
|
4120
|
+
function Ja(d, r = "font-bold") {
|
|
4125
4121
|
return `${(d == null ? void 0 : d.title.length) > 0 ? `<div class="${r}">${d.title}</div>` : ""}${d != null && d.content ? d.content.replace(/\n\n/g, `
|
|
4126
4122
|
`).replace(/\n/g, "<br/>") : ""}`;
|
|
4127
4123
|
}
|
|
@@ -4171,7 +4167,7 @@ function Ga(d) {
|
|
|
4171
4167
|
function Fn(d) {
|
|
4172
4168
|
return Ba($r(0, d, "", []).toString(16), 8);
|
|
4173
4169
|
}
|
|
4174
|
-
function
|
|
4170
|
+
function Va(d, r) {
|
|
4175
4171
|
if (d = d.toString().replace(/[^0-9.]/g, ""), d < 1e3)
|
|
4176
4172
|
return d;
|
|
4177
4173
|
const o = [
|
|
@@ -4216,10 +4212,10 @@ function qa(d) {
|
|
|
4216
4212
|
function ei(d) {
|
|
4217
4213
|
const r = window.BuzzCasting.getOptions().suspended ?? !1;
|
|
4218
4214
|
return d.forEach((o) => {
|
|
4219
|
-
var l, x, D, K,
|
|
4220
|
-
if (r ? o.content = "License suspended, please contact your Sales Representative to restore service" : o.content = ((l = o.content) == null ? void 0 : l.replace(/(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)((\?.*)?)/g, "")) || "", o.sender !== null ? ((((x = o.sender) == null ? void 0 : x.title) === "Unknown author" || ((D = o.sender) == null ? void 0 : D.title) === null) && (o.sender.title = ""), ((K = o.sender) == null ? void 0 : K.name) !== "" && o.sender.title === "" && (o.sender.title = o.sender.name), ((
|
|
4221
|
-
const
|
|
4222
|
-
o.sender.title =
|
|
4215
|
+
var l, x, D, K, U;
|
|
4216
|
+
if (r ? o.content = "License suspended, please contact your Sales Representative to restore service" : o.content = ((l = o.content) == null ? void 0 : l.replace(/(https?:\/\/)?([\da-z.-]+)\.([a-z.]{2,6})([/\w .-]*)((\?.*)?)/g, "")) || "", o.sender !== null ? ((((x = o.sender) == null ? void 0 : x.title) === "Unknown author" || ((D = o.sender) == null ? void 0 : D.title) === null) && (o.sender.title = ""), ((K = o.sender) == null ? void 0 : K.name) !== "" && o.sender.title === "" && (o.sender.title = o.sender.name), ((U = o.sender) == null ? void 0 : U.name) !== "" && o.channel === "tw" && (o.sender.name = `@${o.sender.name}`)) : o.sender = { title: "", name: "", id: "", avatar: "default", bio: "", location: "", following: 0, verified: 0, listed: 0, followers: 0, favourites: 0, messages: 0, influence: 0 }, o.sender.title === "" && o.link !== "") {
|
|
4217
|
+
const M = new URL(o.link);
|
|
4218
|
+
o.sender.title = M.hostname.replace("www.", "");
|
|
4223
4219
|
}
|
|
4224
4220
|
}), d;
|
|
4225
4221
|
}
|
|
@@ -4273,98 +4269,98 @@ class si {
|
|
|
4273
4269
|
l.push(this.api.get(x));
|
|
4274
4270
|
}), await Promise.allSettled(l).then(
|
|
4275
4271
|
(x) => x.forEach(async (D) => {
|
|
4276
|
-
let K,
|
|
4272
|
+
let K, U = 400;
|
|
4277
4273
|
if (D.status === "fulfilled") {
|
|
4278
|
-
let
|
|
4274
|
+
let M = D.value;
|
|
4279
4275
|
if (this.sm === null)
|
|
4280
4276
|
return 400;
|
|
4281
|
-
if (
|
|
4277
|
+
if (M.success === !0) {
|
|
4282
4278
|
const X = this.sm.subscribers.filter(
|
|
4283
|
-
(le) => le.widget ===
|
|
4279
|
+
(le) => le.widget === M.query.widget
|
|
4284
4280
|
)[0];
|
|
4285
4281
|
let se = "", ee;
|
|
4286
|
-
switch (
|
|
4282
|
+
switch (M.query.type) {
|
|
4287
4283
|
case N.MESSAGES:
|
|
4288
|
-
if (ee =
|
|
4284
|
+
if (ee = M.data.messages.filter(
|
|
4289
4285
|
(le) => le.id !== null
|
|
4290
|
-
),
|
|
4286
|
+
), M.data.messages = ee, se = Fn(M.data.messages), X.hash === se)
|
|
4291
4287
|
return console.info(
|
|
4292
4288
|
"%capi%c %cno updates",
|
|
4293
4289
|
g.API,
|
|
4294
4290
|
g.NONE,
|
|
4295
4291
|
g.NO_UPDATES,
|
|
4296
4292
|
N.MESSAGES,
|
|
4297
|
-
|
|
4298
|
-
|
|
4293
|
+
M.query.slide,
|
|
4294
|
+
M.query.widget
|
|
4299
4295
|
), console.debug(
|
|
4300
4296
|
"%capi%c %cno updates",
|
|
4301
4297
|
g.API,
|
|
4302
4298
|
g.NONE,
|
|
4303
4299
|
g.NO_UPDATES,
|
|
4304
4300
|
N.MESSAGES,
|
|
4305
|
-
|
|
4301
|
+
M
|
|
4306
4302
|
), 204;
|
|
4307
|
-
K =
|
|
4303
|
+
K = M, X.hash = se, U = await this.sm.setMessages(M.query, M);
|
|
4308
4304
|
break;
|
|
4309
4305
|
case N.CLOUD:
|
|
4310
|
-
se = Fn(
|
|
4306
|
+
se = Fn(M.data), X.hash === se ? (console.info(
|
|
4311
4307
|
"%capi%c %cno updates",
|
|
4312
4308
|
g.API,
|
|
4313
4309
|
g.NONE,
|
|
4314
4310
|
g.NO_UPDATES,
|
|
4315
4311
|
N.CLOUD,
|
|
4316
|
-
|
|
4317
|
-
|
|
4312
|
+
M.query.slide,
|
|
4313
|
+
M.query.widget
|
|
4318
4314
|
), console.debug(
|
|
4319
4315
|
"%capi%c %cno updates",
|
|
4320
4316
|
g.API,
|
|
4321
4317
|
g.NONE,
|
|
4322
4318
|
g.NO_UPDATES,
|
|
4323
4319
|
N.CLOUD,
|
|
4324
|
-
|
|
4325
|
-
),
|
|
4320
|
+
M
|
|
4321
|
+
), U = 204) : (X.hash = se, K = {
|
|
4326
4322
|
data: {
|
|
4327
|
-
dashboard:
|
|
4328
|
-
cloud:
|
|
4329
|
-
query:
|
|
4330
|
-
slide:
|
|
4323
|
+
dashboard: M.query.dashboard,
|
|
4324
|
+
cloud: M.data,
|
|
4325
|
+
query: M.query,
|
|
4326
|
+
slide: M.query.slide
|
|
4331
4327
|
},
|
|
4332
|
-
query:
|
|
4333
|
-
message:
|
|
4334
|
-
success:
|
|
4335
|
-
},
|
|
4336
|
-
|
|
4328
|
+
query: M.query,
|
|
4329
|
+
message: M.message,
|
|
4330
|
+
success: M.success
|
|
4331
|
+
}, U = await this.sm.setCloud(
|
|
4332
|
+
M.query,
|
|
4337
4333
|
K.data.cloud
|
|
4338
4334
|
));
|
|
4339
4335
|
break;
|
|
4340
4336
|
case N.SERIES:
|
|
4341
|
-
se = Fn(
|
|
4337
|
+
se = Fn(M.data), X.hash === se ? (console.info(
|
|
4342
4338
|
"%capi%c %cno updates",
|
|
4343
4339
|
g.API,
|
|
4344
4340
|
g.NONE,
|
|
4345
4341
|
g.NO_UPDATES,
|
|
4346
4342
|
N.SERIES,
|
|
4347
|
-
|
|
4348
|
-
|
|
4343
|
+
M.query.slide,
|
|
4344
|
+
M.query.widget
|
|
4349
4345
|
), console.debug(
|
|
4350
4346
|
"%capi%c %cno updates",
|
|
4351
4347
|
g.API,
|
|
4352
4348
|
g.NONE,
|
|
4353
4349
|
g.NO_UPDATES,
|
|
4354
4350
|
N.SERIES,
|
|
4355
|
-
|
|
4356
|
-
),
|
|
4351
|
+
M
|
|
4352
|
+
), U = 204) : (X.hash = se, K = {
|
|
4357
4353
|
data: {
|
|
4358
|
-
dashboard:
|
|
4359
|
-
series:
|
|
4360
|
-
query:
|
|
4361
|
-
slide:
|
|
4354
|
+
dashboard: M.query.dashboard,
|
|
4355
|
+
series: M.data,
|
|
4356
|
+
query: M.query,
|
|
4357
|
+
slide: M.query.slide
|
|
4362
4358
|
},
|
|
4363
|
-
query:
|
|
4364
|
-
message:
|
|
4365
|
-
success:
|
|
4366
|
-
},
|
|
4367
|
-
|
|
4359
|
+
query: M.query,
|
|
4360
|
+
message: M.message,
|
|
4361
|
+
success: M.success
|
|
4362
|
+
}, U = await this.sm.setSeries(
|
|
4363
|
+
M.query,
|
|
4368
4364
|
K.data.series
|
|
4369
4365
|
));
|
|
4370
4366
|
break;
|
|
@@ -4375,37 +4371,37 @@ class si {
|
|
|
4375
4371
|
g.NONE,
|
|
4376
4372
|
g.STORAGE,
|
|
4377
4373
|
"error",
|
|
4378
|
-
`data type ${
|
|
4374
|
+
`data type ${M.query.type} unknown`
|
|
4379
4375
|
);
|
|
4380
4376
|
}
|
|
4381
4377
|
} else
|
|
4382
|
-
|
|
4383
|
-
switch (
|
|
4378
|
+
U = 401;
|
|
4379
|
+
switch (U) {
|
|
4384
4380
|
case 201:
|
|
4385
4381
|
console.info(
|
|
4386
4382
|
"%capp%c %cbroadcast",
|
|
4387
4383
|
g.API,
|
|
4388
4384
|
g.NONE,
|
|
4389
4385
|
g.BROADCAST,
|
|
4390
|
-
|
|
4391
|
-
|
|
4386
|
+
M.query.slide,
|
|
4387
|
+
M.data.title ?? M.query.widget
|
|
4392
4388
|
), console.debug(
|
|
4393
4389
|
"%capp%c %cbroadcast",
|
|
4394
4390
|
g.API,
|
|
4395
4391
|
g.NONE,
|
|
4396
4392
|
g.BROADCAST,
|
|
4397
|
-
|
|
4393
|
+
M
|
|
4398
4394
|
);
|
|
4399
4395
|
const X = structuredClone(K.query);
|
|
4400
|
-
switch (
|
|
4396
|
+
switch (M.query.type) {
|
|
4401
4397
|
case "messages":
|
|
4402
|
-
|
|
4398
|
+
M = await this.sm.getMessages(X);
|
|
4403
4399
|
break;
|
|
4404
4400
|
case "cloud":
|
|
4405
|
-
|
|
4401
|
+
M = await this.sm.getCloud(X), M && (M.query = X);
|
|
4406
4402
|
break;
|
|
4407
4403
|
case "series":
|
|
4408
|
-
|
|
4404
|
+
M = await this.sm.getSeries(X), M && (M.query = X);
|
|
4409
4405
|
break;
|
|
4410
4406
|
default:
|
|
4411
4407
|
console.warn(
|
|
@@ -4414,12 +4410,12 @@ class si {
|
|
|
4414
4410
|
g.NONE,
|
|
4415
4411
|
g.BROADCAST,
|
|
4416
4412
|
"Unhandled data type",
|
|
4417
|
-
|
|
4413
|
+
M.query
|
|
4418
4414
|
);
|
|
4419
4415
|
}
|
|
4420
|
-
|
|
4416
|
+
M && this.bc.postMessage({
|
|
4421
4417
|
event: re.WIDGET_UPDATE,
|
|
4422
|
-
data:
|
|
4418
|
+
data: M.data
|
|
4423
4419
|
});
|
|
4424
4420
|
break;
|
|
4425
4421
|
case 204:
|
|
@@ -4431,12 +4427,12 @@ class si {
|
|
|
4431
4427
|
g.NONE,
|
|
4432
4428
|
g.BROADCAST,
|
|
4433
4429
|
"Fetch error",
|
|
4434
|
-
|
|
4435
|
-
|
|
4430
|
+
M.query.slide,
|
|
4431
|
+
M.data.title ?? M.query.widget
|
|
4436
4432
|
);
|
|
4437
4433
|
break;
|
|
4438
4434
|
}
|
|
4439
|
-
return
|
|
4435
|
+
return U;
|
|
4440
4436
|
} else
|
|
4441
4437
|
return console.warn(
|
|
4442
4438
|
"%capi%c %cstorage",
|
|
@@ -4837,9 +4833,9 @@ export {
|
|
|
4837
4833
|
Na as clearContents,
|
|
4838
4834
|
Ka as deepMerge,
|
|
4839
4835
|
za as filterAttributes,
|
|
4840
|
-
|
|
4836
|
+
Ja as formatContent,
|
|
4841
4837
|
Fn as hashSum,
|
|
4842
|
-
|
|
4838
|
+
Va as intToString,
|
|
4843
4839
|
Za as numberFormatter,
|
|
4844
4840
|
ai as randomValue,
|
|
4845
4841
|
qa as rtl,
|