@seedprotocol/react 0.7.12-next.1410.gda14c61 → 0.7.12-next.1434.gd03298c
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.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1014 -1003
- package/dist/index.js.map +1 -1
- package/dist/item.d.ts.map +1 -1
- package/dist/itemProperty.d.ts.map +1 -1
- package/dist/modelProperty.d.ts.map +1 -1
- package/dist/services.d.ts +5 -2
- package/dist/services.d.ts.map +1 -1
- package/dist/useCreateState.d.ts.map +1 -1
- package/package.json +3 -3
package/dist/index.js
CHANGED
|
@@ -1,34 +1,34 @@
|
|
|
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 te, eventEmitter as D, getAddressesForItemsFilter as
|
|
5
|
-
import { debounce as
|
|
6
|
-
import
|
|
7
|
-
import { Fragment as
|
|
8
|
-
import { QueryClient as
|
|
9
|
-
import { and as
|
|
10
|
-
import
|
|
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 te, entityLoadError as ne, eventEmitter as D, getAddressesForItemsFilter as re, getArweaveReadBaseUrls as ie, getClient as O, getPropertySchema as ae, getVersionData as oe, isChangeFeedRunning as k, isClientReadySnapshot as se, isValidEasAttestationUid as A, loadAllSchemasFromDb as ce, mapUrlAttribute as le, metadata as j, modelSchemas as ue, models as de, nextArweaveGatewayUrl as M, normalizeArweaveTxIdForEnsure as N, normalizeFeedItemFields as fe, ownedSeedsSql as pe, pickLatestMetadataRowPerProperty as me, placeholderUidSql as he, properties as P, publisherInAddressListSql as ge, rehostArweaveLinksInHtml as F, resolveMediaRef as _e, schemas as I, seeds as L, watchEntityRows as ve } from "@seedprotocol/sdk";
|
|
5
|
+
import { debounce as ye, orderBy as be, startCase as xe } from "lodash-es";
|
|
6
|
+
import R from "debug";
|
|
7
|
+
import { Fragment as z, jsx as B, jsxs as V } from "react/jsx-runtime";
|
|
8
|
+
import { QueryClient as Se, QueryClientContext as Ce, QueryClientProvider as we, useQuery as H, useQueryClient as U } from "@tanstack/react-query";
|
|
9
|
+
import { and as W, desc as Te, eq as G, gt as Ee, isNotNull as De, isNull as Oe, or as ke } from "drizzle-orm";
|
|
10
|
+
import Ae from "pluralize";
|
|
11
11
|
//#region src/client.ts
|
|
12
|
-
var
|
|
13
|
-
function
|
|
14
|
-
let t =
|
|
12
|
+
var je = (e) => O().subscribeService(e), Me = () => O().getService(), Ne = () => l(je, Me, Me);
|
|
13
|
+
function K(e) {
|
|
14
|
+
let t = Ne(), r = s(e);
|
|
15
15
|
r.current = e;
|
|
16
16
|
let i = n((e) => {
|
|
17
17
|
let n = t.subscribe({
|
|
18
18
|
next: e,
|
|
19
19
|
error: e,
|
|
20
20
|
complete: e
|
|
21
|
-
}), r =
|
|
21
|
+
}), r = O().subscribeService(e);
|
|
22
22
|
return () => {
|
|
23
23
|
n.unsubscribe(), r();
|
|
24
24
|
};
|
|
25
25
|
}, [t]), a = () => r.current(t.getSnapshot());
|
|
26
26
|
return l(i, a, a);
|
|
27
27
|
}
|
|
28
|
-
var
|
|
28
|
+
var q = () => K(se);
|
|
29
29
|
//#endregion
|
|
30
30
|
//#region src/useHeldEntities.ts
|
|
31
|
-
function
|
|
31
|
+
function J(e, t, n) {
|
|
32
32
|
i(() => {
|
|
33
33
|
let r = e.filter((e) => t(e));
|
|
34
34
|
r.length < e.length && n();
|
|
@@ -49,11 +49,11 @@ function Y(e, t, n) {
|
|
|
49
49
|
}
|
|
50
50
|
//#endregion
|
|
51
51
|
//#region src/addressesPersistedEventName.ts
|
|
52
|
-
var
|
|
53
|
-
function
|
|
54
|
-
return r(
|
|
52
|
+
var Pe = "addresses.persisted", Fe = "localCopies.removed", Ie = t(0);
|
|
53
|
+
function Le() {
|
|
54
|
+
return r(Ie);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
56
|
+
function Re({ queryClient: e, children: t }) {
|
|
57
57
|
let [r, a] = c(0), o = n(() => {
|
|
58
58
|
e.invalidateQueries({
|
|
59
59
|
queryKey: ["seed", "items"],
|
|
@@ -66,19 +66,19 @@ function Le({ queryClient: e, children: t }) {
|
|
|
66
66
|
exact: !1
|
|
67
67
|
}), a((e) => e + 1);
|
|
68
68
|
}, [e]);
|
|
69
|
-
return i(() => (D.on(
|
|
70
|
-
D.off(
|
|
71
|
-
}), [o]), /* @__PURE__ */
|
|
69
|
+
return i(() => (D.on(Pe, o), D.on(Fe, o), () => {
|
|
70
|
+
D.off(Pe, o), D.off(Fe, o);
|
|
71
|
+
}), [o]), /* @__PURE__ */ B(Ie.Provider, {
|
|
72
72
|
value: r,
|
|
73
73
|
children: t
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
76
|
//#endregion
|
|
77
77
|
//#region src/liveQuery.ts
|
|
78
|
-
function
|
|
79
|
-
return
|
|
78
|
+
function Y(e) {
|
|
79
|
+
return He(e).data;
|
|
80
80
|
}
|
|
81
|
-
function
|
|
81
|
+
function ze(e) {
|
|
82
82
|
if (e && typeof e == "object" && typeof e.toSQL == "function") try {
|
|
83
83
|
let { sql: t, params: n } = e.toSQL();
|
|
84
84
|
return `sql:${t}|${JSON.stringify(n)}`;
|
|
@@ -87,19 +87,19 @@ function Re(e) {
|
|
|
87
87
|
}
|
|
88
88
|
return e;
|
|
89
89
|
}
|
|
90
|
-
var
|
|
90
|
+
var Be = [
|
|
91
91
|
500,
|
|
92
92
|
1e3,
|
|
93
93
|
2e3,
|
|
94
94
|
5e3,
|
|
95
95
|
1e4,
|
|
96
96
|
3e4
|
|
97
|
-
],
|
|
98
|
-
function
|
|
97
|
+
], Ve = (e) => e instanceof Error ? e : Error(String(e));
|
|
98
|
+
function He(e) {
|
|
99
99
|
let [t, n] = c({
|
|
100
100
|
data: void 0,
|
|
101
101
|
error: null
|
|
102
|
-
}), [r, a] = c(0), o =
|
|
102
|
+
}), [r, a] = c(0), o = q(), l = ze(e), u = s(e);
|
|
103
103
|
u.current = e;
|
|
104
104
|
let d = s(0), p = s(null);
|
|
105
105
|
return i(() => {
|
|
@@ -116,9 +116,9 @@ function Ve(e) {
|
|
|
116
116
|
let r, i = (e) => {
|
|
117
117
|
n((t) => ({
|
|
118
118
|
data: t.data,
|
|
119
|
-
error:
|
|
119
|
+
error: Ve(e)
|
|
120
120
|
}));
|
|
121
|
-
let t =
|
|
121
|
+
let t = Be[Math.min(d.current, Be.length - 1)];
|
|
122
122
|
d.current += 1, r = setTimeout(() => a((e) => e + 1), t);
|
|
123
123
|
}, s;
|
|
124
124
|
try {
|
|
@@ -145,16 +145,16 @@ function Ve(e) {
|
|
|
145
145
|
}
|
|
146
146
|
//#endregion
|
|
147
147
|
//#region src/queryClient.ts
|
|
148
|
-
var
|
|
148
|
+
var Ue = { queries: {
|
|
149
149
|
networkMode: "offlineFirst",
|
|
150
150
|
gcTime: 864e5,
|
|
151
151
|
staleTime: 6e4
|
|
152
152
|
} };
|
|
153
|
-
function
|
|
154
|
-
return { ...
|
|
153
|
+
function We() {
|
|
154
|
+
return { ...Ue };
|
|
155
155
|
}
|
|
156
|
-
function
|
|
157
|
-
let t =
|
|
156
|
+
function Ge(e) {
|
|
157
|
+
let t = We();
|
|
158
158
|
return e ? {
|
|
159
159
|
queries: {
|
|
160
160
|
...t.queries,
|
|
@@ -166,33 +166,33 @@ function We(e) {
|
|
|
166
166
|
}
|
|
167
167
|
} : t;
|
|
168
168
|
}
|
|
169
|
-
function
|
|
170
|
-
let t =
|
|
171
|
-
return new
|
|
169
|
+
function X(e) {
|
|
170
|
+
let t = We(), { defaultOptions: n, ...r } = e ?? {};
|
|
171
|
+
return new Se({
|
|
172
172
|
...r,
|
|
173
|
-
defaultOptions: n ?
|
|
173
|
+
defaultOptions: n ? Ge(n) : t
|
|
174
174
|
});
|
|
175
175
|
}
|
|
176
|
-
var
|
|
176
|
+
var Ke, qe = !1, Je = () => {
|
|
177
177
|
try {
|
|
178
178
|
return process.env.NODE_ENV !== "production";
|
|
179
179
|
} catch {
|
|
180
180
|
return !1;
|
|
181
181
|
}
|
|
182
182
|
};
|
|
183
|
-
function
|
|
184
|
-
return r(
|
|
183
|
+
function Ye() {
|
|
184
|
+
return r(Ce) || (!qe && Je() && (qe = !0, console.warn("[@seedprotocol/react] A Seed hook ran outside SeedProvider (no QueryClientProvider found), so it uses a shared fallback QueryClient. Wrap the app in <SeedProvider>: from 0.8 these hooks will throw without it.")), Ke ?? (Ke = X()), Ke);
|
|
185
185
|
}
|
|
186
186
|
//#endregion
|
|
187
187
|
//#region src/item.ts
|
|
188
|
-
var
|
|
188
|
+
var Xe = R("seedSdk:react:item"), Ze = (e) => [
|
|
189
189
|
"seed",
|
|
190
190
|
"item",
|
|
191
191
|
e ?? null
|
|
192
|
-
],
|
|
193
|
-
let a = t || r, [, l] = c(0), [, u] = c(0), [d, f] = c(!1), [p, m] = c(null), g = s(!1), v =
|
|
192
|
+
], Qe = ({ modelName: e, seedLocalId: t, seedUid: r }) => {
|
|
193
|
+
let a = t || r, [, l] = c(0), [, u] = c(0), [d, f] = c(!1), [p, m] = c(null), g = s(!1), v = q(), y = Ye(), b = o(() => Ze(a), [a]), x = s(b);
|
|
194
194
|
x.current = b;
|
|
195
|
-
let S =
|
|
195
|
+
let S = H({
|
|
196
196
|
queryKey: b,
|
|
197
197
|
queryFn: async () => {
|
|
198
198
|
let n = _.peekReady(a) ?? await _.find({
|
|
@@ -202,7 +202,7 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
202
202
|
hold: !1
|
|
203
203
|
});
|
|
204
204
|
if (n) return n;
|
|
205
|
-
|
|
205
|
+
Xe("[useItem] no item found", e, a);
|
|
206
206
|
let i = y.getQueryData(b);
|
|
207
207
|
return i && i.getService().getSnapshot().status === "active" ? i : null;
|
|
208
208
|
},
|
|
@@ -215,7 +215,7 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
215
215
|
}, y), C = S.data ?? void 0, w = n(() => {
|
|
216
216
|
y.invalidateQueries({ queryKey: x.current });
|
|
217
217
|
}, [y]);
|
|
218
|
-
return
|
|
218
|
+
return J(o(() => C ? [C] : [], [C]), $e, w), i(() => {
|
|
219
219
|
let e = () => {
|
|
220
220
|
l((e) => e + 1), y.invalidateQueries({ queryKey: x.current });
|
|
221
221
|
};
|
|
@@ -258,18 +258,18 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
258
258
|
isLoading: !!a && S.isPending || d,
|
|
259
259
|
error: p ?? S.error
|
|
260
260
|
};
|
|
261
|
-
},
|
|
261
|
+
}, $e = (e) => _.retain(e), et = [], tt = (e) => {
|
|
262
262
|
let t = /* @__PURE__ */ new Map(), n = [];
|
|
263
263
|
for (let r of e ?? []) {
|
|
264
264
|
if (!r.localId) continue;
|
|
265
|
-
let e =
|
|
265
|
+
let e = A(r.uid) ? r.uid.toLowerCase() : "", i = r.lastVersionPublishedAt || r.attestationCreatedAt || r.createdAt;
|
|
266
266
|
i && t.set(r.localId, i), n.push(`${r.localId}:${e}:${i ?? ""}`);
|
|
267
267
|
}
|
|
268
268
|
return {
|
|
269
269
|
signature: n.sort().join(","),
|
|
270
270
|
sortTimes: t
|
|
271
271
|
};
|
|
272
|
-
},
|
|
272
|
+
}, nt = (e, t, n, r, i, a, o) => [
|
|
273
273
|
"seed",
|
|
274
274
|
"items",
|
|
275
275
|
e ?? null,
|
|
@@ -281,8 +281,8 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
281
281
|
modelFileId: a ?? null,
|
|
282
282
|
schemaName: o ?? null
|
|
283
283
|
}] : []
|
|
284
|
-
],
|
|
285
|
-
let d =
|
|
284
|
+
], rt = ({ modelName: e, modelFileId: t, schemaName: r, deleted: a = !1, includeEas: l = !1, addressFilter: u }) => {
|
|
285
|
+
let d = q(), p = Le(), m = U();
|
|
286
286
|
i(() => {
|
|
287
287
|
let e = () => {
|
|
288
288
|
m.invalidateQueries({ queryKey: ["seed", "items"] });
|
|
@@ -298,13 +298,13 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
298
298
|
return;
|
|
299
299
|
}
|
|
300
300
|
let e = !1;
|
|
301
|
-
return
|
|
301
|
+
return re(u).then((t) => {
|
|
302
302
|
e || S(t);
|
|
303
303
|
}), () => {
|
|
304
304
|
e = !0;
|
|
305
305
|
};
|
|
306
306
|
}, [u, p]);
|
|
307
|
-
let C = o(() =>
|
|
307
|
+
let C = o(() => nt(e, a, l, u, p, t, r), [
|
|
308
308
|
e,
|
|
309
309
|
a,
|
|
310
310
|
l,
|
|
@@ -316,7 +316,7 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
316
316
|
i(() => {
|
|
317
317
|
v.current = /* @__PURE__ */ new Set();
|
|
318
318
|
}, [C]);
|
|
319
|
-
let { data: w =
|
|
319
|
+
let { data: w = et, isLoading: T, isFetching: E, dataUpdatedAt: te, error: ne } = H({
|
|
320
320
|
queryKey: C,
|
|
321
321
|
queryFn: async ({ signal: n }) => (y.current++, await _.all(e, a, {
|
|
322
322
|
hold: !1,
|
|
@@ -332,40 +332,40 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
332
332
|
gcTime: 0
|
|
333
333
|
});
|
|
334
334
|
g.current = w;
|
|
335
|
-
let
|
|
336
|
-
|
|
337
|
-
m.invalidateQueries({ queryKey:
|
|
335
|
+
let ie = s(C);
|
|
336
|
+
ie.current = C, J(w, $e, n(() => {
|
|
337
|
+
m.invalidateQueries({ queryKey: ie.current });
|
|
338
338
|
}, [m]));
|
|
339
|
-
let
|
|
340
|
-
if (!
|
|
339
|
+
let O = d ? f.getAppDb() : null, ae = Y(o(() => {
|
|
340
|
+
if (!O || (u === "owned" || u === "watched") && x === null) return null;
|
|
341
341
|
let t = [];
|
|
342
|
-
l || t.push(
|
|
343
|
-
let n =
|
|
344
|
-
return
|
|
345
|
-
localId:
|
|
346
|
-
uid:
|
|
347
|
-
type:
|
|
348
|
-
schemaUid:
|
|
349
|
-
createdAt:
|
|
350
|
-
attestationCreatedAt:
|
|
342
|
+
l || t.push(he(L.uid)), e && t.push(G(L.type, ee(e))), u === "owned" ? t.push(pe(x ?? [])) : u === "watched" && t.push(ge(L.publisher, x ?? [])), a ? t.push(G(L._markedForDeletion, 1)) : (t.push(ke(Oe(L._markedForDeletion), G(L._markedForDeletion, 0))), t.push(ke(Oe(L.revokedAt), G(L.revokedAt, 0))));
|
|
343
|
+
let n = oe();
|
|
344
|
+
return O.with(n).select({
|
|
345
|
+
localId: L.localId,
|
|
346
|
+
uid: L.uid,
|
|
347
|
+
type: L.type,
|
|
348
|
+
schemaUid: L.schemaUid,
|
|
349
|
+
createdAt: L.createdAt,
|
|
350
|
+
attestationCreatedAt: L.attestationCreatedAt,
|
|
351
351
|
lastVersionPublishedAt: n.lastVersionPublishedAt,
|
|
352
|
-
_markedForDeletion:
|
|
353
|
-
}).from(
|
|
352
|
+
_markedForDeletion: L._markedForDeletion
|
|
353
|
+
}).from(L).leftJoin(n, G(L.localId, n.seedLocalId)).where(W(Ee(n.versionsCount, 0), ...t)).groupBy(L.localId);
|
|
354
354
|
}, [
|
|
355
|
-
|
|
355
|
+
O,
|
|
356
356
|
d,
|
|
357
357
|
e,
|
|
358
358
|
a,
|
|
359
359
|
l,
|
|
360
360
|
u,
|
|
361
361
|
x
|
|
362
|
-
])),
|
|
363
|
-
|
|
364
|
-
let
|
|
362
|
+
])), k = s(tt(void 0)), se = tt(ae);
|
|
363
|
+
se.signature !== k.current.signature && (k.current = se);
|
|
364
|
+
let A = k.current;
|
|
365
365
|
return i(() => {
|
|
366
|
-
if (!d || !
|
|
366
|
+
if (!d || !ae) return;
|
|
367
367
|
let e = /* @__PURE__ */ new Set();
|
|
368
|
-
for (let t of
|
|
368
|
+
for (let t of ae) {
|
|
369
369
|
let n = t.localId || t.uid;
|
|
370
370
|
n && e.add(n);
|
|
371
371
|
}
|
|
@@ -374,26 +374,30 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
374
374
|
let n = e.seedLocalId || e.seedUid;
|
|
375
375
|
n && t.add(n);
|
|
376
376
|
}
|
|
377
|
-
e.size === 0 && t.size > 0 || (
|
|
377
|
+
e.size === 0 && t.size > 0 || (st(t, e) ? v.current = e : st(v.current, e) && (y.current > b.current || E) || (v.current = e, b.current = y.current, m.invalidateQueries({ queryKey: C })));
|
|
378
378
|
}, [
|
|
379
379
|
d,
|
|
380
|
-
|
|
380
|
+
ae,
|
|
381
381
|
m,
|
|
382
382
|
C,
|
|
383
383
|
te,
|
|
384
384
|
E
|
|
385
385
|
]), {
|
|
386
|
-
items: o(() =>
|
|
386
|
+
items: o(() => be(w, [(e) => e.seedLocalId && A.sortTimes.get(e.seedLocalId) || e.lastVersionPublishedAt || e.attestationCreatedAt || e.createdAt], ["desc"]), [w, A]),
|
|
387
387
|
isLoading: T || !d,
|
|
388
|
-
error:
|
|
388
|
+
error: ne
|
|
389
389
|
};
|
|
390
|
-
},
|
|
391
|
-
let
|
|
390
|
+
}, it = (e, t) => {
|
|
391
|
+
let n = Object.keys(e ?? {}), r = Object.keys(t ?? {});
|
|
392
|
+
return n.length === r.length && n.every((n) => Object.is(e?.[n], t?.[n]));
|
|
393
|
+
}, at = () => {
|
|
394
|
+
let [e, t] = c(!1), [r, i] = c(null), a = s([]), o = n(() => i(null), []);
|
|
392
395
|
return {
|
|
393
396
|
createItem: n((e, n, r) => {
|
|
394
|
-
|
|
397
|
+
let o = a.current.find((t) => t.modelName === e && it(t.itemData, n) && it(t.options, r));
|
|
398
|
+
if (o) return Xe("[useCreateItem] [createItem] the same create is running, returning it"), o.promise;
|
|
395
399
|
i(null), u(() => t(!0));
|
|
396
|
-
let
|
|
400
|
+
let s = async () => {
|
|
397
401
|
try {
|
|
398
402
|
let t = n ?? {};
|
|
399
403
|
return await _.create({
|
|
@@ -404,19 +408,24 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
404
408
|
...r
|
|
405
409
|
}) ?? void 0;
|
|
406
410
|
} catch (e) {
|
|
407
|
-
|
|
411
|
+
Xe("[useCreateItem] Error creating item:", e), i(e instanceof Error ? e : Error(String(e)));
|
|
408
412
|
return;
|
|
409
413
|
} finally {
|
|
410
|
-
a.current =
|
|
414
|
+
a.current = a.current.filter((e) => e !== c), a.current.length === 0 && queueMicrotask(() => t(!1));
|
|
411
415
|
}
|
|
412
|
-
}
|
|
413
|
-
|
|
416
|
+
}, c = {
|
|
417
|
+
modelName: e,
|
|
418
|
+
itemData: n,
|
|
419
|
+
options: r,
|
|
420
|
+
promise: Promise.resolve(void 0)
|
|
421
|
+
};
|
|
422
|
+
return a.current = [...a.current, c], c.promise = s(), c.promise;
|
|
414
423
|
}, []),
|
|
415
424
|
isLoading: e,
|
|
416
425
|
error: r,
|
|
417
426
|
resetError: o
|
|
418
427
|
};
|
|
419
|
-
},
|
|
428
|
+
}, ot = () => {
|
|
420
429
|
let [e, t] = c(null), [r, a] = c(!1), [o, l] = c(null), u = s(void 0), d = n(() => l(null), []), f = n((e, n) => {
|
|
421
430
|
e && (t(e), l(null), e.publish(n).catch((e) => {
|
|
422
431
|
l(e instanceof Error ? e : Error(String(e)));
|
|
@@ -441,16 +450,16 @@ var Ye = z("seedSdk:react:item"), Xe = (e) => [
|
|
|
441
450
|
resetError: d
|
|
442
451
|
};
|
|
443
452
|
};
|
|
444
|
-
function
|
|
453
|
+
function st(e, t) {
|
|
445
454
|
return e.size === t.size && [...e].every((e) => t.has(e));
|
|
446
455
|
}
|
|
447
456
|
//#endregion
|
|
448
457
|
//#region src/entityRows.ts
|
|
449
|
-
function
|
|
450
|
-
let n =
|
|
458
|
+
function ct(e, t) {
|
|
459
|
+
let n = q() && k(), r = He(n ? null : t), [a, o] = c({
|
|
451
460
|
data: void 0,
|
|
452
461
|
error: null
|
|
453
|
-
}), l = e && t ? `${JSON.stringify(e)}|${String(
|
|
462
|
+
}), l = e && t ? `${JSON.stringify(e)}|${String(ze(t))}` : null, u = s({
|
|
454
463
|
watch: e,
|
|
455
464
|
query: t
|
|
456
465
|
});
|
|
@@ -464,14 +473,14 @@ function ot(e, t) {
|
|
|
464
473
|
});
|
|
465
474
|
let { watch: e, query: t } = u.current;
|
|
466
475
|
if (!n || !l || !e || !t) return;
|
|
467
|
-
let r =
|
|
476
|
+
let r = ve(e, () => t.all(), (e) => o({
|
|
468
477
|
data: [...e],
|
|
469
478
|
error: null
|
|
470
479
|
}), {
|
|
471
480
|
immediate: !0,
|
|
472
481
|
onError: (e) => o((t) => ({
|
|
473
482
|
data: t.data,
|
|
474
|
-
error:
|
|
483
|
+
error: Ve(e)
|
|
475
484
|
}))
|
|
476
485
|
});
|
|
477
486
|
return () => r.unsubscribe();
|
|
@@ -479,15 +488,15 @@ function ot(e, t) {
|
|
|
479
488
|
}
|
|
480
489
|
//#endregion
|
|
481
490
|
//#region src/itemProperty.ts
|
|
482
|
-
var
|
|
491
|
+
var lt = R("seedSdk:react:property"), ut = R("seedSdk:react:itemProperties"), dt = (e, t, n) => [
|
|
483
492
|
"seed",
|
|
484
493
|
"itemProperty",
|
|
485
494
|
e ?? null,
|
|
486
495
|
t ?? null,
|
|
487
496
|
n
|
|
488
497
|
];
|
|
489
|
-
function
|
|
490
|
-
let n =
|
|
498
|
+
function ft(e, t) {
|
|
499
|
+
let n = q(), r = Ye(), [, 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(() => {
|
|
491
500
|
let e = p !== void 0 && p !== "" ? p : u, t = p !== void 0 && p !== "" ? void 0 : d;
|
|
492
501
|
return (e || t) && m ? {
|
|
493
502
|
type: "identifiers",
|
|
@@ -501,7 +510,7 @@ function ut(e, t) {
|
|
|
501
510
|
m,
|
|
502
511
|
u,
|
|
503
512
|
d
|
|
504
|
-
]), g = o(() =>
|
|
513
|
+
]), g = o(() => dt(h?.seedLocalId, h?.seedUid, h?.propertyName ?? ""), [h]), _ = H({
|
|
505
514
|
queryKey: g,
|
|
506
515
|
queryFn: async () => {
|
|
507
516
|
if (!h) return null;
|
|
@@ -515,7 +524,7 @@ function ut(e, t) {
|
|
|
515
524
|
seedUid: h.itemId,
|
|
516
525
|
hold: !1
|
|
517
526
|
}) : void 0, n = e ?? t;
|
|
518
|
-
return n ||
|
|
527
|
+
return n || lt(`[useItemProperty] no property found for Item.${h.seedLocalId || h.seedUid}.${h.propertyName}`), n ?? null;
|
|
519
528
|
},
|
|
520
529
|
initialData: () => h ? v.peekReady(h) : void 0,
|
|
521
530
|
staleTime: 0,
|
|
@@ -524,26 +533,26 @@ function ut(e, t) {
|
|
|
524
533
|
retry: !1,
|
|
525
534
|
enabled: n && !!h
|
|
526
535
|
}, r), y = _.data ?? void 0;
|
|
527
|
-
return
|
|
536
|
+
return ht(o(() => y ? [y] : [], [y])), i(() => {
|
|
528
537
|
if (!y) return;
|
|
529
|
-
let e = () => a((e) => e + 1), t = y.getService().getSnapshot()?.context, n = t?.renderValue, r = t?.propertyValue, i =
|
|
538
|
+
let e = () => a((e) => e + 1), t = y.getService().getSnapshot()?.context, n = t?.renderValue, r = t?.propertyValue, i = t?.conflict, o = !1, s = 0, c, l = y.getService().subscribe((t) => {
|
|
530
539
|
let a = t?.context ?? {};
|
|
531
|
-
if (!Object.is(a.renderValue, n) || !Object.is(a.propertyValue, r)) {
|
|
532
|
-
n = a.renderValue, r = a.propertyValue, i = t.value === "idle" && a._status === "ready",
|
|
540
|
+
if (!Object.is(a.renderValue, n) || !Object.is(a.propertyValue, r) || !Object.is(a.conflict ?? null, i ?? null)) {
|
|
541
|
+
n = a.renderValue, r = a.propertyValue, i = a.conflict, o = t.value === "idle" && a._status === "ready", s = Date.now(), clearTimeout(c), c = void 0, e();
|
|
533
542
|
return;
|
|
534
543
|
}
|
|
535
544
|
if (t.value === "idle" && a._status === "ready") {
|
|
536
|
-
|
|
545
|
+
o || (o = !0, clearTimeout(c), c = void 0, e());
|
|
537
546
|
return;
|
|
538
547
|
}
|
|
539
|
-
|
|
540
|
-
let
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
}, 50 - (
|
|
548
|
+
o = !1;
|
|
549
|
+
let l = Date.now();
|
|
550
|
+
l - s >= 50 ? (s = l, e()) : c || (c = setTimeout(() => {
|
|
551
|
+
c = void 0, s = Date.now(), e();
|
|
552
|
+
}, 50 - (l - s)));
|
|
544
553
|
});
|
|
545
554
|
return () => {
|
|
546
|
-
clearTimeout(
|
|
555
|
+
clearTimeout(c), l.unsubscribe();
|
|
547
556
|
};
|
|
548
557
|
}, [y]), {
|
|
549
558
|
property: y,
|
|
@@ -551,8 +560,8 @@ function ut(e, t) {
|
|
|
551
560
|
error: _.error
|
|
552
561
|
};
|
|
553
562
|
}
|
|
554
|
-
function
|
|
555
|
-
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 } =
|
|
563
|
+
function pt(e, t = 300) {
|
|
564
|
+
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 } = ft(o(() => r ? {
|
|
556
565
|
itemId: r,
|
|
557
566
|
propertyName: l
|
|
558
567
|
} : {
|
|
@@ -564,7 +573,7 @@ function dt(e, t = 300) {
|
|
|
564
573
|
a,
|
|
565
574
|
c,
|
|
566
575
|
l
|
|
567
|
-
])), p = s(""), m =
|
|
576
|
+
])), p = s(""), m = mt(u), h = o(() => ye((e) => {
|
|
568
577
|
e.setValue(p.current);
|
|
569
578
|
}, t), [t]);
|
|
570
579
|
i(() => () => h.flush(), [h]);
|
|
@@ -579,7 +588,7 @@ function dt(e, t = 300) {
|
|
|
579
588
|
error: f ?? m
|
|
580
589
|
};
|
|
581
590
|
}
|
|
582
|
-
function
|
|
591
|
+
function mt(e) {
|
|
583
592
|
let [t, n] = c(null);
|
|
584
593
|
return i(() => {
|
|
585
594
|
if (!e) {
|
|
@@ -599,7 +608,7 @@ function ft(e) {
|
|
|
599
608
|
return () => a.unsubscribe();
|
|
600
609
|
}, [e]), t;
|
|
601
610
|
}
|
|
602
|
-
function
|
|
611
|
+
function ht(e) {
|
|
603
612
|
i(() => {
|
|
604
613
|
let t = e.filter((e) => v.retain(e));
|
|
605
614
|
return () => {
|
|
@@ -609,7 +618,7 @@ function pt(e) {
|
|
|
609
618
|
};
|
|
610
619
|
}, [e]);
|
|
611
620
|
}
|
|
612
|
-
async function
|
|
621
|
+
async function gt(e, t) {
|
|
613
622
|
if (!e && !t) return [];
|
|
614
623
|
let n = f.getAppDb();
|
|
615
624
|
if (!n) return [];
|
|
@@ -624,19 +633,19 @@ async function mt(e, t) {
|
|
|
624
633
|
let o;
|
|
625
634
|
if (r.length > 0) {
|
|
626
635
|
let e = r[0];
|
|
627
|
-
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o =
|
|
636
|
+
o = e.modelName ?? e.modelType, o && typeof o == "string" && (o = xe(o));
|
|
628
637
|
}
|
|
629
638
|
let s = await n.select({
|
|
630
|
-
type:
|
|
631
|
-
modelFileId:
|
|
632
|
-
}).from(
|
|
633
|
-
!o && s.length > 0 && s[0].type && (o =
|
|
639
|
+
type: L.type,
|
|
640
|
+
modelFileId: L.modelFileId
|
|
641
|
+
}).from(L).where(t ? G(L.uid, t) : G(L.localId, e)).limit(1), c = s[0]?.modelFileId ?? void 0;
|
|
642
|
+
!o && s.length > 0 && s[0].type && (o = xe(s[0].type));
|
|
634
643
|
let l = [];
|
|
635
644
|
if (o) try {
|
|
636
645
|
let { Model: e } = await import("@seedprotocol/sdk"), t = await e.resolveAsync(o, { modelFileId: c });
|
|
637
646
|
if (t?.properties) for (let e of t.properties) e.name && l.push(e.name);
|
|
638
647
|
} catch (e) {
|
|
639
|
-
|
|
648
|
+
ut(`[useItemProperties] Error getting ModelProperties for ${o}:`, e);
|
|
640
649
|
}
|
|
641
650
|
if (o && l.length > 0) {
|
|
642
651
|
let n = r.length > 0 ? r[0].seedLocalId ?? e : e, s = r.length > 0 ? r[0].seedUid ?? t : t;
|
|
@@ -653,11 +662,11 @@ async function mt(e, t) {
|
|
|
653
662
|
});
|
|
654
663
|
t && i.push(t);
|
|
655
664
|
} catch (t) {
|
|
656
|
-
|
|
665
|
+
lt(`[useItemProperties] Error creating ItemProperty for missing property ${e}:`, t);
|
|
657
666
|
}
|
|
658
667
|
}
|
|
659
668
|
if (e || t) {
|
|
660
|
-
let a = await n.select({ createdAt:
|
|
669
|
+
let a = await n.select({ createdAt: L.createdAt }).from(L).where(t ? G(L.uid, t) : G(L.localId, e)).limit(1);
|
|
661
670
|
if (a.length > 0 && a[0].createdAt) {
|
|
662
671
|
let n = "createdAt";
|
|
663
672
|
if (!i.some((e) => e.propertyName === n) && o) try {
|
|
@@ -673,14 +682,14 @@ async function mt(e, t) {
|
|
|
673
682
|
});
|
|
674
683
|
l && i.push(l);
|
|
675
684
|
} catch (e) {
|
|
676
|
-
|
|
685
|
+
lt("[useItemProperties] Error creating createdAt ItemProperty:", e);
|
|
677
686
|
}
|
|
678
687
|
}
|
|
679
688
|
}
|
|
680
689
|
return i;
|
|
681
690
|
}
|
|
682
|
-
function
|
|
683
|
-
let t =
|
|
691
|
+
function _t(e) {
|
|
692
|
+
let t = q(), n = U(), r = s(void 0), a = o(() => typeof e == "string" ? {
|
|
684
693
|
type: "itemId",
|
|
685
694
|
itemId: e
|
|
686
695
|
} : typeof e == "object" ? {
|
|
@@ -695,53 +704,54 @@ function ht(e) {
|
|
|
695
704
|
"seed",
|
|
696
705
|
"itemProperties",
|
|
697
706
|
u
|
|
698
|
-
], [u]), { data: p = [], isLoading: m, error: h } =
|
|
707
|
+
], [u]), { data: p = [], isLoading: m, error: h } = H({
|
|
699
708
|
queryKey: d,
|
|
700
|
-
queryFn: () =>
|
|
709
|
+
queryFn: () => gt(c, l),
|
|
701
710
|
enabled: t && !!u,
|
|
702
|
-
gcTime: 0
|
|
711
|
+
gcTime: 0,
|
|
712
|
+
structuralSharing: !1
|
|
703
713
|
});
|
|
704
|
-
|
|
714
|
+
ht(p);
|
|
705
715
|
let g = o(() => {
|
|
706
|
-
if (!t || !c && !l) return
|
|
716
|
+
if (!t || !c && !l) return ut("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
707
717
|
let e = f.getAppDb();
|
|
708
|
-
if (!e) return
|
|
709
|
-
|
|
718
|
+
if (!e) return ut("[useItemProperties] Query: returning null (no db)"), null;
|
|
719
|
+
ut(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${l}`);
|
|
710
720
|
let n = l ? e.select({
|
|
711
|
-
propertyName:
|
|
712
|
-
propertyValue:
|
|
713
|
-
seedLocalId:
|
|
714
|
-
seedUid:
|
|
715
|
-
modelType:
|
|
716
|
-
schemaUid:
|
|
717
|
-
createdAt:
|
|
718
|
-
attestationCreatedAt:
|
|
719
|
-
localId:
|
|
720
|
-
revokedAt:
|
|
721
|
-
}).from(
|
|
722
|
-
propertyName:
|
|
723
|
-
propertyValue:
|
|
724
|
-
seedLocalId:
|
|
725
|
-
seedUid:
|
|
726
|
-
modelType:
|
|
727
|
-
schemaUid:
|
|
728
|
-
createdAt:
|
|
729
|
-
attestationCreatedAt:
|
|
730
|
-
localId:
|
|
731
|
-
revokedAt:
|
|
732
|
-
}).from(
|
|
733
|
-
return
|
|
721
|
+
propertyName: j.propertyName,
|
|
722
|
+
propertyValue: j.propertyValue,
|
|
723
|
+
seedLocalId: j.seedLocalId,
|
|
724
|
+
seedUid: j.seedUid,
|
|
725
|
+
modelType: j.modelType,
|
|
726
|
+
schemaUid: j.schemaUid,
|
|
727
|
+
createdAt: j.createdAt,
|
|
728
|
+
attestationCreatedAt: j.attestationCreatedAt,
|
|
729
|
+
localId: j.localId,
|
|
730
|
+
revokedAt: j.revokedAt
|
|
731
|
+
}).from(j).where(W(G(j.seedUid, l), De(j.propertyName))) : c ? e.select({
|
|
732
|
+
propertyName: j.propertyName,
|
|
733
|
+
propertyValue: j.propertyValue,
|
|
734
|
+
seedLocalId: j.seedLocalId,
|
|
735
|
+
seedUid: j.seedUid,
|
|
736
|
+
modelType: j.modelType,
|
|
737
|
+
schemaUid: j.schemaUid,
|
|
738
|
+
createdAt: j.createdAt,
|
|
739
|
+
attestationCreatedAt: j.attestationCreatedAt,
|
|
740
|
+
localId: j.localId,
|
|
741
|
+
revokedAt: j.revokedAt
|
|
742
|
+
}).from(j).where(W(G(j.seedLocalId, c), De(j.propertyName))) : null;
|
|
743
|
+
return ut("[useItemProperties] Query: created query object", { queryType: l ? "seedUid" : "seedLocalId" }), n;
|
|
734
744
|
}, [
|
|
735
745
|
t,
|
|
736
746
|
c,
|
|
737
747
|
l
|
|
738
|
-
]), _ =
|
|
748
|
+
]), _ = ct(o(() => l ? {
|
|
739
749
|
seedUid: l,
|
|
740
750
|
tables: ["metadata"]
|
|
741
751
|
} : c ? {
|
|
742
752
|
seedLocalId: c,
|
|
743
753
|
tables: ["metadata"]
|
|
744
|
-
} : null, [c, l]), g).data, v = o(() => !_ || _.length === 0 ? [] :
|
|
754
|
+
} : null, [c, l]), g).data, v = o(() => !_ || _.length === 0 ? [] : me(_), [_]);
|
|
745
755
|
return i(() => {
|
|
746
756
|
if (!t || !c && !l || v === void 0) return;
|
|
747
757
|
let e = JSON.stringify(v.map((e) => ({
|
|
@@ -767,7 +777,7 @@ function ht(e) {
|
|
|
767
777
|
error: h
|
|
768
778
|
};
|
|
769
779
|
}
|
|
770
|
-
var
|
|
780
|
+
var vt = () => {
|
|
771
781
|
let e = s(void 0), [t, r] = c(!1), [a, o] = c(null), l = n(() => o(null), []), u = n((t) => {
|
|
772
782
|
if (!t.propertyName || !t.seedLocalId && !t.seedUid || !t.modelName) {
|
|
773
783
|
o(/* @__PURE__ */ Error("seedLocalId or seedUid, propertyName, and modelName are required"));
|
|
@@ -783,7 +793,11 @@ var gt = () => {
|
|
|
783
793
|
return;
|
|
784
794
|
}
|
|
785
795
|
let i = n.getService().subscribe(() => {
|
|
786
|
-
|
|
796
|
+
if (n.status === "error") {
|
|
797
|
+
let e = ne(n);
|
|
798
|
+
o(e instanceof Error ? e : /* @__PURE__ */ Error("Failed to create item property")), r(!1);
|
|
799
|
+
}
|
|
800
|
+
n.status === "ready" && (o(null), r(!1));
|
|
787
801
|
});
|
|
788
802
|
return e.current = i, n;
|
|
789
803
|
}, []);
|
|
@@ -795,7 +809,7 @@ var gt = () => {
|
|
|
795
809
|
error: a,
|
|
796
810
|
resetError: l
|
|
797
811
|
};
|
|
798
|
-
},
|
|
812
|
+
}, yt = () => {
|
|
799
813
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
800
814
|
return {
|
|
801
815
|
destroy: n(async (e) => {
|
|
@@ -814,24 +828,24 @@ var gt = () => {
|
|
|
814
828
|
error: r,
|
|
815
829
|
resetError: n(() => i(null), [])
|
|
816
830
|
};
|
|
817
|
-
},
|
|
831
|
+
}, bt = /* @__PURE__ */ new Set([
|
|
818
832
|
m.SAVE_CONFIG,
|
|
819
833
|
m.PROCESS_SCHEMA_FILES,
|
|
820
834
|
m.ADD_MODELS_TO_DB,
|
|
821
835
|
m.IDLE
|
|
822
|
-
]),
|
|
836
|
+
]), xt = (e) => typeof e == "string" && bt.has(e), St = () => ({ dbsAreReady: K((e) => e.status === "active" && xt(e.value)) }), Ct = R("seedSdk:react:services"), wt = [
|
|
823
837
|
"idle",
|
|
824
838
|
"ready",
|
|
825
839
|
"done",
|
|
826
840
|
"success",
|
|
827
841
|
"initialized"
|
|
828
|
-
],
|
|
842
|
+
], Tt = (e) => {
|
|
829
843
|
let t = "actor", n = e;
|
|
830
|
-
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t =
|
|
831
|
-
},
|
|
844
|
+
return e && n.uniqueKey && (t = n.uniqueKey), e && !n.uniqueKey && n.logic && n.logic.config && (t = Dt(e)), t;
|
|
845
|
+
}, Et = (e) => {
|
|
832
846
|
let t;
|
|
833
|
-
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value),
|
|
834
|
-
},
|
|
847
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (t = e.getSnapshot().value), Tt(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;
|
|
848
|
+
}, Dt = (e) => {
|
|
835
849
|
let t = e;
|
|
836
850
|
if (!e || !t.logic || !t.logic.config || !t._snapshot) return;
|
|
837
851
|
let n = t.logic.config;
|
|
@@ -842,23 +856,23 @@ var gt = () => {
|
|
|
842
856
|
try {
|
|
843
857
|
i = e.getSnapshot();
|
|
844
858
|
} catch (e) {
|
|
845
|
-
return
|
|
859
|
+
return Ct("Error:", e), r;
|
|
846
860
|
}
|
|
847
861
|
if (i) {
|
|
848
862
|
let e = i.context;
|
|
849
|
-
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r =
|
|
863
|
+
e && e.dbName && (r = e.dbName), e && e.modelNamePlural && (r = e.modelNamePlural), e && e.modelName && (r = Ae(e.modelName.toLowerCase()));
|
|
850
864
|
}
|
|
851
865
|
return r;
|
|
852
|
-
},
|
|
866
|
+
}, Ot = (e) => e?.logic?.config?.id === b.CLIENT_MANAGER, kt = (e) => {
|
|
853
867
|
let t = e?.getSnapshot();
|
|
854
|
-
if (
|
|
855
|
-
let n =
|
|
856
|
-
if (n &&
|
|
868
|
+
if (Ot(e)) return t?.status === "active" ? Pt(t.value) : 0;
|
|
869
|
+
let n = Et(e);
|
|
870
|
+
if (n && wt.includes(n)) return 100;
|
|
857
871
|
let r = e?.logic?.states;
|
|
858
872
|
if (!n || !r) return 0;
|
|
859
873
|
let i = Object.entries(r).filter(([, e]) => e.tags?.includes("loading")).map(([e]) => e), a = i.indexOf(n);
|
|
860
874
|
return a < 0 ? 0 : a / i.length * 100;
|
|
861
|
-
},
|
|
875
|
+
}, At = (e) => {
|
|
862
876
|
let [t, r] = c(0), a = n((t) => {
|
|
863
877
|
let n = e.subscribe({
|
|
864
878
|
next: t,
|
|
@@ -866,7 +880,7 @@ var gt = () => {
|
|
|
866
880
|
complete: t
|
|
867
881
|
});
|
|
868
882
|
return () => n.unsubscribe();
|
|
869
|
-
}, [e]), o = () =>
|
|
883
|
+
}, [e]), o = () => Et(e), s = l(a, o, o), u = n((t) => {
|
|
870
884
|
let n = e.getSnapshot().value;
|
|
871
885
|
n === "done" || n === "success" || n === "idle" || n === "ready" ? clearInterval(t) : r((e) => e + 1);
|
|
872
886
|
}, [e]), d = n(() => {
|
|
@@ -879,16 +893,16 @@ var gt = () => {
|
|
|
879
893
|
let e = d();
|
|
880
894
|
return () => clearInterval(e);
|
|
881
895
|
}, []), {
|
|
882
|
-
name:
|
|
896
|
+
name: Tt(e),
|
|
883
897
|
timeElapsed: t,
|
|
884
898
|
value: s,
|
|
885
|
-
percentComplete:
|
|
886
|
-
uniqueKey:
|
|
899
|
+
percentComplete: kt(e),
|
|
900
|
+
uniqueKey: Dt(e)
|
|
887
901
|
};
|
|
888
|
-
},
|
|
889
|
-
let { internalStatus: e } =
|
|
902
|
+
}, jt = () => {
|
|
903
|
+
let { internalStatus: e } = It();
|
|
890
904
|
return e === "ready";
|
|
891
|
-
},
|
|
905
|
+
}, Mt = () => {}, Nt = () => !1, Pt = (e) => {
|
|
892
906
|
switch (e) {
|
|
893
907
|
case m.IDLE: return 100;
|
|
894
908
|
case m.ADD_MODELS_TO_DB: return 90;
|
|
@@ -899,27 +913,27 @@ var gt = () => {
|
|
|
899
913
|
case m.PLATFORM_CLASSES_INIT: return 10;
|
|
900
914
|
default: return 0;
|
|
901
915
|
}
|
|
902
|
-
},
|
|
903
|
-
let e =
|
|
916
|
+
}, Ft = () => {
|
|
917
|
+
let e = Ne(), t = K((e) => e.status === "active" ? Pt(e.value) : 0);
|
|
904
918
|
return {
|
|
905
919
|
services: o(() => (e.uniqueKey = "clientManager", [e]), [e]),
|
|
906
920
|
percentComplete: t
|
|
907
921
|
};
|
|
908
|
-
},
|
|
909
|
-
status:
|
|
910
|
-
internalStatus:
|
|
911
|
-
}),
|
|
912
|
-
function
|
|
922
|
+
}, It = () => ({
|
|
923
|
+
status: K((e) => e.status === "active" ? e.value : "stopped"),
|
|
924
|
+
internalStatus: K((e) => e.status === "active" ? xt(e.value) ? "ready" : e.value : "stopped")
|
|
925
|
+
}), Lt = (e) => e instanceof Error ? e : Error(String(e));
|
|
926
|
+
function Rt(e) {
|
|
913
927
|
let t = s(null), r = s(0), [a, o] = c(!1), [l, u] = c(null), d = n(() => u(null), []), f = n((n) => {
|
|
914
928
|
let r = (t) => {
|
|
915
929
|
if (n.status === "error") {
|
|
916
|
-
let
|
|
917
|
-
u(
|
|
930
|
+
let r = ne(n) ?? t.context?._loadingError?.error;
|
|
931
|
+
u(r instanceof Error ? r : Error(e)), o(!1);
|
|
918
932
|
} else n.status === "ready" && (u(null), o(!1));
|
|
919
933
|
}, i = n.getService();
|
|
920
934
|
t.current = i.subscribe(r), r(i.getSnapshot());
|
|
921
935
|
}, [e]), p = n((e) => {
|
|
922
|
-
throw u(
|
|
936
|
+
throw u(Lt(e)), o(!1), e;
|
|
923
937
|
}, []), m = n(() => (t.current?.unsubscribe(), t.current = null, u(null), o(!0), ++r.current), []), h = n((e) => {
|
|
924
938
|
m();
|
|
925
939
|
let t;
|
|
@@ -959,11 +973,11 @@ function It(e) {
|
|
|
959
973
|
}
|
|
960
974
|
//#endregion
|
|
961
975
|
//#region src/schema.ts
|
|
962
|
-
var
|
|
963
|
-
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d =
|
|
976
|
+
var zt = R("seedSdk:react:schema"), Bt = (e) => {
|
|
977
|
+
let [t, r] = c(null), [a, o] = c(!!e), [s, l] = c(null), d = q(), f = n(async (e, t) => {
|
|
964
978
|
o(!0), l(null);
|
|
965
979
|
try {
|
|
966
|
-
if (!await
|
|
980
|
+
if (!await Vt(e)) {
|
|
967
981
|
if (!t.current) return;
|
|
968
982
|
r(null), o(!1);
|
|
969
983
|
return;
|
|
@@ -983,7 +997,7 @@ var Lt = z("seedSdk:react:schema"), Rt = (e) => {
|
|
|
983
997
|
};
|
|
984
998
|
a(i.getSnapshot()), t.subscription = i.subscribe(a);
|
|
985
999
|
} catch (e) {
|
|
986
|
-
if (
|
|
1000
|
+
if (zt("[useSchema] Error creating schema:", e), !t.current) return;
|
|
987
1001
|
l(e), r(null), o(!1);
|
|
988
1002
|
}
|
|
989
1003
|
}, []);
|
|
@@ -1010,25 +1024,25 @@ var Lt = z("seedSdk:react:schema"), Rt = (e) => {
|
|
|
1010
1024
|
error: s
|
|
1011
1025
|
};
|
|
1012
1026
|
};
|
|
1013
|
-
async function
|
|
1027
|
+
async function Vt(e) {
|
|
1014
1028
|
if (e === C) return !0;
|
|
1015
1029
|
let t = f.getAppDb();
|
|
1016
|
-
return !t || (await t.select({ id:
|
|
1030
|
+
return !t || (await t.select({ id: I.id }).from(I).where(ke(G(I.name, e), G(I.schemaFileId, e))).limit(1)).length > 0;
|
|
1017
1031
|
}
|
|
1018
|
-
var
|
|
1019
|
-
let e =
|
|
1020
|
-
queryKey:
|
|
1032
|
+
var Ht = ["seed", "schemas"], Ut = [], Wt = (e) => w.retain(e), Gt = () => {
|
|
1033
|
+
let e = q(), t = Ye(), r = s(void 0), a = s([]), { data: c = Ut, isLoading: l, error: u } = H({
|
|
1034
|
+
queryKey: Ht,
|
|
1021
1035
|
queryFn: () => w.all({ waitForReady: !0 }),
|
|
1022
1036
|
enabled: e
|
|
1023
1037
|
}, t);
|
|
1024
|
-
a.current = c,
|
|
1025
|
-
t.invalidateQueries({ queryKey:
|
|
1038
|
+
a.current = c, J(c, Wt, n(() => {
|
|
1039
|
+
t.invalidateQueries({ queryKey: Ht });
|
|
1026
1040
|
}, [t]));
|
|
1027
|
-
let d = e ? f.getAppDb() : null, p =
|
|
1041
|
+
let d = e ? f.getAppDb() : null, p = Y(o(() => d ? d.select().from(I).orderBy(I.name, Te(I.version)) : null, [d, e]));
|
|
1028
1042
|
return i(() => {
|
|
1029
1043
|
if (typeof BroadcastChannel > "u") return;
|
|
1030
1044
|
let e = new BroadcastChannel("seed-schemas-invalidate"), n = () => {
|
|
1031
|
-
t.invalidateQueries({ queryKey:
|
|
1045
|
+
t.invalidateQueries({ queryKey: Ht });
|
|
1032
1046
|
};
|
|
1033
1047
|
return e.addEventListener("message", n), () => {
|
|
1034
1048
|
e.removeEventListener("message", n), e.close();
|
|
@@ -1051,7 +1065,7 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1051
1065
|
let o = /* @__PURE__ */ new Set();
|
|
1052
1066
|
for (let e of p) e.name !== "Seed Protocol" && (e.schemaFileId ? o.add(e.schemaFileId) : e.name != null && e.version !== void 0 && o.add(`${e.name}:${e.version}`));
|
|
1053
1067
|
let s = i.size === o.size && [...i].every((e) => o.has(e)), c = i.size > 0 && o.size > 0 && [...o].some((e) => !i.has(e)), l = [...i].some((e) => !o.has(e));
|
|
1054
|
-
!s && (c || l) && t.invalidateQueries({ queryKey:
|
|
1068
|
+
!s && (c || l) && t.invalidateQueries({ queryKey: Ht });
|
|
1055
1069
|
}, [
|
|
1056
1070
|
e,
|
|
1057
1071
|
p,
|
|
@@ -1061,15 +1075,15 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1061
1075
|
isLoading: l,
|
|
1062
1076
|
error: u
|
|
1063
1077
|
};
|
|
1064
|
-
},
|
|
1065
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1078
|
+
}, Kt = () => {
|
|
1079
|
+
let { run: e, isLoading: t, error: r, resetError: i } = Rt("Failed to create schema");
|
|
1066
1080
|
return {
|
|
1067
1081
|
createSchema: n((t) => e(() => w.create(t, { waitForReady: !1 })), [e]),
|
|
1068
1082
|
isLoading: t,
|
|
1069
1083
|
error: r,
|
|
1070
1084
|
resetError: i
|
|
1071
1085
|
};
|
|
1072
|
-
},
|
|
1086
|
+
}, qt = () => {
|
|
1073
1087
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1074
1088
|
return {
|
|
1075
1089
|
destroy: n(async (e) => {
|
|
@@ -1088,10 +1102,10 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1088
1102
|
error: r,
|
|
1089
1103
|
resetError: n(() => i(null), [])
|
|
1090
1104
|
};
|
|
1091
|
-
},
|
|
1092
|
-
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a =
|
|
1105
|
+
}, Jt = () => {
|
|
1106
|
+
let [e, t] = c(), r = s(/* @__PURE__ */ new Map()), a = q(), o = n(async () => {
|
|
1093
1107
|
if (a) try {
|
|
1094
|
-
let e = await
|
|
1108
|
+
let e = await ce(), n = /* @__PURE__ */ new Set();
|
|
1095
1109
|
for (let t of e) {
|
|
1096
1110
|
let e = t.schema.metadata?.name;
|
|
1097
1111
|
e && n.add(e);
|
|
@@ -1110,7 +1124,7 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1110
1124
|
for (let [e, t] of r.current.entries()) n.has(e) || t.unload();
|
|
1111
1125
|
r.current = i, t(Array.from(i.values()));
|
|
1112
1126
|
} catch (e) {
|
|
1113
|
-
|
|
1127
|
+
zt("Error fetching all schema versions from database:", e), t(null);
|
|
1114
1128
|
}
|
|
1115
1129
|
}, [a]);
|
|
1116
1130
|
return i(() => {
|
|
@@ -1120,20 +1134,20 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1120
1134
|
e.unload();
|
|
1121
1135
|
}), r.current.clear();
|
|
1122
1136
|
}, []), e;
|
|
1123
|
-
},
|
|
1137
|
+
}, Yt = () => Bt(C), Xt = (e) => [
|
|
1124
1138
|
"seed",
|
|
1125
1139
|
"models",
|
|
1126
1140
|
e
|
|
1127
|
-
],
|
|
1128
|
-
let t =
|
|
1141
|
+
], Zt = [], Qt = (e) => x.retain(e), $t = (e) => e.getService().getSnapshot().status === "active", en = (e) => {
|
|
1142
|
+
let t = q(), r = Ye(), a = s(null), c = o(() => Xt(e), [e]), { data: l = Zt, isLoading: u, error: d } = H({
|
|
1129
1143
|
queryKey: c,
|
|
1130
1144
|
queryFn: async () => {
|
|
1131
1145
|
let t = await x.all(e, { waitForReady: !1 }), n = r.getQueryData(c), i = a.current;
|
|
1132
|
-
return t.length === 0 && n && n.length > 0 && n.every(
|
|
1146
|
+
return t.length === 0 && n && n.length > 0 && n.every($t) && (!i || i.size > 0) ? n : t;
|
|
1133
1147
|
},
|
|
1134
1148
|
enabled: t && !!e
|
|
1135
|
-
}, r), p = e ? l :
|
|
1136
|
-
m.current = p,
|
|
1149
|
+
}, r), p = e ? l : Zt, m = s(p);
|
|
1150
|
+
m.current = p, J(p, Qt, n(() => {
|
|
1137
1151
|
r.invalidateQueries({ queryKey: c });
|
|
1138
1152
|
}, [r, c])), i(() => {
|
|
1139
1153
|
if (!e || typeof BroadcastChannel > "u") return;
|
|
@@ -1153,11 +1167,11 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1153
1167
|
function _() {
|
|
1154
1168
|
let t = f.getAppDb();
|
|
1155
1169
|
return !t || !e ? null : t.select({
|
|
1156
|
-
modelFileId:
|
|
1157
|
-
modelName:
|
|
1158
|
-
}).from(
|
|
1170
|
+
modelFileId: de.schemaFileId,
|
|
1171
|
+
modelName: de.name
|
|
1172
|
+
}).from(I).innerJoin(ue, G(I.id, ue.schemaId)).innerJoin(de, G(ue.modelId, de.id)).where(ke(G(I.schemaFileId, e), G(I.name, e)));
|
|
1159
1173
|
}
|
|
1160
|
-
let v =
|
|
1174
|
+
let v = Y(o(() => {
|
|
1161
1175
|
if (!e || !t) return null;
|
|
1162
1176
|
let n = {
|
|
1163
1177
|
schemaId: e,
|
|
@@ -1188,8 +1202,8 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1188
1202
|
isLoading: u,
|
|
1189
1203
|
error: d
|
|
1190
1204
|
};
|
|
1191
|
-
},
|
|
1192
|
-
let r =
|
|
1205
|
+
}, tn = (e, t) => {
|
|
1206
|
+
let r = q(), [a, l] = c(void 0), [u, d] = c(!1), [f, p] = c(null), m = s(void 0), [, h] = c(0), [g, _] = c(0), v = t == null;
|
|
1193
1207
|
i(() => {
|
|
1194
1208
|
!r || !v || !e ? (l(void 0), d(!1), p(null)) : (async () => {
|
|
1195
1209
|
try {
|
|
@@ -1207,8 +1221,8 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1207
1221
|
g
|
|
1208
1222
|
]);
|
|
1209
1223
|
let y = n(() => _((e) => e + 1), []);
|
|
1210
|
-
|
|
1211
|
-
let { models: b, isLoading: S, error: C } =
|
|
1224
|
+
J(o(() => a ? [a] : Zt, [a]), Qt, y);
|
|
1225
|
+
let { models: b, isLoading: S, error: C } = en(v ? null : e), w = o(() => {
|
|
1212
1226
|
if (!v && t) return b.find((e) => (e.modelName ?? e.name) === t);
|
|
1213
1227
|
}, [
|
|
1214
1228
|
v,
|
|
@@ -1230,8 +1244,8 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1230
1244
|
isLoading: S,
|
|
1231
1245
|
error: C
|
|
1232
1246
|
};
|
|
1233
|
-
},
|
|
1234
|
-
let { run: e, isLoading: t, error: r, resetError: i } =
|
|
1247
|
+
}, nn = () => {
|
|
1248
|
+
let { run: e, isLoading: t, error: r, resetError: i } = Rt("Failed to create model");
|
|
1235
1249
|
return {
|
|
1236
1250
|
create: n((t, n, r) => e(() => x.create(n, t, {
|
|
1237
1251
|
...r,
|
|
@@ -1241,7 +1255,7 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1241
1255
|
error: r,
|
|
1242
1256
|
resetError: i
|
|
1243
1257
|
};
|
|
1244
|
-
},
|
|
1258
|
+
}, rn = () => {
|
|
1245
1259
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1246
1260
|
return {
|
|
1247
1261
|
destroy: n(async (e) => {
|
|
@@ -1260,34 +1274,30 @@ var Bt = ["seed", "schemas"], Vt = [], Ht = (e) => w.retain(e), Ut = () => {
|
|
|
1260
1274
|
error: r,
|
|
1261
1275
|
resetError: n(() => i(null), [])
|
|
1262
1276
|
};
|
|
1263
|
-
},
|
|
1264
|
-
async function
|
|
1277
|
+
}, an = [], on = (e) => S.retain(e);
|
|
1278
|
+
async function sn(e) {
|
|
1265
1279
|
let t = f.getAppDb();
|
|
1266
|
-
if (t) {
|
|
1267
|
-
let n = await t.select({ name: L.name }).from(L).where(Oe(K(L.name, e), K(L.schemaFileId, e))).limit(1);
|
|
1268
|
-
if (n[0]?.name) return n[0].name;
|
|
1269
|
-
}
|
|
1270
|
-
return ie(e) ?? e;
|
|
1280
|
+
if (t) return (await t.select({ name: I.name }).from(I).where(ke(G(I.name, e), G(I.schemaFileId, e))).limit(1))[0]?.name ?? void 0;
|
|
1271
1281
|
}
|
|
1272
|
-
var
|
|
1273
|
-
let { model: r } =
|
|
1282
|
+
var cn = (e, t) => {
|
|
1283
|
+
let { model: r } = tn(e, t), a = q(), c = Ye(), l = dn(r), u = r?.id, d = o(() => [
|
|
1274
1284
|
"seed",
|
|
1275
1285
|
"modelProperties",
|
|
1276
1286
|
u ?? ""
|
|
1277
|
-
], [u]), { data: p =
|
|
1287
|
+
], [u]), { data: p = an, isLoading: m, error: h } = H({
|
|
1278
1288
|
queryKey: d,
|
|
1279
1289
|
queryFn: () => S.all(u, { waitForReady: !0 }),
|
|
1280
1290
|
enabled: a && !!u
|
|
1281
1291
|
}, c);
|
|
1282
|
-
|
|
1292
|
+
J(p, on, n(() => {
|
|
1283
1293
|
c.invalidateQueries({ queryKey: d });
|
|
1284
1294
|
}, [c, d]));
|
|
1285
|
-
let g = a ? f.getAppDb() : null, _ =
|
|
1286
|
-
id:
|
|
1287
|
-
name:
|
|
1288
|
-
dataType:
|
|
1289
|
-
schemaFileId:
|
|
1290
|
-
}).from(
|
|
1295
|
+
let g = a ? f.getAppDb() : null, _ = Y(o(() => !g || !l ? null : g.select({
|
|
1296
|
+
id: P.id,
|
|
1297
|
+
name: P.name,
|
|
1298
|
+
dataType: P.dataType,
|
|
1299
|
+
schemaFileId: P.schemaFileId
|
|
1300
|
+
}).from(P).where(G(P.modelId, l)), [
|
|
1291
1301
|
g,
|
|
1292
1302
|
a,
|
|
1293
1303
|
l
|
|
@@ -1328,39 +1338,39 @@ var on = (e, t) => {
|
|
|
1328
1338
|
isLoading: m && p.length === 0,
|
|
1329
1339
|
error: h
|
|
1330
1340
|
};
|
|
1331
|
-
},
|
|
1341
|
+
}, ln = [
|
|
1332
1342
|
400,
|
|
1333
1343
|
1200,
|
|
1334
1344
|
2500
|
|
1335
|
-
],
|
|
1345
|
+
], un = (e) => {
|
|
1336
1346
|
if (e) try {
|
|
1337
1347
|
return e._getSnapshotContext()._dbId;
|
|
1338
1348
|
} catch {
|
|
1339
1349
|
return;
|
|
1340
1350
|
}
|
|
1341
|
-
},
|
|
1342
|
-
let [t, n] = c(() =>
|
|
1351
|
+
}, dn = (e) => {
|
|
1352
|
+
let [t, n] = c(() => un(e));
|
|
1343
1353
|
return i(() => {
|
|
1344
|
-
if (n(
|
|
1345
|
-
let t = e.getService().subscribe(() => n(
|
|
1354
|
+
if (n(un(e)), !e) return;
|
|
1355
|
+
let t = e.getService().subscribe(() => n(un(e)));
|
|
1346
1356
|
return () => t.unsubscribe();
|
|
1347
1357
|
}, [e]), t;
|
|
1348
|
-
},
|
|
1358
|
+
}, fn = async (e, t) => {
|
|
1349
1359
|
let n = await x.createById(e);
|
|
1350
1360
|
if (!n) return;
|
|
1351
1361
|
let r = n.modelName ?? n.name;
|
|
1352
|
-
if (r) return
|
|
1362
|
+
if (r) return ae(r, t, {
|
|
1353
1363
|
modelFileId: e,
|
|
1354
1364
|
schemaName: n.schemaName
|
|
1355
1365
|
});
|
|
1356
1366
|
};
|
|
1357
|
-
function
|
|
1367
|
+
function pn(...e) {
|
|
1358
1368
|
let [t, r, a] = e, l = Math.min(e.length, 3), d = o(() => l === 3 ? !!(t && r && a) : l === 2 ? !!(t && r) : !!t, [
|
|
1359
1369
|
l,
|
|
1360
1370
|
t,
|
|
1361
1371
|
r,
|
|
1362
1372
|
a
|
|
1363
|
-
]), [f, p] = c(void 0), [m, h] = c(d), [g, _] = c(null), v = s(void 0), y =
|
|
1373
|
+
]), [f, p] = c(void 0), [m, h] = c(d), [g, _] = c(null), v = s(void 0), y = q(), b = o(() => l === 3 ? {
|
|
1364
1374
|
type: "schemaId",
|
|
1365
1375
|
schemaId: t,
|
|
1366
1376
|
modelName: r,
|
|
@@ -1398,7 +1408,7 @@ function dn(...e) {
|
|
|
1398
1408
|
p(void 0), h(!1), _(null);
|
|
1399
1409
|
return;
|
|
1400
1410
|
}
|
|
1401
|
-
t = await
|
|
1411
|
+
t = await fn(b.modelFileId, b.propertyName);
|
|
1402
1412
|
let e = await x.createById(b.modelFileId);
|
|
1403
1413
|
n = e?.modelName ?? e?.name;
|
|
1404
1414
|
} else {
|
|
@@ -1406,8 +1416,8 @@ function dn(...e) {
|
|
|
1406
1416
|
p(void 0), h(!1), _(null);
|
|
1407
1417
|
return;
|
|
1408
1418
|
}
|
|
1409
|
-
let e = await
|
|
1410
|
-
t = await
|
|
1419
|
+
let e = await sn(b.schemaId);
|
|
1420
|
+
t = e ? await ae(b.modelName, b.propertyName, { schemaName: e }) : void 0, n = b.modelName;
|
|
1411
1421
|
}
|
|
1412
1422
|
if (t && n) {
|
|
1413
1423
|
let e = S.create({
|
|
@@ -1434,11 +1444,11 @@ function dn(...e) {
|
|
|
1434
1444
|
C ? w() : (p(void 0), h(!1), _(null));
|
|
1435
1445
|
}, [C, w]);
|
|
1436
1446
|
let T = n(() => void w({ quiet: !0 }), [w]);
|
|
1437
|
-
|
|
1447
|
+
J(o(() => f ? [f] : an, [f]), on, T);
|
|
1438
1448
|
let ee = s(!1);
|
|
1439
1449
|
ee.current = m || !!f || !!g, i(() => {
|
|
1440
1450
|
if (!C || b.type === "propertyFileId") return;
|
|
1441
|
-
let e =
|
|
1451
|
+
let e = ln.map((e) => setTimeout(() => {
|
|
1442
1452
|
ee.current || w({ quiet: !0 });
|
|
1443
1453
|
}, e));
|
|
1444
1454
|
return () => e.forEach((e) => clearTimeout(e));
|
|
@@ -1451,7 +1461,7 @@ function dn(...e) {
|
|
|
1451
1461
|
return i(() => {
|
|
1452
1462
|
if (!f || !E) return;
|
|
1453
1463
|
v.current?.unsubscribe();
|
|
1454
|
-
let e =
|
|
1464
|
+
let e = ye(w, 100), t = f.getService().subscribe(() => {
|
|
1455
1465
|
e();
|
|
1456
1466
|
});
|
|
1457
1467
|
return v.current = t, () => {
|
|
@@ -1467,12 +1477,13 @@ function dn(...e) {
|
|
|
1467
1477
|
error: g
|
|
1468
1478
|
};
|
|
1469
1479
|
}
|
|
1470
|
-
var
|
|
1471
|
-
let { runAsync: e, isLoading: t, error: r, resetError: i } =
|
|
1480
|
+
var mn = () => {
|
|
1481
|
+
let { runAsync: e, isLoading: t, error: r, resetError: i } = Rt("Failed to create model property");
|
|
1472
1482
|
return {
|
|
1473
1483
|
create: n((t, n, r) => e(async () => {
|
|
1474
1484
|
if (!n || !r.name || !r.dataType) throw Error("modelName, property name and dataType are required");
|
|
1475
|
-
let e = await
|
|
1485
|
+
let e = await sn(t);
|
|
1486
|
+
if (!e) throw Error(`No stored schema has the name or schema file id "${t}"`);
|
|
1476
1487
|
return S.create({
|
|
1477
1488
|
...r,
|
|
1478
1489
|
modelName: n
|
|
@@ -1485,7 +1496,7 @@ var fn = () => {
|
|
|
1485
1496
|
error: r,
|
|
1486
1497
|
resetError: i
|
|
1487
1498
|
};
|
|
1488
|
-
},
|
|
1499
|
+
}, hn = () => {
|
|
1489
1500
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1490
1501
|
return {
|
|
1491
1502
|
destroy: n(async (e) => {
|
|
@@ -1504,7 +1515,7 @@ var fn = () => {
|
|
|
1504
1515
|
error: r,
|
|
1505
1516
|
resetError: n(() => i(null), [])
|
|
1506
1517
|
};
|
|
1507
|
-
},
|
|
1518
|
+
}, gn = () => {
|
|
1508
1519
|
let [e, t] = c(!1), [r, i] = c(null);
|
|
1509
1520
|
return {
|
|
1510
1521
|
deleteItem: n(async (e) => {
|
|
@@ -1523,18 +1534,18 @@ var fn = () => {
|
|
|
1523
1534
|
error: r,
|
|
1524
1535
|
resetError: n(() => i(null), [])
|
|
1525
1536
|
};
|
|
1526
|
-
},
|
|
1527
|
-
function
|
|
1528
|
-
let e =
|
|
1529
|
-
queryKey:
|
|
1537
|
+
}, _n = ["seed", "imageFiles"];
|
|
1538
|
+
function vn() {
|
|
1539
|
+
let e = q(), t = Ye(), { data: n = [], isLoading: r, error: a, refetch: o } = H({
|
|
1540
|
+
queryKey: _n,
|
|
1530
1541
|
queryFn: () => p.listImageFiles(),
|
|
1531
1542
|
enabled: e
|
|
1532
1543
|
}, t);
|
|
1533
1544
|
return i(() => {
|
|
1534
1545
|
let e = (e) => {
|
|
1535
|
-
e.includes("/images/") && t.invalidateQueries({ queryKey:
|
|
1546
|
+
e.includes("/images/") && t.invalidateQueries({ queryKey: _n });
|
|
1536
1547
|
}, n = (e) => {
|
|
1537
|
-
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey:
|
|
1548
|
+
e.some((e) => e.includes("/images/")) && t.invalidateQueries({ queryKey: _n });
|
|
1538
1549
|
};
|
|
1539
1550
|
return D.on("file-saved", e), D.on(g, n), () => {
|
|
1540
1551
|
D.off("file-saved", e), D.off(g, n);
|
|
@@ -1548,9 +1559,9 @@ function gn() {
|
|
|
1548
1559
|
}
|
|
1549
1560
|
//#endregion
|
|
1550
1561
|
//#region src/useFiles.ts
|
|
1551
|
-
var
|
|
1552
|
-
function
|
|
1553
|
-
let t =
|
|
1562
|
+
var yn = ["seed", "files"];
|
|
1563
|
+
function bn(e = "files") {
|
|
1564
|
+
let t = q(), n = Ye(), r = o(() => [...yn, e], [e]), { data: a = [], isLoading: s, error: c, refetch: l } = H({
|
|
1554
1565
|
queryKey: r,
|
|
1555
1566
|
queryFn: () => p.listFiles(e),
|
|
1556
1567
|
enabled: t
|
|
@@ -1577,28 +1588,28 @@ function vn(e = "files") {
|
|
|
1577
1588
|
}
|
|
1578
1589
|
//#endregion
|
|
1579
1590
|
//#region src/useEasSyncProcesses.ts
|
|
1580
|
-
function
|
|
1581
|
-
return
|
|
1591
|
+
function xn() {
|
|
1592
|
+
return q() ? f.getAppDb() : null;
|
|
1582
1593
|
}
|
|
1583
|
-
function
|
|
1584
|
-
let e =
|
|
1585
|
-
return o(() => e ? e.select().from(E).orderBy(
|
|
1594
|
+
function Sn() {
|
|
1595
|
+
let e = xn();
|
|
1596
|
+
return o(() => e ? e.select().from(E).orderBy(Te(E.startedAt)) : null, [e]);
|
|
1586
1597
|
}
|
|
1587
|
-
function
|
|
1588
|
-
let e =
|
|
1598
|
+
function Cn() {
|
|
1599
|
+
let e = Y(Sn());
|
|
1589
1600
|
return {
|
|
1590
1601
|
records: e,
|
|
1591
1602
|
nonActiveCount: o(() => e === void 0 ? void 0 : e.filter((e) => e.status !== "in_progress").length, [e])
|
|
1592
1603
|
};
|
|
1593
1604
|
}
|
|
1594
|
-
function
|
|
1595
|
-
return
|
|
1605
|
+
function wn() {
|
|
1606
|
+
return Y(Sn());
|
|
1596
1607
|
}
|
|
1597
|
-
function
|
|
1598
|
-
return
|
|
1608
|
+
function Tn() {
|
|
1609
|
+
return Cn().nonActiveCount;
|
|
1599
1610
|
}
|
|
1600
|
-
function
|
|
1601
|
-
let t =
|
|
1611
|
+
function En(e) {
|
|
1612
|
+
let t = xn(), 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);
|
|
1602
1613
|
return {
|
|
1603
1614
|
record: n && n.length > 0 ? n[0] : null,
|
|
1604
1615
|
isLoading: r
|
|
@@ -1606,13 +1617,13 @@ function wn(e) {
|
|
|
1606
1617
|
}
|
|
1607
1618
|
//#endregion
|
|
1608
1619
|
//#region src/SeedProvider.tsx
|
|
1609
|
-
var
|
|
1610
|
-
function
|
|
1611
|
-
return Promise.resolve(
|
|
1620
|
+
var Dn = null;
|
|
1621
|
+
function On(e) {
|
|
1622
|
+
return Promise.resolve(Dn?.(e));
|
|
1612
1623
|
}
|
|
1613
|
-
function
|
|
1624
|
+
function kn({ queryClient: e }) {
|
|
1614
1625
|
return i(() => {
|
|
1615
|
-
|
|
1626
|
+
Dn = (t) => e.invalidateQueries({ queryKey: [
|
|
1616
1627
|
"seed",
|
|
1617
1628
|
"itemProperties",
|
|
1618
1629
|
t
|
|
@@ -1624,11 +1635,11 @@ function Dn({ queryClient: e }) {
|
|
|
1624
1635
|
});
|
|
1625
1636
|
};
|
|
1626
1637
|
return D.on(h, t), () => {
|
|
1627
|
-
D.off(h, t),
|
|
1638
|
+
D.off(h, t), Dn = null;
|
|
1628
1639
|
};
|
|
1629
1640
|
}, [e]), null;
|
|
1630
1641
|
}
|
|
1631
|
-
function
|
|
1642
|
+
function An({ config: e, addresses: t, onInitError: n }) {
|
|
1632
1643
|
let r = s(n);
|
|
1633
1644
|
r.current = n;
|
|
1634
1645
|
let a = s(t);
|
|
@@ -1644,8 +1655,8 @@ function On({ config: e, addresses: t, onInitError: n }) {
|
|
|
1644
1655
|
});
|
|
1645
1656
|
}, [e, o]), null;
|
|
1646
1657
|
}
|
|
1647
|
-
function
|
|
1648
|
-
let s = o(() => i ??
|
|
1658
|
+
function jn({ children: e, config: t, addresses: n, onInitError: r, queryClient: i, queryClientRef: a }) {
|
|
1659
|
+
let s = o(() => i ?? X(), [i]);
|
|
1649
1660
|
if (a && (a.current = s, typeof window < "u")) {
|
|
1650
1661
|
let e = window;
|
|
1651
1662
|
e.__TEST_SEED_QUERY_CLIENT__ = s;
|
|
@@ -1653,13 +1664,13 @@ function kn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1653
1664
|
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = s);
|
|
1654
1665
|
} catch {}
|
|
1655
1666
|
}
|
|
1656
|
-
return /* @__PURE__ */
|
|
1667
|
+
return /* @__PURE__ */ B(we, {
|
|
1657
1668
|
client: s,
|
|
1658
|
-
children: /* @__PURE__ */
|
|
1669
|
+
children: /* @__PURE__ */ V(Re, {
|
|
1659
1670
|
queryClient: s,
|
|
1660
1671
|
children: [
|
|
1661
|
-
/* @__PURE__ */
|
|
1662
|
-
t && /* @__PURE__ */
|
|
1672
|
+
/* @__PURE__ */ B(kn, { queryClient: s }),
|
|
1673
|
+
t && /* @__PURE__ */ B(An, {
|
|
1663
1674
|
config: t,
|
|
1664
1675
|
addresses: n,
|
|
1665
1676
|
onInitError: r
|
|
@@ -1671,8 +1682,8 @@ function kn({ children: e, config: t, addresses: n, onInitError: r, queryClient:
|
|
|
1671
1682
|
}
|
|
1672
1683
|
//#endregion
|
|
1673
1684
|
//#region src/SeedClientGate.tsx
|
|
1674
|
-
function
|
|
1675
|
-
return /* @__PURE__ */
|
|
1685
|
+
function Mn() {
|
|
1686
|
+
return /* @__PURE__ */ B("div", {
|
|
1676
1687
|
style: {
|
|
1677
1688
|
display: "flex",
|
|
1678
1689
|
alignItems: "center",
|
|
@@ -1683,21 +1694,21 @@ function An() {
|
|
|
1683
1694
|
children: "Loading..."
|
|
1684
1695
|
});
|
|
1685
1696
|
}
|
|
1686
|
-
function
|
|
1697
|
+
function Nn(e) {
|
|
1687
1698
|
try {
|
|
1688
1699
|
return JSON.stringify(e ?? null);
|
|
1689
1700
|
} catch {
|
|
1690
1701
|
return e;
|
|
1691
1702
|
}
|
|
1692
1703
|
}
|
|
1693
|
-
function
|
|
1694
|
-
let l =
|
|
1704
|
+
function Pn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r, loadingClassName: a, onInitError: o, children: c }) {
|
|
1705
|
+
let l = q(), u = s(o);
|
|
1695
1706
|
u.current = o;
|
|
1696
1707
|
let d = s(e);
|
|
1697
1708
|
d.current = e;
|
|
1698
1709
|
let f = s(t);
|
|
1699
1710
|
f.current = t;
|
|
1700
|
-
let p =
|
|
1711
|
+
let p = Nn(e), m = Nn(t);
|
|
1701
1712
|
i(() => {
|
|
1702
1713
|
let e = d.current, t = f.current, n = t ? {
|
|
1703
1714
|
...e,
|
|
@@ -1710,7 +1721,7 @@ function Mn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1710
1721
|
u.current ? u.current(e) : console.error("[SeedClientGate] client init failed", e);
|
|
1711
1722
|
});
|
|
1712
1723
|
}, [p, m]);
|
|
1713
|
-
let h = n ?? /* @__PURE__ */
|
|
1724
|
+
let h = n ?? /* @__PURE__ */ B(Mn, {}), g = r ? void 0 : {
|
|
1714
1725
|
position: "relative",
|
|
1715
1726
|
display: "flex",
|
|
1716
1727
|
height: "100vh",
|
|
@@ -1725,15 +1736,15 @@ function Mn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1725
1736
|
justifyContent: "center"
|
|
1726
1737
|
}
|
|
1727
1738
|
};
|
|
1728
|
-
return /* @__PURE__ */
|
|
1739
|
+
return /* @__PURE__ */ V("div", {
|
|
1729
1740
|
className: r,
|
|
1730
1741
|
style: g,
|
|
1731
|
-
children: [/* @__PURE__ */
|
|
1742
|
+
children: [/* @__PURE__ */ B("div", {
|
|
1732
1743
|
className: a,
|
|
1733
1744
|
style: _,
|
|
1734
1745
|
"aria-hidden": l,
|
|
1735
1746
|
children: h
|
|
1736
|
-
}), /* @__PURE__ */
|
|
1747
|
+
}), /* @__PURE__ */ B("div", {
|
|
1737
1748
|
style: {
|
|
1738
1749
|
flex: 1,
|
|
1739
1750
|
display: l ? "flex" : "none",
|
|
@@ -1745,54 +1756,54 @@ function Mn({ initConfig: e, schema: t, loadingComponent: n, wrapperClassName: r
|
|
|
1745
1756
|
}
|
|
1746
1757
|
//#endregion
|
|
1747
1758
|
//#region src/opfsPaths.ts
|
|
1748
|
-
function
|
|
1759
|
+
function Fn(e) {
|
|
1749
1760
|
let t = e.split("/").filter(Boolean);
|
|
1750
1761
|
if (t.length === 0) throw Error(`Invalid OPFS path: "${e}"`);
|
|
1751
1762
|
return t;
|
|
1752
1763
|
}
|
|
1753
|
-
async function
|
|
1764
|
+
async function In(e, t) {
|
|
1754
1765
|
let n = t ?? await navigator.storage.getDirectory();
|
|
1755
1766
|
for (let t of e.split("/").filter(Boolean)) n = await n.getDirectoryHandle(t);
|
|
1756
1767
|
return n;
|
|
1757
1768
|
}
|
|
1758
|
-
async function
|
|
1759
|
-
let n =
|
|
1769
|
+
async function Ln(e, t) {
|
|
1770
|
+
let n = Fn(e), r = n.pop();
|
|
1760
1771
|
return {
|
|
1761
|
-
dir: await
|
|
1772
|
+
dir: await In(n.join("/"), t),
|
|
1762
1773
|
name: r
|
|
1763
1774
|
};
|
|
1764
1775
|
}
|
|
1765
|
-
async function
|
|
1766
|
-
let { dir: n, name: r } = await
|
|
1776
|
+
async function Rn(e, t) {
|
|
1777
|
+
let { dir: n, name: r } = await Ln(e, t);
|
|
1767
1778
|
return n.getFileHandle(r);
|
|
1768
1779
|
}
|
|
1769
|
-
async function
|
|
1770
|
-
return (await
|
|
1780
|
+
async function zn(e, t) {
|
|
1781
|
+
return (await Rn(e, t)).getFile();
|
|
1771
1782
|
}
|
|
1772
|
-
async function
|
|
1773
|
-
let { dir: n, name: r } = await
|
|
1783
|
+
async function Bn(e, t) {
|
|
1784
|
+
let { dir: n, name: r } = await Ln(e, t);
|
|
1774
1785
|
await n.removeEntry(r);
|
|
1775
1786
|
}
|
|
1776
|
-
async function
|
|
1787
|
+
async function Vn(e, t) {
|
|
1777
1788
|
let n = await e.getDirectoryHandle(t), r = [];
|
|
1778
1789
|
for await (let e of n.entries()) r.push(e);
|
|
1779
1790
|
let i = !0;
|
|
1780
|
-
for (let [e, t] of r) (t.kind === "file" || !await
|
|
1791
|
+
for (let [e, t] of r) (t.kind === "file" || !await Vn(n, e)) && (i = !1);
|
|
1781
1792
|
return i && await e.removeEntry(t), i;
|
|
1782
1793
|
}
|
|
1783
|
-
async function
|
|
1794
|
+
async function Hn(e, t) {
|
|
1784
1795
|
try {
|
|
1785
|
-
let { dir: n, name: r } = await
|
|
1786
|
-
return await
|
|
1796
|
+
let { dir: n, name: r } = await Ln(e, t);
|
|
1797
|
+
return await Vn(n, r);
|
|
1787
1798
|
} catch (e) {
|
|
1788
1799
|
if (e instanceof DOMException && e.name === "NotFoundError") return !0;
|
|
1789
1800
|
throw e;
|
|
1790
1801
|
}
|
|
1791
1802
|
}
|
|
1792
|
-
function
|
|
1803
|
+
function Un() {
|
|
1793
1804
|
return typeof navigator < "u" && !!navigator.storage && typeof navigator.storage.getDirectory == "function";
|
|
1794
1805
|
}
|
|
1795
|
-
var
|
|
1806
|
+
var Wn = [
|
|
1796
1807
|
{
|
|
1797
1808
|
type: "image/jpeg",
|
|
1798
1809
|
test: (e) => e[0] === 255 && e[1] === 216 && e[2] === 255
|
|
@@ -1803,43 +1814,43 @@ var Hn = [
|
|
|
1803
1814
|
},
|
|
1804
1815
|
{
|
|
1805
1816
|
type: "image/gif",
|
|
1806
|
-
test: (e) =>
|
|
1817
|
+
test: (e) => Gn(e, 0, 4) === "GIF8"
|
|
1807
1818
|
},
|
|
1808
1819
|
{
|
|
1809
1820
|
type: "image/webp",
|
|
1810
|
-
test: (e) =>
|
|
1821
|
+
test: (e) => Gn(e, 0, 4) === "RIFF" && Gn(e, 8, 12) === "WEBP"
|
|
1811
1822
|
},
|
|
1812
1823
|
{
|
|
1813
1824
|
type: "image/avif",
|
|
1814
|
-
test: (e) =>
|
|
1825
|
+
test: (e) => Gn(e, 4, 8) === "ftyp" && ["avif", "avis"].includes(Gn(e, 8, 12))
|
|
1815
1826
|
},
|
|
1816
1827
|
{
|
|
1817
1828
|
type: "application/vnd.sqlite3",
|
|
1818
|
-
test: (e) =>
|
|
1829
|
+
test: (e) => Gn(e, 0, 15) === "SQLite format 3"
|
|
1819
1830
|
},
|
|
1820
1831
|
{
|
|
1821
1832
|
type: "application/pdf",
|
|
1822
|
-
test: (e) =>
|
|
1833
|
+
test: (e) => Gn(e, 0, 5) === "%PDF-"
|
|
1823
1834
|
}
|
|
1824
1835
|
];
|
|
1825
|
-
function
|
|
1836
|
+
function Gn(e, t, n) {
|
|
1826
1837
|
return String.fromCharCode(...e.subarray(t, n));
|
|
1827
1838
|
}
|
|
1828
|
-
function
|
|
1829
|
-
return
|
|
1839
|
+
function Kn(e) {
|
|
1840
|
+
return Wn.find((t) => t.test(e))?.type;
|
|
1830
1841
|
}
|
|
1831
|
-
async function
|
|
1832
|
-
if (e.size !== 0) return
|
|
1842
|
+
async function qn(e) {
|
|
1843
|
+
if (e.size !== 0) return Kn(new Uint8Array(await e.slice(0, 16).arrayBuffer()));
|
|
1833
1844
|
}
|
|
1834
1845
|
//#endregion
|
|
1835
1846
|
//#region src/useOPFSFiles.ts
|
|
1836
|
-
async function
|
|
1847
|
+
async function Jn(e, t = "") {
|
|
1837
1848
|
let n = [];
|
|
1838
1849
|
try {
|
|
1839
1850
|
for await (let [r, i] of e.entries()) {
|
|
1840
1851
|
let e = t ? `${t}/${r}` : r;
|
|
1841
1852
|
if (i.kind === "file") try {
|
|
1842
|
-
let t = await i.getFile(), a = t.type ? void 0 : await
|
|
1853
|
+
let t = await i.getFile(), a = t.type ? void 0 : await qn(t).catch(() => void 0);
|
|
1843
1854
|
n.push({
|
|
1844
1855
|
name: r,
|
|
1845
1856
|
path: e,
|
|
@@ -1852,7 +1863,7 @@ async function Kn(e, t = "") {
|
|
|
1852
1863
|
console.warn(`Failed to read file ${e}:`, t);
|
|
1853
1864
|
}
|
|
1854
1865
|
else if (i.kind === "directory") {
|
|
1855
|
-
let t = await
|
|
1866
|
+
let t = await Jn(i, e);
|
|
1856
1867
|
n.push(...t);
|
|
1857
1868
|
}
|
|
1858
1869
|
}
|
|
@@ -1861,11 +1872,11 @@ async function Kn(e, t = "") {
|
|
|
1861
1872
|
}
|
|
1862
1873
|
return n;
|
|
1863
1874
|
}
|
|
1864
|
-
function
|
|
1875
|
+
function Yn(e = {}) {
|
|
1865
1876
|
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 () => {
|
|
1866
1877
|
s(!0), f(null), m(null);
|
|
1867
1878
|
try {
|
|
1868
|
-
let e = await
|
|
1879
|
+
let e = await Jn(await In(t ?? ""), t || "");
|
|
1869
1880
|
a(e.sort((e, t) => e.path.localeCompare(t.path)));
|
|
1870
1881
|
} catch (e) {
|
|
1871
1882
|
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);
|
|
@@ -1886,96 +1897,96 @@ function qn(e = {}) {
|
|
|
1886
1897
|
}
|
|
1887
1898
|
//#endregion
|
|
1888
1899
|
//#region src/OPFSFilesManager/format.ts
|
|
1889
|
-
var
|
|
1900
|
+
var Xn = [
|
|
1890
1901
|
"B",
|
|
1891
1902
|
"KB",
|
|
1892
1903
|
"MB",
|
|
1893
1904
|
"GB",
|
|
1894
1905
|
"TB"
|
|
1895
1906
|
];
|
|
1896
|
-
function
|
|
1907
|
+
function Z(e) {
|
|
1897
1908
|
if (!Number.isFinite(e) || e <= 0) return "0 B";
|
|
1898
|
-
let t = Math.min(
|
|
1899
|
-
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${
|
|
1909
|
+
let t = Math.min(Xn.length - 1, Math.floor(Math.log(e) / Math.log(1024))), n = e / 1024 ** t;
|
|
1910
|
+
return `${t === 0 ? n : n < 10 ? Math.round(n * 10) / 10 : Math.round(n)} ${Xn[t]}`;
|
|
1900
1911
|
}
|
|
1901
|
-
var
|
|
1902
|
-
function
|
|
1912
|
+
var Zn = 6e4, Qn = 60 * Zn, $n = 24 * Qn;
|
|
1913
|
+
function er(e, t = Date.now()) {
|
|
1903
1914
|
let n = t - e;
|
|
1904
|
-
if (n <
|
|
1905
|
-
if (n <
|
|
1906
|
-
if (n <
|
|
1907
|
-
let r = Math.round(n /
|
|
1915
|
+
if (n < Zn) return "just now";
|
|
1916
|
+
if (n < Qn) return `${Math.round(n / Zn)} min ago`;
|
|
1917
|
+
if (n < $n) return `${Math.round(n / Qn)} h ago`;
|
|
1918
|
+
let r = Math.round(n / $n);
|
|
1908
1919
|
return r === 1 ? "yesterday" : r < 30 ? `${r} days ago` : new Date(e).toLocaleDateString(void 0, { dateStyle: "medium" });
|
|
1909
1920
|
}
|
|
1910
|
-
function
|
|
1921
|
+
function tr(e) {
|
|
1911
1922
|
return new Date(e).toLocaleString(void 0, {
|
|
1912
1923
|
dateStyle: "medium",
|
|
1913
1924
|
timeStyle: "short"
|
|
1914
1925
|
});
|
|
1915
1926
|
}
|
|
1916
|
-
function
|
|
1927
|
+
function nr(e, t) {
|
|
1917
1928
|
if (e.length <= t) return e;
|
|
1918
1929
|
let n = Math.ceil((t - 1) / 2), r = Math.floor((t - 1) / 2);
|
|
1919
1930
|
return `${e.slice(0, n)}…${e.slice(e.length - r)}`;
|
|
1920
1931
|
}
|
|
1921
1932
|
//#endregion
|
|
1922
1933
|
//#region src/OPFSFilesManager/icons.tsx
|
|
1923
|
-
var
|
|
1924
|
-
check: /* @__PURE__ */
|
|
1925
|
-
chevronLeft: /* @__PURE__ */
|
|
1926
|
-
chevronRight: /* @__PURE__ */
|
|
1927
|
-
copy: /* @__PURE__ */
|
|
1934
|
+
var rr = {
|
|
1935
|
+
check: /* @__PURE__ */ B("path", { d: "M20 6 9 17l-5-5" }),
|
|
1936
|
+
chevronLeft: /* @__PURE__ */ B("path", { d: "m15 18-6-6 6-6" }),
|
|
1937
|
+
chevronRight: /* @__PURE__ */ B("path", { d: "m9 18 6-6-6-6" }),
|
|
1938
|
+
copy: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("rect", {
|
|
1928
1939
|
width: "14",
|
|
1929
1940
|
height: "14",
|
|
1930
1941
|
x: "8",
|
|
1931
1942
|
y: "8",
|
|
1932
1943
|
rx: "2",
|
|
1933
1944
|
ry: "2"
|
|
1934
|
-
}), /* @__PURE__ */
|
|
1935
|
-
database: /* @__PURE__ */
|
|
1936
|
-
/* @__PURE__ */
|
|
1945
|
+
}), /* @__PURE__ */ B("path", { d: "M4 16c-1.1 0-2-.9-2-2V4c0-1.1.9-2 2-2h10c1.1 0 2 .9 2 2" })] }),
|
|
1946
|
+
database: /* @__PURE__ */ V(z, { children: [
|
|
1947
|
+
/* @__PURE__ */ B("ellipse", {
|
|
1937
1948
|
cx: "12",
|
|
1938
1949
|
cy: "5",
|
|
1939
1950
|
rx: "9",
|
|
1940
1951
|
ry: "3"
|
|
1941
1952
|
}),
|
|
1942
|
-
/* @__PURE__ */
|
|
1943
|
-
/* @__PURE__ */
|
|
1953
|
+
/* @__PURE__ */ B("path", { d: "M3 5V19A9 3 0 0 0 21 19V5" }),
|
|
1954
|
+
/* @__PURE__ */ B("path", { d: "M3 12A9 3 0 0 0 21 12" })
|
|
1944
1955
|
] }),
|
|
1945
|
-
download: /* @__PURE__ */
|
|
1946
|
-
/* @__PURE__ */
|
|
1947
|
-
/* @__PURE__ */
|
|
1948
|
-
/* @__PURE__ */
|
|
1956
|
+
download: /* @__PURE__ */ V(z, { children: [
|
|
1957
|
+
/* @__PURE__ */ B("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1958
|
+
/* @__PURE__ */ B("polyline", { points: "7 10 12 15 17 10" }),
|
|
1959
|
+
/* @__PURE__ */ B("line", {
|
|
1949
1960
|
x1: "12",
|
|
1950
1961
|
x2: "12",
|
|
1951
1962
|
y1: "15",
|
|
1952
1963
|
y2: "3"
|
|
1953
1964
|
})
|
|
1954
1965
|
] }),
|
|
1955
|
-
file: /* @__PURE__ */
|
|
1956
|
-
fileCode: /* @__PURE__ */
|
|
1957
|
-
/* @__PURE__ */
|
|
1958
|
-
/* @__PURE__ */
|
|
1959
|
-
/* @__PURE__ */
|
|
1960
|
-
/* @__PURE__ */
|
|
1966
|
+
file: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }), /* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" })] }),
|
|
1967
|
+
fileCode: /* @__PURE__ */ V(z, { children: [
|
|
1968
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1969
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1970
|
+
/* @__PURE__ */ B("path", { d: "m10 13-2 2 2 2" }),
|
|
1971
|
+
/* @__PURE__ */ B("path", { d: "m14 17 2-2-2-2" })
|
|
1961
1972
|
] }),
|
|
1962
|
-
fileJson: /* @__PURE__ */
|
|
1963
|
-
/* @__PURE__ */
|
|
1964
|
-
/* @__PURE__ */
|
|
1965
|
-
/* @__PURE__ */
|
|
1966
|
-
/* @__PURE__ */
|
|
1973
|
+
fileJson: /* @__PURE__ */ V(z, { children: [
|
|
1974
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1975
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1976
|
+
/* @__PURE__ */ B("path", { d: "M10 12a1 1 0 0 0-1 1v1a1 1 0 0 1-1 1 1 1 0 0 1 1 1v1a1 1 0 0 0 1 1" }),
|
|
1977
|
+
/* @__PURE__ */ B("path", { d: "M14 18a1 1 0 0 0 1-1v-1a1 1 0 0 1 1-1 1 1 0 0 1-1-1v-1a1 1 0 0 0-1-1" })
|
|
1967
1978
|
] }),
|
|
1968
|
-
fileText: /* @__PURE__ */
|
|
1969
|
-
/* @__PURE__ */
|
|
1970
|
-
/* @__PURE__ */
|
|
1971
|
-
/* @__PURE__ */
|
|
1972
|
-
/* @__PURE__ */
|
|
1973
|
-
/* @__PURE__ */
|
|
1979
|
+
fileText: /* @__PURE__ */ V(z, { children: [
|
|
1980
|
+
/* @__PURE__ */ B("path", { d: "M15 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V7Z" }),
|
|
1981
|
+
/* @__PURE__ */ B("path", { d: "M14 2v4a2 2 0 0 0 2 2h4" }),
|
|
1982
|
+
/* @__PURE__ */ B("path", { d: "M10 9H8" }),
|
|
1983
|
+
/* @__PURE__ */ B("path", { d: "M16 13H8" }),
|
|
1984
|
+
/* @__PURE__ */ B("path", { d: "M16 17H8" })
|
|
1974
1985
|
] }),
|
|
1975
|
-
folder: /* @__PURE__ */
|
|
1976
|
-
folderOpen: /* @__PURE__ */
|
|
1977
|
-
image: /* @__PURE__ */
|
|
1978
|
-
/* @__PURE__ */
|
|
1986
|
+
folder: /* @__PURE__ */ B("path", { d: "M20 20a2 2 0 0 0 2-2V8a2 2 0 0 0-2-2h-7.9a2 2 0 0 1-1.69-.9L9.6 3.9A2 2 0 0 0 7.93 3H4a2 2 0 0 0-2 2v13a2 2 0 0 0 2 2Z" }),
|
|
1987
|
+
folderOpen: /* @__PURE__ */ B("path", { d: "m6 14 1.5-2.9A2 2 0 0 1 9.24 10H20a2 2 0 0 1 1.94 2.5l-1.54 6a2 2 0 0 1-1.95 1.5H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h3.9a2 2 0 0 1 1.69.9l.81 1.2a2 2 0 0 0 1.67.9H18a2 2 0 0 1 2 2v2" }),
|
|
1988
|
+
image: /* @__PURE__ */ V(z, { children: [
|
|
1989
|
+
/* @__PURE__ */ B("rect", {
|
|
1979
1990
|
width: "18",
|
|
1980
1991
|
height: "18",
|
|
1981
1992
|
x: "3",
|
|
@@ -1983,64 +1994,64 @@ var tr = {
|
|
|
1983
1994
|
rx: "2",
|
|
1984
1995
|
ry: "2"
|
|
1985
1996
|
}),
|
|
1986
|
-
/* @__PURE__ */
|
|
1997
|
+
/* @__PURE__ */ B("circle", {
|
|
1987
1998
|
cx: "9",
|
|
1988
1999
|
cy: "9",
|
|
1989
2000
|
r: "2"
|
|
1990
2001
|
}),
|
|
1991
|
-
/* @__PURE__ */
|
|
2002
|
+
/* @__PURE__ */ B("path", { d: "m21 15-3.086-3.086a2 2 0 0 0-2.828 0L6 21" })
|
|
1992
2003
|
] }),
|
|
1993
|
-
imageOff: /* @__PURE__ */
|
|
1994
|
-
/* @__PURE__ */
|
|
2004
|
+
imageOff: /* @__PURE__ */ V(z, { children: [
|
|
2005
|
+
/* @__PURE__ */ B("line", {
|
|
1995
2006
|
x1: "2",
|
|
1996
2007
|
x2: "22",
|
|
1997
2008
|
y1: "2",
|
|
1998
2009
|
y2: "22"
|
|
1999
2010
|
}),
|
|
2000
|
-
/* @__PURE__ */
|
|
2001
|
-
/* @__PURE__ */
|
|
2011
|
+
/* @__PURE__ */ B("path", { d: "M10.41 10.41a2 2 0 1 1-2.83-2.83" }),
|
|
2012
|
+
/* @__PURE__ */ B("line", {
|
|
2002
2013
|
x1: "13.5",
|
|
2003
2014
|
x2: "6",
|
|
2004
2015
|
y1: "13.5",
|
|
2005
2016
|
y2: "21"
|
|
2006
2017
|
}),
|
|
2007
|
-
/* @__PURE__ */
|
|
2018
|
+
/* @__PURE__ */ B("line", {
|
|
2008
2019
|
x1: "18",
|
|
2009
2020
|
x2: "21",
|
|
2010
2021
|
y1: "12",
|
|
2011
2022
|
y2: "15"
|
|
2012
2023
|
}),
|
|
2013
|
-
/* @__PURE__ */
|
|
2014
|
-
/* @__PURE__ */
|
|
2024
|
+
/* @__PURE__ */ B("path", { d: "M3.59 3.59A1.99 1.99 0 0 0 3 5v14a2 2 0 0 0 2 2h14c.55 0 1.052-.22 1.41-.59" }),
|
|
2025
|
+
/* @__PURE__ */ B("path", { d: "M21 15V5a2 2 0 0 0-2-2H9" })
|
|
2015
2026
|
] }),
|
|
2016
|
-
layers: /* @__PURE__ */
|
|
2017
|
-
/* @__PURE__ */
|
|
2018
|
-
/* @__PURE__ */
|
|
2019
|
-
/* @__PURE__ */
|
|
2027
|
+
layers: /* @__PURE__ */ V(z, { children: [
|
|
2028
|
+
/* @__PURE__ */ B("path", { d: "m12.83 2.18a2 2 0 0 0-1.66 0L2.6 6.08a1 1 0 0 0 0 1.83l8.58 3.91a2 2 0 0 0 1.66 0l8.58-3.9a1 1 0 0 0 0-1.83Z" }),
|
|
2029
|
+
/* @__PURE__ */ B("path", { d: "m22 17.65-9.17 4.16a2 2 0 0 1-1.66 0L2 17.65" }),
|
|
2030
|
+
/* @__PURE__ */ B("path", { d: "m22 12.65-9.17 4.16a2 2 0 0 1-1.66 0L2 12.65" })
|
|
2020
2031
|
] }),
|
|
2021
|
-
layoutGrid: /* @__PURE__ */
|
|
2022
|
-
/* @__PURE__ */
|
|
2032
|
+
layoutGrid: /* @__PURE__ */ V(z, { children: [
|
|
2033
|
+
/* @__PURE__ */ B("rect", {
|
|
2023
2034
|
width: "7",
|
|
2024
2035
|
height: "7",
|
|
2025
2036
|
x: "3",
|
|
2026
2037
|
y: "3",
|
|
2027
2038
|
rx: "1"
|
|
2028
2039
|
}),
|
|
2029
|
-
/* @__PURE__ */
|
|
2040
|
+
/* @__PURE__ */ B("rect", {
|
|
2030
2041
|
width: "7",
|
|
2031
2042
|
height: "7",
|
|
2032
2043
|
x: "14",
|
|
2033
2044
|
y: "3",
|
|
2034
2045
|
rx: "1"
|
|
2035
2046
|
}),
|
|
2036
|
-
/* @__PURE__ */
|
|
2047
|
+
/* @__PURE__ */ B("rect", {
|
|
2037
2048
|
width: "7",
|
|
2038
2049
|
height: "7",
|
|
2039
2050
|
x: "14",
|
|
2040
2051
|
y: "14",
|
|
2041
2052
|
rx: "1"
|
|
2042
2053
|
}),
|
|
2043
|
-
/* @__PURE__ */
|
|
2054
|
+
/* @__PURE__ */ B("rect", {
|
|
2044
2055
|
width: "7",
|
|
2045
2056
|
height: "7",
|
|
2046
2057
|
x: "3",
|
|
@@ -2048,51 +2059,51 @@ var tr = {
|
|
|
2048
2059
|
rx: "1"
|
|
2049
2060
|
})
|
|
2050
2061
|
] }),
|
|
2051
|
-
list: /* @__PURE__ */
|
|
2052
|
-
/* @__PURE__ */
|
|
2053
|
-
/* @__PURE__ */
|
|
2054
|
-
/* @__PURE__ */
|
|
2055
|
-
/* @__PURE__ */
|
|
2056
|
-
/* @__PURE__ */
|
|
2057
|
-
/* @__PURE__ */
|
|
2062
|
+
list: /* @__PURE__ */ V(z, { children: [
|
|
2063
|
+
/* @__PURE__ */ B("path", { d: "M3 12h.01" }),
|
|
2064
|
+
/* @__PURE__ */ B("path", { d: "M3 18h.01" }),
|
|
2065
|
+
/* @__PURE__ */ B("path", { d: "M3 6h.01" }),
|
|
2066
|
+
/* @__PURE__ */ B("path", { d: "M8 12h13" }),
|
|
2067
|
+
/* @__PURE__ */ B("path", { d: "M8 18h13" }),
|
|
2068
|
+
/* @__PURE__ */ B("path", { d: "M8 6h13" })
|
|
2058
2069
|
] }),
|
|
2059
|
-
refresh: /* @__PURE__ */
|
|
2060
|
-
/* @__PURE__ */
|
|
2061
|
-
/* @__PURE__ */
|
|
2062
|
-
/* @__PURE__ */
|
|
2063
|
-
/* @__PURE__ */
|
|
2070
|
+
refresh: /* @__PURE__ */ V(z, { children: [
|
|
2071
|
+
/* @__PURE__ */ B("path", { d: "M3 12a9 9 0 0 1 9-9 9.75 9.75 0 0 1 6.74 2.74L21 8" }),
|
|
2072
|
+
/* @__PURE__ */ B("path", { d: "M21 3v5h-5" }),
|
|
2073
|
+
/* @__PURE__ */ B("path", { d: "M21 12a9 9 0 0 1-9 9 9.75 9.75 0 0 1-6.74-2.74L3 16" }),
|
|
2074
|
+
/* @__PURE__ */ B("path", { d: "M8 16H3v5" })
|
|
2064
2075
|
] }),
|
|
2065
|
-
search: /* @__PURE__ */
|
|
2076
|
+
search: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("circle", {
|
|
2066
2077
|
cx: "11",
|
|
2067
2078
|
cy: "11",
|
|
2068
2079
|
r: "8"
|
|
2069
|
-
}), /* @__PURE__ */
|
|
2070
|
-
trash: /* @__PURE__ */
|
|
2071
|
-
/* @__PURE__ */
|
|
2072
|
-
/* @__PURE__ */
|
|
2073
|
-
/* @__PURE__ */
|
|
2074
|
-
/* @__PURE__ */
|
|
2080
|
+
}), /* @__PURE__ */ B("path", { d: "m21 21-4.3-4.3" })] }),
|
|
2081
|
+
trash: /* @__PURE__ */ V(z, { children: [
|
|
2082
|
+
/* @__PURE__ */ B("path", { d: "M3 6h18" }),
|
|
2083
|
+
/* @__PURE__ */ B("path", { d: "M19 6v14c0 1-1 2-2 2H7c-1 0-2-1-2-2V6" }),
|
|
2084
|
+
/* @__PURE__ */ B("path", { d: "M8 6V4c0-1 1-2 2-2h4c1 0 2 1 2 2v2" }),
|
|
2085
|
+
/* @__PURE__ */ B("line", {
|
|
2075
2086
|
x1: "10",
|
|
2076
2087
|
x2: "10",
|
|
2077
2088
|
y1: "11",
|
|
2078
2089
|
y2: "17"
|
|
2079
2090
|
}),
|
|
2080
|
-
/* @__PURE__ */
|
|
2091
|
+
/* @__PURE__ */ B("line", {
|
|
2081
2092
|
x1: "14",
|
|
2082
2093
|
x2: "14",
|
|
2083
2094
|
y1: "11",
|
|
2084
2095
|
y2: "17"
|
|
2085
2096
|
})
|
|
2086
2097
|
] }),
|
|
2087
|
-
triangleAlert: /* @__PURE__ */
|
|
2088
|
-
/* @__PURE__ */
|
|
2089
|
-
/* @__PURE__ */
|
|
2090
|
-
/* @__PURE__ */
|
|
2098
|
+
triangleAlert: /* @__PURE__ */ V(z, { children: [
|
|
2099
|
+
/* @__PURE__ */ B("path", { d: "m21.73 18-8-14a2 2 0 0 0-3.48 0l-8 14A2 2 0 0 0 4 21h16a2 2 0 0 0 1.73-3" }),
|
|
2100
|
+
/* @__PURE__ */ B("path", { d: "M12 9v4" }),
|
|
2101
|
+
/* @__PURE__ */ B("path", { d: "M12 17h.01" })
|
|
2091
2102
|
] }),
|
|
2092
|
-
x: /* @__PURE__ */
|
|
2103
|
+
x: /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("path", { d: "M18 6 6 18" }), /* @__PURE__ */ B("path", { d: "m6 6 12 12" })] })
|
|
2093
2104
|
};
|
|
2094
|
-
function
|
|
2095
|
-
return /* @__PURE__ */
|
|
2105
|
+
function Q({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
2106
|
+
return /* @__PURE__ */ B("svg", {
|
|
2096
2107
|
xmlns: "http://www.w3.org/2000/svg",
|
|
2097
2108
|
width: t,
|
|
2098
2109
|
height: t,
|
|
@@ -2105,20 +2116,20 @@ function $({ name: e, size: t = 16, strokeWidth: n = 2, className: r }) {
|
|
|
2105
2116
|
"aria-hidden": "true",
|
|
2106
2117
|
focusable: "false",
|
|
2107
2118
|
className: r,
|
|
2108
|
-
children:
|
|
2119
|
+
children: rr[e]
|
|
2109
2120
|
});
|
|
2110
2121
|
}
|
|
2111
2122
|
//#endregion
|
|
2112
2123
|
//#region src/OPFSFilesManager/DeleteDialog.tsx
|
|
2113
|
-
var
|
|
2114
|
-
function
|
|
2124
|
+
var ir = 6;
|
|
2125
|
+
function ar({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
2115
2126
|
let a = s(null);
|
|
2116
2127
|
return i(() => {
|
|
2117
2128
|
let e = a.current;
|
|
2118
2129
|
return e && !e.open && (e.showModal(), e.querySelector("[data-initial-focus]")?.focus()), () => {
|
|
2119
2130
|
e?.open && e.close();
|
|
2120
2131
|
};
|
|
2121
|
-
}, []), /* @__PURE__ */
|
|
2132
|
+
}, []), /* @__PURE__ */ B("dialog", {
|
|
2122
2133
|
ref: a,
|
|
2123
2134
|
className: ["seed-fm-dialog", e].filter(Boolean).join(" "),
|
|
2124
2135
|
"aria-labelledby": "seed-fm-delete-title",
|
|
@@ -2128,7 +2139,7 @@ function rr({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2128
2139
|
onClick: (e) => {
|
|
2129
2140
|
e.target === e.currentTarget && t();
|
|
2130
2141
|
},
|
|
2131
|
-
children: /* @__PURE__ */
|
|
2142
|
+
children: /* @__PURE__ */ B("form", {
|
|
2132
2143
|
method: "dialog",
|
|
2133
2144
|
onSubmit: (e) => {
|
|
2134
2145
|
e.preventDefault(), n();
|
|
@@ -2137,32 +2148,32 @@ function rr({ className: e, onCancel: t, onSubmit: n, children: r }) {
|
|
|
2137
2148
|
})
|
|
2138
2149
|
});
|
|
2139
2150
|
}
|
|
2140
|
-
function
|
|
2141
|
-
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 ${
|
|
2142
|
-
return /* @__PURE__ */
|
|
2151
|
+
function or({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel: i, onConfirm: a, className: o }) {
|
|
2152
|
+
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 ${nr(e[0].file.name, 32)}?` : `Delete ${e.length} files?`;
|
|
2153
|
+
return /* @__PURE__ */ V(ar, {
|
|
2143
2154
|
className: o,
|
|
2144
2155
|
onCancel: i,
|
|
2145
2156
|
onSubmit: () => a(s),
|
|
2146
2157
|
children: [
|
|
2147
|
-
/* @__PURE__ */
|
|
2158
|
+
/* @__PURE__ */ B("h3", {
|
|
2148
2159
|
id: "seed-fm-delete-title",
|
|
2149
2160
|
children: h
|
|
2150
2161
|
}),
|
|
2151
|
-
/* @__PURE__ */
|
|
2162
|
+
/* @__PURE__ */ V("p", { children: [
|
|
2152
2163
|
"This removes ",
|
|
2153
2164
|
e.length === 1 ? "it" : "them",
|
|
2154
2165
|
" from this browser’s private storage. Copies on Arweave or other devices aren’t affected. You can’t undo this."
|
|
2155
2166
|
] }),
|
|
2156
|
-
/* @__PURE__ */
|
|
2167
|
+
/* @__PURE__ */ V("ul", { children: [e.slice(0, ir).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
2157
2168
|
title: e.file.path,
|
|
2158
2169
|
children: e.file.path.startsWith(p) ? e.file.path.slice(p.length) : e.file.path
|
|
2159
|
-
}), /* @__PURE__ */
|
|
2170
|
+
}), /* @__PURE__ */ B("span", { children: Z(e.file.size) })] }, e.file.path)), e.length > ir && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
2160
2171
|
"and ",
|
|
2161
|
-
e.length -
|
|
2172
|
+
e.length - ir,
|
|
2162
2173
|
" more"
|
|
2163
2174
|
] }) })] }),
|
|
2164
|
-
u.length > 0 && /* @__PURE__ */
|
|
2165
|
-
/* @__PURE__ */
|
|
2175
|
+
u.length > 0 && /* @__PURE__ */ V("label", { children: [
|
|
2176
|
+
/* @__PURE__ */ B("input", {
|
|
2166
2177
|
type: "checkbox",
|
|
2167
2178
|
className: "seed-fm-checkbox",
|
|
2168
2179
|
checked: s,
|
|
@@ -2173,26 +2184,26 @@ function ir({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2173
2184
|
" resized ",
|
|
2174
2185
|
u.length === 1 ? "copy" : "copies",
|
|
2175
2186
|
" (",
|
|
2176
|
-
|
|
2187
|
+
Z(d),
|
|
2177
2188
|
")"
|
|
2178
2189
|
] }),
|
|
2179
|
-
n && /* @__PURE__ */
|
|
2190
|
+
n && /* @__PURE__ */ V("div", {
|
|
2180
2191
|
className: "seed-fm-warning",
|
|
2181
2192
|
role: "alert",
|
|
2182
|
-
children: [/* @__PURE__ */
|
|
2193
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2183
2194
|
name: "triangleAlert",
|
|
2184
2195
|
size: 16
|
|
2185
|
-
}), /* @__PURE__ */
|
|
2196
|
+
}), /* @__PURE__ */ B("span", { children: n })]
|
|
2186
2197
|
}),
|
|
2187
|
-
/* @__PURE__ */
|
|
2198
|
+
/* @__PURE__ */ V("div", {
|
|
2188
2199
|
className: "seed-fm-dialog-actions",
|
|
2189
|
-
children: [/* @__PURE__ */
|
|
2200
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2190
2201
|
type: "button",
|
|
2191
2202
|
className: "seed-fm-btn",
|
|
2192
2203
|
onClick: i,
|
|
2193
2204
|
"data-initial-focus": !0,
|
|
2194
2205
|
children: "Cancel"
|
|
2195
|
-
}), /* @__PURE__ */
|
|
2206
|
+
}), /* @__PURE__ */ B("button", {
|
|
2196
2207
|
type: "submit",
|
|
2197
2208
|
className: `seed-fm-btn ${m.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
2198
2209
|
children: m.label ?? `Delete ${f} ${f === 1 ? "file" : "files"}`
|
|
@@ -2201,43 +2212,43 @@ function ir({ entries: e, rootPath: t, warning: n, deleteActionFor: r, onCancel:
|
|
|
2201
2212
|
]
|
|
2202
2213
|
});
|
|
2203
2214
|
}
|
|
2204
|
-
function
|
|
2215
|
+
function sr({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy: a, onDownload: o, onCancel: s, onConfirm: l, className: u }) {
|
|
2205
2216
|
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;
|
|
2206
|
-
return /* @__PURE__ */
|
|
2217
|
+
return /* @__PURE__ */ V(ar, {
|
|
2207
2218
|
className: u,
|
|
2208
2219
|
onCancel: s,
|
|
2209
2220
|
onSubmit: l,
|
|
2210
2221
|
children: [
|
|
2211
|
-
/* @__PURE__ */
|
|
2222
|
+
/* @__PURE__ */ B("h3", {
|
|
2212
2223
|
id: "seed-fm-delete-title",
|
|
2213
|
-
children: i.label ? `${i.label}?` : `Delete the “${
|
|
2224
|
+
children: i.label ? `${i.label}?` : `Delete the “${nr(e.name, 32)}” folder?`
|
|
2214
2225
|
}),
|
|
2215
|
-
/* @__PURE__ */
|
|
2226
|
+
/* @__PURE__ */ V("p", { children: [
|
|
2216
2227
|
"This removes the folder and the ",
|
|
2217
2228
|
h,
|
|
2218
2229
|
" in it (",
|
|
2219
|
-
|
|
2230
|
+
Z(p),
|
|
2220
2231
|
g > 0 && `, including ${g} resized ${g === 1 ? "copy" : "copies"}`,
|
|
2221
2232
|
") from this browser’s private storage. Copies on Arweave or other devices aren’t affected."
|
|
2222
2233
|
] }),
|
|
2223
|
-
/* @__PURE__ */
|
|
2234
|
+
/* @__PURE__ */ V("div", {
|
|
2224
2235
|
className: "seed-fm-irreversible",
|
|
2225
|
-
children: [/* @__PURE__ */
|
|
2236
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2226
2237
|
name: "triangleAlert",
|
|
2227
2238
|
size: 16
|
|
2228
|
-
}), /* @__PURE__ */
|
|
2239
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("strong", { children: "This can’t be undone." }), " Once deleted, these files can’t be recovered from this browser."] })]
|
|
2229
2240
|
}),
|
|
2230
|
-
/* @__PURE__ */
|
|
2241
|
+
/* @__PURE__ */ V("ul", { children: [t.slice(0, ir).map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ B("code", {
|
|
2231
2242
|
title: e.path,
|
|
2232
2243
|
children: e.path.slice(m.length)
|
|
2233
|
-
}), /* @__PURE__ */
|
|
2244
|
+
}), /* @__PURE__ */ B("span", { children: Z(e.size) })] }, e.path)), t.length > ir && /* @__PURE__ */ B("li", { children: /* @__PURE__ */ V("span", { children: [
|
|
2234
2245
|
"and ",
|
|
2235
|
-
t.length -
|
|
2246
|
+
t.length - ir,
|
|
2236
2247
|
" more"
|
|
2237
2248
|
] }) })] }),
|
|
2238
|
-
/* @__PURE__ */
|
|
2249
|
+
/* @__PURE__ */ V("div", {
|
|
2239
2250
|
className: "seed-fm-keepcopy",
|
|
2240
|
-
children: [/* @__PURE__ */
|
|
2251
|
+
children: [/* @__PURE__ */ B("span", { children: d ? "Saved a copy to your computer." : "Want a copy first? Save the folder to your computer." }), /* @__PURE__ */ V("button", {
|
|
2241
2252
|
type: "button",
|
|
2242
2253
|
className: "seed-fm-btn",
|
|
2243
2254
|
disabled: a,
|
|
@@ -2245,7 +2256,7 @@ function ar({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2245
2256
|
await o() && f(!0);
|
|
2246
2257
|
},
|
|
2247
2258
|
children: [
|
|
2248
|
-
/* @__PURE__ */
|
|
2259
|
+
/* @__PURE__ */ B(Q, {
|
|
2249
2260
|
name: d ? "check" : "download",
|
|
2250
2261
|
size: 15
|
|
2251
2262
|
}),
|
|
@@ -2254,7 +2265,7 @@ function ar({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2254
2265
|
]
|
|
2255
2266
|
})]
|
|
2256
2267
|
}),
|
|
2257
|
-
n > 0 && /* @__PURE__ */
|
|
2268
|
+
n > 0 && /* @__PURE__ */ V("p", { children: [
|
|
2258
2269
|
n,
|
|
2259
2270
|
" other ",
|
|
2260
2271
|
n === 1 ? "file" : "files",
|
|
@@ -2263,23 +2274,23 @@ function ar({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2263
2274
|
" ",
|
|
2264
2275
|
"hidden here and won’t be deleted, so the folder itself will stay."
|
|
2265
2276
|
] }),
|
|
2266
|
-
r && /* @__PURE__ */
|
|
2277
|
+
r && /* @__PURE__ */ V("div", {
|
|
2267
2278
|
className: "seed-fm-warning",
|
|
2268
2279
|
role: "alert",
|
|
2269
|
-
children: [/* @__PURE__ */
|
|
2280
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2270
2281
|
name: "triangleAlert",
|
|
2271
2282
|
size: 16
|
|
2272
|
-
}), /* @__PURE__ */
|
|
2283
|
+
}), /* @__PURE__ */ B("span", { children: r })]
|
|
2273
2284
|
}),
|
|
2274
|
-
/* @__PURE__ */
|
|
2285
|
+
/* @__PURE__ */ V("div", {
|
|
2275
2286
|
className: "seed-fm-dialog-actions",
|
|
2276
|
-
children: [/* @__PURE__ */
|
|
2287
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2277
2288
|
type: "button",
|
|
2278
2289
|
className: "seed-fm-btn",
|
|
2279
2290
|
onClick: s,
|
|
2280
2291
|
"data-initial-focus": !0,
|
|
2281
2292
|
children: "Cancel"
|
|
2282
|
-
}), /* @__PURE__ */
|
|
2293
|
+
}), /* @__PURE__ */ B("button", {
|
|
2283
2294
|
type: "submit",
|
|
2284
2295
|
disabled: a,
|
|
2285
2296
|
className: `seed-fm-btn ${i.destructive ? "seed-fm-btn--danger" : "seed-fm-btn--primary"}`,
|
|
@@ -2291,42 +2302,42 @@ function ar({ folder: e, files: t, hiddenCount: n, warning: r, action: i, busy:
|
|
|
2291
2302
|
}
|
|
2292
2303
|
//#endregion
|
|
2293
2304
|
//#region src/OPFSFilesManager/fileModel.ts
|
|
2294
|
-
function
|
|
2305
|
+
function cr(e) {
|
|
2295
2306
|
return e.detectedType ?? e.type;
|
|
2296
2307
|
}
|
|
2297
|
-
var
|
|
2298
|
-
function
|
|
2299
|
-
let t =
|
|
2300
|
-
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" ||
|
|
2308
|
+
var lr = /\.(db|sqlite|sqlite3)(-journal|-wal|-shm)?$/i;
|
|
2309
|
+
function $(e) {
|
|
2310
|
+
let t = cr(e);
|
|
2311
|
+
return t.startsWith("image/") ? "image" : t === "application/vnd.sqlite3" || lr.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";
|
|
2301
2312
|
}
|
|
2302
|
-
function
|
|
2313
|
+
function ur(e) {
|
|
2303
2314
|
let t = /\.([a-z0-9-]{1,12})$/i.exec(e.name)?.[1];
|
|
2304
2315
|
if (t) return t.toLowerCase();
|
|
2305
|
-
let n =
|
|
2316
|
+
let n = cr(e);
|
|
2306
2317
|
return n === "application/octet-stream" ? "bin" : n.split("/")[1]?.replace(/^vnd\./, "") ?? "bin";
|
|
2307
2318
|
}
|
|
2308
|
-
var
|
|
2309
|
-
function
|
|
2310
|
-
let t =
|
|
2319
|
+
var dr = /^(.*\/)?images\/(\d+)\/([^/]+)\.webp$/, fr = /^(.*\/)?images\/([^/]+)$/, pr = (e) => e.replace(/\.[^/.]+$/, "");
|
|
2320
|
+
function mr(e) {
|
|
2321
|
+
let t = dr.exec(e);
|
|
2311
2322
|
return t ? {
|
|
2312
2323
|
key: `${t[1] ?? ""}images/${t[3]}`,
|
|
2313
2324
|
width: Number(t[2])
|
|
2314
2325
|
} : null;
|
|
2315
2326
|
}
|
|
2316
|
-
function
|
|
2317
|
-
let t =
|
|
2318
|
-
return t ? `${t[1] ?? ""}images/${
|
|
2327
|
+
function hr(e) {
|
|
2328
|
+
let t = fr.exec(e);
|
|
2329
|
+
return t ? `${t[1] ?? ""}images/${pr(t[2])}` : null;
|
|
2319
2330
|
}
|
|
2320
|
-
var
|
|
2331
|
+
var gr = (e) => ({
|
|
2321
2332
|
file: e,
|
|
2322
2333
|
variants: [],
|
|
2323
2334
|
totalSize: e.size
|
|
2324
2335
|
});
|
|
2325
|
-
function
|
|
2326
|
-
if (!t) return e.map(
|
|
2336
|
+
function _r(e, t) {
|
|
2337
|
+
if (!t) return e.map(gr);
|
|
2327
2338
|
let n = /* @__PURE__ */ new Map(), r = [], i = [];
|
|
2328
2339
|
for (let t of e) {
|
|
2329
|
-
let e =
|
|
2340
|
+
let e = mr(t.path);
|
|
2330
2341
|
if (e) {
|
|
2331
2342
|
i.push({
|
|
2332
2343
|
file: t,
|
|
@@ -2334,27 +2345,27 @@ function gr(e, t) {
|
|
|
2334
2345
|
});
|
|
2335
2346
|
continue;
|
|
2336
2347
|
}
|
|
2337
|
-
let a =
|
|
2348
|
+
let a = gr(t);
|
|
2338
2349
|
r.push(a);
|
|
2339
|
-
let o =
|
|
2340
|
-
o &&
|
|
2350
|
+
let o = hr(t.path);
|
|
2351
|
+
o && $(t) === "image" && n.set(o, a);
|
|
2341
2352
|
}
|
|
2342
2353
|
for (let e of i) {
|
|
2343
2354
|
let t = n.get(e.key);
|
|
2344
2355
|
t ? (t.variants.push({
|
|
2345
2356
|
file: e.file,
|
|
2346
2357
|
width: e.width
|
|
2347
|
-
}), t.totalSize += e.file.size) : r.push(
|
|
2358
|
+
}), t.totalSize += e.file.size) : r.push(gr(e.file));
|
|
2348
2359
|
}
|
|
2349
2360
|
for (let e of n.values()) e.variants.sort((e, t) => e.width - t.width);
|
|
2350
2361
|
return r;
|
|
2351
2362
|
}
|
|
2352
|
-
var
|
|
2353
|
-
function
|
|
2363
|
+
var vr = (e, t) => e ? `${e}/${t}` : t;
|
|
2364
|
+
function yr(e, t, n = {}) {
|
|
2354
2365
|
let r = t ? `${t}/` : "", i = e.filter((e) => e.file.path.startsWith(r)), a = n.query?.trim().toLowerCase();
|
|
2355
2366
|
if (a) return {
|
|
2356
2367
|
folders: [],
|
|
2357
|
-
entries:
|
|
2368
|
+
entries: br(i.filter((e) => e.file.path.slice(r.length).toLowerCase().includes(a)), n.sort)
|
|
2358
2369
|
};
|
|
2359
2370
|
let o = /* @__PURE__ */ new Map(), s = [];
|
|
2360
2371
|
for (let e of i) {
|
|
@@ -2365,7 +2376,7 @@ function vr(e, t, n = {}) {
|
|
|
2365
2376
|
}
|
|
2366
2377
|
let a = n.slice(0, i), c = o.get(a) ?? {
|
|
2367
2378
|
name: a,
|
|
2368
|
-
path:
|
|
2379
|
+
path: vr(t, a),
|
|
2369
2380
|
fileCount: 0,
|
|
2370
2381
|
size: 0
|
|
2371
2382
|
};
|
|
@@ -2373,10 +2384,10 @@ function vr(e, t, n = {}) {
|
|
|
2373
2384
|
}
|
|
2374
2385
|
return {
|
|
2375
2386
|
folders: [...o.values()].sort((e, t) => e.name.localeCompare(t.name)),
|
|
2376
|
-
entries:
|
|
2387
|
+
entries: br(s, n.sort)
|
|
2377
2388
|
};
|
|
2378
2389
|
}
|
|
2379
|
-
function
|
|
2390
|
+
function br(e, t = "name") {
|
|
2380
2391
|
let n = {
|
|
2381
2392
|
name: (e, t) => e.file.name.localeCompare(t.file.name),
|
|
2382
2393
|
modified: (e, t) => t.file.lastModified - e.file.lastModified,
|
|
@@ -2384,7 +2395,7 @@ function yr(e, t = "name") {
|
|
|
2384
2395
|
};
|
|
2385
2396
|
return [...e].sort(n[t]);
|
|
2386
2397
|
}
|
|
2387
|
-
function
|
|
2398
|
+
function xr(e) {
|
|
2388
2399
|
let t = {
|
|
2389
2400
|
image: 0,
|
|
2390
2401
|
database: 0,
|
|
@@ -2393,34 +2404,34 @@ function br(e) {
|
|
|
2393
2404
|
text: 0,
|
|
2394
2405
|
other: 0
|
|
2395
2406
|
};
|
|
2396
|
-
for (let n of e) t[
|
|
2407
|
+
for (let n of e) t[$(n)] += n.size;
|
|
2397
2408
|
return t;
|
|
2398
2409
|
}
|
|
2399
|
-
function
|
|
2410
|
+
function Sr(e) {
|
|
2400
2411
|
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;
|
|
2401
2412
|
}
|
|
2402
2413
|
//#endregion
|
|
2403
2414
|
//#region src/OPFSFilesManager/useThumbnail.ts
|
|
2404
|
-
var
|
|
2405
|
-
function
|
|
2415
|
+
var Cr = 400, wr = 262144, Tr = 4, Er = 3e4, Dr = 0, Or = [];
|
|
2416
|
+
function kr(e) {
|
|
2406
2417
|
return new Promise((t, n) => {
|
|
2407
2418
|
let r = () => {
|
|
2408
|
-
|
|
2409
|
-
|
|
2419
|
+
Dr++, e().then(t, n).finally(() => {
|
|
2420
|
+
Dr--, Or.shift()?.();
|
|
2410
2421
|
});
|
|
2411
2422
|
};
|
|
2412
|
-
|
|
2423
|
+
Dr < Tr ? r() : Or.push(r);
|
|
2413
2424
|
});
|
|
2414
2425
|
}
|
|
2415
|
-
var
|
|
2416
|
-
function
|
|
2417
|
-
let n =
|
|
2426
|
+
var Ar = /* @__PURE__ */ new Map();
|
|
2427
|
+
function jr(e, t) {
|
|
2428
|
+
let n = Ar.get(e);
|
|
2418
2429
|
if (!n) {
|
|
2419
2430
|
let r = {
|
|
2420
2431
|
refs: 0,
|
|
2421
2432
|
promise: Promise.resolve("")
|
|
2422
2433
|
};
|
|
2423
|
-
r.promise =
|
|
2434
|
+
r.promise = kr(t).then((e) => (r.url = URL.createObjectURL(e), r.url)), Ar.set(e, r), n = r;
|
|
2424
2435
|
}
|
|
2425
2436
|
n.timer && (clearTimeout(n.timer), n.timer = void 0), n.refs++;
|
|
2426
2437
|
let r = n, i = !1;
|
|
@@ -2428,15 +2439,15 @@ function Ar(e, t) {
|
|
|
2428
2439
|
promise: r.promise,
|
|
2429
2440
|
release: () => {
|
|
2430
2441
|
i || (i = !0, r.refs--, !(r.refs > 0) && (r.timer = setTimeout(() => {
|
|
2431
|
-
r.url && URL.revokeObjectURL(r.url),
|
|
2432
|
-
},
|
|
2442
|
+
r.url && URL.revokeObjectURL(r.url), Ar.get(e) === r && Ar.delete(e);
|
|
2443
|
+
}, Er)));
|
|
2433
2444
|
}
|
|
2434
2445
|
};
|
|
2435
2446
|
}
|
|
2436
|
-
async function
|
|
2437
|
-
if (e.size <
|
|
2447
|
+
async function Mr(e) {
|
|
2448
|
+
if (e.size < wr || typeof createImageBitmap != "function") return e;
|
|
2438
2449
|
let t = await createImageBitmap(e, {
|
|
2439
|
-
resizeWidth:
|
|
2450
|
+
resizeWidth: Cr,
|
|
2440
2451
|
resizeQuality: "medium"
|
|
2441
2452
|
});
|
|
2442
2453
|
try {
|
|
@@ -2453,22 +2464,22 @@ async function jr(e) {
|
|
|
2453
2464
|
t.close();
|
|
2454
2465
|
}
|
|
2455
2466
|
}
|
|
2456
|
-
async function
|
|
2467
|
+
async function Nr(e) {
|
|
2457
2468
|
let t = e.variants[0];
|
|
2458
|
-
return t ?
|
|
2469
|
+
return t ? zn(t.file.path) : Mr(await zn(e.file.path));
|
|
2459
2470
|
}
|
|
2460
|
-
var
|
|
2461
|
-
function
|
|
2462
|
-
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (
|
|
2463
|
-
for (let t of e) t.isIntersecting && (
|
|
2464
|
-
}, { rootMargin: "300px" })),
|
|
2465
|
-
|
|
2471
|
+
var Pr = /* @__PURE__ */ new WeakMap(), Fr = null;
|
|
2472
|
+
function Ir(e, t) {
|
|
2473
|
+
return typeof IntersectionObserver > "u" ? (t(), () => {}) : (Fr ?? (Fr = new IntersectionObserver((e) => {
|
|
2474
|
+
for (let t of e) t.isIntersecting && (Fr.unobserve(t.target), Pr.get(t.target)?.(), Pr.delete(t.target));
|
|
2475
|
+
}, { rootMargin: "300px" })), Pr.set(e, t), Fr.observe(e), () => {
|
|
2476
|
+
Pr.delete(e), Fr?.unobserve(e);
|
|
2466
2477
|
});
|
|
2467
2478
|
}
|
|
2468
|
-
function
|
|
2469
|
-
let t =
|
|
2479
|
+
function Lr(e) {
|
|
2480
|
+
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), []);
|
|
2470
2481
|
i(() => {
|
|
2471
|
-
if (t && r && !o) return
|
|
2482
|
+
if (t && r && !o) return Ir(r, () => s(!0));
|
|
2472
2483
|
}, [
|
|
2473
2484
|
t,
|
|
2474
2485
|
r,
|
|
@@ -2479,7 +2490,7 @@ function Ir(e) {
|
|
|
2479
2490
|
if (!t || !o) return;
|
|
2480
2491
|
let n = !1;
|
|
2481
2492
|
f("loading");
|
|
2482
|
-
let r =
|
|
2493
|
+
let r = jr(_, () => Nr(e));
|
|
2483
2494
|
return r.promise.then((e) => {
|
|
2484
2495
|
n || (u(e), f("ready"));
|
|
2485
2496
|
}, () => {
|
|
@@ -2502,7 +2513,7 @@ function Ir(e) {
|
|
|
2502
2513
|
}
|
|
2503
2514
|
//#endregion
|
|
2504
2515
|
//#region src/OPFSFilesManager/FileThumbnail.tsx
|
|
2505
|
-
var
|
|
2516
|
+
var Rr = {
|
|
2506
2517
|
image: {
|
|
2507
2518
|
icon: "image",
|
|
2508
2519
|
label: "Images",
|
|
@@ -2533,53 +2544,53 @@ var Lr = {
|
|
|
2533
2544
|
label: "Other",
|
|
2534
2545
|
color: "var(--seed-kind-other)"
|
|
2535
2546
|
}
|
|
2536
|
-
},
|
|
2537
|
-
function
|
|
2538
|
-
let r =
|
|
2547
|
+
}, zr = (e) => ({ "--seed-kind": Rr[e].color }), Br = (e) => /png|webp|gif|avif|svg/.test(cr(e.file));
|
|
2548
|
+
function Vr({ entry: e, size: t, children: n }) {
|
|
2549
|
+
let r = $(e.file), { ref: i, url: a, status: o, markError: s } = Lr(e), c = r === "image" && o === "error", l = r === "image" && a && !c, u = [
|
|
2539
2550
|
t === "tile" ? "seed-fm-thumb" : "seed-fm-mini",
|
|
2540
|
-
l &&
|
|
2551
|
+
l && Br(e) ? "seed-fm-thumb--checker" : "",
|
|
2541
2552
|
r === "image" && o === "loading" ? "seed-fm-skeleton" : ""
|
|
2542
2553
|
].filter(Boolean).join(" "), d;
|
|
2543
|
-
return d = l ? /* @__PURE__ */
|
|
2554
|
+
return d = l ? /* @__PURE__ */ B("img", {
|
|
2544
2555
|
src: a,
|
|
2545
2556
|
alt: "",
|
|
2546
2557
|
decoding: "async",
|
|
2547
2558
|
draggable: !1,
|
|
2548
2559
|
onError: s
|
|
2549
|
-
}) : t === "mini" ? /* @__PURE__ */
|
|
2550
|
-
name: c ? "imageOff" :
|
|
2560
|
+
}) : t === "mini" ? /* @__PURE__ */ B(Q, {
|
|
2561
|
+
name: c ? "imageOff" : Rr[r].icon,
|
|
2551
2562
|
size: 16
|
|
2552
|
-
}) : r === "image" && !c ? null : /* @__PURE__ */
|
|
2563
|
+
}) : r === "image" && !c ? null : /* @__PURE__ */ V("span", {
|
|
2553
2564
|
className: "seed-fm-kind",
|
|
2554
|
-
children: [/* @__PURE__ */
|
|
2555
|
-
name: c ? "imageOff" :
|
|
2565
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2566
|
+
name: c ? "imageOff" : Rr[r].icon,
|
|
2556
2567
|
size: 28,
|
|
2557
2568
|
strokeWidth: 1.6
|
|
2558
|
-
}), c ? /* @__PURE__ */
|
|
2569
|
+
}), c ? /* @__PURE__ */ B("span", {
|
|
2559
2570
|
className: "seed-fm-kind-error",
|
|
2560
2571
|
children: "Can’t decode image"
|
|
2561
|
-
}) : /* @__PURE__ */
|
|
2572
|
+
}) : /* @__PURE__ */ B("span", {
|
|
2562
2573
|
className: "seed-fm-ext",
|
|
2563
|
-
children:
|
|
2574
|
+
children: ur(e.file)
|
|
2564
2575
|
})]
|
|
2565
|
-
}), /* @__PURE__ */
|
|
2576
|
+
}), /* @__PURE__ */ V("span", {
|
|
2566
2577
|
ref: i,
|
|
2567
2578
|
className: u,
|
|
2568
|
-
style:
|
|
2579
|
+
style: zr(r),
|
|
2569
2580
|
children: [d, n]
|
|
2570
2581
|
});
|
|
2571
2582
|
}
|
|
2572
2583
|
//#endregion
|
|
2573
2584
|
//#region src/OPFSFilesManager/FileGrid.tsx
|
|
2574
|
-
function
|
|
2575
|
-
return /* @__PURE__ */
|
|
2585
|
+
function Hr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i, tileClassName: a }) {
|
|
2586
|
+
return /* @__PURE__ */ B("ul", {
|
|
2576
2587
|
className: ["seed-fm-grid", i].filter(Boolean).join(" "),
|
|
2577
2588
|
role: "listbox",
|
|
2578
2589
|
"aria-label": "Files",
|
|
2579
2590
|
"aria-multiselectable": "true",
|
|
2580
2591
|
children: e.map((e, i) => {
|
|
2581
2592
|
let { file: o, variants: s } = e, c = t.has(o.path);
|
|
2582
|
-
return /* @__PURE__ */
|
|
2593
|
+
return /* @__PURE__ */ V("li", {
|
|
2583
2594
|
role: "option",
|
|
2584
2595
|
tabIndex: 0,
|
|
2585
2596
|
"aria-selected": c,
|
|
@@ -2591,10 +2602,10 @@ function Vr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2591
2602
|
onKeyDown: (t) => {
|
|
2592
2603
|
t.target === t.currentTarget && (t.key === "Enter" ? (t.preventDefault(), n(e, i, t)) : t.key === " " && (t.preventDefault(), r(e, i, t.shiftKey)));
|
|
2593
2604
|
},
|
|
2594
|
-
children: [/* @__PURE__ */
|
|
2605
|
+
children: [/* @__PURE__ */ V(Vr, {
|
|
2595
2606
|
entry: e,
|
|
2596
2607
|
size: "tile",
|
|
2597
|
-
children: [/* @__PURE__ */
|
|
2608
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2598
2609
|
type: "button",
|
|
2599
2610
|
className: "seed-fm-check",
|
|
2600
2611
|
tabIndex: -1,
|
|
@@ -2602,16 +2613,16 @@ function Vr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2602
2613
|
onClick: (t) => {
|
|
2603
2614
|
t.stopPropagation(), r(e, i, t.shiftKey);
|
|
2604
2615
|
},
|
|
2605
|
-
children: c && /* @__PURE__ */
|
|
2616
|
+
children: c && /* @__PURE__ */ B(Q, {
|
|
2606
2617
|
name: "check",
|
|
2607
2618
|
size: 14,
|
|
2608
2619
|
strokeWidth: 3
|
|
2609
2620
|
})
|
|
2610
|
-
}), s.length > 0 && /* @__PURE__ */
|
|
2621
|
+
}), s.length > 0 && /* @__PURE__ */ V("span", {
|
|
2611
2622
|
className: "seed-fm-badge",
|
|
2612
2623
|
title: "Resized copies are grouped with this image",
|
|
2613
2624
|
children: [
|
|
2614
|
-
/* @__PURE__ */
|
|
2625
|
+
/* @__PURE__ */ B(Q, {
|
|
2615
2626
|
name: "layers",
|
|
2616
2627
|
size: 11,
|
|
2617
2628
|
strokeWidth: 2.2
|
|
@@ -2621,21 +2632,21 @@ function Vr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2621
2632
|
s.length === 1 ? "size" : "sizes"
|
|
2622
2633
|
]
|
|
2623
2634
|
})]
|
|
2624
|
-
}), /* @__PURE__ */
|
|
2635
|
+
}), /* @__PURE__ */ V("span", {
|
|
2625
2636
|
className: "seed-fm-tile-meta",
|
|
2626
|
-
children: [/* @__PURE__ */
|
|
2637
|
+
children: [/* @__PURE__ */ B("span", {
|
|
2627
2638
|
className: "seed-fm-tile-name",
|
|
2628
|
-
children:
|
|
2629
|
-
}), /* @__PURE__ */
|
|
2639
|
+
children: nr(o.name, 24)
|
|
2640
|
+
}), /* @__PURE__ */ V("span", {
|
|
2630
2641
|
className: "seed-fm-tile-sub",
|
|
2631
2642
|
children: [
|
|
2632
|
-
|
|
2643
|
+
Z(o.size),
|
|
2633
2644
|
" ·",
|
|
2634
2645
|
" ",
|
|
2635
|
-
/* @__PURE__ */
|
|
2646
|
+
/* @__PURE__ */ B("time", {
|
|
2636
2647
|
dateTime: new Date(o.lastModified).toISOString(),
|
|
2637
|
-
title:
|
|
2638
|
-
children:
|
|
2648
|
+
title: tr(o.lastModified),
|
|
2649
|
+
children: er(o.lastModified)
|
|
2639
2650
|
})
|
|
2640
2651
|
]
|
|
2641
2652
|
})]
|
|
@@ -2646,20 +2657,20 @@ function Vr({ entries: e, selected: t, onActivate: n, onToggle: r, className: i,
|
|
|
2646
2657
|
}
|
|
2647
2658
|
//#endregion
|
|
2648
2659
|
//#region src/OPFSFilesManager/FileList.tsx
|
|
2649
|
-
function
|
|
2660
|
+
function Ur({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onToggleAll: o, onDownload: c, onDelete: l, deleteActionFor: u, className: d, rowClassName: f }) {
|
|
2650
2661
|
let p = s(null), m = e.filter((e) => t.has(e.file.path)).length, h = e.length > 0 && m === e.length;
|
|
2651
2662
|
i(() => {
|
|
2652
2663
|
p.current && (p.current.indeterminate = m > 0 && !h);
|
|
2653
2664
|
}, [m, h]);
|
|
2654
2665
|
let g = n ? `${n}/` : "";
|
|
2655
|
-
return /* @__PURE__ */
|
|
2666
|
+
return /* @__PURE__ */ B("div", {
|
|
2656
2667
|
className: "seed-fm-list-wrap",
|
|
2657
|
-
children: /* @__PURE__ */
|
|
2668
|
+
children: /* @__PURE__ */ V("table", {
|
|
2658
2669
|
className: ["seed-fm-list", d].filter(Boolean).join(" "),
|
|
2659
|
-
children: [/* @__PURE__ */
|
|
2660
|
-
/* @__PURE__ */
|
|
2670
|
+
children: [/* @__PURE__ */ B("thead", { children: /* @__PURE__ */ V("tr", { children: [
|
|
2671
|
+
/* @__PURE__ */ B("th", {
|
|
2661
2672
|
style: { width: 28 },
|
|
2662
|
-
children: /* @__PURE__ */
|
|
2673
|
+
children: /* @__PURE__ */ B("input", {
|
|
2663
2674
|
ref: p,
|
|
2664
2675
|
type: "checkbox",
|
|
2665
2676
|
className: "seed-fm-checkbox",
|
|
@@ -2668,34 +2679,34 @@ function Hr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2668
2679
|
"aria-label": "Select all"
|
|
2669
2680
|
})
|
|
2670
2681
|
}),
|
|
2671
|
-
/* @__PURE__ */
|
|
2672
|
-
/* @__PURE__ */
|
|
2682
|
+
/* @__PURE__ */ B("th", { children: "Name" }),
|
|
2683
|
+
/* @__PURE__ */ B("th", {
|
|
2673
2684
|
className: "seed-fm-col-type",
|
|
2674
2685
|
children: "Type"
|
|
2675
2686
|
}),
|
|
2676
|
-
/* @__PURE__ */
|
|
2687
|
+
/* @__PURE__ */ B("th", {
|
|
2677
2688
|
className: "seed-fm-num seed-fm-col-size",
|
|
2678
2689
|
children: "Size"
|
|
2679
2690
|
}),
|
|
2680
|
-
/* @__PURE__ */
|
|
2691
|
+
/* @__PURE__ */ B("th", {
|
|
2681
2692
|
className: "seed-fm-col-modified",
|
|
2682
2693
|
children: "Modified"
|
|
2683
2694
|
}),
|
|
2684
|
-
/* @__PURE__ */
|
|
2695
|
+
/* @__PURE__ */ B("th", { children: /* @__PURE__ */ B("span", {
|
|
2685
2696
|
className: "seed-fm-visually-hidden",
|
|
2686
2697
|
children: "Actions"
|
|
2687
2698
|
}) })
|
|
2688
|
-
] }) }), /* @__PURE__ */
|
|
2699
|
+
] }) }), /* @__PURE__ */ B("tbody", { children: e.map((e, n) => {
|
|
2689
2700
|
let { file: i } = e, o = t.has(i.path), s = u(e);
|
|
2690
|
-
return /* @__PURE__ */
|
|
2701
|
+
return /* @__PURE__ */ V("tr", {
|
|
2691
2702
|
"data-path": i.path,
|
|
2692
2703
|
"aria-selected": o,
|
|
2693
2704
|
className: ["seed-fm-row", f].filter(Boolean).join(" "),
|
|
2694
2705
|
onClick: (t) => r(e, n, t),
|
|
2695
2706
|
children: [
|
|
2696
|
-
/* @__PURE__ */
|
|
2707
|
+
/* @__PURE__ */ B("td", {
|
|
2697
2708
|
onClick: (e) => e.stopPropagation(),
|
|
2698
|
-
children: /* @__PURE__ */
|
|
2709
|
+
children: /* @__PURE__ */ B("input", {
|
|
2699
2710
|
type: "checkbox",
|
|
2700
2711
|
className: "seed-fm-checkbox",
|
|
2701
2712
|
checked: o,
|
|
@@ -2704,61 +2715,61 @@ function Hr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2704
2715
|
"aria-label": `Select ${i.name}`
|
|
2705
2716
|
})
|
|
2706
2717
|
}),
|
|
2707
|
-
/* @__PURE__ */
|
|
2718
|
+
/* @__PURE__ */ B("td", { children: /* @__PURE__ */ V("span", {
|
|
2708
2719
|
className: "seed-fm-namecell",
|
|
2709
|
-
children: [/* @__PURE__ */
|
|
2720
|
+
children: [/* @__PURE__ */ B(Vr, {
|
|
2710
2721
|
entry: e,
|
|
2711
2722
|
size: "mini"
|
|
2712
|
-
}), /* @__PURE__ */
|
|
2723
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("button", {
|
|
2713
2724
|
type: "button",
|
|
2714
2725
|
className: "seed-fm-row-name seed-fm-row-open",
|
|
2715
2726
|
onClick: (t) => {
|
|
2716
2727
|
t.stopPropagation(), r(e, n, t);
|
|
2717
2728
|
},
|
|
2718
2729
|
children: i.name
|
|
2719
|
-
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */
|
|
2730
|
+
}), i.path.slice(g.length) !== i.name && /* @__PURE__ */ B("span", {
|
|
2720
2731
|
className: "seed-fm-row-path",
|
|
2721
2732
|
children: i.path.slice(g.length)
|
|
2722
2733
|
})] })]
|
|
2723
2734
|
}) }),
|
|
2724
|
-
/* @__PURE__ */
|
|
2735
|
+
/* @__PURE__ */ B("td", {
|
|
2725
2736
|
className: "seed-fm-col-type",
|
|
2726
|
-
children: /* @__PURE__ */
|
|
2737
|
+
children: /* @__PURE__ */ V("span", {
|
|
2727
2738
|
className: "seed-fm-type",
|
|
2728
|
-
style:
|
|
2729
|
-
children: [
|
|
2739
|
+
style: zr($(i)),
|
|
2740
|
+
children: [cr(i), i.detectedType && /* @__PURE__ */ B("small", { children: "detected" })]
|
|
2730
2741
|
})
|
|
2731
2742
|
}),
|
|
2732
|
-
/* @__PURE__ */
|
|
2743
|
+
/* @__PURE__ */ B("td", {
|
|
2733
2744
|
className: "seed-fm-num seed-fm-col-size",
|
|
2734
2745
|
title: `${i.size.toLocaleString()} bytes`,
|
|
2735
|
-
children:
|
|
2746
|
+
children: Z(e.totalSize)
|
|
2736
2747
|
}),
|
|
2737
|
-
/* @__PURE__ */
|
|
2748
|
+
/* @__PURE__ */ B("td", {
|
|
2738
2749
|
className: "seed-fm-when seed-fm-col-modified",
|
|
2739
|
-
title:
|
|
2740
|
-
children:
|
|
2750
|
+
title: tr(i.lastModified),
|
|
2751
|
+
children: er(i.lastModified)
|
|
2741
2752
|
}),
|
|
2742
|
-
/* @__PURE__ */
|
|
2753
|
+
/* @__PURE__ */ V("td", {
|
|
2743
2754
|
className: "seed-fm-actions",
|
|
2744
2755
|
onClick: (e) => e.stopPropagation(),
|
|
2745
|
-
children: [/* @__PURE__ */
|
|
2756
|
+
children: [/* @__PURE__ */ B("button", {
|
|
2746
2757
|
type: "button",
|
|
2747
2758
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2748
2759
|
"aria-label": `Download ${i.name}`,
|
|
2749
2760
|
title: "Download",
|
|
2750
2761
|
onClick: () => c(e),
|
|
2751
|
-
children: /* @__PURE__ */
|
|
2762
|
+
children: /* @__PURE__ */ B(Q, {
|
|
2752
2763
|
name: "download",
|
|
2753
2764
|
size: 15
|
|
2754
2765
|
})
|
|
2755
|
-
}), /* @__PURE__ */
|
|
2766
|
+
}), /* @__PURE__ */ B("button", {
|
|
2756
2767
|
type: "button",
|
|
2757
2768
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2758
2769
|
"aria-label": s.label ? `${s.label}: ${i.name}` : `Delete ${i.name}`,
|
|
2759
2770
|
title: s.label ?? "Delete",
|
|
2760
2771
|
onClick: () => l(e),
|
|
2761
|
-
children: /* @__PURE__ */
|
|
2772
|
+
children: /* @__PURE__ */ B(Q, {
|
|
2762
2773
|
name: "trash",
|
|
2763
2774
|
size: 15
|
|
2764
2775
|
})
|
|
@@ -2772,22 +2783,22 @@ function Hr({ entries: e, selected: t, cwd: n, onActivate: r, onToggle: a, onTog
|
|
|
2772
2783
|
}
|
|
2773
2784
|
//#endregion
|
|
2774
2785
|
//#region src/OPFSFilesManager/PreviewPanel.tsx
|
|
2775
|
-
var
|
|
2776
|
-
function
|
|
2777
|
-
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o =
|
|
2786
|
+
var Wr = 1048576, Gr = 32768;
|
|
2787
|
+
function Kr(e) {
|
|
2788
|
+
let [t, n] = c({ kind: "loading" }), { path: r, lastModified: a } = e.file, o = $(e.file), s = e.file.size;
|
|
2778
2789
|
return i(() => {
|
|
2779
2790
|
let e = !1, t = null;
|
|
2780
2791
|
return n({ kind: "loading" }), (async () => {
|
|
2781
|
-
if (o === "image") return t = URL.createObjectURL(await
|
|
2792
|
+
if (o === "image") return t = URL.createObjectURL(await zn(r)), {
|
|
2782
2793
|
kind: "image",
|
|
2783
2794
|
url: t
|
|
2784
2795
|
};
|
|
2785
2796
|
if (o === "json" || o === "html" || o === "text") {
|
|
2786
|
-
if (s >
|
|
2797
|
+
if (s > Wr) return {
|
|
2787
2798
|
kind: "none",
|
|
2788
2799
|
message: "This file is too large to preview."
|
|
2789
2800
|
};
|
|
2790
|
-
let e = await
|
|
2801
|
+
let e = await zn(r), t = e.size > Gr, n = await e.slice(0, Gr).text();
|
|
2791
2802
|
if (o === "json" && !t) try {
|
|
2792
2803
|
n = JSON.stringify(JSON.parse(n), null, 2);
|
|
2793
2804
|
} catch {}
|
|
@@ -2821,15 +2832,15 @@ function Gr(e) {
|
|
|
2821
2832
|
o
|
|
2822
2833
|
]), t;
|
|
2823
2834
|
}
|
|
2824
|
-
function
|
|
2825
|
-
let { file: f, variants: p } = e, m =
|
|
2835
|
+
function qr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onDelete: o, deleteAction: l, onCopyPath: u, className: d }) {
|
|
2836
|
+
let { file: f, variants: p } = e, m = $(f), h = Kr(e), [g, _] = c(null), [v, y] = c(!1), b = s(null);
|
|
2826
2837
|
i(() => {
|
|
2827
2838
|
_(null), y(!1);
|
|
2828
2839
|
}, [f.path]), i(() => {
|
|
2829
2840
|
b.current?.focus();
|
|
2830
2841
|
}, []);
|
|
2831
2842
|
let x = `seed-fm-panel-${encodeURIComponent(f.path)}`, S = p.reduce((e, t) => e + t.file.size, 0), C;
|
|
2832
|
-
if (h.kind === "image" && !v) C = /* @__PURE__ */
|
|
2843
|
+
if (h.kind === "image" && !v) C = /* @__PURE__ */ B("img", {
|
|
2833
2844
|
src: h.url,
|
|
2834
2845
|
alt: `Preview of ${f.name}`,
|
|
2835
2846
|
onLoad: (e) => _({
|
|
@@ -2838,144 +2849,144 @@ function Kr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2838
2849
|
}),
|
|
2839
2850
|
onError: () => y(!0)
|
|
2840
2851
|
});
|
|
2841
|
-
else if (h.kind === "text") C = /* @__PURE__ */
|
|
2852
|
+
else if (h.kind === "text") C = /* @__PURE__ */ V("pre", { children: [h.text, h.truncated && "\n…"] });
|
|
2842
2853
|
else if (h.kind === "loading") C = null;
|
|
2843
2854
|
else {
|
|
2844
2855
|
let e = h.kind === "none" ? h.message : "The browser can’t decode this image. The file may be corrupt or not an image.";
|
|
2845
|
-
C = /* @__PURE__ */
|
|
2856
|
+
C = /* @__PURE__ */ V("span", {
|
|
2846
2857
|
className: "seed-fm-preview-note",
|
|
2847
|
-
children: [/* @__PURE__ */
|
|
2848
|
-
name: v ? "imageOff" :
|
|
2858
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2859
|
+
name: v ? "imageOff" : Rr[m].icon,
|
|
2849
2860
|
size: 32,
|
|
2850
2861
|
strokeWidth: 1.5
|
|
2851
2862
|
}), e]
|
|
2852
2863
|
});
|
|
2853
2864
|
}
|
|
2854
|
-
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(
|
|
2855
|
-
return /* @__PURE__ */
|
|
2865
|
+
let w = h.kind === "image" && !v && /png|webp|gif|avif|svg/.test(cr(f));
|
|
2866
|
+
return /* @__PURE__ */ V("aside", {
|
|
2856
2867
|
className: ["seed-fm-panel", d].filter(Boolean).join(" "),
|
|
2857
2868
|
role: "dialog",
|
|
2858
2869
|
"aria-modal": "false",
|
|
2859
2870
|
"aria-labelledby": x,
|
|
2860
2871
|
children: [
|
|
2861
|
-
/* @__PURE__ */
|
|
2872
|
+
/* @__PURE__ */ V("div", {
|
|
2862
2873
|
className: "seed-fm-panel-head",
|
|
2863
2874
|
children: [
|
|
2864
|
-
/* @__PURE__ */
|
|
2875
|
+
/* @__PURE__ */ B("h3", {
|
|
2865
2876
|
id: x,
|
|
2866
2877
|
title: f.name,
|
|
2867
2878
|
children: f.name
|
|
2868
2879
|
}),
|
|
2869
|
-
/* @__PURE__ */
|
|
2880
|
+
/* @__PURE__ */ B("button", {
|
|
2870
2881
|
type: "button",
|
|
2871
2882
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2872
2883
|
"aria-label": "Previous file",
|
|
2873
2884
|
disabled: !n,
|
|
2874
2885
|
onClick: n ?? void 0,
|
|
2875
|
-
children: /* @__PURE__ */
|
|
2886
|
+
children: /* @__PURE__ */ B(Q, { name: "chevronLeft" })
|
|
2876
2887
|
}),
|
|
2877
|
-
/* @__PURE__ */
|
|
2888
|
+
/* @__PURE__ */ B("button", {
|
|
2878
2889
|
type: "button",
|
|
2879
2890
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2880
2891
|
"aria-label": "Next file",
|
|
2881
2892
|
disabled: !r,
|
|
2882
2893
|
onClick: r ?? void 0,
|
|
2883
|
-
children: /* @__PURE__ */
|
|
2894
|
+
children: /* @__PURE__ */ B(Q, { name: "chevronRight" })
|
|
2884
2895
|
}),
|
|
2885
|
-
/* @__PURE__ */
|
|
2896
|
+
/* @__PURE__ */ B("button", {
|
|
2886
2897
|
ref: b,
|
|
2887
2898
|
type: "button",
|
|
2888
2899
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2889
2900
|
"aria-label": "Close details",
|
|
2890
2901
|
onClick: t,
|
|
2891
|
-
children: /* @__PURE__ */
|
|
2902
|
+
children: /* @__PURE__ */ B(Q, { name: "x" })
|
|
2892
2903
|
})
|
|
2893
2904
|
]
|
|
2894
2905
|
}),
|
|
2895
|
-
/* @__PURE__ */
|
|
2906
|
+
/* @__PURE__ */ V("div", {
|
|
2896
2907
|
className: "seed-fm-panel-body",
|
|
2897
2908
|
children: [
|
|
2898
|
-
/* @__PURE__ */
|
|
2909
|
+
/* @__PURE__ */ B("div", {
|
|
2899
2910
|
className: [
|
|
2900
2911
|
"seed-fm-preview",
|
|
2901
2912
|
w ? "seed-fm-thumb--checker" : "",
|
|
2902
2913
|
h.kind === "loading" ? "seed-fm-skeleton" : ""
|
|
2903
2914
|
].filter(Boolean).join(" "),
|
|
2904
|
-
style:
|
|
2915
|
+
style: zr(m),
|
|
2905
2916
|
children: C
|
|
2906
2917
|
}),
|
|
2907
|
-
/* @__PURE__ */
|
|
2918
|
+
/* @__PURE__ */ V("dl", {
|
|
2908
2919
|
className: "seed-fm-details",
|
|
2909
2920
|
children: [
|
|
2910
|
-
/* @__PURE__ */
|
|
2911
|
-
/* @__PURE__ */
|
|
2921
|
+
/* @__PURE__ */ B("dt", { children: "Path" }),
|
|
2922
|
+
/* @__PURE__ */ B("dd", { children: /* @__PURE__ */ V("span", {
|
|
2912
2923
|
className: "seed-fm-path",
|
|
2913
|
-
children: [/* @__PURE__ */
|
|
2924
|
+
children: [/* @__PURE__ */ B("code", { children: f.path }), /* @__PURE__ */ B("button", {
|
|
2914
2925
|
type: "button",
|
|
2915
2926
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon",
|
|
2916
2927
|
"aria-label": "Copy path",
|
|
2917
2928
|
title: "Copy path",
|
|
2918
2929
|
onClick: u,
|
|
2919
|
-
children: /* @__PURE__ */
|
|
2930
|
+
children: /* @__PURE__ */ B(Q, {
|
|
2920
2931
|
name: "copy",
|
|
2921
2932
|
size: 13
|
|
2922
2933
|
})
|
|
2923
2934
|
})]
|
|
2924
2935
|
}) }),
|
|
2925
|
-
/* @__PURE__ */
|
|
2926
|
-
/* @__PURE__ */
|
|
2927
|
-
|
|
2936
|
+
/* @__PURE__ */ B("dt", { children: "Size" }),
|
|
2937
|
+
/* @__PURE__ */ V("dd", { children: [
|
|
2938
|
+
Z(f.size),
|
|
2928
2939
|
" ",
|
|
2929
|
-
/* @__PURE__ */
|
|
2940
|
+
/* @__PURE__ */ V("small", { children: [f.size.toLocaleString(), " bytes"] })
|
|
2930
2941
|
] }),
|
|
2931
|
-
/* @__PURE__ */
|
|
2932
|
-
/* @__PURE__ */
|
|
2942
|
+
/* @__PURE__ */ B("dt", { children: "Type" }),
|
|
2943
|
+
/* @__PURE__ */ V("dd", { children: [cr(f), f.detectedType && /* @__PURE__ */ V("small", { children: [
|
|
2933
2944
|
" from file contents. File.type is “",
|
|
2934
2945
|
f.type,
|
|
2935
2946
|
"”"
|
|
2936
2947
|
] })] }),
|
|
2937
|
-
g && /* @__PURE__ */
|
|
2948
|
+
g && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("dt", { children: "Dimensions" }), /* @__PURE__ */ V("dd", { children: [
|
|
2938
2949
|
g.width.toLocaleString(),
|
|
2939
2950
|
" × ",
|
|
2940
2951
|
g.height.toLocaleString(),
|
|
2941
2952
|
" px"
|
|
2942
2953
|
] })] }),
|
|
2943
|
-
/* @__PURE__ */
|
|
2944
|
-
/* @__PURE__ */
|
|
2945
|
-
|
|
2954
|
+
/* @__PURE__ */ B("dt", { children: "Modified" }),
|
|
2955
|
+
/* @__PURE__ */ V("dd", { children: [
|
|
2956
|
+
tr(f.lastModified),
|
|
2946
2957
|
" ",
|
|
2947
|
-
/* @__PURE__ */
|
|
2958
|
+
/* @__PURE__ */ B("small", { children: er(f.lastModified) })
|
|
2948
2959
|
] })
|
|
2949
2960
|
]
|
|
2950
2961
|
}),
|
|
2951
|
-
p.length > 0 && /* @__PURE__ */
|
|
2962
|
+
p.length > 0 && /* @__PURE__ */ V("div", { children: [/* @__PURE__ */ V("div", {
|
|
2952
2963
|
className: "seed-fm-section-label",
|
|
2953
|
-
children: ["Resized copies · ",
|
|
2954
|
-
}), /* @__PURE__ */
|
|
2964
|
+
children: ["Resized copies · ", Z(S)]
|
|
2965
|
+
}), /* @__PURE__ */ B("ul", {
|
|
2955
2966
|
className: "seed-fm-variants",
|
|
2956
|
-
children: p.map((e) => /* @__PURE__ */
|
|
2967
|
+
children: p.map((e) => /* @__PURE__ */ V("li", {
|
|
2957
2968
|
title: e.file.path,
|
|
2958
|
-
children: [/* @__PURE__ */
|
|
2969
|
+
children: [/* @__PURE__ */ V("span", { children: [e.width, "w · webp"] }), /* @__PURE__ */ B("span", { children: Z(e.file.size) })]
|
|
2959
2970
|
}, e.file.path))
|
|
2960
2971
|
})] })
|
|
2961
2972
|
]
|
|
2962
2973
|
}),
|
|
2963
|
-
/* @__PURE__ */
|
|
2974
|
+
/* @__PURE__ */ V("div", {
|
|
2964
2975
|
className: "seed-fm-panel-foot",
|
|
2965
|
-
children: [/* @__PURE__ */
|
|
2976
|
+
children: [/* @__PURE__ */ V("button", {
|
|
2966
2977
|
type: "button",
|
|
2967
2978
|
className: "seed-fm-btn seed-fm-btn--primary",
|
|
2968
2979
|
onClick: a,
|
|
2969
|
-
children: [/* @__PURE__ */
|
|
2980
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
2970
2981
|
name: "download",
|
|
2971
2982
|
size: 15
|
|
2972
2983
|
}), " Download"]
|
|
2973
|
-
}), /* @__PURE__ */
|
|
2984
|
+
}), /* @__PURE__ */ V("button", {
|
|
2974
2985
|
type: "button",
|
|
2975
2986
|
className: `seed-fm-btn${l.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
2976
2987
|
onClick: o,
|
|
2977
2988
|
children: [
|
|
2978
|
-
/* @__PURE__ */
|
|
2989
|
+
/* @__PURE__ */ B(Q, {
|
|
2979
2990
|
name: "trash",
|
|
2980
2991
|
size: 15
|
|
2981
2992
|
}),
|
|
@@ -2989,18 +3000,18 @@ function Kr({ entry: e, onClose: t, onPrevious: n, onNext: r, onDownload: a, onD
|
|
|
2989
3000
|
}
|
|
2990
3001
|
//#endregion
|
|
2991
3002
|
//#region src/OPFSFilesManager/styles.ts
|
|
2992
|
-
var
|
|
3003
|
+
var Jr = "seed-opfs-files-manager-styles", Yr = "seed-opfs-files-manager", Xr = "\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", Zr = "\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", Qr = `@layer ${Yr} {\n${`
|
|
2993
3004
|
.seed-fm {
|
|
2994
|
-
${
|
|
3005
|
+
${Xr}
|
|
2995
3006
|
--seed-radius-sm: 6px;
|
|
2996
3007
|
--seed-radius-md: 8px;
|
|
2997
3008
|
--seed-radius-lg: 12px;
|
|
2998
3009
|
--seed-font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
|
|
2999
3010
|
color-scheme: light;
|
|
3000
3011
|
}
|
|
3001
|
-
.seed-fm[data-seed-theme="dark"] { ${
|
|
3012
|
+
.seed-fm[data-seed-theme="dark"] { ${Zr} }
|
|
3002
3013
|
@media (prefers-color-scheme: dark) {
|
|
3003
|
-
.seed-fm[data-seed-theme="system"] { ${
|
|
3014
|
+
.seed-fm[data-seed-theme="system"] { ${Zr} }
|
|
3004
3015
|
}
|
|
3005
3016
|
|
|
3006
3017
|
.seed-fm { position: relative; color: var(--seed-fg); background: var(--seed-bg); font-family: inherit; font-size: 14px; line-height: 1.45; }
|
|
@@ -3208,14 +3219,14 @@ var qr = "seed-opfs-files-manager-styles", Jr = "seed-opfs-files-manager", Yr =
|
|
|
3208
3219
|
.seed-fm-thumb img { transition: none; }
|
|
3209
3220
|
}
|
|
3210
3221
|
`}\n}`;
|
|
3211
|
-
function
|
|
3222
|
+
function $r() {
|
|
3212
3223
|
if (typeof document > "u" || document.getElementById("seed-opfs-files-manager-styles")) return;
|
|
3213
3224
|
let e = document.createElement("style");
|
|
3214
|
-
e.id =
|
|
3225
|
+
e.id = Jr, e.textContent = Qr, document.head.appendChild(e);
|
|
3215
3226
|
}
|
|
3216
3227
|
//#endregion
|
|
3217
3228
|
//#region src/OPFSFilesManager/useStorageEstimate.ts
|
|
3218
|
-
function
|
|
3229
|
+
function ei(e) {
|
|
3219
3230
|
let [t, n] = c(null);
|
|
3220
3231
|
return i(() => {
|
|
3221
3232
|
if (typeof navigator > "u" || typeof navigator.storage?.estimate != "function") return;
|
|
@@ -3232,40 +3243,40 @@ function $r(e) {
|
|
|
3232
3243
|
}
|
|
3233
3244
|
//#endregion
|
|
3234
3245
|
//#region src/OPFSFilesManager/zip.ts
|
|
3235
|
-
var
|
|
3236
|
-
function
|
|
3237
|
-
if (
|
|
3238
|
-
|
|
3246
|
+
var ti = null;
|
|
3247
|
+
function ni() {
|
|
3248
|
+
if (ti) return ti;
|
|
3249
|
+
ti = /* @__PURE__ */ new Uint32Array(256);
|
|
3239
3250
|
for (let e = 0; e < 256; e++) {
|
|
3240
3251
|
let t = e;
|
|
3241
3252
|
for (let e = 0; e < 8; e++) t = t & 1 ? 3988292384 ^ t >>> 1 : t >>> 1;
|
|
3242
|
-
|
|
3253
|
+
ti[e] = t >>> 0;
|
|
3243
3254
|
}
|
|
3244
|
-
return
|
|
3255
|
+
return ti;
|
|
3245
3256
|
}
|
|
3246
|
-
function
|
|
3247
|
-
let t =
|
|
3257
|
+
function ri(e) {
|
|
3258
|
+
let t = ni(), n = 4294967295;
|
|
3248
3259
|
for (let r = 0; r < e.length; r++) n = t[(n ^ e[r]) & 255] ^ n >>> 8;
|
|
3249
3260
|
return (n ^ 4294967295) >>> 0;
|
|
3250
3261
|
}
|
|
3251
|
-
function
|
|
3262
|
+
function ii(e) {
|
|
3252
3263
|
let t = new Date(e), n = Math.max(1980, t.getFullYear());
|
|
3253
3264
|
return {
|
|
3254
3265
|
time: t.getHours() << 11 | t.getMinutes() << 5 | Math.floor(t.getSeconds() / 2),
|
|
3255
3266
|
date: n - 1980 << 9 | t.getMonth() + 1 << 5 | t.getDate()
|
|
3256
3267
|
};
|
|
3257
3268
|
}
|
|
3258
|
-
var
|
|
3259
|
-
async function
|
|
3269
|
+
var ai = 2048, oi = 4294967295;
|
|
3270
|
+
async function si(e) {
|
|
3260
3271
|
if (e.length > 65535) throw Error("Too many files for a ZIP archive (max 65,535).");
|
|
3261
3272
|
let t = new TextEncoder(), n = [], r = [], i = 0;
|
|
3262
3273
|
for (let a of e) {
|
|
3263
|
-
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s =
|
|
3264
|
-
if (i + o.length + 30 + e.length >
|
|
3274
|
+
let e = t.encode(a.name), o = new Uint8Array(await a.data.arrayBuffer()), s = ri(o), { time: c, date: l } = ii(a.lastModified ?? Date.now());
|
|
3275
|
+
if (i + o.length + 30 + e.length > oi) throw Error("Selection is too large for a ZIP archive (max 4 GB).");
|
|
3265
3276
|
let u = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(30));
|
|
3266
|
-
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6,
|
|
3277
|
+
u.setUint32(0, 67324752, !0), u.setUint16(4, 20, !0), u.setUint16(6, ai, !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);
|
|
3267
3278
|
let d = /* @__PURE__ */ new DataView(/* @__PURE__ */ new ArrayBuffer(46));
|
|
3268
|
-
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8,
|
|
3279
|
+
d.setUint32(0, 33639248, !0), d.setUint16(4, 20, !0), d.setUint16(6, 20, !0), d.setUint16(8, ai, !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);
|
|
3269
3280
|
let f = new Uint8Array(46 + e.length);
|
|
3270
3281
|
f.set(new Uint8Array(d.buffer), 0), f.set(e, 46), r.push(f), i += 30 + e.length + o.length;
|
|
3271
3282
|
}
|
|
@@ -3278,12 +3289,12 @@ async function oi(e) {
|
|
|
3278
3289
|
}
|
|
3279
3290
|
//#endregion
|
|
3280
3291
|
//#region src/OPFSFilesManager/OPFSFilesManager.tsx
|
|
3281
|
-
var
|
|
3282
|
-
function
|
|
3292
|
+
var ci = "Everything this app stores in the browser’s private file system (OPFS).", li = 4e3, ui = (e) => e instanceof Error ? e.message : String(e), di = (e, t, n = `${t}s`) => `${e} ${e === 1 ? t : n}`, fi = (e) => (e ?? "").split("/").filter(Boolean).join("/");
|
|
3293
|
+
function pi(e, t) {
|
|
3283
3294
|
let n = URL.createObjectURL(t), r = document.createElement("a");
|
|
3284
3295
|
r.href = n, r.download = e, document.body.appendChild(r), r.click(), r.remove(), setTimeout(() => URL.revokeObjectURL(n), 1e3);
|
|
3285
3296
|
}
|
|
3286
|
-
function
|
|
3297
|
+
function mi() {
|
|
3287
3298
|
let [e, t] = c([]), r = s(/* @__PURE__ */ new Set());
|
|
3288
3299
|
return i(() => {
|
|
3289
3300
|
let e = r.current;
|
|
@@ -3299,12 +3310,12 @@ function pi() {
|
|
|
3299
3310
|
}]);
|
|
3300
3311
|
let a = setTimeout(() => {
|
|
3301
3312
|
r.current.delete(a), t((e) => e.filter((e) => e.id !== i));
|
|
3302
|
-
},
|
|
3313
|
+
}, li);
|
|
3303
3314
|
r.current.add(a);
|
|
3304
3315
|
}, [])
|
|
3305
3316
|
};
|
|
3306
3317
|
}
|
|
3307
|
-
var
|
|
3318
|
+
var hi = [
|
|
3308
3319
|
"image",
|
|
3309
3320
|
"database",
|
|
3310
3321
|
"json",
|
|
@@ -3312,195 +3323,195 @@ var mi = [
|
|
|
3312
3323
|
"text",
|
|
3313
3324
|
"other"
|
|
3314
3325
|
];
|
|
3315
|
-
function
|
|
3316
|
-
let n =
|
|
3317
|
-
label:
|
|
3326
|
+
function gi({ files: e, estimate: t }) {
|
|
3327
|
+
let n = xr(e), r = e.reduce((e, t) => e + t.size, 0), i = t ? Math.max(0, t.usage - r) : 0, a = r + i, o = [...hi.filter((e) => n[e] > 0).map((e) => ({
|
|
3328
|
+
label: Rr[e].label,
|
|
3318
3329
|
size: n[e],
|
|
3319
|
-
color:
|
|
3330
|
+
color: Rr[e].color
|
|
3320
3331
|
})), ...i > 0 ? [{
|
|
3321
3332
|
label: "Other site data",
|
|
3322
3333
|
size: i,
|
|
3323
3334
|
color: "var(--seed-border-strong)"
|
|
3324
3335
|
}] : []];
|
|
3325
|
-
return /* @__PURE__ */
|
|
3336
|
+
return /* @__PURE__ */ V("div", {
|
|
3326
3337
|
className: "seed-fm-usage",
|
|
3327
3338
|
title: "From navigator.storage.estimate(). Browsers round these numbers.",
|
|
3328
|
-
children: [/* @__PURE__ */
|
|
3339
|
+
children: [/* @__PURE__ */ V("div", {
|
|
3329
3340
|
className: "seed-fm-usage-row",
|
|
3330
|
-
children: [/* @__PURE__ */
|
|
3331
|
-
/* @__PURE__ */
|
|
3341
|
+
children: [/* @__PURE__ */ V("span", { children: [
|
|
3342
|
+
/* @__PURE__ */ B("strong", { children: Z(t ? t.usage : r) }),
|
|
3332
3343
|
" ",
|
|
3333
|
-
t ? "used by this site" : `in ${
|
|
3334
|
-
] }), t && /* @__PURE__ */
|
|
3335
|
-
}), a > 0 && /* @__PURE__ */
|
|
3344
|
+
t ? "used by this site" : `in ${di(e.length, "file")}`
|
|
3345
|
+
] }), t && /* @__PURE__ */ V("span", { children: [Z(t.quota), " available"] })]
|
|
3346
|
+
}), a > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3336
3347
|
className: "seed-fm-meter",
|
|
3337
3348
|
role: "img",
|
|
3338
3349
|
"aria-label": "Storage used, by file type",
|
|
3339
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3350
|
+
children: o.map((e) => /* @__PURE__ */ B("span", { style: {
|
|
3340
3351
|
width: `${e.size / a * 100}%`,
|
|
3341
3352
|
background: e.color
|
|
3342
3353
|
} }, e.label))
|
|
3343
|
-
}), /* @__PURE__ */
|
|
3354
|
+
}), /* @__PURE__ */ B("ul", {
|
|
3344
3355
|
className: "seed-fm-legend",
|
|
3345
|
-
children: o.map((e) => /* @__PURE__ */
|
|
3356
|
+
children: o.map((e) => /* @__PURE__ */ V("li", {
|
|
3346
3357
|
style: { "--seed-swatch": e.color },
|
|
3347
3358
|
children: [
|
|
3348
3359
|
e.label,
|
|
3349
3360
|
" ",
|
|
3350
|
-
|
|
3361
|
+
Z(e.size)
|
|
3351
3362
|
]
|
|
3352
3363
|
}, e.label))
|
|
3353
3364
|
})] })]
|
|
3354
3365
|
});
|
|
3355
3366
|
}
|
|
3356
|
-
function
|
|
3357
|
-
return /* @__PURE__ */
|
|
3367
|
+
function _i({ icon: e, title: t, children: n, tone: r, action: i }) {
|
|
3368
|
+
return /* @__PURE__ */ V("div", {
|
|
3358
3369
|
className: `seed-fm-state${r === "error" ? " seed-fm-state--error" : ""}`,
|
|
3359
3370
|
role: r === "error" ? "alert" : void 0,
|
|
3360
3371
|
children: [
|
|
3361
|
-
/* @__PURE__ */
|
|
3372
|
+
/* @__PURE__ */ B("span", {
|
|
3362
3373
|
className: "seed-fm-state-icon",
|
|
3363
|
-
children: /* @__PURE__ */
|
|
3374
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3364
3375
|
name: e,
|
|
3365
3376
|
size: 22
|
|
3366
3377
|
})
|
|
3367
3378
|
}),
|
|
3368
|
-
/* @__PURE__ */
|
|
3369
|
-
/* @__PURE__ */
|
|
3379
|
+
/* @__PURE__ */ B("h3", { children: t }),
|
|
3380
|
+
/* @__PURE__ */ B("p", { children: n }),
|
|
3370
3381
|
i
|
|
3371
3382
|
]
|
|
3372
3383
|
});
|
|
3373
3384
|
}
|
|
3374
|
-
function
|
|
3385
|
+
function vi({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDownload: l, title: u = "Files", description: d = ci, headingLevel: f = 2, theme: p = "system", className: m, classNames: h = {}, defaultView: g, groupImageVariants: _ = !0, deleteWarning: v = Sr, confirmDelete: y, deleteAction: b, onNotify: x }) {
|
|
3375
3386
|
a(() => {
|
|
3376
|
-
p !== "none" &&
|
|
3387
|
+
p !== "none" && $r();
|
|
3377
3388
|
}, [p]);
|
|
3378
|
-
let S =
|
|
3379
|
-
i(() =>
|
|
3380
|
-
let
|
|
3381
|
-
i(() =>
|
|
3382
|
-
let [
|
|
3383
|
-
x ? x(e, t, n) :
|
|
3384
|
-
},
|
|
3385
|
-
query:
|
|
3386
|
-
sort:
|
|
3389
|
+
let S = fi(e), C = S ? S.split("/").pop() : "OPFS", w = (e, t) => [t, h[e]].filter(Boolean).join(" "), { files: T, isLoading: ee, hasLoaded: E, error: te, errorName: ne, refetch: D } = Yn({ rootPath: e }), re = o(() => t ? T.filter(t) : T, [T, t]), ie = ei(T), [O, ae] = c(_);
|
|
3390
|
+
i(() => ae(_), [_]);
|
|
3391
|
+
let oe = o(() => _r(re, O), [re, O]), [k, se] = c(S);
|
|
3392
|
+
i(() => se(S), [S]);
|
|
3393
|
+
let [A, ce] = c(""), [le, j] = c("name"), [ue, de] = c(g), [M, N] = c(() => /* @__PURE__ */ new Set()), fe = s(null), [pe, me] = c(null), he = s(null), [P, ge] = c(null), [F, _e] = c(null), [I, L] = c(!1), { toasts: ve, showToast: ye } = mi(), be = (e, t, n) => {
|
|
3394
|
+
x ? x(e, t, n) : ye(e, t);
|
|
3395
|
+
}, xe = o(() => yr(oe, k, {
|
|
3396
|
+
query: A,
|
|
3397
|
+
sort: le
|
|
3387
3398
|
}), [
|
|
3388
|
-
|
|
3399
|
+
oe,
|
|
3400
|
+
k,
|
|
3389
3401
|
A,
|
|
3390
|
-
|
|
3391
|
-
|
|
3392
|
-
]), z = be.entries, xe = z.length ? z.filter((e) => cr(e.file) === "image").length / z.length : 0, Se = le ?? (xe >= .5 ? "grid" : "list"), Ce = o(() => new Map(ae.map((e) => [e.file.path, e])), [ae]), U = o(() => [...N].map((e) => Ce.get(e)).filter((e) => !!e), [N, Ce]), W = fe ? Ce.get(fe) ?? null : null, G = W ? z.indexOf(W) : -1;
|
|
3402
|
+
le
|
|
3403
|
+
]), R = xe.entries, Se = R.length ? R.filter((e) => $(e.file) === "image").length / R.length : 0, Ce = ue ?? (Se >= .5 ? "grid" : "list"), we = o(() => new Map(oe.map((e) => [e.file.path, e])), [oe]), H = o(() => [...M].map((e) => we.get(e)).filter((e) => !!e), [M, we]), U = pe ? we.get(pe) ?? null : null, W = U ? R.indexOf(U) : -1;
|
|
3393
3404
|
i(() => {
|
|
3394
|
-
|
|
3395
|
-
let t = new Set([...e].filter((e) =>
|
|
3405
|
+
N((e) => {
|
|
3406
|
+
let t = new Set([...e].filter((e) => we.has(e)));
|
|
3396
3407
|
return t.size === e.size ? e : t;
|
|
3397
3408
|
});
|
|
3398
|
-
}, [
|
|
3399
|
-
let
|
|
3400
|
-
|
|
3401
|
-
},
|
|
3402
|
-
let r =
|
|
3403
|
-
|
|
3409
|
+
}, [we]);
|
|
3410
|
+
let Te = (e) => {
|
|
3411
|
+
se(e), ce(""), N(/* @__PURE__ */ new Set()), fe.current = null, me(null);
|
|
3412
|
+
}, G = (e, t, n) => {
|
|
3413
|
+
let r = fe.current;
|
|
3414
|
+
N((i) => {
|
|
3404
3415
|
let a = new Set(i);
|
|
3405
3416
|
if (n && r != null) {
|
|
3406
3417
|
let [e, n] = r < t ? [r, t] : [t, r];
|
|
3407
|
-
for (let t of
|
|
3418
|
+
for (let t of R.slice(e, n + 1)) a.add(t.file.path);
|
|
3408
3419
|
} else a.has(e.file.path) ? a.delete(e.file.path) : a.add(e.file.path);
|
|
3409
3420
|
return a;
|
|
3410
|
-
}), (!n || r == null) && (
|
|
3411
|
-
},
|
|
3412
|
-
|
|
3413
|
-
},
|
|
3414
|
-
|
|
3415
|
-
},
|
|
3421
|
+
}), (!n || r == null) && (fe.current = t);
|
|
3422
|
+
}, Ee = (e) => {
|
|
3423
|
+
pe || (he.current = document.activeElement), me(e);
|
|
3424
|
+
}, De = () => {
|
|
3425
|
+
me(null), he.current?.focus?.(), he.current = null;
|
|
3426
|
+
}, Oe = (e, t, n) => {
|
|
3416
3427
|
let r = n.shiftKey || n.metaKey || n.ctrlKey;
|
|
3417
|
-
|
|
3418
|
-
},
|
|
3419
|
-
let e =
|
|
3420
|
-
|
|
3428
|
+
M.size > 0 || r ? G(e, t, n.shiftKey) : Ee(e.file.path);
|
|
3429
|
+
}, ke = () => {
|
|
3430
|
+
let e = R.every((e) => M.has(e.file.path));
|
|
3431
|
+
N((t) => {
|
|
3421
3432
|
let n = new Set(t);
|
|
3422
|
-
for (let t of
|
|
3433
|
+
for (let t of R) e ? n.delete(t.file.path) : n.add(t.file.path);
|
|
3423
3434
|
return n;
|
|
3424
3435
|
});
|
|
3425
|
-
},
|
|
3426
|
-
l ? await l(e, t) :
|
|
3427
|
-
},
|
|
3436
|
+
}, Ae = (e) => S && e.startsWith(`${S}/`) ? e.slice(S.length + 1) : e, je = async (e, t) => {
|
|
3437
|
+
l ? await l(e, t) : pi(e.name, t);
|
|
3438
|
+
}, Me = async (e, t) => {
|
|
3428
3439
|
if (e.length === 0) return !1;
|
|
3429
|
-
|
|
3440
|
+
L(!0);
|
|
3430
3441
|
try {
|
|
3431
3442
|
if (e.length === 1 && !t) {
|
|
3432
3443
|
let [t] = e;
|
|
3433
|
-
return await
|
|
3444
|
+
return await je(t, await zn(t.path)), !0;
|
|
3434
3445
|
}
|
|
3435
|
-
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await
|
|
3436
|
-
name: t ? e.path.slice(n.length) :
|
|
3437
|
-
data: await
|
|
3446
|
+
let n = t ? t.path.slice(0, t.path.length - t.name.length) : "", r = await si(await Promise.all(e.map(async (e) => ({
|
|
3447
|
+
name: t ? e.path.slice(n.length) : Ae(e.path),
|
|
3448
|
+
data: await zn(e.path),
|
|
3438
3449
|
lastModified: e.lastModified
|
|
3439
3450
|
})))), i = `${t ? t.name : C}-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.zip`;
|
|
3440
|
-
return await
|
|
3451
|
+
return await je({
|
|
3441
3452
|
name: i,
|
|
3442
3453
|
path: i,
|
|
3443
3454
|
size: r.size,
|
|
3444
3455
|
type: "application/zip",
|
|
3445
3456
|
lastModified: Date.now()
|
|
3446
|
-
}, r),
|
|
3457
|
+
}, r), be(`Saved ${i} with ${di(e.length, "file")}`, "success", {
|
|
3447
3458
|
kind: "download",
|
|
3448
3459
|
paths: e.map((e) => e.path),
|
|
3449
3460
|
fileName: i
|
|
3450
3461
|
}), !0;
|
|
3451
3462
|
} catch (t) {
|
|
3452
|
-
return
|
|
3463
|
+
return be(`Couldn’t download: ${ui(t)}`, "error", {
|
|
3453
3464
|
kind: "download",
|
|
3454
3465
|
paths: e.map((e) => e.path),
|
|
3455
|
-
error:
|
|
3466
|
+
error: ui(t)
|
|
3456
3467
|
}), !1;
|
|
3457
3468
|
} finally {
|
|
3458
|
-
|
|
3469
|
+
L(!1);
|
|
3459
3470
|
}
|
|
3460
|
-
},
|
|
3471
|
+
}, Ne = (e) => Me(e.map((e) => e.file)), K = (e, t) => e.flatMap((e) => [e.file, ...t ? e.variants.map((e) => e.file) : []]), q = (e) => {
|
|
3461
3472
|
let t = b?.(e);
|
|
3462
3473
|
return {
|
|
3463
3474
|
label: t?.label,
|
|
3464
3475
|
destructive: t?.destructive !== !1
|
|
3465
3476
|
};
|
|
3466
|
-
},
|
|
3467
|
-
|
|
3477
|
+
}, J = (e) => q(K(e, !0)), Pe = async (e, t) => {
|
|
3478
|
+
L(!0);
|
|
3468
3479
|
let i = [], a = [], o = [], s = !1;
|
|
3469
3480
|
try {
|
|
3470
3481
|
let r = await navigator.storage.getDirectory();
|
|
3471
3482
|
for (let t of e) if (n && !await n(t)) o.push(t.path);
|
|
3472
3483
|
else try {
|
|
3473
|
-
await
|
|
3484
|
+
await Bn(t.path, r), i.push(t.path);
|
|
3474
3485
|
} catch (e) {
|
|
3475
3486
|
a.push({
|
|
3476
3487
|
path: t.path,
|
|
3477
|
-
error:
|
|
3488
|
+
error: ui(e)
|
|
3478
3489
|
});
|
|
3479
3490
|
}
|
|
3480
3491
|
if (t) try {
|
|
3481
|
-
s = await
|
|
3492
|
+
s = await Hn(t.path, r);
|
|
3482
3493
|
} catch (e) {
|
|
3483
3494
|
a.push({
|
|
3484
3495
|
path: t.path,
|
|
3485
|
-
error:
|
|
3496
|
+
error: ui(e)
|
|
3486
3497
|
});
|
|
3487
3498
|
}
|
|
3488
3499
|
} catch (e) {
|
|
3489
3500
|
a.push({
|
|
3490
3501
|
path: "",
|
|
3491
|
-
error:
|
|
3502
|
+
error: ui(e)
|
|
3492
3503
|
});
|
|
3493
3504
|
}
|
|
3494
|
-
|
|
3505
|
+
N((e) => {
|
|
3495
3506
|
let t = new Set(e);
|
|
3496
3507
|
return i.forEach((e) => t.delete(e)), t;
|
|
3497
|
-
}),
|
|
3498
|
-
let c = [s ? `Deleted the ${t.name} folder (${
|
|
3508
|
+
}), pe && i.includes(pe) && me(null), await D(), L(!1);
|
|
3509
|
+
let c = [s ? `Deleted the ${t.name} folder (${di(i.length, "file")})` : i.length > 0 ? `Deleted ${di(i.length, "file")}` : "Nothing deleted"];
|
|
3499
3510
|
if (o.length && c.push(`${o.length} kept by onBeforeDelete`), a.length) {
|
|
3500
3511
|
let e = a.map((e) => e.path ? `${e.path.split("/").pop()}: ${e.error}` : e.error);
|
|
3501
3512
|
c.push(`${a.length} failed (${e.join("; ")})`);
|
|
3502
3513
|
}
|
|
3503
|
-
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`),
|
|
3514
|
+
t && !s && !a.length && c.push(`The ${t.name} folder still has files, so it was kept`), be(c.join(". "), a.length ? "error" : "success", {
|
|
3504
3515
|
kind: "delete",
|
|
3505
3516
|
deleted: i,
|
|
3506
3517
|
skipped: o,
|
|
@@ -3510,367 +3521,367 @@ function _i({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3510
3521
|
folderRemoved: s
|
|
3511
3522
|
}
|
|
3512
3523
|
}), i.length > 0 && await r?.(i);
|
|
3513
|
-
},
|
|
3524
|
+
}, Fe = async (e) => {
|
|
3514
3525
|
if (e.length === 0) return;
|
|
3515
3526
|
if (!y) {
|
|
3516
|
-
|
|
3527
|
+
ge(e);
|
|
3517
3528
|
return;
|
|
3518
3529
|
}
|
|
3519
|
-
let t =
|
|
3520
|
-
await y(t) && await
|
|
3521
|
-
},
|
|
3530
|
+
let t = K(e, !0);
|
|
3531
|
+
await y(t) && await Pe(t);
|
|
3532
|
+
}, Ie = (e) => re.filter((t) => t.path.startsWith(`${e.path}/`)), Le = async (e) => {
|
|
3522
3533
|
if (!y) {
|
|
3523
|
-
|
|
3534
|
+
_e(e);
|
|
3524
3535
|
return;
|
|
3525
3536
|
}
|
|
3526
|
-
let t =
|
|
3527
|
-
await y(t) && await
|
|
3528
|
-
},
|
|
3529
|
-
let t = () =>
|
|
3537
|
+
let t = Ie(e);
|
|
3538
|
+
await y(t) && await Pe(t, e);
|
|
3539
|
+
}, Re = (e) => {
|
|
3540
|
+
let t = () => be("Path copied", "success", {
|
|
3530
3541
|
kind: "copy-path",
|
|
3531
3542
|
path: e
|
|
3532
|
-
}), n = (t) =>
|
|
3543
|
+
}), n = (t) => be("Couldn’t copy. Select the path text instead.", "error", {
|
|
3533
3544
|
kind: "copy-path",
|
|
3534
3545
|
path: e,
|
|
3535
|
-
error: t === void 0 ? "Clipboard unavailable" :
|
|
3546
|
+
error: t === void 0 ? "Clipboard unavailable" : ui(t)
|
|
3536
3547
|
});
|
|
3537
3548
|
try {
|
|
3538
3549
|
navigator.clipboard.writeText(e).then(t, n);
|
|
3539
3550
|
} catch (e) {
|
|
3540
3551
|
n(e);
|
|
3541
3552
|
}
|
|
3542
|
-
},
|
|
3543
|
-
if (
|
|
3553
|
+
}, Y = (e) => {
|
|
3554
|
+
if (P || F) return;
|
|
3544
3555
|
let t = e.target instanceof HTMLInputElement || e.target instanceof HTMLSelectElement;
|
|
3545
3556
|
if (e.key === "Escape") {
|
|
3546
|
-
if (
|
|
3547
|
-
else if (
|
|
3557
|
+
if (pe) De();
|
|
3558
|
+
else if (M.size > 0) N(/* @__PURE__ */ new Set());
|
|
3548
3559
|
else return;
|
|
3549
3560
|
e.preventDefault();
|
|
3550
|
-
} else if (
|
|
3551
|
-
let t =
|
|
3552
|
-
t &&
|
|
3561
|
+
} else if (U && !t && (e.key === "ArrowLeft" || e.key === "ArrowRight")) {
|
|
3562
|
+
let t = R[W + (e.key === "ArrowRight" ? 1 : -1)];
|
|
3563
|
+
t && me(t.file.path), e.preventDefault();
|
|
3553
3564
|
}
|
|
3554
|
-
},
|
|
3565
|
+
}, ze = o(() => re.some((e) => mr(e.path)), [re]), Be = /(^|\/)images(\/\d+)?$/.test(k), Ve = [{
|
|
3555
3566
|
label: C,
|
|
3556
3567
|
path: S
|
|
3557
|
-
}, ...(
|
|
3568
|
+
}, ...(k.length > S.length ? k.slice(S ? S.length + 1 : 0).split("/") : []).map((e, t, n) => ({
|
|
3558
3569
|
label: e,
|
|
3559
3570
|
path: [S, ...n.slice(0, t + 1)].filter(Boolean).join("/")
|
|
3560
|
-
}))],
|
|
3561
|
-
if (!
|
|
3571
|
+
}))], He = `h${f}`, Ue = H.reduce((e, t) => e + t.file.size, 0), We;
|
|
3572
|
+
if (!Un()) We = /* @__PURE__ */ B(_i, {
|
|
3562
3573
|
icon: "triangleAlert",
|
|
3563
3574
|
tone: "error",
|
|
3564
3575
|
title: "This browser doesn’t support private file storage",
|
|
3565
3576
|
children: "OPFS isn’t available here. Some private browsing windows and older browsers turn it off. Try a current version of Chrome, Edge, Firefox, or Safari in a normal window."
|
|
3566
3577
|
});
|
|
3567
3578
|
else if (te) {
|
|
3568
|
-
let e = /* @__PURE__ */
|
|
3579
|
+
let e = /* @__PURE__ */ V("button", {
|
|
3569
3580
|
type: "button",
|
|
3570
3581
|
className: "seed-fm-btn",
|
|
3571
|
-
onClick: () =>
|
|
3572
|
-
children: [/* @__PURE__ */
|
|
3582
|
+
onClick: () => D(),
|
|
3583
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3573
3584
|
name: "refresh",
|
|
3574
3585
|
size: 15
|
|
3575
3586
|
}), " Try again"]
|
|
3576
3587
|
});
|
|
3577
|
-
|
|
3588
|
+
We = ne === "NotFoundError" && S ? /* @__PURE__ */ V(_i, {
|
|
3578
3589
|
icon: "triangleAlert",
|
|
3579
3590
|
tone: "error",
|
|
3580
3591
|
title: `Can’t open ${S}`,
|
|
3581
3592
|
action: e,
|
|
3582
3593
|
children: [
|
|
3583
3594
|
"The folder ",
|
|
3584
|
-
/* @__PURE__ */
|
|
3595
|
+
/* @__PURE__ */ B("code", { children: S }),
|
|
3585
3596
|
" doesn’t exist in this browser’s private storage yet. Check the",
|
|
3586
3597
|
" ",
|
|
3587
|
-
/* @__PURE__ */
|
|
3598
|
+
/* @__PURE__ */ B("code", { children: "rootPath" }),
|
|
3588
3599
|
" prop, or open the app once so the SDK creates it."
|
|
3589
3600
|
]
|
|
3590
|
-
}) : /* @__PURE__ */
|
|
3601
|
+
}) : /* @__PURE__ */ B(_i, {
|
|
3591
3602
|
icon: "triangleAlert",
|
|
3592
3603
|
tone: "error",
|
|
3593
3604
|
title: "Can’t read private storage",
|
|
3594
3605
|
action: e,
|
|
3595
3606
|
children: te
|
|
3596
3607
|
});
|
|
3597
|
-
} else
|
|
3608
|
+
} else We = E ? oe.length === 0 ? /* @__PURE__ */ B(_i, {
|
|
3598
3609
|
icon: "folderOpen",
|
|
3599
3610
|
title: `No files in ${C} yet`,
|
|
3600
3611
|
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."
|
|
3601
|
-
}) :
|
|
3612
|
+
}) : xe.folders.length === 0 && R.length === 0 ? A ? /* @__PURE__ */ V(_i, {
|
|
3602
3613
|
icon: "search",
|
|
3603
|
-
title: `No matches for “${
|
|
3604
|
-
action: /* @__PURE__ */
|
|
3614
|
+
title: `No matches for “${A}”`,
|
|
3615
|
+
action: /* @__PURE__ */ B("button", {
|
|
3605
3616
|
type: "button",
|
|
3606
3617
|
className: "seed-fm-btn",
|
|
3607
|
-
onClick: () =>
|
|
3618
|
+
onClick: () => ce(""),
|
|
3608
3619
|
children: "Clear search"
|
|
3609
3620
|
}),
|
|
3610
3621
|
children: [
|
|
3611
3622
|
"Search covers file names and paths in ",
|
|
3612
|
-
|
|
3623
|
+
Ve[Ve.length - 1].label,
|
|
3613
3624
|
" and every folder inside it."
|
|
3614
3625
|
]
|
|
3615
|
-
}) : /* @__PURE__ */
|
|
3626
|
+
}) : /* @__PURE__ */ B(_i, {
|
|
3616
3627
|
icon: "folderOpen",
|
|
3617
3628
|
title: "This folder is empty",
|
|
3618
3629
|
children: "Everything in it has been deleted or filtered out."
|
|
3619
|
-
}) : /* @__PURE__ */
|
|
3630
|
+
}) : /* @__PURE__ */ V(z, { children: [xe.folders.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3620
3631
|
className: "seed-fm-section-label",
|
|
3621
3632
|
children: "Folders"
|
|
3622
|
-
}), /* @__PURE__ */
|
|
3633
|
+
}), /* @__PURE__ */ B("ul", {
|
|
3623
3634
|
className: "seed-fm-folders",
|
|
3624
|
-
children:
|
|
3635
|
+
children: xe.folders.map((e) => /* @__PURE__ */ V("li", { children: [/* @__PURE__ */ V("button", {
|
|
3625
3636
|
type: "button",
|
|
3626
3637
|
className: w("folder", "seed-fm-folder"),
|
|
3627
|
-
onClick: () =>
|
|
3628
|
-
children: [/* @__PURE__ */
|
|
3638
|
+
onClick: () => Te(e.path),
|
|
3639
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3629
3640
|
name: "folder",
|
|
3630
3641
|
size: 20,
|
|
3631
3642
|
strokeWidth: 1.75
|
|
3632
|
-
}), /* @__PURE__ */
|
|
3643
|
+
}), /* @__PURE__ */ V("span", { children: [/* @__PURE__ */ B("span", {
|
|
3633
3644
|
className: "seed-fm-folder-name",
|
|
3634
3645
|
children: e.name
|
|
3635
|
-
}), /* @__PURE__ */
|
|
3646
|
+
}), /* @__PURE__ */ V("span", {
|
|
3636
3647
|
className: "seed-fm-folder-meta",
|
|
3637
3648
|
children: [
|
|
3638
|
-
|
|
3649
|
+
di(e.fileCount, "file"),
|
|
3639
3650
|
" · ",
|
|
3640
|
-
|
|
3651
|
+
Z(e.size)
|
|
3641
3652
|
]
|
|
3642
3653
|
})] })]
|
|
3643
|
-
}), /* @__PURE__ */
|
|
3654
|
+
}), /* @__PURE__ */ B("button", {
|
|
3644
3655
|
type: "button",
|
|
3645
3656
|
className: "seed-fm-btn seed-fm-btn--ghost seed-fm-btn--icon seed-fm-folder-delete",
|
|
3646
3657
|
"aria-label": `Delete folder ${e.name}`,
|
|
3647
3658
|
title: "Delete folder",
|
|
3648
|
-
disabled:
|
|
3649
|
-
onClick: () =>
|
|
3650
|
-
children: /* @__PURE__ */
|
|
3659
|
+
disabled: I,
|
|
3660
|
+
onClick: () => Le(e),
|
|
3661
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3651
3662
|
name: "trash",
|
|
3652
3663
|
size: 15
|
|
3653
3664
|
})
|
|
3654
3665
|
})] }, e.path))
|
|
3655
|
-
})] }),
|
|
3666
|
+
})] }), R.length > 0 && /* @__PURE__ */ V(z, { children: [/* @__PURE__ */ B("div", {
|
|
3656
3667
|
className: "seed-fm-section-label",
|
|
3657
|
-
children:
|
|
3658
|
-
}),
|
|
3659
|
-
entries:
|
|
3660
|
-
selected:
|
|
3661
|
-
onActivate:
|
|
3662
|
-
onToggle:
|
|
3668
|
+
children: A ? di(R.length, "result") : "Files"
|
|
3669
|
+
}), Ce === "grid" ? /* @__PURE__ */ B(Hr, {
|
|
3670
|
+
entries: R,
|
|
3671
|
+
selected: M,
|
|
3672
|
+
onActivate: Oe,
|
|
3673
|
+
onToggle: G,
|
|
3663
3674
|
className: h.grid,
|
|
3664
3675
|
tileClassName: h.tile
|
|
3665
|
-
}) : /* @__PURE__ */
|
|
3666
|
-
entries:
|
|
3667
|
-
selected:
|
|
3668
|
-
cwd:
|
|
3669
|
-
onActivate:
|
|
3670
|
-
onToggle:
|
|
3671
|
-
onToggleAll:
|
|
3672
|
-
onDownload: (e) =>
|
|
3673
|
-
onDelete: (e) =>
|
|
3674
|
-
deleteActionFor: (e) =>
|
|
3676
|
+
}) : /* @__PURE__ */ B(Ur, {
|
|
3677
|
+
entries: R,
|
|
3678
|
+
selected: M,
|
|
3679
|
+
cwd: k,
|
|
3680
|
+
onActivate: Oe,
|
|
3681
|
+
onToggle: G,
|
|
3682
|
+
onToggleAll: ke,
|
|
3683
|
+
onDownload: (e) => Ne([e]),
|
|
3684
|
+
onDelete: (e) => Fe([e]),
|
|
3685
|
+
deleteActionFor: (e) => J([e]),
|
|
3675
3686
|
className: h.list,
|
|
3676
3687
|
rowClassName: h.row
|
|
3677
|
-
})] })] }) : /* @__PURE__ */
|
|
3688
|
+
})] })] }) : /* @__PURE__ */ B("ul", {
|
|
3678
3689
|
className: w("grid", "seed-fm-grid"),
|
|
3679
3690
|
"aria-busy": "true",
|
|
3680
3691
|
"aria-label": "Loading files",
|
|
3681
|
-
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */
|
|
3692
|
+
children: Array.from({ length: 8 }, (e, t) => /* @__PURE__ */ B("li", {
|
|
3682
3693
|
className: "seed-fm-tile",
|
|
3683
|
-
children: /* @__PURE__ */
|
|
3694
|
+
children: /* @__PURE__ */ B("span", { className: "seed-fm-thumb seed-fm-skeleton" })
|
|
3684
3695
|
}, t))
|
|
3685
3696
|
});
|
|
3686
|
-
let
|
|
3687
|
-
return /* @__PURE__ */
|
|
3697
|
+
let Ge = P ? K(P, !0) : [], X = F ? Ie(F) : [], Ke = M.size > 0 ? J(H) : null;
|
|
3698
|
+
return /* @__PURE__ */ V("div", {
|
|
3688
3699
|
className: [w("root", "seed-fm"), m].filter(Boolean).join(" "),
|
|
3689
3700
|
"data-seed-theme": p === "none" ? void 0 : p,
|
|
3690
|
-
"data-selecting":
|
|
3691
|
-
onKeyDown:
|
|
3701
|
+
"data-selecting": M.size > 0 || void 0,
|
|
3702
|
+
onKeyDown: Y,
|
|
3692
3703
|
children: [
|
|
3693
|
-
/* @__PURE__ */
|
|
3704
|
+
/* @__PURE__ */ V("div", {
|
|
3694
3705
|
className: "seed-fm-frame",
|
|
3695
3706
|
children: [
|
|
3696
|
-
/* @__PURE__ */
|
|
3707
|
+
/* @__PURE__ */ V("header", {
|
|
3697
3708
|
className: w("header", "seed-fm-header"),
|
|
3698
3709
|
children: [
|
|
3699
|
-
/* @__PURE__ */
|
|
3710
|
+
/* @__PURE__ */ V("div", {
|
|
3700
3711
|
className: "seed-fm-titles",
|
|
3701
|
-
children: [/* @__PURE__ */
|
|
3712
|
+
children: [/* @__PURE__ */ B(He, {
|
|
3702
3713
|
className: "seed-fm-title",
|
|
3703
3714
|
children: u
|
|
3704
|
-
}), d && /* @__PURE__ */
|
|
3715
|
+
}), d && /* @__PURE__ */ B("p", {
|
|
3705
3716
|
className: "seed-fm-description",
|
|
3706
3717
|
children: d
|
|
3707
3718
|
})]
|
|
3708
3719
|
}),
|
|
3709
|
-
E && !te && /* @__PURE__ */
|
|
3710
|
-
files:
|
|
3711
|
-
estimate:
|
|
3720
|
+
E && !te && /* @__PURE__ */ B(gi, {
|
|
3721
|
+
files: re,
|
|
3722
|
+
estimate: ie
|
|
3712
3723
|
}),
|
|
3713
|
-
/* @__PURE__ */
|
|
3724
|
+
/* @__PURE__ */ B("button", {
|
|
3714
3725
|
type: "button",
|
|
3715
3726
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3716
|
-
onClick: () =>
|
|
3727
|
+
onClick: () => D(),
|
|
3717
3728
|
"aria-label": "Refresh",
|
|
3718
3729
|
title: "Refresh",
|
|
3719
3730
|
"data-busy": ee && E,
|
|
3720
|
-
children: /* @__PURE__ */
|
|
3731
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3721
3732
|
name: "refresh",
|
|
3722
3733
|
size: 15
|
|
3723
3734
|
})
|
|
3724
3735
|
})
|
|
3725
3736
|
]
|
|
3726
3737
|
}),
|
|
3727
|
-
E && !te &&
|
|
3738
|
+
E && !te && oe.length > 0 && /* @__PURE__ */ V("div", {
|
|
3728
3739
|
className: w("toolbar", "seed-fm-toolbar"),
|
|
3729
3740
|
children: [
|
|
3730
|
-
/* @__PURE__ */
|
|
3741
|
+
/* @__PURE__ */ B("nav", {
|
|
3731
3742
|
"aria-label": "Folder",
|
|
3732
|
-
children: /* @__PURE__ */
|
|
3743
|
+
children: /* @__PURE__ */ B("ol", {
|
|
3733
3744
|
className: "seed-fm-crumbs",
|
|
3734
|
-
children:
|
|
3745
|
+
children: Ve.map((e, t) => /* @__PURE__ */ V("li", { children: [t > 0 && /* @__PURE__ */ B(Q, {
|
|
3735
3746
|
name: "chevronRight",
|
|
3736
3747
|
size: 14
|
|
3737
|
-
}), /* @__PURE__ */
|
|
3748
|
+
}), /* @__PURE__ */ B("button", {
|
|
3738
3749
|
type: "button",
|
|
3739
|
-
onClick: () =>
|
|
3740
|
-
"aria-current": t ===
|
|
3750
|
+
onClick: () => Te(e.path),
|
|
3751
|
+
"aria-current": t === Ve.length - 1 ? "page" : void 0,
|
|
3741
3752
|
children: e.label
|
|
3742
3753
|
})] }, e.path || "/"))
|
|
3743
3754
|
})
|
|
3744
3755
|
}),
|
|
3745
|
-
/* @__PURE__ */
|
|
3756
|
+
/* @__PURE__ */ V("label", {
|
|
3746
3757
|
className: "seed-fm-search",
|
|
3747
|
-
children: [/* @__PURE__ */
|
|
3758
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3748
3759
|
name: "search",
|
|
3749
3760
|
size: 14
|
|
3750
|
-
}), /* @__PURE__ */
|
|
3761
|
+
}), /* @__PURE__ */ B("input", {
|
|
3751
3762
|
type: "search",
|
|
3752
|
-
value:
|
|
3753
|
-
onChange: (e) =>
|
|
3763
|
+
value: A,
|
|
3764
|
+
onChange: (e) => ce(e.target.value),
|
|
3754
3765
|
placeholder: "Search names and paths",
|
|
3755
3766
|
"aria-label": "Search files"
|
|
3756
3767
|
})]
|
|
3757
3768
|
}),
|
|
3758
|
-
/* @__PURE__ */
|
|
3769
|
+
/* @__PURE__ */ V("select", {
|
|
3759
3770
|
className: "seed-fm-select",
|
|
3760
|
-
value:
|
|
3761
|
-
onChange: (e) =>
|
|
3771
|
+
value: le,
|
|
3772
|
+
onChange: (e) => j(e.target.value),
|
|
3762
3773
|
"aria-label": "Sort by",
|
|
3763
3774
|
children: [
|
|
3764
|
-
/* @__PURE__ */
|
|
3775
|
+
/* @__PURE__ */ B("option", {
|
|
3765
3776
|
value: "name",
|
|
3766
3777
|
children: "Name"
|
|
3767
3778
|
}),
|
|
3768
|
-
/* @__PURE__ */
|
|
3779
|
+
/* @__PURE__ */ B("option", {
|
|
3769
3780
|
value: "modified",
|
|
3770
3781
|
children: "Recently modified"
|
|
3771
3782
|
}),
|
|
3772
|
-
/* @__PURE__ */
|
|
3783
|
+
/* @__PURE__ */ B("option", {
|
|
3773
3784
|
value: "size",
|
|
3774
3785
|
children: "Largest"
|
|
3775
3786
|
})
|
|
3776
3787
|
]
|
|
3777
3788
|
}),
|
|
3778
|
-
/* @__PURE__ */
|
|
3789
|
+
/* @__PURE__ */ V("div", {
|
|
3779
3790
|
className: "seed-fm-viewtoggle",
|
|
3780
3791
|
role: "group",
|
|
3781
3792
|
"aria-label": "View",
|
|
3782
|
-
children: [/* @__PURE__ */
|
|
3793
|
+
children: [/* @__PURE__ */ B("button", {
|
|
3783
3794
|
type: "button",
|
|
3784
|
-
"aria-pressed":
|
|
3795
|
+
"aria-pressed": Ce === "grid",
|
|
3785
3796
|
"aria-label": "Grid view",
|
|
3786
|
-
onClick: () =>
|
|
3787
|
-
children: /* @__PURE__ */
|
|
3797
|
+
onClick: () => de("grid"),
|
|
3798
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3788
3799
|
name: "layoutGrid",
|
|
3789
3800
|
size: 15
|
|
3790
3801
|
})
|
|
3791
|
-
}), /* @__PURE__ */
|
|
3802
|
+
}), /* @__PURE__ */ B("button", {
|
|
3792
3803
|
type: "button",
|
|
3793
|
-
"aria-pressed":
|
|
3804
|
+
"aria-pressed": Ce === "list",
|
|
3794
3805
|
"aria-label": "List view",
|
|
3795
|
-
onClick: () =>
|
|
3796
|
-
children: /* @__PURE__ */
|
|
3806
|
+
onClick: () => de("list"),
|
|
3807
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3797
3808
|
name: "list",
|
|
3798
3809
|
size: 15
|
|
3799
3810
|
})
|
|
3800
3811
|
})]
|
|
3801
3812
|
}),
|
|
3802
|
-
|
|
3813
|
+
ze && Be && /* @__PURE__ */ V("p", {
|
|
3803
3814
|
className: "seed-fm-hint",
|
|
3804
3815
|
children: [
|
|
3805
|
-
/* @__PURE__ */
|
|
3816
|
+
/* @__PURE__ */ B(Q, {
|
|
3806
3817
|
name: "layers",
|
|
3807
3818
|
size: 13
|
|
3808
3819
|
}),
|
|
3809
|
-
|
|
3810
|
-
/* @__PURE__ */
|
|
3820
|
+
O ? "Resized copies are grouped with their original image." : "Resized copies are shown in their size folders.",
|
|
3821
|
+
/* @__PURE__ */ B("button", {
|
|
3811
3822
|
type: "button",
|
|
3812
3823
|
className: "seed-fm-linkbtn",
|
|
3813
3824
|
onClick: () => {
|
|
3814
|
-
|
|
3825
|
+
ae(!O), N(/* @__PURE__ */ new Set());
|
|
3815
3826
|
},
|
|
3816
|
-
children:
|
|
3827
|
+
children: O ? "Show as folders" : "Group with originals"
|
|
3817
3828
|
})
|
|
3818
3829
|
]
|
|
3819
3830
|
})
|
|
3820
3831
|
]
|
|
3821
3832
|
}),
|
|
3822
|
-
/* @__PURE__ */
|
|
3833
|
+
/* @__PURE__ */ B("div", {
|
|
3823
3834
|
className: w("body", "seed-fm-body"),
|
|
3824
|
-
children:
|
|
3835
|
+
children: We
|
|
3825
3836
|
}),
|
|
3826
|
-
|
|
3837
|
+
Ke && /* @__PURE__ */ V("div", {
|
|
3827
3838
|
className: w("batchBar", "seed-fm-batch"),
|
|
3828
3839
|
role: "toolbar",
|
|
3829
3840
|
"aria-label": "Selected files",
|
|
3830
3841
|
children: [
|
|
3831
|
-
/* @__PURE__ */
|
|
3842
|
+
/* @__PURE__ */ V("span", {
|
|
3832
3843
|
className: "seed-fm-batch-count",
|
|
3833
3844
|
"aria-live": "polite",
|
|
3834
3845
|
children: [
|
|
3835
|
-
|
|
3846
|
+
M.size,
|
|
3836
3847
|
" selected ",
|
|
3837
|
-
/* @__PURE__ */
|
|
3848
|
+
/* @__PURE__ */ V("span", { children: ["· ", Z(Ue)] })
|
|
3838
3849
|
]
|
|
3839
3850
|
}),
|
|
3840
|
-
/* @__PURE__ */
|
|
3851
|
+
/* @__PURE__ */ V("button", {
|
|
3841
3852
|
type: "button",
|
|
3842
3853
|
className: "seed-fm-btn",
|
|
3843
|
-
disabled:
|
|
3844
|
-
onClick: () =>
|
|
3854
|
+
disabled: I,
|
|
3855
|
+
onClick: () => Ne(H),
|
|
3845
3856
|
children: [
|
|
3846
|
-
/* @__PURE__ */
|
|
3857
|
+
/* @__PURE__ */ B(Q, {
|
|
3847
3858
|
name: "download",
|
|
3848
3859
|
size: 15
|
|
3849
3860
|
}),
|
|
3850
3861
|
" ",
|
|
3851
|
-
|
|
3862
|
+
M.size > 1 ? "Download .zip" : "Download"
|
|
3852
3863
|
]
|
|
3853
3864
|
}),
|
|
3854
|
-
/* @__PURE__ */
|
|
3865
|
+
/* @__PURE__ */ V("button", {
|
|
3855
3866
|
type: "button",
|
|
3856
|
-
className: `seed-fm-btn${
|
|
3857
|
-
disabled:
|
|
3858
|
-
onClick: () =>
|
|
3867
|
+
className: `seed-fm-btn${Ke.destructive ? " seed-fm-btn--danger-text" : ""}`,
|
|
3868
|
+
disabled: I,
|
|
3869
|
+
onClick: () => Fe(H),
|
|
3859
3870
|
children: [
|
|
3860
|
-
/* @__PURE__ */
|
|
3871
|
+
/* @__PURE__ */ B(Q, {
|
|
3861
3872
|
name: "trash",
|
|
3862
3873
|
size: 15
|
|
3863
3874
|
}),
|
|
3864
3875
|
" ",
|
|
3865
|
-
|
|
3876
|
+
Ke.label ?? "Delete"
|
|
3866
3877
|
]
|
|
3867
3878
|
}),
|
|
3868
|
-
/* @__PURE__ */
|
|
3879
|
+
/* @__PURE__ */ B("button", {
|
|
3869
3880
|
type: "button",
|
|
3870
3881
|
className: "seed-fm-btn seed-fm-btn--icon",
|
|
3871
3882
|
"aria-label": "Clear selection",
|
|
3872
|
-
onClick: () =>
|
|
3873
|
-
children: /* @__PURE__ */
|
|
3883
|
+
onClick: () => N(/* @__PURE__ */ new Set()),
|
|
3884
|
+
children: /* @__PURE__ */ B(Q, {
|
|
3874
3885
|
name: "x",
|
|
3875
3886
|
size: 15
|
|
3876
3887
|
})
|
|
@@ -3879,49 +3890,49 @@ function _i({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3879
3890
|
})
|
|
3880
3891
|
]
|
|
3881
3892
|
}),
|
|
3882
|
-
|
|
3883
|
-
entry:
|
|
3893
|
+
U && /* @__PURE__ */ B(qr, {
|
|
3894
|
+
entry: U,
|
|
3884
3895
|
className: h.panel,
|
|
3885
|
-
onClose:
|
|
3886
|
-
onPrevious:
|
|
3887
|
-
onNext:
|
|
3888
|
-
onDownload: () =>
|
|
3889
|
-
onDelete: () =>
|
|
3890
|
-
deleteAction:
|
|
3891
|
-
onCopyPath: () =>
|
|
3896
|
+
onClose: De,
|
|
3897
|
+
onPrevious: W > 0 ? () => me(R[W - 1].file.path) : null,
|
|
3898
|
+
onNext: W >= 0 && W < R.length - 1 ? () => me(R[W + 1].file.path) : null,
|
|
3899
|
+
onDownload: () => Ne([U]),
|
|
3900
|
+
onDelete: () => Fe([U]),
|
|
3901
|
+
deleteAction: J([U]),
|
|
3902
|
+
onCopyPath: () => Re(U.file.path)
|
|
3892
3903
|
}, "panel"),
|
|
3893
|
-
|
|
3894
|
-
entries:
|
|
3904
|
+
P && /* @__PURE__ */ B(or, {
|
|
3905
|
+
entries: P,
|
|
3895
3906
|
rootPath: S,
|
|
3896
|
-
warning: v(
|
|
3897
|
-
deleteActionFor: (e) =>
|
|
3907
|
+
warning: v(Ge),
|
|
3908
|
+
deleteActionFor: (e) => q(K(P, e)),
|
|
3898
3909
|
className: h.dialog,
|
|
3899
|
-
onCancel: () =>
|
|
3910
|
+
onCancel: () => ge(null),
|
|
3900
3911
|
onConfirm: (e) => {
|
|
3901
|
-
let t =
|
|
3902
|
-
|
|
3912
|
+
let t = K(P, e);
|
|
3913
|
+
ge(null), Pe(t);
|
|
3903
3914
|
}
|
|
3904
3915
|
}),
|
|
3905
|
-
|
|
3906
|
-
folder:
|
|
3907
|
-
files:
|
|
3908
|
-
hiddenCount: T.filter((e) => e.path.startsWith(`${
|
|
3909
|
-
warning: v(
|
|
3910
|
-
action:
|
|
3911
|
-
busy:
|
|
3916
|
+
F && /* @__PURE__ */ B(sr, {
|
|
3917
|
+
folder: F,
|
|
3918
|
+
files: X,
|
|
3919
|
+
hiddenCount: T.filter((e) => e.path.startsWith(`${F.path}/`)).length - X.length,
|
|
3920
|
+
warning: v(X),
|
|
3921
|
+
action: q(X),
|
|
3922
|
+
busy: I,
|
|
3912
3923
|
className: h.dialog,
|
|
3913
|
-
onDownload: () =>
|
|
3914
|
-
onCancel: () =>
|
|
3924
|
+
onDownload: () => Me(X, F),
|
|
3925
|
+
onCancel: () => _e(null),
|
|
3915
3926
|
onConfirm: () => {
|
|
3916
|
-
|
|
3927
|
+
_e(null), Pe(X, F);
|
|
3917
3928
|
}
|
|
3918
3929
|
}),
|
|
3919
|
-
!x && /* @__PURE__ */
|
|
3930
|
+
!x && /* @__PURE__ */ B("ul", {
|
|
3920
3931
|
className: "seed-fm-toasts",
|
|
3921
3932
|
"aria-live": "polite",
|
|
3922
|
-
children:
|
|
3933
|
+
children: ve.map((e) => /* @__PURE__ */ V("li", {
|
|
3923
3934
|
className: w("toast", `seed-fm-toast${e.tone === "error" ? " seed-fm-toast--error" : ""}`),
|
|
3924
|
-
children: [/* @__PURE__ */
|
|
3935
|
+
children: [/* @__PURE__ */ B(Q, {
|
|
3925
3936
|
name: e.tone === "error" ? "triangleAlert" : "check",
|
|
3926
3937
|
size: 15,
|
|
3927
3938
|
strokeWidth: 2.5
|
|
@@ -3933,15 +3944,15 @@ function _i({ rootPath: e, filter: t, onBeforeDelete: n, onAfterDelete: r, onDow
|
|
|
3933
3944
|
}
|
|
3934
3945
|
//#endregion
|
|
3935
3946
|
//#region src/useEnsureLocalImage.ts
|
|
3936
|
-
var
|
|
3947
|
+
var yi = (e) => {
|
|
3937
3948
|
try {
|
|
3938
3949
|
return e.getService?.()?.getSnapshot?.()?.context?.storageTransactionId || void 0;
|
|
3939
3950
|
} catch {
|
|
3940
3951
|
return;
|
|
3941
3952
|
}
|
|
3942
3953
|
};
|
|
3943
|
-
function
|
|
3944
|
-
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, _ =
|
|
3954
|
+
function bi(e) {
|
|
3955
|
+
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, _ = yi(t), v = o(() => N(_) ?? N(r) ?? N(m) ?? N(g), [
|
|
3945
3956
|
_,
|
|
3946
3957
|
r,
|
|
3947
3958
|
m,
|
|
@@ -3954,7 +3965,7 @@ function yi(e) {
|
|
|
3954
3965
|
if (!v) return [];
|
|
3955
3966
|
let e = [];
|
|
3956
3967
|
try {
|
|
3957
|
-
for (let t of
|
|
3968
|
+
for (let t of ie()) {
|
|
3958
3969
|
let n = `${t.replace(/\/$/, "")}/raw/${v}`;
|
|
3959
3970
|
e.includes(n) || e.push(n);
|
|
3960
3971
|
}
|
|
@@ -4009,23 +4020,23 @@ function yi(e) {
|
|
|
4009
4020
|
}
|
|
4010
4021
|
//#endregion
|
|
4011
4022
|
//#region src/SeedImage.tsx
|
|
4012
|
-
var
|
|
4023
|
+
var xi = R("seedSdk:react:SeedImage"), Si = /* @__PURE__ */ new Map(), Ci = (e) => {
|
|
4013
4024
|
let t = e.match(/^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/);
|
|
4014
4025
|
return t && t[2] ? t[2] : e;
|
|
4015
4026
|
};
|
|
4016
|
-
function
|
|
4027
|
+
function wi(e) {
|
|
4017
4028
|
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
4018
4029
|
}
|
|
4019
|
-
function
|
|
4020
|
-
let n = RegExp(`^${
|
|
4030
|
+
function Ti(e, t) {
|
|
4031
|
+
let n = RegExp(`^${wi(t)}$`), r = Ci(e);
|
|
4021
4032
|
return n.test(r);
|
|
4022
4033
|
}
|
|
4023
|
-
var
|
|
4024
|
-
let [l, u] = c(), [d, f] = c(), { property: m } =
|
|
4034
|
+
var Ei = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure: a = !0, ...o }, s) => {
|
|
4035
|
+
let [l, u] = c(), [d, f] = c(), { property: m } = ft({
|
|
4025
4036
|
propertyName: t.propertyName,
|
|
4026
4037
|
seedLocalId: t.seedLocalId,
|
|
4027
4038
|
seedUid: t.seedUid
|
|
4028
|
-
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } =
|
|
4039
|
+
}), h = t ?? m, g = r ?? h?.refResolvedValue ?? h?.value, { status: _, gatewayHref: v, onGatewayError: y } = bi({
|
|
4029
4040
|
imageProperty: h ?? t,
|
|
4030
4041
|
filename: r,
|
|
4031
4042
|
width: n,
|
|
@@ -4049,7 +4060,7 @@ var Ti = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4049
4060
|
!e && n && f(n);
|
|
4050
4061
|
}
|
|
4051
4062
|
} catch (e) {
|
|
4052
|
-
|
|
4063
|
+
xi("_getOriginalContentUrl error", e);
|
|
4053
4064
|
}
|
|
4054
4065
|
})(), () => {
|
|
4055
4066
|
e = !0;
|
|
@@ -4065,25 +4076,25 @@ var Ti = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4065
4076
|
try {
|
|
4066
4077
|
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));
|
|
4067
4078
|
if (r.length === 0) return;
|
|
4068
|
-
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a =
|
|
4069
|
-
if (
|
|
4070
|
-
let e =
|
|
4079
|
+
let i = r.reduce((e, t) => Math.abs(t - n) < Math.abs(e - n) ? t : e, r[0]), a = Ci(g), o = `${a}-${i}`;
|
|
4080
|
+
if (Si.has(o)) try {
|
|
4081
|
+
let e = Si.get(o);
|
|
4071
4082
|
if (e && (await fetch(e)).ok) {
|
|
4072
4083
|
u(e);
|
|
4073
4084
|
return;
|
|
4074
4085
|
}
|
|
4075
4086
|
} catch (e) {
|
|
4076
|
-
|
|
4087
|
+
xi("error", e), Si.delete(o);
|
|
4077
4088
|
}
|
|
4078
|
-
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ?
|
|
4089
|
+
let s = e.readdirSync(`${t}/${i}`, { withFileTypes: !0 }).find((e) => e.name ? Ti(e.name, a) : !1);
|
|
4079
4090
|
if (!s) return;
|
|
4080
4091
|
let c = `${t}/${i}/${s?.name}`;
|
|
4081
4092
|
if (await p.pathExists(c)) {
|
|
4082
4093
|
let e = await p.getContentUrlFromPath(c);
|
|
4083
|
-
e && (
|
|
4094
|
+
e && (Si.set(o, e), u(e));
|
|
4084
4095
|
}
|
|
4085
4096
|
} catch (e) {
|
|
4086
|
-
|
|
4097
|
+
xi("_getSizedContentUrl error", e);
|
|
4087
4098
|
}
|
|
4088
4099
|
})();
|
|
4089
4100
|
}, [
|
|
@@ -4095,21 +4106,21 @@ var Ti = e.memo(e.forwardRef(({ imageProperty: t, width: n, filename: r, ensure:
|
|
|
4095
4106
|
]);
|
|
4096
4107
|
let ee = (e) => typeof e == "string" && e.startsWith("blob:"), E = !!l || !!d || !!C || !!x && ee(x);
|
|
4097
4108
|
if (!E && !g && !v) return null;
|
|
4098
|
-
let te = l || d || C || (ee(x) ? x : void 0) || (a && !E ? v : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", { onError:
|
|
4099
|
-
v && te === v && y(),
|
|
4109
|
+
let te = l || d || C || (ee(x) ? x : void 0) || (a && !E ? v : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7", { onError: ne, ...D } = o, re = (e) => {
|
|
4110
|
+
v && te === v && y(), ne?.(e);
|
|
4100
4111
|
};
|
|
4101
|
-
return /* @__PURE__ */
|
|
4112
|
+
return /* @__PURE__ */ B("img", {
|
|
4102
4113
|
src: te,
|
|
4103
4114
|
alt: o.alt || t.propertyName || "Image",
|
|
4104
4115
|
width: n,
|
|
4105
|
-
...
|
|
4116
|
+
...D,
|
|
4106
4117
|
ref: s,
|
|
4107
|
-
onError:
|
|
4118
|
+
onError: re
|
|
4108
4119
|
});
|
|
4109
4120
|
}));
|
|
4110
4121
|
//#endregion
|
|
4111
4122
|
//#region src/useResolvedMediaRef.ts
|
|
4112
|
-
function
|
|
4123
|
+
function Di(e) {
|
|
4113
4124
|
let { value: t, enabled: r = !0, treatAs: a } = e, [o, s] = c(0), l = JSON.stringify([
|
|
4114
4125
|
r,
|
|
4115
4126
|
t ?? null,
|
|
@@ -4133,7 +4144,7 @@ function Ei(e) {
|
|
|
4133
4144
|
error: null
|
|
4134
4145
|
});
|
|
4135
4146
|
try {
|
|
4136
|
-
let r = await
|
|
4147
|
+
let r = await _e(String(t), { treatAs: a }), i = r.status === "ready" && r.source === "localBlob" ? r.href : void 0;
|
|
4137
4148
|
if (e) {
|
|
4138
4149
|
i && URL.revokeObjectURL(i);
|
|
4139
4150
|
return;
|
|
@@ -4179,8 +4190,8 @@ function Ei(e) {
|
|
|
4179
4190
|
}
|
|
4180
4191
|
//#endregion
|
|
4181
4192
|
//#region src/SeedMediaImage.tsx
|
|
4182
|
-
function
|
|
4183
|
-
let { href: o } =
|
|
4193
|
+
function Oi({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
4194
|
+
let { href: o } = Di({
|
|
4184
4195
|
value: e,
|
|
4185
4196
|
enabled: t,
|
|
4186
4197
|
treatAs: n
|
|
@@ -4191,18 +4202,18 @@ function Di({ value: e, enabled: t, treatAs: n, render: r, alt: i, ...a }) {
|
|
|
4191
4202
|
src: o,
|
|
4192
4203
|
alt: i ?? ""
|
|
4193
4204
|
};
|
|
4194
|
-
return r ? /* @__PURE__ */
|
|
4205
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("img", { ...s });
|
|
4195
4206
|
}
|
|
4196
4207
|
//#endregion
|
|
4197
4208
|
//#region src/SeedMediaFile.tsx
|
|
4198
|
-
function
|
|
4209
|
+
function ki(e) {
|
|
4199
4210
|
try {
|
|
4200
4211
|
return new URL(e).pathname.split("/").filter(Boolean).pop() || "Open";
|
|
4201
4212
|
} catch {
|
|
4202
4213
|
return "Open";
|
|
4203
4214
|
}
|
|
4204
4215
|
}
|
|
4205
|
-
function
|
|
4216
|
+
function Ai(e) {
|
|
4206
4217
|
try {
|
|
4207
4218
|
let t = new URL(e).protocol;
|
|
4208
4219
|
return t === "http:" || t === "https:";
|
|
@@ -4210,27 +4221,27 @@ function ki(e) {
|
|
|
4210
4221
|
return !1;
|
|
4211
4222
|
}
|
|
4212
4223
|
}
|
|
4213
|
-
function
|
|
4214
|
-
let { href: l } =
|
|
4224
|
+
function ji({ value: e, enabled: t, treatAs: n, download: r, render: i, children: a, target: o, rel: s, ...c }) {
|
|
4225
|
+
let { href: l } = Di({
|
|
4215
4226
|
value: e,
|
|
4216
4227
|
enabled: t,
|
|
4217
4228
|
treatAs: n
|
|
4218
4229
|
});
|
|
4219
4230
|
if (!l) return null;
|
|
4220
|
-
let u =
|
|
4231
|
+
let u = Ai(l), d = o === void 0 ? u ? "_blank" : void 0 : o, f = {
|
|
4221
4232
|
...c,
|
|
4222
4233
|
href: l,
|
|
4223
4234
|
download: r,
|
|
4224
4235
|
target: d,
|
|
4225
4236
|
rel: s ?? (u && d === "_blank" ? "noopener noreferrer" : void 0),
|
|
4226
|
-
children: a ??
|
|
4237
|
+
children: a ?? ki(l)
|
|
4227
4238
|
};
|
|
4228
|
-
return i ? /* @__PURE__ */
|
|
4239
|
+
return i ? /* @__PURE__ */ B(z, { children: i(f) }) : /* @__PURE__ */ B("a", { ...f });
|
|
4229
4240
|
}
|
|
4230
4241
|
//#endregion
|
|
4231
4242
|
//#region src/SeedMediaAudio.tsx
|
|
4232
|
-
function
|
|
4233
|
-
let { href: o } =
|
|
4243
|
+
function Mi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4244
|
+
let { href: o } = Di({
|
|
4234
4245
|
value: e,
|
|
4235
4246
|
enabled: t,
|
|
4236
4247
|
treatAs: n
|
|
@@ -4241,12 +4252,12 @@ function ji({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4241
4252
|
src: o,
|
|
4242
4253
|
controls: i
|
|
4243
4254
|
};
|
|
4244
|
-
return r ? /* @__PURE__ */
|
|
4255
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("audio", { ...s });
|
|
4245
4256
|
}
|
|
4246
4257
|
//#endregion
|
|
4247
4258
|
//#region src/SeedMediaVideo.tsx
|
|
4248
|
-
function
|
|
4249
|
-
let { href: o } =
|
|
4259
|
+
function Ni({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...a }) {
|
|
4260
|
+
let { href: o } = Di({
|
|
4250
4261
|
value: e,
|
|
4251
4262
|
enabled: t,
|
|
4252
4263
|
treatAs: n
|
|
@@ -4257,44 +4268,44 @@ function Mi({ value: e, enabled: t, treatAs: n, render: r, controls: i = !0, ...
|
|
|
4257
4268
|
src: o,
|
|
4258
4269
|
controls: i
|
|
4259
4270
|
};
|
|
4260
|
-
return r ? /* @__PURE__ */
|
|
4271
|
+
return r ? /* @__PURE__ */ B(z, { children: r(s) }) : /* @__PURE__ */ B("video", { ...s });
|
|
4261
4272
|
}
|
|
4262
4273
|
//#endregion
|
|
4263
4274
|
//#region src/SeedHtml.tsx
|
|
4264
|
-
function
|
|
4275
|
+
function Pi(e) {
|
|
4265
4276
|
return typeof e == "string" && e.trim().length > 0;
|
|
4266
4277
|
}
|
|
4267
|
-
var
|
|
4278
|
+
var Fi = /* @__PURE__ */ new Set([
|
|
4268
4279
|
"img",
|
|
4269
4280
|
"video",
|
|
4270
4281
|
"audio",
|
|
4271
4282
|
"source"
|
|
4272
|
-
]),
|
|
4283
|
+
]), Ii = [
|
|
4273
4284
|
"src",
|
|
4274
4285
|
"srcset",
|
|
4275
4286
|
"poster"
|
|
4276
4287
|
];
|
|
4277
|
-
function
|
|
4288
|
+
function Li(e) {
|
|
4278
4289
|
let t = (e) => {
|
|
4279
4290
|
let t = e.target;
|
|
4280
|
-
if (!(t instanceof Element) || !
|
|
4291
|
+
if (!(t instanceof Element) || !Fi.has(t.tagName.toLowerCase())) return;
|
|
4281
4292
|
let n = !1;
|
|
4282
|
-
for (let e of
|
|
4293
|
+
for (let e of Ii) {
|
|
4283
4294
|
let r = t.getAttribute(e);
|
|
4284
4295
|
if (!r) continue;
|
|
4285
|
-
let i =
|
|
4296
|
+
let i = le(e, r, (e) => M(e));
|
|
4286
4297
|
i !== void 0 && (t.setAttribute(e, i), n = !0);
|
|
4287
4298
|
}
|
|
4288
4299
|
n && t.tagName.toLowerCase() === "source" && t.parentElement?.load?.();
|
|
4289
4300
|
};
|
|
4290
4301
|
return e.addEventListener("error", t, !0), () => e.removeEventListener("error", t, !0);
|
|
4291
4302
|
}
|
|
4292
|
-
function
|
|
4293
|
-
let a = e.useRef(null), o = e.useMemo(() =>
|
|
4303
|
+
function Ri({ html: t, sanitize: n, render: r, ...i }) {
|
|
4304
|
+
let a = e.useRef(null), o = e.useMemo(() => Pi(t) ? n(F(t)) : void 0, [t, n]);
|
|
4294
4305
|
return e.useEffect(() => {
|
|
4295
4306
|
let e = a.current;
|
|
4296
|
-
return e ?
|
|
4297
|
-
}, [o, r]), o === void 0 ? null : r ? /* @__PURE__ */
|
|
4307
|
+
return e ? Li(e) : void 0;
|
|
4308
|
+
}, [o, r]), o === void 0 ? null : r ? /* @__PURE__ */ B(z, { children: r({ html: o }) }) : /* @__PURE__ */ B("div", {
|
|
4298
4309
|
...i,
|
|
4299
4310
|
ref: a,
|
|
4300
4311
|
dangerouslySetInnerHTML: { __html: o }
|
|
@@ -4302,46 +4313,46 @@ function Li({ html: t, sanitize: n, render: r, ...i }) {
|
|
|
4302
4313
|
}
|
|
4303
4314
|
//#endregion
|
|
4304
4315
|
//#region src/formatSeedJson.ts
|
|
4305
|
-
function
|
|
4316
|
+
function zi(e, t) {
|
|
4306
4317
|
return e.length <= t ? e : `${e.slice(0, t)}…`;
|
|
4307
4318
|
}
|
|
4308
|
-
function
|
|
4319
|
+
function Bi(e) {
|
|
4309
4320
|
let t = e.trim();
|
|
4310
4321
|
return t.startsWith("{") && t.endsWith("}") || t.startsWith("[") && t.endsWith("]");
|
|
4311
4322
|
}
|
|
4312
|
-
function
|
|
4323
|
+
function Vi(e, t, n, r, i) {
|
|
4313
4324
|
if (typeof e == "bigint") return String(e);
|
|
4314
4325
|
if (typeof e == "symbol") return e.toString();
|
|
4315
4326
|
if (typeof e == "function") return "[Function]";
|
|
4316
4327
|
if (e instanceof Date) return e.toISOString();
|
|
4317
|
-
if (typeof e == "string") return
|
|
4328
|
+
if (typeof e == "string") return zi(e, n);
|
|
4318
4329
|
if (typeof e != "object" || !e) return e;
|
|
4319
4330
|
if (i.has(e)) return "[Circular]";
|
|
4320
4331
|
if (r >= t) return "[Max depth]";
|
|
4321
4332
|
i.add(e);
|
|
4322
4333
|
try {
|
|
4323
|
-
if (Array.isArray(e)) return e.map((e) =>
|
|
4334
|
+
if (Array.isArray(e)) return e.map((e) => Vi(e, t, n, r + 1, i));
|
|
4324
4335
|
let a = {};
|
|
4325
|
-
for (let [o, s] of Object.entries(e)) a[o] =
|
|
4336
|
+
for (let [o, s] of Object.entries(e)) a[o] = Vi(s, t, n, r + 1, i);
|
|
4326
4337
|
return a;
|
|
4327
4338
|
} finally {
|
|
4328
4339
|
i.delete(e);
|
|
4329
4340
|
}
|
|
4330
4341
|
}
|
|
4331
|
-
function
|
|
4342
|
+
function Hi(e, t) {
|
|
4332
4343
|
let n = t?.maxDepth ?? 6, r = t?.maxStringLength ?? 5e4, i = t?.space ?? 2;
|
|
4333
4344
|
if (e === void 0) return "undefined";
|
|
4334
4345
|
if (e === null) return "null";
|
|
4335
4346
|
let a = e;
|
|
4336
4347
|
if (typeof e == "string") {
|
|
4337
|
-
if (
|
|
4348
|
+
if (Bi(e)) try {
|
|
4338
4349
|
a = JSON.parse(e);
|
|
4339
4350
|
} catch {
|
|
4340
|
-
return
|
|
4351
|
+
return zi(e, r);
|
|
4341
4352
|
}
|
|
4342
|
-
else return
|
|
4353
|
+
else return zi(e, r);
|
|
4343
4354
|
}
|
|
4344
|
-
let o =
|
|
4355
|
+
let o = Vi(a, n, r, 0, /* @__PURE__ */ new WeakSet());
|
|
4345
4356
|
try {
|
|
4346
4357
|
return JSON.stringify(o, null, i);
|
|
4347
4358
|
} catch {
|
|
@@ -4350,19 +4361,19 @@ function Vi(e, t) {
|
|
|
4350
4361
|
}
|
|
4351
4362
|
//#endregion
|
|
4352
4363
|
//#region src/SeedJson.tsx
|
|
4353
|
-
function
|
|
4354
|
-
let a = t ? t(e) :
|
|
4355
|
-
return r ? /* @__PURE__ */
|
|
4364
|
+
function Ui({ value: e, format: t, formatOptions: n, render: r, ...i }) {
|
|
4365
|
+
let a = t ? t(e) : Hi(e, n);
|
|
4366
|
+
return r ? /* @__PURE__ */ B(z, { children: r({ text: a }) }) : /* @__PURE__ */ B("pre", {
|
|
4356
4367
|
...i,
|
|
4357
4368
|
children: a
|
|
4358
4369
|
});
|
|
4359
4370
|
}
|
|
4360
4371
|
//#endregion
|
|
4361
4372
|
//#region src/useNormalizedFeedItemFields.ts
|
|
4362
|
-
function
|
|
4363
|
-
return o(() => e ?
|
|
4373
|
+
function Wi(e, t) {
|
|
4374
|
+
return o(() => e ? fe(e, t) : {}, [e, t]);
|
|
4364
4375
|
}
|
|
4365
4376
|
//#endregion
|
|
4366
|
-
export {
|
|
4377
|
+
export { Pe as ADDRESSES_PERSISTED_EVENT, yn as FILES_QUERY_KEY_PREFIX, Fe as LOCAL_COPIES_REMOVED_EVENT, vi as OPFSFilesManager, Qr as OPFS_FILES_MANAGER_CSS, Pn as SeedClientGate, Ri as SeedHtml, Ei as SeedImage, Ui as SeedJson, Mi as SeedMediaAudio, ji as SeedMediaFile, Oi as SeedMediaImage, Ni as SeedMediaVideo, jn as SeedProvider, Li as attachArweaveLoadFailover, X as createSeedQueryClient, Hi as formatSeedJson, dt as getItemPropertyQueryKey, Ze as getItemQueryKey, kt as getPercentComplete, We as getSeedQueryDefaultOptions, Tt as getServiceName, Dt as getServiceUniqueKey, Et as getServiceValue, On as invalidateItemPropertiesForItem, se as isClientReadySnapshot, xt as isDbReadyState, Ge as mergeSeedQueryDefaults, Jt as useAllSchemaVersions, K as useClientSelector, Ne as useClientService, at as useCreateItem, vt as useCreateItemProperty, nn as useCreateModel, mn as useCreateModelProperty, Kt as useCreateSchema, St as useDbsAreReady, pt as useDebouncedItemProperty, gn as useDeleteItem, yt as useDestroyItemProperty, rn as useDestroyModel, hn as useDestroyModelProperty, qt as useDestroySchema, En as useEasSyncProcessById, wn as useEasSyncProcesses, Tn as useEasSyncProcessesNonActiveCount, Cn as useEasSyncProcessesState, bi as useEnsureLocalImage, bn as useFiles, It as useGlobalServiceStatus, Nt as useHasSavedSnapshots, vn as useImageFiles, q as useIsClientReady, jt as useIsDbReady, Qe as useItem, _t as useItemProperties, ft as useItemProperty, rt as useItems, Y as useLiveQuery, He as useLiveQueryState, tn as useModel, cn as useModelProperties, pn as useModelProperty, en as useModels, Wi as useNormalizedFeedItemFields, Yn as useOPFSFiles, Mt as usePersistedSnapshots, ot as usePublishItem, Di as useResolvedMediaRef, Bt as useSchema, Gt as useSchemas, Le as useSeedAddressRevision, Yt as useSeedProtocolSchema, At as useService, Ft as useServices, ei as useStorageEstimate, Lr as useThumbnail };
|
|
4367
4378
|
|
|
4368
4379
|
//# sourceMappingURL=index.js.map
|