@ai-matrx/records-ui 0.58.0 → 0.60.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
@@ -262,11 +262,17 @@ function recordName(document2, titleKey, fallback = "Untitled") {
262
262
  );
263
263
  for (const key of keys) {
264
264
  const value = data[key];
265
- if (typeof value === "string" && value.trim() !== "") return value.trim();
265
+ if (typeof value === "string" && value.trim() !== "" && !looksLikeId(value.trim())) {
266
+ return value.trim();
267
+ }
266
268
  if (typeof value === "number") return String(value);
267
269
  }
268
270
  return fallback;
269
271
  }
272
+ var RECORD_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
273
+ function looksLikeId(value) {
274
+ return typeof value === "string" && RECORD_ID.test(value.trim());
275
+ }
270
276
  function rowName(row, titleKey, fallback = "Untitled") {
271
277
  return recordName(row?.document, titleKey, fallback);
272
278
  }
@@ -4788,12 +4794,13 @@ function ValueOnTheOtherSide({
4788
4794
  }
4789
4795
 
4790
4796
  // src/StageRules.tsx
4791
- import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo12, useState as useState14 } from "react";
4797
+ import { useCallback as useCallback8, useEffect as useEffect8, useMemo as useMemo12, useState as useState15 } from "react";
4792
4798
  import { useFields as useFields6, useRecordsClient as useRecordsClient11, useTable as useTable5 } from "@ai-matrx/records/react";
4793
- import { BasicInput as BasicInput6, BasicTextarea as BasicTextarea3, Button as Button12, Separator as Separator5, Skeleton as Skeleton3, cn as cn13 } from "@ai-matrx/design-system";
4799
+ import { BasicInput as BasicInput6, BasicTextarea as BasicTextarea3, Button as Button13, Separator as Separator5, Skeleton as Skeleton3, cn as cn13 } from "@ai-matrx/design-system";
4794
4800
 
4795
4801
  // src/Condition.tsx
4796
- import { BasicInput as BasicInput5 } from "@ai-matrx/design-system";
4802
+ import { useState as useState14 } from "react";
4803
+ import { BasicInput as BasicInput5, Button as Button12 } from "@ai-matrx/design-system";
4797
4804
  import { Fragment as Fragment8, jsx as jsx17, jsxs as jsxs13 } from "react/jsx-runtime";
4798
4805
  var CONDITION_OPS = [
4799
4806
  { op: "eq", label: "is" },
@@ -4922,6 +4929,155 @@ function ConditionRow({ lead, expr, fields, onChange, emptyLabel = "always", cla
4922
4929
  ] }) : null
4923
4930
  ] });
4924
4931
  }
4932
+ var JOINERS = [
4933
+ { op: "and", label: "All of these are true" },
4934
+ { op: "or", label: "Any of these is true" }
4935
+ ];
4936
+ function asNode(expr) {
4937
+ return expr && typeof expr === "object" && !Array.isArray(expr) ? expr : null;
4938
+ }
4939
+ function groupOf(expr) {
4940
+ const node = asNode(expr);
4941
+ if (!node) return null;
4942
+ const op = node["op"];
4943
+ if (op !== "and" && op !== "or") return null;
4944
+ const args = Array.isArray(node["args"]) ? node["args"] : [];
4945
+ return { op, args };
4946
+ }
4947
+ function conditionIsDrawable(expr, depth = 1) {
4948
+ if (expr === null || expr === void 0) return true;
4949
+ const group = groupOf(expr);
4950
+ if (!group) return conditionIsSimple(expr);
4951
+ if (group.args.length === 0) return true;
4952
+ return group.args.every((arg) => {
4953
+ const node = asNode(arg);
4954
+ if (node === null) return false;
4955
+ return conditionIsSimple(node) || depth > 0 && conditionIsDrawable(node, depth - 1);
4956
+ });
4957
+ }
4958
+ function clausesOf(expr) {
4959
+ const group = groupOf(expr);
4960
+ if (group) return group;
4961
+ return { op: "and", args: expr === null || expr === void 0 ? [] : [expr] };
4962
+ }
4963
+ function writeGroup(op, args) {
4964
+ const kept = args.filter((a) => a !== null && a !== void 0);
4965
+ if (kept.length === 0) return null;
4966
+ if (kept.length === 1) return kept[0];
4967
+ return { op, args: kept };
4968
+ }
4969
+ function ConditionGroup({
4970
+ lead,
4971
+ expr,
4972
+ fields,
4973
+ onChange,
4974
+ emptyLabel = "always",
4975
+ allowNesting = true,
4976
+ className
4977
+ }) {
4978
+ const { op, args } = clausesOf(expr);
4979
+ const [drafting, setDrafting] = useState14(false);
4980
+ const replaceAt = (index, next) => {
4981
+ const nextArgs = args.slice();
4982
+ if (next === null || next === void 0) nextArgs.splice(index, 1);
4983
+ else nextArgs[index] = next;
4984
+ onChange(writeGroup(op, nextArgs));
4985
+ };
4986
+ const joinWord = (index) => index === 0 ? lead : op === "and" ? "and" : "or";
4987
+ return /* @__PURE__ */ jsxs13("div", { className: className ?? "flex flex-col gap-1 text-xs", "data-testid": "condition-group", children: [
4988
+ args.length > 1 ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
4989
+ /* @__PURE__ */ jsx17("span", { className: "text-muted-foreground", children: lead }),
4990
+ /* @__PURE__ */ jsx17(
4991
+ "select",
4992
+ {
4993
+ "aria-label": "How these conditions are joined",
4994
+ className: "h-8 rounded border bg-background px-1 text-xs",
4995
+ value: op,
4996
+ onChange: (e) => onChange(writeGroup(e.target.value, args)),
4997
+ children: JOINERS.map((j) => /* @__PURE__ */ jsx17("option", { value: j.op, children: j.label }, j.op))
4998
+ }
4999
+ )
5000
+ ] }) : null,
5001
+ args.length === 0 ? /* @__PURE__ */ jsx17(
5002
+ ConditionRow,
5003
+ {
5004
+ lead,
5005
+ emptyLabel,
5006
+ expr: null,
5007
+ fields,
5008
+ onChange: (next) => onChange(next)
5009
+ }
5010
+ ) : args.map((arg, index) => {
5011
+ const nested = groupOf(arg);
5012
+ const key = `clause-${index}`;
5013
+ if (nested && allowNesting) {
5014
+ return /* @__PURE__ */ jsx17("div", { className: "ml-4 rounded border border-dashed p-1", "data-testid": "condition-nested-group", children: /* @__PURE__ */ jsx17(
5015
+ ConditionGroup,
5016
+ {
5017
+ lead: op === "and" ? "and also, any of:" : "or, all of:",
5018
+ expr: arg,
5019
+ fields,
5020
+ onChange: (next) => replaceAt(index, next),
5021
+ emptyLabel,
5022
+ allowNesting: false
5023
+ }
5024
+ ) }, key);
5025
+ }
5026
+ return /* @__PURE__ */ jsx17(
5027
+ ConditionRow,
5028
+ {
5029
+ lead: args.length > 1 ? joinWord(index) : lead,
5030
+ emptyLabel,
5031
+ expr: arg,
5032
+ fields,
5033
+ onChange: (next) => replaceAt(index, next)
5034
+ },
5035
+ key
5036
+ );
5037
+ }),
5038
+ drafting ? /* @__PURE__ */ jsx17(
5039
+ ConditionRow,
5040
+ {
5041
+ lead: op === "and" ? "and" : "or",
5042
+ emptyLabel,
5043
+ expr: null,
5044
+ fields,
5045
+ onChange: (next) => {
5046
+ if (next === null) return;
5047
+ setDrafting(false);
5048
+ onChange(writeGroup(op, [...args, next]));
5049
+ }
5050
+ }
5051
+ ) : null,
5052
+ args.length > 0 && !drafting ? /* @__PURE__ */ jsxs13("div", { className: "flex items-center gap-1", children: [
5053
+ /* @__PURE__ */ jsx17(
5054
+ Button12,
5055
+ {
5056
+ size: "sm",
5057
+ variant: "ghost",
5058
+ className: "h-6 px-1 text-xs",
5059
+ "data-testid": "condition-add-clause",
5060
+ onClick: () => setDrafting(true),
5061
+ children: "Add another condition"
5062
+ }
5063
+ ),
5064
+ allowNesting && args.length > 1 && !args.some((a) => groupOf(a) !== null) ? /* @__PURE__ */ jsx17(
5065
+ Button12,
5066
+ {
5067
+ size: "sm",
5068
+ variant: "ghost",
5069
+ className: "h-6 px-1 text-xs",
5070
+ "data-testid": "condition-add-group",
5071
+ onClick: () => replaceAt(args.length - 1, {
5072
+ op: op === "and" ? "or" : "and",
5073
+ args: [args[args.length - 1]]
5074
+ }),
5075
+ children: "Group the last one"
5076
+ }
5077
+ ) : null
5078
+ ] }) : null
5079
+ ] });
5080
+ }
4925
5081
 
4926
5082
  // src/StageRules.tsx
4927
5083
  import { jsx as jsx18, jsxs as jsxs14 } from "react/jsx-runtime";
@@ -4959,15 +5115,15 @@ function StageRulesSection({ tableId, stage, className }) {
4959
5115
  const table = useTable5(tableId);
4960
5116
  const rights = useTableRights(table.data);
4961
5117
  const fields = useFields6(tableId);
4962
- const [pipeline, setPipeline] = useState14(null);
4963
- const [enforcement, setEnforcement] = useState14(null);
4964
- const [asked, setAsked] = useState14(false);
4965
- const [error, setError] = useState14(null);
4966
- const [chosen, setChosen] = useState14(stage ?? null);
4967
- const [draft, setDraft] = useState14(null);
4968
- const [preview, setPreview] = useState14(null);
4969
- const [previewError, setPreviewError] = useState14(null);
4970
- const [saving, setSaving] = useState14(false);
5118
+ const [pipeline, setPipeline] = useState15(null);
5119
+ const [enforcement, setEnforcement] = useState15(null);
5120
+ const [asked, setAsked] = useState15(false);
5121
+ const [error, setError] = useState15(null);
5122
+ const [chosen, setChosen] = useState15(stage ?? null);
5123
+ const [draft, setDraft] = useState15(null);
5124
+ const [preview, setPreview] = useState15(null);
5125
+ const [previewError, setPreviewError] = useState15(null);
5126
+ const [saving, setSaving] = useState15(false);
4971
5127
  const load = useCallback8(async () => {
4972
5128
  const [read, mode] = await Promise.all([client.pipelineRead({ table_id: tableId }), client.stageRuleEnforcement()]);
4973
5129
  if (!read.ok) setError(read.error);
@@ -5067,7 +5223,7 @@ function StageRulesSection({ tableId, stage, className }) {
5067
5223
  ),
5068
5224
  /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: gates.length }),
5069
5225
  canEdit && !draft ? /* @__PURE__ */ jsx18(
5070
- Button12,
5226
+ Button13,
5071
5227
  {
5072
5228
  size: "sm",
5073
5229
  variant: "outline",
@@ -5089,7 +5245,7 @@ function StageRulesSection({ tableId, stage, className }) {
5089
5245
  /* @__PURE__ */ jsx18("div", { className: "text-muted-foreground", children: rule.message }),
5090
5246
  /* @__PURE__ */ jsx18("div", { className: "text-muted-foreground", children: (rule.on_fail ?? "refuse") === "require_approval" ? "Asks for approval" : "Turns it away" })
5091
5247
  ] }),
5092
- canEdit ? /* @__PURE__ */ jsx18(Button12, { size: "sm", variant: "ghost", onClick: () => setDraft(draftOf(rule)), children: "Edit" }) : null
5248
+ canEdit ? /* @__PURE__ */ jsx18(Button13, { size: "sm", variant: "ghost", onClick: () => setDraft(draftOf(rule)), children: "Edit" }) : null
5093
5249
  ] }, rule.id)) }) : null,
5094
5250
  draft ? /* @__PURE__ */ jsxs14("div", { className: "flex flex-col gap-2 rounded border p-2", children: [
5095
5251
  draft.opaque ? /* @__PURE__ */ jsxs14("p", { className: "rounded border border-amber-500/40 bg-amber-500/5 px-2 py-1 text-muted-foreground", children: [
@@ -5155,8 +5311,8 @@ function StageRulesSection({ tableId, stage, className }) {
5155
5311
  previewError ? /* @__PURE__ */ jsx18(RefusalNotice, { error: previewError }) : preview ? /* @__PURE__ */ jsx18("p", { className: "text-muted-foreground", "data-testid": "stage-rule-preview", children: preview.refused === 0 ? `No ${preview.noun ?? "card"}s on this board would be stopped by this today, out of ${preview.considered} that could move here.` : `${preview.refused} of ${preview.considered} ${preview.noun ?? "card"}s would be ${(draft.on_fail ?? "refuse") === "require_approval" ? "sent for approval" : "refused"} today \u2014 ${preview.examples.map((e) => e.title).join(", ")}${preview.refused > preview.examples.length ? " and others" : ""}.` }) : null,
5156
5312
  error ? /* @__PURE__ */ jsx18(RefusalNotice, { error }) : null,
5157
5313
  /* @__PURE__ */ jsxs14("div", { className: "flex items-center gap-2", children: [
5158
- draft.message.trim() && Object.keys(draft.demands ?? {}).length > 0 ? /* @__PURE__ */ jsx18(Button12, { size: "sm", onClick: () => void save(), disabled: saving, children: saving ? "Saving\u2026" : "Save this rule" }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: Object.keys(draft.demands ?? {}).length === 0 ? "Say what a card needs before it can get here." : NEEDS_A_SENTENCE }),
5159
- /* @__PURE__ */ jsx18(Button12, { size: "sm", variant: "ghost", onClick: () => setDraft(null), children: "Cancel" })
5314
+ draft.message.trim() && Object.keys(draft.demands ?? {}).length > 0 ? /* @__PURE__ */ jsx18(Button13, { size: "sm", onClick: () => void save(), disabled: saving, children: saving ? "Saving\u2026" : "Save this rule" }) : /* @__PURE__ */ jsx18("span", { className: "text-muted-foreground", children: Object.keys(draft.demands ?? {}).length === 0 ? "Say what a card needs before it can get here." : NEEDS_A_SENTENCE }),
5315
+ /* @__PURE__ */ jsx18(Button13, { size: "sm", variant: "ghost", onClick: () => setDraft(null), children: "Cancel" })
5160
5316
  ] })
5161
5317
  ] }) : null,
5162
5318
  /* @__PURE__ */ jsx18(Separator5, {})
@@ -5169,15 +5325,15 @@ function Clause({
5169
5325
  fields,
5170
5326
  onChange
5171
5327
  }) {
5172
- const [replacing, setReplacing] = useState14(false);
5173
- const drawable = conditionIsSimple(expr) || replacing;
5328
+ const [replacing, setReplacing] = useState15(false);
5329
+ const drawable = conditionIsDrawable(expr) || replacing;
5174
5330
  if (drawable) {
5175
5331
  return /* @__PURE__ */ jsx18(
5176
- ConditionRow,
5332
+ ConditionGroup,
5177
5333
  {
5178
5334
  lead,
5179
5335
  emptyLabel,
5180
- expr: replacing && !conditionIsSimple(expr) ? null : expr,
5336
+ expr: replacing && !conditionIsDrawable(expr) ? null : expr,
5181
5337
  fields,
5182
5338
  onChange
5183
5339
  }
@@ -5192,7 +5348,7 @@ function Clause({
5192
5348
  ", so it is shown as it reads."
5193
5349
  ] }),
5194
5350
  /* @__PURE__ */ jsx18(
5195
- Button12,
5351
+ Button13,
5196
5352
  {
5197
5353
  size: "sm",
5198
5354
  variant: "ghost",
@@ -5208,14 +5364,14 @@ function Clause({
5208
5364
  }
5209
5365
 
5210
5366
  // src/TableSettings.tsx
5211
- import { useState as useState15 } from "react";
5367
+ import { useState as useState16 } from "react";
5212
5368
  import {
5213
5369
  useFieldMutation as useFieldMutation2,
5214
5370
  useFields as useFields7,
5215
5371
  useRecordMutation,
5216
5372
  useTable as useTable6
5217
5373
  } from "@ai-matrx/records/react";
5218
- import { Badge as Badge6, Button as Button13, Separator as Separator6, cn as cn14 } from "@ai-matrx/design-system";
5374
+ import { Badge as Badge6, Button as Button14, Separator as Separator6, cn as cn14 } from "@ai-matrx/design-system";
5219
5375
  import { Fragment as Fragment9, jsx as jsx19, jsxs as jsxs15 } from "react/jsx-runtime";
5220
5376
  function TableSettings({
5221
5377
  tableId,
@@ -5230,10 +5386,10 @@ function TableSettings({
5230
5386
  const rights = useTableRights(table.data);
5231
5387
  const mutation = useRecordMutation();
5232
5388
  const shape = useFieldMutation2();
5233
- const [editing, setEditing] = useState15(null);
5234
- const [askingToDelete, setAskingToDelete] = useState15(false);
5235
- const [askingToRemove, setAskingToRemove] = useState15(null);
5236
- const [enriching, setEnriching] = useState15(null);
5389
+ const [editing, setEditing] = useState16(null);
5390
+ const [askingToDelete, setAskingToDelete] = useState16(false);
5391
+ const [askingToRemove, setAskingToRemove] = useState16(null);
5392
+ const [enriching, setEnriching] = useState16(null);
5237
5393
  if (table.error) return /* @__PURE__ */ jsx19(RefusalNotice, { error: table.error, className });
5238
5394
  if (fields.error) return /* @__PURE__ */ jsx19(RefusalNotice, { error: fields.error, className });
5239
5395
  if (!rights.structure) return /* @__PURE__ */ jsx19("p", { className: cn14("text-xs text-muted-foreground", className), children: rights.why("structure") });
@@ -5263,7 +5419,7 @@ function TableSettings({
5263
5419
  return /* @__PURE__ */ jsxs15("div", { className, children: [
5264
5420
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center justify-between px-2 pt-2", children: [
5265
5421
  /* @__PURE__ */ jsx19("h2", { className: "text-sm font-medium", children: fieldName(enriching) }),
5266
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "ghost", onClick: () => {
5422
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => {
5267
5423
  setEnriching(null);
5268
5424
  fields.reload();
5269
5425
  }, children: "Back" })
@@ -5291,7 +5447,7 @@ function TableSettings({
5291
5447
  /* @__PURE__ */ jsxs15("div", { className: "flex items-center gap-2", children: [
5292
5448
  /* @__PURE__ */ jsx19("span", { className: "font-medium", children: "Fields" }),
5293
5449
  /* @__PURE__ */ jsx19("span", { className: "text-muted-foreground", children: rows.length }),
5294
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Add a field" })
5450
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Add a field" })
5295
5451
  ] }),
5296
5452
  mutation.error ? /* @__PURE__ */ jsx19(RefusalNotice, { error: mutation.error }) : null,
5297
5453
  shape.error ? /* @__PURE__ */ jsx19(RefusalNotice, { error: shape.error }) : null,
@@ -5302,7 +5458,7 @@ function TableSettings({
5302
5458
  " takes it off every record of this table. The values stay in each record's history and nothing else is deleted."
5303
5459
  ] }),
5304
5460
  /* @__PURE__ */ jsx19(
5305
- Button13,
5461
+ Button14,
5306
5462
  {
5307
5463
  size: "sm",
5308
5464
  variant: "destructive",
@@ -5311,7 +5467,7 @@ function TableSettings({
5311
5467
  children: shape.saving ? "Removing\u2026" : "Remove it"
5312
5468
  }
5313
5469
  ),
5314
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
5470
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => setAskingToRemove(null), children: "Keep it" })
5315
5471
  ] }) : null,
5316
5472
  /* @__PURE__ */ jsxs15("ul", { className: "divide-y rounded border", children: [
5317
5473
  rows.map((field, index) => /* @__PURE__ */ jsxs15("li", { className: "flex items-center gap-2 px-2 py-1.5", children: [
@@ -5319,7 +5475,7 @@ function TableSettings({
5319
5475
  /* @__PURE__ */ jsx19(Badge6, { variant: "outline", className: "text-[10px] font-normal", children: fieldTypeLabel(field) }),
5320
5476
  field.required ? /* @__PURE__ */ jsx19("span", { className: "text-[10px] text-destructive", children: "required" }) : null,
5321
5477
  /* @__PURE__ */ jsx19(
5322
- Button13,
5478
+ Button14,
5323
5479
  {
5324
5480
  size: "sm",
5325
5481
  variant: "ghost",
@@ -5330,7 +5486,7 @@ function TableSettings({
5330
5486
  }
5331
5487
  ),
5332
5488
  /* @__PURE__ */ jsx19(
5333
- Button13,
5489
+ Button14,
5334
5490
  {
5335
5491
  size: "sm",
5336
5492
  variant: "ghost",
@@ -5341,9 +5497,9 @@ function TableSettings({
5341
5497
  }
5342
5498
  ),
5343
5499
  field.source === "agent" ? /* @__PURE__ */ jsx19(Badge6, { variant: "secondary", className: "text-[10px] font-normal", children: "a model fills this in" }) : null,
5344
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "ghost", onClick: () => setEditing(field), children: "Edit" }),
5500
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => setEditing(field), children: "Edit" }),
5345
5501
  /* @__PURE__ */ jsx19(
5346
- Button13,
5502
+ Button14,
5347
5503
  {
5348
5504
  size: "sm",
5349
5505
  variant: "ghost",
@@ -5353,7 +5509,7 @@ function TableSettings({
5353
5509
  }
5354
5510
  ),
5355
5511
  /* @__PURE__ */ jsx19(
5356
- Button13,
5512
+ Button14,
5357
5513
  {
5358
5514
  size: "sm",
5359
5515
  variant: "ghost",
@@ -5376,8 +5532,8 @@ function TableSettings({
5376
5532
  /* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1 truncate", children: proposal.field.label || proposal.field.key }),
5377
5533
  /* @__PURE__ */ jsx19("span", { className: "min-w-0 flex-1 truncate text-muted-foreground", children: proposal.why }),
5378
5534
  /* @__PURE__ */ jsx19(Badge6, { variant: "secondary", className: "text-[10px] font-normal", children: proposal.proposed_by }),
5379
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "outline", onClick: () => onAcceptProposal?.(proposal), children: "Accept" }),
5380
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "ghost", onClick: () => onRejectProposal?.(proposal), children: "Reject" })
5535
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "outline", onClick: () => onAcceptProposal?.(proposal), children: "Accept" }),
5536
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => onRejectProposal?.(proposal), children: "Reject" })
5381
5537
  ] }, proposal.id)) }),
5382
5538
  /* @__PURE__ */ jsx19(Separator6, {}),
5383
5539
  /* @__PURE__ */ jsxs15("div", { className: "flex flex-col gap-1", children: [
@@ -5394,22 +5550,22 @@ function TableSettings({
5394
5550
  table.data?.retention_days ? ` The store keeps them for ${table.data.retention_days} days, so it can still be restored.` : " The store keeps them, so it can still be restored."
5395
5551
  ] }),
5396
5552
  /* @__PURE__ */ jsxs15("div", { className: "flex gap-1", children: [
5397
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "destructive", disabled: mutation.saving, onClick: () => void deleteTable(), children: mutation.saving ? "Deleting\u2026" : "Delete this table" }),
5398
- /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
5553
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "destructive", disabled: mutation.saving, onClick: () => void deleteTable(), children: mutation.saving ? "Deleting\u2026" : "Delete this table" }),
5554
+ /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "ghost", onClick: () => setAskingToDelete(false), children: "Keep it" })
5399
5555
  ] })
5400
- ] }) : /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsx19(Button13, { size: "sm", variant: "outline", onClick: () => setAskingToDelete(true), children: "Delete this table" }) }),
5556
+ ] }) : /* @__PURE__ */ jsx19("div", { children: /* @__PURE__ */ jsx19(Button14, { size: "sm", variant: "outline", onClick: () => setAskingToDelete(true), children: "Delete this table" }) }),
5401
5557
  mutation.error ? /* @__PURE__ */ jsx19(RefusalNotice, { error: mutation.error }) : null
5402
5558
  ] })
5403
5559
  ] });
5404
5560
  }
5405
5561
 
5406
5562
  // src/Peek.tsx
5407
- import { useState as useState20 } from "react";
5563
+ import { useState as useState21 } from "react";
5408
5564
  import { useFields as useFields9, useRecord as useRecord2, useRecordsClient as useRecordsClient14, useTable as useTable7 } from "@ai-matrx/records/react";
5409
5565
  import { AlchemyMenu as AlchemyMenu2 } from "@ai-matrx/alchemy/react";
5410
5566
 
5411
5567
  // src/RecordChat.tsx
5412
- import { useEffect as useEffect9, useMemo as useMemo13, useState as useState16 } from "react";
5568
+ import { useEffect as useEffect9, useMemo as useMemo13, useState as useState17 } from "react";
5413
5569
  import { useRecordsClient as useRecordsClient12 } from "@ai-matrx/records/react";
5414
5570
  import { Skeleton as Skeleton4, cn as cn15 } from "@ai-matrx/design-system";
