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