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