@seedprotocol/react 0.7.7 → 0.7.8-next.1066.gac32194

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