@voltro/client 0.83.1 → 0.84.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1,54 +1,17 @@
1
- import { A as e, C as t, D as n, E as r, F as i, M as a, N as o, O as s, P as c, S as l, T as u, _ as d, a as f, b as p, c as m, d as h, f as g, g as _, h as v, i as y, j as b, k as x, l as S, m as C, n as w, o as T, p as E, r as D, s as O, t as ee, u as k, v as A, w as te, x as j, y as M } from "./authRefresh-Cu2A-H5R.js";
2
- import { C as N, S as P, _ as ne, a as F, b as re, c as ie, d as ae, f as oe, g as se, h as ce, i as le, l as ue, m as de, n as fe, o as pe, p as me, r as he, s as ge, t as _e, u as ve, v as ye, w as be, x as xe, y as Se } from "./formData-dGz5aoUR.js";
3
- import { createContext as I, createElement as Ce, useCallback as L, useContext as we, useDebugValue as Te, useEffect as R, useId as Ee, useMemo as z, useRef as B, useState as V, useSyncExternalStore as H } from "react";
4
- import { Cause as De, Duration as Oe, Effect as U, Exit as ke, Fiber as Ae, Option as je, Schedule as Me, Schema as Ne, Stream as W } from "effect";
5
- import { PAIRING_HOST as Pe, PAIRING_SCHEME as Fe, PAIRING_STORAGE_KEY as Ie, applyPairing as Le, clearPairing as Re, errorMessage as ze, errorTag as Be, fieldIssuesOf as Ve, firstEventValue as He, pairingLink as Ue, parsePairingLink as We, pluginTag as Ge, readPairing as Ke } from "@voltro/protocol";
6
- import { jsx as qe } from "react/jsx-runtime";
7
- import { FormApi as Je } from "@tanstack/form-core";
8
- import { useStore as Ye } from "@tanstack/react-store";
9
- import { ArrayFormatter as Xe } from "effect/ParseResult";
10
- //#region src/runtimeContext.ts
11
- var Ze = I(null), Qe = () => {
12
- throw Error("Voltro: rpc / cache calls are not invokable on a not-yet-resolved api — either during SSR, or in the client boot window before the api client resolves");
13
- }, $e = new Proxy(() => Qe(), {
14
- get: (e, t) => $e,
15
- has: () => !0,
16
- apply: () => Qe()
17
- }), et = Symbol.for("@voltro/client/ssrDescriptors"), tt = globalThis, nt = tt[et] ?? (tt[et] = { byApi: /* @__PURE__ */ new Map() }), rt = (e, t) => {
18
- nt.byApi.set(e, t);
19
- }, it = (e) => nt.byApi.get(e), at = () => {
20
- nt.byApi.clear();
21
- }, ot = {
22
- runtime: { runPromiseExit: () => Promise.resolve(ke.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
23
- cache: new M(),
24
- client: $e,
25
- descriptors: {},
26
- inspectBaseUrl: "",
27
- errorBus: new v(),
28
- recovery: new g("ssr")
29
- }, st = {
30
- get: (e) => {
31
- let t = it(e);
32
- return t === void 0 ? ot : {
33
- ...ot,
34
- descriptors: t
35
- };
36
- },
37
- names: []
38
- }, ct = !1, lt = !1, G = null, ut = () => {
39
- ct = !1, lt = !1, G !== null && (clearTimeout(G), G = null);
40
- }, dt = () => {
41
- let e = we(Ze);
42
- return e ? (lt || (lt = !0, G !== null && (clearTimeout(G), G = null)), e) : (globalThis.window !== void 0 && !ct && !lt && G === null && process.env.NODE_ENV !== "production" && (G = setTimeout(() => {
43
- G = null, !(ct || lt) && (ct = !0, console.warn("useFrameworkRuntimes: no <FrameworkRuntimesProvider> in the tree — returning a loading baseline (subscriptions read `undefined`, mutations are no-ops). If this is not an intentional lazy/conditional mount, mount your app via @voltro/web mount() or wrap the subtree in <VoltroRuntimeProvider>."));
44
- }, 0)), st);
45
- }, K = (e) => {
46
- let t = dt(), n = t.demand;
47
- return R(() => {
48
- n?.(e);
49
- }, [n, e]), t.get(e);
50
- }, ft = (e) => typeof e.runtime?.runFork != "function", pt = ({ apis: e, children: t, demand: n }) => {
51
- let r = z(() => ({
1
+ import { A as e, C as t, D as n, E as r, O as i, S as a, T as o, _ as s, a as c, b as l, d as u, f as d, g as f, h as p, i as m, k as h, l as g, m as _, n as v, o as y, p as b, r as x, t as S, u as C, v as w, w as T, x as E, y as D } from "./runRpc-DvHpFZAZ.js";
2
+ import { a as ee, c as O, d as k, f as A, i as j, l as M, n as N, o as te, r as P, s as F, t as ne, u as I } from "./queryOnce-CvdopzOj.js";
3
+ import { a as L, c as R, i as z, n as re, o as ie, r as ae, s as oe, t as se } from "./authRefresh-C4Ow8HH7.js";
4
+ import { C as ce, S as le, _ as ue, a as de, b as fe, c as pe, d as me, f as he, g as ge, h as _e, i as ve, l as ye, m as be, n as xe, o as Se, p as Ce, r as we, s as Te, t as Ee, u as De, v as Oe, w as ke, x as Ae, y as je } from "./formData-dGz5aoUR.js";
5
+ import { createContext as Me, createElement as Ne, useCallback as B, useContext as Pe, useDebugValue as Fe, useEffect as V, useId as Ie, useMemo as H, useRef as U, useState as W, useSyncExternalStore as G } from "react";
6
+ import { Cause as Le, Duration as Re, Effect as K, Exit as ze, Fiber as Be, Option as Ve, Schedule as He, Schema as Ue, Stream as q } from "effect";
7
+ import { PAIRING_HOST as We, PAIRING_SCHEME as Ge, PAIRING_STORAGE_KEY as Ke, applyPairing as qe, clearPairing as Je, errorMessage as Ye, errorTag as Xe, fieldIssuesOf as Ze, pairingLink as Qe, parsePairingLink as $e, pluginTag as et, readPairing as tt } from "@voltro/protocol";
8
+ import { jsx as nt } from "react/jsx-runtime";
9
+ import { FormApi as rt } from "@tanstack/form-core";
10
+ import { useStore as it } from "@tanstack/react-store";
11
+ import { ArrayFormatter as at } from "effect/ParseResult";
12
+ //#region src/provider.tsx
13
+ var ot = ({ apis: e, children: t, demand: n }) => {
14
+ let r = H(() => ({
52
15
  get: (t) => {
53
16
  let n = e.get(t);
54
17
  if (!n) {
@@ -60,45 +23,45 @@ var Ze = I(null), Qe = () => {
60
23
  names: Array.from(e.keys()),
61
24
  ...n === void 0 ? {} : { demand: n }
62
25
  }), [e]);
63
- return /* @__PURE__ */ qe(Ze.Provider, {
26
+ return /* @__PURE__ */ nt(P.Provider, {
64
27
  value: r,
65
28
  children: t
66
29
  });
67
- }, mt = Symbol.for("@voltro/client/storeStorageProvider"), ht = () => {
68
- let e = globalThis, t = e[mt];
30
+ }, st = Symbol.for("@voltro/client/storeStorageProvider"), ct = () => {
31
+ let e = globalThis, t = e[st];
69
32
  if (t !== void 0) return t;
70
33
  let n = {
71
34
  provider: void 0,
72
35
  used: !1
73
36
  };
74
- return e[mt] = n, n;
75
- }, gt = (e) => {
37
+ return e[st] = n, n;
38
+ }, lt = (e) => {
76
39
  if (typeof window > "u") return null;
77
40
  try {
78
41
  return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
79
42
  } catch {
80
43
  return null;
81
44
  }
82
- }, _t = (e) => {
83
- let t = ht();
45
+ }, ut = (e) => {
46
+ let t = ct();
84
47
  t.used && e !== null && console.warn("[voltro] setStoreStorage() was called after a persisted store had already read. That store booted against the previous backing store and will not be re-read. Install storage before the first render — on React Native, after awaiting hydrate()."), t.provider = e ?? void 0;
85
- }, vt = (e) => {
86
- let t = ht();
87
- return t.used = !0, (t.provider ?? gt)(e);
88
- }, yt = () => {
89
- let e = ht();
48
+ }, dt = (e) => {
49
+ let t = ct();
50
+ return t.used = !0, (t.provider ?? lt)(e);
51
+ }, ft = () => {
52
+ let e = ct();
90
53
  e.provider = void 0, e.used = !1;
91
- }, bt = (e, t) => {
54
+ }, pt = (e, t) => {
92
55
  if (Object.is(e, t)) return !0;
93
56
  if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
94
57
  let n = Object.keys(e), r = Object.keys(t);
95
58
  if (n.length !== r.length) return !1;
96
59
  for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
97
60
  return !0;
98
- }, xt = 50, St = /* @__PURE__ */ new Set(), Ct = (e, t) => {
99
- St.has(e) || (St.add(e), console.warn(t));
100
- }, wt = "\0global", Tt = null, Et = (e, t, n) => {
101
- let r = Tt?.() ?? null;
61
+ }, mt = 50, ht = /* @__PURE__ */ new Set(), gt = (e, t) => {
62
+ ht.has(e) || (ht.add(e), console.warn(t));
63
+ }, _t = "\0global", vt = null, yt = (e, t, n) => {
64
+ let r = vt?.() ?? null;
102
65
  if (r === null) return n;
103
66
  let i = n;
104
67
  for (let n of r.seeds) n.store === e && n.key === t && (i = {
@@ -106,9 +69,9 @@ var Ze = I(null), Qe = () => {
106
69
  ...n.value
107
70
  });
108
71
  return i;
109
- }, Dt = (e, t) => {
72
+ }, bt = (e, t) => {
110
73
  let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
111
- if (i >= xt) throw i = 0, Error(`defineStore: notification depth exceeded ${xt} — a subscriber writes a NEW value every time it is notified, so the store can never settle. Look for a listener calling set() with something derived from the current state without converging.`);
74
+ if (i >= mt) throw i = 0, Error(`defineStore: notification depth exceeded ${mt} — a subscriber writes a NEW value every time it is notified, so the store can never settle. Look for a listener calling set() with something derived from the current state without converging.`);
112
75
  i += 1;
113
76
  try {
114
77
  for (let e of [...r]) e();
@@ -129,20 +92,20 @@ var Ze = I(null), Qe = () => {
129
92
  if (typeof i?.then == "function") throw a === 1 && o !== void 0 && (n = o), --a, a === 0 && (o = void 0, s = void 0), Error(`defineStore: batch('${e}') was given an async function. A batch is synchronous — everything after the first await would land outside it. Await the work first, then batch the writes: \`const r = await load(); store.batch('${e}', () => { … })\`.`);
130
93
  if (--a, a > 0) return;
131
94
  let l = o, u = s;
132
- o = void 0, s = void 0, !bt(l, n) && (t(l, n, u), c());
95
+ o = void 0, s = void 0, !pt(l, n) && (t(l, n, u), c());
133
96
  },
134
97
  set: (e, r) => {
135
98
  let i = typeof e == "function" ? e(n) : {
136
99
  ...n,
137
100
  ...e
138
101
  };
139
- if (bt(i, n)) return;
102
+ if (pt(i, n)) return;
140
103
  let o = n;
141
104
  n = i, !(a > 0) && (t(o, i, r), c());
142
105
  },
143
106
  reset: () => {
144
107
  let r = e();
145
- if (bt(r, n)) return;
108
+ if (pt(r, n)) return;
146
109
  let i = n;
147
110
  n = r, !(a > 0) && (t(i, r, "reset"), c());
148
111
  },
@@ -150,51 +113,51 @@ var Ze = I(null), Qe = () => {
150
113
  r.delete(e);
151
114
  })
152
115
  };
153
- }, Ot = 200, kt = [], At = /* @__PURE__ */ new Set(), jt = [], Mt = () => jt, Nt = (e) => (At.add(e), () => {
154
- At.delete(e);
155
- }), Pt = () => {
156
- kt.length = 0, jt = [];
157
- }, Ft = (e, t) => {
158
- let n = kt[e];
116
+ }, xt = 200, St = [], Ct = /* @__PURE__ */ new Set(), wt = [], Tt = () => wt, Et = (e) => (Ct.add(e), () => {
117
+ Ct.delete(e);
118
+ }), Dt = () => {
119
+ St.length = 0, wt = [];
120
+ }, Ot = (e, t) => {
121
+ let n = St[e];
159
122
  if (n === void 0) return !1;
160
- let r = zt.get(n.store);
123
+ let r = Mt.get(n.store);
161
124
  if (r === void 0) return !1;
162
125
  let i = t === "before" ? n.prev : n.next;
163
- Lt = !0;
126
+ At = !0;
164
127
  try {
165
128
  r.set(() => i, n.key, `travel:${t}`);
166
129
  } finally {
167
- Lt = !1;
130
+ At = !1;
168
131
  }
169
132
  return !0;
170
- }, It = !1, Lt = !1, Rt = (e) => {
171
- kt.push(e), kt.length > Ot && kt.shift(), jt = [...kt];
172
- for (let e of [...At]) e();
173
- }, zt = /* @__PURE__ */ new Map(), Bt = /* @__PURE__ */ new Map(), Vt = 0, Ht = !1, Ut = /* @__PURE__ */ new Map(), Wt = () => (Ht || (Ht = !0, queueMicrotask(() => {
174
- Vt += 1, Ht = !1;
175
- })), Vt), Gt = Kt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
176
- function Kt(e) {
133
+ }, kt = !1, At = !1, jt = (e) => {
134
+ St.push(e), St.length > xt && St.shift(), wt = [...St];
135
+ for (let e of [...Ct]) e();
136
+ }, Mt = /* @__PURE__ */ new Map(), Nt = /* @__PURE__ */ new Map(), Pt = 0, Ft = !1, It = /* @__PURE__ */ new Map(), Lt = () => (Ft || (Ft = !0, queueMicrotask(() => {
137
+ Pt += 1, Ft = !1;
138
+ })), Pt), Rt = zt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
139
+ function zt(e) {
177
140
  let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
178
141
  return n.length > 0 ? n : void 0;
179
142
  }
180
- var qt = () => {
143
+ var Bt = () => {
181
144
  let e = (/* @__PURE__ */ Error()).stack;
182
145
  if (typeof e != "string") return "<unknown>";
183
146
  for (let t of e.split("\n").slice(1)) {
184
- let e = Kt(t);
147
+ let e = zt(t);
185
148
  if (e === void 0) continue;
186
149
  let n = e.replace(/:\d+:\d+$/, "");
187
- if (Gt === "" || n !== Gt.replace(/:\d+:\d+$/, "")) return n;
150
+ if (Rt === "" || n !== Rt.replace(/:\d+:\d+$/, "")) return n;
188
151
  }
189
152
  return "<unknown>";
190
- }, Jt = () => [...zt.values()], Yt = (e, t, n) => {
191
- let r = qt(), i = Wt(), a = zt.get(e);
153
+ }, Vt = () => [...Mt.values()], Ht = (e, t, n) => {
154
+ let r = Bt(), i = Lt(), a = Mt.get(e);
192
155
  if (a !== void 0) {
193
- let t = Bt.get(e) ?? "<unknown>", n = Ut.get(e) === i;
156
+ let t = Nt.get(e) ?? "<unknown>", n = It.get(e) === i;
194
157
  if (r !== "<unknown>" && r === t && !n) return a;
195
158
  throw Error(`defineStore: '${e}' is already defined. Store names are the devtools + seed key, so two stores sharing one name would silently share state. Rename one.\n first: ${t}\n second: ${r}`);
196
159
  }
197
- let o = n?.persist, s = () => vt(o?.storage === "session" ? "session" : "local"), c = () => {
160
+ let o = n?.persist, s = () => dt(o?.storage === "session" ? "session" : "local"), c = () => {
198
161
  let e = s();
199
162
  if (e === null || o === void 0) return;
200
163
  let t;
@@ -219,28 +182,28 @@ var qt = () => {
219
182
  t.setItem(o.key, JSON.stringify(n));
220
183
  } catch {}
221
184
  }, u = /* @__PURE__ */ new Map(), d = (n) => {
222
- let r = n ?? wt, i = u.get(r);
185
+ let r = n ?? _t, i = u.get(r);
223
186
  if (i === void 0) {
224
187
  let a = n;
225
- i = Dt(o !== void 0 && n === void 0 ? () => {
188
+ i = bt(o !== void 0 && n === void 0 ? () => {
226
189
  let e = t();
227
190
  return f = e, {
228
191
  ...e,
229
192
  ...c() ?? {}
230
193
  };
231
194
  } : t, (t, n, r) => {
232
- if (o !== void 0 && a === void 0 && l(n), !It && !Lt) {
195
+ if (o !== void 0 && a === void 0 && l(n), !kt && !At) {
233
196
  let e = m(a);
234
197
  e.steps.length = e.cursor, e.steps.push({
235
198
  prev: t,
236
199
  next: n
237
200
  }), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
238
201
  }
239
- Rt({
202
+ jt({
240
203
  store: e,
241
204
  ...a === void 0 ? {} : { key: a },
242
205
  ...r === void 0 ? {} : { label: r },
243
- ...It || Lt ? { isUndo: !0 } : {},
206
+ ...kt || At ? { isUndo: !0 } : {},
244
207
  prev: t,
245
208
  next: n,
246
209
  at: Date.now()
@@ -249,7 +212,7 @@ var qt = () => {
249
212
  }
250
213
  return i;
251
214
  }, f, p = /* @__PURE__ */ new Map(), m = (e) => {
252
- let t = e ?? wt, n = p.get(t);
215
+ let t = e ?? _t, n = p.get(t);
253
216
  return n === void 0 && (n = {
254
217
  steps: [],
255
218
  cursor: 0
@@ -269,24 +232,24 @@ var qt = () => {
269
232
  }, b = {
270
233
  name: e,
271
234
  use: (t, n) => {
272
- let r = d(n?.key), i = B(t);
235
+ let r = d(n?.key), i = U(t);
273
236
  i.current = t;
274
- let a = B(n?.equals);
237
+ let a = U(n?.equals);
275
238
  a.current = n?.equals;
276
- let o = B({
239
+ let o = U({
277
240
  state: void 0,
278
241
  value: void 0,
279
242
  has: !1
280
- }), s = L((t) => {
243
+ }), s = B((t) => {
281
244
  let n = o.current;
282
245
  if (n.has && Object.is(n.state, t)) return n.value;
283
246
  let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
284
- if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && bt(n.value, r)) {
247
+ if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && pt(n.value, r)) {
285
248
  let t = !0;
286
249
  try {
287
250
  t = !Object.is(i.current(n.state), n.value);
288
251
  } catch {}
289
- Ct(e, t ? `[@voltro/client] ${e}.use(): the selector returns a NEW object each call, so the default identity check never sees it as unchanged and this component re-renders on EVERY store change.\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or select a primitive.` : `[@voltro/client] ${e}.use(): this component re-renders on store changes that do not change what it selects. The selector is stable — it returns the same reference for the same state — and the STORE is writing a new value that is equal one level deep (a fresh \`[]\` or \`{}\`, say).\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or stop writing an equal value.`);
252
+ gt(e, t ? `[@voltro/client] ${e}.use(): the selector returns a NEW object each call, so the default identity check never sees it as unchanged and this component re-renders on EVERY store change.\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or select a primitive.` : `[@voltro/client] ${e}.use(): this component re-renders on store changes that do not change what it selects. The selector is stable — it returns the same reference for the same state — and the STORE is writing a new value that is equal one level deep (a fresh \`[]\` or \`{}\`, say).\n Pass \`{ equals: shallow }\` (exported from @voltro/client), or stop writing an equal value.`);
290
253
  }
291
254
  let l = c ? n.value : r;
292
255
  return o.current = {
@@ -294,7 +257,7 @@ var qt = () => {
294
257
  value: l,
295
258
  has: !0
296
259
  }, l;
297
- }, []), c = n?.key, l = n?.retain === !0, u = L((e) => {
260
+ }, []), c = n?.key, l = n?.retain === !0, u = B((e) => {
298
261
  let t = r.subscribe(e);
299
262
  return c !== void 0 && !l && v(c), () => {
300
263
  t(), c !== void 0 && !l && y(c);
@@ -303,12 +266,12 @@ var qt = () => {
303
266
  r,
304
267
  c,
305
268
  l
306
- ]), p = L(() => s(r.get()), [r, s]), m = L(() => s(Et(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
269
+ ]), p = B(() => s(r.get()), [r, s]), m = B(() => s(yt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
307
270
  r,
308
271
  n?.key,
309
272
  s
310
- ]), h = H(u, p, m);
311
- return Te(h), h;
273
+ ]), h = G(u, p, m);
274
+ return Fe(h), h;
312
275
  },
313
276
  instance: d,
314
277
  get: (e) => d(e).get(),
@@ -321,11 +284,11 @@ var qt = () => {
321
284
  undo: (e) => {
322
285
  let t = m(e);
323
286
  if (t.cursor === 0) return !1;
324
- --t.cursor, It = !0;
287
+ --t.cursor, kt = !0;
325
288
  try {
326
289
  d(e).set(() => t.steps[t.cursor].prev, "undo");
327
290
  } finally {
328
- It = !1;
291
+ kt = !1;
329
292
  }
330
293
  return !0;
331
294
  },
@@ -333,11 +296,11 @@ var qt = () => {
333
296
  let t = m(e);
334
297
  if (t.cursor >= t.steps.length) return !1;
335
298
  let n = t.steps[t.cursor];
336
- t.cursor += 1, It = !0;
299
+ t.cursor += 1, kt = !0;
337
300
  try {
338
301
  d(e).set(() => n.next, "redo");
339
302
  } finally {
340
- It = !1;
303
+ kt = !1;
341
304
  }
342
305
  return !0;
343
306
  },
@@ -349,27 +312,27 @@ var qt = () => {
349
312
  release: (e) => {
350
313
  u.delete(e), p.delete(e);
351
314
  },
352
- keys: () => [...u.keys()].filter((e) => e !== wt)
315
+ keys: () => [...u.keys()].filter((e) => e !== _t)
353
316
  };
354
- return zt.set(e, b), Bt.set(e, r), Ut.set(e, i), b;
355
- }, Xt = () => {
356
- zt.clear(), Bt.clear(), Ut.clear(), St.clear();
357
- }, Zt = () => ({ seeds: [] }), Qt = (e) => {
358
- Tt = e;
359
- }, $t = (e, t, n) => {
360
- let r = Tt?.() ?? null;
317
+ return Mt.set(e, b), Nt.set(e, r), It.set(e, i), b;
318
+ }, Ut = () => {
319
+ Mt.clear(), Nt.clear(), It.clear(), ht.clear();
320
+ }, Wt = () => ({ seeds: [] }), Gt = (e) => {
321
+ vt = e;
322
+ }, Kt = (e, t, n) => {
323
+ let r = vt?.() ?? null;
361
324
  if (r === null) throw Error(`seedStore('${e.name}') was called outside a server render. Seeding exists to put a value into the SSR hydration payload; on the client, set the store directly instead. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
362
325
  r.seeds.push({
363
326
  store: e.name,
364
327
  ...n?.key === void 0 ? {} : { key: n.key },
365
328
  value: t
366
329
  });
367
- }, en = (e) => {
330
+ }, qt = (e) => {
368
331
  if (e !== void 0) for (let t of e) {
369
- let e = zt.get(t.store);
332
+ let e = Mt.get(t.store);
370
333
  e !== void 0 && e.set(t.value, t.key);
371
334
  }
372
- }, tn = {
335
+ }, Jt = {
373
336
  read: () => typeof navigator > "u" || navigator.onLine,
374
337
  subscribe: (e) => {
375
338
  if (typeof window > "u") return () => {};
@@ -378,7 +341,7 @@ var qt = () => {
378
341
  window.removeEventListener("online", t), window.removeEventListener("offline", n);
379
342
  };
380
343
  }
381
- }, nn = (e, t = {}) => {
344
+ }, Yt = (e, t = {}) => {
382
345
  let n = e.platform.shell !== "browser" && e.platform.shell !== "node" && e.platform.shell !== "test";
383
346
  return {
384
347
  offlineStart: e.platform.installed || n,
@@ -392,20 +355,20 @@ var qt = () => {
392
355
  installPrompt: e.platform.shell === "browser" && !e.platform.installed,
393
356
  ...t
394
357
  };
395
- }, rn = (e) => {
358
+ }, Xt = (e) => {
396
359
  let { capabilities: t, ...n } = e;
397
360
  return {
398
361
  ...n,
399
- capabilities: nn(n, t)
362
+ capabilities: Yt(n, t)
400
363
  };
401
- }, an = (e) => ({
364
+ }, Zt = (e) => ({
402
365
  kind: "none",
403
366
  get: async () => null,
404
367
  set: async () => {
405
368
  throw Error(`secureStorage: ${e}`);
406
369
  },
407
370
  delete: async () => {}
408
- }), on = () => {
371
+ }), Qt = () => {
409
372
  let e = /* @__PURE__ */ new Map();
410
373
  return {
411
374
  kind: "memory",
@@ -417,17 +380,17 @@ var qt = () => {
417
380
  e.delete(t);
418
381
  }
419
382
  };
420
- }, sn = {
383
+ }, $t = {
421
384
  read: () => typeof document > "u" ? "active" : document.visibilityState === "hidden" ? "background" : "active",
422
385
  subscribe: (e) => {
423
386
  if (typeof document > "u") return () => {};
424
387
  let t = () => e(document.visibilityState === "hidden" ? "background" : "active");
425
388
  return document.addEventListener("visibilitychange", t), () => document.removeEventListener("visibilitychange", t);
426
389
  }
427
- }, cn = {
390
+ }, en = {
428
391
  initialUrl: async () => typeof location > "u" ? null : location.href,
429
392
  subscribe: () => () => {}
430
- }, ln = () => {
393
+ }, tn = () => {
431
394
  if (typeof Notification > "u") return;
432
395
  let e = (e) => e === "granted" ? "granted" : e === "denied" ? "denied" : "prompt";
433
396
  return {
@@ -440,58 +403,58 @@ var qt = () => {
440
403
  });
441
404
  }
442
405
  };
443
- }, un = () => {
406
+ }, nn = () => {
444
407
  if (typeof window > "u") return !1;
445
408
  let e = window.matchMedia;
446
409
  return typeof e == "function" && e.call(window, "(display-mode: standalone)").matches ? !0 : navigator.standalone === !0;
447
- }, dn = (e, t) => {
410
+ }, rn = (e, t) => {
448
411
  let n = globalThis.WebSocket;
449
412
  if (n === void 0) throw Error("platform: no global WebSocket in this environment");
450
413
  return t === void 0 ? new n(e) : new n(e, t);
451
- }, fn = (e = {}) => {
452
- let t = typeof window < "u", n = un(), r = t ? navigator.userAgent : "", i = t ? /jsdom/i.test(r) ? "test" : "browser" : "node", a = ln();
453
- return rn({
414
+ }, an = (e = {}) => {
415
+ let t = typeof window < "u", n = nn(), r = t ? navigator.userAgent : "", i = t ? /jsdom/i.test(r) ? "test" : "browser" : "node", a = tn();
416
+ return Xt({
454
417
  platform: {
455
418
  kind: n ? "pwa" : "web",
456
419
  shell: i,
457
420
  installed: n
458
421
  },
459
- webSocket: dn,
460
- storage: gt,
461
- secureStorage: an("a browser tab has no secure store a page can read; the session is an HttpOnly cookie the server sets"),
462
- online: tn,
463
- lifecycle: sn,
464
- links: cn,
422
+ webSocket: rn,
423
+ storage: lt,
424
+ secureStorage: Zt("a browser tab has no secure store a page can read; the session is an HttpOnly cookie the server sets"),
425
+ online: Jt,
426
+ lifecycle: $t,
427
+ links: en,
465
428
  ...a === void 0 ? {} : { notifications: a },
466
429
  clock: { now: () => Date.now() },
467
430
  ...e
468
431
  });
469
- }, pn = Symbol.for("@voltro/client/platform"), mn = () => {
470
- let e = globalThis, t = e[pn];
432
+ }, on = Symbol.for("@voltro/client/platform"), sn = () => {
433
+ let e = globalThis, t = e[on];
471
434
  if (t !== void 0) return t;
472
435
  let n = {
473
436
  adapter: void 0,
474
437
  fallback: void 0,
475
438
  listeners: /* @__PURE__ */ new Set()
476
439
  };
477
- return e[pn] = n, n;
478
- }, hn = (e) => {
479
- let t = mn();
480
- t.adapter = e, _t(e.storage);
440
+ return e[on] = n, n;
441
+ }, cn = (e) => {
442
+ let t = sn();
443
+ t.adapter = e, ut(e.storage);
481
444
  for (let e of t.listeners) e();
482
- }, gn = () => {
483
- let e = mn();
484
- return e.adapter === void 0 ? (e.fallback === void 0 && (e.fallback = fn()), e.fallback) : e.adapter;
485
- }, _n = () => mn().adapter !== void 0, vn = () => {
486
- let e = mn();
487
- e.adapter = void 0, e.fallback = void 0, _t(null);
445
+ }, ln = () => {
446
+ let e = sn();
447
+ return e.adapter === void 0 ? (e.fallback === void 0 && (e.fallback = an()), e.fallback) : e.adapter;
448
+ }, un = () => sn().adapter !== void 0, dn = () => {
449
+ let e = sn();
450
+ e.adapter = void 0, e.fallback = void 0, ut(null);
488
451
  for (let t of e.listeners) t();
489
- }, yn = (e) => {
490
- let t = mn();
452
+ }, fn = (e) => {
453
+ let t = sn();
491
454
  return t.listeners.add(e), () => {
492
455
  t.listeners.delete(e);
493
456
  };
494
- }, bn = () => H(yn, gn, gn), xn = (e) => bn().extensions?.[e] ?? null, Sn = (e) => {
457
+ }, pn = () => G(fn, ln, ln), mn = (e) => pn().extensions?.[e] ?? null, hn = (e) => {
495
458
  let t = e.pattern;
496
459
  if (t.length === 0 || t[0] !== "/") throw Error(`defineDeepLink: pattern must start with "/" (got "${t}")`);
497
460
  return {
@@ -499,7 +462,7 @@ var qt = () => {
499
462
  pattern: t,
500
463
  handler: e.handler
501
464
  };
502
- }, Cn = (e) => {
465
+ }, gn = (e) => {
503
466
  let t = e, n = /^([a-zA-Z][a-zA-Z0-9+.-]*):\/\//.exec(t);
504
467
  if (n) {
505
468
  let e = t.slice(n[0].length), r = n[1].toLowerCase();
@@ -516,8 +479,8 @@ var qt = () => {
516
479
  return e;
517
480
  }
518
481
  });
519
- }, wn = (e, t) => {
520
- let n = Cn(e), r = Cn(t);
482
+ }, _n = (e, t) => {
483
+ let n = gn(e), r = gn(t);
521
484
  if (n.length !== r.length) return null;
522
485
  let i = {};
523
486
  for (let e = 0; e < n.length; e++) {
@@ -529,10 +492,10 @@ var qt = () => {
529
492
  } else if (t !== "*" && t !== a) return null;
530
493
  }
531
494
  return i;
532
- }, Tn = (e, t) => {
533
- let n = wn(e.pattern, t);
495
+ }, vn = (e, t) => {
496
+ let n = _n(e.pattern, t);
534
497
  return n === null ? null : (e.handler(n), n);
535
- }, En = (e, t) => {
498
+ }, yn = (e, t) => {
536
499
  let n = e.split("/").map((n) => {
537
500
  if (!n.startsWith(":")) return n;
538
501
  let r = n.slice(1), i = t[r];
@@ -540,49 +503,49 @@ var qt = () => {
540
503
  return encodeURIComponent(i);
541
504
  }).join("/");
542
505
  return n.length === 0 ? "/" : n;
543
- }, Dn = (e, t) => {
506
+ }, bn = (e, t) => {
544
507
  for (let n of e) {
545
- let e = wn(n.pattern, t);
508
+ let e = _n(n.pattern, t);
546
509
  if (e !== null) return {
547
510
  descriptor: n,
548
511
  params: e
549
512
  };
550
513
  }
551
514
  return null;
552
- }, On = (e, t) => {
553
- let n = Dn(e, t);
515
+ }, xn = (e, t) => {
516
+ let n = bn(e, t);
554
517
  if (n === null) return null;
555
518
  let r = n.descriptor.handler;
556
519
  return r(n.params), n.params;
557
- }, kn = Object.freeze({
520
+ }, Sn = Object.freeze({
558
521
  data: void 0,
559
522
  revision: -1,
560
523
  emittedAt: void 0,
561
524
  error: void 0,
562
525
  pendingPatches: 0
563
- }), An = () => kn;
564
- function q(e, t, n = {}, r = {}) {
565
- let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u = B(n);
526
+ }), Cn = () => Sn;
527
+ function J(e, t, n = {}, r = {}) {
528
+ let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = k(e), l = c[t]?.source, u = U(n);
566
529
  u.current = n;
567
- let d = B(s);
530
+ let d = U(s);
568
531
  d.current = s;
569
- let f = z(() => JSON.stringify(Object.entries(n).sort(([e], [t]) => e.localeCompare(t))), [n]), p = z(() => {
532
+ let f = H(() => JSON.stringify(Object.entries(n).sort(([e], [t]) => e.localeCompare(t))), [n]), p = H(() => {
570
533
  let e = u.current;
571
534
  return {
572
535
  queryKey: [t, e],
573
- fetch: () => T(d.current, t)(e)
536
+ fetch: () => v(d.current, t)(e)
574
537
  };
575
- }, [t, f]), m = p.queryKey, h = L((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
538
+ }, [t, f]), m = p.queryKey, h = B((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
576
539
  o,
577
540
  a,
578
541
  l,
579
542
  i,
580
543
  p
581
- ]), g = L(() => i ? kn : o.peek(m), [
544
+ ]), g = B(() => i ? Sn : o.peek(m), [
582
545
  o,
583
546
  i,
584
547
  m
585
- ]), _ = H(h, g, An), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
548
+ ]), _ = G(h, g, Cn), y = _.data !== void 0, b = y && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), x = {
586
549
  revision: _.revision,
587
550
  emittedAt: _.emittedAt,
588
551
  error: _.error,
@@ -591,74 +554,69 @@ function q(e, t, n = {}, r = {}) {
591
554
  if (r.initialSnapshot !== void 0) {
592
555
  let e = Array.isArray(r.initialSnapshot) ? r.initialSnapshot.length === 0 : r.initialSnapshot === null;
593
556
  return {
594
- ...b,
595
- data: v ? _.data : r.initialSnapshot,
557
+ ...x,
558
+ data: y ? _.data : r.initialSnapshot,
596
559
  loading: !1,
597
560
  idle: i,
598
- isEmpty: v ? y : e,
561
+ isEmpty: y ? b : e,
599
562
  failed: !1
600
563
  };
601
564
  }
602
565
  return r.fallback === void 0 ? i ? {
603
- ...b,
566
+ ...x,
604
567
  data: void 0,
605
568
  loading: !1,
606
569
  isEmpty: !1,
607
570
  idle: !0,
608
571
  failed: !1
609
- } : v ? {
610
- ...b,
572
+ } : y ? {
573
+ ...x,
611
574
  data: _.data,
612
575
  loading: !1,
613
- isEmpty: y,
576
+ isEmpty: b,
614
577
  idle: !1,
615
578
  failed: !1
616
- } : b.error === void 0 ? {
617
- ...b,
579
+ } : x.error === void 0 ? {
580
+ ...x,
618
581
  data: void 0,
619
582
  loading: !0,
620
583
  isEmpty: !1,
621
584
  idle: !1,
622
585
  failed: !1
623
586
  } : {
624
- ...b,
587
+ ...x,
625
588
  data: void 0,
626
589
  loading: !1,
627
590
  isEmpty: !1,
628
591
  idle: !1,
629
592
  failed: !0,
630
- error: b.error
593
+ error: x.error
631
594
  } : {
632
- ...b,
633
- data: v ? _.data : r.fallback,
634
- loading: !v && !i,
595
+ ...x,
596
+ data: y ? _.data : r.fallback,
597
+ loading: !y && !i,
635
598
  idle: i,
636
- isEmpty: y,
637
- failed: !v && b.error !== void 0
599
+ isEmpty: b,
600
+ failed: !y && x.error !== void 0
638
601
  };
639
602
  }
640
603
  //#endregion
641
- //#region src/awaitResolvedApi.ts
642
- var jn = 15e3, J = async (e, t, n) => {
643
- if (!ft(e.current)) return e.current;
644
- let r = Date.now() + jn;
645
- for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !ft(e.current)) return e.current;
646
- throw Error(`Voltro: the api "${t}" did not resolve within ${jn}ms, so ${n} was never sent. This is not the boot window — that is waited out. Check that "${t}" is a configured api name and that its client could connect.`);
647
- }, Mn = 100, Y = [], Nn = /* @__PURE__ */ new Set(), Pn = [], Fn = () => {
648
- Pn = Y.slice();
649
- }, In = () => {
650
- Fn();
651
- for (let e of Nn) try {
604
+ //#region src/mutationsBus.ts
605
+ var wn = 100, Y = [], Tn = /* @__PURE__ */ new Set(), En = [], Dn = () => {
606
+ En = Y.slice();
607
+ }, On = () => {
608
+ Dn();
609
+ for (let e of Tn) try {
652
610
  e();
653
611
  } catch {}
654
- }, Ln = (e) => {
612
+ }, kn = (e) => {
655
613
  let t = {
656
614
  ...e,
657
615
  kind: e.kind ?? "mutation",
658
616
  status: "pending",
659
617
  startedAt: Date.now()
660
618
  };
661
- Y.unshift(t), Y.length > Mn && (Y.length = Mn), In();
619
+ Y.unshift(t), Y.length > wn && (Y.length = wn), On();
662
620
  }, X = (e, t) => {
663
621
  let n = Y.findIndex((t) => t.id === e);
664
622
  if (n === -1) return;
@@ -675,42 +633,42 @@ var jn = 15e3, J = async (e, t, n) => {
675
633
  error: t.error,
676
634
  settledAt: i,
677
635
  durationMs: i - r.startedAt
678
- }, In();
679
- }, Rn = () => Pn, zn = (e) => (Nn.add(e), () => {
680
- Nn.delete(e);
681
- }), Bn = () => {
682
- Y.length !== 0 && (Y.length = 0, In());
683
- }, Vn = /* @__PURE__ */ new WeakMap(), Hn = (e, t) => {
636
+ }, On();
637
+ }, An = () => En, jn = (e) => (Tn.add(e), () => {
638
+ Tn.delete(e);
639
+ }), Mn = () => {
640
+ Y.length !== 0 && (Y.length = 0, On());
641
+ }, Nn = /* @__PURE__ */ new WeakMap(), Pn = (e, t) => {
684
642
  let n = Object.freeze({
685
643
  apiName: e,
686
644
  kind: "connection-setup"
687
645
  });
688
- return Vn.set(n, t), n;
689
- }, Un = (e, t) => {
690
- let n = Vn.get(e);
646
+ return Nn.set(n, t), n;
647
+ }, Fn = (e, t) => {
648
+ let n = Nn.get(e);
691
649
  if (n === void 0 || e.apiName !== t) throw Error(`Voltro: connection setup must belong to api "${t}"`);
692
650
  return n;
693
- }, Wn = /* @__PURE__ */ new WeakMap(), Gn = (e, t) => {
694
- Wn.set(e, t);
695
- }, Kn = (e) => Wn.get(e)?.capture(), qn = class extends Error {
651
+ }, In = /* @__PURE__ */ new WeakMap(), Ln = (e, t) => {
652
+ In.set(e, t);
653
+ }, Rn = (e) => In.get(e)?.capture(), zn = class extends Error {
696
654
  reason;
697
655
  _tag = "MutationSerialExecutionError";
698
656
  constructor(e) {
699
657
  super(`Serial mutation cannot start: ${e}`), this.reason = e, this.name = "MutationSerialExecutionError";
700
658
  }
701
- }, Jn = (e = 32) => {
659
+ }, Bn = (e = 32) => {
702
660
  if (!Number.isSafeInteger(e) || e < 1) throw RangeError("maxPending must be a positive safe integer");
703
661
  let t = /* @__PURE__ */ new WeakMap(), n = 0;
704
662
  return { reserve(r, i) {
705
- if (typeof r != "string" || r.length === 0) throw new qn("invalid-key");
706
- if (i.aborted) throw new qn("scope-changed");
663
+ if (typeof r != "string" || r.length === 0) throw new zn("invalid-key");
664
+ if (i.aborted) throw new zn("scope-changed");
707
665
  let a = t.get(i);
708
666
  a === void 0 && (a = /* @__PURE__ */ new Map(), t.set(i, a));
709
667
  let o = a, s = a.get(r);
710
- if (s?.blocked.signal.aborted) throw new qn("unknown-predecessor");
711
- if (n >= e) throw new qn("capacity");
668
+ if (s?.blocked.signal.aborted) throw new zn("unknown-predecessor");
669
+ if (n >= e) throw new zn("capacity");
712
670
  s === void 0 && (s = {
713
- semaphore: U.unsafeMakeSemaphore(1),
671
+ semaphore: K.unsafeMakeSemaphore(1),
714
672
  calls: 0,
715
673
  blocked: new AbortController()
716
674
  }, a.set(r, s));
@@ -719,9 +677,9 @@ var jn = 15e3, J = async (e, t, n) => {
719
677
  let l = new AbortController(), u = () => l.abort();
720
678
  i.addEventListener("abort", u, { once: !0 }), c.blocked.signal.addEventListener("abort", u, { once: !0 });
721
679
  let d = () => {
722
- if (i.aborted) throw new qn("scope-changed");
723
- if (c.blocked.signal.aborted) throw new qn("unknown-predecessor");
724
- }, f = U.runPromise(c.semaphore.take(1), { signal: l.signal }), p = f.then(() => {
680
+ if (i.aborted) throw new zn("scope-changed");
681
+ if (c.blocked.signal.aborted) throw new zn("unknown-predecessor");
682
+ }, f = K.runPromise(c.semaphore.take(1), { signal: l.signal }), p = f.then(() => {
725
683
  d();
726
684
  }, (e) => {
727
685
  throw d(), e;
@@ -733,19 +691,19 @@ var jn = 15e3, J = async (e, t, n) => {
733
691
  assertActive: d,
734
692
  release(e) {
735
693
  m || (m = !0, e === "unknown" && c.blocked.abort(), f.then(() => {
736
- U.runSync(c.semaphore.release(1));
694
+ K.runSync(c.semaphore.release(1));
737
695
  }, () => {}).finally(() => {
738
696
  i.removeEventListener("abort", u), c.blocked.signal.removeEventListener("abort", u), --n, --c.calls, c.calls === 0 && !c.blocked.signal.aborted && o.delete(r);
739
697
  }));
740
698
  }
741
699
  };
742
700
  } };
743
- }, Yn = /* @__PURE__ */ new WeakMap(), Xn = (e, t, n) => {
744
- let r = Yn.get(e);
745
- r === void 0 && (r = /* @__PURE__ */ new Map(), Yn.set(e, r));
701
+ }, Vn = /* @__PURE__ */ new WeakMap(), Hn = (e, t, n) => {
702
+ let r = Vn.get(e);
703
+ r === void 0 && (r = /* @__PURE__ */ new Map(), Vn.set(e, r));
746
704
  let i = r.get(t);
747
- return i === void 0 && (i = Jn(n), r.set(t, i)), i;
748
- }, Zn = (e, t) => {
705
+ return i === void 0 && (i = Bn(n), r.set(t, i)), i;
706
+ }, Un = (e, t) => {
749
707
  if (t === void 0 || typeof e != "object" || !e) return e;
750
708
  try {
751
709
  Object.defineProperty(e, "__voltroTraceId", {
@@ -755,188 +713,188 @@ var jn = 15e3, J = async (e, t, n) => {
755
713
  });
756
714
  } catch {}
757
715
  return e;
758
- }, Qn, $n = (e) => {
759
- Qn = e;
760
- }, er = () => Qn, tr = (e, t, n) => typeof e == "function" ? e(t, n) : e, nr = 0, rr = () => `mut_${++nr}`, ir = (e, t) => ({
716
+ }, Wn, Gn = (e) => {
717
+ Wn = e;
718
+ }, Kn = () => Wn, qn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Jn = 0, Yn = () => `mut_${++Jn}`, Xn = (e, t) => ({
761
719
  update: (n, r) => {
762
720
  e.update(n, r, t);
763
721
  },
764
722
  forTag: (n, r) => e.forTag(n, r, t)
765
- }), ar = (t, n) => {
766
- let r = K(t), { descriptors: i } = r, a = B(r);
767
- a.current = r;
768
- let o = i[n], s = o?.targets;
723
+ }), Zn = (e, t) => {
724
+ let n = k(e), { descriptors: i } = n, a = U(n);
725
+ a.current = n;
726
+ let s = i[t], l = s?.targets;
769
727
  if (process.env.NODE_ENV !== "production") {
770
- let e = o?.kind;
771
- e !== void 0 && e !== "mutation" && console.error(`[@voltro/client] useMutation('${t}', '${n}') targets a ${e}, not a mutation. Use ${e === "action" ? "useAction" : e === "workflow" ? "useWorkflow" : `the ${e} hook`} instead.`);
728
+ let n = s?.kind;
729
+ n !== void 0 && n !== "mutation" && console.error(`[@voltro/client] useMutation('${e}', '${t}') targets a ${n}, not a mutation. Use ${n === "action" ? "useAction" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
772
730
  }
773
- let [c, l] = V(!1), [u, d] = V(void 0), [p, m] = V(void 0), h = B(null), g = B(!1), _ = B(0), v = L(async (r, i) => {
774
- let o = i?.onError !== void 0 || i?.notify?.error !== void 0, c = (e) => {
775
- i?.onError?.(e, r);
776
- let t = tr(i?.notify?.error, e, r);
777
- t !== void 0 && Qn?.error(t);
731
+ let [u, d] = W(!1), [f, p] = W(void 0), [m, h] = W(void 0), g = U(null), _ = U(!1), y = U(0), b = B(async (n, i) => {
732
+ let s = i?.onError !== void 0 || i?.notify?.error !== void 0, u = (e) => {
733
+ i?.onError?.(e, n);
734
+ let t = qn(i?.notify?.error, e, n);
735
+ t !== void 0 && Wn?.error(t);
778
736
  };
779
- _.current += 1;
780
- let u = () => l(--_.current > 0);
781
- l(!0), d(void 0);
782
- let p, x, S, C, w;
737
+ y.current += 1;
738
+ let f = () => d(--y.current > 0);
739
+ d(!0), p(void 0);
740
+ let m, x, C, w, T;
783
741
  try {
784
- C = Kn(v);
785
- let e = a.current.descriptors[n]?.serialize;
786
- if (e !== void 0) {
787
- let i = a.current, o = i.recovery ?? E(i.errorBus, t);
788
- w = Xn(i.descriptors, n, e.maxPending ?? 32).reserve(e.key(r), o.subjectSignal);
742
+ w = Rn(b);
743
+ let r = a.current.descriptors[t]?.serialize;
744
+ if (r !== void 0) {
745
+ let i = a.current, o = i.recovery ?? c(i.errorBus, e);
746
+ T = Hn(i.descriptors, t, r.maxPending ?? 32).reserve(r.key(n), o.subjectSignal);
789
747
  }
790
- ({runtime: p, cache: x, client: S} = await J(a, t, n));
748
+ ({runtime: m, cache: x, client: C} = await N(a, e, t));
791
749
  } catch (e) {
792
- if (w?.release(), u(), d(e), a.current.errorBus.emit({
750
+ if (T?.release(), f(), p(e), a.current.errorBus.emit({
793
751
  source: "mutation",
794
- tag: n,
752
+ tag: t,
795
753
  error: e,
796
754
  kind: "client",
797
755
  outcome: "not-started"
798
- }), o) return c(e);
756
+ }), s) return u(e);
799
757
  throw e;
800
758
  }
801
- let O = rr(), ee = i?.idempotencyKey ?? D();
802
- Ln({
803
- id: O,
804
- apiName: t,
805
- tag: n,
806
- input: r
759
+ let E = Yn(), D = i?.idempotencyKey ?? ae();
760
+ kn({
761
+ id: E,
762
+ apiName: e,
763
+ tag: t,
764
+ input: n
807
765
  });
808
- let A = h.current, te = g.current;
766
+ let ee = g.current, O = _.current;
809
767
  try {
810
- A ? A(ir(x, O), r) : !te && s && s.length > 0 && x.autoApply(s, r, O);
768
+ ee ? ee(Xn(x, E), n) : !O && l && l.length > 0 && x.autoApply(l, n, E);
811
769
  } catch (e) {
812
- if (w?.release(), d(e), u(), x.revertByMutation(O), X(O, {
770
+ if (T?.release(), p(e), f(), x.revertByMutation(E), X(E, {
813
771
  status: "error",
814
772
  error: e
815
- }), o) return c(e);
773
+ }), s) return u(e);
816
774
  throw e;
817
775
  }
818
- let j, M = !1, N, P, ne, F = Date.now();
776
+ let k, A = !1, j, M, te, P = Date.now();
819
777
  try {
820
- if (w) {
821
- await w.ready, w.assertActive();
822
- let e = await J(a, t, n);
823
- p = e.runtime, S = e.client;
778
+ if (T) {
779
+ await T.ready, T.assertActive();
780
+ let n = await N(a, e, t);
781
+ m = n.runtime, C = n.client;
824
782
  }
825
- let o = async (e, i, o, s) => {
826
- let c = k(e), l = c?.getSnapshot();
827
- P = c === void 0 ? void 0 : () => a.current.runtime === e && l !== void 0 && c.getSnapshot() === l, s?.(), w?.assertActive();
828
- let u = C === void 0 ? void 0 : await C.prepare(e, i);
829
- l = c?.getSnapshot(), s?.();
830
- let d = T(i, n), p = y(d(r), ee), m = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
831
- j = e.traceId, b({
783
+ let s = async (i, o, s, c) => {
784
+ let l = R(i), u = l?.getSnapshot();
785
+ M = l === void 0 ? void 0 : () => a.current.runtime === i && u !== void 0 && l.getSnapshot() === u, c?.(), T?.assertActive();
786
+ let d = w === void 0 ? void 0 : await w.prepare(i, o);
787
+ u = l?.getSnapshot(), c?.();
788
+ let f = v(o, t), p = z(f(n), D), m = K.currentSpan.pipe(K.tap((e) => K.sync(() => {
789
+ k = e.traceId, r({
832
790
  traceId: e.traceId,
833
791
  spanId: e.spanId,
834
792
  source: "mutation",
835
- tag: n
793
+ tag: t
836
794
  });
837
- })), U.catchAll(() => U.void), U.zipRight(U.try({
795
+ })), K.catchAll(() => K.void), K.zipRight(K.try({
838
796
  try: () => {
839
- s?.(), w?.assertActive(), M = !0;
797
+ c?.(), T?.assertActive(), A = !0;
840
798
  },
841
799
  catch: (e) => e
842
- })), U.zipRight(p)).pipe(U.withSpan(`client.mutation.${n}`, { attributes: {
843
- "voltro.api": t,
844
- "voltro.mutationId": O,
845
- "rpc.tag": n,
846
- "voltro.replay": o
800
+ })), K.zipRight(p)).pipe(K.withSpan(`client.mutation.${t}`, { attributes: {
801
+ "voltro.api": e,
802
+ "voltro.mutationId": E,
803
+ "rpc.tag": t,
804
+ "voltro.replay": s
847
805
  } }));
848
- return u === void 0 ? f(e, m) : u.run(m);
849
- }, s;
806
+ return d === void 0 ? S(i, m) : d.run(m);
807
+ }, l;
850
808
  try {
851
- s = await o(p, S, !1);
852
- } catch (r) {
853
- let i = e(r, M ? "handler" : "client"), c = Zn(r, j);
854
- i === "transport" && (a.current.errorBus.emit({
809
+ l = await s(m, C, !1);
810
+ } catch (n) {
811
+ let r = o(n, A ? "handler" : "client"), i = Un(n, k);
812
+ r === "transport" && (a.current.errorBus.emit({
855
813
  source: "mutation",
856
- tag: n,
857
- error: c,
858
- kind: i,
859
- ...P === void 0 ? {} : { affectsTransport: P() },
860
- outcome: M ? "unknown" : "not-started",
861
- ...j === void 0 ? {} : { traceId: j }
862
- }), N = c);
863
- let l = a.current, u = l.recovery ?? E(l.errorBus, t), d = i === "transport" ? u.reserveMutationReplay(F) : void 0;
864
- if (d === void 0) throw c;
814
+ tag: t,
815
+ error: i,
816
+ kind: r,
817
+ ...M === void 0 ? {} : { affectsTransport: M() },
818
+ outcome: A ? "unknown" : "not-started",
819
+ ...k === void 0 ? {} : { traceId: k }
820
+ }), j = i);
821
+ let u = a.current, d = u.recovery ?? c(u.errorBus, e), f = r === "transport" ? d.reserveMutationReplay(P) : void 0;
822
+ if (f === void 0) throw i;
865
823
  try {
866
- if (!await u.waitForMutationReplaySupport(F) || !await u.waitForProtocolReady(F) || !d.isValid()) throw c;
867
- let e = () => {
868
- if (!d.isValid()) throw c;
824
+ if (!await d.waitForMutationReplaySupport(P) || !await d.waitForProtocolReady(P) || !f.isValid()) throw i;
825
+ let n = () => {
826
+ if (!f.isValid()) throw i;
869
827
  };
870
828
  for (;;) {
871
- e();
872
- let r = await J(a, t, n);
829
+ n();
830
+ let r = await N(a, e, t);
873
831
  try {
874
- s = await o(r.runtime, r.client, !0, e);
832
+ l = await s(r.runtime, r.client, !0, n);
875
833
  break;
876
- } catch (t) {
877
- let n = t;
878
- if (n?._tag !== "MutationInFlight") throw t;
879
- let r = typeof n.retryAfterMs == "number" && Number.isFinite(n.retryAfterMs) && n.retryAfterMs > 0 ? n.retryAfterMs : 1e3;
880
- if (r >= u.replayWindowRemaining(F)) throw t;
881
- await new Promise((e) => setTimeout(e, r)), e();
834
+ } catch (e) {
835
+ let t = e;
836
+ if (t?._tag !== "MutationInFlight") throw e;
837
+ let r = typeof t.retryAfterMs == "number" && Number.isFinite(t.retryAfterMs) && t.retryAfterMs > 0 ? t.retryAfterMs : 1e3;
838
+ if (r >= d.replayWindowRemaining(P)) throw e;
839
+ await new Promise((e) => setTimeout(e, r)), n();
882
840
  }
883
841
  }
884
842
  } finally {
885
- d.release();
843
+ f.release();
886
844
  }
887
845
  }
888
- m(s), X(O, {
846
+ h(l), X(E, {
889
847
  status: "success",
890
- output: s
848
+ output: l
891
849
  }), a.current.errorBus.emitSuccess({
892
850
  source: "mutation",
893
- tag: n
894
- }), x.confirmByMutation(O), i?.onSuccess?.(s, r);
895
- let c = tr(i?.notify?.success, s, r);
896
- return c !== void 0 && Qn?.success(c), s;
897
- } catch (t) {
898
- M && (N !== void 0 || e(t, "handler") === "transport") && (ne = "unknown");
899
- let r = Zn(t, j);
900
- if (d(r), X(O, {
851
+ tag: t
852
+ }), x.confirmByMutation(E), i?.onSuccess?.(l, n);
853
+ let u = qn(i?.notify?.success, l, n);
854
+ return u !== void 0 && Wn?.success(u), l;
855
+ } catch (e) {
856
+ A && (j !== void 0 || o(e, "handler") === "transport") && (te = "unknown");
857
+ let n = Un(e, k);
858
+ if (p(n), X(E, {
901
859
  status: "error",
902
- error: r
903
- }), x.revertByMutation(O), Object.is(N, r) || a.current.errorBus.emit({
860
+ error: n
861
+ }), x.revertByMutation(E), Object.is(j, n) || a.current.errorBus.emit({
904
862
  source: "mutation",
905
- tag: n,
906
- error: r,
907
- kind: M ? e(t, "handler") : "client",
908
- ...P === void 0 ? {} : { affectsTransport: P() },
909
- outcome: M && e(t, "handler") === "transport" ? "unknown" : M ? "known" : "not-started",
910
- ...j === void 0 ? {} : { traceId: j }
911
- }), o) return c(r);
912
- throw r;
863
+ tag: t,
864
+ error: n,
865
+ kind: A ? o(e, "handler") : "client",
866
+ ...M === void 0 ? {} : { affectsTransport: M() },
867
+ outcome: A && o(e, "handler") === "transport" ? "unknown" : A ? "known" : "not-started",
868
+ ...k === void 0 ? {} : { traceId: k }
869
+ }), s) return u(n);
870
+ throw n;
913
871
  } finally {
914
- w?.release(ne), u();
872
+ T?.release(te), f();
915
873
  }
916
874
  }, [
875
+ e,
917
876
  t,
918
- n,
919
- s
877
+ l
920
878
  ]);
921
- return z(() => {
922
- let e = {
923
- mutate: v,
924
- pending: c,
925
- error: u,
926
- data: p,
927
- withOptimistic: (t) => (h.current = t, e),
928
- withoutOptimistic: () => (g.current = !0, e),
929
- withConnectionSetup: (n) => (Gn(v, Un(n, t)), e)
879
+ return H(() => {
880
+ let t = {
881
+ mutate: b,
882
+ pending: u,
883
+ error: f,
884
+ data: m,
885
+ withOptimistic: (e) => (g.current = e, t),
886
+ withoutOptimistic: () => (_.current = !0, t),
887
+ withConnectionSetup: (n) => (Ln(b, Fn(n, e)), t)
930
888
  };
931
- return e;
889
+ return t;
932
890
  }, [
933
- v,
934
- c,
891
+ b,
935
892
  u,
936
- p,
937
- t
893
+ f,
894
+ m,
895
+ e
938
896
  ]);
939
- }, or = (e, t) => {
897
+ }, Qn = (e, t) => {
940
898
  if (t === void 0 || typeof e != "object" || !e) return e;
941
899
  try {
942
900
  Object.defineProperty(e, "__voltroTraceId", {
@@ -946,90 +904,90 @@ var jn = 15e3, J = async (e, t, n) => {
946
904
  });
947
905
  } catch {}
948
906
  return e;
949
- }, sr = (e, t, n) => typeof e == "function" ? e(t, n) : e, cr = 0, lr = () => `act_${++cr}`, ur = (t, n) => {
950
- let r = K(t), { descriptors: i } = r, a = B(r);
951
- if (a.current = r, process.env.NODE_ENV !== "production") {
952
- let e = i[n]?.kind;
953
- e !== void 0 && e !== "action" && console.error(`[@voltro/client] useAction('${t}', '${n}') targets a ${e}, not an action. Use ${e === "mutation" ? "useMutation" : e === "workflow" ? "useWorkflow" : `the ${e} hook`} instead.`);
907
+ }, $n = (e, t, n) => typeof e == "function" ? e(t, n) : e, er = 0, tr = () => `act_${++er}`, nr = (e, t) => {
908
+ let n = k(e), { descriptors: i } = n, a = U(n);
909
+ if (a.current = n, process.env.NODE_ENV !== "production") {
910
+ let n = i[t]?.kind;
911
+ n !== void 0 && n !== "action" && console.error(`[@voltro/client] useAction('${e}', '${t}') targets a ${n}, not an action. Use ${n === "mutation" ? "useMutation" : n === "workflow" ? "useWorkflow" : `the ${n} hook`} instead.`);
954
912
  }
955
- let [o, s] = V(!1), [c, l] = V(void 0), [u, d] = V(void 0), p = L(async (r, i) => {
956
- let o = i?.onError !== void 0 || i?.notify?.error !== void 0;
957
- s(!0), l(void 0);
958
- let c = lr(), u = i?.idempotencyKey ?? D();
959
- Ln({
960
- id: c,
961
- apiName: t,
962
- tag: n,
963
- input: r,
913
+ let [s, c] = W(!1), [l, u] = W(void 0), [d, f] = W(void 0), p = B(async (n, i) => {
914
+ let s = i?.onError !== void 0 || i?.notify?.error !== void 0;
915
+ c(!0), u(void 0);
916
+ let l = tr(), d = i?.idempotencyKey ?? ae();
917
+ kn({
918
+ id: l,
919
+ apiName: e,
920
+ tag: t,
921
+ input: n,
964
922
  kind: "action"
965
923
  });
966
924
  let p, m = !1;
967
925
  try {
968
- let { runtime: e, client: o } = await J(a, t, n), s = T(o, n), l = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
969
- p = e.traceId, b({
926
+ let { runtime: o, client: s } = await N(a, e, t), c = v(s, t), u = K.currentSpan.pipe(K.tap((e) => K.sync(() => {
927
+ p = e.traceId, r({
970
928
  traceId: e.traceId,
971
929
  spanId: e.spanId,
972
930
  source: "action",
973
- tag: n
931
+ tag: t
974
932
  });
975
- })), U.catchAll(() => U.void), U.zipRight(y(s(r), u))).pipe(U.withSpan(`client.action.${n}`, { attributes: {
976
- "voltro.api": t,
977
- "voltro.actionId": c,
978
- "rpc.tag": n
933
+ })), K.catchAll(() => K.void), K.zipRight(z(c(n), d))).pipe(K.withSpan(`client.action.${t}`, { attributes: {
934
+ "voltro.api": e,
935
+ "voltro.actionId": l,
936
+ "rpc.tag": t
979
937
  } }));
980
938
  m = !0;
981
- let h = await f(e, l);
982
- d(h), X(c, {
939
+ let h = await S(o, u);
940
+ f(h), X(l, {
983
941
  status: "success",
984
942
  output: h
985
943
  }), a.current.errorBus.emitSuccess({
986
944
  source: "action",
987
- tag: n
988
- }), i?.onSuccess?.(h, r);
989
- let g = sr(i?.notify?.success, h, r);
990
- return g !== void 0 && er()?.success(g), h;
991
- } catch (t) {
992
- let s = or(t, p);
993
- if (l(s), X(c, {
945
+ tag: t
946
+ }), i?.onSuccess?.(h, n);
947
+ let g = $n(i?.notify?.success, h, n);
948
+ return g !== void 0 && Kn()?.success(g), h;
949
+ } catch (e) {
950
+ let r = Qn(e, p);
951
+ if (u(r), X(l, {
994
952
  status: "error",
995
- error: s
953
+ error: r
996
954
  }), a.current.errorBus.emit({
997
955
  source: "action",
998
- tag: n,
999
- error: s,
1000
- kind: m ? e(t, "handler") : "client",
1001
- outcome: m && e(t, "handler") === "transport" ? "unknown" : m ? "known" : "not-started",
956
+ tag: t,
957
+ error: r,
958
+ kind: m ? o(e, "handler") : "client",
959
+ outcome: m && o(e, "handler") === "transport" ? "unknown" : m ? "known" : "not-started",
1002
960
  ...p === void 0 ? {} : { traceId: p }
1003
- }), o) {
1004
- i?.onError?.(s, r);
1005
- let e = sr(i?.notify?.error, s, r);
1006
- e !== void 0 && er()?.error(e);
961
+ }), s) {
962
+ i?.onError?.(r, n);
963
+ let e = $n(i?.notify?.error, r, n);
964
+ e !== void 0 && Kn()?.error(e);
1007
965
  return;
1008
966
  }
1009
- throw s;
967
+ throw r;
1010
968
  } finally {
1011
- s(!1);
969
+ c(!1);
1012
970
  }
1013
- }, [t, n]);
1014
- return z(() => ({
971
+ }, [e, t]);
972
+ return H(() => ({
1015
973
  run: p,
1016
- pending: o,
1017
- error: c,
1018
- lastResult: u
974
+ pending: s,
975
+ error: l,
976
+ lastResult: d
1019
977
  }), [
1020
978
  p,
1021
- o,
1022
- c,
1023
- u
979
+ s,
980
+ l,
981
+ d
1024
982
  ]);
1025
- }, dr = I(void 0), fr = (e) => Ce(dr.Provider, { value: e.messages }, e.children), pr = () => we(dr), mr = Symbol.for("voltro.client.formEngine"), hr = I(void 0), gr = (e, t) => {
983
+ }, rr = Me(void 0), ir = (e) => Ne(rr.Provider, { value: e.messages }, e.children), ar = () => Pe(rr), or = Symbol.for("voltro.client.formEngine"), sr = Me(void 0), cr = (e, t) => {
1026
984
  let n = e;
1027
985
  for (let e of t.split(".")) {
1028
986
  if (typeof n != "object" || !n) return;
1029
987
  n = n[e];
1030
988
  }
1031
989
  return n;
1032
- }, _r = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), vr = {
990
+ }, lr = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), ur = {
1033
991
  isTouched: !1,
1034
992
  isBlurred: !1,
1035
993
  isDirty: !1,
@@ -1038,35 +996,35 @@ var jn = 15e3, J = async (e, t, n) => {
1038
996
  isValidating: !1,
1039
997
  errorMap: {},
1040
998
  errorSourceMap: {}
1041
- }, yr = (e, t) => {
999
+ }, dr = (e, t) => {
1042
1000
  let n = e.find((e) => e.name === t);
1043
1001
  if (n !== void 0) return n;
1044
1002
  let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
1045
1003
  if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
1046
- }, br = (e, t, n) => {
1047
- let r = K(e), i = B(void 0), a = typeof t == "function" ? t(i.current?.state?.values ?? n.defaults ?? {}) : t, o = B(a).current, s = ar(e, a), c = n.schema ?? r.descriptors[a]?.input;
1048
- return process.env.NODE_ENV !== "production" && c === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${t}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`), Sr(e, o, n, c, i, s);
1049
- }, xr = (e) => {
1050
- let t = B(void 0);
1051
- return Sr("local", Ee(), {
1004
+ }, fr = (e, t, n) => {
1005
+ let r = k(e), i = U(void 0), a = typeof t == "function" ? t(i.current?.state?.values ?? n.defaults ?? {}) : t, o = U(a).current, s = Zn(e, a), c = n.schema ?? r.descriptors[a]?.input;
1006
+ return process.env.NODE_ENV !== "production" && c === void 0 && console.error(`[@voltro/client] useFormBinding('${e}', '${t}'): no input schema. Pass options.schema, or mount the descriptor so its input reaches the client. Rendering no fields; submit skips client-side validation.`), mr(e, o, n, c, i, s);
1007
+ }, pr = (e) => {
1008
+ let t = U(void 0);
1009
+ return mr("local", Ie(), {
1052
1010
  ...e,
1053
- onSubmit: async ({ input: t }) => e.onSubmit(await Ne.decodeUnknownPromise(e.schema)(t))
1011
+ onSubmit: async ({ input: t }) => e.onSubmit(await Ue.decodeUnknownPromise(e.schema)(t))
1054
1012
  }, e.schema, t);
1055
- }, Sr = (e, t, n, r, i, a) => {
1056
- let o = z(() => r ? be(r) : [], [r]), s = pr(), c = n.messages ?? s, l = z(() => ({
1013
+ }, mr = (e, t, n, r, i, a) => {
1014
+ let o = H(() => r ? ke(r) : [], [r]), s = ar(), c = n.messages ?? s, l = H(() => ({
1057
1015
  ...n.locale === void 0 ? {} : { locale: n.locale },
1058
1016
  ...c === void 0 ? {} : { messages: c }
1059
- }), [n.locale, c]), u = B(n.asyncFields);
1017
+ }), [n.locale, c]), u = U(n.asyncFields);
1060
1018
  u.current = n.asyncFields;
1061
- let d = B(n);
1019
+ let d = U(n);
1062
1020
  d.current = n;
1063
- let f = B(a);
1021
+ let f = U(a);
1064
1022
  f.current = a;
1065
- let p = B(l);
1023
+ let p = U(l);
1066
1024
  p.current = l;
1067
- let m = B(r);
1025
+ let m = U(r);
1068
1026
  m.current = r;
1069
- let [h, g] = V(() => n.flash?.errors ?? {}), [_, v] = V(n.flash?.formError), [y, b] = V(void 0), x = B(void 0), S = B(!1), C = L((e) => {
1027
+ let [h, g] = W(() => n.flash?.errors ?? {}), [_, v] = W(n.flash?.formError), [y, b] = W(void 0), x = U(void 0), S = U(!1), C = B((e) => {
1070
1028
  let t = m.current;
1071
1029
  if (t === void 0) return [];
1072
1030
  let n = d.current, r = e;
@@ -1075,97 +1033,97 @@ var jn = 15e3, J = async (e, t, n) => {
1075
1033
  } catch {
1076
1034
  r = e;
1077
1035
  }
1078
- let i = re(t, r, p.current).issues;
1036
+ let i = fe(t, r, p.current).issues;
1079
1037
  if (n.toInput === void 0) return i;
1080
1038
  let a = n.errorPath ?? {};
1081
1039
  return i.map((t) => {
1082
1040
  let n = a[t.path];
1083
- return n === void 0 ? (gr(e, t.path) !== void 0 || t.path.includes("."), t) : {
1041
+ return n === void 0 ? (cr(e, t.path) !== void 0 || t.path.includes("."), t) : {
1084
1042
  ...t,
1085
1043
  path: n
1086
1044
  };
1087
1045
  });
1088
- }, []), w = L((e) => {
1046
+ }, []), w = B((e) => {
1089
1047
  let t = { ...e ?? {} }, n = m.current;
1090
- if (n !== void 0) for (let e of be(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
1048
+ if (n !== void 0) for (let e of ke(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
1091
1049
  return t;
1092
- }, []), T = B(() => Promise.resolve());
1050
+ }, []), T = U(() => Promise.resolve());
1093
1051
  if (i.current === void 0) {
1094
1052
  let e = n.flash, t = e === void 0 ? w(n.defaults) : {
1095
1053
  ...w(n.defaults),
1096
1054
  ...e.values
1097
1055
  };
1098
- i.current = new Je({
1056
+ i.current = new rt({
1099
1057
  onSubmit: ({ value: e }) => T.current(e),
1100
1058
  defaultValues: t,
1101
1059
  validators: { onChange: ({ value: e }) => {
1102
1060
  let t = C(e);
1103
1061
  if (t.length === 0) return;
1104
1062
  let n = {};
1105
- for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = ye(e, p.current));
1063
+ for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = Oe(e, p.current));
1106
1064
  return { fields: n };
1107
1065
  } }
1108
1066
  });
1109
1067
  }
1110
1068
  let E = i.current, D = E;
1111
- R(() => D.mount(), [D]);
1112
- let O = n.subscribe ?? "all";
1113
- Ye(E.store, (e) => O === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
1114
- let ee = E.store.state.values, k = E.store.state, A = z(() => C(ee), [C, ee]), te = n.isLoading === !0, j = n.validate, M = j?.onChange ?? "afterTouched", N = j?.onBlur ?? !0, P = k.submissionAttempts, ne = k.fieldMetaBase ?? {}, F = L((e) => {
1115
- if (te) return !1;
1116
- if (P > 0 || M === "always") return !0;
1117
- if (M === "never") return !1;
1118
- let t = ne[e];
1119
- return t === void 0 ? !1 : N ? t.isBlurred === !0 : t.isTouched === !0;
1069
+ V(() => D.mount(), [D]);
1070
+ let ee = n.subscribe ?? "all";
1071
+ it(E.store, (e) => ee === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
1072
+ let O = E.store.state.values, k = E.store.state, A = H(() => C(O), [C, O]), j = n.isLoading === !0, M = n.validate, N = M?.onChange ?? "afterTouched", te = M?.onBlur ?? !0, P = k.submissionAttempts, F = k.fieldMetaBase ?? {}, ne = B((e) => {
1073
+ if (j) return !1;
1074
+ if (P > 0 || N === "always") return !0;
1075
+ if (N === "never") return !1;
1076
+ let t = F[e];
1077
+ return t === void 0 ? !1 : te ? t.isBlurred === !0 : t.isTouched === !0;
1120
1078
  }, [
1121
1079
  P,
1122
- ne,
1123
- te,
1124
- M,
1125
- N
1126
- ]), ie = L((e) => {
1080
+ F,
1081
+ j,
1082
+ N,
1083
+ te
1084
+ ]), I = B((e) => {
1127
1085
  let t = h[e];
1128
1086
  if (t !== void 0) return t;
1129
1087
  let n = u.current?.[e];
1130
- if (n !== void 0 && n.status === "invalid") return n.message ?? ye({
1088
+ if (n !== void 0 && n.status === "invalid") return n.message ?? Oe({
1131
1089
  id: "validation.invalid",
1132
1090
  fallback: "Invalid value"
1133
1091
  }, p.current);
1134
- if (!F(e)) return;
1092
+ if (!ne(e)) return;
1135
1093
  let r = A.find((t) => t.path === e);
1136
- return r === void 0 ? void 0 : ye(r, p.current);
1094
+ return r === void 0 ? void 0 : Oe(r, p.current);
1137
1095
  }, [
1138
1096
  h,
1139
- F,
1097
+ ne,
1140
1098
  A
1141
- ]), ae = z(() => {
1099
+ ]), L = H(() => {
1142
1100
  let e = {}, t = /* @__PURE__ */ new Set([...A.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(h)]);
1143
1101
  for (let [e, n] of Object.entries(u.current ?? {})) n.status === "invalid" && t.add(e);
1144
1102
  for (let n of t) {
1145
- let t = ie(n);
1103
+ let t = I(n);
1146
1104
  t !== void 0 && (e[n] = t);
1147
1105
  }
1148
1106
  return e;
1149
1107
  }, [
1150
1108
  A,
1151
1109
  h,
1152
- ie
1153
- ]), oe = L((e) => {
1110
+ I
1111
+ ]), R = B((e) => {
1154
1112
  g((t) => {
1155
1113
  if (!(e in t)) return t;
1156
1114
  let n = { ...t };
1157
1115
  return delete n[e], n;
1158
1116
  });
1159
- }, []), se = L((n) => {
1160
- let r = yr(o, n), i = D.getFieldMeta(n), a = ie(n), s = _r(e, t, n), c = u.current?.[n], l = [a === void 0 ? void 0 : `${s}-error`, r?.description === void 0 ? void 0 : `${s}-help`].filter((e) => e !== void 0);
1117
+ }, []), z = B((n) => {
1118
+ let r = dr(o, n), i = D.getFieldMeta(n), a = I(n), s = lr(e, t, n), c = u.current?.[n], l = [a === void 0 ? void 0 : `${s}-error`, r?.description === void 0 ? void 0 : `${s}-help`].filter((e) => e !== void 0);
1161
1119
  return {
1162
1120
  value: D.getFieldValue(n),
1163
1121
  setValue: (e) => {
1164
- oe(n), !Object.is(D.getFieldValue(n), e) && D.setFieldValue(n, e);
1122
+ R(n), !Object.is(D.getFieldValue(n), e) && D.setFieldValue(n, e);
1165
1123
  },
1166
1124
  onBlur: () => {
1167
1125
  D.setFieldMeta(n, (e) => ({
1168
- ...vr,
1126
+ ...ur,
1169
1127
  ...e ?? {},
1170
1128
  isTouched: !0,
1171
1129
  isBlurred: !0
@@ -1192,12 +1150,12 @@ var jn = 15e3, J = async (e, t, n) => {
1192
1150
  }, [
1193
1151
  e,
1194
1152
  t,
1195
- oe,
1153
+ R,
1196
1154
  D,
1197
1155
  o,
1198
1156
  h,
1199
- ie
1200
- ]), ce = L((e) => ({
1157
+ I
1158
+ ]), re = B((e) => ({
1201
1159
  items: D.getFieldValue(e) ?? [],
1202
1160
  push: (t) => {
1203
1161
  D.pushFieldValue(e, t);
@@ -1214,14 +1172,14 @@ var jn = 15e3, J = async (e, t, n) => {
1214
1172
  swap: (t, n) => {
1215
1173
  D.swapFieldValues(e, t, n);
1216
1174
  },
1217
- field: (t, n) => se(`${e}.${t}.${n}`)
1218
- }), [D, se]), le = L((e) => o.filter((t) => t.section === e), [o]), ue = L((e, t) => {
1219
- oe(e), !Object.is(D.getFieldValue(e), t) && D.setFieldValue(e, t);
1220
- }, [oe, D]), de = L((e) => {
1175
+ field: (t, n) => z(`${e}.${t}.${n}`)
1176
+ }), [D, z]), ie = B((e) => o.filter((t) => t.section === e), [o]), ae = B((e, t) => {
1177
+ R(e), !Object.is(D.getFieldValue(e), t) && D.setFieldValue(e, t);
1178
+ }, [R, D]), oe = B((e) => {
1221
1179
  for (let [t, n] of Object.entries(e)) D.setFieldValue(t, n);
1222
- }, [D]), fe = L((e) => {
1180
+ }, [D]), se = B((e) => {
1223
1181
  g({}), v(void 0), b(void 0), x.current = void 0, S.current = !1, e === void 0 ? D.reset() : D.reset(w(e));
1224
- }, [D, w]), pe = n.asyncTimeoutMs ?? 5e3, me = L(async () => {
1182
+ }, [D, w]), ce = n.asyncTimeoutMs ?? 5e3, le = B(async () => {
1225
1183
  let e = Date.now();
1226
1184
  for (;;) {
1227
1185
  let t = u.current;
@@ -1229,23 +1187,23 @@ var jn = 15e3, J = async (e, t, n) => {
1229
1187
  let n = Object.entries(t), r = n.filter(([, e]) => e.status === "checking");
1230
1188
  if (r.length === 0) {
1231
1189
  let e = n.filter(([, e]) => e.status === "invalid");
1232
- return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ?? ye({
1190
+ return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ?? Oe({
1233
1191
  id: "validation.invalid",
1234
1192
  fallback: "Invalid value"
1235
1193
  }, p.current)]));
1236
1194
  }
1237
- if (Date.now() - e > pe) return Object.fromEntries(r.map(([e]) => [e, ye({
1195
+ if (Date.now() - e > ce) return Object.fromEntries(r.map(([e]) => [e, Oe({
1238
1196
  id: "validation.checking",
1239
1197
  fallback: "Still checking…"
1240
1198
  }, p.current)]));
1241
1199
  await new Promise((e) => setTimeout(e, 50));
1242
1200
  }
1243
- }, [pe]), he = L(() => {
1201
+ }, [ce]), ue = B(() => {
1244
1202
  let n = globalThis.document;
1245
1203
  if (n?.getElementById === void 0) return;
1246
1204
  let r = [...o.map((e) => e.name), ...Object.keys(h).filter((e) => !o.some((t) => t.name === e))];
1247
- for (let i of r) if (ie(i) !== void 0) {
1248
- n.getElementById(_r(e, t, i))?.focus?.();
1205
+ for (let i of r) if (I(i) !== void 0) {
1206
+ n.getElementById(lr(e, t, i))?.focus?.();
1249
1207
  return;
1250
1208
  }
1251
1209
  }, [
@@ -1253,17 +1211,17 @@ var jn = 15e3, J = async (e, t, n) => {
1253
1211
  t,
1254
1212
  o,
1255
1213
  h,
1256
- ie
1257
- ]), ge = B(he);
1258
- ge.current = he;
1259
- let _e = L(async () => {
1214
+ I
1215
+ ]), de = U(ue);
1216
+ de.current = ue;
1217
+ let pe = B(async () => {
1260
1218
  v(void 0), g({}), b(void 0), x.current = void 0, S.current = !1;
1261
1219
  let e, t = !1;
1262
1220
  if (await D.handleSubmit().catch((n) => {
1263
1221
  t = !0, e = n;
1264
1222
  }), t) throw e;
1265
1223
  return S.current || queueMicrotask(() => {
1266
- ge.current();
1224
+ de.current();
1267
1225
  }), x.current;
1268
1226
  }, [D]);
1269
1227
  T.current = (async (e) => {
@@ -1276,22 +1234,22 @@ var jn = 15e3, J = async (e, t, n) => {
1276
1234
  }
1277
1235
  if (C(n).length > 0) {
1278
1236
  queueMicrotask(() => {
1279
- ge.current();
1237
+ de.current();
1280
1238
  });
1281
1239
  return;
1282
1240
  }
1283
1241
  let i = m.current;
1284
1242
  if (i !== void 0) {
1285
- let e = Se(i, r);
1243
+ let e = je(i, r);
1286
1244
  e.dropped.length > 0 && process.env.NODE_ENV !== "production" && console.warn(`[@voltro/client] useFormBinding: dropped ${e.dropped.length} value(s) the mutation's input does not declare (${e.dropped.join(", ")}). The server refuses undeclared fields, so they are not sent. Map them with \`toInput\` if they belong in the write; ignore this if they are form-only state.`), r = e.input;
1287
1245
  }
1288
- let a = await me();
1246
+ let a = await le();
1289
1247
  if (a !== void 0) {
1290
1248
  g((e) => ({
1291
1249
  ...e,
1292
1250
  ...a
1293
1251
  })), queueMicrotask(() => {
1294
- ge.current();
1252
+ de.current();
1295
1253
  });
1296
1254
  return;
1297
1255
  }
@@ -1307,13 +1265,13 @@ var jn = 15e3, J = async (e, t, n) => {
1307
1265
  });
1308
1266
  x.current = e, S.current = !0, t.onSuccess?.(e);
1309
1267
  } catch (e) {
1310
- let t = Ve(e);
1268
+ let t = Ze(e);
1311
1269
  if (t.length === 0) {
1312
1270
  b(e), d.current.onError?.(e);
1313
1271
  return;
1314
1272
  }
1315
1273
  let n = {};
1316
- for (let e of t) e.field in n || (n[e.field] = ye({
1274
+ for (let e of t) e.field in n || (n[e.field] = Oe({
1317
1275
  id: e.message,
1318
1276
  ...e.params === void 0 ? {} : { params: e.params },
1319
1277
  fallback: e.message
@@ -1322,78 +1280,78 @@ var jn = 15e3, J = async (e, t, n) => {
1322
1280
  ...e,
1323
1281
  ...n
1324
1282
  })), queueMicrotask(() => {
1325
- ge.current();
1283
+ de.current();
1326
1284
  });
1327
1285
  }
1328
1286
  });
1329
- let ve = A.length === 0, xe = Object.values(u.current ?? {}).some((e) => e.status === "checking"), I = y ?? a?.error, Ce = I !== void 0 && Ve(I).length > 0 ? void 0 : I, we = Object.keys(ae).length, Te = (() => {
1330
- for (let e of o) if (ae[e.name] !== void 0) return e.name;
1331
- let e = Object.keys(ae);
1287
+ let me = A.length === 0, he = Object.values(u.current ?? {}).some((e) => e.status === "checking"), ge = y ?? a?.error, _e = ge !== void 0 && Ze(ge).length > 0 ? void 0 : ge, ve = Object.keys(L).length, ye = (() => {
1288
+ for (let e of o) if (L[e.name] !== void 0) return e.name;
1289
+ let e = Object.keys(L);
1332
1290
  return e.length > 0 ? e[0] : void 0;
1333
- })(), Ee = {
1334
- isDirty: !te && k.isDirty,
1291
+ })(), be = {
1292
+ isDirty: !j && k.isDirty,
1335
1293
  isPristine: k.isPristine,
1336
1294
  isTouched: k.isTouched,
1337
- isValid: ve,
1338
- isValidating: xe,
1339
- canSubmit: ve && !xe && !k.isSubmitting && !te,
1295
+ isValid: me,
1296
+ isValidating: he,
1297
+ canSubmit: me && !he && !k.isSubmitting && !j,
1340
1298
  isSubmitting: k.isSubmitting,
1341
1299
  isSubmitted: k.isSubmitted,
1342
1300
  isSubmitSuccessful: k.isSubmitSuccessful && S.current,
1343
1301
  submissionAttempts: k.submissionAttempts,
1344
- errorCount: we,
1345
- firstInvalidPath: Te,
1302
+ errorCount: ve,
1303
+ firstInvalidPath: ye,
1346
1304
  pending: a?.pending ?? k.isSubmitting,
1347
- isLoading: te,
1348
- submitError: Ce,
1305
+ isLoading: j,
1306
+ submitError: _e,
1349
1307
  data: a?.data ?? x.current
1350
- }, H = {
1308
+ }, xe = {
1351
1309
  fields: o,
1352
- values: ee,
1353
- errors: ae,
1310
+ values: O,
1311
+ errors: L,
1354
1312
  issues: A,
1355
- isValid: ve,
1313
+ isValid: me,
1356
1314
  pending: a?.pending ?? k.isSubmitting,
1357
- submitError: Ce,
1315
+ submitError: _e,
1358
1316
  formError: _,
1359
1317
  data: a?.data ?? x.current,
1360
- setValue: ue,
1361
- setValues: de,
1362
- reset: fe,
1363
- submit: _e,
1364
- field: se,
1365
- array: ce,
1366
- section: le,
1367
- state: Ee,
1368
- focusFirstInvalid: he
1318
+ setValue: ae,
1319
+ setValues: oe,
1320
+ reset: se,
1321
+ submit: pe,
1322
+ field: z,
1323
+ array: re,
1324
+ section: ie,
1325
+ state: be,
1326
+ focusFirstInvalid: ue
1369
1327
  };
1370
- return Object.defineProperty(H, mr, {
1328
+ return Object.defineProperty(xe, or, {
1371
1329
  value: {
1372
1330
  store: E.store,
1373
- field: se
1331
+ field: z
1374
1332
  },
1375
1333
  enumerable: !1
1376
- }), H;
1377
- }, Cr = (e) => Ce(hr.Provider, { value: e.binding }, e.children), wr = () => we(hr);
1378
- function Tr(e, t) {
1379
- let n = we(hr), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
1334
+ }), xe;
1335
+ }, hr = (e) => Ne(sr.Provider, { value: e.binding }, e.children), gr = () => Pe(sr);
1336
+ function _r(e, t) {
1337
+ let n = Pe(sr), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
1380
1338
  if (a === void 0) throw Error("useFormField(path) found no form binding — mount <FormBindingProvider binding={form}> above this field, or call useFormField(form, path) with the binding in hand.");
1381
- let o = a[mr];
1339
+ let o = a[or];
1382
1340
  if (o === void 0) throw Error("useFormField: not a useFormBinding result");
1383
- return Ye(o.store, (e) => {
1341
+ return it(o.store, (e) => {
1384
1342
  let t = e.fieldMetaBase[i];
1385
- return `${JSON.stringify(gr(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
1343
+ return `${JSON.stringify(cr(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
1386
1344
  }), o.field(i);
1387
1345
  }
1388
1346
  //#endregion
1389
1347
  //#region src/connectionPrerequisite.ts
1390
- var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:connection-setup-superseded" ? "superseded" : "inactive", Z = class extends Error {
1348
+ var vr = "voltro:connection-setup-superseded", yr = (e) => e.reason === "voltro:connection-setup-superseded" ? "superseded" : "inactive", Z = class extends Error {
1391
1349
  reason;
1392
1350
  _tag = "ConnectionPrerequisiteInvalidated";
1393
1351
  constructor(e) {
1394
- super(`Voltro connection prerequisite: ${e}`), this.reason = e, x(this, e === "connection-unavailable" || e === "connection-changed" ? "transport" : "client");
1352
+ super(`Voltro connection prerequisite: ${e}`), this.reason = e, T(this, e === "connection-unavailable" || e === "connection-changed" ? "transport" : "client");
1395
1353
  }
1396
- }, Or = class {
1354
+ }, br = class {
1397
1355
  #e;
1398
1356
  #t;
1399
1357
  #n = /* @__PURE__ */ new WeakMap();
@@ -1403,15 +1361,15 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1403
1361
  this.#e = e, this.#t = t;
1404
1362
  }
1405
1363
  prepare(e, t) {
1406
- let n = k(e)?.getSnapshot();
1407
- if (this.#e.aborted) return Promise.reject(new Z(Dr(this.#e)));
1364
+ let n = R(e)?.getSnapshot();
1365
+ if (this.#e.aborted) return Promise.reject(new Z(yr(this.#e)));
1408
1366
  if (n === void 0) return Promise.reject(new Z("connection-unavailable"));
1409
1367
  let r = this.#n.get(n);
1410
1368
  if (r !== void 0) return r.then((t) => (this.assertCurrent(e, t), t));
1411
- let i = this.#a(e, n, t).pipe(U.timeoutFail({
1369
+ let i = this.#a(e, n, t).pipe(K.timeoutFail({
1412
1370
  duration: this.#t,
1413
1371
  onTimeout: () => new Z("timeout")
1414
- })), a = f(e, i).then((t) => {
1372
+ })), a = S(e, i).then((t) => {
1415
1373
  let r = Object.freeze({
1416
1374
  lease: n,
1417
1375
  output: t
@@ -1423,33 +1381,33 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1423
1381
  }), a;
1424
1382
  }
1425
1383
  assertCurrent(e, t) {
1426
- if (!this.#r.has(t)) throw new Z(Dr(this.#e));
1384
+ if (!this.#r.has(t)) throw new Z(yr(this.#e));
1427
1385
  this.#i(e, t.lease);
1428
1386
  }
1429
1387
  #i(e, t) {
1430
- if (this.#e.aborted) throw new Z(Dr(this.#e));
1431
- if (t.signal.aborted || k(e)?.getSnapshot() !== t) throw new Z("connection-changed");
1388
+ if (this.#e.aborted) throw new Z(yr(this.#e));
1389
+ if (t.signal.aborted || R(e)?.getSnapshot() !== t) throw new Z("connection-changed");
1432
1390
  }
1433
1391
  run(e, t, n) {
1434
- let r = U.try({
1392
+ let r = K.try({
1435
1393
  try: () => this.assertCurrent(e, t),
1436
1394
  catch: (e) => e
1437
- }).pipe(U.zipRight(n));
1438
- return f(e, this.#a(e, t.lease, r));
1395
+ }).pipe(K.zipRight(n));
1396
+ return S(e, this.#a(e, t.lease, r));
1439
1397
  }
1440
1398
  #a(e, t, n) {
1441
- let r = U.try({
1399
+ let r = K.try({
1442
1400
  try: () => this.#i(e, t),
1443
1401
  catch: (e) => e
1444
- }), i = U.async((e) => {
1445
- let n = () => e(U.fail(new Z(this.#e.aborted ? Dr(this.#e) : "connection-changed")));
1446
- return this.#e.addEventListener("abort", n, { once: !0 }), t.signal.addEventListener("abort", n, { once: !0 }), (this.#e.aborted || t.signal.aborted) && n(), U.sync(() => {
1402
+ }), i = K.async((e) => {
1403
+ let n = () => e(K.fail(new Z(this.#e.aborted ? yr(this.#e) : "connection-changed")));
1404
+ return this.#e.addEventListener("abort", n, { once: !0 }), t.signal.addEventListener("abort", n, { once: !0 }), (this.#e.aborted || t.signal.aborted) && n(), K.sync(() => {
1447
1405
  this.#e.removeEventListener("abort", n), t.signal.removeEventListener("abort", n);
1448
1406
  });
1449
1407
  });
1450
- return r.pipe(U.zipRight(n), U.tap(() => r), U.raceFirst(i));
1408
+ return r.pipe(K.zipRight(n), K.tap(() => r), K.raceFirst(i));
1451
1409
  }
1452
- }, kr = class {
1410
+ }, xr = class {
1453
1411
  #e;
1454
1412
  #t;
1455
1413
  #n;
@@ -1464,7 +1422,7 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1464
1422
  #s;
1465
1423
  handle;
1466
1424
  constructor(e, t, n) {
1467
- this.#e = e, this.#t = t, this.#n = n, this.handle = Hn(e, { capture: () => this.#f() });
1425
+ this.#e = e, this.#t = t, this.#n = n, this.handle = Pn(e, { capture: () => this.#f() });
1468
1426
  }
1469
1427
  getSnapshot = () => this.#a;
1470
1428
  subscribe = (e) => (this.#r.add(e), () => {
@@ -1472,7 +1430,7 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1472
1430
  });
1473
1431
  clear = (e = !1) => {
1474
1432
  let t = this.#i;
1475
- this.#i = void 0, this.#s = void 0, t?.detachSubject?.(), t?.controller.abort(e ? Er : void 0), this.#h({
1433
+ this.#i = void 0, this.#s = void 0, t?.detachSubject?.(), t?.controller.abort(e ? vr : void 0), this.#h({
1476
1434
  status: "idle",
1477
1435
  data: void 0,
1478
1436
  error: void 0
@@ -1482,11 +1440,11 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1482
1440
  this.clear(!0);
1483
1441
  let n = new AbortController(), r = {
1484
1442
  input: e,
1485
- key: D(),
1443
+ key: ae(),
1486
1444
  controller: n,
1487
1445
  subject: void 0,
1488
1446
  detachSubject: void 0,
1489
- prerequisite: new Or(n.signal, this.#c(this.#n()).options.replayWindowMs),
1447
+ prerequisite: new br(n.signal, this.#c(this.#n()).options.replayWindowMs),
1490
1448
  established: !1
1491
1449
  };
1492
1450
  this.#i = r, this.#h({
@@ -1506,7 +1464,7 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1506
1464
  }
1507
1465
  }
1508
1466
  watch(e) {
1509
- let t = k(e.runtime), n = () => {
1467
+ let t = R(e.runtime), n = () => {
1510
1468
  let n = this.#i;
1511
1469
  if (n === void 0 || !n.established || this.#n().runtime !== e.runtime) return;
1512
1470
  if (n.subject !== this.#c(e).subjectSignal) {
@@ -1523,10 +1481,10 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1523
1481
  return n(), t?.subscribe(n) ?? (() => {});
1524
1482
  }
1525
1483
  #c(e) {
1526
- return e.recovery ?? E(e.errorBus, this.#e);
1484
+ return e.recovery ?? c(e.errorBus, this.#e);
1527
1485
  }
1528
1486
  #l(e) {
1529
- if (this.#i !== e || e.controller.signal.aborted) throw new Z(Dr(e.controller.signal));
1487
+ if (this.#i !== e || e.controller.signal.aborted) throw new Z(yr(e.controller.signal));
1530
1488
  }
1531
1489
  #u(e, t, n) {
1532
1490
  this.#l(e);
@@ -1549,32 +1507,32 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1549
1507
  if (e === void 0) throw new Z("inactive");
1550
1508
  return { prepare: async (t, n) => {
1551
1509
  let r = await this.#p(e, t, n);
1552
- return { run: (i) => e.prerequisite.run(t, r, U.try({
1510
+ return { run: (i) => e.prerequisite.run(t, r, K.try({
1553
1511
  try: () => this.#u(e, t, n),
1554
1512
  catch: (e) => e
1555
- }).pipe(U.zipRight(i))) };
1513
+ }).pipe(K.zipRight(i))) };
1556
1514
  } };
1557
1515
  }
1558
1516
  async #p(e, t, n) {
1559
1517
  let r = this.#u(e, t, n), i = r.descriptors[this.#t];
1560
1518
  if (i?.kind !== "mutation" || i.idempotencyScope !== "connection") throw Error(`Voltro: useConnectionSetup("${this.#t}") requires a mutation declaring idempotencyScope: 'connection'`);
1561
1519
  this.#d(e, r), this.#l(e);
1562
- let a = k(t);
1520
+ let a = R(t);
1563
1521
  if (a === void 0) throw new Z("connection-unavailable");
1564
1522
  if (a.getSnapshot() === void 0) {
1565
- let n = U.async((t) => {
1523
+ let n = K.async((t) => {
1566
1524
  let n = () => {
1567
1525
  let n = a.getSnapshot();
1568
- e.controller.signal.aborted ? t(U.fail(new Z(Dr(e.controller.signal)))) : n !== void 0 && t(U.succeed(n));
1526
+ e.controller.signal.aborted ? t(K.fail(new Z(yr(e.controller.signal)))) : n !== void 0 && t(K.succeed(n));
1569
1527
  }, r = a.subscribe(n);
1570
- return e.controller.signal.addEventListener("abort", n, { once: !0 }), n(), U.sync(() => {
1528
+ return e.controller.signal.addEventListener("abort", n, { once: !0 }), n(), K.sync(() => {
1571
1529
  r(), e.controller.signal.removeEventListener("abort", n);
1572
1530
  });
1573
- }).pipe(U.timeoutFail({
1531
+ }).pipe(K.timeoutFail({
1574
1532
  duration: this.#c(r).options.replayWindowMs,
1575
1533
  onTimeout: () => new Z("timeout")
1576
1534
  }));
1577
- await f(t, n);
1535
+ await S(t, n);
1578
1536
  }
1579
1537
  this.#u(e, t, n);
1580
1538
  let o = a.getSnapshot();
@@ -1593,39 +1551,39 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1593
1551
  }), n;
1594
1552
  }
1595
1553
  }
1596
- #m(t, n) {
1597
- return U.suspend(() => {
1598
- let r = `setup_${t.key}_${++this.#o}`;
1599
- return Ln({
1600
- id: r,
1554
+ #m(e, t) {
1555
+ return K.suspend(() => {
1556
+ let n = `setup_${e.key}_${++this.#o}`;
1557
+ return kn({
1558
+ id: n,
1601
1559
  apiName: this.#e,
1602
1560
  tag: this.#t,
1603
- input: t.input
1604
- }), U.suspend(() => {
1605
- this.#u(t, n.runtime, n.client);
1606
- let e = T(n.client, this.#t);
1607
- return y(e(t.input), t.key);
1608
- }).pipe(U.withSpan(`client.connectionSetup.${this.#t}`)).pipe(U.onExit((t) => U.sync(() => {
1609
- if (ke.isSuccess(t)) X(r, {
1561
+ input: e.input
1562
+ }), K.suspend(() => {
1563
+ this.#u(e, t.runtime, t.client);
1564
+ let n = v(t.client, this.#t);
1565
+ return z(n(e.input), e.key);
1566
+ }).pipe(K.withSpan(`client.connectionSetup.${this.#t}`)).pipe(K.onExit((e) => K.sync(() => {
1567
+ if (ze.isSuccess(e)) X(n, {
1610
1568
  status: "success",
1611
- output: t.value
1612
- }), n.errorBus.emitSuccess({
1569
+ output: e.value
1570
+ }), t.errorBus.emitSuccess({
1613
1571
  source: "mutation",
1614
1572
  tag: this.#t
1615
1573
  });
1616
1574
  else {
1617
- let i = o(t.cause);
1618
- if (X(r, {
1575
+ let r = i(e.cause);
1576
+ if (X(n, {
1619
1577
  status: "error",
1620
- error: i
1621
- }), !De.isInterruptedOnly(t.cause)) {
1622
- let t = e(i, "handler");
1623
- n.errorBus.emit({
1578
+ error: r
1579
+ }), !Le.isInterruptedOnly(e.cause)) {
1580
+ let e = o(r, "handler");
1581
+ t.errorBus.emit({
1624
1582
  source: "mutation",
1625
1583
  tag: this.#t,
1626
- error: i,
1627
- kind: t,
1628
- outcome: t === "transport" ? "unknown" : "known"
1584
+ error: r,
1585
+ kind: e,
1586
+ outcome: e === "transport" ? "unknown" : "known"
1629
1587
  });
1630
1588
  }
1631
1589
  }
@@ -1640,151 +1598,151 @@ var Er = "voltro:connection-setup-superseded", Dr = (e) => e.reason === "voltro:
1640
1598
  } catch {}
1641
1599
  }
1642
1600
  }
1643
- }, Ar = (e, t) => {
1644
- let n = K(e), r = B(n);
1601
+ }, Sr = (e, t) => {
1602
+ let n = k(e), r = U(n);
1645
1603
  r.current = n;
1646
- let i = z(() => new kr(e, t, () => r.current), [e, t]), a = L((n) => i.activate(n, () => J(r, e, t)), [
1604
+ let i = H(() => new xr(e, t, () => r.current), [e, t]), a = B((n) => i.activate(n, () => N(r, e, t)), [
1647
1605
  i,
1648
1606
  e,
1649
1607
  t
1650
- ]), o = H(i.subscribe, i.getSnapshot, i.getSnapshot);
1651
- return R(() => i.watch(r.current), [
1608
+ ]), o = G(i.subscribe, i.getSnapshot, i.getSnapshot);
1609
+ return V(() => i.watch(r.current), [
1652
1610
  i,
1653
1611
  n.runtime,
1654
1612
  n.client,
1655
1613
  n.recovery
1656
- ]), R(() => () => i.clear(), [i]), {
1614
+ ]), V(() => () => i.clear(), [i]), {
1657
1615
  ...o,
1658
1616
  handle: i.handle,
1659
1617
  activate: a,
1660
1618
  clear: i.clear,
1661
1619
  ready: o.status === "ready"
1662
1620
  };
1663
- }, jr = q, Mr = (e) => ({
1664
- useSubscription: (t, n, r) => jr(e, t, n, r),
1665
- useMutation: (t) => ar(e, t),
1666
- useConnectionSetup: (t) => Ar(e, t),
1667
- useAction: (t) => ur(e, t),
1668
- useFormBinding: (t, n) => br(e, t, n ?? {})
1669
- }), Nr = () => ({ seeds: [] }), Pr = null, Fr = (e) => {
1670
- Pr = e;
1671
- }, Ir = /* @__PURE__ */ new Map(), Lr = (e, t) => `${e}\u0000${t}`, Rr = (e, t, n, r) => {
1672
- let i = Pr?.() ?? null;
1621
+ }, Cr = J, wr = (e) => ({
1622
+ useSubscription: (t, n, r) => Cr(e, t, n, r),
1623
+ useMutation: (t) => Zn(e, t),
1624
+ useConnectionSetup: (t) => Sr(e, t),
1625
+ useAction: (t) => nr(e, t),
1626
+ useFormBinding: (t, n) => fr(e, t, n ?? {})
1627
+ }), Tr = () => ({ seeds: [] }), Er = null, Dr = (e) => {
1628
+ Er = e;
1629
+ }, Or = /* @__PURE__ */ new Map(), kr = (e, t) => `${e}\u0000${t}`, Ar = (e, t, n, r) => {
1630
+ let i = Er?.() ?? null;
1673
1631
  if (i === null) throw Error(`seedPreloadedSubscription('${e}', '${t}') was called outside a server render. Preload seeds exist to put a subscription's first value into the SSR hydration payload; on the client the live subscription already provides it. (If this IS server code, the render did not install a seed bag — that is a framework bug.)`);
1674
1632
  i.seeds.push({
1675
1633
  api: e,
1676
- key: j([t, n]),
1634
+ key: f([t, n]),
1677
1635
  value: r
1678
1636
  });
1679
- }, zr = (e, t, n) => {
1680
- let r = Pr?.() ?? null;
1637
+ }, jr = (e, t, n) => {
1638
+ let r = Er?.() ?? null;
1681
1639
  r !== null && r.seeds.push({
1682
1640
  api: e,
1683
- key: j([t, n]),
1641
+ key: f([t, n]),
1684
1642
  value: void 0,
1685
1643
  failed: !0
1686
1644
  });
1687
- }, Br = (e) => {
1688
- if (e !== void 0) for (let t of e) Ir.set(Lr(t.api, t.key), {
1645
+ }, Mr = (e) => {
1646
+ if (e !== void 0) for (let t of e) Or.set(kr(t.api, t.key), {
1689
1647
  value: t.value,
1690
1648
  failed: t.failed === !0
1691
1649
  });
1692
- }, Vr = (e, t, n) => {
1693
- let r = j([t, n]), i = Pr?.() ?? null;
1650
+ }, Nr = (e, t, n) => {
1651
+ let r = f([t, n]), i = Er?.() ?? null;
1694
1652
  if (i !== null) {
1695
1653
  for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
1696
1654
  return;
1697
1655
  }
1698
- let a = Ir.get(Lr(e, r));
1656
+ let a = Or.get(kr(e, r));
1699
1657
  return a === void 0 || a.failed ? void 0 : a.value;
1700
- }, Hr = (e, t, n) => {
1701
- let r = j([t, n]), i = Pr?.() ?? null;
1658
+ }, Pr = (e, t, n) => {
1659
+ let r = f([t, n]), i = Er?.() ?? null;
1702
1660
  if (i !== null) {
1703
1661
  for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
1704
1662
  return "absent";
1705
1663
  }
1706
- let a = Ir.get(Lr(e, r));
1664
+ let a = Or.get(kr(e, r));
1707
1665
  return a === void 0 ? "absent" : a.failed ? "failed" : "seeded";
1708
- }, Ur = () => {
1709
- Ir.clear();
1666
+ }, Fr = () => {
1667
+ Or.clear();
1710
1668
  };
1711
1669
  //#endregion
1712
1670
  //#region src/usePreloadedSubscription.ts
1713
- function Wr(e, t, n = {}, r = {}) {
1714
- let i = Vr(e, t, n), a = q(e, t, n, i === void 0 ? r : {
1671
+ function Ir(e, t, n = {}, r = {}) {
1672
+ let i = Nr(e, t, n), a = J(e, t, n, i === void 0 ? r : {
1715
1673
  ...r,
1716
1674
  initialSnapshot: i
1717
1675
  });
1718
- return Hr(e, t, n) === "failed" ? {
1676
+ return Pr(e, t, n) === "failed" ? {
1719
1677
  ...a,
1720
1678
  preloadFailed: !0
1721
1679
  } : a;
1722
1680
  }
1723
1681
  //#endregion
1724
1682
  //#region src/useEvent.ts
1725
- var Gr = {
1683
+ var Lr = {
1726
1684
  status: "idle",
1727
1685
  missed: 0,
1728
1686
  lastMiss: void 0
1729
- }, Kr = class {
1687
+ }, Rr = class {
1730
1688
  _tag = "EventStreamClosed";
1731
1689
  };
1732
- function qr(e, t, r, i = {}) {
1733
- let { skip: a = !1, apiName: o = "app", onMissed: s } = i, c = K(o), { runtime: l, client: u } = c, [d, f] = V(Gr), p = B(r);
1734
- p.current = r;
1735
- let m = B(s);
1690
+ function zr(e, t, n, r = {}) {
1691
+ let { skip: i = !1, apiName: o = "app", onMissed: s } = r, c = k(o), { runtime: l, client: u } = c, [d, f] = W(Lr), p = U(n);
1692
+ p.current = n;
1693
+ let m = U(s);
1736
1694
  m.current = s;
1737
- let h = B(u);
1695
+ let h = U(u);
1738
1696
  h.current = u;
1739
- let g = B(l);
1697
+ let g = U(l);
1740
1698
  g.current = l;
1741
- let _ = B(/* @__PURE__ */ new Map()), v = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), y = B(t);
1742
- y.current = t;
1743
- let b = B(null);
1744
- b.current !== v && (b.current = v, _.current = /* @__PURE__ */ new Map());
1745
- let x = L((t, r) => {
1746
- t <= 0 || (n(o, "event.gap", {
1699
+ let _ = U(/* @__PURE__ */ new Map()), y = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), b = U(t);
1700
+ b.current = t;
1701
+ let x = U(null);
1702
+ x.current !== y && (x.current = y, _.current = /* @__PURE__ */ new Map());
1703
+ let S = B((t, n) => {
1704
+ t <= 0 || (a(o, "event.gap", {
1747
1705
  tag: e.name,
1748
1706
  missed: t,
1749
- reason: r
1707
+ reason: n
1750
1708
  }), f((e) => ({
1751
1709
  ...e,
1752
1710
  missed: e.missed + t,
1753
1711
  lastMiss: {
1754
1712
  count: t,
1755
- reason: r
1713
+ reason: n
1756
1714
  }
1757
1715
  })), m.current?.({
1758
1716
  count: t,
1759
- reason: r
1717
+ reason: n
1760
1718
  }));
1761
- }, [o, e.name]), S = !a && v !== null && !ft(c);
1762
- return R(() => {
1763
- if (!S) {
1764
- f(Gr);
1719
+ }, [o, e.name]), C = !i && y !== null && !te(c);
1720
+ return V(() => {
1721
+ if (!C) {
1722
+ f(Lr);
1765
1723
  return;
1766
1724
  }
1767
1725
  f((e) => ({
1768
1726
  ...e,
1769
1727
  status: "connecting"
1770
1728
  }));
1771
- let t = 0, n = U.sync(() => {
1729
+ let t = 0, n = K.sync(() => {
1772
1730
  let t = [..._.current].map(([e, t]) => ({
1773
1731
  origin: e,
1774
1732
  n: t
1775
1733
  }));
1776
- return T(h.current, e.name)({
1777
- key: y.current,
1734
+ return v(h.current, e.name)({
1735
+ key: b.current,
1778
1736
  ...t.length > 0 ? { resume: t } : {}
1779
1737
  });
1780
- }), r = W.unwrap(n).pipe(W.tap(() => U.sync(() => {
1738
+ }), r = q.unwrap(n).pipe(q.tap(() => K.sync(() => {
1781
1739
  t = 0;
1782
- })), W.concat(W.fail(new Kr())), W.retry(Me.exponential("250 millis", 2).pipe(Me.either(Me.spaced("30 seconds")), Me.jittered, Me.tapOutput(() => U.sync(() => {
1740
+ })), q.concat(q.fail(new Rr())), q.retry(He.exponential("250 millis", 2).pipe(He.either(He.spaced("30 seconds")), He.jittered, He.tapOutput(() => K.sync(() => {
1783
1741
  t += 1, f((e) => ({
1784
1742
  ...e,
1785
1743
  status: "connecting"
1786
1744
  }));
1787
- }))))), i = g.current.runFork(W.runForEach(r, (e) => U.sync(() => {
1745
+ }))))), i = g.current.runFork(q.runForEach(r, (e) => K.sync(() => {
1788
1746
  if (e._tag === "attached") {
1789
1747
  f((e) => ({
1790
1748
  ...e,
@@ -1793,7 +1751,7 @@ function qr(e, t, r, i = {}) {
1793
1751
  return;
1794
1752
  }
1795
1753
  if (e._tag === "gap") {
1796
- x(e.missed, e.reason);
1754
+ S(e.missed, e.reason);
1797
1755
  return;
1798
1756
  }
1799
1757
  _.current.set(e.origin, Math.max(_.current.get(e.origin) ?? 0, e.n)), p.current(e.payload);
@@ -1802,15 +1760,15 @@ function qr(e, t, r, i = {}) {
1802
1760
  g.current.runFork(i.interruptAsFork(i.id()));
1803
1761
  };
1804
1762
  }, [
1805
- S,
1806
- v,
1763
+ C,
1764
+ y,
1807
1765
  e.name,
1808
- x
1809
- ]), S ? d : Gr;
1766
+ S
1767
+ ]), C ? d : Lr;
1810
1768
  }
1811
1769
  //#endregion
1812
1770
  //#region src/sequence.ts
1813
- var Jr = () => {
1771
+ var Br = () => {
1814
1772
  let e = (t) => ({
1815
1773
  steps: t,
1816
1774
  step: ((n, r, i) => e([...t, {
@@ -1822,7 +1780,7 @@ var Jr = () => {
1822
1780
  }]))
1823
1781
  });
1824
1782
  return e([]);
1825
- }, Yr = async (e, t = {}) => {
1783
+ }, Vr = async (e, t = {}) => {
1826
1784
  let n = {}, r = [];
1827
1785
  for (let i of e.steps) {
1828
1786
  if (i.when !== void 0 && !i.when(n)) {
@@ -1882,13 +1840,13 @@ var Jr = () => {
1882
1840
  ok: !0,
1883
1841
  data: n
1884
1842
  };
1885
- }, Xr = (e = {}) => {
1886
- let [t, n] = V(!1), [r, i] = V(void 0), [a, o] = V(void 0), s = B(e);
1843
+ }, Hr = (e = {}) => {
1844
+ let [t, n] = W(!1), [r, i] = W(void 0), [a, o] = W(void 0), s = U(e);
1887
1845
  return s.current = e, {
1888
- run: L(async (e, t = {}) => {
1846
+ run: B(async (e, t = {}) => {
1889
1847
  n(!0), i(void 0), o(void 0);
1890
1848
  try {
1891
- let n = await Yr(e, {
1849
+ let n = await Vr(e, {
1892
1850
  ...s.current,
1893
1851
  ...t
1894
1852
  });
@@ -1901,7 +1859,7 @@ var Jr = () => {
1901
1859
  error: r,
1902
1860
  failedStep: a
1903
1861
  };
1904
- }, Zr = "@voltro/plugin-storage", Q = (e) => Ge(Zr, e), Qr = (e, t, n, r) => new Promise((i, a) => {
1862
+ }, Ur = "@voltro/plugin-storage", Q = (e) => et(Ur, e), Wr = (e, t, n, r) => new Promise((i, a) => {
1905
1863
  let o = new XMLHttpRequest();
1906
1864
  if (o.open("PUT", e), o.upload.onprogress = (e) => {
1907
1865
  e.lengthComputable && n(e.loaded / e.total);
@@ -1915,7 +1873,7 @@ var Jr = () => {
1915
1873
  return;
1916
1874
  }
1917
1875
  r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
1918
- }), $r = (e, t, n, r, i, a) => new Promise((o, s) => {
1876
+ }), Gr = (e, t, n, r, i, a) => new Promise((o, s) => {
1919
1877
  let c = new XMLHttpRequest();
1920
1878
  if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
1921
1879
  e.lengthComputable && r(e.loaded / e.total);
@@ -1933,7 +1891,7 @@ var Jr = () => {
1933
1891
  return;
1934
1892
  }
1935
1893
  i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
1936
- }), ei = (e, t, n, r, i) => new Promise((a, o) => {
1894
+ }), Kr = (e, t, n, r, i) => new Promise((a, o) => {
1937
1895
  let s = new XMLHttpRequest();
1938
1896
  if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
1939
1897
  e.lengthComputable && r(e.loaded / e.total);
@@ -1944,7 +1902,7 @@ var Jr = () => {
1944
1902
  return;
1945
1903
  }
1946
1904
  i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
1947
- }), ti = (e, t, n, r, i) => new Promise((a, o) => {
1905
+ }), qr = (e, t, n, r, i) => new Promise((a, o) => {
1948
1906
  let s = new XMLHttpRequest();
1949
1907
  if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
1950
1908
  e.lengthComputable && r(e.loaded / e.total);
@@ -1960,65 +1918,65 @@ var Jr = () => {
1960
1918
  return;
1961
1919
  }
1962
1920
  i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
1963
- }), ni = (t, n = {}) => {
1964
- let r = K(t), { inspectBaseUrl: i } = r, a = B(r);
1965
- a.current = r;
1966
- let [o, s] = V(0), [c, l] = V("idle"), [u, d] = V(void 0), p = B(null), m = L(() => {
1921
+ }), Jr = (e, t = {}) => {
1922
+ let n = k(e), { inspectBaseUrl: r } = n, i = U(n);
1923
+ i.current = n;
1924
+ let [a, s] = W(0), [c, l] = W("idle"), [u, d] = W(void 0), f = U(null), p = B(() => {
1967
1925
  s(0), l("idle"), d(void 0);
1968
- }, []), h = L(() => {
1969
- p.current?.abort();
1970
- }, []), g = L((e) => /^https?:\/\//.test(e) ? e : `${i}${e}`, [i]), _ = L(async (e, r, i, o) => {
1971
- let { runtime: s, client: c } = await J(a, t, "storage.upload").catch((e) => {
1972
- throw x(e, "client");
1973
- }), l = Math.max(0, r.retries ?? n.retries ?? 1), u = (e instanceof File, e.type || "application/octet-stream"), d = e instanceof File ? e.name : "blob", p = r.visibility ?? n.visibility, m = r.key ?? n.key, h = r.folder ?? n.folder, _ = r.tags ?? n.tags, v = {
1974
- ...p ? { visibility: p } : {},
1975
- ...h ? { folder: h } : {},
1976
- ..._ ? { tags: _ } : {},
1926
+ }, []), m = B(() => {
1927
+ f.current?.abort();
1928
+ }, []), h = B((e) => /^https?:\/\//.test(e) ? e : `${r}${e}`, [r]), g = B(async (n, r, a, o) => {
1929
+ let { runtime: s, client: c } = await N(i, e, "storage.upload").catch((e) => {
1930
+ throw T(e, "client");
1931
+ }), l = Math.max(0, r.retries ?? t.retries ?? 1), u = (n instanceof File, n.type || "application/octet-stream"), d = n instanceof File ? n.name : "blob", f = r.visibility ?? t.visibility, p = r.key ?? t.key, m = r.folder ?? t.folder, g = r.tags ?? t.tags, _ = {
1932
+ ...f ? { visibility: f } : {},
1933
+ ...m ? { folder: m } : {},
1934
+ ...g ? { tags: g } : {},
1977
1935
  ...r.alt ? { alt: r.alt } : {},
1978
1936
  ...r.caption ? { caption: r.caption } : {}
1979
1937
  }, y = (e) => ({
1980
1938
  id: e.id,
1981
- url: g(e.url),
1939
+ url: h(e.url),
1982
1940
  name: d,
1983
1941
  mime: e.contentType,
1984
1942
  size: e.size,
1985
1943
  ...e.width === void 0 ? {} : { width: e.width },
1986
1944
  ...e.height === void 0 ? {} : { height: e.height }
1987
1945
  }), b = async () => {
1988
- let t = r.mintTag ?? n.mintTag ?? Q("mintUploadTicket"), a = T(c, t), l = await f(s, a({
1946
+ let e = r.mintTag ?? t.mintTag ?? Q("mintUploadTicket"), i = v(c, e), l = await S(s, i({
1989
1947
  contentType: u,
1990
- ...v,
1991
- ...m ? { key: m } : {}
1992
- })), d = await ti(g(l.uploadUrl), u, e, o, i);
1948
+ ..._,
1949
+ ...p ? { key: p } : {}
1950
+ })), d = await qr(h(l.uploadUrl), u, n, o, a);
1993
1951
  return y(d);
1994
- }, S = async () => {
1995
- let t = r.presignMintTag ?? n.presignMintTag ?? Q("mintPresignedUpload"), a = r.finalizeTag ?? n.finalizeTag ?? Q("finalizeUpload"), l;
1952
+ }, x = async () => {
1953
+ let e = r.presignMintTag ?? t.presignMintTag ?? Q("mintPresignedUpload"), i = r.finalizeTag ?? t.finalizeTag ?? Q("finalizeUpload"), l;
1996
1954
  try {
1997
- let e = T(c, t);
1998
- l = await f(s, e({
1955
+ let t = v(c, e);
1956
+ l = await S(s, t({
1999
1957
  contentType: u,
2000
- ...v
1958
+ ..._
2001
1959
  }));
2002
1960
  } catch {
2003
1961
  return null;
2004
1962
  }
2005
- await ei(l.uploadUrl, u, e, o, i);
2006
- let d = T(c, a), p = await f(s, d({ finalizeToken: l.finalizeToken }));
2007
- return y(p);
1963
+ await Kr(l.uploadUrl, u, n, o, a);
1964
+ let d = v(c, i), f = await S(s, d({ finalizeToken: l.finalizeToken }));
1965
+ return y(f);
2008
1966
  }, C = async () => {
2009
- let t = r.beginResumableTag ?? n.beginResumableTag ?? Q("beginResumableUpload"), a = T(c, t), l = e.size, d = r.chunkSize ?? n.chunkSize, p = await f(s, a({
1967
+ let e = r.beginResumableTag ?? t.beginResumableTag ?? Q("beginResumableUpload"), i = v(c, e), l = n.size, d = r.chunkSize ?? t.chunkSize, f = await S(s, i({
2010
1968
  contentType: u,
2011
1969
  size: l,
2012
- ...v,
1970
+ ..._,
2013
1971
  ...d ? { chunkSize: d } : {}
2014
- })), m = g(p.uploadUrl), h = Math.max(1, p.chunkSize), _ = Math.max(1, Math.ceil(l / h)), b = Math.max(0, r.retries ?? n.retries ?? 1), x = 0, S = null;
2015
- for (let t = 0; t < _; t++) {
2016
- let n = t * h, r = Math.min(l, n + h), a = e.slice(n, r), s = t === _ - 1, c = r - n, d = 0;
1972
+ })), p = h(f.uploadUrl), m = Math.max(1, f.chunkSize), g = Math.max(1, Math.ceil(l / m)), b = Math.max(0, r.retries ?? t.retries ?? 1), x = 0, C = null;
1973
+ for (let e = 0; e < g; e++) {
1974
+ let t = e * m, r = Math.min(l, t + m), i = n.slice(t, r), s = e === g - 1, c = r - t, d = 0;
2017
1975
  for (;;) {
2018
- if (i.aborted) throw new DOMException("upload aborted", "AbortError");
1976
+ if (a.aborted) throw new DOMException("upload aborted", "AbortError");
2019
1977
  try {
2020
- let e = await $r(`${m}?${`token=${encodeURIComponent(p.resumableToken)}&index=${t}${s ? "&final=1" : ""}`}`, u, a, (e) => o((x + e * c) / l), i, s);
2021
- s && (S = e);
1978
+ let t = await Gr(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${s ? "&final=1" : ""}`}`, u, i, (e) => o((x + e * c) / l), a, s);
1979
+ s && (C = t);
2022
1980
  break;
2023
1981
  } catch (e) {
2024
1982
  if (e instanceof DOMException && e.name === "AbortError" || d++ >= b) throw e;
@@ -2026,69 +1984,69 @@ var Jr = () => {
2026
1984
  }
2027
1985
  x += c, o(x / l);
2028
1986
  }
2029
- if (!S) throw Error("resumable upload produced no final reply");
2030
- return y(S);
1987
+ if (!C) throw Error("resumable upload produced no final reply");
1988
+ return y(C);
2031
1989
  }, w = async () => {
2032
- let t = r.multipartBeginTag ?? n.multipartBeginTag ?? Q("beginMultipartUpload"), a = r.multipartSignTag ?? n.multipartSignTag ?? Q("signMultipartPart"), l = r.multipartCompleteTag ?? n.multipartCompleteTag ?? Q("completeMultipartUpload"), p = r.multipartAbortTag ?? n.multipartAbortTag ?? Q("abortMultipartUpload"), m = e.size, h = r.chunkSize ?? n.chunkSize, _;
1990
+ let e = r.multipartBeginTag ?? t.multipartBeginTag ?? Q("beginMultipartUpload"), i = r.multipartSignTag ?? t.multipartSignTag ?? Q("signMultipartPart"), l = r.multipartCompleteTag ?? t.multipartCompleteTag ?? Q("completeMultipartUpload"), f = r.multipartAbortTag ?? t.multipartAbortTag ?? Q("abortMultipartUpload"), p = n.size, m = r.chunkSize ?? t.chunkSize, g;
2033
1991
  try {
2034
- let e = T(c, t);
2035
- _ = await f(s, e({
1992
+ let t = v(c, e);
1993
+ g = await S(s, t({
2036
1994
  contentType: u,
2037
- size: m,
2038
- ...v,
2039
- ...h ? { partSize: h } : {}
1995
+ size: p,
1996
+ ..._,
1997
+ ...m ? { partSize: m } : {}
2040
1998
  }));
2041
1999
  } catch {
2042
2000
  return null;
2043
2001
  }
2044
- let y = T(c, a), b = T(c, l), x = T(c, p), S = Math.max(1, _.partSize), C = Math.max(1, Math.ceil(m / S)), w = Math.max(0, r.retries ?? n.retries ?? 1), E = [], D = 0;
2002
+ let y = v(c, i), b = v(c, l), x = v(c, f), C = Math.max(1, g.partSize), w = Math.max(1, Math.ceil(p / C)), T = Math.max(0, r.retries ?? t.retries ?? 1), E = [], D = 0;
2045
2003
  try {
2046
- for (let t = 0; t < C; t++) {
2047
- let n = t * S, r = Math.min(m, n + S), a = e.slice(n, r), c = t + 1, l = r - n, u = 0;
2004
+ for (let e = 0; e < w; e++) {
2005
+ let t = e * C, r = Math.min(p, t + C), i = n.slice(t, r), c = e + 1, l = r - t, u = 0;
2048
2006
  for (;;) {
2049
- if (i.aborted) throw new DOMException("upload aborted", "AbortError");
2007
+ if (a.aborted) throw new DOMException("upload aborted", "AbortError");
2050
2008
  try {
2051
- let { url: e } = await f(s, y({
2052
- multipartToken: _.multipartToken,
2009
+ let { url: e } = await S(s, y({
2010
+ multipartToken: g.multipartToken,
2053
2011
  partNumber: c
2054
- })), t = await Qr(e, a, (e) => o((D + e * l) / m), i);
2012
+ })), t = await Wr(e, i, (e) => o((D + e * l) / p), a);
2055
2013
  E.push({
2056
2014
  partNumber: c,
2057
2015
  etag: t
2058
2016
  });
2059
2017
  break;
2060
2018
  } catch (e) {
2061
- if (e instanceof DOMException && e.name === "AbortError" || u++ >= w) throw e;
2019
+ if (e instanceof DOMException && e.name === "AbortError" || u++ >= T) throw e;
2062
2020
  }
2063
2021
  }
2064
- D += l, o(D / m);
2022
+ D += l, o(D / p);
2065
2023
  }
2066
- let t = await f(s, b({
2067
- multipartToken: _.multipartToken,
2024
+ let e = await S(s, b({
2025
+ multipartToken: g.multipartToken,
2068
2026
  parts: E
2069
2027
  }));
2070
2028
  return {
2071
- id: t.id,
2072
- url: g(t.url),
2029
+ id: e.id,
2030
+ url: h(e.url),
2073
2031
  name: d,
2074
2032
  mime: u,
2075
- size: t.size
2033
+ size: e.size
2076
2034
  };
2077
2035
  } catch (e) {
2078
2036
  try {
2079
- await f(s, x({ multipartToken: _.multipartToken }));
2037
+ await S(s, x({ multipartToken: g.multipartToken }));
2080
2038
  } catch {}
2081
2039
  throw e;
2082
2040
  }
2083
2041
  };
2084
- if ((r.prefer ?? n.prefer) === "multipart") return await w() || await C();
2085
- if ((r.prefer ?? n.prefer) === "resumable") return await C();
2086
- let E = (r.prefer ?? n.prefer) === "presign", D;
2042
+ if ((r.prefer ?? t.prefer) === "multipart") return await w() || await C();
2043
+ if ((r.prefer ?? t.prefer) === "resumable") return await C();
2044
+ let E = (r.prefer ?? t.prefer) === "presign", D;
2087
2045
  for (let e = 0; e <= l; e++) {
2088
- if (i.aborted) throw new DOMException("upload aborted", "AbortError");
2046
+ if (a.aborted) throw new DOMException("upload aborted", "AbortError");
2089
2047
  try {
2090
2048
  if (E) {
2091
- let e = await S();
2049
+ let e = await x();
2092
2050
  if (e) return e;
2093
2051
  }
2094
2052
  return await b();
@@ -2098,106 +2056,106 @@ var Jr = () => {
2098
2056
  }
2099
2057
  throw D;
2100
2058
  }, [
2101
- t,
2102
- g,
2103
- n.mintTag,
2104
- n.presignMintTag,
2105
- n.finalizeTag,
2106
- n.beginResumableTag,
2107
- n.multipartBeginTag,
2108
- n.multipartSignTag,
2109
- n.multipartCompleteTag,
2110
- n.multipartAbortTag,
2111
- n.chunkSize,
2112
- n.prefer,
2113
- n.visibility,
2114
- n.key,
2115
- n.folder,
2116
- n.tags,
2117
- n.retries
2118
- ]), v = L(async (t, r = {}) => {
2119
- let i = new AbortController();
2120
- p.current = i, l("uploading"), d(void 0), s(0);
2059
+ e,
2060
+ h,
2061
+ t.mintTag,
2062
+ t.presignMintTag,
2063
+ t.finalizeTag,
2064
+ t.beginResumableTag,
2065
+ t.multipartBeginTag,
2066
+ t.multipartSignTag,
2067
+ t.multipartCompleteTag,
2068
+ t.multipartAbortTag,
2069
+ t.chunkSize,
2070
+ t.prefer,
2071
+ t.visibility,
2072
+ t.key,
2073
+ t.folder,
2074
+ t.tags,
2075
+ t.retries
2076
+ ]), _ = B(async (e, n = {}) => {
2077
+ let r = new AbortController();
2078
+ f.current = r, l("uploading"), d(void 0), s(0);
2121
2079
  try {
2122
- let e = await _(t, r, i.signal, s);
2123
- return s(1), l("success"), e;
2124
- } catch (t) {
2125
- throw l("error"), d(t), t instanceof DOMException && t.name === "AbortError" || a.current.errorBus.emit({
2080
+ let t = await g(e, n, r.signal, s);
2081
+ return s(1), l("success"), t;
2082
+ } catch (e) {
2083
+ throw l("error"), d(e), e instanceof DOMException && e.name === "AbortError" || i.current.errorBus.emit({
2126
2084
  source: "action",
2127
- tag: r.mintTag ?? n.mintTag ?? Q("mintUploadTicket"),
2128
- error: t,
2129
- kind: e(t, "unknown"),
2130
- outcome: e(t, "unknown") === "transport" ? "unknown" : "not-applicable"
2131
- }), t;
2085
+ tag: n.mintTag ?? t.mintTag ?? Q("mintUploadTicket"),
2086
+ error: e,
2087
+ kind: o(e, "unknown"),
2088
+ outcome: o(e, "unknown") === "transport" ? "unknown" : "not-applicable"
2089
+ }), e;
2132
2090
  }
2133
- }, [_, n.mintTag]), y = L(async (t, r = {}) => {
2134
- if (t.length === 0) return [];
2135
- let i = new AbortController();
2136
- p.current = i, l("uploading"), d(void 0), s(0);
2137
- let o = Math.max(1, r.concurrency ?? n.concurrency ?? 3), c = Array(t.length), u = Array(t.length).fill(0), f = () => s(u.reduce((e, t) => e + t, 0) / t.length), m = 0, h = async () => {
2091
+ }, [g, t.mintTag]), y = B(async (e, n = {}) => {
2092
+ if (e.length === 0) return [];
2093
+ let r = new AbortController();
2094
+ f.current = r, l("uploading"), d(void 0), s(0);
2095
+ let a = Math.max(1, n.concurrency ?? t.concurrency ?? 3), c = Array(e.length), u = Array(e.length).fill(0), p = () => s(u.reduce((e, t) => e + t, 0) / e.length), m = 0, h = async () => {
2138
2096
  for (;;) {
2139
- let e = m++;
2140
- if (e >= t.length) return;
2141
- c[e] = await _(t[e], r, i.signal, (t) => {
2142
- u[e] = t, f();
2143
- }), u[e] = 1, f();
2097
+ let t = m++;
2098
+ if (t >= e.length) return;
2099
+ c[t] = await g(e[t], n, r.signal, (e) => {
2100
+ u[t] = e, p();
2101
+ }), u[t] = 1, p();
2144
2102
  }
2145
2103
  };
2146
2104
  try {
2147
- return await Promise.all(Array.from({ length: Math.min(o, t.length) }, () => h())), s(1), l("success"), c;
2148
- } catch (t) {
2149
- throw i.abort(), l("error"), d(t), t instanceof DOMException && t.name === "AbortError" || a.current.errorBus.emit({
2105
+ return await Promise.all(Array.from({ length: Math.min(a, e.length) }, () => h())), s(1), l("success"), c;
2106
+ } catch (e) {
2107
+ throw r.abort(), l("error"), d(e), e instanceof DOMException && e.name === "AbortError" || i.current.errorBus.emit({
2150
2108
  source: "action",
2151
- tag: r.mintTag ?? n.mintTag ?? Q("mintUploadTicket"),
2152
- error: t,
2153
- kind: e(t, "unknown"),
2154
- outcome: e(t, "unknown") === "transport" ? "unknown" : "not-applicable"
2155
- }), t;
2109
+ tag: n.mintTag ?? t.mintTag ?? Q("mintUploadTicket"),
2110
+ error: e,
2111
+ kind: o(e, "unknown"),
2112
+ outcome: o(e, "unknown") === "transport" ? "unknown" : "not-applicable"
2113
+ }), e;
2156
2114
  }
2157
2115
  }, [
2158
- _,
2159
- n.concurrency,
2160
- n.mintTag
2161
- ]), b = L((e, t = {}) => {
2116
+ g,
2117
+ t.concurrency,
2118
+ t.mintTag
2119
+ ]), b = B((e, t = {}) => {
2162
2120
  e.preventDefault();
2163
2121
  let n = e.dataTransfer ? Array.from(e.dataTransfer.files) : [];
2164
2122
  return n.length ? y(n, t) : Promise.resolve([]);
2165
- }, [y]), S = L((e, t = {}) => {
2123
+ }, [y]), x = B((e, t = {}) => {
2166
2124
  let n = e.clipboardData ? Array.from(e.clipboardData.files) : [];
2167
2125
  return n.length ? y(n, t) : Promise.resolve([]);
2168
- }, [y]), C = z(() => ({
2126
+ }, [y]), C = H(() => ({
2169
2127
  onDragOver: (e) => e.preventDefault(),
2170
2128
  onDrop: (e) => {
2171
2129
  b(e);
2172
2130
  }
2173
2131
  }), [b]);
2174
- return z(() => ({
2175
- upload: v,
2132
+ return H(() => ({
2133
+ upload: _,
2176
2134
  uploadMany: y,
2177
- progress: o,
2135
+ progress: a,
2178
2136
  status: c,
2179
2137
  error: u,
2180
- cancel: h,
2181
- reset: m,
2138
+ cancel: m,
2139
+ reset: p,
2182
2140
  onDrop: b,
2183
- onPaste: S,
2141
+ onPaste: x,
2184
2142
  dropzoneProps: C
2185
2143
  }), [
2186
- v,
2144
+ _,
2187
2145
  y,
2188
- o,
2146
+ a,
2189
2147
  c,
2190
2148
  u,
2191
- h,
2192
2149
  m,
2150
+ p,
2193
2151
  b,
2194
- S,
2152
+ x,
2195
2153
  C
2196
2154
  ]);
2197
- }, ri = (e, t) => {
2198
- let n = ni(e), r = ur(e, t.action), [i, a] = V("idle"), [o, s] = V(void 0), [c, l] = V(void 0), u = B(t.extra);
2155
+ }, Yr = (e, t) => {
2156
+ let n = Jr(e), r = nr(e, t.action), [i, a] = W("idle"), [o, s] = W(void 0), [c, l] = W(void 0), u = U(t.extra);
2199
2157
  u.current = t.extra;
2200
- let d = L(async (e) => {
2158
+ let d = B(async (e) => {
2201
2159
  l(void 0), s(void 0), a("uploading");
2202
2160
  let t;
2203
2161
  try {
@@ -2215,12 +2173,12 @@ var Jr = () => {
2215
2173
  } catch (e) {
2216
2174
  throw a("error"), l(e), e;
2217
2175
  }
2218
- }, [n, r]), f = L(() => {
2176
+ }, [n, r]), f = B(() => {
2219
2177
  n.cancel(), a("idle");
2220
- }, [n]), p = L(() => {
2178
+ }, [n]), p = B(() => {
2221
2179
  n.reset(), a("idle"), s(void 0), l(void 0);
2222
2180
  }, [n]);
2223
- return z(() => ({
2181
+ return H(() => ({
2224
2182
  phase: i,
2225
2183
  progress: i === "uploading" ? n.progress : void 0,
2226
2184
  result: o,
@@ -2239,28 +2197,28 @@ var Jr = () => {
2239
2197
  p
2240
2198
  ]);
2241
2199
  }, $ = async (e) => {
2242
- let t = T(e.client, e.tag), n = U.currentSpan.pipe(U.tap((t) => U.sync(() => {
2243
- b({
2200
+ let t = v(e.client, e.tag), n = K.currentSpan.pipe(K.tap((t) => K.sync(() => {
2201
+ r({
2244
2202
  traceId: t.traceId,
2245
2203
  spanId: t.spanId,
2246
2204
  source: "mutation",
2247
2205
  tag: e.tag
2248
2206
  });
2249
- })), U.catchAll(() => U.void), U.zipRight(t(e.input)), U.withSpan(`${e.spanPrefix}.${e.tag}`, { attributes: {
2207
+ })), K.catchAll(() => K.void), K.zipRight(t(e.input)), K.withSpan(`${e.spanPrefix}.${e.tag}`, { attributes: {
2250
2208
  "voltro.api": e.apiName,
2251
2209
  "rpc.tag": e.tag
2252
2210
  } }));
2253
- return f(e.runtime, n);
2254
- }, ii = (e, t) => {
2255
- let n = K(e), { descriptors: r } = n, i = B(n);
2211
+ return S(e.runtime, n);
2212
+ }, Xr = (e, t) => {
2213
+ let n = k(e), { descriptors: r } = n, i = U(n);
2256
2214
  if (i.current = n, process.env.NODE_ENV !== "production") {
2257
2215
  let n = r[t]?.kind;
2258
2216
  n !== void 0 && n !== "workflow" && console.error(`[@voltro/client] useWorkflow('${e}', '${t}') targets a ${n}, not a workflow. Use ${n === "mutation" ? "useMutation" : n === "action" ? "useAction" : `the ${n} hook`} instead.`);
2259
2217
  }
2260
- let [a, o] = V(!1), [s, c] = V(void 0), [l, u] = V(void 0), d = L(async (n) => {
2218
+ let [a, o] = W(!1), [s, c] = W(void 0), [l, u] = W(void 0), d = B(async (n) => {
2261
2219
  o(!0), c(void 0);
2262
2220
  try {
2263
- let { runtime: r, client: a } = await J(i, e, t), o = await $({
2221
+ let { runtime: r, client: a } = await N(i, e, t), o = await $({
2264
2222
  apiName: e,
2265
2223
  runtime: r,
2266
2224
  client: a,
@@ -2274,8 +2232,8 @@ var Jr = () => {
2274
2232
  } finally {
2275
2233
  o(!1);
2276
2234
  }
2277
- }, [e, t]), p = L(async (t) => {
2278
- let n = "__voltro.workflow.queued.cancel", { runtime: r, client: a } = await J(i, e, n);
2235
+ }, [e, t]), f = B(async (t) => {
2236
+ let n = "__voltro.workflow.queued.cancel", { runtime: r, client: a } = await N(i, e, n);
2279
2237
  return $({
2280
2238
  apiName: e,
2281
2239
  runtime: r,
@@ -2284,26 +2242,26 @@ var Jr = () => {
2284
2242
  input: t,
2285
2243
  spanPrefix: "client.workflow.queued.cancel"
2286
2244
  });
2287
- }, [e]), m = L(async (t) => {
2288
- let n = "__voltro.workflow.queued.control", { runtime: r, client: a } = await J(i, e, n), o = T(a, n);
2289
- return f(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
2290
- if (je.isSome(e)) {
2291
- if (e.value._tag === "snapshot") return U.succeed(e.value.data);
2292
- if (e.value._tag === "error") return U.fail(e.value.error);
2245
+ }, [e]), p = B(async (t) => {
2246
+ let n = "__voltro.workflow.queued.control", { runtime: r, client: a } = await N(i, e, n), o = v(a, n);
2247
+ return S(r, q.runHead(o(t)).pipe(K.flatMap((e) => {
2248
+ if (Ve.isSome(e)) {
2249
+ if (e.value._tag === "snapshot") return K.succeed(e.value.data);
2250
+ if (e.value._tag === "error") return K.fail(e.value.error);
2293
2251
  }
2294
- return U.fail(/* @__PURE__ */ Error("queued workflow control query ended without a snapshot"));
2252
+ return K.fail(/* @__PURE__ */ Error("queued workflow control query ended without a snapshot"));
2295
2253
  })));
2296
- }, [e]), h = L(async (t) => {
2297
- let n = "__voltro.workflow.control", { runtime: r, client: a } = await J(i, e, n), o = T(a, n);
2298
- return f(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
2299
- if (je.isSome(e)) {
2300
- if (e.value._tag === "snapshot") return U.succeed(e.value.data);
2301
- if (e.value._tag === "error") return U.fail(e.value.error);
2254
+ }, [e]), m = B(async (t) => {
2255
+ let n = "__voltro.workflow.control", { runtime: r, client: a } = await N(i, e, n), o = v(a, n);
2256
+ return S(r, q.runHead(o(t)).pipe(K.flatMap((e) => {
2257
+ if (Ve.isSome(e)) {
2258
+ if (e.value._tag === "snapshot") return K.succeed(e.value.data);
2259
+ if (e.value._tag === "error") return K.fail(e.value.error);
2302
2260
  }
2303
- return U.fail(/* @__PURE__ */ Error("workflow control query ended without a snapshot"));
2261
+ return K.fail(/* @__PURE__ */ Error("workflow control query ended without a snapshot"));
2304
2262
  })));
2305
- }, [e]), g = L(async (t, n) => {
2306
- let { runtime: r, client: a } = await J(i, e, "__voltro.workflow.cancel");
2263
+ }, [e]), h = B(async (t, n) => {
2264
+ let { runtime: r, client: a } = await N(i, e, "__voltro.workflow.cancel");
2307
2265
  return $({
2308
2266
  apiName: e,
2309
2267
  runtime: r,
@@ -2315,8 +2273,8 @@ var Jr = () => {
2315
2273
  },
2316
2274
  spanPrefix: "client.workflow.cancel"
2317
2275
  });
2318
- }, [e]), _ = L(async (t, n) => {
2319
- let { runtime: r, client: a } = await J(i, e, "__voltro.workflow.resume");
2276
+ }, [e]), g = B(async (t, n) => {
2277
+ let { runtime: r, client: a } = await N(i, e, "__voltro.workflow.resume");
2320
2278
  return $({
2321
2279
  apiName: e,
2322
2280
  runtime: r,
@@ -2328,8 +2286,8 @@ var Jr = () => {
2328
2286
  },
2329
2287
  spanPrefix: "client.workflow.resume"
2330
2288
  });
2331
- }, [e]), v = L(async (t, n, r) => {
2332
- let { runtime: a, client: o } = await J(i, e, "__voltro.workflow.signal");
2289
+ }, [e]), _ = B(async (t, n, r) => {
2290
+ let { runtime: a, client: o } = await N(i, e, "__voltro.workflow.signal");
2333
2291
  return $({
2334
2292
  apiName: e,
2335
2293
  runtime: a,
@@ -2342,8 +2300,8 @@ var Jr = () => {
2342
2300
  },
2343
2301
  spanPrefix: "client.workflow.signal"
2344
2302
  });
2345
- }, [e]), y = L(async (t, n, r, a) => {
2346
- let { runtime: o, client: s } = await J(i, e, "__voltro.workflow.update");
2303
+ }, [e]), y = B(async (t, n, r, a) => {
2304
+ let { runtime: o, client: s } = await N(i, e, "__voltro.workflow.update");
2347
2305
  return $({
2348
2306
  apiName: e,
2349
2307
  runtime: o,
@@ -2358,38 +2316,38 @@ var Jr = () => {
2358
2316
  spanPrefix: "client.workflow.update"
2359
2317
  });
2360
2318
  }, [e]);
2361
- return z(() => ({
2319
+ return H(() => ({
2362
2320
  start: d,
2363
- cancelQueued: p,
2364
- readQueuedCancellation: m,
2365
- cancel: g,
2366
- readControl: h,
2367
- resume: _,
2368
- signal: v,
2321
+ cancelQueued: f,
2322
+ readQueuedCancellation: p,
2323
+ cancel: h,
2324
+ readControl: m,
2325
+ resume: g,
2326
+ signal: _,
2369
2327
  update: y,
2370
2328
  pending: a,
2371
2329
  error: s,
2372
2330
  data: l
2373
2331
  }), [
2374
2332
  d,
2333
+ f,
2375
2334
  p,
2335
+ h,
2376
2336
  m,
2377
2337
  g,
2378
- h,
2379
2338
  _,
2380
- v,
2381
2339
  y,
2382
2340
  a,
2383
2341
  s,
2384
2342
  l
2385
2343
  ]);
2386
- }, ai = (e) => {
2387
- let t = K(e), n = B(t);
2344
+ }, Zr = (e) => {
2345
+ let t = k(e), n = U(t);
2388
2346
  n.current = t;
2389
- let [r, i] = V(!1), [a, o] = V(void 0), [s, c] = V(void 0), l = L(async (t, r, a) => {
2347
+ let [r, i] = W(!1), [a, o] = W(void 0), [s, c] = W(void 0), l = B(async (t, r, a) => {
2390
2348
  i(!0), o(void 0);
2391
2349
  try {
2392
- let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.signal"), s = await $({
2350
+ let { runtime: i, client: o } = await N(n, e, "__voltro.workflow.signal"), s = await $({
2393
2351
  apiName: e,
2394
2352
  runtime: i,
2395
2353
  client: o,
@@ -2408,7 +2366,7 @@ var Jr = () => {
2408
2366
  i(!1);
2409
2367
  }
2410
2368
  }, [e]);
2411
- return z(() => ({
2369
+ return H(() => ({
2412
2370
  signal: l,
2413
2371
  pending: r,
2414
2372
  error: a,
@@ -2419,13 +2377,13 @@ var Jr = () => {
2419
2377
  a,
2420
2378
  s
2421
2379
  ]);
2422
- }, oi = (e) => {
2423
- let t = K(e), n = B(t);
2380
+ }, Qr = (e) => {
2381
+ let t = k(e), n = U(t);
2424
2382
  n.current = t;
2425
- let [r, i] = V(!1), [a, o] = V(void 0), [s, c] = V(void 0), l = L(async (t, r, a, s) => {
2383
+ let [r, i] = W(!1), [a, o] = W(void 0), [s, c] = W(void 0), l = B(async (t, r, a, s) => {
2426
2384
  i(!0), o(void 0);
2427
2385
  try {
2428
- let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.update"), l = await $({
2386
+ let { runtime: i, client: o } = await N(n, e, "__voltro.workflow.update"), l = await $({
2429
2387
  apiName: e,
2430
2388
  runtime: i,
2431
2389
  client: o,
@@ -2445,7 +2403,7 @@ var Jr = () => {
2445
2403
  i(!1);
2446
2404
  }
2447
2405
  }, [e]);
2448
- return z(() => ({
2406
+ return H(() => ({
2449
2407
  update: l,
2450
2408
  pending: r,
2451
2409
  error: a,
@@ -2456,8 +2414,8 @@ var Jr = () => {
2456
2414
  a,
2457
2415
  s
2458
2416
  ]);
2459
- }, si = (e, t) => {
2460
- let n = q(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
2417
+ }, $r = (e, t) => {
2418
+ let n = J(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
2461
2419
  return n.loading || n.idle || n.failed ? {
2462
2420
  ...n,
2463
2421
  run: void 0
@@ -2465,8 +2423,8 @@ var Jr = () => {
2465
2423
  ...n,
2466
2424
  run: n.data[0]
2467
2425
  };
2468
- }, ci = (e, t = {}, n = {}) => {
2469
- let r = q(e, "__voltro.workflow.runs", t, n);
2426
+ }, ei = (e, t = {}, n = {}) => {
2427
+ let r = J(e, "__voltro.workflow.runs", t, n);
2470
2428
  return r.loading || r.idle || r.failed ? {
2471
2429
  ...r,
2472
2430
  runs: []
@@ -2474,8 +2432,8 @@ var Jr = () => {
2474
2432
  ...r,
2475
2433
  runs: r.data
2476
2434
  };
2477
- }, li = (e, t) => {
2478
- let n = q(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
2435
+ }, ti = (e, t) => {
2436
+ let n = J(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
2479
2437
  return n.loading || n.idle || n.failed ? {
2480
2438
  ...n,
2481
2439
  steps: []
@@ -2483,8 +2441,8 @@ var Jr = () => {
2483
2441
  ...n,
2484
2442
  steps: n.data
2485
2443
  };
2486
- }, ui = (e, t) => {
2487
- let n = q(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
2444
+ }, ni = (e, t) => {
2445
+ let n = J(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
2488
2446
  return n.loading || n.idle || n.failed ? {
2489
2447
  ...n,
2490
2448
  events: []
@@ -2492,8 +2450,8 @@ var Jr = () => {
2492
2450
  ...n,
2493
2451
  events: n.data
2494
2452
  };
2495
- }, di = ui, fi = (e, t = {}, n = {}) => {
2496
- let r = q(e, "__voltro.workflow.domainEvents", t, n);
2453
+ }, ri = ni, ii = (e, t = {}, n = {}) => {
2454
+ let r = J(e, "__voltro.workflow.domainEvents", t, n);
2497
2455
  return r.loading || r.idle || r.failed ? {
2498
2456
  ...r,
2499
2457
  events: []
@@ -2501,8 +2459,8 @@ var Jr = () => {
2501
2459
  ...r,
2502
2460
  events: r.data
2503
2461
  };
2504
- }, pi = (e, t) => {
2505
- let n = q(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
2462
+ }, ai = (e, t) => {
2463
+ let n = J(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
2506
2464
  return n.loading || n.idle || n.failed ? {
2507
2465
  ...n,
2508
2466
  deliveries: []
@@ -2510,42 +2468,42 @@ var Jr = () => {
2510
2468
  ...n,
2511
2469
  deliveries: n.data
2512
2470
  };
2513
- }, mi = (e, t) => {
2471
+ }, oi = (e, t) => {
2514
2472
  let n = e.payload;
2515
2473
  if (!n || typeof n != "object") return;
2516
2474
  let r = n[t];
2517
2475
  return typeof r == "string" ? r : void 0;
2518
- }, hi = (e) => {
2476
+ }, si = (e) => {
2519
2477
  let t = e.payload;
2520
2478
  if (!t || typeof t != "object") return;
2521
2479
  let n = t.updateId;
2522
2480
  return typeof n == "string" ? n : void 0;
2523
- }, gi = (e) => {
2481
+ }, ci = (e) => {
2524
2482
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
2525
2483
  for (let r of e) if (r.eventType === "signal-received") {
2526
- let e = mi(r, "signalName");
2484
+ let e = oi(r, "signalName");
2527
2485
  e && t.add(e);
2528
2486
  } else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
2529
- let e = hi(r);
2487
+ let e = si(r);
2530
2488
  e && n.add(e);
2531
2489
  }
2532
2490
  for (let r = e.length - 1; r >= 0; --r) {
2533
2491
  let i = e[r];
2534
2492
  if (i.eventType === "signal-awaited") {
2535
- let e = mi(i, "signalName");
2493
+ let e = oi(i, "signalName");
2536
2494
  if (e && !t.has(e)) return {
2537
2495
  name: e,
2538
2496
  kind: "signal"
2539
2497
  };
2540
2498
  } else if (i.eventType === "update-requested") {
2541
- let e = hi(i), t = mi(i, "updateName");
2499
+ let e = si(i), t = oi(i, "updateName");
2542
2500
  if (t && (!e || !n.has(e))) return {
2543
2501
  name: t,
2544
2502
  kind: "update"
2545
2503
  };
2546
2504
  }
2547
2505
  }
2548
- }, _i = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), vi = (e, t) => {
2506
+ }, li = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), ui = (e, t) => {
2549
2507
  if (!e || e.status !== "failed") return;
2550
2508
  let n = t.find((e) => e.status === "failed");
2551
2509
  return {
@@ -2553,34 +2511,34 @@ var Jr = () => {
2553
2511
  message: e.errorMessage,
2554
2512
  step: n?.stepName
2555
2513
  };
2556
- }, yi = (e, t) => {
2557
- let n = si(e, t), r = li(e, t), i = ui(e, t), a = ii(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = L(async () => {
2514
+ }, di = (e, t) => {
2515
+ let n = $r(e, t), r = ti(e, t), i = ni(e, t), a = Xr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = B(async () => {
2558
2516
  if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
2559
2517
  await a.cancel({
2560
2518
  workflowName: o.tag,
2561
2519
  executionId: o.executionId
2562
2520
  });
2563
- }, [a, o]), u = L(async () => {
2521
+ }, [a, o]), u = B(async () => {
2564
2522
  if (!o) throw Error("useWorkflowRunState: no run loaded — cannot resume");
2565
2523
  await a.resume({
2566
2524
  workflowName: o.tag,
2567
2525
  executionId: o.executionId
2568
2526
  });
2569
- }, [a, o]), d = L((e, n) => {
2527
+ }, [a, o]), d = B((e, n) => {
2570
2528
  if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot signal");
2571
2529
  return a.signal({ id: t }, e, n);
2572
- }, [a, t]), f = L((e, n, r) => {
2530
+ }, [a, t]), f = B((e, n, r) => {
2573
2531
  if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot update");
2574
2532
  return a.update({ id: t }, e, n, r);
2575
2533
  }, [a, t]);
2576
- return z(() => ({
2534
+ return H(() => ({
2577
2535
  run: o,
2578
2536
  status: o?.status,
2579
2537
  steps: s,
2580
2538
  events: c,
2581
- currentStep: _i(s),
2582
- waitingFor: o?.status === "suspended" ? gi(c) : void 0,
2583
- error: vi(o, s),
2539
+ currentStep: li(s),
2540
+ waitingFor: o?.status === "suspended" ? ci(c) : void 0,
2541
+ error: ui(o, s),
2584
2542
  traceId: o?.traceId,
2585
2543
  loading: n.data === void 0,
2586
2544
  cancel: l,
@@ -2597,24 +2555,24 @@ var Jr = () => {
2597
2555
  d,
2598
2556
  f
2599
2557
  ]);
2600
- }, bi = (e, t) => {
2601
- let { runtime: n, client: r } = K(e), [i, a] = V([]), [s, c] = V("idle"), [l, u] = V(void 0), d = B(null), f = L(() => {
2558
+ }, fi = (e, t) => {
2559
+ let { runtime: n, client: r } = k(e), [a, o] = W([]), [s, c] = W("idle"), [l, u] = W(void 0), d = U(null), f = B(() => {
2602
2560
  let e = d.current;
2603
- e && (d.current = null, n.runFork(Ae.interrupt(e)), c((e) => e === "streaming" ? "idle" : e));
2561
+ e && (d.current = null, n.runFork(Be.interrupt(e)), c((e) => e === "streaming" ? "idle" : e));
2604
2562
  }, [n]);
2605
2563
  return {
2606
- events: i,
2564
+ events: a,
2607
2565
  status: s,
2608
2566
  error: l,
2609
- start: L((e = {}) => {
2610
- let i = d.current;
2611
- i && n.runFork(Ae.interrupt(i)), a([]), u(void 0), c("streaming");
2612
- let s = T(r, t)(e), l = W.runForEach(s, (e) => U.sync(() => a((t) => [...t, e]))).pipe(U.matchCause({
2567
+ start: B((e = {}) => {
2568
+ let a = d.current;
2569
+ a && n.runFork(Be.interrupt(a)), o([]), u(void 0), c("streaming");
2570
+ let s = v(r, t)(e), l = q.runForEach(s, (e) => K.sync(() => o((t) => [...t, e]))).pipe(K.matchCause({
2613
2571
  onSuccess: () => {
2614
2572
  c("done");
2615
2573
  },
2616
2574
  onFailure: (e) => {
2617
- De.isInterruptedOnly(e) || (u(o(e)), c("error"));
2575
+ Le.isInterruptedOnly(e) || (u(i(e)), c("error"));
2618
2576
  }
2619
2577
  }));
2620
2578
  d.current = n.runFork(l);
@@ -2625,61 +2583,61 @@ var Jr = () => {
2625
2583
  ]),
2626
2584
  cancel: f
2627
2585
  };
2628
- }, xi = (e, t, n, r) => {
2629
- let i = 0, a = !1, s = (e) => U.sync(() => {
2630
- e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
2586
+ }, pi = (e, t, n, r) => {
2587
+ let a = 0, o = !1, s = (e) => K.sync(() => {
2588
+ e.seq <= a || (a = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (o = !0));
2631
2589
  }), c = (e) => {
2632
2590
  if (typeof e != "object" || !e) return;
2633
2591
  let t = e.name, n = e.message;
2634
2592
  if (typeof t == "string" || typeof n == "string") return `${typeof t == "string" ? t : ""}::${typeof n == "string" ? n : ""}`;
2635
- }, l, u = (e, t, a) => {
2636
- let o = i > t, s = o ? 0 : e + 1, u = a === void 0 ? void 0 : c(a), f = u !== void 0 && u === l && !o;
2637
- if (l = o ? void 0 : u, f || s > r.maxReconnects) return U.sync(() => {
2638
- n.onError(a ?? /* @__PURE__ */ Error("stream connection lost")), n.onStatus("error");
2593
+ }, l, u = (e, t, i) => {
2594
+ let o = a > t, s = o ? 0 : e + 1, u = i === void 0 ? void 0 : c(i), f = u !== void 0 && u === l && !o;
2595
+ if (l = o ? void 0 : u, f || s > r.maxReconnects) return K.sync(() => {
2596
+ n.onError(i ?? /* @__PURE__ */ Error("stream connection lost")), n.onStatus("error");
2639
2597
  });
2640
2598
  let p = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, s - 1));
2641
- return U.sync(() => {
2599
+ return K.sync(() => {
2642
2600
  n.onStatus("reconnecting"), n.onReconnect();
2643
- }).pipe(U.zipRight(U.sleep(Oe.millis(p))), U.zipRight(U.sync(() => n.onStatus("streaming"))), U.zipRight(d(s)));
2644
- }, d = (r) => U.suspend(() => {
2645
- let c = i, l = e({
2601
+ }).pipe(K.zipRight(K.sleep(Re.millis(p))), K.zipRight(K.sync(() => n.onStatus("streaming"))), K.zipRight(d(s)));
2602
+ }, d = (r) => K.suspend(() => {
2603
+ let c = a, l = e({
2646
2604
  ...t,
2647
2605
  fromSeq: c
2648
2606
  });
2649
- return W.runForEach(l, s).pipe(U.matchCauseEffect({
2650
- onSuccess: () => a ? U.sync(() => n.onStatus("done")) : u(r, c, void 0),
2651
- onFailure: (e) => De.isInterruptedOnly(e) ? U.void : a ? U.sync(() => n.onStatus("done")) : u(r, c, o(e))
2607
+ return q.runForEach(l, s).pipe(K.matchCauseEffect({
2608
+ onSuccess: () => o ? K.sync(() => n.onStatus("done")) : u(r, c, void 0),
2609
+ onFailure: (e) => Le.isInterruptedOnly(e) ? K.void : o ? K.sync(() => n.onStatus("done")) : u(r, c, i(e))
2652
2610
  }));
2653
2611
  });
2654
2612
  return d(0);
2655
- }, Si = (e) => {
2613
+ }, mi = (e) => {
2656
2614
  let t = e?._tag;
2657
2615
  return t === "done" || t === "error";
2658
- }, Ci = (e, t, n = {}) => {
2659
- let { runtime: r, client: i } = K(e), [a, o] = V([]), [s, c] = V("idle"), [l, u] = V(0), [d, f] = V(void 0), p = B(null), m = {
2616
+ }, hi = (e, t, n = {}) => {
2617
+ let { runtime: r, client: i } = k(e), [a, o] = W([]), [s, c] = W("idle"), [l, u] = W(0), [d, f] = W(void 0), p = U(null), m = {
2660
2618
  maxReconnects: n.maxReconnects ?? 6,
2661
2619
  backoffMs: n.backoffMs ?? 400,
2662
2620
  maxBackoffMs: n.maxBackoffMs ?? 8e3,
2663
- isTerminal: n.isTerminal ?? Si
2664
- }, h = L(() => {
2621
+ isTerminal: n.isTerminal ?? mi
2622
+ }, h = B(() => {
2665
2623
  let e = p.current;
2666
- e && (p.current = null, r.runFork(Ae.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
2624
+ e && (p.current = null, r.runFork(Be.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
2667
2625
  }, [r]);
2668
2626
  return {
2669
2627
  events: a,
2670
2628
  status: s,
2671
2629
  reconnects: l,
2672
2630
  error: d,
2673
- start: L((e = {}) => {
2631
+ start: B((e = {}) => {
2674
2632
  let n = p.current;
2675
- n && r.runFork(Ae.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
2676
- let a = T(i, t), s = {
2633
+ n && r.runFork(Be.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
2634
+ let a = v(i, t), s = {
2677
2635
  onEvent: (e) => o((t) => [...t, e]),
2678
2636
  onStatus: c,
2679
2637
  onReconnect: () => u((e) => e + 1),
2680
2638
  onError: f
2681
2639
  };
2682
- p.current = r.runFork(xi(a, e, s, m));
2640
+ p.current = r.runFork(pi(a, e, s, m));
2683
2641
  }, [
2684
2642
  r,
2685
2643
  i,
@@ -2691,13 +2649,13 @@ var Jr = () => {
2691
2649
  ]),
2692
2650
  cancel: h
2693
2651
  };
2694
- }, wi = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), Ti = (e) => {
2652
+ }, gi = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), _i = (e) => {
2695
2653
  for (let t = e.length - 1; t >= 0; --t) {
2696
2654
  let n = e[t];
2697
2655
  if (n.role === "user" && n.content) return n.content;
2698
2656
  }
2699
- }, Ei = (e, t, n) => {
2700
- let { threadId: r } = n, i = q(e, `${t}.messages`, { threadId: r }), a = ur(e, `${t}.send`), o = z(() => [...i.data ?? []].sort(wi), [i.data]), s = L((e, t = {}) => a.run({
2657
+ }, vi = (e, t, n) => {
2658
+ let { threadId: r } = n, i = J(e, `${t}.messages`, { threadId: r }), a = nr(e, `${t}.send`), o = H(() => [...i.data ?? []].sort(gi), [i.data]), s = B((e, t = {}) => a.run({
2701
2659
  threadId: r,
2702
2660
  order: i.data?.length ?? 0,
2703
2661
  prompt: e,
@@ -2706,11 +2664,11 @@ var Jr = () => {
2706
2664
  a,
2707
2665
  r,
2708
2666
  i.data
2709
- ]), c = L(() => {
2710
- let e = Ti(o);
2667
+ ]), c = B(() => {
2668
+ let e = _i(o);
2711
2669
  return e === void 0 ? void 0 : s(e);
2712
2670
  }, [o, s]);
2713
- return z(() => ({
2671
+ return H(() => ({
2714
2672
  messages: o,
2715
2673
  streaming: o.some((e) => e.streaming),
2716
2674
  loading: i.data === void 0,
@@ -2727,9 +2685,9 @@ var Jr = () => {
2727
2685
  s,
2728
2686
  c
2729
2687
  ]);
2730
- }, Di = (e, t) => {
2731
- let { events: n, status: r, error: i, start: a, cancel: o } = bi(e, t), [s, c] = V([]), l = B(null), u = z(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
2732
- return R(() => {
2688
+ }, yi = (e, t) => {
2689
+ let { events: n, status: r, error: i, start: a, cancel: o } = fi(e, t), [s, c] = W([]), l = U(null), u = H(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
2690
+ return V(() => {
2733
2691
  if (r !== "done" || l.current === null) return;
2734
2692
  let e = l.current;
2735
2693
  l.current = null, c((t) => [
@@ -2748,18 +2706,18 @@ var Jr = () => {
2748
2706
  history: s,
2749
2707
  status: r,
2750
2708
  error: i,
2751
- send: L((e = {}) => {
2709
+ send: B((e = {}) => {
2752
2710
  let t = e.message;
2753
2711
  l.current = typeof t == "string" ? t : "", a(e);
2754
2712
  }, [a]),
2755
2713
  cancel: o
2756
2714
  };
2757
- }, Oi = (e, t) => {
2758
- let n = ur(e, t), [r, i] = V(void 0), a = L(async (e) => {
2715
+ }, bi = (e, t) => {
2716
+ let n = nr(e, t), [r, i] = W(void 0), a = B(async (e) => {
2759
2717
  let t = await n.run({ question: e });
2760
2718
  return i(t), t;
2761
- }, [n]), o = L(() => i(void 0), []);
2762
- return z(() => ({
2719
+ }, [n]), o = B(() => i(void 0), []);
2720
+ return H(() => ({
2763
2721
  ask: a,
2764
2722
  answer: r,
2765
2723
  pending: n.pending,
@@ -2772,35 +2730,32 @@ var Jr = () => {
2772
2730
  n.error,
2773
2731
  o
2774
2732
  ]);
2775
- }, ki = (e) => {
2776
- let { cache: t, runtime: n } = K(e);
2777
- return L(() => {
2733
+ }, xi = (e) => {
2734
+ let { cache: t, runtime: n } = k(e);
2735
+ return B(() => {
2778
2736
  t.refreshAll(n);
2779
2737
  }, [t, n]);
2780
- }, Ai = (e, t, n) => {
2781
- let { cache: r } = K(e), i = j([t, n]), a = B([t, n]);
2782
- return a.current = [t, n], z(() => {
2738
+ }, Si = (e, t, n) => {
2739
+ let { cache: r } = k(e), i = f([t, n]), a = U([t, n]);
2740
+ return a.current = [t, n], H(() => {
2783
2741
  let e = a.current;
2784
2742
  return () => r.refresh(e);
2785
2743
  }, [r, i]);
2786
- }, ji = async (e, t, n, r, i) => {
2787
- let { runtime: a, client: o } = await J(e, t, n), s = T(o, n)(r ?? {}), c = U.isEffect(s) ? s : W.runHead(s).pipe(U.map(je.getOrUndefined)), l = await f(a, c, { signal: i });
2788
- return He(n, l, "[loader.query]");
2789
- }, Mi = (e, t) => {
2790
- let n = K(e), r = n.recovery ?? E(n.errorBus, e), i = B(t);
2791
- i.current = t, R(() => r.onVisibleError((e) => i.current(e)), [r]);
2792
- }, Ni = (e, t) => {
2793
- let { errorBus: n } = K(e), r = B(t);
2794
- r.current = t, R(() => n.on((e) => r.current(e)), [n]);
2795
- }, Pi = {
2744
+ }, Ci = (e, t) => {
2745
+ let n = k(e), r = n.recovery ?? c(n.errorBus, e), i = U(t);
2746
+ i.current = t, V(() => r.onVisibleError((e) => i.current(e)), [r]);
2747
+ }, wi = (e, t) => {
2748
+ let { errorBus: n } = k(e), r = U(t);
2749
+ r.current = t, V(() => n.on((e) => r.current(e)), [n]);
2750
+ }, Ti = {
2796
2751
  failed: [],
2797
2752
  healthy: !0
2798
- }, Fi = (e) => {
2799
- let { errorBus: t } = K(e), [n, r] = V(Pi);
2800
- return R(() => {
2753
+ }, Ei = (e) => {
2754
+ let { errorBus: t } = k(e), [n, r] = W(Ti);
2755
+ return V(() => {
2801
2756
  let e = /* @__PURE__ */ new Map(), n = () => {
2802
2757
  let t = [...e.values()].sort((e, t) => t.at - e.at);
2803
- r(t.length === 0 ? Pi : {
2758
+ r(t.length === 0 ? Ti : {
2804
2759
  failed: t,
2805
2760
  healthy: !1
2806
2761
  });
@@ -2818,20 +2773,20 @@ var Jr = () => {
2818
2773
  i(), a();
2819
2774
  };
2820
2775
  }, [t]), n;
2821
- }, Ii = (e, t) => {
2776
+ }, Di = (e, t) => {
2822
2777
  let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
2823
2778
  if (i) return i;
2824
- let a = I(t);
2779
+ let a = Me(t);
2825
2780
  return n[r] = a, a;
2826
- }, Li = Ii("serverRequest", null), Ri = () => we(Li), zi = ({ value: e, children: t }) => /* @__PURE__ */ qe(Li.Provider, {
2781
+ }, Oi = Di("serverRequest", null), ki = () => Pe(Oi), Ai = ({ value: e, children: t }) => /* @__PURE__ */ nt(Oi.Provider, {
2827
2782
  value: e,
2828
2783
  children: t
2829
- }), Bi = (e) => {
2830
- let t = Ri();
2831
- return z(() => {
2784
+ }), ji = (e) => {
2785
+ let t = ki();
2786
+ return H(() => {
2832
2787
  if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
2833
2788
  if (typeof document > "u") return;
2834
- let n = document.getElementById(_e);
2789
+ let n = document.getElementById(Ee);
2835
2790
  if (n !== null && n.textContent !== null && n.textContent !== "") try {
2836
2791
  let t = JSON.parse(n.textContent);
2837
2792
  return t.formKey === e ? t : void 0;
@@ -2839,15 +2794,15 @@ var Jr = () => {
2839
2794
  return;
2840
2795
  }
2841
2796
  }, [t, e]);
2842
- }, Vi = (e, t, n) => e.map((e) => {
2797
+ }, Mi = (e, t, n) => e.map((e) => {
2843
2798
  let r = String(e[n] ?? ""), i = e[t];
2844
2799
  return {
2845
2800
  value: r,
2846
2801
  label: i == null ? r : String(i)
2847
2802
  };
2848
- }), Hi = (e, t, n = {}) => {
2849
- let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = V(n.initialTerm ?? ""), [l, u] = V(s);
2850
- R(() => {
2803
+ }), Ni = (e, t, n = {}) => {
2804
+ let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = W(n.initialTerm ?? ""), [l, u] = W(s);
2805
+ V(() => {
2851
2806
  if (s === l) return;
2852
2807
  let e = setTimeout(() => u(s), r);
2853
2808
  return () => clearTimeout(e);
@@ -2856,24 +2811,24 @@ var Jr = () => {
2856
2811
  l,
2857
2812
  r
2858
2813
  ]);
2859
- let d = n.skipUntilTerm === !0 && l.trim() === "", f = q(e, t, z(() => o(l), [o, l]), { skip: d }), p = z(() => Vi(f.data ?? [], i, a), [
2814
+ let d = n.skipUntilTerm === !0 && l.trim() === "", f = J(e, t, H(() => o(l), [o, l]), { skip: d }), p = H(() => Mi(f.data ?? [], i, a), [
2860
2815
  f.data,
2861
2816
  i,
2862
2817
  a
2863
- ]), m = L((e) => c(e), []);
2818
+ ]), m = B((e) => c(e), []);
2864
2819
  return {
2865
2820
  options: p,
2866
2821
  loading: !d && f.data === void 0,
2867
2822
  term: s,
2868
2823
  search: m
2869
2824
  };
2870
- }, Ui = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Wi = (e, t, n = {}) => {
2871
- let r = K(e), [i, a] = V(n.pageSize), o = q(e, t, z(() => i === void 0 ? n.input ?? {} : {
2825
+ }, Pi = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, Fi = (e, t, n = {}) => {
2826
+ let r = k(e), [i, a] = W(n.pageSize), o = J(e, t, H(() => i === void 0 ? n.input ?? {} : {
2872
2827
  ...n.input,
2873
2828
  limit: i
2874
- }, [n.input, i])), s = r.descriptors[t]?.output, c = L(() => {
2829
+ }, [n.input, i])), s = r.descriptors[t]?.output, c = B(() => {
2875
2830
  n.pageSize !== void 0 && a((e) => (e ?? n.pageSize) + n.pageSize);
2876
- }, [n.pageSize]), l = z(() => n.columns ?? (s === void 0 ? [] : N(s)), [n.columns, s]), [u, d] = V(n.initialSort), f = L((e) => {
2831
+ }, [n.pageSize]), l = H(() => n.columns ?? (s === void 0 ? [] : ce(s)), [n.columns, s]), [u, d] = W(n.initialSort), f = B((e) => {
2877
2832
  d((t) => t?.column === e ? {
2878
2833
  column: e,
2879
2834
  direction: t.direction === "asc" ? "desc" : "asc"
@@ -2884,11 +2839,11 @@ var Jr = () => {
2884
2839
  }, []);
2885
2840
  return {
2886
2841
  columns: l,
2887
- rows: z(() => {
2842
+ rows: H(() => {
2888
2843
  let e = o.data ?? [];
2889
2844
  if (u === void 0) return e;
2890
2845
  let t = u.direction === "asc" ? 1 : -1;
2891
- return [...e].sort((e, n) => Ui(e[u.column], n[u.column]) * t);
2846
+ return [...e].sort((e, n) => Pi(e[u.column], n[u.column]) * t);
2892
2847
  }, [o.data, u]),
2893
2848
  loading: o.data === void 0,
2894
2849
  error: o.error,
@@ -2897,26 +2852,26 @@ var Jr = () => {
2897
2852
  loadMore: c,
2898
2853
  hasMore: i !== void 0 && (o.data?.length ?? 0) >= i
2899
2854
  };
2900
- }, Gi = (e, t, n, r) => {
2855
+ }, Ii = (e, t, n, r) => {
2901
2856
  let i = e.replace(/\/$/, ""), a = new URLSearchParams({
2902
2857
  table: t,
2903
2858
  id: n
2904
2859
  });
2905
2860
  return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
2906
- }, Ki = Gi, qi = (e, t, n, r) => {
2907
- let { inspectBaseUrl: i } = K(e), [a, o] = V({
2861
+ }, Li = Ii, Ri = (e, t, n, r) => {
2862
+ let { inspectBaseUrl: i } = k(e), [a, o] = W({
2908
2863
  data: void 0,
2909
2864
  loading: !0,
2910
2865
  error: void 0
2911
2866
  });
2912
- return R(() => {
2867
+ return V(() => {
2913
2868
  let e = !1;
2914
2869
  o({
2915
2870
  data: void 0,
2916
2871
  loading: !0,
2917
2872
  error: void 0
2918
2873
  });
2919
- let a = Gi(i ?? "", t, n, r);
2874
+ let a = Ii(i ?? "", t, n, r);
2920
2875
  return fetch(a).then(async (e) => {
2921
2876
  if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
2922
2877
  return await e.json();
@@ -2942,23 +2897,23 @@ var Jr = () => {
2942
2897
  n,
2943
2898
  r
2944
2899
  ]), a;
2945
- }, Ji = "admin:full", Yi = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), Xi = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), Zi = I({ scopes: [] });
2946
- function Qi(e) {
2947
- return Ce(Zi.Provider, { value: { scopes: e.scopes } }, e.children);
2900
+ }, zi = "admin:full", Bi = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), Vi = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), Hi = Me({ scopes: [] });
2901
+ function Ui(e) {
2902
+ return Ne(Hi.Provider, { value: { scopes: e.scopes } }, e.children);
2948
2903
  }
2949
- var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scopes, e), na = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, ra = (e) => {
2950
- let { inspectBaseUrl: t } = K(e), [n, r] = V({
2904
+ var Wi = () => Pe(Hi), Gi = (e) => Bi(Wi().scopes, e), Ki = (e) => Vi(Wi().scopes, e), qi = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, Ji = (e) => {
2905
+ let { inspectBaseUrl: t } = k(e), [n, r] = W({
2951
2906
  manifest: void 0,
2952
2907
  loading: !0,
2953
2908
  error: void 0
2954
2909
  });
2955
- return R(() => {
2910
+ return V(() => {
2956
2911
  let e = !1;
2957
2912
  return r({
2958
2913
  manifest: void 0,
2959
2914
  loading: !0,
2960
2915
  error: void 0
2961
- }), fetch(na(t ?? "")).then(async (e) => {
2916
+ }), fetch(qi(t ?? "")).then(async (e) => {
2962
2917
  if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
2963
2918
  return await e.json();
2964
2919
  }).then((t) => {
@@ -2977,7 +2932,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
2977
2932
  e = !0;
2978
2933
  };
2979
2934
  }, [e, t]), n;
2980
- }, ia = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), aa = (e, t) => {
2935
+ }, Yi = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), Xi = (e, t) => {
2981
2936
  if (e === void 0) return "unknown";
2982
2937
  if (t.includes("admin:full") || e.length === 0) return "allowed";
2983
2938
  let n = !1;
@@ -2986,7 +2941,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
2986
2941
  n = !0;
2987
2942
  continue;
2988
2943
  }
2989
- if (!ia(t, r)) {
2944
+ if (!Yi(t, r)) {
2990
2945
  if (r.resourceScoped) {
2991
2946
  n = !0;
2992
2947
  continue;
@@ -2995,13 +2950,13 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
2995
2950
  }
2996
2951
  }
2997
2952
  return n ? "unknown" : "allowed";
2998
- }, oa = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), sa = (e) => {
2953
+ }, Zi = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), Qi = (e) => {
2999
2954
  for (let t of e ?? []) if (t.kind === "open") return t.reason;
3000
- }, ca = (e) => aa(e, $i().scopes), la = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, ua = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, da = (e) => e === void 0 ? {} : {
2955
+ }, $i = (e) => Xi(e, Wi().scopes), ea = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, ta = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, na = (e) => e === void 0 ? {} : {
3001
2956
  tag: e.tag,
3002
2957
  ...e.guards === void 0 ? {} : { guards: e.guards }
3003
- }, fa = (e) => e.tables.filter((e) => !e.framework).map((t) => {
3004
- let n = e.procedures.find((e) => e.kind === "query" && la(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && ua(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && ua(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && ua(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
2958
+ }, ra = (e) => e.tables.filter((e) => !e.framework).map((t) => {
2959
+ let n = e.procedures.find((e) => e.kind === "query" && ea(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && ta(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && ta(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && ta(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
3005
2960
  return {
3006
2961
  table: t.name,
3007
2962
  columns: t.columns.filter((e) => e.serverOnly !== !0),
@@ -3010,22 +2965,22 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3010
2965
  reactive: t.reactive,
3011
2966
  ...o === void 0 ? {} : { pkColumn: o },
3012
2967
  editable: (t.editable ?? !0) && o !== void 0,
3013
- list: da(n),
3014
- create: da(r),
3015
- update: da(i),
3016
- delete: da(a)
2968
+ list: na(n),
2969
+ create: na(r),
2970
+ update: na(i),
2971
+ delete: na(a)
3017
2972
  };
3018
- }), pa = (e) => {
3019
- let [t, n] = V([]), [r, i] = V([]), a = L((e) => {
2973
+ }), ia = (e) => {
2974
+ let [t, n] = W([]), [r, i] = W([]), a = B((e) => {
3020
2975
  n((t) => [...t, e]), i([]);
3021
- }, []), o = L(async () => {
2976
+ }, []), o = B(async () => {
3022
2977
  let r = t[t.length - 1];
3023
2978
  r !== void 0 && r.blockedBy === void 0 && (await e.onUndo(r.invocationId), n((e) => e.slice(0, -1)), i((e) => [...e, r]));
3024
- }, [t, e]), s = L(async () => {
2979
+ }, [t, e]), s = B(async () => {
3025
2980
  let t = r[r.length - 1];
3026
2981
  t !== void 0 && (await e.onRedo(t.invocationId), i((e) => e.slice(0, -1)), n((e) => [...e, t]));
3027
2982
  }, [r, e]);
3028
- return z(() => {
2983
+ return H(() => {
3029
2984
  let e = t[t.length - 1];
3030
2985
  return {
3031
2986
  record: a,
@@ -3043,14 +2998,14 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3043
2998
  o,
3044
2999
  s
3045
3000
  ]);
3046
- }, ma = "__voltro.undo.log", ha = "__voltro.undo.apply", ga = "__voltro.undo.redo", _a = (e, t) => {
3047
- let n = t?.limit, { data: r } = q(e, ma, n === void 0 ? {} : { limit: n }), i = ar(e, ha), a = ar(e, ga), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = L(async (e) => {
3001
+ }, aa = "__voltro.undo.log", oa = "__voltro.undo.apply", sa = "__voltro.undo.redo", ca = (e, t) => {
3002
+ let n = t?.limit, { data: r } = J(e, aa, n === void 0 ? {} : { limit: n }), i = Zn(e, oa), a = Zn(e, sa), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = B(async (e) => {
3048
3003
  await i.mutate({ invocationId: e });
3049
- }, [i]), u = L(async (e) => {
3004
+ }, [i]), u = B(async (e) => {
3050
3005
  await a.mutate({ invocationId: e });
3051
- }, [a]), d = L(async () => {
3006
+ }, [a]), d = B(async () => {
3052
3007
  s && await l(s.id);
3053
- }, [s, l]), f = L(async () => {
3008
+ }, [s, l]), f = B(async () => {
3054
3009
  c && await u(c.id);
3055
3010
  }, [c, u]);
3056
3011
  return {
@@ -3063,22 +3018,22 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3063
3018
  undoLast: d,
3064
3019
  redoLast: f
3065
3020
  };
3066
- }, va = (e, t) => ({
3021
+ }, la = (e, t) => ({
3067
3022
  name: e,
3068
3023
  map: t
3069
- }), ya = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), ba = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), xa = (e, t, n) => {
3024
+ }), ua = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), da = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), fa = (e, t, n) => {
3070
3025
  let r = { ...t };
3071
3026
  for (let [i, a] of Object.entries(e.map)) {
3072
- if (ba.has(i) || a === void 0) continue;
3027
+ if (da.has(i) || a === void 0) continue;
3073
3028
  let e = t[i];
3074
3029
  r[i] = (...r) => {
3075
- let i = ya(a, t);
3030
+ let i = ua(a, t);
3076
3031
  if (i !== null && n(i), typeof e == "function") return e(...r);
3077
3032
  };
3078
3033
  }
3079
3034
  return r;
3080
- }, Sa = (e, t, n) => {
3081
- let r = B({
3035
+ }, pa = (e, t, n) => {
3036
+ let r = U({
3082
3037
  spec: e,
3083
3038
  props: t,
3084
3039
  sink: n
@@ -3087,47 +3042,47 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3087
3042
  spec: e,
3088
3043
  props: t,
3089
3044
  sink: n
3090
- }, R(() => {
3091
- let e = r.current, t = ya(e.spec.map.onMount, e.props);
3045
+ }, V(() => {
3046
+ let e = r.current, t = ua(e.spec.map.onMount, e.props);
3092
3047
  return t !== null && e.sink(t), () => {
3093
- let e = r.current, t = ya(e.spec.map.onUnmount, e.props);
3048
+ let e = r.current, t = ua(e.spec.map.onUnmount, e.props);
3094
3049
  t !== null && e.sink(t);
3095
3050
  };
3096
- }, []), z(() => xa(e, t, n), [
3051
+ }, []), H(() => fa(e, t, n), [
3097
3052
  e,
3098
3053
  t,
3099
3054
  n
3100
3055
  ]);
3101
- }, Ca = (e, t) => {
3102
- let n = K(e).descriptors[t]?.input;
3103
- return z(() => n === void 0 ? [] : be(n), [n]);
3104
- }, wa = (e, t) => {
3105
- let n = K(e).descriptors[t]?.output;
3106
- return z(() => n === void 0 ? [] : N(n), [n]);
3107
- }, Ta = (e, t) => {
3056
+ }, ma = (e, t) => {
3057
+ let n = k(e).descriptors[t]?.input;
3058
+ return H(() => n === void 0 ? [] : ke(n), [n]);
3059
+ }, ha = (e, t) => {
3060
+ let n = k(e).descriptors[t]?.output;
3061
+ return H(() => n === void 0 ? [] : ce(n), [n]);
3062
+ }, ga = (e, t) => {
3108
3063
  if (e === t) return !0;
3109
3064
  if (e.length !== t.length) return !1;
3110
3065
  for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
3111
3066
  return !0;
3112
- }, Ea = (e) => Object.keys(e).sort().map((t) => e[t]), Da = (e, t) => {
3113
- let n = B(null), r = Ea(e);
3114
- return (n.current === null || !Ta(n.current.key, r)) && (n.current = {
3067
+ }, _a = (e) => Object.keys(e).sort().map((t) => e[t]), va = (e, t) => {
3068
+ let n = U(null), r = _a(e);
3069
+ return (n.current === null || !ga(n.current.key, r)) && (n.current = {
3115
3070
  key: r,
3116
3071
  value: t(e)
3117
3072
  }), n.current.value;
3118
- }, Oa = (e, t, n, r = {}) => {
3119
- let i = q(e, t, { ...n }, r);
3120
- return z(() => ({
3073
+ }, ya = (e, t, n, r = {}) => {
3074
+ let i = J(e, t, { ...n }, r);
3075
+ return H(() => ({
3121
3076
  allowed: i.data?.allowed === !0,
3122
3077
  pending: i.data === void 0
3123
3078
  }), [i.data]);
3124
- }, ka = (e, t, n, r = {}) => {
3125
- let i = q(e, t, { ...n }, r);
3126
- return z(() => ({
3079
+ }, ba = (e, t, n, r = {}) => {
3080
+ let i = J(e, t, { ...n }, r);
3081
+ return H(() => ({
3127
3082
  allowedIds: new Set(i.data?.allowedIds ?? []),
3128
3083
  pending: i.data === void 0
3129
3084
  }), [i.data]);
3130
- }, Aa = (e) => {
3085
+ }, xa = (e) => {
3131
3086
  switch (e) {
3132
3087
  case "select":
3133
3088
  case "radio":
@@ -3143,26 +3098,26 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3143
3098
  case "switch": return "boolean";
3144
3099
  default: return null;
3145
3100
  }
3146
- }, ja = (e) => be(e).map((e) => {
3101
+ }, Sa = (e) => ke(e).map((e) => {
3147
3102
  if (e.name.includes(".")) return null;
3148
- let t = Aa(e.widget);
3103
+ let t = xa(e.widget);
3149
3104
  return t === null ? null : {
3150
3105
  name: e.name,
3151
3106
  label: e.label,
3152
3107
  kind: t,
3153
3108
  ...e.options ? { options: e.options } : {}
3154
3109
  };
3155
- }).filter((e) => e !== null), Ma = (e) => {
3110
+ }).filter((e) => e !== null), Ca = (e) => {
3156
3111
  let t = {};
3157
3112
  for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
3158
3113
  return t;
3159
- }, Na = (e, t, n = {}) => {
3160
- let r = K(e).descriptors[t]?.input, i = z(() => r === void 0 ? [] : ja(r), [r]), [a, o] = V(n.initial ?? {}), s = L((e, t) => {
3161
- o((n) => Ma({
3114
+ }, wa = (e, t, n = {}) => {
3115
+ let r = k(e).descriptors[t]?.input, i = H(() => r === void 0 ? [] : Sa(r), [r]), [a, o] = W(n.initial ?? {}), s = B((e, t) => {
3116
+ o((n) => Ca({
3162
3117
  ...n,
3163
3118
  [e]: t
3164
3119
  }));
3165
- }, []), c = L(() => o({}), []), l = q(e, t, z(() => Ma(a), [a]));
3120
+ }, []), c = B(() => o({}), []), l = J(e, t, H(() => Ca(a), [a]));
3166
3121
  return {
3167
3122
  filters: i,
3168
3123
  values: a,
@@ -3173,20 +3128,20 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3173
3128
  loading: l.data === void 0,
3174
3129
  error: l.error
3175
3130
  };
3176
- }, Pa = (e, t, n = {}) => {
3177
- let r = q(e, t, n), i = r.data;
3131
+ }, Ta = (e, t, n = {}) => {
3132
+ let r = J(e, t, n), i = r.data;
3178
3133
  return {
3179
3134
  record: Array.isArray(i) ? i[0] : i,
3180
3135
  loading: i === void 0,
3181
3136
  error: r.error
3182
3137
  };
3183
- }, Fa = (e, t = 300) => {
3184
- let [n, r] = V(e);
3185
- return R(() => {
3138
+ }, Ea = (e, t = 300) => {
3139
+ let [n, r] = W(e);
3140
+ return V(() => {
3186
3141
  let n = setTimeout(() => r(e), t);
3187
3142
  return () => clearTimeout(n);
3188
3143
  }, [e, t]), n;
3189
- }, Ia = (e) => {
3144
+ }, Da = (e) => {
3190
3145
  let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
3191
3146
  if (a && t.trim() === "") return {
3192
3147
  status: "idle",
@@ -3204,39 +3159,39 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3204
3159
  valid: o.valid,
3205
3160
  message: o.message
3206
3161
  };
3207
- }, La = (e, t, n, r) => {
3208
- let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Fa(n, o), l = s && c.trim() === "", u = q(e, t, z(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
3209
- return Ia({
3162
+ }, Oa = (e, t, n, r) => {
3163
+ let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Ea(n, o), l = s && c.trim() === "", u = J(e, t, H(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
3164
+ return Da({
3210
3165
  value: n,
3211
3166
  debouncedValue: c,
3212
3167
  data: l ? null : u.data,
3213
3168
  interpret: a,
3214
3169
  skipEmpty: s
3215
3170
  });
3216
- }, Ra = (e, t) => ({
3171
+ }, ka = (e, t) => ({
3217
3172
  name: e,
3218
3173
  payload: t
3219
- }), za = (e, t) => {
3220
- let n = Ne.decodeUnknownEither(e.payload, { errors: "all" })(t);
3174
+ }), Aa = (e, t) => {
3175
+ let n = Ue.decodeUnknownEither(e.payload, { errors: "all" })(t);
3221
3176
  if (n._tag === "Right") return {
3222
3177
  valid: !0,
3223
3178
  errors: {}
3224
3179
  };
3225
3180
  let r = {};
3226
- for (let e of Xe.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
3181
+ for (let e of at.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
3227
3182
  return {
3228
3183
  valid: !1,
3229
3184
  errors: r
3230
3185
  };
3231
- }, Ba = (e) => {
3186
+ }, ja = (e) => {
3232
3187
  let t = new Map(e.map((e) => [e.name, e]));
3233
3188
  return {
3234
3189
  names: [...t.keys()].sort(),
3235
3190
  get: (e) => t.get(e),
3236
3191
  events: e
3237
3192
  };
3238
- }, Va = (e, t) => {
3239
- let n = Ba(e);
3193
+ }, Ma = (e, t) => {
3194
+ let n = ja(e);
3240
3195
  return {
3241
3196
  track: (e, r) => {
3242
3197
  let i = n.get(e);
@@ -3245,7 +3200,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3245
3200
  return;
3246
3201
  }
3247
3202
  if (process.env.NODE_ENV !== "production") {
3248
- let t = za(i, r);
3203
+ let t = Aa(i, r);
3249
3204
  t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
3250
3205
  }
3251
3206
  t({
@@ -3256,143 +3211,201 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3256
3211
  names: n.names,
3257
3212
  catalog: n
3258
3213
  };
3259
- }, Ha = (e, t) => {
3260
- let n = ur(e, t);
3214
+ }, Na = (e, t) => {
3215
+ let n = nr(e, t);
3261
3216
  return {
3262
- preview: L((e) => n.run(e), [n]),
3217
+ preview: B((e) => n.run(e), [n]),
3263
3218
  diff: n.lastResult,
3264
3219
  pending: n.pending,
3265
3220
  error: n.error
3266
3221
  };
3267
- }, Ua = (e, t, n, r) => [...e, {
3222
+ }, Pa = () => globalThis.navigator?.onLine !== !1, Fa = (e) => Pa() && (g().online(e) ?? !0), Ia = (e) => {
3223
+ let t = g().subscribe(e);
3224
+ return typeof window > "u" ? t : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
3225
+ t(), window.removeEventListener("online", e), window.removeEventListener("offline", e);
3226
+ });
3227
+ }, La = (e) => {
3228
+ let t = B(() => Fa(e), [e]);
3229
+ return G(Ia, t, () => !0);
3230
+ }, Ra = (e, t, n, r, i) => [...e, {
3268
3231
  id: t,
3269
3232
  tag: n,
3270
3233
  input: r,
3271
3234
  status: "pending",
3272
- attempts: 0
3273
- }], Wa = (e, t, n) => e.map((e) => e.id === t ? {
3235
+ attempts: 0,
3236
+ ...i === void 0 ? {} : { stamp: i }
3237
+ }], za = (e, t, n) => e.map((e) => e.id === t ? {
3274
3238
  ...e,
3275
3239
  ...n
3276
- } : e), Ga = (e, t) => Wa(e, t, { status: "sent" }), Ka = (e, t, n) => e.map((e) => e.id === t ? {
3240
+ } : e), Ba = (e, t) => za(e, t, { status: "sent" }), Va = (e, t, n) => e.map((e) => e.id === t ? {
3277
3241
  ...e,
3278
3242
  status: "failed",
3279
3243
  error: n,
3280
3244
  attempts: e.attempts + 1
3281
- } : e), qa = (e, t, n) => Wa(e, t, {
3245
+ } : e), Ha = (e, t, n) => za(e, t, {
3282
3246
  status: "conflict",
3283
3247
  error: n
3284
- }), Ja = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
3248
+ }), Ua = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
3285
3249
  ...e,
3286
3250
  input: n,
3287
3251
  status: "pending",
3288
3252
  error: void 0
3289
- } : e), Ya = (e) => e.filter((e) => e.status !== "sent"), Xa = (e) => {
3253
+ } : e), Wa = (e) => e.filter((e) => e.status !== "sent"), Ga = (e) => {
3290
3254
  let t = [];
3291
3255
  for (let n of e) {
3292
3256
  if (n.status === "conflict") break;
3293
3257
  (n.status === "pending" || n.status === "failed") && t.push(n);
3294
3258
  }
3295
3259
  return t;
3296
- }, Za = (e) => {
3260
+ }, Ka = (e) => {
3297
3261
  let t = e;
3298
3262
  return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
3299
- }, Qa = (e) => {
3300
- let [t, n] = V(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
3301
- return R(() => {
3302
- if (e !== void 0) {
3303
- n(e);
3304
- return;
3305
- }
3306
- if (typeof window > "u") return;
3307
- let t = () => n(!0), r = () => n(!1);
3308
- return window.addEventListener("online", t), window.addEventListener("offline", r), () => {
3309
- window.removeEventListener("online", t), window.removeEventListener("offline", r);
3310
- };
3311
- }, [e]), t;
3312
- }, $a = (e) => {
3313
- let { send: t, persistence: n, isConflict: r = Za, idFor: i } = e, [a, o] = V([]), [s, c] = V(0), l = Qa(e.online), u = B([]), d = L((e) => {
3314
- let t = e(u.current);
3315
- u.current = t, o(t);
3316
- }, []), f = B(t);
3317
- f.current = t;
3318
- let p = B(r);
3319
- p.current = r;
3320
- let m = B(void 0), h = B(!1), g = B(!0);
3321
- R(() => (g.current = !0, () => {
3322
- g.current = !1;
3263
+ }, qa = (e) => {
3264
+ let t = Math.min(3e4, 1e3 * 2 ** Math.max(0, e - 1));
3265
+ return t / 2 + t / 2 * Math.random();
3266
+ }, Ja = (e) => {
3267
+ let { persistence: t, isConflict: n = Ka, idFor: r, api: i } = e;
3268
+ if (e.send === void 0 && i === void 0) throw Error("useOutbox: pass `send`, or `api` to send through that api's own mutations.");
3269
+ let a = Pe(P), o = a?.demand;
3270
+ V(() => {
3271
+ i !== void 0 && o?.(i);
3272
+ }, [o, i]);
3273
+ let s = i === void 0 || a === null ? void 0 : a.get(i), l = U(s);
3274
+ l.current = s;
3275
+ let [u, d] = W([]), [f, p] = W(0), m = La(i), h = e.online ?? m, g = U([]), _ = B((e) => {
3276
+ let t = e(g.current);
3277
+ g.current = t, d(t);
3278
+ }, []), y = U(e.retryDelay ?? qa);
3279
+ y.current = e.retryDelay ?? qa;
3280
+ let b = U(e.stamp);
3281
+ b.current = e.stamp;
3282
+ let x = U(async () => void 0);
3283
+ x.current = e.send ?? (async (e) => {
3284
+ if (l.current === void 0) throw Error(`useOutbox: no mounted api '${i}' — render it inside the framework's runtime provider.`);
3285
+ let t = await N(l, i, e.tag), n = v(t.client, e.tag);
3286
+ await S(t.runtime, z(n(e.input), e.id));
3287
+ });
3288
+ let C = U(n);
3289
+ C.current = n;
3290
+ let w = U(void 0), T = U(!1), E = U(!0);
3291
+ V(() => (E.current = !0, () => {
3292
+ E.current = !1;
3323
3293
  }), []);
3324
- let _ = B(0), v = B(Math.random().toString(36).slice(2, 8)), y = B(n === void 0);
3325
- R(() => {
3326
- if (n === void 0 || y.current) return;
3294
+ let D = U(0), ee = U(Math.random().toString(36).slice(2, 8)), O = U(t === void 0), [k, A] = W(0), j = s === void 0 ? void 0 : s.recovery ?? c(s.errorBus, i);
3295
+ V(() => {
3296
+ if (j === void 0) return;
3297
+ let e = j.subjectSignal;
3298
+ if (e.aborted) return;
3299
+ let n = () => {
3300
+ g.current = [], d([]), O.current = t === void 0, T.current = !1, A((e) => e + 1);
3301
+ };
3302
+ return e.addEventListener("abort", n, { once: !0 }), () => {
3303
+ e.removeEventListener("abort", n);
3304
+ };
3305
+ }, [
3306
+ j,
3307
+ t,
3308
+ k
3309
+ ]), V(() => {
3310
+ if (t === void 0) return;
3327
3311
  let e = !1;
3328
- return n.load().then((t) => {
3329
- e || (y.current = !0, t.length > 0 && d((e) => [...t, ...e]), c((e) => e + 1));
3330
- }).catch(() => {
3331
- e || (y.current = !0, c((e) => e + 1));
3312
+ return O.current = !1, t.load().then((t) => {
3313
+ e || (O.current = !0, t.length > 0 && _((e) => [...t, ...e]), p((e) => e + 1));
3314
+ }, () => {
3315
+ e || (O.current = !0, p((e) => e + 1));
3332
3316
  }), () => {
3333
3317
  e = !0;
3334
3318
  };
3335
- }, [n, d]), R(() => {
3336
- n !== void 0 && y.current && n.save(Ya(a)).catch(() => {});
3337
3319
  }, [
3338
- n,
3339
- a,
3340
- s
3320
+ t,
3321
+ _,
3322
+ k
3323
+ ]), V(() => {
3324
+ t !== void 0 && O.current && t.save(Wa(u)).catch(() => {});
3325
+ }, [
3326
+ t,
3327
+ u,
3328
+ f
3329
+ ]);
3330
+ let M = U(/* @__PURE__ */ new Set()), F = s === void 0 || te(s) ? void 0 : s.cache;
3331
+ V(() => {
3332
+ if (F !== void 0 && s !== void 0) for (let e of u) {
3333
+ let t = s.descriptors[e.tag]?.targets;
3334
+ if (e.status === "pending" || e.status === "failed") {
3335
+ if (M.current.delete(e.id), t === void 0 || t.length === 0 || F.hasIntent(e.id) || typeof e.input != "object" || e.input === null) continue;
3336
+ F.autoApply(t, e.input, e.id, { standing: !0 });
3337
+ } else M.current.has(e.id) || (M.current.add(e.id), e.status === "sent" ? F.confirmByMutation(e.id) : F.revertByMutation(e.id));
3338
+ }
3339
+ }, [
3340
+ F,
3341
+ s,
3342
+ u
3341
3343
  ]);
3342
- let b = L((e, t) => {
3343
- let n = i?.() ?? `obx_${v.current}_${_.current++}_${e}`;
3344
- d((r) => Ua(r, n, e, t)), c((e) => e + 1);
3345
- }, [i, d]), x = L(() => {
3346
- if (!y.current || !g.current) return Promise.resolve();
3347
- if (m.current !== void 0) return m.current;
3348
- h.current = !1;
3344
+ let ne = B((e, t) => {
3345
+ let n = r?.() ?? `obx_${ee.current}_${D.current++}_${e}`;
3346
+ _((r) => Ra(r, n, e, t, b.current?.())), p((e) => e + 1);
3347
+ }, [r, _]), I = U(void 0), L = B(() => {
3348
+ I.current !== void 0 && clearTimeout(I.current), I.current = void 0;
3349
+ }, []);
3350
+ V(() => L, [L]);
3351
+ let R = B(() => {
3352
+ if (!O.current || !E.current) return Promise.resolve();
3353
+ if (w.current !== void 0) return w.current;
3354
+ T.current = !1, L();
3349
3355
  let e = Promise.resolve().then(async () => {
3350
- for (; g.current;) {
3351
- let e = Xa(u.current)[0];
3356
+ for (; E.current;) {
3357
+ let e = Ga(g.current)[0];
3352
3358
  if (e === void 0) break;
3353
3359
  try {
3354
- if (await f.current(e), !g.current) break;
3355
- d((t) => Ga(t, e.id));
3360
+ if (await x.current(e), !E.current) break;
3361
+ _((t) => Ba(t, e.id));
3356
3362
  } catch (t) {
3357
- if (!g.current) break;
3358
- d((n) => p.current(t) ? qa(n, e.id, t) : Ka(n, e.id, t)), h.current = !0;
3363
+ if (!E.current) break;
3364
+ let n = C.current(t);
3365
+ _((r) => n ? Ha(r, e.id, t) : Va(r, e.id, t)), T.current = !0, n || (I.current = setTimeout(() => {
3366
+ I.current = void 0, re.current();
3367
+ }, y.current(e.attempts + 1)));
3359
3368
  break;
3360
3369
  }
3361
3370
  }
3362
3371
  }).finally(() => {
3363
- m.current === e && (m.current = void 0);
3372
+ w.current === e && (w.current = void 0);
3364
3373
  });
3365
- return m.current = e, e;
3366
- }, [d]);
3367
- R(() => {
3368
- l && x();
3369
- }, [l, x]), R(() => {
3370
- l && !h.current && x();
3374
+ return w.current = e, e;
3375
+ }, [_, L]), re = U(R);
3376
+ re.current = R, V(() => {
3377
+ h ? R() : L();
3371
3378
  }, [
3372
- s,
3373
- l,
3374
- x
3379
+ h,
3380
+ R,
3381
+ L
3382
+ ]), V(() => {
3383
+ h && !T.current && R();
3384
+ }, [
3385
+ f,
3386
+ h,
3387
+ R
3375
3388
  ]);
3376
- let S = L((e, t) => {
3377
- d((n) => Ja(n, e, t)), l && x();
3389
+ let ie = B((e, t) => {
3390
+ _((n) => Ua(n, e, t)), h && R();
3378
3391
  }, [
3379
- l,
3380
- x,
3381
- d
3392
+ h,
3393
+ R,
3394
+ _
3382
3395
  ]);
3383
3396
  return {
3384
- queue: a,
3385
- enqueue: b,
3386
- replay: x,
3387
- online: l,
3388
- pending: a.filter((e) => e.status === "pending" || e.status === "failed").length,
3389
- conflicts: a.filter((e) => e.status === "conflict"),
3390
- resolveConflict: S
3397
+ queue: u,
3398
+ enqueue: ne,
3399
+ replay: R,
3400
+ online: h,
3401
+ pending: u.filter((e) => e.status === "pending" || e.status === "failed").length,
3402
+ conflicts: u.filter((e) => e.status === "conflict"),
3403
+ resolveConflict: ie
3391
3404
  };
3392
- }, eo = (e) => {
3405
+ }, Ya = (e) => {
3393
3406
  let t = e;
3394
3407
  return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
3395
- }, to = (e) => {
3408
+ }, Xa = (e) => {
3396
3409
  let t = (Array.isArray(e) ? e : [e]).filter((e) => typeof e == "object" && !!e);
3397
3410
  for (let e of t) {
3398
3411
  if (e._tag === "Chunk") {
@@ -3407,9 +3420,9 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3407
3420
  };
3408
3421
  }
3409
3422
  return { ok: !0 };
3410
- }, no = async (e) => {
3411
- let t = e.fetch ?? ((e, t) => fetch(e, t)), n = e.isConflict ?? eo, r = e.queue, i = 0, a = 0, o = 0;
3412
- for (let s of Xa(e.queue)) {
3423
+ }, Za = async (e) => {
3424
+ let t = e.fetch ?? ((e, t) => fetch(e, t)), n = e.isConflict ?? Ya, r = e.queue, i = 0, a = 0, o = 0;
3425
+ for (let s of Ga(e.queue)) {
3413
3426
  let c;
3414
3427
  try {
3415
3428
  let n = await t(e.url, {
@@ -3423,10 +3436,10 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3423
3436
  id: s.id,
3424
3437
  tag: s.tag,
3425
3438
  payload: s.input,
3426
- headers: []
3439
+ headers: [["idempotency-key", s.id]]
3427
3440
  })
3428
3441
  });
3429
- c = n.ok ? to(await n.json().catch(() => null)) : {
3442
+ c = n.ok ? Xa(await n.json().catch(() => null)) : {
3430
3443
  ok: !1,
3431
3444
  error: { status: n.status }
3432
3445
  };
@@ -3437,14 +3450,14 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3437
3450
  };
3438
3451
  }
3439
3452
  if (c.ok) {
3440
- r = Ga(r, s.id), i++;
3453
+ r = Ba(r, s.id), i++;
3441
3454
  continue;
3442
3455
  }
3443
3456
  if (n(c.error)) {
3444
- r = qa(r, s.id, c.error), o++;
3457
+ r = Ha(r, s.id, c.error), o++;
3445
3458
  continue;
3446
3459
  }
3447
- r = Ka(r, s.id, c.error), a++;
3460
+ r = Va(r, s.id, c.error), a++;
3448
3461
  break;
3449
3462
  }
3450
3463
  return {
@@ -3453,14 +3466,14 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3453
3466
  failed: a,
3454
3467
  conflicts: o
3455
3468
  };
3456
- }, ro = "voltro-outbox", io = "outbox", ao = "queue", oo = (e, t) => new Promise((n, r) => {
3469
+ }, Qa = "voltro-outbox", $a = "outbox", eo = "queue", to = (e, t) => new Promise((n, r) => {
3457
3470
  let i = e.open(t, 1);
3458
3471
  i.onupgradeneeded = () => {
3459
- i.result.objectStoreNames.contains(io) || i.result.createObjectStore(io);
3472
+ i.result.objectStoreNames.contains($a) || i.result.createObjectStore($a);
3460
3473
  }, i.onsuccess = () => n(i.result), i.onerror = () => r(i.error ?? /* @__PURE__ */ Error("indexedDB open failed"));
3461
- }), so = (e) => new Promise((t, n) => {
3474
+ }), no = (e) => new Promise((t, n) => {
3462
3475
  e.onsuccess = () => t(e.result), e.onerror = () => n(e.error ?? /* @__PURE__ */ Error("indexedDB request failed"));
3463
- }), co = (e = {}) => {
3476
+ }), ro = (e = {}) => {
3464
3477
  let t = e.name ?? "voltro-outbox", n = () => {
3465
3478
  let t = e.indexedDB ?? globalThis.indexedDB;
3466
3479
  if (t === void 0) throw Error("indexedDbOutboxPersistence: no indexedDB in this environment");
@@ -3468,31 +3481,31 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3468
3481
  };
3469
3482
  return {
3470
3483
  load: async () => {
3471
- let e = await oo(n(), t);
3484
+ let e = await to(n(), t);
3472
3485
  try {
3473
- let t = await so(e.transaction(io, "readonly").objectStore(io).get(ao));
3486
+ let t = await no(e.transaction($a, "readonly").objectStore($a).get(eo));
3474
3487
  return Array.isArray(t) ? t : [];
3475
3488
  } finally {
3476
3489
  e.close();
3477
3490
  }
3478
3491
  },
3479
3492
  save: async (e) => {
3480
- let r = await oo(n(), t);
3493
+ let r = await to(n(), t);
3481
3494
  try {
3482
- await so(r.transaction(io, "readwrite").objectStore(io).put(e, ao));
3495
+ await no(r.transaction($a, "readwrite").objectStore($a).put(e, eo));
3483
3496
  } finally {
3484
3497
  r.close();
3485
3498
  }
3486
3499
  }
3487
3500
  };
3488
- }, lo = "voltro:outbox", uo = async (e) => {
3489
- let t = e.persistence ?? co(), n = await t.load(), r = await no({
3501
+ }, io = "voltro:outbox", ao = async (e) => {
3502
+ let t = e.persistence ?? ro(), n = await t.load(), r = await Za({
3490
3503
  url: e.url,
3491
3504
  queue: n,
3492
3505
  ...e.headers ? { headers: e.headers } : {}
3493
3506
  });
3494
3507
  return r.sent + r.failed + r.conflicts > 0 && await t.save(r.queue), r;
3495
- }, fo = (e) => {
3508
+ }, oo = (e) => {
3496
3509
  let { scrollTop: t, viewportHeight: n, rowHeight: r, overscan: i = 5, total: a } = e, o = r > 0 ? r : 1, s = Math.max(0, Math.floor(t / o)), c = Math.ceil(n / o), l = Math.max(0, s - i), u = s + c + i, d = a === void 0 ? u : Math.min(u, a);
3497
3510
  return {
3498
3511
  startIndex: l,
@@ -3502,8 +3515,8 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3502
3515
  topSpacer: l * r,
3503
3516
  bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
3504
3517
  };
3505
- }, po = (e, t, n) => {
3506
- let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = V(0), u = z(() => fo({
3518
+ }, so = (e, t, n) => {
3519
+ let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = W(0), u = H(() => oo({
3507
3520
  scrollTop: c,
3508
3521
  viewportHeight: i,
3509
3522
  rowHeight: r,
@@ -3515,7 +3528,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3515
3528
  r,
3516
3529
  a,
3517
3530
  o
3518
- ]), d = q(e, t, z(() => ({
3531
+ ]), d = J(e, t, H(() => ({
3519
3532
  ...s,
3520
3533
  offset: u.offset,
3521
3534
  limit: u.limit
@@ -3523,7 +3536,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3523
3536
  s,
3524
3537
  u.offset,
3525
3538
  u.limit
3526
- ])), f = L((e) => {
3539
+ ])), f = B((e) => {
3527
3540
  l(e.currentTarget.scrollTop);
3528
3541
  }, []);
3529
3542
  return {
@@ -3535,37 +3548,57 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3535
3548
  loading: d.data === void 0,
3536
3549
  error: d.error
3537
3550
  };
3538
- }, mo = () => typeof navigator > "u" || navigator.onLine, ho = () => !0, go = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
3551
+ }, co = () => typeof navigator > "u" || navigator.onLine, lo = () => !0, uo = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
3539
3552
  window.removeEventListener("online", e), window.removeEventListener("offline", e);
3540
- }), _o = (e) => {
3541
- let t = K(e), r = t.recovery ?? E(t.errorBus, e), i = H(r.subscribe, r.getSnapshot, r.getServerSnapshot ?? (() => h)), a = H(go, mo, ho), o = L(() => r.reportExternalSuccess(), [r]), s = a ? i.status : "offline";
3542
- return R(() => {
3543
- n(e, "connection.status", {
3553
+ }), fo = (e) => {
3554
+ let t = k(e), n = t.recovery ?? c(t.errorBus, e), r = G(n.subscribe, n.getSnapshot, n.getServerSnapshot ?? (() => x)), i = G(uo, co, lo), o = B(() => n.reportExternalSuccess(), [n]), s = i ? r.status : "offline";
3555
+ return V(() => {
3556
+ a(e, "connection.status", {
3544
3557
  status: s,
3545
- rawTransport: i.rawTransport,
3546
- online: a,
3547
- failureCount: i.failureCount,
3548
- failedSubscriptions: i.failedSubscriptions.length,
3549
- pendingMutationReplays: i.pendingMutationReplays,
3550
- mutationReplay: i.mutationReplay
3558
+ rawTransport: r.rawTransport,
3559
+ online: i,
3560
+ failureCount: r.failureCount,
3561
+ failedSubscriptions: r.failedSubscriptions.length,
3562
+ pendingMutationReplays: r.pendingMutationReplays,
3563
+ mutationReplay: r.mutationReplay
3551
3564
  });
3552
3565
  }, [
3553
3566
  e,
3554
3567
  s,
3555
- a,
3556
- i
3568
+ i,
3569
+ r
3557
3570
  ]), {
3558
3571
  status: s,
3559
- rawTransport: i.rawTransport,
3560
- online: a,
3561
- failureCount: i.failureCount,
3562
- lastFailureAt: i.lastFailureAt,
3563
- failedSubscriptions: i.failedSubscriptions,
3564
- pendingMutationReplays: i.pendingMutationReplays,
3565
- mutationReplay: i.mutationReplay,
3572
+ rawTransport: r.rawTransport,
3573
+ online: i,
3574
+ failureCount: r.failureCount,
3575
+ lastFailureAt: r.lastFailureAt,
3576
+ failedSubscriptions: r.failedSubscriptions,
3577
+ pendingMutationReplays: r.pendingMutationReplays,
3578
+ mutationReplay: r.mutationReplay,
3566
3579
  reportSuccess: o
3567
3580
  };
3568
- }, vo = "__voltro.connections.list", yo = "__voltro.connections.start", bo = "__voltro.connections.submitToken", xo = "__voltro.connections.disconnect", So = {
3581
+ }, po = (e, t) => e === t ? 0 : e == null ? 1 : t == null ? -1 : e instanceof Date && t instanceof Date ? e.getTime() - t.getTime() : typeof e == "number" && typeof t == "number" ? e - t : String(e).localeCompare(String(t)), mo = (e, t = {}) => {
3582
+ let n = t.where === void 0 ? [...e] : e.filter(t.where), r = t.orderBy;
3583
+ if (r !== void 0) {
3584
+ let e = typeof r == "function" ? r : (e, t) => {
3585
+ let [n, i] = typeof r == "string" ? [r, "asc"] : r, a = po(e[n], t[n]);
3586
+ return i === "desc" ? -a : a;
3587
+ };
3588
+ n = n.sort(e);
3589
+ }
3590
+ return t.limit === void 0 ? n : n.slice(0, Math.max(0, t.limit));
3591
+ }, ho = (e, t, n = {}) => {
3592
+ let { cache: r } = k(e), i = G(B((e) => r.subscribeAny(e), [r]), B(() => r.rowsOf(t), [r, t]), () => go), a = U(n);
3593
+ a.current = n;
3594
+ let { where: o, orderBy: s, limit: c } = n;
3595
+ return H(() => mo(i, a.current), [
3596
+ i,
3597
+ o,
3598
+ s,
3599
+ c
3600
+ ]);
3601
+ }, go = [], _o = "__voltro.connections.list", vo = "__voltro.connections.start", yo = "__voltro.connections.submitToken", bo = "__voltro.connections.disconnect", xo = {
3569
3602
  connectionId: "",
3570
3603
  kind: "oauth2",
3571
3604
  label: "",
@@ -3576,14 +3609,14 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3576
3609
  expiresAt: null,
3577
3610
  lastError: null,
3578
3611
  connectedAt: null
3579
- }, Co = (e, t) => {
3612
+ }, So = (e, t) => {
3580
3613
  if (t === "redirect") {
3581
3614
  globalThis.location.assign(e);
3582
3615
  return;
3583
3616
  }
3584
3617
  globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
3585
- }, wo = (e) => {
3586
- let { data: t } = q(e, vo, {}), n = ur(e, yo), r = ar(e, bo), i = ar(e, xo), a = t ?? [], o = n.pending || r.pending || i.pending, s = L((e) => ({
3618
+ }, Co = (e) => {
3619
+ let { data: t } = J(e, _o, {}), n = nr(e, vo), r = Zn(e, yo), i = Zn(e, bo), a = t ?? [], o = n.pending || r.pending || i.pending, s = B((e) => ({
3587
3620
  ...e,
3588
3621
  connected: e.status === "connected",
3589
3622
  needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
@@ -3591,7 +3624,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3591
3624
  connect: async (t) => {
3592
3625
  if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
3593
3626
  let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
3594
- Co((await n.run({
3627
+ So((await n.run({
3595
3628
  connectionId: e.connectionId,
3596
3629
  redirectTo: r
3597
3630
  })).authorizeUrl, t?.mode);
@@ -3611,7 +3644,7 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3611
3644
  n,
3612
3645
  r,
3613
3646
  i
3614
- ]), c = L((e) => {
3647
+ ]), c = B((e) => {
3615
3648
  let t = a.find((t) => t.connectionId === e);
3616
3649
  return t === void 0 ? void 0 : s(t);
3617
3650
  }, [a, s]);
@@ -3621,10 +3654,10 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3621
3654
  get: c,
3622
3655
  pending: o
3623
3656
  };
3624
- }, To = (e, t) => {
3625
- let n = wo(e), r = n.get(t);
3626
- return z(() => r === void 0 ? {
3627
- ...So,
3657
+ }, wo = (e, t) => {
3658
+ let n = Co(e), r = n.get(t);
3659
+ return H(() => r === void 0 ? {
3660
+ ...xo,
3628
3661
  connectionId: t,
3629
3662
  label: t,
3630
3663
  connected: !1,
@@ -3649,6 +3682,6 @@ var $i = () => we(Zi), ea = (e) => Yi($i().scopes, e), ta = (e) => Xi($i().scope
3649
3682
  n.loading,
3650
3683
  n.pending
3651
3684
  ]);
3652
- }, Eo = "framework-client";
3685
+ }, To = "framework-client";
3653
3686
  //#endregion
3654
- export { Ji as ADMIN_SCOPE, Eo as CLIENT_NAME, vo as CONNECTIONS_LIST_TAG, xo as CONNECTION_DISCONNECT_TAG, yo as CONNECTION_START_TAG, bo as CONNECTION_SUBMIT_TOKEN_TAG, _e as FORM_FLASH_SCRIPT_ID, fe as FORM_KEY_FIELD, he as FORM_PATH_PREFIX, le as FORM_REDIRECT_FIELD, Cr as FormBindingProvider, Ze as FrameworkRuntimesContext, pt as FrameworkRuntimesProvider, h as INITIAL_RECOVERY_SNAPSHOT, M as LoadingSubscriptionCache, qn as MutationSerialExecutionError, ro as OUTBOX_DB_NAME, lo as OUTBOX_SYNC_TAG, Pe as PAIRING_HOST, Fe as PAIRING_SCHEME, Ie as PAIRING_STORAGE_KEY, Qi as PermissionProvider, ge as RICH_TEXT_MARKS, ie as RICH_TEXT_MAX_NODES, g as RecoveryCoordinator, ue as RichTextDocument, v as RpcErrorBus, Li as ServerRequestContext, zi as ServerRequestProvider, p as SubscriptionCache, ha as UNDO_APPLY_TAG, ma as UNDO_LOG_TAG, ga as UNDO_REDO_TAG, fr as ValidationMessagesProvider, ut as _resetFrameworkRuntimesWarning, at as _resetSsrDescriptors, Le as applyPairing, Br as applyPreloadSeeds, en as applyStoreSeeds, tn as browserOnlineSource, fn as browserPlatform, gt as browserStoreStorage, m as buildApiRuntime, Yi as canCall, Xi as canCallAny, nn as capabilitiesOf, t as clearClientDiagnostics, Bn as clearMutations, Re as clearPairing, Ya as clearSent, Pt as clearStoreHistory, te as clientDiagnosticsSnapshot, fo as computeWindow, Va as createAnalytics, Mr as createHooks, gn as currentPlatform, aa as decideAccess, se as decodeFieldIssues, En as deepLinkHref, Sn as defineDeepLink, Ra as defineEvent, rn as definePlatform, Yt as defineStore, va as defineTracking, Jt as definedStores, fa as deriveEntityAdmins, u as disableClientDiagnosticsPersistence, On as dispatchDeepLink, ne as documentLocale, uo as drainOutboxInWorker, no as drainOutboxOverHttp, ve as emptyRichTextDocument, r as enableClientDiagnosticsPersistence, Ua as enqueueEntry, ze as errorMessage, Be as errorTag, Ba as eventCatalog, ja as filtersFromSchema, F as formActionPath, pe as formDataToInput, xe as formField, P as formSections, D as freshIdempotencyKey, er as getMutationNotifier, Rn as getMutations, Ii as globalContext, co as indexedDbOutboxPersistence, hn as installPlatform, _n as isPlatformInstalled, ae as isRichTextDocument, oe as isSafeHref, un as isStandaloneDisplay, ee as isUnauthenticated, ft as isUnresolvedApi, Nr as makePreloadSeedBag, Zt as makeStoreSeedBag, na as manifestUrl, qa as markConflict, Ka as markFailed, Ga as markSent, wn as matchDeepLink, Dn as matchFirstDeepLink, on as memoryTokenStore, sa as openAccessReason, Ue as pairingLink, We as parsePairingLink, me as parseRichText, Ki as provenanceUrl, _ as publishClientError, b as publishClientTrace, ji as queryOnce, Ke as readPairing, Hr as readPreloadedSeedOutcome, Vr as readPreloadedSnapshot, n as recordClientDiagnostic, E as recoveryCoordinatorFor, an as refusingTokenStore, c as registerCellMerger, rt as registerSsrDescriptors, i as registeredCellMerger, Xa as replayable, d as reportClientError, oa as requiredScopes, vn as resetPlatformForTest, Ur as resetPreloadSeeds, Xt as resetStoreRegistryForTests, yt as resetStoreStorageForTest, T as resolveByTag, Ja as resolveConflictEntry, C as resolveRecoveryOptions, vt as resolveStoreStorage, ya as resolveTrackingEvent, ye as resolveValidationMessage, Se as restrictToSchema, xi as resumableConsumeProgram, de as richTextToPlainText, Vi as rowsToOptions, to as rpcHttpOutcome, Tn as runDeepLink, Yr as runSequence, N as schemaToColumns, be as schemaToFields, Rr as seedPreloadedSubscription, zr as seedPreloadedSubscriptionFailure, $t as seedStore, Jr as sequence, ce as serializeRichText, $n as setMutationNotifier, Fr as setPreloadSeedResolver, Qt as setStoreSeedResolver, _t as setStoreStorage, X as settleMutation, bt as shallow, Ta as shallowArrayEqual, Ea as sourceValues, $e as ssrClientProxy, it as ssrDescriptorsFor, ot as ssrStubHandle, j as stableKey, O as startApiSupervisor, Ln as startMutation, Mt as storeHistory, s as subscribeClientDiagnostics, A as subscribeClientErrors, a as subscribeClientTraces, zn as subscribeMutations, Nt as subscribeStoreHistory, l as supersedesConfirmedPatches, Ft as travelToStoreState, ca as useAccessDecision, ur as useAction, Di as useAgent, Ei as useAgentChat, bi as useAgentStream, La as useAsyncValidation, ea as useCan, ta as useCanAny, ra as useCapabilityManifest, To as useConnection, Ar as useConnectionSetup, _o as useConnectionStatus, wo as useConnections, Oi as useDataCopilot, Wi as useDataTable, Fa as useDebounced, Da as useDerived, qr as useEvent, br as useFormBinding, wr as useFormBindingContext, Tr as useFormField, Bi as useFormFlash, Ca as useFormSkeleton, K as useFrameworkApi, dt as useFrameworkRuntimes, ar as useMutation, Ni as useOnRawRpcError, Mi as useOnRpcError, $a as useOutbox, $i as usePermissions, bn as usePlatform, Wr as usePreloadedSubscription, Ha as usePreview, qi as useProvenance, Hi as useQueryField, Na as useQueryFilters, Pa as useRecord, Ai as useRefreshSubscription, ki as useRefreshSubscriptions, Oa as useResourceCan, ka as useResourceCans, Ci as useResumableAgentStream, xr as useSchemaFormBinding, Xr as useSequence, Ri as useServerRequest, xn as useShellExtension, q as useSubscription, Fi as useSubscriptionHealth, wa as useTableSkeleton, Sa as useTracking, ri as useTranscription, pa as useUndo, _a as useUndoLog, ni as useUpload, pr as useValidationMessages, po as useWindowedSubscription, ii as useWorkflow, fi as useWorkflowDomainEvents, pi as useWorkflowEventDeliveries, di as useWorkflowEvents, si as useWorkflowRun, ui as useWorkflowRunEvents, yi as useWorkflowRunState, li as useWorkflowRunSteps, ci as useWorkflowRuns, ai as useWorkflowSignal, oi as useWorkflowUpdate, za as validateEventPayload, re as validateFields, Ia as validationStatus, w as wireAuthRefresh, y as withIdempotencyKey, S as withProtocolOpenRecovery, xa as wrapTrackedCallbacks };
3687
+ export { zi as ADMIN_SCOPE, To as CLIENT_NAME, _o as CONNECTIONS_LIST_TAG, bo as CONNECTION_DISCONNECT_TAG, vo as CONNECTION_START_TAG, yo as CONNECTION_SUBMIT_TOKEN_TAG, Ee as FORM_FLASH_SCRIPT_ID, xe as FORM_KEY_FIELD, we as FORM_PATH_PREFIX, ve as FORM_REDIRECT_FIELD, hr as FormBindingProvider, P as FrameworkRuntimesContext, ot as FrameworkRuntimesProvider, x as INITIAL_RECOVERY_SNAPSHOT, _ as LoadingSubscriptionCache, zn as MutationSerialExecutionError, Qa as OUTBOX_DB_NAME, io as OUTBOX_SYNC_TAG, We as PAIRING_HOST, Ge as PAIRING_SCHEME, Ke as PAIRING_STORAGE_KEY, Ui as PermissionProvider, Te as RICH_TEXT_MARKS, pe as RICH_TEXT_MAX_NODES, m as RecoveryCoordinator, ye as RichTextDocument, C as RpcErrorBus, Oi as ServerRequestContext, Ai as ServerRequestProvider, p as SubscriptionCache, oa as UNDO_APPLY_TAG, aa as UNDO_LOG_TAG, sa as UNDO_REDO_TAG, ir as ValidationMessagesProvider, j as _resetFrameworkRuntimesWarning, ee as _resetSsrDescriptors, g as apiConnectivity, qe as applyPairing, Mr as applyPreloadSeeds, qt as applyStoreSeeds, Jt as browserOnlineSource, an as browserPlatform, lt as browserStoreStorage, ie as buildApiRuntime, Bi as canCall, Vi as canCallAny, Yt as capabilitiesOf, w as clearClientDiagnostics, Mn as clearMutations, Je as clearPairing, Wa as clearSent, Dt as clearStoreHistory, D as clientDiagnosticsSnapshot, oo as computeWindow, Ma as createAnalytics, wr as createHooks, ln as currentPlatform, Xi as decideAccess, ge as decodeFieldIssues, yn as deepLinkHref, qa as defaultOutboxRetryDelay, hn as defineDeepLink, ka as defineEvent, Xt as definePlatform, Ht as defineStore, la as defineTracking, Vt as definedStores, ra as deriveEntityAdmins, l as disableClientDiagnosticsPersistence, xn as dispatchDeepLink, ue as documentLocale, ao as drainOutboxInWorker, Za as drainOutboxOverHttp, De as emptyRichTextDocument, E as enableClientDiagnosticsPersistence, Ra as enqueueEntry, Ye as errorMessage, Xe as errorTag, ja as eventCatalog, Sa as filtersFromSchema, de as formActionPath, Se as formDataToInput, Ae as formField, le as formSections, ae as freshIdempotencyKey, Kn as getMutationNotifier, An as getMutations, Di as globalContext, ro as indexedDbOutboxPersistence, cn as installPlatform, un as isPlatformInstalled, me as isRichTextDocument, he as isSafeHref, nn as isStandaloneDisplay, se as isUnauthenticated, te as isUnresolvedApi, Tr as makePreloadSeedBag, Wt as makeStoreSeedBag, qi as manifestUrl, Ha as markConflict, Va as markFailed, Ba as markSent, _n as matchDeepLink, bn as matchFirstDeepLink, Qt as memoryTokenStore, Qi as openAccessReason, Qe as pairingLink, $e as parsePairingLink, Ce as parseRichText, Li as provenanceUrl, u as publishClientError, r as publishClientTrace, ne as queryOnce, Fa as readApiOnline, tt as readPairing, Pr as readPreloadedSeedOutcome, Nr as readPreloadedSnapshot, a as recordClientDiagnostic, c as recoveryCoordinatorFor, Zt as refusingTokenStore, h as registerCellMerger, F as registerSsrDescriptors, e as registeredCellMerger, Ga as replayable, d as reportClientError, Zi as requiredScopes, dn as resetPlatformForTest, Fr as resetPreloadSeeds, Ut as resetStoreRegistryForTests, ft as resetStoreStorageForTest, v as resolveByTag, Ua as resolveConflictEntry, y as resolveRecoveryOptions, dt as resolveStoreStorage, ua as resolveTrackingEvent, Oe as resolveValidationMessage, je as restrictToSchema, pi as resumableConsumeProgram, be as richTextToPlainText, Mi as rowsToOptions, Xa as rpcHttpOutcome, vn as runDeepLink, mo as runLocalQuery, Vr as runSequence, ce as schemaToColumns, ke as schemaToFields, Ar as seedPreloadedSubscription, jr as seedPreloadedSubscriptionFailure, Kt as seedStore, Br as sequence, _e as serializeRichText, Gn as setMutationNotifier, Dr as setPreloadSeedResolver, Gt as setStoreSeedResolver, ut as setStoreStorage, X as settleMutation, pt as shallow, ga as shallowArrayEqual, _a as sourceValues, O as ssrClientProxy, M as ssrDescriptorsFor, I as ssrStubHandle, f as stableKey, L as startApiSupervisor, kn as startMutation, Tt as storeHistory, Ia as subscribeApiOnline, t as subscribeClientDiagnostics, b as subscribeClientErrors, n as subscribeClientTraces, jn as subscribeMutations, Et as subscribeStoreHistory, s as supersedesConfirmedPatches, Ot as travelToStoreState, $i as useAccessDecision, nr as useAction, yi as useAgent, vi as useAgentChat, fi as useAgentStream, La as useApiOnline, Oa as useAsyncValidation, Gi as useCan, Ki as useCanAny, Ji as useCapabilityManifest, wo as useConnection, Sr as useConnectionSetup, fo as useConnectionStatus, Co as useConnections, bi as useDataCopilot, Fi as useDataTable, Ea as useDebounced, va as useDerived, zr as useEvent, fr as useFormBinding, gr as useFormBindingContext, _r as useFormField, ji as useFormFlash, ma as useFormSkeleton, k as useFrameworkApi, A as useFrameworkRuntimes, ho as useLocalQuery, Zn as useMutation, wi as useOnRawRpcError, Ci as useOnRpcError, Ja as useOutbox, Wi as usePermissions, pn as usePlatform, Ir as usePreloadedSubscription, Na as usePreview, Ri as useProvenance, Ni as useQueryField, wa as useQueryFilters, Ta as useRecord, Si as useRefreshSubscription, xi as useRefreshSubscriptions, ya as useResourceCan, ba as useResourceCans, hi as useResumableAgentStream, pr as useSchemaFormBinding, Hr as useSequence, ki as useServerRequest, mn as useShellExtension, J as useSubscription, Ei as useSubscriptionHealth, ha as useTableSkeleton, pa as useTracking, Yr as useTranscription, ia as useUndo, ca as useUndoLog, Jr as useUpload, ar as useValidationMessages, so as useWindowedSubscription, Xr as useWorkflow, ii as useWorkflowDomainEvents, ai as useWorkflowEventDeliveries, ri as useWorkflowEvents, $r as useWorkflowRun, ni as useWorkflowRunEvents, di as useWorkflowRunState, ti as useWorkflowRunSteps, ei as useWorkflowRuns, Zr as useWorkflowSignal, Qr as useWorkflowUpdate, Aa as validateEventPayload, fe as validateFields, Da as validationStatus, re as wireAuthRefresh, z as withIdempotencyKey, oe as withProtocolOpenRecovery, fa as wrapTrackedCallbacks };