@dialecte/core 0.0.7 → 0.0.9
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/chain-methods/chain-creator.d.ts.map +1 -1
- package/dist/chain-methods/ending/queries/get-attributes-values.d.ts +5 -0
- package/dist/chain-methods/ending/queries/get-attributes-values.d.ts.map +1 -0
- package/dist/chain-methods/ending/queries/index.d.ts +1 -0
- package/dist/chain-methods/ending/queries/index.d.ts.map +1 -1
- package/dist/chain-methods/mutations/clone.d.ts +1 -0
- package/dist/chain-methods/mutations/clone.d.ts.map +1 -1
- package/dist/chain-methods/types.d.ts +2 -1
- package/dist/chain-methods/types.d.ts.map +1 -1
- package/dist/index.js +527 -511
- package/dist/types/dialecte-config.d.ts +6 -3
- package/dist/types/dialecte-config.d.ts.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -28,13 +28,13 @@ function pr(l, c) {
|
|
|
28
28
|
function no(l) {
|
|
29
29
|
return Array.isArray(l);
|
|
30
30
|
}
|
|
31
|
-
function
|
|
31
|
+
function is(l) {
|
|
32
32
|
return pr(l, sa);
|
|
33
33
|
}
|
|
34
|
-
function
|
|
34
|
+
function ss(l) {
|
|
35
35
|
return pr(l, ua);
|
|
36
36
|
}
|
|
37
|
-
function
|
|
37
|
+
function us(l) {
|
|
38
38
|
return pr(l, to);
|
|
39
39
|
}
|
|
40
40
|
function xn(l) {
|
|
@@ -87,7 +87,7 @@ function la(l) {
|
|
|
87
87
|
};
|
|
88
88
|
if (!u.elements.includes(h)) return q;
|
|
89
89
|
const z = u.definition[h].attributes.sequence, H = u.definition[h].attributes.details, M = z.flatMap((J) => {
|
|
90
|
-
const
|
|
90
|
+
const re = H[J].required, ye = H[J]?.namespace || void 0, Y = P.find((ie) => ie.name === J)?.value || (re ? H[J]?.default || "" : void 0);
|
|
91
91
|
return Y === void 0 ? [] : [
|
|
92
92
|
{
|
|
93
93
|
name: J,
|
|
@@ -109,7 +109,7 @@ function ro(l) {
|
|
|
109
109
|
const { attributes: c, name: u } = l;
|
|
110
110
|
return c.find((m) => m.name === u)?.value || "";
|
|
111
111
|
}
|
|
112
|
-
function
|
|
112
|
+
function ao(l) {
|
|
113
113
|
const { attributes: c } = l;
|
|
114
114
|
return c.reduce(
|
|
115
115
|
(u, o) => {
|
|
@@ -121,7 +121,7 @@ function ss(l) {
|
|
|
121
121
|
}
|
|
122
122
|
async function fa(l) {
|
|
123
123
|
const { context: c, dialecteConfig: u, databaseInstance: o, tagName: h, attributes: m } = l;
|
|
124
|
-
return (await
|
|
124
|
+
return (await oo({
|
|
125
125
|
tagName: h,
|
|
126
126
|
stagedOperations: c.stagedOperations,
|
|
127
127
|
dialecteConfig: u,
|
|
@@ -163,7 +163,7 @@ async function Ye(l) {
|
|
|
163
163
|
if (P)
|
|
164
164
|
return Ee(P.tagName === u, "Element tagName mismatch"), y === "raw" ? P : Pe({ record: P });
|
|
165
165
|
}
|
|
166
|
-
async function
|
|
166
|
+
async function oo(l) {
|
|
167
167
|
const { stagedOperations: c, tagName: u, dialecteConfig: o, databaseInstance: h, type: m = "raw" } = l, y = o.database.tables.xmlElements.name, b = await h.table(y).where({ tagName: u }).toArray(), R = new Map(
|
|
168
168
|
b.map((P) => [P.id, m === "raw" ? P : Pe({ record: P })])
|
|
169
169
|
);
|
|
@@ -209,7 +209,7 @@ const qe = {
|
|
|
209
209
|
uri: "http://dialecte.dev/XML/DEV-EXT",
|
|
210
210
|
prefix: "ext"
|
|
211
211
|
}
|
|
212
|
-
},
|
|
212
|
+
}, cs = `xmlns="${qe.default.uri}"`, ls = `xmlns:${qe.dev.prefix}="${qe.dev.uri}"`, fs = `xmlns:${qe.ext.prefix}="${qe.ext.uri}"`, io = "db-id", da = `${qe.dev.prefix}:${io}`, so = [
|
|
213
213
|
"A",
|
|
214
214
|
"AAAA_1",
|
|
215
215
|
"AAAA_2",
|
|
@@ -241,7 +241,7 @@ const qe = {
|
|
|
241
241
|
"CC_2",
|
|
242
242
|
"CC_3",
|
|
243
243
|
"Root"
|
|
244
|
-
],
|
|
244
|
+
], uo = {
|
|
245
245
|
A: { aA: "", bA: "", cA: "" },
|
|
246
246
|
AAAA_1: {
|
|
247
247
|
aAAAA_1: "",
|
|
@@ -345,7 +345,7 @@ const qe = {
|
|
|
345
345
|
CC_2: { aCC_2: "", bCC_2: "", cCC_2: "" },
|
|
346
346
|
CC_3: { aCC_3: "", bCC_3: "", cCC_3: "" },
|
|
347
347
|
Root: {}
|
|
348
|
-
},
|
|
348
|
+
}, co = {
|
|
349
349
|
A: ["AA_1", "AA_2", "AA_3"],
|
|
350
350
|
AAAA_1: [],
|
|
351
351
|
AAAA_2: [],
|
|
@@ -377,7 +377,7 @@ const qe = {
|
|
|
377
377
|
CC_2: ["CCC_1", "CCC_2", "CCC_3"],
|
|
378
378
|
CC_3: ["CCC_1", "CCC_2", "CCC_3"],
|
|
379
379
|
Root: ["A", "B", "C"]
|
|
380
|
-
},
|
|
380
|
+
}, lo = {
|
|
381
381
|
A: ["Root"],
|
|
382
382
|
AAAA_1: ["AAA_1"],
|
|
383
383
|
AAAA_2: ["AAA_2"],
|
|
@@ -409,7 +409,7 @@ const qe = {
|
|
|
409
409
|
CC_2: ["C"],
|
|
410
410
|
CC_3: ["C"],
|
|
411
411
|
Root: []
|
|
412
|
-
},
|
|
412
|
+
}, fo = {
|
|
413
413
|
A: ["AAAA_1", "AAAA_2", "AAAA_3", "AAA_1", "AAA_2", "AAA_3", "AA_1", "AA_2", "AA_3"],
|
|
414
414
|
AAAA_1: [],
|
|
415
415
|
AAAA_2: [],
|
|
@@ -472,7 +472,7 @@ const qe = {
|
|
|
472
472
|
"CC_2",
|
|
473
473
|
"CC_3"
|
|
474
474
|
]
|
|
475
|
-
},
|
|
475
|
+
}, ho = {
|
|
476
476
|
A: ["Root"],
|
|
477
477
|
AAAA_1: ["A", "AAA_1", "AA_1", "Root"],
|
|
478
478
|
AAAA_2: ["A", "AAA_2", "AA_2", "Root"],
|
|
@@ -518,13 +518,13 @@ const qe = {
|
|
|
518
518
|
maxOccurrence: null,
|
|
519
519
|
assertions: null
|
|
520
520
|
};
|
|
521
|
-
function
|
|
521
|
+
function mo(l) {
|
|
522
522
|
return {
|
|
523
523
|
required: [`a${l}`],
|
|
524
524
|
optional: [`b${l}`, `c${l}`]
|
|
525
525
|
};
|
|
526
526
|
}
|
|
527
|
-
function
|
|
527
|
+
function po() {
|
|
528
528
|
const l = ["A", "B", "C"], u = {};
|
|
529
529
|
u.Root = {
|
|
530
530
|
tag: "Root",
|
|
@@ -559,13 +559,13 @@ function mo() {
|
|
|
559
559
|
}
|
|
560
560
|
};
|
|
561
561
|
for (const o of l)
|
|
562
|
-
|
|
562
|
+
go(o, 3, u);
|
|
563
563
|
return u;
|
|
564
564
|
}
|
|
565
|
-
function
|
|
566
|
-
const o =
|
|
565
|
+
function go(l, c, u) {
|
|
566
|
+
const o = yo(l, c);
|
|
567
567
|
for (const h of o) {
|
|
568
|
-
const m = ha(h), y =
|
|
568
|
+
const m = ha(h), y = vo(h), b = _o(h, c), P = h.endsWith("_3") ? qe.ext : qe.default, q = mo(h), V = [...q.required, ...q.optional], z = Zr(h), M = {
|
|
569
569
|
...Ct,
|
|
570
570
|
minOccurrence: z === 1 ? 1 : null,
|
|
571
571
|
maxOccurrence: z
|
|
@@ -583,9 +583,9 @@ function po(l, c, u) {
|
|
|
583
583
|
namespace: P,
|
|
584
584
|
attributes: {
|
|
585
585
|
any: !1,
|
|
586
|
-
sequence:
|
|
586
|
+
sequence: V,
|
|
587
587
|
details: Object.fromEntries(
|
|
588
|
-
|
|
588
|
+
V.map((F) => {
|
|
589
589
|
const J = q.required.includes(F), ye = F.startsWith("c") ? qe.ext : P;
|
|
590
590
|
return [
|
|
591
591
|
F,
|
|
@@ -604,14 +604,14 @@ function po(l, c, u) {
|
|
|
604
604
|
sequence: b,
|
|
605
605
|
details: Object.fromEntries(
|
|
606
606
|
b.map((F) => {
|
|
607
|
-
const J = Zr(F),
|
|
607
|
+
const J = Zr(F), re = J === 1;
|
|
608
608
|
return [
|
|
609
609
|
F,
|
|
610
610
|
{
|
|
611
|
-
required:
|
|
611
|
+
required: re,
|
|
612
612
|
validation: {
|
|
613
613
|
...Ct,
|
|
614
|
-
minOccurrence:
|
|
614
|
+
minOccurrence: re ? 1 : null,
|
|
615
615
|
maxOccurrence: J
|
|
616
616
|
},
|
|
617
617
|
constraints: []
|
|
@@ -624,7 +624,7 @@ function po(l, c, u) {
|
|
|
624
624
|
};
|
|
625
625
|
}
|
|
626
626
|
}
|
|
627
|
-
function
|
|
627
|
+
function yo(l, c) {
|
|
628
628
|
const u = [l];
|
|
629
629
|
let o = [l];
|
|
630
630
|
for (let h = 1; h <= c; h++) {
|
|
@@ -640,14 +640,14 @@ function go(l, c) {
|
|
|
640
640
|
}
|
|
641
641
|
return u;
|
|
642
642
|
}
|
|
643
|
-
function
|
|
643
|
+
function vo(l) {
|
|
644
644
|
if (l.length === 1) return null;
|
|
645
645
|
const c = l.match(/^([A-Z]+)_(\d+)$/);
|
|
646
646
|
if (!c) return null;
|
|
647
647
|
const [, u, o] = c;
|
|
648
648
|
return u.length === 2 ? u.charAt(0) : `${u.slice(0, -1)}_${o}`;
|
|
649
649
|
}
|
|
650
|
-
function
|
|
650
|
+
function _o(l, c) {
|
|
651
651
|
if (ha(l) > c) return [];
|
|
652
652
|
const o = l.match(/^([A-Z]+)(?:_(\d+))?$/);
|
|
653
653
|
if (!o) return [];
|
|
@@ -661,9 +661,9 @@ function Zr(l) {
|
|
|
661
661
|
const c = l.match(/_(\d+)$/);
|
|
662
662
|
return c ? parseInt(c[1], 10) : 1;
|
|
663
663
|
}
|
|
664
|
-
const
|
|
664
|
+
const bo = po(), Co = {
|
|
665
665
|
supportedFileExtensions: [".xml"]
|
|
666
|
-
},
|
|
666
|
+
}, Ao = {
|
|
667
667
|
tables: {
|
|
668
668
|
xmlElements: {
|
|
669
669
|
name: "xmlElements",
|
|
@@ -673,20 +673,20 @@ const _o = mo(), bo = {
|
|
|
673
673
|
}, ma = {
|
|
674
674
|
rootElementName: "Root",
|
|
675
675
|
singletonElements: ["Root", "A", "B", "C", "D"],
|
|
676
|
-
elements:
|
|
676
|
+
elements: so,
|
|
677
677
|
namespaces: qe,
|
|
678
|
-
attributes:
|
|
679
|
-
children:
|
|
680
|
-
parents:
|
|
681
|
-
descendants:
|
|
682
|
-
ancestors:
|
|
683
|
-
database:
|
|
684
|
-
io:
|
|
685
|
-
definition:
|
|
678
|
+
attributes: uo,
|
|
679
|
+
children: co,
|
|
680
|
+
parents: lo,
|
|
681
|
+
descendants: fo,
|
|
682
|
+
ancestors: ho,
|
|
683
|
+
database: Ao,
|
|
684
|
+
io: Co,
|
|
685
|
+
definition: bo,
|
|
686
686
|
hooks: {},
|
|
687
687
|
extensions: {}
|
|
688
688
|
};
|
|
689
|
-
function
|
|
689
|
+
function ds(l) {
|
|
690
690
|
const { record: c, type: u = "raw" } = l, o = la({
|
|
691
691
|
record: c,
|
|
692
692
|
dialecteConfig: ma
|
|
@@ -702,11 +702,11 @@ function fs(l) {
|
|
|
702
702
|
throw new Error(`Unsupported record type: ${u}`);
|
|
703
703
|
}
|
|
704
704
|
}
|
|
705
|
-
var
|
|
705
|
+
var wo = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
|
|
706
706
|
function pa(l) {
|
|
707
707
|
return l && l.__esModule && Object.prototype.hasOwnProperty.call(l, "default") ? l.default : l;
|
|
708
708
|
}
|
|
709
|
-
function
|
|
709
|
+
function Bo(l) {
|
|
710
710
|
if (Object.prototype.hasOwnProperty.call(l, "__esModule")) return l;
|
|
711
711
|
var c = l.default;
|
|
712
712
|
if (typeof c == "function") {
|
|
@@ -730,12 +730,12 @@ function wo(l) {
|
|
|
730
730
|
});
|
|
731
731
|
}), u;
|
|
732
732
|
}
|
|
733
|
-
var Tn = { exports: {} },
|
|
734
|
-
function
|
|
733
|
+
var Tn = { exports: {} }, Eo = Tn.exports, Jr;
|
|
734
|
+
function xo() {
|
|
735
735
|
return Jr || (Jr = 1, (function(l, c) {
|
|
736
736
|
(function(u, o) {
|
|
737
737
|
l.exports = o();
|
|
738
|
-
})(
|
|
738
|
+
})(Eo, function() {
|
|
739
739
|
var u = function(e, t) {
|
|
740
740
|
return (u = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function(n, r) {
|
|
741
741
|
n.__proto__ = r;
|
|
@@ -752,7 +752,7 @@ function Eo() {
|
|
|
752
752
|
for (var r, a = 0, i = t.length; a < i; a++) !r && a in t || ((r = r || Array.prototype.slice.call(t, 0, a))[a] = t[a]);
|
|
753
753
|
return e.concat(r || Array.prototype.slice.call(t));
|
|
754
754
|
}
|
|
755
|
-
var m = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window :
|
|
755
|
+
var m = typeof globalThis < "u" ? globalThis : typeof self < "u" ? self : typeof window < "u" ? window : wo, y = Object.keys, b = Array.isArray;
|
|
756
756
|
function R(e, t) {
|
|
757
757
|
return typeof t != "object" || y(t).forEach(function(n) {
|
|
758
758
|
e[n] = t[n];
|
|
@@ -760,7 +760,7 @@ function Eo() {
|
|
|
760
760
|
}
|
|
761
761
|
typeof Promise > "u" || m.Promise || (m.Promise = Promise);
|
|
762
762
|
var P = Object.getPrototypeOf, q = {}.hasOwnProperty;
|
|
763
|
-
function
|
|
763
|
+
function V(e, t) {
|
|
764
764
|
return q.call(e, t);
|
|
765
765
|
}
|
|
766
766
|
function z(e, t) {
|
|
@@ -770,28 +770,28 @@ function Eo() {
|
|
|
770
770
|
}
|
|
771
771
|
var H = Object.defineProperty;
|
|
772
772
|
function M(e, t, n, r) {
|
|
773
|
-
H(e, t, R(n &&
|
|
773
|
+
H(e, t, R(n && V(n, "get") && typeof n.get == "function" ? { get: n.get, set: n.set, configurable: !0 } : { value: n, configurable: !0, writable: !0 }, r));
|
|
774
774
|
}
|
|
775
775
|
function F(e) {
|
|
776
776
|
return { from: function(t) {
|
|
777
777
|
return e.prototype = Object.create(t.prototype), M(e.prototype, "constructor", e), { extend: z.bind(null, e.prototype) };
|
|
778
778
|
} };
|
|
779
779
|
}
|
|
780
|
-
var J = Object.getOwnPropertyDescriptor,
|
|
780
|
+
var J = Object.getOwnPropertyDescriptor, re = [].slice;
|
|
781
781
|
function ye(e, t, n) {
|
|
782
|
-
return
|
|
782
|
+
return re.call(e, t, n);
|
|
783
783
|
}
|
|
784
|
-
function
|
|
784
|
+
function ee(e, t) {
|
|
785
785
|
return t(e);
|
|
786
786
|
}
|
|
787
787
|
function Y(e) {
|
|
788
788
|
if (!e) throw new Error("Assertion Failed");
|
|
789
789
|
}
|
|
790
|
-
function
|
|
790
|
+
function ie(e) {
|
|
791
791
|
m.setImmediate ? setImmediate(e) : setTimeout(e, 0);
|
|
792
792
|
}
|
|
793
793
|
function pe(e, t) {
|
|
794
|
-
if (typeof t == "string" &&
|
|
794
|
+
if (typeof t == "string" && V(e, t)) return e[t];
|
|
795
795
|
if (!t) return e;
|
|
796
796
|
if (typeof t != "string") {
|
|
797
797
|
for (var n = [], r = 0, a = t.length; r < a; ++r) {
|
|
@@ -806,18 +806,18 @@ function Eo() {
|
|
|
806
806
|
return p == null ? void 0 : pe(p, t.substr(d + 1));
|
|
807
807
|
}
|
|
808
808
|
}
|
|
809
|
-
function
|
|
809
|
+
function oe(e, t, n) {
|
|
810
810
|
if (e && t !== void 0 && !("isFrozen" in Object && Object.isFrozen(e))) if (typeof t != "string" && "length" in t) {
|
|
811
811
|
Y(typeof n != "string" && "length" in n);
|
|
812
|
-
for (var r = 0, a = t.length; r < a; ++r)
|
|
812
|
+
for (var r = 0, a = t.length; r < a; ++r) oe(e, t[r], n[r]);
|
|
813
813
|
} else {
|
|
814
814
|
var i, d, p = t.indexOf(".");
|
|
815
|
-
p !== -1 ? (i = t.substr(0, p), (d = t.substr(p + 1)) === "" ? n === void 0 ? b(e) && !isNaN(parseInt(i)) ? e.splice(i, 1) : delete e[i] : e[i] = n :
|
|
815
|
+
p !== -1 ? (i = t.substr(0, p), (d = t.substr(p + 1)) === "" ? n === void 0 ? b(e) && !isNaN(parseInt(i)) ? e.splice(i, 1) : delete e[i] : e[i] = n : oe(p = !(p = e[i]) || !V(e, i) ? e[i] = {} : p, d, n)) : n === void 0 ? b(e) && !isNaN(parseInt(t)) ? e.splice(t, 1) : delete e[t] : e[t] = n;
|
|
816
816
|
}
|
|
817
817
|
}
|
|
818
818
|
function Re(e) {
|
|
819
819
|
var t, n = {};
|
|
820
|
-
for (t in e)
|
|
820
|
+
for (t in e) V(e, t) && (n[t] = e[t]);
|
|
821
821
|
return n;
|
|
822
822
|
}
|
|
823
823
|
var I = [].concat;
|
|
@@ -844,7 +844,7 @@ function Eo() {
|
|
|
844
844
|
} else if (ze.has(n.constructor)) r = n;
|
|
845
845
|
else {
|
|
846
846
|
var d, p = P(n);
|
|
847
|
-
for (d in r = p === Object.prototype ? {} : Object.create(p), de.set(n, r), n)
|
|
847
|
+
for (d in r = p === Object.prototype ? {} : Object.create(p), de.set(n, r), n) V(n, d) && (r[d] = t(n[d]));
|
|
848
848
|
}
|
|
849
849
|
return r;
|
|
850
850
|
})(e), de = null, e;
|
|
@@ -1492,7 +1492,7 @@ function Eo() {
|
|
|
1492
1492
|
return p.numFailures ? X.reject(p.failures[0]) : p.lastResult;
|
|
1493
1493
|
}).then(function(p) {
|
|
1494
1494
|
if (i) try {
|
|
1495
|
-
|
|
1495
|
+
oe(e, i, p);
|
|
1496
1496
|
} catch {
|
|
1497
1497
|
}
|
|
1498
1498
|
return p;
|
|
@@ -1507,7 +1507,7 @@ function Eo() {
|
|
|
1507
1507
|
return p.numFailures ? X.reject(p.failures[0]) : p.lastResult;
|
|
1508
1508
|
}).then(function(p) {
|
|
1509
1509
|
if (i) try {
|
|
1510
|
-
|
|
1510
|
+
oe(e, i, p);
|
|
1511
1511
|
} catch {
|
|
1512
1512
|
}
|
|
1513
1513
|
return p;
|
|
@@ -1581,7 +1581,7 @@ function Eo() {
|
|
|
1581
1581
|
var D = N[E], S = A[D];
|
|
1582
1582
|
if (D === t.schema.primKey.keyPath) {
|
|
1583
1583
|
if (se(S, _) !== 0) throw new O.Constraint("Cannot update primary key in bulkUpdate()");
|
|
1584
|
-
} else
|
|
1584
|
+
} else oe(x, D, S);
|
|
1585
1585
|
}
|
|
1586
1586
|
i.push(T), v.push(_), C.push(x);
|
|
1587
1587
|
}
|
|
@@ -1645,7 +1645,7 @@ function Eo() {
|
|
|
1645
1645
|
var _ = i(g, he, function() {
|
|
1646
1646
|
for (var A = arguments.length, x = new Array(A); A--; ) x[A] = arguments[A];
|
|
1647
1647
|
_.subscribers.forEach(function(E) {
|
|
1648
|
-
|
|
1648
|
+
ie(function() {
|
|
1649
1649
|
E.apply(null, x);
|
|
1650
1650
|
});
|
|
1651
1651
|
});
|
|
@@ -1688,7 +1688,7 @@ function Eo() {
|
|
|
1688
1688
|
return v.stop(T);
|
|
1689
1689
|
}, function(T) {
|
|
1690
1690
|
return v.fail(T);
|
|
1691
|
-
}) || ((g = "" + (w = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(w)),
|
|
1691
|
+
}) || ((g = "" + (w = v.primaryKey)) == "[object ArrayBuffer]" && (g = "" + new Uint8Array(w)), V(i, g) || (i[g] = !0, t(p, v, C)));
|
|
1692
1692
|
};
|
|
1693
1693
|
return Promise.all([e.or._iterate(d, n), Ir(Rr(e, r, n), e.algorithm, d, !e.keysOnly && e.valueMapper)]);
|
|
1694
1694
|
}
|
|
@@ -1904,7 +1904,7 @@ function Eo() {
|
|
|
1904
1904
|
if (!e || !e.multi) return this;
|
|
1905
1905
|
var t = {};
|
|
1906
1906
|
return Un(this._ctx, function(a) {
|
|
1907
|
-
var r = a.primaryKey.toString(), a =
|
|
1907
|
+
var r = a.primaryKey.toString(), a = V(t, r);
|
|
1908
1908
|
return t[r] = !0, !a;
|
|
1909
1909
|
}), this;
|
|
1910
1910
|
}, le.prototype.modify = function(e) {
|
|
@@ -1914,7 +1914,7 @@ function Eo() {
|
|
|
1914
1914
|
d = typeof e == "function" ? e : (a = y(e), i = a.length, function(N) {
|
|
1915
1915
|
for (var D = !1, S = 0; S < i; ++S) {
|
|
1916
1916
|
var k = a[S], j = e[k], U = pe(N, k);
|
|
1917
|
-
j instanceof Ut ? (
|
|
1917
|
+
j instanceof Ut ? (oe(N, k, j.execute(U)), D = !0) : U !== j && (oe(N, k, j), D = !0);
|
|
1918
1918
|
}
|
|
1919
1919
|
return D;
|
|
1920
1920
|
});
|
|
@@ -1933,17 +1933,17 @@ function Eo() {
|
|
|
1933
1933
|
function D(k) {
|
|
1934
1934
|
var j = Math.min(w, N.length - k), U = N.slice(k, k + j);
|
|
1935
1935
|
return (E ? Promise.resolve([]) : p.getMany({ trans: r, keys: U, cache: "immutable" })).then(function(K) {
|
|
1936
|
-
var L = [],
|
|
1937
|
-
if (!E) for (var
|
|
1938
|
-
var ce = K[
|
|
1939
|
-
d.call(ne, ne.value, ne) !== !1 && (ne.value == null ? W.push(N[k +
|
|
1936
|
+
var L = [], G = [], $ = v ? [] : null, W = E ? U : [];
|
|
1937
|
+
if (!E) for (var ae = 0; ae < j; ++ae) {
|
|
1938
|
+
var ce = K[ae], ne = { value: Se(ce), primKey: N[k + ae] };
|
|
1939
|
+
d.call(ne, ne.value, ne) !== !1 && (ne.value == null ? W.push(N[k + ae]) : v || se(C(ce), C(ne.value)) === 0 ? (G.push(ne.value), v && $.push(N[k + ae])) : (W.push(N[k + ae]), L.push(ne.value)));
|
|
1940
1940
|
}
|
|
1941
1941
|
return Promise.resolve(0 < L.length && p.mutate({ trans: r, type: "add", values: L }).then(function(_e) {
|
|
1942
|
-
for (var
|
|
1942
|
+
for (var te in _e.failures) W.splice(parseInt(te), 1);
|
|
1943
1943
|
T(L.length, _e);
|
|
1944
1944
|
})).then(function() {
|
|
1945
|
-
return (0 <
|
|
1946
|
-
return T(
|
|
1945
|
+
return (0 < G.length || S && typeof e == "object") && p.mutate({ trans: r, type: "put", keys: $, values: G, criteria: S, changeSpec: typeof e != "function" && e, isAdditionalChunk: 0 < k }).then(function(_e) {
|
|
1946
|
+
return T(G.length, _e);
|
|
1947
1947
|
});
|
|
1948
1948
|
}).then(function() {
|
|
1949
1949
|
return (0 < W.length || S && E) && p.mutate({ trans: r, type: "delete", keys: W, criteria: S, isAdditionalChunk: 0 < k }).then(function(_e) {
|
|
@@ -2035,13 +2035,13 @@ function Eo() {
|
|
|
2035
2035
|
var D = i(N);
|
|
2036
2036
|
if (t(D, v, _)) return !0;
|
|
2037
2037
|
for (var S = null, k = _; k < g; ++k) {
|
|
2038
|
-
var j = (function(U, K, L,
|
|
2039
|
-
for (var
|
|
2038
|
+
var j = (function(U, K, L, G, $, W) {
|
|
2039
|
+
for (var ae = Math.min(U.length, G.length), ce = -1, ne = 0; ne < ae; ++ne) {
|
|
2040
2040
|
var _e = K[ne];
|
|
2041
|
-
if (_e !==
|
|
2041
|
+
if (_e !== G[ne]) return $(U[ne], L[ne]) < 0 ? U.substr(0, ne) + L[ne] + L.substr(ne + 1) : $(U[ne], G[ne]) < 0 ? U.substr(0, ne) + G[ne] + L.substr(ne + 1) : 0 <= ce ? U.substr(0, ce) + K[ce] + L.substr(ce + 1) : null;
|
|
2042
2042
|
$(U[ne], _e) < 0 && (ce = ne);
|
|
2043
2043
|
}
|
|
2044
|
-
return
|
|
2044
|
+
return ae < G.length && W === "next" ? U + L.substr(U.length) : ae < U.length && W === "prev" ? U.substr(0, L.length) : ce < 0 ? null : U.substr(0, ce) + G[ce] + L.substr(ce + 1);
|
|
2045
2045
|
})(N, D, p[k], v[k], d, C);
|
|
2046
2046
|
j === null && S === null ? _ = k + 1 : (S === null || 0 < d(S, j)) && (S = j);
|
|
2047
2047
|
}
|
|
@@ -2286,7 +2286,7 @@ function Eo() {
|
|
|
2286
2286
|
this.active && (this.active = !1, this.idbtrans && this.idbtrans.abort(), this._reject(new O.Abort()));
|
|
2287
2287
|
}, $e.prototype.table = function(e) {
|
|
2288
2288
|
var t = this._memoizedTables || (this._memoizedTables = {});
|
|
2289
|
-
if (
|
|
2289
|
+
if (V(t, e)) return t[e];
|
|
2290
2290
|
var n = this.schema[e];
|
|
2291
2291
|
if (!n) throw new O.NotFound("Table " + e + " not part of transaction");
|
|
2292
2292
|
return n = new this.db.Table(e, n, this), n.core = this.db.core.table(e), t[e] = n;
|
|
@@ -2349,12 +2349,12 @@ function Eo() {
|
|
|
2349
2349
|
var E = x.trans, N = x.type, D = x.keys, S = x.values, k = x.range;
|
|
2350
2350
|
return new Promise(function(j, U) {
|
|
2351
2351
|
j = ge(j);
|
|
2352
|
-
var K = E.objectStore(A), L = K.keyPath == null,
|
|
2353
|
-
if (!
|
|
2352
|
+
var K = E.objectStore(A), L = K.keyPath == null, G = N === "put" || N === "add";
|
|
2353
|
+
if (!G && N !== "delete" && N !== "deleteRange") throw new Error("Invalid operation type: " + N);
|
|
2354
2354
|
var $, W = (D || S || { length: 1 }).length;
|
|
2355
2355
|
if (D && S && D.length !== S.length) throw new Error("Given keys array must have same length as given values array.");
|
|
2356
2356
|
if (W === 0) return j({ numFailures: 0, failures: {}, results: [], lastResult: void 0 });
|
|
2357
|
-
function
|
|
2357
|
+
function ae(Ie) {
|
|
2358
2358
|
++_e, $t(Ie);
|
|
2359
2359
|
}
|
|
2360
2360
|
var ce = [], ne = [], _e = 0;
|
|
@@ -2362,9 +2362,9 @@ function Eo() {
|
|
|
2362
2362
|
if (k.type === 4) return j({ numFailures: _e, failures: ne, results: [], lastResult: void 0 });
|
|
2363
2363
|
k.type === 3 ? ce.push($ = K.clear()) : ce.push($ = K.delete(r(k)));
|
|
2364
2364
|
} else {
|
|
2365
|
-
var L =
|
|
2366
|
-
if (
|
|
2367
|
-
else for (Oe = 0; Oe < W; ++Oe) ce.push($ = K[N](
|
|
2365
|
+
var L = G ? L ? [S, D] : [S, null] : [D, null], te = L[0], Ne = L[1];
|
|
2366
|
+
if (G) for (var Oe = 0; Oe < W; ++Oe) ce.push($ = Ne && Ne[Oe] !== void 0 ? K[N](te[Oe], Ne[Oe]) : K[N](te[Oe])), $.onerror = ae;
|
|
2367
|
+
else for (Oe = 0; Oe < W; ++Oe) ce.push($ = K[N](te[Oe])), $.onerror = ae;
|
|
2368
2368
|
}
|
|
2369
2369
|
function Bn(Ie) {
|
|
2370
2370
|
Ie = Ie.target.result, ce.forEach(function(bt, fr) {
|
|
@@ -2374,16 +2374,16 @@ function Eo() {
|
|
|
2374
2374
|
}), lastResult: Ie });
|
|
2375
2375
|
}
|
|
2376
2376
|
$.onerror = function(Ie) {
|
|
2377
|
-
|
|
2377
|
+
ae(Ie), Bn(Ie);
|
|
2378
2378
|
}, $.onsuccess = Bn;
|
|
2379
2379
|
});
|
|
2380
2380
|
}, getMany: function(x) {
|
|
2381
2381
|
var E = x.trans, N = x.keys;
|
|
2382
2382
|
return new Promise(function(D, S) {
|
|
2383
2383
|
D = ge(D);
|
|
2384
|
-
for (var k, j = E.objectStore(A), U = N.length, K = new Array(U), L = 0,
|
|
2385
|
-
ce = ce.target, K[ce._pos] = ce.result, ++
|
|
2386
|
-
}, W = Ue(S),
|
|
2384
|
+
for (var k, j = E.objectStore(A), U = N.length, K = new Array(U), L = 0, G = 0, $ = function(ce) {
|
|
2385
|
+
ce = ce.target, K[ce._pos] = ce.result, ++G === L && D(K);
|
|
2386
|
+
}, W = Ue(S), ae = 0; ae < U; ++ae) N[ae] != null && ((k = j.get(N[ae]))._pos = ae, k.onsuccess = $, k.onerror = W, ++L);
|
|
2387
2387
|
L === 0 && D(K);
|
|
2388
2388
|
});
|
|
2389
2389
|
}, get: function(x) {
|
|
@@ -2398,53 +2398,53 @@ function Eo() {
|
|
|
2398
2398
|
}, query: (_ = C, function(x) {
|
|
2399
2399
|
return new Promise(function(E, N) {
|
|
2400
2400
|
E = ge(E);
|
|
2401
|
-
var D, S, k, L = x.trans, j = x.values, U = x.limit, $ = x.query, K = U === 1 / 0 ? void 0 : U,
|
|
2401
|
+
var D, S, k, L = x.trans, j = x.values, U = x.limit, $ = x.query, K = U === 1 / 0 ? void 0 : U, G = $.index, $ = $.range, L = L.objectStore(A), G = G.isPrimaryKey ? L : L.index(G.name), $ = r($);
|
|
2402
2402
|
if (U === 0) return E({ result: [] });
|
|
2403
|
-
_ ? ((K = j ?
|
|
2403
|
+
_ ? ((K = j ? G.getAll($, K) : G.getAllKeys($, K)).onsuccess = function(W) {
|
|
2404
2404
|
return E({ result: W.target.result });
|
|
2405
|
-
}, K.onerror = Ue(N)) : (D = 0, S = !j && "openKeyCursor" in
|
|
2406
|
-
var
|
|
2407
|
-
return
|
|
2405
|
+
}, K.onerror = Ue(N)) : (D = 0, S = !j && "openKeyCursor" in G ? G.openKeyCursor($) : G.openCursor($), k = [], S.onsuccess = function(W) {
|
|
2406
|
+
var ae = S.result;
|
|
2407
|
+
return ae ? (k.push(j ? ae.value : ae.primaryKey), ++D === U ? E({ result: k }) : void ae.continue()) : E({ result: k });
|
|
2408
2408
|
}, S.onerror = Ue(N));
|
|
2409
2409
|
});
|
|
2410
2410
|
}), openCursor: function(x) {
|
|
2411
2411
|
var E = x.trans, N = x.values, D = x.query, S = x.reverse, k = x.unique;
|
|
2412
2412
|
return new Promise(function(j, U) {
|
|
2413
2413
|
j = ge(j);
|
|
2414
|
-
var
|
|
2414
|
+
var G = D.index, K = D.range, L = E.objectStore(A), L = G.isPrimaryKey ? L : L.index(G.name), G = S ? k ? "prevunique" : "prev" : k ? "nextunique" : "next", $ = !N && "openKeyCursor" in L ? L.openKeyCursor(r(K), G) : L.openCursor(r(K), G);
|
|
2415
2415
|
$.onerror = Ue(U), $.onsuccess = ge(function(W) {
|
|
2416
|
-
var
|
|
2417
|
-
|
|
2416
|
+
var ae, ce, ne, _e, te = $.result;
|
|
2417
|
+
te ? (te.___id = ++ja, te.done = !1, ae = te.continue.bind(te), ce = (ce = te.continuePrimaryKey) && ce.bind(te), ne = te.advance.bind(te), _e = function() {
|
|
2418
2418
|
throw new Error("Cursor not stopped");
|
|
2419
|
-
},
|
|
2419
|
+
}, te.trans = E, te.stop = te.continue = te.continuePrimaryKey = te.advance = function() {
|
|
2420
2420
|
throw new Error("Cursor not started");
|
|
2421
|
-
},
|
|
2421
|
+
}, te.fail = ge(U), te.next = function() {
|
|
2422
2422
|
var Ne = this, Oe = 1;
|
|
2423
2423
|
return this.start(function() {
|
|
2424
2424
|
return Oe-- ? Ne.continue() : Ne.stop();
|
|
2425
2425
|
}).then(function() {
|
|
2426
2426
|
return Ne;
|
|
2427
2427
|
});
|
|
2428
|
-
},
|
|
2428
|
+
}, te.start = function(Ne) {
|
|
2429
2429
|
function Oe() {
|
|
2430
2430
|
if ($.result) try {
|
|
2431
2431
|
Ne();
|
|
2432
2432
|
} catch (Ie) {
|
|
2433
|
-
|
|
2433
|
+
te.fail(Ie);
|
|
2434
2434
|
}
|
|
2435
|
-
else
|
|
2435
|
+
else te.done = !0, te.start = function() {
|
|
2436
2436
|
throw new Error("Cursor behind last entry");
|
|
2437
|
-
},
|
|
2437
|
+
}, te.stop();
|
|
2438
2438
|
}
|
|
2439
2439
|
var Bn = new Promise(function(Ie, bt) {
|
|
2440
|
-
Ie = ge(Ie), $.onerror = Ue(bt),
|
|
2441
|
-
|
|
2440
|
+
Ie = ge(Ie), $.onerror = Ue(bt), te.fail = bt, te.stop = function(fr) {
|
|
2441
|
+
te.stop = te.continue = te.continuePrimaryKey = te.advance = _e, Ie(fr);
|
|
2442
2442
|
};
|
|
2443
2443
|
});
|
|
2444
2444
|
return $.onsuccess = ge(function(Ie) {
|
|
2445
2445
|
$.onsuccess = Oe, Oe();
|
|
2446
|
-
}),
|
|
2447
|
-
}, j(
|
|
2446
|
+
}), te.continue = ae, te.continuePrimaryKey = ce, te.advance = ne, Oe(), Bn;
|
|
2447
|
+
}, j(te)) : j(null);
|
|
2448
2448
|
}, U);
|
|
2449
2449
|
});
|
|
2450
2450
|
}, count: function(x) {
|
|
@@ -2532,16 +2532,16 @@ function Eo() {
|
|
|
2532
2532
|
var D = E, S = N._cfg.dbschema;
|
|
2533
2533
|
yn(g, D, A), yn(g, S, A), E = g._dbSchema = S;
|
|
2534
2534
|
var k = zn(D, S);
|
|
2535
|
-
k.add.forEach(function(
|
|
2536
|
-
Qn(A,
|
|
2537
|
-
}), k.change.forEach(function(
|
|
2538
|
-
if (
|
|
2539
|
-
var $ = A.objectStore(
|
|
2540
|
-
|
|
2535
|
+
k.add.forEach(function(G) {
|
|
2536
|
+
Qn(A, G[0], G[1].primKey, G[1].indexes);
|
|
2537
|
+
}), k.change.forEach(function(G) {
|
|
2538
|
+
if (G.recreate) throw new O.Upgrade("Not yet support for changing primary key");
|
|
2539
|
+
var $ = A.objectStore(G.name);
|
|
2540
|
+
G.add.forEach(function(W) {
|
|
2541
2541
|
return pn($, W);
|
|
2542
|
-
}),
|
|
2542
|
+
}), G.change.forEach(function(W) {
|
|
2543
2543
|
$.deleteIndex(W.name), pn($, W);
|
|
2544
|
-
}),
|
|
2544
|
+
}), G.del.forEach(function(W) {
|
|
2545
2545
|
return $.deleteIndex(W);
|
|
2546
2546
|
});
|
|
2547
2547
|
});
|
|
@@ -2549,13 +2549,13 @@ function Eo() {
|
|
|
2549
2549
|
if (j && N._cfg.version > T) {
|
|
2550
2550
|
hn(g, A), _._memoizedTables = {};
|
|
2551
2551
|
var U = Re(S);
|
|
2552
|
-
k.del.forEach(function(
|
|
2553
|
-
U[
|
|
2552
|
+
k.del.forEach(function(G) {
|
|
2553
|
+
U[G] = D[G];
|
|
2554
2554
|
}), Yn(g, [g.Transaction.prototype]), mn(g, [g.Transaction.prototype], y(U), U), _.schema = U;
|
|
2555
2555
|
var K, L = je(j);
|
|
2556
2556
|
return L && xt(), k = X.follow(function() {
|
|
2557
|
-
var
|
|
2558
|
-
(K = j(_)) && L && (
|
|
2557
|
+
var G;
|
|
2558
|
+
(K = j(_)) && L && (G = nt.bind(null, null), K.then(G, G));
|
|
2559
2559
|
}), K && typeof K.then == "function" ? X.resolve(K) : k.then(function() {
|
|
2560
2560
|
return K;
|
|
2561
2561
|
});
|
|
@@ -2766,7 +2766,7 @@ function Eo() {
|
|
|
2766
2766
|
return y(t).forEach(function(n) {
|
|
2767
2767
|
e[n] ? Yt(e[n], t[n]) : e[n] = (function r(a) {
|
|
2768
2768
|
var i, d, p = {};
|
|
2769
|
-
for (i in a)
|
|
2769
|
+
for (i in a) V(a, i) && (d = a[i], p[i] = !d || typeof d != "object" || ze.has(d.constructor) ? d : r(d));
|
|
2770
2770
|
return p;
|
|
2771
2771
|
})(t[n]);
|
|
2772
2772
|
}), e;
|
|
@@ -2980,9 +2980,9 @@ function Eo() {
|
|
|
2980
2980
|
function ir(e, t, n, r) {
|
|
2981
2981
|
return n = n || {}, r = r || "", y(e).forEach(function(a) {
|
|
2982
2982
|
var i, d, p;
|
|
2983
|
-
|
|
2983
|
+
V(t, a) ? (i = e[a], d = t[a], typeof i == "object" && typeof d == "object" && i && d ? (p = Ve(i)) !== Ve(d) ? n[r + a] = t[a] : p === "Object" ? ir(i, d, n, r + a + ".") : i !== d && (n[r + a] = t[a]) : i !== d && (n[r + a] = t[a])) : n[r + a] = void 0;
|
|
2984
2984
|
}), y(t).forEach(function(a) {
|
|
2985
|
-
|
|
2985
|
+
V(e, a) || (n[r + a] = t[a]);
|
|
2986
2986
|
}), n;
|
|
2987
2987
|
}
|
|
2988
2988
|
function sr(e, t) {
|
|
@@ -3028,15 +3028,15 @@ function Eo() {
|
|
|
3028
3028
|
if (!E) throw new Error("Keys missing");
|
|
3029
3029
|
return (g = g.type === "add" || g.type === "put" ? o(o({}, g), { keys: E }) : o({}, g)).type !== "delete" && (g.values = h([], g.values)), g.keys && (g.keys = h([], g.keys)), T = n, A = E, ((_ = g).type === "add" ? Promise.resolve([]) : T.getMany({ trans: _.trans, keys: A, cache: "immutable" })).then(function(N) {
|
|
3030
3030
|
var D = E.map(function(S, k) {
|
|
3031
|
-
var j, U, K, L = N[k],
|
|
3032
|
-
return g.type === "delete" ? p.fire.call(
|
|
3033
|
-
|
|
3034
|
-
}))),
|
|
3031
|
+
var j, U, K, L = N[k], G = { onerror: null, onsuccess: null };
|
|
3032
|
+
return g.type === "delete" ? p.fire.call(G, S, L, x) : g.type === "add" || L === void 0 ? (j = v.fire.call(G, S, g.values[k], x), S == null && j != null && (g.keys[k] = S = j, r.outbound || oe(g.values[k], r.keyPath, S))) : (j = ir(L, g.values[k]), (U = C.fire.call(G, j, S, L, x)) && (K = g.values[k], Object.keys(U).forEach(function($) {
|
|
3033
|
+
V(K, $) ? K[$] = U[$] : oe(K, $, U[$]);
|
|
3034
|
+
}))), G;
|
|
3035
3035
|
});
|
|
3036
3036
|
return n.mutate(g).then(function(S) {
|
|
3037
3037
|
for (var k = S.failures, j = S.results, U = S.numFailures, S = S.lastResult, K = 0; K < E.length; ++K) {
|
|
3038
|
-
var L = (j || E)[K],
|
|
3039
|
-
L == null ?
|
|
3038
|
+
var L = (j || E)[K], G = D[K];
|
|
3039
|
+
L == null ? G.onerror && G.onerror(k[K]) : G.onsuccess && G.onsuccess(g.type === "put" && N[K] ? g.values[K] : L);
|
|
3040
3040
|
}
|
|
3041
3041
|
return { failures: k, results: j, numFailures: U, lastResult: S };
|
|
3042
3042
|
}).catch(function(S) {
|
|
@@ -3098,12 +3098,12 @@ function Eo() {
|
|
|
3098
3098
|
function A($) {
|
|
3099
3099
|
return $ = "idb://".concat(t, "/").concat(r, "/").concat($), S[$] || (S[$] = new Te());
|
|
3100
3100
|
}
|
|
3101
|
-
var x, E, N, D = _.trans, S = _.mutatedParts || (_.mutatedParts = {}), k = A(""), j = A(":dels"), U = _.type,
|
|
3101
|
+
var x, E, N, D = _.trans, S = _.mutatedParts || (_.mutatedParts = {}), k = A(""), j = A(":dels"), U = _.type, G = _.type === "deleteRange" ? [_.range] : _.type === "delete" ? [_.keys] : _.values.length < 50 ? [sr(d, _).filter(function($) {
|
|
3102
3102
|
return $;
|
|
3103
|
-
}), _.values] : [], K =
|
|
3104
|
-
return b(K) ? (k.addKeys(K), (
|
|
3103
|
+
}), _.values] : [], K = G[0], L = G[1], G = _.trans._cache;
|
|
3104
|
+
return b(K) ? (k.addKeys(K), (G = U === "delete" || K.length === L.length ? Vr(K, G) : null) || j.addKeys(K), (G || L) && (x = A, E = G, N = L, i.indexes.forEach(function($) {
|
|
3105
3105
|
var W = x($.name || "");
|
|
3106
|
-
function
|
|
3106
|
+
function ae(ne) {
|
|
3107
3107
|
return ne != null ? $.extractKey(ne) : null;
|
|
3108
3108
|
}
|
|
3109
3109
|
function ce(ne) {
|
|
@@ -3112,19 +3112,19 @@ function Eo() {
|
|
|
3112
3112
|
}) : W.addKey(ne);
|
|
3113
3113
|
}
|
|
3114
3114
|
(E || N).forEach(function(ne, Ne) {
|
|
3115
|
-
var
|
|
3116
|
-
se(
|
|
3115
|
+
var te = E && ae(E[Ne]), Ne = N && ae(N[Ne]);
|
|
3116
|
+
se(te, Ne) !== 0 && (te != null && ce(te), Ne != null && ce(Ne));
|
|
3117
3117
|
});
|
|
3118
3118
|
}))) : K ? (L = { from: (L = K.lower) !== null && L !== void 0 ? L : e.MIN_KEY, to: (L = K.upper) !== null && L !== void 0 ? L : e.MAX_KEY }, j.add(L), k.add(L)) : (k.add(n), j.add(n), i.indexes.forEach(function($) {
|
|
3119
3119
|
return A($.name).add(n);
|
|
3120
3120
|
})), a.mutate(_).then(function($) {
|
|
3121
3121
|
return !K || _.type !== "add" && _.type !== "put" || (k.addKeys($.results), C && C.forEach(function(W) {
|
|
3122
|
-
for (var
|
|
3123
|
-
return W.extractKey(
|
|
3124
|
-
}), ce = W.keyPath.findIndex(function(
|
|
3125
|
-
return
|
|
3126
|
-
}), ne = 0, _e = $.results.length; ne < _e; ++ne)
|
|
3127
|
-
A(W.name).addKeys(
|
|
3122
|
+
for (var ae = _.values.map(function(te) {
|
|
3123
|
+
return W.extractKey(te);
|
|
3124
|
+
}), ce = W.keyPath.findIndex(function(te) {
|
|
3125
|
+
return te === d.keyPath;
|
|
3126
|
+
}), ne = 0, _e = $.results.length; ne < _e; ++ne) ae[ne][ce] = $.results[ne];
|
|
3127
|
+
A(W.name).addKeys(ae);
|
|
3128
3128
|
})), D.mutatedParts = _n(D.mutatedParts || {}, S), $;
|
|
3129
3129
|
});
|
|
3130
3130
|
} }), g = function(A) {
|
|
@@ -3147,18 +3147,18 @@ function Eo() {
|
|
|
3147
3147
|
var j = _ === "query" && v && A.values && a.query(o(o({}, A), { values: !1 }));
|
|
3148
3148
|
return a[_].apply(this, arguments).then(function(L) {
|
|
3149
3149
|
if (_ === "query") {
|
|
3150
|
-
if (v && A.values) return j.then(function(
|
|
3151
|
-
return
|
|
3150
|
+
if (v && A.values) return j.then(function(ae) {
|
|
3151
|
+
return ae = ae.result, S.addKeys(ae), L;
|
|
3152
3152
|
});
|
|
3153
|
-
var
|
|
3154
|
-
(A.values ? S : k).addKeys(
|
|
3153
|
+
var G = A.values ? L.result.map(p) : L.result;
|
|
3154
|
+
(A.values ? S : k).addKeys(G);
|
|
3155
3155
|
} else if (_ === "openCursor") {
|
|
3156
3156
|
var $ = L, W = A.values;
|
|
3157
3157
|
return $ && Object.create($, { key: { get: function() {
|
|
3158
3158
|
return k.addKey($.primaryKey), $.key;
|
|
3159
3159
|
} }, primaryKey: { get: function() {
|
|
3160
|
-
var
|
|
3161
|
-
return k.addKey(
|
|
3160
|
+
var ae = $.primaryKey;
|
|
3161
|
+
return k.addKey(ae), ae;
|
|
3162
3162
|
} }, value: { get: function() {
|
|
3163
3163
|
return W && S.addKey($.primaryKey), $.value;
|
|
3164
3164
|
} } });
|
|
@@ -3227,9 +3227,9 @@ function Eo() {
|
|
|
3227
3227
|
});
|
|
3228
3228
|
break;
|
|
3229
3229
|
case "deleteRange":
|
|
3230
|
-
var
|
|
3230
|
+
var G = A.range;
|
|
3231
3231
|
x = _.filter(function(W) {
|
|
3232
|
-
return !ur(C(W),
|
|
3232
|
+
return !ur(C(W), G);
|
|
3233
3233
|
});
|
|
3234
3234
|
}
|
|
3235
3235
|
return x;
|
|
@@ -3290,7 +3290,7 @@ function Eo() {
|
|
|
3290
3290
|
_.optimisticOps = _.optimisticOps.filter(function(W) {
|
|
3291
3291
|
return W.trans !== p;
|
|
3292
3292
|
});
|
|
3293
|
-
for (var k = 0, j = Object.values(_.queries.query); k < j.length; k++) for (var U, K, L,
|
|
3293
|
+
for (var k = 0, j = Object.values(_.queries.query); k < j.length; k++) for (var U, K, L, G = 0, $ = (U = j[k]).slice(); G < $.length; G++) (K = $[G]).res != null && p.mutatedParts && (v && !K.dirty ? (L = Object.isFrozen(K.res), L = Yr(K.res, K.req, x, A, K, L), K.dirty ? (Ge(U, K), K.subscribers.forEach(function(W) {
|
|
3294
3294
|
return C.add(W);
|
|
3295
3295
|
})) : L !== K.res && (K.res = L, K.promise = X.resolve({ result: L }))) : (K.dirty && Ge(U, K), K.subscribers.forEach(function(W) {
|
|
3296
3296
|
return C.add(W);
|
|
@@ -3319,7 +3319,7 @@ function Eo() {
|
|
|
3319
3319
|
})) : d.then(function(v) {
|
|
3320
3320
|
var C = Wr(0, o(o({}, i), { values: i.values.map(function(w, g) {
|
|
3321
3321
|
var T;
|
|
3322
|
-
return v.failures[g] ? w : (w = (T = a.keyPath) !== null && T !== void 0 && T.includes(".") ? Se(w) : o({}, w),
|
|
3322
|
+
return v.failures[g] ? w : (w = (T = a.keyPath) !== null && T !== void 0 && T.includes(".") ? Se(w) : o({}, w), oe(w, a.keyPath, v.results[g]), w);
|
|
3323
3323
|
}) }), v);
|
|
3324
3324
|
p.optimisticOps.push(C), queueMicrotask(function() {
|
|
3325
3325
|
return i.mutatedParts && bn(i.mutatedParts);
|
|
@@ -3521,7 +3521,7 @@ function Eo() {
|
|
|
3521
3521
|
return r._whenReady(v);
|
|
3522
3522
|
}) : this._whenReady(v);
|
|
3523
3523
|
}, Ce.prototype.table = function(e) {
|
|
3524
|
-
if (!
|
|
3524
|
+
if (!V(this._allTables, e)) throw new O.InvalidTable("Table ".concat(e, " does not exist"));
|
|
3525
3525
|
return this._allTables[e];
|
|
3526
3526
|
}, Ce);
|
|
3527
3527
|
function Ce(e, t) {
|
|
@@ -3540,7 +3540,7 @@ function Eo() {
|
|
|
3540
3540
|
n.on(g).unsubscribe(_), T.apply(n, A);
|
|
3541
3541
|
};
|
|
3542
3542
|
return n.on(g, _);
|
|
3543
|
-
}, this.on.ready.subscribe =
|
|
3543
|
+
}, this.on.ready.subscribe = ee(this.on.ready.subscribe, function(g) {
|
|
3544
3544
|
return function(T, _) {
|
|
3545
3545
|
Ce.vip(function() {
|
|
3546
3546
|
var A, x = n._state;
|
|
@@ -3652,7 +3652,7 @@ function Eo() {
|
|
|
3652
3652
|
}
|
|
3653
3653
|
})(E = { subscr: x, signal: d.signal, requery: T, querier: e, trans: null }), Promise.resolve(N).then(function(D) {
|
|
3654
3654
|
n = !0, t = D, p || E.signal.aborted || (v = {}, (function(S) {
|
|
3655
|
-
for (var k in S) if (
|
|
3655
|
+
for (var k in S) if (V(S, k)) return;
|
|
3656
3656
|
return 1;
|
|
3657
3657
|
})(C = x) || g || (ot(Vt, _), g = !0), Kn(function() {
|
|
3658
3658
|
return !p && a.next && a.next(D);
|
|
@@ -3731,11 +3731,11 @@ function Eo() {
|
|
|
3731
3731
|
return De;
|
|
3732
3732
|
}, set: function(e) {
|
|
3733
3733
|
kt(e);
|
|
3734
|
-
} }, derive: F, extend: R, props: z, override:
|
|
3735
|
-
typeof t == "string" ?
|
|
3736
|
-
|
|
3734
|
+
} }, derive: F, extend: R, props: z, override: ee, Events: qt, on: ot, liveQuery: Qr, extendObservabilitySet: _n, getByKeyPath: pe, setByKeyPath: oe, delByKeyPath: function(e, t) {
|
|
3735
|
+
typeof t == "string" ? oe(e, t, void 0) : "length" in t && [].map.call(t, function(n) {
|
|
3736
|
+
oe(e, n, void 0);
|
|
3737
3737
|
});
|
|
3738
|
-
}, shallowClone: Re, deepClone: Se, getObjectDiff: ir, cmp: se, asap:
|
|
3738
|
+
}, shallowClone: Re, deepClone: Se, getObjectDiff: ir, cmp: se, asap: ie, minKey: -1 / 0, addons: [], connections: Tt, errnames: f, dependencies: wn, cache: vt, semVer: "4.2.0", version: "4.2.0".split(".").map(function(e) {
|
|
3739
3739
|
return parseInt(e);
|
|
3740
3740
|
}).reduce(function(e, t, n) {
|
|
3741
3741
|
return e + t / Math.pow(10, 2 * n);
|
|
@@ -3773,22 +3773,22 @@ function Eo() {
|
|
|
3773
3773
|
});
|
|
3774
3774
|
})(Tn)), Tn.exports;
|
|
3775
3775
|
}
|
|
3776
|
-
var
|
|
3777
|
-
const hr = /* @__PURE__ */ pa(
|
|
3776
|
+
var To = xo();
|
|
3777
|
+
const hr = /* @__PURE__ */ pa(To), ea = /* @__PURE__ */ Symbol.for("Dexie"), ct = globalThis[ea] || (globalThis[ea] = hr);
|
|
3778
3778
|
if (hr.semVer !== ct.semVer)
|
|
3779
3779
|
throw new Error(`Two different versions of Dexie loaded in the same app: ${hr.semVer} and ${ct.semVer}`);
|
|
3780
3780
|
const {
|
|
3781
|
-
liveQuery:
|
|
3782
|
-
mergeRanges:
|
|
3783
|
-
rangesOverlap:
|
|
3784
|
-
RangeSet:
|
|
3785
|
-
cmp:
|
|
3786
|
-
Entity:
|
|
3787
|
-
PropModification:
|
|
3788
|
-
replacePrefix:
|
|
3789
|
-
add:
|
|
3790
|
-
remove:
|
|
3791
|
-
DexieYProvider:
|
|
3781
|
+
liveQuery: hs,
|
|
3782
|
+
mergeRanges: ms,
|
|
3783
|
+
rangesOverlap: ps,
|
|
3784
|
+
RangeSet: gs,
|
|
3785
|
+
cmp: ys,
|
|
3786
|
+
Entity: vs,
|
|
3787
|
+
PropModification: _s,
|
|
3788
|
+
replacePrefix: bs,
|
|
3789
|
+
add: Cs,
|
|
3790
|
+
remove: As,
|
|
3791
|
+
DexieYProvider: ws
|
|
3792
3792
|
} = ct;
|
|
3793
3793
|
async function ga(l) {
|
|
3794
3794
|
const { databaseName: c, dialecteConfig: u, createRootIfEmpty: o = !1 } = l, { xmlElements: h, additionalTables: m } = u.database.tables, y = new ct(c), b = {
|
|
@@ -3797,12 +3797,12 @@ async function ga(l) {
|
|
|
3797
3797
|
if (m)
|
|
3798
3798
|
for (const [R, P] of Object.entries(m))
|
|
3799
3799
|
b[R] = P.schema;
|
|
3800
|
-
return y.version(1).stores(b), o && await
|
|
3800
|
+
return y.version(1).stores(b), o && await No({
|
|
3801
3801
|
databaseInstance: y,
|
|
3802
3802
|
dialecteConfig: u
|
|
3803
3803
|
}), y;
|
|
3804
3804
|
}
|
|
3805
|
-
async function
|
|
3805
|
+
async function No(l) {
|
|
3806
3806
|
const { databaseInstance: c, dialecteConfig: u } = l, o = u.database.tables.xmlElements.name, h = u.rootElementName;
|
|
3807
3807
|
await c.open();
|
|
3808
3808
|
const m = c.table(o), y = await m.where({ tagName: h }).count(), b = u.definition[h].attributes.details;
|
|
@@ -3830,33 +3830,33 @@ const On = {
|
|
|
3830
3830
|
function lt(l) {
|
|
3831
3831
|
Object.assign(On, l);
|
|
3832
3832
|
}
|
|
3833
|
-
function
|
|
3833
|
+
function Oo(l) {
|
|
3834
3834
|
lt({
|
|
3835
3835
|
loading: !0,
|
|
3836
3836
|
error: null,
|
|
3837
3837
|
progress: l ? { phase: "executing", operation: l } : { phase: "starting" }
|
|
3838
3838
|
});
|
|
3839
3839
|
}
|
|
3840
|
-
function
|
|
3840
|
+
function Ro() {
|
|
3841
3841
|
lt({
|
|
3842
3842
|
loading: !1,
|
|
3843
3843
|
progress: null
|
|
3844
3844
|
});
|
|
3845
3845
|
}
|
|
3846
|
-
function
|
|
3846
|
+
function Io(l) {
|
|
3847
3847
|
lt({
|
|
3848
3848
|
loading: !1,
|
|
3849
3849
|
error: l,
|
|
3850
3850
|
progress: null
|
|
3851
3851
|
});
|
|
3852
3852
|
}
|
|
3853
|
-
function
|
|
3853
|
+
function Do(l) {
|
|
3854
3854
|
lt({
|
|
3855
3855
|
loading: !0,
|
|
3856
3856
|
progress: { phase: "executing", operation: l }
|
|
3857
3857
|
});
|
|
3858
3858
|
}
|
|
3859
|
-
function
|
|
3859
|
+
function Po(l) {
|
|
3860
3860
|
const { current: c, total: u, operation: o } = l, h = On.progress;
|
|
3861
3861
|
!h || h.phase !== "ending" ? lt({
|
|
3862
3862
|
loading: !0,
|
|
@@ -3874,7 +3874,7 @@ function Do(l) {
|
|
|
3874
3874
|
}
|
|
3875
3875
|
});
|
|
3876
3876
|
}
|
|
3877
|
-
function
|
|
3877
|
+
function So() {
|
|
3878
3878
|
const l = On.progress;
|
|
3879
3879
|
l?.phase === "ending" && lt({
|
|
3880
3880
|
loading: !1,
|
|
@@ -3885,14 +3885,14 @@ function Po() {
|
|
|
3885
3885
|
});
|
|
3886
3886
|
}
|
|
3887
3887
|
const st = {
|
|
3888
|
-
setLoading:
|
|
3889
|
-
setIdle:
|
|
3890
|
-
setError:
|
|
3891
|
-
setOperation:
|
|
3892
|
-
updateEndingProgress:
|
|
3893
|
-
setComplete:
|
|
3888
|
+
setLoading: Oo,
|
|
3889
|
+
setIdle: Ro,
|
|
3890
|
+
setError: Io,
|
|
3891
|
+
setOperation: Do,
|
|
3892
|
+
updateEndingProgress: Po,
|
|
3893
|
+
setComplete: So
|
|
3894
3894
|
};
|
|
3895
|
-
function
|
|
3895
|
+
function ko() {
|
|
3896
3896
|
return On;
|
|
3897
3897
|
}
|
|
3898
3898
|
function ya() {
|
|
@@ -3902,7 +3902,7 @@ function ya() {
|
|
|
3902
3902
|
progress: null
|
|
3903
3903
|
});
|
|
3904
3904
|
}
|
|
3905
|
-
function
|
|
3905
|
+
function Fo(l) {
|
|
3906
3906
|
ya();
|
|
3907
3907
|
const { dialecteConfig: c, databaseInstance: u } = l, o = c.database.tables.xmlElements.name, h = c.rootElementName, m = Promise.resolve().then(
|
|
3908
3908
|
async () => {
|
|
@@ -3930,7 +3930,7 @@ function ko(l) {
|
|
|
3930
3930
|
tagName: h
|
|
3931
3931
|
});
|
|
3932
3932
|
}
|
|
3933
|
-
function
|
|
3933
|
+
function Mo(l) {
|
|
3934
3934
|
ya();
|
|
3935
3935
|
const { dialecteConfig: c, databaseInstance: u, tagName: o, id: h } = l, m = c.database.tables.xmlElements.name, y = Promise.resolve().then(
|
|
3936
3936
|
async () => {
|
|
@@ -3953,7 +3953,7 @@ function Fo(l) {
|
|
|
3953
3953
|
);
|
|
3954
3954
|
return vr({ contextPromise: y, dialecteConfig: c, databaseInstance: u, tagName: o });
|
|
3955
3955
|
}
|
|
3956
|
-
async function
|
|
3956
|
+
async function jo(l) {
|
|
3957
3957
|
const { databaseName: c, dialecteConfig: u } = l;
|
|
3958
3958
|
Ee(c, "Database name is required to create SDK");
|
|
3959
3959
|
const o = await ga({
|
|
@@ -3962,29 +3962,29 @@ async function Mo(l) {
|
|
|
3962
3962
|
createRootIfEmpty: !0
|
|
3963
3963
|
});
|
|
3964
3964
|
return {
|
|
3965
|
-
getState:
|
|
3965
|
+
getState: ko,
|
|
3966
3966
|
getDatabaseInstance: () => o,
|
|
3967
|
-
fromRoot: () =>
|
|
3968
|
-
fromElement: (h) =>
|
|
3967
|
+
fromRoot: () => Fo({ dialecteConfig: u, databaseInstance: o }),
|
|
3968
|
+
fromElement: (h) => Mo({
|
|
3969
3969
|
dialecteConfig: u,
|
|
3970
3970
|
databaseInstance: o,
|
|
3971
3971
|
...h
|
|
3972
3972
|
})
|
|
3973
3973
|
};
|
|
3974
3974
|
}
|
|
3975
|
-
async function
|
|
3975
|
+
async function Ko(l) {
|
|
3976
3976
|
const { databaseInstance: c, elementsTableName: u, records: o } = l, h = c.table(u);
|
|
3977
3977
|
await c.transaction("rw", h, () => h.bulkAdd(o));
|
|
3978
3978
|
}
|
|
3979
|
-
async function
|
|
3979
|
+
async function Bs(l) {
|
|
3980
3980
|
if (await ct.exists(l))
|
|
3981
3981
|
return await ct.delete(l);
|
|
3982
3982
|
}
|
|
3983
|
-
function
|
|
3983
|
+
function qo(l) {
|
|
3984
3984
|
return "prefix" in l && "uri" in l && !!l.prefix && !!l.uri;
|
|
3985
3985
|
}
|
|
3986
3986
|
const Qt = {};
|
|
3987
|
-
function
|
|
3987
|
+
function Lo(l) {
|
|
3988
3988
|
const { parentId: c, child: u } = l;
|
|
3989
3989
|
Qt[c] || (Qt[c] = []);
|
|
3990
3990
|
const o = {
|
|
@@ -3993,27 +3993,27 @@ function qo(l) {
|
|
|
3993
3993
|
};
|
|
3994
3994
|
Qt[c].push(o);
|
|
3995
3995
|
}
|
|
3996
|
-
function
|
|
3996
|
+
function Uo(l) {
|
|
3997
3997
|
const { currentBatch: c } = l, u = [...c];
|
|
3998
3998
|
for (const [o, h] of u.entries()) {
|
|
3999
3999
|
const m = Qt[h.id] || [];
|
|
4000
|
-
m.length > 0 && (u[o].children.push(...m),
|
|
4000
|
+
m.length > 0 && (u[o].children.push(...m), $o({
|
|
4001
4001
|
parentId: h.id
|
|
4002
4002
|
}));
|
|
4003
4003
|
}
|
|
4004
4004
|
return u;
|
|
4005
4005
|
}
|
|
4006
|
-
function
|
|
4006
|
+
function $o(l) {
|
|
4007
4007
|
const { parentId: c } = l;
|
|
4008
4008
|
delete Qt[c];
|
|
4009
4009
|
}
|
|
4010
4010
|
var dr = {};
|
|
4011
|
-
const
|
|
4011
|
+
const Vo = {}, Go = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
4012
4012
|
__proto__: null,
|
|
4013
|
-
default:
|
|
4014
|
-
}, Symbol.toStringTag, { value: "Module" })),
|
|
4013
|
+
default: Vo
|
|
4014
|
+
}, Symbol.toStringTag, { value: "Module" })), Xo = /* @__PURE__ */ Bo(Go);
|
|
4015
4015
|
var ta;
|
|
4016
|
-
function
|
|
4016
|
+
function Wo() {
|
|
4017
4017
|
return ta || (ta = 1, (function(l) {
|
|
4018
4018
|
(function(c) {
|
|
4019
4019
|
c.parser = function(f, s) {
|
|
@@ -4116,7 +4116,7 @@ function Xo() {
|
|
|
4116
4116
|
};
|
|
4117
4117
|
var b;
|
|
4118
4118
|
try {
|
|
4119
|
-
b =
|
|
4119
|
+
b = Xo.Stream;
|
|
4120
4120
|
} catch {
|
|
4121
4121
|
b = function() {
|
|
4122
4122
|
};
|
|
@@ -4172,22 +4172,22 @@ function Xo() {
|
|
|
4172
4172
|
B.splice(0, 0, f), O.emit.apply(O, B);
|
|
4173
4173
|
}), b.prototype.on.call(O, f, s);
|
|
4174
4174
|
};
|
|
4175
|
-
var
|
|
4175
|
+
var V = "[CDATA[", z = "DOCTYPE", H = "http://www.w3.org/XML/1998/namespace", M = "http://www.w3.org/2000/xmlns/", F = { xml: H, xmlns: M }, J = /[:_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]/, re = /[:_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-]/, ye = /[#:_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]/, ee = /[#:_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-]/;
|
|
4176
4176
|
function Y(f) {
|
|
4177
4177
|
return f === " " || f === `
|
|
4178
4178
|
` || f === "\r" || f === " ";
|
|
4179
4179
|
}
|
|
4180
|
-
function
|
|
4180
|
+
function ie(f) {
|
|
4181
4181
|
return f === '"' || f === "'";
|
|
4182
4182
|
}
|
|
4183
4183
|
function pe(f) {
|
|
4184
4184
|
return f === ">" || Y(f);
|
|
4185
4185
|
}
|
|
4186
|
-
function
|
|
4186
|
+
function oe(f, s) {
|
|
4187
4187
|
return f.test(s);
|
|
4188
4188
|
}
|
|
4189
4189
|
function Re(f, s) {
|
|
4190
|
-
return !
|
|
4190
|
+
return !oe(f, s);
|
|
4191
4191
|
}
|
|
4192
4192
|
var I = 0;
|
|
4193
4193
|
c.STATE = {
|
|
@@ -4720,7 +4720,7 @@ Actual: ` + f.attribValue
|
|
|
4720
4720
|
case I.OPEN_WAKA:
|
|
4721
4721
|
if (B === "!")
|
|
4722
4722
|
s.state = I.SGML_DECL, s.sgmlDecl = "";
|
|
4723
|
-
else if (!Y(B)) if (
|
|
4723
|
+
else if (!Y(B)) if (oe(J, B))
|
|
4724
4724
|
s.state = I.OPEN_TAG, s.tagName = B;
|
|
4725
4725
|
else if (B === "/")
|
|
4726
4726
|
s.state = I.CLOSE_TAG, s.tagName = "";
|
|
@@ -4739,22 +4739,22 @@ Actual: ` + f.attribValue
|
|
|
4739
4739
|
s.state = I.COMMENT, s.comment = "", s.sgmlDecl = "";
|
|
4740
4740
|
continue;
|
|
4741
4741
|
}
|
|
4742
|
-
s.doctype && s.doctype !== !0 && s.sgmlDecl ? (s.state = I.DOCTYPE_DTD, s.doctype += "<!" + s.sgmlDecl + B, s.sgmlDecl = "") : (s.sgmlDecl + B).toUpperCase() ===
|
|
4742
|
+
s.doctype && s.doctype !== !0 && s.sgmlDecl ? (s.state = I.DOCTYPE_DTD, s.doctype += "<!" + s.sgmlDecl + B, s.sgmlDecl = "") : (s.sgmlDecl + B).toUpperCase() === V ? (de(s, "onopencdata"), s.state = I.CDATA, s.sgmlDecl = "", s.cdata = "") : (s.sgmlDecl + B).toUpperCase() === z ? (s.state = I.DOCTYPE, (s.doctype || s.sawRoot) && fe(
|
|
4743
4743
|
s,
|
|
4744
4744
|
"Inappropriately located doctype declaration"
|
|
4745
|
-
), s.doctype = "", s.sgmlDecl = "") : B === ">" ? (de(s, "onsgmldeclaration", s.sgmlDecl), s.sgmlDecl = "", s.state = I.TEXT) : (
|
|
4745
|
+
), s.doctype = "", s.sgmlDecl = "") : B === ">" ? (de(s, "onsgmldeclaration", s.sgmlDecl), s.sgmlDecl = "", s.state = I.TEXT) : (ie(B) && (s.state = I.SGML_DECL_QUOTED), s.sgmlDecl += B);
|
|
4746
4746
|
continue;
|
|
4747
4747
|
case I.SGML_DECL_QUOTED:
|
|
4748
4748
|
B === s.q && (s.state = I.SGML_DECL, s.q = ""), s.sgmlDecl += B;
|
|
4749
4749
|
continue;
|
|
4750
4750
|
case I.DOCTYPE:
|
|
4751
|
-
B === ">" ? (s.state = I.TEXT, de(s, "ondoctype", s.doctype), s.doctype = !0) : (s.doctype += B, B === "[" ? s.state = I.DOCTYPE_DTD :
|
|
4751
|
+
B === ">" ? (s.state = I.TEXT, de(s, "ondoctype", s.doctype), s.doctype = !0) : (s.doctype += B, B === "[" ? s.state = I.DOCTYPE_DTD : ie(B) && (s.state = I.DOCTYPE_QUOTED, s.q = B));
|
|
4752
4752
|
continue;
|
|
4753
4753
|
case I.DOCTYPE_QUOTED:
|
|
4754
4754
|
s.doctype += B, B === s.q && (s.q = "", s.state = I.DOCTYPE);
|
|
4755
4755
|
continue;
|
|
4756
4756
|
case I.DOCTYPE_DTD:
|
|
4757
|
-
B === "]" ? (s.doctype += B, s.state = I.DOCTYPE) : B === "<" ? (s.state = I.OPEN_WAKA, s.startTagPosition = s.position) :
|
|
4757
|
+
B === "]" ? (s.doctype += B, s.state = I.DOCTYPE) : B === "<" ? (s.state = I.OPEN_WAKA, s.startTagPosition = s.position) : ie(B) ? (s.doctype += B, s.state = I.DOCTYPE_DTD_QUOTED, s.q = B) : s.doctype += B;
|
|
4758
4758
|
continue;
|
|
4759
4759
|
case I.DOCTYPE_DTD_QUOTED:
|
|
4760
4760
|
s.doctype += B, B === s.q && (s.state = I.DOCTYPE_DTD, s.q = "");
|
|
@@ -4795,7 +4795,7 @@ Actual: ` + f.attribValue
|
|
|
4795
4795
|
}), s.procInstName = s.procInstBody = "", s.state = I.TEXT) : (s.procInstBody += "?" + B, s.state = I.PROC_INST_BODY);
|
|
4796
4796
|
continue;
|
|
4797
4797
|
case I.OPEN_TAG:
|
|
4798
|
-
|
|
4798
|
+
oe(re, B) ? s.tagName += B : (Ge(s), B === ">" ? je(s) : B === "/" ? s.state = I.OPEN_TAG_SLASH : (Y(B) || fe(s, "Invalid character in tag name"), s.state = I.ATTRIB));
|
|
4799
4799
|
continue;
|
|
4800
4800
|
case I.OPEN_TAG_SLASH:
|
|
4801
4801
|
B === ">" ? (je(s, !0), Pt(s)) : (fe(
|
|
@@ -4806,10 +4806,10 @@ Actual: ` + f.attribValue
|
|
|
4806
4806
|
case I.ATTRIB:
|
|
4807
4807
|
if (Y(B))
|
|
4808
4808
|
continue;
|
|
4809
|
-
B === ">" ? je(s) : B === "/" ? s.state = I.OPEN_TAG_SLASH :
|
|
4809
|
+
B === ">" ? je(s) : B === "/" ? s.state = I.OPEN_TAG_SLASH : oe(J, B) ? (s.attribName = B, s.attribValue = "", s.state = I.ATTRIB_NAME) : fe(s, "Invalid attribute name");
|
|
4810
4810
|
continue;
|
|
4811
4811
|
case I.ATTRIB_NAME:
|
|
4812
|
-
B === "=" ? s.state = I.ATTRIB_VALUE : B === ">" ? (fe(s, "Attribute without value"), s.attribValue = s.attribName, ke(s), je(s)) : Y(B) ? s.state = I.ATTRIB_NAME_SAW_WHITE :
|
|
4812
|
+
B === "=" ? s.state = I.ATTRIB_VALUE : B === ">" ? (fe(s, "Attribute without value"), s.attribValue = s.attribName, ke(s), je(s)) : Y(B) ? s.state = I.ATTRIB_NAME_SAW_WHITE : oe(re, B) ? s.attribName += B : fe(s, "Invalid attribute name");
|
|
4813
4813
|
continue;
|
|
4814
4814
|
case I.ATTRIB_NAME_SAW_WHITE:
|
|
4815
4815
|
if (B === "=")
|
|
@@ -4820,13 +4820,13 @@ Actual: ` + f.attribValue
|
|
|
4820
4820
|
fe(s, "Attribute without value"), s.tag.attributes[s.attribName] = "", s.attribValue = "", de(s, "onattribute", {
|
|
4821
4821
|
name: s.attribName,
|
|
4822
4822
|
value: ""
|
|
4823
|
-
}), s.attribName = "", B === ">" ? je(s) :
|
|
4823
|
+
}), s.attribName = "", B === ">" ? je(s) : oe(J, B) ? (s.attribName = B, s.state = I.ATTRIB_NAME) : (fe(s, "Invalid attribute name"), s.state = I.ATTRIB);
|
|
4824
4824
|
}
|
|
4825
4825
|
continue;
|
|
4826
4826
|
case I.ATTRIB_VALUE:
|
|
4827
4827
|
if (Y(B))
|
|
4828
4828
|
continue;
|
|
4829
|
-
|
|
4829
|
+
ie(B) ? (s.q = B, s.state = I.ATTRIB_VALUE_QUOTED) : (s.opt.unquotedAttributeValues || Ve(s, "Unquoted attribute value"), s.state = I.ATTRIB_VALUE_UNQUOTED, s.attribValue = B);
|
|
4830
4830
|
continue;
|
|
4831
4831
|
case I.ATTRIB_VALUE_QUOTED:
|
|
4832
4832
|
if (B !== s.q) {
|
|
@@ -4836,7 +4836,7 @@ Actual: ` + f.attribValue
|
|
|
4836
4836
|
ke(s), s.q = "", s.state = I.ATTRIB_VALUE_CLOSED;
|
|
4837
4837
|
continue;
|
|
4838
4838
|
case I.ATTRIB_VALUE_CLOSED:
|
|
4839
|
-
Y(B) ? s.state = I.ATTRIB : B === ">" ? je(s) : B === "/" ? s.state = I.OPEN_TAG_SLASH :
|
|
4839
|
+
Y(B) ? s.state = I.ATTRIB : B === ">" ? je(s) : B === "/" ? s.state = I.OPEN_TAG_SLASH : oe(J, B) ? (fe(s, "No whitespace between attributes"), s.attribName = B, s.attribValue = "", s.state = I.ATTRIB_NAME) : fe(s, "Invalid attribute name");
|
|
4840
4840
|
continue;
|
|
4841
4841
|
case I.ATTRIB_VALUE_UNQUOTED:
|
|
4842
4842
|
if (!pe(B)) {
|
|
@@ -4847,7 +4847,7 @@ Actual: ` + f.attribValue
|
|
|
4847
4847
|
continue;
|
|
4848
4848
|
case I.CLOSE_TAG:
|
|
4849
4849
|
if (s.tagName)
|
|
4850
|
-
B === ">" ? Pt(s) :
|
|
4850
|
+
B === ">" ? Pt(s) : oe(re, B) ? s.tagName += B : s.script ? (s.script += "</" + s.tagName + B, s.tagName = "", s.state = I.SCRIPT) : (Y(B) || fe(s, "Invalid tagname in closing tag"), s.state = I.CLOSE_TAG_SAW_WHITE);
|
|
4851
4851
|
else {
|
|
4852
4852
|
if (Y(B))
|
|
4853
4853
|
continue;
|
|
@@ -4877,7 +4877,7 @@ Actual: ` + f.attribValue
|
|
|
4877
4877
|
if (B === ";") {
|
|
4878
4878
|
var ve = Qe(s);
|
|
4879
4879
|
s.opt.unparsedEntities && !Object.values(c.XML_ENTITIES).includes(ve) ? (s.entity = "", s.state = he, s.write(ve)) : (s[xe] += ve, s.entity = "", s.state = he);
|
|
4880
|
-
} else
|
|
4880
|
+
} else oe(s.entity.length ? ee : ye, B) ? s.entity += B : (fe(s, "Invalid character in entity name"), s[xe] += "&" + s.entity + B, s.entity = "", s.state = he);
|
|
4881
4881
|
continue;
|
|
4882
4882
|
default:
|
|
4883
4883
|
throw new Error(s, "Unknown state: " + s.state);
|
|
@@ -4909,15 +4909,15 @@ Actual: ` + f.attribValue
|
|
|
4909
4909
|
})(l);
|
|
4910
4910
|
})(dr)), dr;
|
|
4911
4911
|
}
|
|
4912
|
-
var
|
|
4913
|
-
function
|
|
4912
|
+
var Yo = Wo();
|
|
4913
|
+
function zo(l) {
|
|
4914
4914
|
const { dialecteConfig: c, useCustomRecordsIds: u } = l;
|
|
4915
4915
|
let h = {
|
|
4916
4916
|
defaultNamespace: null,
|
|
4917
4917
|
stack: [],
|
|
4918
4918
|
recordsBatch: []
|
|
4919
4919
|
};
|
|
4920
|
-
const m =
|
|
4920
|
+
const m = Yo.parser(
|
|
4921
4921
|
!0,
|
|
4922
4922
|
// strict mode
|
|
4923
4923
|
{
|
|
@@ -4933,14 +4933,14 @@ function Yo(l) {
|
|
|
4933
4933
|
// Enable namespace handling
|
|
4934
4934
|
}
|
|
4935
4935
|
);
|
|
4936
|
-
m.onopentag = (R) => h =
|
|
4936
|
+
m.onopentag = (R) => h = Qo({
|
|
4937
4937
|
node: R,
|
|
4938
4938
|
state: h,
|
|
4939
4939
|
dialecteConfig: c,
|
|
4940
4940
|
useCustomRecordsIds: u
|
|
4941
|
-
}), m.ontext = (R) => h =
|
|
4941
|
+
}), m.ontext = (R) => h = Ho({ text: R, state: h }), m.onclosetag = () => ({ updatedState: h } = Zo({
|
|
4942
4942
|
state: h
|
|
4943
|
-
})), m.onerror =
|
|
4943
|
+
})), m.onerror = Jo;
|
|
4944
4944
|
function y() {
|
|
4945
4945
|
const R = h.recordsBatch;
|
|
4946
4946
|
return h.recordsBatch = [], R;
|
|
@@ -4954,32 +4954,32 @@ function Yo(l) {
|
|
|
4954
4954
|
getSize: b
|
|
4955
4955
|
};
|
|
4956
4956
|
}
|
|
4957
|
-
function
|
|
4958
|
-
const { node: c, state: u, dialecteConfig: o, useCustomRecordsIds: h } = l, m = { ...u }, y =
|
|
4959
|
-
m.defaultNamespace || (m.defaultNamespace =
|
|
4957
|
+
function Qo(l) {
|
|
4958
|
+
const { node: c, state: u, dialecteConfig: o, useCustomRecordsIds: h } = l, m = { ...u }, y = ei(c);
|
|
4959
|
+
m.defaultNamespace || (m.defaultNamespace = ti({
|
|
4960
4960
|
element: c,
|
|
4961
4961
|
defaultNamespace: o.namespaces.default,
|
|
4962
4962
|
rootElementName: o.rootElementName
|
|
4963
4963
|
}));
|
|
4964
|
-
const b =
|
|
4964
|
+
const b = ni(c, m.defaultNamespace), R = oi({ attributes: c.attributes, useCustomRecordsIds: h }), P = ii({
|
|
4965
4965
|
attributes: c.attributes,
|
|
4966
4966
|
useCustomRecordsIds: h
|
|
4967
|
-
}), q =
|
|
4967
|
+
}), q = ri(P), V = ai(u.stack), z = {
|
|
4968
4968
|
id: R,
|
|
4969
4969
|
tagName: y,
|
|
4970
4970
|
namespace: b,
|
|
4971
4971
|
attributes: q,
|
|
4972
4972
|
value: "",
|
|
4973
|
-
parent:
|
|
4973
|
+
parent: V,
|
|
4974
4974
|
children: []
|
|
4975
4975
|
};
|
|
4976
4976
|
return m.stack.push(z), m;
|
|
4977
4977
|
}
|
|
4978
|
-
function
|
|
4978
|
+
function Ho(l) {
|
|
4979
4979
|
const { text: c, state: u } = l;
|
|
4980
4980
|
return c && u.stack.length > 0 && (u.stack[u.stack.length - 1].value += c), u;
|
|
4981
4981
|
}
|
|
4982
|
-
function
|
|
4982
|
+
function Zo(l) {
|
|
4983
4983
|
const { state: c } = l, u = c.stack.at(-1);
|
|
4984
4984
|
let o = c.stack.slice(0, -1);
|
|
4985
4985
|
const h = [...c.recordsBatch];
|
|
@@ -4995,7 +4995,7 @@ function Ho(l) {
|
|
|
4995
4995
|
]
|
|
4996
4996
|
} : y
|
|
4997
4997
|
);
|
|
4998
|
-
} else u.parent &&
|
|
4998
|
+
} else u.parent && Lo({
|
|
4999
4999
|
parentId: u.parent.id,
|
|
5000
5000
|
child: { id: u.id, tagName: u.tagName }
|
|
5001
5001
|
});
|
|
@@ -5009,13 +5009,13 @@ function Ho(l) {
|
|
|
5009
5009
|
}
|
|
5010
5010
|
};
|
|
5011
5011
|
}
|
|
5012
|
-
function
|
|
5012
|
+
function Jo(l) {
|
|
5013
5013
|
return new Error(`XML parsing error: ${l}`);
|
|
5014
5014
|
}
|
|
5015
|
-
function
|
|
5015
|
+
function ei(l) {
|
|
5016
5016
|
return l.local;
|
|
5017
5017
|
}
|
|
5018
|
-
function
|
|
5018
|
+
function ti(l) {
|
|
5019
5019
|
const { element: c, defaultNamespace: u, rootElementName: o } = l;
|
|
5020
5020
|
return Ee(
|
|
5021
5021
|
c.name === o,
|
|
@@ -5025,13 +5025,13 @@ function ei(l) {
|
|
|
5025
5025
|
uri: c.attributes.xmlns.value
|
|
5026
5026
|
} : u;
|
|
5027
5027
|
}
|
|
5028
|
-
function
|
|
5029
|
-
return
|
|
5028
|
+
function ni(l, c) {
|
|
5029
|
+
return qo(l) ? {
|
|
5030
5030
|
prefix: l.prefix,
|
|
5031
5031
|
uri: l.uri
|
|
5032
5032
|
} : c;
|
|
5033
5033
|
}
|
|
5034
|
-
function
|
|
5034
|
+
function ri(l) {
|
|
5035
5035
|
return l.map((c) => {
|
|
5036
5036
|
const u = c.prefix && c.uri ? {
|
|
5037
5037
|
prefix: c.prefix,
|
|
@@ -5044,16 +5044,16 @@ function ni(l) {
|
|
|
5044
5044
|
};
|
|
5045
5045
|
});
|
|
5046
5046
|
}
|
|
5047
|
-
function
|
|
5047
|
+
function ai(l) {
|
|
5048
5048
|
if (l.length === 0) return null;
|
|
5049
5049
|
const c = l[l.length - 1];
|
|
5050
5050
|
return c ? { id: c.id, tagName: c.tagName } : null;
|
|
5051
5051
|
}
|
|
5052
|
-
function
|
|
5052
|
+
function oi(l) {
|
|
5053
5053
|
const { attributes: c, useCustomRecordsIds: u } = l, o = c[da];
|
|
5054
5054
|
return u && o && o.value ? o.value : crypto.randomUUID();
|
|
5055
5055
|
}
|
|
5056
|
-
function
|
|
5056
|
+
function ii(l) {
|
|
5057
5057
|
const { attributes: c, useCustomRecordsIds: u } = l;
|
|
5058
5058
|
return u ? Object.values(c).filter((o) => o.name !== da) : Object.values(c);
|
|
5059
5059
|
}
|
|
@@ -5063,7 +5063,7 @@ const na = {
|
|
|
5063
5063
|
// 32KB
|
|
5064
5064
|
batchSize: 2e3
|
|
5065
5065
|
};
|
|
5066
|
-
async function
|
|
5066
|
+
async function si(l) {
|
|
5067
5067
|
const { files: c, dialecteConfig: u, useCustomRecordsIds: o = !1 } = l, h = [];
|
|
5068
5068
|
if (c.length === 0) throw new Error("No files provided for import.");
|
|
5069
5069
|
const { importOptions: m = na, supportedFileExtensions: y } = u.io, b = {
|
|
@@ -5071,12 +5071,12 @@ async function ii(l) {
|
|
|
5071
5071
|
...m
|
|
5072
5072
|
};
|
|
5073
5073
|
for (const R of c) {
|
|
5074
|
-
if (!
|
|
5074
|
+
if (!ui({ file: R, supportedExtensions: y })) {
|
|
5075
5075
|
console.error(`Unsupported file type: ${R.name}`);
|
|
5076
5076
|
continue;
|
|
5077
5077
|
}
|
|
5078
5078
|
R.size === 0 && console.warn(`File is empty: ${R.name}`);
|
|
5079
|
-
const P = await
|
|
5079
|
+
const P = await li({
|
|
5080
5080
|
file: R,
|
|
5081
5081
|
dialecteConfig: u,
|
|
5082
5082
|
options: b,
|
|
@@ -5086,18 +5086,18 @@ async function ii(l) {
|
|
|
5086
5086
|
}
|
|
5087
5087
|
return h;
|
|
5088
5088
|
}
|
|
5089
|
-
function
|
|
5089
|
+
function ui(l) {
|
|
5090
5090
|
const { file: c, supportedExtensions: u } = l;
|
|
5091
5091
|
return u.some((o) => c.name.toLowerCase().endsWith(o));
|
|
5092
5092
|
}
|
|
5093
|
-
function
|
|
5093
|
+
function ci(l) {
|
|
5094
5094
|
return l.name.replace(/\.[^.]+$/, "");
|
|
5095
5095
|
}
|
|
5096
|
-
async function
|
|
5097
|
-
const { file: c, dialecteConfig: u, options: o, useCustomRecordsIds: h } = l, m =
|
|
5096
|
+
async function li(l) {
|
|
5097
|
+
const { file: c, dialecteConfig: u, options: o, useCustomRecordsIds: h } = l, m = ci(c), y = await ga({ databaseName: m, dialecteConfig: u });
|
|
5098
5098
|
try {
|
|
5099
5099
|
const b = u.database.tables.xmlElements.name;
|
|
5100
|
-
return await y.table(b).clear(), o.useBrowserApi && c.size !== 0 && await
|
|
5100
|
+
return await y.table(b).clear(), o.useBrowserApi && c.size !== 0 && await fi({
|
|
5101
5101
|
file: c,
|
|
5102
5102
|
databaseInstance: y,
|
|
5103
5103
|
elementsTableName: b,
|
|
@@ -5114,8 +5114,8 @@ async function ci(l) {
|
|
|
5114
5114
|
y.close();
|
|
5115
5115
|
}
|
|
5116
5116
|
}
|
|
5117
|
-
async function
|
|
5118
|
-
const { file: c, databaseInstance: u, elementsTableName: o, dialecteConfig: h, options: m } = l, y = c.stream().getReader(), b =
|
|
5117
|
+
async function fi(l) {
|
|
5118
|
+
const { file: c, databaseInstance: u, elementsTableName: o, dialecteConfig: h, options: m } = l, y = c.stream().getReader(), b = zo({
|
|
5119
5119
|
dialecteConfig: h,
|
|
5120
5120
|
useCustomRecordsIds: m.useCustomRecordsIds
|
|
5121
5121
|
}), R = new TextDecoder(), P = new Uint8Array(0);
|
|
@@ -5130,7 +5130,7 @@ async function li(l) {
|
|
|
5130
5130
|
});
|
|
5131
5131
|
}
|
|
5132
5132
|
async function mr(l) {
|
|
5133
|
-
const { databaseInstance: c, elementsTableName: u, reader: o, sax: h, textDecoder: m, buffer: y, options: b } = l, { chunkSize: R, batchSize: P } = b, { done: q, value:
|
|
5133
|
+
const { databaseInstance: c, elementsTableName: u, reader: o, sax: h, textDecoder: m, buffer: y, options: b } = l, { chunkSize: R, batchSize: P } = b, { done: q, value: V } = await o.read();
|
|
5134
5134
|
if (q) {
|
|
5135
5135
|
if (y.length > 0) {
|
|
5136
5136
|
const H = m.decode(y);
|
|
@@ -5143,10 +5143,10 @@ async function mr(l) {
|
|
|
5143
5143
|
batchSize: 0
|
|
5144
5144
|
});
|
|
5145
5145
|
}
|
|
5146
|
-
if (!
|
|
5146
|
+
if (!V)
|
|
5147
5147
|
return await mr(l);
|
|
5148
|
-
let z = new Uint8Array(y.length +
|
|
5149
|
-
for (z.set(y), z.set(
|
|
5148
|
+
let z = new Uint8Array(y.length + V.length);
|
|
5149
|
+
for (z.set(y), z.set(V, y.length); z.length >= R; ) {
|
|
5150
5150
|
const H = z.slice(0, R);
|
|
5151
5151
|
z = z.slice(R);
|
|
5152
5152
|
const M = m.decode(H, { stream: !0 });
|
|
@@ -5162,10 +5162,10 @@ async function mr(l) {
|
|
|
5162
5162
|
async function ra(l) {
|
|
5163
5163
|
const { databaseInstance: c, elementsTableName: u, sax: o, batchSize: h } = l;
|
|
5164
5164
|
if (o.getSize() >= h) {
|
|
5165
|
-
const y = o.drainBatch(), b =
|
|
5165
|
+
const y = o.drainBatch(), b = Uo({
|
|
5166
5166
|
currentBatch: y
|
|
5167
5167
|
});
|
|
5168
|
-
await
|
|
5168
|
+
await Ko({
|
|
5169
5169
|
databaseInstance: c,
|
|
5170
5170
|
elementsTableName: u,
|
|
5171
5171
|
records: b
|
|
@@ -5174,54 +5174,54 @@ async function ra(l) {
|
|
|
5174
5174
|
}
|
|
5175
5175
|
const va = "_temp-idb-id";
|
|
5176
5176
|
var zt = { exports: {} }, En = { exports: {} }, aa;
|
|
5177
|
-
function
|
|
5177
|
+
function di() {
|
|
5178
5178
|
return aa || (aa = 1, (function(l, c) {
|
|
5179
5179
|
Object.defineProperty(c, "__esModule", { value: !0 }), c.ParsingError = void 0;
|
|
5180
5180
|
class u extends Error {
|
|
5181
|
-
constructor(Y,
|
|
5182
|
-
super(Y), this.cause =
|
|
5181
|
+
constructor(Y, ie) {
|
|
5182
|
+
super(Y), this.cause = ie;
|
|
5183
5183
|
}
|
|
5184
5184
|
}
|
|
5185
5185
|
c.ParsingError = u;
|
|
5186
5186
|
let o;
|
|
5187
5187
|
function h() {
|
|
5188
|
-
return R(!1) || z() ||
|
|
5188
|
+
return R(!1) || z() || V() || q() || b();
|
|
5189
5189
|
}
|
|
5190
5190
|
function m() {
|
|
5191
|
-
return F(/\s*/), R(!0) ||
|
|
5191
|
+
return F(/\s*/), R(!0) || V() || P() || b();
|
|
5192
5192
|
}
|
|
5193
5193
|
function y() {
|
|
5194
|
-
const
|
|
5195
|
-
let
|
|
5194
|
+
const ee = b(), Y = [];
|
|
5195
|
+
let ie, pe = m();
|
|
5196
5196
|
for (; pe; ) {
|
|
5197
5197
|
if (pe.node.type === "Element") {
|
|
5198
|
-
if (
|
|
5198
|
+
if (ie)
|
|
5199
5199
|
throw new Error("Found multiple root nodes");
|
|
5200
|
-
|
|
5200
|
+
ie = pe.node;
|
|
5201
5201
|
}
|
|
5202
5202
|
pe.excluded || Y.push(pe.node), pe = m();
|
|
5203
5203
|
}
|
|
5204
|
-
if (!
|
|
5204
|
+
if (!ie)
|
|
5205
5205
|
throw new u("Failed to parse XML", "Root Element not found");
|
|
5206
5206
|
if (o.xml.length !== 0)
|
|
5207
5207
|
throw new u("Failed to parse XML", "Not Well-Formed XML");
|
|
5208
5208
|
return {
|
|
5209
|
-
declaration:
|
|
5210
|
-
root:
|
|
5209
|
+
declaration: ee ? ee.node : null,
|
|
5210
|
+
root: ie,
|
|
5211
5211
|
children: Y
|
|
5212
5212
|
};
|
|
5213
5213
|
}
|
|
5214
5214
|
function b() {
|
|
5215
|
-
const
|
|
5216
|
-
if (!
|
|
5215
|
+
const ee = F(/^<\?([\w-:.]+)\s*/);
|
|
5216
|
+
if (!ee)
|
|
5217
5217
|
return;
|
|
5218
5218
|
const Y = {
|
|
5219
|
-
name:
|
|
5219
|
+
name: ee[1],
|
|
5220
5220
|
type: "ProcessingInstruction",
|
|
5221
5221
|
content: ""
|
|
5222
|
-
},
|
|
5223
|
-
if (
|
|
5224
|
-
Y.content = o.xml.substring(0,
|
|
5222
|
+
}, ie = o.xml.indexOf("?>");
|
|
5223
|
+
if (ie > -1)
|
|
5224
|
+
Y.content = o.xml.substring(0, ie).trim(), o.xml = o.xml.slice(ie);
|
|
5225
5225
|
else
|
|
5226
5226
|
throw new u("Failed to parse XML", "ProcessingInstruction closing tag not found");
|
|
5227
5227
|
return F(/\?>/), {
|
|
@@ -5229,34 +5229,34 @@ function fi() {
|
|
|
5229
5229
|
node: Y
|
|
5230
5230
|
};
|
|
5231
5231
|
}
|
|
5232
|
-
function R(
|
|
5232
|
+
function R(ee) {
|
|
5233
5233
|
const Y = F(/^<([^?!</>\s]+)\s*/);
|
|
5234
5234
|
if (!Y)
|
|
5235
5235
|
return;
|
|
5236
|
-
const
|
|
5236
|
+
const ie = {
|
|
5237
5237
|
type: "Element",
|
|
5238
5238
|
name: Y[1],
|
|
5239
5239
|
attributes: {},
|
|
5240
5240
|
children: []
|
|
5241
|
-
}, pe =
|
|
5242
|
-
for (; !(J() ||
|
|
5241
|
+
}, pe = ee ? !1 : o.options.filter(ie) === !1;
|
|
5242
|
+
for (; !(J() || re(">") || re("?>") || re("/>")); ) {
|
|
5243
5243
|
const Re = H();
|
|
5244
5244
|
if (Re)
|
|
5245
|
-
|
|
5245
|
+
ie.attributes[Re.name] = Re.value;
|
|
5246
5246
|
else
|
|
5247
5247
|
return;
|
|
5248
5248
|
}
|
|
5249
5249
|
if (F(/^\s*\/>/))
|
|
5250
|
-
return
|
|
5250
|
+
return ie.children = null, {
|
|
5251
5251
|
excluded: pe,
|
|
5252
|
-
node:
|
|
5252
|
+
node: ie
|
|
5253
5253
|
};
|
|
5254
5254
|
F(/\??>/);
|
|
5255
|
-
let
|
|
5256
|
-
for (;
|
|
5257
|
-
|
|
5255
|
+
let oe = h();
|
|
5256
|
+
for (; oe; )
|
|
5257
|
+
oe.excluded || ie.children.push(oe.node), oe = h();
|
|
5258
5258
|
if (o.options.strictMode) {
|
|
5259
|
-
const Re = `</${
|
|
5259
|
+
const Re = `</${ie.name}>`;
|
|
5260
5260
|
if (o.xml.startsWith(Re))
|
|
5261
5261
|
o.xml = o.xml.slice(Re.length);
|
|
5262
5262
|
else
|
|
@@ -5265,15 +5265,15 @@ function fi() {
|
|
|
5265
5265
|
F(/^<\/[\w-:.\u00C0-\u00FF]+\s*>/);
|
|
5266
5266
|
return {
|
|
5267
5267
|
excluded: pe,
|
|
5268
|
-
node:
|
|
5268
|
+
node: ie
|
|
5269
5269
|
};
|
|
5270
5270
|
}
|
|
5271
5271
|
function P() {
|
|
5272
|
-
const
|
|
5273
|
-
if (
|
|
5272
|
+
const ee = F(/^<!DOCTYPE\s+\S+\s+SYSTEM[^>]*>/) || F(/^<!DOCTYPE\s+\S+\s+PUBLIC[^>]*>/) || F(/^<!DOCTYPE\s+\S+\s*\[[^\]]*]>/) || F(/^<!DOCTYPE\s+\S+\s*>/);
|
|
5273
|
+
if (ee) {
|
|
5274
5274
|
const Y = {
|
|
5275
5275
|
type: "DocumentType",
|
|
5276
|
-
content:
|
|
5276
|
+
content: ee[0]
|
|
5277
5277
|
};
|
|
5278
5278
|
return {
|
|
5279
5279
|
excluded: o.options.filter(Y) === !1,
|
|
@@ -5283,25 +5283,25 @@ function fi() {
|
|
|
5283
5283
|
}
|
|
5284
5284
|
function q() {
|
|
5285
5285
|
if (o.xml.startsWith("<![CDATA[")) {
|
|
5286
|
-
const
|
|
5287
|
-
if (
|
|
5288
|
-
const Y =
|
|
5286
|
+
const ee = o.xml.indexOf("]]>");
|
|
5287
|
+
if (ee > -1) {
|
|
5288
|
+
const Y = ee + 3, ie = {
|
|
5289
5289
|
type: "CDATA",
|
|
5290
5290
|
content: o.xml.substring(0, Y)
|
|
5291
5291
|
};
|
|
5292
5292
|
return o.xml = o.xml.slice(Y), {
|
|
5293
|
-
excluded: o.options.filter(
|
|
5294
|
-
node:
|
|
5293
|
+
excluded: o.options.filter(ie) === !1,
|
|
5294
|
+
node: ie
|
|
5295
5295
|
};
|
|
5296
5296
|
}
|
|
5297
5297
|
}
|
|
5298
5298
|
}
|
|
5299
|
-
function
|
|
5300
|
-
const
|
|
5301
|
-
if (
|
|
5299
|
+
function V() {
|
|
5300
|
+
const ee = F(/^<!--[\s\S]*?-->/);
|
|
5301
|
+
if (ee) {
|
|
5302
5302
|
const Y = {
|
|
5303
5303
|
type: "Comment",
|
|
5304
|
-
content:
|
|
5304
|
+
content: ee[0]
|
|
5305
5305
|
};
|
|
5306
5306
|
return {
|
|
5307
5307
|
excluded: o.options.filter(Y) === !1,
|
|
@@ -5310,11 +5310,11 @@ function fi() {
|
|
|
5310
5310
|
}
|
|
5311
5311
|
}
|
|
5312
5312
|
function z() {
|
|
5313
|
-
const
|
|
5314
|
-
if (
|
|
5313
|
+
const ee = F(/^([^<]+)/);
|
|
5314
|
+
if (ee) {
|
|
5315
5315
|
const Y = {
|
|
5316
5316
|
type: "Text",
|
|
5317
|
-
content:
|
|
5317
|
+
content: ee[1]
|
|
5318
5318
|
};
|
|
5319
5319
|
return {
|
|
5320
5320
|
excluded: o.options.filter(Y) === !1,
|
|
@@ -5323,46 +5323,46 @@ function fi() {
|
|
|
5323
5323
|
}
|
|
5324
5324
|
}
|
|
5325
5325
|
function H() {
|
|
5326
|
-
const
|
|
5327
|
-
if (
|
|
5326
|
+
const ee = F(/([^=]+)\s*=\s*("[^"]*"|'[^']*'|[^>\s]+)\s*/);
|
|
5327
|
+
if (ee)
|
|
5328
5328
|
return {
|
|
5329
|
-
name:
|
|
5330
|
-
value: M(
|
|
5329
|
+
name: ee[1].trim(),
|
|
5330
|
+
value: M(ee[2].trim())
|
|
5331
5331
|
};
|
|
5332
5332
|
}
|
|
5333
|
-
function M(
|
|
5334
|
-
return
|
|
5333
|
+
function M(ee) {
|
|
5334
|
+
return ee.replace(/^['"]|['"]$/g, "");
|
|
5335
5335
|
}
|
|
5336
|
-
function F(
|
|
5337
|
-
const Y = o.xml.match(
|
|
5336
|
+
function F(ee) {
|
|
5337
|
+
const Y = o.xml.match(ee);
|
|
5338
5338
|
if (Y)
|
|
5339
5339
|
return o.xml = o.xml.slice(Y[0].length), Y;
|
|
5340
5340
|
}
|
|
5341
5341
|
function J() {
|
|
5342
5342
|
return o.xml.length === 0;
|
|
5343
5343
|
}
|
|
5344
|
-
function
|
|
5345
|
-
return o.xml.indexOf(
|
|
5344
|
+
function re(ee) {
|
|
5345
|
+
return o.xml.indexOf(ee) === 0;
|
|
5346
5346
|
}
|
|
5347
|
-
function ye(
|
|
5348
|
-
|
|
5349
|
-
const
|
|
5347
|
+
function ye(ee, Y = {}) {
|
|
5348
|
+
ee = ee.trim();
|
|
5349
|
+
const ie = Y.filter || (() => !0);
|
|
5350
5350
|
return o = {
|
|
5351
|
-
xml:
|
|
5352
|
-
options: Object.assign(Object.assign({}, Y), { filter:
|
|
5351
|
+
xml: ee,
|
|
5352
|
+
options: Object.assign(Object.assign({}, Y), { filter: ie, strictMode: Y.strictMode === !0 })
|
|
5353
5353
|
}, y();
|
|
5354
5354
|
}
|
|
5355
5355
|
l.exports = ye, c.default = ye;
|
|
5356
5356
|
})(En, En.exports)), En.exports;
|
|
5357
5357
|
}
|
|
5358
5358
|
var oa = zt.exports, ia;
|
|
5359
|
-
function
|
|
5359
|
+
function hi() {
|
|
5360
5360
|
return ia || (ia = 1, (function(l, c) {
|
|
5361
5361
|
var u = oa && oa.__importDefault || function(M) {
|
|
5362
5362
|
return M && M.__esModule ? M : { default: M };
|
|
5363
5363
|
};
|
|
5364
5364
|
Object.defineProperty(c, "__esModule", { value: !0 });
|
|
5365
|
-
const o = u(/* @__PURE__ */
|
|
5365
|
+
const o = u(/* @__PURE__ */ di());
|
|
5366
5366
|
function h(M) {
|
|
5367
5367
|
if (!M.options.indentation && !M.options.lineSeparator)
|
|
5368
5368
|
return;
|
|
@@ -5392,42 +5392,42 @@ function di() {
|
|
|
5392
5392
|
}
|
|
5393
5393
|
function R(M, F, J) {
|
|
5394
5394
|
if (!J) {
|
|
5395
|
-
const
|
|
5396
|
-
(F.options.lineSeparator ||
|
|
5395
|
+
const re = M.trim();
|
|
5396
|
+
(F.options.lineSeparator || re.length === 0) && (M = re);
|
|
5397
5397
|
}
|
|
5398
5398
|
M.length > 0 && (!J && F.content.length > 0 && h(F), y(F, M));
|
|
5399
5399
|
}
|
|
5400
5400
|
function P(M, F) {
|
|
5401
|
-
const J = "/" + M.join("/"),
|
|
5402
|
-
return F.includes(
|
|
5401
|
+
const J = "/" + M.join("/"), re = M[M.length - 1];
|
|
5402
|
+
return F.includes(re) || F.includes(J);
|
|
5403
5403
|
}
|
|
5404
5404
|
function q(M, F, J) {
|
|
5405
|
-
if (F.path.push(M.name), !J && F.content.length > 0 && h(F), y(F, "<" + M.name),
|
|
5406
|
-
const
|
|
5407
|
-
y(F,
|
|
5405
|
+
if (F.path.push(M.name), !J && F.content.length > 0 && h(F), y(F, "<" + M.name), V(F, M.attributes), M.children === null || F.options.forceSelfClosingEmptyTag && M.children.length === 0) {
|
|
5406
|
+
const re = F.options.whiteSpaceAtEndOfSelfclosingTag ? " />" : "/>";
|
|
5407
|
+
y(F, re);
|
|
5408
5408
|
} else if (M.children.length === 0)
|
|
5409
5409
|
y(F, "></" + M.name + ">");
|
|
5410
5410
|
else {
|
|
5411
|
-
const
|
|
5411
|
+
const re = M.children;
|
|
5412
5412
|
y(F, ">"), F.level++;
|
|
5413
|
-
let ye = M.attributes["xml:space"] === "preserve" || J,
|
|
5414
|
-
if (!ye && F.options.ignoredPaths && (
|
|
5415
|
-
let Y = !1,
|
|
5416
|
-
|
|
5417
|
-
|
|
5418
|
-
`) ? (
|
|
5419
|
-
}), Y && (!pe || !
|
|
5413
|
+
let ye = M.attributes["xml:space"] === "preserve" || J, ee = !1;
|
|
5414
|
+
if (!ye && F.options.ignoredPaths && (ee = P(F.path, F.options.ignoredPaths), ye = ee), !ye && F.options.collapseContent) {
|
|
5415
|
+
let Y = !1, ie = !1, pe = !1;
|
|
5416
|
+
re.forEach(function(oe, Re) {
|
|
5417
|
+
oe.type === "Text" ? (oe.content.includes(`
|
|
5418
|
+
`) ? (ie = !0, oe.content = oe.content.trim()) : (Re === 0 || Re === re.length - 1) && !J && oe.content.trim().length === 0 && (oe.content = ""), (oe.content.trim().length > 0 || re.length === 1) && (Y = !0)) : oe.type === "CDATA" ? Y = !0 : pe = !0;
|
|
5419
|
+
}), Y && (!pe || !ie) && (ye = !0);
|
|
5420
5420
|
}
|
|
5421
|
-
|
|
5421
|
+
re.forEach(function(Y) {
|
|
5422
5422
|
b(Y, F, J || ye);
|
|
5423
|
-
}), F.level--, !J && !ye && h(F),
|
|
5423
|
+
}), F.level--, !J && !ye && h(F), ee && m(F), y(F, "</" + M.name + ">");
|
|
5424
5424
|
}
|
|
5425
5425
|
F.path.pop();
|
|
5426
5426
|
}
|
|
5427
|
-
function
|
|
5427
|
+
function V(M, F) {
|
|
5428
5428
|
Object.keys(F).forEach(function(J) {
|
|
5429
|
-
const
|
|
5430
|
-
y(M, " " + J + '="' +
|
|
5429
|
+
const re = F[J].replace(/"/g, """);
|
|
5430
|
+
y(M, " " + J + '="' + re + '"');
|
|
5431
5431
|
});
|
|
5432
5432
|
}
|
|
5433
5433
|
function z(M, F) {
|
|
@@ -5437,11 +5437,11 @@ function di() {
|
|
|
5437
5437
|
F.indentation = "indentation" in F ? F.indentation : " ", F.collapseContent = F.collapseContent === !0, F.lineSeparator = "lineSeparator" in F ? F.lineSeparator : `\r
|
|
5438
5438
|
`, F.whiteSpaceAtEndOfSelfclosingTag = F.whiteSpaceAtEndOfSelfclosingTag === !0, F.throwOnFailure = F.throwOnFailure !== !1;
|
|
5439
5439
|
try {
|
|
5440
|
-
const J = (0, o.default)(M, { filter: F.filter, strictMode: F.strictMode }),
|
|
5441
|
-
return J.declaration && z(J.declaration,
|
|
5442
|
-
b(ye,
|
|
5443
|
-
}), F.lineSeparator ?
|
|
5444
|
-
`).replace(/\n/g, F.lineSeparator) :
|
|
5440
|
+
const J = (0, o.default)(M, { filter: F.filter, strictMode: F.strictMode }), re = { content: "", level: 0, options: F, path: [] };
|
|
5441
|
+
return J.declaration && z(J.declaration, re), J.children.forEach(function(ye) {
|
|
5442
|
+
b(ye, re, !1);
|
|
5443
|
+
}), F.lineSeparator ? re.content.replace(/\r\n/g, `
|
|
5444
|
+
`).replace(/\n/g, F.lineSeparator) : re.content;
|
|
5445
5445
|
} catch (J) {
|
|
5446
5446
|
if (F.throwOnFailure)
|
|
5447
5447
|
throw J;
|
|
@@ -5451,17 +5451,17 @@ function di() {
|
|
|
5451
5451
|
H.minify = (M, F = {}) => H(M, Object.assign(Object.assign({}, F), { indentation: "", lineSeparator: "" })), l.exports = H, c.default = H;
|
|
5452
5452
|
})(zt, zt.exports)), zt.exports;
|
|
5453
5453
|
}
|
|
5454
|
-
var
|
|
5455
|
-
const
|
|
5456
|
-
function
|
|
5457
|
-
return
|
|
5454
|
+
var mi = /* @__PURE__ */ hi();
|
|
5455
|
+
const pi = /* @__PURE__ */ pa(mi);
|
|
5456
|
+
function gi(l) {
|
|
5457
|
+
return pi(l);
|
|
5458
5458
|
}
|
|
5459
|
-
async function
|
|
5459
|
+
async function yi(l) {
|
|
5460
5460
|
const { extension: c, xmlDocument: u, filename: o } = l, b = `<?xml version="1.0" encoding="UTF-8"?>
|
|
5461
|
-
` + new XMLSerializer().serializeToString(u), R =
|
|
5461
|
+
` + new XMLSerializer().serializeToString(u), R = gi(b), P = new Blob([R], { type: "application/xml" });
|
|
5462
5462
|
if ("showSaveFilePicker" in window)
|
|
5463
5463
|
try {
|
|
5464
|
-
const
|
|
5464
|
+
const V = await (await window.showSaveFilePicker({
|
|
5465
5465
|
suggestedName: o,
|
|
5466
5466
|
types: [
|
|
5467
5467
|
{
|
|
@@ -5470,29 +5470,29 @@ async function gi(l) {
|
|
|
5470
5470
|
}
|
|
5471
5471
|
]
|
|
5472
5472
|
})).createWritable();
|
|
5473
|
-
await
|
|
5473
|
+
await V.write(P), await V.close();
|
|
5474
5474
|
} catch (q) {
|
|
5475
5475
|
q.name !== "AbortError" && console.error("Save failed:", q);
|
|
5476
5476
|
}
|
|
5477
5477
|
else {
|
|
5478
|
-
const q = URL.createObjectURL(P),
|
|
5479
|
-
|
|
5478
|
+
const q = URL.createObjectURL(P), V = document.createElement("a");
|
|
5479
|
+
V.href = q, V.download = o, document.body.appendChild(V), V.click(), V.remove(), URL.revokeObjectURL(q);
|
|
5480
5480
|
}
|
|
5481
5481
|
}
|
|
5482
|
-
async function
|
|
5482
|
+
async function Es(l) {
|
|
5483
5483
|
const { databaseName: c, extension: u, withDownload: o, dialecteConfig: h } = l, m = await _a({
|
|
5484
5484
|
databaseName: c,
|
|
5485
5485
|
extension: u,
|
|
5486
5486
|
dialecteConfig: h,
|
|
5487
5487
|
withDatabaseIds: !1
|
|
5488
5488
|
});
|
|
5489
|
-
return o && await
|
|
5489
|
+
return o && await yi({
|
|
5490
5490
|
extension: u,
|
|
5491
5491
|
xmlDocument: m.xmlDocument,
|
|
5492
5492
|
filename: m.filename
|
|
5493
5493
|
}), m;
|
|
5494
5494
|
}
|
|
5495
|
-
async function
|
|
5495
|
+
async function xs(l) {
|
|
5496
5496
|
const { databaseName: c, dialecteConfig: u } = l;
|
|
5497
5497
|
return _a({
|
|
5498
5498
|
databaseName: c,
|
|
@@ -5504,7 +5504,7 @@ async function _a(l) {
|
|
|
5504
5504
|
const { databaseName: c, extension: u = "xml", dialecteConfig: o, withDatabaseIds: h } = l, m = new ct(c);
|
|
5505
5505
|
await m.open();
|
|
5506
5506
|
try {
|
|
5507
|
-
const y = await
|
|
5507
|
+
const y = await vi({
|
|
5508
5508
|
databaseInstance: m,
|
|
5509
5509
|
dialecteConfig: o,
|
|
5510
5510
|
withDatabaseIds: h
|
|
@@ -5519,7 +5519,7 @@ async function _a(l) {
|
|
|
5519
5519
|
m.close();
|
|
5520
5520
|
}
|
|
5521
5521
|
}
|
|
5522
|
-
async function
|
|
5522
|
+
async function vi(l) {
|
|
5523
5523
|
const { databaseInstance: c, dialecteConfig: u, withDatabaseIds: o } = l, { useBrowserApi: h = !0 } = u.io.exportOptions ?? { useBrowserApi: !0 }, m = u.rootElementName, y = u.namespaces.default, b = u.database.tables.xmlElements.name;
|
|
5524
5524
|
if (h) {
|
|
5525
5525
|
const R = document.implementation.createDocument(
|
|
@@ -5560,17 +5560,17 @@ async function ba(l) {
|
|
|
5560
5560
|
} = l;
|
|
5561
5561
|
if (!y.children) return;
|
|
5562
5562
|
const R = y.children.map((z) => z.id), q = await c.table(o).bulkGet(R);
|
|
5563
|
-
|
|
5563
|
+
Ci({
|
|
5564
5564
|
childrenRecords: q,
|
|
5565
5565
|
parentRecord: y
|
|
5566
5566
|
});
|
|
5567
|
-
const
|
|
5567
|
+
const V = bi({
|
|
5568
5568
|
parentTagName: y.tagName,
|
|
5569
5569
|
availableChildren: u.children,
|
|
5570
5570
|
childrenRecords: q
|
|
5571
5571
|
});
|
|
5572
|
-
for (const z of
|
|
5573
|
-
const H =
|
|
5572
|
+
for (const z of V) {
|
|
5573
|
+
const H = _i({
|
|
5574
5574
|
document: m,
|
|
5575
5575
|
record: z,
|
|
5576
5576
|
defaultNamespace: u.namespaces.default,
|
|
@@ -5588,7 +5588,7 @@ async function ba(l) {
|
|
|
5588
5588
|
}
|
|
5589
5589
|
return l.xmlDocument;
|
|
5590
5590
|
}
|
|
5591
|
-
function
|
|
5591
|
+
function _i(l) {
|
|
5592
5592
|
const { document: c, record: u, defaultNamespace: o, withDatabaseIds: h } = l;
|
|
5593
5593
|
let m;
|
|
5594
5594
|
return !(u.namespace.uri === o.uri) && u.namespace.prefix && u.namespace.prefix !== "xmlns" ? (Aa({
|
|
@@ -5602,7 +5602,7 @@ function vi(l) {
|
|
|
5602
5602
|
function Ca(l) {
|
|
5603
5603
|
const { document: c, element: u, attributes: o, isRoot: h } = l;
|
|
5604
5604
|
for (const m of o)
|
|
5605
|
-
if (!
|
|
5605
|
+
if (!Ai(m))
|
|
5606
5606
|
if (wa(m)) {
|
|
5607
5607
|
const y = m.namespace?.prefix || "";
|
|
5608
5608
|
!h && y && Aa({
|
|
@@ -5619,7 +5619,7 @@ function Aa(l) {
|
|
|
5619
5619
|
const h = "http://www.w3.org/2000/xmlns/";
|
|
5620
5620
|
o.getAttributeNS(h, u.prefix) === null && o.setAttributeNS(h, `xmlns:${u.prefix}`, u.uri);
|
|
5621
5621
|
}
|
|
5622
|
-
function
|
|
5622
|
+
function bi(l) {
|
|
5623
5623
|
const { parentTagName: c, availableChildren: u, childrenRecords: o } = l, h = [], m = new Set(u[c]);
|
|
5624
5624
|
if (!m.size) return o;
|
|
5625
5625
|
const y = /* @__PURE__ */ new Map(), b = [];
|
|
@@ -5633,7 +5633,7 @@ function _i(l) {
|
|
|
5633
5633
|
}
|
|
5634
5634
|
return h.push(...b), h;
|
|
5635
5635
|
}
|
|
5636
|
-
function
|
|
5636
|
+
function Ci(l) {
|
|
5637
5637
|
const { childrenRecords: c, parentRecord: u } = l, o = c.map((h, m) => h === void 0 ? m : -1).filter((h) => h !== -1);
|
|
5638
5638
|
if (o.length > 0) {
|
|
5639
5639
|
const h = o.map((m) => {
|
|
@@ -5648,15 +5648,15 @@ function bi(l) {
|
|
|
5648
5648
|
function wa(l) {
|
|
5649
5649
|
return l !== null && typeof l == "object" && "namespace" in l && !!l.namespace;
|
|
5650
5650
|
}
|
|
5651
|
-
function
|
|
5651
|
+
function Ai(l) {
|
|
5652
5652
|
return !!(l.name === "xmlns" || l.name.startsWith("xmlns:") || wa(l) && l.namespace?.prefix === "xmlns");
|
|
5653
5653
|
}
|
|
5654
|
-
async function
|
|
5655
|
-
const { xmlString: c, dialecteConfig: u = ma } = l, o = `test-${crypto.randomUUID()}.xml`, h = new File([c], o, { type: "text/xml" }), y = (await
|
|
5654
|
+
async function Ts(l) {
|
|
5655
|
+
const { xmlString: c, dialecteConfig: u = ma } = l, o = `test-${crypto.randomUUID()}.xml`, h = new File([c], o, { type: "text/xml" }), y = (await si({
|
|
5656
5656
|
files: [h],
|
|
5657
5657
|
dialecteConfig: u,
|
|
5658
5658
|
useCustomRecordsIds: !0
|
|
5659
|
-
}))[0], b = await
|
|
5659
|
+
}))[0], b = await jo({
|
|
5660
5660
|
databaseName: y,
|
|
5661
5661
|
dialecteConfig: u
|
|
5662
5662
|
}), R = b.getDatabaseInstance();
|
|
@@ -5664,7 +5664,7 @@ async function xs(l) {
|
|
|
5664
5664
|
R?.isOpen() && (R.close(), await new Promise((q) => setTimeout(q, 20))), await ct.delete(y);
|
|
5665
5665
|
} };
|
|
5666
5666
|
}
|
|
5667
|
-
async function
|
|
5667
|
+
async function Ns(l) {
|
|
5668
5668
|
const { chain: c, operations: u } = l;
|
|
5669
5669
|
let o = c;
|
|
5670
5670
|
for (const m of u)
|
|
@@ -5677,8 +5677,8 @@ async function Ts(l) {
|
|
|
5677
5677
|
break;
|
|
5678
5678
|
case "addChild":
|
|
5679
5679
|
m.goTo && (o = o.goToElement(m.goTo));
|
|
5680
|
-
const { id: y, tagName: b, attributes: R, namespace: P, value: q, setFocus:
|
|
5681
|
-
|
|
5680
|
+
const { id: y, tagName: b, attributes: R, namespace: P, value: q, setFocus: V } = m;
|
|
5681
|
+
V ? o = o.addChild({
|
|
5682
5682
|
id: y,
|
|
5683
5683
|
tagName: b,
|
|
5684
5684
|
attributes: R,
|
|
@@ -5698,7 +5698,7 @@ async function Ts(l) {
|
|
|
5698
5698
|
const h = await o.getContext();
|
|
5699
5699
|
return await o.commit(), h;
|
|
5700
5700
|
}
|
|
5701
|
-
function
|
|
5701
|
+
function wi(l) {
|
|
5702
5702
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
|
|
5703
5703
|
return async function() {
|
|
5704
5704
|
const h = await c;
|
|
@@ -5714,7 +5714,7 @@ function Ai(l) {
|
|
|
5714
5714
|
return Ee(m, "Parent record not found"), m;
|
|
5715
5715
|
};
|
|
5716
5716
|
}
|
|
5717
|
-
function
|
|
5717
|
+
function Bi(l) {
|
|
5718
5718
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
|
|
5719
5719
|
return async function(h) {
|
|
5720
5720
|
const m = await c, y = {};
|
|
@@ -5725,7 +5725,7 @@ function wi(l) {
|
|
|
5725
5725
|
databaseInstance: o,
|
|
5726
5726
|
tagName: b,
|
|
5727
5727
|
attributes: R
|
|
5728
|
-
})).filter((
|
|
5728
|
+
})).filter((V) => V.parent?.tagName === m.currentFocus.tagName && V.parent?.id === m.currentFocus.id);
|
|
5729
5729
|
y[b] || (y[b] = []), y[b].push(...q);
|
|
5730
5730
|
}
|
|
5731
5731
|
return y;
|
|
@@ -5734,7 +5734,7 @@ function wi(l) {
|
|
|
5734
5734
|
function Ba(l) {
|
|
5735
5735
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
|
|
5736
5736
|
return async function(h = {}) {
|
|
5737
|
-
const { include: m, exclude: y, unwrap: b } = h, R = await c, P = await
|
|
5737
|
+
const { include: m, exclude: y, unwrap: b } = h, R = await c, P = await Ei({
|
|
5738
5738
|
root: R.currentFocus,
|
|
5739
5739
|
context: R,
|
|
5740
5740
|
dialecteConfig: u,
|
|
@@ -5742,16 +5742,16 @@ function Ba(l) {
|
|
|
5742
5742
|
include: m,
|
|
5743
5743
|
exclude: y
|
|
5744
5744
|
});
|
|
5745
|
-
return P ? b ?
|
|
5745
|
+
return P ? b ? Di({ tree: P, unwrapTagNames: b }) : P : Nn({ record: R.currentFocus });
|
|
5746
5746
|
};
|
|
5747
5747
|
}
|
|
5748
|
-
async function
|
|
5748
|
+
async function Ei(l) {
|
|
5749
5749
|
const { root: c, context: u, dialecteConfig: o, databaseInstance: h, include: m, exclude: y } = l;
|
|
5750
5750
|
async function b(R) {
|
|
5751
5751
|
const { record: P, includeFilter: q } = R;
|
|
5752
|
-
if (
|
|
5752
|
+
if (xi({ record: P, excludeFilters: y }))
|
|
5753
5753
|
return Nn({ record: P });
|
|
5754
|
-
const
|
|
5754
|
+
const V = await Ni({
|
|
5755
5755
|
record: P,
|
|
5756
5756
|
context: u,
|
|
5757
5757
|
dialecteConfig: o,
|
|
@@ -5759,7 +5759,7 @@ async function Bi(l) {
|
|
|
5759
5759
|
currentIncludeFilter: q,
|
|
5760
5760
|
excludeFilters: y
|
|
5761
5761
|
}), H = (await Promise.all(
|
|
5762
|
-
|
|
5762
|
+
V.map(
|
|
5763
5763
|
({ record: M, includeFilter: F }) => b({ record: M, includeFilter: F })
|
|
5764
5764
|
)
|
|
5765
5765
|
)).filter(
|
|
@@ -5769,15 +5769,15 @@ async function Bi(l) {
|
|
|
5769
5769
|
}
|
|
5770
5770
|
return b({ record: c, includeFilter: m });
|
|
5771
5771
|
}
|
|
5772
|
-
function
|
|
5772
|
+
function xi(l) {
|
|
5773
5773
|
const { record: c, excludeFilters: u } = l;
|
|
5774
5774
|
return u ? u.some((o) => (o.scope ?? "self") !== "children" ? !1 : Rn({ record: c, filter: o })) : !1;
|
|
5775
5775
|
}
|
|
5776
|
-
function
|
|
5776
|
+
function Ti(l) {
|
|
5777
5777
|
const { record: c, excludeFilters: u } = l;
|
|
5778
5778
|
return u ? u.some((o) => (o.scope ?? "self") !== "self" ? !1 : Rn({ record: c, filter: o })) : !1;
|
|
5779
5779
|
}
|
|
5780
|
-
async function
|
|
5780
|
+
async function Ni(l) {
|
|
5781
5781
|
const {
|
|
5782
5782
|
record: c,
|
|
5783
5783
|
context: u,
|
|
@@ -5785,17 +5785,17 @@ async function Ti(l) {
|
|
|
5785
5785
|
databaseInstance: h,
|
|
5786
5786
|
currentIncludeFilter: m,
|
|
5787
5787
|
excludeFilters: y
|
|
5788
|
-
} = l, R = (await
|
|
5788
|
+
} = l, R = (await Oi({
|
|
5789
5789
|
record: c,
|
|
5790
5790
|
context: u,
|
|
5791
5791
|
dialecteConfig: o,
|
|
5792
5792
|
databaseInstance: h
|
|
5793
5793
|
})).filter(
|
|
5794
|
-
(P) => !
|
|
5794
|
+
(P) => !Ti({ record: P, excludeFilters: y })
|
|
5795
5795
|
);
|
|
5796
|
-
return
|
|
5796
|
+
return Ri({ children: R, currentIncludeFilter: m });
|
|
5797
5797
|
}
|
|
5798
|
-
async function
|
|
5798
|
+
async function Oi(l) {
|
|
5799
5799
|
const { record: c, context: u, dialecteConfig: o, databaseInstance: h } = l;
|
|
5800
5800
|
return c.children?.length ? (await Promise.all(
|
|
5801
5801
|
c.children.map(
|
|
@@ -5812,7 +5812,7 @@ async function Ni(l) {
|
|
|
5812
5812
|
(y) => !!y
|
|
5813
5813
|
) : [];
|
|
5814
5814
|
}
|
|
5815
|
-
function
|
|
5815
|
+
function Ri(l) {
|
|
5816
5816
|
const { children: c, currentIncludeFilter: u } = l;
|
|
5817
5817
|
if (!u)
|
|
5818
5818
|
return c.map((h) => ({ record: h, includeFilter: void 0 }));
|
|
@@ -5822,7 +5822,7 @@ function Oi(l) {
|
|
|
5822
5822
|
if (u.children && u.children.length > 0) {
|
|
5823
5823
|
const h = [];
|
|
5824
5824
|
for (const m of o) {
|
|
5825
|
-
const y =
|
|
5825
|
+
const y = Ii({
|
|
5826
5826
|
child: m,
|
|
5827
5827
|
branches: u.children
|
|
5828
5828
|
});
|
|
@@ -5832,7 +5832,7 @@ function Oi(l) {
|
|
|
5832
5832
|
}
|
|
5833
5833
|
return o.map((h) => ({ record: h, includeFilter: void 0 }));
|
|
5834
5834
|
}
|
|
5835
|
-
function
|
|
5835
|
+
function Ii(l) {
|
|
5836
5836
|
const { child: c, branches: u } = l;
|
|
5837
5837
|
return u.find((o) => Rn({ record: c, filter: o }));
|
|
5838
5838
|
}
|
|
@@ -5840,7 +5840,7 @@ function Rn(l) {
|
|
|
5840
5840
|
const { record: c, filter: u } = l;
|
|
5841
5841
|
return c.tagName !== u.tagName ? !1 : u.attributes ? gr(c, u.attributes) : !0;
|
|
5842
5842
|
}
|
|
5843
|
-
function
|
|
5843
|
+
function Di(l) {
|
|
5844
5844
|
const { tree: c, unwrapTagNames: u } = l;
|
|
5845
5845
|
function o(h) {
|
|
5846
5846
|
return h.flatMap((m) => u.includes(m.tagName) ? o(m.tree) : [
|
|
@@ -5868,7 +5868,7 @@ function xa(l) {
|
|
|
5868
5868
|
const c = [l.tagName];
|
|
5869
5869
|
return l.descendant && c.push(...xa(l.descendant)), c;
|
|
5870
5870
|
}
|
|
5871
|
-
function
|
|
5871
|
+
function Pi(l) {
|
|
5872
5872
|
const c = [];
|
|
5873
5873
|
function u(o) {
|
|
5874
5874
|
if (o.tree?.length)
|
|
@@ -5877,7 +5877,7 @@ function Di(l) {
|
|
|
5877
5877
|
}
|
|
5878
5878
|
return u(l), c;
|
|
5879
5879
|
}
|
|
5880
|
-
function
|
|
5880
|
+
function Si(l) {
|
|
5881
5881
|
const c = /* @__PURE__ */ new Map();
|
|
5882
5882
|
for (const [u, o] of l.entries()) {
|
|
5883
5883
|
const h = /* @__PURE__ */ new Map();
|
|
@@ -5887,16 +5887,16 @@ function Pi(l) {
|
|
|
5887
5887
|
}
|
|
5888
5888
|
return c;
|
|
5889
5889
|
}
|
|
5890
|
-
function
|
|
5890
|
+
function ki(l, c) {
|
|
5891
5891
|
const u = {};
|
|
5892
5892
|
for (const o of c)
|
|
5893
5893
|
u[o] = l.get(o) || [];
|
|
5894
5894
|
return u;
|
|
5895
5895
|
}
|
|
5896
|
-
async function
|
|
5896
|
+
async function Fi(l) {
|
|
5897
5897
|
const { context: c, dialecteConfig: u, databaseInstance: o, candidates: h, focus: m, path: y, collectTags: b } = l, R = /* @__PURE__ */ new Map();
|
|
5898
5898
|
for (const q of h) {
|
|
5899
|
-
const
|
|
5899
|
+
const V = await Mi({
|
|
5900
5900
|
candidate: q,
|
|
5901
5901
|
focus: m,
|
|
5902
5902
|
context: c,
|
|
@@ -5905,14 +5905,14 @@ async function ki(l) {
|
|
|
5905
5905
|
path: y,
|
|
5906
5906
|
shouldCollect: !0
|
|
5907
5907
|
});
|
|
5908
|
-
|
|
5908
|
+
V.valid && V.ancestors && Ui(V.ancestors, b, R);
|
|
5909
5909
|
}
|
|
5910
|
-
const P =
|
|
5911
|
-
return
|
|
5910
|
+
const P = Si(R);
|
|
5911
|
+
return ki(P, b);
|
|
5912
5912
|
}
|
|
5913
|
-
async function
|
|
5913
|
+
async function Mi(l) {
|
|
5914
5914
|
const { candidate: c, focus: u, context: o, dialecteConfig: h, databaseInstance: m, path: y, shouldCollect: b } = l;
|
|
5915
|
-
return c.id === u.id ? { valid: !1 } : y ?
|
|
5915
|
+
return c.id === u.id ? { valid: !1 } : y ? Ki({
|
|
5916
5916
|
candidate: c,
|
|
5917
5917
|
focus: u,
|
|
5918
5918
|
context: o,
|
|
@@ -5920,7 +5920,7 @@ async function Fi(l) {
|
|
|
5920
5920
|
databaseInstance: m,
|
|
5921
5921
|
path: y,
|
|
5922
5922
|
shouldCollect: b
|
|
5923
|
-
}) :
|
|
5923
|
+
}) : ji({
|
|
5924
5924
|
candidate: c,
|
|
5925
5925
|
focus: u,
|
|
5926
5926
|
context: o,
|
|
@@ -5928,12 +5928,12 @@ async function Fi(l) {
|
|
|
5928
5928
|
databaseInstance: m
|
|
5929
5929
|
});
|
|
5930
5930
|
}
|
|
5931
|
-
async function
|
|
5931
|
+
async function ji(l) {
|
|
5932
5932
|
const { candidate: c, focus: u, context: o, dialecteConfig: h, databaseInstance: m } = l;
|
|
5933
5933
|
let y = c.parent;
|
|
5934
5934
|
for (; y; ) {
|
|
5935
5935
|
if (y.id === u.id && y.tagName === u.tagName)
|
|
5936
|
-
return { valid: !0, ancestors: await
|
|
5936
|
+
return { valid: !0, ancestors: await Li({
|
|
5937
5937
|
from: c,
|
|
5938
5938
|
toFocus: u,
|
|
5939
5939
|
context: o,
|
|
@@ -5953,11 +5953,11 @@ async function Mi(l) {
|
|
|
5953
5953
|
}
|
|
5954
5954
|
return { valid: !1 };
|
|
5955
5955
|
}
|
|
5956
|
-
async function
|
|
5956
|
+
async function Ki(l) {
|
|
5957
5957
|
const { candidate: c, focus: u, context: o, dialecteConfig: h, databaseInstance: m, path: y, shouldCollect: b } = l, R = b ? [c] : [];
|
|
5958
5958
|
let P = c.parent;
|
|
5959
|
-
for (let
|
|
5960
|
-
const z = y[
|
|
5959
|
+
for (let V = y.length - 1; V >= 0; V--) {
|
|
5960
|
+
const z = y[V], H = await qi({
|
|
5961
5961
|
current: P,
|
|
5962
5962
|
expected: z,
|
|
5963
5963
|
context: o,
|
|
@@ -5969,7 +5969,7 @@ async function ji(l) {
|
|
|
5969
5969
|
}
|
|
5970
5970
|
return { valid: P?.id === u.id && P?.tagName === u.tagName, ancestors: b ? R : void 0 };
|
|
5971
5971
|
}
|
|
5972
|
-
async function
|
|
5972
|
+
async function qi(l) {
|
|
5973
5973
|
const { current: c, expected: u, context: o, dialecteConfig: h, databaseInstance: m } = l;
|
|
5974
5974
|
let y = c;
|
|
5975
5975
|
for (; y; ) {
|
|
@@ -6007,7 +6007,7 @@ async function Ki(l) {
|
|
|
6007
6007
|
}
|
|
6008
6008
|
return { found: !1 };
|
|
6009
6009
|
}
|
|
6010
|
-
async function
|
|
6010
|
+
async function Li(l) {
|
|
6011
6011
|
const { from: c, toFocus: u, context: o, dialecteConfig: h, databaseInstance: m } = l, y = [c];
|
|
6012
6012
|
let b = c.parent;
|
|
6013
6013
|
for (; b && !(b.id === u.id && b.tagName === u.tagName); ) {
|
|
@@ -6026,20 +6026,20 @@ async function qi(l) {
|
|
|
6026
6026
|
}
|
|
6027
6027
|
return y;
|
|
6028
6028
|
}
|
|
6029
|
-
function
|
|
6029
|
+
function Ui(l, c, u) {
|
|
6030
6030
|
for (const o of l)
|
|
6031
6031
|
c.has(o.tagName) && (u.has(o.tagName) || u.set(o.tagName, []), u.get(o.tagName).push(o));
|
|
6032
6032
|
}
|
|
6033
|
-
function
|
|
6033
|
+
function $i(l) {
|
|
6034
6034
|
const { contextPromise: c, dialecteConfig: u, databaseInstance: o } = l;
|
|
6035
6035
|
async function h(m) {
|
|
6036
6036
|
const y = await c;
|
|
6037
|
-
return m ?
|
|
6037
|
+
return m ? Gi({
|
|
6038
6038
|
context: y,
|
|
6039
6039
|
dialecteConfig: u,
|
|
6040
6040
|
databaseInstance: o,
|
|
6041
6041
|
filter: m
|
|
6042
|
-
}) :
|
|
6042
|
+
}) : Vi({
|
|
6043
6043
|
contextPromise: c,
|
|
6044
6044
|
dialecteConfig: u,
|
|
6045
6045
|
databaseInstance: o,
|
|
@@ -6048,15 +6048,15 @@ function Ui(l) {
|
|
|
6048
6048
|
}
|
|
6049
6049
|
return h;
|
|
6050
6050
|
}
|
|
6051
|
-
async function
|
|
6052
|
-
const { contextPromise: c, dialecteConfig: u, databaseInstance: o, currentElement: h } = l, y = await Ba({ contextPromise: c, dialecteConfig: u, databaseInstance: o })(), b =
|
|
6051
|
+
async function Vi(l) {
|
|
6052
|
+
const { contextPromise: c, dialecteConfig: u, databaseInstance: o, currentElement: h } = l, y = await Ba({ contextPromise: c, dialecteConfig: u, databaseInstance: o })(), b = Pi(y), R = [h, ...u.descendants[h]], P = {};
|
|
6053
6053
|
for (const q of R)
|
|
6054
6054
|
P[q] = [];
|
|
6055
6055
|
for (const q of b)
|
|
6056
6056
|
P[q.tagName] && P[q.tagName].push(q);
|
|
6057
6057
|
return P;
|
|
6058
6058
|
}
|
|
6059
|
-
async function
|
|
6059
|
+
async function Gi(l) {
|
|
6060
6060
|
const { context: c, dialecteConfig: u, databaseInstance: o, filter: h } = l, m = new Set(xa(h)), y = Ea(h), b = y[y.length - 1], R = y.slice(0, -1), P = await fa({
|
|
6061
6061
|
context: c,
|
|
6062
6062
|
dialecteConfig: u,
|
|
@@ -6064,7 +6064,7 @@ async function Vi(l) {
|
|
|
6064
6064
|
tagName: b.tagName,
|
|
6065
6065
|
attributes: b.attributes
|
|
6066
6066
|
});
|
|
6067
|
-
return await
|
|
6067
|
+
return await Fi({
|
|
6068
6068
|
context: c,
|
|
6069
6069
|
dialecteConfig: u,
|
|
6070
6070
|
databaseInstance: o,
|
|
@@ -6074,7 +6074,14 @@ async function Vi(l) {
|
|
|
6074
6074
|
collectTags: m
|
|
6075
6075
|
});
|
|
6076
6076
|
}
|
|
6077
|
-
function
|
|
6077
|
+
function Xi(l) {
|
|
6078
|
+
const { contextPromise: c } = l;
|
|
6079
|
+
return async function() {
|
|
6080
|
+
const u = await c;
|
|
6081
|
+
return ao({ attributes: u.currentFocus.attributes });
|
|
6082
|
+
};
|
|
6083
|
+
}
|
|
6084
|
+
function Wi(l) {
|
|
6078
6085
|
const c = /* @__PURE__ */ new Map();
|
|
6079
6086
|
for (const o of l) {
|
|
6080
6087
|
const h = (o.status === "deleted" ? o.oldRecord : o.newRecord).id, m = c.get(h);
|
|
@@ -6103,7 +6110,7 @@ function Gi(l) {
|
|
|
6103
6110
|
deletes: u.filter((o) => o.status === "deleted")
|
|
6104
6111
|
};
|
|
6105
6112
|
}
|
|
6106
|
-
const
|
|
6113
|
+
const Yi = {
|
|
6107
6114
|
// 000-099: Generic errors
|
|
6108
6115
|
UNKNOWN_ERROR: {
|
|
6109
6116
|
code: "D001",
|
|
@@ -6148,15 +6155,15 @@ const Xi = {
|
|
|
6148
6155
|
// 500-599: Flavor configuration errors
|
|
6149
6156
|
};
|
|
6150
6157
|
function Ta(l) {
|
|
6151
|
-
const { errorKey: c, messageOverride: u, context: o } = l, { code: h, message: m } =
|
|
6158
|
+
const { errorKey: c, messageOverride: u, context: o } = l, { code: h, message: m } = Yi[c], y = new Error(u ?? m);
|
|
6152
6159
|
return y.code = h, y.errorKey = c, y.defaultMessage = m, y.context = o, y;
|
|
6153
6160
|
}
|
|
6154
|
-
function
|
|
6161
|
+
function zi(l) {
|
|
6155
6162
|
return async function() {
|
|
6156
|
-
const { contextPromise: u, dialecteConfig: o, databaseInstance: h } = l, m = o.database.tables.xmlElements.name, y = h.table(m), b = structuredClone(await u), { creates: R, updates: P, deletes: q } =
|
|
6163
|
+
const { contextPromise: u, dialecteConfig: o, databaseInstance: h } = l, m = o.database.tables.xmlElements.name, y = h.table(m), b = structuredClone(await u), { creates: R, updates: P, deletes: q } = Wi(b.stagedOperations), V = R.length + P.length + q.length;
|
|
6157
6164
|
st.updateEndingProgress({
|
|
6158
6165
|
current: 0,
|
|
6159
|
-
total:
|
|
6166
|
+
total: V,
|
|
6160
6167
|
operation: "Committing changes"
|
|
6161
6168
|
});
|
|
6162
6169
|
try {
|
|
@@ -6164,15 +6171,15 @@ function Wi(l) {
|
|
|
6164
6171
|
let z = 0;
|
|
6165
6172
|
R.length > 0 && (await y.bulkAdd(R.map((H) => H.newRecord)), z += R.length, st.updateEndingProgress({
|
|
6166
6173
|
current: z,
|
|
6167
|
-
total:
|
|
6174
|
+
total: V,
|
|
6168
6175
|
operation: `Created ${R.length} elements`
|
|
6169
6176
|
})), P.length > 0 && (await y.bulkPut(P.map((H) => H.newRecord)), z += P.length, st.updateEndingProgress({
|
|
6170
6177
|
current: z,
|
|
6171
|
-
total:
|
|
6178
|
+
total: V,
|
|
6172
6179
|
operation: `Updated ${P.length} elements`
|
|
6173
6180
|
})), q.length > 0 && (await y.bulkDelete(q.map((H) => H.oldRecord.id)), z += q.length, st.updateEndingProgress({
|
|
6174
6181
|
current: z,
|
|
6175
|
-
total:
|
|
6182
|
+
total: V,
|
|
6176
6183
|
operation: `Deleted ${q.length} elements`
|
|
6177
6184
|
}));
|
|
6178
6185
|
}), b.stagedOperations = [], st.setComplete();
|
|
@@ -6190,22 +6197,22 @@ function Wi(l) {
|
|
|
6190
6197
|
}
|
|
6191
6198
|
};
|
|
6192
6199
|
}
|
|
6193
|
-
function
|
|
6200
|
+
function Qi(l) {
|
|
6194
6201
|
const { chain: c, contextPromise: u, dialecteConfig: o } = l;
|
|
6195
6202
|
return function(h) {
|
|
6196
|
-
const { id: m, tagName: y, attributes: b, namespace: R, value: P, setFocus: q = !1 } = h,
|
|
6203
|
+
const { id: m, tagName: y, attributes: b, namespace: R, value: P, setFocus: q = !1 } = h, V = m ?? crypto.randomUUID(), z = u.then((H) => {
|
|
6197
6204
|
try {
|
|
6198
6205
|
st.setOperation(`Creating ${y}`);
|
|
6199
6206
|
const M = la({
|
|
6200
6207
|
record: {
|
|
6201
|
-
id:
|
|
6208
|
+
id: V,
|
|
6202
6209
|
tagName: y,
|
|
6203
6210
|
attributes: b,
|
|
6204
6211
|
namespace: R,
|
|
6205
6212
|
value: P
|
|
6206
6213
|
},
|
|
6207
6214
|
dialecteConfig: o
|
|
6208
|
-
}), { childRecord: F, updatedParent: J } =
|
|
6215
|
+
}), { childRecord: F, updatedParent: J } = Hi({
|
|
6209
6216
|
record: M,
|
|
6210
6217
|
context: H,
|
|
6211
6218
|
dialecteConfig: o
|
|
@@ -6238,7 +6245,7 @@ function Yi(l) {
|
|
|
6238
6245
|
});
|
|
6239
6246
|
};
|
|
6240
6247
|
}
|
|
6241
|
-
function
|
|
6248
|
+
function Hi(l) {
|
|
6242
6249
|
const { record: c, context: u, dialecteConfig: o } = l, h = {
|
|
6243
6250
|
...c,
|
|
6244
6251
|
parent: { id: u.currentFocus.id, tagName: u.currentFocus.tagName },
|
|
@@ -6279,40 +6286,45 @@ function zi(l) {
|
|
|
6279
6286
|
updatedParent: Pe({ record: m, status: "updated" })
|
|
6280
6287
|
};
|
|
6281
6288
|
}
|
|
6282
|
-
function
|
|
6283
|
-
const { chain: c, contextPromise: u } = l;
|
|
6284
|
-
return function(
|
|
6285
|
-
const { record:
|
|
6286
|
-
const
|
|
6287
|
-
contextPromise: Promise.resolve(
|
|
6289
|
+
function Zi(l) {
|
|
6290
|
+
const { chain: c, contextPromise: u, dialecteConfig: o } = l;
|
|
6291
|
+
return function(h) {
|
|
6292
|
+
const { record: m, setFocus: y } = h, b = u.then(async (R) => {
|
|
6293
|
+
const P = c({
|
|
6294
|
+
contextPromise: Promise.resolve(R)
|
|
6288
6295
|
});
|
|
6289
|
-
let
|
|
6290
|
-
chain:
|
|
6291
|
-
childRecord:
|
|
6296
|
+
let q = await V({
|
|
6297
|
+
chain: P,
|
|
6298
|
+
childRecord: m
|
|
6292
6299
|
});
|
|
6293
|
-
async function
|
|
6294
|
-
const { chain:
|
|
6295
|
-
let F =
|
|
6296
|
-
|
|
6297
|
-
|
|
6298
|
-
|
|
6299
|
-
|
|
6300
|
-
|
|
6301
|
-
|
|
6302
|
-
|
|
6303
|
-
|
|
6304
|
-
|
|
6300
|
+
async function V(z) {
|
|
6301
|
+
const { chain: H, childRecord: M } = z;
|
|
6302
|
+
let F = !0, J = M, re = H;
|
|
6303
|
+
if (o.hooks?.beforeClone && ({ shouldBeCloned: F, transformedRecord: J } = o.hooks.beforeClone({
|
|
6304
|
+
record: J
|
|
6305
|
+
})), F) {
|
|
6306
|
+
re = H.addChild({
|
|
6307
|
+
tagName: M.tagName,
|
|
6308
|
+
namespace: M.namespace,
|
|
6309
|
+
attributes: M.attributes,
|
|
6310
|
+
value: M.value,
|
|
6311
|
+
setFocus: !0
|
|
6312
|
+
});
|
|
6313
|
+
for (const ee of M.tree)
|
|
6314
|
+
re = await V({ chain: re, childRecord: ee }), re = re.goToParent();
|
|
6315
|
+
}
|
|
6316
|
+
return re;
|
|
6305
6317
|
}
|
|
6306
|
-
return
|
|
6318
|
+
return y || (q = q.goToParent()), await q.getContext();
|
|
6307
6319
|
});
|
|
6308
|
-
return c(
|
|
6309
|
-
contextPromise:
|
|
6320
|
+
return c(y ? {
|
|
6321
|
+
contextPromise: b
|
|
6310
6322
|
} : {
|
|
6311
|
-
contextPromise:
|
|
6323
|
+
contextPromise: b
|
|
6312
6324
|
});
|
|
6313
6325
|
};
|
|
6314
6326
|
}
|
|
6315
|
-
function
|
|
6327
|
+
function Ji(l) {
|
|
6316
6328
|
const { chain: c, contextPromise: u, dialecteConfig: o } = l;
|
|
6317
6329
|
return function(h) {
|
|
6318
6330
|
const { attributes: m, value: y } = h, b = u.then(async (R) => {
|
|
@@ -6328,7 +6340,7 @@ function Hi(l) {
|
|
|
6328
6340
|
(M) => !z.some((F) => F.name === M.name)
|
|
6329
6341
|
), ...z];
|
|
6330
6342
|
}
|
|
6331
|
-
const
|
|
6343
|
+
const V = {
|
|
6332
6344
|
...P,
|
|
6333
6345
|
attributes: q,
|
|
6334
6346
|
value: y !== void 0 ? y : P.value
|
|
@@ -6337,16 +6349,16 @@ function Hi(l) {
|
|
|
6337
6349
|
context: R,
|
|
6338
6350
|
status: "updated",
|
|
6339
6351
|
oldRecord: P,
|
|
6340
|
-
newRecord:
|
|
6352
|
+
newRecord: V
|
|
6341
6353
|
}), {
|
|
6342
6354
|
...R,
|
|
6343
|
-
currentFocus: Pe({ record:
|
|
6355
|
+
currentFocus: Pe({ record: V, status: "updated" })
|
|
6344
6356
|
};
|
|
6345
6357
|
});
|
|
6346
6358
|
return c({ contextPromise: b });
|
|
6347
6359
|
};
|
|
6348
6360
|
}
|
|
6349
|
-
function
|
|
6361
|
+
function es(l) {
|
|
6350
6362
|
const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
|
|
6351
6363
|
return function() {
|
|
6352
6364
|
const m = u.then(async (y) => {
|
|
@@ -6361,7 +6373,7 @@ function Zi(l) {
|
|
|
6361
6373
|
databaseInstance: h,
|
|
6362
6374
|
currentChild: b
|
|
6363
6375
|
});
|
|
6364
|
-
const R = await
|
|
6376
|
+
const R = await ts({
|
|
6365
6377
|
context: y,
|
|
6366
6378
|
dialecteConfig: o,
|
|
6367
6379
|
databaseInstance: h
|
|
@@ -6398,7 +6410,7 @@ async function Na(l) {
|
|
|
6398
6410
|
}));
|
|
6399
6411
|
}
|
|
6400
6412
|
}
|
|
6401
|
-
async function
|
|
6413
|
+
async function ts(l) {
|
|
6402
6414
|
const { context: c, dialecteConfig: u, databaseInstance: o } = l, h = c.currentFocus.parent;
|
|
6403
6415
|
Ee(h, "Cannot delete root element");
|
|
6404
6416
|
const m = await Ye({
|
|
@@ -6420,12 +6432,12 @@ async function Ji(l) {
|
|
|
6420
6432
|
newRecord: y
|
|
6421
6433
|
}), Pe({ record: y, status: "updated" });
|
|
6422
6434
|
}
|
|
6423
|
-
function
|
|
6435
|
+
function ns(l) {
|
|
6424
6436
|
const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
|
|
6425
6437
|
return function(y) {
|
|
6426
|
-
const { tagName: b, id: R } = y, P = o.database.tables.xmlElements.name, q = u.then(async (
|
|
6438
|
+
const { tagName: b, id: R } = y, P = o.database.tables.xmlElements.name, q = u.then(async (V) => {
|
|
6427
6439
|
const z = o.singletonElements?.includes(b), H = R ? yr({
|
|
6428
|
-
stagedOperations:
|
|
6440
|
+
stagedOperations: V.stagedOperations,
|
|
6429
6441
|
id: R,
|
|
6430
6442
|
tagName: b
|
|
6431
6443
|
}) : null;
|
|
@@ -6443,7 +6455,7 @@ function es(l) {
|
|
|
6443
6455
|
M.tagName === b,
|
|
6444
6456
|
`Element tagName mismatch: expected "${b}", got "${M.tagName}"`
|
|
6445
6457
|
), {
|
|
6446
|
-
...
|
|
6458
|
+
...V,
|
|
6447
6459
|
currentFocus: Pe({ record: M })
|
|
6448
6460
|
};
|
|
6449
6461
|
});
|
|
@@ -6452,7 +6464,7 @@ function es(l) {
|
|
|
6452
6464
|
});
|
|
6453
6465
|
};
|
|
6454
6466
|
}
|
|
6455
|
-
function
|
|
6467
|
+
function rs(l) {
|
|
6456
6468
|
const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
|
|
6457
6469
|
return function() {
|
|
6458
6470
|
const y = u.then(async (b) => {
|
|
@@ -6467,7 +6479,7 @@ function ts(l) {
|
|
|
6467
6479
|
if (P)
|
|
6468
6480
|
q = P.record;
|
|
6469
6481
|
else {
|
|
6470
|
-
const
|
|
6482
|
+
const V = o.database.tables.xmlElements.name, z = await h.table(V).get({
|
|
6471
6483
|
id: R.id,
|
|
6472
6484
|
tagName: R.tagName
|
|
6473
6485
|
});
|
|
@@ -6481,24 +6493,24 @@ function ts(l) {
|
|
|
6481
6493
|
return c({ contextPromise: y });
|
|
6482
6494
|
};
|
|
6483
6495
|
}
|
|
6484
|
-
function
|
|
6496
|
+
function as(l) {
|
|
6485
6497
|
const { chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h } = l;
|
|
6486
6498
|
return {
|
|
6487
6499
|
//== Navigation
|
|
6488
|
-
goToElement:
|
|
6500
|
+
goToElement: ns({
|
|
6489
6501
|
chain: c,
|
|
6490
6502
|
contextPromise: u,
|
|
6491
6503
|
dialecteConfig: o,
|
|
6492
6504
|
databaseInstance: h
|
|
6493
6505
|
}),
|
|
6494
|
-
goToParent:
|
|
6506
|
+
goToParent: rs({ chain: c, contextPromise: u, dialecteConfig: o, databaseInstance: h }),
|
|
6495
6507
|
//== Queries
|
|
6496
|
-
findChildren:
|
|
6508
|
+
findChildren: Bi({
|
|
6497
6509
|
contextPromise: u,
|
|
6498
6510
|
dialecteConfig: o,
|
|
6499
6511
|
databaseInstance: h
|
|
6500
6512
|
}),
|
|
6501
|
-
findDescendants:
|
|
6513
|
+
findDescendants: $i({
|
|
6502
6514
|
contextPromise: u,
|
|
6503
6515
|
dialecteConfig: o,
|
|
6504
6516
|
databaseInstance: h
|
|
@@ -6508,22 +6520,26 @@ function ns(l) {
|
|
|
6508
6520
|
dialecteConfig: o,
|
|
6509
6521
|
databaseInstance: h
|
|
6510
6522
|
}),
|
|
6523
|
+
getAttributesValues: Xi({
|
|
6524
|
+
contextPromise: u
|
|
6525
|
+
}),
|
|
6511
6526
|
//== Mutations
|
|
6512
|
-
addChild:
|
|
6527
|
+
addChild: Qi({
|
|
6513
6528
|
chain: c,
|
|
6514
6529
|
contextPromise: u,
|
|
6515
6530
|
dialecteConfig: o
|
|
6516
6531
|
}),
|
|
6517
|
-
deepCloneChild:
|
|
6532
|
+
deepCloneChild: Zi({
|
|
6518
6533
|
chain: c,
|
|
6519
|
-
contextPromise: u
|
|
6534
|
+
contextPromise: u,
|
|
6535
|
+
dialecteConfig: o
|
|
6520
6536
|
}),
|
|
6521
|
-
update:
|
|
6537
|
+
update: Ji({
|
|
6522
6538
|
chain: c,
|
|
6523
6539
|
contextPromise: u,
|
|
6524
6540
|
dialecteConfig: o
|
|
6525
6541
|
}),
|
|
6526
|
-
delete:
|
|
6542
|
+
delete: es({
|
|
6527
6543
|
chain: c,
|
|
6528
6544
|
contextPromise: u,
|
|
6529
6545
|
dialecteConfig: o,
|
|
@@ -6533,19 +6549,19 @@ function ns(l) {
|
|
|
6533
6549
|
getContext: eo({
|
|
6534
6550
|
contextPromise: u
|
|
6535
6551
|
}),
|
|
6536
|
-
getParent:
|
|
6552
|
+
getParent: wi({
|
|
6537
6553
|
contextPromise: u,
|
|
6538
6554
|
dialecteConfig: o,
|
|
6539
6555
|
databaseInstance: h
|
|
6540
6556
|
}),
|
|
6541
|
-
commit:
|
|
6557
|
+
commit: zi({
|
|
6542
6558
|
contextPromise: u,
|
|
6543
6559
|
dialecteConfig: o,
|
|
6544
6560
|
databaseInstance: h
|
|
6545
6561
|
})
|
|
6546
6562
|
};
|
|
6547
6563
|
}
|
|
6548
|
-
function
|
|
6564
|
+
function os(l) {
|
|
6549
6565
|
const { coreChain: c, tagName: u, chain: o, dialecteConfig: h, contextPromise: m } = l, y = { ...c }, b = h.extensions[u] || {};
|
|
6550
6566
|
for (const [R, P] of Object.entries(b))
|
|
6551
6567
|
y[R] = P({
|
|
@@ -6566,13 +6582,13 @@ function vr(l) {
|
|
|
6566
6582
|
tagName: h
|
|
6567
6583
|
});
|
|
6568
6584
|
}
|
|
6569
|
-
const y =
|
|
6585
|
+
const y = as({
|
|
6570
6586
|
chain: m,
|
|
6571
6587
|
dialecteConfig: c,
|
|
6572
6588
|
databaseInstance: u,
|
|
6573
6589
|
contextPromise: o
|
|
6574
6590
|
});
|
|
6575
|
-
return
|
|
6591
|
+
return os({
|
|
6576
6592
|
coreChain: y,
|
|
6577
6593
|
tagName: h,
|
|
6578
6594
|
chain: m,
|
|
@@ -6581,44 +6597,44 @@ function vr(l) {
|
|
|
6581
6597
|
});
|
|
6582
6598
|
}
|
|
6583
6599
|
export {
|
|
6584
|
-
|
|
6585
|
-
|
|
6600
|
+
Ao as DATABASE_CONFIG,
|
|
6601
|
+
io as DEV_CUSTOM_RECORD_ID_ATTRIBUTE_NAME,
|
|
6586
6602
|
da as DEV_ID,
|
|
6587
6603
|
qe as DIALECTE_NAMESPACES,
|
|
6588
|
-
|
|
6604
|
+
Co as IO_CONFIG,
|
|
6589
6605
|
va as TEMP_IDB_ID_ATTRIBUTE_NAME,
|
|
6590
6606
|
ma as TEST_DIALECTE_CONFIG,
|
|
6591
|
-
|
|
6592
|
-
|
|
6593
|
-
|
|
6607
|
+
cs as XMLNS_DEFAULT_NAMESPACE,
|
|
6608
|
+
ls as XMLNS_DEV_NAMESPACE,
|
|
6609
|
+
fs as XMLNS_EXT_NAMESPACE,
|
|
6594
6610
|
ut as addStagedOperation,
|
|
6595
6611
|
Ee as assert,
|
|
6596
|
-
|
|
6612
|
+
Ko as bulkAddRecords,
|
|
6597
6613
|
vr as chain,
|
|
6598
6614
|
ga as createDatabaseInstance,
|
|
6599
|
-
|
|
6600
|
-
|
|
6601
|
-
|
|
6602
|
-
|
|
6615
|
+
jo as createDialecte,
|
|
6616
|
+
Ts as createTestDialecte,
|
|
6617
|
+
ds as createTestRecord,
|
|
6618
|
+
Bs as deleteDatabaseIfExists,
|
|
6603
6619
|
st as dialecteState,
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6620
|
+
Ns as executeChainOperations,
|
|
6621
|
+
xs as exportXmlDocumentForOpenSCD,
|
|
6622
|
+
Es as exportXmlFile,
|
|
6623
|
+
oo as fetchRecords,
|
|
6608
6624
|
fa as findByAttributes,
|
|
6609
|
-
|
|
6625
|
+
gi as formatXml,
|
|
6610
6626
|
ro as getAttributeValueByName,
|
|
6611
|
-
|
|
6612
|
-
|
|
6627
|
+
ao as getAttributesValuesByName,
|
|
6628
|
+
ci as getDatabaseName,
|
|
6613
6629
|
yr as getLatestStagedRecord,
|
|
6614
6630
|
Ye as getRecord,
|
|
6615
|
-
|
|
6616
|
-
|
|
6617
|
-
|
|
6618
|
-
|
|
6631
|
+
ko as getState,
|
|
6632
|
+
si as importXmlFiles,
|
|
6633
|
+
ss as isChainRecord,
|
|
6634
|
+
ui as isFileSupported,
|
|
6619
6635
|
no as isFullAttributeArray,
|
|
6620
|
-
|
|
6621
|
-
|
|
6636
|
+
is as isRawRecord,
|
|
6637
|
+
us as isTreeRecord,
|
|
6622
6638
|
gr as matchesAttributeFilter,
|
|
6623
6639
|
ya as resetState,
|
|
6624
6640
|
la as standardizeRecord,
|