@emailmaker/filemanager 1.1.84 → 1.1.85-dev.2
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/.build-meta.json +1 -1
- package/assets/icon-sets/lucide.json +6275 -0
- package/assets/icon-sets/tabler.json +19336 -0
- package/components/ImageIcons/iconSets.d.ts +36 -0
- package/components/ImageIcons/iconSets.test.d.ts +1 -0
- package/components/ImageIcons/iconStockSearch.d.ts +3 -1
- package/core.esm.js +239 -255
- package/core.js +1 -1
- package/file-manager-IconsTab.js +2044 -0
- package/{file-manager-ImageCodeGenerator-BGvqvt7G.js → file-manager-ImageCodeGenerator.js} +7 -7
- package/{file-manager-JsBarcode-CyaffT5b.js → file-manager-JsBarcode.js} +30 -30
- package/file-manager-PageLoader-C55pqnwT.js +24 -0
- package/{file-manager-PixieEditor-D-Cv1Ieh.js → file-manager-PixieEditor.js} +13 -10
- package/{file-manager-browser-DDyRNDQk.js → file-manager-browser.js} +8 -8
- package/{file-manager-hooks-DQggJnuP.js → file-manager-hooks-D9OOfpfX.js} +1855 -1853
- package/{file-manager-rolldown-runtime-DAVfCfog.js → file-manager-rolldown-runtime-DawGUBAG.js} +2 -2
- package/file-manager-urls-C8FU4GJ1.js +19 -0
- package/{file-manager-useMediaListEngine-ChZpHgET.js → file-manager-useMediaListEngine-B_YxvsBO.js} +4 -4
- package/file-manager.esm.js +378 -330
- package/file-manager.js +12 -12
- package/package.json +4 -1
- package/types.d.ts +7 -0
- package/utils/generateId.d.ts +5 -0
- package/file-manager-IconsTab-DUvutF2N.js +0 -2434
- package/file-manager-urls-DN9gaYil.js +0 -37
package/core.esm.js
CHANGED
|
@@ -168,74 +168,76 @@ function b(e) {
|
|
|
168
168
|
};
|
|
169
169
|
}
|
|
170
170
|
//#endregion
|
|
171
|
+
//#region packages/file-manager/src/utils/generateId.ts
|
|
172
|
+
function x() {
|
|
173
|
+
if (typeof globalThis?.crypto?.randomUUID == "function") return globalThis.crypto.randomUUID();
|
|
174
|
+
try {
|
|
175
|
+
let e = globalThis.crypto || globalThis.msCrypto;
|
|
176
|
+
if (e && typeof e.getRandomValues == "function") {
|
|
177
|
+
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
178
|
+
e.getRandomValues(t);
|
|
179
|
+
let n = "";
|
|
180
|
+
for (let e = 0; e < t.length; e++) n += t[e].toString(16).padStart(2, "0");
|
|
181
|
+
return `id_${n}`;
|
|
182
|
+
}
|
|
183
|
+
} catch {}
|
|
184
|
+
return `id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random() * (2 ** 53 - 1)).toString(36).slice(0, 8)}`;
|
|
185
|
+
}
|
|
186
|
+
//#endregion
|
|
171
187
|
//#region packages/file-manager/src/utils/urlNormalization.ts
|
|
172
|
-
var
|
|
173
|
-
function
|
|
188
|
+
var S = /^(utm_[a-z0-9_]+|fbclid|gclid|igshid|mc_cid|mc_eid)$/i;
|
|
189
|
+
function C(e) {
|
|
174
190
|
try {
|
|
175
191
|
return decodeURIComponent(e.replace(/\+/g, " "));
|
|
176
192
|
} catch {
|
|
177
193
|
return e;
|
|
178
194
|
}
|
|
179
195
|
}
|
|
180
|
-
function
|
|
196
|
+
function w(e) {
|
|
181
197
|
let t = new URL(e.trim());
|
|
182
198
|
t.hash = "", t.hostname = t.hostname.toLowerCase(), (t.protocol === "https:" && t.port === "443" || t.protocol === "http:" && t.port === "80") && (t.port = "");
|
|
183
199
|
let n = (t.search.startsWith("?") ? t.search.slice(1) : t.search).split("&").filter(Boolean).map((e) => {
|
|
184
200
|
let t = e.indexOf("="), n = t === -1 ? e : e.slice(0, t), r = t === -1 ? "" : e.slice(t + 1);
|
|
185
201
|
return {
|
|
186
202
|
pair: e,
|
|
187
|
-
key:
|
|
188
|
-
value:
|
|
203
|
+
key: C(n),
|
|
204
|
+
value: C(r)
|
|
189
205
|
};
|
|
190
|
-
}).filter(({ key: e }) => !
|
|
206
|
+
}).filter(({ key: e }) => !S.test(e)).sort((e, t) => {
|
|
191
207
|
let n = e.key.localeCompare(t.key);
|
|
192
208
|
return n === 0 ? e.value.localeCompare(t.value) : n;
|
|
193
209
|
});
|
|
194
210
|
return t.search = n.length ? `?${n.map(({ pair: e }) => e).join("&")}` : "", t.toString();
|
|
195
211
|
}
|
|
196
|
-
function
|
|
212
|
+
function T(e) {
|
|
197
213
|
try {
|
|
198
|
-
return
|
|
214
|
+
return w(e);
|
|
199
215
|
} catch {
|
|
200
216
|
return e.trim();
|
|
201
217
|
}
|
|
202
218
|
}
|
|
203
219
|
//#endregion
|
|
204
220
|
//#region packages/file-manager/src/adapters/TreeCache.ts
|
|
205
|
-
var
|
|
206
|
-
function D(e) {
|
|
207
|
-
return e == null || e === "" ? T : e;
|
|
208
|
-
}
|
|
221
|
+
var E = "", D = 18e5;
|
|
209
222
|
function O(e) {
|
|
223
|
+
return e == null || e === "" ? E : e;
|
|
224
|
+
}
|
|
225
|
+
function k(e) {
|
|
210
226
|
if (e == null) return Infinity;
|
|
211
227
|
let t = Number(e);
|
|
212
228
|
return Number.isFinite(t) && t >= 0 ? t : Infinity;
|
|
213
229
|
}
|
|
214
|
-
function
|
|
230
|
+
function A(e) {
|
|
215
231
|
return !e || typeof e.search != "string" ? !1 : e.search.trim().length > 0;
|
|
216
232
|
}
|
|
217
|
-
function
|
|
233
|
+
function j(e) {
|
|
218
234
|
if (!e) return null;
|
|
219
235
|
let t = e.folderId;
|
|
220
236
|
return t == null ? null : String(t);
|
|
221
237
|
}
|
|
222
|
-
function
|
|
238
|
+
function M(e) {
|
|
223
239
|
return !!e && !!e.isFolder;
|
|
224
240
|
}
|
|
225
|
-
function M() {
|
|
226
|
-
if (typeof globalThis?.crypto?.randomUUID == "function") return globalThis.crypto.randomUUID();
|
|
227
|
-
try {
|
|
228
|
-
let e = globalThis.crypto || globalThis.msCrypto;
|
|
229
|
-
if (e && typeof e.getRandomValues == "function") {
|
|
230
|
-
let t = /* @__PURE__ */ new Uint8Array(16);
|
|
231
|
-
e.getRandomValues(t);
|
|
232
|
-
let n = "";
|
|
233
|
-
for (let e = 0; e < t.length; e++) n += t[e].toString(16).padStart(2, "0");
|
|
234
|
-
return `id_${n}`;
|
|
235
|
-
}
|
|
236
|
-
} catch {}
|
|
237
|
-
return `id_fallback_${Date.now().toString(36)}_${Math.floor(Math.random() * (2 ** 53 - 1)).toString(36).slice(0, 8)}`;
|
|
238
|
-
}
|
|
239
241
|
function N(e) {
|
|
240
242
|
if (!e || typeof e != "object") return !1;
|
|
241
243
|
let t = e;
|
|
@@ -288,32 +290,32 @@ var I = class e {
|
|
|
288
290
|
}
|
|
289
291
|
getFileSystemItem(e) {
|
|
290
292
|
let t = this.getEntity(e);
|
|
291
|
-
return t && !
|
|
293
|
+
return t && !M(t) ? t : void 0;
|
|
292
294
|
}
|
|
293
295
|
getFolder(e) {
|
|
294
296
|
let t = this.getEntity(e);
|
|
295
|
-
return t &&
|
|
297
|
+
return t && M(t) ? t : void 0;
|
|
296
298
|
}
|
|
297
299
|
getChildrenIds(e, t = {}) {
|
|
298
|
-
let n =
|
|
300
|
+
let n = O(e), r = this.childrenByParent.get(n);
|
|
299
301
|
return r ? t.onlyFileSystemItems ? Array.from(r.files) : t.onlyFolders ? Array.from(r.folders) : [...Array.from(r.folders), ...Array.from(r.files)] : [];
|
|
300
302
|
}
|
|
301
303
|
searchByUrl(e) {
|
|
302
|
-
let t =
|
|
304
|
+
let t = T(e);
|
|
303
305
|
for (let n of this.entities.values()) {
|
|
304
306
|
let r = n.value.url;
|
|
305
|
-
if (r && (r === e ||
|
|
307
|
+
if (r && (r === e || T(r) === t)) return n.value;
|
|
306
308
|
}
|
|
307
309
|
return null;
|
|
308
310
|
}
|
|
309
311
|
upsertEntity(e) {
|
|
310
|
-
let t = this.entities.get(e.id) ?? null, n = t ? t.value : null, r = n ?
|
|
311
|
-
if (n &&
|
|
312
|
+
let t = this.entities.get(e.id) ?? null, n = t ? t.value : null, r = n ? j(n) : null, i = j(e), a = n ? M(n) : !1, o = M(e), s;
|
|
313
|
+
if (n && M(n) && o) {
|
|
312
314
|
let t = n.childrenCount, r = e.childrenCount;
|
|
313
315
|
t !== void 0 && r === void 0 && (s = t);
|
|
314
316
|
}
|
|
315
317
|
if (n && (r !== i || a !== o)) {
|
|
316
|
-
let t =
|
|
318
|
+
let t = O(r), n = this.childrenByParent.get(t);
|
|
317
319
|
n && (a ? n.folders.delete(e.id) : n.files.delete(e.id), n.files.size === 0 && n.folders.size === 0 && this.childrenByParent.delete(t));
|
|
318
320
|
}
|
|
319
321
|
let c = e;
|
|
@@ -324,7 +326,7 @@ var I = class e {
|
|
|
324
326
|
value: { ...c },
|
|
325
327
|
updatedAt: this.now()
|
|
326
328
|
}), this.checkCacheSize();
|
|
327
|
-
let l =
|
|
329
|
+
let l = O(i), u = this.childrenByParent.get(l);
|
|
328
330
|
u || (u = {
|
|
329
331
|
files: /* @__PURE__ */ new Set(),
|
|
330
332
|
folders: /* @__PURE__ */ new Set()
|
|
@@ -333,7 +335,7 @@ var I = class e {
|
|
|
333
335
|
updateServerChildrenCount(e, t) {
|
|
334
336
|
if (e == null || t == null || Number.isNaN(t)) return;
|
|
335
337
|
let n = this.entities.get(e);
|
|
336
|
-
if (!n || !
|
|
338
|
+
if (!n || !M(n.value)) return;
|
|
337
339
|
let r = {
|
|
338
340
|
...n.value,
|
|
339
341
|
childrenCount: t
|
|
@@ -349,32 +351,32 @@ var I = class e {
|
|
|
349
351
|
entity: null,
|
|
350
352
|
parentId: null
|
|
351
353
|
};
|
|
352
|
-
let n = t.value, r =
|
|
353
|
-
return a && (
|
|
354
|
+
let n = t.value, r = j(n), i = O(r), a = this.childrenByParent.get(i);
|
|
355
|
+
return a && (M(n) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i)), this.entities.delete(e), {
|
|
354
356
|
entity: { ...n },
|
|
355
357
|
parentId: r
|
|
356
358
|
};
|
|
357
359
|
}
|
|
358
360
|
deleteFolderRecursive(e) {
|
|
359
361
|
let t = this.entities.get(e);
|
|
360
|
-
if (!t || !
|
|
362
|
+
if (!t || !M(t.value)) return {
|
|
361
363
|
deletedFolderRecords: [],
|
|
362
364
|
deletedFileSystemItemRecords: []
|
|
363
365
|
};
|
|
364
366
|
let n = [{
|
|
365
367
|
id: e,
|
|
366
|
-
parentId:
|
|
368
|
+
parentId: j(t.value)
|
|
367
369
|
}], r = [], i = [];
|
|
368
370
|
for (; n.length;) {
|
|
369
371
|
let e = n.shift();
|
|
370
372
|
r.push(e);
|
|
371
|
-
let t = this.childrenByParent.get(
|
|
373
|
+
let t = this.childrenByParent.get(O(e.id));
|
|
372
374
|
if (t) {
|
|
373
375
|
for (let e of Array.from(t.folders)) {
|
|
374
376
|
let t = this.entities.get(e);
|
|
375
377
|
t && n.push({
|
|
376
378
|
id: e,
|
|
377
|
-
parentId:
|
|
379
|
+
parentId: j(t.value)
|
|
378
380
|
});
|
|
379
381
|
}
|
|
380
382
|
for (let e of Array.from(t.files)) i.push(e);
|
|
@@ -384,16 +386,16 @@ var I = class e {
|
|
|
384
386
|
for (let e of i) {
|
|
385
387
|
let t = this.entities.get(e);
|
|
386
388
|
if (!t) continue;
|
|
387
|
-
let n = t.value, r =
|
|
389
|
+
let n = t.value, r = O(j(n)), i = this.childrenByParent.get(r);
|
|
388
390
|
i && (i.files.delete(e), i.files.size === 0 && i.folders.size === 0 && this.childrenByParent.delete(r)), this.entities.delete(e), a.push({ ...n });
|
|
389
391
|
}
|
|
390
392
|
let o = [];
|
|
391
393
|
for (let e = r.length - 1; e >= 0; e--) {
|
|
392
394
|
let { id: t, parentId: n } = r[e], i = this.entities.get(t);
|
|
393
395
|
if (!i) continue;
|
|
394
|
-
let a = i.value, s =
|
|
396
|
+
let a = i.value, s = O(a.id);
|
|
395
397
|
this.childrenByParent.delete(s);
|
|
396
|
-
let c =
|
|
398
|
+
let c = O(n), l = this.childrenByParent.get(c);
|
|
397
399
|
l && (l.folders.delete(t), l.files.size === 0 && l.folders.size === 0 && this.childrenByParent.delete(c)), this.entities.delete(t), o.push({ ...a });
|
|
398
400
|
}
|
|
399
401
|
return {
|
|
@@ -404,13 +406,13 @@ var I = class e {
|
|
|
404
406
|
moveEntityById(e, t) {
|
|
405
407
|
let n = this.entities.get(e) ?? null;
|
|
406
408
|
if (!n) return null;
|
|
407
|
-
let r = n.value, i =
|
|
408
|
-
a && (
|
|
409
|
+
let r = n.value, i = O(j(r)), a = this.childrenByParent.get(i);
|
|
410
|
+
a && (M(r) ? a.folders.delete(e) : a.files.delete(e), a.files.size === 0 && a.folders.size === 0 && this.childrenByParent.delete(i));
|
|
409
411
|
let o = {
|
|
410
412
|
...r,
|
|
411
413
|
folderId: t
|
|
412
414
|
};
|
|
413
|
-
if (
|
|
415
|
+
if (M(r) && M(o)) {
|
|
414
416
|
let e = r.childrenCount;
|
|
415
417
|
e !== void 0 && (o.childrenCount = e);
|
|
416
418
|
}
|
|
@@ -418,15 +420,15 @@ var I = class e {
|
|
|
418
420
|
value: o,
|
|
419
421
|
updatedAt: this.now()
|
|
420
422
|
});
|
|
421
|
-
let s =
|
|
423
|
+
let s = O(t), c = this.childrenByParent.get(s);
|
|
422
424
|
return c || (c = {
|
|
423
425
|
files: /* @__PURE__ */ new Set(),
|
|
424
426
|
folders: /* @__PURE__ */ new Set()
|
|
425
|
-
}, this.childrenByParent.set(s, c)),
|
|
427
|
+
}, this.childrenByParent.set(s, c)), M(o) ? c.folders.add(e) : c.files.add(e), { ...o };
|
|
426
428
|
}
|
|
427
429
|
copyFileSystemItem(e, t, n) {
|
|
428
430
|
let r = this.entities.get(e) ?? null;
|
|
429
|
-
if (!r ||
|
|
431
|
+
if (!r || M(r.value)) return null;
|
|
430
432
|
let i = {
|
|
431
433
|
...r.value,
|
|
432
434
|
id: t,
|
|
@@ -436,7 +438,7 @@ var I = class e {
|
|
|
436
438
|
}
|
|
437
439
|
copyFolderShallow(e, t, n) {
|
|
438
440
|
let r = this.entities.get(e) ?? null;
|
|
439
|
-
if (!r || !
|
|
441
|
+
if (!r || !M(r.value)) return null;
|
|
440
442
|
let i = {
|
|
441
443
|
...r.value,
|
|
442
444
|
id: t,
|
|
@@ -460,7 +462,7 @@ var I = class e {
|
|
|
460
462
|
let n = t?.parentId, r = t?.recursive ?? !1, i = t?.itemType ?? "all", a = t?.caseSensitive ?? !1, o = t?.limit ?? Infinity, s = a ? e.trim() : e.trim().toLowerCase(), c = [], l = null;
|
|
461
463
|
if (n !== void 0) {
|
|
462
464
|
l = /* @__PURE__ */ new Set();
|
|
463
|
-
let e =
|
|
465
|
+
let e = O(n);
|
|
464
466
|
if (l.add(e), r) {
|
|
465
467
|
let t = [e], n = /* @__PURE__ */ new Set();
|
|
466
468
|
for (; t.length > 0;) {
|
|
@@ -476,10 +478,10 @@ var I = class e {
|
|
|
476
478
|
if (c.length >= o) break;
|
|
477
479
|
let t = e.value;
|
|
478
480
|
if (l !== null) {
|
|
479
|
-
let e =
|
|
481
|
+
let e = O(j(t));
|
|
480
482
|
if (!l.has(e)) continue;
|
|
481
483
|
}
|
|
482
|
-
if (i === "file" &&
|
|
484
|
+
if (i === "file" && M(t) || i === "folder" && !M(t)) continue;
|
|
483
485
|
let n = t.name ?? "";
|
|
484
486
|
(a ? n : n.toLowerCase()).includes(s) && c.push({ ...t });
|
|
485
487
|
}
|
|
@@ -507,7 +509,7 @@ var I = class e {
|
|
|
507
509
|
return n;
|
|
508
510
|
}
|
|
509
511
|
}, L = class e {
|
|
510
|
-
constructor(e = {}, t =
|
|
512
|
+
constructor(e = {}, t = D, n, r, i = new o(), a = N) {
|
|
511
513
|
this.views = /* @__PURE__ */ new Map(), this.maxViewsPerParent = 50;
|
|
512
514
|
let s = g(e);
|
|
513
515
|
this.strategy = {
|
|
@@ -531,7 +533,7 @@ var I = class e {
|
|
|
531
533
|
return Date.now();
|
|
532
534
|
}
|
|
533
535
|
parentKey(e) {
|
|
534
|
-
return
|
|
536
|
+
return O(e ?? null);
|
|
535
537
|
}
|
|
536
538
|
isExpired(e) {
|
|
537
539
|
return e == null || this.ttl !== Infinity && this.now() - e > this.ttl;
|
|
@@ -540,13 +542,13 @@ var I = class e {
|
|
|
540
542
|
return !e || e.some((e) => !t.getEntity(e) || t.isEntityStale(e, this.entityTtl));
|
|
541
543
|
}
|
|
542
544
|
isEntityTypeCompatible(e, t) {
|
|
543
|
-
return !!(!t || t === "all" || t === "file" && !
|
|
545
|
+
return !!(!t || t === "all" || t === "file" && !M(e) || t === "folder" && M(e));
|
|
544
546
|
}
|
|
545
547
|
markViewStaleForReload(e) {
|
|
546
548
|
e.view.meta = {
|
|
547
549
|
...e.view.meta ?? {},
|
|
548
550
|
stale: !0
|
|
549
|
-
}, e.view.updatedAt = this.now(), e.view.loadId =
|
|
551
|
+
}, e.view.updatedAt = this.now(), e.view.loadId = x(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
|
|
550
552
|
}
|
|
551
553
|
cleanupOldViews(e) {
|
|
552
554
|
if (e.size <= this.maxViewsPerParent) return;
|
|
@@ -580,11 +582,11 @@ var I = class e {
|
|
|
580
582
|
};
|
|
581
583
|
}
|
|
582
584
|
if (l.view.promise) return l.view.promise;
|
|
583
|
-
let d =
|
|
585
|
+
let d = x();
|
|
584
586
|
l.view.loadId = d;
|
|
585
587
|
let f = (async () => {
|
|
586
588
|
try {
|
|
587
|
-
let a = await n(e, t), o =
|
|
589
|
+
let a = await n(e, t), o = A(t), s = o ? {
|
|
588
590
|
...a,
|
|
589
591
|
total: void 0
|
|
590
592
|
} : a, u = this.views.get(i)?.get(F(t));
|
|
@@ -596,7 +598,7 @@ var I = class e {
|
|
|
596
598
|
l.view.value = s.items.map((e) => e.id);
|
|
597
599
|
let { items: f, ...p } = s, m = { ...p };
|
|
598
600
|
l.view.meta = m, l.view.meta && (l.view.meta.stale = !1), this.failedRequests.delete(c), l.view.updatedAt = this.now(), !o && typeof m.total == "number" && (this.serverChildrenCountHandler ? this.serverChildrenCountHandler(e ?? null, m.total, r) : r.updateServerChildrenCount(e, m.total));
|
|
599
|
-
let h = this.strategy.preloadPagesAfter ?? 0, g = this.strategy.preloadPagesBefore ?? 0, _ =
|
|
601
|
+
let h = this.strategy.preloadPagesAfter ?? 0, g = this.strategy.preloadPagesBefore ?? 0, _ = k(t?.pageSize);
|
|
600
602
|
if ((h > 0 || g > 0) && Number.isFinite(_)) {
|
|
601
603
|
let i = e, a = { ...t }, o = typeof m.totalPages == "number" ? m.totalPages : 1, s = t?.page ?? 1, c = _, l = n, u = d;
|
|
602
604
|
setTimeout(() => {
|
|
@@ -707,7 +709,7 @@ var I = class e {
|
|
|
707
709
|
syncTotalsInSameViews(e, t) {
|
|
708
710
|
let n = t.view.meta;
|
|
709
711
|
if (!n || typeof n.total != "number") return;
|
|
710
|
-
let r = Number(n.total), i =
|
|
712
|
+
let r = Number(n.total), i = k(t.params?.pageSize), a = Number.isFinite(i) && i > 0 ? Math.max(1, Math.ceil(r / i)) : void 0;
|
|
711
713
|
for (let [, n] of e) this.isParamsSame(n.params ?? {}, t.params ?? {}) && (n.view.meta || (n.view.meta = {}), n.view.meta.total = r, a !== void 0 && (n.view.meta.totalPages = a));
|
|
712
714
|
}
|
|
713
715
|
cascadeShiftPages(e, t, n, r, i, a, o) {
|
|
@@ -761,26 +763,28 @@ var I = class e {
|
|
|
761
763
|
...o,
|
|
762
764
|
page: n + 1
|
|
763
765
|
}, c = F(s), l = e.get(c), u = !1;
|
|
764
|
-
if (!l?.view.value || this.isExpired(l.view.updatedAt))
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
777
|
-
|
|
778
|
-
|
|
779
|
-
|
|
780
|
-
|
|
781
|
-
|
|
782
|
-
|
|
783
|
-
|
|
766
|
+
if (!l?.view.value || this.isExpired(l.view.updatedAt)) {
|
|
767
|
+
if (n >= i) {
|
|
768
|
+
l = {
|
|
769
|
+
params: s,
|
|
770
|
+
view: {
|
|
771
|
+
promise: null,
|
|
772
|
+
value: void 0,
|
|
773
|
+
meta: void 0,
|
|
774
|
+
updatedAt: 0,
|
|
775
|
+
loadId: null
|
|
776
|
+
}
|
|
777
|
+
}, e.set(c, l), this.cleanupOldViews(e);
|
|
778
|
+
let r = t.view.meta;
|
|
779
|
+
r && (l.view.meta = {
|
|
780
|
+
...r,
|
|
781
|
+
page: n + 1
|
|
782
|
+
}), u = !0;
|
|
783
|
+
} else return t.view.meta = {
|
|
784
|
+
...t.view.meta ?? {},
|
|
785
|
+
stale: !0
|
|
786
|
+
}, !1;
|
|
787
|
+
}
|
|
784
788
|
let d = t.view.value.slice(r).filter((e) => a.getEntity(e));
|
|
785
789
|
if (d.length === 0) return u && e.delete(c), !1;
|
|
786
790
|
t.view.value = t.view.value.slice(0, r), t.view.updatedAt = Date.now(), l.view.value = [...d, ...l.view.value ?? []], l.view.updatedAt = Date.now();
|
|
@@ -824,7 +828,7 @@ var I = class e {
|
|
|
824
828
|
], e.view.updatedAt = this.now(), !0);
|
|
825
829
|
}
|
|
826
830
|
updateChildrenCountForOperation(e, t, n, r) {
|
|
827
|
-
let i =
|
|
831
|
+
let i = j(t);
|
|
828
832
|
switch (e) {
|
|
829
833
|
case "delete":
|
|
830
834
|
this.adjustChildrenCount(r, i, -1), this.childrenCountInvalidator?.(i);
|
|
@@ -833,9 +837,7 @@ var I = class e {
|
|
|
833
837
|
case "copy":
|
|
834
838
|
this.adjustChildrenCount(r, i, 1), this.childrenCountInvalidator?.(i);
|
|
835
839
|
break;
|
|
836
|
-
case "move":
|
|
837
|
-
this.adjustChildrenCount(r, n ?? null, -1), this.adjustChildrenCount(r, i, 1), this.childrenCountInvalidator?.(n ?? null), this.childrenCountInvalidator?.(i);
|
|
838
|
-
break;
|
|
840
|
+
case "move": this.adjustChildrenCount(r, n ?? null, -1), this.adjustChildrenCount(r, i, 1), this.childrenCountInvalidator?.(n ?? null), this.childrenCountInvalidator?.(i);
|
|
839
841
|
}
|
|
840
842
|
}
|
|
841
843
|
adjustChildrenCount(e, t, n) {
|
|
@@ -851,14 +853,14 @@ var I = class e {
|
|
|
851
853
|
this.updateChildrenCountForOperation(n, t, i, r);
|
|
852
854
|
let o = this.parentKey(e), s = this.views.get(o);
|
|
853
855
|
if (s) for (let [, e] of s) {
|
|
854
|
-
let a = e.params ?? {}, o = a?.page ?? 1, c =
|
|
856
|
+
let a = e.params ?? {}, o = a?.page ?? 1, c = k(a?.pageSize), l = Number.isFinite(c), u = !!(a?.sortBy || a?.sortOrder), d = !!a?.search, f = a?.itemType || "all";
|
|
855
857
|
if (this.isEntityTypeCompatible(t, f)) {
|
|
856
858
|
if (d && this.strategy.filterMatch && !this.strategy.filterMatch(t, e.params)) {
|
|
857
859
|
e.view.value?.includes(t.id) && (e.view.value = e.view.value.filter((e) => e !== t.id), e.view.meta && typeof e.view.meta.total == "number" && (e.view.meta.total = Math.max(0, e.view.meta.total - 1)), this.markViewStaleForReload(e));
|
|
858
860
|
continue;
|
|
859
861
|
}
|
|
860
862
|
if (!e.view.value) {
|
|
861
|
-
e.view.meta && (e.view.meta.stale = !0), e.view.loadId =
|
|
863
|
+
e.view.meta && (e.view.meta.stale = !0), e.view.loadId = x(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
|
|
862
864
|
continue;
|
|
863
865
|
}
|
|
864
866
|
if (e.view.value.includes(t.id), this.shouldInvalidateCompletely(e, n, t, u, l, o)) {
|
|
@@ -876,9 +878,7 @@ var I = class e {
|
|
|
876
878
|
case "update":
|
|
877
879
|
this.handleUpdate(s, e, o, c, l, u, d, t, r);
|
|
878
880
|
break;
|
|
879
|
-
case "move":
|
|
880
|
-
this.handleMove(s, e, o, c, l, u, t, i, r);
|
|
881
|
-
break;
|
|
881
|
+
case "move": this.handleMove(s, e, o, c, l, u, t, i, r);
|
|
882
882
|
}
|
|
883
883
|
}
|
|
884
884
|
}
|
|
@@ -908,27 +908,28 @@ var I = class e {
|
|
|
908
908
|
t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
|
|
909
909
|
}
|
|
910
910
|
}
|
|
911
|
-
t.view.loadId =
|
|
911
|
+
t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
|
|
912
912
|
}
|
|
913
913
|
handleInsert(e, t, n, r, i, a, o, s) {
|
|
914
914
|
if (!t.view.value.includes(o.id)) {
|
|
915
|
-
if (a && this.strategy.allowSortedInsert && this.strategy.comparator && s)
|
|
916
|
-
if (
|
|
917
|
-
if (t.view.meta
|
|
918
|
-
|
|
919
|
-
|
|
915
|
+
if (a && this.strategy.allowSortedInsert && this.strategy.comparator && s) {
|
|
916
|
+
if (this.tryInsertSorted(t, o, s)) {
|
|
917
|
+
if (t.view.meta && typeof t.view.meta.total == "number") {
|
|
918
|
+
if (t.view.meta.total += 1, i && Number.isFinite(r)) {
|
|
919
|
+
let e = r;
|
|
920
|
+
e > 0 && (t.view.meta.totalPages = Math.max(1, Math.ceil(t.view.meta.total / e)));
|
|
921
|
+
}
|
|
922
|
+
this.syncTotalsInSameViews(e, t);
|
|
920
923
|
}
|
|
921
|
-
|
|
922
|
-
|
|
923
|
-
|
|
924
|
-
|
|
925
|
-
|
|
926
|
-
|
|
927
|
-
t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
|
|
924
|
+
if (t.view.updatedAt = Date.now(), i && (t.view.value?.length ?? 0) > r && s) {
|
|
925
|
+
let i = t.view.meta, a = i && typeof i.totalPages == "number" ? i.totalPages : 1;
|
|
926
|
+
if (this.cascadeShiftToNextPage(e, t, n, r, a, s, t.params ?? {}) && t.view.meta && typeof t.view.meta.totalPages == "number") {
|
|
927
|
+
let n = t.view.meta.totalPages + 1;
|
|
928
|
+
t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
|
|
929
|
+
}
|
|
928
930
|
}
|
|
929
|
-
}
|
|
930
|
-
} else
|
|
931
|
-
else if (!i || t.view.value.length < r) {
|
|
931
|
+
} else this.markViewStaleForReload(t);
|
|
932
|
+
} else if (!i || t.view.value.length < r) {
|
|
932
933
|
if (t.view.value.push(o.id), t.view.meta && typeof t.view.meta.total == "number") {
|
|
933
934
|
if (t.view.meta.total += 1, i && Number.isFinite(r)) {
|
|
934
935
|
let e = r;
|
|
@@ -938,7 +939,7 @@ var I = class e {
|
|
|
938
939
|
}
|
|
939
940
|
t.view.updatedAt = Date.now();
|
|
940
941
|
} else this.markViewStaleForReload(t);
|
|
941
|
-
t.view.loadId =
|
|
942
|
+
t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
|
|
942
943
|
}
|
|
943
944
|
}
|
|
944
945
|
handleUpdate(e, t, n, r, i, a, o, s, c) {
|
|
@@ -955,29 +956,30 @@ var I = class e {
|
|
|
955
956
|
t.view.meta.totalPages = n, this.updateTotalPagesForAllViews(e, n);
|
|
956
957
|
}
|
|
957
958
|
}
|
|
958
|
-
t.view.loadId =
|
|
959
|
+
t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
|
|
959
960
|
return;
|
|
960
961
|
}
|
|
961
962
|
if (l && (a || o)) {
|
|
962
|
-
t.view.value = t.view.value.filter((e) => e !== s.id), this.tryReinsertEntity(t, s, c, i, r) ? (t.view.updatedAt = Date.now(), t.view.loadId =
|
|
963
|
+
t.view.value = t.view.value.filter((e) => e !== s.id), this.tryReinsertEntity(t, s, c, i, r) ? (t.view.updatedAt = Date.now(), t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0)) : this.markViewStaleForReload(t);
|
|
963
964
|
return;
|
|
964
965
|
}
|
|
965
966
|
if (l) {
|
|
966
|
-
t.view.updatedAt = Date.now(), t.view.loadId =
|
|
967
|
+
t.view.updatedAt = Date.now(), t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
|
|
967
968
|
return;
|
|
968
969
|
}
|
|
969
970
|
if (u && !o) {
|
|
970
|
-
if (a && this.strategy.allowSortedInsert && this.strategy.comparator && c)
|
|
971
|
-
if (
|
|
972
|
-
if (t.view.meta
|
|
973
|
-
|
|
974
|
-
|
|
971
|
+
if (a && this.strategy.allowSortedInsert && this.strategy.comparator && c) {
|
|
972
|
+
if (this.tryInsertSorted(t, s, c)) {
|
|
973
|
+
if (t.view.meta && typeof t.view.meta.total == "number") {
|
|
974
|
+
if (t.view.meta.total += 1, i && Number.isFinite(r)) {
|
|
975
|
+
let e = r;
|
|
976
|
+
e > 0 && (t.view.meta.totalPages = Math.max(1, Math.ceil(t.view.meta.total / e)));
|
|
977
|
+
}
|
|
978
|
+
this.syncTotalsInSameViews(e, t);
|
|
975
979
|
}
|
|
976
|
-
|
|
977
|
-
}
|
|
978
|
-
|
|
979
|
-
} else this.markViewStaleForReload(t);
|
|
980
|
-
else if (!i || t.view.value.length < r) {
|
|
980
|
+
t.view.updatedAt = Date.now();
|
|
981
|
+
} else this.markViewStaleForReload(t);
|
|
982
|
+
} else if (!i || t.view.value.length < r) {
|
|
981
983
|
if (t.view.value.push(s.id), t.view.meta && typeof t.view.meta.total == "number") {
|
|
982
984
|
if (t.view.meta.total += 1, i && Number.isFinite(r)) {
|
|
983
985
|
let e = r;
|
|
@@ -987,7 +989,7 @@ var I = class e {
|
|
|
987
989
|
}
|
|
988
990
|
t.view.updatedAt = Date.now();
|
|
989
991
|
} else this.markViewStaleForReload(t);
|
|
990
|
-
t.view.loadId =
|
|
992
|
+
t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
|
|
991
993
|
}
|
|
992
994
|
}
|
|
993
995
|
handleMove(e, t, n, r, i, a, o, s, c) {
|
|
@@ -1005,13 +1007,13 @@ var I = class e {
|
|
|
1005
1007
|
}
|
|
1006
1008
|
this.syncTotalsInSameViews(e, t);
|
|
1007
1009
|
}
|
|
1008
|
-
t.view.loadId =
|
|
1010
|
+
t.view.loadId = x(), t.view.abortController && (t.view.abortController.abort(), t.view.abortController = void 0);
|
|
1009
1011
|
}
|
|
1010
1012
|
forceInvalidateChildrenViews(e) {
|
|
1011
1013
|
let t = this.parentKey(e ?? null);
|
|
1012
1014
|
this.failedRequests.clearChildrenViewErrorsForParent(t);
|
|
1013
1015
|
let n = this.views.get(t);
|
|
1014
|
-
if (n) for (let [, e] of n) e.view.value = void 0, e.view.meta = void 0, e.view.promise = null, e.view.updatedAt = 0, e.view.loadId =
|
|
1016
|
+
if (n) for (let [, e] of n) e.view.value = void 0, e.view.meta = void 0, e.view.promise = null, e.view.updatedAt = 0, e.view.loadId = x(), e.view.abortController && (e.view.abortController.abort(), e.view.abortController = void 0);
|
|
1015
1017
|
}
|
|
1016
1018
|
getKnownTotal(e) {
|
|
1017
1019
|
let t = this.parentKey(e ?? null), n = this.views.get(t);
|
|
@@ -1055,10 +1057,10 @@ var I = class e {
|
|
|
1055
1057
|
}
|
|
1056
1058
|
}, R = class e {
|
|
1057
1059
|
invalidateChildrenCountCache(e) {
|
|
1058
|
-
let t =
|
|
1060
|
+
let t = O(e ?? "");
|
|
1059
1061
|
this.childrenCountPromises.delete(t), this.failedRequests.delete(o.childrenCountKey(t));
|
|
1060
1062
|
}
|
|
1061
|
-
constructor(e = {}, t =
|
|
1063
|
+
constructor(e = {}, t = D, n, r) {
|
|
1062
1064
|
this.childrenCountPromises = /* @__PURE__ */ new Map(), this.isFolderNotFoundError = r?.isFolderNotFoundError ?? N, this.failedRequests = new o(), this.ttl = r?.ttl ?? t, this.errorTtl = r?.errorTtl ?? n ?? this.ttl, this.entities = new I(), this.views = new L(e, this.ttl, this.errorTtl, void 0, this.failedRequests, this.isFolderNotFoundError), this.views.setServerChildrenCountHandler((e, t, n) => {
|
|
1063
1065
|
this.handleServerReportedChildrenCount(e, t, n ?? this.entities);
|
|
1064
1066
|
}), this.views.setChildrenCountInvalidator((e) => {
|
|
@@ -1078,7 +1080,7 @@ var I = class e {
|
|
|
1078
1080
|
return this.views.getOrCreateChildren(e, t, n, this.entities);
|
|
1079
1081
|
}
|
|
1080
1082
|
upsertEntity(e) {
|
|
1081
|
-
let t = this.entities.getEntity(e.id), n = t ?
|
|
1083
|
+
let t = this.entities.getEntity(e.id), n = t ? j(t) : null, r = j(e), i = t ? M(t) : !1, a = M(e);
|
|
1082
1084
|
if (this.entities.upsertEntity(e), t) {
|
|
1083
1085
|
if (n !== r || i !== a) {
|
|
1084
1086
|
this.views.smartInvalidateChildrenViews(n, t, "delete", this.entities), this.views.smartInvalidateChildrenViews(r, e, "insert", this.entities);
|
|
@@ -1090,24 +1092,24 @@ var I = class e {
|
|
|
1090
1092
|
isAncestor(e, t) {
|
|
1091
1093
|
let n = t, r = /* @__PURE__ */ new Set();
|
|
1092
1094
|
for (; n && !r.has(n);) {
|
|
1093
|
-
if (r.add(n),
|
|
1095
|
+
if (r.add(n), O(n) === O(e)) return !0;
|
|
1094
1096
|
let t = this.entities.getEntity(n);
|
|
1095
1097
|
if (!t) break;
|
|
1096
|
-
n =
|
|
1098
|
+
n = j(t), n === null && (n = E);
|
|
1097
1099
|
}
|
|
1098
1100
|
return !1;
|
|
1099
1101
|
}
|
|
1100
1102
|
moveEntity(e, t) {
|
|
1101
1103
|
let n = this.entities.getEntity(e);
|
|
1102
|
-
if (!n ||
|
|
1103
|
-
let r =
|
|
1104
|
+
if (!n || M(n) && t !== null && this.isAncestor(e, t)) return null;
|
|
1105
|
+
let r = j(n), i = this.entities.moveEntityById(e, t);
|
|
1104
1106
|
return i ? (this.views.smartInvalidateChildrenViews(r, n, "delete", this.entities), this.views.smartInvalidateChildrenViews(t, i, "insert", this.entities), i) : null;
|
|
1105
1107
|
}
|
|
1106
1108
|
copyEntity(e, t, n, r) {
|
|
1107
1109
|
let i = this.entities.getEntity(e);
|
|
1108
1110
|
if (!i) return null;
|
|
1109
1111
|
let a = null;
|
|
1110
|
-
if (
|
|
1112
|
+
if (M(i)) {
|
|
1111
1113
|
let n = [e], i = [];
|
|
1112
1114
|
for (; n.length;) {
|
|
1113
1115
|
let e = n.shift();
|
|
@@ -1116,9 +1118,9 @@ var I = class e {
|
|
|
1116
1118
|
for (let e of t) n.push(e);
|
|
1117
1119
|
}
|
|
1118
1120
|
let o = /* @__PURE__ */ new Map();
|
|
1119
|
-
for (let e of i) o.set(e,
|
|
1121
|
+
for (let e of i) o.set(e, x());
|
|
1120
1122
|
for (let n of i) {
|
|
1121
|
-
let i = this.entities.getFolder(n), a = o.get(n), s =
|
|
1123
|
+
let i = this.entities.getFolder(n), a = o.get(n), s = j(i), c = s === null ? t : o.get(s) ?? null, l = {
|
|
1122
1124
|
...i,
|
|
1123
1125
|
...n === e ? r : void 0,
|
|
1124
1126
|
id: a,
|
|
@@ -1131,7 +1133,7 @@ var I = class e {
|
|
|
1131
1133
|
for (let e of n) {
|
|
1132
1134
|
let n = this.entities.getFileSystemItem(e);
|
|
1133
1135
|
if (!n) continue;
|
|
1134
|
-
let r =
|
|
1136
|
+
let r = x(), i = {
|
|
1135
1137
|
...n,
|
|
1136
1138
|
id: r,
|
|
1137
1139
|
folderId: t
|
|
@@ -1141,7 +1143,7 @@ var I = class e {
|
|
|
1141
1143
|
}
|
|
1142
1144
|
a = this.entities.getEntity(o.get(e)) ?? null;
|
|
1143
1145
|
} else {
|
|
1144
|
-
let i = n ??
|
|
1146
|
+
let i = n ?? x();
|
|
1145
1147
|
if (a = this.entities.copyFileSystemItem(e, i, t ?? null), a && r) {
|
|
1146
1148
|
let e = {
|
|
1147
1149
|
...a,
|
|
@@ -1160,13 +1162,14 @@ var I = class e {
|
|
|
1160
1162
|
deleteEntity(e) {
|
|
1161
1163
|
let t = this.entities.getEntity(e);
|
|
1162
1164
|
if (!t) return null;
|
|
1163
|
-
if (
|
|
1165
|
+
if (M(t)) {
|
|
1164
1166
|
let { deletedFolderRecords: n, deletedFileSystemItemRecords: r } = this.entities.deleteFolderRecursive(e);
|
|
1165
1167
|
for (let e of r) this.views.smartInvalidateChildrenViews(e.folderId, e, "delete", this.entities);
|
|
1166
1168
|
for (let e of n) this.views.smartInvalidateChildrenViews(e.folderId, e, "delete", this.entities);
|
|
1167
1169
|
for (let e of n) this.views.forceInvalidateChildrenViews(e.id);
|
|
1168
1170
|
return t;
|
|
1169
|
-
}
|
|
1171
|
+
}
|
|
1172
|
+
{
|
|
1170
1173
|
let { entity: t, parentId: n } = this.entities.deleteEntityById(e);
|
|
1171
1174
|
return t && this.views.smartInvalidateChildrenViews(n, t, "delete", this.entities), t;
|
|
1172
1175
|
}
|
|
@@ -1188,7 +1191,7 @@ var I = class e {
|
|
|
1188
1191
|
return;
|
|
1189
1192
|
}
|
|
1190
1193
|
let n = /* @__PURE__ */ new Set();
|
|
1191
|
-
if (
|
|
1194
|
+
if (M(t)) {
|
|
1192
1195
|
let t = [e];
|
|
1193
1196
|
for (; t.length;) {
|
|
1194
1197
|
let e = t.pop();
|
|
@@ -1212,7 +1215,7 @@ var I = class e {
|
|
|
1212
1215
|
return this.entities.searchByName(e, t);
|
|
1213
1216
|
}
|
|
1214
1217
|
async getChildrenCount(e = "", t) {
|
|
1215
|
-
let n =
|
|
1218
|
+
let n = O(e), r = o.childrenCountKey(n), i = this.failedRequests.getFreshError(r, this.errorTtl);
|
|
1216
1219
|
if (i != null) return Promise.reject(i);
|
|
1217
1220
|
let a = this.childrenCountPromises.get(n);
|
|
1218
1221
|
if (a) return a;
|
|
@@ -1282,8 +1285,8 @@ var I = class e {
|
|
|
1282
1285
|
let i = n.getFolder(r)?.childrenCount;
|
|
1283
1286
|
i !== void 0 && i !== t && (console.warn(`Conflict: folder "${r}" has childrenCount=${i} but server says total=${t}`), this.views.forceInvalidateChildrenViews(r)), n.updateServerChildrenCount(r, t);
|
|
1284
1287
|
}
|
|
1285
|
-
}, ee = "",
|
|
1286
|
-
function
|
|
1288
|
+
}, ee = "", z = "Trash", B = "Edited", V = 1e4, H = 1e4, U = 25, W = 10;
|
|
1289
|
+
function G(e, t) {
|
|
1287
1290
|
let n = e ?? {}, r = Array.isArray(n.detailed) ? n.detailed.map((e) => ({
|
|
1288
1291
|
requestId: e.requestId ?? e.id,
|
|
1289
1292
|
success: !!e.success,
|
|
@@ -1296,30 +1299,30 @@ function U(e, t) {
|
|
|
1296
1299
|
detailed: r
|
|
1297
1300
|
};
|
|
1298
1301
|
}
|
|
1299
|
-
function
|
|
1302
|
+
function K(e) {
|
|
1300
1303
|
return e == null ? "" : String(e);
|
|
1301
1304
|
}
|
|
1302
|
-
function
|
|
1305
|
+
function q(e) {
|
|
1303
1306
|
return {
|
|
1304
1307
|
...e,
|
|
1305
|
-
name:
|
|
1308
|
+
name: K(e.name)
|
|
1306
1309
|
};
|
|
1307
1310
|
}
|
|
1308
|
-
function
|
|
1309
|
-
return (e ?? []).map(
|
|
1311
|
+
function J(e) {
|
|
1312
|
+
return (e ?? []).map(q);
|
|
1310
1313
|
}
|
|
1311
|
-
function
|
|
1314
|
+
function Y(e) {
|
|
1312
1315
|
return !e || typeof e != "object" || !("name" in e) ? e : {
|
|
1313
1316
|
...e,
|
|
1314
|
-
name:
|
|
1317
|
+
name: K(e.name)
|
|
1315
1318
|
};
|
|
1316
1319
|
}
|
|
1317
|
-
function
|
|
1320
|
+
function X(e) {
|
|
1318
1321
|
return e ? e.replaceAll("\\", "/").split("/").filter(Boolean) : [];
|
|
1319
1322
|
}
|
|
1320
|
-
|
|
1323
|
+
var Z = class {
|
|
1321
1324
|
_getTrashPath() {
|
|
1322
|
-
return this._pathOptions.trashPath ||
|
|
1325
|
+
return this._pathOptions.trashPath || z;
|
|
1323
1326
|
}
|
|
1324
1327
|
_getPathLookupCandidates(e) {
|
|
1325
1328
|
return y(e, this._getTrashPath(), _);
|
|
@@ -1332,7 +1335,7 @@ for (var re = class {
|
|
|
1332
1335
|
name: t.name || t.id,
|
|
1333
1336
|
parentId: t.folderId
|
|
1334
1337
|
};
|
|
1335
|
-
return this._cache.upsertEntity(
|
|
1338
|
+
return this._cache.upsertEntity(q({
|
|
1336
1339
|
id: r.id,
|
|
1337
1340
|
name: r.name,
|
|
1338
1341
|
folderId: r.parentId ?? null,
|
|
@@ -1346,8 +1349,8 @@ for (var re = class {
|
|
|
1346
1349
|
}
|
|
1347
1350
|
}
|
|
1348
1351
|
async _findOrCreateFolderByPath(t) {
|
|
1349
|
-
let n =
|
|
1350
|
-
if (n.length >
|
|
1352
|
+
let n = X(t);
|
|
1353
|
+
if (n.length > W) throw new e("Path depth exceeds maximum limit of %s".replace("%s", String(W)), "ValidationError");
|
|
1351
1354
|
let r = await this._resolveFolderByPath(t);
|
|
1352
1355
|
if (r) return r;
|
|
1353
1356
|
let i;
|
|
@@ -1379,7 +1382,7 @@ for (var re = class {
|
|
|
1379
1382
|
return t;
|
|
1380
1383
|
}
|
|
1381
1384
|
async getTempFolder() {
|
|
1382
|
-
let t = this._pathOptions.tempPath ??
|
|
1385
|
+
let t = this._pathOptions.tempPath ?? B;
|
|
1383
1386
|
if (t) try {
|
|
1384
1387
|
return await this._findOrCreateFolderByPath(t);
|
|
1385
1388
|
} catch (t) {
|
|
@@ -1390,7 +1393,7 @@ for (var re = class {
|
|
|
1390
1393
|
}
|
|
1391
1394
|
constructor(e, t = {}, n, r = {}) {
|
|
1392
1395
|
this._dataProvider = e, this._options = t, this._pathOptions = n, this._blobFetchForceReloadOnceIds = /* @__PURE__ */ new Set(), this._mutationRegistry = new s(), this._mapItem = async ({ childrenCount: e, ...t }) => {
|
|
1393
|
-
let n =
|
|
1396
|
+
let n = q(t);
|
|
1394
1397
|
if (n.isFolder) return {
|
|
1395
1398
|
...n,
|
|
1396
1399
|
childCount: e,
|
|
@@ -1529,7 +1532,7 @@ for (var re = class {
|
|
|
1529
1532
|
if (!this._dataProvider.pathMode) return null;
|
|
1530
1533
|
let r = await this._getFileByPathStyleId(t);
|
|
1531
1534
|
if (r && !r.isFolder) {
|
|
1532
|
-
let e =
|
|
1535
|
+
let e = q(r);
|
|
1533
1536
|
return this._cache.upsertEntity(e), await this._mapItem(e);
|
|
1534
1537
|
}
|
|
1535
1538
|
return null;
|
|
@@ -1544,14 +1547,14 @@ for (var re = class {
|
|
|
1544
1547
|
}
|
|
1545
1548
|
async getFiles({ folderId: e, search: t, sortBy: n, sortOrder: r, page: i, limit: a, itemType: o = "all", noFolder: s = !1 }) {
|
|
1546
1549
|
s && (e = (await this.getTempFolder())?.id);
|
|
1547
|
-
let c = this.normalizeId(e ?? this._rootId), l = this._options.enablePagination === !1, u = l ? 1 : i, d = l ?
|
|
1550
|
+
let c = this.normalizeId(e ?? this._rootId), l = this._options.enablePagination === !1, u = l ? 1 : i, d = l ? V : a, f = this._options.clientSideFilter, p = this._options.clientSideSorting, m = this._options.clientSidePaging, h = m ? Math.max(1, i ?? 1) : void 0, g = m ? typeof a == "number" && Number.isFinite(a) && a > 0 ? a : U : void 0, _ = this._emptyFilesResult(m ? h : u, m ? g : d);
|
|
1548
1551
|
if (this._isDeletingId(c)) return _;
|
|
1549
1552
|
let v = this._options.unifiedCatalogFetch !== !1 && l && (o === "folder" || o === "file"), y = v ? "all" : o, b = {
|
|
1550
1553
|
folderId: c,
|
|
1551
1554
|
itemType: y
|
|
1552
1555
|
};
|
|
1553
|
-
f || (b.search = t), p || (b.sortBy = n ?? (y === "folder" ? void 0 : "date"), b.sortOrder = r ?? (y === "folder" ? void 0 : "desc")), m || (b.page = u, b.limit = v ?
|
|
1554
|
-
let x = v ?
|
|
1556
|
+
f || (b.search = t), p || (b.sortBy = n ?? (y === "folder" ? void 0 : "date"), b.sortOrder = r ?? (y === "folder" ? void 0 : "desc")), m || (b.page = u, b.limit = v ? H : d);
|
|
1557
|
+
let x = v ? H : m ? void 0 : d, S = {
|
|
1555
1558
|
folderId: c,
|
|
1556
1559
|
itemType: y,
|
|
1557
1560
|
search: f ? void 0 : t,
|
|
@@ -1562,11 +1565,11 @@ for (var re = class {
|
|
|
1562
1565
|
}, C;
|
|
1563
1566
|
try {
|
|
1564
1567
|
C = await this._cache.getOrCreateChildren(c, S, async (e, t) => {
|
|
1565
|
-
let n = t.pageSize, r = n != null && Number.isFinite(Number(n)) ? Number(n) :
|
|
1568
|
+
let n = t.pageSize, r = n != null && Number.isFinite(Number(n)) ? Number(n) : V, i = await this._dataProvider.getItems({
|
|
1566
1569
|
...t,
|
|
1567
1570
|
folderId: e,
|
|
1568
1571
|
limit: r
|
|
1569
|
-
}), a =
|
|
1572
|
+
}), a = J(i.items);
|
|
1570
1573
|
return m ? {
|
|
1571
1574
|
items: a,
|
|
1572
1575
|
total: typeof i.pagination?.total == "number" ? i.pagination.total : a.length
|
|
@@ -1591,10 +1594,12 @@ for (var re = class {
|
|
|
1591
1594
|
let T;
|
|
1592
1595
|
T = m || f || v ? w.length : C.total ?? w.length;
|
|
1593
1596
|
let E = w;
|
|
1594
|
-
if (m)
|
|
1595
|
-
|
|
1596
|
-
|
|
1597
|
-
|
|
1597
|
+
if (m) {
|
|
1598
|
+
if (typeof this._options.clientSidePaging == "function") E = this._options.clientSidePaging(w, h, g);
|
|
1599
|
+
else {
|
|
1600
|
+
let e = (h - 1) * g, t = e + g;
|
|
1601
|
+
E = w.slice(e, t);
|
|
1602
|
+
}
|
|
1598
1603
|
}
|
|
1599
1604
|
if (typeof this._dataProvider.getUrl == "function" || typeof this._dataProvider.getThumbnailUrl == "function") {
|
|
1600
1605
|
let e = E.map(async (e) => {
|
|
@@ -1660,7 +1665,7 @@ for (var re = class {
|
|
|
1660
1665
|
if (typeof this._dataProvider.findFileByUrl == "function") try {
|
|
1661
1666
|
let t = await this._dataProvider.findFileByUrl(e);
|
|
1662
1667
|
if (t) {
|
|
1663
|
-
let e =
|
|
1668
|
+
let e = q(t);
|
|
1664
1669
|
return this._cache.upsertEntity(e), e;
|
|
1665
1670
|
}
|
|
1666
1671
|
} catch (e) {
|
|
@@ -1678,7 +1683,7 @@ for (var re = class {
|
|
|
1678
1683
|
folderId: t,
|
|
1679
1684
|
itemType: "all",
|
|
1680
1685
|
page: 1,
|
|
1681
|
-
limit:
|
|
1686
|
+
limit: U
|
|
1682
1687
|
});
|
|
1683
1688
|
return e.pagination.total ?? e.files.length;
|
|
1684
1689
|
}
|
|
@@ -1706,7 +1711,7 @@ for (var re = class {
|
|
|
1706
1711
|
let r = await this._dataProvider.uploadFile({
|
|
1707
1712
|
...t,
|
|
1708
1713
|
folderId: n
|
|
1709
|
-
}), i =
|
|
1714
|
+
}), i = q({
|
|
1710
1715
|
name: t.name,
|
|
1711
1716
|
size: t.size,
|
|
1712
1717
|
...r,
|
|
@@ -1744,10 +1749,10 @@ for (var re = class {
|
|
|
1744
1749
|
folderId: a,
|
|
1745
1750
|
items: e
|
|
1746
1751
|
});
|
|
1747
|
-
o =
|
|
1752
|
+
o = G(t, (e) => {
|
|
1748
1753
|
if (e) return {
|
|
1749
1754
|
id: e.id,
|
|
1750
|
-
name:
|
|
1755
|
+
name: K(e.name),
|
|
1751
1756
|
folderId: e.folderId,
|
|
1752
1757
|
url: e.url,
|
|
1753
1758
|
thumbnailUrl: e.thumbnailUrl,
|
|
@@ -1759,7 +1764,7 @@ for (var re = class {
|
|
|
1759
1764
|
for (let e = 0; e < o.detailed.length; e++) {
|
|
1760
1765
|
let t = o.detailed[e];
|
|
1761
1766
|
if (t && t.success) {
|
|
1762
|
-
let r = t.data, i = r?.id ?? t.requestId, o = n?.[e]?.data, s =
|
|
1767
|
+
let r = t.data, i = r?.id ?? t.requestId, o = n?.[e]?.data, s = q({
|
|
1763
1768
|
...o,
|
|
1764
1769
|
...r,
|
|
1765
1770
|
id: i,
|
|
@@ -1833,7 +1838,7 @@ for (var re = class {
|
|
|
1833
1838
|
detailed: []
|
|
1834
1839
|
}, i = n.permanent ? null : await this.getTrashFolder();
|
|
1835
1840
|
if (typeof this._dataProvider.deleteItems == "function") {
|
|
1836
|
-
if (r =
|
|
1841
|
+
if (r = G(await this._dataProvider.deleteItems(t.map((e) => this._cache.getEntity(e)), n), (e) => e), r.success) {
|
|
1837
1842
|
let e = r.detailed || t.map((e) => ({
|
|
1838
1843
|
requestId: e,
|
|
1839
1844
|
success: !0,
|
|
@@ -1891,7 +1896,7 @@ for (var re = class {
|
|
|
1891
1896
|
async createFolder({ name: t, parentId: n, is_force_create: r }) {
|
|
1892
1897
|
let i = this.normalizeId(n ?? this._rootId);
|
|
1893
1898
|
if (this._validateName(t, !0), this._validateDuplicates && this._checkNameExistsInCache(i, t, !0)) throw new e("Folder '%s' already exists in parent folder".replace("%s", t), "FolderAlreadyExists");
|
|
1894
|
-
let a = await this._dataProvider.createFolder(t, i, r), o =
|
|
1899
|
+
let a = await this._dataProvider.createFolder(t, i, r), o = q({
|
|
1895
1900
|
id: a.id,
|
|
1896
1901
|
folderId: i,
|
|
1897
1902
|
name: a.name,
|
|
@@ -1930,8 +1935,8 @@ for (var re = class {
|
|
|
1930
1935
|
let t = this.normalizeId(i.folderId);
|
|
1931
1936
|
if (this._checkNameExistsInCache(t, n, !0, r)) throw new e("Folder '%s' already exists in parent folder".replace("%s", n), "FolderAlreadyExists");
|
|
1932
1937
|
}
|
|
1933
|
-
let a =
|
|
1934
|
-
return this._cache.upsertEntity(
|
|
1938
|
+
let a = Y(await this._dataProvider.renameItem(i, n));
|
|
1939
|
+
return this._cache.upsertEntity(q({
|
|
1935
1940
|
...this._cache.getEntity(a.id),
|
|
1936
1941
|
...a
|
|
1937
1942
|
})), this._cache.getEntity(a.id);
|
|
@@ -1945,8 +1950,8 @@ for (var re = class {
|
|
|
1945
1950
|
let t = this.normalizeId(r.folderId);
|
|
1946
1951
|
if (this._checkNameExistsInCache(t, n, !1, i)) throw new e("File '%s' already exists in parent folder".replace("%s", n), "FileAlreadyExists");
|
|
1947
1952
|
}
|
|
1948
|
-
let a =
|
|
1949
|
-
return a && this._cache.upsertEntity(
|
|
1953
|
+
let a = Y(await this._dataProvider.renameItem(r, n));
|
|
1954
|
+
return a && this._cache.upsertEntity(q({
|
|
1950
1955
|
...this._cache.getEntity(i),
|
|
1951
1956
|
...a
|
|
1952
1957
|
})), this._cache.getEntity(i);
|
|
@@ -1957,12 +1962,12 @@ for (var re = class {
|
|
|
1957
1962
|
this._validateTargetFolderType(n);
|
|
1958
1963
|
let a = this._cache.getEntity(t);
|
|
1959
1964
|
if (!a) {
|
|
1960
|
-
let e =
|
|
1965
|
+
let e = Y(await this._dataProvider.moveItem({
|
|
1961
1966
|
id: t,
|
|
1962
1967
|
folderId: i,
|
|
1963
1968
|
isFolder: r
|
|
1964
1969
|
}, i));
|
|
1965
|
-
if (e.id === t) this._cache.upsertEntity(
|
|
1970
|
+
if (e.id === t) this._cache.upsertEntity(q({
|
|
1966
1971
|
...e,
|
|
1967
1972
|
folderId: i
|
|
1968
1973
|
}));
|
|
@@ -1970,7 +1975,7 @@ for (var re = class {
|
|
|
1970
1975
|
try {
|
|
1971
1976
|
this._cache.deleteEntity(t);
|
|
1972
1977
|
} catch {}
|
|
1973
|
-
this._cache.upsertEntity(
|
|
1978
|
+
this._cache.upsertEntity(q({
|
|
1974
1979
|
...e,
|
|
1975
1980
|
folderId: i
|
|
1976
1981
|
}));
|
|
@@ -1985,16 +1990,17 @@ for (var re = class {
|
|
|
1985
1990
|
let t = a.isFolder ? "FolderAlreadyExists" : "FileAlreadyExists";
|
|
1986
1991
|
throw new e(`${a.isFolder ? "Folder" : "File"} '${a.name}' already exists in target folder`, t);
|
|
1987
1992
|
}
|
|
1988
|
-
let o =
|
|
1993
|
+
let o = Y(await this._dataProvider.moveItem(a, i));
|
|
1989
1994
|
if (o.id === t) {
|
|
1990
1995
|
let e = this._cache.moveEntity(t, i);
|
|
1991
|
-
return this._cache.upsertEntity(
|
|
1996
|
+
return this._cache.upsertEntity(q({
|
|
1992
1997
|
...e,
|
|
1993
1998
|
...o
|
|
1994
1999
|
})), !0;
|
|
1995
|
-
}
|
|
2000
|
+
}
|
|
2001
|
+
{
|
|
1996
2002
|
let e = this._cache.deleteEntity(t);
|
|
1997
|
-
return this._cache.upsertEntity(
|
|
2003
|
+
return this._cache.upsertEntity(q({
|
|
1998
2004
|
...e,
|
|
1999
2005
|
...o,
|
|
2000
2006
|
folderId: i
|
|
@@ -2019,7 +2025,7 @@ for (var re = class {
|
|
|
2019
2025
|
detailed: Array(i.length),
|
|
2020
2026
|
success: !0
|
|
2021
2027
|
};
|
|
2022
|
-
if (typeof this._dataProvider.moveItems == "function") a =
|
|
2028
|
+
if (typeof this._dataProvider.moveItems == "function") a = G(await this._dataProvider.moveItems(i, r), (e) => e);
|
|
2023
2029
|
else if (typeof this._dataProvider.moveItem == "function") a.detailed = await Promise.all(n.map(async (e, t) => {
|
|
2024
2030
|
let n = i[t] || {
|
|
2025
2031
|
id: e,
|
|
@@ -2030,7 +2036,7 @@ for (var re = class {
|
|
|
2030
2036
|
try {
|
|
2031
2037
|
return {
|
|
2032
2038
|
requestId: e,
|
|
2033
|
-
data:
|
|
2039
|
+
data: Y(await this._dataProvider.moveItem(n, r)),
|
|
2034
2040
|
success: !0
|
|
2035
2041
|
};
|
|
2036
2042
|
} catch (t) {
|
|
@@ -2048,21 +2054,24 @@ for (var re = class {
|
|
|
2048
2054
|
success: !0,
|
|
2049
2055
|
data: void 0
|
|
2050
2056
|
}));
|
|
2051
|
-
for (let t of e) if (t.success)
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
folderId: r
|
|
2055
|
-
}));
|
|
2056
|
-
else {
|
|
2057
|
-
let e = this._cache.deleteEntity(t.requestId);
|
|
2058
|
-
this._cache.upsertEntity(G({
|
|
2059
|
-
...e,
|
|
2057
|
+
for (let t of e) if (t.success) {
|
|
2058
|
+
if (!t.data || t.data.id === t.requestId) this._cache.moveEntity(t.requestId, r), t.data && this._cache.upsertEntity(q({
|
|
2059
|
+
...this._cache.getEntity(t.requestId),
|
|
2060
2060
|
...t.data,
|
|
2061
2061
|
folderId: r
|
|
2062
2062
|
}));
|
|
2063
|
+
else {
|
|
2064
|
+
let e = this._cache.deleteEntity(t.requestId);
|
|
2065
|
+
this._cache.upsertEntity(q({
|
|
2066
|
+
...e,
|
|
2067
|
+
...t.data,
|
|
2068
|
+
folderId: r
|
|
2069
|
+
}));
|
|
2070
|
+
}
|
|
2063
2071
|
}
|
|
2064
2072
|
return a;
|
|
2065
|
-
}
|
|
2073
|
+
}
|
|
2074
|
+
return {
|
|
2066
2075
|
success: !1,
|
|
2067
2076
|
error: a.error || new e("Move items failed", "MoveNotAllowed")
|
|
2068
2077
|
};
|
|
@@ -2073,11 +2082,11 @@ for (var re = class {
|
|
|
2073
2082
|
this._validateTargetFolderType(n);
|
|
2074
2083
|
let i = this._cache.getEntity(t);
|
|
2075
2084
|
if (!i) {
|
|
2076
|
-
let e =
|
|
2085
|
+
let e = Y(await this._dataProvider.copyItem({
|
|
2077
2086
|
id: t,
|
|
2078
2087
|
folderId: r
|
|
2079
2088
|
}, r));
|
|
2080
|
-
return this._cache.copyEntity(t, r, e.id), this._cache.upsertEntity(
|
|
2089
|
+
return this._cache.copyEntity(t, r, e.id), this._cache.upsertEntity(q({
|
|
2081
2090
|
...e,
|
|
2082
2091
|
folderId: r
|
|
2083
2092
|
})), !0;
|
|
@@ -2089,11 +2098,11 @@ for (var re = class {
|
|
|
2089
2098
|
throw new e(`${i.isFolder ? "Folder" : "File"} '${i.name}' already exists in target folder`, t);
|
|
2090
2099
|
}
|
|
2091
2100
|
}
|
|
2092
|
-
let a =
|
|
2101
|
+
let a = Y(await this._dataProvider.copyItem(i, r));
|
|
2093
2102
|
return this._cache.copyEntity(t, r, a.id, {
|
|
2094
2103
|
...a,
|
|
2095
2104
|
folderId: r
|
|
2096
|
-
}) || this._cache.upsertEntity(
|
|
2105
|
+
}) || this._cache.upsertEntity(q({
|
|
2097
2106
|
...a,
|
|
2098
2107
|
folderId: r
|
|
2099
2108
|
})), !0;
|
|
@@ -2122,7 +2131,7 @@ for (var re = class {
|
|
|
2122
2131
|
detailed: Array(o.length),
|
|
2123
2132
|
success: !0
|
|
2124
2133
|
};
|
|
2125
|
-
if (typeof this._dataProvider.copyItems == "function") s =
|
|
2134
|
+
if (typeof this._dataProvider.copyItems == "function") s = G(await this._dataProvider.copyItems(o, r), (e) => e);
|
|
2126
2135
|
else if (typeof this._dataProvider.copyItem == "function") s.detailed = await Promise.all(a.map(async (e, t) => {
|
|
2127
2136
|
let n = o[t] || {
|
|
2128
2137
|
id: e,
|
|
@@ -2132,7 +2141,7 @@ for (var re = class {
|
|
|
2132
2141
|
try {
|
|
2133
2142
|
return {
|
|
2134
2143
|
requestId: e,
|
|
2135
|
-
data:
|
|
2144
|
+
data: Y(await this._dataProvider.copyItem(n, r)),
|
|
2136
2145
|
success: !0
|
|
2137
2146
|
};
|
|
2138
2147
|
} catch (t) {
|
|
@@ -2146,16 +2155,18 @@ for (var re = class {
|
|
|
2146
2155
|
else throw new e("Copy items is not supported", "CopyNotAllowed");
|
|
2147
2156
|
if (s.success && s.detailed) for (let e = 0, t = s.detailed.length; e < t; e++) {
|
|
2148
2157
|
let t = s.detailed[e];
|
|
2149
|
-
if (t.success)
|
|
2150
|
-
|
|
2151
|
-
|
|
2152
|
-
|
|
2153
|
-
|
|
2154
|
-
|
|
2155
|
-
|
|
2156
|
-
|
|
2157
|
-
|
|
2158
|
-
|
|
2158
|
+
if (t.success) {
|
|
2159
|
+
if (t.data?.id) {
|
|
2160
|
+
let e = t.data.folderId || r;
|
|
2161
|
+
!this._cache.copyEntity(t.requestId, e, t.data.id, {
|
|
2162
|
+
...t.data,
|
|
2163
|
+
folderId: e
|
|
2164
|
+
}) && t.data && this._cache.upsertEntity(q({
|
|
2165
|
+
...t.data,
|
|
2166
|
+
folderId: e
|
|
2167
|
+
}));
|
|
2168
|
+
} else console.error("batchResult in copy method must have ids");
|
|
2169
|
+
}
|
|
2159
2170
|
}
|
|
2160
2171
|
else if (!s.detailed) throw new e("batchResult in copy method must have detailed results", "ValidationError");
|
|
2161
2172
|
return s;
|
|
@@ -2170,7 +2181,7 @@ for (var re = class {
|
|
|
2170
2181
|
}
|
|
2171
2182
|
let t = this.normalizeId(e.folderId ?? this._rootId);
|
|
2172
2183
|
try {
|
|
2173
|
-
let n =
|
|
2184
|
+
let n = q({
|
|
2174
2185
|
...await this._dataProvider.uploadFileByUrl(e.url, t, { eventSource: e.eventSource }),
|
|
2175
2186
|
folderId: t
|
|
2176
2187
|
});
|
|
@@ -2187,42 +2198,15 @@ for (var re = class {
|
|
|
2187
2198
|
let t = this.normalizeId(i.folderId);
|
|
2188
2199
|
if (this._checkNameExistsInCache(t, n.name, !1, r)) throw new e("File '%s' already exists in parent folder".replace("%s", n.name), "FileAlreadyExists");
|
|
2189
2200
|
}
|
|
2190
|
-
let a =
|
|
2191
|
-
return this._cache.upsertEntity(
|
|
2201
|
+
let a = Y(await this._dataProvider.updateFile(i, { ...n }));
|
|
2202
|
+
return this._cache.upsertEntity(q({
|
|
2192
2203
|
...this._cache.getEntity(r),
|
|
2193
2204
|
...a,
|
|
2194
2205
|
...n
|
|
2195
2206
|
})), this._cache.getEntity(r);
|
|
2196
2207
|
}
|
|
2197
|
-
},
|
|
2198
|
-
|
|
2199
|
-
return (Y[e[t + 0]] + Y[e[t + 1]] + Y[e[t + 2]] + Y[e[t + 3]] + "-" + Y[e[t + 4]] + Y[e[t + 5]] + "-" + Y[e[t + 6]] + Y[e[t + 7]] + "-" + Y[e[t + 8]] + Y[e[t + 9]] + "-" + Y[e[t + 10]] + Y[e[t + 11]] + Y[e[t + 12]] + Y[e[t + 13]] + Y[e[t + 14]] + Y[e[t + 15]]).toLowerCase();
|
|
2200
|
-
}
|
|
2201
|
-
//#endregion
|
|
2202
|
-
//#region packages/file-manager/node_modules/uuid/dist/esm-browser/rng.js
|
|
2203
|
-
var Z, ae = /* @__PURE__ */ new Uint8Array(16);
|
|
2204
|
-
function oe() {
|
|
2205
|
-
if (!Z && (Z = typeof crypto < "u" && crypto.getRandomValues && crypto.getRandomValues.bind(crypto), !Z)) throw Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");
|
|
2206
|
-
return Z(ae);
|
|
2207
|
-
}
|
|
2208
|
-
var Q = { randomUUID: typeof crypto < "u" && crypto.randomUUID && crypto.randomUUID.bind(crypto) };
|
|
2209
|
-
//#endregion
|
|
2210
|
-
//#region packages/file-manager/node_modules/uuid/dist/esm-browser/v4.js
|
|
2211
|
-
function se(e, t, n) {
|
|
2212
|
-
if (Q.randomUUID && !t && !e) return Q.randomUUID();
|
|
2213
|
-
e ||= {};
|
|
2214
|
-
var r = e.random || (e.rng || oe)();
|
|
2215
|
-
if (r[6] = r[6] & 15 | 64, r[8] = r[8] & 63 | 128, t) {
|
|
2216
|
-
n ||= 0;
|
|
2217
|
-
for (var i = 0; i < 16; ++i) t[n + i] = r[i];
|
|
2218
|
-
return t;
|
|
2219
|
-
}
|
|
2220
|
-
return ie(r);
|
|
2221
|
-
}
|
|
2222
|
-
//#endregion
|
|
2223
|
-
//#region packages/file-manager/src/adapters/PathAwareStorageAdapter.ts
|
|
2224
|
-
var ce = "", le = "Trash", ue = class {
|
|
2225
|
-
constructor(e, t = ce, n = _, r = le, i = !0) {
|
|
2208
|
+
}, Q = "", te = "Trash", ne = class {
|
|
2209
|
+
constructor(e, t = Q, n = _, r = te, i = !0) {
|
|
2226
2210
|
this._inner = e, this.rootPath = t, this.trashId = n, this.trashPath = r, this.ensureFolderTrailingSlash = i, this._pathToId = /* @__PURE__ */ new Map(), this._idToPath = /* @__PURE__ */ new Map(), this.validateDuplicates = this._inner.validateDuplicates ?? !1, typeof e.getUrl == "function" && (this.getUrl = (t) => e.getUrl({
|
|
2227
2211
|
...t,
|
|
2228
2212
|
id: this.pathForId(t.id, !1),
|
|
@@ -2283,7 +2267,7 @@ var ce = "", le = "Trash", ue = class {
|
|
|
2283
2267
|
let t = v(e);
|
|
2284
2268
|
if (t === v(this.trashPath)) return this.trashId;
|
|
2285
2269
|
if (this._pathToId.has(t)) return this._pathToId.get(t);
|
|
2286
|
-
let n =
|
|
2270
|
+
let n = x();
|
|
2287
2271
|
return this._pathToId.set(t, n), this._idToPath.set(n, t), n;
|
|
2288
2272
|
}
|
|
2289
2273
|
pathForId(t, n, r) {
|
|
@@ -2682,15 +2666,15 @@ var ce = "", le = "Trash", ue = class {
|
|
|
2682
2666
|
};
|
|
2683
2667
|
//#endregion
|
|
2684
2668
|
//#region packages/file-manager/src/utils/directResourceFetchError.ts
|
|
2685
|
-
function
|
|
2669
|
+
function re(e) {
|
|
2686
2670
|
return typeof e != "object" || !e ? !1 : "name" in e && e.name === "DirectResourceFetchError" ? !("final" in e) || e.final !== !1 : "final" in e && e.final === !0;
|
|
2687
2671
|
}
|
|
2688
2672
|
//#endregion
|
|
2689
2673
|
//#region packages/file-manager/src/utils/remoteFileFetchPipeline.ts
|
|
2690
2674
|
function $(t) {
|
|
2691
|
-
if (
|
|
2675
|
+
if (re(t) || t instanceof e) throw t;
|
|
2692
2676
|
}
|
|
2693
|
-
async function
|
|
2677
|
+
async function ie(e, t, n, r, i) {
|
|
2694
2678
|
let { fetchWithProxy: a, handleFileProxy: o, handleProxyUrl: s } = t, c = {
|
|
2695
2679
|
mode: "cors",
|
|
2696
2680
|
...i?.fetchInit
|
|
@@ -2722,6 +2706,6 @@ async function fe(e, t, n, r, i) {
|
|
|
2722
2706
|
throw l instanceof Error ? l : /* @__PURE__ */ Error("Failed to download file from the URL");
|
|
2723
2707
|
}
|
|
2724
2708
|
//#endregion
|
|
2725
|
-
export {
|
|
2709
|
+
export { D as DEFAULT_FILE_MANAGER_CACHE_TTL_MS, Z as DataSourceProxyBase, o as FailedRequestCache, e as FileManagerApiError, s as MutationRegistry, ne as PathAwareStorageAdapter, _ as TRASH_FOLDER_ID, R as TreeCache, L as ViewCacheManager, i as buildAssetsPath, l as compareFileSystemItems, b as createSystemFolderByPathResolver, m as defaultChildrenViewFilterMatch, p as defaultFileSystemItemComparator, h as defaultHasSortValue, N as defaultIsFolderNotFoundError, ie as fetchRemoteImageBlobByUrl, r as getAssetsBase, y as getTrashFolderLookupCandidates, d as hasComparableSortValue, n as joinUrls, t as mapHttpStatusToErrorCode, f as matchesChildrenViewFilter, v as normalizeSystemFolderPath, c as resolveSortParams, g as resolveViewStrategyOptions };
|
|
2726
2710
|
|
|
2727
2711
|
//# sourceMappingURL=core.esm.js.map
|