@seedprotocol/react 0.7.8-next.1034.g2acd2a2 → 0.7.8-next.1066.gac32194
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.js +467 -478
- package/dist/index.js.map +1 -1
- package/dist/item.d.ts.map +1 -1
- package/dist/itemProperty.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import e, { createContext as t, useCallback as n, useContext as r, useEffect as i, useInsertionEffect as a, useMemo as o, useRef as s, useState as c, useSyncExternalStore as l } from "react";
|
|
3
3
|
import { flushSync as u } from "react-dom";
|
|
4
|
-
import { BaseArweaveClient as d, BaseDb as f, BaseFileManager as p, ClientManagerState as m, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as h, FILES_CHANGED_EVENT as g, Item as _, ItemProperty as v, ItemPropertySaveValidationError as y, MachineIds as b, Model as x, ModelProperty as S, SEED_PROTOCOL_SCHEMA_NAME as C, Schema as w, client as T, easName as ee, easSyncProcesses as E, ensureImageLocal as D, eventEmitter as O, getAddressesForItemsFilter as te, getArweaveReadBaseUrls as k, getClient as ne, getPropertySchema as re, getSchemaNameFromId as ie, getVersionData as ae, loadAllSchemasFromDb as
|
|
4
|
+
import { BaseArweaveClient as d, BaseDb as f, BaseFileManager as p, ClientManagerState as m, EAS_SEED_DATA_SYNCED_TO_DB_EVENT as h, FILES_CHANGED_EVENT as g, Item as _, ItemProperty as v, ItemPropertySaveValidationError as y, MachineIds as b, Model as x, ModelProperty as S, SEED_PROTOCOL_SCHEMA_NAME as C, Schema as w, client as T, easName as ee, easSyncProcesses as E, ensureImageLocal as D, eventEmitter as O, getAddressesForItemsFilter as te, getArweaveReadBaseUrls as k, getClient as ne, getPropertySchema as re, getSchemaNameFromId as ie, getVersionData as ae, loadAllSchemasFromDb as oe, metadata as A, modelSchemas as j, models as M, normalizeArweaveTxIdForEnsure as se, normalizeFeedItemFields as ce, ownedSeedsSql as le, pickLatestMetadataRowPerProperty as ue, placeholderUidSql as N, properties as P, publisherInAddressListSql as de, resolveMediaRef as fe, schemas as F, seeds as I } from "@seedprotocol/sdk";
|
|
5
5
|
import { debounce as L, orderBy as pe, startCase as R } from "lodash-es";
|
|
6
6
|
import z from "debug";
|
|
7
7
|
import { Fragment as B, jsx as V, jsxs as H } from "react/jsx-runtime";
|
|
@@ -250,20 +250,20 @@ var Ue = z("seedSdk:react:item"), We = (e) => [
|
|
|
250
250
|
O.off(h, e);
|
|
251
251
|
};
|
|
252
252
|
}, [p]);
|
|
253
|
-
let m = s([]), g = s(/* @__PURE__ */ new Set()), v = s(
|
|
253
|
+
let m = s([]), g = s(/* @__PURE__ */ new Set()), v = s(0), y = s(0), [b, x] = c(null);
|
|
254
254
|
i(() => {
|
|
255
255
|
if (l !== "owned" && l !== "watched") {
|
|
256
|
-
|
|
256
|
+
x(null);
|
|
257
257
|
return;
|
|
258
258
|
}
|
|
259
259
|
let e = !1;
|
|
260
260
|
return te(l).then((t) => {
|
|
261
|
-
e ||
|
|
261
|
+
e || x(t);
|
|
262
262
|
}), () => {
|
|
263
263
|
e = !0;
|
|
264
264
|
};
|
|
265
265
|
}, [l, d]);
|
|
266
|
-
let
|
|
266
|
+
let S = o(() => Ke(e, r, a, l, d, t, n), [
|
|
267
267
|
e,
|
|
268
268
|
r,
|
|
269
269
|
a,
|
|
@@ -273,27 +273,28 @@ var Ue = z("seedSdk:react:item"), We = (e) => [
|
|
|
273
273
|
n
|
|
274
274
|
]);
|
|
275
275
|
i(() => {
|
|
276
|
-
|
|
277
|
-
}, [
|
|
278
|
-
let { data:
|
|
279
|
-
queryKey:
|
|
280
|
-
queryFn: async () => await _.all(e, r, {
|
|
276
|
+
g.current = /* @__PURE__ */ new Set();
|
|
277
|
+
}, [S]);
|
|
278
|
+
let { data: C = [], isLoading: w, isFetching: T, dataUpdatedAt: E, error: D } = U({
|
|
279
|
+
queryKey: S,
|
|
280
|
+
queryFn: async ({ signal: i }) => (v.current++, await _.all(e, r, {
|
|
281
281
|
waitForReady: !0,
|
|
282
282
|
includeEas: a,
|
|
283
283
|
addressFilter: l,
|
|
284
284
|
modelFileId: t,
|
|
285
|
-
schemaName: n
|
|
286
|
-
|
|
285
|
+
schemaName: n,
|
|
286
|
+
signal: i
|
|
287
|
+
})),
|
|
287
288
|
enabled: u,
|
|
288
289
|
staleTime: 0
|
|
289
290
|
});
|
|
290
|
-
m.current =
|
|
291
|
-
let
|
|
292
|
-
if (!
|
|
291
|
+
m.current = C;
|
|
292
|
+
let k = u ? f.getAppDb() : null, ne = Y(o(() => {
|
|
293
|
+
if (!k || (l === "owned" || l === "watched") && b === null) return null;
|
|
293
294
|
let t = [];
|
|
294
|
-
a || t.push(N(I.uid)), e && t.push(G(I.type, ee(e))), l === "owned" ? t.push(le(
|
|
295
|
+
a || t.push(N(I.uid)), e && t.push(G(I.type, ee(e))), l === "owned" ? t.push(le(b ?? [])) : l === "watched" && t.push(de(I.publisher, b ?? [])), r ? t.push(G(I._markedForDeletion, 1)) : (t.push(K(xe(I._markedForDeletion), G(I._markedForDeletion, 0))), t.push(K(xe(I.revokedAt), G(I.revokedAt, 0))));
|
|
295
296
|
let n = ae();
|
|
296
|
-
return
|
|
297
|
+
return k.with(n).select({
|
|
297
298
|
localId: I.localId,
|
|
298
299
|
uid: I.uid,
|
|
299
300
|
type: I.type,
|
|
@@ -303,18 +304,18 @@ var Ue = z("seedSdk:react:item"), We = (e) => [
|
|
|
303
304
|
_markedForDeletion: I._markedForDeletion
|
|
304
305
|
}).from(I).leftJoin(n, G(I.localId, n.seedLocalId)).where(ve(ye(n.versionsCount, 0), ...t)).groupBy(I.localId);
|
|
305
306
|
}, [
|
|
306
|
-
|
|
307
|
+
k,
|
|
307
308
|
u,
|
|
308
309
|
e,
|
|
309
310
|
r,
|
|
310
311
|
a,
|
|
311
312
|
l,
|
|
312
|
-
|
|
313
|
+
b
|
|
313
314
|
]));
|
|
314
315
|
return i(() => {
|
|
315
|
-
if (!u || !
|
|
316
|
+
if (!u || !ne) return;
|
|
316
317
|
let e = /* @__PURE__ */ new Set();
|
|
317
|
-
for (let t of
|
|
318
|
+
for (let t of ne) {
|
|
318
319
|
let n = t.localId || t.uid;
|
|
319
320
|
n && e.add(n);
|
|
320
321
|
}
|
|
@@ -323,22 +324,18 @@ var Ue = z("seedSdk:react:item"), We = (e) => [
|
|
|
323
324
|
let n = e.seedLocalId || e.seedUid;
|
|
324
325
|
n && t.add(n);
|
|
325
326
|
}
|
|
326
|
-
|
|
327
|
-
if (!v.current && (v.current = !0, e.size > 0 && t.size === 0)) {
|
|
328
|
-
g.current = new Set(e), p.invalidateQueries({ queryKey: x });
|
|
329
|
-
return;
|
|
330
|
-
}
|
|
331
|
-
let n = g.current;
|
|
332
|
-
n.size === e.size && [...n].every((t) => e.has(t)) || (t.size === e.size && [...t].every((t) => e.has(t)) ? g.current = new Set(e) : (g.current = new Set(e), p.invalidateQueries({ queryKey: x })));
|
|
327
|
+
e.size === 0 && t.size > 0 || (Xe(t, e) ? g.current = e : Xe(g.current, e) && (v.current > y.current || T) || (g.current = e, y.current = v.current, p.invalidateQueries({ queryKey: S })));
|
|
333
328
|
}, [
|
|
334
329
|
u,
|
|
335
|
-
|
|
330
|
+
ne,
|
|
336
331
|
p,
|
|
337
|
-
|
|
332
|
+
S,
|
|
333
|
+
E,
|
|
334
|
+
T
|
|
338
335
|
]), {
|
|
339
|
-
items: o(() => pe(
|
|
340
|
-
isLoading:
|
|
341
|
-
error:
|
|
336
|
+
items: o(() => pe(C, [(e) => e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]), [C]),
|
|
337
|
+
isLoading: w || !u,
|
|
338
|
+
error: D
|
|
342
339
|
};
|
|
343
340
|
}, Je = () => {
|
|
344
341
|
let [e, t] = c(!1), [r, i] = c(null), a = s(null), o = n(() => i(null), []);
|
|
@@ -390,14 +387,20 @@ var Ue = z("seedSdk:react:item"), We = (e) => [
|
|
|
390
387
|
error: o,
|
|
391
388
|
resetError: d
|
|
392
389
|
};
|
|
393
|
-
}
|
|
390
|
+
};
|
|
391
|
+
function Xe(e, t) {
|
|
392
|
+
return e.size === t.size && [...e].every((e) => t.has(e));
|
|
393
|
+
}
|
|
394
|
+
//#endregion
|
|
395
|
+
//#region src/itemProperty.ts
|
|
396
|
+
var Ze = z("seedSdk:react:property"), Qe = z("seedSdk:react:itemProperties"), $e = (e, t, n) => [
|
|
394
397
|
"seed",
|
|
395
398
|
"itemProperty",
|
|
396
399
|
e ?? null,
|
|
397
400
|
t ?? null,
|
|
398
401
|
n
|
|
399
402
|
];
|
|
400
|
-
function
|
|
403
|
+
function et(e, t) {
|
|
401
404
|
let n = J(), r = X(), [, a] = c(0), s = typeof e == "object" && e ? e : null, l = s?.itemId, u = s?.seedLocalId, d = s?.seedUid, f = s?.propertyName, p = typeof e == "string" ? e : l !== void 0 && l !== "" ? l : void 0, m = f ?? (typeof e == "string" ? t : void 0), h = o(() => {
|
|
402
405
|
let e = p !== void 0 && p !== "" ? p : u, t = p !== void 0 && p !== "" ? void 0 : d;
|
|
403
406
|
return (e || t) && m ? {
|
|
@@ -412,7 +415,7 @@ function $e(e, t) {
|
|
|
412
415
|
m,
|
|
413
416
|
u,
|
|
414
417
|
d
|
|
415
|
-
]), g = o(() =>
|
|
418
|
+
]), g = o(() => $e(h?.seedLocalId, h?.seedUid, h?.propertyName ?? ""), [h]), _ = U({
|
|
416
419
|
queryKey: g,
|
|
417
420
|
queryFn: async () => {
|
|
418
421
|
if (!h) return null;
|
|
@@ -426,7 +429,7 @@ function $e(e, t) {
|
|
|
426
429
|
seedUid: h.itemId,
|
|
427
430
|
hold: !1
|
|
428
431
|
}) : void 0, n = e ?? t;
|
|
429
|
-
return n ||
|
|
432
|
+
return n || Ze(`[useItemProperty] no property found for Item.${h.seedLocalId || h.seedUid}.${h.propertyName}`), n ?? null;
|
|
430
433
|
},
|
|
431
434
|
initialData: () => h ? v.peekReady(h) : void 0,
|
|
432
435
|
staleTime: 0,
|
|
@@ -435,7 +438,7 @@ function $e(e, t) {
|
|
|
435
438
|
retry: !1,
|
|
436
439
|
enabled: n && !!h
|
|
437
440
|
}, r), y = _.data ?? void 0;
|
|
438
|
-
return
|
|
441
|
+
return rt(o(() => y ? [y] : [], [y])), i(() => {
|
|
439
442
|
if (!y) return;
|
|
440
443
|
let e = () => a((e) => e + 1), t = y.getService().getSnapshot()?.context, n = t?.renderValue, r = t?.propertyValue, i = !1, o = 0, s, c = y.getService().subscribe((t) => {
|
|
441
444
|
let a = t?.context ?? {};
|
|
@@ -462,8 +465,8 @@ function $e(e, t) {
|
|
|
462
465
|
error: _.error
|
|
463
466
|
};
|
|
464
467
|
}
|
|
465
|
-
function
|
|
466
|
-
let r = "itemId" in e ? e.itemId : void 0, a = "seedLocalId" in e ? e.seedLocalId : void 0, c = "seedUid" in e ? e.seedUid : void 0, l = e.propertyName, { property: u, isLoading: d, error: f } =
|
|
468
|
+
function tt(e, t = 300) {
|
|
469
|
+
let r = "itemId" in e ? e.itemId : void 0, a = "seedLocalId" in e ? e.seedLocalId : void 0, c = "seedUid" in e ? e.seedUid : void 0, l = e.propertyName, { property: u, isLoading: d, error: f } = et(o(() => r ? {
|
|
467
470
|
itemId: r,
|
|
468
471
|
propertyName: l
|
|
469
472
|
} : {
|
|
@@ -475,36 +478,22 @@ function et(e, t = 300) {
|
|
|
475
478
|
a,
|
|
476
479
|
c,
|
|
477
480
|
l
|
|
478
|
-
])), p = s(""), m =
|
|
479
|
-
|
|
480
|
-
m.current = null, e.setValue(p.current, { before: t });
|
|
481
|
+
])), p = s(""), m = nt(u), h = o(() => L((e) => {
|
|
482
|
+
e.setValue(p.current);
|
|
481
483
|
}, t), [t]);
|
|
482
|
-
i(() => () =>
|
|
483
|
-
let
|
|
484
|
+
i(() => () => h.flush(), [h]);
|
|
485
|
+
let g = n(() => h.flush(), [h]);
|
|
484
486
|
return {
|
|
485
487
|
property: u,
|
|
486
488
|
setValue: n((e) => {
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
m.current = {
|
|
491
|
-
propertyValue: e.propertyValue,
|
|
492
|
-
renderValue: e.renderValue
|
|
493
|
-
};
|
|
494
|
-
}
|
|
495
|
-
p.current = e, u.getService().send({
|
|
496
|
-
type: "updateContext",
|
|
497
|
-
propertyValue: e,
|
|
498
|
-
renderValue: e
|
|
499
|
-
}), g(u);
|
|
500
|
-
}
|
|
501
|
-
}, [u, g]),
|
|
502
|
-
flush: _,
|
|
489
|
+
u && (p.current = e, u.showValue(e), h(u));
|
|
490
|
+
}, [u, h]),
|
|
491
|
+
flush: g,
|
|
503
492
|
isLoading: d,
|
|
504
|
-
error: f ??
|
|
493
|
+
error: f ?? m
|
|
505
494
|
};
|
|
506
495
|
}
|
|
507
|
-
function
|
|
496
|
+
function nt(e) {
|
|
508
497
|
let [t, n] = c(null);
|
|
509
498
|
return i(() => {
|
|
510
499
|
if (!e) {
|
|
@@ -524,7 +513,7 @@ function tt(e) {
|
|
|
524
513
|
return () => a.unsubscribe();
|
|
525
514
|
}, [e]), t;
|
|
526
515
|
}
|
|
527
|
-
function
|
|
516
|
+
function rt(e) {
|
|
528
517
|
i(() => {
|
|
529
518
|
let t = e.filter((e) => v.retain(e));
|
|
530
519
|
return () => {
|
|
@@ -534,7 +523,7 @@ function nt(e) {
|
|
|
534
523
|
};
|
|
535
524
|
}, [e]);
|
|
536
525
|
}
|
|
537
|
-
async function
|
|
526
|
+
async function it(e, t) {
|
|
538
527
|
if (!e && !t) return [];
|
|
539
528
|
let n = f.getAppDb();
|
|
540
529
|
if (!n) return [];
|
|
@@ -561,7 +550,7 @@ async function rt(e, t) {
|
|
|
561
550
|
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.resolveAsync(o, { modelFileId: c });
|
|
562
551
|
if (t?.properties) for (let e of t.properties) e.name && l.push(e.name);
|
|
563
552
|
} catch (e) {
|
|
564
|
-
|
|
553
|
+
Qe(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
565
554
|
}
|
|
566
555
|
if (o && l.length > 0) {
|
|
567
556
|
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, s = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
@@ -578,7 +567,7 @@ async function rt(e, t) {
|
|
|
578
567
|
});
|
|
579
568
|
t && i.push(t);
|
|
580
569
|
} catch (t) {
|
|
581
|
-
|
|
570
|
+
Ze(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
582
571
|
}
|
|
583
572
|
}
|
|
584
573
|
if (e || t) {
|
|
@@ -598,13 +587,13 @@ async function rt(e, t) {
|
|
|
598
587
|
});
|
|
599
588
|
l && i.push(l);
|
|
600
589
|
} catch (e) {
|
|
601
|
-
|
|
590
|
+
Ze("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
602
591
|
}
|
|
603
592
|
}
|
|
604
593
|
}
|
|
605
594
|
return i;
|
|
606
595
|
}
|
|
607
|
-
function
|
|
596
|
+
function at(e) {
|
|
608
597
|
let t = J(), n = _e(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
609
598
|
type: "itemId",
|
|
610
599
|
itemId: e
|
|
@@ -622,40 +611,40 @@ function it(e) {
|
|
|
622
611
|
u
|
|
623
612
|
], [u]), { data: p = [], isLoading: m, error: h } = U({
|
|
624
613
|
queryKey: d,
|
|
625
|
-
queryFn: () =>
|
|
614
|
+
queryFn: () => it(c, l),
|
|
626
615
|
enabled: t && !!u,
|
|
627
616
|
gcTime: 0
|
|
628
617
|
});
|
|
629
|
-
|
|
618
|
+
rt(p);
|
|
630
619
|
let g = Y(o(() => {
|
|
631
|
-
if (!t || !c && !l) return
|
|
620
|
+
if (!t || !c && !l) return Qe("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
632
621
|
let e = f.getAppDb();
|
|
633
|
-
if (!e) return
|
|
634
|
-
|
|
622
|
+
if (!e) return Qe("[useItemProperties] Query: returning null (no db)"), null;
|
|
623
|
+
Qe(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
635
624
|
let n = l ? e.select({
|
|
636
|
-
propertyName:
|
|
637
|
-
propertyValue:
|
|
638
|
-
seedLocalId:
|
|
639
|
-
seedUid:
|
|
640
|
-
modelType:
|
|
641
|
-
schemaUid:
|
|
642
|
-
createdAt:
|
|
643
|
-
attestationCreatedAt:
|
|
644
|
-
localId:
|
|
645
|
-
revokedAt:
|
|
646
|
-
}).from(
|
|
647
|
-
propertyName:
|
|
648
|
-
propertyValue:
|
|
649
|
-
seedLocalId:
|
|
650
|
-
seedUid:
|
|
651
|
-
modelType:
|
|
652
|
-
schemaUid:
|
|
653
|
-
createdAt:
|
|
654
|
-
attestationCreatedAt:
|
|
655
|
-
localId:
|
|
656
|
-
revokedAt:
|
|
657
|
-
}).from(
|
|
658
|
-
return
|
|
625
|
+
propertyName: A.propertyName,
|
|
626
|
+
propertyValue: A.propertyValue,
|
|
627
|
+
seedLocalId: A.seedLocalId,
|
|
628
|
+
seedUid: A.seedUid,
|
|
629
|
+
modelType: A.modelType,
|
|
630
|
+
schemaUid: A.schemaUid,
|
|
631
|
+
createdAt: A.createdAt,
|
|
632
|
+
attestationCreatedAt: A.attestationCreatedAt,
|
|
633
|
+
localId: A.localId,
|
|
634
|
+
revokedAt: A.revokedAt
|
|
635
|
+
}).from(A).where(ve(G(A.seedUid, l), be(A.propertyName))) : c ? e.select({
|
|
636
|
+
propertyName: A.propertyName,
|
|
637
|
+
propertyValue: A.propertyValue,
|
|
638
|
+
seedLocalId: A.seedLocalId,
|
|
639
|
+
seedUid: A.seedUid,
|
|
640
|
+
modelType: A.modelType,
|
|
641
|
+
schemaUid: A.schemaUid,
|
|
642
|
+
createdAt: A.createdAt,
|
|
643
|
+
attestationCreatedAt: A.attestationCreatedAt,
|
|
644
|
+
localId: A.localId,
|
|
645
|
+
revokedAt: A.revokedAt
|
|
646
|
+
}).from(A).where(ve(G(A.seedLocalId, c), be(A.propertyName))) : null;
|
|
647
|
+
return Qe("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
659
648
|
}, [
|
|
660
649
|
t,
|
|
661
650
|
c,
|
|
@@ -686,7 +675,7 @@ function it(e) {
|
|
|
686
675
|
error: h
|
|
687
676
|
};
|
|
688
677
|
}
|
|
689
|
-
var
|
|
678
|
+
var ot = () => {
|
|
690
679
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
691
680
|
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
692
681
|
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
@@ -715,7 +704,7 @@ var at = () => {
|
|
|
715
704
|
error: a,
|
|
716
705
|
resetError: l
|
|
717
706
|
};
|
|
718
|
-
},
|
|
707
|
+
}, st = () => {
|
|
719
708
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
720
709
|
return {
|
|
721
710
|
destroy: n(async (e) => {
|
|
@@ -734,25 +723,25 @@ var at = () => {
|
|
|
734
723
|
error: r,
|
|
735
724
|
resetError: n(() => i(null), [])
|
|
736
725
|
};
|
|
737
|
-
},
|
|
726
|
+
}, ct = /* @__PURE__ */ new Set([
|
|
738
727
|
m.SAVE_CONFIG,
|
|
739
728
|
m.PROCESS_SCHEMA_FILES,
|
|
740
729
|
m.ADD_MODELS_TO_STORE,
|
|
741
730
|
m.ADD_MODELS_TO_DB,
|
|
742
731
|
m.IDLE
|
|
743
|
-
]),
|
|
732
|
+
]), lt = (e) => typeof e == "string" && ct.has(e), ut = () => ({ dbsAreReady: q((e) => e.status === "active" && lt(e.value)) }), dt = z("seedSdk:react:services"), ft = [
|
|
744
733
|
"idle",
|
|
745
734
|
"ready",
|
|
746
735
|
"done",
|
|
747
736
|
"success",
|
|
748
737
|
"initialized"
|
|
749
|
-
],
|
|
738
|
+
], pt = (e) => {
|
|
750
739
|
let t = "actor", n = e;
|
|
751
|
-
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t =
|
|
752
|
-
}, pt = (e) => {
|
|
753
|
-
let t;
|
|
754
|
-
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), ft(e) === "global" && t && typeof t == "object" && Object.keys(t).length > 0 && Object.keys(t)[0] === "initialized" && (t = "ready"), t && typeof t == "object" && (t = JSON.stringify(t)), t;
|
|
740
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = ht(e)), t;
|
|
755
741
|
}, mt = (e) => {
|
|
742
|
+
let t;
|
|
743
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), pt(e) === "global" && t && typeof t == "object" && Object.keys(t).length > 0 && Object.keys(t)[0] === "initialized" && (t = "ready"), t && typeof t == "object" && (t = JSON.stringify(t)), t;
|
|
744
|
+
}, ht = (e) => {
|
|
756
745
|
let t = e;
|
|
757
746
|
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
758
747
|
let n = t.logic.config;
|
|
@@ -763,23 +752,23 @@ var at = () => {
|
|
|
763
752
|
try {
|
|
764
753
|
i = e.getSnapshot();
|
|
765
754
|
} catch (e) {
|
|
766
|
-
return
|
|
755
|
+
return dt("Error:", e), r;
|
|
767
756
|
}
|
|
768
757
|
if (i) {
|
|
769
758
|
let e = i.context;
|
|
770
759
|
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = Se(e.modelName.toLowerCase()));
|
|
771
760
|
}
|
|
772
761
|
return r;
|
|
773
|
-
},
|
|
762
|
+
}, gt = (e) => e?.logic?.config?.id === b.CLIENT_MANAGER, _t = (e) => {
|
|
774
763
|
let t = e?.getSnapshot();
|
|
775
|
-
if (
|
|
776
|
-
let n =
|
|
777
|
-
if (n &&
|
|
764
|
+
if (gt(e)) return t?.status === "active" ? St(t.value) : 0;
|
|
765
|
+
let n = mt(e);
|
|
766
|
+
if (n && ft.includes(n)) return 100;
|
|
778
767
|
let r = e?.logic?.states;
|
|
779
768
|
if (!n || !r) return 0;
|
|
780
769
|
let i = Object.entries(r).filter(([, e]) => e.tags?.includes("loading")).map(([e]) => e), a = i.indexOf(n);
|
|
781
770
|
return a < 0 ? 0 : a / i.length * 100;
|
|
782
|
-
},
|
|
771
|
+
}, vt = (e) => {
|
|
783
772
|
let [t, r] = c(0), a = n((t) => {
|
|
784
773
|
let n = e.subscribe({
|
|
785
774
|
next: t,
|
|
@@ -787,7 +776,7 @@ var at = () => {
|
|
|
787
776
|
complete: t
|
|
788
777
|
});
|
|
789
778
|
return () => n.unsubscribe();
|
|
790
|
-
}, [e]), o = () =>
|
|
779
|
+
}, [e]), o = () => mt(e), s = l(a, o, o), u = n((t) => {
|
|
791
780
|
let n = e.getSnapshot().value;
|
|
792
781
|
n === "done" || n === "success" || n === "idle" || n === "ready" ? clearInterval(t) : r((e) => e + 1);
|
|
793
782
|
}, [e]), d = n(() => {
|
|
@@ -800,16 +789,16 @@ var at = () => {
|
|
|
800
789
|
let e = d();
|
|
801
790
|
return () => clearInterval(e);
|
|
802
791
|
}, []), {
|
|
803
|
-
name:
|
|
792
|
+
name: pt(e),
|
|
804
793
|
timeElapsed: t,
|
|
805
794
|
value: s,
|
|
806
|
-
percentComplete:
|
|
807
|
-
uniqueKey:
|
|
795
|
+
percentComplete: _t(e),
|
|
796
|
+
uniqueKey: ht(e)
|
|
808
797
|
};
|
|
809
|
-
},
|
|
810
|
-
let { internalStatus: e } =
|
|
798
|
+
}, yt = () => {
|
|
799
|
+
let { internalStatus: e } = wt();
|
|
811
800
|
return e === "ready";
|
|
812
|
-
},
|
|
801
|
+
}, bt = () => {}, xt = () => !1, St = (e) => {
|
|
813
802
|
switch (e) {
|
|
814
803
|
case m.IDLE: return 100;
|
|
815
804
|
case m.ADD_MODELS_TO_DB: return 90;
|
|
@@ -821,17 +810,17 @@ var at = () => {
|
|
|
821
810
|
case m.PLATFORM_CLASSES_INIT: return 10;
|
|
822
811
|
default: return 0;
|
|
823
812
|
}
|
|
824
|
-
},
|
|
825
|
-
let e = Te(), t = q((e) => e.status === "active" ?
|
|
813
|
+
}, Ct = () => {
|
|
814
|
+
let e = Te(), t = q((e) => e.status === "active" ? St(e.value) : 0);
|
|
826
815
|
return {
|
|
827
816
|
services: o(() => (e.uniqueKey = "clientManager", [e]), [e]),
|
|
828
817
|
percentComplete: t
|
|
829
818
|
};
|
|
830
|
-
},
|
|
819
|
+
}, wt = () => ({
|
|
831
820
|
status: q((e) => e.value),
|
|
832
|
-
internalStatus: q((e) => e.status === "active" &&
|
|
833
|
-
}),
|
|
834
|
-
function
|
|
821
|
+
internalStatus: q((e) => e.status === "active" && lt(e.value) ? "ready" : e.value)
|
|
822
|
+
}), Tt = (e) => e instanceof Error ? e : Error(String(e));
|
|
823
|
+
function Et(e) {
|
|
835
824
|
let t = s(null), r = s(0), [a, o] = c(!1), [l, u] = c(null), d = n(() => u(null), []), f = n((n) => {
|
|
836
825
|
let r = (t) => {
|
|
837
826
|
if (t.value === "error") {
|
|
@@ -841,7 +830,7 @@ function Tt(e) {
|
|
|
841
830
|
}, i = n.getService();
|
|
842
831
|
t.current = i.subscribe(r), r(i.getSnapshot());
|
|
843
832
|
}, [e]), p = n((e) => {
|
|
844
|
-
throw u(
|
|
833
|
+
throw u(Tt(e)), o(!1), e;
|
|
845
834
|
}, []), m = n(() => (t.current?.unsubscribe(), t.current = null, u(null), o(!0), ++r.current), []), h = n((e) => {
|
|
846
835
|
m();
|
|
847
836
|
let t;
|
|
@@ -881,11 +870,11 @@ function Tt(e) {
|
|
|
881
870
|
}
|
|
882
871
|
//#endregion
|
|
883
872
|
//#region src/schema.ts
|
|
884
|
-
var
|
|
873
|
+
var Dt = z("seedSdk:react:schema"), Ot = (e) => {
|
|
885
874
|
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d = J(), f = n(async (e, t) => {
|
|
886
875
|
o(!0), l(null);
|
|
887
876
|
try {
|
|
888
|
-
if (!await
|
|
877
|
+
if (!await kt(e)) {
|
|
889
878
|
if (!t.current) return;
|
|
890
879
|
r(null), o(!1);
|
|
891
880
|
return;
|
|
@@ -902,7 +891,7 @@ var Et = z("seedSdk:react:schema"), Dt = (e) => {
|
|
|
902
891
|
};
|
|
903
892
|
a(i.getSnapshot()), t.subscription = i.subscribe(a);
|
|
904
893
|
} catch (e) {
|
|
905
|
-
if (
|
|
894
|
+
if (Dt("[useSchema] Error creating schema:", e), !t.current) return;
|
|
906
895
|
l(e), r(null), o(!1);
|
|
907
896
|
}
|
|
908
897
|
}, []);
|
|
@@ -929,14 +918,14 @@ var Et = z("seedSdk:react:schema"), Dt = (e) => {
|
|
|
929
918
|
error: s
|
|
930
919
|
};
|
|
931
920
|
};
|
|
932
|
-
async function
|
|
921
|
+
async function kt(e) {
|
|
933
922
|
if (e === C) return !0;
|
|
934
923
|
let t = f.getAppDb();
|
|
935
924
|
return !t || (await t.select({ id: F.id }).from(F).where(K(G(F.name, e), G(F.schemaFileId, e))).limit(1)).length > 0;
|
|
936
925
|
}
|
|
937
|
-
var
|
|
926
|
+
var At = ["seed", "schemas"], jt = () => {
|
|
938
927
|
let e = J(), t = X(), n = s(void 0), r = s([]), { data: a = [], isLoading: c, error: l } = U({
|
|
939
|
-
queryKey:
|
|
928
|
+
queryKey: At,
|
|
940
929
|
queryFn: () => w.all({ waitForReady: !0 }),
|
|
941
930
|
enabled: e
|
|
942
931
|
}, t);
|
|
@@ -945,7 +934,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
945
934
|
return i(() => {
|
|
946
935
|
if (typeof BroadcastChannel > "u") return;
|
|
947
936
|
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
948
|
-
t.invalidateQueries({ queryKey:
|
|
937
|
+
t.invalidateQueries({ queryKey: At });
|
|
949
938
|
};
|
|
950
939
|
return e.addEventListener("message", n), () => {
|
|
951
940
|
e.removeEventListener("message", n), e.close();
|
|
@@ -968,7 +957,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
968
957
|
let o = /* @__PURE__ */ new Set();
|
|
969
958
|
for (let e of d) e.name !== "Seed Protocol" && (e.schemaFileId ? o.add(e.schemaFileId) : e.name != null && e.version !== void 0 && o.add(`${e.name}:${e.version}`));
|
|
970
959
|
let s = a.size === o.size && [...a].every((e) => o.has(e)), c = a.size > 0 && o.size > 0 && [...o].some((e) => !a.has(e)), l = [...a].some((e) => !o.has(e));
|
|
971
|
-
!s && (c || l) && t.invalidateQueries({ queryKey:
|
|
960
|
+
!s && (c || l) && t.invalidateQueries({ queryKey: At });
|
|
972
961
|
}, [
|
|
973
962
|
e,
|
|
974
963
|
d,
|
|
@@ -978,15 +967,15 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
978
967
|
isLoading: c,
|
|
979
968
|
error: l
|
|
980
969
|
};
|
|
981
|
-
},
|
|
982
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
970
|
+
}, Mt = () => {
|
|
971
|
+
let { run: e, isLoading: t, error: r, resetError: i } = Et("Failed to create schema");
|
|
983
972
|
return {
|
|
984
973
|
createSchema: n((t) => e(() => w.create(t, { waitForReady: !1 })), [e]),
|
|
985
974
|
isLoading: t,
|
|
986
975
|
error: r,
|
|
987
976
|
resetError: i
|
|
988
977
|
};
|
|
989
|
-
},
|
|
978
|
+
}, Nt = () => {
|
|
990
979
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
991
980
|
return {
|
|
992
981
|
destroy: n(async (e) => {
|
|
@@ -1005,10 +994,10 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1005
994
|
error: r,
|
|
1006
995
|
resetError: n(() => i(null), [])
|
|
1007
996
|
};
|
|
1008
|
-
},
|
|
997
|
+
}, Pt = () => {
|
|
1009
998
|
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = J(), o = n(async () => {
|
|
1010
999
|
if (a) try {
|
|
1011
|
-
let e = await
|
|
1000
|
+
let e = await oe(), n = /* @__PURE__ */ new Set();
|
|
1012
1001
|
for (let t of e) {
|
|
1013
1002
|
let e = t.schema.metadata?.name;
|
|
1014
1003
|
e && n.add(e);
|
|
@@ -1024,7 +1013,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1024
1013
|
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
1025
1014
|
r.current = i, t(Array.from(i.values()));
|
|
1026
1015
|
} catch (e) {
|
|
1027
|
-
|
|
1016
|
+
Dt("Error fetching all schema versions from database:", e), t(null);
|
|
1028
1017
|
}
|
|
1029
1018
|
}, [a]);
|
|
1030
1019
|
return i(() => {
|
|
@@ -1034,12 +1023,12 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1034
1023
|
e.unload();
|
|
1035
1024
|
}), r.current.clear();
|
|
1036
1025
|
}, []), e;
|
|
1037
|
-
},
|
|
1026
|
+
}, Ft = () => Ot(C), It = (e) => [
|
|
1038
1027
|
"seed",
|
|
1039
1028
|
"models",
|
|
1040
1029
|
e
|
|
1041
|
-
],
|
|
1042
|
-
let t = J(), n = X(), r = s(null), a = o(() =>
|
|
1030
|
+
], Lt = (e) => {
|
|
1031
|
+
let t = J(), n = X(), r = s(null), a = o(() => It(e), [e]), { data: c = [], isLoading: l, error: u } = U({
|
|
1043
1032
|
queryKey: a,
|
|
1044
1033
|
queryFn: async () => {
|
|
1045
1034
|
let t = await x.all(e, { waitForReady: !1 }), i = n.getQueryData(a), o = r.current;
|
|
@@ -1065,9 +1054,9 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1065
1054
|
function g() {
|
|
1066
1055
|
let t = f.getAppDb();
|
|
1067
1056
|
return !t || !e ? null : t.select({
|
|
1068
|
-
modelFileId:
|
|
1069
|
-
modelName:
|
|
1070
|
-
}).from(F).innerJoin(
|
|
1057
|
+
modelFileId: M.schemaFileId,
|
|
1058
|
+
modelName: M.name
|
|
1059
|
+
}).from(F).innerJoin(j, G(F.id, j.schemaId)).innerJoin(M, G(j.modelId, M.id)).where(K(G(F.schemaFileId, e), G(F.name, e)));
|
|
1071
1060
|
}
|
|
1072
1061
|
let _ = Y(o(() => {
|
|
1073
1062
|
if (!e || !t) return null;
|
|
@@ -1100,7 +1089,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1100
1089
|
isLoading: l,
|
|
1101
1090
|
error: u
|
|
1102
1091
|
};
|
|
1103
|
-
},
|
|
1092
|
+
}, Rt = (e, t) => {
|
|
1104
1093
|
let n = J(), [r, a] = c(void 0), [l, u] = c(!1), [d, f] = c(null), p = s(void 0), [, m] = c(0), h = t == null;
|
|
1105
1094
|
i(() => {
|
|
1106
1095
|
!n || !h || !e ? (a(void 0), u(!1), f(null)) : (async () => {
|
|
@@ -1117,7 +1106,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1117
1106
|
h,
|
|
1118
1107
|
e
|
|
1119
1108
|
]);
|
|
1120
|
-
let { models: g, isLoading: _, error: v } =
|
|
1109
|
+
let { models: g, isLoading: _, error: v } = Lt(h ? null : e), y = o(() => {
|
|
1121
1110
|
if (!h && t) return g.find((e) => (e.modelName ?? e.name) === t);
|
|
1122
1111
|
}, [
|
|
1123
1112
|
h,
|
|
@@ -1139,8 +1128,8 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1139
1128
|
isLoading: _,
|
|
1140
1129
|
error: v
|
|
1141
1130
|
};
|
|
1142
|
-
},
|
|
1143
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1131
|
+
}, zt = () => {
|
|
1132
|
+
let { run: e, isLoading: t, error: r, resetError: i } = Et("Failed to create model");
|
|
1144
1133
|
return {
|
|
1145
1134
|
create: n((t, n, r) => e(() => x.create(n, t, {
|
|
1146
1135
|
...r,
|
|
@@ -1150,7 +1139,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1150
1139
|
error: r,
|
|
1151
1140
|
resetError: i
|
|
1152
1141
|
};
|
|
1153
|
-
},
|
|
1142
|
+
}, Bt = () => {
|
|
1154
1143
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1155
1144
|
return {
|
|
1156
1145
|
destroy: n(async (e) => {
|
|
@@ -1172,7 +1161,7 @@ var kt = ["seed", "schemas"], At = () => {
|
|
|
1172
1161
|
};
|
|
1173
1162
|
//#endregion
|
|
1174
1163
|
//#region src/modelProperty.ts
|
|
1175
|
-
async function
|
|
1164
|
+
async function Vt(e) {
|
|
1176
1165
|
let t = f.getAppDb();
|
|
1177
1166
|
if (t) {
|
|
1178
1167
|
let n = await t.select({ name: F.name }).from(F).where(K(G(F.name, e), G(F.schemaFileId, e))).limit(1);
|
|
@@ -1180,8 +1169,8 @@ async function Bt(e) {
|
|
|
1180
1169
|
}
|
|
1181
1170
|
return ie(e) ?? e;
|
|
1182
1171
|
}
|
|
1183
|
-
var
|
|
1184
|
-
let { model: n } =
|
|
1172
|
+
var Ht = (e, t) => {
|
|
1173
|
+
let { model: n } = Rt(e, t), r = J(), a = X(), c = Gt(n), l = n?.id, u = o(() => [
|
|
1185
1174
|
"seed",
|
|
1186
1175
|
"modelProperties",
|
|
1187
1176
|
l ?? ""
|
|
@@ -1235,24 +1224,24 @@ var Vt = (e, t) => {
|
|
|
1235
1224
|
isLoading: p && d.length === 0,
|
|
1236
1225
|
error: m
|
|
1237
1226
|
};
|
|
1238
|
-
},
|
|
1227
|
+
}, Ut = [
|
|
1239
1228
|
400,
|
|
1240
1229
|
1200,
|
|
1241
1230
|
2500
|
|
1242
|
-
],
|
|
1231
|
+
], Wt = (e) => {
|
|
1243
1232
|
if (e) try {
|
|
1244
1233
|
return e._getSnapshotContext()._dbId;
|
|
1245
1234
|
} catch {
|
|
1246
1235
|
return;
|
|
1247
1236
|
}
|
|
1248
|
-
},
|
|
1249
|
-
let [t, n] = c(() =>
|
|
1237
|
+
}, Gt = (e) => {
|
|
1238
|
+
let [t, n] = c(() => Wt(e));
|
|
1250
1239
|
return i(() => {
|
|
1251
|
-
if (n(
|
|
1252
|
-
let t = e.getService().subscribe(() => n(
|
|
1240
|
+
if (n(Wt(e)), !e) return;
|
|
1241
|
+
let t = e.getService().subscribe(() => n(Wt(e)));
|
|
1253
1242
|
return () => t.unsubscribe();
|
|
1254
1243
|
}, [e]), t;
|
|
1255
|
-
},
|
|
1244
|
+
}, Kt = async (e, t) => {
|
|
1256
1245
|
let n = await x.createById(e, { hold: !1 });
|
|
1257
1246
|
if (!n) return;
|
|
1258
1247
|
let r = n.modelName ?? n.name;
|
|
@@ -1261,7 +1250,7 @@ var Vt = (e, t) => {
|
|
|
1261
1250
|
schemaName: n.schemaName
|
|
1262
1251
|
});
|
|
1263
1252
|
};
|
|
1264
|
-
function
|
|
1253
|
+
function qt(...e) {
|
|
1265
1254
|
let [t, r, a] = e, l = Math.min(e.length, 3), d = o(() => l === 3 ? !!(t && r && a) : l === 2 ? !!(t && r) : !!t, [
|
|
1266
1255
|
l,
|
|
1267
1256
|
t,
|
|
@@ -1305,7 +1294,7 @@ function Kt(...e) {
|
|
|
1305
1294
|
p(void 0), h(!1), _(null);
|
|
1306
1295
|
return;
|
|
1307
1296
|
}
|
|
1308
|
-
t = await
|
|
1297
|
+
t = await Kt(b.modelFileId, b.propertyName);
|
|
1309
1298
|
let e = await x.createById(b.modelFileId, { hold: !1 });
|
|
1310
1299
|
n = e?.modelName ?? e?.name;
|
|
1311
1300
|
} else {
|
|
@@ -1313,7 +1302,7 @@ function Kt(...e) {
|
|
|
1313
1302
|
p(void 0), h(!1), _(null);
|
|
1314
1303
|
return;
|
|
1315
1304
|
}
|
|
1316
|
-
let e = await
|
|
1305
|
+
let e = await Vt(b.schemaId);
|
|
1317
1306
|
t = await re(b.modelName, b.propertyName, { schemaName: e }), n = b.modelName;
|
|
1318
1307
|
}
|
|
1319
1308
|
if (t && n) {
|
|
@@ -1343,7 +1332,7 @@ function Kt(...e) {
|
|
|
1343
1332
|
let T = s(!1);
|
|
1344
1333
|
T.current = m || !!f || !!g, i(() => {
|
|
1345
1334
|
if (!C || b.type === "propertyFileId") return;
|
|
1346
|
-
let e =
|
|
1335
|
+
let e = Ut.map((e) => setTimeout(() => {
|
|
1347
1336
|
T.current || w({ quiet: !0 });
|
|
1348
1337
|
}, e));
|
|
1349
1338
|
return () => e.forEach((e) => clearTimeout(e));
|
|
@@ -1372,12 +1361,12 @@ function Kt(...e) {
|
|
|
1372
1361
|
error: g
|
|
1373
1362
|
};
|
|
1374
1363
|
}
|
|
1375
|
-
var
|
|
1376
|
-
let { runAsync: e, isLoading: t, error: r, resetError: i } =
|
|
1364
|
+
var Jt = () => {
|
|
1365
|
+
let { runAsync: e, isLoading: t, error: r, resetError: i } = Et("Failed to create model property");
|
|
1377
1366
|
return {
|
|
1378
1367
|
create: n((t, n, r) => e(async () => {
|
|
1379
1368
|
if (!n || !r.name || !r.dataType) throw Error("modelName, property name and dataType are required");
|
|
1380
|
-
let e = await
|
|
1369
|
+
let e = await Vt(t);
|
|
1381
1370
|
return S.create({
|
|
1382
1371
|
...r,
|
|
1383
1372
|
modelName: n
|
|
@@ -1390,7 +1379,7 @@ var qt = () => {
|
|
|
1390
1379
|
error: r,
|
|
1391
1380
|
resetError: i
|
|
1392
1381
|
};
|
|
1393
|
-
},
|
|
1382
|
+
}, Yt = () => {
|
|
1394
1383
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1395
1384
|
return {
|
|
1396
1385
|
destroy: n(async (e) => {
|
|
@@ -1409,7 +1398,7 @@ var qt = () => {
|
|
|
1409
1398
|
error: r,
|
|
1410
1399
|
resetError: n(() => i(null), [])
|
|
1411
1400
|
};
|
|
1412
|
-
},
|
|
1401
|
+
}, Xt = () => {
|
|
1413
1402
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1414
1403
|
return {
|
|
1415
1404
|
deleteItem: n(async (e) => {
|
|
@@ -1428,20 +1417,20 @@ var qt = () => {
|
|
|
1428
1417
|
error: r,
|
|
1429
1418
|
resetError: n(() => i(null), [])
|
|
1430
1419
|
};
|
|
1431
|
-
},
|
|
1432
|
-
function
|
|
1420
|
+
}, Zt = ["seed", "imageFiles"];
|
|
1421
|
+
function Qt() {
|
|
1433
1422
|
let e = J(), t = X(), { data: n = [], isLoading: r, error: a, refetch: o } = U({
|
|
1434
|
-
queryKey:
|
|
1423
|
+
queryKey: Zt,
|
|
1435
1424
|
queryFn: () => p.listImageFiles(),
|
|
1436
1425
|
enabled: e
|
|
1437
1426
|
}, t);
|
|
1438
1427
|
return i(() => {
|
|
1439
1428
|
let e = (e) => {
|
|
1440
|
-
e.includes("/images/") && t.invalidateQueries({ queryKey:
|
|
1429
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: Zt });
|
|
1441
1430
|
}, n = () => {
|
|
1442
|
-
t.invalidateQueries({ queryKey:
|
|
1431
|
+
t.invalidateQueries({ queryKey: Zt });
|
|
1443
1432
|
}, r = (e) => {
|
|
1444
|
-
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey:
|
|
1433
|
+
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: Zt });
|
|
1445
1434
|
};
|
|
1446
1435
|
return O.on("file-saved", e), O.on("fs.downloadAll.success", n), O.on(g, r), () => {
|
|
1447
1436
|
O.off("file-saved", e), O.off("fs.downloadAll.success", n), O.off(g, r);
|
|
@@ -1455,9 +1444,9 @@ function Zt() {
|
|
|
1455
1444
|
}
|
|
1456
1445
|
//#endregion
|
|
1457
1446
|
//#region src/useFiles.ts
|
|
1458
|
-
var
|
|
1459
|
-
function
|
|
1460
|
-
let t = J(), n = X(), r = o(() => [
|
|
1447
|
+
var $t = ["seed", "files"];
|
|
1448
|
+
function en(e = "files") {
|
|
1449
|
+
let t = J(), n = X(), r = o(() => [...$t, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = U({
|
|
1461
1450
|
queryKey: r,
|
|
1462
1451
|
queryFn: () => p.listFiles(e),
|
|
1463
1452
|
enabled: t
|
|
@@ -1486,28 +1475,28 @@ function $t(e = "files") {
|
|
|
1486
1475
|
}
|
|
1487
1476
|
//#endregion
|
|
1488
1477
|
//#region src/useEasSyncProcesses.ts
|
|
1489
|
-
function
|
|
1478
|
+
function tn() {
|
|
1490
1479
|
return J() ? f.getAppDb() : null;
|
|
1491
1480
|
}
|
|
1492
|
-
function
|
|
1493
|
-
let e =
|
|
1481
|
+
function nn() {
|
|
1482
|
+
let e = tn();
|
|
1494
1483
|
return o(() => e ? e.select().from(E).orderBy(W(E.startedAt)) : null, [e]);
|
|
1495
1484
|
}
|
|
1496
|
-
function
|
|
1497
|
-
let e = Y(
|
|
1485
|
+
function rn() {
|
|
1486
|
+
let e = Y(nn());
|
|
1498
1487
|
return {
|
|
1499
1488
|
records: e,
|
|
1500
1489
|
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1501
1490
|
};
|
|
1502
1491
|
}
|
|
1503
|
-
function rn() {
|
|
1504
|
-
return Y(tn());
|
|
1505
|
-
}
|
|
1506
1492
|
function an() {
|
|
1507
|
-
return nn()
|
|
1493
|
+
return Y(nn());
|
|
1494
|
+
}
|
|
1495
|
+
function on() {
|
|
1496
|
+
return rn().nonActiveCount;
|
|
1508
1497
|
}
|
|
1509
|
-
function
|
|
1510
|
-
let t =
|
|
1498
|
+
function sn(e) {
|
|
1499
|
+
let t = tn(), n = Y(o(() => e != null && t ? t.select().from(E).where(G(E.id, e)).limit(1) : null, [t, e])), r = e != null && (t == null || n === void 0);
|
|
1511
1500
|
return {
|
|
1512
1501
|
record: n && n.length > 0 ? n[0] : null,
|
|
1513
1502
|
isLoading: r
|
|
@@ -1515,12 +1504,12 @@ function on(e) {
|
|
|
1515
1504
|
}
|
|
1516
1505
|
//#endregion
|
|
1517
1506
|
//#region src/SeedProvider.tsx
|
|
1518
|
-
var
|
|
1519
|
-
function
|
|
1520
|
-
let t =
|
|
1507
|
+
var cn = null;
|
|
1508
|
+
function ln(e) {
|
|
1509
|
+
let t = cn?.(e);
|
|
1521
1510
|
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(t).then(() => {});
|
|
1522
1511
|
}
|
|
1523
|
-
function
|
|
1512
|
+
function un({ queryClient: e }) {
|
|
1524
1513
|
return i(() => {
|
|
1525
1514
|
let t = (t) => {
|
|
1526
1515
|
let n = [
|
|
@@ -1530,7 +1519,7 @@ function ln({ queryClient: e }) {
|
|
|
1530
1519
|
];
|
|
1531
1520
|
return e.invalidateQueries({ queryKey: n }), e.refetchQueries({ queryKey: n });
|
|
1532
1521
|
};
|
|
1533
|
-
|
|
1522
|
+
cn = t, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = t);
|
|
1534
1523
|
let n = (e) => {
|
|
1535
1524
|
let n = e?.seedLocalId ?? e?.seedUid;
|
|
1536
1525
|
n && t(n);
|
|
@@ -1541,11 +1530,11 @@ function ln({ queryClient: e }) {
|
|
|
1541
1530
|
});
|
|
1542
1531
|
};
|
|
1543
1532
|
return O.on("itemProperty.saved", n), O.on(h, r), () => {
|
|
1544
|
-
O.off("itemProperty.saved", n), O.off(h, r),
|
|
1533
|
+
O.off("itemProperty.saved", n), O.off(h, r), cn = null, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = null);
|
|
1545
1534
|
};
|
|
1546
1535
|
}, [e]), null;
|
|
1547
1536
|
}
|
|
1548
|
-
function
|
|
1537
|
+
function dn({ config: e, addresses: t, onInitError: n }) {
|
|
1549
1538
|
let r = s(n);
|
|
1550
1539
|
r.current = n;
|
|
1551
1540
|
let a = s(t);
|
|
@@ -1561,7 +1550,7 @@ function un({ config: e, addresses: t, onInitError: n }) {
|
|
|
1561
1550
|
});
|
|
1562
1551
|
}, [e, o]), null;
|
|
1563
1552
|
}
|
|
1564
|
-
function
|
|
1553
|
+
function fn({ children: e, config: t, addresses: n, onInitError: r, queryClient: i, queryClientRef: a }) {
|
|
1565
1554
|
let s = o(() => i ?? ze(), [i]);
|
|
1566
1555
|
if (a && (a.current = s, typeof window < "u")) {
|
|
1567
1556
|
let e = window;
|
|
@@ -1575,8 +1564,8 @@ function dn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1575
1564
|
children: /* @__PURE__ */ H(je, {
|
|
1576
1565
|
queryClient: s,
|
|
1577
1566
|
children: [
|
|
1578
|
-
/* @__PURE__ */ V(
|
|
1579
|
-
t && /* @__PURE__ */ V(
|
|
1567
|
+
/* @__PURE__ */ V(un, { queryClient: s }),
|
|
1568
|
+
t && /* @__PURE__ */ V(dn, {
|
|
1580
1569
|
config: t,
|
|
1581
1570
|
addresses: n,
|
|
1582
1571
|
onInitError: r
|
|
@@ -1588,7 +1577,7 @@ function dn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1588
1577
|
}
|
|
1589
1578
|
//#endregion
|
|
1590
1579
|
//#region src/SeedClientGate.tsx
|
|
1591
|
-
function
|
|
1580
|
+
function pn() {
|
|
1592
1581
|
return /* @__PURE__ */ V("div", {
|
|
1593
1582
|
style: {
|
|
1594
1583
|
display: "flex",
|
|
@@ -1600,21 +1589,21 @@ function fn() {
|
|
|
1600
1589
|
children: "Loading..."
|
|
1601
1590
|
});
|
|
1602
1591
|
}
|
|
1603
|
-
function
|
|
1592
|
+
function mn(e) {
|
|
1604
1593
|
try {
|
|
1605
1594
|
return JSON.stringify(e ?? null);
|
|
1606
1595
|
} catch {
|
|
1607
1596
|
return e;
|
|
1608
1597
|
}
|
|
1609
1598
|
}
|
|
1610
|
-
function
|
|
1599
|
+
function hn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1611
1600
|
let l = J(), u = s(o);
|
|
1612
1601
|
u.current = o;
|
|
1613
1602
|
let d = s(e);
|
|
1614
1603
|
d.current = e;
|
|
1615
1604
|
let f = s(t);
|
|
1616
1605
|
f.current = t;
|
|
1617
|
-
let p =
|
|
1606
|
+
let p = mn(e), m = mn(t);
|
|
1618
1607
|
i(() => {
|
|
1619
1608
|
let e = d.current, t = f.current, n = t ? {
|
|
1620
1609
|
...e,
|
|
@@ -1627,7 +1616,7 @@ function mn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1627
1616
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1628
1617
|
});
|
|
1629
1618
|
}, [p, m]);
|
|
1630
|
-
let h = n ?? /* @__PURE__ */ V(
|
|
1619
|
+
let h = n ?? /* @__PURE__ */ V(pn, {}), g = r ? void 0 : {
|
|
1631
1620
|
position: "relative",
|
|
1632
1621
|
display: "flex",
|
|
1633
1622
|
height: "100vh",
|
|
@@ -1662,54 +1651,54 @@ function mn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1662
1651
|
}
|
|
1663
1652
|
//#endregion
|
|
1664
1653
|
//#region src/opfsPaths.ts
|
|
1665
|
-
function
|
|
1654
|
+
function gn(e) {
|
|
1666
1655
|
let t = e.split("/").filter(Boolean);
|
|
1667
1656
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1668
1657
|
return t;
|
|
1669
1658
|
}
|
|
1670
|
-
async function
|
|
1659
|
+
async function _n(e, t) {
|
|
1671
1660
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1672
1661
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1673
1662
|
return n;
|
|
1674
1663
|
}
|
|
1675
|
-
async function
|
|
1676
|
-
let n =
|
|
1664
|
+
async function vn(e, t) {
|
|
1665
|
+
let n = gn(e), r = n.pop();
|
|
1677
1666
|
return {
|
|
1678
|
-
dir: await
|
|
1667
|
+
dir: await _n(n.join("/"), t),
|
|
1679
1668
|
name: r
|
|
1680
1669
|
};
|
|
1681
1670
|
}
|
|
1682
|
-
async function vn(e, t) {
|
|
1683
|
-
let { dir: n, name: r } = await _n(e, t);
|
|
1684
|
-
return n.getFileHandle(r);
|
|
1685
|
-
}
|
|
1686
1671
|
async function yn(e, t) {
|
|
1687
|
-
|
|
1672
|
+
let { dir: n, name: r } = await vn(e, t);
|
|
1673
|
+
return n.getFileHandle(r);
|
|
1688
1674
|
}
|
|
1689
1675
|
async function bn(e, t) {
|
|
1690
|
-
|
|
1691
|
-
await n.removeEntry(r);
|
|
1676
|
+
return (await yn(e, t)).getFile();
|
|
1692
1677
|
}
|
|
1693
1678
|
async function xn(e, t) {
|
|
1679
|
+
let { dir: n, name: r } = await vn(e, t);
|
|
1680
|
+
await n.removeEntry(r);
|
|
1681
|
+
}
|
|
1682
|
+
async function Sn(e, t) {
|
|
1694
1683
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1695
1684
|
for await (let e of n.entries()) r.push(e);
|
|
1696
1685
|
let i = !0;
|
|
1697
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1686
|
+
for (let [e, t] of r) (t.kind === "file" || !await Sn(n, e)) && (i = !1);
|
|
1698
1687
|
return i && await e.removeEntry(t), i;
|
|
1699
1688
|
}
|
|
1700
|
-
async function
|
|
1689
|
+
async function Cn(e, t) {
|
|
1701
1690
|
try {
|
|
1702
|
-
let { dir: n, name: r } = await
|
|
1703
|
-
return await
|
|
1691
|
+
let { dir: n, name: r } = await vn(e, t);
|
|
1692
|
+
return await Sn(n, r);
|
|
1704
1693
|
} catch (e) {
|
|
1705
1694
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1706
1695
|
throw e;
|
|
1707
1696
|
}
|
|
1708
1697
|
}
|
|
1709
|
-
function
|
|
1698
|
+
function wn() {
|
|
1710
1699
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1711
1700
|
}
|
|
1712
|
-
var
|
|
1701
|
+
var Tn = [
|
|
1713
1702
|
{
|
|
1714
1703
|
type: "image/jpeg",
|
|
1715
1704
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1720,43 +1709,43 @@ var wn = [
|
|
|
1720
1709
|
},
|
|
1721
1710
|
{
|
|
1722
1711
|
type: "image/gif",
|
|
1723
|
-
test: (e) =>
|
|
1712
|
+
test: (e) => En(e, 0, 4) === "GIF8"
|
|
1724
1713
|
},
|
|
1725
1714
|
{
|
|
1726
1715
|
type: "image/webp",
|
|
1727
|
-
test: (e) =>
|
|
1716
|
+
test: (e) => En(e, 0, 4) === "RIFF" && En(e, 8, 12) === "WEBP"
|
|
1728
1717
|
},
|
|
1729
1718
|
{
|
|
1730
1719
|
type: "image/avif",
|
|
1731
|
-
test: (e) =>
|
|
1720
|
+
test: (e) => En(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(En(e, 8, 12))
|
|
1732
1721
|
},
|
|
1733
1722
|
{
|
|
1734
1723
|
type: "application/vnd.sqlite3",
|
|
1735
|
-
test: (e) =>
|
|
1724
|
+
test: (e) => En(e, 0, 15) === "SQLite format 3"
|
|
1736
1725
|
},
|
|
1737
1726
|
{
|
|
1738
1727
|
type: "application/pdf",
|
|
1739
|
-
test: (e) =>
|
|
1728
|
+
test: (e) => En(e, 0, 5) === "%PDF-"
|
|
1740
1729
|
}
|
|
1741
1730
|
];
|
|
1742
|
-
function
|
|
1731
|
+
function En(e, t, n) {
|
|
1743
1732
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1744
1733
|
}
|
|
1745
|
-
function
|
|
1746
|
-
return
|
|
1734
|
+
function Dn(e) {
|
|
1735
|
+
return Tn.find((t) => t.test(e))?.type;
|
|
1747
1736
|
}
|
|
1748
|
-
async function
|
|
1749
|
-
if (e.size !== 0) return
|
|
1737
|
+
async function On(e) {
|
|
1738
|
+
if (e.size !== 0) return Dn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1750
1739
|
}
|
|
1751
1740
|
//#endregion
|
|
1752
1741
|
//#region src/useOPFSFiles.ts
|
|
1753
|
-
async function
|
|
1742
|
+
async function kn(e, t = "") {
|
|
1754
1743
|
let n = [];
|
|
1755
1744
|
try {
|
|
1756
1745
|
for await (let [r, i] of e.entries()) {
|
|
1757
1746
|
let e = t ? `${t}/${r}` : r;
|
|
1758
1747
|
if (i.kind === "file") try {
|
|
1759
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1748
|
+
let t = await i.getFile(), a = t.type ? void 0 : await On(t).catch(() => void 0);
|
|
1760
1749
|
n.push({
|
|
1761
1750
|
name: r,
|
|
1762
1751
|
path: e,
|
|
@@ -1769,7 +1758,7 @@ async function On(e, t = "") {
|
|
|
1769
1758
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1770
1759
|
}
|
|
1771
1760
|
else if (i.kind === "directory") {
|
|
1772
|
-
let t = await
|
|
1761
|
+
let t = await kn(i, e);
|
|
1773
1762
|
n.push(...t);
|
|
1774
1763
|
}
|
|
1775
1764
|
}
|
|
@@ -1778,11 +1767,11 @@ async function On(e, t = "") {
|
|
|
1778
1767
|
}
|
|
1779
1768
|
return n;
|
|
1780
1769
|
}
|
|
1781
|
-
function
|
|
1770
|
+
function An(e = {}) {
|
|
1782
1771
|
let { rootPath: t } = e, [r, a] = c([]), [o, s] = c(!0), [l, u] = c(!1), [d, f] = c(null), [p, m] = c(null), h = n(async () => {
|
|
1783
1772
|
s(!0), f(null), m(null);
|
|
1784
1773
|
try {
|
|
1785
|
-
let e = await
|
|
1774
|
+
let e = await kn(await _n(t ?? ""), t || "");
|
|
1786
1775
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1787
1776
|
} catch (e) {
|
|
1788
1777
|
f("Failed to access OPFS: " + (e instanceof Error ? e.message : String(e))), m(e instanceof Error ? e.name : null), console.error("OPFS access error:", e);
|
|
@@ -1803,7 +1792,7 @@ function kn(e = {}) {
|
|
|
1803
1792
|
}
|
|
1804
1793
|
//#endregion
|
|
1805
1794
|
//#region src/OPFSFilesManager/format.ts
|
|
1806
|
-
var
|
|
1795
|
+
var jn = [
|
|
1807
1796
|
"B",
|
|
1808
1797
|
"KB",
|
|
1809
1798
|
"MB",
|
|
@@ -1812,32 +1801,32 @@ var An = [
|
|
|
1812
1801
|
];
|
|
1813
1802
|
function Z(e) {
|
|
1814
1803
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1815
|
-
let t = Math.min(
|
|
1816
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1804
|
+
let t = Math.min(jn.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1805
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${jn[t]}`;
|
|
1817
1806
|
}
|
|
1818
|
-
var
|
|
1819
|
-
function
|
|
1807
|
+
var Mn = 6e4, Nn = 60 * Mn, Pn = 24 * Nn;
|
|
1808
|
+
function Fn(e, t = Date.now()) {
|
|
1820
1809
|
let n = t - e;
|
|
1821
|
-
if (n <
|
|
1822
|
-
if (n <
|
|
1823
|
-
if (n <
|
|
1824
|
-
let r = Math.round(n /
|
|
1810
|
+
if (n < Mn) return "just now";
|
|
1811
|
+
if (n < Nn) return `${Math.round(n / Mn)} min ago`;
|
|
1812
|
+
if (n < Pn) return `${Math.round(n / Nn)} h ago`;
|
|
1813
|
+
let r = Math.round(n / Pn);
|
|
1825
1814
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1826
1815
|
}
|
|
1827
|
-
function
|
|
1816
|
+
function In(e) {
|
|
1828
1817
|
return new Date(e).toLocaleString(void 0, {
|
|
1829
1818
|
dateStyle: "medium",
|
|
1830
1819
|
timeStyle: "short"
|
|
1831
1820
|
});
|
|
1832
1821
|
}
|
|
1833
|
-
function
|
|
1822
|
+
function Ln(e, t) {
|
|
1834
1823
|
if (e.length <= t) return e;
|
|
1835
1824
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1836
1825
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1837
1826
|
}
|
|
1838
1827
|
//#endregion
|
|
1839
1828
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1840
|
-
var
|
|
1829
|
+
var Rn = {
|
|
1841
1830
|
check: /* @__PURE__ */ V("path", { d: "M20 6 9 17l-5-5" }),
|
|
1842
1831
|
chevronLeft: /* @__PURE__ */ V("path", { d: "m15 18-6-6 6-6" }),
|
|
1843
1832
|
chevronRight: /* @__PURE__ */ V("path", { d: "m9 18 6-6-6-6" }),
|
|
@@ -2022,13 +2011,13 @@ function Q({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
2022
2011
|
"aria-hidden": "true",
|
|
2023
2012
|
focusable: "false",
|
|
2024
2013
|
className: r,
|
|
2025
|
-
children:
|
|
2014
|
+
children: Rn[e]
|
|
2026
2015
|
});
|
|
2027
2016
|
}
|
|
2028
2017
|
//#endregion
|
|
2029
2018
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
2030
|
-
var
|
|
2031
|
-
function
|
|
2019
|
+
var zn = 6;
|
|
2020
|
+
function Bn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
2032
2021
|
let a = s(null);
|
|
2033
2022
|
return i(() => {
|
|
2034
2023
|
let e = a.current;
|
|
@@ -2054,9 +2043,9 @@ function zn({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2054
2043
|
})
|
|
2055
2044
|
});
|
|
2056
2045
|
}
|
|
2057
|
-
function
|
|
2058
|
-
let [s, l] = c(!0), u = e.flatMap((e) => e.variants), d = u.reduce((e, t) => e + t.file.size, 0), f = e.length + (s ? u.length : 0), p = t ? `${t}/` : "", m = r(s), h = m.label ? `${m.label}?` : e.length === 1 ? `Delete ${
|
|
2059
|
-
return /* @__PURE__ */ H(
|
|
2046
|
+
function Vn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
2047
|
+
let [s, l] = c(!0), u = e.flatMap((e) => e.variants), d = u.reduce((e, t) => e + t.file.size, 0), f = e.length + (s ? u.length : 0), p = t ? `${t}/` : "", m = r(s), h = m.label ? `${m.label}?` : e.length === 1 ? `Delete ${Ln(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
2048
|
+
return /* @__PURE__ */ H(Bn, {
|
|
2060
2049
|
className: o,
|
|
2061
2050
|
onCancel: i,
|
|
2062
2051
|
onSubmit: () => a(s),
|
|
@@ -2070,12 +2059,12 @@ function Bn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2070
2059
|
e.length === 1 ? "it" : "them",
|
|
2071
2060
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
2072
2061
|
] }),
|
|
2073
|
-
/* @__PURE__ */ H("ul", { children: [e.slice(0,
|
|
2062
|
+
/* @__PURE__ */ H("ul", { children: [e.slice(0, zn).map((e) => /* @__PURE__ */ H("li", { children: [/* @__PURE__ */ V("code", {
|
|
2074
2063
|
title: e.file.path,
|
|
2075
2064
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
2076
|
-
}), /* @__PURE__ */ V("span", { children: Z(e.file.size) })] }, e.file.path)), e.length >
|
|
2065
|
+
}), /* @__PURE__ */ V("span", { children: Z(e.file.size) })] }, e.file.path)), e.length > zn && /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H("span", { children: [
|
|
2077
2066
|
"and ",
|
|
2078
|
-
e.length -
|
|
2067
|
+
e.length - zn,
|
|
2079
2068
|
" more"
|
|
2080
2069
|
] }) })] }),
|
|
2081
2070
|
u.length > 0 && /* @__PURE__ */ H("label", { children: [
|
|
@@ -2118,16 +2107,16 @@ function Bn({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2118
2107
|
]
|
|
2119
2108
|
});
|
|
2120
2109
|
}
|
|
2121
|
-
function
|
|
2110
|
+
function Hn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
2122
2111
|
let [d, f] = c(!1), p = t.reduce((e, t) => e + t.size, 0), m = `${e.path}/`, h = `${t.length} ${t.length === 1 ? "file" : "files"}`, g = t.length - e.fileCount;
|
|
2123
|
-
return /* @__PURE__ */ H(
|
|
2112
|
+
return /* @__PURE__ */ H(Bn, {
|
|
2124
2113
|
className: u,
|
|
2125
2114
|
onCancel: s,
|
|
2126
2115
|
onSubmit: l,
|
|
2127
2116
|
children: [
|
|
2128
2117
|
/* @__PURE__ */ V("h3", {
|
|
2129
2118
|
id: "seed-fm-delete-title",
|
|
2130
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
2119
|
+
children: i.label ? `${i.label}?` : `Delete the “${Ln(e.name, 32)}” folder?`
|
|
2131
2120
|
}),
|
|
2132
2121
|
/* @__PURE__ */ H("p", { children: [
|
|
2133
2122
|
"This removes the folder and the ",
|
|
@@ -2144,12 +2133,12 @@ function Vn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2144
2133
|
size: 16
|
|
2145
2134
|
}), /* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2146
2135
|
}),
|
|
2147
|
-
/* @__PURE__ */ H("ul", { children: [t.slice(0,
|
|
2136
|
+
/* @__PURE__ */ H("ul", { children: [t.slice(0, zn).map((e) => /* @__PURE__ */ H("li", { children: [/* @__PURE__ */ V("code", {
|
|
2148
2137
|
title: e.path,
|
|
2149
2138
|
children: e.path.slice(m.length)
|
|
2150
|
-
}), /* @__PURE__ */ V("span", { children: Z(e.size) })] }, e.path)), t.length >
|
|
2139
|
+
}), /* @__PURE__ */ V("span", { children: Z(e.size) })] }, e.path)), t.length > zn && /* @__PURE__ */ V("li", { children: /* @__PURE__ */ H("span", { children: [
|
|
2151
2140
|
"and ",
|
|
2152
|
-
t.length -
|
|
2141
|
+
t.length - zn,
|
|
2153
2142
|
" more"
|
|
2154
2143
|
] }) })] }),
|
|
2155
2144
|
/* @__PURE__ */ H("div", {
|
|
@@ -2208,42 +2197,42 @@ function Vn({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2208
2197
|
}
|
|
2209
2198
|
//#endregion
|
|
2210
2199
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2211
|
-
function
|
|
2200
|
+
function Un(e) {
|
|
2212
2201
|
return e.detectedType ?? e.type;
|
|
2213
2202
|
}
|
|
2214
|
-
var
|
|
2203
|
+
var Wn = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2215
2204
|
function $(e) {
|
|
2216
|
-
let t =
|
|
2217
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" ||
|
|
2205
|
+
let t = Un(e);
|
|
2206
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || Wn.test(e.name) ? "database" : t === "application/json" || /\.json$/i.test(e.name) ? "json" : t === "text/html" || /\.html?$/i.test(e.name) ? "html" : t.startsWith("text/") ? "text" : "other";
|
|
2218
2207
|
}
|
|
2219
|
-
function
|
|
2208
|
+
function Gn(e) {
|
|
2220
2209
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2221
2210
|
if (t) return t.toLowerCase();
|
|
2222
|
-
let n =
|
|
2211
|
+
let n = Un(e);
|
|
2223
2212
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2224
2213
|
}
|
|
2225
|
-
var
|
|
2226
|
-
function
|
|
2227
|
-
let t =
|
|
2214
|
+
var Kn = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, qn = /^(.*\/)?images\/([^/]+)$/, Jn = (e) => e.replace(/\.[^/.]+$/, "");
|
|
2215
|
+
function Yn(e) {
|
|
2216
|
+
let t = Kn.exec(e);
|
|
2228
2217
|
return t ? {
|
|
2229
2218
|
key: `${t[1] ?? ""}images/${t[3]}`,
|
|
2230
2219
|
width: Number(t[2])
|
|
2231
2220
|
} : null;
|
|
2232
2221
|
}
|
|
2233
|
-
function
|
|
2234
|
-
let t =
|
|
2235
|
-
return t ? `${t[1] ?? ""}images/${
|
|
2222
|
+
function Xn(e) {
|
|
2223
|
+
let t = qn.exec(e);
|
|
2224
|
+
return t ? `${t[1] ?? ""}images/${Jn(t[2])}` : null;
|
|
2236
2225
|
}
|
|
2237
|
-
var
|
|
2226
|
+
var Zn = (e) => ({
|
|
2238
2227
|
file: e,
|
|
2239
2228
|
variants: [],
|
|
2240
2229
|
totalSize: e.size
|
|
2241
2230
|
});
|
|
2242
|
-
function
|
|
2243
|
-
if (!t) return e.map(
|
|
2231
|
+
function Qn(e, t) {
|
|
2232
|
+
if (!t) return e.map(Zn);
|
|
2244
2233
|
let n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
2245
2234
|
for (let t of e) {
|
|
2246
|
-
let e =
|
|
2235
|
+
let e = Yn(t.path);
|
|
2247
2236
|
if (e) {
|
|
2248
2237
|
i.push({
|
|
2249
2238
|
file: t,
|
|
@@ -2251,9 +2240,9 @@ function Zn(e, t) {
|
|
|
2251
2240
|
});
|
|
2252
2241
|
continue;
|
|
2253
2242
|
}
|
|
2254
|
-
let a =
|
|
2243
|
+
let a = Zn(t);
|
|
2255
2244
|
r.push(a);
|
|
2256
|
-
let o =
|
|
2245
|
+
let o = Xn(t.path);
|
|
2257
2246
|
o && $(t) === "image" && n.set(o, a);
|
|
2258
2247
|
}
|
|
2259
2248
|
for (let e of i) {
|
|
@@ -2261,17 +2250,17 @@ function Zn(e, t) {
|
|
|
2261
2250
|
t ? (t.variants.push({
|
|
2262
2251
|
file: e.file,
|
|
2263
2252
|
width: e.width
|
|
2264
|
-
}), t.totalSize += e.file.size) : r.push(
|
|
2253
|
+
}), t.totalSize += e.file.size) : r.push(Zn(e.file));
|
|
2265
2254
|
}
|
|
2266
2255
|
for (let e of n.values()) e.variants.sort((e, t) => e.width - t.width);
|
|
2267
2256
|
return r;
|
|
2268
2257
|
}
|
|
2269
|
-
var
|
|
2270
|
-
function
|
|
2258
|
+
var $n = (e, t) => e ? `${e}/${t}` : t;
|
|
2259
|
+
function er(e, t, n = {}) {
|
|
2271
2260
|
let r = t ? `${t}/` : "", i = e.filter((e) => e.file.path.startsWith(r)), a = n.query?.trim().toLowerCase();
|
|
2272
2261
|
if (a) return {
|
|
2273
2262
|
folders: [],
|
|
2274
|
-
entries:
|
|
2263
|
+
entries: tr(i.filter((e) => e.file.path.slice(r.length).toLowerCase().includes(a)), n.sort)
|
|
2275
2264
|
};
|
|
2276
2265
|
let o = /* @__PURE__ */ new Map(), s = [];
|
|
2277
2266
|
for (let e of i) {
|
|
@@ -2282,7 +2271,7 @@ function $n(e, t, n = {}) {
|
|
|
2282
2271
|
}
|
|
2283
2272
|
let a = n.slice(0, i), c = o.get(a) ?? {
|
|
2284
2273
|
name: a,
|
|
2285
|
-
path:
|
|
2274
|
+
path: $n(t, a),
|
|
2286
2275
|
fileCount: 0,
|
|
2287
2276
|
size: 0
|
|
2288
2277
|
};
|
|
@@ -2290,10 +2279,10 @@ function $n(e, t, n = {}) {
|
|
|
2290
2279
|
}
|
|
2291
2280
|
return {
|
|
2292
2281
|
folders: [...o.values()].sort((e, t) => e.name.localeCompare(t.name)),
|
|
2293
|
-
entries:
|
|
2282
|
+
entries: tr(s, n.sort)
|
|
2294
2283
|
};
|
|
2295
2284
|
}
|
|
2296
|
-
function
|
|
2285
|
+
function tr(e, t = "name") {
|
|
2297
2286
|
let n = {
|
|
2298
2287
|
name: (e, t) => e.file.name.localeCompare(t.file.name),
|
|
2299
2288
|
modified: (e, t) => t.file.lastModified - e.file.lastModified,
|
|
@@ -2301,7 +2290,7 @@ function er(e, t = "name") {
|
|
|
2301
2290
|
};
|
|
2302
2291
|
return [...e].sort(n[t]);
|
|
2303
2292
|
}
|
|
2304
|
-
function
|
|
2293
|
+
function nr(e) {
|
|
2305
2294
|
let t = {
|
|
2306
2295
|
image: 0,
|
|
2307
2296
|
database: 0,
|
|
@@ -2313,31 +2302,31 @@ function tr(e) {
|
|
|
2313
2302
|
for (let n of e) t[$(n)] += n.size;
|
|
2314
2303
|
return t;
|
|
2315
2304
|
}
|
|
2316
|
-
function
|
|
2305
|
+
function rr(e) {
|
|
2317
2306
|
return e.find((e) => /(^|\/)db\/seed\.db$/.test(e.path)) ? "This includes the Seed database. The app loses its local items and drafts, and anything not yet published is gone. Reload the app afterwards." : null;
|
|
2318
2307
|
}
|
|
2319
2308
|
//#endregion
|
|
2320
2309
|
//#region src/OPFSFilesManager/useThumbnail.ts
|
|
2321
|
-
var
|
|
2322
|
-
function
|
|
2310
|
+
var ir = 400, ar = 262144, or = 4, sr = 3e4, cr = 0, lr = [];
|
|
2311
|
+
function ur(e) {
|
|
2323
2312
|
return new Promise((t, n) => {
|
|
2324
2313
|
let r = () => {
|
|
2325
|
-
|
|
2326
|
-
|
|
2314
|
+
cr++, e().then(t, n).finally(() => {
|
|
2315
|
+
cr--, lr.shift()?.();
|
|
2327
2316
|
});
|
|
2328
2317
|
};
|
|
2329
|
-
|
|
2318
|
+
cr < or ? r() : lr.push(r);
|
|
2330
2319
|
});
|
|
2331
2320
|
}
|
|
2332
|
-
var
|
|
2333
|
-
function
|
|
2334
|
-
let n =
|
|
2321
|
+
var dr = /* @__PURE__ */ new Map();
|
|
2322
|
+
function fr(e, t) {
|
|
2323
|
+
let n = dr.get(e);
|
|
2335
2324
|
if (!n) {
|
|
2336
2325
|
let r = {
|
|
2337
2326
|
refs: 0,
|
|
2338
2327
|
promise: Promise.resolve("")
|
|
2339
2328
|
};
|
|
2340
|
-
r.promise =
|
|
2329
|
+
r.promise = ur(t).then((e) => (r.url = URL.createObjectURL(e), r.url)), dr.set(e, r), n = r;
|
|
2341
2330
|
}
|
|
2342
2331
|
n.timer && (clearTimeout(n.timer), n.timer = void 0), n.refs++;
|
|
2343
2332
|
let r = n, i = !1;
|
|
@@ -2345,15 +2334,15 @@ function dr(e, t) {
|
|
|
2345
2334
|
promise: r.promise,
|
|
2346
2335
|
release: () => {
|
|
2347
2336
|
i || (i = !0, r.refs--, !(r.refs > 0) && (r.timer = setTimeout(() => {
|
|
2348
|
-
r.url && URL.revokeObjectURL(r.url),
|
|
2349
|
-
},
|
|
2337
|
+
r.url && URL.revokeObjectURL(r.url), dr.get(e) === r && dr.delete(e);
|
|
2338
|
+
}, sr)));
|
|
2350
2339
|
}
|
|
2351
2340
|
};
|
|
2352
2341
|
}
|
|
2353
|
-
async function
|
|
2354
|
-
if (e.size <
|
|
2342
|
+
async function pr(e) {
|
|
2343
|
+
if (e.size < ar || typeof createImageBitmap != "function") return e;
|
|
2355
2344
|
let t = await createImageBitmap(e, {
|
|
2356
|
-
resizeWidth:
|
|
2345
|
+
resizeWidth: ir,
|
|
2357
2346
|
resizeQuality: "medium"
|
|
2358
2347
|
});
|
|
2359
2348
|
try {
|
|
@@ -2370,22 +2359,22 @@ async function fr(e) {
|
|
|
2370
2359
|
t.close();
|
|
2371
2360
|
}
|
|
2372
2361
|
}
|
|
2373
|
-
async function
|
|
2362
|
+
async function mr(e) {
|
|
2374
2363
|
let t = e.variants[0];
|
|
2375
|
-
return t ?
|
|
2364
|
+
return t ? bn(t.file.path) : pr(await bn(e.file.path));
|
|
2376
2365
|
}
|
|
2377
|
-
var
|
|
2378
|
-
function
|
|
2379
|
-
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (
|
|
2380
|
-
for (let t of e) t.isIntersecting && (
|
|
2381
|
-
}, { rootMargin: "300px" })),
|
|
2382
|
-
|
|
2366
|
+
var hr = /* @__PURE__ */ new WeakMap(), gr = null;
|
|
2367
|
+
function _r(e, t) {
|
|
2368
|
+
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (gr ?? (gr = new IntersectionObserver((e) => {
|
|
2369
|
+
for (let t of e) t.isIntersecting && (gr.unobserve(t.target), hr.get(t.target)?.(), hr.delete(t.target));
|
|
2370
|
+
}, { rootMargin: "300px" })), hr.set(e, t), gr.observe(e), () => {
|
|
2371
|
+
hr.delete(e), gr?.unobserve(e);
|
|
2383
2372
|
});
|
|
2384
2373
|
}
|
|
2385
|
-
function
|
|
2374
|
+
function vr(e) {
|
|
2386
2375
|
let t = $(e.file) === "image", [r, a] = c(null), [o, s] = c(!1), [l, u] = c(null), [d, f] = c("idle"), p = n((e) => a(e), []);
|
|
2387
2376
|
i(() => {
|
|
2388
|
-
if (t && r && !o) return
|
|
2377
|
+
if (t && r && !o) return _r(r, () => s(!0));
|
|
2389
2378
|
}, [
|
|
2390
2379
|
t,
|
|
2391
2380
|
r,
|
|
@@ -2396,7 +2385,7 @@ function _r(e) {
|
|
|
2396
2385
|
if (!t || !o) return;
|
|
2397
2386
|
let n = !1;
|
|
2398
2387
|
f("loading");
|
|
2399
|
-
let r =
|
|
2388
|
+
let r = fr(_, () => mr(e));
|
|
2400
2389
|
return r.promise.then((e) => {
|
|
2401
2390
|
n || (u(e), f("ready"));
|
|
2402
2391
|
}, () => {
|
|
@@ -2419,7 +2408,7 @@ function _r(e) {
|
|
|
2419
2408
|
}
|
|
2420
2409
|
//#endregion
|
|
2421
2410
|
//#region src/OPFSFilesManager/FileThumbnail.tsx
|
|
2422
|
-
var
|
|
2411
|
+
var yr = {
|
|
2423
2412
|
image: {
|
|
2424
2413
|
icon: "image",
|
|
2425
2414
|
label: "Images",
|
|
@@ -2450,11 +2439,11 @@ var vr = {
|
|
|
2450
2439
|
label: "Other",
|
|
2451
2440
|
color: "var(--seed-kind-other)"
|
|
2452
2441
|
}
|
|
2453
|
-
},
|
|
2454
|
-
function
|
|
2455
|
-
let r = $(e.file), { ref: i, url: a, status: o, markError: s } =
|
|
2442
|
+
}, br = (e) => ({ "--seed-kind": yr[e].color }), xr = (e) => /png|webp|gif|avif|svg/.test(Un(e.file));
|
|
2443
|
+
function Sr({ entry: e, size: t, children: n }) {
|
|
2444
|
+
let r = $(e.file), { ref: i, url: a, status: o, markError: s } = vr(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2456
2445
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2457
|
-
l &&
|
|
2446
|
+
l && xr(e) ? "seed-fm-thumb--checker" : "",
|
|
2458
2447
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2459
2448
|
].filter(Boolean).join(" "), d;
|
|
2460
2449
|
return d = l ? /* @__PURE__ */ V("img", {
|
|
@@ -2464,12 +2453,12 @@ function xr({ entry: e, size: t, children: n }) {
|
|
|
2464
2453
|
draggable: !1,
|
|
2465
2454
|
onError: s
|
|
2466
2455
|
}) : t === "mini" ? /* @__PURE__ */ V(Q, {
|
|
2467
|
-
name: c ? "imageOff" :
|
|
2456
|
+
name: c ? "imageOff" : yr[r].icon,
|
|
2468
2457
|
size: 16
|
|
2469
2458
|
}) : r === "image" && !c ? null : /* @__PURE__ */ H("span", {
|
|
2470
2459
|
className: "seed-fm-kind",
|
|
2471
2460
|
children: [/* @__PURE__ */ V(Q, {
|
|
2472
|
-
name: c ? "imageOff" :
|
|
2461
|
+
name: c ? "imageOff" : yr[r].icon,
|
|
2473
2462
|
size: 28,
|
|
2474
2463
|
strokeWidth: 1.6
|
|
2475
2464
|
}), c ? /* @__PURE__ */ V("span", {
|
|
@@ -2477,18 +2466,18 @@ function xr({ entry: e, size: t, children: n }) {
|
|
|
2477
2466
|
children: "Can’t decode image"
|
|
2478
2467
|
}) : /* @__PURE__ */ V("span", {
|
|
2479
2468
|
className: "seed-fm-ext",
|
|
2480
|
-
children:
|
|
2469
|
+
children: Gn(e.file)
|
|
2481
2470
|
})]
|
|
2482
2471
|
}), /* @__PURE__ */ H("span", {
|
|
2483
2472
|
ref: i,
|
|
2484
2473
|
className: u,
|
|
2485
|
-
style:
|
|
2474
|
+
style: br(r),
|
|
2486
2475
|
children: [d, n]
|
|
2487
2476
|
});
|
|
2488
2477
|
}
|
|
2489
2478
|
//#endregion
|
|
2490
2479
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2491
|
-
function
|
|
2480
|
+
function Cr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2492
2481
|
return /* @__PURE__ */ V("ul", {
|
|
2493
2482
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2494
2483
|
role: "listbox",
|
|
@@ -2508,7 +2497,7 @@ function Sr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2508
2497
|
onKeyDown: (t) => {
|
|
2509
2498
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2510
2499
|
},
|
|
2511
|
-
children: [/* @__PURE__ */ H(
|
|
2500
|
+
children: [/* @__PURE__ */ H(Sr, {
|
|
2512
2501
|
entry: e,
|
|
2513
2502
|
size: "tile",
|
|
2514
2503
|
children: [/* @__PURE__ */ V("button", {
|
|
@@ -2542,7 +2531,7 @@ function Sr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2542
2531
|
className: "seed-fm-tile-meta",
|
|
2543
2532
|
children: [/* @__PURE__ */ V("span", {
|
|
2544
2533
|
className: "seed-fm-tile-name",
|
|
2545
|
-
children:
|
|
2534
|
+
children: Ln(o.name, 24)
|
|
2546
2535
|
}), /* @__PURE__ */ H("span", {
|
|
2547
2536
|
className: "seed-fm-tile-sub",
|
|
2548
2537
|
children: [
|
|
@@ -2551,8 +2540,8 @@ function Sr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2551
2540
|
" ",
|
|
2552
2541
|
/* @__PURE__ */ V("time", {
|
|
2553
2542
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2554
|
-
title:
|
|
2555
|
-
children:
|
|
2543
|
+
title: In(o.lastModified),
|
|
2544
|
+
children: Fn(o.lastModified)
|
|
2556
2545
|
})
|
|
2557
2546
|
]
|
|
2558
2547
|
})]
|
|
@@ -2563,7 +2552,7 @@ function Sr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2563
2552
|
}
|
|
2564
2553
|
//#endregion
|
|
2565
2554
|
//#region src/OPFSFilesManager/FileList.tsx
|
|
2566
|
-
function
|
|
2555
|
+
function wr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onToggleAll: o, onDownload: c, onDelete: l, deleteActionFor: u, className: d, rowClassName: f }) {
|
|
2567
2556
|
let p = s(null), m = e.filter((e) => t.has(e.file.path)).length, h = e.length > 0 && m === e.length;
|
|
2568
2557
|
i(() => {
|
|
2569
2558
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
@@ -2623,7 +2612,7 @@ function Cr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2623
2612
|
}),
|
|
2624
2613
|
/* @__PURE__ */ V("td", { children: /* @__PURE__ */ H("span", {
|
|
2625
2614
|
className: "seed-fm-namecell",
|
|
2626
|
-
children: [/* @__PURE__ */ V(
|
|
2615
|
+
children: [/* @__PURE__ */ V(Sr, {
|
|
2627
2616
|
entry: e,
|
|
2628
2617
|
size: "mini"
|
|
2629
2618
|
}), /* @__PURE__ */ H("span", { children: [/* @__PURE__ */ V("button", {
|
|
@@ -2642,8 +2631,8 @@ function Cr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2642
2631
|
className: "seed-fm-col-type",
|
|
2643
2632
|
children: /* @__PURE__ */ H("span", {
|
|
2644
2633
|
className: "seed-fm-type",
|
|
2645
|
-
style:
|
|
2646
|
-
children: [
|
|
2634
|
+
style: br($(i)),
|
|
2635
|
+
children: [Un(i), i.detectedType && /* @__PURE__ */ V("small", { children: "detected" })]
|
|
2647
2636
|
})
|
|
2648
2637
|
}),
|
|
2649
2638
|
/* @__PURE__ */ V("td", {
|
|
@@ -2653,8 +2642,8 @@ function Cr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2653
2642
|
}),
|
|
2654
2643
|
/* @__PURE__ */ V("td", {
|
|
2655
2644
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2656
|
-
title:
|
|
2657
|
-
children:
|
|
2645
|
+
title: In(i.lastModified),
|
|
2646
|
+
children: Fn(i.lastModified)
|
|
2658
2647
|
}),
|
|
2659
2648
|
/* @__PURE__ */ H("td", {
|
|
2660
2649
|
className: "seed-fm-actions",
|
|
@@ -2689,22 +2678,22 @@ function Cr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2689
2678
|
}
|
|
2690
2679
|
//#endregion
|
|
2691
2680
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2692
|
-
var
|
|
2693
|
-
function
|
|
2681
|
+
var Tr = 1048576, Er = 32768;
|
|
2682
|
+
function Dr(e) {
|
|
2694
2683
|
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = $(e.file), s = e.file.size;
|
|
2695
2684
|
return i(() => {
|
|
2696
2685
|
let e = !1, t = null;
|
|
2697
2686
|
return n({ kind: "loading" }), (async () => {
|
|
2698
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2687
|
+
if (o === "image") return t = URL.createObjectURL(await bn(r)), {
|
|
2699
2688
|
kind: "image",
|
|
2700
2689
|
url: t
|
|
2701
2690
|
};
|
|
2702
2691
|
if (o === "json" || o === "html" || o === "text") {
|
|
2703
|
-
if (s >
|
|
2692
|
+
if (s > Tr) return {
|
|
2704
2693
|
kind: "none",
|
|
2705
2694
|
message: "This file is too large to preview."
|
|
2706
2695
|
};
|
|
2707
|
-
let e = await
|
|
2696
|
+
let e = await bn(r), t = e.size > Er, n = await e.slice(0, Er).text();
|
|
2708
2697
|
if (o === "json" && !t) try {
|
|
2709
2698
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2710
2699
|
} catch {}
|
|
@@ -2738,8 +2727,8 @@ function Er(e) {
|
|
|
2738
2727
|
o
|
|
2739
2728
|
]), t;
|
|
2740
2729
|
}
|
|
2741
|
-
function
|
|
2742
|
-
let { file: f, variants: p } = e, m = $(f), h =
|
|
2730
|
+
function Or({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onDelete: o, deleteAction: l, onCopyPath: u, className: d }) {
|
|
2731
|
+
let { file: f, variants: p } = e, m = $(f), h = Dr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2743
2732
|
i(() => {
|
|
2744
2733
|
_(null), y(!1);
|
|
2745
2734
|
}, [f.path]), i(() => {
|
|
@@ -2762,13 +2751,13 @@ function Dr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2762
2751
|
C = /* @__PURE__ */ H("span", {
|
|
2763
2752
|
className: "seed-fm-preview-note",
|
|
2764
2753
|
children: [/* @__PURE__ */ V(Q, {
|
|
2765
|
-
name: v ? "imageOff" :
|
|
2754
|
+
name: v ? "imageOff" : yr[m].icon,
|
|
2766
2755
|
size: 32,
|
|
2767
2756
|
strokeWidth: 1.5
|
|
2768
2757
|
}), e]
|
|
2769
2758
|
});
|
|
2770
2759
|
}
|
|
2771
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2760
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(Un(f));
|
|
2772
2761
|
return /* @__PURE__ */ H("aside", {
|
|
2773
2762
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2774
2763
|
role: "dialog",
|
|
@@ -2818,7 +2807,7 @@ function Dr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2818
2807
|
w ? "seed-fm-thumb--checker" : "",
|
|
2819
2808
|
h.kind === "loading" ? "seed-fm-skeleton" : ""
|
|
2820
2809
|
].filter(Boolean).join(" "),
|
|
2821
|
-
style:
|
|
2810
|
+
style: br(m),
|
|
2822
2811
|
children: C
|
|
2823
2812
|
}),
|
|
2824
2813
|
/* @__PURE__ */ H("dl", {
|
|
@@ -2846,7 +2835,7 @@ function Dr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2846
2835
|
/* @__PURE__ */ H("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2847
2836
|
] }),
|
|
2848
2837
|
/* @__PURE__ */ V("dt", { children: "Type" }),
|
|
2849
|
-
/* @__PURE__ */ H("dd", { children: [
|
|
2838
|
+
/* @__PURE__ */ H("dd", { children: [Un(f), f.detectedType && /* @__PURE__ */ H("small", { children: [
|
|
2850
2839
|
" from file contents. File.type is “",
|
|
2851
2840
|
f.type,
|
|
2852
2841
|
"”"
|
|
@@ -2859,9 +2848,9 @@ function Dr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2859
2848
|
] })] }),
|
|
2860
2849
|
/* @__PURE__ */ V("dt", { children: "Modified" }),
|
|
2861
2850
|
/* @__PURE__ */ H("dd", { children: [
|
|
2862
|
-
|
|
2851
|
+
In(f.lastModified),
|
|
2863
2852
|
" ",
|
|
2864
|
-
/* @__PURE__ */ V("small", { children:
|
|
2853
|
+
/* @__PURE__ */ V("small", { children: Fn(f.lastModified) })
|
|
2865
2854
|
] })
|
|
2866
2855
|
]
|
|
2867
2856
|
}),
|
|
@@ -2906,18 +2895,18 @@ function Dr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2906
2895
|
}
|
|
2907
2896
|
//#endregion
|
|
2908
2897
|
//#region src/OPFSFilesManager/styles.ts
|
|
2909
|
-
var
|
|
2898
|
+
var kr = "seed-opfs-files-manager-styles", Ar = "seed-opfs-files-manager", jr = "\n --seed-bg: #fbfcfb;\n --seed-surface: #ffffff;\n --seed-sunken: #f0f3f1;\n --seed-hover: #e9eeeb;\n --seed-fg: #18211d;\n --seed-fg-muted: #5a6861;\n --seed-fg-faint: #8a978f;\n --seed-border: #dfe5e1;\n --seed-border-strong: #c5cfc9;\n --seed-accent: #2c6b59;\n --seed-accent-fg: #ffffff;\n --seed-accent-soft: #e0eee8;\n --seed-danger: #b4332a;\n --seed-danger-fg: #ffffff;\n --seed-danger-soft: #fbe7e4;\n --seed-danger-inverse: #ff9a8f;\n --seed-warn: #8a5208;\n --seed-warn-soft: #fdf1dc;\n --seed-kind-image: #2f7d68;\n --seed-kind-database: #6a4fb3;\n --seed-kind-json: #a2620e;\n --seed-kind-html: #b0413a;\n --seed-kind-text: #3f6f9a;\n --seed-kind-other: #66736c;\n --seed-checker-a: #eef1ef;\n --seed-checker-b: #ffffff;\n --seed-shadow: 0 10px 30px rgb(16 24 20 / 0.14), 0 2px 6px rgb(16 24 20 / 0.08);\n --seed-backdrop: rgb(8 12 10 / 0.42);\n", Mr = "\n --seed-bg: #111816;\n --seed-surface: #171f1c;\n --seed-sunken: #1d2723;\n --seed-hover: #24302b;\n --seed-fg: #e4ebe7;\n --seed-fg-muted: #9daba3;\n --seed-fg-faint: #6f7d76;\n --seed-border: #29342f;\n --seed-border-strong: #3a4842;\n --seed-accent: #6cc0a3;\n --seed-accent-fg: #0c1a15;\n --seed-accent-soft: #1c3a30;\n --seed-danger: #f08277;\n --seed-danger-fg: #2a0d0a;\n --seed-danger-soft: #3b1c19;\n --seed-danger-inverse: #b4332a;\n --seed-warn: #e9b062;\n --seed-warn-soft: #382a14;\n --seed-kind-image: #6cc0a3;\n --seed-kind-database: #b29cf0;\n --seed-kind-json: #e3ad5c;\n --seed-kind-html: #ef8a80;\n --seed-kind-text: #8fb8de;\n --seed-kind-other: #9aa8a0;\n --seed-checker-a: #1d2723;\n --seed-checker-b: #24302b;\n --seed-shadow: 0 12px 34px rgb(0 0 0 / 0.5), 0 2px 6px rgb(0 0 0 / 0.4);\n --seed-backdrop: rgb(0 0 0 / 0.55);\n color-scheme: dark;\n", Nr = `@layer ${Ar} {\n${`
|
|
2910
2899
|
.seed-fm {
|
|
2911
|
-
${
|
|
2900
|
+
${jr}
|
|
2912
2901
|
--seed-radius-sm: 6px;
|
|
2913
2902
|
--seed-radius-md: 8px;
|
|
2914
2903
|
--seed-radius-lg: 12px;
|
|
2915
2904
|
--seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
2916
2905
|
color-scheme: light;
|
|
2917
2906
|
}
|
|
2918
|
-
.seed-fm[data-seed-theme="dark"] { ${
|
|
2907
|
+
.seed-fm[data-seed-theme="dark"] { ${Mr} }
|
|
2919
2908
|
@media (prefers-color-scheme: dark) {
|
|
2920
|
-
.seed-fm[data-seed-theme="system"] { ${
|
|
2909
|
+
.seed-fm[data-seed-theme="system"] { ${Mr} }
|
|
2921
2910
|
}
|
|
2922
2911
|
|
|
2923
2912
|
.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }
|
|
@@ -3125,14 +3114,14 @@ var Or = "seed-opfs-files-manager-styles", kr = "seed-opfs-files-manager", Ar =
|
|
|
3125
3114
|
.seed-fm-thumb img { transition: none; }
|
|
3126
3115
|
}
|
|
3127
3116
|
`}\n}`;
|
|
3128
|
-
function
|
|
3117
|
+
function Pr() {
|
|
3129
3118
|
if (typeof document > "u" || document.getElementById("seed-opfs-files-manager-styles")) return;
|
|
3130
3119
|
let e = document.createElement("style");
|
|
3131
|
-
e.id =
|
|
3120
|
+
e.id = kr, e.textContent = Nr, document.head.appendChild(e);
|
|
3132
3121
|
}
|
|
3133
3122
|
//#endregion
|
|
3134
3123
|
//#region src/OPFSFilesManager/useStorageEstimate.ts
|
|
3135
|
-
function
|
|
3124
|
+
function Fr(e) {
|
|
3136
3125
|
let [t, n] = c(null);
|
|
3137
3126
|
return i(() => {
|
|
3138
3127
|
if (typeof navigator > "u" || typeof navigator.storage?.estimate != "function") return;
|
|
@@ -3149,40 +3138,40 @@ function Pr(e) {
|
|
|
3149
3138
|
}
|
|
3150
3139
|
//#endregion
|
|
3151
3140
|
//#region src/OPFSFilesManager/zip.ts
|
|
3152
|
-
var
|
|
3153
|
-
function
|
|
3154
|
-
if (
|
|
3155
|
-
|
|
3141
|
+
var Ir = null;
|
|
3142
|
+
function Lr() {
|
|
3143
|
+
if (Ir) return Ir;
|
|
3144
|
+
Ir = /* @__PURE__ */ new Uint32Array(256);
|
|
3156
3145
|
for (let e = 0; e < 256; e++) {
|
|
3157
3146
|
let t = e;
|
|
3158
3147
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
3159
|
-
|
|
3148
|
+
Ir[e] = t >>> 0;
|
|
3160
3149
|
}
|
|
3161
|
-
return
|
|
3150
|
+
return Ir;
|
|
3162
3151
|
}
|
|
3163
|
-
function
|
|
3164
|
-
let t =
|
|
3152
|
+
function Rr(e) {
|
|
3153
|
+
let t = Lr(), n = 4294967295;
|
|
3165
3154
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
3166
3155
|
return (n ^ 4294967295) >>> 0;
|
|
3167
3156
|
}
|
|
3168
|
-
function
|
|
3157
|
+
function zr(e) {
|
|
3169
3158
|
let t = new Date(e), n = Math.max(1980, t.getFullYear());
|
|
3170
3159
|
return {
|
|
3171
3160
|
time: t.getHours() << 11 | t.getMinutes() << 5 | Math.floor(t.getSeconds() / 2),
|
|
3172
3161
|
date: n - 1980 << 9 | t.getMonth() + 1 << 5 | t.getDate()
|
|
3173
3162
|
};
|
|
3174
3163
|
}
|
|
3175
|
-
var
|
|
3176
|
-
async function
|
|
3164
|
+
var Br = 2048, Vr = 4294967295;
|
|
3165
|
+
async function Hr(e) {
|
|
3177
3166
|
if (e.length > 65535) throw Error("Too many files for a ZIP archive (max 65,535).");
|
|
3178
3167
|
let t = new TextEncoder(), n = [], r = [], i = 0;
|
|
3179
3168
|
for (let a of e) {
|
|
3180
|
-
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s =
|
|
3181
|
-
if (i + o.length + 30 + e.length >
|
|
3169
|
+
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s = Rr(o), { time: c, date: l } = zr(a.lastModified ?? Date.now());
|
|
3170
|
+
if (i + o.length + 30 + e.length > Vr) throw Error("Selection is too large for a ZIP archive (max 4 GB).");
|
|
3182
3171
|
let u = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(30));
|
|
3183
|
-
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6,
|
|
3172
|
+
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6, Br, !0), u.setUint16(8, 0, !0), u.setUint16(10, c, !0), u.setUint16(12, l, !0), u.setUint32(14, s, !0), u.setUint32(18, o.length, !0), u.setUint32(22, o.length, !0), u.setUint16(26, e.length, !0), u.setUint16(28, 0, !0), n.push(u.buffer, e, o);
|
|
3184
3173
|
let d = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(46));
|
|
3185
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8,
|
|
3174
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, Br, !0), d.setUint16(10, 0, !0), d.setUint16(12, c, !0), d.setUint16(14, l, !0), d.setUint32(16, s, !0), d.setUint32(20, o.length, !0), d.setUint32(24, o.length, !0), d.setUint16(28, e.length, !0), d.setUint32(42, i, !0);
|
|
3186
3175
|
let f = new Uint8Array(46 + e.length);
|
|
3187
3176
|
f.set(new Uint8Array(d.buffer), 0), f.set(e, 46), r.push(f), i += 30 + e.length + o.length;
|
|
3188
3177
|
}
|
|
@@ -3195,12 +3184,12 @@ async function Vr(e) {
|
|
|
3195
3184
|
}
|
|
3196
3185
|
//#endregion
|
|
3197
3186
|
//#region src/OPFSFilesManager/OPFSFilesManager.tsx
|
|
3198
|
-
var
|
|
3199
|
-
function
|
|
3187
|
+
var Ur = "Everything this app stores in the browser’s private file system (OPFS).", Wr = 4e3, Gr = (e) => e instanceof Error ? e.message : String(e), Kr = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, qr = (e) => (e ?? "").split("/").filter(Boolean).join("/");
|
|
3188
|
+
function Jr(e, t) {
|
|
3200
3189
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
3201
3190
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
3202
3191
|
}
|
|
3203
|
-
function
|
|
3192
|
+
function Yr() {
|
|
3204
3193
|
let [e, t] = c([]), r = s(/* @__PURE__ */ new Set());
|
|
3205
3194
|
return i(() => {
|
|
3206
3195
|
let e = r.current;
|
|
@@ -3216,12 +3205,12 @@ function Jr() {
|
|
|
3216
3205
|
}]);
|
|
3217
3206
|
let a = setTimeout(() => {
|
|
3218
3207
|
r.current.delete(a), t((e) => e.filter((e) => e.id !== i));
|
|
3219
|
-
},
|
|
3208
|
+
}, Wr);
|
|
3220
3209
|
r.current.add(a);
|
|
3221
3210
|
}, [])
|
|
3222
3211
|
};
|
|
3223
3212
|
}
|
|
3224
|
-
var
|
|
3213
|
+
var Xr = [
|
|
3225
3214
|
"image",
|
|
3226
3215
|
"database",
|
|
3227
3216
|
"json",
|
|
@@ -3229,11 +3218,11 @@ var Yr = [
|
|
|
3229
3218
|
"text",
|
|
3230
3219
|
"other"
|
|
3231
3220
|
];
|
|
3232
|
-
function
|
|
3233
|
-
let n =
|
|
3234
|
-
label:
|
|
3221
|
+
function Zr({ files: e, estimate: t }) {
|
|
3222
|
+
let n = nr(e), r = e.reduce((e, t) => e + t.size, 0), i = t ? Math.max(0, t.usage - r) : 0, a = r + i, o = [...Xr.filter((e) => n[e] > 0).map((e) => ({
|
|
3223
|
+
label: yr[e].label,
|
|
3235
3224
|
size: n[e],
|
|
3236
|
-
color:
|
|
3225
|
+
color: yr[e].color
|
|
3237
3226
|
})), ...i > 0 ? [{
|
|
3238
3227
|
label: "Other site data",
|
|
3239
3228
|
size: i,
|
|
@@ -3247,7 +3236,7 @@ function Xr({ files: e, estimate: t }) {
|
|
|
3247
3236
|
children: [/* @__PURE__ */ H("span", { children: [
|
|
3248
3237
|
/* @__PURE__ */ V("strong", { children: Z(t ? t.usage : r) }),
|
|
3249
3238
|
" ",
|
|
3250
|
-
t ? "used by this site" : `in ${
|
|
3239
|
+
t ? "used by this site" : `in ${Kr(e.length, "file")}`
|
|
3251
3240
|
] }), t && /* @__PURE__ */ H("span", { children: [Z(t.quota), " available"] })]
|
|
3252
3241
|
}), a > 0 && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
3253
3242
|
className: "seed-fm-meter",
|
|
@@ -3270,7 +3259,7 @@ function Xr({ files: e, estimate: t }) {
|
|
|
3270
3259
|
})] })]
|
|
3271
3260
|
});
|
|
3272
3261
|
}
|
|
3273
|
-
function
|
|
3262
|
+
function Qr({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3274
3263
|
return /* @__PURE__ */ H("div", {
|
|
3275
3264
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3276
3265
|
role: r === "error" ? "alert" : void 0,
|
|
@@ -3288,23 +3277,23 @@ function Zr({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
|
3288
3277
|
]
|
|
3289
3278
|
});
|
|
3290
3279
|
}
|
|
3291
|
-
function
|
|
3280
|
+
function $r({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: l, title: u = "Files", description: d = Ur, headingLevel: f = 2, theme: p = "system", className: m, classNames: h = {}, defaultView: g, groupImageVariants: _ = !0, deleteWarning: v = rr, confirmDelete: y, deleteAction: b, onNotify: x }) {
|
|
3292
3281
|
a(() => {
|
|
3293
|
-
p !== "none" &&
|
|
3282
|
+
p !== "none" && Pr();
|
|
3294
3283
|
}, [p]);
|
|
3295
|
-
let S =
|
|
3284
|
+
let S = qr(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: ee, hasLoaded: E, error: D, errorName: O, refetch: te } = An({ rootPath: e }), k = o(() => t ? T.filter(t) : T, [T, t]), ne = Fr(T), [re, ie] = c(_);
|
|
3296
3285
|
i(() => ie(_), [_]);
|
|
3297
|
-
let ae = o(() =>
|
|
3298
|
-
i(() =>
|
|
3299
|
-
let [
|
|
3286
|
+
let ae = o(() => Qn(k, re), [k, re]), [oe, A] = c(S);
|
|
3287
|
+
i(() => A(S), [S]);
|
|
3288
|
+
let [j, M] = c(""), [se, ce] = c("name"), [le, ue] = c(g), [N, P] = c(() => /* @__PURE__ */ new Set()), de = s(null), [fe, F] = c(null), I = s(null), [L, pe] = c(null), [R, z] = c(null), [me, he] = c(!1), { toasts: ge, showToast: U } = Yr(), _e = (e, t, n) => {
|
|
3300
3289
|
x ? x(e, t, n) : U(e, t);
|
|
3301
|
-
}, ve = o(() =>
|
|
3302
|
-
query:
|
|
3290
|
+
}, ve = o(() => er(ae, oe, {
|
|
3291
|
+
query: j,
|
|
3303
3292
|
sort: se
|
|
3304
3293
|
}), [
|
|
3305
3294
|
ae,
|
|
3306
|
-
|
|
3307
|
-
|
|
3295
|
+
oe,
|
|
3296
|
+
j,
|
|
3308
3297
|
se
|
|
3309
3298
|
]), W = ve.entries, G = W.length ? W.filter((e) => $(e.file) === "image").length / W.length : 0, ye = le ?? (G >= .5 ? "grid" : "list"), be = o(() => new Map(ae.map((e) => [e.file.path, e])), [ae]), xe = o(() => [...N].map((e) => be.get(e)).filter((e) => !!e), [N, be]), K = fe ? be.get(fe) ?? null : null, Se = K ? W.indexOf(K) : -1;
|
|
3310
3299
|
i(() => {
|
|
@@ -3314,7 +3303,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3314
3303
|
});
|
|
3315
3304
|
}, [be]);
|
|
3316
3305
|
let Ce = (e) => {
|
|
3317
|
-
|
|
3306
|
+
A(e), M(""), P(/* @__PURE__ */ new Set()), de.current = null, F(null);
|
|
3318
3307
|
}, we = (e, t, n) => {
|
|
3319
3308
|
let r = de.current;
|
|
3320
3309
|
P((i) => {
|
|
@@ -3340,18 +3329,18 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3340
3329
|
return n;
|
|
3341
3330
|
});
|
|
3342
3331
|
}, De = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, Oe = async (e, t) => {
|
|
3343
|
-
l ? await l(e, t) :
|
|
3332
|
+
l ? await l(e, t) : Jr(e.name, t);
|
|
3344
3333
|
}, ke = async (e, t) => {
|
|
3345
3334
|
if (e.length === 0) return !1;
|
|
3346
3335
|
he(!0);
|
|
3347
3336
|
try {
|
|
3348
3337
|
if (e.length === 1 && !t) {
|
|
3349
3338
|
let [t] = e;
|
|
3350
|
-
return await Oe(t, await
|
|
3339
|
+
return await Oe(t, await bn(t.path)), !0;
|
|
3351
3340
|
}
|
|
3352
|
-
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await
|
|
3341
|
+
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await Hr(await Promise.all(e.map(async (e) => ({
|
|
3353
3342
|
name: t ? e.path.slice(n.length) : De(e.path),
|
|
3354
|
-
data: await
|
|
3343
|
+
data: await bn(e.path),
|
|
3355
3344
|
lastModified: e.lastModified
|
|
3356
3345
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3357
3346
|
return await Oe({
|
|
@@ -3360,16 +3349,16 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3360
3349
|
size: r.size,
|
|
3361
3350
|
type: "application/zip",
|
|
3362
3351
|
lastModified: Date.now()
|
|
3363
|
-
}, r), _e(`Saved ${i} with ${
|
|
3352
|
+
}, r), _e(`Saved ${i} with ${Kr(e.length, "file")}`, "success", {
|
|
3364
3353
|
kind: "download",
|
|
3365
3354
|
paths: e.map((e) => e.path),
|
|
3366
3355
|
fileName: i
|
|
3367
3356
|
}), !0;
|
|
3368
3357
|
} catch (t) {
|
|
3369
|
-
return _e(`Couldn’t download: ${
|
|
3358
|
+
return _e(`Couldn’t download: ${Gr(t)}`, "error", {
|
|
3370
3359
|
kind: "download",
|
|
3371
3360
|
paths: e.map((e) => e.path),
|
|
3372
|
-
error:
|
|
3361
|
+
error: Gr(t)
|
|
3373
3362
|
}), !1;
|
|
3374
3363
|
} finally {
|
|
3375
3364
|
he(!1);
|
|
@@ -3387,32 +3376,32 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3387
3376
|
let r = await navigator.storage.getDirectory();
|
|
3388
3377
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3389
3378
|
else try {
|
|
3390
|
-
await
|
|
3379
|
+
await xn(t.path, r), i.push(t.path);
|
|
3391
3380
|
} catch (e) {
|
|
3392
3381
|
a.push({
|
|
3393
3382
|
path: t.path,
|
|
3394
|
-
error:
|
|
3383
|
+
error: Gr(e)
|
|
3395
3384
|
});
|
|
3396
3385
|
}
|
|
3397
3386
|
if (t) try {
|
|
3398
|
-
s = await
|
|
3387
|
+
s = await Cn(t.path, r);
|
|
3399
3388
|
} catch (e) {
|
|
3400
3389
|
a.push({
|
|
3401
3390
|
path: t.path,
|
|
3402
|
-
error:
|
|
3391
|
+
error: Gr(e)
|
|
3403
3392
|
});
|
|
3404
3393
|
}
|
|
3405
3394
|
} catch (e) {
|
|
3406
3395
|
a.push({
|
|
3407
3396
|
path: "",
|
|
3408
|
-
error:
|
|
3397
|
+
error: Gr(e)
|
|
3409
3398
|
});
|
|
3410
3399
|
}
|
|
3411
3400
|
P((e) => {
|
|
3412
3401
|
let t = new Set(e);
|
|
3413
3402
|
return i.forEach((e) => t.delete(e)), t;
|
|
3414
3403
|
}), fe && i.includes(fe) && F(null), await te(), he(!1);
|
|
3415
|
-
let c = [s ? `Deleted the ${t.name} folder (${
|
|
3404
|
+
let c = [s ? `Deleted the ${t.name} folder (${Kr(i.length, "file")})` : i.length > 0 ? `Deleted ${Kr(i.length, "file")}` : "Nothing deleted"];
|
|
3416
3405
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3417
3406
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3418
3407
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
@@ -3449,7 +3438,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3449
3438
|
}), n = (t) => _e("Couldn’t copy. Select the path text instead.", "error", {
|
|
3450
3439
|
kind: "copy-path",
|
|
3451
3440
|
path: e,
|
|
3452
|
-
error: t === void 0 ? "Clipboard unavailable" :
|
|
3441
|
+
error: t === void 0 ? "Clipboard unavailable" : Gr(t)
|
|
3453
3442
|
});
|
|
3454
3443
|
try {
|
|
3455
3444
|
navigator.clipboard.writeText(e).then(t, n);
|
|
@@ -3468,14 +3457,14 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3468
3457
|
let t = W[Se + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3469
3458
|
t && F(t.file.path), e.preventDefault();
|
|
3470
3459
|
}
|
|
3471
|
-
}, ze = o(() => k.some((e) =>
|
|
3460
|
+
}, ze = o(() => k.some((e) => Yn(e.path)), [k]), Be = /(^|\/)images(\/\d+)?$/.test(oe), Ve = [{
|
|
3472
3461
|
label: C,
|
|
3473
3462
|
path: S
|
|
3474
|
-
}, ...(
|
|
3463
|
+
}, ...(oe.length > S.length ? oe.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3475
3464
|
label: e,
|
|
3476
3465
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3477
3466
|
}))], He = `h${f}`, X = xe.reduce((e, t) => e + t.file.size, 0), Ue;
|
|
3478
|
-
if (!
|
|
3467
|
+
if (!wn()) Ue = /* @__PURE__ */ V(Qr, {
|
|
3479
3468
|
icon: "triangleAlert",
|
|
3480
3469
|
tone: "error",
|
|
3481
3470
|
title: "This browser doesn’t support private file storage",
|
|
@@ -3491,7 +3480,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3491
3480
|
size: 15
|
|
3492
3481
|
}), " Try again"]
|
|
3493
3482
|
});
|
|
3494
|
-
Ue = O === "NotFoundError" && S ? /* @__PURE__ */ H(
|
|
3483
|
+
Ue = O === "NotFoundError" && S ? /* @__PURE__ */ H(Qr, {
|
|
3495
3484
|
icon: "triangleAlert",
|
|
3496
3485
|
tone: "error",
|
|
3497
3486
|
title: `Can’t open ${S}`,
|
|
@@ -3504,24 +3493,24 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3504
3493
|
/* @__PURE__ */ V("code", { children: "rootPath" }),
|
|
3505
3494
|
" prop, or open the app once so the SDK creates it."
|
|
3506
3495
|
]
|
|
3507
|
-
}) : /* @__PURE__ */ V(
|
|
3496
|
+
}) : /* @__PURE__ */ V(Qr, {
|
|
3508
3497
|
icon: "triangleAlert",
|
|
3509
3498
|
tone: "error",
|
|
3510
3499
|
title: "Can’t read private storage",
|
|
3511
3500
|
action: e,
|
|
3512
3501
|
children: D
|
|
3513
3502
|
});
|
|
3514
|
-
} else Ue = E ? ae.length === 0 ? /* @__PURE__ */ V(
|
|
3503
|
+
} else Ue = E ? ae.length === 0 ? /* @__PURE__ */ V(Qr, {
|
|
3515
3504
|
icon: "folderOpen",
|
|
3516
3505
|
title: `No files in ${C} yet`,
|
|
3517
3506
|
children: "Files show up here when the app saves images, JSON, or HTML to this browser’s private storage, for example after you add an image to a post or sync content from Arweave."
|
|
3518
|
-
}) : ve.folders.length === 0 && W.length === 0 ?
|
|
3507
|
+
}) : ve.folders.length === 0 && W.length === 0 ? j ? /* @__PURE__ */ H(Qr, {
|
|
3519
3508
|
icon: "search",
|
|
3520
|
-
title: `No matches for “${
|
|
3509
|
+
title: `No matches for “${j}”`,
|
|
3521
3510
|
action: /* @__PURE__ */ V("button", {
|
|
3522
3511
|
type: "button",
|
|
3523
3512
|
className: "seed-fm-btn",
|
|
3524
|
-
onClick: () =>
|
|
3513
|
+
onClick: () => M(""),
|
|
3525
3514
|
children: "Clear search"
|
|
3526
3515
|
}),
|
|
3527
3516
|
children: [
|
|
@@ -3529,7 +3518,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3529
3518
|
Ve[Ve.length - 1].label,
|
|
3530
3519
|
" and every folder inside it."
|
|
3531
3520
|
]
|
|
3532
|
-
}) : /* @__PURE__ */ V(
|
|
3521
|
+
}) : /* @__PURE__ */ V(Qr, {
|
|
3533
3522
|
icon: "folderOpen",
|
|
3534
3523
|
title: "This folder is empty",
|
|
3535
3524
|
children: "Everything in it has been deleted or filtered out."
|
|
@@ -3552,7 +3541,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3552
3541
|
}), /* @__PURE__ */ H("span", {
|
|
3553
3542
|
className: "seed-fm-folder-meta",
|
|
3554
3543
|
children: [
|
|
3555
|
-
|
|
3544
|
+
Kr(e.fileCount, "file"),
|
|
3556
3545
|
" · ",
|
|
3557
3546
|
Z(e.size)
|
|
3558
3547
|
]
|
|
@@ -3571,18 +3560,18 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3571
3560
|
})] }, e.path))
|
|
3572
3561
|
})] }), W.length > 0 && /* @__PURE__ */ H(B, { children: [/* @__PURE__ */ V("div", {
|
|
3573
3562
|
className: "seed-fm-section-label",
|
|
3574
|
-
children:
|
|
3575
|
-
}), ye === "grid" ? /* @__PURE__ */ V(
|
|
3563
|
+
children: j ? Kr(W.length, "result") : "Files"
|
|
3564
|
+
}), ye === "grid" ? /* @__PURE__ */ V(Cr, {
|
|
3576
3565
|
entries: W,
|
|
3577
3566
|
selected: N,
|
|
3578
3567
|
onActivate: Ee,
|
|
3579
3568
|
onToggle: we,
|
|
3580
3569
|
className: h.grid,
|
|
3581
3570
|
tileClassName: h.tile
|
|
3582
|
-
}) : /* @__PURE__ */ V(
|
|
3571
|
+
}) : /* @__PURE__ */ V(wr, {
|
|
3583
3572
|
entries: W,
|
|
3584
3573
|
selected: N,
|
|
3585
|
-
cwd:
|
|
3574
|
+
cwd: oe,
|
|
3586
3575
|
onActivate: Ee,
|
|
3587
3576
|
onToggle: we,
|
|
3588
3577
|
onToggleAll: J,
|
|
@@ -3623,7 +3612,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3623
3612
|
children: d
|
|
3624
3613
|
})]
|
|
3625
3614
|
}),
|
|
3626
|
-
E && !D && /* @__PURE__ */ V(
|
|
3615
|
+
E && !D && /* @__PURE__ */ V(Zr, {
|
|
3627
3616
|
files: k,
|
|
3628
3617
|
estimate: ne
|
|
3629
3618
|
}),
|
|
@@ -3666,8 +3655,8 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3666
3655
|
size: 14
|
|
3667
3656
|
}), /* @__PURE__ */ V("input", {
|
|
3668
3657
|
type: "search",
|
|
3669
|
-
value:
|
|
3670
|
-
onChange: (e) =>
|
|
3658
|
+
value: j,
|
|
3659
|
+
onChange: (e) => M(e.target.value),
|
|
3671
3660
|
placeholder: "Search names and paths",
|
|
3672
3661
|
"aria-label": "Search files"
|
|
3673
3662
|
})]
|
|
@@ -3796,7 +3785,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3796
3785
|
})
|
|
3797
3786
|
]
|
|
3798
3787
|
}),
|
|
3799
|
-
K && /* @__PURE__ */ V(
|
|
3788
|
+
K && /* @__PURE__ */ V(Or, {
|
|
3800
3789
|
entry: K,
|
|
3801
3790
|
className: h.panel,
|
|
3802
3791
|
onClose: q,
|
|
@@ -3807,7 +3796,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3807
3796
|
deleteAction: Me([K]),
|
|
3808
3797
|
onCopyPath: () => Le(K.file.path)
|
|
3809
3798
|
}, "panel"),
|
|
3810
|
-
L && /* @__PURE__ */ V(
|
|
3799
|
+
L && /* @__PURE__ */ V(Vn, {
|
|
3811
3800
|
entries: L,
|
|
3812
3801
|
rootPath: S,
|
|
3813
3802
|
warning: v(We),
|
|
@@ -3819,7 +3808,7 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3819
3808
|
pe(null), Ne(t);
|
|
3820
3809
|
}
|
|
3821
3810
|
}),
|
|
3822
|
-
R && /* @__PURE__ */ V(
|
|
3811
|
+
R && /* @__PURE__ */ V(Hn, {
|
|
3823
3812
|
folder: R,
|
|
3824
3813
|
files: Ge,
|
|
3825
3814
|
hiddenCount: T.filter((e) => e.path.startsWith(`${R.path}/`)).length - Ge.length,
|
|
@@ -3850,15 +3839,15 @@ function Qr({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3850
3839
|
}
|
|
3851
3840
|
//#endregion
|
|
3852
3841
|
//#region src/useEnsureLocalImage.ts
|
|
3853
|
-
var
|
|
3842
|
+
var ei = (e) => {
|
|
3854
3843
|
try {
|
|
3855
3844
|
return e.getService?.()?.getSnapshot?.()?.context?.storageTransactionId || void 0;
|
|
3856
3845
|
} catch {
|
|
3857
3846
|
return;
|
|
3858
3847
|
}
|
|
3859
3848
|
};
|
|
3860
|
-
function
|
|
3861
|
-
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, u] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ =
|
|
3849
|
+
function ti(e) {
|
|
3850
|
+
let { imageProperty: t, filename: r, width: a, enabled: s = !0 } = e, [l, u] = c(null), [f, p] = c("idle"), m = t?.refResolvedValue, h = t?.value, g = typeof h == "string" ? h : void 0, _ = ei(t), v = o(() => se(_) ?? se(r) ?? se(m) ?? se(g), [
|
|
3862
3851
|
_,
|
|
3863
3852
|
r,
|
|
3864
3853
|
m,
|
|
@@ -3926,23 +3915,23 @@ function ei(e) {
|
|
|
3926
3915
|
}
|
|
3927
3916
|
//#endregion
|
|
3928
3917
|
//#region src/SeedImage.tsx
|
|
3929
|
-
var
|
|
3918
|
+
var ni = z("seedSdk:react:SeedImage"), ri = /* @__PURE__ */ new Map(), ii = (e) => {
|
|
3930
3919
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
3931
3920
|
return t && t[2] ? t[2] : e;
|
|
3932
3921
|
};
|
|
3933
|
-
function
|
|
3922
|
+
function ai(e) {
|
|
3934
3923
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
3935
3924
|
}
|
|
3936
|
-
function
|
|
3937
|
-
let n = RegExp(`^${
|
|
3925
|
+
function oi(e, t) {
|
|
3926
|
+
let n = RegExp(`^${ai(t)}$`), r = ii(e);
|
|
3938
3927
|
return n.test(r);
|
|
3939
3928
|
}
|
|
3940
|
-
var
|
|
3941
|
-
let [l, u] = c(), [d, f] = c(), { property: m } =
|
|
3929
|
+
var si = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }, s) => {
|
|
3930
|
+
let [l, u] = c(), [d, f] = c(), { property: m } = et({
|
|
3942
3931
|
propertyName: t.propertyName,
|
|
3943
3932
|
seedLocalId: t.seedLocalId,
|
|
3944
3933
|
seedUid: t.seedUid
|
|
3945
|
-
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } =
|
|
3934
|
+
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } = ti({
|
|
3946
3935
|
imageProperty: h ?? t,
|
|
3947
3936
|
filename: r,
|
|
3948
3937
|
width: n,
|
|
@@ -3964,7 +3953,7 @@ var oi = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
3964
3953
|
!e && n && f(n);
|
|
3965
3954
|
}
|
|
3966
3955
|
} catch (e) {
|
|
3967
|
-
|
|
3956
|
+
ni("_getOriginalContentUrl error", e);
|
|
3968
3957
|
}
|
|
3969
3958
|
})(), () => {
|
|
3970
3959
|
e = !0;
|
|
@@ -3980,25 +3969,25 @@ var oi = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
3980
3969
|
try {
|
|
3981
3970
|
let e = await p.getFs(), t = h?.localStoragePath ? h.localStoragePath.split("/").slice(0, -1).join("/") : p.getFilesPath("images"), r = e.readdirSync(t, { withFileTypes: !0 }).filter((e) => e.isDirectory()).map((e) => parseInt(e.name)).filter((e) => !Number.isNaN(e));
|
|
3982
3971
|
if (r.length === 0) return;
|
|
3983
|
-
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a =
|
|
3984
|
-
if (
|
|
3985
|
-
let e =
|
|
3972
|
+
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = ii(g), o = `${a}-${i}`;
|
|
3973
|
+
if (ri.has(o)) try {
|
|
3974
|
+
let e = ri.get(o);
|
|
3986
3975
|
if (e && (await fetch(e)).ok) {
|
|
3987
3976
|
u(e);
|
|
3988
3977
|
return;
|
|
3989
3978
|
}
|
|
3990
3979
|
} catch (e) {
|
|
3991
|
-
|
|
3980
|
+
ni("error", e), ri.delete(o);
|
|
3992
3981
|
}
|
|
3993
|
-
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ?
|
|
3982
|
+
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? oi(e.name, a) : !1);
|
|
3994
3983
|
if (!s) return;
|
|
3995
3984
|
let c = `${t}/${i}/${s?.name}`;
|
|
3996
3985
|
if (await p.pathExists(c)) {
|
|
3997
3986
|
let e = await p.getContentUrlFromPath(c);
|
|
3998
|
-
e && (
|
|
3987
|
+
e && (ri.set(o, e), u(e));
|
|
3999
3988
|
}
|
|
4000
3989
|
} catch (e) {
|
|
4001
|
-
|
|
3990
|
+
ni("_getSizedContentUrl error", e);
|
|
4002
3991
|
}
|
|
4003
3992
|
})();
|
|
4004
3993
|
}, [
|
|
@@ -4024,7 +4013,7 @@ var oi = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4024
4013
|
}));
|
|
4025
4014
|
//#endregion
|
|
4026
4015
|
//#region src/useResolvedMediaRef.ts
|
|
4027
|
-
function
|
|
4016
|
+
function ci(e) {
|
|
4028
4017
|
let { value: t, enabled: r = !0, treatAs: a } = e, [o, s] = c(0), l = JSON.stringify([
|
|
4029
4018
|
r,
|
|
4030
4019
|
t ?? null,
|
|
@@ -4094,8 +4083,8 @@ function si(e) {
|
|
|
4094
4083
|
}
|
|
4095
4084
|
//#endregion
|
|
4096
4085
|
//#region src/SeedMediaImage.tsx
|
|
4097
|
-
function
|
|
4098
|
-
let { href: o } =
|
|
4086
|
+
function li({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
4087
|
+
let { href: o } = ci({
|
|
4099
4088
|
value: e,
|
|
4100
4089
|
enabled: t,
|
|
4101
4090
|
treatAs: n
|
|
@@ -4110,14 +4099,14 @@ function ci({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
4110
4099
|
}
|
|
4111
4100
|
//#endregion
|
|
4112
4101
|
//#region src/SeedMediaFile.tsx
|
|
4113
|
-
function
|
|
4102
|
+
function ui(e) {
|
|
4114
4103
|
try {
|
|
4115
4104
|
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
4116
4105
|
} catch {
|
|
4117
4106
|
return "Open";
|
|
4118
4107
|
}
|
|
4119
4108
|
}
|
|
4120
|
-
function
|
|
4109
|
+
function di(e) {
|
|
4121
4110
|
try {
|
|
4122
4111
|
let t = new URL(e).protocol;
|
|
4123
4112
|
return t === "http:" || t === "https:";
|
|
@@ -4125,27 +4114,27 @@ function ui(e) {
|
|
|
4125
4114
|
return !1;
|
|
4126
4115
|
}
|
|
4127
4116
|
}
|
|
4128
|
-
function
|
|
4129
|
-
let { href: l } =
|
|
4117
|
+
function fi({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
4118
|
+
let { href: l } = ci({
|
|
4130
4119
|
value: e,
|
|
4131
4120
|
enabled: t,
|
|
4132
4121
|
treatAs: n
|
|
4133
4122
|
});
|
|
4134
4123
|
if (!l) return null;
|
|
4135
|
-
let u =
|
|
4124
|
+
let u = di(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
4136
4125
|
...c,
|
|
4137
4126
|
href: l,
|
|
4138
4127
|
download: r,
|
|
4139
4128
|
target: d,
|
|
4140
4129
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
4141
|
-
children: a ??
|
|
4130
|
+
children: a ?? ui(l)
|
|
4142
4131
|
};
|
|
4143
4132
|
return i ? /* @__PURE__ */ V(B, { children: i(f) }) : /* @__PURE__ */ V("a", { ...f });
|
|
4144
4133
|
}
|
|
4145
4134
|
//#endregion
|
|
4146
4135
|
//#region src/SeedMediaAudio.tsx
|
|
4147
|
-
function
|
|
4148
|
-
let { href: o } =
|
|
4136
|
+
function pi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4137
|
+
let { href: o } = ci({
|
|
4149
4138
|
value: e,
|
|
4150
4139
|
enabled: t,
|
|
4151
4140
|
treatAs: n
|
|
@@ -4160,8 +4149,8 @@ function fi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4160
4149
|
}
|
|
4161
4150
|
//#endregion
|
|
4162
4151
|
//#region src/SeedMediaVideo.tsx
|
|
4163
|
-
function
|
|
4164
|
-
let { href: o } =
|
|
4152
|
+
function mi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4153
|
+
let { href: o } = ci({
|
|
4165
4154
|
value: e,
|
|
4166
4155
|
enabled: t,
|
|
4167
4156
|
treatAs: n
|
|
@@ -4176,11 +4165,11 @@ function pi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4176
4165
|
}
|
|
4177
4166
|
//#endregion
|
|
4178
4167
|
//#region src/SeedHtml.tsx
|
|
4179
|
-
function
|
|
4168
|
+
function hi(e) {
|
|
4180
4169
|
return typeof e == "string" && e.trim().length > 0;
|
|
4181
4170
|
}
|
|
4182
|
-
function
|
|
4183
|
-
if (!
|
|
4171
|
+
function gi({ html: e, sanitize: t, render: n, ...r }) {
|
|
4172
|
+
if (!hi(e)) return null;
|
|
4184
4173
|
let i = t(e);
|
|
4185
4174
|
return n ? /* @__PURE__ */ V(B, { children: n({ html: i }) }) : /* @__PURE__ */ V("div", {
|
|
4186
4175
|
...r,
|
|
@@ -4189,46 +4178,46 @@ function hi({ html: e, sanitize: t, render: n, ...r }) {
|
|
|
4189
4178
|
}
|
|
4190
4179
|
//#endregion
|
|
4191
4180
|
//#region src/formatSeedJson.ts
|
|
4192
|
-
function
|
|
4181
|
+
function _i(e, t) {
|
|
4193
4182
|
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
4194
4183
|
}
|
|
4195
|
-
function
|
|
4184
|
+
function vi(e) {
|
|
4196
4185
|
let t = e.trim();
|
|
4197
4186
|
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
4198
4187
|
}
|
|
4199
|
-
function
|
|
4188
|
+
function yi(e, t, n, r, i) {
|
|
4200
4189
|
if (typeof e == "bigint") return String(e);
|
|
4201
4190
|
if (typeof e == "symbol") return e.toString();
|
|
4202
4191
|
if (typeof e == "function") return "[Function]";
|
|
4203
4192
|
if (e instanceof Date) return e.toISOString();
|
|
4204
|
-
if (typeof e == "string") return
|
|
4193
|
+
if (typeof e == "string") return _i(e, n);
|
|
4205
4194
|
if (typeof e != "object" || !e) return e;
|
|
4206
4195
|
if (i.has(e)) return "[Circular]";
|
|
4207
4196
|
if (r >= t) return "[Max depth]";
|
|
4208
4197
|
i.add(e);
|
|
4209
4198
|
try {
|
|
4210
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
4199
|
+
if (Array.isArray(e)) return e.map((e) => yi(e, t, n, r + 1, i));
|
|
4211
4200
|
let a = {};
|
|
4212
|
-
for (let [o, s] of Object.entries(e)) a[o] =
|
|
4201
|
+
for (let [o, s] of Object.entries(e)) a[o] = yi(s, t, n, r + 1, i);
|
|
4213
4202
|
return a;
|
|
4214
4203
|
} finally {
|
|
4215
4204
|
i.delete(e);
|
|
4216
4205
|
}
|
|
4217
4206
|
}
|
|
4218
|
-
function
|
|
4207
|
+
function bi(e, t) {
|
|
4219
4208
|
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
4220
4209
|
if (e === void 0) return "undefined";
|
|
4221
4210
|
if (e === null) return "null";
|
|
4222
4211
|
let a = e;
|
|
4223
4212
|
if (typeof e == "string") {
|
|
4224
|
-
if (
|
|
4213
|
+
if (vi(e)) try {
|
|
4225
4214
|
a = JSON.parse(e);
|
|
4226
4215
|
} catch {
|
|
4227
|
-
return
|
|
4216
|
+
return _i(e, r);
|
|
4228
4217
|
}
|
|
4229
|
-
else return
|
|
4218
|
+
else return _i(e, r);
|
|
4230
4219
|
}
|
|
4231
|
-
let o =
|
|
4220
|
+
let o = yi(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
4232
4221
|
try {
|
|
4233
4222
|
return JSON.stringify(o, null, i);
|
|
4234
4223
|
} catch {
|
|
@@ -4237,8 +4226,8 @@ function yi(e, t) {
|
|
|
4237
4226
|
}
|
|
4238
4227
|
//#endregion
|
|
4239
4228
|
//#region src/SeedJson.tsx
|
|
4240
|
-
function
|
|
4241
|
-
let a = t ? t(e) :
|
|
4229
|
+
function xi({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4230
|
+
let a = t ? t(e) : bi(e, n);
|
|
4242
4231
|
return r ? /* @__PURE__ */ V(B, { children: r({ text: a }) }) : /* @__PURE__ */ V("pre", {
|
|
4243
4232
|
...i,
|
|
4244
4233
|
children: a
|
|
@@ -4246,10 +4235,10 @@ function bi({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
|
4246
4235
|
}
|
|
4247
4236
|
//#endregion
|
|
4248
4237
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4249
|
-
function
|
|
4238
|
+
function Si(e, t) {
|
|
4250
4239
|
return o(() => e ? ce(e, t) : {}, [e, t]);
|
|
4251
4240
|
}
|
|
4252
4241
|
//#endregion
|
|
4253
|
-
export { De as ADDRESSES_PERSISTED_EVENT,
|
|
4242
|
+
export { De as ADDRESSES_PERSISTED_EVENT, $t as FILES_QUERY_KEY_PREFIX, Oe as LOCAL_COPIES_REMOVED_EVENT, $r as OPFSFilesManager, Nr as OPFS_FILES_MANAGER_CSS, hn as SeedClientGate, gi as SeedHtml, si as SeedImage, xi as SeedJson, pi as SeedMediaAudio, fi as SeedMediaFile, li as SeedMediaImage, mi as SeedMediaVideo, fn as SeedProvider, ze as createSeedQueryClient, bi as formatSeedJson, $e as getItemPropertyQueryKey, We as getItemQueryKey, _t as getPercentComplete, Le as getSeedQueryDefaultOptions, pt as getServiceName, ht as getServiceUniqueKey, mt as getServiceValue, ln as invalidateItemPropertiesForItem, lt as isDbReadyState, Re as mergeSeedQueryDefaults, Pt as useAllSchemaVersions, q as useClientSelector, Te as useClientService, Je as useCreateItem, ot as useCreateItemProperty, zt as useCreateModel, Jt as useCreateModelProperty, Mt as useCreateSchema, ut as useDbsAreReady, tt as useDebouncedItemProperty, Xt as useDeleteItem, st as useDestroyItemProperty, Bt as useDestroyModel, Yt as useDestroyModelProperty, Nt as useDestroySchema, sn as useEasSyncProcessById, an as useEasSyncProcesses, on as useEasSyncProcessesNonActiveCount, rn as useEasSyncProcessesState, ti as useEnsureLocalImage, en as useFiles, wt as useGlobalServiceStatus, xt as useHasSavedSnapshots, Qt as useImageFiles, J as useIsClientReady, yt as useIsDbReady, Ge as useItem, at as useItemProperties, et as useItemProperty, qe as useItems, Y as useLiveQuery, Fe as useLiveQueryState, Rt as useModel, Ht as useModelProperties, qt as useModelProperty, Lt as useModels, Si as useNormalizedFeedItemFields, An as useOPFSFiles, bt as usePersistedSnapshots, Ye as usePublishItem, ci as useResolvedMediaRef, Ot as useSchema, jt as useSchemas, Ae as useSeedAddressRevision, Ft as useSeedProtocolSchema, vt as useService, Ct as useServices, Fr as useStorageEstimate, vr as useThumbnail };
|
|
4254
4243
|
|
|
4255
4244
|
//# sourceMappingURL=index.js.map
|