@dialecte/core 0.1.2 → 0.1.3
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/document/document.d.ts.map +1 -1
- package/dist/document/query/get/record/staged-lookup.d.ts.map +1 -1
- package/dist/document/query/get/tree/get-tree.d.ts.map +1 -1
- package/dist/document/transaction/create/create.d.ts.map +1 -1
- package/dist/document/transaction/delete/delete.d.ts.map +1 -1
- package/dist/document/transaction/stage-operations.d.ts.map +1 -1
- package/dist/document/transaction/update/update.d.ts.map +1 -1
- package/dist/errors/errors.d.ts +2 -2
- package/dist/errors/errors.d.ts.map +1 -1
- package/dist/helpers.js +12 -13
- package/dist/{index-B67NZSGJ.js → index-CqwLClK7.js} +26 -16
- package/dist/{index-CCEg5JAo.js → index-ni-jr0mc.js} +682 -705
- package/dist/index.js +2 -2
- package/dist/store/dexie-store.d.ts.map +1 -1
- package/dist/test-fixtures/index.d.ts +1 -0
- package/dist/test-fixtures/index.d.ts.map +1 -1
- package/dist/test-fixtures/test-record.d.ts +1609 -33
- package/dist/test-fixtures/test-record.d.ts.map +1 -1
- package/dist/test-fixtures/test-record.types.d.ts +8 -0
- package/dist/test-fixtures/test-record.types.d.ts.map +1 -0
- package/dist/test.js +26 -24
- package/dist/types/io.d.ts +14 -5
- package/dist/types/io.d.ts.map +1 -1
- package/dist/utils/assert.d.ts +2 -3
- package/dist/utils/assert.d.ts.map +1 -1
- package/dist/utils.js +1 -1
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { toRef as Ne, isRecordOf as ur, toTreeRecord as cr, toRawRecord as or, standardizeRecord as Ya, toFullAttributeArray as za, CUSTOM_RECORD_ID_ATTRIBUTE as ia } from "./helpers.js";
|
|
2
|
-
import { t as Me, a as $e } from "./index-
|
|
2
|
+
import { t as Me, a as $e } from "./index-CqwLClK7.js";
|
|
3
3
|
async function dr(g) {
|
|
4
|
-
const { context: u, tagName: c, attributes: i } = g, h = await ua({ context: u, tagName: c }),
|
|
4
|
+
const { context: u, tagName: c, attributes: i } = g, h = await ua({ context: u, tagName: c }), p = [];
|
|
5
5
|
for (const y of h)
|
|
6
|
-
hr({ record: y, attributeFilter: i }) &&
|
|
7
|
-
return
|
|
6
|
+
hr({ record: y, attributeFilter: i }) && p.push(y);
|
|
7
|
+
return p;
|
|
8
8
|
}
|
|
9
9
|
function hr(g) {
|
|
10
10
|
const { record: u, attributeFilter: c } = g;
|
|
@@ -39,15 +39,15 @@ async function Qa(g) {
|
|
|
39
39
|
async function Ha(g) {
|
|
40
40
|
const { context: u, dialecteConfig: c, ref: i } = g, h = await ca({ context: u, ref: i });
|
|
41
41
|
if (!h) return {};
|
|
42
|
-
const
|
|
42
|
+
const p = Ja(h), y = [i.tagName, ...c.descendants[i.tagName]], N = {};
|
|
43
43
|
for (const R of y)
|
|
44
44
|
N[R] = [];
|
|
45
|
-
for (const R of
|
|
45
|
+
for (const R of p)
|
|
46
46
|
N[R.tagName] && N[R.tagName].push(R);
|
|
47
47
|
return N;
|
|
48
48
|
}
|
|
49
49
|
async function Za(g) {
|
|
50
|
-
const { context: u, ref: c, filter: i } = g, h = oa(i),
|
|
50
|
+
const { context: u, ref: c, filter: i } = g, h = oa(i), p = new Set(sa(i)), y = h[h.length - 1], N = y.attributes ? await dr({
|
|
51
51
|
context: u,
|
|
52
52
|
tagName: y.tagName,
|
|
53
53
|
attributes: y.attributes
|
|
@@ -63,9 +63,9 @@ async function Za(g) {
|
|
|
63
63
|
});
|
|
64
64
|
if (X.length !== 0 && ti({ ancestry: X, conditions: h }))
|
|
65
65
|
for (const W of X)
|
|
66
|
-
|
|
66
|
+
p.has(W.tagName) && (R.has(W.tagName) || R.set(W.tagName, /* @__PURE__ */ new Map()), R.get(W.tagName).set(W.id, W));
|
|
67
67
|
}
|
|
68
|
-
return ni({ collected: R, collectTags:
|
|
68
|
+
return ni({ collected: R, collectTags: p });
|
|
69
69
|
}
|
|
70
70
|
function Ja(g) {
|
|
71
71
|
const u = [];
|
|
@@ -94,22 +94,22 @@ function sa(g) {
|
|
|
94
94
|
}
|
|
95
95
|
async function ei(g) {
|
|
96
96
|
const { context: u, record: c, targetRef: i } = g, h = [];
|
|
97
|
-
let
|
|
98
|
-
for (;
|
|
99
|
-
if (h.push(
|
|
97
|
+
let p = c;
|
|
98
|
+
for (; p && p.id !== i.id; ) {
|
|
99
|
+
if (h.push(p), !p.parent) return [];
|
|
100
100
|
const y = await Re({
|
|
101
101
|
context: u,
|
|
102
|
-
ref: Ne(
|
|
102
|
+
ref: Ne(p.parent)
|
|
103
103
|
});
|
|
104
104
|
if (!y) return [];
|
|
105
|
-
|
|
105
|
+
p = y;
|
|
106
106
|
}
|
|
107
|
-
return !
|
|
107
|
+
return !p || p.id !== i.id ? [] : (h.push(p), h);
|
|
108
108
|
}
|
|
109
109
|
function ti(g) {
|
|
110
110
|
const { ancestry: u, conditions: c } = g;
|
|
111
|
-
return c.every((i) => u.some((
|
|
112
|
-
record:
|
|
111
|
+
return c.every((i) => u.some((p) => p.tagName !== i.tagName ? !1 : i.attributes ? hr({
|
|
112
|
+
record: p,
|
|
113
113
|
attributeFilter: i.attributes
|
|
114
114
|
}) : !0) || i.optional === !0);
|
|
115
115
|
}
|
|
@@ -117,8 +117,8 @@ function ni(g) {
|
|
|
117
117
|
const { collected: u, collectTags: c } = g, i = {};
|
|
118
118
|
for (const h of c)
|
|
119
119
|
i[h] = [];
|
|
120
|
-
for (const [h,
|
|
121
|
-
c.has(h) && (i[h] = Array.from(
|
|
120
|
+
for (const [h, p] of u.entries())
|
|
121
|
+
c.has(h) && (i[h] = Array.from(p.values()));
|
|
122
122
|
return i;
|
|
123
123
|
}
|
|
124
124
|
async function ri(g) {
|
|
@@ -140,7 +140,7 @@ async function ii(g) {
|
|
|
140
140
|
async function oi(g) {
|
|
141
141
|
const { context: u, ref: c } = g;
|
|
142
142
|
return ((await Re({ context: u, ref: c }))?.attributes ?? []).reduce(
|
|
143
|
-
(
|
|
143
|
+
(p, y) => (p[y.name] = y.value ?? "", p),
|
|
144
144
|
{}
|
|
145
145
|
);
|
|
146
146
|
}
|
|
@@ -151,50 +151,47 @@ async function si(g) {
|
|
|
151
151
|
function ui(g) {
|
|
152
152
|
const { stagedOperations: u, tagName: c, id: i } = g;
|
|
153
153
|
for (let h = u.length - 1; h >= 0; h--) {
|
|
154
|
-
const
|
|
154
|
+
const p = u[h];
|
|
155
155
|
if (i === void 0) {
|
|
156
|
-
if ((
|
|
156
|
+
if ((p.status === "created" || p.status === "updated") && ur(p.newRecord, c))
|
|
157
157
|
return {
|
|
158
|
-
...
|
|
159
|
-
status:
|
|
158
|
+
...p.newRecord,
|
|
159
|
+
status: p.status
|
|
160
160
|
};
|
|
161
|
-
if (
|
|
161
|
+
if (p.status === "deleted" && ur(p.oldRecord, c))
|
|
162
162
|
return {
|
|
163
|
-
...
|
|
163
|
+
...p.oldRecord,
|
|
164
164
|
status: "deleted"
|
|
165
165
|
};
|
|
166
166
|
continue;
|
|
167
167
|
}
|
|
168
|
-
if (
|
|
169
|
-
const y =
|
|
168
|
+
if (p.status === "created" && p.newRecord.id === i) {
|
|
169
|
+
const y = p.newRecord.tagName;
|
|
170
170
|
return y !== c && Me("ELEMENT_TAGNAME_MISMATCH", {
|
|
171
|
-
method: "getLatestStagedRecord",
|
|
172
171
|
detail: `Expected tagName '${c}', got '${y}' for id '${i}'`,
|
|
173
172
|
ref: { tagName: c, id: i }
|
|
174
173
|
}), {
|
|
175
|
-
...
|
|
174
|
+
...p.newRecord,
|
|
176
175
|
status: "created"
|
|
177
176
|
};
|
|
178
177
|
}
|
|
179
|
-
if (
|
|
180
|
-
const y =
|
|
178
|
+
if (p.status === "updated" && p.newRecord.id === i) {
|
|
179
|
+
const y = p.newRecord.tagName;
|
|
181
180
|
return y !== c && Me("ELEMENT_TAGNAME_MISMATCH", {
|
|
182
|
-
method: "getLatestStagedRecord",
|
|
183
181
|
detail: `Expected tagName '${c}', got '${y}' for id '${i}'`,
|
|
184
182
|
ref: { tagName: c, id: i }
|
|
185
183
|
}), {
|
|
186
|
-
...
|
|
184
|
+
...p.newRecord,
|
|
187
185
|
status: "updated"
|
|
188
186
|
};
|
|
189
187
|
}
|
|
190
|
-
if (
|
|
191
|
-
const y =
|
|
188
|
+
if (p.status === "deleted" && p.oldRecord.id === i) {
|
|
189
|
+
const y = p.oldRecord.tagName;
|
|
192
190
|
return y !== c && Me("ELEMENT_TAGNAME_MISMATCH", {
|
|
193
|
-
method: "getLatestStagedRecord",
|
|
194
191
|
detail: `Expected tagName '${c}', got '${y}' for id '${i}'`,
|
|
195
192
|
ref: { tagName: c, id: i }
|
|
196
193
|
}), {
|
|
197
|
-
...
|
|
194
|
+
...p.oldRecord,
|
|
198
195
|
status: "deleted"
|
|
199
196
|
};
|
|
200
197
|
}
|
|
@@ -202,14 +199,14 @@ function ui(g) {
|
|
|
202
199
|
}
|
|
203
200
|
function ci(g) {
|
|
204
201
|
const { rawRecords: u, stagedOperations: c, tagName: i } = g, h = new Map(
|
|
205
|
-
u.map((
|
|
202
|
+
u.map((p) => [p.id, { ...p, status: "unchanged" }])
|
|
206
203
|
);
|
|
207
|
-
for (const
|
|
208
|
-
if (
|
|
209
|
-
if (!ur(
|
|
210
|
-
h.set(
|
|
204
|
+
for (const p of c) {
|
|
205
|
+
if (p.status === "created" || p.status === "updated") {
|
|
206
|
+
if (!ur(p.newRecord, i)) continue;
|
|
207
|
+
h.set(p.newRecord.id, { ...p.newRecord, status: p.status });
|
|
211
208
|
}
|
|
212
|
-
|
|
209
|
+
p.status === "deleted" && p.oldRecord.tagName === i && h.delete(p.oldRecord.id);
|
|
213
210
|
}
|
|
214
211
|
return Array.from(h.values());
|
|
215
212
|
}
|
|
@@ -226,8 +223,8 @@ async function Re(g) {
|
|
|
226
223
|
}
|
|
227
224
|
let i;
|
|
228
225
|
if (c.id === void 0) {
|
|
229
|
-
const h = `__singleton_${c.tagName}`,
|
|
230
|
-
|
|
226
|
+
const h = `__singleton_${c.tagName}`, p = Xt(u) ? u.recordCache.get(h) : void 0;
|
|
227
|
+
p ? i = p : (i = (await u.store.getByTagName(c.tagName))[0], i && Xt(u) && (u.recordCache.set(i.id, i), u.recordCache.set(h, i)));
|
|
231
228
|
} else {
|
|
232
229
|
const h = Xt(u) ? u.recordCache.get(c.id) : void 0;
|
|
233
230
|
h ? i = h : (i = await u.store.get(c.id), i && Xt(u) && u.recordCache.set(c.id, i));
|
|
@@ -246,31 +243,30 @@ async function ua(g) {
|
|
|
246
243
|
return ci({ rawRecords: i, stagedOperations: u.stagedOperations, tagName: c });
|
|
247
244
|
}
|
|
248
245
|
async function ca(g) {
|
|
249
|
-
const { context: u, ref: c, options: i = {} } = g, { include: h, exclude:
|
|
246
|
+
const { context: u, ref: c, options: i = {} } = g, { include: h, exclude: p, unwrap: y } = i, N = await Re({ context: u, ref: c });
|
|
250
247
|
$e(N, {
|
|
251
248
|
detail: "No record found for provided ref",
|
|
252
|
-
method: "getTree",
|
|
253
249
|
key: "ELEMENT_NOT_FOUND"
|
|
254
250
|
});
|
|
255
251
|
const R = await la({
|
|
256
252
|
context: u,
|
|
257
253
|
record: N,
|
|
258
254
|
includeFilters: h ? [h] : void 0,
|
|
259
|
-
exclude:
|
|
255
|
+
exclude: p
|
|
260
256
|
});
|
|
261
|
-
return R ? y ?
|
|
257
|
+
return R ? y ? mi({ tree: R, unwrapTagNames: y }) : R : cr({ record: N });
|
|
262
258
|
}
|
|
263
259
|
async function la(g) {
|
|
264
260
|
const { context: u, record: c, includeFilters: i, exclude: h } = g;
|
|
265
261
|
if (fi({ record: c, excludeFilters: h }))
|
|
266
262
|
return cr({ record: c });
|
|
267
|
-
const
|
|
263
|
+
const p = await hi({
|
|
268
264
|
context: u,
|
|
269
265
|
record: c,
|
|
270
266
|
currentIncludeFilters: i,
|
|
271
267
|
excludeFilters: h
|
|
272
268
|
}), N = (await Promise.all(
|
|
273
|
-
|
|
269
|
+
p.map(
|
|
274
270
|
({ record: R, includeFilters: j }) => la({ context: u, record: R, includeFilters: j, exclude: h })
|
|
275
271
|
)
|
|
276
272
|
)).filter(
|
|
@@ -280,11 +276,11 @@ async function la(g) {
|
|
|
280
276
|
}
|
|
281
277
|
function fi(g) {
|
|
282
278
|
const { record: u, excludeFilters: c } = g;
|
|
283
|
-
return c ? c.some((i) => (i.scope ?? "self") !== "children" ? !1 :
|
|
279
|
+
return c ? c.some((i) => (i.scope ?? "self") !== "children" ? !1 : pr({ record: u, filter: i })) : !1;
|
|
284
280
|
}
|
|
285
281
|
function di(g) {
|
|
286
282
|
const { record: u, excludeFilters: c } = g;
|
|
287
|
-
return c ? c.some((i) => (i.scope ?? "self") !== "self" ? !1 :
|
|
283
|
+
return c ? c.some((i) => (i.scope ?? "self") !== "self" ? !1 : pr({ record: u, filter: i })) : !1;
|
|
288
284
|
}
|
|
289
285
|
async function hi(g) {
|
|
290
286
|
const { context: u, record: c, currentIncludeFilters: i, excludeFilters: h } = g;
|
|
@@ -301,35 +297,35 @@ async function hi(g) {
|
|
|
301
297
|
).filter(
|
|
302
298
|
(R) => !di({ record: R, excludeFilters: h })
|
|
303
299
|
);
|
|
304
|
-
return
|
|
300
|
+
return pi({ children: N, currentIncludeFilters: i });
|
|
305
301
|
}
|
|
306
|
-
function
|
|
302
|
+
function pi(g) {
|
|
307
303
|
const { children: u, currentIncludeFilters: c } = g;
|
|
308
304
|
if (!c)
|
|
309
305
|
return u.map((h) => ({ record: h, includeFilters: void 0 }));
|
|
310
306
|
const i = [];
|
|
311
307
|
for (const h of u) {
|
|
312
|
-
const
|
|
313
|
-
(y) =>
|
|
308
|
+
const p = c.find(
|
|
309
|
+
(y) => pr({ record: h, filter: y })
|
|
314
310
|
);
|
|
315
|
-
|
|
311
|
+
p && i.push({
|
|
316
312
|
record: h,
|
|
317
|
-
includeFilters:
|
|
313
|
+
includeFilters: p.children?.length ? p.children : void 0
|
|
318
314
|
});
|
|
319
315
|
}
|
|
320
316
|
return i;
|
|
321
317
|
}
|
|
322
|
-
function
|
|
318
|
+
function pr(g) {
|
|
323
319
|
const { record: u, filter: c } = g;
|
|
324
320
|
return u.tagName !== c.tagName ? !1 : c.attributes ? hr({
|
|
325
321
|
record: u,
|
|
326
322
|
attributeFilter: c.attributes
|
|
327
323
|
}) : !0;
|
|
328
324
|
}
|
|
329
|
-
function
|
|
325
|
+
function mi(g) {
|
|
330
326
|
const { tree: u, unwrapTagNames: c } = g;
|
|
331
327
|
function i(h) {
|
|
332
|
-
return h.flatMap((
|
|
328
|
+
return h.flatMap((p) => c.includes(p.tagName) ? i(p.tree) : [{ ...p, tree: i(p.tree) }]);
|
|
333
329
|
}
|
|
334
330
|
return { ...u, tree: i(u.tree) };
|
|
335
331
|
}
|
|
@@ -480,19 +476,16 @@ class fa {
|
|
|
480
476
|
}
|
|
481
477
|
}
|
|
482
478
|
function ze(g) {
|
|
483
|
-
const { context: u, status: c, record: i, oldRecord: h, newRecord:
|
|
479
|
+
const { context: u, status: c, record: i, oldRecord: h, newRecord: p } = g;
|
|
484
480
|
let y, N, R;
|
|
485
|
-
i && (y = or(i)), h && (N = or(h)),
|
|
481
|
+
i && (y = or(i)), h && (N = or(h)), p && (R = or(p)), c === "created" ? ($e(y, {
|
|
486
482
|
detail: "Record is required for created",
|
|
487
|
-
method: "stageOperation",
|
|
488
483
|
key: "ELEMENT_NOT_FOUND"
|
|
489
484
|
}), u.stagedOperations.push({ status: c, oldRecord: void 0, newRecord: y })) : c === "updated" ? ($e(N && R, {
|
|
490
485
|
detail: "Old record and new record are required for updated",
|
|
491
|
-
method: "stageOperation",
|
|
492
486
|
key: "ELEMENT_NOT_FOUND"
|
|
493
487
|
}), u.stagedOperations.push({ status: c, oldRecord: N, newRecord: R })) : c === "deleted" && y && ($e(y, {
|
|
494
488
|
detail: "Record is required for deleted",
|
|
495
|
-
method: "stageOperation",
|
|
496
489
|
key: "ELEMENT_NOT_FOUND"
|
|
497
490
|
}), u.stagedOperations.push({ status: c, oldRecord: y, newRecord: void 0 }));
|
|
498
491
|
}
|
|
@@ -517,17 +510,16 @@ function gi(g) {
|
|
|
517
510
|
}
|
|
518
511
|
}
|
|
519
512
|
async function da(g) {
|
|
520
|
-
const { dialecteConfig: u, context: c, parentRef: i, params: h } = g, { id:
|
|
513
|
+
const { dialecteConfig: u, context: c, parentRef: i, params: h } = g, { id: p, tagName: y, attributes: N, namespace: R, value: j } = h, X = await Re({ context: c, ref: i });
|
|
521
514
|
$e(X, {
|
|
522
515
|
detail: "Parent record not found",
|
|
523
|
-
method: "addChild",
|
|
524
516
|
key: "ELEMENT_NOT_FOUND",
|
|
525
517
|
ref: i
|
|
526
518
|
});
|
|
527
519
|
const W = Ya({
|
|
528
520
|
dialecteConfig: u,
|
|
529
521
|
record: {
|
|
530
|
-
id:
|
|
522
|
+
id: p ?? crypto.randomUUID(),
|
|
531
523
|
tagName: y,
|
|
532
524
|
attributes: N,
|
|
533
525
|
namespace: R,
|
|
@@ -561,20 +553,20 @@ async function da(g) {
|
|
|
561
553
|
return Ne(W);
|
|
562
554
|
}
|
|
563
555
|
async function yi(g) {
|
|
564
|
-
const { dialecteConfig: u, context: c, parentRef: i, record: h } = g,
|
|
556
|
+
const { dialecteConfig: u, context: c, parentRef: i, record: h } = g, p = [];
|
|
565
557
|
return await ha({
|
|
566
558
|
dialecteConfig: u,
|
|
567
559
|
context: c,
|
|
568
560
|
parentRef: i,
|
|
569
561
|
record: h,
|
|
570
|
-
mappings:
|
|
562
|
+
mappings: p
|
|
571
563
|
}), {
|
|
572
564
|
ref: Ne(h),
|
|
573
|
-
mappings:
|
|
565
|
+
mappings: p
|
|
574
566
|
};
|
|
575
567
|
}
|
|
576
568
|
async function ha(g) {
|
|
577
|
-
const { dialecteConfig: u, context: c, parentRef: i, record: h, mappings:
|
|
569
|
+
const { dialecteConfig: u, context: c, parentRef: i, record: h, mappings: p } = g;
|
|
578
570
|
let y = !0, N = h;
|
|
579
571
|
if (u.hooks?.beforeClone) {
|
|
580
572
|
const j = u.hooks.beforeClone({ record: h });
|
|
@@ -592,7 +584,7 @@ async function ha(g) {
|
|
|
592
584
|
value: N.value
|
|
593
585
|
}
|
|
594
586
|
});
|
|
595
|
-
|
|
587
|
+
p.push({
|
|
596
588
|
source: Ne(h),
|
|
597
589
|
target: R
|
|
598
590
|
});
|
|
@@ -602,28 +594,28 @@ async function ha(g) {
|
|
|
602
594
|
context: c,
|
|
603
595
|
parentRef: R,
|
|
604
596
|
record: j,
|
|
605
|
-
mappings:
|
|
597
|
+
mappings: p
|
|
606
598
|
});
|
|
607
599
|
}
|
|
608
600
|
function vi(g) {
|
|
609
601
|
const u = /* @__PURE__ */ new Map();
|
|
610
602
|
for (const i of g) {
|
|
611
|
-
const h = (i.status === "deleted" ? i.oldRecord : i.newRecord).id,
|
|
612
|
-
if (!
|
|
603
|
+
const h = (i.status === "deleted" ? i.oldRecord : i.newRecord).id, p = u.get(h);
|
|
604
|
+
if (!p) {
|
|
613
605
|
u.set(h, i);
|
|
614
606
|
continue;
|
|
615
607
|
}
|
|
616
|
-
|
|
608
|
+
p.status === "created" ? i.status === "updated" ? u.set(h, {
|
|
617
609
|
status: "created",
|
|
618
610
|
oldRecord: void 0,
|
|
619
611
|
newRecord: i.newRecord
|
|
620
|
-
}) : i.status === "deleted" && u.delete(h) :
|
|
612
|
+
}) : i.status === "deleted" && u.delete(h) : p.status === "updated" && (i.status === "updated" ? u.set(h, {
|
|
621
613
|
status: "updated",
|
|
622
|
-
oldRecord:
|
|
614
|
+
oldRecord: p.oldRecord,
|
|
623
615
|
newRecord: i.newRecord
|
|
624
616
|
}) : i.status === "deleted" && u.set(h, {
|
|
625
617
|
status: "deleted",
|
|
626
|
-
oldRecord:
|
|
618
|
+
oldRecord: p.oldRecord,
|
|
627
619
|
newRecord: void 0
|
|
628
620
|
}));
|
|
629
621
|
}
|
|
@@ -635,12 +627,12 @@ function vi(g) {
|
|
|
635
627
|
};
|
|
636
628
|
}
|
|
637
629
|
async function bi(g) {
|
|
638
|
-
const { stagedOperations: u, store: c, documentState: i } = g, { creates: h, updates:
|
|
630
|
+
const { stagedOperations: u, store: c, documentState: i } = g, { creates: h, updates: p, deletes: y } = vi(u), N = h.length + p.length + y.length;
|
|
639
631
|
i.activity = { method: "commit", message: "Committing changes..." }, i.progress = { current: 0, total: N };
|
|
640
632
|
try {
|
|
641
633
|
await c.commit({
|
|
642
634
|
creates: h.map((R) => R.newRecord),
|
|
643
|
-
updates:
|
|
635
|
+
updates: p.map((R) => R.newRecord),
|
|
644
636
|
deletes: y.map((R) => R.oldRecord.id),
|
|
645
637
|
onProgress: (R, j) => {
|
|
646
638
|
i.progress = { current: R, total: j };
|
|
@@ -655,47 +647,43 @@ async function wi(g) {
|
|
|
655
647
|
const { context: u, ref: c } = g, i = await Re({ context: u, ref: c });
|
|
656
648
|
$e(i, {
|
|
657
649
|
detail: `Record not found (tagName=${c.tagName}, id=${c.id})`,
|
|
658
|
-
method: "delete",
|
|
659
650
|
key: "ELEMENT_NOT_FOUND",
|
|
660
651
|
ref: c
|
|
661
652
|
}), $e(i.parent, {
|
|
662
653
|
detail: "Cannot delete root element",
|
|
663
|
-
method: "delete",
|
|
664
654
|
key: "PROTECTED_ROOT"
|
|
665
|
-
}), await
|
|
666
|
-
const h = Ne(i.parent),
|
|
667
|
-
$e(
|
|
655
|
+
}), await pa({ context: u, record: i }), ze({ context: u, status: "deleted", record: i });
|
|
656
|
+
const h = Ne(i.parent), p = await Re({ context: u, ref: h });
|
|
657
|
+
$e(p, {
|
|
668
658
|
detail: `Parent record not found (tagName=${i.parent.tagName}, id=${i.parent.id})`,
|
|
669
|
-
method: "delete",
|
|
670
659
|
key: "ELEMENT_NOT_FOUND"
|
|
671
660
|
});
|
|
672
661
|
const y = {
|
|
673
|
-
...
|
|
674
|
-
children:
|
|
662
|
+
...p,
|
|
663
|
+
children: p.children.filter((N) => N.id !== i.id)
|
|
675
664
|
};
|
|
676
|
-
return ze({ context: u, status: "updated", oldRecord:
|
|
665
|
+
return ze({ context: u, status: "updated", oldRecord: p, newRecord: y }), h;
|
|
677
666
|
}
|
|
678
|
-
async function
|
|
667
|
+
async function pa(g) {
|
|
679
668
|
const { context: u, record: c } = g;
|
|
680
669
|
for (const i of c.children) {
|
|
681
|
-
const h = Ne(i),
|
|
682
|
-
|
|
670
|
+
const h = Ne(i), p = await Re({ context: u, ref: h });
|
|
671
|
+
p && (p.children.length > 0 && await pa({ context: u, record: p }), ze({ context: u, status: "deleted", record: p }));
|
|
683
672
|
}
|
|
684
673
|
}
|
|
685
674
|
async function _i(g) {
|
|
686
|
-
const { dialecteConfig: u, context: c, ref: i, params: h } = g, { attributes:
|
|
675
|
+
const { dialecteConfig: u, context: c, ref: i, params: h } = g, { attributes: p, value: y } = h, N = await Re({ context: c, ref: i });
|
|
687
676
|
$e(N, {
|
|
688
677
|
detail: `Record not found (tagName=${i.tagName}, id=${i.id})`,
|
|
689
|
-
method: "update",
|
|
690
678
|
key: "ELEMENT_NOT_FOUND",
|
|
691
679
|
ref: i
|
|
692
680
|
});
|
|
693
681
|
let R = N.attributes;
|
|
694
|
-
if (
|
|
682
|
+
if (p) {
|
|
695
683
|
const X = za({
|
|
696
684
|
dialecteConfig: u,
|
|
697
685
|
tagName: N.tagName,
|
|
698
|
-
attributes:
|
|
686
|
+
attributes: p
|
|
699
687
|
});
|
|
700
688
|
R = [...N.attributes.filter(
|
|
701
689
|
(J) => !X.some((fe) => fe.name === J.name)
|
|
@@ -878,8 +866,7 @@ class Yr {
|
|
|
878
866
|
}
|
|
879
867
|
async transaction(u, c) {
|
|
880
868
|
this.activeTransactions > 0 && Me("CONCURRENT_TRANSACTION", {
|
|
881
|
-
detail: `${this.activeTransactions} transaction(s) already active. Concurrent transactions risk lost updates — serialize them or implement a transaction queue
|
|
882
|
-
method: "transaction"
|
|
869
|
+
detail: `${this.activeTransactions} transaction(s) already active. Concurrent transactions risk lost updates — serialize them or implement a transaction queue.`
|
|
883
870
|
}), this.activeTransactions++, this.state.loading = !0, this.state.error = null;
|
|
884
871
|
const i = this.createTransaction();
|
|
885
872
|
try {
|
|
@@ -892,7 +879,6 @@ class Yr {
|
|
|
892
879
|
} catch (h) {
|
|
893
880
|
throw this.state.activity = null, this.state.progress = null, this.state.error ?? Me("UNKNOWN", {
|
|
894
881
|
detail: h instanceof Error ? h.message : String(h),
|
|
895
|
-
method: "transaction",
|
|
896
882
|
cause: h instanceof Error ? h : void 0
|
|
897
883
|
});
|
|
898
884
|
} finally {
|
|
@@ -927,12 +913,11 @@ class Yr {
|
|
|
927
913
|
} catch (N) {
|
|
928
914
|
throw this.activeTransactions--, this.state.loading = this.activeTransactions > 0, this.state.error ?? Me("UNKNOWN", {
|
|
929
915
|
detail: N instanceof Error ? N.message : String(N),
|
|
930
|
-
method: "prepare",
|
|
931
916
|
cause: N instanceof Error ? N : void 0
|
|
932
917
|
});
|
|
933
918
|
}
|
|
934
919
|
this.activeTransactions--, this.state.loading = this.activeTransactions > 0;
|
|
935
|
-
const h = i.getStagedOperations(),
|
|
920
|
+
const h = i.getStagedOperations(), p = {
|
|
936
921
|
creates: h.filter((N) => N.status === "created").length,
|
|
937
922
|
updates: h.filter((N) => N.status === "updated").length,
|
|
938
923
|
deletes: h.filter((N) => N.status === "deleted").length
|
|
@@ -940,7 +925,7 @@ class Yr {
|
|
|
940
925
|
let y = !1;
|
|
941
926
|
return {
|
|
942
927
|
operations: h,
|
|
943
|
-
summary:
|
|
928
|
+
summary: p,
|
|
944
929
|
commit: async () => {
|
|
945
930
|
if (!y) {
|
|
946
931
|
y = !0, this.activeTransactions++, this.state.loading = !0, this.state.activity = { method: "commit", message: "Saving changes..." };
|
|
@@ -953,7 +938,6 @@ class Yr {
|
|
|
953
938
|
} catch (N) {
|
|
954
939
|
throw this.state.activity = null, this.state.error ?? Me("UNKNOWN", {
|
|
955
940
|
detail: N instanceof Error ? N.message : String(N),
|
|
956
|
-
method: "commit",
|
|
957
941
|
cause: N instanceof Error ? N : void 0
|
|
958
942
|
});
|
|
959
943
|
} finally {
|
|
@@ -974,7 +958,6 @@ class Yr {
|
|
|
974
958
|
} catch (u) {
|
|
975
959
|
throw this.state.activity = null, this.state.error ?? Me("UNKNOWN", {
|
|
976
960
|
detail: u instanceof Error ? u.message : String(u),
|
|
977
|
-
method: "undo",
|
|
978
961
|
cause: u instanceof Error ? u : void 0
|
|
979
962
|
});
|
|
980
963
|
} finally {
|
|
@@ -988,7 +971,6 @@ class Yr {
|
|
|
988
971
|
} catch (u) {
|
|
989
972
|
throw this.state.activity = null, this.state.error ?? Me("UNKNOWN", {
|
|
990
973
|
detail: u instanceof Error ? u.message : String(u),
|
|
991
|
-
method: "redo",
|
|
992
974
|
cause: u instanceof Error ? u : void 0
|
|
993
975
|
});
|
|
994
976
|
} finally {
|
|
@@ -1005,7 +987,7 @@ class Yr {
|
|
|
1005
987
|
}
|
|
1006
988
|
}
|
|
1007
989
|
var Ei = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
1008
|
-
function
|
|
990
|
+
function ma(g) {
|
|
1009
991
|
return g && g.__esModule && Object.prototype.hasOwnProperty.call(g, "default") ? g.default : g;
|
|
1010
992
|
}
|
|
1011
993
|
function xi(g) {
|
|
@@ -1054,13 +1036,13 @@ function Ai() {
|
|
|
1054
1036
|
for (var r, a = 0, s = t.length; a < s; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
1055
1037
|
return e.concat(r || Array.prototype.slice.call(t));
|
|
1056
1038
|
}
|
|
1057
|
-
var
|
|
1039
|
+
var p = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ei, y = Object.keys, N = Array.isArray;
|
|
1058
1040
|
function R(e, t) {
|
|
1059
1041
|
return typeof t != "object" || y(t).forEach(function(n) {
|
|
1060
1042
|
e[n] = t[n];
|
|
1061
1043
|
}), e;
|
|
1062
1044
|
}
|
|
1063
|
-
typeof Promise > "u" ||
|
|
1045
|
+
typeof Promise > "u" || p.Promise || (p.Promise = Promise);
|
|
1064
1046
|
var j = Object.getPrototypeOf, X = {}.hasOwnProperty;
|
|
1065
1047
|
function W(e, t) {
|
|
1066
1048
|
return X.call(e, t);
|
|
@@ -1090,14 +1072,14 @@ function Ai() {
|
|
|
1090
1072
|
if (!e) throw new Error("Assertion Failed");
|
|
1091
1073
|
}
|
|
1092
1074
|
function ae(e) {
|
|
1093
|
-
|
|
1075
|
+
p.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
1094
1076
|
}
|
|
1095
|
-
function
|
|
1077
|
+
function me(e, t) {
|
|
1096
1078
|
if (typeof t == "string" && W(e, t)) return e[t];
|
|
1097
1079
|
if (!t) return e;
|
|
1098
1080
|
if (typeof t != "string") {
|
|
1099
1081
|
for (var n = [], r = 0, a = t.length; r < a; ++r) {
|
|
1100
|
-
var s =
|
|
1082
|
+
var s = me(e, t[r]);
|
|
1101
1083
|
n.push(s);
|
|
1102
1084
|
}
|
|
1103
1085
|
return n;
|
|
@@ -1105,7 +1087,7 @@ function Ai() {
|
|
|
1105
1087
|
var f = t.indexOf(".");
|
|
1106
1088
|
if (f !== -1) {
|
|
1107
1089
|
var d = e[t.substr(0, f)];
|
|
1108
|
-
return d == null ? void 0 :
|
|
1090
|
+
return d == null ? void 0 : me(d, t.substr(f + 1));
|
|
1109
1091
|
}
|
|
1110
1092
|
}
|
|
1111
1093
|
function ne(e, t, n) {
|
|
@@ -1117,23 +1099,23 @@ function Ai() {
|
|
|
1117
1099
|
d !== -1 ? (s = t.substr(0, d), (f = t.substr(d + 1)) === "" ? n === void 0 ? N(e) && !isNaN(parseInt(s)) ? e.splice(s, 1) : delete e[s] : e[s] = n : ne(d = !(d = e[s]) || !W(e, s) ? e[s] = {} : d, f, n)) : n === void 0 ? N(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
1118
1100
|
}
|
|
1119
1101
|
}
|
|
1120
|
-
function
|
|
1102
|
+
function De(e) {
|
|
1121
1103
|
var t, n = {};
|
|
1122
1104
|
for (t in e) W(e, t) && (n[t] = e[t]);
|
|
1123
1105
|
return n;
|
|
1124
1106
|
}
|
|
1125
|
-
var
|
|
1126
|
-
function
|
|
1127
|
-
return
|
|
1107
|
+
var D = [].concat;
|
|
1108
|
+
function It(e) {
|
|
1109
|
+
return D.apply([], e);
|
|
1128
1110
|
}
|
|
1129
|
-
var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(
|
|
1111
|
+
var ct = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(It([8, 16, 32, 64].map(function(e) {
|
|
1130
1112
|
return ["Int", "Uint", "Float"].map(function(t) {
|
|
1131
1113
|
return t + e + "Array";
|
|
1132
1114
|
});
|
|
1133
1115
|
}))).filter(function(e) {
|
|
1134
|
-
return
|
|
1116
|
+
return p[e];
|
|
1135
1117
|
}), He = new Set(ct.map(function(e) {
|
|
1136
|
-
return
|
|
1118
|
+
return p[e];
|
|
1137
1119
|
})), de = null;
|
|
1138
1120
|
function ke(e) {
|
|
1139
1121
|
return de = /* @__PURE__ */ new WeakMap(), e = (function t(n) {
|
|
@@ -1186,7 +1168,7 @@ function Ai() {
|
|
|
1186
1168
|
return e[Symbol.toStringTag] === "AsyncFunction";
|
|
1187
1169
|
} : function() {
|
|
1188
1170
|
return !1;
|
|
1189
|
-
}, kt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], je = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(kt),
|
|
1171
|
+
}, kt = ["Unknown", "Constraint", "Data", "TransactionInactive", "ReadOnly", "Version", "NotFound", "InvalidState", "InvalidAccess", "Abort", "Timeout", "QuotaExceeded", "Syntax", "DataClone"], je = ["Modify", "Bulk", "OpenFailed", "VersionChange", "Schema", "Upgrade", "InvalidTable", "MissingAPI", "NoSuchDatabase", "InvalidArgument", "SubTransaction", "Unsupported", "Internal", "DatabaseClosed", "PrematureCommit", "ForeignAwait"].concat(kt), Dt = { VersionChanged: "Database version changed by other database connection", DatabaseClosed: "Database has been closed", Abort: "Transaction aborted", TransactionInactive: "Transaction has already completed or failed", MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb" };
|
|
1190
1172
|
function Ze(e, t) {
|
|
1191
1173
|
this.name = e, this.message = t;
|
|
1192
1174
|
}
|
|
@@ -1215,7 +1197,7 @@ function Ai() {
|
|
|
1215
1197
|
var n = t + "Error";
|
|
1216
1198
|
function r(a, s) {
|
|
1217
1199
|
this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(s ? `
|
|
1218
|
-
` + s : ""), this.inner = s || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message =
|
|
1200
|
+
` + s : ""), this.inner = s || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = Dt[t] || n, this.inner = null);
|
|
1219
1201
|
}
|
|
1220
1202
|
return F(r).from(o), e[t] = r, e;
|
|
1221
1203
|
}, {});
|
|
@@ -1287,7 +1269,7 @@ function Ai() {
|
|
|
1287
1269
|
function Rt(e) {
|
|
1288
1270
|
Pe = e;
|
|
1289
1271
|
}
|
|
1290
|
-
var Pt = {},
|
|
1272
|
+
var Pt = {}, mr = 100, ct = typeof Promise > "u" ? [] : (function() {
|
|
1291
1273
|
var e = Promise.resolve();
|
|
1292
1274
|
if (typeof crypto > "u" || !crypto.subtle) return [e, j(e), e];
|
|
1293
1275
|
var t = crypto.subtle.digest("SHA-512", new Uint8Array([0]));
|
|
@@ -1301,7 +1283,7 @@ function Ai() {
|
|
|
1301
1283
|
var t = this._PSD = z;
|
|
1302
1284
|
if (typeof e != "function") {
|
|
1303
1285
|
if (e !== Pt) throw new TypeError("Not a function");
|
|
1304
|
-
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 &&
|
|
1286
|
+
return this._state = arguments[1], this._value = arguments[2], void (this._state === !1 && Dn(this, this._value));
|
|
1305
1287
|
}
|
|
1306
1288
|
this._state = null, this._value = null, ++t.ref, (function n(r, a) {
|
|
1307
1289
|
try {
|
|
@@ -1313,13 +1295,13 @@ function Ai() {
|
|
|
1313
1295
|
s instanceof G ? s._then(d, v) : s.then(d, v);
|
|
1314
1296
|
}) : (r._state = !0, r._value = s, yr(r)), f && Tt();
|
|
1315
1297
|
}
|
|
1316
|
-
},
|
|
1298
|
+
}, Dn.bind(null, r));
|
|
1317
1299
|
} catch (s) {
|
|
1318
|
-
|
|
1300
|
+
Dn(r, s);
|
|
1319
1301
|
}
|
|
1320
1302
|
})(this, e);
|
|
1321
1303
|
}
|
|
1322
|
-
var
|
|
1304
|
+
var In = { get: function() {
|
|
1323
1305
|
var e = z, t = nn;
|
|
1324
1306
|
function n(r, a) {
|
|
1325
1307
|
var s = this, f = !e.global && (e !== z || t !== nn), d = f && !at(), v = new G(function(w, T) {
|
|
@@ -1329,14 +1311,14 @@ function Ai() {
|
|
|
1329
1311
|
}
|
|
1330
1312
|
return n.prototype = Pt, n;
|
|
1331
1313
|
}, set: function(e) {
|
|
1332
|
-
B(this, "then", e && e.prototype === Pt ?
|
|
1314
|
+
B(this, "then", e && e.prototype === Pt ? In : { get: function() {
|
|
1333
1315
|
return e;
|
|
1334
|
-
}, set:
|
|
1316
|
+
}, set: In.set });
|
|
1335
1317
|
} };
|
|
1336
1318
|
function gr(e, t, n, r, a) {
|
|
1337
1319
|
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = a;
|
|
1338
1320
|
}
|
|
1339
|
-
function
|
|
1321
|
+
function Dn(e, t) {
|
|
1340
1322
|
var n, r;
|
|
1341
1323
|
Ht.push(t), e._state === null && (n = e._lib && _t(), t = Cn(t), e._state = !1, e._value = t, r = e, ft.some(function(a) {
|
|
1342
1324
|
return a._value === r._value;
|
|
@@ -1414,7 +1396,7 @@ function Ai() {
|
|
|
1414
1396
|
}
|
|
1415
1397
|
};
|
|
1416
1398
|
}
|
|
1417
|
-
J(G.prototype, { then:
|
|
1399
|
+
J(G.prototype, { then: In, _then: function(e, t) {
|
|
1418
1400
|
Sn(this, new gr(null, null, e, t, z));
|
|
1419
1401
|
}, catch: function(e) {
|
|
1420
1402
|
if (arguments.length === 1) return this.then(null, e);
|
|
@@ -1531,10 +1513,10 @@ function Ai() {
|
|
|
1531
1513
|
}, r = ht(s, e, n, r), s.ref === 0 && s.finalize(), r;
|
|
1532
1514
|
}
|
|
1533
1515
|
function Et() {
|
|
1534
|
-
return Ee.id || (Ee.id = ++Na), ++Ee.awaits, Ee.echoes +=
|
|
1516
|
+
return Ee.id || (Ee.id = ++Na), ++Ee.awaits, Ee.echoes += mr, Ee.id;
|
|
1535
1517
|
}
|
|
1536
1518
|
function at() {
|
|
1537
|
-
return !!Ee.awaits && (--Ee.awaits == 0 && (Ee.id = 0), Ee.echoes = Ee.awaits *
|
|
1519
|
+
return !!Ee.awaits && (--Ee.awaits == 0 && (Ee.id = 0), Ee.echoes = Ee.awaits * mr, !0);
|
|
1538
1520
|
}
|
|
1539
1521
|
function rn(e) {
|
|
1540
1522
|
return Ee.echoes && e && e.constructor === lt ? (Et(), e.then(function(t) {
|
|
@@ -1551,11 +1533,11 @@ function Ai() {
|
|
|
1551
1533
|
var n, r = z;
|
|
1552
1534
|
(t ? !Ee.echoes || tn++ && e === z : !tn || --tn && e === z) || queueMicrotask(t ? (function(a) {
|
|
1553
1535
|
++nn, Ee.echoes && --Ee.echoes != 0 || (Ee.echoes = Ee.awaits = Ee.id = 0), en.push(z), it(a, !0);
|
|
1554
|
-
}).bind(null, e) : Oa), e !== z && (z = e, r === nt && (nt.env = vr()), An && (n = nt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(
|
|
1536
|
+
}).bind(null, e) : Oa), e !== z && (z = e, r === nt && (nt.env = vr()), An && (n = nt.env.Promise, t = e.env, (r.global || e.global) && (Object.defineProperty(p, "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))));
|
|
1555
1537
|
}
|
|
1556
1538
|
function vr() {
|
|
1557
|
-
var e =
|
|
1558
|
-
return An ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(
|
|
1539
|
+
var e = p.Promise;
|
|
1540
|
+
return An ? { Promise: e, PromiseProp: Object.getOwnPropertyDescriptor(p, "Promise"), all: e.all, race: e.race, allSettled: e.allSettled, any: e.any, resolve: e.resolve, reject: e.reject } : {};
|
|
1559
1541
|
}
|
|
1560
1542
|
function ht(e, t, n, r, a) {
|
|
1561
1543
|
var s = z;
|
|
@@ -1580,8 +1562,8 @@ function Ai() {
|
|
|
1580
1562
|
Promise === lt && Ee.echoes === 0 ? tn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
1581
1563
|
}
|
|
1582
1564
|
("" + je).indexOf("[native code]") === -1 && (Et = at = Q);
|
|
1583
|
-
var be = G.reject,
|
|
1584
|
-
function
|
|
1565
|
+
var be = G.reject, pt = "", We = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", wr = "String expected.", xt = [], an = "__dbnames", kn = "readonly", Fn = "readwrite";
|
|
1566
|
+
function mt(e, t) {
|
|
1585
1567
|
return e ? t ? function() {
|
|
1586
1568
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
1587
1569
|
} : e : t;
|
|
@@ -1641,36 +1623,36 @@ function Ai() {
|
|
|
1641
1623
|
return n;
|
|
1642
1624
|
})) : n;
|
|
1643
1625
|
}
|
|
1644
|
-
var Nr = (
|
|
1626
|
+
var Nr = (pe.prototype._trans = function(e, t, n) {
|
|
1645
1627
|
var r = this._tx || z.trans, a = this.name, s = Pe && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
1646
|
-
function f(w, T,
|
|
1647
|
-
if (!
|
|
1648
|
-
return t(
|
|
1628
|
+
function f(w, T, m) {
|
|
1629
|
+
if (!m.schema[a]) throw new C.NotFound("Table " + a + " not part of transaction");
|
|
1630
|
+
return t(m.idbtrans, m);
|
|
1649
1631
|
}
|
|
1650
1632
|
var d = _t();
|
|
1651
1633
|
try {
|
|
1652
1634
|
var v = r && r.db._novip === this.db._novip ? r === z.trans ? r._promise(e, f, n) : rt(function() {
|
|
1653
1635
|
return r._promise(e, f, n);
|
|
1654
|
-
}, { trans: r, transless: z.transless || z }) : (function w(T,
|
|
1636
|
+
}, { trans: r, transless: z.transless || z }) : (function w(T, m, O, b) {
|
|
1655
1637
|
if (T.idbdb && (T._state.openComplete || z.letThrough || T._vip)) {
|
|
1656
|
-
var _ = T._createTransaction(
|
|
1638
|
+
var _ = T._createTransaction(m, O, T._dbSchema);
|
|
1657
1639
|
try {
|
|
1658
1640
|
_.create(), T._state.PR1398_maxLoop = 3;
|
|
1659
1641
|
} catch (A) {
|
|
1660
1642
|
return A.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
|
|
1661
|
-
return w(T,
|
|
1643
|
+
return w(T, m, O, b);
|
|
1662
1644
|
})) : be(A);
|
|
1663
1645
|
}
|
|
1664
|
-
return _._promise(
|
|
1646
|
+
return _._promise(m, function(A, x) {
|
|
1665
1647
|
return rt(function() {
|
|
1666
1648
|
return z.trans = _, b(A, x, _);
|
|
1667
1649
|
});
|
|
1668
1650
|
}).then(function(A) {
|
|
1669
|
-
if (
|
|
1651
|
+
if (m === "readwrite") try {
|
|
1670
1652
|
_.idbtrans.commit();
|
|
1671
1653
|
} catch {
|
|
1672
1654
|
}
|
|
1673
|
-
return
|
|
1655
|
+
return m === "readonly" ? A : _._completion.then(function() {
|
|
1674
1656
|
return A;
|
|
1675
1657
|
});
|
|
1676
1658
|
});
|
|
@@ -1681,7 +1663,7 @@ function Ai() {
|
|
|
1681
1663
|
T.open().catch(Q);
|
|
1682
1664
|
}
|
|
1683
1665
|
return T._state.dbReadyPromise.then(function() {
|
|
1684
|
-
return w(T,
|
|
1666
|
+
return w(T, m, O, b);
|
|
1685
1667
|
});
|
|
1686
1668
|
})(this.db, e, [this.name], f);
|
|
1687
1669
|
return s && (v._consoleTask = s, v = v.catch(function(w) {
|
|
@@ -1690,14 +1672,14 @@ function Ai() {
|
|
|
1690
1672
|
} finally {
|
|
1691
1673
|
d && Tt();
|
|
1692
1674
|
}
|
|
1693
|
-
},
|
|
1675
|
+
}, pe.prototype.get = function(e, t) {
|
|
1694
1676
|
var n = this;
|
|
1695
1677
|
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? be(new C.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(r) {
|
|
1696
1678
|
return n.core.get({ trans: r, key: e }).then(function(a) {
|
|
1697
1679
|
return n.hook.reading.fire(a);
|
|
1698
1680
|
});
|
|
1699
1681
|
}).then(t);
|
|
1700
|
-
},
|
|
1682
|
+
}, pe.prototype.where = function(e) {
|
|
1701
1683
|
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
1702
1684
|
if (N(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
|
|
1703
1685
|
var t = y(e);
|
|
@@ -1713,7 +1695,7 @@ function Ai() {
|
|
|
1713
1695
|
}).sort(function(d, v) {
|
|
1714
1696
|
return d.keyPath.length - v.keyPath.length;
|
|
1715
1697
|
})[0];
|
|
1716
|
-
if (n && this.db._maxKey !==
|
|
1698
|
+
if (n && this.db._maxKey !== pt) {
|
|
1717
1699
|
var s = n.keyPath.slice(0, t.length);
|
|
1718
1700
|
return this.where(s).equals(s.map(function(v) {
|
|
1719
1701
|
return e[v];
|
|
@@ -1724,36 +1706,36 @@ function Ai() {
|
|
|
1724
1706
|
function a(d, v) {
|
|
1725
1707
|
return re(d, v) === 0;
|
|
1726
1708
|
}
|
|
1727
|
-
var f = t.reduce(function(
|
|
1728
|
-
var w =
|
|
1729
|
-
return [w ||
|
|
1730
|
-
return b =
|
|
1709
|
+
var f = t.reduce(function(m, v) {
|
|
1710
|
+
var w = m[0], T = m[1], m = r[v], O = e[v];
|
|
1711
|
+
return [w || m, w || !m ? mt(T, m && m.multi ? function(b) {
|
|
1712
|
+
return b = me(b, v), N(b) && b.some(function(_) {
|
|
1731
1713
|
return a(O, _);
|
|
1732
1714
|
});
|
|
1733
1715
|
} : function(b) {
|
|
1734
|
-
return a(O,
|
|
1716
|
+
return a(O, me(b, v));
|
|
1735
1717
|
}) : T];
|
|
1736
1718
|
}, [null, null]), s = f[0], f = f[1];
|
|
1737
1719
|
return s ? this.where(s.name).equals(e[s.keyPath]).filter(f) : n ? this.filter(f) : this.where(t).equals("");
|
|
1738
|
-
},
|
|
1720
|
+
}, pe.prototype.filter = function(e) {
|
|
1739
1721
|
return this.toCollection().and(e);
|
|
1740
|
-
},
|
|
1722
|
+
}, pe.prototype.count = function(e) {
|
|
1741
1723
|
return this.toCollection().count(e);
|
|
1742
|
-
},
|
|
1724
|
+
}, pe.prototype.offset = function(e) {
|
|
1743
1725
|
return this.toCollection().offset(e);
|
|
1744
|
-
},
|
|
1726
|
+
}, pe.prototype.limit = function(e) {
|
|
1745
1727
|
return this.toCollection().limit(e);
|
|
1746
|
-
},
|
|
1728
|
+
}, pe.prototype.each = function(e) {
|
|
1747
1729
|
return this.toCollection().each(e);
|
|
1748
|
-
},
|
|
1730
|
+
}, pe.prototype.toArray = function(e) {
|
|
1749
1731
|
return this.toCollection().toArray(e);
|
|
1750
|
-
},
|
|
1732
|
+
}, pe.prototype.toCollection = function() {
|
|
1751
1733
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
1752
|
-
},
|
|
1734
|
+
}, pe.prototype.orderBy = function(e) {
|
|
1753
1735
|
return new this.db.Collection(new this.db.WhereClause(this, N(e) ? "[".concat(e.join("+"), "]") : e));
|
|
1754
|
-
},
|
|
1736
|
+
}, pe.prototype.reverse = function() {
|
|
1755
1737
|
return this.toCollection().reverse();
|
|
1756
|
-
},
|
|
1738
|
+
}, pe.prototype.mapToClass = function(e) {
|
|
1757
1739
|
var t, n = this.db, r = this.name;
|
|
1758
1740
|
function a() {
|
|
1759
1741
|
return t !== null && t.apply(this, arguments) || this;
|
|
@@ -1782,11 +1764,11 @@ function Ai() {
|
|
|
1782
1764
|
return T;
|
|
1783
1765
|
}
|
|
1784
1766
|
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = d, this.hook("reading", d), e;
|
|
1785
|
-
},
|
|
1767
|
+
}, pe.prototype.defineClass = function() {
|
|
1786
1768
|
return this.mapToClass(function(e) {
|
|
1787
1769
|
R(this, e);
|
|
1788
1770
|
});
|
|
1789
|
-
},
|
|
1771
|
+
}, pe.prototype.add = function(e, t) {
|
|
1790
1772
|
var n = this, r = this.schema.primKey, a = r.auto, s = r.keyPath, f = e;
|
|
1791
1773
|
return s && a && (f = on(s)(e)), this._trans("readwrite", function(d) {
|
|
1792
1774
|
return n.core.mutate({ trans: d, type: "add", keys: t != null ? [t] : null, values: [f] });
|
|
@@ -1799,9 +1781,9 @@ function Ai() {
|
|
|
1799
1781
|
}
|
|
1800
1782
|
return d;
|
|
1801
1783
|
});
|
|
1802
|
-
},
|
|
1803
|
-
return typeof e != "object" || N(e) ? this.where(":id").equals(e).modify(t) : (e =
|
|
1804
|
-
},
|
|
1784
|
+
}, pe.prototype.update = function(e, t) {
|
|
1785
|
+
return typeof e != "object" || N(e) ? this.where(":id").equals(e).modify(t) : (e = me(e, this.schema.primKey.keyPath), e === void 0 ? be(new C.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
1786
|
+
}, pe.prototype.put = function(e, t) {
|
|
1805
1787
|
var n = this, r = this.schema.primKey, a = r.auto, s = r.keyPath, f = e;
|
|
1806
1788
|
return s && a && (f = on(s)(e)), this._trans("readwrite", function(d) {
|
|
1807
1789
|
return n.core.mutate({ trans: d, type: "put", values: [f], keys: t != null ? [t] : null });
|
|
@@ -1814,7 +1796,7 @@ function Ai() {
|
|
|
1814
1796
|
}
|
|
1815
1797
|
return d;
|
|
1816
1798
|
});
|
|
1817
|
-
},
|
|
1799
|
+
}, pe.prototype.delete = function(e) {
|
|
1818
1800
|
var t = this;
|
|
1819
1801
|
return this._trans("readwrite", function(n) {
|
|
1820
1802
|
return t.core.mutate({ trans: n, type: "delete", keys: [e] }).then(function(r) {
|
|
@@ -1823,7 +1805,7 @@ function Ai() {
|
|
|
1823
1805
|
return r.numFailures ? G.reject(r.failures[0]) : void 0;
|
|
1824
1806
|
});
|
|
1825
1807
|
});
|
|
1826
|
-
},
|
|
1808
|
+
}, pe.prototype.clear = function() {
|
|
1827
1809
|
var e = this;
|
|
1828
1810
|
return this._trans("readwrite", function(t) {
|
|
1829
1811
|
return e.core.mutate({ trans: t, type: "deleteRange", range: _r }).then(function(n) {
|
|
@@ -1832,7 +1814,7 @@ function Ai() {
|
|
|
1832
1814
|
}).then(function(t) {
|
|
1833
1815
|
return t.numFailures ? G.reject(t.failures[0]) : void 0;
|
|
1834
1816
|
});
|
|
1835
|
-
},
|
|
1817
|
+
}, pe.prototype.bulkGet = function(e) {
|
|
1836
1818
|
var t = this;
|
|
1837
1819
|
return this._trans("readonly", function(n) {
|
|
1838
1820
|
return t.core.getMany({ keys: e, trans: n }).then(function(r) {
|
|
@@ -1841,7 +1823,7 @@ function Ai() {
|
|
|
1841
1823
|
});
|
|
1842
1824
|
});
|
|
1843
1825
|
});
|
|
1844
|
-
},
|
|
1826
|
+
}, pe.prototype.bulkAdd = function(e, t, n) {
|
|
1845
1827
|
var r = this, a = Array.isArray(t) ? t : void 0, s = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
1846
1828
|
return this._trans("readwrite", function(f) {
|
|
1847
1829
|
var w = r.schema.primKey, d = w.auto, w = w.keyPath;
|
|
@@ -1849,12 +1831,12 @@ function Ai() {
|
|
|
1849
1831
|
if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1850
1832
|
var v = e.length, w = w && d ? e.map(on(w)) : e;
|
|
1851
1833
|
return r.core.mutate({ trans: f, type: "add", keys: a, values: w, wantResults: s }).then(function(_) {
|
|
1852
|
-
var
|
|
1853
|
-
if (
|
|
1854
|
-
throw new et("".concat(r.name, ".bulkAdd(): ").concat(
|
|
1834
|
+
var m = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
|
|
1835
|
+
if (m === 0) return s ? O : b;
|
|
1836
|
+
throw new et("".concat(r.name, ".bulkAdd(): ").concat(m, " of ").concat(v, " operations failed"), _);
|
|
1855
1837
|
});
|
|
1856
1838
|
});
|
|
1857
|
-
},
|
|
1839
|
+
}, pe.prototype.bulkPut = function(e, t, n) {
|
|
1858
1840
|
var r = this, a = Array.isArray(t) ? t : void 0, s = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
1859
1841
|
return this._trans("readwrite", function(f) {
|
|
1860
1842
|
var w = r.schema.primKey, d = w.auto, w = w.keyPath;
|
|
@@ -1862,12 +1844,12 @@ function Ai() {
|
|
|
1862
1844
|
if (a && a.length !== e.length) throw new C.InvalidArgument("Arguments objects and keys must have the same length");
|
|
1863
1845
|
var v = e.length, w = w && d ? e.map(on(w)) : e;
|
|
1864
1846
|
return r.core.mutate({ trans: f, type: "put", keys: a, values: w, wantResults: s }).then(function(_) {
|
|
1865
|
-
var
|
|
1866
|
-
if (
|
|
1867
|
-
throw new et("".concat(r.name, ".bulkPut(): ").concat(
|
|
1847
|
+
var m = _.numFailures, O = _.results, b = _.lastResult, _ = _.failures;
|
|
1848
|
+
if (m === 0) return s ? O : b;
|
|
1849
|
+
throw new et("".concat(r.name, ".bulkPut(): ").concat(m, " of ").concat(v, " operations failed"), _);
|
|
1868
1850
|
});
|
|
1869
1851
|
});
|
|
1870
|
-
},
|
|
1852
|
+
}, pe.prototype.bulkUpdate = function(e) {
|
|
1871
1853
|
var t = this, n = this.core, r = e.map(function(f) {
|
|
1872
1854
|
return f.key;
|
|
1873
1855
|
}), a = e.map(function(f) {
|
|
@@ -1876,11 +1858,11 @@ function Ai() {
|
|
|
1876
1858
|
return this._trans("readwrite", function(f) {
|
|
1877
1859
|
return n.getMany({ trans: f, keys: r, cache: "clone" }).then(function(d) {
|
|
1878
1860
|
var v = [], w = [];
|
|
1879
|
-
e.forEach(function(
|
|
1880
|
-
var b =
|
|
1861
|
+
e.forEach(function(m, O) {
|
|
1862
|
+
var b = m.key, _ = m.changes, A = d[O];
|
|
1881
1863
|
if (A) {
|
|
1882
|
-
for (var x = 0,
|
|
1883
|
-
var S =
|
|
1864
|
+
for (var x = 0, I = Object.keys(_); x < I.length; x++) {
|
|
1865
|
+
var S = I[x], P = _[S];
|
|
1884
1866
|
if (S === t.schema.primKey.keyPath) {
|
|
1885
1867
|
if (re(P, b) !== 0) throw new C.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1886
1868
|
} else ne(A, S, P);
|
|
@@ -1889,18 +1871,18 @@ function Ai() {
|
|
|
1889
1871
|
}
|
|
1890
1872
|
});
|
|
1891
1873
|
var T = v.length;
|
|
1892
|
-
return n.mutate({ trans: f, type: "put", keys: v, values: w, updates: { keys: r, changeSpecs: a } }).then(function(
|
|
1893
|
-
var O =
|
|
1874
|
+
return n.mutate({ trans: f, type: "put", keys: v, values: w, updates: { keys: r, changeSpecs: a } }).then(function(m) {
|
|
1875
|
+
var O = m.numFailures, b = m.failures;
|
|
1894
1876
|
if (O === 0) return T;
|
|
1895
1877
|
for (var _ = 0, A = Object.keys(b); _ < A.length; _++) {
|
|
1896
|
-
var x,
|
|
1897
|
-
S != null && (x = b[
|
|
1878
|
+
var x, I = A[_], S = s[Number(I)];
|
|
1879
|
+
S != null && (x = b[I], delete b[I], b[S] = x);
|
|
1898
1880
|
}
|
|
1899
1881
|
throw new et("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(T, " operations failed"), b);
|
|
1900
1882
|
});
|
|
1901
1883
|
});
|
|
1902
1884
|
});
|
|
1903
|
-
},
|
|
1885
|
+
}, pe.prototype.bulkDelete = function(e) {
|
|
1904
1886
|
var t = this, n = e.length;
|
|
1905
1887
|
return this._trans("readwrite", function(r) {
|
|
1906
1888
|
return t.core.mutate({ trans: r, type: "delete", keys: e }).then(function(a) {
|
|
@@ -1911,8 +1893,8 @@ function Ai() {
|
|
|
1911
1893
|
if (a === 0) return s;
|
|
1912
1894
|
throw new et("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), f);
|
|
1913
1895
|
});
|
|
1914
|
-
},
|
|
1915
|
-
function
|
|
1896
|
+
}, pe);
|
|
1897
|
+
function pe() {
|
|
1916
1898
|
}
|
|
1917
1899
|
function Mt(e) {
|
|
1918
1900
|
function t(f, d) {
|
|
@@ -1930,21 +1912,21 @@ function Ai() {
|
|
|
1930
1912
|
if (typeof f != "object") {
|
|
1931
1913
|
var w;
|
|
1932
1914
|
d = d || Nn;
|
|
1933
|
-
var T = { subscribers: [], fire: v = v || Q, subscribe: function(
|
|
1934
|
-
T.subscribers.indexOf(
|
|
1935
|
-
}, unsubscribe: function(
|
|
1915
|
+
var T = { subscribers: [], fire: v = v || Q, subscribe: function(m) {
|
|
1916
|
+
T.subscribers.indexOf(m) === -1 && (T.subscribers.push(m), T.fire = d(T.fire, m));
|
|
1917
|
+
}, unsubscribe: function(m) {
|
|
1936
1918
|
T.subscribers = T.subscribers.filter(function(O) {
|
|
1937
|
-
return O !==
|
|
1919
|
+
return O !== m;
|
|
1938
1920
|
}), T.fire = T.subscribers.reduce(d, v);
|
|
1939
1921
|
} };
|
|
1940
1922
|
return n[f] = t[f] = T;
|
|
1941
1923
|
}
|
|
1942
|
-
y(w = f).forEach(function(
|
|
1943
|
-
var O = w[
|
|
1944
|
-
if (N(O)) s(
|
|
1924
|
+
y(w = f).forEach(function(m) {
|
|
1925
|
+
var O = w[m];
|
|
1926
|
+
if (N(O)) s(m, w[m][0], w[m][1]);
|
|
1945
1927
|
else {
|
|
1946
1928
|
if (O !== "asap") throw new C.InvalidArgument("Invalid event config");
|
|
1947
|
-
var b = s(
|
|
1929
|
+
var b = s(m, he, function() {
|
|
1948
1930
|
for (var _ = arguments.length, A = new Array(_); _--; ) A[_] = arguments[_];
|
|
1949
1931
|
b.subscribers.forEach(function(x) {
|
|
1950
1932
|
ae(function() {
|
|
@@ -1963,12 +1945,12 @@ function Ai() {
|
|
|
1963
1945
|
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
|
|
1964
1946
|
}
|
|
1965
1947
|
function Bn(e, t) {
|
|
1966
|
-
e.filter =
|
|
1948
|
+
e.filter = mt(e.filter, t);
|
|
1967
1949
|
}
|
|
1968
1950
|
function Mn(e, t, n) {
|
|
1969
1951
|
var r = e.replayFilter;
|
|
1970
1952
|
e.replayFilter = r ? function() {
|
|
1971
|
-
return
|
|
1953
|
+
return mt(r(), t());
|
|
1972
1954
|
} : t, e.justLimit = n && !r;
|
|
1973
1955
|
}
|
|
1974
1956
|
function un(e, t) {
|
|
@@ -1982,19 +1964,19 @@ function Ai() {
|
|
|
1982
1964
|
return t.openCursor({ trans: n, values: !e.keysOnly, reverse: e.dir === "prev", unique: !!e.unique, query: { index: r, range: e.range } });
|
|
1983
1965
|
}
|
|
1984
1966
|
function cn(e, t, n, r) {
|
|
1985
|
-
var a = e.replayFilter ?
|
|
1967
|
+
var a = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
|
|
1986
1968
|
if (e.or) {
|
|
1987
1969
|
var s = {}, f = function(d, v, w) {
|
|
1988
|
-
var T,
|
|
1970
|
+
var T, m;
|
|
1989
1971
|
a && !a(v, w, function(O) {
|
|
1990
1972
|
return v.stop(O);
|
|
1991
1973
|
}, function(O) {
|
|
1992
1974
|
return v.fail(O);
|
|
1993
|
-
}) || ((
|
|
1975
|
+
}) || ((m = "" + (T = v.primaryKey)) == "[object ArrayBuffer]" && (m = "" + new Uint8Array(T)), W(s, m) || (s[m] = !0, t(d, v, w)));
|
|
1994
1976
|
};
|
|
1995
1977
|
return Promise.all([e.or._iterate(f, n), Or(Ar(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
|
|
1996
1978
|
}
|
|
1997
|
-
return Or(Ar(e, r, n),
|
|
1979
|
+
return Or(Ar(e, r, n), mt(e.algorithm, a), t, !e.keysOnly && e.valueMapper);
|
|
1998
1980
|
}
|
|
1999
1981
|
function Or(e, t, n, r) {
|
|
2000
1982
|
var a = ge(r ? function(s, f, d) {
|
|
@@ -2056,7 +2038,7 @@ function Ai() {
|
|
|
2056
2038
|
return t.error ? t.table._trans(null, be.bind(null, t.error)) : t.table._trans("readwrite", e, "locked");
|
|
2057
2039
|
}, ue.prototype._addAlgorithm = function(e) {
|
|
2058
2040
|
var t = this._ctx;
|
|
2059
|
-
t.algorithm =
|
|
2041
|
+
t.algorithm = mt(t.algorithm, e);
|
|
2060
2042
|
}, ue.prototype._iterate = function(e, t) {
|
|
2061
2043
|
return cn(this._ctx, e, t, this._ctx.table.core);
|
|
2062
2044
|
}, ue.prototype.clone = function(e) {
|
|
@@ -2148,7 +2130,7 @@ function Ai() {
|
|
|
2148
2130
|
var t;
|
|
2149
2131
|
return Bn(this._ctx, function(n) {
|
|
2150
2132
|
return e(n.value);
|
|
2151
|
-
}), (t = this._ctx).isMatch =
|
|
2133
|
+
}), (t = this._ctx).isMatch = mt(t.isMatch, e), this;
|
|
2152
2134
|
}, ue.prototype.and = function(e) {
|
|
2153
2135
|
return this.filter(e);
|
|
2154
2136
|
}, ue.prototype.or = function(e) {
|
|
@@ -2213,32 +2195,32 @@ function Ai() {
|
|
|
2213
2195
|
var t = this, n = this._ctx;
|
|
2214
2196
|
return this._write(function(r) {
|
|
2215
2197
|
var a, s, f;
|
|
2216
|
-
f = typeof e == "function" ? e : (a = y(e), s = a.length, function(
|
|
2198
|
+
f = typeof e == "function" ? e : (a = y(e), s = a.length, function(I) {
|
|
2217
2199
|
for (var S = !1, P = 0; P < s; ++P) {
|
|
2218
|
-
var k = a[P], M = e[k], L =
|
|
2219
|
-
M instanceof Kt ? (ne(
|
|
2200
|
+
var k = a[P], M = e[k], L = me(I, k);
|
|
2201
|
+
M instanceof Kt ? (ne(I, k, M.execute(L)), S = !0) : L !== M && (ne(I, k, M), S = !0);
|
|
2220
2202
|
}
|
|
2221
2203
|
return S;
|
|
2222
2204
|
});
|
|
2223
|
-
var d = n.table.core,
|
|
2224
|
-
|
|
2225
|
-
function O(
|
|
2205
|
+
var d = n.table.core, m = d.schema.primaryKey, v = m.outbound, w = m.extractKey, T = 200, m = t.db._options.modifyChunkSize;
|
|
2206
|
+
m && (T = typeof m == "object" ? m[d.name] || m["*"] || 200 : m);
|
|
2207
|
+
function O(I, k) {
|
|
2226
2208
|
var P = k.failures, k = k.numFailures;
|
|
2227
|
-
_ +=
|
|
2209
|
+
_ += I - k;
|
|
2228
2210
|
for (var M = 0, L = y(P); M < L.length; M++) {
|
|
2229
2211
|
var K = L[M];
|
|
2230
2212
|
b.push(P[K]);
|
|
2231
2213
|
}
|
|
2232
2214
|
}
|
|
2233
|
-
var b = [], _ = 0, A = [], x = e ===
|
|
2234
|
-
return t.clone().primaryKeys().then(function(
|
|
2215
|
+
var b = [], _ = 0, A = [], x = e === Ir;
|
|
2216
|
+
return t.clone().primaryKeys().then(function(I) {
|
|
2235
2217
|
function S(k) {
|
|
2236
|
-
var M = Math.min(T,
|
|
2218
|
+
var M = Math.min(T, I.length - k), L = I.slice(k, k + M);
|
|
2237
2219
|
return (x ? Promise.resolve([]) : d.getMany({ trans: r, keys: L, cache: "immutable" })).then(function(K) {
|
|
2238
2220
|
var q = [], V = [], U = v ? [] : null, $ = x ? L : [];
|
|
2239
2221
|
if (!x) for (var te = 0; te < M; ++te) {
|
|
2240
|
-
var oe = K[te], Z = { value: ke(oe), primKey:
|
|
2241
|
-
f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(
|
|
2222
|
+
var oe = K[te], Z = { value: ke(oe), primKey: I[k + te] };
|
|
2223
|
+
f.call(Z, Z.value, Z) !== !1 && (Z.value == null ? $.push(I[k + te]) : v || re(w(oe), w(Z.value)) === 0 ? (V.push(Z.value), v && U.push(I[k + te])) : ($.push(I[k + te]), q.push(Z.value)));
|
|
2242
2224
|
}
|
|
2243
2225
|
return Promise.resolve(0 < q.length && d.mutate({ trans: r, type: "add", values: q }).then(function(ve) {
|
|
2244
2226
|
for (var H in ve.failures) $.splice(parseInt(H), 1);
|
|
@@ -2254,20 +2236,20 @@ function Ai() {
|
|
|
2254
2236
|
return O($.length, ve);
|
|
2255
2237
|
});
|
|
2256
2238
|
}).then(function() {
|
|
2257
|
-
return
|
|
2239
|
+
return I.length > k + M && S(k + T);
|
|
2258
2240
|
});
|
|
2259
2241
|
});
|
|
2260
2242
|
}
|
|
2261
2243
|
var P = Nt(n) && n.limit === 1 / 0 && (typeof e != "function" || x) && { index: n.index, range: n.range };
|
|
2262
2244
|
return S(0).then(function() {
|
|
2263
2245
|
if (0 < b.length) throw new Je("Error modifying one or more objects", b, _, A);
|
|
2264
|
-
return
|
|
2246
|
+
return I.length;
|
|
2265
2247
|
});
|
|
2266
2248
|
});
|
|
2267
2249
|
});
|
|
2268
2250
|
}, ue.prototype.delete = function() {
|
|
2269
2251
|
var e = this._ctx, t = e.range;
|
|
2270
|
-
return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(
|
|
2252
|
+
return !Nt(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Ir) : this._write(function(n) {
|
|
2271
2253
|
var r = e.table.core.schema.primaryKey, a = t;
|
|
2272
2254
|
return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(s) {
|
|
2273
2255
|
return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
|
|
@@ -2282,13 +2264,13 @@ function Ai() {
|
|
|
2282
2264
|
}, ue);
|
|
2283
2265
|
function ue() {
|
|
2284
2266
|
}
|
|
2285
|
-
var
|
|
2267
|
+
var Ir = function(e, t) {
|
|
2286
2268
|
return t.value = null;
|
|
2287
2269
|
};
|
|
2288
|
-
function
|
|
2270
|
+
function Ia(e, t) {
|
|
2289
2271
|
return e < t ? -1 : e === t ? 0 : 1;
|
|
2290
2272
|
}
|
|
2291
|
-
function
|
|
2273
|
+
function Da(e, t) {
|
|
2292
2274
|
return t < e ? -1 : e === t ? 0 : 1;
|
|
2293
2275
|
}
|
|
2294
2276
|
function Be(e, t, n) {
|
|
@@ -2296,11 +2278,11 @@ function Ai() {
|
|
|
2296
2278
|
}
|
|
2297
2279
|
function At(e) {
|
|
2298
2280
|
return new e.Collection(e, function() {
|
|
2299
|
-
return
|
|
2281
|
+
return Dr("");
|
|
2300
2282
|
}).limit(0);
|
|
2301
2283
|
}
|
|
2302
2284
|
function ln(e, t, n, r) {
|
|
2303
|
-
var a, s, f, d, v, w, T,
|
|
2285
|
+
var a, s, f, d, v, w, T, m = n.length;
|
|
2304
2286
|
if (!n.every(function(_) {
|
|
2305
2287
|
return typeof _ == "string";
|
|
2306
2288
|
})) return Be(e, wr);
|
|
@@ -2313,11 +2295,11 @@ function Ai() {
|
|
|
2313
2295
|
return x.toLowerCase();
|
|
2314
2296
|
} : function(x) {
|
|
2315
2297
|
return x.toUpperCase();
|
|
2316
|
-
}, f = _ === "next" ?
|
|
2298
|
+
}, f = _ === "next" ? Ia : Da;
|
|
2317
2299
|
var A = n.map(function(x) {
|
|
2318
2300
|
return { lower: s(x), upper: a(x) };
|
|
2319
|
-
}).sort(function(x,
|
|
2320
|
-
return f(x.lower,
|
|
2301
|
+
}).sort(function(x, I) {
|
|
2302
|
+
return f(x.lower, I.lower);
|
|
2321
2303
|
});
|
|
2322
2304
|
d = A.map(function(x) {
|
|
2323
2305
|
return x.upper;
|
|
@@ -2326,17 +2308,17 @@ function Ai() {
|
|
|
2326
2308
|
}), T = (w = _) === "next" ? "" : r;
|
|
2327
2309
|
}
|
|
2328
2310
|
O("next"), e = new e.Collection(e, function() {
|
|
2329
|
-
return ot(d[0], v[
|
|
2311
|
+
return ot(d[0], v[m - 1] + r);
|
|
2330
2312
|
}), e._ondirectionchange = function(_) {
|
|
2331
2313
|
O(_);
|
|
2332
2314
|
};
|
|
2333
2315
|
var b = 0;
|
|
2334
2316
|
return e._addAlgorithm(function(_, A, x) {
|
|
2335
|
-
var
|
|
2336
|
-
if (typeof
|
|
2337
|
-
var S = s(
|
|
2317
|
+
var I = _.key;
|
|
2318
|
+
if (typeof I != "string") return !1;
|
|
2319
|
+
var S = s(I);
|
|
2338
2320
|
if (t(S, v, b)) return !0;
|
|
2339
|
-
for (var P = null, k = b; k <
|
|
2321
|
+
for (var P = null, k = b; k < m; ++k) {
|
|
2340
2322
|
var M = (function(L, K, q, V, U, $) {
|
|
2341
2323
|
for (var te = Math.min(L.length, V.length), oe = -1, Z = 0; Z < te; ++Z) {
|
|
2342
2324
|
var ve = K[Z];
|
|
@@ -2344,7 +2326,7 @@ function Ai() {
|
|
|
2344
2326
|
U(L[Z], ve) < 0 && (oe = Z);
|
|
2345
2327
|
}
|
|
2346
2328
|
return te < V.length && $ === "next" ? L + q.substr(L.length) : te < L.length && $ === "prev" ? L.substr(0, q.length) : oe < 0 ? null : L.substr(0, oe) + V[oe] + q.substr(oe + 1);
|
|
2347
|
-
})(
|
|
2329
|
+
})(I, S, d[k], v[k], f, w);
|
|
2348
2330
|
M === null && P === null ? b = k + 1 : (P === null || 0 < f(P, M)) && (P = M);
|
|
2349
2331
|
}
|
|
2350
2332
|
return A(P !== null ? function() {
|
|
@@ -2355,7 +2337,7 @@ function Ai() {
|
|
|
2355
2337
|
function ot(e, t, n, r) {
|
|
2356
2338
|
return { type: 2, lower: e, upper: t, lowerOpen: n, upperOpen: r };
|
|
2357
2339
|
}
|
|
2358
|
-
function
|
|
2340
|
+
function Dr(e) {
|
|
2359
2341
|
return { type: 1, lower: e, upper: e };
|
|
2360
2342
|
}
|
|
2361
2343
|
var Sr = (Object.defineProperty(xe.prototype, "Collection", { get: function() {
|
|
@@ -2371,7 +2353,7 @@ function Ai() {
|
|
|
2371
2353
|
}
|
|
2372
2354
|
}, xe.prototype.equals = function(e) {
|
|
2373
2355
|
return e == null ? Be(this, We) : new this.Collection(this, function() {
|
|
2374
|
-
return
|
|
2356
|
+
return Dr(e);
|
|
2375
2357
|
});
|
|
2376
2358
|
}, xe.prototype.above = function(e) {
|
|
2377
2359
|
return e == null ? Be(this, We) : new this.Collection(this, function() {
|
|
@@ -2390,11 +2372,11 @@ function Ai() {
|
|
|
2390
2372
|
return ot(void 0, e);
|
|
2391
2373
|
});
|
|
2392
2374
|
}, xe.prototype.startsWith = function(e) {
|
|
2393
|
-
return typeof e != "string" ? Be(this, wr) : this.between(e, e +
|
|
2375
|
+
return typeof e != "string" ? Be(this, wr) : this.between(e, e + pt, !0, !0);
|
|
2394
2376
|
}, xe.prototype.startsWithIgnoreCase = function(e) {
|
|
2395
2377
|
return e === "" ? this.startsWith(e) : ln(this, function(t, n) {
|
|
2396
2378
|
return t.indexOf(n[0]) === 0;
|
|
2397
|
-
}, [e],
|
|
2379
|
+
}, [e], pt);
|
|
2398
2380
|
}, xe.prototype.equalsIgnoreCase = function(e) {
|
|
2399
2381
|
return ln(this, function(t, n) {
|
|
2400
2382
|
return t === n[0];
|
|
@@ -2410,7 +2392,7 @@ function Ai() {
|
|
|
2410
2392
|
return n.some(function(r) {
|
|
2411
2393
|
return t.indexOf(r) === 0;
|
|
2412
2394
|
});
|
|
2413
|
-
}, e,
|
|
2395
|
+
}, e, pt);
|
|
2414
2396
|
}, xe.prototype.anyOf = function() {
|
|
2415
2397
|
var e = this, t = Fe.apply(Ue, arguments), n = this._cmp;
|
|
2416
2398
|
try {
|
|
@@ -2446,18 +2428,18 @@ function Ai() {
|
|
|
2446
2428
|
return n ? n.concat([[n[n.length - 1][1], r]]) : [[-1 / 0, r]];
|
|
2447
2429
|
}, null);
|
|
2448
2430
|
return t.push([e[e.length - 1], this.db._maxKey]), this.inAnyRange(t, { includeLowers: !1, includeUppers: !1 });
|
|
2449
|
-
}, xe.prototype.inAnyRange = function(
|
|
2431
|
+
}, xe.prototype.inAnyRange = function(I, t) {
|
|
2450
2432
|
var n = this, r = this._cmp, a = this._ascending, s = this._descending, f = this._min, d = this._max;
|
|
2451
|
-
if (
|
|
2452
|
-
if (!
|
|
2433
|
+
if (I.length === 0) return At(this);
|
|
2434
|
+
if (!I.every(function(S) {
|
|
2453
2435
|
return S[0] !== void 0 && S[1] !== void 0 && a(S[0], S[1]) <= 0;
|
|
2454
2436
|
})) return Be(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", C.InvalidArgument);
|
|
2455
|
-
var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, T,
|
|
2437
|
+
var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, T, m = a;
|
|
2456
2438
|
function O(S, P) {
|
|
2457
|
-
return
|
|
2439
|
+
return m(S[0], P[0]);
|
|
2458
2440
|
}
|
|
2459
2441
|
try {
|
|
2460
|
-
(T =
|
|
2442
|
+
(T = I.reduce(function(S, P) {
|
|
2461
2443
|
for (var k = 0, M = S.length; k < M; ++k) {
|
|
2462
2444
|
var L = S[k];
|
|
2463
2445
|
if (r(P[0], L[1]) < 0 && 0 < r(P[1], L[0])) {
|
|
@@ -2478,23 +2460,23 @@ function Ai() {
|
|
|
2478
2460
|
return 0 < s(S, T[b][0]);
|
|
2479
2461
|
} : function(S) {
|
|
2480
2462
|
return 0 <= s(S, T[b][0]);
|
|
2481
|
-
}, x = _,
|
|
2463
|
+
}, x = _, I = new this.Collection(this, function() {
|
|
2482
2464
|
return ot(T[0][0], T[T.length - 1][1], !v, !w);
|
|
2483
2465
|
});
|
|
2484
|
-
return
|
|
2485
|
-
|
|
2486
|
-
},
|
|
2466
|
+
return I._ondirectionchange = function(S) {
|
|
2467
|
+
m = S === "next" ? (x = _, a) : (x = A, s), T.sort(O);
|
|
2468
|
+
}, I._addAlgorithm(function(S, P, k) {
|
|
2487
2469
|
for (var M, L = S.key; x(L); ) if (++b === T.length) return P(k), !1;
|
|
2488
2470
|
return !_(M = L) && !A(M) || (n._cmp(L, T[b][1]) === 0 || n._cmp(L, T[b][0]) === 0 || P(function() {
|
|
2489
|
-
|
|
2471
|
+
m === a ? S.continue(T[b][0]) : S.continue(T[b][1]);
|
|
2490
2472
|
}), !1);
|
|
2491
|
-
}),
|
|
2473
|
+
}), I;
|
|
2492
2474
|
}, xe.prototype.startsWithAnyOf = function() {
|
|
2493
2475
|
var e = Fe.apply(Ue, arguments);
|
|
2494
2476
|
return e.every(function(t) {
|
|
2495
2477
|
return typeof t == "string";
|
|
2496
2478
|
}) ? e.length === 0 ? At(this) : this.inAnyRange(e.map(function(t) {
|
|
2497
|
-
return [t, t +
|
|
2479
|
+
return [t, t + pt];
|
|
2498
2480
|
})) : Be(this, "startsWithAnyOf() only works with strings");
|
|
2499
2481
|
}, xe);
|
|
2500
2482
|
function xe() {
|
|
@@ -2616,8 +2598,8 @@ function Ai() {
|
|
|
2616
2598
|
}, [[]];
|
|
2617
2599
|
} catch {
|
|
2618
2600
|
return Ut = function() {
|
|
2619
|
-
return
|
|
2620
|
-
},
|
|
2601
|
+
return pt;
|
|
2602
|
+
}, pt;
|
|
2621
2603
|
}
|
|
2622
2604
|
};
|
|
2623
2605
|
function Ln(e) {
|
|
@@ -2625,9 +2607,9 @@ function Ai() {
|
|
|
2625
2607
|
} : typeof e == "string" ? (t = e).split(".").length === 1 ? function(n) {
|
|
2626
2608
|
return n[t];
|
|
2627
2609
|
} : function(n) {
|
|
2628
|
-
return
|
|
2610
|
+
return me(n, t);
|
|
2629
2611
|
} : function(n) {
|
|
2630
|
-
return
|
|
2612
|
+
return me(n, e);
|
|
2631
2613
|
};
|
|
2632
2614
|
var t;
|
|
2633
2615
|
}
|
|
@@ -2648,11 +2630,11 @@ function Ai() {
|
|
|
2648
2630
|
function a(O) {
|
|
2649
2631
|
var b, _ = O.name;
|
|
2650
2632
|
return { name: _, schema: O, mutate: function(A) {
|
|
2651
|
-
var x = A.trans,
|
|
2633
|
+
var x = A.trans, I = A.type, S = A.keys, P = A.values, k = A.range;
|
|
2652
2634
|
return new Promise(function(M, L) {
|
|
2653
2635
|
M = ge(M);
|
|
2654
|
-
var K = x.objectStore(_), q = K.keyPath == null, V =
|
|
2655
|
-
if (!V &&
|
|
2636
|
+
var K = x.objectStore(_), q = K.keyPath == null, V = I === "put" || I === "add";
|
|
2637
|
+
if (!V && I !== "delete" && I !== "deleteRange") throw new Error("Invalid operation type: " + I);
|
|
2656
2638
|
var U, $ = (S || P || { length: 1 }).length;
|
|
2657
2639
|
if (S && P && S.length !== P.length) throw new Error("Given keys array must have same length as given values array.");
|
|
2658
2640
|
if ($ === 0) return M({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
@@ -2660,18 +2642,18 @@ function Ai() {
|
|
|
2660
2642
|
++ve, qt(Se);
|
|
2661
2643
|
}
|
|
2662
2644
|
var oe = [], Z = [], ve = 0;
|
|
2663
|
-
if (
|
|
2645
|
+
if (I === "deleteRange") {
|
|
2664
2646
|
if (k.type === 4) return M({ numFailures: ve, failures: Z, results: [], lastResult: void 0 });
|
|
2665
2647
|
k.type === 3 ? oe.push(U = K.clear()) : oe.push(U = K.delete(r(k)));
|
|
2666
2648
|
} else {
|
|
2667
2649
|
var q = V ? q ? [P, S] : [P, null] : [S, null], H = q[0], Ce = q[1];
|
|
2668
|
-
if (V) for (var
|
|
2669
|
-
else for (
|
|
2650
|
+
if (V) for (var Ie = 0; Ie < $; ++Ie) oe.push(U = Ce && Ce[Ie] !== void 0 ? K[I](H[Ie], Ce[Ie]) : K[I](H[Ie])), U.onerror = te;
|
|
2651
|
+
else for (Ie = 0; Ie < $; ++Ie) oe.push(U = K[I](H[Ie])), U.onerror = te;
|
|
2670
2652
|
}
|
|
2671
2653
|
function Tn(Se) {
|
|
2672
2654
|
Se = Se.target.result, oe.forEach(function(vt, ir) {
|
|
2673
2655
|
return vt.error != null && (Z[ir] = vt.error);
|
|
2674
|
-
}), M({ numFailures: ve, failures: Z, results:
|
|
2656
|
+
}), M({ numFailures: ve, failures: Z, results: I === "delete" ? S : oe.map(function(vt) {
|
|
2675
2657
|
return vt.result;
|
|
2676
2658
|
}), lastResult: Se });
|
|
2677
2659
|
}
|
|
@@ -2680,40 +2662,40 @@ function Ai() {
|
|
|
2680
2662
|
}, U.onsuccess = Tn;
|
|
2681
2663
|
});
|
|
2682
2664
|
}, getMany: function(A) {
|
|
2683
|
-
var x = A.trans,
|
|
2665
|
+
var x = A.trans, I = A.keys;
|
|
2684
2666
|
return new Promise(function(S, P) {
|
|
2685
2667
|
S = ge(S);
|
|
2686
|
-
for (var k, M = x.objectStore(_), L =
|
|
2668
|
+
for (var k, M = x.objectStore(_), L = I.length, K = new Array(L), q = 0, V = 0, U = function(oe) {
|
|
2687
2669
|
oe = oe.target, K[oe._pos] = oe.result, ++V === q && S(K);
|
|
2688
|
-
}, $ = Ve(P), te = 0; te < L; ++te)
|
|
2670
|
+
}, $ = Ve(P), te = 0; te < L; ++te) I[te] != null && ((k = M.get(I[te]))._pos = te, k.onsuccess = U, k.onerror = $, ++q);
|
|
2689
2671
|
q === 0 && S(K);
|
|
2690
2672
|
});
|
|
2691
2673
|
}, get: function(A) {
|
|
2692
|
-
var x = A.trans,
|
|
2674
|
+
var x = A.trans, I = A.key;
|
|
2693
2675
|
return new Promise(function(S, P) {
|
|
2694
2676
|
S = ge(S);
|
|
2695
|
-
var k = x.objectStore(_).get(
|
|
2677
|
+
var k = x.objectStore(_).get(I);
|
|
2696
2678
|
k.onsuccess = function(M) {
|
|
2697
2679
|
return S(M.target.result);
|
|
2698
2680
|
}, k.onerror = Ve(P);
|
|
2699
2681
|
});
|
|
2700
2682
|
}, query: (b = w, function(A) {
|
|
2701
|
-
return new Promise(function(x,
|
|
2683
|
+
return new Promise(function(x, I) {
|
|
2702
2684
|
x = ge(x);
|
|
2703
2685
|
var S, P, k, q = A.trans, M = A.values, L = A.limit, U = A.query, K = L === 1 / 0 ? void 0 : L, V = U.index, U = U.range, q = q.objectStore(_), V = V.isPrimaryKey ? q : q.index(V.name), U = r(U);
|
|
2704
2686
|
if (L === 0) return x({ result: [] });
|
|
2705
2687
|
b ? ((K = M ? V.getAll(U, K) : V.getAllKeys(U, K)).onsuccess = function($) {
|
|
2706
2688
|
return x({ result: $.target.result });
|
|
2707
|
-
}, K.onerror = Ve(
|
|
2689
|
+
}, K.onerror = Ve(I)) : (S = 0, P = !M && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), k = [], P.onsuccess = function($) {
|
|
2708
2690
|
var te = P.result;
|
|
2709
2691
|
return te ? (k.push(M ? te.value : te.primaryKey), ++S === L ? x({ result: k }) : void te.continue()) : x({ result: k });
|
|
2710
|
-
}, P.onerror = Ve(
|
|
2692
|
+
}, P.onerror = Ve(I));
|
|
2711
2693
|
});
|
|
2712
2694
|
}), openCursor: function(A) {
|
|
2713
|
-
var x = A.trans,
|
|
2695
|
+
var x = A.trans, I = A.values, S = A.query, P = A.reverse, k = A.unique;
|
|
2714
2696
|
return new Promise(function(M, L) {
|
|
2715
2697
|
M = ge(M);
|
|
2716
|
-
var V = S.index, K = S.range, q = x.objectStore(_), q = V.isPrimaryKey ? q : q.index(V.name), V = P ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", U = !
|
|
2698
|
+
var V = S.index, K = S.range, q = x.objectStore(_), q = V.isPrimaryKey ? q : q.index(V.name), V = P ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", U = !I && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
|
|
2717
2699
|
U.onerror = Ve(L), U.onsuccess = ge(function($) {
|
|
2718
2700
|
var te, oe, Z, ve, H = U.result;
|
|
2719
2701
|
H ? (H.___id = ++Ra, H.done = !1, te = H.continue.bind(H), oe = (oe = H.continuePrimaryKey) && oe.bind(H), Z = H.advance.bind(H), ve = function() {
|
|
@@ -2721,14 +2703,14 @@ function Ai() {
|
|
|
2721
2703
|
}, H.trans = x, H.stop = H.continue = H.continuePrimaryKey = H.advance = function() {
|
|
2722
2704
|
throw new Error("Cursor not started");
|
|
2723
2705
|
}, H.fail = ge(L), H.next = function() {
|
|
2724
|
-
var Ce = this,
|
|
2706
|
+
var Ce = this, Ie = 1;
|
|
2725
2707
|
return this.start(function() {
|
|
2726
|
-
return
|
|
2708
|
+
return Ie-- ? Ce.continue() : Ce.stop();
|
|
2727
2709
|
}).then(function() {
|
|
2728
2710
|
return Ce;
|
|
2729
2711
|
});
|
|
2730
2712
|
}, H.start = function(Ce) {
|
|
2731
|
-
function
|
|
2713
|
+
function Ie() {
|
|
2732
2714
|
if (U.result) try {
|
|
2733
2715
|
Ce();
|
|
2734
2716
|
} catch (Se) {
|
|
@@ -2744,15 +2726,15 @@ function Ai() {
|
|
|
2744
2726
|
};
|
|
2745
2727
|
});
|
|
2746
2728
|
return U.onsuccess = ge(function(Se) {
|
|
2747
|
-
U.onsuccess =
|
|
2748
|
-
}), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z,
|
|
2729
|
+
U.onsuccess = Ie, Ie();
|
|
2730
|
+
}), H.continue = te, H.continuePrimaryKey = oe, H.advance = Z, Ie(), Tn;
|
|
2749
2731
|
}, M(H)) : M(null);
|
|
2750
2732
|
}, L);
|
|
2751
2733
|
});
|
|
2752
2734
|
}, count: function(A) {
|
|
2753
|
-
var x = A.query,
|
|
2735
|
+
var x = A.query, I = A.trans, S = x.index, P = x.range;
|
|
2754
2736
|
return new Promise(function(k, M) {
|
|
2755
|
-
var L =
|
|
2737
|
+
var L = I.objectStore(_), K = S.isPrimaryKey ? L : L.index(S.name), L = r(P), K = L ? K.count(L) : K.count();
|
|
2756
2738
|
K.onsuccess = ge(function(q) {
|
|
2757
2739
|
return k(q.target.result);
|
|
2758
2740
|
}), K.onerror = Ve(M);
|
|
@@ -2762,21 +2744,21 @@ function Ai() {
|
|
|
2762
2744
|
var s, f, d, T = (f = v, d = Pr((s = e).objectStoreNames), { schema: { name: s.name, tables: d.map(function(O) {
|
|
2763
2745
|
return f.objectStore(O);
|
|
2764
2746
|
}).map(function(O) {
|
|
2765
|
-
var b = O.keyPath, x = O.autoIncrement, _ = N(b), A = {}, x = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: _, keyPath: b, autoIncrement: x, unique: !0, extractKey: Ln(b) }, indexes: Pr(O.indexNames).map(function(
|
|
2766
|
-
return O.index(
|
|
2747
|
+
var b = O.keyPath, x = O.autoIncrement, _ = N(b), A = {}, x = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: _, keyPath: b, autoIncrement: x, unique: !0, extractKey: Ln(b) }, indexes: Pr(O.indexNames).map(function(I) {
|
|
2748
|
+
return O.index(I);
|
|
2767
2749
|
}).map(function(k) {
|
|
2768
2750
|
var S = k.name, P = k.unique, M = k.multiEntry, k = k.keyPath, M = { name: S, compound: N(k), keyPath: k, unique: P, multiEntry: M, extractKey: Ln(k) };
|
|
2769
2751
|
return A[Vt(k)] = M;
|
|
2770
|
-
}), getIndexByKeyPath: function(
|
|
2771
|
-
return A[Vt(
|
|
2752
|
+
}), getIndexByKeyPath: function(I) {
|
|
2753
|
+
return A[Vt(I)];
|
|
2772
2754
|
} };
|
|
2773
2755
|
return A[":id"] = x.primaryKey, b != null && (A[Vt(b)] = x.primaryKey), x;
|
|
2774
|
-
}) }, hasGetAll: 0 < d.length && "getAll" in f.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, w = T.hasGetAll, T = v.tables.map(a),
|
|
2756
|
+
}) }, hasGetAll: 0 < d.length && "getAll" in f.objectStore(d[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = T.schema, w = T.hasGetAll, T = v.tables.map(a), m = {};
|
|
2775
2757
|
return T.forEach(function(O) {
|
|
2776
|
-
return
|
|
2758
|
+
return m[O.name] = O;
|
|
2777
2759
|
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(O) {
|
|
2778
|
-
if (!
|
|
2779
|
-
return
|
|
2760
|
+
if (!m[O]) throw new Error("Table '".concat(O, "' not found"));
|
|
2761
|
+
return m[O];
|
|
2780
2762
|
}, MIN_KEY: -1 / 0, MAX_KEY: Ut(t), schema: v };
|
|
2781
2763
|
}
|
|
2782
2764
|
function ka(e, t, n, r) {
|
|
@@ -2827,12 +2809,12 @@ function Ai() {
|
|
|
2827
2809
|
return z.trans = s, z.transless = d, t !== 0 ? (fn(e, n), w = t, ((v = s).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(T) {
|
|
2828
2810
|
return T ?? w;
|
|
2829
2811
|
}) : G.resolve(w)).then(function(T) {
|
|
2830
|
-
return O = T, b = s, _ = n, A = [], T = (
|
|
2831
|
-
return
|
|
2832
|
-
})).length !== 0 ? (T.forEach(function(
|
|
2812
|
+
return O = T, b = s, _ = n, A = [], T = (m = e)._versions, x = m._dbSchema = pn(0, m.idbdb, _), (T = T.filter(function(I) {
|
|
2813
|
+
return I._cfg.version >= O;
|
|
2814
|
+
})).length !== 0 ? (T.forEach(function(I) {
|
|
2833
2815
|
A.push(function() {
|
|
2834
|
-
var S = x, P =
|
|
2835
|
-
|
|
2816
|
+
var S = x, P = I._cfg.dbschema;
|
|
2817
|
+
mn(m, S, _), mn(m, P, _), x = m._dbSchema = P;
|
|
2836
2818
|
var k = Vn(S, P);
|
|
2837
2819
|
k.add.forEach(function(V) {
|
|
2838
2820
|
Gn(_, V[0], V[1].primKey, V[1].indexes);
|
|
@@ -2847,13 +2829,13 @@ function Ai() {
|
|
|
2847
2829
|
return U.deleteIndex($);
|
|
2848
2830
|
});
|
|
2849
2831
|
});
|
|
2850
|
-
var M =
|
|
2851
|
-
if (M &&
|
|
2852
|
-
fn(
|
|
2853
|
-
var L =
|
|
2832
|
+
var M = I._cfg.contentUpgrade;
|
|
2833
|
+
if (M && I._cfg.version > O) {
|
|
2834
|
+
fn(m, _), b._memoizedTables = {};
|
|
2835
|
+
var L = De(P);
|
|
2854
2836
|
k.del.forEach(function(V) {
|
|
2855
2837
|
L[V] = S[V];
|
|
2856
|
-
}), Un(
|
|
2838
|
+
}), Un(m, [m.Transaction.prototype]), dn(m, [m.Transaction.prototype], y(L), L), b.schema = L;
|
|
2857
2839
|
var K, q = qe(M);
|
|
2858
2840
|
return q && Et(), k = G.follow(function() {
|
|
2859
2841
|
var V;
|
|
@@ -2863,21 +2845,21 @@ function Ai() {
|
|
|
2863
2845
|
});
|
|
2864
2846
|
}
|
|
2865
2847
|
}), A.push(function(S) {
|
|
2866
|
-
var P, k, M =
|
|
2848
|
+
var P, k, M = I._cfg.dbschema;
|
|
2867
2849
|
P = M, k = S, [].slice.call(k.db.objectStoreNames).forEach(function(L) {
|
|
2868
2850
|
return P[L] == null && k.db.deleteObjectStore(L);
|
|
2869
|
-
}), Un(
|
|
2851
|
+
}), Un(m, [m.Transaction.prototype]), dn(m, [m.Transaction.prototype], m._storeNames, m._dbSchema), b.schema = m._dbSchema;
|
|
2870
2852
|
}), A.push(function(S) {
|
|
2871
|
-
|
|
2853
|
+
m.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(m.idbdb.version / 10) === I._cfg.version ? (m.idbdb.deleteObjectStore("$meta"), delete m._dbSchema.$meta, m._storeNames = m._storeNames.filter(function(P) {
|
|
2872
2854
|
return P !== "$meta";
|
|
2873
|
-
})) : S.objectStore("$meta").put(
|
|
2855
|
+
})) : S.objectStore("$meta").put(I._cfg.version, "version"));
|
|
2874
2856
|
});
|
|
2875
|
-
}), (function
|
|
2876
|
-
return A.length ? G.resolve(A.shift()(b.idbtrans)).then(
|
|
2857
|
+
}), (function I() {
|
|
2858
|
+
return A.length ? G.resolve(A.shift()(b.idbtrans)).then(I) : G.resolve();
|
|
2877
2859
|
})().then(function() {
|
|
2878
2860
|
kr(x, _);
|
|
2879
2861
|
})) : G.resolve();
|
|
2880
|
-
var
|
|
2862
|
+
var m, O, b, _, A, x;
|
|
2881
2863
|
}).catch(f)) : (y(a).forEach(function(T) {
|
|
2882
2864
|
Gn(n, T, a[T].primKey, a[T].indexes);
|
|
2883
2865
|
}), fn(e, n), void G.follow(function() {
|
|
@@ -2888,8 +2870,8 @@ function Ai() {
|
|
|
2888
2870
|
}
|
|
2889
2871
|
function Ma(e, t) {
|
|
2890
2872
|
kr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
|
|
2891
|
-
var n =
|
|
2892
|
-
|
|
2873
|
+
var n = pn(0, e.idbdb, t);
|
|
2874
|
+
mn(e, e._dbSchema, t);
|
|
2893
2875
|
for (var r = 0, a = Vn(n, e._dbSchema).change; r < a.length; r++) {
|
|
2894
2876
|
var s = (function(f) {
|
|
2895
2877
|
if (f.change.length || f.recreate) return console.warn("Unable to patch indexes of table ".concat(f.name, " because it has changes on the type of index or primary key.")), { value: void 0 };
|
|
@@ -2913,8 +2895,8 @@ function Ai() {
|
|
|
2913
2895
|
var d = a.idxByName, v = s.idxByName, w = void 0;
|
|
2914
2896
|
for (w in d) v[w] || f.del.push(w);
|
|
2915
2897
|
for (w in v) {
|
|
2916
|
-
var T = d[w],
|
|
2917
|
-
T ? T.src !==
|
|
2898
|
+
var T = d[w], m = v[w];
|
|
2899
|
+
T ? T.src !== m.src && f.change.push(m) : f.add.push(m);
|
|
2918
2900
|
}
|
|
2919
2901
|
(0 < f.del.length || 0 < f.add.length || 0 < f.change.length) && r.change.push(f);
|
|
2920
2902
|
}
|
|
@@ -2936,7 +2918,7 @@ function Ai() {
|
|
|
2936
2918
|
function hn(e, t) {
|
|
2937
2919
|
e.createIndex(t.name, t.keyPath, { unique: t.unique, multiEntry: t.multi });
|
|
2938
2920
|
}
|
|
2939
|
-
function
|
|
2921
|
+
function pn(e, t, n) {
|
|
2940
2922
|
var r = {};
|
|
2941
2923
|
return Te(t.objectStoreNames, 0).forEach(function(a) {
|
|
2942
2924
|
for (var s = n.objectStore(a), f = Kn(Rr(w = s.keyPath), w || "", !0, !1, !!s.autoIncrement, w && typeof w != "string", !0), d = [], v = 0; v < s.indexNames.length; ++v) {
|
|
@@ -2946,7 +2928,7 @@ function Ai() {
|
|
|
2946
2928
|
r[a] = qn(a, f, d);
|
|
2947
2929
|
}), r;
|
|
2948
2930
|
}
|
|
2949
|
-
function
|
|
2931
|
+
function mn(e, t, n) {
|
|
2950
2932
|
for (var r = n.db.objectStoreNames, a = 0; a < r.length; ++a) {
|
|
2951
2933
|
var s = r[a], f = n.objectStore(s);
|
|
2952
2934
|
e._hasGetAll = "getAll" in f;
|
|
@@ -2955,7 +2937,7 @@ function Ai() {
|
|
|
2955
2937
|
!t[s] || (w = t[s].idxByName[T]) && (w.name = v, delete t[s].idxByName[T], t[s].idxByName[v] = w);
|
|
2956
2938
|
}
|
|
2957
2939
|
}
|
|
2958
|
-
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) &&
|
|
2940
|
+
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && p.WorkerGlobalScope && p instanceof p.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
2959
2941
|
}
|
|
2960
2942
|
function Fr(e) {
|
|
2961
2943
|
return e.split(",").map(function(t, n) {
|
|
@@ -3113,8 +3095,8 @@ function Ai() {
|
|
|
3113
3095
|
}
|
|
3114
3096
|
function Kr(e, t, n, r) {
|
|
3115
3097
|
for (var a = [], s = 0, f = Object.entries(e.queries.query); s < f.length; s++) {
|
|
3116
|
-
for (var d = f[s], v = d[0], w = [], T = 0,
|
|
3117
|
-
var O =
|
|
3098
|
+
for (var d = f[s], v = d[0], w = [], T = 0, m = d[1]; T < m.length; T++) {
|
|
3099
|
+
var O = m[T];
|
|
3118
3100
|
zn(t, O.obsSet) ? O.subscribers.forEach(function(x) {
|
|
3119
3101
|
return n.add(x);
|
|
3120
3102
|
}) : r && w.push(O);
|
|
@@ -3142,17 +3124,17 @@ function Ai() {
|
|
|
3142
3124
|
var _ = e.name, A = t.autoSchema || !a ? n.open(_) : n.open(_, a);
|
|
3143
3125
|
if (!A) throw new C.MissingAPI();
|
|
3144
3126
|
A.onerror = Ve(b), A.onblocked = ge(e._fireOnBlocked), A.onupgradeneeded = ge(function(x) {
|
|
3145
|
-
var
|
|
3146
|
-
T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (
|
|
3127
|
+
var I;
|
|
3128
|
+
T = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = qt, T.abort(), A.result.close(), (I = n.deleteDatabase(_)).onsuccess = I.onerror = ge(function() {
|
|
3147
3129
|
b(new C.NoSuchDatabase("Database ".concat(_, " doesnt exist")));
|
|
3148
|
-
})) : (T.onerror = Ve(b), x = x.oldVersion > Math.pow(2, 62) ? 0 : x.oldVersion,
|
|
3130
|
+
})) : (T.onerror = Ve(b), x = x.oldVersion > Math.pow(2, 62) ? 0 : x.oldVersion, m = x < 1, e.idbdb = A.result, s && Ma(e, T), Ba(e, x / 10, T, b));
|
|
3149
3131
|
}, b), A.onsuccess = ge(function() {
|
|
3150
3132
|
T = null;
|
|
3151
|
-
var x,
|
|
3133
|
+
var x, I, S, P, k, M = e.idbdb = A.result, L = Te(M.objectStoreNames);
|
|
3152
3134
|
if (0 < L.length) try {
|
|
3153
3135
|
var K = M.transaction((P = L).length === 1 ? P[0] : P, "readonly");
|
|
3154
|
-
if (t.autoSchema)
|
|
3155
|
-
else if (
|
|
3136
|
+
if (t.autoSchema) I = M, S = K, (x = e).verno = I.version / 10, S = x._dbSchema = pn(0, I, S), x._storeNames = Te(I.objectStoreNames, 0), dn(x, [x._allTables], y(S), S);
|
|
3137
|
+
else if (mn(e, e._dbSchema, K), ((k = Vn(pn(0, (k = e).idbdb, K), k._dbSchema)).add.length || k.change.some(function(q) {
|
|
3156
3138
|
return q.add.length || q.change.length;
|
|
3157
3139
|
})) && !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."), M.close(), a = M.version + 1, s = !0, O(d());
|
|
3158
3140
|
fn(e, K);
|
|
@@ -3162,7 +3144,7 @@ function Ai() {
|
|
|
3162
3144
|
t.vcFired = !0, e.on("versionchange").fire(q);
|
|
3163
3145
|
}), M.onclose = ge(function(q) {
|
|
3164
3146
|
e.on("close").fire(q);
|
|
3165
|
-
}),
|
|
3147
|
+
}), m && (k = e._deps, K = _, M = k.indexedDB, k = k.IDBKeyRange, Xn(M) || K === an || $n(M, k).put({ name: K }).catch(Q)), O();
|
|
3166
3148
|
}, b);
|
|
3167
3149
|
}).catch(function(O) {
|
|
3168
3150
|
switch (O?.name) {
|
|
@@ -3175,7 +3157,7 @@ function Ai() {
|
|
|
3175
3157
|
return G.reject(O);
|
|
3176
3158
|
});
|
|
3177
3159
|
}
|
|
3178
|
-
var v, w = t.dbReadyResolve, T = null,
|
|
3160
|
+
var v, w = t.dbReadyResolve, T = null, m = !1;
|
|
3179
3161
|
return G.race([r, (typeof navigator > "u" ? G.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(O) {
|
|
3180
3162
|
function b() {
|
|
3181
3163
|
return indexedDB.databases().finally(O);
|
|
@@ -3207,7 +3189,7 @@ function Ai() {
|
|
|
3207
3189
|
t.openComplete = !0, w();
|
|
3208
3190
|
}).then(function() {
|
|
3209
3191
|
var O;
|
|
3210
|
-
return
|
|
3192
|
+
return m && (O = {}, e.tables.forEach(function(b) {
|
|
3211
3193
|
b.schema.indexes.forEach(function(_) {
|
|
3212
3194
|
_.name && (O["idb://".concat(e.name, "/").concat(b.name, "/").concat(_.name)] = new Oe(-1 / 0, [[[]]]));
|
|
3213
3195
|
}), O["idb://".concat(e.name, "/").concat(b.name, "/")] = O["idb://".concat(e.name, "/").concat(b.name, "/:dels")] = new Oe(-1 / 0, [[[]]]);
|
|
@@ -3236,44 +3218,44 @@ function Ai() {
|
|
|
3236
3218
|
var qa = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
3237
3219
|
return i(i({}, e), { table: function(t) {
|
|
3238
3220
|
var n = e.table(t), r = n.schema, a = {}, s = [];
|
|
3239
|
-
function f(
|
|
3240
|
-
var _ = Vt(
|
|
3241
|
-
return A.push(
|
|
3221
|
+
function f(m, O, b) {
|
|
3222
|
+
var _ = Vt(m), A = a[_] = a[_] || [], x = m == null ? 0 : typeof m == "string" ? 1 : m.length, I = 0 < O, I = i(i({}, b), { name: I ? "".concat(_, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: I, keyTail: O, keyLength: x, extractKey: Ln(m), unique: !I && b.unique });
|
|
3223
|
+
return A.push(I), I.isPrimaryKey || s.push(I), 1 < x && f(x === 2 ? m[0] : m.slice(0, x - 1), O + 1, b), A.sort(function(S, P) {
|
|
3242
3224
|
return S.keyTail - P.keyTail;
|
|
3243
|
-
}),
|
|
3225
|
+
}), I;
|
|
3244
3226
|
}
|
|
3245
3227
|
t = f(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
|
|
3246
3228
|
for (var d = 0, v = r.indexes; d < v.length; d++) {
|
|
3247
3229
|
var w = v[d];
|
|
3248
3230
|
f(w.keyPath, 0, w);
|
|
3249
3231
|
}
|
|
3250
|
-
function T(
|
|
3251
|
-
var O, b =
|
|
3252
|
-
return b.isVirtual ? i(i({},
|
|
3232
|
+
function T(m) {
|
|
3233
|
+
var O, b = m.query.index;
|
|
3234
|
+
return b.isVirtual ? i(i({}, m), { query: { index: b.lowLevelIndex, range: (O = m.query.range, b = b.keyTail, { type: O.type === 1 ? 2 : O.type, lower: bn(O.lower, O.lowerOpen ? e.MAX_KEY : e.MIN_KEY, b), lowerOpen: !0, upper: bn(O.upper, O.upperOpen ? e.MIN_KEY : e.MAX_KEY, b), upperOpen: !0 }) } }) : m;
|
|
3253
3235
|
}
|
|
3254
|
-
return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: s, getIndexByKeyPath: function(
|
|
3255
|
-
return (
|
|
3256
|
-
} }), count: function(
|
|
3257
|
-
return n.count(T(
|
|
3258
|
-
}, query: function(
|
|
3259
|
-
return n.query(T(
|
|
3260
|
-
}, openCursor: function(
|
|
3261
|
-
var O =
|
|
3262
|
-
return _ ? n.openCursor(T(
|
|
3263
|
-
return
|
|
3264
|
-
}) : n.openCursor(
|
|
3265
|
-
function x(
|
|
3266
|
-
return Object.create(
|
|
3267
|
-
S != null ?
|
|
3236
|
+
return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: s, getIndexByKeyPath: function(m) {
|
|
3237
|
+
return (m = a[Vt(m)]) && m[0];
|
|
3238
|
+
} }), count: function(m) {
|
|
3239
|
+
return n.count(T(m));
|
|
3240
|
+
}, query: function(m) {
|
|
3241
|
+
return n.query(T(m));
|
|
3242
|
+
}, openCursor: function(m) {
|
|
3243
|
+
var O = m.query.index, b = O.keyTail, _ = O.isVirtual, A = O.keyLength;
|
|
3244
|
+
return _ ? n.openCursor(T(m)).then(function(I) {
|
|
3245
|
+
return I && x(I);
|
|
3246
|
+
}) : n.openCursor(m);
|
|
3247
|
+
function x(I) {
|
|
3248
|
+
return Object.create(I, { continue: { value: function(S) {
|
|
3249
|
+
S != null ? I.continue(bn(S, m.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : m.unique ? I.continue(I.key.slice(0, A).concat(m.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : I.continue();
|
|
3268
3250
|
} }, continuePrimaryKey: { value: function(S, P) {
|
|
3269
|
-
|
|
3251
|
+
I.continuePrimaryKey(bn(S, e.MAX_KEY, b), P);
|
|
3270
3252
|
} }, primaryKey: { get: function() {
|
|
3271
|
-
return
|
|
3253
|
+
return I.primaryKey;
|
|
3272
3254
|
} }, key: { get: function() {
|
|
3273
|
-
var S =
|
|
3255
|
+
var S = I.key;
|
|
3274
3256
|
return A === 1 ? S[0] : S.slice(0, A);
|
|
3275
3257
|
} }, value: { get: function() {
|
|
3276
|
-
return
|
|
3258
|
+
return I.value;
|
|
3277
3259
|
} } });
|
|
3278
3260
|
}
|
|
3279
3261
|
} });
|
|
@@ -3314,31 +3296,31 @@ function Ai() {
|
|
|
3314
3296
|
case "deleteRange":
|
|
3315
3297
|
if (d.fire === Q) break;
|
|
3316
3298
|
return s._promise("readwrite", function() {
|
|
3317
|
-
return (function
|
|
3299
|
+
return (function m(O, b, _) {
|
|
3318
3300
|
return n.query({ trans: O, values: !1, query: { index: r, range: b }, limit: _ }).then(function(A) {
|
|
3319
3301
|
var x = A.result;
|
|
3320
|
-
return T({ type: "delete", keys: x, trans: O }).then(function(
|
|
3321
|
-
return 0 <
|
|
3302
|
+
return T({ type: "delete", keys: x, trans: O }).then(function(I) {
|
|
3303
|
+
return 0 < I.numFailures ? Promise.reject(I.failures[0]) : x.length < _ ? { failures: [], numFailures: 0, lastResult: void 0 } : m(O, i(i({}, b), { lower: x[x.length - 1], lowerOpen: !0 }), _);
|
|
3322
3304
|
});
|
|
3323
3305
|
});
|
|
3324
3306
|
})(a.trans, a.range, 1e4);
|
|
3325
3307
|
}, !0);
|
|
3326
3308
|
}
|
|
3327
3309
|
return n.mutate(a);
|
|
3328
|
-
function T(
|
|
3329
|
-
var O, b, _, A = z.trans, x =
|
|
3310
|
+
function T(m) {
|
|
3311
|
+
var O, b, _, A = z.trans, x = m.keys || tr(r, m);
|
|
3330
3312
|
if (!x) throw new Error("Keys missing");
|
|
3331
|
-
return (
|
|
3313
|
+
return (m = m.type === "add" || m.type === "put" ? i(i({}, m), { keys: x }) : i({}, m)).type !== "delete" && (m.values = h([], m.values)), m.keys && (m.keys = h([], m.keys)), O = n, _ = x, ((b = m).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: _, cache: "immutable" })).then(function(I) {
|
|
3332
3314
|
var S = x.map(function(P, k) {
|
|
3333
|
-
var M, L, K, q =
|
|
3334
|
-
return
|
|
3315
|
+
var M, L, K, q = I[k], V = { onerror: null, onsuccess: null };
|
|
3316
|
+
return m.type === "delete" ? d.fire.call(V, P, q, A) : m.type === "add" || q === void 0 ? (M = v.fire.call(V, P, m.values[k], A), P == null && M != null && (m.keys[k] = P = M, r.outbound || ne(m.values[k], r.keyPath, P))) : (M = er(q, m.values[k]), (L = w.fire.call(V, M, P, q, A)) && (K = m.values[k], Object.keys(L).forEach(function(U) {
|
|
3335
3317
|
W(K, U) ? K[U] = L[U] : ne(K, U, L[U]);
|
|
3336
3318
|
}))), V;
|
|
3337
3319
|
});
|
|
3338
|
-
return n.mutate(
|
|
3320
|
+
return n.mutate(m).then(function(P) {
|
|
3339
3321
|
for (var k = P.failures, M = P.results, L = P.numFailures, P = P.lastResult, K = 0; K < x.length; ++K) {
|
|
3340
3322
|
var q = (M || x)[K], V = S[K];
|
|
3341
|
-
q == null ? V.onerror && V.onerror(k[K]) : V.onsuccess && V.onsuccess(
|
|
3323
|
+
q == null ? V.onerror && V.onerror(k[K]) : V.onsuccess && V.onsuccess(m.type === "put" && I[K] ? m.values[K] : q);
|
|
3342
3324
|
}
|
|
3343
3325
|
return { failures: k, results: M, numFailures: L, lastResult: P };
|
|
3344
3326
|
}).catch(function(P) {
|
|
@@ -3394,16 +3376,16 @@ function Ai() {
|
|
|
3394
3376
|
if (z.subscr && a !== "readonly") throw new C.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(z.querier));
|
|
3395
3377
|
return e.transaction(r, a, s);
|
|
3396
3378
|
}, table: function(r) {
|
|
3397
|
-
var a = e.table(r), s = a.schema, f = s.primaryKey,
|
|
3379
|
+
var a = e.table(r), s = a.schema, f = s.primaryKey, m = s.indexes, d = f.extractKey, v = f.outbound, w = f.autoIncrement && m.filter(function(b) {
|
|
3398
3380
|
return b.compound && b.keyPath.includes(f.keyPath);
|
|
3399
3381
|
}), T = i(i({}, a), { mutate: function(b) {
|
|
3400
3382
|
function _(U) {
|
|
3401
3383
|
return U = "idb://".concat(t, "/").concat(r, "/").concat(U), P[U] || (P[U] = new Oe());
|
|
3402
3384
|
}
|
|
3403
|
-
var A, x,
|
|
3385
|
+
var A, x, I, S = b.trans, P = b.mutatedParts || (b.mutatedParts = {}), k = _(""), M = _(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [tr(f, b).filter(function(U) {
|
|
3404
3386
|
return U;
|
|
3405
3387
|
}), b.values] : [], K = V[0], q = V[1], V = b.trans._cache;
|
|
3406
|
-
return N(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? qr(K, V) : null) || M.addKeys(K), (V || q) && (A = _, x = V,
|
|
3388
|
+
return N(K) ? (k.addKeys(K), (V = L === "delete" || K.length === q.length ? qr(K, V) : null) || M.addKeys(K), (V || q) && (A = _, x = V, I = q, s.indexes.forEach(function(U) {
|
|
3407
3389
|
var $ = A(U.name || "");
|
|
3408
3390
|
function te(Z) {
|
|
3409
3391
|
return Z != null ? U.extractKey(Z) : null;
|
|
@@ -3413,8 +3395,8 @@ function Ai() {
|
|
|
3413
3395
|
return $.addKey(ve);
|
|
3414
3396
|
}) : $.addKey(Z);
|
|
3415
3397
|
}
|
|
3416
|
-
(x ||
|
|
3417
|
-
var H = x && te(x[Ce]), Ce =
|
|
3398
|
+
(x || I).forEach(function(Z, Ce) {
|
|
3399
|
+
var H = x && te(x[Ce]), Ce = I && te(I[Ce]);
|
|
3418
3400
|
re(H, Ce) !== 0 && (H != null && oe(H), Ce != null && oe(Ce));
|
|
3419
3401
|
});
|
|
3420
3402
|
}))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, M.add(q), k.add(q)) : (k.add(n), M.add(n), s.indexes.forEach(function(U) {
|
|
@@ -3429,20 +3411,20 @@ function Ai() {
|
|
|
3429
3411
|
_($.name).addKeys(te);
|
|
3430
3412
|
})), S.mutatedParts = yn(S.mutatedParts || {}, P), U;
|
|
3431
3413
|
});
|
|
3432
|
-
} }),
|
|
3414
|
+
} }), m = function(_) {
|
|
3433
3415
|
var A = _.query, _ = A.index, A = A.range;
|
|
3434
3416
|
return [_, new Oe((_ = A.lower) !== null && _ !== void 0 ? _ : e.MIN_KEY, (A = A.upper) !== null && A !== void 0 ? A : e.MAX_KEY)];
|
|
3435
3417
|
}, O = { get: function(b) {
|
|
3436
3418
|
return [f, new Oe(b.key)];
|
|
3437
3419
|
}, getMany: function(b) {
|
|
3438
3420
|
return [f, new Oe().addKeys(b.keys)];
|
|
3439
|
-
}, count:
|
|
3421
|
+
}, count: m, query: m, openCursor: m };
|
|
3440
3422
|
return y(O).forEach(function(b) {
|
|
3441
3423
|
T[b] = function(_) {
|
|
3442
|
-
var A = z.subscr, x = !!A,
|
|
3424
|
+
var A = z.subscr, x = !!A, I = Lr(z, a) && Ur(b, _) ? _.obsSet = {} : A;
|
|
3443
3425
|
if (x) {
|
|
3444
3426
|
var S = function(q) {
|
|
3445
|
-
return q = "idb://".concat(t, "/").concat(r, "/").concat(q),
|
|
3427
|
+
return q = "idb://".concat(t, "/").concat(r, "/").concat(q), I[q] || (I[q] = new Oe());
|
|
3446
3428
|
}, P = S(""), k = S(":dels"), A = O[b](_), x = A[0], A = A[1];
|
|
3447
3429
|
if ((b === "query" && x.isPrimaryKey && !_.values ? k : S(x.name || "")).add(A), !x.isPrimaryKey) {
|
|
3448
3430
|
if (b !== "count") {
|
|
@@ -3492,13 +3474,13 @@ function Ai() {
|
|
|
3492
3474
|
}
|
|
3493
3475
|
function Gr(e, t, O, r, a, s) {
|
|
3494
3476
|
if (!O || O.length === 0) return e;
|
|
3495
|
-
var f = t.query.index, d = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, T = f.extractKey,
|
|
3477
|
+
var f = t.query.index, d = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, T = f.extractKey, m = (f.lowLevelIndex || f).extractKey, O = O.reduce(function(b, _) {
|
|
3496
3478
|
var A = b, x = [];
|
|
3497
|
-
if (_.type === "add" || _.type === "put") for (var
|
|
3479
|
+
if (_.type === "add" || _.type === "put") for (var I = new Oe(), S = _.values.length - 1; 0 <= S; --S) {
|
|
3498
3480
|
var P, k = _.values[S], M = w(k);
|
|
3499
|
-
|
|
3481
|
+
I.hasKey(M) || (P = T(k), (d && N(P) ? P.some(function(U) {
|
|
3500
3482
|
return nr(U, v);
|
|
3501
|
-
}) : nr(P, v)) && (
|
|
3483
|
+
}) : nr(P, v)) && (I.addKey(M), x.push(k)));
|
|
3502
3484
|
}
|
|
3503
3485
|
switch (_.type) {
|
|
3504
3486
|
case "add":
|
|
@@ -3537,7 +3519,7 @@ function Ai() {
|
|
|
3537
3519
|
return A;
|
|
3538
3520
|
}, e);
|
|
3539
3521
|
return O === e ? e : (O.sort(function(b, _) {
|
|
3540
|
-
return re(
|
|
3522
|
+
return re(m(b), m(_)) || re(w(b), w(_));
|
|
3541
3523
|
}), t.limit && t.limit < 1 / 0 && (O.length > t.limit ? O.length = t.limit : e.length === t.limit && O.length < t.limit && (a.dirty = !0)), s ? Object.freeze(O) : O);
|
|
3542
3524
|
}
|
|
3543
3525
|
function $r(e, t) {
|
|
@@ -3579,13 +3561,13 @@ function Ai() {
|
|
|
3579
3561
|
return r === "readwrite" && (f = (s = new AbortController()).signal, a = function(v) {
|
|
3580
3562
|
return function() {
|
|
3581
3563
|
if (s.abort(), r === "readwrite") {
|
|
3582
|
-
for (var w = /* @__PURE__ */ new Set(), T = 0,
|
|
3583
|
-
var O =
|
|
3564
|
+
for (var w = /* @__PURE__ */ new Set(), T = 0, m = n; T < m.length; T++) {
|
|
3565
|
+
var O = m[T], b = gt["idb://".concat(t, "/").concat(O)];
|
|
3584
3566
|
if (b) {
|
|
3585
3567
|
var _ = e.table(O), A = b.optimisticOps.filter(function($) {
|
|
3586
3568
|
return $.trans === d;
|
|
3587
3569
|
});
|
|
3588
|
-
if (d._explicit && v && d.mutatedParts) for (var x = 0,
|
|
3570
|
+
if (d._explicit && v && d.mutatedParts) for (var x = 0, I = Object.values(b.queries.query); x < I.length; x++) for (var S = 0, P = (L = I[x]).slice(); S < P.length; S++) zn((K = P[S]).obsSet, d.mutatedParts) && (Xe(L, K), K.subscribers.forEach(function($) {
|
|
3589
3571
|
return w.add($);
|
|
3590
3572
|
}));
|
|
3591
3573
|
else if (0 < A.length) {
|
|
@@ -3619,9 +3601,9 @@ function Ai() {
|
|
|
3619
3601
|
}), f.catch(function() {
|
|
3620
3602
|
Xe(d.optimisticOps, s), s.mutatedParts && vn(s.mutatedParts);
|
|
3621
3603
|
})) : f.then(function(v) {
|
|
3622
|
-
var w = Vr(0, i(i({}, s), { values: s.values.map(function(T,
|
|
3604
|
+
var w = Vr(0, i(i({}, s), { values: s.values.map(function(T, m) {
|
|
3623
3605
|
var O;
|
|
3624
|
-
return v.failures[
|
|
3606
|
+
return v.failures[m] ? T : (T = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? ke(T) : i({}, T), ne(T, a.keyPath, v.results[m]), T);
|
|
3625
3607
|
}) }), v);
|
|
3626
3608
|
d.optimisticOps.push(w), queueMicrotask(function() {
|
|
3627
3609
|
return s.mutatedParts && vn(s.mutatedParts);
|
|
@@ -3629,36 +3611,36 @@ function Ai() {
|
|
|
3629
3611
|
}), f) : r.mutate(s);
|
|
3630
3612
|
}, query: function(s) {
|
|
3631
3613
|
if (!Lr(z, r) || !Ur("query", s)) return r.query(s);
|
|
3632
|
-
var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable",
|
|
3614
|
+
var f = ((w = z.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", m = z, d = m.requery, v = m.signal, w = (function(_, A, x, I) {
|
|
3633
3615
|
var S = gt["idb://".concat(_, "/").concat(A)];
|
|
3634
3616
|
if (!S) return [];
|
|
3635
3617
|
if (!(A = S.queries[x])) return [null, !1, S, null];
|
|
3636
|
-
var P = A[(
|
|
3618
|
+
var P = A[(I.query ? I.query.index.name : null) || ""];
|
|
3637
3619
|
if (!P) return [null, !1, S, null];
|
|
3638
3620
|
switch (x) {
|
|
3639
3621
|
case "query":
|
|
3640
3622
|
var k = P.find(function(M) {
|
|
3641
|
-
return M.req.limit ===
|
|
3623
|
+
return M.req.limit === I.limit && M.req.values === I.values && $r(M.req.query.range, I.query.range);
|
|
3642
3624
|
});
|
|
3643
3625
|
return k ? [k, !0, S, P] : [P.find(function(M) {
|
|
3644
|
-
return ("limit" in M.req ? M.req.limit : 1 / 0) >=
|
|
3626
|
+
return ("limit" in M.req ? M.req.limit : 1 / 0) >= I.limit && (!I.values || M.req.values) && Ga(M.req.query.range, I.query.range);
|
|
3645
3627
|
}), !1, S, P];
|
|
3646
3628
|
case "count":
|
|
3647
3629
|
return k = P.find(function(M) {
|
|
3648
|
-
return $r(M.req.query.range,
|
|
3630
|
+
return $r(M.req.query.range, I.query.range);
|
|
3649
3631
|
}), [k, !!k, S, P];
|
|
3650
3632
|
}
|
|
3651
|
-
})(t, n, "query", s), T = w[0],
|
|
3652
|
-
return T &&
|
|
3633
|
+
})(t, n, "query", s), T = w[0], m = w[1], O = w[2], b = w[3];
|
|
3634
|
+
return T && m ? T.obsSet = s.obsSet : (m = r.query(s).then(function(_) {
|
|
3653
3635
|
var A = _.result;
|
|
3654
3636
|
if (T && (T.res = A), f) {
|
|
3655
|
-
for (var x = 0,
|
|
3637
|
+
for (var x = 0, I = A.length; x < I; ++x) Object.freeze(A[x]);
|
|
3656
3638
|
Object.freeze(A);
|
|
3657
3639
|
} else _.result = ke(A);
|
|
3658
3640
|
return _;
|
|
3659
3641
|
}).catch(function(_) {
|
|
3660
3642
|
return b && T && Xe(b, T), Promise.reject(_);
|
|
3661
|
-
}), T = { obsSet: s.obsSet, promise:
|
|
3643
|
+
}), T = { obsSet: s.obsSet, promise: m, subscribers: /* @__PURE__ */ new Set(), type: "query", req: s, dirty: !1 }, b ? b.push(T) : (b = [T], (O = O || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[s.query.index.name || ""] = b)), $a(T, b, d, v), T.promise.then(function(_) {
|
|
3662
3644
|
return { result: Gr(_.result, s, O?.optimisticOps, r, T, f) };
|
|
3663
3645
|
});
|
|
3664
3646
|
} });
|
|
@@ -3757,7 +3739,7 @@ function Ai() {
|
|
|
3757
3739
|
var a = arguments.length;
|
|
3758
3740
|
if (a < 2) throw new C.InvalidArgument("Too few arguments");
|
|
3759
3741
|
for (var s = new Array(a - 1); --a; ) s[a - 1] = arguments[a];
|
|
3760
|
-
return r = s.pop(), [t,
|
|
3742
|
+
return r = s.pop(), [t, It(s), r];
|
|
3761
3743
|
}).apply(this, arguments);
|
|
3762
3744
|
return this._transaction.apply(this, e);
|
|
3763
3745
|
}, we.prototype._transaction = function(e, t, n) {
|
|
@@ -3787,29 +3769,29 @@ function Ai() {
|
|
|
3787
3769
|
}), d && a && !a.active && (a = null);
|
|
3788
3770
|
}
|
|
3789
3771
|
} catch (w) {
|
|
3790
|
-
return a ? a._promise(null, function(T,
|
|
3791
|
-
|
|
3772
|
+
return a ? a._promise(null, function(T, m) {
|
|
3773
|
+
m(w);
|
|
3792
3774
|
}) : be(w);
|
|
3793
3775
|
}
|
|
3794
|
-
var v = (function w(T,
|
|
3776
|
+
var v = (function w(T, m, O, b, _) {
|
|
3795
3777
|
return G.resolve().then(function() {
|
|
3796
|
-
var A = z.transless || z, x = T._createTransaction(
|
|
3778
|
+
var A = z.transless || z, x = T._createTransaction(m, O, T._dbSchema, b);
|
|
3797
3779
|
if (x.explicit = !0, A = { trans: x, transless: A }, b) x.idbtrans = b.idbtrans;
|
|
3798
3780
|
else try {
|
|
3799
3781
|
x.create(), x.idbtrans._explicit = !0, T._state.PR1398_maxLoop = 3;
|
|
3800
3782
|
} catch (P) {
|
|
3801
3783
|
return P.name === l.InvalidState && T.isOpen() && 0 < --T._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), T.close({ disableAutoOpen: !1 }), T.open().then(function() {
|
|
3802
|
-
return w(T,
|
|
3784
|
+
return w(T, m, O, null, _);
|
|
3803
3785
|
})) : be(P);
|
|
3804
3786
|
}
|
|
3805
|
-
var
|
|
3787
|
+
var I, S = qe(_);
|
|
3806
3788
|
return S && Et(), A = G.follow(function() {
|
|
3807
3789
|
var P;
|
|
3808
|
-
(
|
|
3809
|
-
}, A), (
|
|
3790
|
+
(I = _.call(x, x)) && (S ? (P = at.bind(null, null), I.then(P, P)) : typeof I.next == "function" && typeof I.throw == "function" && (I = Jn(I)));
|
|
3791
|
+
}, A), (I && typeof I.then == "function" ? G.resolve(I).then(function(P) {
|
|
3810
3792
|
return x.active ? P : be(new C.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3811
3793
|
}) : A.then(function() {
|
|
3812
|
-
return
|
|
3794
|
+
return I;
|
|
3813
3795
|
})).then(function(P) {
|
|
3814
3796
|
return b && x._resolve(), x._completion.then(function() {
|
|
3815
3797
|
return P;
|
|
@@ -3832,26 +3814,26 @@ function Ai() {
|
|
|
3832
3814
|
var r = we.dependencies;
|
|
3833
3815
|
this._options = t = i({ addons: we.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
3834
3816
|
var a, s, f, d, v, w = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: Q, dbReadyPromise: null, cancelOpen: Q, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
3835
|
-
w.dbReadyPromise = new G(function(
|
|
3836
|
-
w.dbReadyResolve =
|
|
3837
|
-
}), w.openCanceller = new G(function(
|
|
3817
|
+
w.dbReadyPromise = new G(function(m) {
|
|
3818
|
+
w.dbReadyResolve = m;
|
|
3819
|
+
}), w.openCanceller = new G(function(m, O) {
|
|
3838
3820
|
w.cancelOpen = O;
|
|
3839
|
-
}), this._state = w, this.name = e, this.on = Mt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(
|
|
3821
|
+
}), this._state = w, this.name = e, this.on = Mt(this, "populate", "blocked", "versionchange", "close", { ready: [wt, Q] }), this.once = function(m, O) {
|
|
3840
3822
|
var b = function() {
|
|
3841
3823
|
for (var _ = [], A = 0; A < arguments.length; A++) _[A] = arguments[A];
|
|
3842
|
-
n.on(
|
|
3824
|
+
n.on(m).unsubscribe(b), O.apply(n, _);
|
|
3843
3825
|
};
|
|
3844
|
-
return n.on(
|
|
3845
|
-
}, this.on.ready.subscribe = ee(this.on.ready.subscribe, function(
|
|
3826
|
+
return n.on(m, b);
|
|
3827
|
+
}, this.on.ready.subscribe = ee(this.on.ready.subscribe, function(m) {
|
|
3846
3828
|
return function(O, b) {
|
|
3847
3829
|
we.vip(function() {
|
|
3848
3830
|
var _, A = n._state;
|
|
3849
|
-
A.openComplete ? (A.dbOpenError || G.resolve().then(O), b &&
|
|
3831
|
+
A.openComplete ? (A.dbOpenError || G.resolve().then(O), b && m(O)) : A.onReadyBeingFired ? (A.onReadyBeingFired.push(O), b && m(O)) : (m(O), _ = n, b || m(function x() {
|
|
3850
3832
|
_.on.ready.unsubscribe(O), _.on.ready.unsubscribe(x);
|
|
3851
3833
|
}));
|
|
3852
3834
|
});
|
|
3853
3835
|
};
|
|
3854
|
-
}), this.Collection = (a = this, jt(Ca.prototype, function(
|
|
3836
|
+
}), this.Collection = (a = this, jt(Ca.prototype, function(I, x) {
|
|
3855
3837
|
this.db = a;
|
|
3856
3838
|
var b = _r, _ = null;
|
|
3857
3839
|
if (x) try {
|
|
@@ -3859,61 +3841,61 @@ function Ai() {
|
|
|
3859
3841
|
} catch (S) {
|
|
3860
3842
|
_ = S;
|
|
3861
3843
|
}
|
|
3862
|
-
var A =
|
|
3863
|
-
this._ctx = { table: x, index: A.index, isPrimKey: !A.index || x.schema.primKey.keyPath && A.index === x.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: _, or: A.or, valueMapper:
|
|
3864
|
-
})), this.Table = (s = this, jt(Nr.prototype, function(
|
|
3865
|
-
this.db = s, this._tx = b, this.name =
|
|
3866
|
-
})), this.Transaction = (f = this, jt(Sa.prototype, function(
|
|
3844
|
+
var A = I._ctx, x = A.table, I = x.hook.reading.fire;
|
|
3845
|
+
this._ctx = { table: x, index: A.index, isPrimKey: !A.index || x.schema.primKey.keyPath && A.index === x.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: _, or: A.or, valueMapper: I !== he ? I : null };
|
|
3846
|
+
})), this.Table = (s = this, jt(Nr.prototype, function(m, O, b) {
|
|
3847
|
+
this.db = s, this._tx = b, this.name = m, this.schema = O, this.hook = s._allTables[m] ? s._allTables[m].hook : Mt(null, { creating: [tt, Q], reading: [Ae, he], updating: [Le, Q], deleting: [_e, Q] });
|
|
3848
|
+
})), this.Transaction = (f = this, jt(Sa.prototype, function(m, O, b, _, A) {
|
|
3867
3849
|
var x = this;
|
|
3868
|
-
|
|
3869
|
-
|
|
3850
|
+
m !== "readonly" && O.forEach(function(I) {
|
|
3851
|
+
I = (I = b[I]) === null || I === void 0 ? void 0 : I.yProps, I && (O = O.concat(I.map(function(S) {
|
|
3870
3852
|
return S.updatesTable;
|
|
3871
3853
|
})));
|
|
3872
|
-
}), this.db = f, this.mode =
|
|
3873
|
-
x._resolve =
|
|
3854
|
+
}), this.db = f, this.mode = m, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = _, this.idbtrans = null, this.on = Mt(this, "complete", "error", "abort"), this.parent = A || 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 G(function(I, S) {
|
|
3855
|
+
x._resolve = I, x._reject = S;
|
|
3874
3856
|
}), this._completion.then(function() {
|
|
3875
3857
|
x.active = !1, x.on.complete.fire();
|
|
3876
|
-
}, function(
|
|
3858
|
+
}, function(I) {
|
|
3877
3859
|
var S = x.active;
|
|
3878
|
-
return x.active = !1, x.on.error.fire(
|
|
3860
|
+
return x.active = !1, x.on.error.fire(I), x.parent ? x.parent._reject(I) : S && x.idbtrans && x.idbtrans.abort(), be(I);
|
|
3879
3861
|
});
|
|
3880
|
-
})), this.Version = (d = this, jt(ja.prototype, function(
|
|
3881
|
-
this.db = d, this._cfg = { version:
|
|
3882
|
-
})), this.WhereClause = (v = this, jt(Sr.prototype, function(
|
|
3883
|
-
if (this.db = v, this._ctx = { table:
|
|
3862
|
+
})), this.Version = (d = this, jt(ja.prototype, function(m) {
|
|
3863
|
+
this.db = d, this._cfg = { version: m, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
3864
|
+
})), this.WhereClause = (v = this, jt(Sr.prototype, function(m, O, b) {
|
|
3865
|
+
if (this.db = v, this._ctx = { table: m, index: O === ":id" ? null : O, or: b }, this._cmp = this._ascending = re, this._descending = function(_, A) {
|
|
3884
3866
|
return re(A, _);
|
|
3885
3867
|
}, this._max = function(_, A) {
|
|
3886
3868
|
return 0 < re(_, A) ? _ : A;
|
|
3887
3869
|
}, this._min = function(_, A) {
|
|
3888
3870
|
return re(_, A) < 0 ? _ : A;
|
|
3889
3871
|
}, this._IDBKeyRange = v._deps.IDBKeyRange, !this._IDBKeyRange) throw new C.MissingAPI();
|
|
3890
|
-
})), this.on("versionchange", function(
|
|
3891
|
-
0 <
|
|
3892
|
-
}), this.on("blocked", function(
|
|
3893
|
-
!
|
|
3894
|
-
}), this._maxKey = Ut(t.IDBKeyRange), this._createTransaction = function(
|
|
3895
|
-
return new n.Transaction(
|
|
3896
|
-
}, this._fireOnBlocked = function(
|
|
3897
|
-
n.on("blocked").fire(
|
|
3872
|
+
})), this.on("versionchange", function(m) {
|
|
3873
|
+
0 < m.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 });
|
|
3874
|
+
}), this.on("blocked", function(m) {
|
|
3875
|
+
!m.newVersion || m.newVersion < m.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(m.oldVersion / 10));
|
|
3876
|
+
}), this._maxKey = Ut(t.IDBKeyRange), this._createTransaction = function(m, O, b, _) {
|
|
3877
|
+
return new n.Transaction(m, O, b, n._options.chromeTransactionDurability, _);
|
|
3878
|
+
}, this._fireOnBlocked = function(m) {
|
|
3879
|
+
n.on("blocked").fire(m), xt.filter(function(O) {
|
|
3898
3880
|
return O.name === n.name && O !== n && !O._state.vcFired;
|
|
3899
3881
|
}).map(function(O) {
|
|
3900
|
-
return O.on("versionchange").fire(
|
|
3882
|
+
return O.on("versionchange").fire(m);
|
|
3901
3883
|
});
|
|
3902
3884
|
}, this.use(Ua), this.use(Xa), this.use(Va), this.use(qa), this.use(La);
|
|
3903
|
-
var T = new Proxy(this, { get: function(
|
|
3885
|
+
var T = new Proxy(this, { get: function(m, O, b) {
|
|
3904
3886
|
if (O === "_vip") return !0;
|
|
3905
3887
|
if (O === "table") return function(A) {
|
|
3906
3888
|
return wn(n.table(A), T);
|
|
3907
3889
|
};
|
|
3908
|
-
var _ = Reflect.get(
|
|
3890
|
+
var _ = Reflect.get(m, O, b);
|
|
3909
3891
|
return _ instanceof Nr ? wn(_, T) : O === "tables" ? _.map(function(A) {
|
|
3910
3892
|
return wn(A, T);
|
|
3911
3893
|
}) : O === "_createTransaction" ? function() {
|
|
3912
3894
|
return wn(_.apply(this, arguments), T);
|
|
3913
3895
|
} : _;
|
|
3914
3896
|
} });
|
|
3915
|
-
this.vip = T, r.forEach(function(
|
|
3916
|
-
return
|
|
3897
|
+
this.vip = T, r.forEach(function(m) {
|
|
3898
|
+
return m(n);
|
|
3917
3899
|
});
|
|
3918
3900
|
}
|
|
3919
3901
|
var _n, je = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", Wa = (rr.prototype.subscribe = function(e, t, n) {
|
|
@@ -3925,7 +3907,7 @@ function Ai() {
|
|
|
3925
3907
|
this._subscribe = e;
|
|
3926
3908
|
}
|
|
3927
3909
|
try {
|
|
3928
|
-
_n = { indexedDB:
|
|
3910
|
+
_n = { indexedDB: p.indexedDB || p.mozIndexedDB || p.webkitIndexedDB || p.msIndexedDB, IDBKeyRange: p.IDBKeyRange || p.webkitIDBKeyRange };
|
|
3929
3911
|
} catch {
|
|
3930
3912
|
_n = { indexedDB: null, IDBKeyRange: null };
|
|
3931
3913
|
}
|
|
@@ -3934,16 +3916,16 @@ function Ai() {
|
|
|
3934
3916
|
var s = qe(e), f, d = !1, v = {}, w = {}, T = { get closed() {
|
|
3935
3917
|
return d;
|
|
3936
3918
|
}, unsubscribe: function() {
|
|
3937
|
-
d || (d = !0, f && f.abort(),
|
|
3919
|
+
d || (d = !0, f && f.abort(), m && st.storagemutated.unsubscribe(b));
|
|
3938
3920
|
} };
|
|
3939
3921
|
a.start && a.start(T);
|
|
3940
|
-
var
|
|
3922
|
+
var m = !1, O = function() {
|
|
3941
3923
|
return Pn(_);
|
|
3942
3924
|
}, b = function(A) {
|
|
3943
3925
|
yn(v, A), zn(w, v) && O();
|
|
3944
3926
|
}, _ = function() {
|
|
3945
|
-
var A, x,
|
|
3946
|
-
!d && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(),
|
|
3927
|
+
var A, x, I;
|
|
3928
|
+
!d && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(), I = (function(S) {
|
|
3947
3929
|
var P = _t();
|
|
3948
3930
|
try {
|
|
3949
3931
|
s && Et();
|
|
@@ -3952,11 +3934,11 @@ function Ai() {
|
|
|
3952
3934
|
} finally {
|
|
3953
3935
|
P && Tt();
|
|
3954
3936
|
}
|
|
3955
|
-
})(x = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(
|
|
3937
|
+
})(x = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(I).then(function(S) {
|
|
3956
3938
|
n = !0, t = S, d || x.signal.aborted || (v = {}, (function(P) {
|
|
3957
3939
|
for (var k in P) if (W(P, k)) return;
|
|
3958
3940
|
return 1;
|
|
3959
|
-
})(w = A) ||
|
|
3941
|
+
})(w = A) || m || (st(Lt, b), m = !0), Pn(function() {
|
|
3960
3942
|
return !d && a.next && a.next(S);
|
|
3961
3943
|
}));
|
|
3962
3944
|
}, function(S) {
|
|
@@ -4033,11 +4015,11 @@ function Ai() {
|
|
|
4033
4015
|
return Pe;
|
|
4034
4016
|
}, set: function(e) {
|
|
4035
4017
|
Rt(e);
|
|
4036
|
-
} }, derive: F, extend: R, props: J, override: ee, Events: Mt, on: st, liveQuery: Xr, extendObservabilitySet: yn, getByKeyPath:
|
|
4018
|
+
} }, derive: F, extend: R, props: J, override: ee, Events: Mt, on: st, liveQuery: Xr, extendObservabilitySet: yn, getByKeyPath: me, setByKeyPath: ne, delByKeyPath: function(e, t) {
|
|
4037
4019
|
typeof t == "string" ? ne(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
4038
4020
|
ne(e, n, void 0);
|
|
4039
4021
|
});
|
|
4040
|
-
}, shallowClone:
|
|
4022
|
+
}, shallowClone: De, deepClone: ke, getObjectDiff: er, cmp: re, asap: ae, minKey: -1 / 0, addons: [], connections: xt, errnames: l, dependencies: _n, cache: gt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
|
|
4041
4023
|
return parseInt(e);
|
|
4042
4024
|
}).reduce(function(e, t, n) {
|
|
4043
4025
|
return e + t / Math.pow(10, 2 * n);
|
|
@@ -4076,7 +4058,7 @@ function Ai() {
|
|
|
4076
4058
|
})(xn)), xn.exports;
|
|
4077
4059
|
}
|
|
4078
4060
|
var Oi = Ai();
|
|
4079
|
-
const lr = /* @__PURE__ */
|
|
4061
|
+
const lr = /* @__PURE__ */ ma(Oi), Qr = /* @__PURE__ */ Symbol.for("Dexie"), Qe = globalThis[Qr] || (globalThis[Qr] = lr);
|
|
4080
4062
|
if (lr.semVer !== Qe.semVer)
|
|
4081
4063
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${lr.semVer} and ${Qe.semVer}`);
|
|
4082
4064
|
const {
|
|
@@ -4097,13 +4079,13 @@ class Ci {
|
|
|
4097
4079
|
this.name = u;
|
|
4098
4080
|
const { xmlElements: i, additionalTables: h } = c.database.tables;
|
|
4099
4081
|
this.tableName = i.name, this.databaseInstance = new Qe(u);
|
|
4100
|
-
const
|
|
4082
|
+
const p = {
|
|
4101
4083
|
[i.name]: i.schema
|
|
4102
4084
|
};
|
|
4103
4085
|
if (h)
|
|
4104
4086
|
for (const [y, N] of Object.entries(h))
|
|
4105
|
-
|
|
4106
|
-
|
|
4087
|
+
p[y] = N.schema;
|
|
4088
|
+
p[Hr] = "++sequenceNumber, id", p[Zr] = "key", this.databaseInstance.version(1).stores(p);
|
|
4107
4089
|
}
|
|
4108
4090
|
async get(u) {
|
|
4109
4091
|
return this.databaseInstance.table(this.tableName).get(u);
|
|
@@ -4124,7 +4106,7 @@ class Ci {
|
|
|
4124
4106
|
await this.metaTable.put({ key: "head", value: u });
|
|
4125
4107
|
}
|
|
4126
4108
|
async commit(u) {
|
|
4127
|
-
const { creates: c, updates: i, deletes: h, onProgress:
|
|
4109
|
+
const { creates: c, updates: i, deletes: h, onProgress: p } = u, y = this.databaseInstance.table(this.tableName), N = c.length + i.length + h.length;
|
|
4128
4110
|
let R = 0;
|
|
4129
4111
|
try {
|
|
4130
4112
|
await this.databaseInstance.transaction(
|
|
@@ -4136,12 +4118,11 @@ class Ci {
|
|
|
4136
4118
|
const j = i.length > 0 ? await y.bulkGet(i.map((B) => B.id)) : [], X = h.length > 0 ? await y.bulkGet(h) : [];
|
|
4137
4119
|
if (c.length > 0)
|
|
4138
4120
|
try {
|
|
4139
|
-
await y.bulkAdd(c), R += c.length,
|
|
4121
|
+
await y.bulkAdd(c), R += c.length, p(R, N);
|
|
4140
4122
|
} catch (B) {
|
|
4141
4123
|
const F = this.extractFailedRecordFromError(B, c);
|
|
4142
4124
|
Me("STORE_BULK_ADD_FAILED", {
|
|
4143
4125
|
detail: B instanceof Error ? B.message : String(B),
|
|
4144
|
-
method: "commit.bulkAdd",
|
|
4145
4126
|
cause: B instanceof Error ? B : void 0,
|
|
4146
4127
|
...F && {
|
|
4147
4128
|
ref: { tagName: F.tagName, id: F.id }
|
|
@@ -4150,12 +4131,11 @@ class Ci {
|
|
|
4150
4131
|
}
|
|
4151
4132
|
if (i.length > 0)
|
|
4152
4133
|
try {
|
|
4153
|
-
await y.bulkPut(i), R += i.length,
|
|
4134
|
+
await y.bulkPut(i), R += i.length, p(R, N);
|
|
4154
4135
|
} catch (B) {
|
|
4155
4136
|
const F = this.extractFailedRecordFromError(B, i);
|
|
4156
4137
|
Me("STORE_BULK_UPDATE_FAILED", {
|
|
4157
4138
|
detail: B instanceof Error ? B.message : String(B),
|
|
4158
|
-
method: "commit.bulkPut",
|
|
4159
4139
|
cause: B instanceof Error ? B : void 0,
|
|
4160
4140
|
...F && {
|
|
4161
4141
|
ref: { tagName: F.tagName, id: F.id }
|
|
@@ -4164,11 +4144,10 @@ class Ci {
|
|
|
4164
4144
|
}
|
|
4165
4145
|
if (h.length > 0)
|
|
4166
4146
|
try {
|
|
4167
|
-
await y.bulkDelete(h), R += h.length,
|
|
4147
|
+
await y.bulkDelete(h), R += h.length, p(R, N);
|
|
4168
4148
|
} catch (B) {
|
|
4169
4149
|
Me("STORE_DELETE_FAILED", {
|
|
4170
4150
|
detail: B instanceof Error ? B.message : String(B),
|
|
4171
|
-
method: "commit.bulkDelete",
|
|
4172
4151
|
cause: B instanceof Error ? B : void 0
|
|
4173
4152
|
});
|
|
4174
4153
|
}
|
|
@@ -4195,7 +4174,6 @@ class Ci {
|
|
|
4195
4174
|
throw j;
|
|
4196
4175
|
Me("STORE_COMMIT_FAILED", {
|
|
4197
4176
|
detail: j instanceof Error ? j.message : String(j),
|
|
4198
|
-
method: "commit",
|
|
4199
4177
|
cause: j instanceof Error ? j : void 0
|
|
4200
4178
|
});
|
|
4201
4179
|
}
|
|
@@ -4205,7 +4183,7 @@ class Ci {
|
|
|
4205
4183
|
const i = u.failures;
|
|
4206
4184
|
if (i && i.length > 0) {
|
|
4207
4185
|
const h = i[0].key;
|
|
4208
|
-
return c.find((
|
|
4186
|
+
return c.find((p) => p.id === h);
|
|
4209
4187
|
}
|
|
4210
4188
|
}
|
|
4211
4189
|
return c[0];
|
|
@@ -4222,8 +4200,8 @@ class Ci {
|
|
|
4222
4200
|
return;
|
|
4223
4201
|
const i = this.databaseInstance.table(this.tableName);
|
|
4224
4202
|
await this.databaseInstance.transaction("rw", i, this.metaTable, async () => {
|
|
4225
|
-
const { creates: h, updates:
|
|
4226
|
-
h.length > 0 && await i.bulkDelete(h.map((N) => N.id)),
|
|
4203
|
+
const { creates: h, updates: p, deletes: y } = c.operations;
|
|
4204
|
+
h.length > 0 && await i.bulkDelete(h.map((N) => N.id)), p.length > 0 && await i.bulkPut(p.map((N) => N.before)), y.length > 0 && await i.bulkAdd(y), await this.setHead(u - 1);
|
|
4227
4205
|
});
|
|
4228
4206
|
}
|
|
4229
4207
|
async redo() {
|
|
@@ -4232,8 +4210,8 @@ class Ci {
|
|
|
4232
4210
|
return;
|
|
4233
4211
|
const h = this.databaseInstance.table(this.tableName);
|
|
4234
4212
|
await this.databaseInstance.transaction("rw", h, this.metaTable, async () => {
|
|
4235
|
-
const { creates:
|
|
4236
|
-
|
|
4213
|
+
const { creates: p, updates: y, deletes: N } = i.operations;
|
|
4214
|
+
p.length > 0 && await h.bulkAdd(p), y.length > 0 && await h.bulkPut(y.map((R) => R.after)), N.length > 0 && await h.bulkDelete(N.map((R) => R.id)), await this.setHead(c);
|
|
4237
4215
|
});
|
|
4238
4216
|
}
|
|
4239
4217
|
async getChangeLog() {
|
|
@@ -4249,26 +4227,26 @@ class Ci {
|
|
|
4249
4227
|
this.databaseInstance.isOpen() && (this.databaseInstance.close(), await new Promise((u) => setTimeout(u, 20))), await Qe.delete(this.databaseInstance.name);
|
|
4250
4228
|
}
|
|
4251
4229
|
}
|
|
4252
|
-
function
|
|
4253
|
-
const { databaseName: u, dialecteConfig: c } = g, { xmlElements: i, additionalTables: h } = c.database.tables,
|
|
4230
|
+
function Ii(g) {
|
|
4231
|
+
const { databaseName: u, dialecteConfig: c } = g, { xmlElements: i, additionalTables: h } = c.database.tables, p = new Qe(u), y = {
|
|
4254
4232
|
[i.name]: i.schema
|
|
4255
4233
|
};
|
|
4256
4234
|
if (h)
|
|
4257
4235
|
for (const [N, R] of Object.entries(h))
|
|
4258
4236
|
y[N] = R.schema;
|
|
4259
|
-
return
|
|
4237
|
+
return p.version(1).stores(y), p;
|
|
4260
4238
|
}
|
|
4261
4239
|
async function ga(g) {
|
|
4262
4240
|
const { databaseInstance: u, elementsTableName: c, records: i } = g, h = u.table(c);
|
|
4263
4241
|
await u.transaction("rw", h, () => h.bulkAdd(i));
|
|
4264
4242
|
}
|
|
4265
|
-
async function
|
|
4243
|
+
async function Di(g) {
|
|
4266
4244
|
const { databaseInstance: u, elementsTableName: c, updates: i } = g;
|
|
4267
4245
|
if (i.length === 0) return;
|
|
4268
4246
|
const h = u.table(c);
|
|
4269
4247
|
await u.transaction("rw", h, async () => {
|
|
4270
|
-
for (const { recordId:
|
|
4271
|
-
const N = await h.get(
|
|
4248
|
+
for (const { recordId: p, ...y } of i) {
|
|
4249
|
+
const N = await h.get(p);
|
|
4272
4250
|
if (!N) continue;
|
|
4273
4251
|
const R = { ...y };
|
|
4274
4252
|
if (y.attributes) {
|
|
@@ -4287,24 +4265,24 @@ async function Ii(g) {
|
|
|
4287
4265
|
}
|
|
4288
4266
|
R.children = j;
|
|
4289
4267
|
}
|
|
4290
|
-
await h.update(
|
|
4268
|
+
await h.update(p, R);
|
|
4291
4269
|
}
|
|
4292
4270
|
});
|
|
4293
4271
|
}
|
|
4294
|
-
async function
|
|
4272
|
+
async function Io(g) {
|
|
4295
4273
|
const { databaseInstance: u, elementsTableName: c, updates: i } = g;
|
|
4296
4274
|
if (i.length === 0) return;
|
|
4297
4275
|
const h = u.table(c);
|
|
4298
4276
|
await u.transaction("rw", h, async () => {
|
|
4299
|
-
for (const { recordId:
|
|
4300
|
-
const N = await h.get(
|
|
4277
|
+
for (const { recordId: p, attributes: y } of i) {
|
|
4278
|
+
const N = await h.get(p);
|
|
4301
4279
|
if (!N) continue;
|
|
4302
4280
|
const R = [...N.attributes];
|
|
4303
4281
|
for (const j of y) {
|
|
4304
4282
|
const X = R.findIndex((W) => W.name === j.name);
|
|
4305
4283
|
X >= 0 ? R[X] = j : R.push(j);
|
|
4306
4284
|
}
|
|
4307
|
-
await h.update(
|
|
4285
|
+
await h.update(p, { attributes: R });
|
|
4308
4286
|
}
|
|
4309
4287
|
});
|
|
4310
4288
|
}
|
|
@@ -4314,7 +4292,7 @@ async function Si(g) {
|
|
|
4314
4292
|
const h = u.table(c);
|
|
4315
4293
|
await u.transaction("rw", h, () => h.bulkDelete(i));
|
|
4316
4294
|
}
|
|
4317
|
-
async function
|
|
4295
|
+
async function Do(g) {
|
|
4318
4296
|
if (await Qe.exists(g))
|
|
4319
4297
|
return await Qe.delete(g);
|
|
4320
4298
|
}
|
|
@@ -4334,8 +4312,8 @@ function Pi(g) {
|
|
|
4334
4312
|
function ki(g) {
|
|
4335
4313
|
const { currentBatch: u } = g, c = [...u];
|
|
4336
4314
|
for (const [i, h] of c.entries()) {
|
|
4337
|
-
const
|
|
4338
|
-
|
|
4315
|
+
const p = Yt[h.id] || [];
|
|
4316
|
+
p.length > 0 && (c[i].children.push(...p), Fi({
|
|
4339
4317
|
parentId: h.id
|
|
4340
4318
|
}));
|
|
4341
4319
|
}
|
|
@@ -4395,7 +4373,7 @@ function Ki() {
|
|
|
4395
4373
|
if (!(this instanceof i))
|
|
4396
4374
|
return new i(l, o);
|
|
4397
4375
|
var C = this;
|
|
4398
|
-
|
|
4376
|
+
p(C), C.q = C.c = "", C.bufferCheckPosition = u.MAX_BUFFER_LENGTH, C.opt = o || {}, C.opt.lowercase = C.opt.lowercase || C.opt.lowercasetags, C.looseCase = C.opt.lowercase ? "toLowerCase" : "toUpperCase", C.opt.maxEntityCount = C.opt.maxEntityCount || 512, C.opt.maxEntityDepth = C.opt.maxEntityDepth || 4, C.entityCount = C.entityDepth = 0, C.tags = [], C.closed = C.closedRoot = C.sawRoot = !1, C.tag = C.error = null, C.strict = !!l, C.noscript = !!(l || C.opt.noscript), C.state = D.BEGIN, C.strictEntities = C.opt.strictEntities, C.ENTITIES = C.strictEntities ? Object.create(u.XML_ENTITIES) : Object.create(u.ENTITIES), C.attribList = [], C.opt.xmlns && (C.ns = Object.create(F)), C.opt.unquotedAttributeValues === void 0 && (C.opt.unquotedAttributeValues = !l), C.trackPosition = C.opt.position !== !1, C.trackPosition && (C.position = C.line = C.column = 0), He(C, "onready");
|
|
4399
4377
|
}
|
|
4400
4378
|
Object.create || (Object.create = function(l) {
|
|
4401
4379
|
function o() {
|
|
@@ -4430,7 +4408,7 @@ function Ki() {
|
|
|
4430
4408
|
var he = u.MAX_BUFFER_LENGTH - C;
|
|
4431
4409
|
l.bufferCheckPosition = he + l.position;
|
|
4432
4410
|
}
|
|
4433
|
-
function
|
|
4411
|
+
function p(l) {
|
|
4434
4412
|
for (var o = 0, C = c.length; o < C; o++)
|
|
4435
4413
|
l[c[o]] = "";
|
|
4436
4414
|
}
|
|
@@ -4518,88 +4496,88 @@ function Ki() {
|
|
|
4518
4496
|
function ae(l) {
|
|
4519
4497
|
return l === '"' || l === "'";
|
|
4520
4498
|
}
|
|
4521
|
-
function
|
|
4499
|
+
function me(l) {
|
|
4522
4500
|
return l === ">" || Y(l);
|
|
4523
4501
|
}
|
|
4524
4502
|
function ne(l, o) {
|
|
4525
4503
|
return l.test(o);
|
|
4526
4504
|
}
|
|
4527
|
-
function
|
|
4505
|
+
function De(l, o) {
|
|
4528
4506
|
return !ne(l, o);
|
|
4529
4507
|
}
|
|
4530
|
-
var
|
|
4508
|
+
var D = 0;
|
|
4531
4509
|
u.STATE = {
|
|
4532
|
-
BEGIN:
|
|
4510
|
+
BEGIN: D++,
|
|
4533
4511
|
// leading byte order mark or whitespace
|
|
4534
|
-
BEGIN_WHITESPACE:
|
|
4512
|
+
BEGIN_WHITESPACE: D++,
|
|
4535
4513
|
// leading whitespace
|
|
4536
|
-
TEXT:
|
|
4514
|
+
TEXT: D++,
|
|
4537
4515
|
// general stuff
|
|
4538
|
-
TEXT_ENTITY:
|
|
4516
|
+
TEXT_ENTITY: D++,
|
|
4539
4517
|
// & and such.
|
|
4540
|
-
OPEN_WAKA:
|
|
4518
|
+
OPEN_WAKA: D++,
|
|
4541
4519
|
// <
|
|
4542
|
-
SGML_DECL:
|
|
4520
|
+
SGML_DECL: D++,
|
|
4543
4521
|
// <!BLARG
|
|
4544
|
-
SGML_DECL_QUOTED:
|
|
4522
|
+
SGML_DECL_QUOTED: D++,
|
|
4545
4523
|
// <!BLARG foo "bar
|
|
4546
|
-
DOCTYPE:
|
|
4524
|
+
DOCTYPE: D++,
|
|
4547
4525
|
// <!DOCTYPE
|
|
4548
|
-
DOCTYPE_QUOTED:
|
|
4526
|
+
DOCTYPE_QUOTED: D++,
|
|
4549
4527
|
// <!DOCTYPE "//blah
|
|
4550
|
-
DOCTYPE_DTD:
|
|
4528
|
+
DOCTYPE_DTD: D++,
|
|
4551
4529
|
// <!DOCTYPE "//blah" [ ...
|
|
4552
|
-
DOCTYPE_DTD_QUOTED:
|
|
4530
|
+
DOCTYPE_DTD_QUOTED: D++,
|
|
4553
4531
|
// <!DOCTYPE "//blah" [ "foo
|
|
4554
|
-
COMMENT_STARTING:
|
|
4532
|
+
COMMENT_STARTING: D++,
|
|
4555
4533
|
// <!-
|
|
4556
|
-
COMMENT:
|
|
4534
|
+
COMMENT: D++,
|
|
4557
4535
|
// <!--
|
|
4558
|
-
COMMENT_ENDING:
|
|
4536
|
+
COMMENT_ENDING: D++,
|
|
4559
4537
|
// <!-- blah -
|
|
4560
|
-
COMMENT_ENDED:
|
|
4538
|
+
COMMENT_ENDED: D++,
|
|
4561
4539
|
// <!-- blah --
|
|
4562
|
-
CDATA:
|
|
4540
|
+
CDATA: D++,
|
|
4563
4541
|
// <![CDATA[ something
|
|
4564
|
-
CDATA_ENDING:
|
|
4542
|
+
CDATA_ENDING: D++,
|
|
4565
4543
|
// ]
|
|
4566
|
-
CDATA_ENDING_2:
|
|
4544
|
+
CDATA_ENDING_2: D++,
|
|
4567
4545
|
// ]]
|
|
4568
|
-
PROC_INST:
|
|
4546
|
+
PROC_INST: D++,
|
|
4569
4547
|
// <?hi
|
|
4570
|
-
PROC_INST_BODY:
|
|
4548
|
+
PROC_INST_BODY: D++,
|
|
4571
4549
|
// <?hi there
|
|
4572
|
-
PROC_INST_ENDING:
|
|
4550
|
+
PROC_INST_ENDING: D++,
|
|
4573
4551
|
// <?hi "there" ?
|
|
4574
|
-
OPEN_TAG:
|
|
4552
|
+
OPEN_TAG: D++,
|
|
4575
4553
|
// <strong
|
|
4576
|
-
OPEN_TAG_SLASH:
|
|
4554
|
+
OPEN_TAG_SLASH: D++,
|
|
4577
4555
|
// <strong /
|
|
4578
|
-
ATTRIB:
|
|
4556
|
+
ATTRIB: D++,
|
|
4579
4557
|
// <a
|
|
4580
|
-
ATTRIB_NAME:
|
|
4558
|
+
ATTRIB_NAME: D++,
|
|
4581
4559
|
// <a foo
|
|
4582
|
-
ATTRIB_NAME_SAW_WHITE:
|
|
4560
|
+
ATTRIB_NAME_SAW_WHITE: D++,
|
|
4583
4561
|
// <a foo _
|
|
4584
|
-
ATTRIB_VALUE:
|
|
4562
|
+
ATTRIB_VALUE: D++,
|
|
4585
4563
|
// <a foo=
|
|
4586
|
-
ATTRIB_VALUE_QUOTED:
|
|
4564
|
+
ATTRIB_VALUE_QUOTED: D++,
|
|
4587
4565
|
// <a foo="bar
|
|
4588
|
-
ATTRIB_VALUE_CLOSED:
|
|
4566
|
+
ATTRIB_VALUE_CLOSED: D++,
|
|
4589
4567
|
// <a foo="bar"
|
|
4590
|
-
ATTRIB_VALUE_UNQUOTED:
|
|
4568
|
+
ATTRIB_VALUE_UNQUOTED: D++,
|
|
4591
4569
|
// <a foo=bar
|
|
4592
|
-
ATTRIB_VALUE_ENTITY_Q:
|
|
4570
|
+
ATTRIB_VALUE_ENTITY_Q: D++,
|
|
4593
4571
|
// <foo bar="""
|
|
4594
|
-
ATTRIB_VALUE_ENTITY_U:
|
|
4572
|
+
ATTRIB_VALUE_ENTITY_U: D++,
|
|
4595
4573
|
// <foo bar="
|
|
4596
|
-
CLOSE_TAG:
|
|
4574
|
+
CLOSE_TAG: D++,
|
|
4597
4575
|
// </a
|
|
4598
|
-
CLOSE_TAG_SAW_WHITE:
|
|
4576
|
+
CLOSE_TAG_SAW_WHITE: D++,
|
|
4599
4577
|
// </a >
|
|
4600
|
-
SCRIPT:
|
|
4578
|
+
SCRIPT: D++,
|
|
4601
4579
|
// <script> ...
|
|
4602
|
-
SCRIPT_ENDING:
|
|
4580
|
+
SCRIPT_ENDING: D++
|
|
4603
4581
|
// <script> ... <
|
|
4604
4582
|
}, u.XML_ENTITIES = {
|
|
4605
4583
|
amp: "&",
|
|
@@ -4865,9 +4843,9 @@ function Ki() {
|
|
|
4865
4843
|
var o = u.ENTITIES[l], C = typeof o == "number" ? String.fromCharCode(o) : o;
|
|
4866
4844
|
u.ENTITIES[l] = C;
|
|
4867
4845
|
});
|
|
4868
|
-
for (var
|
|
4869
|
-
u.STATE[u.STATE[
|
|
4870
|
-
|
|
4846
|
+
for (var It in u.STATE)
|
|
4847
|
+
u.STATE[u.STATE[It]] = It;
|
|
4848
|
+
D = u.STATE;
|
|
4871
4849
|
function He(l, o, C) {
|
|
4872
4850
|
l[o] && l[o](C);
|
|
4873
4851
|
}
|
|
@@ -4887,7 +4865,7 @@ Column: ` + l.column + `
|
|
|
4887
4865
|
Char: ` + l.c), o = new Error(o), l.error = o, He(l, "onerror", o), l;
|
|
4888
4866
|
}
|
|
4889
4867
|
function bt(l) {
|
|
4890
|
-
return l.sawRoot && !l.closedRoot && le(l, "Unclosed root tag"), l.state !==
|
|
4868
|
+
return l.sawRoot && !l.closedRoot && le(l, "Unclosed root tag"), l.state !== D.BEGIN && l.state !== D.BEGIN_WHITESPACE && l.state !== D.TEXT && Ke(l, "Unexpected end"), ke(l), l.c = "", l.closed = !0, He(l, "onend"), i.call(l, l.strict, l.opt), l;
|
|
4891
4869
|
}
|
|
4892
4870
|
function le(l, o) {
|
|
4893
4871
|
if (typeof l != "object" || !(l instanceof i))
|
|
@@ -4964,16 +4942,16 @@ Actual: ` + l.attribValue
|
|
|
4964
4942
|
}
|
|
4965
4943
|
l.attribList.length = 0;
|
|
4966
4944
|
}
|
|
4967
|
-
l.tag.isSelfClosing = !!o, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), o || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state =
|
|
4945
|
+
l.tag.isSelfClosing = !!o, l.sawRoot = !0, l.tags.push(l.tag), de(l, "onopentag", l.tag), o || (!l.noscript && l.tagName.toLowerCase() === "script" ? l.state = D.SCRIPT : l.state = D.TEXT, l.tag = null, l.tagName = ""), l.attribName = l.attribValue = "", l.attribList.length = 0;
|
|
4968
4946
|
}
|
|
4969
|
-
function
|
|
4947
|
+
function Dt(l) {
|
|
4970
4948
|
if (!l.tagName) {
|
|
4971
|
-
le(l, "Weird empty close tag."), l.textNode += "</>", l.state =
|
|
4949
|
+
le(l, "Weird empty close tag."), l.textNode += "</>", l.state = D.TEXT;
|
|
4972
4950
|
return;
|
|
4973
4951
|
}
|
|
4974
4952
|
if (l.script) {
|
|
4975
4953
|
if (l.tagName !== "script") {
|
|
4976
|
-
l.script += "</" + l.tagName + ">", l.tagName = "", l.state =
|
|
4954
|
+
l.script += "</" + l.tagName + ">", l.tagName = "", l.state = D.SCRIPT;
|
|
4977
4955
|
return;
|
|
4978
4956
|
}
|
|
4979
4957
|
de(l, "onscript", l.script), l.script = "";
|
|
@@ -4988,7 +4966,7 @@ Actual: ` + l.attribValue
|
|
|
4988
4966
|
break;
|
|
4989
4967
|
}
|
|
4990
4968
|
if (o < 0) {
|
|
4991
|
-
le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state =
|
|
4969
|
+
le(l, "Unmatched closing tag: " + l.tagName), l.textNode += "</" + l.tagName + ">", l.state = D.TEXT;
|
|
4992
4970
|
return;
|
|
4993
4971
|
}
|
|
4994
4972
|
l.tagName = C;
|
|
@@ -5004,14 +4982,14 @@ Actual: ` + l.attribValue
|
|
|
5004
4982
|
de(l, "onclosenamespace", { prefix: _e, uri: Le });
|
|
5005
4983
|
});
|
|
5006
4984
|
}
|
|
5007
|
-
o === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state =
|
|
4985
|
+
o === 0 && (l.closedRoot = !0), l.tagName = l.attribValue = l.attribName = "", l.attribList.length = 0, l.state = D.TEXT;
|
|
5008
4986
|
}
|
|
5009
4987
|
function Ze(l) {
|
|
5010
4988
|
var o = l.entity, C = o.toLowerCase(), E, ie = "";
|
|
5011
4989
|
return l.ENTITIES[o] ? l.ENTITIES[o] : l.ENTITIES[C] ? l.ENTITIES[C] : (o = C, o.charAt(0) === "#" && (o.charAt(1) === "x" ? (o = o.slice(2), E = parseInt(o, 16), ie = E.toString(16)) : (o = o.slice(1), E = parseInt(o, 10), ie = E.toString(10))), o = o.replace(/^0+/, ""), isNaN(E) || ie.toLowerCase() !== o || E < 0 || E > 1114111 ? (le(l, "Invalid character entity"), "&" + l.entity + ";") : String.fromCodePoint(E));
|
|
5012
4990
|
}
|
|
5013
4991
|
function St(l, o) {
|
|
5014
|
-
o === "<" ? (l.state =
|
|
4992
|
+
o === "<" ? (l.state = D.OPEN_WAKA, l.startTagPosition = l.position) : Y(o) || (le(l, "Non-whitespace before first tag."), l.textNode = o, l.state = D.TEXT);
|
|
5015
4993
|
}
|
|
5016
4994
|
function Je(l, o) {
|
|
5017
4995
|
var C = "";
|
|
@@ -5032,184 +5010,184 @@ Actual: ` + l.attribValue
|
|
|
5032
5010
|
for (var C = 0, E = ""; E = Je(l, C++), o.c = E, !!E; )
|
|
5033
5011
|
switch (o.trackPosition && (o.position++, E === `
|
|
5034
5012
|
` ? (o.line++, o.column = 0) : o.column++), o.state) {
|
|
5035
|
-
case
|
|
5036
|
-
if (o.state =
|
|
5013
|
+
case D.BEGIN:
|
|
5014
|
+
if (o.state = D.BEGIN_WHITESPACE, E === "\uFEFF")
|
|
5037
5015
|
continue;
|
|
5038
5016
|
St(o, E);
|
|
5039
5017
|
continue;
|
|
5040
|
-
case
|
|
5018
|
+
case D.BEGIN_WHITESPACE:
|
|
5041
5019
|
St(o, E);
|
|
5042
5020
|
continue;
|
|
5043
|
-
case
|
|
5021
|
+
case D.TEXT:
|
|
5044
5022
|
if (o.sawRoot && !o.closedRoot) {
|
|
5045
5023
|
for (var Q = C - 1; E && E !== "<" && E !== "&"; )
|
|
5046
5024
|
E = Je(l, C++), E && o.trackPosition && (o.position++, E === `
|
|
5047
5025
|
` ? (o.line++, o.column = 0) : o.column++);
|
|
5048
5026
|
o.textNode += l.substring(Q, C - 1);
|
|
5049
5027
|
}
|
|
5050
|
-
E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state =
|
|
5028
|
+
E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state = D.OPEN_WAKA, o.startTagPosition = o.position) : (!Y(E) && (!o.sawRoot || o.closedRoot) && le(o, "Text data outside of root node."), E === "&" ? o.state = D.TEXT_ENTITY : o.textNode += E);
|
|
5051
5029
|
continue;
|
|
5052
|
-
case
|
|
5053
|
-
E === "<" ? o.state =
|
|
5030
|
+
case D.SCRIPT:
|
|
5031
|
+
E === "<" ? o.state = D.SCRIPT_ENDING : o.script += E;
|
|
5054
5032
|
continue;
|
|
5055
|
-
case
|
|
5056
|
-
E === "/" ? o.state =
|
|
5033
|
+
case D.SCRIPT_ENDING:
|
|
5034
|
+
E === "/" ? o.state = D.CLOSE_TAG : (o.script += "<" + E, o.state = D.SCRIPT);
|
|
5057
5035
|
continue;
|
|
5058
|
-
case
|
|
5036
|
+
case D.OPEN_WAKA:
|
|
5059
5037
|
if (E === "!")
|
|
5060
|
-
o.state =
|
|
5038
|
+
o.state = D.SGML_DECL, o.sgmlDecl = "";
|
|
5061
5039
|
else if (!Y(E)) if (ne(se, E))
|
|
5062
|
-
o.state =
|
|
5040
|
+
o.state = D.OPEN_TAG, o.tagName = E;
|
|
5063
5041
|
else if (E === "/")
|
|
5064
|
-
o.state =
|
|
5042
|
+
o.state = D.CLOSE_TAG, o.tagName = "";
|
|
5065
5043
|
else if (E === "?")
|
|
5066
|
-
o.state =
|
|
5044
|
+
o.state = D.PROC_INST, o.procInstName = o.procInstBody = "";
|
|
5067
5045
|
else {
|
|
5068
5046
|
if (le(o, "Unencoded <"), o.startTagPosition + 1 < o.position) {
|
|
5069
5047
|
var ie = o.position - o.startTagPosition;
|
|
5070
5048
|
E = new Array(ie).join(" ") + E;
|
|
5071
5049
|
}
|
|
5072
|
-
o.textNode += "<" + E, o.state =
|
|
5050
|
+
o.textNode += "<" + E, o.state = D.TEXT;
|
|
5073
5051
|
}
|
|
5074
5052
|
continue;
|
|
5075
|
-
case
|
|
5053
|
+
case D.SGML_DECL:
|
|
5076
5054
|
if (o.sgmlDecl + E === "--") {
|
|
5077
|
-
o.state =
|
|
5055
|
+
o.state = D.COMMENT, o.comment = "", o.sgmlDecl = "";
|
|
5078
5056
|
continue;
|
|
5079
5057
|
}
|
|
5080
|
-
o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state =
|
|
5058
|
+
o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state = D.DOCTYPE_DTD, o.doctype += "<!" + o.sgmlDecl + E, o.sgmlDecl = "") : (o.sgmlDecl + E).toUpperCase() === W ? (de(o, "onopencdata"), o.state = D.CDATA, o.sgmlDecl = "", o.cdata = "") : (o.sgmlDecl + E).toUpperCase() === J ? (o.state = D.DOCTYPE, (o.doctype || o.sawRoot) && le(
|
|
5081
5059
|
o,
|
|
5082
5060
|
"Inappropriately located doctype declaration"
|
|
5083
|
-
), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (de(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state =
|
|
5061
|
+
), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (de(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state = D.TEXT) : (ae(E) && (o.state = D.SGML_DECL_QUOTED), o.sgmlDecl += E);
|
|
5084
5062
|
continue;
|
|
5085
|
-
case
|
|
5086
|
-
E === o.q && (o.state =
|
|
5063
|
+
case D.SGML_DECL_QUOTED:
|
|
5064
|
+
E === o.q && (o.state = D.SGML_DECL, o.q = ""), o.sgmlDecl += E;
|
|
5087
5065
|
continue;
|
|
5088
|
-
case
|
|
5089
|
-
E === ">" ? (o.state =
|
|
5066
|
+
case D.DOCTYPE:
|
|
5067
|
+
E === ">" ? (o.state = D.TEXT, de(o, "ondoctype", o.doctype), o.doctype = !0) : (o.doctype += E, E === "[" ? o.state = D.DOCTYPE_DTD : ae(E) && (o.state = D.DOCTYPE_QUOTED, o.q = E));
|
|
5090
5068
|
continue;
|
|
5091
|
-
case
|
|
5092
|
-
o.doctype += E, E === o.q && (o.q = "", o.state =
|
|
5069
|
+
case D.DOCTYPE_QUOTED:
|
|
5070
|
+
o.doctype += E, E === o.q && (o.q = "", o.state = D.DOCTYPE);
|
|
5093
5071
|
continue;
|
|
5094
|
-
case
|
|
5095
|
-
E === "]" ? (o.doctype += E, o.state =
|
|
5072
|
+
case D.DOCTYPE_DTD:
|
|
5073
|
+
E === "]" ? (o.doctype += E, o.state = D.DOCTYPE) : E === "<" ? (o.state = D.OPEN_WAKA, o.startTagPosition = o.position) : ae(E) ? (o.doctype += E, o.state = D.DOCTYPE_DTD_QUOTED, o.q = E) : o.doctype += E;
|
|
5096
5074
|
continue;
|
|
5097
|
-
case
|
|
5098
|
-
o.doctype += E, E === o.q && (o.state =
|
|
5075
|
+
case D.DOCTYPE_DTD_QUOTED:
|
|
5076
|
+
o.doctype += E, E === o.q && (o.state = D.DOCTYPE_DTD, o.q = "");
|
|
5099
5077
|
continue;
|
|
5100
|
-
case
|
|
5101
|
-
E === "-" ? o.state =
|
|
5078
|
+
case D.COMMENT:
|
|
5079
|
+
E === "-" ? o.state = D.COMMENT_ENDING : o.comment += E;
|
|
5102
5080
|
continue;
|
|
5103
|
-
case
|
|
5104
|
-
E === "-" ? (o.state =
|
|
5081
|
+
case D.COMMENT_ENDING:
|
|
5082
|
+
E === "-" ? (o.state = D.COMMENT_ENDED, o.comment = zt(o.opt, o.comment), o.comment && de(o, "oncomment", o.comment), o.comment = "") : (o.comment += "-" + E, o.state = D.COMMENT);
|
|
5105
5083
|
continue;
|
|
5106
|
-
case
|
|
5107
|
-
E !== ">" ? (le(o, "Malformed comment"), o.comment += "--" + E, o.state =
|
|
5084
|
+
case D.COMMENT_ENDED:
|
|
5085
|
+
E !== ">" ? (le(o, "Malformed comment"), o.comment += "--" + E, o.state = D.COMMENT) : o.doctype && o.doctype !== !0 ? o.state = D.DOCTYPE_DTD : o.state = D.TEXT;
|
|
5108
5086
|
continue;
|
|
5109
|
-
case
|
|
5087
|
+
case D.CDATA:
|
|
5110
5088
|
for (var Q = C - 1; E && E !== "]"; )
|
|
5111
5089
|
E = Je(l, C++), E && o.trackPosition && (o.position++, E === `
|
|
5112
5090
|
` ? (o.line++, o.column = 0) : o.column++);
|
|
5113
|
-
o.cdata += l.substring(Q, C - 1), E === "]" && (o.state =
|
|
5091
|
+
o.cdata += l.substring(Q, C - 1), E === "]" && (o.state = D.CDATA_ENDING);
|
|
5114
5092
|
continue;
|
|
5115
|
-
case
|
|
5116
|
-
E === "]" ? o.state =
|
|
5093
|
+
case D.CDATA_ENDING:
|
|
5094
|
+
E === "]" ? o.state = D.CDATA_ENDING_2 : (o.cdata += "]" + E, o.state = D.CDATA);
|
|
5117
5095
|
continue;
|
|
5118
|
-
case
|
|
5119
|
-
E === ">" ? (o.cdata && de(o, "oncdata", o.cdata), de(o, "onclosecdata"), o.cdata = "", o.state =
|
|
5096
|
+
case D.CDATA_ENDING_2:
|
|
5097
|
+
E === ">" ? (o.cdata && de(o, "oncdata", o.cdata), de(o, "onclosecdata"), o.cdata = "", o.state = D.TEXT) : E === "]" ? o.cdata += "]" : (o.cdata += "]]" + E, o.state = D.CDATA);
|
|
5120
5098
|
continue;
|
|
5121
|
-
case
|
|
5122
|
-
E === "?" ? o.state =
|
|
5099
|
+
case D.PROC_INST:
|
|
5100
|
+
E === "?" ? o.state = D.PROC_INST_ENDING : Y(E) ? o.state = D.PROC_INST_BODY : o.procInstName += E;
|
|
5123
5101
|
continue;
|
|
5124
|
-
case
|
|
5102
|
+
case D.PROC_INST_BODY:
|
|
5125
5103
|
if (!o.procInstBody && Y(E))
|
|
5126
5104
|
continue;
|
|
5127
|
-
E === "?" ? o.state =
|
|
5105
|
+
E === "?" ? o.state = D.PROC_INST_ENDING : o.procInstBody += E;
|
|
5128
5106
|
continue;
|
|
5129
|
-
case
|
|
5107
|
+
case D.PROC_INST_ENDING:
|
|
5130
5108
|
E === ">" ? (de(o, "onprocessinginstruction", {
|
|
5131
5109
|
name: o.procInstName,
|
|
5132
5110
|
body: o.procInstBody
|
|
5133
|
-
}), o.procInstName = o.procInstBody = "", o.state =
|
|
5111
|
+
}), o.procInstName = o.procInstBody = "", o.state = D.TEXT) : (o.procInstBody += "?" + E, o.state = D.PROC_INST_BODY);
|
|
5134
5112
|
continue;
|
|
5135
|
-
case
|
|
5136
|
-
ne(ce, E) ? o.tagName += E : (Xe(o), E === ">" ? qe(o) : E === "/" ? o.state =
|
|
5113
|
+
case D.OPEN_TAG:
|
|
5114
|
+
ne(ce, E) ? o.tagName += E : (Xe(o), E === ">" ? qe(o) : E === "/" ? o.state = D.OPEN_TAG_SLASH : (Y(E) || le(o, "Invalid character in tag name"), o.state = D.ATTRIB));
|
|
5137
5115
|
continue;
|
|
5138
|
-
case
|
|
5139
|
-
E === ">" ? (qe(o, !0),
|
|
5116
|
+
case D.OPEN_TAG_SLASH:
|
|
5117
|
+
E === ">" ? (qe(o, !0), Dt(o)) : (le(
|
|
5140
5118
|
o,
|
|
5141
5119
|
"Forward-slash in opening tag not followed by >"
|
|
5142
|
-
), o.state =
|
|
5120
|
+
), o.state = D.ATTRIB);
|
|
5143
5121
|
continue;
|
|
5144
|
-
case
|
|
5122
|
+
case D.ATTRIB:
|
|
5145
5123
|
if (Y(E))
|
|
5146
5124
|
continue;
|
|
5147
|
-
E === ">" ? qe(o) : E === "/" ? o.state =
|
|
5125
|
+
E === ">" ? qe(o) : E === "/" ? o.state = D.OPEN_TAG_SLASH : ne(se, E) ? (o.attribName = E, o.attribValue = "", o.state = D.ATTRIB_NAME) : le(o, "Invalid attribute name");
|
|
5148
5126
|
continue;
|
|
5149
|
-
case
|
|
5150
|
-
E === "=" ? o.state =
|
|
5127
|
+
case D.ATTRIB_NAME:
|
|
5128
|
+
E === "=" ? o.state = D.ATTRIB_VALUE : E === ">" ? (le(o, "Attribute without value"), o.attribValue = o.attribName, Fe(o), qe(o)) : Y(E) ? o.state = D.ATTRIB_NAME_SAW_WHITE : ne(ce, E) ? o.attribName += E : le(o, "Invalid attribute name");
|
|
5151
5129
|
continue;
|
|
5152
|
-
case
|
|
5130
|
+
case D.ATTRIB_NAME_SAW_WHITE:
|
|
5153
5131
|
if (E === "=")
|
|
5154
|
-
o.state =
|
|
5132
|
+
o.state = D.ATTRIB_VALUE;
|
|
5155
5133
|
else {
|
|
5156
5134
|
if (Y(E))
|
|
5157
5135
|
continue;
|
|
5158
5136
|
le(o, "Attribute without value"), o.tag.attributes[o.attribName] = "", o.attribValue = "", de(o, "onattribute", {
|
|
5159
5137
|
name: o.attribName,
|
|
5160
5138
|
value: ""
|
|
5161
|
-
}), o.attribName = "", E === ">" ? qe(o) : ne(se, E) ? (o.attribName = E, o.state =
|
|
5139
|
+
}), o.attribName = "", E === ">" ? qe(o) : ne(se, E) ? (o.attribName = E, o.state = D.ATTRIB_NAME) : (le(o, "Invalid attribute name"), o.state = D.ATTRIB);
|
|
5162
5140
|
}
|
|
5163
5141
|
continue;
|
|
5164
|
-
case
|
|
5142
|
+
case D.ATTRIB_VALUE:
|
|
5165
5143
|
if (Y(E))
|
|
5166
5144
|
continue;
|
|
5167
|
-
ae(E) ? (o.q = E, o.state =
|
|
5145
|
+
ae(E) ? (o.q = E, o.state = D.ATTRIB_VALUE_QUOTED) : (o.opt.unquotedAttributeValues || Ke(o, "Unquoted attribute value"), o.state = D.ATTRIB_VALUE_UNQUOTED, o.attribValue = E);
|
|
5168
5146
|
continue;
|
|
5169
|
-
case
|
|
5147
|
+
case D.ATTRIB_VALUE_QUOTED:
|
|
5170
5148
|
if (E !== o.q) {
|
|
5171
|
-
E === "&" ? o.state =
|
|
5149
|
+
E === "&" ? o.state = D.ATTRIB_VALUE_ENTITY_Q : o.attribValue += E;
|
|
5172
5150
|
continue;
|
|
5173
5151
|
}
|
|
5174
|
-
Fe(o), o.q = "", o.state =
|
|
5152
|
+
Fe(o), o.q = "", o.state = D.ATTRIB_VALUE_CLOSED;
|
|
5175
5153
|
continue;
|
|
5176
|
-
case
|
|
5177
|
-
Y(E) ? o.state =
|
|
5154
|
+
case D.ATTRIB_VALUE_CLOSED:
|
|
5155
|
+
Y(E) ? o.state = D.ATTRIB : E === ">" ? qe(o) : E === "/" ? o.state = D.OPEN_TAG_SLASH : ne(se, E) ? (le(o, "No whitespace between attributes"), o.attribName = E, o.attribValue = "", o.state = D.ATTRIB_NAME) : le(o, "Invalid attribute name");
|
|
5178
5156
|
continue;
|
|
5179
|
-
case
|
|
5180
|
-
if (!
|
|
5181
|
-
E === "&" ? o.state =
|
|
5157
|
+
case D.ATTRIB_VALUE_UNQUOTED:
|
|
5158
|
+
if (!me(E)) {
|
|
5159
|
+
E === "&" ? o.state = D.ATTRIB_VALUE_ENTITY_U : o.attribValue += E;
|
|
5182
5160
|
continue;
|
|
5183
5161
|
}
|
|
5184
|
-
Fe(o), E === ">" ? qe(o) : o.state =
|
|
5162
|
+
Fe(o), E === ">" ? qe(o) : o.state = D.ATTRIB;
|
|
5185
5163
|
continue;
|
|
5186
|
-
case
|
|
5164
|
+
case D.CLOSE_TAG:
|
|
5187
5165
|
if (o.tagName)
|
|
5188
|
-
E === ">" ?
|
|
5166
|
+
E === ">" ? Dt(o) : ne(ce, E) ? o.tagName += E : o.script ? (o.script += "</" + o.tagName + E, o.tagName = "", o.state = D.SCRIPT) : (Y(E) || le(o, "Invalid tagname in closing tag"), o.state = D.CLOSE_TAG_SAW_WHITE);
|
|
5189
5167
|
else {
|
|
5190
5168
|
if (Y(E))
|
|
5191
5169
|
continue;
|
|
5192
|
-
|
|
5170
|
+
De(se, E) ? o.script ? (o.script += "</" + E, o.state = D.SCRIPT) : le(o, "Invalid tagname in closing tag.") : o.tagName = E;
|
|
5193
5171
|
}
|
|
5194
5172
|
continue;
|
|
5195
|
-
case
|
|
5173
|
+
case D.CLOSE_TAG_SAW_WHITE:
|
|
5196
5174
|
if (Y(E))
|
|
5197
5175
|
continue;
|
|
5198
|
-
E === ">" ?
|
|
5176
|
+
E === ">" ? Dt(o) : le(o, "Invalid characters in closing tag");
|
|
5199
5177
|
continue;
|
|
5200
|
-
case
|
|
5201
|
-
case
|
|
5202
|
-
case
|
|
5178
|
+
case D.TEXT_ENTITY:
|
|
5179
|
+
case D.ATTRIB_VALUE_ENTITY_Q:
|
|
5180
|
+
case D.ATTRIB_VALUE_ENTITY_U:
|
|
5203
5181
|
var he, Ae;
|
|
5204
5182
|
switch (o.state) {
|
|
5205
|
-
case
|
|
5206
|
-
he =
|
|
5183
|
+
case D.TEXT_ENTITY:
|
|
5184
|
+
he = D.TEXT, Ae = "textNode";
|
|
5207
5185
|
break;
|
|
5208
|
-
case
|
|
5209
|
-
he =
|
|
5186
|
+
case D.ATTRIB_VALUE_ENTITY_Q:
|
|
5187
|
+
he = D.ATTRIB_VALUE_QUOTED, Ae = "attribValue";
|
|
5210
5188
|
break;
|
|
5211
|
-
case
|
|
5212
|
-
he =
|
|
5189
|
+
case D.ATTRIB_VALUE_ENTITY_U:
|
|
5190
|
+
he = D.ATTRIB_VALUE_UNQUOTED, Ae = "attribValue";
|
|
5213
5191
|
break;
|
|
5214
5192
|
}
|
|
5215
5193
|
if (E === ";") {
|
|
@@ -5256,7 +5234,7 @@ Actual: ` + l.attribValue
|
|
|
5256
5234
|
var qi = Ki();
|
|
5257
5235
|
function Li(g) {
|
|
5258
5236
|
const { dialecteConfig: u, useCustomRecordsIds: c } = g, i = u.io.hooks;
|
|
5259
|
-
let
|
|
5237
|
+
let p = {
|
|
5260
5238
|
defaultNamespace: null,
|
|
5261
5239
|
stack: [],
|
|
5262
5240
|
recordsBatch: []
|
|
@@ -5277,21 +5255,21 @@ function Li(g) {
|
|
|
5277
5255
|
// Enable namespace handling
|
|
5278
5256
|
}
|
|
5279
5257
|
);
|
|
5280
|
-
y.onopentag = (j) =>
|
|
5258
|
+
y.onopentag = (j) => p = Ui({
|
|
5281
5259
|
node: j,
|
|
5282
|
-
state:
|
|
5260
|
+
state: p,
|
|
5283
5261
|
dialecteConfig: u,
|
|
5284
5262
|
useCustomRecordsIds: c
|
|
5285
|
-
}), y.ontext = (j) =>
|
|
5286
|
-
state:
|
|
5263
|
+
}), y.ontext = (j) => p = Vi({ text: j, state: p }), y.onclosetag = () => ({ updatedState: p } = Gi({
|
|
5264
|
+
state: p,
|
|
5287
5265
|
ioHooks: i
|
|
5288
5266
|
})), y.onerror = $i;
|
|
5289
5267
|
function N() {
|
|
5290
|
-
const j =
|
|
5291
|
-
return
|
|
5268
|
+
const j = p.recordsBatch;
|
|
5269
|
+
return p.recordsBatch = [], j;
|
|
5292
5270
|
}
|
|
5293
5271
|
function R() {
|
|
5294
|
-
return
|
|
5272
|
+
return p.recordsBatch.length;
|
|
5295
5273
|
}
|
|
5296
5274
|
return {
|
|
5297
5275
|
parser: y,
|
|
@@ -5300,13 +5278,13 @@ function Li(g) {
|
|
|
5300
5278
|
};
|
|
5301
5279
|
}
|
|
5302
5280
|
function Ui(g) {
|
|
5303
|
-
const { node: u, state: c, dialecteConfig: i, useCustomRecordsIds: h } = g,
|
|
5304
|
-
|
|
5281
|
+
const { node: u, state: c, dialecteConfig: i, useCustomRecordsIds: h } = g, p = { ...c }, y = Xi(u);
|
|
5282
|
+
p.defaultNamespace || (p.defaultNamespace = Wi({
|
|
5305
5283
|
element: u,
|
|
5306
5284
|
defaultNamespace: i.namespaces.default,
|
|
5307
5285
|
rootElementName: i.rootElementName
|
|
5308
5286
|
}));
|
|
5309
|
-
const N = Yi(u,
|
|
5287
|
+
const N = Yi(u, p.defaultNamespace), R = Hi({ attributes: u.attributes, useCustomRecordsIds: h }), j = Zi({
|
|
5310
5288
|
attributes: u.attributes,
|
|
5311
5289
|
useCustomRecordsIds: h
|
|
5312
5290
|
}), X = zi(j), W = Qi(c.stack), J = {
|
|
@@ -5318,7 +5296,7 @@ function Ui(g) {
|
|
|
5318
5296
|
parent: W,
|
|
5319
5297
|
children: []
|
|
5320
5298
|
};
|
|
5321
|
-
return
|
|
5299
|
+
return p.stack.push(J), p;
|
|
5322
5300
|
}
|
|
5323
5301
|
function Vi(g) {
|
|
5324
5302
|
const { text: u, state: c } = g;
|
|
@@ -5327,7 +5305,7 @@ function Vi(g) {
|
|
|
5327
5305
|
function Gi(g) {
|
|
5328
5306
|
const { state: u, ioHooks: c } = g, i = u.stack.at(-1);
|
|
5329
5307
|
let h = u.stack.slice(0, -1);
|
|
5330
|
-
const
|
|
5308
|
+
const p = [...u.recordsBatch];
|
|
5331
5309
|
if (i) {
|
|
5332
5310
|
if (c?.beforeImportRecord && c.beforeImportRecord({
|
|
5333
5311
|
record: i,
|
|
@@ -5347,13 +5325,13 @@ function Gi(g) {
|
|
|
5347
5325
|
parentId: i.parent.id,
|
|
5348
5326
|
child: { id: i.id, tagName: i.tagName }
|
|
5349
5327
|
});
|
|
5350
|
-
|
|
5328
|
+
p.push(i);
|
|
5351
5329
|
}
|
|
5352
5330
|
return {
|
|
5353
5331
|
updatedState: {
|
|
5354
5332
|
defaultNamespace: u.defaultNamespace,
|
|
5355
5333
|
stack: h,
|
|
5356
|
-
recordsBatch:
|
|
5334
|
+
recordsBatch: p
|
|
5357
5335
|
}
|
|
5358
5336
|
};
|
|
5359
5337
|
}
|
|
@@ -5366,8 +5344,7 @@ function Xi(g) {
|
|
|
5366
5344
|
function Wi(g) {
|
|
5367
5345
|
const { element: u, defaultNamespace: c, rootElementName: i } = g;
|
|
5368
5346
|
return $e(u.name === i, {
|
|
5369
|
-
detail: `Expected root element <${i}>, got <${u.name}
|
|
5370
|
-
method: "import::getDefaultNamespace"
|
|
5347
|
+
detail: `Expected root element <${i}>, got <${u.name}>`
|
|
5371
5348
|
}), u.attributes?.xmlns?.value ? {
|
|
5372
5349
|
prefix: "",
|
|
5373
5350
|
uri: u.attributes.xmlns.value
|
|
@@ -5414,9 +5391,9 @@ const ea = {
|
|
|
5414
5391
|
async function So(g) {
|
|
5415
5392
|
const { files: u, dialecteConfig: c, useCustomRecordsIds: i = !1 } = g, h = [];
|
|
5416
5393
|
if (u.length === 0) throw new Error("No files provided for import.");
|
|
5417
|
-
const { importOptions:
|
|
5394
|
+
const { importOptions: p = ea, supportedFileExtensions: y } = c.io, N = {
|
|
5418
5395
|
...ea,
|
|
5419
|
-
...
|
|
5396
|
+
...p
|
|
5420
5397
|
};
|
|
5421
5398
|
for (const R of u) {
|
|
5422
5399
|
if (!Ji({ file: R, supportedExtensions: y })) {
|
|
@@ -5442,7 +5419,7 @@ function eo(g) {
|
|
|
5442
5419
|
return g.name.replace(/\.[^.]+$/, "");
|
|
5443
5420
|
}
|
|
5444
5421
|
async function to(g) {
|
|
5445
|
-
const { file: u, dialecteConfig: c, options: i, useCustomRecordsIds: h } = g,
|
|
5422
|
+
const { file: u, dialecteConfig: c, options: i, useCustomRecordsIds: h } = g, p = eo(u), y = await Ii({ databaseName: p, dialecteConfig: c });
|
|
5446
5423
|
try {
|
|
5447
5424
|
const N = c.database.tables.xmlElements.name;
|
|
5448
5425
|
if (await y.table(N).clear(), i.useBrowserApi && u.size !== 0 && await no({
|
|
@@ -5457,9 +5434,9 @@ async function to(g) {
|
|
|
5457
5434
|
}
|
|
5458
5435
|
}), c.io.hooks?.afterImport) {
|
|
5459
5436
|
const { creates: R, updates: j, deletes: X } = await c.io.hooks.afterImport();
|
|
5460
|
-
R?.length && await ga({ databaseInstance: y, elementsTableName: N, records: R }), j?.length && await
|
|
5437
|
+
R?.length && await ga({ databaseInstance: y, elementsTableName: N, records: R }), j?.length && await Di({ databaseInstance: y, elementsTableName: N, updates: j }), X?.length && await Si({ databaseInstance: y, elementsTableName: N, ids: X });
|
|
5461
5438
|
}
|
|
5462
|
-
return
|
|
5439
|
+
return p;
|
|
5463
5440
|
} catch (N) {
|
|
5464
5441
|
throw console.error(`Error importing file ${u.name}:`, N), N;
|
|
5465
5442
|
} finally {
|
|
@@ -5467,9 +5444,9 @@ async function to(g) {
|
|
|
5467
5444
|
}
|
|
5468
5445
|
}
|
|
5469
5446
|
async function no(g) {
|
|
5470
|
-
const { file: u, databaseInstance: c, elementsTableName: i, dialecteConfig: h, options:
|
|
5447
|
+
const { file: u, databaseInstance: c, elementsTableName: i, dialecteConfig: h, options: p } = g, y = u.stream().getReader(), N = Li({
|
|
5471
5448
|
dialecteConfig: h,
|
|
5472
|
-
useCustomRecordsIds:
|
|
5449
|
+
useCustomRecordsIds: p.useCustomRecordsIds
|
|
5473
5450
|
}), R = new TextDecoder(), j = new Uint8Array(0);
|
|
5474
5451
|
return await fr({
|
|
5475
5452
|
databaseInstance: c,
|
|
@@ -5478,14 +5455,14 @@ async function no(g) {
|
|
|
5478
5455
|
sax: N,
|
|
5479
5456
|
textDecoder: R,
|
|
5480
5457
|
buffer: j,
|
|
5481
|
-
options:
|
|
5458
|
+
options: p
|
|
5482
5459
|
});
|
|
5483
5460
|
}
|
|
5484
5461
|
async function fr(g) {
|
|
5485
|
-
const { databaseInstance: u, elementsTableName: c, reader: i, sax: h, textDecoder:
|
|
5462
|
+
const { databaseInstance: u, elementsTableName: c, reader: i, sax: h, textDecoder: p, buffer: y, options: N } = g, { chunkSize: R, batchSize: j } = N, { done: X, value: W } = await i.read();
|
|
5486
5463
|
if (X) {
|
|
5487
5464
|
if (y.length > 0) {
|
|
5488
|
-
const fe =
|
|
5465
|
+
const fe = p.decode(y);
|
|
5489
5466
|
h.parser.write(fe);
|
|
5490
5467
|
}
|
|
5491
5468
|
return h.parser.close(), await ta({
|
|
@@ -5501,7 +5478,7 @@ async function fr(g) {
|
|
|
5501
5478
|
for (J.set(y), J.set(W, y.length); J.length >= R; ) {
|
|
5502
5479
|
const fe = J.slice(0, R);
|
|
5503
5480
|
J = J.slice(R);
|
|
5504
|
-
const B =
|
|
5481
|
+
const B = p.decode(fe, { stream: !0 });
|
|
5505
5482
|
h.parser.write(B), await ta({
|
|
5506
5483
|
databaseInstance: u,
|
|
5507
5484
|
elementsTableName: c,
|
|
@@ -5539,19 +5516,19 @@ function ro() {
|
|
|
5539
5516
|
function h() {
|
|
5540
5517
|
return R(!1) || J() || W() || X() || N();
|
|
5541
5518
|
}
|
|
5542
|
-
function
|
|
5519
|
+
function p() {
|
|
5543
5520
|
return F(/\s*/), R(!0) || W() || j() || N();
|
|
5544
5521
|
}
|
|
5545
5522
|
function y() {
|
|
5546
5523
|
const ee = N(), Y = [];
|
|
5547
|
-
let ae,
|
|
5548
|
-
for (;
|
|
5549
|
-
if (
|
|
5524
|
+
let ae, me = p();
|
|
5525
|
+
for (; me; ) {
|
|
5526
|
+
if (me.node.type === "Element") {
|
|
5550
5527
|
if (ae)
|
|
5551
5528
|
throw new Error("Found multiple root nodes");
|
|
5552
|
-
ae =
|
|
5529
|
+
ae = me.node;
|
|
5553
5530
|
}
|
|
5554
|
-
|
|
5531
|
+
me.excluded || Y.push(me.node), me = p();
|
|
5555
5532
|
}
|
|
5556
5533
|
if (!ae)
|
|
5557
5534
|
throw new c("Failed to parse XML", "Root Element not found");
|
|
@@ -5590,17 +5567,17 @@ function ro() {
|
|
|
5590
5567
|
name: Y[1],
|
|
5591
5568
|
attributes: {},
|
|
5592
5569
|
children: []
|
|
5593
|
-
},
|
|
5570
|
+
}, me = ee ? !1 : i.options.filter(ae) === !1;
|
|
5594
5571
|
for (; !(se() || ce(">") || ce("?>") || ce("/>")); ) {
|
|
5595
|
-
const
|
|
5596
|
-
if (
|
|
5597
|
-
ae.attributes[
|
|
5572
|
+
const De = fe();
|
|
5573
|
+
if (De)
|
|
5574
|
+
ae.attributes[De.name] = De.value;
|
|
5598
5575
|
else
|
|
5599
5576
|
return;
|
|
5600
5577
|
}
|
|
5601
5578
|
if (F(/^\s*\/>/))
|
|
5602
5579
|
return ae.children = null, {
|
|
5603
|
-
excluded:
|
|
5580
|
+
excluded: me,
|
|
5604
5581
|
node: ae
|
|
5605
5582
|
};
|
|
5606
5583
|
F(/\??>/);
|
|
@@ -5608,15 +5585,15 @@ function ro() {
|
|
|
5608
5585
|
for (; ne; )
|
|
5609
5586
|
ne.excluded || ae.children.push(ne.node), ne = h();
|
|
5610
5587
|
if (i.options.strictMode) {
|
|
5611
|
-
const
|
|
5612
|
-
if (i.xml.startsWith(
|
|
5613
|
-
i.xml = i.xml.slice(
|
|
5588
|
+
const De = `</${ae.name}>`;
|
|
5589
|
+
if (i.xml.startsWith(De))
|
|
5590
|
+
i.xml = i.xml.slice(De.length);
|
|
5614
5591
|
else
|
|
5615
|
-
throw new c("Failed to parse XML", `Closing tag not matching "${
|
|
5592
|
+
throw new c("Failed to parse XML", `Closing tag not matching "${De}"`);
|
|
5616
5593
|
} else
|
|
5617
5594
|
F(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);
|
|
5618
5595
|
return {
|
|
5619
|
-
excluded:
|
|
5596
|
+
excluded: me,
|
|
5620
5597
|
node: ae
|
|
5621
5598
|
};
|
|
5622
5599
|
}
|
|
@@ -5723,7 +5700,7 @@ function ao() {
|
|
|
5723
5700
|
for (F = 0; F < B.level; F++)
|
|
5724
5701
|
B.content += B.options.indentation;
|
|
5725
5702
|
}
|
|
5726
|
-
function
|
|
5703
|
+
function p(B) {
|
|
5727
5704
|
B.content = B.content.replace(/ +$/, "");
|
|
5728
5705
|
let F;
|
|
5729
5706
|
for (F = 0; F < B.level; F++)
|
|
@@ -5764,15 +5741,15 @@ function ao() {
|
|
|
5764
5741
|
y(F, ">"), F.level++;
|
|
5765
5742
|
let Te = B.attributes["xml:space"] === "preserve" || se, ee = !1;
|
|
5766
5743
|
if (!Te && F.options.ignoredPaths && (ee = j(F.path, F.options.ignoredPaths), Te = ee), !Te && F.options.collapseContent) {
|
|
5767
|
-
let Y = !1, ae = !1,
|
|
5768
|
-
ce.forEach(function(ne,
|
|
5744
|
+
let Y = !1, ae = !1, me = !1;
|
|
5745
|
+
ce.forEach(function(ne, De) {
|
|
5769
5746
|
ne.type === "Text" ? (ne.content.includes(`
|
|
5770
|
-
`) ? (ae = !0, ne.content = ne.content.trim()) : (
|
|
5771
|
-
}), Y && (!
|
|
5747
|
+
`) ? (ae = !0, ne.content = ne.content.trim()) : (De === 0 || De === ce.length - 1) && !se && ne.content.trim().length === 0 && (ne.content = ""), (ne.content.trim().length > 0 || ce.length === 1) && (Y = !0)) : ne.type === "CDATA" ? Y = !0 : me = !0;
|
|
5748
|
+
}), Y && (!me || !ae) && (Te = !0);
|
|
5772
5749
|
}
|
|
5773
5750
|
ce.forEach(function(Y) {
|
|
5774
5751
|
N(Y, F, se || Te);
|
|
5775
|
-
}), F.level--, !se && !Te && h(F), ee &&
|
|
5752
|
+
}), F.level--, !se && !Te && h(F), ee && p(F), y(F, "</" + B.name + ">");
|
|
5776
5753
|
}
|
|
5777
5754
|
F.path.pop();
|
|
5778
5755
|
}
|
|
@@ -5804,7 +5781,7 @@ function ao() {
|
|
|
5804
5781
|
})(Wt, Wt.exports)), Wt.exports;
|
|
5805
5782
|
}
|
|
5806
5783
|
var io = /* @__PURE__ */ ao();
|
|
5807
|
-
const oo = /* @__PURE__ */
|
|
5784
|
+
const oo = /* @__PURE__ */ ma(io);
|
|
5808
5785
|
function so(g) {
|
|
5809
5786
|
return oo(g);
|
|
5810
5787
|
}
|
|
@@ -5837,12 +5814,12 @@ async function Ro(g) {
|
|
|
5837
5814
|
databaseName: c,
|
|
5838
5815
|
extension: i,
|
|
5839
5816
|
withDownload: h = !1,
|
|
5840
|
-
withDatabaseIds:
|
|
5817
|
+
withDatabaseIds: p = !1
|
|
5841
5818
|
} = g, y = await co({
|
|
5842
5819
|
databaseName: c,
|
|
5843
5820
|
extension: i,
|
|
5844
5821
|
dialecteConfig: u,
|
|
5845
|
-
withDatabaseIds:
|
|
5822
|
+
withDatabaseIds: p
|
|
5846
5823
|
});
|
|
5847
5824
|
return h && await uo({
|
|
5848
5825
|
extension: i,
|
|
@@ -5851,11 +5828,11 @@ async function Ro(g) {
|
|
|
5851
5828
|
}), y;
|
|
5852
5829
|
}
|
|
5853
5830
|
async function co(g) {
|
|
5854
|
-
const { databaseName: u, extension: c = "xml", dialecteConfig: i, withDatabaseIds: h } = g,
|
|
5855
|
-
await
|
|
5831
|
+
const { databaseName: u, extension: c = "xml", dialecteConfig: i, withDatabaseIds: h } = g, p = new Qe(u);
|
|
5832
|
+
await p.open();
|
|
5856
5833
|
try {
|
|
5857
5834
|
const y = await lo({
|
|
5858
|
-
databaseInstance:
|
|
5835
|
+
databaseInstance: p,
|
|
5859
5836
|
dialecteConfig: i,
|
|
5860
5837
|
withDatabaseIds: h
|
|
5861
5838
|
});
|
|
@@ -5863,21 +5840,21 @@ async function co(g) {
|
|
|
5863
5840
|
throw new Error("Failed to rebuild XML document from IndexedDB.");
|
|
5864
5841
|
return {
|
|
5865
5842
|
xmlDocument: y,
|
|
5866
|
-
filename:
|
|
5843
|
+
filename: p.name + c
|
|
5867
5844
|
};
|
|
5868
5845
|
} finally {
|
|
5869
|
-
|
|
5846
|
+
p.close();
|
|
5870
5847
|
}
|
|
5871
5848
|
}
|
|
5872
5849
|
async function lo(g) {
|
|
5873
|
-
const { databaseInstance: u, dialecteConfig: c, withDatabaseIds: i } = g, { useBrowserApi: h = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 },
|
|
5850
|
+
const { databaseInstance: u, dialecteConfig: c, withDatabaseIds: i } = g, { useBrowserApi: h = !0 } = c.io.exportOptions ?? { useBrowserApi: !0 }, p = c.rootElementName, y = c.namespaces.default, N = c.database.tables.xmlElements.name;
|
|
5874
5851
|
if (h) {
|
|
5875
5852
|
const R = document.implementation.createDocument(
|
|
5876
5853
|
y.uri,
|
|
5877
5854
|
null,
|
|
5878
5855
|
null
|
|
5879
|
-
), j = await u.table(N).where({ tagName:
|
|
5880
|
-
if (!j) throw new Error(`No ${
|
|
5856
|
+
), j = await u.table(N).where({ tagName: p }).first();
|
|
5857
|
+
if (!j) throw new Error(`No ${p} root element found in DB`);
|
|
5881
5858
|
const X = R.createElementNS(
|
|
5882
5859
|
j.namespace.uri,
|
|
5883
5860
|
j.tagName
|
|
@@ -5905,13 +5882,13 @@ async function va(g) {
|
|
|
5905
5882
|
dialecteConfig: c,
|
|
5906
5883
|
elementsTableName: i,
|
|
5907
5884
|
withDatabaseIds: h,
|
|
5908
|
-
xmlDocument:
|
|
5885
|
+
xmlDocument: p,
|
|
5909
5886
|
databaseRecord: y,
|
|
5910
5887
|
parentDomElement: N
|
|
5911
5888
|
} = g;
|
|
5912
5889
|
if (!y.children) return;
|
|
5913
5890
|
const R = y.children.map((J) => J.id), X = await u.table(i).bulkGet(R);
|
|
5914
|
-
|
|
5891
|
+
po({
|
|
5915
5892
|
childrenRecords: X,
|
|
5916
5893
|
parentRecord: y
|
|
5917
5894
|
});
|
|
@@ -5923,7 +5900,7 @@ async function va(g) {
|
|
|
5923
5900
|
for (const J of W) {
|
|
5924
5901
|
const fe = fo({
|
|
5925
5902
|
dialecteConfig: c,
|
|
5926
|
-
document:
|
|
5903
|
+
document: p,
|
|
5927
5904
|
record: J,
|
|
5928
5905
|
defaultNamespace: c.namespaces.default,
|
|
5929
5906
|
withDatabaseIds: h
|
|
@@ -5933,7 +5910,7 @@ async function va(g) {
|
|
|
5933
5910
|
dialecteConfig: c,
|
|
5934
5911
|
elementsTableName: i,
|
|
5935
5912
|
withDatabaseIds: h,
|
|
5936
|
-
xmlDocument:
|
|
5913
|
+
xmlDocument: p,
|
|
5937
5914
|
databaseRecord: J,
|
|
5938
5915
|
parentDomElement: fe
|
|
5939
5916
|
});
|
|
@@ -5941,7 +5918,7 @@ async function va(g) {
|
|
|
5941
5918
|
return g.xmlDocument;
|
|
5942
5919
|
}
|
|
5943
5920
|
function fo(g) {
|
|
5944
|
-
const { dialecteConfig: u, document: c, record: i, defaultNamespace: h, withDatabaseIds:
|
|
5921
|
+
const { dialecteConfig: u, document: c, record: i, defaultNamespace: h, withDatabaseIds: p } = g;
|
|
5945
5922
|
let y;
|
|
5946
5923
|
return !(i.namespace.uri === h.uri) && i.namespace.prefix && i.namespace.prefix !== "xmlns" ? (wa({
|
|
5947
5924
|
dialecteConfig: u,
|
|
@@ -5956,19 +5933,19 @@ function fo(g) {
|
|
|
5956
5933
|
element: y,
|
|
5957
5934
|
attributes: i.attributes,
|
|
5958
5935
|
isRoot: !1
|
|
5959
|
-
}), i.value && (y.textContent = i.value.trim()),
|
|
5936
|
+
}), i.value && (y.textContent = i.value.trim()), p && y.setAttribute(ya, i.id), y;
|
|
5960
5937
|
}
|
|
5961
5938
|
function ba(g) {
|
|
5962
|
-
const { dialecteConfig: u, document: c, element: i, attributes: h, isRoot:
|
|
5939
|
+
const { dialecteConfig: u, document: c, element: i, attributes: h, isRoot: p } = g;
|
|
5963
5940
|
for (const y of h)
|
|
5964
|
-
if (!
|
|
5941
|
+
if (!mo(y))
|
|
5965
5942
|
if (Ta(y)) {
|
|
5966
5943
|
const N = y.namespace?.prefix || "";
|
|
5967
5944
|
if (!N) {
|
|
5968
5945
|
i.setAttribute(y.name, String(y.value));
|
|
5969
5946
|
continue;
|
|
5970
5947
|
}
|
|
5971
|
-
|
|
5948
|
+
p || wa({
|
|
5972
5949
|
dialecteConfig: u,
|
|
5973
5950
|
document: c,
|
|
5974
5951
|
namespace: y.namespace
|
|
@@ -5980,8 +5957,8 @@ function ba(g) {
|
|
|
5980
5957
|
function wa(g) {
|
|
5981
5958
|
const { dialecteConfig: u, document: c, namespace: i } = g, h = c.documentElement;
|
|
5982
5959
|
if (!h || !i.prefix || i.prefix === "xmlns") return;
|
|
5983
|
-
const
|
|
5984
|
-
h.getAttributeNS(
|
|
5960
|
+
const p = "http://www.w3.org/2000/xmlns/";
|
|
5961
|
+
h.getAttributeNS(p, i.prefix) === null && (h.setAttributeNS(p, `xmlns:${i.prefix}`, i.uri), _a({ dialecteConfig: u, rootElement: h, namespace: i }));
|
|
5985
5962
|
}
|
|
5986
5963
|
function _a(g) {
|
|
5987
5964
|
const { dialecteConfig: u, rootElement: c, namespace: i } = g, h = Object.entries(
|
|
@@ -6000,24 +5977,24 @@ function _a(g) {
|
|
|
6000
5977
|
}
|
|
6001
5978
|
}
|
|
6002
5979
|
function ho(g) {
|
|
6003
|
-
const { parentTagName: u, availableChildren: c, childrenRecords: i } = g, h = [],
|
|
6004
|
-
if (!
|
|
5980
|
+
const { parentTagName: u, availableChildren: c, childrenRecords: i } = g, h = [], p = new Set(c[u]);
|
|
5981
|
+
if (!p.size) return i;
|
|
6005
5982
|
const y = /* @__PURE__ */ new Map(), N = [];
|
|
6006
|
-
for (const R of
|
|
5983
|
+
for (const R of p)
|
|
6007
5984
|
y.set(R, []);
|
|
6008
5985
|
for (const R of i)
|
|
6009
|
-
|
|
6010
|
-
for (const R of
|
|
5986
|
+
p.has(R.tagName) ? y.get(R.tagName)?.push(R) : N.push(R);
|
|
5987
|
+
for (const R of p) {
|
|
6011
5988
|
const j = y.get(R);
|
|
6012
5989
|
j && j.length && h.push(...j);
|
|
6013
5990
|
}
|
|
6014
5991
|
return h.push(...N), h;
|
|
6015
5992
|
}
|
|
6016
|
-
function
|
|
6017
|
-
const { childrenRecords: u, parentRecord: c } = g, i = u.map((h,
|
|
5993
|
+
function po(g) {
|
|
5994
|
+
const { childrenRecords: u, parentRecord: c } = g, i = u.map((h, p) => h === void 0 ? p : -1).filter((h) => h !== -1);
|
|
6018
5995
|
if (i.length > 0) {
|
|
6019
|
-
const h = i.map((
|
|
6020
|
-
const y = c.children[
|
|
5996
|
+
const h = i.map((p) => {
|
|
5997
|
+
const y = c.children[p];
|
|
6021
5998
|
return `'${y.tagName}' (id: ${y.id})`;
|
|
6022
5999
|
});
|
|
6023
6000
|
throw new Error(
|
|
@@ -6028,7 +6005,7 @@ function mo(g) {
|
|
|
6028
6005
|
function Ta(g) {
|
|
6029
6006
|
return g !== null && typeof g == "object" && "namespace" in g && !!g.namespace;
|
|
6030
6007
|
}
|
|
6031
|
-
function
|
|
6008
|
+
function mo(g) {
|
|
6032
6009
|
return !!(g.name === "xmlns" || g.name.startsWith("xmlns:") || Ta(g) && g.namespace?.prefix === "xmlns");
|
|
6033
6010
|
}
|
|
6034
6011
|
function Po(g) {
|
|
@@ -6045,11 +6022,11 @@ export {
|
|
|
6045
6022
|
ga as c,
|
|
6046
6023
|
Si as d,
|
|
6047
6024
|
Ro as e,
|
|
6048
|
-
|
|
6049
|
-
|
|
6050
|
-
|
|
6025
|
+
Io as f,
|
|
6026
|
+
ma as g,
|
|
6027
|
+
Di as h,
|
|
6051
6028
|
So as i,
|
|
6052
|
-
|
|
6029
|
+
Do as j,
|
|
6053
6030
|
dr as k,
|
|
6054
6031
|
Qa as l,
|
|
6055
6032
|
so as m,
|