@voltro/client 0.79.1 → 0.81.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,56 +1,54 @@
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, c as u, d, f, g as p, h as m, i as h, j as g, k as _, l as v, m as y, n as b, o as x, p as S, r as C, s as w, t as T, u as E, v as D, w as ee, x as te, y as O } from "./authRefresh-h4r7ENkZ.js";
2
- import { C as k, S as A, _ as ne, a as j, b as re, c as M, d as ie, f as ae, g as oe, h as N, i as se, l as ce, m as le, n as ue, o as de, p as fe, r as pe, s as me, t as he, u as ge, v as P, w as _e, x as ve, y as ye } from "./formData-dGz5aoUR.js";
3
- import { createContext as F, createElement as be, useCallback as I, useContext as L, useDebugValue as xe, useEffect as R, useId as Se, useMemo as z, useRef as B, useState as V, useSyncExternalStore as H } from "react";
4
- import { Cause as Ce, Duration as we, Effect as U, Exit as Te, Fiber as Ee, Option as De, Schedule as Oe, Schema as ke, Stream as W } from "effect";
5
- import * as Ae from "@effect/platform/Headers";
6
- import { RpcClient as je } from "@effect/rpc";
7
- import { fieldIssuesOf as Me, pluginTag as Ne } from "@voltro/protocol";
8
- import { jsx as Pe } from "react/jsx-runtime";
9
- import { FormApi as Fe } from "@tanstack/form-core";
10
- import { useStore as Ie } from "@tanstack/react-store";
11
- import { ArrayFormatter as Le } from "effect/ParseResult";
1
+ import { A as e, C as t, D as n, E as r, M as i, N as a, O as o, S as s, T as c, _ as l, a as u, b as d, c as f, d as p, f as m, g as h, h as g, i as _, j as v, k as y, l as b, m as x, n as S, o as C, p as w, r as T, s as E, t as D, u as ee, v as O, w as k, x as A, y as j } from "./authRefresh-CZd55lCY.js";
2
+ import { C as M, S as N, _ as te, a as P, b as ne, c as F, d as re, f as ie, g as ae, h as oe, i as se, l as ce, m as le, n as ue, o as de, p as fe, r as pe, s as me, t as he, u as ge, v as _e, w as ve, x as ye, y as be } from "./formData-dGz5aoUR.js";
3
+ import { createContext as I, createElement as xe, useCallback as L, useContext as R, useDebugValue as Se, useEffect as z, useId as Ce, useMemo as B, useRef as V, useState as H, useSyncExternalStore as we } from "react";
4
+ import { Cause as Te, Duration as Ee, Effect as U, Exit as De, Fiber as Oe, Option as ke, Schedule as Ae, Schema as je, Stream as W } from "effect";
5
+ import { fieldIssuesOf as Me, firstEventValue as Ne, pluginTag as Pe } from "@voltro/protocol";
6
+ import { jsx as Fe } from "react/jsx-runtime";
7
+ import { FormApi as Ie } from "@tanstack/form-core";
8
+ import { useStore as Le } from "@tanstack/react-store";
9
+ import { ArrayFormatter as Re } from "effect/ParseResult";
12
10
  //#region src/runtimeContext.ts
