@opencloud-eu/web-client 5.0.0-alpha.1 → 5.1.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.
Files changed (38) hide show
  1. package/dist/{functions-DoaLjzWZ.js → functions-JSgappH3.js} +58 -54
  2. package/dist/functions-K2XX5sqY.cjs +1 -0
  3. package/dist/index-Bjk4YP4o.js +1447 -0
  4. package/dist/{index-VSN9x0VR.js → index-Brk6gzFd.js} +34 -32
  5. package/dist/index-CDNcS2Ra.cjs +1 -0
  6. package/dist/index-CRMq09Yn.js +1933 -0
  7. package/dist/index-D0bnLDAA.cjs +1 -0
  8. package/dist/index-Dn0XwAD_.cjs +13 -0
  9. package/dist/index-YuBBVVCr.js +3860 -0
  10. package/dist/index-_QOU-c0Z.cjs +4 -0
  11. package/dist/index-cttW6Cve.js +1018 -0
  12. package/dist/index-mNoGEl9R.cjs +6 -0
  13. package/dist/src/index.d.ts +3 -15
  14. package/dist/src/ocs/capabilities.d.ts +0 -1
  15. package/dist/src/ocs/urlSign.d.ts +1 -0
  16. package/dist/src/webdav/getFileUrl.d.ts +1 -7
  17. package/dist/{toString-BMC5nz5v.js → toString-CKeGA2IK.js} +57 -63
  18. package/dist/toString-DsGM1XcL.cjs +1 -0
  19. package/dist/web-client/graph/generated.cjs +1 -1
  20. package/dist/web-client/graph/generated.js +1 -1
  21. package/dist/web-client/graph.cjs +1 -1
  22. package/dist/web-client/graph.js +1 -1
  23. package/dist/web-client/ocs.cjs +1 -20
  24. package/dist/web-client/ocs.js +3 -6043
  25. package/dist/web-client/webdav.cjs +1 -1
  26. package/dist/web-client/webdav.js +3 -3
  27. package/dist/web-client.cjs +1 -1
  28. package/dist/web-client.js +67 -84
  29. package/package.json +2 -3
  30. package/dist/functions-D3Ol8cjk.cjs +0 -1
  31. package/dist/index-8RyXehLU.js +0 -1134
  32. package/dist/index-BG-qXJDl.cjs +0 -6
  33. package/dist/index-BfIzVKrn.js +0 -1773
  34. package/dist/index-CVRrfksL.cjs +0 -1
  35. package/dist/index-Cwfbs-Hh.js +0 -4651
  36. package/dist/index-DOiCesBa.cjs +0 -16
  37. package/dist/index-sTep8AuK.cjs +0 -1
  38. package/dist/toString-CEqk2kJI.cjs +0 -1
