@opencloud-eu/web-client 5.1.0 → 6.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{functions-JSgappH3.js → functions-BBKWOL6l.js} +1 -1
- package/dist/{functions-K2XX5sqY.cjs → functions-VxhUeT1u.cjs} +1 -1
- package/dist/{index-Dn0XwAD_.cjs → index-BYnmk_Nt.cjs} +10 -10
- package/dist/{index-YuBBVVCr.js → index-Bf956okn.js} +172 -158
- package/dist/{index-CRMq09Yn.js → index-Bjx4f50a.js} +630 -564
- package/dist/index-C32gBO3b.cjs +6 -0
- package/dist/index-Di51ZQKD.cjs +4 -0
- package/dist/index-Dn8UfKx7.js +1520 -0
- package/dist/{index-Brk6gzFd.js → index-Sp7XASDj.js} +1 -1
- package/dist/{index-CDNcS2Ra.cjs → index-_S-l3FmE.cjs} +1 -1
- package/dist/web-client/graph/generated.cjs +1 -1
- package/dist/web-client/graph/generated.js +1 -1
- package/dist/web-client/graph.cjs +1 -1
- package/dist/web-client/graph.js +1 -1
- package/dist/web-client/ocs.cjs +1 -1
- package/dist/web-client/ocs.js +1 -1
- package/dist/web-client/webdav.cjs +1 -1
- package/dist/web-client/webdav.js +3 -3
- package/dist/web-client.cjs +1 -1
- package/dist/web-client.js +5 -5
- package/package.json +1 -1
- package/dist/index-Bjk4YP4o.js +0 -1447
- package/dist/index-_QOU-c0Z.cjs +0 -4
- package/dist/index-mNoGEl9R.cjs +0 -6
|
@@ -0,0 +1,1520 @@
|
|
|
1
|
+
import { i as ge, a as pe, M as be, t as me, u as Oe } from "./toString-CKeGA2IK.js";
|
|
2
|
+
import { B as Le } from "./index-cttW6Cve.js";
|
|
3
|
+
var Se = /\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/, Pe = /^\w*$/;
|
|
4
|
+
function He(t, e) {
|
|
5
|
+
if (ge(t))
|
|
6
|
+
return !1;
|
|
7
|
+
var n = typeof t;
|
|
8
|
+
return n == "number" || n == "symbol" || n == "boolean" || t == null || pe(t) ? !0 : Pe.test(t) || !Se.test(t) || e != null && t in Object(e);
|
|
9
|
+
}
|
|
10
|
+
var _e = "Expected a function";
|
|
11
|
+
function se(t, e) {
|
|
12
|
+
if (typeof t != "function" || e != null && typeof e != "function")
|
|
13
|
+
throw new TypeError(_e);
|
|
14
|
+
var n = function() {
|
|
15
|
+
var s = arguments, r = e ? e.apply(this, s) : s[0], i = n.cache;
|
|
16
|
+
if (i.has(r))
|
|
17
|
+
return i.get(r);
|
|
18
|
+
var o = t.apply(this, s);
|
|
19
|
+
return n.cache = i.set(r, o) || i, o;
|
|
20
|
+
};
|
|
21
|
+
return n.cache = new (se.Cache || be)(), n;
|
|
22
|
+
}
|
|
23
|
+
se.Cache = be;
|
|
24
|
+
var Fe = 500;
|
|
25
|
+
function ke(t) {
|
|
26
|
+
var e = se(t, function(s) {
|
|
27
|
+
return n.size === Fe && n.clear(), s;
|
|
28
|
+
}), n = e.cache;
|
|
29
|
+
return e;
|
|
30
|
+
}
|
|
31
|
+
var Ue = /[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g, Me = /\\(\\)?/g, Ve = ke(function(t) {
|
|
32
|
+
var e = [];
|
|
33
|
+
return t.charCodeAt(0) === 46 && e.push(""), t.replace(Ue, function(n, s, r, i) {
|
|
34
|
+
e.push(r ? i.replace(Me, "$1") : s || n);
|
|
35
|
+
}), e;
|
|
36
|
+
});
|
|
37
|
+
function ve(t, e) {
|
|
38
|
+
return ge(t) ? t : He(t, e) ? [t] : Ve(me(t));
|
|
39
|
+
}
|
|
40
|
+
function $e(t) {
|
|
41
|
+
if (typeof t == "string" || pe(t))
|
|
42
|
+
return t;
|
|
43
|
+
var e = t + "";
|
|
44
|
+
return e == "0" && 1 / t == -1 / 0 ? "-0" : e;
|
|
45
|
+
}
|
|
46
|
+
function Be(t, e) {
|
|
47
|
+
e = ve(e, t);
|
|
48
|
+
for (var n = 0, s = e.length; t != null && n < s; )
|
|
49
|
+
t = t[$e(e[n++])];
|
|
50
|
+
return n && n == s ? t : void 0;
|
|
51
|
+
}
|
|
52
|
+
function Re(t, e, n) {
|
|
53
|
+
var s = t == null ? void 0 : Be(t, e);
|
|
54
|
+
return s === void 0 ? n : s;
|
|
55
|
+
}
|
|
56
|
+
const je = (t, e) => {
|
|
57
|
+
const n = new URL(t);
|
|
58
|
+
n.pathname = [...n.pathname.split("/"), "cloud", "capabilities"].filter(Boolean).join("/"), n.searchParams.append("format", "json");
|
|
59
|
+
const s = n.href;
|
|
60
|
+
return {
|
|
61
|
+
async getCapabilities() {
|
|
62
|
+
const r = await e.get(s);
|
|
63
|
+
return Re(r, "data.ocs.data", { capabilities: null, version: null });
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
};
|
|
67
|
+
function Ke(t) {
|
|
68
|
+
return t instanceof Uint8Array || ArrayBuffer.isView(t) && t.constructor.name === "Uint8Array";
|
|
69
|
+
}
|
|
70
|
+
function v(t, e = "") {
|
|
71
|
+
if (!Number.isSafeInteger(t) || t < 0) {
|
|
72
|
+
const n = e && `"${e}" `;
|
|
73
|
+
throw new Error(`${n}expected integer >= 0, got ${t}`);
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
function $(t, e, n = "") {
|
|
77
|
+
const s = Ke(t), r = t?.length, i = e !== void 0;
|
|
78
|
+
if (!s || i && r !== e) {
|
|
79
|
+
const o = n && `"${n}" `, a = i ? ` of length ${e}` : "", f = s ? `length=${r}` : `type=${typeof t}`;
|
|
80
|
+
throw new Error(o + "expected Uint8Array" + a + ", got " + f);
|
|
81
|
+
}
|
|
82
|
+
return t;
|
|
83
|
+
}
|
|
84
|
+
function Ee(t) {
|
|
85
|
+
if (typeof t != "function" || typeof t.create != "function")
|
|
86
|
+
throw new Error("Hash must wrapped by utils.createHasher");
|
|
87
|
+
v(t.outputLen), v(t.blockLen);
|
|
88
|
+
}
|
|
89
|
+
function Y(t, e = !0) {
|
|
90
|
+
if (t.destroyed)
|
|
91
|
+
throw new Error("Hash instance has been destroyed");
|
|
92
|
+
if (e && t.finished)
|
|
93
|
+
throw new Error("Hash#digest() has already been called");
|
|
94
|
+
}
|
|
95
|
+
function Ge(t, e) {
|
|
96
|
+
$(t, void 0, "digestInto() output");
|
|
97
|
+
const n = e.outputLen;
|
|
98
|
+
if (t.length < n)
|
|
99
|
+
throw new Error('"digestInto() output" expected to be of length >=' + n);
|
|
100
|
+
}
|
|
101
|
+
function B(...t) {
|
|
102
|
+
for (let e = 0; e < t.length; e++)
|
|
103
|
+
t[e].fill(0);
|
|
104
|
+
}
|
|
105
|
+
function z(t) {
|
|
106
|
+
return new DataView(t.buffer, t.byteOffset, t.byteLength);
|
|
107
|
+
}
|
|
108
|
+
function Xe(t) {
|
|
109
|
+
if (typeof t != "string")
|
|
110
|
+
throw new Error("string expected");
|
|
111
|
+
return new Uint8Array(new TextEncoder().encode(t));
|
|
112
|
+
}
|
|
113
|
+
function ie(t, e = "") {
|
|
114
|
+
return typeof t == "string" ? Xe(t) : $(t, void 0, e);
|
|
115
|
+
}
|
|
116
|
+
function ze(t, e) {
|
|
117
|
+
if (e !== void 0 && {}.toString.call(e) !== "[object Object]")
|
|
118
|
+
throw new Error("options must be object or undefined");
|
|
119
|
+
return Object.assign(t, e);
|
|
120
|
+
}
|
|
121
|
+
function Ye(t, e = {}) {
|
|
122
|
+
const n = (r, i) => t(i).update(r).digest(), s = t(void 0);
|
|
123
|
+
return n.outputLen = s.outputLen, n.blockLen = s.blockLen, n.create = (r) => t(r), Object.assign(n, e), Object.freeze(n);
|
|
124
|
+
}
|
|
125
|
+
const We = (t) => ({
|
|
126
|
+
oid: Uint8Array.from([6, 9, 96, 134, 72, 1, 101, 3, 4, 2, t])
|
|
127
|
+
});
|
|
128
|
+
class ye {
|
|
129
|
+
oHash;
|
|
130
|
+
iHash;
|
|
131
|
+
blockLen;
|
|
132
|
+
outputLen;
|
|
133
|
+
finished = !1;
|
|
134
|
+
destroyed = !1;
|
|
135
|
+
constructor(e, n) {
|
|
136
|
+
if (Ee(e), $(n, void 0, "key"), this.iHash = e.create(), typeof this.iHash.update != "function")
|
|
137
|
+
throw new Error("Expected instance of class which extends utils.Hash");
|
|
138
|
+
this.blockLen = this.iHash.blockLen, this.outputLen = this.iHash.outputLen;
|
|
139
|
+
const s = this.blockLen, r = new Uint8Array(s);
|
|
140
|
+
r.set(n.length > s ? e.create().update(n).digest() : n);
|
|
141
|
+
for (let i = 0; i < r.length; i++)
|
|
142
|
+
r[i] ^= 54;
|
|
143
|
+
this.iHash.update(r), this.oHash = e.create();
|
|
144
|
+
for (let i = 0; i < r.length; i++)
|
|
145
|
+
r[i] ^= 106;
|
|
146
|
+
this.oHash.update(r), B(r);
|
|
147
|
+
}
|
|
148
|
+
update(e) {
|
|
149
|
+
return Y(this), this.iHash.update(e), this;
|
|
150
|
+
}
|
|
151
|
+
digestInto(e) {
|
|
152
|
+
Y(this), $(e, this.outputLen, "output"), this.finished = !0, this.iHash.digestInto(e), this.oHash.update(e), this.oHash.digestInto(e), this.destroy();
|
|
153
|
+
}
|
|
154
|
+
digest() {
|
|
155
|
+
const e = new Uint8Array(this.oHash.outputLen);
|
|
156
|
+
return this.digestInto(e), e;
|
|
157
|
+
}
|
|
158
|
+
_cloneInto(e) {
|
|
159
|
+
e ||= Object.create(Object.getPrototypeOf(this), {});
|
|
160
|
+
const { oHash: n, iHash: s, finished: r, destroyed: i, blockLen: o, outputLen: a } = this;
|
|
161
|
+
return e = e, e.finished = r, e.destroyed = i, e.blockLen = o, e.outputLen = a, e.oHash = n._cloneInto(e.oHash), e.iHash = s._cloneInto(e.iHash), e;
|
|
162
|
+
}
|
|
163
|
+
clone() {
|
|
164
|
+
return this._cloneInto();
|
|
165
|
+
}
|
|
166
|
+
destroy() {
|
|
167
|
+
this.destroyed = !0, this.oHash.destroy(), this.iHash.destroy();
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
const we = (t, e, n) => new ye(t, e).update(n).digest();
|
|
171
|
+
we.create = (t, e) => new ye(t, e);
|
|
172
|
+
function Ze(t, e, n, s) {
|
|
173
|
+
Ee(t);
|
|
174
|
+
const r = ze({ dkLen: 32, asyncTick: 10 }, s), { c: i, dkLen: o, asyncTick: a } = r;
|
|
175
|
+
if (v(i, "c"), v(o, "dkLen"), v(a, "asyncTick"), i < 1)
|
|
176
|
+
throw new Error("iterations (c) must be >= 1");
|
|
177
|
+
const f = ie(e, "password"), c = ie(n, "salt"), l = new Uint8Array(o), u = we.create(t, f), d = u._cloneInto().update(c);
|
|
178
|
+
return { c: i, dkLen: o, asyncTick: a, DK: l, PRF: u, PRFSalt: d };
|
|
179
|
+
}
|
|
180
|
+
function Je(t, e, n, s, r) {
|
|
181
|
+
return t.destroy(), e.destroy(), s && s.destroy(), B(r), n;
|
|
182
|
+
}
|
|
183
|
+
function qe(t, e, n, s) {
|
|
184
|
+
const { c: r, dkLen: i, DK: o, PRF: a, PRFSalt: f } = Ze(t, e, n, s);
|
|
185
|
+
let c;
|
|
186
|
+
const l = new Uint8Array(4), u = z(l), d = new Uint8Array(a.outputLen);
|
|
187
|
+
for (let w = 1, E = 0; E < i; w++, E += a.outputLen) {
|
|
188
|
+
const b = o.subarray(E, E + a.outputLen);
|
|
189
|
+
u.setInt32(0, w, !1), (c = f._cloneInto(c)).update(l).digestInto(d), b.set(d.subarray(0, b.length));
|
|
190
|
+
for (let h = 1; h < r; h++) {
|
|
191
|
+
a._cloneInto(c).update(d).digestInto(d);
|
|
192
|
+
for (let y = 0; y < b.length; y++)
|
|
193
|
+
b[y] ^= d[y];
|
|
194
|
+
}
|
|
195
|
+
}
|
|
196
|
+
return Je(a, f, o, c, d);
|
|
197
|
+
}
|
|
198
|
+
class Qe {
|
|
199
|
+
blockLen;
|
|
200
|
+
outputLen;
|
|
201
|
+
padOffset;
|
|
202
|
+
isLE;
|
|
203
|
+
// For partial updates less than block size
|
|
204
|
+
buffer;
|
|
205
|
+
view;
|
|
206
|
+
finished = !1;
|
|
207
|
+
length = 0;
|
|
208
|
+
pos = 0;
|
|
209
|
+
destroyed = !1;
|
|
210
|
+
constructor(e, n, s, r) {
|
|
211
|
+
this.blockLen = e, this.outputLen = n, this.padOffset = s, this.isLE = r, this.buffer = new Uint8Array(e), this.view = z(this.buffer);
|
|
212
|
+
}
|
|
213
|
+
update(e) {
|
|
214
|
+
Y(this), $(e);
|
|
215
|
+
const { view: n, buffer: s, blockLen: r } = this, i = e.length;
|
|
216
|
+
for (let o = 0; o < i; ) {
|
|
217
|
+
const a = Math.min(r - this.pos, i - o);
|
|
218
|
+
if (a === r) {
|
|
219
|
+
const f = z(e);
|
|
220
|
+
for (; r <= i - o; o += r)
|
|
221
|
+
this.process(f, o);
|
|
222
|
+
continue;
|
|
223
|
+
}
|
|
224
|
+
s.set(e.subarray(o, o + a), this.pos), this.pos += a, o += a, this.pos === r && (this.process(n, 0), this.pos = 0);
|
|
225
|
+
}
|
|
226
|
+
return this.length += e.length, this.roundClean(), this;
|
|
227
|
+
}
|
|
228
|
+
digestInto(e) {
|
|
229
|
+
Y(this), Ge(e, this), this.finished = !0;
|
|
230
|
+
const { buffer: n, view: s, blockLen: r, isLE: i } = this;
|
|
231
|
+
let { pos: o } = this;
|
|
232
|
+
n[o++] = 128, B(this.buffer.subarray(o)), this.padOffset > r - o && (this.process(s, 0), o = 0);
|
|
233
|
+
for (let u = o; u < r; u++)
|
|
234
|
+
n[u] = 0;
|
|
235
|
+
s.setBigUint64(r - 8, BigInt(this.length * 8), i), this.process(s, 0);
|
|
236
|
+
const a = z(e), f = this.outputLen;
|
|
237
|
+
if (f % 4)
|
|
238
|
+
throw new Error("_sha2: outputLen must be aligned to 32bit");
|
|
239
|
+
const c = f / 4, l = this.get();
|
|
240
|
+
if (c > l.length)
|
|
241
|
+
throw new Error("_sha2: outputLen bigger than state");
|
|
242
|
+
for (let u = 0; u < c; u++)
|
|
243
|
+
a.setUint32(4 * u, l[u], i);
|
|
244
|
+
}
|
|
245
|
+
digest() {
|
|
246
|
+
const { buffer: e, outputLen: n } = this;
|
|
247
|
+
this.digestInto(e);
|
|
248
|
+
const s = e.slice(0, n);
|
|
249
|
+
return this.destroy(), s;
|
|
250
|
+
}
|
|
251
|
+
_cloneInto(e) {
|
|
252
|
+
e ||= new this.constructor(), e.set(...this.get());
|
|
253
|
+
const { blockLen: n, buffer: s, length: r, finished: i, destroyed: o, pos: a } = this;
|
|
254
|
+
return e.destroyed = o, e.finished = i, e.length = r, e.pos = a, r % n && e.buffer.set(s), e;
|
|
255
|
+
}
|
|
256
|
+
clone() {
|
|
257
|
+
return this._cloneInto();
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
const x = /* @__PURE__ */ Uint32Array.from([
|
|
261
|
+
1779033703,
|
|
262
|
+
4089235720,
|
|
263
|
+
3144134277,
|
|
264
|
+
2227873595,
|
|
265
|
+
1013904242,
|
|
266
|
+
4271175723,
|
|
267
|
+
2773480762,
|
|
268
|
+
1595750129,
|
|
269
|
+
1359893119,
|
|
270
|
+
2917565137,
|
|
271
|
+
2600822924,
|
|
272
|
+
725511199,
|
|
273
|
+
528734635,
|
|
274
|
+
4215389547,
|
|
275
|
+
1541459225,
|
|
276
|
+
327033209
|
|
277
|
+
]), K = /* @__PURE__ */ BigInt(2 ** 32 - 1), oe = /* @__PURE__ */ BigInt(32);
|
|
278
|
+
function De(t, e = !1) {
|
|
279
|
+
return e ? { h: Number(t & K), l: Number(t >> oe & K) } : { h: Number(t >> oe & K) | 0, l: Number(t & K) | 0 };
|
|
280
|
+
}
|
|
281
|
+
function et(t, e = !1) {
|
|
282
|
+
const n = t.length;
|
|
283
|
+
let s = new Uint32Array(n), r = new Uint32Array(n);
|
|
284
|
+
for (let i = 0; i < n; i++) {
|
|
285
|
+
const { h: o, l: a } = De(t[i], e);
|
|
286
|
+
[s[i], r[i]] = [o, a];
|
|
287
|
+
}
|
|
288
|
+
return [s, r];
|
|
289
|
+
}
|
|
290
|
+
const ce = (t, e, n) => t >>> n, fe = (t, e, n) => t << 32 - n | e >>> n, k = (t, e, n) => t >>> n | e << 32 - n, U = (t, e, n) => t << 32 - n | e >>> n, G = (t, e, n) => t << 64 - n | e >>> n - 32, X = (t, e, n) => t >>> n - 32 | e << 64 - n;
|
|
291
|
+
function m(t, e, n, s) {
|
|
292
|
+
const r = (e >>> 0) + (s >>> 0);
|
|
293
|
+
return { h: t + n + (r / 2 ** 32 | 0) | 0, l: r | 0 };
|
|
294
|
+
}
|
|
295
|
+
const tt = (t, e, n) => (t >>> 0) + (e >>> 0) + (n >>> 0), nt = (t, e, n, s) => e + n + s + (t / 2 ** 32 | 0) | 0, st = (t, e, n, s) => (t >>> 0) + (e >>> 0) + (n >>> 0) + (s >>> 0), rt = (t, e, n, s, r) => e + n + s + r + (t / 2 ** 32 | 0) | 0, it = (t, e, n, s, r) => (t >>> 0) + (e >>> 0) + (n >>> 0) + (s >>> 0) + (r >>> 0), ot = (t, e, n, s, r, i) => e + n + s + r + i + (t / 2 ** 32 | 0) | 0, xe = et([
|
|
296
|
+
"0x428a2f98d728ae22",
|
|
297
|
+
"0x7137449123ef65cd",
|
|
298
|
+
"0xb5c0fbcfec4d3b2f",
|
|
299
|
+
"0xe9b5dba58189dbbc",
|
|
300
|
+
"0x3956c25bf348b538",
|
|
301
|
+
"0x59f111f1b605d019",
|
|
302
|
+
"0x923f82a4af194f9b",
|
|
303
|
+
"0xab1c5ed5da6d8118",
|
|
304
|
+
"0xd807aa98a3030242",
|
|
305
|
+
"0x12835b0145706fbe",
|
|
306
|
+
"0x243185be4ee4b28c",
|
|
307
|
+
"0x550c7dc3d5ffb4e2",
|
|
308
|
+
"0x72be5d74f27b896f",
|
|
309
|
+
"0x80deb1fe3b1696b1",
|
|
310
|
+
"0x9bdc06a725c71235",
|
|
311
|
+
"0xc19bf174cf692694",
|
|
312
|
+
"0xe49b69c19ef14ad2",
|
|
313
|
+
"0xefbe4786384f25e3",
|
|
314
|
+
"0x0fc19dc68b8cd5b5",
|
|
315
|
+
"0x240ca1cc77ac9c65",
|
|
316
|
+
"0x2de92c6f592b0275",
|
|
317
|
+
"0x4a7484aa6ea6e483",
|
|
318
|
+
"0x5cb0a9dcbd41fbd4",
|
|
319
|
+
"0x76f988da831153b5",
|
|
320
|
+
"0x983e5152ee66dfab",
|
|
321
|
+
"0xa831c66d2db43210",
|
|
322
|
+
"0xb00327c898fb213f",
|
|
323
|
+
"0xbf597fc7beef0ee4",
|
|
324
|
+
"0xc6e00bf33da88fc2",
|
|
325
|
+
"0xd5a79147930aa725",
|
|
326
|
+
"0x06ca6351e003826f",
|
|
327
|
+
"0x142929670a0e6e70",
|
|
328
|
+
"0x27b70a8546d22ffc",
|
|
329
|
+
"0x2e1b21385c26c926",
|
|
330
|
+
"0x4d2c6dfc5ac42aed",
|
|
331
|
+
"0x53380d139d95b3df",
|
|
332
|
+
"0x650a73548baf63de",
|
|
333
|
+
"0x766a0abb3c77b2a8",
|
|
334
|
+
"0x81c2c92e47edaee6",
|
|
335
|
+
"0x92722c851482353b",
|
|
336
|
+
"0xa2bfe8a14cf10364",
|
|
337
|
+
"0xa81a664bbc423001",
|
|
338
|
+
"0xc24b8b70d0f89791",
|
|
339
|
+
"0xc76c51a30654be30",
|
|
340
|
+
"0xd192e819d6ef5218",
|
|
341
|
+
"0xd69906245565a910",
|
|
342
|
+
"0xf40e35855771202a",
|
|
343
|
+
"0x106aa07032bbd1b8",
|
|
344
|
+
"0x19a4c116b8d2d0c8",
|
|
345
|
+
"0x1e376c085141ab53",
|
|
346
|
+
"0x2748774cdf8eeb99",
|
|
347
|
+
"0x34b0bcb5e19b48a8",
|
|
348
|
+
"0x391c0cb3c5c95a63",
|
|
349
|
+
"0x4ed8aa4ae3418acb",
|
|
350
|
+
"0x5b9cca4f7763e373",
|
|
351
|
+
"0x682e6ff3d6b2b8a3",
|
|
352
|
+
"0x748f82ee5defb2fc",
|
|
353
|
+
"0x78a5636f43172f60",
|
|
354
|
+
"0x84c87814a1f0ab72",
|
|
355
|
+
"0x8cc702081a6439ec",
|
|
356
|
+
"0x90befffa23631e28",
|
|
357
|
+
"0xa4506cebde82bde9",
|
|
358
|
+
"0xbef9a3f7b2c67915",
|
|
359
|
+
"0xc67178f2e372532b",
|
|
360
|
+
"0xca273eceea26619c",
|
|
361
|
+
"0xd186b8c721c0c207",
|
|
362
|
+
"0xeada7dd6cde0eb1e",
|
|
363
|
+
"0xf57d4f7fee6ed178",
|
|
364
|
+
"0x06f067aa72176fba",
|
|
365
|
+
"0x0a637dc5a2c898a6",
|
|
366
|
+
"0x113f9804bef90dae",
|
|
367
|
+
"0x1b710b35131c471b",
|
|
368
|
+
"0x28db77f523047d84",
|
|
369
|
+
"0x32caab7b40c72493",
|
|
370
|
+
"0x3c9ebe0a15c9bebc",
|
|
371
|
+
"0x431d67c49c100d4c",
|
|
372
|
+
"0x4cc5d4becb3e42b6",
|
|
373
|
+
"0x597f299cfc657e2a",
|
|
374
|
+
"0x5fcb6fab3ad6faec",
|
|
375
|
+
"0x6c44198c4a475817"
|
|
376
|
+
].map((t) => BigInt(t))), ct = xe[0], ft = xe[1], S = /* @__PURE__ */ new Uint32Array(80), P = /* @__PURE__ */ new Uint32Array(80);
|
|
377
|
+
class at extends Qe {
|
|
378
|
+
constructor(e) {
|
|
379
|
+
super(128, e, 16, !1);
|
|
380
|
+
}
|
|
381
|
+
// prettier-ignore
|
|
382
|
+
get() {
|
|
383
|
+
const { Ah: e, Al: n, Bh: s, Bl: r, Ch: i, Cl: o, Dh: a, Dl: f, Eh: c, El: l, Fh: u, Fl: d, Gh: w, Gl: E, Hh: b, Hl: h } = this;
|
|
384
|
+
return [e, n, s, r, i, o, a, f, c, l, u, d, w, E, b, h];
|
|
385
|
+
}
|
|
386
|
+
// prettier-ignore
|
|
387
|
+
set(e, n, s, r, i, o, a, f, c, l, u, d, w, E, b, h) {
|
|
388
|
+
this.Ah = e | 0, this.Al = n | 0, this.Bh = s | 0, this.Bl = r | 0, this.Ch = i | 0, this.Cl = o | 0, this.Dh = a | 0, this.Dl = f | 0, this.Eh = c | 0, this.El = l | 0, this.Fh = u | 0, this.Fl = d | 0, this.Gh = w | 0, this.Gl = E | 0, this.Hh = b | 0, this.Hl = h | 0;
|
|
389
|
+
}
|
|
390
|
+
process(e, n) {
|
|
391
|
+
for (let g = 0; g < 16; g++, n += 4)
|
|
392
|
+
S[g] = e.getUint32(n), P[g] = e.getUint32(n += 4);
|
|
393
|
+
for (let g = 16; g < 80; g++) {
|
|
394
|
+
const O = S[g - 15] | 0, L = P[g - 15] | 0, J = k(O, L, 1) ^ k(O, L, 8) ^ ce(O, L, 7), q = U(O, L, 1) ^ U(O, L, 8) ^ fe(O, L, 7), A = S[g - 2] | 0, C = P[g - 2] | 0, R = k(A, C, 19) ^ G(A, C, 61) ^ ce(A, C, 6), Q = U(A, C, 19) ^ X(A, C, 61) ^ fe(A, C, 6), j = st(q, Q, P[g - 7], P[g - 16]), D = rt(j, J, R, S[g - 7], S[g - 16]);
|
|
395
|
+
S[g] = D | 0, P[g] = j | 0;
|
|
396
|
+
}
|
|
397
|
+
let { Ah: s, Al: r, Bh: i, Bl: o, Ch: a, Cl: f, Dh: c, Dl: l, Eh: u, El: d, Fh: w, Fl: E, Gh: b, Gl: h, Hh: y, Hl: I } = this;
|
|
398
|
+
for (let g = 0; g < 80; g++) {
|
|
399
|
+
const O = k(u, d, 14) ^ k(u, d, 18) ^ G(u, d, 41), L = U(u, d, 14) ^ U(u, d, 18) ^ X(u, d, 41), J = u & w ^ ~u & b, q = d & E ^ ~d & h, A = it(I, L, q, ft[g], P[g]), C = ot(A, y, O, J, ct[g], S[g]), R = A | 0, Q = k(s, r, 28) ^ G(s, r, 34) ^ G(s, r, 39), j = U(s, r, 28) ^ X(s, r, 34) ^ X(s, r, 39), D = s & i ^ s & a ^ i & a, Ce = r & o ^ r & f ^ o & f;
|
|
400
|
+
y = b | 0, I = h | 0, b = w | 0, h = E | 0, w = u | 0, E = d | 0, { h: u, l: d } = m(c | 0, l | 0, C | 0, R | 0), c = a | 0, l = f | 0, a = i | 0, f = o | 0, i = s | 0, o = r | 0;
|
|
401
|
+
const re = tt(R, j, Ce);
|
|
402
|
+
s = nt(re, C, Q, D), r = re | 0;
|
|
403
|
+
}
|
|
404
|
+
({ h: s, l: r } = m(this.Ah | 0, this.Al | 0, s | 0, r | 0)), { h: i, l: o } = m(this.Bh | 0, this.Bl | 0, i | 0, o | 0), { h: a, l: f } = m(this.Ch | 0, this.Cl | 0, a | 0, f | 0), { h: c, l } = m(this.Dh | 0, this.Dl | 0, c | 0, l | 0), { h: u, l: d } = m(this.Eh | 0, this.El | 0, u | 0, d | 0), { h: w, l: E } = m(this.Fh | 0, this.Fl | 0, w | 0, E | 0), { h: b, l: h } = m(this.Gh | 0, this.Gl | 0, b | 0, h | 0), { h: y, l: I } = m(this.Hh | 0, this.Hl | 0, y | 0, I | 0), this.set(s, r, i, o, a, f, c, l, u, d, w, E, b, h, y, I);
|
|
405
|
+
}
|
|
406
|
+
roundClean() {
|
|
407
|
+
B(S, P);
|
|
408
|
+
}
|
|
409
|
+
destroy() {
|
|
410
|
+
B(this.buffer), this.set(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0);
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
class ut extends at {
|
|
414
|
+
Ah = x[0] | 0;
|
|
415
|
+
Al = x[1] | 0;
|
|
416
|
+
Bh = x[2] | 0;
|
|
417
|
+
Bl = x[3] | 0;
|
|
418
|
+
Ch = x[4] | 0;
|
|
419
|
+
Cl = x[5] | 0;
|
|
420
|
+
Dh = x[6] | 0;
|
|
421
|
+
Dl = x[7] | 0;
|
|
422
|
+
Eh = x[8] | 0;
|
|
423
|
+
El = x[9] | 0;
|
|
424
|
+
Fh = x[10] | 0;
|
|
425
|
+
Fl = x[11] | 0;
|
|
426
|
+
Gh = x[12] | 0;
|
|
427
|
+
Gl = x[13] | 0;
|
|
428
|
+
Hh = x[14] | 0;
|
|
429
|
+
Hl = x[15] | 0;
|
|
430
|
+
constructor() {
|
|
431
|
+
super(64);
|
|
432
|
+
}
|
|
433
|
+
}
|
|
434
|
+
const lt = /* @__PURE__ */ Ye(
|
|
435
|
+
() => new ut(),
|
|
436
|
+
/* @__PURE__ */ We(3)
|
|
437
|
+
), dt = (t, e, n, s) => Le.from(qe(lt, t, e, { c: n, dkLen: s })), Ne = ":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", ht = Ne + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", gt = "[" + Ne + "][" + ht + "]*", pt = new RegExp("^" + gt + "$");
|
|
438
|
+
function Te(t, e) {
|
|
439
|
+
const n = [];
|
|
440
|
+
let s = e.exec(t);
|
|
441
|
+
for (; s; ) {
|
|
442
|
+
const r = [];
|
|
443
|
+
r.startIndex = e.lastIndex - s[0].length;
|
|
444
|
+
const i = s.length;
|
|
445
|
+
for (let o = 0; o < i; o++)
|
|
446
|
+
r.push(s[o]);
|
|
447
|
+
n.push(r), s = e.exec(t);
|
|
448
|
+
}
|
|
449
|
+
return n;
|
|
450
|
+
}
|
|
451
|
+
const Z = function(t) {
|
|
452
|
+
const e = pt.exec(t);
|
|
453
|
+
return !(e === null || typeof e > "u");
|
|
454
|
+
};
|
|
455
|
+
function bt(t) {
|
|
456
|
+
return typeof t < "u";
|
|
457
|
+
}
|
|
458
|
+
const Et = {
|
|
459
|
+
allowBooleanAttributes: !1,
|
|
460
|
+
//A tag can have attributes without any value
|
|
461
|
+
unpairedTags: []
|
|
462
|
+
};
|
|
463
|
+
function yt(t, e) {
|
|
464
|
+
e = Object.assign({}, Et, e);
|
|
465
|
+
const n = [];
|
|
466
|
+
let s = !1, r = !1;
|
|
467
|
+
t[0] === "\uFEFF" && (t = t.substr(1));
|
|
468
|
+
for (let i = 0; i < t.length; i++)
|
|
469
|
+
if (t[i] === "<" && t[i + 1] === "?") {
|
|
470
|
+
if (i += 2, i = ue(t, i), i.err) return i;
|
|
471
|
+
} else if (t[i] === "<") {
|
|
472
|
+
let o = i;
|
|
473
|
+
if (i++, t[i] === "!") {
|
|
474
|
+
i = le(t, i);
|
|
475
|
+
continue;
|
|
476
|
+
} else {
|
|
477
|
+
let a = !1;
|
|
478
|
+
t[i] === "/" && (a = !0, i++);
|
|
479
|
+
let f = "";
|
|
480
|
+
for (; i < t.length && t[i] !== ">" && t[i] !== " " && t[i] !== " " && t[i] !== `
|
|
481
|
+
` && t[i] !== "\r"; i++)
|
|
482
|
+
f += t[i];
|
|
483
|
+
if (f = f.trim(), f[f.length - 1] === "/" && (f = f.substring(0, f.length - 1), i--), !mt(f)) {
|
|
484
|
+
let u;
|
|
485
|
+
return f.trim().length === 0 ? u = "Invalid space after '<'." : u = "Tag '" + f + "' is an invalid name.", p("InvalidTag", u, N(t, i));
|
|
486
|
+
}
|
|
487
|
+
const c = Nt(t, i);
|
|
488
|
+
if (c === !1)
|
|
489
|
+
return p("InvalidAttr", "Attributes for '" + f + "' have open quote.", N(t, i));
|
|
490
|
+
let l = c.value;
|
|
491
|
+
if (i = c.index, l[l.length - 1] === "/") {
|
|
492
|
+
const u = i - l.length;
|
|
493
|
+
l = l.substring(0, l.length - 1);
|
|
494
|
+
const d = de(l, e);
|
|
495
|
+
if (d === !0)
|
|
496
|
+
s = !0;
|
|
497
|
+
else
|
|
498
|
+
return p(d.err.code, d.err.msg, N(t, u + d.err.line));
|
|
499
|
+
} else if (a)
|
|
500
|
+
if (c.tagClosed) {
|
|
501
|
+
if (l.trim().length > 0)
|
|
502
|
+
return p("InvalidTag", "Closing tag '" + f + "' can't have attributes or invalid starting.", N(t, o));
|
|
503
|
+
if (n.length === 0)
|
|
504
|
+
return p("InvalidTag", "Closing tag '" + f + "' has not been opened.", N(t, o));
|
|
505
|
+
{
|
|
506
|
+
const u = n.pop();
|
|
507
|
+
if (f !== u.tagName) {
|
|
508
|
+
let d = N(t, u.tagStartPos);
|
|
509
|
+
return p(
|
|
510
|
+
"InvalidTag",
|
|
511
|
+
"Expected closing tag '" + u.tagName + "' (opened in line " + d.line + ", col " + d.col + ") instead of closing tag '" + f + "'.",
|
|
512
|
+
N(t, o)
|
|
513
|
+
);
|
|
514
|
+
}
|
|
515
|
+
n.length == 0 && (r = !0);
|
|
516
|
+
}
|
|
517
|
+
} else return p("InvalidTag", "Closing tag '" + f + "' doesn't have proper closing.", N(t, i));
|
|
518
|
+
else {
|
|
519
|
+
const u = de(l, e);
|
|
520
|
+
if (u !== !0)
|
|
521
|
+
return p(u.err.code, u.err.msg, N(t, i - l.length + u.err.line));
|
|
522
|
+
if (r === !0)
|
|
523
|
+
return p("InvalidXml", "Multiple possible root nodes found.", N(t, i));
|
|
524
|
+
e.unpairedTags.indexOf(f) !== -1 || n.push({ tagName: f, tagStartPos: o }), s = !0;
|
|
525
|
+
}
|
|
526
|
+
for (i++; i < t.length; i++)
|
|
527
|
+
if (t[i] === "<")
|
|
528
|
+
if (t[i + 1] === "!") {
|
|
529
|
+
i++, i = le(t, i);
|
|
530
|
+
continue;
|
|
531
|
+
} else if (t[i + 1] === "?") {
|
|
532
|
+
if (i = ue(t, ++i), i.err) return i;
|
|
533
|
+
} else
|
|
534
|
+
break;
|
|
535
|
+
else if (t[i] === "&") {
|
|
536
|
+
const u = At(t, i);
|
|
537
|
+
if (u == -1)
|
|
538
|
+
return p("InvalidChar", "char '&' is not expected.", N(t, i));
|
|
539
|
+
i = u;
|
|
540
|
+
} else if (r === !0 && !ae(t[i]))
|
|
541
|
+
return p("InvalidXml", "Extra text at the end", N(t, i));
|
|
542
|
+
t[i] === "<" && i--;
|
|
543
|
+
}
|
|
544
|
+
} else {
|
|
545
|
+
if (ae(t[i]))
|
|
546
|
+
continue;
|
|
547
|
+
return p("InvalidChar", "char '" + t[i] + "' is not expected.", N(t, i));
|
|
548
|
+
}
|
|
549
|
+
if (s) {
|
|
550
|
+
if (n.length == 1)
|
|
551
|
+
return p("InvalidTag", "Unclosed tag '" + n[0].tagName + "'.", N(t, n[0].tagStartPos));
|
|
552
|
+
if (n.length > 0)
|
|
553
|
+
return p("InvalidXml", "Invalid '" + JSON.stringify(n.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
|
|
554
|
+
} else return p("InvalidXml", "Start tag expected.", 1);
|
|
555
|
+
return !0;
|
|
556
|
+
}
|
|
557
|
+
function ae(t) {
|
|
558
|
+
return t === " " || t === " " || t === `
|
|
559
|
+
` || t === "\r";
|
|
560
|
+
}
|
|
561
|
+
function ue(t, e) {
|
|
562
|
+
const n = e;
|
|
563
|
+
for (; e < t.length; e++)
|
|
564
|
+
if (t[e] == "?" || t[e] == " ") {
|
|
565
|
+
const s = t.substr(n, e - n);
|
|
566
|
+
if (e > 5 && s === "xml")
|
|
567
|
+
return p("InvalidXml", "XML declaration allowed only at the start of the document.", N(t, e));
|
|
568
|
+
if (t[e] == "?" && t[e + 1] == ">") {
|
|
569
|
+
e++;
|
|
570
|
+
break;
|
|
571
|
+
} else
|
|
572
|
+
continue;
|
|
573
|
+
}
|
|
574
|
+
return e;
|
|
575
|
+
}
|
|
576
|
+
function le(t, e) {
|
|
577
|
+
if (t.length > e + 5 && t[e + 1] === "-" && t[e + 2] === "-") {
|
|
578
|
+
for (e += 3; e < t.length; e++)
|
|
579
|
+
if (t[e] === "-" && t[e + 1] === "-" && t[e + 2] === ">") {
|
|
580
|
+
e += 2;
|
|
581
|
+
break;
|
|
582
|
+
}
|
|
583
|
+
} 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") {
|
|
584
|
+
let n = 1;
|
|
585
|
+
for (e += 8; e < t.length; e++)
|
|
586
|
+
if (t[e] === "<")
|
|
587
|
+
n++;
|
|
588
|
+
else if (t[e] === ">" && (n--, n === 0))
|
|
589
|
+
break;
|
|
590
|
+
} 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] === "[") {
|
|
591
|
+
for (e += 8; e < t.length; e++)
|
|
592
|
+
if (t[e] === "]" && t[e + 1] === "]" && t[e + 2] === ">") {
|
|
593
|
+
e += 2;
|
|
594
|
+
break;
|
|
595
|
+
}
|
|
596
|
+
}
|
|
597
|
+
return e;
|
|
598
|
+
}
|
|
599
|
+
const wt = '"', xt = "'";
|
|
600
|
+
function Nt(t, e) {
|
|
601
|
+
let n = "", s = "", r = !1;
|
|
602
|
+
for (; e < t.length; e++) {
|
|
603
|
+
if (t[e] === wt || t[e] === xt)
|
|
604
|
+
s === "" ? s = t[e] : s !== t[e] || (s = "");
|
|
605
|
+
else if (t[e] === ">" && s === "") {
|
|
606
|
+
r = !0;
|
|
607
|
+
break;
|
|
608
|
+
}
|
|
609
|
+
n += t[e];
|
|
610
|
+
}
|
|
611
|
+
return s !== "" ? !1 : {
|
|
612
|
+
value: n,
|
|
613
|
+
index: e,
|
|
614
|
+
tagClosed: r
|
|
615
|
+
};
|
|
616
|
+
}
|
|
617
|
+
const Tt = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
|
|
618
|
+
function de(t, e) {
|
|
619
|
+
const n = Te(t, Tt), s = {};
|
|
620
|
+
for (let r = 0; r < n.length; r++) {
|
|
621
|
+
if (n[r][1].length === 0)
|
|
622
|
+
return p("InvalidAttr", "Attribute '" + n[r][2] + "' has no space in starting.", M(n[r]));
|
|
623
|
+
if (n[r][3] !== void 0 && n[r][4] === void 0)
|
|
624
|
+
return p("InvalidAttr", "Attribute '" + n[r][2] + "' is without value.", M(n[r]));
|
|
625
|
+
if (n[r][3] === void 0 && !e.allowBooleanAttributes)
|
|
626
|
+
return p("InvalidAttr", "boolean attribute '" + n[r][2] + "' is not allowed.", M(n[r]));
|
|
627
|
+
const i = n[r][2];
|
|
628
|
+
if (!Ct(i))
|
|
629
|
+
return p("InvalidAttr", "Attribute '" + i + "' is an invalid name.", M(n[r]));
|
|
630
|
+
if (!Object.prototype.hasOwnProperty.call(s, i))
|
|
631
|
+
s[i] = 1;
|
|
632
|
+
else
|
|
633
|
+
return p("InvalidAttr", "Attribute '" + i + "' is repeated.", M(n[r]));
|
|
634
|
+
}
|
|
635
|
+
return !0;
|
|
636
|
+
}
|
|
637
|
+
function It(t, e) {
|
|
638
|
+
let n = /\d/;
|
|
639
|
+
for (t[e] === "x" && (e++, n = /[\da-fA-F]/); e < t.length; e++) {
|
|
640
|
+
if (t[e] === ";")
|
|
641
|
+
return e;
|
|
642
|
+
if (!t[e].match(n))
|
|
643
|
+
break;
|
|
644
|
+
}
|
|
645
|
+
return -1;
|
|
646
|
+
}
|
|
647
|
+
function At(t, e) {
|
|
648
|
+
if (e++, t[e] === ";")
|
|
649
|
+
return -1;
|
|
650
|
+
if (t[e] === "#")
|
|
651
|
+
return e++, It(t, e);
|
|
652
|
+
let n = 0;
|
|
653
|
+
for (; e < t.length; e++, n++)
|
|
654
|
+
if (!(t[e].match(/\w/) && n < 20)) {
|
|
655
|
+
if (t[e] === ";")
|
|
656
|
+
break;
|
|
657
|
+
return -1;
|
|
658
|
+
}
|
|
659
|
+
return e;
|
|
660
|
+
}
|
|
661
|
+
function p(t, e, n) {
|
|
662
|
+
return {
|
|
663
|
+
err: {
|
|
664
|
+
code: t,
|
|
665
|
+
msg: e,
|
|
666
|
+
line: n.line || n,
|
|
667
|
+
col: n.col
|
|
668
|
+
}
|
|
669
|
+
};
|
|
670
|
+
}
|
|
671
|
+
function Ct(t) {
|
|
672
|
+
return Z(t);
|
|
673
|
+
}
|
|
674
|
+
function mt(t) {
|
|
675
|
+
return Z(t);
|
|
676
|
+
}
|
|
677
|
+
function N(t, e) {
|
|
678
|
+
const n = t.substring(0, e).split(/\r?\n/);
|
|
679
|
+
return {
|
|
680
|
+
line: n.length,
|
|
681
|
+
// column number is last line's length + 1, because column numbering starts at 1:
|
|
682
|
+
col: n[n.length - 1].length + 1
|
|
683
|
+
};
|
|
684
|
+
}
|
|
685
|
+
function M(t) {
|
|
686
|
+
return t.startIndex + t[1].length;
|
|
687
|
+
}
|
|
688
|
+
const Ot = {
|
|
689
|
+
preserveOrder: !1,
|
|
690
|
+
attributeNamePrefix: "@_",
|
|
691
|
+
attributesGroupName: !1,
|
|
692
|
+
textNodeName: "#text",
|
|
693
|
+
ignoreAttributes: !0,
|
|
694
|
+
removeNSPrefix: !1,
|
|
695
|
+
// remove NS from tag name or attribute name if true
|
|
696
|
+
allowBooleanAttributes: !1,
|
|
697
|
+
//a tag can have attributes without any value
|
|
698
|
+
//ignoreRootElement : false,
|
|
699
|
+
parseTagValue: !0,
|
|
700
|
+
parseAttributeValue: !1,
|
|
701
|
+
trimValues: !0,
|
|
702
|
+
//Trim string values of tag and attributes
|
|
703
|
+
cdataPropName: !1,
|
|
704
|
+
numberParseOptions: {
|
|
705
|
+
hex: !0,
|
|
706
|
+
leadingZeros: !0,
|
|
707
|
+
eNotation: !0
|
|
708
|
+
},
|
|
709
|
+
tagValueProcessor: function(t, e) {
|
|
710
|
+
return e;
|
|
711
|
+
},
|
|
712
|
+
attributeValueProcessor: function(t, e) {
|
|
713
|
+
return e;
|
|
714
|
+
},
|
|
715
|
+
stopNodes: [],
|
|
716
|
+
//nested tags will not be parsed even for errors
|
|
717
|
+
alwaysCreateTextNode: !1,
|
|
718
|
+
isArray: () => !1,
|
|
719
|
+
commentPropName: !1,
|
|
720
|
+
unpairedTags: [],
|
|
721
|
+
processEntities: !0,
|
|
722
|
+
htmlEntities: !1,
|
|
723
|
+
ignoreDeclaration: !1,
|
|
724
|
+
ignorePiTags: !1,
|
|
725
|
+
transformTagName: !1,
|
|
726
|
+
transformAttributeName: !1,
|
|
727
|
+
updateTag: function(t, e, n) {
|
|
728
|
+
return t;
|
|
729
|
+
},
|
|
730
|
+
// skipEmptyListItem: false
|
|
731
|
+
captureMetaData: !1,
|
|
732
|
+
maxNestedTags: 100,
|
|
733
|
+
strictReservedNames: !0
|
|
734
|
+
};
|
|
735
|
+
function Ie(t) {
|
|
736
|
+
return typeof t == "boolean" ? {
|
|
737
|
+
enabled: t,
|
|
738
|
+
// true or false
|
|
739
|
+
maxEntitySize: 1e4,
|
|
740
|
+
maxExpansionDepth: 10,
|
|
741
|
+
maxTotalExpansions: 1e3,
|
|
742
|
+
maxExpandedLength: 1e5,
|
|
743
|
+
maxEntityCount: 100,
|
|
744
|
+
allowedTags: null,
|
|
745
|
+
tagFilter: null
|
|
746
|
+
} : typeof t == "object" && t !== null ? {
|
|
747
|
+
enabled: t.enabled !== !1,
|
|
748
|
+
// default true if not specified
|
|
749
|
+
maxEntitySize: t.maxEntitySize ?? 1e4,
|
|
750
|
+
maxExpansionDepth: t.maxExpansionDepth ?? 10,
|
|
751
|
+
maxTotalExpansions: t.maxTotalExpansions ?? 1e3,
|
|
752
|
+
maxExpandedLength: t.maxExpandedLength ?? 1e5,
|
|
753
|
+
maxEntityCount: t.maxEntityCount ?? 100,
|
|
754
|
+
allowedTags: t.allowedTags ?? null,
|
|
755
|
+
tagFilter: t.tagFilter ?? null
|
|
756
|
+
} : Ie(!0);
|
|
757
|
+
}
|
|
758
|
+
const Lt = function(t) {
|
|
759
|
+
const e = Object.assign({}, Ot, t);
|
|
760
|
+
return e.processEntities = Ie(e.processEntities), e;
|
|
761
|
+
};
|
|
762
|
+
let W;
|
|
763
|
+
typeof Symbol != "function" ? W = "@@xmlMetadata" : W = /* @__PURE__ */ Symbol("XML Node Metadata");
|
|
764
|
+
class H {
|
|
765
|
+
constructor(e) {
|
|
766
|
+
this.tagname = e, this.child = [], this[":@"] = /* @__PURE__ */ Object.create(null);
|
|
767
|
+
}
|
|
768
|
+
add(e, n) {
|
|
769
|
+
e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: n });
|
|
770
|
+
}
|
|
771
|
+
addChild(e, n) {
|
|
772
|
+
e.tagname === "__proto__" && (e.tagname = "#__proto__"), e[":@"] && Object.keys(e[":@"]).length > 0 ? this.child.push({ [e.tagname]: e.child, ":@": e[":@"] }) : this.child.push({ [e.tagname]: e.child }), n !== void 0 && (this.child[this.child.length - 1][W] = { startIndex: n });
|
|
773
|
+
}
|
|
774
|
+
/** symbol used for metadata */
|
|
775
|
+
static getMetaDataSymbol() {
|
|
776
|
+
return W;
|
|
777
|
+
}
|
|
778
|
+
}
|
|
779
|
+
class St {
|
|
780
|
+
constructor(e) {
|
|
781
|
+
this.suppressValidationErr = !e, this.options = e;
|
|
782
|
+
}
|
|
783
|
+
readDocType(e, n) {
|
|
784
|
+
const s = /* @__PURE__ */ Object.create(null);
|
|
785
|
+
let r = 0;
|
|
786
|
+
if (e[n + 3] === "O" && e[n + 4] === "C" && e[n + 5] === "T" && e[n + 6] === "Y" && e[n + 7] === "P" && e[n + 8] === "E") {
|
|
787
|
+
n = n + 9;
|
|
788
|
+
let i = 1, o = !1, a = !1, f = "";
|
|
789
|
+
for (; n < e.length; n++)
|
|
790
|
+
if (e[n] === "<" && !a) {
|
|
791
|
+
if (o && _(e, "!ENTITY", n)) {
|
|
792
|
+
n += 7;
|
|
793
|
+
let c, l;
|
|
794
|
+
if ([c, l, n] = this.readEntityExp(e, n + 1, this.suppressValidationErr), l.indexOf("&") === -1) {
|
|
795
|
+
if (this.options.enabled !== !1 && this.options.maxEntityCount && r >= this.options.maxEntityCount)
|
|
796
|
+
throw new Error(
|
|
797
|
+
`Entity count (${r + 1}) exceeds maximum allowed (${this.options.maxEntityCount})`
|
|
798
|
+
);
|
|
799
|
+
const u = c.replace(/[.\-+*:]/g, "\\.");
|
|
800
|
+
s[c] = {
|
|
801
|
+
regx: RegExp(`&${u};`, "g"),
|
|
802
|
+
val: l
|
|
803
|
+
}, r++;
|
|
804
|
+
}
|
|
805
|
+
} else if (o && _(e, "!ELEMENT", n)) {
|
|
806
|
+
n += 8;
|
|
807
|
+
const { index: c } = this.readElementExp(e, n + 1);
|
|
808
|
+
n = c;
|
|
809
|
+
} else if (o && _(e, "!ATTLIST", n))
|
|
810
|
+
n += 8;
|
|
811
|
+
else if (o && _(e, "!NOTATION", n)) {
|
|
812
|
+
n += 9;
|
|
813
|
+
const { index: c } = this.readNotationExp(e, n + 1, this.suppressValidationErr);
|
|
814
|
+
n = c;
|
|
815
|
+
} else if (_(e, "!--", n)) a = !0;
|
|
816
|
+
else throw new Error("Invalid DOCTYPE");
|
|
817
|
+
i++, f = "";
|
|
818
|
+
} else if (e[n] === ">") {
|
|
819
|
+
if (a ? e[n - 1] === "-" && e[n - 2] === "-" && (a = !1, i--) : i--, i === 0)
|
|
820
|
+
break;
|
|
821
|
+
} else e[n] === "[" ? o = !0 : f += e[n];
|
|
822
|
+
if (i !== 0)
|
|
823
|
+
throw new Error("Unclosed DOCTYPE");
|
|
824
|
+
} else
|
|
825
|
+
throw new Error("Invalid Tag instead of DOCTYPE");
|
|
826
|
+
return { entities: s, i: n };
|
|
827
|
+
}
|
|
828
|
+
readEntityExp(e, n) {
|
|
829
|
+
n = T(e, n);
|
|
830
|
+
let s = "";
|
|
831
|
+
for (; n < e.length && !/\s/.test(e[n]) && e[n] !== '"' && e[n] !== "'"; )
|
|
832
|
+
s += e[n], n++;
|
|
833
|
+
if (V(s), n = T(e, n), !this.suppressValidationErr) {
|
|
834
|
+
if (e.substring(n, n + 6).toUpperCase() === "SYSTEM")
|
|
835
|
+
throw new Error("External entities are not supported");
|
|
836
|
+
if (e[n] === "%")
|
|
837
|
+
throw new Error("Parameter entities are not supported");
|
|
838
|
+
}
|
|
839
|
+
let r = "";
|
|
840
|
+
if ([n, r] = this.readIdentifierVal(e, n, "entity"), this.options.enabled !== !1 && this.options.maxEntitySize && r.length > this.options.maxEntitySize)
|
|
841
|
+
throw new Error(
|
|
842
|
+
`Entity "${s}" size (${r.length}) exceeds maximum allowed size (${this.options.maxEntitySize})`
|
|
843
|
+
);
|
|
844
|
+
return n--, [s, r, n];
|
|
845
|
+
}
|
|
846
|
+
readNotationExp(e, n) {
|
|
847
|
+
n = T(e, n);
|
|
848
|
+
let s = "";
|
|
849
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
850
|
+
s += e[n], n++;
|
|
851
|
+
!this.suppressValidationErr && V(s), n = T(e, n);
|
|
852
|
+
const r = e.substring(n, n + 6).toUpperCase();
|
|
853
|
+
if (!this.suppressValidationErr && r !== "SYSTEM" && r !== "PUBLIC")
|
|
854
|
+
throw new Error(`Expected SYSTEM or PUBLIC, found "${r}"`);
|
|
855
|
+
n += r.length, n = T(e, n);
|
|
856
|
+
let i = null, o = null;
|
|
857
|
+
if (r === "PUBLIC")
|
|
858
|
+
[n, i] = this.readIdentifierVal(e, n, "publicIdentifier"), n = T(e, n), (e[n] === '"' || e[n] === "'") && ([n, o] = this.readIdentifierVal(e, n, "systemIdentifier"));
|
|
859
|
+
else if (r === "SYSTEM" && ([n, o] = this.readIdentifierVal(e, n, "systemIdentifier"), !this.suppressValidationErr && !o))
|
|
860
|
+
throw new Error("Missing mandatory system identifier for SYSTEM notation");
|
|
861
|
+
return { notationName: s, publicIdentifier: i, systemIdentifier: o, index: --n };
|
|
862
|
+
}
|
|
863
|
+
readIdentifierVal(e, n, s) {
|
|
864
|
+
let r = "";
|
|
865
|
+
const i = e[n];
|
|
866
|
+
if (i !== '"' && i !== "'")
|
|
867
|
+
throw new Error(`Expected quoted string, found "${i}"`);
|
|
868
|
+
for (n++; n < e.length && e[n] !== i; )
|
|
869
|
+
r += e[n], n++;
|
|
870
|
+
if (e[n] !== i)
|
|
871
|
+
throw new Error(`Unterminated ${s} value`);
|
|
872
|
+
return n++, [n, r];
|
|
873
|
+
}
|
|
874
|
+
readElementExp(e, n) {
|
|
875
|
+
n = T(e, n);
|
|
876
|
+
let s = "";
|
|
877
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
878
|
+
s += e[n], n++;
|
|
879
|
+
if (!this.suppressValidationErr && !Z(s))
|
|
880
|
+
throw new Error(`Invalid element name: "${s}"`);
|
|
881
|
+
n = T(e, n);
|
|
882
|
+
let r = "";
|
|
883
|
+
if (e[n] === "E" && _(e, "MPTY", n)) n += 4;
|
|
884
|
+
else if (e[n] === "A" && _(e, "NY", n)) n += 2;
|
|
885
|
+
else if (e[n] === "(") {
|
|
886
|
+
for (n++; n < e.length && e[n] !== ")"; )
|
|
887
|
+
r += e[n], n++;
|
|
888
|
+
if (e[n] !== ")")
|
|
889
|
+
throw new Error("Unterminated content model");
|
|
890
|
+
} else if (!this.suppressValidationErr)
|
|
891
|
+
throw new Error(`Invalid Element Expression, found "${e[n]}"`);
|
|
892
|
+
return {
|
|
893
|
+
elementName: s,
|
|
894
|
+
contentModel: r.trim(),
|
|
895
|
+
index: n
|
|
896
|
+
};
|
|
897
|
+
}
|
|
898
|
+
readAttlistExp(e, n) {
|
|
899
|
+
n = T(e, n);
|
|
900
|
+
let s = "";
|
|
901
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
902
|
+
s += e[n], n++;
|
|
903
|
+
V(s), n = T(e, n);
|
|
904
|
+
let r = "";
|
|
905
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
906
|
+
r += e[n], n++;
|
|
907
|
+
if (!V(r))
|
|
908
|
+
throw new Error(`Invalid attribute name: "${r}"`);
|
|
909
|
+
n = T(e, n);
|
|
910
|
+
let i = "";
|
|
911
|
+
if (e.substring(n, n + 8).toUpperCase() === "NOTATION") {
|
|
912
|
+
if (i = "NOTATION", n += 8, n = T(e, n), e[n] !== "(")
|
|
913
|
+
throw new Error(`Expected '(', found "${e[n]}"`);
|
|
914
|
+
n++;
|
|
915
|
+
let a = [];
|
|
916
|
+
for (; n < e.length && e[n] !== ")"; ) {
|
|
917
|
+
let f = "";
|
|
918
|
+
for (; n < e.length && e[n] !== "|" && e[n] !== ")"; )
|
|
919
|
+
f += e[n], n++;
|
|
920
|
+
if (f = f.trim(), !V(f))
|
|
921
|
+
throw new Error(`Invalid notation name: "${f}"`);
|
|
922
|
+
a.push(f), e[n] === "|" && (n++, n = T(e, n));
|
|
923
|
+
}
|
|
924
|
+
if (e[n] !== ")")
|
|
925
|
+
throw new Error("Unterminated list of notations");
|
|
926
|
+
n++, i += " (" + a.join("|") + ")";
|
|
927
|
+
} else {
|
|
928
|
+
for (; n < e.length && !/\s/.test(e[n]); )
|
|
929
|
+
i += e[n], n++;
|
|
930
|
+
const a = ["CDATA", "ID", "IDREF", "IDREFS", "ENTITY", "ENTITIES", "NMTOKEN", "NMTOKENS"];
|
|
931
|
+
if (!this.suppressValidationErr && !a.includes(i.toUpperCase()))
|
|
932
|
+
throw new Error(`Invalid attribute type: "${i}"`);
|
|
933
|
+
}
|
|
934
|
+
n = T(e, n);
|
|
935
|
+
let o = "";
|
|
936
|
+
return e.substring(n, n + 8).toUpperCase() === "#REQUIRED" ? (o = "#REQUIRED", n += 8) : e.substring(n, n + 7).toUpperCase() === "#IMPLIED" ? (o = "#IMPLIED", n += 7) : [n, o] = this.readIdentifierVal(e, n, "ATTLIST"), {
|
|
937
|
+
elementName: s,
|
|
938
|
+
attributeName: r,
|
|
939
|
+
attributeType: i,
|
|
940
|
+
defaultValue: o,
|
|
941
|
+
index: n
|
|
942
|
+
};
|
|
943
|
+
}
|
|
944
|
+
}
|
|
945
|
+
const T = (t, e) => {
|
|
946
|
+
for (; e < t.length && /\s/.test(t[e]); )
|
|
947
|
+
e++;
|
|
948
|
+
return e;
|
|
949
|
+
};
|
|
950
|
+
function _(t, e, n) {
|
|
951
|
+
for (let s = 0; s < e.length; s++)
|
|
952
|
+
if (e[s] !== t[n + s + 1]) return !1;
|
|
953
|
+
return !0;
|
|
954
|
+
}
|
|
955
|
+
function V(t) {
|
|
956
|
+
if (Z(t))
|
|
957
|
+
return t;
|
|
958
|
+
throw new Error(`Invalid entity name ${t}`);
|
|
959
|
+
}
|
|
960
|
+
const Pt = /^[-+]?0x[a-fA-F0-9]+$/, Ht = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, _t = {
|
|
961
|
+
hex: !0,
|
|
962
|
+
// oct: false,
|
|
963
|
+
leadingZeros: !0,
|
|
964
|
+
decimalPoint: ".",
|
|
965
|
+
eNotation: !0,
|
|
966
|
+
//skipLike: /regex/,
|
|
967
|
+
infinity: "original"
|
|
968
|
+
// "null", "infinity" (Infinity type), "string" ("Infinity" (the string literal))
|
|
969
|
+
};
|
|
970
|
+
function Ft(t, e = {}) {
|
|
971
|
+
if (e = Object.assign({}, _t, e), !t || typeof t != "string") return t;
|
|
972
|
+
let n = t.trim();
|
|
973
|
+
if (e.skipLike !== void 0 && e.skipLike.test(n)) return t;
|
|
974
|
+
if (t === "0") return 0;
|
|
975
|
+
if (e.hex && Pt.test(n))
|
|
976
|
+
return Vt(n, 16);
|
|
977
|
+
if (isFinite(n)) {
|
|
978
|
+
if (n.includes("e") || n.includes("E"))
|
|
979
|
+
return Ut(t, n, e);
|
|
980
|
+
{
|
|
981
|
+
const s = Ht.exec(n);
|
|
982
|
+
if (s) {
|
|
983
|
+
const r = s[1] || "", i = s[2];
|
|
984
|
+
let o = Mt(s[3]);
|
|
985
|
+
const a = r ? (
|
|
986
|
+
// 0., -00., 000.
|
|
987
|
+
t[i.length + 1] === "."
|
|
988
|
+
) : t[i.length] === ".";
|
|
989
|
+
if (!e.leadingZeros && (i.length > 1 || i.length === 1 && !a))
|
|
990
|
+
return t;
|
|
991
|
+
{
|
|
992
|
+
const f = Number(n), c = String(f);
|
|
993
|
+
if (f === 0) return f;
|
|
994
|
+
if (c.search(/[eE]/) !== -1)
|
|
995
|
+
return e.eNotation ? f : t;
|
|
996
|
+
if (n.indexOf(".") !== -1)
|
|
997
|
+
return c === "0" || c === o || c === `${r}${o}` ? f : t;
|
|
998
|
+
let l = i ? o : n;
|
|
999
|
+
return i ? l === c || r + l === c ? f : t : l === c || l === r + c ? f : t;
|
|
1000
|
+
}
|
|
1001
|
+
} else
|
|
1002
|
+
return t;
|
|
1003
|
+
}
|
|
1004
|
+
} else return vt(t, Number(n), e);
|
|
1005
|
+
}
|
|
1006
|
+
const kt = /^([-+])?(0*)(\d*(\.\d*)?[eE][-\+]?\d+)$/;
|
|
1007
|
+
function Ut(t, e, n) {
|
|
1008
|
+
if (!n.eNotation) return t;
|
|
1009
|
+
const s = e.match(kt);
|
|
1010
|
+
if (s) {
|
|
1011
|
+
let r = s[1] || "";
|
|
1012
|
+
const i = s[3].indexOf("e") === -1 ? "E" : "e", o = s[2], a = r ? (
|
|
1013
|
+
// 0E.
|
|
1014
|
+
t[o.length + 1] === i
|
|
1015
|
+
) : t[o.length] === i;
|
|
1016
|
+
return o.length > 1 && a ? t : o.length === 1 && (s[3].startsWith(`.${i}`) || s[3][0] === i) ? Number(e) : n.leadingZeros && !a ? (e = (s[1] || "") + s[3], Number(e)) : t;
|
|
1017
|
+
} else
|
|
1018
|
+
return t;
|
|
1019
|
+
}
|
|
1020
|
+
function Mt(t) {
|
|
1021
|
+
return t && t.indexOf(".") !== -1 && (t = t.replace(/0+$/, ""), t === "." ? t = "0" : t[0] === "." ? t = "0" + t : t[t.length - 1] === "." && (t = t.substring(0, t.length - 1))), t;
|
|
1022
|
+
}
|
|
1023
|
+
function Vt(t, e) {
|
|
1024
|
+
if (parseInt) return parseInt(t, e);
|
|
1025
|
+
if (Number.parseInt) return Number.parseInt(t, e);
|
|
1026
|
+
if (window && window.parseInt) return window.parseInt(t, e);
|
|
1027
|
+
throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
|
|
1028
|
+
}
|
|
1029
|
+
function vt(t, e, n) {
|
|
1030
|
+
const s = e === 1 / 0;
|
|
1031
|
+
switch (n.infinity.toLowerCase()) {
|
|
1032
|
+
case "null":
|
|
1033
|
+
return null;
|
|
1034
|
+
case "infinity":
|
|
1035
|
+
return e;
|
|
1036
|
+
// Return Infinity or -Infinity
|
|
1037
|
+
case "string":
|
|
1038
|
+
return s ? "Infinity" : "-Infinity";
|
|
1039
|
+
default:
|
|
1040
|
+
return t;
|
|
1041
|
+
}
|
|
1042
|
+
}
|
|
1043
|
+
function $t(t) {
|
|
1044
|
+
return typeof t == "function" ? t : Array.isArray(t) ? (e) => {
|
|
1045
|
+
for (const n of t)
|
|
1046
|
+
if (typeof n == "string" && e === n || n instanceof RegExp && n.test(e))
|
|
1047
|
+
return !0;
|
|
1048
|
+
} : () => !1;
|
|
1049
|
+
}
|
|
1050
|
+
class Bt {
|
|
1051
|
+
constructor(e) {
|
|
1052
|
+
if (this.options = e, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
|
|
1053
|
+
apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
|
|
1054
|
+
gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
|
|
1055
|
+
lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
|
|
1056
|
+
quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
|
|
1057
|
+
}, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
|
|
1058
|
+
space: { regex: /&(nbsp|#160);/g, val: " " },
|
|
1059
|
+
// "lt" : { regex: /&(lt|#60);/g, val: "<" },
|
|
1060
|
+
// "gt" : { regex: /&(gt|#62);/g, val: ">" },
|
|
1061
|
+
// "amp" : { regex: /&(amp|#38);/g, val: "&" },
|
|
1062
|
+
// "quot" : { regex: /&(quot|#34);/g, val: "\"" },
|
|
1063
|
+
// "apos" : { regex: /&(apos|#39);/g, val: "'" },
|
|
1064
|
+
cent: { regex: /&(cent|#162);/g, val: "¢" },
|
|
1065
|
+
pound: { regex: /&(pound|#163);/g, val: "£" },
|
|
1066
|
+
yen: { regex: /&(yen|#165);/g, val: "¥" },
|
|
1067
|
+
euro: { regex: /&(euro|#8364);/g, val: "€" },
|
|
1068
|
+
copyright: { regex: /&(copy|#169);/g, val: "©" },
|
|
1069
|
+
reg: { regex: /&(reg|#174);/g, val: "®" },
|
|
1070
|
+
inr: { regex: /&(inr|#8377);/g, val: "₹" },
|
|
1071
|
+
num_dec: { regex: /&#([0-9]{1,7});/g, val: (n, s) => he(s, 10, "&#") },
|
|
1072
|
+
num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (n, s) => he(s, 16, "&#x") }
|
|
1073
|
+
}, this.addExternalEntities = Rt, this.parseXml = zt, this.parseTextData = jt, this.resolveNameSpace = Kt, this.buildAttributesMap = Xt, this.isItStopNode = Jt, this.replaceEntitiesValue = Wt, this.readStopNodeData = Qt, this.saveTextToParentTag = Zt, this.addChild = Yt, this.ignoreAttributesFn = $t(this.options.ignoreAttributes), this.entityExpansionCount = 0, this.currentExpandedLength = 0, this.options.stopNodes && this.options.stopNodes.length > 0) {
|
|
1074
|
+
this.stopNodesExact = /* @__PURE__ */ new Set(), this.stopNodesWildcard = /* @__PURE__ */ new Set();
|
|
1075
|
+
for (let n = 0; n < this.options.stopNodes.length; n++) {
|
|
1076
|
+
const s = this.options.stopNodes[n];
|
|
1077
|
+
typeof s == "string" && (s.startsWith("*.") ? this.stopNodesWildcard.add(s.substring(2)) : this.stopNodesExact.add(s));
|
|
1078
|
+
}
|
|
1079
|
+
}
|
|
1080
|
+
}
|
|
1081
|
+
}
|
|
1082
|
+
function Rt(t) {
|
|
1083
|
+
const e = Object.keys(t);
|
|
1084
|
+
for (let n = 0; n < e.length; n++) {
|
|
1085
|
+
const s = e[n], r = s.replace(/[.\-+*:]/g, "\\.");
|
|
1086
|
+
this.lastEntities[s] = {
|
|
1087
|
+
regex: new RegExp("&" + r + ";", "g"),
|
|
1088
|
+
val: t[s]
|
|
1089
|
+
};
|
|
1090
|
+
}
|
|
1091
|
+
}
|
|
1092
|
+
function jt(t, e, n, s, r, i, o) {
|
|
1093
|
+
if (t !== void 0 && (this.options.trimValues && !s && (t = t.trim()), t.length > 0)) {
|
|
1094
|
+
o || (t = this.replaceEntitiesValue(t, e, n));
|
|
1095
|
+
const a = this.options.tagValueProcessor(e, t, n, r, i);
|
|
1096
|
+
return a == null ? t : typeof a != typeof t || a !== t ? a : this.options.trimValues ? ne(t, this.options.parseTagValue, this.options.numberParseOptions) : t.trim() === t ? ne(t, this.options.parseTagValue, this.options.numberParseOptions) : t;
|
|
1097
|
+
}
|
|
1098
|
+
}
|
|
1099
|
+
function Kt(t) {
|
|
1100
|
+
if (this.options.removeNSPrefix) {
|
|
1101
|
+
const e = t.split(":"), n = t.charAt(0) === "/" ? "/" : "";
|
|
1102
|
+
if (e[0] === "xmlns")
|
|
1103
|
+
return "";
|
|
1104
|
+
e.length === 2 && (t = n + e[1]);
|
|
1105
|
+
}
|
|
1106
|
+
return t;
|
|
1107
|
+
}
|
|
1108
|
+
const Gt = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
|
|
1109
|
+
function Xt(t, e, n) {
|
|
1110
|
+
if (this.options.ignoreAttributes !== !0 && typeof t == "string") {
|
|
1111
|
+
const s = Te(t, Gt), r = s.length, i = {};
|
|
1112
|
+
for (let o = 0; o < r; o++) {
|
|
1113
|
+
const a = this.resolveNameSpace(s[o][1]);
|
|
1114
|
+
if (this.ignoreAttributesFn(a, e))
|
|
1115
|
+
continue;
|
|
1116
|
+
let f = s[o][4], c = this.options.attributeNamePrefix + a;
|
|
1117
|
+
if (a.length)
|
|
1118
|
+
if (this.options.transformAttributeName && (c = this.options.transformAttributeName(c)), c === "__proto__" && (c = "#__proto__"), f !== void 0) {
|
|
1119
|
+
this.options.trimValues && (f = f.trim()), f = this.replaceEntitiesValue(f, n, e);
|
|
1120
|
+
const l = this.options.attributeValueProcessor(a, f, e);
|
|
1121
|
+
l == null ? i[c] = f : typeof l != typeof f || l !== f ? i[c] = l : i[c] = ne(
|
|
1122
|
+
f,
|
|
1123
|
+
this.options.parseAttributeValue,
|
|
1124
|
+
this.options.numberParseOptions
|
|
1125
|
+
);
|
|
1126
|
+
} else this.options.allowBooleanAttributes && (i[c] = !0);
|
|
1127
|
+
}
|
|
1128
|
+
if (!Object.keys(i).length)
|
|
1129
|
+
return;
|
|
1130
|
+
if (this.options.attributesGroupName) {
|
|
1131
|
+
const o = {};
|
|
1132
|
+
return o[this.options.attributesGroupName] = i, o;
|
|
1133
|
+
}
|
|
1134
|
+
return i;
|
|
1135
|
+
}
|
|
1136
|
+
}
|
|
1137
|
+
const zt = function(t) {
|
|
1138
|
+
t = t.replace(/\r\n?/g, `
|
|
1139
|
+
`);
|
|
1140
|
+
const e = new H("!xml");
|
|
1141
|
+
let n = e, s = "", r = "";
|
|
1142
|
+
this.entityExpansionCount = 0, this.currentExpandedLength = 0;
|
|
1143
|
+
const i = new St(this.options.processEntities);
|
|
1144
|
+
for (let o = 0; o < t.length; o++)
|
|
1145
|
+
if (t[o] === "<")
|
|
1146
|
+
if (t[o + 1] === "/") {
|
|
1147
|
+
const f = F(t, ">", o, "Closing Tag is not closed.");
|
|
1148
|
+
let c = t.substring(o + 2, f).trim();
|
|
1149
|
+
if (this.options.removeNSPrefix) {
|
|
1150
|
+
const d = c.indexOf(":");
|
|
1151
|
+
d !== -1 && (c = c.substr(d + 1));
|
|
1152
|
+
}
|
|
1153
|
+
this.options.transformTagName && (c = this.options.transformTagName(c)), n && (s = this.saveTextToParentTag(s, n, r));
|
|
1154
|
+
const l = r.substring(r.lastIndexOf(".") + 1);
|
|
1155
|
+
if (c && this.options.unpairedTags.indexOf(c) !== -1)
|
|
1156
|
+
throw new Error(`Unpaired tag can not be used as closing tag: </${c}>`);
|
|
1157
|
+
let u = 0;
|
|
1158
|
+
l && this.options.unpairedTags.indexOf(l) !== -1 ? (u = r.lastIndexOf(".", r.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : u = r.lastIndexOf("."), r = r.substring(0, u), n = this.tagsNodeStack.pop(), s = "", o = f;
|
|
1159
|
+
} else if (t[o + 1] === "?") {
|
|
1160
|
+
let f = te(t, o, !1, "?>");
|
|
1161
|
+
if (!f) throw new Error("Pi Tag is not closed.");
|
|
1162
|
+
if (s = this.saveTextToParentTag(s, n, r), !(this.options.ignoreDeclaration && f.tagName === "?xml" || this.options.ignorePiTags)) {
|
|
1163
|
+
const c = new H(f.tagName);
|
|
1164
|
+
c.add(this.options.textNodeName, ""), f.tagName !== f.tagExp && f.attrExpPresent && (c[":@"] = this.buildAttributesMap(f.tagExp, r, f.tagName)), this.addChild(n, c, r, o);
|
|
1165
|
+
}
|
|
1166
|
+
o = f.closeIndex + 1;
|
|
1167
|
+
} else if (t.substr(o + 1, 3) === "!--") {
|
|
1168
|
+
const f = F(t, "-->", o + 4, "Comment is not closed.");
|
|
1169
|
+
if (this.options.commentPropName) {
|
|
1170
|
+
const c = t.substring(o + 4, f - 2);
|
|
1171
|
+
s = this.saveTextToParentTag(s, n, r), n.add(this.options.commentPropName, [{ [this.options.textNodeName]: c }]);
|
|
1172
|
+
}
|
|
1173
|
+
o = f;
|
|
1174
|
+
} else if (t.substr(o + 1, 2) === "!D") {
|
|
1175
|
+
const f = i.readDocType(t, o);
|
|
1176
|
+
this.docTypeEntities = f.entities, o = f.i;
|
|
1177
|
+
} else if (t.substr(o + 1, 2) === "![") {
|
|
1178
|
+
const f = F(t, "]]>", o, "CDATA is not closed.") - 2, c = t.substring(o + 9, f);
|
|
1179
|
+
s = this.saveTextToParentTag(s, n, r);
|
|
1180
|
+
let l = this.parseTextData(c, n.tagname, r, !0, !1, !0, !0);
|
|
1181
|
+
l == null && (l = ""), this.options.cdataPropName ? n.add(this.options.cdataPropName, [{ [this.options.textNodeName]: c }]) : n.add(this.options.textNodeName, l), o = f + 2;
|
|
1182
|
+
} else {
|
|
1183
|
+
let f = te(t, o, this.options.removeNSPrefix), c = f.tagName;
|
|
1184
|
+
const l = f.rawTagName;
|
|
1185
|
+
let u = f.tagExp, d = f.attrExpPresent, w = f.closeIndex;
|
|
1186
|
+
if (this.options.transformTagName) {
|
|
1187
|
+
const h = this.options.transformTagName(c);
|
|
1188
|
+
u === c && (u = h), c = h;
|
|
1189
|
+
}
|
|
1190
|
+
if (this.options.strictReservedNames && (c === this.options.commentPropName || c === this.options.cdataPropName))
|
|
1191
|
+
throw new Error(`Invalid tag name: ${c}`);
|
|
1192
|
+
n && s && n.tagname !== "!xml" && (s = this.saveTextToParentTag(s, n, r, !1));
|
|
1193
|
+
const E = n;
|
|
1194
|
+
E && this.options.unpairedTags.indexOf(E.tagname) !== -1 && (n = this.tagsNodeStack.pop(), r = r.substring(0, r.lastIndexOf("."))), c !== e.tagname && (r += r ? "." + c : c);
|
|
1195
|
+
const b = o;
|
|
1196
|
+
if (this.isItStopNode(this.stopNodesExact, this.stopNodesWildcard, r, c)) {
|
|
1197
|
+
let h = "";
|
|
1198
|
+
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1)
|
|
1199
|
+
c[c.length - 1] === "/" ? (c = c.substr(0, c.length - 1), r = r.substr(0, r.length - 1), u = c) : u = u.substr(0, u.length - 1), o = f.closeIndex;
|
|
1200
|
+
else if (this.options.unpairedTags.indexOf(c) !== -1)
|
|
1201
|
+
o = f.closeIndex;
|
|
1202
|
+
else {
|
|
1203
|
+
const I = this.readStopNodeData(t, l, w + 1);
|
|
1204
|
+
if (!I) throw new Error(`Unexpected end of ${l}`);
|
|
1205
|
+
o = I.i, h = I.tagContent;
|
|
1206
|
+
}
|
|
1207
|
+
const y = new H(c);
|
|
1208
|
+
c !== u && d && (y[":@"] = this.buildAttributesMap(u, r, c)), h && (h = this.parseTextData(h, c, r, !0, d, !0, !0)), r = r.substr(0, r.lastIndexOf(".")), y.add(this.options.textNodeName, h), this.addChild(n, y, r, b);
|
|
1209
|
+
} else {
|
|
1210
|
+
if (u.length > 0 && u.lastIndexOf("/") === u.length - 1) {
|
|
1211
|
+
if (c[c.length - 1] === "/" ? (c = c.substr(0, c.length - 1), r = r.substr(0, r.length - 1), u = c) : u = u.substr(0, u.length - 1), this.options.transformTagName) {
|
|
1212
|
+
const y = this.options.transformTagName(c);
|
|
1213
|
+
u === c && (u = y), c = y;
|
|
1214
|
+
}
|
|
1215
|
+
const h = new H(c);
|
|
1216
|
+
c !== u && d && (h[":@"] = this.buildAttributesMap(u, r, c)), this.addChild(n, h, r, b), r = r.substr(0, r.lastIndexOf("."));
|
|
1217
|
+
} else if (this.options.unpairedTags.indexOf(c) !== -1) {
|
|
1218
|
+
const h = new H(c);
|
|
1219
|
+
c !== u && d && (h[":@"] = this.buildAttributesMap(u, r)), this.addChild(n, h, r, b), r = r.substr(0, r.lastIndexOf(".")), o = f.closeIndex;
|
|
1220
|
+
continue;
|
|
1221
|
+
} else {
|
|
1222
|
+
const h = new H(c);
|
|
1223
|
+
if (this.tagsNodeStack.length > this.options.maxNestedTags)
|
|
1224
|
+
throw new Error("Maximum nested tags exceeded");
|
|
1225
|
+
this.tagsNodeStack.push(n), c !== u && d && (h[":@"] = this.buildAttributesMap(u, r, c)), this.addChild(n, h, r, b), n = h;
|
|
1226
|
+
}
|
|
1227
|
+
s = "", o = w;
|
|
1228
|
+
}
|
|
1229
|
+
}
|
|
1230
|
+
else
|
|
1231
|
+
s += t[o];
|
|
1232
|
+
return e.child;
|
|
1233
|
+
};
|
|
1234
|
+
function Yt(t, e, n, s) {
|
|
1235
|
+
this.options.captureMetaData || (s = void 0);
|
|
1236
|
+
const r = this.options.updateTag(e.tagname, n, e[":@"]);
|
|
1237
|
+
r === !1 || (typeof r == "string" && (e.tagname = r), t.addChild(e, s));
|
|
1238
|
+
}
|
|
1239
|
+
const Wt = function(t, e, n) {
|
|
1240
|
+
if (t.indexOf("&") === -1)
|
|
1241
|
+
return t;
|
|
1242
|
+
const s = this.options.processEntities;
|
|
1243
|
+
if (!s.enabled || s.allowedTags && !s.allowedTags.includes(e) || s.tagFilter && !s.tagFilter(e, n))
|
|
1244
|
+
return t;
|
|
1245
|
+
for (let r in this.docTypeEntities) {
|
|
1246
|
+
const i = this.docTypeEntities[r], o = t.match(i.regx);
|
|
1247
|
+
if (o) {
|
|
1248
|
+
if (this.entityExpansionCount += o.length, s.maxTotalExpansions && this.entityExpansionCount > s.maxTotalExpansions)
|
|
1249
|
+
throw new Error(
|
|
1250
|
+
`Entity expansion limit exceeded: ${this.entityExpansionCount} > ${s.maxTotalExpansions}`
|
|
1251
|
+
);
|
|
1252
|
+
const a = t.length;
|
|
1253
|
+
if (t = t.replace(i.regx, i.val), s.maxExpandedLength && (this.currentExpandedLength += t.length - a, this.currentExpandedLength > s.maxExpandedLength))
|
|
1254
|
+
throw new Error(
|
|
1255
|
+
`Total expanded content size exceeded: ${this.currentExpandedLength} > ${s.maxExpandedLength}`
|
|
1256
|
+
);
|
|
1257
|
+
}
|
|
1258
|
+
}
|
|
1259
|
+
if (t.indexOf("&") === -1) return t;
|
|
1260
|
+
for (let r in this.lastEntities) {
|
|
1261
|
+
const i = this.lastEntities[r];
|
|
1262
|
+
t = t.replace(i.regex, i.val);
|
|
1263
|
+
}
|
|
1264
|
+
if (t.indexOf("&") === -1) return t;
|
|
1265
|
+
if (this.options.htmlEntities)
|
|
1266
|
+
for (let r in this.htmlEntities) {
|
|
1267
|
+
const i = this.htmlEntities[r];
|
|
1268
|
+
t = t.replace(i.regex, i.val);
|
|
1269
|
+
}
|
|
1270
|
+
return t = t.replace(this.ampEntity.regex, this.ampEntity.val), t;
|
|
1271
|
+
};
|
|
1272
|
+
function Zt(t, e, n, s) {
|
|
1273
|
+
return t && (s === void 0 && (s = e.child.length === 0), t = this.parseTextData(
|
|
1274
|
+
t,
|
|
1275
|
+
e.tagname,
|
|
1276
|
+
n,
|
|
1277
|
+
!1,
|
|
1278
|
+
e[":@"] ? Object.keys(e[":@"]).length !== 0 : !1,
|
|
1279
|
+
s
|
|
1280
|
+
), t !== void 0 && t !== "" && e.add(this.options.textNodeName, t), t = ""), t;
|
|
1281
|
+
}
|
|
1282
|
+
function Jt(t, e, n, s) {
|
|
1283
|
+
return !!(e && e.has(s) || t && t.has(n));
|
|
1284
|
+
}
|
|
1285
|
+
function qt(t, e, n = ">") {
|
|
1286
|
+
let s, r = "";
|
|
1287
|
+
for (let i = e; i < t.length; i++) {
|
|
1288
|
+
let o = t[i];
|
|
1289
|
+
if (s)
|
|
1290
|
+
o === s && (s = "");
|
|
1291
|
+
else if (o === '"' || o === "'")
|
|
1292
|
+
s = o;
|
|
1293
|
+
else if (o === n[0])
|
|
1294
|
+
if (n[1]) {
|
|
1295
|
+
if (t[i + 1] === n[1])
|
|
1296
|
+
return {
|
|
1297
|
+
data: r,
|
|
1298
|
+
index: i
|
|
1299
|
+
};
|
|
1300
|
+
} else
|
|
1301
|
+
return {
|
|
1302
|
+
data: r,
|
|
1303
|
+
index: i
|
|
1304
|
+
};
|
|
1305
|
+
else o === " " && (o = " ");
|
|
1306
|
+
r += o;
|
|
1307
|
+
}
|
|
1308
|
+
}
|
|
1309
|
+
function F(t, e, n, s) {
|
|
1310
|
+
const r = t.indexOf(e, n);
|
|
1311
|
+
if (r === -1)
|
|
1312
|
+
throw new Error(s);
|
|
1313
|
+
return r + e.length - 1;
|
|
1314
|
+
}
|
|
1315
|
+
function te(t, e, n, s = ">") {
|
|
1316
|
+
const r = qt(t, e + 1, s);
|
|
1317
|
+
if (!r) return;
|
|
1318
|
+
let i = r.data;
|
|
1319
|
+
const o = r.index, a = i.search(/\s/);
|
|
1320
|
+
let f = i, c = !0;
|
|
1321
|
+
a !== -1 && (f = i.substring(0, a), i = i.substring(a + 1).trimStart());
|
|
1322
|
+
const l = f;
|
|
1323
|
+
if (n) {
|
|
1324
|
+
const u = f.indexOf(":");
|
|
1325
|
+
u !== -1 && (f = f.substr(u + 1), c = f !== r.data.substr(u + 1));
|
|
1326
|
+
}
|
|
1327
|
+
return {
|
|
1328
|
+
tagName: f,
|
|
1329
|
+
tagExp: i,
|
|
1330
|
+
closeIndex: o,
|
|
1331
|
+
attrExpPresent: c,
|
|
1332
|
+
rawTagName: l
|
|
1333
|
+
};
|
|
1334
|
+
}
|
|
1335
|
+
function Qt(t, e, n) {
|
|
1336
|
+
const s = n;
|
|
1337
|
+
let r = 1;
|
|
1338
|
+
for (; n < t.length; n++)
|
|
1339
|
+
if (t[n] === "<")
|
|
1340
|
+
if (t[n + 1] === "/") {
|
|
1341
|
+
const i = F(t, ">", n, `${e} is not closed`);
|
|
1342
|
+
if (t.substring(n + 2, i).trim() === e && (r--, r === 0))
|
|
1343
|
+
return {
|
|
1344
|
+
tagContent: t.substring(s, n),
|
|
1345
|
+
i
|
|
1346
|
+
};
|
|
1347
|
+
n = i;
|
|
1348
|
+
} else if (t[n + 1] === "?")
|
|
1349
|
+
n = F(t, "?>", n + 1, "StopNode is not closed.");
|
|
1350
|
+
else if (t.substr(n + 1, 3) === "!--")
|
|
1351
|
+
n = F(t, "-->", n + 3, "StopNode is not closed.");
|
|
1352
|
+
else if (t.substr(n + 1, 2) === "![")
|
|
1353
|
+
n = F(t, "]]>", n, "StopNode is not closed.") - 2;
|
|
1354
|
+
else {
|
|
1355
|
+
const i = te(t, n, ">");
|
|
1356
|
+
i && ((i && i.tagName) === e && i.tagExp[i.tagExp.length - 1] !== "/" && r++, n = i.closeIndex);
|
|
1357
|
+
}
|
|
1358
|
+
}
|
|
1359
|
+
function ne(t, e, n) {
|
|
1360
|
+
if (e && typeof t == "string") {
|
|
1361
|
+
const s = t.trim();
|
|
1362
|
+
return s === "true" ? !0 : s === "false" ? !1 : Ft(t, n);
|
|
1363
|
+
} else
|
|
1364
|
+
return bt(t) ? t : "";
|
|
1365
|
+
}
|
|
1366
|
+
function he(t, e, n) {
|
|
1367
|
+
const s = Number.parseInt(t, e);
|
|
1368
|
+
return s >= 0 && s <= 1114111 ? String.fromCodePoint(s) : n + t + ";";
|
|
1369
|
+
}
|
|
1370
|
+
const ee = H.getMetaDataSymbol();
|
|
1371
|
+
function Dt(t, e) {
|
|
1372
|
+
return Ae(t, e);
|
|
1373
|
+
}
|
|
1374
|
+
function Ae(t, e, n) {
|
|
1375
|
+
let s;
|
|
1376
|
+
const r = {};
|
|
1377
|
+
for (let i = 0; i < t.length; i++) {
|
|
1378
|
+
const o = t[i], a = en(o);
|
|
1379
|
+
let f = "";
|
|
1380
|
+
if (n === void 0 ? f = a : f = n + "." + a, a === e.textNodeName)
|
|
1381
|
+
s === void 0 ? s = o[a] : s += "" + o[a];
|
|
1382
|
+
else {
|
|
1383
|
+
if (a === void 0)
|
|
1384
|
+
continue;
|
|
1385
|
+
if (o[a]) {
|
|
1386
|
+
let c = Ae(o[a], e, f);
|
|
1387
|
+
const l = nn(c, e);
|
|
1388
|
+
o[":@"] ? tn(c, o[":@"], f, e) : Object.keys(c).length === 1 && c[e.textNodeName] !== void 0 && !e.alwaysCreateTextNode ? c = c[e.textNodeName] : Object.keys(c).length === 0 && (e.alwaysCreateTextNode ? c[e.textNodeName] = "" : c = ""), o[ee] !== void 0 && typeof c == "object" && c !== null && (c[ee] = o[ee]), r[a] !== void 0 && Object.prototype.hasOwnProperty.call(r, a) ? (Array.isArray(r[a]) || (r[a] = [r[a]]), r[a].push(c)) : e.isArray(a, f, l) ? r[a] = [c] : r[a] = c;
|
|
1389
|
+
}
|
|
1390
|
+
}
|
|
1391
|
+
}
|
|
1392
|
+
return typeof s == "string" ? s.length > 0 && (r[e.textNodeName] = s) : s !== void 0 && (r[e.textNodeName] = s), r;
|
|
1393
|
+
}
|
|
1394
|
+
function en(t) {
|
|
1395
|
+
const e = Object.keys(t);
|
|
1396
|
+
for (let n = 0; n < e.length; n++) {
|
|
1397
|
+
const s = e[n];
|
|
1398
|
+
if (s !== ":@") return s;
|
|
1399
|
+
}
|
|
1400
|
+
}
|
|
1401
|
+
function tn(t, e, n, s) {
|
|
1402
|
+
if (e) {
|
|
1403
|
+
const r = Object.keys(e), i = r.length;
|
|
1404
|
+
for (let o = 0; o < i; o++) {
|
|
1405
|
+
const a = r[o];
|
|
1406
|
+
s.isArray(a, n + "." + a, !0, !0) ? t[a] = [e[a]] : t[a] = e[a];
|
|
1407
|
+
}
|
|
1408
|
+
}
|
|
1409
|
+
}
|
|
1410
|
+
function nn(t, e) {
|
|
1411
|
+
const { textNodeName: n } = e, s = Object.keys(t).length;
|
|
1412
|
+
return !!(s === 0 || s === 1 && (t[n] || typeof t[n] == "boolean" || t[n] === 0));
|
|
1413
|
+
}
|
|
1414
|
+
class sn {
|
|
1415
|
+
constructor(e) {
|
|
1416
|
+
this.externalEntities = {}, this.options = Lt(e);
|
|
1417
|
+
}
|
|
1418
|
+
/**
|
|
1419
|
+
* Parse XML dats to JS object
|
|
1420
|
+
* @param {string|Uint8Array} xmlData
|
|
1421
|
+
* @param {boolean|Object} validationOption
|
|
1422
|
+
*/
|
|
1423
|
+
parse(e, n) {
|
|
1424
|
+
if (typeof e != "string" && e.toString)
|
|
1425
|
+
e = e.toString();
|
|
1426
|
+
else if (typeof e != "string")
|
|
1427
|
+
throw new Error("XML data is accepted in String or Bytes[] form.");
|
|
1428
|
+
if (n) {
|
|
1429
|
+
n === !0 && (n = {});
|
|
1430
|
+
const i = yt(e, n);
|
|
1431
|
+
if (i !== !0)
|
|
1432
|
+
throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
|
|
1433
|
+
}
|
|
1434
|
+
const s = new Bt(this.options);
|
|
1435
|
+
s.addExternalEntities(this.externalEntities);
|
|
1436
|
+
const r = s.parseXml(e);
|
|
1437
|
+
return this.options.preserveOrder || r === void 0 ? r : Dt(r, this.options);
|
|
1438
|
+
}
|
|
1439
|
+
/**
|
|
1440
|
+
* Add Entity which is not by default supported by this library
|
|
1441
|
+
* @param {string} key
|
|
1442
|
+
* @param {string} value
|
|
1443
|
+
*/
|
|
1444
|
+
addEntity(e, n) {
|
|
1445
|
+
if (n.indexOf("&") !== -1)
|
|
1446
|
+
throw new Error("Entity value can't have '&'");
|
|
1447
|
+
if (e.indexOf("&") !== -1 || e.indexOf(";") !== -1)
|
|
1448
|
+
throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '
'");
|
|
1449
|
+
if (n === "&")
|
|
1450
|
+
throw new Error("An entity with value '&' is not permitted");
|
|
1451
|
+
this.externalEntities[e] = n;
|
|
1452
|
+
}
|
|
1453
|
+
/**
|
|
1454
|
+
* Returns a Symbol that can be used to access the metadata
|
|
1455
|
+
* property on a node.
|
|
1456
|
+
*
|
|
1457
|
+
* If Symbol is not available in the environment, an ordinary property is used
|
|
1458
|
+
* and the name of the property is here returned.
|
|
1459
|
+
*
|
|
1460
|
+
* The XMLMetaData property is only present when `captureMetaData`
|
|
1461
|
+
* is true in the options.
|
|
1462
|
+
*/
|
|
1463
|
+
static getMetaDataSymbol() {
|
|
1464
|
+
return H.getMetaDataSymbol();
|
|
1465
|
+
}
|
|
1466
|
+
}
|
|
1467
|
+
class rn {
|
|
1468
|
+
axiosClient;
|
|
1469
|
+
baseURI;
|
|
1470
|
+
xmlParser;
|
|
1471
|
+
signingKey;
|
|
1472
|
+
ALGORITHM = "sha512";
|
|
1473
|
+
TTL = 1200;
|
|
1474
|
+
HASH_LENGTH = 32;
|
|
1475
|
+
ITERATION_COUNT = 1e4;
|
|
1476
|
+
constructor({ axiosClient: e, baseURI: n }) {
|
|
1477
|
+
this.axiosClient = e, this.baseURI = n, this.xmlParser = new sn();
|
|
1478
|
+
}
|
|
1479
|
+
async signUrl(e, n) {
|
|
1480
|
+
const s = new URL(e);
|
|
1481
|
+
s.searchParams.set("OC-Credential", n), s.searchParams.set("OC-Date", (/* @__PURE__ */ new Date()).toISOString()), s.searchParams.set("OC-Expires", this.TTL.toString()), s.searchParams.set("OC-Verb", "GET");
|
|
1482
|
+
const r = await this.createHashedKey(s.toString());
|
|
1483
|
+
return s.searchParams.set("OC-Algo", `PBKDF2/${this.ITERATION_COUNT}-SHA512`), s.searchParams.set("OC-Signature", r), s.toString();
|
|
1484
|
+
}
|
|
1485
|
+
async getSignKey() {
|
|
1486
|
+
if (this.signingKey)
|
|
1487
|
+
return this.signingKey;
|
|
1488
|
+
const e = await this.axiosClient.get(
|
|
1489
|
+
Oe(this.baseURI, "ocs/v1.php/cloud/user/signing-key"),
|
|
1490
|
+
{
|
|
1491
|
+
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
1492
|
+
}
|
|
1493
|
+
), n = this.xmlParser.parse(e.data);
|
|
1494
|
+
return this.signingKey = n.ocs.data["signing-key"], this.signingKey;
|
|
1495
|
+
}
|
|
1496
|
+
async createHashedKey(e) {
|
|
1497
|
+
const n = await this.getSignKey();
|
|
1498
|
+
return dt(
|
|
1499
|
+
e,
|
|
1500
|
+
n,
|
|
1501
|
+
this.ITERATION_COUNT,
|
|
1502
|
+
this.HASH_LENGTH,
|
|
1503
|
+
this.ALGORITHM
|
|
1504
|
+
).toString("hex");
|
|
1505
|
+
}
|
|
1506
|
+
}
|
|
1507
|
+
const fn = (t, e) => {
|
|
1508
|
+
const n = new URL(t);
|
|
1509
|
+
n.pathname = [...n.pathname.split("/"), "ocs", "v1.php"].filter(Boolean).join("/");
|
|
1510
|
+
const s = n.href, r = je(s, e), i = new rn({ baseURI: t, axiosClient: e });
|
|
1511
|
+
return {
|
|
1512
|
+
getCapabilities: () => r.getCapabilities(),
|
|
1513
|
+
signUrl: (o, a) => i.signUrl(o, a)
|
|
1514
|
+
};
|
|
1515
|
+
};
|
|
1516
|
+
export {
|
|
1517
|
+
je as G,
|
|
1518
|
+
sn as X,
|
|
1519
|
+
fn as o
|
|
1520
|
+
};
|