@voltro/client 0.81.0 → 0.82.0

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