@septkit/ui 0.0.52 → 0.0.54
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/dialecte/composables/index.js +2 -1
- package/dist/dialecte/composables/use-document-state.js +69 -0
- package/dist/dialecte/create-document-store.js +3 -3
- package/dist/dialecte/index.js +2 -1
- package/dist/external/.pnpm/{@dialecte_core@0.4.9 → @dialecte_core@0.4.12}/node_modules/@dialecte/core/dist/helpers.js +1 -1
- package/dist/external/.pnpm/{@dialecte_core@0.4.9 → @dialecte_core@0.4.12}/node_modules/@dialecte/core/dist/index.js +1 -1
- package/dist/external/.pnpm/{@dialecte_core@0.4.9/node_modules/@dialecte/core/dist/project-D-KS3OPN.js → @dialecte_core@0.4.12/node_modules/@dialecte/core/dist/project-DkMkDgld.js} +843 -773
- package/dist/external/.pnpm/{@dialecte_core@0.4.9 → @dialecte_core@0.4.12}/node_modules/@dialecte/core/dist/utils-C5_11hqg.js +1 -1
- package/dist/external/.pnpm/{@dialecte_scl@0.3.12/node_modules/@dialecte/scl/dist/hooks-Cm_UYBBt.js → @dialecte_scl@0.3.14/node_modules/@dialecte/scl/dist/hooks-By65uB-0.js} +3 -2
- package/dist/external/.pnpm/{@dialecte_scl@0.3.12 → @dialecte_scl@0.3.14}/node_modules/@dialecte/scl/dist/v2019C1/index.js +3 -3
- package/dist/index.d.ts +71 -0
- package/dist/index.js +26 -23
- package/dist/merge/merge-preflight.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/merge/merge.service.js +2 -2
- package/dist/progress/document-progress-bar.js +5 -0
- package/dist/progress/document-progress-bar.vue_vue_type_script_setup_true_lang.js +25 -0
- package/dist/progress/index.js +2 -0
- package/dist/ui.css +1 -1
- package/package.json +3 -3
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { a as e, d as t, f as n, n as r, o as i, p as a, r as o } from "./utils-C5_11hqg.js";
|
|
2
2
|
import { assertNoFixedViolation as s, isRecordOf as c, standardizeRecord as l, toFullAttributeArray as u, toRawRecord as d, toRef as f, toTreeRecord as p } from "./helpers.js";
|
|
3
|
-
//#region node_modules/.pnpm/@dialecte+core@0.4.
|
|
3
|
+
//#region node_modules/.pnpm/@dialecte+core@0.4.12/node_modules/@dialecte/core/dist/project-DkMkDgld.js
|
|
4
4
|
var m = Object.create, h = Object.defineProperty, g = Object.getOwnPropertyDescriptor, _ = Object.getOwnPropertyNames, v = Object.getPrototypeOf, y = Object.prototype.hasOwnProperty, b = (e, t) => () => (t || (e((t = { exports: {} }).exports, t), e = null), t.exports), x = (e, t, n, r) => {
|
|
5
5
|
if (t && typeof t == "object" || typeof t == "function") for (var i = _(t), a = 0, o = i.length, s; a < o; a++) s = i[a], !y.call(e, s) && s !== n && h(e, s, {
|
|
6
6
|
get: ((e) => t[e]).bind(null, s),
|
|
@@ -22,7 +22,54 @@ function ee(e, t) {
|
|
|
22
22
|
}
|
|
23
23
|
return n;
|
|
24
24
|
}
|
|
25
|
-
function w(e) {
|
|
25
|
+
function w(e, t = () => {}) {
|
|
26
|
+
let n = [], r = () => {
|
|
27
|
+
if (n.length === 0) {
|
|
28
|
+
e.progress = null;
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
let t = n[0], r = n[n.length - 1];
|
|
32
|
+
e.progress = {
|
|
33
|
+
current: t.current,
|
|
34
|
+
total: t.total,
|
|
35
|
+
label: r.label || t.label,
|
|
36
|
+
step: n.length > 1 ? {
|
|
37
|
+
current: r.current,
|
|
38
|
+
total: r.total
|
|
39
|
+
} : null
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
return {
|
|
43
|
+
plan({ steps: e, label: i }) {
|
|
44
|
+
n.push({
|
|
45
|
+
current: 0,
|
|
46
|
+
total: e,
|
|
47
|
+
label: i ?? "",
|
|
48
|
+
open: !1
|
|
49
|
+
}), r(), t(!1);
|
|
50
|
+
},
|
|
51
|
+
nextStep(e) {
|
|
52
|
+
let i = n.at(-1);
|
|
53
|
+
i && (i.open && i.current++, i.open = !0, e !== void 0 && (i.label = e), r(), t(!1));
|
|
54
|
+
},
|
|
55
|
+
endPlan() {
|
|
56
|
+
if (n.length === 0) return;
|
|
57
|
+
n.pop();
|
|
58
|
+
let e = n.length === 0;
|
|
59
|
+
r(), t(e);
|
|
60
|
+
},
|
|
61
|
+
forceClear() {
|
|
62
|
+
n = [], e.progress = null, t(!0);
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
var te = Object.freeze({
|
|
67
|
+
plan() {},
|
|
68
|
+
nextStep() {},
|
|
69
|
+
endPlan() {},
|
|
70
|
+
forceClear() {}
|
|
71
|
+
});
|
|
72
|
+
function T(e) {
|
|
26
73
|
let { stagedOperations: t, tagName: n, id: r } = e;
|
|
27
74
|
for (let e = t.length - 1; e >= 0; e--) {
|
|
28
75
|
let i = t[e];
|
|
@@ -78,7 +125,7 @@ function w(e) {
|
|
|
78
125
|
}
|
|
79
126
|
}
|
|
80
127
|
}
|
|
81
|
-
function
|
|
128
|
+
function ne(e) {
|
|
82
129
|
let { rawRecords: t, stagedOperations: n, tagName: r } = e, i = new Map(t.map((e) => [e.id, {
|
|
83
130
|
...e,
|
|
84
131
|
status: "unchanged"
|
|
@@ -95,7 +142,7 @@ function te(e) {
|
|
|
95
142
|
}
|
|
96
143
|
return Array.from(i.values());
|
|
97
144
|
}
|
|
98
|
-
function
|
|
145
|
+
function re(e) {
|
|
99
146
|
let { rawRecords: t, stagedOperations: n, includeDeleted: r = !1 } = e, i = new Map(t.map((e) => [e.id, {
|
|
100
147
|
...e,
|
|
101
148
|
status: "unchanged"
|
|
@@ -118,7 +165,7 @@ function T(e) {
|
|
|
118
165
|
deleted: a
|
|
119
166
|
};
|
|
120
167
|
}
|
|
121
|
-
function
|
|
168
|
+
function ie(e) {
|
|
122
169
|
let t = /* @__PURE__ */ new Set();
|
|
123
170
|
for (let n of e) n.status === "created" && t.add(n.newRecord.id);
|
|
124
171
|
let n = /* @__PURE__ */ new Map();
|
|
@@ -139,7 +186,7 @@ function ne(e) {
|
|
|
139
186
|
async function E(e) {
|
|
140
187
|
let { context: t, ref: n } = e;
|
|
141
188
|
if (t.stagedOperations.length > 0) {
|
|
142
|
-
let e =
|
|
189
|
+
let e = T({
|
|
143
190
|
stagedOperations: t.stagedOperations,
|
|
144
191
|
tagName: n.tagName,
|
|
145
192
|
id: n.id
|
|
@@ -149,11 +196,11 @@ async function E(e) {
|
|
|
149
196
|
}
|
|
150
197
|
let r;
|
|
151
198
|
if (n.id === void 0) {
|
|
152
|
-
let e = `__singleton_${n.tagName}`, i =
|
|
153
|
-
i ? r = i : (r = (await t.store.getByTagNameInDocument(n.tagName, t.documentId))[0], r &&
|
|
199
|
+
let e = `__singleton_${n.tagName}`, i = _t(t) ? t.recordCache.get(e) : void 0;
|
|
200
|
+
i ? (t.perf.count("core::query::getRecord.cacheHit"), r = i) : (t.perf.count("core::query::getRecord.miss"), t.perf.count("core::store::getByTagName"), r = (await t.store.getByTagNameInDocument(n.tagName, t.documentId))[0], r && _t(t) && (t.recordCache.set(r.id, r), t.recordCache.set(e, r)));
|
|
154
201
|
} else {
|
|
155
|
-
let e =
|
|
156
|
-
e ? r = e : (r = await t.store.get(n.id, t.documentId), r &&
|
|
202
|
+
let e = _t(t) ? t.recordCache.get(n.id) : void 0;
|
|
203
|
+
e ? (t.perf.count("core::query::getRecord.cacheHit"), r = e) : (t.perf.count("core::query::getRecord.miss"), t.perf.count("core::store::get"), r = await t.store.get(n.id, t.documentId), r && _t(t) && t.recordCache.set(n.id, r));
|
|
157
204
|
}
|
|
158
205
|
if (r) return r.tagName !== n.tagName && a("ELEMENT_TAGNAME_MISMATCH", {
|
|
159
206
|
detail: `Expected tagName '${n.tagName}', got '${r.tagName}' for id '${n.id}'`,
|
|
@@ -170,16 +217,18 @@ async function D(e) {
|
|
|
170
217
|
ref: e
|
|
171
218
|
})));
|
|
172
219
|
}
|
|
173
|
-
async function
|
|
174
|
-
let { context: t, tagName: n } = e
|
|
175
|
-
|
|
176
|
-
|
|
220
|
+
async function O(e) {
|
|
221
|
+
let { context: t, tagName: n } = e;
|
|
222
|
+
t.perf.count("core::store::getByTagName");
|
|
223
|
+
let r = await t.store.getByTagNameInDocument(n, t.documentId);
|
|
224
|
+
for (let e of r) _t(t) && t.recordCache.set(e.id, e);
|
|
225
|
+
return ne({
|
|
177
226
|
rawRecords: r,
|
|
178
227
|
stagedOperations: t.stagedOperations,
|
|
179
228
|
tagName: n
|
|
180
229
|
});
|
|
181
230
|
}
|
|
182
|
-
async function
|
|
231
|
+
async function k(e) {
|
|
183
232
|
let { context: t, ref: n, tagName: r } = e, i = await E({
|
|
184
233
|
context: t,
|
|
185
234
|
ref: n
|
|
@@ -206,7 +255,7 @@ async function O(e) {
|
|
|
206
255
|
});
|
|
207
256
|
}
|
|
208
257
|
}
|
|
209
|
-
async function
|
|
258
|
+
async function A(e) {
|
|
210
259
|
let { context: t, ref: n, tagName: r } = e, i = await E({
|
|
211
260
|
context: t,
|
|
212
261
|
ref: n
|
|
@@ -236,7 +285,7 @@ async function k(e) {
|
|
|
236
285
|
refs: c
|
|
237
286
|
})).filter((e) => e !== void 0) : [];
|
|
238
287
|
}
|
|
239
|
-
async function
|
|
288
|
+
async function ae(e) {
|
|
240
289
|
let { context: t, ref: n, options: r } = e, i = r?.depth ?? Infinity, a = r?.stopAtTagName, o = r?.order ?? "bottom-up", s = [], c = await E({
|
|
241
290
|
context: t,
|
|
242
291
|
ref: n
|
|
@@ -252,7 +301,7 @@ async function A(e) {
|
|
|
252
301
|
return o === "top-down" ? s.reverse() : s;
|
|
253
302
|
}
|
|
254
303
|
async function j(e) {
|
|
255
|
-
let { context: t, tagName: n, attributes: r } = e, i = await
|
|
304
|
+
let { context: t, tagName: n, attributes: r } = e, i = await O({
|
|
256
305
|
context: t,
|
|
257
306
|
tagName: n
|
|
258
307
|
}), a = [];
|
|
@@ -275,28 +324,28 @@ function M(e) {
|
|
|
275
324
|
}
|
|
276
325
|
return !0;
|
|
277
326
|
}
|
|
278
|
-
async function
|
|
279
|
-
let { context: t, ref: n, options: r } = e, { collect: i, omit: a } = r, o =
|
|
327
|
+
async function oe(e) {
|
|
328
|
+
let { context: t, ref: n, options: r } = e, { collect: i, omit: a } = r, o = N(a), s = se(i), c = /* @__PURE__ */ new Map();
|
|
280
329
|
for (let e of s.allTags) c.set(e, /* @__PURE__ */ new Map());
|
|
281
330
|
let l = await E({
|
|
282
331
|
context: t,
|
|
283
332
|
ref: n
|
|
284
333
|
});
|
|
285
|
-
return l && (s.mode === "flat" ? await
|
|
334
|
+
return l && (s.mode === "flat" ? await ue({
|
|
286
335
|
context: t,
|
|
287
336
|
rootId: l.id,
|
|
288
337
|
collectSpec: s,
|
|
289
338
|
omitSpec: o,
|
|
290
339
|
collected: c
|
|
291
|
-
}) : await
|
|
340
|
+
}) : await fe({
|
|
292
341
|
context: t,
|
|
293
342
|
record: l,
|
|
294
343
|
pathNodes: s.paths,
|
|
295
344
|
omitSpec: o,
|
|
296
345
|
collected: c
|
|
297
|
-
})),
|
|
346
|
+
})), me(c);
|
|
298
347
|
}
|
|
299
|
-
function
|
|
348
|
+
function N(e) {
|
|
300
349
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
301
350
|
if (!e) return {
|
|
302
351
|
unconditional: t,
|
|
@@ -315,7 +364,7 @@ function P(e) {
|
|
|
315
364
|
conditional: n
|
|
316
365
|
};
|
|
317
366
|
}
|
|
318
|
-
function
|
|
367
|
+
function P(e) {
|
|
319
368
|
let { record: t, omitSpec: n } = e;
|
|
320
369
|
if (n.unconditional.has(t.tagName)) return !0;
|
|
321
370
|
for (let e of n.conditional) if (e.tagName === t.tagName && M({
|
|
@@ -324,7 +373,7 @@ function ie(e) {
|
|
|
324
373
|
})) return !0;
|
|
325
374
|
return !1;
|
|
326
375
|
}
|
|
327
|
-
function
|
|
376
|
+
function se(e) {
|
|
328
377
|
if (typeof e == "string") return {
|
|
329
378
|
mode: "flat",
|
|
330
379
|
targets: [{ tagName: e }],
|
|
@@ -346,16 +395,16 @@ function ae(e) {
|
|
|
346
395
|
let t = /* @__PURE__ */ new Set();
|
|
347
396
|
return {
|
|
348
397
|
mode: "path",
|
|
349
|
-
paths:
|
|
398
|
+
paths: ce(e, t),
|
|
350
399
|
allTags: t
|
|
351
400
|
};
|
|
352
401
|
}
|
|
353
|
-
function
|
|
402
|
+
function ce(e, t) {
|
|
354
403
|
let n = [];
|
|
355
404
|
for (let [r, i] of Object.entries(e)) {
|
|
356
405
|
if (r === "where") continue;
|
|
357
406
|
t.add(r);
|
|
358
|
-
let e =
|
|
407
|
+
let e = le({
|
|
359
408
|
tagName: r,
|
|
360
409
|
value: i,
|
|
361
410
|
allTags: t
|
|
@@ -364,7 +413,7 @@ function F(e, t) {
|
|
|
364
413
|
}
|
|
365
414
|
return n;
|
|
366
415
|
}
|
|
367
|
-
function
|
|
416
|
+
function le(e) {
|
|
368
417
|
let { tagName: t, value: n, allTags: r } = e;
|
|
369
418
|
if (n === !0) return {
|
|
370
419
|
tagName: t,
|
|
@@ -385,25 +434,25 @@ function oe(e) {
|
|
|
385
434
|
return {
|
|
386
435
|
tagName: t,
|
|
387
436
|
where: a,
|
|
388
|
-
children:
|
|
437
|
+
children: ce(s, r),
|
|
389
438
|
isLeaf: !1
|
|
390
439
|
};
|
|
391
440
|
}
|
|
392
|
-
async function
|
|
441
|
+
async function ue(e) {
|
|
393
442
|
let { context: t, rootId: n, collectSpec: r, omitSpec: i, collected: a } = e;
|
|
394
443
|
for (let e of r.targets) {
|
|
395
444
|
if (i.unconditional.has(e.tagName)) continue;
|
|
396
|
-
let r = await
|
|
445
|
+
let r = await O({
|
|
397
446
|
context: t,
|
|
398
447
|
tagName: e.tagName
|
|
399
448
|
});
|
|
400
|
-
for (let o of r)
|
|
449
|
+
for (let o of r) F({
|
|
401
450
|
record: o,
|
|
402
451
|
where: e.where
|
|
403
|
-
}) && (
|
|
452
|
+
}) && (P({
|
|
404
453
|
record: o,
|
|
405
454
|
omitSpec: i
|
|
406
|
-
}) || await
|
|
455
|
+
}) || await de({
|
|
407
456
|
context: t,
|
|
408
457
|
record: o,
|
|
409
458
|
rootId: n,
|
|
@@ -411,14 +460,14 @@ async function se(e) {
|
|
|
411
460
|
}) && a.get(e.tagName).set(o.id, o));
|
|
412
461
|
}
|
|
413
462
|
}
|
|
414
|
-
function
|
|
463
|
+
function F(e) {
|
|
415
464
|
let { record: t, where: n } = e;
|
|
416
465
|
return n ? M({
|
|
417
466
|
record: t,
|
|
418
467
|
attributeFilter: n
|
|
419
468
|
}) : !0;
|
|
420
469
|
}
|
|
421
|
-
async function
|
|
470
|
+
async function de(e) {
|
|
422
471
|
let { context: t, record: n, rootId: r, omitSpec: i } = e;
|
|
423
472
|
if (n.id === r) return !0;
|
|
424
473
|
let a = n;
|
|
@@ -429,7 +478,7 @@ async function le(e) {
|
|
|
429
478
|
context: t,
|
|
430
479
|
ref: f(a.parent)
|
|
431
480
|
});
|
|
432
|
-
if (!e ||
|
|
481
|
+
if (!e || P({
|
|
433
482
|
record: e,
|
|
434
483
|
omitSpec: i
|
|
435
484
|
})) return !1;
|
|
@@ -437,12 +486,12 @@ async function le(e) {
|
|
|
437
486
|
}
|
|
438
487
|
return !1;
|
|
439
488
|
}
|
|
440
|
-
async function
|
|
489
|
+
async function fe(e) {
|
|
441
490
|
let { context: t, record: n, pathNodes: r, omitSpec: i, collected: a } = e;
|
|
442
491
|
if (!n.children?.length) return;
|
|
443
492
|
let o = new Set(r.map((e) => e.tagName));
|
|
444
493
|
for (let e of r) {
|
|
445
|
-
let r = await
|
|
494
|
+
let r = await I({
|
|
446
495
|
context: t,
|
|
447
496
|
record: n,
|
|
448
497
|
tagName: e.tagName,
|
|
@@ -450,7 +499,7 @@ async function I(e) {
|
|
|
450
499
|
omitSpec: i,
|
|
451
500
|
stopAtTagNames: o
|
|
452
501
|
});
|
|
453
|
-
for (let n of r) a.get(e.tagName).set(n.id, n), !e.isLeaf && e.children.length > 0 && await
|
|
502
|
+
for (let n of r) a.get(e.tagName).set(n.id, n), !e.isLeaf && e.children.length > 0 && await fe({
|
|
454
503
|
context: t,
|
|
455
504
|
record: n,
|
|
456
505
|
pathNodes: e.children,
|
|
@@ -459,10 +508,10 @@ async function I(e) {
|
|
|
459
508
|
});
|
|
460
509
|
}
|
|
461
510
|
}
|
|
462
|
-
async function
|
|
511
|
+
async function I(e) {
|
|
463
512
|
let { context: t, record: n, tagName: r, where: i, omitSpec: a, stopAtTagNames: o } = e, s = [];
|
|
464
513
|
if (!n.children?.length) return s;
|
|
465
|
-
let c = [], l = await
|
|
514
|
+
let c = [], l = await pe({
|
|
466
515
|
context: t,
|
|
467
516
|
record: n,
|
|
468
517
|
omitSpec: a
|
|
@@ -470,14 +519,14 @@ async function ue(e) {
|
|
|
470
519
|
for (c.push(...l); c.length > 0;) {
|
|
471
520
|
let e = c.shift();
|
|
472
521
|
if (e.tagName === r) {
|
|
473
|
-
|
|
522
|
+
F({
|
|
474
523
|
record: e,
|
|
475
524
|
where: i
|
|
476
525
|
}) && s.push(e);
|
|
477
526
|
continue;
|
|
478
527
|
}
|
|
479
528
|
if (!(o.has(e.tagName) && e.tagName !== r) && e.children?.length) {
|
|
480
|
-
let n = await
|
|
529
|
+
let n = await pe({
|
|
481
530
|
context: t,
|
|
482
531
|
record: e,
|
|
483
532
|
omitSpec: a
|
|
@@ -487,28 +536,28 @@ async function ue(e) {
|
|
|
487
536
|
}
|
|
488
537
|
return s;
|
|
489
538
|
}
|
|
490
|
-
async function
|
|
539
|
+
async function pe(e) {
|
|
491
540
|
let { context: t, record: n, omitSpec: r } = e;
|
|
492
541
|
if (!n.children?.length) return [];
|
|
493
542
|
let i = n.children.filter((e) => !r.unconditional.has(e.tagName));
|
|
494
543
|
return i.length ? (await Promise.all(i.map((e) => E({
|
|
495
544
|
context: t,
|
|
496
545
|
ref: f(e)
|
|
497
|
-
})))).filter((e) => e !== void 0 && !
|
|
546
|
+
})))).filter((e) => e !== void 0 && !P({
|
|
498
547
|
record: e,
|
|
499
548
|
omitSpec: r
|
|
500
549
|
})) : [];
|
|
501
550
|
}
|
|
502
|
-
function
|
|
551
|
+
function me(e) {
|
|
503
552
|
let t = {};
|
|
504
553
|
for (let [n, r] of e.entries()) t[n] = Array.from(r.values());
|
|
505
554
|
return t;
|
|
506
555
|
}
|
|
507
|
-
async function
|
|
556
|
+
async function he(e) {
|
|
508
557
|
let { context: t, ref: r, name: i, namespace: a, defaults: o = "optional" } = e, s = await E({
|
|
509
558
|
context: t,
|
|
510
559
|
ref: r
|
|
511
|
-
}), c = s?.attributes ?? [], l =
|
|
560
|
+
}), c = s?.attributes ?? [], l = _e(t.dialecteConfig, i, a), u = c.find((e) => e.name === l);
|
|
512
561
|
return u ? u.value : (s ? n({
|
|
513
562
|
dialecteConfig: t.dialecteConfig,
|
|
514
563
|
tagName: s.tagName,
|
|
@@ -516,11 +565,11 @@ async function fe(e) {
|
|
|
516
565
|
defaults: o
|
|
517
566
|
}) : void 0) ?? "";
|
|
518
567
|
}
|
|
519
|
-
async function
|
|
568
|
+
async function ge(e) {
|
|
520
569
|
let { context: t, ref: r, name: a, namespace: o, defaults: s = "optional" } = e, { dialecteConfig: c } = t, l = await E({
|
|
521
570
|
context: t,
|
|
522
571
|
ref: r
|
|
523
|
-
}), u = l?.attributes ?? [], d =
|
|
572
|
+
}), u = l?.attributes ?? [], d = _e(c, a, o), f = u.find((e) => e.name === d);
|
|
524
573
|
if (f) return f;
|
|
525
574
|
if (!l || s === "none") return;
|
|
526
575
|
let p = n({
|
|
@@ -541,23 +590,23 @@ async function pe(e) {
|
|
|
541
590
|
namespace: m
|
|
542
591
|
};
|
|
543
592
|
}
|
|
544
|
-
function
|
|
593
|
+
function _e(e, n, r) {
|
|
545
594
|
if (r === void 0) return n;
|
|
546
595
|
let i = t(e, r);
|
|
547
596
|
return i ? `${i}:${n}` : n;
|
|
548
597
|
}
|
|
549
|
-
async function
|
|
598
|
+
async function ve(e) {
|
|
550
599
|
let { context: r, ref: i, namespace: a, defaults: o = "optional" } = e, { dialecteConfig: s } = r, c = await E({
|
|
551
600
|
context: r,
|
|
552
601
|
ref: i
|
|
553
602
|
}), l = c?.attributes ?? [], u = a === void 0 ? "" : t(s, a), d = l.reduce((e, t) => {
|
|
554
|
-
let { prefix: n, local: r, isXmlns: i } =
|
|
603
|
+
let { prefix: n, local: r, isXmlns: i } = be(t.name);
|
|
555
604
|
return i || n !== u || (e[r] = t.value ?? ""), e;
|
|
556
605
|
}, {});
|
|
557
606
|
if (c && o !== "none") {
|
|
558
607
|
let e = s.definition[c.tagName]?.attributes.sequence ?? [];
|
|
559
608
|
for (let t of e) {
|
|
560
|
-
let { prefix: e, local: r, isXmlns: i } =
|
|
609
|
+
let { prefix: e, local: r, isXmlns: i } = be(t);
|
|
561
610
|
if (i || e !== u || r in d) continue;
|
|
562
611
|
let a = n({
|
|
563
612
|
dialecteConfig: s,
|
|
@@ -570,7 +619,7 @@ async function he(e) {
|
|
|
570
619
|
}
|
|
571
620
|
return d;
|
|
572
621
|
}
|
|
573
|
-
async function
|
|
622
|
+
async function ye(e) {
|
|
574
623
|
let { context: t, ref: r, defaults: a = "optional" } = e, { dialecteConfig: o } = t, s = await E({
|
|
575
624
|
context: t,
|
|
576
625
|
ref: r
|
|
@@ -600,7 +649,7 @@ async function ge(e) {
|
|
|
600
649
|
}
|
|
601
650
|
return c;
|
|
602
651
|
}
|
|
603
|
-
function
|
|
652
|
+
function be(e) {
|
|
604
653
|
if (e === "xmlns" || e.startsWith("xmlns:")) return {
|
|
605
654
|
prefix: "",
|
|
606
655
|
local: e,
|
|
@@ -617,7 +666,7 @@ function _e(e) {
|
|
|
617
666
|
isXmlns: !1
|
|
618
667
|
};
|
|
619
668
|
}
|
|
620
|
-
function
|
|
669
|
+
function L(e) {
|
|
621
670
|
let { tree: t, unwrapTagNames: n } = e;
|
|
622
671
|
function r(e) {
|
|
623
672
|
return e.flatMap((e) => n.includes(e.tagName) ? r(e.tree) : [{
|
|
@@ -630,7 +679,7 @@ function ve(e) {
|
|
|
630
679
|
tree: r(t.tree)
|
|
631
680
|
};
|
|
632
681
|
}
|
|
633
|
-
function
|
|
682
|
+
function xe(e) {
|
|
634
683
|
let t = /* @__PURE__ */ new Set(), n = [];
|
|
635
684
|
if (!e) return {
|
|
636
685
|
unconditional: t,
|
|
@@ -657,32 +706,32 @@ function ye(e) {
|
|
|
657
706
|
conditional: n
|
|
658
707
|
};
|
|
659
708
|
}
|
|
660
|
-
function
|
|
709
|
+
function Se(e) {
|
|
661
710
|
let { record: t, compiledOmit: n } = e;
|
|
662
711
|
return n.unconditional.has(t.tagName) ? !0 : n.conditional.some((e) => e.scope === "self" && e.tagName === t.tagName && M({
|
|
663
712
|
record: t,
|
|
664
713
|
attributeFilter: e.where
|
|
665
714
|
}));
|
|
666
715
|
}
|
|
667
|
-
function
|
|
716
|
+
function Ce(e) {
|
|
668
717
|
let { record: t, compiledOmit: n } = e;
|
|
669
718
|
return n.conditional.some((e) => e.scope === "children" && e.tagName === t.tagName && M({
|
|
670
719
|
record: t,
|
|
671
720
|
attributeFilter: e.where
|
|
672
721
|
}));
|
|
673
722
|
}
|
|
674
|
-
function
|
|
723
|
+
function we(e) {
|
|
675
724
|
let { tree: t, omit: n } = e;
|
|
676
725
|
if (!n?.length) return t;
|
|
677
|
-
let r =
|
|
678
|
-
if (
|
|
726
|
+
let r = xe(n), i = (e) => {
|
|
727
|
+
if (Ce({
|
|
679
728
|
record: e,
|
|
680
729
|
compiledOmit: r
|
|
681
730
|
})) return {
|
|
682
731
|
...e,
|
|
683
732
|
tree: []
|
|
684
733
|
};
|
|
685
|
-
let t = e.tree.filter((e) => !
|
|
734
|
+
let t = e.tree.filter((e) => !Se({
|
|
686
735
|
record: e,
|
|
687
736
|
compiledOmit: r
|
|
688
737
|
})).map((e) => i(e));
|
|
@@ -693,7 +742,7 @@ function xe(e) {
|
|
|
693
742
|
};
|
|
694
743
|
return i(t);
|
|
695
744
|
}
|
|
696
|
-
function
|
|
745
|
+
function Te(e) {
|
|
697
746
|
let { tree: t, childrenConfig: n } = e, i = (e) => {
|
|
698
747
|
if (e.tree.length === 0) return e;
|
|
699
748
|
let t = r({
|
|
@@ -708,7 +757,7 @@ function Se(e) {
|
|
|
708
757
|
};
|
|
709
758
|
return i(t);
|
|
710
759
|
}
|
|
711
|
-
async function
|
|
760
|
+
async function Ee(e) {
|
|
712
761
|
let { context: t, ref: n, options: r = {}, dialecteConfig: i } = e, { select: a, omit: s, unwrap: c } = r, l = await E({
|
|
713
762
|
context: t,
|
|
714
763
|
ref: n
|
|
@@ -717,7 +766,7 @@ async function Ce(e) {
|
|
|
717
766
|
detail: "No record found for provided ref",
|
|
718
767
|
key: "ELEMENT_NOT_FOUND"
|
|
719
768
|
});
|
|
720
|
-
let u =
|
|
769
|
+
let u = xe(s), d = t.dialecteConfig.transparentElements, f = await De({
|
|
721
770
|
context: t,
|
|
722
771
|
record: l,
|
|
723
772
|
select: a,
|
|
@@ -727,21 +776,21 @@ async function Ce(e) {
|
|
|
727
776
|
});
|
|
728
777
|
if (!f) return p({ record: l });
|
|
729
778
|
let m = c ?? (d?.length ? d : void 0);
|
|
730
|
-
return
|
|
731
|
-
tree: m ?
|
|
779
|
+
return Te({
|
|
780
|
+
tree: m ? L({
|
|
732
781
|
tree: f,
|
|
733
782
|
unwrapTagNames: m
|
|
734
783
|
}) : f,
|
|
735
784
|
childrenConfig: t.dialecteConfig.children
|
|
736
785
|
});
|
|
737
786
|
}
|
|
738
|
-
async function
|
|
787
|
+
async function De(e) {
|
|
739
788
|
let { context: t, record: n, select: r, compiledOmit: i, dialecteConfig: a, transparentElements: o } = e;
|
|
740
|
-
if (
|
|
789
|
+
if (Ce({
|
|
741
790
|
record: n,
|
|
742
791
|
compiledOmit: i
|
|
743
792
|
})) return p({ record: n });
|
|
744
|
-
let s = await
|
|
793
|
+
let s = await Oe({
|
|
745
794
|
context: t,
|
|
746
795
|
record: n,
|
|
747
796
|
select: r,
|
|
@@ -751,7 +800,7 @@ async function we(e) {
|
|
|
751
800
|
});
|
|
752
801
|
return p({
|
|
753
802
|
record: n,
|
|
754
|
-
tree: (await Promise.all(s.map(({ record: e, select: n }) =>
|
|
803
|
+
tree: (await Promise.all(s.map(({ record: e, select: n }) => De({
|
|
755
804
|
context: t,
|
|
756
805
|
record: e,
|
|
757
806
|
select: n,
|
|
@@ -761,25 +810,25 @@ async function we(e) {
|
|
|
761
810
|
})))).filter((e) => e !== null)
|
|
762
811
|
});
|
|
763
812
|
}
|
|
764
|
-
async function
|
|
813
|
+
async function Oe(e) {
|
|
765
814
|
let { context: t, record: n, select: r, compiledOmit: i, dialecteConfig: a, transparentElements: o } = e;
|
|
766
815
|
if (!n.children?.length) return [];
|
|
767
|
-
let s = r ?
|
|
816
|
+
let s = r ? je(r) : void 0;
|
|
768
817
|
if (s && r && a && r.recursive !== !1) {
|
|
769
818
|
let e = n.tagName, t = a.children[e], i = r[e] !== void 0;
|
|
770
819
|
t?.includes(e) && !i && s.add(e);
|
|
771
820
|
}
|
|
772
|
-
let c = n.children.filter((e) =>
|
|
821
|
+
let c = n.children.filter((e) => ke({
|
|
773
822
|
tagName: e.tagName,
|
|
774
823
|
compiledOmit: i,
|
|
775
824
|
selectKeys: s,
|
|
776
825
|
transparentElements: o
|
|
777
826
|
}));
|
|
778
|
-
return c.length ?
|
|
827
|
+
return c.length ? Me({
|
|
779
828
|
children: (await Promise.all(c.map((e) => E({
|
|
780
829
|
context: t,
|
|
781
830
|
ref: f(e)
|
|
782
|
-
})))).filter((e) => e !== void 0).filter((e) => !
|
|
831
|
+
})))).filter((e) => e !== void 0).filter((e) => !Se({
|
|
783
832
|
record: e,
|
|
784
833
|
compiledOmit: i
|
|
785
834
|
})),
|
|
@@ -789,17 +838,17 @@ async function Te(e) {
|
|
|
789
838
|
transparentElements: o
|
|
790
839
|
}) : [];
|
|
791
840
|
}
|
|
792
|
-
function
|
|
841
|
+
function ke(e) {
|
|
793
842
|
let { tagName: t, compiledOmit: n, selectKeys: r, transparentElements: i } = e;
|
|
794
843
|
return n.unconditional.has(t) ? !1 : r && !r.has(t) ? !!i?.includes(t) : !0;
|
|
795
844
|
}
|
|
796
|
-
var
|
|
797
|
-
function
|
|
845
|
+
var Ae = /* @__PURE__ */ new Set(["where", "recursive"]);
|
|
846
|
+
function je(e) {
|
|
798
847
|
let t = /* @__PURE__ */ new Set();
|
|
799
|
-
for (let n of Object.keys(e))
|
|
848
|
+
for (let n of Object.keys(e)) Ae.has(n) || t.add(n);
|
|
800
849
|
return t;
|
|
801
850
|
}
|
|
802
|
-
function
|
|
851
|
+
function Me(e) {
|
|
803
852
|
let { children: t, select: n, record: r, dialecteConfig: i, transparentElements: a } = e;
|
|
804
853
|
if (!n) return t.map((e) => ({
|
|
805
854
|
record: e,
|
|
@@ -816,7 +865,7 @@ function ke(e) {
|
|
|
816
865
|
continue;
|
|
817
866
|
}
|
|
818
867
|
if (t === void 0 && e.tagName === r.tagName) {
|
|
819
|
-
let t =
|
|
868
|
+
let t = R({
|
|
820
869
|
child: e,
|
|
821
870
|
select: n,
|
|
822
871
|
dialecteConfig: i
|
|
@@ -834,7 +883,7 @@ function ke(e) {
|
|
|
834
883
|
});
|
|
835
884
|
continue;
|
|
836
885
|
}
|
|
837
|
-
let s =
|
|
886
|
+
let s = Ne({
|
|
838
887
|
child: e,
|
|
839
888
|
entry: t,
|
|
840
889
|
parentRecord: r
|
|
@@ -843,7 +892,7 @@ function ke(e) {
|
|
|
843
892
|
}
|
|
844
893
|
return o;
|
|
845
894
|
}
|
|
846
|
-
function
|
|
895
|
+
function R(e) {
|
|
847
896
|
let { child: t, select: n, dialecteConfig: r } = e;
|
|
848
897
|
if (!(!r || n.recursive === !1) && r.children[t.tagName]?.includes(t.tagName) && !(n.where && !M({
|
|
849
898
|
record: t,
|
|
@@ -853,7 +902,7 @@ function Ae(e) {
|
|
|
853
902
|
select: n
|
|
854
903
|
};
|
|
855
904
|
}
|
|
856
|
-
function
|
|
905
|
+
function Ne(e) {
|
|
857
906
|
let { child: t, entry: n, parentRecord: r } = e, i = n;
|
|
858
907
|
if (!(i.where && !M({
|
|
859
908
|
record: t,
|
|
@@ -871,7 +920,7 @@ function je(e) {
|
|
|
871
920
|
}
|
|
872
921
|
return i.recursive ? {
|
|
873
922
|
record: t,
|
|
874
|
-
select:
|
|
923
|
+
select: Pe(i, t.tagName)
|
|
875
924
|
} : t.tagName === r.tagName ? {
|
|
876
925
|
record: t,
|
|
877
926
|
select: {
|
|
@@ -884,16 +933,16 @@ function je(e) {
|
|
|
884
933
|
};
|
|
885
934
|
}
|
|
886
935
|
}
|
|
887
|
-
function
|
|
936
|
+
function Pe(e, t) {
|
|
888
937
|
return e[t], e;
|
|
889
938
|
}
|
|
890
|
-
async function
|
|
939
|
+
async function Fe(e) {
|
|
891
940
|
let { context: t, ref: n, ancestors: r = 0, depth: i, includeDeleted: a = !1 } = e;
|
|
892
|
-
if (!n && i === void 0) return
|
|
941
|
+
if (!n && i === void 0) return z({
|
|
893
942
|
context: t,
|
|
894
943
|
includeDeleted: a
|
|
895
944
|
});
|
|
896
|
-
let s = e.siblings ?? !1, c = s === !0 || typeof s == "object" && !!s, l = typeof s == "object" && !!s && s.expand === !0, u = n ?? { tagName: t.dialecteConfig.rootElementName }, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = a ?
|
|
945
|
+
let s = e.siblings ?? !1, c = s === !0 || typeof s == "object" && !!s, l = typeof s == "object" && !!s && s.expand === !0, u = n ?? { tagName: t.dialecteConfig.rootElementName }, d = /* @__PURE__ */ new Map(), p = /* @__PURE__ */ new Map(), m = a ? ie(t.stagedOperations) : void 0, h = (e) => {
|
|
897
946
|
if (m) for (let t of m.get(e) ?? []) p.has(t.id) || (p.set(t.id, t), h(t.id));
|
|
898
947
|
}, g = async (e, n) => {
|
|
899
948
|
if (d.set(e.id, e), h(e.id), !(i !== void 0 && n >= i)) for (let r of e.children) {
|
|
@@ -915,7 +964,7 @@ async function Me(e) {
|
|
|
915
964
|
await g(_, 0);
|
|
916
965
|
let y = Math.max(r, +!!c);
|
|
917
966
|
if (y > 0) {
|
|
918
|
-
let e = await
|
|
967
|
+
let e = await ae({
|
|
919
968
|
context: t,
|
|
920
969
|
ref: u,
|
|
921
970
|
options: {
|
|
@@ -939,14 +988,14 @@ async function Me(e) {
|
|
|
939
988
|
}
|
|
940
989
|
}
|
|
941
990
|
}
|
|
942
|
-
return
|
|
991
|
+
return Ie({
|
|
943
992
|
live: d,
|
|
944
993
|
deletedById: p,
|
|
945
994
|
rootId: v
|
|
946
995
|
});
|
|
947
996
|
}
|
|
948
|
-
async function
|
|
949
|
-
let { context: t, includeDeleted: n = !1 } = e, { live: r, deleted: i } =
|
|
997
|
+
async function z(e) {
|
|
998
|
+
let { context: t, includeDeleted: n = !1 } = e, { live: r, deleted: i } = re({
|
|
950
999
|
rawRecords: await t.store.getByDocumentId(t.documentId),
|
|
951
1000
|
stagedOperations: t.stagedOperations,
|
|
952
1001
|
includeDeleted: n
|
|
@@ -958,13 +1007,13 @@ async function Ne(e) {
|
|
|
958
1007
|
return o(a, {
|
|
959
1008
|
key: "ROOT_NOT_FOUND",
|
|
960
1009
|
detail: `No ${t.dialecteConfig.rootElementName} root element found in document`
|
|
961
|
-
}),
|
|
1010
|
+
}), Ie({
|
|
962
1011
|
live: r,
|
|
963
1012
|
deletedById: new Map(i.map((e) => [e.id, e])),
|
|
964
1013
|
rootId: a
|
|
965
1014
|
});
|
|
966
1015
|
}
|
|
967
|
-
function
|
|
1016
|
+
function Ie(e) {
|
|
968
1017
|
let { live: t, deletedById: n, rootId: r } = e, i = new Set(t.keys()), a = Array.from(t.values()).map((e) => ({
|
|
969
1018
|
...e,
|
|
970
1019
|
children: e.children.filter((e) => i.has(e.id))
|
|
@@ -978,7 +1027,7 @@ function Pe(e) {
|
|
|
978
1027
|
rootId: r
|
|
979
1028
|
};
|
|
980
1029
|
}
|
|
981
|
-
function
|
|
1030
|
+
function Le(e) {
|
|
982
1031
|
let { liveRecords: t, deletedRecords: n, rootId: r } = e, i = new Map(t.map((e) => [e.id, e])), a = new Map(n.map((e) => [e.id, e])), s = /* @__PURE__ */ new Map();
|
|
983
1032
|
for (let e of n) {
|
|
984
1033
|
let t = e.parent?.id;
|
|
@@ -1000,7 +1049,7 @@ function B(e) {
|
|
|
1000
1049
|
};
|
|
1001
1050
|
return l(c, "live");
|
|
1002
1051
|
}
|
|
1003
|
-
var
|
|
1052
|
+
var Re = /* @__PURE__ */ b(((e, t) => {
|
|
1004
1053
|
Object.defineProperty(e, "__esModule", { value: !0 }), e.ParsingError = void 0;
|
|
1005
1054
|
var n = class extends Error {
|
|
1006
1055
|
constructor(e, t) {
|
|
@@ -1164,12 +1213,12 @@ var Fe = /* @__PURE__ */ b(((e, t) => {
|
|
|
1164
1213
|
}, o();
|
|
1165
1214
|
}
|
|
1166
1215
|
t !== void 0 && typeof e == "object" && (t.exports = v), e.default = v;
|
|
1167
|
-
})),
|
|
1216
|
+
})), ze = /* @__PURE__ */ b(((e, t) => {
|
|
1168
1217
|
var n = e && e.__importDefault || function(e) {
|
|
1169
1218
|
return e && e.__esModule ? e : { default: e };
|
|
1170
1219
|
};
|
|
1171
1220
|
Object.defineProperty(e, "__esModule", { value: !0 });
|
|
1172
|
-
var r = n(
|
|
1221
|
+
var r = n(Re());
|
|
1173
1222
|
function i(e) {
|
|
1174
1223
|
if (!e.options.indentation && !e.options.lineSeparator) return;
|
|
1175
1224
|
e.content += e.options.lineSeparator;
|
|
@@ -1258,16 +1307,16 @@ var Fe = /* @__PURE__ */ b(((e, t) => {
|
|
|
1258
1307
|
indentation: "",
|
|
1259
1308
|
lineSeparator: ""
|
|
1260
1309
|
})), t !== void 0 && typeof e == "object" && (t.exports = p), e.default = p;
|
|
1261
|
-
})),
|
|
1262
|
-
function
|
|
1263
|
-
return (0,
|
|
1310
|
+
})), Be = /* @__PURE__ */ S(ze(), 1);
|
|
1311
|
+
function Ve(e) {
|
|
1312
|
+
return (0, Be.default)(e);
|
|
1264
1313
|
}
|
|
1265
|
-
var
|
|
1266
|
-
function
|
|
1314
|
+
var He = "_temp-idb-id";
|
|
1315
|
+
function Ue(e, t = {}) {
|
|
1267
1316
|
let { includeXmlDeclaration: n = !0 } = t, r = new XMLSerializer().serializeToString(e);
|
|
1268
|
-
return
|
|
1317
|
+
return Ve(n ? "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + r : r);
|
|
1269
1318
|
}
|
|
1270
|
-
function
|
|
1319
|
+
function We(e) {
|
|
1271
1320
|
let { records: t, config: n, withDatabaseIds: r = !1, rootId: i, declareNamespaces: a = !0 } = e, s = /* @__PURE__ */ new Map(), c;
|
|
1272
1321
|
for (let e of t) s.set(e.id, e), e.tagName === n.rootElementName && (c = e);
|
|
1273
1322
|
let l = i ? s.get(i) : c;
|
|
@@ -1275,13 +1324,13 @@ function Ve(e) {
|
|
|
1275
1324
|
detail: i ? `No record found for rootId "${i}"` : `No ${n.rootElementName} root element found in records`,
|
|
1276
1325
|
key: "EXPORT_ROOT_NOT_FOUND"
|
|
1277
1326
|
});
|
|
1278
|
-
let u = l.tagName !== n.rootElementName, d = n.namespaces.default, f = document.implementation.createDocument(d.uri, null, null), p =
|
|
1327
|
+
let u = l.tagName !== n.rootElementName, d = n.namespaces.default, f = document.implementation.createDocument(d.uri, null, null), p = Ke({
|
|
1279
1328
|
document: f,
|
|
1280
1329
|
record: l,
|
|
1281
1330
|
defaultNamespace: d,
|
|
1282
1331
|
declareNamespaces: a
|
|
1283
1332
|
});
|
|
1284
|
-
return a && p.setAttribute("xmlns", l.namespace.uri), l.attributes &&
|
|
1333
|
+
return a && p.setAttribute("xmlns", l.namespace.uri), l.attributes && V({
|
|
1285
1334
|
config: n,
|
|
1286
1335
|
document: f,
|
|
1287
1336
|
element: p,
|
|
@@ -1289,11 +1338,11 @@ function Ve(e) {
|
|
|
1289
1338
|
isRoot: !0,
|
|
1290
1339
|
isFragment: u,
|
|
1291
1340
|
declareNamespaces: a
|
|
1292
|
-
}), u ||
|
|
1341
|
+
}), u || Je({
|
|
1293
1342
|
config: n,
|
|
1294
1343
|
rootElement: p,
|
|
1295
1344
|
namespace: l.namespace
|
|
1296
|
-
}), l.value && (p.textContent = l.value.trim()), r && p.setAttribute("_temp-idb-id", l.id), f.appendChild(p),
|
|
1345
|
+
}), l.value && (p.textContent = l.value.trim()), r && p.setAttribute("_temp-idb-id", l.id), f.appendChild(p), Ge({
|
|
1297
1346
|
index: s,
|
|
1298
1347
|
config: n,
|
|
1299
1348
|
withDatabaseIds: r,
|
|
@@ -1304,7 +1353,7 @@ function Ve(e) {
|
|
|
1304
1353
|
declareNamespaces: a
|
|
1305
1354
|
}), f;
|
|
1306
1355
|
}
|
|
1307
|
-
function
|
|
1356
|
+
function Ge(e) {
|
|
1308
1357
|
let { index: t, config: n, withDatabaseIds: i, xmlDocument: a, parentRecord: s, parentElement: c, isFragment: l, declareNamespaces: u } = e;
|
|
1309
1358
|
if (!s.children || s.children.length === 0) return;
|
|
1310
1359
|
let d = [];
|
|
@@ -1325,7 +1374,7 @@ function He(e) {
|
|
|
1325
1374
|
childrenConfig: n.children
|
|
1326
1375
|
});
|
|
1327
1376
|
for (let e of f) {
|
|
1328
|
-
let r =
|
|
1377
|
+
let r = B({
|
|
1329
1378
|
config: n,
|
|
1330
1379
|
document: a,
|
|
1331
1380
|
record: e,
|
|
@@ -1334,7 +1383,7 @@ function He(e) {
|
|
|
1334
1383
|
isFragment: l,
|
|
1335
1384
|
declareNamespaces: u
|
|
1336
1385
|
});
|
|
1337
|
-
c.appendChild(r),
|
|
1386
|
+
c.appendChild(r), Ge({
|
|
1338
1387
|
index: t,
|
|
1339
1388
|
config: n,
|
|
1340
1389
|
withDatabaseIds: i,
|
|
@@ -1346,23 +1395,23 @@ function He(e) {
|
|
|
1346
1395
|
});
|
|
1347
1396
|
}
|
|
1348
1397
|
}
|
|
1349
|
-
function
|
|
1398
|
+
function Ke(e) {
|
|
1350
1399
|
let { document: t, record: n, defaultNamespace: r, declareNamespaces: i } = e, a = n.namespace.uri !== r.uri && n.namespace.prefix && n.namespace.prefix !== "xmlns" ? `${n.namespace.prefix}:${n.tagName}` : n.tagName;
|
|
1351
1400
|
return i ? t.createElementNS(n.namespace.uri, a) : t.createElement(a);
|
|
1352
1401
|
}
|
|
1353
|
-
function
|
|
1354
|
-
let { config: t, document: n, record: r, defaultNamespace: i, withDatabaseIds: a, isFragment: o, declareNamespaces: s } = e, c = r.namespace.uri === i.uri, l =
|
|
1402
|
+
function B(e) {
|
|
1403
|
+
let { config: t, document: n, record: r, defaultNamespace: i, withDatabaseIds: a, isFragment: o, declareNamespaces: s } = e, c = r.namespace.uri === i.uri, l = Ke({
|
|
1355
1404
|
document: n,
|
|
1356
1405
|
record: r,
|
|
1357
1406
|
defaultNamespace: i,
|
|
1358
1407
|
declareNamespaces: s
|
|
1359
1408
|
});
|
|
1360
|
-
return s && !c && r.namespace.prefix && r.namespace.prefix !== "xmlns" &&
|
|
1409
|
+
return s && !c && r.namespace.prefix && r.namespace.prefix !== "xmlns" && qe({
|
|
1361
1410
|
config: t,
|
|
1362
1411
|
document: n,
|
|
1363
1412
|
namespace: r.namespace,
|
|
1364
1413
|
isFragment: o
|
|
1365
|
-
}), r.attributes &&
|
|
1414
|
+
}), r.attributes && V({
|
|
1366
1415
|
config: t,
|
|
1367
1416
|
document: n,
|
|
1368
1417
|
element: l,
|
|
@@ -1370,7 +1419,7 @@ function We(e) {
|
|
|
1370
1419
|
isRoot: !1,
|
|
1371
1420
|
isFragment: o,
|
|
1372
1421
|
declareNamespaces: s
|
|
1373
|
-
}),
|
|
1422
|
+
}), Ye({
|
|
1374
1423
|
config: t,
|
|
1375
1424
|
document: n,
|
|
1376
1425
|
element: l,
|
|
@@ -1379,11 +1428,11 @@ function We(e) {
|
|
|
1379
1428
|
declareNamespaces: s
|
|
1380
1429
|
}), r.value && (l.textContent = r.value.trim()), a && l.setAttribute("_temp-idb-id", r.id), l;
|
|
1381
1430
|
}
|
|
1382
|
-
function
|
|
1431
|
+
function V(t) {
|
|
1383
1432
|
let { config: n, document: r, element: i, attributes: a, isRoot: o, isFragment: s, declareNamespaces: c } = t;
|
|
1384
1433
|
for (let t of a) {
|
|
1385
|
-
if (
|
|
1386
|
-
if (!
|
|
1434
|
+
if (Ze(t)) continue;
|
|
1435
|
+
if (!Xe(t) || !t.namespace.prefix) {
|
|
1387
1436
|
i.setAttribute(t.name, String(t.value));
|
|
1388
1437
|
continue;
|
|
1389
1438
|
}
|
|
@@ -1392,7 +1441,7 @@ function Ge(t) {
|
|
|
1392
1441
|
i.setAttribute(`${t.namespace.prefix}:${a}`, String(t.value));
|
|
1393
1442
|
continue;
|
|
1394
1443
|
}
|
|
1395
|
-
o ||
|
|
1444
|
+
o || qe({
|
|
1396
1445
|
config: n,
|
|
1397
1446
|
document: r,
|
|
1398
1447
|
namespace: t.namespace,
|
|
@@ -1400,17 +1449,17 @@ function Ge(t) {
|
|
|
1400
1449
|
}), i.setAttributeNS(t.namespace.uri, `${t.namespace.prefix}:${a}`, String(t.value));
|
|
1401
1450
|
}
|
|
1402
1451
|
}
|
|
1403
|
-
function
|
|
1452
|
+
function qe(e) {
|
|
1404
1453
|
let { config: t, document: n, namespace: r, isFragment: i } = e, a = n.documentElement;
|
|
1405
1454
|
if (!a || !r.prefix || r.prefix === "xmlns") return;
|
|
1406
1455
|
let o = "http://www.w3.org/2000/xmlns/";
|
|
1407
|
-
a.getAttributeNS(o, r.prefix) === null && (a.setAttributeNS(o, `xmlns:${r.prefix}`, r.uri), i ||
|
|
1456
|
+
a.getAttributeNS(o, r.prefix) === null && (a.setAttributeNS(o, `xmlns:${r.prefix}`, r.uri), i || Je({
|
|
1408
1457
|
config: t,
|
|
1409
1458
|
rootElement: a,
|
|
1410
1459
|
namespace: r
|
|
1411
1460
|
}));
|
|
1412
1461
|
}
|
|
1413
|
-
function
|
|
1462
|
+
function Je(t) {
|
|
1414
1463
|
let { config: r, rootElement: i, namespace: a } = t, o = Object.entries(r.definition[r.rootElementName].attributes.details).filter(([e, t]) => n({
|
|
1415
1464
|
dialecteConfig: r,
|
|
1416
1465
|
tagName: r.rootElementName,
|
|
@@ -1430,7 +1479,7 @@ function H(t) {
|
|
|
1430
1479
|
} else i.setAttribute(o, s);
|
|
1431
1480
|
}
|
|
1432
1481
|
}
|
|
1433
|
-
function
|
|
1482
|
+
function Ye(t) {
|
|
1434
1483
|
let { config: r, document: i, element: a, tagName: o, isFragment: s, declareNamespaces: c } = t;
|
|
1435
1484
|
if (!c) return;
|
|
1436
1485
|
let l = r.definition[o]?.attributes.details;
|
|
@@ -1443,7 +1492,7 @@ function Ke(t) {
|
|
|
1443
1492
|
});
|
|
1444
1493
|
if (l === void 0) continue;
|
|
1445
1494
|
let d = e(t);
|
|
1446
|
-
(u.namespace ? a.hasAttributeNS(u.namespace.uri, d) : a.hasAttribute(d)) || (u.namespace && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (c &&
|
|
1495
|
+
(u.namespace ? a.hasAttributeNS(u.namespace.uri, d) : a.hasAttribute(d)) || (u.namespace && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (c && qe({
|
|
1447
1496
|
config: r,
|
|
1448
1497
|
document: i,
|
|
1449
1498
|
namespace: u.namespace,
|
|
@@ -1451,13 +1500,13 @@ function Ke(t) {
|
|
|
1451
1500
|
}), a.setAttributeNS(u.namespace.uri, `${u.namespace.prefix}:${d}`, l)) : a.setAttribute(d, l));
|
|
1452
1501
|
}
|
|
1453
1502
|
}
|
|
1454
|
-
function
|
|
1503
|
+
function Xe(e) {
|
|
1455
1504
|
return typeof e == "object" && !!e && "namespace" in e && !!e.namespace;
|
|
1456
1505
|
}
|
|
1457
|
-
function
|
|
1458
|
-
return !!(e.name === "xmlns" || e.name.startsWith("xmlns:") ||
|
|
1506
|
+
function Ze(e) {
|
|
1507
|
+
return !!(e.name === "xmlns" || e.name.startsWith("xmlns:") || Xe(e) && e.namespace?.prefix === "xmlns");
|
|
1459
1508
|
}
|
|
1460
|
-
var
|
|
1509
|
+
var Qe = /* @__PURE__ */ b(((e, t) => {
|
|
1461
1510
|
t.exports = {};
|
|
1462
1511
|
}));
|
|
1463
1512
|
(/* @__PURE__ */ b(((e) => {
|
|
@@ -1517,15 +1566,15 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
1517
1566
|
var s = n[t[a]].length;
|
|
1518
1567
|
if (s > r) switch (t[a]) {
|
|
1519
1568
|
case "textNode":
|
|
1520
|
-
|
|
1569
|
+
O(n);
|
|
1521
1570
|
break;
|
|
1522
1571
|
case "cdata":
|
|
1523
|
-
|
|
1572
|
+
D(n, "oncdata", n.cdata), n.cdata = "";
|
|
1524
1573
|
break;
|
|
1525
1574
|
case "script":
|
|
1526
|
-
|
|
1575
|
+
D(n, "onscript", n.script), n.script = "";
|
|
1527
1576
|
break;
|
|
1528
|
-
default:
|
|
1577
|
+
default: A(n, "Max buffer length exceeded: " + t[a]);
|
|
1529
1578
|
}
|
|
1530
1579
|
i = Math.max(i, s);
|
|
1531
1580
|
}
|
|
@@ -1535,13 +1584,13 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
1535
1584
|
for (var n = 0, r = t.length; n < r; n++) e[t[n]] = "";
|
|
1536
1585
|
}
|
|
1537
1586
|
function a(e) {
|
|
1538
|
-
|
|
1587
|
+
O(e), e.cdata !== "" && (D(e, "oncdata", e.cdata), e.cdata = ""), e.script !== "" && (D(e, "onscript", e.script), e.script = "");
|
|
1539
1588
|
}
|
|
1540
1589
|
n.prototype = {
|
|
1541
1590
|
end: function() {
|
|
1542
|
-
|
|
1591
|
+
ae(this);
|
|
1543
1592
|
},
|
|
1544
|
-
write:
|
|
1593
|
+
write: F,
|
|
1545
1594
|
resume: function() {
|
|
1546
1595
|
return this.error = null, this;
|
|
1547
1596
|
},
|
|
@@ -1554,7 +1603,7 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
1554
1603
|
};
|
|
1555
1604
|
var o;
|
|
1556
1605
|
try {
|
|
1557
|
-
o =
|
|
1606
|
+
o = Qe().Stream;
|
|
1558
1607
|
} catch {
|
|
1559
1608
|
o = function() {};
|
|
1560
1609
|
}
|
|
@@ -1953,101 +2002,101 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
1953
2002
|
var t = e && e.match(/(?:^|\s)encoding\s*=\s*(['"])([^'"]+)\1/i);
|
|
1954
2003
|
return t ? t[2] : null;
|
|
1955
2004
|
}
|
|
1956
|
-
function
|
|
2005
|
+
function re(e) {
|
|
1957
2006
|
return e ? e.toLowerCase().replace(/[^a-z0-9]/g, "") : null;
|
|
1958
2007
|
}
|
|
1959
|
-
function
|
|
1960
|
-
let n =
|
|
2008
|
+
function ie(e, t) {
|
|
2009
|
+
let n = re(e), r = re(t);
|
|
1961
2010
|
return !n || !r ? !0 : r === "utf16" ? n === "utf16le" || n === "utf16be" : n === r;
|
|
1962
2011
|
}
|
|
1963
|
-
function
|
|
2012
|
+
function E(e, t) {
|
|
1964
2013
|
if (!(!e.strict || !e.encoding || !t || t.name !== "xml")) {
|
|
1965
2014
|
var n = ne(t.body);
|
|
1966
|
-
n && !
|
|
2015
|
+
n && !ie(e.encoding, n) && j(e, "XML declaration encoding " + n + " does not match detected stream encoding " + e.encoding.toUpperCase());
|
|
1967
2016
|
}
|
|
1968
2017
|
}
|
|
1969
|
-
function
|
|
1970
|
-
e.textNode &&
|
|
2018
|
+
function D(e, t, n) {
|
|
2019
|
+
e.textNode && O(e), T(e, t, n);
|
|
1971
2020
|
}
|
|
1972
|
-
function
|
|
1973
|
-
e.textNode =
|
|
2021
|
+
function O(e) {
|
|
2022
|
+
e.textNode = k(e.opt, e.textNode), e.textNode && T(e, "ontext", e.textNode), e.textNode = "";
|
|
1974
2023
|
}
|
|
1975
|
-
function
|
|
2024
|
+
function k(e, t) {
|
|
1976
2025
|
return e.trim && (t = t.trim()), e.normalize && (t = t.replace(/\s+/g, " ")), t;
|
|
1977
2026
|
}
|
|
1978
|
-
function
|
|
1979
|
-
return
|
|
2027
|
+
function A(e, t) {
|
|
2028
|
+
return O(e), e.trackPosition && (t += "\nLine: " + e.line + "\nColumn: " + e.column + "\nChar: " + e.c), t = Error(t), e.error = t, T(e, "onerror", t), e;
|
|
1980
2029
|
}
|
|
1981
|
-
function
|
|
1982
|
-
return e.sawRoot && !e.closedRoot &&
|
|
2030
|
+
function ae(e) {
|
|
2031
|
+
return e.sawRoot && !e.closedRoot && j(e, "Unclosed root tag"), e.state !== w.BEGIN && e.state !== w.BEGIN_WHITESPACE && e.state !== w.TEXT && A(e, "Unexpected end"), O(e), e.c = "", e.closed = !0, T(e, "onend"), n.call(e, e.strict, e.opt), e;
|
|
1983
2032
|
}
|
|
1984
|
-
function
|
|
2033
|
+
function j(e, t) {
|
|
1985
2034
|
if (typeof e != "object" || !(e instanceof n)) throw Error("bad call to strictFail");
|
|
1986
|
-
e.strict &&
|
|
2035
|
+
e.strict && A(e, t);
|
|
1987
2036
|
}
|
|
1988
|
-
function
|
|
2037
|
+
function M(e) {
|
|
1989
2038
|
e.strict || (e.tagName = e.tagName[e.looseCase]());
|
|
1990
2039
|
var t = e.tags[e.tags.length - 1] || e, n = e.tag = {
|
|
1991
2040
|
name: e.tagName,
|
|
1992
2041
|
attributes: {}
|
|
1993
2042
|
};
|
|
1994
|
-
e.opt.xmlns && (n.ns = t.ns), e.attribList.length = 0,
|
|
2043
|
+
e.opt.xmlns && (n.ns = t.ns), e.attribList.length = 0, D(e, "onopentagstart", n);
|
|
1995
2044
|
}
|
|
1996
|
-
function
|
|
2045
|
+
function oe(e, t) {
|
|
1997
2046
|
var n = e.indexOf(":") < 0 ? ["", e] : e.split(":"), r = n[0], i = n[1];
|
|
1998
2047
|
return t && e === "xmlns" && (r = "xmlns", i = ""), {
|
|
1999
2048
|
prefix: r,
|
|
2000
2049
|
local: i
|
|
2001
2050
|
};
|
|
2002
2051
|
}
|
|
2003
|
-
function
|
|
2052
|
+
function N(e) {
|
|
2004
2053
|
if (e.strict || (e.attribName = e.attribName[e.looseCase]()), e.attribList.indexOf(e.attribName) !== -1 || e.tag.attributes.hasOwnProperty(e.attribName)) {
|
|
2005
2054
|
e.attribName = e.attribValue = "";
|
|
2006
2055
|
return;
|
|
2007
2056
|
}
|
|
2008
2057
|
if (e.opt.xmlns) {
|
|
2009
|
-
var t =
|
|
2010
|
-
if (n === "xmlns") if (r === "xml" && e.attribValue !== p)
|
|
2011
|
-
else if (r === "xmlns" && e.attribValue !== m)
|
|
2058
|
+
var t = oe(e.attribName, !0), n = t.prefix, r = t.local;
|
|
2059
|
+
if (n === "xmlns") if (r === "xml" && e.attribValue !== p) j(e, "xml: prefix must be bound to " + p + "\nActual: " + e.attribValue);
|
|
2060
|
+
else if (r === "xmlns" && e.attribValue !== m) j(e, "xmlns: prefix must be bound to " + m + "\nActual: " + e.attribValue);
|
|
2012
2061
|
else {
|
|
2013
2062
|
var i = e.tag, a = e.tags[e.tags.length - 1] || e;
|
|
2014
2063
|
i.ns === a.ns && (i.ns = Object.create(a.ns)), i.ns[r] = e.attribValue;
|
|
2015
2064
|
}
|
|
2016
2065
|
e.attribList.push([e.attribName, e.attribValue]);
|
|
2017
|
-
} else e.tag.attributes[e.attribName] = e.attribValue,
|
|
2066
|
+
} else e.tag.attributes[e.attribName] = e.attribValue, D(e, "onattribute", {
|
|
2018
2067
|
name: e.attribName,
|
|
2019
2068
|
value: e.attribValue
|
|
2020
2069
|
});
|
|
2021
2070
|
e.attribName = e.attribValue = "";
|
|
2022
2071
|
}
|
|
2023
|
-
function
|
|
2072
|
+
function P(e, t) {
|
|
2024
2073
|
if (e.opt.xmlns) {
|
|
2025
|
-
var n = e.tag, r =
|
|
2026
|
-
n.prefix = r.prefix, n.local = r.local, n.uri = n.ns[r.prefix] || "", n.prefix && !n.uri && (
|
|
2074
|
+
var n = e.tag, r = oe(e.tagName);
|
|
2075
|
+
n.prefix = r.prefix, n.local = r.local, n.uri = n.ns[r.prefix] || "", n.prefix && !n.uri && (j(e, "Unbound namespace prefix: " + JSON.stringify(e.tagName)), n.uri = r.prefix);
|
|
2027
2076
|
var i = e.tags[e.tags.length - 1] || e;
|
|
2028
2077
|
n.ns && i.ns !== n.ns && Object.keys(n.ns).forEach(function(t) {
|
|
2029
|
-
|
|
2078
|
+
D(e, "onopennamespace", {
|
|
2030
2079
|
prefix: t,
|
|
2031
2080
|
uri: n.ns[t]
|
|
2032
2081
|
});
|
|
2033
2082
|
});
|
|
2034
2083
|
for (var a = 0, o = e.attribList.length; a < o; a++) {
|
|
2035
|
-
var s = e.attribList[a], c = s[0], l = s[1], u =
|
|
2084
|
+
var s = e.attribList[a], c = s[0], l = s[1], u = oe(c, !0), d = u.prefix, f = u.local, p = d === "" ? "" : n.ns[d] || "", m = {
|
|
2036
2085
|
name: c,
|
|
2037
2086
|
value: l,
|
|
2038
2087
|
prefix: d,
|
|
2039
2088
|
local: f,
|
|
2040
2089
|
uri: p
|
|
2041
2090
|
};
|
|
2042
|
-
d && d !== "xmlns" && !p && (
|
|
2091
|
+
d && d !== "xmlns" && !p && (j(e, "Unbound namespace prefix: " + JSON.stringify(d)), m.uri = d), e.tag.attributes[c] = m, D(e, "onattribute", m);
|
|
2043
2092
|
}
|
|
2044
2093
|
e.attribList.length = 0;
|
|
2045
2094
|
}
|
|
2046
|
-
e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag),
|
|
2095
|
+
e.tag.isSelfClosing = !!t, e.sawRoot = !0, e.tags.push(e.tag), D(e, "onopentag", e.tag), t || (!e.noscript && e.tagName.toLowerCase() === "script" ? e.state = w.SCRIPT : e.state = w.TEXT, e.tag = null, e.tagName = ""), e.attribName = e.attribValue = "", e.attribList.length = 0;
|
|
2047
2096
|
}
|
|
2048
|
-
function
|
|
2097
|
+
function se(e) {
|
|
2049
2098
|
if (!e.tagName) {
|
|
2050
|
-
|
|
2099
|
+
j(e, "Weird empty close tag."), e.textNode += "</>", e.state = w.TEXT;
|
|
2051
2100
|
return;
|
|
2052
2101
|
}
|
|
2053
2102
|
if (e.script) {
|
|
@@ -2055,25 +2104,25 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2055
2104
|
e.script += "</" + e.tagName + ">", e.tagName = "", e.state = w.SCRIPT;
|
|
2056
2105
|
return;
|
|
2057
2106
|
}
|
|
2058
|
-
|
|
2107
|
+
D(e, "onscript", e.script), e.script = "";
|
|
2059
2108
|
}
|
|
2060
2109
|
var t = e.tags.length, n = e.tagName;
|
|
2061
2110
|
e.strict || (n = n[e.looseCase]());
|
|
2062
|
-
for (var r = n; t-- && e.tags[t].name !== r;)
|
|
2111
|
+
for (var r = n; t-- && e.tags[t].name !== r;) j(e, "Unexpected close tag");
|
|
2063
2112
|
if (t < 0) {
|
|
2064
|
-
|
|
2113
|
+
j(e, "Unmatched closing tag: " + e.tagName), e.textNode += "</" + e.tagName + ">", e.state = w.TEXT;
|
|
2065
2114
|
return;
|
|
2066
2115
|
}
|
|
2067
2116
|
e.tagName = n;
|
|
2068
2117
|
for (var i = e.tags.length; i-- > t;) {
|
|
2069
2118
|
var a = e.tag = e.tags.pop();
|
|
2070
|
-
e.tagName = e.tag.name,
|
|
2119
|
+
e.tagName = e.tag.name, D(e, "onclosetag", e.tagName);
|
|
2071
2120
|
var o = {};
|
|
2072
2121
|
for (var s in a.ns) o[s] = a.ns[s];
|
|
2073
2122
|
var c = e.tags[e.tags.length - 1] || e;
|
|
2074
2123
|
e.opt.xmlns && a.ns !== c.ns && Object.keys(a.ns).forEach(function(t) {
|
|
2075
2124
|
var n = a.ns[t];
|
|
2076
|
-
|
|
2125
|
+
D(e, "onclosenamespace", {
|
|
2077
2126
|
prefix: t,
|
|
2078
2127
|
uri: n
|
|
2079
2128
|
});
|
|
@@ -2081,37 +2130,37 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2081
2130
|
}
|
|
2082
2131
|
t === 0 && (e.closedRoot = !0), e.tagName = e.attribValue = e.attribName = "", e.attribList.length = 0, e.state = w.TEXT;
|
|
2083
2132
|
}
|
|
2084
|
-
function
|
|
2133
|
+
function ce(e) {
|
|
2085
2134
|
var t = e.entity, n = t.toLowerCase(), r, i = "";
|
|
2086
|
-
return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === "#" && (t.charAt(1) === "x" ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ""), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (
|
|
2087
|
-
}
|
|
2088
|
-
function ce(e, t) {
|
|
2089
|
-
t === "<" ? (e.state = w.OPEN_WAKA, e.startTagPosition = e.position) : b(t) || (N(e, "Non-whitespace before first tag."), e.textNode = t, e.state = w.TEXT);
|
|
2135
|
+
return e.ENTITIES[t] ? e.ENTITIES[t] : e.ENTITIES[n] ? e.ENTITIES[n] : (t = n, t.charAt(0) === "#" && (t.charAt(1) === "x" ? (t = t.slice(2), r = parseInt(t, 16), i = r.toString(16)) : (t = t.slice(1), r = parseInt(t, 10), i = r.toString(10))), t = t.replace(/^0+/, ""), isNaN(r) || i.toLowerCase() !== t || r < 0 || r > 1114111 ? (j(e, "Invalid character entity"), "&" + e.entity + ";") : String.fromCodePoint(r));
|
|
2090
2136
|
}
|
|
2091
2137
|
function le(e, t) {
|
|
2138
|
+
t === "<" ? (e.state = w.OPEN_WAKA, e.startTagPosition = e.position) : b(t) || (j(e, "Non-whitespace before first tag."), e.textNode = t, e.state = w.TEXT);
|
|
2139
|
+
}
|
|
2140
|
+
function ue(e, t) {
|
|
2092
2141
|
var n = "";
|
|
2093
2142
|
return t < e.length && (n = e.charAt(t)), n;
|
|
2094
2143
|
}
|
|
2095
|
-
function
|
|
2144
|
+
function F(t) {
|
|
2096
2145
|
var n = this;
|
|
2097
2146
|
if (this.error) throw this.error;
|
|
2098
|
-
if (n.closed) return
|
|
2099
|
-
if (t === null) return
|
|
2147
|
+
if (n.closed) return A(n, "Cannot write after close. Assign an onready handler.");
|
|
2148
|
+
if (t === null) return ae(n);
|
|
2100
2149
|
typeof t == "object" && (t = t.toString());
|
|
2101
|
-
for (var i = 0, a = ""; a =
|
|
2150
|
+
for (var i = 0, a = ""; a = ue(t, i++), n.c = a, a;) switch (n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++), n.state) {
|
|
2102
2151
|
case w.BEGIN:
|
|
2103
2152
|
if (n.state = w.BEGIN_WHITESPACE, a === "") continue;
|
|
2104
|
-
|
|
2153
|
+
le(n, a);
|
|
2105
2154
|
continue;
|
|
2106
2155
|
case w.BEGIN_WHITESPACE:
|
|
2107
|
-
|
|
2156
|
+
le(n, a);
|
|
2108
2157
|
continue;
|
|
2109
2158
|
case w.TEXT:
|
|
2110
2159
|
if (n.sawRoot && !n.closedRoot) {
|
|
2111
|
-
for (var o = i - 1; a && a !== "<" && a !== "&";) a =
|
|
2160
|
+
for (var o = i - 1; a && a !== "<" && a !== "&";) a = ue(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
|
|
2112
2161
|
n.textNode += t.substring(o, i - 1);
|
|
2113
2162
|
}
|
|
2114
|
-
a === "<" && !(n.sawRoot && n.closedRoot && !n.strict) ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : (!b(a) && (!n.sawRoot || n.closedRoot) &&
|
|
2163
|
+
a === "<" && !(n.sawRoot && n.closedRoot && !n.strict) ? (n.state = w.OPEN_WAKA, n.startTagPosition = n.position) : (!b(a) && (!n.sawRoot || n.closedRoot) && j(n, "Text data outside of root node."), a === "&" ? n.state = w.TEXT_ENTITY : n.textNode += a);
|
|
2115
2164
|
continue;
|
|
2116
2165
|
case w.SCRIPT:
|
|
2117
2166
|
a === "<" ? n.state = w.SCRIPT_ENDING : n.script += a;
|
|
@@ -2125,7 +2174,7 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2125
2174
|
else if (a === "/") n.state = w.CLOSE_TAG, n.tagName = "";
|
|
2126
2175
|
else if (a === "?") n.state = w.PROC_INST, n.procInstName = n.procInstBody = "";
|
|
2127
2176
|
else {
|
|
2128
|
-
if (
|
|
2177
|
+
if (j(n, "Unencoded <"), n.startTagPosition + 1 < n.position) {
|
|
2129
2178
|
var s = n.position - n.startTagPosition;
|
|
2130
2179
|
a = Array(s).join(" ") + a;
|
|
2131
2180
|
}
|
|
@@ -2137,13 +2186,13 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2137
2186
|
n.state = w.COMMENT, n.comment = "", n.sgmlDecl = "";
|
|
2138
2187
|
continue;
|
|
2139
2188
|
}
|
|
2140
|
-
n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = w.DOCTYPE_DTD, n.doctype += "<!" + n.sgmlDecl + a, n.sgmlDecl = "") : (n.sgmlDecl + a).toUpperCase() === d ? (
|
|
2189
|
+
n.doctype && n.doctype !== !0 && n.sgmlDecl ? (n.state = w.DOCTYPE_DTD, n.doctype += "<!" + n.sgmlDecl + a, n.sgmlDecl = "") : (n.sgmlDecl + a).toUpperCase() === d ? (D(n, "onopencdata"), n.state = w.CDATA, n.sgmlDecl = "", n.cdata = "") : (n.sgmlDecl + a).toUpperCase() === f ? (n.state = w.DOCTYPE, (n.doctype || n.sawRoot) && j(n, "Inappropriately located doctype declaration"), n.doctype = "", n.sgmlDecl = "") : a === ">" ? (D(n, "onsgmldeclaration", n.sgmlDecl), n.sgmlDecl = "", n.state = w.TEXT) : (x(a) && (n.state = w.SGML_DECL_QUOTED), n.sgmlDecl += a);
|
|
2141
2190
|
continue;
|
|
2142
2191
|
case w.SGML_DECL_QUOTED:
|
|
2143
2192
|
a === n.q && (n.state = w.SGML_DECL, n.q = ""), n.sgmlDecl += a;
|
|
2144
2193
|
continue;
|
|
2145
2194
|
case w.DOCTYPE:
|
|
2146
|
-
a === ">" ? (n.state = w.TEXT,
|
|
2195
|
+
a === ">" ? (n.state = w.TEXT, D(n, "ondoctype", n.doctype), n.doctype = !0) : (n.doctype += a, a === "[" ? n.state = w.DOCTYPE_DTD : x(a) && (n.state = w.DOCTYPE_QUOTED, n.q = a));
|
|
2147
2196
|
continue;
|
|
2148
2197
|
case w.DOCTYPE_QUOTED:
|
|
2149
2198
|
n.doctype += a, a === n.q && (n.q = "", n.state = w.DOCTYPE);
|
|
@@ -2158,20 +2207,20 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2158
2207
|
a === "-" ? n.state = w.COMMENT_ENDING : n.comment += a;
|
|
2159
2208
|
continue;
|
|
2160
2209
|
case w.COMMENT_ENDING:
|
|
2161
|
-
a === "-" ? (n.state = w.COMMENT_ENDED, n.comment =
|
|
2210
|
+
a === "-" ? (n.state = w.COMMENT_ENDED, n.comment = k(n.opt, n.comment), n.comment && D(n, "oncomment", n.comment), n.comment = "") : (n.comment += "-" + a, n.state = w.COMMENT);
|
|
2162
2211
|
continue;
|
|
2163
2212
|
case w.COMMENT_ENDED:
|
|
2164
|
-
a === ">" ? n.doctype && n.doctype !== !0 ? n.state = w.DOCTYPE_DTD : n.state = w.TEXT : (
|
|
2213
|
+
a === ">" ? n.doctype && n.doctype !== !0 ? n.state = w.DOCTYPE_DTD : n.state = w.TEXT : (j(n, "Malformed comment"), n.comment += "--" + a, n.state = w.COMMENT);
|
|
2165
2214
|
continue;
|
|
2166
2215
|
case w.CDATA:
|
|
2167
|
-
for (var o = i - 1; a && a !== "]";) a =
|
|
2216
|
+
for (var o = i - 1; a && a !== "]";) a = ue(t, i++), a && n.trackPosition && (n.position++, a === "\n" ? (n.line++, n.column = 0) : n.column++);
|
|
2168
2217
|
n.cdata += t.substring(o, i - 1), a === "]" && (n.state = w.CDATA_ENDING);
|
|
2169
2218
|
continue;
|
|
2170
2219
|
case w.CDATA_ENDING:
|
|
2171
2220
|
a === "]" ? n.state = w.CDATA_ENDING_2 : (n.cdata += "]" + a, n.state = w.CDATA);
|
|
2172
2221
|
continue;
|
|
2173
2222
|
case w.CDATA_ENDING_2:
|
|
2174
|
-
a === ">" ? (n.cdata &&
|
|
2223
|
+
a === ">" ? (n.cdata && D(n, "oncdata", n.cdata), D(n, "onclosecdata"), n.cdata = "", n.state = w.TEXT) : a === "]" ? n.cdata += "]" : (n.cdata += "]]" + a, n.state = w.CDATA);
|
|
2175
2224
|
continue;
|
|
2176
2225
|
case w.PROC_INST:
|
|
2177
2226
|
a === "?" ? n.state = w.PROC_INST_ENDING : b(a) ? n.state = w.PROC_INST_BODY : n.procInstName += a;
|
|
@@ -2186,61 +2235,61 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2186
2235
|
name: n.procInstName,
|
|
2187
2236
|
body: n.procInstBody
|
|
2188
2237
|
};
|
|
2189
|
-
|
|
2238
|
+
E(n, e), D(n, "onprocessinginstruction", e), n.procInstName = n.procInstBody = "", n.state = w.TEXT;
|
|
2190
2239
|
} else n.procInstBody += "?" + a, n.state = w.PROC_INST_BODY;
|
|
2191
2240
|
continue;
|
|
2192
2241
|
case w.OPEN_TAG:
|
|
2193
|
-
C(_, a) ? n.tagName += a : (
|
|
2242
|
+
C(_, a) ? n.tagName += a : (M(n), a === ">" ? P(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : (b(a) || j(n, "Invalid character in tag name"), n.state = w.ATTRIB));
|
|
2194
2243
|
continue;
|
|
2195
2244
|
case w.OPEN_TAG_SLASH:
|
|
2196
|
-
a === ">" ? (
|
|
2245
|
+
a === ">" ? (P(n, !0), se(n)) : (j(n, "Forward-slash in opening tag not followed by >"), n.state = w.ATTRIB);
|
|
2197
2246
|
continue;
|
|
2198
2247
|
case w.ATTRIB:
|
|
2199
2248
|
if (b(a)) continue;
|
|
2200
|
-
a === ">" ?
|
|
2249
|
+
a === ">" ? P(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : j(n, "Invalid attribute name");
|
|
2201
2250
|
continue;
|
|
2202
2251
|
case w.ATTRIB_NAME:
|
|
2203
|
-
a === "=" ? n.state = w.ATTRIB_VALUE : a === ">" ? (
|
|
2252
|
+
a === "=" ? n.state = w.ATTRIB_VALUE : a === ">" ? (j(n, "Attribute without value"), n.attribValue = n.attribName, N(n), P(n)) : b(a) ? n.state = w.ATTRIB_NAME_SAW_WHITE : C(_, a) ? n.attribName += a : j(n, "Invalid attribute name");
|
|
2204
2253
|
continue;
|
|
2205
2254
|
case w.ATTRIB_NAME_SAW_WHITE:
|
|
2206
2255
|
if (a === "=") n.state = w.ATTRIB_VALUE;
|
|
2207
2256
|
else if (b(a)) continue;
|
|
2208
|
-
else
|
|
2257
|
+
else j(n, "Attribute without value"), n.tag.attributes[n.attribName] = "", n.attribValue = "", D(n, "onattribute", {
|
|
2209
2258
|
name: n.attribName,
|
|
2210
2259
|
value: ""
|
|
2211
|
-
}), n.attribName = "", a === ">" ?
|
|
2260
|
+
}), n.attribName = "", a === ">" ? P(n) : C(g, a) ? (n.attribName = a, n.state = w.ATTRIB_NAME) : (j(n, "Invalid attribute name"), n.state = w.ATTRIB);
|
|
2212
2261
|
continue;
|
|
2213
2262
|
case w.ATTRIB_VALUE:
|
|
2214
2263
|
if (b(a)) continue;
|
|
2215
|
-
x(a) ? (n.q = a, n.state = w.ATTRIB_VALUE_QUOTED) : (n.opt.unquotedAttributeValues ||
|
|
2264
|
+
x(a) ? (n.q = a, n.state = w.ATTRIB_VALUE_QUOTED) : (n.opt.unquotedAttributeValues || A(n, "Unquoted attribute value"), n.state = w.ATTRIB_VALUE_UNQUOTED, n.attribValue = a);
|
|
2216
2265
|
continue;
|
|
2217
2266
|
case w.ATTRIB_VALUE_QUOTED:
|
|
2218
2267
|
if (a !== n.q) {
|
|
2219
2268
|
a === "&" ? n.state = w.ATTRIB_VALUE_ENTITY_Q : n.attribValue += a;
|
|
2220
2269
|
continue;
|
|
2221
2270
|
}
|
|
2222
|
-
|
|
2271
|
+
N(n), n.q = "", n.state = w.ATTRIB_VALUE_CLOSED;
|
|
2223
2272
|
continue;
|
|
2224
2273
|
case w.ATTRIB_VALUE_CLOSED:
|
|
2225
|
-
b(a) ? n.state = w.ATTRIB : a === ">" ?
|
|
2274
|
+
b(a) ? n.state = w.ATTRIB : a === ">" ? P(n) : a === "/" ? n.state = w.OPEN_TAG_SLASH : C(g, a) ? (j(n, "No whitespace between attributes"), n.attribName = a, n.attribValue = "", n.state = w.ATTRIB_NAME) : j(n, "Invalid attribute name");
|
|
2226
2275
|
continue;
|
|
2227
2276
|
case w.ATTRIB_VALUE_UNQUOTED:
|
|
2228
2277
|
if (!S(a)) {
|
|
2229
2278
|
a === "&" ? n.state = w.ATTRIB_VALUE_ENTITY_U : n.attribValue += a;
|
|
2230
2279
|
continue;
|
|
2231
2280
|
}
|
|
2232
|
-
|
|
2281
|
+
N(n), a === ">" ? P(n) : n.state = w.ATTRIB;
|
|
2233
2282
|
continue;
|
|
2234
2283
|
case w.CLOSE_TAG:
|
|
2235
|
-
if (n.tagName) a === ">" ?
|
|
2284
|
+
if (n.tagName) a === ">" ? se(n) : C(_, a) ? n.tagName += a : n.script ? (n.script += "</" + n.tagName + a, n.tagName = "", n.state = w.SCRIPT) : (b(a) || j(n, "Invalid tagname in closing tag"), n.state = w.CLOSE_TAG_SAW_WHITE);
|
|
2236
2285
|
else {
|
|
2237
2286
|
if (b(a)) continue;
|
|
2238
|
-
ee(g, a) ? n.script ? (n.script += "</" + a, n.state = w.SCRIPT) :
|
|
2287
|
+
ee(g, a) ? n.script ? (n.script += "</" + a, n.state = w.SCRIPT) : j(n, "Invalid tagname in closing tag.") : n.tagName = a;
|
|
2239
2288
|
}
|
|
2240
2289
|
continue;
|
|
2241
2290
|
case w.CLOSE_TAG_SAW_WHITE:
|
|
2242
2291
|
if (b(a)) continue;
|
|
2243
|
-
a === ">" ?
|
|
2292
|
+
a === ">" ? se(n) : j(n, "Invalid characters in closing tag");
|
|
2244
2293
|
continue;
|
|
2245
2294
|
case w.TEXT_ENTITY:
|
|
2246
2295
|
case w.ATTRIB_VALUE_ENTITY_Q:
|
|
@@ -2258,9 +2307,9 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2258
2307
|
break;
|
|
2259
2308
|
}
|
|
2260
2309
|
if (a === ";") {
|
|
2261
|
-
var u =
|
|
2262
|
-
n.opt.unparsedEntities && !Object.values(e.XML_ENTITIES).includes(u) ? ((n.entityCount += 1) > n.opt.maxEntityCount &&
|
|
2263
|
-
} else C(n.entity.length ? y : v, a) ? n.entity += a : (
|
|
2310
|
+
var u = ce(n);
|
|
2311
|
+
n.opt.unparsedEntities && !Object.values(e.XML_ENTITIES).includes(u) ? ((n.entityCount += 1) > n.opt.maxEntityCount && A(n, "Parsed entity count exceeds max entity count"), (n.entityDepth += 1) > n.opt.maxEntityDepth && A(n, "Parsed entity depth exceeds max entity depth"), n.entity = "", n.state = c, n.write(u), --n.entityDepth) : (n[l] += u, n.entity = "", n.state = c);
|
|
2312
|
+
} else C(n.entity.length ? y : v, a) ? n.entity += a : (j(n, "Invalid character in entity name"), n[l] += "&" + n.entity + a, n.entity = "", n.state = c);
|
|
2264
2313
|
continue;
|
|
2265
2314
|
default: throw Error(n, "Unknown state: " + n.state);
|
|
2266
2315
|
}
|
|
@@ -2287,8 +2336,21 @@ var Ye = /* @__PURE__ */ b(((e, t) => {
|
|
|
2287
2336
|
})();
|
|
2288
2337
|
})(e === void 0 ? e.sax = {} : e);
|
|
2289
2338
|
})))();
|
|
2290
|
-
|
|
2291
|
-
|
|
2339
|
+
var $e = Object.freeze({
|
|
2340
|
+
start() {},
|
|
2341
|
+
stop() {},
|
|
2342
|
+
count() {},
|
|
2343
|
+
profile(e, t) {
|
|
2344
|
+
return t();
|
|
2345
|
+
},
|
|
2346
|
+
report() {
|
|
2347
|
+
return {};
|
|
2348
|
+
},
|
|
2349
|
+
log() {},
|
|
2350
|
+
reset() {}
|
|
2351
|
+
});
|
|
2352
|
+
async function H(e) {
|
|
2353
|
+
let { context: t, options: n = {} } = e, { ref: r, ancestors: i, siblings: a, depth: o, includeDeleted: s, omit: c, unwrap: l, as: u = "tree" } = n, d = await Fe({
|
|
2292
2354
|
context: t,
|
|
2293
2355
|
ref: r ? f(r) : void 0,
|
|
2294
2356
|
ancestors: i,
|
|
@@ -2296,33 +2358,33 @@ async function Xe(e) {
|
|
|
2296
2358
|
depth: o,
|
|
2297
2359
|
includeDeleted: s
|
|
2298
2360
|
});
|
|
2299
|
-
if (u === "xml") return
|
|
2300
|
-
let p =
|
|
2361
|
+
if (u === "xml") return tt(t, d, n.declareNamespaces, n.includeXmlDeclaration);
|
|
2362
|
+
let p = et(t, d, {
|
|
2301
2363
|
omit: c,
|
|
2302
2364
|
unwrap: l
|
|
2303
2365
|
});
|
|
2304
2366
|
return u === "tree" ? p : {
|
|
2305
2367
|
tree: p,
|
|
2306
|
-
xmlString:
|
|
2368
|
+
xmlString: tt(t, d, n.declareNamespaces, n.includeXmlDeclaration)
|
|
2307
2369
|
};
|
|
2308
2370
|
}
|
|
2309
|
-
function
|
|
2310
|
-
let r =
|
|
2311
|
-
r =
|
|
2371
|
+
function et(e, t, n) {
|
|
2372
|
+
let r = Le(t);
|
|
2373
|
+
r = we({
|
|
2312
2374
|
tree: r,
|
|
2313
2375
|
omit: n.omit
|
|
2314
2376
|
});
|
|
2315
2377
|
let i = e.dialecteConfig.transparentElements, a = n.unwrap ?? (i?.length ? [...i] : void 0);
|
|
2316
|
-
return a?.length && (r =
|
|
2378
|
+
return a?.length && (r = L({
|
|
2317
2379
|
tree: r,
|
|
2318
2380
|
unwrapTagNames: a
|
|
2319
|
-
})), r =
|
|
2381
|
+
})), r = Te({
|
|
2320
2382
|
tree: r,
|
|
2321
2383
|
childrenConfig: e.dialecteConfig.children
|
|
2322
2384
|
}), r;
|
|
2323
2385
|
}
|
|
2324
|
-
function
|
|
2325
|
-
return
|
|
2386
|
+
function tt(e, t, n, r) {
|
|
2387
|
+
return Ue(We({
|
|
2326
2388
|
records: t.liveRecords,
|
|
2327
2389
|
config: e.dialecteConfig,
|
|
2328
2390
|
rootId: t.rootId,
|
|
@@ -2346,32 +2408,32 @@ var U = class {
|
|
|
2346
2408
|
});
|
|
2347
2409
|
}
|
|
2348
2410
|
async getChild(e, t) {
|
|
2349
|
-
return
|
|
2411
|
+
return k({
|
|
2350
2412
|
context: this.getContext(),
|
|
2351
2413
|
ref: f(e),
|
|
2352
2414
|
tagName: t
|
|
2353
2415
|
});
|
|
2354
2416
|
}
|
|
2355
2417
|
async getChildren(e, t) {
|
|
2356
|
-
return
|
|
2418
|
+
return A({
|
|
2357
2419
|
context: this.getContext(),
|
|
2358
2420
|
ref: f(e),
|
|
2359
2421
|
tagName: t
|
|
2360
2422
|
});
|
|
2361
2423
|
}
|
|
2362
2424
|
async getRecordsByTagName(e) {
|
|
2363
|
-
return
|
|
2425
|
+
return O({
|
|
2364
2426
|
context: this.getContext(),
|
|
2365
2427
|
tagName: e
|
|
2366
2428
|
});
|
|
2367
2429
|
}
|
|
2368
2430
|
async getAttribute(e, t) {
|
|
2369
2431
|
let n = f(e), { fullObject: r } = t;
|
|
2370
|
-
return r ?
|
|
2432
|
+
return r ? ge({
|
|
2371
2433
|
context: this.getContext(),
|
|
2372
2434
|
ref: n,
|
|
2373
2435
|
...t
|
|
2374
|
-
}) :
|
|
2436
|
+
}) : he({
|
|
2375
2437
|
context: this.getContext(),
|
|
2376
2438
|
ref: n,
|
|
2377
2439
|
...t
|
|
@@ -2379,18 +2441,18 @@ var U = class {
|
|
|
2379
2441
|
}
|
|
2380
2442
|
async getAttributes(e, t) {
|
|
2381
2443
|
let n = f(e), { fullObject: r } = t || {};
|
|
2382
|
-
return r ?
|
|
2444
|
+
return r ? ye({
|
|
2383
2445
|
context: this.getContext(),
|
|
2384
2446
|
ref: n,
|
|
2385
2447
|
...t
|
|
2386
|
-
}) :
|
|
2448
|
+
}) : ve({
|
|
2387
2449
|
context: this.getContext(),
|
|
2388
2450
|
ref: n,
|
|
2389
2451
|
...t
|
|
2390
2452
|
});
|
|
2391
2453
|
}
|
|
2392
2454
|
async getTree(e, t) {
|
|
2393
|
-
return
|
|
2455
|
+
return Ee({
|
|
2394
2456
|
context: this.getContext(),
|
|
2395
2457
|
ref: f(e),
|
|
2396
2458
|
options: t,
|
|
@@ -2398,21 +2460,21 @@ var U = class {
|
|
|
2398
2460
|
});
|
|
2399
2461
|
}
|
|
2400
2462
|
async getSnapshot(e) {
|
|
2401
|
-
return
|
|
2463
|
+
return H({
|
|
2402
2464
|
context: this.getContext(),
|
|
2403
2465
|
options: e
|
|
2404
2466
|
});
|
|
2405
2467
|
}
|
|
2406
2468
|
async findDescendants(e) {
|
|
2407
2469
|
let t = f(e), n = this.dialecteConfig.descendants[t.tagName] ?? [];
|
|
2408
|
-
return
|
|
2470
|
+
return oe({
|
|
2409
2471
|
context: this.getContext(),
|
|
2410
2472
|
ref: t,
|
|
2411
2473
|
options: { collect: n }
|
|
2412
2474
|
});
|
|
2413
2475
|
}
|
|
2414
2476
|
async findAncestors(e) {
|
|
2415
|
-
return e ?
|
|
2477
|
+
return e ? ae({
|
|
2416
2478
|
context: this.getContext(),
|
|
2417
2479
|
ref: f(e)
|
|
2418
2480
|
}) : [];
|
|
@@ -2424,9 +2486,12 @@ var U = class {
|
|
|
2424
2486
|
attributes: e.attributes
|
|
2425
2487
|
});
|
|
2426
2488
|
}
|
|
2427
|
-
},
|
|
2428
|
-
constructor(e, t, n) {
|
|
2429
|
-
this.store = e, this.dialecteConfig = t, this.documentId = n;
|
|
2489
|
+
}, nt = class {
|
|
2490
|
+
constructor(e, t, n, r = $e) {
|
|
2491
|
+
this.store = e, this.dialecteConfig = t, this.documentId = n, this._perf = r;
|
|
2492
|
+
}
|
|
2493
|
+
get perf() {
|
|
2494
|
+
return this._perf;
|
|
2430
2495
|
}
|
|
2431
2496
|
get any() {
|
|
2432
2497
|
return this._any ??= new U(() => this.context, this.dialecteConfig);
|
|
@@ -2440,7 +2505,9 @@ var U = class {
|
|
|
2440
2505
|
dialecteConfig: this.dialecteConfig,
|
|
2441
2506
|
documentId: this.documentId,
|
|
2442
2507
|
recordCache: void 0,
|
|
2443
|
-
stagedOperations: this.getOperations()
|
|
2508
|
+
stagedOperations: this.getOperations(),
|
|
2509
|
+
progress: te,
|
|
2510
|
+
perf: this.perf
|
|
2444
2511
|
};
|
|
2445
2512
|
}
|
|
2446
2513
|
async getDocumentInfo() {
|
|
@@ -2474,21 +2541,21 @@ var U = class {
|
|
|
2474
2541
|
});
|
|
2475
2542
|
}
|
|
2476
2543
|
async getChild(e, t) {
|
|
2477
|
-
if (e) return
|
|
2544
|
+
if (e) return k({
|
|
2478
2545
|
context: this.context,
|
|
2479
2546
|
ref: f(e),
|
|
2480
2547
|
tagName: t
|
|
2481
2548
|
});
|
|
2482
2549
|
}
|
|
2483
2550
|
async getChildren(e, t) {
|
|
2484
|
-
return e ?
|
|
2551
|
+
return e ? A({
|
|
2485
2552
|
context: this.context,
|
|
2486
2553
|
ref: f(e),
|
|
2487
2554
|
tagName: t
|
|
2488
2555
|
}) : [];
|
|
2489
2556
|
}
|
|
2490
2557
|
async getRecordsByTagName(e) {
|
|
2491
|
-
return
|
|
2558
|
+
return O({
|
|
2492
2559
|
context: this.context,
|
|
2493
2560
|
tagName: e
|
|
2494
2561
|
});
|
|
@@ -2497,27 +2564,27 @@ var U = class {
|
|
|
2497
2564
|
let n = f(e);
|
|
2498
2565
|
if (!t) {
|
|
2499
2566
|
let e = this.dialecteConfig.descendants[n.tagName] ?? [];
|
|
2500
|
-
return
|
|
2567
|
+
return oe({
|
|
2501
2568
|
context: this.context,
|
|
2502
2569
|
ref: n,
|
|
2503
2570
|
options: { collect: e }
|
|
2504
2571
|
});
|
|
2505
2572
|
}
|
|
2506
|
-
return
|
|
2573
|
+
return oe({
|
|
2507
2574
|
context: this.context,
|
|
2508
2575
|
ref: n,
|
|
2509
2576
|
options: t
|
|
2510
2577
|
});
|
|
2511
2578
|
}
|
|
2512
2579
|
async findAncestors(e, t) {
|
|
2513
|
-
return e ?
|
|
2580
|
+
return e ? ae({
|
|
2514
2581
|
context: this.context,
|
|
2515
2582
|
ref: f(e),
|
|
2516
2583
|
options: t
|
|
2517
2584
|
}) : [];
|
|
2518
2585
|
}
|
|
2519
2586
|
async getTree(e, t) {
|
|
2520
|
-
return
|
|
2587
|
+
return Ee({
|
|
2521
2588
|
context: this.context,
|
|
2522
2589
|
ref: f(e),
|
|
2523
2590
|
options: t,
|
|
@@ -2525,18 +2592,18 @@ var U = class {
|
|
|
2525
2592
|
});
|
|
2526
2593
|
}
|
|
2527
2594
|
async getSnapshot(e) {
|
|
2528
|
-
return
|
|
2595
|
+
return H({
|
|
2529
2596
|
context: this.context,
|
|
2530
2597
|
options: e
|
|
2531
2598
|
});
|
|
2532
2599
|
}
|
|
2533
2600
|
async getAttribute(e, t) {
|
|
2534
2601
|
let n = f(e), { fullObject: r } = t;
|
|
2535
|
-
return r ?
|
|
2602
|
+
return r ? ge({
|
|
2536
2603
|
context: this.context,
|
|
2537
2604
|
ref: n,
|
|
2538
2605
|
...t
|
|
2539
|
-
}) :
|
|
2606
|
+
}) : he({
|
|
2540
2607
|
context: this.context,
|
|
2541
2608
|
ref: n,
|
|
2542
2609
|
...t
|
|
@@ -2544,11 +2611,11 @@ var U = class {
|
|
|
2544
2611
|
}
|
|
2545
2612
|
async getAttributes(e, t) {
|
|
2546
2613
|
let n = f(e), { fullObject: r } = t || {};
|
|
2547
|
-
return r ?
|
|
2614
|
+
return r ? ye({
|
|
2548
2615
|
context: this.context,
|
|
2549
2616
|
ref: n,
|
|
2550
2617
|
...t
|
|
2551
|
-
}) :
|
|
2618
|
+
}) : ve({
|
|
2552
2619
|
context: this.context,
|
|
2553
2620
|
ref: n,
|
|
2554
2621
|
...t
|
|
@@ -2561,7 +2628,7 @@ var U = class {
|
|
|
2561
2628
|
});
|
|
2562
2629
|
}
|
|
2563
2630
|
};
|
|
2564
|
-
function
|
|
2631
|
+
function W(e) {
|
|
2565
2632
|
let { context: t, status: n, record: r, oldRecord: i, newRecord: a } = e, s, c, l;
|
|
2566
2633
|
r && (s = d(r)), i && (c = d(i)), a && (l = d(a)), n === "created" ? (o(s, {
|
|
2567
2634
|
detail: "Record is required for created",
|
|
@@ -2586,18 +2653,18 @@ function et(e) {
|
|
|
2586
2653
|
newRecord: void 0
|
|
2587
2654
|
}));
|
|
2588
2655
|
}
|
|
2589
|
-
function
|
|
2656
|
+
function rt(e) {
|
|
2590
2657
|
let { context: t, operations: n } = e;
|
|
2591
2658
|
for (let e of n) switch (e.status) {
|
|
2592
2659
|
case "created":
|
|
2593
|
-
|
|
2660
|
+
W({
|
|
2594
2661
|
context: t,
|
|
2595
2662
|
status: "created",
|
|
2596
2663
|
record: e.newRecord
|
|
2597
2664
|
});
|
|
2598
2665
|
break;
|
|
2599
2666
|
case "updated":
|
|
2600
|
-
|
|
2667
|
+
W({
|
|
2601
2668
|
context: t,
|
|
2602
2669
|
status: "updated",
|
|
2603
2670
|
oldRecord: e.oldRecord,
|
|
@@ -2605,7 +2672,7 @@ function W(e) {
|
|
|
2605
2672
|
});
|
|
2606
2673
|
break;
|
|
2607
2674
|
case "deleted":
|
|
2608
|
-
|
|
2675
|
+
W({
|
|
2609
2676
|
context: t,
|
|
2610
2677
|
status: "deleted",
|
|
2611
2678
|
record: e.oldRecord
|
|
@@ -2613,9 +2680,9 @@ function W(e) {
|
|
|
2613
2680
|
break;
|
|
2614
2681
|
}
|
|
2615
2682
|
}
|
|
2616
|
-
async function
|
|
2683
|
+
async function it(e) {
|
|
2617
2684
|
let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, params: c } = e, { id: u, tagName: d, attributes: f, namespace: p, value: m } = c;
|
|
2618
|
-
|
|
2685
|
+
G({
|
|
2619
2686
|
attributes: f,
|
|
2620
2687
|
tagName: d
|
|
2621
2688
|
});
|
|
@@ -2648,7 +2715,7 @@ async function tt(e) {
|
|
|
2648
2715
|
dialecteConfig: t,
|
|
2649
2716
|
tagName: g.tagName,
|
|
2650
2717
|
attributes: g.attributes
|
|
2651
|
-
}),
|
|
2718
|
+
}), W({
|
|
2652
2719
|
context: r,
|
|
2653
2720
|
status: "created",
|
|
2654
2721
|
record: g
|
|
@@ -2660,12 +2727,12 @@ async function tt(e) {
|
|
|
2660
2727
|
tagName: g.tagName
|
|
2661
2728
|
}]
|
|
2662
2729
|
};
|
|
2663
|
-
return
|
|
2730
|
+
return W({
|
|
2664
2731
|
context: r,
|
|
2665
2732
|
status: "updated",
|
|
2666
2733
|
oldRecord: h,
|
|
2667
2734
|
newRecord: _
|
|
2668
|
-
}), n?.afterCreated &&
|
|
2735
|
+
}), n?.afterCreated && rt({
|
|
2669
2736
|
context: r,
|
|
2670
2737
|
operations: await n.afterCreated({
|
|
2671
2738
|
childRecord: g,
|
|
@@ -2674,46 +2741,48 @@ async function tt(e) {
|
|
|
2674
2741
|
})
|
|
2675
2742
|
}), g;
|
|
2676
2743
|
}
|
|
2677
|
-
function
|
|
2744
|
+
function G(t) {
|
|
2678
2745
|
let { attributes: n, tagName: r } = t;
|
|
2679
2746
|
if (!(!n || !Array.isArray(n))) for (let t of n) {
|
|
2680
|
-
let { name: n } = t;
|
|
2681
|
-
|
|
2747
|
+
let { name: n, namespace: i } = t;
|
|
2748
|
+
n === "xmlns" || n.startsWith("xmlns:") || !n.includes(":") || typeof i == "object" && i?.prefix === n.slice(0, n.indexOf(":")) || a("PREFIXED_ATTRIBUTE_NAME", {
|
|
2682
2749
|
detail: `Attribute '${n}' on '${r}' is prefixed — pass a local name plus its namespace instead: { name: '${e(n)}', namespace }.`,
|
|
2683
2750
|
ref: { tagName: r }
|
|
2684
2751
|
});
|
|
2685
2752
|
}
|
|
2686
2753
|
}
|
|
2687
|
-
async function
|
|
2688
|
-
let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, record: o
|
|
2754
|
+
async function at(e) {
|
|
2755
|
+
let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, record: o } = e, s = [];
|
|
2756
|
+
r.perf.start("core::deepClone"), r.perf.start("core::deepClone::countNodes");
|
|
2757
|
+
let c = K(o);
|
|
2758
|
+
r.perf.stop("core::deepClone::countNodes"), r.progress.plan({ steps: c });
|
|
2759
|
+
let l = await ot({
|
|
2689
2760
|
dialecteConfig: t,
|
|
2690
2761
|
hooks: n,
|
|
2691
2762
|
context: r,
|
|
2692
2763
|
query: i,
|
|
2693
2764
|
parentRef: a,
|
|
2694
2765
|
record: o,
|
|
2695
|
-
mappings:
|
|
2766
|
+
mappings: s
|
|
2696
2767
|
});
|
|
2697
|
-
|
|
2698
|
-
let e = await n.afterDeepClone({
|
|
2699
|
-
cumulativeCloneMappings: s,
|
|
2700
|
-
query: i
|
|
2701
|
-
});
|
|
2702
|
-
r.stagedOperations.push(...e);
|
|
2703
|
-
}
|
|
2704
|
-
return {
|
|
2768
|
+
return r.progress.endPlan(), r.perf.stop("core::deepClone"), {
|
|
2705
2769
|
record: l,
|
|
2706
|
-
mappings:
|
|
2770
|
+
mappings: s
|
|
2707
2771
|
};
|
|
2708
2772
|
}
|
|
2709
|
-
|
|
2773
|
+
function K(e) {
|
|
2774
|
+
let t = 1;
|
|
2775
|
+
for (let n of e.tree) t += K(n);
|
|
2776
|
+
return t;
|
|
2777
|
+
}
|
|
2778
|
+
async function ot(e) {
|
|
2710
2779
|
let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, record: o, mappings: s } = e, c = !0, l = o;
|
|
2711
2780
|
if (n?.beforeClone) {
|
|
2712
2781
|
let e = n.beforeClone({ record: o });
|
|
2713
2782
|
c = e.shouldBeCloned, l = e.transformedRecord;
|
|
2714
2783
|
}
|
|
2715
2784
|
if (!c) return l;
|
|
2716
|
-
let u = await
|
|
2785
|
+
let u = await it({
|
|
2717
2786
|
dialecteConfig: t,
|
|
2718
2787
|
hooks: n,
|
|
2719
2788
|
context: r,
|
|
@@ -2729,8 +2798,8 @@ async function it(e) {
|
|
|
2729
2798
|
s.push({
|
|
2730
2799
|
source: Object.assign(d, { attributes: [...o.attributes] }),
|
|
2731
2800
|
target: f(u)
|
|
2732
|
-
});
|
|
2733
|
-
for (let e of l.tree) await
|
|
2801
|
+
}), r.progress.nextStep();
|
|
2802
|
+
for (let e of l.tree) await ot({
|
|
2734
2803
|
dialecteConfig: t,
|
|
2735
2804
|
hooks: n,
|
|
2736
2805
|
context: r,
|
|
@@ -2741,7 +2810,7 @@ async function it(e) {
|
|
|
2741
2810
|
});
|
|
2742
2811
|
return u;
|
|
2743
2812
|
}
|
|
2744
|
-
async function
|
|
2813
|
+
async function st(e) {
|
|
2745
2814
|
let { hooks: t, context: n, query: r, ref: i } = e, a = await E({
|
|
2746
2815
|
context: n,
|
|
2747
2816
|
ref: i
|
|
@@ -2753,16 +2822,16 @@ async function G(e) {
|
|
|
2753
2822
|
}), o(a.parent, {
|
|
2754
2823
|
detail: "Cannot delete root element",
|
|
2755
2824
|
key: "PROTECTED_ROOT"
|
|
2756
|
-
}), t?.beforeDelete &&
|
|
2825
|
+
}), t?.beforeDelete && rt({
|
|
2757
2826
|
context: n,
|
|
2758
2827
|
operations: await t.beforeDelete({
|
|
2759
2828
|
record: a,
|
|
2760
2829
|
query: r
|
|
2761
2830
|
})
|
|
2762
|
-
}), await
|
|
2831
|
+
}), await ct({
|
|
2763
2832
|
context: n,
|
|
2764
2833
|
record: a
|
|
2765
|
-
}),
|
|
2834
|
+
}), W({
|
|
2766
2835
|
context: n,
|
|
2767
2836
|
status: "deleted",
|
|
2768
2837
|
record: a
|
|
@@ -2779,32 +2848,32 @@ async function G(e) {
|
|
|
2779
2848
|
...s,
|
|
2780
2849
|
children: s.children.filter((e) => e.id !== a.id)
|
|
2781
2850
|
};
|
|
2782
|
-
return
|
|
2851
|
+
return W({
|
|
2783
2852
|
context: n,
|
|
2784
2853
|
status: "updated",
|
|
2785
2854
|
oldRecord: s,
|
|
2786
2855
|
newRecord: c
|
|
2787
2856
|
}), c;
|
|
2788
2857
|
}
|
|
2789
|
-
async function
|
|
2858
|
+
async function ct(e) {
|
|
2790
2859
|
let { context: t, record: n } = e;
|
|
2791
2860
|
for (let e of n.children) {
|
|
2792
2861
|
let n = await E({
|
|
2793
2862
|
context: t,
|
|
2794
2863
|
ref: f(e)
|
|
2795
2864
|
});
|
|
2796
|
-
n && (n.children.length > 0 && await
|
|
2865
|
+
n && (n.children.length > 0 && await ct({
|
|
2797
2866
|
context: t,
|
|
2798
2867
|
record: n
|
|
2799
|
-
}),
|
|
2868
|
+
}), W({
|
|
2800
2869
|
context: t,
|
|
2801
2870
|
status: "deleted",
|
|
2802
2871
|
record: n
|
|
2803
2872
|
}));
|
|
2804
2873
|
}
|
|
2805
2874
|
}
|
|
2806
|
-
async function
|
|
2807
|
-
let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, params: o } = e, s =
|
|
2875
|
+
async function lt(e) {
|
|
2876
|
+
let { dialecteConfig: t, hooks: n, context: r, query: i, parentRef: a, params: o } = e, s = ut(o.attributes), c = await A({
|
|
2808
2877
|
context: r,
|
|
2809
2878
|
ref: a,
|
|
2810
2879
|
tagName: o.tagName
|
|
@@ -2812,7 +2881,7 @@ async function K(e) {
|
|
|
2812
2881
|
return (s ? c.find((e) => M({
|
|
2813
2882
|
record: e,
|
|
2814
2883
|
attributeFilter: s
|
|
2815
|
-
})) : o.id === void 0 ? c[0] : c.find((e) => e.id === o.id)) ||
|
|
2884
|
+
})) : o.id === void 0 ? c[0] : c.find((e) => e.id === o.id)) || it({
|
|
2816
2885
|
dialecteConfig: t,
|
|
2817
2886
|
hooks: n,
|
|
2818
2887
|
context: r,
|
|
@@ -2821,12 +2890,12 @@ async function K(e) {
|
|
|
2821
2890
|
params: o
|
|
2822
2891
|
});
|
|
2823
2892
|
}
|
|
2824
|
-
function
|
|
2893
|
+
function ut(e) {
|
|
2825
2894
|
if (!e) return;
|
|
2826
2895
|
let t = Array.isArray(e) ? Object.fromEntries(e.map((e) => [e.name, e.value])) : e;
|
|
2827
2896
|
return Object.values(t).some((e) => e !== void 0 && e !== "") ? t : void 0;
|
|
2828
2897
|
}
|
|
2829
|
-
async function
|
|
2898
|
+
async function dt(e) {
|
|
2830
2899
|
let { dialecteConfig: t, hooks: n, context: r, query: i, ref: a, params: c } = e, { attributes: d, value: f } = c, p = await E({
|
|
2831
2900
|
context: r,
|
|
2832
2901
|
ref: a
|
|
@@ -2858,12 +2927,12 @@ async function st(e) {
|
|
|
2858
2927
|
value: f === void 0 ? p.value : f
|
|
2859
2928
|
}
|
|
2860
2929
|
});
|
|
2861
|
-
return
|
|
2930
|
+
return ft(p, h) ? h : (W({
|
|
2862
2931
|
context: r,
|
|
2863
2932
|
status: "updated",
|
|
2864
2933
|
oldRecord: p,
|
|
2865
2934
|
newRecord: h
|
|
2866
|
-
}), n?.afterUpdated &&
|
|
2935
|
+
}), n?.afterUpdated && rt({
|
|
2867
2936
|
context: r,
|
|
2868
2937
|
operations: await n.afterUpdated({
|
|
2869
2938
|
oldRecord: p,
|
|
@@ -2872,18 +2941,18 @@ async function st(e) {
|
|
|
2872
2941
|
})
|
|
2873
2942
|
}), h);
|
|
2874
2943
|
}
|
|
2875
|
-
function
|
|
2876
|
-
return e.value !== t.value || e.attributes.length !== t.attributes.length ? !1 : e.attributes.every((e, n) =>
|
|
2944
|
+
function ft(e, t) {
|
|
2945
|
+
return e.value !== t.value || e.attributes.length !== t.attributes.length ? !1 : e.attributes.every((e, n) => pt(e, t.attributes[n]));
|
|
2877
2946
|
}
|
|
2878
|
-
function
|
|
2947
|
+
function pt(e, t) {
|
|
2879
2948
|
return e.name === t.name && e.value === t.value && e.namespace?.uri === t.namespace?.uri && e.namespace?.prefix === t.namespace?.prefix;
|
|
2880
2949
|
}
|
|
2881
|
-
var
|
|
2950
|
+
var mt = class extends U {
|
|
2882
2951
|
constructor(e, t, n, r) {
|
|
2883
2952
|
super(e, t), this.hooks = n, this.query = r;
|
|
2884
2953
|
}
|
|
2885
2954
|
async addChild(e, t) {
|
|
2886
|
-
return
|
|
2955
|
+
return it({
|
|
2887
2956
|
context: this.getContext(),
|
|
2888
2957
|
parentRef: f(e),
|
|
2889
2958
|
params: {
|
|
@@ -2899,7 +2968,7 @@ var ut = class extends U {
|
|
|
2899
2968
|
});
|
|
2900
2969
|
}
|
|
2901
2970
|
async ensureChild(e, t) {
|
|
2902
|
-
return
|
|
2971
|
+
return lt({
|
|
2903
2972
|
context: this.getContext(),
|
|
2904
2973
|
parentRef: f(e),
|
|
2905
2974
|
params: {
|
|
@@ -2915,7 +2984,7 @@ var ut = class extends U {
|
|
|
2915
2984
|
});
|
|
2916
2985
|
}
|
|
2917
2986
|
async update(e, t) {
|
|
2918
|
-
return
|
|
2987
|
+
return dt({
|
|
2919
2988
|
context: this.getContext(),
|
|
2920
2989
|
ref: f(e),
|
|
2921
2990
|
params: {
|
|
@@ -2928,7 +2997,7 @@ var ut = class extends U {
|
|
|
2928
2997
|
});
|
|
2929
2998
|
}
|
|
2930
2999
|
async delete(e) {
|
|
2931
|
-
return
|
|
3000
|
+
return st({
|
|
2932
3001
|
context: this.getContext(),
|
|
2933
3002
|
ref: f(e),
|
|
2934
3003
|
hooks: this.hooks,
|
|
@@ -2936,18 +3005,17 @@ var ut = class extends U {
|
|
|
2936
3005
|
});
|
|
2937
3006
|
}
|
|
2938
3007
|
async deepClone(e, t) {
|
|
2939
|
-
return await
|
|
3008
|
+
return await at({
|
|
2940
3009
|
dialecteConfig: this.dialecteConfig,
|
|
2941
3010
|
hooks: this.hooks,
|
|
2942
3011
|
context: this.getContext(),
|
|
2943
3012
|
query: this.query,
|
|
2944
3013
|
parentRef: f(e),
|
|
2945
|
-
record: t
|
|
2946
|
-
cumulativeCloneMappings: []
|
|
3014
|
+
record: t
|
|
2947
3015
|
});
|
|
2948
3016
|
}
|
|
2949
3017
|
};
|
|
2950
|
-
function
|
|
3018
|
+
function q(e) {
|
|
2951
3019
|
let t = /* @__PURE__ */ new Map();
|
|
2952
3020
|
for (let n of e) {
|
|
2953
3021
|
let e = (n.status === "deleted" ? n.oldRecord : n.newRecord).id, r = t.get(e);
|
|
@@ -2976,38 +3044,40 @@ function dt(e) {
|
|
|
2976
3044
|
deletes: n.filter((e) => e.status === "deleted")
|
|
2977
3045
|
};
|
|
2978
3046
|
}
|
|
2979
|
-
async function
|
|
2980
|
-
let { stagedOperations: t, store: n, documentId: r, documentState: i
|
|
2981
|
-
|
|
2982
|
-
|
|
2983
|
-
|
|
2984
|
-
|
|
3047
|
+
async function ht(e) {
|
|
3048
|
+
let { stagedOperations: t, store: n, documentId: r, documentState: i, progress: a, perf: o = $e } = e;
|
|
3049
|
+
o.start("core::commit"), o.start("core::commit::merge");
|
|
3050
|
+
let { creates: s, updates: c, deletes: l } = q(t);
|
|
3051
|
+
o.stop("core::commit::merge");
|
|
3052
|
+
let u = s.length + c.length + l.length;
|
|
3053
|
+
i.loading = !0, a.plan({ steps: u });
|
|
3054
|
+
let d = 0, f = (e) => {
|
|
3055
|
+
for (; d < e;) a.nextStep(), d++;
|
|
2985
3056
|
};
|
|
2986
3057
|
try {
|
|
2987
|
-
await n.commit({
|
|
3058
|
+
o.count("core::store::commit"), o.start("core::store::commit"), await n.commit({
|
|
2988
3059
|
documentId: r,
|
|
2989
|
-
creates:
|
|
2990
|
-
updates:
|
|
2991
|
-
deletes:
|
|
2992
|
-
onProgress: (e
|
|
2993
|
-
|
|
2994
|
-
message: "Committing changes...",
|
|
2995
|
-
current: e,
|
|
2996
|
-
total: t
|
|
2997
|
-
};
|
|
3060
|
+
creates: s.map((e) => e.newRecord),
|
|
3061
|
+
updates: c.map((e) => e.newRecord),
|
|
3062
|
+
deletes: l.map((e) => e.oldRecord.id),
|
|
3063
|
+
onProgress: (e) => {
|
|
3064
|
+
f(e);
|
|
2998
3065
|
}
|
|
2999
|
-
});
|
|
3066
|
+
}), o.stop("core::store::commit");
|
|
3000
3067
|
} catch (e) {
|
|
3001
|
-
throw i.loading = !1,
|
|
3068
|
+
throw i.loading = !1, a.endPlan(), o.stop("core::commit"), e;
|
|
3002
3069
|
}
|
|
3003
|
-
i.lastUpdate = Date.now();
|
|
3070
|
+
i.lastUpdate = Date.now(), a.endPlan(), o.stop("core::commit");
|
|
3004
3071
|
}
|
|
3005
|
-
var
|
|
3006
|
-
constructor(e, t, n, r, i) {
|
|
3007
|
-
super(e, t, n), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.
|
|
3072
|
+
var gt = class extends nt {
|
|
3073
|
+
constructor(e, t, n, r, i, a = $e, o = () => {}) {
|
|
3074
|
+
super(e, t, n, a), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.documentActivity = r, this.hooks = i, this.progressReporter = w(r, o);
|
|
3075
|
+
}
|
|
3076
|
+
get progress() {
|
|
3077
|
+
return this.progressReporter;
|
|
3008
3078
|
}
|
|
3009
3079
|
get any() {
|
|
3010
|
-
return this._anyTx ??= new
|
|
3080
|
+
return this._anyTx ??= new mt(() => this.context, this.dialecteConfig, this.hooks, this);
|
|
3011
3081
|
}
|
|
3012
3082
|
getOperations() {
|
|
3013
3083
|
return this.stagedOperations;
|
|
@@ -3018,11 +3088,13 @@ var pt = class extends $e {
|
|
|
3018
3088
|
dialecteConfig: this.dialecteConfig,
|
|
3019
3089
|
documentId: this.documentId,
|
|
3020
3090
|
recordCache: this.recordCache,
|
|
3021
|
-
stagedOperations: this.stagedOperations
|
|
3091
|
+
stagedOperations: this.stagedOperations,
|
|
3092
|
+
progress: this.progressReporter,
|
|
3093
|
+
perf: this.perf
|
|
3022
3094
|
};
|
|
3023
3095
|
}
|
|
3024
3096
|
async addChild(e, t) {
|
|
3025
|
-
return
|
|
3097
|
+
return it({
|
|
3026
3098
|
context: this.context,
|
|
3027
3099
|
parentRef: f(e),
|
|
3028
3100
|
params: t,
|
|
@@ -3032,7 +3104,7 @@ var pt = class extends $e {
|
|
|
3032
3104
|
});
|
|
3033
3105
|
}
|
|
3034
3106
|
async ensureChild(e, t) {
|
|
3035
|
-
return
|
|
3107
|
+
return lt({
|
|
3036
3108
|
context: this.context,
|
|
3037
3109
|
parentRef: f(e),
|
|
3038
3110
|
params: t,
|
|
@@ -3042,7 +3114,7 @@ var pt = class extends $e {
|
|
|
3042
3114
|
});
|
|
3043
3115
|
}
|
|
3044
3116
|
async update(e, t) {
|
|
3045
|
-
return
|
|
3117
|
+
return dt({
|
|
3046
3118
|
context: this.context,
|
|
3047
3119
|
ref: f(e),
|
|
3048
3120
|
params: t,
|
|
@@ -3052,7 +3124,7 @@ var pt = class extends $e {
|
|
|
3052
3124
|
});
|
|
3053
3125
|
}
|
|
3054
3126
|
async delete(e) {
|
|
3055
|
-
return
|
|
3127
|
+
return st({
|
|
3056
3128
|
context: this.context,
|
|
3057
3129
|
ref: f(e),
|
|
3058
3130
|
hooks: this.hooks,
|
|
@@ -3060,14 +3132,13 @@ var pt = class extends $e {
|
|
|
3060
3132
|
});
|
|
3061
3133
|
}
|
|
3062
3134
|
async deepClone(e, t) {
|
|
3063
|
-
return
|
|
3135
|
+
return at({
|
|
3064
3136
|
dialecteConfig: this.dialecteConfig,
|
|
3065
3137
|
hooks: this.hooks,
|
|
3066
3138
|
context: this.context,
|
|
3067
3139
|
parentRef: f(e),
|
|
3068
3140
|
record: t,
|
|
3069
|
-
query: this
|
|
3070
|
-
cumulativeCloneMappings: this.cumulativeCloneMappings
|
|
3141
|
+
query: this
|
|
3071
3142
|
});
|
|
3072
3143
|
}
|
|
3073
3144
|
getStagedOperations() {
|
|
@@ -3079,26 +3150,25 @@ var pt = class extends $e {
|
|
|
3079
3150
|
clearRecordCache() {
|
|
3080
3151
|
this.recordCache.clear();
|
|
3081
3152
|
}
|
|
3082
|
-
clearCumulativeCloneMappings() {
|
|
3083
|
-
this.cumulativeCloneMappings = [];
|
|
3084
|
-
}
|
|
3085
3153
|
async commit() {
|
|
3086
|
-
await
|
|
3154
|
+
await ht({
|
|
3087
3155
|
stagedOperations: this.stagedOperations,
|
|
3088
3156
|
store: this.store,
|
|
3089
3157
|
documentId: this.documentId,
|
|
3090
|
-
documentState: this.documentActivity
|
|
3158
|
+
documentState: this.documentActivity,
|
|
3159
|
+
progress: this.progressReporter,
|
|
3160
|
+
perf: this.perf
|
|
3091
3161
|
});
|
|
3092
3162
|
}
|
|
3093
3163
|
};
|
|
3094
|
-
function
|
|
3164
|
+
function _t(e) {
|
|
3095
3165
|
return e.recordCache !== void 0;
|
|
3096
3166
|
}
|
|
3097
|
-
var
|
|
3098
|
-
function
|
|
3099
|
-
return `${
|
|
3167
|
+
var vt = "xel_";
|
|
3168
|
+
function J(e) {
|
|
3169
|
+
return `${vt}${e}`;
|
|
3100
3170
|
}
|
|
3101
|
-
var
|
|
3171
|
+
var yt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
3102
3172
|
(function(n, r) {
|
|
3103
3173
|
typeof e == "object" && t !== void 0 ? t.exports = r() : typeof define == "function" && define.amd ? define(r) : (n = typeof globalThis < "u" ? globalThis : n || self).Dexie = r();
|
|
3104
3174
|
})(e, function() {
|
|
@@ -3232,26 +3302,26 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3232
3302
|
return n;
|
|
3233
3303
|
}(e), T = null, e;
|
|
3234
3304
|
}
|
|
3235
|
-
var
|
|
3236
|
-
function
|
|
3237
|
-
return
|
|
3305
|
+
var re = {}.toString;
|
|
3306
|
+
function ie(e) {
|
|
3307
|
+
return re.call(e).slice(8, -1);
|
|
3238
3308
|
}
|
|
3239
|
-
var
|
|
3309
|
+
var E = typeof Symbol < "u" ? Symbol.iterator : "@@iterator", D = typeof E == "symbol" ? function(e) {
|
|
3240
3310
|
var t;
|
|
3241
|
-
return e != null && (t = e[
|
|
3311
|
+
return e != null && (t = e[E]) && t.apply(e);
|
|
3242
3312
|
} : function() {
|
|
3243
3313
|
return null;
|
|
3244
3314
|
};
|
|
3245
|
-
function
|
|
3315
|
+
function O(e, t) {
|
|
3246
3316
|
return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
|
|
3247
3317
|
}
|
|
3248
|
-
var
|
|
3249
|
-
function
|
|
3318
|
+
var k = {};
|
|
3319
|
+
function A(e) {
|
|
3250
3320
|
var t, n, r, i;
|
|
3251
3321
|
if (arguments.length === 1) {
|
|
3252
3322
|
if (a(e)) return e.slice();
|
|
3253
|
-
if (this ===
|
|
3254
|
-
if (i =
|
|
3323
|
+
if (this === k && typeof e == "string") return [e];
|
|
3324
|
+
if (i = D(e)) {
|
|
3255
3325
|
for (n = []; !(r = i.next()).done;) n.push(r.value);
|
|
3256
3326
|
return n;
|
|
3257
3327
|
}
|
|
@@ -3262,11 +3332,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3262
3332
|
for (t = arguments.length, n = Array(t); t--;) n[t] = arguments[t];
|
|
3263
3333
|
return n;
|
|
3264
3334
|
}
|
|
3265
|
-
var
|
|
3335
|
+
var ae = typeof Symbol < "u" ? function(e) {
|
|
3266
3336
|
return e[Symbol.toStringTag] === "AsyncFunction";
|
|
3267
3337
|
} : function() {
|
|
3268
3338
|
return !1;
|
|
3269
|
-
},
|
|
3339
|
+
}, j = [
|
|
3270
3340
|
"Unknown",
|
|
3271
3341
|
"Constraint",
|
|
3272
3342
|
"Data",
|
|
@@ -3281,7 +3351,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3281
3351
|
"QuotaExceeded",
|
|
3282
3352
|
"Syntax",
|
|
3283
3353
|
"DataClone"
|
|
3284
|
-
],
|
|
3354
|
+
], M = [
|
|
3285
3355
|
"Modify",
|
|
3286
3356
|
"Bulk",
|
|
3287
3357
|
"OpenFailed",
|
|
@@ -3298,99 +3368,99 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3298
3368
|
"DatabaseClosed",
|
|
3299
3369
|
"PrematureCommit",
|
|
3300
3370
|
"ForeignAwait"
|
|
3301
|
-
].concat(
|
|
3371
|
+
].concat(j), oe = {
|
|
3302
3372
|
VersionChanged: "Database version changed by other database connection",
|
|
3303
3373
|
DatabaseClosed: "Database has been closed",
|
|
3304
3374
|
Abort: "Transaction aborted",
|
|
3305
3375
|
TransactionInactive: "Transaction has already completed or failed",
|
|
3306
3376
|
MissingAPI: "IndexedDB API missing. Please visit https://tinyurl.com/y2uuvskb"
|
|
3307
3377
|
};
|
|
3308
|
-
function
|
|
3378
|
+
function N(e, t) {
|
|
3309
3379
|
this.name = e, this.message = t;
|
|
3310
3380
|
}
|
|
3311
|
-
function
|
|
3381
|
+
function P(e, t) {
|
|
3312
3382
|
return e + ". Errors: " + Object.keys(t).map(function(e) {
|
|
3313
3383
|
return t[e].toString();
|
|
3314
3384
|
}).filter(function(e, t, n) {
|
|
3315
3385
|
return n.indexOf(e) === t;
|
|
3316
3386
|
}).join("\n");
|
|
3317
3387
|
}
|
|
3318
|
-
function
|
|
3319
|
-
this.failures = t, this.failedKeys = r, this.successCount = n, this.message =
|
|
3388
|
+
function se(e, t, n, r) {
|
|
3389
|
+
this.failures = t, this.failedKeys = r, this.successCount = n, this.message = P(e, t);
|
|
3320
3390
|
}
|
|
3321
|
-
function
|
|
3391
|
+
function ce(e, t) {
|
|
3322
3392
|
this.name = "BulkError", this.failures = Object.keys(t).map(function(e) {
|
|
3323
3393
|
return t[e];
|
|
3324
|
-
}), this.failuresByPos = t, this.message =
|
|
3394
|
+
}), this.failuresByPos = t, this.message = P(e, this.failures);
|
|
3325
3395
|
}
|
|
3326
|
-
p(
|
|
3396
|
+
p(N).from(Error).extend({ toString: function() {
|
|
3327
3397
|
return this.name + ": " + this.message;
|
|
3328
|
-
} }), p(
|
|
3329
|
-
var
|
|
3398
|
+
} }), p(se).from(N), p(ce).from(N);
|
|
3399
|
+
var le = M.reduce(function(e, t) {
|
|
3330
3400
|
return e[t] = t + "Error", e;
|
|
3331
|
-
}, {}),
|
|
3401
|
+
}, {}), ue = N, F = M.reduce(function(e, t) {
|
|
3332
3402
|
var n = t + "Error";
|
|
3333
3403
|
function r(e, r) {
|
|
3334
|
-
this.name = n, e ? typeof e == "string" ? (this.message = `${e}${r ? "\n " + r : ""}`, this.inner = r || null) : typeof e == "object" && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message =
|
|
3404
|
+
this.name = n, e ? typeof e == "string" ? (this.message = `${e}${r ? "\n " + r : ""}`, this.inner = r || null) : typeof e == "object" && (this.message = `${e.name} ${e.message}`, this.inner = e) : (this.message = oe[t] || n, this.inner = null);
|
|
3335
3405
|
}
|
|
3336
|
-
return p(r).from(
|
|
3406
|
+
return p(r).from(ue), e[t] = r, e;
|
|
3337
3407
|
}, {});
|
|
3338
|
-
|
|
3339
|
-
var
|
|
3340
|
-
return e[t + "Error"] =
|
|
3341
|
-
}, {}),
|
|
3408
|
+
F.Syntax = SyntaxError, F.Type = TypeError, F.Range = RangeError;
|
|
3409
|
+
var de = j.reduce(function(e, t) {
|
|
3410
|
+
return e[t + "Error"] = F[t], e;
|
|
3411
|
+
}, {}), fe = M.reduce(function(e, t) {
|
|
3342
3412
|
return [
|
|
3343
3413
|
"Syntax",
|
|
3344
3414
|
"Type",
|
|
3345
3415
|
"Range"
|
|
3346
|
-
].indexOf(t) === -1 && (e[t + "Error"] =
|
|
3416
|
+
].indexOf(t) === -1 && (e[t + "Error"] = F[t]), e;
|
|
3347
3417
|
}, {});
|
|
3348
|
-
function
|
|
3349
|
-
function
|
|
3418
|
+
function I() {}
|
|
3419
|
+
function pe(e) {
|
|
3350
3420
|
return e;
|
|
3351
3421
|
}
|
|
3352
|
-
function
|
|
3353
|
-
return e == null || e ===
|
|
3422
|
+
function me(e, t) {
|
|
3423
|
+
return e == null || e === pe ? t : function(n) {
|
|
3354
3424
|
return t(e(n));
|
|
3355
3425
|
};
|
|
3356
3426
|
}
|
|
3357
|
-
function
|
|
3427
|
+
function he(e, t) {
|
|
3358
3428
|
return function() {
|
|
3359
3429
|
e.apply(this, arguments), t.apply(this, arguments);
|
|
3360
3430
|
};
|
|
3361
3431
|
}
|
|
3362
|
-
function
|
|
3363
|
-
return e ===
|
|
3432
|
+
function ge(e, t) {
|
|
3433
|
+
return e === I ? t : function() {
|
|
3364
3434
|
var n = e.apply(this, arguments);
|
|
3365
3435
|
n !== void 0 && (arguments[0] = n);
|
|
3366
3436
|
var r = this.onsuccess, i = this.onerror;
|
|
3367
3437
|
this.onsuccess = null, this.onerror = null;
|
|
3368
3438
|
var a = t.apply(this, arguments);
|
|
3369
|
-
return r && (this.onsuccess = this.onsuccess ?
|
|
3439
|
+
return r && (this.onsuccess = this.onsuccess ? he(r, this.onsuccess) : r), i && (this.onerror = this.onerror ? he(i, this.onerror) : i), a === void 0 ? n : a;
|
|
3370
3440
|
};
|
|
3371
3441
|
}
|
|
3372
|
-
function
|
|
3373
|
-
return e ===
|
|
3442
|
+
function _e(e, t) {
|
|
3443
|
+
return e === I ? t : function() {
|
|
3374
3444
|
e.apply(this, arguments);
|
|
3375
3445
|
var n = this.onsuccess, r = this.onerror;
|
|
3376
|
-
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ?
|
|
3446
|
+
this.onsuccess = this.onerror = null, t.apply(this, arguments), n && (this.onsuccess = this.onsuccess ? he(n, this.onsuccess) : n), r && (this.onerror = this.onerror ? he(r, this.onerror) : r);
|
|
3377
3447
|
};
|
|
3378
3448
|
}
|
|
3379
|
-
function
|
|
3380
|
-
return e ===
|
|
3449
|
+
function ve(e, t) {
|
|
3450
|
+
return e === I ? t : function(n) {
|
|
3381
3451
|
var r = e.apply(this, arguments);
|
|
3382
3452
|
o(n, r);
|
|
3383
3453
|
var i = this.onsuccess, a = this.onerror;
|
|
3384
|
-
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ?
|
|
3454
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), i && (this.onsuccess = this.onsuccess ? he(i, this.onsuccess) : i), a && (this.onerror = this.onerror ? he(a, this.onerror) : a), r === void 0 ? n === void 0 ? void 0 : n : o(r, n);
|
|
3385
3455
|
};
|
|
3386
3456
|
}
|
|
3387
|
-
function
|
|
3388
|
-
return e ===
|
|
3457
|
+
function ye(e, t) {
|
|
3458
|
+
return e === I ? t : function() {
|
|
3389
3459
|
return !1 !== t.apply(this, arguments) && e.apply(this, arguments);
|
|
3390
3460
|
};
|
|
3391
3461
|
}
|
|
3392
|
-
function
|
|
3393
|
-
return e ===
|
|
3462
|
+
function be(e, t) {
|
|
3463
|
+
return e === I ? t : function() {
|
|
3394
3464
|
var n = e.apply(this, arguments);
|
|
3395
3465
|
if (n && typeof n.then == "function") {
|
|
3396
3466
|
for (var r = this, i = arguments.length, a = Array(i); i--;) a[i] = arguments[i];
|
|
@@ -3401,12 +3471,12 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3401
3471
|
return t.apply(this, arguments);
|
|
3402
3472
|
};
|
|
3403
3473
|
}
|
|
3404
|
-
|
|
3405
|
-
var
|
|
3406
|
-
function
|
|
3407
|
-
|
|
3474
|
+
fe.ModifyError = se, fe.DexieError = N, fe.BulkError = ce;
|
|
3475
|
+
var L = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
3476
|
+
function xe(e) {
|
|
3477
|
+
L = e;
|
|
3408
3478
|
}
|
|
3409
|
-
var
|
|
3479
|
+
var Se = {}, Ce = 100, w = typeof Promise > "u" ? [] : function() {
|
|
3410
3480
|
var e = Promise.resolve();
|
|
3411
3481
|
if (typeof crypto > "u" || !crypto.subtle) return [
|
|
3412
3482
|
e,
|
|
@@ -3419,25 +3489,25 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3419
3489
|
s(t),
|
|
3420
3490
|
e
|
|
3421
3491
|
];
|
|
3422
|
-
}(),
|
|
3423
|
-
|
|
3424
|
-
},
|
|
3492
|
+
}(), j = w[0], M = w[1], w = w[2], M = M && M.then, we = j && j.constructor, Te = !!w, Ee = function(e, t) {
|
|
3493
|
+
Ne.push([e, t]), Oe &&= (queueMicrotask(He), !1);
|
|
3494
|
+
}, De = !0, Oe = !0, ke = [], Ae = [], je = pe, Me = {
|
|
3425
3495
|
id: "global",
|
|
3426
3496
|
global: !0,
|
|
3427
3497
|
ref: 0,
|
|
3428
3498
|
unhandleds: [],
|
|
3429
|
-
onunhandled:
|
|
3499
|
+
onunhandled: I,
|
|
3430
3500
|
pgp: !1,
|
|
3431
3501
|
env: {},
|
|
3432
|
-
finalize:
|
|
3433
|
-
},
|
|
3434
|
-
function
|
|
3502
|
+
finalize: I
|
|
3503
|
+
}, R = Me, Ne = [], Pe = 0, Fe = [];
|
|
3504
|
+
function z(e) {
|
|
3435
3505
|
if (typeof this != "object") throw TypeError("Promises must be constructed via new");
|
|
3436
3506
|
this._listeners = [], this._lib = !1;
|
|
3437
|
-
var t = this._PSD =
|
|
3507
|
+
var t = this._PSD = R;
|
|
3438
3508
|
if (typeof e != "function") {
|
|
3439
|
-
if (e !==
|
|
3440
|
-
this._state = arguments[1], this._value = arguments[2], !1 === this._state &&
|
|
3509
|
+
if (e !== Se) throw TypeError("Not a function");
|
|
3510
|
+
this._state = arguments[1], this._value = arguments[2], !1 === this._state && Re(this, this._value);
|
|
3441
3511
|
return;
|
|
3442
3512
|
}
|
|
3443
3513
|
this._state = null, this._value = null, ++t.ref, function e(t, n) {
|
|
@@ -3445,236 +3515,236 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3445
3515
|
n(function(n) {
|
|
3446
3516
|
if (t._state === null) {
|
|
3447
3517
|
if (n === t) throw TypeError("A promise cannot be resolved with itself.");
|
|
3448
|
-
var r = t._lib &&
|
|
3518
|
+
var r = t._lib && Ue();
|
|
3449
3519
|
n && typeof n.then == "function" ? e(t, function(e, t) {
|
|
3450
|
-
n instanceof
|
|
3451
|
-
}) : (t._state = !0, t._value = n,
|
|
3520
|
+
n instanceof z ? n._then(e, t) : n.then(e, t);
|
|
3521
|
+
}) : (t._state = !0, t._value = n, ze(t)), r && We();
|
|
3452
3522
|
}
|
|
3453
|
-
},
|
|
3523
|
+
}, Re.bind(null, t));
|
|
3454
3524
|
} catch (e) {
|
|
3455
|
-
|
|
3525
|
+
Re(t, e);
|
|
3456
3526
|
}
|
|
3457
3527
|
}(this, e);
|
|
3458
3528
|
}
|
|
3459
|
-
var
|
|
3529
|
+
var Ie = {
|
|
3460
3530
|
get: function() {
|
|
3461
|
-
var e =
|
|
3531
|
+
var e = R, t = Xe;
|
|
3462
3532
|
function n(n, r) {
|
|
3463
|
-
var i = this, a = !e.global && (e !==
|
|
3464
|
-
|
|
3533
|
+
var i = this, a = !e.global && (e !== R || t !== Xe), o = a && !H(), s = new z(function(t, s) {
|
|
3534
|
+
Be(i, new Le(rt(n, e, a, o), rt(r, e, a, o), t, s, e));
|
|
3465
3535
|
});
|
|
3466
3536
|
return this._consoleTask && (s._consoleTask = this._consoleTask), s;
|
|
3467
3537
|
}
|
|
3468
|
-
return n.prototype =
|
|
3538
|
+
return n.prototype = Se, n;
|
|
3469
3539
|
},
|
|
3470
3540
|
set: function(e) {
|
|
3471
|
-
f(this, "then", e && e.prototype ===
|
|
3541
|
+
f(this, "then", e && e.prototype === Se ? Ie : {
|
|
3472
3542
|
get: function() {
|
|
3473
3543
|
return e;
|
|
3474
3544
|
},
|
|
3475
|
-
set:
|
|
3545
|
+
set: Ie.set
|
|
3476
3546
|
});
|
|
3477
3547
|
}
|
|
3478
3548
|
};
|
|
3479
|
-
function
|
|
3549
|
+
function Le(e, t, n, r, i) {
|
|
3480
3550
|
this.onFulfilled = typeof e == "function" ? e : null, this.onRejected = typeof t == "function" ? t : null, this.resolve = n, this.reject = r, this.psd = i;
|
|
3481
3551
|
}
|
|
3482
|
-
function
|
|
3552
|
+
function Re(e, t) {
|
|
3483
3553
|
var n, r;
|
|
3484
|
-
|
|
3554
|
+
Ae.push(t), e._state === null && (n = e._lib && Ue(), t = je(t), e._state = !1, e._value = t, r = e, ke.some(function(e) {
|
|
3485
3555
|
return e._value === r._value;
|
|
3486
|
-
}) ||
|
|
3556
|
+
}) || ke.push(r), ze(e), n && We());
|
|
3487
3557
|
}
|
|
3488
|
-
function
|
|
3558
|
+
function ze(e) {
|
|
3489
3559
|
var t = e._listeners;
|
|
3490
3560
|
e._listeners = [];
|
|
3491
|
-
for (var n = 0, r = t.length; n < r; ++n)
|
|
3561
|
+
for (var n = 0, r = t.length; n < r; ++n) Be(e, t[n]);
|
|
3492
3562
|
var i = e._PSD;
|
|
3493
|
-
--i.ref || i.finalize(),
|
|
3494
|
-
--
|
|
3563
|
+
--i.ref || i.finalize(), Pe === 0 && (++Pe, Ee(function() {
|
|
3564
|
+
--Pe == 0 && Ge();
|
|
3495
3565
|
}, []));
|
|
3496
3566
|
}
|
|
3497
|
-
function
|
|
3567
|
+
function Be(e, t) {
|
|
3498
3568
|
if (e._state !== null) {
|
|
3499
3569
|
var n = e._state ? t.onFulfilled : t.onRejected;
|
|
3500
3570
|
if (n === null) return (e._state ? t.resolve : t.reject)(e._value);
|
|
3501
|
-
++t.psd.ref, ++
|
|
3571
|
+
++t.psd.ref, ++Pe, Ee(Ve, [
|
|
3502
3572
|
n,
|
|
3503
3573
|
e,
|
|
3504
3574
|
t
|
|
3505
3575
|
]);
|
|
3506
3576
|
} else e._listeners.push(t);
|
|
3507
3577
|
}
|
|
3508
|
-
function
|
|
3578
|
+
function Ve(e, t, n) {
|
|
3509
3579
|
try {
|
|
3510
3580
|
var r, i = t._value;
|
|
3511
|
-
!t._state &&
|
|
3581
|
+
!t._state && Ae.length && (Ae = []), r = L && t._consoleTask ? t._consoleTask.run(function() {
|
|
3512
3582
|
return e(i);
|
|
3513
|
-
}) : e(i), t._state ||
|
|
3514
|
-
for (var t =
|
|
3583
|
+
}) : e(i), t._state || Ae.indexOf(i) !== -1 || function(e) {
|
|
3584
|
+
for (var t = ke.length; t;) if (ke[--t]._value === e._value) return ke.splice(t, 1);
|
|
3515
3585
|
}(t), n.resolve(r);
|
|
3516
3586
|
} catch (e) {
|
|
3517
3587
|
n.reject(e);
|
|
3518
3588
|
} finally {
|
|
3519
|
-
--
|
|
3589
|
+
--Pe == 0 && Ge(), --n.psd.ref || n.psd.finalize();
|
|
3520
3590
|
}
|
|
3521
3591
|
}
|
|
3522
|
-
function Ve() {
|
|
3523
|
-
nt(je, function() {
|
|
3524
|
-
He() && Ue();
|
|
3525
|
-
});
|
|
3526
|
-
}
|
|
3527
3592
|
function He() {
|
|
3528
|
-
|
|
3529
|
-
|
|
3593
|
+
W(Me, function() {
|
|
3594
|
+
Ue() && We();
|
|
3595
|
+
});
|
|
3530
3596
|
}
|
|
3531
3597
|
function Ue() {
|
|
3598
|
+
var e = De;
|
|
3599
|
+
return Oe = De = !1, e;
|
|
3600
|
+
}
|
|
3601
|
+
function We() {
|
|
3532
3602
|
var e, t, n;
|
|
3533
3603
|
do
|
|
3534
|
-
for (; 0 <
|
|
3604
|
+
for (; 0 < Ne.length;) for (e = Ne, Ne = [], n = e.length, t = 0; t < n; ++t) {
|
|
3535
3605
|
var r = e[t];
|
|
3536
3606
|
r[0].apply(null, r[1]);
|
|
3537
3607
|
}
|
|
3538
|
-
while (0 <
|
|
3539
|
-
|
|
3608
|
+
while (0 < Ne.length);
|
|
3609
|
+
Oe = De = !0;
|
|
3540
3610
|
}
|
|
3541
|
-
function
|
|
3542
|
-
var e =
|
|
3543
|
-
|
|
3611
|
+
function Ge() {
|
|
3612
|
+
var e = ke;
|
|
3613
|
+
ke = [], e.forEach(function(e) {
|
|
3544
3614
|
e._PSD.onunhandled.call(null, e._value, e);
|
|
3545
3615
|
});
|
|
3546
|
-
for (var t =
|
|
3616
|
+
for (var t = Fe.slice(0), n = t.length; n;) t[--n]();
|
|
3547
3617
|
}
|
|
3548
|
-
function
|
|
3549
|
-
return new
|
|
3618
|
+
function Ke(e) {
|
|
3619
|
+
return new z(Se, !1, e);
|
|
3550
3620
|
}
|
|
3551
|
-
function
|
|
3552
|
-
var n =
|
|
3621
|
+
function B(e, t) {
|
|
3622
|
+
var n = R;
|
|
3553
3623
|
return function() {
|
|
3554
|
-
var r =
|
|
3624
|
+
var r = Ue(), i = R;
|
|
3555
3625
|
try {
|
|
3556
|
-
return
|
|
3626
|
+
return U(n, !0), e.apply(this, arguments);
|
|
3557
3627
|
} catch (e) {
|
|
3558
3628
|
t && t(e);
|
|
3559
3629
|
} finally {
|
|
3560
|
-
|
|
3630
|
+
U(i, !1), r && We();
|
|
3561
3631
|
}
|
|
3562
3632
|
};
|
|
3563
3633
|
}
|
|
3564
|
-
u(
|
|
3565
|
-
then:
|
|
3634
|
+
u(z.prototype, {
|
|
3635
|
+
then: Ie,
|
|
3566
3636
|
_then: function(e, t) {
|
|
3567
|
-
|
|
3637
|
+
Be(this, new Le(null, null, e, t, R));
|
|
3568
3638
|
},
|
|
3569
3639
|
catch: function(e) {
|
|
3570
3640
|
if (arguments.length === 1) return this.then(null, e);
|
|
3571
3641
|
var t = e, n = arguments[1];
|
|
3572
3642
|
return typeof t == "function" ? this.then(null, function(e) {
|
|
3573
|
-
return (e instanceof t ? n :
|
|
3643
|
+
return (e instanceof t ? n : Ke)(e);
|
|
3574
3644
|
}) : this.then(null, function(e) {
|
|
3575
|
-
return (e && e.name === t ? n :
|
|
3645
|
+
return (e && e.name === t ? n : Ke)(e);
|
|
3576
3646
|
});
|
|
3577
3647
|
},
|
|
3578
3648
|
finally: function(e) {
|
|
3579
3649
|
return this.then(function(t) {
|
|
3580
|
-
return
|
|
3650
|
+
return z.resolve(e()).then(function() {
|
|
3581
3651
|
return t;
|
|
3582
3652
|
});
|
|
3583
3653
|
}, function(t) {
|
|
3584
|
-
return
|
|
3585
|
-
return
|
|
3654
|
+
return z.resolve(e()).then(function() {
|
|
3655
|
+
return Ke(t);
|
|
3586
3656
|
});
|
|
3587
3657
|
});
|
|
3588
3658
|
},
|
|
3589
3659
|
timeout: function(e, t) {
|
|
3590
3660
|
var n = this;
|
|
3591
|
-
return e < Infinity ? new
|
|
3661
|
+
return e < Infinity ? new z(function(r, i) {
|
|
3592
3662
|
var a = setTimeout(function() {
|
|
3593
|
-
return i(new
|
|
3663
|
+
return i(new F.Timeout(t));
|
|
3594
3664
|
}, e);
|
|
3595
3665
|
n.then(r, i).finally(clearTimeout.bind(null, a));
|
|
3596
3666
|
}) : this;
|
|
3597
3667
|
}
|
|
3598
|
-
}), typeof Symbol < "u" && Symbol.toStringTag && f(
|
|
3668
|
+
}), typeof Symbol < "u" && Symbol.toStringTag && f(z.prototype, Symbol.toStringTag, "Dexie.Promise"), Me.env = nt(), u(z, {
|
|
3599
3669
|
all: function() {
|
|
3600
|
-
var e =
|
|
3601
|
-
return new
|
|
3670
|
+
var e = A.apply(null, arguments).map(et);
|
|
3671
|
+
return new z(function(t, n) {
|
|
3602
3672
|
e.length === 0 && t([]);
|
|
3603
3673
|
var r = e.length;
|
|
3604
3674
|
e.forEach(function(i, a) {
|
|
3605
|
-
return
|
|
3675
|
+
return z.resolve(i).then(function(n) {
|
|
3606
3676
|
e[a] = n, --r || t(e);
|
|
3607
3677
|
}, n);
|
|
3608
3678
|
});
|
|
3609
3679
|
});
|
|
3610
3680
|
},
|
|
3611
3681
|
resolve: function(e) {
|
|
3612
|
-
return e instanceof
|
|
3682
|
+
return e instanceof z ? e : e && typeof e.then == "function" ? new z(function(t, n) {
|
|
3613
3683
|
e.then(t, n);
|
|
3614
|
-
}) : new
|
|
3684
|
+
}) : new z(Se, !0, e);
|
|
3615
3685
|
},
|
|
3616
|
-
reject:
|
|
3686
|
+
reject: Ke,
|
|
3617
3687
|
race: function() {
|
|
3618
|
-
var e =
|
|
3619
|
-
return new
|
|
3688
|
+
var e = A.apply(null, arguments).map(et);
|
|
3689
|
+
return new z(function(t, n) {
|
|
3620
3690
|
e.map(function(e) {
|
|
3621
|
-
return
|
|
3691
|
+
return z.resolve(e).then(t, n);
|
|
3622
3692
|
});
|
|
3623
3693
|
});
|
|
3624
3694
|
},
|
|
3625
3695
|
PSD: {
|
|
3626
3696
|
get: function() {
|
|
3627
|
-
return
|
|
3697
|
+
return R;
|
|
3628
3698
|
},
|
|
3629
3699
|
set: function(e) {
|
|
3630
|
-
return
|
|
3700
|
+
return R = e;
|
|
3631
3701
|
}
|
|
3632
3702
|
},
|
|
3633
3703
|
totalEchoes: { get: function() {
|
|
3634
|
-
return
|
|
3704
|
+
return Xe;
|
|
3635
3705
|
} },
|
|
3636
|
-
newPSD:
|
|
3637
|
-
usePSD:
|
|
3706
|
+
newPSD: Qe,
|
|
3707
|
+
usePSD: W,
|
|
3638
3708
|
scheduler: {
|
|
3639
3709
|
get: function() {
|
|
3640
|
-
return
|
|
3710
|
+
return Ee;
|
|
3641
3711
|
},
|
|
3642
3712
|
set: function(e) {
|
|
3643
|
-
|
|
3713
|
+
Ee = e;
|
|
3644
3714
|
}
|
|
3645
3715
|
},
|
|
3646
3716
|
rejectionMapper: {
|
|
3647
3717
|
get: function() {
|
|
3648
|
-
return
|
|
3718
|
+
return je;
|
|
3649
3719
|
},
|
|
3650
3720
|
set: function(e) {
|
|
3651
|
-
|
|
3721
|
+
je = e;
|
|
3652
3722
|
}
|
|
3653
3723
|
},
|
|
3654
3724
|
follow: function(e, t) {
|
|
3655
|
-
return new
|
|
3656
|
-
return
|
|
3657
|
-
var r =
|
|
3658
|
-
r.unhandleds = [], r.onunhandled = n, r.finalize =
|
|
3725
|
+
return new z(function(n, r) {
|
|
3726
|
+
return Qe(function(t, n) {
|
|
3727
|
+
var r = R;
|
|
3728
|
+
r.unhandleds = [], r.onunhandled = n, r.finalize = he(function() {
|
|
3659
3729
|
var e, r = this;
|
|
3660
3730
|
e = function() {
|
|
3661
3731
|
r.unhandleds.length === 0 ? t() : n(r.unhandleds[0]);
|
|
3662
|
-
},
|
|
3663
|
-
e(),
|
|
3664
|
-
}), ++
|
|
3665
|
-
--
|
|
3732
|
+
}, Fe.push(function t() {
|
|
3733
|
+
e(), Fe.splice(Fe.indexOf(t), 1);
|
|
3734
|
+
}), ++Pe, Ee(function() {
|
|
3735
|
+
--Pe == 0 && Ge();
|
|
3666
3736
|
}, []);
|
|
3667
3737
|
}, r.finalize), e();
|
|
3668
3738
|
}, t, n, r);
|
|
3669
3739
|
});
|
|
3670
3740
|
}
|
|
3671
|
-
}),
|
|
3672
|
-
var e =
|
|
3673
|
-
return new
|
|
3741
|
+
}), we && (we.allSettled && f(z, "allSettled", function() {
|
|
3742
|
+
var e = A.apply(null, arguments).map(et);
|
|
3743
|
+
return new z(function(t) {
|
|
3674
3744
|
e.length === 0 && t([]);
|
|
3675
3745
|
var n = e.length, r = Array(n);
|
|
3676
3746
|
e.forEach(function(e, i) {
|
|
3677
|
-
return
|
|
3747
|
+
return z.resolve(e).then(function(e) {
|
|
3678
3748
|
return r[i] = {
|
|
3679
3749
|
status: "fulfilled",
|
|
3680
3750
|
value: e
|
|
@@ -3689,70 +3759,70 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3689
3759
|
});
|
|
3690
3760
|
});
|
|
3691
3761
|
});
|
|
3692
|
-
}),
|
|
3693
|
-
var e =
|
|
3694
|
-
return new
|
|
3762
|
+
}), we.any && typeof AggregateError < "u" && f(z, "any", function() {
|
|
3763
|
+
var e = A.apply(null, arguments).map(et);
|
|
3764
|
+
return new z(function(t, n) {
|
|
3695
3765
|
e.length === 0 && n(/* @__PURE__ */ AggregateError([]));
|
|
3696
3766
|
var r = e.length, i = Array(r);
|
|
3697
3767
|
e.forEach(function(e, a) {
|
|
3698
|
-
return
|
|
3768
|
+
return z.resolve(e).then(function(e) {
|
|
3699
3769
|
return t(e);
|
|
3700
3770
|
}, function(e) {
|
|
3701
3771
|
i[a] = e, --r || n(AggregateError(i));
|
|
3702
3772
|
});
|
|
3703
3773
|
});
|
|
3704
3774
|
});
|
|
3705
|
-
}),
|
|
3706
|
-
var
|
|
3775
|
+
}), we.withResolvers && (z.withResolvers = we.withResolvers));
|
|
3776
|
+
var V = {
|
|
3707
3777
|
awaits: 0,
|
|
3708
3778
|
echoes: 0,
|
|
3709
3779
|
id: 0
|
|
3710
|
-
},
|
|
3711
|
-
function
|
|
3712
|
-
var i =
|
|
3713
|
-
return a.parent = i, a.ref = 0, a.global = !1, a.id = ++
|
|
3714
|
-
Promise:
|
|
3780
|
+
}, qe = 0, Je = [], Ye = 0, Xe = 0, Ze = 0;
|
|
3781
|
+
function Qe(e, t, n, r) {
|
|
3782
|
+
var i = R, a = Object.create(i);
|
|
3783
|
+
return a.parent = i, a.ref = 0, a.global = !1, a.id = ++Ze, Me.env, a.env = Te ? {
|
|
3784
|
+
Promise: z,
|
|
3715
3785
|
PromiseProp: {
|
|
3716
|
-
value:
|
|
3786
|
+
value: z,
|
|
3717
3787
|
configurable: !0,
|
|
3718
3788
|
writable: !0
|
|
3719
3789
|
},
|
|
3720
|
-
all:
|
|
3721
|
-
race:
|
|
3722
|
-
allSettled:
|
|
3723
|
-
any:
|
|
3724
|
-
resolve:
|
|
3725
|
-
reject:
|
|
3790
|
+
all: z.all,
|
|
3791
|
+
race: z.race,
|
|
3792
|
+
allSettled: z.allSettled,
|
|
3793
|
+
any: z.any,
|
|
3794
|
+
resolve: z.resolve,
|
|
3795
|
+
reject: z.reject
|
|
3726
3796
|
} : {}, t && o(a, t), ++i.ref, a.finalize = function() {
|
|
3727
3797
|
--this.parent.ref || this.parent.finalize();
|
|
3728
|
-
}, r =
|
|
3798
|
+
}, r = W(a, e, n, r), a.ref === 0 && a.finalize(), r;
|
|
3729
3799
|
}
|
|
3730
|
-
function
|
|
3731
|
-
return
|
|
3800
|
+
function $e() {
|
|
3801
|
+
return V.id ||= ++qe, ++V.awaits, V.echoes += Ce, V.id;
|
|
3732
3802
|
}
|
|
3733
|
-
function
|
|
3734
|
-
return !!
|
|
3803
|
+
function H() {
|
|
3804
|
+
return !!V.awaits && (--V.awaits == 0 && (V.id = 0), V.echoes = V.awaits * Ce, !0);
|
|
3735
3805
|
}
|
|
3736
|
-
function
|
|
3737
|
-
return
|
|
3738
|
-
return
|
|
3806
|
+
function et(e) {
|
|
3807
|
+
return V.echoes && e && e.constructor === we ? ($e(), e.then(function(e) {
|
|
3808
|
+
return H(), e;
|
|
3739
3809
|
}, function(e) {
|
|
3740
|
-
return
|
|
3810
|
+
return H(), G(e);
|
|
3741
3811
|
})) : e;
|
|
3742
3812
|
}
|
|
3743
|
-
function
|
|
3744
|
-
var e =
|
|
3745
|
-
|
|
3813
|
+
function tt() {
|
|
3814
|
+
var e = Je[Je.length - 1];
|
|
3815
|
+
Je.pop(), U(e, !1);
|
|
3746
3816
|
}
|
|
3747
|
-
function
|
|
3748
|
-
var n, i =
|
|
3749
|
-
(t ? !
|
|
3750
|
-
++
|
|
3751
|
-
}.bind(null, e) :
|
|
3817
|
+
function U(e, t) {
|
|
3818
|
+
var n, i = R;
|
|
3819
|
+
(t ? !V.echoes || Ye++ && e === R : !Ye || --Ye && e === R) || queueMicrotask(t ? function(e) {
|
|
3820
|
+
++Xe, V.echoes && --V.echoes != 0 || (V.echoes = V.awaits = V.id = 0), Je.push(R), U(e, !0);
|
|
3821
|
+
}.bind(null, e) : tt), e !== R && (R = e, i === Me && (Me.env = nt()), Te && (n = Me.env.Promise, t = e.env, (i.global || e.global) && (Object.defineProperty(r, "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))));
|
|
3752
3822
|
}
|
|
3753
|
-
function
|
|
3823
|
+
function nt() {
|
|
3754
3824
|
var e = r.Promise;
|
|
3755
|
-
return
|
|
3825
|
+
return Te ? {
|
|
3756
3826
|
Promise: e,
|
|
3757
3827
|
PromiseProp: Object.getOwnPropertyDescriptor(r, "Promise"),
|
|
3758
3828
|
all: e.all,
|
|
@@ -3763,30 +3833,30 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3763
3833
|
reject: e.reject
|
|
3764
3834
|
} : {};
|
|
3765
3835
|
}
|
|
3766
|
-
function
|
|
3767
|
-
var a =
|
|
3836
|
+
function W(e, t, n, r, i) {
|
|
3837
|
+
var a = R;
|
|
3768
3838
|
try {
|
|
3769
|
-
return
|
|
3839
|
+
return U(e, !0), t(n, r, i);
|
|
3770
3840
|
} finally {
|
|
3771
|
-
|
|
3841
|
+
U(a, !1);
|
|
3772
3842
|
}
|
|
3773
3843
|
}
|
|
3774
3844
|
function rt(e, t, n, r) {
|
|
3775
3845
|
return typeof e == "function" ? function() {
|
|
3776
|
-
var i =
|
|
3777
|
-
n &&
|
|
3846
|
+
var i = R;
|
|
3847
|
+
n && $e(), U(t, !0);
|
|
3778
3848
|
try {
|
|
3779
3849
|
return e.apply(this, arguments);
|
|
3780
3850
|
} finally {
|
|
3781
|
-
|
|
3851
|
+
U(i, !1), r && queueMicrotask(H);
|
|
3782
3852
|
}
|
|
3783
3853
|
} : e;
|
|
3784
3854
|
}
|
|
3785
3855
|
function it(e) {
|
|
3786
|
-
Promise ===
|
|
3856
|
+
Promise === we && V.echoes === 0 ? Ye === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
3787
3857
|
}
|
|
3788
|
-
("" +
|
|
3789
|
-
var G =
|
|
3858
|
+
("" + M).indexOf("[native code]") === -1 && ($e = H = I);
|
|
3859
|
+
var G = z.reject, at = "", K = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", ot = "String expected.", st = [], ct = "__dbnames", lt = "readonly", ut = "readwrite";
|
|
3790
3860
|
function dt(e, t) {
|
|
3791
3861
|
return e ? t ? function() {
|
|
3792
3862
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -3807,7 +3877,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3807
3877
|
};
|
|
3808
3878
|
}
|
|
3809
3879
|
function mt() {
|
|
3810
|
-
throw
|
|
3880
|
+
throw F.Type("Entity instances must never be new:ed. Instances are generated by the framework bypassing the constructor.");
|
|
3811
3881
|
}
|
|
3812
3882
|
function q(e, t) {
|
|
3813
3883
|
try {
|
|
@@ -3834,7 +3904,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3834
3904
|
}
|
|
3835
3905
|
function ht(e) {
|
|
3836
3906
|
var t = typeof e;
|
|
3837
|
-
return t == "object" ? ArrayBuffer.isView(e) ? "binary" : (e =
|
|
3907
|
+
return t == "object" ? ArrayBuffer.isView(e) ? "binary" : (e = ie(e), e === "ArrayBuffer" ? "binary" : e) : t;
|
|
3838
3908
|
}
|
|
3839
3909
|
function gt(e) {
|
|
3840
3910
|
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
|
|
@@ -3850,31 +3920,31 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3850
3920
|
})) : n;
|
|
3851
3921
|
}
|
|
3852
3922
|
var vt = (J.prototype._trans = function(e, t, n) {
|
|
3853
|
-
var r = this._tx ||
|
|
3923
|
+
var r = this._tx || R.trans, i = this.name, a = L && typeof console < "u" && console.createTask && console.createTask(`Dexie: ${e === "readonly" ? "read" : "write"} ${this.name}`);
|
|
3854
3924
|
function o(e, n, r) {
|
|
3855
|
-
if (!r.schema[i]) throw new
|
|
3925
|
+
if (!r.schema[i]) throw new F.NotFound("Table " + i + " not part of transaction");
|
|
3856
3926
|
return t(r.idbtrans, r);
|
|
3857
3927
|
}
|
|
3858
|
-
var s =
|
|
3928
|
+
var s = Ue();
|
|
3859
3929
|
try {
|
|
3860
|
-
var c = r && r.db._novip === this.db._novip ? r ===
|
|
3930
|
+
var c = r && r.db._novip === this.db._novip ? r === R.trans ? r._promise(e, o, n) : Qe(function() {
|
|
3861
3931
|
return r._promise(e, o, n);
|
|
3862
3932
|
}, {
|
|
3863
3933
|
trans: r,
|
|
3864
|
-
transless:
|
|
3934
|
+
transless: R.transless || R
|
|
3865
3935
|
}) : function e(t, n, r, i) {
|
|
3866
|
-
if (t.idbdb && (t._state.openComplete ||
|
|
3936
|
+
if (t.idbdb && (t._state.openComplete || R.letThrough || t._vip)) {
|
|
3867
3937
|
var a = t._createTransaction(n, r, t._dbSchema);
|
|
3868
3938
|
try {
|
|
3869
3939
|
a.create(), t._state.PR1398_maxLoop = 3;
|
|
3870
3940
|
} catch (a) {
|
|
3871
|
-
return a.name ===
|
|
3941
|
+
return a.name === le.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
|
|
3872
3942
|
return e(t, n, r, i);
|
|
3873
3943
|
})) : G(a);
|
|
3874
3944
|
}
|
|
3875
3945
|
return a._promise(n, function(e, t) {
|
|
3876
|
-
return
|
|
3877
|
-
return
|
|
3946
|
+
return Qe(function() {
|
|
3947
|
+
return R.trans = a, i(e, t, a);
|
|
3878
3948
|
});
|
|
3879
3949
|
}).then(function(e) {
|
|
3880
3950
|
if (n === "readwrite") try {
|
|
@@ -3885,10 +3955,10 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3885
3955
|
});
|
|
3886
3956
|
});
|
|
3887
3957
|
}
|
|
3888
|
-
if (t._state.openComplete) return G(new
|
|
3958
|
+
if (t._state.openComplete) return G(new F.DatabaseClosed(t._state.dbOpenError));
|
|
3889
3959
|
if (!t._state.isBeingOpened) {
|
|
3890
|
-
if (!t._state.autoOpen) return G(new
|
|
3891
|
-
t.open().catch(
|
|
3960
|
+
if (!t._state.autoOpen) return G(new F.DatabaseClosed());
|
|
3961
|
+
t.open().catch(I);
|
|
3892
3962
|
}
|
|
3893
3963
|
return t._state.dbReadyPromise.then(function() {
|
|
3894
3964
|
return e(t, n, r, i);
|
|
@@ -3898,11 +3968,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3898
3968
|
return console.trace(e), G(e);
|
|
3899
3969
|
})), c;
|
|
3900
3970
|
} finally {
|
|
3901
|
-
s &&
|
|
3971
|
+
s && We();
|
|
3902
3972
|
}
|
|
3903
3973
|
}, J.prototype.get = function(e, t) {
|
|
3904
3974
|
var n = this;
|
|
3905
|
-
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? G(new
|
|
3975
|
+
return e && e.constructor === Object ? this.where(e).first(t) : e == null ? G(new F.Type("Invalid argument to Table.get()")) : this._trans("readonly", function(t) {
|
|
3906
3976
|
return n.core.get({
|
|
3907
3977
|
trans: t,
|
|
3908
3978
|
key: e
|
|
@@ -3932,7 +4002,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
3932
4002
|
return e[t];
|
|
3933
4003
|
}));
|
|
3934
4004
|
}
|
|
3935
|
-
!n &&
|
|
4005
|
+
!n && L && console.warn(`The query ${JSON.stringify(e)} on ${this.name} would benefit from a compound index [${t.join("+")}]`);
|
|
3936
4006
|
var o = this.schema.idxByName;
|
|
3937
4007
|
function s(e, t) {
|
|
3938
4008
|
return q(e, t) === 0;
|
|
@@ -4012,7 +4082,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4012
4082
|
values: [o]
|
|
4013
4083
|
});
|
|
4014
4084
|
}).then(function(e) {
|
|
4015
|
-
return e.numFailures ?
|
|
4085
|
+
return e.numFailures ? z.reject(e.failures[0]) : e.lastResult;
|
|
4016
4086
|
}).then(function(t) {
|
|
4017
4087
|
if (a) try {
|
|
4018
4088
|
x(e, a, t);
|
|
@@ -4020,7 +4090,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4020
4090
|
return t;
|
|
4021
4091
|
});
|
|
4022
4092
|
}, J.prototype.update = function(e, t) {
|
|
4023
|
-
return typeof e != "object" || a(e) ? this.where(":id").equals(e).modify(t) : (e = b(e, this.schema.primKey.keyPath), e === void 0 ? G(new
|
|
4093
|
+
return typeof e != "object" || a(e) ? this.where(":id").equals(e).modify(t) : (e = b(e, this.schema.primKey.keyPath), e === void 0 ? G(new F.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
4024
4094
|
}, J.prototype.put = function(e, t) {
|
|
4025
4095
|
var n = this, r = this.schema.primKey, i = r.auto, a = r.keyPath, o = e;
|
|
4026
4096
|
return a && i && (o = pt(a)(e)), this._trans("readwrite", function(e) {
|
|
@@ -4031,7 +4101,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4031
4101
|
keys: t == null ? null : [t]
|
|
4032
4102
|
});
|
|
4033
4103
|
}).then(function(e) {
|
|
4034
|
-
return e.numFailures ?
|
|
4104
|
+
return e.numFailures ? z.reject(e.failures[0]) : e.lastResult;
|
|
4035
4105
|
}).then(function(t) {
|
|
4036
4106
|
if (a) try {
|
|
4037
4107
|
x(e, a, t);
|
|
@@ -4048,7 +4118,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4048
4118
|
}).then(function(n) {
|
|
4049
4119
|
return _t(t, [e], n);
|
|
4050
4120
|
}).then(function(e) {
|
|
4051
|
-
return e.numFailures ?
|
|
4121
|
+
return e.numFailures ? z.reject(e.failures[0]) : void 0;
|
|
4052
4122
|
});
|
|
4053
4123
|
});
|
|
4054
4124
|
}, J.prototype.clear = function() {
|
|
@@ -4062,7 +4132,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4062
4132
|
return _t(e, null, t);
|
|
4063
4133
|
});
|
|
4064
4134
|
}).then(function(e) {
|
|
4065
|
-
return e.numFailures ?
|
|
4135
|
+
return e.numFailures ? z.reject(e.failures[0]) : void 0;
|
|
4066
4136
|
});
|
|
4067
4137
|
}, J.prototype.bulkGet = function(e) {
|
|
4068
4138
|
var t = this;
|
|
@@ -4080,8 +4150,8 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4080
4150
|
var r = this, i = Array.isArray(t) ? t : void 0, a = (n ||= i ? void 0 : t) ? n.allKeys : void 0;
|
|
4081
4151
|
return this._trans("readwrite", function(t) {
|
|
4082
4152
|
var n = r.schema.primKey, o = n.auto, n = n.keyPath;
|
|
4083
|
-
if (n && i) throw new
|
|
4084
|
-
if (i && i.length !== e.length) throw new
|
|
4153
|
+
if (n && i) throw new F.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
4154
|
+
if (i && i.length !== e.length) throw new F.InvalidArgument("Arguments objects and keys must have the same length");
|
|
4085
4155
|
var s = e.length, n = n && o ? e.map(pt(n)) : e;
|
|
4086
4156
|
return r.core.mutate({
|
|
4087
4157
|
trans: t,
|
|
@@ -4092,15 +4162,15 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4092
4162
|
}).then(function(e) {
|
|
4093
4163
|
var t = e.numFailures, n = e.results, i = e.lastResult, e = e.failures;
|
|
4094
4164
|
if (t === 0) return a ? n : i;
|
|
4095
|
-
throw new
|
|
4165
|
+
throw new ce(`${r.name}.bulkAdd(): ${t} of ${s} operations failed`, e);
|
|
4096
4166
|
});
|
|
4097
4167
|
});
|
|
4098
4168
|
}, J.prototype.bulkPut = function(e, t, n) {
|
|
4099
4169
|
var r = this, i = Array.isArray(t) ? t : void 0, a = (n ||= i ? void 0 : t) ? n.allKeys : void 0;
|
|
4100
4170
|
return this._trans("readwrite", function(t) {
|
|
4101
4171
|
var n = r.schema.primKey, o = n.auto, n = n.keyPath;
|
|
4102
|
-
if (n && i) throw new
|
|
4103
|
-
if (i && i.length !== e.length) throw new
|
|
4172
|
+
if (n && i) throw new F.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
4173
|
+
if (i && i.length !== e.length) throw new F.InvalidArgument("Arguments objects and keys must have the same length");
|
|
4104
4174
|
var s = e.length, n = n && o ? e.map(pt(n)) : e;
|
|
4105
4175
|
return r.core.mutate({
|
|
4106
4176
|
trans: t,
|
|
@@ -4111,7 +4181,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4111
4181
|
}).then(function(e) {
|
|
4112
4182
|
var t = e.numFailures, n = e.results, i = e.lastResult, e = e.failures;
|
|
4113
4183
|
if (t === 0) return a ? n : i;
|
|
4114
|
-
throw new
|
|
4184
|
+
throw new ce(`${r.name}.bulkPut(): ${t} of ${s} operations failed`, e);
|
|
4115
4185
|
});
|
|
4116
4186
|
});
|
|
4117
4187
|
}, J.prototype.bulkUpdate = function(e) {
|
|
@@ -4133,7 +4203,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4133
4203
|
for (var u = 0, d = Object.keys(i); u < d.length; u++) {
|
|
4134
4204
|
var f = d[u], p = i[f];
|
|
4135
4205
|
if (f === t.schema.primKey.keyPath) {
|
|
4136
|
-
if (q(p, r) !== 0) throw new
|
|
4206
|
+
if (q(p, r) !== 0) throw new F.Constraint("Cannot update primary key in bulkUpdate()");
|
|
4137
4207
|
} else x(o, f, p);
|
|
4138
4208
|
}
|
|
4139
4209
|
a.push(n), c.push(r), l.push(o);
|
|
@@ -4156,7 +4226,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4156
4226
|
var s, c = o[i], l = a[Number(c)];
|
|
4157
4227
|
l != null && (s = r[c], delete r[c], r[l] = s);
|
|
4158
4228
|
}
|
|
4159
|
-
throw new
|
|
4229
|
+
throw new ce(`${t.name}.bulkUpdate(): ${n} of ${u} operations failed`, r);
|
|
4160
4230
|
});
|
|
4161
4231
|
});
|
|
4162
4232
|
});
|
|
@@ -4173,7 +4243,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4173
4243
|
}).then(function(e) {
|
|
4174
4244
|
var r = e.numFailures, i = e.lastResult, e = e.failures;
|
|
4175
4245
|
if (r === 0) return i;
|
|
4176
|
-
throw new
|
|
4246
|
+
throw new ce(`${t.name}.bulkDelete(): ${r} of ${n} operations failed`, e);
|
|
4177
4247
|
});
|
|
4178
4248
|
}, J);
|
|
4179
4249
|
function J() {}
|
|
@@ -4192,10 +4262,10 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4192
4262
|
function s(e, r, o) {
|
|
4193
4263
|
if (typeof e != "object") {
|
|
4194
4264
|
var c;
|
|
4195
|
-
r ||=
|
|
4265
|
+
r ||= ye;
|
|
4196
4266
|
var l = {
|
|
4197
4267
|
subscribers: [],
|
|
4198
|
-
fire: o ||=
|
|
4268
|
+
fire: o ||= I,
|
|
4199
4269
|
subscribe: function(e) {
|
|
4200
4270
|
l.subscribers.indexOf(e) === -1 && (l.subscribers.push(e), l.fire = r(l.fire, e));
|
|
4201
4271
|
},
|
|
@@ -4211,8 +4281,8 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4211
4281
|
var t = c[e];
|
|
4212
4282
|
if (a(t)) s(e, c[e][0], c[e][1]);
|
|
4213
4283
|
else {
|
|
4214
|
-
if (t !== "asap") throw new
|
|
4215
|
-
var n = s(e,
|
|
4284
|
+
if (t !== "asap") throw new F.InvalidArgument("Invalid event config");
|
|
4285
|
+
var n = s(e, pe, function() {
|
|
4216
4286
|
for (var e = arguments.length, t = Array(e); e--;) t[e] = arguments[e];
|
|
4217
4287
|
n.subscribers.forEach(function(e) {
|
|
4218
4288
|
y(function() {
|
|
@@ -4242,7 +4312,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4242
4312
|
function wt(e, t) {
|
|
4243
4313
|
if (e.isPrimKey) return t.primaryKey;
|
|
4244
4314
|
var n = t.getIndexByKeyPath(e.index);
|
|
4245
|
-
if (!n) throw new
|
|
4315
|
+
if (!n) throw new F.Schema("KeyPath " + e.index + " on object store " + t.name + " is not indexed");
|
|
4246
4316
|
return n;
|
|
4247
4317
|
}
|
|
4248
4318
|
function Tt(e, t, n) {
|
|
@@ -4274,7 +4344,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4274
4344
|
return Dt(Tt(e, r, n), dt(e.algorithm, i), t, !e.keysOnly && e.valueMapper);
|
|
4275
4345
|
}
|
|
4276
4346
|
function Dt(e, t, n, r) {
|
|
4277
|
-
var i =
|
|
4347
|
+
var i = B(r ? function(e, t, i) {
|
|
4278
4348
|
return n(r(e), t, i);
|
|
4279
4349
|
} : n);
|
|
4280
4350
|
return e.then(function(e) {
|
|
@@ -4285,9 +4355,9 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4285
4355
|
t && !t(e, function(e) {
|
|
4286
4356
|
return n = e;
|
|
4287
4357
|
}, function(t) {
|
|
4288
|
-
e.stop(t), n =
|
|
4358
|
+
e.stop(t), n = I;
|
|
4289
4359
|
}, function(t) {
|
|
4290
|
-
e.fail(t), n =
|
|
4360
|
+
e.fail(t), n = I;
|
|
4291
4361
|
}) || i(e.value, e, function(e) {
|
|
4292
4362
|
return n = e;
|
|
4293
4363
|
}), n();
|
|
@@ -4585,7 +4655,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4585
4655
|
range: n.range
|
|
4586
4656
|
};
|
|
4587
4657
|
return i(0).then(function() {
|
|
4588
|
-
if (0 < m.length) throw new
|
|
4658
|
+
if (0 < m.length) throw new se("Error modifying one or more objects", m, h, g);
|
|
4589
4659
|
return t.length;
|
|
4590
4660
|
});
|
|
4591
4661
|
});
|
|
@@ -4607,7 +4677,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4607
4677
|
range: i
|
|
4608
4678
|
}).then(function(e) {
|
|
4609
4679
|
var n = e.failures, e = e.numFailures;
|
|
4610
|
-
if (e) throw new
|
|
4680
|
+
if (e) throw new se("Could not delete some values", Object.keys(n).map(function(e) {
|
|
4611
4681
|
return n[e];
|
|
4612
4682
|
}), t - e);
|
|
4613
4683
|
return t - e;
|
|
@@ -4751,19 +4821,19 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4751
4821
|
return e === t[0];
|
|
4752
4822
|
}, [e], "");
|
|
4753
4823
|
}, Z.prototype.anyOfIgnoreCase = function() {
|
|
4754
|
-
var e =
|
|
4824
|
+
var e = A.apply(k, arguments);
|
|
4755
4825
|
return e.length === 0 ? Pt(this) : Ft(this, function(e, t) {
|
|
4756
4826
|
return t.indexOf(e) !== -1;
|
|
4757
4827
|
}, e, "");
|
|
4758
4828
|
}, Z.prototype.startsWithAnyOfIgnoreCase = function() {
|
|
4759
|
-
var e =
|
|
4829
|
+
var e = A.apply(k, arguments);
|
|
4760
4830
|
return e.length === 0 ? Pt(this) : Ft(this, function(e, t) {
|
|
4761
4831
|
return t.some(function(t) {
|
|
4762
4832
|
return e.indexOf(t) === 0;
|
|
4763
4833
|
});
|
|
4764
4834
|
}, e, at);
|
|
4765
4835
|
}, Z.prototype.anyOf = function() {
|
|
4766
|
-
var e = this, t =
|
|
4836
|
+
var e = this, t = A.apply(k, arguments), n = this._cmp;
|
|
4767
4837
|
try {
|
|
4768
4838
|
t.sort(n);
|
|
4769
4839
|
} catch {
|
|
@@ -4789,7 +4859,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4789
4859
|
includeUppers: !1
|
|
4790
4860
|
});
|
|
4791
4861
|
}, Z.prototype.noneOf = function() {
|
|
4792
|
-
var e =
|
|
4862
|
+
var e = A.apply(k, arguments);
|
|
4793
4863
|
if (e.length === 0) return new this.Collection(this);
|
|
4794
4864
|
try {
|
|
4795
4865
|
e.sort(this._ascending);
|
|
@@ -4808,7 +4878,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4808
4878
|
if (e.length === 0) return Pt(this);
|
|
4809
4879
|
if (!e.every(function(e) {
|
|
4810
4880
|
return e[0] !== void 0 && e[1] !== void 0 && i(e[0], e[1]) <= 0;
|
|
4811
|
-
})) return X(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower",
|
|
4881
|
+
})) return X(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", F.InvalidArgument);
|
|
4812
4882
|
var c = !t || !1 !== t.includeLowers, l = t && !0 === t.includeUppers, u, d = i;
|
|
4813
4883
|
function f(e, t) {
|
|
4814
4884
|
return d(e[0], t[0]);
|
|
@@ -4847,7 +4917,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4847
4917
|
}), !1);
|
|
4848
4918
|
}), e;
|
|
4849
4919
|
}, Z.prototype.startsWithAnyOf = function() {
|
|
4850
|
-
var e =
|
|
4920
|
+
var e = A.apply(k, arguments);
|
|
4851
4921
|
return e.every(function(e) {
|
|
4852
4922
|
return typeof e == "string";
|
|
4853
4923
|
}) ? e.length === 0 ? Pt(this) : this.inAnyRange(e.map(function(e) {
|
|
@@ -4856,7 +4926,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4856
4926
|
}, Z);
|
|
4857
4927
|
function Z() {}
|
|
4858
4928
|
function zt(e) {
|
|
4859
|
-
return
|
|
4929
|
+
return B(function(t) {
|
|
4860
4930
|
return Bt(t), e(t.target.error), !1;
|
|
4861
4931
|
});
|
|
4862
4932
|
}
|
|
@@ -4864,45 +4934,45 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4864
4934
|
e.stopPropagation && e.stopPropagation(), e.preventDefault && e.preventDefault();
|
|
4865
4935
|
}
|
|
4866
4936
|
var Vt = "storagemutated", Ht = "x-storagemutated-1", Ut = yt(null, Vt), Wt = (Gt.prototype._lock = function() {
|
|
4867
|
-
return v(!
|
|
4937
|
+
return v(!R.global), ++this._reculock, this._reculock !== 1 || R.global || (R.lockOwnerFor = this), this;
|
|
4868
4938
|
}, Gt.prototype._unlock = function() {
|
|
4869
|
-
if (v(!
|
|
4939
|
+
if (v(!R.global), --this._reculock == 0) for (R.global || (R.lockOwnerFor = null); 0 < this._blockedFuncs.length && !this._locked();) {
|
|
4870
4940
|
var e = this._blockedFuncs.shift();
|
|
4871
4941
|
try {
|
|
4872
|
-
|
|
4942
|
+
W(e[1], e[0]);
|
|
4873
4943
|
} catch {}
|
|
4874
4944
|
}
|
|
4875
4945
|
return this;
|
|
4876
4946
|
}, Gt.prototype._locked = function() {
|
|
4877
|
-
return this._reculock &&
|
|
4947
|
+
return this._reculock && R.lockOwnerFor !== this;
|
|
4878
4948
|
}, Gt.prototype.create = function(e) {
|
|
4879
4949
|
var t = this;
|
|
4880
4950
|
if (!this.mode) return this;
|
|
4881
4951
|
var n = this.db.idbdb, r = this.db._state.dbOpenError;
|
|
4882
4952
|
if (v(!this.idbtrans), !e && !n) switch (r && r.name) {
|
|
4883
|
-
case "DatabaseClosedError": throw new
|
|
4884
|
-
case "MissingAPIError": throw new
|
|
4885
|
-
default: throw new
|
|
4953
|
+
case "DatabaseClosedError": throw new F.DatabaseClosed(r);
|
|
4954
|
+
case "MissingAPIError": throw new F.MissingAPI(r.message, r);
|
|
4955
|
+
default: throw new F.OpenFailed(r);
|
|
4886
4956
|
}
|
|
4887
|
-
if (!this.active) throw new
|
|
4888
|
-
return v(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror =
|
|
4957
|
+
if (!this.active) throw new F.TransactionInactive();
|
|
4958
|
+
return v(this._completion._state === null), (e = this.idbtrans = e || (this.db.core || n).transaction(this.storeNames, this.mode, { durability: this.chromeTransactionDurability })).onerror = B(function(n) {
|
|
4889
4959
|
Bt(n), t._reject(e.error);
|
|
4890
|
-
}), e.onabort =
|
|
4891
|
-
Bt(n), t.active && t._reject(new
|
|
4892
|
-
}), e.oncomplete =
|
|
4960
|
+
}), e.onabort = B(function(n) {
|
|
4961
|
+
Bt(n), t.active && t._reject(new F.Abort(e.error)), t.active = !1, t.on("abort").fire(n);
|
|
4962
|
+
}), e.oncomplete = B(function() {
|
|
4893
4963
|
t.active = !1, t._resolve(), "mutatedParts" in e && Ut.storagemutated.fire(e.mutatedParts);
|
|
4894
4964
|
}), this;
|
|
4895
4965
|
}, Gt.prototype._promise = function(e, t, n) {
|
|
4896
4966
|
var r = this;
|
|
4897
|
-
if (e === "readwrite" && this.mode !== "readwrite") return G(new
|
|
4898
|
-
if (!this.active) return G(new
|
|
4899
|
-
if (this._locked()) return new
|
|
4967
|
+
if (e === "readwrite" && this.mode !== "readwrite") return G(new F.ReadOnly("Transaction is readonly"));
|
|
4968
|
+
if (!this.active) return G(new F.TransactionInactive());
|
|
4969
|
+
if (this._locked()) return new z(function(i, a) {
|
|
4900
4970
|
r._blockedFuncs.push([function() {
|
|
4901
4971
|
r._promise(e, t, n).then(i, a);
|
|
4902
|
-
},
|
|
4972
|
+
}, R]);
|
|
4903
4973
|
});
|
|
4904
|
-
if (n) return
|
|
4905
|
-
var e = new
|
|
4974
|
+
if (n) return Qe(function() {
|
|
4975
|
+
var e = new z(function(e, n) {
|
|
4906
4976
|
r._lock();
|
|
4907
4977
|
var i = t(e, n, r);
|
|
4908
4978
|
i && i.then && i.then(e, n);
|
|
@@ -4911,7 +4981,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4911
4981
|
return r._unlock();
|
|
4912
4982
|
}), e._lib = !0, e;
|
|
4913
4983
|
});
|
|
4914
|
-
var i = new
|
|
4984
|
+
var i = new z(function(e, n) {
|
|
4915
4985
|
var i = t(e, n, r);
|
|
4916
4986
|
i && i.then && i.then(e, n);
|
|
4917
4987
|
});
|
|
@@ -4919,7 +4989,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4919
4989
|
}, Gt.prototype._root = function() {
|
|
4920
4990
|
return this.parent ? this.parent._root() : this;
|
|
4921
4991
|
}, Gt.prototype.waitFor = function(e) {
|
|
4922
|
-
var t, n = this._root(), r =
|
|
4992
|
+
var t, n = this._root(), r = z.resolve(e);
|
|
4923
4993
|
n._waitingFor ? n._waitingFor = n._waitingFor.then(function() {
|
|
4924
4994
|
return r;
|
|
4925
4995
|
}) : (n._waitingFor = r, n._waitingQueue = [], t = n.idbtrans.objectStore(n.storeNames[0]), function e() {
|
|
@@ -4927,22 +4997,22 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
4927
4997
|
n._waitingFor && (t.get(-Infinity).onsuccess = e);
|
|
4928
4998
|
}());
|
|
4929
4999
|
var i = n._waitingFor;
|
|
4930
|
-
return new
|
|
5000
|
+
return new z(function(e, t) {
|
|
4931
5001
|
r.then(function(t) {
|
|
4932
|
-
return n._waitingQueue.push(
|
|
5002
|
+
return n._waitingQueue.push(B(e.bind(null, t)));
|
|
4933
5003
|
}, function(e) {
|
|
4934
|
-
return n._waitingQueue.push(
|
|
5004
|
+
return n._waitingQueue.push(B(t.bind(null, e)));
|
|
4935
5005
|
}).finally(function() {
|
|
4936
5006
|
n._waitingFor === i && (n._waitingFor = null);
|
|
4937
5007
|
});
|
|
4938
5008
|
});
|
|
4939
5009
|
}, Gt.prototype.abort = function() {
|
|
4940
|
-
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new
|
|
5010
|
+
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new F.Abort()));
|
|
4941
5011
|
}, Gt.prototype.table = function(e) {
|
|
4942
5012
|
var t = this._memoizedTables ||= {};
|
|
4943
5013
|
if (l(t, e)) return t[e];
|
|
4944
5014
|
var n = this.schema[e];
|
|
4945
|
-
if (!n) throw new
|
|
5015
|
+
if (!n) throw new F.NotFound("Table " + e + " not part of transaction");
|
|
4946
5016
|
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
4947
5017
|
}, Gt);
|
|
4948
5018
|
function Gt() {}
|
|
@@ -5018,7 +5088,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5018
5088
|
mutate: function(e) {
|
|
5019
5089
|
var t = e.trans, i = e.type, a = e.keys, o = e.values, s = e.range;
|
|
5020
5090
|
return new Promise(function(e, c) {
|
|
5021
|
-
e =
|
|
5091
|
+
e = B(e);
|
|
5022
5092
|
var l = t.objectStore(n), u = l.keyPath == null, d = i === "put" || i === "add";
|
|
5023
5093
|
if (!d && i !== "delete" && i !== "deleteRange") throw Error("Invalid operation type: " + i);
|
|
5024
5094
|
var f, p = (a || o || { length: 1 }).length;
|
|
@@ -5066,7 +5136,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5066
5136
|
getMany: function(e) {
|
|
5067
5137
|
var t = e.trans, r = e.keys;
|
|
5068
5138
|
return new Promise(function(e, i) {
|
|
5069
|
-
e =
|
|
5139
|
+
e = B(e);
|
|
5070
5140
|
for (var a, o = t.objectStore(n), s = r.length, c = Array(s), l = 0, u = 0, d = function(t) {
|
|
5071
5141
|
t = t.target, c[t._pos] = t.result, ++u === l && e(c);
|
|
5072
5142
|
}, f = zt(i), p = 0; p < s; ++p) r[p] != null && ((a = o.get(r[p]))._pos = p, a.onsuccess = d, a.onerror = f, ++l);
|
|
@@ -5076,7 +5146,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5076
5146
|
get: function(e) {
|
|
5077
5147
|
var t = e.trans, r = e.key;
|
|
5078
5148
|
return new Promise(function(e, i) {
|
|
5079
|
-
e =
|
|
5149
|
+
e = B(e);
|
|
5080
5150
|
var a = t.objectStore(n).get(r);
|
|
5081
5151
|
a.onsuccess = function(t) {
|
|
5082
5152
|
return e(t.target.result);
|
|
@@ -5085,7 +5155,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5085
5155
|
},
|
|
5086
5156
|
query: (t = u, function(e) {
|
|
5087
5157
|
return new Promise(function(i, a) {
|
|
5088
|
-
i =
|
|
5158
|
+
i = B(i);
|
|
5089
5159
|
var o, s, c, l = e.trans, u = e.values, d = e.limit, f = e.query, p = d === Infinity ? void 0 : d, m = f.index, f = f.range, l = l.objectStore(n), m = m.isPrimaryKey ? l : l.index(m.name), f = r(f);
|
|
5090
5160
|
if (d === 0) return i({ result: [] });
|
|
5091
5161
|
t ? ((p = u ? m.getAll(f, p) : m.getAllKeys(f, p)).onsuccess = function(e) {
|
|
@@ -5099,15 +5169,15 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5099
5169
|
openCursor: function(e) {
|
|
5100
5170
|
var t = e.trans, i = e.values, a = e.query, o = e.reverse, s = e.unique;
|
|
5101
5171
|
return new Promise(function(e, c) {
|
|
5102
|
-
e =
|
|
5172
|
+
e = B(e);
|
|
5103
5173
|
var l = a.index, u = a.range, d = t.objectStore(n), d = l.isPrimaryKey ? d : d.index(l.name), l = o ? s ? "prevunique" : "prev" : s ? "nextunique" : "next", f = !i && "openKeyCursor" in d ? d.openKeyCursor(r(u), l) : d.openCursor(r(u), l);
|
|
5104
|
-
f.onerror = zt(c), f.onsuccess =
|
|
5174
|
+
f.onerror = zt(c), f.onsuccess = B(function(n) {
|
|
5105
5175
|
var r, i, a, o, s = f.result;
|
|
5106
5176
|
s ? (s.___id = ++Qt, s.done = !1, r = s.continue.bind(s), i = (i = s.continuePrimaryKey) && i.bind(s), a = s.advance.bind(s), o = function() {
|
|
5107
5177
|
throw Error("Cursor not stopped");
|
|
5108
5178
|
}, s.trans = t, s.stop = s.continue = s.continuePrimaryKey = s.advance = function() {
|
|
5109
5179
|
throw Error("Cursor not started");
|
|
5110
|
-
}, s.fail =
|
|
5180
|
+
}, s.fail = B(c), s.next = function() {
|
|
5111
5181
|
var e = this, t = 1;
|
|
5112
5182
|
return this.start(function() {
|
|
5113
5183
|
return t-- ? e.continue() : e.stop();
|
|
@@ -5126,11 +5196,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5126
5196
|
}, s.stop();
|
|
5127
5197
|
}
|
|
5128
5198
|
var n = new Promise(function(e, t) {
|
|
5129
|
-
e =
|
|
5199
|
+
e = B(e), f.onerror = zt(t), s.fail = t, s.stop = function(t) {
|
|
5130
5200
|
s.stop = s.continue = s.continuePrimaryKey = s.advance = o, e(t);
|
|
5131
5201
|
};
|
|
5132
5202
|
});
|
|
5133
|
-
return f.onsuccess =
|
|
5203
|
+
return f.onsuccess = B(function(e) {
|
|
5134
5204
|
f.onsuccess = t, t();
|
|
5135
5205
|
}), s.continue = r, s.continuePrimaryKey = i, s.advance = a, t(), n;
|
|
5136
5206
|
}, e(s)) : e(null);
|
|
@@ -5141,7 +5211,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5141
5211
|
var t = e.query, i = e.trans, a = t.index, o = t.range;
|
|
5142
5212
|
return new Promise(function(e, t) {
|
|
5143
5213
|
var s = i.objectStore(n), c = a.isPrimaryKey ? s : s.index(a.name), s = r(o), c = s ? c.count(s) : c.count();
|
|
5144
|
-
c.onsuccess =
|
|
5214
|
+
c.onsuccess = B(function(t) {
|
|
5145
5215
|
return e(t.target.result);
|
|
5146
5216
|
}), c.onerror = zt(t);
|
|
5147
5217
|
});
|
|
@@ -5253,18 +5323,18 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5253
5323
|
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Jt("$meta", hn("")[0], []), e._storeNames.push("$meta"));
|
|
5254
5324
|
var o = e._createTransaction("readwrite", e._storeNames, a);
|
|
5255
5325
|
o.create(n), o._completion.catch(r);
|
|
5256
|
-
var s = o._reject.bind(o), c =
|
|
5257
|
-
|
|
5258
|
-
return
|
|
5326
|
+
var s = o._reject.bind(o), c = R.transless || R;
|
|
5327
|
+
Qe(function() {
|
|
5328
|
+
return R.trans = o, R.transless = c, t === 0 ? (i(a).forEach(function(e) {
|
|
5259
5329
|
un(n, e, a[e].primKey, a[e].indexes);
|
|
5260
|
-
}), nn(e, n), void
|
|
5330
|
+
}), nn(e, n), void z.follow(function() {
|
|
5261
5331
|
return e.on.populate.fire(o);
|
|
5262
5332
|
}).catch(s)) : (nn(e, n), l = t, ((r = o).storeNames.includes("$meta") ? r.table("$meta").get("version").then(function(e) {
|
|
5263
5333
|
return e ?? l;
|
|
5264
|
-
}) :
|
|
5334
|
+
}) : z.resolve(l)).then(function(t) {
|
|
5265
5335
|
return a = t, s = o, c = n, l = [], t = (r = e)._versions, u = r._dbSchema = pn(0, r.idbdb, c), (t = t.filter(function(e) {
|
|
5266
5336
|
return e._cfg.version >= a;
|
|
5267
|
-
})).length === 0 ?
|
|
5337
|
+
})).length === 0 ? z.resolve() : (t.forEach(function(e) {
|
|
5268
5338
|
l.push(function() {
|
|
5269
5339
|
var t = u, n = e._cfg.dbschema;
|
|
5270
5340
|
mn(r, t, c), mn(r, n, c), u = r._dbSchema = n;
|
|
@@ -5272,7 +5342,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5272
5342
|
o.add.forEach(function(e) {
|
|
5273
5343
|
un(c, e[0], e[1].primKey, e[1].indexes);
|
|
5274
5344
|
}), o.change.forEach(function(e) {
|
|
5275
|
-
if (e.recreate) throw new
|
|
5345
|
+
if (e.recreate) throw new F.Upgrade("Not yet support for changing primary key");
|
|
5276
5346
|
var t = c.objectStore(e.name);
|
|
5277
5347
|
e.add.forEach(function(e) {
|
|
5278
5348
|
return fn(t, e);
|
|
@@ -5289,11 +5359,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5289
5359
|
o.del.forEach(function(e) {
|
|
5290
5360
|
d[e] = t[e];
|
|
5291
5361
|
}), an(r, [r.Transaction.prototype]), rn(r, [r.Transaction.prototype], i(d), d), s.schema = d;
|
|
5292
|
-
var f, p =
|
|
5293
|
-
return p &&
|
|
5362
|
+
var f, p = ae(l);
|
|
5363
|
+
return p && $e(), o = z.follow(function() {
|
|
5294
5364
|
var e;
|
|
5295
|
-
(f = l(s)) && p && (e =
|
|
5296
|
-
}), f && typeof f.then == "function" ?
|
|
5365
|
+
(f = l(s)) && p && (e = H.bind(null, null), f.then(e, e));
|
|
5366
|
+
}), f && typeof f.then == "function" ? z.resolve(f) : o.then(function() {
|
|
5297
5367
|
return f;
|
|
5298
5368
|
});
|
|
5299
5369
|
}
|
|
@@ -5308,7 +5378,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5308
5378
|
})) : t.objectStore("$meta").put(e._cfg.version, "version"));
|
|
5309
5379
|
});
|
|
5310
5380
|
}), function e() {
|
|
5311
|
-
return l.length ?
|
|
5381
|
+
return l.length ? z.resolve(l.shift()(s.idbtrans)).then(e) : z.resolve();
|
|
5312
5382
|
}().then(function() {
|
|
5313
5383
|
dn(u, c);
|
|
5314
5384
|
}));
|
|
@@ -5326,7 +5396,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5326
5396
|
if (e.change.length || e.recreate) return console.warn(`Unable to patch indexes of table ${e.name} because it has changes on the type of index or primary key.`), { value: void 0 };
|
|
5327
5397
|
var n = t.objectStore(e.name);
|
|
5328
5398
|
e.add.forEach(function(t) {
|
|
5329
|
-
|
|
5399
|
+
L && console.debug(`Dexie upgrade patch: Creating missing index ${e.name}.${t.src}`), fn(n, t);
|
|
5330
5400
|
});
|
|
5331
5401
|
}(i[r]);
|
|
5332
5402
|
if (typeof a == "object") return a.value;
|
|
@@ -5375,7 +5445,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5375
5445
|
}
|
|
5376
5446
|
function dn(e, t) {
|
|
5377
5447
|
i(e).forEach(function(n) {
|
|
5378
|
-
t.db.objectStoreNames.contains(n) || (
|
|
5448
|
+
t.db.objectStoreNames.contains(n) || (L && console.debug("Dexie: Creating missing table", n), un(t, n, e[n].primKey, e[n].indexes));
|
|
5379
5449
|
});
|
|
5380
5450
|
}
|
|
5381
5451
|
function fn(e, t) {
|
|
@@ -5416,11 +5486,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5416
5486
|
i(e).forEach(function(r) {
|
|
5417
5487
|
if (e[r] !== null) {
|
|
5418
5488
|
var i = n._parseIndexSyntax(e[r]), a = i.shift();
|
|
5419
|
-
if (!a) throw new
|
|
5420
|
-
if (a.unique = !0, a.multi) throw new
|
|
5489
|
+
if (!a) throw new F.Schema("Invalid schema for table " + r + ": " + e[r]);
|
|
5490
|
+
if (a.unique = !0, a.multi) throw new F.Schema("Primary key cannot be multiEntry*");
|
|
5421
5491
|
i.forEach(function(e) {
|
|
5422
|
-
if (e.auto) throw new
|
|
5423
|
-
if (!e.keyPath) throw new
|
|
5492
|
+
if (e.auto) throw new F.Schema("Only primary key can be marked as autoIncrement (++)");
|
|
5493
|
+
if (!e.keyPath) throw new F.Schema("Index must have a name and cannot be an empty string");
|
|
5424
5494
|
}), i = n._createTableSchema(r, a, i), t[r] = i;
|
|
5425
5495
|
}
|
|
5426
5496
|
});
|
|
@@ -5441,7 +5511,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5441
5511
|
this._cfg.tables
|
|
5442
5512
|
], i(r), r), t._storeNames = i(r), this;
|
|
5443
5513
|
}, _n.prototype.upgrade = function(e) {
|
|
5444
|
-
return this._cfg.contentUpgrade =
|
|
5514
|
+
return this._cfg.contentUpgrade = be(this._cfg.contentUpgrade || I, e), this;
|
|
5445
5515
|
}, _n);
|
|
5446
5516
|
function _n() {}
|
|
5447
5517
|
function vn(e, t) {
|
|
@@ -5456,8 +5526,8 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5456
5526
|
return e && typeof e.databases == "function";
|
|
5457
5527
|
}
|
|
5458
5528
|
function bn(e) {
|
|
5459
|
-
return
|
|
5460
|
-
return
|
|
5529
|
+
return Qe(function() {
|
|
5530
|
+
return R.letThrough = !0, e();
|
|
5461
5531
|
});
|
|
5462
5532
|
}
|
|
5463
5533
|
function xn(e) {
|
|
@@ -5572,7 +5642,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5572
5642
|
return t[n] && wn(t[n], e[n]);
|
|
5573
5643
|
});
|
|
5574
5644
|
}
|
|
5575
|
-
u(Q.prototype, ((
|
|
5645
|
+
u(Q.prototype, ((M = {
|
|
5576
5646
|
add: function(e) {
|
|
5577
5647
|
return Cn(this, e), this;
|
|
5578
5648
|
},
|
|
@@ -5589,9 +5659,9 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5589
5659
|
var t = Tn(this).next(e).value;
|
|
5590
5660
|
return t && q(t.from, e) <= 0 && 0 <= q(t.to, e);
|
|
5591
5661
|
}
|
|
5592
|
-
})[
|
|
5662
|
+
})[E] = function() {
|
|
5593
5663
|
return Tn(this);
|
|
5594
|
-
},
|
|
5664
|
+
}, M));
|
|
5595
5665
|
var An = {}, jn = {}, Mn = !1;
|
|
5596
5666
|
function Nn(e) {
|
|
5597
5667
|
On(jn, e), Mn || (Mn = !0, setTimeout(function() {
|
|
@@ -5633,19 +5703,19 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5633
5703
|
t.isBeingOpened = !0, t.dbOpenError = null, t.openComplete = !1;
|
|
5634
5704
|
var r = t.openCanceller, a = Math.round(10 * e.verno), o = !1;
|
|
5635
5705
|
function s() {
|
|
5636
|
-
if (t.openCanceller !== r) throw new
|
|
5706
|
+
if (t.openCanceller !== r) throw new F.DatabaseClosed("db.open() was cancelled");
|
|
5637
5707
|
}
|
|
5638
5708
|
function c() {
|
|
5639
|
-
return new
|
|
5640
|
-
if (s(), !n) throw new
|
|
5709
|
+
return new z(function(r, l) {
|
|
5710
|
+
if (s(), !n) throw new F.MissingAPI();
|
|
5641
5711
|
var u = e.name, p = t.autoSchema || !a ? n.open(u) : n.open(u, a);
|
|
5642
|
-
if (!p) throw new
|
|
5643
|
-
p.onerror = zt(l), p.onblocked =
|
|
5712
|
+
if (!p) throw new F.MissingAPI();
|
|
5713
|
+
p.onerror = zt(l), p.onblocked = B(e._fireOnBlocked), p.onupgradeneeded = B(function(r) {
|
|
5644
5714
|
var i;
|
|
5645
|
-
d = p.transaction, t.autoSchema && !e._options.allowEmptyDB ? (p.onerror = Bt, d.abort(), p.result.close(), (i = n.deleteDatabase(u)).onsuccess = i.onerror =
|
|
5646
|
-
l(new
|
|
5715
|
+
d = p.transaction, t.autoSchema && !e._options.allowEmptyDB ? (p.onerror = Bt, d.abort(), p.result.close(), (i = n.deleteDatabase(u)).onsuccess = i.onerror = B(function() {
|
|
5716
|
+
l(new F.NoSuchDatabase(`Database ${u} doesnt exist`));
|
|
5647
5717
|
})) : (d.onerror = zt(l), r = r.oldVersion > 2 ** 62 ? 0 : r.oldVersion, f = r < 1, e.idbdb = p.result, o && cn(e, d), sn(e, r / 10, d, l));
|
|
5648
|
-
}, l), p.onsuccess =
|
|
5718
|
+
}, l), p.onsuccess = B(function() {
|
|
5649
5719
|
d = null;
|
|
5650
5720
|
var n, s, l, m, h, _ = e.idbdb = p.result, v = g(_.objectStoreNames);
|
|
5651
5721
|
if (0 < v.length) try {
|
|
@@ -5656,11 +5726,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5656
5726
|
})) && !o) 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."), _.close(), a = _.version + 1, o = !0, r(c());
|
|
5657
5727
|
nn(e, y);
|
|
5658
5728
|
} catch {}
|
|
5659
|
-
st.push(e), _.onversionchange =
|
|
5729
|
+
st.push(e), _.onversionchange = B(function(n) {
|
|
5660
5730
|
t.vcFired = !0, e.on("versionchange").fire(n);
|
|
5661
|
-
}), _.onclose =
|
|
5731
|
+
}), _.onclose = B(function(t) {
|
|
5662
5732
|
e.on("close").fire(t);
|
|
5663
|
-
}), f && (h = e._deps, y = u, _ = h.indexedDB, h = h.IDBKeyRange, yn(_) || y === ct || vn(_, h).put({ name: y }).catch(
|
|
5733
|
+
}), f && (h = e._deps, y = u, _ = h.indexedDB, h = h.IDBKeyRange, yn(_) || y === ct || vn(_, h).put({ name: y }).catch(I)), r();
|
|
5664
5734
|
}, l);
|
|
5665
5735
|
}).catch(function(e) {
|
|
5666
5736
|
switch (e?.name) {
|
|
@@ -5669,11 +5739,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5669
5739
|
break;
|
|
5670
5740
|
case "VersionError": if (0 < a) return a = 0, c();
|
|
5671
5741
|
}
|
|
5672
|
-
return
|
|
5742
|
+
return z.reject(e);
|
|
5673
5743
|
});
|
|
5674
5744
|
}
|
|
5675
5745
|
var l, u = t.dbReadyResolve, d = null, f = !1;
|
|
5676
|
-
return
|
|
5746
|
+
return z.race([r, (typeof navigator > "u" ? z.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(e) {
|
|
5677
5747
|
function t() {
|
|
5678
5748
|
return indexedDB.databases().finally(e);
|
|
5679
5749
|
}
|
|
@@ -5681,12 +5751,12 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5681
5751
|
}).finally(function() {
|
|
5682
5752
|
return clearInterval(l);
|
|
5683
5753
|
}) : Promise.resolve()).then(c)]).then(function() {
|
|
5684
|
-
return s(), t.onReadyBeingFired = [],
|
|
5754
|
+
return s(), t.onReadyBeingFired = [], z.resolve(bn(function() {
|
|
5685
5755
|
return e.on.ready.fire(e.vip);
|
|
5686
5756
|
})).then(function n() {
|
|
5687
5757
|
if (0 < t.onReadyBeingFired.length) {
|
|
5688
|
-
var r = t.onReadyBeingFired.reduce(
|
|
5689
|
-
return t.onReadyBeingFired = [],
|
|
5758
|
+
var r = t.onReadyBeingFired.reduce(be, I);
|
|
5759
|
+
return t.onReadyBeingFired = [], z.resolve(bn(function() {
|
|
5690
5760
|
return r(e.vip);
|
|
5691
5761
|
})).then(n);
|
|
5692
5762
|
}
|
|
@@ -5815,7 +5885,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5815
5885
|
function Bn(e, t, n, r) {
|
|
5816
5886
|
return n ||= {}, r ||= "", i(e).forEach(function(i) {
|
|
5817
5887
|
var a, o, s;
|
|
5818
|
-
l(t, i) ? (a = e[i], o = t[i], typeof a == "object" && typeof o == "object" && a && o ? (s =
|
|
5888
|
+
l(t, i) ? (a = e[i], o = t[i], typeof a == "object" && typeof o == "object" && a && o ? (s = ie(a)) === ie(o) ? s === "Object" ? Bn(a, o, n, r + i + ".") : a !== o && (n[r + i] = t[i]) : n[r + i] = t[i] : a !== o && (n[r + i] = t[i])) : n[r + i] = void 0;
|
|
5819
5889
|
}), i(t).forEach(function(i) {
|
|
5820
5890
|
l(e, i) || (n[r + i] = t[i]);
|
|
5821
5891
|
}), n;
|
|
@@ -5831,25 +5901,25 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5831
5901
|
return t(t({}, e), { table: function(r) {
|
|
5832
5902
|
var i = e.table(r), a = i.schema.primaryKey;
|
|
5833
5903
|
return t(t({}, i), { mutate: function(e) {
|
|
5834
|
-
var o =
|
|
5904
|
+
var o = R.trans, s = o.table(r).hook, c = s.deleting, u = s.creating, d = s.updating;
|
|
5835
5905
|
switch (e.type) {
|
|
5836
5906
|
case "add":
|
|
5837
|
-
if (u.fire ===
|
|
5907
|
+
if (u.fire === I) break;
|
|
5838
5908
|
return o._promise("readwrite", function() {
|
|
5839
5909
|
return f(e);
|
|
5840
5910
|
}, !0);
|
|
5841
5911
|
case "put":
|
|
5842
|
-
if (u.fire ===
|
|
5912
|
+
if (u.fire === I && d.fire === I) break;
|
|
5843
5913
|
return o._promise("readwrite", function() {
|
|
5844
5914
|
return f(e);
|
|
5845
5915
|
}, !0);
|
|
5846
5916
|
case "delete":
|
|
5847
|
-
if (c.fire ===
|
|
5917
|
+
if (c.fire === I) break;
|
|
5848
5918
|
return o._promise("readwrite", function() {
|
|
5849
5919
|
return f(e);
|
|
5850
5920
|
}, !0);
|
|
5851
5921
|
case "deleteRange":
|
|
5852
|
-
if (c.fire ===
|
|
5922
|
+
if (c.fire === I) break;
|
|
5853
5923
|
return o._promise("readwrite", function() {
|
|
5854
5924
|
return function e(n, r, o) {
|
|
5855
5925
|
return i.query({
|
|
@@ -5882,7 +5952,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5882
5952
|
}
|
|
5883
5953
|
return i.mutate(e);
|
|
5884
5954
|
function f(e) {
|
|
5885
|
-
var r, o, s, f =
|
|
5955
|
+
var r, o, s, f = R.trans, p = e.keys || Vn(a, e);
|
|
5886
5956
|
if (!p) throw Error("Keys missing");
|
|
5887
5957
|
return (e = e.type === "add" || e.type === "put" ? t(t({}, e), { keys: p }) : t({}, e)).type !== "delete" && (e.values = n([], e.values, !0)), e.keys &&= n([], e.keys, !0), r = i, s = p, ((o = e).type === "add" ? Promise.resolve([]) : r.getMany({
|
|
5888
5958
|
trans: o.trans,
|
|
@@ -5939,7 +6009,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5939
6009
|
getMany: function(e) {
|
|
5940
6010
|
if (!e.cache) return r.getMany(e);
|
|
5941
6011
|
var t = Un(e.keys, e.trans._cache, e.cache === "clone");
|
|
5942
|
-
return t ?
|
|
6012
|
+
return t ? z.resolve(t) : r.getMany(e).then(function(t) {
|
|
5943
6013
|
return e.trans._cache = {
|
|
5944
6014
|
keys: e.keys,
|
|
5945
6015
|
values: e.cache === "clone" ? ne(t) : t
|
|
@@ -5973,7 +6043,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
5973
6043
|
var n = e.schema.name, r = new Q(e.MIN_KEY, e.MAX_KEY);
|
|
5974
6044
|
return t(t({}, e), {
|
|
5975
6045
|
transaction: function(t, n, r) {
|
|
5976
|
-
if (
|
|
6046
|
+
if (R.subscr && n !== "readonly") throw new F.ReadOnly(`Readwrite transaction in liveQuery context. Querier source: ${R.querier}`);
|
|
5977
6047
|
return e.transaction(t, n, r);
|
|
5978
6048
|
},
|
|
5979
6049
|
table: function(o) {
|
|
@@ -6031,7 +6101,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6031
6101
|
};
|
|
6032
6102
|
return i(h).forEach(function(e) {
|
|
6033
6103
|
m[e] = function(i) {
|
|
6034
|
-
var a =
|
|
6104
|
+
var a = R.subscr, c = !!a, l = Gn(R, s) && Kn(e, i) ? i.obsSet = {} : a;
|
|
6035
6105
|
if (c) {
|
|
6036
6106
|
var u = function(e) {
|
|
6037
6107
|
return e = `idb://${n}/${o}/${e}`, l[e] || (l[e] = new Q());
|
|
@@ -6166,7 +6236,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6166
6236
|
e.subscribers.add(n), r.addEventListener("abort", function() {
|
|
6167
6237
|
var r, i;
|
|
6168
6238
|
e.subscribers.delete(n), e.subscribers.size === 0 && (r = e, i = t, setTimeout(function() {
|
|
6169
|
-
r.subscribers.size === 0 &&
|
|
6239
|
+
r.subscribers.size === 0 && O(i, r);
|
|
6170
6240
|
}, 3e3));
|
|
6171
6241
|
});
|
|
6172
6242
|
}
|
|
@@ -6188,16 +6258,16 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6188
6258
|
var f = e.table(u), p = d.optimisticOps.filter(function(e) {
|
|
6189
6259
|
return e.trans === s;
|
|
6190
6260
|
});
|
|
6191
|
-
if (s._explicit && i && s.mutatedParts) for (var m = 0, h = Object.values(d.queries.query); m < h.length; m++) for (var g = 0, _ = (b = h[m]).slice(); g < _.length; g++) kn((x = _[g]).obsSet, s.mutatedParts) && (
|
|
6261
|
+
if (s._explicit && i && s.mutatedParts) for (var m = 0, h = Object.values(d.queries.query); m < h.length; m++) for (var g = 0, _ = (b = h[m]).slice(); g < _.length; g++) kn((x = _[g]).obsSet, s.mutatedParts) && (O(b, x), x.subscribers.forEach(function(e) {
|
|
6192
6262
|
return o.add(e);
|
|
6193
6263
|
}));
|
|
6194
6264
|
else if (0 < p.length) {
|
|
6195
6265
|
d.optimisticOps = d.optimisticOps.filter(function(e) {
|
|
6196
6266
|
return e.trans !== s;
|
|
6197
6267
|
});
|
|
6198
|
-
for (var v = 0, y = Object.values(d.queries.query); v < y.length; v++) for (var b, x, S, C = 0, ee = (b = y[v]).slice(); C < ee.length; C++) (x = ee[C]).res != null && s.mutatedParts && (i && !x.dirty ? (S = Object.isFrozen(x.res), S = Xn(x.res, x.req, p, f, x, S), x.dirty ? (
|
|
6268
|
+
for (var v = 0, y = Object.values(d.queries.query); v < y.length; v++) for (var b, x, S, C = 0, ee = (b = y[v]).slice(); C < ee.length; C++) (x = ee[C]).res != null && s.mutatedParts && (i && !x.dirty ? (S = Object.isFrozen(x.res), S = Xn(x.res, x.req, p, f, x, S), x.dirty ? (O(b, x), x.subscribers.forEach(function(e) {
|
|
6199
6269
|
return o.add(e);
|
|
6200
|
-
})) : S !== x.res && (x.res = S, x.promise =
|
|
6270
|
+
})) : S !== x.res && (x.res = S, x.promise = z.resolve({ result: S }))) : (x.dirty && O(b, x), x.subscribers.forEach(function(e) {
|
|
6201
6271
|
return o.add(e);
|
|
6202
6272
|
})));
|
|
6203
6273
|
}
|
|
@@ -6214,15 +6284,15 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6214
6284
|
var i = e.table(r), a = i.schema.primaryKey;
|
|
6215
6285
|
return t(t({}, i), {
|
|
6216
6286
|
mutate: function(e) {
|
|
6217
|
-
var o =
|
|
6287
|
+
var o = R.trans;
|
|
6218
6288
|
if (a.outbound || o.db._options.cache === "disabled" || o.explicit || o.idbtrans.mode !== "readwrite") return i.mutate(e);
|
|
6219
6289
|
var s = An[`idb://${n}/${r}`];
|
|
6220
6290
|
return s ? (o = i.mutate(e), e.type !== "add" && e.type !== "put" || !(50 <= e.values.length || Vn(a, e).some(function(e) {
|
|
6221
6291
|
return e == null;
|
|
6222
6292
|
})) ? (s.optimisticOps.push(e), e.mutatedParts && Nn(e.mutatedParts), o.then(function(t) {
|
|
6223
|
-
0 < t.numFailures && (
|
|
6293
|
+
0 < t.numFailures && (O(s.optimisticOps, e), (t = Jn(0, e, t)) && s.optimisticOps.push(t), e.mutatedParts && Nn(e.mutatedParts));
|
|
6224
6294
|
}), o.catch(function() {
|
|
6225
|
-
|
|
6295
|
+
O(s.optimisticOps, e), e.mutatedParts && Nn(e.mutatedParts);
|
|
6226
6296
|
})) : o.then(function(n) {
|
|
6227
6297
|
var r = Jn(0, t(t({}, e), { values: e.values.map(function(e, r) {
|
|
6228
6298
|
var i;
|
|
@@ -6234,8 +6304,8 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6234
6304
|
}), o) : i.mutate(e);
|
|
6235
6305
|
},
|
|
6236
6306
|
query: function(e) {
|
|
6237
|
-
if (!Gn(
|
|
6238
|
-
var t = (c =
|
|
6307
|
+
if (!Gn(R, i) || !Kn("query", e)) return i.query(e);
|
|
6308
|
+
var t = (c = R.trans)?.db._options.cache === "immutable", a = R, o = a.requery, s = a.signal, c = function(e, t, n, r) {
|
|
6239
6309
|
var i = An[`idb://${e}/${t}`];
|
|
6240
6310
|
if (!i) return [];
|
|
6241
6311
|
if (!(t = i.queries[n])) return [
|
|
@@ -6287,7 +6357,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6287
6357
|
} else e.result = ne(n);
|
|
6288
6358
|
return e;
|
|
6289
6359
|
}).catch(function(e) {
|
|
6290
|
-
return d && l &&
|
|
6360
|
+
return d && l && O(d, l), Promise.reject(e);
|
|
6291
6361
|
}), l = {
|
|
6292
6362
|
obsSet: e.obsSet,
|
|
6293
6363
|
promise: a,
|
|
@@ -6318,8 +6388,8 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6318
6388
|
} });
|
|
6319
6389
|
}
|
|
6320
6390
|
var nr = ($.prototype.version = function(e) {
|
|
6321
|
-
if (isNaN(e) || e < .1) throw new
|
|
6322
|
-
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new
|
|
6391
|
+
if (isNaN(e) || e < .1) throw new F.Type("Given version is not a positive number");
|
|
6392
|
+
if (e = Math.round(10 * e) / 10, this.idbdb || this._state.isBeingOpened) throw new F.Schema("Cannot add version when database is open");
|
|
6323
6393
|
this.verno = Math.max(this.verno, e);
|
|
6324
6394
|
var t = this._versions, n = t.filter(function(t) {
|
|
6325
6395
|
return t._cfg.version === e;
|
|
@@ -6327,11 +6397,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6327
6397
|
return n || (n = new this.Version(e), t.push(n), t.sort(on), n.stores({}), this._state.autoSchema = !1, n);
|
|
6328
6398
|
}, $.prototype._whenReady = function(e) {
|
|
6329
6399
|
var t = this;
|
|
6330
|
-
return this.idbdb && (this._state.openComplete ||
|
|
6331
|
-
if (t._state.openComplete) return n(new
|
|
6400
|
+
return this.idbdb && (this._state.openComplete || R.letThrough || this._vip) ? e() : new z(function(e, n) {
|
|
6401
|
+
if (t._state.openComplete) return n(new F.DatabaseClosed(t._state.dbOpenError));
|
|
6332
6402
|
if (!t._state.isBeingOpened) {
|
|
6333
|
-
if (!t._state.autoOpen) return void n(new
|
|
6334
|
-
t.open().catch(
|
|
6403
|
+
if (!t._state.autoOpen) return void n(new F.DatabaseClosed());
|
|
6404
|
+
t.open().catch(I);
|
|
6335
6405
|
}
|
|
6336
6406
|
t._state.dbReadyPromise.then(e, n);
|
|
6337
6407
|
}).then(e);
|
|
@@ -6355,7 +6425,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6355
6425
|
})), this;
|
|
6356
6426
|
}, $.prototype.open = function() {
|
|
6357
6427
|
var e = this;
|
|
6358
|
-
return
|
|
6428
|
+
return W(Me, function() {
|
|
6359
6429
|
return In(e);
|
|
6360
6430
|
});
|
|
6361
6431
|
}, $.prototype._close = function() {
|
|
@@ -6367,28 +6437,28 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6367
6437
|
} catch {}
|
|
6368
6438
|
this.idbdb = null;
|
|
6369
6439
|
}
|
|
6370
|
-
e.isBeingOpened || (e.dbReadyPromise = new
|
|
6440
|
+
e.isBeingOpened || (e.dbReadyPromise = new z(function(t) {
|
|
6371
6441
|
e.dbReadyResolve = t;
|
|
6372
|
-
}), e.openCanceller = new
|
|
6442
|
+
}), e.openCanceller = new z(function(t, n) {
|
|
6373
6443
|
e.cancelOpen = n;
|
|
6374
6444
|
}));
|
|
6375
6445
|
}, $.prototype.close = function(e) {
|
|
6376
6446
|
var t = (e === void 0 ? { disableAutoOpen: !0 } : e).disableAutoOpen, e = this._state;
|
|
6377
|
-
t ? (e.isBeingOpened && e.cancelOpen(new
|
|
6447
|
+
t ? (e.isBeingOpened && e.cancelOpen(new F.DatabaseClosed()), this._close(), e.autoOpen = !1, e.dbOpenError = new F.DatabaseClosed()) : (this._close(), e.autoOpen = this._options.autoOpen || e.isBeingOpened, e.openComplete = !1, e.dbOpenError = null);
|
|
6378
6448
|
}, $.prototype.delete = function(e) {
|
|
6379
6449
|
var t = this;
|
|
6380
6450
|
e === void 0 && (e = { disableAutoOpen: !0 });
|
|
6381
6451
|
var n = 0 < arguments.length && typeof arguments[0] != "object", r = this._state;
|
|
6382
|
-
return new
|
|
6452
|
+
return new z(function(i, a) {
|
|
6383
6453
|
function o() {
|
|
6384
6454
|
t.close(e);
|
|
6385
6455
|
var n = t._deps.indexedDB.deleteDatabase(t.name);
|
|
6386
|
-
n.onsuccess =
|
|
6456
|
+
n.onsuccess = B(function() {
|
|
6387
6457
|
var e = t._deps, n = t.name, r = e.indexedDB;
|
|
6388
|
-
e = e.IDBKeyRange, yn(r) || n === ct || vn(r, e).delete(n).catch(
|
|
6458
|
+
e = e.IDBKeyRange, yn(r) || n === ct || vn(r, e).delete(n).catch(I), i();
|
|
6389
6459
|
}), n.onerror = zt(a), n.onblocked = t._fireOnBlocked;
|
|
6390
6460
|
}
|
|
6391
|
-
if (n) throw new
|
|
6461
|
+
if (n) throw new F.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
6392
6462
|
r.isBeingOpened ? r.dbReadyPromise.then(o) : o();
|
|
6393
6463
|
});
|
|
6394
6464
|
}, $.prototype.backendDB = function() {
|
|
@@ -6414,7 +6484,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6414
6484
|
}), $.prototype.transaction = function() {
|
|
6415
6485
|
var e = function(e, t, n) {
|
|
6416
6486
|
var r = arguments.length;
|
|
6417
|
-
if (r < 2) throw new
|
|
6487
|
+
if (r < 2) throw new F.InvalidArgument("Too few arguments");
|
|
6418
6488
|
for (var i = Array(r - 1); --r;) i[r - 1] = arguments[r];
|
|
6419
6489
|
return n = i.pop(), [
|
|
6420
6490
|
e,
|
|
@@ -6424,7 +6494,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6424
6494
|
}.apply(this, arguments);
|
|
6425
6495
|
return this._transaction.apply(this, e);
|
|
6426
6496
|
}, $.prototype._transaction = function(e, t, n) {
|
|
6427
|
-
var r = this, i =
|
|
6497
|
+
var r = this, i = R.trans;
|
|
6428
6498
|
i && i.db === this && e.indexOf("!") === -1 || (i = null);
|
|
6429
6499
|
var a, o, s = e.indexOf("?") !== -1;
|
|
6430
6500
|
e = e.replace("!", "").replace("?", "");
|
|
@@ -6434,17 +6504,17 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6434
6504
|
return e;
|
|
6435
6505
|
}), e == "r" || e === lt) a = lt;
|
|
6436
6506
|
else {
|
|
6437
|
-
if (e != "rw" && e != ut) throw new
|
|
6507
|
+
if (e != "rw" && e != ut) throw new F.InvalidArgument("Invalid transaction mode: " + e);
|
|
6438
6508
|
a = ut;
|
|
6439
6509
|
}
|
|
6440
6510
|
if (i) {
|
|
6441
6511
|
if (i.mode === lt && a === ut) {
|
|
6442
|
-
if (!s) throw new
|
|
6512
|
+
if (!s) throw new F.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
6443
6513
|
i = null;
|
|
6444
6514
|
}
|
|
6445
6515
|
i && o.forEach(function(e) {
|
|
6446
6516
|
if (i && i.storeNames.indexOf(e) === -1) {
|
|
6447
|
-
if (!s) throw new
|
|
6517
|
+
if (!s) throw new F.SubTransaction("Table " + e + " not included in parent transaction.");
|
|
6448
6518
|
i = null;
|
|
6449
6519
|
}
|
|
6450
6520
|
}), s && i && !i.active && (i = null);
|
|
@@ -6455,8 +6525,8 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6455
6525
|
}) : G(e);
|
|
6456
6526
|
}
|
|
6457
6527
|
var c = function e(t, n, r, i, a) {
|
|
6458
|
-
return
|
|
6459
|
-
var o =
|
|
6528
|
+
return z.resolve().then(function() {
|
|
6529
|
+
var o = R.transless || R, s = t._createTransaction(n, r, t._dbSchema, i);
|
|
6460
6530
|
if (s.explicit = !0, o = {
|
|
6461
6531
|
trans: s,
|
|
6462
6532
|
transless: o
|
|
@@ -6464,16 +6534,16 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6464
6534
|
else try {
|
|
6465
6535
|
s.create(), s.idbtrans._explicit = !0, t._state.PR1398_maxLoop = 3;
|
|
6466
6536
|
} catch (i) {
|
|
6467
|
-
return i.name ===
|
|
6537
|
+
return i.name === le.InvalidState && t.isOpen() && 0 < --t._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), t.close({ disableAutoOpen: !1 }), t.open().then(function() {
|
|
6468
6538
|
return e(t, n, r, null, a);
|
|
6469
6539
|
})) : G(i);
|
|
6470
6540
|
}
|
|
6471
|
-
var c, l =
|
|
6472
|
-
return l &&
|
|
6541
|
+
var c, l = ae(a);
|
|
6542
|
+
return l && $e(), o = z.follow(function() {
|
|
6473
6543
|
var e;
|
|
6474
|
-
(c = a.call(s, s)) && (l ? (e =
|
|
6475
|
-
}, o), (c && typeof c.then == "function" ?
|
|
6476
|
-
return s.active ? e : G(new
|
|
6544
|
+
(c = a.call(s, s)) && (l ? (e = H.bind(null, null), c.then(e, e)) : typeof c.next == "function" && typeof c.throw == "function" && (c = Ln(c)));
|
|
6545
|
+
}, o), (c && typeof c.then == "function" ? z.resolve(c).then(function(e) {
|
|
6546
|
+
return s.active ? e : G(new F.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
6477
6547
|
}) : o.then(function() {
|
|
6478
6548
|
return c;
|
|
6479
6549
|
})).then(function(e) {
|
|
@@ -6485,11 +6555,11 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6485
6555
|
});
|
|
6486
6556
|
});
|
|
6487
6557
|
}.bind(null, this, a, o, i, n);
|
|
6488
|
-
return i ? i._promise(a, c, "lock") :
|
|
6558
|
+
return i ? i._promise(a, c, "lock") : R.trans ? W(R.transless, function() {
|
|
6489
6559
|
return r._whenReady(c);
|
|
6490
6560
|
}) : this._whenReady(c);
|
|
6491
6561
|
}, $.prototype.table = function(e) {
|
|
6492
|
-
if (!l(this._allTables, e)) throw new
|
|
6562
|
+
if (!l(this._allTables, e)) throw new F.InvalidTable(`Table ${e} does not exist`);
|
|
6493
6563
|
return this._allTables[e];
|
|
6494
6564
|
}, $);
|
|
6495
6565
|
function $(e, n) {
|
|
@@ -6511,19 +6581,19 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6511
6581
|
isBeingOpened: !1,
|
|
6512
6582
|
onReadyBeingFired: null,
|
|
6513
6583
|
openComplete: !1,
|
|
6514
|
-
dbReadyResolve:
|
|
6584
|
+
dbReadyResolve: I,
|
|
6515
6585
|
dbReadyPromise: null,
|
|
6516
|
-
cancelOpen:
|
|
6586
|
+
cancelOpen: I,
|
|
6517
6587
|
openCanceller: null,
|
|
6518
6588
|
autoSchema: !0,
|
|
6519
6589
|
PR1398_maxLoop: 3,
|
|
6520
6590
|
autoOpen: n.autoOpen
|
|
6521
6591
|
};
|
|
6522
|
-
u.dbReadyPromise = new
|
|
6592
|
+
u.dbReadyPromise = new z(function(e) {
|
|
6523
6593
|
u.dbReadyResolve = e;
|
|
6524
|
-
}), u.openCanceller = new
|
|
6594
|
+
}), u.openCanceller = new z(function(e, t) {
|
|
6525
6595
|
u.cancelOpen = t;
|
|
6526
|
-
}), this._state = u, this.name = e, this.on = yt(this, "populate", "blocked", "versionchange", "close", { ready: [
|
|
6596
|
+
}), this._state = u, this.name = e, this.on = yt(this, "populate", "blocked", "versionchange", "close", { ready: [be, I] }), this.once = function(e, t) {
|
|
6527
6597
|
var n = function() {
|
|
6528
6598
|
var i = [...arguments];
|
|
6529
6599
|
r.on(e).unsubscribe(n), t.apply(r, i);
|
|
@@ -6533,7 +6603,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6533
6603
|
return function(t, n) {
|
|
6534
6604
|
$.vip(function() {
|
|
6535
6605
|
var i, a = r._state;
|
|
6536
|
-
a.openComplete ? (a.dbOpenError ||
|
|
6606
|
+
a.openComplete ? (a.dbOpenError || z.resolve().then(t), n && e(t)) : a.onReadyBeingFired ? (a.onReadyBeingFired.push(t), n && e(t)) : (e(t), i = r, n || e(function e() {
|
|
6537
6607
|
i.on.ready.unsubscribe(t), i.on.ready.unsubscribe(e);
|
|
6538
6608
|
}));
|
|
6539
6609
|
});
|
|
@@ -6564,14 +6634,14 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6564
6634
|
limit: Infinity,
|
|
6565
6635
|
error: r,
|
|
6566
6636
|
or: i.or,
|
|
6567
|
-
valueMapper: e ===
|
|
6637
|
+
valueMapper: e === pe ? null : e
|
|
6568
6638
|
};
|
|
6569
6639
|
})), this.Table = (o = this, bt(vt.prototype, function(e, t, n) {
|
|
6570
6640
|
this.db = o, this._tx = n, this.name = e, this.schema = t, this.hook = o._allTables[e] ? o._allTables[e].hook : yt(null, {
|
|
6571
|
-
creating: [
|
|
6572
|
-
reading: [
|
|
6573
|
-
updating: [
|
|
6574
|
-
deleting: [
|
|
6641
|
+
creating: [ge, I],
|
|
6642
|
+
reading: [me, pe],
|
|
6643
|
+
updating: [ve, I],
|
|
6644
|
+
deleting: [_e, I]
|
|
6575
6645
|
});
|
|
6576
6646
|
})), this.Transaction = (s = this, bt(Wt.prototype, function(e, t, n, r, i) {
|
|
6577
6647
|
var a = this;
|
|
@@ -6579,7 +6649,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6579
6649
|
e = (e = n[e])?.yProps, e && (t = t.concat(e.map(function(e) {
|
|
6580
6650
|
return e.updatesTable;
|
|
6581
6651
|
})));
|
|
6582
|
-
}), this.db = s, this.mode = e, this.storeNames = t, this.schema = n, this.chromeTransactionDurability = r, this.idbtrans = null, this.on = yt(this, "complete", "error", "abort"), this.parent = i || 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
|
|
6652
|
+
}), this.db = s, this.mode = e, this.storeNames = t, this.schema = n, this.chromeTransactionDurability = r, this.idbtrans = null, this.on = yt(this, "complete", "error", "abort"), this.parent = i || 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 z(function(e, t) {
|
|
6583
6653
|
a._resolve = e, a._reject = t;
|
|
6584
6654
|
}), this._completion.then(function() {
|
|
6585
6655
|
a.active = !1, a.on.complete.fire();
|
|
@@ -6606,7 +6676,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6606
6676
|
return 0 < q(e, t) ? e : t;
|
|
6607
6677
|
}, this._min = function(e, t) {
|
|
6608
6678
|
return q(e, t) < 0 ? e : t;
|
|
6609
|
-
}, this._IDBKeyRange = l._deps.IDBKeyRange, !this._IDBKeyRange) throw new
|
|
6679
|
+
}, this._IDBKeyRange = l._deps.IDBKeyRange, !this._IDBKeyRange) throw new F.MissingAPI();
|
|
6610
6680
|
})), this.on("versionchange", function(e) {
|
|
6611
6681
|
0 < e.newVersion ? console.warn(`Another connection wants to upgrade database '${r.name}'. Closing db now to resume the upgrade.`) : console.warn(`Another connection wants to delete database '${r.name}'. Closing db now to resume the delete request.`), r.close({ disableAutoOpen: !1 });
|
|
6612
6682
|
}), this.on("blocked", function(e) {
|
|
@@ -6636,13 +6706,13 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6636
6706
|
return e(r);
|
|
6637
6707
|
});
|
|
6638
6708
|
}
|
|
6639
|
-
var rr,
|
|
6709
|
+
var rr, M = typeof Symbol < "u" && "observable" in Symbol ? Symbol.observable : "@@observable", ir = (ar.prototype.subscribe = function(e, t, n) {
|
|
6640
6710
|
return this._subscribe(e && typeof e != "function" ? e : {
|
|
6641
6711
|
next: e,
|
|
6642
6712
|
error: t,
|
|
6643
6713
|
complete: n
|
|
6644
6714
|
});
|
|
6645
|
-
}, ar.prototype[
|
|
6715
|
+
}, ar.prototype[M] = function() {
|
|
6646
6716
|
return this;
|
|
6647
6717
|
}, ar);
|
|
6648
6718
|
function ar(e) {
|
|
@@ -6661,7 +6731,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6661
6731
|
}
|
|
6662
6732
|
function or(e) {
|
|
6663
6733
|
var t, n = !1, r = new ir(function(r) {
|
|
6664
|
-
var i =
|
|
6734
|
+
var i = ae(e), a, o = !1, s = {}, c = {}, u = {
|
|
6665
6735
|
get closed() {
|
|
6666
6736
|
return o;
|
|
6667
6737
|
},
|
|
@@ -6677,13 +6747,13 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6677
6747
|
}, m = function() {
|
|
6678
6748
|
var u, m, h;
|
|
6679
6749
|
!o && rr.indexedDB && (s = {}, u = {}, a && a.abort(), a = new AbortController(), h = function(t) {
|
|
6680
|
-
var n =
|
|
6750
|
+
var n = Ue();
|
|
6681
6751
|
try {
|
|
6682
|
-
i &&
|
|
6683
|
-
var r =
|
|
6684
|
-
return r = i ? r.finally(
|
|
6752
|
+
i && $e();
|
|
6753
|
+
var r = Qe(e, t);
|
|
6754
|
+
return r = i ? r.finally(H) : r;
|
|
6685
6755
|
} finally {
|
|
6686
|
-
n &&
|
|
6756
|
+
n && We();
|
|
6687
6757
|
}
|
|
6688
6758
|
}(m = {
|
|
6689
6759
|
subscr: u,
|
|
@@ -6721,7 +6791,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6721
6791
|
ur = t;
|
|
6722
6792
|
}
|
|
6723
6793
|
}
|
|
6724
|
-
u(sr, t(t({},
|
|
6794
|
+
u(sr, t(t({}, fe), {
|
|
6725
6795
|
delete: function(e) {
|
|
6726
6796
|
return new sr(e, { addons: [] }).delete();
|
|
6727
6797
|
},
|
|
@@ -6742,7 +6812,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6742
6812
|
});
|
|
6743
6813
|
}) : vn(n, t).toCollection().primaryKeys()).then(e);
|
|
6744
6814
|
} catch {
|
|
6745
|
-
return G(new
|
|
6815
|
+
return G(new F.MissingAPI());
|
|
6746
6816
|
}
|
|
6747
6817
|
var t, n;
|
|
6748
6818
|
},
|
|
@@ -6752,14 +6822,14 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6752
6822
|
};
|
|
6753
6823
|
},
|
|
6754
6824
|
ignoreTransaction: function(e) {
|
|
6755
|
-
return
|
|
6825
|
+
return R.trans ? W(R.transless, e) : e();
|
|
6756
6826
|
},
|
|
6757
6827
|
vip: bn,
|
|
6758
6828
|
async: function(e) {
|
|
6759
6829
|
return function() {
|
|
6760
6830
|
try {
|
|
6761
6831
|
var t = Ln(e.apply(this, arguments));
|
|
6762
|
-
return t && typeof t.then == "function" ? t :
|
|
6832
|
+
return t && typeof t.then == "function" ? t : z.resolve(t);
|
|
6763
6833
|
} catch (e) {
|
|
6764
6834
|
return G(e);
|
|
6765
6835
|
}
|
|
@@ -6768,24 +6838,24 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6768
6838
|
spawn: function(e, t, n) {
|
|
6769
6839
|
try {
|
|
6770
6840
|
var r = Ln(e.apply(n, t || []));
|
|
6771
|
-
return r && typeof r.then == "function" ? r :
|
|
6841
|
+
return r && typeof r.then == "function" ? r : z.resolve(r);
|
|
6772
6842
|
} catch (e) {
|
|
6773
6843
|
return G(e);
|
|
6774
6844
|
}
|
|
6775
6845
|
},
|
|
6776
6846
|
currentTransaction: { get: function() {
|
|
6777
|
-
return
|
|
6847
|
+
return R.trans || null;
|
|
6778
6848
|
} },
|
|
6779
6849
|
waitFor: function(e, t) {
|
|
6780
|
-
return t =
|
|
6850
|
+
return t = z.resolve(typeof e == "function" ? sr.ignoreTransaction(e) : e).timeout(t || 6e4), R.trans ? R.trans.waitFor(t) : t;
|
|
6781
6851
|
},
|
|
6782
|
-
Promise:
|
|
6852
|
+
Promise: z,
|
|
6783
6853
|
debug: {
|
|
6784
6854
|
get: function() {
|
|
6785
|
-
return
|
|
6855
|
+
return L;
|
|
6786
6856
|
},
|
|
6787
6857
|
set: function(e) {
|
|
6788
|
-
|
|
6858
|
+
xe(e);
|
|
6789
6859
|
}
|
|
6790
6860
|
},
|
|
6791
6861
|
derive: p,
|
|
@@ -6811,7 +6881,7 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6811
6881
|
minKey: -Infinity,
|
|
6812
6882
|
addons: [],
|
|
6813
6883
|
connections: st,
|
|
6814
|
-
errnames:
|
|
6884
|
+
errnames: le,
|
|
6815
6885
|
dependencies: rr,
|
|
6816
6886
|
cache: An,
|
|
6817
6887
|
semVer: "4.2.0",
|
|
@@ -6834,16 +6904,16 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6834
6904
|
ur || lr.postMessage(e);
|
|
6835
6905
|
})), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
|
|
6836
6906
|
if (!nr.disableBfCache && e.persisted) {
|
|
6837
|
-
|
|
6907
|
+
L && console.debug("Dexie: handling persisted pagehide"), lr?.close();
|
|
6838
6908
|
for (var t = 0, n = st; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
|
|
6839
6909
|
}
|
|
6840
6910
|
}), addEventListener("pageshow", function(e) {
|
|
6841
|
-
!nr.disableBfCache && e.persisted && (
|
|
6842
|
-
})),
|
|
6843
|
-
return !e || e instanceof
|
|
6911
|
+
!nr.disableBfCache && e.persisted && (L && console.debug("Dexie: handling persisted pageshow"), dr(), cr({ all: new Q(-Infinity, [[]]) }));
|
|
6912
|
+
})), z.rejectionMapper = function(e, t) {
|
|
6913
|
+
return !e || e instanceof N || e instanceof TypeError || e instanceof SyntaxError || !e.name || !de[e.name] ? e : (t = new de[e.name](t || e.message, e), "stack" in e && f(t, "stack", { get: function() {
|
|
6844
6914
|
return this.inner.stack;
|
|
6845
6915
|
} }), t);
|
|
6846
|
-
},
|
|
6916
|
+
}, xe(L), t(nr, Object.freeze({
|
|
6847
6917
|
__proto__: null,
|
|
6848
6918
|
Dexie: nr,
|
|
6849
6919
|
liveQuery: or,
|
|
@@ -6865,9 +6935,9 @@ var gt = /* @__PURE__ */ S((/* @__PURE__ */ b(((e, t) => {
|
|
|
6865
6935
|
rangesOverlap: wn
|
|
6866
6936
|
}), { default: nr }), nr;
|
|
6867
6937
|
});
|
|
6868
|
-
})))(), 1),
|
|
6869
|
-
if (
|
|
6870
|
-
var { liveQuery:
|
|
6938
|
+
})))(), 1), bt = Symbol.for("Dexie"), xt = globalThis[bt] || (globalThis[bt] = yt.default);
|
|
6939
|
+
if (yt.default.semVer !== xt.semVer) throw Error(`Two different versions of Dexie loaded in the same app: ${yt.default.semVer} and ${xt.semVer}`);
|
|
6940
|
+
var { liveQuery: St, mergeRanges: Ct, rangesOverlap: wt, RangeSet: Tt, cmp: Et, Entity: Dt, PropModification: Ot, replacePrefix: kt, add: At, remove: Y, DexieYProvider: jt } = xt;
|
|
6871
6941
|
(class e {
|
|
6872
6942
|
static {
|
|
6873
6943
|
this.reconcileWarned = !1;
|
|
@@ -6887,7 +6957,7 @@ var { liveQuery: J, mergeRanges: yt, rangesOverlap: bt, RangeSet: xt, cmp: St, E
|
|
|
6887
6957
|
return this.documents.has(e);
|
|
6888
6958
|
}
|
|
6889
6959
|
async registerDocument(e) {
|
|
6890
|
-
this.guardWritable(), this.documents.set(e.id, e), this.records.set(
|
|
6960
|
+
this.guardWritable(), this.documents.set(e.id, e), this.records.set(J(e.id), /* @__PURE__ */ new Map()), this.blobData.set(e.id, /* @__PURE__ */ new Map());
|
|
6891
6961
|
}
|
|
6892
6962
|
async getDocument(e) {
|
|
6893
6963
|
return this.documents.get(e);
|
|
@@ -6904,7 +6974,7 @@ var { liveQuery: J, mergeRanges: yt, rangesOverlap: bt, RangeSet: xt, cmp: St, E
|
|
|
6904
6974
|
});
|
|
6905
6975
|
}
|
|
6906
6976
|
async removeDocument(e) {
|
|
6907
|
-
this.guardWritable(), this.documents.delete(e), this.records.delete(
|
|
6977
|
+
this.guardWritable(), this.documents.delete(e), this.records.delete(J(e)), this.changelog.delete(e), this.heads.delete(e), this.blobData.delete(e);
|
|
6908
6978
|
for (let [t, n] of this.blobs) n.documentId === e && this.blobs.delete(t);
|
|
6909
6979
|
}
|
|
6910
6980
|
async get(e, t) {
|
|
@@ -7059,7 +7129,7 @@ var { liveQuery: J, mergeRanges: yt, rangesOverlap: bt, RangeSet: xt, cmp: St, E
|
|
|
7059
7129
|
return t || (t = /* @__PURE__ */ new Map(), this.blobData.set(e, t)), t;
|
|
7060
7130
|
}
|
|
7061
7131
|
getTable(e) {
|
|
7062
|
-
let t =
|
|
7132
|
+
let t = J(e), n = this.records.get(t);
|
|
7063
7133
|
return n || (n = /* @__PURE__ */ new Map(), this.records.set(t, n)), n;
|
|
7064
7134
|
}
|
|
7065
7135
|
guardWritable() {
|
|
@@ -7067,4 +7137,4 @@ var { liveQuery: J, mergeRanges: yt, rangesOverlap: bt, RangeSet: xt, cmp: St, E
|
|
|
7067
7137
|
}
|
|
7068
7138
|
});
|
|
7069
7139
|
//#endregion
|
|
7070
|
-
export {
|
|
7140
|
+
export { he as $, H as A, Ve as B, J as C, mt as D, gt as E, Te as G, Le as H, We as I, xe as J, we as K, $e as N, nt as O, ye as Q, Ue as R, _t as T, Fe as U, ze as V, Ee as W, L as X, Ce as Y, ve as Z, A as at, D as ct, re as dt, ge as et, w as ft, ae as it, U as k, E as lt, S as mt, j as nt, k as ot, C as pt, Se as q, M as rt, O as st, oe as tt, ie as ut, vt as x, He as z };
|