@nextcloud/files 3.0.1-beta.0 → 3.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,2189 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const _ = require("@nextcloud/auth"), K = require("@nextcloud/logger"), ge = require("@nextcloud/l10n"), b = require("path"), we = require("@nextcloud/paths"), me = require("@nextcloud/router"), W = require("webdav");
4
+ /**
5
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
6
+ *
7
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
8
+ *
9
+ * @license AGPL-3.0-or-later
10
+ *
11
+ * This program is free software: you can redistribute it and/or modify
12
+ * it under the terms of the GNU Affero General Public License as
13
+ * published by the Free Software Foundation, either version 3 of the
14
+ * License, or (at your option) any later version.
15
+ *
16
+ * This program is distributed in the hope that it will be useful,
17
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
18
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19
+ * GNU Affero General Public License for more details.
20
+ *
21
+ * You should have received a copy of the GNU Affero General Public License
22
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
23
+ *
24
+ */
25
+ const Ne = (e) => e === null ? K.getLoggerBuilder().setApp("files").build() : K.getLoggerBuilder().setApp("files").setUid(e.uid).build(), N = Ne(_.getCurrentUser());
26
+ /**
27
+ * @copyright Copyright (c) 2021 John Molakvoæ <skjnldsv@protonmail.com>
28
+ *
29
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
30
+ *
31
+ * @license AGPL-3.0-or-later
32
+ *
33
+ * This program is free software: you can redistribute it and/or modify
34
+ * it under the terms of the GNU Affero General Public License as
35
+ * published by the Free Software Foundation, either version 3 of the
36
+ * License, or (at your option) any later version.
37
+ *
38
+ * This program is distributed in the hope that it will be useful,
39
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
40
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
41
+ * GNU Affero General Public License for more details.
42
+ *
43
+ * You should have received a copy of the GNU Affero General Public License
44
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
45
+ *
46
+ */
47
+ class Ee {
48
+ _entries = [];
49
+ registerEntry(t) {
50
+ this.validateEntry(t), this._entries.push(t);
51
+ }
52
+ unregisterEntry(t) {
53
+ const r = typeof t == "string" ? this.getEntryIndex(t) : this.getEntryIndex(t.id);
54
+ if (r === -1) {
55
+ N.warn("Entry not found, nothing removed", { entry: t, entries: this.getEntries() });
56
+ return;
57
+ }
58
+ this._entries.splice(r, 1);
59
+ }
60
+ /**
61
+ * Get the list of registered entries
62
+ *
63
+ * @param {Folder} context the creation context. Usually the current folder
64
+ */
65
+ getEntries(t) {
66
+ return t ? this._entries.filter((r) => typeof r.enabled == "function" ? r.enabled(t) : !0) : this._entries;
67
+ }
68
+ getEntryIndex(t) {
69
+ return this._entries.findIndex((r) => r.id === t);
70
+ }
71
+ validateEntry(t) {
72
+ if (!t.id || !t.displayName || !(t.iconSvgInline || t.iconClass) || !t.handler)
73
+ throw new Error("Invalid entry");
74
+ if (typeof t.id != "string" || typeof t.displayName != "string")
75
+ throw new Error("Invalid id or displayName property");
76
+ if (t.iconClass && typeof t.iconClass != "string" || t.iconSvgInline && typeof t.iconSvgInline != "string")
77
+ throw new Error("Invalid icon provided");
78
+ if (t.enabled !== void 0 && typeof t.enabled != "function")
79
+ throw new Error("Invalid enabled property");
80
+ if (typeof t.handler != "function")
81
+ throw new Error("Invalid handler property");
82
+ if ("order" in t && typeof t.order != "number")
83
+ throw new Error("Invalid order property");
84
+ if (this.getEntryIndex(t.id) !== -1)
85
+ throw new Error("Duplicate entry");
86
+ }
87
+ }
88
+ const L = function() {
89
+ return typeof window._nc_newfilemenu > "u" && (window._nc_newfilemenu = new Ee(), N.debug("NewFileMenu initialized")), window._nc_newfilemenu;
90
+ };
91
+ /**
92
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
93
+ *
94
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
95
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
96
+ *
97
+ * @license AGPL-3.0-or-later
98
+ *
99
+ * This program is free software: you can redistribute it and/or modify
100
+ * it under the terms of the GNU Affero General Public License as
101
+ * published by the Free Software Foundation, either version 3 of the
102
+ * License, or (at your option) any later version.
103
+ *
104
+ * This program is distributed in the hope that it will be useful,
105
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
106
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
107
+ * GNU Affero General Public License for more details.
108
+ *
109
+ * You should have received a copy of the GNU Affero General Public License
110
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
111
+ *
112
+ */
113
+ const x = ["B", "KB", "MB", "GB", "TB", "PB"], $ = ["B", "KiB", "MiB", "GiB", "TiB", "PiB"];
114
+ function ye(e, t = !1, r = !1, s = !1) {
115
+ r = r && !s, typeof e == "string" && (e = Number(e));
116
+ let n = e > 0 ? Math.floor(Math.log(e) / Math.log(s ? 1e3 : 1024)) : 0;
117
+ n = Math.min((r ? $.length : x.length) - 1, n);
118
+ const i = r ? $[n] : x[n];
119
+ let a = (e / Math.pow(s ? 1e3 : 1024, n)).toFixed(1);
120
+ return t === !0 && n === 0 ? (a !== "0.0" ? "< 1 " : "0 ") + (r ? $[1] : x[1]) : (n < 2 ? a = parseFloat(a).toFixed(0) : a = parseFloat(a).toLocaleString(ge.getCanonicalLocale()), a + " " + i);
121
+ }
122
+ function be(e, t = !1) {
123
+ try {
124
+ e = `${e}`.toLocaleLowerCase().replaceAll(/\s+/g, "").replaceAll(",", ".");
125
+ } catch {
126
+ return null;
127
+ }
128
+ const r = e.match(/^([0-9]*(\.[0-9]*)?)([kmgtp]?)(i?)b?$/);
129
+ if (r === null || r[1] === "." || r[1] === "")
130
+ return null;
131
+ const s = {
132
+ "": 0,
133
+ k: 1,
134
+ m: 2,
135
+ g: 3,
136
+ t: 4,
137
+ p: 5,
138
+ e: 6
139
+ }, n = `${r[1]}`, i = r[4] === "i" || t ? 1024 : 1e3;
140
+ return Math.round(Number.parseFloat(n) * i ** s[r[3]]);
141
+ }
142
+ /**
143
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
144
+ *
145
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
146
+ *
147
+ * @license AGPL-3.0-or-later
148
+ *
149
+ * This program is free software: you can redistribute it and/or modify
150
+ * it under the terms of the GNU Affero General Public License as
151
+ * published by the Free Software Foundation, either version 3 of the
152
+ * License, or (at your option) any later version.
153
+ *
154
+ * This program is distributed in the hope that it will be useful,
155
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
156
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
157
+ * GNU Affero General Public License for more details.
158
+ *
159
+ * You should have received a copy of the GNU Affero General Public License
160
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
161
+ *
162
+ */
163
+ var R = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.HIDDEN = "hidden", e))(R || {});
164
+ class ve {
165
+ _action;
166
+ constructor(t) {
167
+ this.validateAction(t), this._action = t;
168
+ }
169
+ get id() {
170
+ return this._action.id;
171
+ }
172
+ get displayName() {
173
+ return this._action.displayName;
174
+ }
175
+ get title() {
176
+ return this._action.title;
177
+ }
178
+ get iconSvgInline() {
179
+ return this._action.iconSvgInline;
180
+ }
181
+ get enabled() {
182
+ return this._action.enabled;
183
+ }
184
+ get exec() {
185
+ return this._action.exec;
186
+ }
187
+ get execBatch() {
188
+ return this._action.execBatch;
189
+ }
190
+ get order() {
191
+ return this._action.order;
192
+ }
193
+ get parent() {
194
+ return this._action.parent;
195
+ }
196
+ get default() {
197
+ return this._action.default;
198
+ }
199
+ get inline() {
200
+ return this._action.inline;
201
+ }
202
+ get renderInline() {
203
+ return this._action.renderInline;
204
+ }
205
+ validateAction(t) {
206
+ if (!t.id || typeof t.id != "string")
207
+ throw new Error("Invalid id");
208
+ if (!t.displayName || typeof t.displayName != "function")
209
+ throw new Error("Invalid displayName function");
210
+ if ("title" in t && typeof t.title != "function")
211
+ throw new Error("Invalid title function");
212
+ if (!t.iconSvgInline || typeof t.iconSvgInline != "function")
213
+ throw new Error("Invalid iconSvgInline function");
214
+ if (!t.exec || typeof t.exec != "function")
215
+ throw new Error("Invalid exec function");
216
+ if ("enabled" in t && typeof t.enabled != "function")
217
+ throw new Error("Invalid enabled function");
218
+ if ("execBatch" in t && typeof t.execBatch != "function")
219
+ throw new Error("Invalid execBatch function");
220
+ if ("order" in t && typeof t.order != "number")
221
+ throw new Error("Invalid order");
222
+ if ("parent" in t && typeof t.parent != "string")
223
+ throw new Error("Invalid parent");
224
+ if (t.default && !Object.values(R).includes(t.default))
225
+ throw new Error("Invalid default");
226
+ if ("inline" in t && typeof t.inline != "function")
227
+ throw new Error("Invalid inline function");
228
+ if ("renderInline" in t && typeof t.renderInline != "function")
229
+ throw new Error("Invalid renderInline function");
230
+ }
231
+ }
232
+ const _e = function(e) {
233
+ if (typeof window._nc_fileactions > "u" && (window._nc_fileactions = [], N.debug("FileActions initialized")), window._nc_fileactions.find((t) => t.id === e.id)) {
234
+ N.error(`FileAction ${e.id} already registered`, { action: e });
235
+ return;
236
+ }
237
+ window._nc_fileactions.push(e);
238
+ }, Te = function() {
239
+ return typeof window._nc_fileactions > "u" && (window._nc_fileactions = [], N.debug("FileActions initialized")), window._nc_fileactions;
240
+ };
241
+ /**
242
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
243
+ *
244
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
245
+ *
246
+ * @license AGPL-3.0-or-later
247
+ *
248
+ * This program is free software: you can redistribute it and/or modify
249
+ * it under the terms of the GNU Affero General Public License as
250
+ * published by the Free Software Foundation, either version 3 of the
251
+ * License, or (at your option) any later version.
252
+ *
253
+ * This program is distributed in the hope that it will be useful,
254
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
255
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
256
+ * GNU Affero General Public License for more details.
257
+ *
258
+ * You should have received a copy of the GNU Affero General Public License
259
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
260
+ *
261
+ */
262
+ class Ie {
263
+ _header;
264
+ constructor(t) {
265
+ this.validateHeader(t), this._header = t;
266
+ }
267
+ get id() {
268
+ return this._header.id;
269
+ }
270
+ get order() {
271
+ return this._header.order;
272
+ }
273
+ get enabled() {
274
+ return this._header.enabled;
275
+ }
276
+ get render() {
277
+ return this._header.render;
278
+ }
279
+ get updated() {
280
+ return this._header.updated;
281
+ }
282
+ validateHeader(t) {
283
+ if (!t.id || !t.render || !t.updated)
284
+ throw new Error("Invalid header: id, render and updated are required");
285
+ if (typeof t.id != "string")
286
+ throw new Error("Invalid id property");
287
+ if (t.enabled !== void 0 && typeof t.enabled != "function")
288
+ throw new Error("Invalid enabled property");
289
+ if (t.render && typeof t.render != "function")
290
+ throw new Error("Invalid render property");
291
+ if (t.updated && typeof t.updated != "function")
292
+ throw new Error("Invalid updated property");
293
+ }
294
+ }
295
+ const Ae = function(e) {
296
+ if (typeof window._nc_filelistheader > "u" && (window._nc_filelistheader = [], N.debug("FileListHeaders initialized")), window._nc_filelistheader.find((t) => t.id === e.id)) {
297
+ N.error(`Header ${e.id} already registered`, { header: e });
298
+ return;
299
+ }
300
+ window._nc_filelistheader.push(e);
301
+ }, Pe = function() {
302
+ return typeof window._nc_filelistheader > "u" && (window._nc_filelistheader = [], N.debug("FileListHeaders initialized")), window._nc_filelistheader;
303
+ };
304
+ /**
305
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
306
+ *
307
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
308
+ *
309
+ * @license AGPL-3.0-or-later
310
+ *
311
+ * This program is free software: you can redistribute it and/or modify
312
+ * it under the terms of the GNU Affero General Public License as
313
+ * published by the Free Software Foundation, either version 3 of the
314
+ * License, or (at your option) any later version.
315
+ *
316
+ * This program is distributed in the hope that it will be useful,
317
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
318
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
319
+ * GNU Affero General Public License for more details.
320
+ *
321
+ * You should have received a copy of the GNU Affero General Public License
322
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
323
+ *
324
+ */
325
+ var m = /* @__PURE__ */ ((e) => (e[e.NONE = 0] = "NONE", e[e.CREATE = 4] = "CREATE", e[e.READ = 1] = "READ", e[e.UPDATE = 2] = "UPDATE", e[e.DELETE = 8] = "DELETE", e[e.SHARE = 16] = "SHARE", e[e.ALL = 31] = "ALL", e))(m || {});
326
+ /**
327
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
328
+ *
329
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
330
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
331
+ *
332
+ * @license AGPL-3.0-or-later
333
+ *
334
+ * This program is free software: you can redistribute it and/or modify
335
+ * it under the terms of the GNU Affero General Public License as
336
+ * published by the Free Software Foundation, either version 3 of the
337
+ * License, or (at your option) any later version.
338
+ *
339
+ * This program is distributed in the hope that it will be useful,
340
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
341
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
342
+ * GNU Affero General Public License for more details.
343
+ *
344
+ * You should have received a copy of the GNU Affero General Public License
345
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
346
+ *
347
+ */
348
+ const M = [
349
+ "d:getcontentlength",
350
+ "d:getcontenttype",
351
+ "d:getetag",
352
+ "d:getlastmodified",
353
+ "d:quota-available-bytes",
354
+ "d:resourcetype",
355
+ "nc:has-preview",
356
+ "nc:is-encrypted",
357
+ "nc:mount-type",
358
+ "oc:comments-unread",
359
+ "oc:favorite",
360
+ "oc:fileid",
361
+ "oc:owner-display-name",
362
+ "oc:owner-id",
363
+ "oc:permissions",
364
+ "oc:size"
365
+ ], B = {
366
+ d: "DAV:",
367
+ nc: "http://nextcloud.org/ns",
368
+ oc: "http://owncloud.org/ns",
369
+ ocs: "http://open-collaboration-services.org/ns"
370
+ }, Oe = function(e, t = { nc: "http://nextcloud.org/ns" }) {
371
+ typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...M], window._nc_dav_namespaces = { ...B });
372
+ const r = { ...window._nc_dav_namespaces, ...t };
373
+ if (window._nc_dav_properties.find((n) => n === e))
374
+ return N.warn(`${e} already registered`, { prop: e }), !1;
375
+ if (e.startsWith("<") || e.split(":").length !== 2)
376
+ return N.error(`${e} is not valid. See example: 'oc:fileid'`, { prop: e }), !1;
377
+ const s = e.split(":")[0];
378
+ return r[s] ? (window._nc_dav_properties.push(e), window._nc_dav_namespaces = r, !0) : (N.error(`${e} namespace unknown`, { prop: e, namespaces: r }), !1);
379
+ }, P = function() {
380
+ return typeof window._nc_dav_properties > "u" && (window._nc_dav_properties = [...M]), window._nc_dav_properties.map((e) => `<${e} />`).join(" ");
381
+ }, O = function() {
382
+ return typeof window._nc_dav_namespaces > "u" && (window._nc_dav_namespaces = { ...B }), Object.keys(window._nc_dav_namespaces).map((e) => `xmlns:${e}="${window._nc_dav_namespaces?.[e]}"`).join(" ");
383
+ }, Ce = function() {
384
+ return `<?xml version="1.0"?>
385
+ <d:propfind ${O()}>
386
+ <d:prop>
387
+ ${P()}
388
+ </d:prop>
389
+ </d:propfind>`;
390
+ }, te = function() {
391
+ return `<?xml version="1.0"?>
392
+ <oc:filter-files ${O()}>
393
+ <d:prop>
394
+ ${P()}
395
+ </d:prop>
396
+ <oc:filter-rules>
397
+ <oc:favorite>1</oc:favorite>
398
+ </oc:filter-rules>
399
+ </oc:filter-files>`;
400
+ }, Fe = function(e) {
401
+ return `<?xml version="1.0" encoding="UTF-8"?>
402
+ <d:searchrequest ${O()}
403
+ xmlns:ns="https://github.com/icewind1991/SearchDAV/ns">
404
+ <d:basicsearch>
405
+ <d:select>
406
+ <d:prop>
407
+ ${P()}
408
+ </d:prop>
409
+ </d:select>
410
+ <d:from>
411
+ <d:scope>
412
+ <d:href>/files/${_.getCurrentUser()?.uid}/</d:href>
413
+ <d:depth>infinity</d:depth>
414
+ </d:scope>
415
+ </d:from>
416
+ <d:where>
417
+ <d:and>
418
+ <d:or>
419
+ <d:not>
420
+ <d:eq>
421
+ <d:prop>
422
+ <d:getcontenttype/>
423
+ </d:prop>
424
+ <d:literal>httpd/unix-directory</d:literal>
425
+ </d:eq>
426
+ </d:not>
427
+ <d:eq>
428
+ <d:prop>
429
+ <oc:size/>
430
+ </d:prop>
431
+ <d:literal>0</d:literal>
432
+ </d:eq>
433
+ </d:or>
434
+ <d:gt>
435
+ <d:prop>
436
+ <d:getlastmodified/>
437
+ </d:prop>
438
+ <d:literal>${e}</d:literal>
439
+ </d:gt>
440
+ </d:and>
441
+ </d:where>
442
+ <d:orderby>
443
+ <d:order>
444
+ <d:prop>
445
+ <d:getlastmodified/>
446
+ </d:prop>
447
+ <d:descending/>
448
+ </d:order>
449
+ </d:orderby>
450
+ <d:limit>
451
+ <d:nresults>100</d:nresults>
452
+ <ns:firstresult>0</ns:firstresult>
453
+ </d:limit>
454
+ </d:basicsearch>
455
+ </d:searchrequest>`;
456
+ };
457
+ /**
458
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
459
+ *
460
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
461
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
462
+ *
463
+ * @license AGPL-3.0-or-later
464
+ *
465
+ * This program is free software: you can redistribute it and/or modify
466
+ * it under the terms of the GNU Affero General Public License as
467
+ * published by the Free Software Foundation, either version 3 of the
468
+ * License, or (at your option) any later version.
469
+ *
470
+ * This program is distributed in the hope that it will be useful,
471
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
472
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
473
+ * GNU Affero General Public License for more details.
474
+ *
475
+ * You should have received a copy of the GNU Affero General Public License
476
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
477
+ *
478
+ */
479
+ const re = function(e = "") {
480
+ let t = m.NONE;
481
+ return e && ((e.includes("C") || e.includes("K")) && (t |= m.CREATE), e.includes("G") && (t |= m.READ), (e.includes("W") || e.includes("N") || e.includes("V")) && (t |= m.UPDATE), e.includes("D") && (t |= m.DELETE), e.includes("R") && (t |= m.SHARE)), t;
482
+ };
483
+ /**
484
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
485
+ *
486
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
487
+ *
488
+ * @license AGPL-3.0-or-later
489
+ *
490
+ * This program is free software: you can redistribute it and/or modify
491
+ * it under the terms of the GNU Affero General Public License as
492
+ * published by the Free Software Foundation, either version 3 of the
493
+ * License, or (at your option) any later version.
494
+ *
495
+ * This program is distributed in the hope that it will be useful,
496
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
497
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
498
+ * GNU Affero General Public License for more details.
499
+ *
500
+ * You should have received a copy of the GNU Affero General Public License
501
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
502
+ *
503
+ */
504
+ var C = /* @__PURE__ */ ((e) => (e.Folder = "folder", e.File = "file", e))(C || {});
505
+ /**
506
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
507
+ *
508
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
509
+ *
510
+ * @license AGPL-3.0-or-later
511
+ *
512
+ * This program is free software: you can redistribute it and/or modify
513
+ * it under the terms of the GNU Affero General Public License as
514
+ * published by the Free Software Foundation, either version 3 of the
515
+ * License, or (at your option) any later version.
516
+ *
517
+ * This program is distributed in the hope that it will be useful,
518
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
519
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
520
+ * GNU Affero General Public License for more details.
521
+ *
522
+ * You should have received a copy of the GNU Affero General Public License
523
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
524
+ *
525
+ */
526
+ const ne = function(e, t) {
527
+ return e.match(t) !== null;
528
+ }, Z = (e, t) => {
529
+ if (e.id && typeof e.id != "number")
530
+ throw new Error("Invalid id type of value");
531
+ if (!e.source)
532
+ throw new Error("Missing mandatory source");
533
+ try {
534
+ new URL(e.source);
535
+ } catch {
536
+ throw new Error("Invalid source format, source must be a valid URL");
537
+ }
538
+ if (!e.source.startsWith("http"))
539
+ throw new Error("Invalid source format, only http(s) is supported");
540
+ if (e.mtime && !(e.mtime instanceof Date))
541
+ throw new Error("Invalid mtime type");
542
+ if (e.crtime && !(e.crtime instanceof Date))
543
+ throw new Error("Invalid crtime type");
544
+ if (!e.mime || typeof e.mime != "string" || !e.mime.match(/^[-\w.]+\/[-+\w.]+$/gi))
545
+ throw new Error("Missing or invalid mandatory mime");
546
+ if ("size" in e && typeof e.size != "number" && e.size !== void 0)
547
+ throw new Error("Invalid size type");
548
+ if ("permissions" in e && e.permissions !== void 0 && !(typeof e.permissions == "number" && e.permissions >= m.NONE && e.permissions <= m.ALL))
549
+ throw new Error("Invalid permissions");
550
+ if (e.owner && e.owner !== null && typeof e.owner != "string")
551
+ throw new Error("Invalid owner type");
552
+ if (e.attributes && typeof e.attributes != "object")
553
+ throw new Error("Invalid attributes type");
554
+ if (e.root && typeof e.root != "string")
555
+ throw new Error("Invalid root type");
556
+ if (e.root && !e.root.startsWith("/"))
557
+ throw new Error("Root must start with a leading slash");
558
+ if (e.root && !e.source.includes(e.root))
559
+ throw new Error("Root must be part of the source");
560
+ if (e.root && ne(e.source, t)) {
561
+ const r = e.source.match(t)[0];
562
+ if (!e.source.includes(b.join(r, e.root)))
563
+ throw new Error("The root must be relative to the service. e.g /files/emma");
564
+ }
565
+ if (e.status && !Object.values(k).includes(e.status))
566
+ throw new Error("Status must be a valid NodeStatus");
567
+ };
568
+ /**
569
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
570
+ *
571
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
572
+ *
573
+ * @license AGPL-3.0-or-later
574
+ *
575
+ * This program is free software: you can redistribute it and/or modify
576
+ * it under the terms of the GNU Affero General Public License as
577
+ * published by the Free Software Foundation, either version 3 of the
578
+ * License, or (at your option) any later version.
579
+ *
580
+ * This program is distributed in the hope that it will be useful,
581
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
582
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
583
+ * GNU Affero General Public License for more details.
584
+ *
585
+ * You should have received a copy of the GNU Affero General Public License
586
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
587
+ *
588
+ */
589
+ var k = /* @__PURE__ */ ((e) => (e.NEW = "new", e.FAILED = "failed", e.LOADING = "loading", e.LOCKED = "locked", e))(k || {});
590
+ class q {
591
+ _data;
592
+ _attributes;
593
+ _knownDavService = /(remote|public)\.php\/(web)?dav/i;
594
+ constructor(t, r) {
595
+ Z(t, r || this._knownDavService), this._data = t;
596
+ const s = {
597
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
598
+ set: (n, i, a) => (this.updateMtime(), Reflect.set(n, i, a)),
599
+ deleteProperty: (n, i) => (this.updateMtime(), Reflect.deleteProperty(n, i))
600
+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
601
+ };
602
+ this._attributes = new Proxy(t.attributes || {}, s), delete this._data.attributes, r && (this._knownDavService = r);
603
+ }
604
+ /**
605
+ * Get the source url to this object
606
+ */
607
+ get source() {
608
+ return this._data.source.replace(/\/$/i, "");
609
+ }
610
+ /**
611
+ * Get the encoded source url to this object for requests purposes
612
+ */
613
+ get encodedSource() {
614
+ const { origin: t } = new URL(this.source);
615
+ return t + we.encodePath(this.source.slice(t.length));
616
+ }
617
+ /**
618
+ * Get this object name
619
+ */
620
+ get basename() {
621
+ return b.basename(this.source);
622
+ }
623
+ /**
624
+ * Get this object's extension
625
+ */
626
+ get extension() {
627
+ return b.extname(this.source);
628
+ }
629
+ /**
630
+ * Get the directory path leading to this object
631
+ * Will use the relative path to root if available
632
+ */
633
+ get dirname() {
634
+ if (this.root) {
635
+ let r = this.source;
636
+ this.isDavRessource && (r = r.split(this._knownDavService).pop());
637
+ const s = r.indexOf(this.root), n = this.root.replace(/\/$/, "");
638
+ return b.dirname(r.slice(s + n.length) || "/");
639
+ }
640
+ const t = new URL(this.source);
641
+ return b.dirname(t.pathname);
642
+ }
643
+ /**
644
+ * Get the file mime
645
+ */
646
+ get mime() {
647
+ return this._data.mime;
648
+ }
649
+ /**
650
+ * Get the file modification time
651
+ */
652
+ get mtime() {
653
+ return this._data.mtime;
654
+ }
655
+ /**
656
+ * Get the file creation time
657
+ */
658
+ get crtime() {
659
+ return this._data.crtime;
660
+ }
661
+ /**
662
+ * Get the file size
663
+ */
664
+ get size() {
665
+ return this._data.size;
666
+ }
667
+ /**
668
+ * Get the file attribute
669
+ */
670
+ get attributes() {
671
+ return this._attributes;
672
+ }
673
+ /**
674
+ * Get the file permissions
675
+ */
676
+ get permissions() {
677
+ return this.owner === null && !this.isDavRessource ? m.READ : this._data.permissions !== void 0 ? this._data.permissions : m.NONE;
678
+ }
679
+ /**
680
+ * Get the file owner
681
+ */
682
+ get owner() {
683
+ return this.isDavRessource ? this._data.owner : null;
684
+ }
685
+ /**
686
+ * Is this a dav-related ressource ?
687
+ */
688
+ get isDavRessource() {
689
+ return ne(this.source, this._knownDavService);
690
+ }
691
+ /**
692
+ * Get the dav root of this object
693
+ */
694
+ get root() {
695
+ return this._data.root ? this._data.root.replace(/^(.+)\/$/, "$1") : this.isDavRessource && b.dirname(this.source).split(this._knownDavService).pop() || null;
696
+ }
697
+ /**
698
+ * Get the absolute path of this object relative to the root
699
+ */
700
+ get path() {
701
+ if (this.root) {
702
+ let t = this.source;
703
+ this.isDavRessource && (t = t.split(this._knownDavService).pop());
704
+ const r = t.indexOf(this.root), s = this.root.replace(/\/$/, "");
705
+ return t.slice(r + s.length) || "/";
706
+ }
707
+ return (this.dirname + "/" + this.basename).replace(/\/\//g, "/");
708
+ }
709
+ /**
710
+ * Get the node id if defined.
711
+ * Will look for the fileid in attributes if undefined.
712
+ */
713
+ get fileid() {
714
+ return this._data?.id || this.attributes?.fileid;
715
+ }
716
+ /**
717
+ * Get the node status.
718
+ */
719
+ get status() {
720
+ return this._data?.status;
721
+ }
722
+ /**
723
+ * Set the node status.
724
+ */
725
+ set status(t) {
726
+ this._data.status = t;
727
+ }
728
+ /**
729
+ * Move the node to a new destination
730
+ *
731
+ * @param {string} destination the new source.
732
+ * e.g. https://cloud.domain.com/remote.php/dav/files/emma/Photos/picture.jpg
733
+ */
734
+ move(t) {
735
+ Z({ ...this._data, source: t }, this._knownDavService), this._data.source = t, this.updateMtime();
736
+ }
737
+ /**
738
+ * Rename the node
739
+ * This aliases the move method for easier usage
740
+ *
741
+ * @param basename The new name of the node
742
+ */
743
+ rename(t) {
744
+ if (t.includes("/"))
745
+ throw new Error("Invalid basename");
746
+ this.move(b.dirname(this.source) + "/" + t);
747
+ }
748
+ /**
749
+ * Update the mtime if exists.
750
+ */
751
+ updateMtime() {
752
+ this._data.mtime && (this._data.mtime = /* @__PURE__ */ new Date());
753
+ }
754
+ }
755
+ /**
756
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
757
+ *
758
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
759
+ *
760
+ * @license AGPL-3.0-or-later
761
+ *
762
+ * This program is free software: you can redistribute it and/or modify
763
+ * it under the terms of the GNU Affero General Public License as
764
+ * published by the Free Software Foundation, either version 3 of the
765
+ * License, or (at your option) any later version.
766
+ *
767
+ * This program is distributed in the hope that it will be useful,
768
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
769
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
770
+ * GNU Affero General Public License for more details.
771
+ *
772
+ * You should have received a copy of the GNU Affero General Public License
773
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
774
+ *
775
+ */
776
+ class ie extends q {
777
+ get type() {
778
+ return C.File;
779
+ }
780
+ }
781
+ /**
782
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
783
+ *
784
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
785
+ *
786
+ * @license AGPL-3.0-or-later
787
+ *
788
+ * This program is free software: you can redistribute it and/or modify
789
+ * it under the terms of the GNU Affero General Public License as
790
+ * published by the Free Software Foundation, either version 3 of the
791
+ * License, or (at your option) any later version.
792
+ *
793
+ * This program is distributed in the hope that it will be useful,
794
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
795
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
796
+ * GNU Affero General Public License for more details.
797
+ *
798
+ * You should have received a copy of the GNU Affero General Public License
799
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
800
+ *
801
+ */
802
+ class se extends q {
803
+ constructor(t) {
804
+ super({
805
+ ...t,
806
+ mime: "httpd/unix-directory"
807
+ });
808
+ }
809
+ get type() {
810
+ return C.Folder;
811
+ }
812
+ get extension() {
813
+ return null;
814
+ }
815
+ get mime() {
816
+ return "httpd/unix-directory";
817
+ }
818
+ }
819
+ /**
820
+ * @copyright Copyright (c) 2023 John Molakvoæ <skjnldsv@protonmail.com>
821
+ *
822
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
823
+ * @author Ferdinand Thiessen <opensource@fthiessen.de>
824
+ *
825
+ * @license AGPL-3.0-or-later
826
+ *
827
+ * This program is free software: you can redistribute it and/or modify
828
+ * it under the terms of the GNU Affero General Public License as
829
+ * published by the Free Software Foundation, either version 3 of the
830
+ * License, or (at your option) any later version.
831
+ *
832
+ * This program is distributed in the hope that it will be useful,
833
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
834
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
835
+ * GNU Affero General Public License for more details.
836
+ *
837
+ * You should have received a copy of the GNU Affero General Public License
838
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
839
+ *
840
+ */
841
+ const U = `/files/${_.getCurrentUser()?.uid}`, X = me.generateRemoteUrl("dav"), xe = function(e = X, t = {}) {
842
+ const r = W.createClient(e, { headers: t });
843
+ function s(i) {
844
+ r.setHeaders({
845
+ ...t,
846
+ // Add this so the server knows it is an request from the browser
847
+ "X-Requested-With": "XMLHttpRequest",
848
+ // Inject user auth
849
+ requesttoken: i ?? ""
850
+ });
851
+ }
852
+ return _.onRequestTokenUpdate(s), s(_.getRequestToken()), W.getPatcher().patch("fetch", (i, a) => {
853
+ const u = a.headers;
854
+ return u?.method && (a.method = u.method, delete u.method), fetch(i, a);
855
+ }), r;
856
+ }, $e = async (e, t = "/", r = U) => (await e.getDirectoryContents(`${r}${t}`, {
857
+ details: !0,
858
+ data: te(),
859
+ headers: {
860
+ // see davGetClient for patched webdav client
861
+ method: "REPORT"
862
+ },
863
+ includeSelf: !0
864
+ })).data.filter((n) => n.filename !== t).map((n) => oe(n, r)), oe = function(e, t = U, r = X) {
865
+ const s = _.getCurrentUser()?.uid;
866
+ if (!s)
867
+ throw new Error("No user id found");
868
+ const n = e.props, i = re(n?.permissions), a = (n?.["owner-id"] || s).toString(), u = {
869
+ id: n?.fileid || 0,
870
+ source: `${r}${e.filename}`,
871
+ mtime: new Date(Date.parse(e.lastmod)),
872
+ mime: e.mime || "application/octet-stream",
873
+ size: n?.size || Number.parseInt(n.getcontentlength || "0"),
874
+ permissions: i,
875
+ owner: a,
876
+ root: t,
877
+ attributes: {
878
+ ...e,
879
+ ...n,
880
+ hasPreview: n?.["has-preview"]
881
+ }
882
+ };
883
+ return delete u.attributes?.props, e.type === "file" ? new ie(u) : new se(u);
884
+ };
885
+ /**
886
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
887
+ *
888
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
889
+ *
890
+ * @license AGPL-3.0-or-later
891
+ *
892
+ * This program is free software: you can redistribute it and/or modify
893
+ * it under the terms of the GNU Affero General Public License as
894
+ * published by the Free Software Foundation, either version 3 of the
895
+ * License, or (at your option) any later version.
896
+ *
897
+ * This program is distributed in the hope that it will be useful,
898
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
899
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
900
+ * GNU Affero General Public License for more details.
901
+ *
902
+ * You should have received a copy of the GNU Affero General Public License
903
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
904
+ *
905
+ */
906
+ class ue {
907
+ _views = [];
908
+ _currentView = null;
909
+ register(t) {
910
+ if (this._views.find((r) => r.id === t.id))
911
+ throw new Error(`View id ${t.id} is already registered`);
912
+ this._views.push(t);
913
+ }
914
+ remove(t) {
915
+ const r = this._views.findIndex((s) => s.id === t);
916
+ r !== -1 && this._views.splice(r, 1);
917
+ }
918
+ get views() {
919
+ return this._views;
920
+ }
921
+ setActive(t) {
922
+ this._currentView = t;
923
+ }
924
+ get active() {
925
+ return this._currentView;
926
+ }
927
+ }
928
+ const Ve = function() {
929
+ return typeof window._nc_navigation > "u" && (window._nc_navigation = new ue(), N.debug("Navigation service initialized")), window._nc_navigation;
930
+ };
931
+ /**
932
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
933
+ *
934
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
935
+ *
936
+ * @license AGPL-3.0-or-later
937
+ *
938
+ * This program is free software: you can redistribute it and/or modify
939
+ * it under the terms of the GNU Affero General Public License as
940
+ * published by the Free Software Foundation, either version 3 of the
941
+ * License, or (at your option) any later version.
942
+ *
943
+ * This program is distributed in the hope that it will be useful,
944
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
945
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
946
+ * GNU Affero General Public License for more details.
947
+ *
948
+ * You should have received a copy of the GNU Affero General Public License
949
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
950
+ *
951
+ */
952
+ class ae {
953
+ _column;
954
+ constructor(t) {
955
+ Se(t), this._column = t;
956
+ }
957
+ get id() {
958
+ return this._column.id;
959
+ }
960
+ get title() {
961
+ return this._column.title;
962
+ }
963
+ get render() {
964
+ return this._column.render;
965
+ }
966
+ get sort() {
967
+ return this._column.sort;
968
+ }
969
+ get summary() {
970
+ return this._column.summary;
971
+ }
972
+ }
973
+ const Se = function(e) {
974
+ if (!e.id || typeof e.id != "string")
975
+ throw new Error("A column id is required");
976
+ if (!e.title || typeof e.title != "string")
977
+ throw new Error("A column title is required");
978
+ if (!e.render || typeof e.render != "function")
979
+ throw new Error("A render function is required");
980
+ if (e.sort && typeof e.sort != "function")
981
+ throw new Error("Column sortFunction must be a function");
982
+ if (e.summary && typeof e.summary != "function")
983
+ throw new Error("Column summary must be a function");
984
+ return !0;
985
+ };
986
+ var G = {}, F = {};
987
+ (function(e) {
988
+ 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", r = t + "\\-.\\d\\u00B7\\u0300-\\u036F\\u203F-\\u2040", s = "[" + t + "][" + r + "]*", n = new RegExp("^" + s + "$"), i = function(u, o) {
989
+ const d = [];
990
+ let l = o.exec(u);
991
+ for (; l; ) {
992
+ const f = [];
993
+ f.startIndex = o.lastIndex - l[0].length;
994
+ const c = l.length;
995
+ for (let g = 0; g < c; g++)
996
+ f.push(l[g]);
997
+ d.push(f), l = o.exec(u);
998
+ }
999
+ return d;
1000
+ }, a = function(u) {
1001
+ const o = n.exec(u);
1002
+ return !(o === null || typeof o > "u");
1003
+ };
1004
+ e.isExist = function(u) {
1005
+ return typeof u < "u";
1006
+ }, e.isEmptyObject = function(u) {
1007
+ return Object.keys(u).length === 0;
1008
+ }, e.merge = function(u, o, d) {
1009
+ if (o) {
1010
+ const l = Object.keys(o), f = l.length;
1011
+ for (let c = 0; c < f; c++)
1012
+ d === "strict" ? u[l[c]] = [o[l[c]]] : u[l[c]] = o[l[c]];
1013
+ }
1014
+ }, e.getValue = function(u) {
1015
+ return e.isExist(u) ? u : "";
1016
+ }, e.isName = a, e.getAllMatches = i, e.nameRegexp = s;
1017
+ })(F);
1018
+ const H = F, Le = {
1019
+ allowBooleanAttributes: !1,
1020
+ //A tag can have attributes without any value
1021
+ unpairedTags: []
1022
+ };
1023
+ G.validate = function(e, t) {
1024
+ t = Object.assign({}, Le, t);
1025
+ const r = [];
1026
+ let s = !1, n = !1;
1027
+ e[0] === "\uFEFF" && (e = e.substr(1));
1028
+ for (let i = 0; i < e.length; i++)
1029
+ if (e[i] === "<" && e[i + 1] === "?") {
1030
+ if (i += 2, i = Y(e, i), i.err)
1031
+ return i;
1032
+ } else if (e[i] === "<") {
1033
+ let a = i;
1034
+ if (i++, e[i] === "!") {
1035
+ i = J(e, i);
1036
+ continue;
1037
+ } else {
1038
+ let u = !1;
1039
+ e[i] === "/" && (u = !0, i++);
1040
+ let o = "";
1041
+ for (; i < e.length && e[i] !== ">" && e[i] !== " " && e[i] !== " " && e[i] !== `
1042
+ ` && e[i] !== "\r"; i++)
1043
+ o += e[i];
1044
+ if (o = o.trim(), o[o.length - 1] === "/" && (o = o.substring(0, o.length - 1), i--), !Ge(o)) {
1045
+ let f;
1046
+ return o.trim().length === 0 ? f = "Invalid space after '<'." : f = "Tag '" + o + "' is an invalid name.", p("InvalidTag", f, w(e, i));
1047
+ }
1048
+ const d = Be(e, i);
1049
+ if (d === !1)
1050
+ return p("InvalidAttr", "Attributes for '" + o + "' have open quote.", w(e, i));
1051
+ let l = d.value;
1052
+ if (i = d.index, l[l.length - 1] === "/") {
1053
+ const f = i - l.length;
1054
+ l = l.substring(0, l.length - 1);
1055
+ const c = Q(l, t);
1056
+ if (c === !0)
1057
+ s = !0;
1058
+ else
1059
+ return p(c.err.code, c.err.msg, w(e, f + c.err.line));
1060
+ } else if (u)
1061
+ if (d.tagClosed) {
1062
+ if (l.trim().length > 0)
1063
+ return p("InvalidTag", "Closing tag '" + o + "' can't have attributes or invalid starting.", w(e, a));
1064
+ {
1065
+ const f = r.pop();
1066
+ if (o !== f.tagName) {
1067
+ let c = w(e, f.tagStartPos);
1068
+ return p(
1069
+ "InvalidTag",
1070
+ "Expected closing tag '" + f.tagName + "' (opened in line " + c.line + ", col " + c.col + ") instead of closing tag '" + o + "'.",
1071
+ w(e, a)
1072
+ );
1073
+ }
1074
+ r.length == 0 && (n = !0);
1075
+ }
1076
+ } else
1077
+ return p("InvalidTag", "Closing tag '" + o + "' doesn't have proper closing.", w(e, i));
1078
+ else {
1079
+ const f = Q(l, t);
1080
+ if (f !== !0)
1081
+ return p(f.err.code, f.err.msg, w(e, i - l.length + f.err.line));
1082
+ if (n === !0)
1083
+ return p("InvalidXml", "Multiple possible root nodes found.", w(e, i));
1084
+ t.unpairedTags.indexOf(o) !== -1 || r.push({ tagName: o, tagStartPos: a }), s = !0;
1085
+ }
1086
+ for (i++; i < e.length; i++)
1087
+ if (e[i] === "<")
1088
+ if (e[i + 1] === "!") {
1089
+ i++, i = J(e, i);
1090
+ continue;
1091
+ } else if (e[i + 1] === "?") {
1092
+ if (i = Y(e, ++i), i.err)
1093
+ return i;
1094
+ } else
1095
+ break;
1096
+ else if (e[i] === "&") {
1097
+ const f = Ue(e, i);
1098
+ if (f == -1)
1099
+ return p("InvalidChar", "char '&' is not expected.", w(e, i));
1100
+ i = f;
1101
+ } else if (n === !0 && !j(e[i]))
1102
+ return p("InvalidXml", "Extra text at the end", w(e, i));
1103
+ e[i] === "<" && i--;
1104
+ }
1105
+ } else {
1106
+ if (j(e[i]))
1107
+ continue;
1108
+ return p("InvalidChar", "char '" + e[i] + "' is not expected.", w(e, i));
1109
+ }
1110
+ if (s) {
1111
+ if (r.length == 1)
1112
+ return p("InvalidTag", "Unclosed tag '" + r[0].tagName + "'.", w(e, r[0].tagStartPos));
1113
+ if (r.length > 0)
1114
+ return p("InvalidXml", "Invalid '" + JSON.stringify(r.map((i) => i.tagName), null, 4).replace(/\r?\n/g, "") + "' found.", { line: 1, col: 1 });
1115
+ } else
1116
+ return p("InvalidXml", "Start tag expected.", 1);
1117
+ return !0;
1118
+ };
1119
+ function j(e) {
1120
+ return e === " " || e === " " || e === `
1121
+ ` || e === "\r";
1122
+ }
1123
+ function Y(e, t) {
1124
+ const r = t;
1125
+ for (; t < e.length; t++)
1126
+ if (e[t] == "?" || e[t] == " ") {
1127
+ const s = e.substr(r, t - r);
1128
+ if (t > 5 && s === "xml")
1129
+ return p("InvalidXml", "XML declaration allowed only at the start of the document.", w(e, t));
1130
+ if (e[t] == "?" && e[t + 1] == ">") {
1131
+ t++;
1132
+ break;
1133
+ } else
1134
+ continue;
1135
+ }
1136
+ return t;
1137
+ }
1138
+ function J(e, t) {
1139
+ if (e.length > t + 5 && e[t + 1] === "-" && e[t + 2] === "-") {
1140
+ for (t += 3; t < e.length; t++)
1141
+ if (e[t] === "-" && e[t + 1] === "-" && e[t + 2] === ">") {
1142
+ t += 2;
1143
+ break;
1144
+ }
1145
+ } else if (e.length > t + 8 && e[t + 1] === "D" && e[t + 2] === "O" && e[t + 3] === "C" && e[t + 4] === "T" && e[t + 5] === "Y" && e[t + 6] === "P" && e[t + 7] === "E") {
1146
+ let r = 1;
1147
+ for (t += 8; t < e.length; t++)
1148
+ if (e[t] === "<")
1149
+ r++;
1150
+ else if (e[t] === ">" && (r--, r === 0))
1151
+ break;
1152
+ } else if (e.length > t + 9 && e[t + 1] === "[" && e[t + 2] === "C" && e[t + 3] === "D" && e[t + 4] === "A" && e[t + 5] === "T" && e[t + 6] === "A" && e[t + 7] === "[") {
1153
+ for (t += 8; t < e.length; t++)
1154
+ if (e[t] === "]" && e[t + 1] === "]" && e[t + 2] === ">") {
1155
+ t += 2;
1156
+ break;
1157
+ }
1158
+ }
1159
+ return t;
1160
+ }
1161
+ const Re = '"', Me = "'";
1162
+ function Be(e, t) {
1163
+ let r = "", s = "", n = !1;
1164
+ for (; t < e.length; t++) {
1165
+ if (e[t] === Re || e[t] === Me)
1166
+ s === "" ? s = e[t] : s !== e[t] || (s = "");
1167
+ else if (e[t] === ">" && s === "") {
1168
+ n = !0;
1169
+ break;
1170
+ }
1171
+ r += e[t];
1172
+ }
1173
+ return s !== "" ? !1 : {
1174
+ value: r,
1175
+ index: t,
1176
+ tagClosed: n
1177
+ };
1178
+ }
1179
+ const ke = new RegExp(`(\\s*)([^\\s=]+)(\\s*=)?(\\s*(['"])(([\\s\\S])*?)\\5)?`, "g");
1180
+ function Q(e, t) {
1181
+ const r = H.getAllMatches(e, ke), s = {};
1182
+ for (let n = 0; n < r.length; n++) {
1183
+ if (r[n][1].length === 0)
1184
+ return p("InvalidAttr", "Attribute '" + r[n][2] + "' has no space in starting.", I(r[n]));
1185
+ if (r[n][3] !== void 0 && r[n][4] === void 0)
1186
+ return p("InvalidAttr", "Attribute '" + r[n][2] + "' is without value.", I(r[n]));
1187
+ if (r[n][3] === void 0 && !t.allowBooleanAttributes)
1188
+ return p("InvalidAttr", "boolean attribute '" + r[n][2] + "' is not allowed.", I(r[n]));
1189
+ const i = r[n][2];
1190
+ if (!Xe(i))
1191
+ return p("InvalidAttr", "Attribute '" + i + "' is an invalid name.", I(r[n]));
1192
+ if (!s.hasOwnProperty(i))
1193
+ s[i] = 1;
1194
+ else
1195
+ return p("InvalidAttr", "Attribute '" + i + "' is repeated.", I(r[n]));
1196
+ }
1197
+ return !0;
1198
+ }
1199
+ function qe(e, t) {
1200
+ let r = /\d/;
1201
+ for (e[t] === "x" && (t++, r = /[\da-fA-F]/); t < e.length; t++) {
1202
+ if (e[t] === ";")
1203
+ return t;
1204
+ if (!e[t].match(r))
1205
+ break;
1206
+ }
1207
+ return -1;
1208
+ }
1209
+ function Ue(e, t) {
1210
+ if (t++, e[t] === ";")
1211
+ return -1;
1212
+ if (e[t] === "#")
1213
+ return t++, qe(e, t);
1214
+ let r = 0;
1215
+ for (; t < e.length; t++, r++)
1216
+ if (!(e[t].match(/\w/) && r < 20)) {
1217
+ if (e[t] === ";")
1218
+ break;
1219
+ return -1;
1220
+ }
1221
+ return t;
1222
+ }
1223
+ function p(e, t, r) {
1224
+ return {
1225
+ err: {
1226
+ code: e,
1227
+ msg: t,
1228
+ line: r.line || r,
1229
+ col: r.col
1230
+ }
1231
+ };
1232
+ }
1233
+ function Xe(e) {
1234
+ return H.isName(e);
1235
+ }
1236
+ function Ge(e) {
1237
+ return H.isName(e);
1238
+ }
1239
+ function w(e, t) {
1240
+ const r = e.substring(0, t).split(/\r?\n/);
1241
+ return {
1242
+ line: r.length,
1243
+ // column number is last line's length + 1, because column numbering starts at 1:
1244
+ col: r[r.length - 1].length + 1
1245
+ };
1246
+ }
1247
+ function I(e) {
1248
+ return e.startIndex + e[1].length;
1249
+ }
1250
+ var z = {};
1251
+ const de = {
1252
+ preserveOrder: !1,
1253
+ attributeNamePrefix: "@_",
1254
+ attributesGroupName: !1,
1255
+ textNodeName: "#text",
1256
+ ignoreAttributes: !0,
1257
+ removeNSPrefix: !1,
1258
+ // remove NS from tag name or attribute name if true
1259
+ allowBooleanAttributes: !1,
1260
+ //a tag can have attributes without any value
1261
+ //ignoreRootElement : false,
1262
+ parseTagValue: !0,
1263
+ parseAttributeValue: !1,
1264
+ trimValues: !0,
1265
+ //Trim string values of tag and attributes
1266
+ cdataPropName: !1,
1267
+ numberParseOptions: {
1268
+ hex: !0,
1269
+ leadingZeros: !0,
1270
+ eNotation: !0
1271
+ },
1272
+ tagValueProcessor: function(e, t) {
1273
+ return t;
1274
+ },
1275
+ attributeValueProcessor: function(e, t) {
1276
+ return t;
1277
+ },
1278
+ stopNodes: [],
1279
+ //nested tags will not be parsed even for errors
1280
+ alwaysCreateTextNode: !1,
1281
+ isArray: () => !1,
1282
+ commentPropName: !1,
1283
+ unpairedTags: [],
1284
+ processEntities: !0,
1285
+ htmlEntities: !1,
1286
+ ignoreDeclaration: !1,
1287
+ ignorePiTags: !1,
1288
+ transformTagName: !1,
1289
+ transformAttributeName: !1,
1290
+ updateTag: function(e, t, r) {
1291
+ return e;
1292
+ }
1293
+ // skipEmptyListItem: false
1294
+ }, He = function(e) {
1295
+ return Object.assign({}, de, e);
1296
+ };
1297
+ z.buildOptions = He;
1298
+ z.defaultOptions = de;
1299
+ class ze {
1300
+ constructor(t) {
1301
+ this.tagname = t, this.child = [], this[":@"] = {};
1302
+ }
1303
+ add(t, r) {
1304
+ t === "__proto__" && (t = "#__proto__"), this.child.push({ [t]: r });
1305
+ }
1306
+ addChild(t) {
1307
+ 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 });
1308
+ }
1309
+ }
1310
+ var Ke = ze;
1311
+ const We = F;
1312
+ function Ze(e, t) {
1313
+ const r = {};
1314
+ if (e[t + 3] === "O" && e[t + 4] === "C" && e[t + 5] === "T" && e[t + 6] === "Y" && e[t + 7] === "P" && e[t + 8] === "E") {
1315
+ t = t + 9;
1316
+ let s = 1, n = !1, i = !1, a = "";
1317
+ for (; t < e.length; t++)
1318
+ if (e[t] === "<" && !i) {
1319
+ if (n && Je(e, t))
1320
+ t += 7, [entityName, val, t] = je(e, t + 1), val.indexOf("&") === -1 && (r[tt(entityName)] = {
1321
+ regx: RegExp(`&${entityName};`, "g"),
1322
+ val
1323
+ });
1324
+ else if (n && Qe(e, t))
1325
+ t += 8;
1326
+ else if (n && De(e, t))
1327
+ t += 8;
1328
+ else if (n && et(e, t))
1329
+ t += 9;
1330
+ else if (Ye)
1331
+ i = !0;
1332
+ else
1333
+ throw new Error("Invalid DOCTYPE");
1334
+ s++, a = "";
1335
+ } else if (e[t] === ">") {
1336
+ if (i ? e[t - 1] === "-" && e[t - 2] === "-" && (i = !1, s--) : s--, s === 0)
1337
+ break;
1338
+ } else
1339
+ e[t] === "[" ? n = !0 : a += e[t];
1340
+ if (s !== 0)
1341
+ throw new Error("Unclosed DOCTYPE");
1342
+ } else
1343
+ throw new Error("Invalid Tag instead of DOCTYPE");
1344
+ return { entities: r, i: t };
1345
+ }
1346
+ function je(e, t) {
1347
+ let r = "";
1348
+ for (; t < e.length && e[t] !== "'" && e[t] !== '"'; t++)
1349
+ r += e[t];
1350
+ if (r = r.trim(), r.indexOf(" ") !== -1)
1351
+ throw new Error("External entites are not supported");
1352
+ const s = e[t++];
1353
+ let n = "";
1354
+ for (; t < e.length && e[t] !== s; t++)
1355
+ n += e[t];
1356
+ return [r, n, t];
1357
+ }
1358
+ function Ye(e, t) {
1359
+ return e[t + 1] === "!" && e[t + 2] === "-" && e[t + 3] === "-";
1360
+ }
1361
+ function Je(e, t) {
1362
+ return e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "N" && e[t + 4] === "T" && e[t + 5] === "I" && e[t + 6] === "T" && e[t + 7] === "Y";
1363
+ }
1364
+ function Qe(e, t) {
1365
+ return e[t + 1] === "!" && e[t + 2] === "E" && e[t + 3] === "L" && e[t + 4] === "E" && e[t + 5] === "M" && e[t + 6] === "E" && e[t + 7] === "N" && e[t + 8] === "T";
1366
+ }
1367
+ function De(e, t) {
1368
+ return e[t + 1] === "!" && e[t + 2] === "A" && e[t + 3] === "T" && e[t + 4] === "T" && e[t + 5] === "L" && e[t + 6] === "I" && e[t + 7] === "S" && e[t + 8] === "T";
1369
+ }
1370
+ function et(e, t) {
1371
+ return e[t + 1] === "!" && e[t + 2] === "N" && e[t + 3] === "O" && e[t + 4] === "T" && e[t + 5] === "A" && e[t + 6] === "T" && e[t + 7] === "I" && e[t + 8] === "O" && e[t + 9] === "N";
1372
+ }
1373
+ function tt(e) {
1374
+ if (We.isName(e))
1375
+ return e;
1376
+ throw new Error(`Invalid entity name ${e}`);
1377
+ }
1378
+ var rt = Ze;
1379
+ const nt = /^[-+]?0x[a-fA-F0-9]+$/, it = /^([\-\+])?(0*)(\.[0-9]+([eE]\-?[0-9]+)?|[0-9]+(\.[0-9]+([eE]\-?[0-9]+)?)?)$/;
1380
+ !Number.parseInt && window.parseInt && (Number.parseInt = window.parseInt);
1381
+ !Number.parseFloat && window.parseFloat && (Number.parseFloat = window.parseFloat);
1382
+ const st = {
1383
+ hex: !0,
1384
+ leadingZeros: !0,
1385
+ decimalPoint: ".",
1386
+ eNotation: !0
1387
+ //skipLike: /regex/
1388
+ };
1389
+ function ot(e, t = {}) {
1390
+ if (t = Object.assign({}, st, t), !e || typeof e != "string")
1391
+ return e;
1392
+ let r = e.trim();
1393
+ if (t.skipLike !== void 0 && t.skipLike.test(r))
1394
+ return e;
1395
+ if (t.hex && nt.test(r))
1396
+ return Number.parseInt(r, 16);
1397
+ {
1398
+ const s = it.exec(r);
1399
+ if (s) {
1400
+ const n = s[1], i = s[2];
1401
+ let a = ut(s[3]);
1402
+ const u = s[4] || s[6];
1403
+ if (!t.leadingZeros && i.length > 0 && n && r[2] !== ".")
1404
+ return e;
1405
+ if (!t.leadingZeros && i.length > 0 && !n && r[1] !== ".")
1406
+ return e;
1407
+ {
1408
+ const o = Number(r), d = "" + o;
1409
+ return d.search(/[eE]/) !== -1 || u ? t.eNotation ? o : e : r.indexOf(".") !== -1 ? d === "0" && a === "" || d === a || n && d === "-" + a ? o : e : i ? a === d || n + a === d ? o : e : r === d || r === n + d ? o : e;
1410
+ }
1411
+ } else
1412
+ return e;
1413
+ }
1414
+ }
1415
+ function ut(e) {
1416
+ return e && e.indexOf(".") !== -1 && (e = e.replace(/0+$/, ""), e === "." ? e = "0" : e[0] === "." ? e = "0" + e : e[e.length - 1] === "." && (e = e.substr(0, e.length - 1))), e;
1417
+ }
1418
+ var at = ot;
1419
+ const le = F, A = Ke, dt = rt, lt = at;
1420
+ let ft = class {
1421
+ constructor(t) {
1422
+ this.options = t, this.currentNode = null, this.tagsNodeStack = [], this.docTypeEntities = {}, this.lastEntities = {
1423
+ apos: { regex: /&(apos|#39|#x27);/g, val: "'" },
1424
+ gt: { regex: /&(gt|#62|#x3E);/g, val: ">" },
1425
+ lt: { regex: /&(lt|#60|#x3C);/g, val: "<" },
1426
+ quot: { regex: /&(quot|#34|#x22);/g, val: '"' }
1427
+ }, this.ampEntity = { regex: /&(amp|#38|#x26);/g, val: "&" }, this.htmlEntities = {
1428
+ space: { regex: /&(nbsp|#160);/g, val: " " },
1429
+ // "lt" : { regex: /&(lt|#60);/g, val: "<" },
1430
+ // "gt" : { regex: /&(gt|#62);/g, val: ">" },
1431
+ // "amp" : { regex: /&(amp|#38);/g, val: "&" },
1432
+ // "quot" : { regex: /&(quot|#34);/g, val: "\"" },
1433
+ // "apos" : { regex: /&(apos|#39);/g, val: "'" },
1434
+ cent: { regex: /&(cent|#162);/g, val: "¢" },
1435
+ pound: { regex: /&(pound|#163);/g, val: "£" },
1436
+ yen: { regex: /&(yen|#165);/g, val: "¥" },
1437
+ euro: { regex: /&(euro|#8364);/g, val: "€" },
1438
+ copyright: { regex: /&(copy|#169);/g, val: "©" },
1439
+ reg: { regex: /&(reg|#174);/g, val: "®" },
1440
+ inr: { regex: /&(inr|#8377);/g, val: "₹" }
1441
+ }, this.addExternalEntities = ct, this.parseXml = mt, this.parseTextData = ht, this.resolveNameSpace = pt, this.buildAttributesMap = wt, this.isItStopNode = bt, this.replaceEntitiesValue = Et, this.readStopNodeData = _t, this.saveTextToParentTag = yt, this.addChild = Nt;
1442
+ }
1443
+ };
1444
+ function ct(e) {
1445
+ const t = Object.keys(e);
1446
+ for (let r = 0; r < t.length; r++) {
1447
+ const s = t[r];
1448
+ this.lastEntities[s] = {
1449
+ regex: new RegExp("&" + s + ";", "g"),
1450
+ val: e[s]
1451
+ };
1452
+ }
1453
+ }
1454
+ function ht(e, t, r, s, n, i, a) {
1455
+ if (e !== void 0 && (this.options.trimValues && !s && (e = e.trim()), e.length > 0)) {
1456
+ a || (e = this.replaceEntitiesValue(e));
1457
+ const u = this.options.tagValueProcessor(t, e, r, n, i);
1458
+ return u == null ? e : typeof u != typeof e || u !== e ? u : this.options.trimValues ? S(e, this.options.parseTagValue, this.options.numberParseOptions) : e.trim() === e ? S(e, this.options.parseTagValue, this.options.numberParseOptions) : e;
1459
+ }
1460
+ }
1461
+ function pt(e) {
1462
+ if (this.options.removeNSPrefix) {
1463
+ const t = e.split(":"), r = e.charAt(0) === "/" ? "/" : "";
1464
+ if (t[0] === "xmlns")
1465
+ return "";
1466
+ t.length === 2 && (e = r + t[1]);
1467
+ }
1468
+ return e;
1469
+ }
1470
+ const gt = new RegExp(`([^\\s=]+)\\s*(=\\s*(['"])([\\s\\S]*?)\\3)?`, "gm");
1471
+ function wt(e, t, r) {
1472
+ if (!this.options.ignoreAttributes && typeof e == "string") {
1473
+ const s = le.getAllMatches(e, gt), n = s.length, i = {};
1474
+ for (let a = 0; a < n; a++) {
1475
+ const u = this.resolveNameSpace(s[a][1]);
1476
+ let o = s[a][4], d = this.options.attributeNamePrefix + u;
1477
+ if (u.length)
1478
+ if (this.options.transformAttributeName && (d = this.options.transformAttributeName(d)), d === "__proto__" && (d = "#__proto__"), o !== void 0) {
1479
+ this.options.trimValues && (o = o.trim()), o = this.replaceEntitiesValue(o);
1480
+ const l = this.options.attributeValueProcessor(u, o, t);
1481
+ l == null ? i[d] = o : typeof l != typeof o || l !== o ? i[d] = l : i[d] = S(
1482
+ o,
1483
+ this.options.parseAttributeValue,
1484
+ this.options.numberParseOptions
1485
+ );
1486
+ } else
1487
+ this.options.allowBooleanAttributes && (i[d] = !0);
1488
+ }
1489
+ if (!Object.keys(i).length)
1490
+ return;
1491
+ if (this.options.attributesGroupName) {
1492
+ const a = {};
1493
+ return a[this.options.attributesGroupName] = i, a;
1494
+ }
1495
+ return i;
1496
+ }
1497
+ }
1498
+ const mt = function(e) {
1499
+ e = e.replace(/\r\n?/g, `
1500
+ `);
1501
+ const t = new A("!xml");
1502
+ let r = t, s = "", n = "";
1503
+ for (let i = 0; i < e.length; i++)
1504
+ if (e[i] === "<")
1505
+ if (e[i + 1] === "/") {
1506
+ const u = v(e, ">", i, "Closing Tag is not closed.");
1507
+ let o = e.substring(i + 2, u).trim();
1508
+ if (this.options.removeNSPrefix) {
1509
+ const f = o.indexOf(":");
1510
+ f !== -1 && (o = o.substr(f + 1));
1511
+ }
1512
+ this.options.transformTagName && (o = this.options.transformTagName(o)), r && (s = this.saveTextToParentTag(s, r, n));
1513
+ const d = n.substring(n.lastIndexOf(".") + 1);
1514
+ if (o && this.options.unpairedTags.indexOf(o) !== -1)
1515
+ throw new Error(`Unpaired tag can not be used as closing tag: </${o}>`);
1516
+ let l = 0;
1517
+ d && this.options.unpairedTags.indexOf(d) !== -1 ? (l = n.lastIndexOf(".", n.lastIndexOf(".") - 1), this.tagsNodeStack.pop()) : l = n.lastIndexOf("."), n = n.substring(0, l), r = this.tagsNodeStack.pop(), s = "", i = u;
1518
+ } else if (e[i + 1] === "?") {
1519
+ let u = V(e, i, !1, "?>");
1520
+ if (!u)
1521
+ throw new Error("Pi Tag is not closed.");
1522
+ if (s = this.saveTextToParentTag(s, r, n), !(this.options.ignoreDeclaration && u.tagName === "?xml" || this.options.ignorePiTags)) {
1523
+ const o = new A(u.tagName);
1524
+ o.add(this.options.textNodeName, ""), u.tagName !== u.tagExp && u.attrExpPresent && (o[":@"] = this.buildAttributesMap(u.tagExp, n, u.tagName)), this.addChild(r, o, n);
1525
+ }
1526
+ i = u.closeIndex + 1;
1527
+ } else if (e.substr(i + 1, 3) === "!--") {
1528
+ const u = v(e, "-->", i + 4, "Comment is not closed.");
1529
+ if (this.options.commentPropName) {
1530
+ const o = e.substring(i + 4, u - 2);
1531
+ s = this.saveTextToParentTag(s, r, n), r.add(this.options.commentPropName, [{ [this.options.textNodeName]: o }]);
1532
+ }
1533
+ i = u;
1534
+ } else if (e.substr(i + 1, 2) === "!D") {
1535
+ const u = dt(e, i);
1536
+ this.docTypeEntities = u.entities, i = u.i;
1537
+ } else if (e.substr(i + 1, 2) === "![") {
1538
+ const u = v(e, "]]>", i, "CDATA is not closed.") - 2, o = e.substring(i + 9, u);
1539
+ s = this.saveTextToParentTag(s, r, n);
1540
+ let d = this.parseTextData(o, r.tagname, n, !0, !1, !0, !0);
1541
+ d == null && (d = ""), this.options.cdataPropName ? r.add(this.options.cdataPropName, [{ [this.options.textNodeName]: o }]) : r.add(this.options.textNodeName, d), i = u + 2;
1542
+ } else {
1543
+ let u = V(e, i, this.options.removeNSPrefix), o = u.tagName;
1544
+ const d = u.rawTagName;
1545
+ let l = u.tagExp, f = u.attrExpPresent, c = u.closeIndex;
1546
+ this.options.transformTagName && (o = this.options.transformTagName(o)), r && s && r.tagname !== "!xml" && (s = this.saveTextToParentTag(s, r, n, !1));
1547
+ const g = r;
1548
+ if (g && this.options.unpairedTags.indexOf(g.tagname) !== -1 && (r = this.tagsNodeStack.pop(), n = n.substring(0, n.lastIndexOf("."))), o !== t.tagname && (n += n ? "." + o : o), this.isItStopNode(this.options.stopNodes, n, o)) {
1549
+ let h = "";
1550
+ if (l.length > 0 && l.lastIndexOf("/") === l.length - 1)
1551
+ i = u.closeIndex;
1552
+ else if (this.options.unpairedTags.indexOf(o) !== -1)
1553
+ i = u.closeIndex;
1554
+ else {
1555
+ const E = this.readStopNodeData(e, d, c + 1);
1556
+ if (!E)
1557
+ throw new Error(`Unexpected end of ${d}`);
1558
+ i = E.i, h = E.tagContent;
1559
+ }
1560
+ const T = new A(o);
1561
+ o !== l && f && (T[":@"] = this.buildAttributesMap(l, n, o)), h && (h = this.parseTextData(h, o, n, !0, f, !0, !0)), n = n.substr(0, n.lastIndexOf(".")), T.add(this.options.textNodeName, h), this.addChild(r, T, n);
1562
+ } else {
1563
+ if (l.length > 0 && l.lastIndexOf("/") === l.length - 1) {
1564
+ o[o.length - 1] === "/" ? (o = o.substr(0, o.length - 1), n = n.substr(0, n.length - 1), l = o) : l = l.substr(0, l.length - 1), this.options.transformTagName && (o = this.options.transformTagName(o));
1565
+ const h = new A(o);
1566
+ o !== l && f && (h[":@"] = this.buildAttributesMap(l, n, o)), this.addChild(r, h, n), n = n.substr(0, n.lastIndexOf("."));
1567
+ } else {
1568
+ const h = new A(o);
1569
+ this.tagsNodeStack.push(r), o !== l && f && (h[":@"] = this.buildAttributesMap(l, n, o)), this.addChild(r, h, n), r = h;
1570
+ }
1571
+ s = "", i = c;
1572
+ }
1573
+ }
1574
+ else
1575
+ s += e[i];
1576
+ return t.child;
1577
+ };
1578
+ function Nt(e, t, r) {
1579
+ const s = this.options.updateTag(t.tagname, r, t[":@"]);
1580
+ s === !1 || (typeof s == "string" && (t.tagname = s), e.addChild(t));
1581
+ }
1582
+ const Et = function(e) {
1583
+ if (this.options.processEntities) {
1584
+ for (let t in this.docTypeEntities) {
1585
+ const r = this.docTypeEntities[t];
1586
+ e = e.replace(r.regx, r.val);
1587
+ }
1588
+ for (let t in this.lastEntities) {
1589
+ const r = this.lastEntities[t];
1590
+ e = e.replace(r.regex, r.val);
1591
+ }
1592
+ if (this.options.htmlEntities)
1593
+ for (let t in this.htmlEntities) {
1594
+ const r = this.htmlEntities[t];
1595
+ e = e.replace(r.regex, r.val);
1596
+ }
1597
+ e = e.replace(this.ampEntity.regex, this.ampEntity.val);
1598
+ }
1599
+ return e;
1600
+ };
1601
+ function yt(e, t, r, s) {
1602
+ return e && (s === void 0 && (s = Object.keys(t.child).length === 0), e = this.parseTextData(
1603
+ e,
1604
+ t.tagname,
1605
+ r,
1606
+ !1,
1607
+ t[":@"] ? Object.keys(t[":@"]).length !== 0 : !1,
1608
+ s
1609
+ ), e !== void 0 && e !== "" && t.add(this.options.textNodeName, e), e = ""), e;
1610
+ }
1611
+ function bt(e, t, r) {
1612
+ const s = "*." + r;
1613
+ for (const n in e) {
1614
+ const i = e[n];
1615
+ if (s === i || t === i)
1616
+ return !0;
1617
+ }
1618
+ return !1;
1619
+ }
1620
+ function vt(e, t, r = ">") {
1621
+ let s, n = "";
1622
+ for (let i = t; i < e.length; i++) {
1623
+ let a = e[i];
1624
+ if (s)
1625
+ a === s && (s = "");
1626
+ else if (a === '"' || a === "'")
1627
+ s = a;
1628
+ else if (a === r[0])
1629
+ if (r[1]) {
1630
+ if (e[i + 1] === r[1])
1631
+ return {
1632
+ data: n,
1633
+ index: i
1634
+ };
1635
+ } else
1636
+ return {
1637
+ data: n,
1638
+ index: i
1639
+ };
1640
+ else
1641
+ a === " " && (a = " ");
1642
+ n += a;
1643
+ }
1644
+ }
1645
+ function v(e, t, r, s) {
1646
+ const n = e.indexOf(t, r);
1647
+ if (n === -1)
1648
+ throw new Error(s);
1649
+ return n + t.length - 1;
1650
+ }
1651
+ function V(e, t, r, s = ">") {
1652
+ const n = vt(e, t + 1, s);
1653
+ if (!n)
1654
+ return;
1655
+ let i = n.data;
1656
+ const a = n.index, u = i.search(/\s/);
1657
+ let o = i, d = !0;
1658
+ u !== -1 && (o = i.substring(0, u), i = i.substring(u + 1).trimStart());
1659
+ const l = o;
1660
+ if (r) {
1661
+ const f = o.indexOf(":");
1662
+ f !== -1 && (o = o.substr(f + 1), d = o !== n.data.substr(f + 1));
1663
+ }
1664
+ return {
1665
+ tagName: o,
1666
+ tagExp: i,
1667
+ closeIndex: a,
1668
+ attrExpPresent: d,
1669
+ rawTagName: l
1670
+ };
1671
+ }
1672
+ function _t(e, t, r) {
1673
+ const s = r;
1674
+ let n = 1;
1675
+ for (; r < e.length; r++)
1676
+ if (e[r] === "<")
1677
+ if (e[r + 1] === "/") {
1678
+ const i = v(e, ">", r, `${t} is not closed`);
1679
+ if (e.substring(r + 2, i).trim() === t && (n--, n === 0))
1680
+ return {
1681
+ tagContent: e.substring(s, r),
1682
+ i
1683
+ };
1684
+ r = i;
1685
+ } else if (e[r + 1] === "?")
1686
+ r = v(e, "?>", r + 1, "StopNode is not closed.");
1687
+ else if (e.substr(r + 1, 3) === "!--")
1688
+ r = v(e, "-->", r + 3, "StopNode is not closed.");
1689
+ else if (e.substr(r + 1, 2) === "![")
1690
+ r = v(e, "]]>", r, "StopNode is not closed.") - 2;
1691
+ else {
1692
+ const i = V(e, r, ">");
1693
+ i && ((i && i.tagName) === t && i.tagExp[i.tagExp.length - 1] !== "/" && n++, r = i.closeIndex);
1694
+ }
1695
+ }
1696
+ function S(e, t, r) {
1697
+ if (t && typeof e == "string") {
1698
+ const s = e.trim();
1699
+ return s === "true" ? !0 : s === "false" ? !1 : lt(e, r);
1700
+ } else
1701
+ return le.isExist(e) ? e : "";
1702
+ }
1703
+ var Tt = ft, fe = {};
1704
+ function It(e, t) {
1705
+ return ce(e, t);
1706
+ }
1707
+ function ce(e, t, r) {
1708
+ let s;
1709
+ const n = {};
1710
+ for (let i = 0; i < e.length; i++) {
1711
+ const a = e[i], u = At(a);
1712
+ let o = "";
1713
+ if (r === void 0 ? o = u : o = r + "." + u, u === t.textNodeName)
1714
+ s === void 0 ? s = a[u] : s += "" + a[u];
1715
+ else {
1716
+ if (u === void 0)
1717
+ continue;
1718
+ if (a[u]) {
1719
+ let d = ce(a[u], t, o);
1720
+ const l = Ot(d, t);
1721
+ a[":@"] ? Pt(d, a[":@"], o, t) : Object.keys(d).length === 1 && d[t.textNodeName] !== void 0 && !t.alwaysCreateTextNode ? d = d[t.textNodeName] : Object.keys(d).length === 0 && (t.alwaysCreateTextNode ? d[t.textNodeName] = "" : d = ""), n[u] !== void 0 && n.hasOwnProperty(u) ? (Array.isArray(n[u]) || (n[u] = [n[u]]), n[u].push(d)) : t.isArray(u, o, l) ? n[u] = [d] : n[u] = d;
1722
+ }
1723
+ }
1724
+ }
1725
+ return typeof s == "string" ? s.length > 0 && (n[t.textNodeName] = s) : s !== void 0 && (n[t.textNodeName] = s), n;
1726
+ }
1727
+ function At(e) {
1728
+ const t = Object.keys(e);
1729
+ for (let r = 0; r < t.length; r++) {
1730
+ const s = t[r];
1731
+ if (s !== ":@")
1732
+ return s;
1733
+ }
1734
+ }
1735
+ function Pt(e, t, r, s) {
1736
+ if (t) {
1737
+ const n = Object.keys(t), i = n.length;
1738
+ for (let a = 0; a < i; a++) {
1739
+ const u = n[a];
1740
+ s.isArray(u, r + "." + u, !0, !0) ? e[u] = [t[u]] : e[u] = t[u];
1741
+ }
1742
+ }
1743
+ }
1744
+ function Ot(e, t) {
1745
+ const { textNodeName: r } = t, s = Object.keys(e).length;
1746
+ return !!(s === 0 || s === 1 && (e[r] || typeof e[r] == "boolean" || e[r] === 0));
1747
+ }
1748
+ fe.prettify = It;
1749
+ const { buildOptions: Ct } = z, Ft = Tt, { prettify: xt } = fe, $t = G;
1750
+ let Vt = class {
1751
+ constructor(t) {
1752
+ this.externalEntities = {}, this.options = Ct(t);
1753
+ }
1754
+ /**
1755
+ * Parse XML dats to JS object
1756
+ * @param {string|Buffer} xmlData
1757
+ * @param {boolean|Object} validationOption
1758
+ */
1759
+ parse(t, r) {
1760
+ if (typeof t != "string")
1761
+ if (t.toString)
1762
+ t = t.toString();
1763
+ else
1764
+ throw new Error("XML data is accepted in String or Bytes[] form.");
1765
+ if (r) {
1766
+ r === !0 && (r = {});
1767
+ const i = $t.validate(t, r);
1768
+ if (i !== !0)
1769
+ throw Error(`${i.err.msg}:${i.err.line}:${i.err.col}`);
1770
+ }
1771
+ const s = new Ft(this.options);
1772
+ s.addExternalEntities(this.externalEntities);
1773
+ const n = s.parseXml(t);
1774
+ return this.options.preserveOrder || n === void 0 ? n : xt(n, this.options);
1775
+ }
1776
+ /**
1777
+ * Add Entity which is not by default supported by this library
1778
+ * @param {string} key
1779
+ * @param {string} value
1780
+ */
1781
+ addEntity(t, r) {
1782
+ if (r.indexOf("&") !== -1)
1783
+ throw new Error("Entity value can't have '&'");
1784
+ if (t.indexOf("&") !== -1 || t.indexOf(";") !== -1)
1785
+ throw new Error("An entity must be set without '&' and ';'. Eg. use '#xD' for '&#xD;'");
1786
+ if (r === "&")
1787
+ throw new Error("An entity with value '&' is not permitted");
1788
+ this.externalEntities[t] = r;
1789
+ }
1790
+ };
1791
+ var St = Vt;
1792
+ const Lt = `
1793
+ `;
1794
+ function Rt(e, t) {
1795
+ let r = "";
1796
+ return t.format && t.indentBy.length > 0 && (r = Lt), he(e, t, "", r);
1797
+ }
1798
+ function he(e, t, r, s) {
1799
+ let n = "", i = !1;
1800
+ for (let a = 0; a < e.length; a++) {
1801
+ const u = e[a], o = Mt(u);
1802
+ if (o === void 0)
1803
+ continue;
1804
+ let d = "";
1805
+ if (r.length === 0 ? d = o : d = `${r}.${o}`, o === t.textNodeName) {
1806
+ let h = u[o];
1807
+ Bt(d, t) || (h = t.tagValueProcessor(o, h), h = pe(h, t)), i && (n += s), n += h, i = !1;
1808
+ continue;
1809
+ } else if (o === t.cdataPropName) {
1810
+ i && (n += s), n += `<![CDATA[${u[o][0][t.textNodeName]}]]>`, i = !1;
1811
+ continue;
1812
+ } else if (o === t.commentPropName) {
1813
+ n += s + `<!--${u[o][0][t.textNodeName]}-->`, i = !0;
1814
+ continue;
1815
+ } else if (o[0] === "?") {
1816
+ const h = D(u[":@"], t), T = o === "?xml" ? "" : s;
1817
+ let E = u[o][0][t.textNodeName];
1818
+ E = E.length !== 0 ? " " + E : "", n += T + `<${o}${E}${h}?>`, i = !0;
1819
+ continue;
1820
+ }
1821
+ let l = s;
1822
+ l !== "" && (l += t.indentBy);
1823
+ const f = D(u[":@"], t), c = s + `<${o}${f}`, g = he(u[o], t, d, l);
1824
+ t.unpairedTags.indexOf(o) !== -1 ? t.suppressUnpairedNode ? n += c + ">" : n += c + "/>" : (!g || g.length === 0) && t.suppressEmptyNode ? n += c + "/>" : g && g.endsWith(">") ? n += c + `>${g}${s}</${o}>` : (n += c + ">", g && s !== "" && (g.includes("/>") || g.includes("</")) ? n += s + t.indentBy + g + s : n += g, n += `</${o}>`), i = !0;
1825
+ }
1826
+ return n;
1827
+ }
1828
+ function Mt(e) {
1829
+ const t = Object.keys(e);
1830
+ for (let r = 0; r < t.length; r++) {
1831
+ const s = t[r];
1832
+ if (e.hasOwnProperty(s) && s !== ":@")
1833
+ return s;
1834
+ }
1835
+ }
1836
+ function D(e, t) {
1837
+ let r = "";
1838
+ if (e && !t.ignoreAttributes)
1839
+ for (let s in e) {
1840
+ if (!e.hasOwnProperty(s))
1841
+ continue;
1842
+ let n = t.attributeValueProcessor(s, e[s]);
1843
+ n = pe(n, t), n === !0 && t.suppressBooleanAttributes ? r += ` ${s.substr(t.attributeNamePrefix.length)}` : r += ` ${s.substr(t.attributeNamePrefix.length)}="${n}"`;
1844
+ }
1845
+ return r;
1846
+ }
1847
+ function Bt(e, t) {
1848
+ e = e.substr(0, e.length - t.textNodeName.length - 1);
1849
+ let r = e.substr(e.lastIndexOf(".") + 1);
1850
+ for (let s in t.stopNodes)
1851
+ if (t.stopNodes[s] === e || t.stopNodes[s] === "*." + r)
1852
+ return !0;
1853
+ return !1;
1854
+ }
1855
+ function pe(e, t) {
1856
+ if (e && e.length > 0 && t.processEntities)
1857
+ for (let r = 0; r < t.entities.length; r++) {
1858
+ const s = t.entities[r];
1859
+ e = e.replace(s.regex, s.val);
1860
+ }
1861
+ return e;
1862
+ }
1863
+ var kt = Rt;
1864
+ const qt = kt, Ut = {
1865
+ attributeNamePrefix: "@_",
1866
+ attributesGroupName: !1,
1867
+ textNodeName: "#text",
1868
+ ignoreAttributes: !0,
1869
+ cdataPropName: !1,
1870
+ format: !1,
1871
+ indentBy: " ",
1872
+ suppressEmptyNode: !1,
1873
+ suppressUnpairedNode: !0,
1874
+ suppressBooleanAttributes: !0,
1875
+ tagValueProcessor: function(e, t) {
1876
+ return t;
1877
+ },
1878
+ attributeValueProcessor: function(e, t) {
1879
+ return t;
1880
+ },
1881
+ preserveOrder: !1,
1882
+ commentPropName: !1,
1883
+ unpairedTags: [],
1884
+ entities: [
1885
+ { regex: new RegExp("&", "g"), val: "&amp;" },
1886
+ //it must be on top
1887
+ { regex: new RegExp(">", "g"), val: "&gt;" },
1888
+ { regex: new RegExp("<", "g"), val: "&lt;" },
1889
+ { regex: new RegExp("'", "g"), val: "&apos;" },
1890
+ { regex: new RegExp('"', "g"), val: "&quot;" }
1891
+ ],
1892
+ processEntities: !0,
1893
+ stopNodes: [],
1894
+ // transformTagName: false,
1895
+ // transformAttributeName: false,
1896
+ oneListGroup: !1
1897
+ };
1898
+ function y(e) {
1899
+ this.options = Object.assign({}, Ut, e), this.options.ignoreAttributes || this.options.attributesGroupName ? this.isAttribute = function() {
1900
+ return !1;
1901
+ } : (this.attrPrefixLen = this.options.attributeNamePrefix.length, this.isAttribute = Ht), this.processTextOrObjNode = Xt, this.options.format ? (this.indentate = Gt, this.tagEndChar = `>
1902
+ `, this.newLine = `
1903
+ `) : (this.indentate = function() {
1904
+ return "";
1905
+ }, this.tagEndChar = ">", this.newLine = "");
1906
+ }
1907
+ y.prototype.build = function(e) {
1908
+ return this.options.preserveOrder ? qt(e, this.options) : (Array.isArray(e) && this.options.arrayNodeName && this.options.arrayNodeName.length > 1 && (e = {
1909
+ [this.options.arrayNodeName]: e
1910
+ }), this.j2x(e, 0).val);
1911
+ };
1912
+ y.prototype.j2x = function(e, t) {
1913
+ let r = "", s = "";
1914
+ for (let n in e)
1915
+ if (Object.prototype.hasOwnProperty.call(e, n))
1916
+ if (typeof e[n] > "u")
1917
+ this.isAttribute(n) && (s += "");
1918
+ else if (e[n] === null)
1919
+ this.isAttribute(n) ? s += "" : n[0] === "?" ? s += this.indentate(t) + "<" + n + "?" + this.tagEndChar : s += this.indentate(t) + "<" + n + "/" + this.tagEndChar;
1920
+ else if (e[n] instanceof Date)
1921
+ s += this.buildTextValNode(e[n], n, "", t);
1922
+ else if (typeof e[n] != "object") {
1923
+ const i = this.isAttribute(n);
1924
+ if (i)
1925
+ r += this.buildAttrPairStr(i, "" + e[n]);
1926
+ else if (n === this.options.textNodeName) {
1927
+ let a = this.options.tagValueProcessor(n, "" + e[n]);
1928
+ s += this.replaceEntitiesValue(a);
1929
+ } else
1930
+ s += this.buildTextValNode(e[n], n, "", t);
1931
+ } else if (Array.isArray(e[n])) {
1932
+ const i = e[n].length;
1933
+ let a = "";
1934
+ for (let u = 0; u < i; u++) {
1935
+ const o = e[n][u];
1936
+ typeof o > "u" || (o === null ? n[0] === "?" ? s += this.indentate(t) + "<" + n + "?" + this.tagEndChar : s += this.indentate(t) + "<" + n + "/" + this.tagEndChar : typeof o == "object" ? this.options.oneListGroup ? a += this.j2x(o, t + 1).val : a += this.processTextOrObjNode(o, n, t) : a += this.buildTextValNode(o, n, "", t));
1937
+ }
1938
+ this.options.oneListGroup && (a = this.buildObjectNode(a, n, "", t)), s += a;
1939
+ } else if (this.options.attributesGroupName && n === this.options.attributesGroupName) {
1940
+ const i = Object.keys(e[n]), a = i.length;
1941
+ for (let u = 0; u < a; u++)
1942
+ r += this.buildAttrPairStr(i[u], "" + e[n][i[u]]);
1943
+ } else
1944
+ s += this.processTextOrObjNode(e[n], n, t);
1945
+ return { attrStr: r, val: s };
1946
+ };
1947
+ y.prototype.buildAttrPairStr = function(e, t) {
1948
+ return t = this.options.attributeValueProcessor(e, "" + t), t = this.replaceEntitiesValue(t), this.options.suppressBooleanAttributes && t === "true" ? " " + e : " " + e + '="' + t + '"';
1949
+ };
1950
+ function Xt(e, t, r) {
1951
+ const s = this.j2x(e, r + 1);
1952
+ return e[this.options.textNodeName] !== void 0 && Object.keys(e).length === 1 ? this.buildTextValNode(e[this.options.textNodeName], t, s.attrStr, r) : this.buildObjectNode(s.val, t, s.attrStr, r);
1953
+ }
1954
+ y.prototype.buildObjectNode = function(e, t, r, s) {
1955
+ if (e === "")
1956
+ return t[0] === "?" ? this.indentate(s) + "<" + t + r + "?" + this.tagEndChar : this.indentate(s) + "<" + t + r + this.closeTag(t) + this.tagEndChar;
1957
+ {
1958
+ let n = "</" + t + this.tagEndChar, i = "";
1959
+ return t[0] === "?" && (i = "?", n = ""), (r || r === "") && e.indexOf("<") === -1 ? this.indentate(s) + "<" + t + r + i + ">" + e + n : this.options.commentPropName !== !1 && t === this.options.commentPropName && i.length === 0 ? this.indentate(s) + `<!--${e}-->` + this.newLine : this.indentate(s) + "<" + t + r + i + this.tagEndChar + e + this.indentate(s) + n;
1960
+ }
1961
+ };
1962
+ y.prototype.closeTag = function(e) {
1963
+ let t = "";
1964
+ return this.options.unpairedTags.indexOf(e) !== -1 ? this.options.suppressUnpairedNode || (t = "/") : this.options.suppressEmptyNode ? t = "/" : t = `></${e}`, t;
1965
+ };
1966
+ y.prototype.buildTextValNode = function(e, t, r, s) {
1967
+ if (this.options.cdataPropName !== !1 && t === this.options.cdataPropName)
1968
+ return this.indentate(s) + `<![CDATA[${e}]]>` + this.newLine;
1969
+ if (this.options.commentPropName !== !1 && t === this.options.commentPropName)
1970
+ return this.indentate(s) + `<!--${e}-->` + this.newLine;
1971
+ if (t[0] === "?")
1972
+ return this.indentate(s) + "<" + t + r + "?" + this.tagEndChar;
1973
+ {
1974
+ let n = this.options.tagValueProcessor(t, e);
1975
+ return n = this.replaceEntitiesValue(n), n === "" ? this.indentate(s) + "<" + t + r + this.closeTag(t) + this.tagEndChar : this.indentate(s) + "<" + t + r + ">" + n + "</" + t + this.tagEndChar;
1976
+ }
1977
+ };
1978
+ y.prototype.replaceEntitiesValue = function(e) {
1979
+ if (e && e.length > 0 && this.options.processEntities)
1980
+ for (let t = 0; t < this.options.entities.length; t++) {
1981
+ const r = this.options.entities[t];
1982
+ e = e.replace(r.regex, r.val);
1983
+ }
1984
+ return e;
1985
+ };
1986
+ function Gt(e) {
1987
+ return this.options.indentBy.repeat(e);
1988
+ }
1989
+ function Ht(e) {
1990
+ return e.startsWith(this.options.attributeNamePrefix) && e !== this.options.textNodeName ? e.substr(this.attrPrefixLen) : !1;
1991
+ }
1992
+ var zt = y;
1993
+ const Kt = G, Wt = St, Zt = zt;
1994
+ var ee = {
1995
+ XMLParser: Wt,
1996
+ XMLValidator: Kt,
1997
+ XMLBuilder: Zt
1998
+ };
1999
+ function jt(e) {
2000
+ if (typeof e != "string")
2001
+ throw new TypeError(`Expected a \`string\`, got \`${typeof e}\``);
2002
+ if (e = e.trim(), e.length === 0 || ee.XMLValidator.validate(e) !== !0)
2003
+ return !1;
2004
+ let t;
2005
+ const r = new ee.XMLParser();
2006
+ try {
2007
+ t = r.parse(e);
2008
+ } catch {
2009
+ return !1;
2010
+ }
2011
+ return !(!t || !("svg" in t));
2012
+ }
2013
+ /**
2014
+ * @copyright Copyright (c) 2022 John Molakvoæ <skjnldsv@protonmail.com>
2015
+ *
2016
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
2017
+ *
2018
+ * @license AGPL-3.0-or-later
2019
+ *
2020
+ * This program is free software: you can redistribute it and/or modify
2021
+ * it under the terms of the GNU Affero General Public License as
2022
+ * published by the Free Software Foundation, either version 3 of the
2023
+ * License, or (at your option) any later version.
2024
+ *
2025
+ * This program is distributed in the hope that it will be useful,
2026
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2027
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2028
+ * GNU Affero General Public License for more details.
2029
+ *
2030
+ * You should have received a copy of the GNU Affero General Public License
2031
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2032
+ *
2033
+ */
2034
+ class Yt {
2035
+ _view;
2036
+ constructor(t) {
2037
+ Jt(t), this._view = t;
2038
+ }
2039
+ get id() {
2040
+ return this._view.id;
2041
+ }
2042
+ get name() {
2043
+ return this._view.name;
2044
+ }
2045
+ get caption() {
2046
+ return this._view.caption;
2047
+ }
2048
+ get emptyTitle() {
2049
+ return this._view.emptyTitle;
2050
+ }
2051
+ get emptyCaption() {
2052
+ return this._view.emptyCaption;
2053
+ }
2054
+ get getContents() {
2055
+ return this._view.getContents;
2056
+ }
2057
+ get icon() {
2058
+ return this._view.icon;
2059
+ }
2060
+ set icon(t) {
2061
+ this._view.icon = t;
2062
+ }
2063
+ get order() {
2064
+ return this._view.order;
2065
+ }
2066
+ set order(t) {
2067
+ this._view.order = t;
2068
+ }
2069
+ get params() {
2070
+ return this._view.params;
2071
+ }
2072
+ set params(t) {
2073
+ this._view.params = t;
2074
+ }
2075
+ get columns() {
2076
+ return this._view.columns;
2077
+ }
2078
+ get emptyView() {
2079
+ return this._view.emptyView;
2080
+ }
2081
+ get parent() {
2082
+ return this._view.parent;
2083
+ }
2084
+ get sticky() {
2085
+ return this._view.sticky;
2086
+ }
2087
+ get expanded() {
2088
+ return this._view.expanded;
2089
+ }
2090
+ set expanded(t) {
2091
+ this._view.expanded = t;
2092
+ }
2093
+ get defaultSortKey() {
2094
+ return this._view.defaultSortKey;
2095
+ }
2096
+ }
2097
+ const Jt = function(e) {
2098
+ if (!e.id || typeof e.id != "string")
2099
+ throw new Error("View id is required and must be a string");
2100
+ if (!e.name || typeof e.name != "string")
2101
+ throw new Error("View name is required and must be a string");
2102
+ if (e.columns && e.columns.length > 0 && (!e.caption || typeof e.caption != "string"))
2103
+ throw new Error("View caption is required for top-level views and must be a string");
2104
+ if (!e.getContents || typeof e.getContents != "function")
2105
+ throw new Error("View getContents is required and must be a function");
2106
+ if (!e.icon || typeof e.icon != "string" || !jt(e.icon))
2107
+ throw new Error("View icon is required and must be a valid svg string");
2108
+ if (!("order" in e) || typeof e.order != "number")
2109
+ throw new Error("View order is required and must be a number");
2110
+ if (e.columns && e.columns.forEach((t) => {
2111
+ if (!(t instanceof ae))
2112
+ throw new Error("View columns must be an array of Column. Invalid column found");
2113
+ }), e.emptyView && typeof e.emptyView != "function")
2114
+ throw new Error("View emptyView must be a function");
2115
+ if (e.parent && typeof e.parent != "string")
2116
+ throw new Error("View parent must be a string");
2117
+ if ("sticky" in e && typeof e.sticky != "boolean")
2118
+ throw new Error("View sticky must be a boolean");
2119
+ if ("expanded" in e && typeof e.expanded != "boolean")
2120
+ throw new Error("View expanded must be a boolean");
2121
+ if (e.defaultSortKey && typeof e.defaultSortKey != "string")
2122
+ throw new Error("View defaultSortKey must be a string");
2123
+ return !0;
2124
+ };
2125
+ /**
2126
+ * @copyright 2019 Christoph Wurst <christoph@winzerhof-wurst.at>
2127
+ *
2128
+ * @author Christoph Wurst <christoph@winzerhof-wurst.at>
2129
+ * @author John Molakvoæ <skjnldsv@protonmail.com>
2130
+ *
2131
+ * @license AGPL-3.0-or-later
2132
+ *
2133
+ * This program is free software: you can redistribute it and/or modify
2134
+ * it under the terms of the GNU Affero General Public License as
2135
+ * published by the Free Software Foundation, either version 3 of the
2136
+ * License, or (at your option) any later version.
2137
+ *
2138
+ * This program is distributed in the hope that it will be useful,
2139
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
2140
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2141
+ * GNU Affero General Public License for more details.
2142
+ *
2143
+ * You should have received a copy of the GNU Affero General Public License
2144
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
2145
+ *
2146
+ */
2147
+ const Qt = function(e) {
2148
+ return L().registerEntry(e);
2149
+ }, Dt = function(e) {
2150
+ return L().unregisterEntry(e);
2151
+ }, er = function(e) {
2152
+ return L().getEntries(e).sort((r, s) => r.order !== void 0 && s.order !== void 0 && r.order !== s.order ? r.order - s.order : r.displayName.localeCompare(s.displayName, void 0, { numeric: !0, sensitivity: "base" }));
2153
+ };
2154
+ exports.Column = ae;
2155
+ exports.DefaultType = R;
2156
+ exports.File = ie;
2157
+ exports.FileAction = ve;
2158
+ exports.FileType = C;
2159
+ exports.Folder = se;
2160
+ exports.Header = Ie;
2161
+ exports.Navigation = ue;
2162
+ exports.Node = q;
2163
+ exports.NodeStatus = k;
2164
+ exports.Permission = m;
2165
+ exports.View = Yt;
2166
+ exports.addNewFileMenuEntry = Qt;
2167
+ exports.davGetClient = xe;
2168
+ exports.davGetDefaultPropfind = Ce;
2169
+ exports.davGetFavoritesReport = te;
2170
+ exports.davGetRecentSearch = Fe;
2171
+ exports.davParsePermissions = re;
2172
+ exports.davRemoteURL = X;
2173
+ exports.davResultToNode = oe;
2174
+ exports.davRootPath = U;
2175
+ exports.defaultDavNamespaces = B;
2176
+ exports.defaultDavProperties = M;
2177
+ exports.formatFileSize = ye;
2178
+ exports.getDavNameSpaces = O;
2179
+ exports.getDavProperties = P;
2180
+ exports.getFavoriteNodes = $e;
2181
+ exports.getFileActions = Te;
2182
+ exports.getFileListHeaders = Pe;
2183
+ exports.getNavigation = Ve;
2184
+ exports.getNewFileMenuEntries = er;
2185
+ exports.parseFileSize = be;
2186
+ exports.registerDavProperty = Oe;
2187
+ exports.registerFileAction = _e;
2188
+ exports.registerFileListHeaders = Ae;
2189
+ exports.removeNewFileMenuEntry = Dt;