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