@nivaro/react 0.3.53 → 0.3.54

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.
@@ -0,0 +1,48 @@
1
+ function r(e) {
2
+ return e.childFailed === !0 || e.reasonWaiting === !0;
3
+ }
4
+ function a(e, s) {
5
+ const { isNew: t } = s, i = s.noun.toLowerCase();
6
+ if (e.childFailed) {
7
+ const n = e.childErrors ?? [];
8
+ return n.length === 0 && e.linkProblems.length > 0 ? null : {
9
+ kind: "error",
10
+ text: n.length > 0 ? `Not everything saved — ${n.join(" · ")}` : "Not everything saved — some lines did not save",
11
+ duration: 2e4
12
+ };
13
+ }
14
+ if (e.reasonWaiting)
15
+ return {
16
+ kind: "warning",
17
+ text: "Not saved yet — give a reason for the change to finish saving",
18
+ duration: 1e4
19
+ };
20
+ if (e.hidden) {
21
+ const n = e.hidden.reason ? ` (${e.hidden.reason})` : "";
22
+ return {
23
+ kind: "warning",
24
+ text: t ? `The new ${i} was created, but it’s outside what you can see${n}.` : `Saved, but this ${i} is now outside what you can see${n}.`,
25
+ duration: 15e3
26
+ };
27
+ }
28
+ if (e.lineConflicts) {
29
+ const n = e.lineConflicts;
30
+ return {
31
+ kind: "warning",
32
+ text: `Saved, except ${n} ${n === 1 ? "line" : "lines"} someone else changed — pick which value wins`,
33
+ duration: 1e4
34
+ };
35
+ }
36
+ if (!t && e.keptTheirs) {
37
+ const n = e.keptTheirs;
38
+ return {
39
+ kind: "success",
40
+ text: e.noFieldWrite && e.onlyMain ? `Kept the newer ${n === 1 ? "value" : "values"} — nothing of yours left to save` : `Changes saved — kept the newer ${n === 1 ? "value" : "values"} for ${n} ${n === 1 ? "field" : "fields"}`
41
+ };
42
+ }
43
+ return !t && e.noFieldWrite && e.onlyMain ? { kind: "plain", text: "Nothing to save — no changes" } : { kind: "success", text: t ? "Record created" : "Changes saved" };
44
+ }
45
+ export {
46
+ a as saveClosingMessage,
47
+ r as saveLeftWorkStaged
48
+ };
@@ -0,0 +1,13 @@
1
+ function n(r, f, t, i) {
2
+ for (const e of r)
3
+ if (!e.startsWith("__") && (!t || !i(f[e], t[e])))
4
+ return !0;
5
+ return !1;
6
+ }
7
+ function u(r) {
8
+ return r.dirty ? r.editsDiffer ? "review" : "refresh" : "auto-refresh";
9
+ }
10
+ export {
11
+ u as staleBannerMode,
12
+ n as touchedEditsDiffer
13
+ };
@@ -1,12 +1,12 @@
1
- import { useQueryClient as Be, useQuery as Ie } from "@tanstack/react-query";
2
- import { useRef as F, useMemo as Oe, useState as ae, useEffect as I, useCallback as l, createContext as Ue, useContext as _e } from "react";
3
- import { useNivaroClient as Je } from "../../context.js";
4
- import { get as We, put as ie, del as Ge } from "../../lib/commands.js";
5
- import { isEmptyValue as v, pickDefault as le, cascadeParents as K, orderTopDown as Xe, captureContext as Ze } from "../../lib/personal-defaults.js";
6
- import { titleCase as Ce } from "../../lib/utils.js";
7
- const et = Ue(null);
8
- function dt() {
9
- return _e(et);
1
+ import { useQueryClient as Ie, useQuery as Ue } from "@tanstack/react-query";
2
+ import { useRef as S, useMemo as Ce, useState as ae, useEffect as I, useCallback as l, createContext as _e, useContext as Je } from "react";
3
+ import { useNivaroClient as We } from "../../context.js";
4
+ import { get as Ge, put as ie, del as Xe } from "../../lib/commands.js";
5
+ import { isEmptyValue as v, pickDefault as le, cascadeParents as K, orderTopDown as Ze, captureContext as et } from "../../lib/personal-defaults.js";
6
+ import { titleCase as Ve } from "../../lib/utils.js";
7
+ const tt = _e(null);
8
+ function yt() {
9
+ return Je(tt);
10
10
  }
11
11
  function Q(i) {
12
12
  return ["field-defaults", i];
@@ -14,73 +14,73 @@ function Q(i) {
14
14
  function L(i) {
15
15
  return Array.isArray(i) ? i.map(L) : i && typeof i == "object" && "id" in i ? i.id : i;
16
16
  }
17
- const tt = /* @__PURE__ */ new Set(["integer", "bigInteger", "float", "decimal", "number", "double"]), rt = /* @__PURE__ */ new Set(["date"]), nt = /* @__PURE__ */ new Set(["dateTime", "datetime", "timestamp", "time"]);
18
- function E(i, f, S) {
17
+ const rt = /* @__PURE__ */ new Set(["integer", "bigInteger", "float", "decimal", "number", "double"]), nt = /* @__PURE__ */ new Set(["date"]), st = /* @__PURE__ */ new Set(["dateTime", "datetime", "timestamp", "time"]);
18
+ function N(i, f, F) {
19
19
  if (v(i) && v(f)) return !0;
20
- if (S && !Array.isArray(i) && !Array.isArray(f) && !v(i) && !v(f)) {
20
+ if (F && !Array.isArray(i) && !Array.isArray(f) && !v(i) && !v(f)) {
21
21
  const M = L(i), k = L(f);
22
- if (tt.has(S)) {
23
- const p = Number(M), m = Number(k);
24
- if (Number.isFinite(p) && Number.isFinite(m)) return p === m;
25
- } else if (rt.has(S)) {
22
+ if (rt.has(F)) {
23
+ const p = Number(M), h = Number(k);
24
+ if (Number.isFinite(p) && Number.isFinite(h)) return p === h;
25
+ } else if (nt.has(F)) {
26
26
  const p = (q) => {
27
27
  var Y;
28
28
  return (Y = /^(\d{4}-\d{2}-\d{2})/.exec(String(q))) == null ? void 0 : Y[1];
29
- }, m = p(M), d = p(k);
30
- if (m && d) return m === d;
31
- } else if (nt.has(S)) {
32
- const p = Date.parse(String(M)), m = Date.parse(String(k));
33
- if (Number.isFinite(p) && Number.isFinite(m)) return p === m;
29
+ }, h = p(M), d = p(k);
30
+ if (h && d) return h === d;
31
+ } else if (st.has(F)) {
32
+ const p = Date.parse(String(M)), h = Date.parse(String(k));
33
+ if (Number.isFinite(p) && Number.isFinite(h)) return p === h;
34
34
  }
35
35
  }
36
- const N = (M) => {
36
+ const E = (M) => {
37
37
  const k = L(M);
38
38
  return Array.isArray(k) ? k.map((p) => String(p)).sort() : String(k);
39
39
  };
40
- return JSON.stringify(N(i)) === JSON.stringify(N(f));
40
+ return JSON.stringify(E(i)) === JSON.stringify(E(f));
41
41
  }
42
- function yt(i, f) {
43
- let S = 0;
44
- for (const [N, M] of i) {
45
- const k = f.get(N);
46
- for (const p of M) k != null && k.has(String(p)) || S++;
42
+ function pt(i, f) {
43
+ let F = 0;
44
+ for (const [E, M] of i) {
45
+ const k = f.get(E);
46
+ for (const p of M) k != null && k.has(String(p)) || F++;
47
47
  }
48
- return S;
48
+ return F;
49
49
  }
50
- function st(i) {
50
+ function ct(i) {
51
51
  return Array.isArray(i) ? i : v(i) ? [] : [i];
52
52
  }
53
- function pt(i) {
54
- const { collection: f, isNew: S, disabled: N, enabled: M = !0, ready: k = !0 } = i, p = Je(), m = Be(), d = F(i);
53
+ function wt(i) {
54
+ const { collection: f, isNew: F, disabled: E, enabled: M = !0, ready: k = !0 } = i, p = We(), h = Ie(), d = S(i);
55
55
  d.current = i;
56
- const { data: q, isError: Y } = Ie({
56
+ const { data: q, isError: Y } = Ue({
57
57
  queryKey: Q(f),
58
- queryFn: () => p.request(We("/field-defaults/mine", { collection: f })).then((e) => e.data ?? []),
58
+ queryFn: () => p.request(Ge("/field-defaults/mine", { collection: f })).then((e) => e.data ?? []),
59
59
  staleTime: 5 * 6e4,
60
60
  enabled: !!f && M
61
- }), U = Oe(() => {
61
+ }), U = Ce(() => {
62
62
  const e = /* @__PURE__ */ new Map();
63
63
  for (const t of q ?? []) {
64
64
  const r = e.get(t.field) ?? [];
65
65
  r.push(t), e.set(t.field, r);
66
66
  }
67
67
  return e;
68
- }, [q]), ee = F(U);
68
+ }, [q]), ee = S(U);
69
69
  ee.current = U;
70
- const h = F(/* @__PURE__ */ new Map()), [_, Ve] = ae(() => /* @__PURE__ */ new Map()), A = F(/* @__PURE__ */ new Map()), [te, Ke] = ae(() => /* @__PURE__ */ new Map()), T = F(/* @__PURE__ */ new Set()), H = F(/* @__PURE__ */ new Map()), J = F(!0);
70
+ const m = S(/* @__PURE__ */ new Map()), [_, Ke] = ae(() => /* @__PURE__ */ new Map()), A = S(/* @__PURE__ */ new Map()), [te, Le] = ae(() => /* @__PURE__ */ new Map()), T = S(/* @__PURE__ */ new Set()), H = S(/* @__PURE__ */ new Map()), J = S(!0);
71
71
  I(() => (J.current = !0, () => {
72
72
  J.current = !1;
73
73
  }), []);
74
- const fe = F(_), de = F(te), b = l(() => {
74
+ const fe = S(_), de = S(te), b = l(() => {
75
75
  if (!J.current) return;
76
76
  const e = (t, r) => t.size === r.size && [...r].every(([n, s]) => t.get(n) === s);
77
- if (!e(fe.current, h.current)) {
78
- const t = new Map(h.current);
79
- fe.current = t, Ve(t);
77
+ if (!e(fe.current, m.current)) {
78
+ const t = new Map(m.current);
79
+ fe.current = t, Ke(t);
80
80
  }
81
81
  if (!e(de.current, A.current)) {
82
82
  const t = new Map(A.current);
83
- de.current = t, Ke(t);
83
+ de.current = t, Le(t);
84
84
  }
85
85
  }, []), o = l((e) => {
86
86
  var n;
@@ -95,7 +95,7 @@ function pt(i) {
95
95
  [o]
96
96
  ), D = l(async (e, t) => {
97
97
  const r = d.current, s = (await Promise.all(
98
- st(L(t)).map(async (u) => {
98
+ ct(L(t)).map(async (u) => {
99
99
  if (!r.valueLabel) return String(u);
100
100
  try {
101
101
  return await r.valueLabel(e, u) ?? null;
@@ -105,7 +105,7 @@ function pt(i) {
105
105
  })
106
106
  )).filter((u) => !!u);
107
107
  return s.length > 0 ? s.join(", ") : null;
108
- }, []), $ = F(0), W = l(
108
+ }, []), $ = S(0), W = l(
109
109
  async (e, t, r) => {
110
110
  const n = await t;
111
111
  $.current === r && (A.current.set(e, n), b());
@@ -121,49 +121,49 @@ function pt(i) {
121
121
  ), G = l((e, t, r) => {
122
122
  const n = d.current;
123
123
  if (n.setFieldValue(e, t, r), v(t)) {
124
- h.current.delete(e);
124
+ m.current.delete(e);
125
125
  return;
126
126
  }
127
- h.current.set(e, t), A.current.delete(e), n.markAutoFilled([e]);
127
+ m.current.set(e, t), A.current.delete(e), n.markAutoFilled([e]);
128
128
  }, []), ye = l(
129
129
  async (e, t) => {
130
- var Re, Me, qe, De, Ee, Ne;
130
+ var Me, qe, De, Ee, Ne, Te;
131
131
  const r = d.current, n = () => $.current !== t, s = ee.current.get(e) ?? [];
132
132
  if (s.length === 0 || !r.layoutAllows(e)) return [];
133
- if (T.current.has(e) || !(((Re = r.canFill) == null ? void 0 : Re.call(r, e)) ?? !0)) return [];
133
+ if (T.current.has(e) || !(((Me = r.canFill) == null ? void 0 : Me.call(r, e)) ?? !0)) return [];
134
134
  const u = o(e), y = !v(u);
135
- if (y && !(((Me = r.replaceable) == null ? void 0 : Me.call(r, e, u)) ?? !1)) return [];
135
+ if (y && !(((qe = r.replaceable) == null ? void 0 : qe.call(r, e, u)) ?? !1)) return [];
136
136
  const R = new Set(s.flatMap((a) => Object.keys(a.context ?? {}))), w = O(R), { pick: c, fillParents: g, blockedBy: C } = le(s, w);
137
137
  if (!c) {
138
138
  if (C) {
139
- const a = (qe = s.find(
140
- (x) => x.context && C in x.context && !E(x.context[C], w[C])
141
- )) == null ? void 0 : qe.context[C];
139
+ const a = (De = s.find(
140
+ (x) => x.context && C in x.context && !N(x.context[C], w[C])
141
+ )) == null ? void 0 : De.context[C];
142
142
  await W(e, re(C, a), t);
143
143
  }
144
144
  return [];
145
145
  }
146
- const V = K(e, r.rulesFor).reverse(), ze = [
146
+ const V = K(e, r.rulesFor).reverse(), Be = [
147
147
  ...V.filter((a) => a in g),
148
148
  ...Object.keys(g).filter((a) => !V.includes(a))
149
149
  ], Z = [], j = () => {
150
150
  for (const [a, x] of Z.reverse())
151
- E(o(a), x) ? G(a, null, x) : h.current.delete(a);
151
+ N(o(a), x) ? G(a, null, x) : m.current.delete(a);
152
152
  };
153
- for (const a of ze) {
154
- const x = g[a], Te = r.layoutAllows(a) && !T.current.has(a) && (((De = r.canFill) == null ? void 0 : De.call(r, a)) ?? !0) ? await r.revalidate(a, x) : !1;
153
+ for (const a of Be) {
154
+ const x = g[a], Oe = r.layoutAllows(a) && !T.current.has(a) && (((Ee = r.canFill) == null ? void 0 : Ee.call(r, a)) ?? !0) ? await r.revalidate(a, x) : !1;
155
155
  if (n()) return [];
156
- if (Te === null)
156
+ if (Oe === null)
157
157
  return j(), [];
158
- if (!Te || !v(o(a)))
158
+ if (!Oe || !v(o(a)))
159
159
  return j(), await W(e, re(a, x), t), [];
160
160
  G(a, x), Z.push([a, x]);
161
161
  }
162
- const Ae = await r.revalidate(e, c.value);
162
+ const Pe = await r.revalidate(e, c.value);
163
163
  if (n()) return [];
164
- if (Ae === null)
164
+ if (Pe === null)
165
165
  return j(), [];
166
- if (!Ae)
166
+ if (!Pe)
167
167
  return j(), await W(
168
168
  e,
169
169
  D(e, c.value).then(
@@ -171,10 +171,10 @@ function pt(i) {
171
171
  ),
172
172
  t
173
173
  ), [];
174
- if (!E(o(e), u) || !(((Ee = r.canFill) == null ? void 0 : Ee.call(r, e)) ?? !0))
174
+ if (!N(o(e), u) || !(((Ne = r.canFill) == null ? void 0 : Ne.call(r, e)) ?? !0))
175
175
  return j(), [];
176
- const Pe = le(s, O(R));
177
- return ((Ne = Pe.pick) == null ? void 0 : Ne.id) !== c.id || Object.keys(Pe.fillParents).length > 0 ? (j(), "stale") : (G(e, c.value, y ? u : void 0), H.current.set(
176
+ const Re = le(s, O(R));
177
+ return ((Te = Re.pick) == null ? void 0 : Te.id) !== c.id || Object.keys(Re.fillParents).length > 0 ? (j(), "stale") : (G(e, c.value, y ? u : void 0), H.current.set(
178
178
  e,
179
179
  Z.map(([a]) => a)
180
180
  ), [...Z.map(([a]) => a), e]);
@@ -200,39 +200,39 @@ function pt(i) {
200
200
  }
201
201
  if ($.current === t) {
202
202
  for (const u of r)
203
- h.current.has(u) && ((s = (n = d.current).afterApply) == null || s.call(n, u, h.current.get(u)));
203
+ m.current.has(u) && ((s = (n = d.current).afterApply) == null || s.call(n, u, m.current.get(u)));
204
204
  b();
205
205
  }
206
206
  },
207
207
  [pe, b]
208
208
  ), se = l(() => {
209
209
  const e = d.current;
210
- return Xe(
210
+ return Ze(
211
211
  [...ee.current.keys()].filter((t) => e.layoutAllows(t)),
212
212
  e.rulesFor
213
213
  );
214
- }, []), ce = F(!1);
214
+ }, []), ce = S(!1);
215
215
  I(() => {
216
- !S || N || !k || ce.current || q === void 0 || (ce.current = !0, ne(se()));
217
- }, [S, N, k, q, ne, se]), I(() => {
216
+ !F || E || !k || ce.current || q === void 0 || (ce.current = !0, ne(se()));
217
+ }, [F, E, k, q, ne, se]), I(() => {
218
218
  let e = !1;
219
- for (const [t, r] of h.current)
220
- E(o(t), r) || (h.current.delete(t), e = !0);
219
+ for (const [t, r] of m.current)
220
+ N(o(t), r) || (m.current.delete(t), e = !0);
221
221
  for (const t of A.current.keys())
222
222
  v(o(t)) || (A.current.delete(t), e = !0);
223
223
  e && b();
224
224
  });
225
- const z = F(/* @__PURE__ */ new Set()), B = F(/* @__PURE__ */ new Map()), [Le, Ye] = ae(0), $e = l(
225
+ const z = S(/* @__PURE__ */ new Set()), B = S(/* @__PURE__ */ new Map()), [Ye, $e] = ae(0), je = l(
226
226
  (e) => {
227
- let t = h.current.delete(e);
227
+ let t = m.current.delete(e);
228
228
  if (A.current.delete(e) && (t = !0), T.current.delete(e), B.current.delete(e), !d.current.isNew) {
229
229
  t && b();
230
230
  return;
231
231
  }
232
232
  const r = d.current.rulesFor;
233
- for (const [n, s] of [...h.current])
234
- K(n, r).includes(e) && (B.current.set(n, s), h.current.delete(n), t = !0);
235
- t && b(), z.current.add(e), Ye((n) => n + 1);
233
+ for (const [n, s] of [...m.current])
234
+ K(n, r).includes(e) && (B.current.set(n, s), m.current.delete(n), t = !0);
235
+ t && b(), z.current.add(e), $e((n) => n + 1);
236
236
  },
237
237
  [b]
238
238
  );
@@ -246,7 +246,7 @@ function pt(i) {
246
246
  for (const s of se()) {
247
247
  if (t.has(s)) {
248
248
  const y = t.get(s), R = o(s);
249
- if (E(R, y)) r.setFieldValue(s, null, y);
249
+ if (N(R, y)) r.setFieldValue(s, null, y);
250
250
  else if (!v(R)) continue;
251
251
  n.push(s);
252
252
  continue;
@@ -255,11 +255,11 @@ function pt(i) {
255
255
  e.some((y) => u.includes(y)) && A.current.has(s) && v(o(s)) && (A.current.delete(s), n.push(s));
256
256
  }
257
257
  b(), n.length > 0 && ne(n);
258
- }, [Le]);
258
+ }, [Ye]);
259
259
  const oe = l(
260
260
  (e) => {
261
261
  var R;
262
- const t = d.current, r = h.current;
262
+ const t = d.current, r = m.current;
263
263
  if (!r.has(e)) return;
264
264
  const n = (w) => K(w, t.rulesFor), s = /* @__PURE__ */ new Set([e]);
265
265
  for (let w = !0; w; ) {
@@ -277,23 +277,23 @@ function pt(i) {
277
277
  const u = (w) => n(w).length, y = [];
278
278
  for (const w of [...s].sort((c, g) => u(g) - u(c))) {
279
279
  const c = r.get(w);
280
- E(o(w), c) && (t.setFieldValue(w, null, c), y.push(w)), r.delete(w), H.current.delete(w), T.current.add(w);
280
+ N(o(w), c) && (t.setFieldValue(w, null, c), y.push(w)), r.delete(w), H.current.delete(w), T.current.add(w);
281
281
  }
282
282
  y.length && ((R = t.onUndone) == null || R.call(t, y)), b();
283
283
  },
284
284
  [o, b]
285
- ), je = l(
285
+ ), Qe = l(
286
286
  (e) => {
287
- if (!h.current.has(e)) return;
288
- const t = h.current.get(e);
289
- E(o(e), t) && d.current.setFieldValue(e, null, t), h.current.delete(e), T.current.add(e), b();
287
+ if (!m.current.has(e)) return;
288
+ const t = m.current.get(e);
289
+ N(o(e), t) && d.current.setFieldValue(e, null, t), m.current.delete(e), T.current.add(e), b();
290
290
  },
291
291
  [o, b]
292
- ), X = `${f}|${S ? "new" : "saved"}|${i.resetKey ?? ""}`, we = F(X);
292
+ ), X = `${f}|${F ? "new" : "saved"}|${i.resetKey ?? ""}`, we = S(X);
293
293
  I(() => {
294
- we.current !== X && (we.current = X, h.current.clear(), A.current.clear(), T.current.clear(), H.current.clear(), B.current.clear(), z.current.clear(), ce.current = !1, $.current += 1, b());
294
+ we.current !== X && (we.current = X, m.current.clear(), A.current.clear(), T.current.clear(), H.current.clear(), B.current.clear(), z.current.clear(), ce.current = !1, $.current += 1, b());
295
295
  }, [X, b]);
296
- const ue = l((e) => te.get(e) ?? null, [te]), Qe = l(() => h.current, []), P = l(
296
+ const ue = l((e) => te.get(e) ?? null, [te]), He = l(() => m.current, []), P = l(
297
297
  (e) => {
298
298
  const t = U.get(e) ?? [];
299
299
  if (t.length === 0) return null;
@@ -301,9 +301,9 @@ function pt(i) {
301
301
  return le(t, O(r)).pick;
302
302
  },
303
303
  [U, O]
304
- ), me = l(() => {
305
- m.invalidateQueries({ queryKey: Q(f) });
306
- }, [m, f]), he = l(
304
+ ), he = l(() => {
305
+ h.invalidateQueries({ queryKey: Q(f) });
306
+ }, [h, f]), me = l(
307
307
  (e) => !v(o(e)),
308
308
  [o]
309
309
  ), ge = l(
@@ -312,7 +312,7 @@ function pt(i) {
312
312
  const t = o(e);
313
313
  if (v(t)) return !1;
314
314
  const r = P(e);
315
- return !!r && E(r.value, t, (s = (n = d.current).fieldType) == null ? void 0 : s.call(n, e));
315
+ return !!r && N(r.value, t, (s = (n = d.current).fieldType) == null ? void 0 : s.call(n, e));
316
316
  },
317
317
  [o, P]
318
318
  ), be = l(
@@ -326,7 +326,7 @@ function pt(i) {
326
326
  r.map(
327
327
  async (n) => {
328
328
  var s;
329
- return await D(n, o(n)) ?? ((s = t.fieldLabel) == null ? void 0 : s.call(t, n)) ?? Ce(n);
329
+ return await D(n, o(n)) ?? ((s = t.fieldLabel) == null ? void 0 : s.call(t, n)) ?? Ve(n);
330
330
  }
331
331
  )
332
332
  );
@@ -341,7 +341,7 @@ function pt(i) {
341
341
  collection: f,
342
342
  field: y,
343
343
  value: L(s[y]),
344
- context: Ze(y, s, t.rulesFor)
344
+ context: et(y, s, t.rulesFor)
345
345
  })
346
346
  );
347
347
  try {
@@ -349,10 +349,10 @@ function pt(i) {
349
349
  for (const y of [...n].reverse())
350
350
  t.layoutAllows(y) && !v(s[y]) && await u(y);
351
351
  } finally {
352
- await m.invalidateQueries({ queryKey: Q(f) });
352
+ await h.invalidateQueries({ queryKey: Q(f) });
353
353
  }
354
354
  },
355
- [p, m, f, o, O]
355
+ [p, h, f, o, O]
356
356
  ), ke = l(
357
357
  async (e) => {
358
358
  const t = P(e);
@@ -369,10 +369,10 @@ function pt(i) {
369
369
  })
370
370
  );
371
371
  } finally {
372
- await m.invalidateQueries({ queryKey: Q(f) });
372
+ await h.invalidateQueries({ queryKey: Q(f) });
373
373
  }
374
374
  },
375
- [p, m, f, o, P]
375
+ [p, h, f, o, P]
376
376
  ), Fe = l(
377
377
  async (e) => {
378
378
  const t = d.current, r = P(e), n = (r == null ? void 0 : r.context) ?? {}, s = [...K(e, t.rulesFor)].reverse(), u = [
@@ -380,7 +380,7 @@ function pt(i) {
380
380
  ...Object.keys(n).filter((c) => !s.includes(c))
381
381
  ], y = (c) => {
382
382
  var g;
383
- return ((g = t.fieldLabel) == null ? void 0 : g.call(t, c)) ?? Ce(c);
383
+ return ((g = t.fieldLabel) == null ? void 0 : g.call(t, c)) ?? Ve(c);
384
384
  }, [R, ...w] = await Promise.all([
385
385
  D(e, o(e)).then((c) => c ?? y(e)),
386
386
  ...u.map((c) => D(c, n[c]).then((g) => g ?? y(c)))
@@ -391,9 +391,9 @@ function pt(i) {
391
391
  ), Se = l(
392
392
  async (e) => {
393
393
  const t = P(e);
394
- return t ? (await p.request(Ge(`/field-defaults/mine/${t.id}`)), h.current.delete(e) && (T.current.add(e), b()), await m.invalidateQueries({ queryKey: Q(f) }), t) : null;
394
+ return t ? (await p.request(Xe(`/field-defaults/mine/${t.id}`)), m.current.delete(e) && (T.current.add(e), b()), await h.invalidateQueries({ queryKey: Q(f) }), t) : null;
395
395
  },
396
- [p, m, f, P, b]
396
+ [p, h, f, P, b]
397
397
  ), xe = l(
398
398
  async (e) => {
399
399
  await p.request(
@@ -403,10 +403,10 @@ function pt(i) {
403
403
  value: e.value,
404
404
  context: e.context ?? {}
405
405
  })
406
- ), await m.invalidateQueries({ queryKey: Q(f) });
406
+ ), await h.invalidateQueries({ queryKey: Q(f) });
407
407
  },
408
- [p, m, f]
409
- ), He = Oe(
408
+ [p, h, f]
409
+ ), Ae = F && !E && !k, ze = Ce(
410
410
  () => ({
411
411
  allowed: (e) => (d.current.enabled ?? !0) && d.current.layoutAllows(e),
412
412
  manageable: (e) => {
@@ -415,7 +415,8 @@ function pt(i) {
415
415
  },
416
416
  loaded: q !== void 0 || Y,
417
417
  failed: q === void 0 && Y,
418
- isNew: S,
418
+ isNew: F,
419
+ held: Ae,
419
420
  defaultFor: P,
420
421
  isDefault: ge,
421
422
  save: ve,
@@ -423,8 +424,8 @@ function pt(i) {
423
424
  describeUpdate: Fe,
424
425
  clear: Se,
425
426
  restore: xe,
426
- refresh: me,
427
- hasValue: he,
427
+ refresh: he,
428
+ hasValue: me,
428
429
  describeSave: be,
429
430
  applied: (e) => _.has(e),
430
431
  hintFor: ue,
@@ -433,7 +434,8 @@ function pt(i) {
433
434
  [
434
435
  q,
435
436
  Y,
436
- S,
437
+ F,
438
+ Ae,
437
439
  P,
438
440
  ge,
439
441
  ve,
@@ -441,21 +443,21 @@ function pt(i) {
441
443
  Fe,
442
444
  Se,
443
445
  xe,
444
- me,
445
446
  he,
447
+ me,
446
448
  be,
447
449
  _,
448
450
  ue,
449
451
  oe
450
452
  ]
451
453
  );
452
- return { ledger: _, hintFor: ue, undo: oe, onPersonChange: $e, release: je, appliedNow: Qe, context: He };
454
+ return { ledger: _, hintFor: ue, undo: oe, onPersonChange: je, release: Qe, appliedNow: He, context: ze };
453
455
  }
454
456
  export {
455
- et as PersonalDefaultsContext,
456
- yt as linksBeyond,
457
+ tt as PersonalDefaultsContext,
458
+ pt as linksBeyond,
457
459
  Q as personalDefaultsKey,
458
- E as sameDefaultValue,
459
- pt as usePersonalDefaults,
460
- dt as usePersonalDefaultsApi
460
+ N as sameDefaultValue,
461
+ wt as usePersonalDefaults,
462
+ yt as usePersonalDefaultsApi
461
463
  };