@dialecte/core 0.1.12 → 0.1.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/document/document.d.ts.map +1 -1
- package/dist/document/query/main.d.ts +22 -13
- package/dist/document/query/main.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.d.ts +2 -1
- package/dist/document/transaction/clone/clone.d.ts.map +1 -1
- package/dist/document/transaction/clone/clone.types.d.ts +6 -2
- package/dist/document/transaction/clone/clone.types.d.ts.map +1 -1
- package/dist/document/transaction/main.d.ts +4 -1
- package/dist/document/transaction/main.d.ts.map +1 -1
- package/dist/{index-DI6N50M1.js → index-MWde6dqY.js} +1142 -1094
- package/dist/index.js +1 -1
- package/dist/test.js +1 -1
- package/dist/types/dialecte-config.d.ts +2 -2
- package/dist/types/dialecte-config.d.ts.map +1 -1
- package/dist/types/ref.d.ts +2 -1
- package/dist/types/ref.d.ts.map +1 -1
- package/package.json +1 -1
|
@@ -6,8 +6,8 @@ function cr(m, s) {
|
|
|
6
6
|
for (const i of Object.keys(m)) {
|
|
7
7
|
const d = m[i], h = {};
|
|
8
8
|
for (const y of Object.keys(d)) {
|
|
9
|
-
const
|
|
10
|
-
h[y] = (...
|
|
9
|
+
const _ = d[y];
|
|
10
|
+
h[y] = (...D) => _(s, ...D);
|
|
11
11
|
}
|
|
12
12
|
l[i] = h;
|
|
13
13
|
}
|
|
@@ -117,20 +117,20 @@ async function ri(m) {
|
|
|
117
117
|
async function ai(m) {
|
|
118
118
|
const { context: s, ref: l, tagName: i } = m, d = await Te({ context: s, ref: l });
|
|
119
119
|
if (!d) return [];
|
|
120
|
-
const h = d.children.filter((
|
|
120
|
+
const h = d.children.filter((_) => _.tagName === i).map((_) => ({ tagName: i, id: _.id }));
|
|
121
121
|
return (await ca({ context: s, refs: h })).filter(
|
|
122
|
-
(
|
|
122
|
+
(_) => _ !== void 0
|
|
123
123
|
);
|
|
124
124
|
}
|
|
125
125
|
async function ii(m) {
|
|
126
|
-
const { context: s, ref: l, options: i } = m, d = i?.depth ?? 1 / 0, h = i?.stopAtTagName, y = i?.order ?? "bottom-up",
|
|
127
|
-
let
|
|
128
|
-
for (;
|
|
129
|
-
const F =
|
|
130
|
-
if (
|
|
131
|
-
|
|
126
|
+
const { context: s, ref: l, options: i } = m, d = i?.depth ?? 1 / 0, h = i?.stopAtTagName, y = i?.order ?? "bottom-up", _ = [];
|
|
127
|
+
let D = await Te({ context: s, ref: l });
|
|
128
|
+
for (; D?.parent && _.length < d; ) {
|
|
129
|
+
const F = D.parent, $ = await Te({ context: s, ref: F });
|
|
130
|
+
if (!$ || (_.push($), h && $.tagName === h)) break;
|
|
131
|
+
D = $;
|
|
132
132
|
}
|
|
133
|
-
return y === "top-down" ?
|
|
133
|
+
return y === "top-down" ? _.reverse() : _;
|
|
134
134
|
}
|
|
135
135
|
async function Nn(m) {
|
|
136
136
|
const { context: s, tagName: l, attributes: i } = m, d = await la({ context: s, tagName: l }), h = [];
|
|
@@ -145,11 +145,11 @@ function mr(m) {
|
|
|
145
145
|
for (const [i, d] of Object.entries(l)) {
|
|
146
146
|
if (d === void 0) continue;
|
|
147
147
|
const y = s.attributes.find(
|
|
148
|
-
(
|
|
148
|
+
(_) => _.name === i
|
|
149
149
|
)?.value ?? "";
|
|
150
150
|
if (y === "") return !1;
|
|
151
151
|
if (Array.isArray(d)) {
|
|
152
|
-
if (!d.some((
|
|
152
|
+
if (!d.some((_) => y === _))
|
|
153
153
|
return !1;
|
|
154
154
|
} else if (y !== d)
|
|
155
155
|
return !1;
|
|
@@ -171,33 +171,33 @@ async function oi(m) {
|
|
|
171
171
|
async function si(m) {
|
|
172
172
|
const { context: s, dialecteConfig: l, ref: i } = m, d = await ha({ context: s, ref: i });
|
|
173
173
|
if (!d) return {};
|
|
174
|
-
const h = ci(d), y = [i.tagName, ...l.descendants[i.tagName]],
|
|
175
|
-
for (const
|
|
176
|
-
|
|
177
|
-
for (const
|
|
178
|
-
|
|
179
|
-
return
|
|
174
|
+
const h = ci(d), y = [i.tagName, ...l.descendants[i.tagName]], _ = {};
|
|
175
|
+
for (const D of y)
|
|
176
|
+
_[D] = [];
|
|
177
|
+
for (const D of h)
|
|
178
|
+
_[D.tagName] && _[D.tagName].push(D);
|
|
179
|
+
return _;
|
|
180
180
|
}
|
|
181
181
|
async function ui(m) {
|
|
182
|
-
const { context: s, ref: l, filter: i } = m, d = fa(i), h = new Set(da(i)), y = d[d.length - 1],
|
|
182
|
+
const { context: s, ref: l, filter: i } = m, d = fa(i), h = new Set(da(i)), y = d[d.length - 1], _ = y.attributes ? await Nn({
|
|
183
183
|
context: s,
|
|
184
184
|
tagName: y.tagName,
|
|
185
185
|
attributes: y.attributes
|
|
186
186
|
}) : await hi({
|
|
187
187
|
context: s,
|
|
188
188
|
tagName: y.tagName
|
|
189
|
-
}),
|
|
190
|
-
for (const F of
|
|
191
|
-
const
|
|
189
|
+
}), D = /* @__PURE__ */ new Map();
|
|
190
|
+
for (const F of _) {
|
|
191
|
+
const $ = await li({
|
|
192
192
|
context: s,
|
|
193
193
|
record: F,
|
|
194
194
|
targetRef: l
|
|
195
195
|
});
|
|
196
|
-
if (
|
|
197
|
-
for (const
|
|
198
|
-
h.has(
|
|
196
|
+
if ($.length !== 0 && fi({ ancestry: $, conditions: d }))
|
|
197
|
+
for (const G of $)
|
|
198
|
+
h.has(G.tagName) && (D.has(G.tagName) || D.set(G.tagName, /* @__PURE__ */ new Map()), D.get(G.tagName).set(G.id, G));
|
|
199
199
|
}
|
|
200
|
-
return di({ collected:
|
|
200
|
+
return di({ collected: D, collectTags: h });
|
|
201
201
|
}
|
|
202
202
|
function ci(m) {
|
|
203
203
|
const s = [];
|
|
@@ -263,11 +263,11 @@ async function hi(m) {
|
|
|
263
263
|
}
|
|
264
264
|
async function pi(m) {
|
|
265
265
|
const { context: s, ref: l, name: i } = m;
|
|
266
|
-
return ((await Te({ context: s, ref: l }))?.attributes ?? []).find((
|
|
266
|
+
return ((await Te({ context: s, ref: l }))?.attributes ?? []).find((_) => _.name === i)?.value ?? "";
|
|
267
267
|
}
|
|
268
268
|
async function mi(m) {
|
|
269
269
|
const { context: s, ref: l, name: i } = m;
|
|
270
|
-
return ((await Te({ context: s, ref: l }))?.attributes ?? []).find((
|
|
270
|
+
return ((await Te({ context: s, ref: l }))?.attributes ?? []).find((_) => _.name === i);
|
|
271
271
|
}
|
|
272
272
|
async function gi(m) {
|
|
273
273
|
const { context: s, ref: l } = m;
|
|
@@ -281,18 +281,18 @@ async function yi(m) {
|
|
|
281
281
|
return (await Te({ context: s, ref: l }))?.attributes ?? [];
|
|
282
282
|
}
|
|
283
283
|
async function ha(m) {
|
|
284
|
-
const { context: s, ref: l, options: i = {} } = m, { include: d, exclude: h, unwrap: y } = i,
|
|
285
|
-
Ge(
|
|
284
|
+
const { context: s, ref: l, options: i = {} } = m, { include: d, exclude: h, unwrap: y } = i, _ = await Te({ context: s, ref: l });
|
|
285
|
+
Ge(_, {
|
|
286
286
|
detail: "No record found for provided ref",
|
|
287
287
|
key: "ELEMENT_NOT_FOUND"
|
|
288
288
|
});
|
|
289
|
-
const
|
|
289
|
+
const D = await pa({
|
|
290
290
|
context: s,
|
|
291
|
-
record:
|
|
291
|
+
record: _,
|
|
292
292
|
includeFilters: d ? [d] : void 0,
|
|
293
293
|
exclude: h
|
|
294
294
|
});
|
|
295
|
-
return
|
|
295
|
+
return D ? y ? Ei({ tree: D, unwrapTagNames: y }) : D : dr({ record: _ });
|
|
296
296
|
}
|
|
297
297
|
async function pa(m) {
|
|
298
298
|
const { context: s, record: l, includeFilters: i, exclude: d } = m;
|
|
@@ -303,14 +303,14 @@ async function pa(m) {
|
|
|
303
303
|
record: l,
|
|
304
304
|
currentIncludeFilters: i,
|
|
305
305
|
excludeFilters: d
|
|
306
|
-
}),
|
|
306
|
+
}), _ = (await Promise.all(
|
|
307
307
|
h.map(
|
|
308
|
-
({ record:
|
|
308
|
+
({ record: D, includeFilters: F }) => pa({ context: s, record: D, includeFilters: F, exclude: d })
|
|
309
309
|
)
|
|
310
310
|
)).filter(
|
|
311
|
-
(
|
|
311
|
+
(D) => D !== null
|
|
312
312
|
);
|
|
313
|
-
return dr({ record: l, tree:
|
|
313
|
+
return dr({ record: l, tree: _ });
|
|
314
314
|
}
|
|
315
315
|
function vi(m) {
|
|
316
316
|
const { record: s, excludeFilters: l } = m;
|
|
@@ -323,19 +323,19 @@ function bi(m) {
|
|
|
323
323
|
async function wi(m) {
|
|
324
324
|
const { context: s, record: l, currentIncludeFilters: i, excludeFilters: d } = m;
|
|
325
325
|
if (!l.children?.length) return [];
|
|
326
|
-
const
|
|
326
|
+
const _ = (await Promise.all(
|
|
327
327
|
l.children.map(
|
|
328
|
-
(
|
|
328
|
+
(D) => Te({
|
|
329
329
|
context: s,
|
|
330
|
-
ref: Ee(
|
|
330
|
+
ref: Ee(D)
|
|
331
331
|
})
|
|
332
332
|
)
|
|
333
333
|
)).filter(
|
|
334
|
-
(
|
|
334
|
+
(D) => D !== void 0
|
|
335
335
|
).filter(
|
|
336
|
-
(
|
|
336
|
+
(D) => !bi({ record: D, excludeFilters: d })
|
|
337
337
|
);
|
|
338
|
-
return _i({ children:
|
|
338
|
+
return _i({ children: _, currentIncludeFilters: i });
|
|
339
339
|
}
|
|
340
340
|
function _i(m) {
|
|
341
341
|
const { children: s, currentIncludeFilters: l } = m;
|
|
@@ -558,6 +558,47 @@ class ma {
|
|
|
558
558
|
const i = Ee(s), { fullObject: d } = l || {};
|
|
559
559
|
return d ? yi({ context: this.context, ref: i, ...l }) : gi({ context: this.context, ref: i, ...l });
|
|
560
560
|
}
|
|
561
|
+
//== Any-typed companions (for union-element / untyped-ref call sites)
|
|
562
|
+
/**
|
|
563
|
+
* Get a single attribute value without element-type constraint.
|
|
564
|
+
* Use when the element type is a union or unknown at the call site.
|
|
565
|
+
* Returns `''` if the attribute is absent.
|
|
566
|
+
*/
|
|
567
|
+
async getAnyAttribute(s, l) {
|
|
568
|
+
return this.getAttribute(
|
|
569
|
+
s,
|
|
570
|
+
{ name: l }
|
|
571
|
+
);
|
|
572
|
+
}
|
|
573
|
+
/**
|
|
574
|
+
* Get all attributes as a plain `Record<string, string>` without element-type constraint.
|
|
575
|
+
* Use when the element type is a union or unknown at the call site.
|
|
576
|
+
*/
|
|
577
|
+
async getAnyAttributes(s) {
|
|
578
|
+
return await this.getAttributes(
|
|
579
|
+
s
|
|
580
|
+
);
|
|
581
|
+
}
|
|
582
|
+
/**
|
|
583
|
+
* Get the first direct child matching a tag name without element-type constraint.
|
|
584
|
+
* Use when the parent or child element type is a union or unknown at the call site.
|
|
585
|
+
*/
|
|
586
|
+
async getAnyChild(s, l) {
|
|
587
|
+
return this.getChild(
|
|
588
|
+
s,
|
|
589
|
+
l
|
|
590
|
+
);
|
|
591
|
+
}
|
|
592
|
+
/**
|
|
593
|
+
* Get all direct children matching a tag name without element-type constraint.
|
|
594
|
+
* Use when the parent or child element type is a union or unknown at the call site.
|
|
595
|
+
*/
|
|
596
|
+
async getAnyChildren(s, l) {
|
|
597
|
+
return this.getChildren(
|
|
598
|
+
s,
|
|
599
|
+
l
|
|
600
|
+
);
|
|
601
|
+
}
|
|
561
602
|
//== Find queries
|
|
562
603
|
/**
|
|
563
604
|
* Find records matching specific attribute values.
|
|
@@ -579,14 +620,14 @@ class ma {
|
|
|
579
620
|
}
|
|
580
621
|
function Ze(m) {
|
|
581
622
|
const { context: s, status: l, record: i, oldRecord: d, newRecord: h } = m;
|
|
582
|
-
let y,
|
|
583
|
-
i && (y = ur(i)), d && (
|
|
623
|
+
let y, _, D;
|
|
624
|
+
i && (y = ur(i)), d && (_ = ur(d)), h && (D = ur(h)), l === "created" ? (Ge(y, {
|
|
584
625
|
detail: "Record is required for created",
|
|
585
626
|
key: "ELEMENT_NOT_FOUND"
|
|
586
|
-
}), s.stagedOperations.push({ status: l, oldRecord: void 0, newRecord: y })) : l === "updated" ? (Ge(
|
|
627
|
+
}), s.stagedOperations.push({ status: l, oldRecord: void 0, newRecord: y })) : l === "updated" ? (Ge(_ && D, {
|
|
587
628
|
detail: "Old record and new record are required for updated",
|
|
588
629
|
key: "ELEMENT_NOT_FOUND"
|
|
589
|
-
}), s.stagedOperations.push({ status: l, oldRecord:
|
|
630
|
+
}), s.stagedOperations.push({ status: l, oldRecord: _, newRecord: D })) : l === "deleted" && y && (Ge(y, {
|
|
590
631
|
detail: "Record is required for deleted",
|
|
591
632
|
key: "ELEMENT_NOT_FOUND"
|
|
592
633
|
}), s.stagedOperations.push({ status: l, oldRecord: y, newRecord: void 0 }));
|
|
@@ -612,7 +653,7 @@ function yr(m) {
|
|
|
612
653
|
}
|
|
613
654
|
}
|
|
614
655
|
async function vr(m) {
|
|
615
|
-
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, params: y } = m, { id:
|
|
656
|
+
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, params: y } = m, { id: _, tagName: D, attributes: F, namespace: $, value: G } = y, Q = await Te({ context: i, ref: h });
|
|
616
657
|
Ge(Q, {
|
|
617
658
|
detail: "Parent record not found",
|
|
618
659
|
key: "ELEMENT_NOT_FOUND",
|
|
@@ -622,11 +663,11 @@ async function vr(m) {
|
|
|
622
663
|
dialecteConfig: s,
|
|
623
664
|
hooks: l,
|
|
624
665
|
record: {
|
|
625
|
-
id:
|
|
626
|
-
tagName:
|
|
666
|
+
id: _ ?? crypto.randomUUID(),
|
|
667
|
+
tagName: D,
|
|
627
668
|
attributes: F,
|
|
628
|
-
namespace:
|
|
629
|
-
value:
|
|
669
|
+
namespace: $,
|
|
670
|
+
value: G,
|
|
630
671
|
parent: { id: Q.id, tagName: Q.tagName },
|
|
631
672
|
children: []
|
|
632
673
|
}
|
|
@@ -636,7 +677,7 @@ async function vr(m) {
|
|
|
636
677
|
status: "created",
|
|
637
678
|
record: fe
|
|
638
679
|
});
|
|
639
|
-
const
|
|
680
|
+
const M = {
|
|
640
681
|
...Q,
|
|
641
682
|
children: [...Q.children, { id: fe.id, tagName: fe.tagName }]
|
|
642
683
|
};
|
|
@@ -644,11 +685,11 @@ async function vr(m) {
|
|
|
644
685
|
context: i,
|
|
645
686
|
status: "updated",
|
|
646
687
|
oldRecord: Q,
|
|
647
|
-
newRecord:
|
|
688
|
+
newRecord: M
|
|
648
689
|
}), l?.afterCreated) {
|
|
649
690
|
const B = await l.afterCreated({
|
|
650
691
|
childRecord: fe,
|
|
651
|
-
parentRecord:
|
|
692
|
+
parentRecord: M,
|
|
652
693
|
query: d
|
|
653
694
|
});
|
|
654
695
|
yr({ context: i, operations: B });
|
|
@@ -656,36 +697,36 @@ async function vr(m) {
|
|
|
656
697
|
return fe;
|
|
657
698
|
}
|
|
658
699
|
async function Ti(m) {
|
|
659
|
-
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, record: y } = m,
|
|
700
|
+
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, record: y, cumulativeCloneMappings: _ } = m, D = [], F = await ga({
|
|
660
701
|
dialecteConfig: s,
|
|
661
702
|
hooks: l,
|
|
662
703
|
context: i,
|
|
663
704
|
query: d,
|
|
664
705
|
parentRef: h,
|
|
665
706
|
record: y,
|
|
666
|
-
mappings:
|
|
707
|
+
mappings: D
|
|
667
708
|
});
|
|
668
|
-
if (l?.afterDeepClone) {
|
|
669
|
-
const
|
|
670
|
-
|
|
709
|
+
if (_.push(...D), l?.afterDeepClone) {
|
|
710
|
+
const $ = await l.afterDeepClone({
|
|
711
|
+
cumulativeCloneMappings: _,
|
|
671
712
|
query: d
|
|
672
713
|
});
|
|
673
|
-
i.stagedOperations.push(
|
|
714
|
+
i.stagedOperations.push(...$);
|
|
674
715
|
}
|
|
675
716
|
return {
|
|
676
|
-
record:
|
|
677
|
-
mappings:
|
|
717
|
+
record: F,
|
|
718
|
+
mappings: D
|
|
678
719
|
};
|
|
679
720
|
}
|
|
680
721
|
async function ga(m) {
|
|
681
|
-
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, record: y, mappings:
|
|
682
|
-
let
|
|
722
|
+
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, record: y, mappings: _ } = m;
|
|
723
|
+
let D = !0, F = y;
|
|
683
724
|
if (l?.beforeClone) {
|
|
684
|
-
const
|
|
685
|
-
|
|
725
|
+
const Q = l.beforeClone({ record: y });
|
|
726
|
+
D = Q.shouldBeCloned, F = Q.transformedRecord;
|
|
686
727
|
}
|
|
687
|
-
if (!
|
|
688
|
-
const
|
|
728
|
+
if (!D) return F;
|
|
729
|
+
const $ = await vr({
|
|
689
730
|
dialecteConfig: s,
|
|
690
731
|
hooks: l,
|
|
691
732
|
context: i,
|
|
@@ -697,22 +738,24 @@ async function ga(m) {
|
|
|
697
738
|
attributes: F.attributes,
|
|
698
739
|
value: F.value
|
|
699
740
|
}
|
|
741
|
+
}), G = Ee(y);
|
|
742
|
+
_.push({
|
|
743
|
+
source: Object.assign(G, {
|
|
744
|
+
attributes: [...y.attributes]
|
|
745
|
+
}),
|
|
746
|
+
target: Ee($)
|
|
700
747
|
});
|
|
701
|
-
|
|
702
|
-
source: Ee(y),
|
|
703
|
-
target: Ee(W)
|
|
704
|
-
});
|
|
705
|
-
for (const V of F.tree)
|
|
748
|
+
for (const Q of F.tree)
|
|
706
749
|
await ga({
|
|
707
750
|
dialecteConfig: s,
|
|
708
751
|
hooks: l,
|
|
709
752
|
context: i,
|
|
710
753
|
query: d,
|
|
711
|
-
parentRef: Ee(
|
|
712
|
-
record:
|
|
713
|
-
mappings:
|
|
754
|
+
parentRef: Ee($),
|
|
755
|
+
record: Q,
|
|
756
|
+
mappings: _
|
|
714
757
|
});
|
|
715
|
-
return
|
|
758
|
+
return $;
|
|
716
759
|
}
|
|
717
760
|
function xi(m) {
|
|
718
761
|
const s = /* @__PURE__ */ new Map();
|
|
@@ -744,23 +787,23 @@ function xi(m) {
|
|
|
744
787
|
};
|
|
745
788
|
}
|
|
746
789
|
async function Ni(m) {
|
|
747
|
-
const { stagedOperations: s, store: l, documentState: i } = m, { creates: d, updates: h, deletes: y } = xi(s),
|
|
748
|
-
i.loading = !0, i.progress = { message: "Committing changes...", current: 0, total:
|
|
790
|
+
const { stagedOperations: s, store: l, documentState: i } = m, { creates: d, updates: h, deletes: y } = xi(s), _ = d.length + h.length + y.length;
|
|
791
|
+
i.loading = !0, i.progress = { message: "Committing changes...", current: 0, total: _ };
|
|
749
792
|
try {
|
|
750
793
|
await l.commit({
|
|
751
|
-
creates: d.map((
|
|
752
|
-
updates: h.map((
|
|
753
|
-
deletes: y.map((
|
|
754
|
-
onProgress: (
|
|
755
|
-
i.progress = { message: "Committing changes...", current:
|
|
794
|
+
creates: d.map((D) => D.newRecord),
|
|
795
|
+
updates: h.map((D) => D.newRecord),
|
|
796
|
+
deletes: y.map((D) => D.oldRecord.id),
|
|
797
|
+
onProgress: (D, F) => {
|
|
798
|
+
i.progress = { message: "Committing changes...", current: D, total: F };
|
|
756
799
|
}
|
|
757
800
|
});
|
|
758
|
-
} catch (
|
|
759
|
-
throw i.loading = !1, i.progress = null,
|
|
801
|
+
} catch (D) {
|
|
802
|
+
throw i.loading = !1, i.progress = null, D;
|
|
760
803
|
}
|
|
761
804
|
i.lastUpdate = Date.now();
|
|
762
805
|
}
|
|
763
|
-
async function
|
|
806
|
+
async function Ai(m) {
|
|
764
807
|
const { hooks: s, context: l, query: i, ref: d } = m, h = await Te({ context: l, ref: d });
|
|
765
808
|
if (Ge(h, {
|
|
766
809
|
detail: `Record not found (tagName=${d.tagName}, id=${d.id})`,
|
|
@@ -774,16 +817,16 @@ async function Oi(m) {
|
|
|
774
817
|
yr({ context: l, operations: F });
|
|
775
818
|
}
|
|
776
819
|
await ya({ context: l, record: h }), Ze({ context: l, status: "deleted", record: h });
|
|
777
|
-
const y = Ee(h.parent),
|
|
778
|
-
Ge(
|
|
820
|
+
const y = Ee(h.parent), _ = await Te({ context: l, ref: y });
|
|
821
|
+
Ge(_, {
|
|
779
822
|
detail: `Parent record not found (tagName=${h.parent.tagName}, id=${h.parent.id})`,
|
|
780
823
|
key: "ELEMENT_NOT_FOUND"
|
|
781
824
|
});
|
|
782
|
-
const
|
|
783
|
-
...
|
|
784
|
-
children:
|
|
825
|
+
const D = {
|
|
826
|
+
..._,
|
|
827
|
+
children: _.children.filter((F) => F.id !== h.id)
|
|
785
828
|
};
|
|
786
|
-
return Ze({ context: l, status: "updated", oldRecord:
|
|
829
|
+
return Ze({ context: l, status: "updated", oldRecord: _, newRecord: D }), D;
|
|
787
830
|
}
|
|
788
831
|
async function ya(m) {
|
|
789
832
|
const { context: s, record: l } = m;
|
|
@@ -792,17 +835,17 @@ async function ya(m) {
|
|
|
792
835
|
h && (h.children.length > 0 && await ya({ context: s, record: h }), Ze({ context: s, status: "deleted", record: h }));
|
|
793
836
|
}
|
|
794
837
|
}
|
|
795
|
-
async function
|
|
796
|
-
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, params: y } = m,
|
|
797
|
-
if (
|
|
798
|
-
const [
|
|
838
|
+
async function Oi(m) {
|
|
839
|
+
const { dialecteConfig: s, hooks: l, context: i, query: d, parentRef: h, params: y } = m, _ = Ci(y.attributes);
|
|
840
|
+
if (_) {
|
|
841
|
+
const [D] = await Nn({
|
|
799
842
|
context: i,
|
|
800
843
|
tagName: y.tagName,
|
|
801
|
-
attributes:
|
|
844
|
+
attributes: _
|
|
802
845
|
});
|
|
803
|
-
if (
|
|
846
|
+
if (D) return D;
|
|
804
847
|
} else {
|
|
805
|
-
const
|
|
848
|
+
const D = { tagName: y.tagName, id: y.id }, F = await Te({ context: i, ref: D });
|
|
806
849
|
if (F) return F;
|
|
807
850
|
}
|
|
808
851
|
return vr({
|
|
@@ -819,43 +862,43 @@ function Ci(m) {
|
|
|
819
862
|
return Object.values(s).some((i) => i !== void 0 && i !== "") ? s : void 0;
|
|
820
863
|
}
|
|
821
864
|
async function Di(m) {
|
|
822
|
-
const { dialecteConfig: s, hooks: l, context: i, query: d, ref: h, params: y } = m, { attributes:
|
|
865
|
+
const { dialecteConfig: s, hooks: l, context: i, query: d, ref: h, params: y } = m, { attributes: _, value: D } = y, F = await Te({ context: i, ref: h });
|
|
823
866
|
Ge(F, {
|
|
824
867
|
detail: `Record not found (tagName=${h.tagName}, id=${h.id})`,
|
|
825
868
|
key: "ELEMENT_NOT_FOUND",
|
|
826
869
|
ref: h
|
|
827
870
|
});
|
|
828
|
-
let
|
|
829
|
-
if (
|
|
871
|
+
let $ = F.attributes;
|
|
872
|
+
if (_) {
|
|
830
873
|
const Q = ei({
|
|
831
874
|
dialecteConfig: s,
|
|
832
875
|
tagName: F.tagName,
|
|
833
|
-
attributes:
|
|
876
|
+
attributes: _
|
|
834
877
|
});
|
|
835
|
-
|
|
836
|
-
(
|
|
878
|
+
$ = [...F.attributes.filter(
|
|
879
|
+
(M) => !Q.some((B) => B.name === M.name)
|
|
837
880
|
), ...Q].filter(
|
|
838
|
-
(
|
|
881
|
+
(M) => M.value !== void 0 && M.value !== null
|
|
839
882
|
);
|
|
840
883
|
}
|
|
841
|
-
const
|
|
884
|
+
const G = {
|
|
842
885
|
...F,
|
|
843
|
-
attributes:
|
|
844
|
-
value:
|
|
886
|
+
attributes: $,
|
|
887
|
+
value: D !== void 0 ? D : F.value
|
|
845
888
|
};
|
|
846
|
-
if (Ze({ context: i, status: "updated", oldRecord: F, newRecord:
|
|
889
|
+
if (Ze({ context: i, status: "updated", oldRecord: F, newRecord: G }), l?.afterUpdated) {
|
|
847
890
|
const Q = await l.afterUpdated({
|
|
848
891
|
oldRecord: F,
|
|
849
|
-
newRecord:
|
|
892
|
+
newRecord: G,
|
|
850
893
|
query: d
|
|
851
894
|
});
|
|
852
895
|
yr({ context: i, operations: Q });
|
|
853
896
|
}
|
|
854
|
-
return
|
|
897
|
+
return G;
|
|
855
898
|
}
|
|
856
899
|
class Ii extends ma {
|
|
857
900
|
constructor(s, l, i, d) {
|
|
858
|
-
super(s, l), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.documentState = i, this.hooks = d;
|
|
901
|
+
super(s, l), this.stagedOperations = [], this.recordCache = /* @__PURE__ */ new Map(), this.cumulativeCloneMappings = [], this.documentState = i, this.hooks = d;
|
|
859
902
|
}
|
|
860
903
|
//== Mutations (sync — stage operations, return Refs)
|
|
861
904
|
/**
|
|
@@ -924,7 +967,7 @@ class Ii extends ma {
|
|
|
924
967
|
* If A already exists under root, returns its ref. Otherwise, creates it and returns the new ref.
|
|
925
968
|
*/
|
|
926
969
|
async ensureChild(s, l) {
|
|
927
|
-
return
|
|
970
|
+
return Oi({
|
|
928
971
|
context: this.context,
|
|
929
972
|
parentRef: Ee(s),
|
|
930
973
|
params: l,
|
|
@@ -969,7 +1012,7 @@ class Ii extends ma {
|
|
|
969
1012
|
* ```
|
|
970
1013
|
*/
|
|
971
1014
|
async delete(s) {
|
|
972
|
-
return
|
|
1015
|
+
return Ai({
|
|
973
1016
|
context: this.context,
|
|
974
1017
|
ref: Ee(s),
|
|
975
1018
|
hooks: this.hooks,
|
|
@@ -996,7 +1039,8 @@ class Ii extends ma {
|
|
|
996
1039
|
context: this.context,
|
|
997
1040
|
parentRef: Ee(s),
|
|
998
1041
|
record: l,
|
|
999
|
-
query: this
|
|
1042
|
+
query: this,
|
|
1043
|
+
cumulativeCloneMappings: this.cumulativeCloneMappings
|
|
1000
1044
|
});
|
|
1001
1045
|
}
|
|
1002
1046
|
//== Internal — called by Document, not by consumers
|
|
@@ -1012,6 +1056,10 @@ class Ii extends ma {
|
|
|
1012
1056
|
clearRecordCache() {
|
|
1013
1057
|
this.recordCache.clear();
|
|
1014
1058
|
}
|
|
1059
|
+
/** Free cumulative clone mappings from memory */
|
|
1060
|
+
clearCumulativeCloneMappings() {
|
|
1061
|
+
this.cumulativeCloneMappings = [];
|
|
1062
|
+
}
|
|
1015
1063
|
/**
|
|
1016
1064
|
* Commit all staged operations to the store atomically.
|
|
1017
1065
|
* Called by Document.transaction() after user callback completes.
|
|
@@ -1075,7 +1123,7 @@ class va {
|
|
|
1075
1123
|
const i = this.withAllExtensions(this.createTransaction());
|
|
1076
1124
|
try {
|
|
1077
1125
|
const d = await s(i);
|
|
1078
|
-
return await i.commit(), this.channel.postMessage(this.state.lastUpdate), i.clearStagedOperations(), i.clearRecordCache(), this.state.history.push({
|
|
1126
|
+
return await i.commit(), this.channel.postMessage(this.state.lastUpdate), i.clearStagedOperations(), i.clearRecordCache(), i.clearCumulativeCloneMappings(), this.state.history.push({
|
|
1079
1127
|
method: "commit",
|
|
1080
1128
|
message: l?.label ?? "Changes committed",
|
|
1081
1129
|
timestamp: Date.now()
|
|
@@ -1114,17 +1162,17 @@ class va {
|
|
|
1114
1162
|
const i = this.createTransaction();
|
|
1115
1163
|
try {
|
|
1116
1164
|
await s(this.withAllExtensions(i));
|
|
1117
|
-
} catch (
|
|
1165
|
+
} catch (_) {
|
|
1118
1166
|
throw this.activeTransactions--, this.state.loading = !1, this.state.error ?? qe("UNKNOWN", {
|
|
1119
|
-
detail:
|
|
1120
|
-
cause:
|
|
1167
|
+
detail: _ instanceof Error ? _.message : String(_),
|
|
1168
|
+
cause: _ instanceof Error ? _ : void 0
|
|
1121
1169
|
});
|
|
1122
1170
|
}
|
|
1123
1171
|
this.activeTransactions--, this.state.loading = !1;
|
|
1124
1172
|
const d = i.getStagedOperations(), h = {
|
|
1125
|
-
creates: d.filter((
|
|
1126
|
-
updates: d.filter((
|
|
1127
|
-
deletes: d.filter((
|
|
1173
|
+
creates: d.filter((_) => _.status === "created").length,
|
|
1174
|
+
updates: d.filter((_) => _.status === "updated").length,
|
|
1175
|
+
deletes: d.filter((_) => _.status === "deleted").length
|
|
1128
1176
|
};
|
|
1129
1177
|
let y = !1;
|
|
1130
1178
|
return {
|
|
@@ -1134,15 +1182,15 @@ class va {
|
|
|
1134
1182
|
if (!y) {
|
|
1135
1183
|
y = !0, this.activeTransactions++, this.state.loading = !0;
|
|
1136
1184
|
try {
|
|
1137
|
-
await i.commit(), this.channel.postMessage(this.state.lastUpdate), i.clearStagedOperations(), i.clearRecordCache(), this.state.history.push({
|
|
1185
|
+
await i.commit(), this.channel.postMessage(this.state.lastUpdate), i.clearStagedOperations(), i.clearRecordCache(), i.clearCumulativeCloneMappings(), this.state.history.push({
|
|
1138
1186
|
method: "commit",
|
|
1139
1187
|
message: l?.label ?? "Changes committed",
|
|
1140
1188
|
timestamp: Date.now()
|
|
1141
1189
|
});
|
|
1142
|
-
} catch (
|
|
1190
|
+
} catch (_) {
|
|
1143
1191
|
throw this.state.error ?? qe("UNKNOWN", {
|
|
1144
|
-
detail:
|
|
1145
|
-
cause:
|
|
1192
|
+
detail: _ instanceof Error ? _.message : String(_),
|
|
1193
|
+
cause: _ instanceof Error ? _ : void 0
|
|
1146
1194
|
});
|
|
1147
1195
|
} finally {
|
|
1148
1196
|
this.activeTransactions--, this.state.loading = !1;
|
|
@@ -1150,7 +1198,7 @@ class va {
|
|
|
1150
1198
|
}
|
|
1151
1199
|
},
|
|
1152
1200
|
discard: () => {
|
|
1153
|
-
y || (y = !0, i.clearStagedOperations(), i.clearRecordCache());
|
|
1201
|
+
y || (y = !0, i.clearStagedOperations(), i.clearRecordCache(), i.clearCumulativeCloneMappings());
|
|
1154
1202
|
}
|
|
1155
1203
|
};
|
|
1156
1204
|
}
|
|
@@ -1240,29 +1288,29 @@ function Pi() {
|
|
|
1240
1288
|
for (var r, a = 0, u = t.length; a < u; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
1241
1289
|
return e.concat(r || Array.prototype.slice.call(t));
|
|
1242
1290
|
}
|
|
1243
|
-
var h = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ri, y = Object.keys,
|
|
1244
|
-
function
|
|
1291
|
+
var h = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : Ri, y = Object.keys, _ = Array.isArray;
|
|
1292
|
+
function D(e, t) {
|
|
1245
1293
|
return typeof t != "object" || y(t).forEach(function(n) {
|
|
1246
1294
|
e[n] = t[n];
|
|
1247
1295
|
}), e;
|
|
1248
1296
|
}
|
|
1249
1297
|
typeof Promise > "u" || h.Promise || (h.Promise = Promise);
|
|
1250
|
-
var F = Object.getPrototypeOf,
|
|
1251
|
-
function
|
|
1252
|
-
return
|
|
1298
|
+
var F = Object.getPrototypeOf, $ = {}.hasOwnProperty;
|
|
1299
|
+
function G(e, t) {
|
|
1300
|
+
return $.call(e, t);
|
|
1253
1301
|
}
|
|
1254
1302
|
function Q(e, t) {
|
|
1255
1303
|
typeof t == "function" && (t = t(F(e))), (typeof Reflect > "u" ? y : Reflect.ownKeys)(t).forEach(function(n) {
|
|
1256
|
-
|
|
1304
|
+
M(e, n, t[n]);
|
|
1257
1305
|
});
|
|
1258
1306
|
}
|
|
1259
1307
|
var fe = Object.defineProperty;
|
|
1260
|
-
function
|
|
1261
|
-
fe(e, t,
|
|
1308
|
+
function M(e, t, n, r) {
|
|
1309
|
+
fe(e, t, D(n && G(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
1262
1310
|
}
|
|
1263
1311
|
function B(e) {
|
|
1264
1312
|
return { from: function(t) {
|
|
1265
|
-
return e.prototype = Object.create(t.prototype),
|
|
1313
|
+
return e.prototype = Object.create(t.prototype), M(e.prototype, "constructor", e), { extend: Q.bind(null, e.prototype) };
|
|
1266
1314
|
} };
|
|
1267
1315
|
}
|
|
1268
1316
|
var ue = Object.getOwnPropertyDescriptor, ie = [].slice;
|
|
@@ -1279,7 +1327,7 @@ function Pi() {
|
|
|
1279
1327
|
h.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
1280
1328
|
}
|
|
1281
1329
|
function de(e, t) {
|
|
1282
|
-
if (typeof t == "string" &&
|
|
1330
|
+
if (typeof t == "string" && G(e, t)) return e[t];
|
|
1283
1331
|
if (!t) return e;
|
|
1284
1332
|
if (typeof t != "string") {
|
|
1285
1333
|
for (var n = [], r = 0, a = t.length; r < a; ++r) {
|
|
@@ -1300,19 +1348,19 @@ function Pi() {
|
|
|
1300
1348
|
for (var r = 0, a = t.length; r < a; ++r) le(e, t[r], n[r]);
|
|
1301
1349
|
} else {
|
|
1302
1350
|
var u, f, p = t.indexOf(".");
|
|
1303
|
-
p !== -1 ? (u = t.substr(0, p), (f = t.substr(p + 1)) === "" ? n === void 0 ?
|
|
1351
|
+
p !== -1 ? (u = t.substr(0, p), (f = t.substr(p + 1)) === "" ? n === void 0 ? _(e) && !isNaN(parseInt(u)) ? e.splice(u, 1) : delete e[u] : e[u] = n : le(p = !(p = e[u]) || !G(e, u) ? e[u] = {} : p, f, n)) : n === void 0 ? _(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
1304
1352
|
}
|
|
1305
1353
|
}
|
|
1306
1354
|
function me(e) {
|
|
1307
1355
|
var t, n = {};
|
|
1308
|
-
for (t in e)
|
|
1356
|
+
for (t in e) G(e, t) && (n[t] = e[t]);
|
|
1309
1357
|
return n;
|
|
1310
1358
|
}
|
|
1311
|
-
var
|
|
1312
|
-
function
|
|
1313
|
-
return
|
|
1359
|
+
var An = [].concat;
|
|
1360
|
+
function I(e) {
|
|
1361
|
+
return An.apply([], e);
|
|
1314
1362
|
}
|
|
1315
|
-
var Ve = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(
|
|
1363
|
+
var Ve = "BigUint64Array,BigInt64Array,Array,Boolean,String,Date,RegExp,Blob,File,FileList,FileSystemFileHandle,FileSystemDirectoryHandle,ArrayBuffer,DataView,Uint8ClampedArray,ImageBitmap,ImageData,Map,Set,CryptoKey".split(",").concat(I([8, 16, 32, 64].map(function(e) {
|
|
1316
1364
|
return ["Int", "Uint", "Float"].map(function(t) {
|
|
1317
1365
|
return t + e + "Array";
|
|
1318
1366
|
});
|
|
@@ -1326,13 +1374,13 @@ function Pi() {
|
|
|
1326
1374
|
if (!n || typeof n != "object") return n;
|
|
1327
1375
|
var r = Ue.get(n);
|
|
1328
1376
|
if (r) return r;
|
|
1329
|
-
if (
|
|
1377
|
+
if (_(n)) {
|
|
1330
1378
|
r = [], Ue.set(n, r);
|
|
1331
1379
|
for (var a = 0, u = n.length; a < u; ++a) r.push(t(n[a]));
|
|
1332
1380
|
} else if (Rt.has(n.constructor)) r = n;
|
|
1333
1381
|
else {
|
|
1334
1382
|
var f, p = F(n);
|
|
1335
|
-
for (f in r = p === Object.prototype ? {} : Object.create(p), Ue.set(n, r), n)
|
|
1383
|
+
for (f in r = p === Object.prototype ? {} : Object.create(p), Ue.set(n, r), n) G(n, f) && (r[f] = t(n[f]));
|
|
1336
1384
|
}
|
|
1337
1385
|
return r;
|
|
1338
1386
|
})(e), Ue = null, e;
|
|
@@ -1347,14 +1395,14 @@ function Pi() {
|
|
|
1347
1395
|
} : function() {
|
|
1348
1396
|
return null;
|
|
1349
1397
|
};
|
|
1350
|
-
function
|
|
1398
|
+
function je(e, t) {
|
|
1351
1399
|
return t = e.indexOf(t), 0 <= t && e.splice(t, 1), 0 <= t;
|
|
1352
1400
|
}
|
|
1353
1401
|
var ze = {};
|
|
1354
1402
|
function Ie(e) {
|
|
1355
1403
|
var t, n, r, a;
|
|
1356
1404
|
if (arguments.length === 1) {
|
|
1357
|
-
if (
|
|
1405
|
+
if (_(e)) return e.slice();
|
|
1358
1406
|
if (this === ze && typeof e == "string") return [e];
|
|
1359
1407
|
if (a = ye(e)) {
|
|
1360
1408
|
for (n = []; !(r = a.next()).done; ) n.push(r.value);
|
|
@@ -1387,23 +1435,23 @@ function Pi() {
|
|
|
1387
1435
|
function tt(e, t, n, r) {
|
|
1388
1436
|
this.failures = t, this.failedKeys = r, this.successCount = n, this.message = wt(e, t);
|
|
1389
1437
|
}
|
|
1390
|
-
function
|
|
1438
|
+
function Me(e, t) {
|
|
1391
1439
|
this.name = "BulkError", this.failures = Object.keys(t).map(function(n) {
|
|
1392
1440
|
return t[n];
|
|
1393
1441
|
}), this.failuresByPos = t, this.message = wt(e, this.failures);
|
|
1394
1442
|
}
|
|
1395
1443
|
B(et).from(Error).extend({ toString: function() {
|
|
1396
1444
|
return this.name + ": " + this.message;
|
|
1397
|
-
} }), B(tt).from(et), B(
|
|
1445
|
+
} }), B(tt).from(et), B(Me).from(et);
|
|
1398
1446
|
var lt = Le.reduce(function(e, t) {
|
|
1399
1447
|
return e[t] = t + "Error", e;
|
|
1400
|
-
}, {}),
|
|
1448
|
+
}, {}), On = et, z = Le.reduce(function(e, t) {
|
|
1401
1449
|
var n = t + "Error";
|
|
1402
1450
|
function r(a, u) {
|
|
1403
1451
|
this.name = n, a ? typeof a == "string" ? (this.message = "".concat(a).concat(u ? `
|
|
1404
1452
|
` + u : ""), this.inner = u || null) : typeof a == "object" && (this.message = "".concat(a.name, " ").concat(a.message), this.inner = a) : (this.message = ce[t] || n, this.inner = null);
|
|
1405
1453
|
}
|
|
1406
|
-
return B(r).from(
|
|
1454
|
+
return B(r).from(On), e[t] = r, e;
|
|
1407
1455
|
}, {});
|
|
1408
1456
|
z.Syntax = SyntaxError, z.Type = TypeError, z.Range = RangeError;
|
|
1409
1457
|
var _t = nt.reduce(function(e, t) {
|
|
@@ -1446,9 +1494,9 @@ function Pi() {
|
|
|
1446
1494
|
function be(e, t) {
|
|
1447
1495
|
return e === c ? t : function(n) {
|
|
1448
1496
|
var r = e.apply(this, arguments);
|
|
1449
|
-
|
|
1497
|
+
D(n, r);
|
|
1450
1498
|
var a = this.onsuccess, u = this.onerror;
|
|
1451
|
-
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? E(a, this.onsuccess) : a), u && (this.onerror = this.onerror ? E(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n :
|
|
1499
|
+
return this.onsuccess = null, this.onerror = null, n = t.apply(this, arguments), a && (this.onsuccess = this.onsuccess ? E(a, this.onsuccess) : a), u && (this.onerror = this.onerror ? E(u, this.onerror) : u), r === void 0 ? n === void 0 ? void 0 : n : D(r, n);
|
|
1452
1500
|
};
|
|
1453
1501
|
}
|
|
1454
1502
|
function Re(e, t) {
|
|
@@ -1456,7 +1504,7 @@ function Pi() {
|
|
|
1456
1504
|
return t.apply(this, arguments) !== !1 && e.apply(this, arguments);
|
|
1457
1505
|
};
|
|
1458
1506
|
}
|
|
1459
|
-
function
|
|
1507
|
+
function Oe(e, t) {
|
|
1460
1508
|
return e === c ? t : function() {
|
|
1461
1509
|
var n = e.apply(this, arguments);
|
|
1462
1510
|
if (n && typeof n.then == "function") {
|
|
@@ -1468,9 +1516,9 @@ function Pi() {
|
|
|
1468
1516
|
return t.apply(this, arguments);
|
|
1469
1517
|
};
|
|
1470
1518
|
}
|
|
1471
|
-
Et.ModifyError = tt, Et.DexieError = et, Et.BulkError =
|
|
1519
|
+
Et.ModifyError = tt, Et.DexieError = et, Et.BulkError = Me;
|
|
1472
1520
|
var Ne = typeof location < "u" && /^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);
|
|
1473
|
-
function
|
|
1521
|
+
function Ae(e) {
|
|
1474
1522
|
Ne = e;
|
|
1475
1523
|
}
|
|
1476
1524
|
var Fe = {}, zt = 100, Ve = typeof Promise > "u" ? [] : (function() {
|
|
@@ -1508,14 +1556,14 @@ function Pi() {
|
|
|
1508
1556
|
var Rn = { get: function() {
|
|
1509
1557
|
var e = Y, t = nn;
|
|
1510
1558
|
function n(r, a) {
|
|
1511
|
-
var u = this, f = !e.global && (e !== Y || t !== nn), p = f && !it(), v = new X(function(
|
|
1512
|
-
kn(u, new br(Er(r, e, f, p), Er(a, e, f, p),
|
|
1559
|
+
var u = this, f = !e.global && (e !== Y || t !== nn), p = f && !it(), v = new X(function(w, x) {
|
|
1560
|
+
kn(u, new br(Er(r, e, f, p), Er(a, e, f, p), w, x, e));
|
|
1513
1561
|
});
|
|
1514
1562
|
return this._consoleTask && (v._consoleTask = this._consoleTask), v;
|
|
1515
1563
|
}
|
|
1516
1564
|
return n.prototype = Fe, n;
|
|
1517
1565
|
}, set: function(e) {
|
|
1518
|
-
|
|
1566
|
+
M(this, "then", e && e.prototype === Fe ? Rn : { get: function() {
|
|
1519
1567
|
return e;
|
|
1520
1568
|
}, set: Rn.set });
|
|
1521
1569
|
} };
|
|
@@ -1628,7 +1676,7 @@ function Pi() {
|
|
|
1628
1676
|
}, e);
|
|
1629
1677
|
n.then(r, a).finally(clearTimeout.bind(null, u));
|
|
1630
1678
|
}) : this;
|
|
1631
|
-
} }), typeof Symbol < "u" && Symbol.toStringTag &&
|
|
1679
|
+
} }), typeof Symbol < "u" && Symbol.toStringTag && M(X.prototype, Symbol.toStringTag, "Dexie.Promise"), rt.env = _r(), Q(X, { all: function() {
|
|
1632
1680
|
var e = Ie.apply(null, arguments).map(rn);
|
|
1633
1681
|
return new X(function(t, n) {
|
|
1634
1682
|
e.length === 0 && t([]);
|
|
@@ -1672,15 +1720,15 @@ function Pi() {
|
|
|
1672
1720
|
var p, v = this;
|
|
1673
1721
|
p = function() {
|
|
1674
1722
|
v.unhandleds.length === 0 ? a() : u(v.unhandleds[0]);
|
|
1675
|
-
}, Zt.push(function
|
|
1676
|
-
p(), Zt.splice(Zt.indexOf(
|
|
1723
|
+
}, Zt.push(function w() {
|
|
1724
|
+
p(), Zt.splice(Zt.indexOf(w), 1);
|
|
1677
1725
|
}), ++dt, Pt(function() {
|
|
1678
1726
|
--dt == 0 && Pn();
|
|
1679
1727
|
}, []);
|
|
1680
1728
|
}, f.finalize), e();
|
|
1681
1729
|
}, t, n, r);
|
|
1682
1730
|
});
|
|
1683
|
-
} }), Xe && (Xe.allSettled &&
|
|
1731
|
+
} }), Xe && (Xe.allSettled && M(X, "allSettled", function() {
|
|
1684
1732
|
var e = Ie.apply(null, arguments).map(rn);
|
|
1685
1733
|
return new X(function(t) {
|
|
1686
1734
|
e.length === 0 && t([]);
|
|
@@ -1695,7 +1743,7 @@ function Pi() {
|
|
|
1695
1743
|
});
|
|
1696
1744
|
});
|
|
1697
1745
|
});
|
|
1698
|
-
}), Xe.any && typeof AggregateError < "u" &&
|
|
1746
|
+
}), Xe.any && typeof AggregateError < "u" && M(X, "any", function() {
|
|
1699
1747
|
var e = Ie.apply(null, arguments).map(rn);
|
|
1700
1748
|
return new X(function(t, n) {
|
|
1701
1749
|
e.length === 0 && n(new AggregateError([]));
|
|
@@ -1712,7 +1760,7 @@ function Pi() {
|
|
|
1712
1760
|
var Ce = { awaits: 0, echoes: 0, id: 0 }, Ia = 0, en = [], tn = 0, nn = 0, Ra = 0;
|
|
1713
1761
|
function at(e, t, n, r) {
|
|
1714
1762
|
var a = Y, u = Object.create(a);
|
|
1715
|
-
return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Ra, rt.env, u.env = Cn ? { Promise: X, PromiseProp: { value: X, configurable: !0, writable: !0 }, all: X.all, race: X.race, allSettled: X.allSettled, any: X.any, resolve: X.resolve, reject: X.reject } : {}, t &&
|
|
1763
|
+
return u.parent = a, u.ref = 0, u.global = !1, u.id = ++Ra, rt.env, u.env = Cn ? { Promise: X, PromiseProp: { value: X, configurable: !0, writable: !0 }, all: X.all, race: X.race, allSettled: X.allSettled, any: X.any, resolve: X.resolve, reject: X.reject } : {}, t && D(u, t), ++a.ref, u.finalize = function() {
|
|
1716
1764
|
--this.parent.ref || this.parent.finalize();
|
|
1717
1765
|
}, r = ht(u, e, n, r), u.ref === 0 && u.finalize(), r;
|
|
1718
1766
|
}
|
|
@@ -1766,7 +1814,7 @@ function Pi() {
|
|
|
1766
1814
|
Promise === Xe && Ce.echoes === 0 ? tn === 0 ? e() : enqueueNativeMicroTask(e) : setTimeout(e, 0);
|
|
1767
1815
|
}
|
|
1768
1816
|
("" + Le).indexOf("[native code]") === -1 && (Nt = it = c);
|
|
1769
|
-
var we = X.reject, pt = "", Qe = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Tr = "String expected.",
|
|
1817
|
+
var we = X.reject, pt = "", Qe = "Invalid key provided. Keys must be of type string, number, Date or Array<string | number | Date>.", Tr = "String expected.", At = [], an = "__dbnames", Bn = "readonly", Mn = "readwrite";
|
|
1770
1818
|
function mt(e, t) {
|
|
1771
1819
|
return e ? t ? function() {
|
|
1772
1820
|
return e.apply(this, arguments) && t.apply(this, arguments);
|
|
@@ -1785,7 +1833,7 @@ function Pi() {
|
|
|
1785
1833
|
}
|
|
1786
1834
|
function re(e, t) {
|
|
1787
1835
|
try {
|
|
1788
|
-
var n =
|
|
1836
|
+
var n = Ar(e), r = Ar(t);
|
|
1789
1837
|
if (n !== r) return n === "Array" ? 1 : r === "Array" ? -1 : n === "binary" ? 1 : r === "binary" ? -1 : n === "string" ? 1 : r === "string" ? -1 : n === "Date" ? 1 : r !== "Date" ? NaN : -1;
|
|
1790
1838
|
switch (n) {
|
|
1791
1839
|
case "number":
|
|
@@ -1794,13 +1842,13 @@ function Pi() {
|
|
|
1794
1842
|
return t < e ? 1 : e < t ? -1 : 0;
|
|
1795
1843
|
case "binary":
|
|
1796
1844
|
return (function(a, u) {
|
|
1797
|
-
for (var f = a.length, p = u.length, v = f < p ? f : p,
|
|
1845
|
+
for (var f = a.length, p = u.length, v = f < p ? f : p, w = 0; w < v; ++w) if (a[w] !== u[w]) return a[w] < u[w] ? -1 : 1;
|
|
1798
1846
|
return f === p ? 0 : f < p ? -1 : 1;
|
|
1799
|
-
})(
|
|
1847
|
+
})(Or(e), Or(t));
|
|
1800
1848
|
case "Array":
|
|
1801
1849
|
return (function(a, u) {
|
|
1802
|
-
for (var f = a.length, p = u.length, v = f < p ? f : p,
|
|
1803
|
-
var x = re(a[
|
|
1850
|
+
for (var f = a.length, p = u.length, v = f < p ? f : p, w = 0; w < v; ++w) {
|
|
1851
|
+
var x = re(a[w], u[w]);
|
|
1804
1852
|
if (x !== 0) return x;
|
|
1805
1853
|
}
|
|
1806
1854
|
return f === p ? 0 : f < p ? -1 : 1;
|
|
@@ -1810,11 +1858,11 @@ function Pi() {
|
|
|
1810
1858
|
}
|
|
1811
1859
|
return NaN;
|
|
1812
1860
|
}
|
|
1813
|
-
function
|
|
1861
|
+
function Ar(e) {
|
|
1814
1862
|
var t = typeof e;
|
|
1815
1863
|
return t != "object" ? t : ArrayBuffer.isView(e) ? "binary" : (e = St(e), e === "ArrayBuffer" ? "binary" : e);
|
|
1816
1864
|
}
|
|
1817
|
-
function
|
|
1865
|
+
function Or(e) {
|
|
1818
1866
|
return e instanceof Uint8Array ? e : ArrayBuffer.isView(e) ? new Uint8Array(e.buffer, e.byteOffset, e.byteLength) : new Uint8Array(e);
|
|
1819
1867
|
}
|
|
1820
1868
|
function sn(e, t, n) {
|
|
@@ -1829,7 +1877,7 @@ function Pi() {
|
|
|
1829
1877
|
}
|
|
1830
1878
|
var Cr = (he.prototype._trans = function(e, t, n) {
|
|
1831
1879
|
var r = this._tx || Y.trans, a = this.name, u = Ne && typeof console < "u" && console.createTask && console.createTask("Dexie: ".concat(e === "readonly" ? "read" : "write", " ").concat(this.name));
|
|
1832
|
-
function f(
|
|
1880
|
+
function f(w, x, g) {
|
|
1833
1881
|
if (!g.schema[a]) throw new z.NotFound("Table " + a + " not part of transaction");
|
|
1834
1882
|
return t(g.idbtrans, g);
|
|
1835
1883
|
}
|
|
@@ -1837,27 +1885,27 @@ function Pi() {
|
|
|
1837
1885
|
try {
|
|
1838
1886
|
var v = r && r.db._novip === this.db._novip ? r === Y.trans ? r._promise(e, f, n) : at(function() {
|
|
1839
1887
|
return r._promise(e, f, n);
|
|
1840
|
-
}, { trans: r, transless: Y.transless || Y }) : (function
|
|
1888
|
+
}, { trans: r, transless: Y.transless || Y }) : (function w(x, g, O, b) {
|
|
1841
1889
|
if (x.idbdb && (x._state.openComplete || Y.letThrough || x._vip)) {
|
|
1842
|
-
var T = x._createTransaction(g,
|
|
1890
|
+
var T = x._createTransaction(g, O, x._dbSchema);
|
|
1843
1891
|
try {
|
|
1844
1892
|
T.create(), x._state.PR1398_maxLoop = 3;
|
|
1845
|
-
} catch (
|
|
1846
|
-
return
|
|
1847
|
-
return
|
|
1848
|
-
})) : we(
|
|
1893
|
+
} catch (A) {
|
|
1894
|
+
return A.name === lt.InvalidState && x.isOpen() && 0 < --x._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), x.close({ disableAutoOpen: !1 }), x.open().then(function() {
|
|
1895
|
+
return w(x, g, O, b);
|
|
1896
|
+
})) : we(A);
|
|
1849
1897
|
}
|
|
1850
|
-
return T._promise(g, function(
|
|
1898
|
+
return T._promise(g, function(A, N) {
|
|
1851
1899
|
return at(function() {
|
|
1852
|
-
return Y.trans = T, b(
|
|
1900
|
+
return Y.trans = T, b(A, N, T);
|
|
1853
1901
|
});
|
|
1854
|
-
}).then(function(
|
|
1902
|
+
}).then(function(A) {
|
|
1855
1903
|
if (g === "readwrite") try {
|
|
1856
1904
|
T.idbtrans.commit();
|
|
1857
1905
|
} catch {
|
|
1858
1906
|
}
|
|
1859
|
-
return g === "readonly" ?
|
|
1860
|
-
return
|
|
1907
|
+
return g === "readonly" ? A : T._completion.then(function() {
|
|
1908
|
+
return A;
|
|
1861
1909
|
});
|
|
1862
1910
|
});
|
|
1863
1911
|
}
|
|
@@ -1867,11 +1915,11 @@ function Pi() {
|
|
|
1867
1915
|
x.open().catch(c);
|
|
1868
1916
|
}
|
|
1869
1917
|
return x._state.dbReadyPromise.then(function() {
|
|
1870
|
-
return
|
|
1918
|
+
return w(x, g, O, b);
|
|
1871
1919
|
});
|
|
1872
1920
|
})(this.db, e, [this.name], f);
|
|
1873
|
-
return u && (v._consoleTask = u, v = v.catch(function(
|
|
1874
|
-
return console.trace(
|
|
1921
|
+
return u && (v._consoleTask = u, v = v.catch(function(w) {
|
|
1922
|
+
return console.trace(w), we(w);
|
|
1875
1923
|
})), v;
|
|
1876
1924
|
} finally {
|
|
1877
1925
|
p && xt();
|
|
@@ -1885,12 +1933,12 @@ function Pi() {
|
|
|
1885
1933
|
}).then(t);
|
|
1886
1934
|
}, he.prototype.where = function(e) {
|
|
1887
1935
|
if (typeof e == "string") return new this.db.WhereClause(this, e);
|
|
1888
|
-
if (
|
|
1936
|
+
if (_(e)) return new this.db.WhereClause(this, "[".concat(e.join("+"), "]"));
|
|
1889
1937
|
var t = y(e);
|
|
1890
1938
|
if (t.length === 1) return this.where(t[0]).equals(e[t[0]]);
|
|
1891
1939
|
var n = this.schema.indexes.concat(this.schema.primKey).filter(function(p) {
|
|
1892
|
-
if (p.compound && t.every(function(
|
|
1893
|
-
return 0 <= p.keyPath.indexOf(
|
|
1940
|
+
if (p.compound && t.every(function(w) {
|
|
1941
|
+
return 0 <= p.keyPath.indexOf(w);
|
|
1894
1942
|
})) {
|
|
1895
1943
|
for (var v = 0; v < t.length; ++v) if (t.indexOf(p.keyPath[v]) === -1) return !1;
|
|
1896
1944
|
return !0;
|
|
@@ -1911,13 +1959,13 @@ function Pi() {
|
|
|
1911
1959
|
return re(p, v) === 0;
|
|
1912
1960
|
}
|
|
1913
1961
|
var f = t.reduce(function(g, v) {
|
|
1914
|
-
var
|
|
1915
|
-
return [
|
|
1916
|
-
return b = de(b, v),
|
|
1917
|
-
return a(
|
|
1962
|
+
var w = g[0], x = g[1], g = r[v], O = e[v];
|
|
1963
|
+
return [w || g, w || !g ? mt(x, g && g.multi ? function(b) {
|
|
1964
|
+
return b = de(b, v), _(b) && b.some(function(T) {
|
|
1965
|
+
return a(O, T);
|
|
1918
1966
|
});
|
|
1919
1967
|
} : function(b) {
|
|
1920
|
-
return a(
|
|
1968
|
+
return a(O, de(b, v));
|
|
1921
1969
|
}) : x];
|
|
1922
1970
|
}, [null, null]), u = f[0], f = f[1];
|
|
1923
1971
|
return u ? this.where(u.name).equals(e[u.keyPath]).filter(f) : n ? this.filter(f) : this.where(t).equals("");
|
|
@@ -1936,7 +1984,7 @@ function Pi() {
|
|
|
1936
1984
|
}, he.prototype.toCollection = function() {
|
|
1937
1985
|
return new this.db.Collection(new this.db.WhereClause(this));
|
|
1938
1986
|
}, he.prototype.orderBy = function(e) {
|
|
1939
|
-
return new this.db.Collection(new this.db.WhereClause(this,
|
|
1987
|
+
return new this.db.Collection(new this.db.WhereClause(this, _(e) ? "[".concat(e.join("+"), "]") : e));
|
|
1940
1988
|
}, he.prototype.reverse = function() {
|
|
1941
1989
|
return this.toCollection().reverse();
|
|
1942
1990
|
}, he.prototype.mapToClass = function(e) {
|
|
@@ -1944,12 +1992,12 @@ function Pi() {
|
|
|
1944
1992
|
function a() {
|
|
1945
1993
|
return t !== null && t.apply(this, arguments) || this;
|
|
1946
1994
|
}
|
|
1947
|
-
(this.schema.mappedClass = e).prototype instanceof Nr && ((function(v,
|
|
1948
|
-
if (typeof
|
|
1995
|
+
(this.schema.mappedClass = e).prototype instanceof Nr && ((function(v, w) {
|
|
1996
|
+
if (typeof w != "function" && w !== null) throw new TypeError("Class extends value " + String(w) + " is not a constructor or null");
|
|
1949
1997
|
function x() {
|
|
1950
1998
|
this.constructor = v;
|
|
1951
1999
|
}
|
|
1952
|
-
l(v,
|
|
2000
|
+
l(v, w), v.prototype = w === null ? Object.create(w) : (x.prototype = w.prototype, new x());
|
|
1953
2001
|
})(a, t = e), Object.defineProperty(a.prototype, "db", { get: function() {
|
|
1954
2002
|
return n;
|
|
1955
2003
|
}, enumerable: !1, configurable: !0 }), a.prototype.table = function() {
|
|
@@ -1960,9 +2008,9 @@ function Pi() {
|
|
|
1960
2008
|
});
|
|
1961
2009
|
function p(v) {
|
|
1962
2010
|
if (!v) return v;
|
|
1963
|
-
var
|
|
1964
|
-
for (
|
|
1965
|
-
x[
|
|
2011
|
+
var w, x = Object.create(e.prototype);
|
|
2012
|
+
for (w in v) if (!u.has(w)) try {
|
|
2013
|
+
x[w] = v[w];
|
|
1966
2014
|
} catch {
|
|
1967
2015
|
}
|
|
1968
2016
|
return x;
|
|
@@ -1970,7 +2018,7 @@ function Pi() {
|
|
|
1970
2018
|
return this.schema.readHook && this.hook.reading.unsubscribe(this.schema.readHook), this.schema.readHook = p, this.hook("reading", p), e;
|
|
1971
2019
|
}, he.prototype.defineClass = function() {
|
|
1972
2020
|
return this.mapToClass(function(e) {
|
|
1973
|
-
|
|
2021
|
+
D(this, e);
|
|
1974
2022
|
});
|
|
1975
2023
|
}, he.prototype.add = function(e, t) {
|
|
1976
2024
|
var n = this, r = this.schema.primKey, a = r.auto, u = r.keyPath, f = e;
|
|
@@ -1986,7 +2034,7 @@ function Pi() {
|
|
|
1986
2034
|
return p;
|
|
1987
2035
|
});
|
|
1988
2036
|
}, he.prototype.update = function(e, t) {
|
|
1989
|
-
return typeof e != "object" ||
|
|
2037
|
+
return typeof e != "object" || _(e) ? this.where(":id").equals(e).modify(t) : (e = de(e, this.schema.primKey.keyPath), e === void 0 ? we(new z.InvalidArgument("Given object does not contain its primary key")) : this.where(":id").equals(e).modify(t));
|
|
1990
2038
|
}, he.prototype.put = function(e, t) {
|
|
1991
2039
|
var n = this, r = this.schema.primKey, a = r.auto, u = r.keyPath, f = e;
|
|
1992
2040
|
return u && a && (f = on(u)(e)), this._trans("readwrite", function(p) {
|
|
@@ -2030,27 +2078,27 @@ function Pi() {
|
|
|
2030
2078
|
}, he.prototype.bulkAdd = function(e, t, n) {
|
|
2031
2079
|
var r = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
2032
2080
|
return this._trans("readwrite", function(f) {
|
|
2033
|
-
var
|
|
2034
|
-
if (
|
|
2081
|
+
var w = r.schema.primKey, p = w.auto, w = w.keyPath;
|
|
2082
|
+
if (w && a) throw new z.InvalidArgument("bulkAdd(): keys argument invalid on tables with inbound keys");
|
|
2035
2083
|
if (a && a.length !== e.length) throw new z.InvalidArgument("Arguments objects and keys must have the same length");
|
|
2036
|
-
var v = e.length,
|
|
2037
|
-
return r.core.mutate({ trans: f, type: "add", keys: a, values:
|
|
2038
|
-
var g = T.numFailures,
|
|
2039
|
-
if (g === 0) return u ?
|
|
2040
|
-
throw new
|
|
2084
|
+
var v = e.length, w = w && p ? e.map(on(w)) : e;
|
|
2085
|
+
return r.core.mutate({ trans: f, type: "add", keys: a, values: w, wantResults: u }).then(function(T) {
|
|
2086
|
+
var g = T.numFailures, O = T.results, b = T.lastResult, T = T.failures;
|
|
2087
|
+
if (g === 0) return u ? O : b;
|
|
2088
|
+
throw new Me("".concat(r.name, ".bulkAdd(): ").concat(g, " of ").concat(v, " operations failed"), T);
|
|
2041
2089
|
});
|
|
2042
2090
|
});
|
|
2043
2091
|
}, he.prototype.bulkPut = function(e, t, n) {
|
|
2044
2092
|
var r = this, a = Array.isArray(t) ? t : void 0, u = (n = n || (a ? void 0 : t)) ? n.allKeys : void 0;
|
|
2045
2093
|
return this._trans("readwrite", function(f) {
|
|
2046
|
-
var
|
|
2047
|
-
if (
|
|
2094
|
+
var w = r.schema.primKey, p = w.auto, w = w.keyPath;
|
|
2095
|
+
if (w && a) throw new z.InvalidArgument("bulkPut(): keys argument invalid on tables with inbound keys");
|
|
2048
2096
|
if (a && a.length !== e.length) throw new z.InvalidArgument("Arguments objects and keys must have the same length");
|
|
2049
|
-
var v = e.length,
|
|
2050
|
-
return r.core.mutate({ trans: f, type: "put", keys: a, values:
|
|
2051
|
-
var g = T.numFailures,
|
|
2052
|
-
if (g === 0) return u ?
|
|
2053
|
-
throw new
|
|
2097
|
+
var v = e.length, w = w && p ? e.map(on(w)) : e;
|
|
2098
|
+
return r.core.mutate({ trans: f, type: "put", keys: a, values: w, wantResults: u }).then(function(T) {
|
|
2099
|
+
var g = T.numFailures, O = T.results, b = T.lastResult, T = T.failures;
|
|
2100
|
+
if (g === 0) return u ? O : b;
|
|
2101
|
+
throw new Me("".concat(r.name, ".bulkPut(): ").concat(g, " of ").concat(v, " operations failed"), T);
|
|
2054
2102
|
});
|
|
2055
2103
|
});
|
|
2056
2104
|
}, he.prototype.bulkUpdate = function(e) {
|
|
@@ -2061,28 +2109,28 @@ function Pi() {
|
|
|
2061
2109
|
}), u = [];
|
|
2062
2110
|
return this._trans("readwrite", function(f) {
|
|
2063
2111
|
return n.getMany({ trans: f, keys: r, cache: "clone" }).then(function(p) {
|
|
2064
|
-
var v = [],
|
|
2065
|
-
e.forEach(function(g,
|
|
2066
|
-
var b = g.key, T = g.changes,
|
|
2067
|
-
if (
|
|
2112
|
+
var v = [], w = [];
|
|
2113
|
+
e.forEach(function(g, O) {
|
|
2114
|
+
var b = g.key, T = g.changes, A = p[O];
|
|
2115
|
+
if (A) {
|
|
2068
2116
|
for (var N = 0, C = Object.keys(T); N < C.length; N++) {
|
|
2069
2117
|
var R = C[N], k = T[R];
|
|
2070
2118
|
if (R === t.schema.primKey.keyPath) {
|
|
2071
2119
|
if (re(k, b) !== 0) throw new z.Constraint("Cannot update primary key in bulkUpdate()");
|
|
2072
|
-
} else le(
|
|
2120
|
+
} else le(A, R, k);
|
|
2073
2121
|
}
|
|
2074
|
-
u.push(
|
|
2122
|
+
u.push(O), v.push(b), w.push(A);
|
|
2075
2123
|
}
|
|
2076
2124
|
});
|
|
2077
2125
|
var x = v.length;
|
|
2078
|
-
return n.mutate({ trans: f, type: "put", keys: v, values:
|
|
2079
|
-
var
|
|
2080
|
-
if (
|
|
2081
|
-
for (var T = 0,
|
|
2082
|
-
var N, C =
|
|
2126
|
+
return n.mutate({ trans: f, type: "put", keys: v, values: w, updates: { keys: r, changeSpecs: a } }).then(function(g) {
|
|
2127
|
+
var O = g.numFailures, b = g.failures;
|
|
2128
|
+
if (O === 0) return x;
|
|
2129
|
+
for (var T = 0, A = Object.keys(b); T < A.length; T++) {
|
|
2130
|
+
var N, C = A[T], R = u[Number(C)];
|
|
2083
2131
|
R != null && (N = b[C], delete b[C], b[R] = N);
|
|
2084
2132
|
}
|
|
2085
|
-
throw new
|
|
2133
|
+
throw new Me("".concat(t.name, ".bulkUpdate(): ").concat(O, " of ").concat(x, " operations failed"), b);
|
|
2086
2134
|
});
|
|
2087
2135
|
});
|
|
2088
2136
|
});
|
|
@@ -2095,7 +2143,7 @@ function Pi() {
|
|
|
2095
2143
|
}).then(function(f) {
|
|
2096
2144
|
var a = f.numFailures, u = f.lastResult, f = f.failures;
|
|
2097
2145
|
if (a === 0) return u;
|
|
2098
|
-
throw new
|
|
2146
|
+
throw new Me("".concat(t.name, ".bulkDelete(): ").concat(a, " of ").concat(n, " operations failed"), f);
|
|
2099
2147
|
});
|
|
2100
2148
|
}, he);
|
|
2101
2149
|
function he() {
|
|
@@ -2103,8 +2151,8 @@ function Pi() {
|
|
|
2103
2151
|
function Bt(e) {
|
|
2104
2152
|
function t(f, p) {
|
|
2105
2153
|
if (p) {
|
|
2106
|
-
for (var v = arguments.length,
|
|
2107
|
-
return n[f].subscribe.apply(null,
|
|
2154
|
+
for (var v = arguments.length, w = new Array(v - 1); --v; ) w[v - 1] = arguments[v];
|
|
2155
|
+
return n[f].subscribe.apply(null, w), e;
|
|
2108
2156
|
}
|
|
2109
2157
|
if (typeof f == "string") return n[f];
|
|
2110
2158
|
}
|
|
@@ -2114,27 +2162,27 @@ function Pi() {
|
|
|
2114
2162
|
return t;
|
|
2115
2163
|
function u(f, p, v) {
|
|
2116
2164
|
if (typeof f != "object") {
|
|
2117
|
-
var
|
|
2165
|
+
var w;
|
|
2118
2166
|
p = p || Re;
|
|
2119
2167
|
var x = { subscribers: [], fire: v = v || c, subscribe: function(g) {
|
|
2120
2168
|
x.subscribers.indexOf(g) === -1 && (x.subscribers.push(g), x.fire = p(x.fire, g));
|
|
2121
2169
|
}, unsubscribe: function(g) {
|
|
2122
|
-
x.subscribers = x.subscribers.filter(function(
|
|
2123
|
-
return
|
|
2170
|
+
x.subscribers = x.subscribers.filter(function(O) {
|
|
2171
|
+
return O !== g;
|
|
2124
2172
|
}), x.fire = x.subscribers.reduce(p, v);
|
|
2125
2173
|
} };
|
|
2126
2174
|
return n[f] = t[f] = x;
|
|
2127
2175
|
}
|
|
2128
|
-
y(
|
|
2129
|
-
var
|
|
2130
|
-
if (
|
|
2176
|
+
y(w = f).forEach(function(g) {
|
|
2177
|
+
var O = w[g];
|
|
2178
|
+
if (_(O)) u(g, w[g][0], w[g][1]);
|
|
2131
2179
|
else {
|
|
2132
|
-
if (
|
|
2180
|
+
if (O !== "asap") throw new z.InvalidArgument("Invalid event config");
|
|
2133
2181
|
var b = u(g, o, function() {
|
|
2134
|
-
for (var T = arguments.length,
|
|
2182
|
+
for (var T = arguments.length, A = new Array(T); T--; ) A[T] = arguments[T];
|
|
2135
2183
|
b.subscribers.forEach(function(N) {
|
|
2136
2184
|
Z(function() {
|
|
2137
|
-
N.apply(null,
|
|
2185
|
+
N.apply(null, A);
|
|
2138
2186
|
});
|
|
2139
2187
|
});
|
|
2140
2188
|
});
|
|
@@ -2142,13 +2190,13 @@ function Pi() {
|
|
|
2142
2190
|
});
|
|
2143
2191
|
}
|
|
2144
2192
|
}
|
|
2145
|
-
function
|
|
2193
|
+
function Mt(e, t) {
|
|
2146
2194
|
return B(t).from({ prototype: e }), t;
|
|
2147
2195
|
}
|
|
2148
|
-
function
|
|
2196
|
+
function Ot(e, t) {
|
|
2149
2197
|
return !(e.filter || e.algorithm || e.or) && (t ? e.justLimit : !e.replayFilter);
|
|
2150
2198
|
}
|
|
2151
|
-
function
|
|
2199
|
+
function jn(e, t) {
|
|
2152
2200
|
e.filter = mt(e.filter, t);
|
|
2153
2201
|
}
|
|
2154
2202
|
function Kn(e, t, n) {
|
|
@@ -2170,13 +2218,13 @@ function Pi() {
|
|
|
2170
2218
|
function cn(e, t, n, r) {
|
|
2171
2219
|
var a = e.replayFilter ? mt(e.filter, e.replayFilter()) : e.filter;
|
|
2172
2220
|
if (e.or) {
|
|
2173
|
-
var u = {}, f = function(p, v,
|
|
2221
|
+
var u = {}, f = function(p, v, w) {
|
|
2174
2222
|
var x, g;
|
|
2175
|
-
a && !a(v,
|
|
2176
|
-
return v.stop(
|
|
2177
|
-
}, function(
|
|
2178
|
-
return v.fail(
|
|
2179
|
-
}) || ((g = "" + (x = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(x)),
|
|
2223
|
+
a && !a(v, w, function(O) {
|
|
2224
|
+
return v.stop(O);
|
|
2225
|
+
}, function(O) {
|
|
2226
|
+
return v.fail(O);
|
|
2227
|
+
}) || ((g = "" + (x = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(x)), G(u, g) || (u[g] = !0, t(p, v, w)));
|
|
2180
2228
|
};
|
|
2181
2229
|
return Promise.all([e.or._iterate(f, n), Ir(Dr(e, r, n), e.algorithm, f, !e.keysOnly && e.valueMapper)]);
|
|
2182
2230
|
}
|
|
@@ -2203,11 +2251,11 @@ function Pi() {
|
|
|
2203
2251
|
});
|
|
2204
2252
|
});
|
|
2205
2253
|
}
|
|
2206
|
-
var
|
|
2254
|
+
var jt = (Rr.prototype.execute = function(e) {
|
|
2207
2255
|
var t = this["@@propmod"];
|
|
2208
2256
|
if (t.add !== void 0) {
|
|
2209
2257
|
var n = t.add;
|
|
2210
|
-
if (
|
|
2258
|
+
if (_(n)) return d(d([], _(e) ? e : [], !0), n).sort();
|
|
2211
2259
|
if (typeof n == "number") return (Number(e) || 0) + n;
|
|
2212
2260
|
if (typeof n == "bigint") try {
|
|
2213
2261
|
return BigInt(e) + n;
|
|
@@ -2218,7 +2266,7 @@ function Pi() {
|
|
|
2218
2266
|
}
|
|
2219
2267
|
if (t.remove !== void 0) {
|
|
2220
2268
|
var r = t.remove;
|
|
2221
|
-
if (
|
|
2269
|
+
if (_(r)) return _(e) ? e.filter(function(a) {
|
|
2222
2270
|
return !r.includes(a);
|
|
2223
2271
|
}).sort() : [];
|
|
2224
2272
|
if (typeof r == "number") return Number(e) - r;
|
|
@@ -2247,7 +2295,7 @@ function Pi() {
|
|
|
2247
2295
|
return cn(this._ctx, e, t, this._ctx.table.core);
|
|
2248
2296
|
}, oe.prototype.clone = function(e) {
|
|
2249
2297
|
var t = Object.create(this.constructor.prototype), n = Object.create(this._ctx);
|
|
2250
|
-
return e &&
|
|
2298
|
+
return e && D(n, e), t._ctx = n, t;
|
|
2251
2299
|
}, oe.prototype.raw = function() {
|
|
2252
2300
|
return this._ctx.valueMapper = null, this;
|
|
2253
2301
|
}, oe.prototype.each = function(e) {
|
|
@@ -2259,7 +2307,7 @@ function Pi() {
|
|
|
2259
2307
|
var t = this;
|
|
2260
2308
|
return this._read(function(n) {
|
|
2261
2309
|
var r = t._ctx, a = r.table.core;
|
|
2262
|
-
if (
|
|
2310
|
+
if (Ot(r, !0)) return a.count({ trans: n, query: { index: un(r, a.schema), range: r.range } }).then(function(f) {
|
|
2263
2311
|
return Math.min(f, r.limit);
|
|
2264
2312
|
});
|
|
2265
2313
|
var u = 0;
|
|
@@ -2271,12 +2319,12 @@ function Pi() {
|
|
|
2271
2319
|
}).then(e);
|
|
2272
2320
|
}, oe.prototype.sortBy = function(e, t) {
|
|
2273
2321
|
var n = e.split(".").reverse(), r = n[0], a = n.length - 1;
|
|
2274
|
-
function u(v,
|
|
2275
|
-
return
|
|
2322
|
+
function u(v, w) {
|
|
2323
|
+
return w ? u(v[n[w]], w - 1) : v[r];
|
|
2276
2324
|
}
|
|
2277
2325
|
var f = this._ctx.dir === "next" ? 1 : -1;
|
|
2278
|
-
function p(v,
|
|
2279
|
-
return re(u(v, a), u(
|
|
2326
|
+
function p(v, w) {
|
|
2327
|
+
return re(u(v, a), u(w, a)) * f;
|
|
2280
2328
|
}
|
|
2281
2329
|
return this.toArray(function(v) {
|
|
2282
2330
|
return v.sort(p);
|
|
@@ -2285,7 +2333,7 @@ function Pi() {
|
|
|
2285
2333
|
var t = this;
|
|
2286
2334
|
return this._read(function(n) {
|
|
2287
2335
|
var r = t._ctx;
|
|
2288
|
-
if (r.dir === "next" &&
|
|
2336
|
+
if (r.dir === "next" && Ot(r, !0) && 0 < r.limit) {
|
|
2289
2337
|
var a = r.valueMapper, u = un(r, r.table.core.schema);
|
|
2290
2338
|
return r.table.core.query({ trans: n, limit: r.limit, values: !0, query: { index: u, range: r.range } }).then(function(p) {
|
|
2291
2339
|
return p = p.result, a ? p.map(a) : p;
|
|
@@ -2300,7 +2348,7 @@ function Pi() {
|
|
|
2300
2348
|
}, e);
|
|
2301
2349
|
}, oe.prototype.offset = function(e) {
|
|
2302
2350
|
var t = this._ctx;
|
|
2303
|
-
return e <= 0 || (t.offset += e,
|
|
2351
|
+
return e <= 0 || (t.offset += e, Ot(t) ? Kn(t, function() {
|
|
2304
2352
|
var n = e;
|
|
2305
2353
|
return function(r, a) {
|
|
2306
2354
|
return n === 0 || (n === 1 ? --n : a(function() {
|
|
@@ -2321,7 +2369,7 @@ function Pi() {
|
|
|
2321
2369
|
};
|
|
2322
2370
|
}, !0), this;
|
|
2323
2371
|
}, oe.prototype.until = function(e, t) {
|
|
2324
|
-
return
|
|
2372
|
+
return jn(this._ctx, function(n, r, a) {
|
|
2325
2373
|
return !e(n.value) || (r(a), t);
|
|
2326
2374
|
}), this;
|
|
2327
2375
|
}, oe.prototype.first = function(e) {
|
|
@@ -2332,7 +2380,7 @@ function Pi() {
|
|
|
2332
2380
|
return this.reverse().first(e);
|
|
2333
2381
|
}, oe.prototype.filter = function(e) {
|
|
2334
2382
|
var t;
|
|
2335
|
-
return
|
|
2383
|
+
return jn(this._ctx, function(n) {
|
|
2336
2384
|
return e(n.value);
|
|
2337
2385
|
}), (t = this._ctx).isMatch = mt(t.isMatch, e), this;
|
|
2338
2386
|
}, oe.prototype.and = function(e) {
|
|
@@ -2366,7 +2414,7 @@ function Pi() {
|
|
|
2366
2414
|
}).then(e);
|
|
2367
2415
|
}, oe.prototype.primaryKeys = function(e) {
|
|
2368
2416
|
var t = this._ctx;
|
|
2369
|
-
if (t.dir === "next" &&
|
|
2417
|
+
if (t.dir === "next" && Ot(t, !0) && 0 < t.limit) return this._read(function(r) {
|
|
2370
2418
|
var a = un(t, t.table.core.schema);
|
|
2371
2419
|
return t.table.core.query({ trans: r, values: !1, limit: t.limit, query: { index: a, range: t.range } });
|
|
2372
2420
|
}).then(function(r) {
|
|
@@ -2391,8 +2439,8 @@ function Pi() {
|
|
|
2391
2439
|
var e = this._ctx, e = e.index && e.table.schema.idxByName[e.index];
|
|
2392
2440
|
if (!e || !e.multi) return this;
|
|
2393
2441
|
var t = {};
|
|
2394
|
-
return
|
|
2395
|
-
var r = a.primaryKey.toString(), a =
|
|
2442
|
+
return jn(this._ctx, function(a) {
|
|
2443
|
+
var r = a.primaryKey.toString(), a = G(t, r);
|
|
2396
2444
|
return t[r] = !0, !a;
|
|
2397
2445
|
}), this;
|
|
2398
2446
|
}, oe.prototype.modify = function(e) {
|
|
@@ -2401,65 +2449,65 @@ function Pi() {
|
|
|
2401
2449
|
var a, u, f;
|
|
2402
2450
|
f = typeof e == "function" ? e : (a = y(e), u = a.length, function(C) {
|
|
2403
2451
|
for (var R = !1, k = 0; k < u; ++k) {
|
|
2404
|
-
var P = a[k],
|
|
2405
|
-
|
|
2452
|
+
var P = a[k], j = e[P], L = de(C, P);
|
|
2453
|
+
j instanceof jt ? (le(C, P, j.execute(L)), R = !0) : L !== j && (le(C, P, j), R = !0);
|
|
2406
2454
|
}
|
|
2407
2455
|
return R;
|
|
2408
2456
|
});
|
|
2409
|
-
var p = n.table.core, g = p.schema.primaryKey, v = g.outbound,
|
|
2457
|
+
var p = n.table.core, g = p.schema.primaryKey, v = g.outbound, w = g.extractKey, x = 200, g = t.db._options.modifyChunkSize;
|
|
2410
2458
|
g && (x = typeof g == "object" ? g[p.name] || g["*"] || 200 : g);
|
|
2411
|
-
function
|
|
2459
|
+
function O(C, P) {
|
|
2412
2460
|
var k = P.failures, P = P.numFailures;
|
|
2413
2461
|
T += C - P;
|
|
2414
|
-
for (var
|
|
2415
|
-
var K = L[
|
|
2462
|
+
for (var j = 0, L = y(k); j < L.length; j++) {
|
|
2463
|
+
var K = L[j];
|
|
2416
2464
|
b.push(k[K]);
|
|
2417
2465
|
}
|
|
2418
2466
|
}
|
|
2419
|
-
var b = [], T = 0,
|
|
2467
|
+
var b = [], T = 0, A = [], N = e === Sr;
|
|
2420
2468
|
return t.clone().primaryKeys().then(function(C) {
|
|
2421
2469
|
function R(P) {
|
|
2422
|
-
var
|
|
2470
|
+
var j = Math.min(x, C.length - P), L = C.slice(P, P + j);
|
|
2423
2471
|
return (N ? Promise.resolve([]) : p.getMany({ trans: r, keys: L, cache: "immutable" })).then(function(K) {
|
|
2424
|
-
var q = [],
|
|
2425
|
-
if (!N) for (var ne = 0; ne <
|
|
2472
|
+
var q = [], V = [], U = v ? [] : null, W = N ? L : [];
|
|
2473
|
+
if (!N) for (var ne = 0; ne < j; ++ne) {
|
|
2426
2474
|
var ae = K[ne], ee = { value: Ye(ae), primKey: C[P + ne] };
|
|
2427
|
-
f.call(ee, ee.value, ee) !== !1 && (ee.value == null ?
|
|
2475
|
+
f.call(ee, ee.value, ee) !== !1 && (ee.value == null ? W.push(C[P + ne]) : v || re(w(ae), w(ee.value)) === 0 ? (V.push(ee.value), v && U.push(C[P + ne])) : (W.push(C[P + ne]), q.push(ee.value)));
|
|
2428
2476
|
}
|
|
2429
2477
|
return Promise.resolve(0 < q.length && p.mutate({ trans: r, type: "add", values: q }).then(function(ve) {
|
|
2430
|
-
for (var J in ve.failures)
|
|
2431
|
-
|
|
2478
|
+
for (var J in ve.failures) W.splice(parseInt(J), 1);
|
|
2479
|
+
O(q.length, ve);
|
|
2432
2480
|
})).then(function() {
|
|
2433
|
-
return (0 <
|
|
2434
|
-
return
|
|
2481
|
+
return (0 < V.length || k && typeof e == "object") && p.mutate({ trans: r, type: "put", keys: U, values: V, criteria: k, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < P }).then(function(ve) {
|
|
2482
|
+
return O(V.length, ve);
|
|
2435
2483
|
});
|
|
2436
2484
|
}).then(function() {
|
|
2437
|
-
return (0 <
|
|
2438
|
-
return sn(n.table,
|
|
2485
|
+
return (0 < W.length || k && N) && p.mutate({ trans: r, type: "delete", keys: W, criteria: k, isAdditionalChunk: 0 < P }).then(function(ve) {
|
|
2486
|
+
return sn(n.table, W, ve);
|
|
2439
2487
|
}).then(function(ve) {
|
|
2440
|
-
return
|
|
2488
|
+
return O(W.length, ve);
|
|
2441
2489
|
});
|
|
2442
2490
|
}).then(function() {
|
|
2443
|
-
return C.length > P +
|
|
2491
|
+
return C.length > P + j && R(P + x);
|
|
2444
2492
|
});
|
|
2445
2493
|
});
|
|
2446
2494
|
}
|
|
2447
|
-
var k =
|
|
2495
|
+
var k = Ot(n) && n.limit === 1 / 0 && (typeof e != "function" || N) && { index: n.index, range: n.range };
|
|
2448
2496
|
return R(0).then(function() {
|
|
2449
|
-
if (0 < b.length) throw new tt("Error modifying one or more objects", b, T,
|
|
2497
|
+
if (0 < b.length) throw new tt("Error modifying one or more objects", b, T, A);
|
|
2450
2498
|
return C.length;
|
|
2451
2499
|
});
|
|
2452
2500
|
});
|
|
2453
2501
|
});
|
|
2454
2502
|
}, oe.prototype.delete = function() {
|
|
2455
2503
|
var e = this._ctx, t = e.range;
|
|
2456
|
-
return !
|
|
2504
|
+
return !Ot(e) || e.table.schema.yProps || !e.isPrimKey && t.type !== 3 ? this.modify(Sr) : this._write(function(n) {
|
|
2457
2505
|
var r = e.table.core.schema.primaryKey, a = t;
|
|
2458
2506
|
return e.table.core.count({ trans: n, query: { index: r, range: a } }).then(function(u) {
|
|
2459
2507
|
return e.table.core.mutate({ trans: n, type: "deleteRange", range: a }).then(function(v) {
|
|
2460
2508
|
var p = v.failures, v = v.numFailures;
|
|
2461
|
-
if (v) throw new tt("Could not delete some values", Object.keys(p).map(function(
|
|
2462
|
-
return p[
|
|
2509
|
+
if (v) throw new tt("Could not delete some values", Object.keys(p).map(function(w) {
|
|
2510
|
+
return p[w];
|
|
2463
2511
|
}), u - v);
|
|
2464
2512
|
return u - v;
|
|
2465
2513
|
});
|
|
@@ -2486,11 +2534,11 @@ function Pi() {
|
|
|
2486
2534
|
}).limit(0);
|
|
2487
2535
|
}
|
|
2488
2536
|
function ln(e, t, n, r) {
|
|
2489
|
-
var a, u, f, p, v,
|
|
2537
|
+
var a, u, f, p, v, w, x, g = n.length;
|
|
2490
2538
|
if (!n.every(function(T) {
|
|
2491
2539
|
return typeof T == "string";
|
|
2492
2540
|
})) return Ke(e, Tr);
|
|
2493
|
-
function
|
|
2541
|
+
function O(T) {
|
|
2494
2542
|
a = T === "next" ? function(N) {
|
|
2495
2543
|
return N.toUpperCase();
|
|
2496
2544
|
} : function(N) {
|
|
@@ -2500,40 +2548,40 @@ function Pi() {
|
|
|
2500
2548
|
} : function(N) {
|
|
2501
2549
|
return N.toUpperCase();
|
|
2502
2550
|
}, f = T === "next" ? Pa : Fa;
|
|
2503
|
-
var
|
|
2551
|
+
var A = n.map(function(N) {
|
|
2504
2552
|
return { lower: u(N), upper: a(N) };
|
|
2505
2553
|
}).sort(function(N, C) {
|
|
2506
2554
|
return f(N.lower, C.lower);
|
|
2507
2555
|
});
|
|
2508
|
-
p =
|
|
2556
|
+
p = A.map(function(N) {
|
|
2509
2557
|
return N.upper;
|
|
2510
|
-
}), v =
|
|
2558
|
+
}), v = A.map(function(N) {
|
|
2511
2559
|
return N.lower;
|
|
2512
|
-
}), x = (
|
|
2560
|
+
}), x = (w = T) === "next" ? "" : r;
|
|
2513
2561
|
}
|
|
2514
|
-
|
|
2562
|
+
O("next"), e = new e.Collection(e, function() {
|
|
2515
2563
|
return st(p[0], v[g - 1] + r);
|
|
2516
2564
|
}), e._ondirectionchange = function(T) {
|
|
2517
|
-
|
|
2565
|
+
O(T);
|
|
2518
2566
|
};
|
|
2519
2567
|
var b = 0;
|
|
2520
|
-
return e._addAlgorithm(function(T,
|
|
2568
|
+
return e._addAlgorithm(function(T, A, N) {
|
|
2521
2569
|
var C = T.key;
|
|
2522
2570
|
if (typeof C != "string") return !1;
|
|
2523
2571
|
var R = u(C);
|
|
2524
2572
|
if (t(R, v, b)) return !0;
|
|
2525
2573
|
for (var k = null, P = b; P < g; ++P) {
|
|
2526
|
-
var
|
|
2527
|
-
for (var ne = Math.min(L.length,
|
|
2574
|
+
var j = (function(L, K, q, V, U, W) {
|
|
2575
|
+
for (var ne = Math.min(L.length, V.length), ae = -1, ee = 0; ee < ne; ++ee) {
|
|
2528
2576
|
var ve = K[ee];
|
|
2529
|
-
if (ve !==
|
|
2577
|
+
if (ve !== V[ee]) return U(L[ee], q[ee]) < 0 ? L.substr(0, ee) + q[ee] + q.substr(ee + 1) : U(L[ee], V[ee]) < 0 ? L.substr(0, ee) + V[ee] + q.substr(ee + 1) : 0 <= ae ? L.substr(0, ae) + K[ae] + q.substr(ae + 1) : null;
|
|
2530
2578
|
U(L[ee], ve) < 0 && (ae = ee);
|
|
2531
2579
|
}
|
|
2532
|
-
return ne <
|
|
2533
|
-
})(C, R, p[P], v[P], f,
|
|
2534
|
-
|
|
2580
|
+
return ne < V.length && W === "next" ? L + q.substr(L.length) : ne < L.length && W === "prev" ? L.substr(0, q.length) : ae < 0 ? null : L.substr(0, ae) + V[ae] + q.substr(ae + 1);
|
|
2581
|
+
})(C, R, p[P], v[P], f, w);
|
|
2582
|
+
j === null && k === null ? b = P + 1 : (k === null || 0 < f(k, j)) && (k = j);
|
|
2535
2583
|
}
|
|
2536
|
-
return
|
|
2584
|
+
return A(k !== null ? function() {
|
|
2537
2585
|
T.continue(k + x);
|
|
2538
2586
|
} : N), !1;
|
|
2539
2587
|
}), e;
|
|
@@ -2638,40 +2686,40 @@ function Pi() {
|
|
|
2638
2686
|
if (!C.every(function(R) {
|
|
2639
2687
|
return R[0] !== void 0 && R[1] !== void 0 && a(R[0], R[1]) <= 0;
|
|
2640
2688
|
})) return Ke(this, "First argument to inAnyRange() must be an Array of two-value Arrays [lower,upper] where upper must not be lower than lower", z.InvalidArgument);
|
|
2641
|
-
var v = !t || t.includeLowers !== !1,
|
|
2642
|
-
function
|
|
2689
|
+
var v = !t || t.includeLowers !== !1, w = t && t.includeUppers === !0, x, g = a;
|
|
2690
|
+
function O(R, k) {
|
|
2643
2691
|
return g(R[0], k[0]);
|
|
2644
2692
|
}
|
|
2645
2693
|
try {
|
|
2646
2694
|
(x = C.reduce(function(R, k) {
|
|
2647
|
-
for (var P = 0,
|
|
2695
|
+
for (var P = 0, j = R.length; P < j; ++P) {
|
|
2648
2696
|
var L = R[P];
|
|
2649
2697
|
if (r(k[0], L[1]) < 0 && 0 < r(k[1], L[0])) {
|
|
2650
2698
|
L[0] = f(L[0], k[0]), L[1] = p(L[1], k[1]);
|
|
2651
2699
|
break;
|
|
2652
2700
|
}
|
|
2653
2701
|
}
|
|
2654
|
-
return P ===
|
|
2655
|
-
}, [])).sort(
|
|
2702
|
+
return P === j && R.push(k), R;
|
|
2703
|
+
}, [])).sort(O);
|
|
2656
2704
|
} catch {
|
|
2657
2705
|
return Ke(this, Qe);
|
|
2658
2706
|
}
|
|
2659
|
-
var b = 0, T =
|
|
2707
|
+
var b = 0, T = w ? function(R) {
|
|
2660
2708
|
return 0 < a(R, x[b][1]);
|
|
2661
2709
|
} : function(R) {
|
|
2662
2710
|
return 0 <= a(R, x[b][1]);
|
|
2663
|
-
},
|
|
2711
|
+
}, A = v ? function(R) {
|
|
2664
2712
|
return 0 < u(R, x[b][0]);
|
|
2665
2713
|
} : function(R) {
|
|
2666
2714
|
return 0 <= u(R, x[b][0]);
|
|
2667
2715
|
}, N = T, C = new this.Collection(this, function() {
|
|
2668
|
-
return st(x[0][0], x[x.length - 1][1], !v, !
|
|
2716
|
+
return st(x[0][0], x[x.length - 1][1], !v, !w);
|
|
2669
2717
|
});
|
|
2670
2718
|
return C._ondirectionchange = function(R) {
|
|
2671
|
-
g = R === "next" ? (N = T, a) : (N =
|
|
2719
|
+
g = R === "next" ? (N = T, a) : (N = A, u), x.sort(O);
|
|
2672
2720
|
}, C._addAlgorithm(function(R, k, P) {
|
|
2673
|
-
for (var
|
|
2674
|
-
return !T(
|
|
2721
|
+
for (var j, L = R.key; N(L); ) if (++b === x.length) return k(P), !1;
|
|
2722
|
+
return !T(j = L) && !A(j) || (n._cmp(L, x[b][1]) === 0 || n._cmp(L, x[b][0]) === 0 || k(function() {
|
|
2675
2723
|
g === a ? R.continue(x[b][0]) : R.continue(x[b][1]);
|
|
2676
2724
|
}), !1);
|
|
2677
2725
|
}), C;
|
|
@@ -2774,7 +2822,7 @@ function Pi() {
|
|
|
2774
2822
|
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new z.Abort()));
|
|
2775
2823
|
}, We.prototype.table = function(e) {
|
|
2776
2824
|
var t = this._memoizedTables || (this._memoizedTables = {});
|
|
2777
|
-
if (
|
|
2825
|
+
if (G(t, e)) return t[e];
|
|
2778
2826
|
var n = this.schema[e];
|
|
2779
2827
|
if (!n) throw new z.NotFound("Table " + e + " not part of transaction");
|
|
2780
2828
|
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
@@ -2820,44 +2868,44 @@ function Pi() {
|
|
|
2820
2868
|
function Br(e) {
|
|
2821
2869
|
return [].slice.call(e);
|
|
2822
2870
|
}
|
|
2823
|
-
var
|
|
2871
|
+
var Ma = 0;
|
|
2824
2872
|
function Ut(e) {
|
|
2825
2873
|
return e == null ? ":id" : typeof e == "string" ? e : "[".concat(e.join("+"), "]");
|
|
2826
2874
|
}
|
|
2827
|
-
function
|
|
2875
|
+
function ja(e, t, v) {
|
|
2828
2876
|
function r(N) {
|
|
2829
2877
|
if (N.type === 3) return null;
|
|
2830
2878
|
if (N.type === 4) throw new Error("Cannot convert never type to IDBKeyRange");
|
|
2831
|
-
var b = N.lower, T = N.upper,
|
|
2832
|
-
return b === void 0 ? T === void 0 ? null : t.upperBound(T, !!N) : T === void 0 ? t.lowerBound(b, !!
|
|
2879
|
+
var b = N.lower, T = N.upper, A = N.lowerOpen, N = N.upperOpen;
|
|
2880
|
+
return b === void 0 ? T === void 0 ? null : t.upperBound(T, !!N) : T === void 0 ? t.lowerBound(b, !!A) : t.bound(b, T, !!A, !!N);
|
|
2833
2881
|
}
|
|
2834
|
-
function a(
|
|
2835
|
-
var b, T =
|
|
2836
|
-
return { name: T, schema:
|
|
2837
|
-
var N =
|
|
2838
|
-
return new Promise(function(
|
|
2839
|
-
|
|
2840
|
-
var K = N.objectStore(T), q = K.keyPath == null,
|
|
2841
|
-
if (!
|
|
2842
|
-
var U,
|
|
2882
|
+
function a(O) {
|
|
2883
|
+
var b, T = O.name;
|
|
2884
|
+
return { name: T, schema: O, mutate: function(A) {
|
|
2885
|
+
var N = A.trans, C = A.type, R = A.keys, k = A.values, P = A.range;
|
|
2886
|
+
return new Promise(function(j, L) {
|
|
2887
|
+
j = pe(j);
|
|
2888
|
+
var K = N.objectStore(T), q = K.keyPath == null, V = C === "put" || C === "add";
|
|
2889
|
+
if (!V && C !== "delete" && C !== "deleteRange") throw new Error("Invalid operation type: " + C);
|
|
2890
|
+
var U, W = (R || k || { length: 1 }).length;
|
|
2843
2891
|
if (R && k && R.length !== k.length) throw new Error("Given keys array must have same length as given values array.");
|
|
2844
|
-
if (
|
|
2892
|
+
if (W === 0) return j({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
2845
2893
|
function ne(Be) {
|
|
2846
2894
|
++ve, Kt(Be);
|
|
2847
2895
|
}
|
|
2848
2896
|
var ae = [], ee = [], ve = 0;
|
|
2849
2897
|
if (C === "deleteRange") {
|
|
2850
|
-
if (P.type === 4) return
|
|
2898
|
+
if (P.type === 4) return j({ numFailures: ve, failures: ee, results: [], lastResult: void 0 });
|
|
2851
2899
|
P.type === 3 ? ae.push(U = K.clear()) : ae.push(U = K.delete(r(P)));
|
|
2852
2900
|
} else {
|
|
2853
|
-
var q =
|
|
2854
|
-
if (
|
|
2855
|
-
else for (Pe = 0; Pe <
|
|
2901
|
+
var q = V ? q ? [k, R] : [k, null] : [R, null], J = q[0], ke = q[1];
|
|
2902
|
+
if (V) for (var Pe = 0; Pe < W; ++Pe) ae.push(U = ke && ke[Pe] !== void 0 ? K[C](J[Pe], ke[Pe]) : K[C](J[Pe])), U.onerror = ne;
|
|
2903
|
+
else for (Pe = 0; Pe < W; ++Pe) ae.push(U = K[C](J[Pe])), U.onerror = ne;
|
|
2856
2904
|
}
|
|
2857
2905
|
function En(Be) {
|
|
2858
2906
|
Be = Be.target.result, ae.forEach(function(vt, sr) {
|
|
2859
2907
|
return vt.error != null && (ee[sr] = vt.error);
|
|
2860
|
-
}),
|
|
2908
|
+
}), j({ numFailures: ve, failures: ee, results: C === "delete" ? R : ae.map(function(vt) {
|
|
2861
2909
|
return vt.result;
|
|
2862
2910
|
}), lastResult: Be });
|
|
2863
2911
|
}
|
|
@@ -2865,44 +2913,44 @@ function Pi() {
|
|
|
2865
2913
|
ne(Be), En(Be);
|
|
2866
2914
|
}, U.onsuccess = En;
|
|
2867
2915
|
});
|
|
2868
|
-
}, getMany: function(
|
|
2869
|
-
var N =
|
|
2916
|
+
}, getMany: function(A) {
|
|
2917
|
+
var N = A.trans, C = A.keys;
|
|
2870
2918
|
return new Promise(function(R, k) {
|
|
2871
2919
|
R = pe(R);
|
|
2872
|
-
for (var P,
|
|
2873
|
-
ae = ae.target, K[ae._pos] = ae.result, ++
|
|
2874
|
-
},
|
|
2920
|
+
for (var P, j = N.objectStore(T), L = C.length, K = new Array(L), q = 0, V = 0, U = function(ae) {
|
|
2921
|
+
ae = ae.target, K[ae._pos] = ae.result, ++V === q && R(K);
|
|
2922
|
+
}, W = $e(k), ne = 0; ne < L; ++ne) C[ne] != null && ((P = j.get(C[ne]))._pos = ne, P.onsuccess = U, P.onerror = W, ++q);
|
|
2875
2923
|
q === 0 && R(K);
|
|
2876
2924
|
});
|
|
2877
|
-
}, get: function(
|
|
2878
|
-
var N =
|
|
2925
|
+
}, get: function(A) {
|
|
2926
|
+
var N = A.trans, C = A.key;
|
|
2879
2927
|
return new Promise(function(R, k) {
|
|
2880
2928
|
R = pe(R);
|
|
2881
2929
|
var P = N.objectStore(T).get(C);
|
|
2882
|
-
P.onsuccess = function(
|
|
2883
|
-
return R(
|
|
2930
|
+
P.onsuccess = function(j) {
|
|
2931
|
+
return R(j.target.result);
|
|
2884
2932
|
}, P.onerror = $e(k);
|
|
2885
2933
|
});
|
|
2886
|
-
}, query: (b =
|
|
2934
|
+
}, query: (b = w, function(A) {
|
|
2887
2935
|
return new Promise(function(N, C) {
|
|
2888
2936
|
N = pe(N);
|
|
2889
|
-
var R, k, P, q =
|
|
2937
|
+
var R, k, P, q = A.trans, j = A.values, L = A.limit, U = A.query, K = L === 1 / 0 ? void 0 : L, V = U.index, U = U.range, q = q.objectStore(T), V = V.isPrimaryKey ? q : q.index(V.name), U = r(U);
|
|
2890
2938
|
if (L === 0) return N({ result: [] });
|
|
2891
|
-
b ? ((K =
|
|
2892
|
-
return N({ result:
|
|
2893
|
-
}, K.onerror = $e(C)) : (R = 0, k = !
|
|
2939
|
+
b ? ((K = j ? V.getAll(U, K) : V.getAllKeys(U, K)).onsuccess = function(W) {
|
|
2940
|
+
return N({ result: W.target.result });
|
|
2941
|
+
}, K.onerror = $e(C)) : (R = 0, k = !j && "openKeyCursor" in V ? V.openKeyCursor(U) : V.openCursor(U), P = [], k.onsuccess = function(W) {
|
|
2894
2942
|
var ne = k.result;
|
|
2895
|
-
return ne ? (P.push(
|
|
2943
|
+
return ne ? (P.push(j ? ne.value : ne.primaryKey), ++R === L ? N({ result: P }) : void ne.continue()) : N({ result: P });
|
|
2896
2944
|
}, k.onerror = $e(C));
|
|
2897
2945
|
});
|
|
2898
|
-
}), openCursor: function(
|
|
2899
|
-
var N =
|
|
2900
|
-
return new Promise(function(
|
|
2901
|
-
|
|
2902
|
-
var
|
|
2903
|
-
U.onerror = $e(L), U.onsuccess = pe(function(
|
|
2946
|
+
}), openCursor: function(A) {
|
|
2947
|
+
var N = A.trans, C = A.values, R = A.query, k = A.reverse, P = A.unique;
|
|
2948
|
+
return new Promise(function(j, L) {
|
|
2949
|
+
j = pe(j);
|
|
2950
|
+
var V = R.index, K = R.range, q = N.objectStore(T), q = V.isPrimaryKey ? q : q.index(V.name), V = k ? P ? "prevunique" : "prev" : P ? "nextunique" : "next", U = !C && "openKeyCursor" in q ? q.openKeyCursor(r(K), V) : q.openCursor(r(K), V);
|
|
2951
|
+
U.onerror = $e(L), U.onsuccess = pe(function(W) {
|
|
2904
2952
|
var ne, ae, ee, ve, J = U.result;
|
|
2905
|
-
J ? (J.___id = ++
|
|
2953
|
+
J ? (J.___id = ++Ma, J.done = !1, ne = J.continue.bind(J), ae = (ae = J.continuePrimaryKey) && ae.bind(J), ee = J.advance.bind(J), ve = function() {
|
|
2906
2954
|
throw new Error("Cursor not stopped");
|
|
2907
2955
|
}, J.trans = N, J.stop = J.continue = J.continuePrimaryKey = J.advance = function() {
|
|
2908
2956
|
throw new Error("Cursor not started");
|
|
@@ -2932,42 +2980,42 @@ function Pi() {
|
|
|
2932
2980
|
return U.onsuccess = pe(function(Be) {
|
|
2933
2981
|
U.onsuccess = Pe, Pe();
|
|
2934
2982
|
}), J.continue = ne, J.continuePrimaryKey = ae, J.advance = ee, Pe(), En;
|
|
2935
|
-
},
|
|
2983
|
+
}, j(J)) : j(null);
|
|
2936
2984
|
}, L);
|
|
2937
2985
|
});
|
|
2938
|
-
}, count: function(
|
|
2939
|
-
var N =
|
|
2940
|
-
return new Promise(function(P,
|
|
2986
|
+
}, count: function(A) {
|
|
2987
|
+
var N = A.query, C = A.trans, R = N.index, k = N.range;
|
|
2988
|
+
return new Promise(function(P, j) {
|
|
2941
2989
|
var L = C.objectStore(T), K = R.isPrimaryKey ? L : L.index(R.name), L = r(k), K = L ? K.count(L) : K.count();
|
|
2942
2990
|
K.onsuccess = pe(function(q) {
|
|
2943
2991
|
return P(q.target.result);
|
|
2944
|
-
}), K.onerror = $e(
|
|
2992
|
+
}), K.onerror = $e(j);
|
|
2945
2993
|
});
|
|
2946
2994
|
} };
|
|
2947
2995
|
}
|
|
2948
|
-
var u, f, p, x = (f = v, p = Br((u = e).objectStoreNames), { schema: { name: u.name, tables: p.map(function(
|
|
2949
|
-
return f.objectStore(
|
|
2950
|
-
}).map(function(
|
|
2951
|
-
var b =
|
|
2952
|
-
return
|
|
2996
|
+
var u, f, p, x = (f = v, p = Br((u = e).objectStoreNames), { schema: { name: u.name, tables: p.map(function(O) {
|
|
2997
|
+
return f.objectStore(O);
|
|
2998
|
+
}).map(function(O) {
|
|
2999
|
+
var b = O.keyPath, N = O.autoIncrement, T = _(b), A = {}, N = { name: O.name, primaryKey: { name: null, isPrimaryKey: !0, outbound: b == null, compound: T, keyPath: b, autoIncrement: N, unique: !0, extractKey: Vn(b) }, indexes: Br(O.indexNames).map(function(C) {
|
|
3000
|
+
return O.index(C);
|
|
2953
3001
|
}).map(function(P) {
|
|
2954
|
-
var R = P.name, k = P.unique,
|
|
2955
|
-
return
|
|
3002
|
+
var R = P.name, k = P.unique, j = P.multiEntry, P = P.keyPath, j = { name: R, compound: _(P), keyPath: P, unique: k, multiEntry: j, extractKey: Vn(P) };
|
|
3003
|
+
return A[Ut(P)] = j;
|
|
2956
3004
|
}), getIndexByKeyPath: function(C) {
|
|
2957
|
-
return
|
|
3005
|
+
return A[Ut(C)];
|
|
2958
3006
|
} };
|
|
2959
|
-
return
|
|
2960
|
-
}) }, hasGetAll: 0 < p.length && "getAll" in f.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = x.schema,
|
|
2961
|
-
return x.forEach(function(
|
|
2962
|
-
return g[
|
|
2963
|
-
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(
|
|
2964
|
-
if (!g[
|
|
2965
|
-
return g[
|
|
3007
|
+
return A[":id"] = N.primaryKey, b != null && (A[Ut(b)] = N.primaryKey), N;
|
|
3008
|
+
}) }, hasGetAll: 0 < p.length && "getAll" in f.objectStore(p[0]) && !(typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604) }), v = x.schema, w = x.hasGetAll, x = v.tables.map(a), g = {};
|
|
3009
|
+
return x.forEach(function(O) {
|
|
3010
|
+
return g[O.name] = O;
|
|
3011
|
+
}), { stack: "dbcore", transaction: e.transaction.bind(e), table: function(O) {
|
|
3012
|
+
if (!g[O]) throw new Error("Table '".concat(O, "' not found"));
|
|
3013
|
+
return g[O];
|
|
2966
3014
|
}, MIN_KEY: -1 / 0, MAX_KEY: Lt(t), schema: v };
|
|
2967
3015
|
}
|
|
2968
3016
|
function Ka(e, t, n, r) {
|
|
2969
3017
|
var a = n.IDBKeyRange;
|
|
2970
|
-
return n.indexedDB, { dbcore: (r =
|
|
3018
|
+
return n.indexedDB, { dbcore: (r = ja(t, a, r), e.dbcore.reduce(function(u, f) {
|
|
2971
3019
|
return f = f.create, i(i({}, u), f(u));
|
|
2972
3020
|
}, r)) };
|
|
2973
3021
|
}
|
|
@@ -2984,10 +3032,10 @@ function Pi() {
|
|
|
2984
3032
|
n.forEach(function(a) {
|
|
2985
3033
|
var u = r[a];
|
|
2986
3034
|
t.forEach(function(f) {
|
|
2987
|
-
var p = (function v(
|
|
2988
|
-
return ue(
|
|
3035
|
+
var p = (function v(w, x) {
|
|
3036
|
+
return ue(w, x) || (w = F(w)) && v(w, x);
|
|
2989
3037
|
})(f, a);
|
|
2990
|
-
(!p || "value" in p && p.value === void 0) && (f === e.Transaction.prototype || f instanceof e.Transaction ?
|
|
3038
|
+
(!p || "value" in p && p.value === void 0) && (f === e.Transaction.prototype || f instanceof e.Transaction ? M(f, a, { get: function() {
|
|
2991
3039
|
return this.table(a);
|
|
2992
3040
|
}, set: function(v) {
|
|
2993
3041
|
fe(this, a, { value: v, writable: !0, configurable: !0, enumerable: !0 });
|
|
@@ -3005,75 +3053,75 @@ function Pi() {
|
|
|
3005
3053
|
}
|
|
3006
3054
|
function La(e, t, n, r) {
|
|
3007
3055
|
var a = e._dbSchema;
|
|
3008
|
-
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Un("$meta",
|
|
3056
|
+
n.objectStoreNames.contains("$meta") && !a.$meta && (a.$meta = Un("$meta", jr("")[0], []), e._storeNames.push("$meta"));
|
|
3009
3057
|
var u = e._createTransaction("readwrite", e._storeNames, a);
|
|
3010
3058
|
u.create(n), u._completion.catch(r);
|
|
3011
3059
|
var f = u._reject.bind(u), p = Y.transless || Y;
|
|
3012
3060
|
at(function() {
|
|
3013
|
-
return Y.trans = u, Y.transless = p, t !== 0 ? (fn(e, n),
|
|
3014
|
-
return x ??
|
|
3015
|
-
}) : X.resolve(
|
|
3016
|
-
return
|
|
3017
|
-
return C._cfg.version >=
|
|
3061
|
+
return Y.trans = u, Y.transless = p, t !== 0 ? (fn(e, n), w = t, ((v = u).storeNames.includes("$meta") ? v.table("$meta").get("version").then(function(x) {
|
|
3062
|
+
return x ?? w;
|
|
3063
|
+
}) : X.resolve(w)).then(function(x) {
|
|
3064
|
+
return O = x, b = u, T = n, A = [], x = (g = e)._versions, N = g._dbSchema = pn(0, g.idbdb, T), (x = x.filter(function(C) {
|
|
3065
|
+
return C._cfg.version >= O;
|
|
3018
3066
|
})).length !== 0 ? (x.forEach(function(C) {
|
|
3019
|
-
|
|
3067
|
+
A.push(function() {
|
|
3020
3068
|
var R = N, k = C._cfg.dbschema;
|
|
3021
3069
|
mn(g, R, T), mn(g, k, T), N = g._dbSchema = k;
|
|
3022
3070
|
var P = Xn(R, k);
|
|
3023
|
-
P.add.forEach(function(
|
|
3024
|
-
$n(T,
|
|
3025
|
-
}), P.change.forEach(function(
|
|
3026
|
-
if (
|
|
3027
|
-
var U = T.objectStore(
|
|
3028
|
-
|
|
3029
|
-
return hn(U,
|
|
3030
|
-
}),
|
|
3031
|
-
U.deleteIndex(
|
|
3032
|
-
}),
|
|
3033
|
-
return U.deleteIndex(
|
|
3071
|
+
P.add.forEach(function(V) {
|
|
3072
|
+
$n(T, V[0], V[1].primKey, V[1].indexes);
|
|
3073
|
+
}), P.change.forEach(function(V) {
|
|
3074
|
+
if (V.recreate) throw new z.Upgrade("Not yet support for changing primary key");
|
|
3075
|
+
var U = T.objectStore(V.name);
|
|
3076
|
+
V.add.forEach(function(W) {
|
|
3077
|
+
return hn(U, W);
|
|
3078
|
+
}), V.change.forEach(function(W) {
|
|
3079
|
+
U.deleteIndex(W.name), hn(U, W);
|
|
3080
|
+
}), V.del.forEach(function(W) {
|
|
3081
|
+
return U.deleteIndex(W);
|
|
3034
3082
|
});
|
|
3035
3083
|
});
|
|
3036
|
-
var
|
|
3037
|
-
if (
|
|
3084
|
+
var j = C._cfg.contentUpgrade;
|
|
3085
|
+
if (j && C._cfg.version > O) {
|
|
3038
3086
|
fn(g, T), b._memoizedTables = {};
|
|
3039
3087
|
var L = me(k);
|
|
3040
|
-
P.del.forEach(function(
|
|
3041
|
-
L[
|
|
3088
|
+
P.del.forEach(function(V) {
|
|
3089
|
+
L[V] = R[V];
|
|
3042
3090
|
}), Gn(g, [g.Transaction.prototype]), dn(g, [g.Transaction.prototype], y(L), L), b.schema = L;
|
|
3043
|
-
var K, q = bt(
|
|
3091
|
+
var K, q = bt(j);
|
|
3044
3092
|
return q && Nt(), P = X.follow(function() {
|
|
3045
|
-
var
|
|
3046
|
-
(K =
|
|
3093
|
+
var V;
|
|
3094
|
+
(K = j(b)) && q && (V = it.bind(null, null), K.then(V, V));
|
|
3047
3095
|
}), K && typeof K.then == "function" ? X.resolve(K) : P.then(function() {
|
|
3048
3096
|
return K;
|
|
3049
3097
|
});
|
|
3050
3098
|
}
|
|
3051
|
-
}),
|
|
3052
|
-
var k, P,
|
|
3053
|
-
k =
|
|
3099
|
+
}), A.push(function(R) {
|
|
3100
|
+
var k, P, j = C._cfg.dbschema;
|
|
3101
|
+
k = j, P = R, [].slice.call(P.db.objectStoreNames).forEach(function(L) {
|
|
3054
3102
|
return k[L] == null && P.db.deleteObjectStore(L);
|
|
3055
3103
|
}), Gn(g, [g.Transaction.prototype]), dn(g, [g.Transaction.prototype], g._storeNames, g._dbSchema), b.schema = g._dbSchema;
|
|
3056
|
-
}),
|
|
3104
|
+
}), A.push(function(R) {
|
|
3057
3105
|
g.idbdb.objectStoreNames.contains("$meta") && (Math.ceil(g.idbdb.version / 10) === C._cfg.version ? (g.idbdb.deleteObjectStore("$meta"), delete g._dbSchema.$meta, g._storeNames = g._storeNames.filter(function(k) {
|
|
3058
3106
|
return k !== "$meta";
|
|
3059
3107
|
})) : R.objectStore("$meta").put(C._cfg.version, "version"));
|
|
3060
3108
|
});
|
|
3061
3109
|
}), (function C() {
|
|
3062
|
-
return
|
|
3110
|
+
return A.length ? X.resolve(A.shift()(b.idbtrans)).then(C) : X.resolve();
|
|
3063
3111
|
})().then(function() {
|
|
3064
|
-
|
|
3112
|
+
Mr(N, T);
|
|
3065
3113
|
})) : X.resolve();
|
|
3066
|
-
var g,
|
|
3114
|
+
var g, O, b, T, A, N;
|
|
3067
3115
|
}).catch(f)) : (y(a).forEach(function(x) {
|
|
3068
3116
|
$n(n, x, a[x].primKey, a[x].indexes);
|
|
3069
3117
|
}), fn(e, n), void X.follow(function() {
|
|
3070
3118
|
return e.on.populate.fire(u);
|
|
3071
3119
|
}).catch(f));
|
|
3072
|
-
var v,
|
|
3120
|
+
var v, w;
|
|
3073
3121
|
});
|
|
3074
3122
|
}
|
|
3075
3123
|
function Ua(e, t) {
|
|
3076
|
-
|
|
3124
|
+
Mr(e._dbSchema, t), t.db.version % 10 != 0 || t.objectStoreNames.contains("$meta") || t.db.createObjectStore("$meta").add(Math.ceil(t.db.version / 10 - 1), "version");
|
|
3077
3125
|
var n = pn(0, e.idbdb, t);
|
|
3078
3126
|
mn(e, e._dbSchema, t);
|
|
3079
3127
|
for (var r = 0, a = Xn(n, e._dbSchema).change; r < a.length; r++) {
|
|
@@ -3096,10 +3144,10 @@ function Pi() {
|
|
|
3096
3144
|
var f = { name: n, def: u, recreate: !1, del: [], add: [], change: [] };
|
|
3097
3145
|
if ("" + (a.primKey.keyPath || "") != "" + (u.primKey.keyPath || "") || a.primKey.auto !== u.primKey.auto) f.recreate = !0, r.change.push(f);
|
|
3098
3146
|
else {
|
|
3099
|
-
var p = a.idxByName, v = u.idxByName,
|
|
3100
|
-
for (
|
|
3101
|
-
for (
|
|
3102
|
-
var x = p[
|
|
3147
|
+
var p = a.idxByName, v = u.idxByName, w = void 0;
|
|
3148
|
+
for (w in p) v[w] || f.del.push(w);
|
|
3149
|
+
for (w in v) {
|
|
3150
|
+
var x = p[w], g = v[w];
|
|
3103
3151
|
x ? x.src !== g.src && f.change.push(g) : f.add.push(g);
|
|
3104
3152
|
}
|
|
3105
3153
|
(0 < f.del.length || 0 < f.add.length || 0 < f.change.length) && r.change.push(f);
|
|
@@ -3114,7 +3162,7 @@ function Pi() {
|
|
|
3114
3162
|
return hn(a, u);
|
|
3115
3163
|
}), a;
|
|
3116
3164
|
}
|
|
3117
|
-
function
|
|
3165
|
+
function Mr(e, t) {
|
|
3118
3166
|
y(e).forEach(function(n) {
|
|
3119
3167
|
t.db.objectStoreNames.contains(n) || (Ne && console.debug("Dexie: Creating missing table", n), $n(t, n, e[n].primKey, e[n].indexes));
|
|
3120
3168
|
});
|
|
@@ -3125,8 +3173,8 @@ function Pi() {
|
|
|
3125
3173
|
function pn(e, t, n) {
|
|
3126
3174
|
var r = {};
|
|
3127
3175
|
return xe(t.objectStoreNames, 0).forEach(function(a) {
|
|
3128
|
-
for (var u = n.objectStore(a), f = Ln(Fr(
|
|
3129
|
-
var x = u.index(u.indexNames[v]),
|
|
3176
|
+
for (var u = n.objectStore(a), f = Ln(Fr(w = u.keyPath), w || "", !0, !1, !!u.autoIncrement, w && typeof w != "string", !0), p = [], v = 0; v < u.indexNames.length; ++v) {
|
|
3177
|
+
var x = u.index(u.indexNames[v]), w = x.keyPath, x = Ln(x.name, w, !!x.unique, !!x.multiEntry, !1, w && typeof w != "string", !1);
|
|
3130
3178
|
p.push(x);
|
|
3131
3179
|
}
|
|
3132
3180
|
r[a] = Un(a, f, p);
|
|
@@ -3137,19 +3185,19 @@ function Pi() {
|
|
|
3137
3185
|
var u = r[a], f = n.objectStore(u);
|
|
3138
3186
|
e._hasGetAll = "getAll" in f;
|
|
3139
3187
|
for (var p = 0; p < f.indexNames.length; ++p) {
|
|
3140
|
-
var v = f.indexNames[p],
|
|
3141
|
-
!t[u] || (
|
|
3188
|
+
var v = f.indexNames[p], w = f.index(v).keyPath, x = typeof w == "string" ? w : "[" + xe(w).join("+") + "]";
|
|
3189
|
+
!t[u] || (w = t[u].idxByName[x]) && (w.name = v, delete t[u].idxByName[x], t[u].idxByName[v] = w);
|
|
3142
3190
|
}
|
|
3143
3191
|
}
|
|
3144
3192
|
typeof navigator < "u" && /Safari/.test(navigator.userAgent) && !/(Chrome\/|Edge\/)/.test(navigator.userAgent) && h.WorkerGlobalScope && h instanceof h.WorkerGlobalScope && [].concat(navigator.userAgent.match(/Safari\/(\d*)/))[1] < 604 && (e._hasGetAll = !1);
|
|
3145
3193
|
}
|
|
3146
|
-
function
|
|
3194
|
+
function jr(e) {
|
|
3147
3195
|
return e.split(",").map(function(t, n) {
|
|
3148
3196
|
var u = t.split(":"), r = (a = u[1]) === null || a === void 0 ? void 0 : a.trim(), a = (t = u[0].trim()).replace(/([&*]|\+\+)/g, ""), u = /^\[/.test(a) ? a.match(/^\[(.*)\]$/)[1].split("+") : a;
|
|
3149
|
-
return Ln(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t),
|
|
3197
|
+
return Ln(a, u || null, /\&/.test(t), /\*/.test(t), /\+\+/.test(t), _(u), n === 0, r);
|
|
3150
3198
|
});
|
|
3151
3199
|
}
|
|
3152
|
-
var Va = (Dt.prototype._createTableSchema = Un, Dt.prototype._parseIndexSyntax =
|
|
3200
|
+
var Va = (Dt.prototype._createTableSchema = Un, Dt.prototype._parseIndexSyntax = jr, Dt.prototype._parseStoresSpec = function(e, t) {
|
|
3153
3201
|
var n = this;
|
|
3154
3202
|
y(e).forEach(function(r) {
|
|
3155
3203
|
if (e[r] !== null) {
|
|
@@ -3164,13 +3212,13 @@ function Pi() {
|
|
|
3164
3212
|
});
|
|
3165
3213
|
}, Dt.prototype.stores = function(n) {
|
|
3166
3214
|
var t = this.db;
|
|
3167
|
-
this._cfg.storesSource = this._cfg.storesSource ?
|
|
3215
|
+
this._cfg.storesSource = this._cfg.storesSource ? D(this._cfg.storesSource, n) : n;
|
|
3168
3216
|
var n = t._versions, r = {}, a = {};
|
|
3169
3217
|
return n.forEach(function(u) {
|
|
3170
|
-
|
|
3218
|
+
D(r, u._cfg.storesSource), a = u._cfg.dbschema = {}, u._parseStoresSpec(r, a);
|
|
3171
3219
|
}), t._dbSchema = a, Gn(t, [t._allTables, t, t.Transaction.prototype]), dn(t, [t._allTables, t, t.Transaction.prototype, this._cfg.tables], y(a), a), t._storeNames = y(a), this;
|
|
3172
3220
|
}, Dt.prototype.upgrade = function(e) {
|
|
3173
|
-
return this._cfg.contentUpgrade =
|
|
3221
|
+
return this._cfg.contentUpgrade = Oe(this._cfg.contentUpgrade || c, e), this;
|
|
3174
3222
|
}, Dt);
|
|
3175
3223
|
function Dt() {
|
|
3176
3224
|
}
|
|
@@ -3192,15 +3240,15 @@ function Pi() {
|
|
|
3192
3240
|
var Se = function(e, t) {
|
|
3193
3241
|
if (!this) {
|
|
3194
3242
|
var n = new Se();
|
|
3195
|
-
return e && "d" in e &&
|
|
3243
|
+
return e && "d" in e && D(n, e), n;
|
|
3196
3244
|
}
|
|
3197
|
-
|
|
3245
|
+
D(this, arguments.length ? { d: 1, from: e, to: 1 < arguments.length ? t : e } : { d: 0 });
|
|
3198
3246
|
};
|
|
3199
3247
|
function Vt(e, t, n) {
|
|
3200
3248
|
var r = re(t, n);
|
|
3201
3249
|
if (!isNaN(r)) {
|
|
3202
3250
|
if (0 < r) throw RangeError();
|
|
3203
|
-
if (Qn(e)) return
|
|
3251
|
+
if (Qn(e)) return D(e, { from: t, to: n, d: 1 });
|
|
3204
3252
|
var a = e.l, r = e.r;
|
|
3205
3253
|
if (re(n, e.from) < 0) return a ? Vt(a, t, n) : e.l = { from: t, to: n, d: 1, l: null, r: null }, qr(e);
|
|
3206
3254
|
if (0 < re(t, e.to)) return r ? Vt(r, t, n) : e.r = { from: t, to: n, d: 1, l: null, r: null }, qr(e);
|
|
@@ -3254,7 +3302,7 @@ function Pi() {
|
|
|
3254
3302
|
return y(t).forEach(function(n) {
|
|
3255
3303
|
e[n] ? Gt(e[n], t[n]) : e[n] = (function r(a) {
|
|
3256
3304
|
var u, f, p = {};
|
|
3257
|
-
for (u in a)
|
|
3305
|
+
for (u in a) G(a, u) && (f = a[u], p[u] = !f || typeof f != "object" || Rt.has(f.constructor) ? f : r(f));
|
|
3258
3306
|
return p;
|
|
3259
3307
|
})(t[n]);
|
|
3260
3308
|
}), e;
|
|
@@ -3299,17 +3347,17 @@ function Pi() {
|
|
|
3299
3347
|
}
|
|
3300
3348
|
function Ur(e, t, n, r) {
|
|
3301
3349
|
for (var a = [], u = 0, f = Object.entries(e.queries.query); u < f.length; u++) {
|
|
3302
|
-
for (var p = f[u], v = p[0],
|
|
3303
|
-
var
|
|
3304
|
-
Hn(t,
|
|
3350
|
+
for (var p = f[u], v = p[0], w = [], x = 0, g = p[1]; x < g.length; x++) {
|
|
3351
|
+
var O = g[x];
|
|
3352
|
+
Hn(t, O.obsSet) ? O.subscribers.forEach(function(N) {
|
|
3305
3353
|
return n.add(N);
|
|
3306
|
-
}) : r &&
|
|
3354
|
+
}) : r && w.push(O);
|
|
3307
3355
|
}
|
|
3308
|
-
r && a.push([v,
|
|
3356
|
+
r && a.push([v, w]);
|
|
3309
3357
|
}
|
|
3310
3358
|
if (r) for (var b = 0, T = a; b < T.length; b++) {
|
|
3311
|
-
var
|
|
3312
|
-
e.queries.query[v] =
|
|
3359
|
+
var A = T[b], v = A[0], w = A[1];
|
|
3360
|
+
e.queries.query[v] = w;
|
|
3313
3361
|
}
|
|
3314
3362
|
}
|
|
3315
3363
|
function Ga(e) {
|
|
@@ -3323,48 +3371,48 @@ function Pi() {
|
|
|
3323
3371
|
if (t.openCanceller !== r) throw new z.DatabaseClosed("db.open() was cancelled");
|
|
3324
3372
|
}
|
|
3325
3373
|
function p() {
|
|
3326
|
-
return new X(function(
|
|
3374
|
+
return new X(function(O, b) {
|
|
3327
3375
|
if (f(), !n) throw new z.MissingAPI();
|
|
3328
|
-
var T = e.name,
|
|
3329
|
-
if (!
|
|
3330
|
-
|
|
3376
|
+
var T = e.name, A = t.autoSchema || !a ? n.open(T) : n.open(T, a);
|
|
3377
|
+
if (!A) throw new z.MissingAPI();
|
|
3378
|
+
A.onerror = $e(b), A.onblocked = pe(e._fireOnBlocked), A.onupgradeneeded = pe(function(N) {
|
|
3331
3379
|
var C;
|
|
3332
|
-
x =
|
|
3380
|
+
x = A.transaction, t.autoSchema && !e._options.allowEmptyDB ? (A.onerror = Kt, x.abort(), A.result.close(), (C = n.deleteDatabase(T)).onsuccess = C.onerror = pe(function() {
|
|
3333
3381
|
b(new z.NoSuchDatabase("Database ".concat(T, " doesnt exist")));
|
|
3334
|
-
})) : (x.onerror = $e(b), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, g = N < 1, e.idbdb =
|
|
3335
|
-
}, b),
|
|
3382
|
+
})) : (x.onerror = $e(b), N = N.oldVersion > Math.pow(2, 62) ? 0 : N.oldVersion, g = N < 1, e.idbdb = A.result, u && Ua(e, x), La(e, N / 10, x, b));
|
|
3383
|
+
}, b), A.onsuccess = pe(function() {
|
|
3336
3384
|
x = null;
|
|
3337
|
-
var N, C, R, k, P,
|
|
3385
|
+
var N, C, R, k, P, j = e.idbdb = A.result, L = xe(j.objectStoreNames);
|
|
3338
3386
|
if (0 < L.length) try {
|
|
3339
|
-
var K =
|
|
3340
|
-
if (t.autoSchema) C =
|
|
3387
|
+
var K = j.transaction((k = L).length === 1 ? k[0] : k, "readonly");
|
|
3388
|
+
if (t.autoSchema) C = j, R = K, (N = e).verno = C.version / 10, R = N._dbSchema = pn(0, C, R), N._storeNames = xe(C.objectStoreNames, 0), dn(N, [N._allTables], y(R), R);
|
|
3341
3389
|
else if (mn(e, e._dbSchema, K), ((P = Xn(pn(0, (P = e).idbdb, K), P._dbSchema)).add.length || P.change.some(function(q) {
|
|
3342
3390
|
return q.add.length || q.change.length;
|
|
3343
|
-
})) && !u) 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."),
|
|
3391
|
+
})) && !u) 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."), j.close(), a = j.version + 1, u = !0, O(p());
|
|
3344
3392
|
fn(e, K);
|
|
3345
3393
|
} catch {
|
|
3346
3394
|
}
|
|
3347
|
-
|
|
3395
|
+
At.push(e), j.onversionchange = pe(function(q) {
|
|
3348
3396
|
t.vcFired = !0, e.on("versionchange").fire(q);
|
|
3349
|
-
}),
|
|
3397
|
+
}), j.onclose = pe(function(q) {
|
|
3350
3398
|
e.on("close").fire(q);
|
|
3351
|
-
}), g && (P = e._deps, K = T,
|
|
3399
|
+
}), g && (P = e._deps, K = T, j = P.indexedDB, P = P.IDBKeyRange, Yn(j) || K === an || Wn(j, P).put({ name: K }).catch(c)), O();
|
|
3352
3400
|
}, b);
|
|
3353
|
-
}).catch(function(
|
|
3354
|
-
switch (
|
|
3401
|
+
}).catch(function(O) {
|
|
3402
|
+
switch (O?.name) {
|
|
3355
3403
|
case "UnknownError":
|
|
3356
3404
|
if (0 < t.PR1398_maxLoop) return t.PR1398_maxLoop--, console.warn("Dexie: Workaround for Chrome UnknownError on open()"), p();
|
|
3357
3405
|
break;
|
|
3358
3406
|
case "VersionError":
|
|
3359
3407
|
if (0 < a) return a = 0, p();
|
|
3360
3408
|
}
|
|
3361
|
-
return X.reject(
|
|
3409
|
+
return X.reject(O);
|
|
3362
3410
|
});
|
|
3363
3411
|
}
|
|
3364
|
-
var v,
|
|
3365
|
-
return X.race([r, (typeof navigator > "u" ? X.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(
|
|
3412
|
+
var v, w = t.dbReadyResolve, x = null, g = !1;
|
|
3413
|
+
return X.race([r, (typeof navigator > "u" ? X.resolve() : !navigator.userAgentData && /Safari\//.test(navigator.userAgent) && !/Chrom(e|ium)\//.test(navigator.userAgent) && indexedDB.databases ? new Promise(function(O) {
|
|
3366
3414
|
function b() {
|
|
3367
|
-
return indexedDB.databases().finally(
|
|
3415
|
+
return indexedDB.databases().finally(O);
|
|
3368
3416
|
}
|
|
3369
3417
|
v = setInterval(b, 100), b();
|
|
3370
3418
|
}).finally(function() {
|
|
@@ -3372,32 +3420,32 @@ function Pi() {
|
|
|
3372
3420
|
}) : Promise.resolve()).then(p)]).then(function() {
|
|
3373
3421
|
return f(), t.onReadyBeingFired = [], X.resolve(zn(function() {
|
|
3374
3422
|
return e.on.ready.fire(e.vip);
|
|
3375
|
-
})).then(function
|
|
3423
|
+
})).then(function O() {
|
|
3376
3424
|
if (0 < t.onReadyBeingFired.length) {
|
|
3377
|
-
var b = t.onReadyBeingFired.reduce(
|
|
3425
|
+
var b = t.onReadyBeingFired.reduce(Oe, c);
|
|
3378
3426
|
return t.onReadyBeingFired = [], X.resolve(zn(function() {
|
|
3379
3427
|
return b(e.vip);
|
|
3380
|
-
})).then(
|
|
3428
|
+
})).then(O);
|
|
3381
3429
|
}
|
|
3382
3430
|
});
|
|
3383
3431
|
}).finally(function() {
|
|
3384
3432
|
t.openCanceller === r && (t.onReadyBeingFired = null, t.isBeingOpened = !1);
|
|
3385
|
-
}).catch(function(
|
|
3386
|
-
t.dbOpenError =
|
|
3433
|
+
}).catch(function(O) {
|
|
3434
|
+
t.dbOpenError = O;
|
|
3387
3435
|
try {
|
|
3388
3436
|
x && x.abort();
|
|
3389
3437
|
} catch {
|
|
3390
3438
|
}
|
|
3391
|
-
return r === t.openCanceller && e._close(), we(
|
|
3439
|
+
return r === t.openCanceller && e._close(), we(O);
|
|
3392
3440
|
}).finally(function() {
|
|
3393
|
-
t.openComplete = !0,
|
|
3441
|
+
t.openComplete = !0, w();
|
|
3394
3442
|
}).then(function() {
|
|
3395
|
-
var
|
|
3396
|
-
return g && (
|
|
3443
|
+
var O;
|
|
3444
|
+
return g && (O = {}, e.tables.forEach(function(b) {
|
|
3397
3445
|
b.schema.indexes.forEach(function(T) {
|
|
3398
|
-
T.name && (
|
|
3399
|
-
}),
|
|
3400
|
-
}), ut(qt).fire(
|
|
3446
|
+
T.name && (O["idb://".concat(e.name, "/").concat(b.name, "/").concat(T.name)] = new Se(-1 / 0, [[[]]]));
|
|
3447
|
+
}), O["idb://".concat(e.name, "/").concat(b.name, "/")] = O["idb://".concat(e.name, "/").concat(b.name, "/:dels")] = new Se(-1 / 0, [[[]]]);
|
|
3448
|
+
}), ut(qt).fire(O), er(O, !0)), e;
|
|
3401
3449
|
});
|
|
3402
3450
|
}
|
|
3403
3451
|
function tr(e) {
|
|
@@ -3410,32 +3458,32 @@ function Pi() {
|
|
|
3410
3458
|
function a(u) {
|
|
3411
3459
|
return function(v) {
|
|
3412
3460
|
var p = u(v), v = p.value;
|
|
3413
|
-
return p.done ? v : v && typeof v.then == "function" ? v.then(n, r) :
|
|
3461
|
+
return p.done ? v : v && typeof v.then == "function" ? v.then(n, r) : _(v) ? Promise.all(v).then(n, r) : n(v);
|
|
3414
3462
|
};
|
|
3415
3463
|
}
|
|
3416
3464
|
return a(t)();
|
|
3417
3465
|
}
|
|
3418
3466
|
function bn(e, t, n) {
|
|
3419
|
-
for (var r =
|
|
3467
|
+
for (var r = _(e) ? e.slice() : [e], a = 0; a < n; ++a) r.push(t);
|
|
3420
3468
|
return r;
|
|
3421
3469
|
}
|
|
3422
3470
|
var Xa = { stack: "dbcore", name: "VirtualIndexMiddleware", level: 1, create: function(e) {
|
|
3423
3471
|
return i(i({}, e), { table: function(t) {
|
|
3424
3472
|
var n = e.table(t), r = n.schema, a = {}, u = [];
|
|
3425
|
-
function f(g,
|
|
3426
|
-
var T = Ut(g),
|
|
3427
|
-
return
|
|
3473
|
+
function f(g, O, b) {
|
|
3474
|
+
var T = Ut(g), A = a[T] = a[T] || [], N = g == null ? 0 : typeof g == "string" ? 1 : g.length, C = 0 < O, C = i(i({}, b), { name: C ? "".concat(T, "(virtual-from:").concat(b.name, ")") : b.name, lowLevelIndex: b, isVirtual: C, keyTail: O, keyLength: N, extractKey: Vn(g), unique: !C && b.unique });
|
|
3475
|
+
return A.push(C), C.isPrimaryKey || u.push(C), 1 < N && f(N === 2 ? g[0] : g.slice(0, N - 1), O + 1, b), A.sort(function(R, k) {
|
|
3428
3476
|
return R.keyTail - k.keyTail;
|
|
3429
3477
|
}), C;
|
|
3430
3478
|
}
|
|
3431
3479
|
t = f(r.primaryKey.keyPath, 0, r.primaryKey), a[":id"] = [t];
|
|
3432
3480
|
for (var p = 0, v = r.indexes; p < v.length; p++) {
|
|
3433
|
-
var
|
|
3434
|
-
f(
|
|
3481
|
+
var w = v[p];
|
|
3482
|
+
f(w.keyPath, 0, w);
|
|
3435
3483
|
}
|
|
3436
3484
|
function x(g) {
|
|
3437
|
-
var
|
|
3438
|
-
return b.isVirtual ? i(i({}, g), { query: { index: b.lowLevelIndex, range: (
|
|
3485
|
+
var O, b = g.query.index;
|
|
3486
|
+
return b.isVirtual ? i(i({}, g), { query: { index: b.lowLevelIndex, range: (O = g.query.range, b = b.keyTail, { type: O.type === 1 ? 2 : O.type, lower: bn(O.lower, O.lowerOpen ? e.MAX_KEY : e.MIN_KEY, b), lowerOpen: !0, upper: bn(O.upper, O.upperOpen ? e.MIN_KEY : e.MAX_KEY, b), upperOpen: !0 }) } }) : g;
|
|
3439
3487
|
}
|
|
3440
3488
|
return i(i({}, n), { schema: i(i({}, r), { primaryKey: t, indexes: u, getIndexByKeyPath: function(g) {
|
|
3441
3489
|
return (g = a[Ut(g)]) && g[0];
|
|
@@ -3444,20 +3492,20 @@ function Pi() {
|
|
|
3444
3492
|
}, query: function(g) {
|
|
3445
3493
|
return n.query(x(g));
|
|
3446
3494
|
}, openCursor: function(g) {
|
|
3447
|
-
var
|
|
3495
|
+
var O = g.query.index, b = O.keyTail, T = O.isVirtual, A = O.keyLength;
|
|
3448
3496
|
return T ? n.openCursor(x(g)).then(function(C) {
|
|
3449
3497
|
return C && N(C);
|
|
3450
3498
|
}) : n.openCursor(g);
|
|
3451
3499
|
function N(C) {
|
|
3452
3500
|
return Object.create(C, { continue: { value: function(R) {
|
|
3453
|
-
R != null ? C.continue(bn(R, g.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : g.unique ? C.continue(C.key.slice(0,
|
|
3501
|
+
R != null ? C.continue(bn(R, g.reverse ? e.MAX_KEY : e.MIN_KEY, b)) : g.unique ? C.continue(C.key.slice(0, A).concat(g.reverse ? e.MIN_KEY : e.MAX_KEY, b)) : C.continue();
|
|
3454
3502
|
} }, continuePrimaryKey: { value: function(R, k) {
|
|
3455
3503
|
C.continuePrimaryKey(bn(R, e.MAX_KEY, b), k);
|
|
3456
3504
|
} }, primaryKey: { get: function() {
|
|
3457
3505
|
return C.primaryKey;
|
|
3458
3506
|
} }, key: { get: function() {
|
|
3459
3507
|
var R = C.key;
|
|
3460
|
-
return
|
|
3508
|
+
return A === 1 ? R[0] : R.slice(0, A);
|
|
3461
3509
|
} }, value: { get: function() {
|
|
3462
3510
|
return C.value;
|
|
3463
3511
|
} } });
|
|
@@ -3468,9 +3516,9 @@ function Pi() {
|
|
|
3468
3516
|
function nr(e, t, n, r) {
|
|
3469
3517
|
return n = n || {}, r = r || "", y(e).forEach(function(a) {
|
|
3470
3518
|
var u, f, p;
|
|
3471
|
-
|
|
3519
|
+
G(t, a) ? (u = e[a], f = t[a], typeof u == "object" && typeof f == "object" && u && f ? (p = St(u)) !== St(f) ? n[r + a] = t[a] : p === "Object" ? nr(u, f, n, r + a + ".") : u !== f && (n[r + a] = t[a]) : u !== f && (n[r + a] = t[a])) : n[r + a] = void 0;
|
|
3472
3520
|
}), y(t).forEach(function(a) {
|
|
3473
|
-
|
|
3521
|
+
G(e, a) || (n[r + a] = t[a]);
|
|
3474
3522
|
}), n;
|
|
3475
3523
|
}
|
|
3476
3524
|
function rr(e, t) {
|
|
@@ -3480,7 +3528,7 @@ function Pi() {
|
|
|
3480
3528
|
return i(i({}, e), { table: function(t) {
|
|
3481
3529
|
var n = e.table(t), r = n.schema.primaryKey;
|
|
3482
3530
|
return i(i({}, n), { mutate: function(a) {
|
|
3483
|
-
var u = Y.trans, f = u.table(t).hook, p = f.deleting, v = f.creating,
|
|
3531
|
+
var u = Y.trans, f = u.table(t).hook, p = f.deleting, v = f.creating, w = f.updating;
|
|
3484
3532
|
switch (a.type) {
|
|
3485
3533
|
case "add":
|
|
3486
3534
|
if (v.fire === c) break;
|
|
@@ -3488,7 +3536,7 @@ function Pi() {
|
|
|
3488
3536
|
return x(a);
|
|
3489
3537
|
}, !0);
|
|
3490
3538
|
case "put":
|
|
3491
|
-
if (v.fire === c &&
|
|
3539
|
+
if (v.fire === c && w.fire === c) break;
|
|
3492
3540
|
return u._promise("readwrite", function() {
|
|
3493
3541
|
return x(a);
|
|
3494
3542
|
}, !0);
|
|
@@ -3500,11 +3548,11 @@ function Pi() {
|
|
|
3500
3548
|
case "deleteRange":
|
|
3501
3549
|
if (p.fire === c) break;
|
|
3502
3550
|
return u._promise("readwrite", function() {
|
|
3503
|
-
return (function g(
|
|
3504
|
-
return n.query({ trans:
|
|
3505
|
-
var N =
|
|
3506
|
-
return x({ type: "delete", keys: N, trans:
|
|
3507
|
-
return 0 < C.numFailures ? Promise.reject(C.failures[0]) : N.length < T ? { failures: [], numFailures: 0, lastResult: void 0 } : g(
|
|
3551
|
+
return (function g(O, b, T) {
|
|
3552
|
+
return n.query({ trans: O, values: !1, query: { index: r, range: b }, limit: T }).then(function(A) {
|
|
3553
|
+
var N = A.result;
|
|
3554
|
+
return x({ type: "delete", keys: N, trans: O }).then(function(C) {
|
|
3555
|
+
return 0 < C.numFailures ? Promise.reject(C.failures[0]) : N.length < T ? { failures: [], numFailures: 0, lastResult: void 0 } : g(O, i(i({}, b), { lower: N[N.length - 1], lowerOpen: !0 }), T);
|
|
3508
3556
|
});
|
|
3509
3557
|
});
|
|
3510
3558
|
})(a.trans, a.range, 1e4);
|
|
@@ -3512,21 +3560,21 @@ function Pi() {
|
|
|
3512
3560
|
}
|
|
3513
3561
|
return n.mutate(a);
|
|
3514
3562
|
function x(g) {
|
|
3515
|
-
var
|
|
3563
|
+
var O, b, T, A = Y.trans, N = g.keys || rr(r, g);
|
|
3516
3564
|
if (!N) throw new Error("Keys missing");
|
|
3517
|
-
return (g = g.type === "add" || g.type === "put" ? i(i({}, g), { keys: N }) : i({}, g)).type !== "delete" && (g.values = d([], g.values)), g.keys && (g.keys = d([], g.keys)),
|
|
3565
|
+
return (g = g.type === "add" || g.type === "put" ? i(i({}, g), { keys: N }) : i({}, g)).type !== "delete" && (g.values = d([], g.values)), g.keys && (g.keys = d([], g.keys)), O = n, T = N, ((b = g).type === "add" ? Promise.resolve([]) : O.getMany({ trans: b.trans, keys: T, cache: "immutable" })).then(function(C) {
|
|
3518
3566
|
var R = N.map(function(k, P) {
|
|
3519
|
-
var
|
|
3520
|
-
return g.type === "delete" ? p.fire.call(
|
|
3521
|
-
|
|
3522
|
-
}))),
|
|
3567
|
+
var j, L, K, q = C[P], V = { onerror: null, onsuccess: null };
|
|
3568
|
+
return g.type === "delete" ? p.fire.call(V, k, q, A) : g.type === "add" || q === void 0 ? (j = v.fire.call(V, k, g.values[P], A), k == null && j != null && (g.keys[P] = k = j, r.outbound || le(g.values[P], r.keyPath, k))) : (j = nr(q, g.values[P]), (L = w.fire.call(V, j, k, q, A)) && (K = g.values[P], Object.keys(L).forEach(function(U) {
|
|
3569
|
+
G(K, U) ? K[U] = L[U] : le(K, U, L[U]);
|
|
3570
|
+
}))), V;
|
|
3523
3571
|
});
|
|
3524
3572
|
return n.mutate(g).then(function(k) {
|
|
3525
|
-
for (var P = k.failures,
|
|
3526
|
-
var q = (
|
|
3527
|
-
q == null ?
|
|
3573
|
+
for (var P = k.failures, j = k.results, L = k.numFailures, k = k.lastResult, K = 0; K < N.length; ++K) {
|
|
3574
|
+
var q = (j || N)[K], V = R[K];
|
|
3575
|
+
q == null ? V.onerror && V.onerror(P[K]) : V.onsuccess && V.onsuccess(g.type === "put" && C[K] ? g.values[K] : q);
|
|
3528
3576
|
}
|
|
3529
|
-
return { failures: P, results:
|
|
3577
|
+
return { failures: P, results: j, numFailures: L, lastResult: k };
|
|
3530
3578
|
}).catch(function(k) {
|
|
3531
3579
|
return R.forEach(function(P) {
|
|
3532
3580
|
return P.onerror && P.onerror(k);
|
|
@@ -3580,75 +3628,75 @@ function Pi() {
|
|
|
3580
3628
|
if (Y.subscr && a !== "readonly") throw new z.ReadOnly("Readwrite transaction in liveQuery context. Querier source: ".concat(Y.querier));
|
|
3581
3629
|
return e.transaction(r, a, u);
|
|
3582
3630
|
}, table: function(r) {
|
|
3583
|
-
var a = e.table(r), u = a.schema, f = u.primaryKey, g = u.indexes, p = f.extractKey, v = f.outbound,
|
|
3631
|
+
var a = e.table(r), u = a.schema, f = u.primaryKey, g = u.indexes, p = f.extractKey, v = f.outbound, w = f.autoIncrement && g.filter(function(b) {
|
|
3584
3632
|
return b.compound && b.keyPath.includes(f.keyPath);
|
|
3585
3633
|
}), x = i(i({}, a), { mutate: function(b) {
|
|
3586
3634
|
function T(U) {
|
|
3587
3635
|
return U = "idb://".concat(t, "/").concat(r, "/").concat(U), k[U] || (k[U] = new Se());
|
|
3588
3636
|
}
|
|
3589
|
-
var
|
|
3637
|
+
var A, N, C, R = b.trans, k = b.mutatedParts || (b.mutatedParts = {}), P = T(""), j = T(":dels"), L = b.type, V = b.type === "deleteRange" ? [b.range] : b.type === "delete" ? [b.keys] : b.values.length < 50 ? [rr(f, b).filter(function(U) {
|
|
3590
3638
|
return U;
|
|
3591
|
-
}), b.values] : [], K =
|
|
3592
|
-
return
|
|
3593
|
-
var
|
|
3639
|
+
}), b.values] : [], K = V[0], q = V[1], V = b.trans._cache;
|
|
3640
|
+
return _(K) ? (P.addKeys(K), (V = L === "delete" || K.length === q.length ? Vr(K, V) : null) || j.addKeys(K), (V || q) && (A = T, N = V, C = q, u.indexes.forEach(function(U) {
|
|
3641
|
+
var W = A(U.name || "");
|
|
3594
3642
|
function ne(ee) {
|
|
3595
3643
|
return ee != null ? U.extractKey(ee) : null;
|
|
3596
3644
|
}
|
|
3597
3645
|
function ae(ee) {
|
|
3598
|
-
return U.multiEntry &&
|
|
3599
|
-
return
|
|
3600
|
-
}) :
|
|
3646
|
+
return U.multiEntry && _(ee) ? ee.forEach(function(ve) {
|
|
3647
|
+
return W.addKey(ve);
|
|
3648
|
+
}) : W.addKey(ee);
|
|
3601
3649
|
}
|
|
3602
3650
|
(N || C).forEach(function(ee, ke) {
|
|
3603
3651
|
var J = N && ne(N[ke]), ke = C && ne(C[ke]);
|
|
3604
3652
|
re(J, ke) !== 0 && (J != null && ae(J), ke != null && ae(ke));
|
|
3605
3653
|
});
|
|
3606
|
-
}))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY },
|
|
3654
|
+
}))) : K ? (q = { from: (q = K.lower) !== null && q !== void 0 ? q : e.MIN_KEY, to: (q = K.upper) !== null && q !== void 0 ? q : e.MAX_KEY }, j.add(q), P.add(q)) : (P.add(n), j.add(n), u.indexes.forEach(function(U) {
|
|
3607
3655
|
return T(U.name).add(n);
|
|
3608
3656
|
})), a.mutate(b).then(function(U) {
|
|
3609
|
-
return !K || b.type !== "add" && b.type !== "put" || (P.addKeys(U.results),
|
|
3657
|
+
return !K || b.type !== "add" && b.type !== "put" || (P.addKeys(U.results), w && w.forEach(function(W) {
|
|
3610
3658
|
for (var ne = b.values.map(function(J) {
|
|
3611
|
-
return
|
|
3612
|
-
}), ae =
|
|
3659
|
+
return W.extractKey(J);
|
|
3660
|
+
}), ae = W.keyPath.findIndex(function(J) {
|
|
3613
3661
|
return J === f.keyPath;
|
|
3614
3662
|
}), ee = 0, ve = U.results.length; ee < ve; ++ee) ne[ee][ae] = U.results[ee];
|
|
3615
|
-
T(
|
|
3663
|
+
T(W.name).addKeys(ne);
|
|
3616
3664
|
})), R.mutatedParts = yn(R.mutatedParts || {}, k), U;
|
|
3617
3665
|
});
|
|
3618
3666
|
} }), g = function(T) {
|
|
3619
|
-
var
|
|
3620
|
-
return [T, new Se((T =
|
|
3621
|
-
},
|
|
3667
|
+
var A = T.query, T = A.index, A = A.range;
|
|
3668
|
+
return [T, new Se((T = A.lower) !== null && T !== void 0 ? T : e.MIN_KEY, (A = A.upper) !== null && A !== void 0 ? A : e.MAX_KEY)];
|
|
3669
|
+
}, O = { get: function(b) {
|
|
3622
3670
|
return [f, new Se(b.key)];
|
|
3623
3671
|
}, getMany: function(b) {
|
|
3624
3672
|
return [f, new Se().addKeys(b.keys)];
|
|
3625
3673
|
}, count: g, query: g, openCursor: g };
|
|
3626
|
-
return y(
|
|
3674
|
+
return y(O).forEach(function(b) {
|
|
3627
3675
|
x[b] = function(T) {
|
|
3628
|
-
var
|
|
3676
|
+
var A = Y.subscr, N = !!A, C = Gr(Y, a) && Xr(b, T) ? T.obsSet = {} : A;
|
|
3629
3677
|
if (N) {
|
|
3630
3678
|
var R = function(q) {
|
|
3631
3679
|
return q = "idb://".concat(t, "/").concat(r, "/").concat(q), C[q] || (C[q] = new Se());
|
|
3632
|
-
}, k = R(""), P = R(":dels"),
|
|
3633
|
-
if ((b === "query" && N.isPrimaryKey && !T.values ? P : R(N.name || "")).add(
|
|
3680
|
+
}, k = R(""), P = R(":dels"), A = O[b](T), N = A[0], A = A[1];
|
|
3681
|
+
if ((b === "query" && N.isPrimaryKey && !T.values ? P : R(N.name || "")).add(A), !N.isPrimaryKey) {
|
|
3634
3682
|
if (b !== "count") {
|
|
3635
|
-
var
|
|
3683
|
+
var j = b === "query" && v && T.values && a.query(i(i({}, T), { values: !1 }));
|
|
3636
3684
|
return a[b].apply(this, arguments).then(function(q) {
|
|
3637
3685
|
if (b === "query") {
|
|
3638
|
-
if (v && T.values) return
|
|
3686
|
+
if (v && T.values) return j.then(function(ne) {
|
|
3639
3687
|
return ne = ne.result, k.addKeys(ne), q;
|
|
3640
3688
|
});
|
|
3641
|
-
var
|
|
3642
|
-
(T.values ? k : P).addKeys(
|
|
3689
|
+
var V = T.values ? q.result.map(p) : q.result;
|
|
3690
|
+
(T.values ? k : P).addKeys(V);
|
|
3643
3691
|
} else if (b === "openCursor") {
|
|
3644
|
-
var U = q,
|
|
3692
|
+
var U = q, W = T.values;
|
|
3645
3693
|
return U && Object.create(U, { key: { get: function() {
|
|
3646
3694
|
return P.addKey(U.primaryKey), U.key;
|
|
3647
3695
|
} }, primaryKey: { get: function() {
|
|
3648
3696
|
var ne = U.primaryKey;
|
|
3649
3697
|
return P.addKey(ne), ne;
|
|
3650
3698
|
} }, value: { get: function() {
|
|
3651
|
-
return
|
|
3699
|
+
return W && k.addKey(U.primaryKey), U.value;
|
|
3652
3700
|
} } });
|
|
3653
3701
|
}
|
|
3654
3702
|
return q;
|
|
@@ -3666,9 +3714,9 @@ function Pi() {
|
|
|
3666
3714
|
if (n.numFailures === 0) return t;
|
|
3667
3715
|
if (t.type === "deleteRange") return null;
|
|
3668
3716
|
var r = t.keys ? t.keys.length : "values" in t && t.values ? t.values.length : 1;
|
|
3669
|
-
return n.numFailures === r ? null : (t = i({}, t),
|
|
3717
|
+
return n.numFailures === r ? null : (t = i({}, t), _(t.keys) && (t.keys = t.keys.filter(function(a, u) {
|
|
3670
3718
|
return !(u in n.failures);
|
|
3671
|
-
})), "values" in t &&
|
|
3719
|
+
})), "values" in t && _(t.values) && (t.values = t.values.filter(function(a, u) {
|
|
3672
3720
|
return !(u in n.failures);
|
|
3673
3721
|
})), t);
|
|
3674
3722
|
}
|
|
@@ -3676,55 +3724,55 @@ function Pi() {
|
|
|
3676
3724
|
return n = e, ((r = t).lower === void 0 || (r.lowerOpen ? 0 < re(n, r.lower) : 0 <= re(n, r.lower))) && (e = e, (t = t).upper === void 0 || (t.upperOpen ? re(e, t.upper) < 0 : re(e, t.upper) <= 0));
|
|
3677
3725
|
var n, r;
|
|
3678
3726
|
}
|
|
3679
|
-
function Wr(e, t,
|
|
3680
|
-
if (!
|
|
3681
|
-
var f = t.query.index, p = f.multiEntry, v = t.query.range,
|
|
3682
|
-
var
|
|
3727
|
+
function Wr(e, t, O, r, a, u) {
|
|
3728
|
+
if (!O || O.length === 0) return e;
|
|
3729
|
+
var f = t.query.index, p = f.multiEntry, v = t.query.range, w = r.schema.primaryKey.extractKey, x = f.extractKey, g = (f.lowLevelIndex || f).extractKey, O = O.reduce(function(b, T) {
|
|
3730
|
+
var A = b, N = [];
|
|
3683
3731
|
if (T.type === "add" || T.type === "put") for (var C = new Se(), R = T.values.length - 1; 0 <= R; --R) {
|
|
3684
|
-
var k, P = T.values[R],
|
|
3685
|
-
C.hasKey(
|
|
3732
|
+
var k, P = T.values[R], j = w(P);
|
|
3733
|
+
C.hasKey(j) || (k = x(P), (p && _(k) ? k.some(function(U) {
|
|
3686
3734
|
return ar(U, v);
|
|
3687
|
-
}) : ar(k, v)) && (C.addKey(
|
|
3735
|
+
}) : ar(k, v)) && (C.addKey(j), N.push(P)));
|
|
3688
3736
|
}
|
|
3689
3737
|
switch (T.type) {
|
|
3690
3738
|
case "add":
|
|
3691
|
-
var L = new Se().addKeys(t.values ? b.map(function(
|
|
3692
|
-
return
|
|
3693
|
-
}) : b),
|
|
3694
|
-
return
|
|
3695
|
-
}) : N.map(function(
|
|
3696
|
-
return
|
|
3697
|
-
}).filter(function(
|
|
3698
|
-
return !L.hasKey(
|
|
3739
|
+
var L = new Se().addKeys(t.values ? b.map(function(W) {
|
|
3740
|
+
return w(W);
|
|
3741
|
+
}) : b), A = b.concat(t.values ? N.filter(function(W) {
|
|
3742
|
+
return W = w(W), !L.hasKey(W) && (L.addKey(W), !0);
|
|
3743
|
+
}) : N.map(function(W) {
|
|
3744
|
+
return w(W);
|
|
3745
|
+
}).filter(function(W) {
|
|
3746
|
+
return !L.hasKey(W) && (L.addKey(W), !0);
|
|
3699
3747
|
}));
|
|
3700
3748
|
break;
|
|
3701
3749
|
case "put":
|
|
3702
|
-
var K = new Se().addKeys(T.values.map(function(
|
|
3703
|
-
return
|
|
3750
|
+
var K = new Se().addKeys(T.values.map(function(W) {
|
|
3751
|
+
return w(W);
|
|
3704
3752
|
}));
|
|
3705
|
-
|
|
3706
|
-
return !K.hasKey(t.values ?
|
|
3707
|
-
}).concat(t.values ? N : N.map(function(
|
|
3708
|
-
return
|
|
3753
|
+
A = b.filter(function(W) {
|
|
3754
|
+
return !K.hasKey(t.values ? w(W) : W);
|
|
3755
|
+
}).concat(t.values ? N : N.map(function(W) {
|
|
3756
|
+
return w(W);
|
|
3709
3757
|
}));
|
|
3710
3758
|
break;
|
|
3711
3759
|
case "delete":
|
|
3712
3760
|
var q = new Se().addKeys(T.keys);
|
|
3713
|
-
|
|
3714
|
-
return !q.hasKey(t.values ?
|
|
3761
|
+
A = b.filter(function(W) {
|
|
3762
|
+
return !q.hasKey(t.values ? w(W) : W);
|
|
3715
3763
|
});
|
|
3716
3764
|
break;
|
|
3717
3765
|
case "deleteRange":
|
|
3718
|
-
var
|
|
3719
|
-
|
|
3720
|
-
return !ar(
|
|
3766
|
+
var V = T.range;
|
|
3767
|
+
A = b.filter(function(W) {
|
|
3768
|
+
return !ar(w(W), V);
|
|
3721
3769
|
});
|
|
3722
3770
|
}
|
|
3723
|
-
return
|
|
3771
|
+
return A;
|
|
3724
3772
|
}, e);
|
|
3725
|
-
return
|
|
3726
|
-
return re(g(b), g(T)) || re(
|
|
3727
|
-
}), t.limit && t.limit < 1 / 0 && (
|
|
3773
|
+
return O === e ? e : (O.sort(function(b, T) {
|
|
3774
|
+
return re(g(b), g(T)) || re(w(b), w(T));
|
|
3775
|
+
}), t.limit && t.limit < 1 / 0 && (O.length > t.limit ? O.length = t.limit : e.length === t.limit && O.length < t.limit && (a.dirty = !0)), u ? Object.freeze(O) : O);
|
|
3728
3776
|
}
|
|
3729
3777
|
function Yr(e, t) {
|
|
3730
3778
|
return re(e.lower, t.lower) === 0 && re(e.upper, t.upper) === 0 && !!e.lowerOpen == !!t.lowerOpen && !!e.upperOpen == !!t.upperOpen;
|
|
@@ -3754,7 +3802,7 @@ function Pi() {
|
|
|
3754
3802
|
e.subscribers.add(n), r.addEventListener("abort", function() {
|
|
3755
3803
|
var a, u;
|
|
3756
3804
|
e.subscribers.delete(n), e.subscribers.size === 0 && (a = e, u = t, setTimeout(function() {
|
|
3757
|
-
a.subscribers.size === 0 &&
|
|
3805
|
+
a.subscribers.size === 0 && je(u, a);
|
|
3758
3806
|
}, 3e3));
|
|
3759
3807
|
});
|
|
3760
3808
|
}
|
|
@@ -3765,29 +3813,29 @@ function Pi() {
|
|
|
3765
3813
|
return r === "readwrite" && (f = (u = new AbortController()).signal, a = function(v) {
|
|
3766
3814
|
return function() {
|
|
3767
3815
|
if (u.abort(), r === "readwrite") {
|
|
3768
|
-
for (var
|
|
3769
|
-
var
|
|
3816
|
+
for (var w = /* @__PURE__ */ new Set(), x = 0, g = n; x < g.length; x++) {
|
|
3817
|
+
var O = g[x], b = gt["idb://".concat(t, "/").concat(O)];
|
|
3770
3818
|
if (b) {
|
|
3771
|
-
var T = e.table(
|
|
3772
|
-
return
|
|
3819
|
+
var T = e.table(O), A = b.optimisticOps.filter(function(W) {
|
|
3820
|
+
return W.trans === p;
|
|
3773
3821
|
});
|
|
3774
|
-
if (p._explicit && v && p.mutatedParts) for (var N = 0, C = Object.values(b.queries.query); N < C.length; N++) for (var R = 0, k = (L = C[N]).slice(); R < k.length; R++) Hn((K = k[R]).obsSet, p.mutatedParts) && (
|
|
3775
|
-
return
|
|
3822
|
+
if (p._explicit && v && p.mutatedParts) for (var N = 0, C = Object.values(b.queries.query); N < C.length; N++) for (var R = 0, k = (L = C[N]).slice(); R < k.length; R++) Hn((K = k[R]).obsSet, p.mutatedParts) && (je(L, K), K.subscribers.forEach(function(W) {
|
|
3823
|
+
return w.add(W);
|
|
3776
3824
|
}));
|
|
3777
|
-
else if (0 <
|
|
3778
|
-
b.optimisticOps = b.optimisticOps.filter(function(
|
|
3779
|
-
return
|
|
3825
|
+
else if (0 < A.length) {
|
|
3826
|
+
b.optimisticOps = b.optimisticOps.filter(function(W) {
|
|
3827
|
+
return W.trans !== p;
|
|
3780
3828
|
});
|
|
3781
|
-
for (var P = 0,
|
|
3782
|
-
return
|
|
3783
|
-
})) : q !== K.res && (K.res = q, K.promise = X.resolve({ result: q }))) : (K.dirty &&
|
|
3784
|
-
return
|
|
3829
|
+
for (var P = 0, j = Object.values(b.queries.query); P < j.length; P++) for (var L, K, q, V = 0, U = (L = j[P]).slice(); V < U.length; V++) (K = U[V]).res != null && p.mutatedParts && (v && !K.dirty ? (q = Object.isFrozen(K.res), q = Wr(K.res, K.req, A, T, K, q), K.dirty ? (je(L, K), K.subscribers.forEach(function(W) {
|
|
3830
|
+
return w.add(W);
|
|
3831
|
+
})) : q !== K.res && (K.res = q, K.promise = X.resolve({ result: q }))) : (K.dirty && je(L, K), K.subscribers.forEach(function(W) {
|
|
3832
|
+
return w.add(W);
|
|
3785
3833
|
})));
|
|
3786
3834
|
}
|
|
3787
3835
|
}
|
|
3788
3836
|
}
|
|
3789
|
-
|
|
3790
|
-
return
|
|
3837
|
+
w.forEach(function(W) {
|
|
3838
|
+
return W();
|
|
3791
3839
|
});
|
|
3792
3840
|
}
|
|
3793
3841
|
};
|
|
@@ -3801,51 +3849,51 @@ function Pi() {
|
|
|
3801
3849
|
return p ? (f = r.mutate(u), u.type !== "add" && u.type !== "put" || !(50 <= u.values.length || rr(a, u).some(function(v) {
|
|
3802
3850
|
return v == null;
|
|
3803
3851
|
})) ? (p.optimisticOps.push(u), u.mutatedParts && vn(u.mutatedParts), f.then(function(v) {
|
|
3804
|
-
0 < v.numFailures && (
|
|
3852
|
+
0 < v.numFailures && (je(p.optimisticOps, u), (v = $r(0, u, v)) && p.optimisticOps.push(v), u.mutatedParts && vn(u.mutatedParts));
|
|
3805
3853
|
}), f.catch(function() {
|
|
3806
|
-
|
|
3854
|
+
je(p.optimisticOps, u), u.mutatedParts && vn(u.mutatedParts);
|
|
3807
3855
|
})) : f.then(function(v) {
|
|
3808
|
-
var
|
|
3809
|
-
var
|
|
3810
|
-
return v.failures[g] ? x : (x = (
|
|
3856
|
+
var w = $r(0, i(i({}, u), { values: u.values.map(function(x, g) {
|
|
3857
|
+
var O;
|
|
3858
|
+
return v.failures[g] ? x : (x = (O = a.keyPath) !== null && O !== void 0 && O.includes(".") ? Ye(x) : i({}, x), le(x, a.keyPath, v.results[g]), x);
|
|
3811
3859
|
}) }), v);
|
|
3812
|
-
p.optimisticOps.push(
|
|
3860
|
+
p.optimisticOps.push(w), queueMicrotask(function() {
|
|
3813
3861
|
return u.mutatedParts && vn(u.mutatedParts);
|
|
3814
3862
|
});
|
|
3815
3863
|
}), f) : r.mutate(u);
|
|
3816
3864
|
}, query: function(u) {
|
|
3817
3865
|
if (!Gr(Y, r) || !Xr("query", u)) return r.query(u);
|
|
3818
|
-
var f = ((
|
|
3819
|
-
var R = gt["idb://".concat(T, "/").concat(
|
|
3866
|
+
var f = ((w = Y.trans) === null || w === void 0 ? void 0 : w.db._options.cache) === "immutable", g = Y, p = g.requery, v = g.signal, w = (function(T, A, N, C) {
|
|
3867
|
+
var R = gt["idb://".concat(T, "/").concat(A)];
|
|
3820
3868
|
if (!R) return [];
|
|
3821
|
-
if (!(
|
|
3822
|
-
var k =
|
|
3869
|
+
if (!(A = R.queries[N])) return [null, !1, R, null];
|
|
3870
|
+
var k = A[(C.query ? C.query.index.name : null) || ""];
|
|
3823
3871
|
if (!k) return [null, !1, R, null];
|
|
3824
3872
|
switch (N) {
|
|
3825
3873
|
case "query":
|
|
3826
|
-
var P = k.find(function(
|
|
3827
|
-
return
|
|
3874
|
+
var P = k.find(function(j) {
|
|
3875
|
+
return j.req.limit === C.limit && j.req.values === C.values && Yr(j.req.query.range, C.query.range);
|
|
3828
3876
|
});
|
|
3829
|
-
return P ? [P, !0, R, k] : [k.find(function(
|
|
3830
|
-
return ("limit" in
|
|
3877
|
+
return P ? [P, !0, R, k] : [k.find(function(j) {
|
|
3878
|
+
return ("limit" in j.req ? j.req.limit : 1 / 0) >= C.limit && (!C.values || j.req.values) && za(j.req.query.range, C.query.range);
|
|
3831
3879
|
}), !1, R, k];
|
|
3832
3880
|
case "count":
|
|
3833
|
-
return P = k.find(function(
|
|
3834
|
-
return Yr(
|
|
3881
|
+
return P = k.find(function(j) {
|
|
3882
|
+
return Yr(j.req.query.range, C.query.range);
|
|
3835
3883
|
}), [P, !!P, R, k];
|
|
3836
3884
|
}
|
|
3837
|
-
})(t, n, "query", u), x =
|
|
3885
|
+
})(t, n, "query", u), x = w[0], g = w[1], O = w[2], b = w[3];
|
|
3838
3886
|
return x && g ? x.obsSet = u.obsSet : (g = r.query(u).then(function(T) {
|
|
3839
|
-
var
|
|
3840
|
-
if (x && (x.res =
|
|
3841
|
-
for (var N = 0, C =
|
|
3842
|
-
Object.freeze(
|
|
3843
|
-
} else T.result = Ye(
|
|
3887
|
+
var A = T.result;
|
|
3888
|
+
if (x && (x.res = A), f) {
|
|
3889
|
+
for (var N = 0, C = A.length; N < C; ++N) Object.freeze(A[N]);
|
|
3890
|
+
Object.freeze(A);
|
|
3891
|
+
} else T.result = Ye(A);
|
|
3844
3892
|
return T;
|
|
3845
3893
|
}).catch(function(T) {
|
|
3846
|
-
return b && x &&
|
|
3847
|
-
}), x = { obsSet: u.obsSet, promise: g, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, b ? b.push(x) : (b = [x], (
|
|
3848
|
-
return { result: Wr(T.result, u,
|
|
3894
|
+
return b && x && je(b, x), Promise.reject(T);
|
|
3895
|
+
}), x = { obsSet: u.obsSet, promise: g, subscribers: /* @__PURE__ */ new Set(), type: "query", req: u, dirty: !1 }, b ? b.push(x) : (b = [x], (O = O || (gt["idb://".concat(t, "/").concat(n)] = { queries: { query: {}, count: {} }, objs: /* @__PURE__ */ new Map(), optimisticOps: [], unsignaledParts: {} })).queries.query[u.query.index.name || ""] = b)), Qa(x, b, p, v), x.promise.then(function(T) {
|
|
3896
|
+
return { result: Wr(T.result, u, O?.optimisticOps, r, x, f) };
|
|
3849
3897
|
});
|
|
3850
3898
|
} });
|
|
3851
3899
|
} });
|
|
@@ -3890,8 +3938,8 @@ function Pi() {
|
|
|
3890
3938
|
});
|
|
3891
3939
|
}, _e.prototype._close = function() {
|
|
3892
3940
|
this.on.close.fire(new CustomEvent("close"));
|
|
3893
|
-
var e = this._state, t =
|
|
3894
|
-
if (0 <= t &&
|
|
3941
|
+
var e = this._state, t = At.indexOf(this);
|
|
3942
|
+
if (0 <= t && At.splice(t, 1), this.idbdb) {
|
|
3895
3943
|
try {
|
|
3896
3944
|
this.idbdb.close();
|
|
3897
3945
|
} catch {
|
|
@@ -3915,8 +3963,8 @@ function Pi() {
|
|
|
3915
3963
|
t.close(e);
|
|
3916
3964
|
var p = t._deps.indexedDB.deleteDatabase(t.name);
|
|
3917
3965
|
p.onsuccess = pe(function() {
|
|
3918
|
-
var v,
|
|
3919
|
-
v = t._deps,
|
|
3966
|
+
var v, w, x;
|
|
3967
|
+
v = t._deps, w = t.name, x = v.indexedDB, v = v.IDBKeyRange, Yn(x) || w === an || Wn(x, v).delete(w).catch(c), a();
|
|
3920
3968
|
}), p.onerror = $e(u), p.onblocked = t._fireOnBlocked;
|
|
3921
3969
|
}
|
|
3922
3970
|
if (n) throw new z.InvalidArgument("Invalid closeOptions argument to db.delete()");
|
|
@@ -3943,7 +3991,7 @@ function Pi() {
|
|
|
3943
3991
|
var a = arguments.length;
|
|
3944
3992
|
if (a < 2) throw new z.InvalidArgument("Too few arguments");
|
|
3945
3993
|
for (var u = new Array(a - 1); --a; ) u[a - 1] = arguments[a];
|
|
3946
|
-
return r = u.pop(), [t,
|
|
3994
|
+
return r = u.pop(), [t, I(u), r];
|
|
3947
3995
|
}).apply(this, arguments);
|
|
3948
3996
|
return this._transaction.apply(this, e);
|
|
3949
3997
|
}, _e.prototype._transaction = function(e, t, n) {
|
|
@@ -3952,49 +4000,49 @@ function Pi() {
|
|
|
3952
4000
|
var u, f, p = e.indexOf("?") !== -1;
|
|
3953
4001
|
e = e.replace("!", "").replace("?", "");
|
|
3954
4002
|
try {
|
|
3955
|
-
if (f = t.map(function(
|
|
3956
|
-
if (
|
|
3957
|
-
return
|
|
4003
|
+
if (f = t.map(function(w) {
|
|
4004
|
+
if (w = w instanceof r.Table ? w.name : w, typeof w != "string") throw new TypeError("Invalid table argument to Dexie.transaction(). Only Table or String are allowed");
|
|
4005
|
+
return w;
|
|
3958
4006
|
}), e == "r" || e === Bn) u = Bn;
|
|
3959
4007
|
else {
|
|
3960
|
-
if (e != "rw" && e !=
|
|
3961
|
-
u =
|
|
4008
|
+
if (e != "rw" && e != Mn) throw new z.InvalidArgument("Invalid transaction mode: " + e);
|
|
4009
|
+
u = Mn;
|
|
3962
4010
|
}
|
|
3963
4011
|
if (a) {
|
|
3964
|
-
if (a.mode === Bn && u ===
|
|
4012
|
+
if (a.mode === Bn && u === Mn) {
|
|
3965
4013
|
if (!p) throw new z.SubTransaction("Cannot enter a sub-transaction with READWRITE mode when parent transaction is READONLY");
|
|
3966
4014
|
a = null;
|
|
3967
4015
|
}
|
|
3968
|
-
a && f.forEach(function(
|
|
3969
|
-
if (a && a.storeNames.indexOf(
|
|
3970
|
-
if (!p) throw new z.SubTransaction("Table " +
|
|
4016
|
+
a && f.forEach(function(w) {
|
|
4017
|
+
if (a && a.storeNames.indexOf(w) === -1) {
|
|
4018
|
+
if (!p) throw new z.SubTransaction("Table " + w + " not included in parent transaction.");
|
|
3971
4019
|
a = null;
|
|
3972
4020
|
}
|
|
3973
4021
|
}), p && a && !a.active && (a = null);
|
|
3974
4022
|
}
|
|
3975
|
-
} catch (
|
|
4023
|
+
} catch (w) {
|
|
3976
4024
|
return a ? a._promise(null, function(x, g) {
|
|
3977
|
-
g(
|
|
3978
|
-
}) : we(
|
|
4025
|
+
g(w);
|
|
4026
|
+
}) : we(w);
|
|
3979
4027
|
}
|
|
3980
|
-
var v = (function
|
|
4028
|
+
var v = (function w(x, g, O, b, T) {
|
|
3981
4029
|
return X.resolve().then(function() {
|
|
3982
|
-
var
|
|
3983
|
-
if (N.explicit = !0,
|
|
4030
|
+
var A = Y.transless || Y, N = x._createTransaction(g, O, x._dbSchema, b);
|
|
4031
|
+
if (N.explicit = !0, A = { trans: N, transless: A }, b) N.idbtrans = b.idbtrans;
|
|
3984
4032
|
else try {
|
|
3985
4033
|
N.create(), N.idbtrans._explicit = !0, x._state.PR1398_maxLoop = 3;
|
|
3986
4034
|
} catch (k) {
|
|
3987
4035
|
return k.name === lt.InvalidState && x.isOpen() && 0 < --x._state.PR1398_maxLoop ? (console.warn("Dexie: Need to reopen db"), x.close({ disableAutoOpen: !1 }), x.open().then(function() {
|
|
3988
|
-
return
|
|
4036
|
+
return w(x, g, O, null, T);
|
|
3989
4037
|
})) : we(k);
|
|
3990
4038
|
}
|
|
3991
4039
|
var C, R = bt(T);
|
|
3992
|
-
return R && Nt(),
|
|
4040
|
+
return R && Nt(), A = X.follow(function() {
|
|
3993
4041
|
var k;
|
|
3994
4042
|
(C = T.call(N, N)) && (R ? (k = it.bind(null, null), C.then(k, k)) : typeof C.next == "function" && typeof C.throw == "function" && (C = tr(C)));
|
|
3995
|
-
},
|
|
4043
|
+
}, A), (C && typeof C.then == "function" ? X.resolve(C).then(function(k) {
|
|
3996
4044
|
return N.active ? k : we(new z.PrematureCommit("Transaction committed too early. See http://bit.ly/2kdckMn"));
|
|
3997
|
-
}) :
|
|
4045
|
+
}) : A.then(function() {
|
|
3998
4046
|
return C;
|
|
3999
4047
|
})).then(function(k) {
|
|
4000
4048
|
return b && N._resolve(), N._completion.then(function() {
|
|
@@ -4009,7 +4057,7 @@ function Pi() {
|
|
|
4009
4057
|
return r._whenReady(v);
|
|
4010
4058
|
}) : this._whenReady(v);
|
|
4011
4059
|
}, _e.prototype.table = function(e) {
|
|
4012
|
-
if (!
|
|
4060
|
+
if (!G(this._allTables, e)) throw new z.InvalidTable("Table ".concat(e, " does not exist"));
|
|
4013
4061
|
return this._allTables[e];
|
|
4014
4062
|
}, _e);
|
|
4015
4063
|
function _e(e, t) {
|
|
@@ -4017,27 +4065,27 @@ function Pi() {
|
|
|
4017
4065
|
this._middlewares = {}, this.verno = 0;
|
|
4018
4066
|
var r = _e.dependencies;
|
|
4019
4067
|
this._options = t = i({ addons: _e.addons, autoOpen: !0, indexedDB: r.indexedDB, IDBKeyRange: r.IDBKeyRange, cache: "cloned" }, t), this._deps = { indexedDB: t.indexedDB, IDBKeyRange: t.IDBKeyRange }, r = t.addons, this._dbSchema = {}, this._versions = [], this._storeNames = [], this._allTables = {}, this.idbdb = null, this._novip = this;
|
|
4020
|
-
var a, u, f, p, v,
|
|
4021
|
-
|
|
4022
|
-
|
|
4023
|
-
}),
|
|
4024
|
-
|
|
4025
|
-
}), this._state =
|
|
4068
|
+
var a, u, f, p, v, w = { dbOpenError: null, isBeingOpened: !1, onReadyBeingFired: null, openComplete: !1, dbReadyResolve: c, dbReadyPromise: null, cancelOpen: c, openCanceller: null, autoSchema: !0, PR1398_maxLoop: 3, autoOpen: t.autoOpen };
|
|
4069
|
+
w.dbReadyPromise = new X(function(g) {
|
|
4070
|
+
w.dbReadyResolve = g;
|
|
4071
|
+
}), w.openCanceller = new X(function(g, O) {
|
|
4072
|
+
w.cancelOpen = O;
|
|
4073
|
+
}), this._state = w, this.name = e, this.on = Bt(this, "populate", "blocked", "versionchange", "close", { ready: [Oe, c] }), this.once = function(g, O) {
|
|
4026
4074
|
var b = function() {
|
|
4027
|
-
for (var T = [],
|
|
4028
|
-
n.on(g).unsubscribe(b),
|
|
4075
|
+
for (var T = [], A = 0; A < arguments.length; A++) T[A] = arguments[A];
|
|
4076
|
+
n.on(g).unsubscribe(b), O.apply(n, T);
|
|
4029
4077
|
};
|
|
4030
4078
|
return n.on(g, b);
|
|
4031
4079
|
}, this.on.ready.subscribe = te(this.on.ready.subscribe, function(g) {
|
|
4032
|
-
return function(
|
|
4080
|
+
return function(O, b) {
|
|
4033
4081
|
_e.vip(function() {
|
|
4034
|
-
var T,
|
|
4035
|
-
|
|
4036
|
-
T.on.ready.unsubscribe(
|
|
4082
|
+
var T, A = n._state;
|
|
4083
|
+
A.openComplete ? (A.dbOpenError || X.resolve().then(O), b && g(O)) : A.onReadyBeingFired ? (A.onReadyBeingFired.push(O), b && g(O)) : (g(O), T = n, b || g(function N() {
|
|
4084
|
+
T.on.ready.unsubscribe(O), T.on.ready.unsubscribe(N);
|
|
4037
4085
|
}));
|
|
4038
4086
|
});
|
|
4039
4087
|
};
|
|
4040
|
-
}), this.Collection = (a = this,
|
|
4088
|
+
}), this.Collection = (a = this, Mt(ka.prototype, function(C, N) {
|
|
4041
4089
|
this.db = a;
|
|
4042
4090
|
var b = xr, T = null;
|
|
4043
4091
|
if (N) try {
|
|
@@ -4045,17 +4093,17 @@ function Pi() {
|
|
|
4045
4093
|
} catch (R) {
|
|
4046
4094
|
T = R;
|
|
4047
4095
|
}
|
|
4048
|
-
var
|
|
4049
|
-
this._ctx = { table: N, index:
|
|
4050
|
-
})), this.Table = (u = this,
|
|
4051
|
-
this.db = u, this._tx = b, this.name = g, this.schema =
|
|
4052
|
-
})), this.Transaction = (f = this,
|
|
4096
|
+
var A = C._ctx, N = A.table, C = N.hook.reading.fire;
|
|
4097
|
+
this._ctx = { table: N, index: A.index, isPrimKey: !A.index || N.schema.primKey.keyPath && A.index === N.schema.primKey.name, range: b, keysOnly: !1, dir: "next", unique: "", algorithm: null, filter: null, replayFilter: null, justLimit: !0, isMatch: null, offset: 0, limit: 1 / 0, error: T, or: A.or, valueMapper: C !== o ? C : null };
|
|
4098
|
+
})), this.Table = (u = this, Mt(Cr.prototype, function(g, O, b) {
|
|
4099
|
+
this.db = u, this._tx = b, this.name = g, this.schema = O, this.hook = u._allTables[g] ? u._allTables[g].hook : Bt(null, { creating: [se, c], reading: [S, o], updating: [be, c], deleting: [ge, c] });
|
|
4100
|
+
})), this.Transaction = (f = this, Mt(Ba.prototype, function(g, O, b, T, A) {
|
|
4053
4101
|
var N = this;
|
|
4054
|
-
g !== "readonly" &&
|
|
4055
|
-
C = (C = b[C]) === null || C === void 0 ? void 0 : C.yProps, C && (
|
|
4102
|
+
g !== "readonly" && O.forEach(function(C) {
|
|
4103
|
+
C = (C = b[C]) === null || C === void 0 ? void 0 : C.yProps, C && (O = O.concat(C.map(function(R) {
|
|
4056
4104
|
return R.updatesTable;
|
|
4057
4105
|
})));
|
|
4058
|
-
}), this.db = f, this.mode = g, this.storeNames =
|
|
4106
|
+
}), this.db = f, this.mode = g, this.storeNames = O, this.schema = b, this.chromeTransactionDurability = T, this.idbtrans = null, this.on = Bt(this, "complete", "error", "abort"), this.parent = A || null, this.active = !0, this._reculock = 0, this._blockedFuncs = [], this._resolve = null, this._reject = null, this._waitingFor = null, this._waitingQueue = null, this._spinCount = 0, this._completion = new X(function(C, R) {
|
|
4059
4107
|
N._resolve = C, N._reject = R;
|
|
4060
4108
|
}), this._completion.then(function() {
|
|
4061
4109
|
N.active = !1, N.on.complete.fire();
|
|
@@ -4063,38 +4111,38 @@ function Pi() {
|
|
|
4063
4111
|
var R = N.active;
|
|
4064
4112
|
return N.active = !1, N.on.error.fire(C), N.parent ? N.parent._reject(C) : R && N.idbtrans && N.idbtrans.abort(), we(C);
|
|
4065
4113
|
});
|
|
4066
|
-
})), this.Version = (p = this,
|
|
4114
|
+
})), this.Version = (p = this, Mt(Va.prototype, function(g) {
|
|
4067
4115
|
this.db = p, this._cfg = { version: g, storesSource: null, dbschema: {}, tables: {}, contentUpgrade: null };
|
|
4068
|
-
})), this.WhereClause = (v = this,
|
|
4069
|
-
if (this.db = v, this._ctx = { table: g, index:
|
|
4070
|
-
return re(
|
|
4071
|
-
}, this._max = function(T,
|
|
4072
|
-
return 0 < re(T,
|
|
4073
|
-
}, this._min = function(T,
|
|
4074
|
-
return re(T,
|
|
4116
|
+
})), this.WhereClause = (v = this, Mt(Pr.prototype, function(g, O, b) {
|
|
4117
|
+
if (this.db = v, this._ctx = { table: g, index: O === ":id" ? null : O, or: b }, this._cmp = this._ascending = re, this._descending = function(T, A) {
|
|
4118
|
+
return re(A, T);
|
|
4119
|
+
}, this._max = function(T, A) {
|
|
4120
|
+
return 0 < re(T, A) ? T : A;
|
|
4121
|
+
}, this._min = function(T, A) {
|
|
4122
|
+
return re(T, A) < 0 ? T : A;
|
|
4075
4123
|
}, this._IDBKeyRange = v._deps.IDBKeyRange, !this._IDBKeyRange) throw new z.MissingAPI();
|
|
4076
4124
|
})), this.on("versionchange", function(g) {
|
|
4077
4125
|
0 < g.newVersion ? console.warn("Another connection wants to upgrade database '".concat(n.name, "'. Closing db now to resume the upgrade.")) : console.warn("Another connection wants to delete database '".concat(n.name, "'. Closing db now to resume the delete request.")), n.close({ disableAutoOpen: !1 });
|
|
4078
4126
|
}), this.on("blocked", function(g) {
|
|
4079
4127
|
!g.newVersion || g.newVersion < g.oldVersion ? console.warn("Dexie.delete('".concat(n.name, "') was blocked")) : console.warn("Upgrade '".concat(n.name, "' blocked by other connection holding version ").concat(g.oldVersion / 10));
|
|
4080
|
-
}), this._maxKey = Lt(t.IDBKeyRange), this._createTransaction = function(g,
|
|
4081
|
-
return new n.Transaction(g,
|
|
4128
|
+
}), this._maxKey = Lt(t.IDBKeyRange), this._createTransaction = function(g, O, b, T) {
|
|
4129
|
+
return new n.Transaction(g, O, b, n._options.chromeTransactionDurability, T);
|
|
4082
4130
|
}, this._fireOnBlocked = function(g) {
|
|
4083
|
-
n.on("blocked").fire(g),
|
|
4084
|
-
return
|
|
4085
|
-
}).map(function(
|
|
4086
|
-
return
|
|
4131
|
+
n.on("blocked").fire(g), At.filter(function(O) {
|
|
4132
|
+
return O.name === n.name && O !== n && !O._state.vcFired;
|
|
4133
|
+
}).map(function(O) {
|
|
4134
|
+
return O.on("versionchange").fire(g);
|
|
4087
4135
|
});
|
|
4088
4136
|
}, this.use(Wa), this.use(Ha), this.use(Ya), this.use(Xa), this.use($a);
|
|
4089
|
-
var x = new Proxy(this, { get: function(g,
|
|
4090
|
-
if (
|
|
4091
|
-
if (
|
|
4092
|
-
return wn(n.table(
|
|
4137
|
+
var x = new Proxy(this, { get: function(g, O, b) {
|
|
4138
|
+
if (O === "_vip") return !0;
|
|
4139
|
+
if (O === "table") return function(A) {
|
|
4140
|
+
return wn(n.table(A), x);
|
|
4093
4141
|
};
|
|
4094
|
-
var T = Reflect.get(g,
|
|
4095
|
-
return T instanceof Cr ? wn(T, x) :
|
|
4096
|
-
return wn(
|
|
4097
|
-
}) :
|
|
4142
|
+
var T = Reflect.get(g, O, b);
|
|
4143
|
+
return T instanceof Cr ? wn(T, x) : O === "tables" ? T.map(function(A) {
|
|
4144
|
+
return wn(A, x);
|
|
4145
|
+
}) : O === "_createTransaction" ? function() {
|
|
4098
4146
|
return wn(T.apply(this, arguments), x);
|
|
4099
4147
|
} : T;
|
|
4100
4148
|
} });
|
|
@@ -4117,19 +4165,19 @@ function Pi() {
|
|
|
4117
4165
|
}
|
|
4118
4166
|
function zr(e) {
|
|
4119
4167
|
var t, n = !1, r = new Za(function(a) {
|
|
4120
|
-
var u = bt(e), f, p = !1, v = {},
|
|
4168
|
+
var u = bt(e), f, p = !1, v = {}, w = {}, x = { get closed() {
|
|
4121
4169
|
return p;
|
|
4122
4170
|
}, unsubscribe: function() {
|
|
4123
4171
|
p || (p = !0, f && f.abort(), g && ut.storagemutated.unsubscribe(b));
|
|
4124
4172
|
} };
|
|
4125
4173
|
a.start && a.start(x);
|
|
4126
|
-
var g = !1,
|
|
4174
|
+
var g = !1, O = function() {
|
|
4127
4175
|
return Fn(T);
|
|
4128
|
-
}, b = function(
|
|
4129
|
-
yn(v,
|
|
4176
|
+
}, b = function(A) {
|
|
4177
|
+
yn(v, A), Hn(w, v) && O();
|
|
4130
4178
|
}, T = function() {
|
|
4131
|
-
var
|
|
4132
|
-
!p && _n.indexedDB && (v = {},
|
|
4179
|
+
var A, N, C;
|
|
4180
|
+
!p && _n.indexedDB && (v = {}, A = {}, f && f.abort(), f = new AbortController(), C = (function(R) {
|
|
4133
4181
|
var k = Tt();
|
|
4134
4182
|
try {
|
|
4135
4183
|
u && Nt();
|
|
@@ -4138,11 +4186,11 @@ function Pi() {
|
|
|
4138
4186
|
} finally {
|
|
4139
4187
|
k && xt();
|
|
4140
4188
|
}
|
|
4141
|
-
})(N = { subscr:
|
|
4189
|
+
})(N = { subscr: A, signal: f.signal, requery: O, querier: e, trans: null }), Promise.resolve(C).then(function(R) {
|
|
4142
4190
|
n = !0, t = R, p || N.signal.aborted || (v = {}, (function(k) {
|
|
4143
|
-
for (var P in k) if (
|
|
4191
|
+
for (var P in k) if (G(k, P)) return;
|
|
4144
4192
|
return 1;
|
|
4145
|
-
})(
|
|
4193
|
+
})(w = A) || g || (ut(qt, b), g = !0), Fn(function() {
|
|
4146
4194
|
return !p && a.next && a.next(R);
|
|
4147
4195
|
}));
|
|
4148
4196
|
}, function(R) {
|
|
@@ -4151,7 +4199,7 @@ function Pi() {
|
|
|
4151
4199
|
});
|
|
4152
4200
|
}));
|
|
4153
4201
|
};
|
|
4154
|
-
return setTimeout(
|
|
4202
|
+
return setTimeout(O, 0), x;
|
|
4155
4203
|
});
|
|
4156
4204
|
return r.hasValue = function() {
|
|
4157
4205
|
return n;
|
|
@@ -4191,7 +4239,7 @@ function Pi() {
|
|
|
4191
4239
|
var t, n;
|
|
4192
4240
|
}, defineClass: function() {
|
|
4193
4241
|
return function(e) {
|
|
4194
|
-
|
|
4242
|
+
D(this, e);
|
|
4195
4243
|
};
|
|
4196
4244
|
}, ignoreTransaction: function(e) {
|
|
4197
4245
|
return Y.trans ? ht(Y.transless, e) : e();
|
|
@@ -4218,12 +4266,12 @@ function Pi() {
|
|
|
4218
4266
|
}, Promise: X, debug: { get: function() {
|
|
4219
4267
|
return Ne;
|
|
4220
4268
|
}, set: function(e) {
|
|
4221
|
-
|
|
4222
|
-
} }, derive: B, extend:
|
|
4269
|
+
Ae(e);
|
|
4270
|
+
} }, derive: B, extend: D, props: Q, override: te, Events: Bt, on: ut, liveQuery: zr, extendObservabilitySet: yn, getByKeyPath: de, setByKeyPath: le, delByKeyPath: function(e, t) {
|
|
4223
4271
|
typeof t == "string" ? le(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
4224
4272
|
le(e, n, void 0);
|
|
4225
4273
|
});
|
|
4226
|
-
}, shallowClone: me, deepClone: Ye, getObjectDiff: nr, cmp: re, asap: Z, minKey: -1 / 0, addons: [], connections:
|
|
4274
|
+
}, shallowClone: me, deepClone: Ye, getObjectDiff: nr, cmp: re, asap: Z, minKey: -1 / 0, addons: [], connections: At, errnames: lt, dependencies: _n, cache: gt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
|
|
4227
4275
|
return parseInt(e);
|
|
4228
4276
|
}).reduce(function(e, t, n) {
|
|
4229
4277
|
return e + t / Math.pow(10, 2 * n);
|
|
@@ -4243,20 +4291,20 @@ function Pi() {
|
|
|
4243
4291
|
})), typeof addEventListener < "u" && (addEventListener("pagehide", function(e) {
|
|
4244
4292
|
if (!He.disableBfCache && e.persisted) {
|
|
4245
4293
|
Ne && console.debug("Dexie: handling persisted pagehide"), It?.close();
|
|
4246
|
-
for (var t = 0, n =
|
|
4294
|
+
for (var t = 0, n = At; t < n.length; t++) n[t].close({ disableAutoOpen: !1 });
|
|
4247
4295
|
}
|
|
4248
4296
|
}), addEventListener("pageshow", function(e) {
|
|
4249
4297
|
!He.disableBfCache && e.persisted && (Ne && console.debug("Dexie: handling persisted pageshow"), Qr(), or({ all: new Se(-1 / 0, [[]]) }));
|
|
4250
4298
|
})), X.rejectionMapper = function(e, t) {
|
|
4251
|
-
return !e || e instanceof et || e instanceof TypeError || e instanceof SyntaxError || !e.name || !_t[e.name] ? e : (t = new _t[e.name](t || e.message, e), "stack" in e &&
|
|
4299
|
+
return !e || e instanceof et || e instanceof TypeError || e instanceof SyntaxError || !e.name || !_t[e.name] ? e : (t = new _t[e.name](t || e.message, e), "stack" in e && M(t, "stack", { get: function() {
|
|
4252
4300
|
return this.inner.stack;
|
|
4253
4301
|
} }), t);
|
|
4254
|
-
},
|
|
4255
|
-
return new
|
|
4302
|
+
}, Ae(Ne), i(He, Object.freeze({ __proto__: null, Dexie: He, liveQuery: zr, Entity: Nr, cmp: re, PropModification: jt, replacePrefix: function(e, t) {
|
|
4303
|
+
return new jt({ replacePrefix: [e, t] });
|
|
4256
4304
|
}, add: function(e) {
|
|
4257
|
-
return new
|
|
4305
|
+
return new jt({ add: e });
|
|
4258
4306
|
}, remove: function(e) {
|
|
4259
|
-
return new
|
|
4307
|
+
return new jt({ remove: e });
|
|
4260
4308
|
}, default: He, RangeSet: Se, mergeRanges: Gt, rangesOverlap: Kr }), { default: He }), He;
|
|
4261
4309
|
});
|
|
4262
4310
|
})(xn)), xn.exports;
|
|
@@ -4266,8 +4314,8 @@ const hr = /* @__PURE__ */ ba(Fi), Zr = /* @__PURE__ */ Symbol.for("Dexie"), Je
|
|
|
4266
4314
|
if (hr.semVer !== Je.semVer)
|
|
4267
4315
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${hr.semVer} and ${Je.semVer}`);
|
|
4268
4316
|
const {
|
|
4269
|
-
liveQuery:
|
|
4270
|
-
mergeRanges:
|
|
4317
|
+
liveQuery: Ao,
|
|
4318
|
+
mergeRanges: Oo,
|
|
4271
4319
|
rangesOverlap: Co,
|
|
4272
4320
|
RangeSet: Do,
|
|
4273
4321
|
cmp: Io,
|
|
@@ -4287,8 +4335,8 @@ class Bi {
|
|
|
4287
4335
|
[i.name]: i.schema
|
|
4288
4336
|
};
|
|
4289
4337
|
if (d)
|
|
4290
|
-
for (const [y,
|
|
4291
|
-
h[y] =
|
|
4338
|
+
for (const [y, _] of Object.entries(d))
|
|
4339
|
+
h[y] = _.schema;
|
|
4292
4340
|
h[Jr] = "++sequenceNumber, id", h[ea] = "key", this.databaseInstance.version(1).stores(h);
|
|
4293
4341
|
}
|
|
4294
4342
|
async get(s) {
|
|
@@ -4310,8 +4358,8 @@ class Bi {
|
|
|
4310
4358
|
await this.metaTable.put({ key: "head", value: s });
|
|
4311
4359
|
}
|
|
4312
4360
|
async commit(s) {
|
|
4313
|
-
const { creates: l, updates: i, deletes: d, onProgress: h } = s, y = this.databaseInstance.table(this.tableName),
|
|
4314
|
-
let
|
|
4361
|
+
const { creates: l, updates: i, deletes: d, onProgress: h } = s, y = this.databaseInstance.table(this.tableName), _ = l.length + i.length + d.length;
|
|
4362
|
+
let D = 0;
|
|
4315
4363
|
try {
|
|
4316
4364
|
await this.databaseInstance.transaction(
|
|
4317
4365
|
"rw",
|
|
@@ -4319,15 +4367,15 @@ class Bi {
|
|
|
4319
4367
|
this.changeLogTable,
|
|
4320
4368
|
this.metaTable,
|
|
4321
4369
|
async () => {
|
|
4322
|
-
const F = i.length > 0 ? await y.bulkGet(i.map((
|
|
4370
|
+
const F = i.length > 0 ? await y.bulkGet(i.map((M) => M.id)) : [], $ = d.length > 0 ? await y.bulkGet(d) : [];
|
|
4323
4371
|
if (l.length > 0)
|
|
4324
4372
|
try {
|
|
4325
|
-
await y.bulkAdd(l),
|
|
4326
|
-
} catch (
|
|
4327
|
-
const B = this.extractFailedRecordFromError(
|
|
4373
|
+
await y.bulkAdd(l), D += l.length, h(D, _);
|
|
4374
|
+
} catch (M) {
|
|
4375
|
+
const B = this.extractFailedRecordFromError(M, l);
|
|
4328
4376
|
qe("STORE_BULK_ADD_FAILED", {
|
|
4329
|
-
detail:
|
|
4330
|
-
cause:
|
|
4377
|
+
detail: M instanceof Error ? M.message : String(M),
|
|
4378
|
+
cause: M instanceof Error ? M : void 0,
|
|
4331
4379
|
...B && {
|
|
4332
4380
|
ref: { tagName: B.tagName, id: B.id }
|
|
4333
4381
|
}
|
|
@@ -4335,12 +4383,12 @@ class Bi {
|
|
|
4335
4383
|
}
|
|
4336
4384
|
if (i.length > 0)
|
|
4337
4385
|
try {
|
|
4338
|
-
await y.bulkPut(i),
|
|
4339
|
-
} catch (
|
|
4340
|
-
const B = this.extractFailedRecordFromError(
|
|
4386
|
+
await y.bulkPut(i), D += i.length, h(D, _);
|
|
4387
|
+
} catch (M) {
|
|
4388
|
+
const B = this.extractFailedRecordFromError(M, i);
|
|
4341
4389
|
qe("STORE_BULK_UPDATE_FAILED", {
|
|
4342
|
-
detail:
|
|
4343
|
-
cause:
|
|
4390
|
+
detail: M instanceof Error ? M.message : String(M),
|
|
4391
|
+
cause: M instanceof Error ? M : void 0,
|
|
4344
4392
|
...B && {
|
|
4345
4393
|
ref: { tagName: B.tagName, id: B.id }
|
|
4346
4394
|
}
|
|
@@ -4348,26 +4396,26 @@ class Bi {
|
|
|
4348
4396
|
}
|
|
4349
4397
|
if (d.length > 0)
|
|
4350
4398
|
try {
|
|
4351
|
-
await y.bulkDelete(d),
|
|
4352
|
-
} catch (
|
|
4399
|
+
await y.bulkDelete(d), D += d.length, h(D, _);
|
|
4400
|
+
} catch (M) {
|
|
4353
4401
|
qe("STORE_DELETE_FAILED", {
|
|
4354
|
-
detail:
|
|
4355
|
-
cause:
|
|
4402
|
+
detail: M instanceof Error ? M.message : String(M),
|
|
4403
|
+
cause: M instanceof Error ? M : void 0
|
|
4356
4404
|
});
|
|
4357
4405
|
}
|
|
4358
|
-
const
|
|
4359
|
-
await this.changeLogTable.where("sequenceNumber").above(
|
|
4360
|
-
const Q =
|
|
4406
|
+
const G = await this.getHead();
|
|
4407
|
+
await this.changeLogTable.where("sequenceNumber").above(G).delete();
|
|
4408
|
+
const Q = G + 1, fe = {
|
|
4361
4409
|
id: crypto.randomUUID(),
|
|
4362
4410
|
sequenceNumber: Q,
|
|
4363
4411
|
timestamp: Date.now(),
|
|
4364
4412
|
operations: {
|
|
4365
4413
|
creates: l,
|
|
4366
|
-
updates: i.map((
|
|
4414
|
+
updates: i.map((M, B) => ({
|
|
4367
4415
|
before: F[B],
|
|
4368
|
-
after:
|
|
4416
|
+
after: M
|
|
4369
4417
|
})),
|
|
4370
|
-
deletes:
|
|
4418
|
+
deletes: $.filter(Boolean)
|
|
4371
4419
|
}
|
|
4372
4420
|
};
|
|
4373
4421
|
await this.changeLogTable.add(fe), await this.setHead(Q);
|
|
@@ -4405,7 +4453,7 @@ class Bi {
|
|
|
4405
4453
|
const i = this.databaseInstance.table(this.tableName);
|
|
4406
4454
|
await this.databaseInstance.transaction("rw", i, this.metaTable, async () => {
|
|
4407
4455
|
const { creates: d, updates: h, deletes: y } = l.operations;
|
|
4408
|
-
d.length > 0 && await i.bulkDelete(d.map((
|
|
4456
|
+
d.length > 0 && await i.bulkDelete(d.map((_) => _.id)), h.length > 0 && await i.bulkPut(h.map((_) => _.before)), y.length > 0 && await i.bulkAdd(y), await this.setHead(s - 1);
|
|
4409
4457
|
});
|
|
4410
4458
|
}
|
|
4411
4459
|
async redo() {
|
|
@@ -4414,8 +4462,8 @@ class Bi {
|
|
|
4414
4462
|
return;
|
|
4415
4463
|
const d = this.databaseInstance.table(this.tableName);
|
|
4416
4464
|
await this.databaseInstance.transaction("rw", d, this.metaTable, async () => {
|
|
4417
|
-
const { creates: h, updates: y, deletes:
|
|
4418
|
-
h.length > 0 && await d.bulkAdd(h), y.length > 0 && await d.bulkPut(y.map((
|
|
4465
|
+
const { creates: h, updates: y, deletes: _ } = i.operations;
|
|
4466
|
+
h.length > 0 && await d.bulkAdd(h), y.length > 0 && await d.bulkPut(y.map((D) => D.after)), _.length > 0 && await d.bulkDelete(_.map((D) => D.id)), await this.setHead(l);
|
|
4419
4467
|
});
|
|
4420
4468
|
}
|
|
4421
4469
|
async getChangeLog() {
|
|
@@ -4431,62 +4479,62 @@ class Bi {
|
|
|
4431
4479
|
this.databaseInstance.isOpen() && (this.databaseInstance.close(), await new Promise((s) => setTimeout(s, 20))), await Je.delete(this.databaseInstance.name);
|
|
4432
4480
|
}
|
|
4433
4481
|
}
|
|
4434
|
-
function
|
|
4482
|
+
function Mi(m) {
|
|
4435
4483
|
const { databaseName: s, dialecteConfig: l } = m, { xmlElements: i, additionalTables: d } = l.database.tables, h = new Je(s), y = {
|
|
4436
4484
|
[i.name]: i.schema
|
|
4437
4485
|
};
|
|
4438
4486
|
if (d)
|
|
4439
|
-
for (const [
|
|
4440
|
-
y[
|
|
4487
|
+
for (const [_, D] of Object.entries(d))
|
|
4488
|
+
y[_] = D.schema;
|
|
4441
4489
|
return h.version(1).stores(y), h;
|
|
4442
4490
|
}
|
|
4443
4491
|
async function wa(m) {
|
|
4444
4492
|
const { databaseInstance: s, elementsTableName: l, records: i } = m, d = s.table(l);
|
|
4445
4493
|
await s.transaction("rw", d, () => d.bulkAdd(i));
|
|
4446
4494
|
}
|
|
4447
|
-
async function
|
|
4495
|
+
async function ji(m) {
|
|
4448
4496
|
const { databaseInstance: s, elementsTableName: l, updates: i } = m;
|
|
4449
4497
|
if (i.length === 0) return;
|
|
4450
4498
|
const d = s.table(l);
|
|
4451
4499
|
await s.transaction("rw", d, async () => {
|
|
4452
4500
|
for (const { recordId: h, ...y } of i) {
|
|
4453
|
-
const
|
|
4454
|
-
if (!
|
|
4455
|
-
const
|
|
4501
|
+
const _ = await d.get(h);
|
|
4502
|
+
if (!_) continue;
|
|
4503
|
+
const D = { ...y };
|
|
4456
4504
|
if (y.attributes) {
|
|
4457
|
-
const F = [...
|
|
4458
|
-
for (const
|
|
4459
|
-
const
|
|
4460
|
-
|
|
4505
|
+
const F = [..._.attributes];
|
|
4506
|
+
for (const $ of y.attributes) {
|
|
4507
|
+
const G = F.findIndex((Q) => Q.name === $.name);
|
|
4508
|
+
G >= 0 ? F[G] = $ : F.push($);
|
|
4461
4509
|
}
|
|
4462
|
-
|
|
4510
|
+
D.attributes = F;
|
|
4463
4511
|
}
|
|
4464
4512
|
if (y.children) {
|
|
4465
|
-
const F = [...
|
|
4466
|
-
for (const
|
|
4467
|
-
const
|
|
4468
|
-
|
|
4513
|
+
const F = [..._.children];
|
|
4514
|
+
for (const $ of y.children) {
|
|
4515
|
+
const G = F.findIndex((Q) => Q.id === $.id);
|
|
4516
|
+
G >= 0 ? F[G] = $ : F.push($);
|
|
4469
4517
|
}
|
|
4470
|
-
|
|
4518
|
+
D.children = F;
|
|
4471
4519
|
}
|
|
4472
|
-
await d.update(h,
|
|
4520
|
+
await d.update(h, D);
|
|
4473
4521
|
}
|
|
4474
4522
|
});
|
|
4475
4523
|
}
|
|
4476
|
-
async function
|
|
4524
|
+
async function Mo(m) {
|
|
4477
4525
|
const { databaseInstance: s, elementsTableName: l, updates: i } = m;
|
|
4478
4526
|
if (i.length === 0) return;
|
|
4479
4527
|
const d = s.table(l);
|
|
4480
4528
|
await s.transaction("rw", d, async () => {
|
|
4481
4529
|
for (const { recordId: h, attributes: y } of i) {
|
|
4482
|
-
const
|
|
4483
|
-
if (!
|
|
4484
|
-
const
|
|
4530
|
+
const _ = await d.get(h);
|
|
4531
|
+
if (!_) continue;
|
|
4532
|
+
const D = [..._.attributes];
|
|
4485
4533
|
for (const F of y) {
|
|
4486
|
-
const
|
|
4487
|
-
|
|
4534
|
+
const $ = D.findIndex((G) => G.name === F.name);
|
|
4535
|
+
$ >= 0 ? D[$] = F : D.push(F);
|
|
4488
4536
|
}
|
|
4489
|
-
await d.update(h, { attributes:
|
|
4537
|
+
await d.update(h, { attributes: D });
|
|
4490
4538
|
}
|
|
4491
4539
|
});
|
|
4492
4540
|
}
|
|
@@ -4496,7 +4544,7 @@ async function Ki(m) {
|
|
|
4496
4544
|
const d = s.table(l);
|
|
4497
4545
|
await s.transaction("rw", d, () => d.bulkDelete(i));
|
|
4498
4546
|
}
|
|
4499
|
-
async function
|
|
4547
|
+
async function jo(m) {
|
|
4500
4548
|
if (await Je.exists(m))
|
|
4501
4549
|
return await Je.delete(m);
|
|
4502
4550
|
}
|
|
@@ -4538,7 +4586,7 @@ function Wi() {
|
|
|
4538
4586
|
(function(s) {
|
|
4539
4587
|
s.parser = function(c, o) {
|
|
4540
4588
|
return new i(c, o);
|
|
4541
|
-
}, s.SAXParser = i, s.SAXStream =
|
|
4589
|
+
}, s.SAXParser = i, s.SAXStream = G, s.createStream = F, s.MAX_BUFFER_LENGTH = 64 * 1024;
|
|
4542
4590
|
var l = [
|
|
4543
4591
|
"comment",
|
|
4544
4592
|
"sgmlDecl",
|
|
@@ -4577,7 +4625,7 @@ function Wi() {
|
|
|
4577
4625
|
if (!(this instanceof i))
|
|
4578
4626
|
return new i(c, o);
|
|
4579
4627
|
var S = this;
|
|
4580
|
-
h(S), S.q = S.c = "", S.bufferCheckPosition = s.MAX_BUFFER_LENGTH, S.encoding = null, S.opt = o || {}, S.opt.lowercase = S.opt.lowercase || S.opt.lowercasetags, S.looseCase = S.opt.lowercase ? "toLowerCase" : "toUpperCase", S.opt.maxEntityCount = S.opt.maxEntityCount || 512, S.opt.maxEntityDepth = S.opt.maxEntityDepth || 4, S.entityCount = S.entityDepth = 0, S.tags = [], S.closed = S.closedRoot = S.sawRoot = !1, S.tag = S.error = null, S.strict = !!c, S.noscript = !!(c || S.opt.noscript), S.state =
|
|
4628
|
+
h(S), S.q = S.c = "", S.bufferCheckPosition = s.MAX_BUFFER_LENGTH, S.encoding = null, S.opt = o || {}, S.opt.lowercase = S.opt.lowercase || S.opt.lowercasetags, S.looseCase = S.opt.lowercase ? "toLowerCase" : "toUpperCase", S.opt.maxEntityCount = S.opt.maxEntityCount || 512, S.opt.maxEntityDepth = S.opt.maxEntityDepth || 4, S.entityCount = S.entityDepth = 0, S.tags = [], S.closed = S.closedRoot = S.sawRoot = !1, S.tag = S.error = null, S.strict = !!c, S.noscript = !!(c || S.opt.noscript), S.state = I.BEGIN, S.strictEntities = S.opt.strictEntities, S.ENTITIES = S.strictEntities ? Object.create(s.XML_ENTITIES) : Object.create(s.ENTITIES), S.attribList = [], S.opt.xmlns && (S.ns = Object.create(ue)), S.opt.unquotedAttributeValues === void 0 && (S.opt.unquotedAttributeValues = !c), S.trackPosition = S.opt.position !== !1, S.trackPosition && (S.position = S.line = S.column = 0), Ue(S, "onready");
|
|
4581
4629
|
}
|
|
4582
4630
|
Object.create || (Object.create = function(c) {
|
|
4583
4631
|
function o() {
|
|
@@ -4596,7 +4644,7 @@ function Wi() {
|
|
|
4596
4644
|
if (ge > o)
|
|
4597
4645
|
switch (l[E]) {
|
|
4598
4646
|
case "textNode":
|
|
4599
|
-
|
|
4647
|
+
je(c);
|
|
4600
4648
|
break;
|
|
4601
4649
|
case "cdata":
|
|
4602
4650
|
ye(c, "oncdata", c.cdata), c.cdata = "";
|
|
@@ -4617,7 +4665,7 @@ function Wi() {
|
|
|
4617
4665
|
c[l[o]] = "";
|
|
4618
4666
|
}
|
|
4619
4667
|
function y(c) {
|
|
4620
|
-
|
|
4668
|
+
je(c), c.cdata !== "" && (ye(c, "oncdata", c.cdata), c.cdata = ""), c.script !== "" && (ye(c, "onscript", c.script), c.script = "");
|
|
4621
4669
|
}
|
|
4622
4670
|
i.prototype = {
|
|
4623
4671
|
end: function() {
|
|
@@ -4634,22 +4682,22 @@ function Wi() {
|
|
|
4634
4682
|
y(this);
|
|
4635
4683
|
}
|
|
4636
4684
|
};
|
|
4637
|
-
var
|
|
4685
|
+
var _;
|
|
4638
4686
|
try {
|
|
4639
|
-
|
|
4687
|
+
_ = $i.Stream;
|
|
4640
4688
|
} catch {
|
|
4641
|
-
|
|
4689
|
+
_ = function() {
|
|
4642
4690
|
};
|
|
4643
4691
|
}
|
|
4644
|
-
|
|
4692
|
+
_ || (_ = function() {
|
|
4645
4693
|
});
|
|
4646
|
-
var
|
|
4694
|
+
var D = s.EVENTS.filter(function(c) {
|
|
4647
4695
|
return c !== "error" && c !== "end";
|
|
4648
4696
|
});
|
|
4649
4697
|
function F(c, o) {
|
|
4650
|
-
return new
|
|
4698
|
+
return new G(c, o);
|
|
4651
4699
|
}
|
|
4652
|
-
function
|
|
4700
|
+
function $(c, o) {
|
|
4653
4701
|
if (c.length >= 2) {
|
|
4654
4702
|
if (c[0] === 255 && c[1] === 254)
|
|
4655
4703
|
return "utf-16le";
|
|
@@ -4658,16 +4706,16 @@ function Wi() {
|
|
|
4658
4706
|
}
|
|
4659
4707
|
return c.length >= 3 && c[0] === 239 && c[1] === 187 && c[2] === 191 ? "utf8" : c.length >= 4 ? c[0] === 60 && c[1] === 0 && c[2] === 63 && c[3] === 0 ? "utf-16le" : c[0] === 0 && c[1] === 60 && c[2] === 0 && c[3] === 63 ? "utf-16be" : "utf8" : o ? "utf8" : null;
|
|
4660
4708
|
}
|
|
4661
|
-
function
|
|
4662
|
-
if (!(this instanceof
|
|
4663
|
-
return new
|
|
4664
|
-
|
|
4709
|
+
function G(c, o) {
|
|
4710
|
+
if (!(this instanceof G))
|
|
4711
|
+
return new G(c, o);
|
|
4712
|
+
_.apply(this), this._parser = new i(c, o), this.writable = !0, this.readable = !0;
|
|
4665
4713
|
var S = this;
|
|
4666
4714
|
this._parser.onend = function() {
|
|
4667
4715
|
S.emit("end");
|
|
4668
4716
|
}, this._parser.onerror = function(E) {
|
|
4669
4717
|
S.emit("error", E), S._parser.error = null;
|
|
4670
|
-
}, this._decoder = null, this._decoderBuffer = null,
|
|
4718
|
+
}, this._decoder = null, this._decoderBuffer = null, D.forEach(function(E) {
|
|
4671
4719
|
Object.defineProperty(S, "on" + E, {
|
|
4672
4720
|
get: function() {
|
|
4673
4721
|
return S._parser["on" + E];
|
|
@@ -4682,19 +4730,19 @@ function Wi() {
|
|
|
4682
4730
|
});
|
|
4683
4731
|
});
|
|
4684
4732
|
}
|
|
4685
|
-
|
|
4733
|
+
G.prototype = Object.create(_.prototype, {
|
|
4686
4734
|
constructor: {
|
|
4687
|
-
value:
|
|
4735
|
+
value: G
|
|
4688
4736
|
}
|
|
4689
|
-
}),
|
|
4737
|
+
}), G.prototype._decodeBuffer = function(c, o) {
|
|
4690
4738
|
if (this._decoderBuffer && (c = Buffer.concat([this._decoderBuffer, c]), this._decoderBuffer = null), !this._decoder) {
|
|
4691
|
-
var S =
|
|
4739
|
+
var S = $(c, o);
|
|
4692
4740
|
if (!S)
|
|
4693
4741
|
return this._decoderBuffer = c, "";
|
|
4694
4742
|
this._parser.encoding = S, this._decoder = new TextDecoder(S);
|
|
4695
4743
|
}
|
|
4696
4744
|
return this._decoder.decode(c, { stream: !o });
|
|
4697
|
-
},
|
|
4745
|
+
}, G.prototype.write = function(c) {
|
|
4698
4746
|
if (typeof Buffer == "function" && typeof Buffer.isBuffer == "function" && Buffer.isBuffer(c))
|
|
4699
4747
|
c = this._decodeBuffer(c, !1);
|
|
4700
4748
|
else if (this._decoderBuffer) {
|
|
@@ -4702,7 +4750,7 @@ function Wi() {
|
|
|
4702
4750
|
o && (this._parser.write(o), this.emit("data", o));
|
|
4703
4751
|
}
|
|
4704
4752
|
return this._parser.write(c.toString()), this.emit("data", c), !0;
|
|
4705
|
-
},
|
|
4753
|
+
}, G.prototype.end = function(c) {
|
|
4706
4754
|
if (c && c.length && this.write(c), this._decoderBuffer) {
|
|
4707
4755
|
var o = this._decodeBuffer(Buffer.alloc(0), !0);
|
|
4708
4756
|
o && (this._parser.write(o), this.emit("data", o));
|
|
@@ -4711,14 +4759,14 @@ function Wi() {
|
|
|
4711
4759
|
S && (this._parser.write(S), this.emit("data", S));
|
|
4712
4760
|
}
|
|
4713
4761
|
return this._parser.end(), !0;
|
|
4714
|
-
},
|
|
4762
|
+
}, G.prototype.on = function(c, o) {
|
|
4715
4763
|
var S = this;
|
|
4716
|
-
return !S._parser["on" + c] &&
|
|
4764
|
+
return !S._parser["on" + c] && D.indexOf(c) !== -1 && (S._parser["on" + c] = function() {
|
|
4717
4765
|
var E = arguments.length === 1 ? [arguments[0]] : Array.apply(null, arguments);
|
|
4718
4766
|
E.splice(0, 0, c), S.emit.apply(S, E);
|
|
4719
|
-
}),
|
|
4767
|
+
}), _.prototype.on.call(S, c, o);
|
|
4720
4768
|
};
|
|
4721
|
-
var Q = "[CDATA[", fe = "DOCTYPE",
|
|
4769
|
+
var Q = "[CDATA[", fe = "DOCTYPE", M = "http://www.w3.org/XML/1998/namespace", B = "http://www.w3.org/2000/xmlns/", ue = { xml: M, xmlns: B }, ie = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, xe = /[:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/, te = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD]/, H = /[#:_A-Za-z\u00C0-\u00D6\u00D8-\u00F6\u00F8-\u02FF\u0370-\u037D\u037F-\u1FFF\u200C-\u200D\u2070-\u218F\u2C00-\u2FEF\u3001-\uD7FF\uF900-\uFDCF\uFDF0-\uFFFD\u00B7\u0300-\u036F\u203F-\u2040.\d-]/;
|
|
4722
4770
|
function Z(c) {
|
|
4723
4771
|
return c === " " || c === `
|
|
4724
4772
|
` || c === "\r" || c === " ";
|
|
@@ -4732,82 +4780,82 @@ function Wi() {
|
|
|
4732
4780
|
function me(c, o) {
|
|
4733
4781
|
return c.test(o);
|
|
4734
4782
|
}
|
|
4735
|
-
function
|
|
4783
|
+
function An(c, o) {
|
|
4736
4784
|
return !me(c, o);
|
|
4737
4785
|
}
|
|
4738
|
-
var
|
|
4786
|
+
var I = 0;
|
|
4739
4787
|
s.STATE = {
|
|
4740
|
-
BEGIN:
|
|
4788
|
+
BEGIN: I++,
|
|
4741
4789
|
// leading byte order mark or whitespace
|
|
4742
|
-
BEGIN_WHITESPACE:
|
|
4790
|
+
BEGIN_WHITESPACE: I++,
|
|
4743
4791
|
// leading whitespace
|
|
4744
|
-
TEXT:
|
|
4792
|
+
TEXT: I++,
|
|
4745
4793
|
// general stuff
|
|
4746
|
-
TEXT_ENTITY:
|
|
4794
|
+
TEXT_ENTITY: I++,
|
|
4747
4795
|
// & and such.
|
|
4748
|
-
OPEN_WAKA:
|
|
4796
|
+
OPEN_WAKA: I++,
|
|
4749
4797
|
// <
|
|
4750
|
-
SGML_DECL:
|
|
4798
|
+
SGML_DECL: I++,
|
|
4751
4799
|
// <!BLARG
|
|
4752
|
-
SGML_DECL_QUOTED:
|
|
4800
|
+
SGML_DECL_QUOTED: I++,
|
|
4753
4801
|
// <!BLARG foo "bar
|
|
4754
|
-
DOCTYPE:
|
|
4802
|
+
DOCTYPE: I++,
|
|
4755
4803
|
// <!DOCTYPE
|
|
4756
|
-
DOCTYPE_QUOTED:
|
|
4804
|
+
DOCTYPE_QUOTED: I++,
|
|
4757
4805
|
// <!DOCTYPE "//blah
|
|
4758
|
-
DOCTYPE_DTD:
|
|
4806
|
+
DOCTYPE_DTD: I++,
|
|
4759
4807
|
// <!DOCTYPE "//blah" [ ...
|
|
4760
|
-
DOCTYPE_DTD_QUOTED:
|
|
4808
|
+
DOCTYPE_DTD_QUOTED: I++,
|
|
4761
4809
|
// <!DOCTYPE "//blah" [ "foo
|
|
4762
|
-
COMMENT_STARTING:
|
|
4810
|
+
COMMENT_STARTING: I++,
|
|
4763
4811
|
// <!-
|
|
4764
|
-
COMMENT:
|
|
4812
|
+
COMMENT: I++,
|
|
4765
4813
|
// <!--
|
|
4766
|
-
COMMENT_ENDING:
|
|
4814
|
+
COMMENT_ENDING: I++,
|
|
4767
4815
|
// <!-- blah -
|
|
4768
|
-
COMMENT_ENDED:
|
|
4816
|
+
COMMENT_ENDED: I++,
|
|
4769
4817
|
// <!-- blah --
|
|
4770
|
-
CDATA:
|
|
4818
|
+
CDATA: I++,
|
|
4771
4819
|
// <![CDATA[ something
|
|
4772
|
-
CDATA_ENDING:
|
|
4820
|
+
CDATA_ENDING: I++,
|
|
4773
4821
|
// ]
|
|
4774
|
-
CDATA_ENDING_2:
|
|
4822
|
+
CDATA_ENDING_2: I++,
|
|
4775
4823
|
// ]]
|
|
4776
|
-
PROC_INST:
|
|
4824
|
+
PROC_INST: I++,
|
|
4777
4825
|
// <?hi
|
|
4778
|
-
PROC_INST_BODY:
|
|
4826
|
+
PROC_INST_BODY: I++,
|
|
4779
4827
|
// <?hi there
|
|
4780
|
-
PROC_INST_ENDING:
|
|
4828
|
+
PROC_INST_ENDING: I++,
|
|
4781
4829
|
// <?hi "there" ?
|
|
4782
|
-
OPEN_TAG:
|
|
4830
|
+
OPEN_TAG: I++,
|
|
4783
4831
|
// <strong
|
|
4784
|
-
OPEN_TAG_SLASH:
|
|
4832
|
+
OPEN_TAG_SLASH: I++,
|
|
4785
4833
|
// <strong /
|
|
4786
|
-
ATTRIB:
|
|
4834
|
+
ATTRIB: I++,
|
|
4787
4835
|
// <a
|
|
4788
|
-
ATTRIB_NAME:
|
|
4836
|
+
ATTRIB_NAME: I++,
|
|
4789
4837
|
// <a foo
|
|
4790
|
-
ATTRIB_NAME_SAW_WHITE:
|
|
4838
|
+
ATTRIB_NAME_SAW_WHITE: I++,
|
|
4791
4839
|
// <a foo _
|
|
4792
|
-
ATTRIB_VALUE:
|
|
4840
|
+
ATTRIB_VALUE: I++,
|
|
4793
4841
|
// <a foo=
|
|
4794
|
-
ATTRIB_VALUE_QUOTED:
|
|
4842
|
+
ATTRIB_VALUE_QUOTED: I++,
|
|
4795
4843
|
// <a foo="bar
|
|
4796
|
-
ATTRIB_VALUE_CLOSED:
|
|
4844
|
+
ATTRIB_VALUE_CLOSED: I++,
|
|
4797
4845
|
// <a foo="bar"
|
|
4798
|
-
ATTRIB_VALUE_UNQUOTED:
|
|
4846
|
+
ATTRIB_VALUE_UNQUOTED: I++,
|
|
4799
4847
|
// <a foo=bar
|
|
4800
|
-
ATTRIB_VALUE_ENTITY_Q:
|
|
4848
|
+
ATTRIB_VALUE_ENTITY_Q: I++,
|
|
4801
4849
|
// <foo bar="""
|
|
4802
|
-
ATTRIB_VALUE_ENTITY_U:
|
|
4850
|
+
ATTRIB_VALUE_ENTITY_U: I++,
|
|
4803
4851
|
// <foo bar="
|
|
4804
|
-
CLOSE_TAG:
|
|
4852
|
+
CLOSE_TAG: I++,
|
|
4805
4853
|
// </a
|
|
4806
|
-
CLOSE_TAG_SAW_WHITE:
|
|
4854
|
+
CLOSE_TAG_SAW_WHITE: I++,
|
|
4807
4855
|
// </a >
|
|
4808
|
-
SCRIPT:
|
|
4856
|
+
SCRIPT: I++,
|
|
4809
4857
|
// <script> ...
|
|
4810
|
-
SCRIPT_ENDING:
|
|
4858
|
+
SCRIPT_ENDING: I++
|
|
4811
4859
|
// <script> ... <
|
|
4812
4860
|
}, s.XML_ENTITIES = {
|
|
4813
4861
|
amp: "&",
|
|
@@ -5075,7 +5123,7 @@ function Wi() {
|
|
|
5075
5123
|
});
|
|
5076
5124
|
for (var Rt in s.STATE)
|
|
5077
5125
|
s.STATE[s.STATE[Rt]] = Rt;
|
|
5078
|
-
|
|
5126
|
+
I = s.STATE;
|
|
5079
5127
|
function Ue(c, o, S) {
|
|
5080
5128
|
c[o] && c[o](S);
|
|
5081
5129
|
}
|
|
@@ -5100,22 +5148,22 @@ function Wi() {
|
|
|
5100
5148
|
}
|
|
5101
5149
|
}
|
|
5102
5150
|
function ye(c, o, S) {
|
|
5103
|
-
c.textNode &&
|
|
5151
|
+
c.textNode && je(c), Ue(c, o, S);
|
|
5104
5152
|
}
|
|
5105
|
-
function
|
|
5153
|
+
function je(c) {
|
|
5106
5154
|
c.textNode = ze(c.opt, c.textNode), c.textNode && Ue(c, "ontext", c.textNode), c.textNode = "";
|
|
5107
5155
|
}
|
|
5108
5156
|
function ze(c, o) {
|
|
5109
5157
|
return c.trim && (o = o.trim()), c.normalize && (o = o.replace(/\s+/g, " ")), o;
|
|
5110
5158
|
}
|
|
5111
5159
|
function Ie(c, o) {
|
|
5112
|
-
return
|
|
5160
|
+
return je(c), c.trackPosition && (o += `
|
|
5113
5161
|
Line: ` + c.line + `
|
|
5114
5162
|
Column: ` + c.column + `
|
|
5115
5163
|
Char: ` + c.c), o = new Error(o), c.error = o, Ue(c, "onerror", o), c;
|
|
5116
5164
|
}
|
|
5117
5165
|
function bt(c) {
|
|
5118
|
-
return c.sawRoot && !c.closedRoot && ce(c, "Unclosed root tag"), c.state !==
|
|
5166
|
+
return c.sawRoot && !c.closedRoot && ce(c, "Unclosed root tag"), c.state !== I.BEGIN && c.state !== I.BEGIN_WHITESPACE && c.state !== I.TEXT && Ie(c, "Unexpected end"), je(c), c.c = "", c.closed = !0, Ue(c, "onend"), i.call(c, c.strict, c.opt), c;
|
|
5119
5167
|
}
|
|
5120
5168
|
function ce(c, o) {
|
|
5121
5169
|
if (typeof c != "object" || !(c instanceof i))
|
|
@@ -5139,10 +5187,10 @@ Char: ` + c.c), o = new Error(o), c.error = o, Ue(c, "onerror", o), c;
|
|
|
5139
5187
|
if (c.opt.xmlns) {
|
|
5140
5188
|
var o = wt(c.attribName, !0), S = o.prefix, E = o.local;
|
|
5141
5189
|
if (S === "xmlns")
|
|
5142
|
-
if (E === "xml" && c.attribValue !==
|
|
5190
|
+
if (E === "xml" && c.attribValue !== M)
|
|
5143
5191
|
ce(
|
|
5144
5192
|
c,
|
|
5145
|
-
"xml: prefix must be bound to " +
|
|
5193
|
+
"xml: prefix must be bound to " + M + `
|
|
5146
5194
|
Actual: ` + c.attribValue
|
|
5147
5195
|
);
|
|
5148
5196
|
else if (E === "xmlns" && c.attribValue !== B)
|
|
@@ -5163,7 +5211,7 @@ Actual: ` + c.attribValue
|
|
|
5163
5211
|
});
|
|
5164
5212
|
c.attribName = c.attribValue = "";
|
|
5165
5213
|
}
|
|
5166
|
-
function
|
|
5214
|
+
function Me(c, o) {
|
|
5167
5215
|
if (c.opt.xmlns) {
|
|
5168
5216
|
var S = c.tag, E = wt(c.tagName);
|
|
5169
5217
|
S.prefix = E.prefix, S.local = E.local, S.uri = S.ns[E.prefix] || "", S.prefix && !S.uri && (ce(
|
|
@@ -5178,8 +5226,8 @@ Actual: ` + c.attribValue
|
|
|
5178
5226
|
});
|
|
5179
5227
|
});
|
|
5180
5228
|
for (var ge = 0, be = c.attribList.length; ge < be; ge++) {
|
|
5181
|
-
var Re = c.attribList[ge],
|
|
5182
|
-
name:
|
|
5229
|
+
var Re = c.attribList[ge], Oe = Re[0], Ne = Re[1], Ae = wt(Oe, !0), Fe = Ae.prefix, zt = Ae.local, nt = Fe === "" ? "" : S.ns[Fe] || "", Ve = {
|
|
5230
|
+
name: Oe,
|
|
5183
5231
|
value: Ne,
|
|
5184
5232
|
prefix: Fe,
|
|
5185
5233
|
local: zt,
|
|
@@ -5188,20 +5236,20 @@ Actual: ` + c.attribValue
|
|
|
5188
5236
|
Fe && Fe !== "xmlns" && !nt && (ce(
|
|
5189
5237
|
c,
|
|
5190
5238
|
"Unbound namespace prefix: " + JSON.stringify(Fe)
|
|
5191
|
-
), Ve.uri = Fe), c.tag.attributes[
|
|
5239
|
+
), Ve.uri = Fe), c.tag.attributes[Oe] = Ve, ye(c, "onattribute", Ve);
|
|
5192
5240
|
}
|
|
5193
5241
|
c.attribList.length = 0;
|
|
5194
5242
|
}
|
|
5195
|
-
c.tag.isSelfClosing = !!o, c.sawRoot = !0, c.tags.push(c.tag), ye(c, "onopentag", c.tag), o || (!c.noscript && c.tagName.toLowerCase() === "script" ? c.state =
|
|
5243
|
+
c.tag.isSelfClosing = !!o, c.sawRoot = !0, c.tags.push(c.tag), ye(c, "onopentag", c.tag), o || (!c.noscript && c.tagName.toLowerCase() === "script" ? c.state = I.SCRIPT : c.state = I.TEXT, c.tag = null, c.tagName = ""), c.attribName = c.attribValue = "", c.attribList.length = 0;
|
|
5196
5244
|
}
|
|
5197
5245
|
function lt(c) {
|
|
5198
5246
|
if (!c.tagName) {
|
|
5199
|
-
ce(c, "Weird empty close tag."), c.textNode += "</>", c.state =
|
|
5247
|
+
ce(c, "Weird empty close tag."), c.textNode += "</>", c.state = I.TEXT;
|
|
5200
5248
|
return;
|
|
5201
5249
|
}
|
|
5202
5250
|
if (c.script) {
|
|
5203
5251
|
if (c.tagName !== "script") {
|
|
5204
|
-
c.script += "</" + c.tagName + ">", c.tagName = "", c.state =
|
|
5252
|
+
c.script += "</" + c.tagName + ">", c.tagName = "", c.state = I.SCRIPT;
|
|
5205
5253
|
return;
|
|
5206
5254
|
}
|
|
5207
5255
|
ye(c, "onscript", c.script), c.script = "";
|
|
@@ -5216,7 +5264,7 @@ Actual: ` + c.attribValue
|
|
|
5216
5264
|
break;
|
|
5217
5265
|
}
|
|
5218
5266
|
if (o < 0) {
|
|
5219
|
-
ce(c, "Unmatched closing tag: " + c.tagName), c.textNode += "</" + c.tagName + ">", c.state =
|
|
5267
|
+
ce(c, "Unmatched closing tag: " + c.tagName), c.textNode += "</" + c.tagName + ">", c.state = I.TEXT;
|
|
5220
5268
|
return;
|
|
5221
5269
|
}
|
|
5222
5270
|
c.tagName = S;
|
|
@@ -5224,22 +5272,22 @@ Actual: ` + c.attribValue
|
|
|
5224
5272
|
var be = c.tag = c.tags.pop();
|
|
5225
5273
|
c.tagName = c.tag.name, ye(c, "onclosetag", c.tagName);
|
|
5226
5274
|
var Re = {};
|
|
5227
|
-
for (var
|
|
5228
|
-
Re[
|
|
5275
|
+
for (var Oe in be.ns)
|
|
5276
|
+
Re[Oe] = be.ns[Oe];
|
|
5229
5277
|
var Ne = c.tags[c.tags.length - 1] || c;
|
|
5230
|
-
c.opt.xmlns && be.ns !== Ne.ns && Object.keys(be.ns).forEach(function(
|
|
5231
|
-
var Fe = be.ns[
|
|
5232
|
-
ye(c, "onclosenamespace", { prefix:
|
|
5278
|
+
c.opt.xmlns && be.ns !== Ne.ns && Object.keys(be.ns).forEach(function(Ae) {
|
|
5279
|
+
var Fe = be.ns[Ae];
|
|
5280
|
+
ye(c, "onclosenamespace", { prefix: Ae, uri: Fe });
|
|
5233
5281
|
});
|
|
5234
5282
|
}
|
|
5235
|
-
o === 0 && (c.closedRoot = !0), c.tagName = c.attribValue = c.attribName = "", c.attribList.length = 0, c.state =
|
|
5283
|
+
o === 0 && (c.closedRoot = !0), c.tagName = c.attribValue = c.attribName = "", c.attribList.length = 0, c.state = I.TEXT;
|
|
5236
5284
|
}
|
|
5237
|
-
function
|
|
5285
|
+
function On(c) {
|
|
5238
5286
|
var o = c.entity, S = o.toLowerCase(), E, se = "";
|
|
5239
5287
|
return c.ENTITIES[o] ? c.ENTITIES[o] : c.ENTITIES[S] ? c.ENTITIES[S] : (o = S, o.charAt(0) === "#" && (o.charAt(1) === "x" ? (o = o.slice(2), E = parseInt(o, 16), se = E.toString(16)) : (o = o.slice(1), E = parseInt(o, 10), se = E.toString(10))), o = o.replace(/^0+/, ""), isNaN(E) || se.toLowerCase() !== o || E < 0 || E > 1114111 ? (ce(c, "Invalid character entity"), "&" + c.entity + ";") : String.fromCodePoint(E));
|
|
5240
5288
|
}
|
|
5241
5289
|
function z(c, o) {
|
|
5242
|
-
o === "<" ? (c.state =
|
|
5290
|
+
o === "<" ? (c.state = I.OPEN_WAKA, c.startTagPosition = c.position) : Z(o) || (ce(c, "Non-whitespace before first tag."), c.textNode = o, c.state = I.TEXT);
|
|
5243
5291
|
}
|
|
5244
5292
|
function _t(c, o) {
|
|
5245
5293
|
var S = "";
|
|
@@ -5260,199 +5308,199 @@ Actual: ` + c.attribValue
|
|
|
5260
5308
|
for (var S = 0, E = ""; E = _t(c, S++), o.c = E, !!E; )
|
|
5261
5309
|
switch (o.trackPosition && (o.position++, E === `
|
|
5262
5310
|
` ? (o.line++, o.column = 0) : o.column++), o.state) {
|
|
5263
|
-
case
|
|
5264
|
-
if (o.state =
|
|
5311
|
+
case I.BEGIN:
|
|
5312
|
+
if (o.state = I.BEGIN_WHITESPACE, E === "\uFEFF")
|
|
5265
5313
|
continue;
|
|
5266
5314
|
z(o, E);
|
|
5267
5315
|
continue;
|
|
5268
|
-
case
|
|
5316
|
+
case I.BEGIN_WHITESPACE:
|
|
5269
5317
|
z(o, E);
|
|
5270
5318
|
continue;
|
|
5271
|
-
case
|
|
5319
|
+
case I.TEXT:
|
|
5272
5320
|
if (o.sawRoot && !o.closedRoot) {
|
|
5273
5321
|
for (var ge = S - 1; E && E !== "<" && E !== "&"; )
|
|
5274
5322
|
E = _t(c, S++), E && o.trackPosition && (o.position++, E === `
|
|
5275
5323
|
` ? (o.line++, o.column = 0) : o.column++);
|
|
5276
5324
|
o.textNode += c.substring(ge, S - 1);
|
|
5277
5325
|
}
|
|
5278
|
-
E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state =
|
|
5326
|
+
E === "<" && !(o.sawRoot && o.closedRoot && !o.strict) ? (o.state = I.OPEN_WAKA, o.startTagPosition = o.position) : (!Z(E) && (!o.sawRoot || o.closedRoot) && ce(o, "Text data outside of root node."), E === "&" ? o.state = I.TEXT_ENTITY : o.textNode += E);
|
|
5279
5327
|
continue;
|
|
5280
|
-
case
|
|
5281
|
-
E === "<" ? o.state =
|
|
5328
|
+
case I.SCRIPT:
|
|
5329
|
+
E === "<" ? o.state = I.SCRIPT_ENDING : o.script += E;
|
|
5282
5330
|
continue;
|
|
5283
|
-
case
|
|
5284
|
-
E === "/" ? o.state =
|
|
5331
|
+
case I.SCRIPT_ENDING:
|
|
5332
|
+
E === "/" ? o.state = I.CLOSE_TAG : (o.script += "<" + E, o.state = I.SCRIPT);
|
|
5285
5333
|
continue;
|
|
5286
|
-
case
|
|
5334
|
+
case I.OPEN_WAKA:
|
|
5287
5335
|
if (E === "!")
|
|
5288
|
-
o.state =
|
|
5336
|
+
o.state = I.SGML_DECL, o.sgmlDecl = "";
|
|
5289
5337
|
else if (!Z(E)) if (me(ie, E))
|
|
5290
|
-
o.state =
|
|
5338
|
+
o.state = I.OPEN_TAG, o.tagName = E;
|
|
5291
5339
|
else if (E === "/")
|
|
5292
|
-
o.state =
|
|
5340
|
+
o.state = I.CLOSE_TAG, o.tagName = "";
|
|
5293
5341
|
else if (E === "?")
|
|
5294
|
-
o.state =
|
|
5342
|
+
o.state = I.PROC_INST, o.procInstName = o.procInstBody = "";
|
|
5295
5343
|
else {
|
|
5296
5344
|
if (ce(o, "Unencoded <"), o.startTagPosition + 1 < o.position) {
|
|
5297
5345
|
var se = o.position - o.startTagPosition;
|
|
5298
5346
|
E = new Array(se).join(" ") + E;
|
|
5299
5347
|
}
|
|
5300
|
-
o.textNode += "<" + E, o.state =
|
|
5348
|
+
o.textNode += "<" + E, o.state = I.TEXT;
|
|
5301
5349
|
}
|
|
5302
5350
|
continue;
|
|
5303
|
-
case
|
|
5351
|
+
case I.SGML_DECL:
|
|
5304
5352
|
if (o.sgmlDecl + E === "--") {
|
|
5305
|
-
o.state =
|
|
5353
|
+
o.state = I.COMMENT, o.comment = "", o.sgmlDecl = "";
|
|
5306
5354
|
continue;
|
|
5307
5355
|
}
|
|
5308
|
-
o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state =
|
|
5356
|
+
o.doctype && o.doctype !== !0 && o.sgmlDecl ? (o.state = I.DOCTYPE_DTD, o.doctype += "<!" + o.sgmlDecl + E, o.sgmlDecl = "") : (o.sgmlDecl + E).toUpperCase() === Q ? (ye(o, "onopencdata"), o.state = I.CDATA, o.sgmlDecl = "", o.cdata = "") : (o.sgmlDecl + E).toUpperCase() === fe ? (o.state = I.DOCTYPE, (o.doctype || o.sawRoot) && ce(
|
|
5309
5357
|
o,
|
|
5310
5358
|
"Inappropriately located doctype declaration"
|
|
5311
|
-
), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (ye(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state =
|
|
5359
|
+
), o.doctype = "", o.sgmlDecl = "") : E === ">" ? (ye(o, "onsgmldeclaration", o.sgmlDecl), o.sgmlDecl = "", o.state = I.TEXT) : (de(E) && (o.state = I.SGML_DECL_QUOTED), o.sgmlDecl += E);
|
|
5312
5360
|
continue;
|
|
5313
|
-
case
|
|
5314
|
-
E === o.q && (o.state =
|
|
5361
|
+
case I.SGML_DECL_QUOTED:
|
|
5362
|
+
E === o.q && (o.state = I.SGML_DECL, o.q = ""), o.sgmlDecl += E;
|
|
5315
5363
|
continue;
|
|
5316
|
-
case
|
|
5317
|
-
E === ">" ? (o.state =
|
|
5364
|
+
case I.DOCTYPE:
|
|
5365
|
+
E === ">" ? (o.state = I.TEXT, ye(o, "ondoctype", o.doctype), o.doctype = !0) : (o.doctype += E, E === "[" ? o.state = I.DOCTYPE_DTD : de(E) && (o.state = I.DOCTYPE_QUOTED, o.q = E));
|
|
5318
5366
|
continue;
|
|
5319
|
-
case
|
|
5320
|
-
o.doctype += E, E === o.q && (o.q = "", o.state =
|
|
5367
|
+
case I.DOCTYPE_QUOTED:
|
|
5368
|
+
o.doctype += E, E === o.q && (o.q = "", o.state = I.DOCTYPE);
|
|
5321
5369
|
continue;
|
|
5322
|
-
case
|
|
5323
|
-
E === "]" ? (o.doctype += E, o.state =
|
|
5370
|
+
case I.DOCTYPE_DTD:
|
|
5371
|
+
E === "]" ? (o.doctype += E, o.state = I.DOCTYPE) : E === "<" ? (o.state = I.OPEN_WAKA, o.startTagPosition = o.position) : de(E) ? (o.doctype += E, o.state = I.DOCTYPE_DTD_QUOTED, o.q = E) : o.doctype += E;
|
|
5324
5372
|
continue;
|
|
5325
|
-
case
|
|
5326
|
-
o.doctype += E, E === o.q && (o.state =
|
|
5373
|
+
case I.DOCTYPE_DTD_QUOTED:
|
|
5374
|
+
o.doctype += E, E === o.q && (o.state = I.DOCTYPE_DTD, o.q = "");
|
|
5327
5375
|
continue;
|
|
5328
|
-
case
|
|
5329
|
-
E === "-" ? o.state =
|
|
5376
|
+
case I.COMMENT:
|
|
5377
|
+
E === "-" ? o.state = I.COMMENT_ENDING : o.comment += E;
|
|
5330
5378
|
continue;
|
|
5331
|
-
case
|
|
5332
|
-
E === "-" ? (o.state =
|
|
5379
|
+
case I.COMMENT_ENDING:
|
|
5380
|
+
E === "-" ? (o.state = I.COMMENT_ENDED, o.comment = ze(o.opt, o.comment), o.comment && ye(o, "oncomment", o.comment), o.comment = "") : (o.comment += "-" + E, o.state = I.COMMENT);
|
|
5333
5381
|
continue;
|
|
5334
|
-
case
|
|
5335
|
-
E !== ">" ? (ce(o, "Malformed comment"), o.comment += "--" + E, o.state =
|
|
5382
|
+
case I.COMMENT_ENDED:
|
|
5383
|
+
E !== ">" ? (ce(o, "Malformed comment"), o.comment += "--" + E, o.state = I.COMMENT) : o.doctype && o.doctype !== !0 ? o.state = I.DOCTYPE_DTD : o.state = I.TEXT;
|
|
5336
5384
|
continue;
|
|
5337
|
-
case
|
|
5385
|
+
case I.CDATA:
|
|
5338
5386
|
for (var ge = S - 1; E && E !== "]"; )
|
|
5339
5387
|
E = _t(c, S++), E && o.trackPosition && (o.position++, E === `
|
|
5340
5388
|
` ? (o.line++, o.column = 0) : o.column++);
|
|
5341
|
-
o.cdata += c.substring(ge, S - 1), E === "]" && (o.state =
|
|
5389
|
+
o.cdata += c.substring(ge, S - 1), E === "]" && (o.state = I.CDATA_ENDING);
|
|
5342
5390
|
continue;
|
|
5343
|
-
case
|
|
5344
|
-
E === "]" ? o.state =
|
|
5391
|
+
case I.CDATA_ENDING:
|
|
5392
|
+
E === "]" ? o.state = I.CDATA_ENDING_2 : (o.cdata += "]" + E, o.state = I.CDATA);
|
|
5345
5393
|
continue;
|
|
5346
|
-
case
|
|
5347
|
-
E === ">" ? (o.cdata && ye(o, "oncdata", o.cdata), ye(o, "onclosecdata"), o.cdata = "", o.state =
|
|
5394
|
+
case I.CDATA_ENDING_2:
|
|
5395
|
+
E === ">" ? (o.cdata && ye(o, "oncdata", o.cdata), ye(o, "onclosecdata"), o.cdata = "", o.state = I.TEXT) : E === "]" ? o.cdata += "]" : (o.cdata += "]]" + E, o.state = I.CDATA);
|
|
5348
5396
|
continue;
|
|
5349
|
-
case
|
|
5350
|
-
E === "?" ? o.state =
|
|
5397
|
+
case I.PROC_INST:
|
|
5398
|
+
E === "?" ? o.state = I.PROC_INST_ENDING : Z(E) ? o.state = I.PROC_INST_BODY : o.procInstName += E;
|
|
5351
5399
|
continue;
|
|
5352
|
-
case
|
|
5400
|
+
case I.PROC_INST_BODY:
|
|
5353
5401
|
if (!o.procInstBody && Z(E))
|
|
5354
5402
|
continue;
|
|
5355
|
-
E === "?" ? o.state =
|
|
5403
|
+
E === "?" ? o.state = I.PROC_INST_ENDING : o.procInstBody += E;
|
|
5356
5404
|
continue;
|
|
5357
|
-
case
|
|
5405
|
+
case I.PROC_INST_ENDING:
|
|
5358
5406
|
if (E === ">") {
|
|
5359
5407
|
const Ne = {
|
|
5360
5408
|
name: o.procInstName,
|
|
5361
5409
|
body: o.procInstBody
|
|
5362
5410
|
};
|
|
5363
|
-
kt(o, Ne), ye(o, "onprocessinginstruction", Ne), o.procInstName = o.procInstBody = "", o.state =
|
|
5411
|
+
kt(o, Ne), ye(o, "onprocessinginstruction", Ne), o.procInstName = o.procInstBody = "", o.state = I.TEXT;
|
|
5364
5412
|
} else
|
|
5365
|
-
o.procInstBody += "?" + E, o.state =
|
|
5413
|
+
o.procInstBody += "?" + E, o.state = I.PROC_INST_BODY;
|
|
5366
5414
|
continue;
|
|
5367
|
-
case
|
|
5368
|
-
me(xe, E) ? o.tagName += E : (et(o), E === ">" ?
|
|
5415
|
+
case I.OPEN_TAG:
|
|
5416
|
+
me(xe, E) ? o.tagName += E : (et(o), E === ">" ? Me(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : (Z(E) || ce(o, "Invalid character in tag name"), o.state = I.ATTRIB));
|
|
5369
5417
|
continue;
|
|
5370
|
-
case
|
|
5371
|
-
E === ">" ? (
|
|
5418
|
+
case I.OPEN_TAG_SLASH:
|
|
5419
|
+
E === ">" ? (Me(o, !0), lt(o)) : (ce(
|
|
5372
5420
|
o,
|
|
5373
5421
|
"Forward-slash in opening tag not followed by >"
|
|
5374
|
-
), o.state =
|
|
5422
|
+
), o.state = I.ATTRIB);
|
|
5375
5423
|
continue;
|
|
5376
|
-
case
|
|
5424
|
+
case I.ATTRIB:
|
|
5377
5425
|
if (Z(E))
|
|
5378
5426
|
continue;
|
|
5379
|
-
E === ">" ?
|
|
5427
|
+
E === ">" ? Me(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : me(ie, E) ? (o.attribName = E, o.attribValue = "", o.state = I.ATTRIB_NAME) : ce(o, "Invalid attribute name");
|
|
5380
5428
|
continue;
|
|
5381
|
-
case
|
|
5382
|
-
E === "=" ? o.state =
|
|
5429
|
+
case I.ATTRIB_NAME:
|
|
5430
|
+
E === "=" ? o.state = I.ATTRIB_VALUE : E === ">" ? (ce(o, "Attribute without value"), o.attribValue = o.attribName, tt(o), Me(o)) : Z(E) ? o.state = I.ATTRIB_NAME_SAW_WHITE : me(xe, E) ? o.attribName += E : ce(o, "Invalid attribute name");
|
|
5383
5431
|
continue;
|
|
5384
|
-
case
|
|
5432
|
+
case I.ATTRIB_NAME_SAW_WHITE:
|
|
5385
5433
|
if (E === "=")
|
|
5386
|
-
o.state =
|
|
5434
|
+
o.state = I.ATTRIB_VALUE;
|
|
5387
5435
|
else {
|
|
5388
5436
|
if (Z(E))
|
|
5389
5437
|
continue;
|
|
5390
5438
|
ce(o, "Attribute without value"), o.tag.attributes[o.attribName] = "", o.attribValue = "", ye(o, "onattribute", {
|
|
5391
5439
|
name: o.attribName,
|
|
5392
5440
|
value: ""
|
|
5393
|
-
}), o.attribName = "", E === ">" ?
|
|
5441
|
+
}), o.attribName = "", E === ">" ? Me(o) : me(ie, E) ? (o.attribName = E, o.state = I.ATTRIB_NAME) : (ce(o, "Invalid attribute name"), o.state = I.ATTRIB);
|
|
5394
5442
|
}
|
|
5395
5443
|
continue;
|
|
5396
|
-
case
|
|
5444
|
+
case I.ATTRIB_VALUE:
|
|
5397
5445
|
if (Z(E))
|
|
5398
5446
|
continue;
|
|
5399
|
-
de(E) ? (o.q = E, o.state =
|
|
5447
|
+
de(E) ? (o.q = E, o.state = I.ATTRIB_VALUE_QUOTED) : (o.opt.unquotedAttributeValues || Ie(o, "Unquoted attribute value"), o.state = I.ATTRIB_VALUE_UNQUOTED, o.attribValue = E);
|
|
5400
5448
|
continue;
|
|
5401
|
-
case
|
|
5449
|
+
case I.ATTRIB_VALUE_QUOTED:
|
|
5402
5450
|
if (E !== o.q) {
|
|
5403
|
-
E === "&" ? o.state =
|
|
5451
|
+
E === "&" ? o.state = I.ATTRIB_VALUE_ENTITY_Q : o.attribValue += E;
|
|
5404
5452
|
continue;
|
|
5405
5453
|
}
|
|
5406
|
-
tt(o), o.q = "", o.state =
|
|
5454
|
+
tt(o), o.q = "", o.state = I.ATTRIB_VALUE_CLOSED;
|
|
5407
5455
|
continue;
|
|
5408
|
-
case
|
|
5409
|
-
Z(E) ? o.state =
|
|
5456
|
+
case I.ATTRIB_VALUE_CLOSED:
|
|
5457
|
+
Z(E) ? o.state = I.ATTRIB : E === ">" ? Me(o) : E === "/" ? o.state = I.OPEN_TAG_SLASH : me(ie, E) ? (ce(o, "No whitespace between attributes"), o.attribName = E, o.attribValue = "", o.state = I.ATTRIB_NAME) : ce(o, "Invalid attribute name");
|
|
5410
5458
|
continue;
|
|
5411
|
-
case
|
|
5459
|
+
case I.ATTRIB_VALUE_UNQUOTED:
|
|
5412
5460
|
if (!le(E)) {
|
|
5413
|
-
E === "&" ? o.state =
|
|
5461
|
+
E === "&" ? o.state = I.ATTRIB_VALUE_ENTITY_U : o.attribValue += E;
|
|
5414
5462
|
continue;
|
|
5415
5463
|
}
|
|
5416
|
-
tt(o), E === ">" ?
|
|
5464
|
+
tt(o), E === ">" ? Me(o) : o.state = I.ATTRIB;
|
|
5417
5465
|
continue;
|
|
5418
|
-
case
|
|
5466
|
+
case I.CLOSE_TAG:
|
|
5419
5467
|
if (o.tagName)
|
|
5420
|
-
E === ">" ? lt(o) : me(xe, E) ? o.tagName += E : o.script ? (o.script += "</" + o.tagName + E, o.tagName = "", o.state =
|
|
5468
|
+
E === ">" ? lt(o) : me(xe, E) ? o.tagName += E : o.script ? (o.script += "</" + o.tagName + E, o.tagName = "", o.state = I.SCRIPT) : (Z(E) || ce(o, "Invalid tagname in closing tag"), o.state = I.CLOSE_TAG_SAW_WHITE);
|
|
5421
5469
|
else {
|
|
5422
5470
|
if (Z(E))
|
|
5423
5471
|
continue;
|
|
5424
|
-
|
|
5472
|
+
An(ie, E) ? o.script ? (o.script += "</" + E, o.state = I.SCRIPT) : ce(o, "Invalid tagname in closing tag.") : o.tagName = E;
|
|
5425
5473
|
}
|
|
5426
5474
|
continue;
|
|
5427
|
-
case
|
|
5475
|
+
case I.CLOSE_TAG_SAW_WHITE:
|
|
5428
5476
|
if (Z(E))
|
|
5429
5477
|
continue;
|
|
5430
5478
|
E === ">" ? lt(o) : ce(o, "Invalid characters in closing tag");
|
|
5431
5479
|
continue;
|
|
5432
|
-
case
|
|
5433
|
-
case
|
|
5434
|
-
case
|
|
5480
|
+
case I.TEXT_ENTITY:
|
|
5481
|
+
case I.ATTRIB_VALUE_ENTITY_Q:
|
|
5482
|
+
case I.ATTRIB_VALUE_ENTITY_U:
|
|
5435
5483
|
var be, Re;
|
|
5436
5484
|
switch (o.state) {
|
|
5437
|
-
case
|
|
5438
|
-
be =
|
|
5485
|
+
case I.TEXT_ENTITY:
|
|
5486
|
+
be = I.TEXT, Re = "textNode";
|
|
5439
5487
|
break;
|
|
5440
|
-
case
|
|
5441
|
-
be =
|
|
5488
|
+
case I.ATTRIB_VALUE_ENTITY_Q:
|
|
5489
|
+
be = I.ATTRIB_VALUE_QUOTED, Re = "attribValue";
|
|
5442
5490
|
break;
|
|
5443
|
-
case
|
|
5444
|
-
be =
|
|
5491
|
+
case I.ATTRIB_VALUE_ENTITY_U:
|
|
5492
|
+
be = I.ATTRIB_VALUE_UNQUOTED, Re = "attribValue";
|
|
5445
5493
|
break;
|
|
5446
5494
|
}
|
|
5447
5495
|
if (E === ";") {
|
|
5448
|
-
var
|
|
5449
|
-
o.opt.unparsedEntities && !Object.values(s.XML_ENTITIES).includes(
|
|
5496
|
+
var Oe = On(o);
|
|
5497
|
+
o.opt.unparsedEntities && !Object.values(s.XML_ENTITIES).includes(Oe) ? ((o.entityCount += 1) > o.opt.maxEntityCount && Ie(
|
|
5450
5498
|
o,
|
|
5451
5499
|
"Parsed entity count exceeds max entity count"
|
|
5452
5500
|
), (o.entityDepth += 1) > o.opt.maxEntityDepth && Ie(
|
|
5453
5501
|
o,
|
|
5454
5502
|
"Parsed entity depth exceeds max entity depth"
|
|
5455
|
-
), o.entity = "", o.state = be, o.write(
|
|
5503
|
+
), o.entity = "", o.state = be, o.write(Oe), o.entityDepth -= 1) : (o[Re] += Oe, o.entity = "", o.state = be);
|
|
5456
5504
|
} else me(o.entity.length ? H : te, E) ? o.entity += E : (ce(o, "Invalid character in entity name"), o[Re] += "&" + o.entity + E, o.entity = "", o.state = be);
|
|
5457
5505
|
continue;
|
|
5458
5506
|
default:
|
|
@@ -5462,17 +5510,17 @@ Actual: ` + c.attribValue
|
|
|
5462
5510
|
}
|
|
5463
5511
|
String.fromCodePoint || (function() {
|
|
5464
5512
|
var c = String.fromCharCode, o = Math.floor, S = function() {
|
|
5465
|
-
var E = 16384, se = [], ge, be, Re = -1,
|
|
5466
|
-
if (!
|
|
5513
|
+
var E = 16384, se = [], ge, be, Re = -1, Oe = arguments.length;
|
|
5514
|
+
if (!Oe)
|
|
5467
5515
|
return "";
|
|
5468
|
-
for (var Ne = ""; ++Re <
|
|
5469
|
-
var
|
|
5470
|
-
if (!isFinite(
|
|
5471
|
-
|
|
5472
|
-
|
|
5473
|
-
o(
|
|
5474
|
-
throw RangeError("Invalid code point: " +
|
|
5475
|
-
|
|
5516
|
+
for (var Ne = ""; ++Re < Oe; ) {
|
|
5517
|
+
var Ae = Number(arguments[Re]);
|
|
5518
|
+
if (!isFinite(Ae) || // `NaN`, `+Infinity`, or `-Infinity`
|
|
5519
|
+
Ae < 0 || // not a valid Unicode code point
|
|
5520
|
+
Ae > 1114111 || // not a valid Unicode code point
|
|
5521
|
+
o(Ae) !== Ae)
|
|
5522
|
+
throw RangeError("Invalid code point: " + Ae);
|
|
5523
|
+
Ae <= 65535 ? se.push(Ae) : (Ae -= 65536, ge = (Ae >> 10) + 55296, be = Ae % 1024 + 56320, se.push(ge, be)), (Re + 1 === Oe || se.length > E) && (Ne += c.apply(null, se), se.length = 0);
|
|
5476
5524
|
}
|
|
5477
5525
|
return Ne;
|
|
5478
5526
|
};
|
|
@@ -5518,17 +5566,17 @@ function zi(m) {
|
|
|
5518
5566
|
state: h,
|
|
5519
5567
|
ioHooks: i
|
|
5520
5568
|
})), y.onerror = Ji;
|
|
5521
|
-
function
|
|
5569
|
+
function _() {
|
|
5522
5570
|
const F = h.recordsBatch;
|
|
5523
5571
|
return h.recordsBatch = [], F;
|
|
5524
5572
|
}
|
|
5525
|
-
function
|
|
5573
|
+
function D() {
|
|
5526
5574
|
return h.recordsBatch.length;
|
|
5527
5575
|
}
|
|
5528
5576
|
return {
|
|
5529
5577
|
parser: y,
|
|
5530
|
-
drainBatch:
|
|
5531
|
-
getSize:
|
|
5578
|
+
drainBatch: _,
|
|
5579
|
+
getSize: D
|
|
5532
5580
|
};
|
|
5533
5581
|
}
|
|
5534
5582
|
function Qi(m) {
|
|
@@ -5538,16 +5586,16 @@ function Qi(m) {
|
|
|
5538
5586
|
defaultNamespace: i.namespaces.default,
|
|
5539
5587
|
rootElementName: i.rootElementName
|
|
5540
5588
|
}));
|
|
5541
|
-
const
|
|
5589
|
+
const _ = no(s, h.defaultNamespace), D = io({ attributes: s.attributes, useCustomRecordsIds: d }), F = oo({
|
|
5542
5590
|
attributes: s.attributes,
|
|
5543
5591
|
useCustomRecordsIds: d
|
|
5544
|
-
}),
|
|
5545
|
-
id:
|
|
5592
|
+
}), $ = ro(F), G = ao(l.stack), Q = {
|
|
5593
|
+
id: D,
|
|
5546
5594
|
tagName: y,
|
|
5547
|
-
namespace:
|
|
5548
|
-
attributes:
|
|
5595
|
+
namespace: _,
|
|
5596
|
+
attributes: $,
|
|
5549
5597
|
value: "",
|
|
5550
|
-
parent:
|
|
5598
|
+
parent: G,
|
|
5551
5599
|
children: []
|
|
5552
5600
|
};
|
|
5553
5601
|
return h.stack.push(Q), h;
|
|
@@ -5567,13 +5615,13 @@ function Zi(m) {
|
|
|
5567
5615
|
}), d.length) {
|
|
5568
5616
|
const y = d.length - 1;
|
|
5569
5617
|
d = d.map(
|
|
5570
|
-
(
|
|
5571
|
-
...
|
|
5618
|
+
(_, D) => D === y ? {
|
|
5619
|
+
..._,
|
|
5572
5620
|
children: [
|
|
5573
|
-
...
|
|
5621
|
+
..._.children,
|
|
5574
5622
|
{ id: i.id, tagName: i.tagName }
|
|
5575
5623
|
]
|
|
5576
|
-
} :
|
|
5624
|
+
} : _
|
|
5577
5625
|
);
|
|
5578
5626
|
} else i.parent && Li({
|
|
5579
5627
|
parentId: i.parent.id,
|
|
@@ -5645,20 +5693,20 @@ const na = {
|
|
|
5645
5693
|
async function Ko(m) {
|
|
5646
5694
|
const { files: s, dialecteConfig: l, useCustomRecordsIds: i = !1 } = m, d = [];
|
|
5647
5695
|
if (s.length === 0) throw new Error("No files provided for import.");
|
|
5648
|
-
const { importOptions: h = na, supportedFileExtensions: y } = l.io,
|
|
5696
|
+
const { importOptions: h = na, supportedFileExtensions: y } = l.io, _ = {
|
|
5649
5697
|
...na,
|
|
5650
5698
|
...h
|
|
5651
5699
|
};
|
|
5652
|
-
for (const
|
|
5653
|
-
if (!so({ file:
|
|
5654
|
-
console.error(`Unsupported file type: ${
|
|
5700
|
+
for (const D of s) {
|
|
5701
|
+
if (!so({ file: D, supportedExtensions: y })) {
|
|
5702
|
+
console.error(`Unsupported file type: ${D.name}`);
|
|
5655
5703
|
continue;
|
|
5656
5704
|
}
|
|
5657
|
-
|
|
5705
|
+
D.size === 0 && console.warn(`File is empty: ${D.name}`);
|
|
5658
5706
|
const F = await co({
|
|
5659
|
-
file:
|
|
5707
|
+
file: D,
|
|
5660
5708
|
dialecteConfig: l,
|
|
5661
|
-
options:
|
|
5709
|
+
options: _,
|
|
5662
5710
|
useCustomRecordsIds: i
|
|
5663
5711
|
});
|
|
5664
5712
|
d.push(F);
|
|
@@ -5673,13 +5721,13 @@ function uo(m) {
|
|
|
5673
5721
|
return m.name.replace(/\.[^.]+$/, "");
|
|
5674
5722
|
}
|
|
5675
5723
|
async function co(m) {
|
|
5676
|
-
const { file: s, dialecteConfig: l, options: i, useCustomRecordsIds: d } = m, h = uo(s), y = await
|
|
5724
|
+
const { file: s, dialecteConfig: l, options: i, useCustomRecordsIds: d } = m, h = uo(s), y = await Mi({ databaseName: h, dialecteConfig: l });
|
|
5677
5725
|
try {
|
|
5678
|
-
const
|
|
5679
|
-
if (await y.table(
|
|
5726
|
+
const _ = l.database.tables.xmlElements.name;
|
|
5727
|
+
if (await y.table(_).clear(), i.useBrowserApi && s.size !== 0 && await lo({
|
|
5680
5728
|
file: s,
|
|
5681
5729
|
databaseInstance: y,
|
|
5682
|
-
elementsTableName:
|
|
5730
|
+
elementsTableName: _,
|
|
5683
5731
|
dialecteConfig: l,
|
|
5684
5732
|
options: {
|
|
5685
5733
|
useCustomRecordsIds: d,
|
|
@@ -5687,34 +5735,34 @@ async function co(m) {
|
|
|
5687
5735
|
batchSize: i.batchSize
|
|
5688
5736
|
}
|
|
5689
5737
|
}), l.io.hooks?.afterImport) {
|
|
5690
|
-
const { creates:
|
|
5691
|
-
|
|
5738
|
+
const { creates: D, updates: F, deletes: $ } = await l.io.hooks.afterImport();
|
|
5739
|
+
D?.length && await wa({ databaseInstance: y, elementsTableName: _, records: D }), F?.length && await ji({ databaseInstance: y, elementsTableName: _, updates: F }), $?.length && await Ki({ databaseInstance: y, elementsTableName: _, ids: $ });
|
|
5692
5740
|
}
|
|
5693
5741
|
return h;
|
|
5694
|
-
} catch (
|
|
5695
|
-
throw console.error(`Error importing file ${s.name}:`,
|
|
5742
|
+
} catch (_) {
|
|
5743
|
+
throw console.error(`Error importing file ${s.name}:`, _), _;
|
|
5696
5744
|
} finally {
|
|
5697
5745
|
y.close();
|
|
5698
5746
|
}
|
|
5699
5747
|
}
|
|
5700
5748
|
async function lo(m) {
|
|
5701
|
-
const { file: s, databaseInstance: l, elementsTableName: i, dialecteConfig: d, options: h } = m, y = s.stream().getReader(),
|
|
5749
|
+
const { file: s, databaseInstance: l, elementsTableName: i, dialecteConfig: d, options: h } = m, y = s.stream().getReader(), _ = zi({
|
|
5702
5750
|
dialecteConfig: d,
|
|
5703
5751
|
useCustomRecordsIds: h.useCustomRecordsIds
|
|
5704
|
-
}),
|
|
5752
|
+
}), D = new TextDecoder(), F = new Uint8Array(0);
|
|
5705
5753
|
return await pr({
|
|
5706
5754
|
databaseInstance: l,
|
|
5707
5755
|
elementsTableName: i,
|
|
5708
5756
|
reader: y,
|
|
5709
|
-
sax:
|
|
5710
|
-
textDecoder:
|
|
5757
|
+
sax: _,
|
|
5758
|
+
textDecoder: D,
|
|
5711
5759
|
buffer: F,
|
|
5712
5760
|
options: h
|
|
5713
5761
|
});
|
|
5714
5762
|
}
|
|
5715
5763
|
async function pr(m) {
|
|
5716
|
-
const { databaseInstance: s, elementsTableName: l, reader: i, sax: d, textDecoder: h, buffer: y, options:
|
|
5717
|
-
if (
|
|
5764
|
+
const { databaseInstance: s, elementsTableName: l, reader: i, sax: d, textDecoder: h, buffer: y, options: _ } = m, { chunkSize: D, batchSize: F } = _, { done: $, value: G } = await i.read();
|
|
5765
|
+
if ($) {
|
|
5718
5766
|
if (y.length > 0) {
|
|
5719
5767
|
const fe = h.decode(y);
|
|
5720
5768
|
d.parser.write(fe);
|
|
@@ -5726,14 +5774,14 @@ async function pr(m) {
|
|
|
5726
5774
|
batchSize: 0
|
|
5727
5775
|
});
|
|
5728
5776
|
}
|
|
5729
|
-
if (!
|
|
5777
|
+
if (!G)
|
|
5730
5778
|
return await pr(m);
|
|
5731
|
-
let Q = new Uint8Array(y.length +
|
|
5732
|
-
for (Q.set(y), Q.set(
|
|
5733
|
-
const fe = Q.slice(0,
|
|
5734
|
-
Q = Q.slice(
|
|
5735
|
-
const
|
|
5736
|
-
d.parser.write(
|
|
5779
|
+
let Q = new Uint8Array(y.length + G.length);
|
|
5780
|
+
for (Q.set(y), Q.set(G, y.length); Q.length >= D; ) {
|
|
5781
|
+
const fe = Q.slice(0, D);
|
|
5782
|
+
Q = Q.slice(D);
|
|
5783
|
+
const M = h.decode(fe, { stream: !0 });
|
|
5784
|
+
d.parser.write(M), await ra({
|
|
5737
5785
|
databaseInstance: s,
|
|
5738
5786
|
elementsTableName: l,
|
|
5739
5787
|
sax: d,
|
|
@@ -5745,13 +5793,13 @@ async function pr(m) {
|
|
|
5745
5793
|
async function ra(m) {
|
|
5746
5794
|
const { databaseInstance: s, elementsTableName: l, sax: i, batchSize: d } = m;
|
|
5747
5795
|
if (i.getSize() >= d) {
|
|
5748
|
-
const y = i.drainBatch(),
|
|
5796
|
+
const y = i.drainBatch(), _ = Ui({
|
|
5749
5797
|
currentBatch: y
|
|
5750
5798
|
});
|
|
5751
5799
|
await wa({
|
|
5752
5800
|
databaseInstance: s,
|
|
5753
5801
|
elementsTableName: l,
|
|
5754
|
-
records:
|
|
5802
|
+
records: _
|
|
5755
5803
|
});
|
|
5756
5804
|
}
|
|
5757
5805
|
}
|
|
@@ -5768,13 +5816,13 @@ function fo() {
|
|
|
5768
5816
|
s.ParsingError = l;
|
|
5769
5817
|
let i;
|
|
5770
5818
|
function d() {
|
|
5771
|
-
return
|
|
5819
|
+
return D(!1) || Q() || G() || $() || _();
|
|
5772
5820
|
}
|
|
5773
5821
|
function h() {
|
|
5774
|
-
return B(/\s*/),
|
|
5822
|
+
return B(/\s*/), D(!0) || G() || F() || _();
|
|
5775
5823
|
}
|
|
5776
5824
|
function y() {
|
|
5777
|
-
const te =
|
|
5825
|
+
const te = _(), H = [];
|
|
5778
5826
|
let Z, de = h();
|
|
5779
5827
|
for (; de; ) {
|
|
5780
5828
|
if (de.node.type === "Element") {
|
|
@@ -5794,7 +5842,7 @@ function fo() {
|
|
|
5794
5842
|
children: H
|
|
5795
5843
|
};
|
|
5796
5844
|
}
|
|
5797
|
-
function
|
|
5845
|
+
function _() {
|
|
5798
5846
|
const te = B(/^<\?([\w-:.]+)\s*/);
|
|
5799
5847
|
if (!te)
|
|
5800
5848
|
return;
|
|
@@ -5812,7 +5860,7 @@ function fo() {
|
|
|
5812
5860
|
node: H
|
|
5813
5861
|
};
|
|
5814
5862
|
}
|
|
5815
|
-
function
|
|
5863
|
+
function D(te) {
|
|
5816
5864
|
const H = B(/^<([^?!</>\s]+)\s*/);
|
|
5817
5865
|
if (!H)
|
|
5818
5866
|
return;
|
|
@@ -5864,7 +5912,7 @@ function fo() {
|
|
|
5864
5912
|
};
|
|
5865
5913
|
}
|
|
5866
5914
|
}
|
|
5867
|
-
function
|
|
5915
|
+
function $() {
|
|
5868
5916
|
if (i.xml.startsWith("<![CDATA[")) {
|
|
5869
5917
|
const te = i.xml.indexOf("]]>");
|
|
5870
5918
|
if (te > -1) {
|
|
@@ -5879,7 +5927,7 @@ function fo() {
|
|
|
5879
5927
|
}
|
|
5880
5928
|
}
|
|
5881
5929
|
}
|
|
5882
|
-
function
|
|
5930
|
+
function G() {
|
|
5883
5931
|
const te = B(/^<!--[\s\S]*?-->/);
|
|
5884
5932
|
if (te) {
|
|
5885
5933
|
const H = {
|
|
@@ -5910,10 +5958,10 @@ function fo() {
|
|
|
5910
5958
|
if (te)
|
|
5911
5959
|
return {
|
|
5912
5960
|
name: te[1].trim(),
|
|
5913
|
-
value:
|
|
5961
|
+
value: M(te[2].trim())
|
|
5914
5962
|
};
|
|
5915
5963
|
}
|
|
5916
|
-
function
|
|
5964
|
+
function M(te) {
|
|
5917
5965
|
return te.replace(/^['"]|['"]$/g, "");
|
|
5918
5966
|
}
|
|
5919
5967
|
function B(te) {
|
|
@@ -5941,59 +5989,59 @@ function fo() {
|
|
|
5941
5989
|
var ia = $t.exports, oa;
|
|
5942
5990
|
function ho() {
|
|
5943
5991
|
return oa || (oa = 1, (function(m, s) {
|
|
5944
|
-
var l = ia && ia.__importDefault || function(
|
|
5945
|
-
return
|
|
5992
|
+
var l = ia && ia.__importDefault || function(M) {
|
|
5993
|
+
return M && M.__esModule ? M : { default: M };
|
|
5946
5994
|
};
|
|
5947
5995
|
Object.defineProperty(s, "__esModule", { value: !0 });
|
|
5948
5996
|
const i = l(/* @__PURE__ */ fo());
|
|
5949
|
-
function d(
|
|
5950
|
-
if (!
|
|
5997
|
+
function d(M) {
|
|
5998
|
+
if (!M.options.indentation && !M.options.lineSeparator)
|
|
5951
5999
|
return;
|
|
5952
|
-
|
|
6000
|
+
M.content += M.options.lineSeparator;
|
|
5953
6001
|
let B;
|
|
5954
|
-
for (B = 0; B <
|
|
5955
|
-
|
|
6002
|
+
for (B = 0; B < M.level; B++)
|
|
6003
|
+
M.content += M.options.indentation;
|
|
5956
6004
|
}
|
|
5957
|
-
function h(
|
|
5958
|
-
|
|
6005
|
+
function h(M) {
|
|
6006
|
+
M.content = M.content.replace(/ +$/, "");
|
|
5959
6007
|
let B;
|
|
5960
|
-
for (B = 0; B <
|
|
5961
|
-
|
|
6008
|
+
for (B = 0; B < M.level; B++)
|
|
6009
|
+
M.content += M.options.indentation;
|
|
5962
6010
|
}
|
|
5963
|
-
function y(
|
|
5964
|
-
|
|
6011
|
+
function y(M, B) {
|
|
6012
|
+
M.content += B;
|
|
5965
6013
|
}
|
|
5966
|
-
function
|
|
5967
|
-
if (
|
|
5968
|
-
|
|
5969
|
-
else if (
|
|
5970
|
-
Q(
|
|
5971
|
-
else if (typeof
|
|
5972
|
-
|
|
6014
|
+
function _(M, B, ue) {
|
|
6015
|
+
if (M.type === "Element")
|
|
6016
|
+
$(M, B, ue);
|
|
6017
|
+
else if (M.type === "ProcessingInstruction")
|
|
6018
|
+
Q(M, B);
|
|
6019
|
+
else if (typeof M.content == "string")
|
|
6020
|
+
D(M.content, B, ue);
|
|
5973
6021
|
else
|
|
5974
|
-
throw new Error("Unknown node type: " +
|
|
6022
|
+
throw new Error("Unknown node type: " + M.type);
|
|
5975
6023
|
}
|
|
5976
|
-
function
|
|
6024
|
+
function D(M, B, ue) {
|
|
5977
6025
|
if (!ue) {
|
|
5978
|
-
const ie =
|
|
5979
|
-
(B.options.lineSeparator || ie.length === 0) && (
|
|
6026
|
+
const ie = M.trim();
|
|
6027
|
+
(B.options.lineSeparator || ie.length === 0) && (M = ie);
|
|
5980
6028
|
}
|
|
5981
|
-
|
|
6029
|
+
M.length > 0 && (!ue && B.content.length > 0 && d(B), y(B, M));
|
|
5982
6030
|
}
|
|
5983
|
-
function F(
|
|
5984
|
-
const ue = "/" +
|
|
6031
|
+
function F(M, B) {
|
|
6032
|
+
const ue = "/" + M.join("/"), ie = M[M.length - 1];
|
|
5985
6033
|
return B.includes(ie) || B.includes(ue);
|
|
5986
6034
|
}
|
|
5987
|
-
function
|
|
5988
|
-
if (B.path.push(
|
|
6035
|
+
function $(M, B, ue) {
|
|
6036
|
+
if (B.path.push(M.name), !ue && B.content.length > 0 && d(B), y(B, "<" + M.name), G(B, M.attributes), M.children === null || B.options.forceSelfClosingEmptyTag && M.children.length === 0) {
|
|
5989
6037
|
const ie = B.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
|
|
5990
6038
|
y(B, ie);
|
|
5991
|
-
} else if (
|
|
5992
|
-
y(B, "></" +
|
|
6039
|
+
} else if (M.children.length === 0)
|
|
6040
|
+
y(B, "></" + M.name + ">");
|
|
5993
6041
|
else {
|
|
5994
|
-
const ie =
|
|
6042
|
+
const ie = M.children;
|
|
5995
6043
|
y(B, ">"), B.level++;
|
|
5996
|
-
let xe =
|
|
6044
|
+
let xe = M.attributes["xml:space"] === "preserve" || ue, te = !1;
|
|
5997
6045
|
if (!xe && B.options.ignoredPaths && (te = F(B.path, B.options.ignoredPaths), xe = te), !xe && B.options.collapseContent) {
|
|
5998
6046
|
let H = !1, Z = !1, de = !1;
|
|
5999
6047
|
ie.forEach(function(le, me) {
|
|
@@ -6002,41 +6050,41 @@ function ho() {
|
|
|
6002
6050
|
}), H && (!de || !Z) && (xe = !0);
|
|
6003
6051
|
}
|
|
6004
6052
|
ie.forEach(function(H) {
|
|
6005
|
-
|
|
6006
|
-
}), B.level--, !ue && !xe && d(B), te && h(B), y(B, "</" +
|
|
6053
|
+
_(H, B, ue || xe);
|
|
6054
|
+
}), B.level--, !ue && !xe && d(B), te && h(B), y(B, "</" + M.name + ">");
|
|
6007
6055
|
}
|
|
6008
6056
|
B.path.pop();
|
|
6009
6057
|
}
|
|
6010
|
-
function
|
|
6058
|
+
function G(M, B) {
|
|
6011
6059
|
Object.keys(B).forEach(function(ue) {
|
|
6012
|
-
if (
|
|
6060
|
+
if (M.options.attributeQuotes === "single") {
|
|
6013
6061
|
const ie = B[ue].replace(/'/g, "'");
|
|
6014
|
-
y(
|
|
6062
|
+
y(M, " " + ue + "='" + ie + "'");
|
|
6015
6063
|
} else {
|
|
6016
6064
|
const ie = B[ue].replace(/"/g, """);
|
|
6017
|
-
y(
|
|
6065
|
+
y(M, " " + ue + '="' + ie + '"');
|
|
6018
6066
|
}
|
|
6019
6067
|
});
|
|
6020
6068
|
}
|
|
6021
|
-
function Q(
|
|
6022
|
-
B.content.length > 0 && d(B), y(B, "<?" +
|
|
6069
|
+
function Q(M, B) {
|
|
6070
|
+
B.content.length > 0 && d(B), y(B, "<?" + M.name), y(B, " " + M.content.trim()), y(B, "?>");
|
|
6023
6071
|
}
|
|
6024
|
-
function fe(
|
|
6072
|
+
function fe(M, B = {}) {
|
|
6025
6073
|
B.indentation = "indentation" in B ? B.indentation : " ", B.collapseContent = B.collapseContent === !0, B.lineSeparator = "lineSeparator" in B ? B.lineSeparator : `\r
|
|
6026
6074
|
`, B.whiteSpaceAtEndOfSelfclosingTag = B.whiteSpaceAtEndOfSelfclosingTag === !0, B.throwOnFailure = B.throwOnFailure !== !1, B.attributeQuotes = "attributeQuotes" in B ? B.attributeQuotes : "double";
|
|
6027
6075
|
try {
|
|
6028
|
-
const ue = (0, i.default)(
|
|
6076
|
+
const ue = (0, i.default)(M, { filter: B.filter, strictMode: B.strictMode }), ie = { content: "", level: 0, options: B, path: [] };
|
|
6029
6077
|
return ue.declaration && Q(ue.declaration, ie), ue.children.forEach(function(xe) {
|
|
6030
|
-
|
|
6078
|
+
_(xe, ie, !1);
|
|
6031
6079
|
}), B.lineSeparator ? ie.content.replace(/\r\n/g, `
|
|
6032
6080
|
`).replace(/\n/g, B.lineSeparator) : ie.content;
|
|
6033
6081
|
} catch (ue) {
|
|
6034
6082
|
if (B.throwOnFailure)
|
|
6035
6083
|
throw ue;
|
|
6036
|
-
return
|
|
6084
|
+
return M;
|
|
6037
6085
|
}
|
|
6038
6086
|
}
|
|
6039
|
-
fe.minify = (
|
|
6087
|
+
fe.minify = (M, B = {}) => fe(M, Object.assign(Object.assign({}, B), { indentation: "", lineSeparator: "" })), m.exports = fe, s.default = fe;
|
|
6040
6088
|
})($t, $t.exports)), $t.exports;
|
|
6041
6089
|
}
|
|
6042
6090
|
var po = /* @__PURE__ */ ho();
|
|
@@ -6045,11 +6093,11 @@ function go(m) {
|
|
|
6045
6093
|
return mo(m);
|
|
6046
6094
|
}
|
|
6047
6095
|
async function yo(m) {
|
|
6048
|
-
const { extension: s, xmlDocument: l, filename: i } = m,
|
|
6049
|
-
` + new XMLSerializer().serializeToString(l),
|
|
6096
|
+
const { extension: s, xmlDocument: l, filename: i } = m, _ = `<?xml version="1.0" encoding="UTF-8"?>
|
|
6097
|
+
` + new XMLSerializer().serializeToString(l), D = go(_), F = new Blob([D], { type: "application/xml" });
|
|
6050
6098
|
if ("showSaveFilePicker" in window)
|
|
6051
6099
|
try {
|
|
6052
|
-
const
|
|
6100
|
+
const G = await (await window.showSaveFilePicker({
|
|
6053
6101
|
suggestedName: i,
|
|
6054
6102
|
types: [
|
|
6055
6103
|
{
|
|
@@ -6058,13 +6106,13 @@ async function yo(m) {
|
|
|
6058
6106
|
}
|
|
6059
6107
|
]
|
|
6060
6108
|
})).createWritable();
|
|
6061
|
-
await
|
|
6062
|
-
} catch (
|
|
6063
|
-
|
|
6109
|
+
await G.write(F), await G.close();
|
|
6110
|
+
} catch ($) {
|
|
6111
|
+
$.name !== "AbortError" && console.error("Save failed:", $);
|
|
6064
6112
|
}
|
|
6065
6113
|
else {
|
|
6066
|
-
const
|
|
6067
|
-
|
|
6114
|
+
const $ = URL.createObjectURL(F), G = document.createElement("a");
|
|
6115
|
+
G.href = $, G.download = i, document.body.appendChild(G), G.click(), G.remove(), URL.revokeObjectURL($);
|
|
6068
6116
|
}
|
|
6069
6117
|
}
|
|
6070
6118
|
async function qo(m) {
|
|
@@ -6106,32 +6154,32 @@ async function vo(m) {
|
|
|
6106
6154
|
}
|
|
6107
6155
|
}
|
|
6108
6156
|
async function bo(m) {
|
|
6109
|
-
const { databaseInstance: s, dialecteConfig: l, withDatabaseIds: i } = m, { useBrowserApi: d = !0 } = l.io.exportOptions ?? { useBrowserApi: !0 }, h = l.rootElementName, y = l.namespaces.default,
|
|
6157
|
+
const { databaseInstance: s, dialecteConfig: l, withDatabaseIds: i } = m, { useBrowserApi: d = !0 } = l.io.exportOptions ?? { useBrowserApi: !0 }, h = l.rootElementName, y = l.namespaces.default, _ = l.database.tables.xmlElements.name;
|
|
6110
6158
|
if (d) {
|
|
6111
|
-
const
|
|
6159
|
+
const D = document.implementation.createDocument(
|
|
6112
6160
|
y.uri,
|
|
6113
6161
|
null,
|
|
6114
6162
|
null
|
|
6115
|
-
), F = await s.table(
|
|
6163
|
+
), F = await s.table(_).where({ tagName: h }).first();
|
|
6116
6164
|
if (!F) throw new Error(`No ${h} root element found in DB`);
|
|
6117
|
-
const
|
|
6165
|
+
const $ = D.createElementNS(
|
|
6118
6166
|
F.namespace.uri,
|
|
6119
6167
|
F.tagName
|
|
6120
6168
|
);
|
|
6121
|
-
return
|
|
6169
|
+
return $.setAttribute("xmlns", F.namespace.uri), F.attributes && Ta({
|
|
6122
6170
|
dialecteConfig: l,
|
|
6123
|
-
document:
|
|
6124
|
-
element:
|
|
6171
|
+
document: D,
|
|
6172
|
+
element: $,
|
|
6125
6173
|
attributes: F.attributes,
|
|
6126
6174
|
isRoot: !0
|
|
6127
|
-
}), Na({ dialecteConfig: l, rootElement:
|
|
6175
|
+
}), Na({ dialecteConfig: l, rootElement: $, namespace: F.namespace }), F.value && ($.textContent = F.value.trim()), i && $.setAttribute(_a, F.id), D.appendChild($), await Ea({
|
|
6128
6176
|
databaseInstance: s,
|
|
6129
6177
|
dialecteConfig: l,
|
|
6130
|
-
elementsTableName:
|
|
6178
|
+
elementsTableName: _,
|
|
6131
6179
|
withDatabaseIds: i,
|
|
6132
|
-
xmlDocument:
|
|
6180
|
+
xmlDocument: D,
|
|
6133
6181
|
databaseRecord: F,
|
|
6134
|
-
parentDomElement:
|
|
6182
|
+
parentDomElement: $
|
|
6135
6183
|
});
|
|
6136
6184
|
}
|
|
6137
6185
|
}
|
|
@@ -6143,20 +6191,20 @@ async function Ea(m) {
|
|
|
6143
6191
|
withDatabaseIds: d,
|
|
6144
6192
|
xmlDocument: h,
|
|
6145
6193
|
databaseRecord: y,
|
|
6146
|
-
parentDomElement:
|
|
6194
|
+
parentDomElement: _
|
|
6147
6195
|
} = m;
|
|
6148
6196
|
if (!y.children) return;
|
|
6149
|
-
const
|
|
6197
|
+
const D = y.children.map((Q) => Q.id), $ = await s.table(i).bulkGet(D);
|
|
6150
6198
|
Eo({
|
|
6151
|
-
childrenRecords:
|
|
6199
|
+
childrenRecords: $,
|
|
6152
6200
|
parentRecord: y
|
|
6153
6201
|
});
|
|
6154
|
-
const
|
|
6202
|
+
const G = _o({
|
|
6155
6203
|
parentTagName: y.tagName,
|
|
6156
6204
|
availableChildren: l.children,
|
|
6157
|
-
childrenRecords:
|
|
6205
|
+
childrenRecords: $
|
|
6158
6206
|
});
|
|
6159
|
-
for (const Q of
|
|
6207
|
+
for (const Q of G) {
|
|
6160
6208
|
const fe = wo({
|
|
6161
6209
|
dialecteConfig: l,
|
|
6162
6210
|
document: h,
|
|
@@ -6164,7 +6212,7 @@ async function Ea(m) {
|
|
|
6164
6212
|
defaultNamespace: l.namespaces.default,
|
|
6165
6213
|
withDatabaseIds: d
|
|
6166
6214
|
});
|
|
6167
|
-
|
|
6215
|
+
_.appendChild(fe), await Ea({
|
|
6168
6216
|
databaseInstance: s,
|
|
6169
6217
|
dialecteConfig: l,
|
|
6170
6218
|
elementsTableName: i,
|
|
@@ -6198,9 +6246,9 @@ function Ta(m) {
|
|
|
6198
6246
|
const { dialecteConfig: s, document: l, element: i, attributes: d, isRoot: h } = m;
|
|
6199
6247
|
for (const y of d)
|
|
6200
6248
|
if (!To(y))
|
|
6201
|
-
if (
|
|
6202
|
-
const
|
|
6203
|
-
if (!
|
|
6249
|
+
if (Aa(y)) {
|
|
6250
|
+
const _ = y.namespace?.prefix || "";
|
|
6251
|
+
if (!_) {
|
|
6204
6252
|
i.setAttribute(y.name, String(y.value));
|
|
6205
6253
|
continue;
|
|
6206
6254
|
}
|
|
@@ -6209,7 +6257,7 @@ function Ta(m) {
|
|
|
6209
6257
|
document: l,
|
|
6210
6258
|
namespace: y.namespace
|
|
6211
6259
|
});
|
|
6212
|
-
const
|
|
6260
|
+
const D = y.name.includes(":") && y.name.split(":").pop() || y.name, F = `${_}:${D}`;
|
|
6213
6261
|
i.setAttributeNS(y.namespace.uri, F, String(y.value));
|
|
6214
6262
|
} else i.setAttribute(y.name, String(y.value));
|
|
6215
6263
|
}
|
|
@@ -6222,31 +6270,31 @@ function xa(m) {
|
|
|
6222
6270
|
function Na(m) {
|
|
6223
6271
|
const { dialecteConfig: s, rootElement: l, namespace: i } = m, d = Object.entries(
|
|
6224
6272
|
s.definition[s.rootElementName].attributes.details
|
|
6225
|
-
).filter(([y,
|
|
6273
|
+
).filter(([y, _]) => i.uri === s.namespaces.default.uri ? !_.namespace : _.namespace?.prefix === i.prefix && _.namespace?.uri === i.uri);
|
|
6226
6274
|
if (d.length > 0)
|
|
6227
|
-
for (const [y,
|
|
6228
|
-
const
|
|
6229
|
-
if (!(
|
|
6230
|
-
if (
|
|
6231
|
-
const
|
|
6232
|
-
l.setAttributeNS(
|
|
6275
|
+
for (const [y, _] of d) {
|
|
6276
|
+
const D = y.includes(":") && y.split(":").pop() || y;
|
|
6277
|
+
if (!(_.namespace ? l.hasAttributeNS(_.namespace.uri, D) : l.hasAttribute(D)))
|
|
6278
|
+
if (_.namespace) {
|
|
6279
|
+
const $ = `${_.namespace.prefix}:${D}`;
|
|
6280
|
+
l.setAttributeNS(_.namespace.uri, $, _.default || "");
|
|
6233
6281
|
} else
|
|
6234
|
-
l.setAttribute(
|
|
6282
|
+
l.setAttribute(D, _.default || "");
|
|
6235
6283
|
}
|
|
6236
6284
|
}
|
|
6237
6285
|
function _o(m) {
|
|
6238
6286
|
const { parentTagName: s, availableChildren: l, childrenRecords: i } = m, d = [], h = new Set(l[s]);
|
|
6239
6287
|
if (!h.size) return i;
|
|
6240
|
-
const y = /* @__PURE__ */ new Map(),
|
|
6241
|
-
for (const
|
|
6242
|
-
y.set(
|
|
6243
|
-
for (const
|
|
6244
|
-
h.has(
|
|
6245
|
-
for (const
|
|
6246
|
-
const F = y.get(
|
|
6288
|
+
const y = /* @__PURE__ */ new Map(), _ = [];
|
|
6289
|
+
for (const D of h)
|
|
6290
|
+
y.set(D, []);
|
|
6291
|
+
for (const D of i)
|
|
6292
|
+
h.has(D.tagName) ? y.get(D.tagName)?.push(D) : _.push(D);
|
|
6293
|
+
for (const D of h) {
|
|
6294
|
+
const F = y.get(D);
|
|
6247
6295
|
F && F.length && d.push(...F);
|
|
6248
6296
|
}
|
|
6249
|
-
return d.push(...
|
|
6297
|
+
return d.push(..._), d;
|
|
6250
6298
|
}
|
|
6251
6299
|
function Eo(m) {
|
|
6252
6300
|
const { childrenRecords: s, parentRecord: l } = m, i = s.map((d, h) => d === void 0 ? h : -1).filter((d) => d !== -1);
|
|
@@ -6260,21 +6308,21 @@ function Eo(m) {
|
|
|
6260
6308
|
);
|
|
6261
6309
|
}
|
|
6262
6310
|
}
|
|
6263
|
-
function
|
|
6311
|
+
function Aa(m) {
|
|
6264
6312
|
return m !== null && typeof m == "object" && "namespace" in m && !!m.namespace;
|
|
6265
6313
|
}
|
|
6266
6314
|
function To(m) {
|
|
6267
|
-
return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") ||
|
|
6315
|
+
return !!(m.name === "xmlns" || m.name.startsWith("xmlns:") || Aa(m) && m.namespace?.prefix === "xmlns");
|
|
6268
6316
|
}
|
|
6269
6317
|
function Lo(m) {
|
|
6270
|
-
const { config: s, storage: l, extensions: i, hooks: d } = m, h = ua({ base: i?.base, custom: i?.custom }), y =
|
|
6318
|
+
const { config: s, storage: l, extensions: i, hooks: d } = m, h = ua({ base: i?.base, custom: i?.custom }), y = Oa(l, s);
|
|
6271
6319
|
return new va(y, s, h, d);
|
|
6272
6320
|
}
|
|
6273
6321
|
async function Uo(m) {
|
|
6274
|
-
const { config: s, storage: l, extensions: i, hooks: d } = m, h = ua({ base: i?.base, custom: i?.custom }), y =
|
|
6322
|
+
const { config: s, storage: l, extensions: i, hooks: d } = m, h = ua({ base: i?.base, custom: i?.custom }), y = Oa(l, s), _ = s.definition[s.rootElementName], D = Object.entries(_?.attributes.details ?? {}).filter(([, F]) => F.required).map(([F, $]) => ({
|
|
6275
6323
|
name: F,
|
|
6276
|
-
value:
|
|
6277
|
-
|
|
6324
|
+
value: $.fixed ?? $.default ?? "",
|
|
6325
|
+
...$.namespace ? { namespace: $.namespace } : {}
|
|
6278
6326
|
}));
|
|
6279
6327
|
return await y.commit({
|
|
6280
6328
|
creates: [
|
|
@@ -6282,7 +6330,7 @@ async function Uo(m) {
|
|
|
6282
6330
|
id: crypto.randomUUID(),
|
|
6283
6331
|
tagName: s.rootElementName,
|
|
6284
6332
|
namespace: s.namespaces.default,
|
|
6285
|
-
attributes:
|
|
6333
|
+
attributes: D,
|
|
6286
6334
|
value: "",
|
|
6287
6335
|
parent: null,
|
|
6288
6336
|
children: []
|
|
@@ -6294,7 +6342,7 @@ async function Uo(m) {
|
|
|
6294
6342
|
}
|
|
6295
6343
|
}), new va(y, s, h, d);
|
|
6296
6344
|
}
|
|
6297
|
-
function
|
|
6345
|
+
function Oa(m, s) {
|
|
6298
6346
|
return m.type === "local" ? new Bi(m.databaseName, s) : m.store;
|
|
6299
6347
|
}
|
|
6300
6348
|
export {
|
|
@@ -6310,11 +6358,11 @@ export {
|
|
|
6310
6358
|
wa as c,
|
|
6311
6359
|
Ki as d,
|
|
6312
6360
|
qo as e,
|
|
6313
|
-
|
|
6314
|
-
|
|
6361
|
+
Mo as f,
|
|
6362
|
+
ji as g,
|
|
6315
6363
|
Uo as h,
|
|
6316
6364
|
Ko as i,
|
|
6317
|
-
|
|
6365
|
+
jo as j,
|
|
6318
6366
|
ii as k,
|
|
6319
6367
|
Nn as l,
|
|
6320
6368
|
oi as m,
|