@seedprotocol/react 0.4.15
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/OPFSFilesManager.d.ts +45 -0
- package/dist/OPFSFilesManager.d.ts.map +1 -0
- package/dist/OPFSImage.d.ts +7 -0
- package/dist/OPFSImage.d.ts.map +1 -0
- package/dist/SeedClientGate.d.ts +28 -0
- package/dist/SeedClientGate.d.ts.map +1 -0
- package/dist/SeedImage.d.ts +13 -0
- package/dist/SeedImage.d.ts.map +1 -0
- package/dist/SeedProvider.d.ts +30 -0
- package/dist/SeedProvider.d.ts.map +1 -0
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/db.d.ts +4 -0
- package/dist/db.d.ts.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +1988 -0
- package/dist/index.js.map +1 -0
- package/dist/item.d.ts +42 -0
- package/dist/item.d.ts.map +1 -0
- package/dist/itemProperty.d.ts +116 -0
- package/dist/itemProperty.d.ts.map +1 -0
- package/dist/liveQuery.d.ts +29 -0
- package/dist/liveQuery.d.ts.map +1 -0
- package/dist/model.d.ts +48 -0
- package/dist/model.d.ts.map +1 -0
- package/dist/modelProperty.d.ts +82 -0
- package/dist/modelProperty.d.ts.map +1 -0
- package/dist/queryClient.d.ts +28 -0
- package/dist/queryClient.d.ts.map +1 -0
- package/dist/schema.d.ts +45 -0
- package/dist/schema.d.ts.map +1 -0
- package/dist/services.d.ts +24 -0
- package/dist/services.d.ts.map +1 -0
- package/dist/trash.d.ts +9 -0
- package/dist/trash.d.ts.map +1 -0
- package/dist/useFiles.d.ts +22 -0
- package/dist/useFiles.d.ts.map +1 -0
- package/dist/useImageFiles.d.ts +19 -0
- package/dist/useImageFiles.d.ts.map +1 -0
- package/dist/useOPFSFiles.d.ts +27 -0
- package/dist/useOPFSFiles.d.ts.map +1 -0
- package/package.json +63 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,1988 @@
|
|
|
1
|
+
import Te, { useState as w, useRef as _, useMemo as D, useEffect as I, useCallback as x } from "react";
|
|
2
|
+
import { flushSync as ce } from "react-dom";
|
|
3
|
+
import { getClient as ye, ClientManagerState as F, BaseDb as W, Item as Ne, getAddressesForItemsFilter as Ve, seeds as A, getVersionData as Ke, createNewItem as je, ItemProperty as ne, metadata as T, appState as de, Schema as me, schemas as G, loadAllSchemasFromDb as We, SEED_PROTOCOL_SCHEMA_NAME as Je, Model as se, models as ie, modelSchemas as ge, ModelProperty as ue, properties as Z, getPropertySchema as ke, getSchemaNameFromId as Ge, BaseFileManager as j, eventEmitter as V, client as Ye } from "@seedprotocol/sdk";
|
|
4
|
+
import { orderBy as Xe, debounce as $e, startCase as De } from "lodash-es";
|
|
5
|
+
import J from "debug";
|
|
6
|
+
import { useSelector as we } from "@xstate/react";
|
|
7
|
+
import { or as ee, isNull as ae, eq as O, inArray as _e, sql as Ze, isNotNull as Ie, and as Ee, gt as et, like as Be, desc as tt } from "drizzle-orm";
|
|
8
|
+
import { toSnakeCase as rt } from "drizzle-orm/casing";
|
|
9
|
+
import { useQueryClient as Y, useQuery as X, QueryClient as nt, QueryClientProvider as st } from "@tanstack/react-query";
|
|
10
|
+
import ot from "pluralize";
|
|
11
|
+
import { jsxs as $, jsx as S } from "react/jsx-runtime";
|
|
12
|
+
const H = () => {
|
|
13
|
+
const r = ye().getService();
|
|
14
|
+
return we(r, (n) => n.value === F.IDLE);
|
|
15
|
+
};
|
|
16
|
+
function oe(e) {
|
|
17
|
+
const [r, t] = w(void 0), n = _(null), i = _(void 0), c = H(), o = D(() => {
|
|
18
|
+
if (!c || !e)
|
|
19
|
+
return null;
|
|
20
|
+
try {
|
|
21
|
+
return W.liveQuery(e);
|
|
22
|
+
} catch (l) {
|
|
23
|
+
return console.error("[useLiveQuery] Failed to create live query:", l), null;
|
|
24
|
+
}
|
|
25
|
+
}, [e, c]);
|
|
26
|
+
return I(() => {
|
|
27
|
+
if (n.current && (n.current.unsubscribe(), n.current = null), !o)
|
|
28
|
+
return;
|
|
29
|
+
const l = o.subscribe({
|
|
30
|
+
next: (a) => {
|
|
31
|
+
const s = i.current, d = s ? JSON.stringify(s) : "undefined", u = a ? JSON.stringify(a) : "undefined";
|
|
32
|
+
d === u && s !== void 0 || (i.current = a, t(a));
|
|
33
|
+
},
|
|
34
|
+
error: (a) => {
|
|
35
|
+
console.error("[useLiveQuery] Error:", a);
|
|
36
|
+
}
|
|
37
|
+
});
|
|
38
|
+
return n.current = l, () => {
|
|
39
|
+
n.current && (n.current.unsubscribe(), n.current = null);
|
|
40
|
+
};
|
|
41
|
+
}, [o]), r;
|
|
42
|
+
}
|
|
43
|
+
const fe = J("seedSdk:react:item"), Kt = ({ modelName: e, seedLocalId: r, seedUid: t }) => {
|
|
44
|
+
const [n, i] = w(), [c, o] = w(!!(r || t)), [l, a] = w(null), s = _(void 0), d = _(!1), u = H(), f = _(e), h = _(r), b = _(t), v = D(() => u ? !!(h.current || b.current) : !1, [u, r, t]), p = x(async () => {
|
|
45
|
+
if (!!!(u && (h.current || b.current))) {
|
|
46
|
+
i(void 0), o(!1), a(null);
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
try {
|
|
50
|
+
a(null);
|
|
51
|
+
const m = await Ne.find({
|
|
52
|
+
modelName: f.current,
|
|
53
|
+
seedLocalId: h.current,
|
|
54
|
+
seedUid: b.current
|
|
55
|
+
});
|
|
56
|
+
if (!m) {
|
|
57
|
+
fe("[useItem] [loadItem] no item found", f.current, h.current), i((E) => E && (E.seedLocalId && E.seedLocalId === h.current || E.seedUid && E.seedUid === b.current) ? E : void 0), o(!1), a(null);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
i(m), o(!1), a(null);
|
|
61
|
+
} catch (m) {
|
|
62
|
+
fe("[useItem] Error loading item:", m), i(void 0), o(!1), a(m);
|
|
63
|
+
}
|
|
64
|
+
}, [u]);
|
|
65
|
+
return I(() => {
|
|
66
|
+
f.current = e, h.current = r, b.current = t;
|
|
67
|
+
}, [e, r, t]), I(() => {
|
|
68
|
+
if (!v) {
|
|
69
|
+
!r && !t && (i(void 0), o(!1), a(null));
|
|
70
|
+
return;
|
|
71
|
+
}
|
|
72
|
+
p();
|
|
73
|
+
}, [v, p, r, t]), I(() => {
|
|
74
|
+
if (!n) {
|
|
75
|
+
s.current?.unsubscribe(), s.current = void 0, d.current = !1;
|
|
76
|
+
return;
|
|
77
|
+
}
|
|
78
|
+
s.current?.unsubscribe(), d.current = !1;
|
|
79
|
+
const m = n.getService().subscribe((E) => {
|
|
80
|
+
E && typeof E == "object" && "value" in E && (E.value === "idle" ? (d.current = !0, o(!1), a(null)) : E.value === "error" ? (a(new Error("Item service error")), o(!1)) : d.current && o(!0));
|
|
81
|
+
});
|
|
82
|
+
return s.current = m, () => {
|
|
83
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
84
|
+
};
|
|
85
|
+
}, [n]), {
|
|
86
|
+
item: n,
|
|
87
|
+
isLoading: c,
|
|
88
|
+
error: l
|
|
89
|
+
};
|
|
90
|
+
}, it = (e, r, t, n) => ["seed", "items", e ?? null, r ?? !1, t ?? !1, n ?? null], jt = ({
|
|
91
|
+
modelName: e,
|
|
92
|
+
deleted: r = !1,
|
|
93
|
+
includeEas: t = !1,
|
|
94
|
+
addressFilter: n
|
|
95
|
+
}) => {
|
|
96
|
+
const i = H(), c = Y(), o = _(void 0), l = _([]), a = _(/* @__PURE__ */ new Set()), [s, d] = w(null);
|
|
97
|
+
I(() => {
|
|
98
|
+
if (n !== "owned" && n !== "watched") {
|
|
99
|
+
d(null);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
let m = !1;
|
|
103
|
+
return Ve(n).then((E) => {
|
|
104
|
+
m || d(E);
|
|
105
|
+
}), () => {
|
|
106
|
+
m = !0;
|
|
107
|
+
};
|
|
108
|
+
}, [n]);
|
|
109
|
+
const u = D(
|
|
110
|
+
() => it(e, r, t, n),
|
|
111
|
+
[e, r, t, n]
|
|
112
|
+
), {
|
|
113
|
+
data: f = [],
|
|
114
|
+
isLoading: h,
|
|
115
|
+
error: b
|
|
116
|
+
} = X({
|
|
117
|
+
queryKey: u,
|
|
118
|
+
queryFn: () => Ne.all(e, r, { waitForReady: !0, includeEas: t, addressFilter: n }),
|
|
119
|
+
enabled: i
|
|
120
|
+
});
|
|
121
|
+
l.current = f;
|
|
122
|
+
const v = i ? W.getAppDb() : null, p = D(() => {
|
|
123
|
+
if (!v || (n === "owned" || n === "watched") && s === null)
|
|
124
|
+
return null;
|
|
125
|
+
const m = [];
|
|
126
|
+
t || m.push(ee(ae(A.uid), O(A.uid, ""))), e && m.push(O(A.type, rt(e))), n === "owned" ? s && s.length > 0 && m.push(
|
|
127
|
+
ee(
|
|
128
|
+
_e(A.publisher, s),
|
|
129
|
+
ae(A.publisher)
|
|
130
|
+
)
|
|
131
|
+
) : n === "watched" && (s && s.length > 0 ? m.push(_e(A.publisher, s)) : m.push(Ze`1=0`)), r ? m.push(
|
|
132
|
+
ee(
|
|
133
|
+
Ie(A._markedForDeletion),
|
|
134
|
+
O(A._markedForDeletion, 1)
|
|
135
|
+
)
|
|
136
|
+
) : (m.push(
|
|
137
|
+
ee(
|
|
138
|
+
ae(A._markedForDeletion),
|
|
139
|
+
O(A._markedForDeletion, 0)
|
|
140
|
+
)
|
|
141
|
+
), m.push(
|
|
142
|
+
ee(ae(A.revokedAt), O(A.revokedAt, 0))
|
|
143
|
+
));
|
|
144
|
+
const E = Ke();
|
|
145
|
+
return v.with(E).select({
|
|
146
|
+
localId: A.localId,
|
|
147
|
+
uid: A.uid,
|
|
148
|
+
type: A.type,
|
|
149
|
+
schemaUid: A.schemaUid,
|
|
150
|
+
createdAt: A.createdAt,
|
|
151
|
+
attestationCreatedAt: A.attestationCreatedAt,
|
|
152
|
+
_markedForDeletion: A._markedForDeletion
|
|
153
|
+
}).from(A).leftJoin(E, O(A.localId, E.seedLocalId)).where(Ee(et(E.versionsCount, 0), ...m)).groupBy(A.localId);
|
|
154
|
+
}, [v, i, e, r, t, n, s]), y = oe(p);
|
|
155
|
+
return I(() => {
|
|
156
|
+
if (!i || !y) return;
|
|
157
|
+
const m = /* @__PURE__ */ new Set();
|
|
158
|
+
for (const N of y) {
|
|
159
|
+
const M = N.localId || N.uid;
|
|
160
|
+
M && m.add(M);
|
|
161
|
+
}
|
|
162
|
+
const E = /* @__PURE__ */ new Set();
|
|
163
|
+
for (const N of l.current) {
|
|
164
|
+
const M = N.seedLocalId || N.seedUid;
|
|
165
|
+
M && E.add(M);
|
|
166
|
+
}
|
|
167
|
+
if (m.size === 0 && E.size > 0) return;
|
|
168
|
+
const g = a.current;
|
|
169
|
+
if (g.size === m.size && [...g].every((N) => m.has(N)))
|
|
170
|
+
return;
|
|
171
|
+
if (o.current = y, E.size === m.size && [...E].every((N) => m.has(N))) {
|
|
172
|
+
a.current = new Set(m);
|
|
173
|
+
return;
|
|
174
|
+
}
|
|
175
|
+
a.current = new Set(m), c.invalidateQueries({ queryKey: u });
|
|
176
|
+
}, [i, y, c, u]), {
|
|
177
|
+
items: Xe(
|
|
178
|
+
f,
|
|
179
|
+
[
|
|
180
|
+
(m) => m.lastVersionPublishedAt || m.attestationCreatedAt || m.createdAt
|
|
181
|
+
],
|
|
182
|
+
["desc"]
|
|
183
|
+
),
|
|
184
|
+
isLoading: h,
|
|
185
|
+
error: b
|
|
186
|
+
};
|
|
187
|
+
}, Wt = () => {
|
|
188
|
+
const [e, r] = w(!1), [t, n] = w(null), i = x(() => n(null), []);
|
|
189
|
+
return {
|
|
190
|
+
createItem: x(
|
|
191
|
+
async (o, l) => {
|
|
192
|
+
if (e) {
|
|
193
|
+
fe("[useCreateItem] [createItem] already creating item, skipping");
|
|
194
|
+
return;
|
|
195
|
+
}
|
|
196
|
+
n(null), ce(() => r(!0));
|
|
197
|
+
try {
|
|
198
|
+
const a = l ?? {}, { seedLocalId: s } = await je({ modelName: o, ...a });
|
|
199
|
+
return await Ne.find({ modelName: o, seedLocalId: s }) ?? void 0;
|
|
200
|
+
} catch (a) {
|
|
201
|
+
fe("[useCreateItem] Error creating item:", a), n(a instanceof Error ? a : new Error(String(a)));
|
|
202
|
+
return;
|
|
203
|
+
} finally {
|
|
204
|
+
queueMicrotask(() => r(!1));
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
[e]
|
|
208
|
+
),
|
|
209
|
+
isLoading: e,
|
|
210
|
+
error: t,
|
|
211
|
+
resetError: i
|
|
212
|
+
};
|
|
213
|
+
}, Jt = () => {
|
|
214
|
+
const [e, r] = w(null), [t, n] = w(!1), [i, c] = w(null), o = _(void 0), l = x(() => c(null), []), a = x((s) => {
|
|
215
|
+
s && (r(s), c(null), s.publish().catch(() => {
|
|
216
|
+
}));
|
|
217
|
+
}, []);
|
|
218
|
+
return I(() => {
|
|
219
|
+
if (!e) {
|
|
220
|
+
o.current?.unsubscribe(), o.current = void 0, n(!1);
|
|
221
|
+
return;
|
|
222
|
+
}
|
|
223
|
+
o.current?.unsubscribe();
|
|
224
|
+
const s = e.getService(), d = s.subscribe((b) => {
|
|
225
|
+
const v = b?.value, p = b?.context;
|
|
226
|
+
n(v === "publishing");
|
|
227
|
+
const y = p?._publishError;
|
|
228
|
+
c(y ? new Error(y.message) : null);
|
|
229
|
+
});
|
|
230
|
+
o.current = d;
|
|
231
|
+
const u = s.getSnapshot();
|
|
232
|
+
n(u?.value === "publishing");
|
|
233
|
+
const h = u?.context?._publishError;
|
|
234
|
+
return c(h ? new Error(h.message) : null), () => {
|
|
235
|
+
o.current?.unsubscribe(), o.current = void 0;
|
|
236
|
+
};
|
|
237
|
+
}, [e]), {
|
|
238
|
+
publishItem: a,
|
|
239
|
+
isLoading: t,
|
|
240
|
+
error: i,
|
|
241
|
+
resetError: l
|
|
242
|
+
};
|
|
243
|
+
}, pe = J("seedSdk:react:property"), re = J("seedSdk:react:itemProperties");
|
|
244
|
+
function Ue(e, r) {
|
|
245
|
+
const t = H(), [n, i] = w(void 0), [c, o] = w(!1), [l, a] = w(null), s = _(void 0), [, d] = w(0), f = typeof e == "object" && e != null ? e : null, h = f?.itemId, b = f?.seedLocalId, v = f?.seedUid, p = f?.propertyName, y = typeof e == "string" ? e : h !== void 0 && h !== "" ? h : void 0, E = p ?? (typeof e == "string" ? r : void 0), g = D(() => {
|
|
246
|
+
const M = y !== void 0 && y !== "" ? y : b, q = y !== void 0 && y !== "" ? void 0 : v;
|
|
247
|
+
return (M != null || q != null) && E != null && E !== "" ? {
|
|
248
|
+
type: "identifiers",
|
|
249
|
+
seedLocalId: M ?? void 0,
|
|
250
|
+
seedUid: q,
|
|
251
|
+
propertyName: E
|
|
252
|
+
} : null;
|
|
253
|
+
}, [y, E, b, v]);
|
|
254
|
+
D(() => g ? !!((g.seedLocalId || g.seedUid) && g.propertyName) : !1, [g]);
|
|
255
|
+
const z = D(() => !t || !g ? !1 : !!((g.seedLocalId || g.seedUid) && g.propertyName), [t, g]), N = x(async () => {
|
|
256
|
+
if (!t || !g) {
|
|
257
|
+
i(void 0), o(!1), a(null);
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
try {
|
|
261
|
+
o(!0), a(null);
|
|
262
|
+
const M = g.seedLocalId, q = g.seedUid;
|
|
263
|
+
if (!M && !q) {
|
|
264
|
+
i(void 0), o(!1), a(null);
|
|
265
|
+
return;
|
|
266
|
+
}
|
|
267
|
+
const K = await ne.find({
|
|
268
|
+
propertyName: g.propertyName,
|
|
269
|
+
seedLocalId: M,
|
|
270
|
+
seedUid: q
|
|
271
|
+
});
|
|
272
|
+
if (!K) {
|
|
273
|
+
pe(
|
|
274
|
+
`[useItemProperty] [updateItemProperty] no property found for Item.${M || q}.${g.propertyName}`
|
|
275
|
+
), i(void 0), o(!1), a(null);
|
|
276
|
+
return;
|
|
277
|
+
}
|
|
278
|
+
i(K), o(!1), a(null);
|
|
279
|
+
} catch (M) {
|
|
280
|
+
pe("[useItemProperty] Error updating item property:", M), i(void 0), o(!1), a(M);
|
|
281
|
+
}
|
|
282
|
+
}, [t, g]);
|
|
283
|
+
return I(() => {
|
|
284
|
+
if (!z) {
|
|
285
|
+
i(void 0), o(!1), a(null);
|
|
286
|
+
return;
|
|
287
|
+
}
|
|
288
|
+
n && g && n.propertyName === g.propertyName && (g.seedLocalId != null && n.seedLocalId === g.seedLocalId || g.seedUid != null && n.seedUid === g.seedUid) || N();
|
|
289
|
+
}, [z, N, n, g]), I(() => {
|
|
290
|
+
if (!n) {
|
|
291
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
292
|
+
return;
|
|
293
|
+
}
|
|
294
|
+
s.current?.unsubscribe();
|
|
295
|
+
let M = 0, q = !1;
|
|
296
|
+
const K = 50, L = n.getService().subscribe((C) => {
|
|
297
|
+
if (C && typeof C == "object" && "value" in C && C.value === "idle") {
|
|
298
|
+
o(!1), a(null), q || (q = !0, d((Q) => Q + 1));
|
|
299
|
+
return;
|
|
300
|
+
}
|
|
301
|
+
q = !1;
|
|
302
|
+
const B = Date.now();
|
|
303
|
+
B - M >= K && (M = B, d((Q) => Q + 1));
|
|
304
|
+
});
|
|
305
|
+
return s.current = L, () => {
|
|
306
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
307
|
+
};
|
|
308
|
+
}, [n]), {
|
|
309
|
+
property: n,
|
|
310
|
+
isLoading: c,
|
|
311
|
+
error: l
|
|
312
|
+
};
|
|
313
|
+
}
|
|
314
|
+
function Gt(e, r = 300) {
|
|
315
|
+
const t = "itemId" in e ? e.itemId : void 0, n = "seedLocalId" in e ? e.seedLocalId : void 0, i = "seedUid" in e ? e.seedUid : void 0, c = e.propertyName, o = D(() => t ? { seedLocalId: t, propertyName: c } : { seedLocalId: n, seedUid: i, propertyName: c }, [t, n, i, c]), { property: l, isLoading: a, error: s } = Ue(o), d = _(""), u = D(
|
|
316
|
+
() => $e((h) => {
|
|
317
|
+
h.getService().send({
|
|
318
|
+
type: "save",
|
|
319
|
+
newValue: d.current
|
|
320
|
+
});
|
|
321
|
+
}, r),
|
|
322
|
+
[r]
|
|
323
|
+
);
|
|
324
|
+
I(() => () => u.cancel(), [u]);
|
|
325
|
+
const f = x(
|
|
326
|
+
(h) => {
|
|
327
|
+
l && (d.current = h, l.getService().send({
|
|
328
|
+
type: "updateContext",
|
|
329
|
+
propertyValue: h,
|
|
330
|
+
renderValue: h
|
|
331
|
+
}), u(l));
|
|
332
|
+
},
|
|
333
|
+
[l, u]
|
|
334
|
+
);
|
|
335
|
+
return {
|
|
336
|
+
property: l,
|
|
337
|
+
setValue: f,
|
|
338
|
+
isLoading: a,
|
|
339
|
+
error: s
|
|
340
|
+
};
|
|
341
|
+
}
|
|
342
|
+
async function at(e, r) {
|
|
343
|
+
if (!e && !r) return [];
|
|
344
|
+
const t = W.getAppDb();
|
|
345
|
+
if (!t) return [];
|
|
346
|
+
const n = await ne.all(
|
|
347
|
+
{ seedLocalId: e ?? void 0, seedUid: r ?? void 0 },
|
|
348
|
+
{ waitForReady: !0 }
|
|
349
|
+
), i = [...n], c = /* @__PURE__ */ new Set();
|
|
350
|
+
for (const a of n)
|
|
351
|
+
a.propertyName && c.add(a.propertyName);
|
|
352
|
+
let o;
|
|
353
|
+
if (n.length > 0) {
|
|
354
|
+
const a = n[0];
|
|
355
|
+
o = a.modelName ?? a.modelType, o && typeof o == "string" && (o = De(o));
|
|
356
|
+
}
|
|
357
|
+
if (!o) {
|
|
358
|
+
const a = await t.select({ type: A.type }).from(A).where(r ? O(A.uid, r) : O(A.localId, e)).limit(1);
|
|
359
|
+
a.length > 0 && a[0].type && (o = De(a[0].type));
|
|
360
|
+
}
|
|
361
|
+
const l = [];
|
|
362
|
+
if (o)
|
|
363
|
+
try {
|
|
364
|
+
const { Model: a } = await import("@seedprotocol/sdk"), s = await a.getByNameAsync(o);
|
|
365
|
+
if (s?.properties)
|
|
366
|
+
for (const d of s.properties)
|
|
367
|
+
d.name && l.push(d.name);
|
|
368
|
+
} catch (a) {
|
|
369
|
+
re(`[useItemProperties] Error getting ModelProperties for ${o}:`, a);
|
|
370
|
+
}
|
|
371
|
+
if (o && l.length > 0) {
|
|
372
|
+
const a = n.length > 0 ? n[0].seedLocalId ?? e : e, s = n.length > 0 ? n[0].seedUid ?? r : r;
|
|
373
|
+
for (const d of l)
|
|
374
|
+
if (!c.has(d))
|
|
375
|
+
try {
|
|
376
|
+
const u = ne.create(
|
|
377
|
+
{
|
|
378
|
+
propertyName: d,
|
|
379
|
+
modelName: o,
|
|
380
|
+
seedLocalId: a || void 0,
|
|
381
|
+
seedUid: s || void 0,
|
|
382
|
+
propertyValue: null
|
|
383
|
+
},
|
|
384
|
+
{ waitForReady: !1 }
|
|
385
|
+
);
|
|
386
|
+
u && i.push(u);
|
|
387
|
+
} catch (u) {
|
|
388
|
+
pe(`[useItemProperties] Error creating ItemProperty for missing property ${d}:`, u);
|
|
389
|
+
}
|
|
390
|
+
}
|
|
391
|
+
if (e || r) {
|
|
392
|
+
const a = await t.select({ createdAt: A.createdAt }).from(A).where(r ? O(A.uid, r) : O(A.localId, e)).limit(1);
|
|
393
|
+
if (a.length > 0 && a[0].createdAt) {
|
|
394
|
+
const s = "createdAt";
|
|
395
|
+
if (!i.some((u) => u.propertyName === s) && o)
|
|
396
|
+
try {
|
|
397
|
+
const u = n.length > 0 ? n[0].seedLocalId ?? e : e, f = n.length > 0 ? n[0].seedUid ?? r : r, h = ne.create(
|
|
398
|
+
{
|
|
399
|
+
propertyName: s,
|
|
400
|
+
modelName: o,
|
|
401
|
+
seedLocalId: u || void 0,
|
|
402
|
+
seedUid: f || void 0,
|
|
403
|
+
propertyValue: a[0].createdAt.toString()
|
|
404
|
+
},
|
|
405
|
+
{ waitForReady: !1 }
|
|
406
|
+
);
|
|
407
|
+
h && i.push(h);
|
|
408
|
+
} catch (u) {
|
|
409
|
+
pe("[useItemProperties] Error creating createdAt ItemProperty:", u);
|
|
410
|
+
}
|
|
411
|
+
}
|
|
412
|
+
}
|
|
413
|
+
return i;
|
|
414
|
+
}
|
|
415
|
+
function Yt(e) {
|
|
416
|
+
const r = H(), t = Y(), n = _(void 0), i = D(() => typeof e == "string" ? { type: "itemId", itemId: e } : typeof e == "object" ? {
|
|
417
|
+
type: "identifiers",
|
|
418
|
+
seedLocalId: e.seedLocalId,
|
|
419
|
+
seedUid: e.seedUid
|
|
420
|
+
} : null, [e]), c = D(() => {
|
|
421
|
+
if (i)
|
|
422
|
+
return i.type === "itemId" ? i.itemId : i.seedLocalId;
|
|
423
|
+
}, [i]), o = D(() => {
|
|
424
|
+
if (!(!i || i.type === "itemId"))
|
|
425
|
+
return i.seedUid;
|
|
426
|
+
}, [i]), l = c ?? o ?? "", a = D(
|
|
427
|
+
() => ["seed", "itemProperties", l],
|
|
428
|
+
[l]
|
|
429
|
+
), {
|
|
430
|
+
data: s = [],
|
|
431
|
+
isLoading: d,
|
|
432
|
+
error: u
|
|
433
|
+
} = X({
|
|
434
|
+
queryKey: a,
|
|
435
|
+
queryFn: () => at(c, o),
|
|
436
|
+
enabled: r && !!l
|
|
437
|
+
}), f = D(() => {
|
|
438
|
+
if (!r || !c && !o)
|
|
439
|
+
return re("[useItemProperties] Query: returning null (not ready or no identifiers)"), null;
|
|
440
|
+
const v = W.getAppDb();
|
|
441
|
+
if (!v)
|
|
442
|
+
return re("[useItemProperties] Query: returning null (no db)"), null;
|
|
443
|
+
re(`[useItemProperties] Query: creating query for seedLocalId=${c}, seedUid=${o}`);
|
|
444
|
+
const p = o ? v.select({
|
|
445
|
+
propertyName: T.propertyName,
|
|
446
|
+
propertyValue: T.propertyValue,
|
|
447
|
+
seedLocalId: T.seedLocalId,
|
|
448
|
+
seedUid: T.seedUid,
|
|
449
|
+
modelType: T.modelType,
|
|
450
|
+
schemaUid: T.schemaUid,
|
|
451
|
+
createdAt: T.createdAt,
|
|
452
|
+
attestationCreatedAt: T.attestationCreatedAt
|
|
453
|
+
}).from(T).where(
|
|
454
|
+
Ee(
|
|
455
|
+
O(T.seedUid, o),
|
|
456
|
+
Ie(T.propertyName)
|
|
457
|
+
)
|
|
458
|
+
) : c ? v.select({
|
|
459
|
+
propertyName: T.propertyName,
|
|
460
|
+
propertyValue: T.propertyValue,
|
|
461
|
+
seedLocalId: T.seedLocalId,
|
|
462
|
+
seedUid: T.seedUid,
|
|
463
|
+
modelType: T.modelType,
|
|
464
|
+
schemaUid: T.schemaUid,
|
|
465
|
+
createdAt: T.createdAt,
|
|
466
|
+
attestationCreatedAt: T.attestationCreatedAt
|
|
467
|
+
}).from(T).where(
|
|
468
|
+
Ee(
|
|
469
|
+
O(T.seedLocalId, c),
|
|
470
|
+
Ie(T.propertyName)
|
|
471
|
+
)
|
|
472
|
+
) : null;
|
|
473
|
+
return re("[useItemProperties] Query: created query object", { queryType: o ? "seedUid" : "seedLocalId" }), p;
|
|
474
|
+
}, [r, c, o]), h = oe(f), b = D(() => {
|
|
475
|
+
if (!h || h.length === 0)
|
|
476
|
+
return [];
|
|
477
|
+
const v = /* @__PURE__ */ new Map();
|
|
478
|
+
for (const p of h) {
|
|
479
|
+
if (!p.propertyName) continue;
|
|
480
|
+
const y = v.get(p.propertyName);
|
|
481
|
+
if (!y)
|
|
482
|
+
v.set(p.propertyName, p);
|
|
483
|
+
else {
|
|
484
|
+
const m = y.attestationCreatedAt || y.createdAt || 0;
|
|
485
|
+
(p.attestationCreatedAt || p.createdAt || 0) > m && v.set(p.propertyName, p);
|
|
486
|
+
}
|
|
487
|
+
}
|
|
488
|
+
return Array.from(v.values());
|
|
489
|
+
}, [h]);
|
|
490
|
+
return I(() => {
|
|
491
|
+
if (!r || !c && !o || b === void 0) return;
|
|
492
|
+
const v = JSON.stringify(
|
|
493
|
+
b.map((p) => ({
|
|
494
|
+
propertyName: p.propertyName,
|
|
495
|
+
propertyValue: p.propertyValue,
|
|
496
|
+
seedLocalId: p.seedLocalId,
|
|
497
|
+
seedUid: p.seedUid
|
|
498
|
+
})).sort((p, y) => (p.propertyName || "").localeCompare(y.propertyName || ""))
|
|
499
|
+
);
|
|
500
|
+
n.current !== v && (n.current = v, b.length > 0 && t.invalidateQueries({ queryKey: a }));
|
|
501
|
+
}, [r, b, s, c, o, t, a]), I(() => {
|
|
502
|
+
n.current = void 0;
|
|
503
|
+
}, [c, o]), {
|
|
504
|
+
properties: s,
|
|
505
|
+
isLoading: d,
|
|
506
|
+
error: u
|
|
507
|
+
};
|
|
508
|
+
}
|
|
509
|
+
const Xt = () => {
|
|
510
|
+
const e = _(void 0), [r, t] = w(!1), [n, i] = w(null), c = x(() => i(null), []), o = x((l) => {
|
|
511
|
+
if (!l.propertyName || !l.seedLocalId && !l.seedUid || !l.modelName) {
|
|
512
|
+
const d = new Error("seedLocalId or seedUid, propertyName, and modelName are required");
|
|
513
|
+
i(d);
|
|
514
|
+
return;
|
|
515
|
+
}
|
|
516
|
+
i(null), t(!0), e.current?.unsubscribe(), e.current = void 0;
|
|
517
|
+
const a = ne.create(l, { waitForReady: !1 });
|
|
518
|
+
if (!a) {
|
|
519
|
+
i(new Error("Failed to create item property")), t(!1);
|
|
520
|
+
return;
|
|
521
|
+
}
|
|
522
|
+
const s = a.getService().subscribe((d) => {
|
|
523
|
+
if (d?.value === "error") {
|
|
524
|
+
const u = d.context?._loadingError?.error ?? new Error("Failed to create item property");
|
|
525
|
+
i(u instanceof Error ? u : new Error(String(u))), t(!1);
|
|
526
|
+
}
|
|
527
|
+
d?.value === "idle" && (i(null), t(!1));
|
|
528
|
+
});
|
|
529
|
+
return e.current = s, a;
|
|
530
|
+
}, []);
|
|
531
|
+
return I(() => () => {
|
|
532
|
+
e.current?.unsubscribe(), e.current = void 0;
|
|
533
|
+
}, []), {
|
|
534
|
+
create: o,
|
|
535
|
+
isLoading: r,
|
|
536
|
+
error: n,
|
|
537
|
+
resetError: c
|
|
538
|
+
};
|
|
539
|
+
}, Zt = () => {
|
|
540
|
+
const [e, r] = w(null), [t, n] = w({
|
|
541
|
+
isLoading: !1,
|
|
542
|
+
error: null
|
|
543
|
+
});
|
|
544
|
+
I(() => {
|
|
545
|
+
if (!e) {
|
|
546
|
+
n({ isLoading: !1, error: null });
|
|
547
|
+
return;
|
|
548
|
+
}
|
|
549
|
+
const o = e.getService(), l = () => {
|
|
550
|
+
const d = o.getSnapshot().context;
|
|
551
|
+
n({
|
|
552
|
+
isLoading: !!d._destroyInProgress,
|
|
553
|
+
error: d._destroyError ? new Error(d._destroyError.message) : null
|
|
554
|
+
});
|
|
555
|
+
};
|
|
556
|
+
l();
|
|
557
|
+
const a = o.subscribe(l);
|
|
558
|
+
return () => a.unsubscribe();
|
|
559
|
+
}, [e]);
|
|
560
|
+
const i = x(async (o) => {
|
|
561
|
+
o && (r(o), await o.destroy());
|
|
562
|
+
}, []), c = x(() => {
|
|
563
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
564
|
+
}, [e]);
|
|
565
|
+
return {
|
|
566
|
+
destroy: i,
|
|
567
|
+
isLoading: t.isLoading,
|
|
568
|
+
error: t.error,
|
|
569
|
+
resetError: c
|
|
570
|
+
};
|
|
571
|
+
}, Le = J("seedSdk:react:services"), lt = ["idle", "ready", "done", "success", "initialized"], Oe = (e) => {
|
|
572
|
+
let r = "actor";
|
|
573
|
+
const t = e;
|
|
574
|
+
return e && t.uniqueKey && (r = t.uniqueKey), e && !t.uniqueKey && t.logic && t.logic.config && (r = Ae(e)), r;
|
|
575
|
+
}, Fe = (e) => {
|
|
576
|
+
let r;
|
|
577
|
+
return e && e.getSnapshot() && e.getSnapshot().value && (r = e.getSnapshot().value), Oe(e) === "global" && r && typeof r == "object" && Object.keys(r).length > 0 && Object.keys(r)[0] === "initialized" && (r = "ready"), r && typeof r == "object" && (r = JSON.stringify(r)), r;
|
|
578
|
+
}, Ae = (e) => {
|
|
579
|
+
const r = e;
|
|
580
|
+
if (!e || !r.logic || !r.logic.config || !r._snapshot)
|
|
581
|
+
return;
|
|
582
|
+
const t = r.logic.config;
|
|
583
|
+
if (!t.id)
|
|
584
|
+
return;
|
|
585
|
+
let n = t.id;
|
|
586
|
+
t.id.includes("@seedSdk/") && (n = t.id.match(/^.*@seedSdk\/(\w+)[\.\w]*/)[1]);
|
|
587
|
+
let i;
|
|
588
|
+
try {
|
|
589
|
+
i = e.getSnapshot();
|
|
590
|
+
} catch (c) {
|
|
591
|
+
return Le("Error:", c), n;
|
|
592
|
+
}
|
|
593
|
+
if (i) {
|
|
594
|
+
const c = i.context;
|
|
595
|
+
c && c.dbName && (n = c.dbName), c && c.modelNamePlural && (n = c.modelNamePlural), c && c.modelName && (n = ot(c.modelName.toLowerCase()));
|
|
596
|
+
}
|
|
597
|
+
return n;
|
|
598
|
+
}, er = (e) => {
|
|
599
|
+
const [r, t] = w(0), n = (o) => {
|
|
600
|
+
let l = 0;
|
|
601
|
+
const a = o;
|
|
602
|
+
if (a.logic?.states) {
|
|
603
|
+
const s = [], d = [];
|
|
604
|
+
for (const [h, b] of Object.entries(a.logic.states))
|
|
605
|
+
b.tags?.includes("loading") && (s.push(h), d.push(b));
|
|
606
|
+
const u = d.length, f = Fe(o);
|
|
607
|
+
if (f && lt.includes(f))
|
|
608
|
+
return 0;
|
|
609
|
+
f && (l = s.indexOf(f) / u * 100);
|
|
610
|
+
}
|
|
611
|
+
return l;
|
|
612
|
+
}, i = x(
|
|
613
|
+
(o) => {
|
|
614
|
+
e.getSnapshot().context;
|
|
615
|
+
const l = e.getSnapshot().value;
|
|
616
|
+
if (l === "done" || l === "success" || l === "idle" || l === "ready") {
|
|
617
|
+
clearInterval(o);
|
|
618
|
+
return;
|
|
619
|
+
}
|
|
620
|
+
t((a) => a + 1);
|
|
621
|
+
},
|
|
622
|
+
[e]
|
|
623
|
+
), c = x(() => {
|
|
624
|
+
const o = setInterval(() => {
|
|
625
|
+
i(o);
|
|
626
|
+
}, 1e3);
|
|
627
|
+
return o;
|
|
628
|
+
}, [i, e]);
|
|
629
|
+
return I(() => {
|
|
630
|
+
const o = c();
|
|
631
|
+
return () => clearInterval(o);
|
|
632
|
+
}, []), {
|
|
633
|
+
name: Oe(e),
|
|
634
|
+
timeElapsed: r,
|
|
635
|
+
value: Fe(e),
|
|
636
|
+
percentComplete: n(e),
|
|
637
|
+
uniqueKey: Ae(e)
|
|
638
|
+
};
|
|
639
|
+
}, ct = () => {
|
|
640
|
+
const [e, r] = w(!1), { internalStatus: t } = ft();
|
|
641
|
+
return I(() => {
|
|
642
|
+
t === "ready" && r(!0);
|
|
643
|
+
}, [t]), I(() => {
|
|
644
|
+
t === "ready" && r(!0);
|
|
645
|
+
}, []), e;
|
|
646
|
+
}, tr = () => {
|
|
647
|
+
const [e, r] = w(!1), t = dt(), { services: n, percentComplete: i } = ut(), c = x(async () => {
|
|
648
|
+
for (const l of n) {
|
|
649
|
+
const a = Ae(l);
|
|
650
|
+
Le(
|
|
651
|
+
`would save to db with snapshot__${a}:`,
|
|
652
|
+
JSON.stringify(l.getPersistedSnapshot())
|
|
653
|
+
);
|
|
654
|
+
}
|
|
655
|
+
}, [n]), o = x(async () => {
|
|
656
|
+
const l = W.getAppDb();
|
|
657
|
+
return l ? await l.select().from(de).where(Be(de.key, "snapshot__%")) : [];
|
|
658
|
+
}, []);
|
|
659
|
+
I(() => !t || e ? void 0 : ((async () => {
|
|
660
|
+
const a = await o();
|
|
661
|
+
Le("persistedSnapshots:", a), r(!0);
|
|
662
|
+
})(), () => {
|
|
663
|
+
c();
|
|
664
|
+
}), [t, e]);
|
|
665
|
+
}, dt = () => {
|
|
666
|
+
const [e, r] = w(!1), t = ct();
|
|
667
|
+
return I(() => {
|
|
668
|
+
t && (async () => {
|
|
669
|
+
const c = await W.getAppDb().select().from(de).where(Be(de.key, "snapshot__%"));
|
|
670
|
+
c && c.length > 0 && r(!0);
|
|
671
|
+
})();
|
|
672
|
+
}, [t]), e;
|
|
673
|
+
}, ut = () => {
|
|
674
|
+
const [e, r] = w([]), [t, n] = w(5);
|
|
675
|
+
return I(() => {
|
|
676
|
+
const c = ye().getService(), o = c;
|
|
677
|
+
o.uniqueKey = "clientManager", r([o]);
|
|
678
|
+
const l = c.subscribe((a) => {
|
|
679
|
+
const s = a.value;
|
|
680
|
+
let d = 0;
|
|
681
|
+
s === F.IDLE ? d = 100 : s === F.ADD_MODELS_TO_DB ? d = 90 : s === F.ADD_MODELS_TO_STORE ? d = 80 : s === F.PROCESS_SCHEMA_FILES ? d = 70 : s === F.SAVE_CONFIG ? d = 60 : s === F.DB_INIT ? d = 50 : s === F.FILE_SYSTEM_INIT ? d = 30 : s === F.PLATFORM_CLASSES_INIT && (d = 10), n(d);
|
|
682
|
+
});
|
|
683
|
+
return () => {
|
|
684
|
+
l.unsubscribe();
|
|
685
|
+
};
|
|
686
|
+
}, []), {
|
|
687
|
+
services: e,
|
|
688
|
+
percentComplete: t
|
|
689
|
+
};
|
|
690
|
+
}, ft = () => {
|
|
691
|
+
const r = ye().getService(), t = we(r, (i) => i.value), n = we(r, (i) => {
|
|
692
|
+
const c = i.value;
|
|
693
|
+
return c === F.DB_INIT || c === F.SAVE_CONFIG || c === F.PROCESS_SCHEMA_FILES || c === F.ADD_MODELS_TO_STORE || c === F.ADD_MODELS_TO_DB || c === F.IDLE ? "ready" : c;
|
|
694
|
+
});
|
|
695
|
+
return {
|
|
696
|
+
status: t,
|
|
697
|
+
internalStatus: n
|
|
698
|
+
};
|
|
699
|
+
};
|
|
700
|
+
J("seedSdk:react:db");
|
|
701
|
+
const rr = () => {
|
|
702
|
+
const [e, r] = w(!1), t = x(() => {
|
|
703
|
+
e || r(!0);
|
|
704
|
+
}, []);
|
|
705
|
+
return I(() => {
|
|
706
|
+
let n;
|
|
707
|
+
return (async () => {
|
|
708
|
+
const o = ye().getService(), l = o.getSnapshot().value;
|
|
709
|
+
if (l === F.DB_INIT || l === F.SAVE_CONFIG || l === F.PROCESS_SCHEMA_FILES || l === F.ADD_MODELS_TO_STORE || l === F.ADD_MODELS_TO_DB || l === F.IDLE) {
|
|
710
|
+
t();
|
|
711
|
+
return;
|
|
712
|
+
}
|
|
713
|
+
n = o.subscribe((a) => {
|
|
714
|
+
const s = a.value;
|
|
715
|
+
(s === F.DB_INIT || s === F.SAVE_CONFIG || s === F.PROCESS_SCHEMA_FILES || s === F.ADD_MODELS_TO_STORE || s === F.ADD_MODELS_TO_DB || s === F.IDLE) && (t(), n?.unsubscribe());
|
|
716
|
+
});
|
|
717
|
+
})(), () => {
|
|
718
|
+
n && n.unsubscribe();
|
|
719
|
+
};
|
|
720
|
+
}, []), {
|
|
721
|
+
dbsAreReady: e
|
|
722
|
+
};
|
|
723
|
+
}, qe = J("seedSdk:react:schema"), pt = (e) => {
|
|
724
|
+
const [r, t] = w(null), [n, i] = w(!!e), [c, o] = w(null), l = _(null), a = H(), s = x((d) => {
|
|
725
|
+
i(!0), o(null);
|
|
726
|
+
try {
|
|
727
|
+
const u = me.create(d, {
|
|
728
|
+
waitForReady: !1
|
|
729
|
+
});
|
|
730
|
+
t(u);
|
|
731
|
+
const f = u.getService();
|
|
732
|
+
f.getSnapshot().value === "idle" ? (ce(() => i(!1)), o(null)) : i(!0), l.current = f.subscribe((v) => {
|
|
733
|
+
v.value === "idle" ? (ce(() => i(!1)), o(null)) : i(!0);
|
|
734
|
+
});
|
|
735
|
+
} catch (u) {
|
|
736
|
+
return qe("[useSchema] Error creating schema:", u), o(u), t(null), i(!1), null;
|
|
737
|
+
}
|
|
738
|
+
}, []);
|
|
739
|
+
return I(() => {
|
|
740
|
+
if (l.current && (l.current.unsubscribe(), l.current = null), !a) {
|
|
741
|
+
t(null), o(null), i(!1);
|
|
742
|
+
return;
|
|
743
|
+
}
|
|
744
|
+
if (!e) {
|
|
745
|
+
t(null), o(null), i(!1);
|
|
746
|
+
return;
|
|
747
|
+
}
|
|
748
|
+
return s(e), () => {
|
|
749
|
+
l.current && (l.current.unsubscribe(), l.current = null);
|
|
750
|
+
};
|
|
751
|
+
}, [e, a, s]), {
|
|
752
|
+
schema: r,
|
|
753
|
+
isLoading: n,
|
|
754
|
+
error: c
|
|
755
|
+
};
|
|
756
|
+
}, be = ["seed", "schemas"], nr = () => {
|
|
757
|
+
const e = H(), r = Y(), t = _(void 0), n = _([]), {
|
|
758
|
+
data: i = [],
|
|
759
|
+
isLoading: c,
|
|
760
|
+
error: o
|
|
761
|
+
} = X({
|
|
762
|
+
queryKey: be,
|
|
763
|
+
queryFn: () => me.all({ waitForReady: !0 }),
|
|
764
|
+
enabled: e
|
|
765
|
+
});
|
|
766
|
+
n.current = i;
|
|
767
|
+
const l = e ? W.getAppDb() : null, a = D(() => l ? l.select().from(G).orderBy(G.name, tt(G.version)) : null, [l, e]), s = oe(a);
|
|
768
|
+
return I(() => {
|
|
769
|
+
if (typeof BroadcastChannel > "u") return;
|
|
770
|
+
const d = new BroadcastChannel("seed-schemas-invalidate"), u = () => {
|
|
771
|
+
r.invalidateQueries({ queryKey: be });
|
|
772
|
+
};
|
|
773
|
+
return d.addEventListener("message", u), () => {
|
|
774
|
+
d.removeEventListener("message", u), d.close();
|
|
775
|
+
};
|
|
776
|
+
}, [r]), I(() => {
|
|
777
|
+
if (!e || !s)
|
|
778
|
+
return;
|
|
779
|
+
const d = t.current, u = d ? JSON.stringify(d) : "undefined", f = s ? JSON.stringify(s) : "undefined";
|
|
780
|
+
if (u === f && d !== void 0)
|
|
781
|
+
return;
|
|
782
|
+
t.current = s;
|
|
783
|
+
const h = /* @__PURE__ */ new Set();
|
|
784
|
+
for (const y of n.current) {
|
|
785
|
+
const m = y.id || y.schemaFileId;
|
|
786
|
+
if (m)
|
|
787
|
+
h.add(m);
|
|
788
|
+
else {
|
|
789
|
+
const E = y.metadata?.name, g = y.version;
|
|
790
|
+
E && g !== void 0 && h.add(`${E}:${g}`);
|
|
791
|
+
}
|
|
792
|
+
}
|
|
793
|
+
const b = /* @__PURE__ */ new Set();
|
|
794
|
+
for (const y of s)
|
|
795
|
+
y.name !== "Seed Protocol" && (y.schemaFileId ? b.add(y.schemaFileId) : y.name != null && y.version !== void 0 && b.add(`${y.name}:${y.version}`));
|
|
796
|
+
const v = h.size === b.size && [...h].every((y) => b.has(y)), p = h.size > 0 && b.size > 0 && [...b].some((y) => !h.has(y));
|
|
797
|
+
!v && p && r.invalidateQueries({ queryKey: be });
|
|
798
|
+
}, [e, s, r]), {
|
|
799
|
+
schemas: i,
|
|
800
|
+
isLoading: c,
|
|
801
|
+
error: o
|
|
802
|
+
};
|
|
803
|
+
}, sr = () => {
|
|
804
|
+
const e = _(null), [r, t] = w(!1), [n, i] = w(null), c = x(() => i(null), []), o = x((l) => {
|
|
805
|
+
i(null), t(!0), e.current?.unsubscribe(), e.current = null;
|
|
806
|
+
const a = me.create(l, {
|
|
807
|
+
waitForReady: !1
|
|
808
|
+
}), s = a.getService().subscribe((d) => {
|
|
809
|
+
if (d.value === "error") {
|
|
810
|
+
const u = d.context._loadingError?.error;
|
|
811
|
+
i(u instanceof Error ? u : new Error("Failed to create schema")), t(!1);
|
|
812
|
+
}
|
|
813
|
+
d.value === "idle" && (i(null), t(!1));
|
|
814
|
+
});
|
|
815
|
+
return e.current = s, a;
|
|
816
|
+
}, []);
|
|
817
|
+
return I(() => () => {
|
|
818
|
+
e.current?.unsubscribe(), e.current = null;
|
|
819
|
+
}, []), {
|
|
820
|
+
createSchema: o,
|
|
821
|
+
isLoading: r,
|
|
822
|
+
error: n,
|
|
823
|
+
resetError: c
|
|
824
|
+
};
|
|
825
|
+
}, or = () => {
|
|
826
|
+
const [e, r] = w(null), [t, n] = w({
|
|
827
|
+
isLoading: !1,
|
|
828
|
+
error: null
|
|
829
|
+
});
|
|
830
|
+
I(() => {
|
|
831
|
+
if (!e) {
|
|
832
|
+
n({ isLoading: !1, error: null });
|
|
833
|
+
return;
|
|
834
|
+
}
|
|
835
|
+
const o = e.getService(), l = () => {
|
|
836
|
+
const d = o.getSnapshot().context;
|
|
837
|
+
n({
|
|
838
|
+
isLoading: !!d._destroyInProgress,
|
|
839
|
+
error: d._destroyError ? new Error(d._destroyError.message) : null
|
|
840
|
+
});
|
|
841
|
+
};
|
|
842
|
+
l();
|
|
843
|
+
const a = o.subscribe(l);
|
|
844
|
+
return () => a.unsubscribe();
|
|
845
|
+
}, [e]);
|
|
846
|
+
const i = x(async (o) => {
|
|
847
|
+
o && (r(o), await o.destroy());
|
|
848
|
+
}, []), c = x(() => {
|
|
849
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
850
|
+
}, [e]);
|
|
851
|
+
return {
|
|
852
|
+
destroy: i,
|
|
853
|
+
isLoading: t.isLoading,
|
|
854
|
+
error: t.error,
|
|
855
|
+
resetError: c
|
|
856
|
+
};
|
|
857
|
+
}, ir = () => {
|
|
858
|
+
const [e, r] = w(), t = _(/* @__PURE__ */ new Map()), n = H(), i = x(async () => {
|
|
859
|
+
if (n)
|
|
860
|
+
try {
|
|
861
|
+
const c = await We(), o = /* @__PURE__ */ new Set();
|
|
862
|
+
for (const a of c) {
|
|
863
|
+
const s = a.schema.metadata?.name;
|
|
864
|
+
s && o.add(s);
|
|
865
|
+
}
|
|
866
|
+
const l = /* @__PURE__ */ new Map();
|
|
867
|
+
for (const a of o)
|
|
868
|
+
if (t.current.has(a)) {
|
|
869
|
+
const s = t.current.get(a);
|
|
870
|
+
l.set(a, s);
|
|
871
|
+
} else {
|
|
872
|
+
const s = me.create(a, {
|
|
873
|
+
waitForReady: !1
|
|
874
|
+
});
|
|
875
|
+
l.set(a, s);
|
|
876
|
+
}
|
|
877
|
+
for (const [a, s] of t.current.entries())
|
|
878
|
+
o.has(a) || s.unload();
|
|
879
|
+
t.current = l, r(Array.from(l.values()));
|
|
880
|
+
} catch (c) {
|
|
881
|
+
qe("Error fetching all schema versions from database:", c), r(null);
|
|
882
|
+
}
|
|
883
|
+
}, [n]);
|
|
884
|
+
return I(() => {
|
|
885
|
+
n && i();
|
|
886
|
+
}, [n, i]), I(() => () => {
|
|
887
|
+
t.current.forEach((c) => {
|
|
888
|
+
c.unload();
|
|
889
|
+
}), t.current.clear();
|
|
890
|
+
}, []), e;
|
|
891
|
+
}, ar = () => pt(Je), yt = (e) => ["seed", "models", e], Ce = /* @__PURE__ */ new Map(), mt = (e) => {
|
|
892
|
+
const r = H(), t = Y(), n = _([]), i = D(() => yt(e), [e]), {
|
|
893
|
+
data: c = [],
|
|
894
|
+
isLoading: o,
|
|
895
|
+
error: l
|
|
896
|
+
} = X({
|
|
897
|
+
queryKey: i,
|
|
898
|
+
queryFn: async () => {
|
|
899
|
+
const p = t.getQueryData(i), y = await se.all(e, { waitForReady: !1 });
|
|
900
|
+
if (Array.isArray(p) && p.length > 0 && Array.isArray(y) && y.length === 0)
|
|
901
|
+
return [...p];
|
|
902
|
+
if (Array.isArray(y) && y.length === 0) {
|
|
903
|
+
const m = t.getQueryData(i);
|
|
904
|
+
if (Array.isArray(m) && m.length > 0)
|
|
905
|
+
return [...m];
|
|
906
|
+
}
|
|
907
|
+
return y;
|
|
908
|
+
},
|
|
909
|
+
enabled: r && !!e
|
|
910
|
+
}), a = e && typeof e == "string" ? e : "";
|
|
911
|
+
c.length > 0 && Ce.set(a, c);
|
|
912
|
+
const s = n.current.length > 0 ? n.current : Ce.get(a), d = e ? c.length > 0 ? c : s?.length ? s : c : c;
|
|
913
|
+
n.current = d, I(() => {
|
|
914
|
+
if (!e || typeof BroadcastChannel > "u") return;
|
|
915
|
+
const p = new BroadcastChannel("seed-models-invalidate"), y = (m) => {
|
|
916
|
+
const { schemaName: E, schemaFileId: g } = m.data || {};
|
|
917
|
+
(e === E || e === g) && (t.invalidateQueries({ queryKey: i }), t.refetchQueries({ queryKey: i }));
|
|
918
|
+
};
|
|
919
|
+
return p.addEventListener("message", y), () => {
|
|
920
|
+
p.removeEventListener("message", y), p.close();
|
|
921
|
+
};
|
|
922
|
+
}, [e, t, i]);
|
|
923
|
+
const u = _(null), f = _(null);
|
|
924
|
+
function h() {
|
|
925
|
+
const p = W.getAppDb();
|
|
926
|
+
return !p || !e ? null : p.select({
|
|
927
|
+
modelFileId: ie.schemaFileId,
|
|
928
|
+
modelName: ie.name
|
|
929
|
+
}).from(G).innerJoin(ge, O(G.id, ge.schemaId)).innerJoin(ie, O(ge.modelId, ie.id)).where(
|
|
930
|
+
ee(
|
|
931
|
+
O(G.schemaFileId, e),
|
|
932
|
+
O(G.name, e)
|
|
933
|
+
)
|
|
934
|
+
);
|
|
935
|
+
}
|
|
936
|
+
const b = D(() => {
|
|
937
|
+
if (!e || !r) return null;
|
|
938
|
+
const p = { schemaId: e, ready: r }, y = u.current;
|
|
939
|
+
if (y && y.schemaId === p.schemaId && y.ready === p.ready && f.current !== null)
|
|
940
|
+
return f.current;
|
|
941
|
+
const m = h();
|
|
942
|
+
return m ? (u.current = p, f.current = m, m) : null;
|
|
943
|
+
}, [e, r]), v = oe(b);
|
|
944
|
+
return I(() => {
|
|
945
|
+
if (!r || !v || !e) return;
|
|
946
|
+
const p = /* @__PURE__ */ new Set();
|
|
947
|
+
for (const g of n.current) {
|
|
948
|
+
const z = g.id || g.modelFileId;
|
|
949
|
+
z ? p.add(z) : g.modelName && p.add(g.modelName);
|
|
950
|
+
}
|
|
951
|
+
const y = /* @__PURE__ */ new Set();
|
|
952
|
+
for (const g of v)
|
|
953
|
+
g.modelFileId ? y.add(g.modelFileId) : g.modelName && y.add(g.modelName);
|
|
954
|
+
const m = p.size === y.size && [...p].every((g) => y.has(g)), E = y.size > 0 && [...y].some((g) => !p.has(g));
|
|
955
|
+
!m && E && t.invalidateQueries({ queryKey: i });
|
|
956
|
+
}, [r, v, e, t, i]), {
|
|
957
|
+
models: d,
|
|
958
|
+
isLoading: o,
|
|
959
|
+
error: l
|
|
960
|
+
};
|
|
961
|
+
}, ht = (e, r) => {
|
|
962
|
+
const t = H(), [n, i] = w(void 0), [c, o] = w(!1), [l, a] = w(null), s = _(void 0), [, d] = w(0), u = r == null;
|
|
963
|
+
if (D(() => t ? u ? !!e : !!(e && r) : !1, [t, u, e, r]), I(() => {
|
|
964
|
+
if (!t || !u || !e) {
|
|
965
|
+
i(void 0), o(!1), a(null);
|
|
966
|
+
return;
|
|
967
|
+
}
|
|
968
|
+
(async () => {
|
|
969
|
+
try {
|
|
970
|
+
o(!0), a(null);
|
|
971
|
+
const y = await se.createById(e);
|
|
972
|
+
i(y || void 0), o(!1), a(null);
|
|
973
|
+
} catch (y) {
|
|
974
|
+
console.error("[useModel] Error looking up model by ID:", y), i(void 0), o(!1), a(y);
|
|
975
|
+
}
|
|
976
|
+
})();
|
|
977
|
+
}, [t, u, e]), I(() => {
|
|
978
|
+
if (!u || !n) {
|
|
979
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
980
|
+
return;
|
|
981
|
+
}
|
|
982
|
+
s.current?.unsubscribe();
|
|
983
|
+
const p = n.getService().subscribe((y) => {
|
|
984
|
+
d((m) => m + 1);
|
|
985
|
+
});
|
|
986
|
+
return s.current = p, () => {
|
|
987
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
988
|
+
};
|
|
989
|
+
}, [u, n]), u)
|
|
990
|
+
return {
|
|
991
|
+
model: n,
|
|
992
|
+
isLoading: c,
|
|
993
|
+
error: l
|
|
994
|
+
};
|
|
995
|
+
const { models: f, isLoading: h, error: b } = mt(e), v = D(() => {
|
|
996
|
+
if (r)
|
|
997
|
+
return f.find((p) => (p.modelName ?? p.name) === r);
|
|
998
|
+
}, [f, r]);
|
|
999
|
+
return I(() => {
|
|
1000
|
+
if (u || !v) {
|
|
1001
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
1002
|
+
return;
|
|
1003
|
+
}
|
|
1004
|
+
s.current?.unsubscribe();
|
|
1005
|
+
const p = v.getService().subscribe((y) => {
|
|
1006
|
+
d((m) => m + 1);
|
|
1007
|
+
});
|
|
1008
|
+
return s.current = p, () => {
|
|
1009
|
+
s.current?.unsubscribe(), s.current = void 0;
|
|
1010
|
+
};
|
|
1011
|
+
}, [u, v]), {
|
|
1012
|
+
model: v,
|
|
1013
|
+
isLoading: h,
|
|
1014
|
+
error: b
|
|
1015
|
+
};
|
|
1016
|
+
}, lr = () => {
|
|
1017
|
+
const e = _(void 0), [r, t] = w(!1), [n, i] = w(null), c = x(() => i(null), []), o = x(
|
|
1018
|
+
(l, a, s) => {
|
|
1019
|
+
i(null), t(!0), e.current?.unsubscribe(), e.current = void 0;
|
|
1020
|
+
const d = se.create(a, l, {
|
|
1021
|
+
...s,
|
|
1022
|
+
waitForReady: !1
|
|
1023
|
+
}), u = d.getService().subscribe((f) => {
|
|
1024
|
+
f.value === "error" && (i(
|
|
1025
|
+
f.context._loadingError?.error ?? new Error("Failed to create model")
|
|
1026
|
+
), t(!1)), f.value === "idle" && (i(null), t(!1));
|
|
1027
|
+
});
|
|
1028
|
+
return e.current = u, d;
|
|
1029
|
+
},
|
|
1030
|
+
[]
|
|
1031
|
+
);
|
|
1032
|
+
return I(() => () => {
|
|
1033
|
+
e.current?.unsubscribe(), e.current = void 0;
|
|
1034
|
+
}, []), {
|
|
1035
|
+
create: o,
|
|
1036
|
+
isLoading: r,
|
|
1037
|
+
error: n,
|
|
1038
|
+
resetError: c
|
|
1039
|
+
};
|
|
1040
|
+
}, cr = () => {
|
|
1041
|
+
const [e, r] = w(null), [t, n] = w({
|
|
1042
|
+
isLoading: !1,
|
|
1043
|
+
error: null
|
|
1044
|
+
});
|
|
1045
|
+
I(() => {
|
|
1046
|
+
if (!e) {
|
|
1047
|
+
n({ isLoading: !1, error: null });
|
|
1048
|
+
return;
|
|
1049
|
+
}
|
|
1050
|
+
const o = e.getService(), l = () => {
|
|
1051
|
+
const d = o.getSnapshot().context;
|
|
1052
|
+
n({
|
|
1053
|
+
isLoading: !!d._destroyInProgress,
|
|
1054
|
+
error: d._destroyError ? new Error(d._destroyError.message) : null
|
|
1055
|
+
});
|
|
1056
|
+
};
|
|
1057
|
+
l();
|
|
1058
|
+
const a = o.subscribe(l);
|
|
1059
|
+
return () => a.unsubscribe();
|
|
1060
|
+
}, [e]);
|
|
1061
|
+
const i = x(async (o) => {
|
|
1062
|
+
o && (r(o), await o.destroy());
|
|
1063
|
+
}, []), c = x(() => {
|
|
1064
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
1065
|
+
}, [e]);
|
|
1066
|
+
return {
|
|
1067
|
+
destroy: i,
|
|
1068
|
+
isLoading: t.isLoading,
|
|
1069
|
+
error: t.error,
|
|
1070
|
+
resetError: c
|
|
1071
|
+
};
|
|
1072
|
+
};
|
|
1073
|
+
J("seedSdk:browser:react:modelProperty");
|
|
1074
|
+
const dr = (e, r) => {
|
|
1075
|
+
const { model: t } = ht(e, r);
|
|
1076
|
+
D(() => {
|
|
1077
|
+
if (t)
|
|
1078
|
+
try {
|
|
1079
|
+
return t.modelName ?? t.name;
|
|
1080
|
+
} catch {
|
|
1081
|
+
return;
|
|
1082
|
+
}
|
|
1083
|
+
}, [t]);
|
|
1084
|
+
const n = H(), i = Y(), c = D(() => {
|
|
1085
|
+
if (!t) return null;
|
|
1086
|
+
try {
|
|
1087
|
+
return t._getSnapshotContext()._dbId;
|
|
1088
|
+
} catch {
|
|
1089
|
+
return null;
|
|
1090
|
+
}
|
|
1091
|
+
}, [t]), o = t?.id, l = D(
|
|
1092
|
+
() => ["seed", "modelProperties", o ?? ""],
|
|
1093
|
+
[o]
|
|
1094
|
+
), {
|
|
1095
|
+
data: a = [],
|
|
1096
|
+
isLoading: s,
|
|
1097
|
+
error: d
|
|
1098
|
+
} = X({
|
|
1099
|
+
queryKey: l,
|
|
1100
|
+
queryFn: () => ue.all(o, { waitForReady: !0 }),
|
|
1101
|
+
enabled: n && !!o
|
|
1102
|
+
}), u = n ? W.getAppDb() : null, f = D(() => !u || !c ? null : u.select({
|
|
1103
|
+
id: Z.id,
|
|
1104
|
+
name: Z.name,
|
|
1105
|
+
dataType: Z.dataType,
|
|
1106
|
+
schemaFileId: Z.schemaFileId
|
|
1107
|
+
}).from(Z).where(O(Z.modelId, c)), [u, n, c]), h = oe(f), b = _([]);
|
|
1108
|
+
b.current = a, I(() => {
|
|
1109
|
+
if (!o || a.length > 0 || !i || !l) return;
|
|
1110
|
+
const y = [400, 1200, 2500].map(
|
|
1111
|
+
(m) => setTimeout(() => {
|
|
1112
|
+
i.invalidateQueries({ queryKey: l });
|
|
1113
|
+
}, m)
|
|
1114
|
+
);
|
|
1115
|
+
return () => y.forEach((m) => clearTimeout(m));
|
|
1116
|
+
}, [o, a.length, i, l]), I(() => {
|
|
1117
|
+
if (!n || !t?.id || !h || !l) return;
|
|
1118
|
+
const p = /* @__PURE__ */ new Set();
|
|
1119
|
+
for (const g of b.current) {
|
|
1120
|
+
const N = g._getSnapshotContext()?.id;
|
|
1121
|
+
N ? p.add(N) : g.name && p.add(g.name);
|
|
1122
|
+
}
|
|
1123
|
+
const y = /* @__PURE__ */ new Set();
|
|
1124
|
+
for (const g of h)
|
|
1125
|
+
g.schemaFileId ? y.add(g.schemaFileId) : g.name && y.add(g.name);
|
|
1126
|
+
!(p.size === y.size && (p.size === 0 || [...p].every((g) => y.has(g)))) && (p.size > 0 || y.size > 0) && i.invalidateQueries({ queryKey: l });
|
|
1127
|
+
}, [n, h, t?.id, i, l]);
|
|
1128
|
+
const v = s && a.length === 0;
|
|
1129
|
+
return {
|
|
1130
|
+
modelProperties: a,
|
|
1131
|
+
isLoading: v,
|
|
1132
|
+
error: d
|
|
1133
|
+
};
|
|
1134
|
+
}, gt = async (e, r) => {
|
|
1135
|
+
const t = await se.createById(e);
|
|
1136
|
+
if (!t)
|
|
1137
|
+
return;
|
|
1138
|
+
const n = t.modelName ?? t.name;
|
|
1139
|
+
if (n)
|
|
1140
|
+
return ke(n, r);
|
|
1141
|
+
};
|
|
1142
|
+
function ur(e, r, t) {
|
|
1143
|
+
const n = D(() => t != null ? !!(e && r && t) : r != null ? !!(e && r) : !!e, [e, r, t]), [i, c] = w(void 0), [o, l] = w(n), [a, s] = w(null), d = _(void 0), u = H(), f = D(() => t != null ? { type: "schemaId", schemaId: e, modelName: r, propertyName: t } : r != null ? { type: "modelFileId", modelFileId: e, propertyName: r } : { type: "propertyFileId", propertyFileId: e }, [e, r, t]), h = D(() => u ? f.type === "propertyFileId" ? !!f.propertyFileId : f.type === "modelFileId" ? !!(f.modelFileId && f.propertyName) : !!(f.schemaId && f.modelName && f.propertyName) : !1, [u, f]), b = x(async () => {
|
|
1144
|
+
if (!u) {
|
|
1145
|
+
c(void 0), l(!1), s(null);
|
|
1146
|
+
return;
|
|
1147
|
+
}
|
|
1148
|
+
let p, y;
|
|
1149
|
+
try {
|
|
1150
|
+
if (l(!0), s(null), f.type === "propertyFileId") {
|
|
1151
|
+
if (!f.propertyFileId) {
|
|
1152
|
+
c(void 0), l(!1), s(null);
|
|
1153
|
+
return;
|
|
1154
|
+
}
|
|
1155
|
+
const m = await ue.createById(f.propertyFileId);
|
|
1156
|
+
m ? (c(m), l(!1), s(null)) : (c(void 0), l(!1), s(null));
|
|
1157
|
+
return;
|
|
1158
|
+
} else if (f.type === "modelFileId") {
|
|
1159
|
+
if (!f.modelFileId || !f.propertyName) {
|
|
1160
|
+
c(void 0), l(!1), s(null);
|
|
1161
|
+
return;
|
|
1162
|
+
}
|
|
1163
|
+
p = await gt(f.modelFileId, f.propertyName);
|
|
1164
|
+
const m = await se.createById(f.modelFileId);
|
|
1165
|
+
y = m?.modelName ?? m?.name;
|
|
1166
|
+
} else {
|
|
1167
|
+
if (!f.schemaId || !f.modelName || !f.propertyName) {
|
|
1168
|
+
c(void 0), l(!1), s(null);
|
|
1169
|
+
return;
|
|
1170
|
+
}
|
|
1171
|
+
p = await ke(f.modelName, f.propertyName), y = f.modelName;
|
|
1172
|
+
}
|
|
1173
|
+
if (p && y) {
|
|
1174
|
+
const m = ue.create(
|
|
1175
|
+
{ ...p, modelName: y },
|
|
1176
|
+
{ waitForReady: !1 }
|
|
1177
|
+
), E = m instanceof Promise ? await m : m;
|
|
1178
|
+
ce(() => {
|
|
1179
|
+
c(E), l(!1), s(null);
|
|
1180
|
+
});
|
|
1181
|
+
} else
|
|
1182
|
+
c(void 0), l(!1), s(null);
|
|
1183
|
+
} catch (m) {
|
|
1184
|
+
console.error("[useModelProperty] Error updating model property:", m), c(void 0), l(!1), s(m);
|
|
1185
|
+
}
|
|
1186
|
+
}, [u, f.type, f.propertyFileId, f.modelFileId, f.propertyName, f.schemaId, f.modelName]);
|
|
1187
|
+
I(() => {
|
|
1188
|
+
if (!h) {
|
|
1189
|
+
c(void 0), l(!1), s(null);
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
b();
|
|
1193
|
+
}, [h, b]);
|
|
1194
|
+
const v = f.type === "propertyFileId";
|
|
1195
|
+
return I(() => {
|
|
1196
|
+
if (!i || !v)
|
|
1197
|
+
return;
|
|
1198
|
+
d.current?.unsubscribe();
|
|
1199
|
+
const p = $e(b, 100), y = i.getService().subscribe(() => {
|
|
1200
|
+
p();
|
|
1201
|
+
});
|
|
1202
|
+
return d.current = y, () => {
|
|
1203
|
+
p.cancel(), d.current?.unsubscribe(), d.current = void 0;
|
|
1204
|
+
};
|
|
1205
|
+
}, [i, b, v]), {
|
|
1206
|
+
modelProperty: i,
|
|
1207
|
+
isLoading: o,
|
|
1208
|
+
error: a
|
|
1209
|
+
};
|
|
1210
|
+
}
|
|
1211
|
+
const fr = () => {
|
|
1212
|
+
const e = _(void 0), [r, t] = w(!1), [n, i] = w(null), c = x(() => i(null), []), o = x(
|
|
1213
|
+
(l, a, s) => {
|
|
1214
|
+
if (i(null), t(!0), e.current?.unsubscribe(), e.current = void 0, !a || !s.name || !s.dataType) {
|
|
1215
|
+
const h = new Error("modelName, property name and dataType are required");
|
|
1216
|
+
throw i(h), t(!1), h;
|
|
1217
|
+
}
|
|
1218
|
+
const d = Ge(l) ?? l, u = ue.create(
|
|
1219
|
+
{ ...s, modelName: a },
|
|
1220
|
+
{ waitForReady: !1, schemaName: d }
|
|
1221
|
+
), f = u.getService().subscribe((h) => {
|
|
1222
|
+
if (h.value === "error") {
|
|
1223
|
+
const b = h.context._loadingError?.error ?? new Error("Failed to create model property");
|
|
1224
|
+
i(b instanceof Error ? b : new Error(String(b))), t(!1);
|
|
1225
|
+
}
|
|
1226
|
+
h.value === "idle" && (i(null), t(!1));
|
|
1227
|
+
});
|
|
1228
|
+
return e.current = f, u;
|
|
1229
|
+
},
|
|
1230
|
+
[]
|
|
1231
|
+
);
|
|
1232
|
+
return I(() => () => {
|
|
1233
|
+
e.current?.unsubscribe(), e.current = void 0;
|
|
1234
|
+
}, []), {
|
|
1235
|
+
create: o,
|
|
1236
|
+
isLoading: r,
|
|
1237
|
+
error: n,
|
|
1238
|
+
resetError: c
|
|
1239
|
+
};
|
|
1240
|
+
}, pr = () => {
|
|
1241
|
+
const [e, r] = w(null), [t, n] = w({
|
|
1242
|
+
isLoading: !1,
|
|
1243
|
+
error: null
|
|
1244
|
+
});
|
|
1245
|
+
I(() => {
|
|
1246
|
+
if (!e) {
|
|
1247
|
+
n({ isLoading: !1, error: null });
|
|
1248
|
+
return;
|
|
1249
|
+
}
|
|
1250
|
+
const o = e.getService(), l = () => {
|
|
1251
|
+
const d = o.getSnapshot().context;
|
|
1252
|
+
n({
|
|
1253
|
+
isLoading: !!d._destroyInProgress,
|
|
1254
|
+
error: d._destroyError ? new Error(d._destroyError.message) : null
|
|
1255
|
+
});
|
|
1256
|
+
};
|
|
1257
|
+
l();
|
|
1258
|
+
const a = o.subscribe(l);
|
|
1259
|
+
return () => a.unsubscribe();
|
|
1260
|
+
}, [e]);
|
|
1261
|
+
const i = x(async (o) => {
|
|
1262
|
+
o && (r(o), await o.destroy());
|
|
1263
|
+
}, []), c = x(() => {
|
|
1264
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
1265
|
+
}, [e]);
|
|
1266
|
+
return {
|
|
1267
|
+
destroy: i,
|
|
1268
|
+
isLoading: t.isLoading,
|
|
1269
|
+
error: t.error,
|
|
1270
|
+
resetError: c
|
|
1271
|
+
};
|
|
1272
|
+
}, yr = () => {
|
|
1273
|
+
const [e, r] = w(null), [t, n] = w({
|
|
1274
|
+
isLoading: !1,
|
|
1275
|
+
error: null
|
|
1276
|
+
});
|
|
1277
|
+
I(() => {
|
|
1278
|
+
if (!e) {
|
|
1279
|
+
n({ isLoading: !1, error: null });
|
|
1280
|
+
return;
|
|
1281
|
+
}
|
|
1282
|
+
const o = e.getService(), l = () => {
|
|
1283
|
+
const d = o.getSnapshot().context;
|
|
1284
|
+
n({
|
|
1285
|
+
isLoading: !!d._destroyInProgress,
|
|
1286
|
+
error: d._destroyError ? new Error(d._destroyError.message) : null
|
|
1287
|
+
});
|
|
1288
|
+
};
|
|
1289
|
+
l();
|
|
1290
|
+
const a = o.subscribe(l);
|
|
1291
|
+
return () => a.unsubscribe();
|
|
1292
|
+
}, [e]);
|
|
1293
|
+
const i = x(async (o) => {
|
|
1294
|
+
o && (r(o), await o.destroy());
|
|
1295
|
+
}, []), c = x(() => {
|
|
1296
|
+
e && e.getService().send({ type: "clearDestroyError" });
|
|
1297
|
+
}, [e]);
|
|
1298
|
+
return {
|
|
1299
|
+
deleteItem: i,
|
|
1300
|
+
isLoading: t.isLoading,
|
|
1301
|
+
error: t.error,
|
|
1302
|
+
resetError: c
|
|
1303
|
+
};
|
|
1304
|
+
}, ve = ["seed", "imageFiles"];
|
|
1305
|
+
function mr() {
|
|
1306
|
+
const e = H(), r = Y(), {
|
|
1307
|
+
data: t = [],
|
|
1308
|
+
isLoading: n,
|
|
1309
|
+
error: i,
|
|
1310
|
+
refetch: c
|
|
1311
|
+
} = X({
|
|
1312
|
+
queryKey: ve,
|
|
1313
|
+
queryFn: () => j.listImageFiles(),
|
|
1314
|
+
enabled: e
|
|
1315
|
+
});
|
|
1316
|
+
return I(() => {
|
|
1317
|
+
const o = (a) => {
|
|
1318
|
+
a.includes("/images/") && r.invalidateQueries({ queryKey: ve });
|
|
1319
|
+
}, l = () => {
|
|
1320
|
+
r.invalidateQueries({ queryKey: ve });
|
|
1321
|
+
};
|
|
1322
|
+
return V.on("file-saved", o), V.on("fs.downloadAll.success", l), () => {
|
|
1323
|
+
V.off("file-saved", o), V.off("fs.downloadAll.success", l);
|
|
1324
|
+
};
|
|
1325
|
+
}, [r]), {
|
|
1326
|
+
imageFiles: t,
|
|
1327
|
+
isLoading: n,
|
|
1328
|
+
error: i instanceof Error ? i : null,
|
|
1329
|
+
refetch: c
|
|
1330
|
+
};
|
|
1331
|
+
}
|
|
1332
|
+
const bt = ["seed", "files"];
|
|
1333
|
+
function hr(e = "files") {
|
|
1334
|
+
const r = H(), t = Y(), n = D(() => [...bt, e], [e]), {
|
|
1335
|
+
data: i = [],
|
|
1336
|
+
isLoading: c,
|
|
1337
|
+
error: o,
|
|
1338
|
+
refetch: l
|
|
1339
|
+
} = X({
|
|
1340
|
+
queryKey: n,
|
|
1341
|
+
queryFn: () => j.listFiles(e),
|
|
1342
|
+
enabled: r
|
|
1343
|
+
});
|
|
1344
|
+
return I(() => {
|
|
1345
|
+
const a = (d) => {
|
|
1346
|
+
d.includes(`/${e}/`) && t.invalidateQueries({ queryKey: n });
|
|
1347
|
+
}, s = () => {
|
|
1348
|
+
t.invalidateQueries({ queryKey: n });
|
|
1349
|
+
};
|
|
1350
|
+
return V.on("file-saved", a), V.on("fs.downloadAll.success", s), () => {
|
|
1351
|
+
V.off("file-saved", a), V.off("fs.downloadAll.success", s);
|
|
1352
|
+
};
|
|
1353
|
+
}, [t, e, n]), {
|
|
1354
|
+
files: i,
|
|
1355
|
+
isLoading: c,
|
|
1356
|
+
error: o instanceof Error ? o : null,
|
|
1357
|
+
refetch: l
|
|
1358
|
+
};
|
|
1359
|
+
}
|
|
1360
|
+
const vt = {
|
|
1361
|
+
queries: {
|
|
1362
|
+
networkMode: "offlineFirst",
|
|
1363
|
+
gcTime: 1e3 * 60 * 60 * 24,
|
|
1364
|
+
// 24 hours
|
|
1365
|
+
staleTime: 1e3 * 60
|
|
1366
|
+
// 1 minute - list data can be slightly stale
|
|
1367
|
+
}
|
|
1368
|
+
};
|
|
1369
|
+
function ze() {
|
|
1370
|
+
return { ...vt };
|
|
1371
|
+
}
|
|
1372
|
+
function St(e) {
|
|
1373
|
+
const r = ze();
|
|
1374
|
+
return e ? {
|
|
1375
|
+
queries: {
|
|
1376
|
+
...r.queries,
|
|
1377
|
+
...e.queries ?? {}
|
|
1378
|
+
},
|
|
1379
|
+
mutations: {
|
|
1380
|
+
...r.mutations ?? {},
|
|
1381
|
+
...e.mutations ?? {}
|
|
1382
|
+
}
|
|
1383
|
+
} : r;
|
|
1384
|
+
}
|
|
1385
|
+
function wt(e) {
|
|
1386
|
+
const r = ze(), { defaultOptions: t, ...n } = e ?? {};
|
|
1387
|
+
return new nt({
|
|
1388
|
+
...n,
|
|
1389
|
+
defaultOptions: t ? St(t) : r
|
|
1390
|
+
});
|
|
1391
|
+
}
|
|
1392
|
+
let xe = null;
|
|
1393
|
+
function gr(e) {
|
|
1394
|
+
const r = xe?.(e);
|
|
1395
|
+
return typeof window < "u" && window.__SEED_INVALIDATE_ITEM_PROPERTIES__ && window.__SEED_INVALIDATE_ITEM_PROPERTIES__(e), Promise.resolve(r).then(() => {
|
|
1396
|
+
});
|
|
1397
|
+
}
|
|
1398
|
+
function It({ queryClient: e }) {
|
|
1399
|
+
return I(() => {
|
|
1400
|
+
const r = (n) => {
|
|
1401
|
+
const i = ["seed", "itemProperties", n];
|
|
1402
|
+
return e.invalidateQueries({ queryKey: i }), e.refetchQueries({ queryKey: i });
|
|
1403
|
+
};
|
|
1404
|
+
xe = r, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = r);
|
|
1405
|
+
const t = (n) => {
|
|
1406
|
+
const i = n?.seedLocalId ?? n?.seedUid;
|
|
1407
|
+
i && r(i);
|
|
1408
|
+
};
|
|
1409
|
+
return V.on("itemProperty.saved", t), () => {
|
|
1410
|
+
V.off("itemProperty.saved", t), xe = null, typeof window < "u" && (window.__SEED_INVALIDATE_ITEM_PROPERTIES__ = null);
|
|
1411
|
+
};
|
|
1412
|
+
}, [e]), null;
|
|
1413
|
+
}
|
|
1414
|
+
function br({ children: e, queryClient: r, queryClientRef: t }) {
|
|
1415
|
+
const n = D(
|
|
1416
|
+
() => r ?? wt(),
|
|
1417
|
+
[r]
|
|
1418
|
+
);
|
|
1419
|
+
if (t && (t.current = n, typeof window < "u")) {
|
|
1420
|
+
const i = window;
|
|
1421
|
+
i.__TEST_SEED_QUERY_CLIENT__ = n;
|
|
1422
|
+
try {
|
|
1423
|
+
window.parent && window.parent !== window && (window.parent.__TEST_SEED_QUERY_CLIENT__ = n);
|
|
1424
|
+
} catch {
|
|
1425
|
+
}
|
|
1426
|
+
}
|
|
1427
|
+
return /* @__PURE__ */ $(st, { client: n, children: [
|
|
1428
|
+
/* @__PURE__ */ S(It, { queryClient: n }),
|
|
1429
|
+
e
|
|
1430
|
+
] });
|
|
1431
|
+
}
|
|
1432
|
+
function Et() {
|
|
1433
|
+
return /* @__PURE__ */ S(
|
|
1434
|
+
"div",
|
|
1435
|
+
{
|
|
1436
|
+
style: {
|
|
1437
|
+
display: "flex",
|
|
1438
|
+
alignItems: "center",
|
|
1439
|
+
justifyContent: "center",
|
|
1440
|
+
height: "100%",
|
|
1441
|
+
width: "100%"
|
|
1442
|
+
},
|
|
1443
|
+
children: "Loading..."
|
|
1444
|
+
}
|
|
1445
|
+
);
|
|
1446
|
+
}
|
|
1447
|
+
function vr({
|
|
1448
|
+
initConfig: e,
|
|
1449
|
+
schema: r,
|
|
1450
|
+
loadingComponent: t,
|
|
1451
|
+
wrapperClassName: n,
|
|
1452
|
+
loadingClassName: i,
|
|
1453
|
+
children: c
|
|
1454
|
+
}) {
|
|
1455
|
+
const o = H();
|
|
1456
|
+
I(() => {
|
|
1457
|
+
const u = r ? {
|
|
1458
|
+
...e,
|
|
1459
|
+
config: {
|
|
1460
|
+
...e.config,
|
|
1461
|
+
schema: r
|
|
1462
|
+
}
|
|
1463
|
+
} : e;
|
|
1464
|
+
Ye.init(u);
|
|
1465
|
+
}, [e, r]);
|
|
1466
|
+
const l = t ?? /* @__PURE__ */ S(Et, {}), a = n ? void 0 : { position: "relative", display: "flex", height: "100vh", width: "100vw" }, s = {
|
|
1467
|
+
display: o ? "none" : "flex",
|
|
1468
|
+
...!i && {
|
|
1469
|
+
position: "absolute",
|
|
1470
|
+
inset: 0,
|
|
1471
|
+
zIndex: 50,
|
|
1472
|
+
alignItems: "center",
|
|
1473
|
+
justifyContent: "center"
|
|
1474
|
+
}
|
|
1475
|
+
};
|
|
1476
|
+
return /* @__PURE__ */ $("div", { className: n, style: a, children: [
|
|
1477
|
+
/* @__PURE__ */ S(
|
|
1478
|
+
"div",
|
|
1479
|
+
{
|
|
1480
|
+
className: i,
|
|
1481
|
+
style: s,
|
|
1482
|
+
"aria-hidden": o,
|
|
1483
|
+
children: l
|
|
1484
|
+
}
|
|
1485
|
+
),
|
|
1486
|
+
/* @__PURE__ */ S("div", { style: {
|
|
1487
|
+
flex: 1,
|
|
1488
|
+
display: o ? "flex" : "none",
|
|
1489
|
+
flexDirection: "column"
|
|
1490
|
+
}, children: c })
|
|
1491
|
+
] });
|
|
1492
|
+
}
|
|
1493
|
+
async function He(e, r = "") {
|
|
1494
|
+
const t = [];
|
|
1495
|
+
try {
|
|
1496
|
+
for await (const [n, i] of e.entries()) {
|
|
1497
|
+
const c = r ? `${r}/${n}` : n;
|
|
1498
|
+
if (i.kind === "file")
|
|
1499
|
+
try {
|
|
1500
|
+
const o = await i.getFile();
|
|
1501
|
+
t.push({
|
|
1502
|
+
name: n,
|
|
1503
|
+
path: c,
|
|
1504
|
+
size: o.size,
|
|
1505
|
+
type: o.type || "application/octet-stream",
|
|
1506
|
+
lastModified: o.lastModified
|
|
1507
|
+
});
|
|
1508
|
+
} catch (o) {
|
|
1509
|
+
console.warn(`Failed to read file ${c}:`, o);
|
|
1510
|
+
}
|
|
1511
|
+
else if (i.kind === "directory") {
|
|
1512
|
+
const o = await He(i, c);
|
|
1513
|
+
t.push(...o);
|
|
1514
|
+
}
|
|
1515
|
+
}
|
|
1516
|
+
} catch (n) {
|
|
1517
|
+
console.warn(`Failed to scan directory ${r}:`, n);
|
|
1518
|
+
}
|
|
1519
|
+
return t;
|
|
1520
|
+
}
|
|
1521
|
+
function Lt(e = {}) {
|
|
1522
|
+
const { rootPath: r } = e, [t, n] = w([]), [i, c] = w(!0), [o, l] = w(null), a = x(async () => {
|
|
1523
|
+
c(!0), l(null);
|
|
1524
|
+
try {
|
|
1525
|
+
let d = await navigator.storage.getDirectory();
|
|
1526
|
+
if (r) {
|
|
1527
|
+
const f = r.split("/").filter(Boolean);
|
|
1528
|
+
for (const h of f)
|
|
1529
|
+
d = await d.getDirectoryHandle(h);
|
|
1530
|
+
}
|
|
1531
|
+
const u = await He(d, r || "");
|
|
1532
|
+
n(u.sort((f, h) => f.path.localeCompare(h.path)));
|
|
1533
|
+
} catch (s) {
|
|
1534
|
+
l(
|
|
1535
|
+
"Failed to access OPFS: " + (s instanceof Error ? s.message : String(s))
|
|
1536
|
+
), console.error("OPFS access error:", s);
|
|
1537
|
+
} finally {
|
|
1538
|
+
c(!1);
|
|
1539
|
+
}
|
|
1540
|
+
}, [r]);
|
|
1541
|
+
return I(() => {
|
|
1542
|
+
a();
|
|
1543
|
+
}, [a]), { files: t, isLoading: i, error: o, refetch: a };
|
|
1544
|
+
}
|
|
1545
|
+
const Pe = () => /* @__PURE__ */ S("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", style: { width: 20, height: 20 }, children: /* @__PURE__ */ S("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M3 16.5v2.25A2.25 2.25 0 005.25 21h13.5A2.25 2.25 0 0021 18.75V16.5M16.5 12L12 16.5m0 0L7.5 12m4.5 4.5V3" }) }), xt = () => /* @__PURE__ */ S("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", style: { width: 48, height: 48 }, children: /* @__PURE__ */ S("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M2.25 12.75V12a2.25 2.25 0 012.25-2.25h15A2.25 2.25 0 0121.75 12v.75m-8.69-6.44l-2.12-2.12a1.5 1.5 0 00-1.061-.44H4.5A2.25 2.25 0 002.25 6v12a2.25 2.25 0 002.25 2.25h15A2.25 2.25 0 0021.75 18V9a2.25 2.25 0 00-2.25-2.25h-5.379a1.5 1.5 0 01-1.06-.44z" }) }), Nt = () => /* @__PURE__ */ S("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", style: { width: 20, height: 20 }, children: /* @__PURE__ */ S("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M19.5 14.25v-2.625a3.375 3.375 0 00-3.375-3.375h-1.5A1.125 1.125 0 0113.5 7.125v-1.5a3.375 3.375 0 00-3.375-3.375H8.25m0 12.75h7.5m-7.5 3H12M10.5 2.25H5.625c-.621 0-1.125.504-1.125 1.125v17.25c0 .621.504 1.125 1.125 1.125h12.75c.621 0 1.125-.504 1.125-1.125V11.25a9 9 0 00-9-9z" }) }), Re = () => /* @__PURE__ */ S("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", strokeWidth: 1.5, stroke: "currentColor", style: { width: 20, height: 20 }, children: /* @__PURE__ */ S("path", { strokeLinecap: "round", strokeLinejoin: "round", d: "M14.74 9l-.346 9m-4.788 0L9.26 9m9.968-3.21c.342.052.682.107 1.022.166m-1.022-.165L18.16 19.673a2.25 2.25 0 01-2.244 2.077H8.084a2.25 2.25 0 01-2.244-2.077L4.772 5.79m14.456 0a48.108 48.108 0 00-3.478-.397m-12 .562c.34-.059.68-.114 1.022-.165m0 0a48.11 48.11 0 013.478-.397m7.5 0v-.916c0-1.18-.91-2.164-2.09-2.201a51.964 51.964 0 00-3.32 0c-1.18.037-2.09 1.022-2.09 2.201v.916m7.5 0a48.667 48.667 0 00-7.5 0" }) }), At = () => /* @__PURE__ */ $(
|
|
1546
|
+
"svg",
|
|
1547
|
+
{
|
|
1548
|
+
xmlns: "http://www.w3.org/2000/svg",
|
|
1549
|
+
fill: "none",
|
|
1550
|
+
viewBox: "0 0 24 24",
|
|
1551
|
+
style: { width: 32, height: 32 },
|
|
1552
|
+
"aria-hidden": !0,
|
|
1553
|
+
children: [
|
|
1554
|
+
/* @__PURE__ */ S(
|
|
1555
|
+
"circle",
|
|
1556
|
+
{
|
|
1557
|
+
style: { opacity: 0.25 },
|
|
1558
|
+
cx: "12",
|
|
1559
|
+
cy: "12",
|
|
1560
|
+
r: "10",
|
|
1561
|
+
stroke: "currentColor",
|
|
1562
|
+
strokeWidth: "4"
|
|
1563
|
+
}
|
|
1564
|
+
),
|
|
1565
|
+
/* @__PURE__ */ S(
|
|
1566
|
+
"path",
|
|
1567
|
+
{
|
|
1568
|
+
style: { opacity: 0.75 },
|
|
1569
|
+
fill: "currentColor",
|
|
1570
|
+
d: "M4 12a8 8 0 018-8V0C5.373 0 0 5.373 0 12h4zm2 5.291A7.962 7.962 0 014 12H0c0 3.042 1.135 5.824 3 7.938l3-2.647z"
|
|
1571
|
+
}
|
|
1572
|
+
)
|
|
1573
|
+
]
|
|
1574
|
+
}
|
|
1575
|
+
);
|
|
1576
|
+
function Dt(e) {
|
|
1577
|
+
if (e === 0) return "0 Bytes";
|
|
1578
|
+
const r = 1024, t = ["Bytes", "KB", "MB", "GB"], n = Math.floor(Math.log(e) / Math.log(r));
|
|
1579
|
+
return Math.round(e / Math.pow(r, n) * 100) / 100 + " " + t[n];
|
|
1580
|
+
}
|
|
1581
|
+
function _t(e) {
|
|
1582
|
+
return new Date(e).toLocaleString();
|
|
1583
|
+
}
|
|
1584
|
+
async function Ft(e, r) {
|
|
1585
|
+
const t = e.path.split("/").filter(Boolean);
|
|
1586
|
+
if (t.length === 0) throw new Error("Invalid file path");
|
|
1587
|
+
let n = r;
|
|
1588
|
+
for (let l = 0; l < t.length - 1; l++)
|
|
1589
|
+
n = await n.getDirectoryHandle(t[l]);
|
|
1590
|
+
const i = t[t.length - 1];
|
|
1591
|
+
return await (await n.getFileHandle(i)).getFile();
|
|
1592
|
+
}
|
|
1593
|
+
async function Me(e, r) {
|
|
1594
|
+
const t = e.split("/").filter(Boolean);
|
|
1595
|
+
if (t.length === 0) throw new Error("Invalid file path");
|
|
1596
|
+
let n = r;
|
|
1597
|
+
for (let c = 0; c < t.length - 1; c++)
|
|
1598
|
+
n = await n.getDirectoryHandle(t[c]);
|
|
1599
|
+
const i = t[t.length - 1];
|
|
1600
|
+
await n.removeEntry(i);
|
|
1601
|
+
}
|
|
1602
|
+
const Ct = {
|
|
1603
|
+
light: {
|
|
1604
|
+
title: "text-gray-900",
|
|
1605
|
+
description: "text-gray-500",
|
|
1606
|
+
batchBar: "bg-gray-100 border-gray-200",
|
|
1607
|
+
batchText: "text-gray-900",
|
|
1608
|
+
clearButton: "text-gray-500 hover:text-gray-900",
|
|
1609
|
+
loadingText: "text-gray-500",
|
|
1610
|
+
errorBox: "bg-red-50 border-red-200",
|
|
1611
|
+
errorTitle: "text-red-800",
|
|
1612
|
+
errorText: "text-red-700",
|
|
1613
|
+
emptyIcon: "text-gray-400",
|
|
1614
|
+
emptyTitle: "text-gray-900",
|
|
1615
|
+
emptyText: "text-gray-500",
|
|
1616
|
+
tableHeader: "bg-gray-100 text-gray-900",
|
|
1617
|
+
tableRow: "bg-white",
|
|
1618
|
+
tableBorder: "border-gray-200 divide-gray-200",
|
|
1619
|
+
tableCell: "text-gray-900",
|
|
1620
|
+
tableCellMuted: "text-gray-500",
|
|
1621
|
+
codeBlock: "bg-gray-100 border-gray-200 text-gray-800",
|
|
1622
|
+
actionButton: "text-gray-500 hover:text-gray-700",
|
|
1623
|
+
deleteButton: "text-gray-500 hover:text-red-600"
|
|
1624
|
+
},
|
|
1625
|
+
dark: {
|
|
1626
|
+
title: "text-white",
|
|
1627
|
+
description: "text-gray-400",
|
|
1628
|
+
batchBar: "bg-gray-800 border-gray-700",
|
|
1629
|
+
batchText: "text-white",
|
|
1630
|
+
clearButton: "text-gray-400 hover:text-white",
|
|
1631
|
+
loadingText: "text-gray-400",
|
|
1632
|
+
errorBox: "bg-red-900/50 border-red-800",
|
|
1633
|
+
errorTitle: "text-red-200",
|
|
1634
|
+
errorText: "text-red-300",
|
|
1635
|
+
emptyIcon: "text-gray-500",
|
|
1636
|
+
emptyTitle: "text-white",
|
|
1637
|
+
emptyText: "text-gray-400",
|
|
1638
|
+
tableHeader: "bg-gray-900 text-white",
|
|
1639
|
+
tableRow: "bg-gray-900",
|
|
1640
|
+
tableBorder: "border-gray-800 divide-gray-800",
|
|
1641
|
+
tableCell: "text-white",
|
|
1642
|
+
tableCellMuted: "text-gray-400",
|
|
1643
|
+
codeBlock: "bg-gray-800 border-gray-700 text-gray-300",
|
|
1644
|
+
actionButton: "text-gray-400 hover:text-indigo-400",
|
|
1645
|
+
deleteButton: "text-gray-400 hover:text-red-500"
|
|
1646
|
+
}
|
|
1647
|
+
}, R = {
|
|
1648
|
+
container: { padding: "2rem 0" },
|
|
1649
|
+
header: {
|
|
1650
|
+
display: "flex",
|
|
1651
|
+
flexWrap: "wrap",
|
|
1652
|
+
alignItems: "center",
|
|
1653
|
+
gap: "1rem",
|
|
1654
|
+
marginBottom: "1rem"
|
|
1655
|
+
},
|
|
1656
|
+
title: { fontSize: "1.5rem", fontWeight: 600, margin: 0 },
|
|
1657
|
+
description: { fontSize: "0.875rem", margin: "0.5rem 0 0 0" },
|
|
1658
|
+
button: "rounded-md px-3 py-2 text-sm font-semibold border-0 cursor-pointer bg-indigo-600 text-white hover:bg-indigo-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-indigo-600",
|
|
1659
|
+
buttonDanger: "rounded-md px-3 py-2 text-sm font-semibold border-0 cursor-pointer bg-red-600 text-white hover:bg-red-500 focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-red-600",
|
|
1660
|
+
table: "min-w-full divide-y",
|
|
1661
|
+
tableHeader: "py-3.5 pl-4 pr-3 text-left text-sm font-semibold sm:pl-6",
|
|
1662
|
+
tableCell: "whitespace-nowrap py-4 pl-4 pr-3 text-sm sm:pl-6",
|
|
1663
|
+
errorBox: "rounded-md border p-4 mt-4",
|
|
1664
|
+
emptyState: "text-center py-12"
|
|
1665
|
+
};
|
|
1666
|
+
function Sr({
|
|
1667
|
+
rootPath: e,
|
|
1668
|
+
filter: r,
|
|
1669
|
+
onBeforeDelete: t,
|
|
1670
|
+
onAfterDelete: n,
|
|
1671
|
+
onDownload: i,
|
|
1672
|
+
title: c = "Files",
|
|
1673
|
+
description: o = "Browse and download all files stored in the Origin Private File System (OPFS).",
|
|
1674
|
+
theme: l = "dark",
|
|
1675
|
+
className: a
|
|
1676
|
+
}) {
|
|
1677
|
+
const s = Ct[l], { files: d, isLoading: u, error: f, refetch: h } = Lt({ rootPath: e }), b = r ? d.filter(r) : d, [v, p] = w(/* @__PURE__ */ new Set()), y = _(null), m = b.length > 0 && v.size === b.length, E = v.size > 0 && v.size < b.length, g = (L) => {
|
|
1678
|
+
p((C) => {
|
|
1679
|
+
const P = new Set(C);
|
|
1680
|
+
return P.has(L) ? P.delete(L) : P.add(L), P;
|
|
1681
|
+
});
|
|
1682
|
+
}, z = () => {
|
|
1683
|
+
p(
|
|
1684
|
+
v.size === b.length ? /* @__PURE__ */ new Set() : new Set(b.map((L) => L.path))
|
|
1685
|
+
);
|
|
1686
|
+
};
|
|
1687
|
+
I(() => {
|
|
1688
|
+
p(/* @__PURE__ */ new Set());
|
|
1689
|
+
}, [b.length]), I(() => {
|
|
1690
|
+
y.current && (y.current.indeterminate = E);
|
|
1691
|
+
}, [E]);
|
|
1692
|
+
const N = async (L, C = !1) => {
|
|
1693
|
+
try {
|
|
1694
|
+
const P = await navigator.storage.getDirectory(), B = await Ft(L, P);
|
|
1695
|
+
if (i)
|
|
1696
|
+
await i(L, B);
|
|
1697
|
+
else {
|
|
1698
|
+
const Q = URL.createObjectURL(B), U = document.createElement("a");
|
|
1699
|
+
U.href = Q, U.download = L.name, document.body.appendChild(U), U.click(), document.body.removeChild(U), URL.revokeObjectURL(Q);
|
|
1700
|
+
}
|
|
1701
|
+
} catch (P) {
|
|
1702
|
+
const B = "Failed to download file: " + (P instanceof Error ? P.message : String(P));
|
|
1703
|
+
throw C || alert(B), P;
|
|
1704
|
+
}
|
|
1705
|
+
}, M = async (L) => {
|
|
1706
|
+
if (!(t && !await t(L)) && confirm(`Are you sure you want to delete "${L.name}"? This action cannot be undone.`))
|
|
1707
|
+
try {
|
|
1708
|
+
const C = await navigator.storage.getDirectory();
|
|
1709
|
+
await Me(L.path, C), await h(), await n?.([L.path]);
|
|
1710
|
+
} catch (C) {
|
|
1711
|
+
alert("Failed to delete file: " + (C instanceof Error ? C.message : String(C)));
|
|
1712
|
+
}
|
|
1713
|
+
}, q = async () => {
|
|
1714
|
+
if (v.size === 0) return;
|
|
1715
|
+
const L = b.filter((P) => v.has(P.path)), C = [];
|
|
1716
|
+
for (const P of L)
|
|
1717
|
+
try {
|
|
1718
|
+
await N(P, !0), await new Promise((B) => setTimeout(B, 100));
|
|
1719
|
+
} catch (B) {
|
|
1720
|
+
C.push(`${P.name}: ${B instanceof Error ? B.message : String(B)}`);
|
|
1721
|
+
}
|
|
1722
|
+
C.length > 0 && alert(`Some downloads failed:
|
|
1723
|
+
${C.join(`
|
|
1724
|
+
`)}`);
|
|
1725
|
+
}, K = async () => {
|
|
1726
|
+
if (v.size === 0) return;
|
|
1727
|
+
const L = b.filter((U) => v.has(U.path)), C = L.map((U) => U.name).join(", ");
|
|
1728
|
+
if (!confirm(
|
|
1729
|
+
`Are you sure you want to delete ${v.size} file(s)?
|
|
1730
|
+
|
|
1731
|
+
Files: ${C}
|
|
1732
|
+
|
|
1733
|
+
This action cannot be undone.`
|
|
1734
|
+
))
|
|
1735
|
+
return;
|
|
1736
|
+
const P = await navigator.storage.getDirectory(), B = [], Q = [];
|
|
1737
|
+
for (const U of L)
|
|
1738
|
+
if (!(t && !await t(U)))
|
|
1739
|
+
try {
|
|
1740
|
+
await Me(U.path, P), B.push(U.path);
|
|
1741
|
+
} catch (te) {
|
|
1742
|
+
Q.push(`${U.name}: ${te instanceof Error ? te.message : String(te)}`);
|
|
1743
|
+
}
|
|
1744
|
+
p(/* @__PURE__ */ new Set()), await h(), B.length > 0 && await n?.(B), Q.length > 0 && alert(`Some deletions failed:
|
|
1745
|
+
${Q.join(`
|
|
1746
|
+
`)}`);
|
|
1747
|
+
};
|
|
1748
|
+
return /* @__PURE__ */ $("div", { className: a, style: R.container, children: [
|
|
1749
|
+
/* @__PURE__ */ S("style", { children: "@keyframes opfs-spin{from{transform:rotate(0deg)}to{transform:rotate(360deg)}}" }),
|
|
1750
|
+
/* @__PURE__ */ $("div", { style: R.header, children: [
|
|
1751
|
+
/* @__PURE__ */ $("div", { style: { flex: 1, minWidth: 0 }, children: [
|
|
1752
|
+
/* @__PURE__ */ S("h1", { style: R.title, className: s.title, children: c }),
|
|
1753
|
+
/* @__PURE__ */ S("p", { style: R.description, className: s.description, children: o })
|
|
1754
|
+
] }),
|
|
1755
|
+
/* @__PURE__ */ S("button", { type: "button", onClick: h, className: R.button, children: "Refresh" })
|
|
1756
|
+
] }),
|
|
1757
|
+
v.size > 0 && /* @__PURE__ */ $(
|
|
1758
|
+
"div",
|
|
1759
|
+
{
|
|
1760
|
+
className: `mt-4 flex items-center justify-between rounded-lg border px-4 py-3 ${s.batchBar}`,
|
|
1761
|
+
children: [
|
|
1762
|
+
/* @__PURE__ */ $("span", { className: `text-sm font-medium ${s.batchText}`, children: [
|
|
1763
|
+
v.size,
|
|
1764
|
+
" file",
|
|
1765
|
+
v.size === 1 ? "" : "s",
|
|
1766
|
+
" selected"
|
|
1767
|
+
] }),
|
|
1768
|
+
/* @__PURE__ */ $("div", { className: "flex items-center gap-3", children: [
|
|
1769
|
+
/* @__PURE__ */ S("button", { onClick: q, className: R.button, children: /* @__PURE__ */ $("span", { className: "inline-flex items-center gap-2", children: [
|
|
1770
|
+
/* @__PURE__ */ S(Pe, {}),
|
|
1771
|
+
" Download All"
|
|
1772
|
+
] }) }),
|
|
1773
|
+
/* @__PURE__ */ S("button", { onClick: K, className: R.buttonDanger, children: /* @__PURE__ */ $("span", { className: "inline-flex items-center gap-2", children: [
|
|
1774
|
+
/* @__PURE__ */ S(Re, {}),
|
|
1775
|
+
" Delete All"
|
|
1776
|
+
] }) }),
|
|
1777
|
+
/* @__PURE__ */ S(
|
|
1778
|
+
"button",
|
|
1779
|
+
{
|
|
1780
|
+
onClick: () => p(/* @__PURE__ */ new Set()),
|
|
1781
|
+
className: `text-sm cursor-pointer bg-transparent border-0 ${s.clearButton}`,
|
|
1782
|
+
children: "Clear selection"
|
|
1783
|
+
}
|
|
1784
|
+
)
|
|
1785
|
+
] })
|
|
1786
|
+
]
|
|
1787
|
+
}
|
|
1788
|
+
),
|
|
1789
|
+
/* @__PURE__ */ S("div", { className: "mt-8", children: u ? /* @__PURE__ */ $("div", { className: "flex justify-center items-center py-12 gap-3", children: [
|
|
1790
|
+
/* @__PURE__ */ S("span", { style: { animation: "opfs-spin 1s linear infinite" }, children: /* @__PURE__ */ S(At, {}) }),
|
|
1791
|
+
/* @__PURE__ */ S("span", { className: s.loadingText, children: "Loading files..." })
|
|
1792
|
+
] }) : f ? /* @__PURE__ */ $("div", { className: `${R.errorBox} ${s.errorBox}`, children: [
|
|
1793
|
+
/* @__PURE__ */ S("h3", { className: `m-0 text-sm font-medium ${s.errorTitle}`, children: "Error" }),
|
|
1794
|
+
/* @__PURE__ */ S("div", { className: `mt-2 text-sm ${s.errorText}`, children: f })
|
|
1795
|
+
] }) : b.length === 0 ? /* @__PURE__ */ $("div", { className: R.emptyState, children: [
|
|
1796
|
+
/* @__PURE__ */ S("span", { className: s.emptyIcon, children: /* @__PURE__ */ S(xt, {}) }),
|
|
1797
|
+
/* @__PURE__ */ S("h3", { className: `mt-2 text-sm font-semibold ${s.emptyTitle}`, children: "No files" }),
|
|
1798
|
+
/* @__PURE__ */ S("p", { className: `mt-1 text-sm ${s.emptyText}`, children: "No files found in OPFS." })
|
|
1799
|
+
] }) : /* @__PURE__ */ S("div", { className: "overflow-x-auto", children: /* @__PURE__ */ $("table", { className: R.table, children: [
|
|
1800
|
+
/* @__PURE__ */ S("thead", { children: /* @__PURE__ */ $("tr", { className: s.tableBorder, children: [
|
|
1801
|
+
/* @__PURE__ */ S("th", { className: `${R.tableHeader} w-10 ${s.tableHeader}`, children: /* @__PURE__ */ S(
|
|
1802
|
+
"input",
|
|
1803
|
+
{
|
|
1804
|
+
ref: y,
|
|
1805
|
+
type: "checkbox",
|
|
1806
|
+
checked: m,
|
|
1807
|
+
onChange: z,
|
|
1808
|
+
"aria-label": "Select all"
|
|
1809
|
+
}
|
|
1810
|
+
) }),
|
|
1811
|
+
/* @__PURE__ */ S("th", { className: `${R.tableHeader} ${s.tableHeader}`, children: "Name" }),
|
|
1812
|
+
/* @__PURE__ */ S("th", { className: `${R.tableHeader} ${s.tableHeader}`, children: "Path" }),
|
|
1813
|
+
/* @__PURE__ */ S("th", { className: `${R.tableHeader} ${s.tableHeader}`, children: "Size" }),
|
|
1814
|
+
/* @__PURE__ */ S("th", { className: `${R.tableHeader} ${s.tableHeader}`, children: "Type" }),
|
|
1815
|
+
/* @__PURE__ */ S("th", { className: `${R.tableHeader} ${s.tableHeader}`, children: "Modified" }),
|
|
1816
|
+
/* @__PURE__ */ S(
|
|
1817
|
+
"th",
|
|
1818
|
+
{
|
|
1819
|
+
className: `${R.tableHeader} w-24 ${s.tableHeader}`,
|
|
1820
|
+
"aria-label": "Actions"
|
|
1821
|
+
}
|
|
1822
|
+
)
|
|
1823
|
+
] }) }),
|
|
1824
|
+
/* @__PURE__ */ S("tbody", { className: `divide-y ${s.tableBorder}`, children: b.map((L) => /* @__PURE__ */ $("tr", { className: s.tableRow, children: [
|
|
1825
|
+
/* @__PURE__ */ S("td", { className: `${R.tableCell} ${s.tableCell}`, children: /* @__PURE__ */ S(
|
|
1826
|
+
"input",
|
|
1827
|
+
{
|
|
1828
|
+
type: "checkbox",
|
|
1829
|
+
checked: v.has(L.path),
|
|
1830
|
+
onChange: () => g(L.path),
|
|
1831
|
+
"aria-label": `Select ${L.name}`
|
|
1832
|
+
}
|
|
1833
|
+
) }),
|
|
1834
|
+
/* @__PURE__ */ S("td", { className: `${R.tableCell} ${s.tableCell}`, children: /* @__PURE__ */ $("span", { className: "flex items-center gap-2", children: [
|
|
1835
|
+
/* @__PURE__ */ S(Nt, {}),
|
|
1836
|
+
L.name
|
|
1837
|
+
] }) }),
|
|
1838
|
+
/* @__PURE__ */ S("td", { className: `${R.tableCell} ${s.tableCellMuted}`, children: /* @__PURE__ */ S("code", { className: `text-xs px-2 py-1 rounded border ${s.codeBlock}`, children: L.path }) }),
|
|
1839
|
+
/* @__PURE__ */ S("td", { className: `${R.tableCell} ${s.tableCellMuted}`, children: Dt(L.size) }),
|
|
1840
|
+
/* @__PURE__ */ S("td", { className: `${R.tableCell} ${s.tableCellMuted}`, children: L.type }),
|
|
1841
|
+
/* @__PURE__ */ S("td", { className: `${R.tableCell} ${s.tableCellMuted}`, children: _t(L.lastModified) }),
|
|
1842
|
+
/* @__PURE__ */ S("td", { className: R.tableCell, children: /* @__PURE__ */ $("div", { className: "flex gap-2 justify-end", children: [
|
|
1843
|
+
/* @__PURE__ */ S(
|
|
1844
|
+
"button",
|
|
1845
|
+
{
|
|
1846
|
+
type: "button",
|
|
1847
|
+
onClick: () => N(L),
|
|
1848
|
+
title: "Download",
|
|
1849
|
+
className: `p-1.5 rounded cursor-pointer bg-transparent border-0 transition-colors ${s.actionButton}`,
|
|
1850
|
+
children: /* @__PURE__ */ S(Pe, {})
|
|
1851
|
+
}
|
|
1852
|
+
),
|
|
1853
|
+
/* @__PURE__ */ S(
|
|
1854
|
+
"button",
|
|
1855
|
+
{
|
|
1856
|
+
type: "button",
|
|
1857
|
+
onClick: () => M(L),
|
|
1858
|
+
title: "Delete",
|
|
1859
|
+
className: `p-1.5 rounded cursor-pointer bg-transparent border-0 transition-colors ${s.deleteButton}`,
|
|
1860
|
+
children: /* @__PURE__ */ S(Re, {})
|
|
1861
|
+
}
|
|
1862
|
+
)
|
|
1863
|
+
] }) })
|
|
1864
|
+
] }, L.path)) })
|
|
1865
|
+
] }) }) })
|
|
1866
|
+
] });
|
|
1867
|
+
}
|
|
1868
|
+
const Se = J("seedSdk:react:SeedImage"), le = /* @__PURE__ */ new Map(), Qe = (e) => {
|
|
1869
|
+
const r = /^(.*[\/\\])?([^\/\\]+?)(\.[^.\/\\]*)?$/, t = e.match(r);
|
|
1870
|
+
return t && t[2] ? t[2] : e;
|
|
1871
|
+
};
|
|
1872
|
+
function Pt(e) {
|
|
1873
|
+
return e.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
|
|
1874
|
+
}
|
|
1875
|
+
function Rt(e, r) {
|
|
1876
|
+
const t = new RegExp(`^${Pt(r)}$`), n = Qe(e);
|
|
1877
|
+
return t.test(n);
|
|
1878
|
+
}
|
|
1879
|
+
const Mt = ({ imageProperty: e, width: r, filename: t, ...n }) => {
|
|
1880
|
+
const [i, c] = w(), [o, l] = w(), { property: a } = Ue({
|
|
1881
|
+
propertyName: e.propertyName,
|
|
1882
|
+
seedLocalId: e.seedLocalId,
|
|
1883
|
+
seedUid: e.seedUid
|
|
1884
|
+
}), s = e ?? a, d = t ?? s?.refResolvedValue ?? s?.value, u = s?.value, f = typeof u == "string" ? u : d, h = u != null && (u instanceof File || u instanceof Blob), [b, v] = w(null), p = Te.useRef(null);
|
|
1885
|
+
I(() => {
|
|
1886
|
+
if (h && (u instanceof File || u instanceof Blob))
|
|
1887
|
+
return p.current || (p.current = URL.createObjectURL(u), v(p.current)), () => {
|
|
1888
|
+
p.current && (URL.revokeObjectURL(p.current), p.current = null), v(null);
|
|
1889
|
+
};
|
|
1890
|
+
p.current = null, v(null);
|
|
1891
|
+
}, [h, u]), I(() => !d || u && ((N) => typeof N == "string" && N.startsWith("blob:"))(u) || b ? void 0 : ((async () => {
|
|
1892
|
+
try {
|
|
1893
|
+
const N = s?.localStoragePath ? s.localStoragePath : `${j.getFilesPath("images")}/${d}`;
|
|
1894
|
+
if (await j.pathExists(N)) {
|
|
1895
|
+
const q = await j.getContentUrlFromPath(N);
|
|
1896
|
+
q && l(q);
|
|
1897
|
+
}
|
|
1898
|
+
} catch (N) {
|
|
1899
|
+
Se("_getOriginalContentUrl error", N);
|
|
1900
|
+
}
|
|
1901
|
+
})(), () => l(void 0)), [d, u, b, s?.localStoragePath]), I(() => {
|
|
1902
|
+
if (!r || !d)
|
|
1903
|
+
return;
|
|
1904
|
+
(async () => {
|
|
1905
|
+
try {
|
|
1906
|
+
const z = await j.getFs(), N = s?.localStoragePath ? s.localStoragePath.split("/").slice(0, -1).join("/") : j.getFilesPath("images"), K = z.readdirSync(N, { withFileTypes: !0 }).filter((k) => k.isDirectory()).map((k) => parseInt(k.name)), L = K.reduce((k, he) => Math.abs(he - r) < Math.abs(k - r) ? he : k, K[0]), C = Qe(d), P = `${C}-${L}`;
|
|
1907
|
+
if (le.has(P))
|
|
1908
|
+
try {
|
|
1909
|
+
const k = le.get(P);
|
|
1910
|
+
if (k && (await fetch(k)).ok) {
|
|
1911
|
+
c(k);
|
|
1912
|
+
return;
|
|
1913
|
+
}
|
|
1914
|
+
} catch (k) {
|
|
1915
|
+
Se("error", k), le.delete(P);
|
|
1916
|
+
}
|
|
1917
|
+
const Q = z.readdirSync(`${N}/${L}`, { withFileTypes: !0 }).find((k) => k.name ? Rt(k.name, C) : !1);
|
|
1918
|
+
if (!Q)
|
|
1919
|
+
return;
|
|
1920
|
+
const U = `${N}/${L}/${Q?.name}`;
|
|
1921
|
+
if (await j.pathExists(U)) {
|
|
1922
|
+
const k = await j.getContentUrlFromPath(U);
|
|
1923
|
+
k && (le.set(P, k), c(k));
|
|
1924
|
+
}
|
|
1925
|
+
} catch (z) {
|
|
1926
|
+
Se("_getSizedContentUrl error", z);
|
|
1927
|
+
}
|
|
1928
|
+
})();
|
|
1929
|
+
}, [s, r, f, d]);
|
|
1930
|
+
const y = (g) => typeof g == "string" && g.startsWith("blob:");
|
|
1931
|
+
if (!(!!i || !!o || !!b || !!f && y(f)) && !d)
|
|
1932
|
+
return null;
|
|
1933
|
+
const E = i || o || b || (y(f) ? f : void 0) || "data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7";
|
|
1934
|
+
return /* @__PURE__ */ S("img", { src: E, alt: n.alt || e.propertyName || "Image", ...n });
|
|
1935
|
+
}, wr = Te.memo(
|
|
1936
|
+
Mt,
|
|
1937
|
+
(e, r) => e.imageProperty === r.imageProperty && e.width === r.width && e.filename === r.filename
|
|
1938
|
+
);
|
|
1939
|
+
export {
|
|
1940
|
+
bt as FILES_QUERY_KEY_PREFIX,
|
|
1941
|
+
Sr as OPFSFilesManager,
|
|
1942
|
+
vr as SeedClientGate,
|
|
1943
|
+
wr as SeedImage,
|
|
1944
|
+
br as SeedProvider,
|
|
1945
|
+
wt as createSeedQueryClient,
|
|
1946
|
+
ze as getSeedQueryDefaultOptions,
|
|
1947
|
+
Oe as getServiceName,
|
|
1948
|
+
Ae as getServiceUniqueKey,
|
|
1949
|
+
Fe as getServiceValue,
|
|
1950
|
+
gr as invalidateItemPropertiesForItem,
|
|
1951
|
+
St as mergeSeedQueryDefaults,
|
|
1952
|
+
ir as useAllSchemaVersions,
|
|
1953
|
+
Wt as useCreateItem,
|
|
1954
|
+
Xt as useCreateItemProperty,
|
|
1955
|
+
lr as useCreateModel,
|
|
1956
|
+
fr as useCreateModelProperty,
|
|
1957
|
+
sr as useCreateSchema,
|
|
1958
|
+
rr as useDbsAreReady,
|
|
1959
|
+
Gt as useDebouncedItemProperty,
|
|
1960
|
+
yr as useDeleteItem,
|
|
1961
|
+
Zt as useDestroyItemProperty,
|
|
1962
|
+
cr as useDestroyModel,
|
|
1963
|
+
pr as useDestroyModelProperty,
|
|
1964
|
+
or as useDestroySchema,
|
|
1965
|
+
hr as useFiles,
|
|
1966
|
+
ft as useGlobalServiceStatus,
|
|
1967
|
+
dt as useHasSavedSnapshots,
|
|
1968
|
+
mr as useImageFiles,
|
|
1969
|
+
ct as useIsDbReady,
|
|
1970
|
+
Kt as useItem,
|
|
1971
|
+
Yt as useItemProperties,
|
|
1972
|
+
Ue as useItemProperty,
|
|
1973
|
+
jt as useItems,
|
|
1974
|
+
oe as useLiveQuery,
|
|
1975
|
+
ht as useModel,
|
|
1976
|
+
dr as useModelProperties,
|
|
1977
|
+
ur as useModelProperty,
|
|
1978
|
+
mt as useModels,
|
|
1979
|
+
Lt as useOPFSFiles,
|
|
1980
|
+
tr as usePersistedSnapshots,
|
|
1981
|
+
Jt as usePublishItem,
|
|
1982
|
+
pt as useSchema,
|
|
1983
|
+
nr as useSchemas,
|
|
1984
|
+
ar as useSeedProtocolSchema,
|
|
1985
|
+
er as useService,
|
|
1986
|
+
ut as useServices
|
|
1987
|
+
};
|
|
1988
|
+
//# sourceMappingURL=index.js.map
|