5415
5571
  import { jsx as jsx20, jsxs as jsxs16 } from "react/jsx-runtime";
@@ -5417,8 +5573,8 @@ var NO_CHAT_REASON = "No chat port is bound, so this panel is absent rather than
5417
5573
  function RecordChat({ tableId, recordId, className }) {
5418
5574
  const client = useRecordsClient12();
5419
5575
  const host = useRecordsUi();
5420
- const [scope, setScope] = useState16(null);
5421
- const [error, setError] = useState16(null);
5576
+ const [scope, setScope] = useState17(null);
5577
+ const [error, setError] = useState17(null);
5422
5578
  useEffect9(() => {
5423
5579
  let cancelled = false;
5424
5580
  setScope(null);
@@ -5533,20 +5689,20 @@ function entriesFor(scope) {
5533
5689
  }
5534
5690
 
5535
5691
  // src/Peek.tsx
5536
- import { Button as Button16, Separator as Separator8, Skeleton as Skeleton5, cn as cn17 } from "@ai-matrx/design-system";
5692
+ import { Button as Button17, Separator as Separator8, Skeleton as Skeleton5, cn as cn17 } from "@ai-matrx/design-system";
5537
5693
 
5538
5694
  // src/RecordForm.tsx
5539
- import { useEffect as useEffect11, useMemo as useMemo15, useState as useState18 } from "react";
5695
+ import { useEffect as useEffect11, useMemo as useMemo15, useState as useState19 } from "react";
5540
5696
  import {
5541
5697
  useFields as useFields8,
5542
5698
  useRecord,
5543
5699
  useRecordMutation as useRecordMutation2
5544
5700
  } from "@ai-matrx/records/react";
5545
5701
  import { predictWriteRefusals } from "@ai-matrx/records/core";
5546
- import { Button as Button14, Separator as Separator7, cn as cn16 } from "@ai-matrx/design-system";
5702
+ import { Button as Button15, Separator as Separator7, cn as cn16 } from "@ai-matrx/design-system";
5547
5703
 
5548
5704
  // src/systemTable.ts
5549
- import { useEffect as useEffect10, useMemo as useMemo14, useState as useState17 } from "react";
5705
+ import { useEffect as useEffect10, useMemo as useMemo14, useState as useState18 } from "react";
5550
5706
  import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react";
5551
5707
  var inFlight = /* @__PURE__ */ new Map();
5552
5708
  async function ensureSystemTable(client, spec) {
@@ -5676,7 +5832,7 @@ async function declare(client, spec) {
5676
5832
  }
5677
5833
  function useSystemTable(spec) {
5678
5834
  const client = useRecordsClient13();
5679
- const [state, setState] = useState17({ tableId: null, loading: true, error: null });
5835
+ const [state, setState] = useState18({ tableId: null, loading: true, error: null });
5680
5836
  const slug = spec.slug;
5681
5837
  const stable = useMemo14(() => spec, [slug]);
5682
5838
  useEffect10(() => {
@@ -5696,7 +5852,7 @@ function useSystemTable(spec) {
5696
5852
  }
5697
5853
  function useRecordVersion(recordId) {
5698
5854
  const client = useRecordsClient13();
5699
- const [version, setVersion] = useState17(null);
5855
+ const [version, setVersion] = useState18(null);
5700
5856
  useEffect10(() => {
5701
5857
  let cancelled = false;
5702
5858
  setVersion(null);
@@ -5730,8 +5886,8 @@ function RecordForm({
5730
5886
  const fields = useFields8(tableId, recordType);
5731
5887
  const existing = useRecord(recordId ?? null);
5732
5888
  const mutation = useRecordMutation2();
5733
- const [draft, setDraft] = useState18({});
5734
- const [touched, setTouched] = useState18(false);
5889
+ const [draft, setDraft] = useState19({});
5890
+ const [touched, setTouched] = useState19(false);
5735
5891
  const loaded = useRecordVersion(recordId ?? null);
5736
5892
  const loadedVersion = loaded.version;
5737
5893
  useEffect11(() => {
@@ -5814,7 +5970,7 @@ function RecordForm({
5814
5970
  ] }, key);
5815
5971
  }),
5816
5972
  /* @__PURE__ */ jsx21(
5817
- Button14,
5973
+ Button15,
5818
5974
  {
5819
5975
  type: "button",
5820
5976
  size: "sm",
@@ -5832,8 +5988,8 @@ function RecordForm({
5832
5988
  ) : null,
5833
5989
  /* @__PURE__ */ jsx21(Separator7, {}),
5834
5990
  /* @__PURE__ */ jsxs17("div", { className: "flex items-center gap-2", children: [
5835
- /* @__PURE__ */ jsx21(Button14, { type: "submit", size: "sm", disabled: mutation.saving, children: mutation.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
5836
- onCancel ? /* @__PURE__ */ jsx21(Button14, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
5991
+ /* @__PURE__ */ jsx21(Button15, { type: "submit", size: "sm", disabled: mutation.saving, children: mutation.saving ? "Saving\u2026" : recordId ? "Save" : "Create" }),
5992
+ onCancel ? /* @__PURE__ */ jsx21(Button15, { type: "button", size: "sm", variant: "ghost", onClick: onCancel, children: "Cancel" }) : null
5837
5993
  ] })
5838
5994
  ]
5839
5995
  }
@@ -5861,8 +6017,8 @@ function asWords(value) {
5861
6017
  }
5862
6018
 
5863
6019
  // src/ShareControl.tsx
5864
- import { useState as useState19 } from "react";
5865
- import { Button as Button15 } from "@ai-matrx/design-system";
6020
+ import { useState as useState20 } from "react";
6021
+ import { Button as Button16 } from "@ai-matrx/design-system";
5866
6022
  import { Fragment as Fragment10, jsx as jsx22, jsxs as jsxs18 } from "react/jsx-runtime";
5867
6023
  function useCanShare() {
5868
6024
  return typeof useRecordsUi().share === "function";
@@ -5881,14 +6037,14 @@ function ShareControl({
5881
6037
  className
5882
6038
  }) {
5883
6039
  const host = useRecordsUi();
5884
- const [open, setOpen] = useState19(false);
6040
+ const [open, setOpen] = useState20(false);
5885
6041
  const asked = useRecordRights(may === void 0 ? subjectId : null);
5886
6042
  const mayShare = may ?? asked.share;
5887
6043
  if (!host.share) return null;
5888
6044
  if (!mayShare) return null;
5889
6045
  return /* @__PURE__ */ jsxs18(Fragment10, { children: [
5890
6046
  /* @__PURE__ */ jsx22(
5891
- Button15,
6047
+ Button16,
5892
6048
  {
5893
6049
  size,
5894
6050
  variant,
@@ -5919,8 +6075,8 @@ function Peek({ tableId, recordId, onClose, className }) {
5919
6075
  const may = useRecordRights(recordId);
5920
6076
  const host = useRecordsUi();
5921
6077
  const organizationId = useRecordsClient14().config.organizationId;
5922
- const [editing, setEditing] = useState20(false);
5923
- const [talking, setTalking] = useState20(false);
6078
+ const [editing, setEditing] = useState21(false);
6079
+ const [talking, setTalking] = useState21(false);
5924
6080
  if (record.error) return /* @__PURE__ */ jsx23(RefusalNotice, { error: record.error, className });
5925
6081
  if (fields.error) return /* @__PURE__ */ jsx23(RefusalNotice, { error: fields.error, className });
5926
6082
  const document2 = record.data?.document;
@@ -5952,21 +6108,21 @@ function Peek({ tableId, recordId, onClose, className }) {
5952
6108
  ),
5953
6109
  href ? /* @__PURE__ */ jsx23("a", { className: "text-primary underline-offset-2 hover:underline", href, children: "Open" }) : null,
5954
6110
  host.talkToRecord ? /* @__PURE__ */ jsx23(
5955
- Button16,
6111
+ Button17,
5956
6112
  {
5957
6113
  size: "sm",
5958
6114
  variant: "outline",
5959
6115
  onClick: () => host.talkToRecord?.({ tableId, recordId, title: title || "this record" }),
5960
6116
  children: "Talk to this record"
5961
6117
  }
5962
- ) : host.chat ? /* @__PURE__ */ jsx23(Button16, { size: "sm", variant: talking ? "ghost" : "outline", onClick: () => setTalking((t) => !t), children: talking ? "Close chat" : "Talk to this record" }) : null,
6118
+ ) : host.chat ? /* @__PURE__ */ jsx23(Button17, { size: "sm", variant: talking ? "ghost" : "outline", onClick: () => setTalking((t) => !t), children: talking ? "Close chat" : "Talk to this record" }) : null,
5963
6119
  /* @__PURE__ */ jsx23(ShareControl, { kind: "record", organizationId, subjectId: recordId, name: title, may: may.share }),
5964
- may.write ? /* @__PURE__ */ jsx23(Button16, { size: "sm", variant: editing ? "ghost" : "outline", onClick: () => setEditing((e) => !e), children: editing ? "Stop editing" : "Edit" }) : may.known ? (
6120
+ may.write ? /* @__PURE__ */ jsx23(Button17, { size: "sm", variant: editing ? "ghost" : "outline", onClick: () => setEditing((e) => !e), children: editing ? "Stop editing" : "Edit" }) : may.known ? (
5965
6121
  // Absent AND explained: no Edit button, and one sentence saying what
5966
6122
  // it would take and who can give it.
5967
6123
  /* @__PURE__ */ jsx23("span", { className: "max-w-[18rem] text-[11px] text-muted-foreground", children: may.why("write") })
5968
6124
  ) : null,
5969
- onClose ? /* @__PURE__ */ jsx23(Button16, { size: "sm", variant: "ghost", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
6125
+ onClose ? /* @__PURE__ */ jsx23(Button17, { size: "sm", variant: "ghost", onClick: onClose, "aria-label": "Close", children: "\xD7" }) : null
5970
6126
  ] }),
5971
6127
  /* @__PURE__ */ jsx23(Separator8, {}),
5972
6128
  talking && host.chat ? /* @__PURE__ */ jsxs19(Fragment11, { children: [
@@ -6123,18 +6279,18 @@ function parseSorts(raw) {
6123
6279
  }
6124
6280
 
6125
6281
  // src/ViewSwitcher.tsx
6126
- import { useEffect as useEffect13, useMemo as useMemo17, useState as useState22 } from "react";
6282
+ import { useEffect as useEffect13, useMemo as useMemo17, useState as useState23 } from "react";
6127
6283
  import { useFields as useFields11, useRecords as useRecords4, useRecordsClient as useRecordsClient16 } from "@ai-matrx/records/react";
6128
- import { Button as Button18, Skeleton as Skeleton7, cn as cn19 } from "@ai-matrx/design-system";
6284
+ import { Button as Button19, Skeleton as Skeleton7, cn as cn19 } from "@ai-matrx/design-system";
6129
6285
 
6130
6286
  // src/Pipeline.tsx
6131
- import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMemo16, useRef as useRef5, useState as useState21 } from "react";
6287
+ import { useCallback as useCallback9, useEffect as useEffect12, useMemo as useMemo16, useRef as useRef5, useState as useState22 } from "react";
6132
6288
  import {
6133
6289
  mayDrag,
6134
6290
  useFields as useFields10,
6135
6291
  useRecordsClient as useRecordsClient15
6136
6292
  } from "@ai-matrx/records/react";
6137
- import { Button as Button17, Skeleton as Skeleton6, cn as cn18 } from "@ai-matrx/design-system";
6293
+ import { Button as Button18, Skeleton as Skeleton6, cn as cn18 } from "@ai-matrx/design-system";
6138
6294
  import { jsx as jsx24, jsxs as jsxs20 } from "react/jsx-runtime";
6139
6295
  var UNPLACED = "\0unplaced";
6140
6296
  function stageOfCard(row, stageKey, stages) {
@@ -6168,14 +6324,14 @@ function PipelineBoard({
6168
6324
  }) {
6169
6325
  const client = useRecordsClient15();
6170
6326
  const fields = useFields10(tableId);
6171
- const [definition, setDefinition] = useState21(null);
6172
- const [columns, setColumns] = useState21([]);
6173
- const [error, setError] = useState21(null);
6174
- const [loading, setLoading] = useState21(true);
6175
- const [pending, setPending] = useState21({ kind: "none" });
6176
- const [waiting, setWaiting] = useState21(/* @__PURE__ */ new Map());
6177
- const [dragging, setDragging] = useState21(null);
6178
- const [over, setOver] = useState21(null);
6327
+ const [definition, setDefinition] = useState22(null);
6328
+ const [columns, setColumns] = useState22([]);
6329
+ const [error, setError] = useState22(null);
6330
+ const [loading, setLoading] = useState22(true);
6331
+ const [pending, setPending] = useState22({ kind: "none" });
6332
+ const [waiting, setWaiting] = useState22(/* @__PURE__ */ new Map());
6333
+ const [dragging, setDragging] = useState22(null);
6334
+ const [over, setOver] = useState22(null);
6179
6335
  const alive = useRef5(true);
6180
6336
  useEffect12(() => {
6181
6337
  alive.current = true;
@@ -6220,6 +6376,7 @@ function PipelineBoard({
6220
6376
  () => all.find((f) => f.key !== stageKey) ?? all[0],
6221
6377
  [all, stageKey]
6222
6378
  );
6379
+ const unplacedLabels = useRecordLabels(titleField ? [titleField] : []);
6223
6380
  const measurable = useMemo16(
6224
6381
  () => all.filter((f) => ["number", "currency", "percentage"].includes(String(f.type ?? ""))),
6225
6382
  [all]
@@ -6390,7 +6547,7 @@ function PipelineBoard({
6390
6547
  unplaced.length > 0 ? /* @__PURE__ */ jsxs20("p", { className: "text-xs text-muted-foreground", "data-testid": "pipeline-unplaced", children: [
6391
6548
  unplaced.length === 1 ? "One record is" : `${unplaced.length} records are`,
6392
6549
  " not in any of these columns \u2014 ",
6393
- unplaced.slice(0, 3).map((r) => rowName(r, titleField?.key ?? null, "Untitled")).join(", "),
6550
+ unplaced.slice(0, 3).map((r) => unplacedName(r, titleField, unplacedLabels)).join(", "),
6394
6551
  unplaced.length > 3 ? ` and ${unplaced.length - 3} more` : "",
6395
6552
  ". Their stage is not one this pipeline offers, so nothing here can draw them; open one from the grid to move it."
6396
6553
  ] }) : null
@@ -6406,14 +6563,14 @@ function Held({
6406
6563
  onFill,
6407
6564
  onAsk
6408
6565
  }) {
6409
- const [draft, setDraft] = useState21({});
6566
+ const [draft, setDraft] = useState22({});
6410
6567
  if (pending.kind === "asking") {
6411
6568
  return /* @__PURE__ */ jsx24("p", { className: "px-2 py-1 text-xs text-muted-foreground", children: "Asking\u2026" });
6412
6569
  }
6413
6570
  if (pending.kind === "refused") {
6414
6571
  return /* @__PURE__ */ jsxs20("div", { className: "mt-1 rounded border border-destructive/50 bg-destructive/5 p-2 text-xs", children: [
6415
6572
  /* @__PURE__ */ jsx24("p", { children: pending.verdict.why }),
6416
- /* @__PURE__ */ jsx24(Button17, { size: "sm", variant: "ghost", className: "mt-1 h-6", onClick: onCancel, children: "Close" })
6573
+ /* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "mt-1 h-6", onClick: onCancel, children: "Close" })
6417
6574
  ] });
6418
6575
  }
6419
6576
  if (pending.kind === "approval") {
@@ -6421,8 +6578,8 @@ function Held({
6421
6578
  /* @__PURE__ */ jsx24("p", { children: pending.verdict.why }),
6422
6579
  pending.verdict.what_happens ? /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: pending.verdict.what_happens }) : null,
6423
6580
  /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1", children: [
6424
- /* @__PURE__ */ jsx24(Button17, { size: "sm", className: "h-6", onClick: onAsk, children: "Ask for approval" }),
6425
- /* @__PURE__ */ jsx24(Button17, { size: "sm", variant: "ghost", className: "h-6", onClick: onCancel, children: "Leave it where it was" })
6581
+ /* @__PURE__ */ jsx24(Button18, { size: "sm", className: "h-6", onClick: onAsk, children: "Ask for approval" }),
6582
+ /* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "h-6", onClick: onCancel, children: "Leave it where it was" })
6426
6583
  ] })
6427
6584
  ] });
6428
6585
  }
@@ -6435,7 +6592,7 @@ function Held({
6435
6592
  (pending.result.approvers ?? []).map((a) => a.name ?? "somebody who can approve it").join(", "),
6436
6593
  "."
6437
6594
  ] }) : null,
6438
- /* @__PURE__ */ jsx24(Button17, { size: "sm", variant: "ghost", className: "mt-1 h-6", onClick: onCancel, children: "Close" })
6595
+ /* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "mt-1 h-6", onClick: onCancel, children: "Close" })
6439
6596
  ] });
6440
6597
  }
6441
6598
  if (pending.kind === "warned") {
@@ -6444,7 +6601,7 @@ function Held({
6444
6601
  /* @__PURE__ */ jsx24("p", { children: w.why }),
6445
6602
  /* @__PURE__ */ jsx24("p", { className: "text-muted-foreground", children: w.what_to_do })
6446
6603
  ] }, w.rule_id)),
6447
- /* @__PURE__ */ jsx24(Button17, { size: "sm", variant: "ghost", className: "h-6 self-start", onClick: onCancel, children: "Close" })
6604
+ /* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "h-6 self-start", onClick: onCancel, children: "Close" })
6448
6605
  ] });
6449
6606
  }
6450
6607
  if (pending.kind !== "needs") return null;
@@ -6465,7 +6622,7 @@ function Held({
6465
6622
  ] }, m.key)),
6466
6623
  /* @__PURE__ */ jsxs20("div", { className: "flex items-center gap-1", children: [
6467
6624
  ready ? /* @__PURE__ */ jsx24(
6468
- Button17,
6625
+ Button18,
6469
6626
  {
6470
6627
  size: "sm",
6471
6628
  className: "h-6",
@@ -6477,7 +6634,7 @@ function Held({
6477
6634
  missing.length === 1 ? "it" : "them",
6478
6635
  " in and the move goes through."
6479
6636
  ] }),
6480
- /* @__PURE__ */ jsx24(Button17, { size: "sm", variant: "ghost", className: "h-6", onClick: onCancel, children: "Leave it where it was" })
6637
+ /* @__PURE__ */ jsx24(Button18, { size: "sm", variant: "ghost", className: "h-6", onClick: onCancel, children: "Leave it where it was" })
6481
6638
  ] }),
6482
6639
  fields.length === 0 ? null : null
6483
6640
  ] });
@@ -6527,6 +6684,10 @@ function Card({
6527
6684
  }
6528
6685
  );
6529
6686
  }
6687
+ function unplacedName(record, field, labels) {
6688
+ if (!field) return rowName(record, null, "Untitled");
6689
+ return scalarText(field, (record.document ?? {})[field.key], labels);
6690
+ }
6530
6691
 
6531
6692
  // src/ViewSwitcher.tsx
6532
6693
  import { jsx as jsx25, jsxs as jsxs21 } from "react/jsx-runtime";
@@ -6534,7 +6695,7 @@ var NO_FIELDS = [];
6534
6695
  function useViewRecords(view, pageSize = 200) {
6535
6696
  const client = useRecordsClient16();
6536
6697
  const table = useRecords4(view.ruleId ? null : view.subject, { pageSize });
6537
- const [ruled, setRuled] = useState22({
6698
+ const [ruled, setRuled] = useState23({
6538
6699
  rows: [],
6539
6700
  loading: Boolean(view.ruleId),
6540
6701
  error: null
@@ -6590,8 +6751,8 @@ function ViewSwitcher({
6590
6751
  pageSize = 200,
6591
6752
  className
6592
6753
  }) {
6593
- const [layout, setLayout] = useState22(view.layout);
6594
- const [local, setLocal] = useState22({});
6754
+ const [layout, setLayout] = useState23(view.layout);
6755
+ const [local, setLocal] = useState23({});
6595
6756
  useEffect13(() => {
6596
6757
  setLayout(view.layout);
6597
6758
  setLocal({});
@@ -6609,7 +6770,7 @@ function ViewSwitcher({
6609
6770
  /* @__PURE__ */ jsxs21("div", { className: "flex items-center gap-2", children: [
6610
6771
  /* @__PURE__ */ jsx25("span", { className: "truncate text-sm font-medium", children: view.name }),
6611
6772
  /* @__PURE__ */ jsx25("div", { className: "ml-auto flex items-center gap-0.5", role: "group", "aria-label": "Layout", children: VIEW_LAYOUTS.map((option) => /* @__PURE__ */ jsx25(
6612
- Button18,
6773
+ Button19,
6613
6774
  {
6614
6775
  size: "sm",
6615
6776
  variant: option === layout ? "secondary" : "ghost",
@@ -6653,7 +6814,7 @@ function offerableFields(all, want) {
6653
6814
  }
6654
6815
  function useStageField(tableId) {
6655
6816
  const client = useRecordsClient16();
6656
- const [stage, setStage] = useState22({
6817
+ const [stage, setStage] = useState23({
6657
6818
  asked: false,
6658
6819
  key: null
6659
6820
  });
@@ -6922,9 +7083,9 @@ function Card2({
6922
7083
  }
6923
7084
 
6924
7085
  // src/ViewBar.tsx
6925
- import { useCallback as useCallback11, useEffect as useEffect14, useState as useState23 } from "react";
7086
+ import { useCallback as useCallback11, useEffect as useEffect14, useState as useState24 } from "react";
6926
7087
  import { useRecordsClient as useRecordsClient17 } from "@ai-matrx/records/react";
6927
- import { Button as Button19, Input as Input2, Skeleton as Skeleton8, cn as cn20 } from "@ai-matrx/design-system";
7088
+ import { Button as Button20, Input as Input2, Skeleton as Skeleton8, cn as cn20 } from "@ai-matrx/design-system";
6928
7089
 
6929
7090
  // src/seedOnce.ts
6930
7091
  import { useCallback as useCallback10, useRef as useRef6 } from "react";
@@ -6947,11 +7108,11 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
6947
7108
  const table = useTable8(tableId);
6948
7109
  const rights = useTableRights(table.data);
6949
7110
  const home = useSystemTable(VIEW_TABLE);
6950
- const [views, setViews] = useState23(null);
6951
- const [error, setError] = useState23(null);
6952
- const [active, setActive] = useState23(activeViewId ?? null);
6953
- const [naming, setNaming] = useState23(false);
6954
- const [draftName, setDraftName] = useState23("");
7111
+ const [views, setViews] = useState24(null);
7112
+ const [error, setError] = useState24(null);
7113
+ const [active, setActive] = useState24(activeViewId ?? null);
7114
+ const [naming, setNaming] = useState24(false);
7115
+ const [draftName, setDraftName] = useState24("");
6955
7116
  const viewTableId = home.tableId;
6956
7117
  const load = useCallback11(async () => {
6957
7118
  if (!viewTableId) return;
@@ -7012,11 +7173,11 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
7012
7173
  if (home.error) {
7013
7174
  return /* @__PURE__ */ jsx26("div", { className: cn20("flex min-w-0 items-center gap-2 overflow-x-auto", className), children: /* @__PURE__ */ jsx26("span", { className: "truncate text-xs text-muted-foreground", children: SAVED_VIEWS_UNAVAILABLE }) });
7014
7175
  }
7015
- if (error) return /* @__PURE__ */ jsx26(RefusalNotice, { error, className, actions: /* @__PURE__ */ jsx26(Button19, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" }) });
7176
+ if (error) return /* @__PURE__ */ jsx26(RefusalNotice, { error, className, actions: /* @__PURE__ */ jsx26(Button20, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" }) });
7016
7177
  if (home.loading || views === null) return /* @__PURE__ */ jsx26(Skeleton8, { className: cn20("h-7 w-64", className) });
7017
7178
  return /* @__PURE__ */ jsxs22("div", { className: cn20("flex items-center gap-1 overflow-x-auto", className), role: "group", "aria-label": "Saved views", children: [
7018
7179
  views.map((view) => /* @__PURE__ */ jsxs22(
7019
- Button19,
7180
+ Button20,
7020
7181
  {
7021
7182
  size: "sm",
7022
7183
  variant: view.id === active ? "secondary" : "ghost",
@@ -7053,18 +7214,18 @@ function ViewBar({ tableId, activeViewId, onActiveView, seed, className }) {
7053
7214
  placeholder: "View name"
7054
7215
  }
7055
7216
  ),
7056
- /* @__PURE__ */ jsx26(Button19, { size: "sm", type: "submit", children: "Save" })
7217
+ /* @__PURE__ */ jsx26(Button20, { size: "sm", type: "submit", children: "Save" })
7057
7218
  ]
7058
7219
  }
7059
- ) : /* @__PURE__ */ jsx26(Button19, { size: "sm", variant: "ghost", className: "ml-1", onClick: () => setNaming(true), children: "New view" }) : null,
7220
+ ) : /* @__PURE__ */ jsx26(Button20, { size: "sm", variant: "ghost", className: "ml-1", onClick: () => setNaming(true), children: "New view" }) : null,
7060
7221
  views.length === 0 && !rights.admin ? /* @__PURE__ */ jsx26("span", { className: "text-xs text-muted-foreground", children: rights.why("structure") }) : null
7061
7222
  ] });
7062
7223
  }
7063
7224
 
7064
7225
  // src/ProposalRow.tsx
7065
- import { useState as useState24 } from "react";
7226
+ import { useState as useState25 } from "react";
7066
7227
  import { useRecordsClient as useRecordsClient18 } from "@ai-matrx/records/react";
7067
- import { Badge as Badge7, Button as Button20, cn as cn21 } from "@ai-matrx/design-system";
7228
+ import { Badge as Badge7, Button as Button21, cn as cn21 } from "@ai-matrx/design-system";
7068
7229
  import { jsx as jsx27, jsxs as jsxs23 } from "react/jsx-runtime";
7069
7230
  var ACT_WORD = {
7070
7231
  add: "Add",
@@ -7081,9 +7242,9 @@ function ProposalRow({
7081
7242
  className
7082
7243
  }) {
7083
7244
  const client = useRecordsClient18();
7084
- const [settled, setSettled] = useState24(outcome ?? null);
7085
- const [busy, setBusy] = useState24(false);
7086
- const [confirming, setConfirming] = useState24(false);
7245
+ const [settled, setSettled] = useState25(outcome ?? null);
7246
+ const [busy, setBusy] = useState25(false);
7247
+ const [confirming, setConfirming] = useState25(false);
7087
7248
  async function applyThroughTheStore() {
7088
7249
  if (change.act === "add") {
7089
7250
  if (!change.table) {
@@ -7136,7 +7297,7 @@ function ProposalRow({
7136
7297
  }
7137
7298
  ) : readOnlyReason ? null : /* @__PURE__ */ jsxs23("span", { className: "flex shrink-0 items-center gap-1", children: [
7138
7299
  /* @__PURE__ */ jsx27(
7139
- Button20,
7300
+ Button21,
7140
7301
  {
7141
7302
  size: "sm",
7142
7303
  variant: "ghost",
@@ -7146,7 +7307,7 @@ function ProposalRow({
7146
7307
  }
7147
7308
  ),
7148
7309
  /* @__PURE__ */ jsx27(
7149
- Button20,
7310
+ Button21,
7150
7311
  {
7151
7312
  size: "sm",
7152
7313
  disabled: busy,
@@ -7160,22 +7321,22 @@ function ProposalRow({
7160
7321
  settled ? /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: settled.sentence }) : null,
7161
7322
  confirming ? /* @__PURE__ */ jsxs23("div", { className: "flex items-center gap-2 rounded bg-destructive/10 p-2 text-xs", children: [
7162
7323
  /* @__PURE__ */ jsx27("span", { className: "min-w-0 flex-1", children: "Accepting this deletes the record. It stays restorable for this table's retention, and after that it is gone." }),
7163
- /* @__PURE__ */ jsx27(Button20, { size: "sm", variant: "ghost", onClick: () => setConfirming(false), children: "Cancel" }),
7164
- /* @__PURE__ */ jsx27(Button20, { size: "sm", variant: "destructive", disabled: busy, onClick: () => void accept(), children: "Delete it" })
7324
+ /* @__PURE__ */ jsx27(Button21, { size: "sm", variant: "ghost", onClick: () => setConfirming(false), children: "Cancel" }),
7325
+ /* @__PURE__ */ jsx27(Button21, { size: "sm", variant: "destructive", disabled: busy, onClick: () => void accept(), children: "Delete it" })
7165
7326
  ] }) : null,
7166
7327
  readOnlyReason && !settled ? /* @__PURE__ */ jsx27("p", { className: "text-xs text-muted-foreground", children: readOnlyReason }) : null
7167
7328
  ] });
7168
7329
  }
7169
7330
 
7170
7331
  // src/ActionInbox.tsx
7171
- import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo19, useRef as useRef7, useState as useState26 } from "react";
7332
+ import { useCallback as useCallback13, useEffect as useEffect16, useMemo as useMemo19, useRef as useRef7, useState as useState27 } from "react";
7172
7333
  import { useRecordsClient as useRecordsClient20 } from "@ai-matrx/records/react";
7173
- import { Badge as Badge9, Button as Button22, Skeleton as Skeleton10, cn as cn23 } from "@ai-matrx/design-system";
7334
+ import { Badge as Badge9, Button as Button23, Skeleton as Skeleton10, cn as cn23 } from "@ai-matrx/design-system";
7174
7335
 
7175
7336
  // src/ChecklistRunner.tsx
7176
- import { useCallback as useCallback12, useEffect as useEffect15, useMemo as useMemo18, useState as useState25 } from "react";
7337
+ import { useCallback as useCallback12, useEffect as useEffect15, useMemo as useMemo18, useState as useState26 } from "react";
7177
7338
  import { useRecordsClient as useRecordsClient19, useTable as useTable9 } from "@ai-matrx/records/react";
7178
- import { Badge as Badge8, BasicInput as BasicInput7, BasicTextarea as BasicTextarea4, Button as Button21, Skeleton as Skeleton9, cn as cn22 } from "@ai-matrx/design-system";
7339
+ import { Badge as Badge8, BasicInput as BasicInput7, BasicTextarea as BasicTextarea4, Button as Button22, Skeleton as Skeleton9, cn as cn22 } from "@ai-matrx/design-system";
7179
7340
  import { Fragment as Fragment12, jsx as jsx28, jsxs as jsxs24 } from "react/jsx-runtime";
7180
7341
  var DUE_WORD = {
7181
7342
  overdue: "Overdue",
@@ -7204,13 +7365,13 @@ function ChecklistRunner({
7204
7365
  const client = useRecordsClient19();
7205
7366
  const table = useTable9(tableId ?? null);
7206
7367
  const rights = useTableRights(table.data);
7207
- const [runs, setRuns] = useState25(null);
7208
- const [activeId, setActiveId] = useState25(runId ?? null);
7209
- const [steps, setSteps] = useState25(null);
7210
- const [templates, setTemplates] = useState25(null);
7211
- const [error, setError] = useState25(null);
7212
- const [busy, setBusy] = useState25(null);
7213
- const [said, setSaid] = useState25(null);
7368
+ const [runs, setRuns] = useState26(null);
7369
+ const [activeId, setActiveId] = useState26(runId ?? null);
7370
+ const [steps, setSteps] = useState26(null);
7371
+ const [templates, setTemplates] = useState26(null);
7372
+ const [error, setError] = useState26(null);
7373
+ const [busy, setBusy] = useState26(null);
7374
+ const [said, setSaid] = useState26(null);
7214
7375
  const mayStart = offerToStart ?? Boolean(recordId);
7215
7376
  const loadRuns = useCallback12(async () => {
7216
7377
  if (runId) {
@@ -7357,7 +7518,7 @@ function ChecklistRunner({
7357
7518
  mayStart && rights.write && templates && templates.length > 0 ? /* @__PURE__ */ jsxs24("div", { className: "flex flex-wrap items-center gap-1.5 border-t pt-2", children: [
7358
7519
  /* @__PURE__ */ jsx28("span", { className: "text-xs text-muted-foreground", children: "Start:" }),
7359
7520
  templates.map((t) => /* @__PURE__ */ jsx28(
7360
- Button21,
7521
+ Button22,
7361
7522
  {
7362
7523
  size: "sm",
7363
7524
  variant: "outline",
@@ -7377,7 +7538,7 @@ function StepRow({
7377
7538
  onComplete,
7378
7539
  className
7379
7540
  }) {
7380
- const [answer, setAnswer] = useState25("");
7541
+ const [answer, setAnswer] = useState26("");
7381
7542
  const key = step2.requires_key ?? (step2.requires === "note" ? "note" : null);
7382
7543
  const asksHere = step2.requires === "note" || step2.requires === "answer";
7383
7544
  const needsAnswer = asksHere && answer.trim().length === 0;
@@ -7434,7 +7595,7 @@ function StepRow({
7434
7595
  ) : null,
7435
7596
  step2.requires === "record_field" || step2.requires === "form" || step2.requires === "document" ? /* @__PURE__ */ jsx28("span", { className: "flex-1 text-[11px] text-muted-foreground", children: step2.requires_label ?? REQUIRES_WORD[step2.requires] }) : null,
7436
7597
  /* @__PURE__ */ jsx28(
7437
- Button21,
7598
+ Button22,
7438
7599
  {
7439
7600
  size: "sm",
7440
7601
  className: "h-7 px-2 text-[11px]",
@@ -7452,9 +7613,9 @@ function StepRow({
7452
7613
  function useMyChecklistSteps(limit = 25) {
7453
7614
  const client = useRecordsClient19();
7454
7615
  const me = client.config.actor.user_id ?? null;
7455
- const [steps, setSteps] = useState25([]);
7456
- const [loading, setLoading] = useState25(true);
7457
- const [error, setError] = useState25(null);
7616
+ const [steps, setSteps] = useState26([]);
7617
+ const [loading, setLoading] = useState26(true);
7618
+ const [error, setError] = useState26(null);
7458
7619
  const refresh = useCallback12(async () => {
7459
7620
  if (!me) {
7460
7621
  setSteps([]);
@@ -7491,8 +7652,8 @@ function useMyChecklistSteps(limit = 25) {
7491
7652
  function MyChecklistSteps({ className }) {
7492
7653
  const client = useRecordsClient19();
7493
7654
  const { steps, loading, error, refresh } = useMyChecklistSteps();
7494
- const [busy, setBusy] = useState25(null);
7495
- const [refusal, setRefusal] = useState25(null);
7655
+ const [busy, setBusy] = useState26(null);
7656
+ const [refusal, setRefusal] = useState26(null);
7496
7657
  const complete = useCallback12(
7497
7658
  async (step2, evidence) => {
7498
7659
  setBusy(step2.step_id);
@@ -7531,11 +7692,11 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
7531
7692
  const client = useRecordsClient19();
7532
7693
  const table = useTable9(tableId);
7533
7694
  const rights = useTableRights(table.data);
7534
- const [templates, setTemplates] = useState25(null);
7535
- const [runs, setRuns] = useState25(null);
7536
- const [error, setError] = useState25(null);
7537
- const [editing, setEditing] = useState25(null);
7538
- const [openRun, setOpenRun] = useState25(null);
7695
+ const [templates, setTemplates] = useState26(null);
7696
+ const [runs, setRuns] = useState26(null);
7697
+ const [error, setError] = useState26(null);
7698
+ const [editing, setEditing] = useState26(null);
7699
+ const [openRun, setOpenRun] = useState26(null);
7539
7700
  const load = useCallback12(async () => {
7540
7701
  const [t, r] = await Promise.all([
7541
7702
  client.checklistTemplates({ about_table_id: tableId, limit: 100 }),
@@ -7570,7 +7731,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
7570
7731
  }
7571
7732
  if (openRun) {
7572
7733
  return /* @__PURE__ */ jsxs24("div", { className: cn22("flex flex-col gap-2", className), children: [
7573
- /* @__PURE__ */ jsx28(Button21, { size: "sm", variant: "ghost", className: "self-start", onClick: () => setOpenRun(null), children: "Back to checklists" }),
7734
+ /* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "ghost", className: "self-start", onClick: () => setOpenRun(null), children: "Back to checklists" }),
7574
7735
  /* @__PURE__ */ jsx28(ChecklistRunner, { tableId, runId: openRun, offerToStart: false })
7575
7736
  ] });
7576
7737
  }
@@ -7578,7 +7739,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
7578
7739
  /* @__PURE__ */ jsxs24("header", { className: "flex items-center gap-2", children: [
7579
7740
  /* @__PURE__ */ jsx28("h3", { className: "text-sm font-medium", children: "Checklists" }),
7580
7741
  /* @__PURE__ */ jsx28("span", { className: "text-xs text-muted-foreground", children: templates.length === 0 ? "none yet" : `${templates.length}` }),
7581
- rights.structure ? /* @__PURE__ */ jsx28(Button21, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Write one" }) : null
7742
+ rights.structure ? /* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "outline", className: "ml-auto", onClick: () => setEditing("new"), children: "Write one" }) : null
7582
7743
  ] }),
7583
7744
  error ? /* @__PURE__ */ jsx28(RefusalNotice, { error }) : null,
7584
7745
  templates.length === 0 ? /* @__PURE__ */ jsx28("p", { className: "text-xs text-muted-foreground", children: NO_TEMPLATES }) : null,
@@ -7605,7 +7766,7 @@ function ChecklistsPanel({ tableId, onOpenRecord, className }) {
7605
7766
  ] })
7606
7767
  ] }),
7607
7768
  rights.structure ? /* @__PURE__ */ jsx28(
7608
- Button21,
7769
+ Button22,
7609
7770
  {
7610
7771
  size: "sm",
7611
7772
  variant: "ghost",
@@ -7690,12 +7851,12 @@ function ChecklistTemplateEditor({
7690
7851
  className
7691
7852
  }) {
7692
7853
  const client = useRecordsClient19();
7693
- const [name, setName] = useState25("");
7694
- const [rows, setRows] = useState25([{ ...EMPTY_ROW }]);
7695
- const [refusal, setRefusal] = useState25(null);
7696
- const [error, setError] = useState25(null);
7697
- const [busy, setBusy] = useState25(false);
7698
- const [loading, setLoading] = useState25(Boolean(templateId));
7854
+ const [name, setName] = useState26("");
7855
+ const [rows, setRows] = useState26([{ ...EMPTY_ROW }]);
7856
+ const [refusal, setRefusal] = useState26(null);
7857
+ const [error, setError] = useState26(null);
7858
+ const [busy, setBusy] = useState26(false);
7859
+ const [loading, setLoading] = useState26(Boolean(templateId));
7699
7860
  useEffect15(() => {
7700
7861
  if (!templateId) return;
7701
7862
  let cancelled = false;
@@ -7766,7 +7927,7 @@ function ChecklistTemplateEditor({
7766
7927
  return /* @__PURE__ */ jsxs24("section", { className: cn22("flex flex-col gap-2", className), "data-testid": "checklist-editor", children: [
7767
7928
  /* @__PURE__ */ jsxs24("header", { className: "flex items-center gap-2", children: [
7768
7929
  /* @__PURE__ */ jsx28("h3", { className: "text-sm font-medium", children: templateId ? "Change this checklist" : "Write a checklist" }),
7769
- /* @__PURE__ */ jsx28(Button21, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => onDone?.(), children: "Cancel" })
7930
+ /* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "ghost", className: "ml-auto", onClick: () => onDone?.(), children: "Cancel" })
7770
7931
  ] }),
7771
7932
  /* @__PURE__ */ jsx28(
7772
7933
  BasicInput7,
@@ -7793,7 +7954,7 @@ function ChecklistTemplateEditor({
7793
7954
  }
7794
7955
  ),
7795
7956
  /* @__PURE__ */ jsx28(
7796
- Button21,
7957
+ Button22,
7797
7958
  {
7798
7959
  size: "sm",
7799
7960
  variant: "ghost",
@@ -7859,8 +8020,8 @@ function ChecklistTemplateEditor({
7859
8020
  ] })
7860
8021
  ] }, index)) }),
7861
8022
  /* @__PURE__ */ jsxs24("div", { className: "flex items-center gap-1.5", children: [
7862
- /* @__PURE__ */ jsx28(Button21, { size: "sm", variant: "outline", onClick: () => setRows((held) => [...held, { ...EMPTY_ROW }]), children: "Add a step" }),
7863
- /* @__PURE__ */ jsx28(Button21, { size: "sm", disabled: busy || refusal !== null || spec.steps.length === 0, onClick: () => void save(), children: busy ? "\u2026" : "Save" })
8023
+ /* @__PURE__ */ jsx28(Button22, { size: "sm", variant: "outline", onClick: () => setRows((held) => [...held, { ...EMPTY_ROW }]), children: "Add a step" }),
8024
+ /* @__PURE__ */ jsx28(Button22, { size: "sm", disabled: busy || refusal !== null || spec.steps.length === 0, onClick: () => void save(), children: busy ? "\u2026" : "Save" })
7864
8025
  ] }),
7865
8026
  refusal ? /* @__PURE__ */ jsx28("p", { className: "text-xs text-muted-foreground", "data-testid": "checklist-editor-refusal", children: refusal }) : null
7866
8027
  ] });
@@ -7913,11 +8074,11 @@ var DUE_WORD2 = {
7913
8074
  };
7914
8075
  function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className }) {
7915
8076
  const client = useRecordsClient20();
7916
- const [items, setItems] = useState26(null);
7917
- const [error, setError] = useState26(null);
7918
- const [outcome, setOutcome] = useState26({});
7919
- const [busy, setBusy] = useState26(null);
7920
- const [cursor, setCursor] = useState26(0);
8077
+ const [items, setItems] = useState27(null);
8078
+ const [error, setError] = useState27(null);
8079
+ const [outcome, setOutcome] = useState27({});
8080
+ const [busy, setBusy] = useState27(null);
8081
+ const [cursor, setCursor] = useState27(0);
7921
8082
  const listRef = useRef7(null);
7922
8083
  const load = useCallback13(async () => {
7923
8084
  const result = await client.workInbox({ limit: 200, includeDecided: includeSettled });
@@ -8002,7 +8163,7 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
8002
8163
  /* @__PURE__ */ jsx29("h3", { className: "text-sm font-medium", children: "Inbox" }),
8003
8164
  /* @__PURE__ */ jsx29("span", { className: "text-xs text-muted-foreground", children: shown.length }),
8004
8165
  /* @__PURE__ */ jsx29("span", { className: "ml-auto hidden text-[10px] text-muted-foreground sm:inline", children: "j/k move \xB7 a approve \xB7 d decline \xB7 o open \xB7 r refresh" }),
8005
- /* @__PURE__ */ jsx29(Button22, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Refresh" })
8166
+ /* @__PURE__ */ jsx29(Button23, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Refresh" })
8006
8167
  ] }),
8007
8168
  error ? /* @__PURE__ */ jsx29(RefusalNotice, { error }) : null,
8008
8169
  shown.length === 0 ? /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: includeSettled ? "Nothing has come through this inbox yet." : "Nothing is waiting on you." }) : /* @__PURE__ */ jsx29("ol", { ref: listRef, className: "flex min-h-0 flex-col gap-1 overflow-y-auto", children: shown.map((item, index) => {
@@ -8030,12 +8191,12 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
8030
8191
  children: DUE_WORD2[item.due_state] ?? item.due_state
8031
8192
  }
8032
8193
  ) : null,
8033
- item.subject_id && onOpenRecord ? /* @__PURE__ */ jsx29(Button22, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: () => open(item), children: "Open" }) : null
8194
+ item.subject_id && onOpenRecord ? /* @__PURE__ */ jsx29(Button23, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: () => open(item), children: "Open" }) : null
8034
8195
  ] }),
8035
8196
  item.summary ? /* @__PURE__ */ jsx29("p", { className: "text-xs text-muted-foreground", children: item.summary }) : null,
8036
8197
  settled ? /* @__PURE__ */ jsx29("p", { className: "text-xs", children: settled }) : item.kind === "assignment" ? /* @__PURE__ */ jsx29("p", { className: "text-[11px] text-muted-foreground", children: item.state === "open" ? "Waiting on you." : `${item.state}.` }) : item.actionable ? /* @__PURE__ */ jsxs25("div", { className: "flex items-center gap-1", children: [
8037
8198
  /* @__PURE__ */ jsx29(
8038
- Button22,
8199
+ Button23,
8039
8200
  {
8040
8201
  size: "sm",
8041
8202
  variant: "ghost",
@@ -8044,7 +8205,7 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
8044
8205
  children: "Decline"
8045
8206
  }
8046
8207
  ),
8047
- /* @__PURE__ */ jsx29(Button22, { size: "sm", disabled: busy === item.item_id, onClick: () => void decide(item, true), children: "Approve" }),
8208
+ /* @__PURE__ */ jsx29(Button23, { size: "sm", disabled: busy === item.item_id, onClick: () => void decide(item, true), children: "Approve" }),
8048
8209
  item.requested_by_name ? /* @__PURE__ */ jsxs25("span", { className: "text-[11px] text-muted-foreground", children: [
8049
8210
  item.origin === "agent" ? "An agent asked, for " : "Asked by ",
8050
8211
  item.requested_by_name
@@ -8066,24 +8227,24 @@ function ActionInbox({ tableId, includeSettled = false, onOpenRecord, className
8066
8227
  }
8067
8228
 
8068
8229
  // src/HistoryPanel.tsx
8069
- import { useCallback as useCallback14, useEffect as useEffect17, useRef as useRef8, useState as useState27 } from "react";
8230
+ import { useCallback as useCallback14, useEffect as useEffect17, useRef as useRef8, useState as useState28 } from "react";
8070
8231
  import {
8071
8232
  useFields as useFields12,
8072
8233
  useRecordsClient as useRecordsClient21,
8073
8234
  useTable as useTable10
8074
8235
  } from "@ai-matrx/records/react";
8075
- import { Badge as Badge10, Button as Button23, Skeleton as Skeleton11, cn as cn24 } from "@ai-matrx/design-system";
8236
+ import { Badge as Badge10, Button as Button24, Skeleton as Skeleton11, cn as cn24 } from "@ai-matrx/design-system";
8076
8237
  import { jsx as jsx30, jsxs as jsxs26 } from "react/jsx-runtime";
8077
8238
  function HistoryPanel({ tableId, recordId, onAskAboutField, className }) {
8078
8239
  const client = useRecordsClient21();
8079
8240
  const table = useTable10(tableId);
8080
8241
  const fields = useFields12(tableId);
8081
8242
  const rights = useTableRights(table.data);
8082
- const [entries, setEntries] = useState27(null);
8083
- const [error, setError] = useState27(null);
8084
- const [open, setOpen] = useState27(null);
8085
- const [pending, setPending] = useState27({ phase: "idle" });
8086
- const [said, setSaid] = useState27(null);
8243
+ const [entries, setEntries] = useState28(null);
8244
+ const [error, setError] = useState28(null);
8245
+ const [open, setOpen] = useState28(null);
8246
+ const [pending, setPending] = useState28({ phase: "idle" });
8247
+ const [said, setSaid] = useState28(null);
8087
8248
  const listRef = useRef8(null);
8088
8249
  const load = useCallback14(async () => {
8089
8250
  const answered = await client.recordHistory({ record_id: recordId });
@@ -8257,7 +8418,7 @@ function VersionRow({
8257
8418
  onCancel
8258
8419
  }
8259
8420
  ) : mine && pending.phase === "writing" ? /* @__PURE__ */ jsx30("p", { className: "text-[11px] text-muted-foreground", children: "Putting it back\u2026" }) : /* @__PURE__ */ jsx30("div", { className: "flex", children: /* @__PURE__ */ jsx30(
8260
- Button23,
8421
+ Button24,
8261
8422
  {
8262
8423
  size: "sm",
8263
8424
  variant: "secondary",
@@ -8317,7 +8478,7 @@ function ChangeLine({
8317
8478
  }
8318
8479
  ) : null,
8319
8480
  onAskAboutField ? /* @__PURE__ */ jsx30(
8320
- Button23,
8481
+ Button24,
8321
8482
  {
8322
8483
  size: "sm",
8323
8484
  variant: "ghost",
@@ -8326,7 +8487,7 @@ function ChangeLine({
8326
8487
  children: "Who changed this?"
8327
8488
  }
8328
8489
  ) : null,
8329
- canRestore ? /* @__PURE__ */ jsx30(Button23, { size: "sm", variant: "ghost", className: "h-5 shrink-0 px-1 text-[10px]", onClick: onRestore, children: "Put this one back" }) : null
8490
+ canRestore ? /* @__PURE__ */ jsx30(Button24, { size: "sm", variant: "ghost", className: "h-5 shrink-0 px-1 text-[10px]", onClick: onRestore, children: "Put this one back" }) : null
8330
8491
  ] });
8331
8492
  }
8332
8493
  function ConfirmRestore({
@@ -8346,8 +8507,8 @@ function ConfirmRestore({
8346
8507
  ] }, change.key)) }),
8347
8508
  /* @__PURE__ */ jsx30("p", { className: "text-[11px] text-muted-foreground", children: "It is saved as a new version. Nothing in the history is erased, and this can be put back too." }),
8348
8509
  /* @__PURE__ */ jsxs26("div", { className: "flex gap-1", children: [
8349
- /* @__PURE__ */ jsx30(Button23, { size: "sm", className: "h-6 px-2 text-[11px]", disabled: busy || preview.count === 0, onClick: onConfirm, children: busy ? "Putting it back\u2026" : "Yes, put it back" }),
8350
- /* @__PURE__ */ jsx30(Button23, { size: "sm", variant: "ghost", className: "h-6 px-2 text-[11px]", onClick: onCancel, children: "Cancel" })
8510
+ /* @__PURE__ */ jsx30(Button24, { size: "sm", className: "h-6 px-2 text-[11px]", disabled: busy || preview.count === 0, onClick: onConfirm, children: busy ? "Putting it back\u2026" : "Yes, put it back" }),
8511
+ /* @__PURE__ */ jsx30(Button24, { size: "sm", variant: "ghost", className: "h-6 px-2 text-[11px]", onClick: onCancel, children: "Cancel" })
8351
8512
  ] })
8352
8513
  ] });
8353
8514
  }
@@ -8375,29 +8536,29 @@ function say(value, field) {
8375
8536
  }
8376
8537
 
8377
8538
  // src/CommentThread.tsx
8378
- import { useCallback as useCallback15, useEffect as useEffect18, useMemo as useMemo20, useRef as useRef9, useState as useState28 } from "react";
8539
+ import { useCallback as useCallback15, useEffect as useEffect18, useMemo as useMemo20, useRef as useRef9, useState as useState29 } from "react";
8379
8540
  import {
8380
8541
  useFields as useFields13,
8381
8542
  useRecordsClient as useRecordsClient22,
8382
8543
  useTable as useTable11
8383
8544
  } from "@ai-matrx/records/react";
8384
- import { Badge as Badge11, Button as Button24, Skeleton as Skeleton12, Textarea, cn as cn25 } from "@ai-matrx/design-system";
8545
+ import { Badge as Badge11, Button as Button25, Skeleton as Skeleton12, Textarea, cn as cn25 } from "@ai-matrx/design-system";
8385
8546
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
8386
8547
  function CommentThread({ tableId, recordId, fieldKey, className }) {
8387
8548
  const client = useRecordsClient22();
8388
8549
  const table = useTable11(tableId);
8389
8550
  const fields = useFields13(tableId);
8390
8551
  const host = useRecordsUi();
8391
- const [thread, setThread] = useState28(null);
8392
- const [error, setError] = useState28(null);
8393
- const [draft, setDraft] = useState28("");
8394
- const [replyTo, setReplyTo] = useState28(null);
8395
- const [busy, setBusy] = useState28(false);
8396
- const [said, setSaid] = useState28(null);
8397
- const [showResolved, setShowResolved] = useState28(false);
8398
- const [people, setPeople] = useState28([]);
8399
- const [mentionQuery, setMentionQuery] = useState28(null);
8400
- const [picked, setPicked] = useState28([]);
8552
+ const [thread, setThread] = useState29(null);
8553
+ const [error, setError] = useState29(null);
8554
+ const [draft, setDraft] = useState29("");
8555
+ const [replyTo, setReplyTo] = useState29(null);
8556
+ const [busy, setBusy] = useState29(false);
8557
+ const [said, setSaid] = useState29(null);
8558
+ const [showResolved, setShowResolved] = useState29(false);
8559
+ const [people, setPeople] = useState29([]);
8560
+ const [mentionQuery, setMentionQuery] = useState29(null);
8561
+ const [picked, setPicked] = useState29([]);
8401
8562
  const box = useRef9(null);
8402
8563
  const load = useCallback15(async () => {
8403
8564
  const answered = await client.commentThread({ record_id: recordId, include_resolved: showResolved });
@@ -8486,7 +8647,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
8486
8647
  /* @__PURE__ */ jsx31("h3", { className: "text-sm font-medium", children: fieldLabel ? `Comments on ${fieldLabel}` : "Comments" }),
8487
8648
  /* @__PURE__ */ jsx31("span", { className: "text-xs text-muted-foreground", children: shown.length }),
8488
8649
  /* @__PURE__ */ jsx31(
8489
- Button24,
8650
+ Button25,
8490
8651
  {
8491
8652
  size: "sm",
8492
8653
  variant: "ghost",
@@ -8520,7 +8681,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
8520
8681
  children: [
8521
8682
  replyTo ? /* @__PURE__ */ jsxs27("span", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
8522
8683
  "Replying",
8523
- /* @__PURE__ */ jsx31(Button24, { size: "sm", variant: "ghost", className: "h-5 px-1", type: "button", onClick: () => setReplyTo(null), children: "Cancel" })
8684
+ /* @__PURE__ */ jsx31(Button25, { size: "sm", variant: "ghost", className: "h-5 px-1", type: "button", onClick: () => setReplyTo(null), children: "Cancel" })
8524
8685
  ] }) : null,
8525
8686
  picked.length > 0 ? /* @__PURE__ */ jsx31("div", { className: "flex flex-wrap gap-1", children: picked.map((p) => /* @__PURE__ */ jsxs27(Badge11, { variant: "secondary", className: "text-[10px]", children: [
8526
8687
  p.name,
@@ -8578,7 +8739,7 @@ function CommentThread({ tableId, recordId, fieldKey, className }) {
8578
8739
  ) }, p.userId)) }) : null,
8579
8740
  /* @__PURE__ */ jsxs27("div", { className: "flex items-center gap-2", children: [
8580
8741
  !host.members ? /* @__PURE__ */ jsx31("span", { className: "text-[11px] text-muted-foreground", children: "Naming somebody needs this screen to know who is in the organization, and it has not been told." }) : null,
8581
- /* @__PURE__ */ jsx31(Button24, { size: "sm", type: "submit", className: "ml-auto h-6 px-2 text-[11px]", disabled: busy || draft.trim() === "", children: busy ? "Posting\u2026" : "Comment" })
8742
+ /* @__PURE__ */ jsx31(Button25, { size: "sm", type: "submit", className: "ml-auto h-6 px-2 text-[11px]", disabled: busy || draft.trim() === "", children: busy ? "Posting\u2026" : "Comment" })
8582
8743
  ] })
8583
8744
  ]
8584
8745
  }
@@ -8605,8 +8766,8 @@ function Line({
8605
8766
  comment.resolved_by_name ? ` by ${comment.resolved_by_name}` : ""
8606
8767
  ] }) : null,
8607
8768
  /* @__PURE__ */ jsxs27("span", { className: "ml-auto flex gap-1", children: [
8608
- onReply ? /* @__PURE__ */ jsx31(Button24, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: onReply, children: "Reply" }) : null,
8609
- onResolve ? /* @__PURE__ */ jsx31(Button24, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: onResolve, children: comment.resolved_at ? "Re-open" : "Resolve" }) : null
8769
+ onReply ? /* @__PURE__ */ jsx31(Button25, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: onReply, children: "Reply" }) : null,
8770
+ onResolve ? /* @__PURE__ */ jsx31(Button25, { size: "sm", variant: "ghost", className: "h-5 px-1 text-[11px]", onClick: onResolve, children: comment.resolved_at ? "Re-open" : "Resolve" }) : null
8610
8771
  ] })
8611
8772
  ] }),
8612
8773
  /* @__PURE__ */ jsx31("p", { className: "whitespace-pre-wrap text-xs", children: comment.body }),
@@ -8618,13 +8779,13 @@ function Line({
8618
8779
  }
8619
8780
 
8620
8781
  // src/FieldHistoryPanel.tsx
8621
- import { useCallback as useCallback16, useEffect as useEffect19, useState as useState29 } from "react";
8782
+ import { useCallback as useCallback16, useEffect as useEffect19, useState as useState30 } from "react";
8622
8783
  import {
8623
8784
  useFields as useFields14,
8624
8785
  useRecordsClient as useRecordsClient23,
8625
8786
  useTable as useTable12
8626
8787
  } from "@ai-matrx/records/react";
8627
- import { Badge as Badge12, Button as Button25, Skeleton as Skeleton13, cn as cn26 } from "@ai-matrx/design-system";
8788
+ import { Badge as Badge12, Button as Button26, Skeleton as Skeleton13, cn as cn26 } from "@ai-matrx/design-system";
8628
8789
  import { Fragment as Fragment13, jsx as jsx32, jsxs as jsxs28 } from "react/jsx-runtime";
8629
8790
  function FieldHistoryPanel({
8630
8791
  tableId,
@@ -8638,10 +8799,10 @@ function FieldHistoryPanel({
8638
8799
  const table = useTable12(tableId);
8639
8800
  const fields = useFields14(tableId);
8640
8801
  const rights = useTableRights(table.data);
8641
- const [rows, setRows] = useState29(null);
8642
- const [error, setError] = useState29(null);
8643
- const [pending, setPending] = useState29({ phase: "idle" });
8644
- const [said, setSaid] = useState29(null);
8802
+ const [rows, setRows] = useState30(null);
8803
+ const [error, setError] = useState30(null);
8804
+ const [pending, setPending] = useState30({ phase: "idle" });
8805
+ const [said, setSaid] = useState30(null);
8645
8806
  const load = useCallback16(async () => {
8646
8807
  const answered = await client.fieldHistory(
8647
8808
  recordId ? { table_id: tableId, field_key: fieldKey, record_id: recordId } : { table_id: tableId, field_key: fieldKey }
@@ -8693,7 +8854,7 @@ function FieldHistoryPanel({
8693
8854
  "?"
8694
8855
  ] }),
8695
8856
  /* @__PURE__ */ jsx32("span", { className: "text-xs text-muted-foreground", children: recordId ? "on this record" : "on every record you can see" }),
8696
- onClose ? /* @__PURE__ */ jsx32(Button25, { size: "sm", variant: "ghost", className: "ml-auto h-6 px-2 text-[11px]", onClick: onClose, children: "Close" }) : null
8857
+ onClose ? /* @__PURE__ */ jsx32(Button26, { size: "sm", variant: "ghost", className: "ml-auto h-6 px-2 text-[11px]", onClick: onClose, children: "Close" }) : null
8697
8858
  ] }),
8698
8859
  said ? /* @__PURE__ */ jsx32("p", { role: "status", className: "text-xs text-muted-foreground", children: said }) : null,
8699
8860
  rows.length === 0 ? /* @__PURE__ */ jsxs28("p", { className: "text-xs text-muted-foreground", children: [
@@ -8705,7 +8866,7 @@ function FieldHistoryPanel({
8705
8866
  return /* @__PURE__ */ jsxs28("li", { className: "flex flex-col", children: [
8706
8867
  /* @__PURE__ */ jsxs28("div", { className: "flex items-baseline gap-2 px-2 py-1.5 text-xs", children: [
8707
8868
  onOpenRecord ? /* @__PURE__ */ jsx32(
8708
- Button25,
8869
+ Button26,
8709
8870
  {
8710
8871
  size: "sm",
8711
8872
  variant: "ghost",
@@ -8734,7 +8895,7 @@ function FieldHistoryPanel({
8734
8895
  }
8735
8896
  ),
8736
8897
  rights.write ? /* @__PURE__ */ jsx32(
8737
- Button25,
8898
+ Button26,
8738
8899
  {
8739
8900
  size: "sm",
8740
8901
  variant: "ghost",
@@ -8846,27 +9007,27 @@ function submissionStamp(args) {
8846
9007
  }
8847
9008
 
8848
9009
  // src/PortalBuilder.tsx
8849
- import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo21, useState as useState30 } from "react";
9010
+ import { useCallback as useCallback17, useEffect as useEffect20, useMemo as useMemo21, useState as useState31 } from "react";
8850
9011
  import { useRecordsClient as useRecordsClient24, useTables as useTables2 } from "@ai-matrx/records/react";
8851
- import { BasicInput as BasicInput8, Button as Button26, Checkbox as Checkbox4, Label as Label4, Separator as Separator9, Skeleton as Skeleton14, cn as cn27 } from "@ai-matrx/design-system";
9012
+ import { BasicInput as BasicInput8, Button as Button27, Checkbox as Checkbox4, Label as Label4, Separator as Separator9, Skeleton as Skeleton14, cn as cn27 } from "@ai-matrx/design-system";
8852
9013
  import { Fragment as Fragment14, jsx as jsx33, jsxs as jsxs29 } from "react/jsx-runtime";
8853
9014
  var RESTATING_REPLACES = "Saving replaces what this portal shows: a table you untick stops being visible to every client the moment you save. Who is invited is not touched.";
8854
9015
  function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
8855
9016
  const client = useRecordsClient24();
8856
9017
  const tables = useTables2();
8857
- const [title, setTitle] = useState30("");
8858
- const [clientTableId, setClientTableId] = useState30(null);
8859
- const [exposures, setExposures] = useState30({});
8860
- const [fieldsByTable, setFieldsByTable] = useState30({});
8861
- const [error, setError] = useState30(null);
8862
- const [saving, setSaving] = useState30(false);
8863
- const [savedId, setSavedId] = useState30(portalId ?? null);
8864
- const [existing, setExisting] = useState30(null);
8865
- const [loading, setLoading] = useState30(Boolean(portalId));
8866
- const [inviteEmail, setInviteEmail] = useState30("");
8867
- const [inviteRecordId, setInviteRecordId] = useState30("");
8868
- const [inviting, setInviting] = useState30(false);
8869
- const [invitationSaid, setInvitationSaid] = useState30(null);
9018
+ const [title, setTitle] = useState31("");
9019
+ const [clientTableId, setClientTableId] = useState31(null);
9020
+ const [exposures, setExposures] = useState31({});
9021
+ const [fieldsByTable, setFieldsByTable] = useState31({});
9022
+ const [error, setError] = useState31(null);
9023
+ const [saving, setSaving] = useState31(false);
9024
+ const [savedId, setSavedId] = useState31(portalId ?? null);
9025
+ const [existing, setExisting] = useState31(null);
9026
+ const [loading, setLoading] = useState31(Boolean(portalId));
9027
+ const [inviteEmail, setInviteEmail] = useState31("");
9028
+ const [inviteRecordId, setInviteRecordId] = useState31("");
9029
+ const [inviting, setInviting] = useState31(false);
9030
+ const [invitationSaid, setInvitationSaid] = useState31(null);
8870
9031
  const loadFields = useCallback17(
8871
9032
  async (id) => {
8872
9033
  if (fieldsByTable[id]) return;
@@ -8969,8 +9130,8 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
8969
9130
  /* @__PURE__ */ jsxs29("header", { className: "flex items-center gap-2", children: [
8970
9131
  /* @__PURE__ */ jsx33("h3", { className: "text-sm font-medium", children: existing ? "Portal" : "New client portal" }),
8971
9132
  /* @__PURE__ */ jsx33("div", { className: "flex-1" }),
8972
- /* @__PURE__ */ jsx33(Button26, { size: "sm", disabled: saving || !ready, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" }),
8973
- onClose ? /* @__PURE__ */ jsx33(Button26, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
9133
+ /* @__PURE__ */ jsx33(Button27, { size: "sm", disabled: saving || !ready, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" }),
9134
+ onClose ? /* @__PURE__ */ jsx33(Button27, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
8974
9135
  ] }),
8975
9136
  error ? /* @__PURE__ */ jsx33(RefusalNotice, { error }) : null,
8976
9137
  /* @__PURE__ */ jsxs29("label", { className: "flex flex-col gap-1", children: [
@@ -9125,7 +9286,7 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
9125
9286
  )
9126
9287
  ] }),
9127
9288
  /* @__PURE__ */ jsx33(
9128
- Button26,
9289
+ Button27,
9129
9290
  {
9130
9291
  size: "sm",
9131
9292
  disabled: inviting || inviteEmail.trim() === "" || inviteRecordId.trim() === "",
@@ -9141,15 +9302,15 @@ function PortalBuilder({ tableId, portalId, onSaved, onClose, className }) {
9141
9302
  }
9142
9303
 
9143
9304
  // src/PortalsPanel.tsx
9144
- import { useCallback as useCallback18, useEffect as useEffect21, useMemo as useMemo22, useState as useState31 } from "react";
9305
+ import { useCallback as useCallback18, useEffect as useEffect21, useMemo as useMemo22, useState as useState32 } from "react";
9145
9306
  import { useRecordsClient as useRecordsClient25 } from "@ai-matrx/records/react";
9146
9307
  import {
9147
9308
  portalPath
9148
9309
  } from "@ai-matrx/records";
9149
- import { Badge as Badge13, BasicInput as BasicInput9, Button as Button28, Separator as Separator10, Skeleton as Skeleton15, cn as cn29 } from "@ai-matrx/design-system";
9310
+ import { Badge as Badge13, BasicInput as BasicInput9, Button as Button29, Separator as Separator10, Skeleton as Skeleton15, cn as cn29 } from "@ai-matrx/design-system";
9150
9311
 
9151
9312
  // src/BuildOrAsk.tsx
9152
- import { Button as Button27, cn as cn28 } from "@ai-matrx/design-system";
9313
+ import { Button as Button28, cn as cn28 } from "@ai-matrx/design-system";
9153
9314
  import { jsx as jsx34, jsxs as jsxs30 } from "react/jsx-runtime";
9154
9315
  var NO_AGENT_PORT = "Asking for one in words needs an agent, which this screen reaches through its host's `onAskForOne` port \u2014 it is not bound here, so build it below instead.";
9155
9316
  function BuildOrAsk({
@@ -9165,8 +9326,8 @@ function BuildOrAsk({
9165
9326
  return /* @__PURE__ */ jsxs30("div", { className: cn28("rounded-md border border-dashed p-3", className), children: [
9166
9327
  /* @__PURE__ */ jsx34("p", { className: "text-xs text-muted-foreground", children }),
9167
9328
  /* @__PURE__ */ jsxs30("div", { className: "mt-2.5 flex flex-wrap items-center gap-2", children: [
9168
- onAsk ? /* @__PURE__ */ jsx34(Button27, { size: "sm", variant: "outline", onClick: onAsk, children: "Ask an agent" }) : null,
9169
- mayBuild ? /* @__PURE__ */ jsx34(Button27, { size: "sm", onClick: onBuild, children: buildLabel }) : null
9329
+ onAsk ? /* @__PURE__ */ jsx34(Button28, { size: "sm", variant: "outline", onClick: onAsk, children: "Ask an agent" }) : null,
9330
+ mayBuild ? /* @__PURE__ */ jsx34(Button28, { size: "sm", onClick: onBuild, children: buildLabel }) : null
9170
9331
  ] }),
9171
9332
  onAsk ? /* @__PURE__ */ jsxs30("p", { className: "mt-2 text-xs text-muted-foreground", children: [
9172
9333
  "You would say something like: \u201C",
@@ -9211,10 +9372,10 @@ var PORTAL_SUGGESTION = "Let each of my customers sign in and see their own jobs
9211
9372
  function PortalsPanel({ tableId, className }) {
9212
9373
  const client = useRecordsClient25();
9213
9374
  const host = useRecordsUi();
9214
- const [portals, setPortals] = useState31(null);
9215
- const [listError, setListError] = useState31(null);
9216
- const [openId, setOpenId] = useState31(null);
9217
- const [building, setBuilding] = useState31(false);
9375
+ const [portals, setPortals] = useState32(null);
9376
+ const [listError, setListError] = useState32(null);
9377
+ const [openId, setOpenId] = useState32(null);
9378
+ const [building, setBuilding] = useState32(false);
9218
9379
  const load = useCallback18(async () => {
9219
9380
  const answered = await client.portals();
9220
9381
  if (!answered.ok) {
@@ -9235,7 +9396,7 @@ function PortalsPanel({ tableId, className }) {
9235
9396
  /* @__PURE__ */ jsx35("h3", { className: "text-sm font-medium", children: "Portals" }),
9236
9397
  /* @__PURE__ */ jsx35("span", { className: "text-xs text-muted-foreground", children: portals.length === 0 ? "none yet" : `${portals.length}` }),
9237
9398
  /* @__PURE__ */ jsx35("div", { className: "flex-1" }),
9238
- portals.length > 0 ? /* @__PURE__ */ jsx35(Button28, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a portal" }) : null
9399
+ portals.length > 0 ? /* @__PURE__ */ jsx35(Button29, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a portal" }) : null
9239
9400
  ] }),
9240
9401
  listError ? /* @__PURE__ */ jsx35(RefusalNotice, { error: listError }) : null,
9241
9402
  building ? /* @__PURE__ */ jsx35(
@@ -9285,7 +9446,7 @@ function PortalsPanel({ tableId, className }) {
9285
9446
  /* @__PURE__ */ jsxs31("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
9286
9447
  /* @__PURE__ */ jsx35(CopyLink, { url }),
9287
9448
  /* @__PURE__ */ jsx35(
9288
- Button28,
9449
+ Button29,
9289
9450
  {
9290
9451
  size: "sm",
9291
9452
  variant: "ghost",
@@ -9307,11 +9468,11 @@ function PortalsPanel({ tableId, className }) {
9307
9468
  ] });
9308
9469
  }
9309
9470
  function CopyLink({ url }) {
9310
- const [copied, setCopied] = useState31(false);
9311
- const [shown, setShown] = useState31(false);
9471
+ const [copied, setCopied] = useState32(false);
9472
+ const [shown, setShown] = useState32(false);
9312
9473
  return /* @__PURE__ */ jsxs31(Fragment15, { children: [
9313
9474
  /* @__PURE__ */ jsx35(
9314
- Button28,
9475
+ Button29,
9315
9476
  {
9316
9477
  size: "sm",
9317
9478
  variant: "outline",
@@ -9342,8 +9503,8 @@ function PortalDetail({
9342
9503
  onChanged
9343
9504
  }) {
9344
9505
  const client = useRecordsClient25();
9345
- const [card, setCard] = useState31(null);
9346
- const [error, setError] = useState31(null);
9506
+ const [card, setCard] = useState32(null);
9507
+ const [error, setError] = useState32(null);
9347
9508
  const load = useCallback18(async () => {
9348
9509
  const answered = await client.portalCard({ portal_id: portalId });
9349
9510
  if (!answered.ok) {
@@ -9452,11 +9613,11 @@ function People({
9452
9613
  onRevoke,
9453
9614
  onPreview
9454
9615
  }) {
9455
- const [askingToRevoke, setAskingToRevoke] = useState31(null);
9456
- const [busy, setBusy] = useState31(false);
9457
- const [said, setSaid] = useState31(null);
9458
- const [error, setError] = useState31(null);
9459
- const [previewing, setPreviewing] = useState31(null);
9616
+ const [askingToRevoke, setAskingToRevoke] = useState32(null);
9617
+ const [busy, setBusy] = useState32(false);
9618
+ const [said, setSaid] = useState32(null);
9619
+ const [error, setError] = useState32(null);
9620
+ const [previewing, setPreviewing] = useState32(null);
9460
9621
  const revoke = useCallback18(
9461
9622
  async (person) => {
9462
9623
  setBusy(true);
@@ -9494,7 +9655,7 @@ function People({
9494
9655
  /* @__PURE__ */ jsx35("p", { className: "mt-0.5 text-muted-foreground", children: state.why }),
9495
9656
  person.is_active ? /* @__PURE__ */ jsxs31("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: [
9496
9657
  /* @__PURE__ */ jsx35(
9497
- Button28,
9658
+ Button29,
9498
9659
  {
9499
9660
  size: "sm",
9500
9661
  variant: "outline",
@@ -9502,13 +9663,13 @@ function People({
9502
9663
  children: showing ? "Stop viewing as them" : "View as this client"
9503
9664
  }
9504
9665
  ),
9505
- /* @__PURE__ */ jsx35(Button28, { size: "sm", variant: "ghost", onClick: () => setAskingToRevoke(person), children: "Remove their access" })
9666
+ /* @__PURE__ */ jsx35(Button29, { size: "sm", variant: "ghost", onClick: () => setAskingToRevoke(person), children: "Remove their access" })
9506
9667
  ] }) : null,
9507
9668
  asking ? /* @__PURE__ */ jsxs31("div", { className: "mt-1.5 flex flex-col gap-1.5 rounded border border-destructive/40 px-2 py-1.5", children: [
9508
9669
  /* @__PURE__ */ jsx35("span", { className: "text-destructive", children: revokeConsequence(person, card.title) }),
9509
9670
  /* @__PURE__ */ jsxs31("div", { className: "flex flex-wrap gap-1.5", children: [
9510
9671
  /* @__PURE__ */ jsx35(
9511
- Button28,
9672
+ Button29,
9512
9673
  {
9513
9674
  size: "sm",
9514
9675
  variant: "destructive",
@@ -9517,7 +9678,7 @@ function People({
9517
9678
  children: busy ? "Removing\u2026" : "Remove their access"
9518
9679
  }
9519
9680
  ),
9520
- /* @__PURE__ */ jsx35(Button28, { size: "sm", variant: "ghost", onClick: () => setAskingToRevoke(null), children: "Keep it" })
9681
+ /* @__PURE__ */ jsx35(Button29, { size: "sm", variant: "ghost", onClick: () => setAskingToRevoke(null), children: "Keep it" })
9521
9682
  ] })
9522
9683
  ] }) : null,
9523
9684
  showing ? /* @__PURE__ */ jsx35(Preview, { card, person, onPreview }) : null
@@ -9534,9 +9695,9 @@ function Preview({
9534
9695
  onPreview
9535
9696
  }) {
9536
9697
  const first = card.tables[0];
9537
- const [which, setWhich] = useState31(first?.table_id ?? null);
9538
- const [rows, setRows] = useState31(null);
9539
- const [error, setError] = useState31(null);
9698
+ const [which, setWhich] = useState32(first?.table_id ?? null);
9699
+ const [rows, setRows] = useState32(null);
9700
+ const [error, setError] = useState32(null);
9540
9701
  useEffect21(() => {
9541
9702
  if (!which) return;
9542
9703
  let cancelled = false;
@@ -9559,7 +9720,7 @@ function Preview({
9559
9720
  return /* @__PURE__ */ jsxs31("div", { className: "mt-1.5 rounded border border-border bg-card px-2 py-1.5", children: [
9560
9721
  /* @__PURE__ */ jsx35("p", { className: "text-xs text-muted-foreground", children: previewLine(person) }),
9561
9722
  card.tables.length > 1 ? /* @__PURE__ */ jsx35("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: card.tables.map((exposed) => /* @__PURE__ */ jsx35(
9562
- Button28,
9723
+ Button29,
9563
9724
  {
9564
9725
  size: "sm",
9565
9726
  variant: exposed.table_id === which ? "secondary" : "ghost",
@@ -9575,14 +9736,14 @@ function Preview({
9575
9736
  }
9576
9737
  function Invite({ card, onInvited }) {
9577
9738
  const client = useRecordsClient25();
9578
- const [rows, setRows] = useState31(null);
9579
- const [titleKey, setTitleKey] = useState31(null);
9580
- const [search, setSearch] = useState31("");
9581
- const [picked, setPicked] = useState31(null);
9582
- const [email, setEmail] = useState31("");
9583
- const [busy, setBusy] = useState31(false);
9584
- const [said, setSaid] = useState31(null);
9585
- const [error, setError] = useState31(null);
9739
+ const [rows, setRows] = useState32(null);
9740
+ const [titleKey, setTitleKey] = useState32(null);
9741
+ const [search, setSearch] = useState32("");
9742
+ const [picked, setPicked] = useState32(null);
9743
+ const [email, setEmail] = useState32("");
9744
+ const [busy, setBusy] = useState32(false);
9745
+ const [said, setSaid] = useState32(null);
9746
+ const [error, setError] = useState32(null);
9586
9747
  useEffect21(() => {
9587
9748
  let cancelled = false;
9588
9749
  void client.list({ table_id: card.client_table_id, limit: 200 }).then((answered) => {
@@ -9648,7 +9809,7 @@ function Invite({ card, onInvited }) {
9648
9809
  picked ? null : /* @__PURE__ */ jsxs31("ul", { className: "flex max-h-40 flex-col gap-0.5 overflow-y-auto", children: [
9649
9810
  options.length === 0 ? /* @__PURE__ */ jsx35("li", { className: "text-xs text-muted-foreground", children: "No client of this portal's client Table matches that. A portal principal is one of those rows \u2014 add the client there first." }) : null,
9650
9811
  options.map((option) => /* @__PURE__ */ jsx35("li", { children: /* @__PURE__ */ jsx35(
9651
- Button28,
9812
+ Button29,
9652
9813
  {
9653
9814
  size: "sm",
9654
9815
  variant: "ghost",
@@ -9672,7 +9833,7 @@ function Invite({ card, onInvited }) {
9672
9833
  }
9673
9834
  ),
9674
9835
  /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(
9675
- Button28,
9836
+ Button29,
9676
9837
  {
9677
9838
  size: "sm",
9678
9839
  disabled: busy || !picked || email.trim() === "",
@@ -9685,9 +9846,9 @@ function Invite({ card, onInvited }) {
9685
9846
  }
9686
9847
 
9687
9848
  // src/DigestScheduler.tsx
9688
- import { useCallback as useCallback19, useEffect as useEffect22, useMemo as useMemo23, useState as useState32 } from "react";
9849
+ import { useCallback as useCallback19, useEffect as useEffect22, useMemo as useMemo23, useState as useState33 } from "react";
9689
9850
  import { useRecordsClient as useRecordsClient26 } from "@ai-matrx/records/react";
9690
- import { BasicInput as BasicInput10, Button as Button29, Checkbox as Checkbox5, Label as Label5, Separator as Separator11, Skeleton as Skeleton16, cn as cn30 } from "@ai-matrx/design-system";
9851
+ import { BasicInput as BasicInput10, Button as Button30, Checkbox as Checkbox5, Label as Label5, Separator as Separator11, Skeleton as Skeleton16, cn as cn30 } from "@ai-matrx/design-system";
9691
9852
  import { Fragment as Fragment16, jsx as jsx36, jsxs as jsxs32 } from "react/jsx-runtime";
9692
9853
  var WEEKDAYS = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"];
9693
9854
  var CADENCE_WORDS = {
@@ -9712,24 +9873,24 @@ function DigestScheduler({
9712
9873
  }) {
9713
9874
  const client = useRecordsClient26();
9714
9875
  const host = useRecordsUi();
9715
- const [views, setViews] = useState32(null);
9716
- const [cadences, setCadences] = useState32([]);
9717
- const [members, setMembers] = useState32(null);
9718
- const [error, setError] = useState32(null);
9719
- const [viewId, setViewId] = useState32(savedViewId ?? "");
9720
- const [name, setName] = useState32(subjectName?.trim() ? `${subjectName.trim()} summary` : "");
9721
- const [cadence, setCadence] = useState32("weekly");
9722
- const [weekday, setWeekday] = useState32("monday");
9723
- const [time, setTime] = useState32("08:00");
9724
- const [channel, setChannel] = useState32("in_app");
9725
- const [quiet, setQuiet] = useState32(false);
9726
- const [quietFrom, setQuietFrom] = useState32("22:00");
9727
- const [quietTo, setQuietTo] = useState32("07:00");
9728
- const [recipients, setRecipients] = useState32([]);
9729
- const [saving, setSaving] = useState32(false);
9730
- const [outcomes, setOutcomes] = useState32(null);
9731
- const [preview, setPreview] = useState32(null);
9732
- const [previewing, setPreviewing] = useState32(false);
9876
+ const [views, setViews] = useState33(null);
9877
+ const [cadences, setCadences] = useState33([]);
9878
+ const [members, setMembers] = useState33(null);
9879
+ const [error, setError] = useState33(null);
9880
+ const [viewId, setViewId] = useState33(savedViewId ?? "");
9881
+ const [name, setName] = useState33(subjectName?.trim() ? `${subjectName.trim()} summary` : "");
9882
+ const [cadence, setCadence] = useState33("weekly");
9883
+ const [weekday, setWeekday] = useState33("monday");
9884
+ const [time, setTime] = useState33("08:00");
9885
+ const [channel, setChannel] = useState33("in_app");
9886
+ const [quiet, setQuiet] = useState33(false);
9887
+ const [quietFrom, setQuietFrom] = useState33("22:00");
9888
+ const [quietTo, setQuietTo] = useState33("07:00");
9889
+ const [recipients, setRecipients] = useState33([]);
9890
+ const [saving, setSaving] = useState33(false);
9891
+ const [outcomes, setOutcomes] = useState33(null);
9892
+ const [preview, setPreview] = useState33(null);
9893
+ const [previewing, setPreviewing] = useState33(false);
9733
9894
  const load = useCallback19(async () => {
9734
9895
  const [saved, offered] = await Promise.all([
9735
9896
  // The store's own door onto `platform.saved_view`, narrowed in SQL to
@@ -9820,8 +9981,8 @@ function DigestScheduler({
9820
9981
  /* @__PURE__ */ jsxs32("header", { className: "flex items-center gap-2", children: [
9821
9982
  /* @__PURE__ */ jsx36("h3", { className: "text-sm font-medium", children: "Send this on a schedule" }),
9822
9983
  /* @__PURE__ */ jsx36("div", { className: "flex-1" }),
9823
- /* @__PURE__ */ jsx36(Button29, { size: "sm", disabled: saving, onClick: () => void scheduleIt(), children: saving ? "Scheduling\u2026" : "Schedule it" }),
9824
- onClose ? /* @__PURE__ */ jsx36(Button29, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
9984
+ /* @__PURE__ */ jsx36(Button30, { size: "sm", disabled: saving, onClick: () => void scheduleIt(), children: saving ? "Scheduling\u2026" : "Schedule it" }),
9985
+ onClose ? /* @__PURE__ */ jsx36(Button30, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
9825
9986
  ] }),
9826
9987
  error ? /* @__PURE__ */ jsx36(RefusalNotice, { error }) : null,
9827
9988
  /* @__PURE__ */ jsxs32("label", { className: "flex flex-col gap-1", children: [
@@ -9947,7 +10108,7 @@ function DigestScheduler({
9947
10108
  ".",
9948
10109
  " ",
9949
10110
  /* @__PURE__ */ jsx36(
9950
- Button29,
10111
+ Button30,
9951
10112
  {
9952
10113
  size: "sm",
9953
10114
  variant: "ghost",
@@ -9973,15 +10134,15 @@ function DigestScheduler({
9973
10134
  preview.changed.map((e) => e.name).join(", ")
9974
10135
  ] }) : null,
9975
10136
  /* @__PURE__ */ jsx36("p", { className: "mt-1.5 text-muted-foreground", children: "Nothing was sent and nothing was recorded \u2014 this is what the next one would say." }),
9976
- /* @__PURE__ */ jsx36(Button29, { size: "sm", variant: "ghost", className: "mt-1", onClick: () => setPreview(null), children: "Close" })
10137
+ /* @__PURE__ */ jsx36(Button30, { size: "sm", variant: "ghost", className: "mt-1", onClick: () => setPreview(null), children: "Close" })
9977
10138
  ] }) : null
9978
10139
  ] });
9979
10140
  }
9980
10141
 
9981
10142
  // src/SubscriptionsPanel.tsx
9982
- import { useCallback as useCallback20, useEffect as useEffect23, useState as useState33 } from "react";
10143
+ import { useCallback as useCallback20, useEffect as useEffect23, useState as useState34 } from "react";
9983
10144
  import { useRecordsClient as useRecordsClient27 } from "@ai-matrx/records/react";
9984
- import { Badge as Badge14, Button as Button30, Skeleton as Skeleton17, Switch as Switch2, cn as cn31 } from "@ai-matrx/design-system";
10145
+ import { Badge as Badge14, Button as Button31, Skeleton as Skeleton17, Switch as Switch2, cn as cn31 } from "@ai-matrx/design-system";
9985
10146
  import { jsx as jsx37, jsxs as jsxs33 } from "react/jsx-runtime";
9986
10147
  function whenItFires(subscription) {
9987
10148
  if (subscription.cadence === "instant") return "as it happens";
@@ -9996,11 +10157,11 @@ var CHANNEL_WORDS2 = {
9996
10157
  var DIGEST_SUGGESTION = "Email me a summary of this every Monday at 8 in the morning.";
9997
10158
  function SubscriptionsPanel({ tableId, className }) {
9998
10159
  const client = useRecordsClient27();
9999
- const [rows, setRows] = useState33(null);
10000
- const [error, setError] = useState33(null);
10001
- const [busy, setBusy] = useState33(null);
10002
- const [preview, setPreview] = useState33(null);
10003
- const [scheduling, setScheduling] = useState33(false);
10160
+ const [rows, setRows] = useState34(null);
10161
+ const [error, setError] = useState34(null);
10162
+ const [busy, setBusy] = useState34(null);
10163
+ const [preview, setPreview] = useState34(null);
10164
+ const [scheduling, setScheduling] = useState34(false);
10004
10165
  const host = useRecordsUi();
10005
10166
  const load = useCallback20(async () => {
10006
10167
  const answered = await client.subscriptions({ table_id: tableId });
@@ -10052,7 +10213,7 @@ function SubscriptionsPanel({ tableId, className }) {
10052
10213
  /* @__PURE__ */ jsx37("span", { className: "text-xs text-muted-foreground", children: rows.length === 0 ? "none" : `${rows.filter((r) => !r.muted).length} on` }),
10053
10214
  /* @__PURE__ */ jsx37("div", { className: "flex-1" }),
10054
10215
  rows.length > 0 ? /* @__PURE__ */ jsx37(
10055
- Button30,
10216
+ Button31,
10056
10217
  {
10057
10218
  size: "sm",
10058
10219
  variant: scheduling ? "secondary" : "ghost",
@@ -10123,7 +10284,7 @@ function SubscriptionsPanel({ tableId, className }) {
10123
10284
  " \u2014 a send inside those hours waits until they end."
10124
10285
  ] }) : null,
10125
10286
  subscription.cadence === "instant" ? null : /* @__PURE__ */ jsx37(
10126
- Button30,
10287
+ Button31,
10127
10288
  {
10128
10289
  size: "sm",
10129
10290
  variant: "ghost",
@@ -10157,20 +10318,20 @@ function SubscriptionsPanel({ tableId, className }) {
10157
10318
  preview.changed.map((e) => e.name).join(", ")
10158
10319
  ] }) : null,
10159
10320
  /* @__PURE__ */ jsx37("p", { className: "mt-1.5 text-muted-foreground", children: "Nothing was sent and nothing was recorded \u2014 this is what the next one would say." }),
10160
- /* @__PURE__ */ jsx37(Button30, { size: "sm", variant: "ghost", className: "mt-1", onClick: () => setPreview(null), children: "Close" })
10321
+ /* @__PURE__ */ jsx37(Button31, { size: "sm", variant: "ghost", className: "mt-1", onClick: () => setPreview(null), children: "Close" })
10161
10322
  ] }) : null
10162
10323
  ] }, subscription.rule_id)) })
10163
10324
  ] });
10164
10325
  }
10165
10326
 
10166
10327
  // src/FormBuilder.tsx
10167
- import { useCallback as useCallback22, useEffect as useEffect25, useMemo as useMemo25, useState as useState35 } from "react";
10328
+ import { useCallback as useCallback22, useEffect as useEffect25, useMemo as useMemo25, useState as useState36 } from "react";
10168
10329
  import { useFields as useFields16, useRecordsClient as useRecordsClient28, useTable as useTable13 } from "@ai-matrx/records/react";
10169
10330
  import { publicFormPath } from "@ai-matrx/records";
10170
10331
  import {
10171
10332
  BasicInput as BasicInput11,
10172
10333
  BasicTextarea as BasicTextarea5,
10173
- Button as Button32,
10334
+ Button as Button33,
10174
10335
  Checkbox as Checkbox6,
10175
10336
  Label as Label6,
10176
10337
  Skeleton as Skeleton19,
@@ -10178,9 +10339,9 @@ import {
10178
10339
  } from "@ai-matrx/design-system";
10179
10340
 
10180
10341
  // src/FormRunner.tsx
10181
- import { useCallback as useCallback21, useEffect as useEffect24, useMemo as useMemo24, useRef as useRef10, useState as useState34 } from "react";
10342
+ import { useCallback as useCallback21, useEffect as useEffect24, useMemo as useMemo24, useRef as useRef10, useState as useState35 } from "react";
10182
10343
  import { useFields as useFields15, useOptionalRecordsClient } from "@ai-matrx/records/react";
10183
- import { Button as Button31, Progress, Skeleton as Skeleton18, cn as cn32 } from "@ai-matrx/design-system";
10344
+ import { Button as Button32, Progress, Skeleton as Skeleton18, cn as cn32 } from "@ai-matrx/design-system";
10184
10345
  import { Fragment as Fragment17, jsx as jsx38, jsxs as jsxs34 } from "react/jsx-runtime";
10185
10346
  function FormRunner(props) {
10186
10347
  if (props.fields && props.onSubmit) {
@@ -10249,13 +10410,13 @@ function FormStage({
10249
10410
  connected = false
10250
10411
  }) {
10251
10412
  const host = useRecordsUi();
10252
- const [answers, setAnswers] = useState34({});
10253
- const [at, setAt] = useState34(0);
10254
- const [error, setError] = useState34(null);
10255
- const [refusal, setRefusal] = useState34(null);
10256
- const [writing, setWriting] = useState34(false);
10257
- const [done, setDone] = useState34(null);
10258
- const [hidden, setHidden] = useState34({});
10413
+ const [answers, setAnswers] = useState35({});
10414
+ const [at, setAt] = useState35(0);
10415
+ const [error, setError] = useState35(null);
10416
+ const [refusal, setRefusal] = useState35(null);
10417
+ const [writing, setWriting] = useState35(false);
10418
+ const [done, setDone] = useState35(null);
10419
+ const [hidden, setHidden] = useState35({});
10259
10420
  const decoy = useRef10("");
10260
10421
  const stage = useRef10(null);
10261
10422
  const questions = useMemo24(() => {
@@ -10417,8 +10578,8 @@ function FormStage({
10417
10578
  )
10418
10579
  ] }) : null,
10419
10580
  /* @__PURE__ */ jsxs34("footer", { className: cn32("flex flex-wrap items-center gap-2", centred && "justify-center"), children: [
10420
- oneAtATime && index > 0 ? /* @__PURE__ */ jsx38(Button31, { size: "sm", variant: "ghost", onClick: retreat, children: "Back" }) : null,
10421
- oneAtATime && index < live.length - 1 ? /* @__PURE__ */ jsx38(Button31, { size: "sm", onClick: advance, children: "Next" }) : /* @__PURE__ */ jsx38(Button31, { size: "sm", disabled: writing || missing.length > 0, onClick: () => void submit(), children: writing ? "Sending\u2026" : form.submitLabel ?? "Submit" }),
10581
+ oneAtATime && index > 0 ? /* @__PURE__ */ jsx38(Button32, { size: "sm", variant: "ghost", onClick: retreat, children: "Back" }) : null,
10582
+ oneAtATime && index < live.length - 1 ? /* @__PURE__ */ jsx38(Button32, { size: "sm", onClick: advance, children: "Next" }) : /* @__PURE__ */ jsx38(Button32, { size: "sm", disabled: writing || missing.length > 0, onClick: () => void submit(), children: writing ? "Sending\u2026" : form.submitLabel ?? "Submit" }),
10422
10583
  missing.length > 0 && (!oneAtATime || index === live.length - 1) ? /* @__PURE__ */ jsxs34("span", { className: "text-xs text-muted-foreground", children: [
10423
10584
  missing.map((q) => q.ask).join(", "),
10424
10585
  " still ",
@@ -10437,7 +10598,7 @@ function Question({
10437
10598
  onChange,
10438
10599
  upload
10439
10600
  }) {
10440
- const [uploadError, setUploadError] = useState34(null);
10601
+ const [uploadError, setUploadError] = useState35(null);
10441
10602
  const field = question.field;
10442
10603
  if (!field) return null;
10443
10604
  const id = `form-${field.key}`;
@@ -10469,6 +10630,28 @@ function Question({
10469
10630
  ] });
10470
10631
  }
10471
10632
 
10633
+ // src/publicQuestions.ts
10634
+ var CANNOT_ASK = {
10635
+ relation: "points at a record in another table, and somebody with no account cannot see that table to pick from it",
10636
+ member: "is a person in this organization, and somebody outside it has no way to choose one",
10637
+ attachment: "holds a file in your own store, and a public page has nowhere to put one yet",
10638
+ formula: "is worked out by the store, so there is nothing for anybody to answer",
10639
+ lookup: "is read through a relation, so the store fills it in",
10640
+ rollup: "is added up by the store, so there is nothing for anybody to answer"
10641
+ };
10642
+ function publiclyAnswerable(field) {
10643
+ return !(field.type in CANNOT_ASK);
10644
+ }
10645
+ function askableFields(fields, hidden = []) {
10646
+ return fields.filter((f) => publiclyAnswerable(f) && !hidden.includes(f.key));
10647
+ }
10648
+ function whyNotAskable(fields, hidden = []) {
10649
+ const left = fields.filter((f) => !publiclyAnswerable(f) && !hidden.includes(f.key));
10650
+ if (left.length === 0) return null;
10651
+ const said = left.map((f) => `${f.label || f.key} ${CANNOT_ASK[f.type]}`);
10652
+ return said.length === 1 ? `${said[0]}, so it is not offered here.` : `These are not offered here: ${said.join("; ")}.`;
10653
+ }
10654
+
10472
10655
  // src/FormBuilder.tsx
10473
10656
  import { Fragment as Fragment18, jsx as jsx39, jsxs as jsxs35 } from "react/jsx-runtime";
10474
10657
  function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
@@ -10478,15 +10661,15 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
10478
10661
  const table = useTable13(tableId);
10479
10662
  const rights = useTableRights(table.data);
10480
10663
  const fields = useFields16(tableId);
10481
- const [forms, setForms] = useState35(null);
10482
- const [error, setError] = useState35(null);
10483
- const [activeId, setActiveId] = useState35(activeFormId ?? null);
10484
- const [draft, setDraft] = useState35(null);
10485
- const [saving, setSaving] = useState35(false);
10486
- const [saved, setSaved] = useState35(null);
10487
- const [publishing, setPublishing] = useState35(false);
10488
- const [copied, setCopied] = useState35(false);
10489
- const [shownUrl, setShownUrl] = useState35(null);
10664
+ const [forms, setForms] = useState36(null);
10665
+ const [error, setError] = useState36(null);
10666
+ const [activeId, setActiveId] = useState36(activeFormId ?? null);
10667
+ const [draft, setDraft] = useState36(null);
10668
+ const [saving, setSaving] = useState36(false);
10669
+ const [saved, setSaved] = useState36(null);
10670
+ const [publishing, setPublishing] = useState36(false);
10671
+ const [copied, setCopied] = useState36(false);
10672
+ const [shownUrl, setShownUrl] = useState36(null);
10490
10673
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
10491
10674
  const load = useCallback22(async () => {
10492
10675
  const answered = await client.forms({ table_id: tableId });
@@ -10592,7 +10775,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
10592
10775
  {
10593
10776
  error,
10594
10777
  className,
10595
- actions: /* @__PURE__ */ jsx39(Button32, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
10778
+ actions: /* @__PURE__ */ jsx39(Button33, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
10596
10779
  }
10597
10780
  );
10598
10781
  }
@@ -10604,7 +10787,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
10604
10787
  /* @__PURE__ */ jsxs35("div", { className: "flex min-w-0 flex-1 flex-col gap-2 overflow-auto", children: [
10605
10788
  /* @__PURE__ */ jsxs35("div", { className: "flex items-center gap-1 overflow-x-auto", role: "group", "aria-label": "Forms", children: [
10606
10789
  forms.map((form) => /* @__PURE__ */ jsx39(
10607
- Button32,
10790
+ Button33,
10608
10791
  {
10609
10792
  size: "sm",
10610
10793
  variant: form.id === activeId ? "secondary" : "ghost",
@@ -10617,10 +10800,10 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
10617
10800
  },
10618
10801
  form.id
10619
10802
  )),
10620
- (fields.data ?? []).length > 0 ? /* @__PURE__ */ jsx39(Button32, { size: "sm", variant: "ghost", onClick: () => void create(`Form ${forms.length + 1}`), children: "New form" }) : null,
10803
+ (fields.data ?? []).length > 0 ? /* @__PURE__ */ jsx39(Button33, { size: "sm", variant: "ghost", onClick: () => void create(`Form ${forms.length + 1}`), children: "New form" }) : null,
10621
10804
  /* @__PURE__ */ jsxs35("span", { className: "ml-auto flex items-center gap-2", children: [
10622
10805
  saved ? /* @__PURE__ */ jsx39("span", { className: "text-xs text-muted-foreground", children: saved }) : null,
10623
- /* @__PURE__ */ jsx39(Button32, { size: "sm", disabled: saving || !draft, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" })
10806
+ /* @__PURE__ */ jsx39(Button33, { size: "sm", disabled: saving || !draft, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" })
10624
10807
  ] })
10625
10808
  ] }),
10626
10809
  !draft ? /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: (fields.data ?? []).length === 0 ? "This table has no fields yet, so there is nothing a form could ask for. Add a field first \u2014 every question is one of this table's own fields." : 'No form collects into this table yet. "New form" makes one, or you ask an agent for the whole thing in a sentence.' }) : /* @__PURE__ */ jsxs35(Fragment18, { children: [
@@ -10701,7 +10884,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
10701
10884
  " fields"
10702
10885
  ] })
10703
10886
  ] }),
10704
- (fields.data ?? []).map((field) => {
10887
+ askableFields(fields.data ?? []).map((field) => {
10705
10888
  const index = draft.questions.findIndex((q) => q.field === field.key);
10706
10889
  const asked = index >= 0;
10707
10890
  const question = asked ? draft.questions[index] : null;
@@ -10753,6 +10936,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, className }) {
10753
10936
  ] }) : null
10754
10937
  ] }, field.id);
10755
10938
  }),
10939
+ whyNotAskable(fields.data ?? []) ? /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: whyNotAskable(fields.data ?? []) }) : null,
10756
10940
  draft.questions.filter((q) => !byKey.has(q.field)).map((q) => /* @__PURE__ */ jsxs35("p", { className: "text-xs text-destructive", children: [
10757
10941
  'This form asks for "',
10758
10942
  q.field,
@@ -10782,7 +10966,7 @@ function PublishRow({
10782
10966
  return /* @__PURE__ */ jsxs35("div", { className: "flex flex-col gap-1.5 rounded border px-2.5 py-2", children: [
10783
10967
  /* @__PURE__ */ jsxs35("div", { className: "flex flex-wrap items-center gap-2", children: [
10784
10968
  mayPublish ? /* @__PURE__ */ jsx39(
10785
- Button32,
10969
+ Button33,
10786
10970
  {
10787
10971
  size: "sm",
10788
10972
  variant: open ? "ghost" : "default",
@@ -10802,7 +10986,7 @@ function PublishRow({
10802
10986
  children: url
10803
10987
  }
10804
10988
  ),
10805
- /* @__PURE__ */ jsx39(Button32, { size: "sm", variant: "outline", onClick: () => onCopy(url), children: copied ? "Copied" : "Copy link" })
10989
+ /* @__PURE__ */ jsx39(Button33, { size: "sm", variant: "outline", onClick: () => onCopy(url), children: copied ? "Copied" : "Copy link" })
10806
10990
  ] }) : null
10807
10991
  ] }),
10808
10992
  /* @__PURE__ */ jsx39("p", { className: "text-xs text-muted-foreground", children: FORM_STATE_WORDS[state] }),
@@ -10819,13 +11003,13 @@ function Condition({
10819
11003
  onChange
10820
11004
  }) {
10821
11005
  return /* @__PURE__ */ jsx39(
10822
- ConditionRow,
11006
+ ConditionGroup,
10823
11007
  {
10824
11008
  lead: "Ask only when",
10825
11009
  expr: question.showIf,
10826
11010
  fields: fieldKeys,
10827
11011
  onChange,
10828
- className: "col-span-2 flex items-center gap-1 text-xs"
11012
+ className: "col-span-2 flex flex-col gap-1 text-xs"
10829
11013
  }
10830
11014
  );
10831
11015
  }
@@ -10919,13 +11103,13 @@ import {
10919
11103
  useEffect as useEffect26,
10920
11104
  useId,
10921
11105
  useRef as useRef11,
10922
- useState as useState36
11106
+ useState as useState37
10923
11107
  } from "react";
10924
11108
  import { cn as cn34 } from "@ai-matrx/design-system";
10925
11109
  import { jsx as jsx40, jsxs as jsxs36 } from "react/jsx-runtime";
10926
11110
  function useMeasuredWidth(fallback = 480) {
10927
11111
  const ref = useRef11(null);
10928
- const [width, setWidth] = useState36(fallback);
11112
+ const [width, setWidth] = useState37(fallback);
10929
11113
  useEffect26(() => {
10930
11114
  const node = ref.current;
10931
11115
  if (!node) return;
@@ -11050,9 +11234,9 @@ function isSignatureField(field) {
11050
11234
  }
11051
11235
 
11052
11236
  // src/DocTemplate.tsx
11053
- import { useCallback as useCallback23, useEffect as useEffect27, useState as useState37 } from "react";
11237
+ import { useCallback as useCallback23, useEffect as useEffect27, useState as useState38 } from "react";
11054
11238
  import { useFields as useFields17, useRecordsClient as useRecordsClient29, useTable as useTable14 } from "@ai-matrx/records/react";
11055
- import { BasicInput as BasicInput12, BasicTextarea as BasicTextarea6, Button as Button33, Label as Label7, Skeleton as Skeleton20, cn as cn35 } from "@ai-matrx/design-system";
11239
+ import { BasicInput as BasicInput12, BasicTextarea as BasicTextarea6, Button as Button34, Label as Label7, Skeleton as Skeleton20, cn as cn35 } from "@ai-matrx/design-system";
11056
11240
  import { jsx as jsx41, jsxs as jsxs37 } from "react/jsx-runtime";
11057
11241
  function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, className }) {
11058
11242
  const client = useRecordsClient29();
@@ -11060,13 +11244,13 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11060
11244
  const table = useTable14(tableId);
11061
11245
  const rights = useTableRights(table.data);
11062
11246
  const fields = useFields17(tableId);
11063
- const [templates, setTemplates] = useState37(null);
11064
- const [error, setError] = useState37(null);
11065
- const [activeId, setActiveId] = useState37(activeTemplateId ?? null);
11066
- const [draftName, setDraftName] = useState37("");
11067
- const [draftBody, setDraftBody] = useState37("");
11068
- const [unresolved, setUnresolved] = useState37([]);
11069
- const [saving, setSaving] = useState37(false);
11247
+ const [templates, setTemplates] = useState38(null);
11248
+ const [error, setError] = useState38(null);
11249
+ const [activeId, setActiveId] = useState38(activeTemplateId ?? null);
11250
+ const [draftName, setDraftName] = useState38("");
11251
+ const [draftBody, setDraftBody] = useState38("");
11252
+ const [unresolved, setUnresolved] = useState38([]);
11253
+ const [saving, setSaving] = useState38(false);
11070
11254
  const load = useCallback23(async () => {
11071
11255
  const held = await client.docTemplates({ table_id: tableId });
11072
11256
  if (!held.ok) {
@@ -11146,7 +11330,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11146
11330
  {
11147
11331
  error,
11148
11332
  className,
11149
- actions: /* @__PURE__ */ jsx41(Button33, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11333
+ actions: /* @__PURE__ */ jsx41(Button34, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11150
11334
  }
11151
11335
  );
11152
11336
  }
@@ -11157,7 +11341,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11157
11341
  return /* @__PURE__ */ jsxs37("div", { className: cn35("flex flex-col gap-2", className), children: [
11158
11342
  /* @__PURE__ */ jsxs37("div", { className: "flex items-center gap-1 overflow-x-auto", role: "group", "aria-label": "Templates", children: [
11159
11343
  templates.map((t) => /* @__PURE__ */ jsxs37(
11160
- Button33,
11344
+ Button34,
11161
11345
  {
11162
11346
  size: "sm",
11163
11347
  variant: t.id === activeId ? "secondary" : "ghost",
@@ -11178,7 +11362,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11178
11362
  t.id
11179
11363
  )),
11180
11364
  /* @__PURE__ */ jsx41(
11181
- Button33,
11365
+ Button34,
11182
11366
  {
11183
11367
  size: "sm",
11184
11368
  variant: "ghost",
@@ -11190,7 +11374,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11190
11374
  children: "New template"
11191
11375
  }
11192
11376
  ),
11193
- /* @__PURE__ */ jsx41(Button33, { size: "sm", className: "ml-auto", disabled: saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" })
11377
+ /* @__PURE__ */ jsx41(Button34, { size: "sm", className: "ml-auto", disabled: saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" })
11194
11378
  ] }),
11195
11379
  /* @__PURE__ */ jsxs37("label", { className: "flex flex-col gap-1", children: [
11196
11380
  /* @__PURE__ */ jsx41(Label7, { className: "text-xs font-medium", children: "Name" }),
@@ -11199,7 +11383,7 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11199
11383
  /* @__PURE__ */ jsxs37("div", { className: "flex flex-wrap items-center gap-1", children: [
11200
11384
  /* @__PURE__ */ jsx41("span", { className: "text-xs text-muted-foreground", children: "Insert" }),
11201
11385
  (fields.data ?? []).map((field) => /* @__PURE__ */ jsx41(
11202
- Button33,
11386
+ Button34,
11203
11387
  {
11204
11388
  size: "sm",
11205
11389
  variant: "ghost",
@@ -11229,17 +11413,17 @@ function DocTemplate({ tableId, seed, activeTemplateId, onActiveTemplate, classN
11229
11413
  }
11230
11414
 
11231
11415
  // src/DocRender.tsx
11232
- import { useCallback as useCallback24, useEffect as useEffect28, useRef as useRef12, useState as useState38 } from "react";
11416
+ import { useCallback as useCallback24, useEffect as useEffect28, useRef as useRef12, useState as useState39 } from "react";
11233
11417
  import { useRecordsClient as useRecordsClient30 } from "@ai-matrx/records/react";
11234
- import { Button as Button34, Skeleton as Skeleton21, cn as cn36 } from "@ai-matrx/design-system";
11418
+ import { Button as Button35, Skeleton as Skeleton21, cn as cn36 } from "@ai-matrx/design-system";
11235
11419
  import { jsx as jsx42, jsxs as jsxs38 } from "react/jsx-runtime";
11236
11420
  function DocRender({ templateId, recordId, filename, onRendered, className }) {
11237
11421
  const client = useRecordsClient30();
11238
- const [preview, setPreview] = useState38(null);
11239
- const [renders, setRenders] = useState38(null);
11240
- const [showing, setShowing] = useState38(null);
11241
- const [error, setError] = useState38(null);
11242
- const [busy, setBusy] = useState38(null);
11422
+ const [preview, setPreview] = useState39(null);
11423
+ const [renders, setRenders] = useState39(null);
11424
+ const [showing, setShowing] = useState39(null);
11425
+ const [error, setError] = useState39(null);
11426
+ const [busy, setBusy] = useState39(null);
11243
11427
  const paper = useRef12(null);
11244
11428
  const load = useCallback24(async () => {
11245
11429
  const [body, held] = await Promise.all([
@@ -11300,7 +11484,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
11300
11484
  {
11301
11485
  error,
11302
11486
  className,
11303
- actions: /* @__PURE__ */ jsx42(Button34, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11487
+ actions: /* @__PURE__ */ jsx42(Button35, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11304
11488
  }
11305
11489
  );
11306
11490
  }
@@ -11310,7 +11494,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
11310
11494
  return /* @__PURE__ */ jsxs38("div", { className: cn36("flex flex-col gap-2", className), children: [
11311
11495
  /* @__PURE__ */ jsxs38("div", { className: "flex items-center gap-1 text-xs", children: [
11312
11496
  /* @__PURE__ */ jsx42(
11313
- Button34,
11497
+ Button35,
11314
11498
  {
11315
11499
  size: "sm",
11316
11500
  variant: frozen ? "ghost" : "secondary",
@@ -11320,7 +11504,7 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
11320
11504
  }
11321
11505
  ),
11322
11506
  renders.map((render) => /* @__PURE__ */ jsx42(
11323
- Button34,
11507
+ Button35,
11324
11508
  {
11325
11509
  size: "sm",
11326
11510
  variant: render.id === showing ? "secondary" : "ghost",
@@ -11332,8 +11516,8 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
11332
11516
  render.id
11333
11517
  )),
11334
11518
  /* @__PURE__ */ jsxs38("span", { className: "ml-auto flex items-center gap-1", children: [
11335
- /* @__PURE__ */ jsx42(Button34, { size: "sm", disabled: busy !== null, onClick: () => void freeze(), children: busy === "freeze" ? "Freezing\u2026" : "Freeze this version" }),
11336
- /* @__PURE__ */ jsx42(Button34, { size: "sm", variant: "ghost", disabled: busy !== null, onClick: () => void toPdf(), children: busy === "pdf" ? "Making the PDF\u2026" : "PDF" })
11519
+ /* @__PURE__ */ jsx42(Button35, { size: "sm", disabled: busy !== null, onClick: () => void freeze(), children: busy === "freeze" ? "Freezing\u2026" : "Freeze this version" }),
11520
+ /* @__PURE__ */ jsx42(Button35, { size: "sm", variant: "ghost", disabled: busy !== null, onClick: () => void toPdf(), children: busy === "pdf" ? "Making the PDF\u2026" : "PDF" })
11337
11521
  ] })
11338
11522
  ] }),
11339
11523
  /* @__PURE__ */ jsx42("div", { ref: paper, className: "whitespace-pre-wrap rounded border bg-background p-4 text-sm text-foreground", children: text }),
@@ -11342,9 +11526,9 @@ function DocRender({ templateId, recordId, filename, onRendered, className }) {
11342
11526
  }
11343
11527
 
11344
11528
  // src/SignBlock.tsx
11345
- import { useCallback as useCallback25, useEffect as useEffect29, useState as useState39 } from "react";
11529
+ import { useCallback as useCallback25, useEffect as useEffect29, useState as useState40 } from "react";
11346
11530
  import { useFields as useFields18, useRecordsClient as useRecordsClient31 } from "@ai-matrx/records/react";
11347
- import { BasicInput as BasicInput13, Button as Button35, Skeleton as Skeleton22, cn as cn37 } from "@ai-matrx/design-system";
11531
+ import { BasicInput as BasicInput13, Button as Button36, Skeleton as Skeleton22, cn as cn37 } from "@ai-matrx/design-system";
11348
11532
  import { useTable as useTable15 } from "@ai-matrx/records/react";
11349
11533
  import { jsx as jsx43, jsxs as jsxs39 } from "react/jsx-runtime";
11350
11534
  function SignBlock({ tableId, recordId, render, className }) {
@@ -11352,11 +11536,11 @@ function SignBlock({ tableId, recordId, render, className }) {
11352
11536
  const table = useTable15(tableId);
11353
11537
  const rights = useTableRights(table.data);
11354
11538
  const fields = useFields18(tableId);
11355
- const [signatures, setSignatures] = useState39(null);
11356
- const [verdicts, setVerdicts] = useState39({});
11357
- const [error, setError] = useState39(null);
11358
- const [name, setName] = useState39("");
11359
- const [busy, setBusy] = useState39(false);
11539
+ const [signatures, setSignatures] = useState40(null);
11540
+ const [verdicts, setVerdicts] = useState40({});
11541
+ const [error, setError] = useState40(null);
11542
+ const [name, setName] = useState40("");
11543
+ const [busy, setBusy] = useState40(false);
11360
11544
  const load = useCallback25(async () => {
11361
11545
  const held = await client.docSignatures({ record_id: recordId });
11362
11546
  if (!held.ok) {
@@ -11399,7 +11583,7 @@ function SignBlock({ tableId, recordId, render, className }) {
11399
11583
  {
11400
11584
  error,
11401
11585
  className,
11402
- actions: /* @__PURE__ */ jsx43(Button35, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11586
+ actions: /* @__PURE__ */ jsx43(Button36, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11403
11587
  }
11404
11588
  );
11405
11589
  }
@@ -11462,7 +11646,7 @@ function SignBlock({ tableId, recordId, render, className }) {
11462
11646
  onChange: (e) => setName(e.target.value)
11463
11647
  }
11464
11648
  ),
11465
- /* @__PURE__ */ jsx43(Button35, { size: "sm", type: "submit", disabled: busy || name.trim() === "", children: "Sign" }),
11649
+ /* @__PURE__ */ jsx43(Button36, { size: "sm", type: "submit", disabled: busy || name.trim() === "", children: "Sign" }),
11466
11650
  /* @__PURE__ */ jsxs39("span", { className: "text-xs text-muted-foreground", children: [
11467
11651
  "seals version ",
11468
11652
  render.template_version,
@@ -11479,9 +11663,9 @@ function SignBlock({ tableId, recordId, render, className }) {
11479
11663
  }
11480
11664
 
11481
11665
  // src/NotifyRuleEditor.tsx
11482
- import { useCallback as useCallback26, useEffect as useEffect30, useState as useState40 } from "react";
11666
+ import { useCallback as useCallback26, useEffect as useEffect30, useState as useState41 } from "react";
11483
11667
  import { useRecordsClient as useRecordsClient32, useTable as useTable16 } from "@ai-matrx/records/react";
11484
- import { Button as Button36, Skeleton as Skeleton23, cn as cn38 } from "@ai-matrx/design-system";
11668
+ import { Button as Button37, Skeleton as Skeleton23, cn as cn38 } from "@ai-matrx/design-system";
11485
11669
  import { jsx as jsx44, jsxs as jsxs40 } from "react/jsx-runtime";
11486
11670
  var CADENCE_WORDS2 = {
11487
11671
  instant: "as it happens",
@@ -11499,11 +11683,11 @@ function NotifyRuleEditor({ tableId, seed, className }) {
11499
11683
  const host = useRecordsUi();
11500
11684
  const table = useTable16(tableId);
11501
11685
  const rights = useTableRights(table.data);
11502
- const [subscriptions, setSubscriptions] = useState40(null);
11503
- const [cadences, setCadences] = useState40([]);
11504
- const [views, setViews] = useState40(null);
11505
- const [error, setError] = useState40(null);
11506
- const [busy, setBusy] = useState40(false);
11686
+ const [subscriptions, setSubscriptions] = useState41(null);
11687
+ const [cadences, setCadences] = useState41([]);
11688
+ const [views, setViews] = useState41(null);
11689
+ const [error, setError] = useState41(null);
11690
+ const [busy, setBusy] = useState41(false);
11507
11691
  const load = useCallback26(async () => {
11508
11692
  const [held, offered] = await Promise.all([
11509
11693
  // THE PERSON'S OWN DOOR, not the notifier's. It answers what is addressed
@@ -11592,7 +11776,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
11592
11776
  {
11593
11777
  error,
11594
11778
  className,
11595
- actions: /* @__PURE__ */ jsx44(Button36, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11779
+ actions: /* @__PURE__ */ jsx44(Button37, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
11596
11780
  }
11597
11781
  );
11598
11782
  }
@@ -11625,7 +11809,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
11625
11809
  held.saved_view_id === null ? /* @__PURE__ */ jsx44("span", { className: "text-destructive", children: "This one names no view, so the store never admits a record to it." }) : null,
11626
11810
  held.muted ? /* @__PURE__ */ jsx44("span", { className: "text-muted-foreground", children: "Switched off \u2014 it tells nobody until somebody switches it back on." }) : null,
11627
11811
  rights.write ? /* @__PURE__ */ jsx44(
11628
- Button36,
11812
+ Button37,
11629
11813
  {
11630
11814
  size: "sm",
11631
11815
  variant: "ghost",
@@ -11686,7 +11870,7 @@ function NotifyRuleEditor({ tableId, seed, className }) {
11686
11870
  className: "h-7 rounded border bg-background px-1 text-xs"
11687
11871
  }
11688
11872
  ),
11689
- /* @__PURE__ */ jsx44(Button36, { size: "sm", type: "submit", disabled: busy, children: "Tell me" }),
11873
+ /* @__PURE__ */ jsx44(Button37, { size: "sm", type: "submit", disabled: busy, children: "Tell me" }),
11690
11874
  /* @__PURE__ */ jsx44("p", { className: "w-full text-xs text-muted-foreground", children: "A send inside your quiet hours is held until they end \u2014 it is never dropped. Leave the schedule blank for the store's own default of 08:00." })
11691
11875
  ]
11692
11876
  }
@@ -12008,9 +12192,9 @@ function Drawing({
12008
12192
  }
12009
12193
 
12010
12194
  // src/DashboardCanvas.tsx
12011
- import { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo27, useState as useState41 } from "react";
12195
+ import { useCallback as useCallback27, useEffect as useEffect31, useMemo as useMemo27, useState as useState42 } from "react";
12012
12196
  import { useFields as useFields19, useRecordsClient as useRecordsClient33, useTable as useTable17 } from "@ai-matrx/records/react";
12013
- import { BasicInput as BasicInput14, Button as Button37, Skeleton as Skeleton24, cn as cn40 } from "@ai-matrx/design-system";
12197
+ import { BasicInput as BasicInput14, Button as Button38, Skeleton as Skeleton24, cn as cn40 } from "@ai-matrx/design-system";
12014
12198
  import { Fragment as Fragment20, jsx as jsx46, jsxs as jsxs42 } from "react/jsx-runtime";
12015
12199
  function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12016
12200
  const client = useRecordsClient33();
@@ -12018,14 +12202,14 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12018
12202
  const table = useTable17(tableId);
12019
12203
  const rights = useTableRights(table.data);
12020
12204
  const fields = useFields19(tableId);
12021
- const [boards, setBoards] = useState41(null);
12022
- const [error, setError] = useState41(null);
12023
- const [activeId, setActiveId] = useState41(activeDashboardId ?? null);
12024
- const [run, setRun] = useState41(null);
12025
- const [running, setRunning] = useState41(false);
12026
- const [question, setQuestion] = useState41("");
12027
- const [asking, setAsking] = useState41(false);
12028
- const [scheduling, setScheduling] = useState41(false);
12205
+ const [boards, setBoards] = useState42(null);
12206
+ const [error, setError] = useState42(null);
12207
+ const [activeId, setActiveId] = useState42(activeDashboardId ?? null);
12208
+ const [run, setRun] = useState42(null);
12209
+ const [running, setRunning] = useState42(false);
12210
+ const [question, setQuestion] = useState42("");
12211
+ const [asking, setAsking] = useState42(false);
12212
+ const [scheduling, setScheduling] = useState42(false);
12029
12213
  const load = useCallback27(async () => {
12030
12214
  const answered = await client.dashboards({ table_id: tableId });
12031
12215
  if (!answered.ok) {
@@ -12155,7 +12339,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12155
12339
  {
12156
12340
  error,
12157
12341
  className,
12158
- actions: /* @__PURE__ */ jsx46(Button37, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
12342
+ actions: /* @__PURE__ */ jsx46(Button38, { size: "sm", variant: "ghost", onClick: () => void load(), children: "Try again" })
12159
12343
  }
12160
12344
  );
12161
12345
  }
@@ -12163,7 +12347,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12163
12347
  return /* @__PURE__ */ jsxs42("div", { className: cn40("flex min-h-0 flex-col gap-2", className), children: [
12164
12348
  /* @__PURE__ */ jsxs42("div", { className: "flex flex-wrap items-center gap-1", role: "group", "aria-label": "Dashboards", children: [
12165
12349
  boards.map((d) => /* @__PURE__ */ jsx46(
12166
- Button37,
12350
+ Button38,
12167
12351
  {
12168
12352
  size: "sm",
12169
12353
  variant: d.id === activeId ? "secondary" : "ghost",
@@ -12173,10 +12357,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12173
12357
  },
12174
12358
  d.id
12175
12359
  )),
12176
- rights.admin ? /* @__PURE__ */ jsx46(Button37, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
12360
+ rights.admin ? /* @__PURE__ */ jsx46(Button38, { size: "sm", variant: "ghost", onClick: () => void create(), children: "New dashboard" }) : null,
12177
12361
  board ? /* @__PURE__ */ jsxs42("span", { className: "ml-auto flex items-center gap-1", children: [
12178
12362
  /* @__PURE__ */ jsx46(
12179
- Button37,
12363
+ Button38,
12180
12364
  {
12181
12365
  size: "sm",
12182
12366
  variant: "ghost",
@@ -12186,7 +12370,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12186
12370
  }
12187
12371
  ),
12188
12372
  /* @__PURE__ */ jsx46(
12189
- Button37,
12373
+ Button38,
12190
12374
  {
12191
12375
  size: "sm",
12192
12376
  variant: scheduling ? "secondary" : "ghost",
@@ -12194,7 +12378,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12194
12378
  children: scheduling ? "Done" : "Send on a schedule"
12195
12379
  }
12196
12380
  ),
12197
- rights.admin ? /* @__PURE__ */ jsx46(Button37, { size: "sm", variant: "ghost", onClick: () => void remove(board), children: "Delete" }) : null
12381
+ rights.admin ? /* @__PURE__ */ jsx46(Button38, { size: "sm", variant: "ghost", onClick: () => void remove(board), children: "Delete" }) : null
12198
12382
  ] }) : null
12199
12383
  ] }),
12200
12384
  board && scheduling ? /* @__PURE__ */ jsx46(
@@ -12222,7 +12406,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12222
12406
  className: "h-8 min-w-0 flex-1 text-xs"
12223
12407
  }
12224
12408
  ),
12225
- /* @__PURE__ */ jsx46(Button37, { size: "sm", disabled: !host.onReask || asking || question.trim() === "", onClick: () => void reask(), children: asking ? "Asking" : "Ask" })
12409
+ /* @__PURE__ */ jsx46(Button38, { size: "sm", disabled: !host.onReask || asking || question.trim() === "", onClick: () => void reask(), children: asking ? "Asking" : "Ask" })
12226
12410
  ] }),
12227
12411
  !host.onReask ? /* @__PURE__ */ jsx46("p", { className: "text-xs text-muted-foreground", children: NO_REASK_REASON }) : null
12228
12412
  ] }) : null,
@@ -12246,7 +12430,7 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12246
12430
  }
12247
12431
  ),
12248
12432
  /* @__PURE__ */ jsx46(
12249
- Button37,
12433
+ Button38,
12250
12434
  {
12251
12435
  size: "sm",
12252
12436
  variant: "ghost",
@@ -12265,10 +12449,10 @@ function DashboardCanvas({ tableId, activeDashboardId, filter, className }) {
12265
12449
  }
12266
12450
 
12267
12451
  // src/FormsPanel.tsx
12268
- import { useCallback as useCallback28, useEffect as useEffect32, useState as useState42 } from "react";
12452
+ import { useCallback as useCallback28, useEffect as useEffect32, useState as useState43 } from "react";
12269
12453
  import { useRecordsClient as useRecordsClient34, useTable as useTable18 } from "@ai-matrx/records/react";
12270
12454
  import { publicFormPath as publicFormPath2 } from "@ai-matrx/records";
12271
- import { Badge as Badge15, Button as Button38, Skeleton as Skeleton25, cn as cn41 } from "@ai-matrx/design-system";
12455
+ import { Badge as Badge15, Button as Button39, Skeleton as Skeleton25, cn as cn41 } from "@ai-matrx/design-system";
12272
12456
  import { Fragment as Fragment21, jsx as jsx47, jsxs as jsxs43 } from "react/jsx-runtime";
12273
12457
  var WHAT_A_FORM_IS = "A form asks for this table's own fields, and its answers land here as ordinary records stamped with the form they came through.";
12274
12458
  var NO_ADMIN = "This table has no forms. Making one needs the admin level on it, because a form decides what people with no account may add here.";
@@ -12281,11 +12465,11 @@ function FormsPanel({ tableId, className }) {
12281
12465
  const host = useRecordsUi();
12282
12466
  const table = useTable18(tableId);
12283
12467
  const rights = useTableRights(table.data);
12284
- const [forms, setForms] = useState42(null);
12285
- const [error, setError] = useState42(null);
12286
- const [busy, setBusy] = useState42(null);
12287
- const [copied, setCopied] = useState42(null);
12288
- const [building, setBuilding] = useState42(false);
12468
+ const [forms, setForms] = useState43(null);
12469
+ const [error, setError] = useState43(null);
12470
+ const [busy, setBusy] = useState43(null);
12471
+ const [copied, setCopied] = useState43(null);
12472
+ const [building, setBuilding] = useState43(false);
12289
12473
  const load = useCallback28(async () => {
12290
12474
  const answered = await client.forms({ table_id: tableId });
12291
12475
  if (!answered.ok) {
@@ -12313,7 +12497,7 @@ function FormsPanel({ tableId, className }) {
12313
12497
  },
12314
12498
  [client, load]
12315
12499
  );
12316
- const [shown, setShown] = useState42(null);
12500
+ const [shown, setShown] = useState43(null);
12317
12501
  const copy = useCallback28(async (url, formId) => {
12318
12502
  try {
12319
12503
  await navigator.clipboard.writeText(url);
@@ -12331,7 +12515,7 @@ function FormsPanel({ tableId, className }) {
12331
12515
  /* @__PURE__ */ jsx47("h3", { className: "text-sm font-medium", children: "Forms" }),
12332
12516
  /* @__PURE__ */ jsx47("span", { className: "text-xs text-muted-foreground", children: forms.length === 0 ? "none yet" : `${forms.length}` }),
12333
12517
  /* @__PURE__ */ jsx47("div", { className: "flex-1" }),
12334
- rights.structure && forms.length > 0 ? /* @__PURE__ */ jsx47(Button38, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a form" }) : null
12518
+ rights.structure && forms.length > 0 ? /* @__PURE__ */ jsx47(Button39, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a form" }) : null
12335
12519
  ] }),
12336
12520
  error ? /* @__PURE__ */ jsx47(RefusalNotice, { error }) : null,
12337
12521
  building ? /* @__PURE__ */ jsx47(
@@ -12388,9 +12572,9 @@ function FormsPanel({ tableId, className }) {
12388
12572
  ] }) : null
12389
12573
  ] }),
12390
12574
  /* @__PURE__ */ jsxs43("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
12391
- form.published_at ? /* @__PURE__ */ jsx47(Button38, { size: "sm", variant: "outline", onClick: () => void copy(url, form.form_id), children: copied === form.form_id ? "Copied" : "Copy link" }) : null,
12575
+ form.published_at ? /* @__PURE__ */ jsx47(Button39, { size: "sm", variant: "outline", onClick: () => void copy(url, form.form_id), children: copied === form.form_id ? "Copied" : "Copy link" }) : null,
12392
12576
  rights.structure ? /* @__PURE__ */ jsx47(
12393
- Button38,
12577
+ Button39,
12394
12578
  {
12395
12579
  size: "sm",
12396
12580
  variant: "ghost",
@@ -12412,12 +12596,12 @@ function FormsPanel({ tableId, className }) {
12412
12596
  }
12413
12597
 
12414
12598
  // src/BookingBuilder.tsx
12415
- import { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo28, useState as useState43 } from "react";
12599
+ import { useCallback as useCallback29, useEffect as useEffect33, useMemo as useMemo28, useState as useState44 } from "react";
12416
12600
  import { useFields as useFields20, useRecordsClient as useRecordsClient35, useTable as useTable19 } from "@ai-matrx/records/react";
12417
12601
  import {
12418
12602
  bookingPath
12419
12603
  } from "@ai-matrx/records";
12420
- import { BasicInput as BasicInput15, BasicTextarea as BasicTextarea7, Button as Button39, Checkbox as Checkbox7, Label as Label8, Skeleton as Skeleton26, cn as cn42 } from "@ai-matrx/design-system";
12604
+ import { BasicInput as BasicInput15, BasicTextarea as BasicTextarea7, Button as Button40, Checkbox as Checkbox7, Label as Label8, Skeleton as Skeleton26, cn as cn42 } from "@ai-matrx/design-system";
12421
12605
  import { Fragment as Fragment22, jsx as jsx48, jsxs as jsxs44 } from "react/jsx-runtime";
12422
12606
  var STORE_ANSWERS_THESE = ["slot", "status", "booked_with"];
12423
12607
  var DAYS = [
@@ -12430,6 +12614,7 @@ var DAYS = [
12430
12614
  { weekday: 0, label: "Sun" }
12431
12615
  ];
12432
12616
  var LENGTHS = [15, 20, 30, 45, 60, 90, 120];
12617
+ var WORKING_WEEK = /* @__PURE__ */ new Set([1, 2, 3, 4, 5]);
12433
12618
  function draftWindows(availability) {
12434
12619
  return DAYS.map((day) => {
12435
12620
  const found = availability?.windows.find((w) => w.weekday === day.weekday);
@@ -12437,7 +12622,7 @@ function draftWindows(availability) {
12437
12622
  weekday: day.weekday,
12438
12623
  from: found?.from ?? "09:00",
12439
12624
  to: found?.to ?? "17:00",
12440
- on: Boolean(found)
12625
+ on: availability ? Boolean(found) : WORKING_WEEK.has(day.weekday)
12441
12626
  };
12442
12627
  });
12443
12628
  }
@@ -12447,28 +12632,30 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12447
12632
  const table = useTable19(tableId);
12448
12633
  const rights = useTableRights(table.data);
12449
12634
  const fields = useFields20(tableId);
12450
- const [existing, setExisting] = useState43(null);
12451
- const [loaded, setLoaded] = useState43(false);
12452
- const [error, setError] = useState43(null);
12453
- const [saving, setSaving] = useState43(false);
12454
- const [publishing, setPublishing] = useState43(false);
12455
- const [copied, setCopied] = useState43(false);
12456
- const [title, setTitle] = useState43("");
12457
- const [minutes, setMinutes] = useState43(30);
12458
- const [buffer, setBuffer] = useState43(0);
12459
- const [lead, setLead] = useState43(120);
12460
- const [perDay, setPerDay] = useState43(8);
12461
- const [days, setDays] = useState43(30);
12462
- const [windows, setWindows] = useState43(() => draftWindows(null));
12463
- const [asked, setAsked] = useState43([]);
12464
- const [confirmation, setConfirmation] = useState43("");
12465
- const [offer, setOffer] = useState43(null);
12466
- const [formId, setFormId] = useState43(bookingId ?? null);
12635
+ const [existing, setExisting] = useState44(null);
12636
+ const [loaded, setLoaded] = useState44(false);
12637
+ const [error, setError] = useState44(null);
12638
+ const [saving, setSaving] = useState44(false);
12639
+ const [publishing, setPublishing] = useState44(false);
12640
+ const [copied, setCopied] = useState44(false);
12641
+ const [title, setTitle] = useState44("");
12642
+ const [minutes, setMinutes] = useState44(30);
12643
+ const [buffer, setBuffer] = useState44(0);
12644
+ const [lead, setLead] = useState44(120);
12645
+ const [perDay, setPerDay] = useState44(8);
12646
+ const [days, setDays] = useState44(30);
12647
+ const [windows, setWindows] = useState44(() => draftWindows(null));
12648
+ const [asked, setAsked] = useState44([]);
12649
+ const [confirmation, setConfirmation] = useState44("");
12650
+ const [offer, setOffer] = useState44(null);
12651
+ const [formId, setFormId] = useState44(bookingId ?? null);
12467
12652
  const publicOrigin = host.publicOrigin ?? (typeof window === "undefined" ? "" : window.location.origin);
12468
12653
  const askable = useMemo28(
12469
- () => (fields.data ?? []).filter(
12470
- (f) => !STORE_ANSWERS_THESE.includes(f.key)
12471
- ),
12654
+ () => askableFields(fields.data ?? [], STORE_ANSWERS_THESE),
12655
+ [fields.data]
12656
+ );
12657
+ const leftOut = useMemo28(
12658
+ () => whyNotAskable(fields.data ?? [], STORE_ANSWERS_THESE),
12472
12659
  [fields.data]
12473
12660
  );
12474
12661
  const load = useCallback29(async () => {
@@ -12494,6 +12681,15 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12494
12681
  if (!existing) return;
12495
12682
  setMinutes(existing.slot_minutes);
12496
12683
  }, [existing]);
12684
+ useEffect33(() => {
12685
+ if (!offer) return;
12686
+ setWindows(draftWindows(offer));
12687
+ setMinutes(offer.slot_minutes);
12688
+ setBuffer(offer.buffer_minutes);
12689
+ setLead(offer.lead_minutes);
12690
+ setPerDay(offer.max_per_day);
12691
+ setDays(offer.days);
12692
+ }, [offer]);
12497
12693
  const availability = useCallback29(
12498
12694
  () => ({
12499
12695
  slot_minutes: minutes,
@@ -12557,8 +12753,8 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12557
12753
  /* @__PURE__ */ jsxs44("header", { className: "flex items-center gap-2", children: [
12558
12754
  /* @__PURE__ */ jsx48("h3", { className: "text-sm font-medium", children: existing ? "Booking page" : "New booking page" }),
12559
12755
  /* @__PURE__ */ jsx48("div", { className: "flex-1" }),
12560
- /* @__PURE__ */ jsx48(Button39, { size: "sm", disabled: saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" }),
12561
- onClose ? /* @__PURE__ */ jsx48(Button39, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
12756
+ /* @__PURE__ */ jsx48(Button40, { size: "sm", disabled: saving, onClick: () => void save(), children: saving ? "Saving\u2026" : "Save" }),
12757
+ onClose ? /* @__PURE__ */ jsx48(Button40, { size: "sm", variant: "ghost", onClick: onClose, children: "Close" }) : null
12562
12758
  ] }),
12563
12759
  error ? /* @__PURE__ */ jsx48(RefusalNotice, { error }) : null,
12564
12760
  /* @__PURE__ */ jsxs44("label", { className: "flex flex-col gap-1", children: [
@@ -12681,7 +12877,8 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12681
12877
  ),
12682
12878
  fieldName(f)
12683
12879
  ] }, f.key)) }),
12684
- /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: "The time, whether it is booked or cancelled, and who it is with are filled in by the store \u2014 a booking page cannot ask a visitor for any of the three." })
12880
+ /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: "The time, whether it is booked or cancelled, and who it is with are filled in by the store \u2014 a booking page cannot ask a visitor for any of the three." }),
12881
+ leftOut ? /* @__PURE__ */ jsx48("p", { className: "text-xs text-muted-foreground", children: leftOut }) : null
12685
12882
  ] }),
12686
12883
  /* @__PURE__ */ jsxs44("label", { className: "flex flex-col gap-1", children: [
12687
12884
  /* @__PURE__ */ jsx48(Label8, { className: "text-xs font-medium", children: "What they see after booking" }),
@@ -12717,7 +12914,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12717
12914
  url ? /* @__PURE__ */ jsxs44("div", { className: "flex flex-wrap items-center gap-2 rounded-md border p-2.5", children: [
12718
12915
  /* @__PURE__ */ jsx48("span", { className: "min-w-0 flex-1 break-all text-xs", children: url }),
12719
12916
  /* @__PURE__ */ jsx48(
12720
- Button39,
12917
+ Button40,
12721
12918
  {
12722
12919
  size: "sm",
12723
12920
  variant: "outline",
@@ -12731,7 +12928,7 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12731
12928
  }
12732
12929
  ),
12733
12930
  /* @__PURE__ */ jsx48(
12734
- Button39,
12931
+ Button40,
12735
12932
  {
12736
12933
  size: "sm",
12737
12934
  disabled: publishing,
@@ -12746,10 +12943,10 @@ function BookingBuilder({ tableId, bookingId, onSaved, onClose, className }) {
12746
12943
  }
12747
12944
 
12748
12945
  // src/BookingSlots.tsx
12749
- import { useCallback as useCallback30, useEffect as useEffect34, useMemo as useMemo29, useState as useState44 } from "react";
12946
+ import { useCallback as useCallback30, useEffect as useEffect34, useMemo as useMemo29, useState as useState45 } from "react";
12750
12947
  import { useRecordsClient as useRecordsClient36, useMyLevels as useMyLevels2 } from "@ai-matrx/records/react";
12751
12948
  import { bookingPath as bookingPath2 } from "@ai-matrx/records";
12752
- import { Badge as Badge16, Button as Button40, Skeleton as Skeleton27, cn as cn43 } from "@ai-matrx/design-system";
12949
+ import { Badge as Badge16, Button as Button41, Skeleton as Skeleton27, cn as cn43 } from "@ai-matrx/design-system";
12753
12950
  import { Fragment as Fragment23, jsx as jsx49, jsxs as jsxs45 } from "react/jsx-runtime";
12754
12951
  var WHAT_A_BOOKING_PAGE_IS = "A booking page offers times you are free and writes each appointment into this table as an ordinary record.";
12755
12952
  function bookingSuggestion(tableName2) {
@@ -12766,12 +12963,12 @@ var STATE_WORDS = {
12766
12963
  function BookingSlots({ tableId, className }) {
12767
12964
  const client = useRecordsClient36();
12768
12965
  const host = useRecordsUi();
12769
- const [pages, setPages] = useState44(null);
12770
- const [error, setError] = useState44(null);
12771
- const [busy, setBusy] = useState44(null);
12772
- const [copied, setCopied] = useState44(null);
12773
- const [shown, setShown] = useState44(null);
12774
- const [building, setBuilding] = useState44(false);
12966
+ const [pages, setPages] = useState45(null);
12967
+ const [error, setError] = useState45(null);
12968
+ const [busy, setBusy] = useState45(null);
12969
+ const [copied, setCopied] = useState45(null);
12970
+ const [shown, setShown] = useState45(null);
12971
+ const [building, setBuilding] = useState45(false);
12775
12972
  const load = useCallback30(async () => {
12776
12973
  const answered = await client.bookings(tableId ? { table_id: tableId } : {});
12777
12974
  if (!answered.ok) {
@@ -12822,7 +13019,7 @@ function BookingSlots({ tableId, className }) {
12822
13019
  /* @__PURE__ */ jsx49("h3", { className: "text-sm font-medium", children: "Bookings" }),
12823
13020
  /* @__PURE__ */ jsx49("span", { className: "text-xs text-muted-foreground", children: pages.length === 0 ? "none yet" : `${pages.length}` }),
12824
13021
  /* @__PURE__ */ jsx49("div", { className: "flex-1" }),
12825
- tableId && pages.length > 0 ? /* @__PURE__ */ jsx49(Button40, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a booking page" }) : null
13022
+ tableId && pages.length > 0 ? /* @__PURE__ */ jsx49(Button41, { size: "sm", variant: building ? "secondary" : "ghost", onClick: () => setBuilding((b) => !b), children: building ? "Done building" : "Build a booking page" }) : null
12826
13023
  ] }),
12827
13024
  error ? /* @__PURE__ */ jsx49(RefusalNotice, { error }) : null,
12828
13025
  building && tableId ? /* @__PURE__ */ jsx49(
@@ -12889,9 +13086,9 @@ function BookingSlots({ tableId, className }) {
12889
13086
  ] }),
12890
13087
  /* @__PURE__ */ jsx49("p", { className: "mt-1 text-xs text-muted-foreground", children: nextInWords(page) }),
12891
13088
  /* @__PURE__ */ jsxs45("div", { className: "mt-2 flex flex-wrap items-center gap-1.5", children: [
12892
- /* @__PURE__ */ jsx49(Button40, { size: "sm", variant: "outline", onClick: () => void copy(url, page.form_id), children: copied === page.form_id ? "Copied" : "Copy link" }),
13089
+ /* @__PURE__ */ jsx49(Button41, { size: "sm", variant: "outline", onClick: () => void copy(url, page.form_id), children: copied === page.form_id ? "Copied" : "Copy link" }),
12893
13090
  mayOpen ? /* @__PURE__ */ jsx49(
12894
- Button40,
13091
+ Button41,
12895
13092
  {
12896
13093
  size: "sm",
12897
13094
  variant: "ghost",
@@ -12939,17 +13136,17 @@ function nextInWords(page) {
12939
13136
  }
12940
13137
 
12941
13138
  // src/CaptureSheet.tsx
12942
- import { useCallback as useCallback32, useEffect as useEffect36, useRef as useRef14, useState as useState46 } from "react";
13139
+ import { useCallback as useCallback32, useEffect as useEffect36, useRef as useRef14, useState as useState47 } from "react";
12943
13140
  import { useFields as useFields21, useRecordsClient as useRecordsClient38, useTable as useTable20 } from "@ai-matrx/records/react";
12944
- import { Button as Button42, Input as Input4, Skeleton as Skeleton29, Textarea as Textarea3, cn as cn45 } from "@ai-matrx/design-system";
13141
+ import { Button as Button43, Input as Input4, Skeleton as Skeleton29, Textarea as Textarea3, cn as cn45 } from "@ai-matrx/design-system";
12945
13142
 
12946
13143
  // src/CaptureRun.tsx
12947
- import { useCallback as useCallback31, useEffect as useEffect35, useMemo as useMemo30, useRef as useRef13, useState as useState45 } from "react";
13144
+ import { useCallback as useCallback31, useEffect as useEffect35, useMemo as useMemo30, useRef as useRef13, useState as useState46 } from "react";
12948
13145
  import {
12949
13146
  openCaptureQueue
12950
13147
  } from "@ai-matrx/records";
12951
13148
  import { useRecordsClient as useRecordsClient37 } from "@ai-matrx/records/react";
12952
- import { Button as Button41, Input as Input3, Skeleton as Skeleton28, Textarea as Textarea2, cn as cn44 } from "@ai-matrx/design-system";
13149
+ import { Button as Button42, Input as Input3, Skeleton as Skeleton28, Textarea as Textarea2, cn as cn44 } from "@ai-matrx/design-system";
12953
13150
  import { jsx as jsx50, jsxs as jsxs46 } from "react/jsx-runtime";
12954
13151
  function controlFor(field) {
12955
13152
  if (!field) return "text";
@@ -12989,17 +13186,17 @@ function whereWeAre(timeoutMs = 4e3) {
12989
13186
  function CaptureRun({ sheetId, face: given, className }) {
12990
13187
  const client = useRecordsClient37();
12991
13188
  const host = useRecordsUi();
12992
- const [face, setFace] = useState45(given);
12993
- const [loadFailed, setLoadFailed] = useState45(null);
12994
- const [at, setAt] = useState45(0);
12995
- const [answers, setAnswers] = useState45({});
12996
- const [files, setFiles] = useState45({});
12997
- const [missing, setMissing] = useState45(null);
12998
- const [done, setDone] = useState45(null);
12999
- const [counts, setCounts] = useState45({ waiting: 0, sending: 0, refused: 0, landed: 0 });
13000
- const [items, setItems] = useState45([]);
13001
- const [lastSynced, setLastSynced] = useState45(null);
13002
- const [sending, setSending] = useState45(false);
13189
+ const [face, setFace] = useState46(given);
13190
+ const [loadFailed, setLoadFailed] = useState46(null);
13191
+ const [at, setAt] = useState46(0);
13192
+ const [answers, setAnswers] = useState46({});
13193
+ const [files, setFiles] = useState46({});
13194
+ const [missing, setMissing] = useState46(null);
13195
+ const [done, setDone] = useState46(null);
13196
+ const [counts, setCounts] = useState46({ waiting: 0, sending: 0, refused: 0, landed: 0 });
13197
+ const [items, setItems] = useState46([]);
13198
+ const [lastSynced, setLastSynced] = useState46(null);
13199
+ const [sending, setSending] = useState46(false);
13003
13200
  const queueRef = useRef13(null);
13004
13201
  useEffect35(() => {
13005
13202
  const q2 = openCaptureQueue({
@@ -13140,7 +13337,7 @@ function CaptureRun({ sheetId, face: given, className }) {
13140
13337
  ] }) : null,
13141
13338
  /* @__PURE__ */ jsx50("span", { className: "ml-auto", "data-testid": "capture-last-synced", children: lastSynced ? `Last synced ${new Date(lastSynced).toLocaleTimeString()}` : "Not synced yet" }),
13142
13339
  waiting > 0 || counts.refused > 0 ? /* @__PURE__ */ jsx50(
13143
- Button41,
13340
+ Button42,
13144
13341
  {
13145
13342
  size: "sm",
13146
13343
  variant: "ghost",
@@ -13156,7 +13353,7 @@ function CaptureRun({ sheetId, face: given, className }) {
13156
13353
  /* @__PURE__ */ jsx50("span", { className: "tabular-nums text-muted-foreground", children: new Date(i.captured_at).toLocaleTimeString() }),
13157
13354
  /* @__PURE__ */ jsx50("span", { className: cn44("flex-1", i.state === "refused" && "text-destructive"), children: i.state === "refused" ? i.last_error ?? "This one was refused." : i.last_error ?? "Waiting for a signal." }),
13158
13355
  i.state === "refused" ? /* @__PURE__ */ jsx50(
13159
- Button41,
13356
+ Button42,
13160
13357
  {
13161
13358
  size: "sm",
13162
13359
  variant: "ghost",
@@ -13179,7 +13376,7 @@ function CaptureRun({ sheetId, face: given, className }) {
13179
13376
  return /* @__PURE__ */ jsxs46("section", { className: cn44("mx-auto flex w-full max-w-sm flex-col gap-3 p-4", className), children: [
13180
13377
  /* @__PURE__ */ jsx50("h2", { className: "text-lg font-medium", "data-testid": "capture-thankyou", children: thanks.title ?? "Logged" }),
13181
13378
  /* @__PURE__ */ jsx50("p", { className: "text-sm text-muted-foreground", children: done.queued ? "There is no signal, so this one is on the phone and goes up the moment there is. Nothing is lost." : thanks.body ?? "Ready for the next one." }),
13182
- /* @__PURE__ */ jsx50(Button41, { className: "h-12", onClick: () => setDone(null), "data-testid": "capture-next", children: "Next one" }),
13379
+ /* @__PURE__ */ jsx50(Button42, { className: "h-12", onClick: () => setDone(null), "data-testid": "capture-next", children: "Next one" }),
13183
13380
  queueLine,
13184
13381
  queuePanel
13185
13382
  ] });
@@ -13273,7 +13470,7 @@ function CaptureRun({ sheetId, face: given, className }) {
13273
13470
  missing ? /* @__PURE__ */ jsx50("p", { className: "text-sm text-destructive", "data-testid": "capture-missing", children: missing }) : null,
13274
13471
  /* @__PURE__ */ jsxs46("div", { className: "flex items-center gap-2", children: [
13275
13472
  at > 0 ? /* @__PURE__ */ jsx50(
13276
- Button41,
13473
+ Button42,
13277
13474
  {
13278
13475
  variant: "ghost",
13279
13476
  className: "h-12 px-3",
@@ -13283,7 +13480,7 @@ function CaptureRun({ sheetId, face: given, className }) {
13283
13480
  }
13284
13481
  ) : null,
13285
13482
  last ? /* @__PURE__ */ jsx50(
13286
- Button41,
13483
+ Button42,
13287
13484
  {
13288
13485
  className: "h-12 flex-1 text-base",
13289
13486
  onClick: () => void capture(),
@@ -13291,7 +13488,7 @@ function CaptureRun({ sheetId, face: given, className }) {
13291
13488
  children: "Capture"
13292
13489
  }
13293
13490
  ) : /* @__PURE__ */ jsx50(
13294
- Button41,
13491
+ Button42,
13295
13492
  {
13296
13493
  className: "h-12 flex-1 text-base",
13297
13494
  onClick: () => setAt(at + 1),
@@ -13349,15 +13546,15 @@ function AdHocCaptureSheet({
13349
13546
  const host = useRecordsUi();
13350
13547
  const table = useTable20(tableId);
13351
13548
  const fields = useFields21(tableId);
13352
- const [mode, setMode] = useState46("reading");
13353
- const [reading, setReading] = useState46("");
13354
- const [note, setNote] = useState46("");
13355
- const [fileId, setFileId] = useState46(null);
13356
- const [pending, setPending] = useState46(null);
13357
- const [saved, setSaved] = useState46([]);
13358
- const [error, setError] = useState46(null);
13359
- const [uploadError, setUploadError] = useState46(null);
13360
- const [flushing, setFlushing] = useState46(false);
13549
+ const [mode, setMode] = useState47("reading");
13550
+ const [reading, setReading] = useState47("");
13551
+ const [note, setNote] = useState47("");
13552
+ const [fileId, setFileId] = useState47(null);
13553
+ const [pending, setPending] = useState47(null);
13554
+ const [saved, setSaved] = useState47([]);
13555
+ const [error, setError] = useState47(null);
13556
+ const [uploadError, setUploadError] = useState47(null);
13557
+ const [flushing, setFlushing] = useState47(false);
13361
13558
  const queue = useRef14([]);
13362
13559
  const keep = useCallback32(
13363
13560
  async (next) => {
@@ -13446,7 +13643,7 @@ function AdHocCaptureSheet({
13446
13643
  return /* @__PURE__ */ jsxs47("section", { className: cn45("mx-auto flex w-full max-w-sm flex-col gap-2", className), children: [
13447
13644
  /* @__PURE__ */ jsxs47("header", { className: "flex items-center gap-1 text-xs text-muted-foreground", children: [
13448
13645
  CAPTURE_MODES.map((m) => /* @__PURE__ */ jsx51(
13449
- Button42,
13646
+ Button43,
13450
13647
  {
13451
13648
  size: "sm",
13452
13649
  variant: m === mode ? "default" : "ghost",
@@ -13517,12 +13714,12 @@ function AdHocCaptureSheet({
13517
13714
  onChange: (e) => setNote(e.target.value)
13518
13715
  }
13519
13716
  ),
13520
- /* @__PURE__ */ jsx51(Button42, { className: "h-12", onClick: () => void capture(), children: "Capture" }),
13717
+ /* @__PURE__ */ jsx51(Button43, { className: "h-12", onClick: () => void capture(), children: "Capture" }),
13521
13718
  pending.length > 0 ? /* @__PURE__ */ jsxs47("div", { className: "flex flex-col gap-1 rounded border p-2", children: [
13522
13719
  /* @__PURE__ */ jsxs47("div", { className: "flex items-center gap-2 text-xs", children: [
13523
13720
  /* @__PURE__ */ jsx51("span", { className: "font-medium", children: "Waiting to send" }),
13524
13721
  /* @__PURE__ */ jsx51(
13525
- Button42,
13722
+ Button43,
13526
13723
  {
13527
13724
  size: "sm",
13528
13725
  variant: "ghost",
@@ -13546,17 +13743,17 @@ function AdHocCaptureSheet({
13546
13743
  }
13547
13744
 
13548
13745
  // src/PortalShell.tsx
13549
- import { useCallback as useCallback33, useEffect as useEffect37, useState as useState47 } from "react";
13746
+ import { useCallback as useCallback33, useEffect as useEffect37, useState as useState48 } from "react";
13550
13747
  import { useRecordsClient as useRecordsClient39 } from "@ai-matrx/records/react";
13551
- import { Button as Button43, Skeleton as Skeleton30, cn as cn46 } from "@ai-matrx/design-system";
13748
+ import { Button as Button44, Skeleton as Skeleton30, cn as cn46 } from "@ai-matrx/design-system";
13552
13749
  import { jsx as jsx52, jsxs as jsxs48 } from "react/jsx-runtime";
13553
13750
  function PortalShell({ tableId, form, resourceType = "record", className }) {
13554
13751
  const client = useRecordsClient39();
13555
- const [card, setCard] = useState47(null);
13556
- const [reach, setReach] = useState47(null);
13557
- const [error, setError] = useState47(null);
13558
- const [open, setOpen] = useState47(null);
13559
- const [sending, setSending] = useState47(false);
13752
+ const [card, setCard] = useState48(null);
13753
+ const [reach, setReach] = useState48(null);
13754
+ const [error, setError] = useState48(null);
13755
+ const [open, setOpen] = useState48(null);
13756
+ const [sending, setSending] = useState48(false);
13560
13757
  const load = useCallback33(async () => {
13561
13758
  const who = await client.externalPrincipalCard();
13562
13759
  if (!who.ok) {
@@ -13586,7 +13783,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
13586
13783
  return /* @__PURE__ */ jsxs48("section", { className: cn46("flex min-h-0 flex-col gap-2", className), children: [
13587
13784
  /* @__PURE__ */ jsxs48("header", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
13588
13785
  /* @__PURE__ */ jsx52("span", { className: "font-medium text-foreground", children: form.name }),
13589
- /* @__PURE__ */ jsx52(Button43, { size: "sm", variant: "ghost", className: "ml-auto h-6 px-2 text-[11px]", onClick: () => setSending(false), children: "Back" })
13786
+ /* @__PURE__ */ jsx52(Button44, { size: "sm", variant: "ghost", className: "ml-auto h-6 px-2 text-[11px]", onClick: () => setSending(false), children: "Back" })
13590
13787
  ] }),
13591
13788
  /* @__PURE__ */ jsx52(
13592
13789
  FormRunner,
@@ -13607,7 +13804,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
13607
13804
  /* @__PURE__ */ jsxs48("header", { className: "flex items-center gap-2 text-xs text-muted-foreground", children: [
13608
13805
  /* @__PURE__ */ jsx52("span", { className: "font-medium text-foreground", children: "Shared with you" }),
13609
13806
  /* @__PURE__ */ jsx52("span", { className: "tabular-nums", children: reach.length }),
13610
- form ? /* @__PURE__ */ jsx52(Button43, { size: "sm", className: "ml-auto h-7 px-2 text-[11px]", onClick: () => setSending(true), children: form.submitLabel ?? form.name }) : null
13807
+ form ? /* @__PURE__ */ jsx52(Button44, { size: "sm", className: "ml-auto h-7 px-2 text-[11px]", onClick: () => setSending(true), children: form.submitLabel ?? form.name }) : null
13611
13808
  ] }),
13612
13809
  reach.length === 0 ? (
13613
13810
  // EMPTY, AND IT SAYS WHICH EMPTY. "Nobody has shared anything with you"
@@ -13631,7 +13828,7 @@ function PortalShell({ tableId, form, resourceType = "record", className }) {
13631
13828
  }
13632
13829
  function PortalRow({ tableId, recordId }) {
13633
13830
  const client = useRecordsClient39();
13634
- const [title, setTitle] = useState47(null);
13831
+ const [title, setTitle] = useState48(null);
13635
13832
  useEffect37(() => {
13636
13833
  let cancelled = false;
13637
13834
  void client.recordRead({ record_id: recordId }).then((answered) => {
@@ -13652,17 +13849,17 @@ function PortalRow({ tableId, recordId }) {
13652
13849
  }
13653
13850
 
13654
13851
  // src/PublicViewPage.tsx
13655
- import { useCallback as useCallback34, useEffect as useEffect38, useState as useState48 } from "react";
13852
+ import { useCallback as useCallback34, useEffect as useEffect38, useState as useState49 } from "react";
13656
13853
  import { useRecordsClient as useRecordsClient40 } from "@ai-matrx/records/react";
13657
13854
  import { Skeleton as Skeleton31, cn as cn47 } from "@ai-matrx/design-system";
13658
13855
  import { jsx as jsx53, jsxs as jsxs49 } from "react/jsx-runtime";
13659
13856
  function PublicViewPage({ slug, className }) {
13660
13857
  const client = useRecordsClient40();
13661
- const [binding, setBinding] = useState48(null);
13662
- const [rows, setRows] = useState48(null);
13663
- const [fields, setFields] = useState48(null);
13664
- const [error, setError] = useState48(null);
13665
- const [gap, setGap] = useState48(null);
13858
+ const [binding, setBinding] = useState49(null);
13859
+ const [rows, setRows] = useState49(null);
13860
+ const [fields, setFields] = useState49(null);
13861
+ const [error, setError] = useState49(null);
13862
+ const [gap, setGap] = useState49(null);
13666
13863
  const load = useCallback34(async () => {
13667
13864
  const notice = await client.worldPublishGapNotice();
13668
13865
  if (notice.ok) setGap(notice.data);
@@ -13733,9 +13930,9 @@ function PublicRow({ row, fields }) {
13733
13930
  }
13734
13931
 
13735
13932
  // src/EmbedFrame.tsx
13736
- import { useCallback as useCallback35, useEffect as useEffect39, useState as useState49 } from "react";
13933
+ import { useCallback as useCallback35, useEffect as useEffect39, useState as useState50 } from "react";
13737
13934
  import { useRecordsClient as useRecordsClient41 } from "@ai-matrx/records/react";
13738
- import { Button as Button44, Input as Input5, Skeleton as Skeleton32, Textarea as Textarea4, cn as cn48 } from "@ai-matrx/design-system";
13935
+ import { Button as Button45, Input as Input5, Skeleton as Skeleton32, Textarea as Textarea4, cn as cn48 } from "@ai-matrx/design-system";
13739
13936
  import { useTable as useTable21 } from "@ai-matrx/records/react";
13740
13937
  import { Fragment as Fragment25, jsx as jsx54, jsxs as jsxs50 } from "react/jsx-runtime";
13741
13938
  function EmbedFrame({
@@ -13750,11 +13947,11 @@ function EmbedFrame({
13750
13947
  const host = useRecordsUi();
13751
13948
  const table = useTable21(tableId);
13752
13949
  const rights = useTableRights(table.data);
13753
- const [origins, setOrigins] = useState49("");
13754
- const [secret, setSecret] = useState49(null);
13755
- const [tokenId, setTokenId] = useState49(null);
13756
- const [error, setError] = useState49(null);
13757
- const [busy, setBusy] = useState49(false);
13950
+ const [origins, setOrigins] = useState50("");
13951
+ const [secret, setSecret] = useState50(null);
13952
+ const [tokenId, setTokenId] = useState50(null);
13953
+ const [error, setError] = useState50(null);
13954
+ const [busy, setBusy] = useState50(false);
13758
13955
  const mode = formId ? "write" : "read";
13759
13956
  const parsed = origins.split(/[\s,]+/).map((o) => o.trim()).filter((o) => o.length > 0);
13760
13957
  const issue = useCallback35(async () => {
@@ -13821,12 +14018,12 @@ function EmbedFrame({
13821
14018
  " will not pass."
13822
14019
  ] })
13823
14020
  ] }),
13824
- !secret ? /* @__PURE__ */ jsx54(Button44, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs50(Fragment25, { children: [
14021
+ !secret ? /* @__PURE__ */ jsx54(Button45, { size: "sm", className: "self-start", disabled: busy || parsed.length === 0, onClick: () => void issue(), children: busy ? "Issuing\u2026" : "Issue embed" }) : /* @__PURE__ */ jsxs50(Fragment25, { children: [
13825
14022
  /* @__PURE__ */ jsx54("p", { className: "rounded border px-2 py-1 text-xs text-muted-foreground", children: "Copy this now. Only its digest is stored, so nobody \u2014 including us \u2014 can show it to you again; if it is lost, issue a new one and replace the old." }),
13826
14023
  /* @__PURE__ */ jsx54(Textarea4, { "aria-label": "Embed snippet", readOnly: true, rows: 3, className: "font-mono text-[11px]", value: snippet ?? "" }),
13827
14024
  /* @__PURE__ */ jsxs50("div", { className: "flex gap-2", children: [
13828
14025
  /* @__PURE__ */ jsx54(
13829
- Button44,
14026
+ Button45,
13830
14027
  {
13831
14028
  size: "sm",
13832
14029
  variant: "outline",
@@ -13834,16 +14031,16 @@ function EmbedFrame({
13834
14031
  children: "Copy"
13835
14032
  }
13836
14033
  ),
13837
- /* @__PURE__ */ jsx54(Button44, { size: "sm", variant: "ghost", disabled: busy, onClick: () => void revoke(), children: "Revoke" })
14034
+ /* @__PURE__ */ jsx54(Button45, { size: "sm", variant: "ghost", disabled: busy, onClick: () => void revoke(), children: "Revoke" })
13838
14035
  ] })
13839
14036
  ] })
13840
14037
  ] });
13841
14038
  }
13842
14039
  function useEmbedHandshake(args) {
13843
14040
  const client = useRecordsClient41();
13844
- const [binding, setBinding] = useState49(null);
13845
- const [error, setError] = useState49(null);
13846
- const [loading, setLoading] = useState49(true);
14041
+ const [binding, setBinding] = useState50(null);
14042
+ const [error, setError] = useState50(null);
14043
+ const [loading, setLoading] = useState50(true);
13847
14044
  const origin = args.origin ?? (typeof location === "undefined" ? "" : location.origin);
13848
14045
  const { secret, requiredMode } = args;
13849
14046
  useEffect39(() => {
@@ -13901,9 +14098,9 @@ function recordsDataSource(client, fallbackSchema = "custom") {
13901
14098
  }
13902
14099
 
13903
14100
  // src/TablesHome.tsx
13904
- import { useCallback as useCallback36, useEffect as useEffect40, useState as useState50 } from "react";
14101
+ import { useCallback as useCallback36, useEffect as useEffect40, useState as useState51 } from "react";
13905
14102
  import { useRecordsClient as useRecordsClient42, useTables as useTables3 } from "@ai-matrx/records/react";
13906
- import { BasicInput as BasicInput16, Button as Button45, Skeleton as Skeleton33, cn as cn49 } from "@ai-matrx/design-system";
14103
+ import { BasicInput as BasicInput16, Button as Button46, Skeleton as Skeleton33, cn as cn49 } from "@ai-matrx/design-system";
13907
14104
 
13908
14105
  // src/createTable.ts
13909
14106
  function tokenFor(name) {
@@ -14040,12 +14237,12 @@ function laneFor(table) {
14040
14237
  function TablesHome({ onOpenTable, className }) {
14041
14238
  const client = useRecordsClient42();
14042
14239
  const tables = useTables3();
14043
- const [creating, setCreating] = useState50(false);
14044
- const [name, setName] = useState50("");
14045
- const [busy, setBusy] = useState50(false);
14046
- const [error, setError] = useState50(null);
14047
- const [importInto, setImportInto] = useState50(null);
14048
- const [boards, setBoards] = useState50(null);
14240
+ const [creating, setCreating] = useState51(false);
14241
+ const [name, setName] = useState51("");
14242
+ const [busy, setBusy] = useState51(false);
14243
+ const [error, setError] = useState51(null);
14244
+ const [importInto, setImportInto] = useState51(null);
14245
+ const [boards, setBoards] = useState51(null);
14049
14246
  useEffect40(() => {
14050
14247
  let cancelled = false;
14051
14248
  void client.dashboards({}).then((result) => {
@@ -14092,9 +14289,9 @@ function TablesHome({ onOpenTable, className }) {
14092
14289
  className: "h-8 max-w-xs"
14093
14290
  }
14094
14291
  ),
14095
- /* @__PURE__ */ jsx56(Button45, { size: "sm", disabled: busy || name.trim().length === 0, onClick: () => void create("open"), children: busy ? "Declaring\u2026" : "Create" }),
14292
+ /* @__PURE__ */ jsx56(Button46, { size: "sm", disabled: busy || name.trim().length === 0, onClick: () => void create("open"), children: busy ? "Declaring\u2026" : "Create" }),
14096
14293
  /* @__PURE__ */ jsx56(
14097
- Button45,
14294
+ Button46,
14098
14295
  {
14099
14296
  size: "sm",
14100
14297
  variant: "outline",
@@ -14103,12 +14300,12 @@ function TablesHome({ onOpenTable, className }) {
14103
14300
  children: "Create and import a file"
14104
14301
  }
14105
14302
  ),
14106
- /* @__PURE__ */ jsx56(Button45, { size: "sm", variant: "ghost", onClick: () => setCreating(false), children: "Cancel" })
14107
- ] }) : /* @__PURE__ */ jsx56(Button45, { size: "sm", onClick: () => setCreating(true), children: "New table" }) }),
14303
+ /* @__PURE__ */ jsx56(Button46, { size: "sm", variant: "ghost", onClick: () => setCreating(false), children: "Cancel" })
14304
+ ] }) : /* @__PURE__ */ jsx56(Button46, { size: "sm", onClick: () => setCreating(true), children: "New table" }) }),
14108
14305
  error ? /* @__PURE__ */ jsx56(RefusalNotice, { error }) : null,
14109
14306
  importInto ? /* @__PURE__ */ jsxs51("div", { className: "rounded-md border p-3", children: [
14110
14307
  /* @__PURE__ */ jsx56(ImportWizard, { tableId: importInto, onDone: () => setImportInto(null) }),
14111
- /* @__PURE__ */ jsx56(Button45, { size: "sm", variant: "ghost", className: "mt-2", onClick: () => onOpenTable?.(importInto), children: "Open the table" })
14308
+ /* @__PURE__ */ jsx56(Button46, { size: "sm", variant: "ghost", className: "mt-2", onClick: () => onOpenTable?.(importInto), children: "Open the table" })
14112
14309
  ] }) : null,
14113
14310
  tables.error ? /* @__PURE__ */ jsx56(RefusalNotice, { error: tables.error }) : null,
14114
14311
  tables.loading && !tables.data ? /* @__PURE__ */ jsxs51("div", { className: "space-y-2", children: [
@@ -14180,9 +14377,9 @@ function TablesHome({ onOpenTable, className }) {
14180
14377
  }
14181
14378
 
14182
14379
  // src/TablePage.tsx
14183
- import { useCallback as useCallback37, useEffect as useEffect41, useState as useState51 } from "react";
14380
+ import { useCallback as useCallback37, useEffect as useEffect41, useState as useState52 } from "react";
14184
14381
  import { useRecordsClient as useRecordsClient43, useTable as useTable22 } from "@ai-matrx/records/react";
14185
- import { Button as Button46, Separator as Separator12, Skeleton as Skeleton34, cn as cn50 } from "@ai-matrx/design-system";
14382
+ import { Button as Button47, Separator as Separator12, Skeleton as Skeleton34, cn as cn50 } from "@ai-matrx/design-system";
14186
14383
  import { Fragment as Fragment27, jsx as jsx57, jsxs as jsxs52 } from "react/jsx-runtime";
14187
14384
  var TABLE_NOT_REACHABLE = "This table is not in the organization you are working in, so there is nothing here to show. Switch to the organization that owns it and open it again \u2014 or it may have been deleted.";
14188
14385
  var DEFAULT_VIEW_NAME = "All records";
@@ -14218,16 +14415,16 @@ function TablePage({
14218
14415
  const table = useTable22(tableId);
14219
14416
  const rights = useTableRights(table.data);
14220
14417
  const organizationId = useRecordsClient43().config.organizationId;
14221
- const [view, setView] = useState51(null);
14418
+ const [view, setView] = useState52(null);
14222
14419
  const opening = openingRail(activeRecordId);
14223
- const [asking, setAsking] = useState51(null);
14224
- const [surface, setSurface] = useState51({
14420
+ const [asking, setAsking] = useState52(null);
14421
+ const [surface, setSurface] = useState52({
14225
14422
  main: activeDashboardId ? "dashboards" : "records",
14226
14423
  rail: opening.rail
14227
14424
  });
14228
14425
  const { main, rail } = surface;
14229
14426
  const setRail = (next) => setSurface((now) => ({ ...now, rail: next }));
14230
- const [openRecord, setOpenRecord] = useState51(opening.record);
14427
+ const [openRecord, setOpenRecord] = useState52(opening.record);
14231
14428
  const viewVersion = useRecordVersion(view?.id ?? null);
14232
14429
  const press = (pressed) => setSurface((now) => chooseSurface(now, pressed));
14233
14430
  const show = (next) => press({ rail: next });
@@ -14258,7 +14455,7 @@ function TablePage({
14258
14455
  return /* @__PURE__ */ jsxs52("div", { className: cn50("flex flex-col items-start gap-2 rounded-md border border-dashed p-6", className), children: [
14259
14456
  /* @__PURE__ */ jsx57("p", { className: "text-sm font-medium", children: "This table is not here" }),
14260
14457
  /* @__PURE__ */ jsx57("p", { className: "max-w-prose text-xs text-muted-foreground", children: TABLE_NOT_REACHABLE }),
14261
- onLeave ? /* @__PURE__ */ jsx57(Button46, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
14458
+ onLeave ? /* @__PURE__ */ jsx57(Button47, { size: "sm", variant: "outline", onClick: onLeave, children: leaveLabel }) : null
14262
14459
  ] });
14263
14460
  }
14264
14461
  return /* @__PURE__ */ jsxs52("div", { className: cn50("flex min-h-0 gap-4", className), children: [
@@ -14273,10 +14470,10 @@ function TablePage({
14273
14470
  className: "min-w-0 flex-1"
14274
14471
  }
14275
14472
  ),
14276
- rights.write && view && view.layout !== "grid" ? /* @__PURE__ */ jsx57(Button46, { size: "sm", onClick: () => show("new-record"), children: "New record" }) : null,
14473
+ rights.write && view && view.layout !== "grid" ? /* @__PURE__ */ jsx57(Button47, { size: "sm", onClick: () => show("new-record"), children: "New record" }) : null,
14277
14474
  rights.structure ? /* @__PURE__ */ jsxs52(Fragment27, { children: [
14278
14475
  /* @__PURE__ */ jsx57(
14279
- Button46,
14476
+ Button47,
14280
14477
  {
14281
14478
  size: "sm",
14282
14479
  variant: surfaceChosen(surface, { rail: "field" }) ? "secondary" : "outline",
@@ -14286,7 +14483,7 @@ function TablePage({
14286
14483
  }
14287
14484
  ),
14288
14485
  /* @__PURE__ */ jsx57(
14289
- Button46,
14486
+ Button47,
14290
14487
  {
14291
14488
  size: "sm",
14292
14489
  variant: surfaceChosen(surface, { rail: "settings" }) ? "secondary" : "ghost",
@@ -14296,7 +14493,7 @@ function TablePage({
14296
14493
  }
14297
14494
  ),
14298
14495
  /* @__PURE__ */ jsx57(
14299
- Button46,
14496
+ Button47,
14300
14497
  {
14301
14498
  size: "sm",
14302
14499
  variant: surfaceChosen(surface, { rail: "import" }) ? "secondary" : "ghost",
@@ -14307,7 +14504,7 @@ function TablePage({
14307
14504
  )
14308
14505
  ] }) : null,
14309
14506
  /* @__PURE__ */ jsx57(
14310
- Button46,
14507
+ Button47,
14311
14508
  {
14312
14509
  size: "sm",
14313
14510
  variant: surfaceChosen(surface, { main: "dashboards" }) ? "secondary" : "ghost",
@@ -14317,7 +14514,7 @@ function TablePage({
14317
14514
  }
14318
14515
  ),
14319
14516
  /* @__PURE__ */ jsx57(
14320
- Button46,
14517
+ Button47,
14321
14518
  {
14322
14519
  size: "sm",
14323
14520
  variant: surfaceChosen(surface, { rail: "forms" }) ? "secondary" : "ghost",
@@ -14327,7 +14524,7 @@ function TablePage({
14327
14524
  }
14328
14525
  ),
14329
14526
  /* @__PURE__ */ jsx57(
14330
- Button46,
14527
+ Button47,
14331
14528
  {
14332
14529
  size: "sm",
14333
14530
  variant: surfaceChosen(surface, { rail: "bookings" }) ? "secondary" : "ghost",
@@ -14337,7 +14534,7 @@ function TablePage({
14337
14534
  }
14338
14535
  ),
14339
14536
  /* @__PURE__ */ jsx57(
14340
- Button46,
14537
+ Button47,
14341
14538
  {
14342
14539
  size: "sm",
14343
14540
  variant: surfaceChosen(surface, { rail: "checklists" }) ? "secondary" : "ghost",
@@ -14347,7 +14544,7 @@ function TablePage({
14347
14544
  }
14348
14545
  ),
14349
14546
  /* @__PURE__ */ jsx57(
14350
- Button46,
14547
+ Button47,
14351
14548
  {
14352
14549
  size: "sm",
14353
14550
  variant: surfaceChosen(surface, { rail: "notifications" }) ? "secondary" : "ghost",
@@ -14357,7 +14554,7 @@ function TablePage({
14357
14554
  }
14358
14555
  ),
14359
14556
  /* @__PURE__ */ jsx57(
14360
- Button46,
14557
+ Button47,
14361
14558
  {
14362
14559
  size: "sm",
14363
14560
  variant: surfaceChosen(surface, { rail: "portals" }) ? "secondary" : "ghost",
@@ -14367,7 +14564,7 @@ function TablePage({
14367
14564
  }
14368
14565
  ),
14369
14566
  /* @__PURE__ */ jsx57(
14370
- Button46,
14567
+ Button47,
14371
14568
  {
14372
14569
  size: "sm",
14373
14570
  variant: surfaceChosen(surface, { rail: "inbox" }) ? "secondary" : "ghost",
@@ -14510,6 +14707,7 @@ export {
14510
14707
  ChecklistTemplateEditor,
14511
14708
  ChecklistsPanel,
14512
14709
  CommentThread,
14710
+ ConditionGroup,
14513
14711
  ConditionRow,
14514
14712
  CustomFieldsSection,
14515
14713
  DEFAULT_FIELDS,
@@ -14615,6 +14813,7 @@ export {
14615
14813
  actorBadge,
14616
14814
  actorWords,
14617
14815
  addFields,
14816
+ askableFields,
14618
14817
  blockFromSpec,
14619
14818
  bodyForReading,
14620
14819
  bodyFromKeys,
@@ -14623,6 +14822,7 @@ export {
14623
14822
  colorFromTheValue,
14624
14823
  columnForField,
14625
14824
  conditionInWords,
14825
+ conditionIsDrawable,
14626
14826
  conditionIsSimple,
14627
14827
  conditionValue,
14628
14828
  controlFor,
@@ -14667,6 +14867,7 @@ export {
14667
14867
  presentationDocument,
14668
14868
  presentationIsEmpty,
14669
14869
  previewLine,
14870
+ publiclyAnswerable,
14670
14871
  recordName,
14671
14872
  recordsDataSource,
14672
14873
  refusalForAPerson,
@@ -14703,6 +14904,7 @@ export {
14703
14904
  whatIsMissing,
14704
14905
  whatYouMayDo,
14705
14906
  whatYouMayDoWithTable,
14706
- whenWords
14907
+ whenWords,
14908
+ whyNotAskable
14707
14909
  };
14708
14910
  //# sourceMappingURL=index.js.map