@nivaro/react 0.2.54 → 0.2.55

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.
Files changed (150) hide show
  1. package/dist/full.css +1 -1
  2. package/dist/hooks/useSessionRecorder.js +99 -98
  3. package/dist/index.d.ts +339 -2
  4. package/dist/index.js +644 -618
  5. package/dist/layout-editor.d.ts +4 -0
  6. package/dist/shared/components/BackgroundRunOffer.js +117 -0
  7. package/dist/shared/components/BroadcastView.js +214 -213
  8. package/dist/shared/components/CollectionBrowserView.js +2592 -2695
  9. package/dist/shared/components/ItemEditForm.js +4066 -3832
  10. package/dist/shared/components/JobsTray.js +100 -55
  11. package/dist/shared/components/MyWorkView.js +91 -89
  12. package/dist/shared/components/NotificationBell.js +80 -79
  13. package/dist/shared/components/ProfileView.js +568 -520
  14. package/dist/shared/components/RecordCompare.js +254 -0
  15. package/dist/shared/components/RecordReadView.js +599 -552
  16. package/dist/shared/components/ReportView.js +578 -543
  17. package/dist/shared/components/RowPresence.js +91 -0
  18. package/dist/shared/components/WidgetSlot.js +474 -458
  19. package/dist/shared/components/ai/AiAnalyticsView.js +16 -6
  20. package/dist/shared/components/ai/AskPanel.js +139 -119
  21. package/dist/shared/components/ai/FirstWeekCard.js +126 -0
  22. package/dist/shared/components/bulk/BulkFieldUpdate.js +289 -0
  23. package/dist/shared/components/bulk/bulk-field-options.js +45 -0
  24. package/dist/shared/components/charts/CumulativeFlowChart.js +176 -0
  25. package/dist/shared/components/chat/ChannelArchive.js +326 -0
  26. package/dist/shared/components/chat/ChannelExtras.js +141 -121
  27. package/dist/shared/components/chat/ChatAnalyticsView.js +112 -110
  28. package/dist/shared/components/chat/ChatPanel.js +1695 -1733
  29. package/dist/shared/components/chat/Composer.js +357 -303
  30. package/dist/shared/components/chat/MessageActions.js +92 -0
  31. package/dist/shared/components/chat/MessageFormat.js +290 -264
  32. package/dist/shared/components/chat/OutboxBubbles.js +146 -0
  33. package/dist/shared/components/chat/RequestIdCard.js +135 -0
  34. package/dist/shared/components/chat/RoomHeaderMenu.js +202 -0
  35. package/dist/shared/components/chat/RoomParts.js +213 -274
  36. package/dist/shared/components/chat/ScreenClip.js +184 -0
  37. package/dist/shared/components/chat/chat-core.js +402 -483
  38. package/dist/shared/components/chat/chat-drafts.js +59 -0
  39. package/dist/shared/components/chat/chat-emoji.js +348 -0
  40. package/dist/shared/components/chat/chat-local-time.js +41 -0
  41. package/dist/shared/components/chat/chat-outbox.js +303 -0
  42. package/dist/shared/components/chat/chat-window.js +163 -0
  43. package/dist/shared/components/chat/huddle/HuddleControls.js +143 -0
  44. package/dist/shared/components/chat/huddle/HuddleStage.js +164 -0
  45. package/dist/shared/components/chat/huddle/huddle-store.js +342 -0
  46. package/dist/shared/components/chat/huddle/useHuddle.js +58 -0
  47. package/dist/shared/components/help-videos/api.js +76 -73
  48. package/dist/shared/components/item-edit/CatalogPickerField.js +113 -112
  49. package/dist/shared/components/item-edit/ChangeReasonDialog.js +13 -13
  50. package/dist/shared/components/item-edit/FieldAffordances.js +2 -2
  51. package/dist/shared/components/item-edit/FieldRenderer.js +248 -245
  52. package/dist/shared/components/item-edit/FieldRow.js +292 -279
  53. package/dist/shared/components/item-edit/GroupSection.js +698 -574
  54. package/dist/shared/components/item-edit/InlineTableField.js +3 -1
  55. package/dist/shared/components/item-edit/RelationCombobox.js +186 -176
  56. package/dist/shared/components/item-edit/entry/EntryStrip.js +54 -0
  57. package/dist/shared/components/item-edit/entry/entry-keys.js +27 -0
  58. package/dist/shared/components/item-edit/entry/useEntryKeyboard.js +70 -0
  59. package/dist/shared/components/item-edit/entry/useEntryMode.js +59 -0
  60. package/dist/shared/components/item-edit/form-structure-ui.js +105 -0
  61. package/dist/shared/components/item-edit/lazy-sections.js +36 -0
  62. package/dist/shared/components/item-edit/lock-why.js +39 -32
  63. package/dist/shared/components/item-edit/picker-miss.js +26 -0
  64. package/dist/shared/components/item-edit/placement-behaviour.js +196 -0
  65. package/dist/shared/components/item-edit/useFormUsageBeacon.js +51 -45
  66. package/dist/shared/components/layout-editor/AddPanel.js +134 -117
  67. package/dist/shared/components/layout-editor/ChangeNote.js +25 -24
  68. package/dist/shared/components/layout-editor/CollabParts.js +80 -75
  69. package/dist/shared/components/layout-editor/DesignNode.js +126 -120
  70. package/dist/shared/components/layout-editor/EditorCanvas.js +30 -27
  71. package/dist/shared/components/layout-editor/EditorTopBar.js +203 -192
  72. package/dist/shared/components/layout-editor/HistoryPanel.js +120 -104
  73. package/dist/shared/components/layout-editor/LayoutEditor.js +768 -671
  74. package/dist/shared/components/layout-editor/RestorePiece.js +143 -0
  75. package/dist/shared/components/layout-editor/StagedChip.js +22 -0
  76. package/dist/shared/components/layout-editor/StructureMenu.js +237 -186
  77. package/dist/shared/components/layout-editor/collab/FormFollowShare.js +149 -103
  78. package/dist/shared/components/layout-editor/collab/collab-api.js +29 -26
  79. package/dist/shared/components/layout-editor/dnd/LayoutDndProvider.js +81 -80
  80. package/dist/shared/components/layout-editor/dnd/node.js +69 -57
  81. package/dist/shared/components/layout-editor/draft-recovery.js +113 -43
  82. package/dist/shared/components/layout-editor/entry/PlacementPresets.js +149 -0
  83. package/dist/shared/components/layout-editor/entry/entry-editor-context.js +10 -0
  84. package/dist/shared/components/layout-editor/entry/presets.js +71 -0
  85. package/dist/shared/components/layout-editor/entry/tab-order.js +110 -0
  86. package/dist/shared/components/layout-editor/entry/theme-preview.js +37 -0
  87. package/dist/shared/components/layout-editor/grid-guides.js +142 -0
  88. package/dist/shared/components/layout-editor/inspector/BehaviourSettings.js +402 -0
  89. package/dist/shared/components/layout-editor/inspector/BulkInspector.js +61 -57
  90. package/dist/shared/components/layout-editor/inspector/GroupInspector.js +247 -151
  91. package/dist/shared/components/layout-editor/inspector/Inspector.js +176 -155
  92. package/dist/shared/components/layout-editor/inspector/LookTab.js +167 -116
  93. package/dist/shared/components/layout-editor/inspector/PickerMisses.js +129 -0
  94. package/dist/shared/components/layout-editor/inspector/PickerTab.js +84 -82
  95. package/dist/shared/components/layout-editor/inspector/RulesTab.js +66 -62
  96. package/dist/shared/components/layout-editor/inspector/kit.js +69 -68
  97. package/dist/shared/components/layout-editor/outputs/OutputsButton.js +254 -0
  98. package/dist/shared/components/layout-editor/outputs/help-sheet.js +154 -0
  99. package/dist/shared/components/layout-editor/outputs/output-api.js +61 -0
  100. package/dist/shared/components/layout-editor/overview/describe-conditions.js +6 -0
  101. package/dist/shared/components/layout-editor/overview/purpose.js +15 -13
  102. package/dist/shared/components/layout-editor/parity-keys.json.js +1 -1
  103. package/dist/shared/components/layout-editor/restore-piece.js +192 -0
  104. package/dist/shared/components/layout-editor/section-structure.js +241 -0
  105. package/dist/shared/components/layout-editor/settings/EntrySection.js +296 -0
  106. package/dist/shared/components/layout-editor/settings/FormSettings.js +41 -39
  107. package/dist/shared/components/layout-editor/settings/ResolveSettings.js +255 -0
  108. package/dist/shared/components/layout-editor/settings/ToolsSection.js +147 -111
  109. package/dist/shared/components/layout-editor/settings/WhoSection.js +29 -26
  110. package/dist/shared/components/layout-editor/settings/settings-registry.js +114 -17
  111. package/dist/shared/components/layout-editor/staged-api.js +64 -0
  112. package/dist/shared/components/layout-editor/structure-ops.js +81 -77
  113. package/dist/shared/components/layout-editor/testing/TestingPanels.js +65 -60
  114. package/dist/shared/components/layout-editor/testing/testing-model.js +198 -185
  115. package/dist/shared/components/layout-editor/toolbar-kit.js +11 -11
  116. package/dist/shared/components/layout-editor/usage/AbTestSection.js +355 -0
  117. package/dist/shared/components/layout-editor/usage/UsagePanel.js +144 -70
  118. package/dist/shared/components/layout-editor/usage/ab-api.js +86 -0
  119. package/dist/shared/components/layout-editor/usage/suggest-collapse.js +32 -0
  120. package/dist/shared/components/layout-editor/useLayoutDraft.js +25 -24
  121. package/dist/shared/components/notifications/NotificationAnalyticsView.js +148 -77
  122. package/dist/shared/components/panels/ErpFailureBanner.js +18 -17
  123. package/dist/shared/components/panels/ExternalRequestsChip.js +63 -62
  124. package/dist/shared/components/pipeline/PipelineEditorView.js +106 -104
  125. package/dist/shared/components/profile/AgentsPanel.js +479 -0
  126. package/dist/shared/components/queue/QueueWorklist.js +1026 -1040
  127. package/dist/shared/components/support/SupportAnalytics.js +171 -0
  128. package/dist/shared/components/support/SupportView.js +75 -73
  129. package/dist/shared/lib/background-runs.js +150 -0
  130. package/dist/shared/lib/delivery-ack.js +9 -0
  131. package/dist/shared/lib/entry-badge-style.js +13 -0
  132. package/dist/shared/lib/entry-config.js +71 -0
  133. package/dist/shared/lib/form-sections.js +64 -0
  134. package/dist/shared/lib/form-structure.js +99 -0
  135. package/dist/shared/lib/form-usage-beacon.js +101 -52
  136. package/dist/shared/lib/jobs-tray.js +25 -23
  137. package/dist/shared/lib/keyset-pager.js +37 -0
  138. package/dist/shared/lib/layout-ops.js +84 -82
  139. package/dist/shared/lib/layout-resolve.js +113 -0
  140. package/dist/shared/lib/placement-behaviour.js +144 -0
  141. package/dist/shared/lib/prefetch.js +149 -0
  142. package/dist/shared/lib/presence-hooks.js +199 -0
  143. package/dist/shared/lib/record-outbox.js +82 -81
  144. package/dist/shared/lib/replay-socket.js +93 -0
  145. package/dist/shared/lib/request-gate.js +51 -50
  146. package/dist/shared/lib/room-gaps.js +96 -0
  147. package/dist/shared/lib/search-log.js +27 -0
  148. package/dist/shared/lib/socket-realtime.js +101 -80
  149. package/dist/shared/lib/worker-socket.js +200 -0
  150. package/package.json +1 -1
