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