@seedprotocol/react 0.7.8-next.1071.g2a141c1 → 0.7.9-next.1110.g7eb9e57

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