@@ -1,9 +1,10 @@
1
1
  import { TABLE_FORM_GROUP_KEYS as Z } from "../../../lib/layout-ops.js";
2
2
  import { parseVisibleWhen as oe, matchesVisibleWhen as le } from "../../../lib/visible-when.js";
3
3
  import { SYSTEM_FIELDS as K } from "../../item-edit/helpers.js";
4
- import { fieldAccessForRole as re } from "../preview/preview-model.js";
5
- const H = 5, ke = 40;
6
- function q(t) {
4
+ import { deferredSections as re } from "../../item-edit/lazy-sections.js";
5
+ import { fieldAccessForRole as de } from "../preview/preview-model.js";
6
+ const H = 5, we = 40;
7
+ function L(t) {
7
8
  let n = t;
8
9
  if (typeof n == "string")
9
10
  try {
@@ -13,79 +14,79 @@ function q(t) {
13
14
  }
14
15
  return n && typeof n == "object" && !Array.isArray(n) ? n : null;
15
16
  }
16
- function ve(t) {
17
+ function Se(t) {
17
18
  var a;
18
- const n = q((a = q(t)) == null ? void 0 : a.testing), l = [];
19
+ const n = L((a = L(t)) == null ? void 0 : a.testing), r = [];
19
20
  if (Array.isArray(n == null ? void 0 : n.records))
20
- for (const r of n.records) {
21
- if ((r == null ? void 0 : r.item) == null || r.item === "") continue;
22
- const d = { item: String(r.item), role_id: r.role_id ? String(r.role_id) : null };
23
- l.some((c) => de(c, d)) || l.push(d);
21
+ for (const l of n.records) {
22
+ if ((l == null ? void 0 : l.item) == null || l.item === "") continue;
23
+ const d = { item: String(l.item), role_id: l.role_id ? String(l.role_id) : null };
24
+ r.some((u) => ae(u, d)) || r.push(d);
24
25
  }
25
26
  const s = Number(n == null ? void 0 : n.cost_limit);
26
27
  return {
27
- records: l.slice(0, H),
28
+ records: r.slice(0, H),
28
29
  cost_limit: Number.isFinite(s) && s > 0 ? Math.round(s) : null
29
30
  };
30
31
  }
31
- const de = (t, n) => t.item === n.item && (t.role_id ?? "").toUpperCase() === (n.role_id ?? "").toUpperCase();
32
- function X(t, n, l) {
33
- const s = { ...q(t) ?? {} };
34
- return l == null ? delete s[n] : s[n] = l, Object.keys(s).length > 0 ? s : null;
32
+ const ae = (t, n) => t.item === n.item && (t.role_id ?? "").toUpperCase() === (n.role_id ?? "").toUpperCase();
33
+ function X(t, n, r) {
34
+ const s = { ...L(t) ?? {} };
35
+ return r == null ? delete s[n] : s[n] = r, Object.keys(s).length > 0 ? s : null;
35
36
  }
36
- function we(t, n) {
37
- const l = n.records.length === 0 && n.cost_limit == null;
37
+ function $e(t, n) {
38
+ const r = n.records.length === 0 && n.cost_limit == null;
38
39
  return {
39
40
  conditions: X(
40
41
  t,
41
42
  "testing",
42
- l ? null : {
43
+ r ? null : {
43
44
  records: n.records.slice(0, H),
44
45
  ...n.cost_limit != null ? { cost_limit: n.cost_limit } : {}
45
46
  }
46
47
  )
47
48
  };
48
49
  }
49
- function $e(t, n) {
50
+ function Ae(t, n) {
50
51
  return { conditions: X(t, "role_ids", n.length ? n : null) };
51
52
  }
52
- const M = (t) => new Map(t.groups.map((n) => [n.key, n]));
53
+ const N = (t) => new Map(t.groups.map((n) => [n.key, n]));
53
54
  function Q(t, n) {
54
55
  if (!n || t == null || t === "") return !1;
55
56
  try {
56
- const l = typeof t == "string" ? JSON.parse(t) : t;
57
- return Array.isArray(l) && l.some((s) => String(s).toUpperCase() === n.toUpperCase());
57
+ const r = typeof t == "string" ? JSON.parse(t) : t;
58
+ return Array.isArray(r) && r.some((s) => String(s).toUpperCase() === n.toUpperCase());
58
59
  } catch {
59
60
  return !1;
60
61
  }
61
62
  }
62
63
  const Y = (t, n) => t == null ? void 0 : t[n];
63
- function L(t, n, l) {
64
+ function M(t, n, r) {
64
65
  const s = new Map(n.groups.map((d) => [d.id, d]));
65
66
  let a = t;
66
- const r = /* @__PURE__ */ new Set();
67
+ const l = /* @__PURE__ */ new Set();
67
68
  for (; a; ) {
68
69
  if (a.type === "tab" && a.container_id == null)
69
- return le(a.visible_when, l);
70
- if (a.container_id == null || r.has(a.id)) return !0;
71
- r.add(a.id), a = s.get(a.container_id);
70
+ return le(a.visible_when, r);
71
+ if (a.container_id == null || l.has(a.id)) return !0;
72
+ l.add(a.id), a = s.get(a.container_id);
72
73
  }
73
74
  return !0;
74
75
  }
75
- function Se(t, n, l) {
76
- const s = M(t), a = l && !l.role.admin_access ? re(l, t) : null, r = /* @__PURE__ */ new Map();
76
+ function Oe(t, n, r) {
77
+ const s = N(t), a = r && !r.role.admin_access ? de(r, t) : null, l = /* @__PURE__ */ new Map();
77
78
  for (const d of t.assignments) {
78
79
  if (d.field.startsWith("__") || d.is_visible === !1 || d.is_visible === 0 || ee(d.overrides)) continue;
79
- const c = d.group_key ?? null;
80
- if (c != null && c !== "__header__") {
81
- if (Z.includes(c)) continue;
82
- const i = s.get(c);
83
- if (!i || !L(i, t, n)) continue;
80
+ const u = d.group_key ?? null;
81
+ if (u != null && u !== "__header__") {
82
+ if (Z.includes(u)) continue;
83
+ const _ = s.get(u);
84
+ if (!_ || !M(_, t, n)) continue;
84
85
  }
85
- let _ = "editable";
86
- l && !l.role.admin_access && (_ = (a == null ? void 0 : a.get(d.field)) ?? "hidden"), _ !== "hidden" && r.get(d.field) !== "editable" && r.set(d.field, _);
86
+ let p = "editable";
87
+ r && !r.role.admin_access && (p = (a == null ? void 0 : a.get(d.field)) ?? "hidden"), p !== "hidden" && l.get(d.field) !== "editable" && l.set(d.field, p);
87
88
  }
88
- return r;
89
+ return l;
89
90
  }
90
91
  function ee(t) {
91
92
  if (t == null || t === "") return !1;
@@ -96,67 +97,67 @@ function ee(t) {
96
97
  return !1;
97
98
  }
98
99
  }
99
- function Ae(...t) {
100
+ function Te(...t) {
100
101
  const n = /* @__PURE__ */ new Set();
101
- for (const l of t)
102
- for (const s of (l == null ? void 0 : l.groups) ?? [])
102
+ for (const r of t)
103
+ for (const s of (r == null ? void 0 : r.groups) ?? [])
103
104
  if (s.type === "tab" && s.container_id == null)
104
105
  for (const a of oe(s.visible_when))
105
106
  a.field && /^[A-Za-z_][A-Za-z0-9_]*$/.test(a.field) && n.add(a.field);
106
107
  return [...n];
107
108
  }
108
- function ae(t, n = 3) {
109
+ function fe(t, n = 3) {
109
110
  return t.length <= 1 ? t[0] ?? "" : t.length <= n ? `${t.slice(0, -1).join(", ")} and ${t[t.length - 1]}` : `${t.slice(0, n).join(", ")} and ${t.length - n} more`;
110
111
  }
111
- const O = (t) => t ? `“${t.name}”` : "no form";
112
- function Oe(t, n, l) {
113
- var p, m;
114
- const s = [], a = ((p = t.form) == null ? void 0 : p.layout_id) ?? null, r = ((m = n.form) == null ? void 0 : m.layout_id) ?? null;
115
- if (a !== r)
116
- return t.view && !n.view ? s.push({ kind: "form", text: `lands on another form: ${O(n.form)}` }) : !t.view && n.view ? s.push({ kind: "form", text: `now opens on this form (was ${O(t.form)})` }) : s.push({
112
+ const T = (t) => t ? `“${t.name}”` : "no form";
113
+ function Ee(t, n, r) {
114
+ var o, h;
115
+ const s = [], a = ((o = t.form) == null ? void 0 : o.layout_id) ?? null, l = ((h = n.form) == null ? void 0 : h.layout_id) ?? null;
116
+ if (a !== l)
117
+ return t.view && !n.view ? s.push({ kind: "form", text: `lands on another form: ${T(n.form)}` }) : !t.view && n.view ? s.push({ kind: "form", text: `now opens on this form (was ${T(t.form)})` }) : s.push({
117
118
  kind: "form",
118
- text: `moves from ${O(t.form)} to ${O(n.form)}`
119
+ text: `moves from ${T(t.form)} to ${T(n.form)}`
119
120
  }), s;
120
121
  if (!t.view || !n.view) return s;
121
- const d = [], c = [], _ = [], i = [];
122
- for (const [g, b] of t.view) {
123
- const k = n.view.get(g);
124
- k ? b === "editable" && k === "readonly" ? _.push(g) : b === "readonly" && k === "editable" && i.push(g) : d.push(g);
122
+ const d = [], u = [], p = [], _ = [];
123
+ for (const [c, m] of t.view) {
124
+ const k = n.view.get(c);
125
+ k ? m === "editable" && k === "readonly" ? p.push(c) : m === "readonly" && k === "editable" && _.push(c) : d.push(c);
125
126
  }
126
- for (const g of n.view.keys()) t.view.has(g) || c.push(g);
127
- const u = (g) => ae(g.map(l));
127
+ for (const c of n.view.keys()) t.view.has(c) || u.push(c);
128
+ const y = (c) => fe(c.map(r));
128
129
  return d.length && s.push({
129
130
  kind: "lost",
130
131
  fields: d,
131
- text: d.length === 1 ? `loses the ${u(d)} field` : `loses ${u(d)} fields`
132
- }), c.length && s.push({
132
+ text: d.length === 1 ? `loses the ${y(d)} field` : `loses ${y(d)} fields`
133
+ }), u.length && s.push({
133
134
  kind: "gained",
134
- fields: c,
135
- text: c.length === 1 ? `gains the ${u(c)} field` : `gains ${u(c)} fields`
136
- }), _.length && s.push({
135
+ fields: u,
136
+ text: u.length === 1 ? `gains the ${y(u)} field` : `gains ${y(u)} fields`
137
+ }), p.length && s.push({
137
138
  kind: "readonly",
138
- fields: _,
139
- text: `can no longer edit ${u(_)}`
140
- }), i.length && s.push({ kind: "editable", fields: i, text: `can now edit ${u(i)}` }), s;
139
+ fields: p,
140
+ text: `can no longer edit ${y(p)}`
141
+ }), _.length && s.push({ kind: "editable", fields: _, text: `can now edit ${y(_)}` }), s;
141
142
  }
142
- const fe = (t) => t != null && t !== "" && !(Array.isArray(t) && t.length === 0);
143
- function Te(t) {
143
+ const ce = (t) => t != null && t !== "" && !(Array.isArray(t) && t.length === 0);
144
+ function qe(t) {
144
145
  var D, x, B;
145
- const { layout: n, rows: l, access: s, thisLayoutId: a } = t, r = n.layout, d = s.role && !s.role.admin_access ? s.role.id : null, c = [], _ = [], i = [], u = (e) => {
146
+ const { layout: n, rows: r, access: s, thisLayoutId: a } = t, l = n.layout, d = s.role && !s.role.admin_access ? s.role.id : null, u = [], p = [], _ = [], y = (e) => {
146
147
  var f;
147
- const o = l.find((h) => h.field === e);
148
- return (o == null ? void 0 : o.label) || ((f = t.label) == null ? void 0 : f.call(t, e)) || e;
149
- }, p = {}, m = r == null ? void 0 : r.default_values;
150
- for (const [e, o] of Object.entries(m ?? {})) p[e] = o;
151
- for (const [e, o] of Object.entries(t.values ?? {})) p[e] = o;
152
- const g = (e) => fe(p[e.field]) || !!e.default_formula || s.column_defaults.some((o) => o.toLowerCase() === e.field.toLowerCase());
153
- if (s.new_record_form && s.new_record_form.layout_id !== a && c.push(
148
+ const i = r.find((g) => g.field === e);
149
+ return (i == null ? void 0 : i.label) || ((f = t.label) == null ? void 0 : f.call(t, e)) || e;
150
+ }, o = {}, h = l == null ? void 0 : l.default_values;
151
+ for (const [e, i] of Object.entries(h ?? {})) o[e] = i;
152
+ for (const [e, i] of Object.entries(t.values ?? {})) o[e] = i;
153
+ const c = (e) => ce(o[e.field]) || !!e.default_formula || s.column_defaults.some((i) => i.toLowerCase() === e.field.toLowerCase());
154
+ if (s.new_record_form && s.new_record_form.layout_id !== a && u.push(
154
155
  `New records open on “${s.new_record_form.name}” for ${((D = s.role) == null ? void 0 : D.name) ?? "administrators"} unless they pick this form.`
155
156
  ), !s.role_may_open)
156
157
  return {
157
- steps: i,
158
- skipped: _,
159
- notes: c,
158
+ steps: _,
159
+ skipped: p,
160
+ notes: u,
160
161
  blocker: {
161
162
  step: -1,
162
163
  where: "Opening the form",
@@ -165,35 +166,35 @@ function Te(t) {
165
166
  };
166
167
  if (!s.can_create)
167
168
  return {
168
- steps: i,
169
- skipped: _,
170
- notes: c,
169
+ steps: _,
170
+ skipped: p,
171
+ notes: u,
171
172
  blocker: {
172
173
  step: -1,
173
174
  where: "Opening the form",
174
175
  reason: `${((B = s.role) == null ? void 0 : B.name) ?? "This role"} may not create records in this collection.`
175
176
  }
176
177
  };
177
- const b = M(n), k = new Set(s.hidden_fields), v = s.create_fields ? new Set(s.create_fields) : null, y = (e, o) => e.sort - o.sort, w = new Map(n.groups.map((e) => [e.id, e])), T = n.groups.filter((e) => e.type === "tab" && e.container_id == null).sort(y), N = n.groups.filter((e) => e.type === "container").sort(y).flatMap(
178
- (e) => n.groups.filter((o) => o.type === "tab" && o.container_id === e.id).sort(y)
179
- ), R = T.length > 0 && (r == null ? void 0 : r.tab_mode) === "steps", C = R && !!(r != null && r.validate_before_next), te = (e) => {
180
- let o = e ? b.get(e) : void 0;
178
+ const m = N(n), k = new Set(s.hidden_fields), w = s.create_fields ? new Set(s.create_fields) : null, v = (e, i) => e.sort - i.sort, E = new Map(n.groups.map((e) => [e.id, e])), b = n.groups.filter((e) => e.type === "tab" && e.container_id == null).sort(v), S = n.groups.filter((e) => e.type === "container").sort(v).flatMap(
179
+ (e) => n.groups.filter((i) => i.type === "tab" && i.container_id === e.id).sort(v)
180
+ ), R = b.length > 0 && (l == null ? void 0 : l.tab_mode) === "steps", C = R && !!(l != null && l.validate_before_next), te = (e) => {
181
+ let i = e ? m.get(e) : void 0;
181
182
  const f = /* @__PURE__ */ new Set();
182
- for (; o; ) {
183
- if (o.type === "tab") return o.key;
184
- if (o.container_id == null || f.has(o.id)) return null;
185
- f.add(o.id), o = w.get(o.container_id);
183
+ for (; i; ) {
184
+ if (i.type === "tab") return i.key;
185
+ if (i.container_id == null || f.has(i.id)) return null;
186
+ f.add(i.id), i = E.get(i.container_id);
186
187
  }
187
188
  return null;
188
- }, j = T.length + N.length > 0, ne = j ? [
189
+ }, j = b.length + S.length > 0, ne = j ? [
189
190
  { key: "__general__", label: "General", group: null, validates: C },
190
- ...N.map((e) => ({
191
+ ...S.map((e) => ({
191
192
  key: e.key,
192
193
  label: e.label || e.key,
193
194
  group: e,
194
195
  validates: !1
195
196
  })),
196
- ...T.map((e) => ({
197
+ ...b.map((e) => ({
197
198
  key: e.key,
198
199
  label: e.label || e.key,
199
200
  group: e,
@@ -201,120 +202,120 @@ function Te(t) {
201
202
  }))
202
203
  ] : [{ key: "__form__", label: "The form", group: null, validates: !1 }], U = "__float__", I = (e) => {
203
204
  if (!j) return "__form__";
204
- const o = te(e);
205
- return o || (!e || e === "__header__" ? "__general__" : R ? U : "__general__");
206
- }, E = [], W = /* @__PURE__ */ new Set(), se = (e) => {
207
- var A, J, G, V;
205
+ const i = te(e);
206
+ return i || (!e || e === "__header__" ? "__general__" : R ? U : "__general__");
207
+ }, q = [], W = /* @__PURE__ */ new Set(), se = (e) => {
208
+ var O, z, J, G;
208
209
  if (!e.required || K.has(e.field) || e.field.startsWith("__")) return null;
209
- const o = { field: e.field, label: u(e.field) }, f = e.group_key ? b.get(e.group_key) : void 0;
210
- if (e.hidden) return { ...o, status: "skipped", reason: "hidden on this form" };
210
+ const i = { field: e.field, label: y(e.field) }, f = e.group_key ? m.get(e.group_key) : void 0;
211
+ if (e.hidden) return { ...i, status: "skipped", reason: "hidden on this form" };
211
212
  if (k.has(e.field) || Q(Y(f, "hidden_for_roles"), d))
212
213
  return {
213
- ...o,
214
+ ...i,
214
215
  status: "skipped",
215
- reason: `${((A = s.role) == null ? void 0 : A.name) ?? "the role"} cannot see it`
216
+ reason: `${((O = s.role) == null ? void 0 : O.name) ?? "the role"} cannot see it`
216
217
  };
217
- if (f && !L(f, n, p))
218
+ if (f && !M(f, n, o))
218
219
  return {
219
- ...o,
220
+ ...i,
220
221
  status: "blocked",
221
222
  reason: `its section “${f.label || f.key}” is hidden for these values`
222
223
  };
223
- if (g(e)) return { ...o, status: "prefilled" };
224
- if (v && !v.has(e.field))
225
- return { ...o, status: "blocked", reason: `${(J = s.role) == null ? void 0 : J.name} may not write it` };
224
+ if (c(e)) return { ...i, status: "prefilled" };
225
+ if (w && !w.has(e.field))
226
+ return { ...i, status: "blocked", reason: `${(z = s.role) == null ? void 0 : z.name} may not write it` };
226
227
  if (Q(Y(f, "locked_for_roles"), d))
227
228
  return {
228
- ...o,
229
+ ...i,
229
230
  status: "blocked",
230
- reason: `its section is locked for ${(G = s.role) == null ? void 0 : G.name}`
231
+ reason: `its section is locked for ${(J = s.role) == null ? void 0 : J.name}`
231
232
  };
232
- const h = n.assignments.find(
233
- (z) => z.field === e.field && (z.group_key ?? null) === (e.group_key ?? null)
233
+ const g = n.assignments.find(
234
+ (V) => V.field === e.field && (V.group_key ?? null) === (e.group_key ?? null)
234
235
  );
235
- return d && ce(h == null ? void 0 : h.lock_conditions).includes(d.toUpperCase()) ? { ...o, status: "blocked", reason: `it is locked for ${(V = s.role) == null ? void 0 : V.name}` } : e.readonly ? { ...o, status: "blocked", reason: "it is read-only on this form" } : { ...o, status: "fill" };
236
+ return d && ue(g == null ? void 0 : g.lock_conditions).includes(d.toUpperCase()) ? { ...i, status: "blocked", reason: `it is locked for ${(G = s.role) == null ? void 0 : G.name}` } : e.readonly ? { ...i, status: "blocked", reason: "it is read-only on this form" } : { ...i, status: "fill" };
236
237
  }, $ = /* @__PURE__ */ new Map();
237
- for (const e of l) {
238
+ for (const e of r) {
238
239
  if (e.layout_assigned === !1) {
239
- e.required && !e.hidden && !K.has(e.field) && !e.field.startsWith("__") && _.push({
240
+ e.required && !e.hidden && !K.has(e.field) && !e.field.startsWith("__") && p.push({
240
241
  field: e.field,
241
- label: u(e.field),
242
+ label: y(e.field),
242
243
  status: "skipped",
243
244
  reason: "not on this form"
244
245
  });
245
246
  continue;
246
247
  }
247
- const o = `${e.field}\0${e.group_key ?? ""}`;
248
- if (W.has(o)) continue;
249
- W.add(o);
248
+ const i = `${e.field}\0${e.group_key ?? ""}`;
249
+ if (W.has(i)) continue;
250
+ W.add(i);
250
251
  const f = se(e);
251
252
  if (!f) continue;
252
253
  if (f.status === "skipped") {
253
- _.some((A) => A.field === f.field) || _.push(f);
254
+ p.some((O) => O.field === f.field) || p.push(f);
254
255
  continue;
255
256
  }
256
- const h = I(e.group_key);
257
- h === U ? E.push(f) : $.set(h, [...$.get(h) ?? [], f]);
257
+ const g = I(e.group_key);
258
+ g === U ? q.push(f) : $.set(g, [...$.get(g) ?? [], f]);
258
259
  }
259
260
  const F = new Set(
260
- [...$.values(), E].flat().filter((e) => e.status !== "blocked").map((e) => e.field)
261
+ [...$.values(), q].flat().filter((e) => e.status !== "blocked").map((e) => e.field)
261
262
  ), ie = new Set(
262
263
  n.assignments.filter((e) => !e.field.startsWith("__") && e.is_visible !== !1 && e.is_visible !== 0).map((e) => I(e.group_key))
263
264
  ), P = /* @__PURE__ */ new Set();
264
265
  for (const e of ne) {
265
- const o = e.group ? !L(e.group, n, p) : !1, f = ($.get(e.key) ?? []).map(
266
- (h) => h.status === "blocked" && F.has(h.field) ? { ...h, status: "fill", reason: void 0 } : o && h.status !== "prefilled" ? {
267
- ...h,
266
+ const i = e.group ? !M(e.group, n, o) : !1, f = ($.get(e.key) ?? []).map(
267
+ (g) => g.status === "blocked" && F.has(g.field) ? { ...g, status: "fill", reason: void 0 } : i && g.status !== "prefilled" ? {
268
+ ...g,
268
269
  status: "blocked",
269
270
  reason: `its step “${e.label}” is hidden for these values`
270
- } : h
271
+ } : g
271
272
  );
272
- e.key === "__general__" && !ie.has(e.key) || (i.push({ key: e.key, label: e.label, hidden: o, fields: f }), e.validates && P.add(e.key));
273
+ e.key === "__general__" && !ie.has(e.key) || (_.push({ key: e.key, label: e.label, hidden: i, fields: f }), e.validates && P.add(e.key));
273
274
  }
274
- for (let e = 0; e < i.length; e++) {
275
- const o = i[e];
276
- if (o.hidden) continue;
277
- const f = o.fields.find((h) => h.status === "blocked");
278
- if (f && P.has(o.key) && e < i.length - 1)
275
+ for (let e = 0; e < _.length; e++) {
276
+ const i = _[e];
277
+ if (i.hidden) continue;
278
+ const f = i.fields.find((g) => g.status === "blocked");
279
+ if (f && P.has(i.key) && e < _.length - 1)
279
280
  return {
280
- steps: i,
281
- skipped: _,
282
- notes: c,
281
+ steps: _,
282
+ skipped: p,
283
+ notes: u,
283
284
  blocker: {
284
285
  step: e,
285
- where: `Next on “${o.label}”`,
286
+ where: `Next on “${i.label}”`,
286
287
  field: f.field,
287
288
  reason: `${f.label} is required, but ${f.reason}.`
288
289
  }
289
290
  };
290
291
  }
291
- const S = [...i.flatMap((e) => e.fields), ...E].find(
292
+ const A = [..._.flatMap((e) => e.fields), ...q].find(
292
293
  (e) => e.status === "blocked" && !F.has(e.field)
293
294
  ) ?? null;
294
- return S ? {
295
- steps: i,
296
- skipped: _,
297
- notes: c,
295
+ return A ? {
296
+ steps: _,
297
+ skipped: p,
298
+ notes: u,
298
299
  blocker: {
299
- step: i.length,
300
+ step: _.length,
300
301
  where: "Save",
301
- field: S.field,
302
- reason: `${S.label} is required, but ${S.reason}.`
302
+ field: A.field,
303
+ reason: `${A.label} is required, but ${A.reason}.`
303
304
  }
304
- } : { steps: i, skipped: _, notes: c, blocker: null };
305
+ } : { steps: _, skipped: p, notes: u, blocker: null };
305
306
  }
306
- function ce(t) {
307
+ function ue(t) {
307
308
  if (t == null || t === "") return [];
308
309
  try {
309
310
  const n = typeof t == "string" ? JSON.parse(t) : t;
310
311
  return Array.isArray(n) ? n.flatMap(
311
- (l) => (l == null ? void 0 : l.type) === "role" && Array.isArray(l.role_ids) ? l.role_ids.map((s) => String(s).toUpperCase()) : []
312
+ (r) => (r == null ? void 0 : r.type) === "role" && Array.isArray(r.role_ids) ? r.role_ids.map((s) => String(s).toUpperCase()) : []
312
313
  ) : [];
313
314
  } catch {
314
315
  return [];
315
316
  }
316
317
  }
317
- const ue = 5, _e = /* @__PURE__ */ new Set(["inline-table", "inline-grid", "list-o2m", "relation-list"]), pe = {
318
+ const _e = 5, pe = /* @__PURE__ */ new Set(["inline-table", "inline-grid", "list-o2m", "relation-list"]), he = {
318
319
  __pipeline__: 2,
319
320
  __tasks__: 1,
320
321
  __comments__: 1,
@@ -323,7 +324,7 @@ const ue = 5, _e = /* @__PURE__ */ new Set(["inline-table", "inline-grid", "list
323
324
  __related_records__: 1,
324
325
  __owners__: 1,
325
326
  __pdf__: 0
326
- }, he = {
327
+ }, me = {
327
328
  __pipeline__: "Workflow",
328
329
  __tasks__: "Tasks",
329
330
  __comments__: "Comments",
@@ -333,61 +334,73 @@ const ue = 5, _e = /* @__PURE__ */ new Set(["inline-table", "inline-grid", "list
333
334
  __owners__: "Owners",
334
335
  __pdf__: "PDF"
335
336
  };
336
- function Ee(t) {
337
- const { layout: n, rows: l, relations: s, collection: a } = t, r = [
338
- { kind: "base", key: "__base__", label: "The record page itself", requests: ue }
339
- ], d = M(n), c = (i, u) => l.find((p) => p.field === i && (p.group_key ?? null) === u) ?? l.find((p) => p.field === i);
340
- for (const i of n.assignments) {
341
- if (i.is_visible === !1 || i.is_visible === 0) continue;
342
- const u = i.group_key ?? null;
343
- if (u && Z.includes(u) || u && u !== "__header__" && !d.has(u)) continue;
344
- const p = `${i.field}\0${u ?? ""}`;
345
- if (i.widget_id != null) {
346
- r.push({
337
+ function Le(t) {
338
+ const { layout: n, rows: r, relations: s, collection: a } = t, l = [
339
+ { kind: "base", key: "__base__", label: "The record page itself", requests: _e }
340
+ ], d = N(n), u = (o, h) => r.find((c) => c.field === o && (c.group_key ?? null) === h) ?? r.find((c) => c.field === o);
341
+ for (const o of n.assignments) {
342
+ if (o.is_visible === !1 || o.is_visible === 0) continue;
343
+ const h = o.group_key ?? null;
344
+ if (h && Z.includes(h) || h && h !== "__header__" && !d.has(h)) continue;
345
+ const c = `${o.field}\0${h ?? ""}`;
346
+ if (o.widget_id != null) {
347
+ l.push({
347
348
  kind: "widget",
348
- key: p,
349
- label: i.label_override || `Widget ${i.widget_id}`,
349
+ key: c,
350
+ label: o.label_override || `Widget ${o.widget_id}`,
350
351
  requests: 1
351
352
  });
352
353
  continue;
353
354
  }
354
- if (i.field.startsWith("__")) {
355
- const y = /^__ext_/.test(i.field), w = y ? 1 : pe[i.field] ?? 0;
356
- w > 0 && r.push({
357
- kind: y ? "widget" : "panel",
358
- key: p,
359
- label: he[i.field] ?? i.field.replace(/^__ext_|__$/g, ""),
360
- requests: w
355
+ if (o.field.startsWith("__")) {
356
+ const b = /^__ext_/.test(o.field), S = b ? 1 : he[o.field] ?? 0;
357
+ S > 0 && l.push({
358
+ kind: b ? "widget" : "panel",
359
+ key: c,
360
+ label: me[o.field] ?? o.field.replace(/^__ext_|__$/g, ""),
361
+ requests: S
361
362
  });
362
363
  continue;
363
364
  }
364
- const m = c(i.field, u);
365
- if (m != null && m.hidden || ee(i.overrides)) continue;
366
- const g = i.label_override || (m == null ? void 0 : m.label) || i.field;
367
- if (i.field.includes(".")) {
368
- r.push({ kind: "query", key: p, label: g, requests: 1 });
365
+ const m = u(o.field, h);
366
+ if (m != null && m.hidden || ee(o.overrides)) continue;
367
+ const k = o.label_override || (m == null ? void 0 : m.label) || o.field;
368
+ if (o.field.includes(".")) {
369
+ l.push({ kind: "query", key: c, label: k, requests: 1 });
369
370
  continue;
370
371
  }
371
- const b = (m == null ? void 0 : m.interface) ?? "", k = s.find((y) => y.one_collection === a && y.one_field === i.field), v = s.some((y) => y.many_collection === a && y.many_field === i.field);
372
- _e.has(b) || k && !k.junction_field && b !== "files-m2m" ? r.push({ kind: "grid", key: p, label: g, requests: 3 }) : k || v || /user|file|m2o|m2m/.test(b) ? r.push({ kind: "picker", key: p, label: g, requests: 1 }) : m != null && m.remote_options_config && r.push({ kind: "query", key: p, label: g, requests: 1 });
372
+ const w = (m == null ? void 0 : m.interface) ?? "", v = s.find((b) => b.one_collection === a && b.one_field === o.field), E = s.some((b) => b.many_collection === a && b.many_field === o.field);
373
+ pe.has(w) || v && !v.junction_field && w !== "files-m2m" ? l.push({ kind: "grid", key: c, label: k, requests: 3 }) : v || E || /user|file|m2o|m2m/.test(w) ? l.push({ kind: "picker", key: c, label: k, requests: 1 }) : m != null && m.remote_options_config && l.push({ kind: "query", key: c, label: k, requests: 1 });
373
374
  }
375
+ const p = re(n, /* @__PURE__ */ new Set()).groups;
376
+ if (p.size > 0)
377
+ for (const o of l) {
378
+ const h = o.key.split("\0")[1] ?? "";
379
+ h && p.has(h) && (o.deferred = !0);
380
+ }
374
381
  const _ = { picker: 0, grid: 0, widget: 0, panel: 0, query: 0 };
375
- for (const i of r) i.kind !== "base" && _[i.kind]++;
376
- return { total: r.reduce((i, u) => i + u.requests, 0), items: r, counts: _ };
382
+ for (const o of l) o.kind !== "base" && !o.deferred && _[o.kind]++;
383
+ const y = (o) => o.reduce((h, c) => h + c.requests, 0);
384
+ return {
385
+ total: y(l.filter((o) => !o.deferred)),
386
+ deferred: y(l.filter((o) => o.deferred)),
387
+ items: l,
388
+ counts: _
389
+ };
377
390
  }
378
391
  export {
379
- ue as BASE_REQUESTS,
380
- ke as DEFAULT_COST_LIMIT,
392
+ _e as BASE_REQUESTS,
393
+ we as DEFAULT_COST_LIMIT,
381
394
  H as MAX_PINNED,
382
- Oe as compareOutcomes,
383
- Ae as conditionFields,
384
- Ee as formCost,
385
- Se as formView,
386
- L as groupShown,
387
- ae as nameList,
388
- ve as readTesting,
389
- $e as roleIdsPatch,
390
- de as samePin,
391
- we as testingPatch,
392
- Te as walkthrough
395
+ Ee as compareOutcomes,
396
+ Te as conditionFields,
397
+ Le as formCost,
398
+ Oe as formView,
399
+ M as groupShown,
400
+ fe as nameList,
401
+ Se as readTesting,
402
+ Ae as roleIdsPatch,
403
+ ae as samePin,
404
+ $e as testingPatch,
405
+ qe as walkthrough
393
406
  };