lakutata 2.0.81 → 2.0.83
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/com/docker.cjs +1 -1
- package/com/docker.mjs +1 -1
- package/decorator/orm.cjs +84 -84
- package/decorator/orm.mjs +42 -128
- package/orm.cjs +873 -1410
- package/orm.mjs +708 -1458
- package/package.json +1 -1
- package/src/components/cacher/adapters/CreateFileCacheAdapter.cjs +230 -239
- package/src/components/cacher/adapters/CreateFileCacheAdapter.mjs +230 -239
- package/src/components/docker/ConnectionOptionsBuilder.cjs +1 -1
- package/src/components/docker/ConnectionOptionsBuilder.mjs +1 -1
- package/src/components/docker/Docker.cjs +4919 -4808
- package/src/components/docker/Docker.mjs +4939 -4828
- package/src/components/docker/lib/DockerContainer.cjs +1 -1
- package/src/components/docker/lib/DockerContainer.mjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.cjs +1 -1
- package/src/components/docker/lib/DockerContainerTTY.mjs +1 -1
- package/src/components/entrypoint/Entrypoint.cjs +1669 -2159
- package/src/components/entrypoint/Entrypoint.mjs +1629 -2119
- package/src/decorators/orm/AfterInsert.cjs +26 -4
- package/src/decorators/orm/AfterInsert.mjs +25 -5
- package/src/decorators/orm/AfterLoad.cjs +26 -4
- package/src/decorators/orm/AfterLoad.mjs +25 -5
- package/src/decorators/orm/AfterRecover.cjs +26 -4
- package/src/decorators/orm/AfterRecover.mjs +25 -5
- package/src/decorators/orm/AfterRemove.cjs +26 -4
- package/src/decorators/orm/AfterRemove.mjs +25 -5
- package/src/decorators/orm/AfterSoftRemove.cjs +26 -4
- package/src/decorators/orm/AfterSoftRemove.mjs +25 -5
- package/src/decorators/orm/AfterUpdate.cjs +26 -4
- package/src/decorators/orm/AfterUpdate.mjs +25 -5
- package/src/decorators/orm/BeforeInsert.cjs +26 -4
- package/src/decorators/orm/BeforeInsert.mjs +25 -5
- package/src/decorators/orm/BeforeRecover.cjs +26 -4
- package/src/decorators/orm/BeforeRecover.mjs +25 -5
- package/src/decorators/orm/BeforeRemove.cjs +26 -4
- package/src/decorators/orm/BeforeRemove.mjs +25 -5
- package/src/decorators/orm/BeforeSoftRemove.cjs +26 -4
- package/src/decorators/orm/BeforeSoftRemove.mjs +25 -5
- package/src/decorators/orm/BeforeUpdate.cjs +26 -4
- package/src/decorators/orm/BeforeUpdate.mjs +25 -5
- package/src/decorators/orm/Check.cjs +29 -4
- package/src/decorators/orm/Check.mjs +28 -5
- package/src/decorators/orm/ChildEntity.cjs +29 -4
- package/src/decorators/orm/ChildEntity.mjs +28 -5
- package/src/decorators/orm/Column.cjs +61 -4
- package/src/decorators/orm/Column.mjs +61 -6
- package/src/decorators/orm/CreateDateColumn.cjs +25 -4
- package/src/decorators/orm/CreateDateColumn.mjs +24 -5
- package/src/decorators/orm/DeleteDateColumn.cjs +25 -4
- package/src/decorators/orm/DeleteDateColumn.mjs +23 -4
- package/src/decorators/orm/Entity.cjs +35 -4
- package/src/decorators/orm/Entity.mjs +33 -4
- package/src/decorators/orm/EventSubscriber.cjs +22 -4
- package/src/decorators/orm/EventSubscriber.mjs +21 -5
- package/src/decorators/orm/Exclusion.cjs +29 -4
- package/src/decorators/orm/Exclusion.mjs +28 -5
- package/src/decorators/orm/Generated.cjs +24 -4
- package/src/decorators/orm/Generated.mjs +23 -5
- package/src/decorators/orm/Index.cjs +41 -4
- package/src/decorators/orm/Index.mjs +41 -6
- package/src/decorators/orm/JoinColumn.cjs +29 -4
- package/src/decorators/orm/JoinColumn.mjs +28 -5
- package/src/decorators/orm/JoinTable.cjs +30 -4
- package/src/decorators/orm/JoinTable.mjs +28 -4
- package/src/decorators/orm/ManyToMany.cjs +42 -4
- package/src/decorators/orm/ManyToMany.mjs +40 -4
- package/src/decorators/orm/ManyToOne.cjs +42 -4
- package/src/decorators/orm/ManyToOne.mjs +40 -4
- package/src/decorators/orm/ObjectIdColumn.cjs +28 -4
- package/src/decorators/orm/ObjectIdColumn.mjs +27 -5
- package/src/decorators/orm/OneToMany.cjs +34 -4
- package/src/decorators/orm/OneToMany.mjs +34 -6
- package/src/decorators/orm/OneToOne.cjs +42 -4
- package/src/decorators/orm/OneToOne.mjs +40 -4
- package/src/decorators/orm/PrimaryColumn.cjs +49 -4
- package/src/decorators/orm/PrimaryColumn.mjs +49 -6
- package/src/decorators/orm/PrimaryGeneratedColumn.cjs +54 -4
- package/src/decorators/orm/PrimaryGeneratedColumn.mjs +54 -6
- package/src/decorators/orm/RelationId.cjs +26 -4
- package/src/decorators/orm/RelationId.mjs +25 -5
- package/src/decorators/orm/TableInheritance.cjs +26 -4
- package/src/decorators/orm/TableInheritance.mjs +25 -5
- package/src/decorators/orm/Tree.cjs +24 -4
- package/src/decorators/orm/Tree.mjs +23 -5
- package/src/decorators/orm/TreeChildren.cjs +31 -4
- package/src/decorators/orm/TreeChildren.mjs +29 -4
- package/src/decorators/orm/TreeLevelColumn.cjs +25 -4
- package/src/decorators/orm/TreeLevelColumn.mjs +23 -4
- package/src/decorators/orm/TreeParent.cjs +31 -4
- package/src/decorators/orm/TreeParent.mjs +29 -4
- package/src/decorators/orm/Unique.cjs +44 -4
- package/src/decorators/orm/Unique.mjs +44 -6
- package/src/decorators/orm/UpdateDateColumn.cjs +25 -4
- package/src/decorators/orm/UpdateDateColumn.mjs +24 -5
- package/src/decorators/orm/VersionColumn.cjs +25 -4
- package/src/decorators/orm/VersionColumn.mjs +24 -5
- package/src/decorators/orm/ViewColumn.cjs +25 -4
- package/src/decorators/orm/ViewColumn.mjs +24 -5
- package/src/decorators/orm/ViewEntity.cjs +34 -4
- package/src/decorators/orm/ViewEntity.mjs +33 -5
- package/src/decorators/orm/VirtualColumn.cjs +42 -4
- package/src/decorators/orm/VirtualColumn.mjs +40 -4
- package/src/lib/base/EventEmitter.cjs +1193 -1200
- package/src/lib/base/EventEmitter.mjs +1194 -1201
- package/src/lib/base/internal/DataValidator.cjs +185 -174
- package/src/lib/base/internal/DataValidator.mjs +186 -175
- package/src/lib/base/internal/PatternManager.cjs +735 -740
- package/src/lib/base/internal/PatternManager.mjs +740 -745
- package/src/lib/core/Application.cjs +99 -112
- package/src/lib/core/Application.mjs +127 -140
- package/src/lib/helpers/IsHtml.cjs +13 -7
- package/src/lib/helpers/IsHtml.mjs +13 -7
- package/src/lib/helpers/IsXML.cjs +1016 -1158
- package/src/lib/helpers/IsXML.mjs +729 -871
- package/src/lib/helpers/ObjectHash.cjs +371 -378
- package/src/lib/helpers/ObjectHash.mjs +371 -378
- package/src/lib/helpers/RandomString.cjs +146 -167
- package/src/lib/helpers/RandomString.mjs +145 -166
- package/src/lib/helpers/URLBuilder.cjs +355 -355
- package/src/lib/helpers/URLBuilder.mjs +350 -350
- package/src/lib/ioc/ListModules.cjs +5237 -5160
- package/src/lib/ioc/ListModules.mjs +5252 -5175
- package/src/lib/validation/VLD.cjs +3903 -4080
- package/src/lib/validation/VLD.mjs +2793 -2970
- package/src/providers/migration/GenerateMigration.cjs +2 -2
- package/src/providers/migration/GenerateMigration.mjs +2 -2
- package/vendor/Package.112.cjs +38321 -38240
- package/vendor/Package.112.mjs +37720 -37579
- package/vendor/Package.16.cjs +7386 -7268
- package/vendor/Package.16.mjs +6706 -6588
- package/vendor/Package.18.cjs +48229 -20
- package/vendor/Package.18.mjs +48192 -24
- package/vendor/Package.2.cjs +5698 -5727
- package/vendor/Package.2.mjs +5707 -5736
- package/vendor/Package.4.cjs +874 -884
- package/vendor/Package.4.mjs +874 -884
- package/vendor/Package.5.cjs +11 -15
- package/vendor/Package.5.mjs +7 -11
- package/vendor/Package.6.cjs +511 -520
- package/vendor/Package.6.mjs +534 -543
- package/vendor/Package.62.cjs +87 -90
- package/vendor/Package.62.mjs +180 -183
- package/vendor/Package.65.cjs +1285 -1292
- package/vendor/Package.65.mjs +190 -197
- package/vendor/Package.68.cjs +111 -252
- package/vendor/Package.68.mjs +134 -268
- package/vendor/Package.9.cjs +118 -132
- package/vendor/Package.9.mjs +124 -138
- package/vendor/TypeDef.internal.3.d.ts +0 -14
- package/vendor/Package.19.cjs +0 -37
- package/vendor/Package.19.mjs +0 -35
- package/vendor/Package.20.cjs +0 -37
- package/vendor/Package.20.mjs +0 -35
- package/vendor/Package.21.cjs +0 -37
- package/vendor/Package.21.mjs +0 -35
- package/vendor/Package.22.cjs +0 -37
- package/vendor/Package.22.mjs +0 -35
- package/vendor/Package.23.cjs +0 -37
- package/vendor/Package.23.mjs +0 -35
- package/vendor/Package.24.cjs +0 -37
- package/vendor/Package.24.mjs +0 -35
- package/vendor/Package.25.cjs +0 -37
- package/vendor/Package.25.mjs +0 -35
- package/vendor/Package.26.cjs +0 -37
- package/vendor/Package.26.mjs +0 -35
- package/vendor/Package.27.cjs +0 -37
- package/vendor/Package.27.mjs +0 -35
- package/vendor/Package.28.cjs +0 -37
- package/vendor/Package.28.mjs +0 -35
- package/vendor/Package.29.cjs +0 -40
- package/vendor/Package.29.mjs +0 -38
- package/vendor/Package.30.cjs +0 -41
- package/vendor/Package.30.mjs +0 -39
- package/vendor/Package.31.cjs +0 -72
- package/vendor/Package.31.mjs +0 -70
- package/vendor/Package.32.cjs +0 -37
- package/vendor/Package.32.mjs +0 -35
- package/vendor/Package.33.cjs +0 -37
- package/vendor/Package.33.mjs +0 -35
- package/vendor/Package.34.cjs +0 -46
- package/vendor/Package.34.mjs +0 -44
- package/vendor/Package.35.cjs +0 -34
- package/vendor/Package.35.mjs +0 -32
- package/vendor/Package.36.cjs +0 -40
- package/vendor/Package.36.mjs +0 -38
- package/vendor/Package.37.cjs +0 -36
- package/vendor/Package.37.mjs +0 -34
- package/vendor/Package.38.cjs +0 -52
- package/vendor/Package.38.mjs +0 -50
- package/vendor/Package.39.cjs +0 -41
- package/vendor/Package.39.mjs +0 -39
- package/vendor/Package.40.cjs +0 -42
- package/vendor/Package.40.mjs +0 -40
- package/vendor/Package.41.cjs +0 -53
- package/vendor/Package.41.mjs +0 -51
- package/vendor/Package.42.cjs +0 -53
- package/vendor/Package.42.mjs +0 -51
- package/vendor/Package.43.cjs +0 -40
- package/vendor/Package.43.mjs +0 -38
- package/vendor/Package.44.cjs +0 -46
- package/vendor/Package.44.mjs +0 -44
- package/vendor/Package.45.cjs +0 -53
- package/vendor/Package.45.mjs +0 -51
- package/vendor/Package.46.cjs +0 -59
- package/vendor/Package.46.mjs +0 -57
- package/vendor/Package.47.cjs +0 -65
- package/vendor/Package.47.mjs +0 -63
- package/vendor/Package.48.cjs +0 -38
- package/vendor/Package.48.mjs +0 -36
- package/vendor/Package.49.cjs +0 -38
- package/vendor/Package.49.mjs +0 -36
- package/vendor/Package.50.cjs +0 -36
- package/vendor/Package.50.mjs +0 -34
- package/vendor/Package.51.cjs +0 -43
- package/vendor/Package.51.mjs +0 -41
- package/vendor/Package.52.cjs +0 -37
- package/vendor/Package.52.mjs +0 -35
- package/vendor/Package.53.cjs +0 -43
- package/vendor/Package.53.mjs +0 -41
- package/vendor/Package.54.cjs +0 -55
- package/vendor/Package.54.mjs +0 -53
- package/vendor/Package.55.cjs +0 -37
- package/vendor/Package.55.mjs +0 -35
- package/vendor/Package.56.cjs +0 -37
- package/vendor/Package.56.mjs +0 -35
- package/vendor/Package.57.cjs +0 -37
- package/vendor/Package.57.mjs +0 -35
- package/vendor/Package.58.cjs +0 -45
- package/vendor/Package.58.mjs +0 -43
- package/vendor/Package.59.cjs +0 -53
- package/vendor/Package.59.mjs +0 -51
- package/vendor/Package.60.cjs +0 -47649
- package/vendor/Package.60.mjs +0 -47606
|
@@ -4,383 +4,390 @@ Object.defineProperty(exports, Symbol.toStringTag, {
|
|
|
4
4
|
value: "Module"
|
|
5
5
|
});
|
|
6
6
|
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
const
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
const i =
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
s
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
s.
|
|
7
|
+
const t = require("../../../vendor/Package.5.cjs");
|
|
8
|
+
|
|
9
|
+
var e = {};
|
|
10
|
+
|
|
11
|
+
var n = {};
|
|
12
|
+
|
|
13
|
+
(function(t) {
|
|
14
|
+
"use strict";
|
|
15
|
+
const e = ":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";
|
|
16
|
+
const n = e + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040";
|
|
17
|
+
const s = "[" + e + "][" + n + "]*";
|
|
18
|
+
const i = new RegExp("^" + s + "$");
|
|
19
|
+
const r = function(t, e) {
|
|
20
|
+
const n = [];
|
|
21
|
+
let s = e.exec(t);
|
|
22
|
+
while (s) {
|
|
23
|
+
const i = [];
|
|
24
|
+
i.startIndex = e.lastIndex - s[0].length;
|
|
25
|
+
const r = s.length;
|
|
26
|
+
for (let t = 0; t < r; t++) {
|
|
27
|
+
i.push(s[t]);
|
|
28
|
+
}
|
|
29
|
+
n.push(i);
|
|
30
|
+
s = e.exec(t);
|
|
26
31
|
}
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const s = n.length;
|
|
50
|
-
for (let r = 0; r < s; r++) {
|
|
51
|
-
if (i === "strict") {
|
|
52
|
-
e[n[r]] = [ t[n[r]] ];
|
|
53
|
-
} else {
|
|
54
|
-
e[n[r]] = t[n[r]];
|
|
32
|
+
return n;
|
|
33
|
+
};
|
|
34
|
+
const o = function(t) {
|
|
35
|
+
const e = i.exec(t);
|
|
36
|
+
return !(e === null || typeof e === "undefined");
|
|
37
|
+
};
|
|
38
|
+
t.isExist = function(t) {
|
|
39
|
+
return typeof t !== "undefined";
|
|
40
|
+
};
|
|
41
|
+
t.isEmptyObject = function(t) {
|
|
42
|
+
return Object.keys(t).length === 0;
|
|
43
|
+
};
|
|
44
|
+
t.merge = function(t, e, n) {
|
|
45
|
+
if (e) {
|
|
46
|
+
const s = Object.keys(e);
|
|
47
|
+
const i = s.length;
|
|
48
|
+
for (let r = 0; r < i; r++) {
|
|
49
|
+
if (n === "strict") {
|
|
50
|
+
t[s[r]] = [ e[s[r]] ];
|
|
51
|
+
} else {
|
|
52
|
+
t[s[r]] = e[s[r]];
|
|
53
|
+
}
|
|
55
54
|
}
|
|
56
55
|
}
|
|
57
|
-
}
|
|
58
|
-
|
|
56
|
+
};
|
|
57
|
+
t.getValue = function(e) {
|
|
58
|
+
if (t.isExist(e)) {
|
|
59
|
+
return e;
|
|
60
|
+
} else {
|
|
61
|
+
return "";
|
|
62
|
+
}
|
|
63
|
+
};
|
|
64
|
+
t.isName = o;
|
|
65
|
+
t.getAllMatches = r;
|
|
66
|
+
t.nameRegexp = s;
|
|
67
|
+
})(n);
|
|
59
68
|
|
|
60
|
-
|
|
61
|
-
if (exports.isExist(e)) {
|
|
62
|
-
return e;
|
|
63
|
-
} else {
|
|
64
|
-
return "";
|
|
65
|
-
}
|
|
66
|
-
}
|
|
69
|
+
const s = t.getDefaultExportFromCjs(n);
|
|
67
70
|
|
|
68
71
|
"use strict";
|
|
69
72
|
|
|
70
|
-
const
|
|
73
|
+
const i = n;
|
|
74
|
+
|
|
75
|
+
const r = {
|
|
71
76
|
allowBooleanAttributes: false,
|
|
72
77
|
unpairedTags: []
|
|
73
78
|
};
|
|
74
79
|
|
|
75
|
-
function
|
|
76
|
-
|
|
77
|
-
const
|
|
78
|
-
let n = false;
|
|
80
|
+
var o = e.validate = function(t, e) {
|
|
81
|
+
e = Object.assign({}, r, e);
|
|
82
|
+
const n = [];
|
|
79
83
|
let s = false;
|
|
80
|
-
|
|
81
|
-
|
|
84
|
+
let i = false;
|
|
85
|
+
if (t[0] === "\ufeff") {
|
|
86
|
+
t = t.substr(1);
|
|
82
87
|
}
|
|
83
|
-
for (let r = 0; r <
|
|
84
|
-
if (
|
|
88
|
+
for (let r = 0; r < t.length; r++) {
|
|
89
|
+
if (t[r] === "<" && t[r + 1] === "?") {
|
|
85
90
|
r += 2;
|
|
86
|
-
r =
|
|
91
|
+
r = l(t, r);
|
|
87
92
|
if (r.err) return r;
|
|
88
|
-
} else if (
|
|
93
|
+
} else if (t[r] === "<") {
|
|
89
94
|
let o = r;
|
|
90
95
|
r++;
|
|
91
|
-
if (
|
|
92
|
-
r =
|
|
96
|
+
if (t[r] === "!") {
|
|
97
|
+
r = u(t, r);
|
|
93
98
|
continue;
|
|
94
99
|
} else {
|
|
95
|
-
let
|
|
96
|
-
if (
|
|
97
|
-
|
|
100
|
+
let f = false;
|
|
101
|
+
if (t[r] === "/") {
|
|
102
|
+
f = true;
|
|
98
103
|
r++;
|
|
99
104
|
}
|
|
100
|
-
let
|
|
101
|
-
for (;r <
|
|
102
|
-
|
|
105
|
+
let c = "";
|
|
106
|
+
for (;r < t.length && t[r] !== ">" && t[r] !== " " && t[r] !== "\t" && t[r] !== "\n" && t[r] !== "\r"; r++) {
|
|
107
|
+
c += t[r];
|
|
103
108
|
}
|
|
104
|
-
|
|
105
|
-
if (
|
|
106
|
-
|
|
109
|
+
c = c.trim();
|
|
110
|
+
if (c[c.length - 1] === "/") {
|
|
111
|
+
c = c.substring(0, c.length - 1);
|
|
107
112
|
r--;
|
|
108
113
|
}
|
|
109
|
-
if (!
|
|
110
|
-
let
|
|
111
|
-
if (
|
|
112
|
-
|
|
114
|
+
if (!b(c)) {
|
|
115
|
+
let e;
|
|
116
|
+
if (c.trim().length === 0) {
|
|
117
|
+
e = "Invalid space after '<'.";
|
|
113
118
|
} else {
|
|
114
|
-
|
|
119
|
+
e = "Tag '" + c + "' is an invalid name.";
|
|
115
120
|
}
|
|
116
|
-
return
|
|
121
|
+
return x("InvalidTag", e, E(t, r));
|
|
117
122
|
}
|
|
118
|
-
const
|
|
119
|
-
if (
|
|
120
|
-
return
|
|
123
|
+
const d = h(t, r);
|
|
124
|
+
if (d === false) {
|
|
125
|
+
return x("InvalidAttr", "Attributes for '" + c + "' have open quote.", E(t, r));
|
|
121
126
|
}
|
|
122
|
-
let
|
|
123
|
-
r =
|
|
124
|
-
if (
|
|
125
|
-
const
|
|
126
|
-
|
|
127
|
-
const
|
|
128
|
-
if (
|
|
129
|
-
|
|
127
|
+
let g = d.value;
|
|
128
|
+
r = d.index;
|
|
129
|
+
if (g[g.length - 1] === "/") {
|
|
130
|
+
const n = r - g.length;
|
|
131
|
+
g = g.substring(0, g.length - 1);
|
|
132
|
+
const i = p(g, e);
|
|
133
|
+
if (i === true) {
|
|
134
|
+
s = true;
|
|
130
135
|
} else {
|
|
131
|
-
return
|
|
136
|
+
return x(i.err.code, i.err.msg, E(t, n + i.err.line));
|
|
132
137
|
}
|
|
133
|
-
} else if (
|
|
134
|
-
if (!
|
|
135
|
-
return
|
|
136
|
-
} else if (
|
|
137
|
-
return
|
|
138
|
-
} else if (
|
|
139
|
-
return
|
|
138
|
+
} else if (f) {
|
|
139
|
+
if (!d.tagClosed) {
|
|
140
|
+
return x("InvalidTag", "Closing tag '" + c + "' doesn't have proper closing.", E(t, r));
|
|
141
|
+
} else if (g.trim().length > 0) {
|
|
142
|
+
return x("InvalidTag", "Closing tag '" + c + "' can't have attributes or invalid starting.", E(t, o));
|
|
143
|
+
} else if (n.length === 0) {
|
|
144
|
+
return x("InvalidTag", "Closing tag '" + c + "' has not been opened.", E(t, o));
|
|
140
145
|
} else {
|
|
141
|
-
const
|
|
142
|
-
if (
|
|
143
|
-
let
|
|
144
|
-
return
|
|
146
|
+
const e = n.pop();
|
|
147
|
+
if (c !== e.tagName) {
|
|
148
|
+
let n = E(t, e.tagStartPos);
|
|
149
|
+
return x("InvalidTag", "Expected closing tag '" + e.tagName + "' (opened in line " + n.line + ", col " + n.col + ") instead of closing tag '" + c + "'.", E(t, o));
|
|
145
150
|
}
|
|
146
|
-
if (
|
|
147
|
-
|
|
151
|
+
if (n.length == 0) {
|
|
152
|
+
i = true;
|
|
148
153
|
}
|
|
149
154
|
}
|
|
150
155
|
} else {
|
|
151
|
-
const a =
|
|
156
|
+
const a = p(g, e);
|
|
152
157
|
if (a !== true) {
|
|
153
|
-
return
|
|
158
|
+
return x(a.err.code, a.err.msg, E(t, r - g.length + a.err.line));
|
|
154
159
|
}
|
|
155
|
-
if (
|
|
156
|
-
return
|
|
157
|
-
} else if (
|
|
158
|
-
|
|
159
|
-
tagName:
|
|
160
|
+
if (i === true) {
|
|
161
|
+
return x("InvalidXml", "Multiple possible root nodes found.", E(t, r));
|
|
162
|
+
} else if (e.unpairedTags.indexOf(c) !== -1) {} else {
|
|
163
|
+
n.push({
|
|
164
|
+
tagName: c,
|
|
160
165
|
tagStartPos: o
|
|
161
166
|
});
|
|
162
167
|
}
|
|
163
|
-
|
|
168
|
+
s = true;
|
|
164
169
|
}
|
|
165
|
-
for (r++; r <
|
|
166
|
-
if (
|
|
167
|
-
if (
|
|
170
|
+
for (r++; r < t.length; r++) {
|
|
171
|
+
if (t[r] === "<") {
|
|
172
|
+
if (t[r + 1] === "!") {
|
|
168
173
|
r++;
|
|
169
|
-
r =
|
|
174
|
+
r = u(t, r);
|
|
170
175
|
continue;
|
|
171
|
-
} else if (
|
|
172
|
-
r =
|
|
176
|
+
} else if (t[r + 1] === "?") {
|
|
177
|
+
r = l(t, ++r);
|
|
173
178
|
if (r.err) return r;
|
|
174
179
|
} else {
|
|
175
180
|
break;
|
|
176
181
|
}
|
|
177
|
-
} else if (
|
|
178
|
-
const
|
|
179
|
-
if (
|
|
180
|
-
r =
|
|
182
|
+
} else if (t[r] === "&") {
|
|
183
|
+
const e = m(t, r);
|
|
184
|
+
if (e == -1) return x("InvalidChar", "char '&' is not expected.", E(t, r));
|
|
185
|
+
r = e;
|
|
181
186
|
} else {
|
|
182
|
-
if (
|
|
183
|
-
return
|
|
187
|
+
if (i === true && !a(t[r])) {
|
|
188
|
+
return x("InvalidXml", "Extra text at the end", E(t, r));
|
|
184
189
|
}
|
|
185
190
|
}
|
|
186
191
|
}
|
|
187
|
-
if (
|
|
192
|
+
if (t[r] === "<") {
|
|
188
193
|
r--;
|
|
189
194
|
}
|
|
190
195
|
}
|
|
191
196
|
} else {
|
|
192
|
-
if (
|
|
197
|
+
if (a(t[r])) {
|
|
193
198
|
continue;
|
|
194
199
|
}
|
|
195
|
-
return
|
|
200
|
+
return x("InvalidChar", "char '" + t[r] + "' is not expected.", E(t, r));
|
|
196
201
|
}
|
|
197
202
|
}
|
|
198
|
-
if (!
|
|
199
|
-
return
|
|
200
|
-
} else if (
|
|
201
|
-
return
|
|
202
|
-
} else if (
|
|
203
|
-
return
|
|
203
|
+
if (!s) {
|
|
204
|
+
return x("InvalidXml", "Start tag expected.", 1);
|
|
205
|
+
} else if (n.length == 1) {
|
|
206
|
+
return x("InvalidTag", "Unclosed tag '" + n[0].tagName + "'.", E(t, n[0].tagStartPos));
|
|
207
|
+
} else if (n.length > 0) {
|
|
208
|
+
return x("InvalidXml", "Invalid '" + JSON.stringify(n.map((t => t.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", {
|
|
204
209
|
line: 1,
|
|
205
210
|
col: 1
|
|
206
211
|
});
|
|
207
212
|
}
|
|
208
213
|
return true;
|
|
209
|
-
}
|
|
214
|
+
};
|
|
210
215
|
|
|
211
|
-
function
|
|
212
|
-
return
|
|
216
|
+
function a(t) {
|
|
217
|
+
return t === " " || t === "\t" || t === "\n" || t === "\r";
|
|
213
218
|
}
|
|
214
219
|
|
|
215
|
-
function
|
|
216
|
-
const
|
|
217
|
-
for (;
|
|
218
|
-
if (e
|
|
219
|
-
const
|
|
220
|
-
if (
|
|
221
|
-
return
|
|
222
|
-
} else if (e
|
|
223
|
-
|
|
220
|
+
function l(t, e) {
|
|
221
|
+
const n = e;
|
|
222
|
+
for (;e < t.length; e++) {
|
|
223
|
+
if (t[e] == "?" || t[e] == " ") {
|
|
224
|
+
const s = t.substr(n, e - n);
|
|
225
|
+
if (e > 5 && s === "xml") {
|
|
226
|
+
return x("InvalidXml", "XML declaration allowed only at the start of the document.", E(t, e));
|
|
227
|
+
} else if (t[e] == "?" && t[e + 1] == ">") {
|
|
228
|
+
e++;
|
|
224
229
|
break;
|
|
225
230
|
} else {
|
|
226
231
|
continue;
|
|
227
232
|
}
|
|
228
233
|
}
|
|
229
234
|
}
|
|
230
|
-
return
|
|
235
|
+
return e;
|
|
231
236
|
}
|
|
232
237
|
|
|
233
|
-
function
|
|
234
|
-
if (
|
|
235
|
-
for (
|
|
236
|
-
if (e
|
|
237
|
-
|
|
238
|
+
function u(t, e) {
|
|
239
|
+
if (t.length > e + 5 && t[e + 1] === "-" && t[e + 2] === "-") {
|
|
240
|
+
for (e += 3; e < t.length; e++) {
|
|
241
|
+
if (t[e] === "-" && t[e + 1] === "-" && t[e + 2] === ">") {
|
|
242
|
+
e += 2;
|
|
238
243
|
break;
|
|
239
244
|
}
|
|
240
245
|
}
|
|
241
|
-
} else if (
|
|
242
|
-
let
|
|
243
|
-
for (
|
|
244
|
-
if (e
|
|
245
|
-
|
|
246
|
-
} else if (e
|
|
247
|
-
|
|
248
|
-
if (
|
|
246
|
+
} else if (t.length > e + 8 && t[e + 1] === "D" && t[e + 2] === "O" && t[e + 3] === "C" && t[e + 4] === "T" && t[e + 5] === "Y" && t[e + 6] === "P" && t[e + 7] === "E") {
|
|
247
|
+
let n = 1;
|
|
248
|
+
for (e += 8; e < t.length; e++) {
|
|
249
|
+
if (t[e] === "<") {
|
|
250
|
+
n++;
|
|
251
|
+
} else if (t[e] === ">") {
|
|
252
|
+
n--;
|
|
253
|
+
if (n === 0) {
|
|
249
254
|
break;
|
|
250
255
|
}
|
|
251
256
|
}
|
|
252
257
|
}
|
|
253
|
-
} else if (
|
|
254
|
-
for (
|
|
255
|
-
if (e
|
|
256
|
-
|
|
258
|
+
} else if (t.length > e + 9 && t[e + 1] === "[" && t[e + 2] === "C" && t[e + 3] === "D" && t[e + 4] === "A" && t[e + 5] === "T" && t[e + 6] === "A" && t[e + 7] === "[") {
|
|
259
|
+
for (e += 8; e < t.length; e++) {
|
|
260
|
+
if (t[e] === "]" && t[e + 1] === "]" && t[e + 2] === ">") {
|
|
261
|
+
e += 2;
|
|
257
262
|
break;
|
|
258
263
|
}
|
|
259
264
|
}
|
|
260
265
|
}
|
|
261
|
-
return
|
|
266
|
+
return e;
|
|
262
267
|
}
|
|
263
268
|
|
|
264
|
-
const
|
|
269
|
+
const f = '"';
|
|
265
270
|
|
|
266
|
-
const
|
|
271
|
+
const c = "'";
|
|
267
272
|
|
|
268
|
-
function
|
|
269
|
-
let i = "";
|
|
273
|
+
function h(t, e) {
|
|
270
274
|
let n = "";
|
|
271
|
-
let s =
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
275
|
+
let s = "";
|
|
276
|
+
let i = false;
|
|
277
|
+
for (;e < t.length; e++) {
|
|
278
|
+
if (t[e] === f || t[e] === c) {
|
|
279
|
+
if (s === "") {
|
|
280
|
+
s = t[e];
|
|
281
|
+
} else if (s !== t[e]) {} else {
|
|
282
|
+
s = "";
|
|
278
283
|
}
|
|
279
|
-
} else if (e
|
|
280
|
-
if (
|
|
281
|
-
|
|
284
|
+
} else if (t[e] === ">") {
|
|
285
|
+
if (s === "") {
|
|
286
|
+
i = true;
|
|
282
287
|
break;
|
|
283
288
|
}
|
|
284
289
|
}
|
|
285
|
-
|
|
290
|
+
n += t[e];
|
|
286
291
|
}
|
|
287
|
-
if (
|
|
292
|
+
if (s !== "") {
|
|
288
293
|
return false;
|
|
289
294
|
}
|
|
290
295
|
return {
|
|
291
|
-
value:
|
|
292
|
-
index:
|
|
293
|
-
tagClosed:
|
|
296
|
+
value: n,
|
|
297
|
+
index: e,
|
|
298
|
+
tagClosed: i
|
|
294
299
|
};
|
|
295
300
|
}
|
|
296
301
|
|
|
297
|
-
const
|
|
302
|
+
const d = new RegExp("(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['\"])(([\\s\\S])*?)\\5)?", "g");
|
|
298
303
|
|
|
299
|
-
function
|
|
300
|
-
const
|
|
301
|
-
const
|
|
302
|
-
for (let
|
|
303
|
-
if (
|
|
304
|
-
return
|
|
305
|
-
} else if (
|
|
306
|
-
return
|
|
307
|
-
} else if (
|
|
308
|
-
return
|
|
309
|
-
}
|
|
310
|
-
const
|
|
311
|
-
if (!
|
|
312
|
-
return
|
|
313
|
-
}
|
|
314
|
-
if (!
|
|
315
|
-
|
|
304
|
+
function p(t, e) {
|
|
305
|
+
const n = i.getAllMatches(t, d);
|
|
306
|
+
const s = {};
|
|
307
|
+
for (let t = 0; t < n.length; t++) {
|
|
308
|
+
if (n[t][1].length === 0) {
|
|
309
|
+
return x("InvalidAttr", "Attribute '" + n[t][2] + "' has no space in starting.", v(n[t]));
|
|
310
|
+
} else if (n[t][3] !== undefined && n[t][4] === undefined) {
|
|
311
|
+
return x("InvalidAttr", "Attribute '" + n[t][2] + "' is without value.", v(n[t]));
|
|
312
|
+
} else if (n[t][3] === undefined && !e.allowBooleanAttributes) {
|
|
313
|
+
return x("InvalidAttr", "boolean attribute '" + n[t][2] + "' is not allowed.", v(n[t]));
|
|
314
|
+
}
|
|
315
|
+
const i = n[t][2];
|
|
316
|
+
if (!N(i)) {
|
|
317
|
+
return x("InvalidAttr", "Attribute '" + i + "' is an invalid name.", v(n[t]));
|
|
318
|
+
}
|
|
319
|
+
if (!s.hasOwnProperty(i)) {
|
|
320
|
+
s[i] = 1;
|
|
316
321
|
} else {
|
|
317
|
-
return
|
|
322
|
+
return x("InvalidAttr", "Attribute '" + i + "' is repeated.", v(n[t]));
|
|
318
323
|
}
|
|
319
324
|
}
|
|
320
325
|
return true;
|
|
321
326
|
}
|
|
322
327
|
|
|
323
|
-
function
|
|
324
|
-
let
|
|
325
|
-
if (e
|
|
326
|
-
|
|
327
|
-
|
|
328
|
+
function g(t, e) {
|
|
329
|
+
let n = /\d/;
|
|
330
|
+
if (t[e] === "x") {
|
|
331
|
+
e++;
|
|
332
|
+
n = /[\da-fA-F]/;
|
|
328
333
|
}
|
|
329
|
-
for (;
|
|
330
|
-
if (e
|
|
331
|
-
if (!e
|
|
334
|
+
for (;e < t.length; e++) {
|
|
335
|
+
if (t[e] === ";") return e;
|
|
336
|
+
if (!t[e].match(n)) break;
|
|
332
337
|
}
|
|
333
338
|
return -1;
|
|
334
339
|
}
|
|
335
340
|
|
|
336
|
-
function
|
|
337
|
-
|
|
338
|
-
if (e
|
|
339
|
-
if (e
|
|
340
|
-
|
|
341
|
-
return
|
|
342
|
-
}
|
|
343
|
-
let
|
|
344
|
-
for (;
|
|
345
|
-
if (e
|
|
346
|
-
if (e
|
|
341
|
+
function m(t, e) {
|
|
342
|
+
e++;
|
|
343
|
+
if (t[e] === ";") return -1;
|
|
344
|
+
if (t[e] === "#") {
|
|
345
|
+
e++;
|
|
346
|
+
return g(t, e);
|
|
347
|
+
}
|
|
348
|
+
let n = 0;
|
|
349
|
+
for (;e < t.length; e++, n++) {
|
|
350
|
+
if (t[e].match(/\w/) && n < 20) continue;
|
|
351
|
+
if (t[e] === ";") break;
|
|
347
352
|
return -1;
|
|
348
353
|
}
|
|
349
|
-
return
|
|
354
|
+
return e;
|
|
350
355
|
}
|
|
351
356
|
|
|
352
|
-
function
|
|
357
|
+
function x(t, e, n) {
|
|
353
358
|
return {
|
|
354
359
|
err: {
|
|
355
|
-
code:
|
|
356
|
-
msg:
|
|
357
|
-
line:
|
|
358
|
-
col:
|
|
360
|
+
code: t,
|
|
361
|
+
msg: e,
|
|
362
|
+
line: n.line || n,
|
|
363
|
+
col: n.col
|
|
359
364
|
}
|
|
360
365
|
};
|
|
361
366
|
}
|
|
362
367
|
|
|
363
|
-
function
|
|
364
|
-
return
|
|
368
|
+
function N(t) {
|
|
369
|
+
return i.isName(t);
|
|
365
370
|
}
|
|
366
371
|
|
|
367
|
-
function
|
|
368
|
-
return
|
|
372
|
+
function b(t) {
|
|
373
|
+
return i.isName(t);
|
|
369
374
|
}
|
|
370
375
|
|
|
371
|
-
function
|
|
372
|
-
const
|
|
376
|
+
function E(t, e) {
|
|
377
|
+
const n = t.substring(0, e).split(/\r?\n/);
|
|
373
378
|
return {
|
|
374
|
-
line:
|
|
375
|
-
col:
|
|
379
|
+
line: n.length,
|
|
380
|
+
col: n[n.length - 1].length + 1
|
|
376
381
|
};
|
|
377
382
|
}
|
|
378
383
|
|
|
379
|
-
function
|
|
380
|
-
return
|
|
384
|
+
function v(t) {
|
|
385
|
+
return t.startIndex + t[1].length;
|
|
381
386
|
}
|
|
382
387
|
|
|
383
|
-
|
|
388
|
+
var y = {};
|
|
389
|
+
|
|
390
|
+
const T = {
|
|
384
391
|
preserveOrder: false,
|
|
385
392
|
attributeNamePrefix: "@_",
|
|
386
393
|
attributesGroupName: false,
|
|
@@ -397,11 +404,11 @@ const P = {
|
|
|
397
404
|
leadingZeros: true,
|
|
398
405
|
eNotation: true
|
|
399
406
|
},
|
|
400
|
-
tagValueProcessor: function(
|
|
401
|
-
return
|
|
407
|
+
tagValueProcessor: function(t, e) {
|
|
408
|
+
return e;
|
|
402
409
|
},
|
|
403
|
-
attributeValueProcessor: function(
|
|
404
|
-
return
|
|
410
|
+
attributeValueProcessor: function(t, e) {
|
|
411
|
+
return e;
|
|
405
412
|
},
|
|
406
413
|
stopNodes: [],
|
|
407
414
|
alwaysCreateTextNode: false,
|
|
@@ -414,421 +421,237 @@ const P = {
|
|
|
414
421
|
ignorePiTags: false,
|
|
415
422
|
transformTagName: false,
|
|
416
423
|
transformAttributeName: false,
|
|
417
|
-
updateTag: function(
|
|
418
|
-
return
|
|
419
|
-
}
|
|
420
|
-
captureMetaData: false
|
|
424
|
+
updateTag: function(t, e, n) {
|
|
425
|
+
return t;
|
|
426
|
+
}
|
|
421
427
|
};
|
|
422
428
|
|
|
423
|
-
const
|
|
424
|
-
return Object.assign({},
|
|
429
|
+
const O = function(t) {
|
|
430
|
+
return Object.assign({}, T, t);
|
|
425
431
|
};
|
|
426
432
|
|
|
427
|
-
|
|
433
|
+
var P = y.buildOptions = O;
|
|
428
434
|
|
|
429
|
-
|
|
435
|
+
var w = y.defaultOptions = T;
|
|
430
436
|
|
|
431
|
-
|
|
432
|
-
S = "@@xmlMetadata";
|
|
433
|
-
} else {
|
|
434
|
-
S = Symbol("XML Node Metadata");
|
|
435
|
-
}
|
|
437
|
+
"use strict";
|
|
436
438
|
|
|
437
439
|
class XmlNode {
|
|
438
|
-
constructor(
|
|
439
|
-
this.tagname =
|
|
440
|
+
constructor(t) {
|
|
441
|
+
this.tagname = t;
|
|
440
442
|
this.child = [];
|
|
441
443
|
this[":@"] = {};
|
|
442
444
|
}
|
|
443
|
-
add(
|
|
444
|
-
if (
|
|
445
|
+
add(t, e) {
|
|
446
|
+
if (t === "__proto__") t = "#__proto__";
|
|
445
447
|
this.child.push({
|
|
446
|
-
[
|
|
448
|
+
[t]: e
|
|
447
449
|
});
|
|
448
450
|
}
|
|
449
|
-
addChild(
|
|
450
|
-
if (
|
|
451
|
-
if (
|
|
451
|
+
addChild(t) {
|
|
452
|
+
if (t.tagname === "__proto__") t.tagname = "#__proto__";
|
|
453
|
+
if (t[":@"] && Object.keys(t[":@"]).length > 0) {
|
|
452
454
|
this.child.push({
|
|
453
|
-
[
|
|
454
|
-
[":@"]:
|
|
455
|
+
[t.tagname]: t.child,
|
|
456
|
+
[":@"]: t[":@"]
|
|
455
457
|
});
|
|
456
458
|
} else {
|
|
457
459
|
this.child.push({
|
|
458
|
-
[
|
|
460
|
+
[t.tagname]: t.child
|
|
459
461
|
});
|
|
460
462
|
}
|
|
461
|
-
if (t !== undefined) {
|
|
462
|
-
this.child[this.child.length - 1][S] = {
|
|
463
|
-
startIndex: t
|
|
464
|
-
};
|
|
465
|
-
}
|
|
466
|
-
}
|
|
467
|
-
static getMetaDataSymbol() {
|
|
468
|
-
return S;
|
|
469
463
|
}
|
|
470
464
|
}
|
|
471
465
|
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
} else if (V(e, "!--", t)) r = true; else throw new Error(`Invalid DOCTYPE`);
|
|
504
|
-
n++;
|
|
505
|
-
o = "";
|
|
506
|
-
} else if (e[t] === ">") {
|
|
507
|
-
if (r) {
|
|
508
|
-
if (e[t - 1] === "-" && e[t - 2] === "-") {
|
|
509
|
-
r = false;
|
|
510
|
-
n--;
|
|
511
|
-
}
|
|
512
|
-
} else {
|
|
513
|
-
n--;
|
|
514
|
-
}
|
|
515
|
-
if (n === 0) {
|
|
516
|
-
break;
|
|
466
|
+
var A = XmlNode;
|
|
467
|
+
|
|
468
|
+
const C = t.getDefaultExportFromCjs(A);
|
|
469
|
+
|
|
470
|
+
const I = n;
|
|
471
|
+
|
|
472
|
+
function j(t, e) {
|
|
473
|
+
const n = {};
|
|
474
|
+
if (t[e + 3] === "O" && t[e + 4] === "C" && t[e + 5] === "T" && t[e + 6] === "Y" && t[e + 7] === "P" && t[e + 8] === "E") {
|
|
475
|
+
e = e + 9;
|
|
476
|
+
let s = 1;
|
|
477
|
+
let i = false, r = false;
|
|
478
|
+
let o = "";
|
|
479
|
+
for (;e < t.length; e++) {
|
|
480
|
+
if (t[e] === "<" && !r) {
|
|
481
|
+
if (i && D(t, e)) {
|
|
482
|
+
e += 7;
|
|
483
|
+
let s, i;
|
|
484
|
+
[s, i, e] = S(t, e + 1);
|
|
485
|
+
if (i.indexOf("&") === -1) n[_(s)] = {
|
|
486
|
+
regx: RegExp(`&${s};`, "g"),
|
|
487
|
+
val: i
|
|
488
|
+
};
|
|
489
|
+
} else if (i && V(t, e)) e += 8; else if (i && k(t, e)) e += 8; else if (i && $(t, e)) e += 9; else if (F) r = true; else throw new Error("Invalid DOCTYPE");
|
|
490
|
+
s++;
|
|
491
|
+
o = "";
|
|
492
|
+
} else if (t[e] === ">") {
|
|
493
|
+
if (r) {
|
|
494
|
+
if (t[e - 1] === "-" && t[e - 2] === "-") {
|
|
495
|
+
r = false;
|
|
496
|
+
s--;
|
|
517
497
|
}
|
|
518
|
-
} else if (e[t] === "[") {
|
|
519
|
-
s = true;
|
|
520
498
|
} else {
|
|
521
|
-
|
|
522
|
-
}
|
|
523
|
-
}
|
|
524
|
-
if (n !== 0) {
|
|
525
|
-
throw new Error(`Unclosed DOCTYPE`);
|
|
526
|
-
}
|
|
527
|
-
} else {
|
|
528
|
-
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
529
|
-
}
|
|
530
|
-
return {
|
|
531
|
-
entities: i,
|
|
532
|
-
i: t
|
|
533
|
-
};
|
|
534
|
-
}
|
|
535
|
-
readEntityExp(e, t) {
|
|
536
|
-
t = C(e, t);
|
|
537
|
-
let i = "";
|
|
538
|
-
while (t < e.length && !/\s/.test(e[t]) && e[t] !== '"' && e[t] !== "'") {
|
|
539
|
-
i += e[t];
|
|
540
|
-
t++;
|
|
541
|
-
}
|
|
542
|
-
D(i);
|
|
543
|
-
t = C(e, t);
|
|
544
|
-
if (!this.suppressValidationErr) {
|
|
545
|
-
if (e.substring(t, t + 6).toUpperCase() === "SYSTEM") {
|
|
546
|
-
throw new Error("External entities are not supported");
|
|
547
|
-
} else if (e[t] === "%") {
|
|
548
|
-
throw new Error("Parameter entities are not supported");
|
|
549
|
-
}
|
|
550
|
-
}
|
|
551
|
-
let n = "";
|
|
552
|
-
[t, n] = this.readIdentifierVal(e, t, "entity");
|
|
553
|
-
t--;
|
|
554
|
-
return [ i, n, t ];
|
|
555
|
-
}
|
|
556
|
-
readNotationExp(e, t) {
|
|
557
|
-
t = C(e, t);
|
|
558
|
-
let i = "";
|
|
559
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
560
|
-
i += e[t];
|
|
561
|
-
t++;
|
|
562
|
-
}
|
|
563
|
-
!this.suppressValidationErr && D(i);
|
|
564
|
-
t = C(e, t);
|
|
565
|
-
const n = e.substring(t, t + 6).toUpperCase();
|
|
566
|
-
if (!this.suppressValidationErr && n !== "SYSTEM" && n !== "PUBLIC") {
|
|
567
|
-
throw new Error(`Expected SYSTEM or PUBLIC, found "${n}"`);
|
|
568
|
-
}
|
|
569
|
-
t += n.length;
|
|
570
|
-
t = C(e, t);
|
|
571
|
-
let s = null;
|
|
572
|
-
let r = null;
|
|
573
|
-
if (n === "PUBLIC") {
|
|
574
|
-
[t, s] = this.readIdentifierVal(e, t, "publicIdentifier");
|
|
575
|
-
t = C(e, t);
|
|
576
|
-
if (e[t] === '"' || e[t] === "'") {
|
|
577
|
-
[t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
|
|
578
|
-
}
|
|
579
|
-
} else if (n === "SYSTEM") {
|
|
580
|
-
[t, r] = this.readIdentifierVal(e, t, "systemIdentifier");
|
|
581
|
-
if (!this.suppressValidationErr && !r) {
|
|
582
|
-
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
583
|
-
}
|
|
584
|
-
}
|
|
585
|
-
return {
|
|
586
|
-
notationName: i,
|
|
587
|
-
publicIdentifier: s,
|
|
588
|
-
systemIdentifier: r,
|
|
589
|
-
index: --t
|
|
590
|
-
};
|
|
591
|
-
}
|
|
592
|
-
readIdentifierVal(e, t, i) {
|
|
593
|
-
let n = "";
|
|
594
|
-
const s = e[t];
|
|
595
|
-
if (s !== '"' && s !== "'") {
|
|
596
|
-
throw new Error(`Expected quoted string, found "${s}"`);
|
|
597
|
-
}
|
|
598
|
-
t++;
|
|
599
|
-
while (t < e.length && e[t] !== s) {
|
|
600
|
-
n += e[t];
|
|
601
|
-
t++;
|
|
602
|
-
}
|
|
603
|
-
if (e[t] !== s) {
|
|
604
|
-
throw new Error(`Unterminated ${i} value`);
|
|
605
|
-
}
|
|
606
|
-
t++;
|
|
607
|
-
return [ t, n ];
|
|
608
|
-
}
|
|
609
|
-
readElementExp(e, t) {
|
|
610
|
-
t = C(e, t);
|
|
611
|
-
let i = "";
|
|
612
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
613
|
-
i += e[t];
|
|
614
|
-
t++;
|
|
615
|
-
}
|
|
616
|
-
if (!this.suppressValidationErr && !r(i)) {
|
|
617
|
-
throw new Error(`Invalid element name: "${i}"`);
|
|
618
|
-
}
|
|
619
|
-
t = C(e, t);
|
|
620
|
-
let n = "";
|
|
621
|
-
if (e[t] === "E" && V(e, "MPTY", t)) t += 4; else if (e[t] === "A" && V(e, "NY", t)) t += 2; else if (e[t] === "(") {
|
|
622
|
-
t++;
|
|
623
|
-
while (t < e.length && e[t] !== ")") {
|
|
624
|
-
n += e[t];
|
|
625
|
-
t++;
|
|
626
|
-
}
|
|
627
|
-
if (e[t] !== ")") {
|
|
628
|
-
throw new Error("Unterminated content model");
|
|
629
|
-
}
|
|
630
|
-
} else if (!this.suppressValidationErr) {
|
|
631
|
-
throw new Error(`Invalid Element Expression, found "${e[t]}"`);
|
|
632
|
-
}
|
|
633
|
-
return {
|
|
634
|
-
elementName: i,
|
|
635
|
-
contentModel: n.trim(),
|
|
636
|
-
index: t
|
|
637
|
-
};
|
|
638
|
-
}
|
|
639
|
-
readAttlistExp(e, t) {
|
|
640
|
-
t = C(e, t);
|
|
641
|
-
let i = "";
|
|
642
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
643
|
-
i += e[t];
|
|
644
|
-
t++;
|
|
645
|
-
}
|
|
646
|
-
D(i);
|
|
647
|
-
t = C(e, t);
|
|
648
|
-
let n = "";
|
|
649
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
650
|
-
n += e[t];
|
|
651
|
-
t++;
|
|
652
|
-
}
|
|
653
|
-
if (!D(n)) {
|
|
654
|
-
throw new Error(`Invalid attribute name: "${n}"`);
|
|
655
|
-
}
|
|
656
|
-
t = C(e, t);
|
|
657
|
-
let s = "";
|
|
658
|
-
if (e.substring(t, t + 8).toUpperCase() === "NOTATION") {
|
|
659
|
-
s = "NOTATION";
|
|
660
|
-
t += 8;
|
|
661
|
-
t = C(e, t);
|
|
662
|
-
if (e[t] !== "(") {
|
|
663
|
-
throw new Error(`Expected '(', found "${e[t]}"`);
|
|
664
|
-
}
|
|
665
|
-
t++;
|
|
666
|
-
let i = [];
|
|
667
|
-
while (t < e.length && e[t] !== ")") {
|
|
668
|
-
let n = "";
|
|
669
|
-
while (t < e.length && e[t] !== "|" && e[t] !== ")") {
|
|
670
|
-
n += e[t];
|
|
671
|
-
t++;
|
|
672
|
-
}
|
|
673
|
-
n = n.trim();
|
|
674
|
-
if (!D(n)) {
|
|
675
|
-
throw new Error(`Invalid notation name: "${n}"`);
|
|
499
|
+
s--;
|
|
676
500
|
}
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
t++;
|
|
680
|
-
t = C(e, t);
|
|
501
|
+
if (s === 0) {
|
|
502
|
+
break;
|
|
681
503
|
}
|
|
682
|
-
}
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
t++;
|
|
687
|
-
s += " (" + i.join("|") + ")";
|
|
688
|
-
} else {
|
|
689
|
-
while (t < e.length && !/\s/.test(e[t])) {
|
|
690
|
-
s += e[t];
|
|
691
|
-
t++;
|
|
692
|
-
}
|
|
693
|
-
const i = [ "CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS" ];
|
|
694
|
-
if (!this.suppressValidationErr && !i.includes(s.toUpperCase())) {
|
|
695
|
-
throw new Error(`Invalid attribute type: "${s}"`);
|
|
504
|
+
} else if (t[e] === "[") {
|
|
505
|
+
i = true;
|
|
506
|
+
} else {
|
|
507
|
+
o += t[e];
|
|
696
508
|
}
|
|
697
509
|
}
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
if (e.substring(t, t + 8).toUpperCase() === "#REQUIRED") {
|
|
701
|
-
r = "#REQUIRED";
|
|
702
|
-
t += 8;
|
|
703
|
-
} else if (e.substring(t, t + 7).toUpperCase() === "#IMPLIED") {
|
|
704
|
-
r = "#IMPLIED";
|
|
705
|
-
t += 7;
|
|
706
|
-
} else {
|
|
707
|
-
[t, r] = this.readIdentifierVal(e, t, "ATTLIST");
|
|
510
|
+
if (s !== 0) {
|
|
511
|
+
throw new Error(`Unclosed DOCTYPE`);
|
|
708
512
|
}
|
|
709
|
-
|
|
710
|
-
|
|
711
|
-
attributeName: n,
|
|
712
|
-
attributeType: s,
|
|
713
|
-
defaultValue: r,
|
|
714
|
-
index: t
|
|
715
|
-
};
|
|
513
|
+
} else {
|
|
514
|
+
throw new Error(`Invalid Tag instead of DOCTYPE`);
|
|
716
515
|
}
|
|
516
|
+
return {
|
|
517
|
+
entities: n,
|
|
518
|
+
i: e
|
|
519
|
+
};
|
|
717
520
|
}
|
|
718
521
|
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
522
|
+
function S(t, e) {
|
|
523
|
+
let n = "";
|
|
524
|
+
for (;e < t.length && (t[e] !== "'" && t[e] !== '"'); e++) {
|
|
525
|
+
n += t[e];
|
|
722
526
|
}
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
for (
|
|
728
|
-
|
|
527
|
+
n = n.trim();
|
|
528
|
+
if (n.indexOf(" ") !== -1) throw new Error("External entites are not supported");
|
|
529
|
+
const s = t[e++];
|
|
530
|
+
let i = "";
|
|
531
|
+
for (;e < t.length && t[e] !== s; e++) {
|
|
532
|
+
i += t[e];
|
|
729
533
|
}
|
|
730
|
-
return
|
|
534
|
+
return [ n, i, e ];
|
|
731
535
|
}
|
|
732
536
|
|
|
733
|
-
function
|
|
734
|
-
if (
|
|
537
|
+
function F(t, e) {
|
|
538
|
+
if (t[e + 1] === "!" && t[e + 2] === "-" && t[e + 3] === "-") return true;
|
|
539
|
+
return false;
|
|
735
540
|
}
|
|
736
541
|
|
|
737
|
-
|
|
542
|
+
function D(t, e) {
|
|
543
|
+
if (t[e + 1] === "!" && t[e + 2] === "E" && t[e + 3] === "N" && t[e + 4] === "T" && t[e + 5] === "I" && t[e + 6] === "T" && t[e + 7] === "Y") return true;
|
|
544
|
+
return false;
|
|
545
|
+
}
|
|
738
546
|
|
|
739
|
-
|
|
547
|
+
function V(t, e) {
|
|
548
|
+
if (t[e + 1] === "!" && t[e + 2] === "E" && t[e + 3] === "L" && t[e + 4] === "E" && t[e + 5] === "M" && t[e + 6] === "E" && t[e + 7] === "N" && t[e + 8] === "T") return true;
|
|
549
|
+
return false;
|
|
550
|
+
}
|
|
551
|
+
|
|
552
|
+
function k(t, e) {
|
|
553
|
+
if (t[e + 1] === "!" && t[e + 2] === "A" && t[e + 3] === "T" && t[e + 4] === "T" && t[e + 5] === "L" && t[e + 6] === "I" && t[e + 7] === "S" && t[e + 8] === "T") return true;
|
|
554
|
+
return false;
|
|
555
|
+
}
|
|
556
|
+
|
|
557
|
+
function $(t, e) {
|
|
558
|
+
if (t[e + 1] === "!" && t[e + 2] === "N" && t[e + 3] === "O" && t[e + 4] === "T" && t[e + 5] === "A" && t[e + 6] === "T" && t[e + 7] === "I" && t[e + 8] === "O" && t[e + 9] === "N") return true;
|
|
559
|
+
return false;
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
function _(t) {
|
|
563
|
+
if (I.isName(t)) return t; else throw new Error(`Invalid entity name ${t}`);
|
|
564
|
+
}
|
|
740
565
|
|
|
741
|
-
|
|
566
|
+
var L = j;
|
|
567
|
+
|
|
568
|
+
const M = t.getDefaultExportFromCjs(L);
|
|
569
|
+
|
|
570
|
+
const X = /^[-+]?0x[a-fA-F0-9]+$/;
|
|
571
|
+
|
|
572
|
+
const B = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/;
|
|
573
|
+
|
|
574
|
+
const G = {
|
|
742
575
|
hex: true,
|
|
743
576
|
leadingZeros: true,
|
|
744
577
|
decimalPoint: ".",
|
|
745
578
|
eNotation: true
|
|
746
579
|
};
|
|
747
580
|
|
|
748
|
-
function
|
|
749
|
-
|
|
750
|
-
if (!
|
|
751
|
-
let
|
|
752
|
-
if (
|
|
753
|
-
return
|
|
754
|
-
} else if (
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
const s = n[1] || "";
|
|
760
|
-
const r = n[2];
|
|
761
|
-
let o = L(n[3]);
|
|
762
|
-
const a = s ? e[r.length + 1] === "." : e[r.length] === ".";
|
|
763
|
-
if (!t.leadingZeros && (r.length > 1 || r.length === 1 && !a)) {
|
|
764
|
-
return e;
|
|
581
|
+
function R(t, e = {}) {
|
|
582
|
+
e = Object.assign({}, G, e);
|
|
583
|
+
if (!t || typeof t !== "string") return t;
|
|
584
|
+
let n = t.trim();
|
|
585
|
+
if (e.skipLike !== undefined && e.skipLike.test(n)) return t; else if (t === "0") return 0; else if (e.hex && X.test(n)) {
|
|
586
|
+
return Z(n, 16);
|
|
587
|
+
} else if (n.search(/[eE]/) !== -1) {
|
|
588
|
+
const s = n.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
|
|
589
|
+
if (s) {
|
|
590
|
+
if (e.leadingZeros) {
|
|
591
|
+
n = (s[1] || "") + s[3];
|
|
765
592
|
} else {
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
593
|
+
if (s[2] === "0" && s[3][0] === ".") {} else {
|
|
594
|
+
return t;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return e.eNotation ? Number(n) : t;
|
|
598
|
+
} else {
|
|
599
|
+
return t;
|
|
600
|
+
}
|
|
601
|
+
} else {
|
|
602
|
+
const s = B.exec(n);
|
|
603
|
+
if (s) {
|
|
604
|
+
const i = s[1];
|
|
605
|
+
const r = s[2];
|
|
606
|
+
let o = U(s[3]);
|
|
607
|
+
if (!e.leadingZeros && r.length > 0 && i && n[2] !== ".") return t; else if (!e.leadingZeros && r.length > 0 && !i && n[1] !== ".") return t; else if (e.leadingZeros && r === t) return 0; else {
|
|
608
|
+
const s = Number(n);
|
|
609
|
+
const a = "" + s;
|
|
769
610
|
if (a.search(/[eE]/) !== -1) {
|
|
770
|
-
if (
|
|
771
|
-
} else if (
|
|
772
|
-
if (a === "0") return
|
|
611
|
+
if (e.eNotation) return s; else return t;
|
|
612
|
+
} else if (n.indexOf(".") !== -1) {
|
|
613
|
+
if (a === "0" && o === "") return s; else if (a === o) return s; else if (i && a === "-" + o) return s; else return t;
|
|
773
614
|
}
|
|
774
|
-
let l = r ? o : i;
|
|
775
615
|
if (r) {
|
|
776
|
-
return
|
|
616
|
+
return o === a || i + o === a ? s : t;
|
|
777
617
|
} else {
|
|
778
|
-
return
|
|
618
|
+
return n === a || n === i + a ? s : t;
|
|
779
619
|
}
|
|
780
620
|
}
|
|
781
621
|
} else {
|
|
782
|
-
return
|
|
622
|
+
return t;
|
|
783
623
|
}
|
|
784
624
|
}
|
|
785
625
|
}
|
|
786
626
|
|
|
787
|
-
|
|
788
|
-
|
|
789
|
-
|
|
790
|
-
|
|
791
|
-
|
|
792
|
-
if (n) {
|
|
793
|
-
let s = n[1] || "";
|
|
794
|
-
const r = n[3].indexOf("e") === -1 ? "E" : "e";
|
|
795
|
-
const o = n[2];
|
|
796
|
-
const a = s ? e[o.length + 1] === r : e[o.length] === r;
|
|
797
|
-
if (o.length > 1 && a) return e; else if (o.length === 1 && (n[3].startsWith(`.${r}`) || n[3][0] === r)) {
|
|
798
|
-
return Number(t);
|
|
799
|
-
} else if (i.leadingZeros && !a) {
|
|
800
|
-
t = (n[1] || "") + n[3];
|
|
801
|
-
return Number(t);
|
|
802
|
-
} else return e;
|
|
803
|
-
} else {
|
|
804
|
-
return e;
|
|
627
|
+
function U(t) {
|
|
628
|
+
if (t && t.indexOf(".") !== -1) {
|
|
629
|
+
t = t.replace(/0+$/, "");
|
|
630
|
+
if (t === ".") t = "0"; else if (t[0] === ".") t = "0" + t; else if (t[t.length - 1] === ".") t = t.substr(0, t.length - 1);
|
|
631
|
+
return t;
|
|
805
632
|
}
|
|
633
|
+
return t;
|
|
806
634
|
}
|
|
807
635
|
|
|
808
|
-
function
|
|
809
|
-
if (e &&
|
|
810
|
-
e = e.replace(/0+$/, "");
|
|
811
|
-
if (e === ".") e = "0"; else if (e[0] === ".") e = "0" + e; else if (e[e.length - 1] === ".") e = e.substring(0, e.length - 1);
|
|
812
|
-
return e;
|
|
813
|
-
}
|
|
814
|
-
return e;
|
|
636
|
+
function Z(t, e) {
|
|
637
|
+
if (parseInt) return parseInt(t, e); else if (Number.parseInt) return Number.parseInt(t, e); else if (window && window.parseInt) return window.parseInt(t, e); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
815
638
|
}
|
|
816
639
|
|
|
817
|
-
|
|
818
|
-
if (parseInt) return parseInt(e, t); else if (Number.parseInt) return Number.parseInt(e, t); else if (window && window.parseInt) return window.parseInt(e, t); else throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
819
|
-
}
|
|
640
|
+
var Y = R;
|
|
820
641
|
|
|
821
|
-
|
|
822
|
-
|
|
823
|
-
|
|
642
|
+
const q = t.getDefaultExportFromCjs(Y);
|
|
643
|
+
|
|
644
|
+
function W(t) {
|
|
645
|
+
if (typeof t === "function") {
|
|
646
|
+
return t;
|
|
824
647
|
}
|
|
825
|
-
if (Array.isArray(
|
|
826
|
-
return
|
|
827
|
-
for (const
|
|
828
|
-
if (typeof
|
|
648
|
+
if (Array.isArray(t)) {
|
|
649
|
+
return e => {
|
|
650
|
+
for (const n of t) {
|
|
651
|
+
if (typeof n === "string" && e === n) {
|
|
829
652
|
return true;
|
|
830
653
|
}
|
|
831
|
-
if (
|
|
654
|
+
if (n instanceof RegExp && n.test(e)) {
|
|
832
655
|
return true;
|
|
833
656
|
}
|
|
834
657
|
}
|
|
@@ -837,11 +660,25 @@ function X(e) {
|
|
|
837
660
|
return () => false;
|
|
838
661
|
}
|
|
839
662
|
|
|
663
|
+
var z = W;
|
|
664
|
+
|
|
665
|
+
const J = t.getDefaultExportFromCjs(z);
|
|
666
|
+
|
|
840
667
|
"use strict";
|
|
841
668
|
|
|
842
|
-
|
|
843
|
-
|
|
844
|
-
|
|
669
|
+
const H = n;
|
|
670
|
+
|
|
671
|
+
const K = A;
|
|
672
|
+
|
|
673
|
+
const Q = L;
|
|
674
|
+
|
|
675
|
+
const tt = Y;
|
|
676
|
+
|
|
677
|
+
const et = z;
|
|
678
|
+
|
|
679
|
+
let nt = class OrderedObjParser {
|
|
680
|
+
constructor(t) {
|
|
681
|
+
this.options = t;
|
|
845
682
|
this.currentNode = null;
|
|
846
683
|
this.tagsNodeStack = [];
|
|
847
684
|
this.docTypeEntities = {};
|
|
@@ -902,279 +739,264 @@ class OrderedObjParser {
|
|
|
902
739
|
},
|
|
903
740
|
num_dec: {
|
|
904
741
|
regex: /&#([0-9]{1,7});/g,
|
|
905
|
-
val: (
|
|
742
|
+
val: (t, e) => String.fromCharCode(Number.parseInt(e, 10))
|
|
906
743
|
},
|
|
907
744
|
num_hex: {
|
|
908
745
|
regex: /&#x([0-9a-fA-F]{1,6});/g,
|
|
909
|
-
val: (
|
|
746
|
+
val: (t, e) => String.fromCharCode(Number.parseInt(e, 16))
|
|
910
747
|
}
|
|
911
748
|
};
|
|
912
|
-
this.addExternalEntities =
|
|
913
|
-
this.parseXml =
|
|
914
|
-
this.parseTextData =
|
|
915
|
-
this.resolveNameSpace =
|
|
916
|
-
this.buildAttributesMap =
|
|
917
|
-
this.isItStopNode =
|
|
918
|
-
this.replaceEntitiesValue =
|
|
919
|
-
this.readStopNodeData =
|
|
920
|
-
this.saveTextToParentTag =
|
|
921
|
-
this.addChild =
|
|
922
|
-
this.ignoreAttributesFn =
|
|
923
|
-
if (this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
924
|
-
this.stopNodesExact = new Set;
|
|
925
|
-
this.stopNodesWildcard = new Set;
|
|
926
|
-
for (let e = 0; e < this.options.stopNodes.length; e++) {
|
|
927
|
-
const t = this.options.stopNodes[e];
|
|
928
|
-
if (typeof t !== "string") continue;
|
|
929
|
-
if (t.startsWith("*.")) {
|
|
930
|
-
this.stopNodesWildcard.add(t.substring(2));
|
|
931
|
-
} else {
|
|
932
|
-
this.stopNodesExact.add(t);
|
|
933
|
-
}
|
|
934
|
-
}
|
|
935
|
-
}
|
|
749
|
+
this.addExternalEntities = st;
|
|
750
|
+
this.parseXml = lt;
|
|
751
|
+
this.parseTextData = it;
|
|
752
|
+
this.resolveNameSpace = rt;
|
|
753
|
+
this.buildAttributesMap = at;
|
|
754
|
+
this.isItStopNode = ht;
|
|
755
|
+
this.replaceEntitiesValue = ft;
|
|
756
|
+
this.readStopNodeData = mt;
|
|
757
|
+
this.saveTextToParentTag = ct;
|
|
758
|
+
this.addChild = ut;
|
|
759
|
+
this.ignoreAttributesFn = et(this.options.ignoreAttributes);
|
|
936
760
|
}
|
|
937
|
-
}
|
|
761
|
+
};
|
|
938
762
|
|
|
939
|
-
function
|
|
940
|
-
const
|
|
941
|
-
for (let
|
|
942
|
-
const
|
|
943
|
-
this.lastEntities[
|
|
944
|
-
regex: new RegExp("&" +
|
|
945
|
-
val:
|
|
763
|
+
function st(t) {
|
|
764
|
+
const e = Object.keys(t);
|
|
765
|
+
for (let n = 0; n < e.length; n++) {
|
|
766
|
+
const s = e[n];
|
|
767
|
+
this.lastEntities[s] = {
|
|
768
|
+
regex: new RegExp("&" + s + ";", "g"),
|
|
769
|
+
val: t[s]
|
|
946
770
|
};
|
|
947
771
|
}
|
|
948
772
|
}
|
|
949
773
|
|
|
950
|
-
function
|
|
951
|
-
if (
|
|
952
|
-
if (this.options.trimValues && !
|
|
953
|
-
|
|
954
|
-
}
|
|
955
|
-
if (
|
|
956
|
-
if (!o)
|
|
957
|
-
const
|
|
958
|
-
if (
|
|
959
|
-
return
|
|
960
|
-
} else if (typeof
|
|
961
|
-
return
|
|
774
|
+
function it(t, e, n, s, i, r, o) {
|
|
775
|
+
if (t !== undefined) {
|
|
776
|
+
if (this.options.trimValues && !s) {
|
|
777
|
+
t = t.trim();
|
|
778
|
+
}
|
|
779
|
+
if (t.length > 0) {
|
|
780
|
+
if (!o) t = this.replaceEntitiesValue(t);
|
|
781
|
+
const s = this.options.tagValueProcessor(e, t, n, i, r);
|
|
782
|
+
if (s === null || s === undefined) {
|
|
783
|
+
return t;
|
|
784
|
+
} else if (typeof s !== typeof t || s !== t) {
|
|
785
|
+
return s;
|
|
962
786
|
} else if (this.options.trimValues) {
|
|
963
|
-
return
|
|
787
|
+
return xt(t, this.options.parseTagValue, this.options.numberParseOptions);
|
|
964
788
|
} else {
|
|
965
|
-
const
|
|
966
|
-
if (
|
|
967
|
-
return
|
|
789
|
+
const e = t.trim();
|
|
790
|
+
if (e === t) {
|
|
791
|
+
return xt(t, this.options.parseTagValue, this.options.numberParseOptions);
|
|
968
792
|
} else {
|
|
969
|
-
return
|
|
793
|
+
return t;
|
|
970
794
|
}
|
|
971
795
|
}
|
|
972
796
|
}
|
|
973
797
|
}
|
|
974
798
|
}
|
|
975
799
|
|
|
976
|
-
function
|
|
800
|
+
function rt(t) {
|
|
977
801
|
if (this.options.removeNSPrefix) {
|
|
978
|
-
const
|
|
979
|
-
const
|
|
980
|
-
if (
|
|
802
|
+
const e = t.split(":");
|
|
803
|
+
const n = t.charAt(0) === "/" ? "/" : "";
|
|
804
|
+
if (e[0] === "xmlns") {
|
|
981
805
|
return "";
|
|
982
806
|
}
|
|
983
|
-
if (
|
|
984
|
-
|
|
807
|
+
if (e.length === 2) {
|
|
808
|
+
t = n + e[1];
|
|
985
809
|
}
|
|
986
810
|
}
|
|
987
|
-
return
|
|
811
|
+
return t;
|
|
988
812
|
}
|
|
989
813
|
|
|
990
|
-
const
|
|
814
|
+
const ot = new RegExp("([^\\s=]+)\\s*(=\\s*(['\"])([\\s\\S]*?)\\3)?", "gm");
|
|
991
815
|
|
|
992
|
-
function
|
|
993
|
-
if (this.options.ignoreAttributes !== true && typeof
|
|
994
|
-
const
|
|
995
|
-
const
|
|
996
|
-
const
|
|
997
|
-
for (let
|
|
998
|
-
const
|
|
999
|
-
if (this.ignoreAttributesFn(
|
|
816
|
+
function at(t, e, n) {
|
|
817
|
+
if (this.options.ignoreAttributes !== true && typeof t === "string") {
|
|
818
|
+
const n = H.getAllMatches(t, ot);
|
|
819
|
+
const s = n.length;
|
|
820
|
+
const i = {};
|
|
821
|
+
for (let t = 0; t < s; t++) {
|
|
822
|
+
const s = this.resolveNameSpace(n[t][1]);
|
|
823
|
+
if (this.ignoreAttributesFn(s, e)) {
|
|
1000
824
|
continue;
|
|
1001
825
|
}
|
|
1002
|
-
let
|
|
1003
|
-
let o = this.options.attributeNamePrefix +
|
|
1004
|
-
if (
|
|
826
|
+
let r = n[t][4];
|
|
827
|
+
let o = this.options.attributeNamePrefix + s;
|
|
828
|
+
if (s.length) {
|
|
1005
829
|
if (this.options.transformAttributeName) {
|
|
1006
830
|
o = this.options.transformAttributeName(o);
|
|
1007
831
|
}
|
|
1008
832
|
if (o === "__proto__") o = "#__proto__";
|
|
1009
|
-
if (
|
|
833
|
+
if (r !== undefined) {
|
|
1010
834
|
if (this.options.trimValues) {
|
|
1011
|
-
|
|
835
|
+
r = r.trim();
|
|
1012
836
|
}
|
|
1013
|
-
|
|
1014
|
-
const
|
|
1015
|
-
if (
|
|
1016
|
-
|
|
1017
|
-
} else if (typeof
|
|
1018
|
-
|
|
837
|
+
r = this.replaceEntitiesValue(r);
|
|
838
|
+
const t = this.options.attributeValueProcessor(s, r, e);
|
|
839
|
+
if (t === null || t === undefined) {
|
|
840
|
+
i[o] = r;
|
|
841
|
+
} else if (typeof t !== typeof r || t !== r) {
|
|
842
|
+
i[o] = t;
|
|
1019
843
|
} else {
|
|
1020
|
-
|
|
844
|
+
i[o] = xt(r, this.options.parseAttributeValue, this.options.numberParseOptions);
|
|
1021
845
|
}
|
|
1022
846
|
} else if (this.options.allowBooleanAttributes) {
|
|
1023
|
-
|
|
847
|
+
i[o] = true;
|
|
1024
848
|
}
|
|
1025
849
|
}
|
|
1026
850
|
}
|
|
1027
|
-
if (!Object.keys(
|
|
851
|
+
if (!Object.keys(i).length) {
|
|
1028
852
|
return;
|
|
1029
853
|
}
|
|
1030
854
|
if (this.options.attributesGroupName) {
|
|
1031
|
-
const
|
|
1032
|
-
|
|
1033
|
-
return
|
|
855
|
+
const t = {};
|
|
856
|
+
t[this.options.attributesGroupName] = i;
|
|
857
|
+
return t;
|
|
1034
858
|
}
|
|
1035
|
-
return
|
|
859
|
+
return i;
|
|
1036
860
|
}
|
|
1037
861
|
}
|
|
1038
862
|
|
|
1039
|
-
const
|
|
1040
|
-
|
|
1041
|
-
const
|
|
1042
|
-
let
|
|
1043
|
-
let n = "";
|
|
863
|
+
const lt = function(t) {
|
|
864
|
+
t = t.replace(/\r\n?/g, "\n");
|
|
865
|
+
const e = new K("!xml");
|
|
866
|
+
let n = e;
|
|
1044
867
|
let s = "";
|
|
1045
|
-
|
|
1046
|
-
for (let
|
|
1047
|
-
const
|
|
1048
|
-
if (
|
|
1049
|
-
if (
|
|
1050
|
-
const
|
|
1051
|
-
let
|
|
868
|
+
let i = "";
|
|
869
|
+
for (let r = 0; r < t.length; r++) {
|
|
870
|
+
const o = t[r];
|
|
871
|
+
if (o === "<") {
|
|
872
|
+
if (t[r + 1] === "/") {
|
|
873
|
+
const e = pt(t, ">", r, "Closing Tag is not closed.");
|
|
874
|
+
let o = t.substring(r + 2, e).trim();
|
|
1052
875
|
if (this.options.removeNSPrefix) {
|
|
1053
|
-
const
|
|
1054
|
-
if (
|
|
1055
|
-
|
|
876
|
+
const t = o.indexOf(":");
|
|
877
|
+
if (t !== -1) {
|
|
878
|
+
o = o.substr(t + 1);
|
|
1056
879
|
}
|
|
1057
880
|
}
|
|
1058
881
|
if (this.options.transformTagName) {
|
|
1059
|
-
|
|
882
|
+
o = this.options.transformTagName(o);
|
|
1060
883
|
}
|
|
1061
|
-
if (
|
|
1062
|
-
|
|
884
|
+
if (n) {
|
|
885
|
+
s = this.saveTextToParentTag(s, n, i);
|
|
1063
886
|
}
|
|
1064
|
-
const a =
|
|
1065
|
-
if (
|
|
1066
|
-
throw new Error(`Unpaired tag can not be used as closing tag: </${
|
|
887
|
+
const a = i.substring(i.lastIndexOf(".") + 1);
|
|
888
|
+
if (o && this.options.unpairedTags.indexOf(o) !== -1) {
|
|
889
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);
|
|
1067
890
|
}
|
|
1068
891
|
let l = 0;
|
|
1069
892
|
if (a && this.options.unpairedTags.indexOf(a) !== -1) {
|
|
1070
|
-
l =
|
|
893
|
+
l = i.lastIndexOf(".", i.lastIndexOf(".") - 1);
|
|
1071
894
|
this.tagsNodeStack.pop();
|
|
1072
895
|
} else {
|
|
1073
|
-
l =
|
|
896
|
+
l = i.lastIndexOf(".");
|
|
1074
897
|
}
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
} else if (
|
|
1080
|
-
let
|
|
1081
|
-
if (!
|
|
1082
|
-
|
|
1083
|
-
if (this.options.ignoreDeclaration &&
|
|
1084
|
-
const
|
|
1085
|
-
|
|
1086
|
-
if (
|
|
1087
|
-
|
|
898
|
+
i = i.substring(0, l);
|
|
899
|
+
n = this.tagsNodeStack.pop();
|
|
900
|
+
s = "";
|
|
901
|
+
r = e;
|
|
902
|
+
} else if (t[r + 1] === "?") {
|
|
903
|
+
let e = gt(t, r, false, "?>");
|
|
904
|
+
if (!e) throw new Error("Pi Tag is not closed.");
|
|
905
|
+
s = this.saveTextToParentTag(s, n, i);
|
|
906
|
+
if (this.options.ignoreDeclaration && e.tagName === "?xml" || this.options.ignorePiTags) {} else {
|
|
907
|
+
const t = new K(e.tagName);
|
|
908
|
+
t.add(this.options.textNodeName, "");
|
|
909
|
+
if (e.tagName !== e.tagExp && e.attrExpPresent) {
|
|
910
|
+
t[":@"] = this.buildAttributesMap(e.tagExp, i, e.tagName);
|
|
1088
911
|
}
|
|
1089
|
-
this.addChild(
|
|
912
|
+
this.addChild(n, t, i);
|
|
1090
913
|
}
|
|
1091
|
-
|
|
1092
|
-
} else if (
|
|
1093
|
-
const
|
|
914
|
+
r = e.closeIndex + 1;
|
|
915
|
+
} else if (t.substr(r + 1, 3) === "!--") {
|
|
916
|
+
const e = pt(t, "--\x3e", r + 4, "Comment is not closed.");
|
|
1094
917
|
if (this.options.commentPropName) {
|
|
1095
|
-
const
|
|
1096
|
-
|
|
1097
|
-
|
|
1098
|
-
[this.options.textNodeName]:
|
|
918
|
+
const o = t.substring(r + 4, e - 2);
|
|
919
|
+
s = this.saveTextToParentTag(s, n, i);
|
|
920
|
+
n.add(this.options.commentPropName, [ {
|
|
921
|
+
[this.options.textNodeName]: o
|
|
1099
922
|
} ]);
|
|
1100
923
|
}
|
|
1101
|
-
|
|
1102
|
-
} else if (
|
|
1103
|
-
const
|
|
1104
|
-
this.docTypeEntities =
|
|
1105
|
-
|
|
1106
|
-
} else if (
|
|
1107
|
-
const
|
|
1108
|
-
const
|
|
1109
|
-
|
|
1110
|
-
let a = this.parseTextData(
|
|
924
|
+
r = e;
|
|
925
|
+
} else if (t.substr(r + 1, 2) === "!D") {
|
|
926
|
+
const e = Q(t, r);
|
|
927
|
+
this.docTypeEntities = e.entities;
|
|
928
|
+
r = e.i;
|
|
929
|
+
} else if (t.substr(r + 1, 2) === "![") {
|
|
930
|
+
const e = pt(t, "]]>", r, "CDATA is not closed.") - 2;
|
|
931
|
+
const o = t.substring(r + 9, e);
|
|
932
|
+
s = this.saveTextToParentTag(s, n, i);
|
|
933
|
+
let a = this.parseTextData(o, n.tagname, i, true, false, true, true);
|
|
1111
934
|
if (a == undefined) a = "";
|
|
1112
935
|
if (this.options.cdataPropName) {
|
|
1113
|
-
|
|
1114
|
-
[this.options.textNodeName]:
|
|
936
|
+
n.add(this.options.cdataPropName, [ {
|
|
937
|
+
[this.options.textNodeName]: o
|
|
1115
938
|
} ]);
|
|
1116
939
|
} else {
|
|
1117
|
-
|
|
940
|
+
n.add(this.options.textNodeName, a);
|
|
1118
941
|
}
|
|
1119
|
-
|
|
942
|
+
r = e + 2;
|
|
1120
943
|
} else {
|
|
1121
|
-
let
|
|
1122
|
-
let a =
|
|
1123
|
-
const l =
|
|
1124
|
-
let u =
|
|
1125
|
-
let f =
|
|
1126
|
-
let
|
|
944
|
+
let o = gt(t, r, this.options.removeNSPrefix);
|
|
945
|
+
let a = o.tagName;
|
|
946
|
+
const l = o.rawTagName;
|
|
947
|
+
let u = o.tagExp;
|
|
948
|
+
let f = o.attrExpPresent;
|
|
949
|
+
let c = o.closeIndex;
|
|
1127
950
|
if (this.options.transformTagName) {
|
|
1128
951
|
a = this.options.transformTagName(a);
|
|
1129
952
|
}
|
|
1130
|
-
if (
|
|
1131
|
-
if (
|
|
1132
|
-
|
|
953
|
+
if (n && s) {
|
|
954
|
+
if (n.tagname !== "!xml") {
|
|
955
|
+
s = this.saveTextToParentTag(s, n, i, false);
|
|
1133
956
|
}
|
|
1134
957
|
}
|
|
1135
|
-
const h =
|
|
958
|
+
const h = n;
|
|
1136
959
|
if (h && this.options.unpairedTags.indexOf(h.tagname) !== -1) {
|
|
1137
|
-
|
|
1138
|
-
|
|
960
|
+
n = this.tagsNodeStack.pop();
|
|
961
|
+
i = i.substring(0, i.lastIndexOf("."));
|
|
1139
962
|
}
|
|
1140
|
-
if (a !==
|
|
1141
|
-
|
|
963
|
+
if (a !== e.tagname) {
|
|
964
|
+
i += i ? "." + a : a;
|
|
1142
965
|
}
|
|
1143
|
-
|
|
1144
|
-
|
|
1145
|
-
let t = "";
|
|
966
|
+
if (this.isItStopNode(this.options.stopNodes, i, a)) {
|
|
967
|
+
let e = "";
|
|
1146
968
|
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
1147
969
|
if (a[a.length - 1] === "/") {
|
|
1148
970
|
a = a.substr(0, a.length - 1);
|
|
1149
|
-
|
|
971
|
+
i = i.substr(0, i.length - 1);
|
|
1150
972
|
u = a;
|
|
1151
973
|
} else {
|
|
1152
974
|
u = u.substr(0, u.length - 1);
|
|
1153
975
|
}
|
|
1154
|
-
|
|
976
|
+
r = o.closeIndex;
|
|
1155
977
|
} else if (this.options.unpairedTags.indexOf(a) !== -1) {
|
|
1156
|
-
|
|
978
|
+
r = o.closeIndex;
|
|
1157
979
|
} else {
|
|
1158
|
-
const
|
|
1159
|
-
if (!
|
|
1160
|
-
|
|
1161
|
-
|
|
980
|
+
const n = this.readStopNodeData(t, l, c + 1);
|
|
981
|
+
if (!n) throw new Error(`Unexpected end of ${l}`);
|
|
982
|
+
r = n.i;
|
|
983
|
+
e = n.tagContent;
|
|
1162
984
|
}
|
|
1163
|
-
const
|
|
985
|
+
const s = new K(a);
|
|
1164
986
|
if (a !== u && f) {
|
|
1165
|
-
|
|
987
|
+
s[":@"] = this.buildAttributesMap(u, i, a);
|
|
1166
988
|
}
|
|
1167
|
-
if (
|
|
1168
|
-
|
|
989
|
+
if (e) {
|
|
990
|
+
e = this.parseTextData(e, a, i, true, f, true, true);
|
|
1169
991
|
}
|
|
1170
|
-
|
|
1171
|
-
|
|
1172
|
-
this.addChild(
|
|
992
|
+
i = i.substr(0, i.lastIndexOf("."));
|
|
993
|
+
s.add(this.options.textNodeName, e);
|
|
994
|
+
this.addChild(n, s, i);
|
|
1173
995
|
} else {
|
|
1174
996
|
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
1175
997
|
if (a[a.length - 1] === "/") {
|
|
1176
998
|
a = a.substr(0, a.length - 1);
|
|
1177
|
-
|
|
999
|
+
i = i.substr(0, i.length - 1);
|
|
1178
1000
|
u = a;
|
|
1179
1001
|
} else {
|
|
1180
1002
|
u = u.substr(0, u.length - 1);
|
|
@@ -1182,124 +1004,126 @@ const q = function(e) {
|
|
|
1182
1004
|
if (this.options.transformTagName) {
|
|
1183
1005
|
a = this.options.transformTagName(a);
|
|
1184
1006
|
}
|
|
1185
|
-
const
|
|
1007
|
+
const t = new K(a);
|
|
1186
1008
|
if (a !== u && f) {
|
|
1187
|
-
|
|
1009
|
+
t[":@"] = this.buildAttributesMap(u, i, a);
|
|
1188
1010
|
}
|
|
1189
|
-
this.addChild(
|
|
1190
|
-
|
|
1011
|
+
this.addChild(n, t, i);
|
|
1012
|
+
i = i.substr(0, i.lastIndexOf("."));
|
|
1191
1013
|
} else {
|
|
1192
|
-
const
|
|
1193
|
-
this.tagsNodeStack.push(
|
|
1014
|
+
const t = new K(a);
|
|
1015
|
+
this.tagsNodeStack.push(n);
|
|
1194
1016
|
if (a !== u && f) {
|
|
1195
|
-
|
|
1017
|
+
t[":@"] = this.buildAttributesMap(u, i, a);
|
|
1196
1018
|
}
|
|
1197
|
-
this.addChild(
|
|
1198
|
-
|
|
1019
|
+
this.addChild(n, t, i);
|
|
1020
|
+
n = t;
|
|
1199
1021
|
}
|
|
1200
|
-
|
|
1201
|
-
|
|
1022
|
+
s = "";
|
|
1023
|
+
r = c;
|
|
1202
1024
|
}
|
|
1203
1025
|
}
|
|
1204
1026
|
} else {
|
|
1205
|
-
|
|
1027
|
+
s += t[r];
|
|
1206
1028
|
}
|
|
1207
1029
|
}
|
|
1208
|
-
return
|
|
1030
|
+
return e.child;
|
|
1209
1031
|
};
|
|
1210
1032
|
|
|
1211
|
-
function
|
|
1212
|
-
|
|
1213
|
-
const s = this.options.updateTag(t.tagname, i, t[":@"]);
|
|
1033
|
+
function ut(t, e, n) {
|
|
1034
|
+
const s = this.options.updateTag(e.tagname, n, e[":@"]);
|
|
1214
1035
|
if (s === false) {} else if (typeof s === "string") {
|
|
1215
|
-
|
|
1216
|
-
|
|
1036
|
+
e.tagname = s;
|
|
1037
|
+
t.addChild(e);
|
|
1217
1038
|
} else {
|
|
1218
|
-
|
|
1039
|
+
t.addChild(e);
|
|
1219
1040
|
}
|
|
1220
1041
|
}
|
|
1221
1042
|
|
|
1222
|
-
const
|
|
1043
|
+
const ft = function(t) {
|
|
1223
1044
|
if (this.options.processEntities) {
|
|
1224
|
-
for (let
|
|
1225
|
-
const
|
|
1226
|
-
|
|
1045
|
+
for (let e in this.docTypeEntities) {
|
|
1046
|
+
const n = this.docTypeEntities[e];
|
|
1047
|
+
t = t.replace(n.regx, n.val);
|
|
1227
1048
|
}
|
|
1228
|
-
for (let
|
|
1229
|
-
const
|
|
1230
|
-
|
|
1049
|
+
for (let e in this.lastEntities) {
|
|
1050
|
+
const n = this.lastEntities[e];
|
|
1051
|
+
t = t.replace(n.regex, n.val);
|
|
1231
1052
|
}
|
|
1232
1053
|
if (this.options.htmlEntities) {
|
|
1233
|
-
for (let
|
|
1234
|
-
const
|
|
1235
|
-
|
|
1054
|
+
for (let e in this.htmlEntities) {
|
|
1055
|
+
const n = this.htmlEntities[e];
|
|
1056
|
+
t = t.replace(n.regex, n.val);
|
|
1236
1057
|
}
|
|
1237
1058
|
}
|
|
1238
|
-
|
|
1059
|
+
t = t.replace(this.ampEntity.regex, this.ampEntity.val);
|
|
1239
1060
|
}
|
|
1240
|
-
return
|
|
1061
|
+
return t;
|
|
1241
1062
|
};
|
|
1242
1063
|
|
|
1243
|
-
function
|
|
1244
|
-
if (
|
|
1245
|
-
if (
|
|
1246
|
-
|
|
1247
|
-
if (
|
|
1248
|
-
|
|
1064
|
+
function ct(t, e, n, s) {
|
|
1065
|
+
if (t) {
|
|
1066
|
+
if (s === undefined) s = e.child.length === 0;
|
|
1067
|
+
t = this.parseTextData(t, e.tagname, n, false, e[":@"] ? Object.keys(e[":@"]).length !== 0 : false, s);
|
|
1068
|
+
if (t !== undefined && t !== "") e.add(this.options.textNodeName, t);
|
|
1069
|
+
t = "";
|
|
1249
1070
|
}
|
|
1250
|
-
return
|
|
1071
|
+
return t;
|
|
1251
1072
|
}
|
|
1252
1073
|
|
|
1253
|
-
function
|
|
1254
|
-
|
|
1255
|
-
|
|
1074
|
+
function ht(t, e, n) {
|
|
1075
|
+
const s = "*." + n;
|
|
1076
|
+
for (const n in t) {
|
|
1077
|
+
const i = t[n];
|
|
1078
|
+
if (s === i || e === i) return true;
|
|
1079
|
+
}
|
|
1256
1080
|
return false;
|
|
1257
1081
|
}
|
|
1258
1082
|
|
|
1259
|
-
function
|
|
1260
|
-
let
|
|
1261
|
-
let
|
|
1262
|
-
for (let r =
|
|
1263
|
-
let
|
|
1264
|
-
if (
|
|
1265
|
-
if (
|
|
1266
|
-
} else if (
|
|
1267
|
-
|
|
1268
|
-
} else if (
|
|
1269
|
-
if (
|
|
1270
|
-
if (
|
|
1083
|
+
function dt(t, e, n = ">") {
|
|
1084
|
+
let s;
|
|
1085
|
+
let i = "";
|
|
1086
|
+
for (let r = e; r < t.length; r++) {
|
|
1087
|
+
let e = t[r];
|
|
1088
|
+
if (s) {
|
|
1089
|
+
if (e === s) s = "";
|
|
1090
|
+
} else if (e === '"' || e === "'") {
|
|
1091
|
+
s = e;
|
|
1092
|
+
} else if (e === n[0]) {
|
|
1093
|
+
if (n[1]) {
|
|
1094
|
+
if (t[r + 1] === n[1]) {
|
|
1271
1095
|
return {
|
|
1272
|
-
data:
|
|
1096
|
+
data: i,
|
|
1273
1097
|
index: r
|
|
1274
1098
|
};
|
|
1275
1099
|
}
|
|
1276
1100
|
} else {
|
|
1277
1101
|
return {
|
|
1278
|
-
data:
|
|
1102
|
+
data: i,
|
|
1279
1103
|
index: r
|
|
1280
1104
|
};
|
|
1281
1105
|
}
|
|
1282
|
-
} else if (
|
|
1283
|
-
|
|
1106
|
+
} else if (e === "\t") {
|
|
1107
|
+
e = " ";
|
|
1284
1108
|
}
|
|
1285
|
-
|
|
1109
|
+
i += e;
|
|
1286
1110
|
}
|
|
1287
1111
|
}
|
|
1288
1112
|
|
|
1289
|
-
function
|
|
1290
|
-
const
|
|
1291
|
-
if (
|
|
1292
|
-
throw new Error(
|
|
1113
|
+
function pt(t, e, n, s) {
|
|
1114
|
+
const i = t.indexOf(e, n);
|
|
1115
|
+
if (i === -1) {
|
|
1116
|
+
throw new Error(s);
|
|
1293
1117
|
} else {
|
|
1294
|
-
return
|
|
1118
|
+
return i + e.length - 1;
|
|
1295
1119
|
}
|
|
1296
1120
|
}
|
|
1297
1121
|
|
|
1298
|
-
function
|
|
1299
|
-
const
|
|
1300
|
-
if (!
|
|
1301
|
-
let r =
|
|
1302
|
-
const o =
|
|
1122
|
+
function gt(t, e, n, s = ">") {
|
|
1123
|
+
const i = dt(t, e + 1, s);
|
|
1124
|
+
if (!i) return;
|
|
1125
|
+
let r = i.data;
|
|
1126
|
+
const o = i.index;
|
|
1303
1127
|
const a = r.search(/\s/);
|
|
1304
1128
|
let l = r;
|
|
1305
1129
|
let u = true;
|
|
@@ -1308,11 +1132,11 @@ function ee(e, t, i, n = ">") {
|
|
|
1308
1132
|
r = r.substring(a + 1).trimStart();
|
|
1309
1133
|
}
|
|
1310
1134
|
const f = l;
|
|
1311
|
-
if (
|
|
1312
|
-
const
|
|
1313
|
-
if (
|
|
1314
|
-
l = l.substr(
|
|
1315
|
-
u = l !==
|
|
1135
|
+
if (n) {
|
|
1136
|
+
const t = l.indexOf(":");
|
|
1137
|
+
if (t !== -1) {
|
|
1138
|
+
l = l.substr(t + 1);
|
|
1139
|
+
u = l !== i.data.substr(t + 1);
|
|
1316
1140
|
}
|
|
1317
1141
|
}
|
|
1318
1142
|
return {
|
|
@@ -1324,313 +1148,333 @@ function ee(e, t, i, n = ">") {
|
|
|
1324
1148
|
};
|
|
1325
1149
|
}
|
|
1326
1150
|
|
|
1327
|
-
function
|
|
1328
|
-
const
|
|
1329
|
-
let
|
|
1330
|
-
for (;
|
|
1331
|
-
if (
|
|
1332
|
-
if (
|
|
1333
|
-
const r =
|
|
1334
|
-
let o =
|
|
1335
|
-
if (o ===
|
|
1336
|
-
|
|
1337
|
-
if (
|
|
1151
|
+
function mt(t, e, n) {
|
|
1152
|
+
const s = n;
|
|
1153
|
+
let i = 1;
|
|
1154
|
+
for (;n < t.length; n++) {
|
|
1155
|
+
if (t[n] === "<") {
|
|
1156
|
+
if (t[n + 1] === "/") {
|
|
1157
|
+
const r = pt(t, ">", n, `${e} is not closed`);
|
|
1158
|
+
let o = t.substring(n + 2, r).trim();
|
|
1159
|
+
if (o === e) {
|
|
1160
|
+
i--;
|
|
1161
|
+
if (i === 0) {
|
|
1338
1162
|
return {
|
|
1339
|
-
tagContent:
|
|
1163
|
+
tagContent: t.substring(s, n),
|
|
1340
1164
|
i: r
|
|
1341
1165
|
};
|
|
1342
1166
|
}
|
|
1343
1167
|
}
|
|
1344
|
-
|
|
1345
|
-
} else if (
|
|
1346
|
-
const
|
|
1347
|
-
|
|
1348
|
-
} else if (
|
|
1349
|
-
const
|
|
1350
|
-
|
|
1351
|
-
} else if (
|
|
1352
|
-
const
|
|
1353
|
-
|
|
1168
|
+
n = r;
|
|
1169
|
+
} else if (t[n + 1] === "?") {
|
|
1170
|
+
const e = pt(t, "?>", n + 1, "StopNode is not closed.");
|
|
1171
|
+
n = e;
|
|
1172
|
+
} else if (t.substr(n + 1, 3) === "!--") {
|
|
1173
|
+
const e = pt(t, "--\x3e", n + 3, "StopNode is not closed.");
|
|
1174
|
+
n = e;
|
|
1175
|
+
} else if (t.substr(n + 1, 2) === "![") {
|
|
1176
|
+
const e = pt(t, "]]>", n, "StopNode is not closed.") - 2;
|
|
1177
|
+
n = e;
|
|
1354
1178
|
} else {
|
|
1355
|
-
const
|
|
1356
|
-
if (
|
|
1357
|
-
const
|
|
1358
|
-
if (
|
|
1359
|
-
|
|
1179
|
+
const s = gt(t, n, ">");
|
|
1180
|
+
if (s) {
|
|
1181
|
+
const t = s && s.tagName;
|
|
1182
|
+
if (t === e && s.tagExp[s.tagExp.length - 1] !== "/") {
|
|
1183
|
+
i++;
|
|
1360
1184
|
}
|
|
1361
|
-
|
|
1185
|
+
n = s.closeIndex;
|
|
1362
1186
|
}
|
|
1363
1187
|
}
|
|
1364
1188
|
}
|
|
1365
1189
|
}
|
|
1366
1190
|
}
|
|
1367
1191
|
|
|
1368
|
-
function
|
|
1369
|
-
if (
|
|
1370
|
-
const
|
|
1371
|
-
if (
|
|
1192
|
+
function xt(t, e, n) {
|
|
1193
|
+
if (e && typeof t === "string") {
|
|
1194
|
+
const e = t.trim();
|
|
1195
|
+
if (e === "true") return true; else if (e === "false") return false; else return tt(t, n);
|
|
1372
1196
|
} else {
|
|
1373
|
-
if (
|
|
1374
|
-
return
|
|
1197
|
+
if (H.isExist(t)) {
|
|
1198
|
+
return t;
|
|
1375
1199
|
} else {
|
|
1376
1200
|
return "";
|
|
1377
1201
|
}
|
|
1378
1202
|
}
|
|
1379
1203
|
}
|
|
1380
1204
|
|
|
1381
|
-
|
|
1205
|
+
var Nt = nt;
|
|
1382
1206
|
|
|
1383
|
-
const
|
|
1207
|
+
const bt = t.getDefaultExportFromCjs(Nt);
|
|
1384
1208
|
|
|
1385
|
-
|
|
1386
|
-
|
|
1209
|
+
var Et = {};
|
|
1210
|
+
|
|
1211
|
+
"use strict";
|
|
1212
|
+
|
|
1213
|
+
function vt(t, e) {
|
|
1214
|
+
return yt(t, e);
|
|
1387
1215
|
}
|
|
1388
1216
|
|
|
1389
|
-
function
|
|
1390
|
-
let
|
|
1391
|
-
const
|
|
1392
|
-
for (let r = 0; r <
|
|
1393
|
-
const o =
|
|
1394
|
-
const a =
|
|
1217
|
+
function yt(t, e, n) {
|
|
1218
|
+
let s;
|
|
1219
|
+
const i = {};
|
|
1220
|
+
for (let r = 0; r < t.length; r++) {
|
|
1221
|
+
const o = t[r];
|
|
1222
|
+
const a = Tt(o);
|
|
1395
1223
|
let l = "";
|
|
1396
|
-
if (
|
|
1397
|
-
if (a ===
|
|
1398
|
-
if (
|
|
1224
|
+
if (n === undefined) l = a; else l = n + "." + a;
|
|
1225
|
+
if (a === e.textNodeName) {
|
|
1226
|
+
if (s === undefined) s = o[a]; else s += "" + o[a];
|
|
1399
1227
|
} else if (a === undefined) {
|
|
1400
1228
|
continue;
|
|
1401
1229
|
} else if (o[a]) {
|
|
1402
|
-
let
|
|
1403
|
-
const
|
|
1404
|
-
if (o[ne] !== undefined) {
|
|
1405
|
-
e[ne] = o[ne];
|
|
1406
|
-
}
|
|
1230
|
+
let t = yt(o[a], e, l);
|
|
1231
|
+
const n = Pt(t, e);
|
|
1407
1232
|
if (o[":@"]) {
|
|
1408
|
-
|
|
1409
|
-
} else if (Object.keys(
|
|
1410
|
-
|
|
1411
|
-
} else if (Object.keys(
|
|
1412
|
-
if (
|
|
1233
|
+
Ot(t, o[":@"], l, e);
|
|
1234
|
+
} else if (Object.keys(t).length === 1 && t[e.textNodeName] !== undefined && !e.alwaysCreateTextNode) {
|
|
1235
|
+
t = t[e.textNodeName];
|
|
1236
|
+
} else if (Object.keys(t).length === 0) {
|
|
1237
|
+
if (e.alwaysCreateTextNode) t[e.textNodeName] = ""; else t = "";
|
|
1413
1238
|
}
|
|
1414
|
-
if (
|
|
1415
|
-
if (!Array.isArray(
|
|
1416
|
-
|
|
1239
|
+
if (i[a] !== undefined && i.hasOwnProperty(a)) {
|
|
1240
|
+
if (!Array.isArray(i[a])) {
|
|
1241
|
+
i[a] = [ i[a] ];
|
|
1417
1242
|
}
|
|
1418
|
-
|
|
1243
|
+
i[a].push(t);
|
|
1419
1244
|
} else {
|
|
1420
|
-
if (
|
|
1421
|
-
|
|
1245
|
+
if (e.isArray(a, l, n)) {
|
|
1246
|
+
i[a] = [ t ];
|
|
1422
1247
|
} else {
|
|
1423
|
-
|
|
1248
|
+
i[a] = t;
|
|
1424
1249
|
}
|
|
1425
1250
|
}
|
|
1426
1251
|
}
|
|
1427
1252
|
}
|
|
1428
|
-
if (typeof
|
|
1429
|
-
if (
|
|
1430
|
-
} else if (
|
|
1431
|
-
return
|
|
1253
|
+
if (typeof s === "string") {
|
|
1254
|
+
if (s.length > 0) i[e.textNodeName] = s;
|
|
1255
|
+
} else if (s !== undefined) i[e.textNodeName] = s;
|
|
1256
|
+
return i;
|
|
1432
1257
|
}
|
|
1433
1258
|
|
|
1434
|
-
function
|
|
1435
|
-
const
|
|
1436
|
-
for (let
|
|
1437
|
-
const
|
|
1438
|
-
if (
|
|
1259
|
+
function Tt(t) {
|
|
1260
|
+
const e = Object.keys(t);
|
|
1261
|
+
for (let t = 0; t < e.length; t++) {
|
|
1262
|
+
const n = e[t];
|
|
1263
|
+
if (n !== ":@") return n;
|
|
1439
1264
|
}
|
|
1440
1265
|
}
|
|
1441
1266
|
|
|
1442
|
-
function
|
|
1443
|
-
if (
|
|
1444
|
-
const
|
|
1445
|
-
const r =
|
|
1267
|
+
function Ot(t, e, n, s) {
|
|
1268
|
+
if (e) {
|
|
1269
|
+
const i = Object.keys(e);
|
|
1270
|
+
const r = i.length;
|
|
1446
1271
|
for (let o = 0; o < r; o++) {
|
|
1447
|
-
const r =
|
|
1448
|
-
if (
|
|
1449
|
-
|
|
1272
|
+
const r = i[o];
|
|
1273
|
+
if (s.isArray(r, n + "." + r, true, true)) {
|
|
1274
|
+
t[r] = [ e[r] ];
|
|
1450
1275
|
} else {
|
|
1451
|
-
|
|
1276
|
+
t[r] = e[r];
|
|
1452
1277
|
}
|
|
1453
1278
|
}
|
|
1454
1279
|
}
|
|
1455
1280
|
}
|
|
1456
1281
|
|
|
1457
|
-
function
|
|
1458
|
-
const {textNodeName:
|
|
1459
|
-
const
|
|
1460
|
-
if (
|
|
1282
|
+
function Pt(t, e) {
|
|
1283
|
+
const {textNodeName: n} = e;
|
|
1284
|
+
const s = Object.keys(t).length;
|
|
1285
|
+
if (s === 0) {
|
|
1461
1286
|
return true;
|
|
1462
1287
|
}
|
|
1463
|
-
if (
|
|
1288
|
+
if (s === 1 && (t[n] || typeof t[n] === "boolean" || t[n] === 0)) {
|
|
1464
1289
|
return true;
|
|
1465
1290
|
}
|
|
1466
1291
|
return false;
|
|
1467
1292
|
}
|
|
1468
1293
|
|
|
1469
|
-
|
|
1470
|
-
|
|
1294
|
+
var wt = Et.prettify = vt;
|
|
1295
|
+
|
|
1296
|
+
const {buildOptions: At} = y;
|
|
1297
|
+
|
|
1298
|
+
const Ct = Nt;
|
|
1299
|
+
|
|
1300
|
+
const {prettify: It} = Et;
|
|
1301
|
+
|
|
1302
|
+
const jt = e;
|
|
1303
|
+
|
|
1304
|
+
let St = class XMLParser {
|
|
1305
|
+
constructor(t) {
|
|
1471
1306
|
this.externalEntities = {};
|
|
1472
|
-
this.options =
|
|
1307
|
+
this.options = At(t);
|
|
1473
1308
|
}
|
|
1474
|
-
parse(
|
|
1475
|
-
if (typeof
|
|
1476
|
-
|
|
1477
|
-
} else
|
|
1309
|
+
parse(t, e) {
|
|
1310
|
+
if (typeof t === "string") {} else if (t.toString) {
|
|
1311
|
+
t = t.toString();
|
|
1312
|
+
} else {
|
|
1478
1313
|
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1479
1314
|
}
|
|
1480
|
-
if (
|
|
1481
|
-
if (
|
|
1482
|
-
const
|
|
1483
|
-
if (
|
|
1484
|
-
throw Error(`${
|
|
1315
|
+
if (e) {
|
|
1316
|
+
if (e === true) e = {};
|
|
1317
|
+
const n = jt.validate(t, e);
|
|
1318
|
+
if (n !== true) {
|
|
1319
|
+
throw Error(`${n.err.msg}:${n.err.line}:${n.err.col}`);
|
|
1485
1320
|
}
|
|
1486
1321
|
}
|
|
1487
|
-
const
|
|
1488
|
-
|
|
1489
|
-
const
|
|
1490
|
-
if (this.options.preserveOrder ||
|
|
1322
|
+
const n = new Ct(this.options);
|
|
1323
|
+
n.addExternalEntities(this.externalEntities);
|
|
1324
|
+
const s = n.parseXml(t);
|
|
1325
|
+
if (this.options.preserveOrder || s === undefined) return s; else return It(s, this.options);
|
|
1491
1326
|
}
|
|
1492
|
-
addEntity(
|
|
1493
|
-
if (
|
|
1327
|
+
addEntity(t, e) {
|
|
1328
|
+
if (e.indexOf("&") !== -1) {
|
|
1494
1329
|
throw new Error("Entity value can't have '&'");
|
|
1495
|
-
} else if (
|
|
1330
|
+
} else if (t.indexOf("&") !== -1 || t.indexOf(";") !== -1) {
|
|
1496
1331
|
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
1497
|
-
} else if (
|
|
1332
|
+
} else if (e === "&") {
|
|
1498
1333
|
throw new Error("An entity with value '&' is not permitted");
|
|
1499
1334
|
} else {
|
|
1500
|
-
this.externalEntities[
|
|
1335
|
+
this.externalEntities[t] = e;
|
|
1501
1336
|
}
|
|
1502
1337
|
}
|
|
1503
|
-
|
|
1504
|
-
return XmlNode.getMetaDataSymbol();
|
|
1505
|
-
}
|
|
1506
|
-
}
|
|
1338
|
+
};
|
|
1507
1339
|
|
|
1508
|
-
|
|
1340
|
+
var Ft = St;
|
|
1509
1341
|
|
|
1510
|
-
|
|
1511
|
-
|
|
1512
|
-
|
|
1513
|
-
|
|
1342
|
+
const Dt = t.getDefaultExportFromCjs(Ft);
|
|
1343
|
+
|
|
1344
|
+
const Vt = "\n";
|
|
1345
|
+
|
|
1346
|
+
function kt(t, e) {
|
|
1347
|
+
let n = "";
|
|
1348
|
+
if (e.format && e.indentBy.length > 0) {
|
|
1349
|
+
n = Vt;
|
|
1514
1350
|
}
|
|
1515
|
-
return
|
|
1351
|
+
return $t(t, e, "", n);
|
|
1516
1352
|
}
|
|
1517
1353
|
|
|
1518
|
-
function
|
|
1519
|
-
let
|
|
1354
|
+
function $t(t, e, n, s) {
|
|
1355
|
+
let i = "";
|
|
1520
1356
|
let r = false;
|
|
1521
|
-
for (let o = 0; o <
|
|
1522
|
-
const a =
|
|
1523
|
-
const l =
|
|
1357
|
+
for (let o = 0; o < t.length; o++) {
|
|
1358
|
+
const a = t[o];
|
|
1359
|
+
const l = _t(a);
|
|
1524
1360
|
if (l === undefined) continue;
|
|
1525
1361
|
let u = "";
|
|
1526
|
-
if (
|
|
1527
|
-
if (l ===
|
|
1528
|
-
let
|
|
1529
|
-
if (!
|
|
1530
|
-
|
|
1531
|
-
|
|
1362
|
+
if (n.length === 0) u = l; else u = `${n}.${l}`;
|
|
1363
|
+
if (l === e.textNodeName) {
|
|
1364
|
+
let t = a[l];
|
|
1365
|
+
if (!Mt(u, e)) {
|
|
1366
|
+
t = e.tagValueProcessor(l, t);
|
|
1367
|
+
t = Xt(t, e);
|
|
1532
1368
|
}
|
|
1533
1369
|
if (r) {
|
|
1534
|
-
|
|
1370
|
+
i += s;
|
|
1535
1371
|
}
|
|
1536
|
-
|
|
1372
|
+
i += t;
|
|
1537
1373
|
r = false;
|
|
1538
1374
|
continue;
|
|
1539
|
-
} else if (l ===
|
|
1375
|
+
} else if (l === e.cdataPropName) {
|
|
1540
1376
|
if (r) {
|
|
1541
|
-
|
|
1377
|
+
i += s;
|
|
1542
1378
|
}
|
|
1543
|
-
|
|
1379
|
+
i += `<![CDATA[${a[l][0][e.textNodeName]}]]>`;
|
|
1544
1380
|
r = false;
|
|
1545
1381
|
continue;
|
|
1546
|
-
} else if (l ===
|
|
1547
|
-
|
|
1382
|
+
} else if (l === e.commentPropName) {
|
|
1383
|
+
i += s + `\x3c!--${a[l][0][e.textNodeName]}--\x3e`;
|
|
1548
1384
|
r = true;
|
|
1549
1385
|
continue;
|
|
1550
1386
|
} else if (l[0] === "?") {
|
|
1551
|
-
const
|
|
1552
|
-
const
|
|
1553
|
-
let o = a[l][0][
|
|
1387
|
+
const t = Lt(a[":@"], e);
|
|
1388
|
+
const n = l === "?xml" ? "" : s;
|
|
1389
|
+
let o = a[l][0][e.textNodeName];
|
|
1554
1390
|
o = o.length !== 0 ? " " + o : "";
|
|
1555
|
-
|
|
1391
|
+
i += n + `<${l}${o}${t}?>`;
|
|
1556
1392
|
r = true;
|
|
1557
1393
|
continue;
|
|
1558
1394
|
}
|
|
1559
|
-
let f =
|
|
1395
|
+
let f = s;
|
|
1560
1396
|
if (f !== "") {
|
|
1561
|
-
f +=
|
|
1562
|
-
}
|
|
1563
|
-
const
|
|
1564
|
-
const h =
|
|
1565
|
-
const
|
|
1566
|
-
if (
|
|
1567
|
-
if (
|
|
1568
|
-
} else if ((!
|
|
1569
|
-
|
|
1570
|
-
} else if (
|
|
1571
|
-
|
|
1397
|
+
f += e.indentBy;
|
|
1398
|
+
}
|
|
1399
|
+
const c = Lt(a[":@"], e);
|
|
1400
|
+
const h = s + `<${l}${c}`;
|
|
1401
|
+
const d = $t(a[l], e, u, f);
|
|
1402
|
+
if (e.unpairedTags.indexOf(l) !== -1) {
|
|
1403
|
+
if (e.suppressUnpairedNode) i += h + ">"; else i += h + "/>";
|
|
1404
|
+
} else if ((!d || d.length === 0) && e.suppressEmptyNode) {
|
|
1405
|
+
i += h + "/>";
|
|
1406
|
+
} else if (d && d.endsWith(">")) {
|
|
1407
|
+
i += h + `>${d}${s}</${l}>`;
|
|
1572
1408
|
} else {
|
|
1573
|
-
|
|
1574
|
-
if (
|
|
1575
|
-
|
|
1409
|
+
i += h + ">";
|
|
1410
|
+
if (d && s !== "" && (d.includes("/>") || d.includes("</"))) {
|
|
1411
|
+
i += s + e.indentBy + d + s;
|
|
1576
1412
|
} else {
|
|
1577
|
-
|
|
1413
|
+
i += d;
|
|
1578
1414
|
}
|
|
1579
|
-
|
|
1415
|
+
i += `</${l}>`;
|
|
1580
1416
|
}
|
|
1581
1417
|
r = true;
|
|
1582
1418
|
}
|
|
1583
|
-
return
|
|
1419
|
+
return i;
|
|
1584
1420
|
}
|
|
1585
1421
|
|
|
1586
|
-
function
|
|
1587
|
-
const
|
|
1588
|
-
for (let
|
|
1589
|
-
const
|
|
1590
|
-
if (!
|
|
1591
|
-
if (
|
|
1422
|
+
function _t(t) {
|
|
1423
|
+
const e = Object.keys(t);
|
|
1424
|
+
for (let n = 0; n < e.length; n++) {
|
|
1425
|
+
const s = e[n];
|
|
1426
|
+
if (!t.hasOwnProperty(s)) continue;
|
|
1427
|
+
if (s !== ":@") return s;
|
|
1592
1428
|
}
|
|
1593
1429
|
}
|
|
1594
1430
|
|
|
1595
|
-
function
|
|
1596
|
-
let
|
|
1597
|
-
if (
|
|
1598
|
-
for (let
|
|
1599
|
-
if (!
|
|
1600
|
-
let
|
|
1601
|
-
|
|
1602
|
-
if (
|
|
1603
|
-
|
|
1431
|
+
function Lt(t, e) {
|
|
1432
|
+
let n = "";
|
|
1433
|
+
if (t && !e.ignoreAttributes) {
|
|
1434
|
+
for (let s in t) {
|
|
1435
|
+
if (!t.hasOwnProperty(s)) continue;
|
|
1436
|
+
let i = e.attributeValueProcessor(s, t[s]);
|
|
1437
|
+
i = Xt(i, e);
|
|
1438
|
+
if (i === true && e.suppressBooleanAttributes) {
|
|
1439
|
+
n += ` ${s.substr(e.attributeNamePrefix.length)}`;
|
|
1604
1440
|
} else {
|
|
1605
|
-
|
|
1441
|
+
n += ` ${s.substr(e.attributeNamePrefix.length)}="${i}"`;
|
|
1606
1442
|
}
|
|
1607
1443
|
}
|
|
1608
1444
|
}
|
|
1609
|
-
return
|
|
1445
|
+
return n;
|
|
1610
1446
|
}
|
|
1611
1447
|
|
|
1612
|
-
function
|
|
1613
|
-
|
|
1614
|
-
let
|
|
1615
|
-
for (let
|
|
1616
|
-
if (
|
|
1448
|
+
function Mt(t, e) {
|
|
1449
|
+
t = t.substr(0, t.length - e.textNodeName.length - 1);
|
|
1450
|
+
let n = t.substr(t.lastIndexOf(".") + 1);
|
|
1451
|
+
for (let s in e.stopNodes) {
|
|
1452
|
+
if (e.stopNodes[s] === t || e.stopNodes[s] === "*." + n) return true;
|
|
1617
1453
|
}
|
|
1618
1454
|
return false;
|
|
1619
1455
|
}
|
|
1620
1456
|
|
|
1621
|
-
function
|
|
1622
|
-
if (
|
|
1623
|
-
for (let
|
|
1624
|
-
const
|
|
1625
|
-
|
|
1457
|
+
function Xt(t, e) {
|
|
1458
|
+
if (t && t.length > 0 && e.processEntities) {
|
|
1459
|
+
for (let n = 0; n < e.entities.length; n++) {
|
|
1460
|
+
const s = e.entities[n];
|
|
1461
|
+
t = t.replace(s.regex, s.val);
|
|
1626
1462
|
}
|
|
1627
1463
|
}
|
|
1628
|
-
return
|
|
1464
|
+
return t;
|
|
1629
1465
|
}
|
|
1630
1466
|
|
|
1467
|
+
var Bt = kt;
|
|
1468
|
+
|
|
1469
|
+
const Gt = t.getDefaultExportFromCjs(Bt);
|
|
1470
|
+
|
|
1631
1471
|
"use strict";
|
|
1632
1472
|
|
|
1633
|
-
const
|
|
1473
|
+
const Rt = Bt;
|
|
1474
|
+
|
|
1475
|
+
const Ut = z;
|
|
1476
|
+
|
|
1477
|
+
const Zt = {
|
|
1634
1478
|
attributeNamePrefix: "@_",
|
|
1635
1479
|
attributesGroupName: false,
|
|
1636
1480
|
textNodeName: "#text",
|
|
@@ -1641,11 +1485,11 @@ const me = {
|
|
|
1641
1485
|
suppressEmptyNode: false,
|
|
1642
1486
|
suppressUnpairedNode: true,
|
|
1643
1487
|
suppressBooleanAttributes: true,
|
|
1644
|
-
tagValueProcessor: function(
|
|
1645
|
-
return
|
|
1488
|
+
tagValueProcessor: function(t, e) {
|
|
1489
|
+
return e;
|
|
1646
1490
|
},
|
|
1647
|
-
attributeValueProcessor: function(
|
|
1648
|
-
return
|
|
1491
|
+
attributeValueProcessor: function(t, e) {
|
|
1492
|
+
return e;
|
|
1649
1493
|
},
|
|
1650
1494
|
preserveOrder: false,
|
|
1651
1495
|
commentPropName: false,
|
|
@@ -1671,20 +1515,20 @@ const me = {
|
|
|
1671
1515
|
oneListGroup: false
|
|
1672
1516
|
};
|
|
1673
1517
|
|
|
1674
|
-
function
|
|
1675
|
-
this.options = Object.assign({},
|
|
1518
|
+
function Yt(t) {
|
|
1519
|
+
this.options = Object.assign({}, Zt, t);
|
|
1676
1520
|
if (this.options.ignoreAttributes === true || this.options.attributesGroupName) {
|
|
1677
1521
|
this.isAttribute = function() {
|
|
1678
1522
|
return false;
|
|
1679
1523
|
};
|
|
1680
1524
|
} else {
|
|
1681
|
-
this.ignoreAttributesFn =
|
|
1525
|
+
this.ignoreAttributesFn = Ut(this.options.ignoreAttributes);
|
|
1682
1526
|
this.attrPrefixLen = this.options.attributeNamePrefix.length;
|
|
1683
|
-
this.isAttribute =
|
|
1527
|
+
this.isAttribute = Jt;
|
|
1684
1528
|
}
|
|
1685
|
-
this.processTextOrObjNode =
|
|
1529
|
+
this.processTextOrObjNode = qt;
|
|
1686
1530
|
if (this.options.format) {
|
|
1687
|
-
this.indentate =
|
|
1531
|
+
this.indentate = zt;
|
|
1688
1532
|
this.tagEndChar = ">\n";
|
|
1689
1533
|
this.newLine = "\n";
|
|
1690
1534
|
} else {
|
|
@@ -1696,219 +1540,233 @@ function xe(e) {
|
|
|
1696
1540
|
}
|
|
1697
1541
|
}
|
|
1698
1542
|
|
|
1699
|
-
|
|
1543
|
+
Yt.prototype.build = function(t) {
|
|
1700
1544
|
if (this.options.preserveOrder) {
|
|
1701
|
-
return
|
|
1545
|
+
return Rt(t, this.options);
|
|
1702
1546
|
} else {
|
|
1703
|
-
if (Array.isArray(
|
|
1704
|
-
|
|
1705
|
-
[this.options.arrayNodeName]:
|
|
1547
|
+
if (Array.isArray(t) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1) {
|
|
1548
|
+
t = {
|
|
1549
|
+
[this.options.arrayNodeName]: t
|
|
1706
1550
|
};
|
|
1707
1551
|
}
|
|
1708
|
-
return this.j2x(
|
|
1552
|
+
return this.j2x(t, 0, []).val;
|
|
1709
1553
|
}
|
|
1710
1554
|
};
|
|
1711
1555
|
|
|
1712
|
-
|
|
1713
|
-
let n = "";
|
|
1556
|
+
Yt.prototype.j2x = function(t, e, n) {
|
|
1714
1557
|
let s = "";
|
|
1715
|
-
|
|
1716
|
-
|
|
1717
|
-
|
|
1718
|
-
if (
|
|
1558
|
+
let i = "";
|
|
1559
|
+
const r = n.join(".");
|
|
1560
|
+
for (let o in t) {
|
|
1561
|
+
if (!Object.prototype.hasOwnProperty.call(t, o)) continue;
|
|
1562
|
+
if (typeof t[o] === "undefined") {
|
|
1719
1563
|
if (this.isAttribute(o)) {
|
|
1720
|
-
|
|
1564
|
+
i += "";
|
|
1721
1565
|
}
|
|
1722
|
-
} else if (
|
|
1566
|
+
} else if (t[o] === null) {
|
|
1723
1567
|
if (this.isAttribute(o)) {
|
|
1724
|
-
|
|
1568
|
+
i += "";
|
|
1725
1569
|
} else if (o === this.options.cdataPropName) {
|
|
1726
|
-
|
|
1570
|
+
i += "";
|
|
1727
1571
|
} else if (o[0] === "?") {
|
|
1728
|
-
|
|
1572
|
+
i += this.indentate(e) + "<" + o + "?" + this.tagEndChar;
|
|
1729
1573
|
} else {
|
|
1730
|
-
|
|
1574
|
+
i += this.indentate(e) + "<" + o + "/" + this.tagEndChar;
|
|
1731
1575
|
}
|
|
1732
|
-
} else if (
|
|
1733
|
-
|
|
1734
|
-
} else if (typeof
|
|
1735
|
-
const
|
|
1736
|
-
if (
|
|
1737
|
-
|
|
1738
|
-
} else if (!
|
|
1576
|
+
} else if (t[o] instanceof Date) {
|
|
1577
|
+
i += this.buildTextValNode(t[o], o, "", e);
|
|
1578
|
+
} else if (typeof t[o] !== "object") {
|
|
1579
|
+
const n = this.isAttribute(o);
|
|
1580
|
+
if (n && !this.ignoreAttributesFn(n, r)) {
|
|
1581
|
+
s += this.buildAttrPairStr(n, "" + t[o]);
|
|
1582
|
+
} else if (!n) {
|
|
1739
1583
|
if (o === this.options.textNodeName) {
|
|
1740
|
-
let
|
|
1741
|
-
|
|
1584
|
+
let e = this.options.tagValueProcessor(o, "" + t[o]);
|
|
1585
|
+
i += this.replaceEntitiesValue(e);
|
|
1742
1586
|
} else {
|
|
1743
|
-
|
|
1587
|
+
i += this.buildTextValNode(t[o], o, "", e);
|
|
1744
1588
|
}
|
|
1745
1589
|
}
|
|
1746
|
-
} else if (Array.isArray(
|
|
1747
|
-
const
|
|
1590
|
+
} else if (Array.isArray(t[o])) {
|
|
1591
|
+
const s = t[o].length;
|
|
1748
1592
|
let r = "";
|
|
1749
1593
|
let a = "";
|
|
1750
|
-
for (let l = 0; l <
|
|
1751
|
-
const
|
|
1752
|
-
if (typeof
|
|
1753
|
-
if (o[0] === "?")
|
|
1754
|
-
} else if (typeof
|
|
1594
|
+
for (let l = 0; l < s; l++) {
|
|
1595
|
+
const s = t[o][l];
|
|
1596
|
+
if (typeof s === "undefined") {} else if (s === null) {
|
|
1597
|
+
if (o[0] === "?") i += this.indentate(e) + "<" + o + "?" + this.tagEndChar; else i += this.indentate(e) + "<" + o + "/" + this.tagEndChar;
|
|
1598
|
+
} else if (typeof s === "object") {
|
|
1755
1599
|
if (this.options.oneListGroup) {
|
|
1756
|
-
const
|
|
1757
|
-
r +=
|
|
1758
|
-
if (this.options.attributesGroupName &&
|
|
1759
|
-
a +=
|
|
1600
|
+
const t = this.j2x(s, e + 1, n.concat(o));
|
|
1601
|
+
r += t.val;
|
|
1602
|
+
if (this.options.attributesGroupName && s.hasOwnProperty(this.options.attributesGroupName)) {
|
|
1603
|
+
a += t.attrStr;
|
|
1760
1604
|
}
|
|
1761
1605
|
} else {
|
|
1762
|
-
r += this.processTextOrObjNode(
|
|
1606
|
+
r += this.processTextOrObjNode(s, o, e, n);
|
|
1763
1607
|
}
|
|
1764
1608
|
} else {
|
|
1765
1609
|
if (this.options.oneListGroup) {
|
|
1766
|
-
let
|
|
1767
|
-
|
|
1768
|
-
r +=
|
|
1610
|
+
let t = this.options.tagValueProcessor(o, s);
|
|
1611
|
+
t = this.replaceEntitiesValue(t);
|
|
1612
|
+
r += t;
|
|
1769
1613
|
} else {
|
|
1770
|
-
r += this.buildTextValNode(
|
|
1614
|
+
r += this.buildTextValNode(s, o, "", e);
|
|
1771
1615
|
}
|
|
1772
1616
|
}
|
|
1773
1617
|
}
|
|
1774
1618
|
if (this.options.oneListGroup) {
|
|
1775
|
-
r = this.buildObjectNode(r, o, a,
|
|
1619
|
+
r = this.buildObjectNode(r, o, a, e);
|
|
1776
1620
|
}
|
|
1777
|
-
|
|
1621
|
+
i += r;
|
|
1778
1622
|
} else {
|
|
1779
1623
|
if (this.options.attributesGroupName && o === this.options.attributesGroupName) {
|
|
1780
|
-
const
|
|
1781
|
-
const
|
|
1782
|
-
for (let
|
|
1783
|
-
|
|
1624
|
+
const e = Object.keys(t[o]);
|
|
1625
|
+
const n = e.length;
|
|
1626
|
+
for (let i = 0; i < n; i++) {
|
|
1627
|
+
s += this.buildAttrPairStr(e[i], "" + t[o][e[i]]);
|
|
1784
1628
|
}
|
|
1785
1629
|
} else {
|
|
1786
|
-
|
|
1630
|
+
i += this.processTextOrObjNode(t[o], o, e, n);
|
|
1787
1631
|
}
|
|
1788
1632
|
}
|
|
1789
1633
|
}
|
|
1790
1634
|
return {
|
|
1791
|
-
attrStr:
|
|
1792
|
-
val:
|
|
1635
|
+
attrStr: s,
|
|
1636
|
+
val: i
|
|
1793
1637
|
};
|
|
1794
1638
|
};
|
|
1795
1639
|
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
if (this.options.suppressBooleanAttributes &&
|
|
1800
|
-
return " " +
|
|
1801
|
-
} else return " " +
|
|
1640
|
+
Yt.prototype.buildAttrPairStr = function(t, e) {
|
|
1641
|
+
e = this.options.attributeValueProcessor(t, "" + e);
|
|
1642
|
+
e = this.replaceEntitiesValue(e);
|
|
1643
|
+
if (this.options.suppressBooleanAttributes && e === "true") {
|
|
1644
|
+
return " " + t;
|
|
1645
|
+
} else return " " + t + '="' + e + '"';
|
|
1802
1646
|
};
|
|
1803
1647
|
|
|
1804
|
-
function
|
|
1805
|
-
const
|
|
1806
|
-
if (
|
|
1807
|
-
return this.buildTextValNode(
|
|
1648
|
+
function qt(t, e, n, s) {
|
|
1649
|
+
const i = this.j2x(t, n + 1, s.concat(e));
|
|
1650
|
+
if (t[this.options.textNodeName] !== undefined && Object.keys(t).length === 1) {
|
|
1651
|
+
return this.buildTextValNode(t[this.options.textNodeName], e, i.attrStr, n);
|
|
1808
1652
|
} else {
|
|
1809
|
-
return this.buildObjectNode(
|
|
1653
|
+
return this.buildObjectNode(i.val, e, i.attrStr, n);
|
|
1810
1654
|
}
|
|
1811
1655
|
}
|
|
1812
1656
|
|
|
1813
|
-
|
|
1814
|
-
if (
|
|
1815
|
-
if (
|
|
1816
|
-
return this.indentate(
|
|
1657
|
+
Yt.prototype.buildObjectNode = function(t, e, n, s) {
|
|
1658
|
+
if (t === "") {
|
|
1659
|
+
if (e[0] === "?") return this.indentate(s) + "<" + e + n + "?" + this.tagEndChar; else {
|
|
1660
|
+
return this.indentate(s) + "<" + e + n + this.closeTag(e) + this.tagEndChar;
|
|
1817
1661
|
}
|
|
1818
1662
|
} else {
|
|
1819
|
-
let
|
|
1663
|
+
let i = "</" + e + this.tagEndChar;
|
|
1820
1664
|
let r = "";
|
|
1821
|
-
if (
|
|
1665
|
+
if (e[0] === "?") {
|
|
1822
1666
|
r = "?";
|
|
1823
|
-
|
|
1667
|
+
i = "";
|
|
1824
1668
|
}
|
|
1825
|
-
if ((
|
|
1826
|
-
return this.indentate(
|
|
1827
|
-
} else if (this.options.commentPropName !== false &&
|
|
1828
|
-
return this.indentate(
|
|
1669
|
+
if ((n || n === "") && t.indexOf("<") === -1) {
|
|
1670
|
+
return this.indentate(s) + "<" + e + n + r + ">" + t + i;
|
|
1671
|
+
} else if (this.options.commentPropName !== false && e === this.options.commentPropName && r.length === 0) {
|
|
1672
|
+
return this.indentate(s) + `\x3c!--${t}--\x3e` + this.newLine;
|
|
1829
1673
|
} else {
|
|
1830
|
-
return this.indentate(
|
|
1674
|
+
return this.indentate(s) + "<" + e + n + r + this.tagEndChar + t + this.indentate(s) + i;
|
|
1831
1675
|
}
|
|
1832
1676
|
}
|
|
1833
1677
|
};
|
|
1834
1678
|
|
|
1835
|
-
|
|
1836
|
-
let
|
|
1837
|
-
if (this.options.unpairedTags.indexOf(
|
|
1838
|
-
if (!this.options.suppressUnpairedNode)
|
|
1679
|
+
Yt.prototype.closeTag = function(t) {
|
|
1680
|
+
let e = "";
|
|
1681
|
+
if (this.options.unpairedTags.indexOf(t) !== -1) {
|
|
1682
|
+
if (!this.options.suppressUnpairedNode) e = "/";
|
|
1839
1683
|
} else if (this.options.suppressEmptyNode) {
|
|
1840
|
-
|
|
1684
|
+
e = "/";
|
|
1841
1685
|
} else {
|
|
1842
|
-
|
|
1686
|
+
e = `></${t}`;
|
|
1843
1687
|
}
|
|
1844
|
-
return
|
|
1688
|
+
return e;
|
|
1845
1689
|
};
|
|
1846
1690
|
|
|
1847
|
-
function
|
|
1848
|
-
if (
|
|
1849
|
-
return this.buildObjectNode(
|
|
1691
|
+
function Wt(t, e, n, s) {
|
|
1692
|
+
if (t !== "") {
|
|
1693
|
+
return this.buildObjectNode(t, e, n, s);
|
|
1850
1694
|
} else {
|
|
1851
|
-
if (
|
|
1852
|
-
return this.indentate(
|
|
1695
|
+
if (e[0] === "?") return this.indentate(s) + "<" + e + n + "?" + this.tagEndChar; else {
|
|
1696
|
+
return this.indentate(s) + "<" + e + n + "/" + this.tagEndChar;
|
|
1853
1697
|
}
|
|
1854
1698
|
}
|
|
1855
1699
|
}
|
|
1856
1700
|
|
|
1857
|
-
|
|
1858
|
-
if (this.options.cdataPropName !== false &&
|
|
1859
|
-
return this.indentate(
|
|
1860
|
-
} else if (this.options.commentPropName !== false &&
|
|
1861
|
-
return this.indentate(
|
|
1862
|
-
} else if (
|
|
1863
|
-
return this.indentate(
|
|
1701
|
+
Yt.prototype.buildTextValNode = function(t, e, n, s) {
|
|
1702
|
+
if (this.options.cdataPropName !== false && e === this.options.cdataPropName) {
|
|
1703
|
+
return this.indentate(s) + `<![CDATA[${t}]]>` + this.newLine;
|
|
1704
|
+
} else if (this.options.commentPropName !== false && e === this.options.commentPropName) {
|
|
1705
|
+
return this.indentate(s) + `\x3c!--${t}--\x3e` + this.newLine;
|
|
1706
|
+
} else if (e[0] === "?") {
|
|
1707
|
+
return this.indentate(s) + "<" + e + n + "?" + this.tagEndChar;
|
|
1864
1708
|
} else {
|
|
1865
|
-
let
|
|
1866
|
-
|
|
1867
|
-
if (
|
|
1868
|
-
return this.indentate(
|
|
1709
|
+
let i = this.options.tagValueProcessor(e, t);
|
|
1710
|
+
i = this.replaceEntitiesValue(i);
|
|
1711
|
+
if (i === "") {
|
|
1712
|
+
return this.indentate(s) + "<" + e + n + this.closeTag(e) + this.tagEndChar;
|
|
1869
1713
|
} else {
|
|
1870
|
-
return this.indentate(
|
|
1714
|
+
return this.indentate(s) + "<" + e + n + ">" + i + "</" + e + this.tagEndChar;
|
|
1871
1715
|
}
|
|
1872
1716
|
}
|
|
1873
1717
|
};
|
|
1874
1718
|
|
|
1875
|
-
|
|
1876
|
-
if (
|
|
1877
|
-
for (let
|
|
1878
|
-
const
|
|
1879
|
-
|
|
1719
|
+
Yt.prototype.replaceEntitiesValue = function(t) {
|
|
1720
|
+
if (t && t.length > 0 && this.options.processEntities) {
|
|
1721
|
+
for (let e = 0; e < this.options.entities.length; e++) {
|
|
1722
|
+
const n = this.options.entities[e];
|
|
1723
|
+
t = t.replace(n.regex, n.val);
|
|
1880
1724
|
}
|
|
1881
1725
|
}
|
|
1882
|
-
return
|
|
1726
|
+
return t;
|
|
1883
1727
|
};
|
|
1884
1728
|
|
|
1885
|
-
function
|
|
1886
|
-
return this.options.indentBy.repeat(
|
|
1729
|
+
function zt(t) {
|
|
1730
|
+
return this.options.indentBy.repeat(t);
|
|
1887
1731
|
}
|
|
1888
1732
|
|
|
1889
|
-
function
|
|
1890
|
-
if (
|
|
1891
|
-
return
|
|
1733
|
+
function Jt(t) {
|
|
1734
|
+
if (t.startsWith(this.options.attributeNamePrefix) && t !== this.options.textNodeName) {
|
|
1735
|
+
return t.substr(this.attrPrefixLen);
|
|
1892
1736
|
} else {
|
|
1893
1737
|
return false;
|
|
1894
1738
|
}
|
|
1895
1739
|
}
|
|
1896
1740
|
|
|
1741
|
+
var Ht = Yt;
|
|
1742
|
+
|
|
1743
|
+
const Kt = t.getDefaultExportFromCjs(Ht);
|
|
1744
|
+
|
|
1897
1745
|
"use strict";
|
|
1898
1746
|
|
|
1899
|
-
const
|
|
1900
|
-
|
|
1747
|
+
const Qt = e;
|
|
1748
|
+
|
|
1749
|
+
const te = Ft;
|
|
1750
|
+
|
|
1751
|
+
const ee = Ht;
|
|
1752
|
+
|
|
1753
|
+
var ne = {
|
|
1754
|
+
XMLParser: te,
|
|
1755
|
+
XMLValidator: Qt,
|
|
1756
|
+
XMLBuilder: ee
|
|
1901
1757
|
};
|
|
1902
1758
|
|
|
1903
|
-
|
|
1759
|
+
const se = t.getDefaultExportFromCjs(ne);
|
|
1760
|
+
|
|
1761
|
+
function ie(t) {
|
|
1904
1762
|
try {
|
|
1905
|
-
|
|
1763
|
+
ne.XMLValidator.validate(t, {
|
|
1906
1764
|
allowBooleanAttributes: true
|
|
1907
1765
|
});
|
|
1908
1766
|
return true;
|
|
1909
|
-
} catch (
|
|
1767
|
+
} catch (t) {
|
|
1910
1768
|
return false;
|
|
1911
1769
|
}
|
|
1912
1770
|
}
|
|
1913
1771
|
|
|
1914
|
-
exports.IsXML =
|
|
1772
|
+
exports.IsXML = ie;
|