@ai-matrx/records-ui 0.115.70 → 0.115.71

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
@@ -99,8 +99,7 @@ function lockedStructure(base2) {
99
99
  return { ...base2, structure: false, why: (what) => what === "structure" ? DATABASE_LOCKED_REASON : base2.why(what) };
100
100
  }
101
101
 
102
- // src/host.tsx
103
- import { jsx } from "react/jsx-runtime";
102
+ // src/tableRights.ts
104
103
  function tableRights(may, overallReason) {
105
104
  return {
106
105
  ...may,
@@ -112,6 +111,9 @@ var NO_RIGHTS = tableRights(NOT_ANSWERED_YET);
112
111
  function tableRightsAt(level) {
113
112
  return tableRights(whatYouMayDo(level, true));
114
113
  }
114
+
115
+ // src/host.tsx
116
+ import { jsx } from "react/jsx-runtime";
115
117
  var NO_SAVED_VIEWS_REASON = "There are no saved views here yet, so there is nothing to be told about. Save a view of this table first and it will be offered here.";
116
118
  var NO_MEMBERS_REASON = "This app cannot offer the people in your organization on this screen yet, so there is nobody to pick. Type the person's name into a text field for now, and tell us \u2014 it is on our list, not yours.";
117
119
  var NO_SHARE_REASON = "Sharing is not available on this screen, so there is no Share button here rather than one that opens nothing. Share this table from the tables list instead.";
@@ -646,9 +648,14 @@ import { dateFilterBounds, dateFilterDayBounds, dayInstantWindow } from "@ai-mat
646
648
 
647
649
  // src/personTime.ts
648
650
  import { useSyncExternalStore } from "react";
651
+
652
+ // src/personZone.ts
649
653
  import { setColorRuleTimeZone } from "@ai-matrx/design-system/data-table/table-style";
650
- var zone = null;
651
- var listeners = /* @__PURE__ */ new Set();
654
+ import { globalSlot } from "@ai-matrx/kit/global-slot";
655
+ var state = globalSlot("ai-matrx.records-ui.person-time-zone", () => ({
656
+ zone: null,
657
+ listeners: /* @__PURE__ */ new Set()
658
+ }));
652
659
  function valid(z) {
653
660
  if (typeof z !== "string" || !z.trim()) return false;
654
661
  try {
@@ -660,25 +667,22 @@ function valid(z) {
660
667
  }
661
668
  function setPersonTimeZone(next) {
662
669
  const clean = valid(next) ? next : null;
663
- if (clean === zone) return;
664
- zone = clean;
670
+ if (clean === state.zone) return;
671
+ state.zone = clean;
665
672
  setColorRuleTimeZone(clean);
666
- listeners.forEach((l) => l());
673
+ state.listeners.forEach((l) => l());
667
674
  }
668
675
  function getPersonTimeZone() {
669
- return zone;
676
+ return state.zone;
670
677
  }
671
- function usePersonTimeZone() {
672
- return useSyncExternalStore(
673
- (cb) => {
674
- listeners.add(cb);
675
- return () => listeners.delete(cb);
676
- },
677
- () => zone,
678
- () => null
679
- );
678
+ function subscribePersonTimeZone(listener) {
679
+ state.listeners.add(listener);
680
+ return () => {
681
+ state.listeners.delete(listener);
682
+ };
680
683
  }
681
684
  function personWallNow(at = /* @__PURE__ */ new Date()) {
685
+ const zone = state.zone;
682
686
  if (!zone) return at;
683
687
  const parts = new Intl.DateTimeFormat("en-US", {
684
688
  timeZone: zone,
@@ -694,13 +698,18 @@ function personWallNow(at = /* @__PURE__ */ new Date()) {
694
698
  return new Date(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
695
699
  }
696
700
 
701
+ // src/personTime.ts
702
+ function usePersonTimeZone() {
703
+ return useSyncExternalStore(
704
+ subscribePersonTimeZone,
705
+ getPersonTimeZone,
706
+ () => null
707
+ );
708
+ }
709
+
697
710
  // src/choiceLooks.ts
698
711
  import { newerKindOf } from "@ai-matrx/records";
699
- import {
700
- CHOICE_CHIP_CLASS,
701
- NEUTRAL_CHIP_CLASS,
702
- STYLE_COLORS
703
- } from "@ai-matrx/design-system/data-table";
712
+ import { CHOICE_CHIP_CLASS, NEUTRAL_CHIP_CLASS, STYLE_COLORS } from "@ai-matrx/design-system/data-table/table-style";
704
713
  function displayFormatOf(field2) {
705
714
  const raw = field2.display_format;
706
715
  if (!raw || typeof raw !== "object") return null;
@@ -1046,10 +1055,10 @@ function clauseFor(f, value, now = /* @__PURE__ */ new Date()) {
1046
1055
  return { rule: value.negated ? not(range) : range };
1047
1056
  }
1048
1057
  case "date": {
1049
- const zone2 = getPersonTimeZone() ?? void 0;
1050
- const moments = dateFilterBounds(value.preset ? { ...value, anchor: now.toISOString() } : value, now, zone2);
1058
+ const zone = getPersonTimeZone() ?? void 0;
1059
+ const moments = dateFilterBounds(value.preset ? { ...value, anchor: now.toISOString() } : value, now, zone);
1051
1060
  const holdsDays = String((f.config ?? {})["kind"] ?? "") === "date";
1052
- const bounds = holdsDays ? dateFilterDayBounds(moments, zone2) : moments;
1061
+ const bounds = holdsDays ? dateFilterDayBounds(moments, zone) : moments;
1053
1062
  if (bounds.since === void 0 && bounds.until === void 0) return null;
1054
1063
  return {
1055
1064
  flat: {
@@ -3127,7 +3136,8 @@ import { useCallback as useCallback2, useEffect as useEffect7, useMemo as useMem
3127
3136
  import { withTablePlacement } from "@ai-matrx/records";
3128
3137
  import { useRecordsClient as useRecordsClient4, useTables } from "@ai-matrx/records/react";
3129
3138
  import { Checkbox, cn as cn7 } from "@ai-matrx/design-system";
3130
- import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3139
+
3140
+ // src/tablePickerEntries.ts
3131
3141
  var PLATFORM_TABLE_PREFIX = "records_ui_";
3132
3142
  function keptByPlatform(table) {
3133
3143
  return table.platform_owned === true || table.kept_by_the_app === true;
@@ -3171,6 +3181,9 @@ function madeOn(stamp) {
3171
3181
  if (Number.isNaN(at.getTime())) return null;
3172
3182
  return new Intl.DateTimeFormat(void 0, { month: "short", day: "numeric", year: "numeric" }).format(at);
3173
3183
  }
3184
+
3185
+ // src/tablePicking.tsx
3186
+ import { jsx as jsx11, jsxs as jsxs9 } from "react/jsx-runtime";
3174
3187
  function usePickerTables() {
3175
3188
  const client = useRecordsClient4();
3176
3189
  const tables = useTables();
@@ -3745,10 +3758,7 @@ import { useRecordsClient as useRecordsClient13 } from "@ai-matrx/records/react"
3745
3758
  import { Button as Button20, Checkbox as Checkbox6, Popover as Popover8, PopoverContent as PopoverContent8, PopoverTrigger as PopoverTrigger8, cn as cn26 } from "@ai-matrx/design-system";
3746
3759
 
3747
3760
  // src/presentation.ts
3748
- import { parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
3749
- import {
3750
- COLOR_ROTATION
3751
- } from "@ai-matrx/design-system/data-table";
3761
+ import { COLOR_ROTATION, parseTableStyle, tableStyleIsEmpty } from "@ai-matrx/design-system/data-table/table-style";
3752
3762
  import { getFieldFormat } from "@ai-matrx/design-system/field-formats";
3753
3763
  import { newerKindOf as newerKindOf3, ratingMaxOf } from "@ai-matrx/records";
3754
3764
 
@@ -5530,8 +5540,7 @@ import { tableShapeChanged as tableShapeChanged3, useRecordsClient as useRecords
5530
5540
  import { SWATCH_CLASS as SWATCH_CLASS2, formatColumnValue } from "@ai-matrx/design-system/data-table";
5531
5541
  import { formatFieldValue as formatFieldValue3 } from "@ai-matrx/design-system/field-formats";
5532
5542
 
5533
- // src/withheld.tsx
5534
- import { jsx as jsx20 } from "react/jsx-runtime";
5543
+ // src/withheldNotice.ts
5535
5544
  var WITHHELD_WORD = "Withheld";
5536
5545
  function withheldNoticeOf(hidden, key) {
5537
5546
  const notice = hidden?.[key];
@@ -5549,6 +5558,9 @@ function withheldSentence(field2, notice) {
5549
5558
  const or = notice.or ? `${needs || reason ? ", or" : " It needs"} ${notice.or}` : "";
5550
5559
  return `${name} is withheld from you.${reason}${needs}${or}${reason || needs || or ? "." : ""}`;
5551
5560
  }
5561
+
5562
+ // src/withheld.tsx
5563
+ import { jsx as jsx20 } from "react/jsx-runtime";
5552
5564
  function WithheldValue({ field: field2, notice }) {
5553
5565
  const sentence2 = withheldSentence(field2, notice);
5554
5566
  return /* @__PURE__ */ jsx20(
@@ -6804,8 +6816,8 @@ function formulaSourceArchived(field2, document2) {
6804
6816
  const keys = (field2.config ?? {})[FORMULA_INPUT_KEYS];
6805
6817
  if (!Array.isArray(keys) || !document2) return null;
6806
6818
  for (const key of keys) {
6807
- const state = sourceArchivedOf(document2[String(key)]);
6808
- if (state) return state;
6819
+ const state2 = sourceArchivedOf(document2[String(key)]);
6820
+ if (state2) return state2;
6809
6821
  }
6810
6822
  return null;
6811
6823
  }
@@ -7035,12 +7047,12 @@ function computedEmptyOf(field2, document2) {
7035
7047
  return { kind: "formula" };
7036
7048
  }
7037
7049
  var SOURCE_ARCHIVED_WORDS = "Source archived";
7038
- function sourceArchivedSentence(state) {
7039
- if (!state.label) return "A column it reads is archived";
7040
- return state.table ? `${state.label} on ${state.table} is archived` : `${state.label} is archived`;
7050
+ function sourceArchivedSentence(state2) {
7051
+ if (!state2.label) return "A column it reads is archived";
7052
+ return state2.table ? `${state2.label} on ${state2.table} is archived` : `${state2.label} is archived`;
7041
7053
  }
7042
- function SourceArchivedValue({ state }) {
7043
- return /* @__PURE__ */ jsx30("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state), "data-records-source-archived": state.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
7054
+ function SourceArchivedValue({ state: state2 }) {
7055
+ return /* @__PURE__ */ jsx30("span", { className: "text-xs italic text-muted-foreground", title: sourceArchivedSentence(state2), "data-records-source-archived": state2.field_id ?? "", children: SOURCE_ARCHIVED_WORDS });
7044
7056
  }
7045
7057
  var ABSENCE_WORDS = ABSENCE_WORD_LABEL;
7046
7058
  function renderValue(field2, value, document2, labels, stillWaitingFor, look) {
@@ -7278,12 +7290,12 @@ function cardWords(record, field2, labels) {
7278
7290
 
7279
7291
  // src/SourceArchivedNotice.tsx
7280
7292
  import { jsx as jsx31, jsxs as jsxs27 } from "react/jsx-runtime";
7281
- function bringBackLabel(state) {
7282
- return state.label ? `Bring back ${state.label}` : "Bring it back";
7293
+ function bringBackLabel(state2) {
7294
+ return state2.label ? `Bring back ${state2.label}` : "Bring it back";
7283
7295
  }
7284
7296
  function SourceArchivedNotice({ fieldId, tableId }) {
7285
7297
  const client = useRecordsClient9();
7286
- const [state, setState] = useState23(null);
7298
+ const [state2, setState] = useState23(null);
7287
7299
  const [busy, setBusy] = useState23(false);
7288
7300
  const [refused, setRefused] = useState23(null);
7289
7301
  const read = useCallback7(async () => {
@@ -7294,19 +7306,19 @@ function SourceArchivedNotice({ fieldId, tableId }) {
7294
7306
  useEffect15(() => {
7295
7307
  void read();
7296
7308
  }, [read]);
7297
- if (refused && !state) return /* @__PURE__ */ jsx31(RefusalNotice, { error: refused });
7298
- if (!state) return null;
7309
+ if (refused && !state2) return /* @__PURE__ */ jsx31(RefusalNotice, { error: refused });
7310
+ if (!state2) return null;
7299
7311
  const restore = async () => {
7300
- if (!state.field_id) return;
7312
+ if (!state2.field_id) return;
7301
7313
  setBusy(true);
7302
7314
  setRefused(null);
7303
- const done = await client.fieldRestore({ field_id: state.field_id });
7315
+ const done = await client.fieldRestore({ field_id: state2.field_id });
7304
7316
  setBusy(false);
7305
7317
  if (!done.ok) {
7306
7318
  setRefused(done.error);
7307
7319
  return;
7308
7320
  }
7309
- if (state.table_id) tableShapeChanged3(state.table_id);
7321
+ if (state2.table_id) tableShapeChanged3(state2.table_id);
7310
7322
  tableShapeChanged3(tableId);
7311
7323
  await read();
7312
7324
  };
@@ -7315,13 +7327,13 @@ function SourceArchivedNotice({ fieldId, tableId }) {
7315
7327
  {
7316
7328
  className: "flex flex-wrap items-center gap-2 rounded-md border border-border px-3 py-2",
7317
7329
  "data-testid": "source-archived-notice",
7318
- "data-field-id": state.field_id ?? "",
7330
+ "data-field-id": state2.field_id ?? "",
7319
7331
  children: [
7320
7332
  /* @__PURE__ */ jsxs27("div", { className: "flex min-w-0 flex-1 flex-col", children: [
7321
7333
  /* @__PURE__ */ jsx31("span", { className: "text-sm", children: SOURCE_ARCHIVED_WORDS }),
7322
- /* @__PURE__ */ jsx31("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state) })
7334
+ /* @__PURE__ */ jsx31("span", { className: "truncate text-xs text-muted-foreground", children: sourceArchivedSentence(state2) })
7323
7335
  ] }),
7324
- state.field_id ? /* @__PURE__ */ jsx31(Button14, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state) }) : null,
7336
+ state2.field_id ? /* @__PURE__ */ jsx31(Button14, { type: "button", size: "sm", variant: "secondary", disabled: busy, onClick: () => void restore(), children: bringBackLabel(state2) }) : null,
7325
7337
  refused ? /* @__PURE__ */ jsx31(RefusalNotice, { error: refused, className: "basis-full" }) : null
7326
7338
  ]
7327
7339
  }
@@ -7359,10 +7371,10 @@ var RELATIVE_DAY_TERMS = [
7359
7371
  { kind: "past_days", label: "is in the past \u2026 days", takesDays: true }
7360
7372
  ];
7361
7373
  function relativeDayNode(fieldId, kind, days) {
7362
- const zone2 = getPersonTimeZone();
7374
+ const zone = getPersonTimeZone();
7363
7375
  const window2 = { relative: kind };
7364
7376
  if (RELATIVE_DAY_TERMS.find((t) => t.kind === kind)?.takesDays) window2["n"] = days ?? 7;
7365
- if (zone2) window2["tz"] = zone2;
7377
+ if (zone) window2["tz"] = zone;
7366
7378
  return { op: "within", args: [{ field: fieldId }, { const: window2 }] };
7367
7379
  }
7368
7380
  function relativeDayOf(expr) {
@@ -9584,12 +9596,12 @@ function sourceKindOf(field2) {
9584
9596
  if (kind === "attachment") return "file";
9585
9597
  return null;
9586
9598
  }
9587
- function whatIsMissing(state) {
9588
- const noun = state.noun ?? "column";
9589
- const { type, label, via, pick, agg, of, relations, formulaFields } = state;
9590
- const relationTarget = state.relationTarget ?? "";
9599
+ function whatIsMissing(state2) {
9600
+ const noun = state2.noun ?? "column";
9601
+ const { type, label, via, pick, agg, of, relations, formulaFields } = state2;
9602
+ const relationTarget = state2.relationTarget ?? "";
9591
9603
  if (label.trim() === "") return `Give the ${noun} a name.`;
9592
- if (type === "entity_reference") return whatIsMissingForEntityReference(state.allowedTypes ?? []);
9604
+ if (type === "entity_reference") return whatIsMissingForEntityReference(state2.allowedTypes ?? []);
9593
9605
  if (type === "relation") {
9594
9606
  if (relationTarget.trim() === "") return `Choose the table this ${noun} points at.`;
9595
9607
  return null;
@@ -12312,7 +12324,7 @@ function GridCell({
12312
12324
  else cancelSinglePress();
12313
12325
  };
12314
12326
  const value = editing ? editing.valueFor(row, field2) : row.document?.[field2.key];
12315
- const state = editing ? editing.stateOf(row.id, field2.key) : null;
12327
+ const state2 = editing ? editing.stateOf(row.id, field2.key) : null;
12316
12328
  const refusal3 = editing ? editing.refusalOf(row.id, field2.key) : null;
12317
12329
  const editable = Boolean(editing) && canWrite && fieldIsEditable(field2);
12318
12330
  if (open && editing) {
@@ -12373,7 +12385,7 @@ function GridCell({
12373
12385
  disabled: !editable,
12374
12386
  "aria-label": editable ? `${fieldName(field2)} \u2014 press Space to ${value === true ? "untick" : "tick"}` : fieldName(field2),
12375
12387
  title: editable ? answered ? `${fieldName(field2)} \u2014 press Space to change` : `${fieldName(field2)} \u2014 nobody has answered this yet` : whyNot ?? `${fieldName(field2)} \u2014 you cannot change this record`,
12376
- className: cn26(state === "saving" ? "opacity-60" : "", state === "refused" ? "ring-1 ring-destructive" : ""),
12388
+ className: cn26(state2 === "saving" ? "opacity-60" : "", state2 === "refused" ? "ring-1 ring-destructive" : ""),
12377
12389
  onCheckedChange: (next) => editing?.setCell(row.id, field2.key, next === true)
12378
12390
  }
12379
12391
  ),
@@ -12384,7 +12396,7 @@ function GridCell({
12384
12396
  if (editable && format?.id === "rating") {
12385
12397
  return /* @__PURE__ */ jsxs40("span", { "data-matrx-cell-control": "", className: "relative flex h-full w-full flex-wrap items-center gap-1.5", children: [
12386
12398
  /* @__PURE__ */ jsx45(FormattedValue, { value, format, onRate: (next) => editing?.setCell(row.id, field2.key, next), selectFirst: true }),
12387
- state === "saving" ? /* @__PURE__ */ jsx45("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
12399
+ state2 === "saving" ? /* @__PURE__ */ jsx45("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
12388
12400
  refusal3 ? /* @__PURE__ */ jsx45(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: false }) : null
12389
12401
  ] });
12390
12402
  }
@@ -12446,8 +12458,8 @@ function GridCell({
12446
12458
  // table cell, and a click there is a row click.
12447
12459
  "block w-full min-w-0 flex-1 truncate rounded px-1 py-0.5",
12448
12460
  editable ? "cursor-text hover:bg-muted focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring" : "",
12449
- state === "saving" ? "opacity-60" : "",
12450
- state === "refused" ? "ring-1 ring-destructive" : ""
12461
+ state2 === "saving" ? "opacity-60" : "",
12462
+ state2 === "refused" ? "ring-1 ring-destructive" : ""
12451
12463
  ),
12452
12464
  onMouseDown: onPointerDown,
12453
12465
  onClickCapture: onLinkClickCapture,
@@ -12506,7 +12518,7 @@ function GridCell({
12506
12518
  }
12507
12519
  ) : null
12508
12520
  ] }),
12509
- state === "saving" ? /* @__PURE__ */ jsx45("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
12521
+ state2 === "saving" ? /* @__PURE__ */ jsx45("span", { "data-records-cell-saving": "", className: "pointer-events-none absolute right-1 top-1/2 z-10 -translate-y-1/2 rounded bg-card/90 px-1 text-[10px] text-muted-foreground", children: "Saving\u2026" }) : null,
12510
12522
  refusal3 ? /* @__PURE__ */ jsx45(CellRefusalNotice, { refusal: refusal3, field: field2, row, editing, typed: true }) : null
12511
12523
  ]
12512
12524
  }
@@ -13082,7 +13094,7 @@ import { useCallback as useCallback11, useEffect as useEffect27, useRef as useRe
13082
13094
  import { useRecordsClient as useRecordsClient15 } from "@ai-matrx/records/react";
13083
13095
  function useTableDecorations(tableId, revision) {
13084
13096
  const client = useRecordsClient15();
13085
- const [state, setState] = useState37({ data: null, loading: Boolean(tableId) });
13097
+ const [state2, setState] = useState37({ data: null, loading: Boolean(tableId) });
13086
13098
  const seen = useRef22({ tableId: void 0, revision: void 0 });
13087
13099
  const ticket = useRef22(0);
13088
13100
  useEffect27(() => {
@@ -13108,7 +13120,7 @@ function useTableDecorations(tableId, revision) {
13108
13120
  ticket.current += 1;
13109
13121
  }, []);
13110
13122
  const apply = useCallback11((next) => setState({ data: next, loading: false }), []);
13111
- return { ...state, apply };
13123
+ return { ...state2, apply };
13112
13124
  }
13113
13125
 
13114
13126
  // src/emptyState.tsx
@@ -13801,42 +13813,13 @@ import { Button as Button24, CreatablePicker as CreatablePicker2 } from "@ai-mat
13801
13813
 
13802
13814
  // src/RecordsMount.tsx
13803
13815
  import { useRef as useRef23 } from "react";
13804
- import { RecordsProvider } from "@ai-matrx/records/react";
13805
- import { jsx as jsx50 } from "react/jsx-runtime";
13806
- var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
13807
- function storeDecidesRights(_table) {
13808
- return NO_RIGHTS;
13809
- }
13810
- function RecordsMount({
13811
- config,
13812
- host,
13813
- letTheStoreDecideRights,
13814
- children
13815
- }) {
13816
- const bound2 = useShallowStableHost(host);
13817
- void letTheStoreDecideRights;
13818
- return /* @__PURE__ */ jsx50(RecordsProvider, { config, children: /* @__PURE__ */ jsx50(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsx50(RecordLabelProvider, { children }) }) });
13819
- }
13820
- function useShallowStableHost(host) {
13821
- const held = useRef23(null);
13822
- const next = host ?? {};
13823
- const previous = held.current;
13824
- if (previous !== null && sameParts(previous, next)) return previous;
13825
- const bound2 = { ...next };
13826
- held.current = bound2;
13827
- return bound2;
13828
- }
13829
- function sameParts(a, b) {
13830
- const aKeys = Object.keys(a);
13831
- const bKeys = Object.keys(b);
13832
- if (aKeys.length !== bKeys.length) return false;
13833
- for (const key of aKeys) if (a[key] !== b[key]) return false;
13834
- return true;
13835
- }
13816
+
13817
+ // src/dataSource.ts
13818
+ import { globalSlot as globalSlot2 } from "@ai-matrx/kit/global-slot";
13836
13819
  function personActor(userId) {
13837
13820
  return userId ? { actor: "user", user_id: userId } : { actor: "user" };
13838
13821
  }
13839
- var dataSources = /* @__PURE__ */ new WeakMap();
13822
+ var dataSources = globalSlot2("ai-matrx.records-ui.data-sources", () => /* @__PURE__ */ new WeakMap());
13840
13823
  function recordsDataSource(client, fallbackSchema = "custom") {
13841
13824
  let bySchema = dataSources.get(client);
13842
13825
  if (!bySchema) {
@@ -13882,6 +13865,40 @@ async function hasSession(getSession) {
13882
13865
  }
13883
13866
  }
13884
13867
 
13868
+ // src/RecordsMount.tsx
13869
+ import { RecordsProvider } from "@ai-matrx/records/react";
13870
+ import { jsx as jsx50 } from "react/jsx-runtime";
13871
+ var STORE_DECIDES_REASON = "This host offers exactly what the record store says this person may do: the level comes back with the table on the read door, so a control they cannot use is never drawn in the first place.";
13872
+ function storeDecidesRights(_table) {
13873
+ return NO_RIGHTS;
13874
+ }
13875
+ function RecordsMount({
13876
+ config,
13877
+ host,
13878
+ letTheStoreDecideRights,
13879
+ children
13880
+ }) {
13881
+ const bound2 = useShallowStableHost(host);
13882
+ void letTheStoreDecideRights;
13883
+ return /* @__PURE__ */ jsx50(RecordsProvider, { config, children: /* @__PURE__ */ jsx50(RecordsUiProvider, { value: bound2, children: /* @__PURE__ */ jsx50(RecordLabelProvider, { children }) }) });
13884
+ }
13885
+ function useShallowStableHost(host) {
13886
+ const held = useRef23(null);
13887
+ const next = host ?? {};
13888
+ const previous = held.current;
13889
+ if (previous !== null && sameParts(previous, next)) return previous;
13890
+ const bound2 = { ...next };
13891
+ held.current = bound2;
13892
+ return bound2;
13893
+ }
13894
+ function sameParts(a, b) {
13895
+ const aKeys = Object.keys(a);
13896
+ const bKeys = Object.keys(b);
13897
+ if (aKeys.length !== bKeys.length) return false;
13898
+ for (const key of aKeys) if (a[key] !== b[key]) return false;
13899
+ return true;
13900
+ }
13901
+
13885
13902
  // src/TablePickers.tsx
13886
13903
  import { Fragment as Fragment15, jsx as jsx51, jsxs as jsxs45 } from "react/jsx-runtime";
13887
13904
  var SHARED_FOR_MS = 5e3;
@@ -13915,7 +13932,7 @@ function readTablesAnywhere(dataSource) {
13915
13932
  return read;
13916
13933
  }
13917
13934
  function useTablesAnywhere(dataSource) {
13918
- const [state, setState] = useState40({ loading: true, error: null, rows: [] });
13935
+ const [state2, setState] = useState40({ loading: true, error: null, rows: [] });
13919
13936
  useEffect28(() => {
13920
13937
  let live = true;
13921
13938
  void readTablesAnywhere(dataSource).then((result) => {
@@ -13925,7 +13942,7 @@ function useTablesAnywhere(dataSource) {
13925
13942
  live = false;
13926
13943
  };
13927
13944
  }, [dataSource]);
13928
- return state;
13945
+ return state2;
13929
13946
  }
13930
13947
  function TablePicker({ dataSource, value, onChange, disabled, tables }) {
13931
13948
  const own3 = useTablesAnywhere(dataSource);
@@ -18032,7 +18049,7 @@ function CustomFieldsSection({
18032
18049
  });
18033
18050
  useEffect39(() => {
18034
18051
  if (!agentDoor) return;
18035
- const state = () => {
18052
+ const state2 = () => {
18036
18053
  const now = live.current;
18037
18054
  return {
18038
18055
  entityToken,
@@ -18049,7 +18066,7 @@ function CustomFieldsSection({
18049
18066
  };
18050
18067
  };
18051
18068
  const check = (requests) => {
18052
- const now = state();
18069
+ const now = state2();
18053
18070
  if (now.mayAdd === false) {
18054
18071
  return [now.refusal ?? "This person may not add a field here."];
18055
18072
  }
@@ -18114,7 +18131,7 @@ function CustomFieldsSection({
18114
18131
  live.current.reload();
18115
18132
  return { ok: true, written };
18116
18133
  };
18117
- return agentDoor({ entityToken, recordId, state, check, addField, checkValues, setValues });
18134
+ return agentDoor({ entityToken, recordId, state: state2, check, addField, checkValues, setValues });
18118
18135
  }, [agentDoor, client, entityToken, recordId]);
18119
18136
  if (!read.loading && !read.error && fields.length === 0 && !mayAdd && !rights.data) return null;
18120
18137
  const storeReason = rights.data?.reason ?? null;
@@ -19017,7 +19034,7 @@ function useDrillLevelReads(args) {
19017
19034
  const asks = drillLevelAsks({ question, dimensions, answers, where });
19018
19035
  const all = [...asks.attributes, ...asks.focus, ...asks.names];
19019
19036
  const key = JSON.stringify({ source, all, window: args.window ?? null, lane: args.lane ?? null });
19020
- const [state, setState] = useState56({ key: "", held: {}, failed: {} });
19037
+ const [state2, setState] = useState56({ key: "", held: {}, failed: {} });
19021
19038
  useEffect42(() => {
19022
19039
  if (!enabled || !source || all.length === 0) return;
19023
19040
  let cancelled = false;
@@ -19052,12 +19069,12 @@ function useDrillLevelReads(args) {
19052
19069
  cancelled = true;
19053
19070
  };
19054
19071
  }, [client, key, enabled]);
19055
- const ready = state.key === key;
19072
+ const ready = state2.key === key;
19056
19073
  const dim = (k) => dimensions.find((d) => d.key === k);
19057
19074
  const outer2 = question.by[0] ?? null;
19058
19075
  const attributes = asks.attributes.length === 0 || !outer2 ? void 0 : asks.attributes.map((ask2) => {
19059
19076
  const d = dim(ask2.fact);
19060
- const why = ready ? state.failed[askId(ask2)] : void 0;
19077
+ const why = ready ? state2.failed[askId(ask2)] : void 0;
19061
19078
  return {
19062
19079
  key: ask2.fact,
19063
19080
  label: d?.label ?? ask2.fact,
@@ -19066,17 +19083,17 @@ function useDrillLevelReads(args) {
19066
19083
  read: (groups) => {
19067
19084
  if (!ready) return void 0;
19068
19085
  const g = groups[outer2];
19069
- return g ? drillFactWords(state.held[askId(ask2)]?.[g], d) : null;
19086
+ return g ? drillFactWords(state2.held[askId(ask2)]?.[g], d) : null;
19070
19087
  }
19071
19088
  };
19072
19089
  });
19073
19090
  const focusAttributes = asks.focus.length === 0 ? void 0 : asks.focus.map((ask2) => {
19074
19091
  const d = dim(ask2.fact);
19075
- const why = ready ? state.failed[askId(ask2)] : void 0;
19092
+ const why = ready ? state2.failed[askId(ask2)] : void 0;
19076
19093
  return {
19077
19094
  key: ask2.fact,
19078
19095
  label: d?.label ?? ask2.fact,
19079
- value: ready ? drillFactWords(state.held[askId(ask2)]?.["\0"], d) : void 0,
19096
+ value: ready ? drillFactWords(state2.held[askId(ask2)]?.["\0"], d) : void 0,
19080
19097
  ...why ? { error: why } : {}
19081
19098
  };
19082
19099
  });
@@ -19085,7 +19102,7 @@ function useDrillLevelReads(args) {
19085
19102
  for (const ask2 of asks.names) {
19086
19103
  if (!ask2.outer) continue;
19087
19104
  const out = names.get(ask2.outer) ?? /* @__PURE__ */ new Map();
19088
- for (const [value, facts] of Object.entries(state.held[askId(ask2)] ?? {})) {
19105
+ for (const [value, facts] of Object.entries(state2.held[askId(ask2)] ?? {})) {
19089
19106
  const words2 = drillFactWords(facts, dim(ask2.fact));
19090
19107
  if (words2 && words2 !== "Several") out.set(value, words2);
19091
19108
  }
@@ -19139,7 +19156,7 @@ function definitionOf(raw) {
19139
19156
  function useDrillDefinition(source) {
19140
19157
  const client = useRecordsClient33();
19141
19158
  const key = source ? JSON.stringify(source) : null;
19142
- const [state, setState] = useState57({ key: null, def: null, error: null });
19159
+ const [state2, setState] = useState57({ key: null, def: null, error: null });
19143
19160
  useEffect43(() => {
19144
19161
  if (!key) return;
19145
19162
  let cancelled = false;
@@ -19159,7 +19176,7 @@ function useDrillDefinition(source) {
19159
19176
  cancelled = true;
19160
19177
  };
19161
19178
  }, [client, key]);
19162
- return state.key === key ? { def: state.def, error: state.error } : { def: null, error: null };
19179
+ return state2.key === key ? { def: state2.def, error: state2.error } : { def: null, error: null };
19163
19180
  }
19164
19181
  function drillWhere(base2, trail, booleans) {
19165
19182
  const where = { ...base2 ?? {} };
@@ -19529,8 +19546,8 @@ function useGridDrillQuestion(args) {
19529
19546
  return { enabled, source, def, question, setQuestion: url.setQuestion, filter, trailFilter };
19530
19547
  }
19531
19548
  function useGridDrillConfig(args) {
19532
- const { state, presentation, onPresentationChange, version } = args;
19533
- const { setQuestion } = state;
19549
+ const { state: state2, presentation, onPresentationChange, version } = args;
19550
+ const { setQuestion } = state2;
19534
19551
  const onQuestionChange = useMemo28(
19535
19552
  () => (next) => {
19536
19553
  setQuestion(next);
@@ -19542,21 +19559,21 @@ function useGridDrillConfig(args) {
19542
19559
  },
19543
19560
  [setQuestion, onPresentationChange, presentation]
19544
19561
  );
19545
- const flat = state.filter && !isRuleFilter2(state.filter) ? state.filter : void 0;
19546
- const rule = state.filter && isRuleFilter2(state.filter) ? filterWithTrailRuleOnly(state) : void 0;
19562
+ const flat = state2.filter && !isRuleFilter2(state2.filter) ? state2.filter : void 0;
19563
+ const rule = state2.filter && isRuleFilter2(state2.filter) ? filterWithTrailRuleOnly(state2) : void 0;
19547
19564
  const { config } = useDrill({
19548
- source: state.source,
19549
- question: state.question,
19565
+ source: state2.source,
19566
+ question: state2.question,
19550
19567
  onQuestionChange,
19551
19568
  filter: flat,
19552
19569
  rule,
19553
19570
  version,
19554
- enabled: state.enabled
19571
+ enabled: state2.enabled
19555
19572
  });
19556
19573
  return config;
19557
19574
  }
19558
- function filterWithTrailRuleOnly(state) {
19559
- return state.trailFilter;
19575
+ function filterWithTrailRuleOnly(state2) {
19576
+ return state2.trailFilter;
19560
19577
  }
19561
19578
 
19562
19579
  // src/pointsCost.ts
@@ -19600,18 +19617,18 @@ function ago(at) {
19600
19617
  return at ? formatRelativeTime2(at, { style: "intl", fallback: "" }) : "";
19601
19618
  }
19602
19619
  function EnrichBadge({ cell: cell2, onPin, className }) {
19603
- const state = cellState(cell2);
19604
- if (!cell2 || state === "none") return null;
19620
+ const state2 = cellState(cell2);
19621
+ if (!cell2 || state2 === "none") return null;
19605
19622
  const source = cell2.source ?? {};
19606
19623
  const read = Array.isArray(source.read) ? source.read : [];
19607
19624
  const alternates = cell2.alternates ?? [];
19608
- const word = state === "yours" ? "yours" : state === "unsure" ? "unsure" : "agent";
19625
+ const word = state2 === "yours" ? "yours" : state2 === "unsure" ? "unsure" : "agent";
19609
19626
  return /* @__PURE__ */ jsxs62(HoverCard, { openDelay: 120, children: [
19610
19627
  /* @__PURE__ */ jsx68(HoverCardTrigger, { asChild: true, children: /* @__PURE__ */ jsxs62("span", { className: cn35("inline-flex items-center gap-1 align-middle", className), children: [
19611
19628
  /* @__PURE__ */ jsx68(
19612
19629
  Badge8,
19613
19630
  {
19614
- variant: state === "yours" ? "secondary" : "outline",
19631
+ variant: state2 === "yours" ? "secondary" : "outline",
19615
19632
  className: "text-[10px] font-normal leading-none",
19616
19633
  children: word
19617
19634
  }
@@ -19619,8 +19636,8 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
19619
19636
  cell2.stale ? /* @__PURE__ */ jsx68(Badge8, { variant: "outline", className: "text-[10px] font-normal leading-none opacity-70", children: "stale" }) : null
19620
19637
  ] }) }),
19621
19638
  /* @__PURE__ */ jsxs62(HoverCardContent, { className: "w-80 space-y-2 text-xs", children: [
19622
- /* @__PURE__ */ jsx68("p", { className: "font-medium", children: state === "yours" ? "You typed this one in" : state === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
19623
- state !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ jsxs62("p", { className: "text-muted-foreground", children: [
19639
+ /* @__PURE__ */ jsx68("p", { className: "font-medium", children: state2 === "yours" ? "You typed this one in" : state2 === "unsure" ? "A model had candidates and committed to none" : "Filled in by a model" }),
19640
+ state2 !== "yours" && cell2.on_behalf_of ? /* @__PURE__ */ jsxs62("p", { className: "text-muted-foreground", children: [
19624
19641
  "Acting for ",
19625
19642
  cell2.on_behalf_of,
19626
19643
  cell2.written_at ? `, ${ago(cell2.written_at)}` : "",
@@ -19641,7 +19658,7 @@ function EnrichBadge({ cell: cell2, onPin, className }) {
19641
19658
  /* @__PURE__ */ jsx68("ul", { className: "list-inside list-disc", children: read.slice(0, 4).map((r, i) => /* @__PURE__ */ jsx68("li", { className: "truncate", children: String(r.title ?? r.url ?? "") }, i)) })
19642
19659
  ] }) : null,
19643
19660
  alternates.length > 0 ? /* @__PURE__ */ jsxs62("div", { children: [
19644
- /* @__PURE__ */ jsx68("p", { className: "text-muted-foreground", children: state === "unsure" ? "What it considered" : "What it nearly said instead" }),
19661
+ /* @__PURE__ */ jsx68("p", { className: "text-muted-foreground", children: state2 === "unsure" ? "What it considered" : "What it nearly said instead" }),
19645
19662
  /* @__PURE__ */ jsx68("ul", { className: "list-inside list-decimal", children: alternates.slice(0, 4).map((a, i) => /* @__PURE__ */ jsx68("li", { children: String(a.value ?? "") }, i)) })
19646
19663
  ] }) : null,
19647
19664
  cell2.stale && cell2.due_at ? /* @__PURE__ */ jsxs62("p", { className: "text-muted-foreground", children: [
@@ -25352,19 +25369,19 @@ function StructureLocked({ className }) {
25352
25369
  // src/viewAddress.ts
25353
25370
  import { createContext as createContext8, useContext as useContext8 } from "react";
25354
25371
  var VIEW_ADDRESS_KEYS = ["sort", "cf", "q", "hide", "page"];
25355
- function isViewAddressEmpty(state) {
25356
- if (!state) return true;
25357
- return !state.sort && Object.keys(state.filters ?? {}).length === 0 && !(state.search ?? "").trim() && (state.hidden?.length ?? 0) === 0 && !(state.page && state.page > 1);
25372
+ function isViewAddressEmpty(state2) {
25373
+ if (!state2) return true;
25374
+ return !state2.sort && Object.keys(state2.filters ?? {}).length === 0 && !(state2.search ?? "").trim() && (state2.hidden?.length ?? 0) === 0 && !(state2.page && state2.page > 1);
25358
25375
  }
25359
- function viewAddressToParams(state) {
25376
+ function viewAddressToParams(state2) {
25360
25377
  const out = {};
25361
- if (!state) return out;
25362
- if (state.sort) out["sort"] = `${state.sort.field}:${state.sort.direction}`;
25363
- const filters = Object.fromEntries(Object.entries(state.filters ?? {}).filter(([, v]) => v !== void 0 && v !== null));
25378
+ if (!state2) return out;
25379
+ if (state2.sort) out["sort"] = `${state2.sort.field}:${state2.sort.direction}`;
25380
+ const filters = Object.fromEntries(Object.entries(state2.filters ?? {}).filter(([, v]) => v !== void 0 && v !== null));
25364
25381
  if (Object.keys(filters).length > 0) out["cf"] = JSON.stringify(filters);
25365
- if ((state.search ?? "").trim()) out["q"] = (state.search ?? "").trim();
25366
- if (state.hidden && state.hidden.length > 0) out["hide"] = JSON.stringify(state.hidden);
25367
- if (state.page && state.page > 1) out["page"] = String(Math.floor(state.page));
25382
+ if ((state2.search ?? "").trim()) out["q"] = (state2.search ?? "").trim();
25383
+ if (state2.hidden && state2.hidden.length > 0) out["hide"] = JSON.stringify(state2.hidden);
25384
+ if (state2.page && state2.page > 1) out["page"] = String(Math.floor(state2.page));
25368
25385
  return out;
25369
25386
  }
25370
25387
  function viewAddressFromParams(get) {
@@ -29231,7 +29248,7 @@ function TimeZoneInput({
29231
29248
  "aria-label": label
29232
29249
  }
29233
29250
  ),
29234
- /* @__PURE__ */ jsx93("datalist", { id: listId, children: TIME_ZONES.map((zone2) => /* @__PURE__ */ jsx93("option", { value: zone2 }, zone2)) })
29251
+ /* @__PURE__ */ jsx93("datalist", { id: listId, children: TIME_ZONES.map((zone) => /* @__PURE__ */ jsx93("option", { value: zone }, zone)) })
29235
29252
  ] });
29236
29253
  }
29237
29254
 
@@ -33153,7 +33170,7 @@ async function declare(client, spec) {
33153
33170
  }
33154
33171
  function usePlatformTable(spec) {
33155
33172
  const client = useRecordsClient66();
33156
- const [state, setState] = useState94({ tableId: null, loading: true, error: null });
33173
+ const [state2, setState] = useState94({ tableId: null, loading: true, error: null });
33157
33174
  const slug = spec.slug;
33158
33175
  const stable = useMemo52(() => spec, [slug]);
33159
33176
  useEffect75(() => {
@@ -33169,7 +33186,7 @@ function usePlatformTable(spec) {
33169
33186
  cancelled = true;
33170
33187
  };
33171
33188
  }, [client, stable]);
33172
- return state;
33189
+ return state2;
33173
33190
  }
33174
33191
 
33175
33192
  // src/viewLook.ts
@@ -37930,7 +37947,7 @@ function chartQuestion(view, fields) {
37930
37947
  function ChartLayout({ view, fields, filter, onChange, remembered }) {
37931
37948
  const client = useRecordsClient70();
37932
37949
  const q = useMemo61(() => chartQuestion(view, fields), [view, fields]);
37933
- const [state, setState] = useState105({ block: null, error: null });
37950
+ const [state2, setState] = useState105({ block: null, error: null });
37934
37951
  const filterKey = JSON.stringify(filter ?? {});
37935
37952
  const qKey = JSON.stringify(q);
37936
37953
  useEffect86(() => {
@@ -37998,7 +38015,7 @@ function ChartLayout({ view, fields, filter, onChange, remembered }) {
37998
38015
  MEASURE_LABEL2[isChartMeasure(view.chartMeasure) ? view.chartMeasure : "count"],
37999
38016
  " needs a number field \u2014 pick one above. Counting until then."
38000
38017
  ] }) : null,
38001
- state.error ? /* @__PURE__ */ jsx127(RefusalNotice, { error: state.error }) : state.block ? /* @__PURE__ */ jsx127(ChartBlock, { block: state.block, subject: view.subject, variant: "bare", centerValue: true }) : null
38018
+ state2.error ? /* @__PURE__ */ jsx127(RefusalNotice, { error: state2.error }) : state2.block ? /* @__PURE__ */ jsx127(ChartBlock, { block: state2.block, subject: view.subject, variant: "bare", centerValue: true }) : null
38002
38019
  ] });
38003
38020
  }
38004
38021
 
@@ -39643,7 +39660,7 @@ function SectionBox({ id, children, ...rest }) {
39643
39660
  return /* @__PURE__ */ jsx131("div", { ref: setNodeRef, className: cn65("rounded-sm", isOver && "bg-accent/40"), ...rest, children });
39644
39661
  }
39645
39662
  function SortableRow({ id, disabled, children }) {
39646
- const { attributes, listeners: listeners2, setNodeRef, transform, transition, isDragging } = useSortable({ id, disabled });
39663
+ const { attributes, listeners, setNodeRef, transform, transition, isDragging } = useSortable({ id, disabled });
39647
39664
  return /* @__PURE__ */ jsx131(
39648
39665
  "div",
39649
39666
  {
@@ -39652,7 +39669,7 @@ function SortableRow({ id, disabled, children }) {
39652
39669
  className: cn65(isDragging && "relative z-10 opacity-80"),
39653
39670
  "data-view-row": id,
39654
39671
  ...disabled ? {} : attributes,
39655
- ...disabled ? {} : listeners2,
39672
+ ...disabled ? {} : listeners,
39656
39673
  children
39657
39674
  }
39658
39675
  );
@@ -41904,8 +41921,8 @@ function planUndo(changes, current, only) {
41904
41921
  const doc = current ?? {};
41905
41922
  return changes.filter((change) => !only || change.key === only).map((change) => {
41906
41923
  const now = doc[change.key];
41907
- const state = sameValue2(now, change.before) ? "already" : sameValue2(now, change.after) ? "clean" : "conflict";
41908
- return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state };
41924
+ const state2 = sameValue2(now, change.before) ? "already" : sameValue2(now, change.after) ? "clean" : "conflict";
41925
+ return { key: change.key, label: change.label, current: now, after: change.after, before: change.before, state: state2 };
41909
41926
  });
41910
41927
  }
41911
41928
  function undoPatch(lines, replaceLaterEdits) {
@@ -41937,11 +41954,11 @@ import { Button as Button84, Skeleton as Skeleton21, cn as cn69 } from "@ai-matr
41937
41954
  import { Button as ControlButton2, Field as ControlField } from "@ai-matrx/design-system/controls";
41938
41955
  import { humanizeIdentifier as humanizeIdentifier16 } from "@ai-matrx/kit/text-case";
41939
41956
  import { Fragment as Fragment52, jsx as jsx135, jsxs as jsxs123 } from "react/jsx-runtime";
41940
- function endOfDayIso(day2, zone2 = getPersonTimeZone()) {
41957
+ function endOfDayIso(day2, zone = getPersonTimeZone()) {
41941
41958
  const [y, m, d] = day2.split("-").map(Number);
41942
- if (!zone2) return new Date(y, m - 1, d, 23, 59, 59, 999).toISOString();
41959
+ if (!zone) return new Date(y, m - 1, d, 23, 59, 59, 999).toISOString();
41943
41960
  const wall = (at) => {
41944
- const parts = new Intl.DateTimeFormat("en-US", { timeZone: zone2, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" }).formatToParts(new Date(at));
41961
+ const parts = new Intl.DateTimeFormat("en-US", { timeZone: zone, year: "numeric", month: "2-digit", day: "2-digit", hour: "2-digit", minute: "2-digit", second: "2-digit", hourCycle: "h23" }).formatToParts(new Date(at));
41945
41962
  const n = (t) => Number(parts.find((p) => p.type === t)?.value ?? 0);
41946
41963
  return Date.UTC(n("year"), n("month") - 1, n("day"), n("hour"), n("minute"), n("second"));
41947
41964
  };
@@ -41950,8 +41967,8 @@ function endOfDayIso(day2, zone2 = getPersonTimeZone()) {
41950
41967
  for (let i = 0; i < 2; i += 1) guess -= wall(guess) - target;
41951
41968
  return new Date(guess + 999).toISOString();
41952
41969
  }
41953
- function asOfArgs(record_id, asOf, zone2 = getPersonTimeZone()) {
41954
- return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone2) } : { record_id, world_on: asOf.day };
41970
+ function asOfArgs(record_id, asOf, zone = getPersonTimeZone()) {
41971
+ return asOf.clock === "recorded" ? { record_id, recorded_at: endOfDayIso(asOf.day, zone) } : { record_id, world_on: asOf.day };
41955
41972
  }
41956
41973
  function AsOfControl({ value, onChange, className }) {
41957
41974
  const [text, setText] = useState113(value ? typedDateText3(value.day) : "");
@@ -42054,12 +42071,12 @@ function AsOfReading({
42054
42071
  className
42055
42072
  }) {
42056
42073
  const client = useRecordsClient78();
42057
- const zone2 = usePersonTimeZone();
42074
+ const zone = usePersonTimeZone();
42058
42075
  const [answer, setAnswer] = useState113(null);
42059
- const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone2 ?? ""}`;
42076
+ const key = `${recordId}|${asOf.clock}|${asOf.day}|${zone ?? ""}`;
42060
42077
  useEffect94(() => {
42061
42078
  let live = true;
42062
- void client.recordAsOf(asOfArgs(recordId, asOf, zone2)).then((got) => {
42079
+ void client.recordAsOf(asOfArgs(recordId, asOf, zone)).then((got) => {
42063
42080
  if (!live) return;
42064
42081
  setAnswer(got.ok ? { key, doc: got.data } : { key, error: got.error });
42065
42082
  });
@@ -44356,7 +44373,7 @@ function People({
44356
44373
  said2 ? /* @__PURE__ */ jsx144("p", { className: "text-xs text-muted-foreground", children: said2 }) : null,
44357
44374
  card.principals.length === 0 ? /* @__PURE__ */ jsx144("p", { className: "text-xs text-muted-foreground", children: "Nobody yet. Inviting somebody below emails them a sign-in link; it gives them nothing until they follow it." }) : null,
44358
44375
  card.principals.map((person) => {
44359
- const state = stateWords(person);
44376
+ const state2 = stateWords(person);
44360
44377
  const asking = askingToRevoke?.principal_id === person.principal_id;
44361
44378
  const showing = previewing?.principal_id === person.principal_id;
44362
44379
  return /* @__PURE__ */ jsxs132(
@@ -44366,10 +44383,10 @@ function People({
44366
44383
  children: [
44367
44384
  /* @__PURE__ */ jsxs132("div", { className: "flex flex-wrap items-center gap-1.5", children: [
44368
44385
  /* @__PURE__ */ jsx144("span", { className: "min-w-0 flex-1 truncate font-medium", children: person.client || person.email }),
44369
- /* @__PURE__ */ jsx144(Badge22, { variant: state.tone, children: state.label })
44386
+ /* @__PURE__ */ jsx144(Badge22, { variant: state2.tone, children: state2.label })
44370
44387
  ] }),
44371
44388
  /* @__PURE__ */ jsx144("p", { className: "mt-0.5 break-all text-muted-foreground", children: person.email }),
44372
- /* @__PURE__ */ jsx144("p", { className: "mt-0.5 text-muted-foreground", children: state.why }),
44389
+ /* @__PURE__ */ jsx144("p", { className: "mt-0.5 text-muted-foreground", children: state2.why }),
44373
44390
  person.is_active ? /* @__PURE__ */ jsxs132("div", { className: "mt-1.5 flex flex-wrap gap-1.5", children: [
44374
44391
  person.accept_path ? /* @__PURE__ */ jsx144(CopyLink, { url: `${here}${person.accept_path}`, what: "their link" }) : null,
44375
44392
  /* @__PURE__ */ jsx144(
@@ -44698,8 +44715,8 @@ function scheduleWords(schedule, tz) {
44698
44715
  if (words2.length === 0) return null;
44699
44716
  const time = words2.find((w) => /^\d{1,2}:\d{2}$/.test(w)) ?? null;
44700
44717
  const day2 = words2.map((w) => DAYS3[w.slice(0, 3)]).find(Boolean) ?? null;
44701
- const zone2 = tz?.trim() ? `${tz.trim()} time` : "UTC";
44702
- const at = time ? `at ${time.padStart(5, "0")}, ${zone2}` : null;
44718
+ const zone = tz?.trim() ? `${tz.trim()} time` : "UTC";
44719
+ const at = time ? `at ${time.padStart(5, "0")}, ${zone}` : null;
44703
44720
  return [day2, at].filter(Boolean).join(" ") || null;
44704
44721
  }
44705
44722
 
@@ -47063,7 +47080,7 @@ function FormBuilder({ tableId, seed, activeFormId, onActiveForm, startWithOne,
47063
47080
  }
47064
47081
  function PublishRow({
47065
47082
  url,
47066
- state,
47083
+ state: state2,
47067
47084
  mayPublish,
47068
47085
  why,
47069
47086
  busy,
@@ -47073,7 +47090,7 @@ function PublishRow({
47073
47090
  onCopy,
47074
47091
  unsaved = false
47075
47092
  }) {
47076
- const open = state === "open";
47093
+ const open = state2 === "open";
47077
47094
  return /* @__PURE__ */ jsxs139("div", { className: "flex flex-col gap-1.5 rounded border px-2.5 py-2", children: [
47078
47095
  /* @__PURE__ */ jsxs139("div", { className: "flex flex-wrap items-center gap-2", children: [
47079
47096
  mayPublish ? /* @__PURE__ */ jsx151(
@@ -47086,7 +47103,7 @@ function PublishRow({
47086
47103
  children: busy ? "\u2026" : open ? "Unpublish" : unsaved ? "Save and publish" : "Publish"
47087
47104
  }
47088
47105
  ) : null,
47089
- state !== "draft" ? /* @__PURE__ */ jsxs139(Fragment60, { children: [
47106
+ state2 !== "draft" ? /* @__PURE__ */ jsxs139(Fragment60, { children: [
47090
47107
  /* @__PURE__ */ jsx151(
47091
47108
  OutboundLink7,
47092
47109
  {
@@ -47098,7 +47115,7 @@ function PublishRow({
47098
47115
  /* @__PURE__ */ jsx151(Button98, { size: "sm", variant: "outline", onClick: () => onCopy(url), children: copied ? "Copied" : "Copy link" })
47099
47116
  ] }) : null
47100
47117
  ] }),
47101
- /* @__PURE__ */ jsx151("p", { className: "w-fit text-xs text-muted-foreground", title: FORM_STATE_WORDS[state], "data-records-form-state": state, children: FORM_STATE_LABELS[state] }),
47118
+ /* @__PURE__ */ jsx151("p", { className: "w-fit text-xs text-muted-foreground", title: FORM_STATE_WORDS[state2], "data-records-form-state": state2, children: FORM_STATE_LABELS[state2] }),
47102
47119
  open && unsaved ? /* @__PURE__ */ jsx151("p", { className: "text-xs text-muted-foreground", "data-records-form-unsaved": "", children: "Unsaved changes \u2014 the live form shows your last save" }) : null,
47103
47120
  !mayPublish ? /* @__PURE__ */ jsx151("p", { className: "w-fit text-xs text-muted-foreground", title: why, children: "Publishing needs table admin" }) : null,
47104
47121
  shownUrl ? /* @__PURE__ */ jsxs139("p", { className: "break-all rounded border border-dashed px-2 py-1 text-xs", title: "This browser would not copy for you.", children: [
@@ -55884,6 +55901,7 @@ export {
55884
55901
  styleFromDecorations,
55885
55902
  submissionStamp2 as submissionStamp,
55886
55903
  subscribeCalendarAction,
55904
+ subscribePersonTimeZone,
55887
55905
  surfaceChosen,
55888
55906
  tableActions,
55889
55907
  tableLink,