@@ -1,4651 +0,0 @@
1
- import { a as Nr } from "./index-BfIzVKrn.js";
2
- import { D as st, I as he, J as me, t as xr, l as ue, p as Kt, m as Pr, K as se } from "./functions-DoaLjzWZ.js";
3
- import { u as M } from "./toString-BMC5nz5v.js";
4
- import { ocs as Er } from "./web-client/ocs.js";
5
- import { p as oe, g as ve } from "./index-8RyXehLU.js";
6
- const we = (r) => encodeURIComponent(r).split("%2F").join("/");
7
- class Qt extends Error {
8
- response;
9
- statusCode;
10
- constructor(e, t, n = null) {
11
- super(e), this.response = t, this.statusCode = n;
12
- }
13
- }
14
- class Ar extends Qt {
15
- errorCode;
16
- constructor(e, t, n, a = null) {
17
- super(e, n, a), this.errorCode = t;
18
- }
19
- }
20
- const re = (r, { fileId: e, path: t, name: n }) => {
21
- if (t !== void 0)
22
- return M(r.webDavPath, t);
23
- if (e !== void 0) {
24
- if (st(r))
25
- throw new Error("public spaces need a path provided");
26
- return M("spaces", e, n || "");
27
- }
28
- return r.webDavPath;
29
- }, Tr = (r, e) => ({
30
- copyFiles(t, { path: n, fileId: a }, u, {
31
- path: c,
32
- parentFolderId: i,
33
- name: h
34
- }, { overwrite: o, ...s } = {}) {
35
- const f = re(t, {
36
- fileId: a,
37
- path: n
38
- }), l = re(u, {
39
- fileId: i,
40
- path: c,
41
- name: h
42
- });
43
- return r.copy(f, l, {
44
- overwrite: o || !1,
45
- ...s
46
- });
47
- }
48
- }), Or = (r, e, t) => ({
49
- async createFolder(n, { path: a, parentFolderId: u, folderName: c, fetchFolder: i = !0, ...h }) {
50
- const o = re(n, { fileId: u, path: a, name: c });
51
- if (await r.mkcol(o), i)
52
- return e.getFileInfo(n, { path: a }, h);
53
- }
54
- }), Cr = (r, { axiosClient: e }) => ({
55
- async getFileContents(t, { fileId: n, path: a }, {
56
- responseType: u = "text",
57
- noCache: c = !0,
58
- headers: i,
59
- ...h
60
- } = {}) {
61
- try {
62
- const o = re(t, { fileId: n, path: a }), s = await e.get(r.getFileUrl(o), {
63
- responseType: u,
64
- headers: {
65
- ...c && { "Cache-Control": "no-cache" },
66
- ...i || {}
67
- },
68
- ...h
69
- });
70
- return {
71
- response: s,
72
- body: s.data,
73
- headers: {
74
- ETag: s.headers.etag,
75
- "OC-ETag": s.headers["oc-etag"],
76
- "OC-FileId": s.headers["oc-fileid"]
77
- }
78
- };
79
- } catch (o) {
80
- const { message: s, response: f } = o;
81
- throw new Qt(s, f, f.status);
82
- }
83
- }
84
- }), Ir = (r, e) => ({
85
- async getFileInfo(t, n, a) {
86
- return (await r.listFiles(t, n, {
87
- depth: 0,
88
- ...a
89
- })).resource;
90
- }
91
- }), Sr = (r, e, t, { axiosClient: n, baseUrl: a }) => ({
92
- async getFileUrl(u, c, {
93
- disposition: i = "attachment",
94
- isUrlSigningEnabled: h = !0,
95
- signUrlTimeout: o = 86400,
96
- version: s = null,
97
- doHeadRequest: f = !1,
98
- username: l = "",
99
- ...g
100
- }) {
101
- if (i === "inline") {
102
- const m = await e.getFileContents(u, c, {
103
- responseType: "blob",
104
- ...g
105
- });
106
- return URL.createObjectURL(m.body);
107
- }
108
- if (s) {
109
- if (!l)
110
- throw new Error("username is required for URL signing");
111
- const m = r.getFileUrl(M("meta", c.fileId, "v", s));
112
- return await Er(a, n).signUrl(m, l);
113
- }
114
- if (c.downloadURL)
115
- return c.downloadURL;
116
- const { downloadURL: d } = await t.getFileInfo(u, c, {
117
- davProperties: [he.DownloadURL]
118
- });
119
- return d;
120
- },
121
- revokeUrl: (u) => {
122
- u && u.startsWith("blob:") && URL.revokeObjectURL(u);
123
- }
124
- }), Fr = (r, e) => ({
125
- getPublicFileUrl(t, n) {
126
- return r.getFileUrl(M("public-files", n));
127
- }
128
- }), jr = (r, e, t) => ({
129
- async listFiles(n, { path: a, fileId: u } = {}, { depth: c = 1, davProperties: i, isTrash: h = !1, ...o } = {}) {
130
- let s;
131
- if (st(n)) {
132
- s = await r.propfind(M(n.webDavPath, a), {
133
- depth: c,
134
- properties: i || me.PublicLink,
135
- ...o
136
- }), s.forEach((d) => {
137
- d.filename = d.filename.split("/").slice(1).join("/");
138
- }), s.length === 1 && (s[0].filename = M(n.id, a, {
139
- leadingSlash: !0
140
- })), s.forEach((d) => {
141
- d.filename = d.filename.split("/").slice(2).join("/");
142
- });
143
- const l = n.driveAlias.startsWith("ocm/") ? "ocm" : "public-link";
144
- if ((!a || a === "/") && c > 0 && l === "ocm" && s[0].props[he.PublicLinkItemType] === "file" && (s = [
145
- {
146
- basename: n.fileId,
147
- type: "directory",
148
- filename: "",
149
- props: {}
150
- },
151
- ...s
152
- ]), !a) {
153
- const [d, ...m] = s;
154
- return {
155
- resource: xr({
156
- ...d,
157
- id: n.id,
158
- driveAlias: n.driveAlias,
159
- webDavPath: n.webDavPath,
160
- publicLinkType: l
161
- }),
162
- children: m.map((w) => ue(w, r.extraProps))
163
- };
164
- }
165
- const g = s.map((d) => ue(d, r.extraProps));
166
- return { resource: g[0], children: g.slice(1) };
167
- }
168
- const f = async () => {
169
- const l = await e.getPathForFileId(u);
170
- return this.listFiles(n, { path: l }, { depth: c, davProperties: i });
171
- };
172
- try {
173
- let l = "";
174
- if (h ? l = Kt(n.id) : l = re(n, { fileId: u, path: a }), s = await r.propfind(l, {
175
- depth: c,
176
- properties: i || me.Default,
177
- ...o
178
- }), h)
179
- return {
180
- resource: ue(s[0], r.extraProps),
181
- children: s.slice(1).map(Pr)
182
- };
183
- const g = s.map((m) => ue(m, r.extraProps)), d = u === n.id;
184
- return u && !d && g[0].fileId && u !== g[0].fileId ? f() : { resource: g[0], children: g.slice(1) };
185
- } catch (l) {
186
- if (l.statusCode === 404 && u)
187
- return f();
188
- throw l;
189
- }
190
- }
191
- }), $r = (r, e) => ({
192
- moveFiles(t, { path: n, fileId: a }, u, {
193
- path: c,
194
- parentFolderId: i,
195
- name: h
196
- }, { overwrite: o, ...s } = {}) {
197
- const f = re(t, {
198
- fileId: a,
199
- path: n
200
- }), l = re(u, {
201
- fileId: i,
202
- path: c,
203
- name: h
204
- });
205
- return r.move(f, l, {
206
- overwrite: o || !1,
207
- ...s
208
- });
209
- }
210
- }), Rr = (r, e, t) => ({
211
- async putFileContents(n, {
212
- fileName: a,
213
- path: u,
214
- parentFolderId: c,
215
- content: i = "",
216
- previousEntityTag: h = "",
217
- overwrite: o,
218
- onUploadProgress: s = null,
219
- ...f
220
- }) {
221
- const l = re(n, { fileId: c, name: a, path: u }), { result: g } = await r.put(l, i, {
222
- previousEntityTag: h,
223
- overwrite: o,
224
- onUploadProgress: s,
225
- ...f
226
- });
227
- return e.getFileInfo(n, {
228
- fileId: g.headers.get("Oc-Fileid"),
229
- path: u
230
- });
231
- }
232
- }), Lr = (r, e) => ({
233
- deleteFile(t, { path: n, ...a }) {
234
- return r.delete(M(t.webDavPath, n), a);
235
- }
236
- }), kr = (r, e) => ({
237
- restoreFile(t, { id: n }, { path: a }, { overwrite: u, ...c } = {}) {
238
- if (st(t))
239
- return;
240
- const i = M(t.webDavPath, a);
241
- return r.move(M(t.webDavTrashPath, n), i, {
242
- overwrite: u,
243
- ...c
244
- });
245
- }
246
- }), Ur = (r, e) => ({
247
- restoreFileVersion(t, { parentFolderId: n, name: a, path: u }, c, i = {}) {
248
- const h = re(t, { path: u, fileId: n, name: a }), o = M("meta", n, "v", c, { leadingSlash: !0 }), s = M("files", h, { leadingSlash: !0 });
249
- return r.copy(o, s, i);
250
- }
251
- }), _r = (r, e) => ({
252
- clearTrashBin(t, { id: n, ...a } = {}) {
253
- let u = Kt(t.id);
254
- return n && (u = M(u, n)), r.delete(u, a);
255
- }
256
- }), Mr = (r, e) => ({
257
- async search(t, { davProperties: n = me.Default, searchLimit: a, ...u }) {
258
- const c = "/spaces/", { range: i, results: h } = await r.report(c, {
259
- pattern: t,
260
- limit: a,
261
- properties: n,
262
- ...u
263
- });
264
- return {
265
- resources: h.map((o) => ({
266
- ...ue(o, r.extraProps),
267
- highlights: o.props[he.Highlights] || ""
268
- })),
269
- totalResults: i ? parseInt(i?.split("/")[1]) : null
270
- };
271
- }
272
- }), Vr = (r, e) => ({
273
- async getPathForFileId(t, n = {}) {
274
- return (await r.propfind(M("meta", t, { leadingSlash: !0 }), {
275
- properties: [he.MetaPathForUser],
276
- ...n
277
- }))[0].props[he.MetaPathForUser];
278
- }
279
- });
280
- var Br = { 2: (r) => {
281
- function e(a, u, c) {
282
- a instanceof RegExp && (a = t(a, c)), u instanceof RegExp && (u = t(u, c));
283
- var i = n(a, u, c);
284
- return i && { start: i[0], end: i[1], pre: c.slice(0, i[0]), body: c.slice(i[0] + a.length, i[1]), post: c.slice(i[1] + u.length) };
285
- }
286
- function t(a, u) {
287
- var c = u.match(a);
288
- return c ? c[0] : null;
289
- }
290
- function n(a, u, c) {
291
- var i, h, o, s, f, l = c.indexOf(a), g = c.indexOf(u, l + 1), d = l;
292
- if (l >= 0 && g > 0) {
293
- for (i = [], o = c.length; d >= 0 && !f; ) d == l ? (i.push(d), l = c.indexOf(a, d + 1)) : i.length == 1 ? f = [i.pop(), g] : ((h = i.pop()) < o && (o = h, s = g), g = c.indexOf(u, d + 1)), d = l < g && l >= 0 ? l : g;
294
- i.length && (f = [o, s]);
295
- }
296
- return f;
297
- }
298
- r.exports = e, e.range = n;
299
- }, 101: function(r, e, t) {
300
- var n;
301
- r = t.nmd(r), (function(a) {
302
- var u = (r && r.exports, typeof ve == "object" && ve);
303
- u.global !== u && u.window;
304
- var c = function(f) {
305
- this.message = f;
306
- };
307
- (c.prototype = new Error()).name = "InvalidCharacterError";
308
- var i = function(f) {
309
- throw new c(f);
310
- }, h = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", o = /[\t\n\f\r ]/g, s = { encode: function(f) {
311
- f = String(f), /[^\0-\xFF]/.test(f) && i("The string to be encoded contains characters outside of the Latin1 range.");
312
- for (var l, g, d, m, w = f.length % 3, v = "", p = -1, y = f.length - w; ++p < y; ) l = f.charCodeAt(p) << 16, g = f.charCodeAt(++p) << 8, d = f.charCodeAt(++p), v += h.charAt((m = l + g + d) >> 18 & 63) + h.charAt(m >> 12 & 63) + h.charAt(m >> 6 & 63) + h.charAt(63 & m);
313
- return w == 2 ? (l = f.charCodeAt(p) << 8, g = f.charCodeAt(++p), v += h.charAt((m = l + g) >> 10) + h.charAt(m >> 4 & 63) + h.charAt(m << 2 & 63) + "=") : w == 1 && (m = f.charCodeAt(p), v += h.charAt(m >> 2) + h.charAt(m << 4 & 63) + "=="), v;
314
- }, decode: function(f) {
315
- var l = (f = String(f).replace(o, "")).length;
316
- l % 4 == 0 && (l = (f = f.replace(/==?$/, "")).length), (l % 4 == 1 || /[^+a-zA-Z0-9/]/.test(f)) && i("Invalid character: the string to be decoded is not correctly encoded.");
317
- for (var g, d, m = 0, w = "", v = -1; ++v < l; ) d = h.indexOf(f.charAt(v)), g = m % 4 ? 64 * g + d : d, m++ % 4 && (w += String.fromCharCode(255 & g >> (-2 * m & 6)));
318
- return w;
319
- }, version: "1.0.0" };
320
- (n = (function() {
321
- return s;
322
- }).call(e, t, e, r)) === void 0 || (r.exports = n);
323
- })();
324
- }, 172: (r, e) => {
325
- e.d = function(t) {
326
- if (!t) return 0;
327
- for (var n = (t = t.toString()).length, a = t.length; a--; ) {
328
- var u = t.charCodeAt(a);
329
- 56320 <= u && u <= 57343 && a--, 127 < u && u <= 2047 ? n++ : 2047 < u && u <= 65535 && (n += 2);
330
- }
331
- return n;
332
- };
333
- }, 526: (r) => {
334
- var e = { utf8: { stringToBytes: function(t) {
335
- return e.bin.stringToBytes(unescape(encodeURIComponent(t)));
336
- }, bytesToString: function(t) {
337
- return decodeURIComponent(escape(e.bin.bytesToString(t)));
338
- } }, bin: { stringToBytes: function(t) {
339
- for (var n = [], a = 0; a < t.length; a++) n.push(255 & t.charCodeAt(a));
340
- return n;
341
- }, bytesToString: function(t) {
342
- for (var n = [], a = 0; a < t.length; a++) n.push(String.fromCharCode(t[a]));
343
- return n.join("");
344
- } } };
345
- r.exports = e;
346
- }, 298: (r) => {
347
- var e, t;
348
- e = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/", t = { rotl: function(n, a) {
349
- return n << a | n >>> 32 - a;
350
- }, rotr: function(n, a) {
351
- return n << 32 - a | n >>> a;
352
- }, endian: function(n) {
353
- if (n.constructor == Number) return 16711935 & t.rotl(n, 8) | 4278255360 & t.rotl(n, 24);
354
- for (var a = 0; a < n.length; a++) n[a] = t.endian(n[a]);
355
- return n;
356
- }, randomBytes: function(n) {
357
- for (var a = []; n > 0; n--) a.push(Math.floor(256 * Math.random()));
358
- return a;
359
- }, bytesToWords: function(n) {
360
- for (var a = [], u = 0, c = 0; u < n.length; u++, c += 8) a[c >>> 5] |= n[u] << 24 - c % 32;
361
- return a;
362
- }, wordsToBytes: function(n) {
363
- for (var a = [], u = 0; u < 32 * n.length; u += 8) a.push(n[u >>> 5] >>> 24 - u % 32 & 255);
364
- return a;
365
- }, bytesToHex: function(n) {
366
- for (var a = [], u = 0; u < n.length; u++) a.push((n[u] >>> 4).toString(16)), a.push((15 & n[u]).toString(16));
367
- return a.join("");
368
- }, hexToBytes: function(n) {
369
- for (var a = [], u = 0; u < n.length; u += 2) a.push(parseInt(n.substr(u, 2), 16));
370
- return a;
371
- }, bytesToBase64: function(n) {
372
- for (var a = [], u = 0; u < n.length; u += 3) for (var c = n[u] << 16 | n[u + 1] << 8 | n[u + 2], i = 0; i < 4; i++) 8 * u + 6 * i <= 8 * n.length ? a.push(e.charAt(c >>> 6 * (3 - i) & 63)) : a.push("=");
373
- return a.join("");
374
- }, base64ToBytes: function(n) {
375
- n = n.replace(/[^A-Z0-9+\/]/gi, "");
376
- for (var a = [], u = 0, c = 0; u < n.length; c = ++u % 4) c != 0 && a.push((e.indexOf(n.charAt(u - 1)) & Math.pow(2, -2 * c + 8) - 1) << 2 * c | e.indexOf(n.charAt(u)) >>> 6 - 2 * c);
377
- return a;
378
- } }, r.exports = t;
379
- }, 635: (r, e, t) => {
380
- const n = t(31), a = t(338), u = t(221);
381
- r.exports = { XMLParser: a, XMLValidator: n, XMLBuilder: u };
382
- }, 118: (r) => {
383
- r.exports = function(e) {
384
- return typeof e == "function" ? e : Array.isArray(e) ? (t) => {
385
- for (const n of e)
386
- if (typeof n == "string" && t === n || n instanceof RegExp && n.test(t)) return !0;
387
- } : () => !1;
388
- };
389
- }, 705: (r, e) => {
390
- const t = ":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", n = "[" + t + "][" + t + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040]*", a = new RegExp("^" + n + "$");
391
- e.isExist = function(u) {
392
- return u !== void 0;
393
- }, e.isEmptyObject = function(u) {
394
- return Object.keys(u).length === 0;
395
- }, e.merge = function(u, c, i) {
396
- if (c) {
397
- const h = Object.keys(c), o = h.length;
398
- for (let s = 0; s < o; s++) u[h[s]] = i === "strict" ? [c[h[s]]] : c[h[s]];
399
- }
400
- }, e.getValue = function(u) {
401
- return e.isExist(u) ? u : "";
402
- }, e.isName = function(u) {
403
- return a.exec(u) != null;
404
- }, e.getAllMatches = function(u, c) {
405
- const i = [];
406
- let h = c.exec(u);
407
- for (; h; ) {
408
- const o = [];
409
- o.startIndex = c.lastIndex - h[0].length;
410
- const s = h.length;
411
- for (let f = 0; f < s; f++) o.push(h[f]);
412
- i.push(o), h = c.exec(u);
413
- }
414
- return i;
415
- }, e.nameRegexp = n;
416
- }, 31: (r, e, t) => {
417
- const n = t(705), a = { allowBooleanAttributes: !1, unpairedTags: [] };
418
- function u(p) {
419
- return p === " " || p === " " || p === `
420
- ` || p === "\r";
421
- }
422
- function c(p, y) {
423
- const A = y;
424
- for (; y < p.length; y++) if (!(p[y] != "?" && p[y] != " ")) {
425
- const N = p.substr(A, y - A);
426
- if (y > 5 && N === "xml") return d("InvalidXml", "XML declaration allowed only at the start of the document.", w(p, y));
427
- if (p[y] == "?" && p[y + 1] == ">") {
428
- y++;
429
- break;
430
- }
431
- }
432
- return y;
433
- }
434
- function i(p, y) {
435
- if (p.length > y + 5 && p[y + 1] === "-" && p[y + 2] === "-") {
436
- for (y += 3; y < p.length; y++) if (p[y] === "-" && p[y + 1] === "-" && p[y + 2] === ">") {
437
- y += 2;
438
- break;
439
- }
440
- } else if (p.length > y + 8 && p[y + 1] === "D" && p[y + 2] === "O" && p[y + 3] === "C" && p[y + 4] === "T" && p[y + 5] === "Y" && p[y + 6] === "P" && p[y + 7] === "E") {
441
- let A = 1;
442
- for (y += 8; y < p.length; y++) if (p[y] === "<") A++;
443
- else if (p[y] === ">" && (A--, A === 0)) break;
444
- } else if (p.length > y + 9 && p[y + 1] === "[" && p[y + 2] === "C" && p[y + 3] === "D" && p[y + 4] === "A" && p[y + 5] === "T" && p[y + 6] === "A" && p[y + 7] === "[") {
445
- for (y += 8; y < p.length; y++) if (p[y] === "]" && p[y + 1] === "]" && p[y + 2] === ">") {
446
- y += 2;
447
- break;
448
- }
449
- }
450
- return y;
451
- }
452
- e.validate = function(p, y) {
453
- y = Object.assign({}, a, y);
454
- const A = [];
455
- let N = !1, b = !1;
456
- p[0] === "\uFEFF" && (p = p.substr(1));
457
- for (let x = 0; x < p.length; x++) if (p[x] === "<" && p[x + 1] === "?") {
458
- if (x += 2, x = c(p, x), x.err) return x;
459
- } else {
460
- if (p[x] !== "<") {
461
- if (u(p[x])) continue;
462
- return d("InvalidChar", "char '" + p[x] + "' is not expected.", w(p, x));
463
- }
464
- {
465
- let T = x;
466
- if (x++, p[x] === "!") {
467
- x = i(p, x);
468
- continue;
469
- }
470
- {
471
- let O = !1;
472
- p[x] === "/" && (O = !0, x++);
473
- let I = "";
474
- for (; x < p.length && p[x] !== ">" && p[x] !== " " && p[x] !== " " && p[x] !== `
475
- ` && p[x] !== "\r"; x++) I += p[x];
476
- if (I = I.trim(), I[I.length - 1] === "/" && (I = I.substring(0, I.length - 1), x--), E = I, !n.isName(E)) {
477
- let F;
478
- return F = I.trim().length === 0 ? "Invalid space after '<'." : "Tag '" + I + "' is an invalid name.", d("InvalidTag", F, w(p, x));
479
- }
480
- const C = s(p, x);
481
- if (C === !1) return d("InvalidAttr", "Attributes for '" + I + "' have open quote.", w(p, x));
482
- let P = C.value;
483
- if (x = C.index, P[P.length - 1] === "/") {
484
- const F = x - P.length;
485
- P = P.substring(0, P.length - 1);
486
- const S = l(P, y);
487
- if (S !== !0) return d(S.err.code, S.err.msg, w(p, F + S.err.line));
488
- N = !0;
489
- } else if (O) {
490
- if (!C.tagClosed) return d("InvalidTag", "Closing tag '" + I + "' doesn't have proper closing.", w(p, x));
491
- if (P.trim().length > 0) return d("InvalidTag", "Closing tag '" + I + "' can't have attributes or invalid starting.", w(p, T));
492
- if (A.length === 0) return d("InvalidTag", "Closing tag '" + I + "' has not been opened.", w(p, T));
493
- {
494
- const F = A.pop();
495
- if (I !== F.tagName) {
496
- let S = w(p, F.tagStartPos);
497
- return d("InvalidTag", "Expected closing tag '" + F.tagName + "' (opened in line " + S.line + ", col " + S.col + ") instead of closing tag '" + I + "'.", w(p, T));
498
- }
499
- A.length == 0 && (b = !0);
500
- }
501
- } else {
502
- const F = l(P, y);
503
- if (F !== !0) return d(F.err.code, F.err.msg, w(p, x - P.length + F.err.line));
504
- if (b === !0) return d("InvalidXml", "Multiple possible root nodes found.", w(p, x));
505
- y.unpairedTags.indexOf(I) !== -1 || A.push({ tagName: I, tagStartPos: T }), N = !0;
506
- }
507
- for (x++; x < p.length; x++) if (p[x] === "<") {
508
- if (p[x + 1] === "!") {
509
- x++, x = i(p, x);
510
- continue;
511
- }
512
- if (p[x + 1] !== "?") break;
513
- if (x = c(p, ++x), x.err) return x;
514
- } else if (p[x] === "&") {
515
- const F = g(p, x);
516
- if (F == -1) return d("InvalidChar", "char '&' is not expected.", w(p, x));
517
- x = F;
518
- } else if (b === !0 && !u(p[x])) return d("InvalidXml", "Extra text at the end", w(p, x));
519
- p[x] === "<" && x--;
520
- }
521
- }
522
- }
523
- var E;
524
- return N ? A.length == 1 ? d("InvalidTag", "Unclosed tag '" + A[0].tagName + "'.", w(p, A[0].tagStartPos)) : !(A.length > 0) || d("InvalidXml", "Invalid '" + JSON.stringify(A.map(((x) => x.tagName)), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 }) : d("InvalidXml", "Start tag expected.", 1);
525
- };
526
- const h = '"', o = "'";
527
- function s(p, y) {
528
- let A = "", N = "", b = !1;
529
- for (; y < p.length; y++) {
530
- if (p[y] === h || p[y] === o) N === "" ? N = p[y] : N !== p[y] || (N = "");
531
- else if (p[y] === ">" && N === "") {
532
- b = !0;
533
- break;
534
- }
535
- A += p[y];
536
- }
537
- return N === "" && { value: A, index: y, tagClosed: b };
538
- }
539
- const f = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
540
- function l(p, y) {
541
- const A = n.getAllMatches(p, f), N = {};
542
- for (let b = 0; b < A.length; b++) {
543
- if (A[b][1].length === 0) return d("InvalidAttr", "Attribute '" + A[b][2] + "' has no space in starting.", v(A[b]));
544
- if (A[b][3] !== void 0 && A[b][4] === void 0) return d("InvalidAttr", "Attribute '" + A[b][2] + "' is without value.", v(A[b]));
545
- if (A[b][3] === void 0 && !y.allowBooleanAttributes) return d("InvalidAttr", "boolean attribute '" + A[b][2] + "' is not allowed.", v(A[b]));
546
- const E = A[b][2];
547
- if (!m(E)) return d("InvalidAttr", "Attribute '" + E + "' is an invalid name.", v(A[b]));
548
- if (N.hasOwnProperty(E)) return d("InvalidAttr", "Attribute '" + E + "' is repeated.", v(A[b]));
549
- N[E] = 1;
550
- }
551
- return !0;
552
- }
553
- function g(p, y) {
554
- if (p[++y] === ";") return -1;
555
- if (p[y] === "#") return (function(N, b) {
556
- let E = /\d/;
557
- for (N[b] === "x" && (b++, E = /[\da-fA-F]/); b < N.length; b++) {
558
- if (N[b] === ";") return b;
559
- if (!N[b].match(E)) break;
560
- }
561
- return -1;
562
- })(p, ++y);
563
- let A = 0;
564
- for (; y < p.length; y++, A++) if (!(p[y].match(/\w/) && A < 20)) {
565
- if (p[y] === ";") break;
566
- return -1;
567
- }
568
- return y;
569
- }
570
- function d(p, y, A) {
571
- return { err: { code: p, msg: y, line: A.line || A, col: A.col } };
572
- }
573
- function m(p) {
574
- return n.isName(p);
575
- }
576
- function w(p, y) {
577
- const A = p.substring(0, y).split(/\r?\n/);
578
- return { line: A.length, col: A[A.length - 1].length + 1 };
579
- }
580
- function v(p) {
581
- return p.startIndex + p[1].length;
582
- }
583
- }, 221: (r, e, t) => {
584
- const n = t(87), a = t(118), u = { attributeNamePrefix: "@_", attributesGroupName: !1, textNodeName: "#text", ignoreAttributes: !0, cdataPropName: !1, format: !1, indentBy: " ", suppressEmptyNode: !1, suppressUnpairedNode: !0, suppressBooleanAttributes: !0, tagValueProcessor: function(s, f) {
585
- return f;
586
- }, attributeValueProcessor: function(s, f) {
587
- return f;
588
- }, preserveOrder: !1, commentPropName: !1, unpairedTags: [], entities: [{ regex: new RegExp("&", "g"), val: "&amp;" }, { regex: new RegExp(">", "g"), val: "&gt;" }, { regex: new RegExp("<", "g"), val: "&lt;" }, { regex: new RegExp("'", "g"), val: "&apos;" }, { regex: new RegExp('"', "g"), val: "&quot;" }], processEntities: !0, stopNodes: [], oneListGroup: !1 };
589
- function c(s) {
590
- this.options = Object.assign({}, u, s), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
591
- return !1;
592
- } : (this.ignoreAttributesFn = a(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = o), this.processTextOrObjNode = i, this.options.format ? (this.indentate = h, this.tagEndChar = `>
593
- `, this.newLine = `
594
- `) : (this.indentate = function() {
595
- return "";
596
- }, this.tagEndChar = ">", this.newLine = "");
597
- }
598
- function i(s, f, l, g) {
599
- const d = this.j2x(s, l + 1, g.concat(f));
600
- return s[this.options.textNodeName] !== void 0 && Object.keys(s).length === 1 ? this.buildTextValNode(s[this.options.textNodeName], f, d.attrStr, l) : this.buildObjectNode(d.val, f, d.attrStr, l);
601
- }
602
- function h(s) {
603
- return this.options.indentBy.repeat(s);
604
- }
605
- function o(s) {
606
- return !(!s.startsWith(this.options.attributeNamePrefix) || s === this.options.textNodeName) && s.substr(this.attrPrefixLen);
607
- }
608
- c.prototype.build = function(s) {
609
- return this.options.preserveOrder ? n(s, this.options) : (Array.isArray(s) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (s = { [this.options.arrayNodeName]: s }), this.j2x(s, 0, []).val);
610
- }, c.prototype.j2x = function(s, f, l) {
611
- let g = "", d = "";
612
- const m = l.join(".");
613
- for (let w in s) if (Object.prototype.hasOwnProperty.call(s, w)) if (s[w] === void 0) this.isAttribute(w) && (d += "");
614
- else if (s[w] === null) this.isAttribute(w) ? d += "" : w[0] === "?" ? d += this.indentate(f) + "<" + w + "?" + this.tagEndChar : d += this.indentate(f) + "<" + w + "/" + this.tagEndChar;
615
- else if (s[w] instanceof Date) d += this.buildTextValNode(s[w], w, "", f);
616
- else if (typeof s[w] != "object") {
617
- const v = this.isAttribute(w);
618
- if (v && !this.ignoreAttributesFn(v, m)) g += this.buildAttrPairStr(v, "" + s[w]);
619
- else if (!v) if (w === this.options.textNodeName) {
620
- let p = this.options.tagValueProcessor(w, "" + s[w]);
621
- d += this.replaceEntitiesValue(p);
622
- } else d += this.buildTextValNode(s[w], w, "", f);
623
- } else if (Array.isArray(s[w])) {
624
- const v = s[w].length;
625
- let p = "", y = "";
626
- for (let A = 0; A < v; A++) {
627
- const N = s[w][A];
628
- if (N !== void 0) if (N === null) w[0] === "?" ? d += this.indentate(f) + "<" + w + "?" + this.tagEndChar : d += this.indentate(f) + "<" + w + "/" + this.tagEndChar;
629
- else if (typeof N == "object") if (this.options.oneListGroup) {
630
- const b = this.j2x(N, f + 1, l.concat(w));
631
- p += b.val, this.options.attributesGroupName && N.hasOwnProperty(this.options.attributesGroupName) && (y += b.attrStr);
632
- } else p += this.processTextOrObjNode(N, w, f, l);
633
- else if (this.options.oneListGroup) {
634
- let b = this.options.tagValueProcessor(w, N);
635
- b = this.replaceEntitiesValue(b), p += b;
636
- } else p += this.buildTextValNode(N, w, "", f);
637
- }
638
- this.options.oneListGroup && (p = this.buildObjectNode(p, w, y, f)), d += p;
639
- } else if (this.options.attributesGroupName && w === this.options.attributesGroupName) {
640
- const v = Object.keys(s[w]), p = v.length;
641
- for (let y = 0; y < p; y++) g += this.buildAttrPairStr(v[y], "" + s[w][v[y]]);
642
- } else d += this.processTextOrObjNode(s[w], w, f, l);
643
- return { attrStr: g, val: d };
644
- }, c.prototype.buildAttrPairStr = function(s, f) {
645
- return f = this.options.attributeValueProcessor(s, "" + f), f = this.replaceEntitiesValue(f), this.options.suppressBooleanAttributes && f === "true" ? " " + s : " " + s + '="' + f + '"';
646
- }, c.prototype.buildObjectNode = function(s, f, l, g) {
647
- if (s === "") return f[0] === "?" ? this.indentate(g) + "<" + f + l + "?" + this.tagEndChar : this.indentate(g) + "<" + f + l + this.closeTag(f) + this.tagEndChar;
648
- {
649
- let d = "</" + f + this.tagEndChar, m = "";
650
- return f[0] === "?" && (m = "?", d = ""), !l && l !== "" || s.indexOf("<") !== -1 ? this.options.commentPropName !== !1 && f === this.options.commentPropName && m.length === 0 ? this.indentate(g) + `<!--${s}-->` + this.newLine : this.indentate(g) + "<" + f + l + m + this.tagEndChar + s + this.indentate(g) + d : this.indentate(g) + "<" + f + l + m + ">" + s + d;
651
- }
652
- }, c.prototype.closeTag = function(s) {
653
- let f = "";
654
- return this.options.unpairedTags.indexOf(s) !== -1 ? this.options.suppressUnpairedNode || (f = "/") : f = this.options.suppressEmptyNode ? "/" : `></${s}`, f;
655
- }, c.prototype.buildTextValNode = function(s, f, l, g) {
656
- if (this.options.cdataPropName !== !1 && f === this.options.cdataPropName) return this.indentate(g) + `<![CDATA[${s}]]>` + this.newLine;
657
- if (this.options.commentPropName !== !1 && f === this.options.commentPropName) return this.indentate(g) + `<!--${s}-->` + this.newLine;
658
- if (f[0] === "?") return this.indentate(g) + "<" + f + l + "?" + this.tagEndChar;
659
- {
660
- let d = this.options.tagValueProcessor(f, s);
661
- return d = this.replaceEntitiesValue(d), d === "" ? this.indentate(g) + "<" + f + l + this.closeTag(f) + this.tagEndChar : this.indentate(g) + "<" + f + l + ">" + d + "</" + f + this.tagEndChar;
662
- }
663
- }, c.prototype.replaceEntitiesValue = function(s) {
664
- if (s && s.length > 0 && this.options.processEntities) for (let f = 0; f < this.options.entities.length; f++) {
665
- const l = this.options.entities[f];
666
- s = s.replace(l.regex, l.val);
667
- }
668
- return s;
669
- }, r.exports = c;
670
- }, 87: (r) => {
671
- function e(c, i, h, o) {
672
- let s = "", f = !1;
673
- for (let l = 0; l < c.length; l++) {
674
- const g = c[l], d = t(g);
675
- if (d === void 0) continue;
676
- let m = "";
677
- if (m = h.length === 0 ? d : `${h}.${d}`, d === i.textNodeName) {
678
- let y = g[d];
679
- a(m, i) || (y = i.tagValueProcessor(d, y), y = u(y, i)), f && (s += o), s += y, f = !1;
680
- continue;
681
- }
682
- if (d === i.cdataPropName) {
683
- f && (s += o), s += `<![CDATA[${g[d][0][i.textNodeName]}]]>`, f = !1;
684
- continue;
685
- }
686
- if (d === i.commentPropName) {
687
- s += o + `<!--${g[d][0][i.textNodeName]}-->`, f = !0;
688
- continue;
689
- }
690
- if (d[0] === "?") {
691
- const y = n(g[":@"], i), A = d === "?xml" ? "" : o;
692
- let N = g[d][0][i.textNodeName];
693
- N = N.length !== 0 ? " " + N : "", s += A + `<${d}${N}${y}?>`, f = !0;
694
- continue;
695
- }
696
- let w = o;
697
- w !== "" && (w += i.indentBy);
698
- const v = o + `<${d}${n(g[":@"], i)}`, p = e(g[d], i, m, w);
699
- i.unpairedTags.indexOf(d) !== -1 ? i.suppressUnpairedNode ? s += v + ">" : s += v + "/>" : p && p.length !== 0 || !i.suppressEmptyNode ? p && p.endsWith(">") ? s += v + `>${p}${o}</${d}>` : (s += v + ">", p && o !== "" && (p.includes("/>") || p.includes("</")) ? s += o + i.indentBy + p + o : s += p, s += `</${d}>`) : s += v + "/>", f = !0;
700
- }
701
- return s;
702
- }
703
- function t(c) {
704
- const i = Object.keys(c);
705
- for (let h = 0; h < i.length; h++) {
706
- const o = i[h];
707
- if (c.hasOwnProperty(o) && o !== ":@") return o;
708
- }
709
- }
710
- function n(c, i) {
711
- let h = "";
712
- if (c && !i.ignoreAttributes) for (let o in c) {
713
- if (!c.hasOwnProperty(o)) continue;
714
- let s = i.attributeValueProcessor(o, c[o]);
715
- s = u(s, i), s === !0 && i.suppressBooleanAttributes ? h += ` ${o.substr(i.attributeNamePrefix.length)}` : h += ` ${o.substr(i.attributeNamePrefix.length)}="${s}"`;
716
- }
717
- return h;
718
- }
719
- function a(c, i) {
720
- let h = (c = c.substr(0, c.length - i.textNodeName.length - 1)).substr(c.lastIndexOf(".") + 1);
721
- for (let o in i.stopNodes) if (i.stopNodes[o] === c || i.stopNodes[o] === "*." + h) return !0;
722
- return !1;
723
- }
724
- function u(c, i) {
725
- if (c && c.length > 0 && i.processEntities) for (let h = 0; h < i.entities.length; h++) {
726
- const o = i.entities[h];
727
- c = c.replace(o.regex, o.val);
728
- }
729
- return c;
730
- }
731
- r.exports = function(c, i) {
732
- let h = "";
733
- return i.format && i.indentBy.length > 0 && (h = `
734
- `), e(c, i, "", h);
735
- };
736
- }, 193: (r, e, t) => {
737
- const n = t(705);
738
- function a(f, l) {
739
- let g = "";
740
- for (; l < f.length && f[l] !== "'" && f[l] !== '"'; l++) g += f[l];
741
- if (g = g.trim(), g.indexOf(" ") !== -1) throw new Error("External entites are not supported");
742
- const d = f[l++];
743
- let m = "";
744
- for (; l < f.length && f[l] !== d; l++) m += f[l];
745
- return [g, m, l];
746
- }
747
- function u(f, l) {
748
- return f[l + 1] === "!" && f[l + 2] === "-" && f[l + 3] === "-";
749
- }
750
- function c(f, l) {
751
- return f[l + 1] === "!" && f[l + 2] === "E" && f[l + 3] === "N" && f[l + 4] === "T" && f[l + 5] === "I" && f[l + 6] === "T" && f[l + 7] === "Y";
752
- }
753
- function i(f, l) {
754
- return f[l + 1] === "!" && f[l + 2] === "E" && f[l + 3] === "L" && f[l + 4] === "E" && f[l + 5] === "M" && f[l + 6] === "E" && f[l + 7] === "N" && f[l + 8] === "T";
755
- }
756
- function h(f, l) {
757
- return f[l + 1] === "!" && f[l + 2] === "A" && f[l + 3] === "T" && f[l + 4] === "T" && f[l + 5] === "L" && f[l + 6] === "I" && f[l + 7] === "S" && f[l + 8] === "T";
758
- }
759
- function o(f, l) {
760
- return f[l + 1] === "!" && f[l + 2] === "N" && f[l + 3] === "O" && f[l + 4] === "T" && f[l + 5] === "A" && f[l + 6] === "T" && f[l + 7] === "I" && f[l + 8] === "O" && f[l + 9] === "N";
761
- }
762
- function s(f) {
763
- if (n.isName(f)) return f;
764
- throw new Error(`Invalid entity name ${f}`);
765
- }
766
- r.exports = function(f, l) {
767
- const g = {};
768
- if (f[l + 3] !== "O" || f[l + 4] !== "C" || f[l + 5] !== "T" || f[l + 6] !== "Y" || f[l + 7] !== "P" || f[l + 8] !== "E") throw new Error("Invalid Tag instead of DOCTYPE");
769
- {
770
- l += 9;
771
- let d = 1, m = !1, w = !1, v = "";
772
- for (; l < f.length; l++) if (f[l] !== "<" || w) if (f[l] === ">") {
773
- if (w ? f[l - 1] === "-" && f[l - 2] === "-" && (w = !1, d--) : d--, d === 0) break;
774
- } else f[l] === "[" ? m = !0 : v += f[l];
775
- else {
776
- if (m && c(f, l)) {
777
- let p, y;
778
- l += 7, [p, y, l] = a(f, l + 1), y.indexOf("&") === -1 && (g[s(p)] = { regx: RegExp(`&${p};`, "g"), val: y });
779
- } else if (m && i(f, l)) l += 8;
780
- else if (m && h(f, l)) l += 8;
781
- else if (m && o(f, l)) l += 9;
782
- else {
783
- if (!u) throw new Error("Invalid DOCTYPE");
784
- w = !0;
785
- }
786
- d++, v = "";
787
- }
788
- if (d !== 0) throw new Error("Unclosed DOCTYPE");
789
- }
790
- return { entities: g, i: l };
791
- };
792
- }, 63: (r, e) => {
793
- const t = { preserveOrder: !1, attributeNamePrefix: "@_", attributesGroupName: !1, textNodeName: "#text", ignoreAttributes: !0, removeNSPrefix: !1, allowBooleanAttributes: !1, parseTagValue: !0, parseAttributeValue: !1, trimValues: !0, cdataPropName: !1, numberParseOptions: { hex: !0, leadingZeros: !0, eNotation: !0 }, tagValueProcessor: function(n, a) {
794
- return a;
795
- }, attributeValueProcessor: function(n, a) {
796
- return a;
797
- }, stopNodes: [], alwaysCreateTextNode: !1, isArray: () => !1, commentPropName: !1, unpairedTags: [], processEntities: !0, htmlEntities: !1, ignoreDeclaration: !1, ignorePiTags: !1, transformTagName: !1, transformAttributeName: !1, updateTag: function(n, a, u) {
798
- return n;
799
- } };
800
- e.buildOptions = function(n) {
801
- return Object.assign({}, t, n);
802
- }, e.defaultOptions = t;
803
- }, 299: (r, e, t) => {
804
- const n = t(705), a = t(365), u = t(193), c = t(494), i = t(118);
805
- function h(b) {
806
- const E = Object.keys(b);
807
- for (let x = 0; x < E.length; x++) {
808
- const T = E[x];
809
- this.lastEntities[T] = { regex: new RegExp("&" + T + ";", "g"), val: b[T] };
810
- }
811
- }
812
- function o(b, E, x, T, O, I, C) {
813
- if (b !== void 0 && (this.options.trimValues && !T && (b = b.trim()), b.length > 0)) {
814
- C || (b = this.replaceEntitiesValue(b));
815
- const P = this.options.tagValueProcessor(E, b, x, O, I);
816
- return P == null ? b : typeof P != typeof b || P !== b ? P : this.options.trimValues || b.trim() === b ? N(b, this.options.parseTagValue, this.options.numberParseOptions) : b;
817
- }
818
- }
819
- function s(b) {
820
- if (this.options.removeNSPrefix) {
821
- const E = b.split(":"), x = b.charAt(0) === "/" ? "/" : "";
822
- if (E[0] === "xmlns") return "";
823
- E.length === 2 && (b = x + E[1]);
824
- }
825
- return b;
826
- }
827
- const f = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
828
- function l(b, E, x) {
829
- if (this.options.ignoreAttributes !== !0 && typeof b == "string") {
830
- const T = n.getAllMatches(b, f), O = T.length, I = {};
831
- for (let C = 0; C < O; C++) {
832
- const P = this.resolveNameSpace(T[C][1]);
833
- if (this.ignoreAttributesFn(P, E)) continue;
834
- let F = T[C][4], S = this.options.attributeNamePrefix + P;
835
- if (P.length) if (this.options.transformAttributeName && (S = this.options.transformAttributeName(S)), S === "__proto__" && (S = "#__proto__"), F !== void 0) {
836
- this.options.trimValues && (F = F.trim()), F = this.replaceEntitiesValue(F);
837
- const j = this.options.attributeValueProcessor(P, F, E);
838
- I[S] = j == null ? F : typeof j != typeof F || j !== F ? j : N(F, this.options.parseAttributeValue, this.options.numberParseOptions);
839
- } else this.options.allowBooleanAttributes && (I[S] = !0);
840
- }
841
- if (!Object.keys(I).length) return;
842
- if (this.options.attributesGroupName) {
843
- const C = {};
844
- return C[this.options.attributesGroupName] = I, C;
845
- }
846
- return I;
847
- }
848
- }
849
- const g = function(b) {
850
- b = b.replace(/\r\n?/g, `
851
- `);
852
- const E = new a("!xml");
853
- let x = E, T = "", O = "";
854
- for (let I = 0; I < b.length; I++) if (b[I] === "<") if (b[I + 1] === "/") {
855
- const C = p(b, ">", I, "Closing Tag is not closed.");
856
- let P = b.substring(I + 2, C).trim();
857
- if (this.options.removeNSPrefix) {
858
- const j = P.indexOf(":");
859
- j !== -1 && (P = P.substr(j + 1));
860
- }
861
- this.options.transformTagName && (P = this.options.transformTagName(P)), x && (T = this.saveTextToParentTag(T, x, O));
862
- const F = O.substring(O.lastIndexOf(".") + 1);
863
- if (P && this.options.unpairedTags.indexOf(P) !== -1) throw new Error(`Unpaired tag can not be used as closing tag: </${P}>`);
864
- let S = 0;
865
- F && this.options.unpairedTags.indexOf(F) !== -1 ? (S = O.lastIndexOf(".", O.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : S = O.lastIndexOf("."), O = O.substring(0, S), x = this.tagsNodeStack.pop(), T = "", I = C;
866
- } else if (b[I + 1] === "?") {
867
- let C = y(b, I, !1, "?>");
868
- if (!C) throw new Error("Pi Tag is not closed.");
869
- if (T = this.saveTextToParentTag(T, x, O), !(this.options.ignoreDeclaration && C.tagName === "?xml" || this.options.ignorePiTags)) {
870
- const P = new a(C.tagName);
871
- P.add(this.options.textNodeName, ""), C.tagName !== C.tagExp && C.attrExpPresent && (P[":@"] = this.buildAttributesMap(C.tagExp, O, C.tagName)), this.addChild(x, P, O);
872
- }
873
- I = C.closeIndex + 1;
874
- } else if (b.substr(I + 1, 3) === "!--") {
875
- const C = p(b, "-->", I + 4, "Comment is not closed.");
876
- if (this.options.commentPropName) {
877
- const P = b.substring(I + 4, C - 2);
878
- T = this.saveTextToParentTag(T, x, O), x.add(this.options.commentPropName, [{ [this.options.textNodeName]: P }]);
879
- }
880
- I = C;
881
- } else if (b.substr(I + 1, 2) === "!D") {
882
- const C = u(b, I);
883
- this.docTypeEntities = C.entities, I = C.i;
884
- } else if (b.substr(I + 1, 2) === "![") {
885
- const C = p(b, "]]>", I, "CDATA is not closed.") - 2, P = b.substring(I + 9, C);
886
- T = this.saveTextToParentTag(T, x, O);
887
- let F = this.parseTextData(P, x.tagname, O, !0, !1, !0, !0);
888
- F == null && (F = ""), this.options.cdataPropName ? x.add(this.options.cdataPropName, [{ [this.options.textNodeName]: P }]) : x.add(this.options.textNodeName, F), I = C + 2;
889
- } else {
890
- let C = y(b, I, this.options.removeNSPrefix), P = C.tagName;
891
- const F = C.rawTagName;
892
- let S = C.tagExp, j = C.attrExpPresent, V = C.closeIndex;
893
- this.options.transformTagName && (P = this.options.transformTagName(P)), x && T && x.tagname !== "!xml" && (T = this.saveTextToParentTag(T, x, O, !1));
894
- const _ = x;
895
- if (_ && this.options.unpairedTags.indexOf(_.tagname) !== -1 && (x = this.tagsNodeStack.pop(), O = O.substring(0, O.lastIndexOf("."))), P !== E.tagname && (O += O ? "." + P : P), this.isItStopNode(this.options.stopNodes, O, P)) {
896
- let $ = "";
897
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1) P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), O = O.substr(0, O.length - 1), S = P) : S = S.substr(0, S.length - 1), I = C.closeIndex;
898
- else if (this.options.unpairedTags.indexOf(P) !== -1) I = C.closeIndex;
899
- else {
900
- const L = this.readStopNodeData(b, F, V + 1);
901
- if (!L) throw new Error(`Unexpected end of ${F}`);
902
- I = L.i, $ = L.tagContent;
903
- }
904
- const z = new a(P);
905
- P !== S && j && (z[":@"] = this.buildAttributesMap(S, O, P)), $ && ($ = this.parseTextData($, P, O, !0, j, !0, !0)), O = O.substr(0, O.lastIndexOf(".")), z.add(this.options.textNodeName, $), this.addChild(x, z, O);
906
- } else {
907
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1) {
908
- P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), O = O.substr(0, O.length - 1), S = P) : S = S.substr(0, S.length - 1), this.options.transformTagName && (P = this.options.transformTagName(P));
909
- const $ = new a(P);
910
- P !== S && j && ($[":@"] = this.buildAttributesMap(S, O, P)), this.addChild(x, $, O), O = O.substr(0, O.lastIndexOf("."));
911
- } else {
912
- const $ = new a(P);
913
- this.tagsNodeStack.push(x), P !== S && j && ($[":@"] = this.buildAttributesMap(S, O, P)), this.addChild(x, $, O), x = $;
914
- }
915
- T = "", I = V;
916
- }
917
- }
918
- else T += b[I];
919
- return E.child;
920
- };
921
- function d(b, E, x) {
922
- const T = this.options.updateTag(E.tagname, x, E[":@"]);
923
- T === !1 || (typeof T == "string" && (E.tagname = T), b.addChild(E));
924
- }
925
- const m = function(b) {
926
- if (this.options.processEntities) {
927
- for (let E in this.docTypeEntities) {
928
- const x = this.docTypeEntities[E];
929
- b = b.replace(x.regx, x.val);
930
- }
931
- for (let E in this.lastEntities) {
932
- const x = this.lastEntities[E];
933
- b = b.replace(x.regex, x.val);
934
- }
935
- if (this.options.htmlEntities) for (let E in this.htmlEntities) {
936
- const x = this.htmlEntities[E];
937
- b = b.replace(x.regex, x.val);
938
- }
939
- b = b.replace(this.ampEntity.regex, this.ampEntity.val);
940
- }
941
- return b;
942
- };
943
- function w(b, E, x, T) {
944
- return b && (T === void 0 && (T = Object.keys(E.child).length === 0), (b = this.parseTextData(b, E.tagname, x, !1, !!E[":@"] && Object.keys(E[":@"]).length !== 0, T)) !== void 0 && b !== "" && E.add(this.options.textNodeName, b), b = ""), b;
945
- }
946
- function v(b, E, x) {
947
- const T = "*." + x;
948
- for (const O in b) {
949
- const I = b[O];
950
- if (T === I || E === I) return !0;
951
- }
952
- return !1;
953
- }
954
- function p(b, E, x, T) {
955
- const O = b.indexOf(E, x);
956
- if (O === -1) throw new Error(T);
957
- return O + E.length - 1;
958
- }
959
- function y(b, E, x) {
960
- const T = (function(j, V) {
961
- let _, $ = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : ">", z = "";
962
- for (let L = V; L < j.length; L++) {
963
- let X = j[L];
964
- if (_) X === _ && (_ = "");
965
- else if (X === '"' || X === "'") _ = X;
966
- else if (X === $[0]) {
967
- if (!$[1]) return { data: z, index: L };
968
- if (j[L + 1] === $[1]) return { data: z, index: L };
969
- } else X === " " && (X = " ");
970
- z += X;
971
- }
972
- })(b, E + 1, arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : ">");
973
- if (!T) return;
974
- let O = T.data;
975
- const I = T.index, C = O.search(/\s/);
976
- let P = O, F = !0;
977
- C !== -1 && (P = O.substring(0, C), O = O.substring(C + 1).trimStart());
978
- const S = P;
979
- if (x) {
980
- const j = P.indexOf(":");
981
- j !== -1 && (P = P.substr(j + 1), F = P !== T.data.substr(j + 1));
982
- }
983
- return { tagName: P, tagExp: O, closeIndex: I, attrExpPresent: F, rawTagName: S };
984
- }
985
- function A(b, E, x) {
986
- const T = x;
987
- let O = 1;
988
- for (; x < b.length; x++) if (b[x] === "<") if (b[x + 1] === "/") {
989
- const I = p(b, ">", x, `${E} is not closed`);
990
- if (b.substring(x + 2, I).trim() === E && (O--, O === 0)) return { tagContent: b.substring(T, x), i: I };
991
- x = I;
992
- } else if (b[x + 1] === "?") x = p(b, "?>", x + 1, "StopNode is not closed.");
993
- else if (b.substr(x + 1, 3) === "!--") x = p(b, "-->", x + 3, "StopNode is not closed.");
994
- else if (b.substr(x + 1, 2) === "![") x = p(b, "]]>", x, "StopNode is not closed.") - 2;
995
- else {
996
- const I = y(b, x, ">");
997
- I && ((I && I.tagName) === E && I.tagExp[I.tagExp.length - 1] !== "/" && O++, x = I.closeIndex);
998
- }
999
- }
1000
- function N(b, E, x) {
1001
- if (E && typeof b == "string") {
1002
- const T = b.trim();
1003
- return T === "true" || T !== "false" && c(b, x);
1004
- }
1005
- return n.isExist(b) ? b : "";
1006
- }
1007
- r.exports = class {
1008
- constructor(b) {
1009
- this.options = b, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = { apos: { regex: /&(apos|#39|#x27);/g, val: "'" }, gt: { regex: /&(gt|#62|#x3E);/g, val: ">" }, lt: { regex: /&(lt|#60|#x3C);/g, val: "<" }, quot: { regex: /&(quot|#34|#x22);/g, val: '"' } }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = { space: { regex: /&(nbsp|#160);/g, val: " " }, cent: { regex: /&(cent|#162);/g, val: "¢" }, pound: { regex: /&(pound|#163);/g, val: "£" }, yen: { regex: /&(yen|#165);/g, val: "¥" }, euro: { regex: /&(euro|#8364);/g, val: "€" }, copyright: { regex: /&(copy|#169);/g, val: "©" }, reg: { regex: /&(reg|#174);/g, val: "®" }, inr: { regex: /&(inr|#8377);/g, val: "₹" }, num_dec: { regex: /&#([0-9]{1,7});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 10)) }, num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 16)) } }, this.addExternalEntities = h, this.parseXml = g, this.parseTextData = o, this.resolveNameSpace = s, this.buildAttributesMap = l, this.isItStopNode = v, this.replaceEntitiesValue = m, this.readStopNodeData = A, this.saveTextToParentTag = w, this.addChild = d, this.ignoreAttributesFn = i(this.options.ignoreAttributes);
1010
- }
1011
- };
1012
- }, 338: (r, e, t) => {
1013
- const { buildOptions: n } = t(63), a = t(299), { prettify: u } = t(728), c = t(31);
1014
- r.exports = class {
1015
- constructor(i) {
1016
- this.externalEntities = {}, this.options = n(i);
1017
- }
1018
- parse(i, h) {
1019
- if (typeof i != "string") {
1020
- if (!i.toString) throw new Error("XML data is accepted in String or Bytes[] form.");
1021
- i = i.toString();
1022
- }
1023
- if (h) {
1024
- h === !0 && (h = {});
1025
- const f = c.validate(i, h);
1026
- if (f !== !0) throw Error(`${f.err.msg}:${f.err.line}:${f.err.col}`);
1027
- }
1028
- const o = new a(this.options);
1029
- o.addExternalEntities(this.externalEntities);
1030
- const s = o.parseXml(i);
1031
- return this.options.preserveOrder || s === void 0 ? s : u(s, this.options);
1032
- }
1033
- addEntity(i, h) {
1034
- if (h.indexOf("&") !== -1) throw new Error("Entity value can't have '&'");
1035
- if (i.indexOf("&") !== -1 || i.indexOf(";") !== -1) throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1036
- if (h === "&") throw new Error("An entity with value '&' is not permitted");
1037
- this.externalEntities[i] = h;
1038
- }
1039
- };
1040
- }, 728: (r, e) => {
1041
- function t(c, i, h) {
1042
- let o;
1043
- const s = {};
1044
- for (let f = 0; f < c.length; f++) {
1045
- const l = c[f], g = n(l);
1046
- let d = "";
1047
- if (d = h === void 0 ? g : h + "." + g, g === i.textNodeName) o === void 0 ? o = l[g] : o += "" + l[g];
1048
- else {
1049
- if (g === void 0) continue;
1050
- if (l[g]) {
1051
- let m = t(l[g], i, d);
1052
- const w = u(m, i);
1053
- l[":@"] ? a(m, l[":@"], d, i) : Object.keys(m).length !== 1 || m[i.textNodeName] === void 0 || i.alwaysCreateTextNode ? Object.keys(m).length === 0 && (i.alwaysCreateTextNode ? m[i.textNodeName] = "" : m = "") : m = m[i.textNodeName], s[g] !== void 0 && s.hasOwnProperty(g) ? (Array.isArray(s[g]) || (s[g] = [s[g]]), s[g].push(m)) : i.isArray(g, d, w) ? s[g] = [m] : s[g] = m;
1054
- }
1055
- }
1056
- }
1057
- return typeof o == "string" ? o.length > 0 && (s[i.textNodeName] = o) : o !== void 0 && (s[i.textNodeName] = o), s;
1058
- }
1059
- function n(c) {
1060
- const i = Object.keys(c);
1061
- for (let h = 0; h < i.length; h++) {
1062
- const o = i[h];
1063
- if (o !== ":@") return o;
1064
- }
1065
- }
1066
- function a(c, i, h, o) {
1067
- if (i) {
1068
- const s = Object.keys(i), f = s.length;
1069
- for (let l = 0; l < f; l++) {
1070
- const g = s[l];
1071
- o.isArray(g, h + "." + g, !0, !0) ? c[g] = [i[g]] : c[g] = i[g];
1072
- }
1073
- }
1074
- }
1075
- function u(c, i) {
1076
- const { textNodeName: h } = i, o = Object.keys(c).length;
1077
- return o === 0 || !(o !== 1 || !c[h] && typeof c[h] != "boolean" && c[h] !== 0);
1078
- }
1079
- e.prettify = function(c, i) {
1080
- return t(c, i);
1081
- };
1082
- }, 365: (r) => {
1083
- r.exports = class {
1084
- constructor(e) {
1085
- this.tagname = e, this.child = [], this[":@"] = {};
1086
- }
1087
- add(e, t) {
1088
- e === "__proto__" && (e = "#__proto__"), this.child.push({ [e]: t });
1089
- }
1090
- addChild(e) {
1091
- 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 });
1092
- }
1093
- };
1094
- }, 135: (r) => {
1095
- function e(t) {
1096
- return !!t.constructor && typeof t.constructor.isBuffer == "function" && t.constructor.isBuffer(t);
1097
- }
1098
- r.exports = function(t) {
1099
- return t != null && (e(t) || (function(n) {
1100
- return typeof n.readFloatLE == "function" && typeof n.slice == "function" && e(n.slice(0, 0));
1101
- })(t) || !!t._isBuffer);
1102
- };
1103
- }, 542: (r, e, t) => {
1104
- (function() {
1105
- var n = t(298), a = t(526).utf8, u = t(135), c = t(526).bin, i = function(h, o) {
1106
- h.constructor == String ? h = o && o.encoding === "binary" ? c.stringToBytes(h) : a.stringToBytes(h) : u(h) ? h = Array.prototype.slice.call(h, 0) : Array.isArray(h) || h.constructor === Uint8Array || (h = h.toString());
1107
- for (var s = n.bytesToWords(h), f = 8 * h.length, l = 1732584193, g = -271733879, d = -1732584194, m = 271733878, w = 0; w < s.length; w++) s[w] = 16711935 & (s[w] << 8 | s[w] >>> 24) | 4278255360 & (s[w] << 24 | s[w] >>> 8);
1108
- s[f >>> 5] |= 128 << f % 32, s[14 + (f + 64 >>> 9 << 4)] = f;
1109
- var v = i._ff, p = i._gg, y = i._hh, A = i._ii;
1110
- for (w = 0; w < s.length; w += 16) {
1111
- var N = l, b = g, E = d, x = m;
1112
- l = v(l, g, d, m, s[w + 0], 7, -680876936), m = v(m, l, g, d, s[w + 1], 12, -389564586), d = v(d, m, l, g, s[w + 2], 17, 606105819), g = v(g, d, m, l, s[w + 3], 22, -1044525330), l = v(l, g, d, m, s[w + 4], 7, -176418897), m = v(m, l, g, d, s[w + 5], 12, 1200080426), d = v(d, m, l, g, s[w + 6], 17, -1473231341), g = v(g, d, m, l, s[w + 7], 22, -45705983), l = v(l, g, d, m, s[w + 8], 7, 1770035416), m = v(m, l, g, d, s[w + 9], 12, -1958414417), d = v(d, m, l, g, s[w + 10], 17, -42063), g = v(g, d, m, l, s[w + 11], 22, -1990404162), l = v(l, g, d, m, s[w + 12], 7, 1804603682), m = v(m, l, g, d, s[w + 13], 12, -40341101), d = v(d, m, l, g, s[w + 14], 17, -1502002290), l = p(l, g = v(g, d, m, l, s[w + 15], 22, 1236535329), d, m, s[w + 1], 5, -165796510), m = p(m, l, g, d, s[w + 6], 9, -1069501632), d = p(d, m, l, g, s[w + 11], 14, 643717713), g = p(g, d, m, l, s[w + 0], 20, -373897302), l = p(l, g, d, m, s[w + 5], 5, -701558691), m = p(m, l, g, d, s[w + 10], 9, 38016083), d = p(d, m, l, g, s[w + 15], 14, -660478335), g = p(g, d, m, l, s[w + 4], 20, -405537848), l = p(l, g, d, m, s[w + 9], 5, 568446438), m = p(m, l, g, d, s[w + 14], 9, -1019803690), d = p(d, m, l, g, s[w + 3], 14, -187363961), g = p(g, d, m, l, s[w + 8], 20, 1163531501), l = p(l, g, d, m, s[w + 13], 5, -1444681467), m = p(m, l, g, d, s[w + 2], 9, -51403784), d = p(d, m, l, g, s[w + 7], 14, 1735328473), l = y(l, g = p(g, d, m, l, s[w + 12], 20, -1926607734), d, m, s[w + 5], 4, -378558), m = y(m, l, g, d, s[w + 8], 11, -2022574463), d = y(d, m, l, g, s[w + 11], 16, 1839030562), g = y(g, d, m, l, s[w + 14], 23, -35309556), l = y(l, g, d, m, s[w + 1], 4, -1530992060), m = y(m, l, g, d, s[w + 4], 11, 1272893353), d = y(d, m, l, g, s[w + 7], 16, -155497632), g = y(g, d, m, l, s[w + 10], 23, -1094730640), l = y(l, g, d, m, s[w + 13], 4, 681279174), m = y(m, l, g, d, s[w + 0], 11, -358537222), d = y(d, m, l, g, s[w + 3], 16, -722521979), g = y(g, d, m, l, s[w + 6], 23, 76029189), l = y(l, g, d, m, s[w + 9], 4, -640364487), m = y(m, l, g, d, s[w + 12], 11, -421815835), d = y(d, m, l, g, s[w + 15], 16, 530742520), l = A(l, g = y(g, d, m, l, s[w + 2], 23, -995338651), d, m, s[w + 0], 6, -198630844), m = A(m, l, g, d, s[w + 7], 10, 1126891415), d = A(d, m, l, g, s[w + 14], 15, -1416354905), g = A(g, d, m, l, s[w + 5], 21, -57434055), l = A(l, g, d, m, s[w + 12], 6, 1700485571), m = A(m, l, g, d, s[w + 3], 10, -1894986606), d = A(d, m, l, g, s[w + 10], 15, -1051523), g = A(g, d, m, l, s[w + 1], 21, -2054922799), l = A(l, g, d, m, s[w + 8], 6, 1873313359), m = A(m, l, g, d, s[w + 15], 10, -30611744), d = A(d, m, l, g, s[w + 6], 15, -1560198380), g = A(g, d, m, l, s[w + 13], 21, 1309151649), l = A(l, g, d, m, s[w + 4], 6, -145523070), m = A(m, l, g, d, s[w + 11], 10, -1120210379), d = A(d, m, l, g, s[w + 2], 15, 718787259), g = A(g, d, m, l, s[w + 9], 21, -343485551), l = l + N >>> 0, g = g + b >>> 0, d = d + E >>> 0, m = m + x >>> 0;
1113
- }
1114
- return n.endian([l, g, d, m]);
1115
- };
1116
- i._ff = function(h, o, s, f, l, g, d) {
1117
- var m = h + (o & s | ~o & f) + (l >>> 0) + d;
1118
- return (m << g | m >>> 32 - g) + o;
1119
- }, i._gg = function(h, o, s, f, l, g, d) {
1120
- var m = h + (o & f | s & ~f) + (l >>> 0) + d;
1121
- return (m << g | m >>> 32 - g) + o;
1122
- }, i._hh = function(h, o, s, f, l, g, d) {
1123
- var m = h + (o ^ s ^ f) + (l >>> 0) + d;
1124
- return (m << g | m >>> 32 - g) + o;
1125
- }, i._ii = function(h, o, s, f, l, g, d) {
1126
- var m = h + (s ^ (o | ~f)) + (l >>> 0) + d;
1127
- return (m << g | m >>> 32 - g) + o;
1128
- }, i._blocksize = 16, i._digestsize = 16, r.exports = function(h, o) {
1129
- if (h == null) throw new Error("Illegal argument " + h);
1130
- var s = n.wordsToBytes(i(h, o));
1131
- return o && o.asBytes ? s : o && o.asString ? c.bytesToString(s) : n.bytesToHex(s);
1132
- };
1133
- })();
1134
- }, 285: (r, e, t) => {
1135
- var n = t(2);
1136
- r.exports = function(v) {
1137
- return v ? (v.substr(0, 2) === "{}" && (v = "\\{\\}" + v.substr(2)), w((function(p) {
1138
- return p.split("\\\\").join(a).split("\\{").join(u).split("\\}").join(c).split("\\,").join(i).split("\\.").join(h);
1139
- })(v), !0).map(s)) : [];
1140
- };
1141
- var a = "\0SLASH" + Math.random() + "\0", u = "\0OPEN" + Math.random() + "\0", c = "\0CLOSE" + Math.random() + "\0", i = "\0COMMA" + Math.random() + "\0", h = "\0PERIOD" + Math.random() + "\0";
1142
- function o(v) {
1143
- return parseInt(v, 10) == v ? parseInt(v, 10) : v.charCodeAt(0);
1144
- }
1145
- function s(v) {
1146
- return v.split(a).join("\\").split(u).join("{").split(c).join("}").split(i).join(",").split(h).join(".");
1147
- }
1148
- function f(v) {
1149
- if (!v) return [""];
1150
- var p = [], y = n("{", "}", v);
1151
- if (!y) return v.split(",");
1152
- var A = y.pre, N = y.body, b = y.post, E = A.split(",");
1153
- E[E.length - 1] += "{" + N + "}";
1154
- var x = f(b);
1155
- return b.length && (E[E.length - 1] += x.shift(), E.push.apply(E, x)), p.push.apply(p, E), p;
1156
- }
1157
- function l(v) {
1158
- return "{" + v + "}";
1159
- }
1160
- function g(v) {
1161
- return /^-?0\d/.test(v);
1162
- }
1163
- function d(v, p) {
1164
- return v <= p;
1165
- }
1166
- function m(v, p) {
1167
- return v >= p;
1168
- }
1169
- function w(v, p) {
1170
- var y = [], A = n("{", "}", v);
1171
- if (!A) return [v];
1172
- var N = A.pre, b = A.post.length ? w(A.post, !1) : [""];
1173
- if (/\$$/.test(A.pre)) for (var E = 0; E < b.length; E++) {
1174
- var x = N + "{" + A.body + "}" + b[E];
1175
- y.push(x);
1176
- }
1177
- else {
1178
- var T, O, I = /^-?\d+\.\.-?\d+(?:\.\.-?\d+)?$/.test(A.body), C = /^[a-zA-Z]\.\.[a-zA-Z](?:\.\.-?\d+)?$/.test(A.body), P = I || C, F = A.body.indexOf(",") >= 0;
1179
- if (!P && !F) return A.post.match(/,.*\}/) ? w(v = A.pre + "{" + A.body + c + A.post) : [v];
1180
- if (P) T = A.body.split(/\.\./);
1181
- else if ((T = f(A.body)).length === 1 && (T = w(T[0], !1).map(l)).length === 1) return b.map((function(wr) {
1182
- return A.pre + T[0] + wr;
1183
- }));
1184
- if (P) {
1185
- var S = o(T[0]), j = o(T[1]), V = Math.max(T[0].length, T[1].length), _ = T.length == 3 ? Math.abs(o(T[2])) : 1, $ = d;
1186
- j < S && (_ *= -1, $ = m);
1187
- var z = T.some(g);
1188
- O = [];
1189
- for (var L = S; $(L, j); L += _) {
1190
- var X;
1191
- if (C) (X = String.fromCharCode(L)) === "\\" && (X = "");
1192
- else if (X = String(L), z) {
1193
- var gt = V - X.length;
1194
- if (gt > 0) {
1195
- var dt = new Array(gt + 1).join("0");
1196
- X = L < 0 ? "-" + dt + X.slice(1) : dt + X;
1197
- }
1198
- }
1199
- O.push(X);
1200
- }
1201
- } else {
1202
- O = [];
1203
- for (var ie = 0; ie < T.length; ie++) O.push.apply(O, w(T[ie], !1));
1204
- }
1205
- for (ie = 0; ie < O.length; ie++) for (E = 0; E < b.length; E++) x = N + O[ie] + b[E], (!p || P || x) && y.push(x);
1206
- }
1207
- return y;
1208
- }
1209
- }, 829: (r) => {
1210
- function e(o) {
1211
- return e = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(s) {
1212
- return typeof s;
1213
- } : function(s) {
1214
- return s && typeof Symbol == "function" && s.constructor === Symbol && s !== Symbol.prototype ? "symbol" : typeof s;
1215
- }, e(o);
1216
- }
1217
- function t(o) {
1218
- var s = typeof Map == "function" ? /* @__PURE__ */ new Map() : void 0;
1219
- return t = function(f) {
1220
- if (f === null || (l = f, Function.toString.call(l).indexOf("[native code]") === -1)) return f;
1221
- var l;
1222
- if (typeof f != "function") throw new TypeError("Super expression must either be null or a function");
1223
- if (s !== void 0) {
1224
- if (s.has(f)) return s.get(f);
1225
- s.set(f, g);
1226
- }
1227
- function g() {
1228
- return n(f, arguments, u(this).constructor);
1229
- }
1230
- return g.prototype = Object.create(f.prototype, { constructor: { value: g, enumerable: !1, writable: !0, configurable: !0 } }), a(g, f);
1231
- }, t(o);
1232
- }
1233
- function n(o, s, f) {
1234
- return n = (function() {
1235
- if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham) return !1;
1236
- if (typeof Proxy == "function") return !0;
1237
- try {
1238
- return Date.prototype.toString.call(Reflect.construct(Date, [], (function() {
1239
- }))), !0;
1240
- } catch {
1241
- return !1;
1242
- }
1243
- })() ? Reflect.construct : function(l, g, d) {
1244
- var m = [null];
1245
- m.push.apply(m, g);
1246
- var w = new (Function.bind.apply(l, m))();
1247
- return d && a(w, d.prototype), w;
1248
- }, n.apply(null, arguments);
1249
- }
1250
- function a(o, s) {
1251
- return a = Object.setPrototypeOf || function(f, l) {
1252
- return f.__proto__ = l, f;
1253
- }, a(o, s);
1254
- }
1255
- function u(o) {
1256
- return u = Object.setPrototypeOf ? Object.getPrototypeOf : function(s) {
1257
- return s.__proto__ || Object.getPrototypeOf(s);
1258
- }, u(o);
1259
- }
1260
- var c = (function(o) {
1261
- function s(f) {
1262
- var l;
1263
- return (function(g, d) {
1264
- if (!(g instanceof d)) throw new TypeError("Cannot call a class as a function");
1265
- })(this, s), (l = (function(g, d) {
1266
- return !d || e(d) !== "object" && typeof d != "function" ? (function(m) {
1267
- if (m === void 0) throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
1268
- return m;
1269
- })(g) : d;
1270
- })(this, u(s).call(this, f))).name = "ObjectPrototypeMutationError", l;
1271
- }
1272
- return (function(f, l) {
1273
- if (typeof l != "function" && l !== null) throw new TypeError("Super expression must either be null or a function");
1274
- f.prototype = Object.create(l && l.prototype, { constructor: { value: f, writable: !0, configurable: !0 } }), l && a(f, l);
1275
- })(s, o), s;
1276
- })(t(Error));
1277
- function i(o, s) {
1278
- for (var f = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : function() {
1279
- }, l = s.split("."), g = l.length, d = function(v) {
1280
- var p = l[v];
1281
- if (!o) return { v: void 0 };
1282
- if (p === "+") {
1283
- if (Array.isArray(o)) return { v: o.map((function(A, N) {
1284
- var b = l.slice(v + 1);
1285
- return b.length > 0 ? i(A, b.join("."), f) : f(o, N, l, v);
1286
- })) };
1287
- var y = l.slice(0, v).join(".");
1288
- throw new Error("Object at wildcard (".concat(y, ") is not an array"));
1289
- }
1290
- o = f(o, p, l, v);
1291
- }, m = 0; m < g; m++) {
1292
- var w = d(m);
1293
- if (e(w) === "object") return w.v;
1294
- }
1295
- return o;
1296
- }
1297
- function h(o, s) {
1298
- return o.length === s + 1;
1299
- }
1300
- r.exports = { set: function(o, s, f) {
1301
- if (e(o) != "object" || o === null || s === void 0) return o;
1302
- if (typeof s == "number") return o[s] = f, o[s];
1303
- try {
1304
- return i(o, s, (function(l, g, d, m) {
1305
- if (l === Reflect.getPrototypeOf({})) throw new c("Attempting to mutate Object.prototype");
1306
- if (!l[g]) {
1307
- var w = Number.isInteger(Number(d[m + 1])), v = d[m + 1] === "+";
1308
- l[g] = w || v ? [] : {};
1309
- }
1310
- return h(d, m) && (l[g] = f), l[g];
1311
- }));
1312
- } catch (l) {
1313
- if (l instanceof c) throw l;
1314
- return o;
1315
- }
1316
- }, get: function(o, s) {
1317
- if (e(o) != "object" || o === null || s === void 0) return o;
1318
- if (typeof s == "number") return o[s];
1319
- try {
1320
- return i(o, s, (function(f, l) {
1321
- return f[l];
1322
- }));
1323
- } catch {
1324
- return o;
1325
- }
1326
- }, has: function(o, s) {
1327
- var f = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1328
- if (e(o) != "object" || o === null || s === void 0) return !1;
1329
- if (typeof s == "number") return s in o;
1330
- try {
1331
- var l = !1;
1332
- return i(o, s, (function(g, d, m, w) {
1333
- if (!h(m, w)) return g && g[d];
1334
- l = f.own ? g.hasOwnProperty(d) : d in g;
1335
- })), l;
1336
- } catch {
1337
- return !1;
1338
- }
1339
- }, hasOwn: function(o, s, f) {
1340
- return this.has(o, s, f || { own: !0 });
1341
- }, isIn: function(o, s, f) {
1342
- var l = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
1343
- if (e(o) != "object" || o === null || s === void 0) return !1;
1344
- try {
1345
- var g = !1, d = !1;
1346
- return i(o, s, (function(m, w, v, p) {
1347
- return g = g || m === f || !!m && m[w] === f, d = h(v, p) && e(m) === "object" && w in m, m && m[w];
1348
- })), l.validPath ? g && d : g;
1349
- } catch {
1350
- return !1;
1351
- }
1352
- }, ObjectPrototypeMutationError: c };
1353
- }, 47: (r, e, t) => {
1354
- var n = t(410), a = function(o) {
1355
- return typeof o == "string";
1356
- };
1357
- function u(o, s) {
1358
- for (var f = [], l = 0; l < o.length; l++) {
1359
- var g = o[l];
1360
- g && g !== "." && (g === ".." ? f.length && f[f.length - 1] !== ".." ? f.pop() : s && f.push("..") : f.push(g));
1361
- }
1362
- return f;
1363
- }
1364
- var c = /^(\/?|)([\s\S]*?)((?:\.{1,2}|[^\/]+?|)(\.[^.\/]*|))(?:[\/]*)$/, i = {};
1365
- function h(o) {
1366
- return c.exec(o).slice(1);
1367
- }
1368
- i.resolve = function() {
1369
- for (var o = "", s = !1, f = arguments.length - 1; f >= -1 && !s; f--) {
1370
- var l = f >= 0 ? arguments[f] : oe.cwd();
1371
- if (!a(l)) throw new TypeError("Arguments to path.resolve must be strings");
1372
- l && (o = l + "/" + o, s = l.charAt(0) === "/");
1373
- }
1374
- return (s ? "/" : "") + (o = u(o.split("/"), !s).join("/")) || ".";
1375
- }, i.normalize = function(o) {
1376
- var s = i.isAbsolute(o), f = o.substr(-1) === "/";
1377
- return (o = u(o.split("/"), !s).join("/")) || s || (o = "."), o && f && (o += "/"), (s ? "/" : "") + o;
1378
- }, i.isAbsolute = function(o) {
1379
- return o.charAt(0) === "/";
1380
- }, i.join = function() {
1381
- for (var o = "", s = 0; s < arguments.length; s++) {
1382
- var f = arguments[s];
1383
- if (!a(f)) throw new TypeError("Arguments to path.join must be strings");
1384
- f && (o += o ? "/" + f : f);
1385
- }
1386
- return i.normalize(o);
1387
- }, i.relative = function(o, s) {
1388
- function f(p) {
1389
- for (var y = 0; y < p.length && p[y] === ""; y++) ;
1390
- for (var A = p.length - 1; A >= 0 && p[A] === ""; A--) ;
1391
- return y > A ? [] : p.slice(y, A + 1);
1392
- }
1393
- o = i.resolve(o).substr(1), s = i.resolve(s).substr(1);
1394
- for (var l = f(o.split("/")), g = f(s.split("/")), d = Math.min(l.length, g.length), m = d, w = 0; w < d; w++) if (l[w] !== g[w]) {
1395
- m = w;
1396
- break;
1397
- }
1398
- var v = [];
1399
- for (w = m; w < l.length; w++) v.push("..");
1400
- return (v = v.concat(g.slice(m))).join("/");
1401
- }, i._makeLong = function(o) {
1402
- return o;
1403
- }, i.dirname = function(o) {
1404
- var s = h(o), f = s[0], l = s[1];
1405
- return f || l ? (l && (l = l.substr(0, l.length - 1)), f + l) : ".";
1406
- }, i.basename = function(o, s) {
1407
- var f = h(o)[2];
1408
- return s && f.substr(-1 * s.length) === s && (f = f.substr(0, f.length - s.length)), f;
1409
- }, i.extname = function(o) {
1410
- return h(o)[3];
1411
- }, i.format = function(o) {
1412
- if (!n.isObject(o)) throw new TypeError("Parameter 'pathObject' must be an object, not " + typeof o);
1413
- var s = o.root || "";
1414
- if (!a(s)) throw new TypeError("'pathObject.root' must be a string or undefined, not " + typeof o.root);
1415
- return (o.dir ? o.dir + i.sep : "") + (o.base || "");
1416
- }, i.parse = function(o) {
1417
- if (!a(o)) throw new TypeError("Parameter 'pathString' must be a string, not " + typeof o);
1418
- var s = h(o);
1419
- if (!s || s.length !== 4) throw new TypeError("Invalid path '" + o + "'");
1420
- return s[1] = s[1] || "", s[2] = s[2] || "", s[3] = s[3] || "", { root: s[0], dir: s[0] + s[1].slice(0, s[1].length - 1), base: s[2], ext: s[3], name: s[2].slice(0, s[2].length - s[3].length) };
1421
- }, i.sep = "/", i.delimiter = ":", r.exports = i;
1422
- }, 647: (r, e) => {
1423
- var t = Object.prototype.hasOwnProperty;
1424
- function n(u) {
1425
- try {
1426
- return decodeURIComponent(u.replace(/\+/g, " "));
1427
- } catch {
1428
- return null;
1429
- }
1430
- }
1431
- function a(u) {
1432
- try {
1433
- return encodeURIComponent(u);
1434
- } catch {
1435
- return null;
1436
- }
1437
- }
1438
- e.stringify = function(u, c) {
1439
- c = c || "";
1440
- var i, h, o = [];
1441
- for (h in typeof c != "string" && (c = "?"), u) if (t.call(u, h)) {
1442
- if ((i = u[h]) || i != null && !isNaN(i) || (i = ""), h = a(h), i = a(i), h === null || i === null) continue;
1443
- o.push(h + "=" + i);
1444
- }
1445
- return o.length ? c + o.join("&") : "";
1446
- }, e.parse = function(u) {
1447
- for (var c, i = /([^=?#&]+)=?([^&]*)/g, h = {}; c = i.exec(u); ) {
1448
- var o = n(c[1]), s = n(c[2]);
1449
- o === null || s === null || o in h || (h[o] = s);
1450
- }
1451
- return h;
1452
- };
1453
- }, 670: (r) => {
1454
- r.exports = function(e, t) {
1455
- if (t = t.split(":")[0], !(e = +e)) return !1;
1456
- switch (t) {
1457
- case "http":
1458
- case "ws":
1459
- return e !== 80;
1460
- case "https":
1461
- case "wss":
1462
- return e !== 443;
1463
- case "ftp":
1464
- return e !== 21;
1465
- case "gopher":
1466
- return e !== 70;
1467
- case "file":
1468
- return !1;
1469
- }
1470
- return e !== 0;
1471
- };
1472
- }, 494: (r) => {
1473
- const e = /^[-+]?0x[a-fA-F0-9]+$/, t = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
1474
- !Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt), !Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
1475
- const n = { hex: !0, leadingZeros: !0, decimalPoint: ".", eNotation: !0 };
1476
- r.exports = function(a) {
1477
- let u = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1478
- if (u = Object.assign({}, n, u), !a || typeof a != "string") return a;
1479
- let c = a.trim();
1480
- if (u.skipLike !== void 0 && u.skipLike.test(c)) return a;
1481
- if (u.hex && e.test(c)) return Number.parseInt(c, 16);
1482
- {
1483
- const h = t.exec(c);
1484
- if (h) {
1485
- const o = h[1], s = h[2];
1486
- let f = ((i = h[3]) && i.indexOf(".") !== -1 && ((i = i.replace(/0+$/, "")) === "." ? i = "0" : i[0] === "." ? i = "0" + i : i[i.length - 1] === "." && (i = i.substr(0, i.length - 1))), i);
1487
- const l = h[4] || h[6];
1488
- if (!u.leadingZeros && s.length > 0 && o && c[2] !== "." || !u.leadingZeros && s.length > 0 && !o && c[1] !== ".") return a;
1489
- {
1490
- const g = Number(c), d = "" + g;
1491
- return d.search(/[eE]/) !== -1 || l ? u.eNotation ? g : a : c.indexOf(".") !== -1 ? d === "0" && f === "" || d === f || o && d === "-" + f ? g : a : s ? f === d || o + f === d ? g : a : c === d || c === o + d ? g : a;
1492
- }
1493
- }
1494
- return a;
1495
- }
1496
- var i;
1497
- };
1498
- }, 737: (r, e, t) => {
1499
- var n = t(670), a = t(647), u = /^[\x00-\x20\u00a0\u1680\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff]+/, c = /[\n\r\t]/g, i = /^[A-Za-z][A-Za-z0-9+-.]*:\/\//, h = /:\d+$/, o = /^([a-z][a-z0-9.+-]*:)?(\/\/)?([\\/]+)?([\S\s]*)/i, s = /^[a-zA-Z]:/;
1500
- function f(p) {
1501
- return (p || "").toString().replace(u, "");
1502
- }
1503
- var l = [["#", "hash"], ["?", "query"], function(p, y) {
1504
- return m(y.protocol) ? p.replace(/\\/g, "/") : p;
1505
- }, ["/", "pathname"], ["@", "auth", 1], [NaN, "host", void 0, 1, 1], [/:(\d*)$/, "port", void 0, 1], [NaN, "hostname", void 0, 1, 1]], g = { hash: 1, query: 1 };
1506
- function d(p) {
1507
- var y, A = (typeof window < "u" ? window : typeof ve < "u" ? ve : typeof self < "u" ? self : {}).location || {}, N = {}, b = typeof (p = p || A);
1508
- if (p.protocol === "blob:") N = new v(unescape(p.pathname), {});
1509
- else if (b === "string") for (y in N = new v(p, {}), g) delete N[y];
1510
- else if (b === "object") {
1511
- for (y in p) y in g || (N[y] = p[y]);
1512
- N.slashes === void 0 && (N.slashes = i.test(p.href));
1513
- }
1514
- return N;
1515
- }
1516
- function m(p) {
1517
- return p === "file:" || p === "ftp:" || p === "http:" || p === "https:" || p === "ws:" || p === "wss:";
1518
- }
1519
- function w(p, y) {
1520
- p = (p = f(p)).replace(c, ""), y = y || {};
1521
- var A, N = o.exec(p), b = N[1] ? N[1].toLowerCase() : "", E = !!N[2], x = !!N[3], T = 0;
1522
- return E ? x ? (A = N[2] + N[3] + N[4], T = N[2].length + N[3].length) : (A = N[2] + N[4], T = N[2].length) : x ? (A = N[3] + N[4], T = N[3].length) : A = N[4], b === "file:" ? T >= 2 && (A = A.slice(2)) : m(b) ? A = N[4] : b ? E && (A = A.slice(2)) : T >= 2 && m(y.protocol) && (A = N[4]), { protocol: b, slashes: E || m(b), slashesCount: T, rest: A };
1523
- }
1524
- function v(p, y, A) {
1525
- if (p = (p = f(p)).replace(c, ""), !(this instanceof v)) return new v(p, y, A);
1526
- var N, b, E, x, T, O, I = l.slice(), C = typeof y, P = this, F = 0;
1527
- for (C !== "object" && C !== "string" && (A = y, y = null), A && typeof A != "function" && (A = a.parse), N = !(b = w(p || "", y = d(y))).protocol && !b.slashes, P.slashes = b.slashes || N && y.slashes, P.protocol = b.protocol || y.protocol || "", p = b.rest, (b.protocol === "file:" && (b.slashesCount !== 2 || s.test(p)) || !b.slashes && (b.protocol || b.slashesCount < 2 || !m(P.protocol))) && (I[3] = [/(.*)/, "pathname"]); F < I.length; F++) typeof (x = I[F]) != "function" ? (E = x[0], O = x[1], E != E ? P[O] = p : typeof E == "string" ? ~(T = E === "@" ? p.lastIndexOf(E) : p.indexOf(E)) && (typeof x[2] == "number" ? (P[O] = p.slice(0, T), p = p.slice(T + x[2])) : (P[O] = p.slice(T), p = p.slice(0, T))) : (T = E.exec(p)) && (P[O] = T[1], p = p.slice(0, T.index)), P[O] = P[O] || N && x[3] && y[O] || "", x[4] && (P[O] = P[O].toLowerCase())) : p = x(p, P);
1528
- A && (P.query = A(P.query)), N && y.slashes && P.pathname.charAt(0) !== "/" && (P.pathname !== "" || y.pathname !== "") && (P.pathname = (function(S, j) {
1529
- if (S === "") return j;
1530
- for (var V = (j || "/").split("/").slice(0, -1).concat(S.split("/")), _ = V.length, $ = V[_ - 1], z = !1, L = 0; _--; ) V[_] === "." ? V.splice(_, 1) : V[_] === ".." ? (V.splice(_, 1), L++) : L && (_ === 0 && (z = !0), V.splice(_, 1), L--);
1531
- return z && V.unshift(""), $ !== "." && $ !== ".." || V.push(""), V.join("/");
1532
- })(P.pathname, y.pathname)), P.pathname.charAt(0) !== "/" && m(P.protocol) && (P.pathname = "/" + P.pathname), n(P.port, P.protocol) || (P.host = P.hostname, P.port = ""), P.username = P.password = "", P.auth && (~(T = P.auth.indexOf(":")) ? (P.username = P.auth.slice(0, T), P.username = encodeURIComponent(decodeURIComponent(P.username)), P.password = P.auth.slice(T + 1), P.password = encodeURIComponent(decodeURIComponent(P.password))) : P.username = encodeURIComponent(decodeURIComponent(P.auth)), P.auth = P.password ? P.username + ":" + P.password : P.username), P.origin = P.protocol !== "file:" && m(P.protocol) && P.host ? P.protocol + "//" + P.host : "null", P.href = P.toString();
1533
- }
1534
- v.prototype = { set: function(p, y, A) {
1535
- var N = this;
1536
- switch (p) {
1537
- case "query":
1538
- typeof y == "string" && y.length && (y = (A || a.parse)(y)), N[p] = y;
1539
- break;
1540
- case "port":
1541
- N[p] = y, n(y, N.protocol) ? y && (N.host = N.hostname + ":" + y) : (N.host = N.hostname, N[p] = "");
1542
- break;
1543
- case "hostname":
1544
- N[p] = y, N.port && (y += ":" + N.port), N.host = y;
1545
- break;
1546
- case "host":
1547
- N[p] = y, h.test(y) ? (y = y.split(":"), N.port = y.pop(), N.hostname = y.join(":")) : (N.hostname = y, N.port = "");
1548
- break;
1549
- case "protocol":
1550
- N.protocol = y.toLowerCase(), N.slashes = !A;
1551
- break;
1552
- case "pathname":
1553
- case "hash":
1554
- if (y) {
1555
- var b = p === "pathname" ? "/" : "#";
1556
- N[p] = y.charAt(0) !== b ? b + y : y;
1557
- } else N[p] = y;
1558
- break;
1559
- case "username":
1560
- case "password":
1561
- N[p] = encodeURIComponent(y);
1562
- break;
1563
- case "auth":
1564
- var E = y.indexOf(":");
1565
- ~E ? (N.username = y.slice(0, E), N.username = encodeURIComponent(decodeURIComponent(N.username)), N.password = y.slice(E + 1), N.password = encodeURIComponent(decodeURIComponent(N.password))) : N.username = encodeURIComponent(decodeURIComponent(y));
1566
- }
1567
- for (var x = 0; x < l.length; x++) {
1568
- var T = l[x];
1569
- T[4] && (N[T[1]] = N[T[1]].toLowerCase());
1570
- }
1571
- return N.auth = N.password ? N.username + ":" + N.password : N.username, N.origin = N.protocol !== "file:" && m(N.protocol) && N.host ? N.protocol + "//" + N.host : "null", N.href = N.toString(), N;
1572
- }, toString: function(p) {
1573
- p && typeof p == "function" || (p = a.stringify);
1574
- var y, A = this, N = A.host, b = A.protocol;
1575
- b && b.charAt(b.length - 1) !== ":" && (b += ":");
1576
- var E = b + (A.protocol && A.slashes || m(A.protocol) ? "//" : "");
1577
- return A.username ? (E += A.username, A.password && (E += ":" + A.password), E += "@") : A.password ? (E += ":" + A.password, E += "@") : A.protocol !== "file:" && m(A.protocol) && !N && A.pathname !== "/" && (E += "@"), (N[N.length - 1] === ":" || h.test(A.hostname) && !A.port) && (N += ":"), E += N + A.pathname, (y = typeof A.query == "object" ? p(A.query) : A.query) && (E += y.charAt(0) !== "?" ? "?" + y : y), A.hash && (E += A.hash), E;
1578
- } }, v.extractProtocol = w, v.location = d, v.trimLeft = f, v.qs = a, r.exports = v;
1579
- }, 410: () => {
1580
- }, 388: () => {
1581
- }, 805: () => {
1582
- }, 345: () => {
1583
- }, 800: () => {
1584
- } }, mt = {};
1585
- function R(r) {
1586
- var e = mt[r];
1587
- if (e !== void 0) return e.exports;
1588
- var t = mt[r] = { id: r, loaded: !1, exports: {} };
1589
- return Br[r].call(t.exports, t, t.exports, R), t.loaded = !0, t.exports;
1590
- }
1591
- R.n = (r) => {
1592
- var e = r && r.__esModule ? () => r.default : () => r;
1593
- return R.d(e, { a: e }), e;
1594
- }, R.d = (r, e) => {
1595
- for (var t in e) R.o(e, t) && !R.o(r, t) && Object.defineProperty(r, t, { enumerable: !0, get: e[t] });
1596
- }, R.o = (r, e) => Object.prototype.hasOwnProperty.call(r, e), R.nmd = (r) => (r.paths = [], r.children || (r.children = []), r);
1597
- var ee = {};
1598
- R.d(ee, { hT: () => J, O4: () => ne, Kd: () => Yr, YK: () => Kr, UU: () => ss, Gu: () => rr, ky: () => hr, h4: () => ye, ch: () => Se, hq: () => ae, i5: () => fr });
1599
- var qr = R(737), Wr = R.n(qr);
1600
- function Fe(r) {
1601
- if (!Qe(r)) throw new Error("Parameter was not an error");
1602
- }
1603
- function Qe(r) {
1604
- return !!r && typeof r == "object" && (e = r, Object.prototype.toString.call(e) === "[object Error]") || r instanceof Error;
1605
- var e;
1606
- }
1607
- class K extends Error {
1608
- constructor(e, t) {
1609
- const n = [...arguments], { options: a, shortMessage: u } = (function(i) {
1610
- let h, o = "";
1611
- if (i.length === 0) h = {};
1612
- else if (Qe(i[0])) h = { cause: i[0] }, o = i.slice(1).join(" ") || "";
1613
- else if (i[0] && typeof i[0] == "object") h = Object.assign({}, i[0]), o = i.slice(1).join(" ") || "";
1614
- else {
1615
- if (typeof i[0] != "string") throw new Error("Invalid arguments passed to Layerr");
1616
- h = {}, o = o = i.join(" ") || "";
1617
- }
1618
- return { options: h, shortMessage: o };
1619
- })(n);
1620
- let c = u;
1621
- if (a.cause && (c = `${c}: ${a.cause.message}`), super(c), this.message = c, a.name && typeof a.name == "string" ? this.name = a.name : this.name = "Layerr", a.cause && Object.defineProperty(this, "_cause", { value: a.cause }), Object.defineProperty(this, "_info", { value: {} }), a.info && typeof a.info == "object" && Object.assign(this._info, a.info), Error.captureStackTrace) {
1622
- const i = a.constructorOpt || this.constructor;
1623
- Error.captureStackTrace(this, i);
1624
- }
1625
- }
1626
- static cause(e) {
1627
- return Fe(e), e._cause && Qe(e._cause) ? e._cause : null;
1628
- }
1629
- static fullStack(e) {
1630
- Fe(e);
1631
- const t = K.cause(e);
1632
- return t ? `${e.stack}
1633
- caused by: ${K.fullStack(t)}` : e.stack ?? "";
1634
- }
1635
- static info(e) {
1636
- Fe(e);
1637
- const t = {}, n = K.cause(e);
1638
- return n && Object.assign(t, K.info(n)), e._info && Object.assign(t, e._info), t;
1639
- }
1640
- toString() {
1641
- let e = this.name || this.constructor.name || this.constructor.prototype.name;
1642
- return this.message && (e = `${e}: ${this.message}`), e;
1643
- }
1644
- }
1645
- var Xr = R(47), Pe = R.n(Xr);
1646
- const bt = "__PATH_SEPARATOR_POSIX__", yt = "__PATH_SEPARATOR_WINDOWS__";
1647
- function k(r) {
1648
- try {
1649
- const e = r.replace(/\//g, bt).replace(/\\\\/g, yt);
1650
- return encodeURIComponent(e).split(yt).join("\\\\").split(bt).join("/");
1651
- } catch (e) {
1652
- throw new K(e, "Failed encoding path");
1653
- }
1654
- }
1655
- function vt(r) {
1656
- return r.startsWith("/") ? r : "/" + r;
1657
- }
1658
- function be(r) {
1659
- let e = r;
1660
- return e[0] !== "/" && (e = "/" + e), /^.+\/$/.test(e) && (e = e.substr(0, e.length - 1)), e;
1661
- }
1662
- function Gr(r) {
1663
- let e = new (Wr())(r).pathname;
1664
- return e.length <= 0 && (e = "/"), be(e);
1665
- }
1666
- function U() {
1667
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1668
- return (function() {
1669
- return (function(n) {
1670
- var a = [];
1671
- if (n.length === 0) return "";
1672
- if (typeof n[0] != "string") throw new TypeError("Url must be a string. Received " + n[0]);
1673
- if (n[0].match(/^[^/:]+:\/*$/) && n.length > 1) {
1674
- var u = n.shift();
1675
- n[0] = u + n[0];
1676
- }
1677
- n[0].match(/^file:\/\/\//) ? n[0] = n[0].replace(/^([^/:]+):\/*/, "$1:///") : n[0] = n[0].replace(/^([^/:]+):\/*/, "$1://");
1678
- for (var c = 0; c < n.length; c++) {
1679
- var i = n[c];
1680
- if (typeof i != "string") throw new TypeError("Url must be a string. Received " + i);
1681
- i !== "" && (c > 0 && (i = i.replace(/^[\/]+/, "")), i = c < n.length - 1 ? i.replace(/[\/]+$/, "") : i.replace(/[\/]+$/, "/"), a.push(i));
1682
- }
1683
- var h = a.join("/"), o = (h = h.replace(/\/(\?|&|#[^!])/g, "$1")).split("?");
1684
- return o.shift() + (o.length > 0 ? "?" : "") + o.join("&");
1685
- })(typeof arguments[0] == "object" ? arguments[0] : [].slice.call(arguments));
1686
- })(e.reduce(((n, a, u) => ((u === 0 || a !== "/" || a === "/" && n[n.length - 1] !== "/") && n.push(a), n)), []));
1687
- }
1688
- var zr = R(542), fe = R.n(zr);
1689
- const Hr = "abcdef0123456789";
1690
- function wt(r, e) {
1691
- const t = r.url.replace("//", ""), n = t.indexOf("/") == -1 ? "/" : t.slice(t.indexOf("/")), a = r.method ? r.method.toUpperCase() : "GET", u = !!/(^|,)\s*auth\s*($|,)/.test(e.qop) && "auth", c = `00000000${e.nc}`.slice(-8), i = (function(l, g, d, m, w, v, p) {
1692
- const y = p || fe()(`${g}:${d}:${m}`);
1693
- return l && l.toLowerCase() === "md5-sess" ? fe()(`${y}:${w}:${v}`) : y;
1694
- })(e.algorithm, e.username, e.realm, e.password, e.nonce, e.cnonce, e.ha1), h = fe()(`${a}:${n}`), o = u ? fe()(`${i}:${e.nonce}:${c}:${e.cnonce}:${u}:${h}`) : fe()(`${i}:${e.nonce}:${h}`), s = { username: e.username, realm: e.realm, nonce: e.nonce, uri: n, qop: u, response: o, nc: c, cnonce: e.cnonce, algorithm: e.algorithm, opaque: e.opaque }, f = [];
1695
- for (const l in s) s[l] && (l === "qop" || l === "nc" || l === "algorithm" ? f.push(`${l}=${s[l]}`) : f.push(`${l}="${s[l]}"`));
1696
- return `Digest ${f.join(", ")}`;
1697
- }
1698
- function Dt(r) {
1699
- return (r.headers && r.headers.get("www-authenticate") || "").split(/\s/)[0].toLowerCase() === "digest";
1700
- }
1701
- var Zr = R(101), er = R.n(Zr);
1702
- function Nt(r) {
1703
- return er().decode(r);
1704
- }
1705
- function xt(r, e) {
1706
- var t;
1707
- return `Basic ${t = `${r}:${e}`, er().encode(t)}`;
1708
- }
1709
- const Ee = typeof WorkerGlobalScope < "u" && self instanceof WorkerGlobalScope ? self : typeof window < "u" ? window : globalThis, Jr = Ee.fetch.bind(Ee), Yr = Ee.Request, Kr = Ee.Response;
1710
- let J = (function(r) {
1711
- return r.Auto = "auto", r.Digest = "digest", r.None = "none", r.Password = "password", r.Token = "token", r;
1712
- })({}), ne = (function(r) {
1713
- return r.DataTypeNoLength = "data-type-no-length", r.InvalidAuthType = "invalid-auth-type", r.InvalidOutputFormat = "invalid-output-format", r.LinkUnsupportedAuthType = "link-unsupported-auth", r.InvalidUpdateRange = "invalid-update-range", r.NotSupported = "not-supported", r;
1714
- })({});
1715
- function tr(r, e, t, n, a) {
1716
- switch (r.authType) {
1717
- case J.Auto:
1718
- e && t && (r.headers.Authorization = xt(e, t));
1719
- break;
1720
- case J.Digest:
1721
- r.digest = /* @__PURE__ */ (function(c, i, h) {
1722
- return { username: c, password: i, ha1: h, nc: 0, algorithm: "md5", hasDigestAuth: !1 };
1723
- })(e, t, a);
1724
- break;
1725
- case J.None:
1726
- break;
1727
- case J.Password:
1728
- r.headers.Authorization = xt(e, t);
1729
- break;
1730
- case J.Token:
1731
- r.headers.Authorization = `${(u = n).token_type} ${u.access_token}`;
1732
- break;
1733
- default:
1734
- throw new K({ info: { code: ne.InvalidAuthType } }, `Invalid auth type: ${r.authType}`);
1735
- }
1736
- var u;
1737
- }
1738
- R(345), R(800);
1739
- const Pt = "@@HOTPATCHER", Qr = () => {
1740
- };
1741
- function je(r) {
1742
- return { original: r, methods: [r], final: !1 };
1743
- }
1744
- class Dr {
1745
- constructor() {
1746
- this._configuration = { registry: {}, getEmptyAction: "null" }, this.__type__ = Pt;
1747
- }
1748
- get configuration() {
1749
- return this._configuration;
1750
- }
1751
- get getEmptyAction() {
1752
- return this.configuration.getEmptyAction;
1753
- }
1754
- set getEmptyAction(e) {
1755
- this.configuration.getEmptyAction = e;
1756
- }
1757
- control(e) {
1758
- let t = arguments.length > 1 && arguments[1] !== void 0 && arguments[1];
1759
- if (!e || e.__type__ !== Pt) throw new Error("Failed taking control of target HotPatcher instance: Invalid type or object");
1760
- return Object.keys(e.configuration.registry).forEach(((n) => {
1761
- this.configuration.registry.hasOwnProperty(n) ? t && (this.configuration.registry[n] = Object.assign({}, e.configuration.registry[n])) : this.configuration.registry[n] = Object.assign({}, e.configuration.registry[n]);
1762
- })), e._configuration = this.configuration, this;
1763
- }
1764
- execute(e) {
1765
- const t = this.get(e) || Qr;
1766
- for (var n = arguments.length, a = new Array(n > 1 ? n - 1 : 0), u = 1; u < n; u++) a[u - 1] = arguments[u];
1767
- return t(...a);
1768
- }
1769
- get(e) {
1770
- const t = this.configuration.registry[e];
1771
- if (!t) switch (this.getEmptyAction) {
1772
- case "null":
1773
- return null;
1774
- case "throw":
1775
- throw new Error(`Failed handling method request: No method provided for override: ${e}`);
1776
- default:
1777
- throw new Error(`Failed handling request which resulted in an empty method: Invalid empty-action specified: ${this.getEmptyAction}`);
1778
- }
1779
- return (function() {
1780
- for (var n = arguments.length, a = new Array(n), u = 0; u < n; u++) a[u] = arguments[u];
1781
- if (a.length === 0) throw new Error("Failed creating sequence: No functions provided");
1782
- return function() {
1783
- for (var c = arguments.length, i = new Array(c), h = 0; h < c; h++) i[h] = arguments[h];
1784
- let o = i;
1785
- const s = this;
1786
- for (; a.length > 0; ) o = [a.shift().apply(s, o)];
1787
- return o[0];
1788
- };
1789
- })(...t.methods);
1790
- }
1791
- isPatched(e) {
1792
- return !!this.configuration.registry[e];
1793
- }
1794
- patch(e, t) {
1795
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
1796
- const { chain: a = !1 } = n;
1797
- if (this.configuration.registry[e] && this.configuration.registry[e].final) throw new Error(`Failed patching '${e}': Method marked as being final`);
1798
- if (typeof t != "function") throw new Error(`Failed patching '${e}': Provided method is not a function`);
1799
- if (a) this.configuration.registry[e] ? this.configuration.registry[e].methods.push(t) : this.configuration.registry[e] = je(t);
1800
- else if (this.isPatched(e)) {
1801
- const { original: u } = this.configuration.registry[e];
1802
- this.configuration.registry[e] = Object.assign(je(t), { original: u });
1803
- } else this.configuration.registry[e] = je(t);
1804
- return this;
1805
- }
1806
- patchInline(e, t) {
1807
- this.isPatched(e) || this.patch(e, t);
1808
- for (var n = arguments.length, a = new Array(n > 2 ? n - 2 : 0), u = 2; u < n; u++) a[u - 2] = arguments[u];
1809
- return this.execute(e, ...a);
1810
- }
1811
- plugin(e) {
1812
- for (var t = arguments.length, n = new Array(t > 1 ? t - 1 : 0), a = 1; a < t; a++) n[a - 1] = arguments[a];
1813
- return n.forEach(((u) => {
1814
- this.patch(e, u, { chain: !0 });
1815
- })), this;
1816
- }
1817
- restore(e) {
1818
- if (!this.isPatched(e)) throw new Error(`Failed restoring method: No method present for key: ${e}`);
1819
- if (typeof this.configuration.registry[e].original != "function") throw new Error(`Failed restoring method: Original method not found or of invalid type for key: ${e}`);
1820
- return this.configuration.registry[e].methods = [this.configuration.registry[e].original], this;
1821
- }
1822
- setFinal(e) {
1823
- if (!this.configuration.registry.hasOwnProperty(e)) throw new Error(`Failed marking '${e}' as final: No method found for key`);
1824
- return this.configuration.registry[e].final = !0, this;
1825
- }
1826
- }
1827
- let $e = null;
1828
- function rr() {
1829
- return $e || ($e = new Dr()), $e;
1830
- }
1831
- function Ae(r) {
1832
- return (function(e) {
1833
- if (typeof e != "object" || e === null || Object.prototype.toString.call(e) != "[object Object]") return !1;
1834
- if (Object.getPrototypeOf(e) === null) return !0;
1835
- let t = e;
1836
- for (; Object.getPrototypeOf(t) !== null; ) t = Object.getPrototypeOf(t);
1837
- return Object.getPrototypeOf(e) === t;
1838
- })(r) ? Object.assign({}, r) : Object.setPrototypeOf(Object.assign({}, r), Object.getPrototypeOf(r));
1839
- }
1840
- function Et() {
1841
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1842
- let n = null, a = [...e];
1843
- for (; a.length > 0; ) {
1844
- const u = a.shift();
1845
- n = n ? nr(n, u) : Ae(u);
1846
- }
1847
- return n;
1848
- }
1849
- function nr(r, e) {
1850
- const t = Ae(r);
1851
- return Object.keys(e).forEach(((n) => {
1852
- t.hasOwnProperty(n) ? Array.isArray(e[n]) ? t[n] = Array.isArray(t[n]) ? [...t[n], ...e[n]] : [...e[n]] : typeof e[n] == "object" && e[n] ? t[n] = typeof t[n] == "object" && t[n] ? nr(t[n], e[n]) : Ae(e[n]) : t[n] = e[n] : t[n] = e[n];
1853
- })), t;
1854
- }
1855
- function en(r) {
1856
- const e = {};
1857
- for (const t of r.keys()) e[t] = r.get(t);
1858
- return e;
1859
- }
1860
- function De() {
1861
- for (var r = arguments.length, e = new Array(r), t = 0; t < r; t++) e[t] = arguments[t];
1862
- if (e.length === 0) return {};
1863
- const n = {};
1864
- return e.reduce(((a, u) => (Object.keys(u).forEach(((c) => {
1865
- const i = c.toLowerCase();
1866
- n.hasOwnProperty(i) ? a[n[i]] = u[c] : (n[i] = c, a[c] = u[c]);
1867
- })), a)), {});
1868
- }
1869
- R(805);
1870
- const tn = typeof ArrayBuffer == "function", { toString: rn } = Object.prototype;
1871
- function sr(r) {
1872
- return tn && (r instanceof ArrayBuffer || rn.call(r) === "[object ArrayBuffer]");
1873
- }
1874
- function ir(r) {
1875
- return r != null && r.constructor != null && typeof r.constructor.isBuffer == "function" && r.constructor.isBuffer(r);
1876
- }
1877
- function it(r) {
1878
- return function() {
1879
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
1880
- try {
1881
- return Promise.resolve(r.apply(this, e));
1882
- } catch (n) {
1883
- return Promise.reject(n);
1884
- }
1885
- };
1886
- }
1887
- function et(r, e, t) {
1888
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
1889
- }
1890
- const or = it((function(r) {
1891
- const e = r._digest;
1892
- return delete r._digest, e.hasDigestAuth && (r = Et(r, { headers: { Authorization: wt(r, e) } })), et(Te(r), (function(t) {
1893
- let n = !1;
1894
- return a = function(c) {
1895
- return n ? c : t;
1896
- }, (u = (function() {
1897
- if (t.status == 401) return e.hasDigestAuth = (function(c, i) {
1898
- if (!Dt(c)) return !1;
1899
- const h = /([a-z0-9_-]+)=(?:"([^"]+)"|([a-z0-9_-]+))/gi;
1900
- for (; ; ) {
1901
- const o = c.headers && c.headers.get("www-authenticate") || "", s = h.exec(o);
1902
- if (!s) break;
1903
- i[s[1]] = s[2] || s[3];
1904
- }
1905
- return i.nc += 1, i.cnonce = (function() {
1906
- let o = "";
1907
- for (let s = 0; s < 32; ++s) o = `${o}${Hr[Math.floor(16 * Math.random())]}`;
1908
- return o;
1909
- })(), !0;
1910
- })(t, e), (function() {
1911
- if (e.hasDigestAuth) return et(Te(r = Et(r, { headers: { Authorization: wt(r, e) } })), (function(c) {
1912
- return c.status == 401 ? e.hasDigestAuth = !1 : e.nc++, n = !0, c;
1913
- }));
1914
- })();
1915
- e.nc++;
1916
- })()) && u.then ? u.then(a) : a(u);
1917
- var a, u;
1918
- }));
1919
- })), nn = it((function(r, e) {
1920
- return et(Te(r), (function(t) {
1921
- return t.ok ? (e.authType = J.Password, t) : t.status == 401 && Dt(t) ? (e.authType = J.Digest, tr(e, e.username, e.password, void 0, void 0), r._digest = e.digest, or(r)) : t;
1922
- }));
1923
- })), B = it((function(r, e) {
1924
- return e.authType === J.Auto ? nn(r, e) : r._digest ? or(r) : Te(r);
1925
- }));
1926
- function q(r, e, t) {
1927
- const n = Ae(r);
1928
- return n.headers = De(e.headers, n.headers || {}, t.headers || {}), t.data !== void 0 && (n.data = t.data), t.signal && (n.signal = t.signal), e.httpAgent && (n.httpAgent = e.httpAgent), e.httpsAgent && (n.httpsAgent = e.httpsAgent), e.digest && (n._digest = e.digest), typeof e.withCredentials == "boolean" && (n.withCredentials = e.withCredentials), n;
1929
- }
1930
- function Te(r) {
1931
- const e = rr();
1932
- return e.patchInline("request", ((t) => e.patchInline("fetch", Jr, t.url, (function(n) {
1933
- let a = {};
1934
- const u = { method: n.method };
1935
- if (n.headers && (a = De(a, n.headers)), n.data !== void 0) {
1936
- const [c, i] = (function(h) {
1937
- if (typeof h == "string") return [h, {}];
1938
- if (ir(h)) return [h, {}];
1939
- if (sr(h)) return [h, {}];
1940
- if (h && typeof h == "object") return [JSON.stringify(h), { "content-type": "application/json" }];
1941
- throw new Error("Unable to convert request body: Unexpected body type: " + typeof h);
1942
- })(n.data);
1943
- u.body = c, a = De(a, i);
1944
- }
1945
- return n.signal && (u.signal = n.signal), n.withCredentials && (u.credentials = "include"), u.headers = a, u;
1946
- })(t))), r);
1947
- }
1948
- var sn = R(285);
1949
- const Oe = (r) => {
1950
- if (typeof r != "string") throw new TypeError("invalid pattern");
1951
- if (r.length > 65536) throw new TypeError("pattern is too long");
1952
- }, on = { "[:alnum:]": ["\\p{L}\\p{Nl}\\p{Nd}", !0], "[:alpha:]": ["\\p{L}\\p{Nl}", !0], "[:ascii:]": ["\\x00-\\x7f", !1], "[:blank:]": ["\\p{Zs}\\t", !0], "[:cntrl:]": ["\\p{Cc}", !0], "[:digit:]": ["\\p{Nd}", !0], "[:graph:]": ["\\p{Z}\\p{C}", !0, !0], "[:lower:]": ["\\p{Ll}", !0], "[:print:]": ["\\p{C}", !0], "[:punct:]": ["\\p{P}", !0], "[:space:]": ["\\p{Z}\\t\\r\\n\\v\\f", !0], "[:upper:]": ["\\p{Lu}", !0], "[:word:]": ["\\p{L}\\p{Nl}\\p{Nd}\\p{Pc}", !0], "[:xdigit:]": ["A-Fa-f0-9", !1] }, pe = (r) => r.replace(/[[\]\\-]/g, "\\$&"), At = (r) => r.join(""), an = (r, e) => {
1953
- const t = e;
1954
- if (r.charAt(t) !== "[") throw new Error("not in a brace expression");
1955
- const n = [], a = [];
1956
- let u = t + 1, c = !1, i = !1, h = !1, o = !1, s = t, f = "";
1957
- e: for (; u < r.length; ) {
1958
- const m = r.charAt(u);
1959
- if (m !== "!" && m !== "^" || u !== t + 1) {
1960
- if (m === "]" && c && !h) {
1961
- s = u + 1;
1962
- break;
1963
- }
1964
- if (c = !0, m !== "\\" || h) {
1965
- if (m === "[" && !h) {
1966
- for (const [w, [v, p, y]] of Object.entries(on)) if (r.startsWith(w, u)) {
1967
- if (f) return ["$.", !1, r.length - t, !0];
1968
- u += w.length, y ? a.push(v) : n.push(v), i = i || p;
1969
- continue e;
1970
- }
1971
- }
1972
- h = !1, f ? (m > f ? n.push(pe(f) + "-" + pe(m)) : m === f && n.push(pe(m)), f = "", u++) : r.startsWith("-]", u + 1) ? (n.push(pe(m + "-")), u += 2) : r.startsWith("-", u + 1) ? (f = m, u += 2) : (n.push(pe(m)), u++);
1973
- } else h = !0, u++;
1974
- } else o = !0, u++;
1975
- }
1976
- if (s < u) return ["", !1, 0, !1];
1977
- if (!n.length && !a.length) return ["$.", !1, r.length - t, !0];
1978
- if (a.length === 0 && n.length === 1 && /^\\?.$/.test(n[0]) && !o)
1979
- return [(l = n[0].length === 2 ? n[0].slice(-1) : n[0], l.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&")), !1, s - t, !1];
1980
- var l;
1981
- const g = "[" + (o ? "^" : "") + At(n) + "]", d = "[" + (o ? "" : "^") + At(a) + "]";
1982
- return [n.length && a.length ? "(" + g + "|" + d + ")" : n.length ? g : d, i, s - t, !0];
1983
- }, ge = function(r) {
1984
- let { windowsPathsNoEscape: e = !1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
1985
- return e ? r.replace(/\[([^\/\\])\]/g, "$1") : r.replace(/((?!\\).|^)\[([^\/\\])\]/g, "$1$2").replace(/\\([^\/])/g, "$1");
1986
- }, un = /* @__PURE__ */ new Set(["!", "?", "+", "*", "@"]), Tt = (r) => un.has(r), Re = "(?!\\.)", ln = /* @__PURE__ */ new Set(["[", "."]), cn = /* @__PURE__ */ new Set(["..", "."]), hn = new Set("().*{}+?[]^$\\!"), ot = "[^/]", Ot = ot + "*?", Ct = ot + "+?";
1987
- class Z {
1988
- type;
1989
- #r;
1990
- #n;
1991
- #i = !1;
1992
- #e = [];
1993
- #t;
1994
- #o;
1995
- #u;
1996
- #a = !1;
1997
- #s;
1998
- #l;
1999
- #h = !1;
2000
- constructor(e, t) {
2001
- let n = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2002
- this.type = e, e && (this.#n = !0), this.#t = t, this.#r = this.#t ? this.#t.#r : this, this.#s = this.#r === this ? n : this.#r.#s, this.#u = this.#r === this ? [] : this.#r.#u, e !== "!" || this.#r.#a || this.#u.push(this), this.#o = this.#t ? this.#t.#e.length : 0;
2003
- }
2004
- get hasMagic() {
2005
- if (this.#n !== void 0) return this.#n;
2006
- for (const e of this.#e) if (typeof e != "string" && (e.type || e.hasMagic)) return this.#n = !0;
2007
- return this.#n;
2008
- }
2009
- toString() {
2010
- return this.#l !== void 0 ? this.#l : this.type ? this.#l = this.type + "(" + this.#e.map(((e) => String(e))).join("|") + ")" : this.#l = this.#e.map(((e) => String(e))).join("");
2011
- }
2012
- #p() {
2013
- if (this !== this.#r) throw new Error("should only call on root");
2014
- if (this.#a) return this;
2015
- let e;
2016
- for (this.toString(), this.#a = !0; e = this.#u.pop(); ) {
2017
- if (e.type !== "!") continue;
2018
- let t = e, n = t.#t;
2019
- for (; n; ) {
2020
- for (let a = t.#o + 1; !n.type && a < n.#e.length; a++) for (const u of e.#e) {
2021
- if (typeof u == "string") throw new Error("string part in extglob AST??");
2022
- u.copyIn(n.#e[a]);
2023
- }
2024
- t = n, n = t.#t;
2025
- }
2026
- }
2027
- return this;
2028
- }
2029
- push() {
2030
- for (var e = arguments.length, t = new Array(e), n = 0; n < e; n++) t[n] = arguments[n];
2031
- for (const a of t) if (a !== "") {
2032
- if (typeof a != "string" && !(a instanceof Z && a.#t === this)) throw new Error("invalid part: " + a);
2033
- this.#e.push(a);
2034
- }
2035
- }
2036
- toJSON() {
2037
- const e = this.type === null ? this.#e.slice().map(((t) => typeof t == "string" ? t : t.toJSON())) : [this.type, ...this.#e.map(((t) => t.toJSON()))];
2038
- return this.isStart() && !this.type && e.unshift([]), this.isEnd() && (this === this.#r || this.#r.#a && this.#t?.type === "!") && e.push({}), e;
2039
- }
2040
- isStart() {
2041
- if (this.#r === this) return !0;
2042
- if (!this.#t?.isStart()) return !1;
2043
- if (this.#o === 0) return !0;
2044
- const e = this.#t;
2045
- for (let t = 0; t < this.#o; t++) {
2046
- const n = e.#e[t];
2047
- if (!(n instanceof Z && n.type === "!")) return !1;
2048
- }
2049
- return !0;
2050
- }
2051
- isEnd() {
2052
- if (this.#r === this || this.#t?.type === "!") return !0;
2053
- if (!this.#t?.isEnd()) return !1;
2054
- if (!this.type) return this.#t?.isEnd();
2055
- const e = this.#t ? this.#t.#e.length : 0;
2056
- return this.#o === e - 1;
2057
- }
2058
- copyIn(e) {
2059
- typeof e == "string" ? this.push(e) : this.push(e.clone(this));
2060
- }
2061
- clone(e) {
2062
- const t = new Z(this.type, e);
2063
- for (const n of this.#e) t.copyIn(n);
2064
- return t;
2065
- }
2066
- static #c(e, t, n, a) {
2067
- let u = !1, c = !1, i = -1, h = !1;
2068
- if (t.type === null) {
2069
- let g = n, d = "";
2070
- for (; g < e.length; ) {
2071
- const m = e.charAt(g++);
2072
- if (u || m === "\\") u = !u, d += m;
2073
- else if (c) g === i + 1 ? m !== "^" && m !== "!" || (h = !0) : m !== "]" || g === i + 2 && h || (c = !1), d += m;
2074
- else if (m !== "[") if (a.noext || !Tt(m) || e.charAt(g) !== "(") d += m;
2075
- else {
2076
- t.push(d), d = "";
2077
- const w = new Z(m, t);
2078
- g = Z.#c(e, w, g, a), t.push(w);
2079
- }
2080
- else c = !0, i = g, h = !1, d += m;
2081
- }
2082
- return t.push(d), g;
2083
- }
2084
- let o = n + 1, s = new Z(null, t);
2085
- const f = [];
2086
- let l = "";
2087
- for (; o < e.length; ) {
2088
- const g = e.charAt(o++);
2089
- if (u || g === "\\") u = !u, l += g;
2090
- else if (c) o === i + 1 ? g !== "^" && g !== "!" || (h = !0) : g !== "]" || o === i + 2 && h || (c = !1), l += g;
2091
- else if (g !== "[") if (Tt(g) && e.charAt(o) === "(") {
2092
- s.push(l), l = "";
2093
- const d = new Z(g, s);
2094
- s.push(d), o = Z.#c(e, d, o, a);
2095
- } else if (g !== "|") {
2096
- if (g === ")") return l === "" && t.#e.length === 0 && (t.#h = !0), s.push(l), l = "", t.push(...f, s), o;
2097
- l += g;
2098
- } else s.push(l), l = "", f.push(s), s = new Z(null, t);
2099
- else c = !0, i = o, h = !1, l += g;
2100
- }
2101
- return t.type = null, t.#n = void 0, t.#e = [e.substring(n - 1)], o;
2102
- }
2103
- static fromGlob(e) {
2104
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2105
- const n = new Z(null, void 0, t);
2106
- return Z.#c(e, n, 0, t), n;
2107
- }
2108
- toMMPattern() {
2109
- if (this !== this.#r) return this.#r.toMMPattern();
2110
- const e = this.toString(), [t, n, a, u] = this.toRegExpSource();
2111
- if (!(a || this.#n || this.#s.nocase && !this.#s.nocaseMagicOnly && e.toUpperCase() !== e.toLowerCase())) return n;
2112
- const c = (this.#s.nocase ? "i" : "") + (u ? "u" : "");
2113
- return Object.assign(new RegExp(`^${t}$`, c), { _src: t, _glob: e });
2114
- }
2115
- get options() {
2116
- return this.#s;
2117
- }
2118
- toRegExpSource(e) {
2119
- const t = e ?? !!this.#s.dot;
2120
- if (this.#r === this && this.#p(), !this.type) {
2121
- const h = this.isStart() && this.isEnd(), o = this.#e.map(((l) => {
2122
- const [g, d, m, w] = typeof l == "string" ? Z.#g(l, this.#n, h) : l.toRegExpSource(e);
2123
- return this.#n = this.#n || m, this.#i = this.#i || w, g;
2124
- })).join("");
2125
- let s = "";
2126
- if (this.isStart() && typeof this.#e[0] == "string" && (this.#e.length !== 1 || !cn.has(this.#e[0]))) {
2127
- const l = ln, g = t && l.has(o.charAt(0)) || o.startsWith("\\.") && l.has(o.charAt(2)) || o.startsWith("\\.\\.") && l.has(o.charAt(4)), d = !t && !e && l.has(o.charAt(0));
2128
- s = g ? "(?!(?:^|/)\\.\\.?(?:$|/))" : d ? Re : "";
2129
- }
2130
- let f = "";
2131
- return this.isEnd() && this.#r.#a && this.#t?.type === "!" && (f = "(?:$|\\/)"), [s + o + f, ge(o), this.#n = !!this.#n, this.#i];
2132
- }
2133
- const n = this.type === "*" || this.type === "+", a = this.type === "!" ? "(?:(?!(?:" : "(?:";
2134
- let u = this.#f(t);
2135
- if (this.isStart() && this.isEnd() && !u && this.type !== "!") {
2136
- const h = this.toString();
2137
- return this.#e = [h], this.type = null, this.#n = void 0, [h, ge(this.toString()), !1, !1];
2138
- }
2139
- let c = !n || e || t ? "" : this.#f(!0);
2140
- c === u && (c = ""), c && (u = `(?:${u})(?:${c})*?`);
2141
- let i = "";
2142
- return i = this.type === "!" && this.#h ? (this.isStart() && !t ? Re : "") + Ct : a + u + (this.type === "!" ? "))" + (!this.isStart() || t || e ? "" : Re) + Ot + ")" : this.type === "@" ? ")" : this.type === "?" ? ")?" : this.type === "+" && c ? ")" : this.type === "*" && c ? ")?" : `)${this.type}`), [i, ge(u), this.#n = !!this.#n, this.#i];
2143
- }
2144
- #f(e) {
2145
- return this.#e.map(((t) => {
2146
- if (typeof t == "string") throw new Error("string type in extglob ast??");
2147
- const [n, a, u, c] = t.toRegExpSource(e);
2148
- return this.#i = this.#i || c, n;
2149
- })).filter(((t) => !(this.isStart() && this.isEnd() && !t))).join("|");
2150
- }
2151
- static #g(e, t) {
2152
- let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], a = !1, u = "", c = !1;
2153
- for (let i = 0; i < e.length; i++) {
2154
- const h = e.charAt(i);
2155
- if (a) a = !1, u += (hn.has(h) ? "\\" : "") + h;
2156
- else if (h !== "\\") {
2157
- if (h === "[") {
2158
- const [o, s, f, l] = an(e, i);
2159
- if (f) {
2160
- u += o, c = c || s, i += f - 1, t = t || l;
2161
- continue;
2162
- }
2163
- }
2164
- h !== "*" ? h !== "?" ? u += h.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") : (u += ot, t = !0) : (u += n && e === "*" ? Ct : Ot, t = !0);
2165
- } else i === e.length - 1 ? u += "\\\\" : a = !0;
2166
- }
2167
- return [u, ge(e), !!t, c];
2168
- }
2169
- }
2170
- const H = function(r, e) {
2171
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2172
- return Oe(e), !(!t.nocomment && e.charAt(0) === "#") && new Ce(e, t).match(r);
2173
- }, fn = /^\*+([^+@!?\*\[\(]*)$/, pn = (r) => (e) => !e.startsWith(".") && e.endsWith(r), gn = (r) => (e) => e.endsWith(r), dn = (r) => (r = r.toLowerCase(), (e) => !e.startsWith(".") && e.toLowerCase().endsWith(r)), mn = (r) => (r = r.toLowerCase(), (e) => e.toLowerCase().endsWith(r)), bn = /^\*+\.\*+$/, yn = (r) => !r.startsWith(".") && r.includes("."), vn = (r) => r !== "." && r !== ".." && r.includes("."), wn = /^\.\*+$/, Nn = (r) => r !== "." && r !== ".." && r.startsWith("."), xn = /^\*+$/, Pn = (r) => r.length !== 0 && !r.startsWith("."), En = (r) => r.length !== 0 && r !== "." && r !== "..", An = /^\?+([^+@!?\*\[\(]*)?$/, Tn = (r) => {
2174
- let [e, t = ""] = r;
2175
- const n = ar([e]);
2176
- return t ? (t = t.toLowerCase(), (a) => n(a) && a.toLowerCase().endsWith(t)) : n;
2177
- }, On = (r) => {
2178
- let [e, t = ""] = r;
2179
- const n = ur([e]);
2180
- return t ? (t = t.toLowerCase(), (a) => n(a) && a.toLowerCase().endsWith(t)) : n;
2181
- }, Cn = (r) => {
2182
- let [e, t = ""] = r;
2183
- const n = ur([e]);
2184
- return t ? (a) => n(a) && a.endsWith(t) : n;
2185
- }, In = (r) => {
2186
- let [e, t = ""] = r;
2187
- const n = ar([e]);
2188
- return t ? (a) => n(a) && a.endsWith(t) : n;
2189
- }, ar = (r) => {
2190
- let [e] = r;
2191
- const t = e.length;
2192
- return (n) => n.length === t && !n.startsWith(".");
2193
- }, ur = (r) => {
2194
- let [e] = r;
2195
- const t = e.length;
2196
- return (n) => n.length === t && n !== "." && n !== "..";
2197
- }, lr = typeof oe == "object" && oe ? typeof oe.env == "object" && oe.env && oe.env.__MINIMATCH_TESTING_PLATFORM__ || oe.platform : "posix";
2198
- H.sep = lr === "win32" ? "\\" : "/";
2199
- const D = /* @__PURE__ */ Symbol("globstar **");
2200
- H.GLOBSTAR = D, H.filter = function(r) {
2201
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2202
- return (t) => H(t, r, e);
2203
- };
2204
- const Q = function(r) {
2205
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2206
- return Object.assign({}, r, e);
2207
- };
2208
- H.defaults = (r) => {
2209
- if (!r || typeof r != "object" || !Object.keys(r).length) return H;
2210
- const e = H;
2211
- return Object.assign((function(t, n) {
2212
- return e(t, n, Q(r, arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}));
2213
- }), { Minimatch: class extends e.Minimatch {
2214
- constructor(t) {
2215
- super(t, Q(r, arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}));
2216
- }
2217
- static defaults(t) {
2218
- return e.defaults(Q(r, t)).Minimatch;
2219
- }
2220
- }, AST: class extends e.AST {
2221
- constructor(t, n) {
2222
- super(t, n, Q(r, arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}));
2223
- }
2224
- static fromGlob(t) {
2225
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2226
- return e.AST.fromGlob(t, Q(r, n));
2227
- }
2228
- }, unescape: function(t) {
2229
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2230
- return e.unescape(t, Q(r, n));
2231
- }, escape: function(t) {
2232
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2233
- return e.escape(t, Q(r, n));
2234
- }, filter: function(t) {
2235
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2236
- return e.filter(t, Q(r, n));
2237
- }, defaults: (t) => e.defaults(Q(r, t)), makeRe: function(t) {
2238
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2239
- return e.makeRe(t, Q(r, n));
2240
- }, braceExpand: function(t) {
2241
- let n = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2242
- return e.braceExpand(t, Q(r, n));
2243
- }, match: function(t, n) {
2244
- let a = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2245
- return e.match(t, n, Q(r, a));
2246
- }, sep: e.sep, GLOBSTAR: D });
2247
- };
2248
- const cr = function(r) {
2249
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2250
- return Oe(r), e.nobrace || !/\{(?:(?!\{).)*\}/.test(r) ? [r] : sn(r);
2251
- };
2252
- H.braceExpand = cr, H.makeRe = function(r) {
2253
- return new Ce(r, arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {}).makeRe();
2254
- }, H.match = function(r, e) {
2255
- const t = new Ce(e, arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {});
2256
- return r = r.filter(((n) => t.match(n))), t.options.nonull && !r.length && r.push(e), r;
2257
- };
2258
- const It = /[?*]|[+@!]\(.*?\)|\[|\]/;
2259
- class Ce {
2260
- options;
2261
- set;
2262
- pattern;
2263
- windowsPathsNoEscape;
2264
- nonegate;
2265
- negate;
2266
- comment;
2267
- empty;
2268
- preserveMultipleSlashes;
2269
- partial;
2270
- globSet;
2271
- globParts;
2272
- nocase;
2273
- isWindows;
2274
- platform;
2275
- windowsNoMagicRoot;
2276
- regexp;
2277
- constructor(e) {
2278
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2279
- Oe(e), t = t || {}, this.options = t, this.pattern = e, this.platform = t.platform || lr, this.isWindows = this.platform === "win32", this.windowsPathsNoEscape = !!t.windowsPathsNoEscape || t.allowWindowsEscape === !1, this.windowsPathsNoEscape && (this.pattern = this.pattern.replace(/\\/g, "/")), this.preserveMultipleSlashes = !!t.preserveMultipleSlashes, this.regexp = null, this.negate = !1, this.nonegate = !!t.nonegate, this.comment = !1, this.empty = !1, this.partial = !!t.partial, this.nocase = !!this.options.nocase, this.windowsNoMagicRoot = t.windowsNoMagicRoot !== void 0 ? t.windowsNoMagicRoot : !(!this.isWindows || !this.nocase), this.globSet = [], this.globParts = [], this.set = [], this.make();
2280
- }
2281
- hasMagic() {
2282
- if (this.options.magicalBraces && this.set.length > 1) return !0;
2283
- for (const e of this.set) for (const t of e) if (typeof t != "string") return !0;
2284
- return !1;
2285
- }
2286
- debug() {
2287
- }
2288
- make() {
2289
- const e = this.pattern, t = this.options;
2290
- if (!t.nocomment && e.charAt(0) === "#") return void (this.comment = !0);
2291
- if (!e) return void (this.empty = !0);
2292
- this.parseNegate(), this.globSet = [...new Set(this.braceExpand())], t.debug && (this.debug = function() {
2293
- return console.error(...arguments);
2294
- }), this.debug(this.pattern, this.globSet);
2295
- const n = this.globSet.map(((u) => this.slashSplit(u)));
2296
- this.globParts = this.preprocess(n), this.debug(this.pattern, this.globParts);
2297
- let a = this.globParts.map(((u, c, i) => {
2298
- if (this.isWindows && this.windowsNoMagicRoot) {
2299
- const h = !(u[0] !== "" || u[1] !== "" || u[2] !== "?" && It.test(u[2]) || It.test(u[3])), o = /^[a-z]:/i.test(u[0]);
2300
- if (h) return [...u.slice(0, 4), ...u.slice(4).map(((s) => this.parse(s)))];
2301
- if (o) return [u[0], ...u.slice(1).map(((s) => this.parse(s)))];
2302
- }
2303
- return u.map(((h) => this.parse(h)));
2304
- }));
2305
- if (this.debug(this.pattern, a), this.set = a.filter(((u) => u.indexOf(!1) === -1)), this.isWindows) for (let u = 0; u < this.set.length; u++) {
2306
- const c = this.set[u];
2307
- c[0] === "" && c[1] === "" && this.globParts[u][2] === "?" && typeof c[3] == "string" && /^[a-z]:$/i.test(c[3]) && (c[2] = "?");
2308
- }
2309
- this.debug(this.pattern, this.set);
2310
- }
2311
- preprocess(e) {
2312
- if (this.options.noglobstar) for (let n = 0; n < e.length; n++) for (let a = 0; a < e[n].length; a++) e[n][a] === "**" && (e[n][a] = "*");
2313
- const { optimizationLevel: t = 1 } = this.options;
2314
- return t >= 2 ? (e = this.firstPhasePreProcess(e), e = this.secondPhasePreProcess(e)) : e = t >= 1 ? this.levelOneOptimize(e) : this.adjascentGlobstarOptimize(e), e;
2315
- }
2316
- adjascentGlobstarOptimize(e) {
2317
- return e.map(((t) => {
2318
- let n = -1;
2319
- for (; (n = t.indexOf("**", n + 1)) !== -1; ) {
2320
- let a = n;
2321
- for (; t[a + 1] === "**"; ) a++;
2322
- a !== n && t.splice(n, a - n);
2323
- }
2324
- return t;
2325
- }));
2326
- }
2327
- levelOneOptimize(e) {
2328
- return e.map(((t) => (t = t.reduce(((n, a) => {
2329
- const u = n[n.length - 1];
2330
- return a === "**" && u === "**" ? n : a === ".." && u && u !== ".." && u !== "." && u !== "**" ? (n.pop(), n) : (n.push(a), n);
2331
- }), [])).length === 0 ? [""] : t));
2332
- }
2333
- levelTwoFileOptimize(e) {
2334
- Array.isArray(e) || (e = this.slashSplit(e));
2335
- let t = !1;
2336
- do {
2337
- if (t = !1, !this.preserveMultipleSlashes) {
2338
- for (let a = 1; a < e.length - 1; a++) {
2339
- const u = e[a];
2340
- a === 1 && u === "" && e[0] === "" || u !== "." && u !== "" || (t = !0, e.splice(a, 1), a--);
2341
- }
2342
- e[0] !== "." || e.length !== 2 || e[1] !== "." && e[1] !== "" || (t = !0, e.pop());
2343
- }
2344
- let n = 0;
2345
- for (; (n = e.indexOf("..", n + 1)) !== -1; ) {
2346
- const a = e[n - 1];
2347
- a && a !== "." && a !== ".." && a !== "**" && (t = !0, e.splice(n - 1, 2), n -= 2);
2348
- }
2349
- } while (t);
2350
- return e.length === 0 ? [""] : e;
2351
- }
2352
- firstPhasePreProcess(e) {
2353
- let t = !1;
2354
- do {
2355
- t = !1;
2356
- for (let n of e) {
2357
- let a = -1;
2358
- for (; (a = n.indexOf("**", a + 1)) !== -1; ) {
2359
- let c = a;
2360
- for (; n[c + 1] === "**"; ) c++;
2361
- c > a && n.splice(a + 1, c - a);
2362
- let i = n[a + 1];
2363
- const h = n[a + 2], o = n[a + 3];
2364
- if (i !== ".." || !h || h === "." || h === ".." || !o || o === "." || o === "..") continue;
2365
- t = !0, n.splice(a, 1);
2366
- const s = n.slice(0);
2367
- s[a] = "**", e.push(s), a--;
2368
- }
2369
- if (!this.preserveMultipleSlashes) {
2370
- for (let c = 1; c < n.length - 1; c++) {
2371
- const i = n[c];
2372
- c === 1 && i === "" && n[0] === "" || i !== "." && i !== "" || (t = !0, n.splice(c, 1), c--);
2373
- }
2374
- n[0] !== "." || n.length !== 2 || n[1] !== "." && n[1] !== "" || (t = !0, n.pop());
2375
- }
2376
- let u = 0;
2377
- for (; (u = n.indexOf("..", u + 1)) !== -1; ) {
2378
- const c = n[u - 1];
2379
- if (c && c !== "." && c !== ".." && c !== "**") {
2380
- t = !0;
2381
- const i = u === 1 && n[u + 1] === "**" ? ["."] : [];
2382
- n.splice(u - 1, 2, ...i), n.length === 0 && n.push(""), u -= 2;
2383
- }
2384
- }
2385
- }
2386
- } while (t);
2387
- return e;
2388
- }
2389
- secondPhasePreProcess(e) {
2390
- for (let t = 0; t < e.length - 1; t++) for (let n = t + 1; n < e.length; n++) {
2391
- const a = this.partsMatch(e[t], e[n], !this.preserveMultipleSlashes);
2392
- if (a) {
2393
- e[t] = [], e[n] = a;
2394
- break;
2395
- }
2396
- }
2397
- return e.filter(((t) => t.length));
2398
- }
2399
- partsMatch(e, t) {
2400
- let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], a = 0, u = 0, c = [], i = "";
2401
- for (; a < e.length && u < t.length; ) if (e[a] === t[u]) c.push(i === "b" ? t[u] : e[a]), a++, u++;
2402
- else if (n && e[a] === "**" && t[u] === e[a + 1]) c.push(e[a]), a++;
2403
- else if (n && t[u] === "**" && e[a] === t[u + 1]) c.push(t[u]), u++;
2404
- else if (e[a] !== "*" || !t[u] || !this.options.dot && t[u].startsWith(".") || t[u] === "**") {
2405
- if (t[u] !== "*" || !e[a] || !this.options.dot && e[a].startsWith(".") || e[a] === "**" || i === "a") return !1;
2406
- i = "b", c.push(t[u]), a++, u++;
2407
- } else {
2408
- if (i === "b") return !1;
2409
- i = "a", c.push(e[a]), a++, u++;
2410
- }
2411
- return e.length === t.length && c;
2412
- }
2413
- parseNegate() {
2414
- if (this.nonegate) return;
2415
- const e = this.pattern;
2416
- let t = !1, n = 0;
2417
- for (let a = 0; a < e.length && e.charAt(a) === "!"; a++) t = !t, n++;
2418
- n && (this.pattern = e.slice(n)), this.negate = t;
2419
- }
2420
- matchOne(e, t) {
2421
- let n = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
2422
- const a = this.options;
2423
- if (this.isWindows) {
2424
- const m = typeof e[0] == "string" && /^[a-z]:$/i.test(e[0]), w = !m && e[0] === "" && e[1] === "" && e[2] === "?" && /^[a-z]:$/i.test(e[3]), v = typeof t[0] == "string" && /^[a-z]:$/i.test(t[0]), p = w ? 3 : m ? 0 : void 0, y = !v && t[0] === "" && t[1] === "" && t[2] === "?" && typeof t[3] == "string" && /^[a-z]:$/i.test(t[3]) ? 3 : v ? 0 : void 0;
2425
- if (typeof p == "number" && typeof y == "number") {
2426
- const [A, N] = [e[p], t[y]];
2427
- A.toLowerCase() === N.toLowerCase() && (t[y] = A, y > p ? t = t.slice(y) : p > y && (e = e.slice(p)));
2428
- }
2429
- }
2430
- const { optimizationLevel: u = 1 } = this.options;
2431
- u >= 2 && (e = this.levelTwoFileOptimize(e)), this.debug("matchOne", this, { file: e, pattern: t }), this.debug("matchOne", e.length, t.length);
2432
- for (var c = 0, i = 0, h = e.length, o = t.length; c < h && i < o; c++, i++) {
2433
- this.debug("matchOne loop");
2434
- var s = t[i], f = e[c];
2435
- if (this.debug(t, s, f), s === !1) return !1;
2436
- if (s === D) {
2437
- this.debug("GLOBSTAR", [t, s, f]);
2438
- var l = c, g = i + 1;
2439
- if (g === o) {
2440
- for (this.debug("** at the end"); c < h; c++) if (e[c] === "." || e[c] === ".." || !a.dot && e[c].charAt(0) === ".") return !1;
2441
- return !0;
2442
- }
2443
- for (; l < h; ) {
2444
- var d = e[l];
2445
- if (this.debug(`
2446
- globstar while`, e, l, t, g, d), this.matchOne(e.slice(l), t.slice(g), n)) return this.debug("globstar found match!", l, h, d), !0;
2447
- if (d === "." || d === ".." || !a.dot && d.charAt(0) === ".") {
2448
- this.debug("dot detected!", e, l, t, g);
2449
- break;
2450
- }
2451
- this.debug("globstar swallow a segment, and continue"), l++;
2452
- }
2453
- return !(!n || (this.debug(`
2454
- >>> no match, partial?`, e, l, t, g), l !== h));
2455
- }
2456
- let m;
2457
- if (typeof s == "string" ? (m = f === s, this.debug("string match", s, f, m)) : (m = s.test(f), this.debug("pattern match", s, f, m)), !m) return !1;
2458
- }
2459
- if (c === h && i === o) return !0;
2460
- if (c === h) return n;
2461
- if (i === o) return c === h - 1 && e[c] === "";
2462
- throw new Error("wtf?");
2463
- }
2464
- braceExpand() {
2465
- return cr(this.pattern, this.options);
2466
- }
2467
- parse(e) {
2468
- Oe(e);
2469
- const t = this.options;
2470
- if (e === "**") return D;
2471
- if (e === "") return "";
2472
- let n, a = null;
2473
- (n = e.match(xn)) ? a = t.dot ? En : Pn : (n = e.match(fn)) ? a = (t.nocase ? t.dot ? mn : dn : t.dot ? gn : pn)(n[1]) : (n = e.match(An)) ? a = (t.nocase ? t.dot ? On : Tn : t.dot ? Cn : In)(n) : (n = e.match(bn)) ? a = t.dot ? vn : yn : (n = e.match(wn)) && (a = Nn);
2474
- const u = Z.fromGlob(e, this.options).toMMPattern();
2475
- return a && typeof u == "object" && Reflect.defineProperty(u, "test", { value: a }), u;
2476
- }
2477
- makeRe() {
2478
- if (this.regexp || this.regexp === !1) return this.regexp;
2479
- const e = this.set;
2480
- if (!e.length) return this.regexp = !1, this.regexp;
2481
- const t = this.options, n = t.noglobstar ? "[^/]*?" : t.dot ? "(?:(?!(?:\\/|^)(?:\\.{1,2})($|\\/)).)*?" : "(?:(?!(?:\\/|^)\\.).)*?", a = new Set(t.nocase ? ["i"] : []);
2482
- let u = e.map(((h) => {
2483
- const o = h.map(((s) => {
2484
- if (s instanceof RegExp) for (const f of s.flags.split("")) a.add(f);
2485
- return typeof s == "string" ? s.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, "\\$&") : s === D ? D : s._src;
2486
- }));
2487
- return o.forEach(((s, f) => {
2488
- const l = o[f + 1], g = o[f - 1];
2489
- s === D && g !== D && (g === void 0 ? l !== void 0 && l !== D ? o[f + 1] = "(?:\\/|" + n + "\\/)?" + l : o[f] = n : l === void 0 ? o[f - 1] = g + "(?:\\/|" + n + ")?" : l !== D && (o[f - 1] = g + "(?:\\/|\\/" + n + "\\/)" + l, o[f + 1] = D));
2490
- })), o.filter(((s) => s !== D)).join("/");
2491
- })).join("|");
2492
- const [c, i] = e.length > 1 ? ["(?:", ")"] : ["", ""];
2493
- u = "^" + c + u + i + "$", this.negate && (u = "^(?!" + u + ").+$");
2494
- try {
2495
- this.regexp = new RegExp(u, [...a].join(""));
2496
- } catch {
2497
- this.regexp = !1;
2498
- }
2499
- return this.regexp;
2500
- }
2501
- slashSplit(e) {
2502
- return this.preserveMultipleSlashes ? e.split("/") : this.isWindows && /^\/\/[^\/]+/.test(e) ? ["", ...e.split(/\/+/)] : e.split(/\/+/);
2503
- }
2504
- match(e) {
2505
- let t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : this.partial;
2506
- if (this.debug("match", e, this.pattern), this.comment) return !1;
2507
- if (this.empty) return e === "";
2508
- if (e === "/" && t) return !0;
2509
- const n = this.options;
2510
- this.isWindows && (e = e.split("\\").join("/"));
2511
- const a = this.slashSplit(e);
2512
- this.debug(this.pattern, "split", a);
2513
- const u = this.set;
2514
- this.debug(this.pattern, "set", u);
2515
- let c = a[a.length - 1];
2516
- if (!c) for (let i = a.length - 2; !c && i >= 0; i--) c = a[i];
2517
- for (let i = 0; i < u.length; i++) {
2518
- const h = u[i];
2519
- let o = a;
2520
- if (n.matchBase && h.length === 1 && (o = [c]), this.matchOne(o, h, t)) return !!n.flipNegate || !this.negate;
2521
- }
2522
- return !n.flipNegate && this.negate;
2523
- }
2524
- static defaults(e) {
2525
- return H.defaults(e).Minimatch;
2526
- }
2527
- }
2528
- function at(r) {
2529
- const e = new Error(`${arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : ""}Invalid response: ${r.status} ${r.statusText}`);
2530
- return e.status = r.status, e.response = r, e;
2531
- }
2532
- function W(r, e) {
2533
- const { status: t } = e;
2534
- if (t === 401 && r.digest) return e;
2535
- if (t >= 400) throw at(e);
2536
- return e;
2537
- }
2538
- function ae(r, e) {
2539
- return arguments.length > 2 && arguments[2] !== void 0 && arguments[2] ? { data: e, headers: r.headers ? en(r.headers) : {}, status: r.status, statusText: r.statusText } : e;
2540
- }
2541
- H.AST = Z, H.Minimatch = Ce, H.escape = function(r) {
2542
- let { windowsPathsNoEscape: e = !1 } = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2543
- return e ? r.replace(/[?*()[\]]/g, "[$&]") : r.replace(/[?*()[\]\\]/g, "\\$&");
2544
- }, H.unescape = ge;
2545
- const Sn = (St = function(r, e, t) {
2546
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
2547
- const a = q({ url: U(r.remoteURL, k(e)), method: "COPY", headers: { Destination: U(r.remoteURL, k(t)), Overwrite: n.overwrite === !1 ? "F" : "T", Depth: n.shallow ? "0" : "infinity" } }, r, n);
2548
- return c = function(i) {
2549
- W(r, i);
2550
- }, (u = B(a, r)) && u.then || (u = Promise.resolve(u)), c ? u.then(c) : u;
2551
- var u, c;
2552
- }, function() {
2553
- for (var r = [], e = 0; e < arguments.length; e++) r[e] = arguments[e];
2554
- try {
2555
- return Promise.resolve(St.apply(this, r));
2556
- } catch (t) {
2557
- return Promise.reject(t);
2558
- }
2559
- });
2560
- var St, ut = R(635), Fn = R(829), te = R.n(Fn), le = (function(r) {
2561
- return r.Array = "array", r.Object = "object", r.Original = "original", r;
2562
- })(le || {});
2563
- function Ne(r, e) {
2564
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : le.Original;
2565
- const n = te().get(r, e);
2566
- return t === "array" && Array.isArray(n) === !1 ? [n] : t === "object" && Array.isArray(n) ? n[0] : n;
2567
- }
2568
- function ye(r) {
2569
- return new Promise(((e) => {
2570
- e((function(t) {
2571
- const { multistatus: n } = t;
2572
- if (n === "") return { multistatus: { response: [] } };
2573
- if (!n) throw new Error("Invalid response: No root multistatus found");
2574
- const a = { multistatus: Array.isArray(n) ? n[0] : n };
2575
- return te().set(a, "multistatus.response", Ne(a, "multistatus.response", le.Array)), te().set(a, "multistatus.response", te().get(a, "multistatus.response").map(((u) => (function(c) {
2576
- const i = Object.assign({}, c);
2577
- return i.status ? te().set(i, "status", Ne(i, "status", le.Object)) : (te().set(i, "propstat", Ne(i, "propstat", le.Object)), te().set(i, "propstat.prop", Ne(i, "propstat.prop", le.Object))), i;
2578
- })(u)))), a;
2579
- })(new ut.XMLParser({ allowBooleanAttributes: !0, attributeNamePrefix: "", textNodeName: "text", ignoreAttributes: !1, removeNSPrefix: !0, numberParseOptions: { hex: !0, leadingZeros: !1 }, attributeValueProcessor: (t, n, a) => n === "true" || n === "false" ? n === "true" : n, tagValueProcessor(t, n, a) {
2580
- if (!a.endsWith("propstat.prop.displayname")) return n;
2581
- } }).parse(r)));
2582
- }));
2583
- }
2584
- function Se(r, e) {
2585
- let t = arguments.length > 2 && arguments[2] !== void 0 && arguments[2];
2586
- const { getlastmodified: n = null, getcontentlength: a = "0", resourcetype: u = null, getcontenttype: c = null, getetag: i = null } = r, h = u && typeof u == "object" && u.collection !== void 0 ? "directory" : "file", o = { filename: e, basename: Pe().basename(e), lastmod: n, size: parseInt(a, 10), type: h, etag: typeof i == "string" ? i.replace(/"/g, "") : null };
2587
- return h === "file" && (o.mime = c && typeof c == "string" ? c.split(";")[0] : ""), t && (r.displayname !== void 0 && (r.displayname = String(r.displayname)), o.props = r), o;
2588
- }
2589
- function hr(r, e) {
2590
- let t = arguments.length > 2 && arguments[2] !== void 0 && arguments[2], n = null;
2591
- try {
2592
- r.multistatus.response[0].propstat && (n = r.multistatus.response[0]);
2593
- } catch {
2594
- }
2595
- if (!n) throw new Error("Failed getting item stat: bad response");
2596
- const { propstat: { prop: a, status: u } } = n, [c, i, h] = u.split(" ", 3), o = parseInt(i, 10);
2597
- if (o >= 400) {
2598
- const s = new Error(`Invalid response: ${o} ${h}`);
2599
- throw s.status = o, s;
2600
- }
2601
- return Se(a, be(e), t);
2602
- }
2603
- function fr(r) {
2604
- switch (String(r)) {
2605
- case "-3":
2606
- return "unlimited";
2607
- case "-2":
2608
- case "-1":
2609
- return "unknown";
2610
- default:
2611
- return parseInt(String(r), 10);
2612
- }
2613
- }
2614
- function Le(r, e, t) {
2615
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2616
- }
2617
- const lt = /* @__PURE__ */ (function(r) {
2618
- return function() {
2619
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2620
- try {
2621
- return Promise.resolve(r.apply(this, e));
2622
- } catch (n) {
2623
- return Promise.reject(n);
2624
- }
2625
- };
2626
- })((function(r, e) {
2627
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2628
- const { details: n = !1 } = t, a = q({ url: U(r.remoteURL, k(e)), method: "PROPFIND", headers: { Accept: "text/plain,application/xml", Depth: "0" } }, r, t);
2629
- return Le(B(a, r), (function(u) {
2630
- return W(r, u), Le(u.text(), (function(c) {
2631
- return Le(ye(c), (function(i) {
2632
- const h = hr(i, e, n);
2633
- return ae(u, h, n);
2634
- }));
2635
- }));
2636
- }));
2637
- }));
2638
- function pr(r, e, t) {
2639
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2640
- }
2641
- const jn = gr((function(r, e) {
2642
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2643
- const n = (function(u) {
2644
- if (!u || u === "/") return [];
2645
- let c = u;
2646
- const i = [];
2647
- do
2648
- i.push(c), c = Pe().dirname(c);
2649
- while (c && c !== "/");
2650
- return i;
2651
- })(be(e));
2652
- n.sort(((u, c) => u.length > c.length ? 1 : c.length > u.length ? -1 : 0));
2653
- let a = !1;
2654
- return (function(u, c, i) {
2655
- if (typeof u[jt] == "function") {
2656
- let m = function(w) {
2657
- try {
2658
- for (; !(h = f.next()).done; ) if ((w = c(h.value)) && w.then) {
2659
- if (!$t(w)) return void w.then(m, s || (s = Y.bind(null, o = new ce(), 2)));
2660
- w = w.v;
2661
- }
2662
- o ? Y(o, 1, w) : o = w;
2663
- } catch (v) {
2664
- Y(o || (o = new ce()), 2, v);
2665
- }
2666
- };
2667
- var h, o, s, f = u[jt]();
2668
- if (m(), f.return) {
2669
- var l = function(w) {
2670
- try {
2671
- h.done || f.return();
2672
- } catch {
2673
- }
2674
- return w;
2675
- };
2676
- if (o && o.then) return o.then(l, (function(w) {
2677
- throw l(w);
2678
- }));
2679
- l();
2680
- }
2681
- return o;
2682
- }
2683
- if (!("length" in u)) throw new TypeError("Object is not iterable");
2684
- for (var g = [], d = 0; d < u.length; d++) g.push(u[d]);
2685
- return (function(m, w, v) {
2686
- var p, y, A = -1;
2687
- return (function N(b) {
2688
- try {
2689
- for (; ++A < m.length && (!v || !v()); ) if ((b = w(A)) && b.then) {
2690
- if (!$t(b)) return void b.then(N, y || (y = Y.bind(null, p = new ce(), 2)));
2691
- b = b.v;
2692
- }
2693
- p ? Y(p, 1, b) : p = b;
2694
- } catch (E) {
2695
- Y(p || (p = new ce()), 2, E);
2696
- }
2697
- })(), p;
2698
- })(g, (function(m) {
2699
- return c(g[m]);
2700
- }), i);
2701
- })(n, (function(u) {
2702
- return c = function() {
2703
- return (function(h, o) {
2704
- try {
2705
- var s = pr(lt(r, u), (function(f) {
2706
- if (f.type !== "directory") throw new Error(`Path includes a file: ${e}`);
2707
- }));
2708
- } catch (f) {
2709
- return o(f);
2710
- }
2711
- return s && s.then ? s.then(void 0, o) : s;
2712
- })(0, (function(h) {
2713
- const o = h;
2714
- return (function() {
2715
- if (o.status === 404) return a = !0, Ft(tt(r, u, { ...t, recursive: !1 }));
2716
- throw h;
2717
- })();
2718
- }));
2719
- }, (i = (function() {
2720
- if (a) return Ft(tt(r, u, { ...t, recursive: !1 }));
2721
- })()) && i.then ? i.then(c) : c();
2722
- var c, i;
2723
- }), (function() {
2724
- return !1;
2725
- }));
2726
- }));
2727
- function gr(r) {
2728
- return function() {
2729
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2730
- try {
2731
- return Promise.resolve(r.apply(this, e));
2732
- } catch (n) {
2733
- return Promise.reject(n);
2734
- }
2735
- };
2736
- }
2737
- function $n() {
2738
- }
2739
- function Ft(r, e) {
2740
- return r && r.then ? r.then($n) : Promise.resolve();
2741
- }
2742
- const jt = typeof Symbol < "u" ? Symbol.iterator || (Symbol.iterator = /* @__PURE__ */ Symbol("Symbol.iterator")) : "@@iterator";
2743
- function Y(r, e, t) {
2744
- if (!r.s) {
2745
- if (t instanceof ce) {
2746
- if (!t.s) return void (t.o = Y.bind(null, r, e));
2747
- 1 & e && (e = t.s), t = t.v;
2748
- }
2749
- if (t && t.then) return void t.then(Y.bind(null, r, e), Y.bind(null, r, 2));
2750
- r.s = e, r.v = t;
2751
- const n = r.o;
2752
- n && n(r);
2753
- }
2754
- }
2755
- const ce = (function() {
2756
- function r() {
2757
- }
2758
- return r.prototype.then = function(e, t) {
2759
- const n = new r(), a = this.s;
2760
- if (a) {
2761
- const u = 1 & a ? e : t;
2762
- if (u) {
2763
- try {
2764
- Y(n, 1, u(this.v));
2765
- } catch (c) {
2766
- Y(n, 2, c);
2767
- }
2768
- return n;
2769
- }
2770
- return this;
2771
- }
2772
- return this.o = function(u) {
2773
- try {
2774
- const c = u.v;
2775
- 1 & u.s ? Y(n, 1, e ? e(c) : c) : t ? Y(n, 1, t(c)) : Y(n, 2, c);
2776
- } catch (c) {
2777
- Y(n, 2, c);
2778
- }
2779
- }, n;
2780
- }, r;
2781
- })();
2782
- function $t(r) {
2783
- return r instanceof ce && 1 & r.s;
2784
- }
2785
- const tt = gr((function(r, e) {
2786
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2787
- if (t.recursive === !0) return jn(r, e, t);
2788
- const n = q({ url: U(r.remoteURL, (a = k(e), a.endsWith("/") ? a : a + "/")), method: "MKCOL" }, r, t);
2789
- var a;
2790
- return pr(B(n, r), (function(u) {
2791
- W(r, u);
2792
- }));
2793
- }));
2794
- var Rn = R(388), Rt = R.n(Rn);
2795
- const Ln = /* @__PURE__ */ (function(r) {
2796
- return function() {
2797
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2798
- try {
2799
- return Promise.resolve(r.apply(this, e));
2800
- } catch (n) {
2801
- return Promise.reject(n);
2802
- }
2803
- };
2804
- })((function(r, e) {
2805
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2806
- const n = {};
2807
- if (typeof t.range == "object" && typeof t.range.start == "number") {
2808
- let i = `bytes=${t.range.start}-`;
2809
- typeof t.range.end == "number" && (i = `${i}${t.range.end}`), n.Range = i;
2810
- }
2811
- const a = q({ url: U(r.remoteURL, k(e)), method: "GET", headers: n }, r, t);
2812
- return c = function(i) {
2813
- if (W(r, i), n.Range && i.status !== 206) {
2814
- const h = new Error(`Invalid response code for partial request: ${i.status}`);
2815
- throw h.status = i.status, h;
2816
- }
2817
- return t.callback && setTimeout((() => {
2818
- t.callback(i);
2819
- }), 0), i.body;
2820
- }, (u = B(a, r)) && u.then || (u = Promise.resolve(u)), c ? u.then(c) : u;
2821
- var u, c;
2822
- })), kn = () => {
2823
- }, Un = /* @__PURE__ */ (function(r) {
2824
- return function() {
2825
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2826
- try {
2827
- return Promise.resolve(r.apply(this, e));
2828
- } catch (n) {
2829
- return Promise.reject(n);
2830
- }
2831
- };
2832
- })((function(r, e, t) {
2833
- t.url || (t.url = U(r.remoteURL, k(e)));
2834
- const n = q(t, r, {});
2835
- return u = function(c) {
2836
- return W(r, c), c;
2837
- }, (a = B(n, r)) && a.then || (a = Promise.resolve(a)), u ? a.then(u) : a;
2838
- var a, u;
2839
- })), _n = /* @__PURE__ */ (function(r) {
2840
- return function() {
2841
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2842
- try {
2843
- return Promise.resolve(r.apply(this, e));
2844
- } catch (n) {
2845
- return Promise.reject(n);
2846
- }
2847
- };
2848
- })((function(r, e) {
2849
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2850
- const n = q({ url: U(r.remoteURL, k(e)), method: "DELETE" }, r, t);
2851
- return u = function(c) {
2852
- W(r, c);
2853
- }, (a = B(n, r)) && a.then || (a = Promise.resolve(a)), u ? a.then(u) : a;
2854
- var a, u;
2855
- })), Mn = /* @__PURE__ */ (function(r) {
2856
- return function() {
2857
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2858
- try {
2859
- return Promise.resolve(r.apply(this, e));
2860
- } catch (n) {
2861
- return Promise.reject(n);
2862
- }
2863
- };
2864
- })((function(r, e) {
2865
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2866
- return (function(n, a) {
2867
- try {
2868
- var u = (c = lt(r, e, t), i = function() {
2869
- return !0;
2870
- }, h ? i ? i(c) : c : (c && c.then || (c = Promise.resolve(c)), i ? c.then(i) : c));
2871
- } catch (o) {
2872
- return a(o);
2873
- }
2874
- var c, i, h;
2875
- return u && u.then ? u.then(void 0, a) : u;
2876
- })(0, (function(n) {
2877
- if (n.status === 404) return !1;
2878
- throw n;
2879
- }));
2880
- }));
2881
- function ke(r, e, t) {
2882
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2883
- }
2884
- const Vn = /* @__PURE__ */ (function(r) {
2885
- return function() {
2886
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2887
- try {
2888
- return Promise.resolve(r.apply(this, e));
2889
- } catch (n) {
2890
- return Promise.reject(n);
2891
- }
2892
- };
2893
- })((function(r, e) {
2894
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2895
- const n = q({ url: U(r.remoteURL, k(e), "/"), method: "PROPFIND", headers: { Accept: "text/plain,application/xml", Depth: t.deep ? "infinity" : "1" } }, r, t);
2896
- return ke(B(n, r), (function(a) {
2897
- return W(r, a), ke(a.text(), (function(u) {
2898
- if (!u) throw new Error("Failed parsing directory contents: Empty response");
2899
- return ke(ye(u), (function(c) {
2900
- const i = vt(e);
2901
- let h = (function(o, s, f) {
2902
- let l = arguments.length > 3 && arguments[3] !== void 0 && arguments[3], g = arguments.length > 4 && arguments[4] !== void 0 && arguments[4];
2903
- const d = Pe().join(s, "/"), { multistatus: { response: m } } = o, w = m.map(((v) => {
2904
- const p = (function(A) {
2905
- try {
2906
- return A.replace(/^https?:\/\/[^\/]+/, "");
2907
- } catch (N) {
2908
- throw new K(N, "Failed normalising HREF");
2909
- }
2910
- })(v.href), { propstat: { prop: y } } = v;
2911
- return Se(y, d === "/" ? decodeURIComponent(be(p)) : be(Pe().relative(decodeURIComponent(d), decodeURIComponent(p))), l);
2912
- }));
2913
- return g ? w : w.filter(((v) => v.basename && (v.type === "file" || v.filename !== f.replace(/\/$/, ""))));
2914
- })(c, vt(r.remoteBasePath || r.remotePath), i, t.details, t.includeSelf);
2915
- return t.glob && (h = (function(o, s) {
2916
- return o.filter(((f) => H(f.filename, s, { matchBase: !0 })));
2917
- })(h, t.glob)), ae(a, h, t.details);
2918
- }));
2919
- }));
2920
- }));
2921
- }));
2922
- function ct(r) {
2923
- return function() {
2924
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2925
- try {
2926
- return Promise.resolve(r.apply(this, e));
2927
- } catch (n) {
2928
- return Promise.reject(n);
2929
- }
2930
- };
2931
- }
2932
- const Bn = ct((function(r, e) {
2933
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2934
- const n = q({ url: U(r.remoteURL, k(e)), method: "GET", headers: { Accept: "text/plain" }, transformResponse: [Xn] }, r, t);
2935
- return Ie(B(n, r), (function(a) {
2936
- return W(r, a), Ie(a.text(), (function(u) {
2937
- return ae(a, u, t.details);
2938
- }));
2939
- }));
2940
- }));
2941
- function Ie(r, e, t) {
2942
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2943
- }
2944
- const qn = ct((function(r, e) {
2945
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2946
- const n = q({ url: U(r.remoteURL, k(e)), method: "GET" }, r, t);
2947
- return Ie(B(n, r), (function(a) {
2948
- let u;
2949
- return W(r, a), (function(c, i) {
2950
- var h = c();
2951
- return h && h.then ? h.then(i) : i();
2952
- })((function() {
2953
- return Ie(a.arrayBuffer(), (function(c) {
2954
- u = c;
2955
- }));
2956
- }), (function() {
2957
- return ae(a, u, t.details);
2958
- }));
2959
- }));
2960
- })), Wn = ct((function(r, e) {
2961
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2962
- const { format: n = "binary" } = t;
2963
- if (n !== "binary" && n !== "text") throw new K({ info: { code: ne.InvalidOutputFormat } }, `Invalid output format: ${n}`);
2964
- return n === "text" ? Bn(r, e, t) : qn(r, e, t);
2965
- })), Xn = (r) => r;
2966
- function Gn(r) {
2967
- return new ut.XMLBuilder({ attributeNamePrefix: "@_", format: !0, ignoreAttributes: !1, suppressEmptyNode: !0 }).build(dr({ lockinfo: { "@_xmlns:d": "DAV:", lockscope: { exclusive: {} }, locktype: { write: {} }, owner: { href: r } } }, "d"));
2968
- }
2969
- function dr(r, e) {
2970
- const t = { ...r };
2971
- for (const n in t) t.hasOwnProperty(n) && (t[n] && typeof t[n] == "object" && n.indexOf(":") === -1 ? (t[`${e}:${n}`] = dr(t[n], e), delete t[n]) : /^@_/.test(n) === !1 && (t[`${e}:${n}`] = t[n], delete t[n]));
2972
- return t;
2973
- }
2974
- function rt(r, e, t) {
2975
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
2976
- }
2977
- function mr(r) {
2978
- return function() {
2979
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
2980
- try {
2981
- return Promise.resolve(r.apply(this, e));
2982
- } catch (n) {
2983
- return Promise.reject(n);
2984
- }
2985
- };
2986
- }
2987
- const zn = mr((function(r, e, t) {
2988
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
2989
- const a = q({ url: U(r.remoteURL, k(e)), method: "UNLOCK", headers: { "Lock-Token": t } }, r, n);
2990
- return rt(B(a, r), (function(u) {
2991
- if (W(r, u), u.status !== 204 && u.status !== 200) throw at(u);
2992
- }));
2993
- })), Hn = mr((function(r, e) {
2994
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2995
- const { refreshToken: n, timeout: a = Zn } = t, u = { Accept: "text/plain,application/xml", Timeout: a };
2996
- n && (u.If = n);
2997
- const c = q({ url: U(r.remoteURL, k(e)), method: "LOCK", headers: u, data: Gn(r.contactHref) }, r, t);
2998
- return rt(B(c, r), (function(i) {
2999
- return W(r, i), rt(i.text(), (function(h) {
3000
- const o = (l = h, new ut.XMLParser({ removeNSPrefix: !0, parseAttributeValue: !0, parseTagValue: !0 }).parse(l)), s = te().get(o, "prop.lockdiscovery.activelock.locktoken.href"), f = te().get(o, "prop.lockdiscovery.activelock.timeout");
3001
- var l;
3002
- if (!s) throw at(i, "No lock token received: ");
3003
- return { token: s, serverTimeout: f };
3004
- }));
3005
- }));
3006
- })), Zn = "Infinite, Second-4100000000";
3007
- function Ue(r, e, t) {
3008
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
3009
- }
3010
- const Jn = /* @__PURE__ */ (function(r) {
3011
- return function() {
3012
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3013
- try {
3014
- return Promise.resolve(r.apply(this, e));
3015
- } catch (n) {
3016
- return Promise.reject(n);
3017
- }
3018
- };
3019
- })((function(r) {
3020
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3021
- const t = e.path || "/", n = q({ url: U(r.remoteURL, t), method: "PROPFIND", headers: { Accept: "text/plain,application/xml", Depth: "0" } }, r, e);
3022
- return Ue(B(n, r), (function(a) {
3023
- return W(r, a), Ue(a.text(), (function(u) {
3024
- return Ue(ye(u), (function(c) {
3025
- const i = (function(h) {
3026
- try {
3027
- const [o] = h.multistatus.response, { propstat: { prop: { "quota-used-bytes": s, "quota-available-bytes": f } } } = o;
3028
- return s !== void 0 && f !== void 0 ? { used: parseInt(String(s), 10), available: fr(f) } : null;
3029
- } catch {
3030
- }
3031
- return null;
3032
- })(c);
3033
- return ae(a, i, e.details);
3034
- }));
3035
- }));
3036
- }));
3037
- }));
3038
- function _e(r, e, t) {
3039
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
3040
- }
3041
- const Yn = /* @__PURE__ */ (function(r) {
3042
- return function() {
3043
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3044
- try {
3045
- return Promise.resolve(r.apply(this, e));
3046
- } catch (n) {
3047
- return Promise.reject(n);
3048
- }
3049
- };
3050
- })((function(r, e) {
3051
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3052
- const { details: n = !1 } = t, a = q({ url: U(r.remoteURL, k(e)), method: "SEARCH", headers: { Accept: "text/plain,application/xml", "Content-Type": r.headers["Content-Type"] || "application/xml; charset=utf-8" } }, r, t);
3053
- return _e(B(a, r), (function(u) {
3054
- return W(r, u), _e(u.text(), (function(c) {
3055
- return _e(ye(c), (function(i) {
3056
- const h = (function(o, s, f) {
3057
- const l = { truncated: !1, results: [] };
3058
- return l.truncated = o.multistatus.response.some(((g) => (g.status || g.propstat?.status).split(" ", 3)?.[1] === "507" && g.href.replace(/\/$/, "").endsWith(k(s).replace(/\/$/, "")))), o.multistatus.response.forEach(((g) => {
3059
- if (g.propstat === void 0) return;
3060
- const d = g.href.split("/").map(decodeURIComponent).join("/");
3061
- l.results.push(Se(g.propstat.prop, d, f));
3062
- })), l;
3063
- })(i, e, n);
3064
- return ae(u, h, n);
3065
- }));
3066
- }));
3067
- }));
3068
- })), Kn = /* @__PURE__ */ (function(r) {
3069
- return function() {
3070
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3071
- try {
3072
- return Promise.resolve(r.apply(this, e));
3073
- } catch (n) {
3074
- return Promise.reject(n);
3075
- }
3076
- };
3077
- })((function(r, e, t) {
3078
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
3079
- const a = q({ url: U(r.remoteURL, k(e)), method: "MOVE", headers: { Destination: U(r.remoteURL, k(t)), Overwrite: n.overwrite === !1 ? "F" : "T" } }, r, n);
3080
- return c = function(i) {
3081
- W(r, i);
3082
- }, (u = B(a, r)) && u.then || (u = Promise.resolve(u)), c ? u.then(c) : u;
3083
- var u, c;
3084
- }));
3085
- var Qn = R(172);
3086
- const Dn = /* @__PURE__ */ (function(r) {
3087
- return function() {
3088
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3089
- try {
3090
- return Promise.resolve(r.apply(this, e));
3091
- } catch (n) {
3092
- return Promise.reject(n);
3093
- }
3094
- };
3095
- })((function(r, e, t) {
3096
- let n = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : {};
3097
- const { contentLength: a = !0, overwrite: u = !0 } = n, c = { "Content-Type": "application/octet-stream" };
3098
- a === !1 || (c["Content-Length"] = typeof a == "number" ? `${a}` : `${(function(s) {
3099
- if (sr(s)) return s.byteLength;
3100
- if (ir(s)) return s.length;
3101
- if (typeof s == "string") return (0, Qn.d)(s);
3102
- throw new K({ info: { code: ne.DataTypeNoLength } }, "Cannot calculate data length: Invalid type");
3103
- })(t)}`), u || (c["If-None-Match"] = "*");
3104
- const i = q({ url: U(r.remoteURL, k(e)), method: "PUT", headers: c, data: t }, r, n);
3105
- return o = function(s) {
3106
- try {
3107
- W(r, s);
3108
- } catch (f) {
3109
- const l = f;
3110
- if (l.status !== 412 || u) throw l;
3111
- return !1;
3112
- }
3113
- return !0;
3114
- }, (h = B(i, r)) && h.then || (h = Promise.resolve(h)), o ? h.then(o) : h;
3115
- var h, o;
3116
- })), br = /* @__PURE__ */ (function(r) {
3117
- return function() {
3118
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3119
- try {
3120
- return Promise.resolve(r.apply(this, e));
3121
- } catch (n) {
3122
- return Promise.reject(n);
3123
- }
3124
- };
3125
- })((function(r, e) {
3126
- let t = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3127
- const n = q({ url: U(r.remoteURL, k(e)), method: "OPTIONS" }, r, t);
3128
- return u = function(c) {
3129
- try {
3130
- W(r, c);
3131
- } catch (i) {
3132
- throw i;
3133
- }
3134
- return { compliance: (c.headers.get("DAV") ?? "").split(",").map(((i) => i.trim())), server: c.headers.get("Server") ?? "" };
3135
- }, (a = B(n, r)) && a.then || (a = Promise.resolve(a)), u ? a.then(u) : a;
3136
- var a, u;
3137
- }));
3138
- function de(r, e, t) {
3139
- return t ? e ? e(r) : r : (r && r.then || (r = Promise.resolve(r)), e ? r.then(e) : r);
3140
- }
3141
- const es = ht((function(r, e, t, n, a) {
3142
- let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
3143
- if (t > n || t < 0) throw new K({ info: { code: ne.InvalidUpdateRange } }, `Invalid update range ${t} for partial update`);
3144
- const c = { "Content-Type": "application/octet-stream", "Content-Length": "" + (n - t + 1), "Content-Range": `bytes ${t}-${n}/*` }, i = q({ url: U(r.remoteURL, k(e)), method: "PUT", headers: c, data: a }, r, u);
3145
- return de(B(i, r), (function(h) {
3146
- W(r, h);
3147
- }));
3148
- }));
3149
- function Lt(r, e) {
3150
- var t = r();
3151
- return t && t.then ? t.then(e) : e(t);
3152
- }
3153
- const ts = ht((function(r, e, t, n, a) {
3154
- let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
3155
- if (t > n || t < 0) throw new K({ info: { code: ne.InvalidUpdateRange } }, `Invalid update range ${t} for partial update`);
3156
- const c = { "Content-Type": "application/x-sabredav-partialupdate", "Content-Length": "" + (n - t + 1), "X-Update-Range": `bytes=${t}-${n}` }, i = q({ url: U(r.remoteURL, k(e)), method: "PATCH", headers: c, data: a }, r, u);
3157
- return de(B(i, r), (function(h) {
3158
- W(r, h);
3159
- }));
3160
- }));
3161
- function ht(r) {
3162
- return function() {
3163
- for (var e = [], t = 0; t < arguments.length; t++) e[t] = arguments[t];
3164
- try {
3165
- return Promise.resolve(r.apply(this, e));
3166
- } catch (n) {
3167
- return Promise.reject(n);
3168
- }
3169
- };
3170
- }
3171
- const rs = ht((function(r, e, t, n, a) {
3172
- let u = arguments.length > 5 && arguments[5] !== void 0 ? arguments[5] : {};
3173
- return de(br(r, e, u), (function(c) {
3174
- let i = !1;
3175
- return Lt((function() {
3176
- if (c.compliance.includes("sabredav-partialupdate")) return de(ts(r, e, t, n, a, u), (function(h) {
3177
- return i = !0, h;
3178
- }));
3179
- }), (function(h) {
3180
- let o = !1;
3181
- return i ? h : Lt((function() {
3182
- if (c.server.includes("Apache") && c.compliance.includes("<http://apache.org/dav/propset/fs/1>")) return de(es(r, e, t, n, a, u), (function(s) {
3183
- return o = !0, s;
3184
- }));
3185
- }), (function(s) {
3186
- if (o) return s;
3187
- throw new K({ info: { code: ne.NotSupported } }, "Not supported");
3188
- }));
3189
- }));
3190
- }));
3191
- })), ns = "https://github.com/perry-mitchell/webdav-client/blob/master/LOCK_CONTACT.md";
3192
- function ss(r) {
3193
- let e = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
3194
- const { authType: t = null, remoteBasePath: n, contactHref: a = ns, ha1: u, headers: c = {}, httpAgent: i, httpsAgent: h, password: o, token: s, username: f, withCredentials: l } = e;
3195
- let g = t;
3196
- g || (g = f || o ? J.Password : J.None);
3197
- const d = { authType: g, remoteBasePath: n, contactHref: a, ha1: u, headers: Object.assign({}, c), httpAgent: i, httpsAgent: h, password: o, remotePath: Gr(r), remoteURL: r, token: s, username: f, withCredentials: l };
3198
- return tr(d, f, o, s, u), { copyFile: (m, w, v) => Sn(d, m, w, v), createDirectory: (m, w) => tt(d, m, w), createReadStream: (m, w) => (function(v, p) {
3199
- let y = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
3200
- const A = new (Rt()).PassThrough();
3201
- return Ln(v, p, y).then(((N) => {
3202
- N.pipe(A);
3203
- })).catch(((N) => {
3204
- A.emit("error", N);
3205
- })), A;
3206
- })(d, m, w), createWriteStream: (m, w, v) => (function(p, y) {
3207
- let A = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {}, N = arguments.length > 3 && arguments[3] !== void 0 ? arguments[3] : kn;
3208
- const b = new (Rt()).PassThrough(), E = {};
3209
- A.overwrite === !1 && (E["If-None-Match"] = "*");
3210
- const x = q({ url: U(p.remoteURL, k(y)), method: "PUT", headers: E, data: b, maxRedirects: 0 }, p, A);
3211
- return B(x, p).then(((T) => W(p, T))).then(((T) => {
3212
- setTimeout((() => {
3213
- N(T);
3214
- }), 0);
3215
- })).catch(((T) => {
3216
- b.emit("error", T);
3217
- })), b;
3218
- })(d, m, w, v), customRequest: (m, w) => Un(d, m, w), deleteFile: (m, w) => _n(d, m, w), exists: (m, w) => Mn(d, m, w), getDirectoryContents: (m, w) => Vn(d, m, w), getFileContents: (m, w) => Wn(d, m, w), getFileDownloadLink: (m) => (function(w, v) {
3219
- let p = U(w.remoteURL, k(v));
3220
- const y = /^https:/i.test(p) ? "https" : "http";
3221
- switch (w.authType) {
3222
- case J.None:
3223
- break;
3224
- case J.Password: {
3225
- const A = Nt(w.headers.Authorization.replace(/^Basic /i, "").trim());
3226
- p = p.replace(/^https?:\/\//, `${y}://${A}@`);
3227
- break;
3228
- }
3229
- default:
3230
- throw new K({ info: { code: ne.LinkUnsupportedAuthType } }, `Unsupported auth type for file link: ${w.authType}`);
3231
- }
3232
- return p;
3233
- })(d, m), getFileUploadLink: (m) => (function(w, v) {
3234
- let p = `${U(w.remoteURL, k(v))}?Content-Type=application/octet-stream`;
3235
- const y = /^https:/i.test(p) ? "https" : "http";
3236
- switch (w.authType) {
3237
- case J.None:
3238
- break;
3239
- case J.Password: {
3240
- const A = Nt(w.headers.Authorization.replace(/^Basic /i, "").trim());
3241
- p = p.replace(/^https?:\/\//, `${y}://${A}@`);
3242
- break;
3243
- }
3244
- default:
3245
- throw new K({ info: { code: ne.LinkUnsupportedAuthType } }, `Unsupported auth type for file link: ${w.authType}`);
3246
- }
3247
- return p;
3248
- })(d, m), getHeaders: () => Object.assign({}, d.headers), getQuota: (m) => Jn(d, m), lock: (m, w) => Hn(d, m, w), moveFile: (m, w, v) => Kn(d, m, w, v), putFileContents: (m, w, v) => Dn(d, m, w, v), partialUpdateFileContents: (m, w, v, p, y) => rs(d, m, w, v, p, y), getDAVCompliance: (m) => br(d, m), search: (m, w) => Yn(d, m, w), setHeaders: (m) => {
3249
- d.headers = Object.assign({}, m);
3250
- }, stat: (m, w) => lt(d, m, w), unlock: (m, w, v) => zn(d, m, w, v) };
3251
- }
3252
- ee.hT;
3253
- ee.O4;
3254
- ee.Kd;
3255
- ee.YK;
3256
- var is = ee.UU;
3257
- ee.Gu;
3258
- ee.ky;
3259
- var os = ee.h4, as = ee.ch;
3260
- ee.hq;
3261
- ee.i5;
3262
- const G = [];
3263
- for (let r = 0; r < 256; ++r)
3264
- G.push((r + 256).toString(16).slice(1));
3265
- function us(r, e = 0) {
3266
- return (G[r[e + 0]] + G[r[e + 1]] + G[r[e + 2]] + G[r[e + 3]] + "-" + G[r[e + 4]] + G[r[e + 5]] + "-" + G[r[e + 6]] + G[r[e + 7]] + "-" + G[r[e + 8]] + G[r[e + 9]] + "-" + G[r[e + 10]] + G[r[e + 11]] + G[r[e + 12]] + G[r[e + 13]] + G[r[e + 14]] + G[r[e + 15]]).toLowerCase();
3267
- }
3268
- let Me;
3269
- const ls = new Uint8Array(16);
3270
- function cs() {
3271
- if (!Me) {
3272
- if (typeof crypto > "u" || !crypto.getRandomValues)
3273
- throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
3274
- Me = crypto.getRandomValues.bind(crypto);
3275
- }
3276
- return Me(ls);
3277
- }
3278
- const hs = typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto), kt = { randomUUID: hs };
3279
- function fs(r, e, t) {
3280
- r = r || {};
3281
- const n = r.random ?? r.rng?.() ?? cs();
3282
- if (n.length < 16)
3283
- throw new Error("Random bytes length must be >= 16");
3284
- return n[6] = n[6] & 15 | 64, n[8] = n[8] & 63 | 128, us(n);
3285
- }
3286
- function ps(r, e, t) {
3287
- return kt.randomUUID && !r ? kt.randomUUID() : fs(r);
3288
- }
3289
- var Ve = {}, Be = {}, Ut;
3290
- function ft() {
3291
- return Ut || (Ut = 1, (function(r) {
3292
- 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", t = e + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", n = "[" + e + "][" + t + "]*", a = new RegExp("^" + n + "$"), u = function(i, h) {
3293
- const o = [];
3294
- let s = h.exec(i);
3295
- for (; s; ) {
3296
- const f = [];
3297
- f.startIndex = h.lastIndex - s[0].length;
3298
- const l = s.length;
3299
- for (let g = 0; g < l; g++)
3300
- f.push(s[g]);
3301
- o.push(f), s = h.exec(i);
3302
- }
3303
- return o;
3304
- }, c = function(i) {
3305
- const h = a.exec(i);
3306
- return !(h === null || typeof h > "u");
3307
- };
3308
- r.isExist = function(i) {
3309
- return typeof i < "u";
3310
- }, r.isEmptyObject = function(i) {
3311
- return Object.keys(i).length === 0;
3312
- }, r.merge = function(i, h, o) {
3313
- if (h) {
3314
- const s = Object.keys(h), f = s.length;
3315
- for (let l = 0; l < f; l++)
3316
- o === "strict" ? i[s[l]] = [h[s[l]]] : i[s[l]] = h[s[l]];
3317
- }
3318
- }, r.getValue = function(i) {
3319
- return r.isExist(i) ? i : "";
3320
- }, r.isName = c, r.getAllMatches = u, r.nameRegexp = n;
3321
- })(Be)), Be;
3322
- }
3323
- var _t;
3324
- function yr() {
3325
- if (_t) return Ve;
3326
- _t = 1;
3327
- const r = ft(), e = {
3328
- allowBooleanAttributes: !1,
3329
- //A tag can have attributes without any value
3330
- unpairedTags: []
3331
- };
3332
- Ve.validate = function(v, p) {
3333
- p = Object.assign({}, e, p);
3334
- const y = [];
3335
- let A = !1, N = !1;
3336
- v[0] === "\uFEFF" && (v = v.substr(1));
3337
- for (let b = 0; b < v.length; b++)
3338
- if (v[b] === "<" && v[b + 1] === "?") {
3339
- if (b += 2, b = n(v, b), b.err) return b;
3340
- } else if (v[b] === "<") {
3341
- let E = b;
3342
- if (b++, v[b] === "!") {
3343
- b = a(v, b);
3344
- continue;
3345
- } else {
3346
- let x = !1;
3347
- v[b] === "/" && (x = !0, b++);
3348
- let T = "";
3349
- for (; b < v.length && v[b] !== ">" && v[b] !== " " && v[b] !== " " && v[b] !== `
3350
- ` && v[b] !== "\r"; b++)
3351
- T += v[b];
3352
- if (T = T.trim(), T[T.length - 1] === "/" && (T = T.substring(0, T.length - 1), b--), !d(T)) {
3353
- let C;
3354
- return T.trim().length === 0 ? C = "Invalid space after '<'." : C = "Tag '" + T + "' is an invalid name.", l("InvalidTag", C, m(v, b));
3355
- }
3356
- const O = i(v, b);
3357
- if (O === !1)
3358
- return l("InvalidAttr", "Attributes for '" + T + "' have open quote.", m(v, b));
3359
- let I = O.value;
3360
- if (b = O.index, I[I.length - 1] === "/") {
3361
- const C = b - I.length;
3362
- I = I.substring(0, I.length - 1);
3363
- const P = o(I, p);
3364
- if (P === !0)
3365
- A = !0;
3366
- else
3367
- return l(P.err.code, P.err.msg, m(v, C + P.err.line));
3368
- } else if (x)
3369
- if (O.tagClosed) {
3370
- if (I.trim().length > 0)
3371
- return l("InvalidTag", "Closing tag '" + T + "' can't have attributes or invalid starting.", m(v, E));
3372
- if (y.length === 0)
3373
- return l("InvalidTag", "Closing tag '" + T + "' has not been opened.", m(v, E));
3374
- {
3375
- const C = y.pop();
3376
- if (T !== C.tagName) {
3377
- let P = m(v, C.tagStartPos);
3378
- return l(
3379
- "InvalidTag",
3380
- "Expected closing tag '" + C.tagName + "' (opened in line " + P.line + ", col " + P.col + ") instead of closing tag '" + T + "'.",
3381
- m(v, E)
3382
- );
3383
- }
3384
- y.length == 0 && (N = !0);
3385
- }
3386
- } else return l("InvalidTag", "Closing tag '" + T + "' doesn't have proper closing.", m(v, b));
3387
- else {
3388
- const C = o(I, p);
3389
- if (C !== !0)
3390
- return l(C.err.code, C.err.msg, m(v, b - I.length + C.err.line));
3391
- if (N === !0)
3392
- return l("InvalidXml", "Multiple possible root nodes found.", m(v, b));
3393
- p.unpairedTags.indexOf(T) !== -1 || y.push({ tagName: T, tagStartPos: E }), A = !0;
3394
- }
3395
- for (b++; b < v.length; b++)
3396
- if (v[b] === "<")
3397
- if (v[b + 1] === "!") {
3398
- b++, b = a(v, b);
3399
- continue;
3400
- } else if (v[b + 1] === "?") {
3401
- if (b = n(v, ++b), b.err) return b;
3402
- } else
3403
- break;
3404
- else if (v[b] === "&") {
3405
- const C = f(v, b);
3406
- if (C == -1)
3407
- return l("InvalidChar", "char '&' is not expected.", m(v, b));
3408
- b = C;
3409
- } else if (N === !0 && !t(v[b]))
3410
- return l("InvalidXml", "Extra text at the end", m(v, b));
3411
- v[b] === "<" && b--;
3412
- }
3413
- } else {
3414
- if (t(v[b]))
3415
- continue;
3416
- return l("InvalidChar", "char '" + v[b] + "' is not expected.", m(v, b));
3417
- }
3418
- if (A) {
3419
- if (y.length == 1)
3420
- return l("InvalidTag", "Unclosed tag '" + y[0].tagName + "'.", m(v, y[0].tagStartPos));
3421
- if (y.length > 0)
3422
- return l("InvalidXml", "Invalid '" + JSON.stringify(y.map((b) => b.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
3423
- } else return l("InvalidXml", "Start tag expected.", 1);
3424
- return !0;
3425
- };
3426
- function t(v) {
3427
- return v === " " || v === " " || v === `
3428
- ` || v === "\r";
3429
- }
3430
- function n(v, p) {
3431
- const y = p;
3432
- for (; p < v.length; p++)
3433
- if (v[p] == "?" || v[p] == " ") {
3434
- const A = v.substr(y, p - y);
3435
- if (p > 5 && A === "xml")
3436
- return l("InvalidXml", "XML declaration allowed only at the start of the document.", m(v, p));
3437
- if (v[p] == "?" && v[p + 1] == ">") {
3438
- p++;
3439
- break;
3440
- } else
3441
- continue;
3442
- }
3443
- return p;
3444
- }
3445
- function a(v, p) {
3446
- if (v.length > p + 5 && v[p + 1] === "-" && v[p + 2] === "-") {
3447
- for (p += 3; p < v.length; p++)
3448
- if (v[p] === "-" && v[p + 1] === "-" && v[p + 2] === ">") {
3449
- p += 2;
3450
- break;
3451
- }
3452
- } else if (v.length > p + 8 && v[p + 1] === "D" && v[p + 2] === "O" && v[p + 3] === "C" && v[p + 4] === "T" && v[p + 5] === "Y" && v[p + 6] === "P" && v[p + 7] === "E") {
3453
- let y = 1;
3454
- for (p += 8; p < v.length; p++)
3455
- if (v[p] === "<")
3456
- y++;
3457
- else if (v[p] === ">" && (y--, y === 0))
3458
- break;
3459
- } else if (v.length > p + 9 && v[p + 1] === "[" && v[p + 2] === "C" && v[p + 3] === "D" && v[p + 4] === "A" && v[p + 5] === "T" && v[p + 6] === "A" && v[p + 7] === "[") {
3460
- for (p += 8; p < v.length; p++)
3461
- if (v[p] === "]" && v[p + 1] === "]" && v[p + 2] === ">") {
3462
- p += 2;
3463
- break;
3464
- }
3465
- }
3466
- return p;
3467
- }
3468
- const u = '"', c = "'";
3469
- function i(v, p) {
3470
- let y = "", A = "", N = !1;
3471
- for (; p < v.length; p++) {
3472
- if (v[p] === u || v[p] === c)
3473
- A === "" ? A = v[p] : A !== v[p] || (A = "");
3474
- else if (v[p] === ">" && A === "") {
3475
- N = !0;
3476
- break;
3477
- }
3478
- y += v[p];
3479
- }
3480
- return A !== "" ? !1 : {
3481
- value: y,
3482
- index: p,
3483
- tagClosed: N
3484
- };
3485
- }
3486
- const h = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
3487
- function o(v, p) {
3488
- const y = r.getAllMatches(v, h), A = {};
3489
- for (let N = 0; N < y.length; N++) {
3490
- if (y[N][1].length === 0)
3491
- return l("InvalidAttr", "Attribute '" + y[N][2] + "' has no space in starting.", w(y[N]));
3492
- if (y[N][3] !== void 0 && y[N][4] === void 0)
3493
- return l("InvalidAttr", "Attribute '" + y[N][2] + "' is without value.", w(y[N]));
3494
- if (y[N][3] === void 0 && !p.allowBooleanAttributes)
3495
- return l("InvalidAttr", "boolean attribute '" + y[N][2] + "' is not allowed.", w(y[N]));
3496
- const b = y[N][2];
3497
- if (!g(b))
3498
- return l("InvalidAttr", "Attribute '" + b + "' is an invalid name.", w(y[N]));
3499
- if (!A.hasOwnProperty(b))
3500
- A[b] = 1;
3501
- else
3502
- return l("InvalidAttr", "Attribute '" + b + "' is repeated.", w(y[N]));
3503
- }
3504
- return !0;
3505
- }
3506
- function s(v, p) {
3507
- let y = /\d/;
3508
- for (v[p] === "x" && (p++, y = /[\da-fA-F]/); p < v.length; p++) {
3509
- if (v[p] === ";")
3510
- return p;
3511
- if (!v[p].match(y))
3512
- break;
3513
- }
3514
- return -1;
3515
- }
3516
- function f(v, p) {
3517
- if (p++, v[p] === ";")
3518
- return -1;
3519
- if (v[p] === "#")
3520
- return p++, s(v, p);
3521
- let y = 0;
3522
- for (; p < v.length; p++, y++)
3523
- if (!(v[p].match(/\w/) && y < 20)) {
3524
- if (v[p] === ";")
3525
- break;
3526
- return -1;
3527
- }
3528
- return p;
3529
- }
3530
- function l(v, p, y) {
3531
- return {
3532
- err: {
3533
- code: v,
3534
- msg: p,
3535
- line: y.line || y,
3536
- col: y.col
3537
- }
3538
- };
3539
- }
3540
- function g(v) {
3541
- return r.isName(v);
3542
- }
3543
- function d(v) {
3544
- return r.isName(v);
3545
- }
3546
- function m(v, p) {
3547
- const y = v.substring(0, p).split(/\r?\n/);
3548
- return {
3549
- line: y.length,
3550
- // column number is last line's length + 1, because column numbering starts at 1:
3551
- col: y[y.length - 1].length + 1
3552
- };
3553
- }
3554
- function w(v) {
3555
- return v.startIndex + v[1].length;
3556
- }
3557
- return Ve;
3558
- }
3559
- var xe = {}, Mt;
3560
- function gs() {
3561
- if (Mt) return xe;
3562
- Mt = 1;
3563
- const r = {
3564
- preserveOrder: !1,
3565
- attributeNamePrefix: "@_",
3566
- attributesGroupName: !1,
3567
- textNodeName: "#text",
3568
- ignoreAttributes: !0,
3569
- removeNSPrefix: !1,
3570
- // remove NS from tag name or attribute name if true
3571
- allowBooleanAttributes: !1,
3572
- //a tag can have attributes without any value
3573
- //ignoreRootElement : false,
3574
- parseTagValue: !0,
3575
- parseAttributeValue: !1,
3576
- trimValues: !0,
3577
- //Trim string values of tag and attributes
3578
- cdataPropName: !1,
3579
- numberParseOptions: {
3580
- hex: !0,
3581
- leadingZeros: !0,
3582
- eNotation: !0
3583
- },
3584
- tagValueProcessor: function(t, n) {
3585
- return n;
3586
- },
3587
- attributeValueProcessor: function(t, n) {
3588
- return n;
3589
- },
3590
- stopNodes: [],
3591
- //nested tags will not be parsed even for errors
3592
- alwaysCreateTextNode: !1,
3593
- isArray: () => !1,
3594
- commentPropName: !1,
3595
- unpairedTags: [],
3596
- processEntities: !0,
3597
- htmlEntities: !1,
3598
- ignoreDeclaration: !1,
3599
- ignorePiTags: !1,
3600
- transformTagName: !1,
3601
- transformAttributeName: !1,
3602
- updateTag: function(t, n, a) {
3603
- return t;
3604
- }
3605
- // skipEmptyListItem: false
3606
- }, e = function(t) {
3607
- return Object.assign({}, r, t);
3608
- };
3609
- return xe.buildOptions = e, xe.defaultOptions = r, xe;
3610
- }
3611
- var qe, Vt;
3612
- function ds() {
3613
- if (Vt) return qe;
3614
- Vt = 1;
3615
- class r {
3616
- constructor(t) {
3617
- this.tagname = t, this.child = [], this[":@"] = {};
3618
- }
3619
- add(t, n) {
3620
- t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: n });
3621
- }
3622
- addChild(t) {
3623
- t.tagname === "__proto__" && (t.tagname = "#__proto__"), t[":@"] && Object.keys(t[":@"]).length > 0 ? this.child.push({ [t.tagname]: t.child, ":@": t[":@"] }) : this.child.push({ [t.tagname]: t.child });
3624
- }
3625
- }
3626
- return qe = r, qe;
3627
- }
3628
- var We, Bt;
3629
- function ms() {
3630
- if (Bt) return We;
3631
- Bt = 1;
3632
- const r = ft();
3633
- function e(o, s) {
3634
- const f = {};
3635
- if (o[s + 3] === "O" && o[s + 4] === "C" && o[s + 5] === "T" && o[s + 6] === "Y" && o[s + 7] === "P" && o[s + 8] === "E") {
3636
- s = s + 9;
3637
- let l = 1, g = !1, d = !1, m = "";
3638
- for (; s < o.length; s++)
3639
- if (o[s] === "<" && !d) {
3640
- if (g && a(o, s)) {
3641
- s += 7;
3642
- let w, v;
3643
- [w, v, s] = t(o, s + 1), v.indexOf("&") === -1 && (f[h(w)] = {
3644
- regx: RegExp(`&${w};`, "g"),
3645
- val: v
3646
- });
3647
- } else if (g && u(o, s)) s += 8;
3648
- else if (g && c(o, s)) s += 8;
3649
- else if (g && i(o, s)) s += 9;
3650
- else if (n) d = !0;
3651
- else throw new Error("Invalid DOCTYPE");
3652
- l++, m = "";
3653
- } else if (o[s] === ">") {
3654
- if (d ? o[s - 1] === "-" && o[s - 2] === "-" && (d = !1, l--) : l--, l === 0)
3655
- break;
3656
- } else o[s] === "[" ? g = !0 : m += o[s];
3657
- if (l !== 0)
3658
- throw new Error("Unclosed DOCTYPE");
3659
- } else
3660
- throw new Error("Invalid Tag instead of DOCTYPE");
3661
- return { entities: f, i: s };
3662
- }
3663
- function t(o, s) {
3664
- let f = "";
3665
- for (; s < o.length && o[s] !== "'" && o[s] !== '"'; s++)
3666
- f += o[s];
3667
- if (f = f.trim(), f.indexOf(" ") !== -1) throw new Error("External entites are not supported");
3668
- const l = o[s++];
3669
- let g = "";
3670
- for (; s < o.length && o[s] !== l; s++)
3671
- g += o[s];
3672
- return [f, g, s];
3673
- }
3674
- function n(o, s) {
3675
- return o[s + 1] === "!" && o[s + 2] === "-" && o[s + 3] === "-";
3676
- }
3677
- function a(o, s) {
3678
- return o[s + 1] === "!" && o[s + 2] === "E" && o[s + 3] === "N" && o[s + 4] === "T" && o[s + 5] === "I" && o[s + 6] === "T" && o[s + 7] === "Y";
3679
- }
3680
- function u(o, s) {
3681
- return o[s + 1] === "!" && o[s + 2] === "E" && o[s + 3] === "L" && o[s + 4] === "E" && o[s + 5] === "M" && o[s + 6] === "E" && o[s + 7] === "N" && o[s + 8] === "T";
3682
- }
3683
- function c(o, s) {
3684
- return o[s + 1] === "!" && o[s + 2] === "A" && o[s + 3] === "T" && o[s + 4] === "T" && o[s + 5] === "L" && o[s + 6] === "I" && o[s + 7] === "S" && o[s + 8] === "T";
3685
- }
3686
- function i(o, s) {
3687
- return o[s + 1] === "!" && o[s + 2] === "N" && o[s + 3] === "O" && o[s + 4] === "T" && o[s + 5] === "A" && o[s + 6] === "T" && o[s + 7] === "I" && o[s + 8] === "O" && o[s + 9] === "N";
3688
- }
3689
- function h(o) {
3690
- if (r.isName(o))
3691
- return o;
3692
- throw new Error(`Invalid entity name ${o}`);
3693
- }
3694
- return We = e, We;
3695
- }
3696
- var Xe, qt;
3697
- function bs() {
3698
- if (qt) return Xe;
3699
- qt = 1;
3700
- const r = /^[-+]?0x[a-fA-F0-9]+$/, e = /^([\-\+])?(0*)([0-9]*(\.[0-9]*)?)$/, t = {
3701
- hex: !0,
3702
- // oct: false,
3703
- leadingZeros: !0,
3704
- decimalPoint: ".",
3705
- eNotation: !0
3706
- //skipLike: /regex/
3707
- };
3708
- function n(c, i = {}) {
3709
- if (i = Object.assign({}, t, i), !c || typeof c != "string") return c;
3710
- let h = c.trim();
3711
- if (i.skipLike !== void 0 && i.skipLike.test(h)) return c;
3712
- if (c === "0") return 0;
3713
- if (i.hex && r.test(h))
3714
- return u(h, 16);
3715
- if (h.search(/[eE]/) !== -1) {
3716
- const o = h.match(/^([-\+])?(0*)([0-9]*(\.[0-9]*)?[eE][-\+]?[0-9]+)$/);
3717
- if (o) {
3718
- if (i.leadingZeros)
3719
- h = (o[1] || "") + o[3];
3720
- else if (!(o[2] === "0" && o[3][0] === ".")) return c;
3721
- return i.eNotation ? Number(h) : c;
3722
- } else
3723
- return c;
3724
- } else {
3725
- const o = e.exec(h);
3726
- if (o) {
3727
- const s = o[1], f = o[2];
3728
- let l = a(o[3]);
3729
- if (!i.leadingZeros && f.length > 0 && s && h[2] !== ".") return c;
3730
- if (!i.leadingZeros && f.length > 0 && !s && h[1] !== ".") return c;
3731
- if (i.leadingZeros && f === c) return 0;
3732
- {
3733
- const g = Number(h), d = "" + g;
3734
- return d.search(/[eE]/) !== -1 ? i.eNotation ? g : c : h.indexOf(".") !== -1 ? d === "0" && l === "" || d === l || s && d === "-" + l ? g : c : f ? l === d || s + l === d ? g : c : h === d || h === s + d ? g : c;
3735
- }
3736
- } else
3737
- return c;
3738
- }
3739
- }
3740
- function a(c) {
3741
- return c && c.indexOf(".") !== -1 && (c = c.replace(/0+$/, ""), c === "." ? c = "0" : c[0] === "." ? c = "0" + c : c[c.length - 1] === "." && (c = c.substr(0, c.length - 1))), c;
3742
- }
3743
- function u(c, i) {
3744
- if (parseInt) return parseInt(c, i);
3745
- if (Number.parseInt) return Number.parseInt(c, i);
3746
- if (window && window.parseInt) return window.parseInt(c, i);
3747
- throw new Error("parseInt, Number.parseInt, window.parseInt are not supported");
3748
- }
3749
- return Xe = n, Xe;
3750
- }
3751
- var Ge, Wt;
3752
- function vr() {
3753
- if (Wt) return Ge;
3754
- Wt = 1;
3755
- function r(e) {
3756
- return typeof e == "function" ? e : Array.isArray(e) ? (t) => {
3757
- for (const n of e)
3758
- if (typeof n == "string" && t === n || n instanceof RegExp && n.test(t))
3759
- return !0;
3760
- } : () => !1;
3761
- }
3762
- return Ge = r, Ge;
3763
- }
3764
- var ze, Xt;
3765
- function ys() {
3766
- if (Xt) return ze;
3767
- Xt = 1;
3768
- const r = ft(), e = ds(), t = ms(), n = bs(), a = vr();
3769
- class u {
3770
- constructor(b) {
3771
- this.options = b, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
3772
- apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
3773
- gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
3774
- lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
3775
- quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
3776
- }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
3777
- space: { regex: /&(nbsp|#160);/g, val: " " },
3778
- // "lt" : { regex: /&(lt|#60);/g, val: "<" },
3779
- // "gt" : { regex: /&(gt|#62);/g, val: ">" },
3780
- // "amp" : { regex: /&(amp|#38);/g, val: "&" },
3781
- // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
3782
- // "apos" : { regex: /&(apos|#39);/g, val: "'" },
3783
- cent: { regex: /&(cent|#162);/g, val: "¢" },
3784
- pound: { regex: /&(pound|#163);/g, val: "£" },
3785
- yen: { regex: /&(yen|#165);/g, val: "¥" },
3786
- euro: { regex: /&(euro|#8364);/g, val: "€" },
3787
- copyright: { regex: /&(copy|#169);/g, val: "©" },
3788
- reg: { regex: /&(reg|#174);/g, val: "®" },
3789
- inr: { regex: /&(inr|#8377);/g, val: "₹" },
3790
- num_dec: { regex: /&#([0-9]{1,7});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 10)) },
3791
- num_hex: { regex: /&#x([0-9a-fA-F]{1,6});/g, val: (E, x) => String.fromCharCode(Number.parseInt(x, 16)) }
3792
- }, this.addExternalEntities = c, this.parseXml = f, this.parseTextData = i, this.resolveNameSpace = h, this.buildAttributesMap = s, this.isItStopNode = m, this.replaceEntitiesValue = g, this.readStopNodeData = y, this.saveTextToParentTag = d, this.addChild = l, this.ignoreAttributesFn = a(this.options.ignoreAttributes);
3793
- }
3794
- }
3795
- function c(N) {
3796
- const b = Object.keys(N);
3797
- for (let E = 0; E < b.length; E++) {
3798
- const x = b[E];
3799
- this.lastEntities[x] = {
3800
- regex: new RegExp("&" + x + ";", "g"),
3801
- val: N[x]
3802
- };
3803
- }
3804
- }
3805
- function i(N, b, E, x, T, O, I) {
3806
- if (N !== void 0 && (this.options.trimValues && !x && (N = N.trim()), N.length > 0)) {
3807
- I || (N = this.replaceEntitiesValue(N));
3808
- const C = this.options.tagValueProcessor(b, N, E, T, O);
3809
- return C == null ? N : typeof C != typeof N || C !== N ? C : this.options.trimValues ? A(N, this.options.parseTagValue, this.options.numberParseOptions) : N.trim() === N ? A(N, this.options.parseTagValue, this.options.numberParseOptions) : N;
3810
- }
3811
- }
3812
- function h(N) {
3813
- if (this.options.removeNSPrefix) {
3814
- const b = N.split(":"), E = N.charAt(0) === "/" ? "/" : "";
3815
- if (b[0] === "xmlns")
3816
- return "";
3817
- b.length === 2 && (N = E + b[1]);
3818
- }
3819
- return N;
3820
- }
3821
- const o = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
3822
- function s(N, b, E) {
3823
- if (this.options.ignoreAttributes !== !0 && typeof N == "string") {
3824
- const x = r.getAllMatches(N, o), T = x.length, O = {};
3825
- for (let I = 0; I < T; I++) {
3826
- const C = this.resolveNameSpace(x[I][1]);
3827
- if (this.ignoreAttributesFn(C, b))
3828
- continue;
3829
- let P = x[I][4], F = this.options.attributeNamePrefix + C;
3830
- if (C.length)
3831
- if (this.options.transformAttributeName && (F = this.options.transformAttributeName(F)), F === "__proto__" && (F = "#__proto__"), P !== void 0) {
3832
- this.options.trimValues && (P = P.trim()), P = this.replaceEntitiesValue(P);
3833
- const S = this.options.attributeValueProcessor(C, P, b);
3834
- S == null ? O[F] = P : typeof S != typeof P || S !== P ? O[F] = S : O[F] = A(
3835
- P,
3836
- this.options.parseAttributeValue,
3837
- this.options.numberParseOptions
3838
- );
3839
- } else this.options.allowBooleanAttributes && (O[F] = !0);
3840
- }
3841
- if (!Object.keys(O).length)
3842
- return;
3843
- if (this.options.attributesGroupName) {
3844
- const I = {};
3845
- return I[this.options.attributesGroupName] = O, I;
3846
- }
3847
- return O;
3848
- }
3849
- }
3850
- const f = function(N) {
3851
- N = N.replace(/\r\n?/g, `
3852
- `);
3853
- const b = new e("!xml");
3854
- let E = b, x = "", T = "";
3855
- for (let O = 0; O < N.length; O++)
3856
- if (N[O] === "<")
3857
- if (N[O + 1] === "/") {
3858
- const C = v(N, ">", O, "Closing Tag is not closed.");
3859
- let P = N.substring(O + 2, C).trim();
3860
- if (this.options.removeNSPrefix) {
3861
- const j = P.indexOf(":");
3862
- j !== -1 && (P = P.substr(j + 1));
3863
- }
3864
- this.options.transformTagName && (P = this.options.transformTagName(P)), E && (x = this.saveTextToParentTag(x, E, T));
3865
- const F = T.substring(T.lastIndexOf(".") + 1);
3866
- if (P && this.options.unpairedTags.indexOf(P) !== -1)
3867
- throw new Error(`Unpaired tag can not be used as closing tag: </${P}>`);
3868
- let S = 0;
3869
- F && this.options.unpairedTags.indexOf(F) !== -1 ? (S = T.lastIndexOf(".", T.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : S = T.lastIndexOf("."), T = T.substring(0, S), E = this.tagsNodeStack.pop(), x = "", O = C;
3870
- } else if (N[O + 1] === "?") {
3871
- let C = p(N, O, !1, "?>");
3872
- if (!C) throw new Error("Pi Tag is not closed.");
3873
- if (x = this.saveTextToParentTag(x, E, T), !(this.options.ignoreDeclaration && C.tagName === "?xml" || this.options.ignorePiTags)) {
3874
- const P = new e(C.tagName);
3875
- P.add(this.options.textNodeName, ""), C.tagName !== C.tagExp && C.attrExpPresent && (P[":@"] = this.buildAttributesMap(C.tagExp, T, C.tagName)), this.addChild(E, P, T);
3876
- }
3877
- O = C.closeIndex + 1;
3878
- } else if (N.substr(O + 1, 3) === "!--") {
3879
- const C = v(N, "-->", O + 4, "Comment is not closed.");
3880
- if (this.options.commentPropName) {
3881
- const P = N.substring(O + 4, C - 2);
3882
- x = this.saveTextToParentTag(x, E, T), E.add(this.options.commentPropName, [{ [this.options.textNodeName]: P }]);
3883
- }
3884
- O = C;
3885
- } else if (N.substr(O + 1, 2) === "!D") {
3886
- const C = t(N, O);
3887
- this.docTypeEntities = C.entities, O = C.i;
3888
- } else if (N.substr(O + 1, 2) === "![") {
3889
- const C = v(N, "]]>", O, "CDATA is not closed.") - 2, P = N.substring(O + 9, C);
3890
- x = this.saveTextToParentTag(x, E, T);
3891
- let F = this.parseTextData(P, E.tagname, T, !0, !1, !0, !0);
3892
- F == null && (F = ""), this.options.cdataPropName ? E.add(this.options.cdataPropName, [{ [this.options.textNodeName]: P }]) : E.add(this.options.textNodeName, F), O = C + 2;
3893
- } else {
3894
- let C = p(N, O, this.options.removeNSPrefix), P = C.tagName;
3895
- const F = C.rawTagName;
3896
- let S = C.tagExp, j = C.attrExpPresent, V = C.closeIndex;
3897
- this.options.transformTagName && (P = this.options.transformTagName(P)), E && x && E.tagname !== "!xml" && (x = this.saveTextToParentTag(x, E, T, !1));
3898
- const _ = E;
3899
- if (_ && this.options.unpairedTags.indexOf(_.tagname) !== -1 && (E = this.tagsNodeStack.pop(), T = T.substring(0, T.lastIndexOf("."))), P !== b.tagname && (T += T ? "." + P : P), this.isItStopNode(this.options.stopNodes, T, P)) {
3900
- let $ = "";
3901
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1)
3902
- P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), T = T.substr(0, T.length - 1), S = P) : S = S.substr(0, S.length - 1), O = C.closeIndex;
3903
- else if (this.options.unpairedTags.indexOf(P) !== -1)
3904
- O = C.closeIndex;
3905
- else {
3906
- const L = this.readStopNodeData(N, F, V + 1);
3907
- if (!L) throw new Error(`Unexpected end of ${F}`);
3908
- O = L.i, $ = L.tagContent;
3909
- }
3910
- const z = new e(P);
3911
- P !== S && j && (z[":@"] = this.buildAttributesMap(S, T, P)), $ && ($ = this.parseTextData($, P, T, !0, j, !0, !0)), T = T.substr(0, T.lastIndexOf(".")), z.add(this.options.textNodeName, $), this.addChild(E, z, T);
3912
- } else {
3913
- if (S.length > 0 && S.lastIndexOf("/") === S.length - 1) {
3914
- P[P.length - 1] === "/" ? (P = P.substr(0, P.length - 1), T = T.substr(0, T.length - 1), S = P) : S = S.substr(0, S.length - 1), this.options.transformTagName && (P = this.options.transformTagName(P));
3915
- const $ = new e(P);
3916
- P !== S && j && ($[":@"] = this.buildAttributesMap(S, T, P)), this.addChild(E, $, T), T = T.substr(0, T.lastIndexOf("."));
3917
- } else {
3918
- const $ = new e(P);
3919
- this.tagsNodeStack.push(E), P !== S && j && ($[":@"] = this.buildAttributesMap(S, T, P)), this.addChild(E, $, T), E = $;
3920
- }
3921
- x = "", O = V;
3922
- }
3923
- }
3924
- else
3925
- x += N[O];
3926
- return b.child;
3927
- };
3928
- function l(N, b, E) {
3929
- const x = this.options.updateTag(b.tagname, E, b[":@"]);
3930
- x === !1 || (typeof x == "string" && (b.tagname = x), N.addChild(b));
3931
- }
3932
- const g = function(N) {
3933
- if (this.options.processEntities) {
3934
- for (let b in this.docTypeEntities) {
3935
- const E = this.docTypeEntities[b];
3936
- N = N.replace(E.regx, E.val);
3937
- }
3938
- for (let b in this.lastEntities) {
3939
- const E = this.lastEntities[b];
3940
- N = N.replace(E.regex, E.val);
3941
- }
3942
- if (this.options.htmlEntities)
3943
- for (let b in this.htmlEntities) {
3944
- const E = this.htmlEntities[b];
3945
- N = N.replace(E.regex, E.val);
3946
- }
3947
- N = N.replace(this.ampEntity.regex, this.ampEntity.val);
3948
- }
3949
- return N;
3950
- };
3951
- function d(N, b, E, x) {
3952
- return N && (x === void 0 && (x = b.child.length === 0), N = this.parseTextData(
3953
- N,
3954
- b.tagname,
3955
- E,
3956
- !1,
3957
- b[":@"] ? Object.keys(b[":@"]).length !== 0 : !1,
3958
- x
3959
- ), N !== void 0 && N !== "" && b.add(this.options.textNodeName, N), N = ""), N;
3960
- }
3961
- function m(N, b, E) {
3962
- const x = "*." + E;
3963
- for (const T in N) {
3964
- const O = N[T];
3965
- if (x === O || b === O) return !0;
3966
- }
3967
- return !1;
3968
- }
3969
- function w(N, b, E = ">") {
3970
- let x, T = "";
3971
- for (let O = b; O < N.length; O++) {
3972
- let I = N[O];
3973
- if (x)
3974
- I === x && (x = "");
3975
- else if (I === '"' || I === "'")
3976
- x = I;
3977
- else if (I === E[0])
3978
- if (E[1]) {
3979
- if (N[O + 1] === E[1])
3980
- return {
3981
- data: T,
3982
- index: O
3983
- };
3984
- } else
3985
- return {
3986
- data: T,
3987
- index: O
3988
- };
3989
- else I === " " && (I = " ");
3990
- T += I;
3991
- }
3992
- }
3993
- function v(N, b, E, x) {
3994
- const T = N.indexOf(b, E);
3995
- if (T === -1)
3996
- throw new Error(x);
3997
- return T + b.length - 1;
3998
- }
3999
- function p(N, b, E, x = ">") {
4000
- const T = w(N, b + 1, x);
4001
- if (!T) return;
4002
- let O = T.data;
4003
- const I = T.index, C = O.search(/\s/);
4004
- let P = O, F = !0;
4005
- C !== -1 && (P = O.substring(0, C), O = O.substring(C + 1).trimStart());
4006
- const S = P;
4007
- if (E) {
4008
- const j = P.indexOf(":");
4009
- j !== -1 && (P = P.substr(j + 1), F = P !== T.data.substr(j + 1));
4010
- }
4011
- return {
4012
- tagName: P,
4013
- tagExp: O,
4014
- closeIndex: I,
4015
- attrExpPresent: F,
4016
- rawTagName: S
4017
- };
4018
- }
4019
- function y(N, b, E) {
4020
- const x = E;
4021
- let T = 1;
4022
- for (; E < N.length; E++)
4023
- if (N[E] === "<")
4024
- if (N[E + 1] === "/") {
4025
- const O = v(N, ">", E, `${b} is not closed`);
4026
- if (N.substring(E + 2, O).trim() === b && (T--, T === 0))
4027
- return {
4028
- tagContent: N.substring(x, E),
4029
- i: O
4030
- };
4031
- E = O;
4032
- } else if (N[E + 1] === "?")
4033
- E = v(N, "?>", E + 1, "StopNode is not closed.");
4034
- else if (N.substr(E + 1, 3) === "!--")
4035
- E = v(N, "-->", E + 3, "StopNode is not closed.");
4036
- else if (N.substr(E + 1, 2) === "![")
4037
- E = v(N, "]]>", E, "StopNode is not closed.") - 2;
4038
- else {
4039
- const O = p(N, E, ">");
4040
- O && ((O && O.tagName) === b && O.tagExp[O.tagExp.length - 1] !== "/" && T++, E = O.closeIndex);
4041
- }
4042
- }
4043
- function A(N, b, E) {
4044
- if (b && typeof N == "string") {
4045
- const x = N.trim();
4046
- return x === "true" ? !0 : x === "false" ? !1 : n(N, E);
4047
- } else
4048
- return r.isExist(N) ? N : "";
4049
- }
4050
- return ze = u, ze;
4051
- }
4052
- var He = {}, Gt;
4053
- function vs() {
4054
- if (Gt) return He;
4055
- Gt = 1;
4056
- function r(u, c) {
4057
- return e(u, c);
4058
- }
4059
- function e(u, c, i) {
4060
- let h;
4061
- const o = {};
4062
- for (let s = 0; s < u.length; s++) {
4063
- const f = u[s], l = t(f);
4064
- let g = "";
4065
- if (i === void 0 ? g = l : g = i + "." + l, l === c.textNodeName)
4066
- h === void 0 ? h = f[l] : h += "" + f[l];
4067
- else {
4068
- if (l === void 0)
4069
- continue;
4070
- if (f[l]) {
4071
- let d = e(f[l], c, g);
4072
- const m = a(d, c);
4073
- f[":@"] ? n(d, f[":@"], g, c) : Object.keys(d).length === 1 && d[c.textNodeName] !== void 0 && !c.alwaysCreateTextNode ? d = d[c.textNodeName] : Object.keys(d).length === 0 && (c.alwaysCreateTextNode ? d[c.textNodeName] = "" : d = ""), o[l] !== void 0 && o.hasOwnProperty(l) ? (Array.isArray(o[l]) || (o[l] = [o[l]]), o[l].push(d)) : c.isArray(l, g, m) ? o[l] = [d] : o[l] = d;
4074
- }
4075
- }
4076
- }
4077
- return typeof h == "string" ? h.length > 0 && (o[c.textNodeName] = h) : h !== void 0 && (o[c.textNodeName] = h), o;
4078
- }
4079
- function t(u) {
4080
- const c = Object.keys(u);
4081
- for (let i = 0; i < c.length; i++) {
4082
- const h = c[i];
4083
- if (h !== ":@") return h;
4084
- }
4085
- }
4086
- function n(u, c, i, h) {
4087
- if (c) {
4088
- const o = Object.keys(c), s = o.length;
4089
- for (let f = 0; f < s; f++) {
4090
- const l = o[f];
4091
- h.isArray(l, i + "." + l, !0, !0) ? u[l] = [c[l]] : u[l] = c[l];
4092
- }
4093
- }
4094
- }
4095
- function a(u, c) {
4096
- const { textNodeName: i } = c, h = Object.keys(u).length;
4097
- return !!(h === 0 || h === 1 && (u[i] || typeof u[i] == "boolean" || u[i] === 0));
4098
- }
4099
- return He.prettify = r, He;
4100
- }
4101
- var Ze, zt;
4102
- function ws() {
4103
- if (zt) return Ze;
4104
- zt = 1;
4105
- const { buildOptions: r } = gs(), e = ys(), { prettify: t } = vs(), n = yr();
4106
- class a {
4107
- constructor(c) {
4108
- this.externalEntities = {}, this.options = r(c);
4109
- }
4110
- /**
4111
- * Parse XML dats to JS object
4112
- * @param {string|Buffer} xmlData
4113
- * @param {boolean|Object} validationOption
4114
- */
4115
- parse(c, i) {
4116
- if (typeof c != "string") if (c.toString)
4117
- c = c.toString();
4118
- else
4119
- throw new Error("XML data is accepted in String or Bytes[] form.");
4120
- if (i) {
4121
- i === !0 && (i = {});
4122
- const s = n.validate(c, i);
4123
- if (s !== !0)
4124
- throw Error(`${s.err.msg}:${s.err.line}:${s.err.col}`);
4125
- }
4126
- const h = new e(this.options);
4127
- h.addExternalEntities(this.externalEntities);
4128
- const o = h.parseXml(c);
4129
- return this.options.preserveOrder || o === void 0 ? o : t(o, this.options);
4130
- }
4131
- /**
4132
- * Add Entity which is not by default supported by this library
4133
- * @param {string} key
4134
- * @param {string} value
4135
- */
4136
- addEntity(c, i) {
4137
- if (i.indexOf("&") !== -1)
4138
- throw new Error("Entity value can't have '&'");
4139
- if (c.indexOf("&") !== -1 || c.indexOf(";") !== -1)
4140
- throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
4141
- if (i === "&")
4142
- throw new Error("An entity with value '&' is not permitted");
4143
- this.externalEntities[c] = i;
4144
- }
4145
- }
4146
- return Ze = a, Ze;
4147
- }
4148
- var Je, Ht;
4149
- function Ns() {
4150
- if (Ht) return Je;
4151
- Ht = 1;
4152
- const r = `
4153
- `;
4154
- function e(i, h) {
4155
- let o = "";
4156
- return h.format && h.indentBy.length > 0 && (o = r), t(i, h, "", o);
4157
- }
4158
- function t(i, h, o, s) {
4159
- let f = "", l = !1;
4160
- for (let g = 0; g < i.length; g++) {
4161
- const d = i[g], m = n(d);
4162
- if (m === void 0) continue;
4163
- let w = "";
4164
- if (o.length === 0 ? w = m : w = `${o}.${m}`, m === h.textNodeName) {
4165
- let N = d[m];
4166
- u(w, h) || (N = h.tagValueProcessor(m, N), N = c(N, h)), l && (f += s), f += N, l = !1;
4167
- continue;
4168
- } else if (m === h.cdataPropName) {
4169
- l && (f += s), f += `<![CDATA[${d[m][0][h.textNodeName]}]]>`, l = !1;
4170
- continue;
4171
- } else if (m === h.commentPropName) {
4172
- f += s + `<!--${d[m][0][h.textNodeName]}-->`, l = !0;
4173
- continue;
4174
- } else if (m[0] === "?") {
4175
- const N = a(d[":@"], h), b = m === "?xml" ? "" : s;
4176
- let E = d[m][0][h.textNodeName];
4177
- E = E.length !== 0 ? " " + E : "", f += b + `<${m}${E}${N}?>`, l = !0;
4178
- continue;
4179
- }
4180
- let v = s;
4181
- v !== "" && (v += h.indentBy);
4182
- const p = a(d[":@"], h), y = s + `<${m}${p}`, A = t(d[m], h, w, v);
4183
- h.unpairedTags.indexOf(m) !== -1 ? h.suppressUnpairedNode ? f += y + ">" : f += y + "/>" : (!A || A.length === 0) && h.suppressEmptyNode ? f += y + "/>" : A && A.endsWith(">") ? f += y + `>${A}${s}</${m}>` : (f += y + ">", A && s !== "" && (A.includes("/>") || A.includes("</")) ? f += s + h.indentBy + A + s : f += A, f += `</${m}>`), l = !0;
4184
- }
4185
- return f;
4186
- }
4187
- function n(i) {
4188
- const h = Object.keys(i);
4189
- for (let o = 0; o < h.length; o++) {
4190
- const s = h[o];
4191
- if (i.hasOwnProperty(s) && s !== ":@")
4192
- return s;
4193
- }
4194
- }
4195
- function a(i, h) {
4196
- let o = "";
4197
- if (i && !h.ignoreAttributes)
4198
- for (let s in i) {
4199
- if (!i.hasOwnProperty(s)) continue;
4200
- let f = h.attributeValueProcessor(s, i[s]);
4201
- f = c(f, h), f === !0 && h.suppressBooleanAttributes ? o += ` ${s.substr(h.attributeNamePrefix.length)}` : o += ` ${s.substr(h.attributeNamePrefix.length)}="${f}"`;
4202
- }
4203
- return o;
4204
- }
4205
- function u(i, h) {
4206
- i = i.substr(0, i.length - h.textNodeName.length - 1);
4207
- let o = i.substr(i.lastIndexOf(".") + 1);
4208
- for (let s in h.stopNodes)
4209
- if (h.stopNodes[s] === i || h.stopNodes[s] === "*." + o) return !0;
4210
- return !1;
4211
- }
4212
- function c(i, h) {
4213
- if (i && i.length > 0 && h.processEntities)
4214
- for (let o = 0; o < h.entities.length; o++) {
4215
- const s = h.entities[o];
4216
- i = i.replace(s.regex, s.val);
4217
- }
4218
- return i;
4219
- }
4220
- return Je = e, Je;
4221
- }
4222
- var Ye, Zt;
4223
- function xs() {
4224
- if (Zt) return Ye;
4225
- Zt = 1;
4226
- const r = Ns(), e = vr(), t = {
4227
- attributeNamePrefix: "@_",
4228
- attributesGroupName: !1,
4229
- textNodeName: "#text",
4230
- ignoreAttributes: !0,
4231
- cdataPropName: !1,
4232
- format: !1,
4233
- indentBy: " ",
4234
- suppressEmptyNode: !1,
4235
- suppressUnpairedNode: !0,
4236
- suppressBooleanAttributes: !0,
4237
- tagValueProcessor: function(i, h) {
4238
- return h;
4239
- },
4240
- attributeValueProcessor: function(i, h) {
4241
- return h;
4242
- },
4243
- preserveOrder: !1,
4244
- commentPropName: !1,
4245
- unpairedTags: [],
4246
- entities: [
4247
- { regex: new RegExp("&", "g"), val: "&amp;" },
4248
- //it must be on top
4249
- { regex: new RegExp(">", "g"), val: "&gt;" },
4250
- { regex: new RegExp("<", "g"), val: "&lt;" },
4251
- { regex: new RegExp("'", "g"), val: "&apos;" },
4252
- { regex: new RegExp('"', "g"), val: "&quot;" }
4253
- ],
4254
- processEntities: !0,
4255
- stopNodes: [],
4256
- // transformTagName: false,
4257
- // transformAttributeName: false,
4258
- oneListGroup: !1
4259
- };
4260
- function n(i) {
4261
- this.options = Object.assign({}, t, i), this.options.ignoreAttributes === !0 || this.options.attributesGroupName ? this.isAttribute = function() {
4262
- return !1;
4263
- } : (this.ignoreAttributesFn = e(this.options.ignoreAttributes), this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = c), this.processTextOrObjNode = a, this.options.format ? (this.indentate = u, this.tagEndChar = `>
4264
- `, this.newLine = `
4265
- `) : (this.indentate = function() {
4266
- return "";
4267
- }, this.tagEndChar = ">", this.newLine = "");
4268
- }
4269
- n.prototype.build = function(i) {
4270
- return this.options.preserveOrder ? r(i, this.options) : (Array.isArray(i) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (i = {
4271
- [this.options.arrayNodeName]: i
4272
- }), this.j2x(i, 0, []).val);
4273
- }, n.prototype.j2x = function(i, h, o) {
4274
- let s = "", f = "";
4275
- const l = o.join(".");
4276
- for (let g in i)
4277
- if (Object.prototype.hasOwnProperty.call(i, g))
4278
- if (typeof i[g] > "u")
4279
- this.isAttribute(g) && (f += "");
4280
- else if (i[g] === null)
4281
- this.isAttribute(g) || g === this.options.cdataPropName ? f += "" : g[0] === "?" ? f += this.indentate(h) + "<" + g + "?" + this.tagEndChar : f += this.indentate(h) + "<" + g + "/" + this.tagEndChar;
4282
- else if (i[g] instanceof Date)
4283
- f += this.buildTextValNode(i[g], g, "", h);
4284
- else if (typeof i[g] != "object") {
4285
- const d = this.isAttribute(g);
4286
- if (d && !this.ignoreAttributesFn(d, l))
4287
- s += this.buildAttrPairStr(d, "" + i[g]);
4288
- else if (!d)
4289
- if (g === this.options.textNodeName) {
4290
- let m = this.options.tagValueProcessor(g, "" + i[g]);
4291
- f += this.replaceEntitiesValue(m);
4292
- } else
4293
- f += this.buildTextValNode(i[g], g, "", h);
4294
- } else if (Array.isArray(i[g])) {
4295
- const d = i[g].length;
4296
- let m = "", w = "";
4297
- for (let v = 0; v < d; v++) {
4298
- const p = i[g][v];
4299
- if (!(typeof p > "u")) if (p === null)
4300
- g[0] === "?" ? f += this.indentate(h) + "<" + g + "?" + this.tagEndChar : f += this.indentate(h) + "<" + g + "/" + this.tagEndChar;
4301
- else if (typeof p == "object")
4302
- if (this.options.oneListGroup) {
4303
- const y = this.j2x(p, h + 1, o.concat(g));
4304
- m += y.val, this.options.attributesGroupName && p.hasOwnProperty(this.options.attributesGroupName) && (w += y.attrStr);
4305
- } else
4306
- m += this.processTextOrObjNode(p, g, h, o);
4307
- else if (this.options.oneListGroup) {
4308
- let y = this.options.tagValueProcessor(g, p);
4309
- y = this.replaceEntitiesValue(y), m += y;
4310
- } else
4311
- m += this.buildTextValNode(p, g, "", h);
4312
- }
4313
- this.options.oneListGroup && (m = this.buildObjectNode(m, g, w, h)), f += m;
4314
- } else if (this.options.attributesGroupName && g === this.options.attributesGroupName) {
4315
- const d = Object.keys(i[g]), m = d.length;
4316
- for (let w = 0; w < m; w++)
4317
- s += this.buildAttrPairStr(d[w], "" + i[g][d[w]]);
4318
- } else
4319
- f += this.processTextOrObjNode(i[g], g, h, o);
4320
- return { attrStr: s, val: f };
4321
- }, n.prototype.buildAttrPairStr = function(i, h) {
4322
- return h = this.options.attributeValueProcessor(i, "" + h), h = this.replaceEntitiesValue(h), this.options.suppressBooleanAttributes && h === "true" ? " " + i : " " + i + '="' + h + '"';
4323
- };
4324
- function a(i, h, o, s) {
4325
- const f = this.j2x(i, o + 1, s.concat(h));
4326
- return i[this.options.textNodeName] !== void 0 && Object.keys(i).length === 1 ? this.buildTextValNode(i[this.options.textNodeName], h, f.attrStr, o) : this.buildObjectNode(f.val, h, f.attrStr, o);
4327
- }
4328
- n.prototype.buildObjectNode = function(i, h, o, s) {
4329
- if (i === "")
4330
- return h[0] === "?" ? this.indentate(s) + "<" + h + o + "?" + this.tagEndChar : this.indentate(s) + "<" + h + o + this.closeTag(h) + this.tagEndChar;
4331
- {
4332
- let f = "</" + h + this.tagEndChar, l = "";
4333
- return h[0] === "?" && (l = "?", f = ""), (o || o === "") && i.indexOf("<") === -1 ? this.indentate(s) + "<" + h + o + l + ">" + i + f : this.options.commentPropName !== !1 && h === this.options.commentPropName && l.length === 0 ? this.indentate(s) + `<!--${i}-->` + this.newLine : this.indentate(s) + "<" + h + o + l + this.tagEndChar + i + this.indentate(s) + f;
4334
- }
4335
- }, n.prototype.closeTag = function(i) {
4336
- let h = "";
4337
- return this.options.unpairedTags.indexOf(i) !== -1 ? this.options.suppressUnpairedNode || (h = "/") : this.options.suppressEmptyNode ? h = "/" : h = `></${i}`, h;
4338
- }, n.prototype.buildTextValNode = function(i, h, o, s) {
4339
- if (this.options.cdataPropName !== !1 && h === this.options.cdataPropName)
4340
- return this.indentate(s) + `<![CDATA[${i}]]>` + this.newLine;
4341
- if (this.options.commentPropName !== !1 && h === this.options.commentPropName)
4342
- return this.indentate(s) + `<!--${i}-->` + this.newLine;
4343
- if (h[0] === "?")
4344
- return this.indentate(s) + "<" + h + o + "?" + this.tagEndChar;
4345
- {
4346
- let f = this.options.tagValueProcessor(h, i);
4347
- return f = this.replaceEntitiesValue(f), f === "" ? this.indentate(s) + "<" + h + o + this.closeTag(h) + this.tagEndChar : this.indentate(s) + "<" + h + o + ">" + f + "</" + h + this.tagEndChar;
4348
- }
4349
- }, n.prototype.replaceEntitiesValue = function(i) {
4350
- if (i && i.length > 0 && this.options.processEntities)
4351
- for (let h = 0; h < this.options.entities.length; h++) {
4352
- const o = this.options.entities[h];
4353
- i = i.replace(o.regex, o.val);
4354
- }
4355
- return i;
4356
- };
4357
- function u(i) {
4358
- return this.options.indentBy.repeat(i);
4359
- }
4360
- function c(i) {
4361
- return i.startsWith(this.options.attributeNamePrefix) && i !== this.options.textNodeName ? i.substr(this.attrPrefixLen) : !1;
4362
- }
4363
- return Ye = n, Ye;
4364
- }
4365
- var Ke, Jt;
4366
- function Ps() {
4367
- if (Jt) return Ke;
4368
- Jt = 1;
4369
- const r = yr(), e = ws(), t = xs();
4370
- return Ke = {
4371
- XMLParser: e,
4372
- XMLValidator: r,
4373
- XMLBuilder: t
4374
- }, Ke;
4375
- }
4376
- var pt = Ps();
4377
- const nt = (r, e) => Object.fromEntries(
4378
- Object.entries(r).map(([t, n]) => e.includes(t) ? [t, n || ""] : [me.DavNamespace.includes(t) ? `d:${t}` : `oc:${t}`, n || ""])
4379
- ), Yt = (r = [], {
4380
- pattern: e,
4381
- filterRules: t,
4382
- limit: n = 0,
4383
- extraProps: a = []
4384
- }) => {
4385
- let u = "d:propfind";
4386
- e && (u = "oc:search-files"), t && (u = "oc:filter-files");
4387
- const c = r.reduce((s, f) => Object.assign(s, { [f]: null }), {}), i = nt(c, a), h = {
4388
- [u]: {
4389
- "d:prop": i,
4390
- "@@xmlns:d": "DAV:",
4391
- "@@xmlns:oc": "http://owncloud.org/ns",
4392
- ...e && {
4393
- "oc:search": { "oc:pattern": e, "oc:limit": n }
4394
- },
4395
- ...t && {
4396
- "oc:filter-rules": nt(t, [])
4397
- }
4398
- }
4399
- };
4400
- return new pt.XMLBuilder({
4401
- format: !0,
4402
- ignoreAttributes: !1,
4403
- attributeNamePrefix: "@@",
4404
- suppressEmptyNode: !0
4405
- }).build(h);
4406
- }, Es = (r) => {
4407
- const e = {
4408
- "d:propertyupdate": {
4409
- "d:set": { "d:prop": nt(r, []) },
4410
- "@@xmlns:d": "DAV:",
4411
- "@@xmlns:oc": "http://owncloud.org/ns"
4412
- }
4413
- };
4414
- return new pt.XMLBuilder({
4415
- format: !0,
4416
- ignoreAttributes: !1,
4417
- attributeNamePrefix: "@@",
4418
- suppressEmptyNode: !0
4419
- }).build(e);
4420
- }, As = (r) => {
4421
- const e = {}, t = r.get("tus-version");
4422
- return t ? (e.version = t.split(","), r.get("tus-extension") && (e.extension = r.get("tus-extension").split(",")), r.get("tus-resumable") && (e.resumable = r.get("tus-resumable")), r.get("tus-max-size") && (e.maxSize = parseInt(r.get("tus-max-size"), 10)), e) : null;
4423
- }, Ts = async (r) => {
4424
- const e = (n) => {
4425
- const a = decodeURIComponent(n);
4426
- return n?.startsWith("/remote.php/dav/") ? M(a.replace("/remote.php/dav/", ""), {
4427
- leadingSlash: !0,
4428
- trailingSlash: !1
4429
- }) : a;
4430
- };
4431
- return (await os(r)).multistatus.response.map(({ href: n, propstat: a }) => {
4432
- const u = {
4433
- ...as(a.prop, e(n), !0),
4434
- processing: a.status === "HTTP/1.1 425 TOO EARLY"
4435
- };
4436
- return u.props.name && (u.props.name = u.props.name.toString()), u;
4437
- });
4438
- }, Os = (r) => {
4439
- const e = new pt.XMLParser(), t = {
4440
- message: "Unknown error",
4441
- errorCode: void 0
4442
- };
4443
- try {
4444
- const n = e.parse(r);
4445
- if (!n["d:error"])
4446
- return t;
4447
- if (n["d:error"]["s:message"]) {
4448
- const a = n["d:error"]["s:message"];
4449
- typeof a == "string" && (t.message = a);
4450
- }
4451
- if (n["d:error"]["s:errorcode"]) {
4452
- const a = n["d:error"]["s:errorcode"];
4453
- typeof a == "string" && (t.errorCode = a);
4454
- }
4455
- } catch {
4456
- return t;
4457
- }
4458
- return t;
4459
- };
4460
- class Cs {
4461
- client;
4462
- davPath;
4463
- headers;
4464
- extraProps;
4465
- constructor({ baseUrl: e, headers: t }) {
4466
- this.davPath = M(e, "remote.php/dav"), this.client = is(this.davPath, {}), this.headers = t, this.extraProps = [];
4467
- }
4468
- mkcol(e, t = {}) {
4469
- return this.request(e, { method: se.mkcol, ...t });
4470
- }
4471
- async propfind(e, {
4472
- depth: t = 1,
4473
- properties: n = [],
4474
- headers: a = {},
4475
- ...u
4476
- } = {}) {
4477
- const c = { ...a, Depth: t.toString() }, { body: i, result: h } = await this.request(e, {
4478
- method: se.propfind,
4479
- data: Yt(n, { extraProps: this.extraProps }),
4480
- headers: c,
4481
- ...u
4482
- });
4483
- return i?.length && (i[0].tusSupport = As(h.headers)), i;
4484
- }
4485
- async report(e, {
4486
- pattern: t = "",
4487
- filterRules: n = null,
4488
- limit: a = 30,
4489
- properties: u,
4490
- ...c
4491
- } = {}) {
4492
- const { body: i, result: h } = await this.request(e, {
4493
- method: se.report,
4494
- data: Yt(u, {
4495
- pattern: t,
4496
- filterRules: n,
4497
- limit: a,
4498
- extraProps: this.extraProps
4499
- }),
4500
- ...c
4501
- });
4502
- return {
4503
- results: i,
4504
- range: h.headers.get("content-range")
4505
- };
4506
- }
4507
- copy(e, t, { overwrite: n = !1, headers: a = {}, ...u } = {}) {
4508
- const c = M(this.davPath, we(t));
4509
- return this.request(e, {
4510
- method: se.copy,
4511
- headers: { ...a, Destination: c, overwrite: n ? "T" : "F" },
4512
- ...u
4513
- });
4514
- }
4515
- move(e, t, { overwrite: n = !1, headers: a = {}, ...u } = {}) {
4516
- const c = M(this.davPath, we(t));
4517
- return this.request(e, {
4518
- method: se.move,
4519
- headers: { ...a, Destination: c, overwrite: n ? "T" : "F" },
4520
- ...u
4521
- });
4522
- }
4523
- put(e, t, {
4524
- headers: n = {},
4525
- onUploadProgress: a,
4526
- previousEntityTag: u,
4527
- overwrite: c,
4528
- ...i
4529
- } = {}) {
4530
- const h = { ...n };
4531
- return u ? h["If-Match"] = u : c || (h["If-None-Match"] = "*"), this.request(e, {
4532
- method: se.put,
4533
- data: t,
4534
- headers: h,
4535
- onUploadProgress: a,
4536
- ...i
4537
- });
4538
- }
4539
- delete(e, t = {}) {
4540
- return this.request(e, { method: se.delete, ...t });
4541
- }
4542
- propPatch(e, t, n = {}) {
4543
- const a = Es(t);
4544
- return this.request(e, { method: se.proppatch, data: a, ...n });
4545
- }
4546
- getFileUrl(e) {
4547
- return M(this.davPath, we(e));
4548
- }
4549
- buildHeaders(e = {}) {
4550
- return {
4551
- "Content-Type": "application/xml; charset=utf-8",
4552
- "X-Requested-With": "XMLHttpRequest",
4553
- "X-Request-ID": ps(),
4554
- ...this.headers && { ...this.headers() },
4555
- ...e
4556
- };
4557
- }
4558
- async request(e, t) {
4559
- const n = M(this.davPath, we(e), { leadingSlash: !0 }), a = {
4560
- ...t,
4561
- url: n,
4562
- headers: this.buildHeaders(t.headers || {})
4563
- };
4564
- try {
4565
- const u = await this.client.customRequest("", a);
4566
- let c;
4567
- if (u.status === 207) {
4568
- const i = await u.text();
4569
- c = await Ts(i);
4570
- }
4571
- return {
4572
- body: c,
4573
- status: u.status,
4574
- result: u
4575
- };
4576
- } catch (u) {
4577
- const { response: c } = u, i = await c.text(), h = Os(i);
4578
- throw new Ar(
4579
- h.message,
4580
- h.errorCode,
4581
- c,
4582
- c.status
4583
- );
4584
- }
4585
- }
4586
- }
4587
- const Is = (r, e) => ({
4588
- async listFileVersions(t, n = {}) {
4589
- const [a, ...u] = await r.propfind(
4590
- M("meta", t, "v", { leadingSlash: !0 }),
4591
- n
4592
- );
4593
- return u.map((c) => ue(c, r.extraProps));
4594
- }
4595
- }), Ss = (r, e) => ({
4596
- setFavorite(t, { path: n }, a, u = {}) {
4597
- const c = { [he.IsFavorite]: a ? "true" : "false" };
4598
- return r.propPatch(M(t.webDavPath, n), c, u);
4599
- }
4600
- }), Fs = (r, e) => ({
4601
- listFavoriteFiles({
4602
- davProperties: t = me.Default,
4603
- username: n = "",
4604
- ...a
4605
- } = {}) {
4606
- return r.report(M("files", n), {
4607
- properties: t,
4608
- filterRules: { favorite: 1 },
4609
- ...a
4610
- });
4611
- }
4612
- }), Us = (r, e) => {
4613
- const t = Nr.create();
4614
- e && t.interceptors.request.use((P) => (Object.assign(P.headers, e()), P));
4615
- const n = { axiosClient: t, baseUrl: r }, a = new Cs({ baseUrl: r, headers: e }), u = (P) => {
4616
- a.extraProps.push(P);
4617
- }, c = Vr(a), { getPathForFileId: i } = c, h = jr(a, c), { listFiles: o } = h, s = Ir(h), { getFileInfo: f } = s, { createFolder: l } = Or(a, s), g = Cr(a, n), { getFileContents: d } = g, { putFileContents: m } = Rr(a, s), { getFileUrl: w, revokeUrl: v } = Sr(
4618
- a,
4619
- g,
4620
- s,
4621
- n
4622
- ), { getPublicFileUrl: p } = Fr(a), { copyFiles: y } = Tr(a), { moveFiles: A } = $r(a), { deleteFile: N } = Lr(a), { restoreFile: b } = kr(a), { listFileVersions: E } = Is(a), { restoreFileVersion: x } = Ur(a), { clearTrashBin: T } = _r(a), { search: O } = Mr(a), { listFavoriteFiles: I } = Fs(a), { setFavorite: C } = Ss(a);
4623
- return {
4624
- copyFiles: y,
4625
- createFolder: l,
4626
- deleteFile: N,
4627
- restoreFile: b,
4628
- restoreFileVersion: x,
4629
- getFileContents: d,
4630
- getFileInfo: f,
4631
- getFileUrl: w,
4632
- getPublicFileUrl: p,
4633
- getPathForFileId: i,
4634
- listFiles: o,
4635
- listFileVersions: E,
4636
- moveFiles: A,
4637
- putFileContents: m,
4638
- revokeUrl: v,
4639
- clearTrashBin: T,
4640
- search: O,
4641
- listFavoriteFiles: I,
4642
- setFavorite: C,
4643
- registerExtraProp: u
4644
- };
4645
- };
4646
- export {
4647
- Ar as D,
4648
- Qt as H,
4649
- we as e,
4650
- Us as w
4651
- };