13
- var Re = F(null), ze = () => {
11
+ var ze = I(null), Be = () => {
14
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");
15
- }, Be = new Proxy(() => ze(), {
16
- get: (e, t) => Be,
13
+ }, Ve = new Proxy(() => Be(), {
14
+ get: (e, t) => Ve,
17
15
  has: () => !0,
18
- apply: () => ze()
19
- }), Ve = Symbol.for("@voltro/client/ssrDescriptors"), He = globalThis, Ue = He[Ve] ?? (He[Ve] = { byApi: /* @__PURE__ */ new Map() }), We = (e, t) => {
20
- Ue.byApi.set(e, t);
21
- }, Ge = (e) => Ue.byApi.get(e), Ke = () => {
22
- Ue.byApi.clear();
23
- }, qe = {
24
- runtime: { runPromiseExit: () => Promise.resolve(Te.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
25
- cache: new s(),
26
- client: Be,
16
+ apply: () => Be()
17
+ }), He = Symbol.for("@voltro/client/ssrDescriptors"), Ue = globalThis, We = Ue[He] ?? (Ue[He] = { byApi: /* @__PURE__ */ new Map() }), Ge = (e, t) => {
18
+ We.byApi.set(e, t);
19
+ }, Ke = (e) => We.byApi.get(e), qe = () => {
20
+ We.byApi.clear();
21
+ }, Je = {
22
+ runtime: { runPromiseExit: () => Promise.resolve(De.die(/* @__PURE__ */ Error("Voltro: mutations are not invokable during SSR"))) },
23
+ cache: new j(),
24
+ client: Ve,
27
25
  descriptors: {},
28
26
  inspectBaseUrl: "",
29
- errorBus: new S(),
30
- recovery: new E("ssr")
31
- }, Je = {
27
+ errorBus: new g(),
28
+ recovery: new m("ssr")
29
+ }, Ye = {
32
30
  get: (e) => {
33
- let t = Ge(e);
34
- return t === void 0 ? qe : {
35
- ...qe,
31
+ let t = Ke(e);
32
+ return t === void 0 ? Je : {
33
+ ...Je,
36
34
  descriptors: t
37
35
  };
38
36
  },
39
37
  names: []
40
- }, Ye = !1, Xe = !1, G = null, Ze = () => {
41
- Ye = !1, Xe = !1, G !== null && (clearTimeout(G), G = null);
42
- }, Qe = () => {
43
- let e = L(Re);
44
- return e ? (Xe || (Xe = !0, G !== null && (clearTimeout(G), G = null)), e) : (globalThis.window !== void 0 && !Ye && !Xe && G === null && process.env.NODE_ENV !== "production" && (G = setTimeout(() => {
45
- G = null, !(Ye || Xe) && (Ye = !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>."));
46
- }, 0)), Je);
38
+ }, Xe = !1, Ze = !1, G = null, Qe = () => {
39
+ Xe = !1, Ze = !1, G !== null && (clearTimeout(G), G = null);
40
+ }, $e = () => {
41
+ let e = R(ze);
42
+ return e ? (Ze || (Ze = !0, G !== null && (clearTimeout(G), G = null)), e) : (globalThis.window !== void 0 && !Xe && !Ze && G === null && process.env.NODE_ENV !== "production" && (G = setTimeout(() => {
43
+ G = null, !(Xe || Ze) && (Xe = !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)), Ye);
47
45
  }, K = (e) => {
48
- let t = Qe(), n = t.demand;
49
- return R(() => {
46
+ let t = $e(), n = t.demand;
47
+ return z(() => {
50
48
  n?.(e);
51
49
  }, [n, e]), t.get(e);
52
- }, $e = (e) => typeof e.runtime?.runFork != "function", et = ({ apis: e, children: t, demand: n }) => {
53
- let r = z(() => ({
50
+ }, et = (e) => typeof e.runtime?.runFork != "function", tt = ({ apis: e, children: t, demand: n }) => {
51
+ let r = B(() => ({
54
52
  get: (t) => {
55
53
  let n = e.get(t);
56
54
  if (!n) {
@@ -62,45 +60,45 @@ var Re = F(null), ze = () => {
62
60
  names: Array.from(e.keys()),
63
61
  ...n === void 0 ? {} : { demand: n }
64
62
  }), [e]);
65
- return /* @__PURE__ */ Pe(Re.Provider, {
63
+ return /* @__PURE__ */ Fe(ze.Provider, {
66
64
  value: r,
67
65
  children: t
68
66
  });
69
- }, tt = Symbol.for("@voltro/client/storeStorageProvider"), nt = () => {
70
- let e = globalThis, t = e[tt];
67
+ }, nt = Symbol.for("@voltro/client/storeStorageProvider"), rt = () => {
68
+ let e = globalThis, t = e[nt];
71
69
  if (t !== void 0) return t;
72
70
  let n = {
73
71
  provider: void 0,
74
72
  used: !1
75
73
  };
76
- return e[tt] = n, n;
77
- }, rt = (e) => {
74
+ return e[nt] = n, n;
75
+ }, it = (e) => {
78
76
  if (typeof window > "u") return null;
79
77
  try {
80
78
  return (e === "session" ? window.sessionStorage : window.localStorage) ?? null;
81
79
  } catch {
82
80
  return null;
83
81
  }
84
- }, it = (e) => {
85
- let t = nt();
86
- 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;
87
82
  }, at = (e) => {
88
- let t = nt();
89
- return t.used = !0, (t.provider ?? rt)(e);
90
- }, ot = () => {
91
- let e = nt();
83
+ let t = rt();
84
+ 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
+ }, ot = (e) => {
86
+ let t = rt();
87
+ return t.used = !0, (t.provider ?? it)(e);
88
+ }, st = () => {
89
+ let e = rt();
92
90
  e.provider = void 0, e.used = !1;
93
- }, st = (e, t) => {
91
+ }, ct = (e, t) => {
94
92
  if (Object.is(e, t)) return !0;
95
93
  if (typeof e != "object" || typeof t != "object" || e === null || t === null || Array.isArray(e) !== Array.isArray(t)) return !1;
96
94
  let n = Object.keys(e), r = Object.keys(t);
97
95
  if (n.length !== r.length) return !1;
98
96
  for (let r of n) if (!Object.prototype.hasOwnProperty.call(t, r) || !Object.is(e[r], t[r])) return !1;
99
97
  return !0;
100
- }, ct = 50, lt = /* @__PURE__ */ new Set(), ut = (e, t) => {
101
- lt.has(e) || (lt.add(e), console.warn(t));
102
- }, dt = "\0global", ft = null, pt = (e, t, n) => {
103
- let r = ft?.() ?? null;
98
+ }, lt = 50, ut = /* @__PURE__ */ new Set(), dt = (e, t) => {
99
+ ut.has(e) || (ut.add(e), console.warn(t));
100
+ }, ft = "\0global", pt = null, mt = (e, t, n) => {
101
+ let r = pt?.() ?? null;
104
102
  if (r === null) return n;
105
103
  let i = n;
106
104
  for (let n of r.seeds) n.store === e && n.key === t && (i = {
@@ -108,9 +106,9 @@ var Re = F(null), ze = () => {
108
106
  ...n.value
109
107
  });
110
108
  return i;
111
- }, mt = (e, t) => {
109
+ }, ht = (e, t) => {
112
110
  let n = e(), r = /* @__PURE__ */ new Set(), i = 0, a = 0, o, s, c = () => {
113
- if (i >= ct) throw i = 0, Error(`defineStore: notification depth exceeded ${ct} — 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.`);
111
+ if (i >= lt) throw i = 0, Error(`defineStore: notification depth exceeded ${lt} — 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.`);
114
112
  i += 1;
115
113
  try {
116
114
  for (let e of [...r]) e();
@@ -131,20 +129,20 @@ var Re = F(null), ze = () => {
131
129
  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}', () => { … })\`.`);
132
130
  if (--a, a > 0) return;
133
131
  let l = o, u = s;
134
- o = void 0, s = void 0, !st(l, n) && (t(l, n, u), c());
132
+ o = void 0, s = void 0, !ct(l, n) && (t(l, n, u), c());
135
133
  },
136
134
  set: (e, r) => {
137
135
  let i = typeof e == "function" ? e(n) : {
138
136
  ...n,
139
137
  ...e
140
138
  };
141
- if (st(i, n)) return;
139
+ if (ct(i, n)) return;
142
140
  let o = n;
143
141
  n = i, !(a > 0) && (t(o, i, r), c());
144
142
  },
145
143
  reset: () => {
146
144
  let r = e();
147
- if (st(r, n)) return;
145
+ if (ct(r, n)) return;
148
146
  let i = n;
149
147
  n = r, !(a > 0) && (t(i, r, "reset"), c());
150
148
  },
@@ -152,51 +150,51 @@ var Re = F(null), ze = () => {
152
150
  r.delete(e);
153
151
  })
154
152
  };
155
- }, ht = 200, gt = [], _t = /* @__PURE__ */ new Set(), vt = [], yt = () => vt, bt = (e) => (_t.add(e), () => {
156
- _t.delete(e);
157
- }), xt = () => {
158
- gt.length = 0, vt = [];
159
- }, St = (e, t) => {
160
- let n = gt[e];
153
+ }, gt = 200, _t = [], vt = /* @__PURE__ */ new Set(), yt = [], bt = () => yt, xt = (e) => (vt.add(e), () => {
154
+ vt.delete(e);
155
+ }), St = () => {
156
+ _t.length = 0, yt = [];
157
+ }, Ct = (e, t) => {
158
+ let n = _t[e];
161
159
  if (n === void 0) return !1;
162
- let r = Et.get(n.store);
160
+ let r = Dt.get(n.store);
163
161
  if (r === void 0) return !1;
164
162
  let i = t === "before" ? n.prev : n.next;
165
- wt = !0;
163
+ Tt = !0;
166
164
  try {
167
165
  r.set(() => i, n.key, `travel:${t}`);
168
166
  } finally {
169
- wt = !1;
167
+ Tt = !1;
170
168
  }
171
169
  return !0;
172
- }, Ct = !1, wt = !1, Tt = (e) => {
173
- gt.push(e), gt.length > ht && gt.shift(), vt = [...gt];
174
- for (let e of [..._t]) e();
175
- }, Et = /* @__PURE__ */ new Map(), Dt = /* @__PURE__ */ new Map(), Ot = 0, kt = !1, At = /* @__PURE__ */ new Map(), jt = () => (kt || (kt = !0, queueMicrotask(() => {
176
- Ot += 1, kt = !1;
177
- })), Ot), Mt = Nt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
178
- function Nt(e) {
170
+ }, wt = !1, Tt = !1, Et = (e) => {
171
+ _t.push(e), _t.length > gt && _t.shift(), yt = [..._t];
172
+ for (let e of [...vt]) e();
173
+ }, Dt = /* @__PURE__ */ new Map(), Ot = /* @__PURE__ */ new Map(), kt = 0, At = !1, jt = /* @__PURE__ */ new Map(), Mt = () => (At || (At = !0, queueMicrotask(() => {
174
+ kt += 1, At = !1;
175
+ })), kt), Nt = Pt(((/* @__PURE__ */ Error()).stack ?? "").split("\n")[1] ?? "") ?? "";
176
+ function Pt(e) {
179
177
  let t = e.trim().replace(/^at\s+/, ""), n = /\(([^()]+)\)\s*$/.exec(t)?.[1] ?? t;
180
178
  return n.length > 0 ? n : void 0;
181
179
  }
182
- var Pt = () => {
180
+ var Ft = () => {
183
181
  let e = (/* @__PURE__ */ Error()).stack;
184
182
  if (typeof e != "string") return "<unknown>";
185
183
  for (let t of e.split("\n").slice(1)) {
186
- let e = Nt(t);
184
+ let e = Pt(t);
187
185
  if (e === void 0) continue;
188
186
  let n = e.replace(/:\d+:\d+$/, "");
189
- if (Mt === "" || n !== Mt.replace(/:\d+:\d+$/, "")) return n;
187
+ if (Nt === "" || n !== Nt.replace(/:\d+:\d+$/, "")) return n;
190
188
  }
191
189
  return "<unknown>";
192
- }, Ft = () => [...Et.values()], It = (e, t, n) => {
193
- let r = Pt(), i = jt(), a = Et.get(e);
190
+ }, It = () => [...Dt.values()], Lt = (e, t, n) => {
191
+ let r = Ft(), i = Mt(), a = Dt.get(e);
194
192
  if (a !== void 0) {
195
- let t = Dt.get(e) ?? "<unknown>", n = At.get(e) === i;
193
+ let t = Ot.get(e) ?? "<unknown>", n = jt.get(e) === i;
196
194
  if (r !== "<unknown>" && r === t && !n) return a;
197
195
  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}`);
198
196
  }
199
- let o = n?.persist, s = () => at(o?.storage === "session" ? "session" : "local"), c = () => {
197
+ let o = n?.persist, s = () => ot(o?.storage === "session" ? "session" : "local"), c = () => {
200
198
  let e = s();
201
199
  if (e === null || o === void 0) return;
202
200
  let t;
@@ -221,28 +219,28 @@ var Pt = () => {
221
219
  t.setItem(o.key, JSON.stringify(n));
222
220
  } catch {}
223
221
  }, u = /* @__PURE__ */ new Map(), d = (n) => {
224
- let r = n ?? dt, i = u.get(r);
222
+ let r = n ?? ft, i = u.get(r);
225
223
  if (i === void 0) {
226
224
  let a = n;
227
- i = mt(o !== void 0 && n === void 0 ? () => {
225
+ i = ht(o !== void 0 && n === void 0 ? () => {
228
226
  let e = t();
229
227
  return f = e, {
230
228
  ...e,
231
229
  ...c() ?? {}
232
230
  };
233
231
  } : t, (t, n, r) => {
234
- if (o !== void 0 && a === void 0 && l(n), !Ct && !wt) {
232
+ if (o !== void 0 && a === void 0 && l(n), !wt && !Tt) {
235
233
  let e = m(a);
236
234
  e.steps.length = e.cursor, e.steps.push({
237
235
  prev: t,
238
236
  next: n
239
237
  }), e.steps.length > h && e.steps.shift(), e.cursor = e.steps.length;
240
238
  }
241
- Tt({
239
+ Et({
242
240
  store: e,
243
241
  ...a === void 0 ? {} : { key: a },
244
242
  ...r === void 0 ? {} : { label: r },
245
- ...Ct || wt ? { isUndo: !0 } : {},
243
+ ...wt || Tt ? { isUndo: !0 } : {},
246
244
  prev: t,
247
245
  next: n,
248
246
  at: Date.now()
@@ -251,7 +249,7 @@ var Pt = () => {
251
249
  }
252
250
  return i;
253
251
  }, f, p = /* @__PURE__ */ new Map(), m = (e) => {
254
- let t = e ?? dt, n = p.get(t);
252
+ let t = e ?? ft, n = p.get(t);
255
253
  return n === void 0 && (n = {
256
254
  steps: [],
257
255
  cursor: 0
@@ -271,24 +269,24 @@ var Pt = () => {
271
269
  }, b = {
272
270
  name: e,
273
271
  use: (t, n) => {
274
- let r = d(n?.key), i = B(t);
272
+ let r = d(n?.key), i = V(t);
275
273
  i.current = t;
276
- let a = B(n?.equals);
274
+ let a = V(n?.equals);
277
275
  a.current = n?.equals;
278
- let o = B({
276
+ let o = V({
279
277
  state: void 0,
280
278
  value: void 0,
281
279
  has: !1
282
- }), s = I((t) => {
280
+ }), s = L((t) => {
283
281
  let n = o.current;
284
282
  if (n.has && Object.is(n.state, t)) return n.value;
285
283
  let r = i.current(t), s = a.current, c = n.has && (s ? s(n.value, r) : Object.is(n.value, r));
286
- if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && st(n.value, r)) {
284
+ if (process.env.NODE_ENV !== "production" && s === void 0 && n.has && !c && typeof r == "object" && r && ct(n.value, r)) {
287
285
  let t = !0;
288
286
  try {
289
287
  t = !Object.is(i.current(n.state), n.value);
290
288
  } catch {}
291
- ut(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.`);
289
+ dt(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.`);
292
290
  }
293
291
  let l = c ? n.value : r;
294
292
  return o.current = {
@@ -296,7 +294,7 @@ var Pt = () => {
296
294
  value: l,
297
295
  has: !0
298
296
  }, l;
299
- }, []), c = n?.key, l = n?.retain === !0, u = I((e) => {
297
+ }, []), c = n?.key, l = n?.retain === !0, u = L((e) => {
300
298
  let t = r.subscribe(e);
301
299
  return c !== void 0 && !l && v(c), () => {
302
300
  t(), c !== void 0 && !l && y(c);
@@ -305,12 +303,12 @@ var Pt = () => {
305
303
  r,
306
304
  c,
307
305
  l
308
- ]), p = I(() => s(r.get()), [r, s]), m = I(() => s(pt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
306
+ ]), p = L(() => s(r.get()), [r, s]), m = L(() => s(mt(e, n?.key, n?.key === void 0 && f !== void 0 ? f : r.get())), [
309
307
  r,
310
308
  n?.key,
311
309
  s
312
- ]), h = H(u, p, m);
313
- return xe(h), h;
310
+ ]), h = we(u, p, m);
311
+ return Se(h), h;
314
312
  },
315
313
  instance: d,
316
314
  get: (e) => d(e).get(),
@@ -323,11 +321,11 @@ var Pt = () => {
323
321
  undo: (e) => {
324
322
  let t = m(e);
325
323
  if (t.cursor === 0) return !1;
326
- --t.cursor, Ct = !0;
324
+ --t.cursor, wt = !0;
327
325
  try {
328
326
  d(e).set(() => t.steps[t.cursor].prev, "undo");
329
327
  } finally {
330
- Ct = !1;
328
+ wt = !1;
331
329
  }
332
330
  return !0;
333
331
  },
@@ -335,11 +333,11 @@ var Pt = () => {
335
333
  let t = m(e);
336
334
  if (t.cursor >= t.steps.length) return !1;
337
335
  let n = t.steps[t.cursor];
338
- t.cursor += 1, Ct = !0;
336
+ t.cursor += 1, wt = !0;
339
337
  try {
340
338
  d(e).set(() => n.next, "redo");
341
339
  } finally {
342
- Ct = !1;
340
+ wt = !1;
343
341
  }
344
342
  return !0;
345
343
  },
@@ -351,131 +349,131 @@ var Pt = () => {
351
349
  release: (e) => {
352
350
  u.delete(e), p.delete(e);
353
351
  },
354
- keys: () => [...u.keys()].filter((e) => e !== dt)
352
+ keys: () => [...u.keys()].filter((e) => e !== ft)
355
353
  };
356
- return Et.set(e, b), Dt.set(e, r), At.set(e, i), b;
357
- }, Lt = () => {
358
- Et.clear(), Dt.clear(), At.clear(), lt.clear();
359
- }, Rt = () => ({ seeds: [] }), zt = (e) => {
360
- ft = e;
361
- }, Bt = (e, t, n) => {
362
- let r = ft?.() ?? null;
354
+ return Dt.set(e, b), Ot.set(e, r), jt.set(e, i), b;
355
+ }, Rt = () => {
356
+ Dt.clear(), Ot.clear(), jt.clear(), ut.clear();
357
+ }, zt = () => ({ seeds: [] }), Bt = (e) => {
358
+ pt = e;
359
+ }, Vt = (e, t, n) => {
360
+ let r = pt?.() ?? null;
363
361
  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.)`);
364
362
  r.seeds.push({
365
363
  store: e.name,
366
364
  ...n?.key === void 0 ? {} : { key: n.key },
367
365
  value: t
368
366
  });
369
- }, Vt = (e) => {
367
+ }, Ht = (e) => {
370
368
  if (e !== void 0) for (let t of e) {
371
- let e = Et.get(t.store);
369
+ let e = Dt.get(t.store);
372
370
  e !== void 0 && e.set(t.value, t.key);
373
371
  }
374
- }, Ht = Object.freeze({
372
+ }, Ut = Object.freeze({
375
373
  data: void 0,
376
374
  revision: -1,
377
375
  emittedAt: void 0,
378
376
  error: void 0,
379
377
  pendingPatches: 0
380
- }), Ut = () => Ht;
378
+ }), Wt = () => Ut;
381
379
  function q(e, t, n = {}, r = {}) {
382
- let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u = B(n);
380
+ let i = r.skip === !0, { runtime: a, cache: o, client: s, descriptors: c } = K(e), l = c[t]?.source, u = V(n);
383
381
  u.current = n;
384
- let d = B(s);
382
+ let d = V(s);
385
383
  d.current = s;
386
- let f = z(() => JSON.stringify(Object.entries(n).sort(([e], [t]) => e.localeCompare(t))), [n]), p = z(() => {
384
+ let f = B(() => JSON.stringify(Object.entries(n).sort(([e], [t]) => e.localeCompare(t))), [n]), p = B(() => {
387
385
  let e = u.current;
388
386
  return {
389
387
  queryKey: [t, e],
390
- fetch: () => h(d.current, t)(e)
388
+ fetch: () => C(d.current, t)(e)
391
389
  };
392
- }, [t, f]), m = p.queryKey, g = I((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
390
+ }, [t, f]), m = p.queryKey, h = L((e) => i ? () => {} : o.subscribe(p.queryKey, p.fetch, a, e, l === void 0 ? {} : { source: l }).unsubscribe, [
393
391
  o,
394
392
  a,
395
393
  l,
396
394
  i,
397
395
  p
398
- ]), _ = I(() => i ? Ht : o.peek(m), [
396
+ ]), g = L(() => i ? Ut : o.peek(m), [
399
397
  o,
400
398
  i,
401
399
  m
402
- ]), v = H(g, _, Ut), y = v.data !== void 0, b = y && (Array.isArray(v.data) ? v.data.length === 0 : v.data === null), x = {
403
- revision: v.revision,
404
- emittedAt: v.emittedAt,
405
- error: v.error,
406
- pendingPatches: v.pendingPatches
400
+ ]), _ = we(h, g, Wt), v = _.data !== void 0, y = v && (Array.isArray(_.data) ? _.data.length === 0 : _.data === null), b = {
401
+ revision: _.revision,
402
+ emittedAt: _.emittedAt,
403
+ error: _.error,
404
+ pendingPatches: _.pendingPatches
407
405
  };
408
406
  if (r.initialSnapshot !== void 0) {
409
407
  let e = Array.isArray(r.initialSnapshot) ? r.initialSnapshot.length === 0 : r.initialSnapshot === null;
410
408
  return {
411
- ...x,
412
- data: y ? v.data : r.initialSnapshot,
409
+ ...b,
410
+ data: v ? _.data : r.initialSnapshot,
413
411
  loading: !1,
414
412
  idle: i,
415
- isEmpty: y ? b : e,
413
+ isEmpty: v ? y : e,
416
414
  failed: !1
417
415
  };
418
416
  }
419
417
  return r.fallback === void 0 ? i ? {
420
- ...x,
418
+ ...b,
421
419
  data: void 0,
422
420
  loading: !1,
423
421
  isEmpty: !1,
424
422
  idle: !0,
425
423
  failed: !1
426
- } : y ? {
427
- ...x,
428
- data: v.data,
424
+ } : v ? {
425
+ ...b,
426
+ data: _.data,
429
427
  loading: !1,
430
- isEmpty: b,
428
+ isEmpty: y,
431
429
  idle: !1,
432
430
  failed: !1
433
- } : x.error === void 0 ? {
434
- ...x,
431
+ } : b.error === void 0 ? {
432
+ ...b,
435
433
  data: void 0,
436
434
  loading: !0,
437
435
  isEmpty: !1,
438
436
  idle: !1,
439
437
  failed: !1
440
438
  } : {
441
- ...x,
439
+ ...b,
442
440
  data: void 0,
443
441
  loading: !1,
444
442
  isEmpty: !1,
445
443
  idle: !1,
446
444
  failed: !0,
447
- error: x.error
445
+ error: b.error
448
446
  } : {
449
- ...x,
450
- data: y ? v.data : r.fallback,
451
- loading: !y && !i,
447
+ ...b,
448
+ data: v ? _.data : r.fallback,
449
+ loading: !v && !i,
452
450
  idle: i,
453
- isEmpty: b,
454
- failed: !y && x.error !== void 0
451
+ isEmpty: y,
452
+ failed: !v && b.error !== void 0
455
453
  };
456
454
  }
457
455
  //#endregion
458
456
  //#region src/awaitResolvedApi.ts
459
- var Wt = 15e3, J = async (e, t, n) => {
460
- if (!$e(e.current)) return e.current;
461
- let r = Date.now() + Wt;
462
- for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !$e(e.current)) return e.current;
463
- throw Error(`Voltro: the api "${t}" did not resolve within ${Wt}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.`);
464
- }, Gt = 100, Y = [], Kt = /* @__PURE__ */ new Set(), qt = [], Jt = () => {
465
- qt = Y.slice();
466
- }, Yt = () => {
467
- Jt();
468
- for (let e of Kt) try {
457
+ var Gt = 15e3, J = async (e, t, n) => {
458
+ if (!et(e.current)) return e.current;
459
+ let r = Date.now() + Gt;
460
+ for (; Date.now() < r;) if (await new Promise((e) => setTimeout(e, 16)), !et(e.current)) return e.current;
461
+ throw Error(`Voltro: the api "${t}" did not resolve within ${Gt}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.`);
462
+ }, Kt = 100, Y = [], qt = /* @__PURE__ */ new Set(), Jt = [], Yt = () => {
463
+ Jt = Y.slice();
464
+ }, Xt = () => {
465
+ Yt();
466
+ for (let e of qt) try {
469
467
  e();
470
468
  } catch {}
471
- }, Xt = (e) => {
469
+ }, Zt = (e) => {
472
470
  let t = {
473
471
  ...e,
474
472
  kind: e.kind ?? "mutation",
475
473
  status: "pending",
476
474
  startedAt: Date.now()
477
475
  };
478
- Y.unshift(t), Y.length > Gt && (Y.length = Gt), Yt();
476
+ Y.unshift(t), Y.length > Kt && (Y.length = Kt), Xt();
479
477
  }, X = (e, t) => {
480
478
  let n = Y.findIndex((t) => t.id === e);
481
479
  if (n === -1) return;
@@ -492,43 +490,40 @@ var Wt = 15e3, J = async (e, t, n) => {
492
490
  error: t.error,
493
491
  settledAt: i,
494
492
  durationMs: i - r.startedAt
495
- }, Yt();
496
- }, Zt = () => qt, Qt = (e) => (Kt.add(e), () => {
497
- Kt.delete(e);
498
- }), $t = () => {
499
- Y.length !== 0 && (Y.length = 0, Yt());
500
- }, en = /* @__PURE__ */ new WeakMap(), tn = (e, t) => {
493
+ }, Xt();
494
+ }, Qt = () => Jt, $t = (e) => (qt.add(e), () => {
495
+ qt.delete(e);
496
+ }), en = () => {
497
+ Y.length !== 0 && (Y.length = 0, Xt());
498
+ }, tn = /* @__PURE__ */ new WeakMap(), nn = (e, t) => {
501
499
  let n = Object.freeze({
502
500
  apiName: e,
503
501
  kind: "connection-setup"
504
502
  });
505
- return en.set(n, t), n;
506
- }, nn = (e, t) => {
507
- let n = en.get(e);
503
+ return tn.set(n, t), n;
504
+ }, rn = (e, t) => {
505
+ let n = tn.get(e);
508
506
  if (n === void 0 || e.apiName !== t) throw Error(`Voltro: connection setup must belong to api "${t}"`);
509
507
  return n;
510
- }, rn = /* @__PURE__ */ new WeakMap(), an = (e, t) => {
511
- rn.set(e, t);
512
- }, on = (e) => rn.get(e)?.capture(), sn = 0, cn = () => {
513
- let e = typeof crypto < "u" ? crypto : void 0;
514
- return e && typeof e.randomUUID == "function" ? e.randomUUID() : `idem_${Date.now().toString(36)}_${sn += 1}`;
515
- }, ln = (e, t) => e.pipe(U.locallyWith(je.currentHeaders, (e) => Ae.set(e, "idempotency-key", t))), un = class extends Error {
508
+ }, an = /* @__PURE__ */ new WeakMap(), on = (e, t) => {
509
+ an.set(e, t);
510
+ }, sn = (e) => an.get(e)?.capture(), cn = class extends Error {
516
511
  reason;
517
512
  _tag = "MutationSerialExecutionError";
518
513
  constructor(e) {
519
514
  super(`Serial mutation cannot start: ${e}`), this.reason = e, this.name = "MutationSerialExecutionError";
520
515
  }
521
- }, dn = (e = 32) => {
516
+ }, ln = (e = 32) => {
522
517
  if (!Number.isSafeInteger(e) || e < 1) throw RangeError("maxPending must be a positive safe integer");
523
518
  let t = /* @__PURE__ */ new WeakMap(), n = 0;
524
519
  return { reserve(r, i) {
525
- if (typeof r != "string" || r.length === 0) throw new un("invalid-key");
526
- if (i.aborted) throw new un("scope-changed");
520
+ if (typeof r != "string" || r.length === 0) throw new cn("invalid-key");
521
+ if (i.aborted) throw new cn("scope-changed");
527
522
  let a = t.get(i);
528
523
  a === void 0 && (a = /* @__PURE__ */ new Map(), t.set(i, a));
529
524
  let o = a, s = a.get(r);
530
- if (s?.blocked.signal.aborted) throw new un("unknown-predecessor");
531
- if (n >= e) throw new un("capacity");
525
+ if (s?.blocked.signal.aborted) throw new cn("unknown-predecessor");
526
+ if (n >= e) throw new cn("capacity");
532
527
  s === void 0 && (s = {
533
528
  semaphore: U.unsafeMakeSemaphore(1),
534
529
  calls: 0,
@@ -539,8 +534,8 @@ var Wt = 15e3, J = async (e, t, n) => {
539
534
  let l = new AbortController(), u = () => l.abort();
540
535
  i.addEventListener("abort", u, { once: !0 }), c.blocked.signal.addEventListener("abort", u, { once: !0 });
541
536
  let d = () => {
542
- if (i.aborted) throw new un("scope-changed");
543
- if (c.blocked.signal.aborted) throw new un("unknown-predecessor");
537
+ if (i.aborted) throw new cn("scope-changed");
538
+ if (c.blocked.signal.aborted) throw new cn("unknown-predecessor");
544
539
  }, f = U.runPromise(c.semaphore.take(1), { signal: l.signal }), p = f.then(() => {
545
540
  d();
546
541
  }, (e) => {
@@ -560,12 +555,12 @@ var Wt = 15e3, J = async (e, t, n) => {
560
555
  }
561
556
  };
562
557
  } };
563
- }, fn = /* @__PURE__ */ new WeakMap(), pn = (e, t, n) => {
564
- let r = fn.get(e);
565
- r === void 0 && (r = /* @__PURE__ */ new Map(), fn.set(e, r));
558
+ }, un = /* @__PURE__ */ new WeakMap(), dn = (e, t, n) => {
559
+ let r = un.get(e);
560
+ r === void 0 && (r = /* @__PURE__ */ new Map(), un.set(e, r));
566
561
  let i = r.get(t);
567
- return i === void 0 && (i = dn(n), r.set(t, i)), i;
568
- }, mn = (e, t) => {
562
+ return i === void 0 && (i = ln(n), r.set(t, i)), i;
563
+ }, fn = (e, t) => {
569
564
  if (t === void 0 || typeof e != "object" || !e) return e;
570
565
  try {
571
566
  Object.defineProperty(e, "__voltroTraceId", {
@@ -575,188 +570,188 @@ var Wt = 15e3, J = async (e, t, n) => {
575
570
  });
576
571
  } catch {}
577
572
  return e;
578
- }, hn, gn = (e) => {
579
- hn = e;
580
- }, _n = () => hn, vn = (e, t, n) => typeof e == "function" ? e(t, n) : e, yn = 0, bn = () => `mut_${++yn}`, xn = (e, t) => ({
573
+ }, pn, mn = (e) => {
574
+ pn = e;
575
+ }, hn = () => pn, gn = (e, t, n) => typeof e == "function" ? e(t, n) : e, _n = 0, vn = () => `mut_${++_n}`, yn = (e, t) => ({
581
576
  update: (n, r) => {
582
577
  e.update(n, r, t);
583
578
  },
584
579
  forTag: (n, r) => e.forTag(n, r, t)
585
- }), Sn = (e, t) => {
586
- let n = K(e), { descriptors: r } = n, a = B(n);
587
- a.current = n;
588
- let o = r[t], s = o?.targets;
580
+ }), bn = (t, n) => {
581
+ let r = K(t), { descriptors: i } = r, a = V(r);
582
+ a.current = r;
583
+ let o = i[n], s = o?.targets;
589
584
  if (process.env.NODE_ENV !== "production") {
590
- let n = o?.kind;
591
- 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.`);
585
+ let e = o?.kind;
586
+ 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.`);
592
587
  }
593
- let [c, l] = V(!1), [f, p] = V(void 0), [m, g] = V(void 0), v = B(null), y = B(!1), b = B(0), x = I(async (n, r) => {
594
- let o = r?.onError !== void 0 || r?.notify?.error !== void 0, c = (e) => {
595
- r?.onError?.(e, n);
596
- let t = vn(r?.notify?.error, e, n);
597
- t !== void 0 && hn?.error(t);
588
+ let [c, l] = H(!1), [d, f] = H(void 0), [p, m] = H(void 0), h = V(null), g = V(!1), y = V(0), b = L(async (r, i) => {
589
+ let o = i?.onError !== void 0 || i?.notify?.error !== void 0, c = (e) => {
590
+ i?.onError?.(e, r);
591
+ let t = gn(i?.notify?.error, e, r);
592
+ t !== void 0 && pn?.error(t);
598
593
  };
599
- b.current += 1;
600
- let f = () => l(--b.current > 0);
601
- l(!0), p(void 0);
602
- let m, S, w, T, E;
594
+ y.current += 1;
595
+ let d = () => l(--y.current > 0);
596
+ l(!0), f(void 0);
597
+ let p, x, S, E, D;
603
598
  try {
604
- T = on(x);
605
- let r = a.current.descriptors[t]?.serialize;
606
- if (r !== void 0) {
607
- let i = a.current, o = i.recovery ?? d(i.errorBus, e);
608
- E = pn(i.descriptors, t, r.maxPending ?? 32).reserve(r.key(n), o.subjectSignal);
599
+ E = sn(b);
600
+ let e = a.current.descriptors[n]?.serialize;
601
+ if (e !== void 0) {
602
+ let i = a.current, o = i.recovery ?? w(i.errorBus, t);
603
+ D = dn(i.descriptors, n, e.maxPending ?? 32).reserve(e.key(r), o.subjectSignal);
609
604
  }
610
- ({runtime: m, cache: S, client: w} = await J(a, e, t));
605
+ ({runtime: p, cache: x, client: S} = await J(a, t, n));
611
606
  } catch (e) {
612
- if (E?.release(), f(), p(e), a.current.errorBus.emit({
607
+ if (D?.release(), d(), f(e), a.current.errorBus.emit({
613
608
  source: "mutation",
614
- tag: t,
609
+ tag: n,
615
610
  error: e,
616
611
  kind: "client",
617
612
  outcome: "not-started"
618
613
  }), o) return c(e);
619
614
  throw e;
620
615
  }
621
- let D = bn(), ee = r?.idempotencyKey ?? cn();
622
- Xt({
623
- id: D,
624
- apiName: e,
625
- tag: t,
626
- input: n
616
+ let O = vn(), k = i?.idempotencyKey ?? T();
617
+ Zt({
618
+ id: O,
619
+ apiName: t,
620
+ tag: n,
621
+ input: r
627
622
  });
628
- let te = v.current, O = y.current;
623
+ let A = h.current, j = g.current;
629
624
  try {
630
- te ? te(xn(S, D), n) : !O && s && s.length > 0 && S.autoApply(s, n, D);
625
+ A ? A(yn(x, O), r) : !j && s && s.length > 0 && x.autoApply(s, r, O);
631
626
  } catch (e) {
632
- if (E?.release(), p(e), f(), S.revertByMutation(D), X(D, {
627
+ if (D?.release(), f(e), d(), x.revertByMutation(O), X(O, {
633
628
  status: "error",
634
629
  error: e
635
630
  }), o) return c(e);
636
631
  throw e;
637
632
  }
638
- let k, A = !1, ne, j, re, M = Date.now();
633
+ let M, N = !1, te, P, ne, F = Date.now();
639
634
  try {
640
- if (E) {
641
- await E.ready, E.assertActive();
642
- let n = await J(a, e, t);
643
- m = n.runtime, w = n.client;
635
+ if (D) {
636
+ await D.ready, D.assertActive();
637
+ let e = await J(a, t, n);
638
+ p = e.runtime, S = e.client;
644
639
  }
645
- let o = async (r, i, o, s) => {
646
- let c = u(r), l = c?.getSnapshot();
647
- j = c === void 0 ? void 0 : () => a.current.runtime === r && l !== void 0 && c.getSnapshot() === l, s?.(), E?.assertActive();
648
- let d = T === void 0 ? void 0 : await T.prepare(r, i);
640
+ let o = async (e, i, o, s) => {
641
+ let c = ee(e), l = c?.getSnapshot();
642
+ P = c === void 0 ? void 0 : () => a.current.runtime === e && l !== void 0 && c.getSnapshot() === l, s?.(), D?.assertActive();
643
+ let d = E === void 0 ? void 0 : await E.prepare(e, i);
649
644
  l = c?.getSnapshot(), s?.();
650
- let f = ln(h(i, t)(n), ee), p = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
651
- k = e.traceId, _({
645
+ let f = C(i, n), p = _(f(r), k), m = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
646
+ M = e.traceId, v({
652
647
  traceId: e.traceId,
653
648
  spanId: e.spanId,
654
649
  source: "mutation",
655
- tag: t
650
+ tag: n
656
651
  });
657
652
  })), U.catchAll(() => U.void), U.zipRight(U.try({
658
653
  try: () => {
659
- s?.(), E?.assertActive(), A = !0;
654
+ s?.(), D?.assertActive(), N = !0;
660
655
  },
661
656
  catch: (e) => e
662
- })), U.zipRight(f)).pipe(U.withSpan(`client.mutation.${t}`, { attributes: {
663
- "voltro.api": e,
664
- "voltro.mutationId": D,
665
- "rpc.tag": t,
657
+ })), U.zipRight(p)).pipe(U.withSpan(`client.mutation.${n}`, { attributes: {
658
+ "voltro.api": t,
659
+ "voltro.mutationId": O,
660
+ "rpc.tag": n,
666
661
  "voltro.replay": o
667
662
  } }));
668
- return d === void 0 ? C(r, p) : d.run(p);
663
+ return d === void 0 ? u(e, m) : d.run(m);
669
664
  }, s;
670
665
  try {
671
- s = await o(m, w, !1);
672
- } catch (n) {
673
- let r = i(n, A ? "handler" : "client"), c = mn(n, k);
674
- r === "transport" && (a.current.errorBus.emit({
666
+ s = await o(p, S, !1);
667
+ } catch (r) {
668
+ let i = e(r, N ? "handler" : "client"), c = fn(r, M);
669
+ i === "transport" && (a.current.errorBus.emit({
675
670
  source: "mutation",
676
- tag: t,
671
+ tag: n,
677
672
  error: c,
678
- kind: r,
679
- ...j === void 0 ? {} : { affectsTransport: j() },
680
- outcome: A ? "unknown" : "not-started",
681
- ...k === void 0 ? {} : { traceId: k }
682
- }), ne = c);
683
- let l = a.current, u = l.recovery ?? d(l.errorBus, e), f = r === "transport" ? u.reserveMutationReplay(M) : void 0;
684
- if (f === void 0) throw c;
673
+ kind: i,
674
+ ...P === void 0 ? {} : { affectsTransport: P() },
675
+ outcome: N ? "unknown" : "not-started",
676
+ ...M === void 0 ? {} : { traceId: M }
677
+ }), te = c);
678
+ let l = a.current, u = l.recovery ?? w(l.errorBus, t), d = i === "transport" ? u.reserveMutationReplay(F) : void 0;
679
+ if (d === void 0) throw c;
685
680
  try {
686
- if (!await u.waitForMutationReplaySupport(M) || !await u.waitForProtocolReady(M) || !f.isValid()) throw c;
687
- let n = () => {
688
- if (!f.isValid()) throw c;
681
+ if (!await u.waitForMutationReplaySupport(F) || !await u.waitForProtocolReady(F) || !d.isValid()) throw c;
682
+ let e = () => {
683
+ if (!d.isValid()) throw c;
689
684
  };
690
685
  for (;;) {
691
- n();
692
- let r = await J(a, e, t);
686
+ e();
687
+ let r = await J(a, t, n);
693
688
  try {
694
- s = await o(r.runtime, r.client, !0, n);
689
+ s = await o(r.runtime, r.client, !0, e);
695
690
  break;
696
- } catch (e) {
697
- let t = e;
698
- if (t?._tag !== "MutationInFlight") throw e;
699
- let r = typeof t.retryAfterMs == "number" && Number.isFinite(t.retryAfterMs) && t.retryAfterMs > 0 ? t.retryAfterMs : 1e3;
700
- if (r >= u.replayWindowRemaining(M)) throw e;
701
- await new Promise((e) => setTimeout(e, r)), n();
691
+ } catch (t) {
692
+ let n = t;
693
+ if (n?._tag !== "MutationInFlight") throw t;
694
+ let r = typeof n.retryAfterMs == "number" && Number.isFinite(n.retryAfterMs) && n.retryAfterMs > 0 ? n.retryAfterMs : 1e3;
695
+ if (r >= u.replayWindowRemaining(F)) throw t;
696
+ await new Promise((e) => setTimeout(e, r)), e();
702
697
  }
703
698
  }
704
699
  } finally {
705
- f.release();
700
+ d.release();
706
701
  }
707
702
  }
708
- g(s), X(D, {
703
+ m(s), X(O, {
709
704
  status: "success",
710
705
  output: s
711
706
  }), a.current.errorBus.emitSuccess({
712
707
  source: "mutation",
713
- tag: t
714
- }), S.confirmByMutation(D), r?.onSuccess?.(s, n);
715
- let c = vn(r?.notify?.success, s, n);
716
- return c !== void 0 && hn?.success(c), s;
717
- } catch (e) {
718
- A && (ne !== void 0 || i(e, "handler") === "transport") && (re = "unknown");
719
- let n = mn(e, k);
720
- if (p(n), X(D, {
708
+ tag: n
709
+ }), x.confirmByMutation(O), i?.onSuccess?.(s, r);
710
+ let c = gn(i?.notify?.success, s, r);
711
+ return c !== void 0 && pn?.success(c), s;
712
+ } catch (t) {
713
+ N && (te !== void 0 || e(t, "handler") === "transport") && (ne = "unknown");
714
+ let r = fn(t, M);
715
+ if (f(r), X(O, {
721
716
  status: "error",
722
- error: n
723
- }), S.revertByMutation(D), Object.is(ne, n) || a.current.errorBus.emit({
717
+ error: r
718
+ }), x.revertByMutation(O), Object.is(te, r) || a.current.errorBus.emit({
724
719
  source: "mutation",
725
- tag: t,
726
- error: n,
727
- kind: A ? i(e, "handler") : "client",
728
- ...j === void 0 ? {} : { affectsTransport: j() },
729
- outcome: A && i(e, "handler") === "transport" ? "unknown" : A ? "known" : "not-started",
730
- ...k === void 0 ? {} : { traceId: k }
731
- }), o) return c(n);
732
- throw n;
720
+ tag: n,
721
+ error: r,
722
+ kind: N ? e(t, "handler") : "client",
723
+ ...P === void 0 ? {} : { affectsTransport: P() },
724
+ outcome: N && e(t, "handler") === "transport" ? "unknown" : N ? "known" : "not-started",
725
+ ...M === void 0 ? {} : { traceId: M }
726
+ }), o) return c(r);
727
+ throw r;
733
728
  } finally {
734
- E?.release(re), f();
729
+ D?.release(ne), d();
735
730
  }
736
731
  }, [
737
- e,
738
732
  t,
733
+ n,
739
734
  s
740
735
  ]);
741
- return z(() => {
742
- let t = {
743
- mutate: x,
736
+ return B(() => {
737
+ let e = {
738
+ mutate: b,
744
739
  pending: c,
745
- error: f,
746
- data: m,
747
- withOptimistic: (e) => (v.current = e, t),
748
- withoutOptimistic: () => (y.current = !0, t),
749
- withConnectionSetup: (n) => (an(x, nn(n, e)), t)
740
+ error: d,
741
+ data: p,
742
+ withOptimistic: (t) => (h.current = t, e),
743
+ withoutOptimistic: () => (g.current = !0, e),
744
+ withConnectionSetup: (n) => (on(b, rn(n, t)), e)
750
745
  };
751
- return t;
746
+ return e;
752
747
  }, [
753
- x,
748
+ b,
754
749
  c,
755
- f,
756
- m,
757
- e
750
+ d,
751
+ p,
752
+ t
758
753
  ]);
759
- }, Cn = (e, t) => {
754
+ }, xn = (e, t) => {
760
755
  if (t === void 0 || typeof e != "object" || !e) return e;
761
756
  try {
762
757
  Object.defineProperty(e, "__voltroTraceId", {
@@ -766,90 +761,90 @@ var Wt = 15e3, J = async (e, t, n) => {
766
761
  });
767
762
  } catch {}
768
763
  return e;
769
- }, wn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Tn = 0, En = () => `act_${++Tn}`, Dn = (e, t) => {
770
- let n = K(e), { descriptors: r } = n, a = B(n);
771
- if (a.current = n, process.env.NODE_ENV !== "production") {
772
- let n = r[t]?.kind;
773
- 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.`);
764
+ }, Sn = (e, t, n) => typeof e == "function" ? e(t, n) : e, Cn = 0, wn = () => `act_${++Cn}`, Tn = (t, n) => {
765
+ let r = K(t), { descriptors: i } = r, a = V(r);
766
+ if (a.current = r, process.env.NODE_ENV !== "production") {
767
+ let e = i[n]?.kind;
768
+ 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.`);
774
769
  }
775
- let [o, s] = V(!1), [c, l] = V(void 0), [u, d] = V(void 0), f = I(async (n, r) => {
776
- let o = r?.onError !== void 0 || r?.notify?.error !== void 0;
770
+ let [o, s] = H(!1), [c, l] = H(void 0), [d, f] = H(void 0), p = L(async (r, i) => {
771
+ let o = i?.onError !== void 0 || i?.notify?.error !== void 0;
777
772
  s(!0), l(void 0);
778
- let c = En(), u = r?.idempotencyKey ?? cn();
779
- Xt({
773
+ let c = wn(), d = i?.idempotencyKey ?? T();
774
+ Zt({
780
775
  id: c,
781
- apiName: e,
782
- tag: t,
783
- input: n,
776
+ apiName: t,
777
+ tag: n,
778
+ input: r,
784
779
  kind: "action"
785
780
  });
786
- let f, p = !1;
781
+ let p, m = !1;
787
782
  try {
788
- let { runtime: i, client: o } = await J(a, e, t), s = h(o, t), l = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
789
- f = e.traceId, _({
783
+ let { runtime: e, client: o } = await J(a, t, n), s = C(o, n), l = U.currentSpan.pipe(U.tap((e) => U.sync(() => {
784
+ p = e.traceId, v({
790
785
  traceId: e.traceId,
791
786
  spanId: e.spanId,
792
787
  source: "action",
793
- tag: t
788
+ tag: n
794
789
  });
795
- })), U.catchAll(() => U.void), U.zipRight(ln(s(n), u))).pipe(U.withSpan(`client.action.${t}`, { attributes: {
796
- "voltro.api": e,
790
+ })), U.catchAll(() => U.void), U.zipRight(_(s(r), d))).pipe(U.withSpan(`client.action.${n}`, { attributes: {
791
+ "voltro.api": t,
797
792
  "voltro.actionId": c,
798
- "rpc.tag": t
793
+ "rpc.tag": n
799
794
  } }));
800
- p = !0;
801
- let m = await C(i, l);
802
- d(m), X(c, {
795
+ m = !0;
796
+ let h = await u(e, l);
797
+ f(h), X(c, {
803
798
  status: "success",
804
- output: m
799
+ output: h
805
800
  }), a.current.errorBus.emitSuccess({
806
801
  source: "action",
807
- tag: t
808
- }), r?.onSuccess?.(m, n);
809
- let g = wn(r?.notify?.success, m, n);
810
- return g !== void 0 && _n()?.success(g), m;
811
- } catch (e) {
812
- let s = Cn(e, f);
802
+ tag: n
803
+ }), i?.onSuccess?.(h, r);
804
+ let g = Sn(i?.notify?.success, h, r);
805
+ return g !== void 0 && hn()?.success(g), h;
806
+ } catch (t) {
807
+ let s = xn(t, p);
813
808
  if (l(s), X(c, {
814
809
  status: "error",
815
810
  error: s
816
811
  }), a.current.errorBus.emit({
817
812
  source: "action",
818
- tag: t,
813
+ tag: n,
819
814
  error: s,
820
- kind: p ? i(e, "handler") : "client",
821
- outcome: p && i(e, "handler") === "transport" ? "unknown" : p ? "known" : "not-started",
822
- ...f === void 0 ? {} : { traceId: f }
815
+ kind: m ? e(t, "handler") : "client",
816
+ outcome: m && e(t, "handler") === "transport" ? "unknown" : m ? "known" : "not-started",
817
+ ...p === void 0 ? {} : { traceId: p }
823
818
  }), o) {
824
- r?.onError?.(s, n);
825
- let e = wn(r?.notify?.error, s, n);
826
- e !== void 0 && _n()?.error(e);
819
+ i?.onError?.(s, r);
820
+ let e = Sn(i?.notify?.error, s, r);
821
+ e !== void 0 && hn()?.error(e);
827
822
  return;
828
823
  }
829
824
  throw s;
830
825
  } finally {
831
826
  s(!1);
832
827
  }
833
- }, [e, t]);
834
- return z(() => ({
835
- run: f,
828
+ }, [t, n]);
829
+ return B(() => ({
830
+ run: p,
836
831
  pending: o,
837
832
  error: c,
838
- lastResult: u
833
+ lastResult: d
839
834
  }), [
840
- f,
835
+ p,
841
836
  o,
842
837
  c,
843
- u
838
+ d
844
839
  ]);
845
- }, On = F(void 0), kn = (e) => be(On.Provider, { value: e.messages }, e.children), An = () => L(On), jn = Symbol.for("voltro.client.formEngine"), Mn = F(void 0), Nn = (e, t) => {
840
+ }, En = I(void 0), Dn = (e) => xe(En.Provider, { value: e.messages }, e.children), On = () => R(En), kn = Symbol.for("voltro.client.formEngine"), An = I(void 0), jn = (e, t) => {
846
841
  let n = e;
847
842
  for (let e of t.split(".")) {
848
843
  if (typeof n != "object" || !n) return;
849
844
  n = n[e];
850
845
  }
851
846
  return n;
852
- }, Pn = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), Fn = {
847
+ }, Mn = (e, t, n) => `vf-${e}-${t}-${n}`.replace(/[^a-zA-Z0-9_-]/g, "-"), Nn = {
853
848
  isTouched: !1,
854
849
  isBlurred: !1,
855
850
  isDirty: !1,
@@ -858,35 +853,35 @@ var Wt = 15e3, J = async (e, t, n) => {
858
853
  isValidating: !1,
859
854
  errorMap: {},
860
855
  errorSourceMap: {}
861
- }, In = (e, t) => {
856
+ }, Pn = (e, t) => {
862
857
  let n = e.find((e) => e.name === t);
863
858
  if (n !== void 0) return n;
864
859
  let r = /^(.+?)\.\d+\.(.+)$/.exec(t);
865
860
  if (r !== null) return e.find((e) => e.name === r[1] && e.widget === "array")?.item?.find((e) => e.name === r[2]);
866
- }, Ln = (e, t, n) => {
867
- 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 = Sn(e, a), c = n.schema ?? r.descriptors[a]?.input;
868
- 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.`), zn(e, o, n, c, i, s);
869
- }, Rn = (e) => {
870
- let t = B(void 0);
871
- return zn("local", Se(), {
861
+ }, Fn = (e, t, n) => {
862
+ let r = K(e), i = V(void 0), a = typeof t == "function" ? t(i.current?.state?.values ?? n.defaults ?? {}) : t, o = V(a).current, s = bn(e, a), c = n.schema ?? r.descriptors[a]?.input;
863
+ 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.`), Ln(e, o, n, c, i, s);
864
+ }, In = (e) => {
865
+ let t = V(void 0);
866
+ return Ln("local", Ce(), {
872
867
  ...e,
873
- onSubmit: async ({ input: t }) => e.onSubmit(await ke.decodeUnknownPromise(e.schema)(t))
868
+ onSubmit: async ({ input: t }) => e.onSubmit(await je.decodeUnknownPromise(e.schema)(t))
874
869
  }, e.schema, t);
875
- }, zn = (e, t, n, r, i, a) => {
876
- let o = z(() => r ? _e(r) : [], [r]), s = An(), c = n.messages ?? s, l = z(() => ({
870
+ }, Ln = (e, t, n, r, i, a) => {
871
+ let o = B(() => r ? ve(r) : [], [r]), s = On(), c = n.messages ?? s, l = B(() => ({
877
872
  ...n.locale === void 0 ? {} : { locale: n.locale },
878
873
  ...c === void 0 ? {} : { messages: c }
879
- }), [n.locale, c]), u = B(n.asyncFields);
874
+ }), [n.locale, c]), u = V(n.asyncFields);
880
875
  u.current = n.asyncFields;
881
- let d = B(n);
876
+ let d = V(n);
882
877
  d.current = n;
883
- let f = B(a);
878
+ let f = V(a);
884
879
  f.current = a;
885
- let p = B(l);
880
+ let p = V(l);
886
881
  p.current = l;
887
- let m = B(r);
882
+ let m = V(r);
888
883
  m.current = r;
889
- 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 = I((e) => {
884
+ let [h, g] = H(() => n.flash?.errors ?? {}), [_, v] = H(n.flash?.formError), [y, b] = H(void 0), x = V(void 0), S = V(!1), C = L((e) => {
890
885
  let t = m.current;
891
886
  if (t === void 0) return [];
892
887
  let n = d.current, r = e;
@@ -895,97 +890,97 @@ var Wt = 15e3, J = async (e, t, n) => {
895
890
  } catch {
896
891
  r = e;
897
892
  }
898
- let i = re(t, r, p.current).issues;
893
+ let i = ne(t, r, p.current).issues;
899
894
  if (n.toInput === void 0) return i;
900
895
  let a = n.errorPath ?? {};
901
896
  return i.map((t) => {
902
897
  let n = a[t.path];
903
- return n === void 0 ? (Nn(e, t.path) !== void 0 || t.path.includes("."), t) : {
898
+ return n === void 0 ? (jn(e, t.path) !== void 0 || t.path.includes("."), t) : {
904
899
  ...t,
905
900
  path: n
906
901
  };
907
902
  });
908
- }, []), w = I((e) => {
903
+ }, []), w = L((e) => {
909
904
  let t = { ...e ?? {} }, n = m.current;
910
- if (n !== void 0) for (let e of _e(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
905
+ if (n !== void 0) for (let e of ve(n)) (e.widget === "checkbox" || e.widget === "switch") && !(e.name in t) && (t[e.name] = !1);
911
906
  return t;
912
- }, []), T = B(() => Promise.resolve());
907
+ }, []), T = V(() => Promise.resolve());
913
908
  if (i.current === void 0) {
914
909
  let e = n.flash, t = e === void 0 ? w(n.defaults) : {
915
910
  ...w(n.defaults),
916
911
  ...e.values
917
912
  };
918
- i.current = new Fe({
913
+ i.current = new Ie({
919
914
  onSubmit: ({ value: e }) => T.current(e),
920
915
  defaultValues: t,
921
916
  validators: { onChange: ({ value: e }) => {
922
917
  let t = C(e);
923
918
  if (t.length === 0) return;
924
919
  let n = {};
925
- for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = P(e, p.current));
920
+ for (let e of t) e.path !== "" && !(e.path in n) && (n[e.path] = _e(e, p.current));
926
921
  return { fields: n };
927
922
  } }
928
923
  });
929
924
  }
930
925
  let E = i.current, D = E;
931
- R(() => D.mount(), [D]);
926
+ z(() => D.mount(), [D]);
932
927
  let ee = n.subscribe ?? "all";
933
- Ie(E.store, (e) => ee === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
934
- let te = E.store.state.values, O = E.store.state, k = z(() => C(te), [C, te]), A = n.isLoading === !0, ne = n.validate, j = ne?.onChange ?? "afterTouched", M = ne?.onBlur ?? !0, ie = O.submissionAttempts, ae = O.fieldMetaBase ?? {}, oe = I((e) => {
935
- if (A) return !1;
936
- if (ie > 0 || j === "always") return !0;
937
- if (j === "never") return !1;
938
- let t = ae[e];
939
- return t === void 0 ? !1 : M ? t.isBlurred === !0 : t.isTouched === !0;
928
+ Le(E.store, (e) => ee === "all" ? e : `${e.submissionAttempts}|${String(e.isSubmitting)}|${String(e.isDirty)}|${String(e.isTouched)}`);
929
+ let O = E.store.state.values, k = E.store.state, A = B(() => 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 ?? {}, re = L((e) => {
930
+ if (j) return !1;
931
+ if (P > 0 || N === "always") return !0;
932
+ if (N === "never") return !1;
933
+ let t = F[e];
934
+ return t === void 0 ? !1 : te ? t.isBlurred === !0 : t.isTouched === !0;
940
935
  }, [
941
- ie,
942
- ae,
943
- A,
936
+ P,
937
+ F,
944
938
  j,
945
- M
946
- ]), N = I((e) => {
939
+ N,
940
+ te
941
+ ]), ie = L((e) => {
947
942
  let t = h[e];
948
943
  if (t !== void 0) return t;
949
944
  let n = u.current?.[e];
950
- if (n !== void 0 && n.status === "invalid") return n.message ?? P({
945
+ if (n !== void 0 && n.status === "invalid") return n.message ?? _e({
951
946
  id: "validation.invalid",
952
947
  fallback: "Invalid value"
953
948
  }, p.current);
954
- if (!oe(e)) return;
955
- let r = k.find((t) => t.path === e);
956
- return r === void 0 ? void 0 : P(r, p.current);
949
+ if (!re(e)) return;
950
+ let r = A.find((t) => t.path === e);
951
+ return r === void 0 ? void 0 : _e(r, p.current);
957
952
  }, [
958
953
  h,
959
- oe,
960
- k
961
- ]), se = z(() => {
962
- let e = {}, t = /* @__PURE__ */ new Set([...k.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(h)]);
954
+ re,
955
+ A
956
+ ]), ae = B(() => {
957
+ let e = {}, t = /* @__PURE__ */ new Set([...A.map((e) => e.path).filter((e) => e !== ""), ...Object.keys(h)]);
963
958
  for (let [e, n] of Object.entries(u.current ?? {})) n.status === "invalid" && t.add(e);
964
959
  for (let n of t) {
965
- let t = N(n);
960
+ let t = ie(n);
966
961
  t !== void 0 && (e[n] = t);
967
962
  }
968
963
  return e;
969
964
  }, [
970
- k,
965
+ A,
971
966
  h,
972
- N
973
- ]), ce = I((e) => {
967
+ ie
968
+ ]), oe = L((e) => {
974
969
  g((t) => {
975
970
  if (!(e in t)) return t;
976
971
  let n = { ...t };
977
972
  return delete n[e], n;
978
973
  });
979
- }, []), le = I((n) => {
980
- let r = In(o, n), i = D.getFieldMeta(n), a = N(n), s = Pn(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);
974
+ }, []), se = L((n) => {
975
+ let r = Pn(o, n), i = D.getFieldMeta(n), a = ie(n), s = Mn(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);
981
976
  return {
982
977
  value: D.getFieldValue(n),
983
978
  setValue: (e) => {
984
- ce(n), !Object.is(D.getFieldValue(n), e) && D.setFieldValue(n, e);
979
+ oe(n), !Object.is(D.getFieldValue(n), e) && D.setFieldValue(n, e);
985
980
  },
986
981
  onBlur: () => {
987
982
  D.setFieldMeta(n, (e) => ({
988
- ...Fn,
983
+ ...Nn,
989
984
  ...e ?? {},
990
985
  isTouched: !0,
991
986
  isBlurred: !0
@@ -1012,12 +1007,12 @@ var Wt = 15e3, J = async (e, t, n) => {
1012
1007
  }, [
1013
1008
  e,
1014
1009
  t,
1015
- ce,
1010
+ oe,
1016
1011
  D,
1017
1012
  o,
1018
1013
  h,
1019
- N
1020
- ]), ue = I((e) => ({
1014
+ ie
1015
+ ]), ce = L((e) => ({
1021
1016
  items: D.getFieldValue(e) ?? [],
1022
1017
  push: (t) => {
1023
1018
  D.pushFieldValue(e, t);
@@ -1034,14 +1029,14 @@ var Wt = 15e3, J = async (e, t, n) => {
1034
1029
  swap: (t, n) => {
1035
1030
  D.swapFieldValues(e, t, n);
1036
1031
  },
1037
- field: (t, n) => le(`${e}.${t}.${n}`)
1038
- }), [D, le]), de = I((e) => o.filter((t) => t.section === e), [o]), fe = I((e, t) => {
1039
- ce(e), !Object.is(D.getFieldValue(e), t) && D.setFieldValue(e, t);
1040
- }, [ce, D]), pe = I((e) => {
1032
+ field: (t, n) => se(`${e}.${t}.${n}`)
1033
+ }), [D, se]), le = L((e) => o.filter((t) => t.section === e), [o]), ue = L((e, t) => {
1034
+ oe(e), !Object.is(D.getFieldValue(e), t) && D.setFieldValue(e, t);
1035
+ }, [oe, D]), de = L((e) => {
1041
1036
  for (let [t, n] of Object.entries(e)) D.setFieldValue(t, n);
1042
- }, [D]), me = I((e) => {
1037
+ }, [D]), fe = L((e) => {
1043
1038
  g({}), v(void 0), b(void 0), x.current = void 0, S.current = !1, e === void 0 ? D.reset() : D.reset(w(e));
1044
- }, [D, w]), he = n.asyncTimeoutMs ?? 5e3, ge = I(async () => {
1039
+ }, [D, w]), pe = n.asyncTimeoutMs ?? 5e3, me = L(async () => {
1045
1040
  let e = Date.now();
1046
1041
  for (;;) {
1047
1042
  let t = u.current;
@@ -1049,23 +1044,23 @@ var Wt = 15e3, J = async (e, t, n) => {
1049
1044
  let n = Object.entries(t), r = n.filter(([, e]) => e.status === "checking");
1050
1045
  if (r.length === 0) {
1051
1046
  let e = n.filter(([, e]) => e.status === "invalid");
1052
- return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ?? P({
1047
+ return e.length === 0 ? void 0 : Object.fromEntries(e.map(([e, t]) => [e, t.message ?? _e({
1053
1048
  id: "validation.invalid",
1054
1049
  fallback: "Invalid value"
1055
1050
  }, p.current)]));
1056
1051
  }
1057
- if (Date.now() - e > he) return Object.fromEntries(r.map(([e]) => [e, P({
1052
+ if (Date.now() - e > pe) return Object.fromEntries(r.map(([e]) => [e, _e({
1058
1053
  id: "validation.checking",
1059
1054
  fallback: "Still checking…"
1060
1055
  }, p.current)]));
1061
1056
  await new Promise((e) => setTimeout(e, 50));
1062
1057
  }
1063
- }, [he]), ve = I(() => {
1058
+ }, [pe]), he = L(() => {
1064
1059
  let n = globalThis.document;
1065
1060
  if (n?.getElementById === void 0) return;
1066
1061
  let r = [...o.map((e) => e.name), ...Object.keys(h).filter((e) => !o.some((t) => t.name === e))];
1067
- for (let i of r) if (N(i) !== void 0) {
1068
- n.getElementById(Pn(e, t, i))?.focus?.();
1062
+ for (let i of r) if (ie(i) !== void 0) {
1063
+ n.getElementById(Mn(e, t, i))?.focus?.();
1069
1064
  return;
1070
1065
  }
1071
1066
  }, [
@@ -1073,17 +1068,17 @@ var Wt = 15e3, J = async (e, t, n) => {
1073
1068
  t,
1074
1069
  o,
1075
1070
  h,
1076
- N
1077
- ]), F = B(ve);
1078
- F.current = ve;
1079
- let be = I(async () => {
1071
+ ie
1072
+ ]), ge = V(he);
1073
+ ge.current = he;
1074
+ let ye = L(async () => {
1080
1075
  v(void 0), g({}), b(void 0), x.current = void 0, S.current = !1;
1081
1076
  let e, t = !1;
1082
1077
  if (await D.handleSubmit().catch((n) => {
1083
1078
  t = !0, e = n;
1084
1079
  }), t) throw e;
1085
1080
  return S.current || queueMicrotask(() => {
1086
- F.current();
1081
+ ge.current();
1087
1082
  }), x.current;
1088
1083
  }, [D]);
1089
1084
  T.current = (async (e) => {
@@ -1096,22 +1091,22 @@ var Wt = 15e3, J = async (e, t, n) => {
1096
1091
  }
1097
1092
  if (C(n).length > 0) {
1098
1093
  queueMicrotask(() => {
1099
- F.current();
1094
+ ge.current();
1100
1095
  });
1101
1096
  return;
1102
1097
  }
1103
1098
  let i = m.current;
1104
1099
  if (i !== void 0) {
1105
- let e = ye(i, r);
1100
+ let e = be(i, r);
1106
1101
  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;
1107
1102
  }
1108
- let a = await ge();
1103
+ let a = await me();
1109
1104
  if (a !== void 0) {
1110
1105
  g((e) => ({
1111
1106
  ...e,
1112
1107
  ...a
1113
1108
  })), queueMicrotask(() => {
1114
- F.current();
1109
+ ge.current();
1115
1110
  });
1116
1111
  return;
1117
1112
  }
@@ -1133,7 +1128,7 @@ var Wt = 15e3, J = async (e, t, n) => {
1133
1128
  return;
1134
1129
  }
1135
1130
  let n = {};
1136
- for (let e of t) e.field in n || (n[e.field] = P({
1131
+ for (let e of t) e.field in n || (n[e.field] = _e({
1137
1132
  id: e.message,
1138
1133
  ...e.params === void 0 ? {} : { params: e.params },
1139
1134
  fallback: e.message
@@ -1142,78 +1137,78 @@ var Wt = 15e3, J = async (e, t, n) => {
1142
1137
  ...e,
1143
1138
  ...n
1144
1139
  })), queueMicrotask(() => {
1145
- F.current();
1140
+ ge.current();
1146
1141
  });
1147
1142
  }
1148
1143
  });
1149
- let L = k.length === 0, xe = Object.values(u.current ?? {}).some((e) => e.status === "checking"), Se = y ?? a?.error, H = Se !== void 0 && Me(Se).length > 0 ? void 0 : Se, Ce = Object.keys(se).length, we = (() => {
1150
- for (let e of o) if (se[e.name] !== void 0) return e.name;
1151
- let e = Object.keys(se);
1144
+ let I = A.length === 0, xe = Object.values(u.current ?? {}).some((e) => e.status === "checking"), R = y ?? a?.error, Se = R !== void 0 && Me(R).length > 0 ? void 0 : R, Ce = Object.keys(ae).length, we = (() => {
1145
+ for (let e of o) if (ae[e.name] !== void 0) return e.name;
1146
+ let e = Object.keys(ae);
1152
1147
  return e.length > 0 ? e[0] : void 0;
1153
- })(), U = {
1154
- isDirty: !A && O.isDirty,
1155
- isPristine: O.isPristine,
1156
- isTouched: O.isTouched,
1157
- isValid: L,
1148
+ })(), Te = {
1149
+ isDirty: !j && k.isDirty,
1150
+ isPristine: k.isPristine,
1151
+ isTouched: k.isTouched,
1152
+ isValid: I,
1158
1153
  isValidating: xe,
1159
- canSubmit: L && !xe && !O.isSubmitting && !A,
1160
- isSubmitting: O.isSubmitting,
1161
- isSubmitted: O.isSubmitted,
1162
- isSubmitSuccessful: O.isSubmitSuccessful && S.current,
1163
- submissionAttempts: O.submissionAttempts,
1154
+ canSubmit: I && !xe && !k.isSubmitting && !j,
1155
+ isSubmitting: k.isSubmitting,
1156
+ isSubmitted: k.isSubmitted,
1157
+ isSubmitSuccessful: k.isSubmitSuccessful && S.current,
1158
+ submissionAttempts: k.submissionAttempts,
1164
1159
  errorCount: Ce,
1165
1160
  firstInvalidPath: we,
1166
- pending: a?.pending ?? O.isSubmitting,
1167
- isLoading: A,
1168
- submitError: H,
1161
+ pending: a?.pending ?? k.isSubmitting,
1162
+ isLoading: j,
1163
+ submitError: Se,
1169
1164
  data: a?.data ?? x.current
1170
- }, Te = {
1165
+ }, Ee = {
1171
1166
  fields: o,
1172
- values: te,
1173
- errors: se,
1174
- issues: k,
1175
- isValid: L,
1176
- pending: a?.pending ?? O.isSubmitting,
1177
- submitError: H,
1167
+ values: O,
1168
+ errors: ae,
1169
+ issues: A,
1170
+ isValid: I,
1171
+ pending: a?.pending ?? k.isSubmitting,
1172
+ submitError: Se,
1178
1173
  formError: _,
1179
1174
  data: a?.data ?? x.current,
1180
- setValue: fe,
1181
- setValues: pe,
1182
- reset: me,
1183
- submit: be,
1184
- field: le,
1185
- array: ue,
1186
- section: de,
1187
- state: U,
1188
- focusFirstInvalid: ve
1175
+ setValue: ue,
1176
+ setValues: de,
1177
+ reset: fe,
1178
+ submit: ye,
1179
+ field: se,
1180
+ array: ce,
1181
+ section: le,
1182
+ state: Te,
1183
+ focusFirstInvalid: he
1189
1184
  };
1190
- return Object.defineProperty(Te, jn, {
1185
+ return Object.defineProperty(Ee, kn, {
1191
1186
  value: {
1192
1187
  store: E.store,
1193
- field: le
1188
+ field: se
1194
1189
  },
1195
1190
  enumerable: !1
1196
- }), Te;
1197
- }, Bn = (e) => be(Mn.Provider, { value: e.binding }, e.children), Vn = () => L(Mn);
1198
- function Hn(e, t) {
1199
- let n = L(Mn), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
1191
+ }), Ee;
1192
+ }, Rn = (e) => xe(An.Provider, { value: e.binding }, e.children), zn = () => R(An);
1193
+ function Bn(e, t) {
1194
+ let n = R(An), r = typeof e == "string" ? void 0 : e, i = typeof e == "string" ? e : t, a = r ?? n;
1200
1195
  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.");
1201
- let o = a[jn];
1196
+ let o = a[kn];
1202
1197
  if (o === void 0) throw Error("useFormField: not a useFormBinding result");
1203
- return Ie(o.store, (e) => {
1198
+ return Le(o.store, (e) => {
1204
1199
  let t = e.fieldMetaBase[i];
1205
- return `${JSON.stringify(Nn(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
1200
+ return `${JSON.stringify(jn(e.values, i))}|${t === void 0 ? "" : `${String(t.isTouched)}${String(t.isBlurred)}${JSON.stringify(t.errorMap)}`}|${e.submissionAttempts}`;
1206
1201
  }), o.field(i);
1207
1202
  }
1208
1203
  //#endregion
1209
1204
  //#region src/connectionPrerequisite.ts
1210
- var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:connection-setup-superseded" ? "superseded" : "inactive", Z = class extends Error {
1205
+ var Vn = "voltro:connection-setup-superseded", Hn = (e) => e.reason === "voltro:connection-setup-superseded" ? "superseded" : "inactive", Z = class extends Error {
1211
1206
  reason;
1212
1207
  _tag = "ConnectionPrerequisiteInvalidated";
1213
1208
  constructor(e) {
1214
- super(`Voltro connection prerequisite: ${e}`), this.reason = e, n(this, e === "connection-unavailable" || e === "connection-changed" ? "transport" : "client");
1209
+ super(`Voltro connection prerequisite: ${e}`), this.reason = e, y(this, e === "connection-unavailable" || e === "connection-changed" ? "transport" : "client");
1215
1210
  }
1216
- }, Gn = class {
1211
+ }, Un = class {
1217
1212
  #e;
1218
1213
  #t;
1219
1214
  #n = /* @__PURE__ */ new WeakMap();
@@ -1223,15 +1218,15 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1223
1218
  this.#e = e, this.#t = t;
1224
1219
  }
1225
1220
  prepare(e, t) {
1226
- let n = u(e)?.getSnapshot();
1227
- if (this.#e.aborted) return Promise.reject(new Z(Wn(this.#e)));
1221
+ let n = ee(e)?.getSnapshot();
1222
+ if (this.#e.aborted) return Promise.reject(new Z(Hn(this.#e)));
1228
1223
  if (n === void 0) return Promise.reject(new Z("connection-unavailable"));
1229
1224
  let r = this.#n.get(n);
1230
1225
  if (r !== void 0) return r.then((t) => (this.assertCurrent(e, t), t));
1231
1226
  let i = this.#a(e, n, t).pipe(U.timeoutFail({
1232
1227
  duration: this.#t,
1233
1228
  onTimeout: () => new Z("timeout")
1234
- })), a = C(e, i).then((t) => {
1229
+ })), a = u(e, i).then((t) => {
1235
1230
  let r = Object.freeze({
1236
1231
  lease: n,
1237
1232
  output: t
@@ -1243,33 +1238,33 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1243
1238
  }), a;
1244
1239
  }
1245
1240
  assertCurrent(e, t) {
1246
- if (!this.#r.has(t)) throw new Z(Wn(this.#e));
1241
+ if (!this.#r.has(t)) throw new Z(Hn(this.#e));
1247
1242
  this.#i(e, t.lease);
1248
1243
  }
1249
1244
  #i(e, t) {
1250
- if (this.#e.aborted) throw new Z(Wn(this.#e));
1251
- if (t.signal.aborted || u(e)?.getSnapshot() !== t) throw new Z("connection-changed");
1245
+ if (this.#e.aborted) throw new Z(Hn(this.#e));
1246
+ if (t.signal.aborted || ee(e)?.getSnapshot() !== t) throw new Z("connection-changed");
1252
1247
  }
1253
1248
  run(e, t, n) {
1254
1249
  let r = U.try({
1255
1250
  try: () => this.assertCurrent(e, t),
1256
1251
  catch: (e) => e
1257
1252
  }).pipe(U.zipRight(n));
1258
- return C(e, this.#a(e, t.lease, r));
1253
+ return u(e, this.#a(e, t.lease, r));
1259
1254
  }
1260
1255
  #a(e, t, n) {
1261
1256
  let r = U.try({
1262
1257
  try: () => this.#i(e, t),
1263
1258
  catch: (e) => e
1264
1259
  }), i = U.async((e) => {
1265
- let n = () => e(U.fail(new Z(this.#e.aborted ? Wn(this.#e) : "connection-changed")));
1260
+ let n = () => e(U.fail(new Z(this.#e.aborted ? Hn(this.#e) : "connection-changed")));
1266
1261
  return this.#e.addEventListener("abort", n, { once: !0 }), t.signal.addEventListener("abort", n, { once: !0 }), (this.#e.aborted || t.signal.aborted) && n(), U.sync(() => {
1267
1262
  this.#e.removeEventListener("abort", n), t.signal.removeEventListener("abort", n);
1268
1263
  });
1269
1264
  });
1270
1265
  return r.pipe(U.zipRight(n), U.tap(() => r), U.raceFirst(i));
1271
1266
  }
1272
- }, Kn = class {
1267
+ }, Wn = class {
1273
1268
  #e;
1274
1269
  #t;
1275
1270
  #n;
@@ -1284,7 +1279,7 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1284
1279
  #s;
1285
1280
  handle;
1286
1281
  constructor(e, t, n) {
1287
- this.#e = e, this.#t = t, this.#n = n, this.handle = tn(e, { capture: () => this.#f() });
1282
+ this.#e = e, this.#t = t, this.#n = n, this.handle = nn(e, { capture: () => this.#f() });
1288
1283
  }
1289
1284
  getSnapshot = () => this.#a;
1290
1285
  subscribe = (e) => (this.#r.add(e), () => {
@@ -1292,7 +1287,7 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1292
1287
  });
1293
1288
  clear = (e = !1) => {
1294
1289
  let t = this.#i;
1295
- this.#i = void 0, this.#s = void 0, t?.detachSubject?.(), t?.controller.abort(e ? Un : void 0), this.#h({
1290
+ this.#i = void 0, this.#s = void 0, t?.detachSubject?.(), t?.controller.abort(e ? Vn : void 0), this.#h({
1296
1291
  status: "idle",
1297
1292
  data: void 0,
1298
1293
  error: void 0
@@ -1302,11 +1297,11 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1302
1297
  this.clear(!0);
1303
1298
  let n = new AbortController(), r = {
1304
1299
  input: e,
1305
- key: cn(),
1300
+ key: T(),
1306
1301
  controller: n,
1307
1302
  subject: void 0,
1308
1303
  detachSubject: void 0,
1309
- prerequisite: new Gn(n.signal, this.#c(this.#n()).options.replayWindowMs),
1304
+ prerequisite: new Un(n.signal, this.#c(this.#n()).options.replayWindowMs),
1310
1305
  established: !1
1311
1306
  };
1312
1307
  this.#i = r, this.#h({
@@ -1326,7 +1321,7 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1326
1321
  }
1327
1322
  }
1328
1323
  watch(e) {
1329
- let t = u(e.runtime), n = () => {
1324
+ let t = ee(e.runtime), n = () => {
1330
1325
  let n = this.#i;
1331
1326
  if (n === void 0 || !n.established || this.#n().runtime !== e.runtime) return;
1332
1327
  if (n.subject !== this.#c(e).subjectSignal) {
@@ -1343,10 +1338,10 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1343
1338
  return n(), t?.subscribe(n) ?? (() => {});
1344
1339
  }
1345
1340
  #c(e) {
1346
- return e.recovery ?? d(e.errorBus, this.#e);
1341
+ return e.recovery ?? w(e.errorBus, this.#e);
1347
1342
  }
1348
1343
  #l(e) {
1349
- if (this.#i !== e || e.controller.signal.aborted) throw new Z(Wn(e.controller.signal));
1344
+ if (this.#i !== e || e.controller.signal.aborted) throw new Z(Hn(e.controller.signal));
1350
1345
  }
1351
1346
  #u(e, t, n) {
1352
1347
  this.#l(e);
@@ -1379,13 +1374,13 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1379
1374
  let r = this.#u(e, t, n), i = r.descriptors[this.#t];
1380
1375
  if (i?.kind !== "mutation" || i.idempotencyScope !== "connection") throw Error(`Voltro: useConnectionSetup("${this.#t}") requires a mutation declaring idempotencyScope: 'connection'`);
1381
1376
  this.#d(e, r), this.#l(e);
1382
- let a = u(t);
1377
+ let a = ee(t);
1383
1378
  if (a === void 0) throw new Z("connection-unavailable");
1384
1379
  if (a.getSnapshot() === void 0) {
1385
1380
  let n = U.async((t) => {
1386
1381
  let n = () => {
1387
1382
  let n = a.getSnapshot();
1388
- e.controller.signal.aborted ? t(U.fail(new Z(Wn(e.controller.signal)))) : n !== void 0 && t(U.succeed(n));
1383
+ e.controller.signal.aborted ? t(U.fail(new Z(Hn(e.controller.signal)))) : n !== void 0 && t(U.succeed(n));
1389
1384
  }, r = a.subscribe(n);
1390
1385
  return e.controller.signal.addEventListener("abort", n, { once: !0 }), n(), U.sync(() => {
1391
1386
  r(), e.controller.signal.removeEventListener("abort", n);
@@ -1394,7 +1389,7 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1394
1389
  duration: this.#c(r).options.replayWindowMs,
1395
1390
  onTimeout: () => new Z("timeout")
1396
1391
  }));
1397
- await C(t, n);
1392
+ await u(t, n);
1398
1393
  }
1399
1394
  this.#u(e, t, n);
1400
1395
  let o = a.getSnapshot();
@@ -1413,35 +1408,39 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1413
1408
  }), n;
1414
1409
  }
1415
1410
  }
1416
- #m(e, t) {
1411
+ #m(t, n) {
1417
1412
  return U.suspend(() => {
1418
- let n = `setup_${e.key}_${++this.#o}`;
1419
- return Xt({
1420
- id: n,
1413
+ let r = `setup_${t.key}_${++this.#o}`;
1414
+ return Zt({
1415
+ id: r,
1421
1416
  apiName: this.#e,
1422
1417
  tag: this.#t,
1423
- input: e.input
1424
- }), U.suspend(() => (this.#u(e, t.runtime, t.client), ln(h(t.client, this.#t)(e.input), e.key))).pipe(U.withSpan(`client.connectionSetup.${this.#t}`)).pipe(U.onExit((e) => U.sync(() => {
1425
- if (Te.isSuccess(e)) X(n, {
1418
+ input: t.input
1419
+ }), U.suspend(() => {
1420
+ this.#u(t, n.runtime, n.client);
1421
+ let e = C(n.client, this.#t);
1422
+ return _(e(t.input), t.key);
1423
+ }).pipe(U.withSpan(`client.connectionSetup.${this.#t}`)).pipe(U.onExit((t) => U.sync(() => {
1424
+ if (De.isSuccess(t)) X(r, {
1426
1425
  status: "success",
1427
- output: e.value
1428
- }), t.errorBus.emitSuccess({
1426
+ output: t.value
1427
+ }), n.errorBus.emitSuccess({
1429
1428
  source: "mutation",
1430
1429
  tag: this.#t
1431
1430
  });
1432
1431
  else {
1433
- let r = g(e.cause);
1434
- if (X(n, {
1432
+ let i = a(t.cause);
1433
+ if (X(r, {
1435
1434
  status: "error",
1436
- error: r
1437
- }), !Ce.isInterruptedOnly(e.cause)) {
1438
- let e = i(r, "handler");
1439
- t.errorBus.emit({
1435
+ error: i
1436
+ }), !Te.isInterruptedOnly(t.cause)) {
1437
+ let t = e(i, "handler");
1438
+ n.errorBus.emit({
1440
1439
  source: "mutation",
1441
1440
  tag: this.#t,
1442
- error: r,
1443
- kind: e,
1444
- outcome: e === "transport" ? "unknown" : "known"
1441
+ error: i,
1442
+ kind: t,
1443
+ outcome: t === "transport" ? "unknown" : "known"
1445
1444
  });
1446
1445
  }
1447
1446
  }
@@ -1456,128 +1455,128 @@ var Un = "voltro:connection-setup-superseded", Wn = (e) => e.reason === "voltro:
1456
1455
  } catch {}
1457
1456
  }
1458
1457
  }
1459
- }, qn = (e, t) => {
1460
- let n = K(e), r = B(n);
1458
+ }, Gn = (e, t) => {
1459
+ let n = K(e), r = V(n);
1461
1460
  r.current = n;
1462
- let i = z(() => new Kn(e, t, () => r.current), [e, t]), a = I((n) => i.activate(n, () => J(r, e, t)), [
1461
+ let i = B(() => new Wn(e, t, () => r.current), [e, t]), a = L((n) => i.activate(n, () => J(r, e, t)), [
1463
1462
  i,
1464
1463
  e,
1465
1464
  t
1466
- ]), o = H(i.subscribe, i.getSnapshot, i.getSnapshot);
1467
- return R(() => i.watch(r.current), [
1465
+ ]), o = we(i.subscribe, i.getSnapshot, i.getSnapshot);
1466
+ return z(() => i.watch(r.current), [
1468
1467
  i,
1469
1468
  n.runtime,
1470
1469
  n.client,
1471
1470
  n.recovery
1472
- ]), R(() => () => i.clear(), [i]), {
1471
+ ]), z(() => () => i.clear(), [i]), {
1473
1472
  ...o,
1474
1473
  handle: i.handle,
1475
1474
  activate: a,
1476
1475
  clear: i.clear,
1477
1476
  ready: o.status === "ready"
1478
1477
  };
1479
- }, Jn = q, Yn = (e) => ({
1480
- useSubscription: (t, n, r) => Jn(e, t, n, r),
1481
- useMutation: (t) => Sn(e, t),
1482
- useConnectionSetup: (t) => qn(e, t),
1483
- useAction: (t) => Dn(e, t),
1484
- useFormBinding: (t, n) => Ln(e, t, n ?? {})
1485
- }), Xn = () => ({ seeds: [] }), Zn = null, Qn = (e) => {
1486
- Zn = e;
1487
- }, $n = /* @__PURE__ */ new Map(), er = (e, t) => `${e}\u0000${t}`, tr = (e, t, n, r) => {
1488
- let i = Zn?.() ?? null;
1478
+ }, Kn = q, qn = (e) => ({
1479
+ useSubscription: (t, n, r) => Kn(e, t, n, r),
1480
+ useMutation: (t) => bn(e, t),
1481
+ useConnectionSetup: (t) => Gn(e, t),
1482
+ useAction: (t) => Tn(e, t),
1483
+ useFormBinding: (t, n) => Fn(e, t, n ?? {})
1484
+ }), Jn = () => ({ seeds: [] }), Yn = null, Xn = (e) => {
1485
+ Yn = e;
1486
+ }, Zn = /* @__PURE__ */ new Map(), Qn = (e, t) => `${e}\u0000${t}`, $n = (e, t, n, r) => {
1487
+ let i = Yn?.() ?? null;
1489
1488
  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.)`);
1490
1489
  i.seeds.push({
1491
1490
  api: e,
1492
- key: O([t, n]),
1491
+ key: A([t, n]),
1493
1492
  value: r
1494
1493
  });
1495
- }, nr = (e, t, n) => {
1496
- let r = Zn?.() ?? null;
1494
+ }, er = (e, t, n) => {
1495
+ let r = Yn?.() ?? null;
1497
1496
  r !== null && r.seeds.push({
1498
1497
  api: e,
1499
- key: O([t, n]),
1498
+ key: A([t, n]),
1500
1499
  value: void 0,
1501
1500
  failed: !0
1502
1501
  });
1503
- }, rr = (e) => {
1504
- if (e !== void 0) for (let t of e) $n.set(er(t.api, t.key), {
1502
+ }, tr = (e) => {
1503
+ if (e !== void 0) for (let t of e) Zn.set(Qn(t.api, t.key), {
1505
1504
  value: t.value,
1506
1505
  failed: t.failed === !0
1507
1506
  });
1508
- }, ir = (e, t, n) => {
1509
- let r = O([t, n]), i = Zn?.() ?? null;
1507
+ }, nr = (e, t, n) => {
1508
+ let r = A([t, n]), i = Yn?.() ?? null;
1510
1509
  if (i !== null) {
1511
1510
  for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? void 0 : t.value;
1512
1511
  return;
1513
1512
  }
1514
- let a = $n.get(er(e, r));
1513
+ let a = Zn.get(Qn(e, r));
1515
1514
  return a === void 0 || a.failed ? void 0 : a.value;
1516
- }, ar = (e, t, n) => {
1517
- let r = O([t, n]), i = Zn?.() ?? null;
1515
+ }, rr = (e, t, n) => {
1516
+ let r = A([t, n]), i = Yn?.() ?? null;
1518
1517
  if (i !== null) {
1519
1518
  for (let t of i.seeds) if (t.api === e && t.key === r) return t.failed === !0 ? "failed" : "seeded";
1520
1519
  return "absent";
1521
1520
  }
1522
- let a = $n.get(er(e, r));
1521
+ let a = Zn.get(Qn(e, r));
1523
1522
  return a === void 0 ? "absent" : a.failed ? "failed" : "seeded";
1524
- }, or = () => {
1525
- $n.clear();
1523
+ }, ir = () => {
1524
+ Zn.clear();
1526
1525
  };
1527
1526
  //#endregion
1528
1527
  //#region src/usePreloadedSubscription.ts
1529
- function sr(e, t, n = {}, r = {}) {
1530
- let i = ir(e, t, n), a = q(e, t, n, i === void 0 ? r : {
1528
+ function ar(e, t, n = {}, r = {}) {
1529
+ let i = nr(e, t, n), a = q(e, t, n, i === void 0 ? r : {
1531
1530
  ...r,
1532
1531
  initialSnapshot: i
1533
1532
  });
1534
- return ar(e, t, n) === "failed" ? {
1533
+ return rr(e, t, n) === "failed" ? {
1535
1534
  ...a,
1536
1535
  preloadFailed: !0
1537
1536
  } : a;
1538
1537
  }
1539
1538
  //#endregion
1540
1539
  //#region src/useEvent.ts
1541
- var cr = {
1540
+ var or = {
1542
1541
  status: "idle",
1543
1542
  missed: 0,
1544
1543
  lastMiss: void 0
1545
- }, lr = class {
1544
+ }, sr = class {
1546
1545
  _tag = "EventStreamClosed";
1547
1546
  };
1548
- function ur(e, t, n, r = {}) {
1549
- let { skip: i = !1, apiName: a = "app", onMissed: s } = r, c = K(a), { runtime: l, client: u } = c, [d, f] = V(cr), p = B(n);
1550
- p.current = n;
1551
- let m = B(s);
1547
+ function cr(e, t, r, i = {}) {
1548
+ let { skip: a = !1, apiName: o = "app", onMissed: s } = i, c = K(o), { runtime: l, client: u } = c, [d, f] = H(or), p = V(r);
1549
+ p.current = r;
1550
+ let m = V(s);
1552
1551
  m.current = s;
1553
- let g = B(u);
1554
- g.current = u;
1555
- let _ = B(l);
1556
- _.current = l;
1557
- let v = B(/* @__PURE__ */ new Map()), y = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), b = B(t);
1558
- b.current = t;
1559
- let x = B(null);
1560
- x.current !== y && (x.current = y, v.current = /* @__PURE__ */ new Map());
1561
- let S = I((t, n) => {
1562
- t <= 0 || (o(a, "event.gap", {
1552
+ let h = V(u);
1553
+ h.current = u;
1554
+ let g = V(l);
1555
+ g.current = l;
1556
+ let _ = V(/* @__PURE__ */ new Map()), v = t === null ? null : JSON.stringify(Object.entries(t).sort(([e], [t]) => e < t ? -1 : 1)), y = V(t);
1557
+ y.current = t;
1558
+ let b = V(null);
1559
+ b.current !== v && (b.current = v, _.current = /* @__PURE__ */ new Map());
1560
+ let x = L((t, r) => {
1561
+ t <= 0 || (n(o, "event.gap", {
1563
1562
  tag: e.name,
1564
1563
  missed: t,
1565
- reason: n
1564
+ reason: r
1566
1565
  }), f((e) => ({
1567
1566
  ...e,
1568
1567
  missed: e.missed + t,
1569
1568
  lastMiss: {
1570
1569
  count: t,
1571
- reason: n
1570
+ reason: r
1572
1571
  }
1573
1572
  })), m.current?.({
1574
1573
  count: t,
1575
- reason: n
1574
+ reason: r
1576
1575
  }));
1577
- }, [a, e.name]), C = !i && y !== null && !$e(c);
1578
- return R(() => {
1579
- if (!C) {
1580
- f(cr);
1576
+ }, [o, e.name]), S = !a && v !== null && !et(c);
1577
+ return z(() => {
1578
+ if (!S) {
1579
+ f(or);
1581
1580
  return;
1582
1581
  }
1583
1582
  f((e) => ({
@@ -1585,22 +1584,22 @@ function ur(e, t, n, r = {}) {
1585
1584
  status: "connecting"
1586
1585
  }));
1587
1586
  let t = 0, n = U.sync(() => {
1588
- let t = [...v.current].map(([e, t]) => ({
1587
+ let t = [..._.current].map(([e, t]) => ({
1589
1588
  origin: e,
1590
1589
  n: t
1591
1590
  }));
1592
- return h(g.current, e.name)({
1593
- key: b.current,
1591
+ return C(h.current, e.name)({
1592
+ key: y.current,
1594
1593
  ...t.length > 0 ? { resume: t } : {}
1595
1594
  });
1596
1595
  }), r = W.unwrap(n).pipe(W.tap(() => U.sync(() => {
1597
1596
  t = 0;
1598
- })), W.concat(W.fail(new lr())), W.retry(Oe.exponential("250 millis", 2).pipe(Oe.either(Oe.spaced("30 seconds")), Oe.jittered, Oe.tapOutput(() => U.sync(() => {
1597
+ })), W.concat(W.fail(new sr())), W.retry(Ae.exponential("250 millis", 2).pipe(Ae.either(Ae.spaced("30 seconds")), Ae.jittered, Ae.tapOutput(() => U.sync(() => {
1599
1598
  t += 1, f((e) => ({
1600
1599
  ...e,
1601
1600
  status: "connecting"
1602
1601
  }));
1603
- }))))), i = _.current.runFork(W.runForEach(r, (e) => U.sync(() => {
1602
+ }))))), i = g.current.runFork(W.runForEach(r, (e) => U.sync(() => {
1604
1603
  if (e._tag === "attached") {
1605
1604
  f((e) => ({
1606
1605
  ...e,
@@ -1609,24 +1608,24 @@ function ur(e, t, n, r = {}) {
1609
1608
  return;
1610
1609
  }
1611
1610
  if (e._tag === "gap") {
1612
- S(e.missed, e.reason);
1611
+ x(e.missed, e.reason);
1613
1612
  return;
1614
1613
  }
1615
- v.current.set(e.origin, Math.max(v.current.get(e.origin) ?? 0, e.n)), p.current(e.payload);
1614
+ _.current.set(e.origin, Math.max(_.current.get(e.origin) ?? 0, e.n)), p.current(e.payload);
1616
1615
  })));
1617
1616
  return () => {
1618
- _.current.runFork(i.interruptAsFork(i.id()));
1617
+ g.current.runFork(i.interruptAsFork(i.id()));
1619
1618
  };
1620
1619
  }, [
1621
- C,
1622
- y,
1620
+ S,
1621
+ v,
1623
1622
  e.name,
1624
- S
1625
- ]), C ? d : cr;
1623
+ x
1624
+ ]), S ? d : or;
1626
1625
  }
1627
1626
  //#endregion
1628
1627
  //#region src/sequence.ts
1629
- var dr = () => {
1628
+ var lr = () => {
1630
1629
  let e = (t) => ({
1631
1630
  steps: t,
1632
1631
  step: ((n, r, i) => e([...t, {
@@ -1638,7 +1637,7 @@ var dr = () => {
1638
1637
  }]))
1639
1638
  });
1640
1639
  return e([]);
1641
- }, fr = async (e, t = {}) => {
1640
+ }, ur = async (e, t = {}) => {
1642
1641
  let n = {}, r = [];
1643
1642
  for (let i of e.steps) {
1644
1643
  if (i.when !== void 0 && !i.when(n)) {
@@ -1698,13 +1697,13 @@ var dr = () => {
1698
1697
  ok: !0,
1699
1698
  data: n
1700
1699
  };
1701
- }, pr = (e = {}) => {
1702
- let [t, n] = V(!1), [r, i] = V(void 0), [a, o] = V(void 0), s = B(e);
1700
+ }, dr = (e = {}) => {
1701
+ let [t, n] = H(!1), [r, i] = H(void 0), [a, o] = H(void 0), s = V(e);
1703
1702
  return s.current = e, {
1704
- run: I(async (e, t = {}) => {
1703
+ run: L(async (e, t = {}) => {
1705
1704
  n(!0), i(void 0), o(void 0);
1706
1705
  try {
1707
- let n = await fr(e, {
1706
+ let n = await ur(e, {
1708
1707
  ...s.current,
1709
1708
  ...t
1710
1709
  });
@@ -1717,7 +1716,7 @@ var dr = () => {
1717
1716
  error: r,
1718
1717
  failedStep: a
1719
1718
  };
1720
- }, mr = "@voltro/plugin-storage", Q = (e) => Ne(mr, e), hr = (e, t, n, r) => new Promise((i, a) => {
1719
+ }, fr = "@voltro/plugin-storage", Q = (e) => Pe(fr, e), pr = (e, t, n, r) => new Promise((i, a) => {
1721
1720
  let o = new XMLHttpRequest();
1722
1721
  if (o.open("PUT", e), o.upload.onprogress = (e) => {
1723
1722
  e.lengthComputable && n(e.loaded / e.total);
@@ -1731,7 +1730,7 @@ var dr = () => {
1731
1730
  return;
1732
1731
  }
1733
1732
  r.addEventListener("abort", () => o.abort(), { once: !0 }), o.send(t);
1734
- }), gr = (e, t, n, r, i, a) => new Promise((o, s) => {
1733
+ }), mr = (e, t, n, r, i, a) => new Promise((o, s) => {
1735
1734
  let c = new XMLHttpRequest();
1736
1735
  if (c.open("POST", e), c.setRequestHeader("content-type", t), c.upload.onprogress = (e) => {
1737
1736
  e.lengthComputable && r(e.loaded / e.total);
@@ -1749,7 +1748,7 @@ var dr = () => {
1749
1748
  return;
1750
1749
  }
1751
1750
  i.addEventListener("abort", () => c.abort(), { once: !0 }), c.send(n);
1752
- }), _r = (e, t, n, r, i) => new Promise((a, o) => {
1751
+ }), hr = (e, t, n, r, i) => new Promise((a, o) => {
1753
1752
  let s = new XMLHttpRequest();
1754
1753
  if (s.open("PUT", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
1755
1754
  e.lengthComputable && r(e.loaded / e.total);
@@ -1760,7 +1759,7 @@ var dr = () => {
1760
1759
  return;
1761
1760
  }
1762
1761
  i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
1763
- }), vr = (e, t, n, r, i) => new Promise((a, o) => {
1762
+ }), gr = (e, t, n, r, i) => new Promise((a, o) => {
1764
1763
  let s = new XMLHttpRequest();
1765
1764
  if (s.open("POST", e), s.setRequestHeader("content-type", t), s.upload.onprogress = (e) => {
1766
1765
  e.lengthComputable && r(e.loaded / e.total);
@@ -1776,132 +1775,132 @@ var dr = () => {
1776
1775
  return;
1777
1776
  }
1778
1777
  i.addEventListener("abort", () => s.abort(), { once: !0 }), s.send(n);
1779
- }), yr = (e, t = {}) => {
1780
- let r = K(e), { inspectBaseUrl: a } = r, o = B(r);
1781
- o.current = r;
1782
- let [s, c] = V(0), [l, u] = V("idle"), [d, f] = V(void 0), p = B(null), m = I(() => {
1783
- c(0), u("idle"), f(void 0);
1784
- }, []), g = I(() => {
1778
+ }), _r = (t, n = {}) => {
1779
+ let r = K(t), { inspectBaseUrl: i } = r, a = V(r);
1780
+ a.current = r;
1781
+ let [o, s] = H(0), [c, l] = H("idle"), [d, f] = H(void 0), p = V(null), m = L(() => {
1782
+ s(0), l("idle"), f(void 0);
1783
+ }, []), h = L(() => {
1785
1784
  p.current?.abort();
1786
- }, []), _ = I((e) => /^https?:\/\//.test(e) ? e : `${a}${e}`, [a]), v = I(async (r, i, a, s) => {
1787
- let { runtime: c, client: l } = await J(o, e, "storage.upload").catch((e) => {
1788
- throw n(e, "client");
1789
- }), u = Math.max(0, i.retries ?? t.retries ?? 1), d = (r instanceof File, r.type || "application/octet-stream"), f = r instanceof File ? r.name : "blob", p = i.visibility ?? t.visibility, m = i.key ?? t.key, g = i.folder ?? t.folder, v = i.tags ?? t.tags, y = {
1785
+ }, []), g = L((e) => /^https?:\/\//.test(e) ? e : `${i}${e}`, [i]), _ = L(async (e, r, i, o) => {
1786
+ let { runtime: s, client: c } = await J(a, t, "storage.upload").catch((e) => {
1787
+ throw y(e, "client");
1788
+ }), l = Math.max(0, r.retries ?? n.retries ?? 1), d = (e instanceof File, e.type || "application/octet-stream"), f = 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 = {
1790
1789
  ...p ? { visibility: p } : {},
1791
- ...g ? { folder: g } : {},
1792
- ...v ? { tags: v } : {},
1793
- ...i.alt ? { alt: i.alt } : {},
1794
- ...i.caption ? { caption: i.caption } : {}
1790
+ ...h ? { folder: h } : {},
1791
+ ..._ ? { tags: _ } : {},
1792
+ ...r.alt ? { alt: r.alt } : {},
1793
+ ...r.caption ? { caption: r.caption } : {}
1795
1794
  }, b = (e) => ({
1796
1795
  id: e.id,
1797
- url: _(e.url),
1796
+ url: g(e.url),
1798
1797
  name: f,
1799
1798
  mime: e.contentType,
1800
1799
  size: e.size,
1801
1800
  ...e.width === void 0 ? {} : { width: e.width },
1802
1801
  ...e.height === void 0 ? {} : { height: e.height }
1803
1802
  }), x = async () => {
1804
- let e = i.mintTag ?? t.mintTag ?? Q("mintUploadTicket"), n = h(l, e), o = await C(c, n({
1803
+ let t = r.mintTag ?? n.mintTag ?? Q("mintUploadTicket"), a = C(c, t), l = await u(s, a({
1805
1804
  contentType: d,
1806
- ...y,
1805
+ ...v,
1807
1806
  ...m ? { key: m } : {}
1808
- })), u = await vr(_(o.uploadUrl), d, r, s, a);
1809
- return b(u);
1807
+ })), f = await gr(g(l.uploadUrl), d, e, o, i);
1808
+ return b(f);
1810
1809
  }, S = async () => {
1811
- let e = i.presignMintTag ?? t.presignMintTag ?? Q("mintPresignedUpload"), n = i.finalizeTag ?? t.finalizeTag ?? Q("finalizeUpload"), o;
1810
+ let t = r.presignMintTag ?? n.presignMintTag ?? Q("mintPresignedUpload"), a = r.finalizeTag ?? n.finalizeTag ?? Q("finalizeUpload"), l;
1812
1811
  try {
1813
- let t = h(l, e);
1814
- o = await C(c, t({
1812
+ let e = C(c, t);
1813
+ l = await u(s, e({
1815
1814
  contentType: d,
1816
- ...y
1815
+ ...v
1817
1816
  }));
1818
1817
  } catch {
1819
1818
  return null;
1820
1819
  }
1821
- await _r(o.uploadUrl, d, r, s, a);
1822
- let u = h(l, n), f = await C(c, u({ finalizeToken: o.finalizeToken }));
1823
- return b(f);
1820
+ await hr(l.uploadUrl, d, e, o, i);
1821
+ let f = C(c, a), p = await u(s, f({ finalizeToken: l.finalizeToken }));
1822
+ return b(p);
1824
1823
  }, w = async () => {
1825
- let e = i.beginResumableTag ?? t.beginResumableTag ?? Q("beginResumableUpload"), n = h(l, e), o = r.size, u = i.chunkSize ?? t.chunkSize, f = await C(c, n({
1824
+ let t = r.beginResumableTag ?? n.beginResumableTag ?? Q("beginResumableUpload"), a = C(c, t), l = e.size, f = r.chunkSize ?? n.chunkSize, p = await u(s, a({
1826
1825
  contentType: d,
1827
- size: o,
1828
- ...y,
1829
- ...u ? { chunkSize: u } : {}
1830
- })), p = _(f.uploadUrl), m = Math.max(1, f.chunkSize), g = Math.max(1, Math.ceil(o / m)), v = Math.max(0, i.retries ?? t.retries ?? 1), x = 0, S = null;
1831
- for (let e = 0; e < g; e++) {
1832
- let t = e * m, n = Math.min(o, t + m), i = r.slice(t, n), c = e === g - 1, l = n - t, u = 0;
1826
+ size: l,
1827
+ ...v,
1828
+ ...f ? { chunkSize: f } : {}
1829
+ })), m = g(p.uploadUrl), h = Math.max(1, p.chunkSize), _ = Math.max(1, Math.ceil(l / h)), y = Math.max(0, r.retries ?? n.retries ?? 1), x = 0, S = null;
1830
+ for (let t = 0; t < _; t++) {
1831
+ let n = t * h, r = Math.min(l, n + h), a = e.slice(n, r), s = t === _ - 1, c = r - n, u = 0;
1833
1832
  for (;;) {
1834
- if (a.aborted) throw new DOMException("upload aborted", "AbortError");
1833
+ if (i.aborted) throw new DOMException("upload aborted", "AbortError");
1835
1834
  try {
1836
- let t = await gr(`${p}?${`token=${encodeURIComponent(f.resumableToken)}&index=${e}${c ? "&final=1" : ""}`}`, d, i, (e) => s((x + e * l) / o), a, c);
1837
- c && (S = t);
1835
+ let e = await mr(`${m}?${`token=${encodeURIComponent(p.resumableToken)}&index=${t}${s ? "&final=1" : ""}`}`, d, a, (e) => o((x + e * c) / l), i, s);
1836
+ s && (S = e);
1838
1837
  break;
1839
1838
  } catch (e) {
1840
- if (e instanceof DOMException && e.name === "AbortError" || u++ >= v) throw e;
1839
+ if (e instanceof DOMException && e.name === "AbortError" || u++ >= y) throw e;
1841
1840
  }
1842
1841
  }
1843
- x += l, s(x / o);
1842
+ x += c, o(x / l);
1844
1843
  }
1845
1844
  if (!S) throw Error("resumable upload produced no final reply");
1846
1845
  return b(S);
1847
1846
  }, T = async () => {
1848
- let e = i.multipartBeginTag ?? t.multipartBeginTag ?? Q("beginMultipartUpload"), n = i.multipartSignTag ?? t.multipartSignTag ?? Q("signMultipartPart"), o = i.multipartCompleteTag ?? t.multipartCompleteTag ?? Q("completeMultipartUpload"), u = i.multipartAbortTag ?? t.multipartAbortTag ?? Q("abortMultipartUpload"), p = r.size, m = i.chunkSize ?? t.chunkSize, g;
1847
+ 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, _;
1849
1848
  try {
1850
- let t = h(l, e);
1851
- g = await C(c, t({
1849
+ let e = C(c, t);
1850
+ _ = await u(s, e({
1852
1851
  contentType: d,
1853
- size: p,
1854
- ...y,
1855
- ...m ? { partSize: m } : {}
1852
+ size: m,
1853
+ ...v,
1854
+ ...h ? { partSize: h } : {}
1856
1855
  }));
1857
1856
  } catch {
1858
1857
  return null;
1859
1858
  }
1860
- let v = h(l, n), b = h(l, o), x = h(l, u), S = Math.max(1, g.partSize), w = Math.max(1, Math.ceil(p / S)), T = Math.max(0, i.retries ?? t.retries ?? 1), E = [], D = 0;
1859
+ let y = C(c, a), b = C(c, l), x = C(c, p), S = Math.max(1, _.partSize), w = Math.max(1, Math.ceil(m / S)), T = Math.max(0, r.retries ?? n.retries ?? 1), E = [], D = 0;
1861
1860
  try {
1862
- for (let e = 0; e < w; e++) {
1863
- let t = e * S, n = Math.min(p, t + S), i = r.slice(t, n), o = e + 1, l = n - t, u = 0;
1861
+ for (let t = 0; t < w; t++) {
1862
+ let n = t * S, r = Math.min(m, n + S), a = e.slice(n, r), c = t + 1, l = r - n, d = 0;
1864
1863
  for (;;) {
1865
- if (a.aborted) throw new DOMException("upload aborted", "AbortError");
1864
+ if (i.aborted) throw new DOMException("upload aborted", "AbortError");
1866
1865
  try {
1867
- let { url: e } = await C(c, v({
1868
- multipartToken: g.multipartToken,
1869
- partNumber: o
1870
- })), t = await hr(e, i, (e) => s((D + e * l) / p), a);
1866
+ let { url: e } = await u(s, y({
1867
+ multipartToken: _.multipartToken,
1868
+ partNumber: c
1869
+ })), t = await pr(e, a, (e) => o((D + e * l) / m), i);
1871
1870
  E.push({
1872
- partNumber: o,
1871
+ partNumber: c,
1873
1872
  etag: t
1874
1873
  });
1875
1874
  break;
1876
1875
  } catch (e) {
1877
- if (e instanceof DOMException && e.name === "AbortError" || u++ >= T) throw e;
1876
+ if (e instanceof DOMException && e.name === "AbortError" || d++ >= T) throw e;
1878
1877
  }
1879
1878
  }
1880
- D += l, s(D / p);
1879
+ D += l, o(D / m);
1881
1880
  }
1882
- let e = await C(c, b({
1883
- multipartToken: g.multipartToken,
1881
+ let t = await u(s, b({
1882
+ multipartToken: _.multipartToken,
1884
1883
  parts: E
1885
1884
  }));
1886
1885
  return {
1887
- id: e.id,
1888
- url: _(e.url),
1886
+ id: t.id,
1887
+ url: g(t.url),
1889
1888
  name: f,
1890
1889
  mime: d,
1891
- size: e.size
1890
+ size: t.size
1892
1891
  };
1893
1892
  } catch (e) {
1894
1893
  try {
1895
- await C(c, x({ multipartToken: g.multipartToken }));
1894
+ await u(s, x({ multipartToken: _.multipartToken }));
1896
1895
  } catch {}
1897
1896
  throw e;
1898
1897
  }
1899
1898
  };
1900
- if ((i.prefer ?? t.prefer) === "multipart") return await T() || await w();
1901
- if ((i.prefer ?? t.prefer) === "resumable") return await w();
1902
- let E = (i.prefer ?? t.prefer) === "presign", D;
1903
- for (let e = 0; e <= u; e++) {
1904
- if (a.aborted) throw new DOMException("upload aborted", "AbortError");
1899
+ if ((r.prefer ?? n.prefer) === "multipart") return await T() || await w();
1900
+ if ((r.prefer ?? n.prefer) === "resumable") return await w();
1901
+ let E = (r.prefer ?? n.prefer) === "presign", D;
1902
+ for (let e = 0; e <= l; e++) {
1903
+ if (i.aborted) throw new DOMException("upload aborted", "AbortError");
1905
1904
  try {
1906
1905
  if (E) {
1907
1906
  let e = await S();
@@ -1909,111 +1908,111 @@ var dr = () => {
1909
1908
  }
1910
1909
  return await x();
1911
1910
  } catch (t) {
1912
- if (t instanceof DOMException && t.name === "AbortError" || (D = t, e === u)) throw t;
1911
+ if (t instanceof DOMException && t.name === "AbortError" || (D = t, e === l)) throw t;
1913
1912
  }
1914
1913
  }
1915
1914
  throw D;
1916
1915
  }, [
1917
- e,
1918
- _,
1919
- t.mintTag,
1920
- t.presignMintTag,
1921
- t.finalizeTag,
1922
- t.beginResumableTag,
1923
- t.multipartBeginTag,
1924
- t.multipartSignTag,
1925
- t.multipartCompleteTag,
1926
- t.multipartAbortTag,
1927
- t.chunkSize,
1928
- t.prefer,
1929
- t.visibility,
1930
- t.key,
1931
- t.folder,
1932
- t.tags,
1933
- t.retries
1934
- ]), y = I(async (e, n = {}) => {
1935
- let r = new AbortController();
1936
- p.current = r, u("uploading"), f(void 0), c(0);
1916
+ t,
1917
+ g,
1918
+ n.mintTag,
1919
+ n.presignMintTag,
1920
+ n.finalizeTag,
1921
+ n.beginResumableTag,
1922
+ n.multipartBeginTag,
1923
+ n.multipartSignTag,
1924
+ n.multipartCompleteTag,
1925
+ n.multipartAbortTag,
1926
+ n.chunkSize,
1927
+ n.prefer,
1928
+ n.visibility,
1929
+ n.key,
1930
+ n.folder,
1931
+ n.tags,
1932
+ n.retries
1933
+ ]), v = L(async (t, r = {}) => {
1934
+ let i = new AbortController();
1935
+ p.current = i, l("uploading"), f(void 0), s(0);
1937
1936
  try {
1938
- let t = await v(e, n, r.signal, c);
1939
- return c(1), u("success"), t;
1940
- } catch (e) {
1941
- throw u("error"), f(e), e instanceof DOMException && e.name === "AbortError" || o.current.errorBus.emit({
1937
+ let e = await _(t, r, i.signal, s);
1938
+ return s(1), l("success"), e;
1939
+ } catch (t) {
1940
+ throw l("error"), f(t), t instanceof DOMException && t.name === "AbortError" || a.current.errorBus.emit({
1942
1941
  source: "action",
1943
- tag: n.mintTag ?? t.mintTag ?? Q("mintUploadTicket"),
1944
- error: e,
1945
- kind: i(e, "unknown"),
1946
- outcome: i(e, "unknown") === "transport" ? "unknown" : "not-applicable"
1947
- }), e;
1942
+ tag: r.mintTag ?? n.mintTag ?? Q("mintUploadTicket"),
1943
+ error: t,
1944
+ kind: e(t, "unknown"),
1945
+ outcome: e(t, "unknown") === "transport" ? "unknown" : "not-applicable"
1946
+ }), t;
1948
1947
  }
1949
- }, [v, t.mintTag]), b = I(async (e, n = {}) => {
1950
- if (e.length === 0) return [];
1951
- let r = new AbortController();
1952
- p.current = r, u("uploading"), f(void 0), c(0);
1953
- let a = Math.max(1, n.concurrency ?? t.concurrency ?? 3), s = Array(e.length), l = Array(e.length).fill(0), d = () => c(l.reduce((e, t) => e + t, 0) / e.length), m = 0, h = async () => {
1948
+ }, [_, n.mintTag]), b = L(async (t, r = {}) => {
1949
+ if (t.length === 0) return [];
1950
+ let i = new AbortController();
1951
+ p.current = i, l("uploading"), f(void 0), s(0);
1952
+ let o = Math.max(1, r.concurrency ?? n.concurrency ?? 3), c = Array(t.length), u = Array(t.length).fill(0), d = () => s(u.reduce((e, t) => e + t, 0) / t.length), m = 0, h = async () => {
1954
1953
  for (;;) {
1955
- let t = m++;
1956
- if (t >= e.length) return;
1957
- s[t] = await v(e[t], n, r.signal, (e) => {
1958
- l[t] = e, d();
1959
- }), l[t] = 1, d();
1954
+ let e = m++;
1955
+ if (e >= t.length) return;
1956
+ c[e] = await _(t[e], r, i.signal, (t) => {
1957
+ u[e] = t, d();
1958
+ }), u[e] = 1, d();
1960
1959
  }
1961
1960
  };
1962
1961
  try {
1963
- return await Promise.all(Array.from({ length: Math.min(a, e.length) }, () => h())), c(1), u("success"), s;
1964
- } catch (e) {
1965
- throw r.abort(), u("error"), f(e), e instanceof DOMException && e.name === "AbortError" || o.current.errorBus.emit({
1962
+ return await Promise.all(Array.from({ length: Math.min(o, t.length) }, () => h())), s(1), l("success"), c;
1963
+ } catch (t) {
1964
+ throw i.abort(), l("error"), f(t), t instanceof DOMException && t.name === "AbortError" || a.current.errorBus.emit({
1966
1965
  source: "action",
1967
- tag: n.mintTag ?? t.mintTag ?? Q("mintUploadTicket"),
1968
- error: e,
1969
- kind: i(e, "unknown"),
1970
- outcome: i(e, "unknown") === "transport" ? "unknown" : "not-applicable"
1971
- }), e;
1966
+ tag: r.mintTag ?? n.mintTag ?? Q("mintUploadTicket"),
1967
+ error: t,
1968
+ kind: e(t, "unknown"),
1969
+ outcome: e(t, "unknown") === "transport" ? "unknown" : "not-applicable"
1970
+ }), t;
1972
1971
  }
1973
1972
  }, [
1974
- v,
1975
- t.concurrency,
1976
- t.mintTag
1977
- ]), x = I((e, t = {}) => {
1973
+ _,
1974
+ n.concurrency,
1975
+ n.mintTag
1976
+ ]), x = L((e, t = {}) => {
1978
1977
  e.preventDefault();
1979
1978
  let n = e.dataTransfer ? Array.from(e.dataTransfer.files) : [];
1980
1979
  return n.length ? b(n, t) : Promise.resolve([]);
1981
- }, [b]), S = I((e, t = {}) => {
1980
+ }, [b]), S = L((e, t = {}) => {
1982
1981
  let n = e.clipboardData ? Array.from(e.clipboardData.files) : [];
1983
1982
  return n.length ? b(n, t) : Promise.resolve([]);
1984
- }, [b]), w = z(() => ({
1983
+ }, [b]), w = B(() => ({
1985
1984
  onDragOver: (e) => e.preventDefault(),
1986
1985
  onDrop: (e) => {
1987
1986
  x(e);
1988
1987
  }
1989
1988
  }), [x]);
1990
- return z(() => ({
1991
- upload: y,
1989
+ return B(() => ({
1990
+ upload: v,
1992
1991
  uploadMany: b,
1993
- progress: s,
1994
- status: l,
1992
+ progress: o,
1993
+ status: c,
1995
1994
  error: d,
1996
- cancel: g,
1995
+ cancel: h,
1997
1996
  reset: m,
1998
1997
  onDrop: x,
1999
1998
  onPaste: S,
2000
1999
  dropzoneProps: w
2001
2000
  }), [
2002
- y,
2001
+ v,
2003
2002
  b,
2004
- s,
2005
- l,
2003
+ o,
2004
+ c,
2006
2005
  d,
2007
- g,
2006
+ h,
2008
2007
  m,
2009
2008
  x,
2010
2009
  S,
2011
2010
  w
2012
2011
  ]);
2013
- }, br = (e, t) => {
2014
- let n = yr(e), r = Dn(e, t.action), [i, a] = V("idle"), [o, s] = V(void 0), [c, l] = V(void 0), u = B(t.extra);
2012
+ }, vr = (e, t) => {
2013
+ let n = _r(e), r = Tn(e, t.action), [i, a] = H("idle"), [o, s] = H(void 0), [c, l] = H(void 0), u = V(t.extra);
2015
2014
  u.current = t.extra;
2016
- let d = I(async (e) => {
2015
+ let d = L(async (e) => {
2017
2016
  l(void 0), s(void 0), a("uploading");
2018
2017
  let t;
2019
2018
  try {
@@ -2031,12 +2030,12 @@ var dr = () => {
2031
2030
  } catch (e) {
2032
2031
  throw a("error"), l(e), e;
2033
2032
  }
2034
- }, [n, r]), f = I(() => {
2033
+ }, [n, r]), f = L(() => {
2035
2034
  n.cancel(), a("idle");
2036
- }, [n]), p = I(() => {
2035
+ }, [n]), p = L(() => {
2037
2036
  n.reset(), a("idle"), s(void 0), l(void 0);
2038
2037
  }, [n]);
2039
- return z(() => ({
2038
+ return B(() => ({
2040
2039
  phase: i,
2041
2040
  progress: i === "uploading" ? n.progress : void 0,
2042
2041
  result: o,
@@ -2055,8 +2054,8 @@ var dr = () => {
2055
2054
  p
2056
2055
  ]);
2057
2056
  }, $ = async (e) => {
2058
- let t = h(e.client, e.tag), n = U.currentSpan.pipe(U.tap((t) => U.sync(() => {
2059
- _({
2057
+ let t = C(e.client, e.tag), n = U.currentSpan.pipe(U.tap((t) => U.sync(() => {
2058
+ v({
2060
2059
  traceId: t.traceId,
2061
2060
  spanId: t.spanId,
2062
2061
  source: "mutation",
@@ -2066,14 +2065,14 @@ var dr = () => {
2066
2065
  "voltro.api": e.apiName,
2067
2066
  "rpc.tag": e.tag
2068
2067
  } }));
2069
- return C(e.runtime, n);
2070
- }, xr = (e, t) => {
2071
- let n = K(e), { descriptors: r } = n, i = B(n);
2068
+ return u(e.runtime, n);
2069
+ }, yr = (e, t) => {
2070
+ let n = K(e), { descriptors: r } = n, i = V(n);
2072
2071
  if (i.current = n, process.env.NODE_ENV !== "production") {
2073
2072
  let n = r[t]?.kind;
2074
2073
  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.`);
2075
2074
  }
2076
- let [a, o] = V(!1), [s, c] = V(void 0), [l, u] = V(void 0), d = I(async (n) => {
2075
+ let [a, o] = H(!1), [s, c] = H(void 0), [l, d] = H(void 0), f = L(async (n) => {
2077
2076
  o(!0), c(void 0);
2078
2077
  try {
2079
2078
  let { runtime: r, client: a } = await J(i, e, t), o = await $({
@@ -2084,13 +2083,13 @@ var dr = () => {
2084
2083
  input: n,
2085
2084
  spanPrefix: "client.workflow.start"
2086
2085
  });
2087
- return u(o), o;
2086
+ return d(o), o;
2088
2087
  } catch (e) {
2089
2088
  throw c(e), e;
2090
2089
  } finally {
2091
2090
  o(!1);
2092
2091
  }
2093
- }, [e, t]), f = I(async (t) => {
2092
+ }, [e, t]), p = L(async (t) => {
2094
2093
  let n = "__voltro.workflow.queued.cancel", { runtime: r, client: a } = await J(i, e, n);
2095
2094
  return $({
2096
2095
  apiName: e,
@@ -2100,25 +2099,25 @@ var dr = () => {
2100
2099
  input: t,
2101
2100
  spanPrefix: "client.workflow.queued.cancel"
2102
2101
  });
2103
- }, [e]), p = I(async (t) => {
2104
- let n = "__voltro.workflow.queued.control", { runtime: r, client: a } = await J(i, e, n), o = h(a, n);
2105
- return C(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
2106
- if (De.isSome(e)) {
2102
+ }, [e]), m = L(async (t) => {
2103
+ let n = "__voltro.workflow.queued.control", { runtime: r, client: a } = await J(i, e, n), o = C(a, n);
2104
+ return u(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
2105
+ if (ke.isSome(e)) {
2107
2106
  if (e.value._tag === "snapshot") return U.succeed(e.value.data);
2108
2107
  if (e.value._tag === "error") return U.fail(e.value.error);
2109
2108
  }
2110
2109
  return U.fail(/* @__PURE__ */ Error("queued workflow control query ended without a snapshot"));
2111
2110
  })));
2112
- }, [e]), m = I(async (t) => {
2113
- let n = "__voltro.workflow.control", { runtime: r, client: a } = await J(i, e, n), o = h(a, n);
2114
- return C(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
2115
- if (De.isSome(e)) {
2111
+ }, [e]), h = L(async (t) => {
2112
+ let n = "__voltro.workflow.control", { runtime: r, client: a } = await J(i, e, n), o = C(a, n);
2113
+ return u(r, W.runHead(o(t)).pipe(U.flatMap((e) => {
2114
+ if (ke.isSome(e)) {
2116
2115
  if (e.value._tag === "snapshot") return U.succeed(e.value.data);
2117
2116
  if (e.value._tag === "error") return U.fail(e.value.error);
2118
2117
  }
2119
2118
  return U.fail(/* @__PURE__ */ Error("workflow control query ended without a snapshot"));
2120
2119
  })));
2121
- }, [e]), g = I(async (t, n) => {
2120
+ }, [e]), g = L(async (t, n) => {
2122
2121
  let { runtime: r, client: a } = await J(i, e, "__voltro.workflow.cancel");
2123
2122
  return $({
2124
2123
  apiName: e,
@@ -2131,7 +2130,7 @@ var dr = () => {
2131
2130
  },
2132
2131
  spanPrefix: "client.workflow.cancel"
2133
2132
  });
2134
- }, [e]), _ = I(async (t, n) => {
2133
+ }, [e]), _ = L(async (t, n) => {
2135
2134
  let { runtime: r, client: a } = await J(i, e, "__voltro.workflow.resume");
2136
2135
  return $({
2137
2136
  apiName: e,
@@ -2144,7 +2143,7 @@ var dr = () => {
2144
2143
  },
2145
2144
  spanPrefix: "client.workflow.resume"
2146
2145
  });
2147
- }, [e]), v = I(async (t, n, r) => {
2146
+ }, [e]), v = L(async (t, n, r) => {
2148
2147
  let { runtime: a, client: o } = await J(i, e, "__voltro.workflow.signal");
2149
2148
  return $({
2150
2149
  apiName: e,
@@ -2158,7 +2157,7 @@ var dr = () => {
2158
2157
  },
2159
2158
  spanPrefix: "client.workflow.signal"
2160
2159
  });
2161
- }, [e]), y = I(async (t, n, r, a) => {
2160
+ }, [e]), y = L(async (t, n, r, a) => {
2162
2161
  let { runtime: o, client: s } = await J(i, e, "__voltro.workflow.update");
2163
2162
  return $({
2164
2163
  apiName: e,
@@ -2174,12 +2173,12 @@ var dr = () => {
2174
2173
  spanPrefix: "client.workflow.update"
2175
2174
  });
2176
2175
  }, [e]);
2177
- return z(() => ({
2178
- start: d,
2179
- cancelQueued: f,
2180
- readQueuedCancellation: p,
2176
+ return B(() => ({
2177
+ start: f,
2178
+ cancelQueued: p,
2179
+ readQueuedCancellation: m,
2181
2180
  cancel: g,
2182
- readControl: m,
2181
+ readControl: h,
2183
2182
  resume: _,
2184
2183
  signal: v,
2185
2184
  update: y,
@@ -2187,11 +2186,11 @@ var dr = () => {
2187
2186
  error: s,
2188
2187
  data: l
2189
2188
  }), [
2190
- d,
2191
2189
  f,
2192
2190
  p,
2193
- g,
2194
2191
  m,
2192
+ g,
2193
+ h,
2195
2194
  _,
2196
2195
  v,
2197
2196
  y,
@@ -2199,10 +2198,10 @@ var dr = () => {
2199
2198
  s,
2200
2199
  l
2201
2200
  ]);
2202
- }, Sr = (e) => {
2203
- let t = K(e), n = B(t);
2201
+ }, br = (e) => {
2202
+ let t = K(e), n = V(t);
2204
2203
  n.current = t;
2205
- let [r, i] = V(!1), [a, o] = V(void 0), [s, c] = V(void 0), l = I(async (t, r, a) => {
2204
+ let [r, i] = H(!1), [a, o] = H(void 0), [s, c] = H(void 0), l = L(async (t, r, a) => {
2206
2205
  i(!0), o(void 0);
2207
2206
  try {
2208
2207
  let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.signal"), s = await $({
@@ -2224,7 +2223,7 @@ var dr = () => {
2224
2223
  i(!1);
2225
2224
  }
2226
2225
  }, [e]);
2227
- return z(() => ({
2226
+ return B(() => ({
2228
2227
  signal: l,
2229
2228
  pending: r,
2230
2229
  error: a,
@@ -2235,10 +2234,10 @@ var dr = () => {
2235
2234
  a,
2236
2235
  s
2237
2236
  ]);
2238
- }, Cr = (e) => {
2239
- let t = K(e), n = B(t);
2237
+ }, xr = (e) => {
2238
+ let t = K(e), n = V(t);
2240
2239
  n.current = t;
2241
- let [r, i] = V(!1), [a, o] = V(void 0), [s, c] = V(void 0), l = I(async (t, r, a, s) => {
2240
+ let [r, i] = H(!1), [a, o] = H(void 0), [s, c] = H(void 0), l = L(async (t, r, a, s) => {
2242
2241
  i(!0), o(void 0);
2243
2242
  try {
2244
2243
  let { runtime: i, client: o } = await J(n, e, "__voltro.workflow.update"), l = await $({
@@ -2261,7 +2260,7 @@ var dr = () => {
2261
2260
  i(!1);
2262
2261
  }
2263
2262
  }, [e]);
2264
- return z(() => ({
2263
+ return B(() => ({
2265
2264
  update: l,
2266
2265
  pending: r,
2267
2266
  error: a,
@@ -2272,7 +2271,7 @@ var dr = () => {
2272
2271
  a,
2273
2272
  s
2274
2273
  ]);
2275
- }, wr = (e, t) => {
2274
+ }, Sr = (e, t) => {
2276
2275
  let n = q(e, "__voltro.workflow.run", t ? { id: t } : {}, { skip: t === void 0 });
2277
2276
  return n.loading || n.idle || n.failed ? {
2278
2277
  ...n,
@@ -2281,7 +2280,7 @@ var dr = () => {
2281
2280
  ...n,
2282
2281
  run: n.data[0]
2283
2282
  };
2284
- }, Tr = (e, t = {}, n = {}) => {
2283
+ }, Cr = (e, t = {}, n = {}) => {
2285
2284
  let r = q(e, "__voltro.workflow.runs", t, n);
2286
2285
  return r.loading || r.idle || r.failed ? {
2287
2286
  ...r,
@@ -2290,7 +2289,7 @@ var dr = () => {
2290
2289
  ...r,
2291
2290
  runs: r.data
2292
2291
  };
2293
- }, Er = (e, t) => {
2292
+ }, wr = (e, t) => {
2294
2293
  let n = q(e, "__voltro.workflow.run.steps", t ? { runId: t } : {}, { skip: t === void 0 });
2295
2294
  return n.loading || n.idle || n.failed ? {
2296
2295
  ...n,
@@ -2299,7 +2298,7 @@ var dr = () => {
2299
2298
  ...n,
2300
2299
  steps: n.data
2301
2300
  };
2302
- }, Dr = (e, t) => {
2301
+ }, Tr = (e, t) => {
2303
2302
  let n = q(e, "__voltro.workflow.run.events", t ? { runId: t } : {}, { skip: t === void 0 });
2304
2303
  return n.loading || n.idle || n.failed ? {
2305
2304
  ...n,
@@ -2308,7 +2307,7 @@ var dr = () => {
2308
2307
  ...n,
2309
2308
  events: n.data
2310
2309
  };
2311
- }, Or = Dr, kr = (e, t = {}, n = {}) => {
2310
+ }, Er = Tr, Dr = (e, t = {}, n = {}) => {
2312
2311
  let r = q(e, "__voltro.workflow.domainEvents", t, n);
2313
2312
  return r.loading || r.idle || r.failed ? {
2314
2313
  ...r,
@@ -2317,7 +2316,7 @@ var dr = () => {
2317
2316
  ...r,
2318
2317
  events: r.data
2319
2318
  };
2320
- }, Ar = (e, t) => {
2319
+ }, Or = (e, t) => {
2321
2320
  let n = q(e, "__voltro.workflow.event.deliveries", t ? { eventId: t } : {}, { skip: t === void 0 });
2322
2321
  return n.loading || n.idle || n.failed ? {
2323
2322
  ...n,
@@ -2326,42 +2325,42 @@ var dr = () => {
2326
2325
  ...n,
2327
2326
  deliveries: n.data
2328
2327
  };
2329
- }, jr = (e, t) => {
2328
+ }, kr = (e, t) => {
2330
2329
  let n = e.payload;
2331
2330
  if (!n || typeof n != "object") return;
2332
2331
  let r = n[t];
2333
2332
  return typeof r == "string" ? r : void 0;
2334
- }, Mr = (e) => {
2333
+ }, Ar = (e) => {
2335
2334
  let t = e.payload;
2336
2335
  if (!t || typeof t != "object") return;
2337
2336
  let n = t.updateId;
2338
2337
  return typeof n == "string" ? n : void 0;
2339
- }, Nr = (e) => {
2338
+ }, jr = (e) => {
2340
2339
  let t = /* @__PURE__ */ new Set(), n = /* @__PURE__ */ new Set();
2341
2340
  for (let r of e) if (r.eventType === "signal-received") {
2342
- let e = jr(r, "signalName");
2341
+ let e = kr(r, "signalName");
2343
2342
  e && t.add(e);
2344
2343
  } else if (r.eventType === "update-completed" || r.eventType === "update-failed") {
2345
- let e = Mr(r);
2344
+ let e = Ar(r);
2346
2345
  e && n.add(e);
2347
2346
  }
2348
2347
  for (let r = e.length - 1; r >= 0; --r) {
2349
2348
  let i = e[r];
2350
2349
  if (i.eventType === "signal-awaited") {
2351
- let e = jr(i, "signalName");
2350
+ let e = kr(i, "signalName");
2352
2351
  if (e && !t.has(e)) return {
2353
2352
  name: e,
2354
2353
  kind: "signal"
2355
2354
  };
2356
2355
  } else if (i.eventType === "update-requested") {
2357
- let e = Mr(i), t = jr(i, "updateName");
2356
+ let e = Ar(i), t = kr(i, "updateName");
2358
2357
  if (t && (!e || !n.has(e))) return {
2359
2358
  name: t,
2360
2359
  kind: "update"
2361
2360
  };
2362
2361
  }
2363
2362
  }
2364
- }, Pr = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), Fr = (e, t) => {
2363
+ }, Mr = (e) => e.find((e) => e.status === "running") || (e.length > 0 ? e[e.length - 1] : void 0), Nr = (e, t) => {
2365
2364
  if (!e || e.status !== "failed") return;
2366
2365
  let n = t.find((e) => e.status === "failed");
2367
2366
  return {
@@ -2369,34 +2368,34 @@ var dr = () => {
2369
2368
  message: e.errorMessage,
2370
2369
  step: n?.stepName
2371
2370
  };
2372
- }, Ir = (e, t) => {
2373
- let n = wr(e, t), r = Er(e, t), i = Dr(e, t), a = xr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = I(async () => {
2371
+ }, Pr = (e, t) => {
2372
+ let n = Sr(e, t), r = wr(e, t), i = Tr(e, t), a = yr(e, n.run?.tag ?? ""), o = n.run, s = r.steps, c = i.events, l = L(async () => {
2374
2373
  if (!o) throw Error("useWorkflowRunState: no run loaded — cannot cancel");
2375
2374
  await a.cancel({
2376
2375
  workflowName: o.tag,
2377
2376
  executionId: o.executionId
2378
2377
  });
2379
- }, [a, o]), u = I(async () => {
2378
+ }, [a, o]), u = L(async () => {
2380
2379
  if (!o) throw Error("useWorkflowRunState: no run loaded — cannot resume");
2381
2380
  await a.resume({
2382
2381
  workflowName: o.tag,
2383
2382
  executionId: o.executionId
2384
2383
  });
2385
- }, [a, o]), d = I((e, n) => {
2384
+ }, [a, o]), d = L((e, n) => {
2386
2385
  if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot signal");
2387
2386
  return a.signal({ id: t }, e, n);
2388
- }, [a, t]), f = I((e, n, r) => {
2387
+ }, [a, t]), f = L((e, n, r) => {
2389
2388
  if (t === void 0) throw Error("useWorkflowRunState: no run id — cannot update");
2390
2389
  return a.update({ id: t }, e, n, r);
2391
2390
  }, [a, t]);
2392
- return z(() => ({
2391
+ return B(() => ({
2393
2392
  run: o,
2394
2393
  status: o?.status,
2395
2394
  steps: s,
2396
2395
  events: c,
2397
- currentStep: Pr(s),
2398
- waitingFor: o?.status === "suspended" ? Nr(c) : void 0,
2399
- error: Fr(o, s),
2396
+ currentStep: Mr(s),
2397
+ waitingFor: o?.status === "suspended" ? jr(c) : void 0,
2398
+ error: Nr(o, s),
2400
2399
  traceId: o?.traceId,
2401
2400
  loading: n.data === void 0,
2402
2401
  cancel: l,
@@ -2413,89 +2412,89 @@ var dr = () => {
2413
2412
  d,
2414
2413
  f
2415
2414
  ]);
2416
- }, Lr = (e, t) => {
2417
- let { runtime: n, client: r } = K(e), [i, a] = V([]), [o, s] = V("idle"), [c, l] = V(void 0), u = B(null), d = I(() => {
2418
- let e = u.current;
2419
- e && (u.current = null, n.runFork(Ee.interrupt(e)), s((e) => e === "streaming" ? "idle" : e));
2415
+ }, Fr = (e, t) => {
2416
+ let { runtime: n, client: r } = K(e), [i, o] = H([]), [s, c] = H("idle"), [l, u] = H(void 0), d = V(null), f = L(() => {
2417
+ let e = d.current;
2418
+ e && (d.current = null, n.runFork(Oe.interrupt(e)), c((e) => e === "streaming" ? "idle" : e));
2420
2419
  }, [n]);
2421
2420
  return {
2422
2421
  events: i,
2423
- status: o,
2424
- error: c,
2425
- start: I((e = {}) => {
2426
- let i = u.current;
2427
- i && n.runFork(Ee.interrupt(i)), a([]), l(void 0), s("streaming");
2428
- let o = h(r, t)(e), c = W.runForEach(o, (e) => U.sync(() => a((t) => [...t, e]))).pipe(U.matchCause({
2422
+ status: s,
2423
+ error: l,
2424
+ start: L((e = {}) => {
2425
+ let i = d.current;
2426
+ i && n.runFork(Oe.interrupt(i)), o([]), u(void 0), c("streaming");
2427
+ let s = C(r, t)(e), l = W.runForEach(s, (e) => U.sync(() => o((t) => [...t, e]))).pipe(U.matchCause({
2429
2428
  onSuccess: () => {
2430
- s("done");
2429
+ c("done");
2431
2430
  },
2432
2431
  onFailure: (e) => {
2433
- Ce.isInterruptedOnly(e) || (l(g(e)), s("error"));
2432
+ Te.isInterruptedOnly(e) || (u(a(e)), c("error"));
2434
2433
  }
2435
2434
  }));
2436
- u.current = n.runFork(c);
2435
+ d.current = n.runFork(l);
2437
2436
  }, [
2438
2437
  n,
2439
2438
  r,
2440
2439
  t
2441
2440
  ]),
2442
- cancel: d
2441
+ cancel: f
2443
2442
  };
2444
- }, Rr = (e, t, n, r) => {
2445
- let i = 0, a = !1, o = (e) => U.sync(() => {
2446
- e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (a = !0));
2447
- }), s = (e) => {
2443
+ }, Ir = (e, t, n, r) => {
2444
+ let i = 0, o = !1, s = (e) => U.sync(() => {
2445
+ e.seq <= i || (i = e.seq, n.onEvent(e.event), r.isTerminal(e.event) && (o = !0));
2446
+ }), c = (e) => {
2448
2447
  if (typeof e != "object" || !e) return;
2449
2448
  let t = e.name, n = e.message;
2450
2449
  if (typeof t == "string" || typeof n == "string") return `${typeof t == "string" ? t : ""}::${typeof n == "string" ? n : ""}`;
2451
- }, c, l = (e, t, a) => {
2452
- let o = i > t, l = o ? 0 : e + 1, d = a === void 0 ? void 0 : s(a), f = d !== void 0 && d === c && !o;
2453
- if (c = o ? void 0 : d, f || l > r.maxReconnects) return U.sync(() => {
2450
+ }, l, u = (e, t, a) => {
2451
+ let o = i > t, s = o ? 0 : e + 1, u = a === void 0 ? void 0 : c(a), f = u !== void 0 && u === l && !o;
2452
+ if (l = o ? void 0 : u, f || s > r.maxReconnects) return U.sync(() => {
2454
2453
  n.onError(a ?? /* @__PURE__ */ Error("stream connection lost")), n.onStatus("error");
2455
2454
  });
2456
- let p = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, l - 1));
2455
+ let p = Math.min(r.maxBackoffMs, r.backoffMs * 2 ** Math.max(0, s - 1));
2457
2456
  return U.sync(() => {
2458
2457
  n.onStatus("reconnecting"), n.onReconnect();
2459
- }).pipe(U.zipRight(U.sleep(we.millis(p))), U.zipRight(U.sync(() => n.onStatus("streaming"))), U.zipRight(u(l)));
2460
- }, u = (r) => U.suspend(() => {
2461
- let s = i, c = e({
2458
+ }).pipe(U.zipRight(U.sleep(Ee.millis(p))), U.zipRight(U.sync(() => n.onStatus("streaming"))), U.zipRight(d(s)));
2459
+ }, d = (r) => U.suspend(() => {
2460
+ let c = i, l = e({
2462
2461
  ...t,
2463
- fromSeq: s
2462
+ fromSeq: c
2464
2463
  });
2465
- return W.runForEach(c, o).pipe(U.matchCauseEffect({
2466
- onSuccess: () => a ? U.sync(() => n.onStatus("done")) : l(r, s, void 0),
2467
- onFailure: (e) => Ce.isInterruptedOnly(e) ? U.void : a ? U.sync(() => n.onStatus("done")) : l(r, s, g(e))
2464
+ return W.runForEach(l, s).pipe(U.matchCauseEffect({
2465
+ onSuccess: () => o ? U.sync(() => n.onStatus("done")) : u(r, c, void 0),
2466
+ onFailure: (e) => Te.isInterruptedOnly(e) ? U.void : o ? U.sync(() => n.onStatus("done")) : u(r, c, a(e))
2468
2467
  }));
2469
2468
  });
2470
- return u(0);
2471
- }, zr = (e) => {
2469
+ return d(0);
2470
+ }, Lr = (e) => {
2472
2471
  let t = e?._tag;
2473
2472
  return t === "done" || t === "error";
2474
- }, Br = (e, t, n = {}) => {
2475
- 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 = {
2473
+ }, Rr = (e, t, n = {}) => {
2474
+ let { runtime: r, client: i } = K(e), [a, o] = H([]), [s, c] = H("idle"), [l, u] = H(0), [d, f] = H(void 0), p = V(null), m = {
2476
2475
  maxReconnects: n.maxReconnects ?? 6,
2477
2476
  backoffMs: n.backoffMs ?? 400,
2478
2477
  maxBackoffMs: n.maxBackoffMs ?? 8e3,
2479
- isTerminal: n.isTerminal ?? zr
2480
- }, g = I(() => {
2478
+ isTerminal: n.isTerminal ?? Lr
2479
+ }, h = L(() => {
2481
2480
  let e = p.current;
2482
- e && (p.current = null, r.runFork(Ee.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
2481
+ e && (p.current = null, r.runFork(Oe.interrupt(e)), c((e) => e === "streaming" || e === "reconnecting" ? "idle" : e));
2483
2482
  }, [r]);
2484
2483
  return {
2485
2484
  events: a,
2486
2485
  status: s,
2487
2486
  reconnects: l,
2488
2487
  error: d,
2489
- start: I((e = {}) => {
2488
+ start: L((e = {}) => {
2490
2489
  let n = p.current;
2491
- n && r.runFork(Ee.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
2492
- let a = h(i, t), s = {
2490
+ n && r.runFork(Oe.interrupt(n)), o([]), f(void 0), u(0), c("streaming");
2491
+ let a = C(i, t), s = {
2493
2492
  onEvent: (e) => o((t) => [...t, e]),
2494
2493
  onStatus: c,
2495
2494
  onReconnect: () => u((e) => e + 1),
2496
2495
  onError: f
2497
2496
  };
2498
- p.current = r.runFork(Rr(a, e, s, m));
2497
+ p.current = r.runFork(Ir(a, e, s, m));
2499
2498
  }, [
2500
2499
  r,
2501
2500
  i,
@@ -2505,15 +2504,15 @@ var dr = () => {
2505
2504
  m.maxBackoffMs,
2506
2505
  m.isTerminal
2507
2506
  ]),
2508
- cancel: g
2507
+ cancel: h
2509
2508
  };
2510
- }, Vr = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), Hr = (e) => {
2509
+ }, zr = (e, t) => e.order - t.order || (e.stepOrder ?? 0) - (t.stepOrder ?? 0), Br = (e) => {
2511
2510
  for (let t = e.length - 1; t >= 0; --t) {
2512
2511
  let n = e[t];
2513
2512
  if (n.role === "user" && n.content) return n.content;
2514
2513
  }
2515
- }, Ur = (e, t, n) => {
2516
- let { threadId: r } = n, i = q(e, `${t}.messages`, { threadId: r }), a = Dn(e, `${t}.send`), o = z(() => [...i.data ?? []].sort(Vr), [i.data]), s = I((e, t = {}) => a.run({
2514
+ }, Vr = (e, t, n) => {
2515
+ let { threadId: r } = n, i = q(e, `${t}.messages`, { threadId: r }), a = Tn(e, `${t}.send`), o = B(() => [...i.data ?? []].sort(zr), [i.data]), s = L((e, t = {}) => a.run({
2517
2516
  threadId: r,
2518
2517
  order: i.data?.length ?? 0,
2519
2518
  prompt: e,
@@ -2522,11 +2521,11 @@ var dr = () => {
2522
2521
  a,
2523
2522
  r,
2524
2523
  i.data
2525
- ]), c = I(() => {
2526
- let e = Hr(o);
2524
+ ]), c = L(() => {
2525
+ let e = Br(o);
2527
2526
  return e === void 0 ? void 0 : s(e);
2528
2527
  }, [o, s]);
2529
- return z(() => ({
2528
+ return B(() => ({
2530
2529
  messages: o,
2531
2530
  streaming: o.some((e) => e.streaming),
2532
2531
  loading: i.data === void 0,
@@ -2543,9 +2542,9 @@ var dr = () => {
2543
2542
  s,
2544
2543
  c
2545
2544
  ]);
2546
- }, Wr = (e, t) => {
2547
- let { events: n, status: r, error: i, start: a, cancel: o } = Lr(e, t), [s, c] = V([]), l = B(null), u = z(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
2548
- return R(() => {
2545
+ }, Hr = (e, t) => {
2546
+ let { events: n, status: r, error: i, start: a, cancel: o } = Fr(e, t), [s, c] = H([]), l = V(null), u = B(() => n.filter((e) => e._tag === "token").map((e) => e.text ?? "").join(""), [n]);
2547
+ return z(() => {
2549
2548
  if (r !== "done" || l.current === null) return;
2550
2549
  let e = l.current;
2551
2550
  l.current = null, c((t) => [
@@ -2564,18 +2563,18 @@ var dr = () => {
2564
2563
  history: s,
2565
2564
  status: r,
2566
2565
  error: i,
2567
- send: I((e = {}) => {
2566
+ send: L((e = {}) => {
2568
2567
  let t = e.message;
2569
2568
  l.current = typeof t == "string" ? t : "", a(e);
2570
2569
  }, [a]),
2571
2570
  cancel: o
2572
2571
  };
2573
- }, Gr = (e, t) => {
2574
- let n = Dn(e, t), [r, i] = V(void 0), a = I(async (e) => {
2572
+ }, Ur = (e, t) => {
2573
+ let n = Tn(e, t), [r, i] = H(void 0), a = L(async (e) => {
2575
2574
  let t = await n.run({ question: e });
2576
2575
  return i(t), t;
2577
- }, [n]), o = I(() => i(void 0), []);
2578
- return z(() => ({
2576
+ }, [n]), o = L(() => i(void 0), []);
2577
+ return B(() => ({
2579
2578
  ask: a,
2580
2579
  answer: r,
2581
2580
  pending: n.pending,
@@ -2588,32 +2587,35 @@ var dr = () => {
2588
2587
  n.error,
2589
2588
  o
2590
2589
  ]);
2591
- }, Kr = (e) => {
2590
+ }, Wr = (e) => {
2592
2591
  let { cache: t, runtime: n } = K(e);
2593
- return I(() => {
2592
+ return L(() => {
2594
2593
  t.refreshAll(n);
2595
2594
  }, [t, n]);
2596
- }, qr = (e, t, n) => {
2597
- let { cache: r } = K(e), i = O([t, n]), a = B([t, n]);
2598
- return a.current = [t, n], z(() => {
2595
+ }, Gr = (e, t, n) => {
2596
+ let { cache: r } = K(e), i = A([t, n]), a = V([t, n]);
2597
+ return a.current = [t, n], B(() => {
2599
2598
  let e = a.current;
2600
2599
  return () => r.refresh(e);
2601
2600
  }, [r, i]);
2601
+ }, Kr = async (e, t, n, r, i) => {
2602
+ let { runtime: a, client: o } = await J(e, t, n), s = C(o, n)(r ?? {}), c = U.isEffect(s) ? s : W.runHead(s).pipe(U.map(ke.getOrUndefined)), l = await u(a, c, { signal: i });
2603
+ return Ne(n, l, "[loader.query]");
2604
+ }, qr = (e, t) => {
2605
+ let n = K(e), r = n.recovery ?? w(n.errorBus, e), i = V(t);
2606
+ i.current = t, z(() => r.onVisibleError((e) => i.current(e)), [r]);
2602
2607
  }, Jr = (e, t) => {
2603
- let n = K(e), r = n.recovery ?? d(n.errorBus, e), i = B(t);
2604
- i.current = t, R(() => r.onVisibleError((e) => i.current(e)), [r]);
2605
- }, Yr = (e, t) => {
2606
- let { errorBus: n } = K(e), r = B(t);
2607
- r.current = t, R(() => n.on((e) => r.current(e)), [n]);
2608
- }, Xr = {
2608
+ let { errorBus: n } = K(e), r = V(t);
2609
+ r.current = t, z(() => n.on((e) => r.current(e)), [n]);
2610
+ }, Yr = {
2609
2611
  failed: [],
2610
2612
  healthy: !0
2611
- }, Zr = (e) => {
2612
- let { errorBus: t } = K(e), [n, r] = V(Xr);
2613
- return R(() => {
2613
+ }, Xr = (e) => {
2614
+ let { errorBus: t } = K(e), [n, r] = H(Yr);
2615
+ return z(() => {
2614
2616
  let e = /* @__PURE__ */ new Map(), n = () => {
2615
2617
  let t = [...e.values()].sort((e, t) => t.at - e.at);
2616
- r(t.length === 0 ? Xr : {
2618
+ r(t.length === 0 ? Yr : {
2617
2619
  failed: t,
2618
2620
  healthy: !1
2619
2621
  });
@@ -2631,17 +2633,17 @@ var dr = () => {
2631
2633
  i(), a();
2632
2634
  };
2633
2635
  }, [t]), n;
2634
- }, Qr = (e, t) => {
2636
+ }, Zr = (e, t) => {
2635
2637
  let n = globalThis, r = Symbol.for(`@voltro/web/context:${e}`), i = n[r];
2636
2638
  if (i) return i;
2637
- let a = F(t);
2639
+ let a = I(t);
2638
2640
  return n[r] = a, a;
2639
- }, $r = Qr("serverRequest", null), ei = () => L($r), ti = ({ value: e, children: t }) => /* @__PURE__ */ Pe($r.Provider, {
2641
+ }, Qr = Zr("serverRequest", null), $r = () => R(Qr), ei = ({ value: e, children: t }) => /* @__PURE__ */ Fe(Qr.Provider, {
2640
2642
  value: e,
2641
2643
  children: t
2642
- }), ni = (e) => {
2643
- let t = ei();
2644
- return z(() => {
2644
+ }), ti = (e) => {
2645
+ let t = $r();
2646
+ return B(() => {
2645
2647
  if (t !== null) return t.formFlash?.formKey === e ? t.formFlash : void 0;
2646
2648
  if (typeof document > "u") return;
2647
2649
  let n = document.getElementById(he);
@@ -2652,15 +2654,15 @@ var dr = () => {
2652
2654
  return;
2653
2655
  }
2654
2656
  }, [t, e]);
2655
- }, ri = (e, t, n) => e.map((e) => {
2657
+ }, ni = (e, t, n) => e.map((e) => {
2656
2658
  let r = String(e[n] ?? ""), i = e[t];
2657
2659
  return {
2658
2660
  value: r,
2659
2661
  label: i == null ? r : String(i)
2660
2662
  };
2661
- }), ii = (e, t, n = {}) => {
2662
- 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);
2663
- R(() => {
2663
+ }), ri = (e, t, n = {}) => {
2664
+ let r = n.debounceMs ?? 200, i = n.labelField ?? "name", a = n.valueField ?? "id", o = n.input ?? ((e) => ({ q: e })), [s, c] = H(n.initialTerm ?? ""), [l, u] = H(s);
2665
+ z(() => {
2664
2666
  if (s === l) return;
2665
2667
  let e = setTimeout(() => u(s), r);
2666
2668
  return () => clearTimeout(e);
@@ -2669,24 +2671,24 @@ var dr = () => {
2669
2671
  l,
2670
2672
  r
2671
2673
  ]);
2672
- let d = n.skipUntilTerm === !0 && l.trim() === "", f = q(e, t, z(() => o(l), [o, l]), { skip: d }), p = z(() => ri(f.data ?? [], i, a), [
2674
+ let d = n.skipUntilTerm === !0 && l.trim() === "", f = q(e, t, B(() => o(l), [o, l]), { skip: d }), p = B(() => ni(f.data ?? [], i, a), [
2673
2675
  f.data,
2674
2676
  i,
2675
2677
  a
2676
- ]), m = I((e) => c(e), []);
2678
+ ]), m = L((e) => c(e), []);
2677
2679
  return {
2678
2680
  options: p,
2679
2681
  loading: !d && f.data === void 0,
2680
2682
  term: s,
2681
2683
  search: m
2682
2684
  };
2683
- }, ai = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, oi = (e, t, n = {}) => {
2684
- let r = K(e), [i, a] = V(n.pageSize), o = q(e, t, z(() => i === void 0 ? n.input ?? {} : {
2685
+ }, ii = (e, t) => e === t ? 0 : e == null ? 1 : t == null || e < t ? -1 : 1, ai = (e, t, n = {}) => {
2686
+ let r = K(e), [i, a] = H(n.pageSize), o = q(e, t, B(() => i === void 0 ? n.input ?? {} : {
2685
2687
  ...n.input,
2686
2688
  limit: i
2687
- }, [n.input, i])), s = r.descriptors[t]?.output, c = I(() => {
2689
+ }, [n.input, i])), s = r.descriptors[t]?.output, c = L(() => {
2688
2690
  n.pageSize !== void 0 && a((e) => (e ?? n.pageSize) + n.pageSize);
2689
- }, [n.pageSize]), l = z(() => n.columns ?? (s === void 0 ? [] : k(s)), [n.columns, s]), [u, d] = V(n.initialSort), f = I((e) => {
2691
+ }, [n.pageSize]), l = B(() => n.columns ?? (s === void 0 ? [] : M(s)), [n.columns, s]), [u, d] = H(n.initialSort), f = L((e) => {
2690
2692
  d((t) => t?.column === e ? {
2691
2693
  column: e,
2692
2694
  direction: t.direction === "asc" ? "desc" : "asc"
@@ -2697,11 +2699,11 @@ var dr = () => {
2697
2699
  }, []);
2698
2700
  return {
2699
2701
  columns: l,
2700
- rows: z(() => {
2702
+ rows: B(() => {
2701
2703
  let e = o.data ?? [];
2702
2704
  if (u === void 0) return e;
2703
2705
  let t = u.direction === "asc" ? 1 : -1;
2704
- return [...e].sort((e, n) => ai(e[u.column], n[u.column]) * t);
2706
+ return [...e].sort((e, n) => ii(e[u.column], n[u.column]) * t);
2705
2707
  }, [o.data, u]),
2706
2708
  loading: o.data === void 0,
2707
2709
  error: o.error,
@@ -2710,26 +2712,26 @@ var dr = () => {
2710
2712
  loadMore: c,
2711
2713
  hasMore: i !== void 0 && (o.data?.length ?? 0) >= i
2712
2714
  };
2713
- }, si = (e, t, n, r) => {
2715
+ }, oi = (e, t, n, r) => {
2714
2716
  let i = e.replace(/\/$/, ""), a = new URLSearchParams({
2715
2717
  table: t,
2716
2718
  id: n
2717
2719
  });
2718
2720
  return r !== void 0 && a.set("column", r), `${i}/_voltro/inspect/provenance?${a.toString()}`;
2719
- }, ci = si, li = (e, t, n, r) => {
2720
- let { inspectBaseUrl: i } = K(e), [a, o] = V({
2721
+ }, si = oi, ci = (e, t, n, r) => {
2722
+ let { inspectBaseUrl: i } = K(e), [a, o] = H({
2721
2723
  data: void 0,
2722
2724
  loading: !0,
2723
2725
  error: void 0
2724
2726
  });
2725
- return R(() => {
2727
+ return z(() => {
2726
2728
  let e = !1;
2727
2729
  o({
2728
2730
  data: void 0,
2729
2731
  loading: !0,
2730
2732
  error: void 0
2731
2733
  });
2732
- let a = si(i ?? "", t, n, r);
2734
+ let a = oi(i ?? "", t, n, r);
2733
2735
  return fetch(a).then(async (e) => {
2734
2736
  if (!e.ok) throw Error(`provenance fetch failed: HTTP ${e.status}`);
2735
2737
  return await e.json();
@@ -2755,23 +2757,23 @@ var dr = () => {
2755
2757
  n,
2756
2758
  r
2757
2759
  ]), a;
2758
- }, ui = "admin:full", di = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), fi = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), pi = F({ scopes: [] });
2759
- function mi(e) {
2760
- return be(pi.Provider, { value: { scopes: e.scopes } }, e.children);
2760
+ }, li = "admin:full", ui = (e, t) => e.includes("admin:full") ? !0 : (typeof t == "string" ? [t] : t).every((t) => e.includes(t)), di = (e, t) => t.length === 0 || e.includes("admin:full") ? !0 : t.some((t) => e.includes(t)), fi = I({ scopes: [] });
2761
+ function pi(e) {
2762
+ return xe(fi.Provider, { value: { scopes: e.scopes } }, e.children);
2761
2763
  }
2762
- var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes, e), vi = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, yi = (e) => {
2763
- let { inspectBaseUrl: t } = K(e), [n, r] = V({
2764
+ var mi = () => R(fi), hi = (e) => ui(mi().scopes, e), gi = (e) => di(mi().scopes, e), _i = (e) => `${e.replace(/\/$/, "")}/_voltro/inspect/manifest`, vi = (e) => {
2765
+ let { inspectBaseUrl: t } = K(e), [n, r] = H({
2764
2766
  manifest: void 0,
2765
2767
  loading: !0,
2766
2768
  error: void 0
2767
2769
  });
2768
- return R(() => {
2770
+ return z(() => {
2769
2771
  let e = !1;
2770
2772
  return r({
2771
2773
  manifest: void 0,
2772
2774
  loading: !0,
2773
2775
  error: void 0
2774
- }), fetch(vi(t ?? "")).then(async (e) => {
2776
+ }), fetch(_i(t ?? "")).then(async (e) => {
2775
2777
  if (!e.ok) throw Error(`manifest fetch failed: HTTP ${e.status}`);
2776
2778
  return await e.json();
2777
2779
  }).then((t) => {
@@ -2790,7 +2792,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2790
2792
  e = !0;
2791
2793
  };
2792
2794
  }, [e, t]), n;
2793
- }, bi = (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) => {
2795
+ }, yi = (e, t) => t.scope.length === 0 || (t.mode === "any" ? t.scope.some((t) => e.includes(t)) : t.scope.every((t) => e.includes(t))), bi = (e, t) => {
2794
2796
  if (e === void 0) return "unknown";
2795
2797
  if (t.includes("admin:full") || e.length === 0) return "allowed";
2796
2798
  let n = !1;
@@ -2799,7 +2801,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2799
2801
  n = !0;
2800
2802
  continue;
2801
2803
  }
2802
- if (!bi(t, r)) {
2804
+ if (!yi(t, r)) {
2803
2805
  if (r.resourceScoped) {
2804
2806
  n = !0;
2805
2807
  continue;
@@ -2808,13 +2810,13 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2808
2810
  }
2809
2811
  }
2810
2812
  return n ? "unknown" : "allowed";
2811
- }, Si = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), Ci = (e) => {
2813
+ }, xi = (e) => (e ?? []).flatMap((e) => e.kind === "scope" ? [...e.scope] : []), Si = (e) => {
2812
2814
  for (let t of e ?? []) if (t.kind === "open") return t.reason;
2813
- }, wi = (e) => xi(e, hi().scopes), Ti = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, Ei = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, Di = (e) => e === void 0 ? {} : {
2815
+ }, Ci = (e) => bi(e, mi().scopes), wi = (e, t) => Array.isArray(e) ? e.includes(t) : e === t, Ti = (e, t, n) => e.targets?.some((e) => e.table === t && e.op === n) ?? !1, Ei = (e) => e === void 0 ? {} : {
2814
2816
  tag: e.tag,
2815
2817
  ...e.guards === void 0 ? {} : { guards: e.guards }
2816
- }, Oi = (e) => e.tables.filter((e) => !e.framework).map((t) => {
2817
- let n = e.procedures.find((e) => e.kind === "query" && Ti(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && Ei(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && Ei(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && Ei(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
2818
+ }, Di = (e) => e.tables.filter((e) => !e.framework).map((t) => {
2819
+ let n = e.procedures.find((e) => e.kind === "query" && wi(e.source, t.name)), r = e.procedures.find((e) => e.kind === "mutation" && Ti(e, t.name, "insert")), i = e.procedures.find((e) => e.kind === "mutation" && Ti(e, t.name, "update")), a = e.procedures.find((e) => e.kind === "mutation" && Ti(e, t.name, "delete")), o = t.pkColumn ?? (t.columns.some((e) => e.name === "id") ? "id" : void 0);
2818
2820
  return {
2819
2821
  table: t.name,
2820
2822
  columns: t.columns.filter((e) => e.serverOnly !== !0),
@@ -2823,22 +2825,22 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2823
2825
  reactive: t.reactive,
2824
2826
  ...o === void 0 ? {} : { pkColumn: o },
2825
2827
  editable: (t.editable ?? !0) && o !== void 0,
2826
- list: Di(n),
2827
- create: Di(r),
2828
- update: Di(i),
2829
- delete: Di(a)
2828
+ list: Ei(n),
2829
+ create: Ei(r),
2830
+ update: Ei(i),
2831
+ delete: Ei(a)
2830
2832
  };
2831
- }), ki = (e) => {
2832
- let [t, n] = V([]), [r, i] = V([]), a = I((e) => {
2833
+ }), Oi = (e) => {
2834
+ let [t, n] = H([]), [r, i] = H([]), a = L((e) => {
2833
2835
  n((t) => [...t, e]), i([]);
2834
- }, []), o = I(async () => {
2836
+ }, []), o = L(async () => {
2835
2837
  let r = t[t.length - 1];
2836
2838
  r !== void 0 && r.blockedBy === void 0 && (await e.onUndo(r.invocationId), n((e) => e.slice(0, -1)), i((e) => [...e, r]));
2837
- }, [t, e]), s = I(async () => {
2839
+ }, [t, e]), s = L(async () => {
2838
2840
  let t = r[r.length - 1];
2839
2841
  t !== void 0 && (await e.onRedo(t.invocationId), i((e) => e.slice(0, -1)), n((e) => [...e, t]));
2840
2842
  }, [r, e]);
2841
- return z(() => {
2843
+ return B(() => {
2842
2844
  let e = t[t.length - 1];
2843
2845
  return {
2844
2846
  record: a,
@@ -2856,14 +2858,14 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2856
2858
  o,
2857
2859
  s
2858
2860
  ]);
2859
- }, Ai = "__voltro.undo.log", ji = "__voltro.undo.apply", Mi = "__voltro.undo.redo", Ni = (e, t) => {
2860
- let n = t?.limit, { data: r } = q(e, Ai, n === void 0 ? {} : { limit: n }), i = Sn(e, ji), a = Sn(e, Mi), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = I(async (e) => {
2861
+ }, ki = "__voltro.undo.log", Ai = "__voltro.undo.apply", ji = "__voltro.undo.redo", Mi = (e, t) => {
2862
+ let n = t?.limit, { data: r } = q(e, ki, n === void 0 ? {} : { limit: n }), i = bn(e, Ai), a = bn(e, ji), o = r ?? [], s = o.find((e) => !e.undone && !e.crossesAction), c = o.find((e) => e.undone), l = L(async (e) => {
2861
2863
  await i.mutate({ invocationId: e });
2862
- }, [i]), u = I(async (e) => {
2864
+ }, [i]), u = L(async (e) => {
2863
2865
  await a.mutate({ invocationId: e });
2864
- }, [a]), d = I(async () => {
2866
+ }, [a]), d = L(async () => {
2865
2867
  s && await l(s.id);
2866
- }, [s, l]), f = I(async () => {
2868
+ }, [s, l]), f = L(async () => {
2867
2869
  c && await u(c.id);
2868
2870
  }, [c, u]);
2869
2871
  return {
@@ -2876,22 +2878,22 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2876
2878
  undoLast: d,
2877
2879
  redoLast: f
2878
2880
  };
2879
- }, Pi = (e, t) => ({
2881
+ }, Ni = (e, t) => ({
2880
2882
  name: e,
2881
2883
  map: t
2882
- }), Fi = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), Ii = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), Li = (e, t, n) => {
2884
+ }), Pi = (e, t) => e === void 0 ? null : typeof e == "string" ? { event: e } : e(t), Fi = /* @__PURE__ */ new Set(["onMount", "onUnmount"]), Ii = (e, t, n) => {
2883
2885
  let r = { ...t };
2884
2886
  for (let [i, a] of Object.entries(e.map)) {
2885
- if (Ii.has(i) || a === void 0) continue;
2887
+ if (Fi.has(i) || a === void 0) continue;
2886
2888
  let e = t[i];
2887
2889
  r[i] = (...r) => {
2888
- let i = Fi(a, t);
2890
+ let i = Pi(a, t);
2889
2891
  if (i !== null && n(i), typeof e == "function") return e(...r);
2890
2892
  };
2891
2893
  }
2892
2894
  return r;
2893
- }, Ri = (e, t, n) => {
2894
- let r = B({
2895
+ }, Li = (e, t, n) => {
2896
+ let r = V({
2895
2897
  spec: e,
2896
2898
  props: t,
2897
2899
  sink: n
@@ -2900,47 +2902,47 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2900
2902
  spec: e,
2901
2903
  props: t,
2902
2904
  sink: n
2903
- }, R(() => {
2904
- let e = r.current, t = Fi(e.spec.map.onMount, e.props);
2905
+ }, z(() => {
2906
+ let e = r.current, t = Pi(e.spec.map.onMount, e.props);
2905
2907
  return t !== null && e.sink(t), () => {
2906
- let e = r.current, t = Fi(e.spec.map.onUnmount, e.props);
2908
+ let e = r.current, t = Pi(e.spec.map.onUnmount, e.props);
2907
2909
  t !== null && e.sink(t);
2908
2910
  };
2909
- }, []), z(() => Li(e, t, n), [
2911
+ }, []), B(() => Ii(e, t, n), [
2910
2912
  e,
2911
2913
  t,
2912
2914
  n
2913
2915
  ]);
2914
- }, zi = (e, t) => {
2916
+ }, Ri = (e, t) => {
2915
2917
  let n = K(e).descriptors[t]?.input;
2916
- return z(() => n === void 0 ? [] : _e(n), [n]);
2917
- }, Bi = (e, t) => {
2918
+ return B(() => n === void 0 ? [] : ve(n), [n]);
2919
+ }, zi = (e, t) => {
2918
2920
  let n = K(e).descriptors[t]?.output;
2919
- return z(() => n === void 0 ? [] : k(n), [n]);
2920
- }, Vi = (e, t) => {
2921
+ return B(() => n === void 0 ? [] : M(n), [n]);
2922
+ }, Bi = (e, t) => {
2921
2923
  if (e === t) return !0;
2922
2924
  if (e.length !== t.length) return !1;
2923
2925
  for (let n = 0; n < e.length; n += 1) if (!Object.is(e[n], t[n])) return !1;
2924
2926
  return !0;
2925
- }, Hi = (e) => Object.keys(e).sort().map((t) => e[t]), Ui = (e, t) => {
2926
- let n = B(null), r = Hi(e);
2927
- return (n.current === null || !Vi(n.current.key, r)) && (n.current = {
2927
+ }, Vi = (e) => Object.keys(e).sort().map((t) => e[t]), Hi = (e, t) => {
2928
+ let n = V(null), r = Vi(e);
2929
+ return (n.current === null || !Bi(n.current.key, r)) && (n.current = {
2928
2930
  key: r,
2929
2931
  value: t(e)
2930
2932
  }), n.current.value;
2931
- }, Wi = (e, t, n, r = {}) => {
2933
+ }, Ui = (e, t, n, r = {}) => {
2932
2934
  let i = q(e, t, { ...n }, r);
2933
- return z(() => ({
2935
+ return B(() => ({
2934
2936
  allowed: i.data?.allowed === !0,
2935
2937
  pending: i.data === void 0
2936
2938
  }), [i.data]);
2937
- }, Gi = (e, t, n, r = {}) => {
2939
+ }, Wi = (e, t, n, r = {}) => {
2938
2940
  let i = q(e, t, { ...n }, r);
2939
- return z(() => ({
2941
+ return B(() => ({
2940
2942
  allowedIds: new Set(i.data?.allowedIds ?? []),
2941
2943
  pending: i.data === void 0
2942
2944
  }), [i.data]);
2943
- }, Ki = (e) => {
2945
+ }, Gi = (e) => {
2944
2946
  switch (e) {
2945
2947
  case "select":
2946
2948
  case "radio":
@@ -2956,26 +2958,26 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2956
2958
  case "switch": return "boolean";
2957
2959
  default: return null;
2958
2960
  }
2959
- }, qi = (e) => _e(e).map((e) => {
2961
+ }, Ki = (e) => ve(e).map((e) => {
2960
2962
  if (e.name.includes(".")) return null;
2961
- let t = Ki(e.widget);
2963
+ let t = Gi(e.widget);
2962
2964
  return t === null ? null : {
2963
2965
  name: e.name,
2964
2966
  label: e.label,
2965
2967
  kind: t,
2966
2968
  ...e.options ? { options: e.options } : {}
2967
2969
  };
2968
- }).filter((e) => e !== null), Ji = (e) => {
2970
+ }).filter((e) => e !== null), qi = (e) => {
2969
2971
  let t = {};
2970
2972
  for (let [n, r] of Object.entries(e)) r === void 0 || r === "" || Array.isArray(r) && r.length === 0 || (t[n] = r);
2971
2973
  return t;
2972
- }, Yi = (e, t, n = {}) => {
2973
- let r = K(e).descriptors[t]?.input, i = z(() => r === void 0 ? [] : qi(r), [r]), [a, o] = V(n.initial ?? {}), s = I((e, t) => {
2974
- o((n) => Ji({
2974
+ }, Ji = (e, t, n = {}) => {
2975
+ let r = K(e).descriptors[t]?.input, i = B(() => r === void 0 ? [] : Ki(r), [r]), [a, o] = H(n.initial ?? {}), s = L((e, t) => {
2976
+ o((n) => qi({
2975
2977
  ...n,
2976
2978
  [e]: t
2977
2979
  }));
2978
- }, []), c = I(() => o({}), []), l = q(e, t, z(() => Ji(a), [a]));
2980
+ }, []), c = L(() => o({}), []), l = q(e, t, B(() => qi(a), [a]));
2979
2981
  return {
2980
2982
  filters: i,
2981
2983
  values: a,
@@ -2986,20 +2988,20 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
2986
2988
  loading: l.data === void 0,
2987
2989
  error: l.error
2988
2990
  };
2989
- }, Xi = (e, t, n = {}) => {
2991
+ }, Yi = (e, t, n = {}) => {
2990
2992
  let r = q(e, t, n), i = r.data;
2991
2993
  return {
2992
2994
  record: Array.isArray(i) ? i[0] : i,
2993
2995
  loading: i === void 0,
2994
2996
  error: r.error
2995
2997
  };
2996
- }, Zi = (e, t = 300) => {
2997
- let [n, r] = V(e);
2998
- return R(() => {
2998
+ }, Xi = (e, t = 300) => {
2999
+ let [n, r] = H(e);
3000
+ return z(() => {
2999
3001
  let n = setTimeout(() => r(e), t);
3000
3002
  return () => clearTimeout(n);
3001
3003
  }, [e, t]), n;
3002
- }, Qi = (e) => {
3004
+ }, Zi = (e) => {
3003
3005
  let { value: t, debouncedValue: n, data: r, interpret: i, skipEmpty: a = !0 } = e;
3004
3006
  if (a && t.trim() === "") return {
3005
3007
  status: "idle",
@@ -3017,39 +3019,39 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3017
3019
  valid: o.valid,
3018
3020
  message: o.message
3019
3021
  };
3020
- }, $i = (e, t, n, r) => {
3021
- let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Zi(n, o), l = s && c.trim() === "", u = q(e, t, z(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
3022
- return Qi({
3022
+ }, Qi = (e, t, n, r) => {
3023
+ let { input: i, interpret: a, debounceMs: o = 300, skipEmpty: s = !0 } = r, c = Xi(n, o), l = s && c.trim() === "", u = q(e, t, B(() => i ? i(c) : { value: c }, [i, c]), { skip: l });
3024
+ return Zi({
3023
3025
  value: n,
3024
3026
  debouncedValue: c,
3025
3027
  data: l ? null : u.data,
3026
3028
  interpret: a,
3027
3029
  skipEmpty: s
3028
3030
  });
3029
- }, ea = (e, t) => ({
3031
+ }, $i = (e, t) => ({
3030
3032
  name: e,
3031
3033
  payload: t
3032
- }), ta = (e, t) => {
3033
- let n = ke.decodeUnknownEither(e.payload, { errors: "all" })(t);
3034
+ }), ea = (e, t) => {
3035
+ let n = je.decodeUnknownEither(e.payload, { errors: "all" })(t);
3034
3036
  if (n._tag === "Right") return {
3035
3037
  valid: !0,
3036
3038
  errors: {}
3037
3039
  };
3038
3040
  let r = {};
3039
- for (let e of Le.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
3041
+ for (let e of Re.formatErrorSync(n.left)) r[e.path.join(".") || "(root)"] = e.message;
3040
3042
  return {
3041
3043
  valid: !1,
3042
3044
  errors: r
3043
3045
  };
3044
- }, na = (e) => {
3046
+ }, ta = (e) => {
3045
3047
  let t = new Map(e.map((e) => [e.name, e]));
3046
3048
  return {
3047
3049
  names: [...t.keys()].sort(),
3048
3050
  get: (e) => t.get(e),
3049
3051
  events: e
3050
3052
  };
3051
- }, ra = (e, t) => {
3052
- let n = na(e);
3053
+ }, na = (e, t) => {
3054
+ let n = ta(e);
3053
3055
  return {
3054
3056
  track: (e, r) => {
3055
3057
  let i = n.get(e);
@@ -3058,7 +3060,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3058
3060
  return;
3059
3061
  }
3060
3062
  if (process.env.NODE_ENV !== "production") {
3061
- let t = ta(i, r);
3063
+ let t = ea(i, r);
3062
3064
  t.valid || console.error(`[@voltro/client] analytics.track('${e}'): payload failed its schema`, t.errors);
3063
3065
  }
3064
3066
  t({
@@ -3069,49 +3071,49 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3069
3071
  names: n.names,
3070
3072
  catalog: n
3071
3073
  };
3072
- }, ia = (e, t) => {
3073
- let n = Dn(e, t);
3074
+ }, ra = (e, t) => {
3075
+ let n = Tn(e, t);
3074
3076
  return {
3075
- preview: I((e) => n.run(e), [n]),
3077
+ preview: L((e) => n.run(e), [n]),
3076
3078
  diff: n.lastResult,
3077
3079
  pending: n.pending,
3078
3080
  error: n.error
3079
3081
  };
3080
- }, aa = (e, t, n, r) => [...e, {
3082
+ }, ia = (e, t, n, r) => [...e, {
3081
3083
  id: t,
3082
3084
  tag: n,
3083
3085
  input: r,
3084
3086
  status: "pending",
3085
3087
  attempts: 0
3086
- }], oa = (e, t, n) => e.map((e) => e.id === t ? {
3088
+ }], aa = (e, t, n) => e.map((e) => e.id === t ? {
3087
3089
  ...e,
3088
3090
  ...n
3089
- } : e), sa = (e, t) => oa(e, t, { status: "sent" }), ca = (e, t, n) => e.map((e) => e.id === t ? {
3091
+ } : e), oa = (e, t) => aa(e, t, { status: "sent" }), sa = (e, t, n) => e.map((e) => e.id === t ? {
3090
3092
  ...e,
3091
3093
  status: "failed",
3092
3094
  error: n,
3093
3095
  attempts: e.attempts + 1
3094
- } : e), la = (e, t, n) => oa(e, t, {
3096
+ } : e), ca = (e, t, n) => aa(e, t, {
3095
3097
  status: "conflict",
3096
3098
  error: n
3097
- }), ua = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
3099
+ }), la = (e, t, n) => e.map((e) => e.id === t && e.status === "conflict" ? {
3098
3100
  ...e,
3099
3101
  input: n,
3100
3102
  status: "pending",
3101
3103
  error: void 0
3102
- } : e), da = (e) => e.filter((e) => e.status !== "sent"), fa = (e) => {
3104
+ } : e), ua = (e) => e.filter((e) => e.status !== "sent"), da = (e) => {
3103
3105
  let t = [];
3104
3106
  for (let n of e) {
3105
3107
  if (n.status === "conflict") break;
3106
3108
  (n.status === "pending" || n.status === "failed") && t.push(n);
3107
3109
  }
3108
3110
  return t;
3109
- }, pa = (e) => {
3111
+ }, fa = (e) => {
3110
3112
  let t = e;
3111
3113
  return t?.conflict === !0 || t?._tag === "UndoBoundaryError" && t?.boundary === "conflict";
3112
- }, ma = (e) => {
3113
- let [t, n] = V(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
3114
- return R(() => {
3114
+ }, pa = (e) => {
3115
+ let [t, n] = H(e ?? (typeof navigator < "u" ? navigator.onLine : !0));
3116
+ return z(() => {
3115
3117
  if (e !== void 0) {
3116
3118
  n(e);
3117
3119
  return;
@@ -3122,20 +3124,20 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3122
3124
  window.removeEventListener("online", t), window.removeEventListener("offline", r);
3123
3125
  };
3124
3126
  }, [e]), t;
3125
- }, ha = (e) => {
3126
- let { send: t, persistence: n, isConflict: r = pa, idFor: i } = e, [a, o] = V([]), [s, c] = V(0), l = ma(e.online), u = B([]), d = I((e) => {
3127
+ }, ma = (e) => {
3128
+ let { send: t, persistence: n, isConflict: r = fa, idFor: i } = e, [a, o] = H([]), [s, c] = H(0), l = pa(e.online), u = V([]), d = L((e) => {
3127
3129
  let t = e(u.current);
3128
3130
  u.current = t, o(t);
3129
- }, []), f = B(t);
3131
+ }, []), f = V(t);
3130
3132
  f.current = t;
3131
- let p = B(r);
3133
+ let p = V(r);
3132
3134
  p.current = r;
3133
- let m = B(void 0), h = B(!1), g = B(!0);
3134
- R(() => (g.current = !0, () => {
3135
+ let m = V(void 0), h = V(!1), g = V(!0);
3136
+ z(() => (g.current = !0, () => {
3135
3137
  g.current = !1;
3136
3138
  }), []);
3137
- let _ = B(0), v = B(Math.random().toString(36).slice(2, 8)), y = B(n === void 0);
3138
- R(() => {
3139
+ let _ = V(0), v = V(Math.random().toString(36).slice(2, 8)), y = V(n === void 0);
3140
+ z(() => {
3139
3141
  if (n === void 0 || y.current) return;
3140
3142
  let e = !1;
3141
3143
  return n.load().then((t) => {
@@ -3145,30 +3147,30 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3145
3147
  }), () => {
3146
3148
  e = !0;
3147
3149
  };
3148
- }, [n, d]), R(() => {
3149
- n !== void 0 && y.current && n.save(da(a)).catch(() => {});
3150
+ }, [n, d]), z(() => {
3151
+ n !== void 0 && y.current && n.save(ua(a)).catch(() => {});
3150
3152
  }, [
3151
3153
  n,
3152
3154
  a,
3153
3155
  s
3154
3156
  ]);
3155
- let b = I((e, t) => {
3157
+ let b = L((e, t) => {
3156
3158
  let n = i?.() ?? `obx_${v.current}_${_.current++}_${e}`;
3157
- d((r) => aa(r, n, e, t)), c((e) => e + 1);
3158
- }, [i, d]), x = I(() => {
3159
+ d((r) => ia(r, n, e, t)), c((e) => e + 1);
3160
+ }, [i, d]), x = L(() => {
3159
3161
  if (!y.current || !g.current) return Promise.resolve();
3160
3162
  if (m.current !== void 0) return m.current;
3161
3163
  h.current = !1;
3162
3164
  let e = Promise.resolve().then(async () => {
3163
3165
  for (; g.current;) {
3164
- let e = fa(u.current)[0];
3166
+ let e = da(u.current)[0];
3165
3167
  if (e === void 0) break;
3166
3168
  try {
3167
3169
  if (await f.current(e), !g.current) break;
3168
- d((t) => sa(t, e.id));
3170
+ d((t) => oa(t, e.id));
3169
3171
  } catch (t) {
3170
3172
  if (!g.current) break;
3171
- d((n) => p.current(t) ? la(n, e.id, t) : ca(n, e.id, t)), h.current = !0;
3173
+ d((n) => p.current(t) ? ca(n, e.id, t) : sa(n, e.id, t)), h.current = !0;
3172
3174
  break;
3173
3175
  }
3174
3176
  }
@@ -3177,17 +3179,17 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3177
3179
  });
3178
3180
  return m.current = e, e;
3179
3181
  }, [d]);
3180
- R(() => {
3182
+ z(() => {
3181
3183
  l && x();
3182
- }, [l, x]), R(() => {
3184
+ }, [l, x]), z(() => {
3183
3185
  l && !h.current && x();
3184
3186
  }, [
3185
3187
  s,
3186
3188
  l,
3187
3189
  x
3188
3190
  ]);
3189
- let S = I((e, t) => {
3190
- d((n) => ua(n, e, t)), l && x();
3191
+ let S = L((e, t) => {
3192
+ d((n) => la(n, e, t)), l && x();
3191
3193
  }, [
3192
3194
  l,
3193
3195
  x,
@@ -3202,7 +3204,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3202
3204
  conflicts: a.filter((e) => e.status === "conflict"),
3203
3205
  resolveConflict: S
3204
3206
  };
3205
- }, ga = (e) => {
3207
+ }, ha = (e) => {
3206
3208
  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);
3207
3209
  return {
3208
3210
  startIndex: l,
@@ -3212,8 +3214,8 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3212
3214
  topSpacer: l * r,
3213
3215
  bottomSpacer: a === void 0 ? 0 : Math.max(0, (a - d) * r)
3214
3216
  };
3215
- }, _a = (e, t, n) => {
3216
- let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = V(0), u = z(() => ga({
3217
+ }, ga = (e, t, n) => {
3218
+ let { rowHeight: r, viewportHeight: i, overscan: a, total: o, input: s } = n, [c, l] = H(0), u = B(() => ha({
3217
3219
  scrollTop: c,
3218
3220
  viewportHeight: i,
3219
3221
  rowHeight: r,
@@ -3225,7 +3227,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3225
3227
  r,
3226
3228
  a,
3227
3229
  o
3228
- ]), d = q(e, t, z(() => ({
3230
+ ]), d = q(e, t, B(() => ({
3229
3231
  ...s,
3230
3232
  offset: u.offset,
3231
3233
  limit: u.limit
@@ -3233,7 +3235,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3233
3235
  s,
3234
3236
  u.offset,
3235
3237
  u.limit
3236
- ])), f = I((e) => {
3238
+ ])), f = L((e) => {
3237
3239
  l(e.currentTarget.scrollTop);
3238
3240
  }, []);
3239
3241
  return {
@@ -3245,37 +3247,37 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3245
3247
  loading: d.data === void 0,
3246
3248
  error: d.error
3247
3249
  };
3248
- }, va = () => typeof navigator > "u" || navigator.onLine, ya = () => !0, ba = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
3250
+ }, _a = () => typeof navigator > "u" || navigator.onLine, va = () => !0, ya = (e) => typeof window > "u" ? () => {} : (window.addEventListener("online", e), window.addEventListener("offline", e), () => {
3249
3251
  window.removeEventListener("online", e), window.removeEventListener("offline", e);
3250
- }), xa = (e) => {
3251
- let t = K(e), n = t.recovery ?? d(t.errorBus, e), r = H(n.subscribe, n.getSnapshot, n.getServerSnapshot ?? (() => v)), i = H(ba, va, ya), a = I(() => n.reportExternalSuccess(), [n]), s = i ? r.status : "offline";
3252
- return R(() => {
3253
- o(e, "connection.status", {
3252
+ }), ba = (e) => {
3253
+ let t = K(e), r = t.recovery ?? w(t.errorBus, e), i = we(r.subscribe, r.getSnapshot, r.getServerSnapshot ?? (() => p)), a = we(ya, _a, va), o = L(() => r.reportExternalSuccess(), [r]), s = a ? i.status : "offline";
3254
+ return z(() => {
3255
+ n(e, "connection.status", {
3254
3256
  status: s,
3255
- rawTransport: r.rawTransport,
3256
- online: i,
3257
- failureCount: r.failureCount,
3258
- failedSubscriptions: r.failedSubscriptions.length,
3259
- pendingMutationReplays: r.pendingMutationReplays,
3260
- mutationReplay: r.mutationReplay
3257
+ rawTransport: i.rawTransport,
3258
+ online: a,
3259
+ failureCount: i.failureCount,
3260
+ failedSubscriptions: i.failedSubscriptions.length,
3261
+ pendingMutationReplays: i.pendingMutationReplays,
3262
+ mutationReplay: i.mutationReplay
3261
3263
  });
3262
3264
  }, [
3263
3265
  e,
3264
3266
  s,
3265
- i,
3266
- r
3267
+ a,
3268
+ i
3267
3269
  ]), {
3268
3270
  status: s,
3269
- rawTransport: r.rawTransport,
3270
- online: i,
3271
- failureCount: r.failureCount,
3272
- lastFailureAt: r.lastFailureAt,
3273
- failedSubscriptions: r.failedSubscriptions,
3274
- pendingMutationReplays: r.pendingMutationReplays,
3275
- mutationReplay: r.mutationReplay,
3276
- reportSuccess: a
3271
+ rawTransport: i.rawTransport,
3272
+ online: a,
3273
+ failureCount: i.failureCount,
3274
+ lastFailureAt: i.lastFailureAt,
3275
+ failedSubscriptions: i.failedSubscriptions,
3276
+ pendingMutationReplays: i.pendingMutationReplays,
3277
+ mutationReplay: i.mutationReplay,
3278
+ reportSuccess: o
3277
3279
  };
3278
- }, Sa = "__voltro.connections.list", Ca = "__voltro.connections.start", wa = "__voltro.connections.submitToken", Ta = "__voltro.connections.disconnect", Ea = {
3280
+ }, xa = "__voltro.connections.list", Sa = "__voltro.connections.start", Ca = "__voltro.connections.submitToken", wa = "__voltro.connections.disconnect", Ta = {
3279
3281
  connectionId: "",
3280
3282
  kind: "oauth2",
3281
3283
  label: "",
@@ -3286,14 +3288,14 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3286
3288
  expiresAt: null,
3287
3289
  lastError: null,
3288
3290
  connectedAt: null
3289
- }, Da = (e, t) => {
3291
+ }, Ea = (e, t) => {
3290
3292
  if (t === "redirect") {
3291
3293
  globalThis.location.assign(e);
3292
3294
  return;
3293
3295
  }
3294
3296
  globalThis.open(e, "voltro-connect", "width=620,height=760,menubar=no,toolbar=no") === null && globalThis.location.assign(e);
3295
- }, Oa = (e) => {
3296
- let { data: t } = q(e, Sa, {}), n = Dn(e, Ca), r = Sn(e, wa), i = Sn(e, Ta), a = t ?? [], o = n.pending || r.pending || i.pending, s = I((e) => ({
3297
+ }, Da = (e) => {
3298
+ let { data: t } = q(e, xa, {}), n = Tn(e, Sa), r = bn(e, Ca), i = bn(e, wa), a = t ?? [], o = n.pending || r.pending || i.pending, s = L((e) => ({
3297
3299
  ...e,
3298
3300
  connected: e.status === "connected",
3299
3301
  needsAttention: e.status === "expired" || e.status === "revoked" || e.status === "error",
@@ -3301,7 +3303,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3301
3303
  connect: async (t) => {
3302
3304
  if (e.kind !== "oauth2") throw Error(`connection "${e.connectionId}" is a personal-access-token connection — call submitToken(token), not connect().`);
3303
3305
  let r = t?.redirectTo ?? `${globalThis.location.pathname}${globalThis.location.search}`;
3304
- Da((await n.run({
3306
+ Ea((await n.run({
3305
3307
  connectionId: e.connectionId,
3306
3308
  redirectTo: r
3307
3309
  })).authorizeUrl, t?.mode);
@@ -3321,7 +3323,7 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3321
3323
  n,
3322
3324
  r,
3323
3325
  i
3324
- ]), c = I((e) => {
3326
+ ]), c = L((e) => {
3325
3327
  let t = a.find((t) => t.connectionId === e);
3326
3328
  return t === void 0 ? void 0 : s(t);
3327
3329
  }, [a, s]);
@@ -3331,10 +3333,10 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3331
3333
  get: c,
3332
3334
  pending: o
3333
3335
  };
3334
- }, ka = (e, t) => {
3335
- let n = Oa(e), r = n.get(t);
3336
- return z(() => r === void 0 ? {
3337
- ...Ea,
3336
+ }, Oa = (e, t) => {
3337
+ let n = Da(e), r = n.get(t);
3338
+ return B(() => r === void 0 ? {
3339
+ ...Ta,
3338
3340
  connectionId: t,
3339
3341
  label: t,
3340
3342
  connected: !1,
@@ -3359,6 +3361,6 @@ var hi = () => L(pi), gi = (e) => di(hi().scopes, e), _i = (e) => fi(hi().scopes
3359
3361
  n.loading,
3360
3362
  n.pending
3361
3363
  ]);
3362
- }, Aa = "framework-client";
3364
+ }, ka = "framework-client";
3363
3365
  //#endregion
3364
- export { ui as ADMIN_SCOPE, Aa as CLIENT_NAME, Sa as CONNECTIONS_LIST_TAG, Ta as CONNECTION_DISCONNECT_TAG, Ca as CONNECTION_START_TAG, wa as CONNECTION_SUBMIT_TOKEN_TAG, he as FORM_FLASH_SCRIPT_ID, ue as FORM_KEY_FIELD, pe as FORM_PATH_PREFIX, se as FORM_REDIRECT_FIELD, Bn as FormBindingProvider, Re as FrameworkRuntimesContext, et as FrameworkRuntimesProvider, v as INITIAL_RECOVERY_SNAPSHOT, s as LoadingSubscriptionCache, un as MutationSerialExecutionError, mi as PermissionProvider, me as RICH_TEXT_MARKS, M as RICH_TEXT_MAX_NODES, E as RecoveryCoordinator, ce as RichTextDocument, S as RpcErrorBus, $r as ServerRequestContext, ti as ServerRequestProvider, D as SubscriptionCache, ji as UNDO_APPLY_TAG, Ai as UNDO_LOG_TAG, Mi as UNDO_REDO_TAG, kn as ValidationMessagesProvider, Ze as _resetFrameworkRuntimesWarning, Ke as _resetSsrDescriptors, rr as applyPreloadSeeds, Vt as applyStoreSeeds, x as buildApiRuntime, di as canCall, fi as canCallAny, te as clearClientDiagnostics, $t as clearMutations, da as clearSent, xt as clearStoreHistory, a as clientDiagnosticsSnapshot, ga as computeWindow, ra as createAnalytics, Yn as createHooks, xi as decideAccess, oe as decodeFieldIssues, ea as defineEvent, It as defineStore, Pi as defineTracking, Ft as definedStores, Oi as deriveEntityAdmins, t as disableClientDiagnosticsPersistence, ne as documentLocale, ge as emptyRichTextDocument, ee as enableClientDiagnosticsPersistence, aa as enqueueEntry, na as eventCatalog, qi as filtersFromSchema, j as formActionPath, de as formDataToInput, ve as formField, A as formSections, cn as freshIdempotencyKey, _n as getMutationNotifier, Zt as getMutations, Qr as globalContext, ie as isRichTextDocument, ae as isSafeHref, T as isUnauthenticated, $e as isUnresolvedApi, Xn as makePreloadSeedBag, Rt as makeStoreSeedBag, vi as manifestUrl, la as markConflict, ca as markFailed, sa as markSent, Ci as openAccessReason, fe as parseRichText, ci as provenanceUrl, y as publishClientError, _ as publishClientTrace, ar as readPreloadedSeedOutcome, ir as readPreloadedSnapshot, o as recordClientDiagnostic, d as recoveryCoordinatorFor, We as registerSsrDescriptors, fa as replayable, m as reportClientError, Si as requiredScopes, or as resetPreloadSeeds, Lt as resetStoreRegistryForTests, ot as resetStoreStorageForTest, h as resolveByTag, ua as resolveConflictEntry, f as resolveRecoveryOptions, at as resolveStoreStorage, Fi as resolveTrackingEvent, P as resolveValidationMessage, ye as restrictToSchema, Rr as resumableConsumeProgram, le as richTextToPlainText, ri as rowsToOptions, fr as runSequence, k as schemaToColumns, _e as schemaToFields, tr as seedPreloadedSubscription, nr as seedPreloadedSubscriptionFailure, Bt as seedStore, dr as sequence, N as serializeRichText, gn as setMutationNotifier, Qn as setPreloadSeedResolver, zt as setStoreSeedResolver, it as setStoreStorage, X as settleMutation, st as shallow, Vi as shallowArrayEqual, Hi as sourceValues, Be as ssrClientProxy, Ge as ssrDescriptorsFor, qe as ssrStubHandle, O as stableKey, c as startApiSupervisor, Xt as startMutation, yt as storeHistory, r as subscribeClientDiagnostics, p as subscribeClientErrors, e as subscribeClientTraces, Qt as subscribeMutations, bt as subscribeStoreHistory, l as supersedesConfirmedPatches, St as travelToStoreState, wi as useAccessDecision, Dn as useAction, Wr as useAgent, Ur as useAgentChat, Lr as useAgentStream, $i as useAsyncValidation, gi as useCan, _i as useCanAny, yi as useCapabilityManifest, ka as useConnection, qn as useConnectionSetup, xa as useConnectionStatus, Oa as useConnections, Gr as useDataCopilot, oi as useDataTable, Zi as useDebounced, Ui as useDerived, ur as useEvent, Ln as useFormBinding, Vn as useFormBindingContext, Hn as useFormField, ni as useFormFlash, zi as useFormSkeleton, K as useFrameworkApi, Qe as useFrameworkRuntimes, Sn as useMutation, Yr as useOnRawRpcError, Jr as useOnRpcError, ha as useOutbox, hi as usePermissions, sr as usePreloadedSubscription, ia as usePreview, li as useProvenance, ii as useQueryField, Yi as useQueryFilters, Xi as useRecord, qr as useRefreshSubscription, Kr as useRefreshSubscriptions, Wi as useResourceCan, Gi as useResourceCans, Br as useResumableAgentStream, Rn as useSchemaFormBinding, pr as useSequence, ei as useServerRequest, q as useSubscription, Zr as useSubscriptionHealth, Bi as useTableSkeleton, Ri as useTracking, br as useTranscription, ki as useUndo, Ni as useUndoLog, yr as useUpload, An as useValidationMessages, _a as useWindowedSubscription, xr as useWorkflow, kr as useWorkflowDomainEvents, Ar as useWorkflowEventDeliveries, Or as useWorkflowEvents, wr as useWorkflowRun, Dr as useWorkflowRunEvents, Ir as useWorkflowRunState, Er as useWorkflowRunSteps, Tr as useWorkflowRuns, Sr as useWorkflowSignal, Cr as useWorkflowUpdate, ta as validateEventPayload, re as validateFields, Qi as validationStatus, b as wireAuthRefresh, ln as withIdempotencyKey, w as withProtocolOpenRecovery, Li as wrapTrackedCallbacks };
3366
+ export { li as ADMIN_SCOPE, ka as CLIENT_NAME, xa as CONNECTIONS_LIST_TAG, wa as CONNECTION_DISCONNECT_TAG, Sa as CONNECTION_START_TAG, Ca as CONNECTION_SUBMIT_TOKEN_TAG, he as FORM_FLASH_SCRIPT_ID, ue as FORM_KEY_FIELD, pe as FORM_PATH_PREFIX, se as FORM_REDIRECT_FIELD, Rn as FormBindingProvider, ze as FrameworkRuntimesContext, tt as FrameworkRuntimesProvider, p as INITIAL_RECOVERY_SNAPSHOT, j as LoadingSubscriptionCache, cn as MutationSerialExecutionError, pi as PermissionProvider, me as RICH_TEXT_MARKS, F as RICH_TEXT_MAX_NODES, m as RecoveryCoordinator, ce as RichTextDocument, g as RpcErrorBus, Qr as ServerRequestContext, ei as ServerRequestProvider, d as SubscriptionCache, Ai as UNDO_APPLY_TAG, ki as UNDO_LOG_TAG, ji as UNDO_REDO_TAG, Dn as ValidationMessagesProvider, Qe as _resetFrameworkRuntimesWarning, qe as _resetSsrDescriptors, tr as applyPreloadSeeds, Ht as applyStoreSeeds, f as buildApiRuntime, ui as canCall, di as canCallAny, t as clearClientDiagnostics, en as clearMutations, ua as clearSent, St as clearStoreHistory, k as clientDiagnosticsSnapshot, ha as computeWindow, na as createAnalytics, qn as createHooks, bi as decideAccess, ae as decodeFieldIssues, $i as defineEvent, Lt as defineStore, Ni as defineTracking, It as definedStores, Di as deriveEntityAdmins, c as disableClientDiagnosticsPersistence, te as documentLocale, ge as emptyRichTextDocument, r as enableClientDiagnosticsPersistence, ia as enqueueEntry, ta as eventCatalog, Ki as filtersFromSchema, P as formActionPath, de as formDataToInput, ye as formField, N as formSections, T as freshIdempotencyKey, hn as getMutationNotifier, Qt as getMutations, Zr as globalContext, re as isRichTextDocument, ie as isSafeHref, D as isUnauthenticated, et as isUnresolvedApi, Jn as makePreloadSeedBag, zt as makeStoreSeedBag, _i as manifestUrl, ca as markConflict, sa as markFailed, oa as markSent, Si as openAccessReason, fe as parseRichText, si as provenanceUrl, h as publishClientError, v as publishClientTrace, Kr as queryOnce, rr as readPreloadedSeedOutcome, nr as readPreloadedSnapshot, n as recordClientDiagnostic, w as recoveryCoordinatorFor, Ge as registerSsrDescriptors, da as replayable, l as reportClientError, xi as requiredScopes, ir as resetPreloadSeeds, Rt as resetStoreRegistryForTests, st as resetStoreStorageForTest, C as resolveByTag, la as resolveConflictEntry, x as resolveRecoveryOptions, ot as resolveStoreStorage, Pi as resolveTrackingEvent, _e as resolveValidationMessage, be as restrictToSchema, Ir as resumableConsumeProgram, le as richTextToPlainText, ni as rowsToOptions, ur as runSequence, M as schemaToColumns, ve as schemaToFields, $n as seedPreloadedSubscription, er as seedPreloadedSubscriptionFailure, Vt as seedStore, lr as sequence, oe as serializeRichText, mn as setMutationNotifier, Xn as setPreloadSeedResolver, Bt as setStoreSeedResolver, at as setStoreStorage, X as settleMutation, ct as shallow, Bi as shallowArrayEqual, Vi as sourceValues, Ve as ssrClientProxy, Ke as ssrDescriptorsFor, Je as ssrStubHandle, A as stableKey, E as startApiSupervisor, Zt as startMutation, bt as storeHistory, o as subscribeClientDiagnostics, O as subscribeClientErrors, i as subscribeClientTraces, $t as subscribeMutations, xt as subscribeStoreHistory, s as supersedesConfirmedPatches, Ct as travelToStoreState, Ci as useAccessDecision, Tn as useAction, Hr as useAgent, Vr as useAgentChat, Fr as useAgentStream, Qi as useAsyncValidation, hi as useCan, gi as useCanAny, vi as useCapabilityManifest, Oa as useConnection, Gn as useConnectionSetup, ba as useConnectionStatus, Da as useConnections, Ur as useDataCopilot, ai as useDataTable, Xi as useDebounced, Hi as useDerived, cr as useEvent, Fn as useFormBinding, zn as useFormBindingContext, Bn as useFormField, ti as useFormFlash, Ri as useFormSkeleton, K as useFrameworkApi, $e as useFrameworkRuntimes, bn as useMutation, Jr as useOnRawRpcError, qr as useOnRpcError, ma as useOutbox, mi as usePermissions, ar as usePreloadedSubscription, ra as usePreview, ci as useProvenance, ri as useQueryField, Ji as useQueryFilters, Yi as useRecord, Gr as useRefreshSubscription, Wr as useRefreshSubscriptions, Ui as useResourceCan, Wi as useResourceCans, Rr as useResumableAgentStream, In as useSchemaFormBinding, dr as useSequence, $r as useServerRequest, q as useSubscription, Xr as useSubscriptionHealth, zi as useTableSkeleton, Li as useTracking, vr as useTranscription, Oi as useUndo, Mi as useUndoLog, _r as useUpload, On as useValidationMessages, ga as useWindowedSubscription, yr as useWorkflow, Dr as useWorkflowDomainEvents, Or as useWorkflowEventDeliveries, Er as useWorkflowEvents, Sr as useWorkflowRun, Tr as useWorkflowRunEvents, Pr as useWorkflowRunState, wr as useWorkflowRunSteps, Cr as useWorkflowRuns, br as useWorkflowSignal, xr as useWorkflowUpdate, ea as validateEventPayload, ne as validateFields, Zi as validationStatus, S as wireAuthRefresh, _ as withIdempotencyKey, b as withProtocolOpenRecovery, Ii as wrapTrackedCallbacks };