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